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
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as o from"react";import{useRef as i,useMemo as r,useEffect as a,useContext as s,useCallback as l,useSyncExternalStore as c,createContext as u,useState as d,useLayoutEffect as h,forwardRef as g,useId as f,useImperativeHandle as p}from"react";import{select as y}from"d3-selection";import{brushX as m,brushY as v,brush as b}from"d3-brush";import{scaleOrdinal as x,scaleLinear as k,scaleLog as w,scaleTime as A,scaleBand as S,scaleSequential as O}from"d3-scale";import{quadtree as C}from"d3-quadtree";import{curveNatural as j,curveBasis as M,curveStepAfter as _,curveStepBefore as P,curveStep as L,curveCatmullRom as T,curveCardinal as $,curveMonotoneY as N,curveMonotoneX as B,line as D,area as E,curveLinear as I,arc as R,pie as H}from"d3-shape";import{bin as F,quantile as W,min as z,groups as Y,max as G,sum as q,mean as X,group as V}from"d3-array";import{packEnclose as U,hierarchy as Q,partition as K,pack as Z,treemap as J,treemapBinary as ee,cluster as te,tree as ne}from"d3-hierarchy";import oe from"regression";import{interpolateNumber as ie}from"d3-interpolate";import{forceLink as re,forceSimulation as ae,forceManyBody as se,forceCenter as le,forceX as ce,forceY as ue}from"d3-force";import{ribbon as de,chord as he}from"d3-chord";function ge(e,t){let n=0,o=t.length-1;for(;o>n;){const i=n+o+1>>1;t[i]>e?o=i-1:n=i}return t[n]}function fe(e,t){let n=0,o=t.length-1;for(;o>n;){const i=n+o>>1;e>t[i]?n=i+1:o=i}return t[n]}function pe({width:t,height:n,totalWidth:o,totalHeight:s,margin:l,dimension:c,scales:u,onBrush:d,binSize:h,snap:g,binBoundaries:f,snapDuring:p,streaming:x}){const k=i(null),w=i(null),A=i(d);A.current=d;const S=i(u);S.current=u;const O=r(()=>f?[...f].sort((e,t)=>e-t):void 0,[f]),C=i(O);C.current=O;const j=i(!1),M=i(null);return a(()=>{if(!k.current)return;const e=y(k.current).select(".brush-g"),o="x"===c?m():"y"===c?v():b();return o.extent([[0,0],[t,n]]),o.on("brush end",i=>{if(j.current)return;const r=S.current;if(!r)return;if(!i.selection)return M.current=null,void A.current(null);let a,s;if("x"===c){const[e,t]=i.selection;a=[r.x.invert(e),r.x.invert(t)],s=[r.y.invert(n),r.y.invert(0)]}else if("y"===c){const[e,n]=i.selection;a=[r.x.invert(0),r.x.invert(t)],s=[r.y.invert(n),r.y.invert(e)]}else{const[[e,t],[n,o]]=i.selection;a=[r.x.invert(e),r.x.invert(n)],s=[r.y.invert(o),r.y.invert(t)]}if("bin"===g&&"y"!==c&&("end"===i.type||"brush"===i.type&&p)){const t=C.current;t&&t.length>0?a=function(e,t){return 0===t.length?e:[ge(e[0],t),fe(e[1],t)]}(a,t):h&&h>0&&(a=[Math.floor(a[0]/h)*h,Math.ceil(a[1]/h)*h]);const n=r.x(a[0]),s=r.x(a[1]);if(j.current=!0,"x"===c)e.call(o.move,[n,s]);else if("xy"===c){const t=i.selection;e.call(o.move,[[n,t[0][1]],[s,t[1][1]]])}j.current=!1}const l={x:a,y:s};M.current=l,A.current(l)}),e.call(o),w.current=o,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{o.on("brush end",null),w.current=null}},[t,n,c,g,h,p]),a(()=>{if(!(x&&u&&w.current&&M.current))return;if(!k.current)return;if("y"===c)return;const e=M.current,t=u.x.domain()[0],n=y(k.current).select(".brush-g");if(t>=e.x[1])return j.current=!0,n.call(w.current.move,null),j.current=!1,M.current=null,void A.current(null);let o=e.x[0],i=!1;if(t>e.x[0]){if(o=t,"bin"===g){const e=C.current;e&&e.length>0?o=fe(t,e):h&&h>0&&(o=Math.ceil(t/h)*h)}if(o>=e.x[1])return j.current=!0,n.call(w.current.move,null),j.current=!1,M.current=null,void A.current(null);i=!0}const r=u.x(o),a=u.x(e.x[1]);if(j.current=!0,"x"===c)n.call(w.current.move,[r,a]);else{const t=u.y(e.y[1]),o=u.y(e.y[0]);n.call(w.current.move,[[r,t],[a,o]])}if(j.current=!1,i){const t={x:[o,e.x[1]],y:e.y};M.current=t,A.current(t)}},[u,x,c,g,h]),e("svg",{ref:k,width:o,height:s,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:e("g",{className:"brush-g",transform:`translate(${l.left},${l.top})`})})}const ye=Object.freeze([]);function me(e){if(!e)return ye;let t=!1;for(let n=0;e.length>n;n++){const o=e[n];if(null==o||"object"!=typeof o){t=!0;break}}if(!t)return e;const n=[];for(const t of e)null!=t&&"object"==typeof t&&n.push(t);return n}class ve{constructor(e,t){var n,o;this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=e,this.chunkThreshold=null!==(n=null==t?void 0:t.chunkThreshold)&&void 0!==n?n:5e3,this.chunkSize=null!==(o=null==t?void 0:t.chunkSize)&&void 0!==o?o: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=me(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 n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}setReplacementData(e){if(e=me(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 n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}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 n=0;e.length>n;n++){const o=e[n];null!=o&&"object"==typeof o&&(this.pushBuffer.push(o),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 be(t){let n=null;const o=()=>(n||(n=u(null)),n),a=xe(t);return[function({children:n,initialState:a}){const s=i(a),l=r(()=>xe(t,s.current),[]),c=o();return e(c.Provider,{value:l,children:n})},e=>{var t;const n=o(),r=null!==(t=s(n))&&void 0!==t?t:a,u=i(e);u.current=e;const d=l(()=>u.current(r.getState()),[r]),h=l(()=>u.current(r.getState()),[r]);return c(r.subscribe,d,h)}]}function xe(e,t){const n=new EventTarget;let o=Object.assign(Object.assign({},e(function(e){o=Object.assign(Object.assign({},o),e(o)),n.dispatchEvent(new Event("update"))})),null!=t?t:{});return{getState:()=>o,subscribe:function(e){return n.addEventListener("update",e),()=>n.removeEventListener("update",e)}}}function ke(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 we(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:Ae})})),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 Ae=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],Se={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}},Oe={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}},Ce={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:Ae,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 je(e,t){if("light"===t)return Se;if("dark"===t)return Oe;if("high-contrast"===t)return Ce;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?Oe:Se;return we(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 we(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[Me,_e]=be(e=>({theme:Se,setTheme(t){e(e=>({theme:je(e.theme,t)}))}}));class Pe{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;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 n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray(),n=[];for(;t.length>e;)n.push(t.shift());this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(const e of t)this.push(e);return n}update(e,t){const n=[],o=(this.head-this._size+this._capacity)%this._capacity;for(let i=0;this._size>i;i++){const r=(o+i)%this._capacity,a=this.buffer[r];if(e(a)){let e;e="object"!=typeof a||null===a?a:Array.isArray(a)?[...a]:Object.assign({},a),n.push(e),this.buffer[r]=t(a)}}return n}remove(e){const t=[],n=[];if(this.forEach(o=>{e(o)?n.push(o):t.push(o)}),0===n.length)return n;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}}class Le{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 n of e){const e=t?t(n):n;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 Te(e,t,n,o,i){const r=new Map;for(const a of e){const e=t(a),s=n(a);if(null==e||null==s||Number.isNaN(e)||Number.isNaN(s))continue;const l=Math.floor(e/o)*o;let c=r.get(l);if(c||(c={start:l,end:l+o,total:0,categories:new Map},r.set(l,c)),c.total+=s,i){const e=i(a);c.categories.set(e,(c.categories.get(e)||0)+s)}}return r}function $e(e,t,n,o,i,r){const a=[];for(const i of e){const e=n(i),r=o(i);Number.isFinite(e)&&Number.isFinite(r)&&a.push({px:t.x(e),py:t.y(r),rawY:r,d:i})}a.sort((e,t)=>e.px-t.px);const s=Array(a.length),l=Array(a.length),c=Array(a.length);for(let e=0;a.length>e;e++){const t=a[e];s[e]=[t.px,t.py],l[e]=t.rawY,c[e]=t.d}return{type:"line",path:s,rawValues:l,style:i,datum:c,group:r}}function Ne(e,t,n,o,i,r,a,s){const l=[];for(const r of e){const e=n(r),a=o(r);if(!Number.isFinite(e)||!Number.isFinite(a))continue;const c=t.x(e),u=s?s(r):i;l.push({px:c,topY:t.y(a),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:a}}function Be(e,t,n,o){var i,r,a;const s=new Map;if("silhouette"===o)for(const o of e){let e=0;for(const i of t)e+=n(i,o)||0;s.set(o,-e/2)}else if("wiggle"===o){e.length>0&&s.set(e[0],0);for(let o=1;e.length>o;o++){const r=e[o-1],a=e[o];let l=0,c=0,u=0;for(const e of t){const t=n(e,a)||0;l+=(2*u+t)*(t-(n(e,r)||0)),c+=t,u+=t}const d=null!==(i=s.get(r))&&void 0!==i?i:0;s.set(a,d-(c>0?l/(2*c):0))}if(e.length>0){let o=0;for(const i of e){let e=0;for(const o of t)e+=n(o,i)||0;o+=(null!==(r=s.get(i))&&void 0!==r?r:0)+e/2}const i=o/e.length;for(const t of e)s.set(t,(null!==(a=s.get(t))&&void 0!==a?a:0)-i)}}else for(const t of e)s.set(t,0);return s}function De(e,t,n,o,i,r,a){const s=n(e),l=o(e);if(!Number.isFinite(s)||!Number.isFinite(l))return null;const c={type:"point",x:t.x(s),y:t.y(l),r:i,style:r,datum:e};return void 0!==a&&(c.pointId=a),c}function Ee(e,t,n,o,i,r,a){return{type:"rect",x:e,y:t,w:n,h:o,style:i,datum:r,group:a}}function Ie(e,t,n,o,i,r,a){const s={type:"heatcell",x:e,y:t,w:n,h:o,fill:i,datum:r};return(null==a?void 0:a.showValues)&&(s.showValues=!0,s.value=a.value,a.valueFormat&&(s.valueFormat=a.valueFormat)),s}function Re(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function He(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function Fe(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function We(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}function ze(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function Ye(e,t,n){const o=e=>e.toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function Ge(e){const t=e.map(ze),n=t.length-1;return e=>{if(0>=e){const[e,n,o]=t[0];return Ye(e,n,o)}if(e>=1){const[e,o,i]=t[n];return Ye(e,o,i)}const o=e*n,i=Math.floor(o),r=o-i,[a,s,l]=t[i],[c,u,d]=t[i+1];return Ye(Math.round(a+(c-a)*r),Math.round(s+(u-s)*r),Math.round(l+(d-l)*r))}}const qe=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Xe=Ge(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),Ve=Ge(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),Ue=Ge(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),Qe=Ge(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),Ke=Ge(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),Ze=Ge(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),Je=Ge(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),et=Ge(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),tt=Ge(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),nt=Ge(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),ot=Ge(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),it=Ge(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]),rt=Ge(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),at=Ge(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),st=Ge(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),lt=Ge(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),ct=Ge(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),ut=Ge(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),dt=Ge(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]),ht={category10:qe,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:Xe,reds:Ve,greens:Ue,oranges:Qe,purples:Ke,viridis:Je,plasma:et},gt=qe,ft=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],pt=["#f0f0f0","#b5d4ea","#f4c2a1","#b8dab2","#d4b5e0","#f9e0a2","#a8d8d8"],yt=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 mt(e,t,n){if("function"==typeof t){const o=t(e);return n&&o&&"string"==typeof o&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||yt.has(t)}(o)?n(o):o}const o=(null==e?void 0:e[t])+"";return n?n(o):gt[Math.abs(function(e){let t=0;for(let n=0;e.length>n;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return Math.abs(t)}(o))%gt.length]}function vt(e,t,n="category10"){const o=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e).map(e=>e+""))),i=o.every(e=>!isNaN(Number(e)));if(Array.isArray(n))return x().domain(o).range(n).unknown("#999");const r=ht[n]||ht.category10;if(i&&"function"==typeof r){let e=-1/0;for(const t of o){const n=Number(t);n>e&&(e=n)}return t=>r(Number(t)/e)}{const e=Array.isArray(r)?r:gt;return x().domain(o).range(e).unknown("#999")}}function bt(e,t,n=[3,20],o){let i;if(i="function"==typeof t?t(e):null==e?void 0:e[t],!o)return i;const[r,a]=o,[s,l]=n;if(a===r)return(s+l)/2;let c=(i-r)/(a-r);return 0>c?c=0:c>1&&(c=1),s+c*(l-s)}function xt(e,t,n){var o,i,r;if(1>=n)return 1;const a=null!==(o=e.minOpacity)&&void 0!==o?o:.1,s=n-1-t;switch(e.type){case"linear":return a+(1-s/(n-1))*(1-a);case"exponential":{const t=null!==(i=e.halfLife)&&void 0!==i?i:n/2;return a+Math.pow(.5,s/t)*(1-a)}case"step":return(null!==(r=e.stepThreshold)&&void 0!==r?r:.5*n)>s?1:a;default:return 1}}function kt(e,t,n){var o;const i=null!==(o=e.duration)&&void 0!==o?o:500,r=n-t;return i>r?1-r/i:0}function wt(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}function At(e,t){return Math.min((e-t.startTime)/t.duration,1)}function St(e,t,n){return e+(t-e)*n}function Ot(){return"undefined"!=typeof performance?performance.now():Date.now()}function Ct(e,t,n){var o,i,r,a;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 n=e.getX(t.datum),o=e.getY(t.datum);if(e.getCategory)return`p:${e.getCategory(t.datum)}:${n}:${o}`;if(null!=n&&null!=o)return`p:${n}:${o}`}return"p:"+n;case"rect":return`r:${t.group||""}:${null!==(a=null!==(i=null===(o=t.datum)||void 0===o?void 0:o.binStart)&&void 0!==i?i:null===(r=t.datum)||void 0===r?void 0:r.category)&&void 0!==a?a:n}`;case"heatcell":return`h:${t.x}_${t.y}`;case"candlestick":return null==t.datum?"c:"+n:"c:"+e.getX(t.datum);case"line":return"l:"+(t.group||"_default");case"area":return"a:"+(t.group||"_default");default:return null}}function jt(e,t,n,o){return"function"==typeof t.style?t.style(o||{},n):t.style&&"object"==typeof t.style?t.style:e.resolveBoundsStyle(n,o)}function Mt(e,t,n,o){if(!e.scales)return null;const i=[],r=[];for(const n of t){const t=e.getX(n);if(!Number.isFinite(t))continue;const a=o.getTop(n),s=o.getBottom(n);if(!Number.isFinite(a)||!Number.isFinite(s))continue;const l=e.scales.x(t),c=e.scales.y(a),u=e.scales.y(s);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:jt(e,o,n,t[0]),datum:t,group:n,interactive:o.interactive}}function _t(e){const t=[],n=[];if(!e)return{perSeries:t,aggregate:n};for(const o of e)o.perSeries?t.push(o):n.push(o);return{perSeries:t,aggregate:n}}function Pt(e,t,n){const o=[];for(const i of n){const n=Mt(e,t,"__ribbon_aggregate",i);n&&o.push(n)}return o}function Lt(e,t,n,o){const i=[];for(const r of o){const o=Mt(e,t,n,r);o&&i.push(o)}return i}function Tt(e,t){if(!e)return{};if(!t||0===t.length)return e;const n=[];for(const o of t){if("band"!==o.kind)continue;const t=o.getTop(e),i=o.getBottom(e);Number.isFinite(i)&&Number.isFinite(t)&&n.push({y0:i,y1:t})}return 0===n.length?e:Object.assign(Object.assign({},e),{band:n[0],bands:n})}function $t(e,t,n,o){var i;if(!e.config.pointStyle)return;const r=null!=o?o:e.getY;for(const o of t){const t=e.resolveGroupColor(o.key);for(const a of o.data){let o=e.config.pointStyle(a);!o.fill&&t&&(o=Object.assign(Object.assign({},o),{fill:t}));const s=null!==(i=o.r)&&void 0!==i?i:3,l=e.getPointId?e.getPointId(a)+"":void 0,c=De(a,e.scales,e.getX,r,s,o,l);c&&n.push(c)}}}const Nt={topOpacity:.8,bottomOpacity:.05};function Bt(e){var t,n;if(e)return!0===e?Nt:"colorStops"in e?e:{topOpacity:null!==(t=e.topOpacity)&&void 0!==t?t:Nt.topOpacity,bottomOpacity:null!==(n=e.bottomOpacity)&&void 0!==n?n:Nt.bottomOpacity}}const Dt={blues:Xe,reds:Ve,greens:Ue,viridis:Je,oranges:Qe,purples:Ke,greys:Ze,plasma:et,inferno:tt,magma:nt,cividis:ot,turbo:it},Et=new Map;function It(e,t){const n="function"==typeof e?e:n=>n[e||t];return e=>{const t=n(e);return null==t?NaN:+t}}function Rt(e){const t=[],n=["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode,o=It(n&&e.valueAccessor||e.yAccessor,n?"value":"y");if(e.boundsAccessor){const n=He(e.boundsAccessor,"bounds");t.push({kind:"bounds",getTop:e=>{const t=o(e);if(!Number.isFinite(t))return NaN;const i=n(e);return Number.isFinite(i)&&0!==i?t+i:t},getBottom:e=>{const t=o(e);if(!Number.isFinite(t))return NaN;const i=n(e);return Number.isFinite(i)&&0!==i?t-i:t},style:e.boundsStyle,perSeries:!0,interactive:!1})}if(e.band){const n=Array.isArray(e.band)?e.band:[e.band];for(const e of n)t.push({kind:"band",getTop:It(e.y1Accessor,"y1"),getBottom:It(e.y0Accessor,"y0"),style:e.style,perSeries:!1!==e.perSeries,interactive:!0===e.interactive})}return t}class Ht{constructor(e){if(this.xExtent=new Le,this.yExtent=new Le,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 Pe(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=He(e.timeAccessor||e.xAccessor,"time"),this.getY=He(e.valueAccessor||e.yAccessor,"value")):(this.getX=He(e.xAccessor,"x"),this.getY=He(e.yAccessor,"y")),this.getGroup=We(e.groupAccessor),this.getCategory=We(e.categoryAccessor),this.getSize=e.sizeAccessor?He(e.sizeAccessor,"size"):void 0,this.getColor=We(e.colorAccessor),this.getY0=e.y0Accessor?He(e.y0Accessor,"y0"):void 0,this.resolvedRibbons=Rt(e),this.getPointId=We(e.pointIdAccessor),"candlestick"===e.chartType){const t=null!=e.openAccessor,n=null!=e.closeAccessor;this.getOpen=t?He(e.openAccessor,"open"):void 0,this.getHigh=He(e.highAccessor,"high"),this.getLow=He(e.lowAccessor,"low"),this.getClose=n?He(e.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!t&&!n}e.pulse&&(this.timestampBuffer=new Pe(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 n=t.getTop(e),o=t.getBottom(e);Number.isFinite(n)&&this.yExtent.push(n),Number.isFinite(o)&&this.yExtent.push(o)}}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?He(this.config.timeAccessor||this.config.xAccessor,"time"):He(this.config.xAccessor,"x"),this.xIsDate=!1,e.inserts.length>0){const t=e.inserts[0],n=this.config.xAccessor,o="function"==typeof n?n(t):t[n||"x"],i=o instanceof Date,r="string"==typeof o&&o.length>=10&&!isNaN(new Date(o).getTime())&&isNaN(Number(o));if(this.xIsDate=i||r,r){const e="string"==typeof n?n:void 0;this.getX=e?t=>+new Date(t[e]):e=>+(n(e)instanceof Date?n(e):new Date(n(e)))}}const n=e.totalSize||e.inserts.length;n>this.buffer.capacity&&(this.buffer.resize(n),this.timestampBuffer&&n>this.timestampBuffer.capacity&&this.timestampBuffer.resize(n));for(const n of e.inserts)if(this.buffer.push(n),this.timestampBuffer&&this.timestampBuffer.push(t),this.xExtent.push(this.getX(n)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow)this.yExtent.push(this.getHigh(n)),this.yExtent.push(this.getLow(n));else{this.yExtent.push(this.getY(n)),this.getY0&&this.yExtent.push(this.getY0(n));for(const e of this.resolvedRibbons){const t=e.getTop(n),o=e.getBottom(n);Number.isFinite(t)&&this.yExtent.push(t),Number.isFinite(o)&&this.yExtent.push(o)}}}else for(const n 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(n);if(this.timestampBuffer&&this.timestampBuffer.push(t),this.xExtent.push(this.getX(n)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow)this.yExtent.push(this.getHigh(n)),this.yExtent.push(this.getLow(n));else{this.yExtent.push(this.getY(n)),this.getY0&&this.yExtent.push(this.getY0(n));for(const e of this.resolvedRibbons){const t=e.getTop(n),o=e.getBottom(n);Number.isFinite(t)&&this.yExtent.push(t),Number.isFinite(o)&&this.yExtent.push(o)}}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 n=t.getTop(e),o=t.getBottom(e);Number.isFinite(n)&&this.yExtent.evict(n),Number.isFinite(o)&&this.yExtent.evict(o)}}}return!0}computeScene(e){var t,n,o,i,r,a,s,l,c,u,d,h,g,f;const{config:p,buffer:y}=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(y,this.getX),this.yExtent.dirty&&this.rebuildYExtent();const m=this.getBufferArray(),v=this.xExtent.extent,b=this.yExtent.extent;let x=p.xExtent?[null!==(n=p.xExtent[0])&&void 0!==n?n:v[0],null!==(o=p.xExtent[1])&&void 0!==o?o:v[1]]:v,S=p.yExtent?[null!==(i=p.yExtent[0])&&void 0!==i?i:b[0],null!==(r=p.yExtent[1])&&void 0!==r?r:b[1]]:b;const O=p.yExtent&&null!=p.yExtent[0]&&null!=p.yExtent[1],C="exact"===p.axisExtent;if("stackedarea"===p.chartType&&!O&&y.size>0)if(p.normalize)S=[0,C?1:1+p.extentPadding];else{const e=`${y.size}:${this._ingestVersion}:${null!==(a=p.baseline)&&void 0!==a?a:"zero"}:${null!==(s=p.stackOrder)&&void 0!==s?s:"key"}`;if(this._stackExtentCache&&this._stackExtentCache.key===e)S=this._stackExtentCache.yDomain;else{const t=this.groupData(m),n=new Map,o=new Set;let i=0;const r=new Map,a=new Map;for(const e of t){const t=new Map;let s=0;for(const n of e.data){const e=this.getX(n),a=this.getY(n);if(!Number.isFinite(e)||!Number.isFinite(a))continue;t.set(e,(t.get(e)||0)+a),o.add(e),s+=a;const l=(r.get(e)||0)+a;r.set(e,l),l>i&&(i=l)}n.set(e.key,t),a.set(e.key,s)}const s=null!==(l=p.stackOrder)&&void 0!==l?l:"key",g=(e,t)=>t>e?-1:e>t?1:0;let f;if("insideOut"===s){const e=[...t].map(e=>e.key).sort((e,t)=>{var n,o;const i=(null!==(n=a.get(t))&&void 0!==n?n:0)-(null!==(o=a.get(e))&&void 0!==o?o:0);return 0!==i?i:g(e,t)}),n=[],o=[];let i=0,r=0;for(const t of e)r>i?(n.push(t),i+=null!==(c=a.get(t))&&void 0!==c?c:0):(o.push(t),r+=null!==(u=a.get(t))&&void 0!==u?u:0);f=[...o.reverse(),...n]}else f="asc"===s?t.map(e=>e.key).sort((e,t)=>{var n,o;const i=(null!==(n=a.get(e))&&void 0!==n?n:0)-(null!==(o=a.get(t))&&void 0!==o?o:0);return 0!==i?i:g(e,t)}):"desc"===s?t.map(e=>e.key).sort((e,t)=>{var n,o;const i=(null!==(n=a.get(t))&&void 0!==n?n:0)-(null!==(o=a.get(e))&&void 0!==o?o:0);return 0!==i?i:g(e,t)}):t.map(e=>e.key).sort(g);if("wiggle"===p.baseline||"silhouette"===p.baseline){const e=Array.from(o).sort((e,t)=>e-t),t=Be(e,f,(e,t)=>{var o;return(null===(o=n.get(e))||void 0===o?void 0:o.get(t))||0},p.baseline);let i=1/0,a=-1/0;for(const n of e){const e=null!==(d=t.get(n))&&void 0!==d?d:0,o=null!==(h=r.get(n))&&void 0!==h?h:0;i>e&&(i=e),e+o>a&&(a=e+o)}Number.isFinite(i)&&Number.isFinite(a)||(i=0,a=0);const s=a-i,l=C?0:s>0?s*p.extentPadding:1;S=[i-l,a+l]}else S=[0,i+(C?0:i>0?i*p.extentPadding:1)];this._stackExtentCache={key:e,yDomain:S}}}else if("bar"===p.chartType&&p.binSize&&!O&&y.size>0){const[,e]=function(e,t,n,o,i){const r=Te(e,t,n,o,i);if(0===r.size)return[0,0];let a=0;for(const e of r.values())e.total>a&&(a=e.total);return[0,a]}(y,this.getX,this.getY,p.binSize,this.getCategory);S=[0,C?e:e+e*p.extentPadding]}else if("waterfall"===p.chartType&&!O&&y.size>0){const[e,t]=function(e,t){let n=0,o=0,i=0;for(const r of e){const e=t(r);null==e||Number.isNaN(e)||(i+=e,n>i&&(n=i),i>o&&(o=i))}return[n,o]}(y,this.getY),n=t-e,o=C?0:n>0?n*p.extentPadding:1;S=[Math.min(0,e-Math.abs(o)),Math.max(0,t+Math.abs(o))]}else if(!O&&S[0]!==1/0){if(this.resolvedRibbons.length>0)for(const e of m)for(const t of this.resolvedRibbons){const n=t.getTop(e),o=t.getBottom(e);Number.isFinite(n)&&(S[0]>n&&(S[0]=n),n>S[1]&&(S[1]=n)),Number.isFinite(o)&&(S[0]>o&&(S[0]=o),o>S[1]&&(S[1]=o))}const e=S[1]-S[0],t=C?0:e>0?e*p.extentPadding:1,n=null===(g=p.yExtent)||void 0===g?void 0:g[0],o=null===(f=p.yExtent)||void 0===f?void 0:f[1];S=[null!=n?S[0]:S[0]-t,null!=o?S[1]:S[1]+t],"log"!==p.yScaleType||S[0]>0||0>=b[0]||C||(S[0]=null!=n?S[0]:b[0]/(1+p.extentPadding))}if(p.yExtent&&!O){const e=p.yExtent[0],t=p.yExtent[1];null==e&&null==t||(S=[null!=e?e:S[0],null!=t?t:S[1]])}if(x[0]===1/0||x[1]===-1/0)if("time"===p.xScaleType){const e=Date.now();x=[e-864e5,e]}else x=[0,1];S[0]!==1/0&&S[1]!==-1/0||(S=[0,1]);const j="streaming"===p.runtimeMode,M=Math.max(0,Math.min(p.scalePadding||0,Math.min(e.width,e.height)/2-1));if(j)if("x"==("up"===(_=p.arrowOfTime)||"down"===_?"y":"x")){const t="right"===p.arrowOfTime?[M,e.width-M]:[e.width-M,M];this.scales={x:k().domain(x).range(t),y:k().domain(S).range([e.height-M,M])}}else{const t="down"===p.arrowOfTime?[M,e.height-M]:[e.height-M,M];this.scales={x:k().domain(S).range([M,e.width-M]),y:k().domain(x).range(t)}}else{const t=(e,t,n)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return w().domain(e).range(n).clamp(!0)}return"time"===e?A().domain([new Date(t[0]),new Date(t[1])]).range(n):k().domain(t).range(n)};this.scales={x:t(p.xScaleType,x,[M,e.width-M]),y:t(p.yScaleType,S,[e.height-M,M])}}var _;this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(e,m),this.config.decay&&this.applyDecay(this.scene,m),this.config.pulse&&this.applyPulse(this.scene,m),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,n=0;for(const e of this.scene)"point"===e.type&&(t++,e.r>n&&(n=e.r));if(this._maxPointRadius=n,Ht.QUADTREE_THRESHOLD>=t)return void(this._quadtree=null);const o=Array(t);let i=0;for(const e of this.scene)"point"===e.type&&(o[i++]=e);this._quadtree=C().x(e=>e.x).y(e=>e.y).addAll(o)}get quadtree(){return this._quadtree}get maxPointRadius(){return this._maxPointRadius}remapScene(e){const t=e.width/this.lastLayout.width,n=e.height/this.lastLayout.height;for(const e of this.scene)switch(e.type){case"line":for(const o of e.path)o[0]*=t,o[1]*=n;break;case"area":for(const o of e.topPath)o[0]*=t,o[1]*=n;for(const o of e.bottomPath)o[0]*=t,o[1]*=n;e.clipRect&&(e.clipRect={x:e.clipRect.x*t,y:e.clipRect.y*n,width:e.clipRect.width*t,height:e.clipRect.height*n});break;case"point":e.x*=t,e.y*=n;break;case"rect":case"heatcell":e.x*=t,e.y*=n,e.w*=t,e.h*=n;break;case"candlestick":e.x*=t,e.openY*=n,e.closeY*=n,e.highY*=n,e.lowY*=n}const o=this.scales.x.domain(),i=this.scales.y.domain(),r=this.scales.x.range(),a=this.scales.y.range(),s=(e,t,n)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return w().domain(e).range(n).clamp(!0)}return"time"===e?A().domain([new Date(t[0]),new Date(t[1])]).range(n):k().domain(t).range(n)},l=Math.max(0,Math.min(this.config.scalePadding||0,Math.min(e.width,e.height)/2-1)),c=a[1]>a[0];this.scales={x:s(this.config.xScaleType,o,r[0]>r[1]?[e.width-l,l]:[l,e.width-l]),y:s(this.config.yScaleType,i,c?[l,e.height-l]:[e.height-l,l])},this.lastLayout={width:e.width,height:e.height},this.rebuildQuadtree(),this.version++}buildSceneNodes(e,t){var n,o,i,r,a,s,l;const{config:c,scales:u}=this;if(!u)return[];if(c.customLayout){const l=null!==(n=c.layoutMargin)&&void 0!==n?n:{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!==(o=c.themeSemantic)&&void 0!==o?o:{},categorical:null!==(i=c.themeCategorical)&&void 0!==i?i:ft},resolveColor:(e,t)=>{var n,o;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!==(o=null===(n=c.themeSemantic)||void 0===n?void 0:n.primary)&&void 0!==o?o:"#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!==(a=h.overlays)&&void 0!==a?a:null,null!==(s=h.nodes)&&void 0!==s?s:[]}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 n;const o=e.groupData(t),i=[],r=null===(n=e.config.annotations)||void 0===n?void 0:n.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:r}=_t(e.ribbons);if(r.length>0&&i.push(...Pt(e,t,r)),n.length>0)for(const t of o)i.push(...Lt(e,t.data,t.key,n))}for(const t of o){const n=e.resolveLineStyle(t.key,t.data[0]),o=$e(t.data,e.scales,e.getX,e.getY,n,t.key);r&&r.length>0&&(o.colorThresholds=r),e.config.curve&&"linear"!==e.config.curve&&(o.curve=e.config.curve),e.config.lineGradient&&(o.strokeGradient=e.config.lineGradient),i.push(o)}return $t(e,o,i),i}(d,t);case"area":return function(e,t){const n=e.groupData(t),o=[];if(e.ribbons&&e.ribbons.length>0){const{perSeries:i,aggregate:r}=_t(e.ribbons);if(r.length>0&&o.push(...Pt(e,t,r)),i.length>0)for(const t of n)o.push(...Lt(e,t.data,t.key,i))}const i=e.scales.y.domain()[0],r=e.getY0?t=>{const n=e.getY0(t);return null==n?i:n}:void 0;for(const t of n){const n=e.resolveAreaStyle(t.key,t.data[0]),a=Ne(t.data,e.scales,e.getX,e.getY,i,n,t.key,r),s=Bt(e.config.gradientFill);s&&(a.fillGradient=s),e.config.curve&&"linear"!==e.config.curve&&(a.curve=e.config.curve),e.config.lineGradient&&(a.strokeGradient=e.config.lineGradient),o.push(a)}return $t(e,n,o),o}(d,t);case"mixed":return function(e,t){const n=e.groupData(t),o=[],i=e.config.areaGroups||new Set;if(e.ribbons&&e.ribbons.length>0){const{perSeries:i,aggregate:r}=_t(e.ribbons);if(r.length>0&&o.push(...Pt(e,t,r)),i.length>0)for(const t of n)o.push(...Lt(e,t.data,t.key,i))}const r=e.scales.y.domain()[0],a=e.getY0?t=>{const n=e.getY0(t);return null==n?r:n}:void 0;for(const t of n)if(i.has(t.key)){const n=e.resolveAreaStyle(t.key,t.data[0]),i=Ne(t.data,e.scales,e.getX,e.getY,r,n,t.key,a),s=Bt(e.config.gradientFill);s&&(i.fillGradient=s),e.config.curve&&"linear"!==e.config.curve&&(i.curve=e.config.curve),e.config.lineGradient&&(i.strokeGradient=e.config.lineGradient),o.push(i)}else{const n=e.resolveLineStyle(t.key,t.data[0]),i=$e(t.data,e.scales,e.getX,e.getY,n,t.key);e.config.curve&&"linear"!==e.config.curve&&(i.curve=e.config.curve),e.config.lineGradient&&(i.strokeGradient=e.config.lineGradient),o.push(i)}return $t(e,n,o),o}(d,t);case"stackedarea":return function(e,t){var n,o,i,r;const a=e.groupData(t),s=null!==(n=e.config.stackOrder)&&void 0!==n?n:"key",l=()=>a.sort((e,t)=>t.key>e.key?-1:e.key>t.key?1:0);if("key"===s)l();else if("asc"===s||"desc"===s||"insideOut"===s){const t=new Map;for(const n of a){let o=0;for(const t of n.data){const n=e.getX(t),i=e.getY(t);Number.isFinite(n)&&Number.isFinite(i)&&(o+=i)}t.set(n.key,o)}const n=(e,t)=>t>e?-1:e>t?1:0;if("asc"===s)a.sort((e,o)=>{var i,r;const a=(null!==(i=t.get(e.key))&&void 0!==i?i:0)-(null!==(r=t.get(o.key))&&void 0!==r?r:0);return 0!==a?a:n(e.key,o.key)});else if("desc"===s)a.sort((e,o)=>{var i,r;const a=(null!==(i=t.get(o.key))&&void 0!==i?i:0)-(null!==(r=t.get(e.key))&&void 0!==r?r:0);return 0!==a?a:n(e.key,o.key)});else{const e=[...a].sort((e,o)=>{var i,r;const a=(null!==(i=t.get(o.key))&&void 0!==i?i:0)-(null!==(r=t.get(e.key))&&void 0!==r?r:0);return 0!==a?a:n(e.key,o.key)}),r=[],s=[];let l=0,c=0;for(const n of e)c>l?(r.push(n),l+=null!==(o=t.get(n.key))&&void 0!==o?o:0):(s.push(n),c+=null!==(i=t.get(n.key))&&void 0!==i?i:0);a.length=0,a.push(...s.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,n,o,i,r,a,s="zero"){var l,c;const u=new Set;for(const t of e)for(const e of t.data){const t=n(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=n(i),r=o(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 n=0;for(const o of e)n+=(null===(l=h.get(o.key))||void 0===l?void 0:l.get(t))||0;g.set(t,n||1)}}const f=Be(d,e.map(e=>e.key),(e,t)=>{var n;return(null===(n=h.get(e))||void 0===n?void 0:n.get(t))||0},s),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 n of e){const e=h.get(n.key),o=[],s=[],l=new Map;for(const n of d){let i=e.get(n)||0;const a=m.get(n);r&&(i/=g.get(n));const c=a+i,u=t.x(n);s.push([u,t.y(a)]),o.push([u,t.y(c)]),m.set(n,c),l.set(n,c)}y.set(n.key,l);const c={type:"area",topPath:o,bottomPath:s,style:i(n.key,n.data[0]),datum:n.data,group:n.key};a&&(c.curve=a),p.push(c)}return{nodes:p,stackedTops:y}}(a,e.scales,e.getX,e.getY,(t,n)=>e.resolveAreaStyle(t,n),e.config.normalize,c,u),g=d;if(e.config.pointStyle){const t=new WeakMap;for(const n of a){const o=h.get(n.key);if(o)for(const i of n.data){const n=e.getX(i),r=e.getY(i);null==n||Number.isNaN(n)||null==r||Number.isNaN(r)||!o.has(n)||t.set(i,o.get(n))}}const n=n=>{var o;return null!==(o=t.get(n))&&void 0!==o?o:e.getY(n)};$t(e,a,g,n)}return g}(d,t);case"scatter":case"bubble":return function(e,t){var n;const o=[],i="bubble"===e.config.chartType?10:5,r=e.config.sizeRange||[3,15];let a=null;if(e.getSize&&!e.config.pointStyle){const n=t.map(t=>e.getSize(t)).filter(e=>null!=e&&!Number.isNaN(e));if(n.length>0){let e=1/0,t=-1/0;for(const o of n)e>o&&(e=o),o>t&&(t=o);a=n=>e===t?(r[0]+r[1])/2:r[0]+(n-e)/(t-e)*(r[1]-r[0])}}const s=e.getColor?e.resolveColorMap(t):null,l=(null===(n=e.config.themeSemantic)||void 0===n?void 0:n.primary)||"#4e79a7";for(const n of t){let t=e.config.pointStyle?e.config.pointStyle(n):{fill:l,opacity:.8},r=t.r||i;if(a&&e.getSize){const t=e.getSize(n);null==t||Number.isNaN(t)||(r=a(t))}if(s&&e.getColor&&!t.fill){const o=e.getColor(n);o&&s.has(o)&&(t=Object.assign(Object.assign({},t),{fill:s.get(o)}))}const c=e.getPointId?e.getPointId(n)+"":void 0,u=De(n,e.scales,e.getX,e.getY,r,t,c);u&&o.push(u)}return o}(d,t);case"heatmap":return function(e,t,n){if(e.config.heatmapAggregation)return function(e,t,n){var o,i,r;const a=Math.max(1,Math.floor(null!==(o=e.config.heatmapXBins)&&void 0!==o?o:20)),s=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=He(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)/a,p=(g-h||1)/s,y=a*s;if(y>1e6)return[];const m=new Int32Array(y),v=new Float64Array(y);for(let n=0;t.length>n;n++){const o=t[n],i=e.getX(o),r=e.getY(o);if(!isFinite(i)||!isFinite(r))continue;const l=Math.min(Math.floor((i-u)/f),a-1),d=Math.min(Math.floor((r-h)/p),s-1);if(0>l||0>d)continue;const g=d*a+l;m[g]++;const y=c(o);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=n.width/a,A=n.height/s,S=e.config.showValues,O=e.config.heatmapValueFormat,C=[];for(let e=0;s>e;e++){const t=e*a;for(let n=0;a>n;n++){const o=t+n;if(0===m[o])continue;let i;switch(l){case"sum":i=v[o];break;case"mean":i=v[o]/m[o];break;default:i=m[o]}const r=(i-b)/k;C.push(Ie(n*w,(s-1-e)*A,w,A,`rgb(${220-(180*r+.5)|0},${220-(100*r+.5)|0},${255-(50*r+.5)|0})`,{xi:n,yi:e,value:i,count:m[o],sum:v[o],xCenter:u+(n+.5)*f,yCenter:h+(e+.5)*p,agg:l},S?{value:i,showValues:!0,valueFormat:O}:void 0))}}return C}(e,t,n);if(0===t.length)return[];const o=He(e.config.valueAccessor,"value"),i=Fe(e.config.xAccessor,"x"),r=Fe(e.config.yAccessor,"y"),a=new Map,s=new Map,l=Array(t.length),c=Array(t.length);for(let e=0;t.length>e;e++){const n=t[e],o=i(n),u=r(n);l[e]=o,c[e]=u,a.has(o)||a.set(o,a.size),s.has(u)||s.set(u,s.size)}const u=a.size,d=s.size;if(0===u||0===d)return[];const h=Array.from(a.keys()),g=Array.from(s.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),a.clear();for(let e=0;h.length>e;e++)a.set(h[e],e)}if(p){g.sort((e,t)=>e-t),s.clear();for(let e=0;g.length>e;e++)s.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 n=t[e],i=a.get(l[e]),r=s.get(c[e]);if(void 0===i||void 0===r)continue;const d=o(n),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]=n}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 Dt?e:"blues";let n=Et.get(t);if(n)return n;n=Array(256);const o=Dt[t]||Xe;for(let e=0;256>e;e++)n[e]=o(e/255);return Et.set(t,n),n}("string"==typeof e.config.colorScheme?e.config.colorScheme:e.config.themeSequential||"blues"),S=255/(w-k||1),O=n.width/u,C=n.height/d,j=e.config.showValues,M=e.config.heatmapValueFormat,_=[];for(let e=0;x>e;e++){const t=m[e];if(!isFinite(t))continue;const n=y[e],o=n%u;_.push(Ie(o*O,(d-1-(n-o)/u)*C,O,C,A[Math.min((t-k)*S+.5|0,255)],v[e],j?{value:t,showValues:!0,valueFormat:M}:void 0))}return _}(d,t,e);case"bar":{const e=function(e,t){var n,o;if(!e.config.binSize)return{nodes:[],binBoundaries:[]};const i=Te(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 n of e.categories.keys())t.add(n);const n=e.config.barColors?Object.keys(e.config.barColors):[],o=new Set(n),a=Array.from(t).filter(e=>!o.has(e)).sort(),s=n.filter(e=>t.has(e)),l=s.join("\0")+""+a.join("\0");e.barCategoryCache&&e.barCategoryCache.key===l?r=e.barCategoryCache.order:(r=[...s,...a],e.barCategoryCache={key:l,order:r})}const a=[],s=e.scales,[l,c]=s.x.domain(),u=e.config.barStyle,d=null===(n=e.config.themeSemantic)||void 0===n?void 0:n.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 n=Math.max(t.start,l),i=Math.min(t.end,c);if(n>=i)continue;const h=s.x(n),p=s.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 n=0;for(const i of r){const r=t.categories.get(i)||0;if(0===r)continue;const l=s.y(n),c=s.y(n+r),h=(null===(o=e.config.barColors)||void 0===o?void 0:o[i])||(null==u?void 0:u.fill)||d||"#4e79a7";a.push(Ee(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)),n+=r}}else{const e=s.y(0),n=s.y(t.total);a.push(Ee(v,Math.min(e,n),b,Math.abs(e-n),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:a,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 n,o,i,r,a,s;const l=[],c=e.config.swarmStyle||{},u=null!==(n=c.radius)&&void 0!==n?n:3,d=null!==(r=null!==(o=c.fill)&&void 0!==o?o:null===(i=e.config.themeSemantic)||void 0===i?void 0:i.primary)&&void 0!==r?r:"#007bff",h=null!==(a=c.opacity)&&void 0!==a?a:.7,g=c.stroke,f=c.strokeWidth;for(const n of t){const t=e.getX(n),o=e.getY(n);if(null==o||Number.isNaN(o))continue;const i=e.scales.x(t),r=e.scales.y(o);let a=d;if(e.getCategory){const t=e.getCategory(n);a=(null===(s=e.config.barColors)||void 0===s?void 0:s[t])||a}const c={type:"point",x:i,y:r,r:u,style:{fill:a,opacity:h,stroke:g,strokeWidth:f},datum:n};e.getPointId&&(c.pointId=e.getPointId(n)+""),l.push(c)}return l}(d,t);case"waterfall":return function(e,t,n){var o,i,r,a,s,l,c;const u=[],d=e.scales,h=e.config.waterfallStyle,g=t.filter(t=>{const n=e.getY(t),o=e.getX(t);return null!=n&&!Number.isNaN(n)&&null!=o&&isFinite(o)});if(0===g.length)return u;const f=null!==(r=null!==(o=null==h?void 0:h.positiveColor)&&void 0!==o?o:null===(i=e.config.themeSemantic)||void 0===i?void 0:i.success)&&void 0!==r?r:"#28a745",p=null!==(l=null!==(a=null==h?void 0:h.negativeColor)&&void 0!==a?a:null===(s=e.config.themeSemantic)||void 0===s?void 0:s.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 o=g[t],i=e.getX(o),r=e.getY(o),a=x+r;let s;s=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!==s?d.x(i+s):l+n.width/10,k=Math.min(l,c)+y/2,w=Math.max(l,c)-y/2-k;if(0>=w){x=a;continue}const A=d.y(x),S=d.y(a),O=Math.min(A,S),C=Math.abs(A-S),j={fill:0>r?p:f,stroke:m,strokeWidth:v};null!=b&&(j.opacity=b),u.push(Ee(k,O,w,C,j,Object.assign(Object.assign({},o),{baseline:x,cumEnd:a,delta:r,_connectorStroke:null==h?void 0:h.connectorStroke,_connectorWidth:null==h?void 0:h.connectorWidth}))),x=a}return u}(d,t,e);case"candlestick":return function(e,t){var n,o;if(!e.getHigh||!e.getLow||!e.scales)return[];const i=null!==(n=e.config.candlestickRangeMode)&&void 0!==n&&n;if(!(i||e.getOpen&&e.getClose))return[];const r=[],a=e.config.candlestickStyle||{},s=a.rangeColor||"#6366f1",l=i?s:a.upColor||"#28a745",c=i?s:a.downColor||"#dc3545",u=i?s:a.wickColor||"#333",d=a.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!==(o=a.bodyWidth)&&void 0!==o?o:0;if(null==a.bodyWidth)if(h.length>1){let t=1/0;for(let n=1;h.length>n;n++){const o=Math.abs(e.scales.x(h[n])-e.scales.x(h[n-1]));o>0&&t>o&&(t=o)}g=t!==1/0?Math.max(2,Math.min(.6*t,20)):6}else g=6;for(const n of t){const t=e.getX(n);if(null==t||Number.isNaN(t))continue;const o=e.getHigh(n),a=e.getLow(n);if(null==o||Number.isNaN(o)||null==a||Number.isNaN(a))continue;const s=i?o:e.getOpen(n),h=i?a:e.getClose(n);if(!i&&[s,h].some(e=>null==e||Number.isNaN(e)))continue;const f=h>=s,p={type:"candlestick",x:e.scales.x(t),openY:e.scales.y(s),closeY:e.scales.y(h),highY:e.scales.y(o),lowY:e.scales.y(a),bodyWidth:g,upColor:l,downColor:c,wickColor:u,wickWidth:d,isUp:f,datum:n};i&&(p.isRange=!0),r.push(p)}return r}(d,t);default:return[]}}resolveBoundsStyle(e,t){var n;const o=this.config.boundsStyle;return"function"==typeof o?o(t||{},e):o&&"object"==typeof o?o:{fill:this.resolveLineStyle(e,t).stroke||(null===(n=this.config.themeSemantic)||void 0===n?void 0:n.primary)||"#4e79a7",fillOpacity:.2,stroke:"none"}}computeDecayOpacity(e,t){const n=this.config.decay;return n&&t>1?xt(n,e,t):1}applyDecay(e,t){this.config.decay&&function(e,t,n){var o,i;const r=n.length;if(1>=r)return;const a=new Map;for(let e=0;n.length>e;e++)a.set(n[e],e);for(const n of t){if("line"===n.type){const t=Array.isArray(n.datum)?n.datum:[];if(2>t.length)continue;const o=Array(t.length);let i=!1;for(let n=0;t.length>n;n++){const s=a.get(t[n]);null!=s?(o[n]=xt(e,s,r),1>o[n]&&(i=!0)):o[n]=1}i&&(n._decayOpacities=o);continue}if("area"===n.type){const t=Array.isArray(n.datum)?n.datum:[],o=n.topPath?n.topPath.length:t.length;if(2>o)continue;if(t.length===o){const i=Array(o);let s=!1;for(let n=0;t.length>n;n++){const o=a.get(t[n]);null!=o?(i[n]=xt(e,o,r),1>i[n]&&(s=!0)):i[n]=1}s&&(n._decayOpacities=i)}else{let i=1;for(const n of t){const t=a.get(n);if(null!=t){const n=xt(e,t,r);i>n&&(i=n)}}if(1>i){const e=Array(o);e.fill(i),n._decayOpacities=e}}continue}const t=a.get(n.datum);if(null==t)continue;const s=xt(e,t,r);if("heatcell"===n.type)n.style={opacity:s};else if("candlestick"===n.type)n._decayOpacity=s;else{const e=null!==(i=null===(o=n.style)||void 0===o?void 0:o.opacity)&&void 0!==i?i:1;n.style=Object.assign(Object.assign({},n.style),{opacity:e*s})}}}(this.config.decay,e,t)}applyPulse(e,t){this.config.pulse&&this.timestampBuffer&&function(e,t,n,o){var i,r;const a="undefined"!=typeof performance?performance.now():Date.now(),s=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;n.length>e;e++)c.set(n[e],e);for(const n of t){if("line"===n.type)continue;if("area"===n.type){const t=Array.isArray(n.datum)?n.datum:[n.datum];let i=0;for(const n of t){const t=c.get(n);if(null==t)continue;const r=o.get(t);if(null==r)continue;const s=kt(e,r,a);s>i&&(i=s)}i>0&&(n._pulseIntensity=i,n._pulseColor=s);continue}const t=c.get(n.datum);if(null==t)continue;const i=o.get(t);if(null==i)continue;const r=kt(e,i,a);r>0&&(n._pulseIntensity=r,n._pulseColor=s,n._pulseGlowRadius=l)}}(this.config.pulse,e,t,this.timestampBuffer)}get hasActivePulses(){return!!this.config.pulse&&function(e,t){var n;if(!t||0===t.size)return!1;const o="undefined"!=typeof performance?performance.now():Date.now(),i=null!==(n=e.duration)&&void 0!==n?n:500,r=t.peek();return null!=r&&i>o-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,n,o){var i,r,a,s;n.clear(),o.clear();for(let l=0;t.length>l;l++){const c=t[l],u=Ct(e,c,l);u&&("point"===c.type?n.set(u,{x:c.x,y:c.y,r:c.r,opacity:c.style.opacity}):"rect"===c.type?n.set(u,{x:c.x,y:c.y,w:c.w,h:c.h,opacity:c.style.opacity}):"heatcell"===c.type?n.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?n.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?o.set(u,{path:c.path.map(e=>[e[0],e[1]]),opacity:null===(a=c.style)||void 0===a?void 0:a.opacity}):"area"===c.type&&o.set(u,{topPath:c.topPath.map(e=>[e[0],e[1]]),bottomPath:c.bottomPath.map(e=>[e[0],e[1]]),opacity:null===(s=c.style)||void 0===s?void 0:s.opacity}))}}(this.transitionContext,this.scene,this.prevPositionMap,this.prevPathMap)}synthesizeIntroPositions(){var e,t,n;this.prevPositionMap.clear(),this.prevPathMap.clear();const o=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=Ct(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:o,w:t.w,h:0,opacity:null!==(n=t.style.opacity)&&void 0!==n?n: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,n,o,i){var r,a,s,l,c,u,d,h,g,f,p,y,m,v,b,x,k,w,A,S,O,C,j,M,_,P,L,T,$,N,B,D,E,I,R,H,F,W,z,Y,G;if(0===o.size&&0===i.size)return n;const q=null!==(r=t.duration)&&void 0!==r?r:300;if(n.exitNodes.length>0){const e=new Set(n.exitNodes);n.scene=n.scene.filter(t=>!e.has(t)),n.exitNodes=[]}let X=!1;const V=new Set,U=new Set;for(let t=0;n.scene.length>t;t++){const r=n.scene[t],P=Ct(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!==(a=r.style.opacity)&&void 0!==a?a:1,r._startOpacity=null!==(l=null!==(s=e.opacity)&&void 0!==s?s: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=o.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!==(S=null===(A=r.style)||void 0===A?void 0:A.opacity)&&void 0!==S?S: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!==(O=L.closeY)&&void 0!==O?O:r.closeY,r.highY=null!==(C=L.highY)&&void 0!==C?C:r.highY,r.lowY=null!==(j=L.lowY)&&void 0!==j?j:r.lowY,X=!0)}else r._targetOpacity=null!==(_=null===(M=r.style)||void 0===M?void 0:M.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 o={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};n.exitNodes.push(o),X=!0}else if(e.startsWith("a:")&&t.topPath&&t.bottomPath){const o={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};n.exitNodes.push(o),X=!0}for(const[e,t]of o)if(!V.has(e)){if(e.startsWith("p:")){const o={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};n.exitNodes.push(o)}else if(e.startsWith("r:")){const o={type:"rect",x:t.x,y:t.y,w:null!==(N=t.w)&&void 0!==N?N:0,h:null!==(B=t.h)&&void 0!==B?B:0,style:{opacity:null!==(D=t.opacity)&&void 0!==D?D:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e};n.exitNodes.push(o)}else if(e.startsWith("h:")){const o={type:"heatcell",x:t.x,y:t.y,w:null!==(E=t.w)&&void 0!==E?E:0,h:null!==(I=t.h)&&void 0!==I?I:0,fill:"#999",datum:null,style:{opacity:null!==(R=t.opacity)&&void 0!==R?R:1},_targetOpacity:0,_transitionKey:e};n.exitNodes.push(o)}else if(e.startsWith("c:")){const o=null!==(H=t.openY)&&void 0!==H?H:t.y,i={type:"candlestick",x:t.x,openY:o,closeY:null!==(F=t.closeY)&&void 0!==F?F:o,highY:null!==(W=t.highY)&&void 0!==W?W:o,lowY:null!==(z=t.lowY)&&void 0!==z?z:o,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};n.exitNodes.push(i)}X=!0}return n.exitNodes.length>0&&(n.scene=[...n.scene,...n.exitNodes]),X&&(n.activeTransition={startTime:Ot(),duration:q}),n}(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},n=function(e,t,n,o){var i,r,a,s,l,c;if(!n.activeTransition)return!1;const u=At(e,n.activeTransition),d=wt(u,"linear"===t.easing?"linear":"ease-out-cubic");for(const e of n.scene){const t=e._transitionKey;if("point"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,r=n?null!==(i=n.opacity)&&void 0!==i?i:1:0;e.style.opacity=St(r,e._targetOpacity,d)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=St(n.x,e._targetX,d),e.y=St(n.y,e._targetY,d),void 0!==e._targetR&&void 0!==n.r&&(e.r=St(n.r,e._targetR,d))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,i=n?null!==(r=n.opacity)&&void 0!==r?r:1:0;e.style.opacity=St(i,e._targetOpacity,d)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=St(n.x,e._targetX,d),e.y=St(n.y,e._targetY,d),void 0!==n.w&&(e.w=St(n.w,e._targetW,d)),void 0!==n.h&&(e.h=St(n.h,e._targetH,d))}else if("heatcell"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,i=n?null!==(a=n.opacity)&&void 0!==a?a:1:0;e.style=Object.assign(Object.assign({},e.style||{}),{opacity:St(i,e._targetOpacity,d)})}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=St(n.x,e._targetX,d),e.y=St(n.y,e._targetY,d),void 0!==n.w&&(e.w=St(n.w,e._targetW,d)),void 0!==n.h&&(e.h=St(n.h,e._targetH,d))}else if("candlestick"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,i=n?null!==(s=n.opacity)&&void 0!==s?s:1:0;e.style=Object.assign(Object.assign({},e.style||{}),{opacity:St(i,e._targetOpacity,d)})}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=St(n.x,e._targetX,d),void 0!==n.openY&&(e.openY=St(n.openY,e._targetOpenY,d)),void 0!==n.closeY&&(e.closeY=St(n.closeY,e._targetCloseY,d)),void 0!==n.highY&&(e.highY=St(n.highY,e._targetHighY,d)),void 0!==n.lowY&&(e.lowY=St(n.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:St(t,e._targetOpacity,d)})}void 0!==e._introClipFraction&&(e._introClipFraction=d);const t=e._prevPath,n=e._targetPath;if(t&&n&&t.length===e.path.length)for(let o=0;e.path.length>o;o++)e.path[o][0]=St(t[o][0],n[o][0],d),e.path[o][1]=St(t[o][1],n[o][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:St(t,e._targetOpacity,d)})}void 0!==e._introClipFraction&&(e._introClipFraction=d);const t=e._prevTopPath,n=e._prevBottomPath,o=e._targetTopPath,i=e._targetBottomPath;if(t&&o&&t.length===e.topPath.length)for(let n=0;e.topPath.length>n;n++)e.topPath[n][0]=St(t[n][0],o[n][0],d),e.topPath[n][1]=St(t[n][1],o[n][1],d);if(n&&i&&n.length===e.bottomPath.length)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t][0]=St(n[t][0],i[t][0],d),e.bottomPath[t][1]=St(n[t][1],i[t][1],d)}}if(u>=1){for(const e of n.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 n=0;e.path.length>n;n++)e.path[n]=t[n];e._prevPath=void 0,e._targetPath=void 0,e._introClipFraction=void 0}else if("area"===e.type){const t=e._targetTopPath,n=e._targetBottomPath;if(t)for(let n=0;e.topPath.length>n;n++)e.topPath[n]=t[n];if(n)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t]=n[t];e._prevTopPath=void 0,e._prevBottomPath=void 0,e._targetTopPath=void 0,e._targetBottomPath=void 0,e._introClipFraction=void 0}}if(n.exitNodes.length>0){const e=new Set(n.exitNodes);n.scene=n.scene.filter(t=>!e.has(t)),n.exitNodes=[]}return n.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,n}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 n=new Map;for(const t of e){const e=this.getGroup(t);n.has(e)||n.set(e,[]),n.get(e).push(t)}t=Array.from(n.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 n of e){const e=this.getColor(n);e&&t.add(e)}const n=Array.from(t).sort(),o=n.join("\0");if(this._colorMapCache&&this._colorMapCache.key===o)return this._colorMapCache.version=this._ingestVersion,this._colorMapCache.map;const i=Array.isArray(this.config.colorScheme)?this.config.colorScheme:this.config.themeCategorical||ft,r=new Map;for(let e=0;n.length>e;e++)r.set(n[e],i[e%i.length]);return this._colorMapCache={key:o,map:r,version:this._ingestVersion},r}resolveLineStyle(e,t){var n;const o=this.config.lineStyle;if("function"==typeof o){const n=o(t||{},e);if(n&&!n.stroke&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},n),{stroke:t})}return n}const i=null===(n=this.config.themeSemantic)||void 0===n?void 0:n.primary;return o&&"object"==typeof o?{stroke:o.stroke||i||"#007bff",strokeWidth:o.strokeWidth||2,strokeDasharray:o.strokeDasharray,fill:o.fill,fillOpacity:o.fillOpacity,opacity:o.opacity}:{stroke:this.resolveGroupColor(e)||i||"#007bff",strokeWidth:2}}resolveAreaStyle(e,t){var n,o;if(this.config.areaStyle){const n=this.config.areaStyle(t||{});if(n&&!n.fill&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},n),{fill:t,stroke:n.stroke||t})}return n}const i=this.config.lineStyle;if("function"==typeof i){const n=i(t||{},e);if(n&&!n.fill&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},n),{fill:t,stroke:n.stroke||t})}return n}const r=null===(n=this.config.themeSemantic)||void 0===n?void 0:n.primary;if(i&&"object"==typeof i)return{fill:i.fill||i.stroke||r||"#4e79a7",fillOpacity:null!==(o=i.fillOpacity)&&void 0!==o?o:.7,stroke:i.stroke||r||"#4e79a7",strokeWidth:i.strokeWidth||2};const a=this.resolveGroupColor(e)||r||"#4e79a7";return{fill:a,fillOpacity:.7,stroke:a,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 n=(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)||ft;if(0===n.length)return null;const o=n[this._groupColorCounter%n.length];if(this._groupColorCounter++,this._groupColorMap.set(e,o),this._groupColorMap.size>Ht.GROUP_COLOR_MAP_CAP){const e=this._groupColorMap.keys().next().value;void 0!==e&&this._groupColorMap.delete(e)}return o}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]),n=this.getPointId,o=e=>t.has(n(e));if(this.timestampBuffer&&this.timestampBuffer.size>0){const e=this.timestampBuffer.toArray(),t=new Set;this.buffer.forEach((e,n)=>{o(e)&&t.add(n)}),this.timestampBuffer.clear();for(let n=0;e.length>n;n++)t.has(n)||this.timestampBuffer.push(e[n])}const i=this.buffer.remove(o);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 n=new Set(Array.isArray(e)?e:[e]),o=this.getPointId,i=new Set;this.buffer.forEach((e,t)=>{n.has(o(e))&&i.add(t)});const r=this.buffer.update(e=>n.has(o(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,n,o,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 a=!1,s=!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||!Re(null!==(t=e.xAccessor)&&void 0!==t?t:e.timeAccessor,null!==(n=r.xAccessor)&&void 0!==n?n:r.timeAccessor),u=l||!Re(null!==(o=e.yAccessor)&&void 0!==o?o: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=He(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=He(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=He(this.config.xAccessor,"x"),this.getY=He(this.config.yAccessor,"y")),u&&this.resolvedRibbons.some(e=>"bounds"===e.kind)&&(this.resolvedRibbons=Rt(this.config)),a=!0,s=!0)}if("groupAccessor"in e&&!Re(e.groupAccessor,r.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?We(this.config.groupAccessor):void 0,a=!0),"categoryAccessor"in e&&!Re(e.categoryAccessor,r.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?We(this.config.categoryAccessor):void 0,a=!0),"sizeAccessor"in e&&!Re(e.sizeAccessor,r.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?He(this.config.sizeAccessor,"size"):void 0,a=!0),"colorAccessor"in e&&!Re(e.colorAccessor,r.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?We(this.config.colorAccessor):void 0,a=!0),"y0Accessor"in e&&!Re(e.y0Accessor,r.y0Accessor)&&(this.getY0=this.config.y0Accessor?He(this.config.y0Accessor,"y0"):void 0,a=!0,s=!0),("boundsAccessor"in e&&!Re(e.boundsAccessor,r.boundsAccessor)||"band"in e&&e.band!==r.band||"boundsStyle"in e&&e.boundsStyle!==r.boundsStyle)&&(this.resolvedRibbons=Rt(this.config),a=!0,s=!0),"pointIdAccessor"in e&&!Re(e.pointIdAccessor,r.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?We(this.config.pointIdAccessor):void 0,a=!0),"candlestick"===this.config.chartType&&(l||"openAccessor"in e&&!Re(e.openAccessor,r.openAccessor)||"closeAccessor"in e&&!Re(e.closeAccessor,r.closeAccessor)||"highAccessor"in e&&!Re(e.highAccessor,r.highAccessor)||"lowAccessor"in e&&!Re(e.lowAccessor,r.lowAccessor))){const e=null!=this.config.openAccessor,t=null!=this.config.closeAccessor;this.getOpen=e?He(this.config.openAccessor,"open"):void 0,this.getHigh=He(this.config.highAccessor,"high"),this.getLow=He(this.config.lowAccessor,"low"),this.getClose=t?He(this.config.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!e&&!t,a=!0,s=!0}if(!a){const t=Object.keys(e).filter(e=>!e.endsWith("Accessor")&&"timeAccessor"!==e&&"valueAccessor"!==e);for(const n of t)if(e[n]!==r[n]){a=!0;break}}a&&(s&&this.rebuildExtents(),this.needsFullRebuild=!0)}}function Ft(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:o.createElement(o.Fragment,null,...t)}function Wt(e,t,n){return n.x>e||e>n.x+n.w||n.y>t||t>n.y+n.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:n.x+n.w/2,cy:n.y+n.h/2}}function zt(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function Yt(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function Gt(e,t){const n=Yt(e);if(!n)return!1;const o=Yt(t);return!o||n.getFullYear()!==o.getFullYear()||n.getMonth()!==o.getMonth()}function qt(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function Xt(e,t,n,o,i,r=e=>e.x,a=e=>e.y,s=e=>e.r){const l=Math.max(o,i+5,12),c=t-l,u=t+l,d=n-l,h=n+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=a(e)-n,u=Math.sqrt(l*l+c*c);zt(s(e),o)>=u&&f>u&&(g=e,f=u),i=i.next}while(i)}return!1}),g?{node:g,distance:f}:null}Ht.GROUP_COLOR_MAP_CAP=1e3,Ht.QUADTREE_THRESHOLD=500;const Vt=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,Ut=new WeakMap;let Qt=0,Kt=!1,Zt=null,Jt=null,en=null;function tn(e,t){var n,o;if(!t)return t;const i=Vt.exec(t);if(!i)return t;const r=e.canvas;if(!r)return(null===(n=i[2])||void 0===n?void 0:n.trim())||t;!function(){if(Kt)return;if("undefined"==typeof window||"undefined"==typeof document)return;Kt=!0;const e=()=>{Qt++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(Zt=new MutationObserver(e),Zt.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{Jt=window.matchMedia("(prefers-color-scheme: dark)"),en=e,"function"==typeof Jt.addEventListener?Jt.addEventListener("change",en):"function"==typeof Jt.addListener&&Jt.addListener(en)}catch(e){}}();let a=Ut.get(r);a&&a.version===Qt||(a={version:Qt,map:new Map},Ut.set(r,a));const s=a.map.get(t);if(void 0!==s)return s;const l=getComputedStyle(r).getPropertyValue(i[1]).trim()||(null===(o=i[2])||void 0===o?void 0:o.trim())||t;return a.map.set(t,l),l}function nn(e,t){const n=e.fillStyle,o="#010203";try{e.fillStyle=o,e.fillStyle=t}catch(t){return e.fillStyle=n,[78,121,167]}const i=e.fillStyle;if(e.fillStyle=n,"string"!=typeof i)return[78,121,167];if(i.toLowerCase()===o&&t.trim().toLowerCase()!==o)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 on(e){switch(e){case"monotoneX":return B;case"monotoneY":return N;case"cardinal":return $;case"catmullRom":return T;case"step":return L;case"stepBefore":return P;case"stepAfter":return _;case"basis":return M;case"natural":return j;default:return null}}function rn(e,t,n){return null==t?n:"string"!=typeof t?t:tn(e,t)||n}function an(e,t,n,o,i,r,a){if("colorStops"in t){const n=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>n.length)return null;const s=e.createLinearGradient(o,i,r,a);for(const e of n)s.addColorStop(e.offset,e.color);return s}const{topOpacity:s,bottomOpacity:l}=t;if(!Number.isFinite(s)||!Number.isFinite(l))return null;const c=Math.max(0,Math.min(1,s)),u=Math.max(0,Math.min(1,l)),d=e.createLinearGradient(o,i,r,a),[h,g,f]=nn(e,n);return d.addColorStop(0,`rgba(${h},${g},${f},${c})`),d.addColorStop(1,`rgba(${h},${g},${f},${u})`),d}function sn(e,t,n,o,i,r){const a=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>a.length)return null;const s=e.createLinearGradient(n,o,i,r);for(const e of a)s.addColorStop(e.offset,e.color);return s}const ln=new WeakMap;function cn(e,t){const n=on(t);if(!n)return e;const o=ln.get(e);if(o)return o;const i=function(e,t,n=8){if(!t||2>e.length)return e.map(([e,t])=>[e,t]);const o=[];let i=null;const r={moveTo(e,t){i=[e,t],o.push([e,t])},lineTo(e,t){i=[e,t],o.push([e,t])},bezierCurveTo(e,t,r,a,s,l){if(!i)return i=[s,l],void o.push([s,l]);const[c,u]=i;for(let i=1;n>=i;i++){const d=i/n,h=1-d;o.push([h*h*h*c+3*h*h*d*e+3*h*d*d*r+d*d*d*s,h*h*h*u+3*h*h*d*t+3*h*d*d*a+d*d*d*l])}i=[s,l]},closePath(){},arc(){},rect(){},arcTo(){},quadraticCurveTo(e,t,n,r){i=[n,r],o.push([n,r])}};return D().x(e=>e[0]).y(e=>e[1]).curve(t).context(r)(e),o}(e,n);return ln.set(e,i),i}function un(e,t,n,o=30,i,r=0){let a=null;if(i){const e=Xt(i,t,n,o,r);e&&(a={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=hn(r,t,n,o);break;case"line":e=gn(r,t,n,o);break;case"rect":if(null==r.datum)break;e=pn(r,t,n);break;case"heatcell":e=yn(r,t,n);break;case"area":if(!1===r.interactive)break;e=vn(r,t,n);break;case"candlestick":e=mn(r,t,n)}e&&o>e.distance&&(a&&e.distance>=a.distance||(a=e))}return a}function dn(e,t,n){if(0===e.length)return null;if(e[0][0]>t||t>e[e.length-1][0])return null;const o=bn(e,t);if(0>o)return null;if(Math.abs(e[o][0]-t)>n)return null;let i=o,r=o;o>0&&e[o][0]>=t?(i=o-1,r=o):e.length-1>o&&(i=o,r=o+1);const[a,s]=e[i],[l,c]=e[r];return l===a?s:s+Math.max(0,Math.min(1,(t-a)/(l-a)))*(c-s)}function hn(e,t,n,o=30){const i=t-e.x,r=n-e.y,a=Math.sqrt(i*i+r*r);return a>zt(e.r,o)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:a}}function gn(e,t,n,o=30){var i,r;if(0===e.path.length)return null;const a=bn(e.path,t);if(0>a)return null;const[s,l]=e.path[a];let c;if(e.path.length>1){let o=1/0;const i=Math.max(0,a-1),r=Math.min(e.path.length-2,a);for(let a=i;r>=a;a++){const[i,r]=e.path[a],[s,l]=e.path[a+1],c=fn(t,n,i,r,s,l);o>c&&(o=c)}c=o}else{const e=t-s,o=n-l;c=Math.sqrt(e*e+o*o)}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,o)?null:{node:e,datum:Array.isArray(e.datum)&&e.datum[a]?e.datum[a]:e.datum,x:s,y:l,distance:c}}function fn(e,t,n,o,i,r){const a=i-n,s=r-o,l=a*a+s*s;if(0===l)return Math.sqrt(Math.pow(e-n,2)+Math.pow(t-o,2));let c=((e-n)*a+(t-o)*s)/l;c=Math.max(0,Math.min(1,c));const u=o+c*s;return Math.sqrt(Math.pow(e-(n+c*a),2)+Math.pow(t-u,2))}function pn(e,t,n){const o=Wt(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function yn(e,t,n){const o=Wt(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function mn(e,t,n){const o=e.bodyWidth/2,i=Math.min(e.openY,e.closeY);if(!(e.x-o-3>t||t>e.x+o+3||e.highY-3>n||n>e.lowY+3)){const o=i+Math.max(Math.max(e.openY,e.closeY)-i,1)/2,r=t-e.x,a=n-o;return{node:e,datum:e.datum,x:e.x,y:o,distance:Math.sqrt(r*r+a*a)}}return null}function vn(e,t,n){if(0===e.topPath.length)return null;const o=bn(e.topPath,t);if(0>o)return null;const[i,r]=e.topPath[o],a=t-i,s=n-r,l=Math.sqrt(a*a+s*s);return{node:e,datum:Array.isArray(e.datum)&&e.datum[o]?e.datum[o]:e.datum,x:i,y:r,distance:l}}function bn(e,t){if(0===e.length)return-1;let n=0,o=e.length-1;for(;o>n;){const i=n+o>>1;t>e[i][0]?n=i+1:o=i}return n>0&&Math.abs(e[n][0]-t)>=Math.abs(e[n-1][0]-t)?n-1:n}function xn(e){var t,n;const o=new Map;for(const n of e){const e=null!==(t=n.group)&&void 0!==t?t:"_default";let i=o.get(e);i||(i=[],o.set(e,i)),i.push(n)}for(const e of o.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(o.keys()).sort((e,t)=>{const n=o.get(e),i=o.get(t);return(n.length>0?n[0].y:0)-(i.length>0?i[0].y:0)}),r=Array.from(o.values()).flat();r.sort((e,t)=>e.x-t.x||e.y-t.y);const a=new Map;for(let e=0;r.length>e;e++){r[e]._flatIndex=e;const t=null===(n=r[e].datum)||void 0===n?void 0:n.id;null!=t&&a.set(t+"",e)}return{flat:r,groups:i,byGroup:o,idToIdx:a}}function kn(e,t){var n,o;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!==(n=r.group)&&void 0!==n?n:"_default",indexInGroup:null!==(o=r._groupIndex)&&void 0!==o?o:0}}function wn(e,t,n){const{group:o,indexInGroup:i}=t,r=n.byGroup.get(o);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=n.groups.indexOf(o);return n.groups.length-1>e?An(n,n.groups[e+1],r[i]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?An(n,n.groups[e-1],r[i]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*n.flat.length)),n.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*n.flat.length)),0);case"Home":return 0;case"End":return n.flat.length-1;case"Escape":return-1;default:return null}}function An(e,t,n){const o=e.byGroup.get(t);let i=0,r=Math.abs(o[0].x-n.x);for(let e=1;o.length>e;e++){const t=Math.abs(o[e].x-n.x);r>t&&(r=t,i=e)}return o[i]._flatIndex}function Sn(e){return"object"==typeof e&&null!==e&&"id"in e?e.id:e}function On(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}function Cn(e,t,n,o,i,r){a(()=>{if(!e)return;const a=setInterval(()=>{var a;const s=t.current;if(!s||0===s.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(a=e.threshold)&&void 0!==a?a:5e3,u=l-s.lastIngestTime>c;u!==i&&(r(u),n.current=!0,o())},1e3);return()=>clearInterval(a)},[e,i,o])}function jn({isStale:t,position:n}){return e("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===n?{top:4,left:4}:"bottom-left"===n?{bottom:4,left:4}:"bottom-right"===n?{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 Mn={fill:(t,n)=>e("rect",{style:t,width:n,height:n}),line:(t,n)=>e("line",{style:t,x1:0,y1:0,x2:n,y2:n})};function _n(e,t,n,o,i){let r;return r="function"==typeof n?n(e):(0,Mn[n])(o(e,t),i),r}function Pn({swatchSize:t}){return e("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 Ln(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const Tn=(n,o,i,r,a,s,l,c,u,d,h)=>{const{type:g="fill",styleFn:f,items:p}=n,y=[];let m=0;const v=!(!o&&!i),b="isolate"===d||void 0===d&&null!=a,{swatchSize:x,labelGap:k,rowHeight:w}=h;return p.forEach((n,d)=>{const h=_n(n,d,g,f,x),A=Ln(n,r,a),S=a&&a.size>0&&a.has(n.label);y.push(t("g",{transform:`translate(0,${m})`,onClick:o?()=>o(n):void 0,onMouseEnter:i?()=>i(n):void 0,onMouseLeave:i?()=>i(null):void 0,tabIndex:v?c===s&&d===l?0:-1:void 0,role:v?"option":void 0,"aria-selected":v&&b?S||!1:void 0,"aria-current":v&&!b&&null!=r&&n.label===r||void 0,"aria-label":n.label,onKeyDown:v?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(n)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const n=(d+("ArrowDown"===e.key?1:-1)+p.length)%p.length;u(c,n);const o=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[n];o instanceof SVGElement&&o.focus()}}:void 0,onFocus:v?e=>{u(c,d),i&&i(n);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:v?e=>{i&&i(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:v?"pointer":"default",opacity:A,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[v&&e("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:x+k+2+7*n.label.length,height:x+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),h,S&&e(Pn,{swatchSize:x}),e("text",{y:x/2,x:x+k,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:n.label})]},"legend-item-"+d)),m+=w}),y};function $n({config:n,orientation:i="vertical",width:r=100}){const{colorFn:a,domain:s,label:l,format:c}=n,u=c||(e=>Math.round(100*e)/100+""),d="grad-legend-"+o.useId();if("horizontal"===i){const n=12,o=Math.min(r,200),i=Math.max(0,(r-o)/2),c=[];for(let t=0;64>=t;t++){const n=t/64;c.push(e("stop",{offset:100*n+"%",stopColor:a(s[0]+n*(s[1]-s[0]))},t))}return t("g",{"aria-label":l||"Gradient legend",children:[e("defs",{children:e("linearGradient",{id:d,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),l&&e("text",{x:i+o/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:l}),e("rect",{x:i,y:0,width:o,height:n,fill:`url(#${d})`,rx:2}),e("text",{x:i,y:n+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(s[0])}),e("text",{x:i+o,y:n+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(s[1])})]})}const h=[];for(let t=0;64>=t;t++){const n=t/64;h.push(e("stop",{offset:100*n+"%",stopColor:a(s[1]-n*(s[1]-s[0]))},t))}return t("g",{"aria-label":l||"Gradient legend",children:[l&&e("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:l}),e("defs",{children:e("linearGradient",{id:d,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:h})}),e("rect",{x:0,y:0,width:14,height:100,fill:`url(#${d})`,rx:2}),e("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(s[1])}),e("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(s[0])})]})}function Nn(n){const{legendGroups:i,customClickBehavior:r,customHoverBehavior:a,highlightedCategory:s,isolatedCategories:l,legendInteraction:c,title:u="Legend",width:d=100,height:h=20,orientation:g="vertical",legendLayout:f}=n,p=function(e){var t,n,o,i,r;const a=Math.max(1,null!==(t=null==e?void 0:e.swatchSize)&&void 0!==t?t:16),s=Math.max(a,null!==(n=null==e?void 0:e.rowHeight)&&void 0!==n?n:22);return{swatchSize:a,labelGap:Math.max(0,null!==(o=null==e?void 0:e.labelGap)&&void 0!==o?o:6),itemGap:Math.max(0,null!==(i=null==e?void 0:e.itemGap)&&void 0!==i?i:10),rowHeight:s,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}}(f),[y,m]=o.useState(0),[v,b]=o.useState(0),x=o.useCallback((e,t)=>{m(e),b(t)},[]),k="vertical"===g?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:a,focusedGroupIndex:s,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u,metrics:d})=>{let h=24;const g=[];return t.forEach((t,f)=>{h+=5,g.push(e("line",{stroke:"gray",x1:0,y1:h,x2:n,y2:h},"legend-top-line legend-symbol-"+f)),h+=8,t.label&&(h+=16,g.push(e("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("g",{className:"legend-item",transform:`translate(0,${h})`,children:Tn(t,o,i,r,a,s,l,f,c,u,d)},"legend-group-"+f)),h+=t.items.length*d.rowHeight+8}),g})({legendGroups:i||[],width:d,customClickBehavior:r,customHoverBehavior:a,highlightedCategory:s,isolatedCategories:l,focusedGroupIndex:y,focusedItemIndex:v,onFocusedIndexChange:x,legendInteraction:c,metrics:p}):(({legendGroups:n,height:o,width:i,customClickBehavior:r,customHoverBehavior:a,highlightedCategory:s,isolatedCategories:l,focusedGroupIndex:c,focusedItemIndex:u,onFocusedIndexChange:d,legendInteraction:h,metrics:g})=>{var f;let p=0;const y=[];n.forEach((n,o)=>{var f;let m=0;n.label&&(m+=16);const v=((n,o,i,r,a,s,l,c,u,d,h,g)=>{const{type:f="fill",styleFn:p,items:y}=n,m=[],{swatchSize:v,labelGap:b,itemGap:x,rowHeight:k,align:w}=h,A=!(!o&&!i),S="isolate"===d||void 0===d&&null!=a,O=y.map(e=>v+b+7*e.label.length),C=[];let j=0,M=0;O.forEach((e,t)=>{const n=0===M?e:M+x+e;g&&g>0&&M>0&&n>g?(C.push({start:j,end:t,width:M}),j=t,M=e):M=n}),y.length>0&&C.push({start:j,end:y.length,width:M}),C.forEach((n,d)=>{let h="center"===w?Math.max(0,((null!=g?g:n.width)-n.width)/2):"end"===w?Math.max(0,(null!=g?g:n.width)-n.width):0;for(let g=n.start;n.end>g;g++){const n=y[g],w=_n(n,g,f,p,v),C=Ln(n,r,a),j=a&&a.size>0&&a.has(n.label);m.push(t("g",{transform:`translate(${h},${d*k})`,onClick:o?()=>o(n):void 0,onMouseEnter:i?()=>i(n):void 0,onMouseLeave:i?()=>i(null):void 0,tabIndex:A?c===s&&g===l?0:-1:void 0,role:A?"option":void 0,"aria-selected":A&&S?j||!1:void 0,"aria-current":A&&!S&&null!=r&&n.label===r||void 0,"aria-label":n.label,onKeyDown:A?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(n)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const n=(g+("ArrowRight"===e.key?1:-1)+y.length)%y.length;u(c,n);const o=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[n];o instanceof SVGElement&&o.focus()}}:void 0,onFocus:A?e=>{u(c,g),i&&i(n);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:A?e=>{i&&i(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:A?"pointer":"default",opacity:C,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[A&&e("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:v+b+2+7*n.label.length,height:v+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),w,j&&e(Pn,{swatchSize:v}),e("text",{y:v/2,x:v+b,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:n.label})]},"legend-item-"+g)),h+=O[g]+x}});const _=Math.max(0,...C.map(e=>e.width)),P=C.length;return{items:m,offset:_,totalRows:P,totalHeight:P*k}})(n,r,a,s,l,c,u,o,d,h,g,null!==(f=g.maxWidth)&&void 0!==f?f:i);m+=v.offset+5,y.push(Object.assign(Object.assign({label:n.label},v),{offset:m,totalRows:v.totalRows,totalHeight:v.totalHeight})),p+=m+12});const m=null!==(f=g.maxWidth)&&void 0!==f?f:i;let v=p>m?0:"center"===g.align?Math.max(0,(m-p)/2):"end"===g.align?Math.max(0,m-p):0;const b=[];return y.forEach((t,i)=>{const r=n[i];r.label&&(b.push(e("text",{transform:`translate(${v},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)),v+=16),b.push(e("g",{className:"legend-item",transform:`translate(${v},0)`,children:t.items},"legend-group-"+i)),v+=t.offset+5,n[i+1]&&b.push(e("line",{stroke:"gray",x1:v,y1:-8,x2:v,y2:(t.totalHeight||o)+0+8},"legend-top-line legend-symbol-"+i)),v+=12}),e("g",{children:b})})({legendGroups:i||[],title:u,height:h,width:d,customClickBehavior:r,customHoverBehavior:a,highlightedCategory:s,isolatedCategories:l,focusedGroupIndex:y,focusedItemIndex:v,onFocusedIndexChange:x,legendInteraction:c,metrics:p}),w=!(!r&&!a);return t("g",{role:w?"listbox":void 0,"aria-multiselectable":!(!w||"isolate"!==c&&(void 0!==c||null==l))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==u&&""!==u&&"vertical"===g&&e("text",{className:"legend-title",y:16,x:d/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:u}),k]})}function Bn(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function Dn(e){return"object"==typeof e&&null!==e&&"gradient"in e}function En(t){var n;const{legend:o,totalWidth:i,totalHeight:r,margin:a,legendPosition:s="right",legendLayout:l,title:c,legendHoverBehavior:u,legendClickBehavior:d,legendHighlightedCategory:h,legendIsolatedCategories:g,legendInteraction:f}=t;if(!o)return null;const p="top"===s||"bottom"===s,y=!!c,m=Math.max(1,p?null!==(n=null==l?void 0:l.maxWidth)&&void 0!==n?n:Math.max(0,i-a.left-a.right):100);let v,b;return"left"===s?(v=Math.max(4,a.left-m-10),b=a.top):"top"===s?(v=a.left,b=y?32:8):"bottom"===s?(v=a.left,b=r-a.bottom+38):(v=i-a.right+10,b=a.top),e("g",{transform:`translate(${v}, ${b})`,children:Dn(o)?e($n,{config:o.gradient,orientation:p?"horizontal":"vertical",width:m}):Bn(o)?e(Nn,{legendGroups:o.legendGroups,title:"",width:m,orientation:p?"horizontal":"vertical",legendLayout:l,customHoverBehavior:u,customClickBehavior:d,highlightedCategory:h,isolatedCategories:g,legendInteraction:f}):o})}function In(e){return"string"==typeof e?{type:e}:e}function Rn({orient:n,config:o,values:i,scale:a,size:s,length:l}){const c=function(e){var t,n,o,i,r;return{type:e.type,bins:null!==(t=e.bins)&&void 0!==t?t:20,fill:null!==(n=e.fill)&&void 0!==n?n:"#4e79a7",fillOpacity:null!==(o=e.fillOpacity)&&void 0!==o?o:.5,stroke:null!==(i=e.stroke)&&void 0!==i?i:"none",strokeWidth:null!==(r=e.strokeWidth)&&void 0!==r?r:1}}(o),u="top"===n||"bottom"===n,d=r(()=>{if(0===i.length)return null;const o=a.domain(),r=s-8;if("boxplot"===c.type){const o=function(e){const t=[...e].sort((e,t)=>e-t),n=t.length;if(0===n)return null;const o=t[Math.floor(.25*n)],i=t[Math.floor(.5*n)],r=t[Math.floor(.75*n)],a=r-o;return{q1:o,median:i,q3:r,whiskerLow:Math.max(t[0],o-1.5*a),whiskerHigh:Math.min(t[n-1],r+1.5*a)}}(i);if(!o)return null;const{q1:s,median:l,q3:d,whiskerLow:h,whiskerHigh:g}=o,f=Math.min(.5*r,20),p=(r-f)/2+4;if(u){const o=a(s),i=a(d),r=a(l),u=a(h),y=a(g),m="top"===n?-1:1,v=0;return t("g",{"data-testid":"marginal-boxplot-"+n,children:[e("line",{x1:u,y1:v+m*(p+f/2),x2:y,y2:v+m*(p+f/2),stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:u,y1:v+m*p,x2:u,y2:v+m*(p+f),stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:y,y1:v+m*p,x2:y,y2:v+m*(p+f),stroke:c.fill,strokeWidth:c.strokeWidth}),e("rect",{x:Math.min(o,i),y:"top"===n?v-p-f:v+p,width:Math.abs(i-o),height:f,fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e("line",{x1:r,y1:"top"===n?v-p-f:v+p,x2:r,y2:"top"===n?v-p:v+p+f,stroke:c.fill,strokeWidth:2})]})}{const o=a(s),i=a(d),r=a(l),u=a(h),y=a(g),m="left"===n?-1:1,v=0;return t("g",{"data-testid":"marginal-boxplot-"+n,children:[e("line",{x1:v+m*(p+f/2),y1:u,x2:v+m*(p+f/2),y2:y,stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:v+m*p,y1:u,x2:v+m*(p+f),y2:u,stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:v+m*p,y1:y,x2:v+m*(p+f),y2:y,stroke:c.fill,strokeWidth:c.strokeWidth}),e("rect",{x:"left"===n?v-p-f:v+p,y:Math.min(o,i),width:f,height:Math.abs(i-o),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e("line",{x1:"left"===n?v-p-f:v+p,y1:r,x2:"left"===n?v-p:v+p+f,y2:r,stroke:c.fill,strokeWidth:2})]})}}const d=F().domain(o).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("g",{"data-testid":"marginal-histogram-"+n,children:d.map((t,o)=>{if(null==t.x0||null==t.x1)return null;const i=t.length/h*r;if(u){const r=a(t.x0),s=a(t.x1)-a(t.x0);return e("rect",{x:r,y:"top"===n?-4-i:4,width:Math.max(s,.5),height:i,fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},o)}{const r=a(t.x0),s=a(t.x1)-a(t.x0);return e("rect",{x:"left"===n?-4-i:4,y:Math.min(r,r+s),width:i,height:Math.abs(s),fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},o)}})});if("violin"===c.type){const t=r/2+4,o=[];for(const e of d){if(null==e.x0||null==e.x1)continue;const i=e.length/h*(r/2),s=a((e.x0+e.x1)/2);o.push(u?`${s},${"top"===n?-(t-i):t-i}`:`${"left"===n?-(t-i):t-i},${s}`)}for(let e=d.length-1;e>=0;e--){const i=d[e];if(null==i.x0||null==i.x1)continue;const s=i.length/h*(r/2),l=a((i.x0+i.x1)/2);o.push(u?`${l},${"top"===n?-(t+s):t+s}`:`${"left"===n?-(t+s):t+s},${l}`)}return e("g",{"data-testid":"marginal-violin-"+n,children:e("polygon",{points:o.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,o=null!=d[0].x0?a(d[0].x0):0;t.push(`M${o},${e}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const o=e.length/h*r,i=a((e.x0+e.x1)/2);t.push(`L${i},${"top"===n?-o-4:o+4}`)}const i=null!=d[d.length-1].x1?a(d[d.length-1].x1):l;t.push(`L${i},${e}`),t.push("Z")}else{const e=0,o=null!=d[0].x0?a(d[0].x0):0;t.push(`M${e},${o}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const o=e.length/h*r,i=a((e.x0+e.x1)/2);t.push(`L${"left"===n?-o-4:o+4},${i}`)}const i=null!=d[d.length-1].x1?a(d[d.length-1].x1):l;t.push(`L${e},${i}`),t.push("Z")}return e("g",{"data-testid":"marginal-ridgeline-"+n,children:e("path",{d:t.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}return null},[i,a,c,s,l,n,u,4]);return d?e("g",{className:"marginal-"+n,"data-testid":"marginal-"+n,children:d}):null}function Hn(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),i=e.split(/\s+/),r=[];let a="";for(const e of i)a&&a.length+1+e.length>o?(r.push(a),a=e):a=a?`${a} ${e}`:e;return a&&r.push(a),r}function Fn(e,t,n,o){return"curly"===e?o?`M0,0 C${.6*n},0 ${.4*n},${t/2} ${n},${t/2} C${.4*n},${t/2} ${.6*n},${t} 0,${t}`:`M0,0 C0,${.6*n} ${t/2},${.4*n} ${t/2},${n} C${t/2},${.4*n} ${t},${.6*n} ${t},0`:o?`M0,0 L${n},0 L${n},${t} L0,${t}`:`M0,0 L0,${n} L${t},${n} L${t},0`}function Wn(n,o,i,r){if(!n)return e("g",{className:"annotation-note"});const{label:a,title:s,orientation:l,align:c,wrap:u=120,noWrap:d}=n;if(!a&&!s)return e("g",{className:"annotation-note"});let h=l;h||(h=Math.abs(o)>Math.abs(i)?"leftRight":"topBottom");let g=c;g&&"dynamic"!==g||(g="topBottom"===h?0>o?"right":"left":0>i?"bottom":"top");let f="start";"topBottom"===h?"right"===g?f="end":"middle"===g&&(f="middle"):f=0>o?"end":"start";const p=16,y=s?d?[s]:Hn(s,u):[],m=a?d?[a]:Hn(a,u):[],v="leftRight"===h?"end"===f?-4:4:0;let b=0;const x=[],k=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";y.length>0&&(x.push(e("text",{className:"annotation-note-title",fill:k,textAnchor:f,fontWeight:"bold",children:y.map((t,n)=>e("tspan",{x:v,dy:0===n?0:p,children:t},n))},"annotation-note-title")),b=y.length*p),m.length>0&&x.push(e("text",{className:"annotation-note-label",fill:k,textAnchor:f,y:b,children:m.map((t,n)=>e("tspan",{x:v,dy:0===n?0:p,children:t},n))},"annotation-note-label"));let w=null;if((s||a)&&(0!==o||0!==i))if("topBottom"===h){const t=Math.min(u,120);let n=0,o=t;"end"===f?(n=-t,o=0):"middle"===f&&(n=-t/2,o=t/2),w=e("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(y.length+m.length)*p+(m.length>0?p:0);let n=0,o=t;"bottom"===g?(n=-t,o=0):"middle"===g&&(n=-t/2,o=t/2),w=e("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const A=Math.max(0,y.length+m.length-1)*p;let S=0;return"topBottom"===h?S=0>i?-(A+2):18:"leftRight"===h&&(S="middle"===g?-(A+p+(m.length>0&&y.length>0?2:0))/2+8:"bottom"===g||0>i?-(A+2):18),t("g",{className:"annotation-note",transform:`translate(${o},${i})`,children:[e("g",{className:"annotation-note-content",transform:0!==S?`translate(0,${S})`:void 0,children:x}),w]})}function zn(t,n,o,i,r){var a;const s=[];switch(t){case"callout-circle":{const t=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);t>0&&s.push(e("circle",{r:t,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const t=(null==n?void 0:n.width)||0,i=(null==n?void 0:n.height)||0;(t>0||i>0)&&s.push(e("rect",{width:t,height:i,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":(null==n?void 0:n.custom)&&s.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const t=i||0,a=r||0;if(void 0!==(null==n?void 0:n.x)){const i=(n.x||0)-t;s.push(e("line",{x1:i,y1:(n.y1||0)-a,x2:i,y2:(n.y2||0)-a,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==(null==n?void 0:n.y)){const i=(n.y||0)-a;s.push(e("line",{x1:(n.x1||0)-t,y1:i,x2:(n.x2||0)-t,y2:i,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==(null==n?void 0:n.x1)||void 0!==(null==n?void 0:n.x2)?s.push(e("line",{x1:(n.x1||0)-t,y1:0,x2:(n.x2||0)-t,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===(null==n?void 0:n.y1)&&void 0===(null==n?void 0:n.y2)||s.push(e("line",{x1:0,y1:(n.y1||0)-a,x2:0,y2:(n.y2||0)-a,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const t=null!==(a=null==n?void 0:n.width)&&void 0!==a?a:null==n?void 0:n.height;void 0!==t&&s.push(e("path",{d:Fn((null==n?void 0:n.type)||"curly",t,(null==n?void 0:n.depth)||30,void 0===(null==n?void 0:n.width)),fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return e("g",{className:"annotation-subject",children:s})}function Yn(t,n,o,i,r,a){var s;const l=[];let c=0,u=0;if("callout-circle"!==r&&"label"!==r||!(null==a?void 0:a.radius)){if("callout-rect"===r&&a){const e=a.width||0,o=a.height||0;if(e>0||o>0){const i=e/2,r=o/2,a=t-i,s=n-r;if(0!==a||0!==s){const t=Math.abs(a),n=Math.abs(s),l=e/2,d=o/2,h=t*d>n*l?l/t:d/n;c=i+a*h,u=r+s*h}}}else if("bracket"===r&&a){const e=a.width,t=a.height,n=a.depth||30;void 0!==e?(c=e/2,u=n):void 0!==t&&(c=n,u=t/2)}}else{const e=(a.radius||0)+(a.radiusPadding||0);if(e>0&&(0!==t||0!==n)){const o=Math.atan2(n,t);c=Math.cos(o)*e,u=Math.sin(o)*e}}const d=Math.sqrt(Math.pow(t-c,2)+Math.pow(n-u,2));if(d>.5){const r=i||"var(--semiotic-text-secondary, currentColor)",a="curve"===(null==o?void 0:o.type);let h=Math.atan2(n-u,t-c);if(a){const i=(null!==(s=null==o?void 0:o.curve)&&void 0!==s?s:.25)*d,a=(c+t)/2+-(n-u)/d*i,g=(u+n)/2+(t-c)/d*i;l.push(e("path",{className:"connector-curve",d:`M${c},${u}Q${a},${g} ${t},${n}`,fill:"none",stroke:r},"connector-line")),h=Math.atan2(g-u,a-c)}else l.push(e("line",{x1:c,y1:u,x2:t,y2:n,stroke:r},"connector-line"));if("arrow"===(null==o?void 0:o.end)){const t=10,n=16/180*Math.PI;l.push(e("path",{d:`M${c},${u}L${c+t*Math.cos(h+n)},${u+t*Math.sin(h+n)}L${c+t*Math.cos(h-n)},${u+t*Math.sin(h-n)}Z`,fill:r,stroke:"none"},"connector-arrow"))}}return e("g",{className:"annotation-connector",children:l})}function Gn(e){var n,o;const{x:i=0,y:r=0,dx:a,dy:s,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}=e,k=Array.isArray(i)?null!==(n=i[0])&&void 0!==n?n:0:i,w=Array.isArray(r)?null!==(o=r[0])&&void 0!==o?o:0:r,A=new Set(Array.isArray(y)?y:[]);let S=a||0,O=s||0;null!=l&&(S=l-k),null!=c&&(O=c-w);const C="string"==typeof g?g:"label";if("bracket"===C&&h&&0===S&&0===O)if(void 0!==h.width){S=h.width/2;const e=h.depth||30;O=e+(0>e?-5:5)}else if(void 0!==h.height){const e=h.depth||30;S=e+(0>e?-5:5),O=h.height/2}return t("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")&&Yn(S,O,d,f,C,h),!A.has("subject")&&zn(C,h,f,k,w),!A.has("note")&&Wn(u,S,O,f)]}))}function qn(t){var n,o;const{noteData:i}=t,{screenCoordinates:r}=i,a="string"==typeof i.type?i.type:"label",s=i.eventListeners||i.events||{};if(i.coordinates&&r){const t=i.nx||r[0][0]+(null!==(n=i.dx)&&void 0!==n?n:0),s=i.ny||r[0][1]+(null!==(o=i.dy)&&void 0!==o?o:0),l=r.map((n,o)=>{const r=Object.assign({},i,{note:0===o?i.note:{label:""},x:n[0],y:n[1],nx:t,ny:s});return e(Gn,Object.assign({"data-testid":"semiotic-annotation"},r,{type:a}),"multi-annotation-"+o)});return e("g",{children:l})}const l=i.note||{title:"none",label:i.label},c=`${l.label}-${l.title}-${i.i}`;return e(Gn,Object.assign({"data-testid":"semiotic-annotation",events:s},i,{type:a}),c)}function Xn(e,t){var n,o,i;const r=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.x)&&void 0!==o?o: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 Vn(e,t){var n,o,i;const r=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.y)&&void 0!==o?o: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 Un(e){return null==e?null:e+""}function Qn(e,t,n){var o;return null===(o=t.stickyPositionCache)||void 0===o||o.set(e,n),n}function Kn(e,t,n){var o,i;const r=e.anchor||(null===(o=e.lifecycle)||void 0===o?void 0:o.anchor)||"fixed";if("latest"===r){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let o=n.pointNodes.length-1;o>=0;o--){const i=n.pointNodes[o];if(i.pointId===e.pointId)return Qn(t,n,{x:i.x,y:i.y})}const o=function(e){var t,n,o,i,r,a;const s=e.data;if(!s||0===s.length)return null;const l=s[s.length-1],c=null!==(n=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==n?n:null===(o=e.scales)||void 0===o?void 0:o.time,u=null!==(r=null===(i=e.scales)||void 0===i?void 0:i.y)&&void 0!==r?r:null===(a=e.scales)||void 0===a?void 0:a.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)}}(n);return o?Qn(t,n,o):null}if("semantic"===r){const o=function(e,t,n){var o,i;const r=function(e){var t,n;return Un(null!==(n=null===(t=e.provenance)||void 0===t?void 0:t.stableId)&&void 0!==n?n:e.stableId)}(e);if(!r)return null;const a=null===(o=n.pointNodes)||void 0===o?void 0:o.find(e=>Un(e.pointId)===r);if(a)return Qn(t,n,{x:a.x,y:a.y});const s=null===(i=n.data)||void 0===i?void 0:i.find(e=>function(e){var t,n,o;return Un(null!==(n=null!==(t=e.stableId)&&void 0!==t?t:e.id)&&void 0!==n?n:null===(o=e.provenance)||void 0===o?void 0:o.stableId)}(e)===r);if(!s)return null;const l=Xn(s,n),c=Vn(s,n);return null==l||null==c?null:Qn(t,n,{x:l,y:c})}(e,t,n);if(o)return o}let a=null,s=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(a=t.x,s=t.y)}if(null!=a&&null!=s||(a=Xn(e,n),s=Vn(e,n)),null!=a&&null!=s)return Qn(t,n,{x:a,y:s});if("sticky"===r){const e=null===(i=n.stickyPositionCache)||void 0===i?void 0:i.get(t);if(e)return e}return null}function Zn(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const Jn={secondary:0,primary:3},eo=".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 to(e){return!0===(null==e?void 0:e._annotationDeferred)}function no(e){return"blended"===(null==e?void 0:e.cohesion)||"layer"===(null==e?void 0:e.cohesion)?e.cohesion:null}function oo(e){var t;const n=null===(t=null==e?void 0:e.provenance)||void 0===t?void 0:t.confidence;return"number"==typeof n&&Number.isFinite(n)?Math.max(0,Math.min(1,n)):null}function io(e){return Math.max(.72,.95-.06*e)}function ro(t){const n=t.map((e,t)=>{return{p:e,i:t,emphasis:(n=e.annotation,"primary"===(null==n?void 0:n.emphasis)||"secondary"===(null==n?void 0:n.emphasis)?n.emphasis:null),confidence:oo(e.annotation),readingOrder:null,rank:1};var n}),o=n.some(e=>null!=e.emphasis||null!=e.confidence),i=t.some(e=>to(e.annotation)),r=t.some(e=>null!=no(e.annotation)),a=t.some(e=>"layer"===no(e.annotation));if(!o&&!i&&!r)return t.map(e=>e.node);const s=n.filter(e=>null==e.emphasis&&null!=e.confidence).slice().sort((e,t)=>{var n,o;return(null!==(n=t.confidence)&&void 0!==n?n:0)-(null!==(o=e.confidence)&&void 0!==o?o: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 n)e.emphasis&&(e.rank=Jn[e.emphasis]);const l=n.sort((e,t)=>e.rank-t.rank||e.i-t.i).map(t=>{const{p:n,i:o,emphasis:i,readingOrder:r}=t,a=to(n.annotation);let s=n.node;if("primary"===i||"secondary"===i||null!=r){const t=null==i&&null!=r;s=e("g",Object.assign({className:t?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+i},"secondary"===i?{opacity:.6,fontSize:"0.88em"}:{},t?{opacity:io(r),"data-annotation-reading-order":r}:{},{children:n.node}),"annotation-emphasis-"+o)}const l=no(n.annotation);return l&&(s=e("g",{className:"annotation-cohesion--"+l,children:s},"annotation-cohesion-"+o)),a&&(s=e("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:s},"annotation-deferred-"+o)),s});return i&&l.unshift(e("style",{children:eo},"annotation-disclosure-style")),a&&l.unshift(e("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 ao={linear:I,monotoneX:B,monotoneY:N,step:L,stepAfter:_,stepBefore:P,basis:M,cardinal:$,catmullRom:T};function so(e,t,n,o){const i=[];return e.forEach((e,r)=>{let a;if(n){const i=n(e,r,o);a=null!=i?i:t(e,r,o)}else a=t(e,r,o);a&&i.push({node:a,annotation:e})}),ro(i)}function lo(n){return function(n,i,r){var a,s,l,c,u,d,h,g,f,p,y,m,v,b,x,k,w,A,S,O,C,j,M,_,P,L,T,$,N,B,D,R,H,F,W,z,Y,G,q,X,V,Q,K,Z,J,ee,te,ne,ie,re,ae;switch(n.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const t=Kn(n,i,r);if(!t)return null;const{x:o,y:c}=t;if(!Zn(o,c,r))return null;const u="callout"===n.type?"callout-circle":n.type,d="callout-circle"===u?{radius:null!==(a=n.radius)&&void 0!==a?a:12,radiusPadding:n.radiusPadding}:"callout-rect"===u?{width:n.width,height:n.height}:void 0;return e(qn,{noteData:Object.assign(Object.assign({x:o,y:c,dx:null!==(s=n.dx)&&void 0!==s?s:30,dy:null!==(l=n.dy)&&void 0!==l?l:-30,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:u},d?{subject:d}:{}),{connector:n.connector||{end:"arrow"},color:n.color,disable:n.disable,opacity:n.opacity,strokeDasharray:n.strokeDasharray,className:n.className})},"ann-"+i)}case"x-threshold":{const o=Xn(null!=n.value?Object.assign(Object.assign({},n),{x:n.value}):n,r);if(null==o)return null;const a=n.color||"#f97316",s=n.labelPosition||"top";let l;return l="bottom"===s?(r.height||0)-4:"center"===s?(r.height||0)/2:12,t("g",{children:[e("line",{x1:o,y1:0,x2:o,y2:r.height||0,stroke:a,strokeWidth:n.strokeWidth||1.5,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&e("text",{x:o+4,y:l,fill:a,fontSize:12,fontWeight:"bold",children:n.label})]},"ann-"+i)}case"y-threshold":{const o=Vn(null!=n.value?Object.assign(Object.assign({},n),{y:n.value}):n,r);if(null==o)return null;const a=n.color||"#f97316",s=n.labelPosition||"right";let l,c;return"left"===s?(l=4,c="start"):"center"===s?(l=(r.width||0)/2,c="middle"):(l=(r.width||0)-4,c="end"),t("g",{children:[e("line",{x1:0,y1:o,x2:r.width||0,y2:o,stroke:a,strokeWidth:n.strokeWidth||1.5,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&e("text",{x:l,y:o-4,textAnchor:c,fill:a,fontSize:12,fontWeight:"bold",children:n.label})]},"ann-"+i)}case"enclose":{const o=(n.coordinates||[]).map(e=>({x:Xn(Object.assign(Object.assign({},e),{type:"point"}),r),y:Vn(Object.assign(Object.assign({},e),{type:"point"}),r),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>o.length)return null;const a=U(o),s=n.padding||10;return t("g",{children:[e("circle",{cx:a.x,cy:a.y,r:a.r+s,fill:n.fill||"none",fillOpacity:n.fillOpacity||.1,stroke:n.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),n.label&&e("text",{x:a.x,y:a.y-a.r-s-4,textAnchor:"middle",fill:n.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:n.label})]},"ann-"+i)}case"rect-enclose":{const o=(n.coordinates||[]).map(e=>({x:Xn(Object.assign(Object.assign({},e),{type:"point"}),r),y:Vn(Object.assign(Object.assign({},e),{type:"point"}),r)})).filter(e=>null!=e.x&&null!=e.y);if(2>o.length)return null;const a=n.padding||10,s=o.map(e=>e.x),l=o.map(e=>e.y),c=Math.min(...s)-a,u=Math.max(...s)+a,d=Math.min(...l)-a,h=Math.max(...l)+a;return t("g",{children:[e("rect",{x:c,y:d,width:u-c,height:h-d,fill:n.fill||"none",fillOpacity:n.fillOpacity||.1,stroke:n.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),n.label&&e("text",{x:(c+u)/2,y:d-4,textAnchor:"middle",fill:n.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:n.label})]},"ann-"+i)}case"highlight":{const t=r.data||[],o="function"==typeof n.filter?t.filter(n.filter):n.field&&null!=n.value?t.filter(e=>e[n.field]===n.value):[],a={stroke:n.color||"#f97316",strokeWidth:2,fill:"none"};return e("g",{children:o.map((t,o)=>{const i=Xn(t,r),s=Vn(t,r);if(null==i||null==s)return null;const l="function"==typeof n.r?n.r(t):n.r||6,c="function"==typeof n.style?n.style(t):n.style||a;return e("circle",Object.assign({cx:i,cy:s,r:l},c),"hl-"+o)})},"ann-"+i)}case"bracket":{const t=Xn(n,r),o=Vn(n,r);return e(qn,{noteData:{x:null!=t?t:0,y:null!=o?o:0,dx:n.dx||0,dy:n.dy||0,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"bracket",subject:{type:n.bracketType||"curly",width:n.width,height:n.height,depth:n.depth||30},color:n.color}},"ann-"+i)}case"trend":{const o=r.data||[];if(2>o.length)return null;const a=r.xAccessor||"x",s=r.yAccessor||"y",l="ordinal"===r.frameType,y="horizontal"===r.projection,m=l?a:null,v=l?s:null;let b;const x=[],k=new Map;if(l&&m&&v){for(const e of o){const t=e[m];if(null==t)continue;const n=t+"";k.has(n)||(k.set(n,x.length),x.push(n))}b=o.map(e=>{const t=e[m],n=e[v];if(null==t||null==n)return null;const o=k.get(t+"");return null!=o?[o,+n]:null}).filter(e=>null!==e)}else b=o.map(e=>[e[a],e[s]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>b.length)return null;const w=null!==(u=null===(c=r.scales)||void 0===c?void 0:c.x)&&void 0!==u?u:null===(d=r.scales)||void 0===d?void 0:d.time,A=null!==(g=null===(h=r.scales)||void 0===h?void 0:h.y)&&void 0!==g?g:null===(f=r.scales)||void 0===f?void 0:f.value;if(!w||!A)return null;const S=e=>t=>{const n=Math.max(0,Math.floor(t)),o=Math.min(x.length-1,n+1),i=t-n,r=e(x[n]);return r+(e(x[o])-r)*i},O=w,C=A;let j;if(l)if(y){const e=S(C);j=(t,n)=>[O(n),e(t)]}else{const e=S(O);j=(t,n)=>[e(t),C(n)]}else j=(e,t)=>[O(e),C(t)];const M=n.method||"linear";let _;_="loess"===M?function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),i=o.map(e=>e[0]),r=o.map(e=>e[1]),a=Math.max(2,Math.ceil(t*n)),s=[];for(let e=0;n>e;e++){const t=i[e],o=i.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(a-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:o[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,g=0,f=0;for(let e=0;n>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){s.push([t,r[e]]);continue}const p=u*g-d*d;if(1e-12>Math.abs(p))s.push([t,h/u]);else{const e=(u*f-d*h)/p;s.push([t,(h-e*d)/u+e*t])}}return s}(b,null!==(p=n.bandwidth)&&void 0!==p?p:.3):("polynomial"===M?oe.polynomial(b,{order:n.order||2}):oe.linear(b)).points;const P=_.map(([e,t])=>{const[n,o]=j(e,t);return`${n},${o}`}).join(" "),L=n.color||"#6366f1",T=_[_.length-1],[$,N]=j(T[0],T[1]);return t("g",{children:[e("polyline",{points:P,fill:"none",stroke:L,strokeWidth:n.strokeWidth||2,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&e("text",{x:$+4,y:N-4,fill:L,fontSize:11,children:n.label})]},"ann-"+i)}case"band":{const o=null!==(m=null===(y=r.scales)||void 0===y?void 0:y.y)&&void 0!==m?m:null===(v=r.scales)||void 0===v?void 0:v.value,a=null!==(b=null==o?void 0:o(n.y0))&&void 0!==b?b:0,s=null!==(x=null==o?void 0:o(n.y1))&&void 0!==x?x:r.height||0;return t("g",{children:[e("rect",{x:0,y:Math.min(a,s),width:r.width||0,height:Math.abs(s-a),fill:n.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:n.fillOpacity||.1}),n.label&&e("text",{x:(r.width||0)-4,y:Math.min(a,s)-4,textAnchor:"end",fill:n.color||"var(--semiotic-primary, #6366f1)",fontSize:11,children:n.label})]},"ann-"+i)}case"envelope":{const o=r.data||[];if(2>o.length)return null;const a=r.xAccessor||"x",s=null!==(w=null===(k=r.scales)||void 0===k?void 0:k.x)&&void 0!==w?w:null===(A=r.scales)||void 0===A?void 0:A.time,l=null!==(O=null===(S=r.scales)||void 0===S?void 0:S.y)&&void 0!==O?O:null===(C=r.scales)||void 0===C?void 0:C.value;if(!s||!l)return null;const c=n.upperAccessor||"upperBounds",u=n.lowerAccessor||"lowerBounds",d=n.filter,h=o.filter(e=>null!=e[c]&&null!=e[u]&&!(d&&!d(e))).sort((e,t)=>e[a]-t[a]);if(2>h.length)return null;const g=ao[r.curve||"linear"]||I,f=E().x(e=>s(e[a])).y0(e=>l(e[u])).y1(e=>l(e[c])).curve(g)(h);if(!f)return null;const p=n.fill||"#6366f1";return t("g",{children:[e("path",{d:f,fill:p,fillOpacity:null!==(j=n.fillOpacity)&&void 0!==j?j:.15,stroke:"none"}),n.label&&h.length>0&&e("text",{x:s(h[h.length-1][a])+4,y:l(h[h.length-1][c])-4,fill:p,fontSize:11,children:n.label})]},"ann-"+i)}case"anomaly-band":{const o=r.data||[];if(2>o.length)return null;const a=r.yAccessor||"y",s=null!==(_=null===(M=r.scales)||void 0===M?void 0:M.x)&&void 0!==_?_:null===(P=r.scales)||void 0===P?void 0:P.time,l=null!==(T=null===(L=r.scales)||void 0===L?void 0:L.y)&&void 0!==T?T:null===($=r.scales)||void 0===$?void 0:$.value;if(!s||!l)return null;const c=o.map(e=>e[a]).filter(e=>null!=e&&isFinite(e));if(2>c.length)return null;const u=c.reduce((e,t)=>e+t,0)/c.length,d=c.reduce((e,t)=>e+Math.pow(t-u,2),0)/c.length,h=Math.sqrt(d),g=null!==(N=n.threshold)&&void 0!==N?N:2,f=u-g*h,p=!1!==n.showBand,y=n.fill||"#6366f1",m=null!==(B=n.fillOpacity)&&void 0!==B?B:.1,v=n.anomalyColor||"#ef4444",b=null!==(D=n.anomalyRadius)&&void 0!==D?D:6,x=l(u+g*h),k=l(f),w=o.filter(e=>{const t=e[a];return null!=t&&Math.abs(t-u)>g*h});return t("g",{children:[p&&e("rect",{x:0,y:Math.min(x,k),width:r.width||0,height:Math.abs(k-x),fill:y,fillOpacity:m}),w.map((t,n)=>{const o=Xn(t,r),i=Vn(t,r);return null==o||null==i?null:e("circle",{cx:o,cy:i,r:b,fill:v,fillOpacity:.7,stroke:v,strokeWidth:1.5},"anomaly-"+n)}),n.label&&e("text",{x:(r.width||0)-4,y:Math.min(x,k)-4,textAnchor:"end",fill:y,fontSize:11,children:n.label})]},"ann-"+i)}case"forecast":{const o=r.data||[];if(3>o.length)return null;const a=r.xAccessor||"x",s=r.yAccessor||"y",l=null!==(H=null===(R=r.scales)||void 0===R?void 0:R.x)&&void 0!==H?H:null===(F=r.scales)||void 0===F?void 0:F.time,c=null!==(z=null===(W=r.scales)||void 0===W?void 0:W.y)&&void 0!==z?z:null===(Y=r.scales)||void 0===Y?void 0:Y.value;if(!l||!c)return null;const u=o.map(e=>[e[a],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>u.length)return null;let d;if("polynomial"===(n.method||"linear")){const e=oe.polynomial(u,{order:n.order||2}).equation;d=t=>e.reduce((e,n,o)=>e+n*Math.pow(t,o),0)}else{const e=u.length;let t=0,n=0,o=0,i=0;for(const[e,r]of u)t+=e,n+=r,o+=e*e,i+=e*r;const r=e*o-t*t;if(1e-12>Math.abs(r))return null;const a=(e*i-t*n)/r,s=(n-a*t)/e;d=e=>s+a*e}const h=u.length,g=u.map(([e,t])=>t-d(e)).reduce((e,t)=>e+t*t,0),f=Math.sqrt(g/Math.max(h-2,1)),p=u.reduce((e,t)=>e+t[0],0)/h,y=u.reduce((e,t)=>e+Math.pow(t[0]-p,2),0),m=null!==(G=n.confidence)&&void 0!==G?G:.95,v=.99>m?.95>m?.9>m?1:1.645:1.96:2.576,b=null!==(q=n.steps)&&void 0!==q?q:5,x=u[h-1][0],k=(x-u[0][0])/Math.max(h-1,1),w=[];for(let e=1;b>=e;e++)w.push(x+e*k);const A=[];for(const e of w){const t=d(e),n=f*Math.sqrt(1+1/h+(y>0?Math.pow(e-p,2)/y:0))*v;A.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const S=`M${A.map(e=>`${l(e.x)},${c(e.yUpper)}`).join(" L")} L${A.slice().reverse().map(e=>`${l(e.x)},${c(e.yLower)}`).join(" L")} Z`,O=A.map(e=>`${l(e.x)},${c(e.yCenter)}`).join(" "),C=`${l(x)},${c(d(x))}`,j=n.strokeColor||"#6366f1";return t("g",{children:[e("path",{d:S,fill:n.fill||"#6366f1",fillOpacity:null!==(X=n.fillOpacity)&&void 0!==X?X:.15,stroke:"none"}),e("polyline",{points:`${C} ${O}`,fill:"none",stroke:j,strokeWidth:null!==(V=n.strokeWidth)&&void 0!==V?V:2,strokeDasharray:null!==(Q=n.strokeDasharray)&&void 0!==Q?Q:"6,3"}),n.label&&A.length>0&&e("text",{x:l(A[A.length-1].x)+4,y:c(A[A.length-1].yCenter)-4,fill:j,fontSize:11,children:n.label})]},"ann-"+i)}case"widget":{let t=null,o=null;if(null!=n.px&&null!=n.py)t=n.px,o=n.py;else{const e=Kn(n,i,r);if(!e)return null;t=e.x,o=e.y}if(null==t||null==o)return null;if(!Zn(t,o,r))return null;const a=null!==(K=n.dx)&&void 0!==K?K:0,s=null!==(Z=n.dy)&&void 0!==Z?Z:0,l=null!==(J=n.width)&&void 0!==J?J:32,c=null!==(ee=n.height)&&void 0!==ee?ee:32,u=null!==(te=n.content)&&void 0!==te?te:e("span",{style:{fontSize:18,cursor:"default"},title:n.label||"Info",children:"ℹ️"});return e("foreignObject",{x:t+a-l/2,y:o+s-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:e("div",{style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+i)}case"text":{const a=Kn(n,i,r);if(!a)return null;const{x:s,y:l}=a,c=s+(n.dx||0),u=l+(n.dy||0),d=n.color||"var(--semiotic-text, #333)",h=e("text",{x:c,y:u,fill:d,fontSize:n.fontSize||11,opacity:n.opacity,strokeDasharray:n.strokeDasharray,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:n.label});return!0!==n._redundantConnector?o.cloneElement(h,{key:"ann-text-"+i}):t("g",{opacity:n.opacity,strokeDasharray:n.strokeDasharray,children:[e("line",{x1:s,y1:l,x2:c,y2:u,stroke:d,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),o.cloneElement(h,{opacity:void 0,strokeDasharray:void 0})]},"ann-text-"+i)}case"category-highlight":{const o=n.category;if(null==o)return null;const a=e=>"function"==typeof e&&"function"==typeof e.bandwidth,s=null===(ne=r.scales)||void 0===ne?void 0:ne.o,l=null===(ie=r.scales)||void 0===ie?void 0:ie.x,c=null===(re=r.scales)||void 0===re?void 0:re.y,u=a(s)?s:a(l)?l:a(c)?c:null;if(!u)return null;const d=u(o+"");if(null==d)return null;const h=u.bandwidth(),g=n.color||"var(--semiotic-primary, #4589ff)",f=null!==(ae=n.opacity)&&void 0!==ae?ae:.15,p=n.label;return t("g",(r.projection?"vertical"===r.projection:u===l)?{children:[e("rect",{x:d,y:0,width:h,height:r.height||0,fill:g,fillOpacity:f}),p&&e("text",{x:d+h/2,y:12,textAnchor:"middle",fill:g,fontSize:12,fontWeight:"bold",children:p})]}:{children:[e("rect",{x:0,y:d,width:r.width||0,height:h,fill:g,fillOpacity:f}),p&&e("text",{x:12,y:d+h/2,dominantBaseline:"middle",fill:g,fontSize:12,fontWeight:"bold",children:p})]},"ann-"+i)}default:return null}}}const co=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function uo(e){return!!e&&"object"==typeof e&&co.has(function(e){return"string"==typeof(null==e?void 0:e.type)?e.type:""}(e))}function ho(e){return"primary"===(null==e?void 0:e.emphasis)||!0===(null==e?void 0:e.defensive)}function go(e,t,n={}){return"number"==typeof n.maxAnnotations&&Number.isFinite(n.maxAnnotations)?Math.max(0,Math.floor(n.maxAnnotations)):e>0&&t>0?Math.max(1,Math.round(e*t/(n.areaPerAnnotation&&n.areaPerAnnotation>0?n.areaPerAnnotation:2e4))):1/0}function fo(e){var t,n;let o;const i=null==e?void 0:e.emphasis;o="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)&&(o+=15*function(e){return Math.max(0,Math.min(1,e))}(r)),null===(n=null==e?void 0:e.lifecycle)||void 0===n?void 0:n.freshness){case"fresh":o+=8;break;case"aging":o+=4;break;case"stale":o+=1;break;case"expired":o-=200}return o}new Set(["label","callout","callout-circle","callout-rect"]);const po=32,yo=6,mo=4,vo=8,bo=72;const xo={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function ko(e){return uo(e)}function wo(e,t){if(!e)return[];const n=Math.max(1,Math.floor(t/7)),o=e.split(/\s+/).filter(Boolean),i=[];let r="";for(const e of o)r&&r.length+e.length+1>n?(i.push(r),r=e):r=r?`${r} ${e}`:e;return r&&i.push(r),i}function Ao(e,t,n,o,i){const r=e+n,a=t+o;return Math.abs(n)>Math.abs(o)?{x:0>n?r-i.width-4:r+4,y:0>o?a-i.height:a,width:i.width,height:i.height}:{x:0>n?r-i.width:r,y:0>o?a-i.height-4:a+4,width:i.width,height:i.height}}function So(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function Oo(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 Co(e,t,n,o,i,r,a,s){const l=So(e,a);let c=.4*Math.hypot(t.dx,t.dy)+80*function(e,t,n,o){const i=Math.max(0,o-e.x),r=Math.max(0,o-e.y);return(i+Math.max(0,e.x+e.width-(t-o)))*e.height+(r+Math.max(0,e.y+e.height-(n-o)))*e.width}(l,i,r,s);for(const e of n)c+=12*Oo(l,e);for(const e of o)c+=4*Oo(l,e);return c}function jo(e){var t;const{annotations:n,context:o,defaultOffset:i=po,notePadding:r=yo,markPadding:a=mo,edgePadding:s=vo,preserveManualOffsets:l=!0,routeLongConnectors:c=!0,connectorThreshold:u=bo,density:d,progressiveDisclosure:h=!1,redundantCues:g=!1,responsive:f,cohesion:p,audience:y}=e,m=o.width||0,v=o.height||0;if(0===n.length||0>=m||0>=v)return n.slice();const b=[],x=function(e,t){return(e.pointNodes||[]).map(e=>{const n=Math.max(1,e.r||1)+t;return{x:e.x-n,y:e.y-n,width:2*n,height:2*n}})}(o,a);let k=!1;const w=n.map((e,t)=>{if(!ko(e))return e;const n=function(e,t,n){var o,i;if("widget"===e.type&&"number"==typeof e.px&&"number"==typeof e.py)return{x:e.px,y:e.py};const r=null!==(o=e.pointId)&&void 0!==o?o:e.nodeId;if(null!=r&&n.pointNodes){const e=n.pointNodes.find(e=>e.pointId===r);if(e)return{x:e.x,y:e.y}}const a=e.coordinates,s=null===(i=n.scales)||void 0===i?void 0:i.geoProjection;if(Array.isArray(a)&&a.length>=2&&s){const e=a[0],t=a[1];if("number"==typeof e&&"number"==typeof t){const n=s([e,t]);if(n&&"number"==typeof n[0]&&"number"==typeof n[1])return{x:n[0],y:n[1]}}}return n.scales||"number"!=typeof e.x||"number"!=typeof e.y?Kn(e,t,n):{x:e.x,y:e.y}}(e,t,o);if(!n)return e;const a=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,n=[...wo("string"==typeof e.title?e.title:void 0,t),...wo("string"==typeof e.label?e.label:void 0,t)],o=n.reduce((e,t)=>Math.max(e,t.length),0);return{width:Math.max(24,Math.min(t,7*o)+10),height:Math.max(18,16*n.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(So(Ao(n.x,n.y,"number"==typeof e.dx?e.dx:t.dx,"number"==typeof e.dy?e.dy:t.dy,a),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=Co(Ao(n.x,n.y,e.dx,e.dy,a),e,b,x,m,v,r,s);g>t&&(h=e,g=t)}if(!h)return e;const f=So(Ao(n.x,n.y,h.dx,h.dy,a),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:n.slice();let S=A;if(g){let e=!1;const t=A.map(t=>{const n=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 n!==t&&(e=!0),n});S=e?t:A}{let e=!1;const t=S.map(t=>{if(!0!==(null==t?void 0:t.defensive))return t;const n=function(e){var t;const n=null==e?void 0:e.provenance;if(!n||"object"!=typeof n)return e;const o="string"==typeof n.source?null!==(t=xo[n.source])&&void 0!==t?t:n.source:null,i="number"==typeof n.confidence&&Number.isFinite(n.confidence)?Math.round(100*Math.max(0,Math.min(1,n.confidence)))+"%":null;if(!o&&!i)return e;if(null!=e.label&&"string"!=typeof e.label)return e;const r=[o,i].filter(Boolean).join(" · "),a="string"==typeof e.label?e.label:"";return a.includes(`(${r})`)?e:Object.assign(Object.assign({},e),{label:a?`${a} (${r})`:`(${r})`})}(t);return n!==t&&(e=!0),n});S=e?t:S}const O=new Set;if(d){const e="object"==typeof d?d:{},n=function(e){if(!e)return 1;const t=function(e){const t=null==e?void 0:e.familiarity;if(!t)return 3;const n=Object.values(t).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0===n.length?3:n.reduce((e,t)=>e+t,0)/n.length}(e);return t>2?4>t?1:.6:1.5}(y),o=1===n?e:Object.assign(Object.assign({},e),{maxAnnotations:Math.max(0,Math.round((null!==(t=e.maxAnnotations)&&void 0!==t?t:go(m,v,e))*n))}),{deferred:i}=function(e){var t;const{annotations:n,width:o,height:i}=e,r=Math.max(0,null!==(t=e.minVisible)&&void 0!==t?t:1),a=go(o,i,e),s=n.map((e,t)=>{return{annotation:e,index:t,note:(n=e,uo(n))};var n}),l=s.filter(e=>e.note);if(0===l.length||a>=l.length)return{visible:n.slice(),deferred:[],budget:a};const c=l.filter(e=>ho(e.annotation)),u=l.filter(e=>!ho(e.annotation)).sort((e,t)=>fo(t.annotation)-fo(e.annotation)||e.index-t.index),d=Math.min(u.length,Math.max(Math.max(0,a-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:n}of s)!n||h.has(t)?g.push(e):f.push(e);return{visible:g,deferred:f,budget:a}}(Object.assign({annotations:S,width:m,height:v},o));for(const e of i)O.add(e)}if(f&&("object"==typeof f&&"number"==typeof f.minWidth?f.minWidth:480)>=m)for(const e of S)ko(e)&&"secondary"===e.emphasis&&O.add(e);if(O.size>0)for(const e of S)!0===(null==e?void 0:e.defensive)&&O.delete(e);let C;return C=0===O.size?S:h?S.map(e=>O.has(e)?Object.assign(Object.assign({},e),{_annotationDeferred:!0}):e):S.filter(e=>!O.has(e)),p?function(e,t){let n=!1;const o=e.map(e=>ko(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(n=!0,Object.assign(Object.assign({},e),{cohesion:t})):e);return n?o:e}(C,p):C}let Mo={positions:new Map};const _o=new Set;function Po(){for(const e of _o)e()}function Lo(e,t){const n=Mo.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(Mo.positions);o.delete(e),Mo={positions:o},Po()}function To(e,t){const n=Mo.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(Mo.positions);o.delete(e),Mo={positions:o},Po()}function $o(){return Mo}function No(e){return _o.add(e),()=>_o.delete(e)}const Bo={positions:new Map};function Do(){return()=>{}}function Eo(){return Bo}function Io(e,t,n){return"exact"===n?function(e,t){const n=e.domain(),o=n[0],i=n[n.length-1],r=o instanceof Date,a=o instanceof Date?o.getTime():o,s=i instanceof Date?i.getTime():i;if(2>t||a===s)return r?[new Date(a),new Date(s)]:[a,s];const l=(s-a)/(t-1),c=Array(t);for(let e=0;t>e;e++){const n=e===t-1?s:a+e*l;c[e]=r?new Date(n):n}return c}(e,t):e.ticks(t)}function Ro(e,t,n){if("edges"===e){if(t)return"start";if(n)return"end"}return"middle"}function Ho(e,t,n){if("edges"===e){if(t)return"hanging";if(n)return"auto"}return"middle"}function Fo(e){if(0===e.length)return{min:null,max:null};let t=1/0,n=-1/0;for(const o of e)t>o.pixel&&(t=o.pixel),o.pixel>n&&(n=o.pixel);return{min:t,max:n}}function Wo(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function zo(e,t,n){if("left"===e||"right"===e){const o="left"===e?n:0,i="left"===e?-1:1,r=Math.ceil(t/8);let a="M0,"+o;for(let e=0;r>e;e++){const n=8*(e+1);a+=`L${Math.min(8*e+4,t)},${o+4*i}`,a+=`L${Math.min(n,t)},${o}`}return a}{const o="bottom"===e?0:t,i="bottom"===e?1:-1,r=Math.ceil(n/8);let a=`M${o},0`;for(let e=0;r>e;e++){const t=8*(e+1);a+=`L${o+4*i},${Math.min(8*e+4,n)}`,a+=`L${o},${Math.min(t,n)}`}return a}}function Yo(n){const{width:o,height:i,totalWidth:a,totalHeight:s,margin:l,scales:c,showAxes:u,axes:d,showGrid:h,xFormat:g,yFormat:f,axisExtent:p}=n,y=r(()=>{var e,t;if(!c)return[];const n=null==d?void 0:d.find(e=>"bottom"===e.orient),i=(null==n?void 0:n.tickFormat)||g||Go,r=Math.max(2,Math.floor(o/70)),a=null!==(e=null==n?void 0:n.ticks)&&void 0!==e?e:5,s=null!==(t=null==n?void 0:n.tickValues)&&void 0!==t?t:Io(c.x,"exact"===p?Math.max(2,a):Math.min(a,r),p),l=s.map(e=>e.valueOf()),u=s.map((e,t)=>({value:e,pixel:c.x(e),label:i(e,t,l)})),h=u.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 qo(u,Math.max(55,h+8))},[c,d,g,o,p]),m=r(()=>{var e,t;if(!c)return[];const n=null==d?void 0:d.find(e=>"left"===e.orient),o=(null==n?void 0:n.tickFormat)||f||Go,r=Math.max(2,Math.floor(i/30)),a=null!==(e=null==n?void 0:n.ticks)&&void 0!==e?e:5;return qo((null!==(t=null==n?void 0:n.tickValues)&&void 0!==t?t:Io(c.y,"exact"===p?Math.max(2,a):Math.min(a,r),p)).map(e=>({value:e,pixel:c.y(e),label:o(e)})),22)},[c,d,f,i,p]),v=h&&c,b=u&&c;if(!v&&!b)return null;const x=null==d?void 0:d.find(e=>"bottom"===e.orient),k=null==d?void 0:d.find(e=>"left"===e.orient),w=b&&(!x||!1!==x.baseline),A=b&&(!k||!1!==k.baseline),S=(null==x?void 0:x.jaggedBase)||!1,O=(null==k?void 0:k.jaggedBase)||!1,C="var(--semiotic-border, #ccc)";return e("svg",{width:a,height:s,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:t("g",{transform:`translate(${l.left},${l.top})`,children:[v&&(()=>{var n,r;const a=Wo(null===(n=null==d?void 0:d.find(e=>"bottom"===e.orient))||void 0===n?void 0:n.gridStyle),s=Wo(null===(r=null==d?void 0:d.find(e=>"left"===e.orient))||void 0===r?void 0:r.gridStyle);return t("g",{className:"stream-grid",children:[y.map((t,n)=>e("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:i,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:a},"xgrid-"+n)),m.map((t,n)=>e("line",{x1:0,y1:t.pixel,x2:o,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:s},"ygrid-"+n))]})})(),w&&!S&&e("line",{x1:0,y1:i,x2:o,y2:i,stroke:C,strokeWidth:1}),S&&e("path",{d:zo("bottom",o,i),fill:"none",stroke:C,strokeWidth:1}),A&&!O&&e("line",{x1:0,y1:0,x2:0,y2:i,stroke:C,strokeWidth:1}),O&&e("path",{d:zo("left",o,i),fill:"none",stroke:C,strokeWidth:1})]})})}function Go(e,t,n){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function qo(e,t){if(2>=e.length)return e;const n=[e[0]];for(let o=1;e.length-1>o;o++)t>Math.abs(e[o].pixel-n[n.length-1].pixel)||n.push(e[o]);const o=e[e.length-1];return t>Math.abs(o.pixel-n[n.length-1].pixel)?n[n.length-1]=o:n.push(o),n}function Xo(o){var s,l;const{width:u,height:d,totalWidth:h,totalHeight:g,margin:f,scales:p,showAxes:y,axes:m,xLabel:v,yLabel:b,yLabelRight:x,xFormat:k,yFormat:w,axisExtent:A,showGrid:S,title:O,legend:C,legendHoverBehavior:j,legendClickBehavior:M,legendHighlightedCategory:_,legendIsolatedCategories:P,legendPosition:L="right",legendLayout:T,foregroundGraphics:$,marginalGraphics:N,xValues:B,yValues:D,annotations:E,autoPlaceAnnotations:I,svgAnnotationRules:R,xAccessor:H,yAccessor:F,annotationData:W,pointNodes:z,curve:Y,underlayRendered:G,canvasObscuresUnderlay:q=!0,linkedCrosshairName:X,linkedCrosshairSourceId:V,children:U}=o,Q=r(()=>{var e,t;if(!y||!p)return[];const n=null==m?void 0:m.find(e=>"bottom"===e.orient),o=(null==n?void 0:n.tickFormat)||k||Go,i=Math.max(2,Math.floor(u/70)),r=null!==(e=null==n?void 0:n.ticks)&&void 0!==e?e:5,a=null!==(t=null==n?void 0:n.tickValues)&&void 0!==t?t:Io(p.x,"exact"===A?Math.max(2,r):Math.min(r,i),A),s=a.map(e=>e.valueOf()),l=a.map((e,t)=>({value:e,pixel:p.x(e),label:o(e,t,s)})),c=l.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),d=(null==n?void 0:n.autoRotate)?Math.max(20,Math.min(c+8,55)):Math.max(55,c+8);let h=qo(l,d);if(h.length>1&&(h=h.filter((e,t)=>0===t||e.label+""!=h[t-1].label+"")),(null==n?void 0:n.includeMax)&&h.length>0&&"exact"!==A&&!(null==n?void 0:n.tickValues)){const e=p.x.domain()[1],t=p.x(e),n=h[h.length-1].pixel;if(Math.abs(t-n)>1){const i=o(e,h.length,s);d>t-n&&h.length>1&&(h=h.slice(0,-1)),h.push({value:e,pixel:t,label:i})}}return h},[y,p,m,k,u,A]),K=r(()=>{var e,t;if(!y||!p)return[];const n=null==m?void 0:m.find(e=>"left"===e.orient),o=(null==n?void 0:n.tickFormat)||w||Go,i=Math.max(2,Math.floor(d/30)),r=null!==(e=null==n?void 0:n.ticks)&&void 0!==e?e:5;let a=qo((null!==(t=null==n?void 0:n.tickValues)&&void 0!==t?t:Io(p.y,"exact"===A?Math.max(2,r):Math.min(r,i),A)).map(e=>({value:e,pixel:p.y(e),label:o(e)})),22);if(a.length>1&&(a=a.filter((e,t)=>0===t||e.label+""!=a[t-1].label+"")),(null==n?void 0:n.includeMax)&&a.length>0&&"exact"!==A&&!(null==n?void 0:n.tickValues)){const e=p.y.domain()[1],t=p.y(e),n=a[a.length-1].pixel;if(Math.abs(t-n)>1){const i=o(e);22>Math.abs(t-n)&&a.length>1&&(a=a.slice(0,-1)),a.push({value:e,pixel:t,label:i})}}return a},[y,p,m,w,d,A]),Z=r(()=>{var e,t;if(!y||!p)return[];const n=null==m?void 0:m.find(e=>"right"===e.orient);if(!n)return[];const o=n.tickFormat||w||Go,i=Math.max(2,Math.floor(d/30)),r=null!==(e=n.ticks)&&void 0!==e?e:5;return qo((null!==(t=n.tickValues)&&void 0!==t?t:Io(p.y,"exact"===A?Math.max(2,r):Math.min(r,i),A)).map(e=>({value:e,pixel:p.y(e),label:o(e)})),22)},[y,p,m,w,d,A]),J=i(new Map),ee=i(null!==(s=null==E?void 0:E.length)&&void 0!==s?s:0),te=null!==(l=null==E?void 0:E.length)&&void 0!==l?l:0;ee.current!==te&&(ee.current=te,J.current=new Map);const ne=r(()=>{if(!E||0===E.length)return null;const e=lo(),t={scales:p?{x:p.x,y:p.y,time:p.x,value:p.y}:null,timeAxis:"x",xAccessor:H,yAccessor:F,width:u,height:d,data:W,frameType:"xy",pointNodes:z,curve:Y,stickyPositionCache:J.current};return so(I?jo(Object.assign({annotations:E,context:t},"object"==typeof I?I:{})):E,e,R,t)},[E,I,R,u,d,H,F,W,p,z,Y]),oe=function(e){var t;const n=c(e?No:Do,e?$o:Eo,e?$o:Eo);return e&&null!==(t=n.positions.get(e))&&void 0!==t?t:null}(X);return a(()=>{if(!(null==oe?void 0:oe.locked)||!X)return;const e=e=>{"Escape"===e.key&&To(X)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[null==oe?void 0:oe.locked,X]),y||O||C||$||N||ne&&ne.length>0||S||U||oe?t("svg",{role:"img",width:h,height:g,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[e("title",{children:"string"==typeof O?O:"XY Chart"}),e("desc",{children:"string"==typeof O?O+" — XY data visualization":"XY data visualization"}),t("g",{transform:`translate(${f.left},${f.top})`,children:[S&&p&&(!G||q)&&(()=>{var n,o;const i=Wo(null===(n=null==m?void 0:m.find(e=>"bottom"===e.orient))||void 0===n?void 0:n.gridStyle),r=Wo(null===(o=null==m?void 0:m.find(e=>"left"===e.orient))||void 0===o?void 0:o.gridStyle);return t("g",{className:"stream-grid",children:[Q.map((t,n)=>e("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:d,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:i},"xgrid-"+n)),K.map((t,n)=>e("line",{x1:0,y1:t.pixel,x2:u,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:r},"ygrid-"+n))]})})(),y&&p&&(()=>{const n=null==m?void 0:m.find(e=>"left"===e.orient),o=null==m?void 0:m.find(e=>"bottom"===e.orient),i=!n||!1!==n.baseline,r=!o||!1!==o.baseline,a=(null==n?void 0:n.jaggedBase)||!1,s=(null==o?void 0:o.jaggedBase)||!1,l=null==o?void 0:o.landmarkTicks,c=null==n?void 0:n.landmarkTicks,h="var(--semiotic-border, #ccc)",g="var(--semiotic-text-secondary, var(--semiotic-text, #666))",p="var(--semiotic-text, #333)",y=!!(null==o?void 0:o.autoRotate)&&Q.length>1&&(()=>{const e=u/Math.max(Q.length-1,1),t=Q.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0);return t+8>e})(),k={fontSize:"var(--semiotic-tick-font-size, 12px)"},w={fontSize:"calc(var(--semiotic-tick-font-size, 12px) + 1px)"},A={fontSize:"var(--semiotic-axis-label-font-size, 12px)"},S=null==o?void 0:o.tickAnchor,O=null==n?void 0:n.tickAnchor,C=Fo(Q),j=Fo(K);return t("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[t("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[(!G||q)&&r&&!s&&e("line",{x1:0,y1:d,x2:u,y2:d,stroke:h,strokeWidth:1}),(!G||q)&&s&&e("path",{d:zo("bottom",u,d),fill:"none",stroke:h,strokeWidth:1}),Q.map((n,o)=>{const i=!!l&&("function"==typeof l?l(n.value,o):Gt(n.value,o>0?Q[o-1].value:void 0));return t("g",{transform:`translate(${n.pixel},${d})`,children:[e("line",{y2:5,stroke:h,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{y:y?10:18,textAnchor:y?"end":Ro(S,n.pixel===C.min,n.pixel===C.max),fontWeight:i?600:400,fill:g,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},i?w:k),transform:y?"rotate(-45)":void 0,children:n.label}):e("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:Object.assign({textAlign:"center",userSelect:"none"},k),children:n.label})})]},"xtick-"+o)}),v&&e("text",{x:u/2,y:d+40,textAnchor:"middle",fill:p,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},A),children:v})]}),t("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[(!G||q)&&i&&!a&&e("line",{x1:0,y1:0,x2:0,y2:d,stroke:h,strokeWidth:1}),(!G||q)&&a&&e("path",{d:zo("left",u,d),fill:"none",stroke:h,strokeWidth:1}),K.map((n,o)=>{const i=!!c&&("function"==typeof c?c(n.value,o):Gt(n.value,o>0?K[o-1].value:void 0));return t("g",{transform:`translate(0,${n.pixel})`,children:[e("line",{x2:-5,stroke:h,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{x:-8,textAnchor:"end",dominantBaseline:Ho(O,n.pixel===j.min,n.pixel===j.max),fontWeight:i?600:400,fill:g,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},i?w:k),children:n.label}):e("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:Object.assign({textAlign:"right",userSelect:"none"},k),children:n.label})})]},"ytick-"+o)}),(()=>{const t=(null==n?void 0:n.label)||b;return t?e("text",{x:15-f.left,y:d/2,textAnchor:"middle",fill:p,transform:`rotate(-90, ${15-f.left}, ${d/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},A),children:t}):null})()]}),(()=>{const n=null==m?void 0:m.find(e=>"right"===e.orient);if(!n||0===Z.length)return null;const o=!1!==n.baseline,i=n.landmarkTicks,r=n.label||x,a=n.tickAnchor,s=Fo(Z);return t("g",{className:"semiotic-axis semiotic-axis-right","data-orient":"right",children:[o&&e("line",{x1:u,y1:0,x2:u,y2:d,stroke:h,strokeWidth:1}),Z.map((n,o)=>{const r=!!i&&("function"==typeof i?i(n.value,o):Gt(n.value,o>0?Z[o-1].value:void 0));return t("g",{transform:`translate(${u},${n.pixel})`,children:[e("line",{x2:5,stroke:h,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{x:8,textAnchor:"start",dominantBaseline:Ho(a,n.pixel===s.min,n.pixel===s.max),fontWeight:r?600:400,fill:g,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},r?w:k),children:n.label}):e("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:Object.assign({textAlign:"left",userSelect:"none"},k),children:n.label})})]},"ytick-r-"+o)}),r&&e("text",{x:u+f.right-15,y:d/2,textAnchor:"middle",fill:p,transform:`rotate(90, ${u+f.right-15}, ${d/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},A),children:r})]})})()]})})(),ne,N&&p&&B&&D&&t(n,{children:[N.top&&e("g",{transform:"translate(0, 0)",children:e(Rn,{orient:"top",config:In(N.top),values:B,scale:p.x,size:f.top,length:u})}),N.bottom&&e("g",{transform:`translate(0, ${d})`,children:e(Rn,{orient:"bottom",config:In(N.bottom),values:B,scale:p.x,size:f.bottom,length:u})}),N.left&&e("g",{transform:"translate(0, 0)",children:e(Rn,{orient:"left",config:In(N.left),values:D,scale:p.y,size:f.left,length:d})}),N.right&&e("g",{transform:`translate(${u}, 0)`,children:e(Rn,{orient:"right",config:In(N.right),values:D,scale:p.y,size:f.right,length:d})})]}),$,oe&&oe.sourceId!==V&&(null==p?void 0:p.x)&&(()=>{const t=p.x(oe.xValue);if(null==t||0>t||t>u)return null;const n=oe.locked;return e("line",{x1:t,y1:0,x2:t,y2:d,stroke:n?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:n?1.5:1,strokeDasharray:n?"6,3":"4,4",pointerEvents:"none"})})(),U]}),O&&e("text",{x:h/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 O?O:null}),En({legend:C,totalWidth:h,totalHeight:g,margin:f,legendPosition:L,title:O,legendLayout:T,legendHoverBehavior:j,legendClickBehavior:M,legendHighlightedCategory:_,legendIsolatedCategories:P})]}):null}function Vo(e){var t,n,o,i;return(null!==(t=e.tl)&&void 0!==t?t:0)>0||(null!==(n=e.tr)&&void 0!==n?n:0)>0||(null!==(o=e.br)&&void 0!==o?o:0)>0||(null!==(i=e.bl)&&void 0!==i?i:0)>0}function Uo(e){const t=e.cornerRadii;if(!t)return{tl:0,tr:0,br:0,bl:0};const n=Math.min(e.w,e.h)/2,o=e=>Math.max(0,Math.min(null!=e?e:0,n));return{tl:o(t.tl),tr:o(t.tr),br:o(t.br),bl:o(t.bl)}}const Qo=(e,t)=>({x:e*Math.cos(t),y:e*Math.sin(t)});function Ko(e){var t,n;const{innerRadius:o,outerRadius:i,startAngle:r,endAngle:a}=e,s=0>=o;if(0>=(null!==(t=e.cornerRadius)&&void 0!==t?t:0)||!e.roundStart&&!e.roundEnd){if(s){const e=Qo(i,r),t=Qo(i,a);return`M0,0 L${e.x},${e.y} A${i},${i} 0 ${a-r>Math.PI?1:0} 1 ${t.x},${t.y} Z`}const e=Qo(i,r),t=Qo(i,a),n=Qo(o,a),l=Qo(o,r),c=a-r>Math.PI?1:0;return`M${e.x},${e.y} A${i},${i} 0 ${c} 1 ${t.x},${t.y} L${n.x},${n.y} A${o},${o} 0 ${c} 0 ${l.x},${l.y} Z`}const l=Math.max(0,Math.min(null!==(n=e.cornerRadius)&&void 0!==n?n:0,(i-o)/2));if(0===l)return Ko(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=s?0:Math.asin(Math.min(1,l/Math.max(1e-9,o+l))),d=a-r,h=e.roundStart&&e.roundEnd?d/2:d,g=!!e.roundStart&&h>c,f=!!e.roundEnd&&h>c;if(!g&&!f)return Ko(Object.assign(Object.assign({},e),{cornerRadius:0,roundStart:!1,roundEnd:!1}));const p=r+(g?c:0),y=a-(f?c:0),m=r+(g?u:0),v=a-(f?u:0),b=Qo(i,p),x=Qo(i,y),k=(i-l)*Math.cos(c),w=Qo(k,r),A=Qo(k,a),S=s?null:Qo(o,v),O=s?null:Qo(o,m),C=s?0:(o+l)*Math.cos(u),j=s?null:Qo(C,r),M=s?null:Qo(C,a),_=y-p>Math.PI?1:0,P=s?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=Qo(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=Qo(i,a);L+=` A${i},${i} 0 ${_} 1 ${e.x},${e.y}`}if(s)L+=" L0,0";else{if(f)L+=` L${M.x},${M.y}`,L+=` A${l},${l} 0 0 1 ${S.x},${S.y}`;else{const e=Qo(o,a);L+=` L${e.x},${e.y}`}if(g)L+=` A${o},${o} 0 ${P} 0 ${O.x},${O.y}`,L+=` A${l},${l} 0 0 1 ${j.x},${j.y}`;else{const e=Qo(o,r);L+=` A${o},${o} 0 ${P} 0 ${e.x},${e.y}`}}return L+=" Z",L}function Zo(e){const t=Ko({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle,endAngle:e.endAngle,cornerRadius:e.cornerRadius,roundStart:e.roundStart,roundEnd:e.roundEnd}),n=[],o=e.colors;if(o.length>0){const t=(e.endAngle-e.startAngle)/o.length;for(let i=0;o.length>i;i++)n.push({d:Ko({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle+i*t,endAngle:e.endAngle}),color:o[i]})}return{clipPath:t,slices:n}}const Jo={innerRadius:0,outerRadius:0,startAngle:0,endAngle:0};function ei(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}function ti(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}const ni="undefined"==typeof window||"undefined"==typeof document,oi="undefined"!=typeof window?h:a;function ii(){const[e,t]=d(!1);return oi(()=>{t(!0)},[]),e}const ri=()=>()=>{},ai=()=>!1,si=()=>!0;function li(){const e=c(ri,ai,si);return i(e).current}function ci(e){const{hydrated:t,wasHydratingFromSSR:n,storeRef:o,dirtyRef:r,renderFnRef:s,cleanup:l}=e;oi(()=>{var e,i;t&&n&&(null===(i=null===(e=o.current)||void 0===e?void 0:e.cancelIntroAnimation)||void 0===i||i.call(e)),r.current=!0,s.current()},[t,n]);const c=i(l);c.current=l,a(()=>()=>{var e;return null===(e=c.current)||void 0===e?void 0:e.call(c)},[])}function ui(e){const t=i(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return hi(e,t);if(!gi(e)||!gi(t))return!1;const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;const n=e[o],i=t[o];if(!Object.is(n,i))if(Array.isArray(n)&&Array.isArray(i)){if(!hi(n,i))return!1}else{if(!gi(n)||!gi(i))return!1;if(!di(n,i))return!1}}return!0}(t.current,e)||(t.current=e),t.current}function di(e,t){const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;if(!Object.is(e[o],t[o]))return!1}return!0}function hi(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(!Object.is(e[n],t[n]))return!1;return!0}function gi(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 fi=o.createContext(null);function pi({children:t}){const[n,i]=o.useState(!1),r=o.useMemo(()=>({visible:n,setVisible:i}),[n]);return e(fi.Provider,{value:r,children:t})}function yi(){return o.useContext(fi)}const mi={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function vi(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e){if(null===(null==t?void 0:t.datum))continue;const e=t.type+"";n[e]=(n[e]||0)+1}if(0===Object.keys(n).length)return t+", empty";const o=[],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"],a=Object.keys(n).sort((e,t)=>{const n=r.indexOf(e),o=r.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of a)o.push(`${n[e]} ${i[e]||e}`);return`${t}, ${o.join(", ")}`}function bi(e,t,n){const o=[];return e>0&&o.push(e+" nodes"),t>0&&o.push(t+" edges"),0===o.length?n+", empty":`${n}, ${o.join(", ")}`}const xi=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""};function ki(e){const t={};if(null==e||"object"!=typeof e)return t;for(const[n,o]of Object.entries(e))n.startsWith("_")||null!=o&&""!==o&&("number"==typeof o?Number.isFinite(o)&&(t[n]=o):"string"==typeof o?t[n]=o:"boolean"==typeof o?t[n]=o+"":o instanceof Date&&(t[n]=o.toISOString().slice(0,10)));return t}const wi="semiotic-accessible-data-table",Ai=wi+" semiotic-accessible-data-table-hidden",Si=wi+" semiotic-accessible-data-table-visible",Oi=Si+" semiotic-accessible-data-table-network",Ci={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"},ji={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},Mi={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)"},_i={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},Pi={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))"},Li={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},Ti={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},$i={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 Ni({scene:n,chartType:i,tableId:r,chartTitle:a}){var s;const[l,c]=o.useState(!1),[u,d]=o.useState(5),h=yi(),g=null!==(s=null==h?void 0:h.visible)&&void 0!==s&&s,f=l||g,p=o.useRef(null),y=a?"Data summary for "+a:r?`Data summary for ${i} ${r}`:"Data summary for "+i;o.useEffect(()=>{f||d(5)},[f]);const m=o.useCallback(e=>{e.target===e.currentTarget&&(l||g||c(!0))},[l,g]),v=o.useCallback(e=>{var t;g||(null===(t=p.current)||void 0===t?void 0:t.contains(e.relatedTarget))||c(!1)},[g]);if(!n||0===n.length)return r?e("span",{id:r,tabIndex:-1,style:mi}):null;if(!f)return e("div",{id:r,className:Ai,tabIndex:-1,onFocus:m,style:mi,role:"region","aria-label":y,children:t("button",{type:"button",onClick:()=>c(!0),children:["View data summary (",n.length," elements)"]})});const b=function(e){var t,n,o,i,r,a,s,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:ki(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 n of e)v.push({label:t,values:ki(n)});break}case"rect":{const e=null!=x.datum&&"object"==typeof x.datum?x.datum:{},r=null!==(n=null!==(t=e.category)&&void 0!==t?t:x.group)&&void 0!==n?n:"",a=null!==(i=null!==(o=e.value)&&void 0!==o?o:e.__aggregateValue)&&void 0!==i?i:e.total;v.push({label:"Bar",values:{category:r,value:null!=a?a:""}});break}case"heatcell":{const e=ki(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!==(a=null===(r=x.datum)||void 0===r?void 0:r.category)&&void 0!==a?a:null===(s=x.datum)||void 0===s?void 0:s.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:ki(x.datum)});break;case"arc":v.push({label:"Arc",values:ki(x.datum)});break;case"candlestick":v.push({label:"Candlestick",values:ki(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}(n),x=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const o of t){const t=[],i=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[o];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 n of t)e>n&&(e=n),n>i&&(i=n),r+=n;n.push({name:o,count:t.length,numeric:!0,min:e,max:i,mean:r/t.length})}else if(i.size>0){const e=Array.from(i);n.push({name:o,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(b),k=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${xi(e.min)} to ${xi(e.max)}, mean ${xi(e.mean)}.`);else{const t=e.uniqueValues,o=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${o}.`)}return n.join(" ")}(b.length,x),w=Math.min(u,b.length),A=b.slice(0,w),S=b.length-w,O=new Set;for(const e of A)for(const t of Object.keys(e.values))O.add(t);const C=Array.from(O);return t("div",{ref:p,id:r,className:Si,tabIndex:-1,onBlur:v,style:Ci,role:"region","aria-label":y,children:[e("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{g&&h&&h.setVisible(!1),c(!1)},"aria-label":"Close data summary",style:Mi,children:"×"}),e("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:ji,children:k}),t("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+i,style:_i,children:[e("caption",{className:"semiotic-accessible-data-table-caption",style:Ti,children:S>0?`First ${w} of ${b.length} data points`:`All ${b.length} data points`}),e("thead",{children:t("tr",{children:[e("th",{style:Pi,children:"type"}),C.map(t=>e("th",{style:Pi,children:t},t))]})}),e("tbody",{children:A.map((n,o)=>t("tr",{children:[e("td",{style:Li,children:n.label}),C.map(t=>{return e("td",{style:Li,children:(o=n.values[t],null==o||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":xi(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"")},t);var o})]},o))})]}),S>0&&t("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>d(e=>e+25),style:$i,children:["Show ",Math.min(25,S)," more"," ",1===S?"row":"rows"," (",S," remaining)"]})]})}function Bi({nodes:n,edges:i,chartType:r,tableId:a,chartTitle:s}){var l,c,u,d,h,g,f,p,y,m,v,b,x,k;const[w,A]=o.useState(!1),[S,O]=o.useState(5),C=yi(),j=null!==(l=null==C?void 0:C.visible)&&void 0!==l&&l,M=w||j,_=s?"Data summary for "+s:a?`Data summary for ${r} ${a}`:"Data summary for "+r,P=o.useRef(null);o.useEffect(()=>{M||O(5)},[M]);const L=o.useCallback(e=>{e.target===e.currentTarget&&(w||j||A(!0))},[w,j]),T=o.useCallback(e=>{var t;j||(null===(t=P.current)||void 0===t?void 0:t.contains(e.relatedTarget))||A(!1)},[j]);if(!n||0===n.length)return a?e("span",{id:a,tabIndex:-1,style:mi}):null;if(!M)return e("div",{id:a,className:Ai,tabIndex:-1,onFocus:L,style:mi,role:"region","aria-label":_,children:t("button",{type:"button",onClick:()=>A(!0),children:["View data summary (",n.length," nodes, ",i.length," edges)"]})});const $=Array.isArray(n)?n:[],N=Array.isArray(i)?i:[],B=new Map,D=new Map,E=new Map,I=new Map;for(const e of N){if(!e||"object"!=typeof e)continue;const t=null!==(c=e.datum)&&void 0!==c?c:e,n="object"==typeof t.source?null===(u=t.source)||void 0===u?void 0:u.id:t.source,o="object"==typeof t.target?null===(d=t.target)||void 0===d?void 0:d.id:t.target,i="number"==typeof t.value&&Number.isFinite(t.value)?t.value:0;if(null!=n&&""!==n){const e=n+"";D.set(e,(null!==(h=D.get(e))&&void 0!==h?h:0)+1),I.set(e,(null!==(g=I.get(e))&&void 0!==g?g:0)+i)}if(null!=o&&""!==o){const e=o+"";B.set(e,(null!==(f=B.get(e))&&void 0!==f?f:0)+1),E.set(e,(null!==(p=E.get(e))&&void 0!==p?p:0)+i)}}const R=[];for(let e=0;$.length>e;e++){const t=$[e];if(!t||"object"!=typeof t)continue;const n=null!==(m=null===(y=t.datum)||void 0===y?void 0:y.id)&&void 0!==m?m:t.id,o=null!=n?n+"":"node-"+e,i=null!==(v=B.get(o))&&void 0!==v?v:0,r=null!==(b=D.get(o))&&void 0!==b?b:0,a=null!==(x=E.get(o))&&void 0!==x?x:0,s=null!==(k=I.get(o))&&void 0!==k?k:0;R.push({id:o,degree:i+r,inDeg:i,outDeg:r,wDegree:a+s,wInDeg:a,wOutDeg:s})}R.sort((e,t)=>t.degree-e.degree);let H=0,F=0;if(R.length>0){let e=0;for(const t of R)e+=t.degree,t.degree>F&&(F=t.degree);H=e/R.length}const W=N.some(e=>{var t;const n=null!==(t=null==e?void 0:e.datum)&&void 0!==t?t:e;return"number"==typeof(null==n?void 0:n.value)&&Number.isFinite(n.value)}),z=[`${R.length} nodes, ${N.length} edges.`];R.length>0&&z.push(`Mean degree: ${xi(H)}, max degree: ${F}.`);const Y=Math.min(S,R.length),G=R.slice(0,Y),q=R.length-Y;return t("div",{ref:P,id:a,className:Oi,tabIndex:-1,onBlur:T,style:Ci,role:"region","aria-label":_,children:[e("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{j&&C&&C.setVisible(!1),A(!1)},"aria-label":"Close data summary",style:Mi,children:"×"}),e("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:ji,children:z.join(" ")}),t("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Node degree summary for "+r,style:_i,children:[e("caption",{className:"semiotic-accessible-data-table-caption",style:Ti,children:q>0?`Top ${Y} of ${R.length} nodes by degree`:`All ${R.length} nodes by degree`}),e("thead",{children:t("tr",{children:[e("th",{style:Pi,children:"id"}),e("th",{style:Pi,children:"degree"}),e("th",{style:Pi,children:"in"}),e("th",{style:Pi,children:"out"}),W&&e("th",{style:Pi,children:"w. degree"}),W&&e("th",{style:Pi,children:"w. in"}),W&&e("th",{style:Pi,children:"w. out"})]})}),e("tbody",{children:G.map((n,o)=>t("tr",{children:[e("td",{style:Li,children:n.id}),e("td",{style:Li,children:n.degree}),e("td",{style:Li,children:n.inDeg}),e("td",{style:Li,children:n.outDeg}),W&&e("td",{style:Li,children:xi(n.wDegree)}),W&&e("td",{style:Li,children:xi(n.wInDeg)}),W&&e("td",{style:Li,children:xi(n.wOutDeg)})]},o))})]}),q>0&&t("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>O(e=>e+25),style:$i,children:["Show ",Math.min(25,q)," more"," ",1===q?"node":"nodes"," (",q," remaining)"]})]})}function Di({summary:t}){return t?e("div",{role:"note",style:mi,children:t}):null}function Ei({tableId:t}){return e("a",{href:"#"+t,style:mi,onClick:e=>{e.preventDefault();const n=document.getElementById(t);n&&requestAnimationFrame(()=>n.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,mi)},children:"Skip to data table"})}function Ii({hoverPoint:t}){let n="";if(t){const e=t.data||t;n="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("div",{"aria-live":"polite","aria-atomic":"true",style:mi,children:n})}const Ri="var(--semiotic-focus, #005fcc)";function Hi({active:t,hoverPoint:n,margin:o,size:i,shape:r="circle",width:a,height:s}){if(!t||!n)return null;const l=n.x+o.left,c=n.y+o.top;let u;if("rect"===r&&null!=a&&null!=s){const t=Math.max(a,4),n=Math.max(s,4);u=e("rect",{x:l-t/2-3,y:c-n/2-3,width:t+6,height:n+6,rx:3,fill:"none",stroke:Ri,strokeWidth:2,strokeDasharray:"4,2"})}else u=e("circle","wedge"===r?{cx:l,cy:c,r:12,fill:"none",stroke:Ri,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:Ri,strokeWidth:2,strokeDasharray:"4,2"});return e("svg",{style:{position:"absolute",left:0,top:0,width:i[0],height:i[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}function Fi(e){return Array.isArray(e)?e[0]:e}function Wi(e,t,n,o){return Object.assign({data:Fi(e),x:t,y:n,__semioticHoverData:!0},o)}const zi={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 Yi(e,t){return"function"==typeof t?t(e):e[t]}function Gi(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 qi(n={}){const{fields:o,title:i,format:r,style:a={},className:s=""}=n;return n=>{if(!n||"object"!=typeof n)return null;let l;const c=[];if(i){const e=Yi(n,i);l=Gi(e,r)}if(o&&o.length>0)o.forEach(e=>{let t,o,i;"string"==typeof e?(t=e,o=e,i=r):(t=e.label,o=e.accessor||e.key||"",i=e.format||r);const a=Yi(n,o);c.push({label:t,value:Gi(a,i)})});else if(!i){const e=["value","y","name","id","label"];for(const t of e)if(void 0!==n[t]){l=Gi(n[t],r);break}if(!l){const e=Object.keys(n).filter(e=>!e.startsWith("_"));e.length>0&&(l=Gi(n[e[0]],r))}}const u=Object.assign(Object.assign({},zi),a);return t("div",{className:("semiotic-tooltip "+s).trim(),style:u,children:[l&&e("div",{style:{fontWeight:c.length>0?"bold":"normal"},children:l}),c.map((e,n)=>t("div",{style:{marginTop:0===n&&l?"4px":0},children:[e.label&&t("span",{children:[e.label,": "]}),e.value]},n))]})}}function Xi(n={}){const{fields:o=[],title:i,format:r,style:a={},className:s="",showLabels:l=!0,separator:c=": "}=n;return n=>{if(!n||"object"!=typeof n)return null;const u=[];if(i){const e=Yi(n,i);u.push({value:Gi(e,r)})}o&&Array.isArray(o)&&o.length>0?o.forEach(e=>{let t,o,i;"string"==typeof e?(t=e,o=e,i=r):(t=e.label,o=e.accessor||e.key||"",i=e.format||r);const a=Gi(Yi(n,o),i);u.push({label:l?t:void 0,value:a})}):Object.keys(n).filter(e=>!e.startsWith("_")&&"data"!==e).forEach(e=>{u.push({label:l?e:void 0,value:Gi(n[e],r)})});const d=Object.assign(Object.assign({},zi),a);return Array.isArray(u)&&0!==u.length?e("div",{className:("semiotic-tooltip semiotic-tooltip-multiline "+s).trim(),style:d,children:u.map((e,n)=>t("div",{style:{marginBottom:u.length-1>n?"4px":0},children:[e.label&&t("strong",{children:[e.label,c]}),e.value]},n))}):null}}function Vi(){return n=>{var o,i,r,a,s,l,c;const u=n.allSeries;if(!u||0===u.length){const t=null!==(i=null===(o=n.data)||void 0===o?void 0:o.value)&&void 0!==i?i:null===(r=n.data)||void 0===r?void 0:r.y;return e("div",{className:"semiotic-tooltip",style:zi,children:e("div",{children:Gi(t)})})}const d=null!==(l=null!==(a=n.xValue)&&void 0!==a?a:null===(s=n.data)||void 0===s?void 0:s.time)&&void 0!==l?l:null===(c=n.data)||void 0===c?void 0:c.x;return t("div",{className:"semiotic-tooltip",style:zi,children:[null!=d&&e("div",{style:{fontWeight:600,marginBottom:4,fontSize:"0.9em",borderBottom:"1px solid var(--semiotic-border, #eee)",paddingBottom:4},children:Gi(d)}),u.map((n,o)=>t("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"1px 0"},children:[e("span",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:n.color,flexShrink:0}}),e("span",{style:{flex:1,fontSize:"0.85em"},children:n.group}),e("span",{style:{fontWeight:500,fontSize:"0.85em"},children:Gi(n.value)})]},o))]})}}function Ui(t){if(!0!==t){if("function"==typeof t){const n=t;return t=>{var o;const i=Fi(!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!==(o=t.data)&&void 0!==o?o:{}:t),r=n(i);return null==r?null:e("div",{className:"semiotic-tooltip",style:zi,children:r})}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?qi(t):qi())}}function Qi({x:t,y:n,containerWidth:i,containerHeight:r,margin:a,children:s,className:l="stream-frame-tooltip",zIndex:c=1}){const u=Number.isFinite(t)&&Number.isFinite(n),d=o.useRef(null),[h,g]=o.useState(null);o.useLayoutEffect(()=>{const e=d.current;if(!e)return;const t=e.getBoundingClientRect();g(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[s,l,i,r]);let f;f=h?`translate(${h.width+12>i-t?"calc(-100% - 12px)":"12px"}, ${h.height+12>r-n?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*i?"calc(-100% - 12px)":"12px"}, ${.3*r>n?"4px":"calc(-100% - 4px)"})`;const p=function(e){if(!o.isValidElement(e))return!1;const t=e.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;const n=e.props;if("string"==typeof n.className&&n.className.trim().length>0)return!0;const i=n.style;if(i&&"object"==typeof i){if(null!=i.background&&""!==i.background)return!0;if(null!=i.backgroundColor&&""!==i.backgroundColor)return!0}return!1}(s),y=p?null:zi;return u?e("div",{ref:d,className:p?l:(l+" semiotic-tooltip").trim(),style:Object.assign(Object.assign({},y||{}),{position:"absolute",left:a.left+t,top:a.top+n,transform:f,pointerEvents:"none",zIndex:c,width:"max-content"}),children:s}):null}function Ki(e,t){if("function"==typeof e.addEventListener)return e.addEventListener("change",t),()=>e.removeEventListener("change",t);const n=e;return n.addListener(t),()=>n.removeListener(t)}function Zi(e,t,n){const o=i(null),[r,s]=d(null);return a(()=>{if(!t&&!n)return;const e=o.current;if(!e)return;const i=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;s(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return i.observe(e),()=>i.disconnect()},[t,n]),[o,[t&&r?r.w:e[0],n&&r?r.h:e[1]]]}const Ji="undefined"==typeof window?a:h;function er(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function tr(e){const t=function(){const[e,t]=d(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return a(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),Ki(e,e=>t(e.matches))},[]),e}(),n=i(t);n.current=t;const[s,c]=Zi(e.sizeProp,e.responsiveWidth,e.responsiveHeight),u=r(()=>Object.assign(Object.assign({},e.marginDefault),e.userMargin),[e.marginDefault,e.userMargin]),h=c[0]-u.left-u.right,g=c[1]-u.top-u.bottom,f=er(e.foregroundGraphics,c,u),p=er(e.backgroundGraphics,c,u),y=_e(e=>e.theme),{transition:m,introEnabled:v}=function(e,t){var n,o;if(!1===e)return{transition:void 0,introEnabled:!1};const i="undefined"!=typeof window&&(null===(n=window.matchMedia)||void 0===n?void 0:n.call(window,"(prefers-reduced-motion: reduce)").matches);return{transition:e?!0===e?{duration:300}:{duration:null!==(o=e.duration)&&void 0!==o?o:300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(i||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),b="semiotic-table-"+o.useId(),x=i(0),k=i(()=>{}),w=l(()=>{x.current||(x.current=requestAnimationFrame(()=>k.current()))},[]);a(()=>()=>{x.current&&(cancelAnimationFrame(x.current),x.current=0)},[]);const A=i(()=>{}),S=i(()=>{}),O=i(null),C=i(0),j=l(()=>{C.current=0;const e=O.current;O.current=null,e&&A.current(e)},[]),M=l(e=>{O.current={clientX:e.clientX,clientY:e.clientY},0===C.current&&(C.current=requestAnimationFrame(j))},[j]),_=l(()=>{O.current=null,0!==C.current&&(cancelAnimationFrame(C.current),C.current=0),S.current()},[]);a(()=>()=>{O.current=null,0!==C.current&&(cancelAnimationFrame(C.current),C.current=0)},[]);const P=e.themeDirtyRef;return Ji(()=>{P&&(Qt++,P.current=!0,w())},[y,w,P]),{reducedMotion:t,reducedMotionRef:n,responsiveRef:s,size:c,margin:u,adjustedWidth:h,adjustedHeight:g,resolvedForeground:f,resolvedBackground:p,currentTheme:y,transition:m,introEnabled:v,tableId:b,rafRef:x,renderFnRef:k,scheduleRender:w,hoverHandlerRef:A,hoverLeaveRef:S,onPointerMove:M,onPointerLeave:_}}function nr(e,t,n,o){const i=e.getContext("2d");if(!i)return null;const r=t[0]*o,a=t[1]*o,s=t[0]+"px",l=t[1]+"px";return e.style.width!==s&&(e.style.width=s),e.style.height!==l&&(e.style.height=l),e.width===r&&e.height===a||(e.width=r,e.height=a),i.setTransform(o,0,0,o,0,0),i.translate(n.left,n.top),i}function or(){return"undefined"!=typeof window&&window.devicePixelRatio||1}function ir(e,t,n){let o=n;for(const n of t)"lesser"===n.thresholdType?n.value>e&&(o=n.color):e>n.value&&(o=n.color);return o}function rr(e,t,n,o,i,r){if(2>t.length)return;const a=[0];for(let e=1;t.length>e;e++){const n=t[e][0]-t[e-1][0],o=t[e][1]-t[e-1][1];a.push(a[e-1]+Math.sqrt(n*n+o*o))}const s=a[a.length-1];if(0===s)return;const l=Math.min(.2*s,40);e.strokeStyle=n,e.lineWidth=o,e.lineCap=r;for(let n=0;t.length-1>n;n++){const o=(a[n]+a[n+1])/2;let r=i;l>o&&(r*=o/l),l>s-o&&(r*=(s-o)/l),e.globalAlpha=Math.max(0,r),e.beginPath(),e.moveTo(t[n][0],t[n][1]),e.lineTo(t[n+1][0],t[n+1][1]),e.stroke()}}const ar=(e,t,n,o)=>{var i,r;const a=t.filter(e=>"line"===e.type);for(const s of a){if(2>s.path.length)continue;const l=s._introClipFraction;void 0!==l&&1>l&&(e.save(),e.beginPath(),e.rect(0,0,o.width*l,o.height),e.clip());const c=s.style.stroke||"#007bff",u=tn(e,c)||c,d=s.style.strokeWidth||2,h=s.colorThresholds,g=s.rawValues;if(e.setLineDash(s.style.strokeDasharray?s.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=s.style.opacity&&(e.globalAlpha=s.style.opacity),e.lineWidth=d,e.lineCap=s.style.strokeLinecap||"butt",s.style._edgeFade){const m=null!==(i=s.style.opacity)&&void 0!==i?i:1;rr(e,s.path,u,d,m,s.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const f=on(s.curve),p=h&&h.length>0&&g&&g.length===s.path.length,y=s._decayOpacities;if(y&&y.length===s.path.length&&!p){e.strokeStyle=u;const v=null!==(r=s.style.opacity)&&void 0!==r?r:1;for(let b=0;s.path.length-1>b;b++)e.globalAlpha=.5*(y[b]+y[b+1])*v,e.beginPath(),e.moveTo(s.path[b][0],s.path[b][1]),e.lineTo(s.path[b+1][0],s.path[b+1][1]),e.stroke()}else if(p){let x=null,k=null,w=null,A=null,S=!1;function O(t,n,o){e.beginPath(),e.strokeStyle=t,e.moveTo(n,o),S=!0}function C(){S&&(e.stroke(),S=!1)}for(let j=0;s.path.length>j;j++){const[M,_]=s.path[j],P=g[j],L=ir(P,h,u);if(null!==x&&null!==A&&null!==w){if(L===A)e.lineTo(M,_);else{const T=[];for(const $ of h){const N=$.value;(w>N||N>P)&&(N>w||P>N)||w===N||P===N||T.push({t:(N-w)/(P-w)})}T.sort((e,t)=>e.t-t.t);for(const B of T){const E=x+(M-x)*B.t,I=k+(_-k)*B.t,R=ir(w+(P-w)*Math.min(B.t+1e-4,1),h,u);e.lineTo(E,I),C(),O(R,E,I)}e.lineTo(M,_)}x=M,k=_,w=P,A=L}else O(L,M,_),x=M,k=_,w=P,A=L}C()}else{e.beginPath();const H=s.strokeGradient&&s.path.length>=2?sn(e,s.strokeGradient,s.path[0][0],0,s.path[s.path.length-1][0],0):null;if(e.strokeStyle=H||u,f)D().x(e=>e[0]).y(e=>e[1]).curve(f).context(e)(s.path);else{const[F,W]=s.path[0];e.moveTo(F,W);for(let z=1;s.path.length>z;z++)e.lineTo(s.path[z][0],s.path[z][1])}e.stroke()}if(s.style.fill&&s.style.fillOpacity&&s.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=s.style.fillOpacity,e.fillStyle=rn(e,s.style.fill,s.style.fill),f&&!p)D().x(e=>e[0]).y(e=>e[1]).curve(f).context(e)(s.path);else{const[G,q]=s.path[0];e.moveTo(G,q);for(let X=1;s.path.length>X;X++)e.lineTo(s.path[X][0],s.path[X][1])}const Y=s.path[0][0];e.lineTo(s.path[s.path.length-1][0],o.height),e.lineTo(Y,o.height),e.closePath(),e.fill()}void 0!==l&&1>l&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}};function sr(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function lr(e,t,n=.3){sr(t)&&(e.globalAlpha=t._pulseIntensity*n,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h))}function cr(e,t,n=.6){var o,i,r,a,s;if(!sr(t))return;const l=null!==(o=t._pulseGlowRadius)&&void 0!==o?o: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!==(s=null!==(a=t.cy)&&void 0!==a?a:t.y)&&void 0!==s?s: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*n,e.stroke()}function ur(e,t,n,o=.35){sr(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}function dr(e,t){const n=on(t.curve);if(!n||2>t.topPath.length||2>t.bottomPath.length){e.beginPath(),e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1]);for(let n=t.bottomPath.length-1;n>=0;n--)e.lineTo(t.bottomPath[n][0],t.bottomPath[n][1]);e.closePath()}else{const o=E().x(e=>e[0]).y0((e,n)=>t.bottomPath[n][1]).y1(e=>e[1]).curve(n).context(e);e.beginPath(),o(t.topPath)}}const hr=(e,t,n,o)=>{var i,r,a;const s=t.filter(e=>"area"===e.type);for(const t of s){if(2>t.topPath.length)continue;let n=!1;t.clipRect&&(e.save(),e.beginPath(),e.rect(t.clipRect.x,t.clipRect.y,t.clipRect.width,t.clipRect.height),e.clip(),n=!0);const s=t._introClipFraction;void 0!==s&&1>s&&(e.save(),e.beginPath(),e.rect(0,0,o.width*s,o.height),e.clip());const l=rn(e,t.style.fill,"#4e79a7"),c=t._decayOpacities;if(c&&c.length===t.topPath.length){const n=null!==(i=t.style.fillOpacity)&&void 0!==i?i:.7;e.fillStyle=l;for(let o=0;t.topPath.length-1>o;o++)e.globalAlpha=.5*(c[o]+c[o+1])*n,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.lineTo(t.bottomPath[o+1][0],t.bottomPath[o+1][1]),e.lineTo(t.bottomPath[o][0],t.bottomPath[o][1]),e.closePath(),e.fill();if(t.style.stroke&&"none"!==t.style.stroke){e.strokeStyle=tn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);for(let n=0;t.topPath.length-1>n;n++)e.globalAlpha=.5*(c[n]+c[n+1]),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.stroke()}e.globalAlpha=1;continue}const u=null!==(r=t.style.opacity)&&void 0!==r?r:1;if(dr(e,t),t.fillGradient&&("colorStops"in t.fillGradient&&t.fillGradient.colorStops.length>=2||"topOpacity"in t.fillGradient)&&t.fillGradient){let n=1/0;for(const e of t.topPath)n>e[1]&&(n=e[1]);let o=-1/0;for(const e of t.bottomPath)e[1]>o&&(o=e[1]);const i=an(e,t.fillGradient,"string"==typeof l?l:"#4e79a7",0,n,0,o);e.fillStyle=i||l,e.globalAlpha=u}else{const n=null!==(a=t.style.fillOpacity)&&void 0!==a?a:.7;e.globalAlpha=n*u,e.fillStyle=l}if(e.fill(),t._pulseIntensity&&t._pulseIntensity>0&&(dr(e,t),ur(e,t)),t.style.stroke&&"none"!==t.style.stroke){e.globalAlpha=u;const n=t.strokeGradient&&t.topPath.length>=2?sn(e,t.strokeGradient,t.topPath[0][0],0,t.topPath[t.topPath.length-1][0],0):null;e.strokeStyle=n||tn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);const o=on(t.curve);if(e.beginPath(),o)D().x(e=>e[0]).y(e=>e[1]).curve(o).context(e)(t.topPath);else{e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1])}e.stroke()}void 0!==s&&1>s&&e.restore(),n&&e.restore(),e.globalAlpha=1}},gr=(e,t,n,o)=>{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 n=null!==(i=t.style.opacity)&&void 0!==i?i:t.style.fillOpacity;null!=n&&(e.globalAlpha=n),e.fillStyle=rn(e,t.style.fill,"#4e79a7"),e.fill(),t.style.stroke&&(e.strokeStyle=rn(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth||1,e.stroke()),cr(e,t),e.globalAlpha=1}}finally{e.restore()}}};function fr(e,t){const{x:n,y:o,w:i,h:r}=t,{tl:a,tr:s,br:l,bl:c}=Uo(t);e.beginPath(),e.moveTo(n+a,o),e.lineTo(n+i-s,o),s>0&&e.arcTo(n+i,o,n+i,o+s,s),e.lineTo(n+i,o+r-l),l>0&&e.arcTo(n+i,o+r,n+i-l,o+r,l),e.lineTo(n+c,o+r),c>0&&e.arcTo(n,o+r,n,o+r-c,c),e.lineTo(n,o+a),a>0&&e.arcTo(n,o,n+a,o,a),e.closePath()}function pr(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 yr=(e,t,n,o)=>{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)mr(e,t);else if(t.cornerRadii&&Vo(t.cornerRadii)){const n=rn(e,t.style.fill,tn(e,"var(--semiotic-primary, #007bff)")),o=pr(t),i=t.fillGradient&&"string"==typeof n?an(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=i||n,fr(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=tn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else if(t.roundedTop&&t.roundedTop>0){const n=rn(e,t.style.fill,tn(e,"var(--semiotic-primary, #007bff)")),o=pr(t),i=t.fillGradient&&"string"==typeof n?an(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=i||n;const r=Math.min(t.roundedTop,t.w/2,t.h/2);e.beginPath();const{x:a,y:s,w:l,h:c}=t;switch(t.roundedEdge){case"right":e.moveTo(a,s),e.lineTo(a+l-r,s),e.arcTo(a+l,s,a+l,s+r,r),e.lineTo(a+l,s+c-r),e.arcTo(a+l,s+c,a+l-r,s+c,r),e.lineTo(a,s+c);break;case"left":e.moveTo(a+l,s),e.lineTo(a+r,s),e.arcTo(a,s,a,s+r,r),e.lineTo(a,s+c-r),e.arcTo(a,s+c,a+r,s+c,r),e.lineTo(a+l,s+c);break;case"bottom":e.moveTo(a,s),e.lineTo(a+l,s),e.lineTo(a+l,s+c-r),e.arcTo(a+l,s+c,a+l-r,s+c,r),e.lineTo(a+r,s+c),e.arcTo(a,s+c,a,s+c-r,r);break;default:e.moveTo(a,s+c),e.lineTo(a,s+r),e.arcTo(a,s,a+r,s,r),e.lineTo(a+l-r,s),e.arcTo(a+l,s,a+l,s+r,r),e.lineTo(a+l,s+c)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=tn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const n=rn(e,t.style.fill,tn(e,"var(--semiotic-primary, #007bff)")),o=pr(t),i=t.fillGradient&&"string"==typeof n?an(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=i||n,e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=tn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}lr(e,t),e.globalAlpha=1}};function mr(e,t){const n=t.style.icon,o=t.style.iconPadding||2,i=Math.min(t.w,t.h)-o;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+o,a=t.x+(t.w-i)/2;for(let o=t.y+t.h-i;o>=t.y-i;o-=r)e.drawImage(n,a,o,i,i)}else{const r=i+o,a=t.y+(t.h-i)/2;for(let o=t.x;t.x+t.w>o;o+=r)e.drawImage(n,o,a,i,i)}e.restore()}function vr(e){const[t,n,o]=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*n+.114*o>128?"#000":"#fff"}function br(e){return Number.isInteger(e)?e+"":100>Math.abs(e)?1>Math.abs(e)?e.toPrecision(3):e.toFixed(1):e.toFixed(0)}const xr=(e,t,n,o)=>{const i=t.filter(e=>"heatcell"===e.type);e.save();try{for(const t of i){const n=t.style;if(null!=(null==n?void 0:n.opacity)&&(e.globalAlpha=n.opacity),e.fillStyle=t.fill,e.fillRect(t.x,t.y,t.w,t.h),e.strokeStyle=tn(e,"var(--semiotic-surface, #fff)"),e.lineWidth=1,e.strokeRect(t.x,t.y,t.w,t.h),lr(e,t),e.globalAlpha=1,t.showValues&&null!=t.value){if(20>t.w||20>t.h)continue;const n=t.valueFormat?t.valueFormat(t.value):br(t.value),o=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=vr(t.fill),e.font=o+"px sans-serif",e.textAlign="center",e.textBaseline="middle",e.fillText(n,i,r)}}}finally{e.restore()}},kr=(e,t,n,o)=>{var i,r,a;for(const n of t){if("candlestick"!==n.type)continue;const t=n;e.save();const s=(null!==(i=t._decayOpacity)&&void 0!==i?i:1)*(null!==(a=null===(r=t.style)||void 0===r?void 0:r.opacity)&&void 0!==a?a:1);1!==s&&(e.globalAlpha=s);const l=tn(e,t.wickColor)||t.wickColor,c=60>o.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 n=Math.max(2,Math.min(t.bodyWidth/2,.12*o.height));e.fillStyle=l,e.beginPath(),e.arc(t.x,t.highY,n,0,2*Math.PI),e.fill(),e.beginPath(),e.arc(t.x,t.lowY,n,0,2*Math.PI),e.fill()}else if(t.bodyWidth>0){const n=Math.min(t.openY,t.closeY),o=Math.abs(t.openY-t.closeY),i=t.isUp?t.upColor:t.downColor,r=tn(e,i)||i;e.fillStyle=r,e.fillRect(t.x-t.bodyWidth/2,n,t.bodyWidth,Math.max(o,1)),e.strokeStyle=r,e.lineWidth=1,e.strokeRect(t.x-t.bodyWidth/2,n,t.bodyWidth,Math.max(o,1))}c&&d(),e.restore()}};function wr(e,t){if(!t)return[];const n=new Set,o=[];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+"";n.has(r)||(n.add(r),o.push(r))}return o}function Ar(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0}function Sr(e,t,n,o){return"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:n,fn:e}:"string"==typeof t?{key:t,fn:null}:"function"==typeof t?{key:o,fn:t}:{key:void 0,fn:null}}function Or(e,t,n){return o=>{if(!o||!n||!e.fn&&!t.fn)return o;let i=!1;const r=o.map(n=>{const o=e.fn&&e.key&&!(e.key in n),r=t.fn&&t.key&&!(t.key in n);if(!o&&!r)return n;i=!0;const a=Object.assign({},n);return o&&(a[e.key]=e.fn(n)),r&&(a[t.key]=t.fn(n)),a});return i?r:o}}const Cr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function jr(e){const t=e[1]-e[0],n=3156e7;return 864e5>t?e=>{const t=new Date(e);return`${(t.getUTCHours()+"").padStart(2,"0")}:${(t.getUTCMinutes()+"").padStart(2,"0")}`}:n>t?e=>{const t=new Date(e);return`${Cr[t.getUTCMonth()]} ${t.getUTCDate()}`}:5*n>t?e=>{const t=new Date(e);return`${Cr[t.getUTCMonth()]} ${t.getUTCFullYear()}`}:e=>new Date(e).getUTCFullYear()+""}const Mr={line:[hr,ar,gr],area:[hr,gr],stackedarea:[hr,gr],scatter:[gr],bubble:[gr],heatmap:[xr],bar:[yr],swarm:[gr],waterfall:[(e,t,n,o)=>{var i;yr(e,t);const r=t.filter(e=>"rect"===e.type);if(2>r.length)return;const a=r[0].datum,s=null==a?void 0:a._connectorStroke;if(s){e.save(),e.strokeStyle=tn(e,s)||s,e.lineWidth=null!==(i=null==a?void 0:a._connectorWidth)&&void 0!==i?i:1,e.setLineDash([]);for(let t=0;r.length-1>t;t++){const o=r[t],i=r[t+1],a=o.datum,s=i.datum;if(null==(null==a?void 0:a.cumEnd)||null==(null==s?void 0:s.baseline))continue;const l=n.y(a.cumEnd),c=o.x+o.w,u=i.x;e.beginPath(),e.moveTo(c,l),e.lineTo(u,l),e.stroke()}e.restore()}}],candlestick:[kr],mixed:[hr,ar,gr],custom:[hr,yr,xr,ar,gr,kr]},_r={top:20,right:20,bottom:30,left:40},Pr={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 Lr(e,t){const n=e.trim();if(/^#[0-9a-f]{3}$/i.test(n)){const e=n[1],o=n[2],i=n[3];return`#${e}${e}${o}${o}${i}${i}${t}`}if(/^#[0-9a-f]{6}$/i.test(n))return`${n}${t}`;const o=n.match(/^rgb\s*\(\s*([^)]+?)\s*\)$/i);return o?`rgba(${o[1]}, ${(parseInt(t,16)/255).toFixed(3)})`:n}const Tr={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 $r({hover:n}){var o,i,r;const a=e=>null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+"",s=null!==(o=n.data)&&void 0!==o?o:{},l=null!==(i=s.y)&&void 0!==i?i:s.value,c=null!==(r=s.x)&&void 0!==r?r:s.time;return t("div",{className:"semiotic-tooltip",style:Tr,children:[e("div",{style:{fontWeight:600,marginBottom:2},children:a(l)}),e("div",{style:{opacity:.7,fontSize:11},children:a(c)})]})}$r.ownsChrome=!0;const Nr=g(function(n,s){var c,u,h,g,y,m,v,b,x,k,w,A,S;const{chartType:O,runtimeMode:C,data:j,chunkThreshold:M,chunkSize:_,xAccessor:P,yAccessor:L,colorAccessor:T,sizeAccessor:$,groupAccessor:N,lineDataAccessor:B,curve:D,normalize:E,baseline:I,stackOrder:R,binSize:H,valueAccessor:F,arrowOfTime:W="right",windowMode:z="sliding",windowSize:Y=200,timeAccessor:G,xExtent:q,yExtent:X,extentPadding:V=.1,scalePadding:U,sizeRange:Q,size:K=[500,300],responsiveWidth:Z,responsiveHeight:J,margin:ee,className:te,background:ne,lineStyle:oe,pointStyle:ie,areaStyle:re,barStyle:ae,waterfallStyle:se,swarmStyle:le,barColors:ce,colorScheme:ue,boundsAccessor:de,boundsStyle:he,y0Accessor:ge,band:fe,gradientFill:ye,lineGradient:be,areaGroups:xe,openAccessor:we,highAccessor:Ae,lowAccessor:Se,closeAccessor:Oe,candlestickStyle:Ce,showAxes:je=!0,axes:Me,xLabel:_e,yLabel:Pe,yLabelRight:Le,xFormat:Te,yFormat:$e,axisExtent:Ne,tickFormatTime:Be,tickFormatValue:De,hoverAnnotation:Ee,tooltipContent:Ie,customHoverBehavior:Re,customClickBehavior:He,enableHover:Fe,hoverRadius:We=30,tooltipMode:ze,annotations:Ye,autoPlaceAnnotations:Ge,svgAnnotationRules:qe,showGrid:Xe,legend:Ve,legendHoverBehavior:Ue,legendClickBehavior:Qe,legendHighlightedCategory:Ke,legendIsolatedCategories:Ze,legendPosition:Je,legendLayout:et,legendCategoryAccessor:tt,onCategoriesChange:nt,backgroundGraphics:ot,foregroundGraphics:it,canvasPreRenderers:rt,svgPreRenderers:at,title:st,categoryAccessor:lt,brush:ct,onBrush:ut,decay:dt,pulse:ht,transition:gt,animate:ft,staleness:pt,heatmapAggregation:yt,heatmapXBins:mt,heatmapYBins:vt,showValues:bt,heatmapValueFormat:xt,marginalGraphics:kt,pointIdAccessor:wt,xScaleType:At,yScaleType:St,accessibleTable:Ot=!0,description:Ct,summary:jt,linkedCrosshairName:Mt,linkedCrosshairSourceId:_t,customLayout:Pt,layoutConfig:Lt}=n,$t=f().replace(/:/g,""),Nt=i(!1),Bt=tr({sizeProp:K,responsiveWidth:Z,responsiveHeight:J,userMargin:ee,marginDefault:_r,animate:ft,transitionProp:gt,themeDirtyRef:Nt}),Dt=ii(),Et=li(),{reducedMotionRef:It,responsiveRef:Rt,size:Wt,currentTheme:zt,transition:Yt,introEnabled:Gt,tableId:qt,rafRef:Xt,renderFnRef:Vt,scheduleRender:Ut}=Bt;let Qt=Bt.margin;if(kt){const e=60,t=Object.assign({},Bt.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),Qt=t}const Kt="function"==typeof it?it({size:Wt,margin:Qt}):it,Zt="function"==typeof ot?ot({size:Wt,margin:Qt}):ot,Jt=Wt[0]-Qt.left-Qt.right,en=Wt[1]-Qt.top-Qt.bottom,nn=r(()=>me(j),[j]),on=null!=Ee?Ee:Fe,rn=i(null),an=i(null),[sn,ln]=d(0),[hn,gn]=d(null),fn=i(null),pn=i(null),[yn,mn]=d(null),vn=i(Pr.primary),An=i([]),Sn=i(tt),Mn=i(nt);Sn.current=tt,Mn.current=nt;const[_n,Pn]=d(!1),[Ln,Tn]=d([]),[$n,Nn]=d([]),Bn="streaming"===C||["bar","swarm","waterfall"].includes(O),Dn=r(()=>{var e,t,n;return{chartType:O,runtimeMode:Bn?"streaming":"bounded",windowSize:Y,windowMode:z,arrowOfTime:Bn?W:"right",extentPadding:V,scalePadding:U,axisExtent:Ne,xAccessor:P,yAccessor:L,timeAccessor:Bn?G:void 0,valueAccessor:F,colorAccessor:T,sizeAccessor:$,groupAccessor:N||(B?"_lineGroup":void 0),categoryAccessor:lt,lineDataAccessor:B,xScaleType:At,yScaleType:St,xExtent:q,yExtent:X,sizeRange:Q,binSize:H,normalize:E,baseline:I,stackOrder:R,boundsAccessor:de,boundsStyle:he,y0Accessor:ge,band:fe,gradientFill:!0===ye?{topOpacity:.8,bottomOpacity:.05}:!1===ye?void 0:ye,areaGroups:xe?new Set(xe):void 0,lineGradient:be,openAccessor:we,highAccessor:Ae,lowAccessor:Se,closeAccessor:Oe,candlestickStyle:Ce,lineStyle:oe,pointStyle:ie,areaStyle:re,swarmStyle:le,waterfallStyle:se,colorScheme:ue,barColors:ce,barStyle:ae,annotations:Ye,decay:dt,pulse:ht,transition:Yt,introAnimation:Gt,staleness:pt,heatmapAggregation:yt,heatmapXBins:mt,heatmapYBins:vt,showValues:bt,heatmapValueFormat:xt,pointIdAccessor:wt,curve:D,themeCategorical:null===(e=null==zt?void 0:zt.colors)||void 0===e?void 0:e.categorical,themeSemantic:ke(zt),themeSequential:null===(t=null==zt?void 0:zt.colors)||void 0===t?void 0:t.sequential,themeDiverging:null===(n=null==zt?void 0:zt.colors)||void 0===n?void 0:n.diverging,customLayout:Pt,layoutConfig:Lt,layoutMargin:Qt}},[O,Y,z,W,V,U,Ne,P,L,G,F,At,St,T,$,N,lt,B,q,X,Q,H,E,I,R,de,he,ge,fe,ye,be,xe,we,Ae,Se,Oe,Ce,oe,ie,re,le,se,ae,ue,ce,Ye,dt,ht,null==Yt?void 0:Yt.duration,null==Yt?void 0:Yt.easing,Gt,pt,yt,mt,vt,bt,xt,Bn,wt,D,zt,Pt,Lt,Qt]),En=ui(Dn),In=i(null);In.current||(In.current=new Ht(En));const Rn=l(()=>{var e,t;const n=Sn.current,o=Mn.current;if(!o||!n)return;const i=wr(null!==(t=null===(e=In.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[],n);Ar(i,An.current)||(An.current=i,o(i))},[]);a(()=>{var e;null===(e=In.current)||void 0===e||e.updateConfig(En),Nt.current=!0,Ut()},[En,Ut]);const Hn=i(null);Hn.current||(Hn.current=new ve(e=>{const t=In.current;t&&t.ingest(e)&&(Nt.current=!0,Ut())},{chunkThreshold:M,chunkSize:_})),a(()=>{var e;null===(e=Hn.current)||void 0===e||e.updateChunkOptions({chunkThreshold:M,chunkSize:_})},[M,_]);const Fn=l(e=>{var t;null===(t=Hn.current)||void 0===t||t.push(e)},[]),Wn=l(e=>{var t;null===(t=Hn.current)||void 0===t||t.pushMany(e)},[]),zn=l(()=>{var e,t;null===(e=Hn.current)||void 0===e||e.clear(),null===(t=In.current)||void 0===t||t.clear(),Nt.current=!0,Ut()},[Ut]);p(s,()=>({push:Fn,pushMany:Wn,remove:e=>{var t,n,o;null===(t=Hn.current)||void 0===t||t.flush();const i=null!==(o=null===(n=In.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[];return i.length>0&&(fn.current&&i.some(e=>{var t;return e===(null===(t=fn.current)||void 0===t?void 0:t.data)})&&(fn.current=null,mn(null)),Nt.current=!0,Ut()),i},update:(e,t)=>{var n,o,i;null===(n=Hn.current)||void 0===n||n.flush();const r=null!==(i=null===(o=In.current)||void 0===o?void 0:o.update(e,t))&&void 0!==i?i:[];return r.length>0&&(Nt.current=!0,Ut()),r},clear:zn,getData:()=>{var e,t,n;return null===(e=Hn.current)||void 0===e||e.flush(),null!==(n=null===(t=In.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=In.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null},getExtents:()=>{var e,t;return null!==(t=null===(e=In.current)||void 0===e?void 0:e.getExtents())&&void 0!==t?t:null}}),[Fn,Wn,zn,Ut]),a(()=>{var e,t;if(j){if(B&&nn.length>0&&"object"==typeof nn[0]&&null!==nn[0]){const t="string"==typeof B?B:"coordinates";if(Array.isArray(nn[0][t])){const n=[];for(const e of nn){const o=e[t];if(Array.isArray(o)){const t=e.label||e.id||e.key;if(null!=t)for(const e of o)n.push(Object.assign(Object.assign({},e),{_lineGroup:t}));else for(const e of o)n.push(e)}}return void(null===(e=Hn.current)||void 0===e||e.setBoundedData(n))}}null===(t=Hn.current)||void 0===t||t.setBoundedData(nn)}},[j,nn,B]);const{hoverHandlerRef:Yn,hoverLeaveRef:Gn,onPointerMove:qn,onPointerLeave:Xn}=Bt;Yn.current=e=>{var t,n,o,i;if(!on)return;const r=rn.current;if(!r)return;const a=r.getBoundingClientRect(),s=e.clientX-a.left-Qt.left,l=e.clientY-a.top-Qt.top;if(0>s||s>Jt||0>l||l>en)return void(fn.current&&(fn.current=null,pn.current=null,mn(null),Re&&(Re(null),Nt.current=!0),Ut()));const c=In.current;if(!c||0===c.scene.length)return;const u=un(c.scene,s,l,We,c.quadtree,c.maxPointRadius),d="multi"===ze,h=()=>{fn.current&&(fn.current=null,pn.current=null,mn(null),Re&&Re(null),Ut())};if(!u&&!d)return void h();const g=d||!u?s:u.x,f=d||!u?l:u.y,p=(null==u?void 0:u.datum)?Tt(u.datum,c.resolvedRibbons):{},y=null===(n=null===(t=c.scales)||void 0===t?void 0:t.x)||void 0===n?void 0:n.invert,m="function"==typeof y?y(g):void 0;let v=Wi(p,g,f,null!=m?{xValue:m,xPx:g}:void 0);if(d&&c.scene.length>0&&c.scales){const e=function(e,t,n=30){const o=[];for(const i of e)if("line"===i.type){const e=i;if(2>e.path.length)continue;const r=dn(cn(e.path,e.curve),t,n);if(null===r)continue;const a=bn(e.path,t);o.push({node:i,datum:Array.isArray(e.datum)&&e.datum[a]?e.datum[a]:e.datum,x:e.path[a][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=cn(e.topPath,e.curve),a=cn(e.bottomPath,e.curve),s=dn(r,t,n);if(null===s)continue;const l=dn(a,t,n),c=bn(e.topPath,t);o.push({node:i,datum:Array.isArray(e.datum)&&e.datum[c]?e.datum[c]:e.datum,x:e.topPath[c][0],y:s,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 o}(c.scene,g,Math.max(We,Jt));if(e.length>0){const t=c.scales.y.invert,n=vn.current,o=y?y(g):g;if(u)v.xValue=o,v.xPx=g;else{const e={xValue:o};"string"==typeof P&&(e[P]=o),v=Wi(e,g,f,{xValue:o,xPx:g})}v.allSeries=e.map(e=>{const o=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?o-i:o,valuePx:e.y,color:e.color||n,datum:Tt(e.datum,c.resolvedRibbons)}})}}u||(null===(o=v.allSeries)||void 0===o?void 0:o.length)?(fn.current=v,pn.current=null!==(i=null==u?void 0:u.node)&&void 0!==i?i:null,mn(v),Re&&(Re(v),Nt.current=!0),Ut()):h()},Gn.current=()=>{fn.current&&(fn.current=null,pn.current=null,mn(null),Re&&(Re(null),Nt.current=!0),Ut())};const Vn=i(()=>{});Vn.current=e=>{var t,n;if(!He)return;const o=rn.current;if(!o)return;const i=o.getBoundingClientRect(),r=e.clientX-i.left-Qt.left,a=e.clientY-i.top-Qt.top;if(0>r||r>Jt||0>a||a>en)return void He(null);const s=In.current;if(!s||0===s.scene.length)return void He(null);const l=un(s.scene,r,a,We,s.quadtree,s.maxPointRadius);if(!l)return void He(null);const c=l.datum||{},u=null===(n=null===(t=s.scales)||void 0===t?void 0:t.x)||void 0===n?void 0:n.invert,d="function"==typeof u?u(l.x):void 0;He(Wi(c,l.x,l.y,null!=d?{xValue:d,xPx:l.x}:void 0))};const Un=l(e=>Vn.current(e),[]),Qn=i(-1),Kn=i(null),Zn=i(null),Jn=l(e=>{const t=In.current;if(!t||0===t.scene.length)return;const n=t.version;let o;if(Zn.current&&Zn.current.version===n)o=Zn.current.graph;else{const e=function(e){var t,n,o;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,n=Array.isArray(e.datum)?e.datum:[],o=null!==(t=e.group)&&void 0!==t?t:"_default";for(let t=0;e.path.length>t&&n.length>t;t++)i.push({x:e.path[t][0],y:e.path[t][1],datum:n[t],shape:"circle",group:o});break}case"area":{const e=r,t=Array.isArray(e.datum)?e.datum:[],o=null!==(n=e.group)&&void 0!==n?n:"_default";for(let n=0;e.topPath.length>n&&t.length>n;n++)i.push({x:e.topPath[n][0],y:e.topPath[n][1],datum:t[n],shape:"circle",group:o});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!==(o=r.group)&&void 0!==o?o:"_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;o=xn(e),Zn.current={version:n,graph:o}}const i=Qn.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),Qn.current=0;const n=o.flat[0];Kn.current={shape:n.shape,w:n.w,h:n.h};const i=On(Object.assign(Object.assign({},n),{datum:Tt(n.datum,t.resolvedRibbons)}));return fn.current=i,mn(i),Re&&Re(i),void Ut()}const r=kn(o,i),a=wn(e.key,r,o);if(null===a)return;if(e.preventDefault(),0>a)return Qn.current=-1,Kn.current=null,fn.current=null,pn.current=null,mn(null),Re&&Re(null),void Ut();Qn.current=a;const s=o.flat[a];Kn.current={shape:s.shape,w:s.w,h:s.h};const l=On(Object.assign(Object.assign({},s),{datum:Tt(s.datum,t.resolvedRibbons)}));fn.current=l,mn(l),Re&&Re(l),Ut()},[Re,Ut]),eo=l(e=>{Qn.current=-1,Kn.current=null,qn(e)},[qn]);Vt.current=()=>{var e,t;Xt.current=0;const n=rn.current,o=an.current;if(!n||!o)return;const i=In.current;if(!i)return;const r="undefined"!=typeof performance?performance.now():Date.now(),a=i.advanceTransition(It.current?r+1e6:r),s=!It.current&&a,l=Nt.current||a;l&&!s&&(i.computeScene({width:Jt,height:en}),Rn());const c=or(),u=function(e){if(!e)return Pr;const t=getComputedStyle(e),n=t.getPropertyValue("--semiotic-border").trim(),o=t.getPropertyValue("--semiotic-text-secondary").trim(),i=t.getPropertyValue("--semiotic-bg").trim(),r=t.getPropertyValue("--semiotic-primary").trim(),a=o||t.getPropertyValue("--text-secondary").trim(),s=t.getPropertyValue("--text-primary").trim(),l=n||t.getPropertyValue("--surface-3").trim(),c=i||t.getPropertyValue("--surface-0").trim();return a||s||n||r?{axisStroke:l||Pr.axisStroke,tickText:a||Pr.tickText,crosshair:a?Lr(a,"66"):Pr.crosshair,hoverFill:c?Lr(c,"4D"):Pr.hoverFill,hoverStroke:a?Lr(a,"99"):Pr.hoverStroke,pointRing:c||Pr.pointRing,primary:r||Pr.primary}:Pr}(n);vn.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=nr(n,Wt,Qt,c);if(e){if(e.clearRect(-Qt.left,-Qt.top,Wt[0],Wt[1]),h&&(e.globalAlpha=null!==(t=null==pt?void 0:pt.dimOpacity)&&void 0!==t?t:.5),"transparent"!==ne&&!ot){const t=getComputedStyle(n).getPropertyValue("--semiotic-bg").trim(),o=ne||(t&&"transparent"!==t?t:null),i=o?tn(e,o):null;i&&(e.fillStyle=i,e.fillRect(-Qt.left,-Qt.top,Wt[0],Wt[1]))}if(e.save(),"function"==typeof e.rect&&(e.beginPath(),e.rect(0,0,Jt,en),e.clip()),rt&&i.scales)for(const t of rt)e.save(),t(e,i.scene,i.scales,{width:Jt,height:en}),e.restore();const o=Pt?Mr.custom:Mr[O];if(o&&i.scales)for(const t of o)t(e,i.scene,i.scales,{width:Jt,height:en});e.restore(),h&&(e.globalAlpha=1)}}{const e=nr(o,Wt,Qt,c);if(e&&(e.clearRect(-Qt.left,-Qt.top,Wt[0],Wt[1]),on&&fn.current&&i.scales&&function(e,t,n,o,i,r,a){var s;if(!1===i.crosshair)return;const l=t.allSeries,c=l&&l.length>0,u=null!==(s=t.xPx)&&void 0!==s?s:t.x;e.save();const d="object"==typeof i.crosshair?i.crosshair:{};if(e.strokeStyle=d.stroke||a.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,o),e.stroke(),c||(e.beginPath(),e.moveTo(0,t.y),e.lineTo(n,t.y),e.stroke()),e.restore(),c){e.lineWidth=2,e.strokeStyle=a.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||a.primary,e.fill(),e.stroke())}else{const n=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 n="string"==typeof t.fill?t.fill:null;return"line"===e.type||"area"===e.type?t.stroke||n||null:n||t.stroke||null}(r)||a.primary;e.beginPath(),e.arc(t.x,t.y,4,0,2*Math.PI),e.fillStyle=n,e.fill(),e.strokeStyle=a.pointRing,e.lineWidth=2,e.stroke()}}(e,fn.current,Jt,en,"object"==typeof on?on:{},pn.current,u),pn.current&&Array.isArray(Ee))){const t=Ee.find(e=>e&&"object"==typeof e&&"highlight"===e.type);t&&function(e,t,n,o,i){var r;if(!n)return;const a="group"in n?n.group:void 0;if(void 0!==a)for(const n of t){if("line"!==n.type)continue;if(n.group!==a)continue;if(2>n.path.length)continue;const t="function"==typeof o.style?n.datum?o.style(n.datum):{}:o.style||{};e.save(),e.beginPath(),e.moveTo(n.path[0][0],n.path[0][1]);for(let t=1;n.path.length>t;t++)e.lineTo(n.path[t][0],n.path[t][1]);e.strokeStyle=t.stroke||n.style.stroke||i.primary,e.lineWidth=t.strokeWidth||(n.style.strokeWidth||2)+2,e.globalAlpha=null!==(r=t.opacity)&&void 0!==r?r:1,e.stroke(),e.restore()}}(e,i.scene,pn.current,t,u)}}l&&n&&n.setAttribute("aria-label",vi(i.scene,O+" chart"));const g=Nt.current;if(Nt.current=!1,g&&i.scales){const e=e=>"object"==typeof e&&null!==e&&"function"==typeof e.valueOf?e.valueOf():e;if((!hn||e(hn.x.domain()[0])!==e(i.scales.x.domain()[0])||e(hn.x.domain()[1])!==e(i.scales.x.domain()[1])||e(hn.y.domain()[0])!==e(i.scales.y.domain()[0])||e(hn.y.domain()[1])!==e(i.scales.y.domain()[1])||hn.x.range()[0]!==i.scales.x.range()[0]||hn.x.range()[1]!==i.scales.x.range()[1]||hn.y.range()[0]!==i.scales.y.range()[0]||hn.y.range()[1]!==i.scales.y.range()[1])&&gn(i.scales),kt){const e=i.getData(),t="function"==typeof P?P:e=>e[P||"x"],n="function"==typeof L?L:e=>e[L||"y"];Tn(e.map(e=>t(e)).filter(e=>"number"==typeof e&&isFinite(e))),Nn(e.map(e=>n(e)).filter(e=>"number"==typeof e&&isFinite(e)))}}g&&Ye&&Ye.length>0&&ln(e=>e+1),(null==pt?void 0:pt.showBadge)&&Pn(!!h),(s||null!=i.activeTransition||i.hasActivePulses)&&(Xt.current=requestAnimationFrame(()=>Vt.current()))},ci({hydrated:Dt,wasHydratingFromSSR:Et,storeRef:In,dirtyRef:Nt,renderFnRef:Vt,cleanup:()=>{var e;return null===(e=Hn.current)||void 0===e?void 0:e.clear()}}),a(()=>{Nt.current=!0,Ut()},[O,Jt,en,je,ne,oe,rt,Ut]),Cn(pt,In,Nt,Ut,_n,Pn);const to=r(()=>{if(Te||Be)return;const e=In.current;return(null==e?void 0:e.xIsDate)&&hn?jr(hn.x.domain()):void 0},[Te,Be,hn]),no=Te||Be||to,oo=on&&yn?Ie?Ie(yn):e($r,{hover:yn}):null,io=oo?e(Qi,{x:yn.x,y:yn.y,containerWidth:Jt,containerHeight:en,margin:Qt,className:"stream-frame-tooltip",children:oo}):null,ro=Kn.current,ao=e(Hi,{active:Qn.current>=0,hoverPoint:yn,margin:Qt,size:Wt,shape:null==ro?void 0:ro.shape,width:null==ro?void 0:ro.w,height:null==ro?void 0:ro.h}),so=Sr(P,G,"__semiotic_resolvedX","__semiotic_resolvedTime"),lo=Sr(L,F,"__semiotic_resolvedY","__semiotic_resolvedValue"),co=so.key,uo=lo.key,ho=Or(so,lo,Ye&&Ye.length>0||!1);if(ni||!Dt&&Et){const n=In.current;n&&j&&(n.ingest({inserts:nn,bounded:!0}),n.computeScene({width:Jt,height:en}));const i=null!==(c=null==n?void 0:n.scene)&&void 0!==c?c:[],r=null!==(u=null==n?void 0:n.scales)&&void 0!==u?u:null,a=no||(()=>{if((null==n?void 0:n.xIsDate)&&r)return jr(r.x.domain())})();return t("div",{ref:Rt,className:"stream-xy-frame"+(te?" "+te:""),role:"img","aria-label":Ct||("string"==typeof st?st:"XY chart"),style:{position:"relative",width:Z?"100%":Wt[0],height:J?"100%":Wt[1]},children:[e(Di,{summary:jt}),t("svg",{xmlns:"http://www.w3.org/2000/svg",width:Wt[0],height:Wt[1],style:{position:"absolute",left:0,top:0},children:[e("g",{transform:`translate(${Qt.left},${Qt.top})`,children:Zt}),t("g",{transform:`translate(${Qt.left},${Qt.top})`,children:[ne&&e("rect",{x:0,y:0,width:Jt,height:en,fill:ne}),at&&r&&at.map((t,n)=>e(o.Fragment,{children:t(i,r,{width:Jt,height:en})},"svgpre-"+n)),i.map((n,o)=>function(n,o,i){var r,a,s,l,c;switch(n.type){case"line":{const t=n;if(0===t.path.length)return null;const i="M"+t.path.map(([e,t])=>`${e},${t}`).join("L");return e("path",{d:i,fill:"none",stroke:t.style.stroke||"#4e79a7",strokeWidth:t.style.strokeWidth||2,strokeDasharray:t.style.strokeDasharray,opacity:t.style.opacity},"line-"+o)}case"area":{const c=n;if(0===c.topPath.length)return null;const u=`M${c.topPath.map(([e,t])=>`${e},${t}`).join("L")}L${[...c.bottomPath].reverse().map(([e,t])=>`${e},${t}`).join("L")}Z`;if(c.clipRect){const n=`${i?i+"-":""}area-clip-${o}`;return t("g",{children:[e("defs",{children:e("clipPath",{id:n,children:e("rect",{x:c.clipRect.x,y:c.clipRect.y,width:c.clipRect.width,height:c.clipRect.height})})}),e("path",{d:u,fill:ei(c.style.fill),fillOpacity:null!==(a=null!==(r=c.style.fillOpacity)&&void 0!==r?r:c.style.opacity)&&void 0!==a?a:.7,stroke:c.style.stroke,strokeWidth:c.style.strokeWidth,clipPath:`url(#${n})`})]},"area-"+o)}return e("path",{d:u,fill:ei(c.style.fill),fillOpacity:null!==(l=null!==(s=c.style.fillOpacity)&&void 0!==s?s:c.style.opacity)&&void 0!==l?l:.7,stroke:c.style.stroke,strokeWidth:c.style.strokeWidth},"area-"+o)}case"point":{const t=n;return e("circle",{cx:t.x,cy:t.y,r:t.r,fill:ei(t.style.fill),opacity:null!==(c=t.style.opacity)&&void 0!==c?c:.8,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},"point-"+o)}case"rect":{const t=n;return e("rect",{x:t.x,y:t.y,width:t.w,height:t.h,fill:ei(t.style.fill),opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},"rect-"+o)}case"heatcell":{const i=n;if(i.showValues&&null!=i.value&&i.w>=20&&i.h>=20){const n=i.valueFormat?i.valueFormat(i.value):Number.isInteger(i.value)?i.value+"":100>Math.abs(i.value)?1>Math.abs(i.value)?i.value.toPrecision(3):i.value.toFixed(1):i.value.toFixed(0),[r,a,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]}(i.fill),l=.299*r+.587*a+.114*s>128?"#000":"#fff",c=Math.max(10,Math.min(16,.3*Math.min(i.w,i.h)));return t("g",{children:[e("rect",{x:i.x,y:i.y,width:i.w,height:i.h,fill:i.fill}),e("text",{x:i.x+i.w/2,y:i.y+i.h/2,textAnchor:"middle",dominantBaseline:"middle",fill:l,fontSize:c+"px",children:n})]},"heatcell-"+o)}return e("rect",{x:i.x,y:i.y,width:i.w,height:i.h,fill:i.fill},"heatcell-"+o)}case"candlestick":{const i=n,r=Math.min(i.openY,i.closeY),a=Math.max(Math.abs(i.openY-i.closeY),1),s=i.isUp?i.upColor:i.downColor;return t("g",{children:[e("line",{x1:i.x,y1:i.highY,x2:i.x,y2:i.lowY,stroke:i.wickColor,strokeWidth:i.wickWidth}),e("rect",{x:i.x-i.bodyWidth/2,y:r,width:i.bodyWidth,height:a,fill:s,stroke:s,strokeWidth:1})]},"candle-"+o)}default:return null}}(n,o,$t)).filter(Boolean)]})]}),e(Xo,{width:Jt,height:en,totalWidth:Wt[0],totalHeight:Wt[1],margin:Qt,scales:r,showAxes:je,axes:Me,xLabel:_e,yLabel:Pe,yLabelRight:Le,xFormat:a,yFormat:$e||De,axisExtent:Ne,showGrid:Xe,title:st,legend:Ve,legendHoverBehavior:Ue,legendClickBehavior:Qe,legendHighlightedCategory:Ke,legendIsolatedCategories:Ze,legendPosition:Je,legendLayout:et,foregroundGraphics:Ft(Kt,null===(h=In.current)||void 0===h?void 0:h.customLayoutOverlays),marginalGraphics:kt,xValues:[],yValues:[],annotations:Ye,autoPlaceAnnotations:Ge,svgAnnotationRules:qe,annotationFrame:0,xAccessor:co,yAccessor:uo,annotationData:ho(null==n?void 0:n.getData()),pointNodes:null==n?void 0:n.scene.filter(e=>"point"===e.type),curve:"string"==typeof D?D:void 0,linkedCrosshairName:Mt,linkedCrosshairSourceId:_t})]})}return t("div",{ref:Rt,className:"stream-xy-frame"+(te?" "+te:""),role:"group","aria-label":Ct||("string"==typeof st?st:"XY chart"),tabIndex:0,style:{position:"relative",width:Z?"100%":Wt[0],height:J?"100%":Wt[1],overflow:"visible"},onKeyDown:Jn,children:[Ot&&e(Ei,{tableId:qt}),Ot&&e(Ni,{scene:null!==(y=null===(g=In.current)||void 0===g?void 0:g.scene)&&void 0!==y?y:[],chartType:O+" chart",tableId:qt,chartTitle:"string"==typeof st?st:void 0}),e(Di,{summary:jt}),e(Ii,{hoverPoint:yn}),t("div",{role:"img","aria-label":Ct||("string"==typeof st?st:"XY chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:on?eo:void 0,onMouseLeave:on?Xn:void 0,onClick:He?Un:void 0,children:[Zt&&e("svg",{style:{position:"absolute",left:0,top:0,width:Wt[0],height:Wt[1],pointerEvents:"none"},children:e("g",{transform:`translate(${Qt.left},${Qt.top})`,children:Zt})}),e(Yo,{width:Jt,height:en,totalWidth:Wt[0],totalHeight:Wt[1],margin:Qt,scales:hn,showAxes:je,axes:Me,showGrid:Xe,xFormat:no,yFormat:$e||De,axisExtent:Ne}),e("canvas",{ref:rn,"aria-label":vi(null!==(v=null===(m=In.current)||void 0===m?void 0:m.scene)&&void 0!==v?v:[],O+" chart"),style:{position:"absolute",left:0,top:0}}),e("canvas",{ref:an,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e(Xo,{width:Jt,height:en,totalWidth:Wt[0],totalHeight:Wt[1],margin:Qt,scales:hn,showAxes:je,axes:Me,xLabel:_e,yLabel:Pe,yLabelRight:Le,xFormat:no,yFormat:$e||De,axisExtent:Ne,showGrid:Xe,title:st,legend:Ve,legendHoverBehavior:Ue,legendClickBehavior:Qe,legendHighlightedCategory:Ke,legendIsolatedCategories:Ze,legendPosition:Je,legendLayout:et,foregroundGraphics:Ft(Kt,null===(b=In.current)||void 0===b?void 0:b.customLayoutOverlays),marginalGraphics:kt,xValues:Ln,yValues:$n,annotations:Ye,autoPlaceAnnotations:Ge,svgAnnotationRules:qe,annotationFrame:sn,xAccessor:co,yAccessor:uo,annotationData:ho(null===(x=In.current)||void 0===x?void 0:x.getData()),pointNodes:null===(k=In.current)||void 0===k?void 0:k.scene.filter(e=>"point"===e.type),curve:"string"==typeof D?D:void 0,underlayRendered:!0,canvasObscuresUnderlay:"transparent"!==ne&&!ot,linkedCrosshairName:Mt,linkedCrosshairSourceId:_t}),(ct||ut)&&e(pe,{width:Jt,height:en,totalWidth:Wt[0],totalHeight:Wt[1],margin:Qt,dimension:null!==(w=null==ct?void 0:ct.dimension)&&void 0!==w?w:"xy",scales:hn,onBrush:null!=ut?ut:()=>{},binSize:H,snap:null==ct?void 0:ct.snap,binBoundaries:null!==(A=null==ct?void 0:ct.binBoundaries)&&void 0!==A?A:"bar"===O?null===(S=In.current)||void 0===S?void 0:S.getBinBoundaries():void 0,snapDuring:null==ct?void 0:ct.snapDuring,streaming:"streaming"===C}),(null==pt?void 0:pt.showBadge)&&e(jn,{isStale:_n,position:pt.badgePosition}),ao,io]})]})});function Br(e,t){var n;const{columns:o,config:i,resolvePieceStyle:r}=e,a=[],s=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(o),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!==(n=i.cornerRadius)&&void 0!==n?n:0)>0;for(let e=0;h.length>e;e++){const t=h[e],n=t.pieceData[0],o="number"==typeof(null==n?void 0:n._pctStart)?n._pctStart:t.pctStart,d=c+o*u,g=c+(o+("number"==typeof(null==n?void 0:n._pct)?n._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:s,startAngle:d,endAngle:g},i.cornerRadius&&{cornerRadius:i.cornerRadius}),{style:p,datum:(null==n?void 0:n._nonInteractive)?null:t.pieceData,category:t.name});(null==n?void 0:n._roundedEnds)?v.roundedEnds=n._roundedEnds:f&&(v.roundedEnds={start:y,end:m}),(null==n?void 0:n._gradientBand)&&(v._gradientBand=n._gradientBand),a.push(v)}return a}function Dr(e){var t,n,o;const i=e.length,r=e[0],a=e[i-1];return{n:i,min:r,q1:null!==(t=W(e,.25))&&void 0!==t?t:r,median:null!==(n=W(e,.5))&&void 0!==n?n:(r+a)/2,q3:null!==(o=W(e,.75))&&void 0!==o?o:a,max:a,mean:e.reduce((e,t)=>e+t,0)/i}}function Er(e,t,n){if(Array.isArray(e)&&e.length>0)return e;if("string"==typeof e){const t=ht[e];if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:n}function Ir(e){return 0===e.length?()=>"#4e79a7":t=>{var n;let o=0;for(let e=0;t.length>e;e++)o=31*o+t.charCodeAt(e)|0;return null!==(n=e[Math.abs(o)%e.length])&&void 0!==n?n:"#4e79a7"}}Nr.displayName="StreamXYFrame";const Rr={bar:function(e,t){var n,o,i;const{scales:r,columns:a,config:s,getR:l,getStack:c,resolvePieceStyle:u}=e,{r:d,projection:h}=r,g=[],f="vertical"===h,p="horizontal"===h,y=s.normalize,m=[];if(c){const e=new Set;for(const t of Object.values(a))for(const n of t.pieceData){const t=c(n);e.has(t)||(e.add(t),m.push(t))}}else m.push("_default");for(const e of Object.values(a)){const t=new Map;for(const n of e.pieceData){const e=c?c(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const o=t.get(e);o.total+=l(n),o.pieces.push(n)}let n=0;if(y)for(const e of t.values())n+=Math.abs(e.total);let o=0,i=0;for(const r of m){const a=t.get(r);if(!a)continue;let s=a.total;y&&n>0&&(s/=n);const l=u(a.pieces[0],c?r:e.name),h=Object.assign(Object.assign({},a.pieces[0]),{__aggregateValue:a.total,__pieceCount:a.pieces.length,category:e.name});if(f){const t=d(0>s?i:o+s),n=0>s?d(i+s)-d(i):d(o)-d(o+s);g.push(Ee(e.x,t,e.width,Math.abs(n),l,h,r)),0>s?i+=s:o+=s}else if(p){const t=d(0>s?i+s:o),n=0>s?d(i)-d(i+s):d(o+s)-d(o);g.push(Ee(t,e.x,Math.abs(n),e.width,l,h,r)),0>s?i+=s:o+=s}}}const v="vertical"===h,b=s.roundedTop&&s.roundedTop>0?Math.max(0,s.roundedTop):0;for(const e of g){if("rect"!==e.type)continue;const t=null!==(o=null===(n=e.datum)||void 0===n?void 0:n.__aggregateValue)&&void 0!==o?o:0;e.roundedEdge=v?0>t?"bottom":"top":0>t?"left":"right",s.gradientFill&&(e.fillGradient=s.gradientFill)}if(b>0){const e=new Map;for(const t of g){if("rect"!==t.type)continue;const n=(null===(i=t.datum)||void 0===i?void 0:i.category)||"";e.has(n)||e.set(n,[]),e.get(n).push(t)}for(const t of e.values()){if(0===t.length)continue;const e=t.filter(e=>{var t,n;return(null!==(n=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==n?n:0)>=0}),n=t.filter(e=>{var t,n;return 0>(null!==(n=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==n?n: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),n.length>0&&(n.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:n,columns:o,config:i,getR:r,getGroup:a,resolvePieceStyle:s}=e,{r:l,projection:c}=n,u=[],d="vertical"===c,h=[],g=new Set;for(const e of Object.values(o))for(const t of e.pieceData){const e=a?a(t):"_default";g.has(e)||(g.add(e),h.push(e))}const f=h.length||1;for(const e of Object.values(o)){const t=e.width/f,n=.2*t,o=t-n,i=new Map;for(const t of e.pieceData){const e=a?a(t):"_default";i.has(e)||i.set(e,[]),i.get(e).push(t)}for(let a=0;h.length>a;a++){const c=i.get(h[a])||[];for(const i of c){const c=r(i),g=s(i,h[a]);if(d){const r=e.x+a*t+n/2,s=l(0),d=l(c);u.push(Ee(r,Math.min(s,d),o,Math.abs(s-d),g,i,h[a]))}else{const r=e.x+a*t+n/2,s=l(0),d=l(c);u.push(Ee(Math.min(s,d),r,Math.abs(d-s),o,g,i,h[a]))}}}}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 n,o;const{scales:i,columns:r,getR:a,multiScales:s,resolvePieceStyle:l}=e,{r:c,projection:u}=i,d=[],h="vertical"===u,g="radial"===u,f=s.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!==(n=t.__rIndex)&&void 0!==n?n:0,r=null!==(o=t.__rValue)&&void 0!==o?o:a(t),u=f&&s[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,n=u(r);b=Math.cos(t)*n,x=Math.sin(t)*n}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:n,columns:o,getR:i,resolvePieceStyle:r}=e,{r:a,projection:s}=n,l=[],c="vertical"===s;for(const e of Object.values(o)){const t=e.width/2;for(let n=0;e.pieceData.length>n;n++){const o=e.pieceData[n],s=i(o),u=r(o,e.name),d=u.r||4,h=(7919*n%100/100-.5)*t*.8,g=c?e.middle+h:a(s),f=c?a(s):e.middle+h;l.push({type:"point",x:g,y:f,r:d,style:u,datum:o})}}return l},pie:Br,donut:Br,boxplot:function(e,t){var n,o,i,r,a,s;const{scales:l,columns:c,config:u,getR:d,resolveSummaryStyle:h}=e,{r:g,projection:f}=l,p=[],y="vertical"===f,m=!1!==u.showOutliers;for(const t of Object.values(c)){const l=t.pieceData.map(e=>d(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===l.length)continue;const c=l[0],u=l[l.length-1],f=null!==(n=W(l,.25))&&void 0!==n?n:c,v=null!==(o=W(l,.5))&&void 0!==o?o:(c+u)/2,b=null!==(i=W(l,.75))&&void 0!==i?i:u,x=b-f,k=f-1.5*x,w=b+1.5*x,A=null!==(r=l.find(e=>e>=k))&&void 0!==r?r:c,S=null!==(a=[...l].reverse().find(e=>w>=e))&&void 0!==a?a:u,O=h(t.pieceData[0],t.name),C=[];if(m)for(const e of t.pieceData){const n=d(e);if(k>n||n>w){const o=y?t.middle:g(n),i=y?g(n):t.middle;C.push({px:o,py:i,value:n,datum:e})}}if(p.push({type:"boxplot",x:y?t.middle:0,y:y?0:t.middle,projection:y?"vertical":"horizontal",columnWidth:.6*t.width,minPos:g(A),q1Pos:g(f),medianPos:g(v),q3Pos:g(b),maxPos:g(S),stats:{n:l.length,min:A,q1:f,median:v,q3:b,max:S,mean:l.reduce((e,t)=>e+t,0)/l.length},style:O,datum:t.pieceData,category:t.name,outliers:C}),m)for(const t of C)p.push({type:"point",x:t.px,y:t.py,r:3,style:{fill:O.fill||(null===(s=e.config.themeSemantic)||void 0===s?void 0:s.secondary)||"#999",opacity:.6},datum:t.datum})}return p},violin:function(e,t){var n,o,i;const{scales:r,columns:a,config:s,getR:l,resolveSummaryStyle:c}=e,{r:u,projection:d}=r,h=[],g="vertical"===d,f=s.bins||20,p=!1!==s.showIQR;for(const e of Object.values(a)){const t=e.pieceData.map(e=>l(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const r=t[0],a=t[t.length-1],s=(a-r)/f||1,d=Array(f).fill(0);for(const e of t)d[Math.min(Math.floor((e-r)/s),f-1)]++;const y=Math.max(...d,1),m=e.width/2*.9;let v="";if(g){v=`M ${e.middle} ${u(r)}`;for(let t=0;f>t;t++){const n=u(r+(t+.5)*s);v+=` L ${e.middle+d[t]/y*m} ${n}`}v+=` L ${e.middle} ${u(a)}`;for(let t=f-1;t>=0;t--){const n=u(r+(t+.5)*s);v+=` L ${e.middle-d[t]/y*m} ${n}`}v+=" Z"}else{v=`M ${u(r)} ${e.middle}`;for(let t=0;f>t;t++)v+=` L ${u(r+(t+.5)*s)} ${e.middle-d[t]/y*m}`;v+=` L ${u(a)} ${e.middle}`;for(let t=f-1;t>=0;t--)v+=` L ${u(r+(t+.5)*s)} ${e.middle+d[t]/y*m}`;v+=" Z"}const b=c(e.pieceData[0],e.name);let x;if(p&&t.length>=4){const s=null!==(n=W(t,.25))&&void 0!==n?n:r,l=null!==(o=W(t,.5))&&void 0!==o?o:(r+a)/2,c=null!==(i=W(t,.75))&&void 0!==i?i:a;x={q1Pos:u(s),medianPos:u(l),q3Pos:u(c),centerPos:e.middle,isVertical:g}}const k=g?{x:e.x,y:Math.min(u(a),u(r)),width:e.width,height:Math.abs(u(a)-u(r))}:{x:Math.min(u(r),u(a)),y:e.x,width:Math.abs(u(a)-u(r)),height:e.width};h.push({type:"violin",pathString:v,translateX:0,translateY:0,bounds:k,iqrLine:x,stats:Dr(t),style:b,datum:e.pieceData,category:e.name})}return h},histogram:function(e,t){var n;const{scales:o,columns:i,config:r,getR:a,resolveSummaryStyle:s}=e,{r:l}=o,c=[],u=r.bins||25,d=r.normalize,h=null===(n=l.domain)||void 0===n?void 0:n.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=>a(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const n=null!=g&&isFinite(g)?g:Math.min(...t),o=null!=f&&isFinite(f)?f:Math.max(...t),i=(o-n)/u||1,r=Array(u).fill(0);for(const e of t)n>e||e>o||r[Math.min(Math.floor((e-n)/i),u-1)]++;const h=t.length,p=Math.max(...r,1),y=s(e.pieceData[0],e.name);for(let t=0;u>t;t++){if(0===r[t])continue;const o=(d?r[t]/h:r[t]/p)*e.width*.9,a=l(n+t*i),s=l(n+(t+1)*i);c.push(Ee(Math.min(a,s),e.x+e.width-o,Math.abs(s-a),o,y,{bin:t,count:r[t],range:[n+t*i,n+(t+1)*i],category:e.name},e.name))}}return c},ridgeline:function(e,t){var n;const{scales:o,columns:i,config:r,getR:a,resolveSummaryStyle:s}=e,{r:l,projection:c}=o,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=>a(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const o=t[0],i=t[t.length-1],r=(i-o)/d||1,c=Array(d).fill(0);for(const e of t)o>e||e>i||c[Math.min(Math.floor((e-o)/r),d-1)]++;const f=Math.max(...c,1),p=s(e.pieceData[0],e.name),y=e.width*g;let m="";if(h){const t=e.x+e.width;m=`M ${l(o)} ${t}`;for(let e=0;d>e;e++)m+=` L ${l(o+(e+.5)*r)} ${t-c[e]/f*y}`;m+=` L ${l(i)} ${t} Z`}else{const t=e.x;m=`M ${t} ${l(o)}`;for(let e=0;d>e;e++){const n=l(o+(e+.5)*r);m+=` L ${t+c[e]/f*y} ${n}`}m+=` L ${t} ${l(i)} Z`}const v=h?{x:Math.min(l(o),l(i)),y:e.x,width:Math.abs(l(i)-l(o)),height:e.width}:{x:e.x,y:Math.min(l(i),l(o)),width:e.width,height:Math.abs(l(i)-l(o))};u.push({type:"violin",pathString:m,translateX:0,translateY:0,bounds:v,stats:Dr(t),style:Object.assign(Object.assign({},p),{fillOpacity:null!==(n=p.fillOpacity)&&void 0!==n?n:.5}),datum:e.pieceData,category:e.name})}return u},timeline:function(e,t){const{scales:n,columns:o,getRawRange:i,resolvePieceStyle:r}=e,{r:a,projection:s}=n,l=[],c="horizontal"===s;for(const e of Object.values(o))for(const t of e.pieceData){const n=i(t);if(!n)continue;const[o,s]=n,u=r(t,e.name);if(c){const n=a(Math.min(o,s)),i=a(Math.max(o,s));l.push(Ee(n,e.x,i-n,e.width,u,t,e.name))}else{const n=a(Math.max(o,s)),i=a(Math.min(o,s));l.push(Ee(e.x,n,e.width,i-n,u,t,e.name))}}return l},funnel:function(e,t){var n,o,i,r,a,s,l,c;const{columns:u,getR:d,getStack:h,resolvePieceStyle:g}=e,f=[],p=t.width/2,y=!1!==e.config.showLabels,m=e.scales.o.domain().map(e=>u[e]).filter(Boolean);if(0===m.length)return f;const v=[],b=new Set;for(const e of m)for(const t of e.pieceData){const e=h?h(t):"_default";b.has(e)||(b.add(e),v.push(e))}const x=v.length>1&&"_default"!==v[0],w=[];let A=0;for(const e of m){const t=new Map;let n=0;for(const o of e.pieceData){const e=h?h(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const i=t.get(e),r=d(o);i.total+=r,i.pieces.push(o),n+=r}w.push({col:e,groups:t,stepTotal:n}),x||n>A&&(A=n)}if(x)for(const e of w){let t=0,n=0;for(let o=0;v.length>o;o++){const i=e.groups.get(v[o]);i&&(o%2==0?t+=i.total:n+=i.total)}const o=Math.max(t,n);o>A&&(A=o)}if(0===A)return f;const S=new Map;for(const e of v){const t=w[0].groups.get(e);S.set(e,null!==(n=null==t?void 0:t.total)&&void 0!==n?n:0)}const O=w[0].stepTotal,C=x?.95*p:.9*t.width,j=k().domain([0,A]).range([0,C]),M=null!==(o=e.config.connectorOpacity)&&void 0!==o?o:.3;let _=new Map;for(let t=0;w.length>t;t++){const n=w[t],o=n.col,u=0===t,d=o.width,h=.55*d,m=o.x+(d-h)/2,b=new Map;if(x){let e=0;for(const t of v){const o=n.groups.get(t);o&&(e+=j(o.total))}let t=p,i=p;for(let r=0;v.length>r;r++){const s=v[r],l=n.groups.get(s);if(!l)continue;const c=j(l.total),d=r%2==0,x=d?t:i-c;d?t+=c:i-=c;const k=g(l.pieces[0],s),w=null!==(a=S.get(s))&&void 0!==a?a:l.total,A=w>0?l.total/w*100:0,O=Object.assign(Object.assign({},l.pieces[0]),{__funnelValue:l.total,__funnelPercent:A,__funnelStep:o.name,__funnelIsFirstStep:u,__aggregateValue:l.total,__pieceCount:l.pieces.length,category:s});y&&(0===r&&(O.__funnelStepLabel=o.name,O.__funnelStepLabelX=p,O.__funnelStepLabelY=m,O.__funnelRowWidth=e),O.__funnelValueLabelX=x+c/2,O.__funnelValueLabelY=m,O.__funnelBarW=c),f.push(Ee(x,m,c,h,k,O,s)),b.set(s,{x:x,y:m,w:c,h:h})}}else{const e=n.stepTotal,t=j(e),a=p-t/2,s=v[0],l="_default"!==s,c=null!==(r=null===(i=n.groups.get(s))||void 0===i?void 0:i.pieces[0])&&void 0!==r?r:o.pieceData[0],d=l?s:o.name,x=g(c,d),k=O>0?e/O*100:0,w=Object.assign(Object.assign({},c),{__funnelValue:e,__funnelPercent:k,__funnelStep:o.name,__funnelIsFirstStep:u,category:l?s:o.name});y&&(w.__funnelStepLabel=o.name,w.__funnelStepLabelX=p,w.__funnelStepLabelY=m,w.__funnelRowWidth=t,w.__funnelValueLabelX=p,w.__funnelValueLabelY=m,w.__funnelBarW=t),f.push(Ee(a,m,t,h,x,w,d)),b.set(s,{x:a,y:m,w:t,h:h})}if(t>0&&_.size>0){const t=x?v:[v[0]];for(const i of t){const t=_.get(i),r=b.get(i);if(!t||!r)continue;const a=(()=>{const e=n.groups.get(i);return g(e?e.pieces[0]:o.pieceData[0],"_default"===i?o.name:i)})(),u={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:a.fill||(null===(s=e.config.themeSemantic)||void 0===s?void 0:s.secondary)||"#999",opacity:M},datum:null!==(c=null===(l=n.groups.get(i))||void 0===l?void 0:l.pieces[0])&&void 0!==c?c:o.pieceData[0],category:"_default"===i?o.name:i};f.push(u)}}_=b}return f},"bar-funnel":function(e,t){var n,o,i,r;const{columns:a,getR:s,getStack:l,resolvePieceStyle:c,scales:u}=e,d=[],h=u.o.domain().map(e=>a[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 n=0;for(const o of e.pieceData){const e=l?l(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const i=t.get(e),r=s(o);i.total+=r,i.pieces.push(o),n+=r}y.push({col:e,groups:t,stepTotal:n})}const m=new Map;for(const e of g){const t=null===(n=y[0])||void 0===n?void 0:n.groups.get(e);m.set(e,null!==(o=null==t?void 0:t.total)&&void 0!==o?o: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],n=t.col,o=0===e,a=e>0?y[e-1]:null,s=n.width/b,l=s*x,u=s-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==a?void 0:a.groups.get(h),w=null!==(r=null==k?void 0:k.total)&&void 0!==r?r:y,A=o?0:Math.max(0,w-y),S=n.x+e*s+l/2,O=v(y),C=v(0)-O,j=c(f.pieces[0],p?h:n.name),M=Object.assign(Object.assign({},f.pieces[0]),{__barFunnelValue:y,__barFunnelPercent:x,__barFunnelIsFirstStep:o,__barFunnelIsDropoff:!1,__barFunnelStep:n.name,__barFunnelDropoffValue:A,__barFunnelCategory:"_default"===h?void 0:h,category:p?h:n.name,__barFunnelLabelX:S+u/2,__barFunnelLabelY:v(y+A)});if(d.push(Ee(S,O,u,C,j,M,p?h:n.name)),A>0){const e=v(y+A),t=O-e,o=Object.assign({},j),i=Object.assign(Object.assign({},f.pieces[0]),{__barFunnelValue:A,__barFunnelPercent:b>0?A/b*100:0,__barFunnelIsFirstStep:!1,__barFunnelIsDropoff:!0,__barFunnelStep:n.name,__barFunnelCategory:"_default"===h?void 0:h,category:p?h:n.name});d.push(Ee(S,e,u,t,o,i,p?h:n.name))}}}return d},swimlane:function(e,t){var n;const{scales:o,columns:i,getR:r,getStack:a,resolvePieceStyle:s}=e,{r:l,projection:c}=o,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!==(n=f.opacity)&&void 0!==n?n:1,[o,r]=l.range(),a=Math.min(o,r),s=Math.abs(r-o);for(const n of Object.values(i)){const o={fill:e,opacity:t},i=d?Ee(a,n.x,s,n.width,o,null,"__track__"):Ee(n.x,a,n.width,s,o,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 n=u.length;for(const n of e.pieceData){const o=Math.abs(r(n));if(0===o)continue;const i=a?a(n):e.name,c=s(n,i);let f;if(d){const r=l(t),a=l(t+o);f=Ee(r,e.x,a-r,e.width,c,n,i)}else{const r=l(t+o),a=l(t);f=Ee(e.x,r,e.width,a-r,c,n,i)}h&&(f.fillGradient=h,f.roundedEdge=g),u.push(f),t+=o}if(p>0&&u.length>n){const e=u.slice(n),t=e[0],o=e[e.length-1];1===e.length?t.cornerRadii={tl:p,tr:p,br:p,bl:p}:d?(t.cornerRadii={tl:p,bl:p},o.cornerRadii={tr:p,br:p}):(t.cornerRadii={bl:p,br:p},o.cornerRadii={tl:p,tr:p})}}return u}};class Hr{constructor(e){this.rExtent=new Le,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 Pe(e.windowSize),this.getO=We(e.categoryAccessor||e.oAccessor,"category");const t=e.valueAccessor||e.rAccessor;Array.isArray(t)?(this.rAccessors=t.map(e=>He(e,"value")),this.getR=this.rAccessors[0],this.rExtents=t.map(()=>new Le)):(this.getR=He(t,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=We(e.stackBy),this.getGroup=We(e.groupBy),this.getColor=We(e.colorAccessor),this.getConnector=We(e.connectorAccessor),this.getDataId=We(e.dataIdAccessor),e.pulse&&(this.timestampBuffer=new Pe(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 n=e.totalSize||e.inserts.length;n>this.buffer.capacity&&(this.buffer.resize(n),this.timestampBuffer&&n>this.timestampBuffer.capacity&&this.timestampBuffer.resize(n));for(const n of e.inserts)this.buffer.push(n),this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(n)),this.pushValueExtent(n)}else{this._hasStreamingData=!0;for(const n of e.inserts){const e=this.buffer.push(n);this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(n)),this.pushValueExtent(n),null!=e&&this.evictValueExtent(e)}}return!0}pushValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.push(t[0]),this.rExtent.push(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].push(this.rAccessors[t](e));this.rExtent.push(this.getR(e))}else this.rExtent.push(this.getR(e))}evictValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.evict(t[0]),this.rExtent.evict(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].evict(this.rAccessors[t](e));this.rExtent.evict(this.getR(e))}else this.rExtent.evict(this.getR(e))}getRawRange(e){const t=this.config.valueAccessor||this.config.rAccessor;if(!t)return null;const n="function"==typeof t?t(e):e[t];return Array.isArray(n)&&n.length>=2?[+n[0],+n[1]]:null}computeScene(e){const{config:t,buffer:n}=this;if(0===n.size)return this.scales=null,this.scene=[],this.columns={},void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(n,this.getR);const o=n.toArray(),i=t.projection||"vertical",r=t.oExtent||this.resolveCategories(o),a=this.computeValueDomain(o,r),s="horizontal"===i,l="radial"===i,c=Math.min(.9,Math.max(0,null!=t.barPadding?t.barPadding/("vertical"===i?e.width:e.height):.1));let u,d;if(l){u=S().domain(r).range([0,1]).padding(0);const n=Math.min(e.width,e.height)/2,o=t.innerRadius||0;d=k().domain(a).range([o,n])}else s?(u=S().domain(r).range([0,e.height]).padding(c),d=k().domain(a).range([0,e.width])):(u=S().domain(r).range([0,e.width]).padding(c),d=k().domain(a).range([e.height,0]));this.scales={o:u,r:d,projection:i},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((o,i)=>{var r;const a=this.rExtents[i];a.dirty&&a.recalculate(n,o);let[l,c]=a.extent;l===1/0&&(l=0,c=1);const u=null!==(r=t.extentPadding)&&void 0!==r?r:.05,d=c-l,h=d>0?d*u:1;return l-=h,c+=h,l>0&&(l=0),s?k().domain([l,c]).range([0,e.width]):k().domain([l,c]).range([e.height,0])}):[];let h=o;this.rAccessors.length>1&&(h=o.flatMap(e=>this.rAccessors.map((t,n)=>Object.assign(Object.assign({},e),{__rIndex:n,__rValue:t(e),__rName:this.resolveRAccessorName(n)})))),this.columns=this.buildColumns(h,r,u,i,e),this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(h,e),this.rebuildPointQuadtree(),this.config.decay&&this.applyDecay(this.scene,o),this.config.pulse&&this.applyPulse(this.scene,o),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,n=Array.isArray(t)?t[e]:t;return"string"==typeof n?n:"value"+e}resolveCategories(e){const t=this.config.oSort,n="streaming"===this.config.runtimeMode||this._hasStreamingData,o="auto"===t?void 0:t;let i=null;if(n){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(n&&void 0===o){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===o)return r;if("function"==typeof o)return r.sort(o);const a=new Map;for(const t of e){const e=this.getO(t);a.set(e,(a.get(e)||0)+Math.abs(this.getR(t)))}return r.sort("asc"===o?(e,t)=>(a.get(e)||0)-(a.get(t)||0):(e,t)=>(a.get(t)||0)-(a.get(e)||0))}computeValueDomain(e,t){var n,o,i,r,a;const s=this.config.chartType,l=null!==(n=this.config.extentPadding)&&void 0!==n?n:.05;if("radial"===this.config.projection&&("pie"===s||"donut"===s))return[0,1];let c=0,u=0;if("bar"===s&&this.getStack&&this.config.normalize)c=0,u=1;else if("bar"===s&&this.getStack){const t=new Map,n=new Map;for(const o of e){const e=this.getO(o),i=this.getR(o);0>i?n.set(e,(n.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 n.values())c>e&&(c=e)}else if("bar"===s){const t=new Map;for(const n of e){const e=this.getO(n),o=this.getR(n);t.set(e,(t.get(e)||0)+o)}for(const e of t.values())e>u&&(u=e),c>e&&(c=e)}else if("swimlane"===s){const t=new Map;for(const n of e){const e=this.getO(n),o=Math.abs(this.getR(n));t.set(e,(t.get(e)||0)+o)}for(const e of t.values())e>u&&(u=e)}else if("clusterbar"===s||"bar-funnel"===s)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"===s||"clusterbar"===s||"bar-funnel"===s||"swimlane"===s;if(d&&null==(null===(o=this.config.rExtent)||void 0===o?void 0:o[0])&&null==(null===(i=this.config.rExtent)||void 0===i?void 0:i[1])&&(c>0&&(c=0),0>u&&(u=0)),"bar-funnel"!==s&&"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===(a=this.config.rExtent)||void 0===a?void 0:a[1])||d&&!this.config.baselinePadding&&0===u||"swimlane"===s||(u+=t)}return[c,u]}buildColumns(e,t,n,o,i){var r;const a={},s=new Map;for(const t of e){const e=this.getO(t);s.has(e)||s.set(e,[]),s.get(e).push(t)}let l=0;if("radial"===o)for(const t of e)l+=Math.abs(this.getR(t));const c=this.config.dynamicColumnWidth;let u=null;if(c&&"radial"!==o){u=new Map;let e=0;for(const n of t){const t=s.get(n)||[];let o;o="string"==typeof c?t.reduce((e,t)=>e+(Number(t[c])||0),0):c(t),u.set(n,o),e+=o}const r=("horizontal"===o?i.height:i.width)-n.padding()*n.step()*t.length;if(e>0)for(const[t,n]of u)u.set(t,n/e*r)}let d=0,h=0;for(const e of t){const t=s.get(e)||[],o=t.reduce((e,t)=>e+Math.abs(this.getR(t)),0),i=l>0?o/l:0;let c,g;u?(c=h,g=u.get(e)||n.bandwidth(),h+=g+n.padding()*n.step()):(c=null!==(r=n(e))&&void 0!==r?r:0,g=n.bandwidth()),a[e]={name:e,x:c,y:0,width:g,middle:c+g/2,padding:n.padding()*n.step(),pieceData:t,pct:i,pctStart:d},d+=i}return a}getSceneContext(){return{scales:this.scales,columns:this.columns,config:this.config,getR:this.getR,getStack:this.getStack,getGroup:this.getGroup,getColor:this.getColor,getConnector:this.getConnector,getO:this.getO,multiScales:this.multiScales,rAccessors:this.rAccessors,resolvePieceStyle:(e,t)=>this.resolvePieceStyle(e,t),resolveSummaryStyle:(e,t)=>this.resolveSummaryStyle(e,t),getRawRange:e=>this.getRawRange(e)}}buildSceneNodes(e,t){var n,o;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!==(n=r.overlays)&&void 0!==n?n:null,null!==(o=r.nodes)&&void 0!==o?o:[]}this.customLayoutOverlays=null;const i=this.getSceneContext(),r=Rr[this.config.chartType];let a=r?r(i,t):[];if(this.getConnector&&this.scales){const e=function(e,t){var n,o;const{scales:i,config:r,getConnector:a,getO:s}=e;if(!a||!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 n=a(t);if(!n)continue;let o,i;"point"===e.type?(o=e.x,i=e.y):(o=e.x+e.w/2,i=e.y+("vertical"===c?0:e.h/2)),u.has(n)||u.set(n,[]),u.get(n).push({x:o,y:i,datum:t,category:s(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 a=i[r],s=i[r+1],c="function"==typeof h?h(a.datum):h||{stroke:(null===(n=e.config.themeSemantic)||void 0===n?void 0:n.border)||(null===(o=e.config.themeSemantic)||void 0===o?void 0:o.secondary)||"#999",strokeWidth:1,opacity:.5};l.push({type:"connector",x1:a.x,y1:a.y,x2:s.x,y2:s.y,style:c,datum:a.datum,group:t})}}return l}(i,a);a=[...e,...a]}return a}buildLayoutContext(e,t){var n,o,i;const r=this.config,a=null!==(n=r.layoutMargin)&&void 0!==n?n:{top:0,right:0,bottom:0,left:0},s=Er(r.colorScheme,r.themeCategorical,ft),l=this.scales;return{data:e,scales:{o:l.o,r:l.r,projection:l.projection},dimensions:{width:t.width,height:t.height,margin:a,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!==(o=r.themeSemantic)&&void 0!==o?o:{},categorical:[...s]},resolveColor:Ir(s),config:null!==(i=r.layoutConfig)&&void 0!==i?i:{}}}resolvePieceStyle(e,t){if("function"==typeof this.config.pieceStyle){const n=this.config.pieceStyle(e,t);return n&&!n.fill&&t?Object.assign(Object.assign({},n),{fill:this.getColorFromScheme(t)}):n}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 n=Array.isArray(this.config.colorScheme)?this.config.colorScheme:this.config.themeCategorical||ft,o=n[this._colorSchemeIndex%n.length];return this._colorSchemeIndex++,this._colorSchemeMap.set(e,o),o}resolveSummaryStyle(e,t){return"function"==typeof this.config.summaryStyle?this.config.summaryStyle(e,t):this.config.summaryStyle&&"object"==typeof this.config.summaryStyle?this.config.summaryStyle:{fill:"#007bff",fillOpacity:.6,stroke:"#007bff",strokeWidth:1}}computeDecayOpacity(e,t){const n=this.config.decay;return n&&t>1?xt(n,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._dataVersion)return this._datumIndexCache.map;const t=new Map;for(let n=0;e.length>n;n++)t.set(e[n],n);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,n="function"==typeof t,o=n?null:t||"category",i=new Map;for(let r=0;e.length>r;r++){const a=e[r],s=n?t(a):a[o];let l=i.get(s);l||(l=[],i.set(s,l)),l.push(r)}return this._categoryIndexCache={version:this._dataVersion,map:i},i}rebuildPointQuadtree(){let e=0,t=0;for(const n of this.scene)"point"===n.type&&(e++,n.r>t&&(t=n.r));if(this._maxPointRadius=t,Hr.QUADTREE_THRESHOLD>=e)return void(this._pointQuadtree=null);const n=Array(e);let o=0;for(const e of this.scene)"point"===e.type&&(n[o++]=e);this._pointQuadtree=C().x(e=>e.x).y(e=>e.y).addAll(n)}get pointQuadtree(){return this._pointQuadtree}get maxPointRadius(){return this._maxPointRadius}applyDecay(e,t){var n,o;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 a=this.computeDecayOpacity(e,i),s=null!==(o=null===(n=t.style)||void 0===n?void 0:n.opacity)&&void 0!==o?o:1;t.style=Object.assign(Object.assign({},t.style),{opacity:s*a})}}applyPulse(e,t){var n,o,i;if(!this.config.pulse||!this.timestampBuffer)return;const r="undefined"!=typeof performance?performance.now():Date.now(),a=null!==(n=this.config.pulse.duration)&&void 0!==n?n:500,s=null!==(o=this.config.pulse.color)&&void 0!==o?o:"rgba(255,255,255,0.6)",l=null!==(i=this.config.pulse.glowRadius)&&void 0!==i?i:4,c=this.getDatumIndexMap(t);let u=null;for(const n of e){if("connector"===n.type||"violin"===n.type||"boxplot"===n.type)continue;if("wedge"===n.type){const e=n.category;if(!e)continue;u||(u=this.getCategoryIndexMap(t));const o=u.get(e);if(!o)continue;let i=0;for(let e=0;o.length>e;e++){const t=this.timestampBuffer.get(o[e]);if(null==t)continue;const n=r-t;if(a>n){const e=1-n/a;e>i&&(i=e)}}i>0&&(n._pulseIntensity=i,n._pulseColor=s);continue}const e=c.get(n.datum);if(null==e)continue;const o=this.timestampBuffer.get(e);if(null==o)continue;const i=r-o;a>i&&(n._pulseIntensity=1-i/a,n._pulseColor=s,n._pulseGlowRadius=l)}}get hasActivePulses(){var e;if(!this.config.pulse||!this.timestampBuffer||0===this.timestampBuffer.size)return!1;const t="undefined"!=typeof performance?performance.now():Date.now(),n=null!==(e=this.config.pulse.duration)&&void 0!==e?e:500,o=this.timestampBuffer.peek();return null!=o&&n>t-o}synthesizeIntroPositions(){var e,t,n,o,i;this.prevPositionMap.clear();const r=new Map,a=null!==(t=null===(e=this.scales)||void 0===e?void 0:e.r(0))&&void 0!==t?t:0,s="horizontal"!==(null===(n=this.scales)||void 0===n?void 0:n.projection);let l;for(let e=0;this.scene.length>e;e++){const t=this.scene[e],n=this.getNodeKey(t,r);n&&("rect"===t.type?this.prevPositionMap.set(n,s?{x:t.x,y:a,w:t.w,h:0,opacity:null!==(o=t.style.opacity)&&void 0!==o?o:1}:{x:a,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(n,{x:t.x,y:t.y,r:0,opacity:0}):"wedge"===t.type&&(void 0===l&&(l=t.startAngle),this.prevPositionMap.set(n,{x:t.cx,y:t.cy,startAngle:l,endAngle:l,innerRadius:t.innerRadius,outerRadius:t.outerRadius,opacity:0})))}}getNodeKey(e,t){var n,o,i;if("point"===e.type){const n=`p:${e.datum?this.getO(e.datum):""}:${e.datum?this.getR(e.datum):0}`,o=t.get(n)||0;return t.set(n,o+1),`${n}:${o}`}return"rect"===e.type?`r:${e.group||""}:${null!==(o=null===(n=e.datum)||void 0===n?void 0:n.category)&&void 0!==o?o:""}`:"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 n=0;this.scene.length>n;n++){const o=this.scene[n],i=this.getNodeKey(o,t);i&&("point"===o.type?this.prevPositionMap.set(i,{x:o.x,y:o.y,r:o.r,opacity:o.style.opacity}):"rect"===o.type?this.prevPositionMap.set(i,{x:o.x,y:o.y,w:o.w,h:o.h,opacity:o.style.opacity}):"wedge"===o.type&&this.prevPositionMap.set(i,{x:o.cx,y:o.cy,startAngle:o.startAngle,endAngle:o.endAngle,innerRadius:o.innerRadius,outerRadius:o.outerRadius,opacity:null!==(e=o.style.opacity)&&void 0!==e?e:1}))}}startTransition(){var e,t,n,o,i,r,a,s,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,S=new Map;for(let e=0;this.scene.length>e;e++){const c=this.scene[e],u=this.getNodeKey(c,S);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!==(n=c.style.opacity)&&void 0!==n?n: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!==(o=c.style.opacity)&&void 0!==o?o: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!==(a=c.style.opacity)&&void 0!==a?a: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!==(s=c.style.opacity)&&void 0!==s?s: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 n=((null!==(f=t.startAngle)&&void 0!==f?f:0)+(null!==(p=t.endAngle)&&void 0!==p?p:0))/2,o={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:n,_targetEndAngle:n,_targetOpacity:0,_transitionKey:e};this.exitNodes.push(o)}w=!0}this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),w&&(this.activeTransition={startTime:Ot(),duration:k})}advanceTransition(e){var t,n,o,i;if(!this.activeTransition)return!1;const r=At(e,this.activeTransition),a=wt(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 o=this.prevPositionMap.get(t),i=o?null!==(n=o.opacity)&&void 0!==n?n:1:0;e.style.opacity=St(i,e._targetOpacity,a)}const o=this.prevPositionMap.get(t);void 0!==e._targetX&&o&&(e.x=St(o.x,e._targetX,a),e.y=St(o.y,e._targetY,a)),void 0!==e._targetR&&void 0!==(null==o?void 0:o.r)&&(e.r=St(o.r,e._targetR,a))}else if("rect"===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=St(i,e._targetOpacity,a)}if(void 0===e._targetX)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=St(n.x,e._targetX,a),e.y=St(n.y,e._targetY,a),void 0!==n.w&&(e.w=St(n.w,e._targetW,a),e.h=St(n.h,e._targetH,a))}else if("wedge"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t),o=n?null!==(i=n.opacity)&&void 0!==i?i:1:0;e.style=Object.assign(Object.assign({},e.style),{opacity:St(o,e._targetOpacity,a)})}if(void 0!==e._targetStartAngle&&void 0!==e._targetEndAngle){const n=this.prevPositionMap.get(t);n&&void 0!==n.startAngle&&(e.startAngle=St(n.startAngle,e._targetStartAngle,a),e.endAngle=St(n.endAngle,e._targetEndAngle,a))}}}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]),n=this.getDataId,o=e=>t.has(n(e));if(this.timestampBuffer&&this.timestampBuffer.size>0){const e=this.timestampBuffer.toArray(),t=new Set;this.buffer.forEach((e,n)=>{o(e)&&t.add(n)}),this.timestampBuffer.clear();for(let n=0;e.length>n;n++)t.has(n)||this.timestampBuffer.push(e[n])}const i=this.buffer.remove(o);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 n=new Set(Array.isArray(e)?e:[e]),o=this.getDataId,i=new Set;this.buffer.forEach((e,t)=>{n.has(o(e))&&i.add(t)});const r=this.buffer.update(e=>n.has(o(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&&!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),("categoryAccessor"in e||"oAccessor"in e)&&(Re(e.categoryAccessor||e.oAccessor,t.categoryAccessor||t.oAccessor)||(this.getO=We(this.config.categoryAccessor||this.config.oAccessor,"category"),this.categories.clear())),"valueAccessor"in e||"rAccessor"in e){const n=e.valueAccessor||e.rAccessor,o=t.valueAccessor||t.rAccessor,i=Array.isArray(n)?n:[n],r=Array.isArray(o)?o:[o];if(i.length!==r.length||i.some((e,t)=>!Re(e,r[t]))){const e=this.config.valueAccessor||this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>He(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new Le)):(this.getR=He(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!Re(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?We(this.config.stackBy):void 0),"groupBy"in e&&!Re(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?We(this.config.groupBy):void 0),"colorAccessor"in e&&!Re(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?We(this.config.colorAccessor):void 0),"connectorAccessor"in e&&!Re(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?We(this.config.connectorAccessor):void 0)}}function Fr(e,t,n){const o=Wt(t,n,e);return o.hit?{datum:e.datum,x:o.cx,y:e.y,distance:0,category:e.group}:null}function Wr(e,t,n,o=30){const i=t-e.x,r=n-e.y,a=Math.sqrt(i*i+r*r);return a>zt(e.r,o)?null:{datum:e.datum,x:e.x,y:e.y,distance:a}}function zr(e,t,n){const o=t-e.cx,i=n-e.cy,r=Math.sqrt(o*o+i*i);if(e.innerRadius>r||r>e.outerRadius)return null;const a=qt(Math.atan2(i,o)),s=qt(e.startAngle),l=qt(e.endAngle);if(!(s>l?a>=s||l>=a:a>=s&&l>=a))return null;const c=(e.startAngle+e.endAngle)/2,u=(e.innerRadius+e.outerRadius)/2;return{datum:e.datum,x:e.cx+Math.cos(c)*u,y:e.cy+Math.sin(c)*u,distance:0,category:e.category}}function Yr(e,t,n){const o=e.columnWidth/2;if("vertical"===e.projection){if(!(e.x-o>t||t>e.x+o||Math.min(e.minPos,e.maxPos)>n||n>Math.max(e.minPos,e.maxPos)))return{datum:e.datum,x:e.x,y:e.medianPos,distance:0,category:e.category,stats:e.stats}}else{const i=e.y-o,r=e.y+o;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||i>n||n>r))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category,stats:e.stats}}return null}function Gr(e,t,n){if(!e.bounds)return null;const{x:o,y:i,width:r,height:a}=e.bounds;return o>t||t>o+r||i>n||n>i+a?null:{datum:e.datum,x:o+r/2,y:i+a/2,distance:0,category:e.category,stats:e.stats}}function qr(o){const{width:i,height:a,totalWidth:s,totalHeight:l,margin:c,scales:u,showAxes:d,showGrid:h,rFormat:g}=o,{rTickValues:f,axisExtent:p}=o,y="radial"===(null==u?void 0:u.projection),m="horizontal"===(null==u?void 0:u.projection),v=r(()=>!u||y?[]:(f||Io(u.r,5,p)).map(e=>({value:e,pixel:u.r(e),label:(g||Xr)(e)})),[u,g,y,f,p]),b=h&&u&&!y,x=d&&u&&!y;return b||x?e("svg",{width:s,height:l,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:t("g",{transform:`translate(${c.left},${c.top})`,children:[b&&e("g",{className:"ordinal-grid",children:v.map((t,n)=>e("line",{x1:m?t.pixel:0,y1:m?0:t.pixel,x2:m?t.pixel:i,y2:m?a:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+n))}),x&&e(n,{children:t(n,m?{children:[e("line",{x1:0,y1:0,x2:0,y2:a,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e("line",{x1:0,y1:a,x2:i,y2:a,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]}:{children:[e("line",{x1:0,y1:a,x2:i,y2:a,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e("line",{x1:0,y1:0,x2:0,y2:a,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]})})]})}):null}function Xr(e){return Math.round(100*e)/100+""}function Vr(o){var a,s;const{width:l,height:c,totalWidth:u,totalHeight:d,margin:h,scales:g,showAxes:f,showCategoryTicks:p,oLabel:y,rLabel:m,oFormat:v,rFormat:b,showGrid:x,title:k,legend:w,legendHoverBehavior:A,legendClickBehavior:S,legendHighlightedCategory:O,legendIsolatedCategories:C,legendPosition:j="right",legendLayout:M,foregroundGraphics:_,annotations:P,autoPlaceAnnotations:L,svgAnnotationRules:T,xAccessor:$,yAccessor:N,annotationData:B,underlayRendered:D,children:E}=o,I="radial"===(null==g?void 0:g.projection),R="horizontal"===(null==g?void 0:g.projection),H=!1!==p,F=r(()=>f&&H&&g&&!I?g.o.domain().map((e,t)=>{var n;return{value:e,pixel:(null!==(n=g.o(e))&&void 0!==n?n:0)+g.o.bandwidth()/2,label:v?v(e,t):e}}):[],[f,H,g,v,I]),W=o.rTickValues,z=o.tickLabelEdgeAlign,Y=o.axisExtent,G=r(()=>f&&g&&!I?(W||Io(g.r,5,Y)).map(e=>({value:e,pixel:g.r(e),label:(b||Xr)(e)})):[],[f,g,b,I,W,Y]),q=i(new Map),X=i(null!==(a=null==P?void 0:P.length)&&void 0!==a?a:0),V=null!==(s=null==P?void 0:P.length)&&void 0!==s?s:0;X.current!==V&&(X.current=V,q.current=new Map);const U=r(()=>{if(!P||0===P.length)return null;const e=lo(),t="horizontal"===(null==g?void 0:g.projection),n=(null==g?void 0:g.o)?e=>{var t;return(null!==(t=g.o(e))&&void 0!==t?t:0)+g.o.bandwidth()/2}:null,o={scales:g?{x:t?g.r:n||g.r,y:t&&n||g.r,time:g.r,value:g.r,o:g.o}:null,timeAxis:"x",xAccessor:$,yAccessor:N,width:l,height:c,data:B,frameType:"ordinal",projection:t?"horizontal":"vertical",stickyPositionCache:q.current};return so(L?jo(Object.assign({annotations:P,context:o},"object"==typeof L?L:{})):P,e,T,o)},[P,L,T,l,c,g,$,N,B]);return f||k||w||_||U&&U.length>0||x||E?t("svg",{role:"img",width:u,height:d,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[e("title",{children:"string"==typeof k?k:"Ordinal Chart"}),e("desc",{children:"string"==typeof k?k+" — ordinal data visualization":"Ordinal data visualization"}),t("g",{transform:`translate(${h.left},${h.top})`,children:[x&&g&&!I&&!D&&e("g",{className:"ordinal-grid",children:G.map((t,n)=>e("line",{x1:R?t.pixel:0,y1:R?0:t.pixel,x2:R?t.pixel:l,y2:R?c:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+n))}),f&&g&&!I&&(()=>{const o={fontSize:"var(--semiotic-tick-font-size, 12px)"},i={fontSize:"var(--semiotic-axis-label-font-size, 12px)"};return e("g",{className:"ordinal-axes",children:t(n,R?{children:[t("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[!D&&e("line",{x1:0,y1:0,x2:0,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),F.map((n,i)=>t("g",{transform:`translate(0,${n.pixel})`,children:[e("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},o),children:n.label}):e("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:Object.assign({textAlign:"right",userSelect:"none"},o),children:n.label})})]},"cat-"+i)),y&&e("text",{x:15-h.left,y:c/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-h.left}, ${c/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},i),children:y})]}),t("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[!D&&e("line",{x1:0,y1:c,x2:l,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),!D&&(null==g?void 0:g.r)&&(()=>{const t=g.r(0);return t>1&&l-1>t?e("line",{x1:t,y1:0,x2:t,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1,strokeDasharray:"4,4"}):null})(),G.map((n,i)=>{const r=z?0===i?"start":i===G.length-1?"end":"middle":"middle";return t("g",{transform:`translate(${n.pixel},${c})`,children:[e("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e("text",{y:18,textAnchor:r,fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},o),children:n.label})]},"val-"+i)}),m&&e("text",{x:l/2,y:c+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},i),children:m})]})]}:{children:[t("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[!D&&(()=>{const t=(null==g?void 0:g.r)?g.r(0):c,n=0>t||t>c?c:t;return e("line",{x1:0,y1:n,x2:l,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),F.map((n,i)=>t("g",{transform:`translate(${n.pixel},${c})`,children:[e("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{y:18,textAnchor:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},o),children:n.label}):e("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:Object.assign({textAlign:"center",userSelect:"none"},o),children:n.label})})]},"cat-"+i)),y&&e("text",{x:l/2,y:c+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},i),children:y})]}),t("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[!D&&e("line",{x1:0,y1:0,x2:0,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),G.map((n,i)=>t("g",{transform:`translate(0,${n.pixel})`,children:[e("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},o),children:n.label})]},"val-"+i)),m&&e("text",{x:15-h.left,y:c/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-h.left}, ${c/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},i),children:m})]})]})})})(),U,_,E]}),k&&e("text",{x:u/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 k?k:null}),En({legend:w,totalWidth:u,totalHeight:d,margin:h,legendPosition:j,title:k,legendLayout:M,legendHoverBehavior:A,legendClickBehavior:S,legendHighlightedCategory:O,legendIsolatedCategories:C})]}):null}function Ur({width:t,height:n,totalWidth:o,totalHeight:r,margin:s,scales:l,onBrush:c}){const u=i(null),d=i(null),h=i(c);h.current=c;const g=i(l);g.current=l;const f=i(!1),p=i(null),b="horizontal"===(null==l?void 0:l.projection),x=i(b);return x.current=b,a(()=>{if(!u.current)return;const e=y(u.current).select(".brush-g"),o=b?m():v();return o.extent([[0,0],[t,n]]),o.on("brush end",e=>{if(f.current)return;const t=g.current;if(!t)return;if(!e.selection)return p.current=null,void h.current(null);const[n,o]=e.selection;let i;i=x.current?[t.r.invert(n),t.r.invert(o)]:[t.r.invert(o),t.r.invert(n)];const r={r:i};p.current=r,h.current(r)}),e.call(o),d.current=o,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{o.on("brush end",null),d.current=null}},[t,n,b]),a(()=>{if(!l||!d.current||!p.current)return;if(!u.current)return;const e=p.current,t=y(u.current).select(".brush-g"),n=l.r(e.r[0]),o=l.r(e.r[1]);b?(f.current=!0,t.call(d.current.move,[n,o]),f.current=!1):(f.current=!0,t.call(d.current.move,[o,n]),f.current=!1)},[l,b]),e("svg",{ref:u,width:o,height:r,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:e("g",{className:"brush-g",transform:`translate(${s.left},${s.top})`,style:{pointerEvents:"all"}})})}function Qr(e,t){var n,o,i,r;const a=t._gradientBand.colors;if(0===a.length)return;const{clipPath:s,slices:l}=Zo({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,cornerRadius:t.cornerRadius,roundStart:null===(o=null===(n=t.roundedEnds)||void 0===n?void 0:n.start)||void 0===o||o,roundEnd:null===(r=null===(i=t.roundedEnds)||void 0===i?void 0:i.end)||void 0===r||r,colors:a}),c=new Path2D(s);e.save(),e.translate(t.cx,t.cy),e.clip(c);for(const t of l)e.fillStyle=tn(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=tn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(c),e.restore())}function Kr(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 Zr(e,t){const n={innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle+Math.PI/2,endAngle:t.endAngle+Math.PI/2},o=R().cornerRadius(t.cornerRadius)(n);if(!o)return;e.save(),e.translate(t.cx,t.cy);const i=new Path2D(o);e.fill(i),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(i),e.restore()}Hr.QUADTREE_THRESHOLD=500;const Jr=(e,t,n,o)=>{var i,r;const a=t.filter(e=>"wedge"===e.type);for(const t of a){const n=null!==(i=t.style.fillOpacity)&&void 0!==i?i:1,o=null!==(r=t.style.opacity)&&void 0!==r?r:1;if(e.globalAlpha=n*o,t._gradientBand&&t._gradientBand.colors.length>0)Qr(e,t),t._pulseIntensity&&t._pulseIntensity>0&&(Kr(e,t),ur(e,t)),e.globalAlpha=1;else{if(e.fillStyle=("string"==typeof t.style.fill?tn(e,t.style.fill):t.style.fill)||"#007bff",t.roundedEnds){t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=tn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1);const n=Ko({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 o=new Path2D(n);e.fill(o),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(o),e.restore()}else t.cornerRadius?(t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=tn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1),Zr(e,t)):(Kr(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=tn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()));t._pulseIntensity&&t._pulseIntensity>0&&(Kr(e,t),ur(e,t)),e.globalAlpha=1}}},ea=(e,t,n,o)=>{var i,r;const a=t.filter(e=>"boxplot"===e.type);for(const t of a){const n=t.columnWidth/2,o="vertical"===t.projection,a=tn(e,"var(--semiotic-primary, #007bff)"),s=tn(e,"var(--semiotic-text, #333)"),l=t.style.fill,c="string"==typeof l?tn(e,l)||l:null!=l?l:a,u=t.style.stroke,d="string"==typeof u?tn(e,u)||u:s,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(),o?(e.moveTo(t.x,t.minPos),e.lineTo(t.x,t.maxPos)):(e.moveTo(t.minPos,t.y),e.lineTo(t.maxPos,t.y)),e.stroke(),e.beginPath(),o?(e.moveTo(t.x-.4*n,t.minPos),e.lineTo(t.x+.4*n,t.minPos),e.moveTo(t.x-.4*n,t.maxPos),e.lineTo(t.x+.4*n,t.maxPos)):(e.moveTo(t.minPos,t.y-.4*n),e.lineTo(t.minPos,t.y+.4*n),e.moveTo(t.maxPos,t.y-.4*n),e.lineTo(t.maxPos,t.y+.4*n)),e.stroke(),e.globalAlpha=g,e.fillStyle=c,o){const o=Math.min(t.q1Pos,t.q3Pos),i=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-n,o,t.columnWidth,i),e.globalAlpha=1,e.strokeRect(t.x-n,o,t.columnWidth,i)}else{const o=Math.min(t.q1Pos,t.q3Pos),i=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(o,t.y-n,i,t.columnWidth),e.globalAlpha=1,e.strokeRect(o,t.y-n,i,t.columnWidth)}e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),o?(e.moveTo(t.x-n,t.medianPos),e.lineTo(t.x+n,t.medianPos)):(e.moveTo(t.medianPos,t.y-n),e.lineTo(t.medianPos,t.y+n)),e.stroke(),e.restore()}},ta=(e,t,n,o)=>{var i,r;const a=t.filter(e=>"violin"===e.type);for(const t of a){e.save(),(t.translateX||t.translateY)&&e.translate(t.translateX,t.translateY);const n=new Path2D(t.pathString);if(e.globalAlpha=null!==(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?tn(e,t.style.fill):t.style.fill)||"#007bff",e.fill(n),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=tn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(n)),t.iqrLine){e.strokeStyle="#333",e.lineWidth=2,e.globalAlpha=.8;const n=t.iqrLine.centerPos,o=!1!==t.iqrLine.isVertical;e.beginPath(),o?(e.moveTo(n,t.iqrLine.q1Pos),e.lineTo(n,t.iqrLine.q3Pos)):(e.moveTo(t.iqrLine.q1Pos,n),e.lineTo(t.iqrLine.q3Pos,n)),e.stroke(),e.beginPath(),o?e.arc(n,t.iqrLine.medianPos,3,0,2*Math.PI):e.arc(t.iqrLine.medianPos,n,3,0,2*Math.PI),e.fillStyle="#fff",e.fill(),e.strokeStyle="#333",e.lineWidth=1,e.stroke(),e.globalAlpha=1}e.restore()}},na=(e,t,n,o)=>{var i,r,a;const s=t.filter(e=>"connector"===e.type);if(0===s.length)return;const l=new Map;for(const e of s){const t=e.group||"_default";l.has(t)||l.set(t,[]),l.get(t).push(e)}for(const[,t]of l){if(0===t.length)continue;const n=t[0].style;if(n.fill&&"none"!==n.fill){e.beginPath(),e.moveTo(t[0].x1,t[0].y1);for(const n of t)e.lineTo(n.x2,n.y2);e.closePath(),e.globalAlpha=null!==(r=null!==(i=n.fillOpacity)&&void 0!==i?i:n.opacity)&&void 0!==r?r:.3,e.fillStyle=n.fill,e.fill(),e.globalAlpha=1}for(const n of t)e.beginPath(),e.moveTo(n.x1,n.y1),e.lineTo(n.x2,n.y2),e.strokeStyle=tn(e,n.style.stroke)||("string"==typeof n.style.fill?tn(e,n.style.fill):n.style.fill)||tn(e,"var(--semiotic-border, #999)"),e.lineWidth=n.style.strokeWidth||1,e.globalAlpha=null!==(a=n.style.opacity)&&void 0!==a?a:.5,e.stroke(),e.globalAlpha=1}},oa=(e,t,n,o)=>{var i,r,a,s;const l=t.filter(e=>"trapezoid"===e.type);for(const t of l){const n=t.points;if(n.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(n[0][0],n[0][1]);for(let t=1;n.length>t;t++)e.lineTo(n[t][0],n[t][1]);e.closePath(),e.fillStyle=(null===(a=t.style)||void 0===a?void 0:a.fill)||"#999",e.fill(),(null===(s=t.style)||void 0===s?void 0:s.stroke)&&(e.strokeStyle=tn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}};function ia(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 ra(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}let aa=null;function sa(e={},t){const{background:n="transparent",stroke:o="#000",lineWidth:i=1.5,spacing:r=6,angle:a=45}=e,s=Math.max(8,Math.ceil(2*r));let l;try{l=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(aa||(aa=document.createElement("canvas")),aa.width=e,aa.height=e,aa)}(s)}catch(e){return null}const c=l.getContext("2d");if(!c)return null;n&&"transparent"!==n?(c.fillStyle=n,c.fillRect(0,0,s,s)):c.clearRect(0,0,s,s),c.strokeStyle=o,c.lineWidth=i,c.lineCap="square";const u=a*Math.PI/180;if(45===a||-45===a){const e=a>0?1:-1;for(let t=-s;2*s>=t;t+=r)c.beginPath(),c.moveTo(t,0),c.lineTo(t+e*s,s),c.stroke()}else{c.save(),c.translate(s/2,s/2),c.rotate(u);const e=2*s;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 la=new Map;function ca(e,t){const n=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,o=la.get(n);if(void 0!==o)return o;const i=sa({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return la.set(n,i),i}function ua(e,t,n,o,i,r){e.moveTo(t+r,n),e.lineTo(t+o-r,n),e.quadraticCurveTo(t+o,n,t+o,n+r),e.lineTo(t+o,n+i-r),e.quadraticCurveTo(t+o,n+i,t+o-r,n+i),e.lineTo(t+r,n+i),e.quadraticCurveTo(t,n+i,t,n+i-r),e.lineTo(t,n+r),e.quadraticCurveTo(t,n,t+r,n),e.closePath()}function da(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 ha(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}const ga=e=>[na,...e],fa={bar:ga([yr]),clusterbar:ga([yr]),point:ga([gr]),swarm:ga([gr]),pie:[Jr],donut:[Jr],boxplot:ga([ea,gr]),violin:ga([ta]),histogram:ga([yr]),ridgeline:ga([ta]),timeline:ga([yr]),funnel:[yr,oa,(e,t,n,o)=>{var i,r,a,s;const l=t.filter(e=>"rect"===e.type&&null!=e.datum);if(0!==l.length&&l.some(e=>{var t,n;return null!=(null===(t=e.datum)||void 0===t?void 0:t.__funnelStepLabel)||null!=(null===(n=e.datum)||void 0===n?void 0:n.__funnelValueLabelX)})){e.textBaseline="top",e.lineJoin="round",e.textAlign="center",e.font="bold 14px sans-serif";for(const t of l){const n=t.datum;if(!n)continue;if(!n.__funnelStepLabel)continue;const o=n.__funnelStepLabel;if(e.measureText(o).width+16>(null!==(r=null!==(i=n.__funnelRowWidth)&&void 0!==i?i:n.__funnelBarW)&&void 0!==r?r:0))continue;const a=n.__funnelStepLabelX,s=n.__funnelStepLabelY+3;e.strokeStyle="rgba(0,0,0,0.6)",e.lineWidth=3,e.strokeText(o,a,s),e.fillStyle="#fff",e.fillText(o,a,s)}e.font="bold 13px sans-serif";for(const t of l){const n=t.datum;if(!n)continue;if(null==n.__funnelValueLabelX)continue;const o=null!==(a=n.__funnelBarW)&&void 0!==a?a:0;if(60>o)continue;const i=n.__funnelValue;if(null==i||0===i)continue;const r=n.__funnelPercent,l=!0===n.__funnelIsFirstStep;let c;if(c=l?ia(i):null!=r?`${ia(i)} (${ra(r)})`:ia(i),e.measureText(c).width+16>o){if(l||null==r)continue;if(c=ia(i),e.measureText(c).width+16>o)continue}const u=n.__funnelValueLabelX,d=(null!==(s=n.__funnelValueLabelY)&&void 0!==s?s: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":[yr,(e,t,n,o)=>{var i,r;const a=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 a){const n=("string"==typeof t.style.fill?t.style.fill:null)||tn(e,"var(--semiotic-border, #999)"),o=ca(n,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),o?e.fillStyle=o:(e.fillStyle=n,e.globalAlpha=.4*(null!==(r=t.style.opacity)&&void 0!==r?r:1)),e.fill(),e.globalAlpha=1}},(e,t,n,o)=>{const i=t.filter(e=>{var t,n;return"rect"===e.type&&!0!==(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)&&null!=(null===(n=e.datum)||void 0===n?void 0:n.__barFunnelLabelX)});if(0===i.length)return;const r=function(e,t){const[n,o,i]=nn(e,t);return(.2126*n+.7152*o+.0722*i)/255>.6}(e,tn(e,"var(--semiotic-text, #333)")),a=r?"#1f2937":"#ffffff",s=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 n=t.datum;if(!n)continue;const o=n.__barFunnelValue;if(null==o)continue;if(25>t.w)continue;const i=n.__barFunnelPercent,r=!(!0===n.__barFunnelIsFirstStep)&&null!=i,u=r?ha(i):"",d=da(o);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=n.__barFunnelLabelX,m=y-f/2,v=n.__barFunnelLabelY-p-4;e.save(),e.shadowColor="rgba(0,0,0,0.15)",e.shadowBlur=4,e.shadowOffsetY=1,e.fillStyle=a,e.beginPath(),ua(e,m,v,f,p,4),e.fill(),e.restore(),e.strokeStyle=s,e.lineWidth=.5,e.beginPath(),ua(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:ga([yr]),custom:ga([yr,gr,Jr,ea,ta,oa])},pa={top:50,right:40,bottom:60,left:70},ya={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 ma({hover:n}){var o,i,r,a,s,l;const c=n.data||{},u=n.stats,d=n.category;if(Array.isArray(c)){const n=d||(null===(o=c[0])||void 0===o?void 0:o.category)||"";if(u)return t("div",{className:"semiotic-tooltip",style:ya,children:[n&&e("div",{style:{fontWeight:"bold"},children:n+""}),t("div",{children:["n = ",u.n]}),t("div",{children:["Min: ",u.min.toLocaleString()]}),t("div",{children:["Q1: ",u.q1.toLocaleString()]}),t("div",{children:["Median: ",u.median.toLocaleString()]}),t("div",{children:["Q3: ",u.q3.toLocaleString()]}),t("div",{children:["Max: ",u.max.toLocaleString()]}),t("div",{style:{opacity:.8},children:["Mean: ",u.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});const i=c.length;return t("div",{className:"semiotic-tooltip",style:ya,children:[n&&e("div",{style:{fontWeight:"bold"},children:n+""}),t("div",{children:[i," items"]})]})}if(null!=c.bin&&null!=c.count){const n=c.range||[];return t("div",{className:"semiotic-tooltip",style:ya,children:[c.category&&e("div",{style:{fontWeight:"bold"},children:c.category+""}),t("div",{children:["Count: ",c.count]}),2===n.length&&t("div",{style:{opacity:.8},children:[Number(n[0]).toFixed(1)," – ",Number(n[1]).toFixed(1)]})]})}const h=n.__oAccessor,g=n.__rAccessor,f=n.__chartType;if("swarm"===f||"point"===f){const n=Object.entries(c).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e("div",{className:"semiotic-tooltip",style:ya,children:n.map(([e,n])=>t("div",{children:[t("span",{style:{opacity:.7},children:[e,":"]})," ","number"==typeof n?n.toLocaleString():n+""]},e))})}const p=(h&&null!=c[h]?c[h]:null)||c.category||c.name||c.group||c.__rName||"",y=null!==(l=null!==(s=null!==(a=null!==(r=null!==(i=c.__aggregateValue)&&void 0!==i?i:g&&null!=c[g]?c[g]:null)&&void 0!==r?r:c.value)&&void 0!==a?a:c.__rValue)&&void 0!==s?s:c.pct)&&void 0!==l?l:"";if(!p&&""===y){const n=Object.entries(c).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e("div",{className:"semiotic-tooltip",style:ya,children:n.map(([e,n])=>t("div",{children:[t("span",{style:{opacity:.7},children:[e,":"]})," ","number"==typeof n?n.toLocaleString():n+""]},e))})}return t("div",{className:"semiotic-tooltip",style:ya,children:[p&&e("div",{style:{fontWeight:"bold"},children:p+""}),""!==y&&e("div",{children:"number"==typeof y?y.toLocaleString():y+""})]})}ma.ownsChrome=!0;const va=g(function(n,s){var c,u,h,g,f,y,m,v,b,x,k,w;const{chartType:A,runtimeMode:S,data:O,oAccessor:C="category",rAccessor:j="value",colorAccessor:M,stackBy:_,groupBy:P,multiAxis:L,timeAccessor:T,valueAccessor:$,categoryAccessor:N,projection:B="vertical",size:D=[600,400],responsiveWidth:E,responsiveHeight:I,margin:H,barPadding:F,roundedTop:W,gradientFill:z,trackFill:Y,baselinePadding:G,innerRadius:q,cornerRadius:X,normalize:V,startAngle:U,sweepAngle:Q,dynamicColumnWidth:K,bins:Z,showOutliers:J,showIQR:ee,amplitude:te,connectorOpacity:ne,showLabels:oe,connectorAccessor:ie,connectorStyle:re,dataIdAccessor:ae,rExtent:se,oExtent:le,extentPadding:ce=.05,oSort:ue,windowMode:de="sliding",windowSize:he=200,pieceStyle:ge,summaryStyle:fe,colorScheme:pe,barColors:ye,showAxes:be=!0,showCategoryTicks:xe,categoryLabel:we,valueLabel:Ae,categoryFormat:Se,valueFormat:Oe,oLabel:Ce,rLabel:je,oFormat:Me,rFormat:_e,rTickValues:Pe,tickLabelEdgeAlign:Le,axisExtent:Te,enableHover:$e=!0,hoverAnnotation:Ne,tooltipContent:Be,customHoverBehavior:De,annotations:Ee,autoPlaceAnnotations:Ie,svgAnnotationRules:Re,showGrid:He=!1,legend:Fe,legendHoverBehavior:We,legendClickBehavior:ze,legendHighlightedCategory:Ye,legendIsolatedCategories:Ge,legendPosition:qe,legendLayout:Xe,legendCategoryAccessor:Ve,onCategoriesChange:Ue,backgroundGraphics:Qe,foregroundGraphics:Ke,title:Ze,className:Je,background:et,centerContent:tt,decay:nt,pulse:ot,transition:it,animate:rt,staleness:at,brush:st,onBrush:lt,accessibleTable:ct=!0,description:ut,summary:dt,customLayout:ht,layoutConfig:gt}=n,ft=i(!0),pt=tr({sizeProp:D,responsiveWidth:E,responsiveHeight:I,userMargin:H,marginDefault:pa,foregroundGraphics:Ke,backgroundGraphics:Qe,animate:rt,transitionProp:it,themeDirtyRef:ft}),{reducedMotionRef:yt,responsiveRef:mt,size:vt,margin:bt,adjustedWidth:xt,adjustedHeight:kt,resolvedForeground:wt,resolvedBackground:At,currentTheme:St,transition:Ot,introEnabled:Ct,tableId:jt,rafRef:Mt,renderFnRef:_t,scheduleRender:Pt}=pt,Lt=ii(),Tt=li(),$t=r(()=>me(O),[O]),Nt=null!=we?we:Ce,Bt=null!=Ae?Ae:je,Dt=null!=Se?Se:Me,Et=null!=Oe?Oe:_e,It=i(null),Rt=i(null),Ht=i([]),Wt=i(Ve),zt=i(Ue);Wt.current=Ve,zt.current=Ue;const[Yt,Gt]=d(null),[qt,Vt]=d(null),[Ut,Qt]=d(0),[Kt,Zt]=d(!1),Jt=$e||Ne,en="streaming"===S,nn=r(()=>{var e,t,n;return{chartType:A,runtimeMode:en?"streaming":"bounded",windowSize:he,windowMode:de,extentPadding:ce,projection:B,oAccessor:en?void 0:C,rAccessor:en?void 0:j,colorAccessor:M,stackBy:_,groupBy:P,multiAxis:L,timeAccessor:en?T:void 0,valueAccessor:en?$||("string"==typeof j||"function"==typeof j?j:void 0):void 0,categoryAccessor:en?N||C:void 0,rExtent:se,oExtent:le,axisExtent:Te,barPadding:F,roundedTop:W,gradientFill:z,trackFill:Y,baselinePadding:G,innerRadius:q,cornerRadius:X,normalize:V,startAngle:U,sweepAngle:Q,dynamicColumnWidth:K,bins:Z,showOutliers:J,showIQR:ee,amplitude:te,connectorOpacity:ne,showLabels:oe,connectorAccessor:ie,connectorStyle:re,dataIdAccessor:ae,oSort:ue,pieceStyle:ge,summaryStyle:fe,colorScheme:pe,themeCategorical:null===(e=null==St?void 0:St.colors)||void 0===e?void 0:e.categorical,themeSemantic:ke(St),themeSequential:null===(t=null==St?void 0:St.colors)||void 0===t?void 0:t.sequential,themeDiverging:null===(n=null==St?void 0:St.colors)||void 0===n?void 0:n.diverging,barColors:ye,decay:nt,pulse:ot,transition:Ot,introAnimation:Ct,staleness:at,customLayout:ht,layoutConfig:gt,layoutMargin:bt}},[A,he,de,ce,B,C,j,M,_,P,L,T,$,N,se,le,Te,F,W,z,Y,G,q,X,V,U,Q,K,Z,J,ee,te,ne,oe,ie,re,ae,ue,ge,fe,pe,ye,nt,ot,null==Ot?void 0:Ot.duration,null==Ot?void 0:Ot.easing,Ct,at,en,St,ht,gt,bt]),on=ui(nn),rn=i(null);rn.current||(rn.current=new Hr(on));const an=l(()=>{var e,t;const n=Wt.current,o=zt.current;if(!o||!n)return;const i=wr(null!==(t=null===(e=rn.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[],n);Ar(i,Ht.current)||(Ht.current=i,o(i))},[]);a(()=>{var e;null===(e=rn.current)||void 0===e||e.updateConfig(on),ft.current=!0,Pt()},[on,Pt]);const sn=i(null);sn.current||(sn.current=new ve(e=>{const t=rn.current;t&&t.ingest(e)&&(ft.current=!0,Pt())}));const ln=l(e=>{var t;null===(t=sn.current)||void 0===t||t.push(e)},[]),cn=l(e=>{var t;null===(t=sn.current)||void 0===t||t.pushMany(e)},[]),un=l(()=>{var e,t;null===(e=sn.current)||void 0===e||e.clear(),null===(t=rn.current)||void 0===t||t.clear(),ft.current=!0,Pt()},[Pt]),dn=l(e=>{var t,n;null===(t=sn.current)||void 0===t||t.clearLastData(),null===(n=sn.current)||void 0===n||n.setReplacementData(e)},[]);p(s,()=>({push:ln,pushMany:cn,replace:dn,remove:e=>{var t,n,o,i;null===(t=sn.current)||void 0===t||t.flush();const r=null!==(o=null===(n=rn.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[];if(r.length>0){const e=null===(i=Rt.current)||void 0===i?void 0:i.data;!!Rt.current&&r.some(Array.isArray(e)?t=>e.includes(t):t=>t===e)&&(Rt.current=null,Gt(null)),ft.current=!0,Pt()}return r},update:(e,t)=>{var n,o,i;null===(n=sn.current)||void 0===n||n.flush();const r=null!==(i=null===(o=rn.current)||void 0===o?void 0:o.update(e,t))&&void 0!==i?i:[];return r.length>0&&(ft.current=!0,Pt()),r},clear:un,getData:()=>{var e,t,n;return null===(e=sn.current)||void 0===e||e.flush(),null!==(n=null===(t=rn.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=rn.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[ln,cn,dn,un,Pt]),a(()=>{var e;O&&(null===(e=sn.current)||void 0===e||e.setBoundedData($t))},[O,$t]);const{hoverHandlerRef:hn,hoverLeaveRef:gn,onPointerMove:fn,onPointerLeave:pn}=pt;hn.current=e=>{if(!Jt)return;const t=It.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-bt.left,i=e.clientY-n.top-bt.top;if(0>o||o>xt||0>i||i>kt)return void(Rt.current&&(Rt.current=null,Gt(null),De&&De(null),Pt()));const r=rn.current;if(!r||0===r.scene.length)return;const a="radial"===B,s=function(e,t,n,o=30,i,r=0){let a=null;if(i){const e=Xt(i,t,n,o,r);e&&(a={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=Fr(r,t,n);break;case"point":if(i)break;e=Wr(r,t,n,o);break;case"wedge":if(null===r.datum)break;e=zr(r,t,n);break;case"boxplot":e=Yr(r,t,n);break;case"violin":e=Gr(r,t,n)}e&&o>e.distance&&(a&&e.distance>=a.distance||(a=e))}return a}(r.scene,a?o-xt/2:o,a?i-kt/2:i,30,r.pointQuadtree,r.maxPointRadius);if(!s)return void(Rt.current&&(Rt.current=null,Gt(null),De&&De(null),Pt()));const l=Wi(s.datum||{},s.x,s.y,Object.assign(Object.assign(Object.assign({},s.stats&&{stats:s.stats}),s.category&&{category:s.category}),{__oAccessor:"string"==typeof C?C:void 0,__rAccessor:"string"==typeof j?j:void 0,__chartType:A}));Rt.current=l,Gt(l),De&&(De(l),ft.current=!0),Pt()},gn.current=()=>{Rt.current&&(Rt.current=null,Gt(null),De&&(De(null),ft.current=!0),Pt())};const yn=i(-1),mn=i(null),vn=i(null),bn=l(e=>{const t=rn.current;if(!t||0===t.scene.length)return;const n=t.version;let o;if(vn.current&&vn.current.version===n)o=vn.current.graph;else{const e=function(e){var t,n,o;const i=[];for(const r of e)if("rect"===r.type&&null!=r.x){if(null==r.datum)continue;const e=null!==(n=null===(t=r.datum)||void 0===t?void 0:t.category)&&void 0!==n?n:"";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!==(o=r.group)&&void 0!==o?o: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;o=xn(e),vn.current={version:n,graph:o}}const i=yn.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),yn.current=0;const t=o.flat[0];mn.current={shape:t.shape,w:t.w,h:t.h};const n=Object.assign(Object.assign({},On(t)),{__oAccessor:"string"==typeof C?C:void 0,__rAccessor:"string"==typeof j?j:void 0,__chartType:A});return Rt.current=n,Gt(n),De&&De(n),void Pt()}const r=kn(o,i),a=wn(e.key,r,o);if(null===a)return;if(e.preventDefault(),0>a)return yn.current=-1,mn.current=null,Rt.current=null,Gt(null),De&&De(null),void Pt();yn.current=a;const s=o.flat[a];mn.current={shape:s.shape,w:s.w,h:s.h};const l=Object.assign(Object.assign({},On(s)),{__oAccessor:"string"==typeof C?C:void 0,__rAccessor:"string"==typeof j?j:void 0,__chartType:A});Rt.current=l,Gt(l),De&&De(l),Pt()},[De,Pt]),An=l(e=>{yn.current=-1,mn.current=null,fn(e)},[fn]);_t.current=()=>{var e,t;Mt.current=0;const n=It.current;if(!n)return;const o=n.getContext("2d");if(!o)return;const i=rn.current;if(!i)return;const r="undefined"!=typeof performance?performance.now():Date.now(),a=i.advanceTransition(yt.current?r+1e6:r),s=!yt.current&&a,l=ft.current;l&&!a&&(i.computeScene({width:xt,height:kt}),an(),ft.current=!1),(l||s)&&n.setAttribute("aria-label",vi(i.scene,A+" chart"));const c=or(),u=vt[0]*c,d=vt[1]*c;n.width===u&&n.height===d||(n.width=u,n.height=d,n.style.width=vt[0]+"px",n.style.height=vt[1]+"px"),o.setTransform(c,0,0,c,0,0),o.clearRect(0,0,vt[0],vt[1]);const h=null!==(e=null==at?void 0:at.threshold)&&void 0!==e?e:5e3,g=at&&i.lastIngestTime>0&&r-i.lastIngestTime>h;if(g&&(o.globalAlpha=null!==(t=null==at?void 0:at.dimOpacity)&&void 0!==t?t:.5),"transparent"!==et&&!Qe){const e=n?getComputedStyle(n).getPropertyValue("--semiotic-bg").trim():"",t=et||(e&&"transparent"!==e?e:null),i=t?tn(o,t):null;i&&(o.fillStyle=i,o.fillRect(0,0,vt[0],vt[1]))}const f="radial"===B;o.save(),o.beginPath(),o.rect(bt.left,bt.top,xt,kt),o.clip(),f?(o.save(),o.translate(bt.left+xt/2,bt.top+kt/2)):o.translate(bt.left,bt.top);const p=ht?fa.custom:fa[A]||[],y={width:xt,height:kt};for(const e of p)e(o,i.scene,i.scales,y);f&&o.restore(),o.restore(),g&&(o.globalAlpha=1),l&&i.scales&&(Vt(i.scales),Qt(e=>e+1)),(null==at?void 0:at.showBadge)&&Zt(!!g),(s||null!=i.activeTransition||i.hasActivePulses)&&(Mt.current=requestAnimationFrame(()=>_t.current()))},ci({hydrated:Lt,wasHydratingFromSSR:Tt,storeRef:rn,dirtyRef:ft,renderFnRef:_t,cleanup:()=>{var e;return null===(e=sn.current)||void 0===e?void 0:e.clear()}}),a(()=>{ft.current=!0,Pt()},[A,xt,kt,be,et,Pt]),Cn(at,rn,ft,Pt,Kt,Zt);const Sn=Jt&&Yt?Be?Be(Yt):e(ma,{hover:Yt}):null,Mn="radial"===B,_n=Sn?e(Qi,{x:Yt?Mn?Yt.x+xt/2:Yt.x:0,y:Yt?Mn?Yt.y+kt/2:Yt.y:0,containerWidth:xt,containerHeight:kt,margin:bt,className:"stream-ordinal-tooltip",children:Sn}):null,Pn=Sr(C,void 0,"__semiotic_resolvedO",""),Ln=Sr(j,void 0,"__semiotic_resolvedR",""),Tn=Pn.key,$n=Ln.key,Nn=Or(Pn,Ln,Ee&&Ee.length>0||!1);if(ni||!Lt&&Tt){const n=rn.current;n&&O&&(n.ingest({inserts:$t,bounded:!0}),n.computeScene({width:xt,height:kt}));const i=null!==(c=null==n?void 0:n.scene)&&void 0!==c?c:[],r=null!==(u=null==n?void 0:n.scales)&&void 0!==u?u:null,a="radial"===B,s=a?bt.left+xt/2:bt.left,l=a?bt.top+kt/2:bt.top;return t("div",{ref:mt,className:"stream-ordinal-frame"+(Je?" "+Je:""),role:"img","aria-label":ut||("string"==typeof Ze?Ze:"Ordinal chart"),style:{position:"relative",width:E?"100%":vt[0],height:I?"100%":vt[1]},children:[e(Di,{summary:dt}),t("svg",{xmlns:"http://www.w3.org/2000/svg",width:vt[0],height:vt[1],style:{position:"absolute",left:0,top:0},children:[At&&e("g",{transform:`translate(${bt.left},${bt.top})`,children:At}),t("g",{transform:`translate(${s},${l})`,children:[et&&e("rect",{x:0,y:0,width:xt,height:kt,fill:et}),i.map((n,i)=>function(n,i,r){var a,s,l,c,u,d,h,g,f;const p=("category"in n?n.category:void 0)||("group"in n?n.group:void 0)||"",y=e=>`ord-${n.type}-${p}-${i}-${e}`,m=`ord-${n.type}-${p}-${i}`;switch(n.type){case"rect":{const i=n,r=ti(m)+"-grad",a=function(t,n){const o=t.fillGradient;if(!o)return null;let i=t.x,r=t.y,a=t.x,s=t.y+t.h;"bottom"===t.roundedEdge?(r=t.y+t.h,s=t.y):"right"===t.roundedEdge?(i=t.x+t.w,r=t.y,a=t.x,s=t.y):"left"===t.roundedEdge&&(i=t.x,r=t.y,a=t.x+t.w,s=t.y);const l=[];if("colorStops"in o){const t=o.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 n=0;t.length>n;n++)l.push(e("stop",{offset:t[n].offset,stopColor:t[n].color},n))}else{const n=ei(t.style.fill);l.push(e("stop",{offset:0,stopColor:n,stopOpacity:o.topOpacity},"0")),l.push(e("stop",{offset:1,stopColor:n,stopOpacity:o.bottomOpacity},"1"))}return e("linearGradient",{id:n,gradientUnits:"userSpaceOnUse",x1:i,y1:r,x2:a,y2:s,children:l})}(i,r),s=a?`url(#${r})`:ei(i.style.fill);if(i.cornerRadii&&Vo(i.cornerRadii)){const n=function(e){const{x:t,y:n,w:o,h:i}=e,{tl:r,tr:a,br:s,bl:l}=Uo(e);let c=`M${t+r},${n}`;return c+=` L${t+o-a},${n}`,a>0&&(c+=` A${a},${a} 0 0 1 ${t+o},${n+a}`),c+=` L${t+o},${n+i-s}`,s>0&&(c+=` A${s},${s} 0 0 1 ${t+o-s},${n+i}`),c+=` L${t+l},${n+i}`,l>0&&(c+=` A${l},${l} 0 0 1 ${t},${n+i-l}`),c+=` L${t},${n+r}`,r>0&&(c+=` A${r},${r} 0 0 1 ${t+r},${n}`),c+=" Z",c}(i);return t(o.Fragment,{children:[a&&e("defs",{children:a}),e("path",{d:n,fill:s,opacity:i.style.opacity,stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})]},m)}if(i.roundedTop&&i.roundedTop>0){const n=Math.min(i.roundedTop,i.w/2,i.h/2),{x:r,y:l,w:c,h:u}=i;let d;switch(i.roundedEdge){case"right":d=`M${r},${l} L${r+c-n},${l} A${n},${n} 0 0 1 ${r+c},${l+n} L${r+c},${l+u-n} A${n},${n} 0 0 1 ${r+c-n},${l+u} L${r},${l+u} Z`;break;case"left":d=`M${r+c},${l} L${r+n},${l} A${n},${n} 0 0 0 ${r},${l+n} L${r},${l+u-n} A${n},${n} 0 0 0 ${r+n},${l+u} L${r+c},${l+u} Z`;break;case"bottom":d=`M${r},${l} L${r+c},${l} L${r+c},${l+u-n} A${n},${n} 0 0 1 ${r+c-n},${l+u} L${r+n},${l+u} A${n},${n} 0 0 1 ${r},${l+u-n} Z`;break;default:d=`M${r},${l+u} L${r},${l+n} A${n},${n} 0 0 1 ${r+n},${l} L${r+c-n},${l} A${n},${n} 0 0 1 ${r+c},${l+n} L${r+c},${l+u} Z`}return t(o.Fragment,{children:[a&&e("defs",{children:a}),e("path",{d:d,fill:s,opacity:i.style.opacity,stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})]},m)}return t(o.Fragment,{children:[a&&e("defs",{children:a}),e("rect",{x:i.x,y:i.y,width:i.w,height:i.h,fill:s,opacity:i.style.opacity,stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})]},m)}case"point":{const t=n;return e("circle",{cx:t.x,cy:t.y,r:t.r,fill:ei(t.style.fill),opacity:null!==(a=t.style.opacity)&&void 0!==a?a:.8,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},m)}case"wedge":{const o=n;if(o._gradientBand&&o._gradientBand.colors.length>0){const n=ti(`${r?r+"-":""}gauge-grad-${o.category||m}-${i}`),{clipPath:a,slices:d}=Zo({innerRadius:o.innerRadius,outerRadius:o.outerRadius,startAngle:o.startAngle,endAngle:o.endAngle,cornerRadius:o.cornerRadius,roundStart:null===(l=null===(s=o.roundedEnds)||void 0===s?void 0:s.start)||void 0===l||l,roundEnd:null===(u=null===(c=o.roundedEnds)||void 0===c?void 0:c.end)||void 0===u||u,colors:o._gradientBand.colors});return t("g",{transform:`translate(${o.cx},${o.cy})`,opacity:o.style.opacity,fillOpacity:o.style.fillOpacity,children:[e("defs",{children:e("clipPath",{id:n,children:e("path",{d:a})})}),e("g",{clipPath:`url(#${n})`,children:d.map((t,n)=>e("path",{d:t.d,fill:ei(t.color)},n))}),o.style.stroke&&"none"!==o.style.stroke&&e("path",{d:a,fill:"none",stroke:o.style.stroke,strokeWidth:o.style.strokeWidth})]},m)}let a;if(o.roundedEnds)a=Ko({innerRadius:o.innerRadius,outerRadius:o.outerRadius,startAngle:o.startAngle,endAngle:o.endAngle,cornerRadius:o.cornerRadius,roundStart:o.roundedEnds.start,roundEnd:o.roundedEnds.end});else{const e=R().innerRadius(o.innerRadius).outerRadius(o.outerRadius).startAngle(o.startAngle+Math.PI/2).endAngle(o.endAngle+Math.PI/2);o.cornerRadius&&e.cornerRadius(o.cornerRadius),a=e(Jo)||""}return e("path",{d:a,transform:`translate(${o.cx},${o.cy})`,fill:ei(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},m)}case"boxplot":{const o=n,i=o.columnWidth/2;return t("g","vertical"===o.projection?{children:[e("line",{x1:o.x,y1:o.minPos,x2:o.x,y2:o.maxPos,stroke:o.style.stroke||"#333",strokeWidth:1}),e("rect",{x:o.x-i,y:Math.min(o.q1Pos,o.q3Pos),width:o.columnWidth,height:Math.abs(o.q3Pos-o.q1Pos),fill:ei(o.style.fill),fillOpacity:null!==(d=o.style.fillOpacity)&&void 0!==d?d:.6,stroke:o.style.stroke||"#333",strokeWidth:1}),e("line",{x1:o.x-i,y1:o.medianPos,x2:o.x+i,y2:o.medianPos,stroke:o.style.stroke||"#333",strokeWidth:2}),e("line",{x1:o.x-.5*i,y1:o.minPos,x2:o.x+.5*i,y2:o.minPos,stroke:o.style.stroke||"#333",strokeWidth:1}),e("line",{x1:o.x-.5*i,y1:o.maxPos,x2:o.x+.5*i,y2:o.maxPos,stroke:o.style.stroke||"#333",strokeWidth:1})]}:{children:[e("line",{x1:o.minPos,y1:o.y,x2:o.maxPos,y2:o.y,stroke:o.style.stroke||"#333",strokeWidth:1}),e("rect",{x:Math.min(o.q1Pos,o.q3Pos),y:o.y-i,width:Math.abs(o.q3Pos-o.q1Pos),height:o.columnWidth,fill:ei(o.style.fill),fillOpacity:null!==(h=o.style.fillOpacity)&&void 0!==h?h:.6,stroke:o.style.stroke||"#333",strokeWidth:1}),e("line",{x1:o.medianPos,y1:o.y-i,x2:o.medianPos,y2:o.y+i,stroke:o.style.stroke||"#333",strokeWidth:2}),e("line",{x1:o.minPos,y1:o.y-.5*i,x2:o.minPos,y2:o.y+.5*i,stroke:o.style.stroke||"#333",strokeWidth:1}),e("line",{x1:o.maxPos,y1:o.y-.5*i,x2:o.maxPos,y2:o.y+.5*i,stroke:o.style.stroke||"#333",strokeWidth:1})]},m)}case"violin":{const t=n,o=[e("path",{d:t.pathString,transform:t.translateX||t.translateY?`translate(${t.translateX},${t.translateY})`:void 0,fill:ei(t.style.fill),fillOpacity:null!==(g=t.style.fillOpacity)&&void 0!==g?g:.6,stroke:t.style.stroke||"#333",strokeWidth:t.style.strokeWidth||1},y("path"))];if(t.iqrLine&&t.bounds){const n=t.bounds,i=n.x+n.width/2,r=n.y+n.height/2;n.height>n.width?o.push(e("line",{x1:i,y1:t.iqrLine.q1Pos,x2:i,y2:t.iqrLine.q3Pos,stroke:t.style.stroke||"#333",strokeWidth:2},y("iqr")),e("circle",{cx:i,cy:t.iqrLine.medianPos,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},y("med"))):o.push(e("line",{x1:t.iqrLine.q1Pos,y1:r,x2:t.iqrLine.q3Pos,y2:r,stroke:t.style.stroke||"#333",strokeWidth:2},y("iqr")),e("circle",{cx:t.iqrLine.medianPos,cy:r,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},y("med")))}return e("g",{children:o},m)}case"connector":return e("line",{x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,stroke:n.style.stroke||"#999",strokeWidth:n.style.strokeWidth||1,opacity:null!==(f=n.style.opacity)&&void 0!==f?f:.5},m);case"trapezoid":{const t=n,o=t.points.map(e=>`${e[0]},${e[1]}`).join(" ");return e("polygon",{points:o,fill:ei(t.style.fill,"#999"),opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},m)}default:return null}}(n,i,jt)).filter(Boolean)]})]}),e(Vr,{width:xt,height:kt,totalWidth:vt[0],totalHeight:vt[1],margin:bt,scales:r,showAxes:be,showCategoryTicks:xe,oLabel:Nt,rLabel:Bt,oFormat:Dt,rFormat:Et,rTickValues:Pe,tickLabelEdgeAlign:Le,axisExtent:Te,showGrid:He,title:Ze,legend:Fe,legendHoverBehavior:We,legendClickBehavior:ze,legendHighlightedCategory:Ye,legendIsolatedCategories:Ge,legendPosition:qe,legendLayout:Xe,foregroundGraphics:Ft(wt,null===(h=rn.current)||void 0===h?void 0:h.customLayoutOverlays),annotations:Ee,autoPlaceAnnotations:Ie,svgAnnotationRules:Re,annotationFrame:0,xAccessor:Tn,yAccessor:$n,annotationData:Nn(null==n?void 0:n.getData())}),tt&&"radial"===B&&e("div",{style:{position:"absolute",left:bt.left+xt/2,top:bt.top+kt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:tt})]})}return t("div",{ref:mt,className:"stream-ordinal-frame"+(Je?" "+Je:""),role:"group","aria-label":ut||("string"==typeof Ze?Ze:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:E?"100%":vt[0],height:I?"100%":vt[1],overflow:"visible"},onKeyDown:bn,children:[ct&&e(Ei,{tableId:jt}),ct&&e(Ni,{scene:null!==(f=null===(g=rn.current)||void 0===g?void 0:g.scene)&&void 0!==f?f:[],chartType:A+" chart",tableId:jt,chartTitle:"string"==typeof Ze?Ze:void 0}),e(Di,{summary:dt}),e(Ii,{hoverPoint:Yt}),t("div",{role:"img","aria-label":ut||("string"==typeof Ze?Ze:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Jt?An:void 0,onMouseLeave:Jt?pn:void 0,children:[At&&e("svg",{style:{position:"absolute",top:0,left:0,width:vt[0],height:vt[1],pointerEvents:"none"},children:e("g",{transform:`translate(${bt.left},${bt.top})`,children:At})}),e(qr,{width:xt,height:kt,totalWidth:vt[0],totalHeight:vt[1],margin:bt,scales:qt,showAxes:be,showGrid:He,rFormat:Et,rTickValues:Pe,axisExtent:Te}),e("canvas",{ref:It,"aria-label":vi(null!==(m=null===(y=rn.current)||void 0===y?void 0:y.scene)&&void 0!==m?m:[],A+" chart"),style:{position:"absolute",top:0,left:0,width:vt[0],height:vt[1]}}),e(Vr,{width:xt,height:kt,totalWidth:vt[0],totalHeight:vt[1],margin:bt,scales:qt,showAxes:be,showCategoryTicks:xe,oLabel:Nt,rLabel:Bt,oFormat:Dt,rFormat:Et,rTickValues:Pe,axisExtent:Te,showGrid:He,title:Ze,legend:Fe,legendHoverBehavior:We,legendClickBehavior:ze,legendHighlightedCategory:Ye,legendIsolatedCategories:Ge,legendPosition:qe,legendLayout:Xe,foregroundGraphics:Ft(wt,null===(v=rn.current)||void 0===v?void 0:v.customLayoutOverlays),annotations:Ee,autoPlaceAnnotations:Ie,svgAnnotationRules:Re,annotationFrame:Ut,xAccessor:Tn,yAccessor:$n,annotationData:Nn(null===(b=rn.current)||void 0===b?void 0:b.getData()),underlayRendered:!0}),(st||lt)&&"radial"!==B&&e(Ur,{width:xt,height:kt,totalWidth:vt[0],totalHeight:vt[1],margin:bt,scales:qt,onBrush:lt||(()=>{})}),tt&&"radial"===B&&e("div",{style:{position:"absolute",left:bt.left+xt/2,top:bt.top+kt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:tt}),(null==at?void 0:at.showBadge)&&e(jn,{isStale:Kt,position:at.badgePosition}),e(Hi,{active:yn.current>=0,hoverPoint:Yt,margin:bt,size:vt,shape:null===(x=mn.current)||void 0===x?void 0:x.shape,width:null===(k=mn.current)||void 0===k?void 0:k.w,height:null===(w=mn.current)||void 0===w?void 0:w.h}),_n]})]})});va.displayName="StreamOrdinalFrame";const ba={weightChange:.1,newEdge:.5,newNode:1,threshold:3,transitionDuration:500},xa={radius:3,opacity:.7,speedMultiplier:1,maxPerEdge:50,spawnRate:.1};class ka{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 n=this.particles[t];return n.active=!0,n.t=0,n.offset=Math.random()-.5,n.edgeIndex=e,n.x=0,n.y=0,n}step(e,t,n,o){var i;for(let r=0;this.capacity>r;r++){const a=this.particles[r];if(!a.active)continue;const s=n[a.edgeIndex];if(!s||!s.bezier){a.active=!1,this._freeIndices.push(r);continue}const l=o&&null!==(i=o[a.edgeIndex])&&void 0!==i?i:1;a.t+=e*t*l*(s.bezier.circular?.3:1),1>a.t?wa(s.bezier,a.t,a.offset,a):(a.active=!1,this._freeIndices.push(r))}}countForEdge(e){let t=0;for(let n=0;this.capacity>n;n++)this.particles[n].active&&this.particles[n].edgeIndex===e&&t++;return t}clear(){for(let e=0;this.capacity>e;e++)this.particles[e].active=!1;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 n=0;e>n;n++)t.length>n?this.particles[n]=t[n]:(this.particles[n]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0},this._freeIndices.push(n));this.capacity=e}}function wa(e,t,n,o){if(e.circular&&e.segments)return void function(e,t,n,o,i){const r=e.length,a=t*r,s=Math.min(Math.floor(a),r-1),l=a-s,[c,u,d,h]=e[s];Aa(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*n*o*2,i.y+=e*n*o*2}}(e.segments,t,n,e.halfWidth,o);if(!e.points)return o.x=0,void(o.y=0);const[i,r,a,s]=e.points;Aa(i,r,a,s,t,o);const l=s.x-i.x,c=s.y-i.y,u=Math.sqrt(l*l+c*c);if(u>.001){const t=l/u;o.x+=-c/u*n*e.halfWidth*2,o.y+=t*n*e.halfWidth*2}}function Aa(e,t,n,o,i,r){const a=1-i,s=a*a,l=s*a,c=i*i,u=c*i;r.x=l*e.x+3*s*i*t.x+3*a*c*n.x+u*o.x,r.y=l*e.y+3*s*i*t.y+3*a*c*n.y+u*o.y}function Sa(e,t){var n=e.get(t);if(!n)throw Error("missing: "+t);return n}function Oa(e,t){var n,o=[],i=[],r=[],a={},s=[];function l(e){r[e]=!1,a.hasOwnProperty(e)&&Object.keys(a[e]).forEach(function(t){delete a[e][t],r[t]&&l(t)})}function c(e){var t,o,d=!1;for(i.push(e),r[e]=!0,t=0;s[e].length>t;t++)(o=s[e][t])===n?(u(n,i),d=!0):r[o]||(d=c(o));if(d)l(e);else for(t=0;s[e].length>t;t++){var h=a[o=s[e][t]];h||(a[o]=h={}),h[o]=!0}return i.pop(),d}function u(e,t){var n=[].concat(t).concat(e);o.push(n)}function d(t){!function(t){for(var n=0;e.length>n;n++)n>=t&&e[n]||(e[n]=[]),e[n]=e[n].filter(function(e){return e>=t})}(t);for(var n,o=function(e){for(var t=e.length,n=Array(t),o=Array(t),i=Array(t),r=Array(t),a=Array(t),s=Array(t),l=0;t>l;++l)n[l]=-1,o[l]=0,i[l]=!1,r[l]=0,a[l]=-1,s[l]=[];var c,u=0,d=[],h=[];function g(t){var l=[t],c=[t];for(n[t]=o[t]=u,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>n[p]){n[p]=o[p]=u,i[p]=!0,u+=1,l.push(p),c.push(p);break}i[p]&&(o[t]=0|Math.min(o[t],o[p])),0>a[p]||s[t].push(a[p])}r[t]=f}else{if(o[t]===n[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(s[b]),v+=s[b].length,a[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>n[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=o.components.filter(function(e){return e.length>1}),r=1/0,a=0;i.length>a;a++)for(var s=0;i[a].length>s;s++)r>i[a][s]&&(r=i[a][s],n=a);var l=i[n];if(!l)return!1;var c=e.map(function(e,t){return-1===l.indexOf(t)?[]:e.filter(function(e){return-1!==l.indexOf(e)})});return{leastVertex:r,adjList:c}}n=0;for(var h=e.length;h>n;){var g=d(n);if(n=g.leastVertex,s=g.adjList){for(var f=0;s.length>f;f++)for(var p=0;s[f].length>p;p++){var y=s[f][p];r[+y]=!1,a[y]={}}c(n),n+=1}else n=h}return o}function Ca(e){return e.y0-e.y1>0?"up":"down"}function ja(e,t){return t(e.source)==t(e.target)}function Ma(e){var t=0;e.source.sourceLinks.forEach(function(e){t=e.circular?t+1:t});var n=0;return e.target.targetLinks.forEach(function(e){n=e.circular?n+1:n}),1>=t&&1>=n}function _a(e){return e.target.x0-e.source.x1}function Pa(e,t){var n=Ta(e),o=_a(t)/Math.tan(n);return"up"==Ca(e)?e.y1-o:e.y1+o}function La(e,t){var n=Ta(e),o=_a(t)/Math.tan(n);return"up"==Ca(e)?e.y1+o:e.y1-o}function Ta(e){var t=Math.abs(e.y1-e.y0);return Math.atan(Math.abs(e.target.x0-e.source.x1)/t)}function $a(e,t){return t(e)}function Na(e){return Da(e.source)}function Ba(e){return Da(e.target)}function Da(e){return(e.y0+e.y1)/2}function Ea(e){return e.virtual?0:e.value}function Ia(e,t){var n=0;e.sourceLinks.forEach(function(e){n=e.circular&&!ja(e,t)?n+1:n});var o=0;return e.targetLinks.forEach(function(e){o=e.circular&&!ja(e,t)?o+1:o}),n+o}function Ra(e){return e.target.depth}function Ha(e,t){return e.sourceLinks.length?e.depth:t-1}function Fa(e,t){return e.y0-t.y0}function Wa(e,t){return t.y0-e.y0}function za(e,t){return e.y1-t.y1}function Ya(e,t){return t.y1-e.y1}function Ga(e,t){return Xa(e.source,t.source)||e.index-t.index}function qa(e,t){return Xa(e.target,t.target)||e.index-t.index}function Xa(e,t){return e.partOfCycle===t.partOfCycle?e.y0-t.y0:"top"===e.circularLinkType||"bottom"===t.circularLinkType?-1:1}function Va(e,t){return Ua(e)==Ua(t)?"bottom"==e.circularLinkType?Wa(e,t):Fa(e,t):Ua(t)-Ua(e)}function Ua(e){return e.target.column-e.source.column}function Qa(e,t){return Ka(e)==Ka(t)}function Ka(e){return e.y0-e.y1>0?"up":"down"}function Za(e,t,n,o,i){let r=e;var a=Math.max(8,.15*(r.y1-r.y0));r.links.forEach(function(e){e.circular&&(e._circularWidth=Math.min(e.width,a))});var s=z(r.links,function(e){return e.source.y0});r.links.forEach(function(e){e.circular&&(e.circularPathData={})});var l=r.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}),Ja(r.links.filter(function(e){return"top"==e.circularLinkType}),t,n),Ja(r.links.filter(function(e){return"bottom"==e.circularLinkType}),t,n),r.links.forEach(function(e){if(e.circular){if(e.circularPathData.arcRadius=e._circularWidth+o,e.circularPathData.rightNodeBuffer=5,e.circularPathData.leftNodeBuffer=5,e.circularPathData.sourceWidth=e.source.x1-e.source.x0,e.circularPathData.sourceX=e.source.x0+e.circularPathData.sourceWidth,e.circularPathData.targetX=e.target.x0,e.circularPathData.sourceY=e.y0,e.circularPathData.targetY=e.y1,ja(e,t)&&Ma(e))e.circularPathData.rightSmallArcRadius=o+e._circularWidth/2,e.circularPathData.rightLargeArcRadius=o+e._circularWidth/2,e.circularPathData.leftSmallArcRadius=o+e._circularWidth/2,e.circularPathData.leftLargeArcRadius=o+e._circularWidth/2,"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=e.source.y1+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 a=e.source.column,l=e.circularLinkType,c=r.links.filter(function(e){return e.source.column==a&&e.circularLinkType==l});c.sort("bottom"==e.circularLinkType?Wa:Fa);var u=0;c.forEach(function(t,i){t.circularLinkID==e.circularLinkID&&(e.circularPathData.rightSmallArcRadius=o+e._circularWidth/2+u,e.circularPathData.rightLargeArcRadius=o+e._circularWidth/2+i*n+u),u+=t._circularWidth||t.width}),a=e.target.column,(c=r.links.filter(function(e){return e.target.column==a&&e.circularLinkType==l})).sort("bottom"==e.circularLinkType?Ya:za),u=0,c.forEach(function(t,i){t.circularLinkID==e.circularLinkID&&(e.circularPathData.leftSmallArcRadius=o+e._circularWidth/2+u,e.circularPathData.leftLargeArcRadius=o+e._circularWidth/2+i*n+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=s-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,n=e.y0,o=e.target.x0,i=e.y1,r=(t+o)/2;return"M"+t+","+n+"C"+r+","+n+" "+r+","+i+" "+o+","+i}(e)}),r}function Ja(e,t,n){e.sort(Va);var o=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(ja(e,t)&&Ma(e))e.circularPathData.verticalBuffer=r+e._circularWidth/2;else{for(var a=0;o.length>a;a++){var s=o[a];if(s!==e&&s.circularPathData&&void 0!==s.circularPathData.verticalBuffer&&es(e,s)){var l=s.circularPathData.verticalBuffer+(s._circularWidth||s.width)/2+n;r=l>r?l:r}}e.circularPathData.verticalBuffer=r+e._circularWidth/2}}),e}function es(e,t){return e.source.column>=t.target.column&&t.source.column>=e.target.column}function ts(e){return function(){return e}}function ns(e){return e.index}function os(e){return e.nodes}function is(e){return e.links}function rs(e,t,n){var o=Y(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});o.forEach(function(i,r){var a=i.length;if(t)i.sort(t);else if(r>0){var s=new Map;i.forEach(function(e,t){var n,o,i,r=(o=0,i=0,(n=e).targetLinks.forEach(function(e){if(!e.circular){var t=e.value||1;i+=Da(e.source)*t,o+=t}}),n.sourceLinks.forEach(function(e){if(!e.circular){var t=e.value||1;i+=Da(e.target)*t,o+=t}}),o>0?i/o:NaN);s.set(e,{bc:r,idx:t})}),i.sort(function(e,t){var n=s.get(e),o=s.get(t),i=n.bc,r=o.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)?n.idx-o.idx:1:-1:i-r})}else i.sort(function(e,t){return e.circularLinkType==t.circularLinkType?Ia(t,n)-Ia(e,n):"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==o.length-1&&1==a||0==t.depth&&1==a?(t.y0=e.y1/2-t.value*e.ky,t.y1=t.y0+t.value*e.ky):t.partOfCycle?0==Ia(t,n)?(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)/a*i,t.y1=t.y0+t.value*e.ky):(t.y0=(e.y1-e.y0)/2-a/2+i,t.y1=t.y0+t.value*e.ky)})})}function as(e,t,n,o,i,r){var a=Y(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});u();for(var s=1,l=r;l>0;--l)c(s*=.99,n),u();function c(t,n){var o=a.length;a.forEach(function(i){var r=i.length,a=i[0].depth;i.forEach(function(i){var s;if(i.sourceLinks.length||i.targetLinks.length)if(i.partOfCycle&&Ia(i,n)>0){var l=X(i.sourceLinks,Ba),c=X(i.targetLinks,Na),u=l&&c?(l+c)/2:l||c;if(u){var d=(u-Da(i))*t*.3;i.y0+=d,i.y1+=d}}else if(0==a&&1==r)i.y0=e.y1/2-(s=i.y1-i.y0)/2,i.y1=e.y1/2+s/2;else if(a==o-1&&1==r)i.y0=e.y1/2-(s=i.y1-i.y0)/2,i.y1=e.y1/2+s/2;else if(1==i.targetLinks.length&&1==i.targetLinks[0].source.sourceLinks.length)s=i.y1-i.y0,i.y0=i.targetLinks[0].source.y0,i.y1=i.y0+s;else{var h=X(i.sourceLinks,Ba),g=X(i.targetLinks,Na),f=((h&&g?(h+g)/2:h||g)-Da(i))*t;i.y0+=f,i.y1+=f}})})}function u(){a.forEach(function(n){var r,a,s,l=e.y0,c=n.length;for(n.sort(t||Xa),s=0;c>s;++s)(a=l-(r=n[s]).y0)>0&&(r.y0+=a,r.y1+=a),l=r.y1+o;if((a=l-o-e.y1)>0)for(l=r.y0-=a,r.y1-=a,s=c-2;s>=0;--s)(a=(r=n[s]).y1+i-l)>0&&(r.y0-=a,r.y1-=a),l=r.y0})}}function ss(e){e.nodes.forEach(function(e){e.sourceLinks.sort(qa),e.targetLinks.sort(Ga)}),e.nodes.forEach(function(e){var t=e.y0,n=t,o=e.y1,i=o;e.sourceLinks.forEach(function(e){e.circular?(e.y0=o-e.width/2,o-=e.width):(e.y0=t+e.width/2,t+=e.width)}),e.targetLinks.forEach(function(e){e.circular?(e.y1=i-e.width/2,i-=e.width):(e.y1=n+e.width/2,n+=e.width)})})}function ls(){var e=0,t=0,n=1,o=1,i=24,r=8,a=null,s=ns,l=Ha,c=void 0,u=32,d=2,h=os,g=is;function f(){var f={nodes:h.apply(null,arguments),links:g.apply(null,arguments)};return function(h){h.x0=e,h.y0=t,h.x1=n,h.y1=o,h.py=0,function(e,t){e.nodes.forEach(function(e,t){e.index=t,e.sourceLinks=[],e.targetLinks=[]});var n=function(e,t){var n=new Map;return V(e,t).forEach(function(e,t){n.set(t,e[0])}),n}(e.nodes,t);e.links.forEach(function(e,t){e.index=t;var o=e.source,i=e.target;"object"!=typeof o&&(o=e.source=Sa(n,o)),"object"!=typeof i&&(i=e.target=Sa(n,i)),o.sourceLinks.push(e),i.targetLinks.push(e)})}(h,s),function(e,t){var n=0;if(null==t){for(var o=[],i=0;e.links.length>i;i++){var r=e.links[i],a=r.source.index,s=r.target.index;o[a]||(o[a]=[]),o[s]||(o[s]=[]),-1===o[a].indexOf(s)&&o[a].push(s)}var l=Oa(o);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,o=e.source.index;t===o||c[o]&&c[o][t]?(e.circular=!0,e.circularLinkID=n++):e.circular=!1})}else e.links.forEach(function(e){t(e.source)<t(e.target)?e.circular=!1:(e.circular=!0,e.circularLinkID=n++)})}(h,c),function(e,t){var n=0,o=0;e.links.forEach(function(i){i.circular&&(i.circularLinkType=i.source.circularLinkType||i.target.circularLinkType?i.source.circularLinkType?i.source.circularLinkType:i.target.circularLinkType:o>n?"top":"bottom","top"==i.circularLinkType?n++:o++,e.nodes.forEach(function(e){$a(e,t)!=$a(i.source,t)&&$a(e,t)!=$a(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),ja(e,t)&&(e.circularLinkType=e.source.circularLinkType))})}(h,s),function(e){e.nodes.forEach(function(e){e.partOfCycle=!1,e.value=Math.max(q(e.sourceLinks,Ea),q(e.targetLinks,Ea)),e.sourceLinks.forEach(function(t){t.circular&&(e.partOfCycle=!0,e.circularLinkType=t.circularLinkType)}),e.targetLinks.forEach(function(t){t.circular&&(e.partOfCycle=!0,e.circularLinkType=t.circularLinkType)})})}(h),function(e,t,n){var o,i,r;if(null!=t){e.nodes.sort(function(e,n){return t(e)<t(n)?-1:1});var a=0,s=t(e.nodes[0]);e.nodes.forEach(function(e){a=t(e)==s?a:a+1,s=t(e)==s?s:t(e),e.column=a})}for(o=e.nodes,i=[],r=0;o.length;++r,o=i,i=[])o.forEach(function(e){e.depth=r,e.sourceLinks.forEach(function(e){0>i.indexOf(e.target)&&!e.circular&&i.push(e.target)})});for(o=e.nodes,i=[],r=0;o.length;++r,o=i,i=[])o.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?n(e,r):e.column})}(h,c,l);var g=r;if(null!==a){var f=Y(h.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]}),p=G(f,function(e){return e.length});p>1&&(g=Math.max(1,(o-t)*a/(p-1)))}(function(e,t,n){var o=Y(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=z(o,function(t){return(e.y1-e.y0-(t.length-1)*e.py)/q(t,function(e){return e.value})});e.ky=i,e.links.forEach(function(t){t.width=t.value*e.ky});var r=G(e.nodes,function(e){return e.column});e.nodes.forEach(r>0?function(t){t.x0=e.x0+t.column*((e.x1-e.x0-n)/r),t.x1=t.x0+n}:function(t){t.x0=e.x0,t.x1=t.x0+n})})(h,g,i),rs(h,c,s),as(h,c,s,g,g,u),ss(h),Za(h,s,d,10,8),rs(h,c,s),as(h,c,s,g,g,u),ss(h),Za(h,s,d,10,8),function(e,t){let n=e;n.nodes.forEach(function(e){e.y+(e.y1-e.y0)>n.y1&&(e.y=e.y-(e.y+(e.y1-e.y0)-n.y1));var o=n.links.filter(function(n){return $a(n.source,t)==$a(e,t)}),i=o.length;i>1&&o.sort(function(e,t){if(!e.circular&&!t.circular){if(e.target.column==t.target.column)return e.y1-t.y1;if(!Qa(e,t))return e.y1-t.y1;if(e.target.column>t.target.column){var n=Pa(t,e);return e.y1-n}if(t.target.column>e.target.column)return Pa(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;o.forEach(function(e){e.y0=r+e.width/2,r+=e.width}),o.forEach(function(t,n){if("bottom"==t.circularLinkType){for(var r=n+1,a=0;i>r;r++)a+=o[r].width;t.y0=e.y1-a-t.width/2}})})}(h,s),function(e,t){let n=e;n.nodes.forEach(function(e){var o=n.links.filter(function(n){return $a(n.target,t)==$a(e,t)}),i=o.length;i>1&&o.sort(function(e,t){if(!e.circular&&!t.circular){if(e.source.column==t.source.column)return e.y0-t.y0;if(!Qa(e,t))return e.y0-t.y0;if(e.source.column>t.source.column){var n=La(t,e);return e.y0-n}if(t.source.column>e.source.column)return La(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;o.forEach(function(e){e.y1=r+e.width/2,r+=e.width}),o.forEach(function(t,n){if("bottom"==t.circularLinkType){for(var r=n+1,a=0;i>r;r++)a+=o[r].width;t.y1=e.y1-a-t.width/2}})})}(h,s),function(e){var t=e.nodes,n=e.links,o=!1,i=!1;if(n.forEach(function(e){"top"==e.circularLinkType?o=!0:"bottom"==e.circularLinkType&&(i=!0)}),0==o||0==i){var r=z(t,function(e){return e.y0}),a=G(t,function(e){return e.y1}),s=(e.y1-e.y0)/(a-r);function l(t){return(t-r)/(a-r)*(e.y1-e.y0)+e.y0}1>s?(t.forEach(function(e){e.y0=l(e.y0),e.y1=l(e.y1)}),n.forEach(function(e){e.y0=l(e.y0),e.y1=l(e.y1),e.width=e.width*s})):t.forEach(function(e){var t=e.y1-e.y0,n=l(e.y0)-e.y0;e.y0=l(e.y0),e.y1=e.y0+t,e.sourceLinks.forEach(function(e){e.y0=e.y0+n}),e.targetLinks.forEach(function(e){e.y1=e.y1+n})})}}(h),Za(h,s,d,10,8)}(f),f}return f.update=function(e){return ss(e),Za(e,s,d,10,8),e},f.nodeWidth=function(e){return arguments.length?(i=+e,f):i},f.nodePadding=function(e){return arguments.length?(r=+e,f):r},f.nodePaddingRatio=function(e){return arguments.length?(a=+e,f):a},f.nodes=function(e){return arguments.length?(h="function"==typeof e?e:ts(e),f):h},f.links=function(e){return arguments.length?(g="function"==typeof e?e:ts(e),f):g},f.nodeId=function(e){return arguments.length?(s="function"==typeof e?e:ts(e),f):s},f.nodeAlign=function(e){return arguments.length?(l="function"==typeof e?e:ts(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(i){return arguments.length?(e=+i[0][0],t=+i[0][1],n=+i[1][0],o=+i[1][1],f):[[e,t],[n,o]]},f.size=function(i){return arguments.length?(e=t=0,n=+i[0],o=+i[1],f):[n-e,o-t]},f}function cs(e){const{sx:t,sTop:n,sBot:o,tx:i,tTop:r,tBot:a,cp1X:s,cp2X:l}=e,c=(n+o)/2,u=(r+a)/2;return{pathD:[`M${t},${n}`,`C${s},${n} ${l},${r} ${i},${r}`,`L${i},${a}`,`C${l},${a} ${s},${o} ${t},${o}`,"Z"].join(" "),bezier:{circular:!1,points:[{x:t,y:c},{x:s,y:c},{x:l,y:u},{x:i,y:u}],halfWidth:(o-n)/2}}}const us=e=>{let t,n,o,i,r,a,s,l,c;if("down"===e.direction)return t=e.y0-e.sankeyWidth/2,n=e.y1-e.sankeyWidth/2,o=e.y1+e.sankeyWidth/2,i=e.y0+e.sankeyWidth/2,r=e.source.x1,a=e.target.x0,s=ie(r,a),l=s(.5),c=s(.5),`M${t},${r}C${t},${l} ${n},${c} ${n},${a}L${o},${a}C${o},${c} ${i},${l} ${i},${r}Z`;const u=e.sankeyWidth/2,d=ie(e.source.x1,e.target.x0),{pathD:h}=cs({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 ds(e){var t;const n=e.sankeyWidth/2,o=(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,o=i.sourceY,r=i.targetX,a=i.targetY;if("object"!=typeof e.source||!e.source||"object"!=typeof e.target||!e.target)return null;const s=Math.max(15,Math.min(40,.33*(i.rightFullExtent-t))),l=Math.max(15,Math.min(40,.33*(r-i.leftFullExtent)));return`M${t},${o-n}L${t+s},${o-n}L${t+s},${o+n}L${t},${o+n}ZM${r},${a-n}L${r-l},${a-n}L${r-l},${a+n}L${r},${a+n}Z`}const r=i.sourceX,a=i.sourceY,s=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(o,15));return`M${r},${a-h*n}L${c},${a-h*n}L${c+o},${a-h*n+h*g}L${c+o},${d+h*o-h*g}L${c+o-g},${d+h*o}L${u-o+g},${d+h*o}L${u-o},${d+h*o-h*g}L${u-o},${l-h*n+h*g}L${u-o+g},${l-h*n}L${s},${l-h*n}L${s},${l+h*n}L${u+o},${l+h*n}L${u+o},${d-h*o}L${c-o},${d-h*o}L${c-o},${a+h*n}L${r},${a+h*n}Z`}const hs=new Set,gs=new WeakMap;function fs(e,t){if("production"===process.env.NODE_ENV)return e;if(!e||!e.data||"object"!=typeof e.data)return e;let n=gs.get(e);if(n){const e=n.get(t);if(e)return e}else n=new Map,gs.set(e,n);const o=new Proxy(e,{get(e,n,o){if("string"==typeof n&&!(n in e)&&e.data&&n in e.data){const e=`${t}:${n}`;hs.has(e)||(hs.add(e),console.warn(`[Semiotic] "${t}" callback accessed "${n}" on the wrapper object, but it only exists on ".data". Use d.data.${n} (or d.data?.${n}) instead. Frame callbacks receive RealtimeNode/RealtimeEdge wrappers, not your raw data.`))}return Reflect.get(e,n,o)}});return n.set(t,o),o}const ps={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(Ra))-1:0},justify:Ha};function ys(e){return"string"==typeof e?e:e.id}const ms={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,n,o){var i,r,a,s,l,c,u;if(0===e.length)return;const d="vertical"===n.orientation?"down":"right",h=n.nodeAlign||"justify",g=null!==(i=n.nodeWidth)&&void 0!==i?i:15,f=null!==(r=n.nodePaddingRatio)&&void 0!==r?r:.05,p=null!==(a=n.iterations)&&void 0!==a?a: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],[o[1],o[0]]]:[[0,0],[o[0],o[1]]];const b=ls().extent(v).links(m).nodes(y).nodeAlign(ps[h]||Ha).nodeId(e=>e.id).nodeWidth(g).iterations(p);b.nodePaddingRatio&&b.nodePaddingRatio(f),b();{let e=1/0,t=-1/0,n=1/0,i=-1/0;for(const o of y)e>o.x0&&(e=o.x0),o.x1>t&&(t=o.x1),n>o.y0&&(n=o.y0),o.y1>i&&(i=o.y1);for(const o of m){if(!o.circular||!o.circularPathData)continue;const r=o.circularPathData,a=(null!==(l=null!==(s=o._circularWidth)&&void 0!==s?s:o.width)&&void 0!==l?l:0)/2;e>r.leftFullExtent-a&&(e=r.leftFullExtent-a),r.rightFullExtent+a>t&&(t=r.rightFullExtent+a),n>r.verticalFullExtent-a&&(n=r.verticalFullExtent-a),r.verticalFullExtent+a>i&&(i=r.verticalFullExtent+a)}const r=t-e,a=i-n,u=o[0],d=o[1];if(r>0&&a>0&&(0>e||0>n||t>u||i>d)){const t=Math.min(u/r,d/a),o=-e*t+(u-r*t)/2,i=-n*t+(d-a*t)/2;for(const e of y)e.x0=e.x0*t+o,e.x1=e.x1*t+o,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 n=e.circularPathData;n.sourceX=n.sourceX*t+o,n.targetX=n.targetX*t+o,n.sourceY=n.sourceY*t+i,n.targetY=n.targetY*t+i,n.rightFullExtent=n.rightFullExtent*t+o,n.leftFullExtent=n.leftFullExtent*t+o,n.verticalFullExtent=n.verticalFullExtent*t+i,n.rightInnerExtent=n.rightInnerExtent*t+o,n.leftInnerExtent=n.leftInnerExtent*t+o,n.verticalRightInnerExtent=n.verticalRightInnerExtent*t+i,n.verticalLeftInnerExtent=n.verticalLeftInnerExtent*t+i,n.rightSmallArcRadius*=t,n.rightLargeArcRadius*=t,n.leftSmallArcRadius*=t,n.leftLargeArcRadius*=t,n.sourceWidth*=t,n.rightNodeBuffer*=t,n.leftNodeBuffer*=t,n.arcRadius*=t}}}const x=new Map;for(const t of e)x.set(t.id,t);for(const e of 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=ys(e.source),n=ys(e.target),o=k.get(e._edgeKey?e._edgeKey:`${t}\0${n}`);if(o){o.y0=e.y0,o.y1=e.y1,o.sankeyWidth=null!==(u=e.width)&&void 0!==u?u:0,o.circular=!!e.circular,o.circularPathData=e.circularPathData,o._circularWidth=e._circularWidth,o._circularStub=e._circularStub,o.path=e.path,o.circularLinkType=e.circularLinkType,o.direction=d;const i=x.get(t),r=x.get(n);i&&(o.source=i),r&&(o.target=r)}}},buildScene(e,t,n,o){var i,r,a,s,l,c;const u="vertical"===n.orientation?"down":"right",d=n.nodeStyle,h=n.edgeStyle,g=null!==(i=n.edgeOpacity)&&void 0!==i?i:.5,f=n.edgeColorBy||"source",p=Array.isArray(n.colorScheme)?n.colorScheme:n.themeCategorical&&n.themeCategorical.length>0?n.themeCategorical:qe,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,n=t.y1-t.y0;if(0>=e||0>=n)continue;const o=d?d(fs(t,"nodeStyle")):{},i={fill:o.fill||y.get(t.id)||"#4d430c",stroke:o.stroke,strokeWidth:o.strokeWidth,opacity:o.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:n,h:e,style:i,datum:t,id:t.id,label:t.id}:{type:"rect",x:t.x0,y:t.y0,w:e,h:n,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,o="object"==typeof e.target?e.target:null;if(!t||!o)continue;let i=(null===(r=n.themeSemantic)||void 0===r?void 0:r.border)||(null===(a=n.themeSemantic)||void 0===a?void 0:a.secondary)||"#999";i="function"==typeof f?f(e)||i:"target"===f?x.get(o.id)||y.get(o.id)||i:x.get(t.id)||y.get(t.id)||i;const u=h?h(fs(e,"edgeStyle")):{};if(e._circularStub&&e.circular&&e.circularPathData){const t=e.circularPathData,n=e.sankeyWidth/2,o=Math.max(15,Math.min(40,.33*(t.rightFullExtent-t.sourceX))),r=Math.max(15,Math.min(40,.33*(t.targetX-t.leftFullExtent))),a=u.fill||i;v.push({type:"bezier",pathD:`M${t.sourceX},${t.sourceY-n}L${t.sourceX+o},${t.sourceY-n}L${t.sourceX+o},${t.sourceY+n}L${t.sourceX},${t.sourceY+n}Z`,style:{fill:a,fillOpacity:null!==(s=u.fillOpacity)&&void 0!==s?s:g,stroke:"none",opacity:u.opacity},datum:e,_gradient:{direction:"right",from:1,to:0,x0:t.sourceX,x1:t.sourceX+o}}),v.push({type:"bezier",pathD:`M${t.targetX},${t.targetY-n}L${t.targetX-r},${t.targetY-n}L${t.targetX-r},${t.targetY+n}L${t.targetX},${t.targetY+n}Z`,style:{fill:a,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?ds(e):us(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!==n.showLabels){const t=(w=n.nodeLabel)?"function"==typeof w?w:e=>e[w]||e.id:null;for(const n of e){const e=n.x1-n.x0,i=n.y1-n.y0;if(0>=e||0>=i)continue;const r=t?t(n):n.id;if(!r)continue;let a,s,l;"down"===u?(a=n.y0+(n.y1-n.y0)/2,s=n.x1+14,l="start"):(o[0]/2>n.x0+e/2?(a=n.x0-6,l="end"):(a=n.x1+6,l="start"),s=n.y0+i/2),b.push({x:a,y:s,text:r+"",anchor:"down"===u?"middle":l,baseline:"middle",fontSize:11})}}var w;return{sceneNodes:m,sceneEdges:v,labels:b}}},vs={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,n,o){var i,r;if(0===e.length)return;const a=null!==(i=n.forceStrength)&&void 0!==i?i:.1,s=o[0]/2,l=o[1]/2,c=n.__previousPositions;let u=0;const d=[];for(const t of e){const e=null!=t.x&&null!=t.y&&(0!==t.x||0!==t.y),n=null==c?void 0:c.get(t.id);e?u++:n?(t.x=n.x,t.y=n.y,u++):d.push(t)}const h=u>0&&.3>=(e.length>0?d.length/e.length:1);if(h){const n=new Map;for(const t of e)n.set(t.id,t);for(const e of d){const o=bs(e.id,t,n);if(o.length>0){let t=0,n=0;for(const e of o)t+=e.x,n+=e.y;const i=xs(e.id),r=i%360*(Math.PI/180),a=10+i%20;e.x=t/o.length+a*Math.cos(r),e.y=n/o.length+a*Math.sin(r)}else{const t=xs(e.id),n=t%360*(Math.PI/180),o=15+t%30;e.x=s+o*Math.cos(n),e.y=l+o*Math.sin(n)}}}else{const t=2.399963229728653;for(let n=0;e.length>n;n++){const o=e[n];if(null==o.x||null==o.y||0===o.x&&0===o.y){const e=10*Math.sqrt(n+.5),i=n*t;o.x=s+e*Math.cos(i),o.y=l+e*Math.sin(i)}}}const g=null!==(r=n.iterations)&&void 0!==r?r:Math.max(50,Math.min(300,Math.floor(300-2*(e.length-30)))),f=0===n.iterations?0:h?40:g,p=ks(n.nodeSize,n.nodeSizeRange,e),y=e=>p(e);if(f>0){const n=re().strength(e=>{const t=e.weight;return Math.min(2.5,t?t*a:a)}).id(e=>e.id),o=ae().force("charge",se().strength(e=>-25*y(e))).force("center",le(s,l).strength(.8)).force("x",ce(s).strength(.15)).force("y",ue(l).strength(.15));if(o.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}));n.links(e),o.force("link",n)}h?o.alpha(.3):.1>o.alpha()&&o.alpha(1),o.stop();for(let e=0;f>e;++e)o.tick()}for(const t of e){if(null==t.x||null==t.y)continue;const e=y(t);t.x=Math.max(e,Math.min(o[0]-e,t.x)),t.y=Math.max(e,Math.min(o[1]-e,t.y)),t.x0=0,t.x1=0,t.y0=0,t.y1=0}const m=new Map;for(const t of e)m.set(t.id,t);for(const e of t){if("string"==typeof e.source){const t=m.get(e.source);t&&(e.source=t)}if("string"==typeof e.target){const t=m.get(e.target);t&&(e.target=t)}}},buildScene(e,t,n,o){var i,r,a,s,l,c,u;const d=n.nodeStyle,h=n.edgeStyle,g=ks(n.nodeSize,n.nodeSizeRange,e),f=Array.isArray(n.colorScheme)?n.colorScheme:n.themeCategorical&&n.themeCategorical.length>0?n.themeCategorical:qe,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(fs(t,"nodeSize")),o=d?d(fs(t,"nodeStyle")):{},s={fill:o.fill||p.get(t.id)||(null===(i=n.themeSemantic)||void 0===i?void 0:i.primary)||"#007bff",stroke:o.stroke||(null===(r=n.themeSemantic)||void 0===r?void 0:r.surface)||"#fff",strokeWidth:null!==(a=o.strokeWidth)&&void 0!==a?a:2,opacity:o.opacity};y.push({type:"circle",cx:t.x,cy:t.y,r:e,style:s,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),o="object"==typeof e.target?e.target:b.get(e.target);if(!t||!o)continue;if(null==t.x||null==t.y)continue;if(null==o.x||null==o.y)continue;const i=h?h(fs(e,"edgeStyle")):{},r={stroke:i.stroke||(null===(s=n.themeSemantic)||void 0===s?void 0:s.border)||(null===(l=n.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:o.x,y2:o.y,style:r,datum:e})}if(!1!==n.showLabels){const t=(x=n.nodeLabel)?"function"==typeof x?x:e=>e[x]||e.id:null;for(const n of e){if(null==n.x||null==n.y)continue;const e=t?t(n):n.id;if(!e)continue;const o=g(fs(n,"nodeSize"));v.push({x:n.x,y:n.y-o-4,text:e+"",anchor:"middle",baseline:"auto",fontSize:11})}}var x;return{sceneNodes:y,sceneEdges:m,labels:v}}};function bs(e,t,n){const o=[];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 a=null;if(t===e?a=r:r===e&&(a=t),a){const e=n.get(a);!e||0===e.x&&0===e.y||o.push({x:e.x,y:e.y})}}return o}function xs(e){let t=0;for(let n=0;e.length>n;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return Math.abs(t)}function ks(e,t,n){var o,i;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],a=n.map(t=>{var n;return null===(n=t.data)||void 0===n?void 0:n[e]}).filter(e=>null!=e&&"number"==typeof e);if(0===a.length)return()=>r[0];const s=null!==(o=z(a))&&void 0!==o?o:0,l=null!==(i=G(a))&&void 0!==i?i:1;if(s===l)return()=>(r[0]+r[1])/2;const c=k().domain([s,l]).range(r).clamp(!0);return t=>{var n;const o=null===(n=t.data)||void 0===n?void 0:n[e];return null==o||"number"!=typeof o?r[0]:c(o)}}const ws=qe,As={supportsStreaming:!1,hierarchical:!1,computeLayout(e,t,n,o){if(0===e.length)return;const{padAngle:i=.01,groupWidth:r=20,sortGroups:a}=n,s=Math.min(o[0],o[1])/2,l=s-r,c=o[0]/2,u=o[1]/2,d=(h=n.valueAccessor)?"function"==typeof h?h:e=>{var t;return null!==(t=e[h])&&void 0!==t?t:1}:e=>{var t;return null!==(t=e.value)&&void 0!==t?t:1};var h;const g=new Map;for(let t=0;e.length>t;t++)g.set(e[t].id,t);const f=e.length,p=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,n=g.get("string"==typeof e.source?e.source:e.source.id),o=g.get(t);if(void 0===n||void 0===o)continue;const i=d(e);p[n][o]=i}const y=he().padAngle(i);a&&y.sortGroups(a);const m=y(p),v=m.groups,b=R().innerRadius(l).outerRadius(s);for(const t of v){const n=e[t.index],o=b.centroid({innerRadius:l,outerRadius:s,startAngle:t.startAngle,endAngle:t.endAngle});n.x=o[0]+c,n.y=o[1]+u,n.__arcData={startAngle:t.startAngle,endAngle:t.endAngle}}const x=new Map;for(const t of e)x.set(t.id,t);for(const e of t){const t="string"==typeof e.target?e.target:e.target.id,n=x.get("string"==typeof e.source?e.source:e.source.id),o=x.get(t);n&&(e.source=n),o&&(e.target=o)}const 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 m){const n=e[t.source.index].id,o=e[t.target.index].id,i=k.get(`${n}\0${o}`)||k.get(`${o}\0${n}`);i&&(i.__chordData=t)}},buildScene(e,t,n,o){var i,r,a,s;const{groupWidth:l=20,edgeOpacity:c=.5}=n,u=Math.min(o[0],o[1])/2,d=u-l,h=o[0]/2,g=o[1]/2,f=n.nodeStyle,p=n.edgeStyle,y=n.edgeColorBy||"source",m=Array.isArray(n.colorScheme)?n.colorScheme:n.themeCategorical&&n.themeCategorical.length>0?n.themeCategorical:ws,v=new Map;e.forEach((e,t)=>{v.set(e.id,m[t%m.length])});const b=de().radius(d),x=[],k=[],w=[];for(let t=0;e.length>t;t++){const n=e[t],o=n.__arcData;if(!o)continue;let r;r=f?f(fs(n,"nodeStyle")).fill||v.get(n.id)||m[t%m.length]:v.get(n.id)||m[t%m.length];const a=f?f(fs(n,"nodeStyle")):{},s={fill:r,stroke:a.stroke||"black",strokeWidth:null!==(i=a.strokeWidth)&&void 0!==i?i:1,opacity:a.opacity};x.push({type:"arc",cx:h,cy:g,innerR:d,outerR:u,startAngle:o.startAngle-Math.PI/2,endAngle:o.endAngle-Math.PI/2,style:s,datum:n,id:n.id,label:n.id})}for(const e of t){const t=e.__chordData;if(!t)continue;const o=b(t);if(!o)continue;const i=Ss(o,h,g);let l=(null===(r=n.themeSemantic)||void 0===r?void 0:r.border)||(null===(a=n.themeSemantic)||void 0===a?void 0:a.secondary)||"#999";if(p)l=p(fs(e,"edgeStyle")).fill||l;else{const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;"target"===y&&n?l=v.get(n.id)||l:t&&(l=v.get(t.id)||l)}const u=p?p(fs(e,"edgeStyle")):{},d={fill:l,fillOpacity:null!==(s=u.fillOpacity)&&void 0!==s?s:c,stroke:u.stroke||"none",strokeWidth:u.strokeWidth,opacity:u.opacity};k.push({type:"ribbon",pathD:i,style:d,datum:e})}if(!1!==n.showLabels){const t=(A=n.nodeLabel)?"function"==typeof A?A:e=>e[A]||e.id:null,o=u+12;for(const n of e){const e=n.__arcData;if(!e)continue;const i=t?t(n):n.id;if(!i)continue;const r=(e.startAngle+e.endAngle)/2,a=r-Math.PI/2;w.push({x:h+Math.cos(a)*o,y:g+Math.sin(a)*o,text:i+"",anchor:r>Math.PI?"end":"start",baseline:"middle",fontSize:11})}}var A;return{sceneNodes:x,sceneEdges:k,labels:w}}};function Ss(e,t,n){const o=e.match(/[a-zA-Z]|[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?/g);if(!o)return e;const i=[];let r=0;for(;o.length>r;){const e=o[r];if("M"===e||"L"===e)for(i.push(e),r++;o.length>r&&!isNaN(Number(o[r]));)i.push(Number(o[r])+t+""),r++,o.length>r&&!isNaN(Number(o[r]))&&(i.push(Number(o[r])+n+""),r++);else if("C"===e)for(i.push(e),r++;o.length>r&&!isNaN(Number(o[r]));)for(let e=0;3>e&&o.length>r&&!isNaN(Number(o[r]));e++)i.push(Number(o[r])+t+""),r++,o.length>r&&!isNaN(Number(o[r]))&&(i.push(Number(o[r])+n+""),r++);else if("Q"===e)for(i.push(e),r++;o.length>r&&!isNaN(Number(o[r]));)for(let e=0;2>e&&o.length>r&&!isNaN(Number(o[r]));e++)i.push(Number(o[r])+t+""),r++,o.length>r&&!isNaN(Number(o[r]))&&(i.push(Number(o[r])+n+""),r++);else if("A"===e)for(i.push(e),r++;o.length>r&&!isNaN(Number(o[r]));)i.push(o[r++]),o.length>r&&i.push(o[r++]),o.length>r&&i.push(o[r++]),o.length>r&&i.push(o[r++]),o.length>r&&i.push(o[r++]),o.length>r&&(i.push(Number(o[r])+t+""),r++),o.length>r&&(i.push(Number(o[r])+n+""),r++);else"Z"===e||"z"===e?(i.push(e),r++):(i.push(o[r]),r++)}return i.join(" ")}const Os=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];function Cs(e){const[t,n,o]=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*n+.114*o>150?"#222":"#fff"}function js(e,t,n){const o=t.nodeIDAccessor;return"function"==typeof o?o(e.data)+"":"string"==typeof o&&void 0!==e.data[o]?e.data[o]+"":void 0!==e.data.name?e.data.name+"":void 0!==e.data.id?e.data.id+"":"node-"+n}function Ms(e){return e?"function"==typeof e?e:t=>{var n;return(null===(n=t.data)||void 0===n?void 0:n[e])||t[e]||t.id}:null}function _s(e){return Array.isArray(e.colorScheme)?e.colorScheme:e.themeCategorical&&e.themeCategorical.length>0?e.themeCategorical:Os}function Ps(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 Ls(e,t,n,o,i){if("horizontal"===i){const i=(e+n)/2;return`M ${e},${t} C ${i},${t} ${i},${o} ${n},${o}`}if("radial"===i){const i=(e+n)/2;return`M ${e},${t} Q ${i},${t} ${i},${(t+o)/2} T ${n},${o}`}{const i=(t+o)/2;return`M ${e},${t} C ${e},${i} ${n},${i} ${n},${o}`}}const Ts={supportsStreaming:!1,hierarchical:!0,computeLayout(e,t,n,o){var i;const r=n.__hierarchyRoot;if(!r)return;const a=n.chartType,s=function(e){if(e)return"function"==typeof e?e:t=>t[e]}(n.childrenAccessor),l=n.hierarchySum,c="function"==typeof l?l:"string"==typeof l?e=>Number(e[l])||0:e=>Number(e.value)||0,u=Q(r,s);u.sum(c),u.sort((e,t)=>{var n,o;return(null!==(n=t.value)&&void 0!==n?n:0)-(null!==(o=e.value)&&void 0!==o?o:0)});const[d,h]=o;switch(a){case"tree":!function(e,t,n,o){const i=t.treeOrientation||"vertical",r=ne();r.size("horizontal"===i?[o,n]:"radial"===i?[2*Math.PI,Math.min(n,o)/2*.8]:[n,o]),r(e)}(u,n,d,h);break;case"cluster":!function(e,t,n,o){const i=t.treeOrientation||"vertical",r=te();r.size("horizontal"===i?[o,n]:"radial"===i?[2*Math.PI,Math.min(n,o)/2*.8]:[n,o]),r(e)}(u,n,d,h);break;case"treemap":!function(e,t,n,o){var i,r;const a=null!==(i=t.padding)&&void 0!==i?i:4,s=null!==(r=t.paddingTop)&&void 0!==r?r:0,l=J().size([n,o]).tile(ee).padding(a);s>0&&l.paddingTop(s),l(e)}(u,n,d,h);break;case"circlepack":!function(e,t,n,o){var i;const r=null!==(i=t.padding)&&void 0!==i?i:4;Z().size([n,o]).padding(r)(e)}(u,n,d,h);break;case"partition":!function(e,t,n,o){var i;K().size([n,o]).padding(null!==(i=t.padding)&&void 0!==i?i:1)(e)}(u,n,d,h)}const g=u.descendants();e.length=0,t.length=0;const f=new Map;for(let t=0;g.length>t;t++){const o=g[t],r={id:js(o,n,t),x:0,y:0,x0:0,x1:0,y0:0,y1:0,width:0,height:0,value:null!==(i=o.value)&&void 0!==i?i:0,depth:o.depth,data:o.data,createdByFrame:!0};"tree"===a||"cluster"===a?$s(r,o,n):"treemap"===a||"partition"===a?Ns(r,o):"circlepack"===a&&Bs(r,o),r.__hierarchyNode=o,e.push(r),f.set(o,r)}if("tree"===a||"cluster"===a)for(const e of g)if(e.parent){const n=f.get(e.parent),o=f.get(e);n&&o&&t.push({source:n,target:o,value:1,y0:0,y1:0,sankeyWidth:0,data:{depth:e.depth}})}},buildScene(e,t,n,o){const i=n.nodeStyle||(()=>({})),r=n.edgeStyle||(()=>({}));switch(n.chartType){case"tree":case"cluster":return function(e,t,n,o,i,r){var a,s,l,c,u,d,h,g;const f=[],p=[],y=[],m=n.treeOrientation||"vertical",v="radial"===m,b=o[0]/2,x=o[1]/2,k="number"==typeof(w=n.nodeSize)?w:5;var w;for(const t of e){let e=t.x,o=t.y;v&&(e+=b,o+=x);const r=i(fs(t,"nodeStyle"));let l=r.fill||Ps(n);if(n.colorByDepth&&void 0!==t.depth){const e=_s(n);l=e[t.depth%e.length]}const c={fill:l,stroke:r.stroke||(null===(a=n.themeSemantic)||void 0===a?void 0:a.surface)||"#fff",strokeWidth:null!==(s=r.strokeWidth)&&void 0!==s?s:1,opacity:r.opacity};f.push({type:"circle",cx:e,cy:o,r:k,style:c,datum:t,id:t.id,label:t.id,depth:t.depth})}const A=null!==(l=n.edgeOpacity)&&void 0!==l?l:.5;for(const e of t){const t="object"==typeof e.source?e.source:null,o="object"==typeof e.target?e.target:null;if(!t||!o)continue;let i=t.x,a=t.y,s=o.x,l=o.y;v&&(i+=b,a+=x,s+=b,l+=x);const g=Ls(i,a,s,l,m),f=r(fs(e,"edgeStyle")),y={fill:"none",stroke:f.stroke||(null===(c=n.themeSemantic)||void 0===c?void 0:c.border)||(null===(u=n.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!==n.showLabels){const t=Ms(n.nodeLabel);for(const n of e){const e=t?t(n):n.id;if(!e)continue;let o,i,r,a=n.x,s=n.y;if(v&&(a+=b,s+=x),v){const e=a-b,t=s-x,n=Math.sqrt(e*e+t*t);n>0?(o=a+e/n*10,i=s+t/n*10,r=0>e?"end":"start"):(o=a,i=s-12,r="middle")}else"horizontal"===m?((null===(g=n.data)||void 0===g?void 0:g.children)&&0!==n.data.children.length?(o=a-k-6,r="end"):(o=a+k+6,r="start"),i=s):(o=a,i=s+k+14,r="middle");y.push({x:o,y:i,text:e+"",anchor:r,baseline:"middle",fontSize:11})}}return{sceneNodes:f,sceneEdges:p,labels:y}}(e,t,n,o,i,r);case"treemap":case"partition":return function(e,t,n,o){var i,r,a,s,l;const c=[],u=[];for(const n of e){const e=n.x1-n.x0,a=n.y1-n.y0;if(0>=e||0>=a)continue;const s=o(fs(n,"nodeStyle"));let l=s.fill||Ps(t);if(t.colorByDepth&&void 0!==n.depth){const e=_s(t);l=e[n.depth%e.length]}const u={fill:l,stroke:s.stroke||(null===(i=t.themeSemantic)||void 0===i?void 0:i.surface)||"#fff",strokeWidth:null!==(r=s.strokeWidth)&&void 0!==r?r:1,opacity:s.opacity};c.push({type:"rect",x:n.x0,y:n.y0,w:e,h:a,style:u,datum:n,id:n.id,label:n.id,depth:n.depth})}if(!1!==t.showLabels){const n=Ms(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===(a=c.data)||void 0===a?void 0:a.children)&&c.data.children.length>0);if(!r){if("leaf"===i&&!h)continue;if("parent"===i&&h)continue}const g=n?n(c):c.id;if(!g)continue;if((h?30:40)>e||(h?16:14)>d)continue;let f=o(fs(c,"nodeStyle")).fill||Ps(t);if(t.colorByDepth&&void 0!==c.depth){const e=_s(t);f=e[c.depth%e.length]}const p="string"==typeof f?Cs(f):null!==(l=null===(s=t.themeSemantic)||void 0===s?void 0:s.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,n,0,i);case"circlepack":return function(e,t,n,o){var i,r,a,s,l,c,u,d,h,g;const f=[],p=[];for(const n of e){const e=null!==(i=n.__radius)&&void 0!==i?i:5;if(0>=e)continue;const l=o(fs(n,"nodeStyle"));let c=l.fill||Ps(t);if(t.colorByDepth&&void 0!==n.depth){const e=_s(t);c=e[n.depth%e.length]}const u={fill:c,stroke:l.stroke||(null===(r=t.themeSemantic)||void 0===r?void 0:r.surface)||"#fff",strokeWidth:null!==(a=l.strokeWidth)&&void 0!==a?a:1,opacity:null!==(s=l.opacity)&&void 0!==s?s:.7};f.push({type:"circle",cx:n.x,cy:n.y,r:e,style:u,datum:n,id:n.id,label:n.id,depth:n.depth})}if(!1!==t.showLabels){const n=Ms(t.nodeLabel);for(const i of e){const e=null!==(l=i.__radius)&&void 0!==l?l:5,r=n?n(i):i.id;if(!r)continue;if(15>e)continue;const a=!((null===(c=i.data)||void 0===c?void 0:c.children)&&i.data.children.length>0);let s=o(fs(i,"nodeStyle")).fill||Ps(t);if(t.colorByDepth&&void 0!==i.depth){const e=_s(t);s=e[i.depth%e.length]}if(a){const n="string"==typeof s?Cs(s):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:n})}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,n,0,i);default:return{sceneNodes:[],sceneEdges:[],labels:[]}}}};function $s(e,t,n){const o=n.treeOrientation||"vertical";if("radial"===o){const n=t.x,o=t.y;e.x=o*Math.cos(n-Math.PI/2),e.y=o*Math.sin(n-Math.PI/2)}else"horizontal"===o?(e.x=t.y,e.y=t.x):(e.x=t.x,e.y=t.y);e.x0=e.x-5,e.x1=e.x+5,e.y0=e.y-5,e.y1=e.y+5,e.width=10,e.height=10}function Ns(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 Bs(e,t){var n;const o=null!==(n=t.r)&&void 0!==n?n:0;e.x=t.x,e.y=t.y,e.x0=t.x-o,e.x1=t.x+o,e.y0=t.y-o,e.y1=t.y+o,e.width=2*o,e.height=2*o,e.__radius=o}function Ds(e){let t=e.__orbitState;return t||(t={metaMap:new Map,startTime:"undefined"!=typeof performance?performance.now():Date.now()},e.__orbitState=t),t}const Es={supportsStreaming:!1,hierarchical:!0,supportsAnimation:!0,computeLayout(e,t,n,o){const i=n.__hierarchyRoot;i&&function(e,t,n,o,i){var r,a;const s=function(e){if("function"==typeof e)return e;const t=e||"children";return e=>e[t]||null}(n.childrenAccessor),l=function(e){if("function"==typeof e)return e;const t=e||"name";return e=>{var n;return(null!==(n=e[t])&&void 0!==n?n:"")+""}}(n.nodeIDAccessor),c=function(e){if(Array.isArray(e))return e;switch(e){case"solar":return[1];case"atomic":return[2,8];default:return[9999]}}(n.orbitMode),u=null!==(r=n.orbitSize)&&void 0!==r?r:2.95,d=null!==(a=n.orbitEccentricity)&&void 0!==a?a:1,h="number"==typeof u?()=>u:u,g="number"==typeof d?()=>d:d,f=Ds(n);f.metaMap.clear(),o.length=0,i.length=0;const p=new Map;function y(e){var t;const n=null!==(t=p.get(e))&&void 0!==t?t:0;return p.set(e,n+1),0===n?e:`${e}__${n}`}const m=t[0]/2,v=t[1]/2,b=Math.min(t[0],t[1])/2*.85,x=y(l(e));o.push({id:x,x:m,y:v,x0:m,x1:m,y0:v,y1:v,width:0,height:0,value:0,depth:0,data:e}),f.metaMap.set(x,{ring:b,angle:0,depth:0,parentId:null,eccentricity:1}),function e(t,n,r,a,u,d,p){const m=s(t);if(!(null==m?void 0:m.length))return;const v=m.length;let b=0,x=0,k=0;for(;v>x;)x+=c[Math.min(k,c.length-1)],k++,b++;let w=0;for(let v=0;b>v;v++){const x=c[Math.min(v,c.length-1)],k=m.slice(w,w+x);if(!k.length)break;const A=(v+1)/b,S={id:n,depth:d,data:t,parentId:n},O=p?u/h(S)*A:u*A,C=H().value(e=>{var t;return(null===(t=s(e))||void 0===t?void 0:t.length)?4:1}).sort(null),j=C(k),M=g(S);for(let t=0;k.length>t;t++){const s=(j[t].startAngle+j[t].endAngle)/2,c=k[t],u=y(l(c)),h=r+O*Math.sin(s),g=a+O*Math.cos(s)*M;o.push({id:u,x:h,y:g,x0:h,x1:h,y0:g,y1:g,width:0,height:0,value:0,depth:d,data:c}),f.metaMap.set(u,{ring:O,angle:s,depth:d,parentId:n,eccentricity:M}),i.push({source:n,target:u,value:1,y0:0,y1:0,sankeyWidth:0,data:{source:n,target:u}}),e(c,u,h,g,O,d+1,!0)}w+=x}}(e,x,m,v,b,1,!1)}(i,o,n,e,t)},buildScene(e,t,n,o){var i,r,a,s,l,c,u;const d=n.nodeStyle,h=n.nodeSize,g="number"==typeof h?()=>h:"function"==typeof h?h:()=>6,f=[],p=[],y=[];if(!1!==n.orbitShowRings){const t=Ds(n),o=new Map;for(const t of e)o.set(t.id,t);const i=new Map;for(const[,e]of t.metaMap){if(!e.parentId)continue;const t=o.get(e.parentId);if(!t)continue;const n=`${e.parentId}:${e.ring}`;i.has(n)||i.set(n,{parentX:t.x,parentY:t.y,ring:e.ring,ecc:e.eccentricity})}const r=48,a={stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1};for(const[,{parentX:e,parentY:t,ring:n,ecc:o}]of i)for(let i=0;r>i;i++){const s=i/r*Math.PI*2,l=(i+1)/r*Math.PI*2;p.push({type:"line",x1:e+n*Math.sin(s),y1:t+n*Math.cos(s)*o,x2:e+n*Math.sin(l),y2:t+n*Math.cos(l)*o,style:a,datum:null})}}for(const t of e){if(null==t.x||null==t.y)continue;const e=g(fs(t,"nodeSize")),o=d?d(fs(t,"nodeStyle")):{},c={fill:o.fill||(null===(i=n.themeSemantic)||void 0===i?void 0:i.primary)||"#6366f1",stroke:o.stroke||(null===(r=n.themeSemantic)||void 0===r?void 0:r.surface)||"#fff",strokeWidth:null!==(a=o.strokeWidth)&&void 0!==a?a:1,opacity:null!==(s=o.opacity)&&void 0!==s?s: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),n="object"==typeof e.target?e.target:m.get(e.target);t&&n&&(null!=t.x&&null!=n.x&&p.push({type:"line",x1:t.x,y1:t.y,x2:n.x,y2:n.y,style:{stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1},datum:e}))}if(n.showLabels){const t=n.nodeLabel;for(const n of e){const e=g(fs(n,"nodeSize"));if(4>=e)continue;const o="function"==typeof t?t(n):t&&null!==(u=null===(c=n.data)||void 0===c?void 0:c[t])&&void 0!==u?u:n.id;y.push({x:n.x,y:n.y+e+12,text:o+"",anchor:"middle",fontSize:10,fill:"currentColor"})}}return{sceneNodes:f,sceneEdges:p,labels:y}},tick:(e,t,n,o,i)=>!1!==n.orbitAnimated&&(function(e,t){var n,o;const i=Ds(t),r=null!==(n=t.orbitSpeed)&&void 0!==n?n:.25,a=null!==(o=t.orbitRevolution)&&void 0!==o?o: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 n=null!==(t=e.depth)&&void 0!==t?t:0;return(n%2==0?1:-1)/(n+1)};default:return e=>{var t;return 1/((null!==(t=e.depth)&&void 0!==t?t:0)+1)}}}(t.orbitRevolutionStyle),s=(("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 n=c.get(e.parentId);if(!n)continue;const o=e.angle+s*l*a({id:t.id,depth:e.depth,data:t.data,parentId:e.parentId});t.x=n.x+e.ring*Math.sin(o),t.y=n.y+e.ring*Math.cos(o)*e.eccentricity,t.x0=t.x,t.x1=t.x,t.y0=t.y,t.y1=t.y}}(e,n),!0)},Is={sankey:ms,force:vs,chord:As,tree:Ts,cluster:Ts,treemap:Ts,circlepack:Ts,partition:Ts,orbit:Es};function Rs(e){return Is[e]}class Hs{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({},ba),e.tensionConfig),e.showParticles&&("sankey"===e.chartType||e.customNetworkLayout)&&(this.particlePool=new ka(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({},ba),e.tensionConfig),!e.showParticles||"sankey"!==e.chartType&&!e.customNetworkLayout||this.particlePool||(this.particlePool=new ka(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,n){const{nodeIDAccessor:o="id",sourceAccessor:i="source",targetAccessor:r="target",valueAccessor:a="value"}=this.config,s="function"==typeof o?o:e=>e[o],l="function"==typeof i?i:e=>e[i],c="function"==typeof r?r:e=>e[r],u="function"==typeof a?a:e=>{var t;return null!==(t=e[a])&&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=s(t)+"";this.nodes.set(e,Object.assign(Object.assign({},Fs(e)),{data:t}))}for(let e=0;t.length>e;e++){const n=t[e],o=l(n)+"",i=c(n)+"",r=u(n),a=null==r?NaN:Number(r),s=Number.isFinite(a)?a:1;this.nodes.has(o)||this.nodes.set(o,Object.assign(Object.assign({},Fs(o)),{data:n})),this.nodes.has(i)||this.nodes.set(i,Object.assign(Object.assign({},Fs(i)),{data:n}));const d=`${o}\0${i}\0${e}`,h={source:o,target:i,value:s,y0:0,y1:0,sankeyWidth:0,data:n,_edgeKey:d};n&&"object"==typeof n&&Ws(n.bezier)&&(h.bezier=n.bezier),this.edges.set(d,h)}this.runLayout(n)}edgeKey(e,t){return`${e}\0${t}`}ingestEdge(e){const{source:t,target:n,value:o}=e,i=0===this.nodes.size;let r=!1;const a="undefined"!=typeof performance?performance.now():Date.now();this.lastIngestTime=a,this._decaySortedNodes=null,this.nodes.has(t)||(this.nodes.set(t,Fs(t)),this.nodeTimestamps.set(t,a),this.tension+=this.tensionConfig.newNode,r=!0),this.nodes.has(n)||(this.nodes.set(n,Fs(n)),this.nodeTimestamps.set(n,a),this.tension+=this.tensionConfig.newNode,r=!0);const s=this.edgeKey(t,n),l=this.edges.get(s);let c=!1;return l?(l.value+=o,this.edgeTimestamps.set(s,a),this.tension+=this.tensionConfig.weightChange,c=!0):(this.edges.set(s,{source:t,target:n,value:o,y0:0,y1:0,sankeyWidth:0}),this.edgeTimestamps.set(s,a),this.tension+=this.tensionConfig.newEdge,r=!0),i||r||c||this.tension>=this.tensionConfig.threshold}runLayout(e){var t,n,o,i,r,a,s,l;if(this.config.customNetworkLayout)return this.recordTopologyDiff(),void this.layoutVersion++;const c=Rs(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 s of u)if(void 0!==s._prevX0){const l=(null!==(t=s._prevX1)&&void 0!==t?t:0)-(null!==(n=s._prevX0)&&void 0!==n?n:0),c=(null!==(o=s._prevY1)&&void 0!==o?o:0)-(null!==(i=s._prevY0)&&void 0!==i?i:0);e.set(s.id,{x:(null!==(r=s._prevX0)&&void 0!==r?r:0)+l/2,y:(null!==(a=s._prevY0)&&void 0!==a?a:0)+c/2})}else 0===s.x&&0===s.y||e.set(s.id,{x:s.x,y:s.y});if(this._lastPositionSnapshot)for(const[t,n]of this._lastPositionSnapshot)e.has(t)||e.set(t,n);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],n=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=n,this.edges.set(n,t)}const e=this._boundedPrevSnapshot;if(e&&e.size>0)for(const t of this.nodes.values()){const n=e.get(t.id);n&&(t._prevX0=n.x0,t._prevX1=n.x1,t._prevY0=n.y0,t._prevY1=n.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===(s=this.config.transition)||void 0===s?void 0:s.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,n=e[1]/2;for(const e of this.nodes.values())e._prevX0=t,e._prevX1=t,e._prevY0=n,e._prevY1=n;for(const e of this.edges.values())e._prevY0=n,e._prevY1=n,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,n,o,i,r,a,s;if(this._sceneNodesRevision++,this.config.customNetworkLayout){const l=Array.from(this.nodes.values()),c=Array.from(this.edges.values()),u=Er(this.config.colorScheme,this.config.themeCategorical,qe),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:Ir(u),config:null!==(n=this.config.layoutConfig)&&void 0!==n?n:{},selection:null!==(o=this.config.layoutSelection)&&void 0!==o?o: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!==(a=h.labels)&&void 0!==a?a:[],void(this.customLayoutOverlays=null!==(s=h.overlays)&&void 0!==s?s:null)}this.customLayoutOverlays=null;const l=Rs(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 n of this.sceneNodes)"circle"===n.type&&(e++,n.r>t&&(t=n.r));if(this._maxNodeRadius=t,Hs.QUADTREE_THRESHOLD>=e)return void(this._nodeQuadtree=null);const n=Array(e);let o=0;for(const e of this.sceneNodes)"circle"===e.type&&(n[o++]=e);this._nodeQuadtree=C().x(e=>e.cx).y(e=>e.cy).addAll(n)}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=Rs(this.config.chartType);return!!(null==e?void 0:e.supportsAnimation)&&!1!==this.config.orbitAnimated}tickAnimation(e,t){const n=Rs(this.config.chartType);if(!(null==n?void 0:n.tick))return!1;const o=n.hierarchical?Array.from(this.nodes.values()):this.nodesArray,i=n.hierarchical?Array.from(this.edges.values()):this.edgesArray;return n.tick(o,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=At(e,this.transition),n=wt(t);for(const e of this.nodes.values())void 0===e._targetX0||void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=St(e._prevX0,e._targetX0,n),e.x1=St(e._prevX1,e._targetX1,n),e.y0=St(e._prevY0,e._targetY0,n),e.y1=St(e._prevY1,e._targetY1,n));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=St(e._prevY0,e._targetY0,n),e.y1=St(e._prevY1,e._targetY1,n),e.sankeyWidth=St(e._prevSankeyWidth,e._targetSankeyWidth,n));return this.rebuildAllBeziers(),1>t||(this.snapToTargets(),this.transition=null,!1)}prepareForRelayout(){const e=this._boundedPrevSnapshot;for(const t of this.nodes.values()){const n=null==e?void 0:e.get(t.id);n&&0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1?(t._prevX0=n.x0,t._prevX1=n.x1,t._prevY0=n.y0,t._prevY1=n.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 n=t.get(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`);if(n){e._prevY0=n.y0,e._prevY1=n.y1,e._prevSankeyWidth=n.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,n="string"==typeof e.target?this.nodes.get(e.target):e.target;t&&n&&(e.bezier=e.circular&&e.circularPathData?this.buildCircularBezier(e):this.buildStandardBezier(e,t,n))}buildStandardBezier(e,t,n){const o=(e.sankeyWidth||1)/2;if("down"===e.direction){const i=t.x1,r=n.x0,a=ie(i,r);return{circular:!1,points:[{x:e.y0,y:i},{x:e.y0,y:a(.5)},{x:e.y1,y:a(.5)},{x:e.y1,y:r}],halfWidth:o}}const i=t.x1,r=n.x0,a=ie(i,r);return{circular:!1,points:[{x:i,y:e.y0},{x:a(.5),y:e.y0},{x:a(.5),y:e.y1},{x:r,y:e.y1}],halfWidth:o}}buildCircularBezier(e){const t=(e._circularWidth||e.sankeyWidth||1)/2,n=e.circularPathData;if(!n)throw Error("buildCircularBezier requires circularPathData");if(e._circularStub){const e=Math.max(15,Math.min(40,.33*(n.rightFullExtent-n.sourceX))),o=Math.max(15,Math.min(40,.33*(n.targetX-n.leftFullExtent)));return{circular:!0,segments:[[{x:n.sourceX,y:n.sourceY},{x:n.sourceX+.33*e,y:n.sourceY},{x:n.sourceX+.66*e,y:n.sourceY},{x:n.sourceX+e,y:n.sourceY}],[{x:n.targetX-o,y:n.targetY},{x:n.targetX-.66*o,y:n.targetY},{x:n.targetX-.33*o,y:n.targetY},{x:n.targetX,y:n.targetY}]],halfWidth:t}}let o;o="down"===e.direction?[{x:n.sourceY,y:n.sourceX},{x:n.sourceY,y:n.rightFullExtent},{x:n.verticalFullExtent,y:n.rightFullExtent},{x:n.verticalFullExtent,y:n.leftFullExtent},{x:n.targetY,y:n.leftFullExtent},{x:n.targetY,y:n.targetX}]:[{x:n.sourceX,y:n.sourceY},{x:n.rightFullExtent,y:n.sourceY},{x:n.rightFullExtent,y:n.verticalFullExtent},{x:n.leftFullExtent,y:n.verticalFullExtent},{x:n.leftFullExtent,y:n.targetY},{x:n.targetX,y:n.targetY}];const i=[];for(let e=0;o.length-1>e;e++){const t=o[e],n=o[e+1],r=n.x-t.x,a=n.y-t.y;i.push([t,{x:t.x+r/3,y:t.y+a/3},{x:t.x+2*r/3,y:t.y+2*a/3},n])}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,n,o,i,r;const a=this.config.pulse;if(!a)return;const s=null!==(t=a.duration)&&void 0!==t?t:500,l=null!==(n=a.color)&&void 0!==n?n:"rgba(255,255,255,0.6)",c=null!==(o=a.glowRadius)&&void 0!==o?o:4;for(const t of this.sceneNodes){const n=t.id;if(!n)continue;const o=this.nodeTimestamps.get(n);if(!o)continue;const i=e-o;s>i&&(t._pulseIntensity=1-i/s,t._pulseColor=l,t._pulseGlowRadius=c)}for(const t of this.sceneEdges){const n=t.datum;if(!n)continue;const o="object"==typeof n.source?null===(i=n.source)||void 0===i?void 0:i.id:n.source,a="object"==typeof n.target?null===(r=n.target)||void 0===r?void 0:r.id:n.target;if(!o||!a)continue;const c=this.edgeTimestamps.get(`${o}\0${a}`);if(!c)continue;const u=e-c;s>u&&(t._pulseIntensity=1-u/s,t._pulseColor=l)}}applyDecay(){var e,t;const n=this.config.decay;if(!n)return;const o=this.nodeTimestamps.size;if(1>=o)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 a=r.id;if(!a)continue;const s=i.get(a);if(void 0===s)continue;const l=xt(n,s,o),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 n=e-this.lastTopologyChangeTime;if(n>=2e3)return;const o=1-n/2e3;for(const e of this.sceneNodes){const n=e.id;n&&this.addedNodes.has(n)&&(e._pulseIntensity=Math.max(null!==(t=e._pulseIntensity)&&void 0!==t?t:0,o),e._pulseColor="rgba(34, 197, 94, 0.7)",e._pulseGlowRadius=8)}}get hasActiveTopologyDiff(){return 0!==this.addedNodes.size&&2e3>("undefined"!=typeof performance?performance.now():Date.now())-this.lastTopologyChangeTime}applyThresholds(e){var t,n;const o=this.config.thresholds;if(!o)return;const i=null!==(t=o.warningColor)&&void 0!==t?t:"#f59e0b",r=null!==(n=o.criticalColor)&&void 0!==n?n:"#ef4444",a=!1!==o.pulse;for(const t of this.sceneNodes){const n=t.id;if(!n)continue;const s=this.nodes.get(n);if(!s)continue;const l=o.metric(s);let c=null;void 0===o.critical||o.critical>l?void 0===o.warning||o.warning>l||(c=i):c=r,c&&(t.style=Object.assign(Object.assign({},t.style),{fill:c}),a&&(t._pulseIntensity=.6+.4*Math.sin(e/300),t._pulseColor=c,t._pulseGlowRadius=6))}}get hasActiveThresholds(){const e=this.config.thresholds;if(!e)return!1;for(const t of this.nodes.values()){const n=e.metric(t);if(void 0!==e.warning&&n>=e.warning||void 0!==e.critical&&n>=e.critical)return!0}return!1}get hasActivePulses(){var e;const t=this.config.pulse;if(!t||0===this.lastIngestTime)return!1;const n="undefined"!=typeof performance?performance.now():Date.now();return(null!==(e=t.duration)&&void 0!==e?e:500)>n-this.lastIngestTime}getLayoutData(){return{nodes:Array.from(this.nodes.values()),edges:Array.from(this.edges.values())}}updateNode(e,t){var n;const o=this.nodes.get(e);if(!o)return null;const i=o.data?Object.assign({},o.data):{};return o.data=t(null!==(n=o.data)&&void 0!==n?n:{}),this.layoutVersion++,i}updateEdge(e,t,n){var o;const i=this.config.valueAccessor,r="function"==typeof i?i:i?e=>e[i]:e=>e.value,a=[];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){a.push(i.data?Object.assign({},i.data):{}),i.data=n(null!==(o=i.data)&&void 0!==o?o:{});const e=r(i.data);null!=e&&(i.value=Number(e))}return a.length>0&&this.layoutVersion++,a}removeNode(e){if(!this.nodes.has(e))return!1;this.nodes.delete(e),this.nodeTimestamps.delete(e);for(const[t,n]of this.edges)("string"==typeof n.source?n.source:n.source.id)!==e&&("string"==typeof n.target?n.target:n.target.id)!==e||(this.edges.delete(t),this.edgeTimestamps.delete(t));return this.layoutVersion++,!0}removeEdge(e,t){const n=[];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 o="function"==typeof t?t:e=>null==e?void 0:e[t];for(const[t,i]of this.edges)i.data&&o(i.data)===e&&n.push(t)}else for(const[o,i]of this.edges)("string"==typeof i.source?i.source:i.source.id)===e&&("string"==typeof i.target?i.target:i.target.id)===t&&n.push(o);for(const e of n)this.edges.delete(e),this.edgeTimestamps.delete(e);return n.length>0&&this.layoutVersion++,n.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 Fs(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 Ws(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(!zs(e))return!1;return!0}return zs(t.points)}function zs(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 Ys(e,t,n,o,i=30,r,a=0){let s=null,l=i,c=1/0;if(r){const e=Xt(r,n,o,i,a,e=>e.cx,e=>e.cy,e=>e.r);e&&(s={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=Gs(t,n,o,i);if(e)if("rect"===t.type){const n=t.w*t.h;c>n&&(s=e,c=n)}else l>e.distance&&(s=e,l=e.distance)}if(s)return s;for(const e of t){if(!1===e.interactive)continue;const t=Qs(e,n,o);t&&l>t.distance&&(s=t,l=t.distance)}return s}function Gs(e,t,n,o=30){switch(e.type){case"circle":return function(e,t,n,o=30){const i=t-e.cx,r=n-e.cy,a=Math.sqrt(i*i+r*r);return a>zt(e.r,o)?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:a}}(e,t,n,o);case"rect":return function(e,t,n){const o=Wt(t,n,e);return o.hit?{type:"node",datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}(e,t,n);case"arc":return function(e,t,n){const o=t-e.cx,i=n-e.cy,r=Math.sqrt(o*o+i*i);if(e.innerR-2>r||r>e.outerR+2)return null;const a=qt(Math.atan2(i,o)),s=qt(e.startAngle),l=qt(e.endAngle);if(s>l?a>=s||l>=a:a>=s&&l>=a){const t=(e.startAngle+e.endAngle)/2,n=(e.innerR+e.outerR)/2;return{type:"node",datum:e.datum,x:e.cx+n*Math.cos(t),y:e.cy+n*Math.sin(t),distance:0}}return null}(e,t,n);default:return null}}Hs.QUADTREE_THRESHOLD=500;let qs=null,Xs=null;function Vs(){return Xs||(qs=document.createElement("canvas"),qs.width=1,qs.height=1,Xs=qs.getContext("2d")),Xs}function Us(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 Qs(e,t,n){switch(e.type){case"bezier":return function(e,t,n){if(!e.pathD)return null;const o=Us(e),i=Vs();if(!o||!i)return null;try{if(i.isPointInPath(o,t,n))return{type:"edge",datum:e.datum,x:t,y:n,distance:0};const r=i.lineWidth;i.lineWidth=10;const a=i.isPointInStroke(o,t,n);if(i.lineWidth=r,a)return{type:"edge",datum:e.datum,x:t,y:n,distance:4}}catch(e){}return null}(e,t,n);case"line":return function(e,t,n){const o=e.x2-e.x1,i=e.y2-e.y1,r=o*o+i*i;if(0===r)return null;let a=((t-e.x1)*o+(n-e.y1)*i)/r;a=Math.max(0,Math.min(1,a));const s=e.x1+a*o,l=e.y1+a*i,c=Math.sqrt(Math.pow(t-s,2)+Math.pow(n-l,2));return c>5?null:{type:"edge",datum:e.datum,x:s,y:l,distance:c}}(e,t,n);case"ribbon":case"curved":return function(e,t,n){if(!e.pathD)return null;const o=Us(e),i=Vs();if(!o||!i)return null;try{if(i.isPointInPath(o,t,n))return{type:"edge",datum:e.datum,x:t,y:n,distance:0};const r=i.lineWidth;i.lineWidth=10;const a=i.isPointInStroke(o,t,n);if(i.lineWidth=r,a)return{type:"edge",datum:e.datum,x:t,y:n,distance:4}}catch(e){}return null}(e,t,n);default:return null}}function Ks(i){const{width:r,height:a,totalWidth:s,totalHeight:l,margin:c,labels:u,title:d,legend:h,legendHoverBehavior:g,legendClickBehavior:f,legendHighlightedCategory:p,legendIsolatedCategories:y,legendPosition:m="right",legendLayout:v,foregroundGraphics:b,sceneNodes:x,annotations:k,autoPlaceAnnotations:w,svgAnnotationRules:A}=i,S=o.useMemo(()=>{const e=(x||[]).flatMap(e=>{const t=function(e){var t,n,o,i;const r=null!==(t=e.cx)&&void 0!==t?t:null!=e.x&&null!=e.w?e.x+e.w/2:e.x,a=null!==(n=e.cy)&&void 0!==n?n:null!=e.y&&null!=e.h?e.y+e.h/2:e.y;return"number"!=typeof r||"number"!=typeof a?null:{x:r,y:a,r:"number"==typeof e.r?Math.max(1,e.r):"number"==typeof e.outerR?Math.max(1,e.outerR):Math.max(1,null!==(o=e.w)&&void 0!==o?o:0,null!==(i=e.h)&&void 0!==i?i:0)/2}}(e),n=function(e){var t,n,o,i,r,a,s,l;const c=null!==(a=null!==(o=null!==(t=e.id)&&void 0!==t?t:null===(n=e.datum)||void 0===n?void 0:n.id)&&void 0!==o?o:null===(r=null===(i=e.datum)||void 0===i?void 0:i.data)||void 0===r?void 0:r.id)&&void 0!==a?a:null===(l=null===(s=e.datum)||void 0===s?void 0:s.data)||void 0===l?void 0:l.name;return null==c?void 0:c+""}(e);return t?[Object.assign({pointId:n},t)]:[]});return{scales:null,width:r,height:a,frameType:"network",pointNodes:e,sceneNodes:x}},[a,x,r]),O=o.useMemo(()=>k&&w?jo(Object.assign({annotations:k,context:S},"object"==typeof w?w:{})):k,[k,w,S]),C=O?ro(O.reduce((t,n,i)=>{if("widget"===n.type||!A)return t;const r=A(n,i,S);return r&&t.push({node:e(o.Fragment,{children:r},"annotation-"+i),annotation:n}),t},[])):null,j=!0===(null==O?void 0:O.some(e=>"widget"===e.type&&!0===e._annotationDeferred));return t(n,{children:[j&&e("style",{children:eo},"annotation-widget-disclosure-style"),t("svg",{role:"img",width:s,height:l,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[e("title",{children:"string"==typeof d?d:"Network Chart"}),e("desc",{children:"string"==typeof d?d+" — network data visualization":"Network data visualization"}),t("g",{transform:`translate(${c.left},${c.top})`,children:[u.map((t,n)=>e("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-"+n)),C,b]}),d&&"string"==typeof d?e("text",{x:s/2,y:16,textAnchor:"middle",fontWeight:600,fill:"currentColor",className:"semiotic-chart-title",style:{fontSize:"var(--semiotic-title-font-size, 14px)"},children:d}):d?e("foreignObject",{x:0,y:0,width:s,height:c.top,children:d}):null,En({legend:h,totalWidth:s,totalHeight:l,margin:c,legendPosition:m,title:d,legendLayout:v,legendHoverBehavior:g,legendClickBehavior:f,legendHighlightedCategory:p,legendIsolatedCategories:y})]}),null==O?void 0:O.filter(e=>"widget"===e.type&&e.nodeId&&x).map((t,n)=>{var o,i,r,a,s,l,u,d,h;const g=!0===t._annotationDeferred,f=x.find(e=>{var n,o,i,r,a;return e.id===t.nodeId||(null===(n=e.datum)||void 0===n?void 0:n.id)===t.nodeId||(null===(i=null===(o=e.datum)||void 0===o?void 0:o.data)||void 0===i?void 0:i.id)===t.nodeId||(null===(a=null===(r=e.datum)||void 0===r?void 0:r.data)||void 0===a?void 0:a.name)===t.nodeId});if(!f)return null;const p=c.left+(null!==(o=f.cx)&&void 0!==o?o:null!=f.x&&null!=f.w?f.x+f.w/2:null!==(i=f.x)&&void 0!==i?i:0),y=c.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!==(s=t.dx)&&void 0!==s?s:0,v=null!==(l=t.dy)&&void 0!==l?l:-16,b=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("span",{style:{fontSize:18,cursor:"default"},children:"ℹ️"});return e("div",{className:g?"annotation-deferred":void 0,"data-annotation-disclosure":g?"deferred":void 0,style:{position:"absolute",left:p+m-b/2,top:y+v-k/2,width:b,height:k,display:"flex",alignItems:"center",justifyContent:"center",zIndex:5},children:w},"widget-"+n)})]})}function Zs(e){return e._cachedPath2D&&e._cachedPath2DSource===e.pathD||(e._cachedPath2D=new Path2D(e.pathD),e._cachedPath2DSource=e.pathD),e._cachedPath2D}function Js(e,t){var n,o,i,r,a,s;if(!t.pathD)return;e.save();const l=Zs(t);if(t.style.fill&&"none"!==t.style.fill){const a=t._gradient;if(a){const i=e.createLinearGradient(a.x0,0,a.x1,0),r=null!==(o=null!==(n=t.style.fillOpacity)&&void 0!==n?n:t.style.opacity)&&void 0!==o?o:.5,s="string"==typeof t.style.fill?t.style.fill:"#999",l=tn(e,s)||s;i.addColorStop(0,1===a.from?l:"transparent"),i.addColorStop(1,1===a.to?l:"transparent"),e.fillStyle=i,e.globalAlpha=r}else e.fillStyle="string"==typeof t.style.fill&&tn(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=tn(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(a=t.style.strokeWidth)&&void 0!==a?a:.5,e.globalAlpha=.5*(null!==(s=t.style.opacity)&&void 0!==s?s:1),e.stroke(l)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.2*t._pulseIntensity,e.fill(l)),e.restore()}function el(e,t){var n,o;e.save();const i=t.style.stroke||"#999";e.strokeStyle=tn(e,i)||i,e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.strokeDasharray&&e.setLineDash(t.style.strokeDasharray.split(/[\s,]+/).map(Number)),e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.stroke(),t._pulseIntensity&&t._pulseIntensity>0&&(e.setLineDash([]),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=(null!==(o=t.style.strokeWidth)&&void 0!==o?o:1)+3*t._pulseIntensity,e.globalAlpha=.4*t._pulseIntensity,e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.stroke()),e.restore()}function tl(e,t){var n,o,i,r;if(!t.pathD)return;e.save();const a=Zs(t);t.style.fill&&"none"!==t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&tn(e,t.style.fill)||t.style.fill,e.globalAlpha=null!==(o=null!==(n=t.style.fillOpacity)&&void 0!==n?n:t.style.opacity)&&void 0!==o?o:.5,e.fill(a)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=tn(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(a)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.25*t._pulseIntensity,e.fill(a)),e.restore()}function nl(e,t){var n,o;if(!t.pathD)return;e.save();const i=Zs(t),r=t.style.stroke||"#999";e.strokeStyle=tn(e,r)||r,e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n: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&&tn(e,t.style.fill)||t.style.fill,e.globalAlpha=null!==(o=t.style.fillOpacity)&&void 0!==o?o:.1,e.fill(i)),e.restore()}Ks.displayName="NetworkSVGOverlay";const ol={top:20,right:80,bottom:20,left:80},il={top:40,right:40,bottom:40,left:40},rl=new Set(["chord","force","circlepack","orbit"]),al=[800,600],sl={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 ll({data:n}){var o,i,r,a,s,l;if("edge"===n.nodeOrEdge){const e=n.data;return e?t("div",{className:"semiotic-tooltip",style:sl,children:[t("div",{style:{fontWeight:600},children:["object"==typeof e.source?e.source.id:e.source," → ","object"==typeof e.target?e.target.id:e.target]}),null!=e.value&&t("div",{style:{marginTop:4,opacity:.8},children:["Value:"," ","number"==typeof e.value?e.value.toLocaleString():e.value+""]})]}):null}const c=n.data;if(!c)return null;const u=c.__hierarchyNode;if(u){const n=[];let s=u;for(;s;){const e=null!==(a=null!==(i=null===(o=s.data)||void 0===o?void 0:o.name)&&void 0!==i?i:null===(r=s.data)||void 0===r?void 0:r.id)&&void 0!==a?a:c.id;null!=e&&n.unshift(e+""),s=s.parent}n.length>1&&n.shift();const l=n.length-1;return t("div",{className:"semiotic-tooltip",style:sl,children:[e("div",{children:n.map((n,o)=>t("span",{children:[o>0&&e("span",{style:{margin:"0 3px",opacity:.5},children:" → "}),o===l?e("strong",{children:n}):e("span",{style:{opacity:.7},children:n})]},o))}),null!=c.value&&c.value>0&&e("div",{style:{marginTop:4,opacity:.8},children:"number"==typeof c.value?c.value.toLocaleString():c.value+""})]})}const d=((null===(s=c.sourceLinks)||void 0===s?void 0:s.length)||0)+((null===(l=c.targetLinks)||void 0===l?void 0:l.length)||0),h=(c.sourceLinks||[]).reduce((e,t)=>e+(t.value||0),0)+(c.targetLinks||[]).reduce((e,t)=>e+(t.value||0),0);return t("div",{className:"semiotic-tooltip",style:sl,children:[e("div",{style:{fontWeight:600},children:c.id}),null!=c.value&&c.value>0&&t("div",{style:{marginTop:4,opacity:.8},children:["Total:"," ","number"==typeof c.value?c.value.toLocaleString():c.value+""]}),d>0&&t("div",{style:{marginTop:4,opacity:.8},children:["Connections: ",d,h!==d&&` (weighted: ${h.toLocaleString()})`]})]})}ll.ownsChrome=!0;const cl=g(function(n,o){var s,c,u,h,g,f,y,m,v,b,x,k,w,A,S,O,C,j,M;const{chartType:_,nodes:P,edges:L,data:T,initialEdges:$,nodeIDAccessor:N="id",sourceAccessor:B="source",targetAccessor:D="target",valueAccessor:E="value",edgeIdAccessor:I,childrenAccessor:H,hierarchySum:F,orientation:W="horizontal",nodeAlign:z="justify",nodePaddingRatio:Y=.05,nodeWidth:G=15,iterations:q=300,forceStrength:X=.1,padAngle:V=.01,groupWidth:U=20,sortGroups:Q,edgeSort:K,treeOrientation:Z="vertical",edgeType:J="curve",padding:ee,paddingTop:te,tensionConfig:ne,showParticles:oe=!1,particleStyle:ie,nodeStyle:re,edgeStyle:ae,colorBy:se,colorScheme:le="category10",edgeColorBy:ce="source",edgeOpacity:ue=.5,colorByDepth:de=!1,nodeSize:he=8,nodeSizeRange:ge=[5,20],nodeLabel:fe,showLabels:pe=!0,labelMode:ye,size:ve=al,responsiveWidth:be,responsiveHeight:xe,margin:we,className:Ae,background:Se,enableHover:Oe=!0,tooltipContent:Ce,customHoverBehavior:je,customClickBehavior:Me,onObservation:_e,chartId:Pe,onTopologyChange:Le,annotations:Te,autoPlaceAnnotations:$e,svgAnnotationRules:Ne,legend:Be,legendPosition:De,legendLayout:Ee,legendHoverBehavior:Ie,legendClickBehavior:Re,legendHighlightedCategory:He,legendIsolatedCategories:Fe,title:We,foregroundGraphics:ze,backgroundGraphics:Ye,decay:Ge,pulse:qe,transition:Xe,animate:Ve,staleness:Ue,thresholds:Qe,accessibleTable:Ke=!0,description:Ze,summary:Je,orbitMode:et,orbitSize:tt,orbitSpeed:nt,orbitRevolution:ot,orbitRevolutionStyle:it,orbitEccentricity:rt,orbitShowRings:at,orbitAnimated:st,customNetworkLayout:lt,layoutConfig:ct,layoutSelection:ut}=n,dt=rl.has(_)?il:ol,ht=i(!0),ft=tr({sizeProp:ve,responsiveWidth:be,responsiveHeight:xe,userMargin:we,marginDefault:dt,foregroundGraphics:ze,backgroundGraphics:Ye,animate:Ve,transitionProp:Xe,themeDirtyRef:ht}),{reducedMotionRef:pt,responsiveRef:yt,size:mt,margin:vt,adjustedWidth:bt,adjustedHeight:xt,resolvedForeground:kt,resolvedBackground:wt,transition:At,introEnabled:St,tableId:Ot,rafRef:Ct,renderFnRef:jt,scheduleRender:Mt,currentTheme:_t}=ft,Pt=ii(),Lt=li(),Tt=r(()=>me(P),[P]),$t=r(()=>Array.isArray(L)?me(L):L,[L]),Nt=r(()=>Object.assign(Object.assign({},ba),ne),[ne]),Bt=r(()=>Object.assign(Object.assign({},xa),ie),[ie]),Dt=r(()=>{var e;return{chartType:_,nodeIDAccessor:N,sourceAccessor:B,targetAccessor:D,valueAccessor:E,edgeIdAccessor:I,childrenAccessor:H,hierarchySum:F,orientation:W,nodeAlign:z,nodePaddingRatio:Y,nodeWidth:G,iterations:q,forceStrength:X,padAngle:V,groupWidth:U,sortGroups:Q,edgeSort:K,treeOrientation:Z,edgeType:J,padding:ee,paddingTop:te,tensionConfig:Nt,showParticles:oe,particleStyle:Bt,nodeStyle:re,edgeStyle:ae,nodeLabel:fe,showLabels:pe,labelMode:ye,colorBy:se,colorScheme:le,themeCategorical:null===(e=null==_t?void 0:_t.colors)||void 0===e?void 0:e.categorical,themeSemantic:ke(_t),edgeColorBy:ce,edgeOpacity:ue,colorByDepth:de,nodeSize:he,nodeSizeRange:ge,decay:Ge,pulse:qe,transition:At,introAnimation:St,staleness:Ue,thresholds:Qe,orbitMode:et,orbitSize:tt,orbitSpeed:nt,orbitRevolution:ot,orbitRevolutionStyle:it,orbitEccentricity:rt,orbitShowRings:at,orbitAnimated:st,customNetworkLayout:lt,layoutConfig:ct,layoutSelection:ut}},[_,N,B,D,E,H,F,W,z,Y,G,q,X,V,U,Q,K,Z,J,ee,te,Nt,oe,Bt,re,ae,fe,pe,ye,se,le,ce,ue,de,he,ge,Ge,qe,null==At?void 0:At.duration,null==At?void 0:At.easing,St,Ue,Qe,et,tt,nt,ot,it,rt,at,st,_t,lt,ct,ut]),Et=ui(Dt),It=ui({chartType:_,nodeIDAccessor:N,sourceAccessor:B,targetAccessor:D,valueAccessor:E,childrenAccessor:H,hierarchySum:F,orientation:W,nodeAlign:z,nodePaddingRatio:Y,nodeWidth:G,iterations:q,forceStrength:X,padAngle:V,groupWidth:U,sortGroups:Q,edgeSort:K,treeOrientation:Z,edgeType:J,padding:ee,paddingTop:te,tensionConfig:Nt,orbitMode:et,orbitSize:tt,orbitEccentricity:rt,customNetworkLayout:lt}),Rt=i(null),Ht=i(0),Wt=i(0),zt=i(!1),Yt=i(null);Yt.current||(Yt.current=new Hs(Et));const[Gt,qt]=d(null),[Xt,Vt]=d(0),[Ut,Qt]=d(0),[Kt,Zt]=d(!1),Jt=i(null),en=i(new Map),nn=i(0),on=l(e=>{if("function"==typeof se)return se(e)+"";if("string"==typeof se&&e.data){const t=e.data[se];if(void 0!==t){if(!en.current.has(t+"")){const e=Array.isArray(le)?le:gt;en.current.set(t+"",e[nn.current++%e.length])}return en.current.get(t+"")}}if(en.current.has(e.id))return en.current.get(e.id);const t=Array.isArray(le)?le:gt,n=se?t[nn.current++%t.length]:t[0];return en.current.set(e.id,n),n},[se,le]),rn=(null===(s=null==_t?void 0:_t.colors)||void 0===s?void 0:s.border)||(null===(c=null==_t?void 0:_t.colors)||void 0===c?void 0:c.secondary)||(null===(u=null==_t?void 0:_t.colors)||void 0===u?void 0:u.primary)||"#999",an=l(e=>{var t,n;return e?"object"==typeof e?e:null!==(n=null===(t=Yt.current)||void 0===t?void 0:t.nodes.get(e))&&void 0!==n?n:null:null},[]),sn=l(e=>{if("function"==typeof ce)return ce(e);const t=an(e.source),n=an(e.target);return"target"===ce&&n?on(n):t?on(t):rn},[ce,on,rn,an]),ln=l(e=>{if("function"==typeof Bt.color){const t=an(e.source);return t?Bt.color(e,t):rn}if(!(null==ie?void 0:ie.colorBy))return sn(e);const t=Bt.colorBy,n=an(e.source),o=an(e.target);return"target"===t&&o?on(o):n?on(n):rn},[null==ie?void 0:ie.colorBy,Bt.color,Bt.colorBy,on,sn,rn,an]),cn=("sankey"===_||!!lt)&&oe||!!qe||null!==(g=null===(h=Yt.current)||void 0===h?void 0:h.isAnimating)&&void 0!==g&&g;a(()=>{var e;null===(e=Yt.current)||void 0===e||e.updateConfig(Et),ht.current=!0,Mt()},[Et,Mt]),a(()=>{var e;const t=Yt.current;if(t){t.buildScene([bt,xt]);for(const n of t.sceneNodes)n.id&&"string"==typeof(null===(e=n.style)||void 0===e?void 0:e.fill)&&en.current.set(n.id,n.style.fill);ht.current=!0,Mt()}},[_t,bt,xt,Mt]);const un=l(()=>{var e;const t=Yt.current;if(!t)return;t.runLayout([bt,xt]),t.buildScene([bt,xt]),ht.current=!0;for(const n of t.sceneNodes)n.id&&"string"==typeof(null===(e=n.style)||void 0===e?void 0:e.fill)&&en.current.set(n.id,n.style.fill);const n=Array.isArray(le)?le:gt,o=Array.from(t.nodes.values());for(let e=0;o.length>e;e++){const t=o[e];en.current.has(t.id)||en.current.set(t.id,n[e%n.length])}if(nn.current=o.length,Vt(t.layoutVersion),Le){const{nodes:e,edges:n}=t.getLayoutData();Le(e,n)}},[bt,xt,Le,le]),dn=l(e=>{if(null==e||"object"!=typeof e)return;const t=Yt.current;t&&(t.ingestEdge(e)&&un(),Mt())},[un,Mt]),hn=l(e=>{const t=Yt.current;if(!t)return;let n=!1;for(const o of e)null!=o&&"object"==typeof o&&t.ingestEdge(o)&&(n=!0);n&&un(),Mt()},[un,Mt]),gn=l(()=>{var e,t,n;null===(e=Yt.current)||void 0===e||e.clear(),en.current.clear(),nn.current=0,Vt(null!==(n=null===(t=Yt.current)||void 0===t?void 0:t.layoutVersion)&&void 0!==n?n:0),qt(null),Jt.current=null,ht.current=!0,Mt()},[Mt]),fn=l(()=>{const e=Yt.current;e&&(e.tension+=999,un(),Mt())},[un,Mt]);p(o,()=>({push:dn,pushMany:hn,removeNode:e=>{var t,n,o;const i=null!==(n=null===(t=Yt.current)||void 0===t?void 0:t.removeNode(e))&&void 0!==n&&n;if(i){const t=(null===(o=Jt.current)||void 0===o?void 0:o.data)?"function"==typeof N?N(Jt.current.data):Jt.current.data[N]:void 0;Jt.current&&"node"===Jt.current.nodeOrEdge&&t===e&&(Jt.current=null,qt(null)),en.current.delete(e),un(),ht.current=!0,Mt()}return i},removeEdge:(e,t)=>{var n,o;const i=null!==(o=null===(n=Yt.current)||void 0===n?void 0:n.removeEdge(e,t))&&void 0!==o&&o;if(i){if(Jt.current&&"edge"===Jt.current.nodeOrEdge){const n=Jt.current.data;let o;o=void 0!==t?("object"==typeof(null==n?void 0:n.source)?n.source.id:null==n?void 0:n.source)===e&&("object"==typeof(null==n?void 0:n.target)?n.target.id:null==n?void 0:n.target)===t:!I||!n||("function"==typeof I?I:e=>null==e?void 0:e[I])(n)===e,o&&(Jt.current=null,qt(null))}un(),ht.current=!0,Mt()}return i},updateNode:(e,t)=>{var n,o;const i=null!==(o=null===(n=Yt.current)||void 0===n?void 0:n.updateNode(e,t))&&void 0!==o?o:null;return i&&(ht.current=!0,Mt()),i},updateEdge:(e,t,n)=>{var o,i;const r=null!==(i=null===(o=Yt.current)||void 0===o?void 0:o.updateEdge(e,t,n))&&void 0!==i?i:[];return r.length>0&&(un(),ht.current=!0,Mt()),r},clear:gn,getTopology:()=>{var e,t;return null!==(t=null===(e=Yt.current)||void 0===e?void 0:e.getLayoutData())&&void 0!==t?t:{nodes:[],edges:[]}},getTopologyDiff:()=>{const e=Yt.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:fn,getTension:()=>{var e,t;return null!==(t=null===(e=Yt.current)||void 0===e?void 0:e.tension)&&void 0!==t?t:0}}),[dn,hn,gn,fn,un,Mt]);const pn=["tree","cluster","treemap","circlepack","partition","orbit"].includes(_),yn=pn?T||(Array.isArray(L)?void 0:L):void 0;a(()=>{var e;const t=Yt.current;if(t)if(pn&&yn)t.ingestHierarchy(yn,[bt,xt]),t.buildScene([bt,xt]),ht.current=!0,Mt();else{const n=Tt,o=Array.isArray($t)?$t:[];if(0===n.length&&0===o.length)return;t.ingestBounded(n,o,[bt,xt]),t.buildScene([bt,xt]);for(const n of t.sceneNodes)n.id&&(null===(e=n.style)||void 0===e?void 0:e.fill)&&en.current.set(n.id,n.style.fill+"");const i=Array.isArray(le)?le:gt,r=Array.from(t.nodes.values());for(let e=0;r.length>e;e++){const t=r[e];en.current.has(t.id)||en.current.set(t.id,i[e%i.length])}nn.current=r.length,ht.current=!0,Mt()}},[Tt,$t,T,yn,pn,bt,xt,It,Mt,le]),a(()=>{$&&$.length>0&&hn($)},[]);const mn=l(e=>{if(je&&je(e),_e){const t=Date.now();_e(e?{type:"hover",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:Pe}:{type:"hover-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:Pe})}},[je,_e,Pe]),vn=l(e=>{if(Me&&Me(e),_e){const t=Date.now();_e(e?{type:"click",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:Pe}:{type:"click-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:Pe})}},[Me,_e,Pe]),{hoverHandlerRef:bn,hoverLeaveRef:An,onPointerMove:On,onPointerLeave:Mn}=ft;bn.current=e=>{if(!Oe)return;const t=Rt.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-vt.left,i=e.clientY-n.top-vt.top;if(0>o||o>bt||0>i||i>xt)return void(Jt.current&&(Jt.current=null,qt(null),mn&&(mn(null),ht.current=!0),Mt()));const r=Yt.current;if(!r)return;const a=Ys(r.sceneNodes,r.sceneEdges,o,i,30,r.nodeQuadtree,r.maxNodeRadius);if(!a)return void(Jt.current&&(Jt.current=null,qt(null),mn&&(mn(null),ht.current=!0),Mt()));const s=Wi(a.datum||{},a.x,a.y,{nodeOrEdge:a.type});Jt.current=s,qt(s),mn&&(mn(s),ht.current=!0),Mt()},An.current=()=>{Jt.current&&(Jt.current=null,qt(null),mn&&(mn(null),ht.current=!0),Mt())};const _n=i(()=>{});_n.current=e=>{if(!Me&&!_e)return;const t=Rt.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-vt.left,i=e.clientY-n.top-vt.top;if(0>o||o>bt||0>i||i>xt)return;const r=Yt.current;if(!r)return;const a=Ys(r.sceneNodes,r.sceneEdges,o,i,30,r.nodeQuadtree,r.maxNodeRadius);vn(a?Wi(a.datum||{},a.x,a.y,{nodeOrEdge:a.type}):null)};const Pn=l(e=>_n.current(e),[]),Ln=i(-1),Tn=i(null),$n=i(-1),Nn=l(e=>{var t;const n=Yt.current;if(!n)return;const o=function(e){var t,n,o,i,r,a;const s=[];for(const l of e)if("circle"===l.type&&null!=l.cx){if(0>=l.r)continue;s.push({x:l.cx,y:l.cy,datum:l.datum,shape:"circle",group:null!==(n=null===(t=l.datum)||void 0===t?void 0:t.id)&&void 0!==n?n:"_default"})}else if("rect"===l.type&&null!=l.x){if(0>=l.w||0>=l.h)continue;s.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===(o=l.datum)||void 0===o?void 0:o.id)&&void 0!==i?i:"_default"})}else"arc"===l.type&&null!=l.cx&&s.push({x:l.cx,y:l.cy,datum:l.datum,shape:"circle",group:null!==(a=null===(r=l.datum)||void 0===r?void 0:r.id)&&void 0!==a?a:"_default"});return s.sort((e,t)=>e.x-t.x||e.y-t.y),s}(n.sceneNodes);if(0===o.length)return;const i=xn(o),r=Ln.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(),Ln.current=0,$n.current=-1;const t=i.flat[0];Tn.current={shape:t.shape,w:t.w,h:t.h};const n=Wi(t.datum||{},t.x,t.y,{nodeOrEdge:"node"});return Jt.current=n,qt(n),mn&&(mn(n),ht.current=!0),void Mt()}const a=kn(i,r),s=function(e,t,n,o,i){var r,a,s;const l=n.flat[t.flatIndex];if(!l)return wn(e,t,n);const c=null===(r=l.datum)||void 0===r?void 0:r.id;switch(e){case"ArrowRight":case"ArrowLeft":case"ArrowDown":case"ArrowUp":{const o=null!==(a=function(e,t,n){let o=null,i=1/0;for(let r=0;e.flat.length>r;r++){const a=e.flat[r];if(a===t)continue;const s=a.x-t.x,l=a.y-t.y;let c=!1;switch(n){case"right":c=s>0&&Math.abs(s)>=Math.abs(l);break;case"left":c=0>s&&Math.abs(s)>=Math.abs(l);break;case"down":c=l>0&&Math.abs(l)>=Math.abs(s);break;case"up":c=0>l&&Math.abs(l)>=Math.abs(s)}if(!c)continue;const u=s*s+l*l;i>u&&(i=u,o=r)}return o}(n,l,"ArrowRight"===e?"right":"ArrowLeft"===e?"left":"ArrowDown"===e?"down":"up"))&&void 0!==a?a:t.flatIndex;return o!==t.flatIndex&&(i.current=-1),o}case"Enter":{if(null==c)return t.flatIndex;const e=function(e,t){var n;const o=e+"",i=[];for(const e of t){const t=null!==(n=e.datum)&&void 0!==n?n:e,r=Sn(t.source),a=Sn(t.target),s=null!=r,l=null!=a;s&&r+""===o&&l?i.push(a+""):l&&a+""===o&&s&&i.push(r+"")}return i}(c,o);if(0===e.length)return t.flatIndex;const r=null!==(s=n.idToIdx.get(e[(i.current+1)%e.length]))&&void 0!==s?s:-1;return 0>r?t.flatIndex:(i.current=-1,r)}default:{const o=wn(e,t,n);return null!==o&&o!==t.flatIndex&&(i.current=-1),o}}}(e.key,a,i,null!==(t=n.sceneEdges)&&void 0!==t?t:[],$n);if(null===s)return;if(e.preventDefault(),0>s)return Ln.current=-1,Tn.current=null,$n.current=-1,Jt.current=null,qt(null),mn&&(mn(null),ht.current=!0),void Mt();Ln.current=s;const l=i.flat[s];Tn.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"};Jt.current=c,qt(c),mn&&(mn(c),ht.current=!0),Mt()},[mn,Mt]),Bn=l(e=>{Ln.current=-1,Tn.current=null,On(e)},[On]);jt.current=()=>{var e,t,n,o,i,r,a;Ct.current=0;const s=Rt.current;if(!s)return;const l=s.getContext("2d");if(!l)return;const c=Yt.current;if(!c)return;const u=performance.now(),d=Ht.current?Math.min((u-Ht.current)/1e3,.1):.016;Ht.current=u;const h=c.advanceTransition(pt.current?u+1e6:u),g=!pt.current&&h,f=!pt.current&&c.tickAnimation([bt,xt],d);(h||ht.current||f)&&c.buildScene([bt,xt]);const p=or();if(!nr(s,mt,vt,p))return;if(l.clearRect(-vt.left,-vt.top,mt[0],mt[1]),Se){const e=tn(l,Se);e&&(l.fillStyle=e,l.fillRect(0,0,bt,xt))}Ge&&c.applyDecay(),qe&&c.applyPulse(u),Qe&&c.applyThresholds(u),c.applyTopologyDiff(u);const y=null!==(e=null==Ue?void 0:Ue.threshold)&&void 0!==e?e:5e3,m=Ue&&c.lastIngestTime>0&&u-c.lastIngestTime>y;if(m&&(l.globalAlpha=null!==(t=null==Ue?void 0:Ue.dimOpacity)&&void 0!==t?t:.5),function(e,t){for(const n of t)switch(n.type){case"bezier":Js(e,n);break;case"line":el(e,n);break;case"ribbon":tl(e,n);break;case"curved":nl(e,n)}}(l,c.sceneEdges),function(e,t){var n,o,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&&tn(e,t.style.fill)||t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(n=t.style.opacity)&&void 0!==n?n:1)*t.style.fillOpacity),e.fillRect(t.x,t.y,t.w,t.h)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=tn(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,e.globalAlpha=null!==(i=t.style.opacity)&&void 0!==i?i:1,e.strokeRect(t.x,t.y,t.w,t.h)),lr(e,t),e.restore())}}(l,c.sceneNodes),function(e,t){var n,o,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&&tn(e,t.style.fill)||t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(n=t.style.opacity)&&void 0!==n?n:1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=tn(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,e.globalAlpha=null!==(i=t.style.opacity)&&void 0!==i?i:1,e.stroke()),cr(e,t),e.restore())}}(l,c.sceneNodes),function(e,t){var n,o,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&&tn(e,t.style.fill)||t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(n=t.style.opacity)&&void 0!==n?n:1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=tn(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,e.globalAlpha=null!==(i=t.style.opacity)&&void 0!==i?i:1,e.stroke()),e.restore()}}(l,c.sceneNodes),oe&&c.particlePool&&!m){const e=c.edgesArray;if(e.length>0){!function(e,t,n,o){var i,r;const a=null!==(i=o.spawnRate)&&void 0!==i?i:xa.spawnRate,s=null!==(r=o.maxPerEdge)&&void 0!==r?r:xa.maxPerEdge;for(let o=0;t.length>o;o++){const i=t[o];if(!i.bezier)continue;if(e.countForEdge(o)>=s)continue;const r=i.value*a*n*(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(o)<s;t++)e.spawn(o)}}(c.particlePool,e,d,Bt);const t=.5*(null!==(n=Bt.speedMultiplier)&&void 0!==n?n:1);let o;if(Bt.proportionalSpeed){const t=e.reduce((e,t)=>Math.max(e,t.value||1),1);o=e.map(e=>.3+(e.value||1)/t*1.7)}c.particlePool.step(d,t,e,o),function(e,t,n,o,i){var r,a;const s=null!==(r=o.radius)&&void 0!==r?r:xa.radius,l=null!==(a=o.opacity)&&void 0!==a?a:xa.opacity;e.globalAlpha=l;for(let r=0;t.particles.length>r;r++){const a=t.particles[r];if(!a.active)continue;const l=n[a.edgeIndex];if(!l)continue;let c;c="string"==typeof o.color&&"inherit"!==o.color?o.color:i(l),e.fillStyle=tn(e,c)||c,e.beginPath(),e.arc(a.x,a.y,s,0,2*Math.PI),e.fill()}e.globalAlpha=1}(l,c.particlePool,e,Bt,ln)}}m&&(l.globalAlpha=1);const v=ht.current;if(ht.current=!1,v||g||f){const e=Rt.current;e&&e.setAttribute("aria-label",bi(null!==(i=null===(o=c.sceneNodes)||void 0===o?void 0:o.length)&&void 0!==i?i:0,null!==(a=null===(r=c.sceneEdges)||void 0===r?void 0:r.length)&&void 0!==a?a:0,"Network chart"))}const b=v||g||f||zt.current;b&&u-Wt.current>=33?(Qt(e=>e+1),Wt.current=u,zt.current=!1):zt.current=!!b,(cn||g||null!=c.transition||f||c.hasActivePulses||c.hasActiveThresholds||c.hasActiveTopologyDiff||zt.current)&&(Ct.current=requestAnimationFrame(()=>jt.current()))},ci({hydrated:Pt,wasHydratingFromSSR:Lt,storeRef:Yt,dirtyRef:ht,renderFnRef:jt}),a(()=>{ht.current=!0,Mt()},[_,bt,xt,Se,Mt]),Cn(Ue,Yt,ht,Mt,Kt,Zt);const Dn=Oe&&Gt?e(Qi,{x:Gt.x,y:Gt.y,containerWidth:bt,containerHeight:xt,margin:vt,className:"stream-network-tooltip",zIndex:2,children:Ce?Ce(Gt):e(ll,{data:Gt})}):null;if(ni||!Pt&&Lt){const n=Yt.current;if(n){const e=["tree","cluster","treemap","circlepack","partition","orbit"].includes(_),t=e?T||(Array.isArray(L)?void 0:L):void 0;if(e&&t)n.ingestHierarchy(t,[bt,xt]),n.buildScene([bt,xt]);else{const e=Tt,t=Array.isArray($t)?$t:[];(e.length>0||t.length>0)&&(n.ingestBounded(e,t,[bt,xt]),n.buildScene([bt,xt]))}}const o=null!==(f=null==n?void 0:n.sceneNodes)&&void 0!==f?f:[],i=null!==(y=null==n?void 0:n.sceneEdges)&&void 0!==y?y:[],r=null!==(m=null==n?void 0:n.labels)&&void 0!==m?m:[];return t("div",{ref:yt,className:"stream-network-frame"+(Ae?" "+Ae:""),role:"img","aria-label":Ze||("string"==typeof We?We:"Network chart"),style:{position:"relative",width:be?"100%":mt[0],height:xe?"100%":mt[1]},children:[e(Di,{summary:Je}),t("svg",{xmlns:"http://www.w3.org/2000/svg",width:mt[0],height:mt[1],style:{position:"absolute",left:0,top:0},children:[wt&&e("g",{transform:`translate(${vt.left},${vt.top})`,children:wt}),t("g",{transform:`translate(${vt.left},${vt.top})`,children:[Se&&e("rect",{x:0,y:0,width:bt,height:xt,fill:Se}),i.map((t,n)=>function(t,n){switch(t.type){case"line":return e("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-"+n);case"bezier":{const o=t;return e("path",{d:o.pathD,fill:ei(o.style.fill,"#999"),fillOpacity:o.style.fillOpacity,stroke:o.style.stroke||"none",strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},"net-edge-"+n)}case"ribbon":{const o=t;return e("path",{d:o.pathD,fill:ei(o.style.fill,"#999"),fillOpacity:o.style.fillOpacity,stroke:o.style.stroke||"none",strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},"net-edge-"+n)}case"curved":{const o=t;return e("path",{d:o.pathD,fill:ei(o.style.fill,"none"),stroke:o.style.stroke||"#999",strokeWidth:o.style.strokeWidth||1,opacity:o.style.opacity},"net-edge-"+n)}default:return null}}(t,n)).filter(Boolean),o.map((t,n)=>function(t,n){switch(t.type){case"circle":{const o=t;return e("circle",{cx:o.cx,cy:o.cy,r:o.r,fill:ei(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},"net-circle-"+n)}case"rect":{const o=t;return e("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:ei(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},"net-rect-"+n)}case"arc":{const o=t,i=R().innerRadius(o.innerR).outerRadius(o.outerR).startAngle(o.startAngle+Math.PI/2).endAngle(o.endAngle+Math.PI/2)(Jo)||"";return e("path",{d:i,transform:`translate(${o.cx},${o.cy})`,fill:ei(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},"net-arc-"+n)}default:return null}}(t,n)).filter(Boolean),r.map((t,n)=>function(t,n){return e("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-"+n)}(t,n)).filter(Boolean)]})]}),e(Ks,{width:bt,height:xt,totalWidth:mt[0],totalHeight:mt[1],margin:vt,labels:r,sceneNodes:o,title:We,legend:Be,legendPosition:De,legendLayout:Ee,legendHoverBehavior:Ie,legendClickBehavior:Re,legendHighlightedCategory:He,legendIsolatedCategories:Fe,foregroundGraphics:Ft(kt,null===(v=Yt.current)||void 0===v?void 0:v.customLayoutOverlays),annotations:Te,autoPlaceAnnotations:$e,svgAnnotationRules:Ne,annotationFrame:0})]})}const En=Yt.current;return t("div",{ref:yt,className:"stream-network-frame"+(Ae?" "+Ae:""),role:"group","aria-label":Ze||("string"==typeof We?We:"Network chart"),tabIndex:0,style:{position:"relative",width:be?"100%":mt[0],height:xe?"100%":mt[1],overflow:"visible"},onKeyDown:Nn,children:[Ke&&e(Ei,{tableId:Ot}),Ke&&e(Bi,{nodes:null!==(b=null==En?void 0:En.sceneNodes)&&void 0!==b?b:[],edges:null!==(x=null==En?void 0:En.sceneEdges)&&void 0!==x?x:[],chartType:"Network chart",tableId:Ot,chartTitle:"string"==typeof We?We:void 0}),e(Di,{summary:Je}),e(Ii,{hoverPoint:Gt}),t("div",{role:"img","aria-label":Ze||("string"==typeof We?We:"Network chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Oe?Bn:void 0,onMouseLeave:Oe?Mn:void 0,onClick:Me||_e?Pn:void 0,children:[wt&&e("svg",{overflow:"visible",style:{position:"absolute",top:0,left:0,width:mt[0],height:mt[1],pointerEvents:"none",overflow:"visible"},children:e("g",{transform:`translate(${vt.left},${vt.top})`,children:wt})}),e("canvas",{ref:Rt,"aria-label":bi(null!==(w=null===(k=null==En?void 0:En.sceneNodes)||void 0===k?void 0:k.length)&&void 0!==w?w:0,null!==(S=null===(A=null==En?void 0:En.sceneEdges)||void 0===A?void 0:A.length)&&void 0!==S?S:0,"Network chart"),style:{position:"absolute",top:0,left:0}}),e(Ks,{width:bt,height:xt,totalWidth:mt[0],totalHeight:mt[1],margin:vt,labels:(null==En?void 0:En.labels)||[],sceneNodes:null==En?void 0:En.sceneNodes,title:We,legend:Be,legendPosition:De,legendLayout:Ee,legendHoverBehavior:Ie,legendClickBehavior:Re,legendHighlightedCategory:He,legendIsolatedCategories:Fe,foregroundGraphics:Ft(kt,null===(O=Yt.current)||void 0===O?void 0:O.customLayoutOverlays),annotations:Te,autoPlaceAnnotations:$e,svgAnnotationRules:Ne,annotationFrame:Ut}),e(Hi,{active:Ln.current>=0,hoverPoint:Gt,margin:vt,size:mt,shape:null===(C=Tn.current)||void 0===C?void 0:C.shape,width:null===(j=Tn.current)||void 0===j?void 0:j.w,height:null===(M=Tn.current)||void 0===M?void 0:M.h}),Dn,(null==Ue?void 0:Ue.showBadge)&&e(jn,{isStale:Kt,position:Ue.badgePosition})]})]})});function ul(e){const{title:t,description:n,summary:o,accessibleTable:i,className:r,animate:a,axisExtent:s,autoPlaceAnnotations:l}=e,c={};return t&&(c.title=t),n&&(c.description=n),o&&(c.summary=o),void 0!==i&&(c.accessibleTable=i),r&&(c.className=r),null!=a&&(c.animate=a),void 0!==s&&(c.axisExtent=s),void 0!==l&&(c.autoPlaceAnnotations=l),c}function dl(e){const{linkedHover:t,onObservation:n,onClick:o,hoverHighlight:i,customHoverBehavior:r,customClickBehavior:a,linkedHoverInClickPredicate:s=!0}=e,l={};return(t||n||o||i)&&(l.customHoverBehavior=r),(s?n||o||t:n||o)&&(l.customClickBehavior=a),l}function hl(e){const{tooltip:t,defaultTooltipContent:n}=e;return{tooltipContent:!1===t?()=>null:Ui(t)||n}}function gl(e){return"string"==typeof e?e:"value"}function fl(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function pl(e,t){if(!t)return fl(e);try{const n=t(e);return null==n?fl(e):n}catch(t){return fl(e)}}function yl(e,t){return"function"==typeof t?t(e):e[t]}function ml(e,t){if(!e)return[];const n=[];return(Array.isArray(e)?e:[e]).forEach((e,o)=>{const i="string"==typeof(null==e?void 0:e.y1Accessor)?e.y1Accessor:"high";n.push({label:"string"==typeof(null==e?void 0:e.y0Accessor)?e.y0Accessor:"low",accessor:e=>{var t,n,i,r;return null!==(i=null===(n=null===(t=null==e?void 0:e.bands)||void 0===t?void 0:t[o])||void 0===n?void 0:n.y0)&&void 0!==i?i:0===o?null===(r=null==e?void 0:e.band)||void 0===r?void 0:r.y0:void 0},format:t}),n.push({label:i,accessor:e=>{var t,n,i,r;return null!==(i=null===(n=null===(t=null==e?void 0:e.bands)||void 0===t?void 0:t[o])||void 0===n?void 0:n.y1)&&void 0!==i?i:0===o?null===(r=null==e?void 0:e.band)||void 0===r?void 0:r.y1:void 0},format:t})}),n}function vl(n){const o=n.find(e=>"title"===e.role),i=n.filter(e=>"title"!==e.role);return n=>{const r=n.data;if(!r)return null;const a=o?pl(yl(r,o.accessor),o.format):null;return t("div",{className:"semiotic-tooltip",style:zi,children:[null!=a&&e("div",{style:{fontWeight:"bold",marginBottom:i.length>0?4:0},children:a}),i.map((n,o)=>{const i=pl(yl(r,n.accessor),n.format);return t("div",{style:o>0?{marginTop:2}:void 0,children:[t("span",{style:{opacity:.7},children:[n.label,": "]}),e("span",{children:i})]},o)})]})}}function bl({categoryAccessor:n,valueAccessor:o,groupAccessor:i,groupLabel:r,pieData:a=!1,valueFormat:s}){return l=>{var c;const u=a?(null===(c=l.data)||void 0===c?void 0:c[0])||l.data||l:l.data||l,d=yl(u,n),h=yl(u,o),g=i?yl(u,i):void 0;return t("div",{className:"semiotic-tooltip",style:zi,children:[e("div",{style:{fontWeight:"bold"},children:fl(d)}),e("div",{style:{marginTop:4},children:pl(h,s)}),null!=g&&t("div",{style:{marginTop:2,opacity:.8},children:[r||gl(i),": ",fl(g)]})]})}}cl.displayName="StreamNetworkFrame";const xl=u(null);function kl({colors:t,categories:n,colorScheme:o="category10",children:i}){const a=r(()=>{if(t)return t;if(n){const e=Array.isArray(o)?o:ht[o]||gt,t={};for(let o=0;n.length>o;o++)t[n[o]]=e[o%e.length];return t}return{}},[t,n,o]);return e(xl.Provider,{value:a,children:i})}function wl(){return s(xl)}function Al(e){const t=[];for(const[n,o]of Object.entries(e.fields))if("point"===o.type)t.push(e=>o.values.has(e[n]));else{const[e,i]=o.range;t.push(t=>{const o=t[n];return o>=e&&i>=o})}return e=>t.every(t=>t(e))}function Sl(e,t){const n=[];for(const[o,i]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(Al(i));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}function Ol(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}kl.displayName="CategoryColorProvider";const[Cl,jl]=be(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),i=Ol(o,t),r=new Map(i.clauses);return r.set(n.clientId,n),o.set(t,Object.assign(Object.assign({},i),{clauses:r})),{selections:o}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o)return{};const i=new Map(e.selections),r=new Map(o.clauses);return r.delete(n),i.set(t,Object.assign(Object.assign({},o),{clauses:r})),{selections:i}})},setResolution(t,n){e(e=>{const o=new Map(e.selections),i=Ol(o,t);return o.set(t,Object.assign(Object.assign({},i),{resolution:n})),{selections:o}})},clearSelection(t){e(e=>{const n=new Map(e.selections),o=n.get(t);return o&&n.set(t,Object.assign(Object.assign({},o),{clauses:new Map})),{selections:n}})}})),[Ml,_l]=be(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const n=e.observations;return n.push(t),n.length>e.maxObservations&&n.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));function Pl(e){const t=f(),n=e.clientId||t,{name:o}=e,i=jl(e=>e.selections.get(o)),a=jl(e=>e.setClause),s=jl(e=>e.clearClause),c=r(()=>!!i&&i.clauses.size>0,[i]);return{predicate:r(()=>i&&0!==i.clauses.size?Sl(i,n):()=>!0,[i,n]),isActive:c,selectPoints:l(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};a(o,{clientId:n,type:"point",fields:t})},[n,o,a]),selectInterval:l(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};a(o,{clientId:n,type:"interval",fields:t})},[n,o,a]),clear:l(()=>{s(o,n)},[s,o,n]),clientId:n}}function Ll(e,t){const n=f(),o=t||n,i=jl(e=>e.setClause),r=jl(e=>e.clearClause);return{selectPoints:l(t=>{const n={};for(const[e,o]of Object.entries(t))n[e]={type:"point",values:new Set(o)};i(e,{clientId:o,type:"point",fields:n})},[e,o,i]),clear:l(()=>r(e,o),[e,o,r]),clientId:o}}function Tl(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:i,selectPoints:r,clear:a}=Pl({name:t});return{onHover:l(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&&r(t)},[n,r,a,t]),predicate:o,isActive:i}}function $l(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function Nl(e){const{name:t,xField:n,yField:o}=e,{predicate:i,isActive:a,selectInterval:s,clear:c}=Pl({name:t}),u=n&&o?"xyBrush":n?"xBrush":"yBrush",d=l(e=>{if(!e)return void c();const t={};"xyBrush"===u&&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])]),o&&(t[o]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===u&&$l(e)?n&&(t[n]=[Math.min(...e),Math.max(...e)]):"yBrush"===u&&$l(e)&&o&&(t[o]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&s(t)},[u,n,o,s,c]);return{brushInteraction:r(()=>({brush:u,during:d,end:d}),[u,d]),predicate:i,isActive:a,clear:c}}function Bl(e,t,n){const o=jl(e=>e.selections.get(t));return r(()=>{if(!o||0===o.clauses.size)return e;const t=Sl(o,n);return e.filter(t)},[e,o,n])}function Dl(e={}){const{limit:t=50,types:n,chartId:o}=e,i=_l(e=>e.version),a=_l(e=>e.observations),s=_l(e=>e.clearObservations),l=r(()=>{let e=a;if(n&&n.length>0){const t=new Set(n);e=e.filter(e=>t.has(e.type))}return o&&(e=e.filter(e=>e.chartId===o)),e.length>t&&(e=e.slice(e.length-t)),e},[a,n,o,t,i]);return{observations:l,latest:l.length>0?l[l.length-1]:null,clear:s}}const El=u(!1),Il=u(null),Rl="undefined"==typeof window?a:h;function Hl(e){const t=new Set,n=[];for(const o of e)t.has(o)||(t.add(o),n.push(o));return n}function Fl(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0}function Wl(e){const t=s(Il),n=f(),o=Hl(e),r=i([]);Fl(r.current,o)||(r.current=o);const a=r.current;Rl(()=>{if(t)return()=>t.unregisterCategories(n)},[t,n]),Rl(()=>{t&&t.registerCategories(n,a)},[t,n,a])}function zl({selections:e}){const t=jl(e=>e.setResolution);return a(()=>{for(const[n,o]of Object.entries(e))o.resolution&&t(n,o.resolution)},[e,t]),null}function Yl({categoryColors:t,interaction:n,selectionName:o,field:s}){const c=Object.entries(t),u=c.map(([e])=>e),h=[{styleFn:e=>({fill:e.color||"#333",stroke:e.color||"#333"}),type:"fill",items:c.map(([e,t])=>({label:e,color:t})),label:""}],g=Tl({name:o,fields:[s]}),f=Pl({name:o,clientId:"__linked-legend-isolate__"}),[p,y]=d(new Set),[m,v]=d(null),b=i(f.selectPoints);b.current=f.selectPoints;const x=i(f.clear);x.current=f.clear,a(()=>{"isolate"===n&&(p.size>0?b.current({[s]:Array.from(p)}):x.current())},[n,p,s]);const k=l(e=>{"highlight"===n&&(e?(v(e.label),g.onHover({[s]:e.label})):(v(null),g.onHover(null)))},[n,s,g]),w=l(e=>{"isolate"===n&&y(t=>{const n=new Set(t);return n.has(e.label)?n.delete(e.label):n.add(e.label),n.size===u.length?new Set:n})},[n,u.length]),[A,[S]]=Zi([0,0],!0,!1),O=r(()=>function(e,t){if(!t||0===e.length)return 1;let n=0,o=1;for(const i of e){const e=26+7*i.length;n>0&&n+e>t&&(o++,n=0),n+=e}return o}(c.map(([e])=>e),S),[c,S]);return 0===c.length?null:e("div",{ref:A,style:{width:"100%",display:"block"},children:e("svg",{width:"100%",height:Math.max(30,22*O+8),style:{display:"block",overflow:"visible"},children:e(Nn,{legendGroups:h,title:!1,orientation:"horizontal",width:S,height:20,customHoverBehavior:"highlight"===n?k:void 0,customClickBehavior:"isolate"===n?w:void 0,highlightedCategory:m,isolatedCategories:p})})})}function Gl({children:n,selections:o,showLegend:a,legendPosition:s="top",legendInteraction:l="none",legendSelectionName:c="legend",legendField:u="category"}){const h=wl(),[g,f]=d({}),p=i({}),y=r(()=>({registerCategories:(e,t)=>{const n=Hl(t);f(t=>{var o;return Fl(null!==(o=t[e])&&void 0!==o?o:[],n)?t:Object.assign(Object.assign({},t),{[e]:n})})},unregisterCategories:e=>{f(t=>{if(!(e in t))return t;const n=Object.assign({},t);return delete n[e],n})}}),[]),m=r(()=>{const e=[];for(const t of Object.values(g))for(const n of t)e.push(n);return Hl(e)},[g]),v=r(()=>{var e;const t=null!=h?h:{},n=p.current;let o=Object.keys(t).length+Object.keys(n).length;for(const e of m)t[e]||n[e]||(n[e]=gt[o%gt.length],o++);const i=Object.assign({},t);for(const o of m)i[o]=null!==(e=t[o])&&void 0!==e?e:n[o];return i},[h,m]),b=void 0===a||a,x=b&&Object.keys(v).length>0;return e(Cl,{children:t(Ml,{children:[o&&e(zl,{selections:o}),e(Il.Provider,{value:y,children:e(kl,{colors:v,children:t(El.Provider,{value:x,children:[b&&"top"===s&&e(Yl,{categoryColors:v,interaction:l,selectionName:c,field:u}),n,b&&"bottom"===s&&e(Yl,{categoryColors:v,interaction:l,selectionName:c,field:u})]})})})]})})}function ql({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:i,strokeWidth:r,categories:a}){const s=(a&&a.length>0?a:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((i,r)=>{const a=e.find("function"==typeof t?e=>t(e)===i:e=>e[t]===i),s=a?o(a,t,n):n?n(i):ft[r%ft.length];return{label:i+"",color:s}});return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==i&&(n.stroke=i),void 0!==r&&(n.strokeWidth=r),n},type:"fill",items:s,label:""}]}}function Xl(e){return e?"string"==typeof e?{name:e}:e:null}function Vl(e,t,n){return t?(o,...i)=>{var r;const a=Object.assign({},e(o,...i));if(t.isActive)if(t.predicate(o))(null==n?void 0:n.selectedStyle)&&Object.assign(a,n.selectedStyle);else{const e=null!==(r=null==n?void 0:n.unselectedOpacity)&&void 0!==r?r:.5;a.opacity=e,a.fillOpacity=e,a.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(a,n.unselectedStyle)}return a}:e}const Ul=["#6929c4","#1192e8","#005d5d","#9f1853","#fa4d56","#570408","#198038","#002d9c","#ee538b","#b28600","#009d9a","#012749","#8a3800","#a56eff"],Ql={danger:"#da1e28",warning:"#f1c21b",success:"#24a148",info:"#0043ce"},Kl={light:Se,dark:Oe,"high-contrast":Ce,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 Zl(e){return Kl[e]}function Jl(e,t=":root"){var n,o,i,r,a;const s=[];return s.push(` --semiotic-bg: ${e.colors.background};`),s.push(` --semiotic-text: ${e.colors.text};`),s.push(` --semiotic-text-secondary: ${e.colors.textSecondary};`),s.push(` --semiotic-grid: ${e.colors.grid};`),s.push(` --semiotic-border: ${e.colors.border};`),s.push(` --semiotic-primary: ${e.colors.primary};`),s.push(` --semiotic-font-family: ${e.typography.fontFamily};`),e.colors.focus&&s.push(` --semiotic-focus: ${e.colors.focus};`),e.colors.selection&&s.push(` --semiotic-selection-color: ${e.colors.selection};`),null!=e.colors.selectionOpacity&&s.push(` --semiotic-selection-opacity: ${e.colors.selectionOpacity};`),e.colors.diverging&&s.push(` --semiotic-diverging: ${e.colors.diverging};`),(null===(n=e.tooltip)||void 0===n?void 0:n.background)&&s.push(` --semiotic-tooltip-bg: ${e.tooltip.background};`),(null===(o=e.tooltip)||void 0===o?void 0:o.text)&&s.push(` --semiotic-tooltip-text: ${e.tooltip.text};`),(null===(i=e.tooltip)||void 0===i?void 0:i.borderRadius)&&s.push(` --semiotic-tooltip-radius: ${e.tooltip.borderRadius};`),(null===(r=e.tooltip)||void 0===r?void 0:r.fontSize)&&s.push(` --semiotic-tooltip-font-size: ${e.tooltip.fontSize};`),(null===(a=e.tooltip)||void 0===a?void 0:a.shadow)&&s.push(` --semiotic-tooltip-shadow: ${e.tooltip.shadow};`),e.borderRadius&&s.push(` --semiotic-border-radius: ${e.borderRadius};`),e.colors.annotation&&s.push(` --semiotic-annotation-color: ${e.colors.annotation};`),null!=e.typography.legendSize&&s.push(` --semiotic-legend-font-size: ${e.typography.legendSize}px;`),null!=e.typography.titleFontSize&&s.push(` --semiotic-title-font-size: ${e.typography.titleFontSize}px;`),null!=e.typography.tickFontFamily&&s.push(` --semiotic-tick-font-family: ${e.typography.tickFontFamily};`),null!=e.typography.tickSize&&s.push(` --semiotic-tick-font-size: ${e.typography.tickSize}px;`),null!=e.typography.labelSize&&s.push(` --semiotic-axis-label-font-size: ${e.typography.labelSize}px;`),s.push(` --semiotic-secondary: ${e.colors.secondary||e.colors.primary};`),s.push(` --semiotic-surface: ${e.colors.surface||e.colors.background};`),e.colors.success&&s.push(` --semiotic-success: ${e.colors.success};`),e.colors.danger&&s.push(` --semiotic-danger: ${e.colors.danger};`),e.colors.warning&&s.push(` --semiotic-warning: ${e.colors.warning};`),e.colors.error&&s.push(` --semiotic-error: ${e.colors.error};`),e.colors.info&&s.push(` --semiotic-info: ${e.colors.info};`),`${t} {\n${s.join("\n")}\n}`}function ec(e){var t,n,o,i,r,a;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===(n=e.tooltip)||void 0===n?void 0:n.text)||e.colors.text,$type:"color"},radius:{$value:(null===(o=e.tooltip)||void 0===o?void 0:o.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!==(a=e.colors.selectionOpacity)&&void 0!==a?a:.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"}}:{})}}const tc=o.createContext(void 0),nc="undefined"==typeof window?o.useEffect:o.useLayoutEffect;function oc(e){if("string"!=typeof e)return e;if("light"===e||"dark"===e||"high-contrast"===e)return e;return Zl(e)||(void 0!==console&&console.warn(`[ThemeProvider] Unknown theme preset "${e}". Falling back to light theme.`),"light")}function ic({theme:e}){const t=_e(e=>e.setTheme),n=_e(e=>e.theme),i=o.useRef(n);i.current=n;const r=o.useRef(null);o.useEffect(()=>{if(void 0!==e)return;if("undefined"==typeof window||!window.matchMedia)return;const n=window.matchMedia("(forced-colors: active)");return n.matches&&(r.current=i.current===Ce?Se:i.current,t("high-contrast")),Ki(n,e=>{var n,o;e.matches?(r.current=i.current===Ce?null!==(n=r.current)&&void 0!==n?n:Se:i.current,t("high-contrast")):(function(e,t){e(t===Se?"light":t===Oe?"dark":t===Ce?"high-contrast":t)}(t,null!==(o=r.current)&&void 0!==o?o:Se),r.current=null)})},[e,t]);const a=o.useRef(!1);return nc(()=>{a.current?void 0!==e&&t(oc(e)):a.current=!0},[e,t]),null}function rc({children:t}){var n,i,r,a,s;const l=_e(e=>e.theme),c=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":l.colors.background,"--semiotic-text":l.colors.text,"--semiotic-text-secondary":l.colors.textSecondary,"--semiotic-grid":l.colors.grid,"--semiotic-border":l.colors.border,"--semiotic-cell-border":l.colors.cellBorder||l.colors.border,"--semiotic-primary":l.colors.primary,"--semiotic-font-family":l.typography.fontFamily},l.colors.focus?{"--semiotic-focus":l.colors.focus}:{}),(null===(n=l.tooltip)||void 0===n?void 0:n.background)?{"--semiotic-tooltip-bg":l.tooltip.background}:{}),(null===(i=l.tooltip)||void 0===i?void 0:i.text)?{"--semiotic-tooltip-text":l.tooltip.text}:{}),(null===(r=l.tooltip)||void 0===r?void 0:r.borderRadius)?{"--semiotic-tooltip-radius":l.tooltip.borderRadius}:{}),(null===(a=l.tooltip)||void 0===a?void 0:a.fontSize)?{"--semiotic-tooltip-font-size":l.tooltip.fontSize}:{}),(null===(s=l.tooltip)||void 0===s?void 0:s.shadow)?{"--semiotic-tooltip-shadow":l.tooltip.shadow}:{}),l.borderRadius?{"--semiotic-border-radius":l.borderRadius}:{}),l.colors.selection?{"--semiotic-selection-color":l.colors.selection}:{}),null!=l.colors.selectionOpacity?{"--semiotic-selection-opacity":l.colors.selectionOpacity+""}:{}),l.colors.diverging?{"--semiotic-diverging":l.colors.diverging}:{}),l.colors.annotation?{"--semiotic-annotation-color":l.colors.annotation}:{}),null!=l.typography.legendSize?{"--semiotic-legend-font-size":l.typography.legendSize+"px"}:{}),null!=l.typography.titleFontSize?{"--semiotic-title-font-size":l.typography.titleFontSize+"px"}:{}),null!=l.typography.tickFontFamily?{"--semiotic-tick-font-family":l.typography.tickFontFamily}:{}),null!=l.typography.tickSize?{"--semiotic-tick-font-size":l.typography.tickSize+"px"}:{}),null!=l.typography.labelSize?{"--semiotic-axis-label-font-size":l.typography.labelSize+"px"}:{}),{"--semiotic-secondary":l.colors.secondary||l.colors.primary,"--semiotic-surface":l.colors.surface||l.colors.background}),l.colors.success?{"--semiotic-success":l.colors.success}:{}),l.colors.danger?{"--semiotic-danger":l.colors.danger}:{}),l.colors.warning?{"--semiotic-warning":l.colors.warning}:{}),l.colors.error?{"--semiotic-error":l.colors.error}:{}),l.colors.info?{"--semiotic-info":l.colors.info}:{}),u=o.useContext(tc),d={};return u&&(d["data-semiotic-theme"]=u),e("div",Object.assign({style:c},d,{children:t}))}function ac({theme:n,children:i}){const r="string"==typeof n&&Zl(n)?n:void 0,a=o.useMemo(()=>function(e){return void 0!==e?je(Se,oc(e)):"undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(forced-colors: active)").matches?Ce:Se}(n),[n]);return e(Me,{initialState:{theme:a},children:t(tc.Provider,{value:r,children:[e(ic,{theme:n}),e(rc,{children:i})]})})}function sc(){return _e(e=>e.theme)}const lc="#007bff";function cc(e,t,n){var o;const i=null!==(o=e.xValue)&&void 0!==o?o:null==t?void 0:t[n];if(null==i)return null;const r=Number(i);return Number.isFinite(r)?r:null}function uc(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 dc(){var e;const t=sc(),n=null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.categorical;return n&&n.length>0?n:void 0}function hc(e,t,n,o,i){if(e)return e;let r;if(Array.isArray(n))r=n;else if(t&&t.length>0)r=t;else if("string"==typeof n){const e=ht[n];Array.isArray(e)&&(r=e)}return r&&0!==r.length?null!=o?(i.has(o)||i.set(o,i.size),r[i.get(o)%r.length]):r[0]:lc}function gc(e,t,n){const o=wl(),i=dc();return r(()=>{var r;if(!t)return;const a=null!==(r=null!=n?n:i&&i.length>0?i:void 0)&&void 0!==r?r:"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>t(e)+"")));if(o&&Object.keys(o).length>0){const e=vt(n.map(e=>({_cat:e})),"_cat",a);return t=>o[t]||e(t)}return vt(n.map(e=>({_cat:e})),"_cat",a)}if(o&&Object.keys(o).length>0){const n=vt(e,t,a);return e=>o[e]||n(e)}return vt(e,t,a)}if(o&&Object.keys(o).length>0){const e=vt([{_:"a"}],"_",a);return t=>o[t]||e(t)}},[e,t,n,o,i])}function fc(e,t,n){return r(()=>{if(!t||"auto"===t||"function"==typeof t)return e;const o=[...e],i=function(e){return"function"==typeof e?e:t=>t[e]}(n);return o.sort("asc"===t?(e,t)=>i(e)-i(t):(e,t)=>i(t)-i(e))},[e,t,n])}function pc({selection:e,linkedHover:t,fallbackFields:n=[],unwrapData:o=!1,onObservation:i,chartType:s,chartId:c,onClick:u,hoverHighlight:h,colorByField:g}){const p=f(),y=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,n),m="series"===(null==y?void 0:y.mode)?[y.seriesField||g||n[0]].filter(e=>!!e):(null==y?void 0:y.fields)||n||[],v=Pl({name:(null==e?void 0:e.name)||"__unused__"}),b=Tl({name:(null==y?void 0:y.name)||"hover",fields:m}),x=_l(e=>e.pushObservation),k=e?{isActive:v.isActive,predicate:v.predicate}:null,[w,A]=d(null),S=g||n[0],O=r(()=>{if(!h||null==w||!S)return null;const e=w,t=S;return{isActive:!0,predicate:n=>{var o;return("string"==typeof n[t]?n[t]:(null!==(o=n[t])&&void 0!==o?o:"")+"")===e}}},[h,w,S]),C=l(e=>{var n,o;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==y?void 0:y.mode)&&y.xField){const n=cc(e,t,y.xField);null!=n&&function(e,t,n){const o=Mo.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(Mo={positions:new Map(Mo.positions).set(e,{xValue:t,sourceId:n})},Po())}(y.name||"hover",n,p)}"x-position"!==(null==y?void 0:y.mode)&&b.onHover(t)}else"x-position"===(null==y?void 0:y.mode)&&Lo(y.name||"hover",p),"x-position"!==(null==y?void 0:y.mode)&&b.onHover(null);if(h&&S)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[S];A(null!=n?n+"":null)}else A(null);if(i||x){const t={timestamp:Date.now(),chartType:s||"unknown",chartId:c};if(e){const r=uc(e),a=Object.assign(Object.assign({},t),{type:"hover",datum:r||{},x:null!==(n=e.x)&&void 0!==n?n:0,y:null!==(o=e.y)&&void 0!==o?o:0});i&&i(a),x&&x(a)}else{const e=Object.assign(Object.assign({},t),{type:"hover-end"});i&&i(e),x&&x(e)}}},[t,b,y,p,i,s,c,x,h,S]),j=l(e=>{var t,n,o,r;if("x-position"===(null==y?void 0:y.mode)&&y.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=cc(e,t,y.xField);null!=n&&function(e,t,n){const o=Mo.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(Mo.positions);return t.delete(e),Mo={positions:t},Po(),!1}Mo={positions:new Map(Mo.positions).set(e,{xValue:t,sourceId:n,locked:!0})},Po()}(y.name||"hover",n,p)}if(e&&u){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),u(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(i||x){const t={timestamp:Date.now(),chartType:s||"unknown",chartId:c};if(e){const n=uc(e),a=Object.assign(Object.assign({},t),{type:"click",datum:n||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(r=e.y)&&void 0!==r?r:0});i&&i(a),x&&x(a)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});i&&i(e),x&&x(e)}}},[u,i,x,s,c,y,p]);return a(()=>{if("x-position"!==(null==y?void 0:y.mode))return;const e=y.name||"hover";return()=>{To(e,p),Lo(e,p)}},[null==y?void 0:y.mode,null==y?void 0:y.name,p]),{activeSelectionHook:k,hoverSelectionHook:O,customHoverBehavior:C,customClickBehavior:j,crosshairSourceId:p}}function yc(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===(null==n?void 0:n.mode))return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}function mc({data:e,colorBy:t,colorScale:n,showLegend:o,legendPosition:i="right",userMargin:a,defaults:l={top:50,bottom:60,left:70,right:40},categories:c}){const u=s(El),d=null!==s(Il),h=void 0!==o?o:!u&&!!t,g=!!t&&(h||d),f=r(()=>{if(!g)return[];if(void 0!==c)return c;const n=new Set;for(const o of e){const e="function"==typeof t?t(o):o[t];null!=e&&n.add(e+"")}return Array.from(n)},[c,t,e,g]);Wl(d&&t?f:[]);const p=r(()=>{if(!h||!t)return;const o=ql({data:e,colorBy:t,colorScale:n,getColor:mt,categories:f}),i=o.legendGroups.reduce((e,t)=>e+t.items.length,0);return 0!==i?o:void 0},[h,t,e,n,f]),y=r(()=>{const e="number"==typeof a?{top:a,bottom:a,left:a,right:a}:null!=a?a:{},t=t=>{const n=e[t];return"number"==typeof n?n:l[t]},n={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},o=t=>"number"==typeof e[t];return p&&("right"===i&&!o("right")&&110>n.right?n.right=110:"left"===i&&!o("left")&&110>n.left?n.left=110:"top"===i&&!o("top")&&50>n.top?n.top=50:"bottom"===i&&!o("bottom")&&80>n.bottom&&(n.bottom=80)),n},[l,a,p,i]);return{legend:p,margin:y,legendPosition:i}}function vc(e,t,n){const[o,i]=d(null),[a,s]=d(new Set),c=l(t=>{"highlight"===e&&i(t?t.label:null)},[e]),u=l(t=>{"isolate"===e&&s(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]),h=r(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=o?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===o}:"isolate"===e&&a.size>0?{isActive:!0,predicate:e=>{const o=n?e[n]:"function"==typeof t?t(e):null;return a.has(o)}}:null},[e,t,o,a]);return{highlightedCategory:"highlight"===e?o:null,isolatedCategories:"isolate"===e?a:new Set,onLegendHover:c,onLegendClick:u,legendSelectionHook:h}}const bc={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 xc(e,t,n){var o,i,r,a,s,l,c;const u=bc[e||"primary"],d="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:e&&"primary"!==e||!(null==n?void 0:n.width)?u.width:n.width,height:null!==(i=t.height)&&void 0!==i?i:e&&"primary"!==e||!(null==n?void 0:n.height)?u.height:n.height,showAxes:null!==(r=t.showAxes)&&void 0!==r?r:u.showAxes,showGrid:null!==(a=t.showGrid)&&void 0!==a?a:u.showGrid,enableHover:null!==(s=t.enableHover)&&void 0!==s?s:!!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:kc(u.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:d}}function kc(e,t,n){if(!1!==t)return e;const o=Object.assign({},e);return"horizontal"===n?o.left=Math.min(o.left,15):o.bottom=Math.min(o.bottom,15),o}function wc({componentName:n,message:o,diagnosticHint:i,width:r,height:a}){return e("div",{role:"alert",style:{width:r,height:Math.max(a,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:t("div",{style:{textAlign:"center",maxWidth:400},children:[e("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:n}),e("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:o}),i&&e("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:i})]})})}class Ac extends o.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var n,o;null===(o=(n=this.props).onError)||void 0===o||o.call(n,e,t)}render(){if(this.state.error){const{fallback:t}=this.props,n=this.state.error;return"function"==typeof t?t(n):void 0!==t?t:e(wc,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}var Sc;const Oc="undefined"!=typeof process&&"production"!==(null===(Sc=process.env)||void 0===Sc?void 0:Sc.NODE_ENV);function Cc({componentName:t,width:n,height:o,children:i}){return e(Ac,{fallback:i=>e(wc,{componentName:t,message:i.message,width:n,height:o}),children:i})}const jc={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"},Mc={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function _c(t,n,o,i){return!1===i||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e("div",{style:Object.assign(Object.assign({},jc),{width:n,height:o}),children:i||"No data available"}):null}function Pc(t,n,o,i){if(!t)return null;if(!1===i)return null;if(null!=i)return e("div",{style:{width:n,height:o,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:i});const r=Math.min(5,Math.floor(o/40)),a=Math.max(8,Math.floor(o/(3*r))),s=Math.max(6,Math.floor(o/(2.5*r))),l=Math.floor((o-(r*(a+s)-s))/2);return e("div",{style:{width:n,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:r},(t,o)=>e("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},Mc),{position:"absolute",top:l+o*(a+s),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:a,opacity:.5+o%2*.2})},o))})}function Lc(e,t,n,o){if(!Oc)return;if(!t||0===t.length)return;if("string"!=typeof o)return;const i=t[0];if(!i||"object"!=typeof i)return;if(o in i)return;const r=Object.keys(i).join(", ");console.warn(`[semiotic] ${e}: ${n} "${o}" not found in data. Available keys: ${r}`)}function Tc(e,t){const n=e.length,o=t.length,i=Array(o+1);for(let e=0;o>=e;e++)i[e]=e;for(let r=1;n>=r;r++){let n=i[0];i[0]=r;for(let a=1;o>=a;a++){const o=i[a];i[a]=e[r-1]===t[a-1]?n:1+Math.min(n,i[a],i[a-1]),n=o}}return i[o]}function $c(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function Nc(e,t){var n;if(0===t.length)return null;const o=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(o)||o.includes(e.toLowerCase()))||(null!==(n=function(e,t,n=3){let o,i=n+1;for(const n of t){const t=Tc(e.toLowerCase(),n.toLowerCase());i>t&&(i=t,o=n)}return i>n?void 0:o}(e,t,3))&&void 0!==n?n:null)}function Bc({componentName:e,data:t,accessors:n,requiredProps:o}){if(o)for(const[t,n]of Object.entries(o))if(null==n)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(n){const o=$c(t).find(e=>e&&"object"==typeof e);if(o){const t=Object.keys(o);for(const[i,r]of Object.entries(n))if(r&&"string"==typeof r&&!(r in o)){const n=Nc(r,t),o=n?` Try ${i}="${n}".`:"";return`${e}: ${i} "${r}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}function Dc({componentName:e,data:t,dataLabel:n="data"}){return null==t?`${e}: No ${n} provided. Pass a hierarchical object with children: { name: "root", children: [...] }.`:Array.isArray(t)?`${e}: ${n} 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 Ec({componentName:e,nodes:t,edges:n,nodesRequired:o=!1,edgesRequired:i=!0,accessors:r}){if(null==t&&null==n)return null;if(i&&(!n||!Array.isArray(n)||0===n.length))return e+': No edges provided. Pass a non-empty array: edges={[{ source: "A", target: "B", value: 10 }, ...]}.';if(o&&(!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 n=$c(t).find(e=>e&&"object"==typeof e);if(n){const t=Object.keys(n);for(const[o,i]of Object.entries(r))if(i&&"string"==typeof i&&!(i in n)){const n=Nc(i,t),r=n?` Try ${o}="${n}".`:"";return`${e}: ${o} "${i}" not found in node data. Available fields: ${t.join(", ")}.${r}`}}}return null}function Ic(e){const t=_e(e=>e.theme.colors.selectionOpacity);return r(()=>{var n,o;if(void 0!==e||void 0!==t)return Object.assign(Object.assign({name:null!==(n=null==e?void 0:e.name)&&void 0!==n?n:""},e),{unselectedOpacity:null!==(o=null==e?void 0:e.unselectedOpacity)&&void 0!==o?o:t})},[e,t])}function Rc(e){const{data:t,rawData:n,colorBy:o,colorScheme:i,legendInteraction:a,legendPosition:s,selection:c,linkedHover:u,fallbackFields:h,unwrapData:g=!1,onObservation:f,chartType:p,chartId:y,showLegend:m,userMargin:v,marginDefaults:b,onClick:x,hoverHighlight:k,loading:w,loadingContent:A,emptyContent:S,width:O,height:C}=e,j=void 0===n,M=r(()=>me(t),[t]),[_,P]=d([]),L=l(e=>{P(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[]),T="string"==typeof e.colorBy?e.colorBy:void 0,{activeSelectionHook:$,hoverSelectionHook:N,customHoverBehavior:B,customClickBehavior:D,crosshairSourceId:E}=pc({selection:c,linkedHover:u,fallbackFields:h,unwrapData:g,onObservation:f,chartType:p,chartId:y,onClick:x,hoverHighlight:k,colorByField:T}),I=yc(u,E),R=gc(M,o,i),H=r(()=>{if(!o)return[];const e=new Set;for(const t of M){const n="function"==typeof o?o(t):t[o];null!=n&&e.add(n+"")}return Array.from(e)},[M,o]),F=r(()=>j&&_.length>0?_:H,[j,_,H]),W=vc(a,o,F),z=r(()=>N||(W.legendSelectionHook?W.legendSelectionHook:$),[N,W.legendSelectionHook,$]),Y=Ic(c),G=dc(),q=wl(),X=r(()=>{if(R)return R;if(!o||0===F.length)return;const e=Array.isArray(i)&&i.length>0||"string"==typeof i&&i.length>0?i:G&&G.length>0?G:ft,t="__streamCat",n=vt(F.map(e=>({[t]:e})),t,e);return e=>(null==q?void 0:q[e])||n(e)||"#999"},[R,o,F,i,G,q]),{legend:V,margin:U,legendPosition:Q}=mc({data:M,colorBy:o,colorScale:X,showLegend:m,legendPosition:s,userMargin:v,defaults:b,categories:F}),K=r(()=>{const e={};return V&&(e.legend=V,e.legendPosition=Q),a&&"none"!==a&&(e.legendHoverBehavior=W.onLegendHover,e.legendClickBehavior=W.onLegendClick,e.legendHighlightedCategory=W.highlightedCategory,e.legendIsolatedCategories=W.isolatedCategories),j&&o&&(e.legendCategoryAccessor=o,e.onCategoriesChange=L),e},[V,Q,a,W.onLegendHover,W.onLegendClick,W.highlightedCategory,W.isolatedCategories,j,o,L]),Z=Array.isArray(n)?me(n):n,J=Pc(w,O,C,A),ee=J?null:_c(Z,O,C,S);return{data:M,colorScale:R,allCategories:F,legendState:W,effectiveSelectionHook:z,activeSelectionHook:$,customHoverBehavior:B,customClickBehavior:D,legend:V,margin:U,legendPosition:Q,earlyReturn:J||ee||null,legendBehaviorProps:K,crosshairProps:I,resolvedSelection:Y}}function Hc(e,t){const{variant:n,frameRef:o,overrides:i,deps:r}=t;p(e,()=>{const e=function(e,t){if("xy"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o;return null!==(o=null===(n=e.current)||void 0===n?void 0:n.remove(t))&&void 0!==o?o:[]},update:(t,n)=>{var o,i;return null!==(i=null===(o=e.current)||void 0===o?void 0:o.update(t,n))&&void 0!==i?i:[]},clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getScales())&&void 0!==n?n:null}}}if("network"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o,i,r,a;const s=Array.isArray(t)?t:[t],l=null!==(i=null===(o=null===(n=e.current)||void 0===n?void 0:n.getTopology())||void 0===o?void 0:o.nodes)&&void 0!==i?i:[],c=[];for(const t of s){const n=l.find(e=>e.id===t);n&&c.push(Object.assign(Object.assign({},null!==(r=n.data)&&void 0!==r?r:{}),{id:t})),null===(a=e.current)||void 0===a||a.removeNode(t)}return c},update:(t,n)=>(Array.isArray(t)?t:[t]).flatMap(t=>{var o;const i=null===(o=e.current)||void 0===o?void 0:o.updateNode(t,n);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,n,o,i;return null!==(i=null===(o=null===(n=null===(t=e.current)||void 0===t?void 0:t.getTopology())||void 0===n?void 0:n.nodes)||void 0===o?void 0:o.map(e=>e.data))&&void 0!==i?i:[]}}}if("geo-points"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o;return null!==(o=null===(n=e.current)||void 0===n?void 0:n.removePoint(t))&&void 0!==o?o:[]},update:(t,n)=>{var o,i,r;const a=null!==(i=null===(o=e.current)||void 0===o?void 0:o.removePoint(t))&&void 0!==i?i:[];for(const t of a)null===(r=e.current)||void 0===r||r.push(n(t));return a},clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]}}}const n=t;return{push:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.pushLine(e)},pushMany:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.pushManyLines(e)},remove:e=>{var t,o;return null!==(o=null===(t=n.current)||void 0===t?void 0:t.removeLine(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,i,r;const a=null!==(i=null===(o=n.current)||void 0===o?void 0:o.removeLine(e))&&void 0!==i?i:[];for(const e of a)null===(r=n.current)||void 0===r||r.pushLine(t(e));return a},clear:()=>{var e;return null===(e=n.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=n.current)||void 0===e?void 0:e.getLines())&&void 0!==t?t:[]}}}(n,o);return Object.assign(Object.assign({},e),i)},null!=r?r:[])}function Fc(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return null!=e?e:()=>({});const n={};return void 0!==t.stroke&&(n.stroke=t.stroke),void 0!==t.strokeWidth&&(n.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(n.opacity=t.opacity),e?(...t)=>{const o=e(...t)||{};return Object.assign(Object.assign({},o),n)}:(...e)=>Object.assign({},n)}function Wc(e){const{colorBy:t,colorScale:n,color:o,pointRadius:i=5,radiusFn:a,fillOpacity:s=1,fallbackFill:l,baseStyleExtras:c,stroke:u,strokeWidth:d,opacity:h,effectiveSelectionHook:g,resolvedSelection:f,colorDatumAccessor:p}=e,y=r(()=>e=>{const r="function"==typeof c?c(e):c,u=r?Object.assign({},r):{};if(void 0===u.fillOpacity&&(u.fillOpacity=s),void 0===u.fill)if(t){if(n){const o=p?p(e):e;u.fill=mt(o,t,n)}}else u.fill=l?l(e):o||lc;return void 0===u.r&&(u.r=a?a(e):i),u},[t,n,o,i,a,s,l,c,p]),m=r(()=>Fc(y,{stroke:u,strokeWidth:d,opacity:h}),[y,u,d,h]);return r(()=>Vl(m,null!=g?g:null,f),[m,g,f])}function zc(e){const{accessor:t,data:n,isPushMode:o}=e,a=i(null),[s,c]=d(0),u=l(e=>{if(!o||!t)return;let n=!1;for(const o of e){const e="function"==typeof t?t(o):o[t];if(null==e)continue;const i="number"==typeof e?e:Number(e);Number.isFinite(i)&&(a.current?(a.current[0]>i&&(a.current[0]=i,n=!0),i>a.current[1]&&(a.current[1]=i,n=!0)):(a.current=[i,i],n=!0))}n&&c(e=>e+1)},[o,t]),h=l(()=>{o&&(a.current=null,c(e=>e+1))},[o]),g=r(()=>{var e;if(o)return null!==(e=a.current)&&void 0!==e?e:void 0;if(!t||0===n.length)return;const i="function"==typeof t?t:e=>e[t];let r=1/0,s=-1/0;for(const e of n){const t=i(e);if(null==t)continue;const n="number"==typeof t?t:Number(t);Number.isFinite(n)&&(r>n&&(r=n),n>s&&(s=n))}return Number.isFinite(r)&&Number.isFinite(s)?[r,s]:void 0},[n,t,o,s]);return{domain:g,trackPushed:u,reset:h}}function Yc(e){var t;if(!e)return;const n="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=n.method)&&void 0!==t?t:"linear"},null!=n.bandwidth&&{bandwidth:n.bandwidth}),null!=n.order&&{order:n.order}),null!=n.color&&{color:n.color}),null!=n.strokeWidth&&{strokeWidth:n.strokeWidth}),null!=n.strokeDasharray&&{strokeDasharray:n.strokeDasharray}),null!=n.label&&{label:n.label})}function Gc(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(o=Object.getOwnPropertySymbols(e);o.length>i;i++)0>t.indexOf(o[i])&&Object.prototype.propertyIsEnumerable.call(e,o[i])&&(n[o[i]]=e[o[i]])}return n}function qc(e,t,n,o){return new(n||(n=Promise))(function(i,r){function a(e){try{l(o.next(e))}catch(e){r(e)}}function s(e){try{l(o.throw(e))}catch(e){r(e)}}function l(e){e.done?i(e.value):function(e){return e instanceof n?e:new n(function(t){t(e)})}(e.value).then(a,s)}l((o=o.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const Xc="__forecastSegment";let Vc=null;function Uc(){return qc(this,void 0,void 0,function*(){return Vc||(Vc=yield import("./semiotic-statisticalOverlays-C3DsOgr_.js")),Vc})}const Qc="__semiotic_resolvedX",Kc="__semiotic_resolvedY";function Zc(e){const{data:t,xAccessor:n,yAccessor:o,forecast:s,anomaly:l,groupBy:c}=e,u="string"==typeof n?n:Qc,h="string"==typeof o?o:Kc,g=r(()=>{if(!s&&!l)return t;const e="function"==typeof n,i="function"==typeof o;return e||i?t.map(t=>{const r=Object.assign({},t);return e&&(r[Qc]=n(t)),i&&(r[Kc]=o(t)),r}):t},[t,s,l,n,o]),[f,p]=d(null),[y,m]=d([]),v=i(s),b=i(l);return a(()=>{if(!s&&!l)return void((v.current||b.current)&&(p(null),m([]),v.current=s,b.current=l));let e=!1;const t=s!==v.current||l!==b.current;if(v.current=s,b.current=l,t&&(p(null),m([])),s){const t=c&&"string"==typeof c&&"object"==typeof s?Object.assign(Object.assign({},s),{_groupBy:c}):s;(function(...e){return qc(this,void 0,void 0,function*(){return(yield Uc()).buildForecast(...e)})})(g,u,h,t,l).then(t=>{e||(p(t),m(t.annotations))}).catch(()=>{e||(p(null),m([]))})}else l&&function(...e){return qc(this,void 0,void 0,function*(){return(yield Uc()).buildAnomalyAnnotations(...e)})}(l).then(t=>{e||(p(null),m(t))}).catch(()=>{e||m([])});return()=>{e=!0}},[g,s,l,u,h,c]),{effectiveData:f?f.processedData:t,statisticalAnnotations:y,hasForecast:!!f,xAccessorKey:u,yAccessorKey:h}}const Jc=g(function(t,n){const a=i(null),s=xc(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:c,margin:u,className:d,xFormat:h,yFormat:g,xAccessor:f="x",yAccessor:p="y",xScaleType:y,yScaleType:m,colorBy:v,colorScheme:b,sizeBy:x,sizeRange:k=[3,15],pointRadius:w=5,pointOpacity:A=.8,tooltip:S,marginalGraphics:O,pointIdAccessor:C,annotations:j,regression:M,forecast:_,anomaly:P,xExtent:L,yExtent:T,frameProps:$={},selection:N,linkedHover:B,linkedBrush:D,onObservation:E,onClick:I,hoverHighlight:R,chartId:H,loading:F,loadingContent:W,emptyContent:z,legendInteraction:Y,legendPosition:G,color:q,stroke:X,strokeWidth:V,opacity:U}=t,{width:Q,height:K,enableHover:Z,showGrid:J,showLegend:ee,title:te,description:ne,summary:oe,accessibleTable:ie,xLabel:re,yLabel:ae}=s,se=r(()=>me(c),[c]),le=void 0===c,{domain:ce,trackPushed:ue,reset:de}=zc({accessor:x,data:se,isPushMode:le}),he=l(e=>{var t;ue([e]),null===(t=a.current)||void 0===t||t.push(e)},[ue]),ge=l(e=>{var t;ue(e),null===(t=a.current)||void 0===t||t.pushMany(e)},[ue]);Hc(n,{variant:"xy",frameRef:a,overrides:{push:he,pushMany:ge,clear:()=>{var e;de(),null===(e=a.current)||void 0===e||e.clear()}},deps:[he,ge,de]});const fe=Rc({data:se,rawData:c,colorBy:v,colorScheme:b,legendInteraction:Y,legendPosition:G,selection:N,linkedHover:B,fallbackFields:v?["string"==typeof v?v:""]:[],unwrapData:!1,onObservation:E,onClick:I,hoverHighlight:R,chartType:"Scatterplot",chartId:H,showLegend:ee,userMargin:u,marginDefaults:s.marginDefaults,loading:F,loadingContent:W,emptyContent:z,width:Q,height:K}),pe=Xl(D),ye=Nl({name:(null==pe?void 0:pe.name)||"__unused_brush__",xField:(null==pe?void 0:pe.xField)||("string"==typeof f?f:void 0),yField:(null==pe?void 0:pe.yField)||("string"==typeof p?p:void 0)}),ve=pe?"xyBrush"===ye.brushInteraction.brush?"xy":"xBrush"===ye.brushInteraction.brush?"x":"y":void 0,be=o.useRef(ye.brushInteraction);be.current=ye.brushInteraction;const xe=l(e=>{const t=be.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)},[]);Lc("Scatterplot",se,"xAccessor",f),Lc("Scatterplot",se,"yAccessor",p);const ke=r(()=>x?null!=ce?ce:[0,1]:void 0,[x,ce]),we=r(()=>x?e=>bt(e,x,k,ke):void 0,[x,k,ke]),Ae=Wc({colorBy:v,colorScale:fe.colorScale,color:q,pointRadius:w,fillOpacity:A,radiusFn:we,stroke:X,strokeWidth:V,opacity:U,effectiveSelectionHook:fe.effectiveSelectionHook,resolvedSelection:fe.resolvedSelection}),Se=r(()=>vl([{label:re||gl(f),accessor:f,role:"x",format:h},{label:ae||gl(p),accessor:p,role:"y",format:g},...v?[{label:gl(v),accessor:v,role:"color"}]:[],...x?[{label:gl(x),accessor:x,role:"size"}]:[]]),[f,p,re,ae,v,x,h,g]),{effectiveData:Oe,statisticalAnnotations:Ce}=Zc({data:se,xAccessor:f,yAccessor:p,forecast:_,anomaly:P}),je=r(()=>{const e=Yc(M);return e||0!==Ce.length?[...e?[e]:[],...j||[],...Ce]:j},[M,j,Ce]);if(fe.earlyReturn)return fe.earlyReturn;const Me=Bc({componentName:"Scatterplot",data:c,accessors:{xAccessor:f,yAccessor:p}});if(Me)return e(wc,{componentName:"Scatterplot",message:Me,width:Q,height:K});const _e=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!=c&&{data:Oe}),{xAccessor:f,yAccessor:p,xScaleType:y,yScaleType:m,colorAccessor:v||void 0,sizeAccessor:x||void 0,sizeRange:k,pointStyle:Ae,colorScheme:b,size:[Q,K],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:fe.margin,showAxes:s.showAxes,xLabel:re,yLabel:ae,xFormat:h,yFormat:g,enableHover:Z,showGrid:J}),fe.legendBehaviorProps),ul({title:te,description:ne,summary:oe,accessibleTable:ie,className:d,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),hl({tooltip:S,defaultTooltipContent:Se})),dl({linkedHover:B,onObservation:E,onClick:I,hoverHighlight:R,customHoverBehavior:fe.customHoverBehavior,customClickBehavior:fe.customClickBehavior})),O&&{marginalGraphics:O}),C&&{pointIdAccessor:C}),je&&je.length>0&&{annotations:je}),L&&{xExtent:L}),T&&{yExtent:T}),pe&&{brush:{dimension:ve},onBrush:xe}),fe.crosshairProps),$);return e(Cc,{componentName:"Scatterplot",width:Q,height:K,children:e(Nr,Object.assign({ref:a},_e))})});function eu(e,t){return Je(1===t?.5:e/(t-1))}Jc.displayName="Scatterplot";const tu=g(function(t,o){var a,s;const l=i(null);Hc(o,{variant:"xy",frameRef:l});const c=xc(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:u,margin:d,className:h,xFormat:g,yFormat:f,xAccessor:p="x",yAccessor:y="y",orderAccessor:m,orderLabel:v,pointRadius:b=4,tooltip:x,pointIdAccessor:k,annotations:w,regression:A,forecast:S,anomaly:O,xExtent:C,yExtent:j,frameProps:M={},selection:_,linkedHover:P,onObservation:L,onClick:T,hoverHighlight:$,chartId:N,loading:B,loadingContent:D,emptyContent:E,legendInteraction:I,stroke:R,strokeWidth:H,opacity:F}=t,{width:W,height:z,enableHover:Y,showGrid:G,title:q,description:X,summary:V,accessibleTable:U,xLabel:Q,yLabel:K}=c,Z=u||[],{safeData:J,orderMap:ee}=r(()=>{const e="function"==typeof p?p:e=>e[p],t="function"==typeof y?y:e=>e[y];let n=Z;if(m&&Z.length>0){const e="function"==typeof m?m:e=>e[m];n=[...Z].sort((t,n)=>{const o=e(t),i=e(n);return(o instanceof Date?o.getTime():+o)-(i instanceof Date?i.getTime():+i)})}const o=new WeakMap;let i=0;for(const o of n){const n=e(o),r=t(o);null!=n&&null!=r&&isFinite(n)&&isFinite(r)&&i++}let r=0;for(const a of n){const n=e(a),s=t(a);null!=n&&null!=s&&isFinite(n)&&isFinite(s)&&o.set(a,{idx:r++,total:i})}return{safeData:n,orderMap:o}},[Z,m,p,y]);Lc("ConnectedScatterplot",J,"xAccessor",p),Lc("ConnectedScatterplot",J,"yAccessor",y);const te=Rc({data:J,rawData:u,colorBy:void 0,colorScheme:void 0,legendInteraction:I,selection:_,linkedHover:P,fallbackFields:[],unwrapData:!1,onObservation:L,onClick:T,hoverHighlight:$,chartType:"ConnectedScatterplot",chartId:N,showLegend:void 0,userMargin:d,marginDefaults:{top:50,right:40,bottom:60,left:70},loading:B,loadingContent:D,emptyContent:E,width:W,height:z}),ne=null!==(s=null===(a=te.resolvedSelection)||void 0===a?void 0:a.unselectedOpacity)&&void 0!==s?s:.5,oe=r(()=>(e,t)=>{var n,o,i,r;const a=t.filter(e=>"point"===e.type);if(2>a.length)return;const s=null===(n=te.effectiveSelectionHook)||void 0===n?void 0:n.isActive,l=null===(o=te.effectiveSelectionHook)||void 0===o?void 0:o.predicate,c=100>a.length,u=a.length;e.lineCap="round";for(let t=0;u-1>t;t++){const n=a[t],o=a[t+1],d=eu(t,u),h=!s||!l||l(null!==(i=n.datum)&&void 0!==i?i:n)||l(null!==(r=o.datum)&&void 0!==r?r:o),g=s?h?1:ne:1;c&&(e.beginPath(),e.moveTo(n.x,n.y),e.lineTo(o.x,o.y),e.strokeStyle="white",e.lineWidth=b+2,e.globalAlpha=.5*g,e.stroke()),e.beginPath(),e.moveTo(n.x,n.y),e.lineTo(o.x,o.y),e.strokeStyle=d,e.lineWidth=b,e.globalAlpha=g,e.stroke()}e.globalAlpha=1},[b,te.effectiveSelectionHook,ne]),ie=r(()=>[oe],[oe]),re=r(()=>(t,o,i)=>{var r,a;const s=t.filter(e=>"point"===e.type);if(2>s.length)return null;const l=s.length,c=100>l,u=[];for(let t=0;l-1>t;t++){const n=s[t],o=s[t+1],i=eu(t,l),d="number"==typeof(null===(r=n.style)||void 0===r?void 0:r.opacity)?n.style.opacity:1,h="number"==typeof(null===(a=o.style)||void 0===a?void 0:a.opacity)?o.style.opacity:1,g=Math.min(d,h);c&&u.push(e("line",{x1:n.x,y1:n.y,x2:o.x,y2:o.y,stroke:"white",strokeWidth:b+2,strokeLinecap:"round",opacity:.5*g},"halo-"+t)),u.push(e("line",{x1:n.x,y1:n.y,x2:o.x,y2:o.y,stroke:i,strokeWidth:b,strokeLinecap:"round",opacity:g},"seg-"+t))}return e(n,{children:u})},[b]),ae=r(()=>[re],[re]),se=r(()=>e=>{var t,n;const o=ee.get(e),i=null!==(t=null==o?void 0:o.idx)&&void 0!==t?t:0,r=null!==(n=null==o?void 0:o.total)&&void 0!==n?n:1;return{fill:r>0?eu(i,r):"#6366f1",stroke:"white",strokeWidth:1,r:b,fillOpacity:1}},[b,ee]),le=Wc({colorScale:void 0,baseStyleExtras:se,stroke:R,strokeWidth:H,opacity:F,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection}),ce=v||("string"==typeof m?m:"Order"),ue=r(()=>vl([{label:Q||gl(p),accessor:p,role:"x",format:g},{label:K||gl(y),accessor:y,role:"y",format:f},...m?[{label:ce,accessor:m,role:"group"}]:[]]),[p,y,Q,K,m,ce,g,f]),de=Bc({componentName:"ConnectedScatterplot",data:u,accessors:{xAccessor:p,yAccessor:y}}),{effectiveData:he,statisticalAnnotations:ge}=Zc({data:J,xAccessor:p,yAccessor:y,forecast:S,anomaly:O});if(te.earlyReturn)return te.earlyReturn;const fe=Yc(A),pe=fe||ge.length>0?[...fe?[fe]:[],...w||[],...ge]:w,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({chartType:"scatter"},null!=u&&{data:he}),{xAccessor:p,yAccessor:y,pointStyle:le,size:[W,z],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:te.margin,showAxes:c.showAxes,xLabel:Q,yLabel:K,xFormat:g,yFormat:f,enableHover:Y,showGrid:G}),ul({title:q,description:X,summary:V,accessibleTable:U,className:h,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),hl({tooltip:x,defaultTooltipContent:ue})),dl({linkedHover:P,onObservation:L,onClick:T,hoverHighlight:$,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior})),k&&{pointIdAccessor:k}),{canvasPreRenderers:ie,svgPreRenderers:ae}),pe&&pe.length>0&&{annotations:pe}),C&&{xExtent:C}),j&&{yExtent:j}),te.crosshairProps),M);return de?e(wc,{componentName:"ConnectedScatterplot",message:de,width:W,height:z}):e(Cc,{componentName:"ConnectedScatterplot",width:W,height:z,children:e(Nr,Object.assign({ref:l},ye))})});function nu(e){const{lineWidth:t=2,colorBy:n,colorScale:o,color:i,resolveStroke:a,fillArea:s,areaOpacity:l=.3,stroke:c,strokeWidth:u,opacity:d,effectiveSelectionHook:h,resolvedSelection:g}=e,f=r(()=>(e,r)=>{const c={strokeWidth:t},u=!0===s||Array.isArray(s)&&null!=r&&s.includes(r);let d;return a?d=a(e,r):n?o&&(d=mt(e,n,o)):d=i||lc,void 0!==d&&(c.stroke=d,u&&(c.fill=d,c.fillOpacity=l)),c},[t,n,o,i,a,s,l]),p=r(()=>Fc(f,{stroke:c,strokeWidth:u,opacity:d}),[f,c,u,d]);return r(()=>Vl(p,null!=h?h:null,g),[p,h,g])}tu.displayName="ConnectedScatterplot";const ou=g(function(t,n){var o,s;const c=i(null);Hc(n,{variant:"xy",frameRef:c});const u=xc(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:t.xLabel,yLabel:t.yLabel}),{data:h,margin:g,className:f,xFormat:p,yFormat:y,axisExtent:m,xAccessor:v="x",yAccessor:b="y",lineBy:x,lineDataAccessor:k="coordinates",colorBy:w,colorScheme:A,curve:S="linear",showPoints:O=!1,pointRadius:C=3,fillArea:j=!1,areaOpacity:M=.3,lineWidth:_=2,lineGradient:P,tooltip:L,pointIdAccessor:T,annotations:$,directLabel:N,gapStrategy:B="break",anomaly:D,forecast:E,band:I,xExtent:R,yExtent:H,frameProps:F={},selection:W,linkedHover:z,onObservation:Y,onClick:G,hoverHighlight:q,hoverRadius:X,chartId:V,loading:U,loadingContent:Q,emptyContent:K,legendInteraction:Z,legendPosition:J,xScaleType:ee,yScaleType:te,color:ne,stroke:oe,strokeWidth:ie,opacity:re}=t,{width:ae,height:se,enableHover:le,showGrid:ce,showLegend:ue,title:de,description:he,summary:ge,accessibleTable:fe,xLabel:pe,yLabel:ye}=u,ve=r(()=>me(h),[h]);Lc("LineChart",ve,"xAccessor",v),Lc("LineChart",ve,"yAccessor",b);const{effectiveData:be,statisticalAnnotations:xe}=Zc({data:ve,xAccessor:v,yAccessor:b,forecast:E,anomaly:D,groupBy:x}),ke="__compoundGroup",we=!(!E||!x),Ae=we?ke:E?Xc:x,Se=r(()=>{if(!we)return be;const e="function"==typeof x?x:e=>e[x];return be.map(t=>{const n=Object.assign({},t);return n[ke]=`${e(t)}__${t[Xc]||"observed"}`,n})},[be,we,x]),Oe=we?Se:be,Ce=w||x,je=r(()=>{if(!E)return;const e=E.upperBounds,t=E.lowerBounds;if(!e&&!t)return;const n="function"==typeof e?e:"string"==typeof e?t=>t[e]:null,o="function"==typeof t?t:"string"==typeof t?e=>e[t]:null;let i=1/0,r=-1/0;const a=be;for(const e of a){const t="function"==typeof b?b(e):+e[b];if(isFinite(t)&&(i>t&&(i=t),t>r&&(r=t)),n){const t=n(e);null!=t&&isFinite(t)&&(t>r&&(r=t),i>t&&(i=t))}if(o){const t=o(e);null!=t&&isFinite(t)&&(i>t&&(i=t),t>r&&(r=t))}}return isFinite(i)&&isFinite(r)?[i,r]:void 0},[E,be,b]),Me=l(e=>{const t="function"==typeof v?v(e):e[v],n="function"==typeof b?b(e):e[b];return null==t||null==n||Number.isNaN(t)||Number.isNaN(n)},[v,b]),_e=void 0!==(null===(o=Oe[0])||void 0===o?void 0:o[k]),Pe=r(()=>{if(_e)return Oe;if(Ae){const e=Oe.reduce((e,t)=>{const n="function"==typeof Ae?Ae(t):t[Ae];if(!e[n]){const o={[k]:[]};"string"==typeof Ae&&(o[Ae]=n),we&&(o[Xc]=t[Xc],"string"==typeof x&&(o[x]=t[x])),e[n]=o}return e[n][k].push(t),e},{});return Object.values(e)}return[{[k]:Oe}]},[Oe,Ae,k,_e]),{gapProcessedLineData:Le,hasGaps:Te}=r(()=>{if("interpolate"===B){let e=!1;const t=[];for(const n of Pe){const o=(n[k]||[]).filter(t=>!Me(t)||(e=!0,!1));o.length>0&&t.push(Object.assign(Object.assign({},n),{[k]:o}))}return{gapProcessedLineData:t,hasGaps:e}}if("break"===B){let e=!1;const t=[];for(const n of Pe){const o=n[k]||[];let i=[],r=0;const a=Ae&&"string"==typeof Ae?n[Ae]:void 0;for(const s of o)if(Me(s))e=!0,i.length>0&&(t.push(Object.assign(Object.assign({},n),{[k]:i})),i=[],r++);else{const e=null!=a?`${a}__seg${r}`:"__seg"+r;i.push(Object.assign(Object.assign({},s),{_gapSegment:e}))}i.length>0&&t.push(Object.assign(Object.assign({},n),{[k]:i}))}return{gapProcessedLineData:t,hasGaps:e}}if("zero"===B){let e=!1;const t="string"==typeof b?b:"y",n=[];for(const o of Pe){const i=o[k]||[],r=[];for(const n of i)Me(n)?(e=!0,r.push(Object.assign(Object.assign({},n),{[t]:0}))):r.push(n);n.push(Object.assign(Object.assign({},o),{[k]:r}))}return{gapProcessedLineData:n,hasGaps:e}}return{gapProcessedLineData:Pe,hasGaps:!1}},[Pe,B,k,Me,Ae,b]),$e="object"==typeof N?N:{},Ne=$e.position||"end",Be=$e.fontSize||11,De=r(()=>{var e;if(!N||!Ce)return[];const t="function"==typeof Ce?Ce:e=>e[Ce],n=new Set;for(const o of Le){const i=o[k]||[];if(0===i.length)continue;const r=null!==(e=t("end"===Ne?i[i.length-1]:i[0]))&&void 0!==e?e:t(o);if(null==r)continue;const a=r+"";""!==a&&n.add(a)}return Array.from(n)},[N,Ce,Le,k,Ne]),Ee=r(()=>{if(!N)return u.marginDefaults;const e=De.reduce((e,t)=>Math.max(e,t.length*(.6*Be)),0),t=e+10,n="end"===Ne?"right":"left";return Object.assign(Object.assign({},u.marginDefaults),{[n]:Math.max(u.marginDefaults[n]||0,t)})},[N,De,Be,Ne,u.marginDefaults]),Ie=Rc({data:be,rawData:h,colorBy:Ce,colorScheme:A,legendInteraction:Z,legendPosition:J,selection:W,linkedHover:z,fallbackFields:Ce?["string"==typeof Ce?Ce:""]:[],unwrapData:!1,onObservation:Y,onClick:G,hoverHighlight:q,chartType:"LineChart",chartId:V,showLegend:(!N||void 0!==ue)&&ue,userMargin:g,marginDefaults:Ee,loading:U,loadingContent:Q,emptyContent:K,width:ae,height:se}),Re=Ie.colorScale,He=Ie.customHoverBehavior,Fe=Ie.customClickBehavior,We=Ie.crosshairProps,ze=nu({lineWidth:_,colorBy:Ce,colorScale:Re,color:ne,fillArea:j,areaOpacity:M,stroke:oe,strokeWidth:ie,opacity:re,effectiveSelectionHook:Ie.effectiveSelectionHook,resolvedSelection:Ie.resolvedSelection}),[Ye,Ge]=d(null);a(()=>{if(!E)return void Ge(null);let e=!1;return function(...e){return qc(this,void 0,void 0,function*(){return(yield Uc()).createSegmentLineStyle(...e)})}(ze,E).then(t=>{e||Ge(()=>t)}).catch(()=>{e||Ge(null)}),()=>{e=!0}},[ze,E]);const qe=Ye||ze,Xe=r(()=>{if(O)return e=>{const t={r:C,fillOpacity:1};return Ce?Re&&(t.fill=mt(e.parentLine||e,Ce,Re)):t.fill=ne||lc,t}},[O,C,Ce,Re,ne]),Ve=Array.isArray(j)?"mixed":j?"area":"line",Ue=r(()=>{var e;if(!N||!Ce)return[];const t="function"==typeof v?v:e=>e[v],n="function"==typeof b?b:e=>e[b],o="function"==typeof Ce?Ce:e=>e[Ce],i=new Map;for(const t of Le){const n=t[k]||[];if(0===n.length)continue;const r="end"===Ne?n[n.length-1]:n[0],a=null!==(e=o(r))&&void 0!==e?e:o(t);if(null==a)continue;const s=a+"";""===s||i.has(s)||i.set(s,r)}const r=Array.from(i.entries()).map(([e,o])=>({type:"text",label:e,["string"==typeof v?v:"x"]:t(o),["string"==typeof b?b:"y"]:n(o),dx:"end"===Ne?6:-6,dy:0,color:Re?Re(e):lc,fontSize:Be}));r.sort((e,t)=>{const n="string"==typeof b?b:"y";return e[n]-t[n]});for(let e=1;r.length>e;e++){const t="string"==typeof b?b:"y",n=r[e-1],o=r[e];Be+2>Math.abs(o[t]+o.dy-(n[t]+n.dy))&&(o.dy+=Be+2)}return r},[N,Ce,Re,Le,k,v,b,Ne,Be]),Qe=Ie.margin,Ke=x||w,Ze=r(()=>vl([{label:pe||gl(v),accessor:v,role:"x",format:p},{label:ye||gl(b),accessor:b,role:"y",format:y},...Ke?[{label:gl(Ke),accessor:Ke,role:"group"}]:[],...ml(I,y)]),[v,b,pe,ye,Ke,p,y,I]),Je=Bc({componentName:"LineChart",data:_e?(null===(s=be[0])||void 0===s?void 0:s[k])||[]:h,accessors:{xAccessor:v,yAccessor:b}}),et=r(()=>_e||Ae||Te?Le.flatMap(e=>{const t=e[k]||[];return Ae&&"string"==typeof Ae?t.map(t=>Object.assign(Object.assign({},t),{[Ae]:e[Ae]})):t}):Oe,[Le,k,_e,Ae,Oe,Te]),tt=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:Ve},Array.isArray(j)&&{areaGroups:j}),P&&{lineGradient:P}),null!=X&&{hoverRadius:X}),null!=h&&{data:et}),{xAccessor:v,yAccessor:b,xScaleType:ee,yScaleType:te}),R&&{xExtent:R}),!H||null==H[0]&&null==H[1]?je?{yExtent:je}:{}:{yExtent:H}),{groupAccessor:"break"===B&&Te?"_gapSegment":Ae||void 0}),I&&{band:I}),{curve:S,lineStyle:qe}),O&&{pointStyle:Xe}),{size:[ae,se],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Qe,showAxes:u.showAxes,xLabel:pe,yLabel:ye,xFormat:p,yFormat:y}),void 0!==m&&{axisExtent:m}),void 0!==t.autoPlaceAnnotations&&{autoPlaceAnnotations:t.autoPlaceAnnotations}),{enableHover:le,showGrid:ce}),Ie.legendBehaviorProps),de&&{title:de}),he&&{description:he}),ge&&{summary:ge}),void 0!==fe&&{accessibleTable:fe}),f&&{className:f}),null!=t.animate&&{animate:t.animate}),{tooltipContent:!1===L?()=>null:"multi"===L?Vi():Ui(L)||Ze}),"multi"===L&&{tooltipMode:"multi"}),(z||Y||G||q)&&{customHoverBehavior:He}),(Y||G||z)&&{customClickBehavior:Fe}),T&&{pointIdAccessor:T}),((null==$?void 0:$.length)||xe.length||Ue.length)&&{annotations:[...$||[],...xe,...Ue]}),We),F);return Ie.earlyReturn?Ie.earlyReturn:Je?e(wc,{componentName:"LineChart",message:Je,width:ae,height:se}):e(Cc,{componentName:"LineChart",width:ae,height:se,children:e(Nr,Object.assign({ref:c},tt))})});function iu(e){var t;const{safeData:n,data:o,areaBy:i,lineDataAccessor:a,colorBy:s,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:S,yFormat:O,groupField:C}=e,j=void 0!==(null===(t=n[0])||void 0===t?void 0:t[a]),M=r(()=>{if(null==o)return[];if(!j&&!i)return n;let e;if(j)e=n;else{const t=i,o=n.reduce((e,n)=>{const o="function"==typeof t?t(n):n[t];if(!e[o]){const n={[a]:[]};"string"==typeof t&&(n[t]=o),e[o]=n}return e[o][a].push(n),e},{});e=Object.values(o)}return e.flatMap(e=>{const t=e[a]||[];return i&&"string"==typeof i?t.map(t=>Object.assign(Object.assign({},t),{[i]:e[i]})):t})},[o,n,i,a,j]),_=r(()=>e=>{const t={};if(s){if(l){const n=mt(e,s,l);t.fill=n,y?(t.stroke=n,t.strokeWidth=m):t.stroke="none"}}else{const e=c||lc;t.fill=e,y?(t.stroke=e,t.strokeWidth=m):t.stroke="none"}return t.fillOpacity=p,t},[s,l,c,p,y,m]),P=r(()=>Fc(_,{stroke:u,strokeWidth:d,opacity:h}),[_,u,d,h]);return{flattenedData:M,lineStyle:r(()=>Vl(P,null!=g?g:null,f),[P,g,f]),pointStyle:r(()=>{if(v)return e=>{const t={r:b,fillOpacity:1};return s?l&&(t.fill=mt(e.parentLine||e,s,l)):t.fill=c||lc,t}},[v,b,s,l,c]),defaultTooltipContent:r(()=>vl([{label:w||gl(x),accessor:x,role:"x",format:S},{label:A||gl(k),accessor:k,role:"y",format:O},...C?[{label:gl(C),accessor:C,role:"group"}]:[],...ml(e.band,O)]),[x,k,w,A,C,S,O,e.band])}}function ru(e,t){if(null==t)return e;const n=e.trim(),o=n.match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i);if(o){const e=o[1],n=3===e.length?e.split("").map(e=>e+e).join(""):e;return`rgba(${parseInt(n.slice(0,2),16)}, ${parseInt(n.slice(2,4),16)}, ${parseInt(n.slice(4,6),16)}, ${t})`}if(n.startsWith("rgba(")){const e=n.lastIndexOf(","),o=n.lastIndexOf(")");if(-1!==e&&o>e)return`${n.slice(0,e+1)} ${t})`}return n.startsWith("rgb(")?n.replace(/^rgb\(/,"rgba(").replace(/\)$/,`, ${t})`):e}ou.displayName="LineChart";const au=g(function(t,n){const o=i(null);Hc(n,{variant:"xy",frameRef:o});const a=xc(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:s,margin:l,className:c,xFormat:u,yFormat:d,xAccessor:h="x",yAccessor:g="y",areaBy:f,y0Accessor:p,gradientFill:y=!1,semanticGradient:m,lineDataAccessor:v="coordinates",colorBy:b,colorScheme:x,curve:k="monotoneX",areaOpacity:w=.7,lineGradient:A,showLine:S=!0,lineWidth:O=2,showPoints:C=!1,pointRadius:j=3,tooltip:M,annotations:_,forecast:P,anomaly:L,band:T,xExtent:$,yExtent:N,frameProps:B={},selection:D,linkedHover:E,onObservation:I,onClick:R,hoverHighlight:H,chartId:F,loading:W,loadingContent:z,emptyContent:Y,legendInteraction:G,legendPosition:q,color:X,stroke:V,strokeWidth:U,opacity:Q}=t,{width:K,height:Z,enableHover:J,showGrid:ee,showLegend:te,title:ne,description:oe,summary:ie,accessibleTable:re,xLabel:ae,yLabel:se}=a,le=r(()=>me(s),[s]),ce=b||f,ue=r(()=>{return m&&m.length>0?{colorStops:(e=m,e.filter(e=>Number.isFinite(e.at)).map(e=>({offset:1-Math.max(0,Math.min(100,e.at))/100,color:ru(e.color,e.opacity)})).sort((e,t)=>e.offset-t.offset))}:y;var e},[m,y]);Lc("AreaChart",le,"xAccessor",h),Lc("AreaChart",le,"yAccessor",g);const de=Rc({data:le,rawData:s,colorBy:ce,colorScheme:x,legendInteraction:G,legendPosition:q,selection:D,linkedHover:E,fallbackFields:ce?["string"==typeof ce?ce:""]:[],unwrapData:!1,onObservation:I,onClick:R,hoverHighlight:H,chartType:"AreaChart",chartId:F,showLegend:te,userMargin:l,marginDefaults:a.marginDefaults,loading:W,loadingContent:z,emptyContent:Y,width:K,height:Z}),{effectiveData:he,statisticalAnnotations:ge}=Zc({data:le,xAccessor:h,yAccessor:g,forecast:P,anomaly:L,groupBy:f}),{flattenedData:fe,lineStyle:pe,pointStyle:ye,defaultTooltipContent:ve}=iu({safeData:he,data:s,areaBy:f,lineDataAccessor:v,colorBy:ce,colorScale:de.colorScale,color:X,stroke:V,strokeWidth:U,opacity:Q,effectiveSelectionHook:de.effectiveSelectionHook,resolvedSelection:de.resolvedSelection,areaOpacity:w,showLine:S,lineWidth:O,showPoints:C,pointRadius:j,xAccessor:h,yAccessor:g,xLabel:ae,yLabel:se,xFormat:u,yFormat:d,groupField:f||b,band:T}),be=Bc({componentName:"AreaChart",data:s,accessors:{xAccessor:h,yAccessor:g}}),xe=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:h,yAccessor:g,groupAccessor:f||void 0}),p&&{y0Accessor:p}),T&&{band:T}),ue&&{gradientFill:ue}),A&&{lineGradient:A}),{curve:k,lineStyle:pe}),C&&ye&&{pointStyle:ye}),{size:[K,Z],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:de.margin,showAxes:a.showAxes,xLabel:ae,yLabel:se,xFormat:u,yFormat:d,enableHover:J}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),{showGrid:ee}),de.legendBehaviorProps),ul({title:ne,description:oe,summary:ie,accessibleTable:re,className:c,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),"multi"===M?{tooltipContent:Vi(),tooltipMode:"multi"}:hl({tooltip:M,defaultTooltipContent:ve})),dl({linkedHover:E,onObservation:I,onClick:R,hoverHighlight:H,customHoverBehavior:de.customHoverBehavior,customClickBehavior:de.customClickBehavior})),(_&&_.length>0||ge.length>0)&&{annotations:[..._||[],...ge]}),$&&{xExtent:$}),N&&{yExtent:N}),de.crosshairProps),B);return de.earlyReturn?de.earlyReturn:be?e(wc,{componentName:"AreaChart",message:be,width:K,height:Z}):e(Cc,{componentName:"AreaChart",width:K,height:Z,children:e(Nr,Object.assign({ref:o},xe))})});function su(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}au.displayName="AreaChart";const lu=g(function(n,o){const a=i(null),s=xc(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel}),{data:c,margin:u,className:h,xFormat:g,yFormat:f,xAccessor:y="x",seriesAAccessor:m="a",seriesBAccessor:v="b",seriesALabel:b="A",seriesBLabel:x="B",seriesAColor:k="var(--semiotic-danger, #dc2626)",seriesBColor:w="var(--semiotic-info, #2563eb)",showLines:A=!0,lineWidth:S=1.5,showPoints:O=!1,pointRadius:C=3,curve:j="linear",areaOpacity:M=.6,gradientFill:_,tooltip:P,annotations:L,xExtent:T,yExtent:$,frameProps:N={},selection:B,linkedHover:D,onObservation:E,onClick:I,hoverHighlight:R,chartId:H,loading:F,loadingContent:W,emptyContent:z,legendInteraction:Y,legendPosition:G,pointIdAccessor:q,windowSize:X}=n,{width:V,height:U,enableHover:Q,showGrid:K,showLegend:Z,title:J,description:ee,summary:te,accessibleTable:ne,xLabel:oe,yLabel:ie}=s,re=r(()=>"function"==typeof y?e=>su(y(e)):e=>su(e[y]),[y]),ae=r(()=>"function"==typeof m?e=>su(m(e)):e=>su(e[m]),[m]),se=r(()=>"function"==typeof v?e=>su(v(e)):e=>su(e[v]),[v]),[le,ce]=d([]),ue=i([]),de=null==c,he=r(()=>me(de?le:c),[de,le,c]),ge=r(()=>function(e,t,n,o){if(!e.length)return[];const i=e.filter(e=>Number.isFinite(t(e))).sort((e,n)=>t(e)-t(n)),r=[];let a=0,s=null,l=null,c=[];const u=(e,t)=>e>t?"A":t>e?"B":null,d=e=>`seg-${a}-${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=n(r),y=o(r);if(!Number.isFinite(f)||!Number.isFinite(p)||!Number.isFinite(y))continue;const m=u(p,y);if(null!==m)if(null!=s){if(l&&l.w!==m){let e,t;if(c.length>0)e=c[0].x,t=c[0].y;else{const n=p-l.a-(y-l.b);if(0!==n){const o=Math.max(0,Math.min(1,(l.b-l.a)/n));e=l.x+o*(f-l.x),t=l.a+o*(p-l.a)}else e=l.x,t=l.a}h({__x:e,__y:t,__y0:t,__diffSegment:d(s),__diffWinner:s,__valA:t,__valB:t}),a++,s=m,h({__x:e,__y:t,__y0:t,__diffSegment:d(s),__diffWinner:s,__valA:t,__valB:t});for(let e=1;c.length>e;e++)g(c[e],s)}else for(const e of c)g(e,s);c=[],h({__x:f,__y:y>p?y:p,__y0:y>p?p:y,__diffSegment:d(s),__diffWinner:s,__valA:p,__valB:y,__sourceDatum:r}),l={x:f,a:p,b:y,w:m}}else{s=m;for(const e of c)g(e,s);c=[],h({__x:f,__y:y>p?y:p,__y0:y>p?p:y,__diffSegment:d(s),__diffWinner:s,__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!=s?s:"A");return r}(he,re,ae,se),[he,re,ae,se]),fe=r(()=>A?function(e,t,n,o){if(!e.length)return[];const i=e.filter(e=>Number.isFinite(t(e))).sort((e,n)=>t(e)-t(n)),r=[];for(const e of i){const i=t(e),a=n(e),s=o(e);Number.isFinite(a)&&r.push({__x:i,__y:a,__diffSegment:"line-A"}),Number.isFinite(s)&&r.push({__x:i,__y:s,__diffSegment:"line-B"})}return r}(he,re,ae,se):[],[A,he,re,ae,se]),pe=r(()=>[...ge,...fe],[ge,fe]),ye=r(()=>{const e=new Set;for(const t of ge)e.add(t.__diffSegment);return Array.from(e)},[ge]);p(o,()=>{const e=e=>{const t=X&&e.length>X?e.slice(e.length-X):e;ue.current=t,ce(t)},t=q?"function"==typeof q?q:e=>e[q]:null;return{push:t=>e([...ue.current,t]),pushMany:t=>e([...ue.current,...t]),remove:n=>{if(!t)return[];const o=Array.isArray(n)?n:[n],i=[],r=[];for(const e of ue.current)o.includes(t(e))?i.push(e):r.push(e);return e(r),i},update:(n,o)=>{if(!t)return[];const i=Array.isArray(n)?n:[n],r=[],a=ue.current.map(e=>{if(i.includes(t(e))){const t=o(e);return r.push(t),t}return e});return e(a),r},clear:()=>e([]),getData:()=>de?ue.current:he,getScales:()=>{var e,t;return null!==(t=null===(e=a.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}},[de,he,q,X]);const ve=Rc({data:he,rawData:c,colorBy:"__diffWinner",colorScheme:[k,w],legendInteraction:Y,legendPosition:G,selection:B,linkedHover:D,fallbackFields:["__diffWinner"],unwrapData:!1,onObservation:E,onClick:I,hoverHighlight:R,chartType:"DifferenceChart",chartId:H,showLegend:Z,userMargin:u,marginDefaults:s.marginDefaults,loading:F,loadingContent:W,emptyContent:z,width:V,height:U}),be=r(()=>{if(!1!==Z)return{legendGroups:[{label:"",type:"fill",styleFn:e=>({fill:e.color||"currentColor"}),items:[{label:b,color:k},{label:x,color:w}]}]}},[Z,b,x,k,w]),xe=l(e=>{const t=e.__diffSegment;return{fill:"A"==((null==t?void 0:t.endsWith("-A"))?"A":"B")?k:w,stroke:"none",fillOpacity:M}},[k,w,M]),ke=l(e=>({stroke:"A"==("line-A"===e.__diffSegment?"A":"B")?k:w,strokeWidth:S,fill:"none"}),[k,w,S]),we=l(e=>({fill:"A"==("line-A"===e.__diffSegment?"A":"B")?k:w,r:C}),[k,w,C]),Ae=l(n=>{var o;const i=n.data,r=n.allSeries,a=null!==(o=n.xValue)&&void 0!==o?o:null==i?void 0:i.__x;let s=null==i?void 0:i.__valA,l=null==i?void 0:i.__valB;if(r&&r.length>0){const e=r.find(e=>"line-A"===e.group),t=r.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)&&(l=t.value)}if(null!=a&&(null==s||null==l)){const e=he.find(e=>re(e)===a);e&&(null==s&&(s=ae(e)),null==l&&(l=se(e)))}const c=e=>null!=e&&Number.isFinite(e)?""+Math.round(100*e)/100:"—",u=g&&null!=a?g(a):null!=a?a+"":"";return t("div",{className:"semiotic-tooltip",style:zi,children:[u&&e("div",{style:{fontWeight:600,marginBottom:4},children:u}),t("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e("span",{style:{width:10,height:10,background:k,display:"inline-block",borderRadius:2}}),t("span",{children:[b,": ",c(s)]})]}),t("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e("span",{style:{width:10,height:10,background:w,display:"inline-block",borderRadius:2}}),t("span",{children:[x,": ",c(l)]})]}),null!=s&&null!=l&&Number.isFinite(s)&&Number.isFinite(l)&&t("div",{style:{marginTop:4,opacity:.7},children:["Δ = ",c(s-l)]})]})},[he,re,ae,se,g,k,w,b,x]),Se="multi"===P,Oe=r(()=>!1===P?()=>null:Se?Ae:Ui(P)||Ae,[P,Se,Ae]);if(ve.earlyReturn)return ve.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({chartType:"mixed",data:pe,xAccessor:"__x",yAccessor:"__y",y0Accessor:"__y0",groupAccessor:"__diffSegment",areaGroups:ye,curve:j,areaStyle:xe,lineStyle:ke},O&&{pointStyle:we}),{size:[V,U],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ve.margin,showAxes:s.showAxes,xLabel:oe,yLabel:ie,xFormat:g,yFormat:f,enableHover:Q,showGrid:K}),_&&{gradientFill:!0===_?{topOpacity:.85,bottomOpacity:.15}:_}),be&&{legend:be,legendPosition:ve.legendPosition}),ul({title:J,description:ee,summary:te,accessibleTable:ne,className:h,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),{tooltipContent:Oe}),Se&&{tooltipMode:"multi"}),dl({linkedHover:D,onObservation:E,onClick:I,hoverHighlight:R,customHoverBehavior:ve.customHoverBehavior,customClickBehavior:ve.customClickBehavior})),L&&L.length>0&&{annotations:L}),T&&{xExtent:T}),$&&{yExtent:$}),ve.crosshairProps),N);return e(Cc,{componentName:"DifferenceChart",width:V,height:U,children:e(Nr,Object.assign({ref:a},Ce))})});"function"==typeof lu&&(lu.displayName="DifferenceChart");const cu=g(function(t,n){const o=i(null),a=xc(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:s,margin:l,className:c,xFormat:u,yFormat:d,xAccessor:h="x",yAccessor:g="y",areaBy:f,lineDataAccessor:p="coordinates",colorBy:y,colorScheme:m,curve:v="monotoneX",areaOpacity:b=.7,showLine:x=!0,lineWidth:k=2,showPoints:w=!1,pointRadius:A=3,normalize:S=!1,baseline:O="zero",stackOrder:C,tooltip:j,annotations:M,xExtent:_,yExtent:P,frameProps:L={},selection:T,linkedHover:$,onObservation:N,onClick:B,hoverHighlight:D,chartId:E,loading:I,loadingContent:R,emptyContent:H,legendInteraction:F,legendPosition:W,color:z,stroke:Y,strokeWidth:G,opacity:q}=t,{width:X,height:V,enableHover:U,showGrid:Q,showLegend:K,title:Z,description:J,summary:ee,accessibleTable:te,xLabel:ne,yLabel:oe}=a,ie=r(()=>me(s),[s]),re=y||f;Hc(n,{variant:"xy",frameRef:o});const ae=Rc({data:ie,rawData:s,colorBy:re,colorScheme:m,legendInteraction:F,legendPosition:W,selection:T,linkedHover:$,fallbackFields:re?["string"==typeof re?re:""]:[],unwrapData:!1,onObservation:N,onClick:B,hoverHighlight:D,chartType:"StackedAreaChart",chartId:E,showLegend:K,userMargin:l,marginDefaults:a.marginDefaults,loading:I,loadingContent:R,emptyContent:H,width:X,height:V}),{flattenedData:se,lineStyle:le,pointStyle:ce,defaultTooltipContent:ue}=iu({safeData:ie,data:s,areaBy:f,lineDataAccessor:p,colorBy:re,colorScale:ae.colorScale,color:z,stroke:Y,strokeWidth:G,opacity:q,effectiveSelectionHook:ae.effectiveSelectionHook,resolvedSelection:ae.resolvedSelection,areaOpacity:b,showLine:x,lineWidth:k,showPoints:w,pointRadius:A,xAccessor:h,yAccessor:g,xLabel:ne,yLabel:oe,xFormat:u,yFormat:d,groupField:f||y}),de=Bc({componentName:"StackedAreaChart",data:s,accessors:{xAccessor:h,yAccessor:g}}),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:se}),{xAccessor:h,yAccessor:g,groupAccessor:f||void 0,curve:v,normalize:S,baseline:S?"zero":O,stackOrder:C,lineStyle:le}),w&&ce&&{pointStyle:ce}),{size:[X,V],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ae.margin,showAxes:a.showAxes,xLabel:ne,yLabel:oe,xFormat:u,yFormat:d,enableHover:U}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),{showGrid:Q}),ae.legendBehaviorProps),ul({title:Z,description:J,summary:ee,accessibleTable:te,className:c,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),"multi"===j?{tooltipContent:Vi(),tooltipMode:"multi"}:hl({tooltip:j,defaultTooltipContent:ue})),dl({linkedHover:$,onObservation:N,onClick:B,hoverHighlight:D,customHoverBehavior:ae.customHoverBehavior,customClickBehavior:ae.customClickBehavior})),M&&M.length>0&&{annotations:M}),_&&{xExtent:_}),P&&{yExtent:P}),ae.crosshairProps),L);return ae.earlyReturn?ae.earlyReturn:de?e(wc,{componentName:"StackedAreaChart",message:de,width:X,height:V}):e(Cc,{componentName:"StackedAreaChart",width:X,height:V,children:e(Nr,Object.assign({ref:o},he))})});cu.displayName="StackedAreaChart";const uu=g(function(t,n){var o;const a=i(null);Hc(n,{variant:"xy",frameRef:a});const s=xc(t.mode,{width:t.width,height:t.height,showGrid:void 0,enableHover:t.enableHover,showLegend:void 0,title:t.title,xLabel:t.xLabel,yLabel:t.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:k,xExtent:w,yExtent:A,frameProps:S={},selection:C,linkedHover:j,onObservation:M,onClick:_,hoverHighlight:P,chartId:L,loading:T,loadingContent:$,emptyContent:N,showLegend:B,legendPosition:D,legendInteraction:E}=t,{width:I,height:R,enableHover:H,title:F,description:W,summary:z,accessibleTable:Y,xLabel:G,yLabel:q}=s,X=Pc(T,I,R,$),V=X?null:_c(l,I,R,N),U=r(()=>me(l),[l]),Q=function(){var e;const t=sc();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.sequential)||void 0}(),K=null!==(o=null!=y?y:Q)&&void 0!==o?o:"blues",Z=null!=B&&B,J=null!=D?D:"right",{margin:ee}=mc({data:U,colorBy:Z?"value":void 0,colorScale:void 0,showLegend:Z,legendPosition:J,userMargin:c,defaults:s.marginDefaults}),{customHoverBehavior:te,customClickBehavior:ne,crosshairSourceId:oe}=pc({selection:C,linkedHover:j,fallbackFields:[],onObservation:M,onClick:_,chartType:"Heatmap",chartId:L,hoverHighlight:P,colorByField:void 0});Ic(C);const ie=yc(j,oe);vc(E,void 0,[]);const re=r(()=>"function"==typeof g?e=>g(e):e=>e[g],[g]),ae=r(()=>{const e=U.map(re);return[Math.min(...e),Math.max(...e)]},[U,re]),se=r(()=>"custom"===K&&m?m:O({blues:Xe,reds:Ve,greens:Ue,viridis:Je,oranges:Qe,purples:Ke,greys:Ze,plasma:et,inferno:tt,magma:nt,cividis:ot,turbo:it}[K]||Xe).domain(ae),[K,m,ae]),le=r(()=>vl([{label:G||gl(d),accessor:d,role:"x",format:f},{label:q||gl(h),accessor:h,role:"y",format:p},{label:gl(g),accessor:g,role:"value",format:b}]),[d,h,G,q,g,f,p,b]),ce=Bc({componentName:"Heatmap",data:l,accessors:{xAccessor:d,yAccessor:h,valueAccessor:g}}),ue=r(()=>{if(Z)return{gradient:{colorFn:e=>se(e),domain:ae,label:"string"==typeof g?g:"value",format:b}}},[Z,se,ae,g,b]),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({chartType:"heatmap"},null!=l&&{data:U}),{xAccessor:d,yAccessor:h,valueAccessor:g,colorScheme:"custom"!==K?K:void 0,showValues:v,heatmapValueFormat:b,size:[I,R],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ee,showAxes:s.showAxes,xLabel:G,yLabel:q,xFormat:f,yFormat:p,enableHover:H}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),ue&&{legend:ue,legendPosition:J}),ul({title:F,description:W,summary:z,accessibleTable:Y,className:u,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),hl({tooltip:x,defaultTooltipContent:le})),dl({linkedHover:j,onObservation:M,onClick:_,hoverHighlight:P,customHoverBehavior:te,customClickBehavior:ne})),k&&k.length>0&&{annotations:k}),w&&{xExtent:w}),A&&{yExtent:A}),ie),S);return X||V||(ce?e(wc,{componentName:"Heatmap",message:ce,width:I,height:R}):e(Cc,{componentName:"Heatmap",width:I,height:R,children:e(Nr,Object.assign({ref:a},de))}))});uu.displayName="Heatmap";const du=g(function(t,n){const o=i(null),a=xc(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel}),{data:s,margin:c,className:u,xFormat:d,yFormat:h,xAccessor:g="x",yAccessor:f="y",sizeBy:p,sizeRange:y=[5,40],colorBy:m,colorScheme:v,bubbleOpacity:b=.6,bubbleStrokeWidth:x=1,bubbleStrokeColor:k="white",tooltip:w,marginalGraphics:A,pointIdAccessor:S,annotations:O,regression:C,xExtent:j,yExtent:M,frameProps:_={},selection:P,linkedHover:L,linkedBrush:T,onObservation:$,onClick:N,hoverHighlight:B,chartId:D,loading:E,loadingContent:I,emptyContent:R,legendInteraction:H,legendPosition:F,color:W,stroke:z,strokeWidth:Y,opacity:G}=t,{width:q,height:X,enableHover:V,showGrid:U,showLegend:Q,title:K,description:Z,summary:J,accessibleTable:ee,xLabel:te,yLabel:ne}=a,oe=r(()=>me(s),[s]),ie=void 0===s,re=Rc({data:oe,rawData:s,colorBy:m,colorScheme:v,legendInteraction:H,legendPosition:F,selection:P,linkedHover:L,fallbackFields:m?["string"==typeof m?m:""]:[],unwrapData:!1,onObservation:$,onClick:N,hoverHighlight:B,chartType:"BubbleChart",chartId:D,showLegend:Q,userMargin:c,marginDefaults:a.marginDefaults,loading:E,loadingContent:I,emptyContent:R,width:q,height:X}),{domain:ae,trackPushed:se,reset:le}=zc({accessor:p,data:oe,isPushMode:ie}),ce=l(e=>{var t;se([e]),null===(t=o.current)||void 0===t||t.push(e)},[se]),ue=l(e=>{var t;se(e),null===(t=o.current)||void 0===t||t.pushMany(e)},[se]);Hc(n,{variant:"xy",frameRef:o,overrides:{push:ce,pushMany:ue,clear:()=>{var e;le(),null===(e=o.current)||void 0===e||e.clear()}},deps:[ce,ue,le]});const de=Xl(T);Nl({name:(null==de?void 0:de.name)||"__unused_brush__",xField:(null==de?void 0:de.xField)||("string"==typeof g?g:void 0),yField:(null==de?void 0:de.yField)||("string"==typeof f?f:void 0)});const he=r(()=>({stroke:k,strokeWidth:x}),[k,x]),ge=r(()=>null!=ae?ae:[0,1],[ae]),fe=l(e=>bt(e,p,y,ge),[p,y,ge]),pe=Wc({colorBy:m,colorScale:re.colorScale,color:W,fillOpacity:b,radiusFn:fe,baseStyleExtras:he,stroke:z,strokeWidth:Y,opacity:G,effectiveSelectionHook:re.effectiveSelectionHook,resolvedSelection:re.resolvedSelection}),ye=r(()=>vl([{label:te||gl(g),accessor:g,role:"x",format:d},{label:ne||gl(f),accessor:f,role:"y",format:h},{label:gl(p),accessor:p,role:"size"},...m?[{label:gl(m),accessor:m,role:"color"}]:[]]),[g,f,te,ne,p,m,d,h]);if(re.earlyReturn)return re.earlyReturn;const ve=Bc({componentName:"BubbleChart",data:s,accessors:{xAccessor:g,yAccessor:f},requiredProps:{sizeBy:p}});if(ve)return e(wc,{componentName:"BubbleChart",message:ve,width:q,height:X});const be=Yc(C),xe=be?[be,...O||[]]:O,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:"bubble"},null!=s&&{data:oe}),{xAccessor:g,yAccessor:f,colorAccessor:m||void 0,sizeAccessor:p,sizeRange:y,pointStyle:pe,colorScheme:v,size:[q,X],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:re.margin,showAxes:a.showAxes,xLabel:te,yLabel:ne,xFormat:d,yFormat:h,enableHover:V,showGrid:U}),re.legendBehaviorProps),ul({title:K,description:Z,summary:J,accessibleTable:ee,className:u,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),hl({tooltip:w,defaultTooltipContent:ye})),dl({linkedHover:L,onObservation:$,onClick:N,hoverHighlight:B,customHoverBehavior:re.customHoverBehavior,customClickBehavior:re.customClickBehavior})),A&&{marginalGraphics:A}),S&&{pointIdAccessor:S}),xe&&xe.length>0&&{annotations:xe}),j&&{xExtent:j}),M&&{yExtent:M}),re.crosshairProps),_);return e(Cc,{componentName:"BubbleChart",width:q,height:X,children:e(Nr,Object.assign({ref:o},ke))})});du.displayName="BubbleChart";const hu="__splomIdx",gu={top:4,bottom:4,left:4,right:4};function fu({frameRef:t,cellSize:n,onBrush:o}){const r=i(null),s=n-gu.left-gu.right,l=n-gu.top-gu.bottom;return a(()=>{if(!r.current)return;const e=y(r.current).select(".brush-g"),n=b().extent([[0,0],[s,l]]).on("brush end",e=>{var n;const i=null===(n=t.current)||void 0===n?void 0:n.getScales();if(!i)return;if(!e.selection)return void o(null);const[[r,a],[s,l]]=e.selection,c=[[i.x.invert(r),i.y.invert(a)],[i.x.invert(s),i.y.invert(l)]];o(c)});return e.call(n),e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{n.on("brush end",null)}},[s,l,t,o]),e("svg",{ref:r,width:n,height:n,style:{position:"absolute",top:0,left:0},children:e("g",{className:"brush-g",transform:`translate(${gu.left},${gu.top})`})})}function pu({data:n,xField:o,yField:r,cellSize:a,pointRadius:s,pointOpacity:c,colorBy:u,colorScale:d,brushSelectionName:h,hoverSelectionName:g,unselectedOpacity:f,mode:p,onPointHover:y}){const m=i(null),v=Pl({name:h,clientId:`splom-${o}-${r}`}),b=Nl({name:h,xField:o,yField:r}),x=Pl({name:g,clientId:"splom-hover-source"}),k=x.selectPoints,w=l(e=>{e?b.brushInteraction.during(e):b.brushInteraction.end(null)},[b.brushInteraction]),A=l(e=>{if(!e)return void(null==y||y(null));const t=e.data,n=null==t?void 0:t[hu];void 0!==n&&(k({[hu]:[n]}),null==y||y(t,e.x+gu.left,e.y+gu.top))},[k,y]),S=l(e=>{const t={opacity:c,r:s};return t.fill=u?mt(e,u,d):lc,"hover"===p?x.isActive&&x.predicate(e)?(t.opacity=1,t.r=2.5*s,t.stroke="#333",t.strokeWidth=1.5):x.isActive&&(t.opacity=.6*c):v.isActive&&!v.predicate(e)&&(t.opacity=f),t},[u,d,c,s,p,v.isActive,v.predicate,x.isActive,x.predicate,f]);return t("div",{style:{position:"relative",width:a,height:a},children:[e(Nr,{ref:m,chartType:"scatter",data:n,size:[a,a],xAccessor:o,yAccessor:r,pointStyle:S,margin:gu,showAxes:!1,enableHover:"hover"===p,customHoverBehavior:"hover"===p?A:void 0,tooltipContent:"hover"===p?()=>null:void 0}),"brush"===p&&e(fu,{frameRef:m,cellSize:a,xField:o,yField:r,onBrush:w})]})}function yu({data:n,field:o,label:i,cellSize:a,bins:s,colorBy:l,colorScale:c,brushSelectionName:u,hoverSelectionName:d,mode:h}){const g=Pl({name:u,clientId:"splom-diag-"+o}),f=Pl({name:d,clientId:`splom-diag-${o}-hover`}),p="hover"===h?f:g,y=p.isActive,m=p.predicate,v=r(()=>{const e=n.map(e=>e[o]).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,r="string"==typeof l?l:null,c=r?[...new Set(n.map(e=>e[r]).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 n){const n=e[o];if(null==n||isNaN(n))continue;const a=Math.min(Math.floor((n-t)/i),s-1);if(d[a]++,y&&!m(e)||h[a]++,r){const t=u.get(e[r]+"");void 0!==t&&(g[a][t]++,y&&!m(e)||f[a][t]++)}}const p=Math.max(...d,1),v=g.map((e,t)=>{let n=0;return e.map((e,o)=>{const i=e/p*(a-24),r={x:t/s*a,w:a/s-1,h:i,y0:n,category:c[o]};return n+=i,r})}),b=f.map((e,t)=>{let n=0;return e.map((e,o)=>{const i=e/p*(a-24),r={x:t/s*a,w:a/s-1,h:i,y0:n,category:c[o]};return n+=i,r})});return{bars:d.map((e,t)=>({x:t/s*a,w:a/s-1,h:e/p*(a-24),count:e})),selectedBars:h.map((e,t)=>({x:t/s*a,w:a/s-1,h:e/p*(a-24),count:e})),categoryBars:v,selectedCategoryBars:b,max:p,categories:c}},[n,o,s,a,y,m,l]);return t("svg",{width:a,height:a,style:{overflow:"hidden"},children:[e("text",{x:a/2,y:14,textAnchor:"middle",fontSize:11,fontWeight:"bold",fill:"#333",children:i}),v.categories.length>0?v.categoryBars.map((t,n)=>t.map((t,o)=>e("rect",{x:t.x,y:a-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:c?c(t.category):lc,opacity:y?.3:.6},`bg-${n}-${o}`))):v.bars.map((t,n)=>e("rect",{x:t.x,y:a-t.h,width:Math.max(t.w,1),height:t.h,fill:lc,opacity:y?.3:.6},"bg-"+n)),y&&(v.categories.length>0?v.selectedCategoryBars.map((t,n)=>t.map((t,o)=>e("rect",{x:t.x,y:a-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:c?c(t.category):lc,opacity:.7},`sel-${n}-${o}`))):v.selectedBars.map((t,n)=>e("rect",{x:t.x,y:a-t.h,width:Math.max(t.w,1),height:t.h,fill:lc,opacity:.7},"sel-"+n)))]})}function mu({label:t,cellSize:n}){return e("svg",{width:n,height:n,children:e("text",{x:n/2,y:n/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:12,fontWeight:"bold",fill:"#333",children:t})})}function vu(n){const{data:i,fields:a,fieldLabels:s={},colorBy:c,colorScheme:u,cellSize:h=150,cellGap:g=4,pointRadius:f=2,pointOpacity:p=.5,diagonal:y="histogram",histogramBins:m=20,brushMode:v="crossfilter",hoverMode:b=!0,unselectedOpacity:x=.1,showGrid:k=!1,tooltip:w,showLegend:A,idAccessor:S,className:O,onObservation:C,chartId:j}=n,M="splom",_="splom-hover",P=b?"hover":v?"brush":"hover",L=jl(e=>e.clearSelection),[T,$]=d(null),N=l(()=>{L(_),$(null)},[L,_]),B=r(()=>(i||[]).map((e,t)=>void 0!==e[hu]?e:Object.assign(Object.assign({},e),{[hu]:t})),[i]),D=gc(B,c,u),E=void 0!==A?A:!!c,I=r(()=>{if(!E||!c)return null;const e="string"==typeof c?c:null;return e?[...new Set(B.map(t=>t[e]))].map(e=>({label:e+"",color:D?D(e+""):lc})):null},[E,c,B,D]),R=r(()=>({display:"grid",gridTemplateColumns:"40px "+a.map(()=>h+"px").join(" "),gridTemplateRows:a.map(()=>h+"px").join(" ")+" 40px",gap:g+"px",width:"fit-content"}),[a,h,g,40]);return t("div",{className:O,style:{position:"relative"},children:[I&&e("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"},children:I.map(n=>t("div",{style:{display:"flex",alignItems:"center",gap:4},children:[e("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",backgroundColor:n.color}}),e("span",{style:{fontSize:11},children:n.label})]},n.label))}),t("div",{style:R,onMouseLeave:"hover"===P?N:void 0,children:[a.map((n,i)=>t(o.Fragment,{children:[e("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:11,fontWeight:"bold",color:"#333"},children:s[n]||n}),a.map((t,o)=>i===o?"label"===y?e(mu,{label:s[n]||n,cellSize:h},"diag-"+n):e(yu,{data:B,field:n,label:s[n]||n,cellSize:h,bins:m,colorBy:c,colorScale:D,brushSelectionName:M,hoverSelectionName:_,unselectedOpacity:x,mode:P},"diag-"+n):e(pu,{data:B,xField:t,yField:n,fieldLabels:s,cellSize:h,pointRadius:f,pointOpacity:p,colorBy:c,colorScale:D,brushSelectionName:M,hoverSelectionName:_,unselectedOpacity:x,showGrid:k,tooltip:w,mode:P,onPointHover:"hover"===P?(e,r,a)=>{e?($({datum:e,xField:t,yField:n,colIndex:o,rowIndex:i,px:null!=r?r:0,py:null!=a?a:0}),C&&C({type:"hover",datum:e,x:null!=r?r:0,y:null!=a?a:0,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:j})):($(null),C&&C({type:"hover-end",timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:j}))}:void 0},`cell-${n}-${t}`))]},"row-"+n)),e("div",{})," ",a.map(t=>e("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:"bold",color:"#333"},children:s[t]||t},"col-label-"+t))]}),T&&"hover"===P&&(()=>{const n=T.datum,o=s[T.xField]||T.xField,i=s[T.yField]||T.yField,r=c?"function"==typeof c?c(n):n[c]:null,a=S?"function"==typeof S?S(n):n[S]:"Row "+n[hu];return t("div",{style:{position:"absolute",left:40+T.colIndex*(h+g)+T.px,top:T.rowIndex*(h+g)+T.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("div",{style:{fontWeight:"bold",marginBottom:2},children:a+""}),t("div",{children:[o,": ",null!=n[T.xField]?Number(n[T.xField]).toFixed(1):"–"]}),t("div",{children:[i,": ",null!=n[T.yField]?Number(n[T.yField]).toFixed(1):"–"]}),null!=r&&t("div",{style:{opacity:.8},children:["string"==typeof c?c:"group",": ",r+""]})]})})()]})}function bu(t){const{brushMode:n="crossfilter",hoverMode:o=!0}=t,i={};return!o&&n&&(i.splom={resolution:n}),o&&(i["splom-hover"]={resolution:"union"}),e(Gl,{selections:i,children:e(vu,Object.assign({},t))})}function xu({width:t,height:n,margin:o,scales:r,brushDirection:s,extent:l,onBrush:c}){const u=i(null),d=i(null),h=i(!1),g=t+o.left+o.right,f=n+o.top+o.bottom;return a(()=>{if(!u.current||!r)return;const e=y(u.current).select(".brush-group"),o="x"===s?m().extent([[0,0],[t,n]]):v().extent([[0,0],[t,n]]);return o.on("brush end",e=>{if(h.current)return;if(!e.sourceEvent)return;const t=e.selection;if(!t)return void c(null);const n=("x"===s?r.x:r.y).invert;if(!n)return;const o=[n(t[0]),n(t[1])];c(o)}),e.call(o),d.current=o,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.2).attr("stroke","steelblue").attr("stroke-width",1),()=>{o.on("brush end",null)}},[r,t,n,s,c]),a(()=>{if(!d.current||!r||!u.current)return;const e=y(u.current).select(".brush-group"),t="x"===s?r.x:r.y;if(h.current=!0,l){const n=[t(l[0]),t(l[1])];e.call(d.current.move,n)}else e.call(d.current.move,null);h.current=!1},[l,r,s]),e("svg",{ref:u,width:g,height:f,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:e("g",{className:"brush-group",transform:`translate(${o.left},${o.top})`})})}function ku(n){var o,s;const{data:c,width:u=600,height:h=400,margin:g,className:f,title:p,description:y,summary:m,xLabel:v,yLabel:b,xFormat:x,yFormat:k,xAccessor:w="x",yAccessor:A="y",lineBy:S,lineDataAccessor:O="coordinates",colorBy:C,colorScheme:j,curve:M="linear",lineWidth:_=2,fillArea:P=!1,areaOpacity:L=.3,showPoints:T=!1,pointRadius:$=3,enableHover:N=!0,showGrid:B=!1,showLegend:D,legendPosition:E,tooltip:I,minimap:R={},renderBefore:H=!1,onBrush:F,brushExtent:W,yExtent:z,frameProps:Y={},loading:G,loadingContent:q,emptyContent:X}=n,V=Pc(G,u,h,q),U=V?null:_c(c,u,h,X),Q=r(()=>me(c),[c]),[K,Z]=d(null),J=null!=W?W:K,ee=l(e=>{W||Z(e),null==F||F(e)},[W,F]),te=i(null),[ne,oe]=d(null);a(()=>{let e=0,t=!1;const n=()=>{var o,i;if(t)return;const r=null===(i=null===(o=te.current)||void 0===o?void 0:o.getScales)||void 0===i?void 0:i.call(o);r?oe(r):e=requestAnimationFrame(n)};return e=requestAnimationFrame(n),()=>{t=!0,e&&cancelAnimationFrame(e)}},[c]);const ie=void 0!==(null===(o=Q[0])||void 0===o?void 0:o[O]),re=r(()=>{if(ie)return Q;if(S){const e=Q.reduce((e,t)=>{const n="function"==typeof S?S(t):t[S];if(!e[n]){const t={[O]:[]};"string"==typeof S&&(t[S]=n),e[n]=t}return e[n][O].push(t),e},{});return Object.values(e)}return[{[O]:Q}]},[Q,S,O,ie]),ae=r(()=>ie||S?re.flatMap(e=>{const t=e[O]||[];return S&&"string"==typeof S?t.map(t=>Object.assign(Object.assign({},t),{[S]:e[S]})):t}):Q,[re,O,ie,S,Q]),se=gc(Q,C,j),le=nu({lineWidth:_,colorBy:C,colorScale:se,fillArea:P,areaOpacity:L}),ce=r(()=>{if(R.lineStyle)return R.lineStyle},[R.lineStyle]),ue=nu({lineWidth:1,colorBy:C,colorScale:se}),de=null!=ce?ce:ue,he=r(()=>{if(T)return e=>{const t={r:$,fillOpacity:1};return t.fill=C?mt(e.parentLine||e,C,se):lc,t}},[T,$,C,se]),{legend:ge,margin:fe,legendPosition:pe}=mc({data:re,colorBy:C,colorScale:se,showLegend:D,legendPosition:E,userMargin:g}),ye=R.height||60,ve=r(()=>{var e,t,n,o,i,r,a,s;return{top:null!==(t=null===(e=R.margin)||void 0===e?void 0:e.top)&&void 0!==t?t:0,bottom:null!==(o=null===(n=R.margin)||void 0===n?void 0:n.bottom)&&void 0!==o?o:20,left:null!==(r=null===(i=R.margin)||void 0===i?void 0:i.left)&&void 0!==r?r:fe.left,right:null!==(s=null===(a=R.margin)||void 0===a?void 0:a.right)&&void 0!==s?s:fe.right}},[R.margin,fe]),be=R.brushDirection||"x",xe=r(()=>vl([{label:v||gl(w),accessor:w,role:"x",format:x},{label:b||gl(A),accessor:A,role:"y",format:k}]),[w,A,v,b,x,k]),ke=Bc({componentName:"MinimapChart",data:c,accessors:{xAccessor:w,yAccessor:A}});if(ke)return e(wc,{componentName:"MinimapChart",message:ke,width:u,height:h});const we=P?"area":"line",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:we,data:ae,xAccessor:w,yAccessor:A,groupAccessor:S||void 0,curve:M,lineStyle:le},T&&{pointStyle:he}),{size:[u,h],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:fe,showAxes:!0,xLabel:v,yLabel:b,xFormat:x,yFormat:k,enableHover:N,showGrid:B}),ge&&{legend:ge,legendPosition:pe}),p&&{title:p}),y&&{description:y}),m&&{summary:m}),{tooltipContent:!1===I?()=>null:Ui(I)||xe}),J&&{xExtent:J}),z&&{yExtent:z}),void 0!==n.axisExtent&&{axisExtent:n.axisExtent}),void 0!==n.autoPlaceAnnotations&&{autoPlaceAnnotations:n.autoPlaceAnnotations}),Y),Se=Object.assign({chartType:we,data:ae,xAccessor:w,yAccessor:A,groupAccessor:S||void 0,curve:M,lineStyle:de,size:[u,ye+ve.top+ve.bottom],margin:ve,showAxes:null!==(s=R.showAxes)&&void 0!==s&&s,background:R.background,enableHover:!1},z&&{yExtent:z}),Oe=t("div",{style:{position:"relative",width:u,overflow:"hidden"},children:[e(Nr,Object.assign({ref:te},Se)),e(xu,{width:u-ve.left-ve.right,height:ye,margin:ve,scales:ne,brushDirection:be,extent:J,onBrush:ee})]},"minimap"),Ce=e("div",{style:{overflow:"hidden"},children:e(Nr,Object.assign({},Ae))},"main");return V||U||e(Cc,{componentName:"MinimapChart",width:u,height:h,children:t("div",{className:"minimap-chart"+(f?" "+f:""),children:[H?Oe:Ce,H?Ce:Oe]})})}bu.displayName="ScatterplotMatrix",ku.displayName="MinimapChart";const wu={label:"Low / High",color:"#E9C46A",opacity:.08},Au={label:"High / High",color:"#2A9D8F",opacity:.08},Su={label:"Low / Low",color:"#E76F51",opacity:.08},Ou={label:"High / Low",color:"#86BBD8",opacity:.08};function Cu(e,t){var n,o,i;return{label:null!==(n=null==t?void 0:t.label)&&void 0!==n?n:e.label,color:null!==(o=null==t?void 0:t.color)&&void 0!==o?o:e.color,opacity:null!==(i=null==t?void 0:t.opacity)&&void 0!==i?i:e.opacity}}const ju=g(function(o,a){const s=i(null);Hc(a,{variant:"xy",frameRef:s});const l=xc(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:c,margin:u,className:d,xFormat:h,yFormat:g,xAccessor:f="x",yAccessor:p="y",xCenter:y,yCenter:m,quadrants:v,centerlineStyle:b={},showQuadrantLabels:x=!0,quadrantLabelSize:k=12,colorBy:w,colorScheme:A,sizeBy:S,sizeRange:O=[3,15],pointRadius:C=5,pointOpacity:j=.8,tooltip:M,pointIdAccessor:_,annotations:P,frameProps:L={},selection:T,linkedHover:$,onObservation:N,onClick:B,hoverHighlight:D,chartId:E,loading:I,loadingContent:R,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:ne,yLabel:oe}=l,ie=r(()=>({topLeft:Cu(wu,null==v?void 0:v.topLeft),topRight:Cu(Au,null==v?void 0:v.topRight),bottomLeft:Cu(Su,null==v?void 0:v.bottomLeft),bottomRight:Cu(Ou,null==v?void 0:v.bottomRight)}),[v]),re=r(()=>me(c),[c]),ae=Rc({data:re,rawData:c,colorBy:w,colorScheme:A,legendInteraction:F,legendPosition:W,selection:T,linkedHover:$,fallbackFields:"string"==typeof w?[w]:[],unwrapData:!1,onObservation:N,onClick:B,hoverHighlight:D,chartType:"QuadrantChart",chartId:E,showLegend:K,userMargin:u,marginDefaults:l.marginDefaults,loading:I,loadingContent:R,emptyContent:H,width:X,height:V});Lc("QuadrantChart",re,"xAccessor",f),Lc("QuadrantChart",re,"yAccessor",p);const se=r(()=>{if(!re.length)return;const e="function"==typeof f?f:e=>+e[f],t="function"==typeof p?p:e=>+e[p];let n=1/0,o=-1/0,i=1/0,r=-1/0;for(const a of re){const s=e(a),l=t(a);isFinite(s)&&(n>s&&(n=s),s>o&&(o=s)),isFinite(l)&&(i>l&&(i=l),l>r&&(r=l))}if(null!=y&&isFinite(y)&&(n>y&&(n=y),y>o&&(o=y)),null!=m&&isFinite(m)&&(i>m&&(i=m),m>r&&(r=m)),n===1/0)return;const a=.1*(o-n)||1,s=.1*(r-i)||1;return{xExtent:[n-a,o+a],yExtent:[i-s,r+s]}},[re,f,p,y,m]),le=r(()=>{if(!S||0===re.length)return;const e=re.map(e=>"function"==typeof S?S(e):e[S]).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0!==e.length?[Math.min(...e),Math.max(...e)]:void 0},[re,S]),ce=r(()=>"function"==typeof f?f:e=>+e[f],[f]),ue=r(()=>"function"==typeof p?p:e=>+e[p],[p]),de=r(()=>e=>{const t=ce(e),n=ue(e),o=null!=y?t>=y:void 0,i=null!=m?n>=m:void 0;return void 0===i||void 0===o?z||lc:i&&o?ie.topRight.color:i&&!o?ie.topLeft.color:!i&&o?ie.bottomRight.color:ie.bottomLeft.color},[ce,ue,y,m,ie,z]),he=r(()=>S?e=>bt(e,S,O,le):void 0,[S,O,le]),ge=Wc({colorBy:w,colorScale:ae.colorScale,color:z,pointRadius:C,fillOpacity:j,radiusFn:he,fallbackFill:de,stroke:Y,strokeWidth:G,opacity:q,effectiveSelectionHook:ae.effectiveSelectionHook,resolvedSelection:ae.resolvedSelection}),fe=r(()=>{if(!re.length)return;const e=new Set;"string"==typeof f&&e.add(f),"string"==typeof p&&e.add(p),"string"==typeof w&&e.add(w),"string"==typeof S&&e.add(S);const t=re[0];for(const n of Object.keys(t))if(!n.startsWith("_")&&!e.has(n)&&"string"==typeof t[n])return n},[re,f,p,w,S]),pe=r(()=>vl([...fe?[{label:fe,accessor:fe,role:"title"}]:[],{label:ne||gl(f),accessor:f,role:"x",format:h},{label:oe||gl(p),accessor:p,role:"y",format:g},...w?[{label:gl(w),accessor:w,role:"color"}]:[],...S?[{label:gl(S),accessor:S,role:"size"}]:[]]),[fe,f,p,ne,oe,w,S,h,g]),ye=Bc({componentName:"QuadrantChart",data:c,accessors:{xAccessor:f,yAccessor:p}}),ve=r(()=>{var e;const t={stroke:b.stroke||"#999",strokeWidth:null!==(e=b.strokeWidth)&&void 0!==e?e:1,dashArray:b.strokeDasharray||[]};return[(e,n,o,i)=>{var r;if(!(null==o?void 0:o.x)||!(null==o?void 0:o.y))return;const a=i.width,s=i.height,l=null!=y?o.x(y):a/2,c=null!=m?o.y(m):s/2;if(null!=y&&!isFinite(l))return;if(null!=m&&!isFinite(c))return;const u=Math.max(0,Math.min(a,l)),d=Math.max(0,Math.min(s,c)),h=[{config:ie.topLeft,x:0,y:0,w:u,h:d},{config:ie.topRight,x:u,y:0,w:a-u,h:d},{config:ie.bottomLeft,x:0,y:d,w:u,h:s-d},{config:ie.bottomRight,x:u,y:d,w:a-u,h:s-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,s),e.stroke(),e.beginPath(),e.moveTo(0,d),e.lineTo(a,d),e.stroke(),e.setLineDash([])}]},[y,m,ie,b]),be=r(()=>x?[...ve,(e,t,n,o)=>{if(!(null==n?void 0:n.x)||!(null==n?void 0:n.y))return;const i=o.width,r=o.height,a=null!=y?n.x(y):i/2,s=null!=m?n.y(m):r/2;(null==y||isFinite(a))&&(null==m||isFinite(s))&&(e.font=`600 ${k}px sans-serif`,e.globalAlpha=.5,e.fillStyle=ie.topLeft.color,e.textAlign="left",e.textBaseline="top",e.fillText(ie.topLeft.label,8,8),e.fillStyle=ie.topRight.color,e.textAlign="right",e.textBaseline="top",e.fillText(ie.topRight.label,i-8,8),e.fillStyle=ie.bottomLeft.color,e.textAlign="left",e.textBaseline="bottom",e.fillText(ie.bottomLeft.label,8,r-8),e.fillStyle=ie.bottomRight.color,e.textAlign="right",e.textBaseline="bottom",e.fillText(ie.bottomRight.label,i-8,r-8),e.globalAlpha=1)}]:ve,[ve,x,k,ie,y,m]),xe=r(()=>{const e=L.canvasPreRenderers||[];return[...be,...e]},[be,L.canvasPreRenderers]),ke=r(()=>{var o;const i={stroke:b.stroke||"#999",strokeWidth:null!==(o=b.strokeWidth)&&void 0!==o?o:1,dashArray:b.strokeDasharray?Array.isArray(b.strokeDasharray)?b.strokeDasharray.join(","):b.strokeDasharray:void 0};return[(o,r,a)=>{if(!(null==r?void 0:r.x)||!(null==r?void 0:r.y))return null;const s=a.width,l=a.height,c=null!=y?r.x(y):s/2,u=null!=m?r.y(m):l/2;if(null!=y&&!isFinite(c))return null;if(null!=m&&!isFinite(u))return null;const d=Math.max(0,Math.min(s,c)),h=Math.max(0,Math.min(l,u));return t(n,{children:[[{config:ie.topLeft,x:0,y:0,w:d,h:h},{config:ie.topRight,x:d,y:0,w:s-d,h:h},{config:ie.bottomLeft,x:0,y:h,w:d,h:l-h},{config:ie.bottomRight,x:d,y:h,w:s-d,h:l-h}].map((t,n)=>{var o;return t.w>0&&t.h>0?e("rect",{x:t.x,y:t.y,width:t.w,height:t.h,fill:t.config.color,opacity:null!==(o=t.config.opacity)&&void 0!==o?o:.08},"qf-"+n):null}),e("line",{x1:d,y1:0,x2:d,y2:l,stroke:i.stroke,strokeWidth:i.strokeWidth,strokeDasharray:i.dashArray}),e("line",{x1:0,y1:h,x2:s,y2:h,stroke:i.stroke,strokeWidth:i.strokeWidth,strokeDasharray:i.dashArray}),x&&t(n,{children:[e("text",{x:8,y:8+k,fill:ie.topLeft.color,fontWeight:600,fontSize:k,opacity:.5,children:ie.topLeft.label}),e("text",{x:s-8,y:8+k,fill:ie.topRight.color,fontWeight:600,fontSize:k,opacity:.5,textAnchor:"end",children:ie.topRight.label}),e("text",{x:8,y:l-8,fill:ie.bottomLeft.color,fontWeight:600,fontSize:k,opacity:.5,children:ie.bottomLeft.label}),e("text",{x:s-8,y:l-8,fill:ie.bottomRight.color,fontWeight:600,fontSize:k,opacity:.5,textAnchor:"end",children:ie.bottomRight.label})]})]})}]},[y,m,ie,b,x,k]);if(ae.earlyReturn)return ae.earlyReturn;const we=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!=c&&{data:re}),{xAccessor:f,yAccessor:p,colorAccessor:w||void 0,sizeAccessor:S||void 0,sizeRange:O,pointStyle:ge,colorScheme:A,size:[X,V],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ae.margin,showAxes:l.showAxes,xLabel:ne,yLabel:oe,xFormat:h,yFormat:g,enableHover:U,showGrid:Q}),se&&{xExtent:se.xExtent,yExtent:se.yExtent}),ae.legendBehaviorProps),Z&&{title:Z}),J&&{description:J}),ee&&{summary:ee}),void 0!==te&&{accessibleTable:te}),d&&{className:d}),null!=o.animate&&{animate:o.animate}),void 0!==o.axisExtent&&{axisExtent:o.axisExtent}),void 0!==o.autoPlaceAnnotations&&{autoPlaceAnnotations:o.autoPlaceAnnotations}),{tooltipContent:!1===M?()=>null:!0===M||void 0===M?pe:Ui(M)||pe}),($||N||B||D)&&{customHoverBehavior:ae.customHoverBehavior}),(N||B||$)&&{customClickBehavior:ae.customClickBehavior}),_&&{pointIdAccessor:_}),P&&P.length>0&&{annotations:P}),{canvasPreRenderers:xe}),ae.crosshairProps),L),xe.length>0&&{canvasPreRenderers:xe}),{svgPreRenderers:ke});return ye?e(wc,{componentName:"QuadrantChart",message:ye,width:X,height:V}):e(Cc,{componentName:"QuadrantChart",width:X,height:V,children:e(Nr,Object.assign({ref:s},we))})});ju.displayName="QuadrantChart";const Mu="__ma_unitized",_u="__ma_series";function Pu(e,t){const n=t[1]-t[0];return 0===n?.5:(e-t[0])/n}function Lu(e,t){return t[0]+e*(t[1]-t[0])}const Tu=g(function(t,n){var a;const s=i(null),c=i([]),u=i(t.series);u.current=t.series,p(n,()=>{const e=()=>{var e;return(null!==(e=u.current)&&void 0!==e?e:[]).filter(e=>null!=e&&"object"==typeof e)};return{push:t=>{if(!s.current)return;const n=e(),o=t;for(let e=0;n.length>e&&2>e;e++){const t=n[e],i=t.extent||c.current[e];if(!i)continue;const r=("function"==typeof t.yAccessor?t.yAccessor:e=>e[t.yAccessor])(o);null!=r&&isFinite(r)&&s.current.push(Object.assign(Object.assign({},o),{[Mu]:Pu(r,i),[_u]:t.label||"Series "+(e+1)}))}},pushMany:t=>{if(!s.current)return;const n=e(),o=[];for(const e of t)for(let t=0;n.length>t&&2>t;t++){const i=n[t],r=i.extent||c.current[t];if(!r)continue;const a=("function"==typeof i.yAccessor?i.yAccessor:e=>e[i.yAccessor])(e);null!=a&&isFinite(a)&&o.push(Object.assign(Object.assign({},e),{[Mu]:Pu(a,r),[_u]:i.label||"Series "+(t+1)}))}s.current.pushMany(o)},remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}},[]);const d=xc(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,xLabel:t.xLabel,accessibleTable:t.accessibleTable},{width:800,height:400}),{data:h,margin:g,className:f,xFormat:y,xAccessor:m="x",series:v,colorScheme:b,curve:x="monotoneX",lineWidth:k=2,tooltip:w,annotations:A,frameProps:S={},selection:O,linkedHover:C,onObservation:j,onClick:M,hoverHighlight:_,chartId:P,loading:L,loadingContent:T,emptyContent:$,legendInteraction:N,legendPosition:B,stroke:D,strokeWidth:E,opacity:I}=t,{width:R,height:H,enableHover:F,showGrid:W,showLegend:z=!0,title:Y,description:G,summary:q,accessibleTable:X,xLabel:V}=d,U=r(()=>me(h),[h]),Q=r(()=>me(v),[v]),K=Q,Z=2===Q.length;"undefined"==typeof process||"production"===(null===(a=process.env)||void 0===a?void 0:a.NODE_ENV)||Z||console.warn(`[MultiAxisLineChart] Expected exactly 2 series for dual-axis mode, got ${Q.length}. Rendering as a standard multi-line chart.`);const J=Pc(L,R,H,T),ee=J?null:_c(h,R,H,$),te=dc(),ne=r(()=>{let e;if(Array.isArray(b))e=b;else if(te&&te.length>0)e=te;else{const t=ht[b];e=Array.isArray(t)?t:gt}return K.map((t,n)=>t.color||e[n%e.length])},[K,b,te]),oe=r(()=>Q.map((e,t)=>e.label||"Series "+(t+1)),[Q]),{unitizedData:ie,extents:re}=r(()=>{if(0===U.length){const e=Q.map(e=>e.extent||null).filter(Boolean);return e.length===Q.length&&(c.current=e),{unitizedData:[],extents:e.length===Q.length?e:[]}}const e=Q.map(e=>e.extent||function(e,t){let n=1/0,o=-1/0;const i="function"==typeof t?t:e=>e[t];for(const t of e){const e=i(t);null!=e&&isFinite(e)&&(n>e&&(n=e),e>o&&(o=e))}if(!isFinite(n)||!isFinite(o))return[0,1];if(n===o){const e=0===n?1:.1*Math.abs(n);return[n-e,o+e]}return[n,o]}(U,e.yAccessor));if(c.current=e,!Z){const t=[];for(const e of U)for(let n=0;Q.length>n;n++){const o=Q[n],i=("function"==typeof o.yAccessor?o.yAccessor:e=>e[o.yAccessor])(e);null!=i&&t.push(Object.assign(Object.assign({},e),{[Mu]:i,[_u]:oe[n]}))}return{unitizedData:t,extents:e}}const t=[];for(const n of U)for(let o=0;2>o;o++){const i=Q[o],r=("function"==typeof i.yAccessor?i.yAccessor:e=>e[i.yAccessor])(n);null!=r&&t.push(Object.assign(Object.assign({},n),{[Mu]:Pu(r,e[o]),[_u]:oe[o]}))}return{unitizedData:t,extents:e}},[U,Q,Z,oe]),ae=r(()=>{if(Z&&re.length>=2)return[{orient:"left",label:oe[0],tickFormat:Q[0].format||(e=>{const t=Lu(e,re[0]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"right",label:oe[1],tickFormat:Q[1].format||(e=>{const t=Lu(e,re[1]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"bottom"}]},[Z,re,Q,oe]),se=Rc({data:r(()=>ie.length>0?ie:oe.map(e=>({[_u]:e})),[ie,oe]),rawData:h,colorBy:_u,colorScheme:ne,legendInteraction:N,legendPosition:B,selection:O,linkedHover:C,fallbackFields:[_u],unwrapData:!1,onObservation:j,onClick:M,hoverHighlight:_,chartType:"MultiAxisLineChart",chartId:P,showLegend:z,userMargin:g,marginDefaults:Z?Object.assign(Object.assign({},d.marginDefaults),{left:70,right:70}):d.marginDefaults,loading:L,loadingContent:T,emptyContent:$,width:R,height:H}),le=r(()=>{const e=new Map;return oe.forEach((t,n)=>e.set(t,ne[n])),e},[oe,ne]),ce=nu({lineWidth:k,resolveStroke:l(e=>le.get(e[_u])||ne[0],[le,ne]),stroke:D,strokeWidth:E,opacity:I,effectiveSelectionHook:se.effectiveSelectionHook,resolvedSelection:se.resolvedSelection}),ue=r(()=>{if(!1===w)return()=>null;return Ui(w)||(e=>{var t;const n=e.data||e,i=n[_u],r=oe.indexOf(i),a=n[Mu],s=Z&&r>=0&&re[r]?Lu(a,re[r]):a,l=r>=0&&(null===(t=Q[r])||void 0===t?void 0:t.format)?Q[r].format:e=>Number.isInteger(e)?e+"":e.toFixed(2),c="function"==typeof m?m(n):n[m];return o.createElement("div",{style:{padding:"6px 10px",fontFamily:"var(--semiotic-font-family, sans-serif)",fontSize:"var(--semiotic-tooltip-font-size, 13px)"}},o.createElement("div",{style:{fontWeight:600,marginBottom:4,color:ne[r]||"inherit"}},i),o.createElement("div",null,`${"string"==typeof m?m:"x"}: ${c}`),o.createElement("div",null,`${i}: ${l(s)}`))})},[w,oe,ne,re,Z,Q,m]);if(se.earlyReturn)return se.earlyReturn;const de=Bc({componentName:"MultiAxisLineChart",data:h,accessors:{xAccessor:m}}),he=Z?[0,1]:void 0,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(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"line"},null!=h&&{data:ie}),{xAccessor:m,yAccessor:Mu,groupAccessor:_u,lineStyle:ce,colorScheme:ne,size:[R,H],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:se.margin,showAxes:d.showAxes}),ae&&{axes:ae}),{xLabel:V}),Z?{}:{yLabel:oe[0]}),{xFormat:y}),Z&&he&&{yExtent:he}),{enableHover:F}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),{showGrid:W,curve:x}),se.legendBehaviorProps),Y&&{title:Y}),G&&{description:G}),q&&{summary:q}),void 0!==X&&{accessibleTable:X}),f&&{className:f}),null!=t.animate&&{animate:t.animate}),void 0!==t.axisExtent&&{axisExtent:t.axisExtent}),void 0!==t.autoPlaceAnnotations&&{autoPlaceAnnotations:t.autoPlaceAnnotations}),{tooltipContent:ue}),A&&{annotations:A}),(C||j||M||_)&&{customHoverBehavior:se.customHoverBehavior}),(j||M||C)&&{customClickBehavior:se.customClickBehavior}),se.crosshairProps),S);return J||ee||(de?e(wc,{componentName:"MultiAxisLineChart",message:de,width:R,height:H}):e(Cc,{componentName:"MultiAxisLineChart",width:R,height:H,children:e(Nr,Object.assign({ref:s},ge))}))});function $u(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}Tu.displayName="MultiAxisLineChart";const Nu=g(function(t,n){const o=i(null);Hc(n,{variant:"xy",frameRef:o});const a=xc(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,title:t.title,xLabel:t.xLabel,yLabel:t.yLabel,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable}),{data:s,margin:l,className:c,xFormat:u,yFormat:d,xAccessor:h="x",highAccessor:g="high",lowAccessor:f="low",openAccessor:p,closeAccessor:y,candlestickStyle:m,tooltip:v,annotations:b,xExtent:x,yExtent:k,frameProps:w={},selection:A,linkedHover:S,onObservation:O,onClick:C,chartId:j,loading:M,loadingContent:_,emptyContent:P}=t,{width:L,height:T,enableHover:$,showGrid:N,title:B,description:D,summary:E,accessibleTable:I,xLabel:R,yLabel:H}=a,F=Pc(M,L,T,_),W=F?null:_c(s,L,T,P),z=r(()=>me(s),[s]),Y=null==p||null==y;Lc("CandlestickChart",z,"xAccessor",h),Lc("CandlestickChart",z,"highAccessor",g),Lc("CandlestickChart",z,"lowAccessor",f),Y||(Lc("CandlestickChart",z,"openAccessor",p),Lc("CandlestickChart",z,"closeAccessor",y));const{customHoverBehavior:G,customClickBehavior:q,crosshairSourceId:X}=pc({selection:A,linkedHover:S,onObservation:O,onClick:C,chartType:"CandlestickChart",chartId:j}),V=yc(S,X),U=r(()=>{const e=a.marginDefaults,n="sparkline"===t.mode?Object.assign(Object.assign({},e),{top:0,bottom:0}):e;return null==l?n:Object.assign(Object.assign({},n),$u(l))},[l,a.marginDefaults,t.mode]),Q=r(()=>{const e=[{label:R||gl(h),accessor:h,role:"x",format:u}];return Y?(e.push({label:"High",accessor:g,role:"y",format:d}),e.push({label:"Low",accessor:f,format:d})):(e.push({label:"Open",accessor:p,format:d}),e.push({label:"High",accessor:g,format:d}),e.push({label:"Low",accessor:f,format:d}),e.push({label:"Close",accessor:y,format:d})),vl(e)},[h,R,u,d,g,f,p,y,Y]),K=Bc({componentName:"CandlestickChart",data:s,accessors:Object.assign({xAccessor:h,highAccessor:g,lowAccessor:f},!Y&&{openAccessor:p,closeAccessor:y})}),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:h,yAccessor:g,highAccessor:g,lowAccessor:f}),!Y&&{openAccessor:p,closeAccessor:y}),m&&{candlestickStyle:m}),{scalePadding:Z,extentPadding:J,size:[L,T],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:U,showAxes:a.showAxes,xLabel:R,yLabel:H,xFormat:u,yFormat:d,enableHover:$,showGrid:N}),t.pointIdAccessor&&{pointIdAccessor:t.pointIdAccessor}),ul({title:B,description:D,summary:E,accessibleTable:I,className:c,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),hl({tooltip:v,defaultTooltipContent:Q})),dl({linkedHover:S,onObservation:O,onClick:C,customHoverBehavior:G,customClickBehavior:q})),b&&b.length>0&&{annotations:b}),x&&{xExtent:x}),k&&{yExtent:k}),V),w);return F||W||(K?e(wc,{componentName:"CandlestickChart",message:K,width:L,height:T}):e(Cc,{componentName:"CandlestickChart",width:L,height:T,children:e(Nr,Object.assign({ref:o},ee))}))});function Bu(e){const t=i(null);return Hc(e.imperativeRef,{variant:e.imperativeVariant,frameRef:t}),{frameRef:t,resolved:xc(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:r(()=>$u(e.margin),[e.margin])}}function Du(e){var t;const n=Bu(e),{resolved:o,normalizedMargin:i}=n,r=Rc({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:o.showLegend,userMargin:i,marginDefaults:o.marginDefaults,loading:e.loading,loadingContent:e.loadingContent,emptyContent:e.emptyContent,width:o.width,height:o.height});return Object.assign(Object.assign({},n),{safeData:r.data,setup:r,earlyReturn:r.earlyReturn})}Nu.displayName="CandlestickChart";const Eu=g(function(t,n){const{data:o,layout:i,layoutConfig:r,xExtent:a,yExtent:s,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:S,setup:O,earlyReturn:C}=Du({imperativeRef:n,imperativeVariant:"xy",chartTypeLabel:"XYCustomChart",unwrapData:!1,data:o,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(C)return C;const{width:j,height:M,enableHover:_,showGrid:P,title:L,description:T,summary:$,accessibleTable:N,xLabel:B,yLabel:D}=A,E=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"custom"},null!=o&&{data:S}),{customLayout:i,layoutConfig:r,xExtent:a,yExtent:s,colorScheme:x,size:[j,M],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:O.margin,showAxes:l,xLabel:B,yLabel:D,enableHover:_,showGrid:P}),O.legendBehaviorProps),ul({title:L,description:T,summary:$,accessibleTable:N,className:u,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),null!=t.tooltip&&{tooltipContent:t.tooltip}),dl({linkedHover:p,onObservation:h,onClick:g,hoverHighlight:!1,customHoverBehavior:O.customHoverBehavior,customClickBehavior:O.customClickBehavior})),d&&d.length>0&&{annotations:d}),O.crosshairProps),k);return e(Cc,{componentName:"XYCustomChart",width:j,height:M,children:e(Nr,Object.assign({ref:w},E))})});Eu.displayName="XYCustomChart";const Iu=g(function(t,n){const{nodes:o,edges:i,layout:a,layoutConfig:s,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={}}=t,{frameRef:x,resolved:k,normalizedMargin:w}=Bu({imperativeRef:n,imperativeVariant:"network",margin:d,width:t.width,height:t.height,enableHover:t.enableHover,title:t.title,mode:t.mode}),A=r(()=>me(null!=o?o:[]),[o]),S=r(()=>me(null!=i?i:[]),[i]),{customHoverBehavior:O,customClickBehavior:C,activeSelectionHook:j}=pc({selection:f,linkedHover:p,fallbackFields:[],onObservation:y,onClick:m,chartType:"NetworkCustomChart",chartId:v}),M=r(()=>(null==j?void 0:j.isActive)?{isActive:!0,predicate:j.predicate}:null,[null==j?void 0:j.isActive,null==j?void 0:j.predicate]),{width:_,height:P,enableHover:L,title:T,description:$,summary:N,accessibleTable:B}=k,D=Object.assign(Object.assign(Object.assign(Object.assign({chartType:"force"},null!=o&&{nodes:A}),null!=i&&{edges:S}),{customNetworkLayout:a,layoutConfig:s,nodeIDAccessor:l,sourceAccessor:c,targetAccessor:u,colorScheme:g,size:[_,P],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:w,className:h,title:T,description:$,summary:N,accessibleTable:B,enableHover:L,customHoverBehavior:p||y||m?O:void 0,customClickBehavior:y||m?C:void 0,layoutSelection:M}),b);return e(Cc,{componentName:"NetworkCustomChart",width:_,height:P,children:e(cl,Object.assign({ref:x},D))})});Iu.displayName="NetworkCustomChart";const Ru=g(function(t,n){const{data:o,layout:i,layoutConfig:r,categoryAccessor:a="category",valueAccessor:s="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:S={}}=t,{frameRef:O,resolved:C,safeData:j,setup:M,earlyReturn:_}=Du({imperativeRef:n,imperativeVariant:"xy",chartTypeLabel:"OrdinalCustomChart",unwrapData:!0,data:o,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:N,description:B,summary:D,accessibleTable:E}=C,I=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"custom"},null!=o&&{data:j}),{customLayout:i,layoutConfig:r,oAccessor:a,rAccessor:s,oExtent:l,rExtent:c,projection:u,colorScheme:g,size:[P,L],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:M.margin,enableHover:T,showAxes:f,showGrid:$,annotations:p}),ul({title:N,description:B,summary:D,accessibleTable:E,className:h,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),dl({linkedHover:b,onObservation:y,onClick:m,hoverHighlight:!1,customHoverBehavior:M.customHoverBehavior,customClickBehavior:M.customClickBehavior})),S);return e(Cc,{componentName:"OrdinalCustomChart",width:P,height:L,children:e(va,Object.assign({ref:O},I))})});function Hu({ref:e,frameRef:t,setup:n}){return p(e,()=>({push:e=>{var n;return null===(n=t.current)||void 0===n?void 0:n.push(e)},pushMany:e=>{var n;return null===(n=t.current)||void 0===n?void 0:n.pushMany(e)},remove:e=>{var n,o;return null!==(o=null===(n=t.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[]},update:(e,n)=>{var o,i;return null!==(i=null===(o=t.current)||void 0===o?void 0:o.update(e,n))&&void 0!==i?i:[]},clear:()=>{var e;return null===(e=t.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,n;return null!==(n=null===(e=t.current)||void 0===e?void 0:e.getData())&&void 0!==n?n:[]},getScales:()=>{var e,n;return null!==(n=null===(e=t.current)||void 0===e?void 0:e.getScales())&&void 0!==n?n:null}}),[t]),{effectiveLegendProps:n.legendBehaviorProps,effectiveMargin:n.margin}}function Fu(e){const{colorBy:t,colorScale:n,color:o,themeCategorical:i,colorScheme:a,categoryIndexMap:s,userPieceStyle:l,stroke:c,strokeWidth:u,opacity:d,effectiveSelectionHook:h,resolvedSelection:g,cycleByCategory:f=!1,baseStyleExtras:p,linkStrokeToFill:y=!1}=e,m=r(()=>(e,r)=>{const l="function"==typeof p?p(e,r):p,c=l?Object.assign({},l):{};if(void 0===c.fill)if(t){if(!n)return c;c.fill=mt(e,t,n)}else c.fill=hc(o,i,a,f?r:void 0,s);return y&&void 0===c.stroke&&void 0!==c.fill&&(c.stroke=c.fill),c},[t,n,o,i,a,s,f,p,y]),v=r(()=>Fc(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 r(()=>Vl(v,null!=h?h:null,g),[v,h,g])}Ru.displayName="OrdinalCustomChart";const Wu=g(function(t,n){const o=xc(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),a=i(null),{data:s,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="vertical",valueFormat:g,colorBy:f,colorScheme:p,sort:y=!1,barPadding:m=40,roundedTop:v,gradientFill:b=!1,baselinePadding:x=!1,tooltip:k,annotations:w,regression:A,valueExtent:S,frameProps:O={},selection:C,linkedHover:j,onObservation:M,onClick:_,hoverHighlight:P,chartId:L,loading:T,loadingContent:$,emptyContent:N,legendInteraction:B,legendPosition:D,color:E,stroke:I,strokeWidth:R,opacity:H,showCategoryTicks:F,categoryFormat:W,dataIdAccessor:z}=t,{width:Y,height:G,enableHover:q,showGrid:X,showLegend:V,title:U,description:Q,summary:K,accessibleTable:Z,categoryLabel:J,valueLabel:ee}=o,te=r(()=>me(s),[s]),ne=Rc({data:te,rawData:s,colorBy:f,colorScheme:p,legendInteraction:B,legendPosition:D,selection:C,linkedHover:j,fallbackFields:f?["string"==typeof f?f:""]:[],unwrapData:!0,onObservation:M,onClick:_,hoverHighlight:P,chartType:"BarChart",chartId:L,showLegend:V,userMargin:l,marginDefaults:o.marginDefaults,loading:T,loadingContent:$,emptyContent:N,width:Y,height:G}),{effectiveLegendProps:oe,effectiveMargin:ie}=Hu({ref:n,frameRef:a,setup:ne});Lc("BarChart",te,"categoryAccessor",u),Lc("BarChart",te,"valueAccessor",d);const re=fc(te,y,d),ae=dc(),se=r(()=>new Map,[te]),le=Fu({colorBy:f,colorScale:ne.colorScale,color:E,themeCategorical:ae,colorScheme:p,categoryIndexMap:se,userPieceStyle:null==O?void 0:O.pieceStyle,stroke:I,strokeWidth:R,opacity:H,effectiveSelectionHook:ne.effectiveSelectionHook,resolvedSelection:ne.resolvedSelection}),ce=r(()=>bl({categoryAccessor:u,valueAccessor:d,groupAccessor:f&&f!==u?f:void 0,groupLabel:"string"==typeof f?f:"group",valueFormat:g}),[u,d,f,g]);if(ne.earlyReturn)return ne.earlyReturn;const ue=Bc({componentName:"BarChart",data:s,accessors:{categoryAccessor:u,valueAccessor:d}});if(ue)return e(wc,{componentName:"BarChart",message:ue,width:Y,height:G});const de=Yc(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:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:le,size:[Y,G],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ie,barPadding:m}),null!=v&&{roundedTop:v}),b&&{gradientFill:!0===b?{topOpacity:.8,bottomOpacity:.05}:b}),z&&{dataIdAccessor:z}),{baselinePadding:x,enableHover:q,showAxes:o.showAxes,oLabel:J,rLabel:ee,rFormat:g}),W&&{oFormat:W}),{showGrid:X,showCategoryTicks:F,oSort:y}),oe),ul({title:U,description:Q,summary:K,accessibleTable:Z,className:c,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),hl({tooltip:k,defaultTooltipContent:ce})),dl({linkedHover:j,onObservation:M,onClick:_,hoverHighlight:P,customHoverBehavior:ne.customHoverBehavior,customClickBehavior:ne.customClickBehavior})),he&&he.length>0&&{annotations:he}),S&&{rExtent:S}),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return e(Cc,{componentName:"BarChart",width:Y,height:G,children:e(va,Object.assign({ref:a},ge))})});Wu.displayName="BarChart";const zu=g(function(t,n){const o=xc(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),a=i(null),{data:s,margin:l,className:c,categoryAccessor:u="category",stackBy:d,valueAccessor:h="value",orientation:g="vertical",valueFormat:f,colorBy:p,colorScheme:y,normalize:m=!1,sort:v=!1,barPadding:b=40,roundedTop:x,baselinePadding:k=!1,tooltip:w,annotations:A,valueExtent:S,frameProps:O={},selection:C,linkedHover:j,onObservation:M,onClick:_,hoverHighlight:P,chartId:L,loading:T,loadingContent:$,emptyContent:N,legendInteraction:B,legendPosition:D,color:E,stroke:I,strokeWidth:R,opacity:H,categoryFormat:F}=t,{width:W,height:z,enableHover:Y,showGrid:G,showLegend:q,title:X,description:V,summary:U,accessibleTable:Q,categoryLabel:K,valueLabel:Z}=o,J=r(()=>me(s),[s]),ee=p||d,te=Rc({data:J,rawData:s,colorBy:ee,colorScheme:y,legendInteraction:B,legendPosition:D,selection:C,linkedHover:j,fallbackFields:ee?["string"==typeof ee?ee:""]:[],unwrapData:!0,onObservation:M,onClick:_,hoverHighlight:P,chartType:"StackedBarChart",chartId:L,showLegend:q,userMargin:l,marginDefaults:o.marginDefaults,loading:T,loadingContent:$,emptyContent:N,width:W,height:z}),ne=dc(),oe=r(()=>new Map,[J]),ie=Fu({colorBy:ee,colorScale:te.colorScale,color:E,themeCategorical:ne,colorScheme:y,categoryIndexMap:oe,userPieceStyle:null==O?void 0:O.pieceStyle,stroke:I,strokeWidth:R,opacity:H,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection}),re=r(()=>bl({categoryAccessor:d,valueAccessor:h,groupAccessor:u,valueFormat:f}),[d,u,h,f]),ae=Bc({componentName:"StackedBarChart",data:s,accessors:{categoryAccessor:u,valueAccessor:h},requiredProps:{stackBy:d}}),{effectiveLegendProps:se,effectiveMargin:le}=Hu({ref:n,frameRef:a,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:u,rAccessor:h,stackBy:d,normalize:m,oSort:v,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:ie,size:[W,z],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:le,barPadding:b}),null!=x&&{roundedTop:x}),{baselinePadding:k,enableHover:Y}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:o.showAxes,oLabel:K,rLabel:Z,rFormat:f}),F&&{oFormat:F}),{showGrid:G}),se),ul({title:X,description:V,summary:U,accessibleTable:Q,className:c,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),hl({tooltip:w,defaultTooltipContent:re})),dl({linkedHover:j,onObservation:M,onClick:_,hoverHighlight:P,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior})),A&&A.length>0&&{annotations:A}),S&&{rExtent:S}),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return ae?e(wc,{componentName:"StackedBarChart",message:ae,width:W,height:z}):e(Cc,{componentName:"StackedBarChart",width:W,height:z,children:e(va,Object.assign({ref:a},ce))})});zu.displayName="StackedBarChart";const Yu={RdBu:rt,PiYG:at,PRGn:st,BrBG:lt,RdYlBu:ct,RdYlGn:ut,Spectral:dt},Gu="__likert_neutral_neg",qu="__likert_neutral_pos";function Xu(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function Vu(e,t,n,o,i,r){const a=new Map,s=new Set(t);for(const l of e){const e=n(l);a.has(e)||a.set(e,new Map);const c=a.get(e);if(o){const e=o(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 n=e-1;if(0>n||n>=t.length)continue;const i=t[n];c.set(i,(c.get(i)||0)+1)}else if(i&&r){const e=i(l),t=r(l);if(!s.has(e))continue;c.set(e,(c.get(e)||0)+(Number.isFinite(t)?t:0))}}const l=[];for(const[e,n]of a){let o=0;for(const e of t)o+=n.get(e)||0;if(0!==o)for(let i=0;t.length>i;i++){const r=t[i],a=n.get(r)||0;l.push({__likertCategory:e,__likertLevel:r,__likertLevelLabel:r,__likertCount:a,__likertPct:a/o*100,__likertLevelIndex:i})}}return l}function Uu(e,t){const n=t.length,o=n%2!=0,i=Math.floor(n/2),r=[];for(const t of e){const e=t.__likertLevelIndex;if(o&&e===i){const e=t.__likertPct/2;r.push(Object.assign(Object.assign({},t),{__likertLevel:Gu,__likertPct:-e})),r.push(Object.assign(Object.assign({},t),{__likertLevel:qu,__likertPct:e}))}else r.push(i>e?Object.assign(Object.assign({},t),{__likertPct:-t.__likertPct}):t)}return r}function Qu(e,t){const n=t.length,o=n%2!=0,i=Math.floor(n/2),r=new Map;for(const t of e){const e=r.get(t.__likertCategory)||[];e.push(t),r.set(t.__likertCategory,e)}const a=[];for(const[,e]of r){const t=new Map;let r,s;for(const n of e)n.__likertLevel===Gu?r=n:n.__likertLevel===qu?s=n:t.set(n.__likertLevelIndex,n);o&&r&&a.push(r);for(let e=i-1;e>=0;e--){const n=t.get(e);n&&a.push(n)}o&&s&&a.push(s);for(let e=o?i+1:i;n>e;e++){const n=t.get(e);n&&a.push(n)}}return a}const Ku=["Very Low","Low","Neutral","High","Very High"],Zu=new Map,Ju=g(function(t,n){const a=xc(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=i(null),{data:c,margin:u,className:h,categoryAccessor:g="question",valueAccessor:f,levelAccessor:y,countAccessor:m="count",levels:v=Ku,orientation:b="horizontal",colorScheme:x,barPadding:k=20,tooltip:w,annotations:A,valueExtent:S,frameProps:O={},selection:C,linkedHover:j,onObservation:M,onClick:_,hoverHighlight:P,chartId:L,valueFormat:T,loading:$,loadingContent:N,emptyContent:B,legendInteraction:D,legendPosition:E,categoryFormat:I,stroke:R,strokeWidth:H,opacity:F}=t,{width:W,height:z,enableHover:Y,showGrid:G,showLegend:q,title:X,description:V,summary:U,accessibleTable:Q,categoryLabel:K,valueLabel:Z}=a,J="horizontal"===b,ee=void 0===c,te=!y,ne=function(){var e;const t=sc();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.diverging)||void 0}(),oe=r(()=>x&&Array.isArray(x)&&x.length>=v.length?x:function(e,t){if(0>=e)return[];if(t){const n=Yu[t];if(n){if(1===e)return[n(.5)];const t=[];for(let o=0;e>o;o++)t.push(n(o/(e-1)));return t}}const n=["#da1e28","#ff8389","#ffb3b8"],o=["#a6c8ff","#4589ff","#0043ce"],i="#a8a8a8";if(1===e)return[i];const r=e%2!=0,a=Math.floor(e/2),s=[];for(let e=0;a>e;e++)s.push(n[Math.min(Math.floor(e*n.length/a),n.length-1)]);r&&s.push(i);for(let e=0;a>e;e++)s.push(o[Math.min(Math.floor(e*o.length/a),o.length-1)]);return s}(v.length,ne),[x,v.length,ne]),ie=r(()=>{const e=new Map;for(let t=0;v.length>t;t++)e.set(v[t],oe[t]||"#888");return e},[v,oe]),{processedData:re,reAggregate:ae,accumulatorRef:se}=function({data:e,levels:t,categoryAccessor:n,valueAccessor:o,levelAccessor:a,countAccessor:s,isDiverging:c,frameRef:u}){const d=!a,h=r(()=>Xu(n,"question"),[n]),g=r(()=>d?Xu(o,"score"):null,[d,o]),f=r(()=>d?null:Xu(a,"level"),[d,a]),p=r(()=>d?null:Xu(s,"count"),[d,s]),y=e||[],m=i([]),v=r(()=>{if(0===y.length)return[];let e=Vu(y,t,h,g,f,p);return c&&(e=Uu(e,t),e=Qu(e,t)),e},[y,t,h,g,f,p,c]),b=l(e=>{var n;let o=Vu(e,t,h,g,f,p);c&&(o=Uu(o,t),o=Qu(o,t)),null===(n=u.current)||void 0===n||n.replace(o)},[t,h,g,f,p,c,u]);return{processedData:v,reAggregate:b,accumulatorRef:m}}({data:c,levels:v,categoryAccessor:g,valueAccessor:f,levelAccessor:y,countAccessor:m,isDiverging:J,frameRef:s}),le="__likertLevelLabel",ce=function({isPushMode:e,colorBy:t,colorScheme:n,showLegend:o,legendPosition:a="right"}){const s=i(new Set),c=i([]),[u,h]=d(0),g=wl(),f=dc(),p=l(e=>{const n=e[t];return null!=n?n+"":null},[t]),y=l(n=>{if(!e||!t)return;let o=!1;for(const e of n){if(!e||"object"!=typeof e)continue;const t=p(e);null==t||s.current.has(t)||(s.current.add(t),c.current.push(t),o=!0)}o&&h(e=>e+1)},[e,t,p]),m=l(n=>{if(!e||!t)return;const o=Array.from(new Set(n.map(String))),i=c.current;i.length===o.length&&i.every((e,t)=>e===o[t])||(s.current=new Set(o),c.current=o,h(e=>e+1))},[e,t]),v=l(e=>t=>{y([t]),e(t)},[y]),b=l(e=>t=>{y(t),e(t)},[y]),x=l(()=>{s.current=new Set,c.current=[],h(e=>e+1)},[]);Wl(e&&t?c.current:[]);const k=r(()=>{if(!e||!t||!1===o)return;const i=c.current;if(0===i.length)return;const r=Array.isArray(n)&&n.length>0||"string"==typeof n&&n.length>0?n:f&&f.length>0?f:ft,a=t,s=i.map(e=>({[a]:e})),l=vt(s,a,r);return ql({data:s,colorBy:a,colorScale:e=>(null==g?void 0:g[e])||l(e)||"#999",getColor:mt})},[e,t,o,n,g,f,u]),w=r(()=>{if(k)return"right"===a?{right:110}:"left"===a?{left:110}:"top"===a?{top:50}:"bottom"===a?{bottom:80}:{right:110}},[k,a]);return{wrapPush:v,wrapPushMany:b,resetCategories:x,categories:c.current,categoryDomainProps:e&&t?{legendCategoryAccessor:t,onCategoriesChange:m}:{},streamingLegend:k,streamingMarginAdjust:w}}({isPushMode:ee,colorBy:le,colorScheme:oe,showLegend:q,legendPosition:E}),ue=l(ce.wrapPush(e=>{se.current.push(e),ae(se.current)}),[ce.wrapPush,ae,se]),de=l(ce.wrapPushMany(e=>{se.current.push(...e),ae(se.current)}),[ce.wrapPushMany,ae,se]);p(n,()=>({push:ue,pushMany:de,remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;se.current=[],ce.resetCategories(),null===(e=s.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[ue,de,ce.resetCategories,se]);const he=Rc({data:re,rawData:c,colorBy:le,colorScheme:oe,legendInteraction:D,legendPosition:E,selection:C,linkedHover:j,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:M,onClick:_,hoverHighlight:P,chartType:"LikertChart",chartId:L,showLegend:q,userMargin:u,marginDefaults:a.marginDefaults,loading:$,loadingContent:N,emptyContent:B,width:W,height:z}),ge=r(()=>{const e=v.length;return e%2!=0&&ie.get(v[Math.floor(e/2)])||"#888"},[v,ie]),fe=Fu({colorBy:void 0,colorScale:void 0,color:void 0,themeCategorical:void 0,colorScheme:void 0,categoryIndexMap:Zu,userPieceStyle:null==O?void 0:O.pieceStyle,stroke:R,strokeWidth:H,opacity:F,effectiveSelectionHook:he.effectiveSelectionHook,resolvedSelection:he.resolvedSelection,baseStyleExtras:e=>{var t,n;const o=e.__likertLevelLabel||(null===(t=e.data)||void 0===t?void 0:t.__likertLevelLabel),i=e.__likertLevel||(null===(n=e.data)||void 0===n?void 0:n.__likertLevel);if(i===Gu||i===qu)return{fill:ge};const r=o||i;return r&&ie.has(r)?{fill:ie.get(r)}:{fill:"#888"}}}),pe=r(()=>{const e=v.length;return e%2!=0?v[Math.floor(e/2)]:""},[v]),ye=r(()=>e=>{const t=e.data||e,n=t.__likertLevel||"Unknown",i=n===Gu||n===qu?pe:n,r=t.__likertCategory||"",a=Math.abs(t.__likertPct||0),s=n===Gu||n===qu?2*a:a,l=t.__likertCount||0;return o.createElement("div",{className:"semiotic-tooltip",style:zi},o.createElement("div",{style:{fontWeight:"bold"}},r),o.createElement("div",{style:{marginTop:4}},`${i}: ${s.toFixed(1)}% (n=${l})`))},[pe]),me=r(()=>{if(!v||2>v.length)return"LikertChart requires `levels` with at least 2 entries.";if(f&&y)return"LikertChart: provide either `valueAccessor` (raw responses) or `levelAccessor` + `countAccessor` (pre-aggregated), not both.";if(y&&!m)return"LikertChart: pre-aggregated mode requires both `levelAccessor` and `countAccessor`.";if(void 0!==c&&0===c.length)return null;const e={categoryAccessor:g};return te?f&&(e.valueAccessor=f):(y&&(e.levelAccessor=y),m&&(e.countAccessor=m)),Bc({componentName:"LikertChart",data:c,accessors:e,requiredProps:{levels:v}})},[c,g,f,y,m,v,te]),ve=r(()=>[{styleFn:e=>({fill:ie.get(e.label)||"#888"}),items:v.map(e=>({label:e})),label:""}],[v,ie]),be=r(()=>!1!==q?Object.assign(Object.assign({},he.legendBehaviorProps),{legend:{legendGroups:ve},legendPosition:E||he.legendPosition||"bottom"}):he.legendBehaviorProps,[he.legendBehaviorProps,he.legendPosition,E,q,ve]),xe=r(()=>{const e=Object.assign({},he.margin);if(ee&&!1!==q){const t=E||"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(ce.streamingMarginAdjust)for(const[t,n]of Object.entries(ce.streamingMarginAdjust))n>e[t]&&(e[t]=n);return J&&100>e.left&&(e.left=100),e},[he.margin,ce.streamingMarginAdjust,J,ee,q,E]),ke=r(()=>T||(J?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[J,T]);if(he.earlyReturn)return he.earlyReturn;const we=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!=c&&{data:re}),{oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:J?"horizontal":"vertical",pieceStyle:fe,size:[W,z],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:xe,barPadding:k,enableHover:Y}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:a.showAxes,oLabel:K,rLabel:Z||(J?void 0:"Percentage"),rFormat:ke}),I&&{oFormat:I}),{showGrid:G}),be),X&&{title:X}),V&&{description:V}),U&&{summary:U}),void 0!==Q&&{accessibleTable:Q}),h&&{className:h}),null!=t.animate&&{animate:t.animate}),void 0!==t.axisExtent&&{axisExtent:t.axisExtent}),void 0!==t.autoPlaceAnnotations&&{autoPlaceAnnotations:t.autoPlaceAnnotations}),{tooltipContent:!1===w?()=>null:!0===w?ye:Ui(w)||ye}),(j||M||_||P)&&{customHoverBehavior:he.customHoverBehavior}),(M||_||j)&&{customClickBehavior:he.customClickBehavior}),A&&A.length>0&&{annotations:A}),S&&{rExtent:S}),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return me?e(wc,{componentName:"LikertChart",message:me,width:W,height:z}):e(Cc,{componentName:"LikertChart",width:W,height:z,children:e(va,Object.assign({ref:s},we))})});function ed({brushProp:e,onBrushProp:t,linkedBrush:n,valueAccessor:o}){const r=Xl("string"==typeof n?n:n?{name:n.name,xField:n.rField}:void 0),a=Nl({name:(null==r?void 0:r.name)||"__unused_ordinal_brush__",xField:(null==r?void 0:r.xField)||("string"==typeof o?o:"value")}),s=i(a.brushInteraction);s.current=a.brushInteraction;const c=l(e=>{if(r){s.current.end(e?e.r:null)}null==t||t(e)},[t,r]),u=!!(e||n||t);return{hasBrush:u,handleBrush:c,brushStreamProps:u?{brush:{dimension:"r"},onBrush:c}:{}}}Ju.displayName="LikertChart";const td=g(function(t,n){const o=xc(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),a=i(null);Hc(n,{variant:"xy",frameRef:a});const{data:s,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="vertical",valueFormat:g,colorBy:f,colorScheme:p,sizeBy:y,sizeRange:m=[3,8],pointRadius:v=4,pointOpacity:b=.7,categoryPadding:x=20,tooltip:k,annotations:w,valueExtent:A,brush:S,onBrush:O,linkedBrush:C,frameProps:j={},selection:M,linkedHover:_,onObservation:P,onClick:L,hoverHighlight:T,chartId:$,loading:N,loadingContent:B,emptyContent:D,legendInteraction:E,legendPosition:I,color:R,stroke:H,strokeWidth:F,opacity:W,showCategoryTicks:z,categoryFormat:Y}=t,{width:G,height:q,enableHover:X,showGrid:V,showLegend:U,title:Q,description:K,summary:Z,accessibleTable:J,categoryLabel:ee,valueLabel:te}=o,ne=r(()=>me(s),[s]),oe=Rc({data:ne,rawData:s,colorBy:f,colorScheme:p,legendInteraction:E,legendPosition:I,selection:M,linkedHover:_,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:P,onClick:L,hoverHighlight:T,chartType:"SwarmPlot",chartId:$,showLegend:U,userMargin:l,marginDefaults:o.marginDefaults,loading:N,loadingContent:B,emptyContent:D,width:G,height:q}),ie=ed({brushProp:S,onBrushProp:O,linkedBrush:C,valueAccessor:d}),re=r(()=>{if(!y)return;const e=ne.map(e=>"function"==typeof y?y(e):e[y]);return[Math.min(...e),Math.max(...e)]},[ne,y]),ae=dc(),se=r(()=>new Map,[ne]),le=Fu({colorBy:f,colorScale:oe.colorScale,color:R,themeCategorical:ae,colorScheme:p,categoryIndexMap:se,userPieceStyle:null==j?void 0:j.pieceStyle,stroke:H,strokeWidth:F,opacity:W,effectiveSelectionHook:oe.effectiveSelectionHook,resolvedSelection:oe.resolvedSelection,baseStyleExtras:e=>({fillOpacity:b,r:y?bt(e,y,m,re):v})}),ce=r(()=>bl({categoryAccessor:u,valueAccessor:d,groupAccessor:f||void 0,valueFormat:g}),[u,d,f,g]);if(oe.earlyReturn)return oe.earlyReturn;const ue=Bc({componentName:"SwarmPlot",data:s,accessors:{categoryAccessor:u,valueAccessor:d}});if(ue)return e(wc,{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:ne}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:le,size:[G,q],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:oe.margin,barPadding:x,enableHover:X}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:o.showAxes,oLabel:ee,rLabel:te,rFormat:g}),Y&&{oFormat:Y}),{showGrid:V,showCategoryTicks:z}),oe.legendBehaviorProps),ul({title:Q,description:K,summary:Z,accessibleTable:J,className:c,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),hl({tooltip:k,defaultTooltipContent:ce})),dl({linkedHover:_,onObservation:P,onClick:L,hoverHighlight:T,customHoverBehavior:oe.customHoverBehavior,customClickBehavior:oe.customClickBehavior})),w&&w.length>0&&{annotations:w}),A&&{rExtent:A}),ie.brushStreamProps),Object.fromEntries(Object.entries(j).filter(([e])=>"pieceStyle"!==e)));return e(Cc,{componentName:"SwarmPlot",width:G,height:q,children:e(va,Object.assign({ref:a},de))})});function nd(n){return o=>{var i;const r=o.category||o.data&&(null===(i=o.data[0])||void 0===i?void 0:i.category)||"",a=o.stats||(o.data||o).stats;if(a&&null!=a.median)return t("div",{className:"semiotic-tooltip",style:zi,children:[r&&e("div",{style:{fontWeight:"bold"},children:r+""}),null!=a.n&&t("div",{children:["n = ",a.n]}),null!=a.min&&t("div",{children:["Min: ",a.min.toLocaleString()]}),null!=a.q1&&t("div",{children:["Q1: ",a.q1.toLocaleString()]}),t("div",{children:["Median: ",a.median.toLocaleString()]}),null!=a.q3&&t("div",{children:["Q3: ",a.q3.toLocaleString()]}),null!=a.max&&t("div",{children:["Max: ",a.max.toLocaleString()]}),null!=a.mean&&t("div",{style:{opacity:.8},children:["Mean: ",a.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});if(null==n?void 0:n.valueAccessor){const i=n.valueAccessor,a=(Array.isArray(o.data)?o.data:[]).map(e=>Number("function"==typeof i?i(e):e[i])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),s=a.length,l=s>0?s%2!=0?a[Math.floor(s/2)]:(a[s/2-1]+a[s/2])/2:null;return t("div",{className:"semiotic-tooltip",style:zi,children:[r&&e("div",{style:{fontWeight:"bold"},children:r+""}),s>0&&t("div",{children:["n = ",s]}),null!=l&&t("div",{children:["Median: ",l.toLocaleString()]})]})}return e("div",{className:"semiotic-tooltip",style:zi,children:e("div",{style:{fontWeight:"bold"},children:r+""})})}}td.displayName="SwarmPlot";const od=g(function(t,n){const o=xc(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),a=i(null);Hc(n,{variant:"xy",frameRef:a});const{data:s,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="vertical",valueFormat:g,colorBy:f,colorScheme:p,showOutliers:y=!0,categoryPadding:m=20,tooltip:v,annotations:b,valueExtent:x,frameProps:k={},selection:w,linkedHover:A,onObservation:S,onClick:O,hoverHighlight:C,chartId:j,loading:M,loadingContent:_,emptyContent:P,legendInteraction:L,legendPosition:T,color:$,stroke:N,strokeWidth:B,opacity:D,showCategoryTicks:E,categoryFormat:I}=t,{width:R,height:H,enableHover:F,showGrid:W,showLegend:z,title:Y,description:G,summary:q,accessibleTable:X,categoryLabel:V,valueLabel:U}=o,Q=r(()=>me(s),[s]),K=Rc({data:Q,rawData:s,colorBy:f,colorScheme:p,legendInteraction:L,legendPosition:T,selection:w,linkedHover:A,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:S,onClick:O,hoverHighlight:C,chartType:"BoxPlot",chartId:j,showLegend:z,userMargin:l,marginDefaults:o.marginDefaults,loading:M,loadingContent:_,emptyContent:P,width:R,height:H}),Z=dc(),J=r(()=>new Map,[Q]),ee=Fu({colorBy:f,colorScale:K.colorScale,color:$,themeCategorical:Z,colorScheme:p,categoryIndexMap:J,userPieceStyle:void 0,stroke:N,strokeWidth:B,opacity:D,effectiveSelectionHook:K.effectiveSelectionHook,resolvedSelection:K.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),te=r(()=>nd(),[]);if(K.earlyReturn)return K.earlyReturn;const ne=Bc({componentName:"BoxPlot",data:s,accessors:{categoryAccessor:u,valueAccessor:d}});if(ne)return e(wc,{componentName:"BoxPlot",message:ne,width:R,height:H});const oe=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:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:ee,showOutliers:y,size:[R,H],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:K.margin,barPadding:m,enableHover:F}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:o.showAxes,oLabel:V,rLabel:U,rFormat:g}),I&&{oFormat:I}),{showGrid:W,showCategoryTicks:E}),K.legendBehaviorProps),ul({title:Y,description:G,summary:q,accessibleTable:X,className:c,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),hl({tooltip:v,defaultTooltipContent:te})),dl({linkedHover:A,onObservation:S,onClick:O,hoverHighlight:C,customHoverBehavior:K.customHoverBehavior,customClickBehavior:K.customClickBehavior})),b&&b.length>0&&{annotations:b}),x&&{rExtent:x}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return e(Cc,{componentName:"BoxPlot",width:R,height:H,children:e(va,Object.assign({ref:a},oe))})});od.displayName="BoxPlot";const id=e=>{const t=null==e?void 0:e.category;return null==t?"All":t+""},rd=g(function(n,o){const a=xc(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:"horizontal"}),s=i(null);Hc(o,{variant:"xy",frameRef:s});const{data:l,margin:c,className:u,categoryAccessor:d=id,valueAccessor:h="value",bins:g=25,relative:f=!1,valueFormat:p,colorBy:y,colorScheme:m,categoryPadding:v=20,tooltip:b,annotations:x,valueExtent:k,brush:w,onBrush:A,linkedBrush:S,frameProps:O={},selection:C,linkedHover:j,onObservation:M,onClick:_,hoverHighlight:P,chartId:L,loading:T,loadingContent:$,emptyContent:N,legendInteraction:B,legendPosition:D,color:E,stroke:I,strokeWidth:R,opacity:H,showCategoryTicks:F,categoryFormat:W}=n,{width:z,height:Y,enableHover:G,showGrid:q,showLegend:X,title:V,description:U,summary:Q,accessibleTable:K,categoryLabel:Z,valueLabel:J}=a,ee=r(()=>me(l),[l]),te=Rc({data:ee,rawData:l,colorBy:y,colorScheme:m,legendInteraction:B,legendPosition:D,selection:C,linkedHover:j,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:M,onClick:_,hoverHighlight:P,chartType:"Histogram",chartId:L,showLegend:X,userMargin:c,marginDefaults:a.marginDefaults,loading:T,loadingContent:$,emptyContent:N,width:z,height:Y}),ne=ed({brushProp:w,onBrushProp:A,linkedBrush:S,valueAccessor:h}),oe=r(()=>{if(0===ee.length)return;const e="function"==typeof h?h:e=>e[h];let t=1/0,n=-1/0;for(const o of ee){const i=e(o);null!=i&&isFinite(i)&&(t>i&&(t=i),i>n&&(n=i))}return t>n?void 0:[t,n]},[ee,h]),ie=dc(),re=r(()=>new Map,[ee]),ae=Fu({colorBy:y,colorScale:te.colorScale,color:E,themeCategorical:ie,colorScheme:m,categoryIndexMap:re,userPieceStyle:void 0,stroke:I,strokeWidth:R,opacity:H,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),se=r(()=>n=>{const o=n.data||n,i=o.category||n.category||"",r=o.count,a=o.range;return t("div",{className:"semiotic-tooltip",style:zi,children:[i&&e("div",{style:{fontWeight:"bold"},children:i+""}),null!=r&&t("div",{children:["Count: ",r]}),a&&2===a.length&&t("div",{style:{opacity:.8},children:[Number(a[0]).toFixed(1)," – ",Number(a[1]).toFixed(1)]})]})},[]);if(te.earlyReturn)return te.earlyReturn;const le=Bc({componentName:"Histogram",data:l,accessors:{categoryAccessor:d,valueAccessor:h}});if(le)return e(wc,{componentName:"Histogram",message:le,width:z,height:Y});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:"histogram"},null!=l&&{data:ee}),{oAccessor:d,rAccessor:h,projection:"horizontal",summaryStyle:ae,bins:g,normalize:f}),k?{rExtent:k}:oe&&{rExtent:oe}),{size:[z,Y],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:te.margin,barPadding:v,enableHover:G}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:a.showAxes,oLabel:Z,rLabel:J,rFormat:p}),W&&{oFormat:W}),{showGrid:q,showCategoryTicks:F}),te.legendBehaviorProps),ul({title:V,description:U,summary:Q,accessibleTable:K,className:u,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),hl({tooltip:b,defaultTooltipContent:se})),dl({linkedHover:j,onObservation:M,onClick:_,hoverHighlight:P,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior})),x&&x.length>0&&{annotations:x}),ne.brushStreamProps),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return e(Cc,{componentName:"Histogram",width:z,height:Y,children:e(va,Object.assign({ref:s},ce))})});rd.displayName="Histogram";const ad=g(function(t,n){const o=xc(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),a=i(null);Hc(n,{variant:"xy",frameRef:a});const{data:s,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="vertical",bins:g=25,showIQR:f=!0,valueFormat:p,colorBy:y,colorScheme:m,categoryPadding:v=20,tooltip:b,annotations:x,valueExtent:k,brush:w,onBrush:A,linkedBrush:S,frameProps:O={},selection:C,linkedHover:j,onObservation:M,onClick:_,hoverHighlight:P,chartId:L,loading:T,loadingContent:$,emptyContent:N,legendInteraction:B,legendPosition:D,color:E,stroke:I,strokeWidth:R,opacity:H,showCategoryTicks:F,categoryFormat:W}=t,{width:z,height:Y,enableHover:G,showGrid:q,showLegend:X,title:V,description:U,summary:Q,accessibleTable:K,categoryLabel:Z,valueLabel:J}=o,ee=r(()=>me(s),[s]),te=Rc({data:ee,rawData:s,colorBy:y,colorScheme:m,legendInteraction:B,legendPosition:D,selection:C,linkedHover:j,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:M,onClick:_,hoverHighlight:P,chartType:"ViolinPlot",chartId:L,showLegend:X,userMargin:l,marginDefaults:o.marginDefaults,loading:T,loadingContent:$,emptyContent:N,width:z,height:Y}),ne=ed({brushProp:w,onBrushProp:A,linkedBrush:S,valueAccessor:d}),oe=dc(),ie=r(()=>new Map,[ee]),re=Fu({colorBy:y,colorScale:te.colorScale,color:E,themeCategorical:oe,colorScheme:m,categoryIndexMap:ie,userPieceStyle:void 0,stroke:I,strokeWidth:R,opacity:H,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection,baseStyleExtras:{fillOpacity:.6},linkStrokeToFill:!0}),ae=r(()=>nd({valueAccessor:d}),[d]);if(te.earlyReturn)return te.earlyReturn;const se=Bc({componentName:"ViolinPlot",data:s,accessors:{categoryAccessor:u,valueAccessor:d}});if(se)return e(wc,{componentName:"ViolinPlot",message:se,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:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:re,bins:g,showIQR:f,size:[z,Y],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:te.margin,barPadding:v,enableHover:G}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:o.showAxes,oLabel:Z,rLabel:J,rFormat:p}),W&&{oFormat:W}),{showGrid:q,showCategoryTicks:F}),te.legendBehaviorProps),ul({title:V,description:U,summary:Q,accessibleTable:K,className:c,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),hl({tooltip:b,defaultTooltipContent:ae})),dl({linkedHover:j,onObservation:M,onClick:_,hoverHighlight:P,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior})),x&&x.length>0&&{annotations:x}),k&&{rExtent:k}),ne.brushStreamProps),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return e(Cc,{componentName:"ViolinPlot",width:z,height:Y,children:e(va,Object.assign({ref:a},le))})});ad.displayName="ViolinPlot";const sd=g(function(t,n){const o=xc(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),a=i(null);Hc(n,{variant:"xy",frameRef:a});const{data:s,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="horizontal",bins:g=20,amplitude:f=1.5,valueFormat:p,colorBy:y,colorScheme:m,categoryPadding:v=5,tooltip:b,annotations:x,valueExtent:k,frameProps:w={},selection:A,linkedHover:S,onObservation:O,onClick:C,hoverHighlight:j,chartId:M,loading:_,loadingContent:P,emptyContent:L,legendInteraction:T,legendPosition:$,color:N,stroke:B,strokeWidth:D,opacity:E,showCategoryTicks:I,categoryFormat:R}=t,{width:H,height:F,enableHover:W,showGrid:z,showLegend:Y,title:G,description:q,summary:X,accessibleTable:V,categoryLabel:U,valueLabel:Q}=o,K=r(()=>me(s),[s]),Z=Rc({data:K,rawData:s,colorBy:y,colorScheme:m,legendInteraction:T,legendPosition:$,selection:A,linkedHover:S,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:O,onClick:C,hoverHighlight:j,chartType:"RidgelinePlot",chartId:M,showLegend:Y,userMargin:l,marginDefaults:o.marginDefaults,loading:_,loadingContent:P,emptyContent:L,width:H,height:F}),J=dc(),ee=r(()=>new Map,[K]),te=Fu({colorBy:y,colorScale:Z.colorScale,color:N,themeCategorical:J,colorScheme:m,categoryIndexMap:ee,userPieceStyle:void 0,stroke:B,strokeWidth:D,opacity:E,effectiveSelectionHook:Z.effectiveSelectionHook,resolvedSelection:Z.resolvedSelection,baseStyleExtras:{fillOpacity:.5},linkStrokeToFill:!0}),ne=r(()=>nd(),[]);if(Z.earlyReturn)return Z.earlyReturn;const oe=Bc({componentName:"RidgelinePlot",data:s,accessors:{categoryAccessor:u,valueAccessor:d}});if(oe)return e(wc,{componentName:"RidgelinePlot",message:oe,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:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:te,bins:g,size:[H,F],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Z.margin,barPadding:v,enableHover:W}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:o.showAxes,oLabel:U,rLabel:Q,rFormat:p}),R&&{oFormat:R}),{showGrid:z,showCategoryTicks:I,oSort:!1,amplitude:f}),Z.legendBehaviorProps),ul({title:G,description:q,summary:X,accessibleTable:V,className:c,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),hl({tooltip:b,defaultTooltipContent:ne})),dl({linkedHover:S,onObservation:O,onClick:C,hoverHighlight:j,customHoverBehavior:Z.customHoverBehavior,customClickBehavior:Z.customClickBehavior})),x&&x.length>0&&{annotations:x}),k&&{rExtent:k}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return e(Cc,{componentName:"RidgelinePlot",width:H,height:F,children:e(va,Object.assign({ref:a},ie))})});sd.displayName="RidgelinePlot";const ld=g(function(n,o){const a=xc(n.mode,{width:n.width,height:n.height,showGrid:!1,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,showCategoryTicks:!1}),s=i(null);Hc(o,{variant:"xy",frameRef:s});const{data:l,margin:c,className:u,stepAccessor:d="step",valueAccessor:h="value",categoryAccessor:g,colorBy:f,colorScheme:p,orientation:y="horizontal",connectorOpacity:m=.3,showLabels:v=!0,tooltip:b,annotations:x,frameProps:k={},selection:w,linkedHover:A,onObservation:S,onClick:O,hoverHighlight:C,chartId:j,loading:M,loadingContent:_,emptyContent:P,legendInteraction:L,legendPosition:T,color:$,stroke:N,strokeWidth:B,opacity:D,categoryFormat:E}=n,I="vertical"===y,{width:R,height:H,enableHover:F,showLegend:W,title:z,description:Y,summary:G,accessibleTable:q}=a,X=I?{top:z?60:40,right:20,bottom:60,left:60}:{top:z?40:10,right:10,bottom:10,left:10},V=r(()=>me(l),[l]),U=f||g,Q=!U,K=Rc({data:V,rawData:l,colorBy:U,colorScheme:p,legendInteraction:L,legendPosition:T,selection:w,linkedHover:A,fallbackFields:U?["string"==typeof U?U:""]:[],unwrapData:!0,onObservation:S,onClick:O,hoverHighlight:C,chartType:"FunnelChart",chartId:j,showLegend:W,userMargin:c,marginDefaults:X,loading:M,loadingContent:_,emptyContent:P,width:R,height:H});Lc("FunnelChart",V,"stepAccessor",d),Lc("FunnelChart",V,"valueAccessor",h);const Z=dc(),J=r(()=>new Map,[V]),ee=r(()=>{if(Q)return $||((null==Z?void 0:Z[0])?Z[0]:Array.isArray(p)&&p[0]?p[0]:"#4e79a7")},[Q,$,Z,p]),te=Fu({colorBy:ee?void 0:U,colorScale:K.colorScale,color:null!=ee?ee:$,themeCategorical:Z,colorScheme:p,categoryIndexMap:J,userPieceStyle:null==k?void 0:k.pieceStyle,stroke:N,strokeWidth:B,opacity:D,effectiveSelectionHook:K.effectiveSelectionHook,resolvedSelection:K.resolvedSelection}),ne=r(()=>n=>{var o,i,r,a,s,l;const c=(null==n?void 0:n.data)||n,u=(null==c?void 0:c.__funnelStep)||(null==c?void 0:c.__barFunnelStep)||(null==c?void 0:c.step)||"",d=null!==(r=null!==(i=null!==(o=null==c?void 0:c.__funnelValue)&&void 0!==o?o:null==c?void 0:c.__barFunnelValue)&&void 0!==i?i:null==c?void 0:c.value)&&void 0!==r?r:"",h=null!==(a=null==c?void 0:c.__funnelPercent)&&void 0!==a?a:null==c?void 0:c.__barFunnelPercent,g=null!==(s=null==c?void 0:c.__funnelIsFirstStep)&&void 0!==s?s:null==c?void 0:c.__barFunnelIsFirstStep,f=null==c?void 0:c.__barFunnelIsDropoff,p=null!==(l=null==c?void 0:c.__barFunnelCategory)&&void 0!==l?l:null==c?void 0:c.category,y=null==h||g?"":` (${.05>Math.abs(h-Math.round(h))?Math.round(h)+"%":h.toFixed(1)+"%"})`;return t("div",{className:"semiotic-tooltip",style:zi,children:[u&&e("div",{style:{fontWeight:"bold"},children:u+""}),p&&p!==u&&e("div",{style:{marginTop:2,opacity:.8},children:p+""}),f&&e("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7},children:"Dropoff"}),t("div",{style:{marginTop:4},children:[d+"",y]})]})},[]);if(K.earlyReturn)return K.earlyReturn;const oe=Bc({componentName:"FunnelChart",data:l,accessors:{stepAccessor:d,valueAccessor:h}});if(oe)return e(wc,{componentName:"FunnelChart",message:oe,width:R,height:H});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(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:I?"bar-funnel":"funnel"},null!=l&&{data:V}),{oAccessor:d,rAccessor:h}),g&&{stackBy:g}),{projection:I?"vertical":"horizontal",barPadding:I?40:0,pieceStyle:te,size:[R,H],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:K.margin,enableHover:F}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:I,showCategoryTicks:I}),E&&{oFormat:E}),{showGrid:I}),!I&&{connectorOpacity:m}),{showLabels:v}),K.legendBehaviorProps),z&&{title:z}),Y&&{description:Y}),G&&{summary:G}),void 0!==q&&{accessibleTable:q}),u&&{className:u}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===b?()=>null:!0===b||null==b?ne:Ui(b)||ne}),(A||S||O||C)&&{customHoverBehavior:K.customHoverBehavior}),(S||O||A)&&{customClickBehavior:K.customClickBehavior}),x&&x.length>0&&{annotations:x}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return e(Cc,{componentName:"FunnelChart",width:R,height:H,children:e(va,Object.assign({ref:s},ie))})});ld.displayName="FunnelChart";const cd=g(function(t,n){var o;const a=xc(t.mode,{width:t.width,height:t.height,showGrid:null===(o=t.showGrid)||void 0===o||o,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),s=i(null);Hc(n,{variant:"xy",frameRef:s});const{data:l,margin:c,className:u,categoryAccessor:d="category",valueAccessor:h="value",orientation:g="horizontal",valueFormat:f,colorBy:p,colorScheme:y,sort:m="auto",dotRadius:v=5,categoryPadding:b=10,tooltip:x,annotations:k,regression:w,valueExtent:A,frameProps:S={},selection:O,linkedHover:C,onObservation:j,onClick:M,hoverHighlight:_,chartId:P,loading:L,loadingContent:T,emptyContent:$,legendInteraction:N,legendPosition:B,color:D,stroke:E,strokeWidth:I,opacity:R,categoryFormat:H}=t,{width:F,height:W,enableHover:z,showGrid:Y,showLegend:G,title:q,description:X,summary:V,accessibleTable:U,categoryLabel:Q,valueLabel:K}=a,Z=r(()=>me(l),[l]),J=Rc({data:Z,rawData:l,colorBy:p,colorScheme:y,legendInteraction:N,legendPosition:B,selection:O,linkedHover:C,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:j,onClick:M,hoverHighlight:_,chartType:"DotPlot",chartId:P,showLegend:G,userMargin:c,marginDefaults:a.marginDefaults,loading:L,loadingContent:T,emptyContent:$,width:F,height:W}),ee=fc(Z,m,h),te=dc(),ne=r(()=>new Map,[Z]),oe=Fu({colorBy:p,colorScale:J.colorScale,color:D,themeCategorical:te,colorScheme:y,categoryIndexMap:ne,userPieceStyle:null==S?void 0:S.pieceStyle,stroke:E,strokeWidth:I,opacity:R,effectiveSelectionHook:J.effectiveSelectionHook,resolvedSelection:J.resolvedSelection,baseStyleExtras:{r:v,fillOpacity:.8}}),ie=r(()=>bl({categoryAccessor:d,valueAccessor:h,valueFormat:f}),[d,h,f]);if(J.earlyReturn)return J.earlyReturn;const re=Bc({componentName:"DotPlot",data:l,accessors:{categoryAccessor:d,valueAccessor:h}});if(re)return e(wc,{componentName:"DotPlot",message:re,width:F,height:W});const ae=Yc(w),se=ae?[ae,...k||[]]:k,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!=l&&{data:ee}),{oAccessor:d,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:oe,size:[F,W],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:J.margin,barPadding:b,enableHover:z}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:a.showAxes,oLabel:Q,rLabel:K,rFormat:f}),H&&{oFormat:H}),{showGrid:Y,oSort:m}),J.legendBehaviorProps),ul({title:q,description:X,summary:V,accessibleTable:U,className:u,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),hl({tooltip:x,defaultTooltipContent:ie})),dl({linkedHover:C,onObservation:j,onClick:M,hoverHighlight:_,customHoverBehavior:J.customHoverBehavior,customClickBehavior:J.customClickBehavior})),se&&se.length>0&&{annotations:se}),A&&{rExtent:A}),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return e(Cc,{componentName:"DotPlot",width:F,height:W,children:e(va,Object.assign({ref:s},le))})});cd.displayName="DotPlot";const ud=g(function(t,n){var o,a;const s=xc(t.mode,{width:null!==(o=t.width)&&void 0!==o?o:400,height:null!==(a=t.height)&&void 0!==a?a:400,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,showCategoryTicks:t.showCategoryTicks}),l=i(null),{data:c,margin:u,className:d,categoryAccessor:h="category",valueAccessor:g="value",colorBy:f,colorScheme:p,startAngle:y=0,cornerRadius:m,tooltip:v,annotations:b,frameProps:x={},selection:k,linkedHover:w,onObservation:A,onClick:S,hoverHighlight:O,chartId:C,loading:j,loadingContent:M,emptyContent:_,legendInteraction:P,legendPosition:L,color:T,stroke:$,strokeWidth:N,opacity:B}=t,{width:D,height:E,enableHover:I,showLegend:R,title:H,description:F,summary:W,accessibleTable:z}=s,Y=r(()=>me(c),[c]),G=f||h,q=Rc({data:Y,rawData:c,colorBy:G,colorScheme:p,legendInteraction:P,legendPosition:L,selection:k,linkedHover:w,fallbackFields:G?["string"==typeof G?G:""]:[],unwrapData:!0,onObservation:A,onClick:S,hoverHighlight:O,chartType:"PieChart",chartId:C,showLegend:R,userMargin:u,marginDefaults:s.marginDefaults,loading:j,loadingContent:M,emptyContent:_,width:D,height:E}),X=dc(),V=r(()=>new Map,[Y]),U=Fu({colorBy:G,colorScale:q.colorScale,color:T,themeCategorical:X,colorScheme:p,categoryIndexMap:V,userPieceStyle:null==x?void 0:x.pieceStyle,stroke:$,strokeWidth:N,opacity:B,effectiveSelectionHook:q.effectiveSelectionHook,resolvedSelection:q.resolvedSelection,cycleByCategory:!0}),Q=r(()=>bl({categoryAccessor:h,valueAccessor:g,groupAccessor:f&&f!==h?f:void 0,groupLabel:"string"==typeof f?f:"group",pieData:!0}),[h,g,f]),K=Bc({componentName:"PieChart",data:c,accessors:{categoryAccessor:h,valueAccessor:g}}),{effectiveLegendProps:Z,effectiveMargin:J}=Hu({ref:n,frameRef:l,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!=c&&{data:Y}),{oAccessor:h,rAccessor:g,projection:"radial",pieceStyle:U,startAngle:y}),null!=m&&{cornerRadius:m}),{size:[D,E],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:J,enableHover:I}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:!1}),Z),ul({title:H,description:F,summary:W,accessibleTable:z,className:d,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),hl({tooltip:v,defaultTooltipContent:Q})),dl({linkedHover:w,onObservation:A,onClick:S,hoverHighlight:O,customHoverBehavior:q.customHoverBehavior,customClickBehavior:q.customClickBehavior})),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return K?e(wc,{componentName:"PieChart",message:K,width:D,height:E}):e(Cc,{componentName:"PieChart",width:D,height:E,children:e(va,Object.assign({ref:l},ee))})});ud.displayName="PieChart";const dd=g(function(t,n){const o=xc(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,linkedHover:t.linkedHover,showCategoryTicks:t.showCategoryTicks},{width:400,height:400}),a=i(null),{data:s,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",innerRadius:h,centerContent:g,colorBy:f,colorScheme:p,startAngle:y=0,cornerRadius:m,tooltip:v,annotations:b,frameProps:x={},selection:k,linkedHover:w,onObservation:A,onClick:S,hoverHighlight:O,chartId:C,loading:j,loadingContent:M,emptyContent:_,legendInteraction:P,legendPosition:L,color:T,stroke:$,strokeWidth:N,opacity:B}=t,{width:D,height:E,enableHover:I,showLegend:R,title:H,description:F,summary:W,accessibleTable:z}=o,Y=r(()=>me(s),[s]),G=f||u,q=Rc({data:Y,rawData:s,colorBy:G,colorScheme:p,legendInteraction:P,legendPosition:L,selection:k,linkedHover:w,fallbackFields:G?["string"==typeof G?G:""]:[],unwrapData:!0,onObservation:A,onClick:S,hoverHighlight:O,chartType:"DonutChart",chartId:C,showLegend:R,userMargin:l,marginDefaults:o.marginDefaults,loading:j,loadingContent:M,emptyContent:_,width:D,height:E}),X=null!=h?h:Math.max(2,.15*Math.min(D,E)),V=dc(),U=r(()=>new Map,[Y]),Q=Fu({colorBy:G,colorScale:q.colorScale,color:T,themeCategorical:V,colorScheme:p,categoryIndexMap:U,userPieceStyle:null==x?void 0:x.pieceStyle,stroke:$,strokeWidth:N,opacity:B,effectiveSelectionHook:q.effectiveSelectionHook,resolvedSelection:q.resolvedSelection,cycleByCategory:!0}),K=r(()=>bl({categoryAccessor:u,valueAccessor:d,groupAccessor:f&&f!==u?f:void 0,groupLabel:"string"==typeof f?f:"group",pieData:!0}),[u,d,f]),Z=Bc({componentName:"DonutChart",data:s,accessors:{categoryAccessor:u,valueAccessor:d}}),{effectiveLegendProps:J,effectiveMargin:ee}=Hu({ref:n,frameRef:a,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:u,rAccessor:d,projection:"radial",pieceStyle:Q,innerRadius:X,startAngle:y}),null!=m&&{cornerRadius:m}),{centerContent:g,size:[D,E],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ee,enableHover:I}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:!1}),J),ul({title:H,description:F,summary:W,accessibleTable:z,className:c,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),hl({tooltip:v,defaultTooltipContent:K})),dl({linkedHover:w,onObservation:A,onClick:S,hoverHighlight:O,customHoverBehavior:q.customHoverBehavior,customClickBehavior:q.customClickBehavior})),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return Z?e(wc,{componentName:"DonutChart",message:Z,width:D,height:E}):e(Cc,{componentName:"DonutChart",width:D,height:E,children:e(va,Object.assign({ref:a},te))})});function hd(e=240){const t=360-e,n=180+t/2,o=n*Math.PI/180;return{sweepRad:e*Math.PI/180,gapDeg:t,startAngleDeg:n,startAngleRad:o,offsetRad:-Math.PI/2+o}}function gd(e){return Math.max(0,Math.min(1,e))}function fd(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 n=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);if(n){const e=[Number(n[1]),Number(n[2]),Number(n[3])];if(e.every(Number.isFinite))return e}return null}function pd(e,t,n){const o=e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function yd(e,t){const n=e.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:gd(e.offset),color:e.color})).sort((e,t)=>e.offset-t.offset);if(0===n.length)return"#999999";if(1===n.length)return n[0].color;const o=gd(t);if(n[0].offset>=o)return n[0].color;if(o>=n[n.length-1].offset)return n[n.length-1].color;for(let e=0;n.length-1>e;e++){const t=n[e],i=n[e+1];if(t.offset>o||o>i.offset)continue;const r=i.offset-t.offset,a=r>0?(o-t.offset)/r:0,s=fd(t.color),l=fd(i.color);if(!s||!l)return.5>a?t.color:i.color;const[c,u,d]=s,[h,g,f]=l;return pd(c+(h-c)*a,u+(g-u)*a,d+(f-d)*a)}return n[n.length-1].color}function md(e,t,n){return`${e}-${t}`}dd.displayName="DonutChart";const vd=g(function(n,o){const a=xc(n.mode,{width:n.width,height:n.height,enableHover:n.enableHover,showLegend:!1,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary},{width:300,height:250}),s=i(null),l="context"===n.mode,{compactMode:c}=a,{value:u,min:d=0,max:h=100,thresholds:g,gradientFill:f,color:p,backgroundColor:y="var(--semiotic-grid, #e0e0e0)",arcWidth:m=.3,cornerRadius:v,showNeedle:b=!0,needleColor:x="var(--semiotic-text, #333)",centerContent:k,valueFormat:w,showScaleLabels:A=!c,sweep:S=240,fillZones:O=!0,tooltip:C,annotations:j,frameProps:M={},className:_,stroke:P,strokeWidth:L,opacity:T}=n,{width:$,height:N,title:B,description:D,summary:E,accessibleTable:I}=a,R=f&&"object"==typeof f?f:void 0,H=Math.max(d,Math.min(h,u)),F=h-d||1,W=(H-d)/F,{gaugeData:z,pieceStyle:Y,gaugeAnnotations:G}=r(()=>function(e){const{min:t,max:n,value:o,thresholds:i,fillColor:r,backgroundColor:a,fillZones:s,showScaleLabels:l,gradientFill:c,gradientSteps:u=240}=e,d=n-t||1,h=(Math.max(t,Math.min(n,o))-t)/d;let g=i&&i.length>0?[...i].sort((e,t)=>e.value-t.value):[{value:n,color:r||"#007bff"}];g=g.map(e=>Object.assign(Object.assign({},e),{value:Math.max(t,Math.min(n,e.value))})),n>g[g.length-1].value&&g.push({value:n,color:g[g.length-1].color});const f=!!c&&c.colorStops.length>=2,p=[],y=new Map,m=[];if(f){const e=s?h:1,t=md("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:a,opacity:.4}),e>0){const t=Math.max(1,Math.floor(u)),n=Math.max(1,Math.min(t,Math.round(e*t))),o=[];for(let t=0;n>t;t++)o.push(yd(c.colorStops,e*(t+.5)/n));const i=md("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:o}}),y.set(i,{fill:o[0]||a})}}else{let e=t;for(let n=0;g.length>n;n++){const o=g[n],i=(o.value-e)/d,r=(e-t)/d,l=(o.value-t)/d,c=Math.max(0,(s?Math.min(h,l):l)-r),u=s?Math.max(0,i-c):0;if(c>0){const e=md("fill",n);p.push({category:e,value:c,_zone:o.label||"Zone "+(n+1),_isFill:!0}),y.set(e,{fill:o.color})}if(u>0){const e=md("bg",n);p.push({category:e,value:u,_zone:o.label||"Zone "+(n+1),_isFill:!1}),y.set(e,{fill:a,opacity:.4})}e=o.value}}if(l&&i&&i.length>0)for(const e of i)e.value>t&&n>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:a},gaugeAnnotations:m}}({min:d,max:h,value:u,thresholds:g,fillColor:p,backgroundColor:y,fillZones:O,showScaleLabels:A,gradientFill:R}),[u,d,h,g,p,y,A,O,R]),q=r(()=>Fc(Y,{stroke:P,strokeWidth:L,opacity:T}),[Y,P,L,T]),{sweepRad:X,startAngleDeg:V}=hd(S),U=function(e=240){const{sweepRad:t,offsetRad:n}=hd(e),o=[[Math.cos(n),Math.sin(n)],[Math.cos(n+t),Math.sin(n+t)],[0,0]];for(let e=0;2*Math.PI>e;e+=Math.PI/2)((e-n)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)>t+.001||o.push([Math.cos(e),Math.sin(e)]);const i=o.map(e=>e[0]),r=o.map(e=>e[1]),a=Math.min(...i),s=Math.max(...i),l=Math.min(...r),c=Math.max(...r);return{minX:a,maxX:s,minY:l,maxY:c,width:s-a,height:c-l,cx:(a+s)/2,cy:(l+c)/2}}(S),Q=Math.min(10,Math.max(1,Math.min($,N)/12)),K=U.cx,Z=U.cy,J=Math.max(4,Math.min(($-2*Q)/U.width,(N-2*Q)/U.height)-2),ee=Math.max(0,Math.min(J-1.5,J*(1-m))),te=$/2-K*J,ne=N/2-Z*J,oe=2*(J+4),ie=r(()=>{if(c&&null==k)return null;if(null!=k)return"function"==typeof k?k(H,d,h):k;const n=w?w(H):Math.round(H)+"";return t("div",{style:{textAlign:"center",lineHeight:1.2},children:[e("div",{style:{fontSize:Math.max(16,.3*J),fontWeight:700,color:"var(--semiotic-text, #333)"},children:n}),A&&t("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"},children:[d," – ",h]})]})},[k,H,d,h,w,A,J,c]),re=r(()=>l&&null==k?{type:"gauge-value",text:w?w(H):Math.round(H)+""}:null,[l,k,H,w]),ae=r(()=>{if(!b)return null;const e=-Math.PI/2+V*Math.PI/180+W*X,t=ee>20?ee-8:J-1;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:x}},[b,W,V,X,ee,x]),se=r(()=>(n,o,i)=>{if("gauge-needle"===n.type){const r=(i.width||$)/2,a=(i.height||N)/2,s=Math.max(1,J-ee),l=Math.max(1,Math.min(2.5,.4*s)),c=Math.max(1,Math.min(5,.6*s));return t("g",{transform:`translate(${r},${a})`,children:[e("line",{x1:0,y1:0,x2:n.tipX,y2:n.tipY,stroke:n.color,strokeWidth:l,strokeLinecap:"round"}),e("circle",{cx:0,cy:0,r:c,fill:n.color})]},"gauge-needle-"+o)}if("gauge-label"===n.type){const r=-Math.PI/2+V*Math.PI/180+(n.value-d)/F*X,a=(i.width||$)/2,s=(i.height||N)/2,l=ee-1,c=J+1,u=Math.cos(r)*l,h=Math.sin(r)*l,g=Math.cos(r)*c,f=Math.sin(r)*c,p=J+10,y=Math.cos(r)*p,m=Math.sin(r)*p,v=((r+Math.PI/2)/(2*Math.PI)*12+12)%12;let b="middle",x="middle";return v>=11||1>v?(b="middle",x="auto"):v>=1&&5>v?(b="start",x="middle"):v>=5&&7>v?(b="middle",x="hanging"):(b="end",x="middle"),t("g",{transform:`translate(${a},${s})`,children:[e("line",{x1:u,y1:h,x2:g,y2:f,stroke:"var(--semiotic-border)",strokeWidth:2,strokeLinecap:"round"}),e("text",{x:y,y:m,textAnchor:b,dominantBaseline:x,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none",fontSize:"var(--semiotic-gauge-label-font-size, 10px)"},children:n.label})]},"gauge-label-"+o)}return"gauge-value"===n.type?e("text",{x:(i.width||$)/2,y:(i.height||N)/2-.2*ee,textAnchor:"middle",dominantBaseline:"middle",fontSize:Math.max(12,Math.min(22,.28*J)),fontWeight:700,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:n.text},"gauge-value-"+o):null},[$,N,d,F,V,X,ee,J]),le=r(()=>{const e=[...G,...j||[]];return ae&&e.push(ae),re&&e.push(re),e},[G,j,ae,re]),ce=r(()=>n=>{var o;const i=(null===(o=null==n?void 0:n.data)||void 0===o?void 0:o[0])||(null==n?void 0:n.data)||n,r=null==i?void 0:i._isFill;return t("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("div",{style:{fontWeight:600},children:(null==i?void 0:i._zone)||""}),e("div",{style:{fontSize:"0.85em",color:"var(--semiotic-text-secondary, #666)"},children:r?"Current: "+Math.round(H):"Remaining"})]})},[H]);if(0===z.length)return e(wc,{componentName:"GaugeChart",message:"No data to display",width:$,height:N});const ue=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut",data:z,oAccessor:"category",rAccessor:"value",oSort:!1,projection:"radial",pieceStyle:q,innerRadius:ee,startAngle:V,sweepAngle:S},null!=v&&{cornerRadius:v}),{centerContent:ie,size:[$,N],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:{top:ne-oe/2,bottom:N-ne-oe/2,left:te-oe/2,right:$-te-oe/2},enableHover:a.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===C?()=>null:Ui(C)||ce,svgAnnotationRules:se}),le.length>0&&{annotations:le}),B&&{title:B}),D&&{description:D}),E&&{summary:E}),void 0!==I&&{accessibleTable:I}),_&&{className:_}),null!=n.animate&&{animate:n.animate}),M);return e(Cc,{componentName:"GaugeChart",width:$,height:N,children:e(va,Object.assign({ref:s},ue))})});vd.displayName="GaugeChart";const bd=g(function(t,n){const o=xc(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),a=i(null),{data:s,margin:l,className:c,categoryAccessor:u="category",groupBy:d,valueAccessor:h="value",orientation:g="vertical",valueFormat:f,colorBy:p,colorScheme:y,sort:m=!1,barPadding:v=60,roundedTop:b,baselinePadding:x=!1,tooltip:k,annotations:w,valueExtent:A,frameProps:S={},selection:O,linkedHover:C,onObservation:j,onClick:M,hoverHighlight:_,chartId:P,loading:L,loadingContent:T,emptyContent:$,legendInteraction:N,legendPosition:B,color:D,stroke:E,strokeWidth:I,opacity:R,categoryFormat:H}=t,{width:F,height:W,enableHover:z,showGrid:Y,showLegend:G,title:q,description:X,summary:V,accessibleTable:U,categoryLabel:Q,valueLabel:K}=o,Z=r(()=>me(s),[s]),J=p||d,ee=Rc({data:Z,rawData:s,colorBy:J,colorScheme:y,legendInteraction:N,legendPosition:B,selection:O,linkedHover:C,fallbackFields:J?["string"==typeof J?J:""]:[],unwrapData:!0,onObservation:j,onClick:M,hoverHighlight:_,chartType:"GroupedBarChart",chartId:P,showLegend:G,userMargin:l,marginDefaults:o.marginDefaults,loading:L,loadingContent:T,emptyContent:$,width:F,height:W}),te=dc(),ne=r(()=>new Map,[Z]),oe=Fu({colorBy:J,colorScale:ee.colorScale,color:D,themeCategorical:te,colorScheme:y,categoryIndexMap:ne,userPieceStyle:S.pieceStyle,stroke:E,strokeWidth:I,opacity:R,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection}),ie=r(()=>bl({categoryAccessor:d,valueAccessor:h,groupAccessor:u,valueFormat:f}),[d,u,h,f]),re=Bc({componentName:"GroupedBarChart",data:s,accessors:{categoryAccessor:u,valueAccessor:h},requiredProps:{groupBy:d}}),{effectiveLegendProps:ae,effectiveMargin:se}=Hu({ref:n,frameRef:a,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:u,rAccessor:h,groupBy:d,oSort:m,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:oe,size:[F,W],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:se,barPadding:v}),null!=b&&{roundedTop:b}),{baselinePadding:x,enableHover:z}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:o.showAxes,oLabel:Q,rLabel:K,rFormat:f}),H&&{oFormat:H}),{showGrid:Y}),ae),ul({title:q,description:X,summary:V,accessibleTable:U,className:c,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),hl({tooltip:k,defaultTooltipContent:ie})),dl({linkedHover:C,onObservation:j,onClick:M,hoverHighlight:_,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior})),w&&w.length>0&&{annotations:w}),A&&{rExtent:A}),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return re?e(wc,{componentName:"GroupedBarChart",message:re,width:F,height:W}):e(Cc,{componentName:"GroupedBarChart",width:F,height:W,children:e(va,Object.assign({ref:a},le))})});bd.displayName="GroupedBarChart";const xd=g(function(t,n){const o=xc(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),a=i(null),{data:s,margin:l,className:c,categoryAccessor:u="category",subcategoryAccessor:d,valueAccessor:h="value",orientation:g="horizontal",valueFormat:f,colorBy:p,colorScheme:y,barPadding:m,tooltip:v,annotations:b,brush:x,onBrush:k,linkedBrush:w,frameProps:A={},selection:S,linkedHover:O,onObservation:C,onClick:j,hoverHighlight:M,chartId:_,loading:P,loadingContent:L,emptyContent:T,legendInteraction:$,legendPosition:N,color:B,stroke:D,strokeWidth:E,opacity:I,categoryFormat:R,rTickValues:H,tickLabelEdgeAlign:F,showCategoryTicks:W,gradientFill:z,trackFill:Y,roundedTop:G,valueExtent:q}=t,{width:X,height:V,enableHover:U,showGrid:Q,showLegend:K,title:Z,description:J,summary:ee,accessibleTable:te,categoryLabel:ne,valueLabel:oe}=o,ie=r(()=>me(s),[s]),re=p||d,ae=r(()=>{if(null!=m)return m;if("sparkline"!==t.mode)return 40;const e=new Set(ie.map(e=>"function"==typeof u?u(e):e[u])),n=Math.max(1,e.size);return n>1?Math.max(0,Math.min(1,(("horizontal"===g?V:X)-2*n)/(n-1))):1},[m,t.mode,ie,u,g,X,V]),se=Rc({data:ie,rawData:s,colorBy:re,colorScheme:y,legendInteraction:$,legendPosition:N,selection:S,linkedHover:O,fallbackFields:re?["string"==typeof re?re:""]:[],unwrapData:!0,onObservation:C,onClick:j,hoverHighlight:M,chartType:"SwimlaneChart",chartId:_,showLegend:K,userMargin:l,marginDefaults:o.marginDefaults,loading:P,loadingContent:L,emptyContent:T,width:X,height:V}),le=ed({brushProp:x,onBrushProp:k,linkedBrush:w,valueAccessor:h}),ce=dc(),ue=r(()=>new Map,[ie]),de=Fu({colorBy:re,colorScale:se.colorScale,color:B,themeCategorical:ce,colorScheme:y,categoryIndexMap:ue,userPieceStyle:null==A?void 0:A.pieceStyle,stroke:D,strokeWidth:E,opacity:I,effectiveSelectionHook:se.effectiveSelectionHook,resolvedSelection:se.resolvedSelection,cycleByCategory:!0}),he=r(()=>bl({categoryAccessor:d,valueAccessor:h,groupAccessor:u,valueFormat:f}),[d,u,h,f]),ge=Bc({componentName:"SwimlaneChart",data:s,accessors:{categoryAccessor:u,valueAccessor:h,subcategoryAccessor:d},requiredProps:{subcategoryAccessor:d}}),{effectiveLegendProps:fe,effectiveMargin:pe}=Hu({ref:n,frameRef:a,setup:se});if(se.earlyReturn)return se.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:u,rAccessor:h,stackBy:d,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:de,size:[X,V],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:pe,barPadding:ae,enableHover:U}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:o.showAxes,oLabel:!1===W?void 0:ne,rLabel:oe,rFormat:f}),H&&{rTickValues:H}),null!=F&&{tickLabelEdgeAlign:F}),R&&{oFormat:R}),void 0!==W&&{showCategoryTicks:W}),{showGrid:Q}),fe),ul({title:Z,description:J,summary:ee,accessibleTable:te,className:c,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),hl({tooltip:v,defaultTooltipContent:he})),dl({linkedHover:O,onObservation:C,onClick:j,hoverHighlight:M,customHoverBehavior:se.customHoverBehavior,customClickBehavior:se.customClickBehavior})),b&&b.length>0&&{annotations:b}),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(wc,{componentName:"SwimlaneChart",message:ge,width:X,height:V}):e(Cc,{componentName:"SwimlaneChart",width:X,height:V,children:e(va,Object.assign({ref:a},ye))})});function kd(e,t){if(!e)return[];const n=[],o=e=>{n.push(e);const i="function"==typeof t?t(e):e[t];i&&Array.isArray(i)&&i.forEach(o)};return o(e),n}function wd(e,t,n,o){if(e&&e.length>0)return e;const i=new Set;return t.forEach(e=>{const t="function"==typeof n?n(e):e[n],r="function"==typeof o?o(e):e[o];i.add(t),i.add(r)}),Array.from(i).map(e=>({id:e}))}function Ad(e){return"function"==typeof e?e:t=>t[e]||1}function Sd({edgeColorBy:e,colorBy:t,colorScale:n,nodeStyleFn:o,edgeOpacity:i,baseStyle:r={}}){return a=>{const s=Object.assign({fillOpacity:i},r);if("function"==typeof e)s.fill=e(a);else if("source"===e){const e="object"==typeof a.source?a.source:null;t&&e?s.fill=mt(e.data||e,t,n):e&&(s.fill=o(e,e.index).fill)}else if("target"===e){const e="object"==typeof a.target?a.target:null;t&&e?s.fill=mt(e.data||e,t,n):e&&(s.fill=o(e,e.index).fill)}else"gradient"===e&&(s.fill="#999",s.fillOpacity=.7*i);return s}}function Od(e){const{nodes:t,edges:n,inferNodes:o=!0,sourceAccessor:i="source",targetAccessor:a="target",colorBy:s,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:k,loading:w,loadingContent:A,emptyContent:S,emptyDataKey:O="edges"}=e,C=r(()=>me(n),[n]),j=r(()=>me(t),[t]),M=Pc(w,x,k,A),_=M?null:_c("nodes"===O?void 0===t?void 0:j:void 0===n?void 0:C,x,k,S),P=r(()=>o?wd(j,C,i,a):j,[o,j,C,i,a]),L=gc(P,s,l),T=dc(),$=r(()=>{if(Array.isArray(l))return l;if(T&&T.length>0)return T;if("string"==typeof l){const e=ht[l];if(Array.isArray(e)&&e.length>0)return e}return gt},[l,T]),N=r(()=>{if(!s)return[];const e=new Set;for(const t of P){const n="function"==typeof s?s(t):t[s];null!=n&&e.add(n+"")}return Array.from(e)},[P,s]),B=vc(d,s,N),{legend:D,margin:E,legendPosition:I}=mc({data:P,colorBy:s,colorScale:L,showLegend:c,legendPosition:u,userMargin:b,defaults:v,categories:N}),R=pc({selection:h,linkedHover:g,fallbackFields:s?["string"==typeof s?s:""]:[],unwrapData:!0,onObservation:f,onClick:p,chartType:y,chartId:m}),{customHoverBehavior:H,customClickBehavior:F,activeSelectionHook:W,hoverSelectionHook:z,crosshairSourceId:Y}=R;return{safeNodes:P,safeEdges:C,colorScale:L,effectivePalette:$,themeCategorical:T,allCategories:N,legendState:B,legend:D,margin:E,legendPosition:I,customHoverBehavior:H,customClickBehavior:F,activeSelectionHook:W,hoverSelectionHook:z,crosshairSourceId:Y,loadingEl:M,emptyEl:_}}xd.displayName="SwimlaneChart";const Cd=g(function(t,n){var o;const a=i(null);Hc(n,{variant:"network",frameRef:a});const s=xc(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLegend:t.showLegend,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{nodes:l,edges:c,margin:u,className:d,nodeIdAccessor:h,nodeIDAccessor:g,sourceAccessor:f="source",targetAccessor:p="target",nodeLabel:y,colorBy:m,colorScheme:v,nodeSize:b=8,nodeSizeRange:x=[5,20],edgeWidth:k=1,edgeColor:w="#999",edgeOpacity:A=.6,iterations:S=300,forceStrength:O=.1,tooltip:C,frameProps:j={},onObservation:M,onClick:_,chartId:P,selection:L,linkedHover:T,loading:$,loadingContent:N,emptyContent:B,legendInteraction:D,legendPosition:E,stroke:I,strokeWidth:R,opacity:H}=t,F=null!==(o=null!=h?h:g)&&void 0!==o?o:"id",{width:W,height:z,enableHover:Y,showLegend:G,showLabels:q=!1,title:X,description:V,summary:U,accessibleTable:Q}=s,K=Od({nodes:l,edges:c,inferNodes:!1,sourceAccessor:f,targetAccessor:p,colorBy:m,colorScheme:v,showLegend:G,legendPosition:E,legendInteraction:D,selection:L,linkedHover:T,onObservation:M,onClick:_,chartType:"ForceDirectedGraph",chartId:P,marginDefaults:s.marginDefaults,userMargin:u,width:W,height:z,loading:$,loadingContent:N,emptyContent:B,emptyDataKey:"nodes"}),Z=r(()=>new Map,[]),J=r(()=>e=>{const t={};return t.fill=m?mt(e.data||e,m,K.colorScale):hc(void 0,K.themeCategorical,v,void 0,Z),"number"==typeof b&&(t.r=b),t},[m,K.colorScale,b,K.themeCategorical,v,Z]),ee=r(()=>Fc(J,{stroke:I,strokeWidth:R,opacity:H}),[J,I,R,H]),te=r(()=>e=>({stroke:w,strokeWidth:"number"==typeof k?k:"function"==typeof k?k(e):e[k]||1,opacity:A}),[k,w,A]),ne=r(()=>Fc(te,{stroke:I,strokeWidth:R,opacity:H}),[te,I,R,H]),oe=r(()=>{if(q&&y)return"function"==typeof y?y:e=>{var t,n,o;return null!==(o=null!==(n=null===(t=e.data)||void 0===t?void 0:t[y])&&void 0!==n?n:e[y])&&void 0!==o?o:e.id}},[q,y]),ie=Ec({componentName:"ForceDirectedGraph",nodes:l,edges:c,nodesRequired:!0,edgesRequired:!0,accessors:{nodeIDAccessor:F}});return ie?e(wc,{componentName:"ForceDirectedGraph",message:ie,width:W,height:z}):K.loadingEl?K.loadingEl:K.emptyEl?K.emptyEl:e(Cc,{componentName:"ForceDirectedGraph",width:W,height:z,children:e(cl,Object.assign({ref:a,chartType:"force"},null!=l&&{nodes:K.safeNodes},null!=c&&{edges:K.safeEdges},{size:[W,z],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:K.margin,nodeIDAccessor:F,sourceAccessor:f,targetAccessor:p,iterations:S,forceStrength:O,nodeStyle:ee,edgeStyle:ne,colorBy:m,colorScheme:K.effectivePalette,nodeSize:b,nodeSizeRange:x,nodeLabel:oe,showLabels:q,enableHover:Y,tooltipContent:!1===C?()=>null:Ui(C)||void 0,customHoverBehavior:T||M||_?K.customHoverBehavior:void 0,customClickBehavior:M||_?K.customClickBehavior:void 0,legend:K.legend,legendPosition:K.legendPosition},D&&"none"!==D&&{legendHoverBehavior:K.legendState.onLegendHover,legendClickBehavior:K.legendState.onLegendClick,legendHighlightedCategory:K.legendState.highlightedCategory,legendIsolatedCategories:K.legendState.isolatedCategories},{className:d,title:X,description:V,summary:U,accessibleTable:Q},null!=t.animate&&{animate:t.animate},j))})});Cd.displayName="ForceDirectedGraph";const jd=g(function(t,n){const o=i(null);Hc(n,{variant:"network",frameRef:o,overrides:{getData:()=>{var e,t,n,i;return null!==(i=null===(n=null===(t=null===(e=o.current)||void 0===e?void 0:e.getTopology())||void 0===t?void 0:t.edges)||void 0===n?void 0:n.map(e=>e.data))&&void 0!==i?i:[]}}});const a=xc(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{nodes:s,edges:l,margin:c,className:u,sourceAccessor:d="source",targetAccessor:h="target",valueAccessor:g="value",nodeIdAccessor:f="id",colorBy:p,colorScheme:y,edgeColorBy:m="source",padAngle:v=.01,groupWidth:b=20,sortGroups:x,nodeLabel:k,edgeOpacity:w=.5,tooltip:A,frameProps:S={},onObservation:O,onClick:C,chartId:j,selection:M,linkedHover:_,loading:P,loadingContent:L,emptyContent:T,legendInteraction:$,stroke:N,strokeWidth:B,opacity:D}=t,{width:E,height:I,enableHover:R,showLabels:H=!0,title:F,description:W,summary:z,accessibleTable:Y}=a,G=Od({nodes:s,edges:l,inferNodes:!0,sourceAccessor:d,targetAccessor:h,colorBy:p,colorScheme:y,showLegend:!1,legendInteraction:$,selection:M,linkedHover:_,onObservation:O,onClick:C,chartType:"ChordDiagram",chartId:j,marginDefaults:a.marginDefaults,userMargin:c,width:E,height:I,loading:P,loadingContent:L,emptyContent:T}),q=r(()=>new Map,[]),X=G.safeNodes.length>0,V=r(()=>{if(X)return(e,t)=>{var n,o;const i={stroke:"black",strokeWidth:1};if(p)i.fill=mt(e.data||e,p,G.colorScale);else{const r=Array.isArray(y)?y:ht[y]||gt,a=Array.isArray(r)?r:gt,s=null!==(o=null!==(n=e.index)&&void 0!==n?n:t)&&void 0!==o?o:0;i.fill=a[s%a.length]}return i}},[X,p,G.colorScale,y]),U=r(()=>V?Fc(V,{stroke:N,strokeWidth:B,opacity:D}):void 0,[V,N,B,D]),Q=r(()=>{if(X)return Sd({edgeColorBy:m,colorBy:p,colorScale:G.colorScale,nodeStyleFn:U||(e=>({fill:hc(void 0,G.themeCategorical,y,void 0,q)})),edgeOpacity:w,baseStyle:{stroke:"black",strokeWidth:.5,strokeOpacity:w}})},[X,m,p,G.colorScale,U,w,G.themeCategorical,y,q]),K=r(()=>Q?Fc(Q,{stroke:N,strokeWidth:B,opacity:D}):void 0,[Q,N,B,D]),Z=r(()=>{if(!H)return;const e=k||f;return"function"==typeof e?e:t=>{var n,o,i;return null!==(i=null!==(o=null===(n=t.data)||void 0===n?void 0:n[e])&&void 0!==o?o:t[e])&&void 0!==i?i:t.id}},[H,k,f]),J=Ec({componentName:"ChordDiagram",edges:l,edgesRequired:!0});return J?e(wc,{componentName:"ChordDiagram",message:J,width:E,height:I}):G.loadingEl?G.loadingEl:G.emptyEl?G.emptyEl:e(Cc,{componentName:"ChordDiagram",width:E,height:I,children:e(cl,Object.assign({ref:o,chartType:"chord"},G.safeNodes.length>0&&{nodes:G.safeNodes},null!=l&&{edges:G.safeEdges},{size:[E,I],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:G.margin,nodeIDAccessor:f,sourceAccessor:d,targetAccessor:h,valueAccessor:g,padAngle:v,groupWidth:b,sortGroups:x,nodeStyle:U,edgeStyle:K,colorBy:p,colorScheme:G.effectivePalette,edgeColorBy:m,edgeOpacity:w,nodeLabel:Z,showLabels:H,enableHover:R,tooltipContent:!1===A?()=>null:Ui(A)||void 0,customHoverBehavior:_||O||C?G.customHoverBehavior:void 0,customClickBehavior:O||C?G.customClickBehavior:void 0},$&&"none"!==$&&{legendHoverBehavior:G.legendState.onLegendHover,legendClickBehavior:G.legendState.onLegendClick,legendHighlightedCategory:G.legendState.highlightedCategory,legendIsolatedCategories:G.legendState.isolatedCategories},{className:u,title:F,description:W,summary:z,accessibleTable:Y},null!=t.animate&&{animate:t.animate},S))})});jd.displayName="ChordDiagram";const Md=g(function(t,n){const o=i(null);Hc(n,{variant:"network",frameRef:o,overrides:{getData:()=>{var e,t,n,i;return null!==(i=null===(n=null===(t=null===(e=o.current)||void 0===e?void 0:e.getTopology())||void 0===t?void 0:t.edges)||void 0===n?void 0:n.map(e=>e.data))&&void 0!==i?i:[]}}});const a=xc(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:800,height:600}),{nodes:s,edges:l,margin:c,className:u,sourceAccessor:d="source",targetAccessor:h="target",valueAccessor:g="value",nodeIdAccessor:f="id",colorBy:p,colorScheme:y,edgeColorBy:m="source",orientation:v="horizontal",nodeAlign:b="justify",nodePaddingRatio:x=.05,nodeWidth:k=15,nodeLabel:w,edgeOpacity:A=.5,edgeSort:S,tooltip:O,frameProps:C={},onObservation:j,onClick:M,chartId:_,selection:P,linkedHover:L,loading:T,loadingContent:$,emptyContent:N,showLegend:B,legendPosition:D,legendInteraction:E,stroke:I,strokeWidth:R,opacity:H}=t,{width:F,height:W,enableHover:z,showLabels:Y=!0,title:G,description:q,summary:X,accessibleTable:V}=a,U=Od({nodes:s,edges:l,inferNodes:!0,sourceAccessor:d,targetAccessor:h,colorBy:p,colorScheme:y,showLegend:B,legendPosition:D,legendInteraction:E,selection:P,linkedHover:L,onObservation:j,onClick:M,chartType:"SankeyDiagram",chartId:_,marginDefaults:a.marginDefaults,userMargin:c,width:F,height:W,loading:T,loadingContent:$,emptyContent:N}),Q=r(()=>new Map,[]),K=r(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=p?mt(e.data||e,p,U.colorScale):hc(void 0,U.themeCategorical,y,void 0,Q),t},[p,U.colorScale,U.themeCategorical,y,Q]),Z=r(()=>Fc(K,{stroke:I,strokeWidth:R,opacity:H}),[K,I,R,H]),J=r(()=>Sd({edgeColorBy:m,colorBy:p,colorScale:U.colorScale,nodeStyleFn:Z,edgeOpacity:A,baseStyle:{stroke:"none",strokeWidth:0}}),[m,p,U.colorScale,Z,A]),ee=r(()=>Fc(J,{stroke:I,strokeWidth:R,opacity:H}),[J,I,R,H]),te=r(()=>{if(!Y)return;const e=w||f;return"function"==typeof e?e:t=>{var n,o,i;return null!==(i=null!==(o=null===(n=t.data)||void 0===n?void 0:n[e])&&void 0!==o?o:t[e])&&void 0!==i?i:t.id}},[Y,w,f]),ne=Ec({componentName:"SankeyDiagram",edges:l,edgesRequired:!0});return ne?e(wc,{componentName:"SankeyDiagram",message:ne,width:F,height:W}):U.loadingEl?U.loadingEl:U.emptyEl?U.emptyEl:e(Cc,{componentName:"SankeyDiagram",width:F,height:W,children:e(cl,Object.assign({ref:o,chartType:"sankey"},U.safeNodes.length>0&&{nodes:U.safeNodes},null!=l&&{edges:U.safeEdges},{size:[F,W],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:U.margin,nodeIDAccessor:f,sourceAccessor:d,targetAccessor:h,valueAccessor:g,orientation:v,nodeAlign:b,nodePaddingRatio:x,nodeWidth:k,nodeStyle:Z,edgeStyle:ee,colorBy:p,colorScheme:U.effectivePalette,edgeColorBy:m,edgeOpacity:A,edgeSort:S,nodeLabel:te,showLabels:Y,enableHover:z,tooltipContent:!1===O?()=>null:Ui(O)||void 0,customHoverBehavior:L||j||M?U.customHoverBehavior:void 0,customClickBehavior:j||M?U.customClickBehavior:void 0,legend:U.legend,legendPosition:U.legendPosition},E&&"none"!==E&&{legendHoverBehavior:U.legendState.onLegendHover,legendClickBehavior:U.legendState.onLegendClick,legendHighlightedCategory:U.legendState.highlightedCategory,legendIsolatedCategories:U.legendState.isolatedCategories},{className:u,title:G,description:q,summary:X,accessibleTable:V},null!=t.animate&&{animate:t.animate},C))})});function _d(e,t,n){const o=t.incoming[e.id],i=t.outgoing[e.id],r=[];for(const e of o)r.push({time:e.endTime,delta:+e.value,edge:e,kind:"in",side:n.get(e.id).targetSide});for(const e of i)r.push({time:e.startTime,delta:-e.value,edge:e,kind:"out",side:n.get(e.id).sourceSide});const a={create:0,in:1,"transfer-out":2,"transfer-in":3,out:4},s=()=>{r.sort((e,t)=>{var n,o;return e.time-t.time||(null!==(n=a[e.kind])&&void 0!==n?n:99)-(null!==(o=a[t.kind])&&void 0!==o?o: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};s();const f=[];let p=0,y=0;for(const e of r)if("out"===e.kind){const t=Math.abs(e.delta);let n=t-("top"===e.side?p:y);if(n>0){const t="top"===e.side?"bot":"top",o=Math.min(n,"top"===t?p:y);if(o>0){const i=g(e.time);f.push({time:i,delta:-o,kind:"transfer-out",side:t}),f.push({time:i,delta:+o,kind:"transfer-in",side:e.side}),"top"===t?p-=o:y-=o,"top"===e.side?p+=o:y+=o,n-=o}n>0&&null!==u&&(f.push({time:u,delta:+n,kind:"create",side:e.side}),"top"===e.side?p+=n:y+=n)}"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),s();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 S=[];let O=0;for(;w.length>O;){let e=O;for(;w.length>e+1&&w[e+1].t===w[O].t;)e++;S.push(w[O]);for(let t=O+1;e>=t;t++){const e=S[S.length-1];w[t].topMass===e.topMass&&w[t].botMass===e.botMass||S.push(w[t])}O=e+1}const C=Array.isArray(e.xExtent)&&Number.isFinite(e.xExtent[1])?e.xExtent[1]:null;let j=null;for(const e of i)null!=e.systemInTime&&Number.isFinite(e.systemInTime)&&e.startTime>e.systemInTime&&(null===j||j>e.systemInTime)&&(j=e.systemInTime);let M=null;for(const e of o)null!=e.systemOutTime&&Number.isFinite(e.systemOutTime)&&e.systemOutTime>e.endTime&&(null===M||e.systemOutTime>M)&&(M=e.systemOutTime);if(S.length>0){const e=S[S.length-1],t=Math.max(null!=C?C:-1/0,null!=M?M:-1/0);Number.isFinite(t)&&t>e.t&&e.topMass+e.botMass>0&&S.push({t:t,topMass:e.topMass,botMass:e.botMass});const n=S[0],o=Math.min(null!=c?c:1/0,null!=j?j:1/0);Number.isFinite(o)&&n.t>o&&n.topMass+n.botMass>0&&S.unshift({t:o,topMass:n.topMass,botMass:n.botMass})}return{samples:S,peak:b,topPeak:x,botPeak:k,localAttachments:A}}function Pd(e,t){return t?Math.max(t[0],Math.min(t[1],e)):e}function Ld(e,t){return e.map(e=>({t:Pd(e.t,t),topMass:e.topMass,botMass:e.botMass}))}function Td(e,t,n){const o=e.value*n;if("out"===e.kind){const i=e.sideMassBefore*n;if("top"===e.side){const e=t-i;return[e,e+o]}const r=t+i;return[r-o,r]}const i=e.sideMassAfter*n;if("top"===e.side){const e=t-i;return[e,e+o]}const r=t+i;return[r-o,r]}function $d(e,t){let n=0;for(let o=0;t.length>o;o++)for(let i=o+1;t.length>i;i++){const r=t[o],a=t[i];r.source!==a.source&&r.target!==a.target&&r.source!==a.target&&r.target!==a.source&&(Math.min(r.endTime,a.endTime)>Math.max(r.startTime,a.startTime)&&e[a.source]>e[r.source]!=e[a.target]>e[r.target]&&n++)}return n}function Nd(e,t){let n=0;for(const o of t)n+=Math.abs(e[o.source]-e[o.target])*(o.value||1);return n}function Bd(e,t){return 1e3*$d(e,t)+Nd(e,t)}function Dd(e,t){return{slots:e.map(e=>({peak:Object.assign({},e.peak),occupants:e.occupants.slice()})),map:Object.assign({},t)}}function Ed(e,t,n){e.length>8||n.length>40?(function(e,t,n,o=6){const i=e.length;if(1>=i)return;let r=Dd(e,t),a=Bd(t,n);for(let s=0;o>s;s++){const o=Array(i).fill(0),s=Array(i).fill(0);for(const e of n){const n=t[e.source],i=t[e.target];o[n]+=i*(e.value||1),s[n]+=e.value||1,o[i]+=n*(e.value||1),s[i]+=e.value||1}const l=Array.from({length:i},(e,t)=>t).sort((e,t)=>(s[e]>0?o[e]/s[e]:e)-(s[t]>0?o[t]/s[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=Bd(t,n);if(a>d)a=d,r=Dd(e,t);else if(d===a)break}!function(e,t,n){e.length=0;for(const t of n.slots)e.push(t);for(const e of Object.keys(t))delete t[e];for(const e of Object.keys(n.map))t[e]=n.map[e]}(e,t,r)}(e,t,n,6),function(e,t,n,o=6){const i=e.length;if(1>=i)return;let r=Bd(t,n);for(let a=0;o>a;a++){let o=!1;for(let a=0;i-1>a;a++){const i=e[a];e[a]=e[a+1],e[a+1]=i;for(const e of Object.keys(t))t[e]===a?t[e]=a+1:t[e]===a+1&&(t[e]=a);const s=Bd(t,n);if(r>s)r=s,o=!0;else{const n=e[a];e[a]=e[a+1],e[a+1]=n;for(const e of Object.keys(t))t[e]===a?t[e]=a+1:t[e]===a+1&&(t[e]=a)}}if(!o)break}}(e,t,n,6)):function(e,t,n){const o=e.length;if(1>=o)return;const i=Object.assign({},t),r=Object.keys(i),a=Array.from({length:o},(e,t)=>t),s=a.slice(),l=Object.assign({},i);let c=a.slice(),u=1/0;const d=()=>{for(const e of r)l[e]=s[i[e]];const e=Bd(l,n);u>e&&(u=e,c=a.slice())},h=(e,t)=>{const n=a[e],o=a[t];a[e]=o,a[t]=n,s[n]=t,s[o]=e};d();const g=Array(o).fill(0);let f=0;for(;o>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,n)}function Id(e,t,n,o,i){var r,a,s,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]=n[t.id].topPeak||0,x[t.id]=n[t.id].botPeak||0;const k="half"===v,w={};for(const t of e){const e=Array.isArray(t.xExtent)?t.xExtent[0]:null,n=Array.isArray(t.xExtent)?t.xExtent[1]:null;let i=null!=e&&Number.isFinite(e)?e:1/0,r=null!=n&&Number.isFinite(n)?n:-1/0;for(const e of o.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 o.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={},S=[];if("reuse"===y){const n=new Map;for(const t of e)n.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!==(a=i.get(t.id))&&void 0!==a?a:0)&&d.push(t.id);for(;d.length;){const e=d.shift();for(const t of null!==(s=o.outgoing[e])&&void 0!==s?s:[]){const o=(null!==(l=n.get(e))&&void 0!==l?l:0)+1;o>(null!==(c=n.get(t.target))&&void 0!==c?c:0)&&n.set(t.target,o),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 o,i;const r=null!==(o=n.get(e.id))&&void 0!==o?o:0,a=null!==(i=n.get(t.id))&&void 0!==i?i:0;return r!==a?r-a: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 n=-1;for(let e=0;S.length>e;e++){const o=S[e].occupants[S[e].occupants.length-1];if(null===t.start||void 0===o||t.start>=o.end){n=e;break}}-1===n&&(S.push({occupants:[],peak:{topPeak:0,botPeak:0}}),n=S.length-1),S[n].occupants.push({id:e.id,end:null!==(u=null==t?void 0:t.end)&&void 0!==u?u:-1/0}),S[n].peak.topPeak=Math.max(S[n].peak.topPeak,b[e.id]),S[n].peak.botPeak=Math.max(S[n].peak.botPeak,x[e.id]),A[e.id]=n}}else e.forEach((e,t)=>{var n,o;S.push({occupants:[{id:e.id,end:null!==(o=null===(n=w[e.id])||void 0===n?void 0:n.end)&&void 0!==o?o:-1/0}],peak:{topPeak:b[e.id],botPeak:x[e.id]}}),A[e.id]=t});let O=null,C=null,j=null,M=null;const _=()=>{O=$d(A,t),j=Nd(A,t)},P=()=>{C=$d(A,t),M=Nd(A,t)};"crossing-min"===m?(_(),Ed(S,A,t),P()):"inside-out"===m?(_(),function(e,t){const n=e.length;if(1>=n)return;const o=e=>e.peak.topPeak+e.peak.botPeak,i=e.map((e,t)=>({slot:e,idx:t})).sort((e,t)=>o(t.slot)-o(e.slot)),r=Array(n),a=Math.floor((n-1)/2);r[a]=i[0].idx;let s=a-1,l=a+1;for(let e=1;i.length>e;e++)e%2==1&&n>l||0>s?r[l++]=i[e].idx:r[s--]=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)}(S,A),P()):"crossing-min+inside-out"===m&&(_(),Ed(S,A,t),function(e,t,n){const o=e.length;if(1>=o)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((o-1)/2);let a=Bd(t,n);for(const{slot:s}of i){const i=e.indexOf(s);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;o>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=Bd(t,n);if(d>a){const n=e[l];e.splice(l,1),e.splice(i,0,n);const r=new Map;for(let e=0;o>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 a=d}}(S,A,t),P());const L=S.map(e=>{const t=new Map;for(const o of e.occupants){const e=n[o.id];if(e)for(const n of e.samples){const e=t.get(n.t)||{top:0,bot:0};t.set(n.t,{top:Math.max(e.top,n.topMass),bot:Math.max(e.bot,n.botMass)})}}return[...t.entries()].sort((e,t)=>e[0]-t[0])}),T=(e,t)=>{let n={top:0,bot:0};for(const[o,i]of e){if(o>t)break;n=i}return n},$=[];for(let e=0;S.length-1>e;e++){const t=L[e],n=L[e+1],o=new Set([...t.map(e=>e[0]),...n.map(e=>e[0])]);let i=0;for(const e of o){const o=T(t,e),r=T(n,e);o.bot+r.top>i&&(i=o.bot+r.top)}$.push(i)}const N=[];let B=f+(null!==(h=null===(d=S[0])||void 0===d?void 0:d.peak.topPeak)&&void 0!==h?h:0)*p;S.length>0&&N.push(B);for(let e=1;S.length>e;e++)B+=$[e-1]*p+f,N.push(B);if(S.length>0&&(B+=S[S.length-1].peak.botPeak*p+f),B>g){const e=g/B;for(let t=0;N.length>t;t++)N[t]*=e}const D=0===S.length?0:S[0].peak.topPeak+$.reduce((e,t)=>e+t,0)+S[S.length-1].peak.botPeak,E={};for(const t of e)E[t.id]=N[A[t.id]];return{effectiveSlotsHeight:D,centerlines:E,laneLifetime:w,slots:S,slotByNode:A,slotCenter:N,crossingsBefore:O,crossingsAfter:C,lengthBefore:j,lengthAfter:M}}Md.displayName="SankeyDiagram";const Rd=e=>{var t,n;const{bands:o=[],ribbons:i=[],showLabels:r=!0}=e.config,a=[];for(const e of i)a.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 o)if(e.gradientStubs)for(let t=0;e.gradientStubs.length>t;t++){const n=e.gradientStubs[t];a.push({type:"bezier",pathD:n.pathD,interactive:!1,style:{fill:e.fill,fillOpacity:.86,stroke:"none"},_gradient:{x0:n.x0,x1:n.x1,from:n.from,to:n.to},datum:{__kind:"band",data:e.rawDatum,id:`${e.id}__stub${t}`}})}for(const e of o)a.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!==(n=e.strokeWidth)&&void 0!==n?n:.5}),datum:{__kind:"band",data:e.rawDatum,id:e.id}});const s=r?o.map(e=>({x:e.labelX,y:e.labelY,text:e.labelText,anchor:"end",baseline:"middle",fontSize:11,fontWeight:600})):[];return{sceneNodes:o.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:a,labels:s}};function Hd(e){return"object"==typeof e&&null!==e&&"__kind"in e&&("band"===e.__kind||"ribbon"===e.__kind)}function Fd(e){return null==e?NaN:e instanceof Date?e.getTime():"number"==typeof e?e:new Date(e).getTime()}function Wd(e,t){return"function"==typeof e?e(t):t[e]}const zd=g(function(o,a){const{nodes:s,edges:c,domain:u,axisTicks:h=[],nodeIdAccessor:g="id",sourceAccessor:f="source",targetAccessor:p="target",valueAccessor:y="value",startTimeAccessor:m="startTime",endTimeAccessor:v="endTime",systemInTimeAccessor:b,systemOutTimeAccessor:x,xExtentAccessor:k="xExtent",edgeIdAccessor:w="id",colorBy:S,colorScheme:O,showLegend:C,legendPosition:j="right",pairing:M="temporal",packing:_="reuse",laneOrder:P="crossing-min",ribbonLane:L="both",lifetimeMode:T="half",showLaneRails:$=!1,showQualityReadout:N=!1,showLabels:B=!0,width:D=600,height:E=400,margin:I,title:R,description:H,summary:F,accessibleTable:W,responsiveWidth:z,responsiveHeight:Y,loading:G,loadingContent:q,emptyContent:X,edgeOpacity:V=.35,timeFormat:U,valueFormat:Q,tooltip:K,enableHover:Z=!0,onObservation:J,onClick:ee,showParticles:te=!1,particleStyle:ne,chartId:oe,frameProps:ie={}}=o,[re,ae]=d([]),[se,le]=d([]),ce=i(re),ue=i(se);ce.current=re,ue.current=se;const de=l(e=>{ce.current=e,ae(e)},[]),he=l(e=>{ue.current=e,le(e)},[]),ge=void 0!==c,fe=me(ge?c:re),pe=r(()=>{const e=me(null!=s?s:[]),t=se;if(0===e.length&&0===t.length)return wd([],fe,f,p);const n=new Set,o=[];for(const t of e){const e=Wd(g,t)+"";n.has(e)||(n.add(e),o.push(t))}for(const e of t){const t=Wd(g,e)+"";n.has(t)||(n.add(t),o.push(e))}const i=wd([],fe,f,p);for(const e of i)n.has(e.id)||(n.add(e.id),o.push(e));return o},[s,se,fe,g,f,p]),ye=i(null),ve=l((e,t)=>{const n=Wd(w,e);return null!=n?n+"":`${Wd(f,e)}-${Wd(p,e)}-${t}`},[w,f,p]),be=l(e=>{if(null==e)return!1;const t=e;return null!=Wd(f,t)&&null!=Wd(p,t)},[f,p]);Hc(a,{variant:"network",frameRef:ye,overrides:{push(e){if(be(e)){if(ge)return void console.warn("ProcessSankey.push: edge ignored — `edges` prop is controlled.");de([...ce.current,e])}else he([...ue.current,e])},pushMany(e){const t=[],n=[];for(const o of e)be(o)?t.push(o):n.push(o);t.length>0&&(ge?console.warn("ProcessSankey.pushMany: edges ignored — `edges` prop is controlled."):de([...ce.current,...t])),n.length>0&&he([...ue.current,...n])},remove(e){const t=new Set(Array.isArray(e)?e:[e]),n=[];if(!ge){const e=ce.current,o=[];for(let i=0;e.length>i;i++){const r=e[i];t.has(ve(r,i))?n.push(r):o.push(r)}o.length!==e.length&&de(o)}const o=ue.current,i=[];for(const e of o){const o=Wd(g,e)+"";t.has(o)?n.push(e):i.push(e)}return i.length!==o.length&&he(i),n},update(e,t){const n=new Set(Array.isArray(e)?e:[e]),o=[];if(!ge){let e=!1;const i=ce.current.map((i,r)=>n.has(ve(i,r))?(o.push(i),e=!0,t(i)):i);e&&de(i)}let i=!1;const r=ue.current.map(e=>{const r=Wd(g,e)+"";return n.has(r)?(o.push(e),i=!0,t(e)):e});return i&&he(r),o},clear(){var e;ge||de([]),he([]),null===(e=ye.current)||void 0===e||e.clear()},getData:()=>null!=fe?fe:[],getScales:()=>null},deps:[ge,be,ve,g,fe,de,he]});const xe=ve,ke=l(e=>Wd(g,e)+"",[g]),{nodes:we,edges:Ae,domain:Se,rawNodeById:Oe,rawEdgeById:Ce}=r(()=>{const e=(null!=pe?pe:[]).map(e=>{const t={id:ke(e),__raw:e},n=k?Wd(k,e):null;if(Array.isArray(n)&&2===n.length){const e=Fd(n[0]),o=Fd(n[1]);Number.isFinite(e)&&Number.isFinite(o)&&(t.xExtent=[e,o])}return t}),t=(null!=fe?fe:[]).map((e,t)=>{const n={id:xe(e,t),source:Wd(f,e)+"",target:Wd(p,e)+"",value:Number(Wd(y,e)),startTime:Fd(Wd(m,e)),endTime:Fd(Wd(v,e)),__raw:e};if(b){const t=Fd(Wd(b,e));Number.isFinite(t)&&(n.systemInTime=t)}if(x){const t=Fd(Wd(x,e));Number.isFinite(t)&&(n.systemOutTime=t)}return n}),n=[Fd(u[0]),Fd(u[1])],o=new Map;for(const t of e)null!=t.__raw&&o.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:n,rawNodeById:o,rawEdgeById:i}},[pe,fe,u,ke,xe,k,f,p,y,m,v,b,x]),je=Od({nodes:pe,edges:fe,inferNodes:!1,sourceAccessor:f,targetAccessor:p,colorBy:S,colorScheme:O,showLegend:!1,legendPosition:j,selection:void 0,linkedHover:void 0,onObservation:J,onClick:ee,chartType:"ProcessSankey",chartId:oe,marginDefaults:{top:30,right:80,bottom:40,left:80},userMargin:I,width:D,height:E,loading:G,loadingContent:q,emptyContent:X}),Me=(null!=C?C:!!S)&&!!S,_e=l(e=>null!=I&&("number"==typeof I||null!=I[e]),[I]),Pe=r(()=>{const e=Object.assign({},je.margin);return Me&&("right"===j&&!_e("right")&&140>e.right?e.right=140:"bottom"===j&&!_e("bottom")&&80>e.bottom&&(e.bottom=80)),e},[je.margin,Me,j,_e]),Le=D-Pe.left-Pe.right,Te=E-Pe.top-Pe.bottom,$e=r(()=>function(e,t,n){const o=[],i=new Set(e.map(e=>e.id)),r=Array.isArray(n)&&2===n.length,a=r&&Number.isFinite(n[0])&&Number.isFinite(n[1]);r&&a&&a&&n[1]>=n[0]||o.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]||o.push({kind:"invalid-node-time",id:t.id}));for(const e of t)i.has(e.source)||o.push({kind:"missing-node",id:e.id,endpoint:"source",nodeId:e.source}),i.has(e.target)||o.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||o.push({kind:"invalid-value",id:e.id}),e.endTime>e.startTime||o.push({kind:"backward-edge",id:e.id,source:e.source,target:e.target})):o.push({kind:"invalid-edge-time",id:e.id});return o}(we,Ae,Se),[we,Ae,Se]),Ne=r(()=>$e.length>0?null:function(e,t,n){var o;const{plotH:i,pairing:r="temporal",packing:a="reuse",laneOrder:s="crossing-min",lifetimeMode:l="half"}=n,c=function(e,t){const n={},o={};for(const t of e)n[t.id]=[],o[t.id]=[];for(const e of t)o[e.source]&&o[e.source].push(e),n[e.target]&&n[e.target].push(e);return{incoming:n,outgoing:o}}(e,t),u=function(e,t,n,o="value"){const i="temporal"===o?(e,t)=>e.endTime-t.endTime:(e,t)=>t.value-e.value,r="temporal"===o?(e,t)=>e.startTime-t.startTime:(e,t)=>t.value-e.value,a=new Map;for(const e of t)a.set(e.id,{});const s=(e,t)=>{const n=new Map;for(const o of e){const e=o[t];n.has(e)||n.set(e,{partner:e,edges:[],total:0,earliestStart:1/0,latestEnd:-1/0});const i=n.get(e);i.edges.push(o),i.total+=o.value,i.earliestStart=Math.min(i.earliestStart,o.startTime),i.latestEnd=Math.max(i.latestEnd,o.endTime)}const a=[...n.values()];a.sort("temporal"===o?(e,n)=>"target"===t?e.earliestStart-n.earliestStart:e.latestEnd-n.latestEnd:(e,t)=>t.total-e.total);for(const e of a)e.edges.sort("target"===t?r:i);return a};for(const t of e){const e=n.outgoing[t.id],o=n.incoming[t.id];if(0===o.length)s(e,"target").forEach((e,t)=>{const n=t%2==0?"top":"bot";for(const t of e.edges)a.get(t.id).sourceSide=n});else if(0===e.length)s(o,"source").forEach((e,t)=>{const n=t%2==0?"top":"bot";for(const t of e.edges)a.get(t.id).targetSide=n});else{const t=s(o,"source"),n=s(e,"target"),i=Math.max(t.length,n.length);for(let e=0;i>e;e++){const o=e%2==0?"top":"bot";if(t[e])for(const n of t[e].edges)a.get(n.id).targetSide=o;if(n[e])for(const t of n[e].edges)a.get(t.id).sourceSide=o}}}return a}(e,t,c,r);let d={};for(const t of e)d[t.id]=_d(t,c,u);const h=Id(e,t,d,c,{plotH:i,padding:12,valueScale:1,packing:a,laneOrder:s,lifetimeMode:l}),g=new Set;for(const e of t){const t=h.slotByNode[e.source],n=h.slotByNode[e.target];if(void 0===t||void 0===n)continue;const o=u.get(e.id);t!==n?t>n?(o.sourceSide="top",o.targetSide="bot"):(o.sourceSide="bot",o.targetSide="top"):(g.add(e.id),o.sourceSide="bot",o.targetSide="bot")}for(const t of e){const e=c.outgoing[t.id],n=c.incoming[t.id],o=new Set(e.map(e=>u.get(e.id).sourceSide)),i=new Set(n.map(e=>u.get(e.id).targetSide));if(1===o.size&&n.length>0){const e=[...o][0];for(const t of n)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 n of e)h.slotByNode[n.source]===h.slotByNode[n.target]&&(u.get(n.id).sourceSide=t)}}for(const t of e){const e=c.incoming[t.id],n=c.outgoing[t.id];if(0===e.length||0===n.length)continue;const o=()=>{const t={inTop:0,inBot:0,outTop:0,outBot:0};for(const n of e)"top"===u.get(n.id).targetSide?t.inTop+=n.value:t.inBot+=n.value;for(const e of n)"top"===u.get(e.id).sourceSide?t.outTop+=e.value:t.outBot+=e.value;return t},i=(e,t)=>{const i=o(),r="top"===e?i.outTop-i.inTop:i.outBot-i.inBot,a="top"===t?i.inTop-i.outTop:i.inBot-i.outBot;if(0>=r||0>=a)return!1;const s=Math.min(r,a),l=n.filter(t=>!g.has(t.id)&&u.get(t.id).sourceSide===e&&s>=t.value).sort((e,t)=>t.value-e.value);return 0!==l.length&&(u.get(l[0].id).sourceSide=t,!0)};let r=n.length+1;for(;r-- >0&&(i("top","bot")||i("bot","top")););}d={};for(const t of e)d[t.id]=_d(t,c,u);const f=Id(e,t,d,c,{plotH:i,padding:12,valueScale:1,packing:a,laneOrder:s,lifetimeMode:l}),p=null!==(o=f.effectiveSlotsHeight)&&void 0!==o?o: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=Id(e,t,d,c,{plotH:i,padding:y,valueScale:m,packing:a,laneOrder:s,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}}(we,Ae,{plotH:Te,pairing:M,packing:_,laneOrder:P,lifetimeMode:T}),[$e,we,Ae,Te,M,_,P,T]),Be=r(()=>A().domain(Se).range([0,Le]),[Se,Le]),De=l((e,t)=>{if(S&&pe){const t=Oe.get(e);if(t)return mt(t,S,je.colorScale)}return je.effectivePalette[t%je.effectivePalette.length]||"#475569"},[S,pe,Oe,je.colorScale,je.effectivePalette]),Ee=r(()=>{const e=new Map;return we.forEach((t,n)=>e.set(t.id,n)),e},[we]),Ie=r(()=>{if(!Ne)return{bands:[],ribbons:[]};const{centerlines:e,nodeData:t,valueScale:n}=Ne,o=[],i=[];return we.forEach((i,r)=>{var a;const s=t[i.id];if(!s||0===s.samples.length)return;const l=function(e,t,n,o,i){if(0===e.length)return null;const r=Ld(e,i),a=e=>t-r[e].topMass*n,s=e=>t+r[e].botMass*n;let l=`M${o(r[0].t)},${a(0)}`;for(let e=1;r.length>e;e++)l+=` L${o(r[e].t)},${a(e)}`;l+=` L${o(r[r.length-1].t)},${s(r.length-1)}`;for(let e=r.length-2;e>=0;e--)l+=` L${o(r[e].t)},${s(e)}`;return l+" Z"}(s.samples,e[i.id],n,Be,Se);if(!l)return;const c=Ld(s.samples,Se),u=c.find(e=>e.topMass+e.botMass>0)||c[0],d=e[i.id]+(u.botMass-u.topMass)*n/2,h=De(i.id,r),g=null!==(a=Oe.get(i.id))&&void 0!==a?a:i,f=function(e,t,n,o,i){const r=n.nodeData[e];if(!r||0===r.samples.length)return[];const a=n.valueScale,s=n.centerlines[e],l=Ld(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=o(c.t),h=o(u.t),g=e=>o(Pd(e,i)),f=[],p=(e,t,n,o)=>`M${e},${t} L${n},${t} L${n},${o} L${e},${o} Z`;for(const n of t){if(n.source===e&&null!=n.systemInTime&&Number.isFinite(n.systemInTime)){const e=r.localAttachments.get(n.id);if(e&&"out"===e.kind&&n.startTime>n.systemInTime){const t=g(n.systemInTime),o=g(n.startTime),i=t-20,r=Math.max(d,i);if(o>r){const[n,l]=Td(e,s,a);f.push({pathD:p(r,n,o,l),x0:i,x1:t,from:0,to:1})}}}if(n.target===e&&null!=n.systemOutTime&&Number.isFinite(n.systemOutTime)){const e=r.localAttachments.get(n.id);if(e&&"in"===e.kind&&n.systemOutTime>n.endTime){const t=g(n.systemOutTime),o=g(n.endTime),i=t+20,r=Math.min(h,i);if(r>o){const[n,l]=Td(e,s,a);f.push({pathD:p(o,n,r,l),x0:t,x1:i,from:1,to:0})}}}}return f}(i.id,Ae,Ne,Be,Se);o.push(Object.assign(Object.assign({id:i.id,pathD:l,fill:h,stroke:h,strokeWidth:.5},f.length>0&&{gradientStubs:f}),{rawDatum:g,labelX:Be(u.t)-4,labelY:d,labelText:i.id}))}),Ae.forEach(o=>{var r,a,s,l;const c=null===(r=t[o.source])||void 0===r?void 0:r.localAttachments.get(o.id),u=null===(a=t[o.target])||void 0===a?void 0:a.localAttachments.get(o.id);if(!c||!u)return;const d=null!==(s=Ee.get(o.source))&&void 0!==s?s:0,h=De(o.source,d),g=function(e,t,n,o,i,r,a,s){const l=i,c=e=>s?Math.max(s[0],Math.min(s[1],e)):e,u=r(c(e.time)),d=r(c(n.time)),h=e.value*l,g=n.value*l,f=e.sideMassBefore*l,p=n.sideMassAfter*l;let y,m,v,b;"top"===e.side?(y=t-f,m=y+h):(m=t+f,y=m-h),"top"===n.side?(v=o-p,b=v+g):(b=o+p,v=b-g);const x="source"===a?u+.85*(d-u):"target"===a?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[o.source],u,e[o.target],n,Be,L,Se),{pathD:f,bezier:p}=cs(g),y=null!==(l=Ce.get(o.id))&&void 0!==l?l:o;i.push({id:o.id,pathD:f,fill:h,opacity:V,rawDatum:y,bezier:p})}),{bands:o,ribbons:i}},[Ne,we,Ae,Be,Se,De,Oe,Ce,L,V,Ee]),Re=r(()=>({bands:Ie.bands,ribbons:Ie.ribbons,showLabels:B}),[Ie,B]),He=r(()=>{if(!Me||!S)return;const e=new Map;(null!=pe?pe:[]).forEach((t,n)=>{const o=Wd(S,t),i=null==o?"":o+"";i&&!e.has(i)&&e.set(i,{label:i,color:De(ke(t),n)})});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},[Me,S,pe,De,ke]),Fe=r(()=>!1!==K&&Z?void 0===K||!0===K?null:Ui(K)||null:null,[K,Z]),We=l(e=>U?U(new Date(e)):Number.isFinite(e)?1e10>Math.abs(e)?Number.isInteger(e)?e+"":e.toFixed(2):new Date(e).toISOString().slice(0,10):"",[U]),ze=l(e=>Q?Q(e):e+"",[Q]),Ye=l(o=>{if(!o||!o.data)return null;const i=o.data;if(!Hd(i))return null;const r=i.data;if(Fe)return Fe(r);if("band"===i.__kind){const n=i.id,o=Ne?function(e){if(!e)return[];const t=new Set,n=[];for(const o of e.samples){const e=o.topMass+o.botMass,i=`${o.t}:${e}`;t.has(i)||(t.add(i),n.push({t:o.t,total:e}))}return n}(Ne.nodeData[n]):[],r=5,a=o.length>r?o.length:null,s=function(e,t=5){if(t>=e.length)return e.slice();const n=[...e].sort((e,t)=>e.total-t.total),o=n.length-1,i=[Object.assign(Object.assign({},n[0]),{mark:"min"}),Object.assign(Object.assign({},n[Math.floor(.25*o)]),{mark:"q25"}),Object.assign(Object.assign({},n[Math.floor(.5*o)]),{mark:"median"}),Object.assign(Object.assign({},n[Math.floor(.75*o)]),{mark:"q75"}),Object.assign(Object.assign({},n[o]),{mark:"max"})],r=new Set,a=[];for(const e of i)r.has(e.t)||(r.add(e.t),a.push(e));return a.sort((e,t)=>e.t-t.t)}(o,r);return t("div",{style:{minWidth:160},children:[e("div",{style:{fontWeight:600,marginBottom:4},children:n}),s.length>0&&t("table",{style:{borderCollapse:"collapse",fontSize:11,width:"100%"},children:[e("thead",{children:t("tr",{style:{opacity:.6},children:[e("th",{style:{textAlign:"left",fontWeight:500,paddingRight:8},children:"Time"}),e("th",{style:{textAlign:"right",fontWeight:500},children:"Mass"}),null!=a&&e("th",{})]})}),e("tbody",{children:s.map((n,o)=>t("tr",{children:[e("td",{style:{paddingRight:8},children:We(n.t)}),e("td",{style:{textAlign:"right"},children:ze(n.total)}),null!=a&&e("td",{style:{textAlign:"right",paddingLeft:8,opacity:.55},children:n.mark})]},o))})]}),null!=a&&t("div",{style:{marginTop:4,fontSize:10,opacity:.55},children:["showing ",s.length," of ",a," samples"]})]})}const a=r,s=Wd(f,a),l=Wd(p,a),c=Wd(y,a),u=Wd(m,a),d=Wd(v,a);return t("div",{style:{minWidth:160},children:[t("div",{style:{fontWeight:600,marginBottom:4},children:[s+""," → ",l+""]}),t("div",{style:{display:"grid",gridTemplateColumns:"auto 1fr",columnGap:8,fontSize:11},children:[null!=c&&t(n,{children:[e("span",{style:{opacity:.6},children:"value"}),e("span",{style:{textAlign:"right"},children:ze(Number(c))})]}),null!=u&&t(n,{children:[e("span",{style:{opacity:.6},children:"start"}),e("span",{style:{textAlign:"right"},children:We(Fd(u))})]}),null!=d&&t(n,{children:[e("span",{style:{opacity:.6},children:"end"}),e("span",{style:{textAlign:"right"},children:We(Fd(d))})]})]})]})},[Ne,Fe,We,ze,f,p,y,m,v]),Ge=r(()=>{if(!Ne)return null;const{centerlines:n,laneLifetime:o,nodeData:i,valueScale:r,compressedPadding:a,crossingsBefore:s,crossingsAfter:l,lengthBefore:c,lengthAfter:u}=Ne;let d=null,g=null;for(const e of we){const t=o[e.id];if(!t||null===t.start||null===t.end)continue;const n=Be(t.start),i=Be(t.end);(null===d||d>n)&&(d=n),(null===g||i>g)&&(g=i)}const f=e=>Math.max(0,Math.min(Le,e)),p=f(null!=d?d:0),y=Math.max(p,f(null!=g?g:Le));return t("g",{children:[N&&null!==(null!=l?l:null)&&t("text",{x:Le,y:-12,fontSize:10,fill:"#94a3b8",textAnchor:"end",children:["crossings: ",s," → ",l," ","edge length: ",Math.round(c)," → ",Math.round(u)]}),a&&e("text",{x:Le,y:2,fontSize:10,fill:"#94a3b8",textAnchor:"end",children:"dense layout: lane gaps compressed"}),h.map((t,n)=>{const o=Be(Fd(t.date));return p-.5>o||o>y+.5?null:e("line",{x1:o,y1:0,x2:o,y2:Te,stroke:"#94a3b8",strokeOpacity:.15,strokeDasharray:"2 4"},"grid-"+n)}),$&&we.map((a,s)=>{const l=o[a.id];if(!l||null===l.start)return null;const c=i[a.id],u=c?{topPeak:c.topPeak,botPeak:c.botPeak}:{topPeak:0,botPeak:0},d=n[a.id]+(u.botPeak-u.topPeak)*r/2,h=Be(l.start),g=Be(l.end),f=De(a.id,s);return t("g",{children:[e("line",{x1:h,y1:d,x2:g,y2:d,stroke:f,strokeOpacity:.35,strokeWidth:1,strokeDasharray:"3 3"}),e("line",{x1:h,y1:d-4,x2:h,y2:d+4,stroke:f,strokeOpacity:.5}),e("line",{x1:g,y1:d-4,x2:g,y2:d+4,stroke:f,strokeOpacity:.5})]},"lane-"+a.id)}),e("line",{x1:p,y1:Te+4,x2:y,y2:Te+4,stroke:"#94a3b8"}),h.map((n,o)=>{const i=Fd(n.date),r=Be(i);if(p-.5>r||r>y+.5)return null;const a=null!=n.label?n.label:U?U(new Date(i)):"";return t("g",{transform:`translate(${r},${Te+4})`,children:[e("line",{y2:6,stroke:"#94a3b8"}),e("text",{y:20,textAnchor:"middle",fontSize:11,fill:"#475569",children:a})]},o)})]})},[Ne,h,Be,Le,Te,$,we,De,N,U]),qe=r(()=>(null!=pe?pe:[]).map(e=>({id:ke(e),data:e})),[pe,ke]),Xe=r(()=>{const e=new Map;for(const t of Ie.ribbons)t.bezier&&e.set(t.id,t.bezier);return e},[Ie]),Ve=r(()=>(null!=fe?fe:[]).map((e,t)=>{const n=xe(e,t),o=Number(Wd(y,e));return{id:n,source:Wd(f,e)+"",target:Wd(p,e)+"",value:Number.isFinite(o)?o:0,bezier:Xe.get(n),data:e}}),[fe,xe,f,p,y,Xe]),Ue=je.loadingEl,Qe=je.emptyEl;return $e.length>0?t("svg",{width:D,height:E,role:"img","aria-label":null!=R?R:"Process Sankey validation failed",children:[e("text",{x:20,y:30,fontSize:13,fontWeight:600,fill:"var(--semiotic-danger, #dc2626)",children:"ProcessSankey: data invalid"}),$e.map((t,n)=>{return e("text",{x:20,y:56+18*n,fontSize:12,fill:"#64748b",children:"• "+(o=t,"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)},n);var o})]}):Ue||Qe||e(cl,Object.assign({ref:ye,chartType:"force",nodes:qe,edges:Ve,customNetworkLayout:Rd,layoutConfig:Re,size:[D,E],responsiveWidth:z,responsiveHeight:Y,margin:Pe,title:R,description:null!=H?H:"Temporal process flow with lifetime-bounded node lanes, mass bands, and value-scaled ribbons.",summary:F,accessibleTable:W,enableHover:Z,tooltipContent:!1===K?()=>null:Ye,backgroundGraphics:Ge,showParticles:te,particleStyle:ne,legend:He,legendPosition:j,onObservation:J,customClickBehavior:ee?e=>{if(!e||!e.data)return;const t=e.data;Hd(t)&&ee(t.data,{x:e.x,y:e.y})}:void 0,chartId:oe,colorScheme:Array.isArray(O)?O:void 0},ie))});function Yd(t){const n=xc(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{data:o,margin:i,className:a,layout:s="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:S,loading:O,loadingContent:C,legendInteraction:j,stroke:M,strokeWidth:_,opacity:P}=t,{width:L,height:T,enableHover:$,showLabels:N=!0,title:B,description:D,summary:E,accessibleTable:I}=n,R=Od({nodes:r(()=>kd(null!=o?o:null,c),[o,c]),edges:void 0,inferNodes:!1,colorBy:f?void 0:h,colorScheme:g,showLegend:!1,legendInteraction:j,selection:A,linkedHover:S,onObservation:x,onClick:k,chartType:"TreeDiagram",chartId:w,marginDefaults:n.marginDefaults,userMargin:i,width:L,height:T,loading:O,loadingContent:C}),H=r(()=>new Map,[]),F=r(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=f?pt[(e.depth||0)%pt.length]:h?mt(e.data||e,h,R.colorScale):hc(void 0,R.themeCategorical,g,void 0,H),t},[h,f,R.colorScale,R.themeCategorical,g,H]),W=r(()=>Fc(F,{stroke:M,strokeWidth:_,opacity:P}),[F,M,_,P]),z=r(()=>()=>({stroke:"#999",strokeWidth:1,fill:"none"}),[]),Y=r(()=>Fc(z,{stroke:M,strokeWidth:_,opacity:P}),[z,M,_,P]),G=r(()=>{if("treemap"===s||"circlepack"===s||"partition"===s)return Ad(u)},[s,u]),q=Dc({componentName:"TreeDiagram",data:o});return q?e(wc,{componentName:"TreeDiagram",message:q,width:L,height:T}):R.loadingEl?R.loadingEl:e(Cc,{componentName:"TreeDiagram",width:L,height:T,children:e(cl,Object.assign({chartType:s},null!=o&&{data:o},{size:[L,T],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:R.margin,nodeIDAccessor:d,childrenAccessor:c,hierarchySum:G,treeOrientation:l,edgeType:p,nodeStyle:W,edgeStyle:Y,colorBy:h,colorScheme:R.effectivePalette,colorByDepth:f,nodeSize:m,nodeLabel:N?y||d:void 0,showLabels:N,enableHover:$,tooltipContent:!1===v?()=>null:Ui(v)||void 0,customHoverBehavior:S||x||k?R.customHoverBehavior:void 0,customClickBehavior:x||k?R.customClickBehavior:void 0},j&&"none"!==j&&{legendHoverBehavior:R.legendState.onLegendHover,legendClickBehavior:R.legendState.onLegendClick,legendHighlightedCategory:R.legendState.highlightedCategory,legendIsolatedCategories:R.legendState.isolatedCategories},{className:a,title:B,description:D,summary:E,accessibleTable:I},null!=t.animate&&{animate:t.animate},b))})}function Gd(t){const n=xc(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,linkedHover:t.linkedHover},{width:600,height:600}),{data:o,margin:i,className:a,childrenAccessor:s="children",valueAccessor:c="value",nodeIdAccessor:u="name",colorBy:d,colorScheme:h,colorByDepth:g=!1,labelMode:f="leaf",nodeLabel:p,padding:y=4,paddingTop:m,nodeStyle:v,tooltip:b,frameProps:x={},selection:k,linkedHover:w,onObservation:A,onClick:S,chartId:O,loading:C,loadingContent:j,legendInteraction:M,stroke:_,strokeWidth:P,opacity:L}=t,{nodeStyle:T}=x,$=Gc(x,["nodeStyle"]),{width:N,height:B,enableHover:D,showLabels:E=!0,title:I,description:R,summary:H,accessibleTable:F}=n,W=Od({nodes:r(()=>kd(null!=o?o:null,s),[o,s]),edges:void 0,inferNodes:!1,colorBy:g?void 0:d,colorScheme:h,showLegend:!1,legendInteraction:M,selection:k,linkedHover:w,onObservation:A,onClick:S,chartType:"Treemap",chartId:O,marginDefaults:n.marginDefaults,userMargin:i,width:N,height:B,loading:C,loadingContent:j}),z=Ic(k),Y=W.customHoverBehavior,G=l(e=>{if(!e)return Y(null);const t=e.data||e;Y({data:(null==t?void 0:t.data)||t})},[Y]),q=r(()=>new Map,[]),X=r(()=>e=>{const t={stroke:"var(--semiotic-cell-border, var(--semiotic-border, #fff))",strokeWidth:1,strokeOpacity:.8};return t.fill=g?pt[(e.depth||0)%pt.length]:d?mt(e.data||e,d,W.colorScale):hc(void 0,W.themeCategorical,h,void 0,q),t},[d,g,W.colorScale,W.themeCategorical,h,q]),V=r(()=>v||T?e=>{var t,n;return Object.assign(Object.assign(Object.assign({},X(e)),T&&null!==(t=T(e))&&void 0!==t?t:{}),v&&null!==(n=v(e))&&void 0!==n?n:{})}:X,[X,v,T]),U=r(()=>Fc(V,{stroke:_,strokeWidth:P,opacity:L}),[V,_,P,L]),Q=r(()=>W.activeSelectionHook?e=>{var t;const n=Object.assign({},U(e));if(W.activeSelectionHook.isActive)if(W.activeSelectionHook.predicate(e.data||e))(null==z?void 0:z.selectedStyle)&&Object.assign(n,z.selectedStyle);else{const e=null!==(t=null==z?void 0:z.unselectedOpacity)&&void 0!==t?t:.5;n.opacity=e,n.fillOpacity=e,n.strokeOpacity=e,(null==z?void 0:z.unselectedStyle)&&Object.assign(n,z.unselectedStyle)}return n}:U,[U,W.activeSelectionHook,z]),K=r(()=>Ad(c),[c]),Z=void 0!==m?m:!E||"parent"!==f&&"all"!==f?void 0:18,J=Dc({componentName:"Treemap",data:o});return J?e(wc,{componentName:"Treemap",message:J,width:N,height:B}):W.loadingEl?W.loadingEl:e(Cc,{componentName:"Treemap",width:N,height:B,children:e(cl,Object.assign({chartType:"treemap"},null!=o&&{data:o},{size:[N,B],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:W.margin,nodeIDAccessor:u,childrenAccessor:s,hierarchySum:K,padding:y,paddingTop:Z,nodeStyle:Q,colorBy:d,colorScheme:W.effectivePalette,colorByDepth:g,nodeLabel:E?p||u:void 0,showLabels:E,labelMode:f,enableHover:D,tooltipContent:!1===b?()=>null:Ui(b)||void 0},(w||A||S)&&{customHoverBehavior:G},(A||S)&&{customClickBehavior:W.customClickBehavior},M&&"none"!==M&&{legendHoverBehavior:W.legendState.onLegendHover,legendClickBehavior:W.legendState.onLegendClick,legendHighlightedCategory:W.legendState.highlightedCategory,legendIsolatedCategories:W.legendState.isolatedCategories},{className:a,title:I,description:R,summary:H,accessibleTable:F},null!=t.animate&&{animate:t.animate},$))})}function qd(t){const n=xc(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{data:o,margin:i,className:a,childrenAccessor:s="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:S,legendInteraction:O,stroke:C,strokeWidth:j,opacity:M}=t,{width:_,height:P,enableHover:L,showLabels:T=!0,title:$,description:N,summary:B,accessibleTable:D}=n,E=Od({nodes:r(()=>kd(null!=o?o:null,s),[o,s]),edges:void 0,inferNodes:!1,colorBy:h?void 0:u,colorScheme:d,showLegend:!1,legendInteraction:O,selection:k,linkedHover:w,onObservation:v,onClick:b,chartType:"CirclePack",chartId:x,marginDefaults:n.marginDefaults,userMargin:i,width:_,height:P,loading:A,loadingContent:S}),I=r(()=>new Map,[]),R=r(()=>e=>{const t={stroke:"currentColor",strokeWidth:1,strokeOpacity:.3,fillOpacity:f};return t.fill=h?pt[(e.depth||0)%pt.length]:u?mt(e.data||e,u,E.colorScale):hc(void 0,E.themeCategorical,d,void 0,I),t},[u,h,E.colorScale,f,E.themeCategorical,d,I]),H=r(()=>Fc(R,{stroke:C,strokeWidth:j,opacity:M}),[R,C,j,M]),F=r(()=>Ad(l),[l]),W=Dc({componentName:"CirclePack",data:o});return W?e(wc,{componentName:"CirclePack",message:W,width:_,height:P}):E.loadingEl?E.loadingEl:e(Cc,{componentName:"CirclePack",width:_,height:P,children:e(cl,Object.assign({chartType:"circlepack"},null!=o&&{data:o},{size:[_,P],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:E.margin,nodeIDAccessor:c,childrenAccessor:s,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:Ui(y)||void 0,customHoverBehavior:w||v||b?E.customHoverBehavior:void 0,customClickBehavior:v||b?E.customClickBehavior:void 0},O&&"none"!==O&&{legendHoverBehavior:E.legendState.onLegendHover,legendClickBehavior:E.legendState.onLegendClick,legendHighlightedCategory:E.legendState.highlightedCategory,legendIsolatedCategories:E.legendState.isolatedCategories},{className:a,title:$,description:N,summary:B,accessibleTable:D},null!=t.animate&&{animate:t.animate},m))})}zd.displayName="ProcessSankey",Yd.displayName="TreeDiagram",Gd.displayName="Treemap",qd.displayName="CirclePack";const Xd=pt;function Vd(t){const n=xc(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{data:o,margin:i,className:a,childrenAccessor:s="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:S,frameProps:O={},onObservation:C,onClick:j,chartId:M,selection:_,linkedHover:P,loading:L,loadingContent:T,stroke:$,strokeWidth:N,opacity:B}=t,{width:D,height:E,enableHover:I,title:R,description:H,summary:F,accessibleTable:W}=n,z=Od({nodes:r(()=>kd(o,s),[o,s]),edges:void 0,inferNodes:!1,colorBy:d?void 0:c,colorScheme:u,showLegend:!1,legendInteraction:void 0,selection:_,linkedHover:P,onObservation:C,onClick:j,chartType:"OrbitDiagram",chartId:M,marginDefaults:{top:10,right:10,bottom:10,left:10},userMargin:i,width:D,height:E,loading:L,loadingContent:T}),Y=r(()=>new Map,[]),{colorScale:G,customClickBehavior:q,customHoverBehavior:X,themeCategorical:V}=z,U=r(()=>{if(Array.isArray(u))return u;const e=ht[u];return Array.isArray(e)?e:gt},[u]),Q=r(()=>e=>{var t;const n={stroke:"#fff",strokeWidth:1},o=0===(null!==(t=e.depth)&&void 0!==t?t:0);return n.fill=d?o?U[0]:Xd[(e.depth||0)%Xd.length]:c?mt(e.data||e,c,G):hc(void 0,V,u,void 0,Y),n.opacity=o?1:.85,n},[c,d,G,U,V,u,Y]),K=r(()=>Fc(Q,{stroke:$,strokeWidth:N,opacity:B}),[Q,$,N,B]),Z=r(()=>()=>({stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1}),[]),J=r(()=>{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=r(()=>{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=Dc({componentName:"OrbitDiagram",data:o});return te?e(wc,{componentName:"OrbitDiagram",message:te,width:D,height:E}):z.loadingEl?z.loadingEl:e(Cc,{componentName:"OrbitDiagram",width:D,height:E,children:e(cl,Object.assign({chartType:"orbit"},null!=o&&{data:o},{size:[D,E],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:z.margin,nodeIDAccessor:l,childrenAccessor:s,nodeStyle:K,edgeStyle:Z,colorBy:c,colorScheme:z.effectivePalette,colorByDepth:d,nodeSize:b,nodeLabel:x?l:void 0,showLabels:x,enableHover:!k&&I,tooltipContent:k?void 0:!1===w?()=>null:Ui(w)||void 0,customHoverBehavior:P||C||j?J:void 0,customClickBehavior:C||j?ee:void 0,foregroundGraphics:A,annotations:S,className:a,title:R,description:H,summary:F,orbitMode:h,orbitSize:g,orbitSpeed:f,orbitRevolution:p,orbitRevolutionStyle:y,orbitEccentricity:m,orbitShowRings:v,orbitAnimated:k,accessibleTable:W},null!=t.animate&&{animate:t.animate},O))})}Vd.displayName="OrbitDiagram";const Ud={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"},Qd={opacity:.7,marginRight:4};function Kd(e,t,n){if(null!=e)return"function"==typeof t?t(e):e["string"==typeof t?t:n]}function Zd(e){return null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+""}function Jd(e={}){const{timeAccessor:n,valueAccessor:o,xLabel:i="x",yLabel:r="y"}=e;return e=>{var a;const s=null!==(a=null==e?void 0:e.data)&&void 0!==a?a:null,l=Kd(s,n,"time"),c=Kd(s,o,"value");return t("div",{className:"semiotic-tooltip",style:Ud,children:[t("div",{children:[t("span",{style:Qd,children:[i,":"]}),Zd(l)]}),t("div",{children:[t("span",{style:Qd,children:[r,":"]}),Zd(c)]})]})}}function eh(e,t){var n;return null!=e?e:Math.max(null!==(n=null==t?void 0:t.length)&&void 0!==n?n:0,200)}const th=g(function(t,n){var o,r,a,s,c;const u=xc(t.mode,{width:null!==(r=null===(o=t.size)||void 0===o?void 0:o[0])&&void 0!==r?r:t.width,height:null!==(s=null===(a=t.size)||void 0===a?void 0:a[1])&&void 0!==s?s:t.height,enableHover:null!=t.enableHover?!!t.enableHover:void 0}),{size:d,margin:h,className:g,arrowOfTime:f="right",windowMode:y="sliding",windowSize:m,data:v,timeAccessor:b,valueAccessor:x,timeExtent:k,valueExtent:w,extentPadding:A,stroke:S="#007bff",strokeWidth:O=2,strokeDasharray:C,opacity:j,background:M,tooltipContent:_,tooltip:P,onHover:L,annotations:T,autoPlaceAnnotations:$,svgAnnotationRules:N,tickFormatTime:B,tickFormatValue:D,decay:E,pulse:I,staleness:R,transition:H,linkedHover:F,selection:W,onObservation:z,chartId:Y,loading:G,loadingContent:q,emptyContent:X,emphasis:V,legendPosition:U}=t,Q=u.showAxes,K=u.enableHover,Z=null!=h?h:u.marginDefaults,J=null!=d?d:[u.width,u.height],ee=null!==(c=null!=_?_:P)&&void 0!==c?c:Jd({timeAccessor:b,valueAccessor:x}),te=i(null),{customHoverBehavior:ne}=pc({selection:W,linkedHover:F,unwrapData:!0,onObservation:z,chartType:"RealtimeLineChart",chartId:Y}),oe=l(e=>{L&&L(e),ne(e)},[L,ne]);p(n,()=>({push:e=>{var t;return null===(t=te.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=te.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=te.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=te.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=te.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=te.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=te.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[]);const ie=Pc(G,J[0],J[1],q),re=ie?null:_c(v,J[0],J[1],X),ae={stroke:S,strokeWidth:O,strokeDasharray:C};null!=j&&(ae.opacity=j);const se=eh(m,v);return ie||re||e(Nr,{ref:te,chartType:"line",runtimeMode:"streaming",size:J,margin:Z,className:V?`${g||""} semiotic-emphasis-${V}`.trim():g,arrowOfTime:f,windowMode:y,windowSize:se,data:v,timeAccessor:b,valueAccessor:x,xExtent:k,yExtent:w,extentPadding:A,lineStyle:ae,showAxes:Q,background:M,hoverAnnotation:K,tooltipContent:ee,customHoverBehavior:oe,annotations:T,autoPlaceAnnotations:$,svgAnnotationRules:N,tickFormatTime:B,tickFormatValue:D,decay:E,pulse:I,staleness:R,transition:H,pointIdAccessor:t.pointIdAccessor,legendPosition:U})});function nh(e,t,n){const o="function"==typeof t?t(e):e[null!=t?t:n];if(null==o)return null;if(o instanceof Date)return o.getTime();if("string"==typeof o&&""===o.trim())return null;const i=Number(o);return Number.isFinite(i)?i:null}th.displayName="RealtimeLineChart";const oh=g(function(n,o){var a,s,c,u,d;const h=xc(n.mode,{width:null!==(s=null===(a=n.size)||void 0===a?void 0:a[0])&&void 0!==s?s:n.width,height:null!==(u=null===(c=n.size)||void 0===c?void 0:c[1])&&void 0!==u?u:n.height,showAxes:n.showAxes,enableHover:null!=n.enableHover?!!n.enableHover:void 0,linkedHover:n.linkedHover}),{binSize:g,size:f,margin:y,className:m,arrowOfTime:v="right",windowMode:b="sliding",windowSize:x,data:k,timeAccessor:w,valueAccessor:A,direction:S="up",timeExtent:O,valueExtent:C,extentPadding:j,categoryAccessor:M,colors:_,fill:P,stroke:L,strokeWidth:T,opacity:$,gap:N,background:B,tooltipContent:D,tooltip:E,onHover:I,annotations:R,autoPlaceAnnotations:H,svgAnnotationRules:F,tickFormatTime:W,tickFormatValue:z,linkedHover:Y,selection:G,decay:q,pulse:X,staleness:V,transition:U,onObservation:Q,chartId:K,loading:Z,loadingContent:J,emptyContent:ee,emphasis:te,legendPosition:ne,brush:oe,onBrush:ie,linkedBrush:re}=n,ae=h.showAxes,se=h.enableHover,le=null!=y?y:h.marginDefaults,ce=null!=f?f:[h.width,h.height],ue=null!==(d=null!=D?D:E)&&void 0!==d?d:function(n={}){const{timeAccessor:o,valueAccessor:i}=n;return n=>{var r;const a=null!==(r=null==n?void 0:n.data)&&void 0!==r?r:null;if(null==(null==a?void 0:a.binStart)||null==(null==a?void 0:a.binEnd)){const n=Kd(a,o,"time"),r=Kd(a,i,"value");return t("div",{className:"semiotic-tooltip",style:Ud,children:[t("div",{children:[e("span",{style:Qd,children:"x:"}),Zd(n)]}),t("div",{children:[e("span",{style:Qd,children:"y:"}),Zd(r)]})]})}return t("div",{className:"semiotic-tooltip",style:Ud,children:[t("div",{children:[e("span",{style:Qd,children:"range:"}),Zd(a.binStart),"–",Zd(a.binEnd)]}),null!=a.total&&t("div",{children:[e("span",{style:Qd,children:"count:"}),Zd(a.total)]}),null!=a.category&&t("div",{children:[e("span",{style:Qd,children:"category:"}),Zd(a.category)]})]})}}({timeAccessor:w,valueAccessor:A}),de=i(null),{customHoverBehavior:he}=pc({selection:G,linkedHover:Y,unwrapData:!0,onObservation:Q,chartType:"RealtimeHistogram",chartId:K}),ge=l(e=>{I&&I(e),he(e)},[I,he]),fe=!0===oe?{dimension:"x",snap:"bin"}:"x"===oe?{dimension:"x"}:"object"==typeof oe?oe:void 0,pe=Xl(re),ye=Nl(Object.assign({name:(null==pe?void 0:pe.name)||"__unused_hist_brush__",xField:(null==pe?void 0:pe.xField)||("string"==typeof w?w:"time")},(null==pe?void 0:pe.yField)?{yField:pe.yField}:{})),me=i(ye.brushInteraction);me.current=ye.brushInteraction;const ve=l(e=>{if(ie&&ie(e),Q&&Q(e?{type:"brush",extent:e,timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:K}:{type:"brush-end",timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:K}),pe){const t=me.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)}},[ie,Q,K,pe]);p(o,()=>({push:e=>{var t;return null===(t=de.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=de.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=de.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=de.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=de.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=de.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=de.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[]);const be=Pc(Z,ce[0],ce[1],J),xe=be?null:_c(k,ce[0],ce[1],ee),ke={};null!=P&&(ke.fill=P),null!=L&&(ke.stroke=L),null!=T&&(ke.strokeWidth=T),null!=$&&(ke.opacity=$),null!=N&&(ke.gap=N);const we=te?`${m||""} semiotic-emphasis-${te}`.trim():m,Ae=eh(x,k),Se=r(()=>"down"!==S?C:function({data:e,valueAccessor:t,timeAccessor:n,binSize:o,valueExtent:i,extentPadding:r}){var a;if(i)return[i[1],i[0]];if(!e||0===e.length)return;const s=new Map;for(const i of e){const e=nh(i,n,"time"),r=nh(i,t,"value");if(null==e||null==r)continue;const l=Math.floor(e/o)*o;s.set(l,(null!==(a=s.get(l))&&void 0!==a?a:0)+r)}let l=0;for(const e of s.values())e>l&&(l=e);return[l>0?l+l*(null!=r?r:.1):1,0]}({data:k,valueAccessor:A,timeAccessor:w,binSize:g,valueExtent:C,extentPadding:j}),[S,k,A,w,g,C,j]);return be||xe||e(Nr,{ref:de,chartType:"bar",runtimeMode:"streaming",size:ce,margin:le,className:we,arrowOfTime:v,windowMode:b,windowSize:Ae,data:k,timeAccessor:w,valueAccessor:A,xExtent:O,yExtent:Se,extentPadding:j,binSize:g,categoryAccessor:M,barColors:_,barStyle:ke,showAxes:ae,background:B,hoverAnnotation:se,tooltipContent:ue,customHoverBehavior:ge,annotations:R,autoPlaceAnnotations:H,svgAnnotationRules:F,tickFormatTime:W,tickFormatValue:z,decay:q,pulse:X,staleness:V,transition:U,pointIdAccessor:n.pointIdAccessor,legendPosition:ne,brush:fe||(re?{dimension:"x"}:void 0),onBrush:fe||re?ve:void 0})});function ih(t){return e(oh,Object.assign({},t,{windowMode:"growing"}))}oh.displayName="RealtimeHistogram",ih.displayName="TemporalHistogram";const rh=oh,ah=g(function(t,n){var o,r,a,s,c;const u=xc(t.mode,{width:null!==(r=null===(o=t.size)||void 0===o?void 0:o[0])&&void 0!==r?r:t.width,height:null!==(s=null===(a=t.size)||void 0===a?void 0:a[1])&&void 0!==s?s:t.height,enableHover:null!=t.enableHover?!!t.enableHover:void 0}),{size:d,margin:h,className:g,arrowOfTime:f="right",windowMode:y="sliding",windowSize:m,data:v,timeAccessor:b,valueAccessor:x,timeExtent:k,valueExtent:w,extentPadding:A,categoryAccessor:S,colors:O,radius:C,fill:j,opacity:M,stroke:_,strokeWidth:P,background:L,tooltipContent:T,tooltip:$,onHover:N,annotations:B,autoPlaceAnnotations:D,svgAnnotationRules:E,tickFormatTime:I,tickFormatValue:R,linkedHover:H,selection:F,onObservation:W,chartId:z,loading:Y,loadingContent:G,emptyContent:q,emphasis:X,legendPosition:V}=t,U=u.showAxes,Q=u.enableHover,K=null!=h?h:u.marginDefaults,Z=null!=d?d:[u.width,u.height],J=null!==(c=null!=T?T:$)&&void 0!==c?c:Jd({timeAccessor:b,valueAccessor:x}),ee=i(null),{customHoverBehavior:te}=pc({selection:F,linkedHover:H,unwrapData:!0,onObservation:W,chartType:"RealtimeSwarmChart",chartId:z}),ne=l(e=>{N&&N(e),te(e)},[N,te]);p(n,()=>({push:e=>{var t;return null===(t=ee.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=ee.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=ee.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=ee.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=ee.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=ee.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=ee.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[]);const oe=Pc(Y,Z[0],Z[1],G),ie=oe?null:_c(v,Z[0],Z[1],q),re={};null!=C&&(re.radius=C),null!=j&&(re.fill=j),null!=M&&(re.opacity=M),null!=_&&(re.stroke=_),null!=P&&(re.strokeWidth=P);const ae=X?`${g||""} semiotic-emphasis-${X}`.trim():g,se=eh(m,v);return oe||ie||e(Nr,{ref:ee,chartType:"swarm",runtimeMode:"streaming",size:Z,margin:K,className:ae,arrowOfTime:f,windowMode:y,windowSize:se,data:v,timeAccessor:b,valueAccessor:x,xExtent:k,yExtent:w,extentPadding:A,categoryAccessor:S,barColors:O,swarmStyle:re,showAxes:U,background:L,hoverAnnotation:Q,tooltipContent:J,customHoverBehavior:ne,annotations:B,autoPlaceAnnotations:D,svgAnnotationRules:E,tickFormatTime:I,tickFormatValue:R,legendPosition:V,pointIdAccessor:t.pointIdAccessor})});ah.displayName="RealtimeSwarmChart";const sh=g(function(n,o){var r,a,s,c,u;const d=xc(n.mode,{width:null!==(a=null===(r=n.size)||void 0===r?void 0:r[0])&&void 0!==a?a:n.width,height:null!==(c=null===(s=n.size)||void 0===s?void 0:s[1])&&void 0!==c?c:n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0}),{size:h,margin:g,className:f,arrowOfTime:y="right",windowMode:m="sliding",windowSize:v,data:b,timeAccessor:x,valueAccessor:k,timeExtent:w,valueExtent:A,extentPadding:S,positiveColor:O,negativeColor:C,connectorStroke:j,connectorWidth:M,gap:_,stroke:P,strokeWidth:L,opacity:T,background:$,tooltipContent:N,tooltip:B,onHover:D,annotations:E,autoPlaceAnnotations:I,svgAnnotationRules:R,tickFormatTime:H,tickFormatValue:F,linkedHover:W,selection:z,onObservation:Y,chartId:G,loading:q,loadingContent:X,emptyContent:V,emphasis:U,legendPosition:Q}=n,K=d.showAxes,Z=d.enableHover,J=null!=g?g:d.marginDefaults,ee=null!=h?h:[d.width,d.height],te=null!==(u=null!=N?N:B)&&void 0!==u?u:function(n={}){const{timeAccessor:o,valueAccessor:i}=n;return n=>{var r,a;const s=null!==(r=null==n?void 0:n.data)&&void 0!==r?r:null,l=Kd(s,o,"time"),c=null!==(a=null==s?void 0:s.delta)&&void 0!==a?a:Kd(s,i,"value"),u=null==s?void 0:s.cumEnd,d="number"==typeof c?0>c?Zd(c):"+"+Zd(c):Zd(c);return t("div",{className:"semiotic-tooltip",style:Ud,children:[t("div",{children:[e("span",{style:Qd,children:"x:"}),Zd(l)]}),t("div",{children:[e("span",{style:Qd,children:"Δ:"}),d]}),null!=u&&t("div",{children:[e("span",{style:Qd,children:"total:"}),Zd(u)]})]})}}({timeAccessor:x,valueAccessor:k}),ne=i(null),{customHoverBehavior:oe}=pc({selection:z,linkedHover:W,unwrapData:!0,onObservation:Y,chartType:"RealtimeWaterfallChart",chartId:G}),ie=l(e=>{D&&D(e),oe(e)},[D,oe]);p(o,()=>({push:e=>{var t;return null===(t=ne.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=ne.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=ne.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=ne.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=ne.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=ne.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=ne.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[]);const re=Pc(q,ee[0],ee[1],X),ae=re?null:_c(b,ee[0],ee[1],V),se={};null!=O&&(se.positiveColor=O),null!=C&&(se.negativeColor=C),null!=j&&(se.connectorStroke=j),null!=M&&(se.connectorWidth=M),null!=_&&(se.gap=_),null!=P&&(se.stroke=P),null!=L&&(se.strokeWidth=L),null!=T&&(se.opacity=T);const le=U?`${f||""} semiotic-emphasis-${U}`.trim():f,ce=eh(v,b);return re||ae||e(Nr,{ref:ne,chartType:"waterfall",runtimeMode:"streaming",size:ee,margin:J,className:le,arrowOfTime:y,windowMode:m,windowSize:ce,data:b,timeAccessor:x,valueAccessor:k,xExtent:w,yExtent:A,extentPadding:S,waterfallStyle:se,showAxes:K,background:$,hoverAnnotation:Z,tooltipContent:te,customHoverBehavior:ie,annotations:E,autoPlaceAnnotations:I,svgAnnotationRules:R,tickFormatTime:H,tickFormatValue:F,legendPosition:Q,pointIdAccessor:n.pointIdAccessor})});sh.displayName="RealtimeWaterfallChart";const lh=g(function(n,o){var r,a,s,c,u;const d=xc(n.mode,{width:null!==(a=null===(r=n.size)||void 0===r?void 0:r[0])&&void 0!==a?a:n.width,height:null!==(c=null===(s=n.size)||void 0===s?void 0:s[1])&&void 0!==c?c:n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0}),{size:h,margin:g,className:f,arrowOfTime:y="right",windowMode:m="sliding",windowSize:v,data:b,timeAccessor:x,valueAccessor:k,categoryAccessor:w,timeExtent:A,valueExtent:S,extentPadding:O,heatmapXBins:C=20,heatmapYBins:j=20,aggregation:M="count",background:_,tooltipContent:P,tooltip:L,onHover:T,annotations:$,autoPlaceAnnotations:N,svgAnnotationRules:B,tickFormatTime:D,tickFormatValue:E,decay:I,pulse:R,staleness:H,linkedHover:F,selection:W,onObservation:z,chartId:Y,loading:G,loadingContent:q,emptyContent:X,emphasis:V,legendPosition:U}=n,Q=d.showAxes,K=d.enableHover,Z=null!=g?g:d.marginDefaults,J=null!=h?h:[d.width,d.height],ee=null!==(u=null!=P?P:L)&&void 0!==u?u:function(n={}){const{timeAccessor:o,valueAccessor:i,xLabel:r="x",yLabel:a="y"}=n;return n=>{var s,l,c,u;const d=null!==(s=null==n?void 0:n.data)&&void 0!==s?s:null,h=null!==(l=null==d?void 0:d.xCenter)&&void 0!==l?l:Kd(d,o,"time"),g=null!==(c=null==d?void 0:d.yCenter)&&void 0!==c?c:Kd(d,i,"value"),f=null==d?void 0:d.count,p=null==d?void 0:d.sum,y=null==d?void 0:d.value,m=null!==(u=null==d?void 0:d.agg)&&void 0!==u?u:"count";return t("div",{className:"semiotic-tooltip",style:Ud,children:[t("div",{children:[t("span",{style:Qd,children:[r,":"]}),Zd(h)]}),t("div",{children:[t("span",{style:Qd,children:[a,":"]}),Zd(g)]}),null!=f&&t("div",{children:[e("span",{style:Qd,children:"count:"}),Zd(f)]}),"sum"===m&&null!=p&&t("div",{children:[e("span",{style:Qd,children:"sum:"}),Zd(p)]}),"mean"===m&&null!=y&&t("div",{children:[e("span",{style:Qd,children:"mean:"}),Zd(y)]})]})}}({timeAccessor:x,valueAccessor:k}),te=i(null),{customHoverBehavior:ne}=pc({selection:W,linkedHover:F,unwrapData:!0,onObservation:z,chartType:"RealtimeHeatmap",chartId:Y}),oe=l(e=>{T&&T(e),ne(e)},[T,ne]);p(o,()=>({push:e=>{var t;return null===(t=te.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=te.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=te.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=te.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=te.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=te.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=te.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[]);const ie=Pc(G,J[0],J[1],q),re=ie?null:_c(b,J[0],J[1],X),ae=V?`${f||""} semiotic-emphasis-${V}`.trim():f,se=eh(v,b);return ie||re||e(Nr,{ref:te,chartType:"heatmap",runtimeMode:"streaming",size:J,margin:Z,className:ae,arrowOfTime:y,windowMode:m,windowSize:se,data:b,timeAccessor:x,valueAccessor:k,categoryAccessor:w,xExtent:A,yExtent:S,extentPadding:O,heatmapXBins:C,heatmapYBins:j,heatmapAggregation:M,showAxes:Q,background:_,hoverAnnotation:K,tooltipContent:ee,customHoverBehavior:oe,annotations:$,autoPlaceAnnotations:N,svgAnnotationRules:B,tickFormatTime:D,tickFormatValue:E,decay:I,pulse:R,staleness:H,legendPosition:U,pointIdAccessor:n.pointIdAccessor})});function ch(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)),n=Math.abs(t);return 1e9>n?1e6>n?1e4>n?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"}lh.displayName="RealtimeHeatmap";const uh=864e5;function dh(e){return 10>e?"0"+e:e+""}const hh=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function gh(e){let t,n=e;return(o,i,r)=>{const a=o instanceof Date?o:new Date(o);e||!r||2>r.length||r===t||(t=r,n=function(e){if(2>e.length)return"days";const t=[];for(let n=1;e.length>n;n++)t.push(e[n]-e[n-1]);t.sort((e,t)=>e-t);const n=t[Math.floor(t.length/2)];return 12e4>n?"seconds":72e5>n?"minutes":2*uh>n?"hours":60*uh>n?"days":400*uh>n?"months":"years"}(r));const s=n||"days";return null!=i&&0!==i&&r&&0!==r.length?function(e,t,n){const o=e.getUTCFullYear()!==t.getUTCFullYear(),i=o||e.getUTCMonth()!==t.getUTCMonth(),r=i||e.getUTCDate()!==t.getUTCDate(),a=r||e.getUTCHours()!==t.getUTCHours(),s=a||e.getUTCMinutes()!==t.getUTCMinutes(),l=hh[e.getUTCMonth()],c=e.getUTCDate(),u=e.getUTCFullYear(),d=dh(e.getUTCHours()),h=dh(e.getUTCMinutes()),g=dh(e.getUTCSeconds());switch(n){case"seconds":return o?`${l} ${c}, ${u} ${d}:${h}:${g}`:r?`${l} ${c} ${d}:${h}:${g}`:a?`${d}:${h}:${g}`:s?`${h}:${g}`:":"+g;case"minutes":return o?`${l} ${c}, ${u} ${d}:${h}`:r?`${l} ${c} ${d}:${h}`:a?`${d}:${h}`:":"+h;case"hours":return o?`${l} ${c}, ${u} ${d}:00`:i?`${l} ${c} ${d}:${h}`:r?`${l} ${c} ${d}:00`:d+":00";case"days":return o?`${l} ${c}, ${u}`:i?`${l} ${c}`:""+c;case"months":return o?`${l} ${u}`:""+l;case"years":return""+u}}(a,new Date(r[i-1]),s):function(e,t){const n=hh[e.getUTCMonth()],o=e.getUTCDate(),i=e.getUTCFullYear(),r=dh(e.getUTCHours()),a=dh(e.getUTCMinutes()),s=dh(e.getUTCSeconds());switch(t){case"seconds":return`${n} ${o}, ${i} ${r}:${a}:${s}`;case"minutes":case"hours":return`${n} ${o}, ${i} ${r}:${a}`;case"days":return`${n} ${o}, ${i}`;case"months":return`${n} ${i}`;case"years":return""+i}}(a,s)}}function fh(e,t=.5){const n=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!n)return e;const o=Math.round(parseInt(n[1],16)*(1-t)),i=Math.round(parseInt(n[2],16)*(1-t)),r=Math.round(parseInt(n[3],16)*(1-t));return`#${o.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}`}function ph(e,t=.5){const n=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!n)return e;const o=Math.round(parseInt(n[1],16)+(255-parseInt(n[1],16))*t),i=Math.round(parseInt(n[2],16)+(255-parseInt(n[2],16))*t),r=Math.round(parseInt(n[3],16)+(255-parseInt(n[3],16))*t);return`#${o.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}`}function yh(e,t){return qc(this,void 0,void 0,function*(){const{format:n="png",filename:o="chart",scale:i=2,background:r="white"}=t||{},a=e.querySelector("svg");if(!a)throw Error("No SVG element found in the container");const s=a.cloneNode(!0),l=a.getBoundingClientRect();if(s.getAttribute("width")||s.setAttribute("width",l.width+""),s.getAttribute("height")||s.setAttribute("height",l.height+""),s.getAttribute("xmlns")||s.setAttribute("xmlns","http://www.w3.org/2000/svg"),mh(a,s),"svg"===n){const e=(new XMLSerializer).serializeToString(s);vh(new Blob([e],{type:"image/svg+xml;charset=utf-8"}),o+".svg")}else{const t=l.width*i,n=l.height*i,a=document.createElement("canvas");a.width=t,a.height=n;const c=a.getContext("2d");c.fillStyle=r,c.fillRect(0,0,t,n),c.scale(i,i);const u=e.querySelector("canvas");u&&c.drawImage(u,0,0,l.width,l.height);const d=(new XMLSerializer).serializeToString(s),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),a.toBlob(n=>{n?(vh(n,o+".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 mh(e,t){var n;const o=e.children,i=t.children,r=window.getComputedStyle(e),a=["fill","stroke","stroke-width","stroke-dasharray","opacity","fill-opacity","stroke-opacity","font-family","font-size","font-weight","text-anchor","dominant-baseline"];for(const e of a){const o=r.getPropertyValue(e);o&&"none"!==o&&""!==o&&(null===(n=t.style)||void 0===n||n.setProperty(e,o))}for(let e=0;Math.min(o.length,i.length)>e;e++)mh(o[e],i[e])}function vh(e,t){const n=URL.createObjectURL(e),o=document.createElement("a");o.href=n,o.download=t,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(n)}const bh={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"}},xh={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},kh={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"},categoryFormat:{type:"function"}},wh=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],Ah=["vertical","horizontal"],Sh={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},bh),xh),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:wh},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({},bh),xh),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:wh},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({},bh),xh),{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:wh},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({},bh),xh),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:wh},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({},bh),xh),{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({},bh),xh),{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({},bh),xh),{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({},bh),xh),{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({},bh),xh),{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({},bh),xh),{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({},bh),xh),{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({},bh),kh),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Ah},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({},bh),kh),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Ah},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({},bh),kh),{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:Ah},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},bh),kh),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Ah},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({},bh),kh),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Ah},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({},bh),kh),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Ah},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},bh),kh),{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({},bh),kh),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Ah},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({},bh),kh),{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({},bh),kh),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Ah},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({},bh),{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({},bh),{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({},bh),{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({},bh),kh),{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({},bh),kh),{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({},bh),{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({},bh),{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:Ah},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({},bh),{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({},bh),{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({},bh),{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({},bh),{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({},bh),{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({},bh),{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({},bh),{data:{type:"array"},fields:{type:"array"}})},MinimapChart:{required:["data"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},bh),{data:{type:"array"}})},ChoroplethMap:{required:["areas"],dataShape:"array",dataAccessors:["valueAccessor"],props:Object.assign(Object.assign({},bh),{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({},bh),{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({},bh),{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({},bh),{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"}}}},Oh=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"]),Ch=new Set(["data","nodes","edges"]),jh="function"==typeof structuredClone?structuredClone:e=>JSON.parse(JSON.stringify(e));function Mh(e,t,n){if(!Sh[e])throw Error(`Unknown component "${e}". Known components: ${Object.keys(Sh).join(", ")}`);const o=!1!==(null==n?void 0:n.includeData),i={};for(const[e,n]of Object.entries(t))null!=n&&(Oh.has(e)||!o&&Ch.has(e)||"function"!=typeof n&&((null==n?void 0:n.$$typeof)||(i[e]=jh(n))));return Object.assign({component:e,props:i,version:"1",createdAt:(new Date).toISOString()},(null==n?void 0:n.selections)?{selections:n.selections}:{})}function _h(e){if(!e.component||!e.props)throw Error("Invalid chart config: missing component or props");if(!Sh[e.component])throw Error(`Unknown component "${e.component}". This config may require a newer version of semiotic.`);return{componentName:e.component,props:jh(e.props)}}function Ph(e){const t=JSON.stringify(e);return"sc="+btoa(unescape(encodeURIComponent(t))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Lh(e){const t=new URLSearchParams(e.includes("?")?e.split("?")[1]:e).get("sc");if(!t)throw Error("No chart config found in URL (missing 'sc' parameter)");const n=t.replace(/-/g,"+").replace(/_/g,"/"),o=decodeURIComponent(escape(atob(n)));return JSON.parse(o)}function Th(e){return qc(this,arguments,void 0,function*(e,t="json"){const n="jsx"===t?$h(e):JSON.stringify(e,null,2);if("undefined"==typeof navigator||!navigator.clipboard)throw Error("Clipboard API not available. copyConfig requires a browser environment.");yield navigator.clipboard.writeText(n)})}function $h(e){const{component:t,props:n}=e,o=["<"+t];for(const[e,t]of Object.entries(n))if("string"==typeof t)o.push(` ${e}="${t}"`);else if("boolean"==typeof t&&!0===t)o.push(" "+e);else if("boolean"==typeof t&&!1===t)o.push(` ${e}={false}`);else if("number"==typeof t)o.push(` ${e}={${t}}`);else{const n=JSON.stringify(t);o.push(80>n.length?` ${e}={${n}}`:` ${e}={${JSON.stringify(t,null,2)}}`)}return o.push("/>"),o.join("\n")}function Nh(e){const t={};for(const[n,o]of e){const e=[];for(const[,t]of o.clauses){const n={};for(const[e,o]of Object.entries(t.fields))n[e]="point"===o.type?{type:"point",values:Array.from(o.values)}:{type:"interval",range:o.range};e.push({clientId:t.clientId,type:t.type,fields:n})}t[n]={name:o.name,resolution:o.resolution,clauses:e}}return t}function Bh(e){const t=new Map;for(const[n,o]of Object.entries(e)){const e=new Map;for(const t of o.clauses){const n={};for(const[e,o]of Object.entries(t.fields))n[e]="point"===o.type?{type:"point",values:new Set(o.values)}:{type:"interval",range:o.range};e.set(t.clientId,{clientId:t.clientId,type:t.type,fields:n})}t.set(n,{name:o.name,resolution:o.resolution,clauses:e})}return t}function Dh(e){return"nominal"===e||"ordinal"===e}function Eh(e){return"quantitative"===e||"temporal"===e}const Ih={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"},Rh={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"},Hh={sum:"sum",mean:"mean",average:"mean",count:"count",min:"min",max:"max",median:"mean"};function Fh(e){var t,n,o,i,r,a,s,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:Gc(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===(n=e.data)||void 0===n?void 0:n.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 S={};e.width&&(S.width=e.width),e.height&&(S.height=e.height);const O=function(e){if(e)return"string"==typeof e?e:e.text}(e.title);if(O&&(S.title=O),(null==b?void 0:b.field)&&(S.colorBy=b.field,null===(o=b.scale)||void 0===o?void 0:o.scheme)){const e=Ih[b.scale.scheme];e&&(S.colorScheme=e)}void 0!==(null==w?void 0:w.value)&&(S.pointOpacity=w.value);const C=null==m?void 0:m.aggregate,j=null==v?void 0:v.aggregate;if(A&&(C||j)){const e=j?v:m,t=j?m:v,n=Hh[e.aggregate];if(n&&(null==t?void 0:t.field)&&e.field)A=function(e,t){const{groupBy:n,value:o,agg:i="sum"}=t,r=new Map;for(const t of e){const e=t[n]+"";r.has(e)||r.set(e,[]),r.get(e).push(Number(t[o]))}const a=[];for(const[e,t]of r){let o;switch(i){case"count":o=t.length;break;case"mean":o=t.reduce((e,t)=>e+t,0)/t.length;break;case"min":o=Math.min(...t);break;case"max":o=Math.max(...t);break;default:o=t.reduce((e,t)=>e+t,0)}a.push({[n]:e,value:o})}return a}(A,{groupBy:t.field,value:e.field,agg:n});else if(("count"===n||"count"===e.aggregate)&&(null==t?void 0:t.field)&&A){const e=new Map;for(const n of A){const o=n[t.field]+"";e.set(o,(e.get(o)||0)+1)}A=Array.from(e,([e,n])=>({[t.field]:e,value:n}))}}if((null==m?void 0:m.bin)||(null==v?void 0:v.bin)){const e="Histogram";A&&(S.data=A),(null==m?void 0:m.bin)?(S.valueAccessor=m.field,(null==v?void 0:v.field)&&(S.categoryAccessor=v.field),(null===(i=m.axis)||void 0===i?void 0:i.title)&&(S.valueLabel=m.axis.title)):(null==v?void 0:v.bin)&&(S.valueAccessor=v.field,(null==m?void 0:m.field)&&(S.categoryAccessor=m.field),(null===(r=v.axis)||void 0===r?void 0:r.title)&&(S.valueLabel=v.axis.title));const t=(null==m?void 0:m.bin)||(null==v?void 0:v.bin),n="object"==typeof t?t.maxbins:void 0;return n&&(S.bins=n),zh(e,S,g)}let M;switch(f){case"bar":M=function(e,t,n,o,i,r,a){var s,l,c,u,d,h;let g;return(null==n?void 0:n.field)&&!1!==(null==e?void 0:e.stack)&&!1!==(null==t?void 0:t.stack)&&null!==(null==e?void 0:e.stack)&&null!==(null==t?void 0:t.stack)?(g="StackedBarChart",o.stackBy=n.field):g="BarChart",Dh(null==e?void 0:e.type)&&Eh(null==t?void 0:t.type)?(o.categoryAccessor=e.field,o.valueAccessor=a?"value":t.field,(null===(s=null==e?void 0:e.axis)||void 0===s?void 0:s.title)&&(o.categoryLabel=e.axis.title),(null===(l=null==t?void 0:t.axis)||void 0===l?void 0:l.title)&&(o.valueLabel=t.axis.title)):Eh(null==e?void 0:e.type)&&Dh(null==t?void 0:t.type)?(o.categoryAccessor=t.field,o.valueAccessor=r?"value":e.field,o.orientation="horizontal",(null===(c=null==t?void 0:t.axis)||void 0===c?void 0:c.title)&&(o.categoryLabel=t.axis.title),(null===(u=null==e?void 0:e.axis)||void 0===u?void 0:u.title)&&(o.valueLabel=e.axis.title)):((null==e?void 0:e.field)&&(o.categoryAccessor=e.field),(null==t?void 0:t.field)&&(o.valueAccessor=a?"value":t.field),(null===(d=null==e?void 0:e.axis)||void 0===d?void 0:d.title)&&(o.categoryLabel=e.axis.title),(null===(h=null==t?void 0:t.axis)||void 0===h?void 0:h.title)&&(o.valueLabel=t.axis.title)),i&&(o.data=i),g}(m,v,b,S,A,C,j);break;case"line":if(M="LineChart",Wh(m,v,S,C,j),(null==b?void 0:b.field)&&(S.lineBy=b.field),p.interpolate){const e=Rh[p.interpolate];e&&(S.curve=e)}!0===p.point&&(S.showPoints=!0),A&&(S.data=A);break;case"area":if((null==b?void 0:b.field)?(M="StackedAreaChart",S.areaBy=b.field):M="AreaChart",Wh(m,v,S,C,j),p.interpolate){const e=Rh[p.interpolate];e&&(S.curve=e)}void 0!==p.opacity&&(S.areaOpacity=p.opacity),A&&(S.data=A);break;case"point":case"circle":case"square":(null==x?void 0:x.field)?(M="BubbleChart",S.sizeBy=x.field,(null===(a=x.scale)||void 0===a?void 0:a.range)&&(S.sizeRange=x.scale.range)):M="Scatterplot",Wh(m,v,S,C,j),A&&(S.data=A);break;case"rect":M="Heatmap",(null==m?void 0:m.field)&&(S.xAccessor=m.field),(null==v?void 0:v.field)&&(S.yAccessor=v.field),(null==b?void 0:b.field)&&(S.valueAccessor=b.field,delete S.colorBy),(null===(s=null==m?void 0:m.axis)||void 0===s?void 0:s.title)&&(S.xLabel=m.axis.title),(null===(l=null==v?void 0:v.axis)||void 0===l?void 0:l.title)&&(S.yLabel=v.axis.title),A&&(S.data=A);break;case"arc":p.innerRadius&&p.innerRadius>0?(M="DonutChart",S.innerRadius=p.innerRadius):M="PieChart",(null==k?void 0:k.field)?S.valueAccessor=k.field:(null==v?void 0:v.field)&&(S.valueAccessor=j?"value":v.field),(null==b?void 0:b.field)&&(S.categoryAccessor=b.field),(null==m?void 0:m.field)&&!(null==k?void 0:k.field)&&(S.categoryAccessor=m.field),A&&(S.data=A);break;case"tick":M="DotPlot",Dh(null==m?void 0:m.type)?(S.categoryAccessor=m.field,(null==v?void 0:v.field)&&(S.valueAccessor=j?"value":v.field),(null===(c=null==m?void 0:m.axis)||void 0===c?void 0:c.title)&&(S.categoryLabel=m.axis.title),(null===(u=null==v?void 0:v.axis)||void 0===u?void 0:u.title)&&(S.valueLabel=v.axis.title)):Dh(null==v?void 0:v.type)?(S.categoryAccessor=v.field,(null==m?void 0:m.field)&&(S.valueAccessor=C?"value":m.field),S.orientation="horizontal",(null===(d=null==v?void 0:v.axis)||void 0===d?void 0:d.title)&&(S.categoryLabel=v.axis.title),(null===(h=null==m?void 0:m.axis)||void 0===h?void 0:h.title)&&(S.valueLabel=m.axis.title)):((null==m?void 0:m.field)&&(S.categoryAccessor=m.field),(null==v?void 0:v.field)&&(S.valueAccessor=j?"value":v.field)),A&&(S.data=A);break;default:g.push(`Unsupported mark type "${f}". Defaulting to Scatterplot.`),M="Scatterplot",Wh(m,v,S,C,j),A&&(S.data=A)}return zh(M,S,g)}function Wh(e,t,n,o,i){var r,a;(null==e?void 0:e.field)&&(n.xAccessor=o?"value":e.field),(null==t?void 0:t.field)&&(n.yAccessor=i?"value":t.field),(null===(r=null==e?void 0:e.axis)||void 0===r?void 0:r.title)&&(n.xLabel=e.axis.title),(null===(a=null==t?void 0:t.axis)||void 0===a?void 0:a.title)&&(n.yLabel=t.axis.title)}function zh(e,t,n){const o={component:e,props:t,version:"1",createdAt:(new Date).toISOString()};if(n.length>0){o.warnings=n;for(const e of n)console.warn("[semiotic/fromVegaLite] "+e)}return o}const Yh=new Set(["LineChart","AreaChart","StackedAreaChart","DifferenceChart","Scatterplot","BubbleChart","ConnectedScatterplot","QuadrantChart","MultiAxisLineChart","MinimapChart"]),Gh=new Set(["BarChart","StackedBarChart","GroupedBarChart","DotPlot"]),qh=new Set(["PieChart","DonutChart","FunnelChart"]),Xh=new Set(["Histogram","BoxPlot","ViolinPlot","RidgelinePlot","SwarmPlot"]);function Vh(e,t){var n,o;return Gh.has(e)||qh.has(e)||"SwimlaneChart"===e||"GaugeChart"===e?{measure:t.valueAccessor,measureFallback:"value",dimension:null!==(n=t.categoryAccessor)&&void 0!==n?n:t.stepAccessor,dimensionFallback:"category"}:{measure:null!==(o=t.yAccessor)&&void 0!==o?o:t.valueAccessor,measureFallback:"y",dimension:t.xAccessor,dimensionFallback:"x"}}function Uh(e){for(const t of["lineBy","areaBy","stackBy","groupBy","colorBy"]){const n=e[t];if("string"==typeof n&&n)return n}}function Qh(e,t){return null==e?"—":e instanceof Date?e.toISOString().slice(0,10):"number"==typeof e?t(e):e+""}function Kh(e,t={}){var n,o;const i=!0===t.showRetractedAnnotations,r=!0===t.showSupersededAnnotations,a=new Set;for(const t of e){const e=null===(n=null==t?void 0:t.lifecycle)||void 0===n?void 0:n.supersedes;e&&"retracted"!==(null===(o=null==t?void 0:t.lifecycle)||void 0===o?void 0:o.status)&&a.add(e)}return e.filter(e=>{var t,n;if("retracted"===(null===(t=null==e?void 0:e.lifecycle)||void 0===t?void 0:t.status)&&!i)return!1;const o=null===(n=null==e?void 0:e.provenance)||void 0===n?void 0:n.stableId;return!(o&&a.has(o)&&!r)})}const Zh={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"},Jh=new Set(["ForceDirectedGraph","SankeyDiagram","ProcessSankey","ChordDiagram"]);function eg(e){return Zh[e]||e.replace(/([a-z])([A-Z])/g,"$1 $2").toLowerCase()+" chart"}const tg=new Set(["Scatterplot","BubbleChart","ConnectedScatterplot","QuadrantChart","ScatterplotMatrix"]),ng={"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"},og={"time-series":"tracking",categorical:"comparing",distribution:"characterizing",relationship:"relating",flow:"tracing",network:"tracing",hierarchy:"nesting",geo:"locating",realtime:"tracking",value:"presenting",custom:"presenting"},ig=["trend","compare-series","compare-categories","rank","part-to-whole","distribution","correlation","flow","hierarchy","geo","composition-over-time","change-detection","outlier-detection"],rg={alerting:"alerting",tracking:"trend",comparing:"comparison",ranking:"ranking",apportioning:"composition",characterizing:"distribution",relating:"correlation",tracing:"flow",nesting:"hierarchy",locating:"locator",presenting:"single-value"};function ag(e="en"){let t,n;try{t=new Intl.NumberFormat(e,{notation:"compact",maximumFractionDigits:1}),n=new Intl.NumberFormat(e,{maximumFractionDigits:2})}catch(e){t=new Intl.NumberFormat("en",{notation:"compact",maximumFractionDigits:1}),n=new Intl.NumberFormat("en",{maximumFractionDigits:2})}return e=>Number.isFinite(e)?1e4>Math.abs(e)?n.format(e):t.format(e):e+""}const sg={"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 lg(e){const t=sg["string"==typeof e.type?e.type:"annotation"]||"an annotation",n=function(e){var t,n;const o=e.provenance&&"object"==typeof e.provenance?e.provenance:null,i=null!==(n=null!==(t=null==o?void 0:o.authorKind)&&void 0!==t?t:null==o?void 0:o.source)&&void 0!==n?n:null==o?void 0:o.basis;return"watcher"===i?"a watcher-flagged ":"agent"===i||"ai"===i||"llm-inference"===i?"an AI-suggested ":""}(e),o=n?n+t.replace(/^an? /,""):t,i="string"==typeof e.label?e.label:"string"==typeof e.title?e.title:void 0;return i?`${o} labeled "${i}"`:o}function cg(e,t,n={}){var o,i;const r=void 0!==n.levels,a=new Set(null!==(o=n.levels)&&void 0!==o?o:["l1","l2","l3"]);!r&&n.capability&&a.add("l4");const s=ag(null!==(i=n.locale)&&void 0!==i?i:"en"),l=eg(e),c=Array.isArray(t.data)?t.data:null,u=Uh(t),{measure:d,measureFallback:h,dimension:g,dimensionFallback:f}=Vh(e,t),p="string"==typeof d&&d?d:h,y="string"==typeof g&&g?g:f,m={};if(a.has("l1"))if(Yh.has(e)||Gh.has(e))m.l1=`A ${l} of ${p} by ${y}`+(u?`, split by ${u}.`:".");else if(qh.has(e))m.l1=`A ${l} showing ${p} across ${y} categories.`;else if(Xh.has(e))m.l1=`A ${l} of the distribution of ${p}`+(u?` by ${u}.`:".");else if(Jh.has(e)){const e=Array.isArray(t.nodes)?t.nodes.length:void 0,n=Array.isArray(t.edges)?t.edges.length:void 0,o=[null!=e?`${e} ${dg(e,"node")}`:null,null!=n?`${n} ${dg(n,"edge")}`:null].filter(Boolean);m.l1=`A ${l}${o.length?" with "+o.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=Yh.has(e)||Gh.has(e)||qh.has(e)||Xh.has(e);let b=null;if((a.has("l2")||a.has("l3")||a.has("l4"))&&v&&c&&c.length>0&&(b=function(e,t,n,o){let i=0,r=0,a=1/0,s=-1/0,l=null,c=null,u=0,d=0,h=null,g=null,f=NaN,p=NaN;for(const n of e){const e=t(n);Number.isFinite(e)&&(0===i&&(f=e,h=n),p=e,g=n,a>e&&(a=e,l=n,u=i),e>s&&(s=e,c=n,d=i),i++,r+=e)}return 0===i?null:{count:i,min:a,max:s,mean:r/i,minLabel:Qh(null!=l?n(l):null,o),maxLabel:Qh(null!=c?n(c):null,o),first:f,last:p,firstLabel:Qh(null!=h?n(h):null,o),lastLabel:Qh(null!=g?n(g):null,o),minIndex:u,maxIndex:d}}(c,He(d,h),Fe(g,f),s)),a.has("l2")&&v&&(c&&0!==c.length?b&&(m.l2=qh.has(e)?`${b.count} segments totaling ${s(function(e){return e.mean*e.count}(b))}. Largest is ${b.maxLabel} at ${s(b.max)}; smallest is ${b.minLabel} at ${s(b.min)}.`:`${p} ranges from ${s(b.min)} (${b.minLabel}) to ${s(b.max)} (${b.maxLabel}), with a mean of ${s(b.mean)} across ${b.count} points.`):m.l2="No data is loaded yet."),a.has("l3")&&b&&Yh.has(e)?m.l3=function(e,t,n){const{first:o,last:i,min:r,max:a,maxLabel:s,minLabel:l,firstLabel:c,lastLabel:u,minIndex:d,maxIndex:h,count:g}=e,f=a-r,p=i-o;if(0===f)return`${ug(t)} is constant at ${n(o)} across the series.`;if(.04>f/(Math.abs(e.mean)||1))return`${ug(t)} ends roughly where it started (${n(o)} at ${c} to ${n(i)} at ${u}), ranging between ${n(r)} and ${n(a)}.`;const y=h>0&&g-1>h,m=d>0&&g-1>d,v=(a-Math.max(o,i))/f,b=(Math.min(o,i)-r)/f;return y&&v>.15?`Overall ${t} climbs to a peak of ${n(a)} (${s}), then falls to ${n(i)} (${u}).`:m&&b>.15?`Overall ${t} drops to a low of ${n(r)} (${l}), then recovers to ${n(i)} (${u}).`:.05>Math.abs(p)/f?`${ug(t)} ends roughly where it started (${n(o)} at ${c} to ${n(i)} at ${u}), ranging between ${n(r)} and ${n(a)}.`:p>0?h===g-1?`Overall ${t} rises from ${n(o)} (${c}) to a peak of ${n(i)} (${u}).`:`Overall ${t} rises from ${n(o)} (${c}) to ${n(i)} (${u}), after peaking at ${n(a)} (${s}).`:d===g-1?`Overall ${t} falls from ${n(o)} (${c}) to a low of ${n(i)} (${u}).`:`Overall ${t} falls from ${n(o)} (${c}) to ${n(i)} (${u}), after dipping to ${n(r)} (${l}).`}(b,p,s):a.has("l3")&&b&&Gh.has(e)&&(m.l3=`The highest ${y} is ${b.maxLabel} and the lowest is ${b.minLabel}.`),a.has("l4")){const o=function(e,t){var n;const o=function(e){if(e){if("fits"in e||"buildProps"in e){const t=e,n={};for(const[e,o]of Object.entries(t.intentScores))"number"==typeof o&&Number.isFinite(o)&&(n[e]=o);return{family:t.family,intentScores:Object.keys(n).length?n:void 0}}return e}}(t);if(null==o?void 0:o.act)return o.act;if(null==o?void 0:o.intentScores){const e=function(e){let t,n=0;for(const[o,i]of Object.entries(e))if("number"==typeof i&&i>0)if(i>n)t=o,n=i;else if(i===n&&void 0!==t){const e=ig.indexOf(o),n=ig.indexOf(t);-1===e||-1!==n&&e>=n||(t=o)}return t}(o.intentScores);if(e&&ng[e]&&(null!==(n=o.intentScores[e])&&void 0!==n?n:0)>=3)return ng[e]}return(null==o?void 0:o.family)?og[o.family]:function(e){return qh.has(e)||"StackedAreaChart"===e?"apportioning":tg.has(e)?"relating":Gh.has(e)?"comparing":Xh.has(e)?"characterizing":Yh.has(e)?"tracking":Jh.has(e)?"tracing":"BigNumber"===e?"presenting":void 0}(e)}(e,n.capability);o&&(m.l4=function(e,t,n,o,i,r,a,s){const l=rg[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 n.label&&n.label?n.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,n,o,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 "+n;case"comparing":return`compare ${n} across ${o}`;case"ranking":return"read it top to bottom by "+n;case"apportioning":return`read each ${o}'s share of the whole`;case"characterizing":return"read it for the spread and shape of "+n;default:return"read the highlighted features"}switch(e){case"alerting":return function(e,t,n){if(Gh.has(n)||qh.has(n))return`${e.maxLabel} stands out at ${t(e.max)} — check it first`;const{first:o,last:i,min:r,max:a,minLabel:s,maxLabel:l,lastLabel:c,minIndex:u,maxIndex:d,count:h}=e,g=a-r;if(g>0){const e=d>0&&h-1>d,n=u>0&&h-1>u,f=(a-Math.max(o,i))/g,p=(Math.min(o,i)-r)/g;if(e&&f>.15)return`the peak of ${t(a)} at ${l} is the point to investigate`;if(n&&p>.15)return`the dip to ${t(r)} at ${s} is the point to investigate`;if(i>=a)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(a)}) and ${s} (${t(r)}) — are the points to check`}(t,i,r);case"tracking":return`read it for the trajectory of ${n}, which ${function(e){const t=e.max-e.min,n=e.last-e.first;return 0===t||.05>Math.abs(n)/t?"holds roughly steady":n>0?"rises":"falls"}(t)} from ${i(t.first)} (${t.firstLabel}) to ${i(t.last)} (${t.lastLabel})`;case"comparing":return`compare ${n} across ${o}; ${t.maxLabel} leads at ${i(t.max)}`;case"ranking":return`read it top to bottom by ${n}; ${t.maxLabel} ranks highest at ${i(t.max)}`;case"apportioning":{const e=t.mean*t.count,n=e>0?Math.round(t.max/e*100):null;return`read each ${o}'s share of the ${i(e)} total; ${t.maxLabel} is the largest at ${i(t.max)}${null!=n?` (${n}%)`:""}`}case"characterizing":return`read it for the spread of ${n}, from ${i(t.min)} to ${i(t.max)}`;default:return"read the highlighted features"}}(e,o,i,r,a,t)}return`${u}; ${d}.${function(e,t){var n;if(!t)return"";const o=null===(n=t.familiarity)||void 0===n?void 0:n[e];return"number"!=typeof o||o>2?"":` This ${eg(e)} may be unfamiliar${t.name?` to ${t.name.toLowerCase()} readers`:""} — lean on this description.`}(t,s)}`}(o,e,t,b,p,y,s,n.audience))}const x=["l1","l2","l3","l4"].filter(e=>a.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 n=Kh(t.filter(e=>!!e&&"object"==typeof e));if(0===n.length)return;const o=n.map(lg),i=o.slice(0,5),r=o.length-i.length,a=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`:""),s=n.length;return`The author has marked ${1===s?"one feature":s+" features"} on this chart: ${a}.`}(t);return Object.assign({text:k?`${k} ${x}`.trim():x,levels:m},k?{annotations:k}:{})}function ug(e){return e.length?e[0].toUpperCase()+e.slice(1):e}function dg(e,t){return 1===e?t:t+"s"}function hg(e,t,n={}){var o,i,r;const a=null!==(o=n.locale)&&void 0!==o?o:"en",s=Math.max(1,null!==(i=n.maxLeaves)&&void 0!==i?i:200),l=ag(a),c={id:"root",role:"chart",label:cg(e,t,{locale:a}).text||"Chart.",level:1,children:[]},u=function(e,t){const n=Array.isArray(e.annotations)?e.annotations:null;if(!n)return null;const o=Kh(n.filter(e=>!!e&&"object"==typeof e));if(0===o.length)return null;let i=0;const r=o.slice(0,t).map(e=>{var t;const n=null===(t=e.lifecycle)||void 0===t?void 0:t.status,o=n&&"accepted"!==n?` (${n})`:"";return{id:"annotation-"+i++,role:"annotation",level:3,label:`${r=lg(e),r?r.charAt(0).toUpperCase()+r.slice(1):r}${o}.`,datum:e};var r});o.length>t&&r.push({id:"annotation-"+i++,role:"annotation",level:3,label:`…and ${o.length-t} more annotations.`});const a=o.length;return{id:"annotations",role:"annotation",level:2,label:`Annotations: ${1===a?"one marked feature":a+" marked features"}.`,children:r}}(t,s),d=Array.isArray(t.data)?t.data:null,h=Yh.has(e)||Gh.has(e)||qh.has(e)||Xh.has(e);if(!d||0===d.length||!h)return u&&(c.children=[u]),c;const{measure:g,measureFallback:f,dimension:p,dimensionFallback:y}=Vh(e,t),m=He(g,f),v=Fe(p,y),b="string"==typeof g&&g?g:f,x="string"==typeof p&&p?p:y,k=Uh(t);let w=0;const A=e=>`${e}-${w++}`,S=(e,t)=>{const n=e.slice(0,s).map(e=>((e,t)=>{const n=m(e),o=Qh(v(e),l);return{id:A("datum"),role:"datum",level:t,label:`${o}: ${Number.isFinite(n)?l(n):"—"}`,value:Number.isFinite(n)?n:void 0,datum:e}})(e,t));return e.length>s&&n.push({id:A("more"),role:"datum",level:t,label:`…and ${e.length-s} more points`}),n},O=[];if(Yh.has(e)||Gh.has(e)){let t=1/0,n=-1/0,o=1/0,i=-1/0;const r=[];let a=!0;for(const e of d){const s=m(e);Number.isFinite(s)&&(t>s&&(t=s),s>n&&(n=s));const l=v(e);r.push(l),"number"==typeof l&&Number.isFinite(l)?(o>l&&(o=l),l>i&&(i=l)):a=!1}const s=new Set,c=[];for(const e of r){const t=e+"";s.has(t)||(s.add(t),c.push(e))}const u=a?`${l(o)} to ${l(i)}`:`${Qh(c[0],l)} to ${Qh(c[c.length-1],l)} (${Gh.has(e)?c.length+" categories":d.length+" points"})`;O.push({id:A("axis"),role:"axis",level:2,label:`${Gh.has(e)?"Category axis":"X axis"}: ${x}, ${u}.`}),t>n||O.push({id:A("axis"),role:"axis",level:2,label:`Value axis: ${b}, ${l(t)} to ${l(n)}.`})}if(k){const n=Fe(k,k),o=new Map;for(const e of d){const t=(null!==(r=n(e))&&void 0!==r?r:"—")+"",i=o.get(t);i?i.push(e):o.set(t,[e])}const i=[];for(const[n,r]of o){const o=cg(e,Object.assign(Object.assign({},t),{data:r}),{levels:["l2","l3"],locale:a}).text;i.push({id:A("series"),role:"series",level:2,label:`Series ${n}: ${o}`,children:S(r,3)})}c.children=[...O,...i]}else c.children=[...O,...S(d,2)];return u&&c.children.push(u),c}const gg={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0,padding:0,margin:-1};function fg({tree:n,label:i,visible:r=!1,className:a,onActiveChange:s,activeId:l,chartId:c}){const[u,d]=o.useState(()=>new Set([n.id])),[h,g]=o.useState(n.id),f=void 0!==l,p=f?l:h,y=o.useRef(null),m=o.useRef(new Map),v=o.useMemo(()=>function(e){const t=new Map,n=e=>{var o;for(const i of null!==(o=e.children)&&void 0!==o?o:[])t.set(i.id,e),n(i)};return n(e),t}(n),[n]),b=o.useMemo(()=>function(e,t){const n=[],o=e=>{if(n.push(e),e.children&&e.children.length>0&&t.has(e.id))for(const t of e.children)o(t)};return o(e),n}(n,u),[n,u]);o.useEffect(()=>{f||b.some(e=>e.id===h)||g(n.id)},[b,h,n.id,f]),o.useEffect(()=>{const e=[];let t=v.get(p);for(;t;)e.push(t.id),t=v.get(t.id);e.length>0&&d(t=>{if(e.every(e=>t.has(e)))return t;const n=new Set(t);for(const t of e)n.add(t);return n})},[p,v]),o.useEffect(()=>{var e,t;(null===(e=y.current)||void 0===e?void 0:e.contains(document.activeElement))&&(null===(t=m.current.get(p))||void 0===t||t.focus())},[p]);const x=o.useCallback((e,t,n)=>{},[c]),k=o.useCallback(e=>{e.id!==p&&(f||g(e.id),null==s||s(e),x(e,"focus"))},[s,f,x,p]),w=e=>{d(t=>new Set(t).add(e.id)),x(e,"toggle",!0)},A=e=>{d(t=>{const n=new Set(t);return n.delete(e.id),n}),x(e,"toggle",!1)},S=(n,o,i)=>{const a=!!n.children&&n.children.length>0,s=u.has(n.id);return t("li",{role:"treeitem","aria-label":n.label,"aria-level":n.level,"aria-posinset":o,"aria-setsize":i,"aria-expanded":a?s:void 0,"aria-selected":n.id===p,tabIndex:n.id===p?0:-1,ref:e=>{m.current.set(n.id,e)},onClick:e=>{e.stopPropagation(),k(n),a&&(s?A:w)(n)},style:r?{listStyle:"none",padding:"2px 6px",paddingLeft:6+16*(n.level-1),cursor:a?"pointer":"default",fontSize:13,color:"var(--semiotic-text, currentColor)",background:n.id===p?"var(--semiotic-surface, var(--semiotic-grid, var(--semiotic-bg, #f0f4f8)))":"transparent",outline:"none"}:void 0,children:[t("span",{className:"semiotic-nav-tree-label semiotic-nav-tree-"+n.role,children:[r&&a?s?"▾ ":"▸ ":"",n.label]}),a&&s&&e("ul",{role:"group",style:r?{margin:0,padding:0}:void 0,children:n.children.map((e,t)=>S(e,t+1,n.children.length))})]},n.id)};return e("div",{ref:y,className:"semiotic-nav-tree"+(a?" "+a:""),style:r?void 0:gg,onKeyDown:e=>{const t=b.findIndex(e=>e.id===p);if(-1===t)return;const n=b[t],o=!!n.children&&n.children.length>0,i=u.has(n.id);let r=!0;switch(e.key){case"ArrowDown":k(b[Math.min(t+1,b.length-1)]);break;case"ArrowUp":k(b[Math.max(t-1,0)]);break;case"Home":k(b[0]);break;case"End":k(b[b.length-1]);break;case"ArrowRight":o&&!i?w(n):o&&i?k(n.children[0]):r=!1;break;case"ArrowLeft":if(o&&i)A(n);else{const e=v.get(n.id);e?k(e):r=!1}break;case"Enter":case" ":o?(i?A:w)(n):r=!1;break;default:r=!1}r&&(e.preventDefault(),e.stopPropagation())},children:e("ul",{role:"tree","aria-label":i||"Chart navigation",style:r?{margin:0,padding:0}:void 0,children:S(n,1,1)})})}const pg={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0,padding:0,margin:-1};function yg(){const n=function(){const e=o.useContext(fi);return e?()=>e.setVisible(e=>!e):null}();return n?e("button",{className:"semiotic-chart-action",onClick:n,title:"Data summary","aria-label":"Toggle data summary",style:kg,children:t("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e("rect",{x:"1",y:"1",width:"12",height:"3",rx:"0.5"}),e("rect",{x:"1",y:"6",width:"8",height:"3",rx:"0.5"}),e("rect",{x:"1",y:"11",width:"5",height:"2",rx:"0.5"})]})}):null}const mg={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 vg({height:t}){return e("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 bg({error:t}){return e("div",{role:"alert",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",minHeight:120,padding:24,boxSizing:"border-box"},children:e("div",{style:{textAlign:"center",maxWidth:400,fontSize:14,color:"var(--semiotic-text-secondary, #666)",lineHeight:1.5},children:t})})}const xg=o.forwardRef(function({title:i,subtitle:r,children:a,width:s="100%",height:l=400,actions:c,chartConfig:u,describe:d,navigable:h,controls:g,loading:f=!1,error:p,errorBoundary:y=!1,status:m,detailsPanel:v,className:b,style:x},k){var w;const A=o.useRef(null),S=o.useRef(null),[O,C]=o.useState(!1),j=!1!==(null==c?void 0:c.export)&&void 0!==(null==c?void 0:c.export),M=!1!==(null==c?void 0:c.fullscreen)&&void 0!==(null==c?void 0:c.fullscreen),_=!1!==(null==c?void 0:c.copyConfig)&&void 0!==(null==c?void 0:c.copyConfig)&&u,P=!0===(null==c?void 0:c.dataSummary),L=o.useMemo(()=>{if(!d||!(null==u?void 0:u.component)||!(null==u?void 0:u.props))return"";const e="object"==typeof d?d.levels:void 0;try{return cg(u.component,u.props,e?{levels:e}:{}).text}catch(e){return""}},[d,u]),T="object"==typeof d&&!0===d.visible,$=o.useMemo(()=>{if(!h||!(null==u?void 0:u.component)||!(null==u?void 0:u.props))return null;const e="object"==typeof h?h.maxLeaves:void 0;try{return hg(u.component,u.props,e?{maxLeaves:e}:{})}catch(e){return null}},[h,u]),N="object"==typeof h&&!0===h.visible,B=o.useMemo(()=>"object"==typeof(null==c?void 0:c.export)?c.export:{},[null==c?void 0:c.export]),D="object"==typeof(null==c?void 0:c.copyConfig)?c.copyConfig.format:"json",E=o.useCallback(e=>qc(this,void 0,void 0,function*(){S.current&&(yield yh(S.current,Object.assign(Object.assign({},B),e)))}),[B]),I=o.useCallback(()=>{A.current&&(document.fullscreenElement?document.exitFullscreen().catch(()=>{}):A.current.requestFullscreen().catch(()=>{}))},[]),R=o.useCallback(e=>qc(this,void 0,void 0,function*(){var t,n;u&&(yield Th(Object.assign(Object.assign({},u),{version:null!==(t=u.version)&&void 0!==t?t:"1",createdAt:null!==(n=u.createdAt)&&void 0!==n?n:(new Date).toISOString()}),e||D||"json"))}),[u,D]);o.useEffect(()=>{const e=()=>{C(!!document.fullscreenElement)};return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[]),o.useImperativeHandle(k,()=>({export:E,toggleFullscreen:I,copyConfig:R,element:A.current}),[E,I,R]);const H=i||r||g||j||M||_||P||m,F=f?e(vg,{height:l}):p?e(bg,{error:p}):y?e(Ac,{children:a}):a;return W=t(n,{children:[e("style",{dangerouslySetInnerHTML:{__html:"@keyframes semiotic-skeleton-pulse {\n 0% { background-position: 200% 0; }\n 100% { background-position: -200% 0; }\n}"}}),t("div",{ref:A,className:"semiotic-chart-container"+(b?" "+b:""),style:Object.assign(Object.assign({width:s,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"},O?{display:"flex",flexDirection:"column",width:"100%",height:"100%"}:{}),x),children:[H&&t("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:[t("div",{className:"semiotic-chart-title-area",children:[i&&e("div",{className:"semiotic-chart-title",style:{fontSize:14,fontWeight:600,color:"var(--semiotic-text, #333)"},children:i}),r&&e("div",{className:"semiotic-chart-subtitle",style:{fontSize:12,color:"var(--semiotic-text-secondary, #666)",marginTop:i?2:0},children:r})]}),t("div",{className:"semiotic-chart-toolbar",style:{display:"flex",alignItems:"center",gap:4},children:[g,j&&e("button",{className:"semiotic-chart-action",onClick:()=>E(),title:"Export chart","aria-label":"Export chart",style:kg,children:t("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e("path",{d:"M7 2v8M3.5 7L7 10.5 10.5 7"}),e("path",{d:"M2 12h10"})]})}),P&&e(yg,{}),M&&e("button",{className:"semiotic-chart-action",onClick:I,title:O?"Exit fullscreen":"Fullscreen","aria-label":O?"Exit fullscreen":"Enter fullscreen",style:kg,children:e("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:t(n,O?{children:[e("path",{d:"M9 1v4h4"}),e("path",{d:"M5 13V9H1"}),e("path",{d:"M13 5H9V1"}),e("path",{d:"M1 9h4v4"})]}:{children:[e("path",{d:"M1 5V1h4"}),e("path",{d:"M13 9v4H9"}),e("path",{d:"M9 1h4v4"}),e("path",{d:"M5 13H1V9"})]})})}),_&&e("button",{className:"semiotic-chart-action",onClick:()=>R(),title:"Copy config","aria-label":"Copy chart configuration",style:kg,children:t("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e("rect",{x:"5",y:"5",width:"8",height:"8",rx:"1"}),e("path",{d:"M9 5V2a1 1 0 00-1-1H2a1 1 0 00-1 1v6a1 1 0 001 1h3"})]})}),m&&e("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:mg[m].bg,color:mg[m].color,lineHeight:"18px"},children:m})]})]}),L&&e("div",{className:"semiotic-chart-description",role:"note",style:T?{padding:"8px 16px",fontSize:12,lineHeight:1.5,color:"var(--semiotic-text-secondary, #666)",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"}:pg,children:L}),$&&e("div",{className:"semiotic-chart-nav",style:N?{padding:"8px 8px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)",maxHeight:240,overflow:"auto"}:void 0,children:e(fg,{tree:$,label:"string"==typeof i&&i?i+" — navigable structure":"Chart navigable structure",visible:N,chartId:"string"==typeof(null===(w=null==u?void 0:u.props)||void 0===w?void 0:w.chartId)?u.props.chartId:void 0})}),t("div",{className:"semiotic-chart-body",ref:S,style:Object.assign({position:"relative",overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center"},O?{flex:1}:{height:l}),children:[F,v]})]})]}),P?e(pi,{children:W}):W;var W}),kg={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 wg({children:t,columns:n="auto",minCellWidth:i=300,gap:r=16,className:a,style:s}){const l="number"==typeof n?n:void 0;return e("div",{className:"semiotic-chart-grid"+(a?" "+a:""),style:Object.assign({display:"grid",gridTemplateColumns:"auto"===n?`repeat(auto-fill, minmax(${i}px, 1fr))`:`repeat(${n}, 1fr)`,gap:r,width:"100%"},s),children:o.Children.map(t,t=>o.isValidElement(t)?"primary"!==t.props.emphasis||void 0!==l&&2>l?t:e("div",{style:{gridColumn:"span 2"},children:t}):t)})}function Ag({children:n,context:o,position:i="right",contextSize:r=250,gap:a=12,className:s,style:l}){const c="left"===i||"right"===i,u="left"===i||"top"===i,d=Object.assign({display:"flex",flexDirection:c?u?"row-reverse":"row":u?"column-reverse":"column",gap:a,width:"100%"},l),h=c?{flex:`0 0 ${r}px`,width:r,minHeight:0}:{flex:`0 0 ${r}px`,height:r,minWidth:0};return t("div",{className:"semiotic-context-layout"+(s?" "+s:""),style:d,children:[e("div",{style:{flex:"1 1 0%",minWidth:0,minHeight:0},children:n}),e("div",{style:h,children:o})]})}wg.displayName="ChartGrid",Ag.displayName="ContextLayout";function Sg({children:n,position:o="right",size:r=300,trigger:s="click",chartId:c,observation:u,dismissOnEmpty:h=!0,showClose:g=!0,onToggle:f,className:p,style:y}){const[m,v]=d(null),[b,x]=d(null),[k,w]=d(!1),[A,S]=d(!1),O=i(null),C=i(void 0),j="click"===s?["click","click-end"]:["hover","hover-end"],{latest:M}=Dl({types:j,chartId:c,limit:1}),_=void 0!==u?u:M,P=l(()=>{S(!0),w(!1),clearTimeout(C.current),C.current=setTimeout(()=>{S(!1),v(null),x(null)},200)},[]);if(a(()=>{if(_)if("click"===_.type||"hover"===_.type){const e=_;v(e.datum),x(e),w(e=>(e||(S(!0),clearTimeout(C.current),C.current=setTimeout(()=>S(!1),200)),!0))}else!h||"click-end"!==_.type&&"hover-end"!==_.type||P()},[h,P,_]),a(()=>{null==f||f(k)},[k,f]),a(()=>()=>clearTimeout(C.current),[]),!m&&!A)return null;const L=m&&b?n(m,b):null;if(null===L&&!A)return null;const T=function(e,t,n,o){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:o?"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:n?"translateX(0)":`translateX(${t}px)`,opacity:n?1:0}:"bottom"===e?{bottom:0,left:0,width:"100%",height:t,borderTopWidth:1,padding:"12px 16px",transform:n?"translateY(0)":`translateY(${t}px)`,opacity:n?1:0}:{top:"50%",left:"50%",transform:n?"translate(-50%, -50%) scale(1)":"translate(-50%, -50%) scale(0.95)",opacity:n?1:0,width:Math.min(t,400),maxHeight:"80%",borderWidth:1,borderRadius:8,padding:"16px 20px",boxShadow:"0 8px 32px rgba(0,0,0,0.12)"})}(o,r,k,A);return t("div",{ref:O,className:`semiotic-details-panel semiotic-details-${o}${p?" "+p:""}`,style:Object.assign(Object.assign({},T),y),children:[g&&e("button",{className:"semiotic-details-close",onClick:P,"aria-label":"Close details",style:Og,children:e("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",children:e("path",{d:"M2 2l8 8M10 2l-8 8"})})}),e("div",{className:"semiotic-details-content",style:{overflow:"auto",flex:1},children:L})]})}const Og={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 Cg(e){var t;if("datum"===e.role&&e.datum)return e.datum;for(const n of null!==(t=e.children)&&void 0!==t?t:[]){const e=Cg(n);if(e)return e}return null}function jg(e,t){return e?t.map(t=>e[t]+"").join(""):""}function Mg(e){var t;const{tree:n,chartId:o,observe:s=["hover","click"]}=e,c=null!==(t=e.selectionName)&&void 0!==t?t:"__semiotic-nav-sync"+(o?":"+o:""),u=r(()=>{if(e.matchFields)return e.matchFields;const t=Cg(n);return t?Object.keys(t).filter(e=>{return!e.startsWith("_")&&(null==(n=t[e])||"string"==typeof n||"number"==typeof n||"boolean"==typeof n);var n}):[]},[e.matchFields,n]),h=r(()=>{const e=new Map,t=n=>{var o;if("datum"===n.role&&n.datum){const t=jg(n.datum,u);e.has(t)||e.set(t,n.id)}for(const e of null!==(o=n.children)&&void 0!==o?o:[])t(e)};return t(n),e},[n,u]),{selectPoints:g,clear:f}=Pl({name:c}),{latest:p}=Dl({chartId:o,types:[...s,"hover-end"],limit:1}),[y,m]=d(n.id);a(()=>{m(n.id),f()},[n,f]);const v=l(e=>{if(m(e.id),"datum"===e.role&&e.datum&&u.length>0){const t={};for(const n of u)t[n]=[e.datum[n]];g(t)}else f()},[u,g,f]),b=e.annotations,x=r(()=>{const e=new Set;if(0===u.length||!b)return e;for(const t of b){const n=h.get(jg(t,u));n&&e.add(n)}return e},[b,h,u]),k=l(e=>{const t="number"==typeof e?null==b?void 0:b[e]:e;if(!t||0===u.length)return!1;const n=h.get(jg(t,u));if(!n)return!1;m(n);const o={};for(const e of u)o[e]=[t[e]];return g(o),!0},[b,h,u,g]),w=i(null);return a(()=>{if(!p||p===w.current)return;if(w.current=p,"hover-end"===p.type)return;const e=p.datum;if(!e||0===u.length)return;const t=h.get(jg(e,u));t&&t!==y&&m(t)},[p,h,u,y]),{activeId:y,onActiveChange:v,selection:{name:c},annotatedIds:x,focusAnnotation:k}}Sg.displayName="DetailsPanel";export{fg as AccessibleNavTree,au as AreaChart,Wu as BarChart,od as BoxPlot,du as BubbleChart,Ql as CARBON_ALERT,Ul as CARBON_CATEGORICAL_14,Ae as COLOR_BLIND_SAFE_CATEGORICAL,Nu as CandlestickChart,kl as CategoryColorProvider,xg as ChartContainer,Ac as ChartErrorBoundary,wg as ChartGrid,jd as ChordDiagram,qd as CirclePack,tu as ConnectedScatterplot,Ag as ContextLayout,Oe as DARK_THEME,Sg as DetailsPanel,lu as DifferenceChart,dd as DonutChart,cd as DotPlot,Cd as ForceDirectedGraph,ld as FunnelChart,vd as GaugeChart,bd as GroupedBarChart,Ce as HIGH_CONTRAST_THEME,uu as Heatmap,rd as Histogram,Le as IncrementalExtent,Se as LIGHT_THEME,Ju as LikertChart,ou as LineChart,Gl as LinkedCharts,ku as MinimapChart,Tu as MultiAxisLineChart,Xi as MultiLineTooltip,Iu as NetworkCustomChart,Vd as OrbitDiagram,Ru as OrdinalCustomChart,ud as PieChart,zd as ProcessSankey,ju as QuadrantChart,lh as RealtimeHeatmap,oh as RealtimeHistogram,th as RealtimeLineChart,ah as RealtimeSwarmChart,rh as RealtimeTemporalHistogram,sh as RealtimeWaterfallChart,sd as RidgelinePlot,Pe as RingBuffer,Md as SankeyDiagram,Jc as Scatterplot,bu as ScatterplotMatrix,cu as StackedAreaChart,zu as StackedBarChart,cl as StreamNetworkFrame,va as StreamOrdinalFrame,Nr as StreamXYFrame,td as SwarmPlot,xd as SwimlaneChart,Kl as THEME_PRESETS,ih as TemporalHistogram,ac as ThemeProvider,qi as Tooltip,Yd as TreeDiagram,Gd as Treemap,ad as ViolinPlot,Eu as XYCustomChart,gh as adaptiveTimeTicks,hg as buildNavigationTree,$h as configToJSX,Th as copyConfig,sa as createHatchPattern,fh as darkenColor,Bh as deserializeSelections,yh as exportChart,_h as fromConfig,Lh as fromURL,Fh as fromVegaLite,ph as lightenColor,Ui as normalizeTooltip,Zl as resolveThemePreset,Nh as serializeSelections,ch as smartTickFormat,Jl as themeToCSS,ec as themeToTokens,Mh as toConfig,Ph as toURL,Nl as useBrushSelection,wl as useCategoryColors,Dl as useChartObserver,Bl as useFilteredData,Tl as useLinkedHover,Mg as useNavigationSync,Pl as useSelection,Ll as useSelectionActions,sc as useTheme};
|
|
2
|
+
import{darkenColor as e,getMax as t,getMin as o,getMinMax as r,lightenColor as n}from"./semiotic-chunk-3FSVZ46U.module.min.js";import*as i from"react";import{useRef as a,useState as s,useEffect as l,useMemo as c,useCallback as u,useImperativeHandle as d,useId as h,forwardRef as p,memo as f}from"react";import{useRef as m,useEffect as g,useMemo as y}from"react";import{select as b}from"d3-selection";import{brush as v,brushX as x,brushY as w}from"d3-brush";import*as k from"react";function S({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=k.useId().replace(/:/g,""),n=k.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:k.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))},[])}}}import{jsx as A,jsxs as C}from"react/jsx-runtime";function M(e,t,o,r){const[n,i]=[Math.min(...t),Math.max(...t)],a=(i-n)/20;let[s,l]=e;if(r)0>o?s=Math.max(n,s-a):l=Math.min(i,l+a);else{const e=l-s;s=Math.max(n,Math.min(i-e,s+o*a)),l=s+e}return[s,l]}function P(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 _(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 L({width:e,height:t,totalWidth:o,totalHeight:r,margin:n,dimension:i,scales:a,onBrush:s,binSize:l,snap:c,binBoundaries:u,snapDuring:d,streaming:h}){const p=m(null),f=m(null),k=m(s);k.current=s;const L=m(a);L.current=a;const R=y(()=>u?[...u].sort((e,t)=>e-t):void 0,[u]),I=m(R);I.current=R;const $=m(!1),T=m(null),N=S({label:"xy"===i?"Two-dimensional data range brush":i.toUpperCase()+" data range brush",onAction:e=>{const t=L.current,o=f.current;if(!t||!o||!p.current)return;const r=b(p.current).select(".brush-g");if("clear"===e.type)return $.current=!0,r.call(o.move,null),$.current=!1,T.current=null,void k.current(null);const n=t.x.domain(),a=t.y.domain(),s=T.current;let l=s?.x??[n[0]+.4*(n[1]-n[0]),n[0]+.6*(n[1]-n[0])],c=s?.y??[a[0]+.4*(a[1]-a[0]),a[0]+.6*(a[1]-a[0])];const u="left"===e.direction||"right"===e.direction,d="left"===e.direction||"down"===e.direction?-1:1;if(u&&"y"!==i&&(l=M(l,n,d,e.resize)),u||"x"===i||(c=M(c,a,d,e.resize)),u&&"y"===i||!u&&"x"===i)return;const h={x:l,y:c};$.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])]]),$.current=!1,T.current=h,k.current(h)}});return g(()=>{if(!p.current)return;const o=b(p.current).select(".brush-g"),r="x"===i?x():"y"===i?w():v();return r.extent([[0,0],[e,t]]),r.on("brush end",n=>{if($.current)return;const a=L.current;if(!a)return;if(!n.selection)return T.current=null,void k.current(null);let s,u;if("x"===i){const[e,o]=n.selection;s=[a.x.invert(e),a.x.invert(o)],u=[a.y.invert(t),a.y.invert(0)]}else if("y"===i){const[t,o]=n.selection;s=[a.x.invert(0),a.x.invert(e)],u=[a.y.invert(o),a.y.invert(t)]}else{const[[e,t],[o,r]]=n.selection;s=[a.x.invert(e),a.x.invert(o)],u=[a.y.invert(r),a.y.invert(t)]}if("bin"===c&&"y"!==i&&("end"===n.type||"brush"===n.type&&d)){const e=I.current;e&&e.length>0?s=function(e,t){return 0===t.length?e:[P(e[0],t),_(e[1],t)]}(s,e):l&&l>0&&(s=[Math.floor(s[0]/l)*l,Math.ceil(s[1]/l)*l]);const t=a.x(s[0]),c=a.x(s[1]);if($.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]]])}$.current=!1}const h={x:s,y:u};T.current=h,k.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]),g(()=>{if(!(h&&a&&f.current&&T.current))return;if(!p.current)return;if("y"===i)return;const e=T.current,t=a.x.domain()[0],o=b(p.current).select(".brush-g");if(t>=e.x[1])return $.current=!0,o.call(f.current.move,null),$.current=!1,T.current=null,void k.current(null);let r=e.x[0],n=!1;if(t>e.x[0]){if(r=t,"bin"===c){const e=I.current;e&&e.length>0?r=_(t,e):l&&l>0&&(r=Math.ceil(t/l)*l)}if(r>=e.x[1])return $.current=!0,o.call(f.current.move,null),$.current=!1,T.current=null,void k.current(null);n=!0}const s=a.x(r),u=a.x(e.x[1]);if($.current=!0,"x"===i)o.call(f.current.move,[s,u]);else{const t=a.y(e.y[1]),r=a.y(e.y[0]);o.call(f.current.move,[[s,t],[u,r]])}if($.current=!1,n){const t={x:[r,e.x[1]],y:e.y};T.current=t,k.current(t)}},[a,h,i,c,l]),C("svg",{ref:p,width:o,height:r,...N.svgProps,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:[A("title",{children:N.svgProps["aria-label"]}),A("desc",{id:N.descriptionId,children:N.description}),A("g",{className:"brush-g",transform:`translate(${n.left},${n.top})`})]})}var R=Object.freeze([]);function I(e){if(!e)return R;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 $=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=I(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=I(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}};import{createContext as T,useCallback as N,useContext as F,useMemo as D,useRef as B,useSyncExternalStore as E}from"react";import{jsx as z}from"react/jsx-runtime";function H(e){let t=null;const o=()=>(t||(t=T(null)),t),r=O(e);return[function({children:t,initialState:r}){const n=B(r),i=D(()=>O(e,n.current),[]),a=o();return z(a.Provider,{value:i,children:t})},(e,t)=>{const n=o(),i=F(n)??r,a=B(e);a.current=e;const s=B({hasValue:!1,value:void 0}),l=N(()=>{const e=a.current(i.getState()),o=s.current;return o.hasValue&&t&&t(o.value,e)?o.value:(s.current={hasValue:!0,value:e},e)},[i,t]),c=N(()=>a.current(i.getState()),[i]);return E(i.subscribe,l,c)}]}function O(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 W(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 j(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t={...t,colors:{...t.colors,categorical:Y}}),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 Y=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],G={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}},q={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}},V={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:Y,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 X(e,t){if("light"===t)return G;if("dark"===t)return q;if("high-contrast"===t)return V;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?q:G;return j({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}return j({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}var[U,K]=H(e=>({theme:G,setTheme(t){e(e=>({theme:X(e.theme,t)}))}})),Q=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,a=this.buffer[i];if(e(a)){let e;e="object"!=typeof a||null===a?a:Array.isArray(a)?[...a]:{...a},o.push(e),this.buffer[i]=t(a)}}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}},Z=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 J(e,t){return e===t}function ee(e,t){if("function"==typeof e)return t=>+e(t);const o=e||t;return e=>+e[o]}function te(e,t){if("function"==typeof e)return e;const o=e||t;return e=>e[o]}function oe(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}var re=/^\d{4}-\d{1,2}$/;function ne(e){const t=e.trim();if(!t||!Number.isNaN(Number(t)))return NaN;const o=re.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 ie(e){return e instanceof Date?e.getTime():"string"==typeof e?ne(e):+e}function ae(e){return new Set(Array.isArray(e)?e:[e])}import{scaleOrdinal as se}from"d3-scale";function le(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function ce(e,t,o){const r=e=>e.toString(16).padStart(2,"0");return`#${r(e)}${r(t)}${r(o)}`}function ue(e){const t=e.map(le),o=t.length-1;return e=>{if(0>=e){const[e,o,r]=t[0];return ce(e,o,r)}if(e>=1){const[e,r,n]=t[o];return ce(e,r,n)}const r=e*o,n=Math.floor(r),i=r-n,[a,s,l]=t[n],[c,u,d]=t[n+1];return ce(Math.round(a+(c-a)*i),Math.round(s+(u-s)*i),Math.round(l+(d-l)*i))}}var de=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],he=ue(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),pe=ue(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),fe=ue(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),me=ue(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),ge=ue(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),ye=ue(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),be=ue(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),ve=ue(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),xe=ue(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),we=ue(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),ke=ue(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),Se=ue(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]),Ae={blues:he,reds:pe,greens:fe,viridis:be,oranges:me,purples:ge,greys:ye,plasma:ve,inferno:xe,magma:we,cividis:ke,turbo:Se};function Ce(e){return e&&Ae[e]||he}var Me=ue(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),Pe=ue(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),_e=ue(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),Le=ue(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),Re=ue(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),Ie=ue(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),$e=ue(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]),Te={category10:de,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],...Ae},Ne=de,Fe=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],De=["#f0f0f0","#b5d4ea","#f4c2a1","#b8dab2","#d4b5e0","#f9e0a2","#a8d8d8"],Be=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 Ee(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")||Be.has(t)}(r)?o(r):r}const r=e?.[t]+"";return o?o(r):Ne[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))%Ne.length]}function ze(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 He(e,t,o="category10"){if(o&&"object"==typeof o&&!Array.isArray(o)){const e=o;return t=>ze(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 se().domain(r).range(o).unknown("#999");const i=Te[o]||Te.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:Ne;return se().domain(r).range(e).unknown("#999")}}function Oe(e,t,o=[3,20],r){let n;if(n="function"==typeof t?t(e):e?.[t],!r)return n;const[i,a]=r,[s,l]=o;if(a===i)return(s+l)/2;let c=(n-i)/(a-i);return 0>c?c=0:c>1&&(c=1),s+c*(l-s)}function We(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}function je(e,t){return Math.min((e-t.startTime)/t.duration,1)}function Ye(e,t,o){return e+(t-e)*o}function Ge(){return"undefined"!=typeof performance?performance.now():Date.now()}function qe(e,t,o={}){return Number.isFinite(t)&&t>0?Number.isNaN(e)?"fresh":e===1/0?"expired":0>e||t*(o.fresh??1)>e?"fresh":t*(o.aging??1.5)>e?"aging":t*(o.stale??3)>e?"stale":"expired":"fresh"}function Ve(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 Xe(e){const{data:t,encoding:o}=e,r=[],n=new Map;return t.forEach((e,t)=>{const i=Ve(o.id,e,t);if(null==i||""===i)throw Error(`[semiotic] Motion encoding row ${t} resolved an empty id.`);const a=i+"";if(n.has(a))throw Error(`[semiotic] Duplicate motion encoding id "${a}".`);const s=Ve(o.process?.group,e,t),l=Ve(o.process?.stage,e,t),c=Ve(o.accessible?.group,e,t)??(null!=s?s+"":null!=l?l+"":void 0),u={};for(const r of Object.keys(o.evidence??{}))u[r]=Ve(o.evidence?.[r],e,t);const d={id:a,datum:e,time:{arrival:Ve(o.time?.arrival,e,t),basis:o.time?.basis,unit:o.time?.unit},placement:{x:Ve(o.placement?.x,e,t),y:Ve(o.placement?.y,e,t),lane:Ve(o.placement?.lane,e,t),space:o.placement?.space},kinematics:{velocityX:Ve(o.kinematics?.velocityX,e,t),velocityY:Ve(o.kinematics?.velocityY,e,t),space:o.kinematics?.space},process:{group:s,stage:l,target:Ve(o.process?.target,e,t),work:Ve(o.process?.work,e,t)},evidence:u,accessible:{description:Ve(o.accessible?.description,e,t),group:c,label:Ve(o.accessible?.label,e,t)??a}};r.push(d),n.set(a,d)}),{rows:r,byId:n}}function Ue(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 Ke(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 Qe(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 Ze(e,t,o){return Number.isFinite(o)&&o>0?Qe((t.x-e.x)/o,(t.y-e.y)/o):Qe(0,0)}function Je(e,t,o){if(1>=o)return 1;const r=o-1;return Ke({age:r-t,extent:r,type:e.type,halfLife:e.halfLife??o/2,threshold:e.stepThreshold??.5*o,minOpacity:e.minOpacity??.1})}function et(e){const t=new Map;for(let o=0;e.length>o;o++)t.set(e[o],o);return t}function tt(e,t,o){const r=e.duration??500,n=o-t;return r>n?1-n/r:0}function ot(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 rt(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 nt(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 it(e,t,o,r,n,i){const a=[];for(const n of e){const e=o(n),i=r(n);Number.isFinite(e)&&Number.isFinite(i)&&a.push({px:t.x(e),py:t.y(i),rawY:i,d:n})}a.sort((e,t)=>e.px-t.px);const s=Array(a.length),l=Array(a.length),c=Array(a.length);for(let e=0;a.length>e;e++){const t=a[e];s[e]=[t.px,t.py],l[e]=t.rawY,c[e]=t.d}return{type:"line",path:s,rawValues:l,style:n,datum:c,group:i}}function at(e,t,o,r,n,i,a,s){const l=[];for(const i of e){const e=o(i),a=r(i);if(!Number.isFinite(e)||!Number.isFinite(a))continue;const c=t.x(e),u=s?s(i):n;l.push({px:c,topY:t.y(a),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:a}}function st(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],a=e[r];let s=0,l=0,c=0;for(const e of t){const t=o(e,a)||0;s+=(2*c+t)*(t-(o(e,i)||0)),l+=t,c+=t}const u=n.get(i)??0;n.set(a,u-(l>0?s/(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 lt(e,t,o,r,n,i,a){const s=o(e),l=r(e);if(!Number.isFinite(s)||!Number.isFinite(l))return null;const c={type:"point",x:t.x(s),y:t.y(l),r:n,style:i,datum:e};return void 0!==a&&(c.pointId=a),c}function ct(e,t,o,r,n,i,a,s){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:a,datum:e};return void 0!==s&&(u.pointId=s),u}function ut(e,t,o,r,n,i,a){return{type:"rect",x:e,y:t,w:o,h:r,style:n,datum:i,group:a}}function dt(e,t,o,r,n,i,a){const s={type:"heatcell",x:e,y:t,w:o,h:r,fill:n,datum:i};return a?.showValues&&(s.showValues=!0,s.value=a.value,a.valueFormat&&(s.valueFormat=a.valueFormat)),s}function ht(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 pt(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 a=r.getTop(o),s=r.getBottom(o);if(!Number.isFinite(a)||!Number.isFinite(s))continue;const l=e.scales.x(t),c=e.scales.y(a),u=e.scales.y(s);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:ht(e,r,o,t[0]),datum:t,group:o,interactive:r.interactive}}function ft(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 mt(e,t,o){const r=[];for(const n of o){const o=pt(e,t,"__ribbon_aggregate",n);o&&r.push(o)}return r}function gt(e,t,o,r){const n=[];for(const i of r){const r=pt(e,t,o,i);r&&n.push(r)}return n}function yt(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 bt(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 a=r.r??3,s=e.getPointId?e.getPointId(i)+"":void 0,l=lt(i,e.scales,e.getX,n,a,r,s);l&&o.push(l)}}}var vt={topOpacity:.8,bottomOpacity:.05};function xt(e){if(e)return!0===e?vt:"colorStops"in e?e:{topOpacity:e.topOpacity??vt.topOpacity,bottomOpacity:e.bottomOpacity??vt.bottomOpacity}}import{symbol as wt,symbolCircle as kt,symbolCross as St,symbolDiamond as At,symbolSquare as Ct,symbolStar as Mt,symbolTriangle as Pt,symbolWye as _t}from"d3-shape";var Lt={circle:kt,square:Ct,triangle:Pt,diamond:At,star:Mt,cross:St,wye:_t},Rt=["circle","triangle","diamond","star","square","chevron","cross","wye"];function It(e,t,o){if(o)return o;const r=e??"circle";return"chevron"===r?function(e){const t=1.5*$t(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):wt(Lt[r]??kt,Math.max(1,t))()??""}function $t(e){return Math.sqrt(Math.max(1,e)/Math.PI)}var Tt=new Map;function Nt(e,t,o,r,n){const i=new Map;for(const a of e){const e=t(a),s=o(a);if(null==e||null==s||Number.isNaN(e)||Number.isNaN(s))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+=s,n){const e=n(a);c.categories.set(e,(c.categories.get(e)||0)+s)}}return i}function Ft(e){if("production"===process.env.NODE_ENV)return;const{label:t,nodes:o,overlays:r,warned:n}=e;Dt(r)&&0===o.length&&Bt(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)&&Bt(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 Dt(e){return null!=e&&!1!==e&&""!==e&&(!Array.isArray(e)||e.some(Dt))}function Bt(e,t,o){e.has(t)||(e.add(t),console.warn(o))}function Et(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 zt(e,t){const o="function"==typeof e?e:o=>o[e||t];return e=>{const t=o(e);return null==t?NaN:+t}}function Ht(e){const t=[],o=["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode,r=zt(o&&e.valueAccessor||e.yAccessor,o?"value":"y");if(e.boundsAccessor){const o=ee(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:zt(e.y1Accessor,"y1"),getBottom:zt(e.y0Accessor,"y0"),style:e.style,perSeries:!1!==e.perSeries,interactive:!0===e.interactive})}return t}import{scaleLinear as Ot,scaleLog as Wt,scaleSymlog as jt,scaleTime as Yt}from"d3-scale";function Gt(e,t){return t?[t[0]??e[0],t[1]??e[1]]:e}function qt(e,t,o){if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return Wt().domain(e).range(o).clamp(!0)}return"symlog"===e?jt().domain(t).range(o):"time"===e?Yt().domain([new Date(t[0]),new Date(t[1])]).range(o):Ot().domain(t).range(o)}function Vt(e,t,o){t>e.capacity&&(e.resize(t),o&&t>o.capacity&&o.resize(t))}function Xt(e,t){const o=new Q(e.capacity);return e.forEach(()=>o.push(t)),o}function Ut(e,t,o,r){const n=e.push(t);return o&&o.push(r),n}function Kt(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 Qt={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 Zt(e,t){const o={...e};for(const e of t)o[Qt[e]]++;return o}function Jt(e,t,o){const r=new Set(t);return{changeSet:{...e,...e.keys?{keys:[...e.keys]}:{}},changed:r,revisions:Zt(o,r)}}var eo=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=Jt({kind:"initialize"},[],this.revisions)}get last(){return this.latest}record(e,t){const o=Jt(e,t,this.revisions);return this.revisions=o.revisions,this.latest=o,o}},to=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],oo=["scene-style","data-paint","accessibility","evidence"],ro=new Set(["lineStyle","pointStyle","areaStyle","barStyle","swarmStyle","waterfallStyle","candlestickStyle","boundsStyle","colorScheme","themeCategorical","themeSemantic","barColors"]),no=class{constructor(){this.tracker=new eo}get last(){return this.tracker.last}recordData(e,t){return this.tracker.record({kind:e,...void 0===t?{}:{count:t}},to)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},oo):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=>ro.has(e))&&o.add("scene-style"),o}(e,o):[])}};import{quadtree as io}from"d3-quadtree";var ao=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=io().x(e=>e.x).y(e=>e.y).addAll(n)}},so=class e{constructor(e){if(this.xExtent=new Z,this.yExtent=new Z,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 no,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 ao,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 a=e.color??"rgba(255,255,255,0.6)",s=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,s=!1;for(const o of t){const t=c.get(o);if(null==t)continue;s=!0;const a=r.get(t);if(null==a)continue;const l=tt(e,a,i);l>n&&(n=l)}s&&(l=ot(o,n,a)||l);continue}const t=c.get(o.datum);if(null==t)continue;const n=r.get(t);l=ot(o,null==n?0:tt(e,n,i),a,s)||l}return l}(this.config.pulse,e,t,this.timestampBuffer,this.getDatumIndexMap(t),o),this._stylePaintPending=!1,this.config=e,this.buffer=new Q(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=ee(e.timeAccessor||e.xAccessor,"time"),this.getY=ee(e.valueAccessor||e.yAccessor,"value")):(this.getX=ee(e.xAccessor,"x"),this.getY=ee(e.yAccessor,"y")),this.getGroup=oe(e.groupAccessor),this.getCategory=oe(e.categoryAccessor),this.getSize=e.sizeAccessor?ee(e.sizeAccessor,"size"):void 0,this.getColor=oe(e.colorAccessor),this.getSymbol=oe(e.symbolAccessor),this.getY0=e.y0Accessor?ee(e.y0Accessor,"y0"):void 0,this.resolvedRibbons=Ht(e),this.getPointId=oe(e.pointIdAccessor),"candlestick"===e.chartType){const t=null!=e.openAccessor,o=null!=e.closeAccessor;this.getOpen=t?ee(e.openAccessor,"open"):void 0,this.getHigh=ee(e.highAccessor,"high"),this.getLow=ee(e.lowAccessor,"low"),this.getClose=o?ee(e.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!t&&!o}e.pulse&&(this.timestampBuffer=new Q(e.windowSize))}syncPulseTimestampBuffer(){this.config.pulse?null!=this.timestampBuffer&&this.timestampBuffer.capacity===this.buffer.capacity&&this.timestampBuffer.size===this.buffer.size||(this.timestampBuffer=Xt(this.buffer,Ge())):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=Ge();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?ee(this.config.timeAccessor||this.config.xAccessor,"time"):ee(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(ne(r));if(this.xIsDate=n||i,i){const e="string"==typeof o?o:void 0;this.getX=e?t=>ie(t[e]):e=>ie(o(e))}}Vt(this.buffer,e.totalSize||e.inserts.length,this.timestampBuffer);for(const o of e.inserts)Ut(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=Ut(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(),a=this.yExtent.extent;let s=Gt(this.xExtent.extent,t.xExtent),l=Gt(a,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 a=`${e.bufferSize}:${e.ingestVersion}:${t.baseline??"zero"}:${t.stackOrder??"key"}`;if(e.stackExtentCache&&e.stackExtentCache.key===a)return{yDomain:e.stackExtentCache.yDomain,stackExtentCache:e.stackExtentCache};const s=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),a=n(i);if(!Number.isFinite(e)||!Number.isFinite(a))continue;t.set(e,(t.get(e)||0)+a),l.add(e),o+=a;const s=(u.get(e)||0)+a;u.set(e,s),s>c&&(c=s)}s.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,m;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=st(e,f,(e,t)=>s.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 a=n-r,c=i?0:a>0?a*t.extentPadding:1;m=[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,a=0;for(const r of t){const t=o(r,i)||0;0>t?a+=t:e+=t}r>a&&(r=a),e>n&&(n=e)}return[r,n]}(e,f,(e,t)=>s.get(e)?.get(t)||0),n=r-o,a=i?0:n>0?n*t.extentPadding:1;m=[o-a,r+a]}else m=[0,c+(i?0:c>0?c*t.extentPadding:1)];return{yDomain:m,stackExtentCache:{key:a,yDomain:m}}}({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,a){const[,s]=function(e,t,o,r,n){const i=Nt(e,t,o,r,n);if(0===i.size)return[0,0];let a=0;for(const e of i.values())e.total>a&&(a=e.total);return[0,a]}(e,t,o,r,n);return[0,a?s:s+s*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),a=i-n,s=r?0:a>0?a*o:1;return[Math.min(0,n-Math.abs(s)),Math.max(0,i+Math.abs(s))]}(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:a}));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:s,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}}(s,l,t.xScaleType)),this.scales=function(e){const{config:t,layout:o,xDomain:r,yDomain:n}=e,i="streaming"===t.runtimeMode,a=Math.max(0,Math.min(t.scalePadding||0,Math.min(o.width,o.height)/2-1));if(i){if("x"==("up"===(s=t.arrowOfTime)||"down"===s?"y":"x")){const e="right"===t.arrowOfTime?[a,o.width-a]:[o.width-a,a];return{x:Ot().domain(r).range(e),y:qt(t.yScaleType,n,[o.height-a,a])}}const e="down"===t.arrowOfTime?[a,o.height-a]:[o.height-a,a];return{x:qt(t.yScaleType,n,[a,o.width-a]),y:Ot().domain(r).range(e)}}var s;return{x:qt(t.xScaleType,r,[a,o.width-a]),y:qt(t.yScaleType,n,[o.height-a,a])}}({config:t,layout:e,xDomain:s,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(),a=this.scales.y.range(),s=qt,l=Math.max(0,Math.min(this.config.scalePadding||0,Math.min(e.width,e.height)/2-1)),c=a[1]>a[0];this.scales={x:s(this.config.xScaleType,r,i[0]>i[1]?[e.width-l,l]:[l,e.width-l]),y:s(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??Fe},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=Et("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 a=i.nodes??[];if(this._customRestyle=i.restyle,this.hasCustomRestyle=!!i.restyle,this.hasCustomRestyle){this._baseStyles=new WeakMap;for(const e of a)e.style&&this._baseStyles.set(e,e.style);this.applyCustomRestyle(a,o.layoutSelection??null)}return Ft({label:"customLayout",nodes:a,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned}),a}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}=ft(e.ribbons);if(i.length>0&&r.push(...mt(e,t,i)),n.length>0)for(const t of o)r.push(...gt(e,t.data,t.key,n))}for(const t of o){const o=e.resolveLineStyle(t.key,t.data[0]),i=it(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 bt(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}=ft(e.ribbons);if(i.length>0&&r.push(...mt(e,t,i)),n.length>0)for(const t of o)r.push(...gt(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]),a=at(t.data,e.scales,e.getX,e.getY,n,o,t.key,i),s=xt(e.config.gradientFill);s&&(a.fillGradient=s),e.config.curve&&"linear"!==e.config.curve&&(a.curve=e.config.curve),e.config.lineGradient&&(a.strokeGradient=e.config.lineGradient),r.push(a)}return bt(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}=ft(e.ribbons);if(i.length>0&&r.push(...mt(e,t,i)),n.length>0)for(const t of o)r.push(...gt(e,t.data,t.key,n))}const i=e.scales.y.domain()[0],a=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=at(t.data,e.scales,e.getX,e.getY,i,o,t.key,a),s=xt(e.config.gradientFill);s&&(n.fillGradient=s),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=it(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 bt(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 a=0,s=0;for(const o of e)s>a?(r.push(o),a+=t.get(o.key)??0):(i.push(o),s+=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,a=e.config.normalize?"zero":e.config.baseline??"zero",{nodes:s,stackedTops:l}=function(e,t,o,r,n,i,a,s="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=st(c,e.map(e=>e.key),(e,t)=>u.get(e)?.get(t)||0,s),p="diverging"===s&&!i,f=[],m=new Map,g=new Map,y=new Map,b=new Map;for(const e of c)g.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 s=[],l=[];const h=()=>{if(s.length>=2){const e={type:"area",topPath:s,bottomPath:l,style:n(o.key,o.data[0]),datum:o.data,group:o.key};a&&(e.curve=a),f.push(e)}s=[],l=[]};for(const o of c){const n=e.has(o);let a,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?(a=y.get(o),c=a+u,y.set(o,c)):(a=b.get(o),c=a+u,b.set(o,c)):(a=g.get(o),c=a+u,g.set(o,c));const f=t.x(o);l.push([f,t.y(a)]),s.push([f,t.y(c)]),r.set(o,c)}h(),m.set(o.key,r)}return{nodes:f,stackedTops:m}}(o,e.scales,e.getX,e.getY,(t,o)=>e.resolveAreaStyle(t,o),e.config.normalize,i,a),c=s;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);bt(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 a=e.getColor?e.resolveColorMap(t):null,s=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=Rt[d%Rt.length],d++,u.set(e,o)),o};for(const n of t){let t=e.config.pointStyle?e.config.pointStyle(n):{fill:s,opacity:.8},c=t.r||r;if(i&&e.getSize){const t=e.getSize(n);null==t||Number.isNaN(t)||(c=i(t))}if(a&&e.getColor&&!t.fill){const o=e.getColor(n);o&&a.has(o)&&(t={...t,fill:a.get(o)})}const u=e.getPointId?e.getPointId(n)+"":void 0;if(l){const r=h(l(n)+""),i=ct(n,e.scales,e.getX,e.getY,Math.PI*c*c,r,t,u);i&&o.push(i)}else{const r=lt(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",a=ee(e.config.valueAccessor,"value");if(!e.scales||0===t.length)return[];const[s,l]=e.scales.x.domain(),[c,u]=e.scales.y.domain(),d=(l-s||1)/r,h=(u-c||1)/n,p=r*n;if(p>1e6)return[];const f=new Int32Array(p),m=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-s)/d),r-1),g=Math.min(Math.floor((u-c)/h),n-1);if(0>p||0>g)continue;const y=g*r+p;f[y]++;const b=a(i);m[y]+=isFinite(b)?b:0}let g=1/0,y=-1/0;for(let e=0;p>e;e++){if(0===f[e])continue;let t;switch(i){case"sum":t=m[e];break;case"mean":t=m[e]/f[e];break;default:t=f[e]}g>t&&(g=t),t>y&&(y=t)}if(!isFinite(g))return[];const b=y-g||1,v=o.width/r,x=o.height/n,w=e.config.showValues,k=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 a;switch(i){case"sum":a=m[r];break;case"mean":a=m[r]/f[r];break;default:a=f[r]}const l=(a-g)/b;S.push(dt(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:a,count:f[r],sum:m[r],xCenter:s+(o+.5)*d,yCenter:c+(e+.5)*h,agg:i},w?{value:a,showValues:!0,valueFormat:k}:void 0))}}return S}(e,t,o);if(0===t.length)return[];const r=ee(e.config.valueAccessor,"value"),n=te(e.config.xAccessor,"x"),i=te(e.config.yAccessor,"y"),a=new Map,s=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,a.has(r)||a.set(r,a.size),s.has(u)||s.set(u,s.size)}const u=a.size,d=s.size;if(0===u||0===d)return[];const h=Array.from(a.keys()),p=Array.from(s.keys()),f=h.every(e=>"number"==typeof e&&!isNaN(e)),m=p.every(e=>"number"==typeof e&&!isNaN(e));if(f){h.sort((e,t)=>e-t),a.clear();for(let e=0;h.length>e;e++)a.set(h[e],e)}if(m){p.sort((e,t)=>e-t),s.clear();for(let e=0;p.length>e;e++)s.set(p[e],e)}const g=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=a.get(l[e]),i=s.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)),g[f]=h,y[f]=d,b[f]=o}let w=1/0,k=-1/0;for(let e=0;x>e;e++){const t=y[e];isFinite(t)&&(w>t&&(w=t),t>k&&(k=t))}if(!isFinite(w)||!isFinite(k))return[];const S=function(e){const t=e in Ae?e:"blues";let o=Tt.get(t);if(o)return o;o=Array(256);const r=Ce(t);for(let e=0;256>e;e++)o[e]=r(e/255);return Tt.set(t,o),o}("string"==typeof e.config.colorScheme?e.config.colorScheme:e.config.themeSequential||"blues"),A=255/(k-w||1),C=o.width/u,M=o.height/d,P=e.config.showValues,_=e.config.heatmapValueFormat,L=[];for(let e=0;x>e;e++){const t=y[e];if(!isFinite(t))continue;const o=g[e],r=o%u;L.push(dt(r*C,(d-1-(o-r)/u)*M,C,M,S[Math.min((t-w)*A+.5|0,255)],b[e],P?{value:t,showValues:!0,valueFormat:_}:void 0))}return L}(n,t,e);case"bar":{const e=function(e,t){if(!e.config.binSize)return{nodes:[],binBoundaries:[]};const o=Nt(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),a=Array.from(t).filter(e=>!i.has(e)).sort(),s=n.filter(e=>t.has(e)),l=s.join("\0")+""+a.join("\0");e.barCategoryCache&&e.barCategoryCache.key===l?r=e.barCategoryCache.order:(r=[...s,...a],e.barCategoryCache={key:l,order:r})}const n=[],i=e.scales,[a,s]=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,a),u=Math.min(t.end,s);if(o>=u)continue;const p=i.x(o),f=i.x(u),m=Math.abs(f-p),g=m>d+1?d:0,y=Math.min(p,f)+g/2,b=Math.max(m-g,1);if(b>0)if(r&&t.categories.size>0){let o=0;for(const a of r){const r=t.categories.get(a)||0;if(0===r)continue;const s=i.y(o),u=i.y(o+r);n.push(ut(y,Math.min(s,u),b,Math.abs(s-u),{fill:e.config.barColors?.[a]||l?.fill||c||"#4e79a7",...h},{binStart:t.start,binEnd:t.end,total:t.total,category:a,categoryValue:r},a)),o+=r}}else{const e=i.y(0),o=i.y(t.total);n.push(ut(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",a=r.opacity??.7,s=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)??{},m={type:"point",x:u,y:d,r:p??n,style:{fill:h,opacity:a,stroke:s,strokeWidth:l,...f},datum:r};e.getPointId&&(m.pointId=e.getPointId(r)+""),o.push(m)}return o}(n,t);case"waterfall":return function(e,t,o){const r=[],n=e.scales,i=e.config.waterfallStyle,a=t.filter(t=>{const o=e.getY(t),r=e.getX(t);return null!=o&&!Number.isNaN(o)&&null!=r&&isFinite(r)});if(0===a.length)return r;const s=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;a.length>t;t++){const f=a[t],m=e.getX(f),g=e.getY(f),y=p+g;let b;b=a.length-1>t?e.getX(a[t+1])-m:t>0?m-e.getX(a[t-1]):0;const v=n.x(m),x=0!==b?n.x(m+b):v+o.width/10,w=Math.min(v,x)+c/2,k=Math.max(v,x)-c/2-w;if(0>=k){p=y;continue}const S=n.y(p),A=n.y(y),C=Math.min(S,A),M=Math.abs(S-A),P={fill:0>g?l:s,stroke:u,strokeWidth:d};null!=h&&(P.opacity=h),r.push(ut(w,C,k,M,P,{...f,baseline:p,cumEnd:y,delta:g,_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",a=o?i:n.upColor||"#28a745",s=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,m={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:a,downColor:s,wickColor:l,wickWidth:c,isUp:f,datum:n};o&&(m.isRange=!0),r.push(m)}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?Je(o,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._ingestVersion)return this._datumIndexCache.map;const t=et(e);return this._datumIndexCache={version:this._ingestVersion,map:t},t}applyDecay(e,t){this.config.decay&&function(e,t,o,r=et(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 a=!1;for(let o=0;t.length>o;o++){const s=r.get(t[o]);null!=s?(i[o]=Je(e,s,n),1>i[o]&&(a=!0)):i[o]=1}a&&(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 a=Array(i);let s=!1;for(let o=0;t.length>o;o++){const i=r.get(t[o]);null!=i?(a[o]=Je(e,i,n),1>a[o]&&(s=!0)):a[o]=1}s&&(o._decayOpacities=a)}else{let a=1;for(const o of t){const t=r.get(o);if(null!=t){const o=Je(e,t,n);a>o&&(a=o)}}if(1>a){const e=Array(i);e.fill(a),o._decayOpacities=e}}continue}const t=r.get(o.datum);if(null==t)continue;const i=Je(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&&rt(this.config.pulse,this.timestampBuffer,e)}get hasActivePulses(){return this.hasActivePulsesAt(Ge())}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],a=nt(e,i,n);a&&("point"===i.type?o.set(a,{x:i.x,y:i.y,r:i.r,opacity:i.style.opacity}):"glyph"===i.type?o.set(a,{x:i.x,y:i.y,r:i.size,opacity:i.style.opacity,glyph:i.glyph}):"rect"===i.type?o.set(a,{x:i.x,y:i.y,w:i.w,h:i.h,opacity:i.style.opacity}):"heatcell"===i.type?o.set(a,{x:i.x,y:i.y,w:i.w,h:i.h,opacity:i.style?.opacity}):"candlestick"===i.type?o.set(a,{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(a,{path:i.path.map(e=>[e[0],e[1]]),opacity:i.style?.opacity}):"area"===i.type&&r.set(a,{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=nt(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 a=!1;const s=new Set,l=new Set;for(let t=0;o.scene.length>t;t++){const i=o.scene[t],c=nt(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]];a=!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]];a=!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},a=!0;continue}const u=r.get(c);if("point"===i.type)if(u){s.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,a=!0)}else i._targetOpacity=i.style.opacity??1,i.style={...i.style,opacity:0},a=!0;else if("glyph"===i.type)if(u){s.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,a=!0)}else i._targetOpacity=i.style.opacity??1,i.style={...i.style,opacity:0},a=!0;else if("rect"===i.type)if(u){s.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,a=!0)}else i._targetOpacity=i.style.opacity??1,i.style={...i.style,opacity:0},a=!0;else if("heatcell"===i.type)if(u){s.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,a=!0)}else i._targetOpacity=i.style?.opacity??1,i.style={...i.style||{},opacity:0},a=!0;else if("candlestick"===i.type)if(u&&null!=u.openY){s.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,a=!0)}else i._targetOpacity=i.style?.opacity??1,i.style={...i.style||{},opacity:0},a=!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),a=!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),a=!0}for(const[e,t]of r)if(!s.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})}a=!0}return o.exitNodes.length>0&&(o.scene=[...o.scene,...o.exitNodes]),a&&(o.activeTransition={startTime:Ge(),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=je(e,o.activeTransition),i=We(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=Ye(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=Ye(o.x,e._targetX,i),e.y=Ye(o.y,e._targetY,i),void 0!==e._targetR&&void 0!==o.r&&(e.r=Ye(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=Ye(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=Ye(o.x,e._targetX,i),e.y=Ye(o.y,e._targetY,i),void 0!==e._targetR&&void 0!==o.r&&(e.size=Ye(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=Ye(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=Ye(o.x,e._targetX,i),e.y=Ye(o.y,e._targetY,i),void 0!==o.w&&(e.w=Ye(o.w,e._targetW,i)),void 0!==o.h&&(e.h=Ye(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:Ye(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=Ye(o.x,e._targetX,i),e.y=Ye(o.y,e._targetY,i),void 0!==o.w&&(e.w=Ye(o.w,e._targetW,i)),void 0!==o.h&&(e.h=Ye(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:Ye(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=Ye(o.x,e._targetX,i),void 0!==o.openY&&(e.openY=Ye(o.openY,e._targetOpenY,i)),void 0!==o.closeY&&(e.closeY=Ye(o.closeY,e._targetCloseY,i)),void 0!==o.highY&&(e.highY=Ye(o.highY,e._targetHighY,i)),void 0!==o.lowY&&(e.lowY=Ye(o.lowY,e._targetLowY,i))}else if("line"===e.type){void 0!==e._targetOpacity&&(e.style={...e.style,opacity:Ye(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]=Ye(t[r][0],o[r][0],i),e.path[r][1]=Ye(t[r][1],o[r][1],i)}else if("area"===e.type){void 0!==e._targetOpacity&&(e.style={...e.style,opacity:Ye(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]=Ye(t[o][0],r[o][0],i),e.topPath[o][1]=Ye(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]=Ye(o[t][0],n[t][0],i),e.bottomPath[t][1]=Ye(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 a=Array.from(i).sort(),s=a.join("\0");if(n&&n.key===s){const e={...n,version:r};return{map:e.map,cache:e}}const l=Array.isArray(o.colorScheme)?o.colorScheme:o.themeCategorical||Fe,c=new Map;for(let e=0;a.length>e;e++)c.set(a[e],l[e%l.length]);return{map:c,cache:{key:s,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 a=r(t)||i||"#4e79a7";return{fill:a,fillOpacity:.7,stroke:a,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:a}=e;if(o){const e=o.map.get(t);if(e)return{color:e,groupColorCounter:a}}const s=r.get(t);if(s)return{color:s,groupColorCounter:a};const l=(Array.isArray(i.colorScheme)&&i.colorScheme.length>0?i.colorScheme:null)||(Array.isArray(i.themeCategorical)&&i.themeCategorical.length>0?i.themeCategorical:null)||Fe;if(0===l.length)return{color:null,groupColorCounter:a};const c=l[a%l.length];if(a++,r.set(t,c),r.size>n){const e=r.keys().next().value;void 0!==e&&r.delete(e)}return{color:c,groupColorCounter:a}}({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=ae(e),o=this.getPointId,r=e=>t.has(o(e));Kt(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=Ge(),this.updateResults.recordData("remove",n.length),n}update(e,t){if(!this.getPointId)throw Error("update() requires pointIdAccessor to be configured");const o=ae(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=Ge(),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,a=e&&t.valueAccessor||t.yAccessor,s=i||!J(e&&this.config.timeAccessor||this.config.xAccessor,e&&t.timeAccessor||t.xAccessor),l=i||!J(o,a);(s||l)&&(e?(this.getX=ee(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=ee(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=ee(this.config.xAccessor,"x"),this.getY=ee(this.config.yAccessor,"y")),l&&this.resolvedRibbons.some(e=>"bounds"===e.kind)&&(this.resolvedRibbons=Ht(this.config)),r=!0,n=!0)}if("groupAccessor"in e&&!J(e.groupAccessor,t.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?oe(this.config.groupAccessor):void 0,r=!0),"categoryAccessor"in e&&!J(e.categoryAccessor,t.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?oe(this.config.categoryAccessor):void 0,r=!0),"sizeAccessor"in e&&!J(e.sizeAccessor,t.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?ee(this.config.sizeAccessor,"size"):void 0,r=!0),"symbolAccessor"in e&&!J(e.symbolAccessor,t.symbolAccessor)&&(this.getSymbol=null!=this.config.symbolAccessor?oe(this.config.symbolAccessor):void 0,r=!0),"colorAccessor"in e&&!J(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?oe(this.config.colorAccessor):void 0,r=!0),"y0Accessor"in e&&!J(e.y0Accessor,t.y0Accessor)&&(this.getY0=this.config.y0Accessor?ee(this.config.y0Accessor,"y0"):void 0,r=!0,n=!0),("boundsAccessor"in e&&!J(e.boundsAccessor,t.boundsAccessor)||"band"in e&&e.band!==t.band||"boundsStyle"in e&&e.boundsStyle!==t.boundsStyle)&&(this.resolvedRibbons=Ht(this.config),r=!0,n=!0),"pointIdAccessor"in e&&!J(e.pointIdAccessor,t.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?oe(this.config.pointIdAccessor):void 0,r=!0),"candlestick"===this.config.chartType&&(i||"openAccessor"in e&&!J(e.openAccessor,t.openAccessor)||"closeAccessor"in e&&!J(e.closeAccessor,t.closeAccessor)||"highAccessor"in e&&!J(e.highAccessor,t.highAccessor)||"lowAccessor"in e&&!J(e.lowAccessor,t.lowAccessor))){const e=null!=this.config.openAccessor,t=null!=this.config.closeAccessor;this.getOpen=e?ee(this.config.openAccessor,"open"):void 0,this.getHigh=ee(this.config.highAccessor,"high"),this.getLow=ee(this.config.lowAccessor,"low"),this.getClose=t?ee(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}};so.GROUP_COLOR_MAP_CAP=1e3;var lo=so,co={sceneGeometry:0,layout:0,domain:0},uo="production"!==process.env.NODE_ENV,ho={revisions:co,signature:"",sawSignals:!1,wasUnconsumed:!1,warnUnconsumed:!1},po=class{constructor(){this.lastConsumed=co,this.lastDuplicateWarning="",this.lastUnconsumedWarning=""}beforeCompute(e,t){if(!uo)return ho;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===(a=this.lastConsumed).sceneGeometry&&i.layout===a.layout&&i.domain===a.domain);var i,a;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(uo){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="")}}};import*as fo from"react";function mo(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:fo.createElement(fo.Fragment,null,...t)}import*as go from"react";import{jsx as yo}from"react/jsx-runtime";var bo={isActive:!1,predicate:()=>!0},vo=go.createContext(null);function xo({value:e,children:t}){return yo(vo.Provider,{value:e,children:t})}function wo(){return go.useContext(vo)??bo}function ko(e,t){return null!=e?yo(xo,{value:t,children:e}):e}import{useEffect as So,useRef as Ao}from"react";function Co(e,t,o,r){So(()=>{e.current?.updateConfig(t),o.current=!0,r()},[t,r,e,o])}function Mo(e,t,o,r){const n=Ao(null);So(()=>{const i=e.current;if(!i)return;const a=t??null;n.current!==a&&(n.current=a,i.setLayoutSelection(a),i.hasCustomRestyle?i.restyleScene(a):o.current=!0,r())},[t,r,e,o])}function Po(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 _o(e,t=30){return Math.max((e??4)+5,12,t)}function Lo(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function Ro(e,t){const o=Lo(e);if(!o)return!1;const r=Lo(t);return!r||o.getFullYear()!==r.getFullYear()||o.getMonth()!==r.getMonth()}function Io(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}var $o=[40,40],To=[.5,.5];function No(e,t){const[o,r]=e.viewBox??$o,[n,i]=e.anchor??To,a=r>0?r:1,s=Math.max(0,t)/a,l=(o>0?o:a)*s,c=a*s;return{width:l,height:c,scale:s,offsetX:-n*l,offsetY:-i*c}}function Fo(e,t,o,r){if("none"!==e)return"color"===e||null==e?t??r:"accent"===e?o:e}var Do=null;function Bo(e){if("undefined"==typeof Path2D)return null;Do||(Do=new Map);const t=Do.get(e);if(t)return t;const o=new Path2D(e);return Do.size>1024&&Do.clear(),Do.set(e,o),o}function Eo(e,t,o=0,r="horizontal"){const[n,i]=e.viewBox??$o,a=Math.min(1,Math.max(0,o)),s=Math.min(1,Math.max(0,t));return s>a?a>0||1>s?"vertical"===r?{x:0,y:i*(1-s),width:n,height:i*(s-a)}:{x:n*a,y:0,width:n*(s-a),height:i}:null:{x:0,y:0,width:0,height:0}}function zo(e,t){const o=No(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 Ho(e,t,o,r,n,i=e=>e){for(const a of t.parts){const t=Bo(a.d);if(!t)continue;const s=a.opacity??1,l=e.globalAlpha;1!==s&&(e.globalAlpha=l*s);const c=n?"none"===a.fill?void 0:n:Fo(a.fill,o,r);c&&(e.fillStyle=i(c),e.fill(t));const u=n?a.stroke&&"none"!==a.stroke?n:void 0:Fo(a.stroke??"none",o,r);u&&(e.strokeStyle=i(u),e.lineWidth=a.strokeWidth??1,e.lineCap=a.strokeLinecap??"butt",e.lineJoin=a.strokeLinejoin??"miter",e.stroke(t)),1!==s&&(e.globalAlpha=l)}}function Oo(e,t,o,r,n,i=e=>e.x,a=e=>e.y,s=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,m,g)=>{if(n>u||c>m||l>h||d>g)return!0;if(!e.length){let n=e;do{const e=n.data,l=i(e)-t,c=a(e)-o,u=Math.sqrt(l*l+c*c);_o(s(e),r)>=u&&f>u&&(p=e,f=u),n=n.next}while(n)}return!1}),p?{node:p,distance:f}:null}var Wo=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,jo=new WeakMap,Yo=0,Go=!1,qo=null,Vo=null;function Xo(e,t){if(!t)return t;const o=Wo.exec(t);if(!o)return t;const r=e.canvas;if(!r)return o[2]?.trim()||t;!function(){if(Go)return;if("undefined"==typeof window||"undefined"==typeof document)return;Go=!0;const e=()=>{Yo++};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{qo=window.matchMedia("(prefers-color-scheme: dark)"),Vo=e,"function"==typeof qo.addEventListener?qo.addEventListener("change",Vo):"function"==typeof qo.addListener&&qo.addListener(Vo)}catch{}}();let n=jo.get(r);n&&n.version===Yo||(n={version:Yo,map:new Map},jo.set(r,n));const i=n.map.get(t);if(void 0!==i)return i;const a=getComputedStyle(r).getPropertyValue(o[1]).trim()||o[2]?.trim()||t;return n.map.set(t,a),a}function Uo(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]}import{curveMonotoneX as Ko,curveMonotoneY as Qo,curveCardinal as Zo,curveCatmullRom as Jo,curveStep as er,curveStepBefore as tr,curveStepAfter as or,curveBasis as rr,curveNatural as nr}from"d3-shape";function ir(e){switch(e){case"monotoneX":return Ko;case"monotoneY":return Qo;case"cardinal":return Zo;case"catmullRom":return Jo;case"step":return er;case"stepBefore":return tr;case"stepAfter":return or;case"basis":return rr;case"natural":return nr;default:return null}}function ar(e,t,o){return null==t?o:"string"!=typeof t?t:Xo(e,t)||o}function sr(e,t,o,r,n,i,a){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 s=e.createLinearGradient(r,n,i,a);for(const e of o)s.addColorStop(e.offset,e.color);return s}const{topOpacity:s,bottomOpacity:l}=t;if(!Number.isFinite(s)||!Number.isFinite(l))return null;const c=Math.max(0,Math.min(1,s)),u=Math.max(0,Math.min(1,l)),d=e.createLinearGradient(r,n,i,a),[h,p,f]=Uo(e,o);return d.addColorStop(0,`rgba(${h},${p},${f},${c})`),d.addColorStop(1,`rgba(${h},${p},${f},${u})`),d}function lr(e,t,o,r,n,i){const a=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>a.length)return null;const s=e.createLinearGradient(o,r,n,i);for(const e of a)s.addColorStop(e.offset,e.color);return s}import{line as cr}from"d3-shape";var ur=new WeakMap;function dr(e,t){const o=ir(t);if(!o)return e;const r=ur.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,a,s,l){if(!n)return n=[s,l],void r.push([s,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*s,h*h*h*u+3*h*h*d*t+3*h*d*d*a+d*d*d*l])}n=[s,l]},closePath(){},arc(){},rect(){},arcTo(){},quadraticCurveTo(e,t,o,i){n=[o,i],r.push([o,i])}};return cr().x(e=>e[0]).y(e=>e[1]).curve(t).context(i)(e),r}(e,o);return ur.set(e,n),n}function hr(e,t,o,r=30,n,i=0){let a=null;if(n){const e=Oo(n,t,o,r,i);e&&(a={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=fr(i,t,o,r);break;case"symbol":e=mr(i,t,o,r);break;case"glyph":e=gr(i,t,o,r);break;case"line":e=yr(i,t,o,r);break;case"rect":if(null==i.datum)break;e=vr(i,t,o);break;case"heatcell":e=xr(i,t,o);break;case"area":if(!1===i.interactive)break;e=kr(i,t,o);break;case"candlestick":e=wr(i,t,o)}e&&r>e.distance&&(a&&e.distance>=a.distance||(a=e))}return a}function pr(e,t,o){if(0===e.length)return null;if(e[0][0]>t||t>e[e.length-1][0])return null;const r=Sr(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[a,s]=e[n],[l,c]=e[i];return l===a?s:s+Math.max(0,Math.min(1,(t-a)/(l-a)))*(c-s)}function fr(e,t,o,r=30){const n=t-e.x,i=o-e.y,a=Math.sqrt(n*n+i*i);return a>_o(e.r,r)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:a}}function mr(e,t,o,r=30){const n=t-e.x,i=o-e.y,a=Math.sqrt(n*n+i*i);return a>_o($t(e.size),r)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:a}}function gr(e,t,o,r=30){if(null==e.datum)return null;const n=zo(e.glyph,e.size),i=e.x+n.centerDx,a=e.y+n.centerDy,s=t-i,l=o-a,c=Math.sqrt(s*s+l*l);return c>_o(n.radius,r)?null:{node:e,datum:e.datum,x:i,y:a,distance:c}}function yr(e,t,o,r=30){if(0===e.path.length)return null;const n=Sr(e.path,t);if(0>n)return null;const[i,a]=e.path[n];let s;if(e.path.length>1){let r=1/0;const i=Math.max(0,n-1),a=Math.min(e.path.length-2,n);for(let n=i;a>=n;n++){const[i,a]=e.path[n],[s,l]=e.path[n+1],c=br(t,o,i,a,s,l);r>c&&(r=c)}s=r}else{const e=t-i,r=o-a;s=Math.sqrt(e*e+r*r)}const l=e.style;return s>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:a,distance:s}}function br(e,t,o,r,n,i){const a=n-o,s=i-r,l=a*a+s*s;if(0===l)return Math.sqrt((e-o)**2+(t-r)**2);let c=((e-o)*a+(t-r)*s)/l;return c=Math.max(0,Math.min(1,c)),Math.sqrt((e-(o+c*a))**2+(t-(r+c*s))**2)}function vr(e,t,o){const r=Po(t,o,e);return r.hit?{node:e,datum:e.datum,x:r.cx,y:r.cy,distance:0}:null}function xr(e,t,o){const r=Po(t,o,e);return r.hit?{node:e,datum:e.datum,x:r.cx,y:r.cy,distance:0}:null}function wr(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,a=o-r;return{node:e,datum:e.datum,x:e.x,y:r,distance:Math.sqrt(i*i+a*a)}}return null}function kr(e,t,o){if(0===e.topPath.length)return null;const r=Sr(e.topPath,t);if(0>r)return null;const[n,i]=e.topPath[r],a=t-n,s=o-i,l=Math.sqrt(a*a+s*s);return{node:e,datum:Array.isArray(e.datum)&&e.datum[r]?e.datum[r]:e.datum,x:n,y:i,distance:l}}function Sr(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 Ar(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 Cr(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 Mr(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 _r(e){return"object"==typeof e&&null!==e&&"id"in e?e.id:e}function Lr(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}import{useEffect as Rr,useRef as Ir}from"react";var $r={fresh:1,aging:.7,stale:.45,expired:.25},Tr={alpha:1,band:"fresh",isStale:!1};function Nr(e,t){if(!e||0>=t)return Tr;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:{...$r,...e.opacities??{}}[n],band:n,isStale:"fresh"!==n}}return t>o?{alpha:e.dimOpacity??.5,band:"stale",isStale:!0}:Tr}function Fr(e,t,o,r,n,i){const a=Ir("fresh");Rr(()=>{if(!e)return;const s=setInterval(()=>{const s=t.current;if(!s||0===s.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=Nr(e,l-s.lastIngestTime);c.band===a.current&&c.isStale===n||(a.current=c.band,c.isStale!==n&&i(c.isStale),o.current=!0,r())},1e3);return()=>clearInterval(s)},[e,n,r])}import{jsx as Dr}from"react/jsx-runtime";function Br({isStale:e,position:t}){return Dr("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"})}import{useMemo as Er,useRef as zr,useEffect as Hr}from"react";import*as Or from"react";import{jsx as Wr,jsxs as jr}from"react/jsx-runtime";var Yr={fill:(e,t)=>Wr("rect",{style:e,width:t,height:t}),line:(e,t)=>Wr("line",{style:e,x1:0,y1:0,x2:t,y2:t})};function Gr(e,t,o,r,n){let i;return i="function"==typeof o?o(e):(0,Yr[o])(r(e,t),n),i}function qr({swatchSize:e}){return Wr("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 Vr(e,t,o){return o&&o.size>0?o.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}var Xr=(e,t,o,r,n,i,a,s,l,c,u)=>{const{type:d="fill",styleFn:h,items:p}=e,f=[];let m=0;const g=!(!t&&!o),y="isolate"===c||void 0===c&&null!=n,{swatchSize:b,labelGap:v,rowHeight:x}=u;return p.forEach((e,c)=>{const u=Gr(e,c,d,h,b),w=Vr(e,r,n),k=n&&n.size>0&&n.has(e.label);f.push(jr("g",{transform:`translate(0,${m})`,onClick:t?()=>t(e):void 0,onMouseEnter:o?()=>o(e):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:g?s===i&&c===a?0:-1:void 0,role:g?"option":void 0,"aria-selected":g&&y?k||!1:void 0,"aria-current":g&&!y&&null!=r&&e.label===r||void 0,"aria-label":e.label,onKeyDown:g?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(s,e);const t=o.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:g?t=>{l(s,c),o&&o(e);const r=t.currentTarget.querySelector(".semiotic-legend-focus-ring");r&&r.setAttribute("visibility","visible")}:void 0,onBlur:g?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:g?"pointer":"default",opacity:w,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[g&&Wr("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,k&&Wr(qr,{swatchSize:b}),Wr("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)),m+=x}),f};function Ur({config:e,orientation:t="vertical",width:o=100}){const{colorFn:r,domain:n,label:i,format:a}=e,s=a||(e=>Math.round(100*e)/100+""),l="grad-legend-"+Or.useId();if("horizontal"===t){const e=12,t=Math.min(o,200),a=Math.max(0,(o-t)/2),c=[];for(let e=0;64>=e;e++){const t=e/64;c.push(Wr("stop",{offset:100*t+"%",stopColor:r(n[0]+t*(n[1]-n[0]))},e))}return jr("g",{"aria-label":i||"Gradient legend",children:[Wr("defs",{children:Wr("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),i&&Wr("text",{x:a+t/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),Wr("rect",{x:a,y:0,width:t,height:e,fill:`url(#${l})`,rx:2}),Wr("text",{x:a,y:e+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:s(n[0])}),Wr("text",{x:a+t,y:e+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:s(n[1])})]})}const c=[];for(let e=0;64>=e;e++){const t=e/64;c.push(Wr("stop",{offset:100*t+"%",stopColor:r(n[1]-t*(n[1]-n[0]))},e))}return jr("g",{"aria-label":i||"Gradient legend",children:[i&&Wr("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),Wr("defs",{children:Wr("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:c})}),Wr("rect",{x:0,y:0,width:14,height:100,fill:`url(#${l})`,rx:2}),Wr("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:s(n[1])}),Wr("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:s(n[0])})]})}function Kr(e){const{legendGroups:t,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:n,isolatedCategories:i,legendInteraction:a,title:s="Legend",width:l=100,height:c=20,orientation:u="vertical",legendLayout:d}=e,h=function(e){const t=Math.max(1,e?.swatchSize??16),o=Math.max(t,e?.rowHeight??22);return{swatchSize:t,labelGap:Math.max(0,e?.labelGap??6),itemGap:Math.max(0,e?.itemGap??10),rowHeight:o,align:"left"===e?.align?"start":"right"===e?.align?"end":e?.align??"start",maxWidth:e?.maxWidth}}(d),[p,f]=Or.useState(0),[m,g]=Or.useState(0),y=Or.useCallback((e,t)=>{f(e),g(t)},[]),b="vertical"===u?(({legendGroups:e,width:t,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:n,isolatedCategories:i,focusedGroupIndex:a,focusedItemIndex:s,onFocusedIndexChange:l,legendInteraction:c,metrics:u})=>{let d=24;const h=[];return e.forEach((e,p)=>{d+=5,h.push(Wr("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(Wr("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(Wr("g",{className:"legend-item",transform:`translate(0,${d})`,children:Xr(e,o,r,n,i,a,s,p,l,c,u)},"legend-group-"+p)),d+=e.items.length*u.rowHeight+8}),h})({legendGroups:t||[],width:l,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:n,isolatedCategories:i,focusedGroupIndex:p,focusedItemIndex:m,onFocusedIndexChange:y,legendInteraction:a,metrics:h}):(({legendGroups:e,height:t,width:o,customClickBehavior:r,customHoverBehavior:n,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:s,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 m=((e,t,o,r,n,i,a,s,l,c,u,d)=>{const{type:h="fill",styleFn:p,items:f}=e,m=[],{swatchSize:g,labelGap:y,itemGap:b,rowHeight:v,align:x}=u,w=!(!t&&!o),k="isolate"===c||void 0===c&&null!=n,S=f.map(e=>g+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=Gr(e,d,h,p,g),A=Vr(e,r,n),C=n&&n.size>0&&n.has(e.label);m.push(jr("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:w?s===i&&d===a?0:-1:void 0,role:w?"option":void 0,"aria-selected":w&&k?C||!1:void 0,"aria-current":w&&!k&&null!=r&&e.label===r||void 0,"aria-label":e.label,onKeyDown:w?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(s,e);const t=o.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:w?t=>{l(s,d),o&&o(e);const r=t.currentTarget.querySelector(".semiotic-legend-focus-ring");r&&r.setAttribute("visibility","visible")}:void 0,onBlur:w?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:w?"pointer":"default",opacity:A,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[w&&Wr("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:g+y+2+7*e.label.length,height:g+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),x,C&&Wr(qr,{swatchSize:g}),Wr("text",{y:g/2,x:g+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 P=Math.max(0,...A.map(e=>e.width)),_=A.length;return{items:m,offset:P,totalRows:_,totalHeight:_*v}})(e,r,n,i,a,s,l,t,c,u,d,d.maxWidth??o);f+=m.offset+5,p.push({label:e.label,...m,offset:f,totalRows:m.totalRows,totalHeight:m.totalHeight}),h+=f+12});const f=d.maxWidth??o;let m=h>f?0:"center"===d.align?Math.max(0,(f-h)/2):"end"===d.align?Math.max(0,f-h):0;const g=[];return p.forEach((o,r)=>{const n=e[r];n.label&&(g.push(Wr("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:n.label},"legend-text-"+r)),m+=16),g.push(Wr("g",{className:"legend-item",transform:`translate(${m},0)`,children:o.items},"legend-group-"+r)),m+=o.offset+5,e[r+1]&&g.push(Wr("line",{stroke:"gray",x1:m,y1:-8,x2:m,y2:(o.totalHeight||t)+0+8},"legend-top-line legend-symbol-"+r)),m+=12}),Wr("g",{children:g})})({legendGroups:t||[],title:s,height:c,width:l,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:n,isolatedCategories:i,focusedGroupIndex:p,focusedItemIndex:m,onFocusedIndexChange:y,legendInteraction:a,metrics:h}),v=!(!o&&!r);return jr("g",{role:v?"listbox":void 0,"aria-multiselectable":!(!v||"isolate"!==a&&(void 0!==a||null==i))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==s&&""!==s&&"vertical"===u&&Wr("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:s}),b]})}function Qr(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}import{jsx as Zr}from"react/jsx-runtime";function Jr(e){const{legend:t,totalWidth:o,totalHeight:r,margin:n,legendPosition:i="right",legendLayout:a,title:s,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=e;if(!t)return null;const p="top"===i||"bottom"===i,f=!!s,m=Math.max(0,o-n.left-n.right),g=Math.max(1,p?a?.maxWidth??m:100);let y,b;return"left"===i?(y=Math.max(4,n.left-g-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),Zr("g",{transform:`translate(${y}, ${b})`,children:(v=t,"object"==typeof v&&null!==v&&"gradient"in v?Zr(Ur,{config:t.gradient,orientation:p?"horizontal":"vertical",width:g}):Qr(t)?Zr(Kr,{legendGroups:t.legendGroups,title:"",width:g,orientation:p?"horizontal":"vertical",legendLayout:a,customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):t)});var v}import{useMemo as en}from"react";import{bin as tn}from"d3-array";import{jsx as on,jsxs as rn}from"react/jsx-runtime";function nn(e){return"string"==typeof e?{type:e}:e}function an({orient:e,config:o,values:r,scale:n,size:i,length:a}){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}}(o),l="top"===e||"bottom"===e,c=en(()=>{if(0===r.length)return null;const o=n.domain(),c=i-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)],a=i-r;return{q1:r,median:n,q3:i,whiskerLow:Math.max(t[0],r-1.5*a),whiskerHigh:Math.min(t[o-1],i+1.5*a)}}(r);if(!t)return null;const{q1:o,median:i,q3:a,whiskerLow:u,whiskerHigh:d}=t,h=Math.min(.5*c,20),p=(c-h)/2+4;if(l){const t=n(o),r=n(a),l=n(i),c=n(u),f=n(d),m="top"===e?-1:1,g=0;return rn("g",{"data-testid":"marginal-boxplot-"+e,children:[on("line",{x1:c,y1:g+m*(p+h/2),x2:f,y2:g+m*(p+h/2),stroke:s.fill,strokeWidth:s.strokeWidth}),on("line",{x1:c,y1:g+m*p,x2:c,y2:g+m*(p+h),stroke:s.fill,strokeWidth:s.strokeWidth}),on("line",{x1:f,y1:g+m*p,x2:f,y2:g+m*(p+h),stroke:s.fill,strokeWidth:s.strokeWidth}),on("rect",{x:Math.min(t,r),y:"top"===e?g-p-h:g+p,width:Math.abs(r-t),height:h,fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth}),on("line",{x1:l,y1:"top"===e?g-p-h:g+p,x2:l,y2:"top"===e?g-p:g+p+h,stroke:s.fill,strokeWidth:2})]})}{const t=n(o),r=n(a),l=n(i),c=n(u),f=n(d),m="left"===e?-1:1,g=0;return rn("g",{"data-testid":"marginal-boxplot-"+e,children:[on("line",{x1:g+m*(p+h/2),y1:c,x2:g+m*(p+h/2),y2:f,stroke:s.fill,strokeWidth:s.strokeWidth}),on("line",{x1:g+m*p,y1:c,x2:g+m*(p+h),y2:c,stroke:s.fill,strokeWidth:s.strokeWidth}),on("line",{x1:g+m*p,y1:f,x2:g+m*(p+h),y2:f,stroke:s.fill,strokeWidth:s.strokeWidth}),on("rect",{x:"left"===e?g-p-h:g+p,y:Math.min(t,r),width:h,height:Math.abs(r-t),fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth}),on("line",{x1:"left"===e?g-p-h:g+p,y1:l,x2:"left"===e?g-p:g+p+h,y2:l,stroke:s.fill,strokeWidth:2})]})}}const u=tn().domain(o).thresholds(s.bins)(r);if(0===u.length)return null;const d=t(u.map(e=>e.length));if(0===d)return null;if("histogram"===s.type)return on("g",{"data-testid":"marginal-histogram-"+e,children:u.map((t,o)=>{if(null==t.x0||null==t.x1)return null;const r=t.length/d*c;if(l){const i=n(t.x0),a=n(t.x1)-n(t.x0);return on("rect",{x:i,y:"top"===e?-4-r:4,width:Math.max(a,.5),height:r,fill:s.fill,fillOpacity:s.fillOpacity,stroke:s.stroke,strokeWidth:s.strokeWidth},o)}{const i=n(t.x0),a=n(t.x1)-n(t.x0);return on("rect",{x:"left"===e?-4-r:4,y:Math.min(i,i+a),width:r,height:Math.abs(a),fill:s.fill,fillOpacity:s.fillOpacity,stroke:s.stroke,strokeWidth:s.strokeWidth},o)}})});if("violin"===s.type){const t=c/2+4,o=[];for(const r of u){if(null==r.x0||null==r.x1)continue;const i=r.length/d*(c/2),a=n((r.x0+r.x1)/2);o.push(l?`${a},${"top"===e?-(t-i):t-i}`:`${"left"===e?-(t-i):t-i},${a}`)}for(let r=u.length-1;r>=0;r--){const i=u[r];if(null==i.x0||null==i.x1)continue;const a=i.length/d*(c/2),s=n((i.x0+i.x1)/2);o.push(l?`${s},${"top"===e?-(t+a):t+a}`:`${"left"===e?-(t+a):t+a},${s}`)}return on("g",{"data-testid":"marginal-violin-"+e,children:on("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(l){const o=0,r=null!=u[0].x0?n(u[0].x0):0;t.push(`M${r},${o}`);for(const o of u){if(null==o.x0||null==o.x1)continue;const r=o.length/d*c,i=n((o.x0+o.x1)/2);t.push(`L${i},${"top"===e?-r-4:r+4}`)}const i=null!=u[u.length-1].x1?n(u[u.length-1].x1):a;t.push(`L${i},${o}`),t.push("Z")}else{const o=0,r=null!=u[0].x0?n(u[0].x0):0;t.push(`M${o},${r}`);for(const o of u){if(null==o.x0||null==o.x1)continue;const r=o.length/d*c,i=n((o.x0+o.x1)/2);t.push(`L${"left"===e?-r-4:r+4},${i}`)}const i=null!=u[u.length-1].x1?n(u[u.length-1].x1):a;t.push(`L${o},${i}`),t.push("Z")}return on("g",{"data-testid":"marginal-ridgeline-"+e,children:on("path",{d:t.join(" "),fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth})})}return null},[r,n,s,i,a,e,l,4]);return c?on("g",{className:"marginal-"+e,"data-testid":"marginal-"+e,children:c}):null}import*as sn from"react";import{jsx as ln,jsxs as cn}from"react/jsx-runtime";function un(e,t=120,o=8){if(!e)return[];const r=Math.max(1,Math.floor(t/o)),n=e.split(/\s+/),i=[];let a="";for(const e of n)a&&a.length+1+e.length>r?(i.push(a),a=e):a=a?`${a} ${e}`:e;return a&&i.push(a),i}function dn(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 hn(e,t,o,r){if(!e)return ln("g",{className:"annotation-note"});const{label:n,title:i,orientation:a,align:s,wrap:l=120,noWrap:c}=e;if(!n&&!i)return ln("g",{className:"annotation-note"});let u=a;u||(u=Math.abs(t)>Math.abs(o)?"leftRight":"topBottom");let d=s;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]:un(i,l):[],m=n?c?[n]:un(n,l):[],g="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(ln("foreignObject",{className:"annotation-note-html",x:"end"===h?g-l:"middle"===h?g-l/2:g,y:-16,width:l,height:Math.max(p,(f.length+m.length)*p+(i&&n?2:0))+p,style:{overflow:"visible"},children:cn("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&&ln("div",{className:"annotation-note-title",style:{fontWeight:"bold"},children:i}),n&&ln("div",{className:"annotation-note-label",children:n})]})},"annotation-note-html")):(f.length>0&&(b.push(ln("text",{className:"annotation-note-title",fill:v,textAnchor:h,fontWeight:"bold",children:f.map((e,t)=>ln("tspan",{x:g,dy:0===t?0:p,children:e},t))},"annotation-note-title")),y=f.length*p),m.length>0&&b.push(ln("text",{className:"annotation-note-label",fill:v,textAnchor:h,y:y,children:m.map((e,t)=>ln("tspan",{x:g,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=ln("line",{className:"note-line",x1:t,x2:o,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const e=(f.length+m.length)*p+(m.length>0?p:0);let t=0,o=e;"bottom"===d?(t=-e,o=0):"middle"===d&&(t=-e/2,o=e/2),x=ln("line",{className:"note-line",x1:0,x2:0,y1:t,y2:o,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const w=Math.max(0,f.length+m.length-1)*p;let k=0;return"topBottom"===u?k=0>o?-(w+2):18:"leftRight"===u&&(k="middle"===d?-(w+p+(m.length>0&&f.length>0?2:0))/2+8:"bottom"===d||0>o?-(w+2):18),cn("g",{className:"annotation-note",transform:`translate(${t},${o})`,children:[ln("g",{className:"annotation-note-content",transform:0!==k?`translate(0,${k})`:void 0,children:b}),x]})}function pn(e,t,o,r,n){const i=[];switch(e){case"callout-circle":{const e=(t?.radius||0)+(t?.radiusPadding||0);e>0&&i.push(ln("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(ln("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,a=n||0;if(void 0!==t?.x){const r=(t.x||0)-e;i.push(ln("line",{x1:r,y1:(t.y1||0)-a,x2:r,y2:(t.y2||0)-a,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==t?.y){const r=(t.y||0)-a;i.push(ln("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(ln("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(ln("line",{x1:0,y1:(t.y1||0)-a,x2:0,y2:(t.y2||0)-a,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(ln("path",{d:dn(e,r,t?.depth||30,void 0===t?.width),fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return ln("g",{className:"annotation-subject",children:i})}function fn(e,t,o,r,n,i){const a=[];let s=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,a=e-n,c=t-i;if(0!==a||0!==c){const e=Math.abs(a),t=Math.abs(c),u=o/2,d=r/2,h=e*d>t*u?u/e:d/t;s=n+a*h,l=i+c*h}}}else if("bracket"===n&&i){const e=i.width,t=i.height,o=i.depth||30;void 0!==e?(s=e/2,l=o):void 0!==t&&(s=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);s=Math.cos(r)*o,l=Math.sin(r)*o}}const c=Math.sqrt((e-s)**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-s);if(i){const r=(s+e)/2,i=(l+t)/2,d=-(t-l)/c,h=(e-s)/c,p=(o?.curve??.25)*c,f=r+d*p,m=i+h*p;a.push(ln("path",{className:"connector-curve",d:`M${s},${l}Q${f},${m} ${e},${t}`,fill:"none",stroke:n},"connector-line")),u=Math.atan2(m-l,f-s)}else a.push(ln("line",{x1:s,y1:l,x2:e,y2:t,stroke:n},"connector-line"));if("arrow"===o?.end){const e=10,t=16/180*Math.PI;a.push(ln("path",{d:`M${s},${l}L${s+e*Math.cos(u+t)},${l+e*Math.sin(u+t)}L${s+e*Math.cos(u-t)},${l+e*Math.sin(u-t)}Z`,fill:n,stroke:"none"},"connector-arrow"))}}return ln("g",{className:"annotation-connector",children:a})}function mn(e){const{x:t=0,y:o=0,dx:r,dy:n,nx:i,ny:a,note:s,connector:l,subject:c,type:u,color:d,className:h,disable:p,opacity:f,strokeDasharray:m,events:g={},"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 w=r||0,k=n||0;null!=i&&(w=i-b),null!=a&&(k=a-v);const S="string"==typeof u?u:"label";if("bracket"===S&&c&&0===w&&0===k)if(void 0!==c.width){w=c.width/2;const e=c.depth||30;k=e+(0>e?-5:5)}else if(void 0!==c.height){const e=c.depth||30;w=e+(0>e?-5:5),k=c.height/2}return cn("g",{className:("annotation "+(h||"")).trim(),transform:`translate(${b},${v})`,"data-testid":y,...null!=f&&{opacity:f},...m&&{strokeDasharray:m},...g,children:[!x.has("connector")&&fn(w,k,l,d,S,c),!x.has("subject")&&pn(S,c,d,b,v),!x.has("note")&&hn(s,w,k,d)]})}function gn(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 a=Object.assign({},t,{note:0===i?t.note:{label:""},x:o[0],y:o[1],nx:e,ny:n});return ln(mn,{"data-testid":"semiotic-annotation",...a,type:r},"multi-annotation-"+i)});return ln("g",{children:i})}const i=t.note||{title:"none",label:t.label},a=`${i.label}-${i.title}-${t.i}`;return ln(mn,{"data-testid":"semiotic-annotation",events:n,...t,type:r},a)}import{packEnclose as yn}from"d3-hierarchy";import{area as bn,curveLinear as vn,curveMonotoneX as xn,curveMonotoneY as wn,curveStep as kn,curveStepAfter as Sn,curveStepBefore as An,curveBasis as Cn,curveCardinal as Mn,curveCatmullRom as Pn}from"d3-shape";import _n from"regression";function Ln(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 Rn(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 In(e){return null==e?null:e+""}function $n(e,t,o){return t.stickyPositionCache?.set(e,o),o}function Tn(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 $n(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"],a=o[e.yAccessor||"y"];return null==i||null==a?null:{x:r(i),y:n(a)}}(o);return r?$n(t,o,r):null}if("semantic"===r){const r=function(e,t,o){const r=function(e){return In(e.provenance?.stableId??e.stableId)}(e);if(!r)return null;const n=o.pointNodes?.find(e=>In(e.pointId)===r);if(n)return $n(t,o,{x:n.x,y:n.y});const i=o.data?.find(e=>function(e){return In(e.stableId??e.id??e.provenance?.stableId)}(e)===r);if(!i)return null;const a=Ln(i,o),s=Rn(i,o);return null==a||null==s?null:$n(t,o,{x:a,y:s})}(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=Ln(e,o),i=Rn(e,o)),null!=n&&null!=i)return $n(t,o,{x:n,y:i});if("sticky"===r){const e=o.stickyPositionCache?.get(t);if(e)return e}return null}function Nn(e,t,o,r=50){return!(-r>e||e>(o.width||0)+r||-r>t||t>(o.height||0)+r)}import{jsx as Fn}from"react/jsx-runtime";var Dn={secondary:0,primary:3},Bn=".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 En(e){return!0===e?._annotationDeferred}function zn(e){return"blended"===e?.cohesion||"layer"===e?.cohesion?e.cohesion:null}function Hn(e){const t=e?.provenance?.confidence;return"number"==typeof t&&Number.isFinite(t)?Math.max(0,Math.min(1,t)):null}function On(e){return Math.max(.72,.95-.06*e)}import{jsx as Wn,jsxs as jn}from"react/jsx-runtime";var Yn={linear:vn,monotoneX:xn,monotoneY:wn,step:kn,stepAfter:Sn,stepBefore:An,basis:Cn,cardinal:Mn,catmullRom:Pn};function Gn(e,t,o,r){const n=[];return e.forEach((e,i)=>{let a;if(o){const n=o(e,i,r);a=null!=n?n:t(e,i,r)}else a=t(e,i,r);a&&n.push({node:a,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:Hn(e.annotation),readingOrder:null,rank:1};var o}),o=t.some(e=>null!=e.emphasis||null!=e.confidence),r=e.some(e=>En(e.annotation)),n=e.some(e=>null!=zn(e.annotation)),i=e.some(e=>"layer"===zn(e.annotation));if(!o&&!r&&!n)return e.map(e=>e.node);const a=t.filter(e=>null==e.emphasis&&null!=e.confidence).slice().sort((e,t)=>(t.confidence??0)-(e.confidence??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 t)e.emphasis&&(e.rank=Dn[e.emphasis]);const s=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=En(t.annotation);let a=t.node;if("primary"===r||"secondary"===r||null!=n){const e=null==r&&null!=n;a=Fn("g",{className:e?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+r,..."secondary"===r?{opacity:.6,fontSize:"0.88em"}:{},...e?{opacity:On(n),"data-annotation-reading-order":n}:{},children:t.node},"annotation-emphasis-"+o)}const s=zn(t.annotation);return s&&(a=Fn("g",{className:"annotation-cohesion--"+s,children:a},"annotation-cohesion-"+o)),i&&(a=Fn("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:a},"annotation-deferred-"+o)),a});return r&&s.unshift(Fn("style",{children:Bn},"annotation-disclosure-style")),i&&s.unshift(Fn("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")),s}(n)}function qn(e){return function(e,t,o){switch(e.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const r=Tn(e,t,o);if(!r)return null;const{x:n,y:i}=r;if(!Nn(n,i,o))return null;const a="callout"===e.type?"callout-circle":e.type,s="callout-circle"===a?{radius:e.radius??12,radiusPadding:e.radiusPadding}:"callout-rect"===a?{width:e.width,height:e.height}:void 0;return Wn(gn,{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:a,...s?{subject:s}:{},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=Ln(null!=e.value?{...e,x:e.value}:e,o);if(null==r)return null;const n=e.color||"#f97316",i=e.labelPosition||"top";let a;a="bottom"===i?(o.height||0)-4:"center"===i?(o.height||0)/2:12;const s=r>.6*(o.width||0),l=s?r-4:r+4,c=s?"end":"start";return jn("g",{opacity:e.opacity,children:[Wn("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&&Wn("text",{x:l,y:a,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=Rn(null!=e.value?{...e,y:e.value}:e,o);if(null==r)return null;const n=e.color||"#f97316",i=e.labelPosition||"right";let a,s;return"left"===i?(a=4,s="start"):"center"===i?(a=(o.width||0)/2,s="middle"):(a=(o.width||0)-4,s="end"),jn("g",{opacity:e.opacity,children:[Wn("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&&Wn("text",{x:a,y:r-4,textAnchor:s,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:Ln({...e,type:"point"},o),y:Rn({...e,type:"point"},o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const n=yn(r),i=e.padding||10;return jn("g",{children:[Wn("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&&Wn("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 n=(e.coordinates||[]).map(e=>({x:Ln({...e,type:"point"},o),y:Rn({...e,type:"point"},o)})).filter(e=>null!=e.x&&null!=e.y);if(2>n.length)return null;const i=e.padding||10,a=n.map(e=>e.x),s=n.map(e=>e.y),[l,c]=r(a),[u,d]=r(s),h=l-i,p=c+i,f=u-i;return jn("g",{children:[Wn("rect",{x:h,y:f,width:p-h,height:d+i-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&&Wn("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 Wn("g",{children:n.map((t,r)=>{const n=Ln(t,o),a=Rn(t,o);if(null==n||null==a)return null;const s="function"==typeof e.r?e.r(t):e.r||6,l="function"==typeof e.style?e.style(t):e.style||i;return Wn("circle",{cx:n,cy:a,r:s,...l},"hl-"+r)})},"ann-"+t)}case"bracket":{const r=Ln(e,o),n=Rn(e,o);return Wn(gn,{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",a="ordinal"===o.frameType,s="horizontal"===o.projection,l=a?n:null,c=a?i:null;let u;const d=[],h=new Map;if(a&&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 m=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},g=p,y=f;let b;if(a)if(s){const e=m(y);b=(t,o)=>[g(o),e(t)]}else{const e=m(g);b=(t,o)=>[e(t),y(o)]}else b=(e,t)=>[g(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]),a=Math.max(2,Math.ceil(t*o)),s=[];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(a-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){s.push([t,i[e]]);continue}const m=u*p-d*d;if(1e-12>Math.abs(m))s.push([t,h/u]);else{const e=(u*f-d*h)/m;s.push([t,(h-e*d)/u+e*t])}}return s}(u,e.bandwidth??.3):("polynomial"===v?_n.polynomial(u,{order:e.order||2}):_n.linear(u)).points;const w=x.map(([e,t])=>{const[o,r]=b(e,t);return`${o},${r}`}).join(" "),k=e.color||"#6366f1",S=x[x.length-1],[A,C]=b(S[0],S[1]);return jn("g",{children:[Wn("polyline",{points:w,fill:"none",stroke:k,strokeWidth:e.strokeWidth||2,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&Wn("text",{x:A+4,y:C-4,fill:k,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 jn("g",{opacity:e.opacity,children:[Wn("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&&Wn("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:jn("g",{opacity:e.opacity,children:[Wn("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&&Wn("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,a=o.scales?.y??o.scales?.value;if(!i||!a)return null;const s=e.upperAccessor||"upperBounds",l=e.lowerAccessor||"lowerBounds",c=e.filter,u=r.filter(e=>null!=e[s]&&null!=e[l]&&!(c&&!c(e))).sort((e,t)=>e[n]-t[n]);if(2>u.length)return null;const d=Yn[o.curve||"linear"]||vn,h=bn().x(e=>i(e[n])).y0(e=>a(e[l])).y1(e=>a(e[s])).curve(d)(u);if(!h)return null;const p=e.fill||"#6366f1";return jn("g",{children:[Wn("path",{d:h,fill:p,fillOpacity:e.fillOpacity??.15,stroke:"none"}),e.label&&u.length>0&&Wn("text",{x:i(u[u.length-1][n])+4,y:a(u[u.length-1][s])-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,a=o.scales?.y??o.scales?.value;if(!i||!a)return null;const s=r.map(e=>e[n]).filter(e=>null!=e&&isFinite(e));if(2>s.length)return null;const l=s.reduce((e,t)=>e+t,0)/s.length,c=s.reduce((e,t)=>e+(t-l)**2,0)/s.length,u=Math.sqrt(c),d=e.threshold??2,h=l-d*u,p=!1!==e.showBand,f=e.fill||"#6366f1",m=e.fillOpacity??.1,g=e.anomalyColor||"#ef4444",y=e.anomalyRadius??6,b=a(l+d*u),v=a(h),x=r.filter(e=>{const t=e[n];return null!=t&&Math.abs(t-l)>d*u});return jn("g",{children:[p&&Wn("rect",{x:0,y:Math.min(b,v),width:o.width||0,height:Math.abs(v-b),fill:f,fillOpacity:m}),x.map((e,t)=>{const r=Ln(e,o),n=Rn(e,o);return null==r||null==n?null:Wn("circle",{cx:r,cy:n,r:y,fill:g,fillOpacity:.7,stroke:g,strokeWidth:1.5},"anomaly-"+t)}),e.label&&Wn("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",a=o.scales?.x??o.scales?.time,s=o.scales?.y??o.scales?.value;if(!a||!s)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=_n.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 a=(e*n-t*o)/i,s=(o-a*t)/e;c=e=>s+a*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),m=e.confidence??.95,g=.99>m?.95>m?.9>m?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 w=[];for(const e of x){const t=c(e),o=h*Math.sqrt(1+1/u+(f>0?(e-p)**2/f:0))*g;w.push({x:e,yCenter:t,yUpper:t+o,yLower:t-o})}const k=`M${w.map(e=>`${a(e.x)},${s(e.yUpper)}`).join(" L")} L${w.slice().reverse().map(e=>`${a(e.x)},${s(e.yLower)}`).join(" L")} Z`,S=w.map(e=>`${a(e.x)},${s(e.yCenter)}`).join(" "),A=`${a(b)},${s(c(b))}`,C=e.strokeColor||"#6366f1";return jn("g",{children:[Wn("path",{d:k,fill:e.fill||"#6366f1",fillOpacity:e.fillOpacity??.15,stroke:"none"}),Wn("polyline",{points:`${A} ${S}`,fill:"none",stroke:C,strokeWidth:e.strokeWidth??2,strokeDasharray:e.strokeDasharray??"6,3"}),e.label&&w.length>0&&Wn("text",{x:a(w[w.length-1].x)+4,y:s(w[w.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=Tn(e,t,o);if(!i)return null;r=i.x,n=i.y}if(!Nn(r,n,o))return null;const i=e.width??32,a=e.height??32;return Wn("foreignObject",{x:r+(e.dx??0)-i/2,y:n+(e.dy??0)-a/2,width:i,height:a,style:{overflow:"visible",pointerEvents:"auto"},children:Wn("div",{style:{width:i,height:a,display:"flex",alignItems:"center",justifyContent:"center"},children:e.content??Wn("span",{style:{fontSize:18,cursor:"default"},title:e.label||"Info",children:"ℹ️"})})},"ann-"+t)}case"text":{const r=Tn(e,t,o);if(!r)return null;const{x:n,y:i}=r,a=n+(e.dx||0),s=i+(e.dy||0),l=e.color||"var(--semiotic-text, #333)",c=Wn("text",{x:a,y:s,fill:l,fontSize:e.fontSize||11,opacity:e.opacity,strokeDasharray:e.strokeDasharray,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:e.label});return!0!==e._redundantConnector?sn.cloneElement(c,{key:"ann-text-"+t}):jn("g",{opacity:e.opacity,strokeDasharray:e.strokeDasharray,children:[Wn("line",{x1:n,y1:i,x2:a,y2:s,stroke:l,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),sn.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,a=o.scales?.x,s=o.scales?.y,l=n(i)?i:n(a)?a:n(s)?s: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 jn("g",(o.projection?"vertical"===o.projection:l===a)?{children:[Wn("rect",{x:c,y:0,width:u,height:o.height||0,fill:d,fillOpacity:h}),p&&Wn("text",{x:c+u/2,y:12,textAnchor:"middle",fill:d,fontSize:12,fontWeight:"bold",children:p})]}:{children:[Wn("rect",{x:0,y:c,width:o.width||0,height:u,fill:d,fillOpacity:h}),p&&Wn("text",{x:12,y:c+u/2,dominantBaseline:"middle",fill:d,fontSize:12,fontWeight:"bold",children:p})]},"ann-"+t)}default:return null}}}var Vn=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function Xn(e){return!!e&&"object"==typeof e&&Vn.has(function(e){return"string"==typeof e?.type?e.type:""}(e))}function Un(e){return"primary"===e?.emphasis||!0===e?.defensive}function Kn(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 Qn(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 Zn=32,Jn=6,ei=4,ti=8,oi=72;var ri={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function ni(e){if(!ii(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 ii(e){return Xn(e)}function ai(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 si(e,t,o,r,n){const i=e+o,a=t+r;return Math.abs(o)>Math.abs(r)?{x:0>o?i-n.width-4:i+4,y:0>r?a-n.height:a,width:n.width,height:n.height}:{x:0>o?i-n.width:i,y:0>r?a-n.height-4:a+4,width:n.width,height:n.height}}function li(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function ci(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 ui(e,t,o,r,n,i,a,s){const l=li(e,a);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,s);for(const e of o)c+=12*ci(l,e);for(const e of r)c+=4*ci(l,e);return c}function di(e){const{annotations:t,context:o,defaultOffset:r=Zn,notePadding:n=Jn,markPadding:i=ei,edgePadding:a=ti,preserveManualOffsets:s=!0,routeLongConnectors:l=!0,connectorThreshold:c=oi,density:u,progressiveDisclosure:d=!1,redundantCues:h=!1,responsive:p,mobile:f,cohesion:m,audience:g}=e,y=o.width||0,b=o.height||0,v="object"==typeof f?f:{},x=v.breakpoint??480,w=!!f&&x>=y,k=w&&!1!==v.preferShortText?t.map(ni):t,S=w&&!u?{maxAnnotations:v.maxAnnotations??("callout-list"===v.strategy?1:2),minVisible:v.minVisible??1}:u,A=d||w&&(!1!==v.progressiveDisclosure||"callout-list"===v.strategy),C=w&&!p?v.responsive??{minWidth:x}:p,M=w&&!m?v.cohesion:m;if(0===k.length||0>=y||0>=b)return k.slice();const 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 L=!1;const R=k.map((e,t)=>{if(!ii(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?Tn(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=[...ai("string"==typeof e.title?e.title:void 0,t),...ai("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(s&&("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 P.push(li(si(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=ui(si(i.x,i.y,e.dx,e.dy,u),e,P,_,y,b,n,a);p>t&&(h=e,p=t)}if(!h)return e;const f=li(si(i.x,i.y,h.dx,h.dy,u),n);P.push(f);const m=Math.hypot(h.dx,h.dy),g=l&&m>=c&&"text"!==e.type&&"widget"!==e.type?{...e.connector||{end:"arrow"},type:"curve"}:e.connector;return L=!0,{...e,dx:h.dx,dy:h.dy,...g?{connector:g}:{}}}),I=L?R:k.slice();let $=I;if(h){let e=!1;const t=I.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});$=e?t:I}{let e=!1;const 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?ri[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});$=e?t:$}const T=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}(g),o=1===t?e:{...e,maxAnnotations:Math.max(0,Math.round((e.maxAnnotations??Kn(y,b,e))*t))},{deferred:r}=function(e){const{annotations:t,width:o,height:r}=e,n=Math.max(0,e.minVisible??1),i=Kn(o,r,e),a=t.map((e,t)=>{return{annotation:e,index:t,note:(o=e,Xn(o))};var o}),s=a.filter(e=>e.note);if(0===s.length||i>=s.length)return{visible:t.slice(),deferred:[],budget:i};const l=s.filter(e=>Un(e.annotation)),c=s.filter(e=>!Un(e.annotation)).sort((e,t)=>Qn(t.annotation)-Qn(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 a)!o||d.has(t)?h.push(e):p.push(e);return{visible:h,deferred:p,budget:i}}({annotations:$,width:y,height:b,...o});for(const e of r)T.add(e)}if(C&&("object"==typeof C&&"number"==typeof C.minWidth?C.minWidth:480)>=y)for(const e of $)ii(e)&&"secondary"===e.emphasis&&T.add(e);if(T.size>0)for(const e of $)!0===e?.defensive&&T.delete(e);let N;return N=0===T.size?$:A?$.map(e=>T.has(e)?{...e,_annotationDeferred:!0}:e):$.filter(e=>!T.has(e)),M?function(e,t){let o=!1;const r=e.map(e=>ii(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(o=!0,{...e,cohesion:t}):e);return o?r:e}(N,M):N}import{useSyncExternalStore as hi}from"react";var pi={positions:new Map},fi=new Set;function mi(){for(const e of fi)e()}function gi(e,t){const o=pi.positions.get(e);if(o?.locked)return;if(!o||o.sourceId!==t)return;const r=new Map(pi.positions);r.delete(e),pi={positions:r},mi()}function yi(e,t){const o=pi.positions.get(e);if(!o?.locked)return;if(t&&o.sourceId!==t)return;const r=new Map(pi.positions);r.delete(e),pi={positions:r},mi()}function bi(){return pi}function vi(e){return fi.add(e),()=>fi.delete(e)}var xi={positions:new Map};function wi(){return()=>{}}function ki(){return xi}function Si(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,a=r instanceof Date?r.getTime():r,s=n instanceof Date?n.getTime():n;if(2>t||a===s)return i?[new Date(a),new Date(s)]:[a,s];const l=(s-a)/(t-1),c=Array(t);for(let e=0;t>e;e++){const o=e===t-1?s:a+e*l;c[e]=i?new Date(o):o}return c}(e,t):e.ticks(t)}import{Fragment as Ai,jsx as Ci,jsxs as Mi}from"react/jsx-runtime";function Pi(e,t,o){if("edges"===e){if(t)return"start";if(o)return"end"}return"middle"}function _i(e,t,o){if("edges"===e){if(t)return"hanging";if(o)return"auto"}return"middle"}function Li(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 Ri(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 a="M0,"+r;for(let e=0;i>e;e++){const o=8*(e+1);a+=`L${Math.min(8*e+4,t)},${r+4*n}`,a+=`L${Math.min(o,t)},${r}`}return a}{const r="bottom"===e?0:t,n="bottom"===e?1:-1,i=Math.ceil(o/8);let a=`M${r},0`;for(let e=0;i>e;e++){const t=8*(e+1);a+=`L${r+4*n},${Math.min(8*e+4,o)}`,a+=`L${r},${Math.min(t,o)}`}return a}}function $i(e){const{width:t,height:o,totalWidth:r,totalHeight:n,margin:i,scales:a,showAxes:s,axes:l,showGrid:c,xFormat:u,yFormat:d,axisExtent:h}=e,p=Er(()=>{if(!a)return[];const e=l?.find(e=>"bottom"===e.orient),o=e?.tickFormat||u||Ti,r=Math.max(2,Math.floor(t/70)),n=e?.ticks??5,i="exact"===h?Math.max(2,n):Math.min(n,r),s=e?.tickValues??Si(a.x,i,h),c=s.map(e=>e.valueOf()),d=s.map((e,t)=>({value:e,pixel:a.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 Ni(d,Math.max(55,p+8))},[a,l,u,t,h]),f=Er(()=>{if(!a)return[];const e=l?.find(e=>"left"===e.orient),t=e?.tickFormat||d||Ti,r=Math.max(2,Math.floor(o/30)),n=e?.ticks??5,i="exact"===h?Math.max(2,n):Math.min(n,r);return Ni((e?.tickValues??Si(a.y,i,h)).map(e=>({value:e,pixel:a.y(e),label:t(e)})),22)},[a,l,d,o,h]),m=c&&a,g=s&&a;if(!m&&!g)return null;const y=l?.find(e=>"bottom"===e.orient),b=l?.find(e=>"left"===e.orient),v=g&&(!y||!1!==y.baseline),x=g&&(!b||!1!==b.baseline),w=y?.jaggedBase||!1,k=b?.jaggedBase||!1,S="var(--semiotic-border, #ccc)";return Ci("svg",{width:r,height:n,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:Mi("g",{transform:`translate(${i.left},${i.top})`,children:[m&&(()=>{const e=Ri(l?.find(e=>"bottom"===e.orient)?.gridStyle),r=Ri(l?.find(e=>"left"===e.orient)?.gridStyle);return Mi("g",{className:"stream-grid",children:[p.map((t,r)=>Ci("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)=>Ci("line",{x1:0,y1:e.pixel,x2:t,y2:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:r},"ygrid-"+o))]})})(),v&&!w&&Ci("line",{x1:0,y1:o,x2:t,y2:o,stroke:S,strokeWidth:1}),w&&Ci("path",{d:Ii("bottom",t,o),fill:"none",stroke:S,strokeWidth:1}),x&&!k&&Ci("line",{x1:0,y1:0,x2:0,y2:o,stroke:S,strokeWidth:1}),k&&Ci("path",{d:Ii("left",t,o),fill:"none",stroke:S,strokeWidth:1})]})})}function Ti(e,t,o){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function Ni(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 Fi(e){const{width:t,height:o,totalWidth:r,totalHeight:n,margin:i,scales:a,showAxes:s,axes:l,xLabel:c,yLabel:u,yLabelRight:d,xFormat:h,yFormat:p,axisExtent:f,showGrid:m,title:g,legend:y,legendHoverBehavior:b,legendClickBehavior:v,legendHighlightedCategory:x,legendIsolatedCategories:w,legendPosition:k="right",legendLayout:S,foregroundGraphics:A,marginalGraphics:C,xValues:M,yValues:P,annotations:_,autoPlaceAnnotations:L,svgAnnotationRules:R,xAccessor:I,yAccessor:$,annotationData:T,pointNodes:N,curve:F,underlayRendered:D,canvasObscuresUnderlay:B=!0,linkedCrosshairName:E,linkedCrosshairSourceId:z,children:H}=e,O=Er(()=>{if(!s||!a)return[];const e=l?.find(e=>"bottom"===e.orient),o=e?.tickFormat||h||Ti,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??Si(a.x,i,f),u=c.map(e=>e.valueOf()),d=c.map((e,t)=>({value:e,pixel:a.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),m=e?.autoRotate?Math.max(20,Math.min(p+8,55)):Math.max(55,p+8);let g=Ni(d,m);if(g.length>1&&(g=g.filter((e,t)=>0===t||e.label+""!=g[t-1].label+"")),e?.includeMax&&g.length>0&&"exact"!==f&&!e?.tickValues){const e=a.x.domain()[1],t=a.x(e),r=g[g.length-1].pixel;if(Math.abs(t-r)>1){const n=o(e,g.length,u);m>t-r&&g.length>1&&(g=g.slice(0,-1)),g.push({value:e,pixel:t,label:n})}}return g},[s,a,l,h,t,f]),W=Er(()=>{if(!s||!a)return[];const e=l?.find(e=>"left"===e.orient),t=e?.tickFormat||p||Ti,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=Ni((e?.tickValues??Si(a.y,i,f)).map(e=>({value:e,pixel:a.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=a.y.domain()[1],o=a.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},[s,a,l,p,o,f]),j=Er(()=>{if(!s||!a)return[];const e=l?.find(e=>"right"===e.orient);if(!e)return[];const t=e.tickFormat||p||Ti,r=Math.max(2,Math.floor(o/30)),n=e.ticks??5;return Ni((e.tickValues??Si(a.y,"exact"===f?Math.max(2,n):Math.min(n,r),f)).map(e=>({value:e,pixel:a.y(e),label:t(e)})),22)},[s,a,l,p,o,f]),Y=zr(new Map),G=zr(_?.length??0),q=_?.length??0;G.current!==q&&(G.current=q,Y.current=new Map);const V=Er(()=>{if(!_||0===_.length)return null;const e=qn(),r={scales:a?{x:a.x,y:a.y,time:a.x,value:a.y}:null,timeAxis:"x",xAccessor:I,yAccessor:$,width:t,height:o,data:T,frameType:"xy",pointNodes:N,curve:F,stickyPositionCache:Y.current};return Gn(L?di({annotations:_,context:r,..."object"==typeof L?L:{}}):_,e,R,r)},[_,L,R,t,o,I,$,T,a,N,F]),X=function(e){const t=hi(e?vi:wi,e?bi:ki,e?bi:ki);return e?t.positions.get(e)??null:null}(E);return Hr(()=>{if(!X?.locked||!E)return;const e=e=>{"Escape"===e.key&&yi(E)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[X?.locked,E]),s||g||y||A||C||V&&V.length>0||m||H||X?Mi("svg",{role:"img",width:r,height:n,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[Ci("title",{children:"string"==typeof g?g:"XY Chart"}),Ci("desc",{children:"string"==typeof g?g+" — XY data visualization":"XY data visualization"}),Mi("g",{transform:`translate(${i.left},${i.top})`,children:[m&&a&&(!D||B)&&(()=>{const e=Ri(l?.find(e=>"bottom"===e.orient)?.gridStyle),r=Ri(l?.find(e=>"left"===e.orient)?.gridStyle);return Mi("g",{className:"stream-grid",children:[O.map((t,r)=>Ci("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:o,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:e},"xgrid-"+r)),W.map((e,o)=>Ci("line",{x1:0,y1:e.pixel,x2:t,y2:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:r},"ygrid-"+o))]})})(),s&&a&&(()=>{const e=l?.find(e=>"left"===e.orient),r=l?.find(e=>"bottom"===e.orient),n=!e||!1!==e.baseline,a=!r||!1!==r.baseline,s=e?.jaggedBase||!1,h=r?.jaggedBase||!1,p=r?.landmarkTicks,f=e?.landmarkTicks,m="var(--semiotic-border, #ccc)",g="var(--semiotic-text-secondary, var(--semiotic-text, #666))",y="var(--semiotic-text, #333)",b=!!r?.autoRotate&&O.length>1&&(()=>{const e=t/Math.max(O.length-1,1);return O.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),w={fontSize:"var(--semiotic-tick-font-size, 12px)"},k={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=Li(O),P=Li(W);return Mi("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[Mi("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[(!D||B)&&a&&!h&&Ci("line",{x1:0,y1:o,x2:t,y2:o,stroke:m,strokeWidth:1}),(!D||B)&&h&&Ci("path",{d:Ii("bottom",t,o),fill:"none",stroke:m,strokeWidth:1}),O.map((e,t)=>{const r=!!p&&("function"==typeof p?p(e.value,t):Ro(e.value,t>0?O[t-1].value:void 0));return Mi("g",{transform:`translate(${e.pixel},${o})`,children:[Ci("line",{y2:5,stroke:m,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?Ci("text",{y:v,textAnchor:b?"end":Pi(A,e.pixel===M.min,e.pixel===M.max),fontWeight:r?600:400,fill:g,className:"semiotic-axis-tick",style:{userSelect:"none",...r?k:w},transform:b?"rotate(-45)":void 0,children:e.label}):Ci("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:Ci("div",{style:{textAlign:"center",userSelect:"none",...w},children:e.label})})]},"xtick-"+t)}),c&&Ci("text",{x:t/2,y:x,textAnchor:"middle",fill:y,className:"semiotic-axis-label",style:{userSelect:"none",...S},children:c})]}),Mi("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[(!D||B)&&n&&!s&&Ci("line",{x1:0,y1:0,x2:0,y2:o,stroke:m,strokeWidth:1}),(!D||B)&&s&&Ci("path",{d:Ii("left",t,o),fill:"none",stroke:m,strokeWidth:1}),W.map((e,t)=>{const o=!!f&&("function"==typeof f?f(e.value,t):Ro(e.value,t>0?W[t-1].value:void 0));return Mi("g",{transform:`translate(0,${e.pixel})`,children:[Ci("line",{x2:-5,stroke:m,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?Ci("text",{x:-8,textAnchor:"end",dominantBaseline:_i(C,e.pixel===P.min,e.pixel===P.max),fontWeight:o?600:400,fill:g,className:"semiotic-axis-tick",style:{userSelect:"none",...o?k:w},children:e.label}):Ci("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:Ci("div",{style:{textAlign:"right",userSelect:"none",...w},children:e.label})})]},"ytick-"+t)}),(()=>{const t=e?.label||u;return t?Ci("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===j.length)return null;const r=!1!==e.baseline,n=e.landmarkTicks,a=e.label||d,s=e.tickAnchor,c=Li(j);return Mi("g",{className:"semiotic-axis semiotic-axis-right","data-orient":"right",children:[r&&Ci("line",{x1:t,y1:0,x2:t,y2:o,stroke:m,strokeWidth:1}),j.map((e,o)=>{const r=!!n&&("function"==typeof n?n(e.value,o):Ro(e.value,o>0?j[o-1].value:void 0));return Mi("g",{transform:`translate(${t},${e.pixel})`,children:[Ci("line",{x2:5,stroke:m,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?Ci("text",{x:8,textAnchor:"start",dominantBaseline:_i(s,e.pixel===c.min,e.pixel===c.max),fontWeight:r?600:400,fill:g,className:"semiotic-axis-tick",style:{userSelect:"none",...r?k:w},children:e.label}):Ci("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:Ci("div",{style:{textAlign:"left",userSelect:"none",...w},children:e.label})})]},"ytick-r-"+o)}),a&&Ci("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:a})]})})()]})})(),V,C&&a&&M&&P&&Mi(Ai,{children:[C.top&&Ci("g",{transform:"translate(0, 0)",children:Ci(an,{orient:"top",config:nn(C.top),values:M,scale:a.x,size:i.top,length:t})}),C.bottom&&Ci("g",{transform:`translate(0, ${o})`,children:Ci(an,{orient:"bottom",config:nn(C.bottom),values:M,scale:a.x,size:i.bottom,length:t})}),C.left&&Ci("g",{transform:"translate(0, 0)",children:Ci(an,{orient:"left",config:nn(C.left),values:P,scale:a.y,size:i.left,length:o})}),C.right&&Ci("g",{transform:`translate(${t}, 0)`,children:Ci(an,{orient:"right",config:nn(C.right),values:P,scale:a.y,size:i.right,length:o})})]}),A,X&&X.sourceId!==z&&a?.x&&(()=>{const e=a.x(X.xValue);if(null==e||0>e||e>t)return null;const r=X.locked;return Ci("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"})})(),H]}),g&&Ci("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 g?g:null}),Jr({legend:y,totalWidth:r,totalHeight:n,margin:i,legendPosition:k,title:g,legendLayout:S,legendHoverBehavior:b,legendClickBehavior:v,legendHighlightedCategory:x,legendIsolatedCategories:w})]}):null}import*as Di from"react";import{arc as Bi}from"d3-shape";function Ei(e){return(e.tl??0)>0||(e.tr??0)>0||(e.br??0)>0||(e.bl??0)>0}function zi(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 Hi=(e,t)=>({x:e*Math.cos(t),y:e*Math.sin(t)});function Oi(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=Hi(o,r),t=Hi(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=Hi(o,r),a=Hi(o,n),s=Hi(t,n),l=Hi(t,r),c=n-r>Math.PI?1:0;return`M${e.x},${e.y} A${o},${o} 0 ${c} 1 ${a.x},${a.y} L${s.x},${s.y} A${t},${t} 0 ${c} 0 ${l.x},${l.y} Z`}const a=Math.max(0,Math.min(e.cornerRadius??0,(o-t)/2));if(0===a)return Oi({...e,cornerRadius:0,roundStart:!1,roundEnd:!1});const s=Math.asin(Math.min(1,a/Math.max(1e-9,o-a))),l=i?0:Math.asin(Math.min(1,a/Math.max(1e-9,t+a))),c=n-r,u=e.roundStart&&e.roundEnd?c/2:c,d=!!e.roundStart&&u>s,h=!!e.roundEnd&&u>s;if(!d&&!h)return Oi({...e,cornerRadius:0,roundStart:!1,roundEnd:!1});const p=r+(d?s:0),f=n-(h?s:0),m=r+(d?l:0),g=n-(h?l:0),y=Hi(o,p),b=Hi(o,f),v=(o-a)*Math.cos(s),x=Hi(v,r),w=Hi(v,n),k=i?null:Hi(t,g),S=i?null:Hi(t,m),A=i?0:(t+a)*Math.cos(l),C=i?null:Hi(A,r),M=i?null:Hi(A,n),P=f-p>Math.PI?1:0,_=i?0:g-m>Math.PI?1:0;let L="";if(d)L+=`M${x.x},${x.y}`,L+=` A${a},${a} 0 0 1 ${y.x},${y.y}`;else{const e=Hi(o,r);L+=`M${e.x},${e.y}`}if(h)L+=` A${o},${o} 0 ${P} 1 ${b.x},${b.y}`,L+=` A${a},${a} 0 0 1 ${w.x},${w.y}`;else{const e=Hi(o,n);L+=` A${o},${o} 0 ${P} 1 ${e.x},${e.y}`}if(i)L+=" L0,0";else{if(h)L+=` L${M.x},${M.y}`,L+=` A${a},${a} 0 0 1 ${k.x},${k.y}`;else{const e=Hi(t,n);L+=` L${e.x},${e.y}`}if(d)L+=` A${t},${t} 0 ${_} 0 ${S.x},${S.y}`,L+=` A${a},${a} 0 0 1 ${C.x},${C.y}`;else{const e=Hi(t,r);L+=` A${t},${t} 0 ${_} 0 ${e.x},${e.y}`}}return L+=" Z",L}function Wi(e){const t=Oi({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:Oi({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle+n*t,endAngle:e.endAngle}),color:r[n]})}return{clipPath:t,slices:o}}import{jsx as ji,jsxs as Yi}from"react/jsx-runtime";var Gi={innerRadius:0,outerRadius:0,startAngle:0,endAngle:0};function qi(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}function Vi(e,t,o){const r=It(e.symbolType,e.size,e.path);return ji("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?qi(e.style.fill):"none",opacity:e.style.opacity,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth},`${o??""}symbol-${t}`)}function Xi(e,t,o,r){const n=e.glyph;if(!n?.parts?.length||0>=e.size)return null;const i=No(n,e.size);if(0>=i.scale)return null;const a=`translate(${t},${o})${e.rotation?` rotate(${180*e.rotation/Math.PI})`:""} translate(${i.offsetX},${i.offsetY}) scale(${i.scale})`,s=e.color??("string"==typeof e.style.fill?e.style.fill:void 0),l=Eo(n,e.fraction??1,e.fractionStart??0,e.fractionDirection??"horizontal"),c=l?Ui(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:Fo(o.fill,s,e.accent),i=t?o.stroke&&"none"!==o.stroke?t:void 0:Fo(o.stroke??"none",s,e.accent);return n||i?ji("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 Yi("g",{transform:a,opacity:1===u?void 0:u,children:[l&&c&&ji("clipPath",{id:c,children:ji("rect",{x:l.x,y:l.y,width:l.width,height:l.height})}),l&&e.ghostColor?ji("g",{children:d(e.ghostColor)}):null,l&&c?ji("g",{clipPath:`url(#${c})`,children:d()}):d()]},r)}function Ui(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}var Ki="undefined"==typeof window||"undefined"==typeof document;import{useEffect as Qi,useLayoutEffect as Zi,useRef as Ji,useState as ea,useSyncExternalStore as ta}from"react";var oa="undefined"!=typeof window?Zi:Qi;function ra(){const[e,t]=ea(!1);return oa(()=>{t(!0)},[]),e}var na=()=>()=>{},ia=()=>!1,aa=()=>!0;function sa(){const e=ta(na,ia,aa);return Ji(e).current}function la(e){const{hydrated:t,wasHydratingFromSSR:o,storeRef:r,dirtyRef:n,renderFnRef:i,cancelRender:a,cleanup:s}=e;oa(()=>{t&&o&&r.current?.cancelIntroAnimation?.(),n.current=!0,a?.(),i.current()},[t,o]);const l=Ji(s);l.current=s,Qi(()=>()=>l.current?.(),[])}import{useRef as ca}from"react";function ua(e){const t=ca(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return ha(e,t);if(!pa(e)||!pa(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(!ha(o,n))return!1}else{if(!pa(o)||!pa(n))return!1;if(!da(o,n))return!1}}return!0}(t.current,e)||(t.current=e),t.current}function da(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 ha(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 pa(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 fa(e,t){const{background:o,hasBackgroundGraphics:r=!1,themeBackground:n="",x:i=0,y:a=0,width:s,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=Xo(e,c);return!!u&&(e.fillStyle=u,e.fillRect(i,a,s,l),!0)}var ma={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 ga(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}import*as ya from"react";import*as ba from"react";import{jsx as va}from"react/jsx-runtime";var xa=ba.createContext(null);function wa({children:e}){const[t,o]=ba.useState(!1),r=ba.useCallback(()=>o(e=>!e),[]),n=ba.useMemo(()=>({visible:t,setVisible:o,toggle:r}),[t,r]);return va(xa.Provider,{value:n,children:e})}function ka(){return ba.useContext(xa)}function Sa(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 Aa(e){return e&&"object"==typeof e?e:{}}function Ca(e){return Aa(e.accessibility).tableFields??e.accessibleDatum??e.datum}import{jsx as Ma,jsxs as Pa}from"react/jsx-runtime";var _a={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function La(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"],a=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 a)r.push(`${o[e]} ${n[e]||e}`);return`${t}, ${r.join(", ")}`}function Ra(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 Ia=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},$a="semiotic-accessible-data-table",Ta=$a+" semiotic-accessible-data-table-hidden",Na=$a+" semiotic-accessible-data-table-visible",Fa=Na+" semiotic-accessible-data-table-network",Da={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"},Ba={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},Ea={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)"},za={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},Ha={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))"},Oa={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},Wa={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},ja={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 Ya({scene:e,chartType:t,tableId:o,chartTitle:r}){const[n,i]=ya.useState(!1),[a,s]=ya.useState(5),l=ka(),c=l?.visible??!1,u=n||c,d=ya.useRef(null),h=r?"Data summary for "+r:o?`Data summary for ${t} ${o}`:"Data summary for "+t;ya.useEffect(()=>{u||s(5)},[u]);const p=ya.useCallback(e=>{e.target===e.currentTarget&&(n||c||i(!0))},[n,c]),f=ya.useCallback(e=>{c||d.current?.contains(e.relatedTarget)||i(!1)},[c]);if(!e||0===e.length)return o?Ma("span",{id:o,tabIndex:-1,style:_a}):null;if(!u)return Ma("div",{id:o,className:Ta,tabIndex:-1,onFocus:p,style:_a,role:"region","aria-label":h,children:Pa("button",{type:"button",onClick:()=>i(!0),children:["View data summary (",e.length," elements)"]})});const m=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:Sa(Ca(r))});break;case"line":case"area":{const e=Ca(r),o=Array.isArray(e)?e:[],n="line"===r.type?"Line point":"Area point";for(const e of o)t.push({label:n,values:Sa(e)});break}case"rect":{const e=Ca(r),o=null!=e&&"object"==typeof e?e:{},n=o.category??r.group??"",i=o.value??o.__aggregateValue??o.total,a=Sa(o);null==a.category&&""!==n&&(a.category=n+""),null==a.value&&null!=i&&(a.value="number"==typeof i||"string"==typeof i?i:i+""),t.push({label:"Bar",values:a});break}case"heatcell":{const e=Sa(Ca(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=Ca(r),o=Sa(e);if(null==o.category){const t=Aa(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:Sa(Ca(r))});break;case"arc":t.push({label:"Arc",values:Sa(Ca(r))});break;case"candlestick":t.push({label:"Candlestick",values:Sa(Ca(r))});break;case"geoarea":{const e=Aa(Ca(r)),o=Sa(e);if(null==o.name){const t=Aa(e.properties).name??e.name;null!=t&&(o.name=t+"")}t.push({label:"Region",values:o});break}}}catch{}return t}(e),g=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}(m),y=function(e,t){const o=[e+" data points."];for(const e of t)if(e.numeric)o.push(`${e.name}: ${Ia(e.min)} to ${Ia(e.max)}, mean ${Ia(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(" ")}(m.length,g),b=Math.min(a,m.length),v=m.slice(0,b),x=m.length-b,w=new Set;for(const e of v)for(const t of Object.keys(e.values))w.add(t);const k=Array.from(w);return Pa("div",{ref:d,id:o,className:Na,tabIndex:-1,onBlur:f,style:Da,role:"region","aria-label":h,children:[Ma("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{c&&l&&l.setVisible(!1),i(!1)},"aria-label":"Close data summary",style:Ea,children:"×"}),Ma("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:Ba,children:y}),Pa("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+t,style:za,children:[Ma("caption",{className:"semiotic-accessible-data-table-caption",style:Wa,children:x>0?`First ${b} of ${m.length} data points`:`All ${m.length} data points`}),Ma("thead",{children:Pa("tr",{children:[Ma("th",{style:Ha,children:"type"}),k.map(e=>Ma("th",{style:Ha,children:e},e))]})}),Ma("tbody",{children:v.map((e,t)=>Pa("tr",{children:[Ma("td",{style:Oa,children:e.label}),k.map(t=>{return Ma("td",{style:Oa,children:(o=e.values[t],null==o||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":Ia(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"")},t);var o})]},t))})]}),x>0&&Pa("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>s(e=>e+25),style:ja,children:["Show ",Math.min(25,x)," more"," ",1===x?"row":"rows"," (",x," remaining)"]})]})}function Ga({nodes:e,edges:t,chartType:o,tableId:r,chartTitle:n}){const[i,a]=ya.useState(!1),[s,l]=ya.useState(5),c=ka(),u=c?.visible??!1,d=i||u,h=n?"Data summary for "+n:r?`Data summary for ${o} ${r}`:"Data summary for "+o,p=ya.useRef(null);ya.useEffect(()=>{d||l(5)},[d]);const f=ya.useCallback(e=>{e.target===e.currentTarget&&(i||u||a(!0))},[i,u]),m=ya.useCallback(e=>{u||p.current?.contains(e.relatedTarget)||a(!1)},[u]);if(!e||0===e.length)return r?Ma("span",{id:r,tabIndex:-1,style:_a}):null;if(!d)return Ma("div",{id:r,className:Ta,tabIndex:-1,onFocus:f,style:_a,role:"region","aria-label":h,children:Pa("button",{type:"button",onClick:()=>a(!0),children:["View data summary (",e.length," nodes, ",t.length," edges)"]})});const g=Array.isArray(e)?e:[],y=Array.isArray(t)?t:[],b=new Map,v=new Map,x=new Map,w=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),w.set(e,(w.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 k=[];for(let e=0;g.length>e;e++){const t=g[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,a=x.get(r)??0,s=w.get(r)??0;k.push({id:r,degree:n+i,inDeg:n,outDeg:i,wDegree:a+s,wInDeg:a,wOutDeg:s})}k.sort((e,t)=>t.degree-e.degree);let S=0,A=0;if(k.length>0){let e=0;for(const t of k)e+=t.degree,t.degree>A&&(A=t.degree);S=e/k.length}const C=y.some(e=>{const t=e?.datum??e;return"number"==typeof t?.value&&Number.isFinite(t.value)}),M=[`${k.length} nodes, ${y.length} edges.`];k.length>0&&M.push(`Mean degree: ${Ia(S)}, max degree: ${A}.`);const P=Math.min(s,k.length),_=k.slice(0,P),L=k.length-P;return Pa("div",{ref:p,id:r,className:Fa,tabIndex:-1,onBlur:m,style:Da,role:"region","aria-label":h,children:[Ma("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{u&&c&&c.setVisible(!1),a(!1)},"aria-label":"Close data summary",style:Ea,children:"×"}),Ma("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:Ba,children:M.join(" ")}),Pa("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Node degree summary for "+o,style:za,children:[Ma("caption",{className:"semiotic-accessible-data-table-caption",style:Wa,children:L>0?`Top ${P} of ${k.length} nodes by degree`:`All ${k.length} nodes by degree`}),Ma("thead",{children:Pa("tr",{children:[Ma("th",{style:Ha,children:"id"}),Ma("th",{style:Ha,children:"degree"}),Ma("th",{style:Ha,children:"in"}),Ma("th",{style:Ha,children:"out"}),C&&Ma("th",{style:Ha,children:"w. degree"}),C&&Ma("th",{style:Ha,children:"w. in"}),C&&Ma("th",{style:Ha,children:"w. out"})]})}),Ma("tbody",{children:_.map((e,t)=>Pa("tr",{children:[Ma("td",{style:Oa,children:e.id}),Ma("td",{style:Oa,children:e.degree}),Ma("td",{style:Oa,children:e.inDeg}),Ma("td",{style:Oa,children:e.outDeg}),C&&Ma("td",{style:Oa,children:Ia(e.wDegree)}),C&&Ma("td",{style:Oa,children:Ia(e.wInDeg)}),C&&Ma("td",{style:Oa,children:Ia(e.wOutDeg)})]},t))})]}),L>0&&Pa("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>l(e=>e+25),style:ja,children:["Show ",Math.min(25,L)," more"," ",1===L?"node":"nodes"," (",L," remaining)"]})]})}function qa({summary:e}){return e?Ma("div",{role:"note",style:_a,children:e}):null}function Va({tableId:e}){return Ma("a",{href:"#"+e,style:_a,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,_a)},children:"Skip to data table"})}function Xa({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 Ma("div",{"aria-live":"polite","aria-atomic":"true",style:_a,children:t})}import{jsx as Ua}from"react/jsx-runtime";var Ka="var(--semiotic-focus, #005fcc)";function Qa({active:e,hoverPoint:t,margin:o,size:r,shape:n="circle",width:i,height:a,pathData:s}){if(!e||!t)return null;const l=t.x+o.left,c=t.y+o.top;let u;if("geoarea"!==n&&"path"!==n||!s)if("rect"===n&&null!=i&&null!=a){const e=Math.max(i,4),t=Math.max(a,4);u=Ua("rect",{x:l-e/2-3,y:c-t/2-3,width:e+6,height:t+6,rx:3,fill:"none",stroke:Ka,strokeWidth:2,strokeDasharray:"4,2"})}else u=Ua("circle","wedge"===n?{cx:l,cy:c,r:12,fill:"none",stroke:Ka,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:Ka,strokeWidth:2,strokeDasharray:"4,2"});else u=Ua("g",{transform:`translate(${o.left},${o.top})`,children:Ua("path",{d:s,fill:"none",stroke:Ka,strokeWidth:2.5,strokeDasharray:"6,3"})});return Ua("svg",{style:{position:"absolute",left:0,top:0,width:r[0],height:r[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}import*as Za from"react";function Ja(e,t){return"touch"===t?Math.max(e,24):e}function es(e){return Array.isArray(e)?e[0]:e}function ts(e,t,o,r){return{data:es(e),x:t,y:o,__semioticHoverData:!0,...r}}var os=["name","label","title"],rs=["type","kind","category","group","class","status","role","shape"],ns=["value","amount","total","count","weight","score"],is=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 as(e,t){for(const o of t){const t=e.find(e=>e.lower===o);if(t)return t}}function ss(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&&is.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=>os.includes(e.lower));const a=i>=0;0>i&&(i=n.findIndex(e=>"id"===e.lower)),0>i&&(i=n.findIndex(e=>"string"==typeof e.value));const s=0>i?void 0:n[i];let l=n.filter((e,t)=>t!==i);a&&(l=l.filter(e=>"id"!==e.lower));const c=as(l,rs),u=as(l,ns),d=new Set(rs),h=new Set(ns),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:s?.key,title:s?.value,entries:p}}import{jsx as ls,jsxs as cs}from"react/jsx-runtime";var us={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 ds(e,t){return"function"==typeof t?t(e):e[t]}function hs(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 ps(e={}){const{fields:t,title:o,format:r,style:n={},className:i=""}=e;return e=>{if(!e||"object"!=typeof e)return null;let a;const s=[];if(o){const t=ds(e,o);a=hs(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 a=ds(e,n);s.push({label:o,value:hs(a,i)})});else if(!o){const t=["value","y","name","id","label"];for(const o of t)if(void 0!==e[o]){a=hs(e[o],r);break}if(!a){const t=Object.keys(e).filter(e=>!e.startsWith("_"));t.length>0&&(a=hs(e[t[0]],r))}}const l={...us,...n};return cs("div",{className:("semiotic-tooltip "+i).trim(),style:l,children:[a&&ls("div",{style:{fontWeight:s.length>0?"bold":"normal"},children:a}),s.map((e,t)=>cs("div",{style:{marginTop:0===t&&a?"4px":0},children:[e.label&&cs("span",{children:[e.label,": "]}),e.value]},t))]})}}function fs(e={}){const{fields:t=[],title:o,format:r,style:n={},className:i="",showLabels:a=!0,separator:s=": "}=e;return e=>{if(!e||"object"!=typeof e)return null;const l=[];if(o){const t=ds(e,o);l.push({value:hs(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 s=hs(ds(e,n),i);l.push({label:a?o:void 0,value:s})});else{const t=ss(e,{skipPositional:!1});null!=t.title&&l.push({label:void 0,value:hs(t.title,r),bold:!0}),t.entries.forEach(e=>{l.push({label:a?e.key:void 0,value:hs(e.value,r)})})}const c={...us,...n};return Array.isArray(l)&&0!==l.length?ls("div",{className:("semiotic-tooltip semiotic-tooltip-multiline "+i).trim(),style:c,children:l.map((e,t)=>cs("div",{style:{marginBottom:l.length-1>t?"4px":0,fontWeight:e.bold?"bold":void 0},children:[e.label&&cs("strong",{children:[e.label,s]}),e.value]},t))}):null}}function ms(){return e=>{const t=e.allSeries;if(!t||0===t.length)return ls("div",{className:"semiotic-tooltip",style:us,children:ls("div",{children:hs(e.data?.value??e.data?.y)})});const o=e.xValue??e.data?.time??e.data?.x;return cs("div",{className:"semiotic-tooltip",style:us,children:[null!=o&&ls("div",{style:{fontWeight:600,marginBottom:4,fontSize:"0.9em",borderBottom:"1px solid var(--semiotic-border, #eee)",paddingBottom:4},children:hs(o)}),t.map((e,t)=>cs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"1px 0"},children:[ls("span",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:e.color,flexShrink:0}}),ls("span",{style:{flex:1,fontSize:"0.85em"},children:e.group}),ls("span",{style:{fontWeight:500,fontSize:"0.85em"},children:hs(e.value)})]},t))]})}}function gs(e){if(!0!==e){if("function"==typeof e){const t=e;return e=>{let o=es(!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:ls("div",{className:"semiotic-tooltip",style:us,children:r})}}return!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?ps(e):ps())}}import{jsx as ys}from"react/jsx-runtime";function bs({x:e,y:t,containerWidth:o,containerHeight:r,margin:n,children:i,className:a="stream-frame-tooltip",zIndex:s=1}){const l=Number.isFinite(e)&&Number.isFinite(t),c=Za.useRef(null),[u,d]=Za.useState(null);Za.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,a,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(!Za.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:us;return l?ys("div",{ref:c,className:p?a:(a+" semiotic-tooltip").trim(),style:{...f||{},position:"absolute",left:n.left+e,top:n.top+t,transform:h,pointerEvents:"none",zIndex:s,width:"max-content"},children:i}):null}import*as vs from"react";import{useCallback as xs,useEffect as ws,useLayoutEffect as ks,useMemo as Ss,useRef as As}from"react";import{useState as Cs,useEffect as Ms}from"react";function Ps(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)}import{useRef as _s,useState as Ls,useEffect as Rs}from"react";function Is(e,t,o){const r=_s(null),[n,i]=Ls(null);return Rs(()=>{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 $s="undefined"==typeof window?ws:ks,Ts={requestAnimationFrame:e=>("undefined"==typeof window?globalThis:window).requestAnimationFrame(e),cancelAnimationFrame:e=>("undefined"==typeof window?globalThis:window).cancelAnimationFrame(e)};function Ns(e,t,o){return"function"==typeof e?e({size:t,margin:o}):e}function Fs(e){const t=function(){const[e,t]=Cs(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return Ms(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),Ps(e,e=>t(e.matches))},[]),e}(),o=As(t);o.current=t;const[r,n]=Is(e.sizeProp,e.responsiveWidth,e.responsiveHeight),i=Ss(()=>({...e.marginDefault,...e.userMargin}),[e.marginDefault,e.userMargin]),a=n[0]-i.left-i.right,s=n[1]-i.top-i.bottom,l=Ns(e.foregroundGraphics,n,i),c=Ns(e.backgroundGraphics,n,i),u=K(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-"+vs.useId(),f=As(null),m=As(e.frameScheduler??Ts);m.current=e.frameScheduler??Ts;const g=As(null),y=As(!1),b=As(()=>{}),v=xs(()=>{if(null!==f.current||y.current)return;const e=m.current;let t=!1,o=!1;const r=e.requestAnimationFrame(()=>{t=!0;const e=!o;e&&(y.current=!0),f.current=null,g.current=null;try{b.current()}finally{e&&(y.current=!1)}});o=!0,t||(f.current=r,g.current=e)},[]),x=xs(()=>{null!==f.current&&((g.current??m.current).cancelAnimationFrame(f.current),f.current=null,g.current=null)},[]);ws(()=>()=>{x()},[x]);const w=As(()=>{}),k=As(()=>{}),S=As(null),A=As(null),C=As(null),M=xs(()=>{const e=S.current;S.current=null,e&&w.current(e)},[]),P=xs(e=>{if(S.current={clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType},null===A.current){const e=m.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]),_=xs(()=>{S.current=null,null!==A.current&&((C.current??m.current).cancelAnimationFrame(A.current),A.current=null,C.current=null),k.current()},[]);ws(()=>()=>{S.current=null,null!==A.current&&((C.current??m.current).cancelAnimationFrame(A.current),A.current=null,C.current=null)},[]);const L=e.themeDirtyRef;return $s(()=>{L&&(Yo++,L.current=!0,v())},[u,v,L]),{reducedMotion:t,reducedMotionRef:o,responsiveRef:r,size:n,margin:i,adjustedWidth:a,adjustedHeight:s,resolvedForeground:l,resolvedBackground:c,currentTheme:u,transition:d,introEnabled:h,tableId:p,rafRef:f,renderFnRef:b,scheduleRender:v,cancelRender:x,hoverHandlerRef:w,hoverLeaveRef:k,onPointerMove:P,onPointerLeave:_}}function Ds(e,t,o,r){const n=r.current,i=!0===e.lastCustomLayoutFailure?.preservedLastGoodScene,a=!i&&e.hasActivePulsesAt(t),s=!(o||i||!a&&!n)&&e.refreshPulse(t);return r.current=a,{changed:s,pending:a}}function Bs(e,t,o,r){const n=e.getContext("2d");if(!n)return null;const i=Math.round(t[0]*r),a=Math.round(t[1]*r),s=i/t[0],l=a/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===a||(e.width=i,e.height=a),n.setTransform(s,0,0,l,0,0),n.translate(o.left,o.top),n}function Es(){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))}import{useCallback as zs}from"react";function Hs(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 Os(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 Ws(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 js(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 a={...o};return r&&(a[e.key]=e.fn(o)),i&&(a[t.key]=t.fn(o)),a});return n?i:r}}var Ys=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Gs=3156e7;function qs(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")}`}:Gs>t?e=>{const t=new Date(e);return`${Ys[t.getUTCMonth()]} ${t.getUTCDate()}`}:5*Gs>t?e=>{const t=new Date(e);return`${Ys[t.getUTCMonth()]} ${t.getUTCFullYear()}`}:e=>new Date(e).getUTCFullYear()+""}function Vs(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:$t(o.size)});else if("glyph"===o.type){const e=zo(o.glyph,o.size);t.push({pointId:o.pointId,x:o.x+e.centerDx,y:o.y+e.centerDy,r:e.radius})}return t}import{line as Xs}from"d3-shape";function Us(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 Ks(e,t,o,r,n,i){if(2>t.length)return;const a=[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];a.push(a[e-1]+Math.sqrt(o*o+r*r))}const s=a[a.length-1];if(0===s)return;const l=Math.min(.2*s,40);e.strokeStyle=o,e.lineWidth=r,e.lineCap=i;for(let o=0;t.length-1>o;o++){const r=(a[o]+a[o+1])/2;let i=n;l>r&&(i*=r/l),l>s-r&&(i*=(s-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 Qs=(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=Xo(e,n)||n,a=t.style.strokeWidth||2,s=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=a,e.lineCap=t.style.strokeLinecap||"butt",t.style._edgeFade){Ks(e,t.path,i,a,t.style.opacity??1,t.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const c=ir(t.curve),u=s&&s.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,a=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],m=Us(f,s,i);if(null!==n&&null!==u&&null!==c){if(m===u)e.lineTo(h,p);else{const t=[];for(const e of s){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=a+(p-a)*l.t,d=Us(c+(f-c)*Math.min(l.t+1e-4,1),s,i);e.lineTo(t,u),r(),o(d,t,u)}e.lineTo(h,p)}n=h,a=p,c=f,u=m}else o(m,h,p),n=h,a=p,c=f,u=m}r()}else{e.beginPath();const o=t.strokeGradient&&t.path.length>=2?lr(e,t.strokeGradient,t.path[0][0],0,t.path[t.path.length-1][0],0):null;if(e.strokeStyle=o||i,c)Xs().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=ar(e,t.style.fill,t.style.fill),c&&!u)Xs().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 Zs(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Js(e,t,o=.3){Zs(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 el(e,t,o=.6){if(!Zs(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 tl(e,t,o,r=.35){Zs(t)&&(e.globalAlpha=t._pulseIntensity*r,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",o?e.fill(o):e.fill())}import{area as ol,line as rl}from"d3-shape";function nl(e,t){const o=ir(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=ol().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 il=(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=ar(e,t.style.fill,"#4e79a7"),a=t._decayOpacities;if(a&&a.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*(a[r]+a[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=Xo(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*(a[o]+a[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 s=t.style.opacity??1;if(nl(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=sr(e,t.fillGradient,"string"==typeof i?i:"#4e79a7",0,o,0,r);e.fillStyle=n||i,e.globalAlpha=s}else e.globalAlpha=(t.style.fillOpacity??.7)*s,e.fillStyle=i;if(e.fill(),t._pulseIntensity&&t._pulseIntensity>0&&(nl(e,t),tl(e,t)),t.style.stroke&&"none"!==t.style.stroke){e.globalAlpha=s;const o=t.strokeGradient&&t.topPath.length>=2?lr(e,t.strokeGradient,t.topPath[0][0],0,t.topPath[t.topPath.length-1][0],0):null;e.strokeStyle=o||Xo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);const r=ir(t.curve);if(e.beginPath(),r)rl().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}},al=(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=ar(e,o.style.fill,"#4e79a7"),e.fill(),o.style.stroke&&(e.strokeStyle=ar(e,o.style.stroke,o.style.stroke),e.lineWidth=o.style.strokeWidth||1,e.stroke()),el(e,o)}finally{e.restore()}}},sl=new Map;function ll(e){try{if(e.path)return new Path2D(e.path);const t=`${e.symbolType??"circle"}:${Math.round(e.size)}`;let o=sl.get(t);return o||(o=new Path2D(It(e.symbolType,e.size)),sl.size>256&&sl.clear(),sl.set(t,o)),o}catch{return null}}var cl=(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=ll(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=ar(e,t.style.fill,"#4e79a7"),e.fill(n)),t.style.stroke&&"none"!==t.style.stroke&&(e.globalAlpha=o*i,e.strokeStyle=ar(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth??1,e.stroke(n)),e.restore()}e.globalAlpha=o};function ul(e,t,o,r,n){if(0>=t.size)return;const i=t.glyph;if(!i||!i.parts?.length)return;const a=No(i,t.size);if(0>=a.scale)return;const s=(t.style.opacity??1)*(t._decayOpacity??1);if(0>=s)return;const l=t=>{const o=ar(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(a.offsetX,a.offsetY),e.scale(a.scale,a.scale),e.globalAlpha=n*s*(t.style.fillOpacity??1);const u=Eo(i,t.fraction??1,t.fractionStart??0,t.fractionDirection??"horizontal");u&&t.ghostColor&&Ho(e,i,c,t.accent,t.ghostColor,l),u&&(e.beginPath(),e.rect(u.x,u.y,u.width,u.height),e.clip()),Ho(e,i,c,t.accent,void 0,l),e.restore()}var dl=(e,t)=>{const o=e.globalAlpha;for(const r of t)"glyph"===r.type&&ul(e,r,r.x,r.y,o);e.globalAlpha=o};function hl(e,t){const{x:o,y:r,w:n,h:i}=t,{tl:a,tr:s,br:l,bl:c}=zi(t);e.beginPath(),e.moveTo(o+a,r),e.lineTo(o+n-s,r),s>0&&e.arcTo(o+n,r,o+n,r+s,s),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+a),a>0&&e.arcTo(o,r,o+a,r,a),e.closePath()}function pl(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 fl=(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)ml(e,t);else if(t.cornerRadii&&Ei(t.cornerRadii)){const o=ar(e,t.style.fill,Xo(e,"var(--semiotic-primary, #007bff)")),r=pl(t),n=t.fillGradient&&"string"==typeof o?sr(e,t.fillGradient,o,r.x0,r.y0,r.x1,r.y1):null;e.fillStyle=n||o,hl(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Xo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else if(t.roundedTop&&t.roundedTop>0){const o=ar(e,t.style.fill,Xo(e,"var(--semiotic-primary, #007bff)")),r=pl(t),n=t.fillGradient&&"string"==typeof o?sr(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:a,y:s,w:l,h:c}=t;switch(t.roundedEdge){case"right":e.moveTo(a,s),e.lineTo(a+l-i,s),e.arcTo(a+l,s,a+l,s+i,i),e.lineTo(a+l,s+c-i),e.arcTo(a+l,s+c,a+l-i,s+c,i),e.lineTo(a,s+c);break;case"left":e.moveTo(a+l,s),e.lineTo(a+i,s),e.arcTo(a,s,a,s+i,i),e.lineTo(a,s+c-i),e.arcTo(a,s+c,a+i,s+c,i),e.lineTo(a+l,s+c);break;case"bottom":e.moveTo(a,s),e.lineTo(a+l,s),e.lineTo(a+l,s+c-i),e.arcTo(a+l,s+c,a+l-i,s+c,i),e.lineTo(a+i,s+c),e.arcTo(a,s+c,a,s+c-i,i);break;default:e.moveTo(a,s+c),e.lineTo(a,s+i),e.arcTo(a,s,a+i,s,i),e.lineTo(a+l-i,s),e.arcTo(a+l,s,a+l,s+i,i),e.lineTo(a+l,s+c)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Xo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const o=ar(e,t.style.fill,Xo(e,"var(--semiotic-primary, #007bff)")),r=pl(t),n=t.fillGradient&&"string"==typeof o?sr(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=Xo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}Js(e,t),e.globalAlpha=1}};function ml(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,a=t.x+(t.w-n)/2;for(let r=t.y+t.h-n;r>=t.y-n;r-=i)e.drawImage(o,a,r,n,n)}else{const i=n+r,a=t.y+(t.h-n)/2;for(let r=t.x;t.x+t.w>r;r+=i)e.drawImage(o,r,a,n,n)}e.restore()}function gl(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 yl(e){return Number.isInteger(e)?e+"":100>Math.abs(e)?1>Math.abs(e)?e.toPrecision(3):e.toFixed(1):e.toFixed(0)}var bl=(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=Xo(e,"var(--semiotic-surface, #fff)"),e.lineWidth=1,e.strokeRect(t.x,t.y,t.w,t.h),Js(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):yl(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=gl(t.fill),e.font=r+"px sans-serif",e.textAlign="center",e.textBaseline="middle",e.fillText(o,n,i)}}}finally{e.restore()}},vl=(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=Xo(e,t.wickColor)||t.wickColor,a=60>r.height,s=a?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=s,e.stroke()};if(a||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=Xo(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))}a&&l(),e.restore()}},xl={line:[il,Qs,al],area:[il,al],stackedarea:[il,al],scatter:[al,cl],bubble:[al,cl],heatmap:[bl],bar:[fl],swarm:[al],waterfall:[(e,t,o,r)=>{fl(e,t);const n=t.filter(e=>"rect"===e.type);if(2>n.length)return;const i=n[0].datum,a=i?._connectorStroke;if(a){e.save(),e.strokeStyle=Xo(e,a)||a,e.lineWidth=i?._connectorWidth??1,e.setLineDash([]);for(let t=0;n.length-1>t;t++){const r=n[t],i=n[t+1],a=r.datum,s=i.datum;if(null==a?.cumEnd||null==s?.baseline)continue;const l=o.y(a.cumEnd),c=r.x+r.w,u=i.x;e.beginPath(),e.moveTo(c,l),e.lineTo(u,l),e.stroke()}e.restore()}}],candlestick:[vl],mixed:[il,Qs,al],custom:[il,fl,bl,Qs,al,cl,dl,vl]};import{jsx as wl,jsxs as kl}from"react/jsx-runtime";function Sl(e){return"string"==typeof e?e:"value"}function Al(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function Cl(e,t){if(!t)return Al(e);try{const o=t(e);return null==o?Al(e):o}catch{return Al(e)}}function Ml(e,t){return"function"==typeof t?t(e):e[t]}function Pl(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 _l(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?Cl(Ml(r,t.accessor),t.format):null;return kl("div",{className:"semiotic-tooltip",style:us,children:[null!=n&&wl("div",{style:{fontWeight:"bold",marginBottom:o.length>0?4:0},children:n}),o.map((e,t)=>{const o=Cl(Ml(r,e.accessor),e.format);return kl("div",{style:t>0?{marginTop:2}:void 0,children:[kl("span",{style:{opacity:.7},children:[e.label,": "]}),wl("span",{children:o})]},t)})]})}}function Ll({categoryAccessor:e,valueAccessor:t,groupAccessor:o,groupLabel:r,pieData:n=!1,valueFormat:i}){return a=>{const s=n?a.data?.[0]||a.data||a:a.data||a,l=Ml(s,e),c=Ml(s,t),u=o?Ml(s,o):void 0;return kl("div",{className:"semiotic-tooltip",style:us,children:[wl("div",{style:{fontWeight:"bold"},children:Al(l)}),wl("div",{style:{marginTop:4},children:Cl(c,i)}),null!=u&&kl("div",{style:{marginTop:2,opacity:.8},children:[r||Sl(o),": ",Al(u)]})]})}}import{jsx as Rl,jsxs as Il}from"react/jsx-runtime";function $l(e){return null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+""}function Tl({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=ss(t);if(null!=e.title||e.entries.length>0)return Il("div",{className:"semiotic-tooltip",style:us,children:[null!=e.title&&Rl("div",{style:{fontWeight:600,marginBottom:e.entries.length?2:0},children:e.title+""}),e.entries.map(e=>Il("div",{style:{opacity:.7,fontSize:11},children:[e.key,":"," ",Rl("span",{style:{fontWeight:600},children:$l(e.value)})]},e.key))]})}return Il("div",{className:"semiotic-tooltip",style:us,children:[Rl("div",{style:{fontWeight:600,marginBottom:2},children:$l(o)}),Rl("div",{style:{opacity:.7,fontSize:11},children:$l(r)})]})}Tl.ownsChrome=!0;import{jsx as Nl,jsxs as Fl}from"react/jsx-runtime";var Dl={top:20,right:20,bottom:30,left:40},Bl=ma;function El(e){if(e)return"x"===e.dimension?"pan-y":"y"===e.dimension?"pan-x":"none"}var zl=f(p(function(e,t){const{chartType:o,runtimeMode:r,data:n,chunkThreshold:p,chunkSize:f,xAccessor:m,yAccessor:g,accessorRevision:y,colorAccessor:b,sizeAccessor:v,symbolAccessor:x,symbolMap:w,groupAccessor:k,lineDataAccessor:S,curve:A,normalize:C,baseline:M,stackOrder:P,binSize:_,valueAccessor:R,arrowOfTime:T="right",windowMode:N="sliding",windowSize:F=200,timeAccessor:D,xExtent:B,yExtent:E,extentPadding:z=.1,scalePadding:H,sizeRange:O,size:j=[500,300],responsiveWidth:Y,responsiveHeight:G,margin:q,className:V,background:X,lineStyle:U,pointStyle:K,areaStyle:Q,barStyle:Z,waterfallStyle:J,swarmStyle:ee,barColors:te,colorScheme:oe,boundsAccessor:re,boundsStyle:ne,y0Accessor:ie,band:ae,gradientFill:se,lineGradient:le,areaGroups:ce,openAccessor:ue,highAccessor:de,lowAccessor:he,closeAccessor:pe,candlestickStyle:fe,showAxes:me=!0,axes:ge,xLabel:ye,yLabel:be,yLabelRight:ve,xFormat:xe,yFormat:we,axisExtent:ke,tickFormatTime:Se,tickFormatValue:Ae,hoverAnnotation:Ce,tooltipContent:Me,customHoverBehavior:Pe,customClickBehavior:_e,enableHover:Le,hoverRadius:Re=30,tooltipMode:Ie,annotations:$e,autoPlaceAnnotations:Te,svgAnnotationRules:Ne,showGrid:Fe,legend:De,legendHoverBehavior:Be,legendClickBehavior:Ee,legendHighlightedCategory:ze,legendIsolatedCategories:He,legendPosition:Oe,legendLayout:We,legendCategoryAccessor:je,onCategoriesChange:Ye,backgroundGraphics:Ge,foregroundGraphics:qe,canvasPreRenderers:Ve,svgPreRenderers:Xe,title:Ue,categoryAccessor:Ke,brush:Qe,onBrush:Ze,decay:Je,pulse:et,transition:tt,animate:ot,staleness:rt,heatmapAggregation:nt,heatmapXBins:it,heatmapYBins:at,showValues:st,heatmapValueFormat:lt,marginalGraphics:ct,pointIdAccessor:ut,xScaleType:dt,yScaleType:ht,accessibleTable:pt=!0,description:ft,summary:mt,linkedCrosshairName:gt,linkedCrosshairSourceId:bt,customLayout:vt,onLayoutError:xt,layoutConfig:wt,layoutSelection:kt}=e,St=h().replace(/:/g,""),At=a(!1),Ct=a({w:-1,h:-1}),Mt=a(!1),Pt=Fs({sizeProp:j,responsiveWidth:Y,responsiveHeight:G,userMargin:q,marginDefault:Dl,animate:ot,transitionProp:tt,themeDirtyRef:At}),_t=ra(),Lt=sa(),{reducedMotionRef:Rt,responsiveRef:It,size:$t,currentTheme:Tt,transition:Nt,introEnabled:Ft,tableId:Dt,rafRef:Bt,renderFnRef:Et,scheduleRender:zt,cancelRender:Ht}=Pt;let Ot=Pt.margin;if(ct){const e=60,t={...Pt.margin};ct.top&&e>t.top&&(t.top=e),ct.bottom&&e>t.bottom&&(t.bottom=e),ct.left&&e>t.left&&(t.left=e),ct.right&&e>t.right&&(t.right=e),Ot=t}const Wt=$t[0]-Ot.left-Ot.right,jt=$t[1]-Ot.top-Ot.bottom,Yt=c(()=>I(n),[n]),Gt=Ce??Le,qt=a(null),Vt=a(null),[Xt,Ut]=s(0),Kt=a(0),[Qt,Zt]=s(null),Jt=(e,t)=>"function"==typeof e?e({size:$t,margin:Ot,scales:t}):e,eo=Jt(qe,Qt),to=Jt(Ge,Qt),oo=a(null),ro=a(null),no=a(void 0),[io,ao]=s(null),so=a(Bl.primary),co=a(function(){let e=-1,t=ma;return{resolve(o){if(!o)return ma;const r=Yo;return r===e||(t=function(e){if(!e)return ma;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(),a=r||t.getPropertyValue("--text-secondary").trim(),s=t.getPropertyValue("--text-primary").trim(),l=o||t.getPropertyValue("--surface-3").trim(),c=n||t.getPropertyValue("--surface-0").trim();return a||s||o||i?{axisStroke:l||ma.axisStroke,tickText:a||ma.tickText,crosshair:a?ga(a,"66"):ma.crosshair,hoverFill:c?ga(c,"4D"):ma.hoverFill,hoverStroke:a?ga(a,"99"):ma.hoverStroke,pointRing:c||ma.pointRing,primary:i||ma.primary,background:c||ma.background}:ma}(o),e=r),t},invalidate(){e=-1}}}()),uo=a(!1),ho=a(new po),fo=a([]),go=a(je),yo=a(Ye);go.current=je,yo.current=Ye;const[bo,vo]=s(!1),[xo,wo]=s([]),[So,Ao]=s([]),Po="streaming"===r||["bar","swarm","waterfall"].includes(o),_o=ua(c(()=>({chartType:o,runtimeMode:Po?"streaming":"bounded",windowSize:F,windowMode:N,arrowOfTime:Po?T:"right",extentPadding:z,scalePadding:H,axisExtent:ke,xAccessor:m,yAccessor:g,accessorRevision:y,timeAccessor:Po?D:void 0,valueAccessor:R,colorAccessor:b,sizeAccessor:v,symbolAccessor:x,symbolMap:w,groupAccessor:k||(S?"_lineGroup":void 0),categoryAccessor:Ke,lineDataAccessor:S,xScaleType:dt,yScaleType:ht,xExtent:B,yExtent:E,sizeRange:O,binSize:_,normalize:C,baseline:M,stackOrder:P,boundsAccessor:re,boundsStyle:ne,y0Accessor:ie,band:ae,gradientFill:!0===se?{topOpacity:.8,bottomOpacity:.05}:!1===se?void 0:se,areaGroups:ce?new Set(ce):void 0,lineGradient:le,openAccessor:ue,highAccessor:de,lowAccessor:he,closeAccessor:pe,candlestickStyle:fe,lineStyle:U,pointStyle:K,areaStyle:Q,swarmStyle:ee,waterfallStyle:J,colorScheme:oe,barColors:te,barStyle:Z,annotations:$e,decay:Je,pulse:et,transition:Nt,introAnimation:Ft,staleness:rt,heatmapAggregation:nt,heatmapXBins:it,heatmapYBins:at,showValues:st,heatmapValueFormat:lt,pointIdAccessor:ut,curve:A,themeCategorical:Tt?.colors?.categorical,themeSemantic:W(Tt),themeSequential:Tt?.colors?.sequential,themeDiverging:Tt?.colors?.diverging,customLayout:vt,onLayoutError:xt,layoutConfig:wt,layoutMargin:Ot}),[o,F,N,T,z,H,ke,m,g,y,D,R,dt,ht,b,v,x,w,k,Ke,S,B,E,O,_,C,M,P,re,ne,ie,ae,se,le,ce,ue,de,he,pe,fe,U,K,Q,ee,J,Z,oe,te,$e,Je,et,Nt?.duration,Nt?.easing,Ft,rt,nt,it,at,st,lt,Po,ut,A,Tt,vt,xt,wt,Ot])),Lo=a(null);Lo.current||(Lo.current=new lo(_o));const Ro=function(e,t,o,r){return zs(()=>{const n=t.current,i=o.current;if(!i||!n)return;const a=Hs(e.current?.getData()??[],n);Os(a,r.current)||(r.current=a,i(a))},[t,o,r,e])}(Lo,go,yo,fo);Co(Lo,_o,At,zt),Mo(Lo,kt,At,zt);const Io=a(null);Io.current||(Io.current=new $(e=>{const t=Lo.current;t&&t.ingest(e)&&(At.current=!0,zt())},{chunkThreshold:p,chunkSize:f})),l(()=>{Io.current?.updateChunkOptions({chunkThreshold:p,chunkSize:f})},[p,f]);const $o=u(e=>{Io.current?.push(e)},[]),To=u(e=>{Io.current?.pushMany(e)},[]),No=u(()=>{Io.current?.clear(),Lo.current?.clear(),At.current=!0,zt()},[zt]);d(t,()=>({push:$o,pushMany:To,remove:e=>{Io.current?.flush();const t=Lo.current?.remove(e)??[];return t.length>0&&(oo.current&&t.some(e=>e===oo.current?.data)&&(oo.current=null,ao(null)),At.current=!0,zt()),t},update:(e,t)=>{Io.current?.flush();const o=Lo.current?.update(e,t)??[];return o.length>0&&(At.current=!0,zt()),o},clear:No,getData:()=>(Io.current?.flush(),Lo.current?.getData()??[]),getScales:()=>Lo.current?.scales??null,getExtents:()=>Lo.current?.getExtents()??null,getCustomLayout:()=>Lo.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>Lo.current?.lastCustomLayoutFailure??null}),[$o,To,No,zt]),l(()=>{if(n){if(S&&Yt.length>0&&"object"==typeof Yt[0]&&null!==Yt[0]){const e="string"==typeof S?S:"coordinates";if(Array.isArray(Yt[0][e])){const t=[];for(const o of Yt){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 Io.current?.setBoundedData(t)}}Io.current?.setBoundedData(Yt)}},[n,Yt,S]);const{hoverHandlerRef:Fo,hoverLeaveRef:Do,onPointerMove:Bo,onPointerLeave:Eo}=Pt;Fo.current=e=>{if(!Gt)return;const t=qt.current;if(!t)return;const r=t.getBoundingClientRect(),n=e.clientX-r.left-Ot.left,i=e.clientY-r.top-Ot.top;if(0>n||n>Wt||0>i||i>jt)return void(oo.current&&(oo.current=null,ro.current=null,ao(null),Pe&&(Pe(null),At.current=!0),zt()));const a=Lo.current;if(!a||0===a.scene.length)return;const s=Ja(Re,e.pointerType),l=hr(a.scene,n,i,s,a.quadtree,a.maxPointRadius),c="multi"===Ie,u=()=>{oo.current&&(oo.current=null,ro.current=null,ao(null),Pe&&Pe(null),zt())};if(!l&&!c)return void u();const d=c||!l?n:l.x,h=c||!l?i:l.y,p=l?.datum?yt(l.datum,a.resolvedRibbons):{},f=a.scales?.x?.invert,g="function"==typeof f?f(d):void 0;let y=ts(p,d,h,null!=g?{xValue:g,xPx:d}:void 0);if(c&&a.scene.length>0&&a.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=pr(dr(e.path,e.curve),t,o);if(null===i)continue;const a=Sr(e.path,t);r.push({node:n,datum:Array.isArray(e.datum)&&e.datum[a]?e.datum[a]:e.datum,x:e.path[a][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=dr(e.topPath,e.curve),a=dr(e.bottomPath,e.curve),s=pr(i,t,o);if(null===s)continue;const l=pr(a,t,o),c=Sr(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:s,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}(a.scene,d,Math.max(s,Wt));if(e.length>0){const t=a.scales.y.invert,r=so.current,n=f?f(d):d;if(l)y.xValue=n,y.xPx=d;else{const e={xValue:n};"string"==typeof m&&(e[m]=n),y=ts(e,d,h,{xValue:n,xPx:d})}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:yt(e.datum,a.resolvedRibbons)}})}}l||y.allSeries?.length?(oo.current=y,ro.current=l?.node??null,ao(y),Pe&&(Pe(y),At.current=!0),zt()):u()},Do.current=()=>{oo.current&&(oo.current=null,ro.current=null,ao(null),Pe&&(Pe(null),At.current=!0),zt())};const Ho=a(()=>{});Ho.current=e=>{if(!_e)return;const t=qt.current;if(!t)return;const o=t.getBoundingClientRect(),r=e.clientX-o.left-Ot.left,n=e.clientY-o.top-Ot.top;if(0>r||r>Wt||0>n||n>jt)return void _e(null);const i=Lo.current;if(!i||0===i.scene.length)return void _e(null);const a=Ja(Re,no.current),s=hr(i.scene,r,n,a,i.quadtree,i.maxPointRadius);if(!s)return void _e(null);const l=s.datum||{},c=i.scales?.x?.invert,u="function"==typeof c?c(s.x):void 0;_e(ts(l,s.x,s.y,null!=u?{xValue:u,xPx:s.x}:void 0))};const Oo=u(e=>Ho.current(e),[]),Wo=a(-1),jo=a(null),Go=a(null),qo=u(e=>{const t=Lo.current;if(!t||0===t.scene.length)return;const o=t.version;let r;if(Go.current&&Go.current.version===o)r=Go.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=zo(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=Ar(e),Go.current={version:o,graph:r}}const n=Wo.current;if(0>n){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),Wo.current=0;const o=r.flat[0];jo.current={shape:o.shape,w:o.w,h:o.h};const n=Lr({...o,datum:yt(o.datum,t.resolvedRibbons)});return oo.current=n,ao(n),Pe&&Pe(n),void zt()}const i=Cr(r,n),a=Mr(e.key,i,r);if(null===a)return;if(e.preventDefault(),0>a)return Wo.current=-1,jo.current=null,oo.current=null,ro.current=null,ao(null),Pe&&Pe(null),void zt();Wo.current=a;const s=r.flat[a];jo.current={shape:s.shape,w:s.w,h:s.h};const l=Lr({...s,datum:yt(s.datum,t.resolvedRibbons)});oo.current=l,ao(l),Pe&&Pe(l),zt()},[Pe,zt]),Vo=u(e=>{no.current=e.pointerType,Wo.current=-1,jo.current=null,Bo(e)},[Bo]),Xo=u(e=>{no.current="mouse",Wo.current=-1,jo.current=null,Bo({clientX:e.clientX,clientY:e.clientY,pointerType:"mouse"})},[Bo]),Uo=u(e=>{no.current=e.pointerType},[]);Et.current=()=>{Bt.current=null;const e=qt.current,t=Vt.current;if(!e||!t)return;const r=Lo.current;if(!r)return;const n="undefined"!=typeof performance?performance.now():Date.now(),i=r.advanceTransition(Rt.current?n+1e6:n),a=!Rt.current&&i,s=Ct.current.w!==Wt||Ct.current.h!==jt,l=At.current||i||s,c=r.consumeStylePaintPending();let u=!1;const d=r.getLastUpdateResult(),h=ho.current.beforeCompute(d,a);!l||a&&!s||(r.computeScene({width:Wt,height:jt}),Ct.current={w:Wt,h:jt},u=!0,Ro()),ho.current.afterCompute(h,u,s);const p=Ds(r,n,u,Mt),f=Es(),y=co.current.resolve(e);so.current=y.primary;const b=Nr(rt,r.lastIngestTime>0?n-r.lastIngestTime:0),v=rt&&b.isStale;if(l||c||p.changed){const t=Bs(e,$t,Ot,f);if(t){if(t.clearRect(-Ot.left,-Ot.top,$t[0],$t[1]),rt&&1>b.alpha&&(t.globalAlpha=b.alpha),fa(t,{background:X,hasBackgroundGraphics:!!Ge,themeBackground:y.background,x:-Ot.left,y:-Ot.top,width:$t[0],height:$t[1]}),t.save(),"function"==typeof t.rect&&(t.beginPath(),t.rect(0,0,Wt,jt),t.clip()),Ve&&r.scales)for(const e of Ve)t.save(),e(t,r.scene,r.scales,{width:Wt,height:jt}),t.restore();const e=vt?xl.custom:xl[o];if(e&&r.scales)for(const o of e)o(t,r.scene,r.scales,{width:Wt,height:jt});t.restore(),rt&&1>b.alpha&&(t.globalAlpha=1)}}const x=!!(Gt&&oo.current&&r.scales),w=!!(ro.current&&Array.isArray(Ce)&&Ce.some(e=>e&&"object"==typeof e&&"highlight"===e.type)),k=x||w;if(k||uo.current){const e=Bs(t,$t,Ot,f);if(e&&(e.clearRect(-Ot.left,-Ot.top,$t[0],$t[1]),x&&oo.current&&function(e,t,o,r,n,i,a){if(!1===n.crosshair)return;const s=t.allSeries,l=s&&s.length>0,c=t.xPx??t.x;e.save();const u="object"==typeof n.crosshair?n.crosshair:{};if(e.strokeStyle=u.stroke||a.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=a.pointRing;for(const t of s)null!=t.valuePx&&(e.beginPath(),e.arc(c,t.valuePx,4,0,2*Math.PI),e.fillStyle=t.color||a.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)||a.primary;e.beginPath(),e.arc(t.x,t.y,4,0,2*Math.PI),e.fillStyle=o,e.fill(),e.strokeStyle=a.pointRing,e.lineWidth=2,e.stroke()}}(e,oo.current,Wt,jt,"object"==typeof Gt?Gt:{},ro.current,y),w&&ro.current&&Array.isArray(Ce))){const t=Ce.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,ro.current,t,y)}uo.current=k}l&&e&&e.setAttribute("aria-label",La(r.scene,o+" chart"));const S=At.current;if(At.current=S&&a&&!u,S&&r.scales){const e=e=>"object"==typeof e&&null!==e&&"function"==typeof e.valueOf?e.valueOf():e;if((!Qt||e(Qt.x.domain()[0])!==e(r.scales.x.domain()[0])||e(Qt.x.domain()[1])!==e(r.scales.x.domain()[1])||e(Qt.y.domain()[0])!==e(r.scales.y.domain()[0])||e(Qt.y.domain()[1])!==e(r.scales.y.domain()[1])||Qt.x.range()[0]!==r.scales.x.range()[0]||Qt.x.range()[1]!==r.scales.x.range()[1]||Qt.y.range()[0]!==r.scales.y.range()[0]||Qt.y.range()[1]!==r.scales.y.range()[1])&&Zt(r.scales),ct){const e=r.getData(),t="function"==typeof m?m:e=>e[m||"x"],o="function"==typeof g?g:e=>e[g||"y"];wo(e.map(e=>t(e)).filter(e=>"number"==typeof e&&isFinite(e))),Ao(e.map(e=>o(e)).filter(e=>"number"==typeof e&&isFinite(e)))}}!(($e&&$e.length>0||vt)&&(u||a))||!u&&33>n-Kt.current||(Ut(e=>e+1),Kt.current=n),rt?.showBadge&&vo(!!v),(a||null!=r.activeTransition||p.pending)&&zt()},la({hydrated:_t,wasHydratingFromSSR:Lt,storeRef:Lo,dirtyRef:At,renderFnRef:Et,cancelRender:Ht,cleanup:()=>Io.current?.clear()}),l(()=>{At.current=!0,zt()},[o,Wt,jt,me,X,Ge,U,Ve,zt]),Fr(rt,Lo,At,zt,bo,vo);const Ko=c(()=>{if(xe||Se)return;const e=Lo.current;return e?.xIsDate&&Qt?qs(Qt.x.domain()):void 0},[xe,Se,Qt]),Qo=xe||Se||Ko,Zo=Gt&&io?Me?Me(io):Nl(Tl,{hover:io}):null,Jo=Zo?Nl(bs,{x:io.x,y:io.y,containerWidth:Wt,containerHeight:jt,margin:Ot,className:"stream-frame-tooltip",children:Zo}):null,er=jo.current,tr=Nl(Qa,{active:Wo.current>=0,hoverPoint:io,margin:Ot,size:$t,shape:er?.shape,width:er?.w,height:er?.h}),or=Ws(m,D,"__semiotic_resolvedX","__semiotic_resolvedTime"),rr=Ws(g,R,"__semiotic_resolvedY","__semiotic_resolvedValue"),nr=or.key,ir=rr.key,ar=js(or,rr,$e&&$e.length>0||!1);if(Ki||!_t&&Lt){const e=Lo.current;e&&n&&(e.ingest({inserts:Yt,bounded:!0}),e.computeScene({width:Wt,height:jt}));const t=e?.scene??[],o=e?.scales??null,r=Jt(qe,o),a=Jt(Ge,o),s=Qo||(()=>{if(e?.xIsDate&&o)return qs(o.x.domain())})();return Fl("div",{ref:It,className:"stream-xy-frame"+(V?" "+V:""),role:"img","aria-label":ft||("string"==typeof Ue?Ue:"XY chart"),style:{position:"relative",width:Y?"100%":$t[0],height:G?"100%":$t[1]},children:[Nl(qa,{summary:mt}),Fl("svg",{xmlns:"http://www.w3.org/2000/svg",width:$t[0],height:$t[1],style:{position:"absolute",left:0,top:0},children:[Nl("g",{transform:`translate(${Ot.left},${Ot.top})`,children:a}),Fl("g",{transform:`translate(${Ot.left},${Ot.top})`,children:[X&&Nl("rect",{x:0,y:0,width:Wt,height:jt,fill:X}),Xe&&o&&Xe.map((e,r)=>Nl(i.Fragment,{children:e(t,o,{width:Wt,height:jt})},"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 ji("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 Yi("g",{children:[ji("defs",{children:ji("clipPath",{id:e,children:ji("rect",{x:r.clipRect.x,y:r.clipRect.y,width:r.clipRect.width,height:r.clipRect.height})})}),ji("path",{d:n,fill:qi(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 ji("path",{d:n,fill:qi(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 ji("circle",{cx:o.x,cy:o.y,r:o.r,fill:qi(o.style.fill),opacity:o.style.opacity??.8,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth},"point-"+t)}case"symbol":return Vi(e,t);case"glyph":return Xi(e,e.x,e.y,`${o??""}glyph-${e.pointId??t}`);case"rect":{const o=e;return ji("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:qi(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),a=.299*r+.587*n+.114*i>128?"#000":"#fff",s=Math.max(10,Math.min(16,.3*Math.min(o.w,o.h)));return Yi("g",{children:[ji("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:o.fill}),ji("text",{x:o.x+o.w/2,y:o.y+o.h/2,textAnchor:"middle",dominantBaseline:"middle",fill:a,fontSize:s+"px",children:e})]},"heatcell-"+t)}return ji("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 Yi("g",{children:[ji("line",{x1:o.x,y1:o.highY,x2:o.x,y2:o.lowY,stroke:o.wickColor,strokeWidth:o.wickWidth}),ji("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,St)).filter(Boolean)]})]}),Nl(Fi,{width:Wt,height:jt,totalWidth:$t[0],totalHeight:$t[1],margin:Ot,scales:o,showAxes:me,axes:ge,xLabel:ye,yLabel:be,yLabelRight:ve,xFormat:s,yFormat:we||Ae,axisExtent:ke,showGrid:Fe,title:Ue,legend:De,legendHoverBehavior:Be,legendClickBehavior:Ee,legendHighlightedCategory:ze,legendIsolatedCategories:He,legendPosition:Oe,legendLayout:We,foregroundGraphics:mo(r,ko(Lo.current?.customLayoutOverlays,kt??null)),marginalGraphics:ct,xValues:[],yValues:[],annotations:$e,autoPlaceAnnotations:Te,svgAnnotationRules:Ne,annotationFrame:0,xAccessor:nr,yAccessor:ir,annotationData:ar(e?.getData()),pointNodes:Vs(e?.scene),curve:"string"==typeof A?A:void 0,linkedCrosshairName:gt,linkedCrosshairSourceId:bt})]})}return Fl("div",{ref:It,className:"stream-xy-frame"+(V?" "+V:""),role:"group","aria-label":ft||("string"==typeof Ue?Ue:"XY chart"),tabIndex:0,style:{position:"relative",width:Y?"100%":$t[0],height:G?"100%":$t[1],overflow:"visible",touchAction:El(Qe)},onKeyDown:qo,children:[pt&&Nl(Va,{tableId:Dt}),pt&&Nl(Ya,{scene:Lo.current?.scene??[],chartType:o+" chart",tableId:Dt,chartTitle:"string"==typeof Ue?Ue:void 0}),Nl(qa,{summary:mt}),Nl(Xa,{hoverPoint:io}),Fl("div",{role:"img","aria-label":ft||("string"==typeof Ue?Ue:"XY chart"),style:{position:"relative",width:"100%",height:"100%"},onPointerMove:Gt?Vo:void 0,onMouseMove:Gt?Xo:void 0,onPointerLeave:Gt?Eo:void 0,onMouseLeave:Gt?Eo:void 0,onPointerDown:Gt||_e?Uo:void 0,onClick:_e?Oo:void 0,children:[to&&Nl("svg",{style:{position:"absolute",left:0,top:0,width:$t[0],height:$t[1],pointerEvents:"none"},children:Nl("g",{transform:`translate(${Ot.left},${Ot.top})`,children:to})}),Nl($i,{width:Wt,height:jt,totalWidth:$t[0],totalHeight:$t[1],margin:Ot,scales:Qt,showAxes:me,axes:ge,showGrid:Fe,xFormat:Qo,yFormat:we||Ae,axisExtent:ke}),Nl("canvas",{ref:qt,"aria-label":La(Lo.current?.scene??[],o+" chart"),style:{position:"absolute",left:0,top:0}}),Nl("canvas",{ref:Vt,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),Nl(Fi,{width:Wt,height:jt,totalWidth:$t[0],totalHeight:$t[1],margin:Ot,scales:Qt,showAxes:me,axes:ge,xLabel:ye,yLabel:be,yLabelRight:ve,xFormat:Qo,yFormat:we||Ae,axisExtent:ke,showGrid:Fe,title:Ue,legend:De,legendHoverBehavior:Be,legendClickBehavior:Ee,legendHighlightedCategory:ze,legendIsolatedCategories:He,legendPosition:Oe,legendLayout:We,foregroundGraphics:mo(eo,ko(Lo.current?.customLayoutOverlays,kt??null)),marginalGraphics:ct,xValues:xo,yValues:So,annotations:$e,autoPlaceAnnotations:Te,svgAnnotationRules:Ne,annotationFrame:Xt,xAccessor:nr,yAccessor:ir,annotationData:ar(Lo.current?.getData()),pointNodes:Vs(Lo.current?.scene),curve:"string"==typeof A?A:void 0,underlayRendered:!0,canvasObscuresUnderlay:"transparent"!==X&&!Ge,linkedCrosshairName:gt,linkedCrosshairSourceId:bt}),(Qe||Ze)&&Nl(L,{width:Wt,height:jt,totalWidth:$t[0],totalHeight:$t[1],margin:Ot,dimension:Qe?.dimension??"xy",scales:Qt,onBrush:Ze??(()=>{}),binSize:_,snap:Qe?.snap,binBoundaries:Qe?.binBoundaries??("bar"===o?Lo.current?.getBinBoundaries():void 0),snapDuring:Qe?.snapDuring,streaming:"streaming"===r}),rt?.showBadge&&Nl(Br,{isStale:bo,position:rt.badgePosition}),tr,Jo]})]})}));zl.displayName="StreamXYFrame";var Hl=zl;import{useRef as Ol,useState as Wl,useEffect as jl,useMemo as Yl,useCallback as Gl,useImperativeHandle as ql,forwardRef as Vl,memo as Xl}from"react";import{scaleBand as Ul,scaleLinear as Kl}from"d3-scale";function Ql(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)+"",a=o?.[i];if(a)return a;let s=r.get(i);return s||(s=Rt[n%Rt.length],n++,r.set(i,s)),s}}function Zl(e,t,o,r,n,i,a){e.push(t?{type:"symbol",x:r,y:n,size:Math.PI*i*i,symbolType:t(o),style:a,datum:o}:{type:"point",x:r,y:n,r:i,style:a,datum:o})}function Jl(e,t){const{columns:o,config:r,resolvePieceStyle:n}=e,i=[],a=Math.min(t.width,t.height)/2-4,s="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,m=n(t.pieceData[0],t.name),g=0===e,y=e===d.length-1,b={type:"wedge",cx:0,cy:0,innerRadius:s,outerRadius:a,startAngle:h,endAngle:f,...r.cornerRadius&&{cornerRadius:r.cornerRadius},style:m,datum:o?._nonInteractive?null:t.pieceData,category:t.name};o?._roundedEnds?b.roundedEnds=o._roundedEnds:p&&(b.roundedEnds={start:g,end:y}),o?._gradientBand&&(b._gradientBand=o._gradientBand),i.push(b)}return i}import{quantile as ec}from"d3-array";function tc(e){const t=e.length,o=e[0],r=e[t-1];return{n:t,min:o,q1:ec(e,.25)??o,median:ec(e,.5)??(o+r)/2,q3:ec(e,.75)??r,max:r,mean:e.reduce((e,t)=>e+t,0)/t}}import{scaleLinear as oc}from"d3-scale";var rc={bar:function(e,t){const{scales:o,columns:r,config:n,getR:i,getStack:a,resolvePieceStyle:s}=e,{r:l,projection:c}=o,u=[],d="vertical"===c,h="horizontal"===c,p=n.normalize,f=[];if(a){const e=new Set;for(const t of Object.values(r))for(const o of t.pieceData){const t=a(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=a?a(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 m=s(c.pieces[0],a?i:e.name),g={...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(ut(e.x,t,e.width,Math.abs(o),m,g,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(ut(t,e.x,Math.abs(o),e.width,m,g,i)),0>f?n+=f:r+=f}}}const m="vertical"===c,g=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=m?0>t?"bottom":"top":0>t?"left":"right",n.gradientFill&&(e.fillGradient=n.gradientFill)}if(g>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(m?(e,t)=>t.y>e.y?e:t:(e,t)=>e.x+e.w>t.x+t.w?e:t).roundedTop=g),o.length>0&&(o.reduce(m?(e,t)=>e.y+e.h>t.y+t.h?e:t:(e,t)=>t.x>e.x?e:t).roundedTop=g)}}return u},clusterbar:function(e,t){const{scales:o,columns:r,config:n,getR:i,getGroup:a,resolvePieceStyle:s}=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=a?a(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=a?a(t):"_default";n.has(e)||n.set(e,[]),n.get(e).push(t)}for(let a=0;h.length>a;a++){const c=n.get(h[a])||[];for(const n of c){const c=i(n),p=s(n,h[a]);if(d){const i=e.x+a*t+o/2,s=l(0),d=l(c);u.push(ut(i,Math.min(s,d),r,Math.abs(s-d),p,n,h[a]))}else{const i=e.x+a*t+o/2,s=l(0),d=l(c);u.push(ut(Math.min(s,d),i,Math.abs(d-s),r,p,n,h[a]))}}}}const m=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);m>0&&(e.roundedTop=m),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:a}=e,{r:s,projection:l}=o,c=[],u="vertical"===l,d="radial"===l,h=i.length>0,p=Ql(e),f=2*Math.PI,m=-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]||s,g=a(t,e.name),y=g.r||5;let b,v;if(d){const t=m+(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);Zl(c,p,t,b,v,y,g)}return c},swarm:function(e,t){const{scales:o,columns:r,getR:n,resolvePieceStyle:i}=e,{r:a,projection:s}=o,l=[],c="vertical"===s,u=Ql(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],s=n(r),d=i(r,e.name),h=d.r||4,p=(7919*o%100/100-.5)*t*.8;Zl(l,u,r,c?e.middle+p:a(s),c?a(s):e.middle+p,h,d)}}return l},pie:Jl,donut:Jl,boxplot:function(e,t){const{scales:o,columns:r,config:n,getR:i,resolveSummaryStyle:a}=e,{r:s,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=ec(o,.25)??r,h=ec(o,.5)??(r+n)/2,p=ec(o,.75)??n,f=p-l,m=l-1.5*f,g=p+1.5*f,y=o.find(e=>e>=m)??r,b=[...o].reverse().find(e=>g>=e)??n,v=a(t.pieceData[0],t.name),x=[];if(d)for(const e of t.pieceData){const o=i(e);if(m>o||o>g){const r=u?t.middle:s(o),n=u?s(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:s(y),q1Pos:s(l),medianPos:s(h),q3Pos:s(p),maxPos:s(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,o){const{scales:r,columns:n,config:i,getR:a,resolveSummaryStyle:s}=e,{r:l,projection:c}=r,u=[],d="vertical"===c,h=i.bins||20,p=!1!==i.showIQR;for(const e of Object.values(n)){const o=e.pieceData.map(e=>a(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>o.length)continue;const r=o[0],n=o[o.length-1],i=(n-r)/h||1,c=Array(h).fill(0);for(const e of o)c[Math.min(Math.floor((e-r)/i),h-1)]++;const f=t(c,1),m=e.width/2*.9;let g;if(d){g=`M ${e.middle} ${l(r)}`;for(let t=0;h>t;t++){const o=l(r+(t+.5)*i);g+=` L ${e.middle+c[t]/f*m} ${o}`}g+=` L ${e.middle} ${l(n)}`;for(let t=h-1;t>=0;t--){const o=l(r+(t+.5)*i);g+=` L ${e.middle-c[t]/f*m} ${o}`}g+=" Z"}else{g=`M ${l(r)} ${e.middle}`;for(let t=0;h>t;t++)g+=` L ${l(r+(t+.5)*i)} ${e.middle-c[t]/f*m}`;g+=` L ${l(n)} ${e.middle}`;for(let t=h-1;t>=0;t--)g+=` L ${l(r+(t+.5)*i)} ${e.middle+c[t]/f*m}`;g+=" Z"}const y=s(e.pieceData[0],e.name);let b;if(p&&o.length>=4){const t=ec(o,.25)??r,i=ec(o,.5)??(r+n)/2,a=ec(o,.75)??n;b={q1Pos:l(t),medianPos:l(i),q3Pos:l(a),centerPos:e.middle,isVertical:d}}const v=d?{x:e.x,y:Math.min(l(n),l(r)),width:e.width,height:Math.abs(l(n)-l(r))}:{x:Math.min(l(r),l(n)),y:e.x,width:Math.abs(l(n)-l(r)),height:e.width};u.push({type:"violin",pathString:g,translateX:0,translateY:0,bounds:v,iqrLine:b,stats:tc(o),style:y,datum:e.pieceData,category:e.name})}return u},histogram:function(e,o){const{scales:n,columns:i,config:a,getR:s,resolveSummaryStyle:l}=e,{r:c}=n,u=[],d=a.bins||25,h=a.normalize,p=c.domain?.(),f=p?+p[0]:void 0,m=p?+p[1]:void 0;for(const e of Object.values(i)){const o=e.pieceData.map(e=>s(e)).filter(e=>null!=e&&!isNaN(e));if(0===o.length)continue;const[n,i]=r(o),a=null!=f&&isFinite(f)?f:n,p=null!=m&&isFinite(m)?m:i,g=(p-a)/d||1,y=Array(d).fill(0);for(const e of o)a>e||e>p||y[Math.min(Math.floor((e-a)/g),d-1)]++;const b=o.length,v=t(y,1),x=l(e.pieceData[0],e.name);for(let t=0;d>t;t++){if(0===y[t])continue;const o=(h?y[t]/b:y[t]/v)*e.width*.9,r=c(a+t*g),n=c(a+(t+1)*g);u.push(ut(Math.min(r,n),e.x+e.width-o,Math.abs(n-r),o,x,{bin:t,count:y[t],range:[a+t*g,a+(t+1)*g],category:e.name},e.name))}}return u},ridgeline:function(e,o){const{scales:r,columns:n,config:i,getR:a,resolveSummaryStyle:s}=e,{r:l,projection:c}=r,u=[],d=i.bins||20,h="horizontal"===c,p=i.amplitude||1.5;for(const e of Object.values(n)){const o=e.pieceData.map(e=>a(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>o.length)continue;const r=o[0],n=o[o.length-1],i=(n-r)/d||1,c=Array(d).fill(0);for(const e of o)r>e||e>n||c[Math.min(Math.floor((e-r)/i),d-1)]++;const f=t(c,1),m=s(e.pieceData[0],e.name),g=e.width*p;let y;if(h){const t=e.x+e.width;y=`M ${l(r)} ${t}`;for(let e=0;d>e;e++)y+=` L ${l(r+(e+.5)*i)} ${t-c[e]/f*g}`;y+=` L ${l(n)} ${t} Z`}else{const t=e.x;y=`M ${t} ${l(r)}`;for(let e=0;d>e;e++){const o=l(r+(e+.5)*i);y+=` L ${t+c[e]/f*g} ${o}`}y+=` L ${t} ${l(n)} Z`}const b=h?{x:Math.min(l(r),l(n)),y:e.x,width:Math.abs(l(n)-l(r)),height:e.width}:{x:e.x,y:Math.min(l(n),l(r)),width:e.width,height:Math.abs(l(n)-l(r))};u.push({type:"violin",pathString:y,translateX:0,translateY:0,bounds:b,stats:tc(o),style:{...m,fillOpacity:m.fillOpacity??.5},datum:e.pieceData,category:e.name})}return u},timeline:function(e,t){const{scales:o,columns:r,getRawRange:n,resolvePieceStyle:i}=e,{r:a,projection:s}=o,l=[],c="horizontal"===s;for(const e of Object.values(r))for(const t of e.pieceData){const o=n(t);if(!o)continue;const[r,s]=o,u=i(t,e.name);if(c){const o=a(Math.min(r,s)),n=a(Math.max(r,s));l.push(ut(o,e.x,n-o,e.width,u,t,e.name))}else{const o=a(Math.max(r,s)),n=a(Math.min(r,s));l.push(ut(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,a=[],s=t.width/2,l=!1!==e.config.showLabels,c=e.scales.o.domain().map(e=>o[e]).filter(Boolean);if(0===c.length)return a;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 a=t.get(e),s=r(i);a.total+=s,a.pieces.push(i),o+=s}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 a;const m=new Map;for(const e of u){const t=p[0].groups.get(e);m.set(e,t?.total??0)}const g=p[0].stepTotal,y=h?.95*s:.9*t.width,b=oc().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=s,c=s;for(let h=0;u.length>h;h++){const p=u[h],g=o.groups.get(p);if(!g)continue;const v=b(g.total),x=h%2==0,w=x?t:c-v;x?t+=v:c-=v;const k=i(g.pieces[0],p),S=m.get(p)??g.total,A={...g.pieces[0],__funnelValue:g.total,__funnelPercent:S>0?g.total/S*100:0,__funnelStep:r.name,__funnelIsFirstStep:n,__aggregateValue:g.total,__pieceCount:g.pieces.length,category:p};l&&(0===h&&(A.__funnelStepLabel=r.name,A.__funnelStepLabelX=s,A.__funnelStepLabelY=f,A.__funnelRowWidth=e),A.__funnelValueLabelX=w+v/2,A.__funnelValueLabelY=f,A.__funnelBarW=v),a.push(ut(w,f,v,d,k,A,p)),y.set(p,{x:w,y:f,w:v,h:d})}}else{const e=o.stepTotal,t=b(e),c=s-t/2,h=u[0],p="_default"!==h,m=o.groups.get(h)?.pieces[0]??r.pieceData[0],v=p?h:r.name,x=i(m,v),w=g>0?e/g*100:0,k={...m,__funnelValue:e,__funnelPercent:w,__funnelStep:r.name,__funnelIsFirstStep:n,category:p?h:r.name};l&&(k.__funnelStepLabel=r.name,k.__funnelStepLabelX=s,k.__funnelStepLabelY=f,k.__funnelRowWidth=t,k.__funnelValueLabelX=s,k.__funnelValueLabelY=f,k.__funnelBarW=t),a.push(ut(c,f,t,d,x,k,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),s=y.get(n);if(!t||!s)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],[s.x+s.w,s.y],[s.x,s.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};a.push(c)}}x=y}return a},"bar-funnel":function(e,t){const{columns:o,getR:r,getStack:n,resolvePieceStyle:i,scales:a}=e,s=[],l=a.o.domain().map(e=>o[e]).filter(Boolean);if(0===l.length)return s;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 a=t.get(e),s=r(i);a.total+=s,a.pieces.push(i),o+=s}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=a.r,m=d?c.length:1,g=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,a=o.width/m,l=a*g,u=a-l;for(let e=0;c.length>e;e++){const h=c[e],m=t.groups.get(h);if(!m)continue;const g=m.total,y=p.get(h)??g,b=y>0?g/y*100:0,v=n?.groups.get(h),x=r?0:Math.max(0,(v?.total??g)-g),w=o.x+e*a+l/2,k=f(g),S=f(0)-k,A=i(m.pieces[0],d?h:o.name),C={...m.pieces[0],__barFunnelValue:g,__barFunnelPercent:b,__barFunnelIsFirstStep:r,__barFunnelIsDropoff:!1,__barFunnelStep:o.name,__barFunnelDropoffValue:x,__barFunnelCategory:"_default"===h?void 0:h,category:d?h:o.name,__barFunnelLabelX:w+u/2,__barFunnelLabelY:f(g+x)};if(s.push(ut(w,k,u,S,A,C,d?h:o.name)),x>0){const e=f(g+x),t=k-e,r={...A},n={...m.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};s.push(ut(w,e,u,t,r,n,d?h:o.name))}}}return s},swimlane:function(e,t){const{scales:o,columns:r,getR:n,getStack:i,resolvePieceStyle:a}=e,{r:s,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]=s.range(),i=Math.min(o,n),a=Math.abs(n-o);for(const o of Object.values(r)){const r={fill:e,opacity:t},n=u?ut(i,o.x,a,o.width,r,null,"__track__"):ut(o.x,i,o.width,a,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=a(o,l);let f;if(u){const n=s(t),i=s(t+r);f=ut(n,e.x,i-n,e.width,p,o,l)}else{const n=s(t+r),i=s(t);f=ut(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 nc(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=Te[e];if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:o}function ic(e,t){const o=t&&"object"==typeof t&&!Array.isArray(t)?t:void 0;return 0===e.length?e=>o&&ze(o,e)||"#4e79a7":t=>{if(o){const e=ze(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 ac=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],sc=["scene-style","data-paint","accessibility","evidence"],lc=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],cc=new Set(["accessorRevision","axisExtent","categoryAccessor","chartType","extentPadding","groupBy","multiAxis","normalize","oAccessor","oExtent","oSort","rAccessor","rExtent","runtimeMode","stackBy","timeAccessor","valueAccessor"]),uc=new Set(["barColors","colorScheme","connectorStyle","pieceStyle","summaryStyle","themeCategorical","themeDiverging","themeSemantic","themeSequential"]),dc=class{constructor(){this.tracker=new eo}get last(){return this.tracker.last}recordData(e,t){return this.tracker.record({kind:e,...void 0===t?{}:{count:t}},ac)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},sc):this.recordNoop("restyle")}recordConfig(e){if(0===e.length)return this.tracker.record({kind:"config",keys:e},[]);const t=new Set(lc);return e.some(e=>cc.has(e))&&t.add("domain"),e.some(e=>uc.has(e))&&t.add("scene-style"),this.tracker.record({kind:"config",keys:e},t)}};import{quadtree as hc}from"d3-quadtree";var pc=class{constructor(e){this.rExtent=new Z,this.rExtents=[],this.windowSizeWarned=!1,this.updateResults=new dc,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 Q(e.windowSize),this.getO=oe(e.categoryAccessor||e.oAccessor,"category");const t=e.valueAccessor||e.rAccessor;Array.isArray(t)?(this.rAccessors=t.map(e=>ee(e,"value")),this.getR=this.rAccessors[0],this.rExtents=t.map(()=>new Z)):(this.getR=ee(t,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=oe(e.stackBy),this.getGroup=oe(e.groupBy),this.getColor=oe(e.colorAccessor),this.getSymbol=oe(e.symbolAccessor),this.getConnector=oe(e.connectorAccessor),this.getDataId=oe(e.dataIdAccessor),e.pulse&&(this.timestampBuffer=new Q(e.windowSize))}syncPulseTimestampBuffer(){var e,t,o,r;this.timestampBuffer=(e=!!this.config.pulse,t=this.buffer,o=this.timestampBuffer,r=Ge(),e?null!=o&&o.capacity===t.capacity&&o.size===t.size?o:Xt(t,r):null)}ingest(e){const t=Ge();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(),Vt(this.buffer,e.totalSize||e.inserts.length,this.timestampBuffer);for(const o of e.inserts)Ut(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=Ut(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 a=this.getBufferArray(),s=t.projection||"vertical",l=t.oExtent||this.resolveCategories(a),c=this.computeValueDomain(a,l),u="horizontal"===s,d="radial"===s,h=Math.min(.9,Math.max(0,null!=t.barPadding?t.barPadding/("vertical"===s?e.width:e.height):.1));let p,f;if(d){p=Ul().domain(l).range([0,1]).padding(0);const o=Math.min(e.width,e.height)/2,r=t.innerRadius||0;f=Kl().domain(c).range([r,o])}else u?(p=Ul().domain(l).range([0,e.height]).padding(h),f=Kl().domain(c).range([0,e.width])):(p=Ul().domain(l).range([0,e.width]).padding(h),f=Kl().domain(c).range([e.height,0]));this.scales={o:p,r:f,projection:s},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[a,s]=i.extent;a===1/0&&(a=0,s=1);const l=s-a,c=l>0?l*(t.extentPadding??.05):1;return a-=c,s+=c,a>0&&(a=0),u?Kl().domain([a,s]).range([0,e.width]):Kl().domain([a,s]).range([e.height,0])}):[];let m=a;this.rAccessors.length>1&&(m=a.flatMap(e=>this.rAccessors.map((t,o)=>({...e,__rIndex:o,__rValue:t(e),__rName:this.resolveRAccessorName(o)})))),this.columns=this.buildColumns(m,l,p,s,e),this._customLayoutFailedThisBuild=!1;const g=this.buildSceneNodes(m,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=g,this.rebuildPointQuadtree(),this.config.decay&&this.applyDecay(this.scene,a),this.config.pulse&&this.applyPulse(this.scene,a),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 a=new Map;for(const t of e){const e=this.getO(t);a.set(e,(a.get(e)||0)+Math.abs(this.getR(t)))}return i.sort("asc"===r?(e,t)=>(a.get(e)||0)-(a.get(t)||0):(e,t)=>(a.get(t)||0)-(a.get(e)||0))}computeValueDomain(e,t){return function(e){const{data:t,chartType:o,projection:r,normalize:n,rExtent:i,extentPadding:a=.05,baselinePadding:s,axisExtent:l,getO:c,getR:u,getStack:d,rawRExtent:h}=e,p=a;if("radial"===r&&("pie"===o||"donut"===o))return[0,1];let f=0,m=0;if("bar"===o&&d&&n)f=0,m=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>m&&(m=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>m&&(m=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>m&&(m=t)}else if("clusterbar"===o||"bar-funnel"===o)for(const e of t){const t=u(e);t>m&&(m=t),f>t&&(f=t)}else{const e=h[0],t=h[1];e!==1/0&&(f=e),t!==-1/0&&(m=t)}i&&(null!=i[0]&&(f=i[0]),null!=i[1]&&(m=i[1]));const g="bar"===o||"clusterbar"===o||"bar-funnel"===o||"swimlane"===o;if(g&&null==i?.[0]&&null==i?.[1]&&(f>0&&(f=0),0>m&&(m=0)),"bar-funnel"!==o&&"exact"!==l){const e=m-f,t=e>0?e*p:1,r=g&&!s&&0===f,n=g&&!s&&0===m||"swimlane"===o;null!=i?.[0]||r||(f-=t),null!=i?.[1]||n||(m+=t)}return[f,m]}({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:a,getO:s,getR:l}=e,c={},u=new Map;for(const e of t){const t=s(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(a&&"radial"!==n){h=new Map;let e=0;for(const t of o){const o=u.get(t)||[];let r;r="string"==typeof a?o.reduce((e,t)=>e+(Number(t[a])||0),0):a(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,a;h?(i=f,a=h.get(e)||r.bandwidth(),f+=a+r.padding()*r.step()):(i=r(e)??0,a=r.bandwidth()),c[e]={name:e,x:i,y:0,width:a,middle:i+a/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=Et("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 Ft({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=rc[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 a=[],{projection:s}=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,a;"point"===e.type?(r=e.x,a=e.y):(r=e.x+e.w/2,a=e.y+("vertical"===s?0:e.h/2)),l.has(o)||l.set(o,[]),l.get(o).push({x:r,y:a,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],s="function"==typeof u?u(n.datum):u||{stroke:e.config.themeSemantic?.border||e.config.themeSemantic?.secondary||"#999",strokeWidth:1,opacity:.5};a.push({type:"connector",x1:n.x,y1:n.y,x2:i.x,y2:i.y,style:s,datum:n.datum,group:t})}}return a}(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=nc(o.colorScheme,o.themeCategorical,Fe),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:ic(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||Fe,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?Je(o,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._dataVersion)return this._datumIndexCache.map;const t=et(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 a=e[i],s=o?t(a):a[r],l=n.get(s);l?l.push(i):n.set(s,[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:hc().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=Ge()){return!(!this.config.pulse||!this.timestampBuffer)&&function(e,t,o,r,n,i){const a=e.color??"rgba(255,255,255,0.6)",s=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 a of n(t)??[]){const t=o.get(a);null!=t&&(r=Math.max(r,tt(e,t,i)))}l=ot(c,r,a)||l;continue}if(null==c.datum)continue;const t=r.get(c.datum);if(null==t)continue;const u=o.get(t);l=ot(c,null==u?0:tt(e,u,i),a,s)||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&&rt(this.config.pulse,this.timestampBuffer,e)}get hasActivePulses(){return this.hasActivePulsesAt(Ge())}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],a=this.getNodeKey(i,e);a&&("rect"===i.type?this.prevPositionMap.set(a,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(a,{x:i.x,y:i.y,r:0,opacity:0}):"wedge"===i.type&&(void 0===r&&(r=i.startAngle),this.prevPositionMap.set(a,{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 a=this.prevPositionMap.get(i);if("point"===n.type)a?(o.add(i),n._targetOpacity=n.style.opacity??1,(a.x!==n.x||a.y!==n.y||void 0!==a.r&&a.r!==n.r)&&(n._targetX=n.x,n._targetY=n.y,n._targetR=n.r,n.x=a.x,n.y=a.y,void 0!==a.r&&(n.r=a.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)a?(o.add(i),n._targetOpacity=n.style.opacity??1,a.x===n.x&&a.y===n.y&&a.w===n.w&&a.h===n.h||(n._targetX=n.x,n._targetY=n.y,n._targetW=n.w,n._targetH=n.h,n.x=a.x,n.y=a.y,n.w=a.w??n.w,n.h=a.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(a)o.add(i),n._targetOpacity=n.style.opacity??1,a.startAngle===n.startAngle&&a.endAngle===n.endAngle||(n._targetStartAngle=n.startAngle,n._targetEndAngle=n.endAngle,n.startAngle=a.startAngle,n.endAngle=a.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:Ge(),duration:e})}advanceTransition(e){if(!this.activeTransition)return!1;const t=je(e,this.activeTransition),o=We(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=Ye(r?r.opacity??1:0,e._targetOpacity,o)}const r=this.prevPositionMap.get(t);void 0!==e._targetX&&r&&(e.x=Ye(r.x,e._targetX,o),e.y=Ye(r.y,e._targetY,o)),void 0!==e._targetR&&void 0!==r?.r&&(e.r=Ye(r.r,e._targetR,o))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const r=this.prevPositionMap.get(t);e.style.opacity=Ye(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=Ye(r.x,e._targetX,o),e.y=Ye(r.y,e._targetY,o),void 0!==r.w&&(e.w=Ye(r.w,e._targetW,o),e.h=Ye(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:Ye(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=Ye(r.startAngle,e._targetStartAngle,o),e.endAngle=Ye(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=ae(e),o=this.getDataId,r=e=>t.has(o(e));Kt(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=Ge(),this.updateResults.recordData("remove",n.length),n}update(e,t){if(!this.getDataId)throw Error("update() requires dataIdAccessor to be configured");const o=ae(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=Ge(),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&&!J(e.colorAccessor,t.colorAccessor))&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),("categoryAccessor"in e&&!J(e.categoryAccessor,t.categoryAccessor)||"oAccessor"in e&&!J(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)&&(J(this.config.categoryAccessor||this.config.oAccessor,t.categoryAccessor||t.oAccessor)||(this.getO=oe(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)=>!J(e,i[t])),n){const e=this.config.valueAccessor||this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>ee(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new Z)):(this.getR=ee(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!J(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?oe(this.config.stackBy):void 0),"groupBy"in e&&!J(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?oe(this.config.groupBy):void 0),"colorAccessor"in e&&!J(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?oe(this.config.colorAccessor):void 0),"symbolAccessor"in e&&!J(e.symbolAccessor,t.symbolAccessor)&&(this.getSymbol=null!=this.config.symbolAccessor?oe(this.config.symbolAccessor):void 0),"connectorAccessor"in e&&!J(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?oe(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 fc(e,t,o,r=30,n,i=0){let a=null;if(n){const e=Oo(n,t,o,r,i);e&&(a={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=mc(i,t,o);break;case"point":if(n)break;e=gc(i,t,o,r);break;case"symbol":e=yc(i,t,o,r);break;case"glyph":e=bc(i,t,o,r);break;case"wedge":if(null===i.datum)break;e=vc(i,t,o);break;case"boxplot":e=xc(i,t,o);break;case"violin":e=wc(i,t,o)}e&&r>e.distance&&(a&&e.distance>=a.distance||(a=e))}return a}function mc(e,t,o){const r=Po(t,o,e);return r.hit?{datum:e.datum,x:r.cx,y:e.y,distance:0,category:e.group}:null}function gc(e,t,o,r=30){const n=t-e.x,i=o-e.y,a=Math.sqrt(n*n+i*i);return a>_o(e.r,r)?null:{datum:e.datum,x:e.x,y:e.y,distance:a}}function yc(e,t,o,r=30){const n=t-e.x,i=o-e.y,a=Math.sqrt(n*n+i*i);return a>_o($t(e.size),r)?null:{datum:e.datum,x:e.x,y:e.y,distance:a}}function bc(e,t,o,r=30){if(null==e.datum)return null;const n=zo(e.glyph,e.size),i=e.x+n.centerDx,a=e.y+n.centerDy,s=t-i,l=o-a,c=Math.sqrt(s*s+l*l);return c>_o(n.radius,r)?null:{datum:e.datum,x:i,y:a,distance:c}}function vc(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 a=Io(Math.atan2(n,r)),s=Io(e.startAngle),l=Io(e.endAngle);if(!(s>l?a>=s||l>=a:a>=s&&l>=a))return null;const c=(e.startAngle+e.endAngle)/2,u=(e.innerRadius+e.outerRadius)/2;return{datum:e.datum,x:e.cx+Math.cos(c)*u,y:e.cy+Math.sin(c)*u,distance:0,category:e.category}}function xc(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 wc(e,t,o){if(!e.bounds)return null;const{x:r,y:n,width:i,height:a}=e.bounds;return r>t||t>r+i||n>o||o>n+a?null:{datum:e.datum,x:r+i/2,y:n+a/2,distance:0,category:e.category,stats:e.stats}}import{useMemo as kc,useRef as Sc}from"react";import{Fragment as Ac,jsx as Cc,jsxs as Mc}from"react/jsx-runtime";function Pc(e){const{width:t,height:o,totalWidth:r,totalHeight:n,margin:i,scales:a,showAxes:s,showGrid:l,rFormat:c}=e,{rTickValues:u,axisExtent:d}=e,h="radial"===a?.projection,p="horizontal"===a?.projection,f=kc(()=>!a||h?[]:(u||Si(a.r,5,d)).map(e=>({value:e,pixel:a.r(e),label:(c||_c)(e)})),[a,c,h,u,d]),m=l&&a&&!h,g=s&&a&&!h;return m||g?Cc("svg",{width:r,height:n,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:Mc("g",{transform:`translate(${i.left},${i.top})`,children:[m&&Cc("g",{className:"ordinal-grid",children:f.map((e,r)=>Cc("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))}),g&&Cc(Ac,{children:Mc(Ac,p?{children:[Cc("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),Cc("line",{x1:0,y1:o,x2:t,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]}:{children:[Cc("line",{x1:0,y1:o,x2:t,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),Cc("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]})})]})}):null}function _c(e){return Math.round(100*e)/100+""}function Lc(e){const{width:t,height:o,totalWidth:r,totalHeight:n,margin:i,scales:a,showAxes:s,showCategoryTicks:l,oLabel:c,rLabel:u,oFormat:d,rFormat:h,showGrid:p,title:f,legend:m,legendHoverBehavior:g,legendClickBehavior:y,legendHighlightedCategory:b,legendIsolatedCategories:v,legendPosition:x="right",legendLayout:w,foregroundGraphics:k,annotations:S,autoPlaceAnnotations:A,svgAnnotationRules:C,xAccessor:M,yAccessor:P,annotationData:_,underlayRendered:L,children:R}=e,I="radial"===a?.projection,$="horizontal"===a?.projection,T=!1!==l,N=kc(()=>{if(!s||!T||!a||I)return[];const e=a.o.bandwidth(),t=a.o.domain().map((t,o)=>({value:t,pixel:(a.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=$?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)},[s,T,a,d,I,$]),F=e.rTickValues,D=e.tickLabelEdgeAlign,B=e.axisExtent,E=kc(()=>s&&a&&!I?(F||Si(a.r,5,B)).map(e=>({value:e,pixel:a.r(e),label:(h||_c)(e)})):[],[s,a,h,I,F,B]),z=Sc(new Map),H=Sc(S?.length??0),O=S?.length??0;H.current!==O&&(H.current=O,z.current=new Map);const W=kc(()=>{if(!S||0===S.length)return null;const e=qn(),r="horizontal"===a?.projection,n=a?.o?e=>(a.o(e)??0)+a.o.bandwidth()/2:null,i={scales:a?{x:r?a.r:n||a.r,y:r&&n||a.r,time:a.r,value:a.r,o:a.o}:null,timeAxis:"x",xAccessor:M,yAccessor:P,width:t,height:o,data:_,frameType:"ordinal",projection:r?"horizontal":"vertical",stickyPositionCache:z.current};return Gn(A?di({annotations:S,context:i,..."object"==typeof A?A:{}}):S,e,C,i)},[S,A,C,t,o,a,M,P,_]);return s||f||m||k||W&&W.length>0||p||R?Mc("svg",{role:"img",width:r,height:n,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[Cc("title",{children:"string"==typeof f?f:"Ordinal Chart"}),Cc("desc",{children:"string"==typeof f?f+" — ordinal data visualization":"Ordinal data visualization"}),Mc("g",{transform:`translate(${i.left},${i.top})`,children:[p&&a&&!I&&!L&&Cc("g",{className:"ordinal-grid",children:E.map((e,r)=>Cc("line",{x1:$?e.pixel:0,y1:$?0:e.pixel,x2:$?e.pixel:t,y2:$?o:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+r))}),s&&a&&!I&&(()=>{const e={fontSize:"var(--semiotic-tick-font-size, 12px)"},r={fontSize:"var(--semiotic-axis-label-font-size, 12px)"};return Cc("g",{className:"ordinal-axes",children:Mc(Ac,$?{children:[Mc("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[!L&&Cc("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),N.map((t,o)=>Mc("g",{transform:`translate(0,${t.pixel})`,children:[Cc("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?Cc("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label}):Cc("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:Cc("div",{style:{textAlign:"right",userSelect:"none",...e},children:t.label})})]},"cat-"+o)),c&&Cc("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})]}),Mc("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[!L&&Cc("line",{x1:0,y1:o,x2:t,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),!L&&a?.r&&(()=>{const e=a.r(0);return e>1&&t-1>e?Cc("line",{x1:e,y1:0,x2:e,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1,strokeDasharray:"4,4"}):null})(),E.map((t,r)=>{const n=D?0===r?"start":r===E.length-1?"end":"middle":"middle";return Mc("g",{transform:`translate(${t.pixel},${o})`,children:[Cc("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),Cc("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&&Cc("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:[Mc("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[!L&&(()=>{const e=a?.r?a.r(0):o,r=0>e||e>o?o:e;return Cc("line",{x1:0,y1:r,x2:t,y2:r,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),N.map((t,r)=>Mc("g",{transform:`translate(${t.pixel},${o})`,children:[Cc("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?Cc("text",{y:18,textAnchor:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label}):Cc("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:Cc("div",{style:{textAlign:"center",userSelect:"none",...e},children:t.label})})]},"cat-"+r)),c&&Cc("text",{x:t/2,y:o+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:{userSelect:"none",...r},children:c})]}),Mc("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[!L&&Cc("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),E.map((t,o)=>Mc("g",{transform:`translate(0,${t.pixel})`,children:[Cc("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),Cc("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&&Cc("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})]})]})})})(),W,k,R]}),f&&Cc("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}),Jr({legend:m,totalWidth:r,totalHeight:n,margin:i,legendPosition:x,title:f,legendLayout:w,legendHoverBehavior:g,legendClickBehavior:y,legendHighlightedCategory:b,legendIsolatedCategories:v})]}):null}import{useRef as Rc,useEffect as Ic}from"react";import{select as $c}from"d3-selection";import{brushX as Tc,brushY as Nc}from"d3-brush";import{jsx as Fc,jsxs as Dc}from"react/jsx-runtime";function Bc({width:e,height:t,totalWidth:o,totalHeight:r,margin:n,scales:i,onBrush:a}){const s=Rc(null),l=Rc(null),c=Rc(a);c.current=a;const u=Rc(i);u.current=i;const d=Rc(!1),h=Rc(null),p="horizontal"===i?.projection,f=Rc(p);f.current=p;const m=S({label:"Ordinal value range brush",onAction:e=>{const t=u.current,o=l.current;if(!t||!o||!s.current)return;const r=$c(s.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,a]=[Math.min(...n),Math.max(...n)],p=(a-i)/20,m=h.current?.r??[i+.4*(a-i),i+.6*(a-i)],g="left"===e.direction||"down"===e.direction?-1:1;let[y,b]=m;if(e.resize)0>g?y=Math.max(i,y-p):b=Math.min(a,b+p);else{const e=b-y;y=Math.max(i,Math.min(a-e,y+g*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 Ic(()=>{if(!s.current)return;const o=$c(s.current).select(".brush-g"),r=p?Tc():Nc();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]),Ic(()=>{if(!i||!l.current||!h.current)return;if(!s.current)return;const e=h.current,t=$c(s.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]),Dc("svg",{ref:s,width:o,height:r,...m.svgProps,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[Fc("title",{children:m.svgProps["aria-label"]}),Fc("desc",{id:m.descriptionId,children:m.description}),Fc("g",{className:"brush-g",transform:`translate(${n.left},${n.top})`,style:{pointerEvents:"all"}})]})}import{arc as Ec}from"d3-shape";function zc(e,t){const o=t._gradientBand.colors;if(0===o.length)return;const{clipPath:r,slices:n}=Wi({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=Xo(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=Xo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(i),e.restore())}function Hc(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 Oc(e,t){const o={innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle+Math.PI/2,endAngle:t.endAngle+Math.PI/2},r=Ec().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 Wc=(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)zc(e,t),t._pulseIntensity&&t._pulseIntensity>0&&(Hc(e,t),tl(e,t)),e.globalAlpha=1;else{if(e.fillStyle=("string"==typeof t.style.fill?Xo(e,t.style.fill):t.style.fill)||"#007bff",t.roundedEnds){t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Xo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1);const o=Oi({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=Xo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1),Oc(e,t)):(Hc(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Xo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()));t._pulseIntensity&&t._pulseIntensity>0&&(Hc(e,t),tl(e,t)),e.globalAlpha=1}},jc=(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=Xo(e,"var(--semiotic-primary, #007bff)"),i=Xo(e,"var(--semiotic-text, #333)"),a=t.style.fill,s="string"==typeof a?Xo(e,a)||a:a??n,l=t.style.stroke,c="string"==typeof l?Xo(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=s,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()}},Yc=(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?Xo(e,t.style.fill):t.style.fill)||"#007bff",e.fill(o),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Xo(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()}},Gc=(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=Xo(e,o.style.stroke)||("string"==typeof o.style.fill?Xo(e,o.style.fill):o.style.fill)||Xo(e,"var(--semiotic-border, #999)"),e.lineWidth=o.style.strokeWidth||1,e.globalAlpha=o.style.opacity??.5,e.stroke(),e.globalAlpha=1}},qc=(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=Xo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}};function Vc(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 Xc(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}var Uc=null;function Kc(e={},t){const{background:o="transparent",stroke:r="#000",lineWidth:n=1.5,spacing:i=6,angle:a=45}=e,s=Math.max(8,Math.ceil(2*i));let l;try{l=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(Uc||(Uc=document.createElement("canvas")),Uc.width=e,Uc.height=e,Uc)}(s)}catch{return null}const c=l.getContext("2d");if(!c)return null;o&&"transparent"!==o?(c.fillStyle=o,c.fillRect(0,0,s,s)):c.clearRect(0,0,s,s),c.strokeStyle=r,c.lineWidth=n,c.lineCap="square";const u=a*Math.PI/180;if(45===a||-45===a){const e=a>0?1:-1;for(let t=-s;2*s>=t;t+=i)c.beginPath(),c.moveTo(t,0),c.lineTo(t+e*s,s),c.stroke()}else{c.save(),c.translate(s/2,s/2),c.rotate(u);const e=2*s;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 Qc=new Map;function Zc(e,t){const o=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,r=Qc.get(o);if(void 0!==r)return r;const n=Kc({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return Qc.set(o,n),n}function Jc(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 eu(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 tu(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}var ou=e=>[Gc,...e],ru={bar:ou([fl]),clusterbar:ou([fl]),point:ou([al,cl]),swarm:ou([al,cl]),pie:[Wc],donut:[Wc],boxplot:ou([jc,al]),violin:ou([Yc]),histogram:ou([fl]),ridgeline:ou([Yc]),timeline:ou([fl]),funnel:[fl,qc,(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,a=!0===o.__funnelIsFirstStep;let s;if(s=a?Vc(n):null!=i?`${Vc(n)} (${Xc(i)})`:Vc(n),e.measureText(s).width+16>r){if(a||null==i)continue;if(s=Vc(n),e.measureText(s).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(s,l,c),e.fillStyle="#fff",e.fillText(s,l,c)}e.lineWidth=1,e.lineJoin="miter"}}],"bar-funnel":[fl,(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)||Xo(e,"var(--semiotic-border, #999)"),r=Zc(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]=Uo(e,t);return(.2126*o+.7152*r+.0722*n)/255>.6}(e,Xo(e,"var(--semiotic-text, #333)")),a=i?"#1f2937":"#ffffff",s=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?tu(n):"",d=eu(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,m=i?32:17,g=o.__barFunnelLabelX,y=g-f/2,b=o.__barFunnelLabelY-m-4;e.save(),e.shadowColor="rgba(0,0,0,0.15)",e.shadowBlur=4,e.shadowOffsetY=1,e.fillStyle=a,e.beginPath(),Jc(e,y,b,f,m,4),e.fill(),e.restore(),e.strokeStyle=s,e.lineWidth=.5,e.beginPath(),Jc(e,y,b,f,m,4),e.stroke(),e.textAlign="center",e.textBaseline="top",i?(e.font="bold 13px sans-serif",e.fillStyle=l,e.fillText(u,g,b+3),e.font="11px sans-serif",e.fillStyle=c,e.fillText(d,g,b+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle=l,e.fillText(d,g,b+3))}e.lineWidth=1}],swimlane:ou([fl]),custom:ou([fl,al,cl,dl,Wc,jc,Yc,qc])};import{jsx as nu,jsxs as iu}from"react/jsx-runtime";function au(e){const t=ss(e,{skipPositional:!1});return null==t.title&&0===t.entries.length?null:iu("div",{className:"semiotic-tooltip",style:us,children:[null!=t.title&&nu("div",{style:{fontWeight:"bold"},children:t.title+""}),t.entries.map(e=>iu("div",{children:[iu("span",{style:{opacity:.7},children:[e.key,":"]})," ","number"==typeof e.value?e.value.toLocaleString():e.value+""]},e.key))]})}function su({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 iu("div",{className:"semiotic-tooltip",style:us,children:[e&&nu("div",{style:{fontWeight:"bold"},children:e+""}),iu("div",{children:["n = ",o.n]}),iu("div",{children:["Min: ",o.min.toLocaleString()]}),iu("div",{children:["Q1: ",o.q1.toLocaleString()]}),iu("div",{children:["Median: ",o.median.toLocaleString()]}),iu("div",{children:["Q3: ",o.q3.toLocaleString()]}),iu("div",{children:["Max: ",o.max.toLocaleString()]}),iu("div",{style:{opacity:.8},children:["Mean: ",o.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});const n=t.length;return iu("div",{className:"semiotic-tooltip",style:us,children:[e&&nu("div",{style:{fontWeight:"bold"},children:e+""}),iu("div",{children:[n," items"]})]})}if(null!=t.bin&&null!=t.count){const e=t.range||[];return iu("div",{className:"semiotic-tooltip",style:us,children:[t.category&&nu("div",{style:{fontWeight:"bold"},children:t.category+""}),iu("div",{children:["Count: ",t.count]}),2===e.length&&iu("div",{style:{opacity:.8},children:[Number(e[0]).toFixed(1)," – ",Number(e[1]).toFixed(1)]})]})}const n=e.__oAccessor,i=e.__rAccessor,a=e.__chartType;if("swarm"===a||"point"===a)return au(t);const s=(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 s||""!==l?iu("div",{className:"semiotic-tooltip",style:us,children:[s&&nu("div",{style:{fontWeight:"bold"},children:s+""}),""!==l&&nu("div",{children:"number"==typeof l?l.toLocaleString():l+""})]}):au(t)}su.ownsChrome=!0;import{jsx as lu,jsxs as cu}from"react/jsx-runtime";var uu={top:50,right:40,bottom:60,left:70},du=Xl(Vl(function(e,t){const{chartType:o,runtimeMode:r,data:n,oAccessor:i="category",rAccessor:a="value",colorAccessor:s,symbolAccessor:l,symbolMap:c,stackBy:u,groupBy:d,multiAxis:h,timeAccessor:p,valueAccessor:f,categoryAccessor:m,accessorRevision:g,projection:y="vertical",size:b=[600,400],responsiveWidth:v,responsiveHeight:x,margin:w,barPadding:k,roundedTop:S,gradientFill:A,trackFill:C,baselinePadding:M,innerRadius:P,cornerRadius:_,normalize:L,startAngle:R,sweepAngle:T,dynamicColumnWidth:N,bins:F,showOutliers:D,showIQR:B,amplitude:E,connectorOpacity:z,showLabels:H,connectorAccessor:O,connectorStyle:j,dataIdAccessor:Y,rExtent:G,oExtent:q,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:ae,oLabel:se,rLabel:le,oFormat:ce,rFormat:ue,rTickValues:de,tickLabelEdgeAlign:he,axisExtent:pe,enableHover:fe=!0,hoverAnnotation:me,tooltipContent:ge,customHoverBehavior:ye,customClickBehavior:be,annotations:ve,autoPlaceAnnotations:xe,svgAnnotationRules:we,showGrid:ke=!1,legend:Se,legendHoverBehavior:Ae,legendClickBehavior:Ce,legendHighlightedCategory:Me,legendIsolatedCategories:Pe,legendPosition:_e,legendLayout:Le,legendCategoryAccessor:Re,onCategoriesChange:Ie,backgroundGraphics:$e,foregroundGraphics:Te,title:Ne,className:Fe,background:De,centerContent:Be,decay:Ee,pulse:ze,transition:He,animate:Oe,staleness:We,brush:je,onBrush:Ye,accessibleTable:Ge=!0,description:qe,summary:Ve,customLayout:Xe,onLayoutError:Ue,layoutConfig:Ke,layoutSelection:Qe}=e,Ze=Ol(!0),Je=Fs({sizeProp:b,responsiveWidth:v,responsiveHeight:x,userMargin:w,marginDefault:uu,animate:Oe,transitionProp:He,themeDirtyRef:Ze}),{reducedMotionRef:et,responsiveRef:tt,size:ot,margin:rt,adjustedWidth:nt,adjustedHeight:it,currentTheme:at,transition:st,introEnabled:lt,tableId:ct,rafRef:ut,renderFnRef:dt,scheduleRender:ht,cancelRender:pt}=Je,ft=ra(),mt=sa(),gt=Yl(()=>I(n),[n]),yt=re??se,bt=ne??le,vt=ie??ce,xt=ae??ue,wt=Ol(null),kt=Ol(null),St=Ol([]),At=Ol(Re),Ct=Ol(Ie);At.current=Re,Ct.current=Ie;const[Mt,Pt]=Wl(null),[_t,Lt]=Wl(null),Rt=(e,t)=>"function"==typeof e?e({size:ot,margin:rt,scales:t}):e,It=Rt(Te,_t),$t=Rt($e,_t),[Tt,Nt]=Wl(0),Ft=Ol(0),[Dt,Bt]=Wl(!1),Et=Ol({w:-1,h:-1}),zt=Ol(!1),Ht=fe||me,Ot="streaming"===r,Wt=ua(Yl(()=>({chartType:o,runtimeMode:Ot?"streaming":"bounded",windowSize:K,windowMode:U,extentPadding:V,projection:y,oAccessor:Ot?void 0:i,rAccessor:Ot?void 0:a,accessorRevision:g,colorAccessor:s,symbolAccessor:l,symbolMap:c,stackBy:u,groupBy:d,multiAxis:h,timeAccessor:Ot?p:void 0,valueAccessor:Ot?f||("string"==typeof a||"function"==typeof a?a:void 0):void 0,categoryAccessor:Ot?m||i:void 0,rExtent:G,oExtent:q,axisExtent:pe,barPadding:k,roundedTop:S,gradientFill:A,trackFill:C,baselinePadding:M,innerRadius:P,cornerRadius:_,normalize:L,startAngle:R,sweepAngle:T,dynamicColumnWidth:N,bins:F,showOutliers:D,showIQR:B,amplitude:E,connectorOpacity:z,showLabels:H,connectorAccessor:O,connectorStyle:j,dataIdAccessor:Y,oSort:X,pieceStyle:Q,summaryStyle:Z,colorScheme:J,themeCategorical:at?.colors?.categorical,themeSemantic:W(at),themeSequential:at?.colors?.sequential,themeDiverging:at?.colors?.diverging,barColors:ee,decay:Ee,pulse:ze,transition:st,introAnimation:lt,staleness:We,customLayout:Xe,onLayoutError:Ue,layoutConfig:Ke,layoutMargin:rt}),[o,K,U,V,y,i,a,g,s,l,c,u,d,h,p,f,m,G,q,pe,k,S,A,C,M,P,_,L,R,T,N,F,D,B,E,z,H,O,j,Y,X,Q,Z,J,ee,Ee,ze,st?.duration,st?.easing,lt,We,Ot,at,Xe,Ue,Ke,rt])),jt=Ol(null);jt.current||(jt.current=new pc(Wt));const Yt=Gl(()=>{const e=At.current,t=Ct.current;if(!t||!e)return;const o=Hs(jt.current?.getData()??[],e);Os(o,St.current)||(St.current=o,t(o))},[]);Co(jt,Wt,Ze,ht),Mo(jt,Qe,Ze,ht);const Gt=Ol(null);Gt.current||(Gt.current=new $(e=>{const t=jt.current;t&&t.ingest(e)&&(Ze.current=!0,ht())}));const qt=Gl(e=>{Gt.current?.push(e)},[]),Vt=Gl(e=>{Gt.current?.pushMany(e)},[]),Xt=Gl(()=>{Gt.current?.clear(),jt.current?.clear(),Ze.current=!0,ht()},[ht]),Ut=Gl(e=>{Gt.current?.clearLastData(),Gt.current?.setReplacementData(e)},[]);ql(t,()=>({push:qt,pushMany:Vt,replace:Ut,remove:e=>{Gt.current?.flush();const t=jt.current?.remove(e)??[];if(t.length>0){const e=kt.current?.data;!!kt.current&&t.some(Array.isArray(e)?t=>e.includes(t):t=>t===e)&&(kt.current=null,Pt(null)),Ze.current=!0,ht()}return t},update:(e,t)=>{Gt.current?.flush();const o=jt.current?.update(e,t)??[];return o.length>0&&(Ze.current=!0,ht()),o},clear:Xt,getData:()=>(Gt.current?.flush(),jt.current?.getData()??[]),getScales:()=>jt.current?.scales??null,getCustomLayout:()=>jt.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>jt.current?.lastCustomLayoutFailure??null}),[qt,Vt,Ut,Xt,ht]),jl(()=>{n&&Gt.current?.setBoundedData(gt)},[n,gt]);const{hoverHandlerRef:Kt,hoverLeaveRef:Qt,onPointerMove:Zt,onPointerLeave:Jt}=Je;Kt.current=e=>{if(!Ht)return;const t=wt.current;if(!t)return;const r=t.getBoundingClientRect(),n=e.clientX-r.left-rt.left,s=e.clientY-r.top-rt.top;if(0>n||n>nt||0>s||s>it)return void(kt.current&&(kt.current=null,Pt(null),ye&&ye(null),ht()));const l=jt.current;if(!l||0===l.scene.length)return;const c="radial"===y,u=fc(l.scene,c?n-nt/2:n,c?s-it/2:s,30,l.pointQuadtree,l.maxPointRadius);if(!u)return void(kt.current&&(kt.current=null,Pt(null),ye&&ye(null),ht()));const d=ts(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 a?a:void 0,__chartType:o});kt.current=d,Pt(d),ye&&(ye(d),Ze.current=!0),ht()},Qt.current=()=>{kt.current&&(kt.current=null,Pt(null),ye&&(ye(null),Ze.current=!0),ht())};const eo=Gl(e=>{if(!be)return;const t=wt.current;if(!t)return be(null),Ze.current=!0,void ht();const r=t.getBoundingClientRect(),n=e.clientX-r.left-rt.left,s=e.clientY-r.top-rt.top;if(0>n||n>nt||0>s||s>it)return be(null),Ze.current=!0,void ht();const l=jt.current;if(!l||0===l.scene.length)return be(null),Ze.current=!0,void ht();const c="radial"===y,u=fc(l.scene,c?n-nt/2:n,c?s-it/2:s,30,l.pointQuadtree,l.maxPointRadius);if(!u)return be(null),Ze.current=!0,void ht();be(ts(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 a?a:void 0,__chartType:o})),Ze.current=!0,ht()},[it,nt,o,be,rt,i,y,a,ht]),to=Ol(-1),oo=Ol(null),ro=Ol(null),no=Gl(e=>{const t=jt.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=zo(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=Ar(e),ro.current={version:r,graph:n}}const s=to.current;if(0>s){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={...Lr(t),__oAccessor:"string"==typeof i?i:void 0,__rAccessor:"string"==typeof a?a:void 0,__chartType:o};return kt.current=r,Pt(r),ye&&ye(r),void ht()}const l=Cr(n,s),c=Mr(e.key,l,n);if(null===c)return;if(e.preventDefault(),0>c)return to.current=-1,oo.current=null,kt.current=null,Pt(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={...Lr(u),__oAccessor:"string"==typeof i?i:void 0,__rAccessor:"string"==typeof a?a:void 0,__chartType:o};kt.current=d,Pt(d),ye&&ye(d),ht()},[ye,ht]),io=Gl(e=>{to.current=-1,oo.current=null,Zt(e)},[Zt]);dt.current=()=>{ut.current=null;const e=wt.current;if(!e)return;const t=e.getContext("2d");if(!t)return;const r=jt.current;if(!r)return;const n="undefined"!=typeof performance?performance.now():Date.now(),i=r.advanceTransition(et.current?n+1e6:n),a=!et.current&&i,s=Et.current.w!==nt||Et.current.h!==it,l=Ze.current;let c=!1;!l&&!s||a&&!s||(r.computeScene({width:nt,height:it}),Et.current={w:nt,h:it},c=!0,Yt()),Ze.current=l&&a&&!c;const u=Ds(r,n,c,zt);(c||a)&&e.setAttribute("aria-label",La(r.scene,o+" chart"));const d=Es(),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=We&&r.lastIngestTime>0&&n-r.lastIngestTime>(We?.threshold??5e3);f&&(t.globalAlpha=We?.dimOpacity??.5),fa(t,{background:De,hasBackgroundGraphics:!!$e,themeBackground:$e||"transparent"===De||De?"":getComputedStyle(e).getPropertyValue("--semiotic-bg").trim(),width:ot[0],height:ot[1]});const m="radial"===y;t.save(),t.beginPath(),t.rect(rt.left,rt.top,nt,it),t.clip(),m?(t.save(),t.translate(rt.left+nt/2,rt.top+it/2)):t.translate(rt.left,rt.top);const g=Xe?ru.custom:ru[o]||[],b={width:nt,height:it};for(const e of g)e(t,r.scene,r.scales,b);m&&t.restore(),t.restore(),f&&(t.globalAlpha=1),c&&r.scales?(Lt(r.scales),Nt(e=>e+1),Ft.current=n):a&&r.scales&&n-Ft.current>=33&&(Nt(e=>e+1),Ft.current=n),We?.showBadge&&Bt(!!f),(a||null!=r.activeTransition||u.pending)&&ht()},la({hydrated:ft,wasHydratingFromSSR:mt,storeRef:jt,dirtyRef:Ze,renderFnRef:dt,cancelRender:pt,cleanup:()=>Gt.current?.clear()}),jl(()=>{Ze.current=!0,ht()},[o,nt,it,te,De,ht]),Fr(We,jt,Ze,ht,Dt,Bt);const ao=Ht&&Mt?ge?ge(Mt):lu(su,{hover:Mt}):null,so="radial"===y,lo=ao?lu(bs,{x:Mt?so?Mt.x+nt/2:Mt.x:0,y:Mt?so?Mt.y+it/2:Mt.y:0,containerWidth:nt,containerHeight:it,margin:rt,className:"stream-ordinal-tooltip",children:ao}):null,co=Ws(i,void 0,"__semiotic_resolvedO",""),uo=Ws(a,void 0,"__semiotic_resolvedR",""),ho=co.key,po=uo.key,fo=js(co,uo,ve&&ve.length>0||!1);if(Ki||!ft&&mt){const e=jt.current;e&&n&&(e.ingest({inserts:gt,bounded:!0}),e.computeScene({width:nt,height:it}));const t=e?.scene??[],o=e?.scales??null,r=Rt(Te,o),i=Rt($e,o),a="radial"===y,s=a?rt.left+nt/2:rt.left,l=a?rt.top+it/2:rt.top;return cu("div",{ref:tt,className:"stream-ordinal-frame"+(Fe?" "+Fe:""),role:"img","aria-label":qe||("string"==typeof Ne?Ne:"Ordinal chart"),style:{position:"relative",width:v?"100%":ot[0],height:x?"100%":ot[1]},children:[lu(qa,{summary:Ve}),cu("svg",{xmlns:"http://www.w3.org/2000/svg",width:ot[0],height:ot[1],style:{position:"absolute",left:0,top:0},children:[i&&lu("g",{transform:`translate(${rt.left},${rt.top})`,children:i}),cu("g",{transform:`translate(${s},${l})`,children:[De&&lu("rect",{x:0,y:0,width:nt,height:it,fill:De}),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=Ui(i)+"-grad",r=function(e,t){const o=e.fillGradient;if(!o)return null;let r=e.x,n=e.y,i=e.x,a=e.y+e.h;"bottom"===e.roundedEdge?(n=e.y+e.h,a=e.y):"right"===e.roundedEdge?(r=e.x+e.w,n=e.y,i=e.x,a=e.y):"left"===e.roundedEdge&&(r=e.x,n=e.y,i=e.x+e.w,a=e.y);const s=[];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++)s.push(ji("stop",{offset:e[t].offset,stopColor:e[t].color},t))}else{const t=qi(e.style.fill);s.push(ji("stop",{offset:0,stopColor:t,stopOpacity:o.topOpacity},"0")),s.push(ji("stop",{offset:1,stopColor:t,stopOpacity:o.bottomOpacity},"1"))}return ji("linearGradient",{id:t,gradientUnits:"userSpaceOnUse",x1:r,y1:n,x2:i,y2:a,children:s})}(t,o),n=r?`url(#${o})`:qi(t.style.fill);if(t.cornerRadii&&Ei(t.cornerRadii)){const e=function(e){const{x:t,y:o,w:r,h:n}=e,{tl:i,tr:a,br:s,bl:l}=zi(e);let c=`M${t+i},${o}`;return c+=` L${t+r-a},${o}`,a>0&&(c+=` A${a},${a} 0 0 1 ${t+r},${o+a}`),c+=` L${t+r},${o+n-s}`,s>0&&(c+=` A${s},${s} 0 0 1 ${t+r-s},${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 Yi(Di.Fragment,{children:[r&&ji("defs",{children:r}),ji("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:a,w:s,h:l}=t;let c;switch(t.roundedEdge){case"right":c=`M${o},${a} L${o+s-e},${a} A${e},${e} 0 0 1 ${o+s},${a+e} L${o+s},${a+l-e} A${e},${e} 0 0 1 ${o+s-e},${a+l} L${o},${a+l} Z`;break;case"left":c=`M${o+s},${a} L${o+e},${a} A${e},${e} 0 0 0 ${o},${a+e} L${o},${a+l-e} A${e},${e} 0 0 0 ${o+e},${a+l} L${o+s},${a+l} Z`;break;case"bottom":c=`M${o},${a} L${o+s},${a} L${o+s},${a+l-e} A${e},${e} 0 0 1 ${o+s-e},${a+l} L${o+e},${a+l} A${e},${e} 0 0 1 ${o},${a+l-e} Z`;break;default:c=`M${o},${a+l} L${o},${a+e} A${e},${e} 0 0 1 ${o+e},${a} L${o+s-e},${a} A${e},${e} 0 0 1 ${o+s},${a+e} L${o+s},${a+l} Z`}return Yi(Di.Fragment,{children:[r&&ji("defs",{children:r}),ji("path",{d:c,fill:n,opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})]},i)}return Yi(Di.Fragment,{children:[r&&ji("defs",{children:r}),ji("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 ji("circle",{cx:t.x,cy:t.y,r:t.r,fill:qi(t.style.fill),opacity:t.style.opacity??.8,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},i)}case"symbol":return Vi(e,t,o);case"glyph":return Xi(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=Ui(`${o?o+"-":""}gauge-grad-${r.category||i}-${t}`),{clipPath:n,slices:a}=Wi({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 Yi("g",{transform:`translate(${r.cx},${r.cy})`,opacity:r.style.opacity,fillOpacity:r.style.fillOpacity,children:[ji("defs",{children:ji("clipPath",{id:e,children:ji("path",{d:n})})}),ji("g",{clipPath:`url(#${e})`,children:a.map((e,t)=>ji("path",{d:e.d,fill:qi(e.color)},t))}),r.style.stroke&&"none"!==r.style.stroke&&ji("path",{d:n,fill:"none",stroke:r.style.stroke,strokeWidth:r.style.strokeWidth})]},i)}let n;if(r.roundedEnds)n=Oi({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=Bi().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(Gi)||""}return ji("path",{d:n,transform:`translate(${r.cx},${r.cy})`,fill:qi(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 Yi("g","vertical"===t.projection?{children:[ji("line",{x1:t.x,y1:t.minPos,x2:t.x,y2:t.maxPos,stroke:t.style.stroke||"#333",strokeWidth:1}),ji("rect",{x:t.x-o,y:Math.min(t.q1Pos,t.q3Pos),width:t.columnWidth,height:Math.abs(t.q3Pos-t.q1Pos),fill:qi(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:1}),ji("line",{x1:t.x-o,y1:t.medianPos,x2:t.x+o,y2:t.medianPos,stroke:t.style.stroke||"#333",strokeWidth:2}),ji("line",{x1:t.x-.5*o,y1:t.minPos,x2:t.x+.5*o,y2:t.minPos,stroke:t.style.stroke||"#333",strokeWidth:1}),ji("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:[ji("line",{x1:t.minPos,y1:t.y,x2:t.maxPos,y2:t.y,stroke:t.style.stroke||"#333",strokeWidth:1}),ji("rect",{x:Math.min(t.q1Pos,t.q3Pos),y:t.y-o,width:Math.abs(t.q3Pos-t.q1Pos),height:t.columnWidth,fill:qi(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:1}),ji("line",{x1:t.medianPos,y1:t.y-o,x2:t.medianPos,y2:t.y+o,stroke:t.style.stroke||"#333",strokeWidth:2}),ji("line",{x1:t.minPos,y1:t.y-.5*o,x2:t.minPos,y2:t.y+.5*o,stroke:t.style.stroke||"#333",strokeWidth:1}),ji("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=[ji("path",{d:t.pathString,transform:t.translateX||t.translateY?`translate(${t.translateX},${t.translateY})`:void 0,fill:qi(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(ji("line",{x1:r,y1:t.iqrLine.q1Pos,x2:r,y2:t.iqrLine.q3Pos,stroke:t.style.stroke||"#333",strokeWidth:2},n("iqr")),ji("circle",{cx:r,cy:t.iqrLine.medianPos,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},n("med"))):o.push(ji("line",{x1:t.iqrLine.q1Pos,y1:i,x2:t.iqrLine.q3Pos,y2:i,stroke:t.style.stroke||"#333",strokeWidth:2},n("iqr")),ji("circle",{cx:t.iqrLine.medianPos,cy:i,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},n("med")))}return ji("g",{children:o},i)}case"connector":return ji("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 ji("polygon",{points:o,fill:qi(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)]})]}),lu(Lc,{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:ke,title:Ne,legend:Se,legendHoverBehavior:Ae,legendClickBehavior:Ce,legendHighlightedCategory:Me,legendIsolatedCategories:Pe,legendPosition:_e,legendLayout:Le,foregroundGraphics:mo(r,ko(jt.current?.customLayoutOverlays,Qe??null)),annotations:ve,autoPlaceAnnotations:xe,svgAnnotationRules:we,annotationFrame:0,xAccessor:ho,yAccessor:po,annotationData:fo(e?.getData())}),Be&&"radial"===y&&lu("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 cu("div",{ref:tt,className:"stream-ordinal-frame"+(Fe?" "+Fe:""),role:"group","aria-label":qe||("string"==typeof Ne?Ne:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:v?"100%":ot[0],height:x?"100%":ot[1],overflow:"visible"},onKeyDown:no,children:[Ge&&lu(Va,{tableId:ct}),Ge&&lu(Ya,{scene:jt.current?.scene??[],chartType:o+" chart",tableId:ct,chartTitle:"string"==typeof Ne?Ne:void 0}),lu(qa,{summary:Ve}),lu(Xa,{hoverPoint:Mt}),cu("div",{role:"img","aria-label":qe||("string"==typeof Ne?Ne:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Ht?io:void 0,onMouseLeave:Ht?Jt:void 0,onClick:be?eo:void 0,children:[$t&&lu("svg",{style:{position:"absolute",top:0,left:0,width:ot[0],height:ot[1],pointerEvents:"none"},children:lu("g",{transform:`translate(${rt.left},${rt.top})`,children:$t})}),lu(Pc,{width:nt,height:it,totalWidth:ot[0],totalHeight:ot[1],margin:rt,scales:_t,showAxes:te,showGrid:ke,rFormat:xt,rTickValues:de,axisExtent:pe}),lu("canvas",{ref:wt,"aria-label":La(jt.current?.scene??[],o+" chart"),style:{position:"absolute",top:0,left:0,width:ot[0],height:ot[1]}}),lu(Lc,{width:nt,height:it,totalWidth:ot[0],totalHeight:ot[1],margin:rt,scales:_t,showAxes:te,showCategoryTicks:oe,oLabel:yt,rLabel:bt,oFormat:vt,rFormat:xt,rTickValues:de,axisExtent:pe,showGrid:ke,title:Ne,legend:Se,legendHoverBehavior:Ae,legendClickBehavior:Ce,legendHighlightedCategory:Me,legendIsolatedCategories:Pe,legendPosition:_e,legendLayout:Le,foregroundGraphics:mo(It,ko(jt.current?.customLayoutOverlays,Qe??null)),annotations:ve,autoPlaceAnnotations:xe,svgAnnotationRules:we,annotationFrame:Tt,xAccessor:ho,yAccessor:po,annotationData:fo(jt.current?.getData()),underlayRendered:!0}),(je||Ye)&&"radial"!==y&&lu(Bc,{width:nt,height:it,totalWidth:ot[0],totalHeight:ot[1],margin:rt,scales:_t,onBrush:Ye||(()=>{})}),Be&&"radial"===y&&lu("div",{style:{position:"absolute",left:rt.left+nt/2,top:rt.top+it/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:Be}),We?.showBadge&&lu(Br,{isStale:Dt,position:We.badgePosition}),lu(Qa,{active:to.current>=0,hoverPoint:Mt,margin:rt,size:ot,shape:oo.current?.shape,width:oo.current?.w,height:oo.current?.h}),lo]})]})}));du.displayName="StreamOrdinalFrame";var hu=du;import{useRef as pu,useState as fu,useEffect as mu,useMemo as gu,useCallback as yu,useImperativeHandle as bu,forwardRef as vu,memo as xu}from"react";var wu={weightChange:.1,newEdge:.5,newNode:1,threshold:3,transitionDuration:500},ku={radius:3,opacity:.7,speedMultiplier:1,maxPerEdge:50,spawnRate:.1},Su=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 a=o[i.edgeIndex];a&&a.bezier?(i.t+=e*t*(r?r[i.edgeIndex]??1:1)*(a.bezier.circular?.3:1),1>i.t?Au(a.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 Au(e,t,o,r){if(e.circular&&e.segments)return void function(e,t,o,r,n){const i=e.length,a=t*i,s=Math.min(Math.floor(a),i-1),l=a-s,[c,u,d,h]=e[s];Cu(c,u,d,h,l,n);const p=h.x-c.x,f=h.y-c.y,m=Math.sqrt(p*p+f*f);if(m>.001){const e=p/m;n.x+=-f/m*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,a,s]=e.points;Cu(n,i,a,s,t,r);const l=s.x-n.x,c=s.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 Cu(e,t,o,r,n,i){const a=1-n,s=a*a,l=s*a,c=n*n,u=c*n;i.x=l*e.x+3*s*n*t.x+3*a*c*o.x+u*r.x,i.y=l*e.y+3*s*n*t.y+3*a*c*o.y+u*r.y}function Mu(e,t){var o=e.get(t);if(!o)throw Error("missing: "+t);return o}function Pu(e,t){var o,r=[],n=[],i=[],a={},s=[];function l(e){i[e]=!1,a.hasOwnProperty(e)&&Object.keys(a[e]).forEach(function(t){delete a[e][t],i[t]&&l(t)})}function c(e){var t,r,d=!1;for(n.push(e),i[e]=!0,t=0;s[e].length>t;t++)(r=s[e][t])===o?(u(o,n),d=!0):i[r]||(d=c(r));if(d)l(e);else for(t=0;s[e].length>t;t++){var h=a[r=s[e][t]];h||(a[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),a=Array(t),s=Array(t),l=0;t>l;++l)o[l]=-1,r[l]=0,n[l]=!1,i[l]=0,a[l]=-1,s[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 m=p[f];if(0>o[m]){o[m]=r[m]=u,n[m]=!0,u+=1,l.push(m),c.push(m);break}n[m]&&(r[t]=0|Math.min(r[t],r[m])),0>a[m]||s[t].push(a[m])}i[t]=f}else{if(r[t]===o[t]){var g=[],y=[],b=0;for(f=l.length-1;f>=0;--f){var v=l[f];if(n[v]=!1,g.push(v),y.push(s[v]),b+=s[v].length,a[v]=d.length,v===t){l.length=f;break}}d.push(g);var x=Array(b);for(f=0;y.length>f;f++)for(var w=0;y[f].length>w;w++)x[--b]=y[f][w];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 m=1;f.length>m;m++)f[m]!==f[m-1]&&c.push(f[m]);h[l]=c}}return{components:d,adjacencyList:h}}(e),n=r.components.filter(function(e){return e.length>1}),i=1/0,a=0;n.length>a;a++)for(var s=0;n[a].length>s;s++)i>n[a][s]&&(i=n[a][s],o=a);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,s=p.adjList){for(var f=0;s.length>f;f++)for(var m=0;s[f].length>m;m++){var g=s[f][m];i[+g]=!1,a[g]={}}c(o),o+=1}else o=h}return t?void 0:r}function _u(e){return e.y0-e.y1>0?"up":"down"}function Lu(e,t){return t(e.source)==t(e.target)}function Ru(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 Iu(e){return e.target.x0-e.source.x1}function $u(e,t){var o=Nu(e),r=Iu(t)/Math.tan(o);return"up"==_u(e)?e.y1-r:e.y1+r}function Tu(e,t){var o=Nu(e),r=Iu(t)/Math.tan(o);return"up"==_u(e)?e.y1+r:e.y1-r}function Nu(e){var t=Math.abs(e.y1-e.y0);return Math.atan(Math.abs(e.target.x0-e.source.x1)/t)}function Fu(e,t){return t(e)}function Du(e){return Eu(e.source)}function Bu(e){return Eu(e.target)}function Eu(e){return(e.y0+e.y1)/2}function zu(e){return e.virtual?0:e.value}function Hu(e,t){var o=0;e.sourceLinks.forEach(function(e){o=e.circular&&!Lu(e,t)?o+1:o});var r=0;return e.targetLinks.forEach(function(e){r=e.circular&&!Lu(e,t)?r+1:r}),o+r}function Ou(e){return e.target.depth}function Wu(e,t){return e.sourceLinks.length?e.depth:t-1}function ju(e,t){return e.y0-t.y0}function Yu(e,t){return t.y0-e.y0}function Gu(e,t){return e.y1-t.y1}function qu(e,t){return t.y1-e.y1}function Vu(e,t){return Uu(e.source,t.source)||e.index-t.index}function Xu(e,t){return Uu(e.target,t.target)||e.index-t.index}function Uu(e,t){return e.partOfCycle===t.partOfCycle?e.y0-t.y0:"top"===e.circularLinkType||"bottom"===t.circularLinkType?-1:1}function Ku(e,t){return Qu(e)==Qu(t)?"bottom"==e.circularLinkType?Yu(e,t):ju(e,t):Qu(t)-Qu(e)}function Qu(e){return e.target.column-e.source.column}function Zu(e,t){return Ju(e)==Ju(t)}function Ju(e){return e.y0-e.y1>0?"up":"down"}import{min as ed}from"d3-array";function td(e,t,o,r,n){let i=e;var a=Math.max(8,.15*(i.y1-i.y0));i.links.forEach(function(e){e.circular&&(e._circularWidth=Math.min(e.width,a))});var s=ed(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}),od(i.links.filter(function(e){return"top"==e.circularLinkType}),t,o),od(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,Lu(e,t)&&Ru(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 a=e.source.column,l=e.circularLinkType,c=i.links.filter(function(e){return e.source.column==a&&e.circularLinkType==l});c.sort("bottom"==e.circularLinkType?Yu:ju);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}),a=e.target.column,(c=i.links.filter(function(e){return e.target.column==a&&e.circularLinkType==l})).sort("bottom"==e.circularLinkType?qu:Gu),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=s-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 od(e,t,o){e.sort(Ku);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(Lu(e,t)&&Ru(e))e.circularPathData.verticalBuffer=i+e._circularWidth/2;else{for(var a=0;r.length>a;a++){var s=r[a];if(s!==e&&s.circularPathData&&void 0!==s.circularPathData.verticalBuffer&&rd(e,s)){var l=s.circularPathData.verticalBuffer+(s._circularWidth||s.width)/2+o;i=l>i?l:i}}e.circularPathData.verticalBuffer=i+e._circularWidth/2}}),e}function rd(e,t){return e.source.column>=t.target.column&&t.source.column>=e.target.column}import{min as nd,max as id,sum as ad,mean as sd,group as ld,groups as cd}from"d3-array";function ud(e){return function(){return e}}function dd(e){return e.index}function hd(e){return e.nodes}function pd(e){return e.links}function fd(e,t,o){var r=cd(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 a=n.length;if(t)n.sort(t);else if(i>0){var s=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+=Eu(e.source)*t,r+=t}}),o.sourceLinks.forEach(function(e){if(!e.circular){var t=e.value||1;n+=Eu(e.target)*t,r+=t}}),r>0?n/r:NaN);s.set(e,{bc:i,idx:t})}),n.sort(function(e,t){var o=s.get(e),r=s.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?Hu(t,o)-Hu(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==a||0==t.depth&&1==a?(t.y0=e.y1/2-t.value*e.ky,t.y1=t.y0+t.value*e.ky):t.partOfCycle?0==Hu(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)/a*n,t.y1=t.y0+t.value*e.ky):(t.y0=(e.y1-e.y0)/2-a/2+n,t.y1=t.y0+t.value*e.ky)})})}function md(e,t,o,r,n,i){var a=cd(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});u();for(var s=1,l=i;l>0;--l)c(s*=.99,o),u();function c(t,o){var r=a.length;a.forEach(function(n){var i=n.length,a=n[0].depth;n.forEach(function(n){var s;if(n.sourceLinks.length||n.targetLinks.length)if(n.partOfCycle&&Hu(n,o)>0){var l=sd(n.sourceLinks,Bu),c=sd(n.targetLinks,Du),u=l&&c?(l+c)/2:l||c;if(u){var d=(u-Eu(n))*t*.3;n.y0+=d,n.y1+=d}}else if(0==a&&1==i)n.y0=e.y1/2-(s=n.y1-n.y0)/2,n.y1=e.y1/2+s/2;else if(a==r-1&&1==i)n.y0=e.y1/2-(s=n.y1-n.y0)/2,n.y1=e.y1/2+s/2;else if(1==n.targetLinks.length&&1==n.targetLinks[0].source.sourceLinks.length)s=n.y1-n.y0,n.y0=n.targetLinks[0].source.y0,n.y1=n.y0+s;else{var h=sd(n.sourceLinks,Bu),p=sd(n.targetLinks,Du),f=((h&&p?(h+p)/2:h||p)-Eu(n))*t;n.y0+=f,n.y1+=f}})})}function u(){a.forEach(function(o){var i,a,s,l=e.y0,c=o.length;for(o.sort(t||Uu),s=0;c>s;++s)(a=l-(i=o[s]).y0)>0&&(i.y0+=a,i.y1+=a),l=i.y1+r;if((a=l-r-e.y1)>0)for(l=i.y0-=a,i.y1-=a,s=c-2;s>=0;--s)(a=(i=o[s]).y1+n-l)>0&&(i.y0-=a,i.y1-=a),l=i.y0})}}function gd(e){e.nodes.forEach(function(e){e.sourceLinks.sort(Xu),e.targetLinks.sort(Vu)}),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 yd(){var e=0,t=0,o=1,r=1,n=24,i=8,a=null,s=dd,l=Wu,c=void 0,u=32,d=2,h=hd,p=pd;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 ld(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=Mu(o,r)),"object"!=typeof n&&(n=e.target=Mu(o,n)),r.sourceLinks.push(e),n.targetLinks.push(e)})}(h,s),function(e,t){var o=0;if(null==t){for(var r=[],n=0;e.links.length>n;n++){var i=e.links[n],a=i.source.index,s=i.target.index;r[a]||(r[a]=[]),r[s]||(r[s]=[]),-1===r[a].indexOf(s)&&r[a].push(s)}var l=Pu(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){Fu(e,t)!=Fu(n.source,t)&&Fu(e,t)!=Fu(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),Lu(e,t)&&(e.circularLinkType=e.source.circularLinkType))})}(h,s),function(e){e.nodes.forEach(function(e){e.partOfCycle=!1,e.value=Math.max(ad(e.sourceLinks,zu),ad(e.targetLinks,zu)),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 a=0,s=t(e.nodes[0]);e.nodes.forEach(function(e){a=t(e)==s?a:a+1,s=t(e)==s?s:t(e),e.column=a})}for(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!==a){var f=cd(h.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]}),m=id(f,function(e){return e.length});m>1&&(p=Math.max(1,(r-t)*a/(m-1)))}(function(e,t,o){var r=cd(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=nd(r,function(t){return(e.y1-e.y0-(t.length-1)*e.py)/ad(t,function(e){return e.value})});e.ky=n,e.links.forEach(function(t){t.width=t.value*e.ky});var i=id(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),fd(h,c,s),md(h,c,s,p,p,u),gd(h),td(h,s,d,10,8),fd(h,c,s),md(h,c,s,p,p,u),gd(h),td(h,s,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 Fu(o.source,t)==Fu(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(!Zu(e,t))return e.y1-t.y1;if(e.target.column>t.target.column){var o=$u(t,e);return e.y1-o}if(t.target.column>e.target.column)return $u(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,a=0;n>i;i++)a+=r[i].width;t.y0=e.y1-a-t.width/2}})})}(h,s),function(e,t){let o=e;o.nodes.forEach(function(e){var r=o.links.filter(function(o){return Fu(o.target,t)==Fu(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(!Zu(e,t))return e.y0-t.y0;if(e.source.column>t.source.column){var o=Tu(t,e);return e.y0-o}if(t.source.column>e.source.column)return Tu(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,a=0;n>i;i++)a+=r[i].width;t.y1=e.y1-a-t.width/2}})})}(h,s),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)/(a-i)*(e.y1-e.y0)+e.y0};var i=nd(t,function(e){return e.y0}),a=id(t,function(e){return e.y1}),s=(e.y1-e.y0)/(a-i);1>s?(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*s})):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),td(h,s,d,10,8)}(f),f}return f.update=function(e){return gd(e),td(e,s,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?(a=+e,f):a},f.nodes=function(e){return arguments.length?(h="function"==typeof e?e:ud(e),f):h},f.links=function(e){return arguments.length?(p="function"==typeof e?e:ud(e),f):p},f.nodeId=function(e){return arguments.length?(s="function"==typeof e?e:ud(e),f):s},f.nodeAlign=function(e){return arguments.length?(l="function"==typeof e?e:ud(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}import{interpolateNumber as bd}from"d3-interpolate";import{line as vd,curveLinearClosed as xd}from"d3-shape";function wd(e){const{sx:t,sTop:o,sBot:r,tx:n,tTop:i,tBot:a,cp1X:s,cp2X:l}=e,c=(o+r)/2,u=(i+a)/2;return{pathD:[`M${t},${o}`,`C${s},${o} ${l},${i} ${n},${i}`,`L${n},${a}`,`C${l},${a} ${s},${r} ${t},${r}`,"Z"].join(" "),bezier:{circular:!1,points:[{x:t,y:c},{x:s,y:c},{x:l,y:u},{x:n,y:u}],halfWidth:(r-o)/2}}}var kd=e=>{let t,o,r,n,i,a,s,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,a=e.target.x0,s=bd(i,a),l=s(.5),c=s(.5),`M${t},${i}C${t},${l} ${o},${c} ${o},${a}L${r},${a}C${r},${c} ${n},${l} ${n},${i}Z`;const u=e.sankeyWidth/2,d=bd(e.source.x1,e.target.x0),{pathD:h}=wd({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 Sd(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,a=r.targetY;if("object"!=typeof e.source||!e.source||"object"!=typeof e.target||!e.target)return null;const s=Math.max(15,Math.min(40,.33*(r.rightFullExtent-o))),l=Math.max(15,Math.min(40,.33*(i-r.leftFullExtent)));return`M${o},${n-t}L${o+s},${n-t}L${o+s},${n+t}L${o},${n+t}ZM${i},${a-t}L${i-l},${a-t}L${i-l},${a+t}L${i},${a+t}Z`}const n=r.sourceX,i=r.sourceY,a=r.targetX,s=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},${s-d*t+d*h}L${c-o+h},${s-d*t}L${a},${s-d*t}L${a},${s+d*t}L${c+o},${s+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 Ad=new Set,Cd=new WeakMap;function Md(e,t){if("production"===process.env.NODE_ENV)return e;if(!e||!e.data||"object"!=typeof e.data)return e;let o=Cd.get(e);if(o){const e=o.get(t);if(e)return e}else o=new Map,Cd.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}`;Ad.has(e)||(Ad.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 Pd={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(Ou))-1:0},justify:Wu};function _d(e){return"string"==typeof e?e:e.id}var Ld={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",a=o.nodeWidth??15,s=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=yd().extent(d).links(u).nodes(c).nodeAlign(Pd[i]||Wu).nodeId(e=>e.id).nodeWidth(a).iterations(l);h.nodePaddingRatio&&h.nodePaddingRatio(s),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,a=(r._circularWidth??r.width??0)/2;e>i.leftFullExtent-a&&(e=i.leftFullExtent-a),i.rightFullExtent+a>t&&(t=i.rightFullExtent+a),o>i.verticalFullExtent-a&&(o=i.verticalFullExtent-a),i.verticalFullExtent+a>n&&(n=i.verticalFullExtent+a)}const i=t-e,a=n-o,s=r[0],l=r[1];if(i>0&&a>0&&(0>e||0>o||t>s||n>l)){const t=Math.min(s/i,l/a),r=-e*t+(s-i*t)/2,n=-o*t+(l-a*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=_d(e.source),o=_d(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),a=p.get(o);i&&(r.source=i),a&&(r.target=a)}}},buildScene(e,t,o,r){const n="vertical"===o.orientation?"down":"right",i=o.nodeStyle,a=o.edgeStyle,s=o.edgeOpacity??.5,l=o.edgeColorBy||"source",c=Array.isArray(o.colorScheme)?o.colorScheme:o.themeCategorical&&o.themeCategorical.length>0?o.themeCategorical:de,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(Md(t,"nodeStyle")):{},a={fill:r.fill||u.get(t.id)||"#4d430c",stroke:r.stroke,strokeWidth:r.strokeWidth,opacity:r.opacity};f.set(t.id,("string"==typeof a.fill?a.fill:null)||u.get(t.id)||"#4d430c"),d.push("down"===n?{type:"rect",x:t.y0,y:t.x0,w:o,h:e,style:a,datum:t,id:t.id,label:t.id}:{type:"rect",x:t.x0,y:t.y0,w:e,h:o,style:a,datum:t,id:t.id,label:t.id})}const m=[...t].sort((e,t)=>(t.sankeyWidth||0)-(e.sankeyWidth||0));for(const e of m){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=a?a(Md(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))),a=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??s,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-a},${t.targetY-o}L${t.targetX-a},${t.targetY+o}L${t.targetX},${t.targetY+o}Z`,style:{fill:l,fillOpacity:i.fillOpacity??s,stroke:"none",opacity:i.opacity},datum:e,_gradient:{direction:"left",from:0,to:1,x0:t.targetX-a,x1:t.targetX}});continue}let c;(c=e.circular&&e.circularPathData?Sd(e):kd(e),c)&&h.push({type:"bezier",pathD:c,bezierCache:e.bezier,style:{fill:i.fill||n,fillOpacity:i.fillOpacity??s,stroke:i.stroke||"none",strokeWidth:i.strokeWidth,opacity:i.opacity},datum:e})}if(!1!==o.showLabels){const t=(g=o.nodeLabel)?"function"==typeof g?g:e=>e[g]||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 a=t?t(o):o.id;if(!a)continue;let s,l,c;"down"===n?(s=o.y0+(o.y1-o.y0)/2,l=o.x1+14,c="start"):(r[0]/2>o.x0+e/2?(s=o.x0-6,c="end"):(s=o.x1+6,c="start"),l=o.y0+i/2),p.push({x:s,y:l,text:a+"",anchor:"down"===n?"middle":c,baseline:"middle",fontSize:11})}}var g;return{sceneNodes:d,sceneEdges:h,labels:p}}};import{forceSimulation as Rd,forceCenter as Id,forceX as $d,forceY as Td,forceLink as Nd,forceManyBody as Fd,forceCollide as Dd}from"d3-force";import{scaleLinear as Bd}from"d3-scale";var Ed={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,o,r){if(0===e.length)return;const n=o.forceStrength??.1,i=r[0]/2,a=r[1]/2,s=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=s?.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=zd(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=Hd(e.id),i=n%360*(Math.PI/180),a=10+n%20;e.x=t/r.length+a*Math.cos(i),e.y=o/r.length+a*Math.sin(i)}else{const t=Hd(e.id),o=t%360*(Math.PI/180),r=15+t%30;e.x=i+r*Math.cos(o),e.y=a+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=a+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=Od(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 s=Nd().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=Rd().force("charge",Fd().strength(e=>{const t=o.get(e.id)??0;return-15*p(e)*Math.sqrt(t+1)})).force("collide",Dd(e=>p(e)+3).strength(.9).iterations(2)).force("center",Id(i,a).strength(.8)).force("x",$d(i).strength(.06)).force("y",Td(a).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}));s.links(e),l.force("link",s)}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,a=Od(o.nodeSize,o.nodeSizeRange,e),s=Array.isArray(o.colorScheme)?o.colorScheme:o.themeCategorical&&o.themeCategorical.length>0?o.themeCategorical:de,l=new Map;e.forEach((e,t)=>{l.set(e.id,s[t%s.length])});const c=[],u=[],d=[];for(const t of e){if(null==t.x||null==t.y)continue;const e=a(Md(t,"nodeSize")),r=n?n(Md(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(Md(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=a(Md(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 zd(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 a=null;if(t===e?a=i:i===e&&(a=t),a){const e=o.get(a);!e||0===e.x&&0===e.y||r.push({x:e.x,y:e.y})}}return r}function Hd(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 Od(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 n=t||[5,20],i=[];for(const t of o){const o=t.data?.[e];"number"==typeof o&&i.push(o)}if(0===i.length)return()=>n[0];const[a,s]=r(i);if(a===s)return()=>(n[0]+n[1])/2;const l=Bd().domain([a,s]).range(n).clamp(!0);return t=>{const o=t.data?.[e];return null==o||"number"!=typeof o?n[0]:l(o)}}import{chord as Wd,ribbon as jd}from"d3-chord";import{arc as Yd}from"d3-shape";var Gd=de,qd={supportsStreaming:!1,hierarchical:!1,computeLayout(e,t,o,r){if(0===e.length)return;const{padAngle:n=.01,groupWidth:i=20,sortGroups:a}=o,s=Math.min(r[0],r[1])/2,l=s-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,m=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);m[o][r]=n}const g=Wd().padAngle(n);a&&g.sortGroups(a);const y=g(m),b=y.groups,v=Yd().innerRadius(l).outerRadius(s);for(const t of b){const o=e[t.index],r=v.centroid({innerRadius:l,outerRadius:s,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 w=new Map;for(const e of t)w.set(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,e);for(const t of y){const o=e[t.source.index].id,r=e[t.target.index].id,n=w.get(`${o}\0${r}`)||w.get(`${r}\0${o}`);n&&(n.__chordData=t)}},buildScene(e,t,o,r){const{groupWidth:n=20,edgeOpacity:i=.5}=o,a=Math.min(r[0],r[1])/2,s=a-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:Gd,f=new Map;e.forEach((e,t)=>{f.set(e.id,p[t%p.length])});const m=jd().radius(s),g=[],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(Md(o,"nodeStyle")).fill||f.get(o.id)||p[t%p.length]:f.get(o.id)||p[t%p.length];const i=u?u(Md(o,"nodeStyle")):{};g.push({type:"arc",cx:l,cy:c,innerR:s,outerR:a,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=m(t);if(!r)continue;const n=Vd(r,l,c);let a=o.themeSemantic?.border||o.themeSemantic?.secondary||"#999";if(d)a=d(Md(e,"edgeStyle")).fill||a;else{const t="object"==typeof e.source?e.source:null,o="object"==typeof e.target?e.target:null;"target"===h&&o?a=f.get(o.id)||a:t&&(a=f.get(t.id)||a)}const s=d?d(Md(e,"edgeStyle")):{};y.push({type:"ribbon",pathD:n,style:{fill:a,fillOpacity:s.fillOpacity??i,stroke:s.stroke||"none",strokeWidth:s.strokeWidth,opacity:s.opacity},datum:e})}if(!1!==o.showLabels){const t=(v=o.nodeLabel)?"function"==typeof v?v:e=>e[v]||e.id:null,r=a+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,a=i-Math.PI/2;b.push({x:l+Math.cos(a)*r,y:c+Math.sin(a)*r,text:n+"",anchor:i>Math.PI?"end":"start",baseline:"middle",fontSize:11})}}var v;return{sceneNodes:g,sceneEdges:y,labels:b}}};function Vd(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(" ")}import{hierarchy as Xd,tree as Ud,cluster as Kd,treemap as Qd,pack as Zd,partition as Jd,treemapBinary as eh}from"d3-hierarchy";var th=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];function oh(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 rh(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 nh(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 ih(e){return Array.isArray(e.colorScheme)?e.colorScheme:e.themeCategorical&&e.themeCategorical.length>0?e.themeCategorical:th}function ah(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 sh(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 lh={supportsStreaming:!1,hierarchical:!0,computeLayout(e,t,o,r){const n=o.__hierarchyRoot;if(!n)return;const i=o.chartType,a=function(e){if(e)return"function"==typeof e?e:t=>t[e]}(o.childrenAccessor),s=o.hierarchySum,l="function"==typeof s?s:"string"==typeof s?e=>Number(e[s])||0:e=>Number(e.value)||0,c=Xd(n,a);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=Ud();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=Kd();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,a=Qd().size([o,r]).tile(eh).padding(n);i>0&&a.paddingTop(i),a(e)}(c,o,u,d);break;case"circlepack":!function(e,t,o,r){const n=t.padding??4;Zd().size([o,r]).padding(n)(e)}(c,o,u,d);break;case"partition":!function(e,t,o,r){Jd().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:rh(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?ch(n,r,o):"treemap"===i||"partition"===i?uh(n,r):"circlepack"===i&&dh(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 a=[],s=[],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(Md(t,"nodeStyle"));let s=i.fill||ah(o);if(o.colorByDepth&&void 0!==t.depth){const e=ih(o);s=e[t.depth%e.length]}a.push({type:"circle",cx:e,cy:r,r:p,style:{fill:s,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 m=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,a=t.y,l=r.x,p=r.y;u&&(n+=d,a+=h,l+=d,p+=h);const f=sh(n,a,l,p,c),g=i(Md(e,"edgeStyle"));s.push({type:"curved",pathD:f,style:{fill:"none",stroke:g.stroke||o.themeSemantic?.border||o.themeSemantic?.secondary||"#999",strokeWidth:g.strokeWidth??1.5,opacity:g.opacity??m},datum:e})}if(!1!==o.showLabels){const t=nh(o.nodeLabel);for(const o of e){const e=t?t(o):o.id;if(!e)continue;let r,n,i,a=o.x,s=o.y;if(u&&(a+=d,s+=h),u){const e=a-d,t=s-h,o=Math.sqrt(e*e+t*t);o>0?(r=a+e/o*10,n=s+t/o*10,i=0>e?"end":"start"):(r=a,n=s-12,i="middle")}else"horizontal"===c?(o.data?.children&&0!==o.data.children.length?(r=a-p-6,i="end"):(r=a+p+6,i="start"),n=s):(r=a,n=s+p+14,i="middle");l.push({x:r,y:n,text:e+"",anchor:i,baseline:"middle",fontSize:11})}}return{sceneNodes:a,sceneEdges:s,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 a=r(Md(o,"nodeStyle"));let s=a.fill||ah(t);if(t.colorByDepth&&void 0!==o.depth){const e=ih(t);s=e[o.depth%e.length]}n.push({type:"rect",x:o.x0,y:o.y0,w:e,h:i,style:{fill:s,stroke:a.stroke||t.themeSemantic?.surface||"#fff",strokeWidth:a.strokeWidth??1,opacity:a.opacity},datum:o,id:o.id,label:o.id,depth:o.depth})}if(!1!==t.showLabels){const o=nh(t.nodeLabel),n=t.labelMode||"leaf",a="partition"===t.chartType;for(const s of e){const e=s.x1-s.x0,l=s.y1-s.y0;if(0>=e||0>=l)continue;const c=!(s.data?.children&&s.data.children.length>0);if(!a){if("leaf"===n&&!c)continue;if("parent"===n&&c)continue}const u=o?o(s):s.id;if(!u)continue;if((c?30:40)>e||(c?16:14)>l)continue;let d=r(Md(s,"nodeStyle")).fill||ah(t);if(t.colorByDepth&&void 0!==s.depth){const e=ih(t);d=e[s.depth%e.length]}const h="string"==typeof d?oh(d):t.themeSemantic?.text??"#000";i.push(c?{x:s.x0+e/2,y:s.y0+l/2,text:u+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,Math.min(e,l)/6)),fill:h}:{x:s.x0+4,y:s.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(Md(o,"nodeStyle"));let a=i.fill||ah(t);if(t.colorByDepth&&void 0!==o.depth){const e=ih(t);a=e[o.depth%e.length]}n.push({type:"circle",cx:o.x,cy:o.y,r:e,style:{fill:a,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=nh(t.nodeLabel);for(const n of e){const e=n.__radius??5,a=o?o(n):n.id;if(!a)continue;if(15>e)continue;const s=!(n.data?.children&&n.data.children.length>0);let l=r(Md(n,"nodeStyle")).fill||ah(t);if(t.colorByDepth&&void 0!==n.depth){const e=ih(t);l=e[n.depth%e.length]}if(s){const o="string"==typeof l?oh(l):t.themeSemantic?.text??"#000";i.push({x:n.x,y:n.y,text:a+"",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:a+"",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 ch(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 uh(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 dh(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}import{pie as hh}from"d3-shape";function ph(e){let t=e.__orbitState;return t||(t={metaMap:new Map,startTime:"undefined"!=typeof performance?performance.now():Date.now()},e.__orbitState=t),t}var fh={sankey:Ld,force:Ed,chord:qd,tree:lh,cluster:lh,treemap:lh,circlepack:lh,partition:lh,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),a=function(e){if("function"==typeof e)return e;const t=e||"name";return e=>(e[t]??"")+""}(o.nodeIDAccessor),s=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=ph(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 m=t[0]/2,g=t[1]/2,y=Math.min(t[0],t[1])/2*.85,b=f(a(e));r.push({id:b,x:m,y:g,x0:m,x1:m,y0:g,y1:g,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,m,g){const y=i(t);if(!y?.length)return;const b=y.length;let v=0,x=0,w=0;for(;b>x;)x+=s[Math.min(w,s.length-1)],w++,v++;let k=0;for(let b=0;v>b;b++){const x=s[Math.min(b,s.length-1)],w=y.slice(k,k+x);if(!w.length)break;const S=(b+1)/v,A={id:o,depth:m,data:t,parentId:o},C=g?p/u(A)*S:p*S,M=hh().value(e=>{const t=i(e)?.length;return t?4:1}).sort(null)(w),P=d(A);for(let t=0;w.length>t;t++){const i=(M[t].startAngle+M[t].endAngle)/2,s=w[t],u=f(a(s)),d=l+C*Math.sin(i),p=c+C*Math.cos(i)*P;r.push({id:u,x:d,y:p,x0:d,x1:d,y0:p,y1:p,width:0,height:0,value:0,depth:m,data:s}),h.metaMap.set(u,{ring:C,angle:i,depth:m,parentId:o,eccentricity:P}),n.push({source:o,target:u,value:1,y0:0,y1:0,sankeyWidth:0,data:{source:o,target:u}}),e(s,u,d,p,C,m+1,!0)}k+=x}}(e,b,m,g,y,1,!1)}(n,r,o,e,t)},buildScene(e,t,o,r){const n=o.nodeStyle,i=o.nodeSize,a="number"==typeof i?()=>i:"function"==typeof i?i:()=>6,s=[],l=[],c=[];if(!1!==o.orbitShowRings){const t=ph(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,a={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 s=n/i*Math.PI*2,c=(n+1)/i*Math.PI*2;l.push({type:"line",x1:e+o*Math.sin(s),y1:t+o*Math.cos(s)*r,x2:e+o*Math.sin(c),y2:t+o*Math.cos(c)*r,style:a,datum:null})}}for(const t of e){if(null==t.x||null==t.y)continue;const e=a(Md(t,"nodeSize")),r=n?n(Md(t,"nodeStyle")):{};s.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=a(Md(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:s,sceneEdges:l,labels:c}},tick:(e,t,o,r,n)=>!1!==o.orbitAnimated&&(function(e,t){const o=ph(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,a=r*(Math.PI/6),s=new Map;for(const t of e)s.set(t.id,t);for(const t of e){const e=o.metaMap.get(t.id);if(!e||!e.parentId)continue;const r=s.get(e.parentId);if(!r)continue;const l=e.angle+i*a*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 mh(e){return fh[e]}import{quadtree as gh}from"d3-quadtree";function yh(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 bh(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(!vh(e))return!1;return!0}return vh(t.points)}function vh(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}import{interpolateNumber as xh}from"d3-interpolate";var wh="rgba(34, 197, 94, 0.7)",kh=2e3,Sh=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={...wu,...e.tensionConfig},e.showParticles&&("sankey"===e.chartType||e.customNetworkLayout)&&(this.particlePool=new Su(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={...wu,...e.tensionConfig},!e.showParticles||"sankey"!==e.chartType&&!e.customNetworkLayout||this.particlePool||(this.particlePool=new Su(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:a="target",valueAccessor:s="value"}=this.config,l="function"==typeof n?n:e=>e[n],c="function"==typeof i?i:e=>e[i],u="function"==typeof a?a:e=>e[a],d="function"==typeof s?s:e=>e[s]??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,{...yh(e),data:t})}for(let e=0;t.length>e;e++){const o=t[e],r=c(o)+"",n=u(o)+"",i=d(o),a=null==i?NaN:Number(i),s=Number.isFinite(a)?a:1;this.nodes.has(r)||this.nodes.set(r,{...yh(r),data:o}),this.nodes.has(n)||this.nodes.set(n,{...yh(n),data:o});const l=`${r}\0${n}\0${e}`,h={source:r,target:n,value:s,y0:0,y1:0,sankeyWidth:0,data:o,_edgeKey:l};o&&"object"==typeof o&&bh(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 a=Ge();this.lastIngestTime=a,this._decaySortedNodes=null,this._networkDecayCache=null,this.nodes.has(t)||(this.nodes.set(t,yh(t)),this.nodeTimestamps.set(t,a),this.tension+=this.tensionConfig.newNode,i=!0),this.nodes.has(o)||(this.nodes.set(o,yh(o)),this.nodeTimestamps.set(o,a),this.tension+=this.tensionConfig.newNode,i=!0);const s=this.edgeKey(t,o),l=this.edges.get(s);let c=!1;return l?(l.value+=r,this.edgeTimestamps.set(s,a),this.tension+=this.tensionConfig.weightChange,c=!0):(this.edges.set(s,{source:t,target:o,value:r,y0:0,y1:0,sankeyWidth:0}),this.edgeTimestamps.set(s,a),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=mh(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)),a=this.config.transition?.duration??this.tensionConfig.transitionDuration,s=["sankey","tree","treemap","circlepack","partition"].includes(this.config.chartType);if(!this._hasRenderedOnce&&this.config.introAnimation&&s&&o.length>0&&a>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:Ge(),duration:a}}else i&&a>0&&(this.restorePreviousPositions(),this.transition={startTime:Ge(),duration:a});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=Ge()),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=nc(this.config.colorScheme,this.config.themeCategorical,de),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:ic(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=Et("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 Ft({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=mh(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:a}=t.buildScene(o,r,this.config,e);this.sceneNodes=n,this.sceneEdges=i,this.labels=a,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=gh().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=mh(this.config.chartType);return!!e?.supportsAnimation&&!1!==this.config.orbitAnimated}tickAnimation(e,t){const o=mh(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=je(e,this.transition),o=We(t);for(const e of this.nodes.values())void 0===e._targetX0||void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=Ye(e._prevX0,e._targetX0,o),e.x1=Ye(e._prevX1,e._targetX1,o),e.y0=Ye(e._prevY0,e._targetY0,o),e.y1=Ye(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=Ye(e._prevY0,e._targetY0,o),e.y1=Ye(e._prevY1,e._targetY1,o),e.sankeyWidth=Ye(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,a=o.y-t.y;n.push([t,{x:t.x+i/3,y:t.y+a/3},{x:t.x+2*i/3,y:t.y+2*a/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,a=o.x0,s=xh(i,a);return{circular:!1,points:[{x:e.y0,y:i},{x:e.y0,y:s(r)},{x:e.y1,y:s(1-r)},{x:e.y1,y:a}],halfWidth:n}}const i=t.x1,a=o.x0,s=xh(i,a);return{circular:!1,points:[{x:i,y:e.y0},{x:s(r),y:e.y0},{x:s(1-r),y:e.y1},{x:a,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 a=t.id;if(!a)continue;const s=e.nodeTimestamps.get(a);if(!s)continue;const l=i-s;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 a="object"==typeof n.source?n.source?.id:n.source,s="object"==typeof n.target?n.target?.id:n.target;if(!a||!s)continue;const l=e.edgeTimestamps.get(`${a}\0${s}`);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 a=Je(t,i,o);n.style={...n.style,opacity:(n.style?.opacity??1)*a}}}({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===wh&&(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>=kh)return;const o=1-t/kh;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=wh,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&&kh>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 a=i.id;if(!a)continue;const s=e.nodes.get(a);if(!s)continue;const l=t.metric(s);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=Ge(),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=Ge()),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=Ge(),!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=Ge()),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()}};Sh.QUADTREE_THRESHOLD=500;var Ah=Sh;import*as Ch from"react";import{Fragment as Mh,jsx as Ph,jsxs as _h}from"react/jsx-runtime";function Lh(e){const{width:t,height:o,totalWidth:r,totalHeight:n,margin:i,labels:a,title:s,legend:l,legendHoverBehavior:c,legendClickBehavior:u,legendHighlightedCategory:d,legendIsolatedCategories:h,legendPosition:p="right",legendLayout:f,foregroundGraphics:m,sceneNodes:g,annotations:y,autoPlaceAnnotations:b,svgAnnotationRules:v}=e,x=Ch.useMemo(()=>{const e=(g||[]).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=zo(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,$t(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:g}},[o,g,t]),w=Ch.useMemo(()=>y&&b?di({annotations:y,context:x,..."object"==typeof b?b:{}}):y,[y,b,x]),k=Ch.useMemo(()=>qn(),[]),S=w?Gn(w.filter(e=>"widget"!==e.type),k,v,x):null,A=!0===w?.some(e=>"widget"===e.type&&!0===e._annotationDeferred);return _h(Mh,{children:[A&&Ph("style",{children:Bn},"annotation-widget-disclosure-style"),_h("svg",{role:"img",width:r,height:n,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[Ph("title",{children:"string"==typeof s?s:"Network Chart"}),Ph("desc",{children:"string"==typeof s?s+" — network data visualization":"Network data visualization"}),_h("g",{transform:`translate(${i.left},${i.top})`,children:[a.map((e,t)=>Ph("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,m]}),s&&"string"==typeof s?Ph("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:s}):s?Ph("foreignObject",{x:0,y:0,width:r,height:i.top,children:s}):null,Jr({legend:l,totalWidth:r,totalHeight:n,margin:i,legendPosition:p,title:s,legendLayout:f,legendHoverBehavior:c,legendClickBehavior:u,legendHighlightedCategory:d,legendIsolatedCategories:h})]}),w?.filter(e=>"widget"===e.type&&e.nodeId&&g).map((e,t)=>{const o=!0===e._annotationDeferred,r=g.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,a=e.height??32;return Ph("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)-a/2,width:n,height:a,display:"flex",alignItems:"center",justifyContent:"center",zIndex:5},children:e.content??Ph("span",{style:{fontSize:18,cursor:"default"},children:"ℹ️"})},"widget-"+t)})]})}Lh.displayName="NetworkSVGOverlay";import*as Rh from"react";import{jsx as Ih}from"react/jsx-runtime";var $h={position:"absolute",top:0,left:0,pointerEvents:"none"};function Th({marks:e,margin:t,selection:o=null,overscan:r=400}){const n=Rh.useRef(null),i=function(e,t,o){const[r,n]=Rh.useState(null);return Rh.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)},a=()=>{0===r&&(r=window.requestAnimationFrame(i))};i(),o.addEventListener("scroll",a,{passive:!0});const s=new ResizeObserver(a);return s.observe(o),()=>{0!==r&&window.cancelAnimationFrame(r),o.removeEventListener("scroll",a),s.disconnect()}},[t,e,o]),Rh.useMemo(()=>{if(!e||!r)return e;const{scroll:t,originX:n,originY:i}=r,a=t.left-o,s=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!(a>t+e.width||t>s||l>o+e.height||o>c)})},[e,r,o])}(e,n,r);if(!e||0===e.length)return null;const a=Ih("div",{className:"semiotic-network-html-marks",ref:n,style:{...$h,transform:`translate(${t.left}px, ${t.top}px)`},children:(i??e).map(e=>Ih("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?Ih(xo,{value:o,children:a}):a}import*as Nh from"react";import{jsx as Fh,jsxs as Dh}from"react/jsx-runtime";function Bh({componentName:e,message:t,diagnosticHint:o,width:r,height:n}){return Fh("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:Dh("div",{style:{textAlign:"center",maxWidth:400},children:[Fh("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:e}),Fh("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:t}),o&&Fh("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})]})})}import{jsx as Eh}from"react/jsx-runtime";var zh=class extends Nh.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:Eh(Bh,{componentName:"ChartErrorBoundary",message:t.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}};import{jsx as Hh}from"react/jsx-runtime";var Oh="undefined"!=typeof process&&"production"!==process.env?.NODE_ENV;function Wh({componentName:e,width:t,height:o,children:r}){return Hh(zh,{fallback:r=>Hh(Bh,{componentName:e,message:r.message,width:t,height:o}),children:r})}var jh={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"},Yh={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Gh(e,t,o,r){return!1===r||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?Hh("div",{style:{...jh,width:t,height:o},children:r||"No data available"}):null}function qh(e,t,o,r){if(!e)return null;if(!1===r)return null;if(null!=r)return Hh("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))),a=Math.max(6,Math.floor(o/(2.5*n))),s=Math.floor((o-(n*(i+a)-a))/2);return Hh("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)=>Hh("div",{className:"semiotic-loading-bar",style:{...Yh,position:"absolute",top:s+o*(i+a),left:Math.floor(.1*t),width:30+(37*o+13)%50+"%",height:i,opacity:.5+o%2*.2}},o))})}function Vh(e,t,o,r){if(!Oh)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}`)}function Xh(e,t,o,r,n=4e4){return"sync"!==e&&("worker"===e||r*(t+o)>=n)}function Uh(){return"undefined"!=typeof window&&"undefined"!=typeof Worker}function Kh(){if("undefined"!=typeof DOMException)return new DOMException("Force layout aborted","AbortError");const e=Error("Force layout aborted");return e.name="AbortError",e}var Qh=class{constructor(e=function(){const e="string"==typeof import.meta.url&&import.meta.url?new URL("./forceLayoutWorker.js",import.meta.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(Kh());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(Kh())},a=()=>t?.removeEventListener("abort",i);this.pending.set(o,{cleanup:a,reject:n,resolve:e}),t?.addEventListener("abort",i,{once:!0});try{this.worker.postMessage(r)}catch(e){this.pending.delete(o),a(),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()}},Zh=null;function Jh(e,t){return Uh()?t?.aborted?Promise.reject(Kh()):(Zh&&!Zh.isDead||(Zh=new Qh),Zh).request(e,t):Promise.reject(Error("Web Workers are unavailable"))}import{jsx as ep,jsxs as tp}from"react/jsx-runtime";var op=/^(value|amount|total|count|weight|score)$/i;function rp({data:e}){if("edge"===e.nodeOrEdge){const t=e.data;return t?tp("div",{className:"semiotic-tooltip",style:us,children:[tp("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&&tp("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 tp("div",{className:"semiotic-tooltip",style:us,children:[ep("div",{children:e.map((e,t)=>tp("span",{children:[t>0&&ep("span",{style:{margin:"0 3px",opacity:.5},children:" → "}),t===n?ep("strong",{children:e}):ep("span",{style:{opacity:.7},children:e})]},t))}),null!=t.value&&t.value>0&&ep("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=ss(t.data??t),a=null!=i.title?i.title+"":t.id,s=i.entries.some(e=>op.test(e.key));return tp("div",{className:"semiotic-tooltip",style:us,children:[ep("div",{style:{fontWeight:600},children:a}),i.entries.map(e=>tp("div",{style:{marginTop:4,opacity:.8},children:[e.key,": ",Al(e.value)]},e.key)),!s&&null!=t.value&&t.value>0&&tp("div",{style:{marginTop:4,opacity:.8},children:["Total:"," ","number"==typeof t.value?t.value.toLocaleString():t.value+""]}),r>0&&tp("div",{style:{marginTop:4,opacity:.8},children:["Connections: ",r,n!==r&&` (weighted: ${n.toLocaleString()})`]})]})}function np(e){return e._cachedPath2D&&e._cachedPath2DSource===e.pathD||(e._cachedPath2D=new Path2D(e.pathD),e._cachedPath2DSource=e.pathD),e._cachedPath2D}function ip(e,t){if(!t.pathD)return;e.save();const o=np(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",a=Xo(e,i)||i;o.addColorStop(0,1===r.from?a:"transparent"),o.addColorStop(1,1===r.to?a:"transparent"),e.fillStyle=o,e.globalAlpha=n}else e.fillStyle="string"==typeof t.style.fill&&Xo(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=Xo(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 ap(e,t){e.save();const o=t.style.stroke||"#999";e.strokeStyle=Xo(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 sp(e,t){if(!t.pathD)return;e.save();const o=np(t);t.style.fill&&"none"!==t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&Xo(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=Xo(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 lp(e,t){if(!t.pathD)return;e.save();const o=np(t),r=t.style.stroke||"#999";e.strokeStyle=Xo(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&&Xo(e,t.style.fill)||t.style.fill,e.globalAlpha=t.style.fillOpacity??.1,e.fill(o)),e.restore()}rp.ownsChrome=!0;var cp=new Map;function up(e){try{if(e.path)return new Path2D(e.path);const t=`${e.symbolType??"circle"}:${Math.round(e.size)}`;let o=cp.get(t);return o||(o=new Path2D(It(e.symbolType,e.size)),cp.size>256&&cp.clear(),cp.set(t,o)),o}catch{return null}}function dp(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:Ne,a=Array.from(o);for(let e=0;a.length>e;e++){const t=a[e];r.has(t.id)||r.set(t.id,i[e%i.length])}return a.length}function hp(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,a=Math.sqrt(n*n+i*i);return a>_o(e.r,r)?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:a}}(e,t,o,r);case"rect":return function(e,t,o){const r=Po(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 a=Io(Math.atan2(n,r)),s=Io(e.startAngle),l=Io(e.endAngle);if(s>l?a>=s||l>=a:a>=s&&l>=a){const t=(e.startAngle+e.endAngle)/2,o=(e.innerR+e.outerR)/2;return{type:"node",datum:e.datum,x:e.cx+o*Math.cos(t),y:e.cy+o*Math.sin(t),distance:0}}return null}(e,t,o);case"symbol":return function(e,t,o,r=30){const n=t-e.cx,i=o-e.cy,a=Math.sqrt(n*n+i*i);return a>_o($t(e.size),r)?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:a}}(e,t,o,r);case"glyph":return function(e,t,o,r=30){if(null==e.datum)return null;const n=zo(e.glyph,e.size),i=e.cx+n.centerDx,a=e.cy+n.centerDy,s=t-i,l=o-a,c=Math.sqrt(s*s+l*l);return c>_o(n.radius,r)?null:{type:"node",datum:e.datum,x:i,y:a,distance:c}}(e,t,o,r);default:return null}}var pp=null,fp=null;function mp(){return fp||((pp=document.createElement("canvas")).width=1,pp.height=1,fp=pp.getContext("2d")),fp}function gp(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 yp(e,t,o){switch(e.type){case"bezier":return function(e,t,o){if(!e.pathD)return null;const r=gp(e),n=mp();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 a=n.isPointInStroke(r,t,o);if(n.lineWidth=i,a)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 a=((t-e.x1)*r+(o-e.y1)*n)/i;a=Math.max(0,Math.min(1,a));const s=e.x1+a*r,l=e.y1+a*n,c=Math.sqrt((t-s)**2+(o-l)**2);return c>5?null:{type:"edge",datum:e.datum,x:s,y:l,distance:c}}(e,t,o);case"ribbon":case"curved":return function(e,t,o){if(!e.pathD)return null;const r=gp(e),n=mp();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 a=n.isPointInStroke(r,t,o);if(n.lineWidth=i,a)return{type:"edge",datum:e.datum,x:t,y:o,distance:4}}catch{}return null}(e,t,o);default:return null}}function bp(e){const{clientX:t,clientY:o,canvasRect:r,margin:n,adjustedWidth:i,adjustedHeight:a,sceneNodes:s,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>a)return{kind:"miss-outside"};const f=function(e,t,o,r,n=30,i,a=0){let s=null,l=n,c=1/0;if(i){const e=Oo(i,o,r,n,a,e=>e.cx,e=>e.cy,e=>e.r);e&&(s={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=hp(t,o,r,n);if(e)if("rect"===t.type){const o=t.w*t.h;c>o&&(s=e,c=o)}else l>e.distance&&(s=e,l=e.distance)}if(s)return s;for(const e of t){if(!1===e.interactive)continue;const t=yp(e,o,r);t&&l>t.distance&&(s=t,l=t.distance)}return s}(s,l,h,p,d,c,u);return f?{kind:"hit",hover:ts(f.datum||{},f.x,f.y,{nodeOrEdge:f.type})}:{kind:"miss"}}import{jsx as vp,jsxs as xp}from"react/jsx-runtime";var wp={top:20,right:80,bottom:20,left:80},kp={top:40,right:40,bottom:40,left:40},Sp=new Set(["chord","force","circlepack","orbit"]),Ap=[800,600],Cp=xu(vu(function(e,t){const{chartType:o,nodes:r,edges:n,data:i,initialEdges:a,nodeIDAccessor:s="id",sourceAccessor:l="source",targetAccessor:c="target",valueAccessor:u="value",edgeIdAccessor:d,childrenAccessor:h,hierarchySum:p,orientation:f="horizontal",nodeAlign:m="justify",nodePaddingRatio:g=.05,nodeWidth:y=15,iterations:b=300,forceStrength:v=.1,layoutExecution:x="auto",layoutLoadingContent:w,onLayoutStateChange:k,padAngle:S=.01,groupWidth:A=20,sortGroups:C,edgeSort:M,treeOrientation:P="vertical",edgeType:_="curve",padding:L,paddingTop:R,tensionConfig:$,showParticles:T=!1,particleStyle:N,nodeStyle:F,edgeStyle:D,colorBy:B,colorScheme:E="category10",edgeColorBy:z="source",edgeOpacity:H=.5,colorByDepth:O=!1,nodeSize:j=8,nodeSizeRange:Y=[5,20],nodeLabel:G,showLabels:q=!0,labelMode:V,size:X=Ap,responsiveWidth:U,responsiveHeight:K,margin:Q,className:Z,background:J,enableHover:ee=!0,tooltipContent:te,customHoverBehavior:oe,customClickBehavior:re,onObservation:ne,chartId:ie,onTopologyChange:ae,annotations:se,autoPlaceAnnotations:le,svgAnnotationRules:ce,legend:ue,legendPosition:de,legendLayout:he,legendHoverBehavior:pe,legendClickBehavior:fe,legendHighlightedCategory:me,legendIsolatedCategories:ge,title:ye,foregroundGraphics:be,backgroundGraphics:ve,decay:xe,pulse:we,transition:ke,animate:Se,staleness:Ae,thresholds:Ce,accessibleTable:Me=!0,description:Pe,summary:_e,orbitMode:Le,orbitSize:Re,orbitSpeed:Ie,orbitRevolution:$e,orbitRevolutionStyle:Te,orbitEccentricity:Fe,orbitShowRings:De,orbitAnimated:Be,customNetworkLayout:Ee,onLayoutError:ze,layoutConfig:He,layoutSelection:Oe}=e,We=Sp.has(o)?kp:wp,je=pu(!0),Ye=Fs({sizeProp:X,responsiveWidth:U,responsiveHeight:K,userMargin:Q,marginDefault:We,foregroundGraphics:be,backgroundGraphics:ve,animate:Se,transitionProp:ke,themeDirtyRef:je}),{reducedMotionRef:Ge,responsiveRef:qe,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:at}=Ye,st=ra(),lt=sa(),ct=gu(()=>I(r),[r]),ut=gu(()=>Array.isArray(n)?I(n):n,[n]),dt=gu(()=>({...wu,...$}),[$]),ht=gu(()=>({...ku,...N}),[N]),pt=gu(()=>{return{chartType:(e={chartType:o,nodeIDAccessor:s,sourceAccessor:l,targetAccessor:c,valueAccessor:u,edgeIdAccessor:d,childrenAccessor:h,hierarchySum:p,orientation:f,nodeAlign:m,nodePaddingRatio:g,nodeWidth:y,iterations:b,forceStrength:v,padAngle:S,groupWidth:A,sortGroups:C,edgeSort:M,treeOrientation:P,edgeType:_,padding:L,paddingTop:R,tensionConfig:dt,showParticles:T,particleStyle:ht,nodeStyle:F,edgeStyle:D,nodeLabel:G,showLabels:q,labelMode:V,colorBy:B,colorScheme:E,edgeColorBy:z,edgeOpacity:H,colorByDepth:O,nodeSize:j,nodeSizeRange:Y,decay:xe,pulse:we,transition:Je,introAnimation:et,staleness:Ae,thresholds:Ce,orbitMode:Le,orbitSize:Re,orbitSpeed:Ie,orbitRevolution:$e,orbitRevolutionStyle:Te,orbitEccentricity:Fe,orbitShowRings:De,orbitAnimated:Be,customNetworkLayout:Ee,onLayoutError:ze,layoutConfig:He,currentTheme:at}).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:W(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,s,l,c,u,h,p,f,m,g,y,b,v,S,A,C,M,P,_,L,R,dt,T,ht,F,D,G,q,V,B,E,z,H,O,j,Y,xe,we,Je?.duration,Je?.easing,et,Ae,Ce,Le,Re,Ie,$e,Te,Fe,De,Be,at,Ee,ze,He]),ft=ua(pt),mt=ua({chartType:(gt={chartType:o,nodeIDAccessor:s,sourceAccessor:l,targetAccessor:c,valueAccessor:u,edgeIdAccessor:d,childrenAccessor:h,hierarchySum:p,orientation:f,nodeAlign:m,nodePaddingRatio:g,nodeWidth:y,iterations:b,forceStrength:v,padAngle:S,groupWidth:A,sortGroups:C,edgeSort:M,treeOrientation:P,edgeType:_,padding:L,paddingTop:R,tensionConfig:dt,customNetworkLayout:Ee,orbitMode:Le,orbitSize:Re,orbitEccentricity:Fe}).chartType,nodeIDAccessor:gt.nodeIDAccessor,sourceAccessor:gt.sourceAccessor,targetAccessor:gt.targetAccessor,valueAccessor:gt.valueAccessor,edgeIdAccessor:gt.edgeIdAccessor,childrenAccessor:gt.childrenAccessor,hierarchySum:gt.hierarchySum,orientation:gt.orientation,nodeAlign:gt.nodeAlign,nodePaddingRatio:gt.nodePaddingRatio,nodeWidth:gt.nodeWidth,iterations:gt.iterations,forceStrength:gt.forceStrength,padAngle:gt.padAngle,groupWidth:gt.groupWidth,sortGroups:gt.sortGroups,edgeSort:gt.edgeSort,treeOrientation:gt.treeOrientation,edgeType:gt.edgeType,padding:gt.padding,paddingTop:gt.paddingTop,tensionConfig:gt.tensionConfig,customNetworkLayout:gt.customNetworkLayout,orbitMode:gt.orbitMode,orbitSize:gt.orbitSize,orbitEccentricity:gt.orbitEccentricity});var gt;const yt=pu(null),bt=pu(0),vt=pu(0),xt=pu(!1),wt=pu(null);wt.current||(wt.current=new Ah(ft));const[kt,St]=fu(null),[At,Ct]=fu(0),[Mt,Pt]=fu(0),[_t,Lt]=fu(!1),[Rt,$t]=fu(!1),Tt=pu(0),Nt=pu(null),Ft=pu(!1),Dt=pu(k);Dt.current=k;const Bt=pu(ft);Bt.current=ft;const Et=pu(null),zt=pu(new Map),Ht=pu(0),Ot=yu(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:Ne;n.set(e+"",t[i.current++%t.length])}return n.get(e+"")}}if(n.has(t.id))return n.get(t.id);const a=Array.isArray(r)?r:Ne,s=o?a[i.current++%a.length]:a[0];return n.set(t.id,s),s}({node:e,colorBy:B,colorScheme:E,nodeColorMap:zt.current,colorIndexRef:Ht}),[B,E]),Wt=(jt=at,jt?.colors?.border||jt?.colors?.secondary||jt?.colors?.primary||"#999");var jt;const Yt=yu(e=>function(e,t){return e?"object"==typeof e?e:t?.get(e)??null:null}(e,wt.current?.nodes),[]),Gt=yu(e=>function(e){const{edge:t,edgeColorBy:o,getNodeColor:r,resolveEndpoint:n,fallback:i}=e;if("function"==typeof o)return o(t);const a=n(t.source),s=n(t.target);return"target"===o&&s?r(s):a?r(a):i}({edge:e,edgeColorBy:z,getNodeColor:Ot,resolveEndpoint:Yt,fallback:Wt}),[z,Ot,Wt,Yt]),qt=yu(e=>function(e){const{edge:t,particleStyleColor:o,particleColorBy:r,hasExplicitParticleColorBy:n,getEdgeColor:i,getNodeColor:a,resolveEndpoint:s,fallback:l}=e;if("function"==typeof o){const e=s(t.source);return e?o(t,e):l}if(!n)return i(t);const c=r,u=s(t.source),d=s(t.target);return"target"===c&&d?a(d):u?a(u):l}({edge:e,particleStyleColor:ht.color,particleColorBy:ht.colorBy,hasExplicitParticleColorBy:!!N?.colorBy,getEdgeColor:Gt,getNodeColor:Ot,resolveEndpoint:Yt,fallback:Wt}),[N?.colorBy,ht.color,ht.colorBy,Ot,Gt,Wt,Yt]),Vt=("sankey"===o||!!Ee)&&T||!!we||(wt.current?.isAnimating??!1);Co(wt,ft,je,nt),Mo(wt,Oe,je,nt),mu(()=>{const e=wt.current;e&&(e.buildScene([Ue,Ke]),Ht.current=dp({sceneNodes:e.sceneNodes,nodes:e.nodes.values(),nodeColorMap:zt.current,colorScheme:E}),je.current=!0,nt())},[at,Ue,Ke,nt]);const Xt=yu(()=>{const e=wt.current;if(e&&(e.runLayout([Ue,Ke]),e.buildScene([Ue,Ke]),je.current=!0,Ht.current=dp({sceneNodes:e.sceneNodes,nodes:e.nodes.values(),nodeColorMap:zt.current,colorScheme:E}),Ct(e.layoutVersion),ae)){const{nodes:t,edges:o}=e.getLayoutData();ae(t,o)}},[Ue,Ke,ae,E]),Ut=yu(e=>{if(null==e||"object"!=typeof e)return;const t=wt.current;t&&(t.ingestEdge(e)&&Xt(),nt())},[Xt,nt]),Kt=yu(e=>{const t=wt.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=yu(()=>{wt.current?.clear(),zt.current.clear(),Ht.current=0,Ct(wt.current?.layoutVersion??0),St(null),Et.current=null,je.current=!0,nt()},[nt]),Zt=yu(()=>{const e=wt.current;e&&(e.tension+=999,Xt(),nt())},[Xt,nt]);bu(t,()=>({push:Ut,pushMany:Kt,removeNode:e=>{const t=wt.current?.removeNode(e)??!1;if(t){const t=Et.current?.data?"function"==typeof s?s(Et.current.data):Et.current.data[s]:void 0;Et.current&&"node"===Et.current.nodeOrEdge&&t===e&&(Et.current=null,St(null)),zt.current.delete(e),Xt(),je.current=!0,nt()}return t},removeEdge:(e,t)=>{const o=wt.current?.removeEdge(e,t)??!1;if(o){if(Et.current&&"edge"===Et.current.nodeOrEdge){const o=Et.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&&(Et.current=null,St(null))}Xt(),je.current=!0,nt()}return o},updateNode:(e,t)=>{const o=wt.current?.updateNode(e,t)??null;return o&&(je.current=!0,nt()),o},updateEdge:(e,t,o)=>{const r=wt.current?.updateEdge(e,t,o)??[];return r.length>0&&(Xt(),je.current=!0,nt()),r},clear:Qt,getTopology:()=>wt.current?.getLayoutData()??{nodes:[],edges:[]},getCustomLayout:()=>wt.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>wt.current?.lastCustomLayoutFailure??null,getTopologyDiff:()=>{const e=wt.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:()=>wt.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;mu(()=>{const e=wt.current;if(!e)return;const t=++Tt.current;if(Nt.current?.abort(),Nt.current=null,Jt&&eo)e.ingestHierarchy(eo,[Ue,Ke]),e.buildScene([Ue,Ke]),$t(!1),Dt.current?.("ready"),je.current=!0,nt();else{const i=ct,a=Array.isArray(ut)?ut:[];if(0===i.length&&0===a.length)return null==r&&null==n||0>=e.nodes.size&&0>=e.edges.size||Qt(),$t(!1),void Dt.current?.("ready");const s=[Ue,Ke],l="force"===o&&!Ee&&Uh()&&Xh(x,i.length,a.length,b);if(l&<&&!Ft.current&&e.sceneNodes.length>0)return Ft.current=!0,$t(!1),Dt.current?.("ready"),je.current=!0,void nt();if(l){const o=new AbortController;Nt.current=o;const r=e._lastPositionSnapshot;e.ingestBounded(i,a,s,{deferLayout:!0});const n=e.getLayoutData(),l=function(e,t,o,r,n){const i=Od(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,s,r);return $t(!0),Dt.current?.("pending"),Jh(l,o.signal).then(({positions:o})=>{t===Tt.current&&(e.applyForceLayoutPositions(o,s),e.buildScene(s),Ht.current=dp({sceneNodes:e.sceneNodes,nodes:e.nodes.values(),nodeColorMap:zt.current,colorScheme:E}),$t(!1),Dt.current?.("ready"),Ct(e.layoutVersion),je.current=!0,nt())}).catch(o=>{"AbortError"!==o.name&&t===Tt.current&&(e.runLayout(s),e.buildScene(s),Ht.current=dp({sceneNodes:e.sceneNodes,nodes:e.nodes.values(),nodeColorMap:zt.current,colorScheme:E}),$t(!1),Dt.current?.("error"),Ct(e.layoutVersion),je.current=!0,nt())}),()=>o.abort()}e.ingestBounded(i,a,s),e.buildScene(s),$t(!1),Dt.current?.("ready"),Ht.current=dp({sceneNodes:e.sceneNodes,nodes:e.nodes.values(),nodeColorMap:zt.current,colorScheme:E}),je.current=!0,nt()}},[ct,ut,r,n,i,eo,Jt,Ue,Ke,mt,x,b,lt,o,Ee,nt,Qt,E]),mu(()=>{a&&a.length>0&&Kt(a)},[]);const to=yu(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=yu(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:ao}=Ye,so=()=>!Ee||(wt.current?.hasCustomRestyle??!1);ro.current=e=>{if(!ee)return;const t=so(),o=yt.current;if(!o)return;const r=wt.current;if(!r)return;const n=bp({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?(Et.current=n.hover,St(n.hover),to&&(to(n.hover),t&&(je.current=!0)),t&&nt()):Et.current&&(Et.current=null,St(null),to&&(to(null),t&&(je.current=!0)),t&&nt())},no.current=()=>{if(Et.current){const e=so();Et.current=null,St(null),to&&(to(null),e&&(je.current=!0)),e&&nt()}};const lo=pu(()=>{});lo.current=e=>{if(!re&&!ne)return;const t=yt.current;if(!t)return;const o=wt.current;if(!o)return;const r=bp({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 co=yu(e=>lo.current(e),[]),uo=pu(-1),ho=pu(null),po=pu(-1),fo=yu(e=>{const t=wt.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=zo(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=Ar(o),n=uo.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(),uo.current=0,po.current=-1;const t=r.flat[0];ho.current={shape:t.shape,w:t.w,h:t.h};const o=ts(t.datum||{},t.x,t.y,{nodeOrEdge:"node"});return Et.current=o,St(o),to&&(to(o),je.current=!0),void nt()}const i=Cr(r,n),a=function(e,t,o,r,n){const i=o.flat[t.flatIndex];if(!i)return Mr(e,t,o);const a=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 a=e.flat[i];if(a===t)continue;const s=a.x-t.x,l=a.y-t.y;let c=!1;switch(o){case"right":c=s>0&&Math.abs(s)>=Math.abs(l);break;case"left":c=0>s&&Math.abs(s)>=Math.abs(l);break;case"down":c=l>0&&Math.abs(l)>=Math.abs(s);break;case"up":c=0>l&&Math.abs(l)>=Math.abs(s)}if(!c)continue;const u=s*s+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==a)return t.flatIndex;const e=function(e,t){const o=e+"",r=[];for(const e of t){const t=e.datum??e,n=_r(t.source),i=_r(t.target),a=null!=n,s=null!=i;a&&n+""===o&&s?r.push(i+""):s&&i+""===o&&a&&r.push(n+"")}return r}(a,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=Mr(e,t,o);return null!==r&&r!==t.flatIndex&&(n.current=-1),r}}}(e.key,i,r,t.sceneEdges??[],po);if(null===a)return;if(e.preventDefault(),0>a)return uo.current=-1,ho.current=null,po.current=-1,Et.current=null,St(null),to&&(to(null),je.current=!0),void nt();uo.current=a;const s=r.flat[a];ho.current={shape:s.shape,w:s.w,h:s.h};const l={data:s.datum||{},x:s.x,y:s.y,__semioticHoverData:!0,nodeOrEdge:"node"};Et.current=l,St(l),to&&(to(l),je.current=!0),nt()},[to,nt]),go=yu(e=>{uo.current=-1,ho.current=null,io(e)},[io]);rt.current=()=>{ot.current=null;const e=yt.current;if(!e)return;const t=wt.current;t&&function(e){const{canvas:t,store:o,size:r,margin:n,adjustedWidth:i,adjustedHeight:a,background:s,dirtyRef:l,lastFrameTimeRef:c,reducedMotion:u,showParticles:d,isContinuous:h,animate:p,decay:f,pulse:m,thresholds:g,staleness:y,particleStyle:b,getParticleColor:v,pendingAnnotationFrameRef:x,lastAnnotationFrameTimeRef:w,setAnnotationFrame:k,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 P=o.advanceTransition(u?C+1e6:C),_=!u&&P,L=!u&&o.tickAnimation([i,a],M),R=l.current;(P||R||L)&&o.buildScene([i,a]);const I=d&&!u&&!!o.particlePool,$=!!((T={dirtyOrRebuilt:R,transitioning:_,animationTicked:L,continuous:I||h,liveEncoding:!!f||!!m||!!g||!1!==p&&o.hasActiveTopologyDiff||o.hasActivePulses||o.hasActiveThresholds,forced:o.consumeStylePaintPending()}).dirtyOrRebuilt||T.transitioning||T.animationTicked||T.continuous||T.liveEncoding||T.forced);var T;const N=!!y&&o.lastIngestTime>0&&C-o.lastIngestTime>(y?.threshold??5e3);if($){if(!Bs(t,r,n,Es()))return;if(A.clearRect(-n.left,-n.top,r[0],r[1]),fa(A,{background:s,width:i,height:a}),f&&o.applyDecay(),m&&o.applyPulse(C),g&&o.applyThresholds(C),!1!==p&&o.applyTopologyDiff(C),N&&(A.globalAlpha=y?.dimOpacity??.5),function(e,t){for(const o of t)switch(o.type){case"bezier":ip(e,o);break;case"line":ap(e,o);break;case"ribbon":sp(e,o);break;case"curved":lp(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&&Xo(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=Xo(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)),Js(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&&Xo(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=Xo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??1,e.globalAlpha=t.style.opacity??1,e.stroke()),el(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&&Xo(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=Xo(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=up(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&&Xo(e,t.style.fill)||t.style.fill,e.fill(n)),t.style.stroke&&"none"!==t.style.stroke&&(e.globalAlpha=o*i,e.strokeStyle=Xo(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&&ul(e,r,r.cx,r.cy,o);e.globalAlpha=o}(A,o.sceneNodes),I&&!N){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 a=t[r];if(!a.bezier)continue;if(e.countForEdge(r)>=i)continue;const s=a.value*n*o*(a.bezier.circular?.3:1),l=Math.floor(s),c=s-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 a=0;t.particles.length>a;a++){const s=t.particles[a];if(!s.active)continue;const l=o[s.edgeIndex];if(!l)continue;let c;c="string"==typeof r.color&&"inherit"!==r.color?r.color:n(l),e.fillStyle=Xo(e,c)||c,e.beginPath(),e.arc(s.x,s.y,i,0,2*Math.PI),e.fill()}e.globalAlpha=1}(A,o.particlePool,e,b,v)}}N&&(A.globalAlpha=1)}l.current=!1,(R||_||L)&&t.setAttribute("aria-label",Ra(o.sceneNodes?.length??0,o.sceneEdges?.length??0,"Network chart"));const F=R||_||L||x.current;F&&C-w.current>=33?(k(e=>e+1),w.current=C,x.current=!1):x.current=!!F,(h||_||null!=o.transition||L||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:je,lastFrameTimeRef:bt,reducedMotion:!!Ge.current,showParticles:T,isContinuous:Vt,animate:Se,decay:xe,pulse:we,thresholds:Ce,staleness:Ae,particleStyle:ht,getParticleColor:qt,pendingAnnotationFrameRef:xt,lastAnnotationFrameTimeRef:vt,setAnnotationFrame:Pt,scheduleNextFrame:()=>{nt()}})},la({hydrated:st,wasHydratingFromSSR:lt,storeRef:wt,dirtyRef:je,renderFnRef:rt,cancelRender:it}),mu(()=>{je.current=!0,nt()},[o,Ue,Ke,J,nt]),Fr(Ae,wt,je,nt,_t,Lt);const yo=ee&&kt?vp(bs,{x:kt.x,y:kt.y,containerWidth:Ue,containerHeight:Ke,margin:Xe,className:"stream-network-tooltip",zIndex:2,children:te?te(kt):vp(rp,{data:kt})}):null;if(Ki||!st&<){const e=wt.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??[],a=e?.labels??[];return xp("div",{ref:qe,className:"stream-network-frame"+(Z?" "+Z:""),role:"img","aria-label":Pe||("string"==typeof ye?ye:"Network chart"),style:{position:"relative",width:U?"100%":Ve[0],height:K?"100%":Ve[1]},children:[vp(qa,{summary:_e}),xp("svg",{xmlns:"http://www.w3.org/2000/svg",width:Ve[0],height:Ve[1],style:{position:"absolute",left:0,top:0},children:[Ze&&vp("g",{transform:`translate(${Xe.left},${Xe.top})`,children:Ze}),xp("g",{transform:`translate(${Xe.left},${Xe.top})`,children:[J&&vp("rect",{x:0,y:0,width:Ue,height:Ke,fill:J}),r.map((e,t)=>function(e,t){switch(e.type){case"line":return ji("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 ji("path",{d:o.pathD,fill:qi(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 ji("path",{d:o.pathD,fill:qi(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 ji("path",{d:o.pathD,fill:qi(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 ji("circle",{cx:o.cx,cy:o.cy,r:o.r,fill:qi(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},"net-circle-"+t)}case"rect":{const o=e;return ji("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:qi(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},"net-rect-"+t)}case"arc":{const o=e,r=Bi().innerRadius(o.innerR).outerRadius(o.outerR).startAngle(o.startAngle+Math.PI/2).endAngle(o.endAngle+Math.PI/2)(Gi)||"";return ji("path",{d:r,transform:`translate(${o.cx},${o.cy})`,fill:qi(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},"net-arc-"+t)}case"symbol":{const o=e,r=It(o.symbolType,o.size,o.path);return ji("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?qi(o.style.fill):"none",stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},"net-symbol-"+t)}case"glyph":return Xi(e,e.cx,e.cy,"net-glyph-"+(e.id??t));default:return null}}(e,t)).filter(Boolean),a.map((e,t)=>function(e,t){return ji("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)]})]}),vp(Lh,{width:Ue,height:Ke,totalWidth:Ve[0],totalHeight:Ve[1],margin:Xe,labels:a,sceneNodes:t,title:ye,legend:ue,legendPosition:de,legendLayout:he,legendHoverBehavior:pe,legendClickBehavior:fe,legendHighlightedCategory:me,legendIsolatedCategories:ge,foregroundGraphics:mo(Qe,ko(wt.current?.customLayoutOverlays,Oe??null)),annotations:se,autoPlaceAnnotations:le,svgAnnotationRules:ce,annotationFrame:0}),vp(Th,{marks:e?.customLayoutHtmlMarks,margin:Xe,selection:Oe??null})]})}const bo=wt.current;return xp("div",{ref:qe,className:"stream-network-frame"+(Z?" "+Z:""),role:"group","aria-label":Pe||("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:fo,children:[Me&&vp(Va,{tableId:tt}),Me&&vp(Ga,{nodes:bo?.sceneNodes??[],edges:bo?.sceneEdges??[],chartType:"Network chart",tableId:tt,chartTitle:"string"==typeof ye?ye:void 0}),vp(qa,{summary:_e}),vp(Xa,{hoverPoint:kt}),xp("div",{role:"img","aria-label":Pe||("string"==typeof ye?ye:"Network chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:ee?go:void 0,onMouseLeave:ee?ao:void 0,onClick:re||ne?co:void 0,children:[Rt&&!1!==w&&vp("div",{style:{position:"absolute",inset:0,zIndex:3,background:"var(--semiotic-bg, #fff)"},children:qh(!0,Ve[0],Ve[1],w)}),Ze&&vp("svg",{overflow:"visible",style:{position:"absolute",top:0,left:0,width:Ve[0],height:Ve[1],pointerEvents:"none",overflow:"visible"},children:vp("g",{transform:`translate(${Xe.left},${Xe.top})`,children:Ze})}),vp("canvas",{ref:yt,"aria-label":Ra(bo?.sceneNodes?.length??0,bo?.sceneEdges?.length??0,"Network chart"),style:{position:"absolute",top:0,left:0}}),vp(Lh,{width:Ue,height:Ke,totalWidth:Ve[0],totalHeight:Ve[1],margin:Xe,labels:bo?.labels||[],sceneNodes:bo?.sceneNodes,title:ye,legend:ue,legendPosition:de,legendLayout:he,legendHoverBehavior:pe,legendClickBehavior:fe,legendHighlightedCategory:me,legendIsolatedCategories:ge,foregroundGraphics:mo(Qe,ko(wt.current?.customLayoutOverlays,Oe??null)),annotations:se,autoPlaceAnnotations:le,svgAnnotationRules:ce,annotationFrame:Mt}),vp(Th,{marks:bo?.customLayoutHtmlMarks,margin:Xe,selection:Oe??null}),vp(Qa,{active:uo.current>=0,hoverPoint:kt,margin:Xe,size:Ve,shape:ho.current?.shape,width:ho.current?.w,height:ho.current?.h}),yo,Ae?.showBadge&&vp(Br,{isStale:_t,position:Ae.badgePosition})]})]})}));Cp.displayName="StreamNetworkFrame";var Mp=Cp;function Pp(e){const{title:t,description:o,summary:r,accessibleTable:n,className:i,animate:a,axisExtent:s,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!=a&&(c.animate=a),void 0!==s&&(c.axisExtent=s),void 0!==l&&(c.autoPlaceAnnotations=l),c}function _p(e){const{linkedHover:t,selection:o,onObservation:r,onClick:n,hoverRadius:i,hoverHighlight:a,forceHoverBehavior:s,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(s||t||r||n||a)&&(p.customHoverBehavior=u),d&&(l||(h?r||n||t:r||n)||c?.enabled&&(c.tapToSelect||c.tapToLockTooltip)&&(t||a||o))&&(p.customClickBehavior=d),null!=f&&(p.hoverRadius=f),p}function Lp(e){const{tooltip:t,defaultTooltipContent:o}=e;return{tooltipContent:!1===t?()=>null:gs(t)||o}}import*as Rp from"react";import{useMemo as Ip,useCallback as $p,forwardRef as Tp,useRef as Np}from"react";import{useMemo as Fp,useCallback as Dp,useState as Bp,useId as Ep,useEffect as zp,useRef as Hp}from"react";import{createContext as Op,useContext as Wp,useMemo as jp}from"react";import{jsx as Yp}from"react/jsx-runtime";var Gp=Op(null);function qp({colors:e,categories:t,colorScheme:o="category10",children:r}){const n=jp(()=>{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]=ze(e,o)??Ne[n++%Ne.length];return r}const e=Array.isArray(o)?o:Te[o]||Ne,r={};for(let o=0;t.length>o;o++)r[t[o]]=e[o%e.length];return r}return{}},[e,t,o]);return Yp(Gp.Provider,{value:n,children:r})}function Vp(){return Wp(Gp)}qp.displayName="CategoryColorProvider";import{createContext as Xp,useContext as Up,useEffect as Kp,useId as Qp,useLayoutEffect as Zp,useMemo as Jp,useRef as ef,useState as tf,useCallback as of}from"react";function rf(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 nf(e,t){const o=[];for(const[r,n]of e.clauses)"crossfilter"===e.resolution&&r===t||o.push(rf(n));return 0===o.length?()=>!0:"intersect"===e.resolution?e=>o.every(t=>t(e)):e=>o.some(t=>t(e))}function af(e,t){let o=e.get(t);return o||(o={name:t,resolution:"union",clauses:new Map},e.set(t,o)),o}function sf(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[lf,cf]=H(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||!sf(r,o))return!1}return!0}(n,o))return{};const i=new Map(e.selections),a=af(i,t),s=new Map(a.clauses);return s.set(o.clientId,o),i.set(t,{...a,clauses:s}),{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=af(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}})}})),[uf,df]=H(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}))}}));import{useId as hf,useMemo as pf,useCallback as ff}from"react";function mf(e){const t=hf(),o=e.clientId||t,{name:r}=e,n=cf(e=>e.selections.get(r)),i=cf(e=>e.setClause),a=cf(e=>e.clearClause),s=pf(()=>!!n&&n.clauses.size>0,[n]);return{predicate:pf(()=>n&&0!==n.clauses.size?nf(n,o):()=>!0,[n,o]),isActive:s,selectPoints:ff(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:ff(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:ff(()=>{a(r,o)},[a,r,o]),clientId:o}}function gf(e,t){const o=hf(),r=t||o,n=cf(e=>e.setClause),i=cf(e=>e.clearClause);return{selectPoints:ff(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:ff(()=>i(e,r),[e,r,i]),clientId:r}}function yf(e){const t=e.name||"hover",{fields:o}=e,{predicate:r,isActive:n,selectPoints:i,clear:a}=mf({name:t,fields:o});return{onHover:ff(e=>{if(!e)return void a();const t={};for(const r of o){const o=e[r];void 0!==o&&(t[r]=[o])}xf(t)&&i(t)},[o,i,a,t]),predicate:r,isActive:n}}function bf(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function vf(e){const{name:t,xField:o,yField:r}=e,{predicate:n,isActive:i,selectInterval:a,clear:s}=mf({name:t,fields:[o,r].filter(Boolean)}),l=o&&r?"xyBrush":o?"xBrush":"yBrush",c=ff(e=>{if(!e)return void s();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&&bf(e)?o&&(t[o]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]):"yBrush"===l&&bf(e)&&r&&(t[r]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]),xf(t)&&a(t)},[l,o,r,a,s]);return{brushInteraction:pf(()=>({brush:l,during:c,end:c}),[l,c]),predicate:n,isActive:i,clear:s}}function xf(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function wf(e,t,o){const r=cf(e=>e.selections.get(t));return pf(()=>{if(!r||0===r.clauses.size)return e;const t=nf(r,o);return e.filter(t)},[e,r,o])}import{useMemo as kf}from"react";function Sf(e={}){const{limit:t=50,types:o,chartId:r}=e,n=df(e=>e.version),i=df(e=>e.observations),a=df(e=>e.clearObservations),s=kf(()=>{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:s,latest:s.length>0?s[s.length-1]:null,clear:a}}import{jsx as Af,jsxs as Cf}from"react/jsx-runtime";var Mf=Xp(!1),Pf=Xp(!1);function _f(){return Up(Pf)}var Lf=Xp(null),Rf="undefined"==typeof window?Kp:Zp;function If(e){const t=new Set,o=[];for(const r of e)t.has(r)||(t.add(r),o.push(r));return o}function $f(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 Tf(e){const t=Up(Lf),o=Qp(),r=If(e),n=ef([]);$f(n.current,r)||(n.current=r);const i=n.current;Rf(()=>{if(t)return()=>t.unregisterCategories(o)},[t,o]),Rf(()=>{t&&t.registerCategories(o,i)},[t,o,i])}var Nf="__linked-legend-isolate__",Ff="__linked-legend-highlight__";function Df({categoryColors:e,interaction:t,selectionName:o,field:r}){const n=Object.entries(e),i=n.map(([e])=>e),a=[{styleFn:e=>({fill:e.color||"#333",stroke:e.color||"#333"}),type:"fill",items:n.map(([e,t])=>({label:e,color:t})),label:""}],{selectPoints:s,clear:l}=mf({name:o,fields:[r],clientId:Nf}),{selectPoints:c,clear:u}=mf({name:o,fields:[r],clientId:Ff}),d=cf(e=>e.selections.get(o)),{isolatedCategories:h,highlightedCategory:p}=Jp(()=>{const e=new Set;let t=null;const o=d?.clauses.get(Nf)?.fields[r];if("point"===o?.type)for(const t of o.values)e.add(t+"");const n=d?.clauses.get(Ff)?.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=of(e=>{"highlight"===t&&(e?c({[r]:[e.label]}):u())},[t,r,c,u]),m=of(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():s({[r]:Array.from(o)})},[t,r,h,i.length,s,l]),[g,[y]]=Is([0,0],!0,!1),b=Jp(()=>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:Af("div",{ref:g,style:{width:"100%",display:"block"},children:Af("svg",{width:"100%",height:Math.max(30,22*b+8),style:{display:"block",overflow:"visible"},children:Af(Kr,{legendGroups:a,title:!1,orientation:"horizontal",width:y,height:20,customHoverBehavior:"highlight"===t?f:void 0,customClickBehavior:"isolate"===t?m:void 0,highlightedCategory:p,isolatedCategories:h})})})}function Bf({children:e,selections:t,showLegend:o,legendPosition:r="top",legendInteraction:n="none",legendSelectionName:i="legend",legendField:a="category"}){const s=Jp(()=>{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=Vp(),[c,u]=tf({}),d=ef({}),h=Jp(()=>({registerCategories:(e,t)=>{const o=If(t);u(t=>$f(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=Jp(()=>{const e=[];for(const t of Object.values(c))for(const o of t)e.push(o);return If(e)},[c]),f=Jp(()=>{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]=Ne[o%Ne.length],o++);const r={...e};for(const o of p)r[o]=e[o]??t[o];return r},[l,p]),m=void 0===o||o,g=Object.keys(f).length>0;return Af(lf,{initialState:s,children:Af(uf,{children:Af(Pf.Provider,{value:!0,children:Af(Lf.Provider,{value:h,children:Af(qp,{colors:f,children:Cf(Mf.Provider,{value:m&&g,children:[m&&"top"===r&&Af(Df,{categoryColors:f,interaction:n,selectionName:i,field:a}),e,m&&"bottom"===r&&Af(Df,{categoryColors:f,interaction:n,selectionName:i,field:a})]})})})})})})}function Ef({data:e,colorBy:t,colorScale:o,getColor:r,strokeColor:n,strokeWidth:i,categories:a}){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:(a&&a.length>0?a:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((n,i)=>{const a=e.find("function"==typeof t?e=>t(e)===n:e=>e[t]===n),s=a?r(a,t,o):o?o(n):Fe[i%Fe.length];return{label:n+"",color:s}}),label:""}]}}function zf(e){return e?"string"==typeof e?{name:e}:e:null}function Hf(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??.5;i.opacity=e,i.fillOpacity=e,i.strokeOpacity=e,o?.unselectedStyle&&Object.assign(i,o.unselectedStyle)}return i}:e}import*as Of from"react";function Wf(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 jf(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 Yf=["#6929c4","#1192e8","#005d5d","#9f1853","#fa4d56","#570408","#198038","#002d9c","#ee538b","#b28600","#009d9a","#012749","#8a3800","#a56eff"],Gf={danger:"#da1e28",warning:"#f1c21b",success:"#24a148",info:"#0043ce"},qf={light:G,dark:q,"high-contrast":V,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 Vf(e){return qf[e]}import{jsx as Xf,jsxs as Uf}from"react/jsx-runtime";var Kf=Of.createContext(void 0),Qf="undefined"==typeof window?Of.useEffect:Of.useLayoutEffect;function Zf(e){if("string"!=typeof e)return e;if("light"===e||"dark"===e||"high-contrast"===e)return e;return Vf(e)||(void 0!==console&&console.warn(`[ThemeProvider] Unknown theme preset "${e}". Falling back to light theme.`),"light")}function Jf({theme:e}){const t=K(e=>e.setTheme),o=K(e=>e.theme),r=Of.useRef(o);r.current=o;const n=Of.useRef(null);Of.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===V?G:r.current,t("high-contrast")),Ps(o,e=>{e.matches?(n.current=r.current===V?n.current??G:r.current,t("high-contrast")):(function(e,t){e(t===G?"light":t===q?"dark":t===V?"high-contrast":t)}(t,n.current??G),n.current=null)})},[e,t]);const i=Of.useRef(!1);return Qf(()=>{i.current?void 0!==e&&t(Zf(e)):i.current=!0},[e,t]),null}function em({children:e}){const t=K(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=Of.useContext(Kf),n={};return r&&(n["data-semiotic-theme"]=r),Xf("div",{style:o,...n,children:e})}function tm({theme:e,children:t}){const o="string"==typeof e&&Vf(e)?e:void 0,r=Of.useMemo(()=>function(e){return void 0!==e?X(G,Zf(e)):"undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(forced-colors: active)").matches?V:G}(e),[e]);return Xf(U,{initialState:{theme:r},children:Uf(Kf.Provider,{value:o,children:[Xf(Jf,{theme:e}),Xf(em,{children:t})]})})}function om(){return K(e=>e.theme)}function rm(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function nm(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),a=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&&a!==o.orientation)}function im(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=>nm(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"])rm(e[r])&&rm(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 am="#007bff";function sm(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 lm(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 cm(e){if(!e)return!1;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}var um={enabled:!0,tapToSelect:!0,tapToLockTooltip:!0,clearSelection:"backgroundTap",targetSize:44,snap:"nearestDatum",brushHandleSize:44,standardControls:!1,enabled:!1,tapToSelect:!1,tapToLockTooltip:!1};function dm(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,a=e&&"object"==typeof e?e:void 0;if(!1===e||!1===a?.enabled||void 0===e&&!n&&!i)return um;const s=a??{};return{enabled:!0,tapToSelect:s.tapToSelect??!0,tapToLockTooltip:s.tapToLockTooltip??!0,clearSelection:s.clearSelection??"backgroundTap",targetSize:s.targetSize??r??44,snap:s.snap??"nearestDatum",brushHandleSize:s.brushHandleSize??44,standardControls:s.standardControls??!1}}function hm(){const e=om(),t=e?.colors?.categorical;return t&&t.length>0?t:void 0}function pm(e,t,o,r,n){if(e)return e;if(o&&"object"==typeof o&&!Array.isArray(o)){const e=ze(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=Te[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]:am}function fm(e,t,o){const r=Vp(),n=hm();return Fp(()=>{if(!t)return;const i=r??void 0,a=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&&cm(i)){const e=He(o.map(e=>({_cat:e})),"_cat",a);return t=>i[t]||e(t)}return He(o.map(e=>({_cat:e})),"_cat",a)}if(i&&cm(i)){const o=He(e,t,a);return e=>i[e]||o(e)}return He(e,t,a)}if(i&&cm(i)){const e=He([{_:"a"}],"_",a);return t=>i[t]||e(t)}},[e,t,o,r,n])}function mm(e,t,o){return Fp(()=>{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 gm({selection:e,linkedHover:t,fallbackFields:o=[],unwrapData:r=!1,onObservation:n,chartType:i,chartId:a,onClick:s,hoverHighlight:l,colorByField:c,mobileInteraction:u}){const d=Ep(),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=mf({name:e?.name||"__unused__",fields:p}),m=yf({name:h?.name||"hover",fields:p}),g=df(e=>e.pushObservation),y=e?{isActive:f.isActive,predicate:f.predicate}:null,[b,v]=Bp(null),x=Hp(!1),w=c||o[0],k=Fp(()=>{if(!l||null==b||!w)return null;const e=b,t=w;return{isActive:!0,predicate:o=>("string"==typeof o[t]?o[t]:(o[t]??"")+"")===e}},[l,b,w]),S=Dp(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=sm(e,t,h.xField);null!=o&&function(e,t,o){const r=pi.positions.get(e);r?.locked||r&&r.xValue===t&&r.sourceId===o||(pi={positions:new Map(pi.positions).set(e,{xValue:t,sourceId:o})},mi())}(h.name||"hover",o,d)}"x-position"!==h?.mode&&m.onHover(t)}else"x-position"!==h?.mode||o||gi(h.name||"hover",d),"x-position"===h?.mode||o||m.onHover(null);if(l&&w)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const o=t?.[w];v(null!=o?o+"":null)}else o||v(null);if(n||g){const t={timestamp:Date.now(),chartType:i||"unknown",chartId:a};if(e){const o=lm(e),r={...t,type:"hover",datum:o||{},x:e.x??0,y:e.y??0};n&&n(r),g&&g(r)}else{const e={...t,type:"hover-end"};n&&n(e),g&&g(e)}}},[t,m,h,d,n,i,a,g,l,w,u]),A=Dp((o=!0)=>{x.current=!1,t&&"x-position"!==h?.mode&&m.onHover(null),e&&u?.tapToSelect&&f.clear(),o&&l&&v(null),"x-position"===h?.mode&&(yi(h.name||"hover",d),gi(h.name||"hover",d))},[t,h,m,e,u,f,l,d]),C=Dp(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=sm(o,e,h.xField);null!=t&&function(e,t,o){const r=pi.positions.get(e);if(r?.locked){const t=new Map(pi.positions);return t.delete(e),pi={positions:t},mi(),!1}pi={positions:new Map(pi.positions).set(e,{xValue:t,sourceId:o,locked:!0})},mi()}(h.name||"hover",t,d)}if(r)if(o){x.current=!0;const r=lm(o);if(t&&"x-position"!==h?.mode&&m.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])}cm(e)&&f.selectPoints(e)}if(l&&w){const e=r?.[w];v(null!=e?e+"":null)}}else c&&A();if(o||c){if(o&&s){let e=o.data||o.datum||o;Array.isArray(e)&&(e=e[0]),s(e,{x:o.x??0,y:o.y??0})}if(n||g){const e={timestamp:Date.now(),chartType:i||"unknown",chartId:a};if(o){const t=lm(o),r={...e,type:"click",datum:t||{},x:o.x??0,y:o.y??0};n&&n(r),g&&g(r)}else{const t={...e,type:"click-end"};n&&n(t),g&&g(t)}}}},[s,n,g,i,a,h,d,u,t,m,e,f,p,l,w,A]);return zp(()=>{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]),zp(()=>()=>{x.current&&A(!1)},[A]),zp(()=>{if("x-position"!==h?.mode)return;const e=h.name||"hover";return()=>{yi(e,d),gi(e,d)}},[h?.mode,h?.name,d]),{activeSelectionHook:y,hoverSelectionHook:k,customHoverBehavior:S,customClickBehavior:C,crosshairSourceId:d}}function ym(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 bm({data:e,colorBy:t,colorScale:o,showLegend:r,legendPosition:n="right",userMargin:i,defaults:a={top:50,bottom:60,left:70,right:40},categories:s}){const l=Up(Mf),c=null!==Up(Lf),u=void 0!==r?r:!l&&!!t,d=!!t&&(u||c),h=Fp(()=>{if(!d)return[];if(void 0!==s)return s;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)},[s,t,e,d]);Tf(c&&t?h:[]);const p=Fp(()=>{if(!u||!t)return;const r=Ef({data:e,colorBy:t,colorScale:o,getColor:Ee,categories:h});return 0!==r.legendGroups.reduce((e,t)=>e+t.items.length,0)?r:void 0},[u,t,e,o,h]),f=Fp(()=>{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:a[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},[a,i,p,n]);return{legend:p,margin:f,legendPosition:n}}function vm(e,t,o){const[r,n]=Bp(null),[i,a]=Bp(new Set),s=Fp(()=>new Set,[]),l=Dp(t=>{"highlight"===e&&n(t?t.label:null)},[e]),c=Dp(t=>{"isolate"===e&&a(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=Fp(()=>{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:s,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}var xm={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 wm(e,t,o){const r=xm[e||"primary"],n=e&&"primary"!==e||!o?.width?r.width:o.width,i=e&&"primary"!==e||!o?.height?r.height:o.height,a=im({...t,mode:e},{width:t.width??n,height:t.height??i}).props,s=a.mode||e,l=xm[s||"primary"],c="context"===s||"sparkline"===s,u=s&&"primary"!==s||!o?.width?l.width:o.width;return{width:a.width??u,height:a.height??(s&&"primary"!==s||!o?.height?l.height:o.height),showAxes:a.showAxes??l.showAxes,showGrid:a.showGrid??l.showGrid,enableHover:a.enableHover??(!!a.linkedHover||l.enableHover),showLegend:a.showLegend??l.showLegend,showLabels:a.showLabels??l.showLabels,title:c?void 0:a.title,description:a.description,summary:a.summary,accessibleTable:a.accessibleTable,xLabel:c?void 0:a.xLabel,yLabel:c?void 0:a.yLabel,categoryLabel:c?void 0:a.categoryLabel,valueLabel:c?void 0:a.valueLabel,marginDefaults:km(l.marginDefaults,a.showCategoryTicks,a.orientation),compactMode:c,mobileInteraction:dm(a.mobileInteraction,{mode:s,width:a.width??u,mobileSemantics:a.mobileSemantics}),mobileSemantics:a.mobileSemantics}}function km(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 Sm(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 a=1;r>=a;a++){const r=n[a];n[a]=e[i-1]===t[a-1]?o:1+Math.min(o,n[a],n[a-1]),o=r}}return n[r]}function Am(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function Cm(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=Sm(e.toLowerCase(),o.toLowerCase());n>t&&(n=t,r=o)}return n>o?void 0:r}(e,t,3)??null)}function Mm({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=Am(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=Cm(i,t),r=o?` Try ${n}="${o}".`:"";return`${e}: ${n} "${i}" not found in data. Available fields: ${t.join(", ")}.${r}`}}}return null}function Pm({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 _m({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=Am(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=Cm(n,t),i=o?` Try ${r}="${o}".`:"";return`${e}: ${r} "${n}" not found in node data. Available fields: ${t.join(", ")}.${i}`}}}return null}import{useCallback as Lm,useMemo as Rm,useState as Im}from"react";import{useMemo as $m}from"react";function Tm(e){const t=K(e=>e.theme.colors.selectionOpacity);return $m(()=>{if(void 0!==e||void 0!==t)return{name:e?.name??"",...e,unselectedOpacity:e?.unselectedOpacity??t}},[e,t])}function Nm(e){const{data:t,rawData:o,colorBy:r,colorScheme:n,legendInteraction:i,legendPosition:a,selection:s,linkedHover:l,fallbackFields:c,unwrapData:u=!1,onObservation:d,chartType:h,chartId:p,showLegend:f,userMargin:m,marginDefaults:g,onClick:y,hoverHighlight:b,mobileInteraction:v,mobileSemantics:x,loading:w,loadingContent:k,emptyContent:S,width:A,height:C}=e,M=void 0===o,P=Rm(()=>I(t),[t]),[_,L]=Im([]),R=Lm(e=>{L(t=>t.length===e.length&&t.every((t,o)=>t===e[o])?t:e)},[]),$="string"==typeof e.colorBy?e.colorBy:void 0,T=Rm(()=>dm(v,{width:A,mobileSemantics:x}),[v,A,x]),{activeSelectionHook:N,hoverSelectionHook:F,customHoverBehavior:D,customClickBehavior:B,crosshairSourceId:E}=gm({selection:s,linkedHover:l,fallbackFields:c,unwrapData:u,onObservation:d,chartType:h,chartId:p,onClick:y,hoverHighlight:b,colorByField:$,mobileInteraction:T}),z=ym(l,E),H=fm(P,r,n),O=Rm(()=>{if(!r)return[];const e=new Set;for(const t of P){const o="function"==typeof r?r(t):t[r];null!=o&&e.add(o+"")}return Array.from(e)},[P,r]),W=Rm(()=>M&&_.length>0?_:O,[M,_,O]),j=vm(i,r,W),Y=Rm(()=>F||(j.legendSelectionHook?j.legendSelectionHook:N),[F,j.legendSelectionHook,N]),G=Tm(s),q=hm(),V=Vp(),X=Rm(()=>{if(H)return H;if(!r||0===W.length)return;const e=Array.isArray(n)&&n.length>0||"string"==typeof n&&n.length>0?n:q&&q.length>0?q:Fe,t="__streamCat",o=He(W.map(e=>({[t]:e})),t,e);return e=>V?.[e]||o(e)||"#999"},[H,r,W,n,q,V]),{legend:U,margin:K,legendPosition:Q}=bm({data:P,colorBy:r,colorScale:X,showLegend:f,legendPosition:a,userMargin:m,defaults:g,categories:W}),Z=Rm(()=>{const e={};return U&&(e.legend=U,e.legendPosition=Q),i&&"none"!==i&&(e.legendHoverBehavior=j.onLegendHover,e.legendClickBehavior=j.onLegendClick,e.legendHighlightedCategory=j.highlightedCategory,e.legendIsolatedCategories=j.isolatedCategories),M&&r&&(e.legendCategoryAccessor=r,e.onCategoriesChange=R),e},[U,Q,i,j.onLegendHover,j.onLegendClick,j.highlightedCategory,j.isolatedCategories,M,r,R]),J=Array.isArray(o)?I(o):o,ee=qh(w,A,C,k),te=ee?null:Gh(J,A,C,S);return{data:P,colorScale:H,allCategories:W,legendState:j,effectiveSelectionHook:Y,activeSelectionHook:N,customHoverBehavior:D,customClickBehavior:B,mobileInteraction:T,legend:U,margin:K,legendPosition:Q,earlyReturn:ee||te||null,legendBehaviorProps:Z,crosshairProps:z,resolvedSelection:G}}import{useImperativeHandle as Fm}from"react";function Dm(e,t){const{variant:o,frameRef:r,overrides:n,deps:i}=t;Fm(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??[])}import{useMemo as Bm}from"react";function Em(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 zm(e){const{colorBy:t,colorScale:o,color:r,pointRadius:n=5,radiusFn:i,fillOpacity:a=1,fallbackFill:s,baseStyleExtras:l,stroke:c,strokeWidth:u,opacity:d,effectiveSelectionHook:h,resolvedSelection:p,colorDatumAccessor:f}=e,m=Bm(()=>e=>{const c="function"==typeof l?l(e):l,u=c?{...c}:{};if(void 0===u.fillOpacity&&(u.fillOpacity=a),void 0===u.fill)if(t){if(o){const r=f?f(e):e;u.fill=Ee(r,t,o)}}else u.fill=s?s(e):r||am;return void 0===u.r&&(u.r=i?i(e):n),u},[t,o,r,n,i,a,s,l,f]),g=Bm(()=>Em(m,{stroke:c,strokeWidth:u,opacity:d}),[m,c,u,d]);return Bm(()=>Hf(g,h??null,p),[g,h,p])}import{useCallback as Hm,useMemo as Om,useRef as Wm,useState as jm}from"react";function Ym(e){const{accessor:t,data:o,isPushMode:r}=e,n=Wm(null),[i,a]=jm(0),s=Hm(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&&a(e=>e+1)},[r,t]),l=Hm(()=>{r&&(n.current=null,a(e=>e+1))},[r]);return{domain:Om(()=>{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,a=-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>a&&(a=r))}return Number.isFinite(i)&&Number.isFinite(a)?[i,a]:void 0},[o,t,r,i]),trackPushed:s,reset:l}}function Gm(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}}}import{useEffect as qm,useMemo as Vm,useRef as Xm,useState as Um}from"react";var Km="__forecastSegment",Qm=null;async function Zm(){return Qm||(Qm=await import("./semiotic-statisticalOverlays-UOMSFKVJ.module.min.js")),Qm}var Jm="__semiotic_resolvedX",eg="__semiotic_resolvedY";function tg(e){const{data:t,xAccessor:o,yAccessor:r,forecast:n,anomaly:i,groupBy:a}=e,s="string"==typeof o?o:Jm,l="string"==typeof r?r:eg,c=Vm(()=>{if(!n&&!i)return t;const e="function"==typeof o,a="function"==typeof r;return e||a?t.map(t=>{const n={...t};return e&&(n[Jm]=o(t)),a&&(n[eg]=r(t)),n}):t},[t,n,i,o,r]),[u,d]=Um(null),[h,p]=Um([]),f=Xm(n),m=Xm(i);return qm(()=>{if(!n&&!i)return void((f.current||m.current)&&(d(null),p([]),f.current=n,m.current=i));let e=!1;const t=n!==f.current||i!==m.current;if(f.current=n,m.current=i,t&&(d(null),p([])),n){const t=a&&"string"==typeof a&&"object"==typeof n?{...n,_groupBy:a}:n;(async function(...e){return(await Zm()).buildForecast(...e)})(c,s,l,t,i).then(t=>{e||(d(t),p(t.annotations))}).catch(()=>{e||(d(null),p([]))})}else i&&async function(...e){return(await Zm()).buildAnomalyAnnotations(...e)}(i).then(t=>{e||(d(null),p(t))}).catch(()=>{e||p([])});return()=>{e=!0}},[c,n,i,s,l,a]),{effectiveData:u?u.processedData:t,statisticalAnnotations:h,hasForecast:!!u,xAccessorKey:s,yAccessorKey:l}}import{jsx as og}from"react/jsx-runtime";var rg=Tp(function(e,t){const o=Np(null),r=wm(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:a,xFormat:s,yFormat:l,xAccessor:c="x",yAccessor:u="y",xScaleType:d,yScaleType:h,colorBy:p,colorScheme:f,sizeBy:m,sizeRange:g=[3,15],symbolBy:y,symbolMap:b,pointRadius:v=5,pointOpacity:x=.8,tooltip:w,marginalGraphics:k,pointIdAccessor:S,annotations:A,regression:C,forecast:M,anomaly:P,xExtent:_,yExtent:L,frameProps:R={},selection:$,linkedHover:T,linkedBrush:N,onObservation:F,onClick:D,hoverHighlight:B,chartId:E,loading:z,loadingContent:H,emptyContent:O,legendInteraction:W,legendPosition:j,color:Y,stroke:G,strokeWidth:q,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=Ip(()=>I(n),[n]),ae=void 0===n,{domain:se,trackPushed:le,reset:ce}=Ym({accessor:m,data:ie,isPushMode:ae}),ue=$p(e=>{le([e]),o.current?.push(e)},[le]),de=$p(e=>{le(e),o.current?.pushMany(e)},[le]);Dm(t,{variant:"xy",frameRef:o,overrides:{push:ue,pushMany:de,clear:()=>{ce(),o.current?.clear()}},deps:[ue,de,ce]});const he=Nm({data:ie,rawData:n,colorBy:p,colorScheme:f,legendInteraction:W,legendPosition:j,selection:$,linkedHover:T,fallbackFields:p?["string"==typeof p?p:""]:[],unwrapData:!1,onObservation:F,onClick:D,hoverHighlight:B,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"Scatterplot",chartId:E,showLegend:Z,userMargin:i,marginDefaults:r.marginDefaults,loading:z,loadingContent:H,emptyContent:O,width:X,height:U}),pe=zf(N),fe=vf({name:pe?.name||"__unused_brush__",xField:pe?.xField||("string"==typeof c?c:void 0),yField:pe?.yField||("string"==typeof u?u:void 0)}),me=pe?"xyBrush"===fe.brushInteraction.brush?"xy":"xBrush"===fe.brushInteraction.brush?"x":"y":void 0,ge=Rp.useRef(fe.brushInteraction);ge.current=fe.brushInteraction;const ye=$p(e=>{const t=ge.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)},[]);Vh("Scatterplot",ie,"xAccessor",c),Vh("Scatterplot",ie,"yAccessor",u);const be=Ip(()=>m?se??[0,1]:void 0,[m,se]),ve=Ip(()=>m?e=>Oe(e,m,g,be):void 0,[m,g,be]),xe=zm({colorBy:p,colorScale:he.colorScale,color:Y,pointRadius:v,fillOpacity:x,radiusFn:ve,stroke:G,strokeWidth:q,opacity:V,effectiveSelectionHook:he.effectiveSelectionHook,resolvedSelection:he.resolvedSelection}),we=Ip(()=>_l([{label:re||Sl(c),accessor:c,role:"x",format:s},{label:ne||Sl(u),accessor:u,role:"y",format:l},...p?[{label:Sl(p),accessor:p,role:"color"}]:[],...m?[{label:Sl(m),accessor:m,role:"size"}]:[]]),[c,u,re,ne,p,m,s,l]),{effectiveData:ke,statisticalAnnotations:Se}=tg({data:ie,xAccessor:c,yAccessor:u,forecast:M,anomaly:P}),Ae=Ip(()=>{const e=Gm(C);return e||0!==Se.length?[...e?[e]:[],...A||[],...Se]:A},[C,A,Se]);if(he.earlyReturn)return he.earlyReturn;const Ce=Mm({componentName:"Scatterplot",data:n,accessors:{xAccessor:c,yAccessor:u}});if(Ce)return og(Bh,{componentName:"Scatterplot",message:Ce,width:X,height:U});const Me={chartType:"scatter",...null!=n&&{data:ke},xAccessor:c,yAccessor:u,xScaleType:d,yScaleType:h,colorAccessor:p||void 0,sizeAccessor:m||void 0,...y&&{symbolAccessor:y},...b&&{symbolMap:b},sizeRange:g,pointStyle:xe,colorScheme:f,size:[X,U],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:he.margin,showAxes:r.showAxes,xLabel:re,yLabel:ne,xFormat:s,yFormat:l,enableHover:K,showGrid:Q,...he.legendBehaviorProps,...Pp({title:J,description:ee,summary:te,accessibleTable:oe,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Lp({tooltip:w,defaultTooltipContent:we}),..._p({linkedHover:T,selection:$,onObservation:F,onClick:D,hoverHighlight:B,mobileInteraction:he.mobileInteraction,customHoverBehavior:he.customHoverBehavior,customClickBehavior:he.customClickBehavior}),...k&&{marginalGraphics:k},...S&&{pointIdAccessor:S},...Ae&&Ae.length>0&&{annotations:Ae},..._&&{xExtent:_},...L&&{yExtent:L},...pe&&{brush:{dimension:me},onBrush:ye},...he.crosshairProps,...R};return og(Wh,{componentName:"Scatterplot",width:X,height:U,children:og(Hl,{ref:o,...Me})})});rg.displayName="Scatterplot";import{useMemo as ng,forwardRef as ig,useRef as ag}from"react";import{Fragment as sg,jsx as lg}from"react/jsx-runtime";function cg(e,t){return be(1===t?.5:e/(t-1))}var ug=ig(function(e,t){const o=ag(null);Dm(t,{variant:"xy",frameRef:o});const r=wm(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:a,xFormat:s,yFormat:l,xAccessor:c="x",yAccessor:u="y",orderAccessor:d,orderLabel:h,pointRadius:p=4,tooltip:f,pointIdAccessor:m,annotations:g,regression:y,forecast:b,anomaly:v,xExtent:x,yExtent:w,frameProps:k={},selection:S,linkedHover:A,onObservation:C,onClick:M,hoverHighlight:P,chartId:_,loading:L,loadingContent:R,emptyContent:I,legendInteraction:$,stroke:T,strokeWidth:N,opacity:F}=e,{width:D,height:B,enableHover:E,showGrid:z,title:H,description:O,summary:W,accessibleTable:j,xLabel:Y,yLabel:G}=r,q=n||[],{safeData:V,orderMap:X}=ng(()=>{const e="function"==typeof c?c:e=>e[c],t="function"==typeof u?u:e=>e[u];let o=q;if(d&&q.length>0){const e="function"==typeof d?d:e=>e[d];o=[...q].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 a of o){const o=e(a),s=t(a);null!=o&&null!=s&&isFinite(o)&&isFinite(s)&&r.set(a,{idx:i++,total:n})}return{safeData:o,orderMap:r}},[q,d,c,u]);Vh("ConnectedScatterplot",V,"xAccessor",c),Vh("ConnectedScatterplot",V,"yAccessor",u);const U=Nm({data:V,rawData:n,colorBy:void 0,colorScheme:void 0,legendInteraction:$,selection:S,linkedHover:A,fallbackFields:[],unwrapData:!1,onObservation:C,onClick:M,hoverHighlight:P,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"ConnectedScatterplot",chartId:_,showLegend:void 0,userMargin:i,marginDefaults:{top:50,right:40,bottom:60,left:70},loading:L,loadingContent:R,emptyContent:I,width:D,height:B}),K=U.resolvedSelection?.unselectedOpacity??.5,Q=ng(()=>(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,a=o.length;e.lineCap="round";for(let t=0;a-1>t;t++){const s=o[t],l=o[t+1],c=cg(t,a),u=!r||!n||n(s.datum??s)||n(l.datum??l),d=r?u?1:K:1;i&&(e.beginPath(),e.moveTo(s.x,s.y),e.lineTo(l.x,l.y),e.strokeStyle="white",e.lineWidth=p+2,e.globalAlpha=.5*d,e.stroke()),e.beginPath(),e.moveTo(s.x,s.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=ng(()=>[Q],[Q]),J=ng(()=>(e,t,o)=>{const r=e.filter(e=>"point"===e.type);if(2>r.length)return null;const n=r.length,i=100>n,a=[];for(let e=0;n-1>e;e++){const t=r[e],o=r[e+1],s=cg(e,n),l=Math.min("number"==typeof t.style?.opacity?t.style.opacity:1,"number"==typeof o.style?.opacity?o.style.opacity:1);i&&a.push(lg("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)),a.push(lg("line",{x1:t.x,y1:t.y,x2:o.x,y2:o.y,stroke:s,strokeWidth:p,strokeLinecap:"round",opacity:l},"seg-"+e))}return lg(sg,{children:a})},[p]),ee=ng(()=>[J],[J]),te=zm({colorScale:void 0,baseStyleExtras:ng(()=>e=>{const t=X.get(e),o=t?.idx??0,r=t?.total??1;return{fill:r>0?cg(o,r):"#6366f1",stroke:"white",strokeWidth:1,r:p,fillOpacity:1}},[p,X]),stroke:T,strokeWidth:N,opacity:F,effectiveSelectionHook:U.effectiveSelectionHook,resolvedSelection:U.resolvedSelection}),oe=h||("string"==typeof d?d:"Order"),re=ng(()=>_l([{label:Y||Sl(c),accessor:c,role:"x",format:s},{label:G||Sl(u),accessor:u,role:"y",format:l},...d?[{label:oe,accessor:d,role:"group"}]:[]]),[c,u,Y,G,d,oe,s,l]),ne=Mm({componentName:"ConnectedScatterplot",data:n,accessors:{xAccessor:c,yAccessor:u}}),{effectiveData:ie,statisticalAnnotations:ae}=tg({data:V,xAccessor:c,yAccessor:u,forecast:b,anomaly:v});if(U.earlyReturn)return U.earlyReturn;const se=Gm(y),le=se||ae.length>0?[...se?[se]:[],...g||[],...ae]:g,ce={chartType:"scatter",...null!=n&&{data:ie},xAccessor:c,yAccessor:u,pointStyle:te,size:[D,B],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:U.margin,showAxes:r.showAxes,xLabel:Y,yLabel:G,xFormat:s,yFormat:l,enableHover:E,showGrid:z,...Pp({title:H,description:O,summary:W,accessibleTable:j,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Lp({tooltip:f,defaultTooltipContent:re}),..._p({linkedHover:A,selection:S,onObservation:C,onClick:M,hoverHighlight:P,mobileInteraction:U.mobileInteraction,customHoverBehavior:U.customHoverBehavior,customClickBehavior:U.customClickBehavior}),...m&&{pointIdAccessor:m},canvasPreRenderers:Z,svgPreRenderers:ee,...le&&le.length>0&&{annotations:le},...x&&{xExtent:x},...w&&{yExtent:w},...U.crosshairProps,...k};return ne?lg(Bh,{componentName:"ConnectedScatterplot",message:ne,width:D,height:B}):lg(Wh,{componentName:"ConnectedScatterplot",width:D,height:B,children:lg(Hl,{ref:o,...ce})})});ug.displayName="ConnectedScatterplot";import{useMemo as dg,useCallback as hg,useState as pg,useEffect as fg,forwardRef as mg,useRef as gg}from"react";import{useMemo as yg}from"react";function bg(e){const{lineWidth:t=2,colorBy:o,colorScale:r,color:n,resolveStroke:i,fillArea:a,areaOpacity:s=.3,stroke:l,strokeWidth:c,opacity:u,effectiveSelectionHook:d,resolvedSelection:h}=e,p=yg(()=>(e,l)=>{const c={strokeWidth:t},u=!0===a||Array.isArray(a)&&null!=l&&a.includes(l);let d;return i?d=i(e,l):o?r&&(d=Ee(e,o,r)):d=n||am,void 0!==d&&(c.stroke=d,u&&(c.fill=d,c.fillOpacity=s)),c},[t,o,r,n,i,a,s]),f=yg(()=>Em(p,{stroke:l,strokeWidth:c,opacity:u}),[p,l,c,u]);return yg(()=>Hf(f,d??null,h),[f,d,h])}import{jsx as vg}from"react/jsx-runtime";var xg="__lineObjectSeries",wg=mg(function(e,t){const o=gg(null);Dm(t,{variant:"xy",frameRef:o});const r=wm(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:a,xFormat:s,yFormat:l,axisExtent:c,xAccessor:u="x",yAccessor:d="y",lineBy:h,lineDataAccessor:p="coordinates",colorBy:f,colorScheme:m,curve:g="linear",showPoints:y=!1,pointRadius:b=3,fillArea:v=!1,areaOpacity:x=.3,lineWidth:w=2,lineGradient:k,tooltip:S,pointIdAccessor:A,annotations:C,directLabel:M,gapStrategy:P="break",anomaly:_,forecast:L,band:R,xExtent:$,yExtent:T,frameProps:N={},selection:F,linkedHover:D,onObservation:B,onClick:E,hoverHighlight:z,hoverRadius:H,chartId:O,loading:W,loadingContent:j,emptyContent:Y,legendInteraction:G,legendPosition:q,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:ae,accessibleTable:se,xLabel:le,yLabel:ce}=r,ue=dg(()=>I(n),[n]),de=Array.isArray(ue[0]?.[p])?ue[0][p]:ue;Vh("LineChart",de,"xAccessor",u),Vh("LineChart",de,"yAccessor",d);const{effectiveData:he,statisticalAnnotations:pe}=tg({data:ue,xAccessor:u,yAccessor:d,forecast:L,anomaly:_,groupBy:h}),fe="__compoundGroup",me=!(!L||!h),ge=me?fe:L?Km:h,ye=dg(()=>{if(!me)return he;const e="function"==typeof h?h:e=>e[h];return he.map(t=>{const o={...t};return o[fe]=`${e(t)}__${t[Km]||"observed"}`,o})},[he,me,h]),be=me?ye:he,ve=f||h,xe=dg(()=>{if(!L)return;const e=L.upperBounds,t=L.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 a=he;for(const e of a){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},[L,he,d]),we=hg(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]),ke=void 0!==be[0]?.[p],Se=ke?xg:ge,Ae=dg(()=>{if(ke)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,[xg]:r,[p]:n.map(t=>({...t,[xg]:r,parentLine:e,..."string"==typeof h&&void 0!==e[h]?{[h]:e[h]}:{}}))}});if(ge){const e=be.reduce((e,t)=>{const o="function"==typeof ge?ge(t):t[ge];if(!e[o]){const r={[p]:[]};"string"==typeof ge&&(r[ge]=o),me&&(r[Km]=t[Km],"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,ge,p,ke,h]),{gapProcessedLineData:Ce,hasGaps:Me}=dg(()=>{if("interpolate"===P){let e=!1;const t=[];for(const o of Ae){const r=(o[p]||[]).filter(t=>!we(t)||(e=!0,!1));r.length>0&&t.push({...o,[p]:r})}return{gapProcessedLineData:t,hasGaps:e}}if("break"===P){let e=!1;const t=[];for(const o of Ae){const r=o[p]||[];let n=[],i=0;const a=Se&&"string"==typeof Se?o[Se]:void 0;for(const s of r)if(we(s))e=!0,n.length>0&&(t.push({...o,[p]:n}),n=[],i++);else{const e=null!=a?`${a}__seg${i}`:"__seg"+i;n.push({...s,_gapSegment:e})}n.length>0&&t.push({...o,[p]:n})}return{gapProcessedLineData:t,hasGaps:e}}if("zero"===P){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)we(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,P,p,we,Se,d]),Pe="object"==typeof M?M:{},_e=Pe.position||"end",Le=Pe.fontSize||11,Re=dg(()=>{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"===_e?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,_e]),Ie=dg(()=>{if(!M)return r.marginDefaults;const e=Re.reduce((e,t)=>Math.max(e,t.length*(.6*Le)),0)+10,t="end"===_e?"right":"left";return{...r.marginDefaults,[t]:Math.max(r.marginDefaults[t]||0,e)}},[M,Re,Le,_e,r.marginDefaults]),$e=Nm({data:he,rawData:n,colorBy:ve,colorScheme:m,legendInteraction:G,legendPosition:q,selection:F,linkedHover:D,fallbackFields:ve?["string"==typeof ve?ve:""]:[],unwrapData:!1,onObservation:B,onClick:E,hoverHighlight:z,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"LineChart",chartId:O,showLegend:(!M||void 0!==re)&&re,userMargin:i,marginDefaults:Ie,loading:W,loadingContent:j,emptyContent:Y,width:J,height:ee}),Te=$e.colorScale,Ne=$e.effectiveSelectionHook,Fe=$e.resolvedSelection,De=$e.customHoverBehavior,Be=$e.customClickBehavior,ze=$e.crosshairProps,He=bg({lineWidth:w,colorBy:dg(()=>{if(ve)return ke?e=>{const t=e.parentLine||e;return"function"==typeof ve?ve(t):t[ve]}:ve},[ve,ke]),colorScale:Te,color:U,fillArea:v,areaOpacity:x,stroke:K,strokeWidth:Q,opacity:Z,effectiveSelectionHook:Ne,resolvedSelection:Fe}),[Oe,We]=pg(null);fg(()=>{if(!L)return void We(null);let e=!1;return async function(...e){return(await Zm()).createSegmentLineStyle(...e)}(He,L).then(t=>{e||We(()=>t)}).catch(()=>{e||We(null)}),()=>{e=!0}},[He,L]);const je=Oe||He,Ye=dg(()=>{if(y)return e=>{const t={r:b,fillOpacity:1};return ve?Te&&(t.fill=Ee(e.parentLine||e,ve,Te)):t.fill=U||am,t}},[y,b,ve,Te,U]),Ge=Array.isArray(v)?"mixed":v?"area":"line",qe=dg(()=>{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"===_e?t[t.length-1]:t[0],i=o(n)??o(e);if(null==i)continue;const a=i+"";""===a||r.has(a)||r.set(a,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"===_e?6:-6,dy:0,color:Te?Te(o):am,fontSize:Le}));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];Le+2>Math.abs(r[t]+r.dy-(o[t]+o.dy))&&(r.dy+=Le+2)}return n},[M,ve,Te,Ce,p,u,d,_e,Le]),Ve=$e.margin,Xe=h||f,Ue=dg(()=>_l([{label:le||Sl(u),accessor:u,role:"x",format:s},{label:ce||Sl(d),accessor:d,role:"y",format:l},...Xe?[{label:Sl(Xe),accessor:Xe,role:"group"}]:[],...Pl(R,l)]),[u,d,le,ce,Xe,s,l,R]),Ke=Mm({componentName:"LineChart",data:ke?he[0]?.[p]||[]:n,accessors:{xAccessor:u,yAccessor:d}}),Qe=dg(()=>ke||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,ke,Se,be,Me]),Ze={chartType:Ge,...Array.isArray(v)&&{areaGroups:v},...k&&{lineGradient:k},...null!=n&&{data:Qe},xAccessor:u,yAccessor:d,xScaleType:V,yScaleType:X,...$&&{xExtent:$},...!T||null==T[0]&&null==T[1]?xe?{yExtent:xe}:{}:{yExtent:T},groupAccessor:"break"===P&&Me?"_gapSegment":Se||void 0,...R&&{band:R},curve:g,lineStyle:je,...y&&{pointStyle:Ye},size:[J,ee],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Ve,showAxes:r.showAxes,xLabel:le,yLabel:ce,xFormat:s,yFormat:l,...void 0!==c&&{axisExtent:c},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},enableHover:te,showGrid:oe,...$e.legendBehaviorProps,...ne&&{title:ne},...ie&&{description:ie},...ae&&{summary:ae},...void 0!==se&&{accessibleTable:se},...a&&{className:a},...null!=e.animate&&{animate:e.animate},tooltipContent:!1===S?()=>null:"multi"===S?ms():gs(S)||Ue,..."multi"===S&&{tooltipMode:"multi"},..._p({linkedHover:D,selection:F,onObservation:B,onClick:E,hoverRadius:H,hoverHighlight:z,mobileInteraction:$e.mobileInteraction,customHoverBehavior:De,customClickBehavior:Be}),...A&&{pointIdAccessor:A},...(C?.length||pe.length||qe.length)&&{annotations:[...C||[],...pe,...qe]},...ze,...N};return $e.earlyReturn?$e.earlyReturn:Ke?vg(Bh,{componentName:"LineChart",message:Ke,width:J,height:ee}):vg(Wh,{componentName:"LineChart",width:J,height:ee,children:vg(Hl,{ref:o,...Ze})})});wg.displayName="LineChart";import{useMemo as kg,forwardRef as Sg,useRef as Ag}from"react";import{useMemo as Cg}from"react";function Mg(e){const{safeData:t,data:o,areaBy:r,lineDataAccessor:n,colorBy:i,colorScale:a,color:s,stroke:l,strokeWidth:c,opacity:u,effectiveSelectionHook:d,resolvedSelection:h,areaOpacity:p,showLine:f,lineWidth:m,showPoints:g,pointRadius:y,xAccessor:b,yAccessor:v,xLabel:x,yLabel:w,xFormat:k,yFormat:S,groupField:A}=e,C=void 0!==t[0]?.[n],M=Cg(()=>{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]),P=Cg(()=>e=>{const t={};if(i){if(a){const o=Ee(e,i,a);t.fill=o,f?(t.stroke=o,t.strokeWidth=m):t.stroke="none"}}else{const e=s||am;t.fill=e,f?(t.stroke=e,t.strokeWidth=m):t.stroke="none"}return t.fillOpacity=p,t},[i,a,s,p,f,m]),_=Cg(()=>Em(P,{stroke:l,strokeWidth:c,opacity:u}),[P,l,c,u]);return{flattenedData:M,lineStyle:Cg(()=>Hf(_,d??null,h),[_,d,h]),pointStyle:Cg(()=>{if(g)return e=>{const t={r:y,fillOpacity:1};return i?a&&(t.fill=Ee(e.parentLine||e,i,a)):t.fill=s||am,t}},[g,y,i,a,s]),defaultTooltipContent:Cg(()=>_l([{label:x||Sl(b),accessor:b,role:"x",format:k},{label:w||Sl(v),accessor:v,role:"y",format:S},...A?[{label:Sl(A),accessor:A,role:"group"}]:[],...Pl(e.band,S)]),[b,v,x,w,A,k,S,e.band])}}import{jsx as Pg}from"react/jsx-runtime";function _g(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 Lg=Sg(function(e,t){const o=Ag(null);Dm(t,{variant:"xy",frameRef:o});const r=wm(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:a,xFormat:s,yFormat:l,xAccessor:c="x",yAccessor:u="y",areaBy:d,y0Accessor:h,gradientFill:p=!1,semanticGradient:f,lineDataAccessor:m="coordinates",colorBy:g,colorScheme:y,curve:b="monotoneX",areaOpacity:v=.7,lineGradient:x,showLine:w=!0,lineWidth:k=2,showPoints:S=!1,pointRadius:A=3,tooltip:C,annotations:M,forecast:P,anomaly:_,band:L,xExtent:R,yExtent:$,frameProps:T={},selection:N,linkedHover:F,onObservation:D,onClick:B,hoverHighlight:E,chartId:z,loading:H,loadingContent:O,emptyContent:W,legendInteraction:j,legendPosition:Y,color:G,stroke:q,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,ae=kg(()=>I(n),[n]),se=g||d,le=kg(()=>{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:_g(e.color,e.opacity)})).sort((e,t)=>e.offset-t.offset))}:p;var e},[f,p]);Vh("AreaChart",ae,"xAccessor",c),Vh("AreaChart",ae,"yAccessor",u);const ce=Nm({data:ae,rawData:n,colorBy:se,colorScheme:y,legendInteraction:j,legendPosition:Y,selection:N,linkedHover:F,fallbackFields:se?["string"==typeof se?se:""]:[],unwrapData:!1,onObservation:D,onClick:B,hoverHighlight:E,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"AreaChart",chartId:z,showLegend:J,userMargin:i,marginDefaults:r.marginDefaults,loading:H,loadingContent:O,emptyContent:W,width:U,height:K}),{effectiveData:ue,statisticalAnnotations:de}=tg({data:ae,xAccessor:c,yAccessor:u,forecast:P,anomaly:_,groupBy:d}),{flattenedData:he,lineStyle:pe,pointStyle:fe,defaultTooltipContent:me}=Mg({safeData:ue,data:n,areaBy:d,lineDataAccessor:m,colorBy:se,colorScale:ce.colorScale,color:G,stroke:q,strokeWidth:V,opacity:X,effectiveSelectionHook:ce.effectiveSelectionHook,resolvedSelection:ce.resolvedSelection,areaOpacity:v,showLine:w,lineWidth:k,showPoints:S,pointRadius:A,xAccessor:c,yAccessor:u,xLabel:ne,yLabel:ie,xFormat:s,yFormat:l,groupField:d||g,band:L}),ge=Mm({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},...L&&{band:L},...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:s,yFormat:l,enableHover:Q,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:Z,...ce.legendBehaviorProps,...Pp({title:ee,description:te,summary:oe,accessibleTable:re,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),..."multi"===C?{tooltipContent:ms(),tooltipMode:"multi"}:Lp({tooltip:C,defaultTooltipContent:me}),..._p({linkedHover:F,selection:N,onObservation:D,onClick:B,hoverHighlight:E,mobileInteraction:ce.mobileInteraction,customHoverBehavior:ce.customHoverBehavior,customClickBehavior:ce.customClickBehavior}),...(M&&M.length>0||de.length>0)&&{annotations:[...M||[],...de]},...R&&{xExtent:R},...$&&{yExtent:$},...ce.crosshairProps,...T};return ce.earlyReturn?ce.earlyReturn:ge?Pg(Bh,{componentName:"AreaChart",message:ge,width:U,height:K}):Pg(Wh,{componentName:"AreaChart",width:U,height:K,children:Pg(Hl,{ref:o,...ye})})});Lg.displayName="AreaChart";import{useMemo as Rg,forwardRef as Ig,useRef as $g,useState as Tg,useImperativeHandle as Ng,useCallback as Fg}from"react";import{jsx as Dg,jsxs as Bg}from"react/jsx-runtime";function Eg(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 zg=Ig(function(e,t){const o=$g(null),r=wm(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:a,xFormat:s,yFormat:l,xAccessor:c="x",seriesAAccessor:u="a",seriesBAccessor:d="b",seriesALabel:h="A",seriesBLabel:p="B",seriesAColor:f="var(--semiotic-danger, #dc2626)",seriesBColor:m="var(--semiotic-info, #2563eb)",showLines:g=!0,lineWidth:y=1.5,showPoints:b=!1,pointRadius:v=3,curve:x="linear",areaOpacity:w=.6,gradientFill:k,tooltip:S,annotations:A,xExtent:C,yExtent:M,frameProps:P={},selection:_,linkedHover:L,onObservation:R,onClick:$,hoverHighlight:T,chartId:N,loading:F,loadingContent:D,emptyContent:B,legendInteraction:E,legendPosition:z,pointIdAccessor:H,windowSize:O}=e,{width:W,height:j,enableHover:Y,showGrid:G,showLegend:q,title:V,description:X,summary:U,accessibleTable:K,xLabel:Q,yLabel:Z}=r,J=Rg(()=>"function"==typeof c?e=>Eg(c(e)):e=>Eg(e[c]),[c]),ee=Rg(()=>"function"==typeof u?e=>Eg(u(e)):e=>Eg(e[u]),[u]),te=Rg(()=>"function"==typeof d?e=>Eg(d(e)):e=>Eg(e[d]),[d]),[oe,re]=Tg([]),ne=$g([]),ie=null==n,ae=Rg(()=>I(ie?oe:n),[ie,oe,n]),se=Rg(()=>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 a=0,s=null,l=null,c=[];const u=(e,t)=>e>t?"A":t>e?"B":null,d=e=>`seg-${a}-${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),m=o(i),g=r(i);if(!Number.isFinite(f)||!Number.isFinite(m)||!Number.isFinite(g))continue;const y=u(m,g);if(null!==y)if(null!=s){if(l&&l.w!==y){let e,t;if(c.length>0)e=c[0].x,t=c[0].y;else{const o=m-l.a-(g-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*(m-l.a)}else e=l.x,t=l.a}h({__x:e,__y:t,__y0:t,__diffSegment:d(s),__diffWinner:s,__valA:t,__valB:t}),a++,s=y,h({__x:e,__y:t,__y0:t,__diffSegment:d(s),__diffWinner:s,__valA:t,__valB:t});for(let e=1;c.length>e;e++)p(c[e],s)}else for(const e of c)p(e,s);c=[],h({__x:f,__y:g>m?g:m,__y0:g>m?m:g,__diffSegment:d(s),__diffWinner:s,__valA:m,__valB:g,__sourceDatum:i}),l={x:f,a:m,b:g,w:y}}else{s=y;for(const e of c)p(e,s);c=[],h({__x:f,__y:g>m?g:m,__y0:g>m?m:g,__diffSegment:d(s),__diffWinner:s,__valA:m,__valB:g,__sourceDatum:i}),l={x:f,a:m,b:g,w:y}}else c.push({x:f,y:m,datum:i})}for(const e of c)p(e,s??"A");return i}(ae,J,ee,te),[ae,J,ee,te]),le=Rg(()=>g?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),a=o(e),s=r(e);Number.isFinite(a)&&i.push({__x:n,__y:a,__diffSegment:"line-A"}),Number.isFinite(s)&&i.push({__x:n,__y:s,__diffSegment:"line-B"})}return i}(ae,J,ee,te):[],[g,ae,J,ee,te]),ce=Rg(()=>[...se,...le],[se,le]),ue=Rg(()=>{const e=new Set;for(const t of se)e.add(t.__diffSegment);return Array.from(e)},[se]);Ng(t,()=>{const e=e=>{const t=O&&e.length>O?e.slice(e.length-O):e;ne.current=t,re(t)},t=H?"function"==typeof H?H:e=>e[H]: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=[],a=ne.current.map(e=>{if(n.includes(t(e))){const t=r(e);return i.push(t),t}return e});return e(a),i},clear:()=>e([]),getData:()=>ie?ne.current:ae,getScales:()=>o.current?.getScales()??null}},[ie,ae,H,O]);const de=Nm({data:ae,rawData:n,colorBy:"__diffWinner",colorScheme:[f,m],legendInteraction:E,legendPosition:z,selection:_,linkedHover:L,fallbackFields:["__diffWinner"],unwrapData:!1,onObservation:R,onClick:$,hoverHighlight:T,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"DifferenceChart",chartId:N,showLegend:q,userMargin:i,marginDefaults:r.marginDefaults,loading:F,loadingContent:D,emptyContent:B,width:W,height:j}),he=Rg(()=>{if(!1!==q)return{legendGroups:[{label:"",type:"fill",styleFn:e=>({fill:e.color||"currentColor"}),items:[{label:h,color:f},{label:p,color:m}]}]}},[q,h,p,f,m]),pe=Fg(e=>{const t=e.__diffSegment;return{fill:"A"==(t?.endsWith("-A")?"A":"B")?f:m,stroke:"none",fillOpacity:w}},[f,m,w]),fe=Fg(e=>({stroke:"A"==("line-A"===e.__diffSegment?"A":"B")?f:m,strokeWidth:y,fill:"none"}),[f,m,y]),me=Fg(e=>({fill:"A"==("line-A"===e.__diffSegment?"A":"B")?f:m,r:v}),[f,m,v]),ge=Fg(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=ae.find(e=>J(e)===r);e&&(null==n&&(n=ee(e)),null==i&&(i=te(e)))}const a=e=>null!=e&&Number.isFinite(e)?""+Math.round(100*e)/100:"—",l=s&&null!=r?s(r):null!=r?r+"":"";return Bg("div",{className:"semiotic-tooltip",style:us,children:[l&&Dg("div",{style:{fontWeight:600,marginBottom:4},children:l}),Bg("div",{style:{display:"flex",alignItems:"center",gap:6},children:[Dg("span",{style:{width:10,height:10,background:f,display:"inline-block",borderRadius:2}}),Bg("span",{children:[h,": ",a(n)]})]}),Bg("div",{style:{display:"flex",alignItems:"center",gap:6},children:[Dg("span",{style:{width:10,height:10,background:m,display:"inline-block",borderRadius:2}}),Bg("span",{children:[p,": ",a(i)]})]}),null!=n&&null!=i&&Number.isFinite(n)&&Number.isFinite(i)&&Bg("div",{style:{marginTop:4,opacity:.7},children:["Δ = ",a(n-i)]})]})},[ae,J,ee,te,s,f,m,h,p]),ye="multi"===S,be=Rg(()=>!1===S?()=>null:ye?ge:gs(S)||ge,[S,ye,ge]);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:me},size:[W,j],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:de.margin,showAxes:r.showAxes,xLabel:Q,yLabel:Z,xFormat:s,yFormat:l,enableHover:Y,showGrid:G,...k&&{gradientFill:!0===k?{topOpacity:.85,bottomOpacity:.15}:k},...he&&{legend:he,legendPosition:de.legendPosition},...Pp({title:V,description:X,summary:U,accessibleTable:K,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),tooltipContent:be,...ye&&{tooltipMode:"multi"},..._p({linkedHover:L,selection:_,onObservation:R,onClick:$,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,...P};return Dg(Wh,{componentName:"DifferenceChart",width:W,height:j,children:Dg(Hl,{ref:o,...ve})})});"function"==typeof zg&&(zg.displayName="DifferenceChart");import{useMemo as Hg,forwardRef as Og,useRef as Wg}from"react";import{jsx as jg}from"react/jsx-runtime";var Yg=Og(function(e,t){const o=Wg(null),r=wm(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:a,xFormat:s,yFormat:l,xAccessor:c="x",yAccessor:u="y",areaBy:d,lineDataAccessor:h="coordinates",colorBy:p,colorScheme:f,curve:m="monotoneX",areaOpacity:g=.7,showLine:y=!0,lineWidth:b=2,showPoints:v=!1,pointRadius:x=3,normalize:w=!1,baseline:k="zero",stackOrder:S,tooltip:A,annotations:C,xExtent:M,yExtent:P,frameProps:_={},selection:L,linkedHover:R,onObservation:$,onClick:T,hoverHighlight:N,chartId:F,loading:D,loadingContent:B,emptyContent:E,legendInteraction:z,legendPosition:H,color:O,stroke:W,strokeWidth:j,opacity:Y}=e,{width:G,height:q,enableHover:V,showGrid:X,showLegend:U,title:K,description:Q,summary:Z,accessibleTable:J,xLabel:ee,yLabel:te}=r,oe=Hg(()=>I(n),[n]),re=p||d;Dm(t,{variant:"xy",frameRef:o});const ne=Nm({data:oe,rawData:n,colorBy:re,colorScheme:f,legendInteraction:z,legendPosition:H,selection:L,linkedHover:R,fallbackFields:re?["string"==typeof re?re:""]:[],unwrapData:!1,onObservation:$,onClick:T,hoverHighlight:N,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"StackedAreaChart",chartId:F,showLegend:U,userMargin:i,marginDefaults:r.marginDefaults,loading:D,loadingContent:B,emptyContent:E,width:G,height:q}),{flattenedData:ie,lineStyle:ae,pointStyle:se,defaultTooltipContent:le}=Mg({safeData:oe,data:n,areaBy:d,lineDataAccessor:h,colorBy:re,colorScale:ne.colorScale,color:O,stroke:W,strokeWidth:j,opacity:Y,effectiveSelectionHook:ne.effectiveSelectionHook,resolvedSelection:ne.resolvedSelection,areaOpacity:g,showLine:y,lineWidth:b,showPoints:v,pointRadius:x,xAccessor:c,yAccessor:u,xLabel:ee,yLabel:te,xFormat:s,yFormat:l,groupField:d||p}),ce=Mm({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:m,normalize:w,baseline:w?"zero":k,stackOrder:S,lineStyle:ae,...v&&se&&{pointStyle:se},size:[G,q],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ne.margin,showAxes:r.showAxes,xLabel:ee,yLabel:te,xFormat:s,yFormat:l,enableHover:V,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:X,...ne.legendBehaviorProps,...Pp({title:K,description:Q,summary:Z,accessibleTable:J,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),..."multi"===A?{tooltipContent:ms(),tooltipMode:"multi"}:Lp({tooltip:A,defaultTooltipContent:le}),..._p({linkedHover:R,selection:L,onObservation:$,onClick:T,hoverHighlight:N,mobileInteraction:ne.mobileInteraction,customHoverBehavior:ne.customHoverBehavior,customClickBehavior:ne.customClickBehavior}),...C&&C.length>0&&{annotations:C},...M&&{xExtent:M},...P&&{yExtent:P},...ne.crosshairProps,..._};return ne.earlyReturn?ne.earlyReturn:ce?jg(Bh,{componentName:"StackedAreaChart",message:ce,width:G,height:q}):jg(Wh,{componentName:"StackedAreaChart",width:G,height:q,children:jg(Hl,{ref:o,...ue})})});Yg.displayName="StackedAreaChart";import{useMemo as Gg,forwardRef as qg,useRef as Vg}from"react";import{scaleSequential as Xg}from"d3-scale";import{jsx as Ug}from"react/jsx-runtime";var Kg=qg(function(e,t){const o=Vg(null);Dm(t,{variant:"xy",frameRef:o});const n=wm(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:i,margin:a,className:s,xAccessor:l="x",yAccessor:c="y",valueAccessor:u="value",xFormat:d,yFormat:h,colorScheme:p,customColorScale:f,showValues:m=!1,valueFormat:g,cellBorderColor:y="#fff",cellBorderWidth:b=1,tooltip:v,annotations:x,xExtent:w,yExtent:k,frameProps:S={},selection:A,linkedHover:C,onObservation:M,onClick:P,hoverHighlight:_,chartId:L,loading:R,loadingContent:$,emptyContent:T,showLegend:N,legendPosition:F,legendInteraction:D}=e,{width:B,height:E,enableHover:z,title:H,description:O,summary:W,accessibleTable:j,xLabel:Y,yLabel:G}=n,q=qh(R,B,E,$),V=q?null:Gh(i,B,E,T),X=Gg(()=>I(i),[i]),U=function(){const e=om();return e?.colors?.sequential||void 0}(),K=p??U??"blues",Q=N??!1,Z=F??"right",{margin:J}=bm({data:X,colorBy:Q?"value":void 0,colorScale:void 0,showLegend:Q,legendPosition:Z,userMargin:a,defaults:n.marginDefaults}),{customHoverBehavior:ee,customClickBehavior:te,crosshairSourceId:oe}=gm({selection:A,linkedHover:C,fallbackFields:[],onObservation:M,onClick:P,chartType:"Heatmap",chartId:L,hoverHighlight:_,colorByField:void 0,mobileInteraction:n.mobileInteraction});Tm(A);const re=ym(C,oe);vm(D,void 0,[]);const ne=Gg(()=>"function"==typeof u?e=>u(e):e=>e[u],[u]),ie=Gg(()=>{const e=X.map(ne);return r(e)},[X,ne]),ae=Gg(()=>{if("custom"===K&&f)return f;const e=Ce(K);return Xg(e).domain(ie)},[K,f,ie]),se=Gg(()=>_l([{label:Y||Sl(l),accessor:l,role:"x",format:d},{label:G||Sl(c),accessor:c,role:"y",format:h},{label:Sl(u),accessor:u,role:"value",format:g}]),[l,c,Y,G,u,d,h,g]),le=Mm({componentName:"Heatmap",data:i,accessors:{xAccessor:l,yAccessor:c,valueAccessor:u}}),ce=Gg(()=>{if(Q)return{gradient:{colorFn:e=>ae(e),domain:ie,label:"string"==typeof u?u:"value",format:g}}},[Q,ae,ie,u,g]),ue={chartType:"heatmap",...null!=i&&{data:X},xAccessor:l,yAccessor:c,valueAccessor:u,colorScheme:"custom"!==K?K:void 0,showValues:m,heatmapValueFormat:g,size:[B,E],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:J,showAxes:n.showAxes,xLabel:Y,yLabel:G,xFormat:d,yFormat:h,enableHover:z,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...ce&&{legend:ce,legendPosition:Z},...Pp({title:H,description:O,summary:W,accessibleTable:j,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Lp({tooltip:v,defaultTooltipContent:se}),..._p({linkedHover:C,selection:A,onObservation:M,onClick:P,hoverHighlight:_,mobileInteraction:n.mobileInteraction,customHoverBehavior:ee,customClickBehavior:te}),...x&&x.length>0&&{annotations:x},...w&&{xExtent:w},...k&&{yExtent:k},...re,...S};return q||V||(le?Ug(Bh,{componentName:"Heatmap",message:le,width:B,height:E}):Ug(Wh,{componentName:"Heatmap",width:B,height:E,children:Ug(Hl,{ref:o,...ue})}))});Kg.displayName="Heatmap";import{useMemo as Qg,useCallback as Zg,forwardRef as Jg,useRef as ey}from"react";import{jsx as ty}from"react/jsx-runtime";var oy=Jg(function(e,t){const o=ey(null),r=wm(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:a,xFormat:s,yFormat:l,xAccessor:c="x",yAccessor:u="y",sizeBy:d,sizeRange:h=[5,40],colorBy:p,colorScheme:f,bubbleOpacity:m=.6,bubbleStrokeWidth:g=1,bubbleStrokeColor:y="white",tooltip:b,marginalGraphics:v,pointIdAccessor:x,annotations:w,regression:k,xExtent:S,yExtent:A,frameProps:C={},selection:M,linkedHover:P,linkedBrush:_,onObservation:L,onClick:R,hoverHighlight:$,chartId:T,loading:N,loadingContent:F,emptyContent:D,legendInteraction:B,legendPosition:E,color:z,stroke:H,strokeWidth:O,opacity:W}=e,{width:j,height:Y,enableHover:G,showGrid:q,showLegend:V,title:X,description:U,summary:K,accessibleTable:Q,xLabel:Z,yLabel:J}=r,ee=Qg(()=>I(n),[n]),te=void 0===n,oe=Nm({data:ee,rawData:n,colorBy:p,colorScheme:f,legendInteraction:B,legendPosition:E,selection:M,linkedHover:P,fallbackFields:p?["string"==typeof p?p:""]:[],unwrapData:!1,onObservation:L,onClick:R,hoverHighlight:$,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"BubbleChart",chartId:T,showLegend:V,userMargin:i,marginDefaults:r.marginDefaults,loading:N,loadingContent:F,emptyContent:D,width:j,height:Y}),{domain:re,trackPushed:ne,reset:ie}=Ym({accessor:d,data:ee,isPushMode:te}),ae=Zg(e=>{ne([e]),o.current?.push(e)},[ne]),se=Zg(e=>{ne(e),o.current?.pushMany(e)},[ne]);Dm(t,{variant:"xy",frameRef:o,overrides:{push:ae,pushMany:se,clear:()=>{ie(),o.current?.clear()}},deps:[ae,se,ie]});const le=zf(_),ce=(vf({name:le?.name||"__unused_brush__",xField:le?.xField||("string"==typeof c?c:void 0),yField:le?.yField||("string"==typeof u?u:void 0)}),Qg(()=>({stroke:y,strokeWidth:g}),[y,g])),ue=Qg(()=>re??[0,1],[re]),de=Zg(e=>Oe(e,d,h,ue),[d,h,ue]),he=zm({colorBy:p,colorScale:oe.colorScale,color:z,fillOpacity:m,radiusFn:de,baseStyleExtras:ce,stroke:H,strokeWidth:O,opacity:W,effectiveSelectionHook:oe.effectiveSelectionHook,resolvedSelection:oe.resolvedSelection}),pe=Qg(()=>_l([{label:Z||Sl(c),accessor:c,role:"x",format:s},{label:J||Sl(u),accessor:u,role:"y",format:l},{label:Sl(d),accessor:d,role:"size"},...p?[{label:Sl(p),accessor:p,role:"color"}]:[]]),[c,u,Z,J,d,p,s,l]);if(oe.earlyReturn)return oe.earlyReturn;const fe=Mm({componentName:"BubbleChart",data:n,accessors:{xAccessor:c,yAccessor:u},requiredProps:{sizeBy:d}});if(fe)return ty(Bh,{componentName:"BubbleChart",message:fe,width:j,height:Y});const me=Gm(k),ge=me?[me,...w||[]]:w,ye={chartType:"bubble",...null!=n&&{data:ee},xAccessor:c,yAccessor:u,colorAccessor:p||void 0,sizeAccessor:d,sizeRange:h,pointStyle:he,colorScheme:f,size:[j,Y],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:oe.margin,showAxes:r.showAxes,xLabel:Z,yLabel:J,xFormat:s,yFormat:l,enableHover:G,showGrid:q,...oe.legendBehaviorProps,...Pp({title:X,description:U,summary:K,accessibleTable:Q,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Lp({tooltip:b,defaultTooltipContent:pe}),..._p({linkedHover:P,selection:M,onObservation:L,onClick:R,hoverHighlight:$,mobileInteraction:oe.mobileInteraction,customHoverBehavior:oe.customHoverBehavior,customClickBehavior:oe.customClickBehavior}),...v&&{marginalGraphics:v},...x&&{pointIdAccessor:x},...ge&&ge.length>0&&{annotations:ge},...S&&{xExtent:S},...A&&{yExtent:A},...oe.crosshairProps,...C};return ty(Wh,{componentName:"BubbleChart",width:j,height:Y,children:ty(Hl,{ref:o,...ye})})});oy.displayName="BubbleChart";import*as ry from"react";import{useMemo as ny,useCallback as iy,useState as ay,useRef as sy,useEffect as ly}from"react";import{brush as cy}from"d3-brush";import{select as uy}from"d3-selection";import{jsx as dy,jsxs as hy}from"react/jsx-runtime";var py="__splomIdx",fy={top:4,bottom:4,left:4,right:4};function my({frameRef:e,cellSize:t,onBrush:o}){const r=sy(null),n=t-fy.left-fy.right,i=t-fy.top-fy.bottom;return ly(()=>{if(!r.current)return;const t=uy(r.current).select(".brush-g"),a=cy().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],[a,s]]=t.selection,l=[[r.x.invert(n),r.y.invert(i)],[r.x.invert(a),r.y.invert(s)]];o(l)});return t.call(a),t.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{a.on("brush end",null)}},[n,i,e,o]),dy("svg",{ref:r,width:t,height:t,style:{position:"absolute",top:0,left:0},children:dy("g",{className:"brush-g",transform:`translate(${fy.left},${fy.top})`})})}function gy({data:e,xField:t,yField:o,cellSize:r,pointRadius:n,pointOpacity:i,colorBy:a,colorScale:s,brushSelectionName:l,hoverSelectionName:c,unselectedOpacity:u,mobileInteraction:d,mode:h,onPointHover:p,onPointClick:f}){const m=sy(null),g=mf({name:l,clientId:`splom-${t}-${o}`,fields:[t,o]}),y=vf({name:l,xField:t,yField:o}),b=mf({name:c,clientId:"splom-hover-source",fields:[py]}),v=b.selectPoints,x=iy(e=>{e?y.brushInteraction.during(e):y.brushInteraction.end(null)},[y.brushInteraction]),w=iy(e=>{if(!e)return void p?.(null);const t=e.data,o=t?.[py];void 0!==o&&(v({[py]:[o]}),p?.(t,e.x+fy.left,e.y+fy.top))},[v,p]),k=iy(e=>{if(!e)return void f?.(null);const t=e.data;t&&f?.(t,e.x+fy.left,e.y+fy.top)},[f]),S=iy(e=>{const t={opacity:i,r:n};return t.fill=a?Ee(e,a,s):am,"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):g.isActive&&!g.predicate(e)&&(t.opacity=u),t},[a,s,i,n,h,g.isActive,g.predicate,b.isActive,b.predicate,u]);return hy("div",{style:{position:"relative",width:r,height:r},children:[dy(Hl,{ref:m,chartType:"scatter",data:e,size:[r,r],xAccessor:t,yAccessor:o,pointStyle:S,margin:fy,showAxes:!1,enableHover:"hover"===h,..._p({forceHoverBehavior:"hover"===h,forceClickBehavior:!!f,mobileInteraction:d,customHoverBehavior:w,customClickBehavior:k}),tooltipContent:"hover"===h?()=>null:void 0}),"brush"===h&&dy(my,{frameRef:m,cellSize:r,xField:t,yField:o,onBrush:x})]})}function yy({data:e,field:o,label:n,cellSize:i,bins:a,colorBy:s,colorScale:l,brushSelectionName:c,hoverSelectionName:u,mode:d}){const h=mf({name:c,clientId:"splom-diag-"+o,fields:[o]}),p=mf({name:u,clientId:`splom-diag-${o}-hover`,fields:[py]}),f="hover"===d?p:h,m=f.isActive,g=f.predicate,y=ny(()=>{const n="string"==typeof s?s:null,l=[],c=new Set;for(const t of e){const e=t[o];if(null==e||isNaN(e)||l.push(Number(e)),n){const e=t[n];null!=e&&c.add(e+"")}}if(0===l.length)return{bars:[],selectedBars:[],categoryBars:[],selectedCategoryBars:[],max:0,categories:[]};const[u,d]=r(l),h=(d-u)/a||1,p=Array.from(c),f=new Map(p.map((e,t)=>[e,t])),y=Array(a).fill(0),b=Array(a).fill(0),v=Array.from({length:a},()=>Array(p.length).fill(0)),x=Array.from({length:a},()=>Array(p.length).fill(0));for(const t of e){const e=t[o];if(null==e||isNaN(e))continue;const r=Math.min(Math.floor((e-u)/h),a-1);if(y[r]++,m&&!g(t)||b[r]++,n){const e=f.get(t[n]+"");void 0!==e&&(v[r][e]++,m&&!g(t)||x[r][e]++)}}const w=t(y,1),k=v.map((e,t)=>{let o=0;return e.map((e,r)=>{const n=e/w*(i-24),s={x:t/a*i,w:i/a-1,h:n,y0:o,category:p[r]};return o+=n,s})}),S=x.map((e,t)=>{let o=0;return e.map((e,r)=>{const n=e/w*(i-24),s={x:t/a*i,w:i/a-1,h:n,y0:o,category:p[r]};return o+=n,s})});return{bars:y.map((e,t)=>({x:t/a*i,w:i/a-1,h:e/w*(i-24),count:e})),selectedBars:b.map((e,t)=>({x:t/a*i,w:i/a-1,h:e/w*(i-24),count:e})),categoryBars:k,selectedCategoryBars:S,max:w,categories:p}},[e,o,a,i,m,g,s]);return hy("svg",{width:i,height:i,style:{overflow:"hidden"},children:[dy("text",{x:i/2,y:14,textAnchor:"middle",fontSize:11,fontWeight:"bold",fill:"#333",children:n}),y.categories.length>0?y.categoryBars.map((e,t)=>e.map((e,o)=>dy("rect",{x:e.x,y:i-e.y0-e.h,width:Math.max(e.w,1),height:e.h,fill:l?l(e.category):am,opacity:m?.3:.6},`bg-${t}-${o}`))):y.bars.map((e,t)=>dy("rect",{x:e.x,y:i-e.h,width:Math.max(e.w,1),height:e.h,fill:am,opacity:m?.3:.6},"bg-"+t)),m&&(y.categories.length>0?y.selectedCategoryBars.map((e,t)=>e.map((e,o)=>dy("rect",{x:e.x,y:i-e.y0-e.h,width:Math.max(e.w,1),height:e.h,fill:l?l(e.category):am,opacity:.7},`sel-${t}-${o}`))):y.selectedBars.map((e,t)=>dy("rect",{x:e.x,y:i-e.h,width:Math.max(e.w,1),height:e.h,fill:am,opacity:.7},"sel-"+t)))]})}function by({label:e,cellSize:t}){return dy("svg",{width:t,height:t,children:dy("text",{x:t/2,y:t/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:12,fontWeight:"bold",fill:"#333",children:e})})}function vy(e){const{data:t,fields:o,fieldLabels:r={},colorBy:n,colorScheme:i,cellSize:a=150,cellGap:s=4,pointRadius:l=2,pointOpacity:c=.5,diagonal:u="histogram",histogramBins:d=20,brushMode:h="crossfilter",hoverMode:p=!0,unselectedOpacity:f=.1,showGrid:m=!1,tooltip:g,showLegend:y,idAccessor:b,width:v,className:x,onObservation:w,onClick:k,chartId:S}=e,A="splom",C="splom-hover",M=dm(e.mobileInteraction,{mode:e.mode,width:v??o.length*a,mobileSemantics:e.mobileSemantics}),P=p?"hover":h?"brush":"hover",_=cf(e=>e.clearSelection),[L,R]=ay(null),I=iy(()=>{_(C),R(null)},[_,C]),$=ny(()=>(t||[]).map((e,t)=>void 0!==e[py]?e:{...e,[py]:t}),[t]),T=fm($,n,i),N=iy((e,t,o,r)=>[40+e*(a+s)+(o??0),t*(a+s)+(r??0)],[40,a,s]),F=void 0!==y?y:!!n,D=ny(()=>{if(!F||!n)return null;const e="string"==typeof n?n:null;return e?Array.from(new Set($.map(t=>t[e]).filter(e=>null!=e))).map(e=>({label:e+"",color:T?T(e+""):am})):null},[F,n,$,T]),B=ny(()=>({display:"grid",gridTemplateColumns:"40px "+o.map(()=>a+"px").join(" "),gridTemplateRows:o.map(()=>a+"px").join(" ")+" 40px",gap:s+"px",width:"fit-content"}),[o,a,s,40]);return hy("div",{className:x,style:{position:"relative"},children:[D&&dy("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"},children:D.map(e=>hy("div",{style:{display:"flex",alignItems:"center",gap:4},children:[dy("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",backgroundColor:e.color}}),dy("span",{style:{fontSize:11},children:e.label})]},e.label))}),hy("div",{style:B,onMouseLeave:"hover"===P?I:void 0,children:[o.map((e,t)=>hy(ry.Fragment,{children:[dy("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?dy(by,{label:r[e]||e,cellSize:a},"diag-"+e):dy(yy,{data:$,field:e,label:r[e]||e,cellSize:a,bins:d,colorBy:n,colorScale:T,brushSelectionName:A,hoverSelectionName:C,unselectedOpacity:f,mode:P},"diag-"+e):dy(gy,{data:$,xField:o,yField:e,fieldLabels:r,cellSize:a,pointRadius:l,pointOpacity:c,colorBy:n,colorScale:T,brushSelectionName:A,hoverSelectionName:C,unselectedOpacity:f,showGrid:m,tooltip:g,mobileInteraction:M,mode:P,onPointHover:"hover"===P?(r,n,a)=>{if(r){if(R({datum:r,xField:o,yField:e,colIndex:i,rowIndex:t,px:n??0,py:a??0}),w){const[e,o]=N(i,t,n,a);w({type:"hover",datum:r,x:e,y:o,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:S})}}else R(null),w&&w({type:"hover-end",timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:S})}:void 0,onPointClick:k||w?(e,o,r)=>{if(!e)return;const[n,a]=N(i,t,o,r);k&&k(e,{x:n,y:a}),w&&w({type:"click",datum:e,x:n,y:a,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:S})}:void 0},`cell-${e}-${o}`))]},"row-"+e)),dy("div",{})," ",o.map(e=>dy("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:"bold",color:"#333"},children:r[e]||e},"col-label-"+e))]}),L&&"hover"===P&&(()=>{const e=L.datum,t=r[L.xField]||L.xField,o=r[L.yField]||L.yField,i=n?"function"==typeof n?n(e):e[n]:null,l=b?"function"==typeof b?b(e):e[b]:"Row "+e[py];return hy("div",{style:{position:"absolute",left:40+L.colIndex*(a+s)+L.px,top:L.rowIndex*(a+s)+L.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:[dy("div",{style:{fontWeight:"bold",marginBottom:2},children:l+""}),hy("div",{children:[t,": ",null!=e[L.xField]?Number(e[L.xField]).toFixed(1):"–"]}),hy("div",{children:[o,": ",null!=e[L.yField]?Number(e[L.yField]).toFixed(1):"–"]}),null!=i&&hy("div",{style:{opacity:.8},children:["string"==typeof n?n:"group",": ",i+""]})]})})()]})}function xy(e){const{brushMode:t="crossfilter",hoverMode:o=!0}=e,r={};return!o&&t&&(r.splom={resolution:t}),o&&(r["splom-hover"]={resolution:"union"}),dy(Bf,{selections:r,children:dy(vy,{...e})})}xy.displayName="ScatterplotMatrix";import{useState as wy,useRef as ky,useEffect as Sy,useMemo as Ay,useCallback as Cy}from"react";import{brushX as My,brushY as Py}from"d3-brush";import{select as _y}from"d3-selection";import{jsx as Ly,jsxs as Ry}from"react/jsx-runtime";function Iy({width:e,height:t,margin:o,scales:r,brushDirection:n,extent:i,onBrush:a}){const s=ky(null),l=ky(null),c=ky(!1),u=e+o.left+o.right,d=t+o.top+o.bottom;return Sy(()=>{if(!s.current||!r)return;const o=_y(s.current).select(".brush-group"),i="x"===n?My().extent([[0,0],[e,t]]):Py().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 a(null);const o=("x"===n?r.x:r.y).invert;if(!o)return;const i=[o(t[0]),o(t[1])];a(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,a]),Sy(()=>{if(!l.current||!r||!s.current)return;const e=_y(s.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]),Ly("svg",{ref:s,width:u,height:d,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:Ly("g",{className:"brush-group",transform:`translate(${o.left},${o.top})`})})}function $y(e){const{data:t,width:o=600,height:r=400,margin:n,className:i,title:a,description:s,summary:l,xLabel:c,yLabel:u,xFormat:d,yFormat:h,xAccessor:p="x",yAccessor:f="y",lineBy:m,lineDataAccessor:g="coordinates",colorBy:y,colorScheme:b,curve:v="linear",lineWidth:x=2,fillArea:w=!1,areaOpacity:k=.3,showPoints:S=!1,pointRadius:A=3,enableHover:C=!0,showGrid:M=!1,showLegend:P,legendPosition:_,tooltip:L,minimap:R={},renderBefore:$=!1,onBrush:T,brushExtent:N,yExtent:F,frameProps:D={},loading:B,loadingContent:E,emptyContent:z}=e,H=qh(B,o,r,E),O=H?null:Gh(t,o,r,z),W=Ay(()=>I(t),[t]),[j,Y]=wy(null),G=N??j,q=Cy(e=>{N||Y(e),T?.(e)},[N,T]),V=ky(null),[X,U]=wy(null);Sy(()=>{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!==W[0]?.[g],Q=Ay(()=>{if(K)return W;if(m){const e=W.reduce((e,t)=>{const o="function"==typeof m?m(t):t[m];if(!e[o]){const t={[g]:[]};"string"==typeof m&&(t[m]=o),e[o]=t}return e[o][g].push(t),e},{});return Object.values(e)}return[{[g]:W}]},[W,m,g,K]),Z=Ay(()=>K||m?Q.flatMap(e=>{const t=e[g]||[];return m&&"string"==typeof m?t.map(t=>({...t,[m]:e[m]})):t}):W,[Q,g,K,m,W]),J=fm(W,y,b),ee=bg({lineWidth:x,colorBy:y,colorScale:J,fillArea:w,areaOpacity:k}),te=Ay(()=>{if(R.lineStyle)return R.lineStyle},[R.lineStyle]),oe=bg({lineWidth:1,colorBy:y,colorScale:J}),re=te??oe,ne=Ay(()=>{if(S)return e=>{const t={r:A,fillOpacity:1};return t.fill=y?Ee(e.parentLine||e,y,J):am,t}},[S,A,y,J]),{legend:ie,margin:ae,legendPosition:se}=bm({data:Q,colorBy:y,colorScale:J,showLegend:P,legendPosition:_,userMargin:n}),le=R.height||60,ce=Ay(()=>({top:R.margin?.top??0,bottom:R.margin?.bottom??20,left:R.margin?.left??ae.left,right:R.margin?.right??ae.right}),[R.margin,ae]),ue=R.brushDirection||"x",de=Ay(()=>_l([{label:c||Sl(p),accessor:p,role:"x",format:d},{label:u||Sl(f),accessor:f,role:"y",format:h}]),[p,f,c,u,d,h]),he=Mm({componentName:"MinimapChart",data:t,accessors:{xAccessor:p,yAccessor:f}});if(he)return Ly(Bh,{componentName:"MinimapChart",message:he,width:o,height:r});const pe=w?"area":"line",fe={chartType:pe,data:Z,xAccessor:p,yAccessor:f,groupAccessor:m||void 0,curve:v,lineStyle:ee,...S&&{pointStyle:ne},size:[o,r],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ae,showAxes:!0,xLabel:c,yLabel:u,xFormat:d,yFormat:h,enableHover:C,showGrid:M,...ie&&{legend:ie,legendPosition:se},...a&&{title:a},...s&&{description:s},...l&&{summary:l},tooltipContent:!1===L?()=>null:gs(L)||de,...G&&{xExtent:G},...F&&{yExtent:F},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...D},me={chartType:pe,data:Z,xAccessor:p,yAccessor:f,groupAccessor:m||void 0,curve:v,lineStyle:re,size:[o,le+ce.top+ce.bottom],margin:ce,showAxes:R.showAxes??!1,background:R.background,enableHover:!1,...F&&{yExtent:F}},ge=Ry("div",{style:{position:"relative",width:o,overflow:"hidden"},children:[Ly(Hl,{ref:V,...me}),Ly(Iy,{width:o-ce.left-ce.right,height:le,margin:ce,scales:X,brushDirection:ue,extent:G,onBrush:q})]},"minimap"),ye=Ly("div",{style:{overflow:"hidden"},children:Ly(Hl,{...fe})},"main");return H||O||Ly(Wh,{componentName:"MinimapChart",width:o,height:r,children:Ry("div",{className:"minimap-chart"+(i?" "+i:""),children:[$?ge:ye,$?ye:ge]})})}$y.displayName="MinimapChart";import{useMemo as Ty,forwardRef as Ny,useRef as Fy}from"react";var Dy={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}};import{Fragment as By,jsx as Ey,jsxs as zy}from"react/jsx-runtime";function Hy(e,t){return{label:t?.label??e.label,color:t?.color??e.color,opacity:t?.opacity??e.opacity}}var Oy=Ny(function(e,t){const o=Fy(null);Dm(t,{variant:"xy",frameRef:o});const n=wm(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:i,margin:a,className:s,xFormat:l,yFormat:c,xAccessor:u="x",yAccessor:d="y",xCenter:h,yCenter:p,quadrants:f,centerlineStyle:m={},showQuadrantLabels:g=!0,quadrantLabelSize:y=12,colorBy:b,colorScheme:v,sizeBy:x,sizeRange:w=[3,15],pointRadius:k=5,pointOpacity:S=.8,tooltip:A,pointIdAccessor:C,annotations:M,frameProps:P={},selection:_,linkedHover:L,onObservation:R,onClick:$,hoverHighlight:T,chartId:N,loading:F,loadingContent:D,emptyContent:B,legendInteraction:E,legendPosition:z,color:H,stroke:O,strokeWidth:W,opacity:j}=e,{width:Y,height:G,enableHover:q,showGrid:V,showLegend:X,title:U,description:K,summary:Q,accessibleTable:Z,xLabel:J,yLabel:ee}=n,te=Ty(()=>({topLeft:Hy(Dy.topLeft,f?.topLeft),topRight:Hy(Dy.topRight,f?.topRight),bottomLeft:Hy(Dy.bottomLeft,f?.bottomLeft),bottomRight:Hy(Dy.bottomRight,f?.bottomRight)}),[f]),oe=Ty(()=>I(i),[i]),re=Nm({data:oe,rawData:i,colorBy:b,colorScheme:v,legendInteraction:E,legendPosition:z,selection:_,linkedHover:L,fallbackFields:"string"==typeof b?[b]:[],unwrapData:!1,onObservation:R,onClick:$,hoverHighlight:T,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"QuadrantChart",chartId:N,showLegend:X,userMargin:a,marginDefaults:n.marginDefaults,loading:F,loadingContent:D,emptyContent:B,width:Y,height:G});Vh("QuadrantChart",oe,"xAccessor",u),Vh("QuadrantChart",oe,"yAccessor",d);const ne=Ty(()=>{if(!oe.length)return;const e="function"==typeof u?u:e=>+e[u],t="function"==typeof d?d:e=>+e[d];let o=1/0,r=-1/0,n=1/0,i=-1/0;for(const a of oe){const s=e(a),l=t(a);isFinite(s)&&(o>s&&(o=s),s>r&&(r=s)),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 a=.1*(r-o)||1,s=.1*(i-n)||1;return{xExtent:[o-a,r+a],yExtent:[n-s,i+s]}},[oe,u,d,h,p]),ie=Ty(()=>{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?r(e):void 0},[oe,x]),ae=Ty(()=>"function"==typeof u?u:e=>+e[u],[u]),se=Ty(()=>"function"==typeof d?d:e=>+e[d],[d]),le=Ty(()=>e=>{const t=ae(e),o=se(e),r=null!=h?t>=h:void 0,n=null!=p?o>=p:void 0;return void 0===n||void 0===r?H||am:n&&r?te.topRight.color:n&&!r?te.topLeft.color:!n&&r?te.bottomRight.color:te.bottomLeft.color},[ae,se,h,p,te,H]),ce=Ty(()=>x?e=>Oe(e,x,w,ie):void 0,[x,w,ie]),ue=zm({colorBy:b,colorScale:re.colorScale,color:H,pointRadius:k,fillOpacity:S,radiusFn:ce,fallbackFill:le,stroke:O,strokeWidth:W,opacity:j,effectiveSelectionHook:re.effectiveSelectionHook,resolvedSelection:re.resolvedSelection}),de=Ty(()=>{if(!oe.length)return;const e=new Set;"string"==typeof u&&e.add(u),"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,u,d,b,x]),he=Ty(()=>_l([...de?[{label:de,accessor:de,role:"title"}]:[],{label:J||Sl(u),accessor:u,role:"x",format:l},{label:ee||Sl(d),accessor:d,role:"y",format:c},...b?[{label:Sl(b),accessor:b,role:"color"}]:[],...x?[{label:Sl(x),accessor:x,role:"size"}]:[]]),[de,u,d,J,ee,b,x,l,c]),pe=Mm({componentName:"QuadrantChart",data:i,accessors:{xAccessor:u,yAccessor:d}}),fe=Ty(()=>{const e={stroke:m.stroke||"#999",strokeWidth:m.strokeWidth??1,dashArray:m.strokeDasharray||[]};return[(t,o,r,n)=>{if(!r?.x||!r?.y)return;const i=n.width,a=n.height,s=null!=h?r.x(h):i/2,l=null!=p?r.y(p):a/2;if(null!=h&&!isFinite(s))return;if(null!=p&&!isFinite(l))return;const c=Math.max(0,Math.min(i,s)),u=Math.max(0,Math.min(a,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:a-u},{config:te.bottomRight,x:c,y:u,w:i-c,h:a-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,a),t.stroke(),t.beginPath(),t.moveTo(0,u),t.lineTo(i,u),t.stroke(),t.setLineDash([])}]},[h,p,te,m]),me=Ty(()=>g?[...fe,(e,t,o,r)=>{if(!o?.x||!o?.y)return;const n=r.width,i=r.height,a=null!=h?o.x(h):n/2,s=null!=p?o.y(p):i/2;(null==h||isFinite(a))&&(null==p||isFinite(s))&&(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,g,y,te,h,p]),ge=Ty(()=>{const e=P.canvasPreRenderers||[];return[...me,...e]},[me,P.canvasPreRenderers]),ye=Ty(()=>{const e={stroke:m.stroke||"#999",strokeWidth:m.strokeWidth??1,dashArray:m.strokeDasharray?Array.isArray(m.strokeDasharray)?m.strokeDasharray.join(","):m.strokeDasharray:void 0};return[(t,o,r)=>{if(!o?.x||!o?.y)return null;const n=r.width,i=r.height,a=null!=h?o.x(h):n/2,s=null!=p?o.y(p):i/2;if(null!=h&&!isFinite(a))return null;if(null!=p&&!isFinite(s))return null;const l=Math.max(0,Math.min(n,a)),c=Math.max(0,Math.min(i,s));return zy(By,{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?Ey("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),Ey("line",{x1:l,y1:0,x2:l,y2:i,stroke:e.stroke,strokeWidth:e.strokeWidth,strokeDasharray:e.dashArray}),Ey("line",{x1:0,y1:c,x2:n,y2:c,stroke:e.stroke,strokeWidth:e.strokeWidth,strokeDasharray:e.dashArray}),g&&zy(By,{children:[Ey("text",{x:8,y:8+y,fill:te.topLeft.color,fontWeight:600,fontSize:y,opacity:.5,children:te.topLeft.label}),Ey("text",{x:n-8,y:8+y,fill:te.topRight.color,fontWeight:600,fontSize:y,opacity:.5,textAnchor:"end",children:te.topRight.label}),Ey("text",{x:8,y:i-8,fill:te.bottomLeft.color,fontWeight:600,fontSize:y,opacity:.5,children:te.bottomLeft.label}),Ey("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,m,g,y]);if(re.earlyReturn)return re.earlyReturn;const be={chartType:"scatter",...null!=i&&{data:oe},xAccessor:u,yAccessor:d,colorAccessor:b||void 0,sizeAccessor:x||void 0,sizeRange:w,pointStyle:ue,colorScheme:v,size:[Y,G],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:re.margin,showAxes:n.showAxes,xLabel:J,yLabel:ee,xFormat:l,yFormat:c,enableHover:q,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:gs(A)||he,..._p({linkedHover:L,selection:_,onObservation:R,onClick:$,hoverHighlight:T,mobileInteraction:re.mobileInteraction,customHoverBehavior:re.customHoverBehavior,customClickBehavior:re.customClickBehavior}),...C&&{pointIdAccessor:C},...M&&M.length>0&&{annotations:M},canvasPreRenderers:ge,...re.crosshairProps,...P,...ge.length>0&&{canvasPreRenderers:ge},svgPreRenderers:ye};return pe?Ey(Bh,{componentName:"QuadrantChart",message:pe,width:Y,height:G}):Ey(Wh,{componentName:"QuadrantChart",width:Y,height:G,children:Ey(Hl,{ref:o,...be})})});Oy.displayName="QuadrantChart";import*as Wy from"react";import{useMemo as jy,useCallback as Yy,forwardRef as Gy,useRef as qy,useImperativeHandle as Vy}from"react";import{jsx as Xy}from"react/jsx-runtime";var Uy="__ma_unitized",Ky="__ma_series";function Qy(e,t){const o=t[1]-t[0];return 0===o?.5:(e-t[0])/o}function Zy(e,t){return t[0]+e*(t[1]-t[0])}var Jy=Gy(function(e,t){const o=qy(null),r=qy([]),n=qy(e.series);n.current=e.series,Vy(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],a=t.extent||r.current[e];if(!a)continue;const s=("function"==typeof t.yAccessor?t.yAccessor:e=>e[t.yAccessor])(i);null!=s&&isFinite(s)&&o.current.push({...i,[Uy]:Qy(s,a),[Ky]: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],a=o.extent||r.current[t];if(!a)continue;const s=("function"==typeof o.yAccessor?o.yAccessor:e=>e[o.yAccessor])(e);null!=s&&isFinite(s)&&i.push({...e,[Uy]:Qy(s,a),[Ky]: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=wm(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:a,margin:s,className:l,xFormat:c,xAccessor:u="x",series:d,colorScheme:h,curve:p="monotoneX",lineWidth:f=2,tooltip:m,annotations:g,frameProps:y={},selection:b,linkedHover:v,onObservation:x,onClick:w,hoverHighlight:k,chartId:S,loading:A,loadingContent:C,emptyContent:M,legendInteraction:P,legendPosition:_,stroke:L,strokeWidth:R,opacity:$}=e,{width:T,height:N,enableHover:F,showGrid:D,showLegend:B=!0,title:E,description:z,summary:H,accessibleTable:O,xLabel:W}=i,j=jy(()=>I(a),[a]),Y=jy(()=>I(d),[d]),G=Y,q=2===Y.length;"undefined"==typeof process||"production"===process.env?.NODE_ENV||q||console.warn(`[MultiAxisLineChart] Expected exactly 2 series for dual-axis mode, got ${Y.length}. Rendering as a standard multi-line chart.`);const V=qh(A,T,N,C),X=V?null:Gh(a,T,N,M),U=hm(),K=jy(()=>{let e;if(Array.isArray(h))e=h;else if(U&&U.length>0)e=U;else{const t=Te[h];e=Array.isArray(t)?t:Ne}return G.map((t,o)=>t.color||e[o%e.length])},[G,h,U]),Q=jy(()=>Y.map((e,t)=>e.label||"Series "+(t+1)),[Y]),{unitizedData:Z,extents:J}=jy(()=>{if(0===j.length){const e=Y.map(e=>e.extent||null).filter(Boolean);return e.length===Y.length&&(r.current=e),{unitizedData:[],extents:e.length===Y.length?e:[]}}const e=Y.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]}(j,e.yAccessor));if(r.current=e,!q){const t=[];for(const e of j)for(let o=0;Y.length>o;o++){const r=Y[o],n=("function"==typeof r.yAccessor?r.yAccessor:e=>e[r.yAccessor])(e);null!=n&&t.push({...e,[Uy]:n,[Ky]:Q[o]})}return{unitizedData:t,extents:e}}const t=[];for(const o of j)for(let r=0;2>r;r++){const n=Y[r],i=("function"==typeof n.yAccessor?n.yAccessor:e=>e[n.yAccessor])(o);null!=i&&t.push({...o,[Uy]:Qy(i,e[r]),[Ky]:Q[r]})}return{unitizedData:t,extents:e}},[j,Y,q,Q]),ee=jy(()=>{if(q&&J.length>=2)return[{orient:"left",label:Q[0],tickFormat:Y[0].format||(e=>{const t=Zy(e,J[0]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"right",label:Q[1],tickFormat:Y[1].format||(e=>{const t=Zy(e,J[1]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"bottom"}]},[q,J,Y,Q]),te=Nm({data:jy(()=>Z.length>0?Z:Q.map(e=>({[Ky]:e})),[Z,Q]),rawData:a,colorBy:Ky,colorScheme:K,legendInteraction:P,legendPosition:_,selection:b,linkedHover:v,fallbackFields:[Ky],unwrapData:!1,onObservation:x,onClick:w,hoverHighlight:k,mobileInteraction:i.mobileInteraction,mobileSemantics:i.mobileSemantics,chartType:"MultiAxisLineChart",chartId:S,showLegend:B,userMargin:s,marginDefaults:q?{...i.marginDefaults,left:70,right:70}:i.marginDefaults,loading:A,loadingContent:C,emptyContent:M,width:T,height:N}),oe=jy(()=>{const e=new Map;return Q.forEach((t,o)=>e.set(t,K[o])),e},[Q,K]),re=bg({lineWidth:f,resolveStroke:Yy(e=>oe.get(e[Ky])||K[0],[oe,K]),stroke:L,strokeWidth:R,opacity:$,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection}),ne=jy(()=>{if(!1===m)return()=>null;return gs(m)||(e=>{const t=e.data||e,o=t[Ky],r=Q.indexOf(o),n=t[Uy],i=q&&r>=0&&J[r]?Zy(n,J[r]):n,a=r>=0&&Y[r]?.format?Y[r].format:e=>Number.isInteger(e)?e+"":e.toFixed(2),s="function"==typeof u?u(t):t[u];return Wy.createElement("div",{style:{padding:"6px 10px",fontFamily:"var(--semiotic-font-family, sans-serif)",fontSize:"var(--semiotic-tooltip-font-size, 13px)"}},Wy.createElement("div",{style:{fontWeight:600,marginBottom:4,color:K[r]||"inherit"}},o),Wy.createElement("div",null,`${"string"==typeof u?u:"x"}: ${s}`),Wy.createElement("div",null,`${o}: ${a(i)}`))})},[m,Q,K,J,q,Y,u]);if(te.earlyReturn)return te.earlyReturn;const ie=Mm({componentName:"MultiAxisLineChart",data:a,accessors:{xAccessor:u}}),ae=q?[0,1]:void 0,se={chartType:"line",...null!=a&&{data:Z},xAccessor:u,yAccessor:Uy,groupAccessor:Ky,lineStyle:re,colorScheme:K,size:[T,N],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:te.margin,showAxes:i.showAxes,...ee&&{axes:ee},xLabel:W,...q?{}:{yLabel:Q[0]},xFormat:c,...q&&ae&&{yExtent:ae},enableHover:F,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:D,curve:p,...te.legendBehaviorProps,...E&&{title:E},...z&&{description:z},...H&&{summary:H},...void 0!==O&&{accessibleTable:O},...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,...g&&{annotations:g},..._p({linkedHover:v,selection:b,onObservation:x,onClick:w,hoverHighlight:k,mobileInteraction:te.mobileInteraction,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior}),...te.crosshairProps,...y};return V||X||(ie?Xy(Bh,{componentName:"MultiAxisLineChart",message:ie,width:T,height:N}):Xy(Wh,{componentName:"MultiAxisLineChart",width:T,height:N,children:Xy(Hl,{ref:o,...se})}))});Jy.displayName="MultiAxisLineChart";import{useMemo as eb,forwardRef as tb,useRef as ob}from"react";function rb(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}import{jsx as nb}from"react/jsx-runtime";var ib=tb(function(e,t){const o=ob(null);Dm(t,{variant:"xy",frameRef:o});const r=wm(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:a,xFormat:s,yFormat:l,xAccessor:c="x",highAccessor:u="high",lowAccessor:d="low",openAccessor:h,closeAccessor:p,candlestickStyle:f,tooltip:m,annotations:g,xExtent:y,yExtent:b,frameProps:v={},selection:x,linkedHover:w,onObservation:k,onClick:S,chartId:A,loading:C,loadingContent:M,emptyContent:P}=e,{width:_,height:L,enableHover:R,showGrid:$,title:T,description:N,summary:F,accessibleTable:D,xLabel:B,yLabel:E}=r,z=qh(C,_,L,M),H=z?null:Gh(n,_,L,P),O=eb(()=>I(n),[n]),W=null==h||null==p;Vh("CandlestickChart",O,"xAccessor",c),Vh("CandlestickChart",O,"highAccessor",u),Vh("CandlestickChart",O,"lowAccessor",d),W||(Vh("CandlestickChart",O,"openAccessor",h),Vh("CandlestickChart",O,"closeAccessor",p));const{customHoverBehavior:j,customClickBehavior:Y,crosshairSourceId:G}=gm({selection:x,linkedHover:w,onObservation:k,onClick:S,chartType:"CandlestickChart",chartId:A,mobileInteraction:r.mobileInteraction}),q=ym(w,G),V=eb(()=>{const t=r.marginDefaults,o="sparkline"===e.mode?{...t,top:0,bottom:0}:t;return null==i?o:{...o,...rb(i)}},[i,r.marginDefaults,e.mode]),X=eb(()=>{const e=[{label:B||Sl(c),accessor:c,role:"x",format:s}];return W?(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})),_l(e)},[c,B,s,l,u,d,h,p,W]),U=Mm({componentName:"CandlestickChart",data:n,accessors:{xAccessor:c,highAccessor:u,lowAccessor:d,...!W&&{openAccessor:h,closeAccessor:p}}}),K={chartType:"candlestick",...null!=n&&{data:O},xAccessor:c,yAccessor:u,highAccessor:u,lowAccessor:d,...!W&&{openAccessor:h,closeAccessor:p},...f&&{candlestickStyle:f},scalePadding:Math.max(2,Math.min(12,Math.round(_/40))),extentPadding:_>200?.1:.02,size:[_,L],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:V,showAxes:r.showAxes,xLabel:B,yLabel:E,xFormat:s,yFormat:l,enableHover:R,showGrid:$,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...Pp({title:T,description:N,summary:F,accessibleTable:D,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Lp({tooltip:m,defaultTooltipContent:X}),..._p({linkedHover:w,selection:x,onObservation:k,onClick:S,mobileInteraction:r.mobileInteraction,customHoverBehavior:j,customClickBehavior:Y}),...g&&g.length>0&&{annotations:g},...y&&{xExtent:y},...b&&{yExtent:b},...q,...v};return z||H||(U?nb(Bh,{componentName:"CandlestickChart",message:U,width:_,height:L}):nb(Wh,{componentName:"CandlestickChart",width:_,height:L,children:nb(Hl,{ref:o,...K})}))});ib.displayName="CandlestickChart";import{forwardRef as ab,useMemo as sb}from"react";import{useMemo as lb,useRef as cb}from"react";function ub(e){const t=cb(null);return Dm(e.imperativeRef,{variant:e.imperativeVariant,frameRef:t}),{frameRef:t,resolved:wm(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:lb(()=>rb(e.margin),[e.margin])}}function db(e){const t=ub(e),{resolved:o,normalizedMargin:r}=t,n=Nm({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}}import{jsx as hb}from"react/jsx-runtime";var pb=ab(function(e,t){const{data:o,layout:r,layoutConfig:n,onLayoutError:i,xExtent:a,yExtent:s,showAxes:l=!1,margin:c,className:u,annotations:d,onObservation:h,onClick:p,selection:f,linkedHover:m,chartId:g,loading:y,loadingContent:b,emptyContent:v,colorBy:x,colorScheme:w,frameProps:k={}}=e,{frameRef:S,resolved:A,safeData:C,setup:M,earlyReturn:P}=db({imperativeRef:t,imperativeVariant:"xy",chartTypeLabel:"XYCustomChart",unwrapData:!1,data:o,colorBy:x,colorScheme:w,selection:f,linkedHover:m,onObservation:h,onClick:p,chartId:g,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}),_=M.effectiveSelectionHook,L=sb(()=>_?.isActive?{isActive:!0,predicate:_.predicate}:null,[_?.isActive,_?.predicate]);if(P)return P;const{width:R,height:I,enableHover:$,showGrid:T,title:N,description:F,summary:D,accessibleTable:B,xLabel:E,yLabel:z}=A,H={chartType:"custom",...null!=o&&{data:C},customLayout:r,layoutConfig:n,onLayoutError:i,...L&&{layoutSelection:L},xExtent:a,yExtent:s,colorAccessor:x,colorScheme:w,size:[R,I],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:M.margin,showAxes:l,xLabel:E,yLabel:z,enableHover:$,showGrid:T,...M.legendBehaviorProps,...Pp({title:N,description:F,summary:D,accessibleTable:B,className:u,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...null!=e.tooltip&&{tooltipContent:e.tooltip},..._p({linkedHover:m,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,...k};return hb(Wh,{componentName:"XYCustomChart",width:R,height:I,children:hb(Hl,{ref:S,...H})})});pb.displayName="XYCustomChart";import{forwardRef as fb,useMemo as mb}from"react";import{jsx as gb}from"react/jsx-runtime";var yb=fb(function(e,t){const{nodes:o,edges:r,layout:n,layoutConfig:i,onLayoutError:a,nodeIDAccessor:s="id",sourceAccessor:l="source",targetAccessor:c="target",margin:u,className:d,colorBy:h,colorScheme:p,selection:f,linkedHover:m,onObservation:g,onClick:y,chartId:b,annotations:v,autoPlaceAnnotations:x,frameProps:w={}}=e,{frameRef:k,resolved:S,normalizedMargin:A}=ub({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=mb(()=>I(o??[]),[o]),M=mb(()=>I(r??[]),[r]),P=dm(e.mobileInteraction,{mode:e.mode,width:S.width,mobileSemantics:e.mobileSemantics}),{customHoverBehavior:_,customClickBehavior:L,activeSelectionHook:R}=gm({selection:f,linkedHover:m,fallbackFields:"string"==typeof h?[h]:[],onObservation:g,onClick:y,chartType:"NetworkCustomChart",chartId:b,colorByField:"string"==typeof h?h:void 0,mobileInteraction:P}),$=mb(()=>R?.isActive?{isActive:!0,predicate:R.predicate}:null,[R?.isActive,R?.predicate]),{width:T,height:N,enableHover:F,title:D,description:B,summary:E,accessibleTable:z}=S,H={chartType:"force",...null!=o&&{nodes:C},...null!=r&&{edges:M},customNetworkLayout:n,layoutConfig:i,onLayoutError:a,nodeIDAccessor:s,sourceAccessor:l,targetAccessor:c,colorBy:h,colorScheme:p,size:[T,N],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:A,className:d,title:D,description:B,summary:E,accessibleTable:z,enableHover:F,..._p({linkedHover:m,selection:f,onObservation:g,onClick:y,mobileInteraction:P,customHoverBehavior:_,customClickBehavior:L,linkedHoverInClickPredicate:!1}),layoutSelection:$,...null!=v&&{annotations:v},...null!=x&&{autoPlaceAnnotations:x},...w};return gb(Wh,{componentName:"NetworkCustomChart",width:T,height:N,children:gb(Mp,{ref:k,...H})})});yb.displayName="NetworkCustomChart";import{forwardRef as bb,useMemo as vb}from"react";import{jsx as xb}from"react/jsx-runtime";var wb=bb(function(e,t){const{data:o,layout:r,layoutConfig:n,onLayoutError:i,categoryAccessor:a="category",valueAccessor:s="value",oExtent:l,rExtent:c,projection:u="vertical",margin:d,className:h,colorBy:p,colorScheme:f,showAxes:m=!1,annotations:g,onObservation:y,onClick:b,selection:v,linkedHover:x,chartId:w,loading:k,loadingContent:S,emptyContent:A,frameProps:C={}}=e,{frameRef:M,resolved:P,safeData:_,setup:L,earlyReturn:R}=db({imperativeRef:t,imperativeVariant:"xy",chartTypeLabel:"OrdinalCustomChart",unwrapData:!0,data:o,colorBy:p,colorScheme:f,selection:v,linkedHover:x,onObservation:y,onClick:b,chartId:w,loading:k,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}),I=L.effectiveSelectionHook,$=vb(()=>I?.isActive?{isActive:!0,predicate:I.predicate}:null,[I?.isActive,I?.predicate]);if(R)return R;const{width:T,height:N,enableHover:F,showGrid:D,title:B,description:E,summary:z,accessibleTable:H}=P,O={chartType:"custom",...null!=o&&{data:_},customLayout:r,layoutConfig:n,onLayoutError:i,...$&&{layoutSelection:$},oAccessor:a,rAccessor:s,oExtent:l,rExtent:c,projection:u,colorAccessor:p,colorScheme:f,size:[T,N],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:L.margin,enableHover:F,showAxes:m,showGrid:D,annotations:g,...Pp({title:B,description:E,summary:z,accessibleTable:H,className:h,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),..._p({linkedHover:x,selection:v,onObservation:y,onClick:b,hoverHighlight:!1,mobileInteraction:L.mobileInteraction,customHoverBehavior:L.customHoverBehavior,customClickBehavior:L.customClickBehavior}),...C};return xb(Wh,{componentName:"OrdinalCustomChart",width:T,height:N,children:xb(hu,{ref:M,...O})})});wb.displayName="OrdinalCustomChart";import{useMemo as kb,forwardRef as Sb,useRef as Ab}from"react";import{useImperativeHandle as Cb}from"react";function Mb({ref:e,frameRef:t,setup:o}){return Cb(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}}import{useMemo as Pb}from"react";function _b(e){const{colorBy:t,colorScale:o,color:r,themeCategorical:n,colorScheme:i,categoryIndexMap:a,userPieceStyle:s,stroke:l,strokeWidth:c,opacity:u,effectiveSelectionHook:d,resolvedSelection:h,cycleByCategory:p=!1,baseStyleExtras:f,linkStrokeToFill:m=!1}=e,g=Pb(()=>(e,s)=>{const l="function"==typeof f?f(e,s):f,c=l?{...l}:{};if(void 0===c.fill)if(t){if(!o)return c;c.fill=Ee(e,t,o)}else c.fill=pm(r,n,i,p?s:void 0,a);return m&&void 0===c.stroke&&void 0!==c.fill&&(c.stroke=c.fill),c},[t,o,r,n,i,a,p,f,m]),y=Pb(()=>Em(s?"function"==typeof s?(e,t)=>({...g(e,t),...s(e,t)||{}}):(e,t)=>({...g(e,t),...s}):g,{stroke:l,strokeWidth:c,opacity:u}),[g,s,l,c,u]);return Pb(()=>Hf(y,d??null,h),[y,d,h])}import{jsx as Lb}from"react/jsx-runtime";var Rb=Sb(function(e,t){const o=wm(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=Ab(null),{data:n,margin:i,className:a,categoryAccessor:s="category",valueAccessor:l="value",orientation:c="vertical",valueFormat:u,colorBy:d,colorScheme:h,sort:p=!1,barPadding:f=40,roundedTop:m,gradientFill:g=!1,baselinePadding:y=!1,tooltip:b,annotations:v,regression:x,valueExtent:w,frameProps:k={},selection:S,linkedHover:A,onObservation:C,onClick:M,hoverHighlight:P,chartId:_,loading:L,loadingContent:R,emptyContent:$,legendInteraction:T,legendPosition:N,color:F,stroke:D,strokeWidth:B,opacity:E,showCategoryTicks:z,categoryFormat:H,dataIdAccessor:O}=e,{width:W,height:j,enableHover:Y,showGrid:G,showLegend:q,title:V,description:X,summary:U,accessibleTable:K,categoryLabel:Q,valueLabel:Z}=o,J=kb(()=>I(n),[n]),ee=Nm({data:J,rawData:n,colorBy:d,colorScheme:h,legendInteraction:T,legendPosition:N,selection:S,linkedHover:A,fallbackFields:d?["string"==typeof d?d:""]:[],unwrapData:!0,onObservation:C,onClick:M,hoverHighlight:P,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"BarChart",chartId:_,showLegend:q,userMargin:i,marginDefaults:o.marginDefaults,loading:L,loadingContent:R,emptyContent:$,width:W,height:j}),{effectiveLegendProps:te,effectiveMargin:oe}=Mb({ref:t,frameRef:r,setup:ee});Vh("BarChart",J,"categoryAccessor",s),Vh("BarChart",J,"valueAccessor",l);const re=mm(J,p,l),ne=hm(),ie=kb(()=>new Map,[J]),ae=_b({colorBy:d,colorScale:ee.colorScale,color:F,themeCategorical:ne,colorScheme:h,categoryIndexMap:ie,userPieceStyle:k?.pieceStyle,stroke:D,strokeWidth:B,opacity:E,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection}),se=kb(()=>Ll({categoryAccessor:s,valueAccessor:l,groupAccessor:d&&d!==s?d:void 0,groupLabel:"string"==typeof d?d:"group",valueFormat:u}),[s,l,d,u]);if(ee.earlyReturn)return ee.earlyReturn;const le=Mm({componentName:"BarChart",data:n,accessors:{categoryAccessor:s,valueAccessor:l}});if(le)return Lb(Bh,{componentName:"BarChart",message:le,width:W,height:j});const ce=Gm(x),ue=ce?[ce,...v||[]]:v,de={chartType:"bar",...null!=n&&{data:re},oAccessor:s,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",pieceStyle:ae,size:[W,j],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:oe,barPadding:f,...null!=m&&{roundedTop:m},...g&&{gradientFill:!0===g?{topOpacity:.8,bottomOpacity:.05}:g},...O&&{dataIdAccessor:O},baselinePadding:y,enableHover:Y,showAxes:o.showAxes,oLabel:Q,rLabel:Z,rFormat:u,...H&&{oFormat:H},showGrid:G,showCategoryTicks:z,oSort:p,...te,...Pp({title:V,description:X,summary:U,accessibleTable:K,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Lp({tooltip:b,defaultTooltipContent:se}),..._p({linkedHover:A,selection:S,onObservation:C,onClick:M,hoverHighlight:P,mobileInteraction:ee.mobileInteraction,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior}),...ue&&ue.length>0&&{annotations:ue},...w&&{rExtent:w},...Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e))};return Lb(Wh,{componentName:"BarChart",width:W,height:j,children:Lb(hu,{ref:r,...de})})});Rb.displayName="BarChart";import{useMemo as Ib,forwardRef as $b,useRef as Tb}from"react";import{jsx as Nb}from"react/jsx-runtime";var Fb=$b(function(e,t){const o=wm(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=Tb(null),{data:n,margin:i,className:a,categoryAccessor:s="category",stackBy:l,valueAccessor:c="value",orientation:u="vertical",valueFormat:d,colorBy:h,colorScheme:p,normalize:f=!1,sort:m=!1,barPadding:g=40,roundedTop:y,baselinePadding:b=!1,tooltip:v,annotations:x,valueExtent:w,frameProps:k={},selection:S,linkedHover:A,onObservation:C,onClick:M,hoverHighlight:P,chartId:_,loading:L,loadingContent:R,emptyContent:$,legendInteraction:T,legendPosition:N,color:F,stroke:D,strokeWidth:B,opacity:E,categoryFormat:z}=e,{width:H,height:O,enableHover:W,showGrid:j,showLegend:Y,title:G,description:q,summary:V,accessibleTable:X,categoryLabel:U,valueLabel:K}=o,Q=Ib(()=>I(n),[n]),Z=h||l,J=Nm({data:Q,rawData:n,colorBy:Z,colorScheme:p,legendInteraction:T,legendPosition:N,selection:S,linkedHover:A,fallbackFields:Z?["string"==typeof Z?Z:""]:[],unwrapData:!0,onObservation:C,onClick:M,hoverHighlight:P,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"StackedBarChart",chartId:_,showLegend:Y,userMargin:i,marginDefaults:o.marginDefaults,loading:L,loadingContent:R,emptyContent:$,width:H,height:O}),ee=hm(),te=Ib(()=>new Map,[Q]),oe=_b({colorBy:Z,colorScale:J.colorScale,color:F,themeCategorical:ee,colorScheme:p,categoryIndexMap:te,userPieceStyle:k?.pieceStyle,stroke:D,strokeWidth:B,opacity:E,effectiveSelectionHook:J.effectiveSelectionHook,resolvedSelection:J.resolvedSelection}),re=Ib(()=>Ll({categoryAccessor:l,valueAccessor:c,groupAccessor:s,valueFormat:d}),[l,s,c,d]),ne=Mm({componentName:"StackedBarChart",data:n,accessors:{categoryAccessor:s,valueAccessor:c},requiredProps:{stackBy:l}}),{effectiveLegendProps:ie,effectiveMargin:ae}=Mb({ref:t,frameRef:r,setup:J});if(J.earlyReturn)return J.earlyReturn;const se={chartType:"bar",...null!=n&&{data:Q},oAccessor:s,rAccessor:c,stackBy:l,normalize:f,oSort:m,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:oe,size:[H,O],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ae,barPadding:g,...null!=y&&{roundedTop:y},baselinePadding:b,enableHover:W,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:U,rLabel:K,rFormat:d,...z&&{oFormat:z},showGrid:j,...ie,...Pp({title:G,description:q,summary:V,accessibleTable:X,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Lp({tooltip:v,defaultTooltipContent:re}),..._p({linkedHover:A,selection:S,onObservation:C,onClick:M,hoverHighlight:P,mobileInteraction:J.mobileInteraction,customHoverBehavior:J.customHoverBehavior,customClickBehavior:J.customClickBehavior}),...x&&x.length>0&&{annotations:x},...w&&{rExtent:w},...Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e))};return ne?Nb(Bh,{componentName:"StackedBarChart",message:ne,width:H,height:O}):Nb(Wh,{componentName:"StackedBarChart",width:H,height:O,children:Nb(hu,{ref:r,...se})})});Fb.displayName="StackedBarChart";import*as Db from"react";import{useMemo as Bb,useCallback as Eb,forwardRef as zb,useRef as Hb,useImperativeHandle as Ob}from"react";import{useRef as Wb,useState as jb,useCallback as Yb,useMemo as Gb}from"react";import{useMemo as qb,useCallback as Vb,useRef as Xb}from"react";var Ub={RdBu:Me,PiYG:Pe,PRGn:_e,BrBG:Le,RdYlBu:Re,RdYlGn:Ie,Spectral:$e},Kb="__likert_neutral_neg",Qb="__likert_neutral_pos";function Zb(e,t){if("function"==typeof e)return e;const o=e||t;return e=>e[o]}function Jb(e,t,o,r,n,i){const a=new Map,s=new Set(t);for(const l of e){const e=o(l);a.has(e)||a.set(e,new Map);const c=a.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(!s.has(e))continue;c.set(e,(c.get(e)||0)+(Number.isFinite(t)?t:0))}}const l=[];for(const[e,o]of a){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],a=o.get(i)||0;l.push({__likertCategory:e,__likertLevel:i,__likertLevelLabel:i,__likertCount:a,__likertPct:a/r*100,__likertLevelIndex:n})}}return l}function ev(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:Kb,__likertPct:-e}),i.push({...t,__likertLevel:Qb,__likertPct:e})}else i.push(n>e?{...t,__likertPct:-t.__likertPct}:t)}return i}function tv(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 a=[];for(const[,e]of i){const t=new Map;let i,s;for(const o of e)o.__likertLevel===Kb?i=o:o.__likertLevel===Qb?s=o:t.set(o.__likertLevelIndex,o);r&&i&&a.push(i);for(let e=n-1;e>=0;e--){const o=t.get(e);o&&a.push(o)}r&&s&&a.push(s);for(let e=r?n+1:n;o>e;e++){const o=t.get(e);o&&a.push(o)}}return a}var ov=["Very Low","Low","Neutral","High","Very High"];import{jsx as rv}from"react/jsx-runtime";var nv=new Map,iv=zb(function(e,t){const o=wm(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=Hb(null),{data:n,margin:i,className:a,categoryAccessor:s="question",valueAccessor:l,levelAccessor:c,countAccessor:u="count",levels:d=ov,orientation:h="horizontal",colorScheme:p,barPadding:f=20,tooltip:m,annotations:g,valueExtent:y,frameProps:b={},selection:v,linkedHover:x,onObservation:w,onClick:k,hoverHighlight:S,chartId:A,valueFormat:C,loading:M,loadingContent:P,emptyContent:_,legendInteraction:L,legendPosition:R,categoryFormat:I,stroke:$,strokeWidth:T,opacity:N}=e,{width:F,height:D,enableHover:B,showGrid:E,showLegend:z,title:H,description:O,summary:W,accessibleTable:j,categoryLabel:Y,valueLabel:G}=o,q="horizontal"===h,V=void 0===n,X=!c,U=function(){const e=om();return e?.colors?.diverging||void 0}(),K=Bb(()=>p&&Array.isArray(p)&&p.length>=d.length?p:function(e,t){if(0>=e)return[];if(t){const o=Ub[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,a=Math.floor(e/2),s=[];for(let e=0;a>e;e++)s.push(o[Math.min(Math.floor(e*o.length/a),o.length-1)]);i&&s.push(n);for(let e=0;a>e;e++)s.push(r[Math.min(Math.floor(e*r.length/a),r.length-1)]);return s}(d.length,U),[p,d.length,U]),Q=Bb(()=>{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:a,frameRef:s}){const l=!n,c=qb(()=>Zb(o,"question"),[o]),u=qb(()=>l?Zb(r,"score"):null,[l,r]),d=qb(()=>l?null:Zb(n,"level"),[l,n]),h=qb(()=>l?null:Zb(i,"count"),[l,i]),p=e||[],f=Xb([]);return{processedData:qb(()=>{if(0===p.length)return[];let e=Jb(p,t,c,u,d,h);return a&&(e=ev(e,t),e=tv(e,t)),e},[p,t,c,u,d,h,a]),reAggregate:Vb(e=>{let o=Jb(e,t,c,u,d,h);a&&(o=ev(o,t),o=tv(o,t)),s.current?.replace(o)},[t,c,u,d,h,a,s]),accumulatorRef:f}}({data:n,levels:d,categoryAccessor:s,valueAccessor:l,levelAccessor:c,countAccessor:u,isDiverging:q,frameRef:r}),te="__likertLevelLabel",oe=function({isPushMode:e,colorBy:t,colorScheme:o,showLegend:r,legendPosition:n="right"}){const i=Wb(new Set),a=Wb([]),[s,l]=jb(0),c=Vp(),u=hm(),d=Yb(e=>{if(!t)return null;const o="function"==typeof t?t(e):e[t];return null!=o?o+"":null},[t]),h=Yb(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),a.current.push(t),r=!0)}r&&l(e=>e+1)},[e,t,d]),p=Yb(o=>{if(!e||!t)return;const r=Array.from(new Set(o.map(String))),n=a.current;n.length===r.length&&n.every((e,t)=>e===r[t])||(i.current=new Set(r),a.current=r,l(e=>e+1))},[e,t]),f=Yb(e=>t=>{h([t]),e(t)},[h]),m=Yb(e=>t=>{h(t),e(t)},[h]),g=Yb(()=>{i.current=new Set,a.current=[],l(e=>e+1)},[]);Tf(e&&t?a.current:[]);const y=Gb(()=>{if(!e||!t||!1===r)return;const n=a.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:Fe,s="string"==typeof t?t:"__streamCat",l=n.map(e=>({[s]:e})),d=He(l,s,i);return Ef({data:l,colorBy:s,colorScale:e=>c?.[e]||d(e)||"#999",getColor:Ee})},[e,t,r,o,c,u,s]),b=Gb(()=>{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:m,resetCategories:g,categories:a.current,categoryDomainProps:e&&t?{legendCategoryAccessor:t,onCategoriesChange:p}:{},streamingLegend:y,streamingMarginAdjust:b}}({isPushMode:V,colorBy:te,colorScheme:K,showLegend:z,legendPosition:R}),re=Eb(oe.wrapPush(e=>{ee.current.push(e),J(ee.current)}),[oe.wrapPush,J,ee]),ne=Eb(oe.wrapPushMany(e=>{ee.current.push(...e),J(ee.current)}),[oe.wrapPushMany,J,ee]);Ob(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=Nm({data:Z,rawData:n,colorBy:te,colorScheme:K,legendInteraction:L,legendPosition:R,selection:v,linkedHover:x,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:w,onClick:k,hoverHighlight:S,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"LikertChart",chartId:A,showLegend:z,userMargin:i,marginDefaults:o.marginDefaults,loading:M,loadingContent:P,emptyContent:_,width:F,height:D}),ae=Bb(()=>{const e=d.length;return e%2!=0&&Q.get(d[Math.floor(e/2)])||"#888"},[d,Q]),se=_b({colorBy:void 0,colorScale:void 0,color:void 0,themeCategorical:void 0,colorScheme:void 0,categoryIndexMap:nv,userPieceStyle:b?.pieceStyle,stroke:$,strokeWidth:T,opacity:N,effectiveSelectionHook:ie.effectiveSelectionHook,resolvedSelection:ie.resolvedSelection,baseStyleExtras:e=>{const t=e.__likertLevelLabel||e.data?.__likertLevelLabel,o=e.__likertLevel||e.data?.__likertLevel;if(o===Kb||o===Qb)return{fill:ae};const r=t||o;return r&&Q.has(r)?{fill:Q.get(r)}:{fill:"#888"}}}),le=Bb(()=>{const e=d.length;return e%2!=0?d[Math.floor(e/2)]:""},[d]),ce=Bb(()=>e=>{const t=e.data||e,o=t.__likertLevel||"Unknown",r=o===Kb||o===Qb?le:o,n=t.__likertCategory||"",i=Math.abs(t.__likertPct||0),a=o===Kb||o===Qb?2*i:i,s=t.__likertCount||0;return Db.createElement("div",{className:"semiotic-tooltip",style:us},Db.createElement("div",{style:{fontWeight:"bold"}},n),Db.createElement("div",{style:{marginTop:4}},`${r}: ${a.toFixed(1)}% (n=${s})`))},[le]),ue=Bb(()=>{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:s};return X?l&&(e.valueAccessor=l):(c&&(e.levelAccessor=c),u&&(e.countAccessor=u)),Mm({componentName:"LikertChart",data:n,accessors:e,requiredProps:{levels:d}})},[n,s,l,c,u,d,X]),de=Bb(()=>[{styleFn:e=>({fill:Q.get(e.label)||"#888"}),items:d.map(e=>({label:e})),label:""}],[d,Q]),he=Bb(()=>!1!==z?{...ie.legendBehaviorProps,legend:{legendGroups:de},legendPosition:R||ie.legendPosition||"bottom"}:ie.legendBehaviorProps,[ie.legendBehaviorProps,ie.legendPosition,R,z,de]),pe=Bb(()=>{const e={...ie.margin};if(V&&!1!==z){const t=R||"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 q&&100>e.left&&(e.left=100),e},[ie.margin,oe.streamingMarginAdjust,q,V,z,R]),fe=Bb(()=>C||(q?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[q,C]);if(ie.earlyReturn)return ie.earlyReturn;const me={chartType:"bar",...null!=n&&{data:Z},oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:q?"horizontal":"vertical",pieceStyle:se,size:[F,D],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:pe,barPadding:f,enableHover:B,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:Y,rLabel:G||(q?void 0:"Percentage"),rFormat:fe,...I&&{oFormat:I},showGrid:E,...he,...H&&{title:H},...O&&{description:O},...W&&{summary:W},...void 0!==j&&{accessibleTable:j},...a&&{className:a},...null!=e.animate&&{animate:e.animate},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},tooltipContent:!1===m?()=>null:!0===m?ce:gs(m)||ce,..._p({linkedHover:x,selection:v,onObservation:w,onClick:k,hoverHighlight:S,mobileInteraction:ie.mobileInteraction,customHoverBehavior:ie.customHoverBehavior,customClickBehavior:ie.customClickBehavior}),...g&&g.length>0&&{annotations:g},...y&&{rExtent:y},...Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e))};return ue?rv(Bh,{componentName:"LikertChart",message:ue,width:F,height:D}):rv(Wh,{componentName:"LikertChart",width:F,height:D,children:rv(hu,{ref:r,...me})})});iv.displayName="LikertChart";import{useMemo as av,forwardRef as sv,useRef as lv}from"react";import{useCallback as cv,useRef as uv}from"react";function dv({brushProp:e,onBrushProp:t,linkedBrush:o,valueAccessor:r}){const n=zf("string"==typeof o?o:o?{name:o.name,xField:o.rField}:void 0),i="string"==typeof r?r:"value",a=vf({name:n?.name||"__unused_ordinal_brush__",xField:n?.xField||i}),s=uv(a.brushInteraction);s.current=a.brushInteraction;const l=cv(e=>{if(n){s.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}:{}}}import{jsx as hv}from"react/jsx-runtime";var pv=sv(function(e,t){const o=wm(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}),n=lv(null);Dm(t,{variant:"xy",frameRef:n});const{data:i,margin:a,className:s,categoryAccessor:l="category",valueAccessor:c="value",orientation:u="vertical",valueFormat:d,colorBy:h,colorScheme:p,sizeBy:f,sizeRange:m=[3,8],symbolBy:g,symbolMap:y,pointRadius:b=4,pointOpacity:v=.7,categoryPadding:x=20,tooltip:w,annotations:k,valueExtent:S,brush:A,onBrush:C,linkedBrush:M,frameProps:P={},selection:_,linkedHover:L,onObservation:R,onClick:$,hoverHighlight:T,chartId:N,loading:F,loadingContent:D,emptyContent:B,legendInteraction:E,legendPosition:z,color:H,stroke:O,strokeWidth:W,opacity:j,showCategoryTicks:Y,categoryFormat:G}=e,{width:q,height:V,enableHover:X,showGrid:U,showLegend:K,title:Q,description:Z,summary:J,accessibleTable:ee,categoryLabel:te,valueLabel:oe}=o,re=av(()=>I(i),[i]),ne=Nm({data:re,rawData:i,colorBy:h,colorScheme:p,legendInteraction:E,legendPosition:z,selection:_,linkedHover:L,fallbackFields:h?["string"==typeof h?h:""]:["string"==typeof l?l:""],unwrapData:!0,onObservation:R,onClick:$,hoverHighlight:T,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"SwarmPlot",chartId:N,showLegend:K,userMargin:a,marginDefaults:o.marginDefaults,loading:F,loadingContent:D,emptyContent:B,width:q,height:V}),ie=dv({brushProp:A,onBrushProp:C,linkedBrush:M,valueAccessor:c}),ae=av(()=>{if(!f)return;const e=re.map(e=>"function"==typeof f?f(e):e[f]);return r(e)},[re,f]),se=hm(),le=av(()=>new Map,[re]),ce=_b({colorBy:h,colorScale:ne.colorScale,color:H,themeCategorical:se,colorScheme:p,categoryIndexMap:le,userPieceStyle:P?.pieceStyle,stroke:O,strokeWidth:W,opacity:j,effectiveSelectionHook:ne.effectiveSelectionHook,resolvedSelection:ne.resolvedSelection,baseStyleExtras:e=>({fillOpacity:v,r:f?Oe(e,f,m,ae):b})}),ue=av(()=>Ll({categoryAccessor:l,valueAccessor:c,groupAccessor:h||void 0,valueFormat:d}),[l,c,h,d]);if(ne.earlyReturn)return ne.earlyReturn;const de=Mm({componentName:"SwarmPlot",data:i,accessors:{categoryAccessor:l,valueAccessor:c}});if(de)return hv(Bh,{componentName:"SwarmPlot",message:de,width:q,height:V});const he={chartType:"swarm",...null!=i&&{data:re},oAccessor:l,rAccessor:c,...g&&{symbolAccessor:g},...y&&{symbolMap:y},projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:ce,size:[q,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,...G&&{oFormat:G},showGrid:U,showCategoryTicks:Y,...ne.legendBehaviorProps,...Pp({title:Q,description:Z,summary:J,accessibleTable:ee,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Lp({tooltip:w,defaultTooltipContent:ue}),..._p({linkedHover:L,selection:_,onObservation:R,onClick:$,hoverHighlight:T,mobileInteraction:ne.mobileInteraction,customHoverBehavior:ne.customHoverBehavior,customClickBehavior:ne.customClickBehavior}),...k&&k.length>0&&{annotations:k},...S&&{rExtent:S},...ie.brushStreamProps,...Object.fromEntries(Object.entries(P).filter(([e])=>"pieceStyle"!==e))};return hv(Wh,{componentName:"SwarmPlot",width:q,height:V,children:hv(hu,{ref:n,...he})})});pv.displayName="SwarmPlot";import{useMemo as fv,forwardRef as mv,useRef as gv}from"react";import{jsx as yv,jsxs as bv}from"react/jsx-runtime";function vv(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 bv("div",{className:"semiotic-tooltip",style:us,children:[o&&yv("div",{style:{fontWeight:"bold"},children:o+""}),null!=r.n&&bv("div",{children:["n = ",r.n]}),null!=r.min&&bv("div",{children:["Min: ",r.min.toLocaleString()]}),null!=r.q1&&bv("div",{children:["Q1: ",r.q1.toLocaleString()]}),bv("div",{children:["Median: ",r.median.toLocaleString()]}),null!=r.q3&&bv("div",{children:["Q3: ",r.q3.toLocaleString()]}),null!=r.max&&bv("div",{children:["Max: ",r.max.toLocaleString()]}),null!=r.mean&&bv("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,a=i>0?i%2!=0?n[Math.floor(i/2)]:(n[i/2-1]+n[i/2])/2:null;return bv("div",{className:"semiotic-tooltip",style:us,children:[o&&yv("div",{style:{fontWeight:"bold"},children:o+""}),i>0&&bv("div",{children:["n = ",i]}),null!=a&&bv("div",{children:["Median: ",a.toLocaleString()]})]})}return yv("div",{className:"semiotic-tooltip",style:us,children:yv("div",{style:{fontWeight:"bold"},children:o+""})})}}import{jsx as xv}from"react/jsx-runtime";var wv=mv(function(e,t){const o=wm(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=gv(null);Dm(t,{variant:"xy",frameRef:r});const{data:n,margin:i,className:a,categoryAccessor:s="category",valueAccessor:l="value",orientation:c="vertical",valueFormat:u,colorBy:d,colorScheme:h,showOutliers:p=!0,outlierRadius:f=3,categoryPadding:m=20,tooltip:g,annotations:y,valueExtent:b,frameProps:v={},selection:x,linkedHover:w,onObservation:k,onClick:S,hoverHighlight:A,chartId:C,loading:M,loadingContent:P,emptyContent:_,legendInteraction:L,legendPosition:R,color:$,stroke:T,strokeWidth:N,opacity:F,showCategoryTicks:D,categoryFormat:B}=e,{width:E,height:z,enableHover:H,showGrid:O,showLegend:W,title:j,description:Y,summary:G,accessibleTable:q,categoryLabel:V,valueLabel:X}=o,U=fv(()=>I(n),[n]),K=Nm({data:U,rawData:n,colorBy:d,colorScheme:h,legendInteraction:L,legendPosition:R,selection:x,linkedHover:w,fallbackFields:d?["string"==typeof d?d:""]:["string"==typeof s?s:""],unwrapData:!0,onObservation:k,onClick:S,hoverHighlight:A,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"BoxPlot",chartId:C,showLegend:W,userMargin:i,marginDefaults:o.marginDefaults,loading:M,loadingContent:P,emptyContent:_,width:E,height:z}),Q=hm(),Z=fv(()=>new Map,[U]),J=_b({colorBy:d,colorScale:K.colorScale,color:$,themeCategorical:Q,colorScheme:h,categoryIndexMap:Z,userPieceStyle:void 0,stroke:T,strokeWidth:N,opacity:F,effectiveSelectionHook:K.effectiveSelectionHook,resolvedSelection:K.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),ee=fv(()=>vv(),[]);if(K.earlyReturn)return K.earlyReturn;const te=Mm({componentName:"BoxPlot",data:n,accessors:{categoryAccessor:s,valueAccessor:l}});if(te)return xv(Bh,{componentName:"BoxPlot",message:te,width:E,height:z});const oe={chartType:"boxplot",...null!=n&&{data:U},oAccessor:s,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",summaryStyle:J,showOutliers:p,size:[E,z],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:K.margin,barPadding:m,enableHover:H,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:V,rLabel:X,rFormat:u,...B&&{oFormat:B},showGrid:O,showCategoryTicks:D,...K.legendBehaviorProps,...Pp({title:j,description:Y,summary:G,accessibleTable:q,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Lp({tooltip:g,defaultTooltipContent:ee}),..._p({linkedHover:w,selection:x,onObservation:k,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 xv(Wh,{componentName:"BoxPlot",width:E,height:z,children:xv(hu,{ref:r,...oe})})});wv.displayName="BoxPlot";import{useMemo as kv,forwardRef as Sv,useRef as Av}from"react";import{jsx as Cv,jsxs as Mv}from"react/jsx-runtime";var Pv=e=>{const t=e?.category;return null==t?"All":t+""},_v=Sv(function(e,t){const o=wm(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=Av(null);Dm(t,{variant:"xy",frameRef:r});const{data:n,margin:i,className:a,categoryAccessor:s=Pv,valueAccessor:l="value",bins:c=25,relative:u=!1,valueFormat:d,colorBy:h,colorScheme:p,categoryPadding:f=20,tooltip:m,annotations:g,valueExtent:y,brush:b,onBrush:v,linkedBrush:x,frameProps:w={},selection:k,linkedHover:S,onObservation:A,onClick:C,hoverHighlight:M,chartId:P,loading:_,loadingContent:L,emptyContent:R,legendInteraction:$,legendPosition:T,color:N,stroke:F,strokeWidth:D,opacity:B,showCategoryTicks:E,categoryFormat:z}=e,{width:H,height:O,enableHover:W,showGrid:j,showLegend:Y,title:G,description:q,summary:V,accessibleTable:X,categoryLabel:U,valueLabel:K}=o,Q=kv(()=>I(n),[n]),Z=Nm({data:Q,rawData:n,colorBy:h,colorScheme:p,legendInteraction:$,legendPosition:T,selection:k,linkedHover:S,fallbackFields:h?["string"==typeof h?h:""]:["string"==typeof s?s:""],unwrapData:!0,onObservation:A,onClick:C,hoverHighlight:M,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"Histogram",chartId:P,showLegend:Y,userMargin:i,marginDefaults:o.marginDefaults,loading:_,loadingContent:L,emptyContent:R,width:H,height:O}),J=dv({brushProp:b,onBrushProp:v,linkedBrush:x,valueAccessor:l}),ee=kv(()=>{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=hm(),oe=kv(()=>new Map,[Q]),re=_b({colorBy:h,colorScale:Z.colorScale,color:N,themeCategorical:te,colorScheme:p,categoryIndexMap:oe,userPieceStyle:void 0,stroke:F,strokeWidth:D,opacity:B,effectiveSelectionHook:Z.effectiveSelectionHook,resolvedSelection:Z.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),ne=kv(()=>e=>{const t=e.data||e,o=t.category||e.category||"",r=t.count,n=t.range;return Mv("div",{className:"semiotic-tooltip",style:us,children:[o&&Cv("div",{style:{fontWeight:"bold"},children:o+""}),null!=r&&Mv("div",{children:["Count: ",r]}),n&&2===n.length&&Mv("div",{style:{opacity:.8},children:[Number(n[0]).toFixed(1)," – ",Number(n[1]).toFixed(1)]})]})},[]);if(Z.earlyReturn)return Z.earlyReturn;const ie=Mm({componentName:"Histogram",data:n,accessors:{categoryAccessor:s,valueAccessor:l}});if(ie)return Cv(Bh,{componentName:"Histogram",message:ie,width:H,height:O});const ae={chartType:"histogram",...null!=n&&{data:Q},oAccessor:s,rAccessor:l,projection:"horizontal",summaryStyle:re,bins:c,normalize:u,...y?{rExtent:y}:ee&&{rExtent:ee},size:[H,O],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Z.margin,barPadding:f,enableHover:W,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:U,rLabel:K,rFormat:d,...z&&{oFormat:z},showGrid:j,showCategoryTicks:E,...Z.legendBehaviorProps,...Pp({title:G,description:q,summary:V,accessibleTable:X,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Lp({tooltip:m,defaultTooltipContent:ne}),..._p({linkedHover:S,selection:k,onObservation:A,onClick:C,hoverHighlight:M,mobileInteraction:Z.mobileInteraction,customHoverBehavior:Z.customHoverBehavior,customClickBehavior:Z.customClickBehavior}),...g&&g.length>0&&{annotations:g},...J.brushStreamProps,...Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e))};return Cv(Wh,{componentName:"Histogram",width:H,height:O,children:Cv(hu,{ref:r,...ae})})});_v.displayName="Histogram";import{useMemo as Lv,forwardRef as Rv,useRef as Iv}from"react";import{jsx as $v}from"react/jsx-runtime";var Tv=Rv(function(e,t){const o=wm(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=Iv(null);Dm(t,{variant:"xy",frameRef:r});const{data:n,margin:i,className:a,categoryAccessor:s="category",valueAccessor:l="value",orientation:c="vertical",bins:u=25,curve:d="catmullRom",showIQR:h=!0,valueFormat:p,colorBy:f,colorScheme:m,categoryPadding:g=20,tooltip:y,annotations:b,valueExtent:v,brush:x,onBrush:w,linkedBrush:k,frameProps:S={},selection:A,linkedHover:C,onObservation:M,onClick:P,hoverHighlight:_,chartId:L,loading:R,loadingContent:$,emptyContent:T,legendInteraction:N,legendPosition:F,color:D,stroke:B,strokeWidth:E,opacity:z,showCategoryTicks:H,categoryFormat:O}=e,{width:W,height:j,enableHover:Y,showGrid:G,showLegend:q,title:V,description:X,summary:U,accessibleTable:K,categoryLabel:Q,valueLabel:Z}=o,J=Lv(()=>I(n),[n]),ee=Nm({data:J,rawData:n,colorBy:f,colorScheme:m,legendInteraction:N,legendPosition:F,selection:A,linkedHover:C,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof s?s:""],unwrapData:!0,onObservation:M,onClick:P,hoverHighlight:_,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"ViolinPlot",chartId:L,showLegend:q,userMargin:i,marginDefaults:o.marginDefaults,loading:R,loadingContent:$,emptyContent:T,width:W,height:j}),te=dv({brushProp:x,onBrushProp:w,linkedBrush:k,valueAccessor:l}),oe=hm(),re=Lv(()=>new Map,[J]),ne=_b({colorBy:f,colorScale:ee.colorScale,color:D,themeCategorical:oe,colorScheme:m,categoryIndexMap:re,userPieceStyle:void 0,stroke:B,strokeWidth:E,opacity:z,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection,baseStyleExtras:{fillOpacity:.6},linkStrokeToFill:!0}),ie=Lv(()=>vv({valueAccessor:l}),[l]);if(ee.earlyReturn)return ee.earlyReturn;const ae=Mm({componentName:"ViolinPlot",data:n,accessors:{categoryAccessor:s,valueAccessor:l}});if(ae)return $v(Bh,{componentName:"ViolinPlot",message:ae,width:W,height:j});const se={chartType:"violin",...null!=n&&{data:J},oAccessor:s,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",summaryStyle:ne,bins:u,showIQR:h,size:[W,j],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ee.margin,barPadding:g,enableHover:Y,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:Q,rLabel:Z,rFormat:p,...O&&{oFormat:O},showGrid:G,showCategoryTicks:H,...ee.legendBehaviorProps,...Pp({title:V,description:X,summary:U,accessibleTable:K,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Lp({tooltip:y,defaultTooltipContent:ie}),..._p({linkedHover:C,selection:A,onObservation:M,onClick:P,hoverHighlight:_,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 $v(Wh,{componentName:"ViolinPlot",width:W,height:j,children:$v(hu,{ref:r,...se})})});Tv.displayName="ViolinPlot";import{useMemo as Nv,forwardRef as Fv,useRef as Dv}from"react";import{jsx as Bv}from"react/jsx-runtime";var Ev=Fv(function(e,t){const o=wm(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=Dv(null);Dm(t,{variant:"xy",frameRef:r});const{data:n,margin:i,className:a,categoryAccessor:s="category",valueAccessor:l="value",orientation:c="horizontal",bins:u=20,amplitude:d=1.5,valueFormat:h,colorBy:p,colorScheme:f,categoryPadding:m=5,tooltip:g,annotations:y,valueExtent:b,frameProps:v={},selection:x,linkedHover:w,onObservation:k,onClick:S,hoverHighlight:A,chartId:C,loading:M,loadingContent:P,emptyContent:_,legendInteraction:L,legendPosition:R,color:$,stroke:T,strokeWidth:N,opacity:F,showCategoryTicks:D,categoryFormat:B}=e,{width:E,height:z,enableHover:H,showGrid:O,showLegend:W,title:j,description:Y,summary:G,accessibleTable:q,categoryLabel:V,valueLabel:X}=o,U=Nv(()=>I(n),[n]),K=Nm({data:U,rawData:n,colorBy:p,colorScheme:f,legendInteraction:L,legendPosition:R,selection:x,linkedHover:w,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof s?s:""],unwrapData:!0,onObservation:k,onClick:S,hoverHighlight:A,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"RidgelinePlot",chartId:C,showLegend:W,userMargin:i,marginDefaults:o.marginDefaults,loading:M,loadingContent:P,emptyContent:_,width:E,height:z}),Q=hm(),Z=Nv(()=>new Map,[U]),J=_b({colorBy:p,colorScale:K.colorScale,color:$,themeCategorical:Q,colorScheme:f,categoryIndexMap:Z,userPieceStyle:void 0,stroke:T,strokeWidth:N,opacity:F,effectiveSelectionHook:K.effectiveSelectionHook,resolvedSelection:K.resolvedSelection,baseStyleExtras:{fillOpacity:.5},linkStrokeToFill:!0}),ee=Nv(()=>vv(),[]);if(K.earlyReturn)return K.earlyReturn;const te=Mm({componentName:"RidgelinePlot",data:n,accessors:{categoryAccessor:s,valueAccessor:l}});if(te)return Bv(Bh,{componentName:"RidgelinePlot",message:te,width:E,height:z});const oe={chartType:"ridgeline",...null!=n&&{data:U},oAccessor:s,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",summaryStyle:J,bins:u,size:[E,z],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:K.margin,barPadding:m,enableHover:H,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:V,rLabel:X,rFormat:h,...B&&{oFormat:B},showGrid:O,showCategoryTicks:D,oSort:!1,amplitude:d,...K.legendBehaviorProps,...Pp({title:j,description:Y,summary:G,accessibleTable:q,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Lp({tooltip:g,defaultTooltipContent:ee}),..._p({linkedHover:w,selection:x,onObservation:k,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 Bv(Wh,{componentName:"RidgelinePlot",width:E,height:z,children:Bv(hu,{ref:r,...oe})})});Ev.displayName="RidgelinePlot";import{useMemo as zv,forwardRef as Hv,useRef as Ov}from"react";import{jsx as Wv,jsxs as jv}from"react/jsx-runtime";var Yv=Hv(function(e,t){const o=wm(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=Ov(null);Dm(t,{variant:"xy",frameRef:r});const{data:n,margin:i,className:a,stepAccessor:s="step",valueAccessor:l="value",categoryAccessor:c,colorBy:u,colorScheme:d,orientation:h="horizontal",connectorOpacity:p=.3,showLabels:f=!0,tooltip:m,annotations:g,frameProps:y={},selection:b,linkedHover:v,onObservation:x,onClick:w,hoverHighlight:k,chartId:S,loading:A,loadingContent:C,emptyContent:M,legendInteraction:P,legendPosition:_,color:L,stroke:R,strokeWidth:$,opacity:T,categoryFormat:N}=e,F="vertical"===h,{width:D,height:B,enableHover:E,showLegend:z,title:H,description:O,summary:W,accessibleTable:j}=o,Y=F?{top:H?60:40,right:20,bottom:60,left:60}:{top:H?40:10,right:10,bottom:10,left:10},G=zv(()=>I(n),[n]),q=u||c,V=!q,X=Nm({data:G,rawData:n,colorBy:q,colorScheme:d,legendInteraction:P,legendPosition:_,selection:b,linkedHover:v,fallbackFields:q?["string"==typeof q?q:""]:[],unwrapData:!0,onObservation:x,onClick:w,hoverHighlight:k,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"FunnelChart",chartId:S,showLegend:z,userMargin:i,marginDefaults:Y,loading:A,loadingContent:C,emptyContent:M,width:D,height:B});Vh("FunnelChart",G,"stepAccessor",s),Vh("FunnelChart",G,"valueAccessor",l);const U=hm(),K=zv(()=>new Map,[G]),Q=zv(()=>{if(V)return L||(U?.[0]?U[0]:Array.isArray(d)&&d[0]?d[0]:"#4e79a7")},[V,L,U,d]),Z=_b({colorBy:Q?void 0:q,colorScale:X.colorScale,color:Q??L,themeCategorical:U,colorScheme:d,categoryIndexMap:K,userPieceStyle:y?.pieceStyle,stroke:R,strokeWidth:$,opacity:T,effectiveSelectionHook:X.effectiveSelectionHook,resolvedSelection:X.resolvedSelection}),J=zv(()=>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,a=t?.__barFunnelIsDropoff,s=t?.__barFunnelCategory??t?.category,l=null==n||i?"":` (${.05>Math.abs(n-Math.round(n))?Math.round(n)+"%":n.toFixed(1)+"%"})`;return jv("div",{className:"semiotic-tooltip",style:us,children:[o&&Wv("div",{style:{fontWeight:"bold"},children:o+""}),s&&s!==o&&Wv("div",{style:{marginTop:2,opacity:.8},children:s+""}),a&&Wv("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7},children:"Dropoff"}),jv("div",{style:{marginTop:4},children:[r+"",l]})]})},[]);if(X.earlyReturn)return X.earlyReturn;const ee=Mm({componentName:"FunnelChart",data:n,accessors:{stepAccessor:s,valueAccessor:l}});if(ee)return Wv(Bh,{componentName:"FunnelChart",message:ee,width:D,height:B});const te={chartType:F?"bar-funnel":"funnel",...null!=n&&{data:G},oAccessor:s,rAccessor:l,...c&&{stackBy:c},projection:F?"vertical":"horizontal",barPadding:F?40:0,pieceStyle:Z,size:[D,B],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:X.margin,enableHover:E,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:F,showCategoryTicks:F,...N&&{oFormat:N},showGrid:F,...!F&&{connectorOpacity:p},showLabels:f,...X.legendBehaviorProps,...H&&{title:H},...O&&{description:O},...W&&{summary:W},...void 0!==j&&{accessibleTable:j},...a&&{className:a},...null!=e.animate&&{animate:e.animate},tooltipContent:!1===m?()=>null:!0===m||null==m?J:gs(m)||J,..._p({linkedHover:v,selection:b,onObservation:x,onClick:w,hoverHighlight:k,mobileInteraction:X.mobileInteraction,customHoverBehavior:X.customHoverBehavior,customClickBehavior:X.customClickBehavior}),...g&&g.length>0&&{annotations:g},...Object.fromEntries(Object.entries(y).filter(([e])=>"pieceStyle"!==e))};return Wv(Wh,{componentName:"FunnelChart",width:D,height:B,children:Wv(hu,{ref:r,...te})})});Yv.displayName="FunnelChart";import{useMemo as Gv,forwardRef as qv,useRef as Vv}from"react";import{jsx as Xv}from"react/jsx-runtime";var Uv=qv(function(e,t){const o=wm(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=Vv(null);Dm(t,{variant:"xy",frameRef:r});const{data:n,margin:i,className:a,categoryAccessor:s="category",valueAccessor:l="value",orientation:c="horizontal",valueFormat:u,colorBy:d,colorScheme:h,sort:p="auto",dotRadius:f=5,categoryPadding:m=10,tooltip:g,annotations:y,regression:b,valueExtent:v,frameProps:x={},selection:w,linkedHover:k,onObservation:S,onClick:A,hoverHighlight:C,chartId:M,loading:P,loadingContent:_,emptyContent:L,legendInteraction:R,legendPosition:$,color:T,stroke:N,strokeWidth:F,opacity:D,categoryFormat:B}=e,{width:E,height:z,enableHover:H,showGrid:O,showLegend:W,title:j,description:Y,summary:G,accessibleTable:q,categoryLabel:V,valueLabel:X}=o,U=Gv(()=>I(n),[n]),K=Nm({data:U,rawData:n,colorBy:d,colorScheme:h,legendInteraction:R,legendPosition:$,selection:w,linkedHover:k,fallbackFields:d?["string"==typeof d?d:""]:["string"==typeof s?s:""],unwrapData:!0,onObservation:S,onClick:A,hoverHighlight:C,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"DotPlot",chartId:M,showLegend:W,userMargin:i,marginDefaults:o.marginDefaults,loading:P,loadingContent:_,emptyContent:L,width:E,height:z}),Q=mm(U,p,l),Z=hm(),J=Gv(()=>new Map,[U]),ee=_b({colorBy:d,colorScale:K.colorScale,color:T,themeCategorical:Z,colorScheme:h,categoryIndexMap:J,userPieceStyle:x?.pieceStyle,stroke:N,strokeWidth:F,opacity:D,effectiveSelectionHook:K.effectiveSelectionHook,resolvedSelection:K.resolvedSelection,baseStyleExtras:{r:f,fillOpacity:.8}}),te=Gv(()=>Ll({categoryAccessor:s,valueAccessor:l,valueFormat:u}),[s,l,u]);if(K.earlyReturn)return K.earlyReturn;const oe=Mm({componentName:"DotPlot",data:n,accessors:{categoryAccessor:s,valueAccessor:l}});if(oe)return Xv(Bh,{componentName:"DotPlot",message:oe,width:E,height:z});const re=Gm(b),ne=re?[re,...y||[]]:y,ie={chartType:"point",...null!=n&&{data:Q},oAccessor:s,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",pieceStyle:ee,size:[E,z],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:K.margin,barPadding:m,enableHover:H,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:V,rLabel:X,rFormat:u,...B&&{oFormat:B},showGrid:O,oSort:p,...K.legendBehaviorProps,...Pp({title:j,description:Y,summary:G,accessibleTable:q,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Lp({tooltip:g,defaultTooltipContent:te}),..._p({linkedHover:k,selection:w,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 Xv(Wh,{componentName:"DotPlot",width:E,height:z,children:Xv(hu,{ref:r,...ie})})});Uv.displayName="DotPlot";import{useMemo as Kv,forwardRef as Qv,useRef as Zv}from"react";import{jsx as Jv}from"react/jsx-runtime";var ex=Qv(function(e,t){const o=wm(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=Zv(null),{data:n,margin:i,className:a,categoryAccessor:s="category",valueAccessor:l="value",colorBy:c,colorScheme:u,startAngle:d=0,cornerRadius:h,tooltip:p,annotations:f,frameProps:m={},selection:g,linkedHover:y,onObservation:b,onClick:v,hoverHighlight:x,chartId:w,loading:k,loadingContent:S,emptyContent:A,legendInteraction:C,legendPosition:M,color:P,stroke:_,strokeWidth:L,opacity:R}=e,{width:$,height:T,enableHover:N,showLegend:F,title:D,description:B,summary:E,accessibleTable:z}=o,H=Kv(()=>I(n),[n]),O=c||s,W=Nm({data:H,rawData:n,colorBy:O,colorScheme:u,legendInteraction:C,legendPosition:M,selection:g,linkedHover:y,fallbackFields:O?["string"==typeof O?O:""]:[],unwrapData:!0,onObservation:b,onClick:v,hoverHighlight:x,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"PieChart",chartId:w,showLegend:F,userMargin:i,marginDefaults:o.marginDefaults,loading:k,loadingContent:S,emptyContent:A,width:$,height:T}),j=hm(),Y=Kv(()=>new Map,[H]),G=_b({colorBy:O,colorScale:W.colorScale,color:P,themeCategorical:j,colorScheme:u,categoryIndexMap:Y,userPieceStyle:m?.pieceStyle,stroke:_,strokeWidth:L,opacity:R,effectiveSelectionHook:W.effectiveSelectionHook,resolvedSelection:W.resolvedSelection,cycleByCategory:!0}),q=Kv(()=>Ll({categoryAccessor:s,valueAccessor:l,groupAccessor:c&&c!==s?c:void 0,groupLabel:"string"==typeof c?c:"group",pieData:!0}),[s,l,c]),V=Mm({componentName:"PieChart",data:n,accessors:{categoryAccessor:s,valueAccessor:l}}),{effectiveLegendProps:X,effectiveMargin:U}=Mb({ref:t,frameRef:r,setup:W});if(W.earlyReturn)return W.earlyReturn;const K={chartType:"pie",...null!=n&&{data:H},oAccessor:s,rAccessor:l,projection:"radial",pieceStyle:G,startAngle:d,...null!=h&&{cornerRadius:h},size:[$,T],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:U,enableHover:N,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:!1,...X,...Pp({title:D,description:B,summary:E,accessibleTable:z,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Lp({tooltip:p,defaultTooltipContent:q}),..._p({linkedHover:y,selection:g,onObservation:b,onClick:v,hoverHighlight:x,mobileInteraction:W.mobileInteraction,customHoverBehavior:W.customHoverBehavior,customClickBehavior:W.customClickBehavior}),...f&&f.length>0&&{annotations:f},...Object.fromEntries(Object.entries(m).filter(([e])=>"pieceStyle"!==e))};return V?Jv(Bh,{componentName:"PieChart",message:V,width:$,height:T}):Jv(Wh,{componentName:"PieChart",width:$,height:T,children:Jv(hu,{ref:r,...K})})});ex.displayName="PieChart";import{useMemo as tx,forwardRef as ox,useRef as rx}from"react";import{jsx as nx}from"react/jsx-runtime";var ix=ox(function(e,t){const o=wm(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=rx(null),{data:n,margin:i,className:a,categoryAccessor:s="category",valueAccessor:l="value",innerRadius:c,centerContent:u,colorBy:d,colorScheme:h,startAngle:p=0,cornerRadius:f,tooltip:m,annotations:g,frameProps:y={},selection:b,linkedHover:v,onObservation:x,onClick:w,hoverHighlight:k,chartId:S,loading:A,loadingContent:C,emptyContent:M,legendInteraction:P,legendPosition:_,color:L,stroke:R,strokeWidth:$,opacity:T}=e,{width:N,height:F,enableHover:D,showLegend:B,title:E,description:z,summary:H,accessibleTable:O}=o,W=tx(()=>I(n),[n]),j=d||s,Y=Nm({data:W,rawData:n,colorBy:j,colorScheme:h,legendInteraction:P,legendPosition:_,selection:b,linkedHover:v,fallbackFields:j?["string"==typeof j?j:""]:[],unwrapData:!0,onObservation:x,onClick:w,hoverHighlight:k,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"DonutChart",chartId:S,showLegend:B,userMargin:i,marginDefaults:o.marginDefaults,loading:A,loadingContent:C,emptyContent:M,width:N,height:F}),G=c??Math.max(2,.15*Math.min(N,F)),q=hm(),V=tx(()=>new Map,[W]),X=_b({colorBy:j,colorScale:Y.colorScale,color:L,themeCategorical:q,colorScheme:h,categoryIndexMap:V,userPieceStyle:y?.pieceStyle,stroke:R,strokeWidth:$,opacity:T,effectiveSelectionHook:Y.effectiveSelectionHook,resolvedSelection:Y.resolvedSelection,cycleByCategory:!0}),U=tx(()=>Ll({categoryAccessor:s,valueAccessor:l,groupAccessor:d&&d!==s?d:void 0,groupLabel:"string"==typeof d?d:"group",pieData:!0}),[s,l,d]),K=Mm({componentName:"DonutChart",data:n,accessors:{categoryAccessor:s,valueAccessor:l}}),{effectiveLegendProps:Q,effectiveMargin:Z}=Mb({ref:t,frameRef:r,setup:Y});if(Y.earlyReturn)return Y.earlyReturn;const J={chartType:"donut",...null!=n&&{data:W},oAccessor:s,rAccessor:l,projection:"radial",pieceStyle:X,innerRadius:G,startAngle:p,...null!=f&&{cornerRadius:f},centerContent:u,size:[N,F],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Z,enableHover:D,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:!1,...Q,...Pp({title:E,description:z,summary:H,accessibleTable:O,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Lp({tooltip:m,defaultTooltipContent:U}),..._p({linkedHover:v,selection:b,onObservation:x,onClick:w,hoverHighlight:k,mobileInteraction:Y.mobileInteraction,customHoverBehavior:Y.customHoverBehavior,customClickBehavior:Y.customClickBehavior}),...g&&g.length>0&&{annotations:g},...Object.fromEntries(Object.entries(y).filter(([e])=>"pieceStyle"!==e))};return K?nx(Bh,{componentName:"DonutChart",message:K,width:N,height:F}):nx(Wh,{componentName:"DonutChart",width:N,height:F,children:nx(hu,{ref:r,...J})})});ix.displayName="DonutChart";import{useMemo as ax,forwardRef as sx,useRef as lx}from"react";function cx(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 ux(e){return Math.max(0,Math.min(1,e))}function dx(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 hx(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 px(e,t){const o=e.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:ux(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=ux(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,a=i>0?(r-t.offset)/i:0,s=dx(t.color),l=dx(n.color);if(!s||!l)return.5>a?t.color:n.color;const[c,u,d]=s,[h,p,f]=l;return hx(c+(h-c)*a,u+(p-u)*a,d+(f-d)*a)}return o[o.length-1].color}function fx(e,t,o){return null==o?`${e}-${t}`:`${e}-${t}-${o}`}import{jsx as mx,jsxs as gx}from"react/jsx-runtime";var yx=sx(function(e,t){const o=wm(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}),n=lx(null),i="context"===e.mode,{compactMode:a}=o,{value:s,min:l=0,max:c=100,thresholds:u,gradientFill:d,color:h,backgroundColor:p="var(--semiotic-grid, #e0e0e0)",arcWidth:f=.3,cornerRadius:m,showNeedle:g=!0,needleColor:y="var(--semiotic-text, #333)",centerContent:b,valueFormat:v,showScaleLabels:x=!a,sweep:w=240,fillZones:k=!0,tooltip:S,annotations:A,frameProps:C={},className:M,stroke:P,strokeWidth:_,opacity:L}=e,{width:R,height:I,title:$,description:T,summary:N,accessibleTable:F}=o,D=d&&"object"==typeof d?d:void 0,B=Math.max(l,Math.min(c,s)),E=c-l||1,z=(B-l)/E,{gaugeData:H,pieceStyle:O,gaugeAnnotations:W}=ax(()=>function(e){const{min:t,max:o,value:r,thresholds:n,fillColor:i,backgroundColor:a,fillZones:s,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,m=[],g=new Map,y=[];if(f){const e=s?h:1,t=fx("bg",0);if(m.push({category:t,value:1,_zone:"Track",_isFill:!1,_pctStart:0,_pct:1,_roundedEnds:{start:!0,end:!0},_nonInteractive:!0}),g.set(t,{fill:a,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(px(c.colorStops,e*(t+.5)/o));const n=fx("fill",0);m.push({category:n,value:e,_zone:"Gradient",_isFill:!0,_pctStart:0,_pct:e,_roundedEnds:{start:!0,end:!0},_nonInteractive:!0,_gradientBand:{colors:r}}),g.set(n,{fill:r[0]||a})}}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,(s?Math.min(h,l):l)-i),u=s?Math.max(0,n-c):0;if(c>0){const e=fx("fill",o);m.push({category:e,value:c,_zone:r.label||"Zone "+(o+1),_isFill:!0}),g.set(e,{fill:r.color})}if(u>0){const e=fx("bg",o);m.push({category:e,value:u,_zone:r.label||"Zone "+(o+1),_isFill:!1}),g.set(e,{fill:a,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:m,pieceStyle:(e,t)=>g.get(t||e.category)||{fill:a},gaugeAnnotations:y}}({min:l,max:c,value:s,thresholds:u,fillColor:h,backgroundColor:p,fillZones:k,showScaleLabels:x,gradientFill:D}),[s,l,c,u,h,p,x,k,D]),j=ax(()=>Em(O,{stroke:P,strokeWidth:_,opacity:L}),[O,P,_,L]),{sweepRad:Y,startAngleDeg:G}=cx(w),q=function(e=240){const{sweepRad:t,offsetRad:o}=cx(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]),a=n.map(e=>e[1]),[s,l]=r(i),[c,u]=r(a);return{minX:s,maxX:l,minY:c,maxY:u,width:l-s,height:u-c,cx:(s+l)/2,cy:(c+u)/2}}(w),V=Math.min(10,Math.max(1,Math.min(R,I)/12)),X=q.cx,U=q.cy,K=Math.max(4,Math.min((R-2*V)/q.width,(I-2*V)/q.height)-2),Q=Math.max(0,Math.min(K-1.5,K*(1-f))),Z=R/2-X*K,J=I/2-U*K,ee=2*(K+4),te=ax(()=>{if(a&&null==b)return null;if(null!=b)return"function"==typeof b?b(B,l,c):b;const e=v?v(B):Math.round(B)+"";return gx("div",{style:{textAlign:"center",lineHeight:1.2},children:[mx("div",{style:{fontSize:Math.max(16,.3*K),fontWeight:700,color:"var(--semiotic-text, #333)"},children:e}),x&&gx("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"},children:[l," – ",c]})]})},[b,B,l,c,v,x,K,a]),oe=ax(()=>i&&null==b?{type:"gauge-value",text:v?v(B):Math.round(B)+""}:null,[i,b,B,v]),re=ax(()=>{if(!g)return null;const e=-Math.PI/2+G*Math.PI/180+z*Y,t=Q>20?Q-8:K-1;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:y}},[g,z,G,Y,Q,y]),ne=ax(()=>(e,t,o)=>{if("gauge-needle"===e.type){const r=(o.width||R)/2,n=(o.height||I)/2,i=Math.max(1,K-Q),a=Math.max(1,Math.min(2.5,.4*i)),s=Math.max(1,Math.min(5,.6*i));return gx("g",{transform:`translate(${r},${n})`,children:[mx("line",{x1:0,y1:0,x2:e.tipX,y2:e.tipY,stroke:e.color,strokeWidth:a,strokeLinecap:"round"}),mx("circle",{cx:0,cy:0,r:s,fill:e.color})]},"gauge-needle-"+t)}if("gauge-label"===e.type){const r=-Math.PI/2+G*Math.PI/180+(e.value-l)/E*Y,n=(o.width||R)/2,i=(o.height||I)/2,a=Q-1,s=K+1,c=Math.cos(r)*a,u=Math.sin(r)*a,d=Math.cos(r)*s,h=Math.sin(r)*s,p=K+10,f=Math.cos(r)*p,m=Math.sin(r)*p,g=((r+Math.PI/2)/(2*Math.PI)*12+12)%12;let y,b;return g>=11||1>g?(y="middle",b="auto"):g>=1&&5>g?(y="start",b="middle"):g>=5&&7>g?(y="middle",b="hanging"):(y="end",b="middle"),gx("g",{transform:`translate(${n},${i})`,children:[mx("line",{x1:c,y1:u,x2:d,y2:h,stroke:"var(--semiotic-border)",strokeWidth:2,strokeLinecap:"round"}),mx("text",{x:f,y:m,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?mx("text",{x:(o.width||R)/2,y:(o.height||I)/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},[R,I,l,E,G,Y,Q,K]),ie=ax(()=>{const e=[...W,...A||[]];return re&&e.push(re),oe&&e.push(oe),e},[W,A,re,oe]),ae=ax(()=>e=>{const t=e?.data?.[0]||e?.data||e,o=t?._zone||"",r=t?._isFill;return gx("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:[mx("div",{style:{fontWeight:600},children:o}),mx("div",{style:{fontSize:"0.85em",color:"var(--semiotic-text-secondary, #666)"},children:r?"Current: "+Math.round(B):"Remaining"})]})},[B]);if(0===H.length)return mx(Bh,{componentName:"GaugeChart",message:"No data to display",width:R,height:I});const se={chartType:"donut",data:H,oAccessor:"category",rAccessor:"value",oSort:!1,projection:"radial",pieceStyle:j,innerRadius:Q,startAngle:G,sweepAngle:w,...null!=m&&{cornerRadius:m},centerContent:te,size:[R,I],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:{top:J-ee/2,bottom:I-J-ee/2,left:Z-ee/2,right:R-Z-ee/2},enableHover:o.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===S?()=>null:gs(S)||ae,svgAnnotationRules:ne,...ie.length>0&&{annotations:ie},...$&&{title:$},...T&&{description:T},...N&&{summary:N},...void 0!==F&&{accessibleTable:F},...M&&{className:M},...null!=e.animate&&{animate:e.animate},...C};return mx(Wh,{componentName:"GaugeChart",width:R,height:I,children:mx(hu,{ref:n,...se})})});yx.displayName="GaugeChart";import{useMemo as bx,forwardRef as vx,useRef as xx}from"react";import{jsx as wx}from"react/jsx-runtime";var kx=vx(function(e,t){const o=wm(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=xx(null),{data:n,margin:i,className:a,categoryAccessor:s="category",groupBy:l,valueAccessor:c="value",orientation:u="vertical",valueFormat:d,colorBy:h,colorScheme:p,sort:f=!1,barPadding:m=60,roundedTop:g,baselinePadding:y=!1,tooltip:b,annotations:v,valueExtent:x,frameProps:w={},selection:k,linkedHover:S,onObservation:A,onClick:C,hoverHighlight:M,chartId:P,loading:_,loadingContent:L,emptyContent:R,legendInteraction:$,legendPosition:T,color:N,stroke:F,strokeWidth:D,opacity:B,categoryFormat:E}=e,{width:z,height:H,enableHover:O,showGrid:W,showLegend:j,title:Y,description:G,summary:q,accessibleTable:V,categoryLabel:X,valueLabel:U}=o,K=bx(()=>I(n),[n]),Q=h||l,Z=Nm({data:K,rawData:n,colorBy:Q,colorScheme:p,legendInteraction:$,legendPosition:T,selection:k,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:P,showLegend:j,userMargin:i,marginDefaults:o.marginDefaults,loading:_,loadingContent:L,emptyContent:R,width:z,height:H}),J=hm(),ee=bx(()=>new Map,[K]),te=_b({colorBy:Q,colorScale:Z.colorScale,color:N,themeCategorical:J,colorScheme:p,categoryIndexMap:ee,userPieceStyle:w.pieceStyle,stroke:F,strokeWidth:D,opacity:B,effectiveSelectionHook:Z.effectiveSelectionHook,resolvedSelection:Z.resolvedSelection}),oe=bx(()=>Ll({categoryAccessor:l,valueAccessor:c,groupAccessor:s,valueFormat:d}),[l,s,c,d]),re=Mm({componentName:"GroupedBarChart",data:n,accessors:{categoryAccessor:s,valueAccessor:c},requiredProps:{groupBy:l}}),{effectiveLegendProps:ne,effectiveMargin:ie}=Mb({ref:t,frameRef:r,setup:Z});if(Z.earlyReturn)return Z.earlyReturn;const ae={chartType:"clusterbar",...null!=n&&{data:K},oAccessor:s,rAccessor:c,groupBy:l,oSort:f,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:te,size:[z,H],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ie,barPadding:m,...null!=g&&{roundedTop:g},baselinePadding:y,enableHover:O,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:X,rLabel:U,rFormat:d,...E&&{oFormat:E},showGrid:W,...ne,...Pp({title:Y,description:G,summary:q,accessibleTable:V,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Lp({tooltip:b,defaultTooltipContent:oe}),..._p({linkedHover:S,selection:k,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(w).filter(([e])=>"pieceStyle"!==e))};return re?wx(Bh,{componentName:"GroupedBarChart",message:re,width:z,height:H}):wx(Wh,{componentName:"GroupedBarChart",width:z,height:H,children:wx(hu,{ref:r,...ae})})});kx.displayName="GroupedBarChart";import{useMemo as Sx,forwardRef as Ax,useRef as Cx}from"react";import{jsx as Mx}from"react/jsx-runtime";var Px=Ax(function(e,t){const o=wm(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=Cx(null),{data:n,margin:i,className:a,categoryAccessor:s="category",subcategoryAccessor:l,valueAccessor:c="value",orientation:u="horizontal",valueFormat:d,colorBy:h,colorScheme:p,barPadding:f,tooltip:m,annotations:g,brush:y,onBrush:b,linkedBrush:v,frameProps:x={},selection:w,linkedHover:k,onObservation:S,onClick:A,hoverHighlight:C,chartId:M,loading:P,loadingContent:_,emptyContent:L,legendInteraction:R,legendPosition:$,color:T,stroke:N,strokeWidth:F,opacity:D,categoryFormat:B,rTickValues:E,tickLabelEdgeAlign:z,showCategoryTicks:H,gradientFill:O,trackFill:W,roundedTop:j,valueExtent:Y}=e,{width:G,height:q,enableHover:V,showGrid:X,showLegend:U,title:K,description:Q,summary:Z,accessibleTable:J,categoryLabel:ee,valueLabel:te}=o,oe=Sx(()=>I(n),[n]),re=h||l,ne=Sx(()=>{if(null!=f)return f;if("sparkline"!==e.mode)return 40;const t=new Set(oe.map(e=>"function"==typeof s?s(e):e[s])),o=Math.max(1,t.size);return o>1?Math.max(0,Math.min(1,(("horizontal"===u?q:G)-2*o)/(o-1))):1},[f,e.mode,oe,s,u,G,q]),ie=Nm({data:oe,rawData:n,colorBy:re,colorScheme:p,legendInteraction:R,legendPosition:$,selection:w,linkedHover:k,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:P,loadingContent:_,emptyContent:L,width:G,height:q}),ae=dv({brushProp:y,onBrushProp:b,linkedBrush:v,valueAccessor:c}),se=hm(),le=Sx(()=>new Map,[oe]),ce=_b({colorBy:re,colorScale:ie.colorScale,color:T,themeCategorical:se,colorScheme:p,categoryIndexMap:le,userPieceStyle:x?.pieceStyle,stroke:N,strokeWidth:F,opacity:D,effectiveSelectionHook:ie.effectiveSelectionHook,resolvedSelection:ie.resolvedSelection,cycleByCategory:!0}),ue=Sx(()=>Ll({categoryAccessor:l,valueAccessor:c,groupAccessor:s,valueFormat:d}),[l,s,c,d]),de=Mm({componentName:"SwimlaneChart",data:n,accessors:{categoryAccessor:s,valueAccessor:c,subcategoryAccessor:l},requiredProps:{subcategoryAccessor:l}}),{effectiveLegendProps:he,effectiveMargin:pe}=Mb({ref:t,frameRef:r,setup:ie});if(ie.earlyReturn)return ie.earlyReturn;const fe={chartType:"swimlane",...null!=n&&{data:oe},oAccessor:s,rAccessor:c,stackBy:l,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:ce,size:[G,q],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:pe,barPadding:ne,enableHover:V,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:!1===H?void 0:ee,rLabel:te,rFormat:d,...E&&{rTickValues:E},...null!=z&&{tickLabelEdgeAlign:z},...B&&{oFormat:B},...void 0!==H&&{showCategoryTicks:H},showGrid:X,...he,...Pp({title:K,description:Q,summary:Z,accessibleTable:J,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Lp({tooltip:m,defaultTooltipContent:ue}),..._p({linkedHover:k,selection:w,onObservation:S,onClick:A,hoverHighlight:C,mobileInteraction:ie.mobileInteraction,customHoverBehavior:ie.customHoverBehavior,customClickBehavior:ie.customClickBehavior}),...g&&g.length>0&&{annotations:g},...O&&{gradientFill:!0===O?{topOpacity:.8,bottomOpacity:.05}:O},...null!=W&&{trackFill:W},...null!=j&&{roundedTop:j},...Y&&{rExtent:Y},...ae.brushStreamProps,...Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e))};return de?Mx(Bh,{componentName:"SwimlaneChart",message:de,width:G,height:q}):Mx(Wh,{componentName:"SwimlaneChart",width:G,height:q,children:Mx(hu,{ref:r,...fe})})});Px.displayName="SwimlaneChart";import{useMemo as _x,forwardRef as Lx,useRef as Rx}from"react";import{useMemo as Ix}from"react";function $x(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 Tx(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 Nx(e){return"function"==typeof e?e:t=>t[e]||1}function Fx({edgeColorBy:e,colorBy:t,colorScale:o,nodeStyleFn:r,edgeOpacity:n,baseStyle:i={}}){return a=>{const s={fillOpacity:n,...i};if("function"==typeof e)s.fill=e(a);else if("source"===e){const e="object"==typeof a.source?a.source:null;t&&e?s.fill=Ee(e.data||e,t,o):e&&(s.fill=r(e,e.index).fill)}else if("target"===e){const e="object"==typeof a.target?a.target:null;t&&e?s.fill=Ee(e.data||e,t,o):e&&(s.fill=r(e,e.index).fill)}else"gradient"===e&&(s.fill="#999",s.fillOpacity=.7*n);return s}}function Dx(e){const{nodes:t,edges:o,inferNodes:r=!0,sourceAccessor:n="source",targetAccessor:i="target",colorBy:a,colorScheme:s,showLegend:l,legendPosition:c,legendInteraction:u,selection:d,linkedHover:h,onObservation:p,onClick:f,mobileInteraction:m,mobileSemantics:g,chartType:y,chartId:b,marginDefaults:v,userMargin:x,width:w,height:k,loading:S,loadingContent:A,emptyContent:C,emptyDataKey:M="edges"}=e,P=Ix(()=>I(o),[o]),_=Ix(()=>I(t),[t]),L=qh(S,w,k,A),R=L?null:Gh("nodes"===M?void 0===t?void 0:_:void 0===o?void 0:P,w,k,C),$=Ix(()=>r?Tx(_,P,n,i):_,[r,_,P,n,i]),T=fm($,a,s),N=hm(),F=Ix(()=>{if(Array.isArray(s))return s;if(N&&N.length>0)return N;if("string"==typeof s){const e=Te[s];if(Array.isArray(e)&&e.length>0)return e}return Ne},[s,N]),D=Ix(()=>{if(!a)return[];const e=new Set;for(const t of $){const o="function"==typeof a?a(t):t[a];null!=o&&e.add(o+"")}return Array.from(e)},[$,a]),B=vm(u,a,D),{legend:E,margin:z,legendPosition:H}=bm({data:$,colorBy:a,colorScale:T,showLegend:l,legendPosition:c,userMargin:x,defaults:v,categories:D}),O=Ix(()=>dm(m,{width:w,mobileSemantics:g}),[m,w,g]),W=gm({selection:d,linkedHover:h,fallbackFields:a?["string"==typeof a?a:""]:[],unwrapData:!0,onObservation:p,onClick:f,mobileInteraction:O,chartType:y,chartId:b}),{customHoverBehavior:j,customClickBehavior:Y,activeSelectionHook:G,hoverSelectionHook:q,crosshairSourceId:V}=W;return{safeNodes:$,safeEdges:P,colorScale:T,effectivePalette:F,themeCategorical:N,allCategories:D,legendState:B,legend:E,margin:z,legendPosition:H,mobileInteraction:O,customHoverBehavior:j,customClickBehavior:Y,activeSelectionHook:G,hoverSelectionHook:q,crosshairSourceId:V,loadingEl:L,emptyEl:R}}import{jsx as Bx}from"react/jsx-runtime";var Ex=Lx(function(e,t){const o=Rx(null);Dm(t,{variant:"network",frameRef:o});const r=wm(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:a,className:s,nodeIdAccessor:l,nodeIDAccessor:c,sourceAccessor:u="source",targetAccessor:d="target",nodeLabel:h,colorBy:p,colorScheme:f,nodeSize:m=8,nodeSizeRange:g=[5,20],edgeWidth:y=1,edgeColor:b="#999",edgeOpacity:v=.6,iterations:x=300,forceStrength:w=.1,layoutExecution:k="auto",layoutLoadingContent:S,onLayoutStateChange:A,tooltip:C,frameProps:M={},onObservation:P,onClick:_,chartId:L,selection:R,linkedHover:I,loading:$,loadingContent:T,emptyContent:N,legendInteraction:F,legendPosition:D,stroke:B,strokeWidth:E,opacity:z}=e,H=l??c??"id",{width:O,height:W,enableHover:j,showLegend:Y,showLabels:G=!1,title:q,description:V,summary:X,accessibleTable:U}=r,K=Dx({nodes:n,edges:i,inferNodes:!1,nodeIdAccessor:H,sourceAccessor:u,targetAccessor:d,colorBy:p,colorScheme:f,showLegend:Y,legendPosition:D,legendInteraction:F,selection:R,linkedHover:I,onObservation:P,onClick:_,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"ForceDirectedGraph",chartId:L,marginDefaults:r.marginDefaults,userMargin:a,width:O,height:W,loading:$,loadingContent:T,emptyContent:N,emptyDataKey:"nodes"}),Q=_x(()=>new Map,[]),Z=_x(()=>e=>{const t={};return t.fill=p?Ee(e.data||e,p,K.colorScale):pm(void 0,K.themeCategorical,f,void 0,Q),"number"==typeof m&&(t.r=m),t},[p,K.colorScale,m,K.themeCategorical,f,Q]),J=_x(()=>Em(Z,{stroke:B,strokeWidth:E,opacity:z}),[Z,B,E,z]),ee=_x(()=>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=_x(()=>Em(ee,{stroke:B,strokeWidth:E,opacity:z}),[ee,B,E,z]),oe=_x(()=>{if(G&&h)return"function"==typeof h?h:e=>e.data?.[h]??e[h]??e.id},[G,h]),re=_m({componentName:"ForceDirectedGraph",nodes:n,edges:i,nodesRequired:!0,edgesRequired:!0,accessors:{nodeIDAccessor:H}});return re?Bx(Bh,{componentName:"ForceDirectedGraph",message:re,width:O,height:W}):K.loadingEl?K.loadingEl:K.emptyEl?K.emptyEl:Bx(Wh,{componentName:"ForceDirectedGraph",width:O,height:W,children:Bx(Mp,{ref:o,chartType:"force",...null!=n&&{nodes:K.safeNodes},...null!=i&&{edges:K.safeEdges},size:[O,W],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:K.margin,nodeIDAccessor:H,sourceAccessor:u,targetAccessor:d,iterations:x,forceStrength:w,layoutExecution:k,layoutLoadingContent:S,onLayoutStateChange:A,nodeStyle:J,edgeStyle:te,colorBy:p,colorScheme:K.effectivePalette,nodeSize:m,nodeSizeRange:g,nodeLabel:oe,showLabels:G,enableHover:j,tooltipContent:!1===C?()=>null:gs(C)||void 0,..._p({linkedHover:I,selection:R,onObservation:P,onClick:_,mobileInteraction:K.mobileInteraction,customHoverBehavior:K.customHoverBehavior,customClickBehavior:K.customClickBehavior,linkedHoverInClickPredicate:!1}),legend:K.legend,legendPosition:K.legendPosition,...F&&"none"!==F&&{legendHoverBehavior:K.legendState.onLegendHover,legendClickBehavior:K.legendState.onLegendClick,legendHighlightedCategory:K.legendState.highlightedCategory,legendIsolatedCategories:K.legendState.isolatedCategories},className:s,title:q,description:V,summary:X,accessibleTable:U,...null!=e.animate&&{animate:e.animate},...M})})});Ex.displayName="ForceDirectedGraph";import{useMemo as zx,forwardRef as Hx,useRef as Ox}from"react";import{jsx as Wx}from"react/jsx-runtime";var jx=Hx(function(e,t){const o=Ox(null);Dm(t,{variant:"network",frameRef:o,overrides:{getData:()=>o.current?.getTopology()?.edges?.map(e=>e.data)??[]}});const r=wm(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:a,className:s,sourceAccessor:l="source",targetAccessor:c="target",valueAccessor:u="value",nodeIdAccessor:d="id",colorBy:h,colorScheme:p,edgeColorBy:f="source",padAngle:m=.01,groupWidth:g=20,sortGroups:y,nodeLabel:b,edgeOpacity:v=.5,tooltip:x,frameProps:w={},onObservation:k,onClick:S,chartId:A,selection:C,linkedHover:M,loading:P,loadingContent:_,emptyContent:L,legendInteraction:R,stroke:I,strokeWidth:$,opacity:T}=e,{width:N,height:F,enableHover:D,showLabels:B=!0,title:E,description:z,summary:H,accessibleTable:O}=r,W=Dx({nodes:n,edges:i,inferNodes:!0,nodeIdAccessor:d,sourceAccessor:l,targetAccessor:c,colorBy:h,colorScheme:p,showLegend:!1,legendInteraction:R,selection:C,linkedHover:M,onObservation:k,onClick:S,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"ChordDiagram",chartId:A,marginDefaults:r.marginDefaults,userMargin:a,width:N,height:F,loading:P,loadingContent:_,emptyContent:L}),j=zx(()=>new Map,[]),Y=W.safeNodes.length>0,G=zx(()=>{if(Y)return(e,t)=>{const o={stroke:"black",strokeWidth:1};if(h)o.fill=Ee(e.data||e,h,W.colorScale);else{const r=Array.isArray(p)?p:Te[p]||Ne,n=Array.isArray(r)?r:Ne;o.fill=n[(e.index??t??0)%n.length]}return o}},[Y,h,W.colorScale,p]),q=zx(()=>G?Em(G,{stroke:I,strokeWidth:$,opacity:T}):void 0,[G,I,$,T]),V=zx(()=>{if(Y)return Fx({edgeColorBy:f,colorBy:h,colorScale:W.colorScale,nodeStyleFn:q||(e=>({fill:pm(void 0,W.themeCategorical,p,void 0,j)})),edgeOpacity:v,baseStyle:{stroke:"black",strokeWidth:.5,strokeOpacity:v}})},[Y,f,h,W.colorScale,q,v,W.themeCategorical,p,j]),X=zx(()=>V?Em(V,{stroke:I,strokeWidth:$,opacity:T}):void 0,[V,I,$,T]),U=zx(()=>{if(!B)return;const e=b||d;return"function"==typeof e?e:t=>t.data?.[e]??t[e]??t.id},[B,b,d]),K=_m({componentName:"ChordDiagram",edges:i,edgesRequired:!0});return K?Wx(Bh,{componentName:"ChordDiagram",message:K,width:N,height:F}):W.loadingEl?W.loadingEl:W.emptyEl?W.emptyEl:Wx(Wh,{componentName:"ChordDiagram",width:N,height:F,children:Wx(Mp,{ref:o,chartType:"chord",...W.safeNodes.length>0&&{nodes:W.safeNodes},...null!=i&&{edges:W.safeEdges},size:[N,F],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:W.margin,nodeIDAccessor:d,sourceAccessor:l,targetAccessor:c,valueAccessor:u,padAngle:m,groupWidth:g,sortGroups:y,nodeStyle:q,edgeStyle:X,colorBy:h,colorScheme:W.effectivePalette,edgeColorBy:f,edgeOpacity:v,nodeLabel:U,showLabels:B,enableHover:D,tooltipContent:!1===x?()=>null:gs(x)||void 0,..._p({linkedHover:M,selection:C,onObservation:k,onClick:S,mobileInteraction:W.mobileInteraction,customHoverBehavior:W.customHoverBehavior,customClickBehavior:W.customClickBehavior,linkedHoverInClickPredicate:!1}),...R&&"none"!==R&&{legendHoverBehavior:W.legendState.onLegendHover,legendClickBehavior:W.legendState.onLegendClick,legendHighlightedCategory:W.legendState.highlightedCategory,legendIsolatedCategories:W.legendState.isolatedCategories},className:s,title:E,description:z,summary:H,accessibleTable:O,...null!=e.animate&&{animate:e.animate},...w})})});jx.displayName="ChordDiagram";import{useMemo as Yx,forwardRef as Gx,useRef as qx}from"react";import{jsx as Vx}from"react/jsx-runtime";var Xx=Gx(function(e,t){const o=qx(null);Dm(t,{variant:"network",frameRef:o,overrides:{getData:()=>o.current?.getTopology()?.edges?.map(e=>e.data)??[]}});const r=wm(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:a,className:s,sourceAccessor:l="source",targetAccessor:c="target",valueAccessor:u="value",nodeIdAccessor:d="id",colorBy:h,colorScheme:p,edgeColorBy:f="source",orientation:m="horizontal",nodeAlign:g="justify",nodePaddingRatio:y=.05,nodeWidth:b=15,nodeLabel:v,edgeOpacity:x=.5,edgeSort:w,tooltip:k,frameProps:S={},onObservation:A,onClick:C,chartId:M,selection:P,linkedHover:_,loading:L,loadingContent:R,emptyContent:I,showLegend:$,legendPosition:T,legendInteraction:N,stroke:F,strokeWidth:D,opacity:B}=e,{width:E,height:z,enableHover:H,showLabels:O=!0,title:W,description:j,summary:Y,accessibleTable:G}=r,q=Dx({nodes:n,edges:i,inferNodes:!0,nodeIdAccessor:d,sourceAccessor:l,targetAccessor:c,colorBy:h,colorScheme:p,showLegend:$,legendPosition:T,legendInteraction:N,selection:P,linkedHover:_,onObservation:A,onClick:C,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"SankeyDiagram",chartId:M,marginDefaults:r.marginDefaults,userMargin:a,width:E,height:z,loading:L,loadingContent:R,emptyContent:I}),V=Yx(()=>new Map,[]),X=Yx(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=h?Ee(e.data||e,h,q.colorScale):pm(void 0,q.themeCategorical,p,void 0,V),t},[h,q.colorScale,q.themeCategorical,p,V]),U=Yx(()=>Em(X,{stroke:F,strokeWidth:D,opacity:B}),[X,F,D,B]),K=Yx(()=>Fx({edgeColorBy:f,colorBy:h,colorScale:q.colorScale,nodeStyleFn:U,edgeOpacity:x,baseStyle:{stroke:"none",strokeWidth:0}}),[f,h,q.colorScale,U,x]),Q=Yx(()=>Em(K,{stroke:F,strokeWidth:D,opacity:B}),[K,F,D,B]),Z=Yx(()=>{if(!O)return;const e=v||d;return"function"==typeof e?e:t=>t.data?.[e]??t[e]??t.id},[O,v,d]),J=_m({componentName:"SankeyDiagram",edges:i,edgesRequired:!0});return J?Vx(Bh,{componentName:"SankeyDiagram",message:J,width:E,height:z}):q.loadingEl?q.loadingEl:q.emptyEl?q.emptyEl:Vx(Wh,{componentName:"SankeyDiagram",width:E,height:z,children:Vx(Mp,{ref:o,chartType:"sankey",...q.safeNodes.length>0&&{nodes:q.safeNodes},...null!=i&&{edges:q.safeEdges},size:[E,z],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:q.margin,nodeIDAccessor:d,sourceAccessor:l,targetAccessor:c,valueAccessor:u,orientation:m,nodeAlign:g,nodePaddingRatio:y,nodeWidth:b,nodeStyle:U,edgeStyle:Q,colorBy:h,colorScheme:q.effectivePalette,edgeColorBy:f,edgeOpacity:x,edgeSort:w,nodeLabel:Z,showLabels:O,enableHover:H,tooltipContent:!1===k?()=>null:gs(k)||void 0,..._p({linkedHover:_,selection:P,onObservation:A,onClick:C,mobileInteraction:q.mobileInteraction,customHoverBehavior:q.customHoverBehavior,customClickBehavior:q.customClickBehavior,linkedHoverInClickPredicate:!1}),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:s,title:W,description:j,summary:Y,accessibleTable:G,...null!=e.animate&&{animate:e.animate},...S})})});Xx.displayName="SankeyDiagram";import{useMemo as Ux,useState as Kx,useRef as Qx,useCallback as Zx}from"react";import{scaleTime as Jx}from"d3-scale";import{forwardRef as ew}from"react";function tw(e,t,r){const n=t.incoming[e.id],i=t.outgoing[e.id],a=[];for(const e of n)a.push({time:e.endTime,delta:+e.value,edge:e,kind:"in",side:r.get(e.id).targetSide});for(const e of i)a.push({time:e.startTime,delta:-e.value,edge:e,kind:"out",side:r.get(e.id).sourceSide});const s={create:0,in:1,"transfer-out":2,"transfer-in":3,out:4},l=()=>{a.sort((e,t)=>e.time-t.time||(s[e.kind]??99)-(s[t.kind]??99))},c=a.length?o(a.map(e=>e.time)):null,u=Array.isArray(e.xExtent)&&Number.isFinite(e.xExtent[0])?e.xExtent[0]:null,d=null!=u?u-1:null!=c&&Number.isFinite(c)?c-1:null,h=[...new Set(a.map(e=>e.time))].sort((e,t)=>e-t),p=new Map;for(let e=1;h.length>e;e++)p.set(h[e],h[e-1]);const f=e=>{const t=p.get(e);return null!=t?(t+e)/2:null!=d?d:e};l();const m=[];let g=0,y=0;for(const e of a)if("out"===e.kind){const t=Math.abs(e.delta);let o=t-("top"===e.side?g:y);if(o>0){const t="top"===e.side?"bot":"top",r=Math.min(o,"top"===t?g:y);if(r>0){const n=f(e.time);m.push({time:n,delta:-r,kind:"transfer-out",side:t}),m.push({time:n,delta:+r,kind:"transfer-in",side:e.side}),"top"===t?g-=r:y-=r,"top"===e.side?g+=r:y+=r,o-=r}o>0&&null!==d&&(m.push({time:d,delta:+o,kind:"create",side:e.side}),"top"===e.side?g+=o:y+=o)}"top"===e.side?g-=t:y-=t}else if("in"===e.kind){const t=Math.abs(e.delta);"top"===e.side?g+=t:y+=t}a.push(...m),l();let b=0,v=0,x=0,w=0,k=0;const S=[],A=new Map;for(const e of a){if(S.push({t:e.time,topMass:b,botMass:v}),("in"===e.kind||"out"===e.kind)&&e.edge){const t="top"===e.side?b: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?b+=e.delta:v+=e.delta,b+v>x&&(x=b+v),b>w&&(w=b),v>k&&(k=v),S.push({t:e.time,topMass:b,botMass:v})}const C=[];let M=0;for(;S.length>M;){let e=M;for(;S.length>e+1&&S[e+1].t===S[M].t;)e++;C.push(S[M]);for(let t=M+1;e>=t;t++){const e=C[C.length-1];S[t].topMass===e.topMass&&S[t].botMass===e.botMass||C.push(S[t])}M=e+1}const P=Array.isArray(e.xExtent)&&Number.isFinite(e.xExtent[1])?e.xExtent[1]:null;let _=null;for(const e of i)null!=e.systemInTime&&Number.isFinite(e.systemInTime)&&e.startTime>e.systemInTime&&(null===_||_>e.systemInTime)&&(_=e.systemInTime);let L=null;for(const e of n)null!=e.systemOutTime&&Number.isFinite(e.systemOutTime)&&e.systemOutTime>e.endTime&&(null===L||e.systemOutTime>L)&&(L=e.systemOutTime);if(C.length>0){const e=C[C.length-1],t=Math.max(null!=P?P:-1/0,null!=L?L:-1/0);Number.isFinite(t)&&t>e.t&&e.topMass+e.botMass>0&&C.push({t:t,topMass:e.topMass,botMass:e.botMass});const o=C[0],r=Math.min(null!=u?u:1/0,null!=_?_:1/0);Number.isFinite(r)&&o.t>r&&o.topMass+o.botMass>0&&C.unshift({t:r,topMass:o.topMass,botMass:o.botMass})}return{samples:C,peak:x,topPeak:w,botPeak:k,localAttachments:A}}function ow(e,t){return t?Math.max(t[0],Math.min(t[1],e)):e}function rw(e,t){return e.map(e=>({t:ow(e.t,t),topMass:e.topMass,botMass:e.botMass}))}function nw(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 iw(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],a=t[n];i.source!==a.source&&i.target!==a.target&&i.source!==a.target&&i.target!==a.source&&(Math.min(i.endTime,a.endTime)>Math.max(i.startTime,a.startTime)&&e[a.source]>e[i.source]!=e[a.target]>e[i.target]&&o++)}return o}function aw(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 sw(e,t){return 1e3*iw(e,t)+aw(e,t)}function lw(e,t){return{slots:e.map(e=>({peak:{...e.peak},occupants:e.occupants.slice()})),map:{...t}}}function cw(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=lw(e,t),a=sw(t,o);for(let s=0;r>s;s++){const r=Array(n).fill(0),s=Array(n).fill(0);for(const e of o){const o=t[e.source],n=t[e.target];r[o]+=n*(e.value||1),s[o]+=e.value||1,r[n]+=o*(e.value||1),s[n]+=e.value||1}const l=Array.from({length:n},(e,t)=>t).sort((e,t)=>(s[e]>0?r[e]/s[e]:e)-(s[t]>0?r[t]/s[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=sw(t,o);if(a>d)a=d,i=lw(e,t);else if(d===a)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=sw(t,o);for(let a=0;r>a;a++){let r=!1;for(let a=0;n-1>a;a++){const n=e[a];e[a]=e[a+1],e[a+1]=n;for(const e of Object.keys(t))t[e]===a?t[e]=a+1:t[e]===a+1&&(t[e]=a);const s=sw(t,o);if(i>s)i=s,r=!0;else{const o=e[a];e[a]=e[a+1],e[a+1]=o;for(const e of Object.keys(t))t[e]===a?t[e]=a+1:t[e]===a+1&&(t[e]=a)}}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),a=Array.from({length:r},(e,t)=>t),s=a.slice(),l={...n};let c=a.slice(),u=1/0;const d=()=>{for(const e of i)l[e]=s[n[e]];const e=sw(l,o);u>e&&(u=e,c=a.slice())},h=(e,t)=>{const o=a[e],r=a[t];a[e]=r,a[t]=o,s[o]=t,s[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 m=c.map(t=>e[t]),g=new Map;c.forEach((e,t)=>g.set(e,t));for(const e of Object.keys(t))t[e]=g.get(t[e]);e.length=0;for(const t of m)e.push(t)}(e,t,o)}function uw(e,t,o,r,n){const{plotH:i,padding:a,valueScale:s,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 m={},g=[];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 a=[...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}),s=e.filter(e=>null===f[e.id].start);for(const e of[...a,...s]){const t=f[e.id];let o=-1;for(let e=0;g.length>e;e++){const r=g[e].occupants[g[e].occupants.length-1];if(null===t.start||void 0===r||t.start>=r.end){o=e;break}}-1===o&&(g.push({occupants:[],peak:{topPeak:0,botPeak:0}}),o=g.length-1),g[o].occupants.push({id:e.id,end:t?.end??-1/0}),g[o].peak.topPeak=Math.max(g[o].peak.topPeak,d[e.id]),g[o].peak.botPeak=Math.max(g[o].peak.botPeak,h[e.id]),m[e.id]=o}}else e.forEach((e,t)=>{g.push({occupants:[{id:e.id,end:f[e.id]?.end??-1/0}],peak:{topPeak:d[e.id],botPeak:h[e.id]}}),m[e.id]=t});let y=null,b=null,v=null,x=null;const w=()=>{y=iw(m,t),v=aw(m,t)},k=()=>{b=iw(m,t),x=aw(m,t)};"crossing-min"===c?(w(),cw(g,m,t),k()):"inside-out"===c?(w(),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),a=Math.floor((o-1)/2);i[a]=n[0].idx;let s=a-1,l=a+1;for(let e=1;n.length>e;e++)e%2==1&&o>l||0>s?i[l++]=n[e].idx:i[s--]=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)}(g,m),k()):"crossing-min+inside-out"===c&&(w(),cw(g,m,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 a=sw(t,o);for(const{slot:s}of n){const n=e.indexOf(s);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=sw(t,o);if(d>a){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 a=d}}(g,m,t),k());const S=g.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;g.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 P=a+(g[0]?.peak.topPeak??0)*s;g.length>0&&M.push(P);for(let e=1;g.length>e;e++)P+=C[e-1]*s+a,M.push(P);if(g.length>0&&(P+=g[g.length-1].peak.botPeak*s+a),P>i){const e=i/P;for(let t=0;M.length>t;t++)M[t]*=e}const _=0===g.length?0:g[0].peak.topPeak+C.reduce((e,t)=>e+t,0)+g[g.length-1].peak.botPeak,L={};for(const t of e)L[t.id]=M[m[t.id]];return{effectiveSlotsHeight:_,centerlines:L,laneLifetime:f,slots:g,slotByNode:m,slotCenter:M,crossingsBefore:y,crossingsAfter:b,lengthBefore:v,lengthAfter:x}}var dw=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 hw(e){return"object"==typeof e&&null!==e&&"__kind"in e&&("band"===e.__kind||"ribbon"===e.__kind)}import{Fragment as pw,jsx as fw,jsxs as mw}from"react/jsx-runtime";function gw(e){return null==e?NaN:e instanceof Date?e.getTime():"number"==typeof e?e:new Date(e).getTime()}function yw(e,t){return"function"==typeof e?e(t):t[e]}var bw=ew(function(e,t){const{nodes:o,edges:r,domain:n,axisTicks:i=[],nodeIdAccessor:a="id",sourceAccessor:s="source",targetAccessor:l="target",valueAccessor:c="value",startTimeAccessor:u="startTime",endTimeAccessor:d="endTime",systemInTimeAccessor:h,systemOutTimeAccessor:p,xExtentAccessor:f="xExtent",edgeIdAccessor:m="id",colorBy:g,colorScheme:y,showLegend:b,legendPosition:v="right",pairing:x="temporal",packing:w="reuse",laneOrder:k="crossing-min",ribbonLane:S="both",lifetimeMode:A="half",showLaneRails:C=!1,showQualityReadout:M=!1,showLabels:P=!0,width:_=600,height:L=400,margin:R,title:$,description:T,summary:N,accessibleTable:F,responsiveWidth:D,responsiveHeight:B,loading:E,loadingContent:z,emptyContent:H,edgeOpacity:O=.35,timeFormat:W,valueFormat:j,tooltip:Y,enableHover:G=!0,onObservation:q,onClick:V,showParticles:X=!1,particleStyle:U,chartId:K,frameProps:Q={}}=e,[Z,J]=Kx([]),[ee,te]=Kx([]),oe=Qx(Z),re=Qx(ee);oe.current=Z,re.current=ee;const ne=Zx(e=>{oe.current=e,J(e)},[]),ie=Zx(e=>{re.current=e,te(e)},[]),ae=void 0!==r,se=I(ae?r:Z),le=Ux(()=>{const e=I(o??[]),t=ee;if(0===e.length&&0===t.length)return Tx([],se,s,l);const r=new Set,n=[];for(const t of e){const e=yw(a,t)+"";r.has(e)||(r.add(e),n.push(t))}for(const e of t){const t=yw(a,e)+"";r.has(t)||(r.add(t),n.push(e))}const i=Tx([],se,s,l);for(const e of i)r.has(e.id)||(r.add(e.id),n.push(e));return n},[o,ee,se,a,s,l]),ce=Qx(null),ue=Zx((e,t)=>{const o=yw(m,e);return null!=o?o+"":`${yw(s,e)}-${yw(l,e)}-${t}`},[m,s,l]),de=Zx(e=>{if(null==e)return!1;const t=e;return null!=yw(s,t)&&null!=yw(l,t)},[s,l]);Dm(t,{variant:"network",frameRef:ce,overrides:{push(e){if(de(e)){if(ae)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&&(ae?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(!ae){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=yw(a,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(!ae){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=yw(a,e)+"";return o.has(i)?(r.push(e),n=!0,t(e)):e});return n&&ie(i),r},clear(){ae||ne([]),ie([]),ce.current?.clear()},getData:()=>se??[],getScales:()=>null},deps:[ae,de,ue,a,se,ne,ie]});const he=ue,pe=Zx(e=>yw(a,e)+"",[a]),{nodes:fe,edges:me,domain:ge,rawNodeById:ye,rawEdgeById:be}=Ux(()=>{const e=(le??[]).map(e=>{const t={id:pe(e),__raw:e},o=f?yw(f,e):null;if(Array.isArray(o)&&2===o.length){const e=gw(o[0]),r=gw(o[1]);Number.isFinite(e)&&Number.isFinite(r)&&(t.xExtent=[e,r])}return t}),t=(se??[]).map((e,t)=>{const o={id:he(e,t),source:yw(s,e)+"",target:yw(l,e)+"",value:Number(yw(c,e)),startTime:gw(yw(u,e)),endTime:gw(yw(d,e)),__raw:e};if(h){const t=gw(yw(h,e));Number.isFinite(t)&&(o.systemInTime=t)}if(p){const t=gw(yw(p,e));Number.isFinite(t)&&(o.systemOutTime=t)}return o}),o=[gw(n[0]),gw(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,se,n,pe,he,f,s,l,c,u,d,h,p]),ve=Dx({nodes:le,edges:se,inferNodes:!1,nodeIdAccessor:a,sourceAccessor:s,targetAccessor:l,colorBy:g,colorScheme:y,showLegend:!1,legendPosition:v,selection:void 0,linkedHover:void 0,onObservation:q,onClick:V,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,chartType:"ProcessSankey",chartId:K,marginDefaults:{top:30,right:80,bottom:40,left:80},userMargin:R,width:_,height:L,loading:E,loadingContent:z,emptyContent:H}),xe=(b??!!g)&&!!g,we=Zx(e=>null!=R&&("number"==typeof R||null!=R[e]),[R]),ke=Ux(()=>{const e={...ve.margin};return xe&&("right"===v&&!we("right")&&140>e.right?e.right=140:"bottom"===v&&!we("bottom")&&80>e.bottom&&(e.bottom=80)),e},[ve.margin,xe,v,we]),Se=_-ke.left-ke.right,Ae=L-ke.top-ke.bottom,Ce=Ux(()=>function(e,t,o){const r=[],n=new Set(e.map(e=>e.id)),i=Array.isArray(o)&&2===o.length,a=i&&Number.isFinite(o[0])&&Number.isFinite(o[1]);i&&a&&a&&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,me,ge),[fe,me,ge]),Me=Ux(()=>Ce.length>0?null:function(e,t,o){const{plotH:r,pairing:n="temporal",packing:i="reuse",laneOrder:a="crossing-min",lifetimeMode:s="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,a=new Map;for(const e of t)a.set(e.id,{});const s=(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 a=[...o.values()];a.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 a)e.edges.sort("target"===t?i:n);return a};for(const t of e){const e=o.outgoing[t.id],r=o.incoming[t.id];if(0===r.length)s(e,"target").forEach((e,t)=>{const o=t%2==0?"top":"bot";for(const t of e.edges)a.get(t.id).sourceSide=o});else if(0===e.length)s(r,"source").forEach((e,t)=>{const o=t%2==0?"top":"bot";for(const t of e.edges)a.get(t.id).targetSide=o});else{const t=s(r,"source"),o=s(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)a.get(o.id).targetSide=r;if(o[e])for(const t of o[e].edges)a.get(t.id).sourceSide=r}}}return a}(e,t,l,n);let u={};for(const t of e)u[t.id]=tw(t,l,c);const d=uw(e,t,u,l,{plotH:r,padding:12,valueScale:1,packing:i,laneOrder:a,lifetimeMode:s}),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,a="top"===t?n.inTop-n.outTop:n.inBot-n.outBot;if(0>=i||0>=a)return!1;const s=Math.min(i,a),l=o.filter(t=>!h.has(t.id)&&c.get(t.id).sourceSide===e&&s>=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]=tw(t,l,c);const p=uw(e,t,u,l,{plotH:r,padding:12,valueScale:1,packing:i,laneOrder:a,lifetimeMode:s}),f=p.effectiveSlotsHeight??p.slots.reduce((e,t)=>e+t.peak.topPeak+t.peak.botPeak,0),m=Math.min(12,.35*r/Math.max(p.slots.length+1,1)),g=f>0?Math.max(0,(r-m*(p.slots.length+1))/f):1,y=uw(e,t,u,l,{plotH:r,padding:m,valueScale:g,packing:i,laneOrder:a,lifetimeMode:s});return{nodeData:u,sides:c,valueScale:g,padding:m,compressedPadding:12>m,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,me,{plotH:Ae,pairing:x,packing:w,laneOrder:k,lifetimeMode:A}),[Ce,fe,me,Ae,x,w,k,A]),Pe=Ux(()=>Jx().domain(ge).range([0,Se]),[ge,Se]),_e=Zx((e,t)=>{if(g&&le){const t=ye.get(e);if(t)return Ee(t,g,ve.colorScale)}return ve.effectivePalette[t%ve.effectivePalette.length]||"#475569"},[g,le,ye,ve.colorScale,ve.effectivePalette]),Le=Ux(()=>{const e=new Map;return fe.forEach((t,o)=>e.set(t.id,o)),e},[fe]),Re=Ux(()=>{if(!Me)return{bands:[],ribbons:[]};const{centerlines:e,nodeData:t,valueScale:o}=Me,r=[],n=[];return fe.forEach((n,i)=>{const a=t[n.id];if(!a||0===a.samples.length)return;const s=function(e,t,o,r,n){if(0===e.length)return null;const i=rw(e,n),a=e=>t-i[e].topMass*o,s=e=>t+i[e].botMass*o;let l=`M${r(i[0].t)},${a(0)}`;for(let e=1;i.length>e;e++)l+=` L${r(i[e].t)},${a(e)}`;l+=` L${r(i[i.length-1].t)},${s(i.length-1)}`;for(let e=i.length-2;e>=0;e--)l+=` L${r(i[e].t)},${s(e)}`;return l+" Z"}(a.samples,e[n.id],o,Pe,ge);if(!s)return;const l=rw(a.samples,ge),c=l.find(e=>e.topMass+e.botMass>0)||l[0],u=e[n.id]+(c.botMass-c.topMass)*o/2,d=_e(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 a=o.valueScale,s=o.centerlines[e],l=rw(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(ow(e,n)),f=[],m=(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]=nw(e,s,a);f.push({pathD:m(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]=nw(e,s,a);f.push({pathD:m(r,o,i,l),x0:t,x1:n,from:1,to:0})}}}}return f}(n.id,me,Me,Pe,ge);r.push({id:n.id,pathD:s,fill:d,stroke:d,strokeWidth:.5,...p.length>0&&{gradientStubs:p},rawDatum:h,labelX:Pe(c.t)-4,labelY:u,labelText:n.id})}),me.forEach(r=>{const i=t[r.source]?.localAttachments.get(r.id),a=t[r.target]?.localAttachments.get(r.id);if(!i||!a)return;const s=Le.get(r.source)??0,l=_e(r.source,s),c=function(e,t,o,r,n,i,a,s){const l=n,c=e=>s?Math.max(s[0],Math.min(s[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,m=o.sideMassAfter*l;let g,y,b,v;"top"===e.side?(g=t-f,y=g+h):(y=t+f,g=y-h),"top"===o.side?(b=r-m,v=b+p):(v=r+m,b=v-p);const x="source"===a?u+.85*(d-u):"target"===a?u+.15*(d-u):(u+d)/2;return{sx:u,sTop:g,sBot:y,tx:d,tTop:b,tBot:v,cp1X:x,cp2X:x}}(i,e[r.source],a,e[r.target],o,Pe,S,ge),{pathD:u,bezier:d}=wd(c),h=be.get(r.id)??r;n.push({id:r.id,pathD:u,fill:l,opacity:O,rawDatum:h,bezier:d})}),{bands:r,ribbons:n}},[Me,fe,me,Pe,ge,_e,ye,be,S,O,Le]),Ie=Ux(()=>({bands:Re.bands,ribbons:Re.ribbons,showLabels:P}),[Re,P]),$e=Ux(()=>{if(!xe||!g)return;const e=new Map;(le??[]).forEach((t,o)=>{const r=yw(g,t),n=null==r?"":r+"";n&&!e.has(n)&&e.set(n,{label:n,color:_e(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,g,le,_e,pe]),Te=Ux(()=>!1!==Y&&G?void 0===Y||!0===Y?null:gs(Y)||null:null,[Y,G]),Ne=Zx(e=>W?W(new Date(e)):Number.isFinite(e)?1e10>Math.abs(e)?Number.isInteger(e)?e+"":e.toFixed(2):new Date(e).toISOString().slice(0,10):"",[W]),Fe=Zx(e=>j?j(e):e+"",[j]),De=Zx(e=>{if(!e||!e.data)return null;const t=e.data;if(!hw(t))return null;const o=t.data;if(Te)return Te(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,a=[];for(const e of n)i.has(e.t)||(i.add(e.t),a.push(e));return a.sort((e,t)=>e.t-t.t)}(o,r);return mw("div",{style:{minWidth:160},children:[fw("div",{style:{fontWeight:600,marginBottom:4},children:e}),i.length>0&&mw("table",{style:{borderCollapse:"collapse",fontSize:11,width:"100%"},children:[fw("thead",{children:mw("tr",{style:{opacity:.6},children:[fw("th",{style:{textAlign:"left",fontWeight:500,paddingRight:8},children:"Time"}),fw("th",{style:{textAlign:"right",fontWeight:500},children:"Mass"}),null!=n&&fw("th",{})]})}),fw("tbody",{children:i.map((e,t)=>mw("tr",{children:[fw("td",{style:{paddingRight:8},children:Ne(e.t)}),fw("td",{style:{textAlign:"right"},children:Fe(e.total)}),null!=n&&fw("td",{style:{textAlign:"right",paddingLeft:8,opacity:.55},children:e.mark})]},t))})]}),null!=n&&mw("div",{style:{marginTop:4,fontSize:10,opacity:.55},children:["showing ",i.length," of ",n," samples"]})]})}const r=o,n=yw(s,r),i=yw(l,r),a=yw(c,r),h=yw(u,r),p=yw(d,r);return mw("div",{style:{minWidth:160},children:[mw("div",{style:{fontWeight:600,marginBottom:4},children:[n+""," → ",i+""]}),mw("div",{style:{display:"grid",gridTemplateColumns:"auto 1fr",columnGap:8,fontSize:11},children:[null!=a&&mw(pw,{children:[fw("span",{style:{opacity:.6},children:"value"}),fw("span",{style:{textAlign:"right"},children:Fe(Number(a))})]}),null!=h&&mw(pw,{children:[fw("span",{style:{opacity:.6},children:"start"}),fw("span",{style:{textAlign:"right"},children:Ne(gw(h))})]}),null!=p&&mw(pw,{children:[fw("span",{style:{opacity:.6},children:"end"}),fw("span",{style:{textAlign:"right"},children:Ne(gw(p))})]})]})]})},[Me,Te,Ne,Fe,s,l,c,u,d]),Be=Ux(()=>{if(!Me)return null;const{centerlines:e,laneLifetime:t,nodeData:o,valueScale:r,compressedPadding:n,crossingsBefore:a,crossingsAfter:s,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=Pe(o.start),n=Pe(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 mw("g",{children:[M&&null!==(s??null)&&mw("text",{x:Se,y:-12,fontSize:10,fill:"#94a3b8",textAnchor:"end",children:["crossings: ",a," → ",s," ","edge length: ",Math.round(l)," → ",Math.round(c)]}),n&&fw("text",{x:Se,y:2,fontSize:10,fill:"#94a3b8",textAnchor:"end",children:"dense layout: lane gaps compressed"}),i.map((e,t)=>{const o=Pe(gw(e.date));return p-.5>o||o>f+.5?null:fw("line",{x1:o,y1:0,x2:o,y2:Ae,stroke:"#94a3b8",strokeOpacity:.15,strokeDasharray:"2 4"},"grid-"+t)}),C&&fe.map((n,i)=>{const a=t[n.id];if(!a||null===a.start)return null;const s=o[n.id],l=s?{topPeak:s.topPeak,botPeak:s.botPeak}:{topPeak:0,botPeak:0},c=e[n.id]+(l.botPeak-l.topPeak)*r/2,u=Pe(a.start),d=Pe(a.end),h=_e(n.id,i);return mw("g",{children:[fw("line",{x1:u,y1:c,x2:d,y2:c,stroke:h,strokeOpacity:.35,strokeWidth:1,strokeDasharray:"3 3"}),fw("line",{x1:u,y1:c-4,x2:u,y2:c+4,stroke:h,strokeOpacity:.5}),fw("line",{x1:d,y1:c-4,x2:d,y2:c+4,stroke:h,strokeOpacity:.5})]},"lane-"+n.id)}),fw("line",{x1:p,y1:Ae+4,x2:f,y2:Ae+4,stroke:"#94a3b8"}),i.map((e,t)=>{const o=gw(e.date),r=Pe(o);if(p-.5>r||r>f+.5)return null;const n=null!=e.label?e.label:W?W(new Date(o)):"";return mw("g",{transform:`translate(${r},${Ae+4})`,children:[fw("line",{y2:6,stroke:"#94a3b8"}),fw("text",{y:20,textAnchor:"middle",fontSize:11,fill:"#475569",children:n})]},t)})]})},[Me,i,Pe,Se,Ae,C,fe,_e,M,W]),ze=Ux(()=>(le??[]).map(e=>({id:pe(e),data:e})),[le,pe]),He=Ux(()=>{const e=new Map;for(const t of Re.ribbons)t.bezier&&e.set(t.id,t.bezier);return e},[Re]),Oe=Ux(()=>(se??[]).map((e,t)=>{const o=he(e,t),r=Number(yw(c,e));return{id:o,source:yw(s,e)+"",target:yw(l,e)+"",value:Number.isFinite(r)?r:0,bezier:He.get(o),data:e}}),[se,he,s,l,c,He]),We=ve.loadingEl,je=ve.emptyEl;return Ce.length>0?mw("svg",{width:_,height:L,role:"img","aria-label":$??"Process Sankey validation failed",children:[fw("text",{x:20,y:30,fontSize:13,fontWeight:600,fill:"var(--semiotic-danger, #dc2626)",children:"ProcessSankey: data invalid"}),Ce.map((e,t)=>{return fw("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})]}):We||je||fw(Mp,{ref:ce,chartType:"force",nodes:ze,edges:Oe,customNetworkLayout:dw,layoutConfig:Ie,size:[_,L],responsiveWidth:D,responsiveHeight:B,margin:ke,title:$,description:T??"Temporal process flow with lifetime-bounded node lanes, mass bands, and value-scaled ribbons.",summary:N,accessibleTable:F,enableHover:G,tooltipContent:!1===Y?()=>null:De,backgroundGraphics:Be,showParticles:X,particleStyle:U,legend:$e,legendPosition:v,onObservation:q,...V&&{customClickBehavior:e=>{if(!e||!e.data||!V)return;const t=e.data;hw(t)&&V(t.data,{x:e.x,y:e.y})}},chartId:K,colorScheme:Array.isArray(y)?y:void 0,...Q})});bw.displayName="ProcessSankey";import{useMemo as vw}from"react";import{jsx as xw}from"react/jsx-runtime";function ww(e){const t=wm(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:a="vertical",childrenAccessor:s="children",valueAccessor:l="value",nodeIdAccessor:c="name",colorBy:u,colorScheme:d,colorByDepth:h=!1,edgeStyle:p="curve",nodeLabel:f,nodeSize:m=5,tooltip:g,frameProps:y={},onObservation:b,onClick:v,chartId:x,selection:w,linkedHover:k,loading:S,loadingContent:A,legendInteraction:C,stroke:M,strokeWidth:P,opacity:_}=e,{width:L,height:R,enableHover:I,showLabels:$=!0,title:T,description:N,summary:F,accessibleTable:D}=t,B=Dx({nodes:vw(()=>$x(o??null,s),[o,s]),edges:void 0,inferNodes:!1,colorBy:h?void 0:u,colorScheme:d,showLegend:!1,legendInteraction:C,selection:w,linkedHover:k,onObservation:b,onClick:v,mobileInteraction:t.mobileInteraction,mobileSemantics:t.mobileSemantics,chartType:"TreeDiagram",chartId:x,marginDefaults:t.marginDefaults,userMargin:r,width:L,height:R,loading:S,loadingContent:A}),E=vw(()=>new Map,[]),z=vw(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=h?De[(e.depth||0)%De.length]:u?Ee(e.data||e,u,B.colorScale):pm(void 0,B.themeCategorical,d,void 0,E),t},[u,h,B.colorScale,B.themeCategorical,d,E]),H=vw(()=>Em(z,{stroke:M,strokeWidth:P,opacity:_}),[z,M,P,_]),O=vw(()=>()=>({stroke:"#999",strokeWidth:1,fill:"none"}),[]),W=vw(()=>Em(O,{stroke:M,strokeWidth:P,opacity:_}),[O,M,P,_]),j=vw(()=>{if("treemap"===i||"circlepack"===i||"partition"===i)return Nx(l)},[i,l]),Y=Pm({componentName:"TreeDiagram",data:o});return Y?xw(Bh,{componentName:"TreeDiagram",message:Y,width:L,height:R}):B.loadingEl?B.loadingEl:xw(Wh,{componentName:"TreeDiagram",width:L,height:R,children:xw(Mp,{chartType:i,...null!=o&&{data:o},size:[L,R],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:B.margin,nodeIDAccessor:c,childrenAccessor:s,hierarchySum:j,treeOrientation:a,edgeType:p,nodeStyle:H,edgeStyle:W,colorBy:u,colorScheme:B.effectivePalette,colorByDepth:h,nodeSize:m,nodeLabel:$?f||c:void 0,showLabels:$,enableHover:I,tooltipContent:!1===g?()=>null:gs(g)||void 0,..._p({linkedHover:k,selection:w,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:T,description:N,summary:F,accessibleTable:D,...null!=e.animate&&{animate:e.animate},...y})})}ww.displayName="TreeDiagram";import{useMemo as kw,useCallback as Sw}from"react";import{jsx as Aw}from"react/jsx-runtime";function Cw(e){const t=wm(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:a="value",nodeIdAccessor:s="name",colorBy:l,colorScheme:c,colorByDepth:u=!1,labelMode:d="leaf",nodeLabel:h,padding:p=4,paddingTop:f,nodeStyle:m,tooltip:g,frameProps:y={},selection:b,linkedHover:v,onObservation:x,onClick:w,chartId:k,loading:S,loadingContent:A,legendInteraction:C,stroke:M,strokeWidth:P,opacity:_}=e,{nodeStyle:L,...R}=y,{width:I,height:$,enableHover:T,showLabels:N=!0,title:F,description:D,summary:B,accessibleTable:E}=t,z=Dx({nodes:kw(()=>$x(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:w,mobileInteraction:t.mobileInteraction,mobileSemantics:t.mobileSemantics,chartType:"Treemap",chartId:k,marginDefaults:t.marginDefaults,userMargin:r,width:I,height:$,loading:S,loadingContent:A}),H=Tm(b),O=z.customHoverBehavior,W=Sw(e=>{if(!e)return O(null);const t=e.data||e;O({data:t?.data||t})},[O]),j=kw(()=>new Map,[]),Y=kw(()=>e=>{const t={stroke:"var(--semiotic-cell-border, var(--semiotic-border, #fff))",strokeWidth:1,strokeOpacity:.8};return t.fill=u?De[(e.depth||0)%De.length]:l?Ee(e.data||e,l,z.colorScale):pm(void 0,z.themeCategorical,c,void 0,j),t},[l,u,z.colorScale,z.themeCategorical,c,j]),G=kw(()=>m||L?e=>({...Y(e),...L?L(e)??{}:{},...m?m(e)??{}:{}}):Y,[Y,m,L]),q=kw(()=>Em(G,{stroke:M,strokeWidth:P,opacity:_}),[G,M,P,_]),V=kw(()=>z.activeSelectionHook?e=>{const t={...q(e)};if(z.activeSelectionHook.isActive)if(z.activeSelectionHook.predicate(e.data||e))H?.selectedStyle&&Object.assign(t,H.selectedStyle);else{const e=H?.unselectedOpacity??.5;t.opacity=e,t.fillOpacity=e,t.strokeOpacity=e,H?.unselectedStyle&&Object.assign(t,H.unselectedStyle)}return t}:q,[q,z.activeSelectionHook,H]),X=kw(()=>Nx(a),[a]),U=void 0!==f?f:!N||"parent"!==d&&"all"!==d?void 0:18,K=Pm({componentName:"Treemap",data:o});return K?Aw(Bh,{componentName:"Treemap",message:K,width:I,height:$}):z.loadingEl?z.loadingEl:Aw(Wh,{componentName:"Treemap",width:I,height:$,children:Aw(Mp,{chartType:"treemap",...null!=o&&{data:o},size:[I,$],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:z.margin,nodeIDAccessor:s,childrenAccessor:i,hierarchySum:X,padding:p,paddingTop:U,nodeStyle:V,colorBy:l,colorScheme:z.effectivePalette,colorByDepth:u,nodeLabel:N?h||s:void 0,showLabels:N,labelMode:d,enableHover:T,tooltipContent:!1===g?()=>null:gs(g)||void 0,..._p({linkedHover:v,selection:b,onObservation:x,onClick:w,mobileInteraction:z.mobileInteraction,customHoverBehavior:W,customClickBehavior:z.customClickBehavior,linkedHoverInClickPredicate:!1}),...C&&"none"!==C&&{legendHoverBehavior:z.legendState.onLegendHover,legendClickBehavior:z.legendState.onLegendClick,legendHighlightedCategory:z.legendState.highlightedCategory,legendIsolatedCategories:z.legendState.isolatedCategories},className:n,title:F,description:D,summary:B,accessibleTable:E,...null!=e.animate&&{animate:e.animate},...R})})}Cw.displayName="Treemap";import{useMemo as Mw}from"react";import{jsx as Pw}from"react/jsx-runtime";function _w(e){const t=wm(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:a="value",nodeIdAccessor:s="name",colorBy:l,colorScheme:c,colorByDepth:u=!1,nodeLabel:d,circleOpacity:h=.7,padding:p=4,tooltip:f,frameProps:m={},onObservation:g,onClick:y,chartId:b,selection:v,linkedHover:x,loading:w,loadingContent:k,legendInteraction:S,stroke:A,strokeWidth:C,opacity:M}=e,{width:P,height:_,enableHover:L,showLabels:R=!0,title:I,description:$,summary:T,accessibleTable:N}=t,F=Dx({nodes:Mw(()=>$x(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:g,onClick:y,mobileInteraction:t.mobileInteraction,mobileSemantics:t.mobileSemantics,chartType:"CirclePack",chartId:b,marginDefaults:t.marginDefaults,userMargin:r,width:P,height:_,loading:w,loadingContent:k}),D=Mw(()=>new Map,[]),B=Mw(()=>e=>{const t={stroke:"currentColor",strokeWidth:1,strokeOpacity:.3,fillOpacity:h};return t.fill=u?De[(e.depth||0)%De.length]:l?Ee(e.data||e,l,F.colorScale):pm(void 0,F.themeCategorical,c,void 0,D),t},[l,u,F.colorScale,h,F.themeCategorical,c,D]),E=Mw(()=>Em(B,{stroke:A,strokeWidth:C,opacity:M}),[B,A,C,M]),z=Mw(()=>Nx(a),[a]),H=Pm({componentName:"CirclePack",data:o});return H?Pw(Bh,{componentName:"CirclePack",message:H,width:P,height:_}):F.loadingEl?F.loadingEl:Pw(Wh,{componentName:"CirclePack",width:P,height:_,children:Pw(Mp,{chartType:"circlepack",...null!=o&&{data:o},size:[P,_],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:F.margin,nodeIDAccessor:s,childrenAccessor:i,hierarchySum:z,padding:p,nodeStyle:E,colorBy:l,colorScheme:F.effectivePalette,colorByDepth:u,nodeLabel:R?d||s:void 0,showLabels:R,enableHover:L,tooltipContent:!1===f?()=>null:gs(f)||void 0,..._p({linkedHover:x,selection:v,onObservation:g,onClick:y,mobileInteraction:F.mobileInteraction,customHoverBehavior:F.customHoverBehavior,customClickBehavior:F.customClickBehavior,linkedHoverInClickPredicate:!1}),...S&&"none"!==S&&{legendHoverBehavior:F.legendState.onLegendHover,legendClickBehavior:F.legendState.onLegendClick,legendHighlightedCategory:F.legendState.highlightedCategory,legendIsolatedCategories:F.legendState.isolatedCategories},className:n,title:I,description:$,summary:T,accessibleTable:N,...null!=e.animate&&{animate:e.animate},...m})})}_w.displayName="CirclePack";import{useMemo as Lw}from"react";import{jsx as Rw}from"react/jsx-runtime";var Iw=De;function $w(e){const t=wm(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:a="name",colorBy:s,colorScheme:l,colorByDepth:c=!1,orbitMode:u="flat",orbitSize:d=2.95,speed:h=.25,revolution:p,revolutionStyle:f,eccentricity:m=1,showRings:g=!0,nodeRadius:y=6,showLabels:b=!1,animated:v=!0,tooltip:x,foregroundGraphics:w,annotations:k,frameProps:S={},onObservation:A,onClick:C,chartId:M,selection:P,linkedHover:_,loading:L,loadingContent:R,stroke:I,strokeWidth:$,opacity:T}=e,{width:N,height:F,enableHover:D,title:B,description:E,summary:z,accessibleTable:H}=t,O=Dx({nodes:Lw(()=>$x(o,i),[o,i]),edges:void 0,inferNodes:!1,colorBy:c?void 0:s,colorScheme:l,showLegend:!1,legendInteraction:void 0,selection:P,linkedHover:_,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:N,height:F,loading:L,loadingContent:R}),W=Lw(()=>new Map,[]),{colorScale:j,customClickBehavior:Y,customHoverBehavior:G,themeCategorical:q}=O,V=Lw(()=>{if(Array.isArray(l))return l;const e=Te[l];return Array.isArray(e)?e:Ne},[l]),X=Lw(()=>e=>{const t={stroke:"#fff",strokeWidth:1},o=0===(e.depth??0);return t.fill=c?o?V[0]:Iw[(e.depth||0)%Iw.length]:s?Ee(e.data||e,s,j):pm(void 0,q,l,void 0,W),t.opacity=o?1:.85,t},[s,c,j,V,q,l,W]),U=Lw(()=>Em(X,{stroke:I,strokeWidth:$,opacity:T}),[X,I,$,T]),K=Lw(()=>()=>({stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1}),[]),Q=Lw(()=>e=>{G(e&&e.data&&void 0!==e.data.data?{...e,data:e.data.data}:e)},[G]),Z=Lw(()=>e=>{Y(e&&e.data&&void 0!==e.data.data?{...e,data:e.data.data}:e)},[Y]),J=Pm({componentName:"OrbitDiagram",data:o});return J?Rw(Bh,{componentName:"OrbitDiagram",message:J,width:N,height:F}):O.loadingEl?O.loadingEl:Rw(Wh,{componentName:"OrbitDiagram",width:N,height:F,children:Rw(Mp,{chartType:"orbit",...null!=o&&{data:o},size:[N,F],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:O.margin,nodeIDAccessor:a,childrenAccessor:i,nodeStyle:U,edgeStyle:K,colorBy:s,colorScheme:O.effectivePalette,colorByDepth:c,nodeSize:y,nodeLabel:b?a:void 0,showLabels:b,enableHover:!v&&D,tooltipContent:v?void 0:!1===x?()=>null:gs(x)||void 0,..._p({linkedHover:_,selection:P,onObservation:A,onClick:C,mobileInteraction:O.mobileInteraction,customHoverBehavior:Q,customClickBehavior:Z,linkedHoverInClickPredicate:!1}),foregroundGraphics:w,annotations:k,className:n,title:B,description:E,summary:z,orbitMode:u,orbitSize:d,orbitSpeed:h,orbitRevolution:p,orbitRevolutionStyle:f,orbitEccentricity:m,orbitShowRings:g,orbitAnimated:v,accessibleTable:H,...null!=e.animate&&{animate:e.animate},...S})})}$w.displayName="OrbitDiagram";import{useRef as Tw,useImperativeHandle as Nw,forwardRef as Fw,useCallback as Dw,useState as Bw,useEffect as Ew}from"react";import{jsx as zw,jsxs as Hw}from"react/jsx-runtime";var Ow={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"},Ww={opacity:.7,marginRight:4};function jw(e,t,o){if(null!=e)return"function"==typeof t?t(e):e["string"==typeof t?t:o]}function Yw(e){return null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+""}function Gw(e={}){const{timeAccessor:t,valueAccessor:o,xLabel:r="x",yLabel:n="y"}=e;return e=>{const i=e?.data??null,a=jw(i,t,"time"),s=jw(i,o,"value");return Hw("div",{className:"semiotic-tooltip",style:Ow,children:[Hw("div",{children:[Hw("span",{style:Ww,children:[r,":"]}),Yw(a)]}),Hw("div",{children:[Hw("span",{style:Ww,children:[n,":"]}),Yw(s)]})]})}}function qw(e,t){return null!=e?e:Math.max(t?.length??0,200)}var Vw=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}},Xw=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 Vw,this.windows.set(e,o)),o.push(t)}pushSession(e,t){const o=this.gap,r=new Vw;r.push(t);let n=e,i=e;const a=[],s={start:n,end:i,stats:r};for(const t of this.sessions)e-o>t.end||t.start>e+o?a.push(t):(s.stats.merge(t.stats),n>t.start&&(n=t.start),t.end>i&&(i=t.end));s.start=n,s.end=i,a.push(s),a.sort((e,t)=>e.start-t.start),this.sessions=a}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 Uw(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 Kw={ms:1,s:1e3,m:6e4,h:36e5,d:864e5},Qw=/(\d+(?:\.\d+)?)(ms|s|m|h|d)/g;function Zw(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;Qw.lastIndex=0;let o,r=0,n=0;for(;null!==(o=Qw.exec(t));){const e=parseFloat(o[1]),t=Kw[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 Jw="time",ek="value",tk="__aggLower",ok="__aggUpper",rk="__aggPartial",nk="count",ik="__aggStart",ak="__aggEnd";function sk(e,t){const o=t.stat??"mean",r=t.band??"none",n=t.sigma??1;return e.emit().map(e=>{const t={[Jw]:(e.start+e.end)/2,[ek]:Uw(e,o),[nk]:e.count,[rk]:e.partial,[ik]:e.start,[ak]:e.end},i=function(e,t,o,r=1){if("none"===t)return null;if("minmax"===t)return[e.min,e.max];const n=Uw(e,o),i=e.stddev*r;return[n-i,n+i]}(e,r,o,n);return i&&(t[tk]=i[0],t[ok]=i[1]),t})}var lk=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}};import{jsx as ck}from"react/jsx-runtime";function uk(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 dk=Fw(function(e,t){const o=wm(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:a="right",windowMode:s="sliding",windowSize:l,data:c,timeAccessor:u,valueAccessor:d,timeExtent:h,valueExtent:p,extentPadding:f,stroke:m="#007bff",strokeWidth:g=2,strokeDasharray:y,opacity:b,background:v,tooltipContent:x,tooltip:w,onHover:k,annotations:S,autoPlaceAnnotations:A,svgAnnotationRules:C,tickFormatTime:M,tickFormatValue:P,decay:_,pulse:L,staleness:R,transition:I,linkedHover:$,selection:T,onObservation:N,chartId:F,loading:D,loadingContent:B,emptyContent:E,emphasis:z,legendPosition:H,aggregate:O,eventTime:W}=e,j=o.showAxes,Y=o.enableHover,G=n??o.marginDefaults,q=r??[o.width,o.height],V=x??w??Gw({timeAccessor:u,valueAccessor:d}),X=Tw(null),{customHoverBehavior:U}=gm({selection:T,linkedHover:$,unwrapData:!0,onObservation:N,chartType:"RealtimeLineChart",chartId:F}),K=Dw(e=>{k&&k(e),U(e)},[k,U]),Q=null!=O,[Z,J]=Bw([]),ee=Tw(null),te=Tw(O);te.current=O;const oe=Tw(Q);oe.current=Q;const re=Tw(Z);re.current=Z;const ne=Tw({timeAccessor:u,valueAccessor:d});ne.current={timeAccessor:u,valueAccessor:d},Ew(()=>{if(!Q)return void(ee.current=null);const e=te.current,t=function(e){const t=e.window??"tumbling",o=Zw("session"===t?e.gap??e.size:e.size);if(null==o)return null;const r=null!=e.hop?Zw(e.hop):void 0,n=null!=e.gap?Zw(e.gap):void 0;return new Xw({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=uk(r,e,"time"),i=uk(r,o,"value");null!=n&&null!=i&&t.push(n,i)}}J(t?sk(t,e):[])},[Q?[O.window??"tumbling",O.size,O.hop??"",O.gap??"",O.retain??""].join("|"):"",Q,c]),Ew(()=>{Q&&ee.current&&J(sk(ee.current,te.current))},[O?.stat,O?.band,O?.sigma]);const ie=Dw(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=uk(o,r,"time"),i=uk(o,n,"value");null!=e&&null!=i&&t.push(e,i)}J(sk(t,o))},[]),ae=null!=W,se=Tw(null),le=Tw(W);le.current=W;const ce=Tw(ae);ce.current=ae;const ue=Tw(N);ue.current=N;const de=Tw(F);de.current=F,Ew(()=>{se.current=ae?function(e){const t=Zw(e.lateness);return null==t?null:new lk({lateness:t,getTime:e=>uk(e,ne.current.timeAccessor,"time")??NaN,latePolicy:e.latePolicy??"drop"})}(le.current):null},[ae?`${W.lateness}|${W.latePolicy??"drop"}`:"",ae]);const he=Dw(e=>{0!==e.length&&(oe.current?ie(e):X.current?.pushMany(e))},[ie]),pe=Dw(e=>{const t=se.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:uk(i,r,"time")??NaN,watermark:t.watermark,policy:n,lateCount:t.lateCount,timestamp:Date.now(),chartType:"RealtimeLineChart",chartId:de.current})}}}he(o)},[he]);Nw(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:()=>{se.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=qh(D,q[0],q[1],B),me=fe?null:Gh(Q?void 0:c,q[0],q[1],E),ge={stroke:m,strokeWidth:g,strokeDasharray:y};null!=b&&(ge.opacity=b);const ye=qw(l,c),be=Q?Z:c,ve=Q?Jw:u,xe=Q?ek:d,we=Q&&O&&"none"!==(O.band??"none")?{y0Accessor:tk,y1Accessor:ok,perSeries:!1}:void 0;return fe||me||ck(Hl,{ref:X,chartType:"line",runtimeMode:"streaming",size:q,margin:G,className:z?`${i||""} semiotic-emphasis-${z}`.trim():i,arrowOfTime:a,windowMode:Q?"growing":s,windowSize:Q?Math.max(1,O?.retain??Math.max(Z.length,600)):ye,data:be,timeAccessor:ve,valueAccessor:xe,xExtent:h,yExtent:p,extentPadding:f,band:we,lineStyle:ge,showAxes:j,background:v,hoverAnnotation:Y,tooltipContent:V,..._p({linkedHover:$,selection:T,onObservation:N,forceHoverBehavior:!0,mobileInteraction:o.mobileInteraction,customHoverBehavior:K}),annotations:S,autoPlaceAnnotations:A,svgAnnotationRules:C,tickFormatTime:M,tickFormatValue:P,decay:_,pulse:L,staleness:R,transition:I,pointIdAccessor:e.pointIdAccessor,legendPosition:H})});dk.displayName="RealtimeLineChart";import{useRef as hk,useImperativeHandle as pk,forwardRef as fk,useCallback as mk,useMemo as gk}from"react";import{jsx as yk}from"react/jsx-runtime";function bk(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 vk=fk(function(e,t){const o=wm(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:a,arrowOfTime:s="right",windowMode:l="sliding",windowSize:c,data:u,timeAccessor:d,valueAccessor:h,direction:p="up",timeExtent:f,valueExtent:m,extentPadding:g,categoryAccessor:y,colors:b,fill:v,stroke:x,strokeWidth:w,opacity:k,gap:S,background:A,tooltipContent:C,tooltip:M,onHover:P,annotations:_,autoPlaceAnnotations:L,svgAnnotationRules:R,tickFormatTime:I,tickFormatValue:$,linkedHover:T,selection:N,decay:F,pulse:D,staleness:B,transition:E,onObservation:z,chartId:H,loading:O,loadingContent:W,emptyContent:j,emphasis:Y,legendPosition:G,brush:q,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=jw(r,t,"time"),n=jw(r,o,"value");return Hw("div",{className:"semiotic-tooltip",style:Ow,children:[Hw("div",{children:[zw("span",{style:Ww,children:"x:"}),Yw(e)]}),Hw("div",{children:[zw("span",{style:Ww,children:"y:"}),Yw(n)]})]})}return Hw("div",{className:"semiotic-tooltip",style:Ow,children:[Hw("div",{children:[zw("span",{style:Ww,children:"range:"}),Yw(r.binStart),"–",Yw(r.binEnd)]}),null!=r.total&&Hw("div",{children:[zw("span",{style:Ww,children:"count:"}),Yw(r.total)]}),null!=r.category&&Hw("div",{children:[zw("span",{style:Ww,children:"category:"}),Yw(r.category)]})]})}}({timeAccessor:d,valueAccessor:h}),ee=hk(null),{customHoverBehavior:te}=gm({selection:N,linkedHover:T,unwrapData:!0,onObservation:z,chartType:"RealtimeHistogram",chartId:H}),oe=mk(e=>{P&&P(e),te(e)},[P,te]),re=!0===q?{dimension:"x",snap:"bin"}:"x"===q?{dimension:"x"}:"object"==typeof q?q:void 0,ne=zf(X),ie="string"==typeof d?d:"time",ae=vf({name:ne?.name||"__unused_hist_brush__",xField:ne?.xField||ie,...ne?.yField?{yField:ne.yField}:{}}),se=hk(ae.brushInteraction);se.current=ae.brushInteraction;const le=mk(e=>{if(V&&V(e),z&&z(e?{type:"brush",extent:e,timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:H}:{type:"brush-end",timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:H}),ne){const t=se.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,z,H,ne]);pk(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=qh(O,Z[0],Z[1],W),ue=ce?null:Gh(u,Z[0],Z[1],j),de={};null!=v&&(de.fill=v),null!=x&&(de.stroke=x),null!=w&&(de.strokeWidth=w),null!=k&&(de.opacity=k),null!=S&&(de.gap=S);const he=Y?`${a||""} semiotic-emphasis-${Y}`.trim():a,pe=qw(c,u),fe=gk(()=>"down"!==p?m: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 a=new Map;for(const n of e){const e=bk(n,o,"time"),i=bk(n,t,"value");if(null==e||null==i)continue;const s=Math.floor(e/r)*r;a.set(s,(a.get(s)??0)+i)}let s=0;for(const e of a.values())e>s&&(s=e);return[s>0?s+s*(i??.1):1,0]}({data:u,valueAccessor:h,timeAccessor:d,binSize:r,valueExtent:m,extentPadding:g}),[p,u,h,d,r,m,g]);return ce||ue||yk(Hl,{ref:ee,chartType:"bar",runtimeMode:"streaming",size:Z,margin:Q,className:he,arrowOfTime:s,windowMode:l,windowSize:pe,data:u,timeAccessor:d,valueAccessor:h,xExtent:f,yExtent:fe,extentPadding:g,binSize:r,categoryAccessor:y,barColors:b,barStyle:de,showAxes:U,background:A,hoverAnnotation:K,tooltipContent:J,..._p({linkedHover:T,selection:N,onObservation:z,forceHoverBehavior:!0,mobileInteraction:o.mobileInteraction,customHoverBehavior:oe}),annotations:_,autoPlaceAnnotations:L,svgAnnotationRules:R,tickFormatTime:I,tickFormatValue:$,decay:F,pulse:D,staleness:B,transition:E,pointIdAccessor:e.pointIdAccessor,legendPosition:G,brush:re||(X?{dimension:"x"}:void 0),onBrush:re||X?le:void 0})});function xk(e){return yk(vk,{...e,windowMode:"growing"})}vk.displayName="RealtimeHistogram",xk.displayName="TemporalHistogram";var wk=vk;import{useRef as kk,useImperativeHandle as Sk,forwardRef as Ak,useCallback as Ck}from"react";import{jsx as Mk}from"react/jsx-runtime";var Pk=Ak(function(e,t){const o=wm(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:a="right",windowMode:s="sliding",windowSize:l,data:c,timeAccessor:u,valueAccessor:d,timeExtent:h,valueExtent:p,yScaleType:f,extentPadding:m,categoryAccessor:g,colors:y,radius:b,fill:v,opacity:x,stroke:w,strokeWidth:k,pointStyle:S,background:A,tooltipContent:C,tooltip:M,onHover:P,annotations:_,autoPlaceAnnotations:L,svgAnnotationRules:R,tickFormatTime:I,tickFormatValue:$,linkedHover:T,selection:N,onObservation:F,chartId:D,loading:B,loadingContent:E,emptyContent:z,emphasis:H,legendPosition:O}=e,W=o.showAxes,j=o.enableHover,Y=n??o.marginDefaults,G=r??[o.width,o.height],q=C??M??Gw({timeAccessor:u,valueAccessor:d}),V=kk(null),{customHoverBehavior:X}=gm({selection:N,linkedHover:T,unwrapData:!0,onObservation:F,chartType:"RealtimeSwarmChart",chartId:D}),U=Ck(e=>{P&&P(e),X(e)},[P,X]);Sk(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=qh(B,G[0],G[1],E),Q=K?null:Gh(c,G[0],G[1],z),Z={};null!=b&&(Z.radius=b),null!=v&&(Z.fill=v),null!=x&&(Z.opacity=x),null!=w&&(Z.stroke=w),null!=k&&(Z.strokeWidth=k);const J=S,ee=H?`${i||""} semiotic-emphasis-${H}`.trim():i,te=qw(l,c);return K||Q||Mk(Hl,{ref:V,chartType:"swarm",runtimeMode:"streaming",size:G,margin:Y,className:ee,arrowOfTime:a,windowMode:s,windowSize:te,data:c,timeAccessor:u,valueAccessor:d,xExtent:h,yExtent:p,yScaleType:f,extentPadding:m,categoryAccessor:g,barColors:y,swarmStyle:Z,pointStyle:J,showAxes:W,background:A,hoverAnnotation:j,tooltipContent:q,..._p({linkedHover:T,selection:N,onObservation:F,forceHoverBehavior:!0,mobileInteraction:o.mobileInteraction,customHoverBehavior:U}),annotations:_,autoPlaceAnnotations:L,svgAnnotationRules:R,tickFormatTime:I,tickFormatValue:$,legendPosition:O,pointIdAccessor:e.pointIdAccessor})});Pk.displayName="RealtimeSwarmChart";import{useRef as _k,useImperativeHandle as Lk,forwardRef as Rk,useCallback as Ik}from"react";import{jsx as $k}from"react/jsx-runtime";var Tk=Rk(function(e,t){const o=wm(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:a="right",windowMode:s="sliding",windowSize:l,data:c,timeAccessor:u,valueAccessor:d,timeExtent:h,valueExtent:p,extentPadding:f,positiveColor:m,negativeColor:g,connectorStroke:y,connectorWidth:b,gap:v,stroke:x,strokeWidth:w,opacity:k,background:S,tooltipContent:A,tooltip:C,onHover:M,annotations:P,autoPlaceAnnotations:_,svgAnnotationRules:L,tickFormatTime:R,tickFormatValue:I,linkedHover:$,selection:T,onObservation:N,chartId:F,loading:D,loadingContent:B,emptyContent:E,emphasis:z,legendPosition:H}=e,O=o.showAxes,W=o.enableHover,j=n??o.marginDefaults,Y=r??[o.width,o.height],G=A??C??function(e={}){const{timeAccessor:t,valueAccessor:o}=e;return e=>{const r=e?.data??null,n=jw(r,t,"time"),i=r?.delta??jw(r,o,"value"),a=r?.cumEnd,s="number"==typeof i?0>i?Yw(i):"+"+Yw(i):Yw(i);return Hw("div",{className:"semiotic-tooltip",style:Ow,children:[Hw("div",{children:[zw("span",{style:Ww,children:"x:"}),Yw(n)]}),Hw("div",{children:[zw("span",{style:Ww,children:"Δ:"}),s]}),null!=a&&Hw("div",{children:[zw("span",{style:Ww,children:"total:"}),Yw(a)]})]})}}({timeAccessor:u,valueAccessor:d}),q=_k(null),{customHoverBehavior:V}=gm({selection:T,linkedHover:$,unwrapData:!0,onObservation:N,chartType:"RealtimeWaterfallChart",chartId:F}),X=Ik(e=>{M&&M(e),V(e)},[M,V]);Lk(t,()=>({push:e=>q.current?.push(e),pushMany:e=>q.current?.pushMany(e),remove:e=>q.current?.remove(e)??[],update:(e,t)=>q.current?.update(e,t)??[],clear:()=>q.current?.clear(),getData:()=>q.current?.getData()??[],getScales:()=>q.current?.getScales()??null}),[]);const U=qh(D,Y[0],Y[1],B),K=U?null:Gh(c,Y[0],Y[1],E),Q={};null!=m&&(Q.positiveColor=m),null!=g&&(Q.negativeColor=g),null!=y&&(Q.connectorStroke=y),null!=b&&(Q.connectorWidth=b),null!=v&&(Q.gap=v),null!=x&&(Q.stroke=x),null!=w&&(Q.strokeWidth=w),null!=k&&(Q.opacity=k);const Z=z?`${i||""} semiotic-emphasis-${z}`.trim():i,J=qw(l,c);return U||K||$k(Hl,{ref:q,chartType:"waterfall",runtimeMode:"streaming",size:Y,margin:j,className:Z,arrowOfTime:a,windowMode:s,windowSize:J,data:c,timeAccessor:u,valueAccessor:d,xExtent:h,yExtent:p,extentPadding:f,waterfallStyle:Q,showAxes:O,background:S,hoverAnnotation:W,tooltipContent:G,..._p({linkedHover:$,selection:T,onObservation:N,forceHoverBehavior:!0,mobileInteraction:o.mobileInteraction,customHoverBehavior:X}),annotations:P,autoPlaceAnnotations:_,svgAnnotationRules:L,tickFormatTime:R,tickFormatValue:I,legendPosition:H,pointIdAccessor:e.pointIdAccessor})});Tk.displayName="RealtimeWaterfallChart";import{useRef as Nk,useImperativeHandle as Fk,forwardRef as Dk,useCallback as Bk}from"react";import{jsx as Ek}from"react/jsx-runtime";var zk=Dk(function(e,t){const o=wm(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:a="right",windowMode:s="sliding",windowSize:l,data:c,timeAccessor:u,valueAccessor:d,categoryAccessor:h,timeExtent:p,valueExtent:f,extentPadding:m,heatmapXBins:g=20,heatmapYBins:y=20,aggregation:b="count",background:v,tooltipContent:x,tooltip:w,onHover:k,annotations:S,autoPlaceAnnotations:A,svgAnnotationRules:C,tickFormatTime:M,tickFormatValue:P,decay:_,pulse:L,staleness:R,linkedHover:I,selection:$,onObservation:T,chartId:N,loading:F,loadingContent:D,emptyContent:B,emphasis:E,legendPosition:z}=e,H=o.showAxes,O=o.enableHover,W=n??o.marginDefaults,j=r??[o.width,o.height],Y=x??w??function(e={}){const{timeAccessor:t,valueAccessor:o,xLabel:r="x",yLabel:n="y"}=e;return e=>{const i=e?.data??null,a=i?.xCenter??jw(i,t,"time"),s=i?.yCenter??jw(i,o,"value"),l=i?.count,c=i?.sum,u=i?.value,d=i?.agg??"count";return Hw("div",{className:"semiotic-tooltip",style:Ow,children:[Hw("div",{children:[Hw("span",{style:Ww,children:[r,":"]}),Yw(a)]}),Hw("div",{children:[Hw("span",{style:Ww,children:[n,":"]}),Yw(s)]}),null!=l&&Hw("div",{children:[zw("span",{style:Ww,children:"count:"}),Yw(l)]}),"sum"===d&&null!=c&&Hw("div",{children:[zw("span",{style:Ww,children:"sum:"}),Yw(c)]}),"mean"===d&&null!=u&&Hw("div",{children:[zw("span",{style:Ww,children:"mean:"}),Yw(u)]})]})}}({timeAccessor:u,valueAccessor:d}),G=Nk(null),{customHoverBehavior:q}=gm({selection:$,linkedHover:I,unwrapData:!0,onObservation:T,chartType:"RealtimeHeatmap",chartId:N}),V=Bk(e=>{k&&k(e),q(e)},[k,q]);Fk(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 X=qh(F,j[0],j[1],D),U=X?null:Gh(c,j[0],j[1],B),K=E?`${i||""} semiotic-emphasis-${E}`.trim():i,Q=qw(l,c);return X||U||Ek(Hl,{ref:G,chartType:"heatmap",runtimeMode:"streaming",size:j,margin:W,className:K,arrowOfTime:a,windowMode:s,windowSize:Q,data:c,timeAccessor:u,valueAccessor:d,categoryAccessor:h,xExtent:p,yExtent:f,extentPadding:m,heatmapXBins:g,heatmapYBins:y,heatmapAggregation:b,showAxes:H,background:v,hoverAnnotation:O,tooltipContent:Y,..._p({linkedHover:I,selection:$,onObservation:T,forceHoverBehavior:!0,mobileInteraction:o.mobileInteraction,customHoverBehavior:V}),annotations:S,autoPlaceAnnotations:A,svgAnnotationRules:C,tickFormatTime:M,tickFormatValue:P,decay:_,pulse:L,staleness:R,legendPosition:z,pointIdAccessor:e.pointIdAccessor})});zk.displayName="RealtimeHeatmap";import*as Hk from"react";function Ok(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"}function Wk(e){return 10>e?"0"+e:e+""}var jk=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Yk(e){let t,o=e;return(r,n,i)=>{const a=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 12e4>o?"seconds":72e5>o?"minutes":1728e5>o?"hours":5184e6>o?"days":3456e7>o?"months":"years"}(i));const s=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(),a=i||e.getUTCHours()!==t.getUTCHours(),s=a||e.getUTCMinutes()!==t.getUTCMinutes(),l=jk[e.getUTCMonth()],c=e.getUTCDate(),u=e.getUTCFullYear(),d=Wk(e.getUTCHours()),h=Wk(e.getUTCMinutes()),p=Wk(e.getUTCSeconds());switch(o){case"seconds":return r?`${l} ${c}, ${u} ${d}:${h}:${p}`:i?`${l} ${c} ${d}:${h}:${p}`:a?`${d}:${h}:${p}`:s?`${h}:${p}`:":"+p;case"minutes":return r?`${l} ${c}, ${u} ${d}:${h}`:i?`${l} ${c} ${d}:${h}`:a?`${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}}(a,new Date(i[n-1]),s):function(e,t){const o=jk[e.getUTCMonth()],r=e.getUTCDate(),n=e.getUTCFullYear(),i=Wk(e.getUTCHours()),a=Wk(e.getUTCMinutes()),s=Wk(e.getUTCSeconds());switch(t){case"seconds":return`${o} ${r}, ${n} ${i}:${a}:${s}`;case"minutes":case"hours":return`${o} ${r}, ${n} ${i}:${a}`;case"days":return`${o} ${r}, ${n}`;case"months":return`${o} ${n}`;case"years":return""+n}}(a,s)}}async function Gk(e,t){const{format:o="png",filename:r="chart",scale:n=2,background:i="white"}=t||{},a=e.querySelector("svg");if(!a)throw Error("No SVG element found in the container");const s=a.cloneNode(!0),l=a.getBoundingClientRect();if(s.getAttribute("width")||s.setAttribute("width",l.width+""),s.getAttribute("height")||s.setAttribute("height",l.height+""),s.getAttribute("xmlns")||s.setAttribute("xmlns","http://www.w3.org/2000/svg"),qk(a,s),"svg"===o){const e=(new XMLSerializer).serializeToString(s);Vk(new Blob([e],{type:"image/svg+xml;charset=utf-8"}),r+".svg")}else{const t=l.width*n,o=l.height*n,a=document.createElement("canvas");a.width=t,a.height=o;const c=a.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(s),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),a.toBlob(o=>{o?(Vk(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 qk(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++)qk(o[e],r[e])}function Vk(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 Xk={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}}},Uk=["vertical","horizontal"],Kk=["horizontal","vertical"],Qk=["right","left","top","bottom"],Zk=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"];function Jk(e){const t={type:e.type};return e.enum&&(t.enum=[...e.enum]),t}function eS(e){const t={};for(const[o,r]of Object.entries(function(e){const t={};for(const o of e.propBags)Object.assign(t,Xk[o]);return Object.assign(t,e.ownProps),t}(e)))t[o]=Jk(r);return{required:[...e.required],dataShape:e.dataShape,dataAccessors:[...e.dataAccessors],props:t}}var tS=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:Uk,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:Uk,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:Uk,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:Uk,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:Uk,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:Uk,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:Uk,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:Kk,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:Qk}},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:Kk,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:Qk}},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:ov,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:Uk,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:Zk,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:Zk,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:Zk,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:Zk,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:Qk,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:Dy,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:Uk,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,eS(t)])),oS=["value","threshold","partition-boundary","time-window","range-boundary"];function rS({controlType:e,controlId:t,chartId:o,chartType:r="VisualizationControl",onObservation:n}){return(i,a,s)=>{n?.({type:i,controlType:e,value:a,chartType:r,timestamp:Date.now(),...t?{controlId:t}:{},...o?{chartId:o}:{},...s?{source:s}:{}})}}function nS(e,t,o,r,n){return{id:e,...t?{controlId:t}:{},status:o,message:r,...n?{remediation:n}:{}}}function iS({controls:e=[],minimumTargetSize:t=24}){const o=[],r=new Set;for(const n of e){const e=n?.id,i="controls."+(e||"unknown"),a=n?.domain,s=Array.isArray(a)&&2===a.length&&Number.isFinite(a[0])&&Number.isFinite(a[1])&&a[1]>a[0],l=oS.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(nS(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(nS(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(nS(i+".domain",e,s?"pass":"fail",s?"Control has a finite ordered value domain.":"Control has no finite ordered value domain.","Declare domain as [minimum, maximum].")),o.push(nS(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(nS(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(nS(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(nS(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(nS(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(nS(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 aS(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=>aS(e,t)):Object.entries(e).every(([,e])=>aS(e,t));return t.delete(e),r}var sS=Symbol.for("semiotic.chartRecipeRegistry");function lS(e){return function(){const e=globalThis;return e[sS]||(e[sS]={recipes:new Map,capabilities:new Map,layouts:new Map}),e[sS]}().recipes.get(e)}function cS(e){return"string"==typeof e?lS(e):e&&"object"==typeof e&&"string"==typeof e.id?e:void 0}function uS(e){return"string"==typeof e?e:e.id??e.name}function dS(e){return e.layoutConfig&&"object"==typeof e.layoutConfig?e.layoutConfig:{}}function hS(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 pS(e,t,o){return o??cS(t.recipe)??cS(t.recipeId)??lS(e)}function fS(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 mS(e,t){return e.dataRoles.find(e=>e.role===t)}function gS(e,t){return e.dataRoles.find(e=>t.includes(e.semanticType))}function yS(e,t,o,r,n,i={}){const a={...i};if(t)for(const[e,o]of Object.entries(t))a[e]=o;for(const e of o.dataRoles){const o=fS(e,r,n),i=t&&o?t[o]:o;void 0!==i&&(a[e.role]=i)}return e.replace(/\{([^}]+)\}/g,(e,t)=>{const o=a[t];return null==o?`{${t}}`:o+""})}var bS=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"]),vS=new Set(["data","nodes","edges","points","areas","lines","flows"]);function xS(e,t){return!!vS.has(e)&&("areas"!==e||"string"!=typeof t)}var wS="function"==typeof structuredClone?structuredClone:e=>JSON.parse(JSON.stringify(e));function kS(e,t,o){const r=lS(e)??cS(t.recipe)??cS(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&&!bS.has(n)&&"recipeId"!==n&&(t||!xS(n,i)))if("function"==typeof i||i?.$$typeof){if(o)throw Error(`Portable recipe prop "${n}" is not JSON-safe.`)}else if(aS(i))r[n]=wS(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(uS).filter(e=>!!e),i={name:e.name,intents:n,...e.audience?.primary?{audience:[e.audience.primary]}:{},frameFamily:e.frameFamily};if("portable"===e.portability){if(!aS(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:"1",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:"1",createdAt:(new Date).toISOString(),...o?.selections?{selections:o.selections}:{}}}(r,t,o);if(!tS[e])throw Error(`Unknown component "${e}". Known components: ${Object.keys(tS).join(", ")}`);const n=!1!==o?.includeData,i={};for(const[e,o]of Object.entries(t))null!=o&&(bS.has(e)||!n&&xS(e,o)||"function"!=typeof o&&(o?.$$typeof||(i[e]=wS(o))));return{component:e,props:i,version:"1",createdAt:(new Date).toISOString(),...o?.selections?{selections:o.selections}:{}}}function SS(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=lS(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:{...wS(e.props),recipeId:e.recipeId}}}if(!tS[e.component])throw Error(`Unknown component "${e.component}". This config may require a newer version of semiotic.`);return{componentName:e.component,props:wS(e.props)}}function AS(e){const t=JSON.stringify(e);return"sc="+btoa(unescape(encodeURIComponent(t))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function CS(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 MS(e,t="json"){const o="jsx"===t?PS(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 PS(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 _S(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 LS(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 RS(e){return"nominal"===e||"ordinal"===e}function IS(e){return"quantitative"===e||"temporal"===e}function $S(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}var TS={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"},NS={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"},FS={sum:"sum",mean:"mean",average:"mean",count:"count",min:"min",max:"max",median:"mean"};function DS(e){e=function(e){const t=e;if(!function(e){const t=e.usermeta;if($S(t)&&$S(t.idid))return t.idid}(e)||!Array.isArray(t.layer))return e;const o=t.layer.filter(e=>$S(e)&&!function(e){return!!($S(e)&&$S(e.usermeta)&&$S(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,...a}=o[0];return{...n,...a}}(e);const t=[],{type:o,markProps:n}=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),i=e.encoding||{},a=i.x,s=i.y,l=i.color,c=i.size,u=i.theta,d=i.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||i.facet||i.row||i.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),l?.field&&(p.colorBy=l.field,l.scale?.scheme)){const e=TS[l.scale.scheme];e&&(p.colorScheme=e)}void 0!==d?.value&&(p.pointOpacity=d.value);const m=a?.aggregate,g=s?.aggregate;if(h&&(m||g)){const e=g?s:a,t=g?a:s,o=FS[e.aggregate];if(o&&t?.field&&e.field)h=function(e,t){const{groupBy:o,value:n,agg:i="sum"}=t,a=new Map;for(const t of e){const e=t[o]+"";a.has(e)||a.set(e,[]),a.get(e).push(Number(t[n]))}const s=[];for(const[e,t]of a){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=r(t)[0];break;case"max":n=r(t)[1];break;default:n=t.reduce((e,t)=>e+t,0)}s.push({[o]:e,value:n})}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(a?.bin||s?.bin){const e="Histogram";h&&(p.data=h),a?.bin?(p.valueAccessor=a.field,s?.field&&(p.categoryAccessor=s.field),a.axis?.title&&(p.valueLabel=a.axis.title)):s?.bin&&(p.valueAccessor=s.field,a?.field&&(p.categoryAccessor=a.field),s.axis?.title&&(p.valueLabel=s.axis.title));const o=a?.bin||s?.bin,r="object"==typeof o?o.maxbins:void 0;return r&&(p.bins=r),ES(e,p,t)}let y;switch(o){case"bar":y=function(e,t,o,r,n,i,a){let s;return o?.field&&!1!==e?.stack&&!1!==t?.stack&&null!==e?.stack&&null!==t?.stack?(s="StackedBarChart",r.stackBy=o.field):s="BarChart",RS(e?.type)&&IS(t?.type)?(r.categoryAccessor=e.field,r.valueAccessor=a?"value":t.field,e?.axis?.title&&(r.categoryLabel=e.axis.title),t?.axis?.title&&(r.valueLabel=t.axis.title)):IS(e?.type)&&RS(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=a?"value":t.field),e?.axis?.title&&(r.categoryLabel=e.axis.title),t?.axis?.title&&(r.valueLabel=t.axis.title)),n&&(r.data=n),s}(a,s,l,p,h,m,g);break;case"line":if(y="LineChart",BS(a,s,p,m,g),l?.field&&(p.lineBy=l.field),n.interpolate){const e=NS[n.interpolate];e&&(p.curve=e)}!0===n.point&&(p.showPoints=!0),h&&(p.data=h);break;case"area":if(l?.field?(y="StackedAreaChart",p.areaBy=l.field):y="AreaChart",BS(a,s,p,m,g),n.interpolate){const e=NS[n.interpolate];e&&(p.curve=e)}void 0!==n.opacity&&(p.areaOpacity=n.opacity),h&&(p.data=h);break;case"point":case"circle":case"square":c?.field?(y="BubbleChart",p.sizeBy=c.field,c.scale?.range&&(p.sizeRange=c.scale.range)):y="Scatterplot",BS(a,s,p,m,g),h&&(p.data=h);break;case"rect":y="Heatmap",a?.field&&(p.xAccessor=a.field),s?.field&&(p.yAccessor=s.field),l?.field&&(p.valueAccessor=l.field,delete p.colorBy),a?.axis?.title&&(p.xLabel=a.axis.title),s?.axis?.title&&(p.yLabel=s.axis.title),h&&(p.data=h);break;case"arc":n.innerRadius&&n.innerRadius>0?(y="DonutChart",p.innerRadius=n.innerRadius):y="PieChart",u?.field?p.valueAccessor=u.field:s?.field&&(p.valueAccessor=g?"value":s.field),l?.field&&(p.categoryAccessor=l.field),a?.field&&!u?.field&&(p.categoryAccessor=a.field),h&&(p.data=h);break;case"tick":y="DotPlot",RS(a?.type)?(p.categoryAccessor=a.field,s?.field&&(p.valueAccessor=g?"value":s.field),a?.axis?.title&&(p.categoryLabel=a.axis.title),s?.axis?.title&&(p.valueLabel=s.axis.title)):RS(s?.type)?(p.categoryAccessor=s.field,a?.field&&(p.valueAccessor=m?"value":a.field),p.orientation="horizontal",s?.axis?.title&&(p.categoryLabel=s.axis.title),a?.axis?.title&&(p.valueLabel=a.axis.title)):(a?.field&&(p.categoryAccessor=a.field),s?.field&&(p.valueAccessor=g?"value":s.field)),h&&(p.data=h);break;default:t.push(`Unsupported mark type "${o}". Defaulting to Scatterplot.`),y="Scatterplot",BS(a,s,p,m,g),h&&(p.data=h)}return ES(y,p,t)}function BS(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 ES(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}import*as zS from"react";var HS=new Set(["LineChart","AreaChart","StackedAreaChart","DifferenceChart","Scatterplot","BubbleChart","ConnectedScatterplot","QuadrantChart","MultiAxisLineChart","MinimapChart"]),OS=new Set(["BarChart","StackedBarChart","GroupedBarChart","DotPlot"]),WS=new Set(["PieChart","DonutChart","FunnelChart"]),jS=new Set(["Histogram","BoxPlot","ViolinPlot","RidgelinePlot","SwarmPlot"]);function YS(e,t){return OS.has(e)||WS.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 GS(e){for(const t of["lineBy","areaBy","stackBy","groupBy","colorBy"]){const o=e[t];if("string"==typeof o&&o)return o}}function qS(e,t){return null==e?"—":e instanceof Date?e.toISOString().slice(0,10):"number"==typeof e?t(e):e+""}function VS(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 XS={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"},US=new Set(["ForceDirectedGraph","SankeyDiagram","ProcessSankey","ChordDiagram"]),KS=new Set(["StreamPhysicsFrame","EventDropChart","GaltonBoardChart","PhysicsPileChart","CollisionSwarmChart","PhysicalFlowChart","ProcessFlowChart","GauntletChart","PhysicsCustomChart"]);function QS(e){return XS[e]||e.replace(/([a-z])([A-Z])/g,"$1 $2").toLowerCase()+" chart"}function ZS(e){const t="number"==typeof e?e:"string"==typeof e?Number(e):NaN;return Number.isFinite(t)?t:void 0}var JS=new Set(["Scatterplot","BubbleChart","ConnectedScatterplot","QuadrantChart","ScatterplotMatrix"]),eA={"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"},tA={"time-series":"tracking",categorical:"comparing",distribution:"characterizing",relationship:"relating",flow:"tracing",network:"tracing",hierarchy:"nesting",geo:"locating",realtime:"tracking",value:"presenting",custom:"presenting"},oA=["trend","compare-series","compare-categories","rank","part-to-whole","distribution","correlation","flow","hierarchy","geo","composition-over-time","change-detection","outlier-detection"],rA={alerting:"alerting",tracking:"trend",comparing:"comparison",ranking:"ranking",apportioning:"composition",characterizing:"distribution",relating:"correlation",tracing:"flow",nesting:"hierarchy",locating:"locator",presenting:"single-value"};var nA=new Set(["y-threshold","x-threshold","band","x-band","callout","label"]),iA=new Set(["system","agent","watcher"]),aA=new Set(["ai","agent","system","computed","dbt","great-expectations"]),sA=new Set(["rule","statistical-test","llm-inference","computed"]);function lA(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||!nA.has(t.type))return!1;const o=t.provenance;return!(!o||"object"!=typeof o)&&(iA.has(o.authorKind)||aA.has(o.source)||sA.has(o.basis))})}function cA(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 uA={"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 dA(e){const t=uA["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 hA(e){const t=Array.isArray(e.annotations)?e.annotations:null;if(!t||0===t.length)return;const o=VS(t.filter(e=>!!e&&"object"==typeof e));if(0===o.length)return;const r=o.map(dA),n=r.slice(0,5),i=r.length-n.length,a=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`:""),s=o.length;return`The author has marked ${1===s?"one feature":s+" features"} on this chart: ${a}.`}function pA(e,t,o={}){const r=void 0!==o.levels,n=new Set(o.levels??["l1","l2","l3"]);r||!o.capability&&!lA(t)||n.add("l4");const i=pS(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 a=function(e,t,o={}){const r=hS(t),n=dS(t),i=o.locale??"en",a="function"==typeof e.description?e.description({data:r,config:n,locale:i}):void 0,s=a?.levels??function(e,t,o,r){const n=gS(e,["nominal","ordinal"]),i=gS(e,["quantitative"]),a=n?fS(n,o,t):void 0,s=i?fS(i,o,t):void 0,l=n?.role??a??"category",c=i?.role??s??"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(a&&s)for(const e of t){const t=(e[a]??"Uncategorized")+"",o=Number(e[s]);Number.isFinite(o)&&f.set(t,(f.get(t)??0)+o)}const m=[...f].sort((e,t)=>t[1]-e[1]),g=m.reduce((e,[,t])=>e+t,0),y=m[0],b=m[1],v=g>0?((y?.[1]??0)+(b?.[1]??0))/g:0,x=e.intents.map(e=>({id:uS(e),strength:"string"==typeof e?void 0:e.strength})).sort((e,t)=>"primary"===e.strength?-1:"primary"===t.strength?1:0)[0]?.id,w=e.audience?.primary??e.audienceFit?.find(e=>"strong"===e.fit)?.audience;return{l1:`A ${e.name.toLowerCase()} encodes ${l} and ${c}. ${k=d,k?k.charAt(0).toUpperCase()+k.slice(1):k}.`,l2:m.length>0?`${m.length} categories total ${h.format(g)}. ${y[0]} accounts for ${h.format(y[1])}${g>0?` (${p.format(y[1]/g)})`:""}${b?`, followed by ${b[0]} at ${h.format(b[1])}`:""}.`:`${t.length} data ${1===t.length?"item is":"items are"} represented.`,l3:2>m.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 ${m.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"}${w?` with a ${w} audience`:""}: ${e.designContract.whyCustom}`};var k}(e,r,n,i),l=o.levels??["l1","l2","l3","l4"],c={};for(const e of l)s[e]&&(c[e]=s[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}),s=hA(t);return{...a,text:s?`${s} ${a.text}`.trim():a.text,...s?{annotations:s}:{}}}const a=cA(o.locale??"en"),s=QS(e),l=Array.isArray(t.data)?t.data:null,c=GS(t),u=KS.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=ZS(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),a=ZS(r.secondary??r.secondaryCount),s=ZS(r.observed??r.observedCount);return{label:qS(i,t),count:n,...null!=a?{secondary:a}:{},..."string"==typeof r.secondaryLabel&&r.secondaryLabel?{secondaryLabel:r.secondaryLabel}:{},...null!=s?{observed:s}:{}}}).filter(e=>null!=e):null}(t,a):null,{measure:d,measureFallback:h,dimension:p,dimensionFallback:f}=YS(e,t),m="string"==typeof d&&d?d:h,g="string"==typeof p&&p?p:f,y={};if(KS.has(e)&&function(e,t,o,r,n,i){const a=function(e){return"EventDropChart"===e?"time window":"GaltonBoardChart"===e?"bin":"CollisionSwarmChart"===e?"group lane":"PhysicalFlowChart"===e?"flow node":"container"}(e),s=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)} ${mA(l,s)} across ${o.length} ${mA(o.length,a)}; no ${mA(2,a)} are non-empty yet.`;else{const e=d>0?` ${i(d)} ${mA(d,s)} ${1===d?"is":"are"} marked ${h}.`:"";r.l2=`The settled projection contains ${i(l)} ${mA(l,s)} across ${o.length} ${mA(o.length,a)}; ${c.length} ${mA(c.length,a)} ${1===c.length?"is":"are"} non-empty. The largest ${a} is ${u.label} with ${i(u.count)} ${mA(u.count,s)}.${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)} ${mA(u.count,s)} (${t}); ${e.label} follows with ${i(e.count)} ${mA(e.count,s)}.`:`The settled projection is concentrated in ${u.label}, which holds all ${i(u.count)} ${mA(u.count,s)}.`}}(e,s,u,y,n,a),n.has("l1")&&!KS.has(e))if(HS.has(e)||OS.has(e))y.l1=`A ${s} of ${m} by ${g}`+(c?`, split by ${c}.`:".");else if(WS.has(e))y.l1=`A ${s} showing ${m} across ${g} categories.`;else if(jS.has(e))y.l1=`A ${s} of the distribution of ${m}`+(c?` by ${c}.`:".");else if(US.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} ${mA(e,"node")}`:null,null!=o?`${o} ${mA(o,"edge")}`:null].filter(Boolean);y.l1=`A ${s}${r.length?" with "+r.join(" and "):""}.`}else if("BigNumber"===e){const e="string"==typeof t.label?t.label:m;y.l1=`A single value${e?" for "+e:""}.`}else y.l1=`A ${s}.`;const b=HS.has(e)||OS.has(e)||WS.has(e)||jS.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,a=1/0,s=-1/0,l=null,c=null,u=0,d=0,h=null,p=null,f=NaN,m=NaN;for(const o of e){const e=t(o);Number.isFinite(e)&&(0===n&&(f=e,h=o),m=e,p=o,a>e&&(a=e,l=o,u=n),e>s&&(s=e,c=o,d=n),n++,i+=e)}return 0===n?null:{count:n,min:a,max:s,mean:i/n,minLabel:qS(null!=l?o(l):null,r),maxLabel:qS(null!=c?o(c):null,r),first:f,last:m,firstLabel:qS(null!=h?o(h):null,r),lastLabel:qS(null!=p?o(p):null,r),minIndex:u,maxIndex:d}}(l,ee(d,h),te(p,f),a)),n.has("l2")&&b&&(l&&0!==l.length?v&&(y.l2=WS.has(e)?`${v.count} segments totaling ${a(function(e){return e.mean*e.count}(v))}. Largest is ${v.maxLabel} at ${a(v.max)}; smallest is ${v.minLabel} at ${a(v.min)}.`:`${m} ranges from ${a(v.min)} (${v.minLabel}) to ${a(v.max)} (${v.maxLabel}), with a mean of ${a(v.mean)} across ${v.count} points.`):y.l2="No data is loaded yet."),n.has("l3")&&v&&!c&&HS.has(e)?y.l3=function(e,t,o){const{first:r,last:n,min:i,max:a,maxLabel:s,minLabel:l,firstLabel:c,lastLabel:u,minIndex:d,maxIndex:h,count:p}=e,f=a-i,m=n-r;if(0===f)return`${fA(t)} is constant at ${o(r)} across the series.`;if(.04>f/(Math.abs(e.mean)||1))return`${fA(t)} ends roughly where it started (${o(r)} at ${c} to ${o(n)} at ${u}), ranging between ${o(i)} and ${o(a)}.`;const g=h>0&&p-1>h,y=d>0&&p-1>d,b=(a-Math.max(r,n))/f,v=(Math.min(r,n)-i)/f;return g&&b>.15?`Overall ${t} climbs to a peak of ${o(a)} (${s}), 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(m)/f?`${fA(t)} ends roughly where it started (${o(r)} at ${c} to ${o(n)} at ${u}), ranging between ${o(i)} and ${o(a)}.`:m>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(a)} (${s}).`: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,m,a):n.has("l3")&&v&&!c&&OS.has(e)&&(y.l3=`The highest ${g} is ${v.maxLabel} and the lowest is ${v.minLabel}.`),n.has("l4")){const r=lA(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=oA.indexOf(r),o=oA.indexOf(t);-1===e||-1!==o&&e>=o||(t=r)}return t}(o.intentScores);if(e&&eA[e]&&(o.intentScores[e]??0)>=3)return eA[e]}return o?.family?tA[o.family]:function(e){return WS.has(e)||"StackedAreaChart"===e?"apportioning":JS.has(e)?"relating":OS.has(e)?"comparing":jS.has(e)?"characterizing":HS.has(e)?"tracking":US.has(e)?"tracing":"BigNumber"===e?"presenting":void 0}(e)}(e,o.capability);r&&(y.l4=function(e,t,o,r,n,i,a,s){const l=rA[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(OS.has(o)||WS.has(o))return`${e.maxLabel} stands out at ${t(e.max)} — check it first`;const{first:r,last:n,min:i,max:a,minLabel:s,maxLabel:l,lastLabel:c,minIndex:u,maxIndex:d,count:h}=e,p=a-i;if(p>0){const e=d>0&&h-1>d,o=u>0&&h-1>u,f=(a-Math.max(r,n))/p,m=(Math.min(r,n)-i)/p;if(e&&f>.15)return`the peak of ${t(a)} at ${l} is the point to investigate`;if(o&&m>.15)return`the dip to ${t(i)} at ${s} is the point to investigate`;if(n>=a)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(a)}) and ${s} (${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,a,t)}return`${u}; ${d}.${function(e,t){if(!t)return"";const o=t.familiarity?.[e];return"number"!=typeof o||o>2?"":` This ${QS(e)} may be unfamiliar${t.name?` to ${t.name.toLowerCase()} readers`:""} — lean on this description.`}(t,s)}`}(r,e,t,c?null:v,m,g,a,o.audience))}const x=["l1","l2","l3","l4"].filter(e=>n.has(e)&&y[e]).map(e=>y[e]).join(" "),w=hA(t);return{text:w?`${w} ${x}`.trim():x,levels:y,...w?{annotations:w}:{}}}function fA(e){return e.length?e[0].toUpperCase()+e.slice(1):e}function mA(e,t){return 1!==e&&"body"===t?"bodies":1===e?t:t+"s"}function gA(e){return((e??"unknown")+"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"unknown"}function yA(e,t,o={}){const r=o.locale??"en",n=Math.max(1,o.maxLeaves??200),i=cA(r),a=pS(e,t,o.recipe);if(a)return function(e,t,o={}){const r=hS(t),n=dS(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 a=(s=e.navigation)&&"object"==typeof s?e.navigation:void 0;var s;const l=(a?.groupByRole?mS(e,a.groupByRole):void 0)??(a?.groupBy?.[0]?mS(e,a.groupBy[0])??e.dataRoles.find(e=>e.field===a.groupBy?.[0]):void 0)??gS(e,["nominal","ordinal"]),c=l?fS(l,n,r):void 0,u=(a?.idRole?mS(e,a.idRole):void 0)??gS(e,["identifier"]),d=u?fS(u,n,r):void 0,h={id:"root",role:"chart",label:a?.summaryTemplate?yS(a.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 s=d?t[d]:void 0,l=a?.itemLabelTemplate?yS(a.itemLabelTemplate,t,e,n,r,{count:r.length}):function(e,t,o,r){const n=gS(t,["nominal","ordinal"]),i=t.dataRoles.filter(e=>"quantitative"===e.semanticType),a=n?fS(n,o,r):void 0,s=[];a&&null!=e[a]&&s.push(e[a]+"");for(const t of i){const n=fS(t,o,r);n&&null!=e[n]&&s.push(`${t.role}: ${e[n]+""}`)}return s.length>0?s.join(", "):"Data item"}(t,e,n,r);return{id:"datum-"+gA(s??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-"+gA(e),role:"datum",label:`…and ${t.length-r.length} more items`,level:3}),{id:"group-"+gA(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}(a,t,{maxLeaves:n,locale:r});const s={id:"root",role:"chart",label:pA(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=VS(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=dA(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 a=r.length;return{id:"annotations",role:"annotation",level:2,label:`Annotations: ${1===a?"one marked feature":a+" marked features"}.`,children:i}}(t,n),c=Array.isArray(t.data)?t.data:null,u=HS.has(e)||OS.has(e)||WS.has(e)||jS.has(e);if(!c||0===c.length||!u)return l&&(s.children=[l]),s;const{measure:d,measureFallback:h,dimension:p,dimensionFallback:f}=YS(e,t),m=ee(d,h),g=te(p,f),y="string"==typeof d&&d?d:h,b="string"==typeof p&&p?p:f,v=GS(t);let x=0;const w=e=>`${e}-${x++}`,k=(e,t)=>{const o=e.slice(0,n).map(e=>((e,t)=>{const o=m(e),r=qS(g(e),i);return{id:w("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:w("more"),role:"datum",level:t,label:`…and ${e.length-n} more points`}),o},S=[];if(HS.has(e)||OS.has(e)){let t=1/0,o=-1/0,r=1/0,n=-1/0;const a=[];let s=!0;for(const e of c){const i=m(e);Number.isFinite(i)&&(t>i&&(t=i),i>o&&(o=i));const l=g(e);a.push(l),"number"==typeof l&&Number.isFinite(l)?(r>l&&(r=l),l>n&&(n=l)):s=!1}const l=new Set,u=[];for(const e of a){const t=e+"";l.has(t)||(l.add(t),u.push(e))}const d=s?`${i(r)} to ${i(n)}`:`${qS(u[0],i)} to ${qS(u[u.length-1],i)} (${OS.has(e)?u.length+" categories":c.length+" points"})`;S.push({id:w("axis"),role:"axis",level:2,label:`${OS.has(e)?"Category axis":"X axis"}: ${b}, ${d}.`}),t>o||S.push({id:w("axis"),role:"axis",level:2,label:`Value axis: ${y}, ${i(t)} to ${i(o)}.`})}if(v){const o=te(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,a]of n){const n=pA(e,{...t,data:a},{levels:["l2","l3"],locale:r}).text;i.push({id:w("series"),role:"series",level:2,label:`Series ${o}: ${n}`,children:k(a,3)})}s.children=[...S,...i]}else s.children=[...S,...k(c,2)];return l&&s.children.push(l),s}import*as bA from"react";var vA=null,xA=new Set,wA=new Set;function kA(e,t){void 0!==console&&console.warn(`[conversationArc] ${e} failed:`,t)}function SA(e,t){try{const o=t();o&&"function"==typeof o.then&&Promise.resolve(o).catch(t=>kA(e,t))}catch(t){kA(e,t)}}var AA=Object.freeze([]),CA=AA,MA=!1;function PA(){MA=!0}var _A=new Set;function LA(){for(const e of _A)try{e()}catch(e){void 0!==console&&console.warn("[conversationArc] change subscriber threw:",e)}}function RA(){return vA}var IA={get enabled(){return vA?.enabled??!1},get sessionId(){return vA?.sessionId??null},get capacity(){return vA?.capacity??0},record(e){const t=RA();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();PA(),LA();for(const e of xA)try{e(o)}catch(e){void 0!==console&&console.warn("[conversationArc] subscriber threw:",e)}return function(e){for(const t of wA)t.record&&SA("sink record",()=>t.record?.(e))}(o),o},flush(){const e=RA();if(!e)return[];const t=e.buffer.slice();return e.buffer=[],PA(),LA(),function(e){for(const t of wA)t.flush&&SA("sink flush",()=>t.flush?.(e))}(t),t},getEvents:()=>MA?(CA=vA?Object.freeze(vA.buffer.slice()):AA,MA=!1,CA):CA,subscribe:e=>(xA.add(e),()=>{xA.delete(e)}),clear(){const e=RA();e&&(e.buffer=[],PA(),LA()),function(){for(const e of wA)e.clear&&SA("sink clear",()=>e.clear?.())}()},reset(){if(xA.clear(),wA.clear(),CA=AA,MA=!1,!vA)return LA(),void _A.clear();vA.buffer=[],vA.enabled=!1,vA=null,LA(),_A.clear()}};import{jsx as $A,jsxs as TA}from"react/jsx-runtime";var NA={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0,padding:0,margin:-1};function FA({tree:e,label:t,visible:o=!1,className:r,onActiveChange:n,activeId:i,chartId:a}){const[s,l]=bA.useState(()=>new Set([e.id])),[c,u]=bA.useState(e.id),d=void 0!==i,h=d?i:c,p=bA.useRef(null),f=bA.useRef(new Map),m=bA.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]),g=bA.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,s),[e,s]);bA.useEffect(()=>{d||g.some(e=>e.id===c)||u(e.id)},[g,c,e.id,d]),bA.useEffect(()=>{const e=[];let t=m.get(h);for(;t;)e.push(t.id),t=m.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,m]),bA.useEffect(()=>{p.current?.contains(document.activeElement)&&f.current.get(h)?.focus()},[h]);const y=bA.useCallback((e,t,o)=>{IA.enabled&&IA.record("focus"===t?{type:"nav-node-focused",chartId:a,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:a,nodeId:e.id,role:e.role,level:e.level,expanded:!!o})},[a]),b=bA.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)},w=(e,t,r)=>{const n=!!e.children&&e.children.length>0,i=s.has(e.id);return TA("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:[TA("span",{className:"semiotic-nav-tree-label semiotic-nav-tree-"+e.role,children:[o&&n?i?"▾ ":"▸ ":"",e.label]}),n&&i&&$A("ul",{role:"group",style:o?{margin:0,padding:0}:void 0,children:e.children.map((t,o)=>w(t,o+1,e.children.length))})]},e.id)};return $A("div",{ref:p,className:"semiotic-nav-tree"+(r?" "+r:""),style:o?void 0:NA,onKeyDown:e=>{const t=g.findIndex(e=>e.id===h);if(-1===t)return;const o=g[t],r=!!o.children&&o.children.length>0,n=s.has(o.id);let i=!0;switch(e.key){case"ArrowDown":b(g[Math.min(t+1,g.length-1)]);break;case"ArrowUp":b(g[Math.max(t-1,0)]);break;case"Home":b(g[0]);break;case"End":b(g[g.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=m.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:$A("ul",{role:"tree","aria-label":t||"Chart navigation",style:o?{margin:0,padding:0}:void 0,children:w(e,1,1)})})}import*as DA from"react";import{jsx as BA,jsxs as EA}from"react/jsx-runtime";function zA(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])),a=Math.max(r,Math.min(n,e[1])),s=i>a?[a,i]:[i,a];if(s[1]-s[0]>=o)return s;const l=(s[0]+s[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 HA(e,t,o,r=1,n=r){const i="in"===o?r:-r;return zA([e[0]+i,e[1]-i],t,n)}function OA(e){const{domain:t,initialValue:o=t,step:r=1,minSpan:n=r,label:i,formatValue:a,onChange:s}=e,[l,c]=DA.useState(()=>zA(o,t,n)),u=zA(l,t,n),d=DA.useCallback(e=>{const o=zA(e,t,n);c(o),s?.(o)},[t,n,s]),h=DA.useMemo(()=>({label:i,domain:t,value:u,step:r,formatValue:a,onChange:d,onClear:()=>d(t)}),[t,a,i,d,r,u]),p=DA.useMemo(()=>({onZoomIn:()=>d(HA(u,t,"in",r,n)),onZoomOut:()=>d(HA(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 WA={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)))"},jA={fontSize:11,fontWeight:700,letterSpacing:"0.04em",textTransform:"uppercase",color:"var(--semiotic-text-secondary, #57606a)"};function YA(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 GA(e){return"function"==typeof e}function qA({brush:e,targetSize:t}){const o=e?.value,r=e?.domain,n=!!o&&!!r,i=!0===e?.disabled,a=e?.formatValue??(e=>e),s=!!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 EA("section",{style:WA,"aria-label":"Brush controls",children:[BA("div",{style:jA,children:e?.label??"Filter range"}),n?EA("div",{style:{display:"grid",gap:8},children:[EA("label",{style:{display:"grid",gap:4,fontSize:12},children:[EA("span",{children:["Start: ",a(u)]}),BA("input",{type:"range",min:l,max:c,step:h,value:u,disabled:!s,style:{minHeight:t},onChange:t=>{const o=Number(t.currentTarget.value);e?.onChange?.([Math.min(o,d),d])}})]}),EA("label",{style:{display:"grid",gap:4,fontSize:12},children:[EA("span",{children:["End: ",a(d)]}),BA("input",{type:"range",min:l,max:c,step:h,value:d,disabled:!s,style:{minHeight:t},onChange:t=>{const o=Number(t.currentTarget.value);e?.onChange?.([u,Math.max(o,u)])}})]})]}):BA("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."}),BA("button",{type:"button",disabled:i||!GA(e?.onClear),onClick:e?.onClear,style:YA(t),children:"Clear range"})]})}function VA({zoom:e,targetSize:t}){const o=!0===e?.disabled;return EA("section",{style:WA,"aria-label":"Zoom controls",children:[BA("div",{style:jA,children:e?.label??"Zoom"}),EA("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[BA("button",{type:"button","aria-label":"Zoom out",disabled:o||!GA(e?.onZoomOut),onClick:e?.onZoomOut,style:YA(t),children:"-"}),BA("button",{type:"button","aria-label":"Reset zoom",disabled:o||!GA(e?.onReset),onClick:e?.onReset,style:YA(t),children:"Reset"}),BA("button",{type:"button","aria-label":"Zoom in",disabled:o||!GA(e?.onZoomIn),onClick:e?.onZoomIn,style:YA(t),children:"+"})]})]})}function XA({legend:e,targetSize:t}){const o=!0===e?.disabled,r=e?.items??[];return EA("section",{style:WA,"aria-label":"Legend controls",children:[BA("div",{style:jA,children:e?.label??"Series"}),r.length>0&&BA("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:r.map(r=>{const n=!1!==r.active;return EA("button",{type:"button",disabled:o||r.disabled||!e?.onToggle,onClick:()=>e?.onToggle?.(r.id,!n),style:YA(t,n),"aria-pressed":n,children:[r.color&&BA("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)})}),EA("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[BA("button",{type:"button",disabled:o||!GA(e?.onShowAll),onClick:e?.onShowAll,style:YA(t),children:"Show all"}),BA("button",{type:"button",disabled:o||!GA(e?.onHideAll),onClick:e?.onHideAll,style:YA(t),children:"Hide all"})]})]})}function UA({controls:e,targetSize:t=44,compact:o=!1,className:r,style:n,ariaLabel:i="Mobile chart controls",brush:a,zoom:s,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:a,zoom:s,legend:l});return 0===c.length?null:EA("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")&&BA(qA,{brush:a,targetSize:t}),c.includes("zoom")&&BA(VA,{zoom:s,targetSize:t}),c.includes("legend")&&BA(XA,{legend:l,targetSize:t})]})}var KA=new Set(["LineChart","AreaChart","DifferenceChart","StackedAreaChart","Scatterplot","ConnectedScatterplot","BubbleChart","QuadrantChart","MultiAxisLineChart","CandlestickChart","Heatmap","MinimapChart","RealtimeLineChart","RealtimeHeatmap"]),QA=new Set(["BarChart","StackedBarChart","GroupedBarChart","SwarmPlot","BoxPlot","Histogram","ViolinPlot","DotPlot","RidgelinePlot","FunnelChart","LikertChart","SwimlaneChart"]),ZA={Scatterplot:["pointRadius","hoverRadius"],BubbleChart:["pointRadius","hoverRadius"],ConnectedScatterplot:["pointRadius","hoverRadius"],QuadrantChart:["pointRadius","hoverRadius"],SwarmPlot:["pointRadius","hoverRadius"],DotPlot:["dotRadius","hoverRadius"]};function JA(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function eC(e){return"string"==typeof e&&e.trim().length>0}function tC(e){const t=JA(e.capability)?e.capability:null,o=JA(e.recipe)?e.recipe:null,r=[e.mobileSemantics,e.mobileVisualization,e.mobile,t?.mobile,o?.mobile];for(const e of r)if(JA(e))return e;return null}function oC(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 rC(e){return oC(e.size)||oC(JA(e.frameProps)?e.frameProps.size:void 0)||("number"==typeof e.width&&"number"==typeof e.height?[e.width,e.height]:null)}function nC(e,t){e.push({...t,status:"pass"})}function iC(e,t){e.push({...t,status:"warn"})}function aC(e,t){e.push({...t,status:"manual"})}function sC(e,t={},o={}){const r=o.viewportWidth??390,n=o.targetSize??44,i=rC(t),a=im(t,{width:r,height:i?.[1]}),s=[],l=rC(t=a.props),c=tC(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=tC(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=eC(t.title)||eC(t.summary)||eC(t.description)||!0===c?.summary||eC(c?.summary);if(a.matches.length>0&&nC(s,{id:"layout.responsive-rule-applied",category:"layout",impact:"medium",message:`${a.matches.length} responsive rule(s) applied for the ${r}px mobile audit.`}),l){const[t,o]=l;t>r&&!d?iC(s,{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."}):nC(s,{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&&iC(s,{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&&iC(s,{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&&iC(s,{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 aC(s,{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,JA(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:KA.has(e)?1.25*r:QA.has(e)?Math.max(8,Math.floor(r/34)):r)?iC(s,{id:"density.mark-budget",category:"density",impact:KA.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."}):nC(s,{id:"density.mark-budget",category:"density",impact:"medium",message:f+" data item(s) are within the rough mobile density budget for this component."}));const m=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),g=!1!==t.showAxes&&!1!==t.axis;if(g&&null!=m){const e=Math.max(3,Math.floor(r/58));m>e&&iC(s,{id:"density.explicit-tick-count",category:"density",impact:"medium",message:`${m} 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 g&&(KA.has(e)||QA.has(e))&&aC(s,{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=JA(e.frameProps)?e.frameProps:{};return(!0===e.enableHover||null!=e.tooltipContent||null!=e.tooltip||null!=t.tooltipContent||!0===t.enableHover)&&!function(e){const t=tC(e),o=JA(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||eC(t?.interaction?.hoverFallback)}(e)}(t)?nC(s,{id:"interaction.hover-only-detail",category:"interaction",impact:"high",message:"No hover-only detail path is visible from the config."}):iC(s,{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=ZA[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=JA(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?iC(s,{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?iC(s,{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."}):nC(s,{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=tC(e),r=JA(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)&&iC(s,{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||iC(s,{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 w=Array.isArray(t.annotations)?t.annotations.filter(e=>JA(e)):[];if(w.length>("number"==typeof c?.maxAnnotations?c.maxAnnotations:3)&&430>=r&&iC(s,{id:"annotation.mobile-density",category:"annotation",impact:"medium",message:w.length+" annotation(s) compete for phone plot space.",fix:"Assign annotation priority, collapse secondary notes into a callout list, or provide shorter mobileText."}),w.length>0){const e=w.filter(e=>!eC(e.mobileText)&&!eC(e.shortText)&&!eC(e.label));e.length>0&&aC(s,{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||aC(s,{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?(nC(s,{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?iC(s,{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&&aC(s,{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."})):aC(s,{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||iC(s,{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 k=s.filter(e=>"warn"===e.status),S={highRisk:k.filter(e=>"high"===e.impact).length,warnings:k.length,manual:s.filter(e=>"manual"===e.status).length,passes:s.filter(e=>"pass"===e.status).length};return{component:e,viewportWidth:r,ok:0===S.highRisk,summary:S,findings:s,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."}}import{Fragment as lC,jsx as cC,jsxs as uC}from"react/jsx-runtime";var dC={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0,padding:0,margin:-1};function hC(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function pC(e){return e&&"object"==typeof e&&"number"==typeof e.targetSize?e.targetSize:void 0}function fC(e){return Array.isArray(e)?e.length>0:!!e}function mC(){const e=function(){const e=ba.useContext(xa);return e?e.toggle:null}();return e?cC("button",{className:"semiotic-chart-action",onClick:e,title:"Data summary","aria-label":"Toggle data summary",style:CC,children:uC("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[cC("rect",{x:"1",y:"1",width:"12",height:"3",rx:"0.5"}),cC("rect",{x:"1",y:"6",width:"8",height:"3",rx:"0.5"}),cC("rect",{x:"1",y:"11",width:"5",height:"2",rx:"0.5"})]})}):null}var gC={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)"},yC={error:4,warning:3,info:2,success:1,neutral:0};function bC({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 uC("svg",{...t,children:[cC("path",{d:"M8 1.8 15 14H1L8 1.8Z"}),cC("path",{d:"M8 6.4v3.4"}),cC("circle",{cx:"8",cy:"11.8",r:"0.5",fill:"currentColor",stroke:"none"})]});case"success":return uC("svg",{...t,children:[cC("circle",{cx:"8",cy:"8",r:"6.4"}),cC("path",{d:"M5 8.2 7 10.2 11 5.8"})]});case"info":return uC("svg",{...t,children:[cC("circle",{cx:"8",cy:"8",r:"6.4"}),cC("path",{d:"M8 7.4V11"}),cC("circle",{cx:"8",cy:"5",r:"0.5",fill:"currentColor",stroke:"none"})]});default:return uC("svg",{...t,children:[cC("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"}),cC("path",{d:"M6.5 13a1.5 1.5 0 0 0 3 0"})]})}}function vC({notification:e,level:t,onDismiss:o}){const r=gC[t]??gC.info,n=!1!==e.dismissible;return uC("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:[uC("div",{style:{flex:1,minWidth:0},children:[e.source&&cC("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&&cC("div",{className:"semiotic-chart-notification-title",style:{fontSize:12,fontWeight:600,color:r},children:e.title}),cC("div",{className:"semiotic-chart-notification-message",style:{fontSize:12,lineHeight:1.45,color:"var(--semiotic-text, #333)"},children:e.message})]}),n&&cC("button",{className:"semiotic-chart-notification-dismiss","aria-label":e.title?"Dismiss notification: "+e.title:"Dismiss notification",title:"Dismiss",onClick:o,style:{...CC,width:18,height:18,fontSize:13,lineHeight:1,flex:"none"},children:"×"})]})}function xC({visible:e,onDismiss:t}){const[o,r]=zS.useState(!1),n=zS.useRef(null),i=zS.useRef(null);if(zS.useEffect(()=>{0===e.length&&o&&r(!1)},[e.length,o]),zS.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 a=e.reduce((e,t)=>yC[t.level]>yC[e]?t.level:e,e[0].level),s=gC[a]??gC.info,l=e.length,c=`${l} chart notification${1===l?"":"s"}, most severe: ${a}`;return uC("div",{ref:n,className:"semiotic-chart-notifications",style:{position:"relative",display:"inline-flex"},children:[cC("span",{style:dC,role:"status","aria-live":"polite",children:c}),uC("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:{...CC,color:s,position:"relative"},children:[cC(bC,{level:a}),cC("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:s,color:"#fff",fontSize:9,fontWeight:700,lineHeight:"15px",textAlign:"center"},children:l>99?"99+":l})]}),o&&cC("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=>cC(vC,{notification:e.notification,level:e.level,onDismiss:()=>t(e)},e.key))})]})}var wC={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 kC({height:e}){return cC("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 SC({error:e}){return cC("div",{role:"alert",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",minHeight:120,padding:24,boxSizing:"border-box"},children:cC("div",{style:{textAlign:"center",maxWidth:400,fontSize:14,color:"var(--semiotic-text-secondary, #666)",lineHeight:1.5},children:e})})}var AC=zS.forwardRef(function({title:e,subtitle:t,children:o,width:r="100%",height:n=400,actions:i,chartConfig:a,describe:s,navigable:l,controls:c,banner:u,notifications:d,onNotificationDismiss:h,loading:p=!1,error:f,errorBoundary:m=!1,status:g,detailsPanel:y,mobile:b,mobileAudit:v,className:x,style:w},k){const S=zS.useRef(null),A=zS.useRef(null),[C,M]=zS.useState(!1),[P,_]=zS.useState(()=>new Set);zS.useEffect(()=>{_(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 L=zS.useMemo(()=>d?d.map((e,t)=>({notification:e,index:t,key:e.id??t+"",level:e.level??"info"})).filter(({key:e})=>!P.has(e)):[],[d,P]),R=zS.useCallback(e=>{_(t=>new Set(t).add(e.key)),h?.(e.notification,e.index)},[h]),I=!1!==i?.export&&void 0!==i?.export,$=!1!==i?.fullscreen&&void 0!==i?.fullscreen,T=!1!==i?.copyConfig&&void 0!==i?.copyConfig&&a,N=!0===i?.dataSummary,F=zS.useMemo(()=>{if(!s||!a?.component||!a?.props)return"";const e="object"==typeof s?s.levels:void 0;try{return pA(a.component,a.props,e?{levels:e}:{}).text}catch{return""}},[s,a]),D="object"==typeof s&&!0===s.visible,B=zS.useMemo(()=>{if(!l||!a?.component||!a?.props)return null;const e="object"==typeof l?l.maxLeaves:void 0;try{return yA(a.component,a.props,e?{maxLeaves:e}:{})}catch{return null}},[l,a]),E="object"==typeof l&&!0===l.visible,z=zS.useMemo(()=>"object"==typeof i?.export?i.export:{},[i?.export]),H="object"==typeof i?.copyConfig?i.copyConfig.format:"json",O=zS.useCallback(async e=>{A.current&&await Gk(A.current,{...z,...e})},[z]),W=zS.useCallback(()=>{S.current&&(document.fullscreenElement?document.exitFullscreen().catch(()=>{}):S.current.requestFullscreen().catch(()=>{}))},[]),j=zS.useCallback(async e=>{a&&await MS({...a,version:a.version??"1",createdAt:a.createdAt??(new Date).toISOString()},e||H||"json")},[a,H]);zS.useEffect(()=>{const e=()=>{M(!!document.fullscreenElement)};return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[]),zS.useImperativeHandle(k,()=>({export:O,toggleFullscreen:W,copyConfig:j,element:S.current}),[O,W,j]);const Y=!0===b?{}:b&&"object"==typeof b?b:null,G=!!b,q=Y?.breakpoint??480,V=void 0===Y?.chartMode?"mobile":Y.chartMode,X=Y?.semantics,U=Y?.mobileInteraction??(!!G||void 0),K=Y?.standardControls,Q=hC(K)?K:null,Z=Q?.controls??(hC(K)?void 0:K)??function(e){return e&&"object"==typeof e?e.standardControls:void 0}(U),J=fC(Z)?U&&"object"==typeof U?{...U,standardControls:Z}:!1===U||null==U?U:{standardControls:Z}:U,ee=G&&fC(Z)?cC(UA,{controls:Z,targetSize:Q?.targetSize??pC(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=Y?.summary,oe=!0===Y?.allowHorizontalScroll,re=!0===Y?.hideToolbar,ne=zS.useMemo(()=>{if(!v||!a?.component||!a?.props)return null;const e="object"==typeof v?v:{},t=a.props;try{return sC(a.component,{...t,mobileSemantics:t.mobileSemantics??X,mobileInteraction:t.mobileInteraction??J},{viewportWidth:e.viewportWidth??390,targetSize:e.targetSize??44,inChartContainer:!0})}catch{return null}},[v,a,X,J]);zS.useEffect(()=>{if(!ne||ne.ok)return;const e=ne.findings.filter(e=>"pass"!==e.status).slice(0,5);console.warn(`[Semiotic mobile audit] ${a?.component}: ${ne.summary.highRisk} high-risk mobile finding(s), ${ne.summary.warnings} warning(s).`,e)},[ne,a?.component]);const ie=ne&&!ne.ok&&"object"==typeof v&&!0===v.visible?uC("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,ae=L.length>0,se=e||t||c||I||$||T||N||g||ae,le=zS.useMemo(()=>{if(!G||!zS.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?zS.cloneElement(o,t):o},[o,G,V,X,J]),ce=p?cC(kC,{height:n}):f?cC(SC,{error:f}):m?cC(zh,{children:le}):le;return ue=uC(lC,{children:[cC("style",{dangerouslySetInnerHTML:{__html:`@keyframes semiotic-skeleton-pulse {\n 0% { background-position: 200% 0; }\n 100% { background-position: -200% 0; }\n}\n@media (max-width: ${q}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}`}}),uC("div",{ref:S,className:"semiotic-chart-container"+(x?" "+x:""),"data-semiotic-mobile":G?"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%"}:{},...w},children:[se&&uC("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:[uC("div",{className:"semiotic-chart-title-area",style:{minWidth:0,flex:"1 1 200px"},children:[e&&cC("div",{className:"semiotic-chart-title",style:{fontSize:14,fontWeight:600,color:"var(--semiotic-text, #333)"},children:e}),t&&cC("div",{className:"semiotic-chart-subtitle",style:{fontSize:12,color:"var(--semiotic-text-secondary, #666)",marginTop:e?2:0},children:t})]}),uC("div",{className:"semiotic-chart-toolbar",style:{display:"flex",alignItems:"center",gap:4,marginLeft:"auto"},children:[c,ae&&cC(xC,{visible:L,onDismiss:R}),I&&cC("button",{className:"semiotic-chart-action",onClick:()=>O(),title:"Export chart","aria-label":"Export chart",style:CC,children:uC("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[cC("path",{d:"M7 2v8M3.5 7L7 10.5 10.5 7"}),cC("path",{d:"M2 12h10"})]})}),N&&cC(mC,{}),$&&cC("button",{className:"semiotic-chart-action",onClick:W,title:C?"Exit fullscreen":"Fullscreen","aria-label":C?"Exit fullscreen":"Enter fullscreen",style:CC,children:cC("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:uC(lC,C?{children:[cC("path",{d:"M9 1v4h4"}),cC("path",{d:"M5 13V9H1"}),cC("path",{d:"M13 5H9V1"}),cC("path",{d:"M1 9h4v4"})]}:{children:[cC("path",{d:"M1 5V1h4"}),cC("path",{d:"M13 9v4H9"}),cC("path",{d:"M9 1h4v4"}),cC("path",{d:"M5 13H1V9"})]})})}),T&&cC("button",{className:"semiotic-chart-action",onClick:()=>j(),title:"Copy config","aria-label":"Copy chart configuration",style:CC,children:uC("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[cC("rect",{x:"5",y:"5",width:"8",height:"8",rx:"1"}),cC("path",{d:"M9 5V2a1 1 0 00-1-1H2a1 1 0 00-1 1v6a1 1 0 001 1h3"})]})}),g&&cC("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:wC[g].bg,color:wC[g].color,lineHeight:"18px"},children:g})]})]}),u&&cC("div",{className:"semiotic-chart-banner",children:u}),ie,te&&cC("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&&cC("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}),F&&cC("div",{className:"semiotic-chart-description",role:"note",style:D?{padding:"8px 16px",fontSize:12,lineHeight:1.5,color:"var(--semiotic-text-secondary, #666)",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"}:dC,children:F}),B&&cC("div",{className:"semiotic-chart-nav",style:E?{padding:"8px 8px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)",maxHeight:240,overflow:"auto"}:void 0,children:cC(FA,{tree:B,label:"string"==typeof e&&e?e+" — navigable structure":"Chart navigable structure",visible:E,chartId:"string"==typeof a?.props?.chartId?a.props.chartId:void 0})}),uC("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]})]})]}),N?cC(wa,{children:ue}):ue;var ue}),CC={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};import*as MC from"react";import{jsx as PC,jsxs as _C}from"react/jsx-runtime";function LC({children:e,controls:t,mobile:o,breakpoint:r=480,chartMode:n="mobile",mobileInteraction:i=!0,mobileSemantics:a,mobileSummary:s,chips:l=[],activeChip:c,onChipChange:u,detail:d,detailTitle:h="Details",detailMode:p="sheet",initialDetailOpen:f=!1,allowHorizontalScroll:m=!1,hideToolbar:g=!1,chartDefaults:y,...b}){const[v,x]=MC.useState(()=>c??l.find(e=>!e.disabled)?.id),[w,k]=MC.useState(f);MC.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=MC.useCallback(e=>{e.disabled||(void 0===c&&x(e.id),u?.(e))},[c,u]),C=l.length?PC("div",{className:"semiotic-mobile-chip-row",role:"list","aria-label":"Mobile chart controls",children:l.map(e=>_C("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:[PC("span",{children:e.label}),e.description&&PC("small",{className:"semiotic-mobile-chip-description",children:e.description})]},e.id))}):null,M=s||C?_C("div",{className:"semiotic-mobile-summary-card",children:[s&&PC("div",{className:"semiotic-mobile-summary-copy",children:s}),C]}):o?.summary,P={breakpoint:r,chartMode:n,mobileInteraction:i,semantics:a,allowHorizontalScroll:m,hideToolbar:g,...o,summary:M},_=MC.useMemo(()=>{if(!y||!MC.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?MC.cloneElement(e,o):e},[e,y]),L=!!d&&"sheet"===p,R=!!d&&"inline"===p||L&&w,I=L?PC("button",{type:"button",className:"semiotic-mobile-detail-toggle","aria-expanded":w,onClick:()=>k(e=>!e),children:w?"Hide details":"Show details"}):null,$=t||I?_C("div",{className:"semiotic-mobile-control-stack",children:[t,I]}):void 0;return _C("div",{className:"semiotic-mobile-chart-shell",children:[PC("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 `}),PC(AC,{...b,controls:$,mobile:P,children:_}),R&&_C("section",{className:"semiotic-mobile-detail-panel","data-mode":p,"aria-label":"string"==typeof h?h:"Chart details",children:[_C("div",{className:"semiotic-mobile-detail-header",children:[PC("span",{children:h}),L&&PC("button",{type:"button",className:"semiotic-mobile-detail-toggle",onClick:()=>k(!1),children:"Close"})]}),PC("div",{className:"semiotic-mobile-detail-body",children:d})]})]})}import*as RC from"react";import{jsx as IC,jsxs as $C}from"react/jsx-runtime";function TC(e,t){if(t)return"function"==typeof t?t(e):e?.[t]}function NC(e,t){const o="function"==typeof t?t(e):e[t];return Array.isArray(o)?o:[]}function FC(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 DC(e,t){if(!RC.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?RC.cloneElement(e,r):e}function BC({items:e,children:t,columns:o=3,tabletColumns:r=2,mobileColumns:n=1,mobileBreakpoint:i=480,tabletBreakpoint:a=860,gap:s=12,mode:l="mobile",chartHeight:c=220,sharedExtent:u=!0,valueAccessor:d,dataAccessor:h="data",extentProps:p=["yExtent","valueExtent"],linkedHover:f,selection:m,linkedBy:g,linkProvider:y="auto",selections:b,showLegend:v=!1,legendPosition:x,legendInteraction:w,legendSelectionName:k,legendField:S,mobileInteraction:A=!0,mobileSemantics:C,labelMode:M="panel",chartDefaults:P,className:_,style:L}){const R=_f(),I=e||"function"==typeof t?[]:RC.Children.toArray(t),$=e??I.map((e,t)=>({id:"panel-"+(t+1)})),T=$.length,N=RC.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 NC(t,o))i.push(TC(e,r));const a=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 a?{yExtent:a,valueExtent:a}:{}}($,u,h,d),[$,u,h,d]),F=RC.useMemo(()=>{if(!g)return{name:void 0,fields:void 0,linkedHover:f,selection:m};const e=Array.isArray(g)?"small-multiples":g.name||"small-multiples",t=Array.isArray(g)?g:g.fields||[];return{name:e,fields:t,linkedHover:f??{name:e,fields:t},selection:m??{name:e}}},[g,f,m]),D=RC.useMemo(()=>({linkedHover:F.linkedHover,selection:F.selection}),[F.linkedHover,F.selection]),B=RC.useMemo(()=>{const e={mode:l,height:c,responsiveWidth:!0,mobileInteraction:A,mobileSemantics:C??FC(T),...D,...P};"legend"!==M&&(e.showLegend=!1),"direct"===M&&(e.directLabel=!0);for(const t of p)t in N&&(e[t]=N[t]);return e},[l,c,A,C,T,D,P,M,p,N]),E=$C("section",{className:["semiotic-small-multiple-chart",_].filter(Boolean).join(" "),style:L,"data-semiotic-small-multiple":"true",children:[IC("style",{children:`\n .semiotic-small-multiple-chart {\n --semiotic-small-multiple-columns: ${o};\n --semiotic-small-multiple-gap: ${s}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: ${a}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 `}),$.map((e,o)=>{const r={...B},n="function"==typeof t?t(e,{item:e,index:o,count:T,chartProps:r,sharedExtent:N}):I[o];return $C("article",{className:"semiotic-small-multiple-panel","aria-label":"string"==typeof e.title?e.title:void 0,children:[(e.title||e.subtitle||e.summary)&&$C("header",{className:"semiotic-small-multiple-heading",children:[e.title&&IC("h3",{className:"semiotic-small-multiple-title",children:e.title}),e.subtitle&&IC("p",{className:"semiotic-small-multiple-subtitle",children:e.subtitle}),e.summary&&IC("p",{className:"semiotic-small-multiple-summary",children:e.summary})]}),IC("div",{className:"semiotic-small-multiple-plot",children:DC(n,r)})]},e.id??o)})]});return!0===y||"auto"===y&&(g||f||m||b||!0===v)&&!R?IC(Bf,{selections:b,showLegend:v,legendPosition:x,legendInteraction:w,legendSelectionName:k??F.name??"small-multiples",legendField:S??F.fields?.[0]??"category",children:E}):E}import*as EC from"react";import{Fragment as zC,jsx as HC,jsxs as OC}from"react/jsx-runtime";function WC({children:e,columns:t="auto",minCellWidth:o=300,gap:r=16,tabletColumns:n,mobileColumns:i=1,mobileBreakpoint:a=480,tabletBreakpoint:s=860,chartDefaults:l,className:c,style:u}){const d="semiotic-chart-grid-"+EC.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 OC(zC,{children:[HC("style",{children:`\n ${n?`\n @media (max-width: ${s}px) {\n .${d} {\n grid-template-columns: repeat(${n}, minmax(0, 1fr)) !important;\n }\n }`:""}\n @media (max-width: ${a}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 `}),HC("div",{className:f,style:{display:"grid",gridTemplateColumns:p,gap:r,width:"100%",...u},children:EC.Children.map(e,e=>{if(!EC.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?EC.cloneElement(e,o):e;return"primary"!==e.props.emphasis||void 0!==h&&2>h?r:HC("div",{"data-semiotic-chart-grid-primary":"true",style:{gridColumn:"span 2",minWidth:0},children:r})})})]})}WC.displayName="ChartGrid";import*as jC from"react";import{Fragment as YC,jsx as GC,jsxs as qC}from"react/jsx-runtime";function VC({children:e,context:t,position:o="right",contextSize:r=250,mobilePosition:n="bottom",mobileBreakpoint:i=480,gap:a=12,className:s,style:l}){const c="semiotic-context-layout-"+jC.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:a,width:"100%",...l},p=u?{flex:`0 0 ${r}px`,width:r,minHeight:0}:{flex:`0 0 ${r}px`,height:r,minWidth:0};return qC(YC,{children:[GC("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 `}),qC("div",{className:["semiotic-context-layout",c,s].filter(Boolean).join(" "),"data-mobile-position":n,style:h,children:[GC("div",{className:"semiotic-context-primary",style:{flex:"1 1 0%",minWidth:0,minHeight:0},children:e}),GC("div",{className:"semiotic-context-panel",style:p,children:t})]})]})}VC.displayName="ContextLayout";import{useRef as XC}from"react";var UC=2*Math.PI;function KC(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 QC(e,t,o,r,n){const i=n?.center,a=(e,t)=>{const{x:o,y:r}=KC(e,t,{center:i});return`${ZC(o)},${ZC(r)}`},s=Math.max(0,o),l=Math.max(s,r),c=Math.abs(t-e),u=e>t?0:1;if(c>=UC-1e-6){const e=i?.x??0,t=i?.y??0,o=`${ZC(e)},${ZC(t-l)}`,r=`${ZC(e)},${ZC(t+l)}`;let n=`M${o} A${ZC(l)},${ZC(l)} 0 1 1 ${r} A${ZC(l)},${ZC(l)} 0 1 1 ${o} Z`;if(s>0){const o=`${ZC(e)},${ZC(t-s)}`,r=`${ZC(e)},${ZC(t+s)}`;n+=` M${o} A${ZC(s)},${ZC(s)} 0 1 0 ${r} A${ZC(s)},${ZC(s)} 0 1 0 ${o} Z`}return n}const d=c>Math.PI?1:0,h=a(e,l),p=a(t,l);if(0>=s){const e=i?.x??0,t=i?.y??0;return`M${ZC(e)},${ZC(t)} L${h} A${ZC(l)},${ZC(l)} 0 ${d} ${u} ${p} Z`}const f=a(t,s),m=a(e,s);return`M${h} A${ZC(l)},${ZC(l)} 0 ${d} ${u} ${p} L${f} A${ZC(s)},${ZC(s)} 0 ${d} ${1===u?0:1} ${m} Z`}function ZC(e){return Math.round(1e3*e)/1e3}function JC(e,t,o=0){return t>0?((e-o)%t+t)%t+o:e}import{jsx as eM,jsxs as tM}from"react/jsx-runtime";function oM({value:e,onChange:t,period:o=365,radius:r=180,innerRadius:n=14,width:i,height:a,step:s=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 m=i??2*r+40,g=a??2*r+40,y=m/2,b=g/2,v=function(e){const[t,o]=e,r=o-t||1,n=UC;return e=>0+(e-t)/r*(n-0)}([0,o]),x=XC(null),w=e=>{const t=e.currentTarget.ownerSVGElement??e.currentTarget,r=t.getBoundingClientRect(),n=t.viewBox?.baseVal;return Math.round((Math.atan2((n?.width||m)/(r.width||1)*(e.clientX-r.left)-y-0,-((n?.height||g)/(r.height||1)*(e.clientY-r.top)-b-0))+UC)%UC/UC*o)%o},k=(e,t)=>{e.preventDefault(),e.stopPropagation();const o=e.currentTarget.ownerSVGElement;o?.setPointerCapture?.(e.pointerId),x.current={mode:t,lastValue:w(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:JC(e.start+r,o),end:JC(e.end+r,o)}):t=>({...t,[e]:JC(t[e]+r,o)}))},C=e=>t=>{const o=t.shiftKey?l:s;"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]],P=e=>u?u(e):e+"";return eM("svg",{viewBox:`0 0 ${m} ${g}`,width:m,height:g,className:p,onPointerMove:e=>{const r=x.current;if(!r)return;const n=w(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:JC(t.start+e,o),end:JC(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:tM("g",{transform:`translate(${y},${b})`,children:[eM("g",{role:"slider",tabIndex:0,"aria-label":c+" (move both ends)","aria-valuemin":0,"aria-valuemax":o-1,"aria-valuenow":e.start,"aria-valuetext":`${P(e.start)} to ${P(e.end)}`,onPointerDown:e=>k(e,"range"),onKeyDown:C("range"),style:{cursor:"grab"},children:M.map(([e,t],o)=>eM("path",{d:QC(v(e),v(t),n,r),fill:d,fillOpacity:.35,stroke:h,strokeWidth:1},o))}),["start","end"].map(t=>{const i=e[t],a=(e=>KC(v(e),n))(i),s=(e=>KC(v(e),r+8))(i);return tM("g",{role:"slider",tabIndex:0,"aria-label":`${c} ${t}`,"aria-valuemin":0,"aria-valuemax":o-1,"aria-valuenow":i,"aria-valuetext":P(i),onPointerDown:e=>k(e,t),onKeyDown:C(t),style:{cursor:"grab"},children:[eM("line",{x1:a.x,y1:a.y,x2:s.x,y2:s.y,stroke:"transparent",strokeWidth:20}),eM("line",{x1:a.x,y1:a.y,x2:s.x,y2:s.y,stroke:h,strokeWidth:1.5}),eM("circle",{cx:s.x,cy:s.y,r:4.5,fill:h,stroke:d,strokeWidth:1})]},t)})]})})}import*as rM from"react";import{useRef as nM}from"react";import{jsx as iM,jsxs as aM}from"react/jsx-runtime";function sM(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 lM({value:e,onChange:t,pointerToValue:o,min:r,max:n,step:i=1,largeStep:a=5*i,x:s,y:l,controlType:c="value",controlId:u,label:d,valueText:h,radius:p=12,fill:f="var(--semiotic-bg, #ffffff)",stroke:m="var(--semiotic-primary, #4e79a7)",strokeWidth:g=4,labelText:y,labelDx:b=16,labelDy:v=-16,labelClassName:x,className:w,disabled:k=!1,onChangeStart:S,onChangeEnd:A,onObservation:C,chartId:M,chartType:P}){const _=nM(null),L=nM(e);L.current=e;const R=rM.useMemo(()=>rS({controlType:c,controlId:u,chartId:M,chartType:P,onObservation:C}),[M,P,u,c,C]),I=e=>{if(k)return;const a=o(e);if(null==a||!Number.isFinite(a))return;const s=sM(a,r,n,i);L.current=s,t(s),R("control-change",s,"pointer")},$=e=>{e.stopPropagation(),_.current===e.pointerId&&(e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture?.(e.pointerId),_.current=null,A?.(L.current),R("control-end",L.current,"pointer"))},T=["semiotic-direct-manipulation-control",w].filter(Boolean).join(" ");return aM("g",{className:T,role:"slider",tabIndex:k?-1:0,"aria-disabled":k||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=>{k||(e.preventDefault(),e.stopPropagation(),e.currentTarget.setPointerCapture?.(e.pointerId),_.current=e.pointerId,S?.(L.current),R("control-start",L.current,"pointer"),I(e))},onPointerMove:e=>{e.stopPropagation(),_.current===e.pointerId&&I(e)},onPointerUp:$,onPointerCancel:$,onLostPointerCapture:$,onKeyDown:e=>{if(k)return;const o=e.shiftKey?a:i,s=L.current;let l=null;if("ArrowLeft"!==e.key&&"ArrowDown"!==e.key||(l=s-o),"ArrowRight"!==e.key&&"ArrowUp"!==e.key||(l=s+o),"Home"===e.key&&(l=r),"End"===e.key&&(l=n),null===l)return;e.preventDefault();const c=sM(l,r,n,i);L.current=c,t(c),R("control-change",c,"keyboard")},style:{cursor:k?"default":"grab",touchAction:"none"},children:[iM("circle",{className:"semiotic-direct-manipulation-control__hit",cx:s,cy:l,r:p+10,fill:"transparent"}),iM("circle",{className:"semiotic-direct-manipulation-control__handle",cx:s,cy:l,r:p,fill:f,stroke:m,strokeWidth:g}),y?iM("text",{className:x,x:s+b,y:l+v,fill:m,children:y}):null]})}import{useState as cM,useEffect as uM,useRef as dM,useCallback as hM}from"react";import{jsx as pM,jsxs as fM}from"react/jsx-runtime";function mM({children:e,position:t="right",size:o=300,trigger:r="click",chartId:n,observation:i,dismissOnEmpty:a=!0,showClose:s=!0,onToggle:l,className:c,style:u}){const[d,h]=cM(null),[p,f]=cM(null),[m,g]=cM(!1),[y,b]=cM(!1),v=dM(null),x=dM(void 0),w="click"===r?["click","click-end"]:["hover","hover-end"],{latest:k}=Sf({types:w,chartId:n,limit:1}),S=void 0!==i?i:k,A=hM(()=>{b(!0),g(!1),clearTimeout(x.current),x.current=setTimeout(()=>{b(!1),h(null),f(null)},200)},[]);if(uM(()=>{if(S)if("click"===S.type||"hover"===S.type){const e=S;h(e.datum),f(e),g(e=>(e||(b(!0),clearTimeout(x.current),x.current=setTimeout(()=>b(!1),200)),!0))}else!a||"click-end"!==S.type&&"hover-end"!==S.type||A()},[a,A,S]),uM(()=>{l?.(m)},[m,l]),uM(()=>()=>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 200ms ease-out, opacity 200ms 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,m,y);return fM("div",{ref:v,className:`semiotic-details-panel semiotic-details-${t}${c?" "+c:""}`,style:{...M,...u},children:[s&&pM("button",{className:"semiotic-details-close",onClick:A,"aria-label":"Close details",style:gM,children:pM("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",children:pM("path",{d:"M2 2l8 8M10 2l-8 8"})})}),pM("div",{className:"semiotic-details-content",style:{overflow:"auto",flex:1},children:C})]})}var gM={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};mM.displayName="DetailsPanel";import{useEffect as yM,useMemo as bM,useRef as vM,useState as xM}from"react";import{forceCenter as wM,forceCollide as kM,forceLink as SM,forceManyBody as AM,forceSimulation as CM,forceX as MM,forceY as PM}from"d3-force";function _M(e,t,o={}){const r=o.iterations??260,n=o.repulsion??5200,i=o.linkDistance??165,a=o.linkStrength??.045,s=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=500,m=e.map(e=>({id:e.id,data:e,x:200+600*h(),y:200+600*h()})),g=new Set(e.map(e=>e.id)),y=t.filter(e=>g.has(e.source)&&g.has(e.target)).map(e=>({source:e.source,target:e.target}));if(r>0){const e=CM(m).randomSource(h).alphaDecay(1-Math.pow(.001,1/r)).velocityDecay(Math.max(0,Math.min(1,1-l))).force("charge",AM().strength(e=>{const t=p.get(e.id)??0;return 2.5*-Math.sqrt(n)*Math.sqrt(t+1)})).force("collide",kM(e=>(e=>"function"==typeof c?c(e.data):c)(e)+u).strength(.9).iterations(2)).force("center",wM(f,f).strength(.8)).force("x",MM(f).strength(s)).force("y",PM(f).strength(s));y.length>0&&e.force("link",SM(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 a/.045/o})),e.stop();for(let t=0;r>t;t+=1)e.tick()}let b=1/0,v=1/0,x=-1/0,w=-1/0;for(const e of m){const t=e.x??f,o=e.y??f;b>t&&(b=t),v>o&&(v=o),t>x&&(x=t),o>w&&(w=o)}const k=x-b,S=w-v,A={};for(const e of m)A[e.id]={x:0===k?.5:d+((e.x??f)-b)/k*(1-2*d),y:0===S?.5:d+((e.y??f)-v)/S*(1-2*d)};return A}var LM=new WeakMap;function RM(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 IM(e,t,o){return null==o?null:LM.get(e)?.get(t)?.get(o)??null}function $M(e,t,o,r){if(null==o)return;let n=LM.get(e);n||(n=new WeakMap,LM.set(e,n));let i=n.get(t);if(i||(i=new Map,n.set(t,i)),!i.has(o)&&i.size>=16){const e=i.keys().next().value;void 0!==e&&i.delete(e)}i.set(o,r)}function TM(e,t,o={}){const r=sa(),{seed:n,iterations:i,repulsion:a,linkDistance:s,linkStrength:l,centerStrength:c,damping:u,nodeRadius:d,nodePadding:h,inset:p,execution:f,workerThreshold:m}=o,g=bM(()=>({seed:n,iterations:i,repulsion:a,linkDistance:s,linkStrength:l,centerStrength:c,damping:u,nodeRadius:d,nodePadding:h,inset:p,execution:f,workerThreshold:m}),[n,i,a,s,l,c,u,d,h,p,f,m]),y=vM(r),[b,v]=xM(()=>{if("undefined"==typeof window||r){const o=_M(e,t,g);return $M(e,t,RM(g),o),{positions:o,status:"ready",error:null}}const o=IM(e,t,RM(g));return o?{positions:o,status:"ready",error:null}:{positions:null,status:"pending",error:null}});return yM(()=>{if(y.current)return void(y.current=!1);const o=RM(g),r=IM(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:a,...s}=o,l=s.iterations??260;if(!Uh()||!Xh(r,e.length,t.length,l,i))return _M(e,t,{...s,nodeRadius:a});const c={kind:"normalized",nodes:e.map(e=>({...e})),edges:t.map(e=>({...e})),options:s,nodeRadii:"function"==typeof a?Object.fromEntries(e.map(e=>[e.id,a(e)])):null==a?void 0:Object.fromEntries(e.map(e=>[e.id,a]))};try{return(await Jh(c,n)).positions}catch(o){if("AbortError"===o?.name)throw o;return _M(e,t,{...s,nodeRadius:a})}}(e,t,{...g,signal:n.signal}).then(r=>{$M(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,g]),b}import*as NM from"react";function FM(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 DM(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}}import{jsx as BM,jsxs as EM}from"react/jsx-runtime";function zM({manifest:e,label:t="Intent Mark",className:o,showSummary:r=!0}){const[n,i]=NM.useState(!1),a=NM.useMemo(()=>JSON.stringify(e,null,2),[e]),s=NM.useCallback(async()=>{"undefined"!=typeof navigator&&navigator.clipboard&&(await navigator.clipboard.writeText(a),i(!0),window.setTimeout(()=>i(!1),1200))},[a]);return EM("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:[EM("summary",{style:{cursor:"pointer",padding:"7px 10px",fontSize:12,fontWeight:700,letterSpacing:"0.04em",textTransform:"uppercase"},children:[t," · ",e.intent.primary]}),EM("div",{style:{padding:"0 10px 10px"},children:[r&&BM("p",{style:{margin:"4px 0 10px",fontSize:13,lineHeight:1.45},children:FM(e)}),BM("button",{type:"button",onClick:s,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"}),BM("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:a})]})]})}import{useCallback as HM,useEffect as OM,useMemo as WM,useRef as jM,useState as YM}from"react";function GM(e){if("datum"===e.role&&e.datum)return e.datum;for(const t of e.children??[]){const e=GM(t);if(e)return e}return null}function qM(e,t){return e?t.map(t=>e[t]+"").join(""):""}function VM(e){const{tree:t,chartId:o,observe:r=["hover","click"]}=e,n=e.selectionName??"__semiotic-nav-sync"+(o?":"+o:""),i=WM(()=>{if(e.matchFields)return e.matchFields;const o=GM(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]),a=WM(()=>{const e=new Map,o=t=>{if("datum"===t.role&&t.datum){const o=qM(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:s,clear:l}=mf({name:n,fields:i}),{latest:c}=Sf({chartId:o,types:[...r,"hover-end"],limit:1}),[u,d]=YM(t.id);OM(()=>{d(t.id),l()},[t,l]);const h=HM(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]];s(t)}else l()},[i,s,l]),p=e.annotations,f=WM(()=>{const e=new Set;if(0===i.length||!p)return e;for(const t of p){const o=a.get(qM(t,i));o&&e.add(o)}return e},[p,a,i]),m=HM(e=>{const t="number"==typeof e?p?.[e]:e;if(!t||0===i.length)return!1;const o=a.get(qM(t,i));if(!o)return!1;d(o);const r={};for(const e of i)r[e]=[t[e]];return s(r),!0},[p,a,i,s]),g=jM(null);return OM(()=>{if(!c||c===g.current)return;if(g.current=c,"hover-end"===c.type)return;const e=c.datum;if(!e||0===i.length)return;const t=a.get(qM(e,i));t&&t!==u&&d(t)},[c,a,i,u]),{activeId:u,onActiveChange:h,selection:{name:n},annotatedIds:f,focusAnnotation:m}}import{useEffect as XM,useMemo as UM,useRef as KM}from"react";function QM(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 a=[];if(n.forEach((o,r)=>{const n=t.get(r);void 0===n?a.push(o):n!==o&&(e.update?e.update(r,()=>o):(e.remove?.(r),a.push(o)))}),a.length>0)if(e.pushMany)e.pushMany(a);else if(e.push)for(const t of a)e.push(t);return n}function ZM(e,t,o={}){const{id:r,resetKey:n}=o,i=UM(()=>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]),a=KM({map:new Map,handle:null,resetKey:void 0});XM(()=>{const o=e.current;if(!o)return;const r=a.current;r.handle===o&&r.resetKey===n||(o.clear?.(),r.map=new Map,r.handle=o,r.resetKey=n),r.map=QM(o,r.map,t,i)},[e,t,i,n])}import{Fragment as JM,jsx as eP,jsxs as tP}from"react/jsx-runtime";function oP({items:e,title:t="Additional notes",empty:o=null,ordered:r=!0,renderItem:n,className:i,style:a}){if(!e.length)return o?eP(JM,{children:o}):null;const s=r?"ol":"ul";return tP("section",{className:["semiotic-mobile-annotation-callouts",i].filter(Boolean).join(" "),style:a,children:[eP("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&&eP("h3",{children:t}),eP(s,{children:e.map((e,t)=>eP("li",{children:n?n(e,t):tP(JM,{children:[eP("span",{children:e.label}),(e.source||e.emphasis)&&eP("small",{children:[e.emphasis,e.source].filter(Boolean).join(" - ")})]})},e.id))})]})}export{FA as AccessibleNavTree,Lg as AreaChart,Rb as BarChart,wv as BoxPlot,oy as BubbleChart,Gf as CARBON_ALERT,Yf as CARBON_CATEGORICAL_14,Y as COLOR_BLIND_SAFE_CATEGORICAL,ib as CandlestickChart,qp as CategoryColorProvider,AC as ChartContainer,zh as ChartErrorBoundary,WC as ChartGrid,jx as ChordDiagram,_w as CirclePack,oM as CircularBrush,ug as ConnectedScatterplot,VC as ContextLayout,q as DARK_THEME,mM as DetailsPanel,zg as DifferenceChart,lM as DirectManipulationControl,ix as DonutChart,Uv as DotPlot,Ex as ForceDirectedGraph,Yv as FunnelChart,yx as GaugeChart,kx as GroupedBarChart,V as HIGH_CONTRAST_THEME,Kg as Heatmap,_v as Histogram,Z as IncrementalExtent,zM as IntentMark,G as LIGHT_THEME,iv as LikertChart,wg as LineChart,Bf as LinkedCharts,$y as MinimapChart,oP as MobileAnnotationCalloutList,LC as MobileChartContainer,UA as MobileStandardControls,Jy as MultiAxisLineChart,fs as MultiLineTooltip,yb as NetworkCustomChart,$w as OrbitDiagram,wb as OrdinalCustomChart,ex as PieChart,bw as ProcessSankey,Oy as QuadrantChart,zk as RealtimeHeatmap,vk as RealtimeHistogram,dk as RealtimeLineChart,Pk as RealtimeSwarmChart,wk as RealtimeTemporalHistogram,Tk as RealtimeWaterfallChart,Ev as RidgelinePlot,Q as RingBuffer,Xx as SankeyDiagram,rg as Scatterplot,xy as ScatterplotMatrix,BC as SmallMultipleChart,Yg as StackedAreaChart,Fb as StackedBarChart,Mp as StreamNetworkFrame,hu as StreamOrdinalFrame,Hl as StreamXYFrame,pv as SwarmPlot,Px as SwimlaneChart,qf as THEME_PRESETS,xk as TemporalHistogram,tm as ThemeProvider,ps as Tooltip,ww as TreeDiagram,Cw as Treemap,oS as VISUALIZATION_CONTROL_TYPES,Tv as ViolinPlot,pb as XYCustomChart,Yk as adaptiveTimeTicks,iS as auditVisualizationControls,yA as buildNavigationTree,zA as clampMobileRange,Xe as compileMotionEncoding,PS as configToJSX,MS as copyConfig,rS as createControlObservationAdapter,Kc as createHatchPattern,e as darkenColor,Ze as deriveMotionVector,LS as deserializeSelections,Gk as exportChart,SS as fromConfig,CS as fromURL,DS as fromVegaLite,DM as intentManifestFromRecipe,n as lightenColor,gs as normalizeTooltip,Ke as opacityFromAge,Ve as resolveMotionAccessor,Ue as resolveMotionAge,Qe as resolveMotionVector,im as resolveResponsiveRules,Vf as resolveThemePreset,nm as responsiveRuleMatches,_S as serializeSelections,Ok as smartTickFormat,ss as smartTooltipEntries,FM as summarizeIntentManifest,QM as syncPushBuffer,Wf as themeToCSS,jf as themeToTokens,kS as toConfig,AS as toURL,vf as useBrushSelection,Vp as useCategoryColors,Sf as useChartObserver,wo as useCustomLayoutSelection,wf as useFilteredData,TM as useForceLayout,_f as useLinkedChartsActive,yf as useLinkedHover,OA as useMobileRangeControls,VM as useNavigationSync,mf as useSelection,gf as useSelectionActions,ZM as useSyncedPushData,om as useTheme,HA as zoomMobileRange};
|