semiotic 3.7.5 → 3.8.1
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 +63 -18
- package/README.md +121 -27
- 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 +1741 -163
- package/ai/examples.md +174 -0
- package/ai/schema.json +2733 -536
- package/ai/surface-manifest.json +201 -0
- package/ai/system-prompt.md +20 -4
- package/dist/__tests__/scenarios/mcpProtocolTypes.d.ts +20 -0
- package/dist/components/AccessibleNavTree.d.ts +7 -1
- 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/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 +26 -1
- package/dist/components/ai/chartClinic.d.ts +91 -0
- package/dist/components/ai/chartClinicMetadata.generated.d.ts +15 -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 +102 -0
- package/dist/components/ai/describeChart.d.ts +7 -0
- package/dist/components/ai/describeRecipeChart.d.ts +16 -0
- package/dist/components/ai/generativeChart.d.ts +28 -3
- 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/ai/useNavigationSync.d.ts +17 -2
- package/dist/components/chartContainerMobile.d.ts +9 -0
- package/dist/components/charts/custom/GeoCustomChart.d.ts +48 -0
- package/dist/components/charts/custom/NetworkCustomChart.d.ts +8 -2
- 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/ChoroplethMap.d.ts +19 -2
- package/dist/components/charts/geo/DistanceCartogram.d.ts +15 -3
- package/dist/components/charts/geo/FlowMap.d.ts +11 -7
- package/dist/components/charts/geo/ProportionalSymbolMap.d.ts +15 -3
- package/dist/components/charts/geo/index.d.ts +2 -0
- package/dist/components/charts/index.d.ts +35 -1
- package/dist/components/charts/network/ChordDiagram.d.ts +10 -2
- package/dist/components/charts/network/CirclePack.d.ts +1 -1
- package/dist/components/charts/network/ForceDirectedGraph.d.ts +26 -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 +10 -2
- 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 +22 -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 +12 -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 +12 -1
- package/dist/components/charts/ordinal/SwarmPlot.d.ts +1 -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 +54 -0
- package/dist/components/charts/physics/EventDropChart.capability.d.ts +2 -0
- package/dist/components/charts/physics/EventDropChart.d.ts +60 -0
- package/dist/components/charts/physics/GaltonBoardChart.capability.d.ts +2 -0
- package/dist/components/charts/physics/GaltonBoardChart.d.ts +74 -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 +99 -0
- package/dist/components/charts/physics/PhysicsPileChart.capability.d.ts +2 -0
- package/dist/components/charts/physics/PhysicsPileChart.d.ts +60 -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 +57 -0
- package/dist/components/charts/physics/physicsChartUtils.d.ts +18 -0
- package/dist/components/charts/physics/physicsCustomLayout.d.ts +32 -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 +9 -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/shared/AnnotationLabel.d.ts +88 -0
- package/dist/components/charts/shared/annotationActivation.d.ts +35 -0
- package/dist/components/charts/shared/annotationLabelLayout.d.ts +5 -0
- package/dist/components/charts/shared/annotationRules.d.ts +2 -1
- 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/chartSelectionUtils.d.ts +4 -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/colorUtils.d.ts +16 -1
- package/dist/components/charts/shared/datumTypes.d.ts +2 -0
- package/dist/components/charts/shared/diagnoseAnnotationChecks.d.ts +6 -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/formatUtils.d.ts +3 -3
- package/dist/components/charts/shared/hatchFill.d.ts +87 -0
- package/dist/components/charts/shared/hooks.d.ts +34 -10
- package/dist/components/charts/shared/knownChartComponents.d.ts +9 -0
- package/dist/components/charts/shared/leastSquaresRegression.d.ts +16 -0
- package/dist/components/charts/shared/mergeShapeStyle.d.ts +3 -2
- package/dist/components/charts/shared/motionEncoding.d.ts +145 -0
- package/dist/components/charts/shared/responsiveRules.d.ts +56 -0
- package/dist/components/charts/shared/semanticInteractions.d.ts +42 -0
- package/dist/components/charts/shared/sparseArray.d.ts +1 -1
- package/dist/components/charts/shared/streamPropsHelpers.d.ts +17 -5
- package/dist/components/charts/shared/styleRules.d.ts +205 -0
- package/dist/components/charts/shared/temporalStrings.d.ts +7 -0
- package/dist/components/charts/shared/tooltipUtils.d.ts +22 -9
- package/dist/components/charts/shared/types.d.ts +58 -7
- package/dist/components/charts/shared/useAreaSeriesSetup.d.ts +16 -2
- package/dist/components/charts/shared/useChartSetup.d.ts +11 -4
- package/dist/components/charts/shared/useCustomChartSetup.d.ts +17 -5
- package/dist/components/charts/shared/useFrameImperativeHandle.d.ts +1 -2
- package/dist/components/charts/shared/useLikertAggregation.d.ts +4 -4
- package/dist/components/charts/shared/useNetworkChartSetup.d.ts +6 -2
- package/dist/components/charts/shared/useOrdinalBrush.d.ts +2 -1
- package/dist/components/charts/shared/useOrdinalPieceStyle.d.ts +25 -2
- package/dist/components/charts/shared/useStreamingLegend.d.ts +2 -2
- package/dist/components/charts/shared/useSyncedPushData.d.ts +49 -0
- package/dist/components/charts/shared/useXYLineStyle.d.ts +10 -0
- package/dist/components/charts/shared/useXYPointStyle.d.ts +19 -1
- package/dist/components/charts/shared/validateChartData.d.ts +7 -5
- package/dist/components/charts/shared/validationMap.d.ts +7 -9
- package/dist/components/charts/shared/validationMap.generated.d.ts +6 -0
- package/dist/components/charts/shared/withChartWrapper.d.ts +4 -3
- package/dist/components/charts/value/targetPresentation.d.ts +22 -0
- package/dist/components/charts/value/types.d.ts +5 -6
- package/dist/components/charts/xy/AreaChart.d.ts +9 -1
- package/dist/components/charts/xy/BubbleChart.d.ts +10 -1
- package/dist/components/charts/xy/ConnectedScatterplot.d.ts +7 -0
- package/dist/components/charts/xy/DifferenceChart.d.ts +1 -52
- package/dist/components/charts/xy/Heatmap.d.ts +2 -2
- package/dist/components/charts/xy/LineChart.d.ts +12 -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 +8 -1
- package/dist/components/charts/xy/Scatterplot.d.ts +11 -1
- package/dist/components/charts/xy/ScatterplotMatrix.d.ts +11 -1
- package/dist/components/charts/xy/StackedAreaChart.d.ts +16 -4
- package/dist/components/charts/xy/differenceSegments.d.ts +49 -0
- package/dist/components/charts/xy/scatterplotMatrixInteractionTypes.d.ts +12 -0
- package/dist/components/controls/SentenceFilter.d.ts +97 -0
- package/dist/components/controls/controlAudit.d.ts +24 -0
- package/dist/components/controls/controlContract.d.ts +57 -0
- package/dist/components/data/fromFlintChart.d.ts +74 -0
- package/dist/components/data/fromVegaLite.d.ts +46 -9
- package/dist/components/data/portability/index.d.ts +6 -3
- package/dist/components/data/portability/result.d.ts +52 -0
- package/dist/components/data/portability/spec.d.ts +31 -0
- package/dist/components/data/portability/vegaLite.d.ts +24 -6
- package/dist/components/export/chartConfig.d.ts +11 -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/{gofishBoba.d.ts → boba.d.ts} +2 -2
- 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 +178 -132
- package/dist/components/recipes/gofishIRExamples.d.ts +30 -81
- 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/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/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 +91 -0
- package/dist/components/recipes/recipeGlyph.d.ts +42 -0
- package/dist/components/recipes/recipeLegend.d.ts +53 -1
- package/dist/components/recipes/recipeUtils.d.ts +52 -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/rough/createRoughRenderMode.d.ts +46 -0
- package/dist/components/semiotic-ai-core.d.ts +47 -0
- package/dist/components/semiotic-ai.d.ts +53 -9
- package/dist/components/semiotic-controls.d.ts +20 -0
- package/dist/components/semiotic-experimental.d.ts +38 -9
- package/dist/components/semiotic-geo.d.ts +15 -0
- package/dist/components/semiotic-network.d.ts +15 -0
- package/dist/components/semiotic-ordinal.d.ts +14 -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 +60 -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 -30
- 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 -43
- package/dist/components/semiotic-rough.d.ts +4 -0
- 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 -76
- package/dist/components/semiotic-utils-core.d.ts +50 -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 +12 -0
- package/dist/components/semiotic.d.ts +44 -8
- package/dist/components/server/animatedGif.d.ts +36 -0
- package/dist/components/server/optionalImageTypes.d.ts +37 -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 +21 -0
- package/dist/components/server/serverChartConfigs.d.ts +22 -12
- 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/staticAnnotations.d.ts +6 -3
- package/dist/components/server/staticGeo.d.ts +4 -0
- package/dist/components/server/staticLegend.d.ts +2 -2
- 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 -2
- 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 +7 -23
- package/dist/components/stream/AriaLiveTooltip.d.ts +9 -0
- package/dist/components/stream/CanvasHitTester.d.ts +4 -4
- package/dist/components/stream/DataSourceAdapter.d.ts +1 -1
- package/dist/components/stream/FocusRing.d.ts +4 -2
- package/dist/components/stream/FrameRuntime.d.ts +57 -0
- package/dist/components/stream/GeoCanvasHitTester.d.ts +1 -1
- package/dist/components/stream/GeoParticlePool.d.ts +1 -1
- package/dist/components/stream/GeoPipelineStore.d.ts +62 -3
- package/dist/components/stream/GeoSVGOverlay.d.ts +64 -0
- package/dist/components/stream/NetworkCanvasHitTester.d.ts +2 -1
- package/dist/components/stream/NetworkPipelineStore.d.ts +44 -36
- package/dist/components/stream/NetworkSSRFrame.d.ts +17 -0
- package/dist/components/stream/NetworkSVGOverlay.d.ts +10 -1
- package/dist/components/stream/OrdinalCanvasHitTester.d.ts +2 -2
- package/dist/components/stream/OrdinalPipelineStore.d.ts +55 -11
- package/dist/components/stream/OrdinalSVGOverlay.d.ts +9 -1
- package/dist/components/stream/OrdinalStyleResolver.d.ts +12 -0
- package/dist/components/stream/ParticlePool.d.ts +1 -1
- package/dist/components/stream/PipelineStore.d.ts +81 -174
- package/dist/components/stream/SVGOverlay.d.ts +6 -0
- package/dist/components/stream/SceneGraph.d.ts +12 -4
- 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 +25 -12
- package/dist/components/stream/annotationAccessorResolver.d.ts +2 -2
- 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/customLayoutFailure.d.ts +33 -0
- package/dist/components/stream/customLayoutPalette.d.ts +19 -9
- package/dist/components/stream/frameGraphics.d.ts +4 -0
- package/dist/components/stream/frameKeyboardNavigation.d.ts +45 -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/geoPipelineUpdateResults.d.ts +34 -0
- package/dist/components/stream/geoSceneBuilder.d.ts +16 -0
- package/dist/components/stream/geoTypes.d.ts +97 -15
- package/dist/components/stream/glyphDef.d.ts +98 -0
- package/dist/components/stream/hitTarget.d.ts +170 -0
- package/dist/components/stream/hitTestUtils.d.ts +2 -2
- package/dist/components/stream/hoverUtils.d.ts +7 -2
- 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 +58 -0
- package/dist/components/stream/layouts/hierarchyUtils.d.ts +2 -2
- package/dist/components/stream/networkBezier.d.ts +10 -0
- package/dist/components/stream/networkColorAccessors.d.ts +49 -0
- package/dist/components/stream/networkCustomLayoutRunner.d.ts +23 -0
- package/dist/components/stream/networkCustomRestyle.d.ts +15 -0
- package/dist/components/stream/networkDefaultTooltip.d.ts +10 -0
- package/dist/components/stream/networkFrameAnimation.d.ts +7 -0
- package/dist/components/stream/networkFrameHandleTypes.d.ts +39 -0
- package/dist/components/stream/networkFrameInteraction.d.ts +37 -0
- package/dist/components/stream/networkFrameObservations.d.ts +15 -0
- package/dist/components/stream/networkFramePaint.d.ts +52 -0
- package/dist/components/stream/networkInteractionTypes.d.ts +26 -0
- package/dist/components/stream/networkPipelineConfig.d.ts +22 -0
- package/dist/components/stream/networkPipelineHelpers.d.ts +12 -0
- package/dist/components/stream/networkPipelineUpdateResults.d.ts +38 -0
- package/dist/components/stream/networkRealtimeEncoding.d.ts +41 -0
- package/dist/components/stream/networkTypes.d.ts +103 -51
- package/dist/components/stream/ordinalCanvasRenderers.d.ts +7 -0
- 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 +31 -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 -2
- package/dist/components/stream/ordinalSpatialIndex.d.ts +9 -0
- package/dist/components/stream/ordinalTypes.d.ts +68 -9
- 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 +86 -0
- package/dist/components/stream/physics/PhysicsPipelineTypes.d.ts +181 -0
- package/dist/components/stream/physics/PhysicsSVGOverlay.d.ts +78 -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 +317 -0
- package/dist/components/stream/physics/physicsBodyCanvas.d.ts +27 -0
- package/dist/components/stream/physics/physicsFrameObservations.d.ts +19 -0
- package/dist/components/stream/physics/physicsFrameSetup.d.ts +4 -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 +27 -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 +18 -0
- package/dist/components/stream/pipelineBufferUtils.d.ts +26 -0
- package/dist/components/stream/pipelineConfig.d.ts +179 -0
- package/dist/components/stream/pipelineDecay.d.ts +21 -3
- 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 +17 -3
- 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 +33 -0
- package/dist/components/stream/pipelineStyleResolvers.d.ts +46 -0
- package/dist/components/stream/pipelineTransitions.d.ts +3 -1
- package/dist/components/stream/pipelineUpdateContract.d.ts +69 -0
- package/dist/components/stream/pipelineUpdateStore.d.ts +21 -0
- package/dist/components/stream/pulseFrameRefresh.d.ts +22 -0
- package/dist/components/stream/renderBackend.d.ts +27 -0
- package/dist/components/stream/renderers/canvasRenderHelpers.d.ts +15 -1
- package/dist/components/stream/renderers/geoCanvasRenderer.d.ts +3 -2
- package/dist/components/stream/renderers/glyphCanvasRenderer.d.ts +6 -0
- package/dist/components/stream/renderers/networkParticleRenderer.d.ts +1 -1
- package/dist/components/stream/renderers/resolveCSSColor.d.ts +6 -0
- package/dist/components/stream/sceneRenderBackendTypes.d.ts +28 -0
- package/dist/components/stream/sceneRevisionDiagnostics.d.ts +45 -0
- package/dist/components/stream/streamSemanticTypes.d.ts +16 -0
- package/dist/components/stream/streamStoreSync.d.ts +37 -0
- package/dist/components/stream/streamThemeTypes.d.ts +14 -0
- package/dist/components/stream/svgOverlayUtils.d.ts +10 -0
- package/dist/components/stream/test-utils/frameScheduler.d.ts +12 -0
- package/dist/components/stream/test-utils/revisionConsumption.d.ts +13 -0
- package/dist/components/stream/titleLayout.d.ts +31 -0
- package/dist/components/stream/types.d.ts +165 -72
- package/dist/components/stream/useCanvasFrameHost.d.ts +71 -0
- package/dist/components/stream/useFrame.d.ts +44 -2
- package/dist/components/stream/useHydration.d.ts +6 -0
- package/dist/components/stream/useLegendCategoryEmission.d.ts +5 -0
- package/dist/components/stream/useSemanticFrameInteractions.d.ts +22 -0
- package/dist/components/stream/useUpdateResultSnapshot.d.ts +7 -0
- 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/xyFrameAxisTypes.d.ts +50 -0
- package/dist/components/stream/xySceneBuilders/types.d.ts +10 -9
- 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/rough.min.js +1 -0
- package/dist/rough.module.min.js +1 -0
- 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 +53 -9
- 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 +20 -0
- package/dist/semiotic-data.min.js +1 -1
- package/dist/semiotic-data.module.min.js +1 -1
- package/dist/semiotic-experimental.d.ts +38 -9
- package/dist/semiotic-experimental.min.js +1 -1
- package/dist/semiotic-experimental.module.min.js +1 -1
- package/dist/semiotic-geo.d.ts +15 -0
- package/dist/semiotic-network.d.ts +15 -0
- package/dist/semiotic-ordinal.d.ts +14 -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 +60 -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 -30
- 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 -43
- package/dist/semiotic-recipes.min.js +1 -1
- package/dist/semiotic-recipes.module.min.js +1 -1
- package/dist/semiotic-rough.d.ts +4 -0
- 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 -76
- package/dist/semiotic-themes.min.js +1 -2
- package/dist/semiotic-themes.module.min.js +1 -2
- package/dist/semiotic-utils-core.d.ts +50 -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 +12 -0
- package/dist/semiotic.d.ts +44 -8
- 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/test-utils/capturedFrameProps.d.ts +67 -0
- package/dist/test-utils/frameMock.d.ts +12 -9
- 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 +259 -88
- 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/components/recipes/gofish.d.ts +0 -207
- package/dist/components/recipes/gofishInterpreter.d.ts +0 -52
- package/dist/components/recipes/gofishLambdas.d.ts +0 -145
- package/dist/semiotic-ai-semiotic-ai-u954ylUn.js +0 -2
- package/dist/semiotic-ai-statisticalOverlays-CU7jW05Q.js +0 -1
- package/dist/semiotic-semiotic-BmrYbi99.js +0 -2
- package/dist/semiotic-statisticalOverlays-IjZw8Lsu.js +0 -1
- package/dist/xy-semiotic-xy-Dufu3D0-.js +0 -2
- package/dist/xy-statisticalOverlays-3Ni9bRph.js +0 -1
package/dist/semiotic.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";const e=require("react/jsx-runtime"),t=require("react"),n=require("d3-selection"),o=require("d3-brush"),i=require("d3-scale"),r=require("d3-quadtree"),s=require("d3-shape"),a=require("d3-array"),l=require("d3-hierarchy"),c=require("regression"),u=require("d3-interpolate"),d=require("d3-force"),h=require("d3-chord");function g(e){return e&&e.__esModule?e:{default:e}}function f(e){if(e&&e.__esModule)return e;const t=Object.create(null);if(e)for(const n in e)if("default"!==n){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}return t.default=e,Object.freeze(t)}const p=f(t),y=g(c);function m(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 v(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 b({width:i,height:r,totalWidth:s,totalHeight:a,margin:l,dimension:c,scales:u,onBrush:d,binSize:h,snap:g,binBoundaries:f,snapDuring:p,streaming:y}){const b=t.useRef(null),x=t.useRef(null),k=t.useRef(d);k.current=d;const w=t.useRef(u);w.current=u;const A=t.useMemo(()=>f?[...f].sort((e,t)=>e-t):void 0,[f]),j=t.useRef(A);j.current=A;const S=t.useRef(!1),O=t.useRef(null);return t.useEffect(()=>{if(!b.current)return;const e=n.select(b.current).select(".brush-g"),t="x"===c?o.brushX():"y"===c?o.brushY():o.brush();return t.extent([[0,0],[i,r]]),t.on("brush end",n=>{if(S.current)return;const o=w.current;if(!o)return;if(!n.selection)return O.current=null,void k.current(null);let s,a;if("x"===c){const[e,t]=n.selection;s=[o.x.invert(e),o.x.invert(t)],a=[o.y.invert(r),o.y.invert(0)]}else if("y"===c){const[e,t]=n.selection;s=[o.x.invert(0),o.x.invert(i)],a=[o.y.invert(t),o.y.invert(e)]}else{const[[e,t],[i,r]]=n.selection;s=[o.x.invert(e),o.x.invert(i)],a=[o.y.invert(r),o.y.invert(t)]}if("bin"===g&&"y"!==c&&("end"===n.type||"brush"===n.type&&p)){const i=j.current;i&&i.length>0?s=function(e,t){return 0===t.length?e:[m(e[0],t),v(e[1],t)]}(s,i):h&&h>0&&(s=[Math.floor(s[0]/h)*h,Math.ceil(s[1]/h)*h]);const r=o.x(s[0]),a=o.x(s[1]);if(S.current=!0,"x"===c)e.call(t.move,[r,a]);else if("xy"===c){const o=n.selection;e.call(t.move,[[r,o[0][1]],[a,o[1][1]]])}S.current=!1}const l={x:s,y:a};O.current=l,k.current(l)}),e.call(t),x.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null),x.current=null}},[i,r,c,g,h,p]),t.useEffect(()=>{if(!(y&&u&&x.current&&O.current))return;if(!b.current)return;if("y"===c)return;const e=O.current,t=u.x.domain()[0],o=n.select(b.current).select(".brush-g");if(t>=e.x[1])return S.current=!0,o.call(x.current.move,null),S.current=!1,O.current=null,void k.current(null);let i=e.x[0],r=!1;if(t>e.x[0]){if(i=t,"bin"===g){const e=j.current;e&&e.length>0?i=v(t,e):h&&h>0&&(i=Math.ceil(t/h)*h)}if(i>=e.x[1])return S.current=!0,o.call(x.current.move,null),S.current=!1,O.current=null,void k.current(null);r=!0}const s=u.x(i),a=u.x(e.x[1]);if(S.current=!0,"x"===c)o.call(x.current.move,[s,a]);else{const t=u.y(e.y[1]),n=u.y(e.y[0]);o.call(x.current.move,[[s,t],[a,n]])}if(S.current=!1,r){const t={x:[i,e.x[1]],y:e.y};O.current=t,k.current(t)}},[u,y,c,g,h]),e.jsx("svg",{ref:b,width:s,height:a,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:e.jsx("g",{className:"brush-g",transform:`translate(${l.left},${l.top})`})})}const x=Object.freeze([]);function k(e){if(!e)return x;let t=!1;for(let 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 w{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=k(e),this.lastBoundedData===e)return;if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,totalSize:e.length});let t=this.chunkSize;const 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=k(e),this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.pushBuffer=[],this.flushScheduled=!1,this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0,preserveCategoryOrder:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,preserveCategoryOrder:!0,totalSize:e.length});let t=this.chunkSize;const 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 A(n){let o=null;const i=()=>(o||(o=t.createContext(null)),o),r=j(n);return[function({children:o,initialState:r}){const s=t.useRef(r),a=t.useMemo(()=>j(n,s.current),[]),l=i();return e.jsx(l.Provider,{value:a,children:o})},(e,n)=>{var o;const s=i(),a=null!==(o=t.useContext(s))&&void 0!==o?o:r,l=t.useRef(e);l.current=e;const c=t.useRef({hasValue:!1,value:void 0}),u=t.useCallback(()=>{const e=l.current(a.getState()),t=c.current;return t.hasValue&&n&&n(t.value,e)?t.value:(c.current={hasValue:!0,value:e},e)},[a,n]),d=t.useCallback(()=>l.current(a.getState()),[a]);return t.useSyncExternalStore(a.subscribe,u,d)}]}function j(e,t){const n=new Set;let o=Object.assign(Object.assign({},e(function(e){const t=e(o);if(function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}(t)){o=Object.assign(Object.assign({},o),t);for(const e of n)e()}})),null!=t?t:{});return{getState:()=>o,subscribe:function(e){return n.add(e),()=>{n.delete(e)}}}}function S(e){if(!(null==e?void 0:e.colors))return;const t=e.colors;return{primary:t.primary,secondary:t.secondary||t.primary,surface:t.surface||t.background,success:t.success,danger:t.danger,warning:t.warning,error:t.error,info:t.info,text:t.text,textSecondary:t.textSecondary,border:t.border,grid:t.grid}}function O(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{categorical:M})})),e.accessibility.highContrast){const e="dark"===t.mode;t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{text:e?"#ffffff":"#000000",textSecondary:e?"#cccccc":"#333333",grid:e?"#666666":"#999999",border:e?"#888888":"#000000"})})}return t}const M=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],C={mode:"light",colors:{primary:"#00a2ce",secondary:"#6c757d",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"transparent",surface:"#ffffff",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc",selection:"#00a2ce",selectionOpacity:.15,success:"#2ca02c",danger:"#d62728",warning:"#f0ad4e",error:"#b4181b",info:"#00a2ce"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:12}},_={mode:"dark",colors:{primary:"#4fc3f7",secondary:"#90a4ae",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",diverging:"RdBu",background:"#1a1a2e",surface:"#252540",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555",selection:"#4fc3f7",selectionOpacity:.15,success:"#81c784",danger:"#ef5350",warning:"#ffb74d",error:"#d84848",info:"#4fc3f7"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:12}},P={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:M,sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#000000",textSecondary:"#333333",grid:"#999999",border:"#000000",focus:"#0000cc",selection:"#0000cc",selectionOpacity:.1,success:"#006400",danger:"#cc0000",warning:"#b15a00",error:"#8b0000",info:"#0000cc"},typography:{fontFamily:"system-ui, sans-serif",titleSize:18,labelSize:14,tickSize:12},tooltip:{background:"#000000",text:"#ffffff",borderRadius:"4px",fontSize:"14px",shadow:"0 2px 8px rgba(0, 0, 0, 0.3)"},borderRadius:"4px"};function L(e,t){if("light"===t)return C;if("dark"===t)return _;if("high-contrast"===t)return P;if("string"==typeof t)return void 0!==console&&console.warn(`[ThemeStore] Unknown theme preset "${t}". Keeping current theme.`),e;if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?_:C;return O(Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})}))}return O(Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})}))}const[T,R]=A(e=>({theme:C,setTheme(t){e(e=>({theme:L(e.theme,t)}))}}));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 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,s=this.buffer[r];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:Object.assign({},s),n.push(e),this.buffer[r]=t(s)}}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 N{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(e){Number.isFinite(e)&&(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}evict(e){e!==this._min&&e!==this._max||(this._dirty=!0)}recalculate(e,t){this._min=1/0,this._max=-1/0;for(const 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 E(e,t,n,o,i){const r=new Map;for(const s of e){const e=t(s),a=n(s);if(null==e||null==a||Number.isNaN(e)||Number.isNaN(a))continue;const l=Math.floor(e/o)*o;let c=r.get(l);if(c||(c={start:l,end:l+o,total:0,categories:new Map},r.set(l,c)),c.total+=a,i){const e=i(s);c.categories.set(e,(c.categories.get(e)||0)+a)}}return r}function B(e,t,n,o,i,r){const s=[];for(const i of e){const e=n(i),r=o(i);Number.isFinite(e)&&Number.isFinite(r)&&s.push({px:t.x(e),py:t.y(r),rawY:r,d:i})}s.sort((e,t)=>e.px-t.px);const a=Array(s.length),l=Array(s.length),c=Array(s.length);for(let e=0;s.length>e;e++){const t=s[e];a[e]=[t.px,t.py],l[e]=t.rawY,c[e]=t.d}return{type:"line",path:a,rawValues:l,style:i,datum:c,group:r}}function D(e,t,n,o,i,r,s,a){const l=[];for(const r of e){const e=n(r),s=o(r);if(!Number.isFinite(e)||!Number.isFinite(s))continue;const c=t.x(e),u=a?a(r):i;l.push({px:c,topY:t.y(s),botY:t.y(u)})}l.sort((e,t)=>e.px-t.px);const c=Array(l.length),u=Array(l.length);for(let e=0;l.length>e;e++){const t=l[e];c[e]=[t.px,t.topY],u[e]=[t.px,t.botY]}return{type:"area",topPath:c,bottomPath:u,style:r,datum:e,group:s}}function I(e,t,n,o){var i,r,s;const a=new Map;if("silhouette"===o)for(const o of e){let e=0;for(const i of t)e+=n(i,o)||0;a.set(o,-e/2)}else if("wiggle"===o){e.length>0&&a.set(e[0],0);for(let o=1;e.length>o;o++){const r=e[o-1],s=e[o];let l=0,c=0,u=0;for(const e of t){const t=n(e,s)||0;l+=(2*u+t)*(t-(n(e,r)||0)),c+=t,u+=t}const d=null!==(i=a.get(r))&&void 0!==i?i:0;a.set(s,d-(c>0?l/(2*c):0))}if(e.length>0){let o=0;for(const i of e){let e=0;for(const o of t)e+=n(o,i)||0;o+=(null!==(r=a.get(i))&&void 0!==r?r:0)+e/2}const i=o/e.length;for(const t of e)a.set(t,(null!==(s=a.get(t))&&void 0!==s?s:0)-i)}}else for(const t of e)a.set(t,0);return a}function F(e,t,n,o,i,r,s){const a=n(e),l=o(e);if(!Number.isFinite(a)||!Number.isFinite(l))return null;const c={type:"point",x:t.x(a),y:t.y(l),r:i,style:r,datum:e};return void 0!==s&&(c.pointId=s),c}function H(e,t,n,o,i,r,s,a){const l=n(e),c=o(e);if(!Number.isFinite(l)||!Number.isFinite(c))return null;const u={type:"symbol",x:t.x(l),y:t.y(c),size:i,symbolType:r,style:s,datum:e};return void 0!==a&&(u.pointId=a),u}function W(e,t,n,o,i,r,s){return{type:"rect",x:e,y:t,w:n,h:o,style:i,datum:r,group:s}}function z(e,t,n,o,i,r,s){const a={type:"heatcell",x:e,y:t,w:n,h:o,fill:i,datum:r};return(null==s?void 0:s.showValues)&&(a.showValues=!0,a.value=s.value,s.valueFormat&&(a.valueFormat=s.valueFormat)),a}function Y(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function G(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function q(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function X(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}function V(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function U(e,t,n){const o=e=>e.toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function Q(e){const t=e.map(V),n=t.length-1;return e=>{if(0>=e){const[e,n,o]=t[0];return U(e,n,o)}if(e>=1){const[e,o,i]=t[n];return U(e,o,i)}const o=e*n,i=Math.floor(o),r=o-i,[s,a,l]=t[i],[c,u,d]=t[i+1];return U(Math.round(s+(c-s)*r),Math.round(a+(u-a)*r),Math.round(l+(d-l)*r))}}const K=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Z=Q(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),J=Q(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),ee=Q(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),te=Q(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),ne=Q(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),oe=Q(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),ie=Q(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),re=Q(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),se=Q(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),ae=Q(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),le=Q(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),ce=Q(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]),ue={blues:Z,reds:J,greens:ee,viridis:ie,oranges:te,purples:ne,greys:oe,plasma:re,inferno:se,magma:ae,cividis:le,turbo:ce};function de(e){return e&&ue[e]||Z}const he=Q(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),ge=Q(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),fe=Q(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),pe=Q(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),ye=Q(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),me=Q(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),ve=Q(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]),be=Object.assign({category10:K,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"]},ue),xe=K,ke=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],we=["#f0f0f0","#b5d4ea","#f4c2a1","#b8dab2","#d4b5e0","#f9e0a2","#a8d8d8"],Ae=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 je(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")||Ae.has(t)}(o)?n(o):o}const o=(null==e?void 0:e[t])+"";return n?n(o):xe[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))%xe.length]}function Se(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+""))),r=o.every(e=>!isNaN(Number(e)));if(Array.isArray(n))return i.scaleOrdinal().domain(o).range(n).unknown("#999");const s=be[n]||be.category10;if(r&&"function"==typeof s){let e=-1/0;for(const t of o){const n=Number(t);n>e&&(e=n)}return t=>s(Number(t)/e)}{const e=Array.isArray(s)?s:xe;return i.scaleOrdinal().domain(o).range(e).unknown("#999")}}function Oe(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,s]=o,[a,l]=n;if(s===r)return(a+l)/2;let c=(i-r)/(s-r);return 0>c?c=0:c>1&&(c=1),a+c*(l-a)}function Me(e,t,n){var o,i,r;if(1>=n)return 1;const s=null!==(o=e.minOpacity)&&void 0!==o?o:.1,a=n-1-t;switch(e.type){case"linear":return s+(1-a/(n-1))*(1-s);case"exponential":{const t=null!==(i=e.halfLife)&&void 0!==i?i:n/2;return s+Math.pow(.5,a/t)*(1-s)}case"step":return(null!==(r=e.stepThreshold)&&void 0!==r?r:.5*n)>a?1:s;default:return 1}}function Ce(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 _e(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}function Pe(e,t){return Math.min((e-t.startTime)/t.duration,1)}function Le(e,t,n){return e+(t-e)*n}function Te(){return"undefined"!=typeof performance?performance.now():Date.now()}function Re(e,t,n){var o,i,r,s;if(t._transitionKey)return t._transitionKey;switch(t.type){case"point":if(t.pointId)return"p:"+t.pointId;if("streaming"===e.runtimeMode&&t.datum){const 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!==(s=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!==s?s: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 $e(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 Ne(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 s=o.getTop(n),a=o.getBottom(n);if(!Number.isFinite(s)||!Number.isFinite(a))continue;const l=e.scales.x(t),c=e.scales.y(s),u=e.scales.y(a);Number.isFinite(l)&&Number.isFinite(c)&&Number.isFinite(u)&&(i.push([l,c]),r.push([l,u]))}return 2>i.length?null:{type:"area",topPath:i,bottomPath:r,style:$e(e,o,n,t[0]),datum:t,group:n,interactive:o.interactive}}function Ee(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 Be(e,t,n){const o=[];for(const i of n){const n=Ne(e,t,"__ribbon_aggregate",i);n&&o.push(n)}return o}function De(e,t,n,o){const i=[];for(const r of o){const o=Ne(e,t,n,r);o&&i.push(o)}return i}function Ie(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 Fe(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 s of o.data){let o=e.config.pointStyle(s);!o.fill&&t&&(o=Object.assign(Object.assign({},o),{fill:t}));const a=null!==(i=o.r)&&void 0!==i?i:3,l=e.getPointId?e.getPointId(s)+"":void 0,c=F(s,e.scales,e.getX,r,a,o,l);c&&n.push(c)}}}const He={topOpacity:.8,bottomOpacity:.05};function We(e){var t,n;if(e)return!0===e?He:"colorStops"in e?e:{topOpacity:null!==(t=e.topOpacity)&&void 0!==t?t:He.topOpacity,bottomOpacity:null!==(n=e.bottomOpacity)&&void 0!==n?n:He.bottomOpacity}}const ze={circle:s.symbolCircle,square:s.symbolSquare,triangle:s.symbolTriangle,diamond:s.symbolDiamond,star:s.symbolStar,cross:s.symbolCross,wye:s.symbolWye},Ye=["circle","triangle","diamond","star","square","chevron","cross","wye"];function Ge(e,t,n){var o,i;if(n)return n;const r=null!=e?e:"circle";if("chevron"===r)return function(e){const t=1.5*qe(e),n=.92*t;return`M0,${-t}L${n},${(.78*t).toFixed(3)}L0,${(.28*t).toFixed(3)}L${-n},${(.78*t).toFixed(3)}Z`}(t);const a=null!==(o=ze[r])&&void 0!==o?o:s.symbolCircle;return null!==(i=s.symbol(a,Math.max(1,t))())&&void 0!==i?i:""}function qe(e){return Math.sqrt(Math.max(1,e)/Math.PI)}const Xe=new Map;function Ve(e){if("production"===process.env.NODE_ENV)return;const{label:t,nodes:n,overlays:o,warned:i}=e;Ue(o)&&0===n.length&&Qe(i,"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.`),n.length>0&&n.every(e=>null==e.datum)&&Qe(i,"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 Ue(e){return null!=e&&!1!==e&&""!==e&&(!Array.isArray(e)||e.some(Ue))}function Qe(e,t,n){e.has(t)||(e.add(t),console.warn(n))}function Ke(e,t){const n="function"==typeof e?e:n=>n[e||t];return e=>{const t=n(e);return null==t?NaN:+t}}function Ze(e){const t=[],n=["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode,o=Ke(n&&e.valueAccessor||e.yAccessor,n?"value":"y");if(e.boundsAccessor){const n=G(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:Ke(e.y1Accessor,"y1"),getBottom:Ke(e.y0Accessor,"y0"),style:e.style,perSeries:!1!==e.perSeries,interactive:!0===e.interactive})}return t}class Je{constructor(e){if(this.xExtent=new N,this.yExtent=new N,this.resolvedRibbons=[],this.timestampBuffer=null,this.activeTransition=null,this._hasRenderedOnce=!1,this.prevPositionMap=new Map,this.prevPathMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this._colorMapCache=null,this._groupDataCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this._ingestVersion=0,this._bufferArrayCache=null,this._bufferDirty=!0,this.needsFullRebuild=!0,this.lastLayout=null,this.scales=null,this.scene=[],this.version=0,this.customLayoutOverlays=null,this._customLayoutDiagnosticsWarned=new Set,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.xIsDate=!1,this._quadtree=null,this._maxPointRadius=0,this._lastBoundedInsertsRef=null,this.config=e,this.buffer=new $(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=G(e.timeAccessor||e.xAccessor,"time"),this.getY=G(e.valueAccessor||e.yAccessor,"value")):(this.getX=G(e.xAccessor,"x"),this.getY=G(e.yAccessor,"y")),this.getGroup=X(e.groupAccessor),this.getCategory=X(e.categoryAccessor),this.getSize=e.sizeAccessor?G(e.sizeAccessor,"size"):void 0,this.getColor=X(e.colorAccessor),this.getSymbol=X(e.symbolAccessor),this.getY0=e.y0Accessor?G(e.y0Accessor,"y0"):void 0,this.resolvedRibbons=Ze(e),this.getPointId=X(e.pointIdAccessor),"candlestick"===e.chartType){const t=null!=e.openAccessor,n=null!=e.closeAccessor;this.getOpen=t?G(e.openAccessor,"open"):void 0,this.getHigh=G(e.highAccessor,"high"),this.getLow=G(e.lowAccessor,"low"),this.getClose=n?G(e.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!t&&!n}e.pulse&&(this.timestampBuffer=new $(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?G(this.config.timeAccessor||this.config.xAccessor,"time"):G(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,r,s,a,l,c,u,d,h,g,f,p;const{config:y,buffer:m}=this;if(!this.needsFullRebuild&&!y.customLayout&&this.lastLayout&&this.scene.length>0&&this.scales&&0>=(null!==(t=this.config.scalePadding)&&void 0!==t?t:0)&&(this.lastLayout.width!==e.width||this.lastLayout.height!==e.height))return void this.remapScene(e);this.xExtent.dirty&&this.xExtent.recalculate(m,this.getX),this.yExtent.dirty&&this.rebuildYExtent();const v=this.getBufferArray(),b=this.xExtent.extent,x=this.yExtent.extent;let k=y.xExtent?[null!==(n=y.xExtent[0])&&void 0!==n?n:b[0],null!==(o=y.xExtent[1])&&void 0!==o?o:b[1]]:b,w=y.yExtent?[null!==(r=y.yExtent[0])&&void 0!==r?r:x[0],null!==(s=y.yExtent[1])&&void 0!==s?s:x[1]]:x;const A=y.yExtent&&null!=y.yExtent[0]&&null!=y.yExtent[1],j="exact"===y.axisExtent;if("stackedarea"===y.chartType&&!A&&m.size>0)if(y.normalize)w=[0,j?1:1+y.extentPadding];else{const e=`${m.size}:${this._ingestVersion}:${null!==(a=y.baseline)&&void 0!==a?a:"zero"}:${null!==(l=y.stackOrder)&&void 0!==l?l:"key"}`;if(this._stackExtentCache&&this._stackExtentCache.key===e)w=this._stackExtentCache.yDomain;else{const t=this.groupData(v),n=new Map,o=new Set;let i=0;const r=new Map,s=new Map;for(const e of t){const t=new Map;let a=0;for(const n of e.data){const e=this.getX(n),s=this.getY(n);if(!Number.isFinite(e)||!Number.isFinite(s))continue;t.set(e,(t.get(e)||0)+s),o.add(e),a+=s;const l=(r.get(e)||0)+s;r.set(e,l),l>i&&(i=l)}n.set(e.key,t),s.set(e.key,a)}const a=null!==(c=y.stackOrder)&&void 0!==c?c:"key",l=(e,t)=>t>e?-1:e>t?1:0;let f;if("insideOut"===a){const e=[...t].map(e=>e.key).sort((e,t)=>{var n,o;const i=(null!==(n=s.get(t))&&void 0!==n?n:0)-(null!==(o=s.get(e))&&void 0!==o?o:0);return 0!==i?i:l(e,t)}),n=[],o=[];let i=0,r=0;for(const t of e)r>i?(n.push(t),i+=null!==(u=s.get(t))&&void 0!==u?u:0):(o.push(t),r+=null!==(d=s.get(t))&&void 0!==d?d:0);f=[...o.reverse(),...n]}else f="asc"===a?t.map(e=>e.key).sort((e,t)=>{var n,o;const i=(null!==(n=s.get(e))&&void 0!==n?n:0)-(null!==(o=s.get(t))&&void 0!==o?o:0);return 0!==i?i:l(e,t)}):"desc"===a?t.map(e=>e.key).sort((e,t)=>{var n,o;const i=(null!==(n=s.get(t))&&void 0!==n?n:0)-(null!==(o=s.get(e))&&void 0!==o?o:0);return 0!==i?i:l(e,t)}):t.map(e=>e.key).sort(l);if("wiggle"===y.baseline||"silhouette"===y.baseline){const e=Array.from(o).sort((e,t)=>e-t),t=I(e,f,(e,t)=>{var o;return(null===(o=n.get(e))||void 0===o?void 0:o.get(t))||0},y.baseline);let i=1/0,s=-1/0;for(const n of e){const e=null!==(h=t.get(n))&&void 0!==h?h:0,o=null!==(g=r.get(n))&&void 0!==g?g:0;i>e&&(i=e),e+o>s&&(s=e+o)}Number.isFinite(i)&&Number.isFinite(s)||(i=0,s=0);const a=s-i,l=j?0:a>0?a*y.extentPadding:1;w=[i-l,s+l]}else w=[0,i+(j?0:i>0?i*y.extentPadding:1)];this._stackExtentCache={key:e,yDomain:w}}}else if("bar"===y.chartType&&y.binSize&&!A&&m.size>0){const[,e]=function(e,t,n,o,i){const r=E(e,t,n,o,i);if(0===r.size)return[0,0];let s=0;for(const e of r.values())e.total>s&&(s=e.total);return[0,s]}(m,this.getX,this.getY,y.binSize,this.getCategory);w=[0,j?e:e+e*y.extentPadding]}else if("waterfall"===y.chartType&&!A&&m.size>0){const[e,t]=function(e,t){let 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]}(m,this.getY),n=t-e,o=j?0:n>0?n*y.extentPadding:1;w=[Math.min(0,e-Math.abs(o)),Math.max(0,t+Math.abs(o))]}else if(!A&&w[0]!==1/0){if(this.resolvedRibbons.length>0)for(const e of v)for(const t of this.resolvedRibbons){const n=t.getTop(e),o=t.getBottom(e);Number.isFinite(n)&&(w[0]>n&&(w[0]=n),n>w[1]&&(w[1]=n)),Number.isFinite(o)&&(w[0]>o&&(w[0]=o),o>w[1]&&(w[1]=o))}const e=w[1]-w[0],t=j?0:e>0?e*y.extentPadding:1,n=null===(f=y.yExtent)||void 0===f?void 0:f[0],o=null===(p=y.yExtent)||void 0===p?void 0:p[1];w=[null!=n?w[0]:w[0]-t,null!=o?w[1]:w[1]+t],"log"!==y.yScaleType||w[0]>0||0>=x[0]||j||(w[0]=null!=n?w[0]:x[0]/(1+y.extentPadding))}if(y.yExtent&&!A){const e=y.yExtent[0],t=y.yExtent[1];null==e&&null==t||(w=[null!=e?e:w[0],null!=t?t:w[1]])}if(k[0]===1/0||k[1]===-1/0)if("time"===y.xScaleType){const e=Date.now();k=[e-864e5,e]}else k=[0,1];w[0]!==1/0&&w[1]!==-1/0||(w=[0,1]);const S="streaming"===y.runtimeMode,O=Math.max(0,Math.min(y.scalePadding||0,Math.min(e.width,e.height)/2-1));if(S)if("x"==("up"===(M=y.arrowOfTime)||"down"===M?"y":"x")){const t="right"===y.arrowOfTime?[O,e.width-O]:[e.width-O,O];this.scales={x:i.scaleLinear().domain(k).range(t),y:i.scaleLinear().domain(w).range([e.height-O,O])}}else{const t="down"===y.arrowOfTime?[O,e.height-O]:[e.height-O,O];this.scales={x:i.scaleLinear().domain(w).range([O,e.width-O]),y:i.scaleLinear().domain(k).range(t)}}else{const t=(e,t,n)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return i.scaleLog().domain(e).range(n).clamp(!0)}return"time"===e?i.scaleTime().domain([new Date(t[0]),new Date(t[1])]).range(n):i.scaleLinear().domain(t).range(n)};this.scales={x:t(y.xScaleType,k,[O,e.width-O]),y:t(y.yScaleType,w,[e.height-O,O])}}var M;this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(e,v),this.config.decay&&this.applyDecay(this.scene,v),this.config.pulse&&this.applyPulse(this.scene,v),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&(this.prevPositionMap.size>0||this.prevPathMap.size>0)&&this.startTransition(),this.rebuildQuadtree(),this.needsFullRebuild=!1,this.lastLayout={width:e.width,height:e.height},this.version++}rebuildQuadtree(){const e=this.config.chartType;if("scatter"!==e&&"bubble"!==e)return this._quadtree=null,void(this._maxPointRadius=0);let t=0,n=0;for(const e of this.scene)"point"===e.type&&(t++,e.r>n&&(n=e.r));if(this._maxPointRadius=n,Je.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=r.quadtree().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(),r=this.scales.y.domain(),s=this.scales.x.range(),a=this.scales.y.range(),l=(e,t,n)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return i.scaleLog().domain(e).range(n).clamp(!0)}return"time"===e?i.scaleTime().domain([new Date(t[0]),new Date(t[1])]).range(n):i.scaleLinear().domain(t).range(n)},c=Math.max(0,Math.min(this.config.scalePadding||0,Math.min(e.width,e.height)/2-1)),u=a[1]>a[0];this.scales={x:l(this.config.xScaleType,o,s[0]>s[1]?[e.width-c,c]:[c,e.width-c]),y:l(this.config.yScaleType,r,u?[c,e.height-c]:[e.height-c,c])},this.lastLayout={width:e.width,height:e.height},this.rebuildQuadtree(),this.version++}buildSceneNodes(e,t){var n,o,i,r,s,a,l,c,u;const{config:d,scales:h}=this;if(!h)return[];if(d.customLayout){const u=null!==(n=d.layoutMargin)&&void 0!==n?n:{top:0,right:0,bottom:0,left:0},g={data:t,scales:h,dimensions:{width:e.width,height:e.height,margin:u,plot:{x:0,y:0,width:e.width,height:e.height}},theme:{semantic:null!==(o=d.themeSemantic)&&void 0!==o?o:{},categorical:null!==(i=d.themeCategorical)&&void 0!==i?i:ke},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=d.themeSemantic)||void 0===n?void 0:n.primary)&&void 0!==o?o:"#4e79a7"},config:null!==(r=d.layoutConfig)&&void 0!==r?r:{},selection:null!==(s=d.layoutSelection)&&void 0!==s?s:null};let f;try{f=d.customLayout(g)}catch(e){return"production"!==process.env.NODE_ENV&&console.error("[semiotic] customLayout threw:",e),this.customLayoutOverlays=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,[]}this.customLayoutOverlays=null!==(a=f.overlays)&&void 0!==a?a:null;const p=null!==(l=f.nodes)&&void 0!==l?l:[];if(this._customRestyle=f.restyle,this.hasCustomRestyle=!!f.restyle,this.hasCustomRestyle){this._baseStyles=new WeakMap;for(const e of p)e.style&&this._baseStyles.set(e,e.style);this.applyCustomRestyle(p,null!==(c=d.layoutSelection)&&void 0!==c?c:null)}return Ve({label:"customLayout",nodes:p,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned}),p}if(this.customLayoutOverlays=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,0===t.length)return[];const g={scales:h,config:d,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(d.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}=Ee(e.ribbons);if(r.length>0&&i.push(...Be(e,t,r)),n.length>0)for(const t of o)i.push(...De(e,t.data,t.key,n))}for(const t of o){const n=e.resolveLineStyle(t.key,t.data[0]),o=B(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 Fe(e,o,i),i}(g,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}=Ee(e.ribbons);if(r.length>0&&o.push(...Be(e,t,r)),i.length>0)for(const t of n)o.push(...De(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]),s=D(t.data,e.scales,e.getX,e.getY,i,n,t.key,r),a=We(e.config.gradientFill);a&&(s.fillGradient=a),e.config.curve&&"linear"!==e.config.curve&&(s.curve=e.config.curve),e.config.lineGradient&&(s.strokeGradient=e.config.lineGradient),o.push(s)}return Fe(e,n,o),o}(g,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}=Ee(e.ribbons);if(r.length>0&&o.push(...Be(e,t,r)),i.length>0)for(const t of n)o.push(...De(e,t.data,t.key,i))}const r=e.scales.y.domain()[0],s=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=D(t.data,e.scales,e.getX,e.getY,r,n,t.key,s),a=We(e.config.gradientFill);a&&(i.fillGradient=a),e.config.curve&&"linear"!==e.config.curve&&(i.curve=e.config.curve),e.config.lineGradient&&(i.strokeGradient=e.config.lineGradient),o.push(i)}else{const n=e.resolveLineStyle(t.key,t.data[0]),i=B(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 Fe(e,n,o),o}(g,t);case"stackedarea":return function(e,t){var n,o,i,r;const s=e.groupData(t),a=null!==(n=e.config.stackOrder)&&void 0!==n?n:"key",l=()=>s.sort((e,t)=>t.key>e.key?-1:e.key>t.key?1:0);if("key"===a)l();else if("asc"===a||"desc"===a||"insideOut"===a){const t=new Map;for(const n of s){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"===a)s.sort((e,o)=>{var i,r;const s=(null!==(i=t.get(e.key))&&void 0!==i?i:0)-(null!==(r=t.get(o.key))&&void 0!==r?r:0);return 0!==s?s:n(e.key,o.key)});else if("desc"===a)s.sort((e,o)=>{var i,r;const s=(null!==(i=t.get(o.key))&&void 0!==i?i:0)-(null!==(r=t.get(e.key))&&void 0!==r?r:0);return 0!==s?s:n(e.key,o.key)});else{const e=[...s].sort((e,o)=>{var i,r;const s=(null!==(i=t.get(o.key))&&void 0!==i?i:0)-(null!==(r=t.get(e.key))&&void 0!==r?r:0);return 0!==s?s:n(e.key,o.key)}),r=[],a=[];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):(a.push(n),c+=null!==(i=t.get(n.key))&&void 0!==i?i:0);s.length=0,s.push(...a.reverse(),...r)}}else l();const c=e.config.curve&&"linear"!==e.config.curve?e.config.curve:void 0,u=e.config.normalize?"zero":null!==(r=e.config.baseline)&&void 0!==r?r:"zero",{nodes:d,stackedTops:h}=function(e,t,n,o,i,r,s,a="zero"){var l,c;const u=new Set;for(const t of e)for(const e of t.data){const t=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=I(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},a),p=[],y=new Map,m=new Map;for(const e of d)m.set(e,null!==(c=f.get(e))&&void 0!==c?c:0);for(const n of e){const e=h.get(n.key),o=[],a=[],l=new Map;for(const n of d){let i=e.get(n)||0;const s=m.get(n);r&&(i/=g.get(n));const c=s+i,u=t.x(n);a.push([u,t.y(s)]),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:a,style:i(n.key,n.data[0]),datum:n.data,group:n.key};s&&(c.curve=s),p.push(c)}return{nodes:p,stackedTops:y}}(s,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 s){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)};Fe(e,s,g,n)}return g}(g,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 s=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);s=n=>e===t?(r[0]+r[1])/2:r[0]+(n-e)/(t-e)*(r[1]-r[0])}}const a=e.getColor?e.resolveColorMap(t):null,l=(null===(n=e.config.themeSemantic)||void 0===n?void 0:n.primary)||"#4e79a7",c=e.getSymbol,u=e.config.symbolMap,d=new Map;let h=0;const g=e=>{const t=null==u?void 0:u[e];if(t)return t;let n=d.get(e);return n||(n=Ye[h%Ye.length],h++,d.set(e,n)),n};for(const n of t){let t=e.config.pointStyle?e.config.pointStyle(n):{fill:l,opacity:.8},r=t.r||i;if(s&&e.getSize){const t=e.getSize(n);null==t||Number.isNaN(t)||(r=s(t))}if(a&&e.getColor&&!t.fill){const o=e.getColor(n);o&&a.has(o)&&(t=Object.assign(Object.assign({},t),{fill:a.get(o)}))}const u=e.getPointId?e.getPointId(n)+"":void 0;if(c){const i=g(c(n)+""),s=H(n,e.scales,e.getX,e.getY,Math.PI*r*r,i,t,u);s&&o.push(s)}else{const i=F(n,e.scales,e.getX,e.getY,r,t,u);i&&o.push(i)}}return o}(g,t);case"heatmap":return function(e,t,n){if(e.config.heatmapAggregation)return function(e,t,n){var o,i,r;const s=Math.max(1,Math.floor(null!==(o=e.config.heatmapXBins)&&void 0!==o?o:20)),a=Math.max(1,Math.floor(null!==(i=e.config.heatmapYBins)&&void 0!==i?i:20)),l=null!==(r=e.config.heatmapAggregation)&&void 0!==r?r:"count",c=G(e.config.valueAccessor,"value");if(!e.scales||0===t.length)return[];const[u,d]=e.scales.x.domain(),[h,g]=e.scales.y.domain(),f=(d-u||1)/s,p=(g-h||1)/a,y=s*a;if(y>1e6)return[];const m=new Int32Array(y),v=new Float64Array(y);for(let 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),s-1),d=Math.min(Math.floor((r-h)/p),a-1);if(0>l||0>d)continue;const g=d*s+l;m[g]++;const y=c(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/s,A=n.height/a,j=e.config.showValues,S=e.config.heatmapValueFormat,O=[];for(let e=0;a>e;e++){const t=e*s;for(let n=0;s>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;O.push(z(n*w,(a-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},j?{value:i,showValues:!0,valueFormat:S}:void 0))}}return O}(e,t,n);if(0===t.length)return[];const o=G(e.config.valueAccessor,"value"),i=q(e.config.xAccessor,"x"),r=q(e.config.yAccessor,"y"),s=new Map,a=new Map,l=Array(t.length),c=Array(t.length);for(let e=0;t.length>e;e++){const n=t[e],o=i(n),u=r(n);l[e]=o,c[e]=u,s.has(o)||s.set(o,s.size),a.has(u)||a.set(u,a.size)}const u=s.size,d=a.size;if(0===u||0===d)return[];const h=Array.from(s.keys()),g=Array.from(a.keys()),f=h.every(e=>"number"==typeof e&&!isNaN(e)),p=g.every(e=>"number"==typeof e&&!isNaN(e));if(f){h.sort((e,t)=>e-t),s.clear();for(let e=0;h.length>e;e++)s.set(h[e],e)}if(p){g.sort((e,t)=>e-t),a.clear();for(let e=0;g.length>e;e++)a.set(g[e],e)}const y=new Float64Array(t.length),m=new Float64Array(t.length),v=Array(t.length),b=new Map;let x=0;for(let e=0;t.length>e;e++){const n=t[e],i=s.get(l[e]),r=a.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 ue?e:"blues";let n=Xe.get(t);if(n)return n;n=Array(256);const o=de(t);for(let e=0;256>e;e++)n[e]=o(e/255);return Xe.set(t,n),n}("string"==typeof e.config.colorScheme?e.config.colorScheme:e.config.themeSequential||"blues"),j=255/(w-k||1),S=n.width/u,O=n.height/d,M=e.config.showValues,C=e.config.heatmapValueFormat,_=[];for(let e=0;x>e;e++){const t=m[e];if(!isFinite(t))continue;const n=y[e],o=n%u;_.push(z(o*S,(d-1-(n-o)/u)*O,S,O,A[Math.min((t-k)*j+.5|0,255)],v[e],M?{value:t,showValues:!0,valueFormat:C}:void 0))}return _}(g,t,e);case"bar":{const e=function(e,t){var n,o;if(!e.config.binSize)return{nodes:[],binBoundaries:[]};const i=E(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),s=Array.from(t).filter(e=>!o.has(e)).sort(),a=n.filter(e=>t.has(e)),l=a.join("\0")+""+s.join("\0");e.barCategoryCache&&e.barCategoryCache.key===l?r=e.barCategoryCache.order:(r=[...a,...s],e.barCategoryCache={key:l,order:r})}const s=[],a=e.scales,[l,c]=a.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=a.x(n),p=a.x(i),y=Math.abs(p-h),m=y>g+1?g:0,v=Math.min(h,p)+m/2,b=Math.max(y-m,1);if(b>0)if(r&&t.categories.size>0){let n=0;for(const i of r){const r=t.categories.get(i)||0;if(0===r)continue;const l=a.y(n),c=a.y(n+r),h=(null===(o=e.config.barColors)||void 0===o?void 0:o[i])||(null==u?void 0:u.fill)||d||"#4e79a7";s.push(W(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=a.y(0),n=a.y(t.total);s.push(W(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:s,binBoundaries:Array.from(p).sort((e,t)=>e-t)}}(g,t);return this._barCategoryCache=null!==(u=g.barCategoryCache)&&void 0!==u?u:null,this._binBoundaries=e.binBoundaries,e.nodes}case"swarm":return function(e,t){var n,o,i,r,s,a;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!==(s=c.opacity)&&void 0!==s?s:.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 s=d;if(e.getCategory){const t=e.getCategory(n);s=(null===(a=e.config.barColors)||void 0===a?void 0:a[t])||s}const c={type:"point",x:i,y:r,r:u,style:{fill:s,opacity:h,stroke:g,strokeWidth:f},datum:n};e.getPointId&&(c.pointId=e.getPointId(n)+""),l.push(c)}return l}(g,t);case"waterfall":return function(e,t,n){var o,i,r,s,a,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!==(s=null==h?void 0:h.negativeColor)&&void 0!==s?s:null===(a=e.config.themeSemantic)||void 0===a?void 0:a.danger)&&void 0!==l?l:"#dc3545",y=null!==(c=null==h?void 0:h.gap)&&void 0!==c?c:1,m=null==h?void 0:h.stroke,v=null==h?void 0:h.strokeWidth,b=null==h?void 0:h.opacity;let x=0;for(let t=0;g.length>t;t++){const o=g[t],i=e.getX(o),r=e.getY(o),s=x+r;let a;a=g.length-1>t?e.getX(g[t+1])-i:t>0?i-e.getX(g[t-1]):0;const l=d.x(i),c=0!==a?d.x(i+a):l+n.width/10,k=Math.min(l,c)+y/2,w=Math.max(l,c)-y/2-k;if(0>=w){x=s;continue}const A=d.y(x),j=d.y(s),S=Math.min(A,j),O=Math.abs(A-j),M={fill:0>r?p:f,stroke:m,strokeWidth:v};null!=b&&(M.opacity=b),u.push(W(k,S,w,O,M,Object.assign(Object.assign({},o),{baseline:x,cumEnd:s,delta:r,_connectorStroke:null==h?void 0:h.connectorStroke,_connectorWidth:null==h?void 0:h.connectorWidth}))),x=s}return u}(g,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=[],s=e.config.candlestickStyle||{},a=s.rangeColor||"#6366f1",l=i?a:s.upColor||"#28a745",c=i?a:s.downColor||"#dc3545",u=i?a:s.wickColor||"#333",d=s.wickWidth||(i?2:1),h=t.map(t=>e.getX(t)).filter(e=>null!=e&&!Number.isNaN(e)).sort((e,t)=>e-t);let g=null!==(o=s.bodyWidth)&&void 0!==o?o:0;if(null==s.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),s=e.getLow(n);if(null==o||Number.isNaN(o)||null==s||Number.isNaN(s))continue;const a=i?o:e.getOpen(n),h=i?s:e.getClose(n);if(!i&&[a,h].some(e=>null==e||Number.isNaN(e)))continue;const f=h>=a,p={type:"candlestick",x:e.scales.x(t),openY:e.scales.y(a),closeY:e.scales.y(h),highY:e.scales.y(o),lowY:e.scales.y(s),bodyWidth:g,upColor:l,downColor:c,wickColor:u,wickWidth:d,isUp:f,datum:n};i&&(p.isRange=!0),r.push(p)}return r}(g,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?Me(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 s=new Map;for(let e=0;n.length>e;e++)s.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 a=s.get(t[n]);null!=a?(o[n]=Me(e,a,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 a=!1;for(let n=0;t.length>n;n++){const o=s.get(t[n]);null!=o?(i[n]=Me(e,o,r),1>i[n]&&(a=!0)):i[n]=1}a&&(n._decayOpacities=i)}else{let i=1;for(const n of t){const t=s.get(n);if(null!=t){const n=Me(e,t,r);i>n&&(i=n)}}if(1>i){const e=Array(o);e.fill(i),n._decayOpacities=e}}continue}const t=s.get(n.datum);if(null==t)continue;const a=Me(e,t,r);if("heatcell"===n.type)n.style={opacity:a};else if("candlestick"===n.type)n._decayOpacity=a;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*a})}}}(this.config.decay,e,t)}applyPulse(e,t){this.config.pulse&&this.timestampBuffer&&function(e,t,n,o){var i,r;const s="undefined"!=typeof performance?performance.now():Date.now(),a=null!==(i=e.color)&&void 0!==i?i:"rgba(255,255,255,0.6)",l=null!==(r=e.glowRadius)&&void 0!==r?r:4,c=new Map;for(let e=0;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 a=Ce(e,r,s);a>i&&(i=a)}i>0&&(n._pulseIntensity=i,n._pulseColor=a);continue}const t=c.get(n.datum);if(null==t)continue;const i=o.get(t);if(null==i)continue;const r=Ce(e,i,s);r>0&&(n._pulseIntensity=r,n._pulseColor=a,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,s,a;n.clear(),o.clear();for(let l=0;t.length>l;l++){const c=t[l],u=Re(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===(s=c.style)||void 0===s?void 0:s.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===(a=c.style)||void 0===a?void 0:a.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=Re(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,s,a,l,c,u,d,h,g,f,p,y,m,v,b,x,k,w,A,j,S,O,M,C,_,P,L,T,R,$,N,E,B,D,I,F,H,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=Re(e,r,t);if(!P)continue;if(r._transitionKey=P,"line"===r.type||"area"===r.type){const e=i.get(P);if(e){if(U.add(P),"line"===r.type&&e.path&&e.path.length===r.path.length){r._targetPath=r.path.map(e=>[e[0],e[1]]),r._prevPath=e.path;for(let t=0;r.path.length>t;t++)r.path[t]=[e.path[t][0],e.path[t][1]];X=!0}else if("area"===r.type&&e.topPath&&e.bottomPath&&e.topPath.length===r.topPath.length&&e.bottomPath.length===r.bottomPath.length){r._targetTopPath=r.topPath.map(e=>[e[0],e[1]]),r._targetBottomPath=r.bottomPath.map(e=>[e[0],e[1]]),r._prevTopPath=e.topPath,r._prevBottomPath=e.bottomPath;for(let t=0;r.topPath.length>t;t++)r.topPath[t]=[e.topPath[t][0],e.topPath[t][1]];for(let t=0;r.bottomPath.length>t;t++)r.bottomPath[t]=[e.bottomPath[t][0],e.bottomPath[t][1]];X=!0}r._targetOpacity=null!==(s=r.style.opacity)&&void 0!==s?s:1,r._startOpacity=null!==(l=null!==(a=e.opacity)&&void 0!==a?a:r.style.opacity)&&void 0!==l?l:1}else r._targetOpacity=null!==(c=r.style.opacity)&&void 0!==c?c:1,r._startOpacity=0,r.style=Object.assign(Object.assign({},r.style),{opacity:0}),X=!0;continue}const L=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!==(j=null===(A=r.style)||void 0===A?void 0:A.opacity)&&void 0!==j?j:1,(L.x!==e.x||L.openY!==e.openY||L.closeY!==e.closeY||L.highY!==e.highY||L.lowY!==e.lowY)&&(r._targetX=e.x,r._targetOpenY=e.openY,r._targetCloseY=e.closeY,r._targetHighY=e.highY,r._targetLowY=e.lowY,r.x=L.x,r.openY=L.openY,r.closeY=null!==(S=L.closeY)&&void 0!==S?S:r.closeY,r.highY=null!==(O=L.highY)&&void 0!==O?O:r.highY,r.lowY=null!==(M=L.lowY)&&void 0!==M?M:r.lowY,X=!0)}else r._targetOpacity=null!==(_=null===(C=r.style)||void 0===C?void 0:C.opacity)&&void 0!==_?_:1,r.style=Object.assign(Object.assign({},r.style||{}),{opacity:0}),X=!0}for(const[e,t]of i)if(!U.has(e))if(e.startsWith("l:")&&t.path){const 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!==(R=t.opacity)&&void 0!==R?R: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!==($=t.w)&&void 0!==$?$:0,h:null!==(N=t.h)&&void 0!==N?N:0,style:{opacity:null!==(E=t.opacity)&&void 0!==E?E: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!==(B=t.w)&&void 0!==B?B:0,h:null!==(D=t.h)&&void 0!==D?D:0,fill:"#999",datum:null,style:{opacity:null!==(I=t.opacity)&&void 0!==I?I:1},_targetOpacity:0,_transitionKey:e};n.exitNodes.push(o)}else if(e.startsWith("c:")){const o=null!==(F=t.openY)&&void 0!==F?F:t.y,i={type:"candlestick",x:t.x,openY:o,closeY:null!==(H=t.closeY)&&void 0!==H?H: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:Te(),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,s,a,l,c;if(!n.activeTransition)return!1;const u=Pe(e,n.activeTransition),d=_e(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=Le(r,e._targetOpacity,d)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=Le(n.x,e._targetX,d),e.y=Le(n.y,e._targetY,d),void 0!==e._targetR&&void 0!==n.r&&(e.r=Le(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=Le(i,e._targetOpacity,d)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=Le(n.x,e._targetX,d),e.y=Le(n.y,e._targetY,d),void 0!==n.w&&(e.w=Le(n.w,e._targetW,d)),void 0!==n.h&&(e.h=Le(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!==(s=n.opacity)&&void 0!==s?s:1:0;e.style=Object.assign(Object.assign({},e.style||{}),{opacity:Le(i,e._targetOpacity,d)})}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=Le(n.x,e._targetX,d),e.y=Le(n.y,e._targetY,d),void 0!==n.w&&(e.w=Le(n.w,e._targetW,d)),void 0!==n.h&&(e.h=Le(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!==(a=n.opacity)&&void 0!==a?a:1:0;e.style=Object.assign(Object.assign({},e.style||{}),{opacity:Le(i,e._targetOpacity,d)})}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=Le(n.x,e._targetX,d),void 0!==n.openY&&(e.openY=Le(n.openY,e._targetOpenY,d)),void 0!==n.closeY&&(e.closeY=Le(n.closeY,e._targetCloseY,d)),void 0!==n.highY&&(e.highY=Le(n.highY,e._targetHighY,d)),void 0!==n.lowY&&(e.lowY=Le(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:Le(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]=Le(t[o][0],n[o][0],d),e.path[o][1]=Le(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:Le(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]=Le(t[n][0],o[n][0],d),e.topPath[n][1]=Le(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]=Le(n[t][0],i[t][0],d),e.bottomPath[t][1]=Le(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||ke,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 s=this.resolveGroupColor(e)||r||"#4e79a7";return{fill:s,fillOpacity:.7,stroke:s,strokeWidth:2}}resolveGroupColor(e){if(this._colorMapCache){const t=this._colorMapCache.map.get(e);if(t)return t}const t=this._groupColorMap.get(e);if(t)return t;const 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)||ke;if(0===n.length)return null;const o=n[this._groupColorCounter%n.length];if(this._groupColorCounter++,this._groupColorMap.set(e,o),this._groupColorMap.size>Je.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++,this.lastIngestTime="undefined"!=typeof performance?performance.now():Date.now(),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++,this.lastIngestTime="undefined"!=typeof performance?performance.now():Date.now(),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}setLayoutSelection(e){this.config.layoutSelection=e}applyCustomRestyle(e,t){var n,o;const i=this._customRestyle;if(i)for(const r of e){const e=null!==(o=null!==(n=this._baseStyles.get(r))&&void 0!==n?n:r.style)&&void 0!==o?o:{},s=i(r,t);r.style=s?Object.assign(Object.assign({},e),s):e}}restyleScene(e){this._customRestyle&&this.applyCustomRestyle(this.scene,e)}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 s=!1,a=!1;Object.assign(this.config,e);const l="chartType"in e&&e.chartType!==r.chartType||"runtimeMode"in e&&e.runtimeMode!==r.runtimeMode;if(l||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e){const c=l||!Y(null!==(t=e.xAccessor)&&void 0!==t?t:e.timeAccessor,null!==(n=r.xAccessor)&&void 0!==n?n:r.timeAccessor),u=l||!Y(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=G(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=G(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=G(this.config.xAccessor,"x"),this.getY=G(this.config.yAccessor,"y")),u&&this.resolvedRibbons.some(e=>"bounds"===e.kind)&&(this.resolvedRibbons=Ze(this.config)),s=!0,a=!0)}if("groupAccessor"in e&&!Y(e.groupAccessor,r.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?X(this.config.groupAccessor):void 0,s=!0),"categoryAccessor"in e&&!Y(e.categoryAccessor,r.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?X(this.config.categoryAccessor):void 0,s=!0),"sizeAccessor"in e&&!Y(e.sizeAccessor,r.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?G(this.config.sizeAccessor,"size"):void 0,s=!0),"symbolAccessor"in e&&!Y(e.symbolAccessor,r.symbolAccessor)&&(this.getSymbol=null!=this.config.symbolAccessor?X(this.config.symbolAccessor):void 0,s=!0),"colorAccessor"in e&&!Y(e.colorAccessor,r.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?X(this.config.colorAccessor):void 0,s=!0),"y0Accessor"in e&&!Y(e.y0Accessor,r.y0Accessor)&&(this.getY0=this.config.y0Accessor?G(this.config.y0Accessor,"y0"):void 0,s=!0,a=!0),("boundsAccessor"in e&&!Y(e.boundsAccessor,r.boundsAccessor)||"band"in e&&e.band!==r.band||"boundsStyle"in e&&e.boundsStyle!==r.boundsStyle)&&(this.resolvedRibbons=Ze(this.config),s=!0,a=!0),"pointIdAccessor"in e&&!Y(e.pointIdAccessor,r.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?X(this.config.pointIdAccessor):void 0,s=!0),"candlestick"===this.config.chartType&&(l||"openAccessor"in e&&!Y(e.openAccessor,r.openAccessor)||"closeAccessor"in e&&!Y(e.closeAccessor,r.closeAccessor)||"highAccessor"in e&&!Y(e.highAccessor,r.highAccessor)||"lowAccessor"in e&&!Y(e.lowAccessor,r.lowAccessor))){const e=null!=this.config.openAccessor,t=null!=this.config.closeAccessor;this.getOpen=e?G(this.config.openAccessor,"open"):void 0,this.getHigh=G(this.config.highAccessor,"high"),this.getLow=G(this.config.lowAccessor,"low"),this.getClose=t?G(this.config.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!e&&!t,s=!0,a=!0}if(!s){const t=Object.keys(e).filter(e=>!e.endsWith("Accessor")&&"timeAccessor"!==e&&"valueAccessor"!==e);for(const n of t)if(e[n]!==r[n]){s=!0;break}}s&&(a&&this.rebuildExtents(),this.needsFullRebuild=!0)}}function et(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:p.createElement(p.Fragment,null,...t)}Je.GROUP_COLOR_MAP_CAP=1e3,Je.QUADTREE_THRESHOLD=500;const tt={isActive:!1,predicate:()=>!0},nt=p.createContext(null);function ot({value:t,children:n}){return e.jsx(nt.Provider,{value:t,children:n})}function it(t,n){return null!=t?e.jsx(ot,{value:n,children:t}):t}function rt(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 st(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function at(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function lt(e,t){const n=at(e);if(!n)return!1;const o=at(t);return!o||n.getFullYear()!==o.getFullYear()||n.getMonth()!==o.getMonth()}function ct(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function ut(e,t,n,o,i,r=e=>e.x,s=e=>e.y,a=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=s(e)-n,u=Math.sqrt(l*l+c*c);st(a(e),o)>=u&&f>u&&(g=e,f=u),i=i.next}while(i)}return!1}),g?{node:g,distance:f}:null}const dt=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,ht=new WeakMap;let gt=0,ft=!1,pt=null,yt=null,mt=null;function vt(e,t){var n,o;if(!t)return t;const i=dt.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(ft)return;if("undefined"==typeof window||"undefined"==typeof document)return;ft=!0;const e=()=>{gt++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(pt=new MutationObserver(e),pt.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{yt=window.matchMedia("(prefers-color-scheme: dark)"),mt=e,"function"==typeof yt.addEventListener?yt.addEventListener("change",mt):"function"==typeof yt.addListener&&yt.addListener(mt)}catch(e){}}();let s=ht.get(r);s&&s.version===gt||(s={version:gt,map:new Map},ht.set(r,s));const a=s.map.get(t);if(void 0!==a)return a;const l=getComputedStyle(r).getPropertyValue(i[1]).trim()||(null===(o=i[2])||void 0===o?void 0:o.trim())||t;return s.map.set(t,l),l}function bt(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 xt(e){switch(e){case"monotoneX":return s.curveMonotoneX;case"monotoneY":return s.curveMonotoneY;case"cardinal":return s.curveCardinal;case"catmullRom":return s.curveCatmullRom;case"step":return s.curveStep;case"stepBefore":return s.curveStepBefore;case"stepAfter":return s.curveStepAfter;case"basis":return s.curveBasis;case"natural":return s.curveNatural;default:return null}}function kt(e,t,n){return null==t?n:"string"!=typeof t?t:vt(e,t)||n}function wt(e,t,n,o,i,r,s){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 a=e.createLinearGradient(o,i,r,s);for(const e of n)a.addColorStop(e.offset,e.color);return a}const{topOpacity:a,bottomOpacity:l}=t;if(!Number.isFinite(a)||!Number.isFinite(l))return null;const c=Math.max(0,Math.min(1,a)),u=Math.max(0,Math.min(1,l)),d=e.createLinearGradient(o,i,r,s),[h,g,f]=bt(e,n);return d.addColorStop(0,`rgba(${h},${g},${f},${c})`),d.addColorStop(1,`rgba(${h},${g},${f},${u})`),d}function At(e,t,n,o,i,r){const s=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>s.length)return null;const a=e.createLinearGradient(n,o,i,r);for(const e of s)a.addColorStop(e.offset,e.color);return a}const jt=new WeakMap;function St(e,t){const n=xt(t);if(!n)return e;const o=jt.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,s,a,l){if(!i)return i=[a,l],void o.push([a,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*a,h*h*h*u+3*h*h*d*t+3*h*d*d*s+d*d*d*l])}i=[a,l]},closePath(){},arc(){},rect(){},arcTo(){},quadraticCurveTo(e,t,n,r){i=[n,r],o.push([n,r])}};return s.line().x(e=>e[0]).y(e=>e[1]).curve(t).context(r)(e),o}(e,n);return jt.set(e,i),i}function Ot(e,t,n,o=30,i,r=0){let s=null;if(i){const e=ut(i,t,n,o,r);e&&(s={node:e.node,datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const r of e){let e=null;switch(r.type){case"point":if(i)break;e=Ct(r,t,n,o);break;case"symbol":e=_t(r,t,n,o);break;case"line":e=Pt(r,t,n,o);break;case"rect":if(null==r.datum)break;e=Tt(r,t,n);break;case"heatcell":e=Rt(r,t,n);break;case"area":if(!1===r.interactive)break;e=Nt(r,t,n);break;case"candlestick":e=$t(r,t,n)}e&&o>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}function Mt(e,t,n){if(0===e.length)return null;if(e[0][0]>t||t>e[e.length-1][0])return null;const o=Et(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[s,a]=e[i],[l,c]=e[r];return l===s?a:a+Math.max(0,Math.min(1,(t-s)/(l-s)))*(c-a)}function Ct(e,t,n,o=30){const i=t-e.x,r=n-e.y,s=Math.sqrt(i*i+r*r);return s>st(e.r,o)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:s}}function _t(e,t,n,o=30){const i=t-e.x,r=n-e.y,s=Math.sqrt(i*i+r*r);return s>st(qe(e.size),o)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:s}}function Pt(e,t,n,o=30){var i,r;if(0===e.path.length)return null;const s=Et(e.path,t);if(0>s)return null;const[a,l]=e.path[s];let c;if(e.path.length>1){let o=1/0;const i=Math.max(0,s-1),r=Math.min(e.path.length-2,s);for(let s=i;r>=s;s++){const[i,r]=e.path[s],[a,l]=e.path[s+1],c=Lt(t,n,i,r,a,l);o>c&&(o=c)}c=o}else{const e=t-a,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[s]?e.datum[s]:e.datum,x:a,y:l,distance:c}}function Lt(e,t,n,o,i,r){const s=i-n,a=r-o,l=s*s+a*a;if(0===l)return Math.sqrt(Math.pow(e-n,2)+Math.pow(t-o,2));let c=((e-n)*s+(t-o)*a)/l;c=Math.max(0,Math.min(1,c));const u=o+c*a;return Math.sqrt(Math.pow(e-(n+c*s),2)+Math.pow(t-u,2))}function Tt(e,t,n){const o=rt(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function Rt(e,t,n){const o=rt(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function $t(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,s=n-o;return{node:e,datum:e.datum,x:e.x,y:o,distance:Math.sqrt(r*r+s*s)}}return null}function Nt(e,t,n){if(0===e.topPath.length)return null;const o=Et(e.topPath,t);if(0>o)return null;const[i,r]=e.topPath[o],s=t-i,a=n-r,l=Math.sqrt(s*s+a*a);return{node:e,datum:Array.isArray(e.datum)&&e.datum[o]?e.datum[o]:e.datum,x:i,y:r,distance:l}}function Et(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 Bt(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 s=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&&s.set(t+"",e)}return{flat:r,groups:i,byGroup:o,idToIdx:s}}function Dt(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 It(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?Ft(n,n.groups[e+1],r[i]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?Ft(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 Ft(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 Ht(e){return"object"==typeof e&&null!==e&&"id"in e?e.id:e}function Wt(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}const zt={fresh:1,aging:.7,stale:.45,expired:.25},Yt={alpha:1,band:"fresh",isStale:!1};function Gt(e,t){var n,o;if(!e||0>=t)return Yt;const i=null!=e.threshold&&e.threshold>0?e.threshold:5e3,r=e.graded;if(r){const e="object"==typeof r?r:{},o=function(e,t,n={}){var o,i,r;if(!Number.isFinite(t)||0>=t)return"fresh";if(Number.isNaN(e))return"fresh";if(e===1/0)return"expired";if(0>e)return"fresh";const s=null!==(o=n.fresh)&&void 0!==o?o:1,a=null!==(i=n.aging)&&void 0!==i?i:1.5,l=null!==(r=n.stale)&&void 0!==r?r:3;return t*s>e?"fresh":t*a>e?"aging":t*l>e?"stale":"expired"}(t,i,e.thresholds);return{alpha:Object.assign(Object.assign({},zt),null!==(n=e.opacities)&&void 0!==n?n:{})[o],band:o,isStale:"fresh"!==o}}return t>i?{alpha:null!==(o=e.dimOpacity)&&void 0!==o?o:.5,band:"stale",isStale:!0}:Yt}function qt(e,n,o,i,r,s){const a=t.useRef("fresh");t.useEffect(()=>{if(!e)return;const t=setInterval(()=>{const t=n.current;if(!t||0===t.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=Gt(e,l-t.lastIngestTime);c.band===a.current&&c.isStale===r||(a.current=c.band,c.isStale!==r&&s(c.isStale),o.current=!0,i())},1e3);return()=>clearInterval(t)},[e,r,i])}function Xt({isStale:t,position:n}){return e.jsx("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 Vt={fill:(t,n)=>e.jsx("rect",{style:t,width:n,height:n}),line:(t,n)=>e.jsx("line",{style:t,x1:0,y1:0,x2:n,y2:n})};function Ut(e,t,n,o,i){let r;return r="function"==typeof n?n(e):(0,Vt[n])(o(e,t),i),r}function Qt({swatchSize:t}){return e.jsx("path",{d:`M${.25*t},${.55*t} L${.45*t},${.75*t} L${.8*t},${.3*t}`,fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function Kt(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const Zt=(t,n,o,i,r,s,a,l,c,u,d)=>{const{type:h="fill",styleFn:g,items:f}=t,p=[];let y=0;const m=!(!n&&!o),v="isolate"===u||void 0===u&&null!=r,{swatchSize:b,labelGap:x,rowHeight:k}=d;return f.forEach((t,u)=>{const d=Ut(t,u,h,g,b),w=Kt(t,i,r),A=r&&r.size>0&&r.has(t.label);p.push(e.jsxs("g",{transform:`translate(0,${y})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:m?l===s&&u===a?0:-1:void 0,role:m?"option":void 0,"aria-selected":m&&v?A||!1:void 0,"aria-current":m&&!v&&null!=i&&t.label===i||void 0,"aria-label":t.label,onKeyDown:m?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const t=(u+("ArrowDown"===e.key?1:-1)+f.length)%f.length;c(l,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:m?e=>{c(l,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:m?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:m?"pointer":"default",opacity:w,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[m&&e.jsx("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:b+x+2+7*t.label.length,height:b+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),d,A&&e.jsx(Qt,{swatchSize:b}),e.jsx("text",{y:b/2,x:b+x,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label})]},"legend-item-"+u)),y+=k}),p};function Jt({config:t,orientation:n="vertical",width:o=100}){const{colorFn:i,domain:r,label:s,format:a}=t,l=a||(e=>Math.round(100*e)/100+""),c="grad-legend-"+p.useId();if("horizontal"===n){const t=12,n=Math.min(o,200),a=Math.max(0,(o-n)/2),u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.jsx("stop",{offset:100*n+"%",stopColor:i(r[0]+n*(r[1]-r[0]))},t))}return e.jsxs("g",{"aria-label":s||"Gradient legend",children:[e.jsx("defs",{children:e.jsx("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:u})}),s&&e.jsx("text",{x:a+n/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:s}),e.jsx("rect",{x:a,y:0,width:n,height:t,fill:`url(#${c})`,rx:2}),e.jsx("text",{x:a,y:t+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(r[0])}),e.jsx("text",{x:a+n,y:t+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(r[1])})]})}const u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.jsx("stop",{offset:100*n+"%",stopColor:i(r[1]-n*(r[1]-r[0]))},t))}return e.jsxs("g",{"aria-label":s||"Gradient legend",children:[s&&e.jsx("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:s}),e.jsx("defs",{children:e.jsx("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:u})}),e.jsx("rect",{x:0,y:0,width:14,height:100,fill:`url(#${c})`,rx:2}),e.jsx("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(r[1])}),e.jsx("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(r[0])})]})}function en(t){const{legendGroups:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,legendInteraction:a,title:l="Legend",width:c=100,height:u=20,orientation:d="vertical",legendLayout:h}=t,g=function(e){var t,n,o,i,r;const s=Math.max(1,null!==(t=null==e?void 0:e.swatchSize)&&void 0!==t?t:16),a=Math.max(s,null!==(n=null==e?void 0:e.rowHeight)&&void 0!==n?n:22);return{swatchSize:s,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:a,align:"left"===(null==e?void 0:e.align)?"start":"right"===(null==e?void 0:e.align)?"end":null!==(r=null==e?void 0:e.align)&&void 0!==r?r:"start",maxWidth:null==e?void 0:e.maxWidth}}(h),[f,y]=p.useState(0),[m,v]=p.useState(0),b=p.useCallback((e,t)=>{y(e),v(t)},[]),x="vertical"===d?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u,metrics:d})=>{let h=24;const g=[];return t.forEach((t,f)=>{h+=5,g.push(e.jsx("line",{stroke:"gray",x1:0,y1:h,x2:n,y2:h},"legend-top-line legend-symbol-"+f)),h+=8,t.label&&(h+=16,g.push(e.jsx("text",{y:h,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label},"legend-text-"+f)),h+=8),g.push(e.jsx("g",{className:"legend-item",transform:`translate(0,${h})`,children:Zt(t,o,i,r,s,a,l,f,c,u,d)},"legend-group-"+f)),h+=t.items.length*d.rowHeight+8}),g})({legendGroups:n||[],width:c,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:f,focusedItemIndex:m,onFocusedIndexChange:b,legendInteraction:a,metrics:g}):(({legendGroups:t,height:n,width:o,customClickBehavior:i,customHoverBehavior:r,highlightedCategory:s,isolatedCategories:a,focusedGroupIndex:l,focusedItemIndex:c,onFocusedIndexChange:u,legendInteraction:d,metrics:h})=>{var g;let f=0;const p=[];t.forEach((t,n)=>{var g;let y=0;t.label&&(y+=16);const m=((t,n,o,i,r,s,a,l,c,u,d,h)=>{const{type:g="fill",styleFn:f,items:p}=t,y=[],{swatchSize:m,labelGap:v,itemGap:b,rowHeight:x,align:k}=d,w=!(!n&&!o),A="isolate"===u||void 0===u&&null!=r,j=p.map(e=>m+v+7*e.label.length),S=[];let O=0,M=0;j.forEach((e,t)=>{const n=0===M?e:M+b+e;h&&h>0&&M>0&&n>h?(S.push({start:O,end:t,width:M}),O=t,M=e):M=n}),p.length>0&&S.push({start:O,end:p.length,width:M}),S.forEach((t,u)=>{let d="center"===k?Math.max(0,((null!=h?h:t.width)-t.width)/2):"end"===k?Math.max(0,(null!=h?h:t.width)-t.width):0;for(let h=t.start;t.end>h;h++){const t=p[h],k=Ut(t,h,g,f,m),S=Kt(t,i,r),O=r&&r.size>0&&r.has(t.label);y.push(e.jsxs("g",{transform:`translate(${d},${u*x})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:w?l===s&&h===a?0:-1:void 0,role:w?"option":void 0,"aria-selected":w&&A?O||!1:void 0,"aria-current":w&&!A&&null!=i&&t.label===i||void 0,"aria-label":t.label,onKeyDown:w?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const t=(h+("ArrowRight"===e.key?1:-1)+p.length)%p.length;c(l,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:w?e=>{c(l,h),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.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:S,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[w&&e.jsx("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:m+v+2+7*t.label.length,height:m+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),k,O&&e.jsx(Qt,{swatchSize:m}),e.jsx("text",{y:m/2,x:m+v,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label})]},"legend-item-"+h)),d+=j[h]+b}});const C=Math.max(0,...S.map(e=>e.width)),_=S.length;return{items:y,offset:C,totalRows:_,totalHeight:_*x}})(t,i,r,s,a,l,c,n,u,d,h,null!==(g=h.maxWidth)&&void 0!==g?g:o);y+=m.offset+5,p.push(Object.assign(Object.assign({label:t.label},m),{offset:y,totalRows:m.totalRows,totalHeight:m.totalHeight})),f+=y+12});const y=null!==(g=h.maxWidth)&&void 0!==g?g:o;let m=f>y?0:"center"===h.align?Math.max(0,(y-f)/2):"end"===h.align?Math.max(0,y-f):0;const v=[];return p.forEach((o,i)=>{const r=t[i];r.label&&(v.push(e.jsx("text",{transform:`translate(${m},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:r.label},"legend-text-"+i)),m+=16),v.push(e.jsx("g",{className:"legend-item",transform:`translate(${m},0)`,children:o.items},"legend-group-"+i)),m+=o.offset+5,t[i+1]&&v.push(e.jsx("line",{stroke:"gray",x1:m,y1:-8,x2:m,y2:(o.totalHeight||n)+0+8},"legend-top-line legend-symbol-"+i)),m+=12}),e.jsx("g",{children:v})})({legendGroups:n||[],title:l,height:u,width:c,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:f,focusedItemIndex:m,onFocusedIndexChange:b,legendInteraction:a,metrics:g}),k=!(!o&&!i);return e.jsxs("g",{role:k?"listbox":void 0,"aria-multiselectable":!(!k||"isolate"!==a&&(void 0!==a||null==s))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==l&&""!==l&&"vertical"===d&&e.jsx("text",{className:"legend-title",y:16,x:c/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:l}),x]})}function tn(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function nn(e){return"object"==typeof e&&null!==e&&"gradient"in e}function on(t){var n;const{legend:o,totalWidth:i,totalHeight:r,margin:s,legendPosition:a="right",legendLayout:l,title:c,legendHoverBehavior:u,legendClickBehavior:d,legendHighlightedCategory:h,legendIsolatedCategories:g,legendInteraction:f}=t;if(!o)return null;const p="top"===a||"bottom"===a,y=!!c,m=Math.max(1,p?null!==(n=null==l?void 0:l.maxWidth)&&void 0!==n?n:Math.max(0,i-s.left-s.right):100);let v,b;return"left"===a?(v=Math.max(4,s.left-m-10),b=s.top):"top"===a?(v=s.left,b=y?32:8):"bottom"===a?(v=s.left,b=r-s.bottom+38):(v=i-s.right+10,b=s.top),e.jsx("g",{transform:`translate(${v}, ${b})`,children:nn(o)?e.jsx(Jt,{config:o.gradient,orientation:p?"horizontal":"vertical",width:m}):tn(o)?e.jsx(en,{legendGroups:o.legendGroups,title:"",width:m,orientation:p?"horizontal":"vertical",legendLayout:l,customHoverBehavior:u,customClickBehavior:d,highlightedCategory:h,isolatedCategories:g,legendInteraction:f}):o})}function rn(e){let t=1/0,n=-1/0;for(const o of e)t>o&&(t=o),o>n&&(n=o);return[t,n]}function sn(e,t=-1/0){let n=t;for(const t of e)t>n&&(n=t);return n}function an(e){return"string"==typeof e?{type:e}:e}function ln({orient:n,config:o,values:i,scale:r,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=t.useMemo(()=>{if(0===i.length)return null;const t=r.domain(),o=s-8;if("boxplot"===c.type){const t=function(e){const t=[...e].sort((e,t)=>e-t),n=t.length;if(0===n)return null;const o=t[Math.floor(.25*n)],i=t[Math.floor(.5*n)],r=t[Math.floor(.75*n)],s=r-o;return{q1:o,median:i,q3:r,whiskerLow:Math.max(t[0],o-1.5*s),whiskerHigh:Math.min(t[n-1],r+1.5*s)}}(i);if(!t)return null;const{q1:s,median:a,q3:l,whiskerLow:d,whiskerHigh:h}=t,g=Math.min(.5*o,20),f=(o-g)/2+4;if(u){const t=r(s),o=r(l),i=r(a),u=r(d),p=r(h),y="top"===n?-1:1,m=0;return e.jsxs("g",{"data-testid":"marginal-boxplot-"+n,children:[e.jsx("line",{x1:u,y1:m+y*(f+g/2),x2:p,y2:m+y*(f+g/2),stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:u,y1:m+y*f,x2:u,y2:m+y*(f+g),stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:p,y1:m+y*f,x2:p,y2:m+y*(f+g),stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("rect",{x:Math.min(t,o),y:"top"===n?m-f-g:m+f,width:Math.abs(o-t),height:g,fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:i,y1:"top"===n?m-f-g:m+f,x2:i,y2:"top"===n?m-f:m+f+g,stroke:c.fill,strokeWidth:2})]})}{const t=r(s),o=r(l),i=r(a),u=r(d),p=r(h),y="left"===n?-1:1,m=0;return e.jsxs("g",{"data-testid":"marginal-boxplot-"+n,children:[e.jsx("line",{x1:m+y*(f+g/2),y1:u,x2:m+y*(f+g/2),y2:p,stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:m+y*f,y1:u,x2:m+y*(f+g),y2:u,stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:m+y*f,y1:p,x2:m+y*(f+g),y2:p,stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("rect",{x:"left"===n?m-f-g:m+f,y:Math.min(t,o),width:g,height:Math.abs(o-t),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:"left"===n?m-f-g:m+f,y1:i,x2:"left"===n?m-f:m+f+g,y2:i,stroke:c.fill,strokeWidth:2})]})}}const d=a.bin().domain(t).thresholds(c.bins)(i);if(0===d.length)return null;const h=sn(d.map(e=>e.length));if(0===h)return null;if("histogram"===c.type)return e.jsx("g",{"data-testid":"marginal-histogram-"+n,children:d.map((t,i)=>{if(null==t.x0||null==t.x1)return null;const s=t.length/h*o;if(u){const o=r(t.x0),a=r(t.x1)-r(t.x0);return e.jsx("rect",{x:o,y:"top"===n?-4-s:4,width:Math.max(a,.5),height:s,fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},i)}{const o=r(t.x0),a=r(t.x1)-r(t.x0);return e.jsx("rect",{x:"left"===n?-4-s:4,y:Math.min(o,o+a),width:s,height:Math.abs(a),fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},i)}})});if("violin"===c.type){const t=o/2+4,i=[];for(const e of d){if(null==e.x0||null==e.x1)continue;const s=e.length/h*(o/2),a=r((e.x0+e.x1)/2);i.push(u?`${a},${"top"===n?-(t-s):t-s}`:`${"left"===n?-(t-s):t-s},${a}`)}for(let e=d.length-1;e>=0;e--){const s=d[e];if(null==s.x0||null==s.x1)continue;const a=s.length/h*(o/2),l=r((s.x0+s.x1)/2);i.push(u?`${l},${"top"===n?-(t+a):t+a}`:`${"left"===n?-(t+a):t+a},${l}`)}return e.jsx("g",{"data-testid":"marginal-violin-"+n,children:e.jsx("polygon",{points:i.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}if("ridgeline"===c.type){const t=[];if(u){const e=0,i=null!=d[0].x0?r(d[0].x0):0;t.push(`M${i},${e}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const i=e.length/h*o,s=r((e.x0+e.x1)/2);t.push(`L${s},${"top"===n?-i-4:i+4}`)}const s=null!=d[d.length-1].x1?r(d[d.length-1].x1):l;t.push(`L${s},${e}`),t.push("Z")}else{const e=0,i=null!=d[0].x0?r(d[0].x0):0;t.push(`M${e},${i}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const i=e.length/h*o,s=r((e.x0+e.x1)/2);t.push(`L${"left"===n?-i-4:i+4},${s}`)}const s=null!=d[d.length-1].x1?r(d[d.length-1].x1):l;t.push(`L${e},${s}`),t.push("Z")}return e.jsx("g",{"data-testid":"marginal-ridgeline-"+n,children:e.jsx("path",{d:t.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}return null},[i,r,c,s,l,n,u,4]);return d?e.jsx("g",{className:"marginal-"+n,"data-testid":"marginal-"+n,children:d}):null}function cn(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),i=e.split(/\s+/),r=[];let s="";for(const e of i)s&&s.length+1+e.length>o?(r.push(s),s=e):s=s?`${s} ${e}`:e;return s&&r.push(s),r}function un(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 dn(t,n,o,i){if(!t)return e.jsx("g",{className:"annotation-note"});const{label:r,title:s,orientation:a,align:l,wrap:c=120,noWrap:u}=t;if(!r&&!s)return e.jsx("g",{className:"annotation-note"});let d=a;d||(d=Math.abs(n)>Math.abs(o)?"leftRight":"topBottom");let h=l;h&&"dynamic"!==h||(h="topBottom"===d?0>n?"right":"left":0>o?"bottom":"top");let g="start";"topBottom"===d?"right"===h?g="end":"middle"===h&&(g="middle"):g=0>n?"end":"start";const f=16,p=s?u?[s]:cn(s,c):[],y=r?u?[r]:cn(r,c):[],m="leftRight"===d?"end"===g?-4:4:0;let v=0;const b=[],x=i||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";t.useHTML||t.html?(b.push(e.jsx("foreignObject",{className:"annotation-note-html",x:"end"===g?m-c:"middle"===g?m-c/2:m,y:-16,width:c,height:Math.max(f,(p.length+y.length)*f+(s&&r?2:0))+f,style:{overflow:"visible"},children:e.jsxs("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{color:x,fontSize:"12px",lineHeight:"16px",overflow:"visible",textAlign:"end"===g?"right":"middle"===g?"center":"left",whiteSpace:u?"nowrap":"normal",wordBreak:"break-word"},children:[s&&e.jsx("div",{className:"annotation-note-title",style:{fontWeight:"bold"},children:s}),r&&e.jsx("div",{className:"annotation-note-label",children:r})]})},"annotation-note-html")),v=p.length*f):(p.length>0&&(b.push(e.jsx("text",{className:"annotation-note-title",fill:x,textAnchor:g,fontWeight:"bold",children:p.map((t,n)=>e.jsx("tspan",{x:m,dy:0===n?0:f,children:t},n))},"annotation-note-title")),v=p.length*f),y.length>0&&b.push(e.jsx("text",{className:"annotation-note-label",fill:x,textAnchor:g,y:v,children:y.map((t,n)=>e.jsx("tspan",{x:m,dy:0===n?0:f,children:t},n))},"annotation-note-label")));let k=null;if((s||r)&&(0!==n||0!==o))if("topBottom"===d){const t=Math.min(c,120);let n=0,o=t;"end"===g?(n=-t,o=0):"middle"===g&&(n=-t/2,o=t/2),k=e.jsx("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:i||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(p.length+y.length)*f+(y.length>0?f:0);let n=0,o=t;"bottom"===h?(n=-t,o=0):"middle"===h&&(n=-t/2,o=t/2),k=e.jsx("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:i||"var(--semiotic-text-secondary, currentColor)"})}const w=Math.max(0,p.length+y.length-1)*f;let A=0;return"topBottom"===d?A=0>o?-(w+2):18:"leftRight"===d&&(A="middle"===h?-(w+f+(y.length>0&&p.length>0?2:0))/2+8:"bottom"===h||0>o?-(w+2):18),e.jsxs("g",{className:"annotation-note",transform:`translate(${n},${o})`,children:[e.jsx("g",{className:"annotation-note-content",transform:0!==A?`translate(0,${A})`:void 0,children:b}),k]})}function hn(t,n,o,i,r){var s;const a=[];switch(t){case"callout-circle":{const t=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);t>0&&a.push(e.jsx("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)&&a.push(e.jsx("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)&&a.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const t=i||0,s=r||0;if(void 0!==(null==n?void 0:n.x)){const i=(n.x||0)-t;a.push(e.jsx("line",{x1:i,y1:(n.y1||0)-s,x2:i,y2:(n.y2||0)-s,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)-s;a.push(e.jsx("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)?a.push(e.jsx("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)||a.push(e.jsx("line",{x1:0,y1:(n.y1||0)-s,x2:0,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const t=null!==(s=null==n?void 0:n.width)&&void 0!==s?s:null==n?void 0:n.height;void 0!==t&&a.push(e.jsx("path",{d:un((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.jsx("g",{className:"annotation-subject",children:a})}function gn(t,n,o,i,r,s){var a;const l=[];let c=0,u=0;if("callout-circle"!==r&&"label"!==r||!(null==s?void 0:s.radius)){if("callout-rect"===r&&s){const e=s.width||0,o=s.height||0;if(e>0||o>0){const i=e/2,r=o/2,s=t-i,a=n-r;if(0!==s||0!==a){const t=Math.abs(s),n=Math.abs(a),l=e/2,d=o/2,h=t*d>n*l?l/t:d/n;c=i+s*h,u=r+a*h}}}else if("bracket"===r&&s){const e=s.width,t=s.height,n=s.depth||30;void 0!==e?(c=e/2,u=n):void 0!==t&&(c=n,u=t/2)}}else{const e=(s.radius||0)+(s.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)",s="curve"===(null==o?void 0:o.type);let h=Math.atan2(n-u,t-c);if(s){const i=(null!==(a=null==o?void 0:o.curve)&&void 0!==a?a:.25)*d,s=(c+t)/2+-(n-u)/d*i,g=(u+n)/2+(t-c)/d*i;l.push(e.jsx("path",{className:"connector-curve",d:`M${c},${u}Q${s},${g} ${t},${n}`,fill:"none",stroke:r},"connector-line")),h=Math.atan2(g-u,s-c)}else l.push(e.jsx("line",{x1:c,y1:u,x2:t,y2:n,stroke:r},"connector-line"));if("arrow"===(null==o?void 0:o.end)){const t=10,n=16/180*Math.PI;l.push(e.jsx("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.jsx("g",{className:"annotation-connector",children:l})}function fn(t){var n,o;const{x:i=0,y:r=0,dx:s,dy:a,nx:l,ny:c,note:u,connector:d,subject:h,type:g,color:f,className:p,disable:y,opacity:m,strokeDasharray:v,events:b={},"data-testid":x}=t,k=Array.isArray(i)?null!==(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 j=s||0,S=a||0;null!=l&&(j=l-k),null!=c&&(S=c-w);const O="string"==typeof g?g:"label";if("bracket"===O&&h&&0===j&&0===S)if(void 0!==h.width){j=h.width/2;const e=h.depth||30;S=e+(0>e?-5:5)}else if(void 0!==h.height){const e=h.depth||30;j=e+(0>e?-5:5),S=h.height/2}return e.jsxs("g",Object.assign({className:("annotation "+(p||"")).trim(),transform:`translate(${k},${w})`,"data-testid":x},null!=m&&{opacity:m},v&&{strokeDasharray:v},b,{children:[!A.has("connector")&&gn(j,S,d,f,O,h),!A.has("subject")&&hn(O,h,f,k,w),!A.has("note")&&dn(u,j,S,f)]}))}function pn(t){var n,o;const{noteData:i}=t,{screenCoordinates:r}=i,s="string"==typeof i.type?i.type:"label",a=i.eventListeners||i.events||{};if(i.coordinates&&r){const t=i.nx||r[0][0]+(null!==(n=i.dx)&&void 0!==n?n:0),a=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:a});return e.jsx(fn,Object.assign({"data-testid":"semiotic-annotation"},r,{type:s}),"multi-annotation-"+o)});return e.jsx("g",{children:l})}const l=i.note||{title:"none",label:i.label},c=`${l.label}-${l.title}-${i.i}`;return e.jsx(fn,Object.assign({"data-testid":"semiotic-annotation",events:a},i,{type:s}),c)}function yn(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 mn(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 vn(e){return null==e?null:e+""}function bn(e,t,n){var o;return null===(o=t.stickyPositionCache)||void 0===o||o.set(e,n),n}function xn(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 bn(t,n,{x:i.x,y:i.y})}const o=function(e){var t,n,o,i,r,s;const a=e.data;if(!a||0===a.length)return null;const l=a[a.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===(s=e.scales)||void 0===s?void 0:s.value;if(!c||!u)return null;const d=l[e.xAccessor||"x"],h=l[e.yAccessor||"y"];return null==d||null==h?null:{x:c(d),y:u(h)}}(n);return o?bn(t,n,o):null}if("semantic"===r){const o=function(e,t,n){var o,i;const r=function(e){var t,n;return vn(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 s=null===(o=n.pointNodes)||void 0===o?void 0:o.find(e=>vn(e.pointId)===r);if(s)return bn(t,n,{x:s.x,y:s.y});const a=null===(i=n.data)||void 0===i?void 0:i.find(e=>function(e){var t,n,o;return vn(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(!a)return null;const l=yn(a,n),c=mn(a,n);return null==l||null==c?null:bn(t,n,{x:l,y:c})}(e,t,n);if(o)return o}let s=null,a=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(s=t.x,a=t.y)}if(null!=s&&null!=a||(s=yn(e,n),a=mn(e,n)),null!=s&&null!=a)return bn(t,n,{x:s,y:a});if("sticky"===r){const e=null===(i=n.stickyPositionCache)||void 0===i?void 0:i.get(t);if(e)return e}return null}function kn(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const wn={secondary:0,primary:3},An=".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 jn(e){return!0===(null==e?void 0:e._annotationDeferred)}function Sn(e){return"blended"===(null==e?void 0:e.cohesion)||"layer"===(null==e?void 0:e.cohesion)?e.cohesion:null}function On(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 Mn(e){return Math.max(.72,.95-.06*e)}function Cn(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:On(e.annotation),readingOrder:null,rank:1};var n}),o=n.some(e=>null!=e.emphasis||null!=e.confidence),i=t.some(e=>jn(e.annotation)),r=t.some(e=>null!=Sn(e.annotation)),s=t.some(e=>"layer"===Sn(e.annotation));if(!o&&!i&&!r)return t.map(e=>e.node);const a=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});a.forEach((e,t)=>{e.readingOrder=t,e.rank=2-t/Math.max(1,a.length)});for(const e of n)e.emphasis&&(e.rank=wn[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,s=jn(n.annotation);let a=n.node;if("primary"===i||"secondary"===i||null!=r){const t=null==i&&null!=r;a=e.jsx("g",Object.assign({className:t?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+i},"secondary"===i?{opacity:.6,fontSize:"0.88em"}:{},t?{opacity:Mn(r),"data-annotation-reading-order":r}:{},{children:n.node}),"annotation-emphasis-"+o)}const l=Sn(n.annotation);return l&&(a=e.jsx("g",{className:"annotation-cohesion--"+l,children:a},"annotation-cohesion-"+o)),s&&(a=e.jsx("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:a},"annotation-deferred-"+o)),a});return i&&l.unshift(e.jsx("style",{children:An},"annotation-disclosure-style")),s&&l.unshift(e.jsx("style",{children:".annotation-cohesion--layer text,.annotation-cohesion--layer tspan{fill:var(--semiotic-annotation-color,var(--semiotic-text-secondary,#666));font-style:italic}"},"annotation-cohesion-style")),l}const _n={linear:s.curveLinear,monotoneX:s.curveMonotoneX,monotoneY:s.curveMonotoneY,step:s.curveStep,stepAfter:s.curveStepAfter,stepBefore:s.curveStepBefore,basis:s.curveBasis,cardinal:s.curveCardinal,catmullRom:s.curveCatmullRom};function Pn(e,t,n,o){const i=[];return e.forEach((e,r)=>{let s;if(n){const i=n(e,r,o);s=null!=i?i:t(e,r,o)}else s=t(e,r,o);s&&i.push({node:s,annotation:e})}),Cn(i)}function Ln(t){return function(t,n,o){var i,r,a,c,u,d,h,g,f,m,v,b,x,k,w,A,j,S,O,M,C,_,P,L,T,R,$,N,E,B,D,I,F,H,W,z,Y,G,q,X,V,U,Q,K,Z,J,ee,te,ne,oe,ie;switch(t.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const s=xn(t,n,o);if(!s)return null;const{x:l,y:c}=s;if(!kn(l,c,o))return null;const u="callout"===t.type?"callout-circle":t.type,d="callout-circle"===u?{radius:null!==(i=t.radius)&&void 0!==i?i:12,radiusPadding:t.radiusPadding}:"callout-rect"===u?{width:t.width,height:t.height}:void 0;return e.jsx(pn,{noteData:Object.assign(Object.assign({x:l,y:c,dx:null!==(r=t.dx)&&void 0!==r?r:30,dy:null!==(a=t.dy)&&void 0!==a?a:-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:u},d?{subject:d}:{}),{connector:t.connector||{end:"arrow"},color:t.color,disable:t.disable,opacity:t.opacity,strokeDasharray:t.strokeDasharray,className:t.className})},"ann-"+n)}case"x-threshold":{const i=yn(null!=t.value?Object.assign(Object.assign({},t),{x:t.value}):t,o);if(null==i)return null;const r=t.color||"#f97316",s=t.labelPosition||"top";let a;a="bottom"===s?(o.height||0)-4:"center"===s?(o.height||0)/2:12;const l=i>.6*(o.width||0),c=l?i-4:i+4,u=l?"end":"start";return e.jsxs("g",{opacity:t.opacity,children:[e.jsx("line",{x1:i,y1:0,x2:i,y2:o.height||0,stroke:r,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:c,y:a,textAnchor:u,fill:r,fontSize:12,fontWeight:"bold",stroke:"var(--semiotic-bg, #ffffff)",strokeWidth:3,paintOrder:"stroke",children:t.label})]},"ann-"+n)}case"y-threshold":{const i=mn(null!=t.value?Object.assign(Object.assign({},t),{y:t.value}):t,o);if(null==i)return null;const r=t.color||"#f97316",s=t.labelPosition||"right";let a,l;return"left"===s?(a=4,l="start"):"center"===s?(a=(o.width||0)/2,l="middle"):(a=(o.width||0)-4,l="end"),e.jsxs("g",{opacity:t.opacity,children:[e.jsx("line",{x1:0,y1:i,x2:o.width||0,y2:i,stroke:r,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:a,y:i-4,textAnchor:l,fill:r,fontSize:12,fontWeight:"bold",stroke:"var(--semiotic-bg, #ffffff)",strokeWidth:3,paintOrder:"stroke",children:t.label})]},"ann-"+n)}case"enclose":{const i=(t.coordinates||[]).map(e=>({x:yn(Object.assign(Object.assign({},e),{type:"point"}),o),y:mn(Object.assign(Object.assign({},e),{type:"point"}),o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>i.length)return null;const r=l.packEnclose(i),s=t.padding||10;return e.jsxs("g",{children:[e.jsx("circle",{cx:r.x,cy:r.y,r:r.r+s,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.jsx("text",{x:r.x,y:r.y-r.r-s-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:t.label})]},"ann-"+n)}case"rect-enclose":{const i=(t.coordinates||[]).map(e=>({x:yn(Object.assign(Object.assign({},e),{type:"point"}),o),y:mn(Object.assign(Object.assign({},e),{type:"point"}),o)})).filter(e=>null!=e.x&&null!=e.y);if(2>i.length)return null;const r=t.padding||10,s=i.map(e=>e.x),a=i.map(e=>e.y),[l,c]=rn(s),[u,d]=rn(a),h=l-r,g=c+r,f=u-r;return e.jsxs("g",{children:[e.jsx("rect",{x:h,y:f,width:g-h,height:d+r-f,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.jsx("text",{x:(h+g)/2,y:f-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:t.label})]},"ann-"+n)}case"highlight":{const i=o.data||[],r="function"==typeof t.filter?i.filter(t.filter):t.field&&null!=t.value?i.filter(e=>e[t.field]===t.value):[],s={stroke:t.color||"#f97316",strokeWidth:2,fill:"none"};return e.jsx("g",{children:r.map((n,i)=>{const r=yn(n,o),a=mn(n,o);if(null==r||null==a)return null;const l="function"==typeof t.r?t.r(n):t.r||6,c="function"==typeof t.style?t.style(n):t.style||s;return e.jsx("circle",Object.assign({cx:r,cy:a,r:l},c),"hl-"+i)})},"ann-"+n)}case"bracket":{const i=yn(t,o),r=mn(t,o);return e.jsx(pn,{noteData:{x:null!=i?i:0,y:null!=r?r:0,dx:t.dx||0,dy:t.dy||0,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"bracket",subject:{type:t.bracketType||"curly",width:t.width,height:t.height,depth:t.depth||30},color:t.color}},"ann-"+n)}case"trend":{const i=o.data||[];if(2>i.length)return null;const r=o.xAccessor||"x",s=o.yAccessor||"y",a="ordinal"===o.frameType,l="horizontal"===o.projection,p=a?r:null,v=a?s:null;let b;const x=[],k=new Map;if(a&&p&&v){for(const e of i){const t=e[p];if(null==t)continue;const n=t+"";k.has(n)||(k.set(n,x.length),x.push(n))}b=i.map(e=>{const t=e[p],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=i.map(e=>[e[r],e[s]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>b.length)return null;const w=null!==(u=null===(c=o.scales)||void 0===c?void 0:c.x)&&void 0!==u?u:null===(d=o.scales)||void 0===d?void 0:d.time,A=null!==(g=null===(h=o.scales)||void 0===h?void 0:h.y)&&void 0!==g?g:null===(f=o.scales)||void 0===f?void 0:f.value;if(!w||!A)return null;const j=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},S=w,O=A;let M;if(a)if(l){const e=j(O);M=(t,n)=>[S(n),e(t)]}else{const e=j(S);M=(t,n)=>[e(t),O(n)]}else M=(e,t)=>[S(e),O(t)];const C=t.method||"linear";let _;_="loess"===C?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]),s=Math.max(2,Math.ceil(t*n)),a=[];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(s-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){a.push([t,r[e]]);continue}const p=u*g-d*d;if(1e-12>Math.abs(p))a.push([t,h/u]);else{const e=(u*f-d*h)/p;a.push([t,(h-e*d)/u+e*t])}}return a}(b,null!==(m=t.bandwidth)&&void 0!==m?m:.3):("polynomial"===C?y.default.polynomial(b,{order:t.order||2}):y.default.linear(b)).points;const P=_.map(([e,t])=>{const[n,o]=M(e,t);return`${n},${o}`}).join(" "),L=t.color||"#6366f1",T=_[_.length-1],[R,$]=M(T[0],T[1]);return e.jsxs("g",{children:[e.jsx("polyline",{points:P,fill:"none",stroke:L,strokeWidth:t.strokeWidth||2,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:R+4,y:$-4,fill:L,fontSize:11,children:t.label})]},"ann-"+n)}case"band":{const i=null!==(b=null===(v=o.scales)||void 0===v?void 0:v.y)&&void 0!==b?b:null===(x=o.scales)||void 0===x?void 0:x.value,r=null!==(k=null==i?void 0:i(t.y0))&&void 0!==k?k:0,s=null!==(w=null==i?void 0:i(t.y1))&&void 0!==w?w:o.height||0;return e.jsxs("g",{opacity:t.opacity,children:[e.jsx("rect",{x:0,y:Math.min(r,s),width:o.width||0,height:Math.abs(s-r),fill:t.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:t.fillOpacity||.1}),t.label&&e.jsx("text",{x:(o.width||0)-4,y:Math.max(Math.min(r,s),0)+13,textAnchor:"end",fill:t.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",stroke:"var(--semiotic-bg, #ffffff)",strokeWidth:3,paintOrder:"stroke",children:t.label})]},"ann-"+n)}case"envelope":{const i=o.data||[];if(2>i.length)return null;const r=o.xAccessor||"x",a=null!==(j=null===(A=o.scales)||void 0===A?void 0:A.x)&&void 0!==j?j:null===(S=o.scales)||void 0===S?void 0:S.time,l=null!==(M=null===(O=o.scales)||void 0===O?void 0:O.y)&&void 0!==M?M:null===(C=o.scales)||void 0===C?void 0:C.value;if(!a||!l)return null;const c=t.upperAccessor||"upperBounds",u=t.lowerAccessor||"lowerBounds",d=t.filter,h=i.filter(e=>null!=e[c]&&null!=e[u]&&!(d&&!d(e))).sort((e,t)=>e[r]-t[r]);if(2>h.length)return null;const g=_n[o.curve||"linear"]||s.curveLinear,f=s.area().x(e=>a(e[r])).y0(e=>l(e[u])).y1(e=>l(e[c])).curve(g)(h);if(!f)return null;const p=t.fill||"#6366f1";return e.jsxs("g",{children:[e.jsx("path",{d:f,fill:p,fillOpacity:null!==(_=t.fillOpacity)&&void 0!==_?_:.15,stroke:"none"}),t.label&&h.length>0&&e.jsx("text",{x:a(h[h.length-1][r])+4,y:l(h[h.length-1][c])-4,fill:p,fontSize:11,children:t.label})]},"ann-"+n)}case"anomaly-band":{const i=o.data||[];if(2>i.length)return null;const r=o.yAccessor||"y",s=null!==(L=null===(P=o.scales)||void 0===P?void 0:P.x)&&void 0!==L?L:null===(T=o.scales)||void 0===T?void 0:T.time,a=null!==($=null===(R=o.scales)||void 0===R?void 0:R.y)&&void 0!==$?$:null===(N=o.scales)||void 0===N?void 0:N.value;if(!s||!a)return null;const l=i.map(e=>e[r]).filter(e=>null!=e&&isFinite(e));if(2>l.length)return null;const c=l.reduce((e,t)=>e+t,0)/l.length,u=l.reduce((e,t)=>e+Math.pow(t-c,2),0)/l.length,d=Math.sqrt(u),h=null!==(E=t.threshold)&&void 0!==E?E:2,g=c-h*d,f=!1!==t.showBand,p=t.fill||"#6366f1",y=null!==(B=t.fillOpacity)&&void 0!==B?B:.1,m=t.anomalyColor||"#ef4444",v=null!==(D=t.anomalyRadius)&&void 0!==D?D:6,b=a(c+h*d),x=a(g),k=i.filter(e=>{const t=e[r];return null!=t&&Math.abs(t-c)>h*d});return e.jsxs("g",{children:[f&&e.jsx("rect",{x:0,y:Math.min(b,x),width:o.width||0,height:Math.abs(x-b),fill:p,fillOpacity:y}),k.map((t,n)=>{const i=yn(t,o),r=mn(t,o);return null==i||null==r?null:e.jsx("circle",{cx:i,cy:r,r:v,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5},"anomaly-"+n)}),t.label&&e.jsx("text",{x:(o.width||0)-4,y:Math.min(b,x)-4,textAnchor:"end",fill:p,fontSize:11,children:t.label})]},"ann-"+n)}case"forecast":{const i=o.data||[];if(3>i.length)return null;const r=o.xAccessor||"x",s=o.yAccessor||"y",a=null!==(F=null===(I=o.scales)||void 0===I?void 0:I.x)&&void 0!==F?F:null===(H=o.scales)||void 0===H?void 0:H.time,l=null!==(z=null===(W=o.scales)||void 0===W?void 0:W.y)&&void 0!==z?z:null===(Y=o.scales)||void 0===Y?void 0:Y.value;if(!a||!l)return null;const c=i.map(e=>[e[r],e[s]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>c.length)return null;let u;if("polynomial"===(t.method||"linear")){const e=y.default.polynomial(c,{order:t.order||2}).equation;u=t=>e.reduce((e,n,o)=>e+n*Math.pow(t,o),0)}else{const e=c.length;let t=0,n=0,o=0,i=0;for(const[e,r]of c)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 s=(e*i-t*n)/r,a=(n-s*t)/e;u=e=>a+s*e}const d=c.length,h=c.map(([e,t])=>t-u(e)).reduce((e,t)=>e+t*t,0),g=Math.sqrt(h/Math.max(d-2,1)),f=c.reduce((e,t)=>e+t[0],0)/d,p=c.reduce((e,t)=>e+Math.pow(t[0]-f,2),0),m=null!==(G=t.confidence)&&void 0!==G?G:.95,v=.99>m?.95>m?.9>m?1:1.645:1.96:2.576,b=null!==(q=t.steps)&&void 0!==q?q:5,x=c[d-1][0],k=(x-c[0][0])/Math.max(d-1,1),w=[];for(let e=1;b>=e;e++)w.push(x+e*k);const A=[];for(const e of w){const t=u(e),n=g*Math.sqrt(1+1/d+(p>0?Math.pow(e-f,2)/p:0))*v;A.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const j=`M${A.map(e=>`${a(e.x)},${l(e.yUpper)}`).join(" L")} L${A.slice().reverse().map(e=>`${a(e.x)},${l(e.yLower)}`).join(" L")} Z`,S=A.map(e=>`${a(e.x)},${l(e.yCenter)}`).join(" "),O=`${a(x)},${l(u(x))}`,M=t.strokeColor||"#6366f1";return e.jsxs("g",{children:[e.jsx("path",{d:j,fill:t.fill||"#6366f1",fillOpacity:null!==(X=t.fillOpacity)&&void 0!==X?X:.15,stroke:"none"}),e.jsx("polyline",{points:`${O} ${S}`,fill:"none",stroke:M,strokeWidth:null!==(V=t.strokeWidth)&&void 0!==V?V:2,strokeDasharray:null!==(U=t.strokeDasharray)&&void 0!==U?U:"6,3"}),t.label&&A.length>0&&e.jsx("text",{x:a(A[A.length-1].x)+4,y:l(A[A.length-1].yCenter)-4,fill:M,fontSize:11,children:t.label})]},"ann-"+n)}case"widget":{let i=null,r=null;if(null!=t.px&&null!=t.py)i=t.px,r=t.py;else{const e=xn(t,n,o);if(!e)return null;i=e.x,r=e.y}if(null==i||null==r)return null;if(!kn(i,r,o))return null;const s=null!==(Q=t.dx)&&void 0!==Q?Q:0,a=null!==(K=t.dy)&&void 0!==K?K:0,l=null!==(Z=t.width)&&void 0!==Z?Z:32,c=null!==(J=t.height)&&void 0!==J?J:32,u=null!==(ee=t.content)&&void 0!==ee?ee:e.jsx("span",{style:{fontSize:18,cursor:"default"},title:t.label||"Info",children:"ℹ️"});return e.jsx("foreignObject",{x:i+s-l/2,y:r+a-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:e.jsx("div",{style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+n)}case"text":{const i=xn(t,n,o);if(!i)return null;const{x:r,y:s}=i,a=r+(t.dx||0),l=s+(t.dy||0),c=t.color||"var(--semiotic-text, #333)",u=e.jsx("text",{x:a,y:l,fill:c,fontSize:t.fontSize||11,opacity:t.opacity,strokeDasharray:t.strokeDasharray,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:t.label});return!0!==t._redundantConnector?p.cloneElement(u,{key:"ann-text-"+n}):e.jsxs("g",{opacity:t.opacity,strokeDasharray:t.strokeDasharray,children:[e.jsx("line",{x1:r,y1:s,x2:a,y2:l,stroke:c,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),p.cloneElement(u,{opacity:void 0,strokeDasharray:void 0})]},"ann-text-"+n)}case"category-highlight":{const i=t.category;if(null==i)return null;const r=e=>"function"==typeof e&&"function"==typeof e.bandwidth,s=null===(te=o.scales)||void 0===te?void 0:te.o,a=null===(ne=o.scales)||void 0===ne?void 0:ne.x,l=null===(oe=o.scales)||void 0===oe?void 0:oe.y,c=r(s)?s:r(a)?a:r(l)?l:null;if(!c)return null;const u=c(i+"");if(null==u)return null;const d=c.bandwidth(),h=t.color||"var(--semiotic-primary, #4589ff)",g=null!==(ie=t.opacity)&&void 0!==ie?ie:.15,f=t.label;return e.jsxs("g",(o.projection?"vertical"===o.projection:c===a)?{children:[e.jsx("rect",{x:u,y:0,width:d,height:o.height||0,fill:h,fillOpacity:g}),f&&e.jsx("text",{x:u+d/2,y:12,textAnchor:"middle",fill:h,fontSize:12,fontWeight:"bold",children:f})]}:{children:[e.jsx("rect",{x:0,y:u,width:o.width||0,height:d,fill:h,fillOpacity:g}),f&&e.jsx("text",{x:12,y:u+d/2,dominantBaseline:"middle",fill:h,fontSize:12,fontWeight:"bold",children:f})]},"ann-"+n)}default:return null}}}const Tn=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function Rn(e){return!!e&&"object"==typeof e&&Tn.has(function(e){return"string"==typeof(null==e?void 0:e.type)?e.type:""}(e))}function $n(e){return"primary"===(null==e?void 0:e.emphasis)||!0===(null==e?void 0:e.defensive)}function Nn(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 En(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 Bn=32,Dn=6,In=4,Fn=8,Hn=72;const Wn={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function zn(e){return Rn(e)}function Yn(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 Gn(e,t,n,o,i){const r=e+n,s=t+o;return Math.abs(n)>Math.abs(o)?{x:0>n?r-i.width-4:r+4,y:0>o?s-i.height:s,width:i.width,height:i.height}:{x:0>n?r-i.width:r,y:0>o?s-i.height-4:s+4,width:i.width,height:i.height}}function qn(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function Xn(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 Vn(e,t,n,o,i,r,s,a){const l=qn(e,s);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,a);for(const e of n)c+=12*Xn(l,e);for(const e of o)c+=4*Xn(l,e);return c}function Un(e){var t;const{annotations:n,context:o,defaultOffset:i=Bn,notePadding:r=Dn,markPadding:s=In,edgePadding:a=Fn,preserveManualOffsets:l=!0,routeLongConnectors:c=!0,connectorThreshold:u=Hn,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,s);let k=!1;const w=n.map((e,t)=>{if(!zn(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 s=e.coordinates,a=null===(i=n.scales)||void 0===i?void 0:i.geoProjection;if(Array.isArray(s)&&s.length>=2&&a){const e=s[0],t=s[1];if("number"==typeof e&&"number"==typeof t){const n=a([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?xn(e,t,n):{x:e.x,y:e.y}}(e,t,o);if(!n)return e;const s=function(e){if("widget"===e.type)return{width:"number"==typeof e.width?e.width:32,height:"number"==typeof e.height?e.height:32};const t="number"==typeof e.wrap?e.wrap:120,n=[...Yn("string"==typeof e.title?e.title:void 0,t),...Yn("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(qn(Gn(n.x,n.y,"number"==typeof e.dx?e.dx:t.dx,"number"==typeof e.dy?e.dy:t.dy,s),r)),e}var d;let h=null,g=1/0;for(const e of function(e){const t=1.6*e;return[{dx:e,dy:-e},{dx:-e,dy:-e},{dx:e,dy:e},{dx:-e,dy:e},{dx:e,dy:0},{dx:-e,dy:0},{dx:0,dy:-e},{dx:0,dy:e},{dx:t,dy:-t},{dx:-t,dy:-t},{dx:t,dy:t},{dx:-t,dy:t}]}(i)){const t=Vn(Gn(n.x,n.y,e.dx,e.dy,s),e,b,x,m,v,r,a);g>t&&(h=e,g=t)}if(!h)return e;const f=qn(Gn(n.x,n.y,h.dx,h.dy,s),r);b.push(f);const p=Math.hypot(h.dx,h.dy),y=c&&p>=u&&"text"!==e.type&&"widget"!==e.type?Object.assign(Object.assign({},e.connector||{end:"arrow"}),{type:"curve"}):e.connector;return k=!0,Object.assign(Object.assign(Object.assign({},e),{dx:h.dx,dy:h.dy}),y?{connector:y}:{})}),A=k?w:n.slice();let j=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});j=e?t:A}{let e=!1;const t=j.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=Wn[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(" · "),s="string"==typeof e.label?e.label:"";return s.includes(`(${r})`)?e:Object.assign(Object.assign({},e),{label:s?`${s} (${r})`:`(${r})`})}(t);return n!==t&&(e=!0),n});j=e?t:j}const S=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:Nn(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),s=Nn(o,i,e),a=n.map((e,t)=>{return{annotation:e,index:t,note:(n=e,Rn(n))};var n}),l=a.filter(e=>e.note);if(0===l.length||s>=l.length)return{visible:n.slice(),deferred:[],budget:s};const c=l.filter(e=>$n(e.annotation)),u=l.filter(e=>!$n(e.annotation)).sort((e,t)=>En(t.annotation)-En(e.annotation)||e.index-t.index),d=Math.min(u.length,Math.max(Math.max(0,s-c.length),Math.max(0,r-c.length))),h=new Set([...c.map(e=>e.index),...u.slice(0,d).map(e=>e.index)]),g=[],f=[];for(const{annotation:e,index:t,note:n}of a)!n||h.has(t)?g.push(e):f.push(e);return{visible:g,deferred:f,budget:s}}(Object.assign({annotations:j,width:m,height:v},o));for(const e of i)S.add(e)}if(f&&("object"==typeof f&&"number"==typeof f.minWidth?f.minWidth:480)>=m)for(const e of j)zn(e)&&"secondary"===e.emphasis&&S.add(e);if(S.size>0)for(const e of j)!0===(null==e?void 0:e.defensive)&&S.delete(e);let O;return O=0===S.size?j:h?j.map(e=>S.has(e)?Object.assign(Object.assign({},e),{_annotationDeferred:!0}):e):j.filter(e=>!S.has(e)),p?function(e,t){let n=!1;const o=e.map(e=>zn(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(n=!0,Object.assign(Object.assign({},e),{cohesion:t})):e);return n?o:e}(O,p):O}let Qn={positions:new Map};const Kn=new Set;function Zn(){for(const e of Kn)e()}function Jn(e,t){const n=Qn.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(Qn.positions);o.delete(e),Qn={positions:o},Zn()}function eo(e,t){const n=Qn.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(Qn.positions);o.delete(e),Qn={positions:o},Zn()}function to(){return Qn}function no(e){return Kn.add(e),()=>Kn.delete(e)}const oo={positions:new Map};function io(){return()=>{}}function ro(){return oo}function so(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,s=o instanceof Date?o.getTime():o,a=i instanceof Date?i.getTime():i;if(2>t||s===a)return r?[new Date(s),new Date(a)]:[s,a];const l=(a-s)/(t-1),c=Array(t);for(let e=0;t>e;e++){const n=e===t-1?a:s+e*l;c[e]=r?new Date(n):n}return c}(e,t):e.ticks(t)}function ao(e,t,n){if("edges"===e){if(t)return"start";if(n)return"end"}return"middle"}function lo(e,t,n){if("edges"===e){if(t)return"hanging";if(n)return"auto"}return"middle"}function co(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 uo(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function ho(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 s="M0,"+o;for(let e=0;r>e;e++){const n=8*(e+1);s+=`L${Math.min(8*e+4,t)},${o+4*i}`,s+=`L${Math.min(n,t)},${o}`}return s}{const o="bottom"===e?0:t,i="bottom"===e?1:-1,r=Math.ceil(n/8);let s=`M${o},0`;for(let e=0;r>e;e++){const t=8*(e+1);s+=`L${o+4*i},${Math.min(8*e+4,n)}`,s+=`L${o},${Math.min(t,n)}`}return s}}function go(n){const{width:o,height:i,totalWidth:r,totalHeight:s,margin:a,scales:l,showAxes:c,axes:u,showGrid:d,xFormat:h,yFormat:g,axisExtent:f}=n,p=t.useMemo(()=>{var e,t;if(!l)return[];const n=null==u?void 0:u.find(e=>"bottom"===e.orient),i=(null==n?void 0:n.tickFormat)||h||fo,r=Math.max(2,Math.floor(o/70)),s=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:so(l.x,"exact"===f?Math.max(2,s):Math.min(s,r),f),c=a.map(e=>e.valueOf()),d=a.map((e,t)=>({value:e,pixel:l.x(e),label:i(e,t,c)})),g=d.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0);return po(d,Math.max(55,g+8))},[l,u,h,o,f]),y=t.useMemo(()=>{var e,t;if(!l)return[];const n=null==u?void 0:u.find(e=>"left"===e.orient),o=(null==n?void 0:n.tickFormat)||g||fo,r=Math.max(2,Math.floor(i/30)),s=null!==(e=null==n?void 0:n.ticks)&&void 0!==e?e:5;return po((null!==(t=null==n?void 0:n.tickValues)&&void 0!==t?t:so(l.y,"exact"===f?Math.max(2,s):Math.min(s,r),f)).map(e=>({value:e,pixel:l.y(e),label:o(e)})),22)},[l,u,g,i,f]),m=d&&l,v=c&&l;if(!m&&!v)return null;const b=null==u?void 0:u.find(e=>"bottom"===e.orient),x=null==u?void 0:u.find(e=>"left"===e.orient),k=v&&(!b||!1!==b.baseline),w=v&&(!x||!1!==x.baseline),A=(null==b?void 0:b.jaggedBase)||!1,j=(null==x?void 0:x.jaggedBase)||!1,S="var(--semiotic-border, #ccc)";return e.jsx("svg",{width:r,height:s,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:e.jsxs("g",{transform:`translate(${a.left},${a.top})`,children:[m&&(()=>{var t,n;const r=uo(null===(t=null==u?void 0:u.find(e=>"bottom"===e.orient))||void 0===t?void 0:t.gridStyle),s=uo(null===(n=null==u?void 0:u.find(e=>"left"===e.orient))||void 0===n?void 0:n.gridStyle);return e.jsxs("g",{className:"stream-grid",children:[p.map((t,n)=>e.jsx("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:i,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:r},"xgrid-"+n)),y.map((t,n)=>e.jsx("line",{x1:0,y1:t.pixel,x2:o,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:s},"ygrid-"+n))]})})(),k&&!A&&e.jsx("line",{x1:0,y1:i,x2:o,y2:i,stroke:S,strokeWidth:1}),A&&e.jsx("path",{d:ho("bottom",o,i),fill:"none",stroke:S,strokeWidth:1}),w&&!j&&e.jsx("line",{x1:0,y1:0,x2:0,y2:i,stroke:S,strokeWidth:1}),j&&e.jsx("path",{d:ho("left",o,i),fill:"none",stroke:S,strokeWidth:1})]})})}function fo(e,t,n){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function po(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 yo(n){var o,i;const{width:r,height:s,totalWidth:a,totalHeight:l,margin:c,scales:u,showAxes:d,axes:h,xLabel:g,yLabel:f,yLabelRight:p,xFormat:y,yFormat:m,axisExtent:v,showGrid:b,title:x,legend:k,legendHoverBehavior:w,legendClickBehavior:A,legendHighlightedCategory:j,legendIsolatedCategories:S,legendPosition:O="right",legendLayout:M,foregroundGraphics:C,marginalGraphics:_,xValues:P,yValues:L,annotations:T,autoPlaceAnnotations:R,svgAnnotationRules:$,xAccessor:N,yAccessor:E,annotationData:B,pointNodes:D,curve:I,underlayRendered:F,canvasObscuresUnderlay:H=!0,linkedCrosshairName:W,linkedCrosshairSourceId:z,children:Y}=n,G=t.useMemo(()=>{var e,t;if(!d||!u)return[];const n=null==h?void 0:h.find(e=>"bottom"===e.orient),o=(null==n?void 0:n.tickFormat)||y||fo,i=Math.max(2,Math.floor(r/70)),s=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:so(u.x,"exact"===v?Math.max(2,s):Math.min(s,i),v),l=a.map(e=>e.valueOf()),c=a.map((e,t)=>({value:e,pixel:u.x(e),label:o(e,t,l)})),g=c.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0),f=(null==n?void 0:n.autoRotate)?Math.max(20,Math.min(g+8,55)):Math.max(55,g+8);let p=po(c,f);if(p.length>1&&(p=p.filter((e,t)=>0===t||e.label+""!=p[t-1].label+"")),(null==n?void 0:n.includeMax)&&p.length>0&&"exact"!==v&&!(null==n?void 0:n.tickValues)){const e=u.x.domain()[1],t=u.x(e),n=p[p.length-1].pixel;if(Math.abs(t-n)>1){const i=o(e,p.length,l);f>t-n&&p.length>1&&(p=p.slice(0,-1)),p.push({value:e,pixel:t,label:i})}}return p},[d,u,h,y,r,v]),q=t.useMemo(()=>{var e,t;if(!d||!u)return[];const n=null==h?void 0:h.find(e=>"left"===e.orient),o=(null==n?void 0:n.tickFormat)||m||fo,i=Math.max(2,Math.floor(s/30)),r=null!==(e=null==n?void 0:n.ticks)&&void 0!==e?e:5;let a=po((null!==(t=null==n?void 0:n.tickValues)&&void 0!==t?t:so(u.y,"exact"===v?Math.max(2,r):Math.min(r,i),v)).map(e=>({value:e,pixel:u.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"!==v&&!(null==n?void 0:n.tickValues)){const e=u.y.domain()[1],t=u.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},[d,u,h,m,s,v]),X=t.useMemo(()=>{var e,t;if(!d||!u)return[];const n=null==h?void 0:h.find(e=>"right"===e.orient);if(!n)return[];const o=n.tickFormat||m||fo,i=Math.max(2,Math.floor(s/30)),r=null!==(e=n.ticks)&&void 0!==e?e:5;return po((null!==(t=n.tickValues)&&void 0!==t?t:so(u.y,"exact"===v?Math.max(2,r):Math.min(r,i),v)).map(e=>({value:e,pixel:u.y(e),label:o(e)})),22)},[d,u,h,m,s,v]),V=t.useRef(new Map),U=t.useRef(null!==(o=null==T?void 0:T.length)&&void 0!==o?o:0),Q=null!==(i=null==T?void 0:T.length)&&void 0!==i?i:0;U.current!==Q&&(U.current=Q,V.current=new Map);const K=t.useMemo(()=>{if(!T||0===T.length)return null;const e=Ln(),t={scales:u?{x:u.x,y:u.y,time:u.x,value:u.y}:null,timeAxis:"x",xAccessor:N,yAccessor:E,width:r,height:s,data:B,frameType:"xy",pointNodes:D,curve:I,stickyPositionCache:V.current};return Pn(R?Un(Object.assign({annotations:T,context:t},"object"==typeof R?R:{})):T,e,$,t)},[T,R,$,r,s,N,E,B,u,D,I]),Z=function(e){var n;const o=t.useSyncExternalStore(e?no:io,e?to:ro,e?to:ro);return e&&null!==(n=o.positions.get(e))&&void 0!==n?n:null}(W);return t.useEffect(()=>{if(!(null==Z?void 0:Z.locked)||!W)return;const e=e=>{"Escape"===e.key&&eo(W)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[null==Z?void 0:Z.locked,W]),d||x||k||C||_||K&&K.length>0||b||Y||Z?e.jsxs("svg",{role:"img",width:a,height:l,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[e.jsx("title",{children:"string"==typeof x?x:"XY Chart"}),e.jsx("desc",{children:"string"==typeof x?x+" — XY data visualization":"XY data visualization"}),e.jsxs("g",{transform:`translate(${c.left},${c.top})`,children:[b&&u&&(!F||H)&&(()=>{var t,n;const o=uo(null===(t=null==h?void 0:h.find(e=>"bottom"===e.orient))||void 0===t?void 0:t.gridStyle),i=uo(null===(n=null==h?void 0:h.find(e=>"left"===e.orient))||void 0===n?void 0:n.gridStyle);return e.jsxs("g",{className:"stream-grid",children:[G.map((t,n)=>e.jsx("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:s,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:o},"xgrid-"+n)),q.map((t,n)=>e.jsx("line",{x1:0,y1:t.pixel,x2:r,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:i},"ygrid-"+n))]})})(),d&&u&&(()=>{const t=null==h?void 0:h.find(e=>"left"===e.orient),n=null==h?void 0:h.find(e=>"bottom"===e.orient),o=!t||!1!==t.baseline,i=!n||!1!==n.baseline,a=(null==t?void 0:t.jaggedBase)||!1,l=(null==n?void 0:n.jaggedBase)||!1,u=null==n?void 0:n.landmarkTicks,d=null==t?void 0:t.landmarkTicks,y="var(--semiotic-border, #ccc)",m="var(--semiotic-text-secondary, var(--semiotic-text, #666))",v="var(--semiotic-text, #333)",b=!!(null==n?void 0:n.autoRotate)&&G.length>1&&(()=>{const e=r/Math.max(G.length-1,1);return G.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0)+8>e})(),x={fontSize:"var(--semiotic-tick-font-size, 12px)"},k={fontSize:"calc(var(--semiotic-tick-font-size, 12px) + 1px)"},w={fontSize:"var(--semiotic-axis-label-font-size, 12px)"},A=null==n?void 0:n.tickAnchor,j=null==t?void 0:t.tickAnchor,S=co(G),O=co(q);return e.jsxs("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[e.jsxs("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[(!F||H)&&i&&!l&&e.jsx("line",{x1:0,y1:s,x2:r,y2:s,stroke:y,strokeWidth:1}),(!F||H)&&l&&e.jsx("path",{d:ho("bottom",r,s),fill:"none",stroke:y,strokeWidth:1}),G.map((t,n)=>{const o=!!u&&("function"==typeof u?u(t.value,n):lt(t.value,n>0?G[n-1].value:void 0));return e.jsxs("g",{transform:`translate(${t.pixel},${s})`,children:[e.jsx("line",{y2:5,stroke:y,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{y:b?10:18,textAnchor:b?"end":ao(A,t.pixel===S.min,t.pixel===S.max),fontWeight:o?600:400,fill:m,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},o?k:x),transform:b?"rotate(-45)":void 0,children:t.label}):e.jsx("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:Object.assign({textAlign:"center",userSelect:"none"},x),children:t.label})})]},"xtick-"+n)}),g&&e.jsx("text",{x:r/2,y:s+40,textAnchor:"middle",fill:v,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},w),children:g})]}),e.jsxs("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[(!F||H)&&o&&!a&&e.jsx("line",{x1:0,y1:0,x2:0,y2:s,stroke:y,strokeWidth:1}),(!F||H)&&a&&e.jsx("path",{d:ho("left",r,s),fill:"none",stroke:y,strokeWidth:1}),q.map((t,n)=>{const o=!!d&&("function"==typeof d?d(t.value,n):lt(t.value,n>0?q[n-1].value:void 0));return e.jsxs("g",{transform:`translate(0,${t.pixel})`,children:[e.jsx("line",{x2:-5,stroke:y,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{x:-8,textAnchor:"end",dominantBaseline:lo(j,t.pixel===O.min,t.pixel===O.max),fontWeight:o?600:400,fill:m,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},o?k:x),children:t.label}):e.jsx("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:Object.assign({textAlign:"right",userSelect:"none"},x),children:t.label})})]},"ytick-"+n)}),(()=>{const n=(null==t?void 0:t.label)||f;return n?e.jsx("text",{x:15-c.left,y:s/2,textAnchor:"middle",fill:v,transform:`rotate(-90, ${15-c.left}, ${s/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},w),children:n}):null})()]}),(()=>{const t=null==h?void 0:h.find(e=>"right"===e.orient);if(!t||0===X.length)return null;const n=!1!==t.baseline,o=t.landmarkTicks,i=t.label||p,a=t.tickAnchor,l=co(X);return e.jsxs("g",{className:"semiotic-axis semiotic-axis-right","data-orient":"right",children:[n&&e.jsx("line",{x1:r,y1:0,x2:r,y2:s,stroke:y,strokeWidth:1}),X.map((t,n)=>{const i=!!o&&("function"==typeof o?o(t.value,n):lt(t.value,n>0?X[n-1].value:void 0));return e.jsxs("g",{transform:`translate(${r},${t.pixel})`,children:[e.jsx("line",{x2:5,stroke:y,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{x:8,textAnchor:"start",dominantBaseline:lo(a,t.pixel===l.min,t.pixel===l.max),fontWeight:i?600:400,fill:m,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},i?k:x),children:t.label}):e.jsx("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:Object.assign({textAlign:"left",userSelect:"none"},x),children:t.label})})]},"ytick-r-"+n)}),i&&e.jsx("text",{x:r+c.right-15,y:s/2,textAnchor:"middle",fill:v,transform:`rotate(90, ${r+c.right-15}, ${s/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},w),children:i})]})})()]})})(),K,_&&u&&P&&L&&e.jsxs(e.Fragment,{children:[_.top&&e.jsx("g",{transform:"translate(0, 0)",children:e.jsx(ln,{orient:"top",config:an(_.top),values:P,scale:u.x,size:c.top,length:r})}),_.bottom&&e.jsx("g",{transform:`translate(0, ${s})`,children:e.jsx(ln,{orient:"bottom",config:an(_.bottom),values:P,scale:u.x,size:c.bottom,length:r})}),_.left&&e.jsx("g",{transform:"translate(0, 0)",children:e.jsx(ln,{orient:"left",config:an(_.left),values:L,scale:u.y,size:c.left,length:s})}),_.right&&e.jsx("g",{transform:`translate(${r}, 0)`,children:e.jsx(ln,{orient:"right",config:an(_.right),values:L,scale:u.y,size:c.right,length:s})})]}),C,Z&&Z.sourceId!==z&&(null==u?void 0:u.x)&&(()=>{const t=u.x(Z.xValue);if(null==t||0>t||t>r)return null;const n=Z.locked;return e.jsx("line",{x1:t,y1:0,x2:t,y2:s,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"})})(),Y]}),x&&e.jsx("text",{x:a/2,y:20,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:"string"==typeof x?x:null}),on({legend:k,totalWidth:a,totalHeight:l,margin:c,legendPosition:O,title:x,legendLayout:M,legendHoverBehavior:w,legendClickBehavior:A,legendHighlightedCategory:j,legendIsolatedCategories:S})]}):null}function mo(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 vo(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 bo=(e,t)=>({x:e*Math.cos(t),y:e*Math.sin(t)});function xo(e){var t,n;const{innerRadius:o,outerRadius:i,startAngle:r,endAngle:s}=e,a=0>=o;if(0>=(null!==(t=e.cornerRadius)&&void 0!==t?t:0)||!e.roundStart&&!e.roundEnd){if(a){const e=bo(i,r),t=bo(i,s);return`M0,0 L${e.x},${e.y} A${i},${i} 0 ${s-r>Math.PI?1:0} 1 ${t.x},${t.y} Z`}const e=bo(i,r),t=bo(i,s),n=bo(o,s),l=bo(o,r),c=s-r>Math.PI?1:0;return`M${e.x},${e.y} A${i},${i} 0 ${c} 1 ${t.x},${t.y} L${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 xo(Object.assign(Object.assign({},e),{cornerRadius:0,roundStart:!1,roundEnd:!1}));const c=Math.asin(Math.min(1,l/Math.max(1e-9,i-l))),u=a?0:Math.asin(Math.min(1,l/Math.max(1e-9,o+l))),d=s-r,h=e.roundStart&&e.roundEnd?d/2:d,g=!!e.roundStart&&h>c,f=!!e.roundEnd&&h>c;if(!g&&!f)return xo(Object.assign(Object.assign({},e),{cornerRadius:0,roundStart:!1,roundEnd:!1}));const p=r+(g?c:0),y=s-(f?c:0),m=r+(g?u:0),v=s-(f?u:0),b=bo(i,p),x=bo(i,y),k=(i-l)*Math.cos(c),w=bo(k,r),A=bo(k,s),j=a?null:bo(o,v),S=a?null:bo(o,m),O=a?0:(o+l)*Math.cos(u),M=a?null:bo(O,r),C=a?null:bo(O,s),_=y-p>Math.PI?1:0,P=a?0:v-m>Math.PI?1:0;let L="";if(g)L+=`M${w.x},${w.y}`,L+=` A${l},${l} 0 0 1 ${b.x},${b.y}`;else{const e=bo(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=bo(i,s);L+=` A${i},${i} 0 ${_} 1 ${e.x},${e.y}`}if(a)L+=" L0,0";else{if(f)L+=` L${C.x},${C.y}`,L+=` A${l},${l} 0 0 1 ${j.x},${j.y}`;else{const e=bo(o,s);L+=` L${e.x},${e.y}`}if(g)L+=` A${o},${o} 0 ${P} 0 ${S.x},${S.y}`,L+=` A${l},${l} 0 0 1 ${M.x},${M.y}`;else{const e=bo(o,r);L+=` A${o},${o} 0 ${P} 0 ${e.x},${e.y}`}}return L+=" Z",L}function ko(e){const t=xo({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:xo({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle+i*t,endAngle:e.endAngle}),color:o[i]})}return{clipPath:t,slices:n}}const wo={innerRadius:0,outerRadius:0,startAngle:0,endAngle:0};function Ao(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}function jo(t,n,o){const i=Ge(t.symbolType,t.size,t.path);return e.jsx("path",{d:i,transform:t.rotation?`translate(${t.x},${t.y}) rotate(${180*t.rotation/Math.PI})`:`translate(${t.x},${t.y})`,fill:t.style.fill?Ao(t.style.fill):"none",opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},`${null!=o?o:""}symbol-${n}`)}function So(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}const Oo="undefined"==typeof window||"undefined"==typeof document,Mo="undefined"!=typeof window?t.useLayoutEffect:t.useEffect;function Co(){const[e,n]=t.useState(!1);return Mo(()=>{n(!0)},[]),e}const _o=()=>()=>{},Po=()=>!1,Lo=()=>!0;function To(){const e=t.useSyncExternalStore(_o,Po,Lo);return t.useRef(e).current}function Ro(e){const{hydrated:n,wasHydratingFromSSR:o,storeRef:i,dirtyRef:r,renderFnRef:s,cleanup:a}=e;Mo(()=>{var e,t;n&&o&&(null===(t=null===(e=i.current)||void 0===e?void 0:e.cancelIntroAnimation)||void 0===t||t.call(e)),r.current=!0,s.current()},[n,o]);const l=t.useRef(a);l.current=a,t.useEffect(()=>()=>{var e;return null===(e=l.current)||void 0===e?void 0:e.call(l)},[])}function $o(e){const n=t.useRef(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return Eo(e,t);if(!Bo(e)||!Bo(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(!Eo(n,i))return!1}else{if(!Bo(n)||!Bo(i))return!1;if(!No(n,i))return!1}}return!0}(n.current,e)||(n.current=e),n.current}function No(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 Eo(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 Bo(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 Do=p.createContext(null);function Io({children:t}){const[n,o]=p.useState(!1),i=p.useCallback(()=>o(e=>!e),[]),r=p.useMemo(()=>({visible:n,setVisible:o,toggle:i}),[n,i]);return e.jsx(Do.Provider,{value:r,children:t})}function Fo(){return p.useContext(Do)}const Ho={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function Wo(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"],s=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 s)o.push(`${n[e]} ${i[e]||e}`);return`${t}, ${o.join(", ")}`}function zo(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 Yo=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""};function Go(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 qo="semiotic-accessible-data-table",Xo=qo+" semiotic-accessible-data-table-hidden",Vo=qo+" semiotic-accessible-data-table-visible",Uo=Vo+" semiotic-accessible-data-table-network",Qo={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"},Ko={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},Zo={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)"},Jo={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},ei={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))"},ti={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},ni={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},oi={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 ii({scene:t,chartType:n,tableId:o,chartTitle:i}){var r;const[s,a]=p.useState(!1),[l,c]=p.useState(5),u=Fo(),d=null!==(r=null==u?void 0:u.visible)&&void 0!==r&&r,h=s||d,g=p.useRef(null),f=i?"Data summary for "+i:o?`Data summary for ${n} ${o}`:"Data summary for "+n;p.useEffect(()=>{h||c(5)},[h]);const y=p.useCallback(e=>{e.target===e.currentTarget&&(s||d||a(!0))},[s,d]),m=p.useCallback(e=>{var t;d||(null===(t=g.current)||void 0===t?void 0:t.contains(e.relatedTarget))||a(!1)},[d]);if(!t||0===t.length)return o?e.jsx("span",{id:o,tabIndex:-1,style:Ho}):null;if(!h)return e.jsx("div",{id:o,className:Xo,tabIndex:-1,onFocus:y,style:Ho,role:"region","aria-label":f,children:e.jsxs("button",{type:"button",onClick:()=>a(!0),children:["View data summary (",t.length," elements)"]})});const v=function(e){var t,n,o,i,r,s,a,l,c,u,d,h,g,f,p,y,m;const v=[];if(!Array.isArray(e))return v;const b=e.some(e=>e&&("line"===e.type||"area"===e.type));for(const x of e)if(x&&"object"==typeof x&&null!==x.datum)try{switch(x.type){case"point":if(b)break;v.push({label:"Point",values:Go(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:Go(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:"",s=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!=s?s:""}});break}case"heatcell":{const e=Go(x.datum);null==e.value&&"number"==typeof x.value&&Number.isFinite(x.value)&&(e.value=x.value),v.push({label:"Cell",values:e});break}case"wedge":v.push({label:"Wedge",values:{category:null!==(l=null!==(s=null===(r=x.datum)||void 0===r?void 0:r.category)&&void 0!==s?s:null===(a=x.datum)||void 0===a?void 0:a.label)&&void 0!==l?l:"",value:null!==(u=null===(c=x.datum)||void 0===c?void 0:c.value)&&void 0!==u?u:""}});break;case"circle":v.push({label:"Node",values:Go(x.datum)});break;case"arc":v.push({label:"Arc",values:Go(x.datum)});break;case"candlestick":v.push({label:"Candlestick",values:Go(x.datum)});break;case"geoarea":v.push({label:"Region",values:{name:null!==(p=null!==(g=null===(h=null===(d=x.datum)||void 0===d?void 0:d.properties)||void 0===h?void 0:h.name)&&void 0!==g?g:null===(f=x.datum)||void 0===f?void 0:f.name)&&void 0!==p?p:"",value:null!==(m=null===(y=x.datum)||void 0===y?void 0:y.value)&&void 0!==m?m:""}})}}catch(e){}return v}(t),b=function(e){if(!e||0===e.length)return[];const t=new Set;for(const 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}(v),x=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${Yo(e.min)} to ${Yo(e.max)}, mean ${Yo(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(" ")}(v.length,b),k=Math.min(l,v.length),w=v.slice(0,k),A=v.length-k,j=new Set;for(const e of w)for(const t of Object.keys(e.values))j.add(t);const S=Array.from(j);return e.jsxs("div",{ref:g,id:o,className:Vo,tabIndex:-1,onBlur:m,style:Qo,role:"region","aria-label":f,children:[e.jsx("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{d&&u&&u.setVisible(!1),a(!1)},"aria-label":"Close data summary",style:Zo,children:"×"}),e.jsx("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:Ko,children:x}),e.jsxs("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+n,style:Jo,children:[e.jsx("caption",{className:"semiotic-accessible-data-table-caption",style:ni,children:A>0?`First ${k} of ${v.length} data points`:`All ${v.length} data points`}),e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:ei,children:"type"}),S.map(t=>e.jsx("th",{style:ei,children:t},t))]})}),e.jsx("tbody",{children:w.map((t,n)=>e.jsxs("tr",{children:[e.jsx("td",{style:ti,children:t.label}),S.map(n=>{return e.jsx("td",{style:ti,children:(o=t.values[n],null==o||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":Yo(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"")},n);var o})]},n))})]}),A>0&&e.jsxs("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>c(e=>e+25),style:oi,children:["Show ",Math.min(25,A)," more"," ",1===A?"row":"rows"," (",A," remaining)"]})]})}function ri({nodes:t,edges:n,chartType:o,tableId:i,chartTitle:r}){var s,a,l,c,u,d,h,g,f,y,m,v,b,x;const[k,w]=p.useState(!1),[A,j]=p.useState(5),S=Fo(),O=null!==(s=null==S?void 0:S.visible)&&void 0!==s&&s,M=k||O,C=r?"Data summary for "+r:i?`Data summary for ${o} ${i}`:"Data summary for "+o,_=p.useRef(null);p.useEffect(()=>{M||j(5)},[M]);const P=p.useCallback(e=>{e.target===e.currentTarget&&(k||O||w(!0))},[k,O]),L=p.useCallback(e=>{var t;O||(null===(t=_.current)||void 0===t?void 0:t.contains(e.relatedTarget))||w(!1)},[O]);if(!t||0===t.length)return i?e.jsx("span",{id:i,tabIndex:-1,style:Ho}):null;if(!M)return e.jsx("div",{id:i,className:Xo,tabIndex:-1,onFocus:P,style:Ho,role:"region","aria-label":C,children:e.jsxs("button",{type:"button",onClick:()=>w(!0),children:["View data summary (",t.length," nodes, ",n.length," edges)"]})});const T=Array.isArray(t)?t:[],R=Array.isArray(n)?n:[],$=new Map,N=new Map,E=new Map,B=new Map;for(const e of R){if(!e||"object"!=typeof e)continue;const t=null!==(a=e.datum)&&void 0!==a?a:e,n="object"==typeof t.source?null===(l=t.source)||void 0===l?void 0:l.id:t.source,o="object"==typeof t.target?null===(c=t.target)||void 0===c?void 0:c.id:t.target,i="number"==typeof t.value&&Number.isFinite(t.value)?t.value:0;if(null!=n&&""!==n){const e=n+"";N.set(e,(null!==(u=N.get(e))&&void 0!==u?u:0)+1),B.set(e,(null!==(d=B.get(e))&&void 0!==d?d:0)+i)}if(null!=o&&""!==o){const e=o+"";$.set(e,(null!==(h=$.get(e))&&void 0!==h?h:0)+1),E.set(e,(null!==(g=E.get(e))&&void 0!==g?g:0)+i)}}const D=[];for(let e=0;T.length>e;e++){const t=T[e];if(!t||"object"!=typeof t)continue;const n=null!==(y=null===(f=t.datum)||void 0===f?void 0:f.id)&&void 0!==y?y:t.id,o=null!=n?n+"":"node-"+e,i=null!==(m=$.get(o))&&void 0!==m?m:0,r=null!==(v=N.get(o))&&void 0!==v?v:0,s=null!==(b=E.get(o))&&void 0!==b?b:0,a=null!==(x=B.get(o))&&void 0!==x?x:0;D.push({id:o,degree:i+r,inDeg:i,outDeg:r,wDegree:s+a,wInDeg:s,wOutDeg:a})}D.sort((e,t)=>t.degree-e.degree);let I=0,F=0;if(D.length>0){let e=0;for(const t of D)e+=t.degree,t.degree>F&&(F=t.degree);I=e/D.length}const H=R.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)}),W=[`${D.length} nodes, ${R.length} edges.`];D.length>0&&W.push(`Mean degree: ${Yo(I)}, max degree: ${F}.`);const z=Math.min(A,D.length),Y=D.slice(0,z),G=D.length-z;return e.jsxs("div",{ref:_,id:i,className:Uo,tabIndex:-1,onBlur:L,style:Qo,role:"region","aria-label":C,children:[e.jsx("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{O&&S&&S.setVisible(!1),w(!1)},"aria-label":"Close data summary",style:Zo,children:"×"}),e.jsx("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:Ko,children:W.join(" ")}),e.jsxs("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Node degree summary for "+o,style:Jo,children:[e.jsx("caption",{className:"semiotic-accessible-data-table-caption",style:ni,children:G>0?`Top ${z} of ${D.length} nodes by degree`:`All ${D.length} nodes by degree`}),e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:ei,children:"id"}),e.jsx("th",{style:ei,children:"degree"}),e.jsx("th",{style:ei,children:"in"}),e.jsx("th",{style:ei,children:"out"}),H&&e.jsx("th",{style:ei,children:"w. degree"}),H&&e.jsx("th",{style:ei,children:"w. in"}),H&&e.jsx("th",{style:ei,children:"w. out"})]})}),e.jsx("tbody",{children:Y.map((t,n)=>e.jsxs("tr",{children:[e.jsx("td",{style:ti,children:t.id}),e.jsx("td",{style:ti,children:t.degree}),e.jsx("td",{style:ti,children:t.inDeg}),e.jsx("td",{style:ti,children:t.outDeg}),H&&e.jsx("td",{style:ti,children:Yo(t.wDegree)}),H&&e.jsx("td",{style:ti,children:Yo(t.wInDeg)}),H&&e.jsx("td",{style:ti,children:Yo(t.wOutDeg)})]},n))})]}),G>0&&e.jsxs("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>j(e=>e+25),style:oi,children:["Show ",Math.min(25,G)," more"," ",1===G?"node":"nodes"," (",G," remaining)"]})]})}function si({summary:t}){return t?e.jsx("div",{role:"note",style:Ho,children:t}):null}function ai({tableId:t}){return e.jsx("a",{href:"#"+t,style:Ho,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,Ho)},children:"Skip to data table"})}function li({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.jsx("div",{"aria-live":"polite","aria-atomic":"true",style:Ho,children:n})}const ci="var(--semiotic-focus, #005fcc)";function ui({active:t,hoverPoint:n,margin:o,size:i,shape:r="circle",width:s,height:a}){if(!t||!n)return null;const l=n.x+o.left,c=n.y+o.top;let u;if("rect"===r&&null!=s&&null!=a){const t=Math.max(s,4),n=Math.max(a,4);u=e.jsx("rect",{x:l-t/2-3,y:c-n/2-3,width:t+6,height:n+6,rx:3,fill:"none",stroke:ci,strokeWidth:2,strokeDasharray:"4,2"})}else u=e.jsx("circle","wedge"===r?{cx:l,cy:c,r:12,fill:"none",stroke:ci,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:ci,strokeWidth:2,strokeDasharray:"4,2"});return e.jsx("svg",{style:{position:"absolute",left:0,top:0,width:i[0],height:i[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}function di(e){return Array.isArray(e)?e[0]:e}function hi(e,t,n,o){return Object.assign({data:di(e),x:t,y:n,__semioticHoverData:!0},o)}const gi=["name","label","title"],fi=["type","kind","category","group","class","status","role","shape"],pi=["value","amount","total","count","weight","score"],yi=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 mi(e,t){for(const n of t){const t=e.find(e=>e.lower===n);if(t)return t}}function vi(e,t={}){var n;if(!e||"object"!=typeof e)return{entries:[]};const o=null!==(n=t.maxEntries)&&void 0!==n?n:6,i=!1!==t.skipPositional,r=[];for(const[t,n]of Object.entries(e)){if(t.startsWith("_"))continue;if("data"===t)continue;if(i&&yi.has(t.toLowerCase()))continue;if(null==n)continue;const e=typeof n;("string"===e||"number"===e||"boolean"===e||n instanceof Date)&&r.push({key:t,lower:t.toLowerCase(),value:n})}if(0===r.length)return{entries:[]};let s=r.findIndex(e=>gi.includes(e.lower));const a=s>=0;0>s&&(s=r.findIndex(e=>"id"===e.lower)),0>s&&(s=r.findIndex(e=>"string"==typeof e.value));const l=0>s?void 0:r[s];let c=r.filter((e,t)=>t!==s);a&&(c=c.filter(e=>"id"!==e.lower));const u=mi(c,fi),d=mi(c,pi),h=new Set(fi),g=new Set(pi),f=[];u&&f.push({key:u.key,value:u.value}),d&&f.push({key:d.key,value:d.value});for(const e of c){if(f.length>=o)break;e!==u&&e!==d&&(h.has(e.lower)||g.has(e.lower)||f.push({key:e.key,value:e.value}))}return{titleKey:null==l?void 0:l.key,title:null==l?void 0:l.value,entries:f}}const bi={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 xi(e,t){return"function"==typeof t?t(e):e[t]}function ki(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 wi(t={}){const{fields:n,title:o,format:i,style:r={},className:s=""}=t;return t=>{if(!t||"object"!=typeof t)return null;let a;const l=[];if(o){const e=xi(t,o);a=ki(e,i)}if(n&&n.length>0)n.forEach(e=>{let n,o,r;"string"==typeof e?(n=e,o=e,r=i):(n=e.label,o=e.accessor||e.key||"",r=e.format||i);const s=xi(t,o);l.push({label:n,value:ki(s,r)})});else if(!o){const e=["value","y","name","id","label"];for(const n of e)if(void 0!==t[n]){a=ki(t[n],i);break}if(!a){const e=Object.keys(t).filter(e=>!e.startsWith("_"));e.length>0&&(a=ki(t[e[0]],i))}}const c=Object.assign(Object.assign({},bi),r);return e.jsxs("div",{className:("semiotic-tooltip "+s).trim(),style:c,children:[a&&e.jsx("div",{style:{fontWeight:l.length>0?"bold":"normal"},children:a}),l.map((t,n)=>e.jsxs("div",{style:{marginTop:0===n&&a?"4px":0},children:[t.label&&e.jsxs("span",{children:[t.label,": "]}),t.value]},n))]})}}function Ai(){return t=>{var n,o,i,r,s,a,l;const c=t.allSeries;if(!c||0===c.length){const r=null!==(o=null===(n=t.data)||void 0===n?void 0:n.value)&&void 0!==o?o:null===(i=t.data)||void 0===i?void 0:i.y;return e.jsx("div",{className:"semiotic-tooltip",style:bi,children:e.jsx("div",{children:ki(r)})})}const u=null!==(a=null!==(r=t.xValue)&&void 0!==r?r:null===(s=t.data)||void 0===s?void 0:s.time)&&void 0!==a?a:null===(l=t.data)||void 0===l?void 0:l.x;return e.jsxs("div",{className:"semiotic-tooltip",style:bi,children:[null!=u&&e.jsx("div",{style:{fontWeight:600,marginBottom:4,fontSize:"0.9em",borderBottom:"1px solid var(--semiotic-border, #eee)",paddingBottom:4},children:ki(u)}),c.map((t,n)=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"1px 0"},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:t.color,flexShrink:0}}),e.jsx("span",{style:{flex:1,fontSize:"0.85em"},children:t.group}),e.jsx("span",{style:{fontWeight:500,fontSize:"0.85em"},children:ki(t.value)})]},n))]})}}function ji(t){if(!0!==t){if("function"==typeof t){const n=t;return t=>{var o;let i=di(!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);("node"===(null==t?void 0:t.nodeOrEdge)&&"number"==typeof(null==i?void 0:i.x0)&&"number"==typeof(null==i?void 0:i.x1)||"edge"===(null==t?void 0:t.nodeOrEdge)&&"number"==typeof(null==i?void 0:i.sankeyWidth))&&i.data&&"object"==typeof i.data&&(i=i.data);const r=n(i);return null==r?null:e.jsx("div",{className:"semiotic-tooltip",style:bi,children:r})}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?wi(t):wi())}}function Si({x:t,y:n,containerWidth:o,containerHeight:i,margin:r,children:s,className:a="stream-frame-tooltip",zIndex:l=1}){const c=Number.isFinite(t)&&Number.isFinite(n),u=p.useRef(null),[d,h]=p.useState(null);p.useLayoutEffect(()=>{const e=u.current;if(!e)return;const t=e.getBoundingClientRect();h(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[s,a,o,i]);let g;g=d?`translate(${d.width+12>o-t?"calc(-100% - 12px)":"12px"}, ${d.height+12>i-n?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*o?"calc(-100% - 12px)":"12px"}, ${.3*i>n?"4px":"calc(-100% - 4px)"})`;const f=function(e){if(!p.isValidElement(e))return!1;const t=e.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;const n=e.props;if("string"==typeof n.className&&n.className.trim().length>0)return!0;const o=n.style;if(o&&"object"==typeof o){if(null!=o.background&&""!==o.background)return!0;if(null!=o.backgroundColor&&""!==o.backgroundColor)return!0}return!1}(s),y=f?null:bi;return c?e.jsx("div",{ref:u,className:f?a:(a+" semiotic-tooltip").trim(),style:Object.assign(Object.assign({},y||{}),{position:"absolute",left:r.left+t,top:r.top+n,transform:g,pointerEvents:"none",zIndex:l,width:"max-content"}),children:s}):null}function Oi(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 Mi(e,n,o){const i=t.useRef(null),[r,s]=t.useState(null);return t.useEffect(()=>{if(!n&&!o)return;const e=i.current;if(!e)return;const t=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 t.observe(e),()=>t.disconnect()},[n,o]),[i,[n&&r?r.w:e[0],o&&r?r.h:e[1]]]}const Ci="undefined"==typeof window?t.useEffect:t.useLayoutEffect;function _i(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function Pi(e){const n=function(){const[e,n]=t.useState(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return t.useEffect(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return n(e.matches),Oi(e,e=>n(e.matches))},[]),e}(),o=t.useRef(n);o.current=n;const[i,r]=Mi(e.sizeProp,e.responsiveWidth,e.responsiveHeight),s=t.useMemo(()=>Object.assign(Object.assign({},e.marginDefault),e.userMargin),[e.marginDefault,e.userMargin]),a=r[0]-s.left-s.right,l=r[1]-s.top-s.bottom,c=_i(e.foregroundGraphics,r,s),u=_i(e.backgroundGraphics,r,s),d=R(e=>e.theme),{transition:h,introEnabled:g}=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),f="semiotic-table-"+p.useId(),y=t.useRef(0),m=t.useRef(()=>{}),v=t.useCallback(()=>{y.current||(y.current=requestAnimationFrame(()=>m.current()))},[]);t.useEffect(()=>()=>{y.current&&(cancelAnimationFrame(y.current),y.current=0)},[]);const b=t.useRef(()=>{}),x=t.useRef(()=>{}),k=t.useRef(null),w=t.useRef(0),A=t.useCallback(()=>{w.current=0;const e=k.current;k.current=null,e&&b.current(e)},[]),j=t.useCallback(e=>{k.current={clientX:e.clientX,clientY:e.clientY},0===w.current&&(w.current=requestAnimationFrame(A))},[A]),S=t.useCallback(()=>{k.current=null,0!==w.current&&(cancelAnimationFrame(w.current),w.current=0),x.current()},[]);t.useEffect(()=>()=>{k.current=null,0!==w.current&&(cancelAnimationFrame(w.current),w.current=0)},[]);const O=e.themeDirtyRef;return Ci(()=>{O&&(gt++,O.current=!0,v())},[d,v,O]),{reducedMotion:n,reducedMotionRef:o,responsiveRef:i,size:r,margin:s,adjustedWidth:a,adjustedHeight:l,resolvedForeground:c,resolvedBackground:u,currentTheme:d,transition:h,introEnabled:g,tableId:f,rafRef:y,renderFnRef:m,scheduleRender:v,hoverHandlerRef:b,hoverLeaveRef:x,onPointerMove:j,onPointerLeave:S}}function Li(e,t,n,o){const i=e.getContext("2d");if(!i)return null;const r=t[0]*o,s=t[1]*o,a=t[0]+"px",l=t[1]+"px";return e.style.width!==a&&(e.style.width=a),e.style.height!==l&&(e.style.height=l),e.width===r&&e.height===s||(e.width=r,e.height=s),i.setTransform(o,0,0,o,0,0),i.translate(n.left,n.top),i}function Ti(){return"undefined"!=typeof window&&window.devicePixelRatio||1}function Ri(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 $i(e,t,n,o,i,r){if(2>t.length)return;const s=[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];s.push(s[e-1]+Math.sqrt(n*n+o*o))}const a=s[s.length-1];if(0===a)return;const l=Math.min(.2*a,40);e.strokeStyle=n,e.lineWidth=o,e.lineCap=r;for(let n=0;t.length-1>n;n++){const o=(s[n]+s[n+1])/2;let r=i;l>o&&(r*=o/l),l>a-o&&(r*=(a-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 Ni=(e,t,n,o)=>{var i,r;const a=t.filter(e=>"line"===e.type);for(const l of a){if(2>l.path.length)continue;const c=l._introClipFraction;void 0!==c&&1>c&&(e.save(),e.beginPath(),e.rect(0,0,o.width*c,o.height),e.clip());const u=l.style.stroke||"#007bff",d=vt(e,u)||u,h=l.style.strokeWidth||2,g=l.colorThresholds,f=l.rawValues;if(e.setLineDash(l.style.strokeDasharray?l.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=l.style.opacity&&(e.globalAlpha=l.style.opacity),e.lineWidth=h,e.lineCap=l.style.strokeLinecap||"butt",l.style._edgeFade){const v=null!==(i=l.style.opacity)&&void 0!==i?i:1;$i(e,l.path,d,h,v,l.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const p=xt(l.curve),y=g&&g.length>0&&f&&f.length===l.path.length,m=l._decayOpacities;if(m&&m.length===l.path.length&&!y){e.strokeStyle=d;const b=null!==(r=l.style.opacity)&&void 0!==r?r:1;for(let x=0;l.path.length-1>x;x++)e.globalAlpha=.5*(m[x]+m[x+1])*b,e.beginPath(),e.moveTo(l.path[x][0],l.path[x][1]),e.lineTo(l.path[x+1][0],l.path[x+1][1]),e.stroke()}else if(y){let k=null,w=null,A=null,j=null,S=!1;function O(t,n,o){e.beginPath(),e.strokeStyle=t,e.moveTo(n,o),S=!0}function M(){S&&(e.stroke(),S=!1)}for(let C=0;l.path.length>C;C++){const[_,P]=l.path[C],L=f[C],T=Ri(L,g,d);if(null!==k&&null!==j&&null!==A){if(T===j)e.lineTo(_,P);else{const R=[];for(const $ of g){const N=$.value;(A>N||N>L)&&(N>A||L>N)||A===N||L===N||R.push({t:(N-A)/(L-A)})}R.sort((e,t)=>e.t-t.t);for(const E of R){const B=k+(_-k)*E.t,D=w+(P-w)*E.t,I=Ri(A+(L-A)*Math.min(E.t+1e-4,1),g,d);e.lineTo(B,D),M(),O(I,B,D)}e.lineTo(_,P)}k=_,w=P,A=L,j=T}else O(T,_,P),k=_,w=P,A=L,j=T}M()}else{e.beginPath();const F=l.strokeGradient&&l.path.length>=2?At(e,l.strokeGradient,l.path[0][0],0,l.path[l.path.length-1][0],0):null;if(e.strokeStyle=F||d,p)s.line().x(e=>e[0]).y(e=>e[1]).curve(p).context(e)(l.path);else{const[H,W]=l.path[0];e.moveTo(H,W);for(let z=1;l.path.length>z;z++)e.lineTo(l.path[z][0],l.path[z][1])}e.stroke()}if(l.style.fill&&l.style.fillOpacity&&l.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=l.style.fillOpacity,e.fillStyle=kt(e,l.style.fill,l.style.fill),p&&!y)s.line().x(e=>e[0]).y(e=>e[1]).curve(p).context(e)(l.path);else{const[G,q]=l.path[0];e.moveTo(G,q);for(let X=1;l.path.length>X;X++)e.lineTo(l.path[X][0],l.path[X][1])}const Y=l.path[0][0];e.lineTo(l.path[l.path.length-1][0],o.height),e.lineTo(Y,o.height),e.closePath(),e.fill()}void 0!==c&&1>c&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}};function Ei(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Bi(e,t,n=.3){Ei(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 Di(e,t,n=.6){var o,i,r,s,a;if(!Ei(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!==(a=null!==(s=t.cy)&&void 0!==s?s:t.y)&&void 0!==a?a:0;e.beginPath(),e.arc(u,d,c,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*n,e.stroke()}function Ii(e,t,n,o=.35){Ei(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}function Fi(e,t){const n=xt(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=s.area().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 Hi=(e,t,n,o)=>{var i,r,a;const l=t.filter(e=>"area"===e.type);for(const t of l){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 l=t._introClipFraction;void 0!==l&&1>l&&(e.save(),e.beginPath(),e.rect(0,0,o.width*l,o.height),e.clip());const c=kt(e,t.style.fill,"#4e79a7"),u=t._decayOpacities;if(u&&u.length===t.topPath.length){const n=null!==(i=t.style.fillOpacity)&&void 0!==i?i:.7;e.fillStyle=c;for(let o=0;t.topPath.length-1>o;o++)e.globalAlpha=.5*(u[o]+u[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=vt(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*(u[n]+u[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 d=null!==(r=t.style.opacity)&&void 0!==r?r:1;if(Fi(e,t),t.fillGradient&&("colorStops"in t.fillGradient&&t.fillGradient.colorStops.length>=2||"topOpacity"in t.fillGradient)&&t.fillGradient){let 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=wt(e,t.fillGradient,"string"==typeof c?c:"#4e79a7",0,n,0,o);e.fillStyle=i||c,e.globalAlpha=d}else{const n=null!==(a=t.style.fillOpacity)&&void 0!==a?a:.7;e.globalAlpha=n*d,e.fillStyle=c}if(e.fill(),t._pulseIntensity&&t._pulseIntensity>0&&(Fi(e,t),Ii(e,t)),t.style.stroke&&"none"!==t.style.stroke){e.globalAlpha=d;const n=t.strokeGradient&&t.topPath.length>=2?At(e,t.strokeGradient,t.topPath[0][0],0,t.topPath[t.topPath.length-1][0],0):null;e.strokeStyle=n||vt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);const o=xt(t.curve);if(e.beginPath(),o)s.line().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!==l&&1>l&&e.restore(),n&&e.restore(),e.globalAlpha=1}},Wi=(e,t,n,o)=>{var i,r;const s=t.filter(e=>"point"===e.type);if(0!==s.length){e.save();try{const t=e.globalAlpha;for(const n of s){e.beginPath(),e.arc(n.x,n.y,n.r,0,2*Math.PI);const o=null!==(r=null!==(i=n.style.opacity)&&void 0!==i?i:n.style.fillOpacity)&&void 0!==r?r:1;e.globalAlpha=t*o,e.fillStyle=kt(e,n.style.fill,"#4e79a7"),e.fill(),n.style.stroke&&(e.strokeStyle=kt(e,n.style.stroke,n.style.stroke),e.lineWidth=n.style.strokeWidth||1,e.stroke()),Di(e,n)}}finally{e.restore()}}},zi=new Map;function Yi(e){var t;try{if(e.path)return new Path2D(e.path);const n=`${null!==(t=e.symbolType)&&void 0!==t?t:"circle"}:${Math.round(e.size)}`;let o=zi.get(n);return o||(o=new Path2D(Ge(e.symbolType,e.size)),zi.size>256&&zi.clear(),zi.set(n,o)),o}catch(e){return null}}const Gi=(e,t)=>{var n,o,i,r;const s=e.globalAlpha;for(const a of t){if("symbol"!==a.type)continue;const t=a;if(0>=t.size)continue;const l=Yi(t);if(!l)continue;e.save(),e.translate(t.x,t.y),t.rotation&&e.rotate(t.rotation);const c=(null!==(n=t.style.opacity)&&void 0!==n?n:1)*(null!==(o=t._decayOpacity)&&void 0!==o?o:1);t.style.fill&&(e.globalAlpha=s*c*(null!==(i=t.style.fillOpacity)&&void 0!==i?i:1),e.fillStyle=kt(e,t.style.fill,"#4e79a7"),e.fill(l)),t.style.stroke&&"none"!==t.style.stroke&&(e.globalAlpha=s*c,e.strokeStyle=kt(e,t.style.stroke,t.style.stroke),e.lineWidth=null!==(r=t.style.strokeWidth)&&void 0!==r?r:1,e.stroke(l)),e.restore()}e.globalAlpha=s};function qi(e,t){const{x:n,y:o,w:i,h:r}=t,{tl:s,tr:a,br:l,bl:c}=vo(t);e.beginPath(),e.moveTo(n+s,o),e.lineTo(n+i-a,o),a>0&&e.arcTo(n+i,o,n+i,o+a,a),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+s),s>0&&e.arcTo(n,o,n+s,o,s),e.closePath()}function Xi(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 Vi=(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)Ui(e,t);else if(t.cornerRadii&&mo(t.cornerRadii)){const n=kt(e,t.style.fill,vt(e,"var(--semiotic-primary, #007bff)")),o=Xi(t),i=t.fillGradient&&"string"==typeof n?wt(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=i||n,qi(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=vt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else if(t.roundedTop&&t.roundedTop>0){const n=kt(e,t.style.fill,vt(e,"var(--semiotic-primary, #007bff)")),o=Xi(t),i=t.fillGradient&&"string"==typeof n?wt(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:s,y:a,w:l,h:c}=t;switch(t.roundedEdge){case"right":e.moveTo(s,a),e.lineTo(s+l-r,a),e.arcTo(s+l,a,s+l,a+r,r),e.lineTo(s+l,a+c-r),e.arcTo(s+l,a+c,s+l-r,a+c,r),e.lineTo(s,a+c);break;case"left":e.moveTo(s+l,a),e.lineTo(s+r,a),e.arcTo(s,a,s,a+r,r),e.lineTo(s,a+c-r),e.arcTo(s,a+c,s+r,a+c,r),e.lineTo(s+l,a+c);break;case"bottom":e.moveTo(s,a),e.lineTo(s+l,a),e.lineTo(s+l,a+c-r),e.arcTo(s+l,a+c,s+l-r,a+c,r),e.lineTo(s+r,a+c),e.arcTo(s,a+c,s,a+c-r,r);break;default:e.moveTo(s,a+c),e.lineTo(s,a+r),e.arcTo(s,a,s+r,a,r),e.lineTo(s+l-r,a),e.arcTo(s+l,a,s+l,a+r,r),e.lineTo(s+l,a+c)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=vt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const n=kt(e,t.style.fill,vt(e,"var(--semiotic-primary, #007bff)")),o=Xi(t),i=t.fillGradient&&"string"==typeof n?wt(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=vt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}Bi(e,t),e.globalAlpha=1}};function Ui(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,s=t.x+(t.w-i)/2;for(let o=t.y+t.h-i;o>=t.y-i;o-=r)e.drawImage(n,s,o,i,i)}else{const r=i+o,s=t.y+(t.h-i)/2;for(let o=t.x;t.x+t.w>o;o+=r)e.drawImage(n,o,s,i,i)}e.restore()}function Qi(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 Ki(e){return Number.isInteger(e)?e+"":100>Math.abs(e)?1>Math.abs(e)?e.toPrecision(3):e.toFixed(1):e.toFixed(0)}const Zi=(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=vt(e,"var(--semiotic-surface, #fff)"),e.lineWidth=1,e.strokeRect(t.x,t.y,t.w,t.h),Bi(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):Ki(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=Qi(t.fill),e.font=o+"px sans-serif",e.textAlign="center",e.textBaseline="middle",e.fillText(n,i,r)}}}finally{e.restore()}},Ji=(e,t,n,o)=>{var i,r,s;for(const n of t){if("candlestick"!==n.type)continue;const t=n;e.save();const a=(null!==(i=t._decayOpacity)&&void 0!==i?i:1)*(null!==(s=null===(r=t.style)||void 0===r?void 0:r.opacity)&&void 0!==s?s:1);1!==a&&(e.globalAlpha=a);const l=vt(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=vt(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 er(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 tr(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 nr(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 s=Object.assign({},n);return o&&(s[e.key]=e.fn(n)),r&&(s[t.key]=t.fn(n)),s});return i?r:o}}const ir=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function rr(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`${ir[t.getUTCMonth()]} ${t.getUTCDate()}`}:5*n>t?e=>{const t=new Date(e);return`${ir[t.getUTCMonth()]} ${t.getUTCFullYear()}`}:e=>new Date(e).getUTCFullYear()+""}const sr={line:[Hi,Ni,Wi],area:[Hi,Wi],stackedarea:[Hi,Wi],scatter:[Wi,Gi],bubble:[Wi,Gi],heatmap:[Zi],bar:[Vi],swarm:[Wi],waterfall:[(e,t,n,o)=>{var i;Vi(e,t);const r=t.filter(e=>"rect"===e.type);if(2>r.length)return;const s=r[0].datum,a=null==s?void 0:s._connectorStroke;if(a){e.save(),e.strokeStyle=vt(e,a)||a,e.lineWidth=null!==(i=null==s?void 0:s._connectorWidth)&&void 0!==i?i:1,e.setLineDash([]);for(let t=0;r.length-1>t;t++){const o=r[t],i=r[t+1],s=o.datum,a=i.datum;if(null==(null==s?void 0:s.cumEnd)||null==(null==a?void 0:a.baseline))continue;const l=n.y(s.cumEnd),c=o.x+o.w,u=i.x;e.beginPath(),e.moveTo(c,l),e.lineTo(u,l),e.stroke()}e.restore()}}],candlestick:[Ji],mixed:[Hi,Ni,Wi],custom:[Hi,Vi,Zi,Ni,Wi,Gi,Ji]},ar={top:20,right:20,bottom:30,left:40},lr={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 cr(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 ur={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 dr({hover:t}){var n,o,i;const r=e=>null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+"",s=null!==(n=t.data)&&void 0!==n?n:{},a=null!==(o=s.y)&&void 0!==o?o:s.value,l=null!==(i=s.x)&&void 0!==i?i:s.time;return e.jsxs("div",{className:"semiotic-tooltip",style:ur,children:[e.jsx("div",{style:{fontWeight:600,marginBottom:2},children:r(a)}),e.jsx("div",{style:{opacity:.7,fontSize:11},children:r(l)})]})}dr.ownsChrome=!0;const hr=t.forwardRef(function(n,o){var i,r,s,a,l,c,u,d,h,g,f,y,m;const{chartType:v,runtimeMode:x,data:A,chunkThreshold:j,chunkSize:O,xAccessor:M,yAccessor:C,colorAccessor:_,sizeAccessor:P,symbolAccessor:L,symbolMap:T,groupAccessor:R,lineDataAccessor:$,curve:N,normalize:E,baseline:B,stackOrder:D,binSize:I,valueAccessor:F,arrowOfTime:H="right",windowMode:W="sliding",windowSize:z=200,timeAccessor:Y,xExtent:G,yExtent:q,extentPadding:X=.1,scalePadding:V,sizeRange:U,size:Q=[500,300],responsiveWidth:K,responsiveHeight:Z,margin:J,className:ee,background:te,lineStyle:ne,pointStyle:oe,areaStyle:ie,barStyle:re,waterfallStyle:se,swarmStyle:ae,barColors:le,colorScheme:ce,boundsAccessor:ue,boundsStyle:de,y0Accessor:he,band:ge,gradientFill:fe,lineGradient:pe,areaGroups:ye,openAccessor:me,highAccessor:ve,lowAccessor:be,closeAccessor:xe,candlestickStyle:ke,showAxes:we=!0,axes:Ae,xLabel:je,yLabel:Se,yLabelRight:Oe,xFormat:Me,yFormat:Ce,axisExtent:_e,tickFormatTime:Pe,tickFormatValue:Le,hoverAnnotation:Te,tooltipContent:Re,customHoverBehavior:$e,customClickBehavior:Ne,enableHover:Ee,hoverRadius:Be=30,tooltipMode:De,annotations:Fe,autoPlaceAnnotations:He,svgAnnotationRules:We,showGrid:ze,legend:Ye,legendHoverBehavior:Ge,legendClickBehavior:qe,legendHighlightedCategory:Xe,legendIsolatedCategories:Ve,legendPosition:Ue,legendLayout:Qe,legendCategoryAccessor:Ke,onCategoriesChange:Ze,backgroundGraphics:tt,foregroundGraphics:nt,canvasPreRenderers:ot,svgPreRenderers:rt,title:st,categoryAccessor:at,brush:lt,onBrush:ct,decay:ut,pulse:dt,transition:ht,animate:gt,staleness:ft,heatmapAggregation:pt,heatmapXBins:yt,heatmapYBins:mt,showValues:bt,heatmapValueFormat:xt,marginalGraphics:kt,pointIdAccessor:wt,xScaleType:At,yScaleType:jt,accessibleTable:Ct=!0,description:_t,summary:Pt,linkedCrosshairName:Lt,linkedCrosshairSourceId:Tt,customLayout:Rt,layoutConfig:$t,layoutSelection:Nt}=n,Ft=t.useId().replace(/:/g,""),Ht=t.useRef(!1),zt=t.useRef({w:-1,h:-1}),Yt=Pi({sizeProp:Q,responsiveWidth:K,responsiveHeight:Z,userMargin:J,marginDefault:ar,animate:gt,transitionProp:ht,themeDirtyRef:Ht}),Vt=Co(),Ut=To(),{reducedMotionRef:Qt,responsiveRef:Kt,size:Zt,currentTheme:Jt,transition:en,introEnabled:tn,tableId:nn,rafRef:on,renderFnRef:rn,scheduleRender:sn}=Yt;let an=Yt.margin;if(kt){const e=60,t=Object.assign({},Yt.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),an=t}const ln="function"==typeof nt?nt({size:Zt,margin:an}):nt,cn="function"==typeof tt?tt({size:Zt,margin:an}):tt,un=Zt[0]-an.left-an.right,dn=Zt[1]-an.top-an.bottom,hn=t.useMemo(()=>k(A),[A]),gn=null!=Te?Te:Ee,fn=t.useRef(null),pn=t.useRef(null),[yn,mn]=t.useState(0),vn=t.useRef(0),[bn,xn]=t.useState(null),kn=t.useRef(null),wn=t.useRef(null),[An,jn]=t.useState(null),Sn=t.useRef(lr.primary),On=t.useRef([]),Mn=t.useRef(Ke),Cn=t.useRef(Ze);Mn.current=Ke,Cn.current=Ze;const[_n,Pn]=t.useState(!1),[Ln,Tn]=t.useState([]),[Rn,$n]=t.useState([]),Nn="streaming"===x||["bar","swarm","waterfall"].includes(v),En=t.useMemo(()=>{var e,t,n;return{chartType:v,runtimeMode:Nn?"streaming":"bounded",windowSize:z,windowMode:W,arrowOfTime:Nn?H:"right",extentPadding:X,scalePadding:V,axisExtent:_e,xAccessor:M,yAccessor:C,timeAccessor:Nn?Y:void 0,valueAccessor:F,colorAccessor:_,sizeAccessor:P,symbolAccessor:L,symbolMap:T,groupAccessor:R||($?"_lineGroup":void 0),categoryAccessor:at,lineDataAccessor:$,xScaleType:At,yScaleType:jt,xExtent:G,yExtent:q,sizeRange:U,binSize:I,normalize:E,baseline:B,stackOrder:D,boundsAccessor:ue,boundsStyle:de,y0Accessor:he,band:ge,gradientFill:!0===fe?{topOpacity:.8,bottomOpacity:.05}:!1===fe?void 0:fe,areaGroups:ye?new Set(ye):void 0,lineGradient:pe,openAccessor:me,highAccessor:ve,lowAccessor:be,closeAccessor:xe,candlestickStyle:ke,lineStyle:ne,pointStyle:oe,areaStyle:ie,swarmStyle:ae,waterfallStyle:se,colorScheme:ce,barColors:le,barStyle:re,annotations:Fe,decay:ut,pulse:dt,transition:en,introAnimation:tn,staleness:ft,heatmapAggregation:pt,heatmapXBins:yt,heatmapYBins:mt,showValues:bt,heatmapValueFormat:xt,pointIdAccessor:wt,curve:N,themeCategorical:null===(e=null==Jt?void 0:Jt.colors)||void 0===e?void 0:e.categorical,themeSemantic:S(Jt),themeSequential:null===(t=null==Jt?void 0:Jt.colors)||void 0===t?void 0:t.sequential,themeDiverging:null===(n=null==Jt?void 0:Jt.colors)||void 0===n?void 0:n.diverging,customLayout:Rt,layoutConfig:$t,layoutMargin:an}},[v,z,W,H,X,V,_e,M,C,Y,F,At,jt,_,P,L,T,R,at,$,G,q,U,I,E,B,D,ue,de,he,ge,fe,pe,ye,me,ve,be,xe,ke,ne,oe,ie,ae,se,re,ce,le,Fe,ut,dt,null==en?void 0:en.duration,null==en?void 0:en.easing,tn,ft,pt,yt,mt,bt,xt,Nn,wt,N,Jt,Rt,$t,an]),Bn=$o(En),Dn=t.useRef(null);Dn.current||(Dn.current=new Je(Bn));const In=t.useCallback(()=>{var e,t;const n=Mn.current,o=Cn.current;if(!o||!n)return;const i=er(null!==(t=null===(e=Dn.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[],n);tr(i,On.current)||(On.current=i,o(i))},[]);t.useEffect(()=>{var e;null===(e=Dn.current)||void 0===e||e.updateConfig(Bn),Ht.current=!0,sn()},[Bn,sn]);const Fn=t.useRef(null);t.useEffect(()=>{const e=Dn.current;if(!e)return;const t=null!=Nt?Nt:null;Fn.current!==t&&(Fn.current=t,e.setLayoutSelection(t),e.hasCustomRestyle?e.restyleScene(t):Ht.current=!0,sn())},[Nt,sn]);const Hn=t.useRef(null);Hn.current||(Hn.current=new w(e=>{const t=Dn.current;t&&t.ingest(e)&&(Ht.current=!0,sn())},{chunkThreshold:j,chunkSize:O})),t.useEffect(()=>{var e;null===(e=Hn.current)||void 0===e||e.updateChunkOptions({chunkThreshold:j,chunkSize:O})},[j,O]);const Wn=t.useCallback(e=>{var t;null===(t=Hn.current)||void 0===t||t.push(e)},[]),zn=t.useCallback(e=>{var t;null===(t=Hn.current)||void 0===t||t.pushMany(e)},[]),Yn=t.useCallback(()=>{var e,t;null===(e=Hn.current)||void 0===e||e.clear(),null===(t=Dn.current)||void 0===t||t.clear(),Ht.current=!0,sn()},[sn]);t.useImperativeHandle(o,()=>({push:Wn,pushMany:zn,remove:e=>{var t,n,o;null===(t=Hn.current)||void 0===t||t.flush();const i=null!==(o=null===(n=Dn.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[];return i.length>0&&(kn.current&&i.some(e=>{var t;return e===(null===(t=kn.current)||void 0===t?void 0:t.data)})&&(kn.current=null,jn(null)),Ht.current=!0,sn()),i},update:(e,t)=>{var n,o,i;null===(n=Hn.current)||void 0===n||n.flush();const r=null!==(i=null===(o=Dn.current)||void 0===o?void 0:o.update(e,t))&&void 0!==i?i:[];return r.length>0&&(Ht.current=!0,sn()),r},clear:Yn,getData:()=>{var e,t,n;return null===(e=Hn.current)||void 0===e||e.flush(),null!==(n=null===(t=Dn.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Dn.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null},getExtents:()=>{var e,t;return null!==(t=null===(e=Dn.current)||void 0===e?void 0:e.getExtents())&&void 0!==t?t:null}}),[Wn,zn,Yn,sn]),t.useEffect(()=>{var e,t;if(A){if($&&hn.length>0&&"object"==typeof hn[0]&&null!==hn[0]){const t="string"==typeof $?$:"coordinates";if(Array.isArray(hn[0][t])){const n=[];for(const e of hn){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(hn)}},[A,hn,$]);const{hoverHandlerRef:Gn,hoverLeaveRef:qn,onPointerMove:Xn,onPointerLeave:Vn}=Yt;Gn.current=e=>{var t,n,o,i;if(!gn)return;const r=fn.current;if(!r)return;const s=r.getBoundingClientRect(),a=e.clientX-s.left-an.left,l=e.clientY-s.top-an.top;if(0>a||a>un||0>l||l>dn)return void(kn.current&&(kn.current=null,wn.current=null,jn(null),$e&&($e(null),Ht.current=!0),sn()));const c=Dn.current;if(!c||0===c.scene.length)return;const u=Ot(c.scene,a,l,Be,c.quadtree,c.maxPointRadius),d="multi"===De,h=()=>{kn.current&&(kn.current=null,wn.current=null,jn(null),$e&&$e(null),sn())};if(!u&&!d)return void h();const g=d||!u?a:u.x,f=d||!u?l:u.y,p=(null==u?void 0:u.datum)?Ie(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 b=hi(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=Mt(St(e.path,e.curve),t,n);if(null===r)continue;const s=Et(e.path,t);o.push({node:i,datum:Array.isArray(e.datum)&&e.datum[s]?e.datum[s]:e.datum,x:e.path[s][0],y:r,group:e.group,color:e.style.stroke})}else if("area"===i.type){const e=i;if(!1===e.interactive)continue;if(2>e.topPath.length)continue;const r=St(e.topPath,e.curve),s=St(e.bottomPath,e.curve),a=Mt(r,t,n);if(null===a)continue;const l=Mt(s,t,n),c=Et(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:a,y0:null!=l?l:void 0,group:e.group,color:"string"==typeof e.style.stroke?e.style.stroke:"string"==typeof e.style.fill?e.style.fill:void 0})}return o}(c.scene,g,Math.max(Be,un));if(e.length>0){const t=c.scales.y.invert,n=Sn.current,o=y?y(g):g;if(u)b.xValue=o,b.xPx=g;else{const e={xValue:o};"string"==typeof M&&(e[M]=o),b=hi(e,g,f,{xValue:o,xPx:g})}b.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"===v&&null!=i?o-i:o,valuePx:e.y,color:e.color||n,datum:Ie(e.datum,c.resolvedRibbons)}})}}u||(null===(o=b.allSeries)||void 0===o?void 0:o.length)?(kn.current=b,wn.current=null!==(i=null==u?void 0:u.node)&&void 0!==i?i:null,jn(b),$e&&($e(b),Ht.current=!0),sn()):h()},qn.current=()=>{kn.current&&(kn.current=null,wn.current=null,jn(null),$e&&($e(null),Ht.current=!0),sn())};const Un=t.useRef(()=>{});Un.current=e=>{var t,n;if(!Ne)return;const o=fn.current;if(!o)return;const i=o.getBoundingClientRect(),r=e.clientX-i.left-an.left,s=e.clientY-i.top-an.top;if(0>r||r>un||0>s||s>dn)return void Ne(null);const a=Dn.current;if(!a||0===a.scene.length)return void Ne(null);const l=Ot(a.scene,r,s,Be,a.quadtree,a.maxPointRadius);if(!l)return void Ne(null);const c=l.datum||{},u=null===(n=null===(t=a.scales)||void 0===t?void 0:t.x)||void 0===n?void 0:n.invert,d="function"==typeof u?u(l.x):void 0;Ne(hi(c,l.x,l.y,null!=d?{xValue:d,xPx:l.x}:void 0))};const Qn=t.useCallback(e=>Un.current(e),[]),Kn=t.useRef(-1),Zn=t.useRef(null),Jn=t.useRef(null),eo=t.useCallback(e=>{const t=Dn.current;if(!t||0===t.scene.length)return;const n=t.version;let o;if(Jn.current&&Jn.current.version===n)o=Jn.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"symbol":if(0>=r.size)break;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=Bt(e),Jn.current={version:n,graph:o}}const i=Kn.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),Kn.current=0;const n=o.flat[0];Zn.current={shape:n.shape,w:n.w,h:n.h};const i=Wt(Object.assign(Object.assign({},n),{datum:Ie(n.datum,t.resolvedRibbons)}));return kn.current=i,jn(i),$e&&$e(i),void sn()}const r=Dt(o,i),s=It(e.key,r,o);if(null===s)return;if(e.preventDefault(),0>s)return Kn.current=-1,Zn.current=null,kn.current=null,wn.current=null,jn(null),$e&&$e(null),void sn();Kn.current=s;const a=o.flat[s];Zn.current={shape:a.shape,w:a.w,h:a.h};const l=Wt(Object.assign(Object.assign({},a),{datum:Ie(a.datum,t.resolvedRibbons)}));kn.current=l,jn(l),$e&&$e(l),sn()},[$e,sn]),to=t.useCallback(e=>{Kn.current=-1,Zn.current=null,Xn(e)},[Xn]);rn.current=()=>{on.current=0;const e=fn.current,t=pn.current;if(!e||!t)return;const n=Dn.current;if(!n)return;const o="undefined"!=typeof performance?performance.now():Date.now(),i=n.advanceTransition(Qt.current?o+1e6:o),r=!Qt.current&&i,s=zt.current.w!==un||zt.current.h!==dn,a=Ht.current||i||s;let l=!1;!a||r&&!s||(n.computeScene({width:un,height:dn}),zt.current={w:un,h:dn},l=!0,In());const c=Ti(),u=function(e){if(!e)return lr;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(),s=o||t.getPropertyValue("--text-secondary").trim(),a=t.getPropertyValue("--text-primary").trim(),l=n||t.getPropertyValue("--surface-3").trim(),c=i||t.getPropertyValue("--surface-0").trim();return s||a||n||r?{axisStroke:l||lr.axisStroke,tickText:s||lr.tickText,crosshair:s?cr(s,"66"):lr.crosshair,hoverFill:c?cr(c,"4D"):lr.hoverFill,hoverStroke:s?cr(s,"99"):lr.hoverStroke,pointRing:c||lr.pointRing,primary:r||lr.primary}:lr}(e);Sn.current=u.primary;const d=Gt(ft,n.lastIngestTime>0?o-n.lastIngestTime:0),h=ft&&d.isStale;if(a){const t=Li(e,Zt,an,c);if(t){if(t.clearRect(-an.left,-an.top,Zt[0],Zt[1]),ft&&1>d.alpha&&(t.globalAlpha=d.alpha),"transparent"!==te&&!tt){const n=getComputedStyle(e).getPropertyValue("--semiotic-bg").trim(),o=te||(n&&"transparent"!==n?n:null),i=o?vt(t,o):null;i&&(t.fillStyle=i,t.fillRect(-an.left,-an.top,Zt[0],Zt[1]))}if(t.save(),"function"==typeof t.rect&&(t.beginPath(),t.rect(0,0,un,dn),t.clip()),ot&&n.scales)for(const e of ot)t.save(),e(t,n.scene,n.scales,{width:un,height:dn}),t.restore();const o=Rt?sr.custom:sr[v];if(o&&n.scales)for(const e of o)e(t,n.scene,n.scales,{width:un,height:dn});t.restore(),ft&&1>d.alpha&&(t.globalAlpha=1)}}{const e=Li(t,Zt,an,c);if(e&&(e.clearRect(-an.left,-an.top,Zt[0],Zt[1]),gn&&kn.current&&n.scales&&function(e,t,n,o,i,r,s){var a;if(!1===i.crosshair)return;const l=t.allSeries,c=l&&l.length>0,u=null!==(a=t.xPx)&&void 0!==a?a:t.x;e.save();const d="object"==typeof i.crosshair?i.crosshair:{};if(e.strokeStyle=d.stroke||s.crosshair,e.lineWidth=d.strokeWidth||1,e.setLineDash(d.strokeDasharray?d.strokeDasharray.split(/[\s,]+/).map(Number):[4,4]),e.beginPath(),e.moveTo(c?u:t.x,0),e.lineTo(c?u:t.x,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=s.pointRing;for(const t of l)null!=t.valuePx&&(e.beginPath(),e.arc(u,t.valuePx,4,0,2*Math.PI),e.fillStyle=t.color||s.primary,e.fill(),e.stroke())}else{const 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)||s.primary;e.beginPath(),e.arc(t.x,t.y,4,0,2*Math.PI),e.fillStyle=n,e.fill(),e.strokeStyle=s.pointRing,e.lineWidth=2,e.stroke()}}(e,kn.current,un,dn,"object"==typeof gn?gn:{},wn.current,u),wn.current&&Array.isArray(Te))){const t=Te.find(e=>e&&"object"==typeof e&&"highlight"===e.type);t&&function(e,t,n,o,i){var r;if(!n)return;const s="group"in n?n.group:void 0;if(void 0!==s)for(const n of t){if("line"!==n.type)continue;if(n.group!==s)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,n.scene,wn.current,t,u)}}a&&e&&e.setAttribute("aria-label",Wo(n.scene,v+" chart"));const g=Ht.current;if(Ht.current=g&&r&&!l,g&&n.scales){const e=e=>"object"==typeof e&&null!==e&&"function"==typeof e.valueOf?e.valueOf():e;if((!bn||e(bn.x.domain()[0])!==e(n.scales.x.domain()[0])||e(bn.x.domain()[1])!==e(n.scales.x.domain()[1])||e(bn.y.domain()[0])!==e(n.scales.y.domain()[0])||e(bn.y.domain()[1])!==e(n.scales.y.domain()[1])||bn.x.range()[0]!==n.scales.x.range()[0]||bn.x.range()[1]!==n.scales.x.range()[1]||bn.y.range()[0]!==n.scales.y.range()[0]||bn.y.range()[1]!==n.scales.y.range()[1])&&xn(n.scales),kt){const e=n.getData(),t="function"==typeof M?M:e=>e[M||"x"],o="function"==typeof C?C:e=>e[C||"y"];Tn(e.map(e=>t(e)).filter(e=>"number"==typeof e&&isFinite(e))),$n(e.map(e=>o(e)).filter(e=>"number"==typeof e&&isFinite(e)))}}!((Fe&&Fe.length>0||Rt)&&(l||r))||!l&&33>o-vn.current||(mn(e=>e+1),vn.current=o),(null==ft?void 0:ft.showBadge)&&Pn(!!h),(r||null!=n.activeTransition||n.hasActivePulses)&&(on.current=requestAnimationFrame(()=>rn.current()))},Ro({hydrated:Vt,wasHydratingFromSSR:Ut,storeRef:Dn,dirtyRef:Ht,renderFnRef:rn,cleanup:()=>{var e;return null===(e=Hn.current)||void 0===e?void 0:e.clear()}}),t.useEffect(()=>{Ht.current=!0,sn()},[v,un,dn,we,te,ne,ot,sn]),qt(ft,Dn,Ht,sn,_n,Pn);const no=t.useMemo(()=>{if(Me||Pe)return;const e=Dn.current;return(null==e?void 0:e.xIsDate)&&bn?rr(bn.x.domain()):void 0},[Me,Pe,bn]),oo=Me||Pe||no,io=gn&&An?Re?Re(An):e.jsx(dr,{hover:An}):null,ro=io?e.jsx(Si,{x:An.x,y:An.y,containerWidth:un,containerHeight:dn,margin:an,className:"stream-frame-tooltip",children:io}):null,so=Zn.current,ao=e.jsx(ui,{active:Kn.current>=0,hoverPoint:An,margin:an,size:Zt,shape:null==so?void 0:so.shape,width:null==so?void 0:so.w,height:null==so?void 0:so.h}),lo=nr(M,Y,"__semiotic_resolvedX","__semiotic_resolvedTime"),co=nr(C,F,"__semiotic_resolvedY","__semiotic_resolvedValue"),uo=lo.key,ho=co.key,fo=or(lo,co,Fe&&Fe.length>0||!1);if(Oo||!Vt&&Ut){const t=Dn.current;t&&A&&(t.ingest({inserts:hn,bounded:!0}),t.computeScene({width:un,height:dn}));const n=null!==(i=null==t?void 0:t.scene)&&void 0!==i?i:[],o=null!==(r=null==t?void 0:t.scales)&&void 0!==r?r:null,a=oo||(()=>{if((null==t?void 0:t.xIsDate)&&o)return rr(o.x.domain())})();return e.jsxs("div",{ref:Kt,className:"stream-xy-frame"+(ee?" "+ee:""),role:"img","aria-label":_t||("string"==typeof st?st:"XY chart"),style:{position:"relative",width:K?"100%":Zt[0],height:Z?"100%":Zt[1]},children:[e.jsx(si,{summary:Pt}),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:Zt[0],height:Zt[1],style:{position:"absolute",left:0,top:0},children:[e.jsx("g",{transform:`translate(${an.left},${an.top})`,children:cn}),e.jsxs("g",{transform:`translate(${an.left},${an.top})`,children:[te&&e.jsx("rect",{x:0,y:0,width:un,height:dn,fill:te}),rt&&o&&rt.map((t,i)=>e.jsx(p.Fragment,{children:t(n,o,{width:un,height:dn})},"svgpre-"+i)),n.map((t,n)=>function(t,n,o){var i,r,s,a,l;switch(t.type){case"line":{const o=t;if(0===o.path.length)return null;const i="M"+o.path.map(([e,t])=>`${e},${t}`).join("L");return e.jsx("path",{d:i,fill:"none",stroke:o.style.stroke||"#4e79a7",strokeWidth:o.style.strokeWidth||2,strokeDasharray:o.style.strokeDasharray,opacity:o.style.opacity},"line-"+n)}case"area":{const l=t;if(0===l.topPath.length)return null;const c=`M${l.topPath.map(([e,t])=>`${e},${t}`).join("L")}L${[...l.bottomPath].reverse().map(([e,t])=>`${e},${t}`).join("L")}Z`;if(l.clipRect){const t=`${o?o+"-":""}area-clip-${n}`;return e.jsxs("g",{children:[e.jsx("defs",{children:e.jsx("clipPath",{id:t,children:e.jsx("rect",{x:l.clipRect.x,y:l.clipRect.y,width:l.clipRect.width,height:l.clipRect.height})})}),e.jsx("path",{d:c,fill:Ao(l.style.fill),fillOpacity:null!==(r=null!==(i=l.style.fillOpacity)&&void 0!==i?i:l.style.opacity)&&void 0!==r?r:.7,stroke:l.style.stroke,strokeWidth:l.style.strokeWidth,clipPath:`url(#${t})`})]},"area-"+n)}return e.jsx("path",{d:c,fill:Ao(l.style.fill),fillOpacity:null!==(a=null!==(s=l.style.fillOpacity)&&void 0!==s?s:l.style.opacity)&&void 0!==a?a:.7,stroke:l.style.stroke,strokeWidth:l.style.strokeWidth},"area-"+n)}case"point":{const o=t;return e.jsx("circle",{cx:o.x,cy:o.y,r:o.r,fill:Ao(o.style.fill),opacity:null!==(l=o.style.opacity)&&void 0!==l?l:.8,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth},"point-"+n)}case"symbol":return jo(t,n);case"rect":{const o=t;return e.jsx("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:Ao(o.style.fill),opacity:o.style.opacity,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth},"rect-"+n)}case"heatcell":{const o=t;if(o.showValues&&null!=o.value&&o.w>=20&&o.h>=20){const t=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),[i,r,s]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(o.fill),a=.299*i+.587*r+.114*s>128?"#000":"#fff",l=Math.max(10,Math.min(16,.3*Math.min(o.w,o.h)));return e.jsxs("g",{children:[e.jsx("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:o.fill}),e.jsx("text",{x:o.x+o.w/2,y:o.y+o.h/2,textAnchor:"middle",dominantBaseline:"middle",fill:a,fontSize:l+"px",children:t})]},"heatcell-"+n)}return e.jsx("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:o.fill},"heatcell-"+n)}case"candlestick":{const o=t,i=Math.min(o.openY,o.closeY),r=Math.max(Math.abs(o.openY-o.closeY),1),s=o.isUp?o.upColor:o.downColor;return e.jsxs("g",{children:[e.jsx("line",{x1:o.x,y1:o.highY,x2:o.x,y2:o.lowY,stroke:o.wickColor,strokeWidth:o.wickWidth}),e.jsx("rect",{x:o.x-o.bodyWidth/2,y:i,width:o.bodyWidth,height:r,fill:s,stroke:s,strokeWidth:1})]},"candle-"+n)}default:return null}}(t,n,Ft)).filter(Boolean)]})]}),e.jsx(yo,{width:un,height:dn,totalWidth:Zt[0],totalHeight:Zt[1],margin:an,scales:o,showAxes:we,axes:Ae,xLabel:je,yLabel:Se,yLabelRight:Oe,xFormat:a,yFormat:Ce||Le,axisExtent:_e,showGrid:ze,title:st,legend:Ye,legendHoverBehavior:Ge,legendClickBehavior:qe,legendHighlightedCategory:Xe,legendIsolatedCategories:Ve,legendPosition:Ue,legendLayout:Qe,foregroundGraphics:et(ln,it(null===(s=Dn.current)||void 0===s?void 0:s.customLayoutOverlays,null!=Nt?Nt:null)),marginalGraphics:kt,xValues:[],yValues:[],annotations:Fe,autoPlaceAnnotations:He,svgAnnotationRules:We,annotationFrame:0,xAccessor:uo,yAccessor:ho,annotationData:fo(null==t?void 0:t.getData()),pointNodes:null==t?void 0:t.scene.filter(e=>"point"===e.type),curve:"string"==typeof N?N:void 0,linkedCrosshairName:Lt,linkedCrosshairSourceId:Tt})]})}return e.jsxs("div",{ref:Kt,className:"stream-xy-frame"+(ee?" "+ee:""),role:"group","aria-label":_t||("string"==typeof st?st:"XY chart"),tabIndex:0,style:{position:"relative",width:K?"100%":Zt[0],height:Z?"100%":Zt[1],overflow:"visible"},onKeyDown:eo,children:[Ct&&e.jsx(ai,{tableId:nn}),Ct&&e.jsx(ii,{scene:null!==(l=null===(a=Dn.current)||void 0===a?void 0:a.scene)&&void 0!==l?l:[],chartType:v+" chart",tableId:nn,chartTitle:"string"==typeof st?st:void 0}),e.jsx(si,{summary:Pt}),e.jsx(li,{hoverPoint:An}),e.jsxs("div",{role:"img","aria-label":_t||("string"==typeof st?st:"XY chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:gn?to:void 0,onMouseLeave:gn?Vn:void 0,onClick:Ne?Qn:void 0,children:[cn&&e.jsx("svg",{style:{position:"absolute",left:0,top:0,width:Zt[0],height:Zt[1],pointerEvents:"none"},children:e.jsx("g",{transform:`translate(${an.left},${an.top})`,children:cn})}),e.jsx(go,{width:un,height:dn,totalWidth:Zt[0],totalHeight:Zt[1],margin:an,scales:bn,showAxes:we,axes:Ae,showGrid:ze,xFormat:oo,yFormat:Ce||Le,axisExtent:_e}),e.jsx("canvas",{ref:fn,"aria-label":Wo(null!==(u=null===(c=Dn.current)||void 0===c?void 0:c.scene)&&void 0!==u?u:[],v+" chart"),style:{position:"absolute",left:0,top:0}}),e.jsx("canvas",{ref:pn,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e.jsx(yo,{width:un,height:dn,totalWidth:Zt[0],totalHeight:Zt[1],margin:an,scales:bn,showAxes:we,axes:Ae,xLabel:je,yLabel:Se,yLabelRight:Oe,xFormat:oo,yFormat:Ce||Le,axisExtent:_e,showGrid:ze,title:st,legend:Ye,legendHoverBehavior:Ge,legendClickBehavior:qe,legendHighlightedCategory:Xe,legendIsolatedCategories:Ve,legendPosition:Ue,legendLayout:Qe,foregroundGraphics:et(ln,it(null===(d=Dn.current)||void 0===d?void 0:d.customLayoutOverlays,null!=Nt?Nt:null)),marginalGraphics:kt,xValues:Ln,yValues:Rn,annotations:Fe,autoPlaceAnnotations:He,svgAnnotationRules:We,annotationFrame:yn,xAccessor:uo,yAccessor:ho,annotationData:fo(null===(h=Dn.current)||void 0===h?void 0:h.getData()),pointNodes:null===(g=Dn.current)||void 0===g?void 0:g.scene.filter(e=>"point"===e.type),curve:"string"==typeof N?N:void 0,underlayRendered:!0,canvasObscuresUnderlay:"transparent"!==te&&!tt,linkedCrosshairName:Lt,linkedCrosshairSourceId:Tt}),(lt||ct)&&e.jsx(b,{width:un,height:dn,totalWidth:Zt[0],totalHeight:Zt[1],margin:an,dimension:null!==(f=null==lt?void 0:lt.dimension)&&void 0!==f?f:"xy",scales:bn,onBrush:null!=ct?ct:()=>{},binSize:I,snap:null==lt?void 0:lt.snap,binBoundaries:null!==(y=null==lt?void 0:lt.binBoundaries)&&void 0!==y?y:"bar"===v?null===(m=Dn.current)||void 0===m?void 0:m.getBinBoundaries():void 0,snapDuring:null==lt?void 0:lt.snapDuring,streaming:"streaming"===x}),(null==ft?void 0:ft.showBadge)&&e.jsx(Xt,{isStale:_n,position:ft.badgePosition}),ao,ro]})]})});function gr(e){const t=e.getSymbol;if(!t)return null;const n=e.config.symbolMap,o=new Map;let i=0;return e=>{const r=t(e)+"",s=null==n?void 0:n[r];if(s)return s;let a=o.get(r);return a||(a=Ye[i%Ye.length],i++,o.set(r,a)),a}}function fr(e,t,n,o,i,r,s){e.push(t?{type:"symbol",x:o,y:i,size:Math.PI*r*r,symbolType:t(n),style:s,datum:n}:{type:"point",x:o,y:i,r:r,style:s,datum:n})}function pr(e,t){var n;const{columns:o,config:i,resolvePieceStyle:r}=e,s=[],a=Math.min(t.width,t.height)/2-4,l="donut"===i.chartType?i.innerRadius||60:0,c=-Math.PI/2+(i.startAngle||0)*Math.PI/180,u=null!=i.sweepAngle?i.sweepAngle*Math.PI/180:2*Math.PI,d=null!=i.sweepAngle&&360>i.sweepAngle,h=Object.values(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:a,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),s.push(v)}return s}function yr(e){var t,n,o;const i=e.length,r=e[0],s=e[i-1];return{n:i,min:r,q1:null!==(t=a.quantile(e,.25))&&void 0!==t?t:r,median:null!==(n=a.quantile(e,.5))&&void 0!==n?n:(r+s)/2,q3:null!==(o=a.quantile(e,.75))&&void 0!==o?o:s,max:s,mean:e.reduce((e,t)=>e+t,0)/i}}function mr(e,t,n){if(Array.isArray(e)&&e.length>0)return e;if("string"==typeof e){const t=be[e];if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:n}function vr(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"}}hr.displayName="StreamXYFrame";const br={bar:function(e,t){var n,o,i;const{scales:r,columns:s,config:a,getR:l,getStack:c,resolvePieceStyle:u}=e,{r:d,projection:h}=r,g=[],f="vertical"===h,p="horizontal"===h,y=a.normalize,m=[];if(c){const e=new Set;for(const t of Object.values(s))for(const 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(s)){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 s=t.get(r);if(!s)continue;let a=s.total;y&&n>0&&(a/=n);const l=u(s.pieces[0],c?r:e.name),h=Object.assign(Object.assign({},s.pieces[0]),{__aggregateValue:s.total,__pieceCount:s.pieces.length,category:e.name});if(f){const t=d(0>a?i:o+a),n=0>a?d(i+a)-d(i):d(o)-d(o+a);g.push(W(e.x,t,e.width,Math.abs(n),l,h,r)),0>a?i+=a:o+=a}else if(p){const t=d(0>a?i+a:o),n=0>a?d(i)-d(i+a):d(o+a)-d(o);g.push(W(t,e.x,Math.abs(n),e.width,l,h,r)),0>a?i+=a:o+=a}}}const v="vertical"===h,b=a.roundedTop&&a.roundedTop>0?Math.max(0,a.roundedTop):0;for(const e of g){if("rect"!==e.type)continue;const t=null!==(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",a.gradientFill&&(e.fillGradient=a.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:s,resolvePieceStyle:a}=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=s?s(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=s?s(t):"_default";i.has(e)||i.set(e,[]),i.get(e).push(t)}for(let s=0;h.length>s;s++){const c=i.get(h[s])||[];for(const i of c){const c=r(i),g=a(i,h[s]);if(d){const r=e.x+s*t+n/2,a=l(0),d=l(c);u.push(W(r,Math.min(a,d),o,Math.abs(a-d),g,i,h[s]))}else{const r=e.x+s*t+n/2,a=l(0),d=l(c);u.push(W(Math.min(a,d),r,Math.abs(d-a),o,g,i,h[s]))}}}}const p=i.roundedTop&&i.roundedTop>0?Math.max(0,i.roundedTop):0;for(const e of u){if("rect"!==e.type)continue;if(null==e.datum)continue;const t=r(e.datum);p>0&&(e.roundedTop=p),e.roundedEdge=d?0>t?"bottom":"top":0>t?"left":"right",i.gradientFill&&(e.fillGradient=i.gradientFill)}return u},point:function(e,t){var n,o;const{scales:i,columns:r,getR:s,multiScales:a,resolvePieceStyle:l}=e,{r:c,projection:u}=i,d=[],h="vertical"===u,g="radial"===u,f=a.length>0,p=gr(e),y=2*Math.PI,m=-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:s(t),u=f&&a[i]||c,v=l(t,e.name),b=v.r||5;let x,k;if(g){const t=m+(e.pctStart+e.pct/2)*y,n=u(r);x=Math.cos(t)*n,k=Math.sin(t)*n}else h?(x=e.middle,k=u(r)):(x=u(r),k=e.middle);fr(d,p,t,x,k,b,v)}return d},swarm:function(e,t){const{scales:n,columns:o,getR:i,resolvePieceStyle:r}=e,{r:s,projection:a}=n,l=[],c="vertical"===a,u=gr(e);for(const e of Object.values(o)){const t=e.width/2;for(let n=0;e.pieceData.length>n;n++){const o=e.pieceData[n],a=i(o),d=r(o,e.name),h=d.r||4,g=(7919*n%100/100-.5)*t*.8;fr(l,u,o,c?e.middle+g:s(a),c?s(a):e.middle+g,h,d)}}return l},pie:pr,donut:pr,boxplot:function(e,t){var n,o,i,r,s,l;const{scales:c,columns:u,config:d,getR:h,resolveSummaryStyle:g}=e,{r:f,projection:p}=c,y=[],m="vertical"===p,v=!1!==d.showOutliers;for(const t of Object.values(u)){const c=t.pieceData.map(e=>h(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===c.length)continue;const u=c[0],d=c[c.length-1],p=null!==(n=a.quantile(c,.25))&&void 0!==n?n:u,b=null!==(o=a.quantile(c,.5))&&void 0!==o?o:(u+d)/2,x=null!==(i=a.quantile(c,.75))&&void 0!==i?i:d,k=x-p,w=p-1.5*k,A=x+1.5*k,j=null!==(r=c.find(e=>e>=w))&&void 0!==r?r:u,S=null!==(s=[...c].reverse().find(e=>A>=e))&&void 0!==s?s:d,O=g(t.pieceData[0],t.name),M=[];if(v)for(const e of t.pieceData){const n=h(e);if(w>n||n>A){const o=m?t.middle:f(n),i=m?f(n):t.middle;M.push({px:o,py:i,value:n,datum:e})}}if(y.push({type:"boxplot",x:m?t.middle:0,y:m?0:t.middle,projection:m?"vertical":"horizontal",columnWidth:.6*t.width,minPos:f(j),q1Pos:f(p),medianPos:f(b),q3Pos:f(x),maxPos:f(S),stats:{n:c.length,min:j,q1:p,median:b,q3:x,max:S,mean:c.reduce((e,t)=>e+t,0)/c.length},style:O,datum:t.pieceData,category:t.name,outliers:M}),v)for(const t of M)y.push({type:"point",x:t.px,y:t.py,r:3,style:{fill:O.fill||(null===(l=e.config.themeSemantic)||void 0===l?void 0:l.secondary)||"#999",opacity:.6},datum:t.datum})}return y},violin:function(e,t){var n,o,i;const{scales:r,columns:s,config:l,getR:c,resolveSummaryStyle:u}=e,{r:d,projection:h}=r,g=[],f="vertical"===h,p=l.bins||20,y=!1!==l.showIQR;for(const e of Object.values(s)){const t=e.pieceData.map(e=>c(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const r=t[0],s=t[t.length-1],l=(s-r)/p||1,h=Array(p).fill(0);for(const e of t)h[Math.min(Math.floor((e-r)/l),p-1)]++;const m=sn(h,1),v=e.width/2*.9;let b="";if(f){b=`M ${e.middle} ${d(r)}`;for(let t=0;p>t;t++){const n=d(r+(t+.5)*l);b+=` L ${e.middle+h[t]/m*v} ${n}`}b+=` L ${e.middle} ${d(s)}`;for(let t=p-1;t>=0;t--){const n=d(r+(t+.5)*l);b+=` L ${e.middle-h[t]/m*v} ${n}`}b+=" Z"}else{b=`M ${d(r)} ${e.middle}`;for(let t=0;p>t;t++)b+=` L ${d(r+(t+.5)*l)} ${e.middle-h[t]/m*v}`;b+=` L ${d(s)} ${e.middle}`;for(let t=p-1;t>=0;t--)b+=` L ${d(r+(t+.5)*l)} ${e.middle+h[t]/m*v}`;b+=" Z"}const x=u(e.pieceData[0],e.name);let k;if(y&&t.length>=4){const l=null!==(n=a.quantile(t,.25))&&void 0!==n?n:r,c=null!==(o=a.quantile(t,.5))&&void 0!==o?o:(r+s)/2,u=null!==(i=a.quantile(t,.75))&&void 0!==i?i:s;k={q1Pos:d(l),medianPos:d(c),q3Pos:d(u),centerPos:e.middle,isVertical:f}}const w=f?{x:e.x,y:Math.min(d(s),d(r)),width:e.width,height:Math.abs(d(s)-d(r))}:{x:Math.min(d(r),d(s)),y:e.x,width:Math.abs(d(s)-d(r)),height:e.width};g.push({type:"violin",pathString:b,translateX:0,translateY:0,bounds:w,iqrLine:k,stats:yr(t),style:x,datum:e.pieceData,category:e.name})}return g},histogram:function(e,t){var n;const{scales:o,columns:i,config:r,getR:s,resolveSummaryStyle:a}=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=>s(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const[n,o]=rn(t),i=null!=g&&isFinite(g)?g:n,r=null!=f&&isFinite(f)?f:o,h=(r-i)/u||1,p=Array(u).fill(0);for(const e of t)i>e||e>r||p[Math.min(Math.floor((e-i)/h),u-1)]++;const y=t.length,m=sn(p,1),v=a(e.pieceData[0],e.name);for(let t=0;u>t;t++){if(0===p[t])continue;const n=(d?p[t]/y:p[t]/m)*e.width*.9,o=l(i+t*h),r=l(i+(t+1)*h);c.push(W(Math.min(o,r),e.x+e.width-n,Math.abs(r-o),n,v,{bin:t,count:p[t],range:[i+t*h,i+(t+1)*h],category:e.name},e.name))}}return c},ridgeline:function(e,t){var n;const{scales:o,columns:i,config:r,getR:s,resolveSummaryStyle:a}=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=>s(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=sn(c,1),p=a(e.pieceData[0],e.name),y=e.width*g;let m="";if(h){const t=e.x+e.width;m=`M ${l(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:yr(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:s,projection:a}=n,l=[],c="horizontal"===a;for(const e of Object.values(o))for(const t of e.pieceData){const n=i(t);if(!n)continue;const[o,a]=n,u=r(t,e.name);if(c){const n=s(Math.min(o,a)),i=s(Math.max(o,a));l.push(W(n,e.x,i-n,e.width,u,t,e.name))}else{const n=s(Math.max(o,a)),i=s(Math.min(o,a));l.push(W(e.x,n,e.width,i-n,u,t,e.name))}}return l},funnel:function(e,t){var n,o,r,s,a,l,c,u;const{columns:d,getR:h,getStack:g,resolvePieceStyle:f}=e,p=[],y=t.width/2,m=!1!==e.config.showLabels,v=e.scales.o.domain().map(e=>d[e]).filter(Boolean);if(0===v.length)return p;const b=[],x=new Set;for(const e of v)for(const t of e.pieceData){const e=g?g(t):"_default";x.has(e)||(x.add(e),b.push(e))}const k=b.length>1&&"_default"!==b[0],w=[];let A=0;for(const e of v){const t=new Map;let n=0;for(const o of e.pieceData){const e=g?g(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const i=t.get(e),r=h(o);i.total+=r,i.pieces.push(o),n+=r}w.push({col:e,groups:t,stepTotal:n}),k||n>A&&(A=n)}if(k)for(const e of w){let t=0,n=0;for(let o=0;b.length>o;o++){const i=e.groups.get(b[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 p;const j=new Map;for(const e of b){const t=w[0].groups.get(e);j.set(e,null!==(n=null==t?void 0:t.total)&&void 0!==n?n:0)}const S=w[0].stepTotal,O=k?.95*y:.9*t.width,M=i.scaleLinear().domain([0,A]).range([0,O]),C=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,i=0===t,d=o.width,h=.55*d,g=o.x+(d-h)/2,v=new Map;if(k){let e=0;for(const t of b){const o=n.groups.get(t);o&&(e+=M(o.total))}let t=y,r=y;for(let s=0;b.length>s;s++){const l=b[s],c=n.groups.get(l);if(!c)continue;const u=M(c.total),d=s%2==0,x=d?t:r-u;d?t+=u:r-=u;const k=f(c.pieces[0],l),w=null!==(a=j.get(l))&&void 0!==a?a:c.total,A=w>0?c.total/w*100:0,S=Object.assign(Object.assign({},c.pieces[0]),{__funnelValue:c.total,__funnelPercent:A,__funnelStep:o.name,__funnelIsFirstStep:i,__aggregateValue:c.total,__pieceCount:c.pieces.length,category:l});m&&(0===s&&(S.__funnelStepLabel=o.name,S.__funnelStepLabelX=y,S.__funnelStepLabelY=g,S.__funnelRowWidth=e),S.__funnelValueLabelX=x+u/2,S.__funnelValueLabelY=g,S.__funnelBarW=u),p.push(W(x,g,u,h,k,S,l)),v.set(l,{x:x,y:g,w:u,h:h})}}else{const e=n.stepTotal,t=M(e),a=y-t/2,l=b[0],c="_default"!==l,u=null!==(s=null===(r=n.groups.get(l))||void 0===r?void 0:r.pieces[0])&&void 0!==s?s:o.pieceData[0],d=c?l:o.name,x=f(u,d),k=S>0?e/S*100:0,w=Object.assign(Object.assign({},u),{__funnelValue:e,__funnelPercent:k,__funnelStep:o.name,__funnelIsFirstStep:i,category:c?l:o.name});m&&(w.__funnelStepLabel=o.name,w.__funnelStepLabelX=y,w.__funnelStepLabelY=g,w.__funnelRowWidth=t,w.__funnelValueLabelX=y,w.__funnelValueLabelY=g,w.__funnelBarW=t),p.push(W(a,g,t,h,x,w,d)),v.set(l,{x:a,y:g,w:t,h:h})}if(t>0&&_.size>0){const t=k?b:[b[0]];for(const i of t){const t=_.get(i),r=v.get(i);if(!t||!r)continue;const s=(()=>{const e=n.groups.get(i);return f(e?e.pieces[0]:o.pieceData[0],"_default"===i?o.name:i)})(),a={type:"trapezoid",points:[[t.x,t.y+t.h],[t.x+t.w,t.y+t.h],[r.x+r.w,r.y],[r.x,r.y]],style:{fill:s.fill||(null===(l=e.config.themeSemantic)||void 0===l?void 0:l.secondary)||"#999",opacity:C},datum:null!==(u=null===(c=n.groups.get(i))||void 0===c?void 0:c.pieces[0])&&void 0!==u?u:o.pieceData[0],category:"_default"===i?o.name:i};p.push(a)}}_=v}return p},"bar-funnel":function(e,t){var n,o,i,r;const{columns:s,getR:a,getStack:l,resolvePieceStyle:c,scales:u}=e,d=[],h=u.o.domain().map(e=>s[e]).filter(Boolean);if(0===h.length)return d;const g=[],f=new Set;for(const e of h)for(const t of e.pieceData){const e=l?l(t):"_default";f.has(e)||(f.add(e),g.push(e))}const p=g.length>1&&"_default"!==g[0],y=[];for(const e of h){const t=new Map;let 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=a(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,s=e>0?y[e-1]:null,a=n.width/b,l=a*x,u=a-l;for(let e=0;g.length>e;e++){const h=g[e],f=t.groups.get(h);if(!f)continue;const y=f.total,b=null!==(i=m.get(h))&&void 0!==i?i:y,x=b>0?y/b*100:0,k=null==s?void 0:s.groups.get(h),w=null!==(r=null==k?void 0:k.total)&&void 0!==r?r:y,A=o?0:Math.max(0,w-y),j=n.x+e*a+l/2,S=v(y),O=v(0)-S,M=c(f.pieces[0],p?h:n.name),C=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:j+u/2,__barFunnelLabelY:v(y+A)});if(d.push(W(j,S,u,O,M,C,p?h:n.name)),A>0){const e=v(y+A),t=S-e,o=Object.assign({},M),i=Object.assign(Object.assign({},f.pieces[0]),{__barFunnelValue:A,__barFunnelPercent:b>0?A/b*100:0,__barFunnelIsFirstStep:!1,__barFunnelIsDropoff:!0,__barFunnelStep:n.name,__barFunnelCategory:"_default"===h?void 0:h,category:p?h:n.name});d.push(W(j,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:s,resolvePieceStyle:a}=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(),s=Math.min(o,r),a=Math.abs(r-o);for(const n of Object.values(i)){const o={fill:e,opacity:t},i=d?W(s,n.x,a,n.width,o,null,"__track__"):W(n.x,s,n.width,a,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=s?s(n):e.name,c=a(n,i);let f;if(d){const r=l(t),s=l(t+o);f=W(r,e.x,s-r,e.width,c,n,i)}else{const r=l(t+o),s=l(t);f=W(e.x,r,e.width,s-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 xr{constructor(e){this.rExtent=new N,this.rExtents=[],this.rAccessors=[],this.categories=new Set,this._hasStreamingData=!1,this._colorSchemeMap=null,this._colorSchemeIndex=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositionMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this.scales=null,this.multiScales=[],this.scene=[],this.columns={},this.customLayoutOverlays=null,this._customLayoutDiagnosticsWarned=new Set,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,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 $(e.windowSize),this.getO=X(e.categoryAccessor||e.oAccessor,"category");const t=e.valueAccessor||e.rAccessor;Array.isArray(t)?(this.rAccessors=t.map(e=>G(e,"value")),this.getR=this.rAccessors[0],this.rExtents=t.map(()=>new N)):(this.getR=G(t,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=X(e.stackBy),this.getGroup=X(e.groupBy),this.getColor=X(e.colorAccessor),this.getSymbol=X(e.symbolAccessor),this.getConnector=X(e.connectorAccessor),this.getDataId=X(e.dataIdAccessor),e.pulse&&(this.timestampBuffer=new $(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(),r=t.projection||"vertical",s=t.oExtent||this.resolveCategories(o),a=this.computeValueDomain(o,s),l="horizontal"===r,c="radial"===r,u=Math.min(.9,Math.max(0,null!=t.barPadding?t.barPadding/("vertical"===r?e.width:e.height):.1));let d,h;if(c){d=i.scaleBand().domain(s).range([0,1]).padding(0);const n=Math.min(e.width,e.height)/2,o=t.innerRadius||0;h=i.scaleLinear().domain(a).range([o,n])}else l?(d=i.scaleBand().domain(s).range([0,e.height]).padding(u),h=i.scaleLinear().domain(a).range([0,e.width])):(d=i.scaleBand().domain(s).range([0,e.width]).padding(u),h=i.scaleLinear().domain(a).range([e.height,0]));this.scales={o:d,r:h,projection:r},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((o,r)=>{var s;const a=this.rExtents[r];a.dirty&&a.recalculate(n,o);let[c,u]=a.extent;c===1/0&&(c=0,u=1);const d=null!==(s=t.extentPadding)&&void 0!==s?s:.05,h=u-c,g=h>0?h*d:1;return c-=g,u+=g,c>0&&(c=0),l?i.scaleLinear().domain([c,u]).range([0,e.width]):i.scaleLinear().domain([c,u]).range([e.height,0])}):[];let g=o;this.rAccessors.length>1&&(g=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(g,s,d,r,e),this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(g,e),this.rebuildPointQuadtree(),this.config.decay&&this.applyDecay(this.scene,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 s=new Map;for(const t of e){const e=this.getO(t);s.set(e,(s.get(e)||0)+Math.abs(this.getR(t)))}return r.sort("asc"===o?(e,t)=>(s.get(e)||0)-(s.get(t)||0):(e,t)=>(s.get(t)||0)-(s.get(e)||0))}computeValueDomain(e,t){var n,o,i,r,s;const a=this.config.chartType,l=null!==(n=this.config.extentPadding)&&void 0!==n?n:.05;if("radial"===this.config.projection&&("pie"===a||"donut"===a))return[0,1];let c=0,u=0;if("bar"===a&&this.getStack&&this.config.normalize)c=0,u=1;else if("bar"===a&&this.getStack){const t=new Map,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"===a){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"===a){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"===a||"bar-funnel"===a)for(const t of e){const e=this.getR(t);e>u&&(u=e),c>e&&(c=e)}else{const e=this.rExtent.extent[0],t=this.rExtent.extent[1];e!==1/0&&(c=e),t!==-1/0&&(u=t)}this.config.rExtent&&(null!=this.config.rExtent[0]&&(c=this.config.rExtent[0]),null!=this.config.rExtent[1]&&(u=this.config.rExtent[1]));const d="bar"===a||"clusterbar"===a||"bar-funnel"===a||"swimlane"===a;if(d&&null==(null===(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"!==a&&"exact"!==this.config.axisExtent){const e=u-c,t=e>0?e*l:1;null!=(null===(r=this.config.rExtent)||void 0===r?void 0:r[0])||d&&!this.config.baselinePadding&&0===c||(c-=t),null!=(null===(s=this.config.rExtent)||void 0===s?void 0:s[1])||d&&!this.config.baselinePadding&&0===u||"swimlane"===a||(u+=t)}return[c,u]}buildColumns(e,t,n,o,i){var r;const s={},a=new Map;for(const t of e){const e=this.getO(t);a.has(e)||a.set(e,[]),a.get(e).push(t)}let l=0;if("radial"===o)for(const t of e)l+=Math.abs(this.getR(t));const c=this.config.dynamicColumnWidth;let u=null;if(c&&"radial"!==o){u=new Map;let e=0;for(const n of t){const t=a.get(n)||[];let o;o="string"==typeof c?t.reduce((e,t)=>e+(Number(t[c])||0),0):c(t),u.set(n,o),e+=o}const 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=a.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()),s[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 s}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){var n,o,i;if(!this.scales)return[];if(this.config.customLayout){const r=this.buildLayoutContext(e,t);let s;try{s=this.config.customLayout(r)}catch(e){return"production"!==process.env.NODE_ENV&&console.error("[semiotic] ordinal customLayout threw:",e),this.customLayoutOverlays=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,[]}this.customLayoutOverlays=null!==(n=s.overlays)&&void 0!==n?n:null;const a=null!==(o=s.nodes)&&void 0!==o?o:[];if(this._customRestyle=s.restyle,this.hasCustomRestyle=!!s.restyle,this.hasCustomRestyle){this._baseStyles=new WeakMap;for(const e of a)e.style&&this._baseStyles.set(e,e.style);this.applyCustomRestyle(a,null!==(i=this.config.layoutSelection)&&void 0!==i?i:null)}return Ve({label:"ordinal customLayout",nodes:a,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned}),a}this.customLayoutOverlays=null,this._customRestyle=void 0,this.hasCustomRestyle=!1;const r=this.getSceneContext(),s=br[this.config.chartType];let a=s?s(r,t):[];if(this.getConnector&&this.scales){const e=function(e,t){var n,o;const{scales:i,config:r,getConnector:s,getO:a}=e;if(!s||!i)return[];const l=[],{projection:c}=i,u=new Map;for(const e of t){if("point"!==e.type&&"rect"!==e.type)continue;const t=e.datum;if(!t)continue;const n=s(t);if(!n)continue;let o,i;"point"===e.type?(o=e.x,i=e.y):(o=e.x+e.w/2,i=e.y+("vertical"===c?0:e.h/2)),u.has(n)||u.set(n,[]),u.get(n).push({x:o,y:i,datum:t,category:a(t)})}const d=i.o.domain(),h=r.connectorStyle;for(const[t,i]of u)if(i.length>=2){i.sort((e,t)=>d.indexOf(e.category)-d.indexOf(t.category));for(let r=0;i.length-1>r;r++){const s=i[r],a=i[r+1],c="function"==typeof h?h(s.datum):h||{stroke:(null===(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:s.x,y1:s.y,x2:a.x,y2:a.y,style:c,datum:s.datum,group:t})}}return l}(r,a);a=[...e,...a]}return a}buildLayoutContext(e,t){var n,o,i,r;const s=this.config,a=null!==(n=s.layoutMargin)&&void 0!==n?n:{top:0,right:0,bottom:0,left:0},l=mr(s.colorScheme,s.themeCategorical,ke),c=this.scales;return{data:e,scales:{o:c.o,r:c.r,projection:c.projection},dimensions:{width:t.width,height:t.height,margin:a,plot:"radial"===c.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=s.themeSemantic)&&void 0!==o?o:{},categorical:[...l]},resolveColor:vr(l),config:null!==(i=s.layoutConfig)&&void 0!==i?i:{},selection:null!==(r=s.layoutSelection)&&void 0!==r?r:null}}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||ke,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?Me(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 s=e[r],a=n?t(s):s[o];let l=i.get(a);l||(l=[],i.set(a,l)),l.push(r)}return this._categoryIndexCache={version:this._dataVersion,map:i},i}rebuildPointQuadtree(){let e=0,t=0;for(const n of this.scene)"point"===n.type&&(e++,n.r>t&&(t=n.r));if(this._maxPointRadius=t,xr.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=r.quadtree().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 s=this.computeDecayOpacity(e,i),a=null!==(o=null===(n=t.style)||void 0===n?void 0:n.opacity)&&void 0!==o?o:1;t.style=Object.assign(Object.assign({},t.style),{opacity:a*s})}}applyPulse(e,t){var n,o,i;if(!this.config.pulse||!this.timestampBuffer)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=null!==(n=this.config.pulse.duration)&&void 0!==n?n:500,a=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(s>n){const e=1-n/s;e>i&&(i=e)}}i>0&&(n._pulseIntensity=i,n._pulseColor=a);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;s>i&&(n._pulseIntensity=1-i/s,n._pulseColor=a,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,s=null!==(t=null===(e=this.scales)||void 0===e?void 0:e.r(0))&&void 0!==t?t:0,a="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,a?{x:t.x,y:s,w:t.w,h:0,opacity:null!==(o=t.style.opacity)&&void 0!==o?o:1}:{x:s,y:t.y,w:0,h:t.h,opacity:null!==(i=t.style.opacity)&&void 0!==i?i:1}):"point"===t.type?this.prevPositionMap.set(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,s,a,l,c,u,d,h,g,f,p,y,m,v,b,x;if(!this.config.transition||0===this.prevPositionMap.size)return;const k=null!==(e=this.config.transition.duration)&&void 0!==e?e:300;if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}let w=!1;const A=new Set,j=new Map;for(let e=0;this.scene.length>e;e++){const c=this.scene[e],u=this.getNodeKey(c,j);if(!u)continue;c._transitionKey=u;const d=this.prevPositionMap.get(u);if("point"===c.type)d?(A.add(u),c._targetOpacity=null!==(t=c.style.opacity)&&void 0!==t?t:1,(d.x!==c.x||d.y!==c.y||void 0!==d.r&&d.r!==c.r)&&(c._targetX=c.x,c._targetY=c.y,c._targetR=c.r,c.x=d.x,c.y=d.y,void 0!==d.r&&(c.r=d.r),w=!0)):(c._targetOpacity=null!==(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!==(s=c.style.opacity)&&void 0!==s?s:1,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),w=!0);else if("wedge"===c.type)if(d)A.add(u),c._targetOpacity=null!==(a=c.style.opacity)&&void 0!==a?a:1,d.startAngle===c.startAngle&&d.endAngle===c.endAngle||(c._targetStartAngle=c.startAngle,c._targetEndAngle=c.endAngle,c.startAngle=d.startAngle,c.endAngle=d.endAngle,w=!0);else{c._targetOpacity=null!==(l=c.style.opacity)&&void 0!==l?l:1,c._targetStartAngle=c.startAngle,c._targetEndAngle=c.endAngle;const e=c.startAngle;c.startAngle=e,c.endAngle=e,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),this.prevPositionMap.set(u,{x:c.cx,y:c.cy,startAngle:e,endAngle:e,innerRadius:c.innerRadius,outerRadius:c.outerRadius,opacity:0}),w=!0}}this.exitNodes=[];for(const[e,t]of this.prevPositionMap)if(!A.has(e)){if(e.startsWith("p:"))this.exitNodes.push({type:"point",x:t.x,y:t.y,r:null!==(c=t.r)&&void 0!==c?c:3,style:{opacity:null!==(u=t.opacity)&&void 0!==u?u:1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("r:"))this.exitNodes.push({type:"rect",x:t.x,y:t.y,w:null!==(d=t.w)&&void 0!==d?d:0,h:null!==(h=t.h)&&void 0!==h?h:0,style:{opacity:null!==(g=t.opacity)&&void 0!==g?g:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("w:")){const 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:Te(),duration:k})}advanceTransition(e){var t,n,o,i;if(!this.activeTransition)return!1;const r=Pe(e,this.activeTransition),s=_e(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=Le(i,e._targetOpacity,s)}const o=this.prevPositionMap.get(t);void 0!==e._targetX&&o&&(e.x=Le(o.x,e._targetX,s),e.y=Le(o.y,e._targetY,s)),void 0!==e._targetR&&void 0!==(null==o?void 0:o.r)&&(e.r=Le(o.r,e._targetR,s))}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=Le(i,e._targetOpacity,s)}if(void 0===e._targetX)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=Le(n.x,e._targetX,s),e.y=Le(n.y,e._targetY,s),void 0!==n.w&&(e.w=Le(n.w,e._targetW,s),e.h=Le(n.h,e._targetH,s))}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:Le(o,e._targetOpacity,s)})}if(void 0!==e._targetStartAngle&&void 0!==e._targetEndAngle){const n=this.prevPositionMap.get(t);n&&void 0!==n.startAngle&&(e.startAngle=Le(n.startAngle,e._targetStartAngle,s),e.endAngle=Le(n.endAngle,e._targetEndAngle,s))}}}if(r>=1){for(const e of this.scene)if(void 0!==e._targetOpacity&&(e.style=Object.assign(Object.assign({},e.style||{}),{opacity:0===e._targetOpacity?0:e._targetOpacity}),e._targetOpacity=void 0),"point"===e.type){if(void 0===e._targetX&&void 0===e._targetR)continue;void 0!==e._targetX&&(e.x=e._targetX,e.y=e._targetY),void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else"wedge"===e.type&&void 0!==e._targetStartAngle&&(e.startAngle=e._targetStartAngle,e.endAngle=e._targetEndAngle,e._targetStartAngle=void 0,e._targetEndAngle=void 0);if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}return this.activeTransition=null,!1}return!0}cancelIntroAnimation(){this.prevPositionMap.clear(),this.activeTransition=null}getData(){return this.buffer.toArray()}remove(e){if(!this.getDataId)throw Error("remove() requires dataIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=new Set(Array.isArray(e)?e:[e]),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++,this.lastIngestTime="undefined"!=typeof performance?performance.now():Date.now(),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++,this.lastIngestTime="undefined"!=typeof performance?performance.now():Date.now(),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}setLayoutSelection(e){this.config.layoutSelection=e}applyCustomRestyle(e,t){var n,o;const i=this._customRestyle;if(i)for(const r of e){const e=null!==(o=null!==(n=this._baseStyles.get(r))&&void 0!==n?n:r.style)&&void 0!==o?o:{},s=i(r,t);r.style=s?Object.assign(Object.assign({},e),s):e}}restyleScene(e){this._customRestyle&&this.applyCustomRestyle(this.scene,e)}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&&!Y(e.colorAccessor,t.colorAccessor))&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),("categoryAccessor"in e&&!Y(e.categoryAccessor,t.categoryAccessor)||"oAccessor"in e&&!Y(e.oAccessor,t.oAccessor))&&(this._categoryIndexCache=null),Object.assign(this.config,e),("categoryAccessor"in e||"oAccessor"in e)&&(Y(e.categoryAccessor||e.oAccessor,t.categoryAccessor||t.oAccessor)||(this.getO=X(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)=>!Y(e,r[t]))){const e=this.config.valueAccessor||this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>G(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new N)):(this.getR=G(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!Y(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?X(this.config.stackBy):void 0),"groupBy"in e&&!Y(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?X(this.config.groupBy):void 0),"colorAccessor"in e&&!Y(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?X(this.config.colorAccessor):void 0),"symbolAccessor"in e&&!Y(e.symbolAccessor,t.symbolAccessor)&&(this.getSymbol=null!=this.config.symbolAccessor?X(this.config.symbolAccessor):void 0),"connectorAccessor"in e&&!Y(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?X(this.config.connectorAccessor):void 0)}}function kr(e,t,n){const o=rt(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,s=Math.sqrt(i*i+r*r);return s>st(e.r,o)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function Ar(e,t,n,o=30){const i=t-e.x,r=n-e.y,s=Math.sqrt(i*i+r*r);return s>st(qe(e.size),o)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function jr(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 s=ct(Math.atan2(i,o)),a=ct(e.startAngle),l=ct(e.endAngle);if(!(a>l?s>=a||l>=s:s>=a&&l>=s))return null;const c=(e.startAngle+e.endAngle)/2,u=(e.innerRadius+e.outerRadius)/2;return{datum:e.datum,x:e.cx+Math.cos(c)*u,y:e.cy+Math.sin(c)*u,distance:0,category:e.category}}function Sr(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 Or(e,t,n){if(!e.bounds)return null;const{x:o,y:i,width:r,height:s}=e.bounds;return o>t||t>o+r||i>n||n>i+s?null:{datum:e.datum,x:o+r/2,y:i+s/2,distance:0,category:e.category,stats:e.stats}}function Mr(n){const{width:o,height:i,totalWidth:r,totalHeight:s,margin:a,scales:l,showAxes:c,showGrid:u,rFormat:d}=n,{rTickValues:h,axisExtent:g}=n,f="radial"===(null==l?void 0:l.projection),p="horizontal"===(null==l?void 0:l.projection),y=t.useMemo(()=>!l||f?[]:(h||so(l.r,5,g)).map(e=>({value:e,pixel:l.r(e),label:(d||Cr)(e)})),[l,d,f,h,g]),m=u&&l&&!f,v=c&&l&&!f;return m||v?e.jsx("svg",{width:r,height:s,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:e.jsxs("g",{transform:`translate(${a.left},${a.top})`,children:[m&&e.jsx("g",{className:"ordinal-grid",children:y.map((t,n)=>e.jsx("line",{x1:p?t.pixel:0,y1:p?0:t.pixel,x2:p?t.pixel:o,y2:p?i:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+n))}),v&&e.jsx(e.Fragment,{children:e.jsxs(e.Fragment,p?{children:[e.jsx("line",{x1:0,y1:0,x2:0,y2:i,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.jsx("line",{x1:0,y1:i,x2:o,y2:i,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]}:{children:[e.jsx("line",{x1:0,y1:i,x2:o,y2:i,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.jsx("line",{x1:0,y1:0,x2:0,y2:i,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]})})]})}):null}function Cr(e){return Math.round(100*e)/100+""}function _r(n){var o,i;const{width:r,height:s,totalWidth:a,totalHeight:l,margin:c,scales:u,showAxes:d,showCategoryTicks:h,oLabel:g,rLabel:f,oFormat:p,rFormat:y,showGrid:m,title:v,legend:b,legendHoverBehavior:x,legendClickBehavior:k,legendHighlightedCategory:w,legendIsolatedCategories:A,legendPosition:j="right",legendLayout:S,foregroundGraphics:O,annotations:M,autoPlaceAnnotations:C,svgAnnotationRules:_,xAccessor:P,yAccessor:L,annotationData:T,underlayRendered:R,children:$}=n,N="radial"===(null==u?void 0:u.projection),E="horizontal"===(null==u?void 0:u.projection),B=!1!==h,D=t.useMemo(()=>{if(!d||!B||!u||N)return[];const e=u.o.bandwidth(),t=u.o.domain().map((t,n)=>{var o;return{value:t,pixel:(null!==(o=u.o(t))&&void 0!==o?o:0)+e/2,label:p?p(t,n):t}});if(2>=t.length)return t;const n=Math.abs(t[1].pixel-t[0].pixel)||e;let o,i=0,r=!1;for(const e of t)"string"==typeof e.label?i=Math.max(i,e.label.length):"number"==typeof e.label?i=Math.max(i,(e.label+"").length):r=!0;o=E?r?24:16:Math.max(6.5*i,r?60:0)+6;const s=Math.max(1,Math.ceil(o/n));return 1===s?t:t.filter((e,t)=>t%s===0)},[d,B,u,p,N,E]),I=n.rTickValues,F=n.tickLabelEdgeAlign,H=n.axisExtent,W=t.useMemo(()=>d&&u&&!N?(I||so(u.r,5,H)).map(e=>({value:e,pixel:u.r(e),label:(y||Cr)(e)})):[],[d,u,y,N,I,H]),z=t.useRef(new Map),Y=t.useRef(null!==(o=null==M?void 0:M.length)&&void 0!==o?o:0),G=null!==(i=null==M?void 0:M.length)&&void 0!==i?i:0;Y.current!==G&&(Y.current=G,z.current=new Map);const q=t.useMemo(()=>{if(!M||0===M.length)return null;const e=Ln(),t="horizontal"===(null==u?void 0:u.projection),n=(null==u?void 0:u.o)?e=>{var t;return(null!==(t=u.o(e))&&void 0!==t?t:0)+u.o.bandwidth()/2}:null,o={scales:u?{x:t?u.r:n||u.r,y:t&&n||u.r,time:u.r,value:u.r,o:u.o}:null,timeAxis:"x",xAccessor:P,yAccessor:L,width:r,height:s,data:T,frameType:"ordinal",projection:t?"horizontal":"vertical",stickyPositionCache:z.current};return Pn(C?Un(Object.assign({annotations:M,context:o},"object"==typeof C?C:{})):M,e,_,o)},[M,C,_,r,s,u,P,L,T]);return d||v||b||O||q&&q.length>0||m||$?e.jsxs("svg",{role:"img",width:a,height:l,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[e.jsx("title",{children:"string"==typeof v?v:"Ordinal Chart"}),e.jsx("desc",{children:"string"==typeof v?v+" — ordinal data visualization":"Ordinal data visualization"}),e.jsxs("g",{transform:`translate(${c.left},${c.top})`,children:[m&&u&&!N&&!R&&e.jsx("g",{className:"ordinal-grid",children:W.map((t,n)=>e.jsx("line",{x1:E?t.pixel:0,y1:E?0:t.pixel,x2:E?t.pixel:r,y2:E?s:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+n))}),d&&u&&!N&&(()=>{const t={fontSize:"var(--semiotic-tick-font-size, 12px)"},n={fontSize:"var(--semiotic-axis-label-font-size, 12px)"};return e.jsx("g",{className:"ordinal-axes",children:e.jsxs(e.Fragment,E?{children:[e.jsxs("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[!R&&e.jsx("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),D.map((n,o)=>e.jsxs("g",{transform:`translate(0,${n.pixel})`,children:[e.jsx("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e.jsx("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},t),children:n.label}):e.jsx("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:Object.assign({textAlign:"right",userSelect:"none"},t),children:n.label})})]},"cat-"+o)),g&&e.jsx("text",{x:15-c.left,y:s/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-c.left}, ${s/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},n),children:g})]}),e.jsxs("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[!R&&e.jsx("line",{x1:0,y1:s,x2:r,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),!R&&(null==u?void 0:u.r)&&(()=>{const t=u.r(0);return t>1&&r-1>t?e.jsx("line",{x1:t,y1:0,x2:t,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1,strokeDasharray:"4,4"}):null})(),W.map((n,o)=>{const i=F?0===o?"start":o===W.length-1?"end":"middle":"middle";return e.jsxs("g",{transform:`translate(${n.pixel},${s})`,children:[e.jsx("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.jsx("text",{y:18,textAnchor:i,fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},t),children:n.label})]},"val-"+o)}),f&&e.jsx("text",{x:r/2,y:s+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},n),children:f})]})]}:{children:[e.jsxs("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[!R&&(()=>{const t=(null==u?void 0:u.r)?u.r(0):s,n=0>t||t>s?s:t;return e.jsx("line",{x1:0,y1:n,x2:r,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),D.map((n,o)=>e.jsxs("g",{transform:`translate(${n.pixel},${s})`,children:[e.jsx("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e.jsx("text",{y:18,textAnchor:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},t),children:n.label}):e.jsx("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:Object.assign({textAlign:"center",userSelect:"none"},t),children:n.label})})]},"cat-"+o)),g&&e.jsx("text",{x:r/2,y:s+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},n),children:g})]}),e.jsxs("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[!R&&e.jsx("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),W.map((n,o)=>e.jsxs("g",{transform:`translate(0,${n.pixel})`,children:[e.jsx("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.jsx("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},t),children:n.label})]},"val-"+o)),f&&e.jsx("text",{x:15-c.left,y:s/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-c.left}, ${s/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},n),children:f})]})]})})})(),q,O,$]}),v&&e.jsx("text",{x:a/2,y:20,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:"string"==typeof v?v:null}),on({legend:b,totalWidth:a,totalHeight:l,margin:c,legendPosition:j,title:v,legendLayout:S,legendHoverBehavior:x,legendClickBehavior:k,legendHighlightedCategory:w,legendIsolatedCategories:A})]}):null}function Pr({width:i,height:r,totalWidth:s,totalHeight:a,margin:l,scales:c,onBrush:u}){const d=t.useRef(null),h=t.useRef(null),g=t.useRef(u);g.current=u;const f=t.useRef(c);f.current=c;const p=t.useRef(!1),y=t.useRef(null),m="horizontal"===(null==c?void 0:c.projection),v=t.useRef(m);return v.current=m,t.useEffect(()=>{if(!d.current)return;const e=n.select(d.current).select(".brush-g"),t=m?o.brushX():o.brushY();return t.extent([[0,0],[i,r]]),t.on("brush end",e=>{if(p.current)return;const t=f.current;if(!t)return;if(!e.selection)return y.current=null,void g.current(null);const[n,o]=e.selection;let i;i=v.current?[t.r.invert(n),t.r.invert(o)]:[t.r.invert(o),t.r.invert(n)];const r={r:i};y.current=r,g.current(r)}),e.call(t),h.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null),h.current=null}},[i,r,m]),t.useEffect(()=>{if(!c||!h.current||!y.current)return;if(!d.current)return;const e=y.current,t=n.select(d.current).select(".brush-g"),o=c.r(e.r[0]),i=c.r(e.r[1]);m?(p.current=!0,t.call(h.current.move,[o,i]),p.current=!1):(p.current=!0,t.call(h.current.move,[i,o]),p.current=!1)},[c,m]),e.jsx("svg",{ref:d,width:s,height:a,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:e.jsx("g",{className:"brush-g",transform:`translate(${l.left},${l.top})`,style:{pointerEvents:"all"}})})}function Lr(e,t){var n,o,i,r;const s=t._gradientBand.colors;if(0===s.length)return;const{clipPath:a,slices:l}=ko({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:s}),c=new Path2D(a);e.save(),e.translate(t.cx,t.cy),e.clip(c);for(const t of l)e.fillStyle=vt(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=vt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(c),e.restore())}function Tr(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 Rr(e,t){const n={innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle+Math.PI/2,endAngle:t.endAngle+Math.PI/2},o=s.arc().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()}xr.QUADTREE_THRESHOLD=500;const $r=(e,t,n,o)=>{var i,r;const s=t.filter(e=>"wedge"===e.type);for(const t of s){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)Lr(e,t),t._pulseIntensity&&t._pulseIntensity>0&&(Tr(e,t),Ii(e,t)),e.globalAlpha=1;else{if(e.fillStyle=("string"==typeof t.style.fill?vt(e,t.style.fill):t.style.fill)||"#007bff",t.roundedEnds){t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=vt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1);const n=xo({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=vt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1),Rr(e,t)):(Tr(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=vt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()));t._pulseIntensity&&t._pulseIntensity>0&&(Tr(e,t),Ii(e,t)),e.globalAlpha=1}}},Nr=(e,t,n,o)=>{var i,r;const s=t.filter(e=>"boxplot"===e.type);for(const t of s){const n=t.columnWidth/2,o="vertical"===t.projection,s=vt(e,"var(--semiotic-primary, #007bff)"),a=vt(e,"var(--semiotic-text, #333)"),l=t.style.fill,c="string"==typeof l?vt(e,l)||l:null!=l?l:s,u=t.style.stroke,d="string"==typeof u?vt(e,u)||u:a,h=t.style.strokeWidth||1,g=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.6;if(e.save(),e.strokeStyle=d,e.lineWidth=h,e.beginPath(),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()}},Er=(e,t,n,o)=>{var i,r;const s=t.filter(e=>"violin"===e.type);for(const t of s){e.save(),(t.translateX||t.translateY)&&e.translate(t.translateX,t.translateY);const 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?vt(e,t.style.fill):t.style.fill)||"#007bff",e.fill(n),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=vt(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()}},Br=(e,t,n,o)=>{var i,r,s;const a=t.filter(e=>"connector"===e.type);if(0===a.length)return;const l=new Map;for(const e of a){const t=e.group||"_default";l.has(t)||l.set(t,[]),l.get(t).push(e)}for(const[,t]of l){if(0===t.length)continue;const 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=vt(e,n.style.stroke)||("string"==typeof n.style.fill?vt(e,n.style.fill):n.style.fill)||vt(e,"var(--semiotic-border, #999)"),e.lineWidth=n.style.strokeWidth||1,e.globalAlpha=null!==(s=n.style.opacity)&&void 0!==s?s:.5,e.stroke(),e.globalAlpha=1}},Dr=(e,t,n,o)=>{var i,r,s,a;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===(s=t.style)||void 0===s?void 0:s.fill)||"#999",e.fill(),(null===(a=t.style)||void 0===a?void 0:a.stroke)&&(e.strokeStyle=vt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}};function Ir(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 Fr(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}let Hr=null;function Wr(e={},t){const{background:n="transparent",stroke:o="#000",lineWidth:i=1.5,spacing:r=6,angle:s=45}=e,a=Math.max(8,Math.ceil(2*r));let l;try{l=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(Hr||(Hr=document.createElement("canvas")),Hr.width=e,Hr.height=e,Hr)}(a)}catch(e){return null}const c=l.getContext("2d");if(!c)return null;n&&"transparent"!==n?(c.fillStyle=n,c.fillRect(0,0,a,a)):c.clearRect(0,0,a,a),c.strokeStyle=o,c.lineWidth=i,c.lineCap="square";const u=s*Math.PI/180;if(45===s||-45===s){const e=s>0?1:-1;for(let t=-a;2*a>=t;t+=r)c.beginPath(),c.moveTo(t,0),c.lineTo(t+e*a,a),c.stroke()}else{c.save(),c.translate(a/2,a/2),c.rotate(u);const e=2*a;for(let t=-e;e>=t;t+=r)c.beginPath(),c.moveTo(-e,t),c.lineTo(e,t),c.stroke();c.restore()}return(t||c).createPattern(l,"repeat")}const zr=new Map;function Yr(e,t){const n=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,o=zr.get(n);if(void 0!==o)return o;const i=Wr({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return zr.set(n,i),i}function Gr(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 qr(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 Xr(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}const Vr=e=>[Br,...e],Ur={bar:Vr([Vi]),clusterbar:Vr([Vi]),point:Vr([Wi,Gi]),swarm:Vr([Wi,Gi]),pie:[$r],donut:[$r],boxplot:Vr([Nr,Wi]),violin:Vr([Er]),histogram:Vr([Vi]),ridgeline:Vr([Er]),timeline:Vr([Vi]),funnel:[Vi,Dr,(e,t,n,o)=>{var i,r,s,a;const l=t.filter(e=>"rect"===e.type&&null!=e.datum);if(0!==l.length&&l.some(e=>{var t,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 s=n.__funnelStepLabelX,a=n.__funnelStepLabelY+3;e.strokeStyle="rgba(0,0,0,0.6)",e.lineWidth=3,e.strokeText(o,s,a),e.fillStyle="#fff",e.fillText(o,s,a)}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!==(s=n.__funnelBarW)&&void 0!==s?s: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?Ir(i):null!=r?`${Ir(i)} (${Fr(r)})`:Ir(i),e.measureText(c).width+16>o){if(l||null==r)continue;if(c=Ir(i),e.measureText(c).width+16>o)continue}const u=n.__funnelValueLabelX,d=(null!==(a=n.__funnelValueLabelY)&&void 0!==a?a:t.y)+14+5;e.textAlign="center",e.strokeStyle="rgba(0,0,0,0.5)",e.lineWidth=3,e.strokeText(c,u,d),e.fillStyle="#fff",e.fillText(c,u,d)}e.lineWidth=1,e.lineJoin="miter"}}],"bar-funnel":[Vi,(e,t,n,o)=>{var i,r;const s=t.filter(e=>{var t;return"rect"===e.type&&!0===(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)});for(const t of s){const n=("string"==typeof t.style.fill?t.style.fill:null)||vt(e,"var(--semiotic-border, #999)"),o=Yr(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]=bt(e,t);return(.2126*n+.7152*o+.0722*i)/255>.6}(e,vt(e,"var(--semiotic-text, #333)")),s=r?"#1f2937":"#ffffff",a=r?"rgba(255,255,255,0.18)":"rgba(0,0,0,0.12)",l=r?"#f3f4f6":"#1a1a1a",c=l;for(const t of i){const 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?Xr(i):"",d=qr(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=s,e.beginPath(),Gr(e,m,v,f,p,4),e.fill(),e.restore(),e.strokeStyle=a,e.lineWidth=.5,e.beginPath(),Gr(e,m,v,f,p,4),e.stroke(),e.textAlign="center",e.textBaseline="top",r?(e.font="bold 13px sans-serif",e.fillStyle=l,e.fillText(u,y,v+3),e.font="11px sans-serif",e.fillStyle=c,e.fillText(d,y,v+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle=l,e.fillText(d,y,v+3))}e.lineWidth=1}],swimlane:Vr([Vi]),custom:Vr([Vi,Wi,Gi,$r,Nr,Er,Dr])},Qr={top:50,right:40,bottom:60,left:70},Kr={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 Zr(t){const n=vi(t,{skipPositional:!1});return null==n.title&&0===n.entries.length?null:e.jsxs("div",{className:"semiotic-tooltip",style:Kr,children:[null!=n.title&&e.jsx("div",{style:{fontWeight:"bold"},children:n.title+""}),n.entries.map(t=>e.jsxs("div",{children:[e.jsxs("span",{style:{opacity:.7},children:[t.key,":"]})," ","number"==typeof t.value?t.value.toLocaleString():t.value+""]},t.key))]})}function Jr({hover:t}){var n,o,i,r,s,a;const l=t.data||{},c=t.stats,u=t.category;if(Array.isArray(l)){const t=u||(null===(n=l[0])||void 0===n?void 0:n.category)||"";if(c)return e.jsxs("div",{className:"semiotic-tooltip",style:Kr,children:[t&&e.jsx("div",{style:{fontWeight:"bold"},children:t+""}),e.jsxs("div",{children:["n = ",c.n]}),e.jsxs("div",{children:["Min: ",c.min.toLocaleString()]}),e.jsxs("div",{children:["Q1: ",c.q1.toLocaleString()]}),e.jsxs("div",{children:["Median: ",c.median.toLocaleString()]}),e.jsxs("div",{children:["Q3: ",c.q3.toLocaleString()]}),e.jsxs("div",{children:["Max: ",c.max.toLocaleString()]}),e.jsxs("div",{style:{opacity:.8},children:["Mean: ",c.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});const o=l.length;return e.jsxs("div",{className:"semiotic-tooltip",style:Kr,children:[t&&e.jsx("div",{style:{fontWeight:"bold"},children:t+""}),e.jsxs("div",{children:[o," items"]})]})}if(null!=l.bin&&null!=l.count){const t=l.range||[];return e.jsxs("div",{className:"semiotic-tooltip",style:Kr,children:[l.category&&e.jsx("div",{style:{fontWeight:"bold"},children:l.category+""}),e.jsxs("div",{children:["Count: ",l.count]}),2===t.length&&e.jsxs("div",{style:{opacity:.8},children:[Number(t[0]).toFixed(1)," – ",Number(t[1]).toFixed(1)]})]})}const d=t.__oAccessor,h=t.__rAccessor,g=t.__chartType;if("swarm"===g||"point"===g)return Zr(l);const f=(d&&null!=l[d]?l[d]:null)||l.category||l.name||l.group||l.__rName||"",p=null!==(a=null!==(s=null!==(r=null!==(i=null!==(o=l.__aggregateValue)&&void 0!==o?o:h&&null!=l[h]?l[h]:null)&&void 0!==i?i:l.value)&&void 0!==r?r:l.__rValue)&&void 0!==s?s:l.pct)&&void 0!==a?a:"";return f||""!==p?e.jsxs("div",{className:"semiotic-tooltip",style:Kr,children:[f&&e.jsx("div",{style:{fontWeight:"bold"},children:f+""}),""!==p&&e.jsx("div",{children:"number"==typeof p?p.toLocaleString():p+""})]}):Zr(l)}Jr.ownsChrome=!0;const es=t.forwardRef(function(n,o){var i,r,a,l,c,u,d,h,g,f,y,m;const{chartType:v,runtimeMode:b,data:x,oAccessor:A="category",rAccessor:j="value",colorAccessor:O,symbolAccessor:M,symbolMap:C,stackBy:_,groupBy:P,multiAxis:L,timeAccessor:T,valueAccessor:R,categoryAccessor:$,projection:N="vertical",size:E=[600,400],responsiveWidth:B,responsiveHeight:D,margin:I,barPadding:F,roundedTop:H,gradientFill:W,trackFill:z,baselinePadding:Y,innerRadius:G,cornerRadius:q,normalize:X,startAngle:V,sweepAngle:U,dynamicColumnWidth:Q,bins:K,showOutliers:Z,showIQR:J,amplitude:ee,connectorOpacity:te,showLabels:ne,connectorAccessor:oe,connectorStyle:ie,dataIdAccessor:re,rExtent:se,oExtent:ae,extentPadding:le=.05,oSort:ce,windowMode:ue="sliding",windowSize:de=200,pieceStyle:he,summaryStyle:ge,colorScheme:fe,barColors:pe,showAxes:ye=!0,showCategoryTicks:me,categoryLabel:ve,valueLabel:be,categoryFormat:xe,valueFormat:ke,oLabel:we,rLabel:Ae,oFormat:je,rFormat:Se,rTickValues:Oe,tickLabelEdgeAlign:Me,axisExtent:Ce,enableHover:_e=!0,hoverAnnotation:Pe,tooltipContent:Le,customHoverBehavior:Te,annotations:Re,autoPlaceAnnotations:$e,svgAnnotationRules:Ne,showGrid:Ee=!1,legend:Be,legendHoverBehavior:De,legendClickBehavior:Ie,legendHighlightedCategory:Fe,legendIsolatedCategories:He,legendPosition:We,legendLayout:ze,legendCategoryAccessor:Ye,onCategoriesChange:Ge,backgroundGraphics:qe,foregroundGraphics:Xe,title:Ve,className:Ue,background:Qe,centerContent:Ke,decay:Ze,pulse:Je,transition:tt,animate:nt,staleness:ot,brush:rt,onBrush:st,accessibleTable:at=!0,description:lt,summary:ct,customLayout:dt,layoutConfig:ht,layoutSelection:gt}=n,ft=t.useRef(!0),pt=Pi({sizeProp:E,responsiveWidth:B,responsiveHeight:D,userMargin:I,marginDefault:Qr,foregroundGraphics:Xe,backgroundGraphics:qe,animate:nt,transitionProp:tt,themeDirtyRef:ft}),{reducedMotionRef:yt,responsiveRef:mt,size:bt,margin:xt,adjustedWidth:kt,adjustedHeight:wt,resolvedForeground:At,resolvedBackground:jt,currentTheme:St,transition:Ot,introEnabled:Mt,tableId:Ct,rafRef:_t,renderFnRef:Pt,scheduleRender:Lt}=pt,Tt=Co(),Rt=To(),$t=t.useMemo(()=>k(x),[x]),Nt=null!=ve?ve:we,Et=null!=be?be:Ae,Ft=null!=xe?xe:je,Ht=null!=ke?ke:Se,zt=t.useRef(null),Yt=t.useRef(null),Gt=t.useRef([]),Vt=t.useRef(Ye),Ut=t.useRef(Ge);Vt.current=Ye,Ut.current=Ge;const[Qt,Kt]=t.useState(null),[Zt,Jt]=t.useState(null),[en,tn]=t.useState(0),nn=t.useRef(0),[on,rn]=t.useState(!1),sn=t.useRef({w:-1,h:-1}),an=_e||Pe,ln="streaming"===b,cn=t.useMemo(()=>{var e,t,n;return{chartType:v,runtimeMode:ln?"streaming":"bounded",windowSize:de,windowMode:ue,extentPadding:le,projection:N,oAccessor:ln?void 0:A,rAccessor:ln?void 0:j,colorAccessor:O,symbolAccessor:M,symbolMap:C,stackBy:_,groupBy:P,multiAxis:L,timeAccessor:ln?T:void 0,valueAccessor:ln?R||("string"==typeof j||"function"==typeof j?j:void 0):void 0,categoryAccessor:ln?$||A:void 0,rExtent:se,oExtent:ae,axisExtent:Ce,barPadding:F,roundedTop:H,gradientFill:W,trackFill:z,baselinePadding:Y,innerRadius:G,cornerRadius:q,normalize:X,startAngle:V,sweepAngle:U,dynamicColumnWidth:Q,bins:K,showOutliers:Z,showIQR:J,amplitude:ee,connectorOpacity:te,showLabels:ne,connectorAccessor:oe,connectorStyle:ie,dataIdAccessor:re,oSort:ce,pieceStyle:he,summaryStyle:ge,colorScheme:fe,themeCategorical:null===(e=null==St?void 0:St.colors)||void 0===e?void 0:e.categorical,themeSemantic:S(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:pe,decay:Ze,pulse:Je,transition:Ot,introAnimation:Mt,staleness:ot,customLayout:dt,layoutConfig:ht,layoutMargin:xt}},[v,de,ue,le,N,A,j,O,M,C,_,P,L,T,R,$,se,ae,Ce,F,H,W,z,Y,G,q,X,V,U,Q,K,Z,J,ee,te,ne,oe,ie,re,ce,he,ge,fe,pe,Ze,Je,null==Ot?void 0:Ot.duration,null==Ot?void 0:Ot.easing,Mt,ot,ln,St,dt,ht,xt]),un=$o(cn),dn=t.useRef(null);dn.current||(dn.current=new xr(un));const hn=t.useCallback(()=>{var e,t;const n=Vt.current,o=Ut.current;if(!o||!n)return;const i=er(null!==(t=null===(e=dn.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[],n);tr(i,Gt.current)||(Gt.current=i,o(i))},[]);t.useEffect(()=>{var e;null===(e=dn.current)||void 0===e||e.updateConfig(un),ft.current=!0,Lt()},[un,Lt]);const gn=t.useRef(null);t.useEffect(()=>{const e=dn.current;if(!e)return;const t=null!=gt?gt:null;gn.current!==t&&(gn.current=t,e.setLayoutSelection(t),e.hasCustomRestyle?e.restyleScene(t):ft.current=!0,Lt())},[gt,Lt]);const fn=t.useRef(null);fn.current||(fn.current=new w(e=>{const t=dn.current;t&&t.ingest(e)&&(ft.current=!0,Lt())}));const pn=t.useCallback(e=>{var t;null===(t=fn.current)||void 0===t||t.push(e)},[]),yn=t.useCallback(e=>{var t;null===(t=fn.current)||void 0===t||t.pushMany(e)},[]),mn=t.useCallback(()=>{var e,t;null===(e=fn.current)||void 0===e||e.clear(),null===(t=dn.current)||void 0===t||t.clear(),ft.current=!0,Lt()},[Lt]),vn=t.useCallback(e=>{var t,n;null===(t=fn.current)||void 0===t||t.clearLastData(),null===(n=fn.current)||void 0===n||n.setReplacementData(e)},[]);t.useImperativeHandle(o,()=>({push:pn,pushMany:yn,replace:vn,remove:e=>{var t,n,o,i;null===(t=fn.current)||void 0===t||t.flush();const r=null!==(o=null===(n=dn.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[];if(r.length>0){const e=null===(i=Yt.current)||void 0===i?void 0:i.data;!!Yt.current&&r.some(Array.isArray(e)?t=>e.includes(t):t=>t===e)&&(Yt.current=null,Kt(null)),ft.current=!0,Lt()}return r},update:(e,t)=>{var n,o,i;null===(n=fn.current)||void 0===n||n.flush();const r=null!==(i=null===(o=dn.current)||void 0===o?void 0:o.update(e,t))&&void 0!==i?i:[];return r.length>0&&(ft.current=!0,Lt()),r},clear:mn,getData:()=>{var e,t,n;return null===(e=fn.current)||void 0===e||e.flush(),null!==(n=null===(t=dn.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=dn.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[pn,yn,vn,mn,Lt]),t.useEffect(()=>{var e;x&&(null===(e=fn.current)||void 0===e||e.setBoundedData($t))},[x,$t]);const{hoverHandlerRef:bn,hoverLeaveRef:xn,onPointerMove:kn,onPointerLeave:wn}=pt;bn.current=e=>{if(!an)return;const t=zt.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-xt.left,i=e.clientY-n.top-xt.top;if(0>o||o>kt||0>i||i>wt)return void(Yt.current&&(Yt.current=null,Kt(null),Te&&Te(null),Lt()));const r=dn.current;if(!r||0===r.scene.length)return;const s="radial"===N,a=function(e,t,n,o=30,i,r=0){let s=null;if(i){const e=ut(i,t,n,o,r);e&&(s={datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const r of e){let e=null;switch(r.type){case"rect":if(null==r.datum)break;e=kr(r,t,n);break;case"point":if(i)break;e=wr(r,t,n,o);break;case"symbol":e=Ar(r,t,n,o);break;case"wedge":if(null===r.datum)break;e=jr(r,t,n);break;case"boxplot":e=Sr(r,t,n);break;case"violin":e=Or(r,t,n)}e&&o>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}(r.scene,s?o-kt/2:o,s?i-wt/2:i,30,r.pointQuadtree,r.maxPointRadius);if(!a)return void(Yt.current&&(Yt.current=null,Kt(null),Te&&Te(null),Lt()));const l=hi(a.datum||{},a.x,a.y,Object.assign(Object.assign(Object.assign({},a.stats&&{stats:a.stats}),a.category&&{category:a.category}),{__oAccessor:"string"==typeof A?A:void 0,__rAccessor:"string"==typeof j?j:void 0,__chartType:v}));Yt.current=l,Kt(l),Te&&(Te(l),ft.current=!0),Lt()},xn.current=()=>{Yt.current&&(Yt.current=null,Kt(null),Te&&(Te(null),ft.current=!0),Lt())};const An=t.useRef(-1),jn=t.useRef(null),Sn=t.useRef(null),On=t.useCallback(e=>{const t=dn.current;if(!t||0===t.scene.length)return;const n=t.version;let o;if(Sn.current&&Sn.current.version===n)o=Sn.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("symbol"===r.type){if(0>=r.size)continue;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=Bt(e),Sn.current={version:n,graph:o}}const i=An.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),An.current=0;const t=o.flat[0];jn.current={shape:t.shape,w:t.w,h:t.h};const n=Object.assign(Object.assign({},Wt(t)),{__oAccessor:"string"==typeof A?A:void 0,__rAccessor:"string"==typeof j?j:void 0,__chartType:v});return Yt.current=n,Kt(n),Te&&Te(n),void Lt()}const r=Dt(o,i),s=It(e.key,r,o);if(null===s)return;if(e.preventDefault(),0>s)return An.current=-1,jn.current=null,Yt.current=null,Kt(null),Te&&Te(null),void Lt();An.current=s;const a=o.flat[s];jn.current={shape:a.shape,w:a.w,h:a.h};const l=Object.assign(Object.assign({},Wt(a)),{__oAccessor:"string"==typeof A?A:void 0,__rAccessor:"string"==typeof j?j:void 0,__chartType:v});Yt.current=l,Kt(l),Te&&Te(l),Lt()},[Te,Lt]),Mn=t.useCallback(e=>{An.current=-1,jn.current=null,kn(e)},[kn]);Pt.current=()=>{var e,t;_t.current=0;const n=zt.current;if(!n)return;const o=n.getContext("2d");if(!o)return;const i=dn.current;if(!i)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=i.advanceTransition(yt.current?r+1e6:r),a=!yt.current&&s,l=sn.current.w!==kt||sn.current.h!==wt,c=ft.current;let u=!1;!c&&!l||a&&!l||(i.computeScene({width:kt,height:wt}),sn.current={w:kt,h:wt},u=!0,hn()),ft.current=c&&a&&!u,(u||a)&&n.setAttribute("aria-label",Wo(i.scene,v+" chart"));const d=Ti(),h=bt[0]*d,g=bt[1]*d;n.width===h&&n.height===g||(n.width=h,n.height=g,n.style.width=bt[0]+"px",n.style.height=bt[1]+"px"),o.setTransform(d,0,0,d,0,0),o.clearRect(0,0,bt[0],bt[1]);const f=null!==(e=null==ot?void 0:ot.threshold)&&void 0!==e?e:5e3,p=ot&&i.lastIngestTime>0&&r-i.lastIngestTime>f;if(p&&(o.globalAlpha=null!==(t=null==ot?void 0:ot.dimOpacity)&&void 0!==t?t:.5),"transparent"!==Qe&&!qe){const e=n?getComputedStyle(n).getPropertyValue("--semiotic-bg").trim():"",t=Qe||(e&&"transparent"!==e?e:null),i=t?vt(o,t):null;i&&(o.fillStyle=i,o.fillRect(0,0,bt[0],bt[1]))}const y="radial"===N;o.save(),o.beginPath(),o.rect(xt.left,xt.top,kt,wt),o.clip(),y?(o.save(),o.translate(xt.left+kt/2,xt.top+wt/2)):o.translate(xt.left,xt.top);const m=dt?Ur.custom:Ur[v]||[],b={width:kt,height:wt};for(const e of m)e(o,i.scene,i.scales,b);y&&o.restore(),o.restore(),p&&(o.globalAlpha=1),u&&i.scales?(Jt(i.scales),tn(e=>e+1),nn.current=r):a&&i.scales&&r-nn.current>=33&&(tn(e=>e+1),nn.current=r),(null==ot?void 0:ot.showBadge)&&rn(!!p),(a||null!=i.activeTransition||i.hasActivePulses)&&(_t.current=requestAnimationFrame(()=>Pt.current()))},Ro({hydrated:Tt,wasHydratingFromSSR:Rt,storeRef:dn,dirtyRef:ft,renderFnRef:Pt,cleanup:()=>{var e;return null===(e=fn.current)||void 0===e?void 0:e.clear()}}),t.useEffect(()=>{ft.current=!0,Lt()},[v,kt,wt,ye,Qe,Lt]),qt(ot,dn,ft,Lt,on,rn);const Cn=an&&Qt?Le?Le(Qt):e.jsx(Jr,{hover:Qt}):null,_n="radial"===N,Pn=Cn?e.jsx(Si,{x:Qt?_n?Qt.x+kt/2:Qt.x:0,y:Qt?_n?Qt.y+wt/2:Qt.y:0,containerWidth:kt,containerHeight:wt,margin:xt,className:"stream-ordinal-tooltip",children:Cn}):null,Ln=nr(A,void 0,"__semiotic_resolvedO",""),Tn=nr(j,void 0,"__semiotic_resolvedR",""),Rn=Ln.key,$n=Tn.key,Nn=or(Ln,Tn,Re&&Re.length>0||!1);if(Oo||!Tt&&Rt){const t=dn.current;t&&x&&(t.ingest({inserts:$t,bounded:!0}),t.computeScene({width:kt,height:wt}));const n=null!==(i=null==t?void 0:t.scene)&&void 0!==i?i:[],o=null!==(r=null==t?void 0:t.scales)&&void 0!==r?r:null,l="radial"===N,c=l?xt.left+kt/2:xt.left,u=l?xt.top+wt/2:xt.top;return e.jsxs("div",{ref:mt,className:"stream-ordinal-frame"+(Ue?" "+Ue:""),role:"img","aria-label":lt||("string"==typeof Ve?Ve:"Ordinal chart"),style:{position:"relative",width:B?"100%":bt[0],height:D?"100%":bt[1]},children:[e.jsx(si,{summary:ct}),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:bt[0],height:bt[1],style:{position:"absolute",left:0,top:0},children:[jt&&e.jsx("g",{transform:`translate(${xt.left},${xt.top})`,children:jt}),e.jsxs("g",{transform:`translate(${c},${u})`,children:[Qe&&e.jsx("rect",{x:0,y:0,width:kt,height:wt,fill:Qe}),n.map((t,n)=>function(t,n,o){var i,r,a,l,c,u,d,h,g;const f=("category"in t?t.category:void 0)||("group"in t?t.group:void 0)||"",y=e=>`ord-${t.type}-${f}-${n}-${e}`,m=`ord-${t.type}-${f}-${n}`;switch(t.type){case"rect":{const n=t,o=So(m)+"-grad",i=function(t,n){const o=t.fillGradient;if(!o)return null;let i=t.x,r=t.y,s=t.x,a=t.y+t.h;"bottom"===t.roundedEdge?(r=t.y+t.h,a=t.y):"right"===t.roundedEdge?(i=t.x+t.w,r=t.y,s=t.x,a=t.y):"left"===t.roundedEdge&&(i=t.x,r=t.y,s=t.x+t.w,a=t.y);const l=[];if("colorStops"in 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.jsx("stop",{offset:t[n].offset,stopColor:t[n].color},n))}else{const n=Ao(t.style.fill);l.push(e.jsx("stop",{offset:0,stopColor:n,stopOpacity:o.topOpacity},"0")),l.push(e.jsx("stop",{offset:1,stopColor:n,stopOpacity:o.bottomOpacity},"1"))}return e.jsx("linearGradient",{id:n,gradientUnits:"userSpaceOnUse",x1:i,y1:r,x2:s,y2:a,children:l})}(n,o),r=i?`url(#${o})`:Ao(n.style.fill);if(n.cornerRadii&&mo(n.cornerRadii)){const t=function(e){const{x:t,y:n,w:o,h:i}=e,{tl:r,tr:s,br:a,bl:l}=vo(e);let c=`M${t+r},${n}`;return c+=` L${t+o-s},${n}`,s>0&&(c+=` A${s},${s} 0 0 1 ${t+o},${n+s}`),c+=` L${t+o},${n+i-a}`,a>0&&(c+=` A${a},${a} 0 0 1 ${t+o-a},${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}(n);return e.jsxs(p.Fragment,{children:[i&&e.jsx("defs",{children:i}),e.jsx("path",{d:t,fill:r,opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})]},m)}if(n.roundedTop&&n.roundedTop>0){const t=Math.min(n.roundedTop,n.w/2,n.h/2),{x:o,y:s,w:a,h:l}=n;let c;switch(n.roundedEdge){case"right":c=`M${o},${s} L${o+a-t},${s} A${t},${t} 0 0 1 ${o+a},${s+t} L${o+a},${s+l-t} A${t},${t} 0 0 1 ${o+a-t},${s+l} L${o},${s+l} Z`;break;case"left":c=`M${o+a},${s} L${o+t},${s} A${t},${t} 0 0 0 ${o},${s+t} L${o},${s+l-t} A${t},${t} 0 0 0 ${o+t},${s+l} L${o+a},${s+l} Z`;break;case"bottom":c=`M${o},${s} L${o+a},${s} L${o+a},${s+l-t} A${t},${t} 0 0 1 ${o+a-t},${s+l} L${o+t},${s+l} A${t},${t} 0 0 1 ${o},${s+l-t} Z`;break;default:c=`M${o},${s+l} L${o},${s+t} A${t},${t} 0 0 1 ${o+t},${s} L${o+a-t},${s} A${t},${t} 0 0 1 ${o+a},${s+t} L${o+a},${s+l} Z`}return e.jsxs(p.Fragment,{children:[i&&e.jsx("defs",{children:i}),e.jsx("path",{d:c,fill:r,opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})]},m)}return e.jsxs(p.Fragment,{children:[i&&e.jsx("defs",{children:i}),e.jsx("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:r,opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})]},m)}case"point":{const n=t;return e.jsx("circle",{cx:n.x,cy:n.y,r:n.r,fill:Ao(n.style.fill),opacity:null!==(i=n.style.opacity)&&void 0!==i?i:.8,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth},m)}case"symbol":return jo(t,n,o);case"wedge":{const i=t;if(i._gradientBand&&i._gradientBand.colors.length>0){const t=So(`${o?o+"-":""}gauge-grad-${i.category||m}-${n}`),{clipPath:s,slices:u}=ko({innerRadius:i.innerRadius,outerRadius:i.outerRadius,startAngle:i.startAngle,endAngle:i.endAngle,cornerRadius:i.cornerRadius,roundStart:null===(a=null===(r=i.roundedEnds)||void 0===r?void 0:r.start)||void 0===a||a,roundEnd:null===(c=null===(l=i.roundedEnds)||void 0===l?void 0:l.end)||void 0===c||c,colors:i._gradientBand.colors});return e.jsxs("g",{transform:`translate(${i.cx},${i.cy})`,opacity:i.style.opacity,fillOpacity:i.style.fillOpacity,children:[e.jsx("defs",{children:e.jsx("clipPath",{id:t,children:e.jsx("path",{d:s})})}),e.jsx("g",{clipPath:`url(#${t})`,children:u.map((t,n)=>e.jsx("path",{d:t.d,fill:Ao(t.color)},n))}),i.style.stroke&&"none"!==i.style.stroke&&e.jsx("path",{d:s,fill:"none",stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})]},m)}let u;if(i.roundedEnds)u=xo({innerRadius:i.innerRadius,outerRadius:i.outerRadius,startAngle:i.startAngle,endAngle:i.endAngle,cornerRadius:i.cornerRadius,roundStart:i.roundedEnds.start,roundEnd:i.roundedEnds.end});else{const e=s.arc().innerRadius(i.innerRadius).outerRadius(i.outerRadius).startAngle(i.startAngle+Math.PI/2).endAngle(i.endAngle+Math.PI/2);i.cornerRadius&&e.cornerRadius(i.cornerRadius),u=e(wo)||""}return e.jsx("path",{d:u,transform:`translate(${i.cx},${i.cy})`,fill:Ao(i.style.fill),stroke:i.style.stroke,strokeWidth:i.style.strokeWidth,opacity:i.style.opacity},m)}case"boxplot":{const n=t,o=n.columnWidth/2;return e.jsxs("g","vertical"===n.projection?{children:[e.jsx("line",{x1:n.x,y1:n.minPos,x2:n.x,y2:n.maxPos,stroke:n.style.stroke||"#333",strokeWidth:1}),e.jsx("rect",{x:n.x-o,y:Math.min(n.q1Pos,n.q3Pos),width:n.columnWidth,height:Math.abs(n.q3Pos-n.q1Pos),fill:Ao(n.style.fill),fillOpacity:null!==(u=n.style.fillOpacity)&&void 0!==u?u:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),e.jsx("line",{x1:n.x-o,y1:n.medianPos,x2:n.x+o,y2:n.medianPos,stroke:n.style.stroke||"#333",strokeWidth:2}),e.jsx("line",{x1:n.x-.5*o,y1:n.minPos,x2:n.x+.5*o,y2:n.minPos,stroke:n.style.stroke||"#333",strokeWidth:1}),e.jsx("line",{x1:n.x-.5*o,y1:n.maxPos,x2:n.x+.5*o,y2:n.maxPos,stroke:n.style.stroke||"#333",strokeWidth:1})]}:{children:[e.jsx("line",{x1:n.minPos,y1:n.y,x2:n.maxPos,y2:n.y,stroke:n.style.stroke||"#333",strokeWidth:1}),e.jsx("rect",{x:Math.min(n.q1Pos,n.q3Pos),y:n.y-o,width:Math.abs(n.q3Pos-n.q1Pos),height:n.columnWidth,fill:Ao(n.style.fill),fillOpacity:null!==(d=n.style.fillOpacity)&&void 0!==d?d:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),e.jsx("line",{x1:n.medianPos,y1:n.y-o,x2:n.medianPos,y2:n.y+o,stroke:n.style.stroke||"#333",strokeWidth:2}),e.jsx("line",{x1:n.minPos,y1:n.y-.5*o,x2:n.minPos,y2:n.y+.5*o,stroke:n.style.stroke||"#333",strokeWidth:1}),e.jsx("line",{x1:n.maxPos,y1:n.y-.5*o,x2:n.maxPos,y2:n.y+.5*o,stroke:n.style.stroke||"#333",strokeWidth:1})]},m)}case"violin":{const n=t,o=[e.jsx("path",{d:n.pathString,transform:n.translateX||n.translateY?`translate(${n.translateX},${n.translateY})`:void 0,fill:Ao(n.style.fill),fillOpacity:null!==(h=n.style.fillOpacity)&&void 0!==h?h:.6,stroke:n.style.stroke||"#333",strokeWidth:n.style.strokeWidth||1},y("path"))];if(n.iqrLine&&n.bounds){const t=n.bounds,i=t.x+t.width/2,r=t.y+t.height/2;t.height>t.width?o.push(e.jsx("line",{x1:i,y1:n.iqrLine.q1Pos,x2:i,y2:n.iqrLine.q3Pos,stroke:n.style.stroke||"#333",strokeWidth:2},y("iqr")),e.jsx("circle",{cx:i,cy:n.iqrLine.medianPos,r:3,fill:"white",stroke:n.style.stroke||"#333",strokeWidth:1},y("med"))):o.push(e.jsx("line",{x1:n.iqrLine.q1Pos,y1:r,x2:n.iqrLine.q3Pos,y2:r,stroke:n.style.stroke||"#333",strokeWidth:2},y("iqr")),e.jsx("circle",{cx:n.iqrLine.medianPos,cy:r,r:3,fill:"white",stroke:n.style.stroke||"#333",strokeWidth:1},y("med")))}return e.jsx("g",{children:o},m)}case"connector":return e.jsx("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.stroke||"#999",strokeWidth:t.style.strokeWidth||1,opacity:null!==(g=t.style.opacity)&&void 0!==g?g:.5},m);case"trapezoid":{const n=t,o=n.points.map(e=>`${e[0]},${e[1]}`).join(" ");return e.jsx("polygon",{points:o,fill:Ao(n.style.fill,"#999"),opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth},m)}default:return null}}(t,n,Ct)).filter(Boolean)]})]}),e.jsx(_r,{width:kt,height:wt,totalWidth:bt[0],totalHeight:bt[1],margin:xt,scales:o,showAxes:ye,showCategoryTicks:me,oLabel:Nt,rLabel:Et,oFormat:Ft,rFormat:Ht,rTickValues:Oe,tickLabelEdgeAlign:Me,axisExtent:Ce,showGrid:Ee,title:Ve,legend:Be,legendHoverBehavior:De,legendClickBehavior:Ie,legendHighlightedCategory:Fe,legendIsolatedCategories:He,legendPosition:We,legendLayout:ze,foregroundGraphics:et(At,it(null===(a=dn.current)||void 0===a?void 0:a.customLayoutOverlays,null!=gt?gt:null)),annotations:Re,autoPlaceAnnotations:$e,svgAnnotationRules:Ne,annotationFrame:0,xAccessor:Rn,yAccessor:$n,annotationData:Nn(null==t?void 0:t.getData())}),Ke&&"radial"===N&&e.jsx("div",{style:{position:"absolute",left:xt.left+kt/2,top:xt.top+wt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:Ke})]})}return e.jsxs("div",{ref:mt,className:"stream-ordinal-frame"+(Ue?" "+Ue:""),role:"group","aria-label":lt||("string"==typeof Ve?Ve:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:B?"100%":bt[0],height:D?"100%":bt[1],overflow:"visible"},onKeyDown:On,children:[at&&e.jsx(ai,{tableId:Ct}),at&&e.jsx(ii,{scene:null!==(c=null===(l=dn.current)||void 0===l?void 0:l.scene)&&void 0!==c?c:[],chartType:v+" chart",tableId:Ct,chartTitle:"string"==typeof Ve?Ve:void 0}),e.jsx(si,{summary:ct}),e.jsx(li,{hoverPoint:Qt}),e.jsxs("div",{role:"img","aria-label":lt||("string"==typeof Ve?Ve:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:an?Mn:void 0,onMouseLeave:an?wn:void 0,children:[jt&&e.jsx("svg",{style:{position:"absolute",top:0,left:0,width:bt[0],height:bt[1],pointerEvents:"none"},children:e.jsx("g",{transform:`translate(${xt.left},${xt.top})`,children:jt})}),e.jsx(Mr,{width:kt,height:wt,totalWidth:bt[0],totalHeight:bt[1],margin:xt,scales:Zt,showAxes:ye,showGrid:Ee,rFormat:Ht,rTickValues:Oe,axisExtent:Ce}),e.jsx("canvas",{ref:zt,"aria-label":Wo(null!==(d=null===(u=dn.current)||void 0===u?void 0:u.scene)&&void 0!==d?d:[],v+" chart"),style:{position:"absolute",top:0,left:0,width:bt[0],height:bt[1]}}),e.jsx(_r,{width:kt,height:wt,totalWidth:bt[0],totalHeight:bt[1],margin:xt,scales:Zt,showAxes:ye,showCategoryTicks:me,oLabel:Nt,rLabel:Et,oFormat:Ft,rFormat:Ht,rTickValues:Oe,axisExtent:Ce,showGrid:Ee,title:Ve,legend:Be,legendHoverBehavior:De,legendClickBehavior:Ie,legendHighlightedCategory:Fe,legendIsolatedCategories:He,legendPosition:We,legendLayout:ze,foregroundGraphics:et(At,it(null===(h=dn.current)||void 0===h?void 0:h.customLayoutOverlays,null!=gt?gt:null)),annotations:Re,autoPlaceAnnotations:$e,svgAnnotationRules:Ne,annotationFrame:en,xAccessor:Rn,yAccessor:$n,annotationData:Nn(null===(g=dn.current)||void 0===g?void 0:g.getData()),underlayRendered:!0}),(rt||st)&&"radial"!==N&&e.jsx(Pr,{width:kt,height:wt,totalWidth:bt[0],totalHeight:bt[1],margin:xt,scales:Zt,onBrush:st||(()=>{})}),Ke&&"radial"===N&&e.jsx("div",{style:{position:"absolute",left:xt.left+kt/2,top:xt.top+wt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:Ke}),(null==ot?void 0:ot.showBadge)&&e.jsx(Xt,{isStale:on,position:ot.badgePosition}),e.jsx(ui,{active:An.current>=0,hoverPoint:Qt,margin:xt,size:bt,shape:null===(f=jn.current)||void 0===f?void 0:f.shape,width:null===(y=jn.current)||void 0===y?void 0:y.w,height:null===(m=jn.current)||void 0===m?void 0:m.h}),Pn]})]})});function ts(e){return"string"==typeof e?e:"value"}function ns(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function os(e,t){if(!t)return ns(e);try{const n=t(e);return null==n?ns(e):n}catch(t){return ns(e)}}function is(e,t){return"function"==typeof t?t(e):e[t]}function rs(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 ss(t){const n=t.find(e=>"title"===e.role),o=t.filter(e=>"title"!==e.role);return t=>{const i=t.data;if(!i)return null;const r=n?os(is(i,n.accessor),n.format):null;return e.jsxs("div",{className:"semiotic-tooltip",style:bi,children:[null!=r&&e.jsx("div",{style:{fontWeight:"bold",marginBottom:o.length>0?4:0},children:r}),o.map((t,n)=>{const o=os(is(i,t.accessor),t.format);return e.jsxs("div",{style:n>0?{marginTop:2}:void 0,children:[e.jsxs("span",{style:{opacity:.7},children:[t.label,": "]}),e.jsx("span",{children:o})]},n)})]})}}function as({categoryAccessor:t,valueAccessor:n,groupAccessor:o,groupLabel:i,pieData:r=!1,valueFormat:s}){return a=>{var l;const c=r?(null===(l=a.data)||void 0===l?void 0:l[0])||a.data||a:a.data||a,u=is(c,t),d=is(c,n),h=o?is(c,o):void 0;return e.jsxs("div",{className:"semiotic-tooltip",style:bi,children:[e.jsx("div",{style:{fontWeight:"bold"},children:ns(u)}),e.jsx("div",{style:{marginTop:4},children:os(d,s)}),null!=h&&e.jsxs("div",{style:{marginTop:2,opacity:.8},children:[i||ts(o),": ",ns(h)]})]})}}es.displayName="StreamOrdinalFrame";const ls={weightChange:.1,newEdge:.5,newNode:1,threshold:3,transitionDuration:500},cs={radius:3,opacity:.7,speedMultiplier:1,maxPerEdge:50,spawnRate:.1};class us{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 s=this.particles[r];if(!s.active)continue;const a=n[s.edgeIndex];if(!a||!a.bezier){s.active=!1,this._freeIndices.push(r);continue}const l=o&&null!==(i=o[s.edgeIndex])&&void 0!==i?i:1;s.t+=e*t*l*(a.bezier.circular?.3:1),1>s.t?ds(a.bezier,s.t,s.offset,s):(s.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 ds(e,t,n,o){if(e.circular&&e.segments)return void function(e,t,n,o,i){const r=e.length,s=t*r,a=Math.min(Math.floor(s),r-1),l=s-a,[c,u,d,h]=e[a];hs(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,s,a]=e.points;hs(i,r,s,a,t,o);const l=a.x-i.x,c=a.y-i.y,u=Math.sqrt(l*l+c*c);if(u>.001){const t=l/u;o.x+=-c/u*n*e.halfWidth*2,o.y+=t*n*e.halfWidth*2}}function hs(e,t,n,o,i,r){const s=1-i,a=s*s,l=a*s,c=i*i,u=c*i;r.x=l*e.x+3*a*i*t.x+3*s*c*n.x+u*o.x,r.y=l*e.y+3*a*i*t.y+3*s*c*n.y+u*o.y}function gs(e,t){var n=e.get(t);if(!n)throw Error("missing: "+t);return n}function fs(e,t){var n,o=[],i=[],r=[],s={},a=[];function l(e){r[e]=!1,s.hasOwnProperty(e)&&Object.keys(s[e]).forEach(function(t){delete s[e][t],r[t]&&l(t)})}function c(e){var t,o,d=!1;for(i.push(e),r[e]=!0,t=0;a[e].length>t;t++)(o=a[e][t])===n?(u(n,i),d=!0):r[o]||(d=c(o));if(d)l(e);else for(t=0;a[e].length>t;t++){var h=s[o=a[e][t]];h||(s[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),s=Array(t),a=Array(t),l=0;t>l;++l)n[l]=-1,o[l]=0,i[l]=!1,r[l]=0,s[l]=-1,a[l]=[];var c,u=0,d=[],h=[];function g(t){var l=[t],c=[t];for(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>s[p]||a[t].push(s[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(a[b]),v+=a[b].length,s[b]=d.length,b===t){l.length=f;break}}d.push(y);var x=Array(v);for(f=0;m.length>f;f++)for(var k=0;m[f].length>k;k++)x[--v]=m[f][k];h.push(x)}c.pop()}}}for(l=0;t>l;++l)0>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,s=0;i.length>s;s++)for(var a=0;i[s].length>a;a++)r>i[s][a]&&(r=i[s][a],n=s);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,a=g.adjList){for(var f=0;a.length>f;f++)for(var p=0;a[f].length>p;p++){var y=a[f][p];r[+y]=!1,s[y]={}}c(n),n+=1}else n=h}return o}function ps(e){return e.y0-e.y1>0?"up":"down"}function ys(e,t){return t(e.source)==t(e.target)}function ms(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 vs(e){return e.target.x0-e.source.x1}function bs(e,t){var n=ks(e),o=vs(t)/Math.tan(n);return"up"==ps(e)?e.y1-o:e.y1+o}function xs(e,t){var n=ks(e),o=vs(t)/Math.tan(n);return"up"==ps(e)?e.y1+o:e.y1-o}function ks(e){var t=Math.abs(e.y1-e.y0);return Math.atan(Math.abs(e.target.x0-e.source.x1)/t)}function ws(e,t){return t(e)}function As(e){return Ss(e.source)}function js(e){return Ss(e.target)}function Ss(e){return(e.y0+e.y1)/2}function Os(e){return e.virtual?0:e.value}function Ms(e,t){var n=0;e.sourceLinks.forEach(function(e){n=e.circular&&!ys(e,t)?n+1:n});var o=0;return e.targetLinks.forEach(function(e){o=e.circular&&!ys(e,t)?o+1:o}),n+o}function Cs(e){return e.target.depth}function _s(e,t){return e.sourceLinks.length?e.depth:t-1}function Ps(e,t){return e.y0-t.y0}function Ls(e,t){return t.y0-e.y0}function Ts(e,t){return e.y1-t.y1}function Rs(e,t){return t.y1-e.y1}function $s(e,t){return Es(e.source,t.source)||e.index-t.index}function Ns(e,t){return Es(e.target,t.target)||e.index-t.index}function Es(e,t){return e.partOfCycle===t.partOfCycle?e.y0-t.y0:"top"===e.circularLinkType||"bottom"===t.circularLinkType?-1:1}function Bs(e,t){return Ds(e)==Ds(t)?"bottom"==e.circularLinkType?Ls(e,t):Ps(e,t):Ds(t)-Ds(e)}function Ds(e){return e.target.column-e.source.column}function Is(e,t){return Fs(e)==Fs(t)}function Fs(e){return e.y0-e.y1>0?"up":"down"}function Hs(e,t,n,o,i){let r=e;var s=Math.max(8,.15*(r.y1-r.y0));r.links.forEach(function(e){e.circular&&(e._circularWidth=Math.min(e.width,s))});var l=a.min(r.links,function(e){return e.source.y0});r.links.forEach(function(e){e.circular&&(e.circularPathData={})});var c=r.links.filter(function(e){return e.circular});return c.sort(function(e,t){return t.value-e.value}),c.forEach(function(e,t){e._circularStub=t>=4}),Ws(r.links.filter(function(e){return"top"==e.circularLinkType}),t,n),Ws(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,ys(e,t)&&ms(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 s=e.source.column,a=e.circularLinkType,c=r.links.filter(function(e){return e.source.column==s&&e.circularLinkType==a});c.sort("bottom"==e.circularLinkType?Ls:Ps);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}),s=e.target.column,(c=r.links.filter(function(e){return e.target.column==s&&e.circularLinkType==a})).sort("bottom"==e.circularLinkType?Rs:Ts),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=l-i-e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius)}e.circularPathData.rightInnerExtent=e.circularPathData.sourceX+e.circularPathData.rightNodeBuffer,e.circularPathData.leftInnerExtent=e.circularPathData.targetX-e.circularPathData.leftNodeBuffer,e.circularPathData.rightFullExtent=e.circularPathData.sourceX+e.circularPathData.rightLargeArcRadius+e.circularPathData.rightNodeBuffer,e.circularPathData.leftFullExtent=e.circularPathData.targetX-e.circularPathData.leftLargeArcRadius-e.circularPathData.leftNodeBuffer}e.path=e.circular?function(e){return"top"==e.circularLinkType?"M"+e.circularPathData.sourceX+" "+e.circularPathData.sourceY+" L"+e.circularPathData.rightInnerExtent+" "+e.circularPathData.sourceY+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightSmallArcRadius+" 0 0 0 "+e.circularPathData.rightFullExtent+" "+(e.circularPathData.sourceY-e.circularPathData.rightSmallArcRadius)+" L"+e.circularPathData.rightFullExtent+" "+e.circularPathData.verticalRightInnerExtent+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightLargeArcRadius+" 0 0 0 "+e.circularPathData.rightInnerExtent+" "+e.circularPathData.verticalFullExtent+" L"+e.circularPathData.leftInnerExtent+" "+e.circularPathData.verticalFullExtent+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftLargeArcRadius+" 0 0 0 "+e.circularPathData.leftFullExtent+" "+e.circularPathData.verticalLeftInnerExtent+" L"+e.circularPathData.leftFullExtent+" "+(e.circularPathData.targetY-e.circularPathData.leftSmallArcRadius)+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftSmallArcRadius+" 0 0 0 "+e.circularPathData.leftInnerExtent+" "+e.circularPathData.targetY+" L"+e.circularPathData.targetX+" "+e.circularPathData.targetY:"M"+e.circularPathData.sourceX+" "+e.circularPathData.sourceY+" L"+e.circularPathData.rightInnerExtent+" "+e.circularPathData.sourceY+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightSmallArcRadius+" 0 0 1 "+e.circularPathData.rightFullExtent+" "+(e.circularPathData.sourceY+e.circularPathData.rightSmallArcRadius)+" L"+e.circularPathData.rightFullExtent+" "+e.circularPathData.verticalRightInnerExtent+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightLargeArcRadius+" 0 0 1 "+e.circularPathData.rightInnerExtent+" "+e.circularPathData.verticalFullExtent+" L"+e.circularPathData.leftInnerExtent+" "+e.circularPathData.verticalFullExtent+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftLargeArcRadius+" 0 0 1 "+e.circularPathData.leftFullExtent+" "+e.circularPathData.verticalLeftInnerExtent+" L"+e.circularPathData.leftFullExtent+" "+(e.circularPathData.targetY+e.circularPathData.leftSmallArcRadius)+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftSmallArcRadius+" 0 0 1 "+e.circularPathData.leftInnerExtent+" "+e.circularPathData.targetY+" L"+e.circularPathData.targetX+" "+e.circularPathData.targetY}(e):function(e){var t=e.source.x1,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 Ws(e,t,n){e.sort(Bs);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(ys(e,t)&&ms(e))e.circularPathData.verticalBuffer=r+e._circularWidth/2;else{for(var s=0;o.length>s;s++){var a=o[s];if(a!==e&&a.circularPathData&&void 0!==a.circularPathData.verticalBuffer&&zs(e,a)){var l=a.circularPathData.verticalBuffer+(a._circularWidth||a.width)/2+n;r=l>r?l:r}}e.circularPathData.verticalBuffer=r+e._circularWidth/2}}),e}function zs(e,t){return e.source.column>=t.target.column&&t.source.column>=e.target.column}function Ys(e){return function(){return e}}function Gs(e){return e.index}function qs(e){return e.nodes}function Xs(e){return e.links}function Vs(e,t,n){var o=a.groups(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 s=i.length;if(t)i.sort(t);else if(r>0){var a=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+=Ss(e.source)*t,o+=t}}),n.sourceLinks.forEach(function(e){if(!e.circular){var t=e.value||1;i+=Ss(e.target)*t,o+=t}}),o>0?i/o:NaN);a.set(e,{bc:r,idx:t})}),i.sort(function(e,t){var n=a.get(e),o=a.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?Ms(t,n)-Ms(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==s||0==t.depth&&1==s?(t.y0=e.y1/2-t.value*e.ky,t.y1=t.y0+t.value*e.ky):t.partOfCycle?0==Ms(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)/s*i,t.y1=t.y0+t.value*e.ky):(t.y0=(e.y1-e.y0)/2-s/2+i,t.y1=t.y0+t.value*e.ky)})})}function Us(e,t,n,o,i,r){var s=a.groups(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});d();for(var l=1,c=r;c>0;--c)u(l*=.99,n),d();function u(t,n){var o=s.length;s.forEach(function(i){var r=i.length,s=i[0].depth;i.forEach(function(i){var l;if(i.sourceLinks.length||i.targetLinks.length)if(i.partOfCycle&&Ms(i,n)>0){var c=a.mean(i.sourceLinks,js),u=a.mean(i.targetLinks,As),d=c&&u?(c+u)/2:c||u;if(d){var h=(d-Ss(i))*t*.3;i.y0+=h,i.y1+=h}}else if(0==s&&1==r)i.y0=e.y1/2-(l=i.y1-i.y0)/2,i.y1=e.y1/2+l/2;else if(s==o-1&&1==r)i.y0=e.y1/2-(l=i.y1-i.y0)/2,i.y1=e.y1/2+l/2;else if(1==i.targetLinks.length&&1==i.targetLinks[0].source.sourceLinks.length)l=i.y1-i.y0,i.y0=i.targetLinks[0].source.y0,i.y1=i.y0+l;else{var g=a.mean(i.sourceLinks,js),f=a.mean(i.targetLinks,As),p=((g&&f?(g+f)/2:g||f)-Ss(i))*t;i.y0+=p,i.y1+=p}})})}function d(){s.forEach(function(n){var r,s,a,l=e.y0,c=n.length;for(n.sort(t||Es),a=0;c>a;++a)(s=l-(r=n[a]).y0)>0&&(r.y0+=s,r.y1+=s),l=r.y1+o;if((s=l-o-e.y1)>0)for(l=r.y0-=s,r.y1-=s,a=c-2;a>=0;--a)(s=(r=n[a]).y1+i-l)>0&&(r.y0-=s,r.y1-=s),l=r.y0})}}function Qs(e){e.nodes.forEach(function(e){e.sourceLinks.sort(Ns),e.targetLinks.sort($s)}),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 Ks(){var e=0,t=0,n=1,o=1,i=24,r=8,s=null,l=Gs,c=_s,u=void 0,d=32,h=2,g=qs,f=Xs;function p(){var p={nodes:g.apply(null,arguments),links:f.apply(null,arguments)};return function(g){g.x0=e,g.y0=t,g.x1=n,g.y1=o,g.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 a.group(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=gs(n,o)),"object"!=typeof i&&(i=e.target=gs(n,i)),o.sourceLinks.push(e),i.targetLinks.push(e)})}(g,l),function(e,t){var n=0;if(null==t){for(var o=[],i=0;e.links.length>i;i++){var r=e.links[i],s=r.source.index,a=r.target.index;o[s]||(o[s]=[]),o[a]||(o[a]=[]),-1===o[s].indexOf(a)&&o[s].push(a)}var l=fs(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++)})}(g,u),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){ws(e,t)!=ws(i.source,t)&&ws(e,t)!=ws(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),ys(e,t)&&(e.circularLinkType=e.source.circularLinkType))})}(g,l),function(e){e.nodes.forEach(function(e){e.partOfCycle=!1,e.value=Math.max(a.sum(e.sourceLinks,Os),a.sum(e.targetLinks,Os)),e.sourceLinks.forEach(function(t){t.circular&&(e.partOfCycle=!0,e.circularLinkType=t.circularLinkType)}),e.targetLinks.forEach(function(t){t.circular&&(e.partOfCycle=!0,e.circularLinkType=t.circularLinkType)})})}(g),function(e,t,n){var o,i,r;if(null!=t){e.nodes.sort(function(e,n){return t(e)<t(n)?-1:1});var s=0,a=t(e.nodes[0]);e.nodes.forEach(function(e){s=t(e)==a?s:s+1,a=t(e)==a?a:t(e),e.column=s})}for(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})}(g,u,c);var f=r;if(null!==s){var p=a.groups(g.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]}),y=a.max(p,function(e){return e.length});y>1&&(f=Math.max(1,(o-t)*s/(y-1)))}(function(e,t,n){var o=a.groups(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});e.py=t;var i=a.min(o,function(t){return(e.y1-e.y0-(t.length-1)*e.py)/a.sum(t,function(e){return e.value})});e.ky=i,e.links.forEach(function(t){t.width=t.value*e.ky});var r=a.max(e.nodes,function(e){return e.column});e.nodes.forEach(r>0?function(t){t.x0=e.x0+t.column*((e.x1-e.x0-n)/r),t.x1=t.x0+n}:function(t){t.x0=e.x0,t.x1=t.x0+n})})(g,f,i),Vs(g,u,l),Us(g,u,l,f,f,d),Qs(g),Hs(g,l,h,10,8),Vs(g,u,l),Us(g,u,l,f,f,d),Qs(g),Hs(g,l,h,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 ws(n.source,t)==ws(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(!Is(e,t))return e.y1-t.y1;if(e.target.column>t.target.column){var n=bs(t,e);return e.y1-n}if(t.target.column>e.target.column)return bs(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,s=0;i>r;r++)s+=o[r].width;t.y0=e.y1-s-t.width/2}})})}(g,l),function(e,t){let n=e;n.nodes.forEach(function(e){var o=n.links.filter(function(n){return ws(n.target,t)==ws(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(!Is(e,t))return e.y0-t.y0;if(e.source.column>t.source.column){var n=xs(t,e);return e.y0-n}if(t.source.column>e.source.column)return xs(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,s=0;i>r;r++)s+=o[r].width;t.y1=e.y1-s-t.width/2}})})}(g,l),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=a.min(t,function(e){return e.y0}),s=a.max(t,function(e){return e.y1}),l=(e.y1-e.y0)/(s-r);function c(t){return(t-r)/(s-r)*(e.y1-e.y0)+e.y0}1>l?(t.forEach(function(e){e.y0=c(e.y0),e.y1=c(e.y1)}),n.forEach(function(e){e.y0=c(e.y0),e.y1=c(e.y1),e.width=e.width*l})):t.forEach(function(e){var t=e.y1-e.y0,n=c(e.y0)-e.y0;e.y0=c(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})})}}(g),Hs(g,l,h,10,8)}(p),p}return p.update=function(e){return Qs(e),Hs(e,l,h,10,8),e},p.nodeWidth=function(e){return arguments.length?(i=+e,p):i},p.nodePadding=function(e){return arguments.length?(r=+e,p):r},p.nodePaddingRatio=function(e){return arguments.length?(s=+e,p):s},p.nodes=function(e){return arguments.length?(g="function"==typeof e?e:Ys(e),p):g},p.links=function(e){return arguments.length?(f="function"==typeof e?e:Ys(e),p):f},p.nodeId=function(e){return arguments.length?(l="function"==typeof e?e:Ys(e),p):l},p.nodeAlign=function(e){return arguments.length?(c="function"==typeof e?e:Ys(e),p):c},p.nodeSort=function(e){return arguments.length?(u=e,p):u},p.iterations=function(e){return arguments.length?(d=+e,p):d},p.circularLinkGap=function(e){return arguments.length?(h=+e,p):h},p.extent=function(i){return arguments.length?(e=+i[0][0],t=+i[0][1],n=+i[1][0],o=+i[1][1],p):[[e,t],[n,o]]},p.size=function(i){return arguments.length?(e=t=0,n=+i[0],o=+i[1],p):[n-e,o-t]},p}function Zs(e){const{sx:t,sTop:n,sBot:o,tx:i,tTop:r,tBot:s,cp1X:a,cp2X:l}=e,c=(n+o)/2,u=(r+s)/2;return{pathD:[`M${t},${n}`,`C${a},${n} ${l},${r} ${i},${r}`,`L${i},${s}`,`C${l},${s} ${a},${o} ${t},${o}`,"Z"].join(" "),bezier:{circular:!1,points:[{x:t,y:c},{x:a,y:c},{x:l,y:u},{x:i,y:u}],halfWidth:(o-n)/2}}}const Js=e=>{let t,n,o,i,r,s,a,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,s=e.target.x0,a=u.interpolateNumber(r,s),l=a(.5),c=a(.5),`M${t},${r}C${t},${l} ${n},${c} ${n},${s}L${o},${s}C${o},${c} ${i},${l} ${i},${r}Z`;const d=e.sankeyWidth/2,h=u.interpolateNumber(e.source.x1,e.target.x0),{pathD:g}=Zs({sx:e.source.x1,sTop:e.y0-d,sBot:e.y0+d,tx:e.target.x0,tTop:e.y1-d,tBot:e.y1+d,cp1X:h(.5),cp2X:h(.5)});return g};function ea(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,s=i.targetY;if("object"!=typeof e.source||!e.source||"object"!=typeof e.target||!e.target)return null;const a=Math.max(15,Math.min(40,.33*(i.rightFullExtent-t))),l=Math.max(15,Math.min(40,.33*(r-i.leftFullExtent)));return`M${t},${o-n}L${t+a},${o-n}L${t+a},${o+n}L${t},${o+n}ZM${r},${s-n}L${r-l},${s-n}L${r-l},${s+n}L${r},${s+n}Z`}const r=i.sourceX,s=i.sourceY,a=i.targetX,l=i.targetY,c=i.rightFullExtent,u=i.leftFullExtent,d=i.verticalFullExtent,h="bottom"===e.circularLinkType?1:-1,g=Math.max(4,Math.min(o,15));return`M${r},${s-h*n}L${c},${s-h*n}L${c+o},${s-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${a},${l-h*n}L${a},${l+h*n}L${u+o},${l+h*n}L${u+o},${d-h*o}L${c-o},${d-h*o}L${c-o},${s+h*n}L${r},${s+h*n}Z`}const ta=new Set,na=new WeakMap;function oa(e,t){if("production"===process.env.NODE_ENV)return e;if(!e||!e.data||"object"!=typeof e.data)return e;let n=na.get(e);if(n){const e=n.get(t);if(e)return e}else n=new Map,na.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}`;ta.has(e)||(ta.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 ia={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(Cs))-1:0},justify:_s};function ra(e){return"string"==typeof e?e:e.id}const sa={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,n,o){var i,r,s,a,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!==(s=n.iterations)&&void 0!==s?s:100,y=e.map(e=>Object.assign({},e)),m=t.map(e=>Object.assign(Object.assign({},e),{source:"string"==typeof e.source?e.source:e.source.id,target:"string"==typeof e.target?e.target:e.target.id,value:Math.sqrt(Math.max(1,e.value||1))}));let v;v="down"===d?[[0,0],[o[1],o[0]]]:[[0,0],[o[0],o[1]]];const b=Ks().extent(v).links(m).nodes(y).nodeAlign(ia[h]||_s).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,s=(null!==(l=null!==(a=o._circularWidth)&&void 0!==a?a:o.width)&&void 0!==l?l:0)/2;e>r.leftFullExtent-s&&(e=r.leftFullExtent-s),r.rightFullExtent+s>t&&(t=r.rightFullExtent+s),n>r.verticalFullExtent-s&&(n=r.verticalFullExtent-s),r.verticalFullExtent+s>i&&(i=r.verticalFullExtent+s)}const r=t-e,s=i-n,u=o[0],d=o[1];if(r>0&&s>0&&(0>e||0>n||t>u||i>d)){const t=Math.min(u/r,d/s),o=-e*t+(u-r*t)/2,i=-n*t+(d-s*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=ra(e.source),n=ra(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,s,a,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:K,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(oa(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===(s=n.themeSemantic)||void 0===s?void 0:s.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(oa(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))),s=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:s,fillOpacity:null!==(a=u.fillOpacity)&&void 0!==a?a:g,stroke:"none",opacity:u.opacity},datum:e,_gradient:{direction:"right",from:1,to:0,x0:t.sourceX,x1:t.sourceX+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:s,fillOpacity:null!==(l=u.fillOpacity)&&void 0!==l?l:g,stroke:"none",opacity:u.opacity},datum:e,_gradient:{direction:"left",from:0,to:1,x0:t.targetX-r,x1:t.targetX}});continue}let d;if(d=e.circular&&e.circularPathData?ea(e):Js(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 s,a,l;"down"===u?(s=n.y0+(n.y1-n.y0)/2,a=n.x1+14,l="start"):(o[0]/2>n.x0+e/2?(s=n.x0-6,l="end"):(s=n.x1+6,l="start"),a=n.y0+i/2),b.push({x:s,y:a,text:r+"",anchor:"down"===u?"middle":l,baseline:"middle",fontSize:11})}}var w;return{sceneNodes:m,sceneEdges:v,labels:b}}},aa={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,n,o){var i,r;if(0===e.length)return;const s=null!==(i=n.forceStrength)&&void 0!==i?i:.1,a=o[0]/2,l=o[1]/2,c=n.__previousPositions;let u=0;const h=[];for(const t of e){const e=null!=t.x&&null!=t.y&&(0!==t.x||0!==t.y),n=null==c?void 0:c.get(t.id);e?u++:n?(t.x=n.x,t.y=n.y,u++):h.push(t)}const g=u>0&&.3>=(e.length>0?h.length/e.length:1);if(g){const n=new Map;for(const t of e)n.set(t.id,t);for(const e of h){const o=la(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=ca(e.id),r=i%360*(Math.PI/180),s=10+i%20;e.x=t/o.length+s*Math.cos(r),e.y=n/o.length+s*Math.sin(r)}else{const t=ca(e.id),n=t%360*(Math.PI/180),o=15+t%30;e.x=a+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=a+e*Math.cos(i),o.y=l+e*Math.sin(i)}}}const f=null!==(r=n.iterations)&&void 0!==r?r:Math.max(50,Math.min(300,Math.floor(300-2*(e.length-30)))),p=0===n.iterations?0:g?40:f,y=ua(n.nodeSize,n.nodeSizeRange,e),m=e=>y(e);if(p>0){const n=d.forceLink().strength(e=>{const t=e.weight;return Math.min(2.5,t?t*s:s)}).id(e=>e.id),o=d.forceSimulation().force("charge",d.forceManyBody().strength(e=>-25*m(e))).force("center",d.forceCenter(a,l).strength(.8)).force("x",d.forceX(a).strength(.15)).force("y",d.forceY(l).strength(.15));if(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)}g?o.alpha(.3):.1>o.alpha()&&o.alpha(1),o.stop();for(let e=0;p>e;++e)o.tick()}for(const t of e){if(null==t.x||null==t.y)continue;const e=m(t);t.x=Math.max(e,Math.min(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 v=new Map;for(const t of e)v.set(t.id,t);for(const e of t){if("string"==typeof e.source){const t=v.get(e.source);t&&(e.source=t)}if("string"==typeof e.target){const t=v.get(e.target);t&&(e.target=t)}}},buildScene(e,t,n,o){var i,r,s,a,l,c,u;const d=n.nodeStyle,h=n.edgeStyle,g=ua(n.nodeSize,n.nodeSizeRange,e),f=Array.isArray(n.colorScheme)?n.colorScheme:n.themeCategorical&&n.themeCategorical.length>0?n.themeCategorical:K,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(oa(t,"nodeSize")),o=d?d(oa(t,"nodeStyle")):{},a={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!==(s=o.strokeWidth)&&void 0!==s?s:2,opacity:o.opacity};y.push({type:"circle",cx:t.x,cy:t.y,r:e,style:a,datum:t,id:t.id,label:t.id})}const b=new Map;for(const t of e)b.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:b.get(e.source),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(oa(e,"edgeStyle")):{},r={stroke:i.stroke||(null===(a=n.themeSemantic)||void 0===a?void 0:a.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(oa(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 la(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 s=null;if(t===e?s=r:r===e&&(s=t),s){const e=n.get(s);!e||0===e.x&&0===e.y||o.push({x:e.x,y:e.y})}}return o}function ca(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 ua(e,t,n){var o;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],s=[];for(const t of n){const n=null===(o=t.data)||void 0===o?void 0:o[e];"number"==typeof n&&s.push(n)}if(0===s.length)return()=>r[0];const[a,l]=rn(s);if(a===l)return()=>(r[0]+r[1])/2;const c=i.scaleLinear().domain([a,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 da=K,ha={supportsStreaming:!1,hierarchical:!1,computeLayout(e,t,n,o){if(0===e.length)return;const{padAngle:i=.01,groupWidth:r=20,sortGroups:a}=n,l=Math.min(o[0],o[1])/2,c=l-r,u=o[0]/2,d=o[1]/2,g=(f=n.valueAccessor)?"function"==typeof f?f:e=>{var t;return null!==(t=e[f])&&void 0!==t?t:1}:e=>{var t;return null!==(t=e.value)&&void 0!==t?t:1};var f;const p=new Map;for(let t=0;e.length>t;t++)p.set(e[t].id,t);const y=e.length,m=Array.from({length:y},()=>Array.from({length:y},()=>0));for(const e of t){const t="string"==typeof e.target?e.target:e.target.id,n=p.get("string"==typeof e.source?e.source:e.source.id),o=p.get(t);if(void 0===n||void 0===o)continue;const i=g(e);m[n][o]=i}const v=h.chord().padAngle(i);a&&v.sortGroups(a);const b=v(m),x=b.groups,k=s.arc().innerRadius(c).outerRadius(l);for(const t of x){const n=e[t.index],o=k.centroid({innerRadius:c,outerRadius:l,startAngle:t.startAngle,endAngle:t.endAngle});n.x=o[0]+u,n.y=o[1]+d,n.__arcData={startAngle:t.startAngle,endAngle:t.endAngle}}const w=new Map;for(const t of e)w.set(t.id,t);for(const e of t){const t="string"==typeof e.target?e.target:e.target.id,n=w.get("string"==typeof e.source?e.source:e.source.id),o=w.get(t);n&&(e.source=n),o&&(e.target=o)}const A=new Map;for(const e of t)A.set(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,e);for(const t of b){const n=e[t.source.index].id,o=e[t.target.index].id,i=A.get(`${n}\0${o}`)||A.get(`${o}\0${n}`);i&&(i.__chordData=t)}},buildScene(e,t,n,o){var i,r,s,a;const{groupWidth:l=20,edgeOpacity:c=.5}=n,u=Math.min(o[0],o[1])/2,d=u-l,g=o[0]/2,f=o[1]/2,p=n.nodeStyle,y=n.edgeStyle,m=n.edgeColorBy||"source",v=Array.isArray(n.colorScheme)?n.colorScheme:n.themeCategorical&&n.themeCategorical.length>0?n.themeCategorical:da,b=new Map;e.forEach((e,t)=>{b.set(e.id,v[t%v.length])});const x=h.ribbon().radius(d),k=[],w=[],A=[];for(let t=0;e.length>t;t++){const n=e[t],o=n.__arcData;if(!o)continue;let r;r=p?p(oa(n,"nodeStyle")).fill||b.get(n.id)||v[t%v.length]:b.get(n.id)||v[t%v.length];const s=p?p(oa(n,"nodeStyle")):{},a={fill:r,stroke:s.stroke||"black",strokeWidth:null!==(i=s.strokeWidth)&&void 0!==i?i:1,opacity:s.opacity};k.push({type:"arc",cx:g,cy:f,innerR:d,outerR:u,startAngle:o.startAngle-Math.PI/2,endAngle:o.endAngle-Math.PI/2,style:a,datum:n,id:n.id,label:n.id})}for(const e of t){const t=e.__chordData;if(!t)continue;const o=x(t);if(!o)continue;const i=ga(o,g,f);let l=(null===(r=n.themeSemantic)||void 0===r?void 0:r.border)||(null===(s=n.themeSemantic)||void 0===s?void 0:s.secondary)||"#999";if(y)l=y(oa(e,"edgeStyle")).fill||l;else{const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;"target"===m&&n?l=b.get(n.id)||l:t&&(l=b.get(t.id)||l)}const u=y?y(oa(e,"edgeStyle")):{},d={fill:l,fillOpacity:null!==(a=u.fillOpacity)&&void 0!==a?a:c,stroke:u.stroke||"none",strokeWidth:u.strokeWidth,opacity:u.opacity};w.push({type:"ribbon",pathD:i,style:d,datum:e})}if(!1!==n.showLabels){const t=(j=n.nodeLabel)?"function"==typeof j?j:e=>e[j]||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,s=r-Math.PI/2;A.push({x:g+Math.cos(s)*o,y:f+Math.sin(s)*o,text:i+"",anchor:r>Math.PI?"end":"start",baseline:"middle",fontSize:11})}}var j;return{sceneNodes:k,sceneEdges:w,labels:A}}};function ga(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 fa=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];function pa(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 ya(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 ma(e){if(!e)return null;if("function"==typeof e){const t=e;return e=>{var n;return t(null!==(n=e.data)&&void 0!==n?n:e)}}return t=>{var n;return(null===(n=t.data)||void 0===n?void 0:n[e])||t[e]||t.id}}function va(e){return Array.isArray(e.colorScheme)?e.colorScheme:e.themeCategorical&&e.themeCategorical.length>0?e.themeCategorical:fa}function ba(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 xa(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 ka={supportsStreaming:!1,hierarchical:!0,computeLayout(e,t,n,o){var i;const r=n.__hierarchyRoot;if(!r)return;const s=n.chartType,a=function(e){if(e)return"function"==typeof e?e:t=>t[e]}(n.childrenAccessor),c=n.hierarchySum,u="function"==typeof c?c:"string"==typeof c?e=>Number(e[c])||0:e=>Number(e.value)||0,d=l.hierarchy(r,a);d.sum(u),d.sort((e,t)=>{var n,o;return(null!==(n=t.value)&&void 0!==n?n:0)-(null!==(o=e.value)&&void 0!==o?o:0)});const[h,g]=o;switch(s){case"tree":!function(e,t,n,o){const i=t.treeOrientation||"vertical",r=l.tree();r.size("horizontal"===i?[o,n]:"radial"===i?[2*Math.PI,Math.min(n,o)/2*.8]:[n,o]),r(e)}(d,n,h,g);break;case"cluster":!function(e,t,n,o){const i=t.treeOrientation||"vertical",r=l.cluster();r.size("horizontal"===i?[o,n]:"radial"===i?[2*Math.PI,Math.min(n,o)/2*.8]:[n,o]),r(e)}(d,n,h,g);break;case"treemap":!function(e,t,n,o){var i,r;const s=null!==(i=t.padding)&&void 0!==i?i:4,a=null!==(r=t.paddingTop)&&void 0!==r?r:0,c=l.treemap().size([n,o]).tile(l.treemapBinary).padding(s);a>0&&c.paddingTop(a),c(e)}(d,n,h,g);break;case"circlepack":!function(e,t,n,o){var i;const r=null!==(i=t.padding)&&void 0!==i?i:4;l.pack().size([n,o]).padding(r)(e)}(d,n,h,g);break;case"partition":!function(e,t,n,o){var i;l.partition().size([n,o]).padding(null!==(i=t.padding)&&void 0!==i?i:1)(e)}(d,n,h,g)}const f=d.descendants();e.length=0,t.length=0;const p=new Map;for(let t=0;f.length>t;t++){const o=f[t],r={id:ya(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"===s||"cluster"===s?wa(r,o,n):"treemap"===s||"partition"===s?Aa(r,o):"circlepack"===s&&ja(r,o),r.__hierarchyNode=o,e.push(r),p.set(o,r)}if("tree"===s||"cluster"===s)for(const e of f)if(e.parent){const n=p.get(e.parent),o=p.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 s,a,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(oa(t,"nodeStyle"));let l=r.fill||ba(n);if(n.colorByDepth&&void 0!==t.depth){const e=va(n);l=e[t.depth%e.length]}const c={fill:l,stroke:r.stroke||(null===(s=n.themeSemantic)||void 0===s?void 0:s.surface)||"#fff",strokeWidth:null!==(a=r.strokeWidth)&&void 0!==a?a:1,opacity:r.opacity};f.push({type:"circle",cx:e,cy: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,s=t.y,a=o.x,l=o.y;v&&(i+=b,s+=x,a+=b,l+=x);const g=xa(i,s,a,l,m),f=r(oa(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=ma(n.nodeLabel);for(const n of e){const e=t?t(n):n.id;if(!e)continue;let o,i,r,s=n.x,a=n.y;if(v&&(s+=b,a+=x),v){const e=s-b,t=a-x,n=Math.sqrt(e*e+t*t);n>0?(o=s+e/n*10,i=a+t/n*10,r=0>e?"end":"start"):(o=s,i=a-12,r="middle")}else"horizontal"===m?((null===(g=n.data)||void 0===g?void 0:g.children)&&0!==n.data.children.length?(o=s-k-6,r="end"):(o=s+k+6,r="start"),i=a):(o=s,i=a+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,s,a,l;const c=[],u=[];for(const n of e){const e=n.x1-n.x0,s=n.y1-n.y0;if(0>=e||0>=s)continue;const a=o(oa(n,"nodeStyle"));let l=a.fill||ba(t);if(t.colorByDepth&&void 0!==n.depth){const e=va(t);l=e[n.depth%e.length]}const u={fill:l,stroke:a.stroke||(null===(i=t.themeSemantic)||void 0===i?void 0:i.surface)||"#fff",strokeWidth:null!==(r=a.strokeWidth)&&void 0!==r?r:1,opacity:a.opacity};c.push({type:"rect",x:n.x0,y:n.y0,w:e,h:s,style:u,datum:n,id:n.id,label:n.id,depth:n.depth})}if(!1!==t.showLabels){const n=ma(t.nodeLabel),i=t.labelMode||"leaf",r="partition"===t.chartType;for(const c of e){const e=c.x1-c.x0,d=c.y1-c.y0;if(0>=e||0>=d)continue;const h=!((null===(s=c.data)||void 0===s?void 0:s.children)&&c.data.children.length>0);if(!r){if("leaf"===i&&!h)continue;if("parent"===i&&h)continue}const g=n?n(c):c.id;if(!g)continue;if((h?30:40)>e||(h?16:14)>d)continue;let f=o(oa(c,"nodeStyle")).fill||ba(t);if(t.colorByDepth&&void 0!==c.depth){const e=va(t);f=e[c.depth%e.length]}const p="string"==typeof f?pa(f):null!==(l=null===(a=t.themeSemantic)||void 0===a?void 0:a.text)&&void 0!==l?l:"#000";u.push(h?{x:c.x0+e/2,y:c.y0+d/2,text:g+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,Math.min(e,d)/6)),fill:p}:{x:c.x0+4,y:c.y0+12,text:g+"",anchor:"start",baseline:"auto",fontSize:11,fontWeight:600,fill:p})}}return{sceneNodes:c,sceneEdges:[],labels:u}}(e,n,0,i);case"circlepack":return function(e,t,n,o){var i,r,s,a,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(oa(n,"nodeStyle"));let c=l.fill||ba(t);if(t.colorByDepth&&void 0!==n.depth){const e=va(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!==(s=l.strokeWidth)&&void 0!==s?s:1,opacity:null!==(a=l.opacity)&&void 0!==a?a:.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=ma(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 s=!((null===(c=i.data)||void 0===c?void 0:c.children)&&i.data.children.length>0);let a=o(oa(i,"nodeStyle")).fill||ba(t);if(t.colorByDepth&&void 0!==i.depth){const e=va(t);a=e[i.depth%e.length]}if(s){const n="string"==typeof a?pa(a):null!==(d=null===(u=t.themeSemantic)||void 0===u?void 0:u.text)&&void 0!==d?d:"#000";p.push({x:i.x,y:i.y,text:r+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,e/3)),fill: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 wa(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 Aa(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 ja(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 Sa(e){let t=e.__orbitState;return t||(t={metaMap:new Map,startTime:"undefined"!=typeof performance?performance.now():Date.now()},e.__orbitState=t),t}const Oa={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 l=function(e){if("function"==typeof e)return e;const t=e||"children";return e=>e[t]||null}(n.childrenAccessor),c=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),u=function(e){if(Array.isArray(e))return e;switch(e){case"solar":return[1];case"atomic":return[2,8];default:return[9999]}}(n.orbitMode),d=null!==(r=n.orbitSize)&&void 0!==r?r:2.95,h=null!==(a=n.orbitEccentricity)&&void 0!==a?a:1,g="number"==typeof d?()=>d:d,f="number"==typeof h?()=>h:h,p=Sa(n);p.metaMap.clear(),o.length=0,i.length=0;const y=new Map;function m(e){var t;const n=null!==(t=y.get(e))&&void 0!==t?t:0;return y.set(e,n+1),0===n?e:`${e}__${n}`}const v=t[0]/2,b=t[1]/2,x=Math.min(t[0],t[1])/2*.85,k=m(c(e));o.push({id:k,x:v,y:b,x0:v,x1:v,y0:b,y1:b,width:0,height:0,value:0,depth:0,data:e}),p.metaMap.set(k,{ring:x,angle:0,depth:0,parentId:null,eccentricity:1}),function e(t,n,r,a,d,h,y){const v=l(t);if(!(null==v?void 0:v.length))return;const b=v.length;let x=0,k=0,w=0;for(;b>k;)k+=u[Math.min(w,u.length-1)],w++,x++;let A=0;for(let b=0;x>b;b++){const k=u[Math.min(b,u.length-1)],w=v.slice(A,A+k);if(!w.length)break;const j=(b+1)/x,S={id:n,depth:h,data:t,parentId:n},O=y?d/g(S)*j:d*j,M=s.pie().value(e=>{var t;return(null===(t=l(e))||void 0===t?void 0:t.length)?4:1}).sort(null),C=M(w),_=f(S);for(let t=0;w.length>t;t++){const s=(C[t].startAngle+C[t].endAngle)/2,l=w[t],u=m(c(l)),d=r+O*Math.sin(s),g=a+O*Math.cos(s)*_;o.push({id:u,x:d,y:g,x0:d,x1:d,y0:g,y1:g,width:0,height:0,value:0,depth:h,data:l}),p.metaMap.set(u,{ring:O,angle:s,depth:h,parentId:n,eccentricity:_}),i.push({source:n,target:u,value:1,y0:0,y1:0,sankeyWidth:0,data:{source:n,target:u}}),e(l,u,d,g,O,h+1,!0)}A+=k}}(e,k,v,b,x,1,!1)}(i,o,n,e,t)},buildScene(e,t,n,o){var i,r,s,a,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=Sa(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,s={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 a=i/r*Math.PI*2,l=(i+1)/r*Math.PI*2;p.push({type:"line",x1:e+n*Math.sin(a),y1:t+n*Math.cos(a)*o,x2:e+n*Math.sin(l),y2:t+n*Math.cos(l)*o,style:s,datum:null})}}for(const t of e){if(null==t.x||null==t.y)continue;const e=g(oa(t,"nodeSize")),o=d?d(oa(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!==(s=o.strokeWidth)&&void 0!==s?s:1,opacity:null!==(a=o.opacity)&&void 0!==a?a:0===(null!==(l=t.depth)&&void 0!==l?l:0)?1:.85};f.push({type:"circle",cx:t.x,cy:t.y,r:e,style:c,datum:t,id:t.id,label:t.id,depth:t.depth})}const m=new Map;for(const t of e)m.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:m.get(e.source),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(oa(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=Sa(t),r=null!==(n=t.orbitSpeed)&&void 0!==n?n:.25,s=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),a=(("undefined"!=typeof performance?performance.now():Date.now())-i.startTime)/1e3,l=r*(Math.PI/6),c=new Map;for(const t of e)c.set(t.id,t);for(const t of e){const e=i.metaMap.get(t.id);if(!e||!e.parentId)continue;const n=c.get(e.parentId);if(!n)continue;const o=e.angle+a*l*s({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)},Ma={sankey:sa,force:aa,chord:ha,tree:ka,cluster:ka,treemap:ka,circlepack:ka,partition:ka,orbit:Oa};function Ca(e){return Ma[e]}class _a{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.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._lastPositionSnapshot=null,this.config=e,this.tensionConfig=Object.assign(Object.assign({},ls),e.tensionConfig),e.showParticles&&("sankey"===e.chartType||e.customNetworkLayout)&&(this.particlePool=new us(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=Object.assign(Object.assign({},ls),e.tensionConfig),!e.showParticles||"sankey"!==e.chartType&&!e.customNetworkLayout||this.particlePool||(this.particlePool=new us(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:s="value"}=this.config,a="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 s?s:e=>{var t;return null!==(t=e[s])&&void 0!==t?t:1};this._boundedPrevSnapshot=new Map;for(const[e,t]of this.nodes)0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1||this._boundedPrevSnapshot.set(e,{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});this._boundedEdgeSnapshot=new Map;for(const[,e]of this.edges)e.sankeyWidth>0&&this._boundedEdgeSnapshot.set(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,{y0:e.y0,y1:e.y1,sankeyWidth:e.sankeyWidth});this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null;for(const t of e){const e=a(t)+"";this.nodes.set(e,Object.assign(Object.assign({},Pa(e)),{data:t}))}for(let e=0;t.length>e;e++){const n=t[e],o=l(n)+"",i=c(n)+"",r=u(n),s=null==r?NaN:Number(r),a=Number.isFinite(s)?s:1;this.nodes.has(o)||this.nodes.set(o,Object.assign(Object.assign({},Pa(o)),{data:n})),this.nodes.has(i)||this.nodes.set(i,Object.assign(Object.assign({},Pa(i)),{data:n}));const d=`${o}\0${i}\0${e}`,h={source:o,target:i,value:a,y0:0,y1:0,sankeyWidth:0,data:n,_edgeKey:d};n&&"object"==typeof n&&La(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 s="undefined"!=typeof performance?performance.now():Date.now();this.lastIngestTime=s,this._decaySortedNodes=null,this.nodes.has(t)||(this.nodes.set(t,Pa(t)),this.nodeTimestamps.set(t,s),this.tension+=this.tensionConfig.newNode,r=!0),this.nodes.has(n)||(this.nodes.set(n,Pa(n)),this.nodeTimestamps.set(n,s),this.tension+=this.tensionConfig.newNode,r=!0);const a=this.edgeKey(t,n),l=this.edges.get(a);let c=!1;return l?(l.value+=o,this.edgeTimestamps.set(a,s),this.tension+=this.tensionConfig.weightChange,c=!0):(this.edges.set(a,{source:t,target:n,value:o,y0:0,y1:0,sankeyWidth:0}),this.edgeTimestamps.set(a,s),this.tension+=this.tensionConfig.newEdge,r=!0),i||r||c||this.tension>=this.tensionConfig.threshold}runLayout(e){var t,n,o,i,r,s,a,l;if(this.config.customNetworkLayout)return this.recordTopologyDiff(),void this.layoutVersion++;const c=Ca(this.config.chartType);if(!c)return;let u=Array.from(this.nodes.values());const d=Array.from(this.edges.values());if(0===u.length&&!c.hierarchical)return;if(this.prepareForRelayout(),c.supportsStreaming&&!c.hierarchical){const e=new Map;for(const a of u)if(void 0!==a._prevX0){const l=(null!==(t=a._prevX1)&&void 0!==t?t:0)-(null!==(n=a._prevX0)&&void 0!==n?n:0),c=(null!==(o=a._prevY1)&&void 0!==o?o:0)-(null!==(i=a._prevY0)&&void 0!==i?i:0);e.set(a.id,{x:(null!==(r=a._prevX0)&&void 0!==r?r:0)+l/2,y:(null!==(s=a._prevY0)&&void 0!==s?s:0)+c/2})}else 0===a.x&&0===a.y||e.set(a.id,{x:a.x,y:a.y});if(this._lastPositionSnapshot)for(const[t,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===(a=this.config.transition)||void 0===a?void 0:a.duration)&&void 0!==l?l:this.tensionConfig.transitionDuration;if(!this._hasRenderedOnce&&this.config.introAnimation&&["sankey","tree","treemap","circlepack","partition"].includes(this.config.chartType)&&u.length>0&&f>0){const t=e[0]/2,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}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)}restyleScene(e){var t,n;if(this._customRestyle){const n=this._customRestyle;for(const o of this.sceneNodes){const i=null!==(t=this._baseStyles.get(o))&&void 0!==t?t:o.style,r=n(o,e);o.style=r?Object.assign(Object.assign({},i),r):i}}if(this._customRestyleEdge){const t=this._customRestyleEdge;for(const o of this.sceneEdges){const i=null!==(n=this._baseStyles.get(o))&&void 0!==n?n:o.style,r=t(o,e);o.style=r?Object.assign(Object.assign({},i),r):i}}}buildScene(e){var t,n,o,i,r,s,a,l,c;if(this._sceneNodesRevision++,this.config.customNetworkLayout){const u=Array.from(this.nodes.values()),d=Array.from(this.edges.values()),h=mr(this.config.colorScheme,this.config.themeCategorical,K),g={nodes:u,edges:d,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:[...h]},resolveColor:vr(h),config:null!==(n=this.config.layoutConfig)&&void 0!==n?n:{},selection:null!==(o=this.config.layoutSelection)&&void 0!==o?o:null};let f;try{f=this.config.customNetworkLayout(g)}catch(e){return"production"!==process.env.NODE_ENV&&console.error("[semiotic] customNetworkLayout threw:",e),this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.customLayoutOverlays=null,void(this.customLayoutHtmlMarks=[])}return this.sceneNodes=null!==(i=f.sceneNodes)&&void 0!==i?i:[],this.sceneEdges=null!==(r=f.sceneEdges)&&void 0!==r?r:[],this.labels=null!==(s=f.labels)&&void 0!==s?s:[],this.customLayoutOverlays=null!==(a=f.overlays)&&void 0!==a?a:null,this.customLayoutHtmlMarks=null!==(l=f.htmlMarks)&&void 0!==l?l:[],this._customRestyle=f.restyle,this._customRestyleEdge=f.restyleEdge,this.hasCustomRestyle=!(!f.restyle&&!f.restyleEdge),this.hasCustomRestyle&&(this.snapshotBaseStyles(),this.restyleScene(null!==(c=this.config.layoutSelection)&&void 0!==c?c:null)),void Ve({label:"customNetworkLayout",nodes:this.sceneNodes,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned})}this._customRestyle=void 0,this._customRestyleEdge=void 0,this.hasCustomRestyle=!1,this.customLayoutOverlays=null,this.customLayoutHtmlMarks=[];const u=Ca(this.config.chartType);if(!u)return;const d=u.hierarchical?Array.from(this.nodes.values()):this.nodesArray,h=u.hierarchical?Array.from(this.edges.values()):this.edgesArray,{sceneNodes:g,sceneEdges:f,labels:p}=u.buildScene(d,h,this.config,e);this.sceneNodes=g,this.sceneEdges=f,this.labels=p}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,_a.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=r.quadtree().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=Ca(this.config.chartType);return!!(null==e?void 0:e.supportsAnimation)&&!1!==this.config.orbitAnimated}tickAnimation(e,t){const n=Ca(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=Pe(e,this.transition),n=_e(t);for(const e of this.nodes.values())void 0===e._targetX0||void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=Le(e._prevX0,e._targetX0,n),e.x1=Le(e._prevX1,e._targetX1,n),e.y0=Le(e._prevY0,e._targetY0,n),e.y1=Le(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=Le(e._prevY0,e._targetY0,n),e.y1=Le(e._prevY1,e._targetY1,n),e.sankeyWidth=Le(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,s=u.interpolateNumber(i,r);return{circular:!1,points:[{x:e.y0,y:i},{x:e.y0,y:s(.5)},{x:e.y1,y:s(.5)},{x:e.y1,y:r}],halfWidth:o}}const i=t.x1,r=n.x0,s=u.interpolateNumber(i,r);return{circular:!1,points:[{x:i,y:e.y0},{x:s(.5),y:e.y0},{x:s(.5),y:e.y1},{x:r,y:e.y1}],halfWidth: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,s=n.y-t.y;i.push([t,{x:t.x+r/3,y:t.y+s/3},{x:t.x+2*r/3,y:t.y+2*s/3},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 s=this.config.pulse;if(!s)return;const a=null!==(t=s.duration)&&void 0!==t?t:500,l=null!==(n=s.color)&&void 0!==n?n:"rgba(255,255,255,0.6)",c=null!==(o=s.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;a>i&&(t._pulseIntensity=1-i/a,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,s="object"==typeof n.target?null===(r=n.target)||void 0===r?void 0:r.id:n.target;if(!o||!s)continue;const c=this.edgeTimestamps.get(`${o}\0${s}`);if(!c)continue;const u=e-c;a>u&&(t._pulseIntensity=1-u/a,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 s=r.id;if(!s)continue;const a=i.get(s);if(void 0===a)continue;const l=Me(n,a,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",s=!1!==o.pulse;for(const t of this.sceneNodes){const n=t.id;if(!n)continue;const a=this.nodes.get(n);if(!a)continue;const l=o.metric(a);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}),s&&(t._pulseIntensity=.6+.4*Math.sin(e/300),t._pulseColor=c,t._pulseGlowRadius=6))}}get hasActiveThresholds(){const e=this.config.thresholds;if(!e)return!1;for(const t of this.nodes.values()){const 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++,this.lastIngestTime="undefined"!=typeof performance?performance.now():Date.now(),i}updateEdge(e,t,n){var o;const i=this.config.valueAccessor,r="function"==typeof i?i:i?e=>e[i]:e=>e.value,s=[];for(const[,i]of this.edges)if(("string"==typeof i.source?i.source:i.source.id)===e&&("string"==typeof i.target?i.target:i.target.id)===t){s.push(i.data?Object.assign({},i.data):{}),i.data=n(null!==(o=i.data)&&void 0!==o?o:{});const e=r(i.data);null!=e&&(i.value=Number(e))}return s.length>0&&(this.layoutVersion++,this.lastIngestTime="undefined"!=typeof performance?performance.now():Date.now()),s}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++,this.lastIngestTime="undefined"!=typeof performance?performance.now():Date.now(),!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++,this.lastIngestTime="undefined"!=typeof performance?performance.now():Date.now()),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 Pa(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 La(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(!Ta(e))return!1;return!0}return Ta(t.points)}function Ta(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 Ra(e,t,n,o,i=30,r,s=0){let a=null,l=i,c=1/0;if(r){const e=ut(r,n,o,i,s,e=>e.cx,e=>e.cy,e=>e.r);e&&(a={type:"node",datum:e.node.datum,x:e.node.cx,y:e.node.cy,distance:e.distance},l=e.distance)}for(const t of e){if(r&&"circle"===t.type)continue;const e=$a(t,n,o,i);if(e)if("rect"===t.type){const n=t.w*t.h;c>n&&(a=e,c=n)}else l>e.distance&&(a=e,l=e.distance)}if(a)return a;for(const e of t){if(!1===e.interactive)continue;const t=Ia(e,n,o);t&&l>t.distance&&(a=t,l=t.distance)}return a}function $a(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,s=Math.sqrt(i*i+r*r);return s>st(e.r,o)?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:s}}(e,t,n,o);case"rect":return function(e,t,n){const o=rt(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 s=ct(Math.atan2(i,o)),a=ct(e.startAngle),l=ct(e.endAngle);if(a>l?s>=a||l>=s:s>=a&&l>=s){const t=(e.startAngle+e.endAngle)/2,n=(e.innerR+e.outerR)/2;return{type:"node",datum:e.datum,x:e.cx+n*Math.cos(t),y:e.cy+n*Math.sin(t),distance:0}}return null}(e,t,n);case"symbol":return function(e,t,n,o=30){const i=t-e.cx,r=n-e.cy,s=Math.sqrt(i*i+r*r);return s>st(qe(e.size),o)?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:s}}(e,t,n,o);default:return null}}_a.QUADTREE_THRESHOLD=500;let Na=null,Ea=null;function Ba(){return Ea||(Na=document.createElement("canvas"),Na.width=1,Na.height=1,Ea=Na.getContext("2d")),Ea}function Da(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 Ia(e,t,n){switch(e.type){case"bezier":return function(e,t,n){if(!e.pathD)return null;const o=Da(e),i=Ba();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 s=i.isPointInStroke(o,t,n);if(i.lineWidth=r,s)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 s=((t-e.x1)*o+(n-e.y1)*i)/r;s=Math.max(0,Math.min(1,s));const a=e.x1+s*o,l=e.y1+s*i,c=Math.sqrt(Math.pow(t-a,2)+Math.pow(n-l,2));return c>5?null:{type:"edge",datum:e.datum,x:a,y:l,distance:c}}(e,t,n);case"ribbon":case"curved":return function(e,t,n){if(!e.pathD)return null;const o=Da(e),i=Ba();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 s=i.isPointInStroke(o,t,n);if(i.lineWidth=r,s)return{type:"edge",datum:e.datum,x:t,y:n,distance:4}}catch(e){}return null}(e,t,n);default:return null}}function Fa(t){const{width:n,height:o,totalWidth:i,totalHeight:r,margin:s,labels:a,title:l,legend:c,legendHoverBehavior:u,legendClickBehavior:d,legendHighlightedCategory:h,legendIsolatedCategories:g,legendPosition:f="right",legendLayout:y,foregroundGraphics:m,sceneNodes:v,annotations:b,autoPlaceAnnotations:x,svgAnnotationRules:k}=t,w=p.useMemo(()=>{const e=(v||[]).flatMap(e=>{const t=function(e){var t,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,s=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 s?null:{x:r,y:s,r:"number"==typeof e.r?Math.max(1,e.r):"number"==typeof e.outerR?Math.max(1,e.outerR):"number"==typeof e.size?Math.max(1,qe(e.size)):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,s,a,l;const c=null!==(s=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!==s?s:null===(l=null===(a=e.datum)||void 0===a?void 0:a.data)||void 0===l?void 0:l.name;return null==c?void 0:c+""}(e);return t?[Object.assign({pointId:n},t)]:[]});return{scales:null,width:n,height:o,frameType:"network",pointNodes:e,sceneNodes:v}},[o,v,n]),A=p.useMemo(()=>b&&x?Un(Object.assign({annotations:b,context:w},"object"==typeof x?x:{})):b,[b,x,w]),j=A?Cn(A.reduce((t,n,o)=>{if("widget"===n.type||!k)return t;const i=k(n,o,w);return i&&t.push({node:e.jsx(p.Fragment,{children:i},"annotation-"+o),annotation:n}),t},[])):null,S=!0===(null==A?void 0:A.some(e=>"widget"===e.type&&!0===e._annotationDeferred));return e.jsxs(e.Fragment,{children:[S&&e.jsx("style",{children:An},"annotation-widget-disclosure-style"),e.jsxs("svg",{role:"img",width:i,height:r,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[e.jsx("title",{children:"string"==typeof l?l:"Network Chart"}),e.jsx("desc",{children:"string"==typeof l?l+" — network data visualization":"Network data visualization"}),e.jsxs("g",{transform:`translate(${s.left},${s.top})`,children:[a.map((t,n)=>e.jsx("text",{x:t.x,y:t.y,textAnchor:t.anchor||"start",dominantBaseline:t.baseline||"middle",fontSize:t.fontSize||11,fontWeight:t.fontWeight,fill:t.fill||"currentColor",stroke:t.stroke,strokeWidth:t.strokeWidth,paintOrder:t.paintOrder,style:{pointerEvents:"none"},children:t.text},"label-"+n)),j,m]}),l&&"string"==typeof l?e.jsx("text",{x:i/2,y:16,textAnchor:"middle",fontWeight:600,fill:"currentColor",className:"semiotic-chart-title",style:{fontSize:"var(--semiotic-title-font-size, 14px)"},children:l}):l?e.jsx("foreignObject",{x:0,y:0,width:i,height:s.top,children:l}):null,on({legend:c,totalWidth:i,totalHeight:r,margin:s,legendPosition:f,title:l,legendLayout:y,legendHoverBehavior:u,legendClickBehavior:d,legendHighlightedCategory:h,legendIsolatedCategories:g})]}),null==A?void 0:A.filter(e=>"widget"===e.type&&e.nodeId&&v).map((t,n)=>{var o,i,r,a,l,c,u,d,h;const g=!0===t._annotationDeferred,f=v.find(e=>{var n,o,i,r,s;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===(s=null===(r=e.datum)||void 0===r?void 0:r.data)||void 0===s?void 0:s.name)===t.nodeId});if(!f)return null;const p=s.left+(null!==(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=s.top+(null!==(r=f.cy)&&void 0!==r?r:null!=f.y&&null!=f.h?f.y+f.h/2:null!==(a=f.y)&&void 0!==a?a:0),m=null!==(l=t.dx)&&void 0!==l?l:0,b=null!==(c=t.dy)&&void 0!==c?c:-16,x=null!==(u=t.width)&&void 0!==u?u:32,k=null!==(d=t.height)&&void 0!==d?d:32,w=null!==(h=t.content)&&void 0!==h?h:e.jsx("span",{style:{fontSize:18,cursor:"default"},children:"ℹ️"});return e.jsx("div",{className:g?"annotation-deferred":void 0,"data-annotation-disclosure":g?"deferred":void 0,style:{position:"absolute",left:p+m-x/2,top:y+b-k/2,width:x,height:k,display:"flex",alignItems:"center",justifyContent:"center",zIndex:5},children:w},"widget-"+n)})]})}Fa.displayName="NetworkSVGOverlay";const Ha={position:"absolute",top:0,left:0,pointerEvents:"none"};function Wa({marks:t,margin:n,selection:o=null,overscan:i=400}){const r=p.useRef(null),s=function(e,t,n){const[o,i]=p.useState(null);return p.useLayoutEffect(()=>{const e=t.current,n=function(e){var t;let n=null!==(t=null==e?void 0:e.parentElement)&&void 0!==t?t:null;for(;n;){const{overflow:e,overflowX:t,overflowY:o}=window.getComputedStyle(n);if(/(auto|scroll|overlay)/.test(`${e} ${o} ${t}`))return n;n=n.parentElement}return null}(e);if(!e||!n)return void i(null);let o=0;const r=()=>{o=0;const t=n.getBoundingClientRect(),r=e.getBoundingClientRect();i(0!==t.width&&0!==t.height?{scroll:{left:t.left,top:t.top,right:t.right,bottom:t.bottom},originX:r.left,originY:r.top}:null)},s=()=>{0===o&&(o=window.requestAnimationFrame(r))};r(),n.addEventListener("scroll",s,{passive:!0});const a=new ResizeObserver(s);return a.observe(n),()=>{0!==o&&window.cancelAnimationFrame(o),n.removeEventListener("scroll",s),a.disconnect()}},[t,e,n]),p.useMemo(()=>{if(!e||!o)return e;const{scroll:t,originX:i,originY:r}=o,s=t.left-n,a=t.right+n,l=t.top-n,c=t.bottom+n;return e.filter(e=>{const t=i+e.x,n=r+e.y;return!(s>t+e.width||t>a||l>n+e.height||n>c)})},[e,o,n])}(t,r,i);if(!t||0===t.length)return null;const a=e.jsx("div",{className:"semiotic-network-html-marks",ref:r,style:Object.assign(Object.assign({},Ha),{transform:`translate(${n.left}px, ${n.top}px)`}),children:(null!=s?s:t).map(t=>e.jsx("div",{className:"semiotic-network-html-mark","data-mark-id":t.id,style:{position:"absolute",transform:`translate(${t.x}px, ${t.y}px)`,width:t.width,height:t.height,pointerEvents:"none"},children:t.content},t.id))});return null!=o?e.jsx(ot,{value:o,children:a}):a}const za=new Map;function Ya(e){var t;try{if(e.path)return new Path2D(e.path);const n=`${null!==(t=e.symbolType)&&void 0!==t?t:"circle"}:${Math.round(e.size)}`;let o=za.get(n);return o||(o=new Path2D(Ge(e.symbolType,e.size)),za.size>256&&za.clear(),za.set(n,o)),o}catch(e){return null}}function Ga(e){return e._cachedPath2D&&e._cachedPath2DSource===e.pathD||(e._cachedPath2D=new Path2D(e.pathD),e._cachedPath2DSource=e.pathD),e._cachedPath2D}function qa(e,t){var n,o,i,r,s,a;if(!t.pathD)return;e.save();const l=Ga(t);if(t.style.fill&&"none"!==t.style.fill){const s=t._gradient;if(s){const i=e.createLinearGradient(s.x0,0,s.x1,0),r=null!==(o=null!==(n=t.style.fillOpacity)&&void 0!==n?n:t.style.opacity)&&void 0!==o?o:.5,a="string"==typeof t.style.fill?t.style.fill:"#999",l=vt(e,a)||a;i.addColorStop(0,1===s.from?l:"transparent"),i.addColorStop(1,1===s.to?l:"transparent"),e.fillStyle=i,e.globalAlpha=r}else e.fillStyle="string"==typeof t.style.fill&&vt(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=vt(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(s=t.style.strokeWidth)&&void 0!==s?s:.5,e.globalAlpha=.5*(null!==(a=t.style.opacity)&&void 0!==a?a:1),e.stroke(l)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.2*t._pulseIntensity,e.fill(l)),e.restore()}function Xa(e,t){var n,o;e.save();const i=t.style.stroke||"#999";e.strokeStyle=vt(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 Va(e,t){var n,o,i,r;if(!t.pathD)return;e.save();const s=Ga(t);t.style.fill&&"none"!==t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&vt(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(s)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=vt(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(i=t.style.strokeWidth)&&void 0!==i?i:.5,e.globalAlpha=.3*(null!==(r=t.style.opacity)&&void 0!==r?r:1),e.stroke(s)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.25*t._pulseIntensity,e.fill(s)),e.restore()}function Ua(e,t){var n,o;if(!t.pathD)return;e.save();const i=Ga(t),r=t.style.stroke||"#999";e.strokeStyle=vt(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&&vt(e,t.style.fill)||t.style.fill,e.globalAlpha=null!==(o=t.style.fillOpacity)&&void 0!==o?o:.1,e.fill(i)),e.restore()}const Qa={top:20,right:80,bottom:20,left:80},Ka={top:40,right:40,bottom:40,left:40},Za=new Set(["chord","force","circlepack","orbit"]),Ja=[800,600],el={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 tl({data:t}){var n,o,i,r,s,a,l;if("edge"===t.nodeOrEdge){const n=t.data;return n?e.jsxs("div",{className:"semiotic-tooltip",style:el,children:[e.jsxs("div",{style:{fontWeight:600},children:["object"==typeof n.source?n.source.id:n.source," → ","object"==typeof n.target?n.target.id:n.target]}),null!=n.value&&e.jsxs("div",{style:{marginTop:4,opacity:.8},children:["Value:"," ","number"==typeof n.value?n.value.toLocaleString():n.value+""]})]}):null}const c=t.data;if(!c)return null;const u=c.__hierarchyNode;if(u){const t=[];let s=u;for(;s;){const e=null!==(r=null!==(o=null===(n=s.data)||void 0===n?void 0:n.name)&&void 0!==o?o:null===(i=s.data)||void 0===i?void 0:i.id)&&void 0!==r?r:c.id;null!=e&&t.unshift(e+""),s=s.parent}t.length>1&&t.shift();const a=t.length-1;return e.jsxs("div",{className:"semiotic-tooltip",style:el,children:[e.jsx("div",{children:t.map((t,n)=>e.jsxs("span",{children:[n>0&&e.jsx("span",{style:{margin:"0 3px",opacity:.5},children:" → "}),n===a?e.jsx("strong",{children:t}):e.jsx("span",{style:{opacity:.7},children:t})]},n))}),null!=c.value&&c.value>0&&e.jsx("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===(a=c.targetLinks)||void 0===a?void 0:a.length)||0),h=(c.sourceLinks||[]).reduce((e,t)=>e+(t.value||0),0)+(c.targetLinks||[]).reduce((e,t)=>e+(t.value||0),0),g=vi(null!==(l=c.data)&&void 0!==l?l:c),f=null!=g.title?g.title+"":c.id,p=g.entries.some(e=>nl.test(e.key));return e.jsxs("div",{className:"semiotic-tooltip",style:el,children:[e.jsx("div",{style:{fontWeight:600},children:f}),g.entries.map(t=>e.jsxs("div",{style:{marginTop:4,opacity:.8},children:[t.key,": ",ns(t.value)]},t.key)),!p&&null!=c.value&&c.value>0&&e.jsxs("div",{style:{marginTop:4,opacity:.8},children:["Total:"," ","number"==typeof c.value?c.value.toLocaleString():c.value+""]}),d>0&&e.jsxs("div",{style:{marginTop:4,opacity:.8},children:["Connections: ",d,h!==d&&` (weighted: ${h.toLocaleString()})`]})]})}const nl=/^(value|amount|total|count|weight|score)$/i;tl.ownsChrome=!0;const ol=t.forwardRef(function(n,o){var i,r,a,l,c,u,d,h,g,f,p,y,m,v,b,x,w,A,j;const{chartType:O,nodes:M,edges:C,data:_,initialEdges:P,nodeIDAccessor:L="id",sourceAccessor:T="source",targetAccessor:R="target",valueAccessor:$="value",edgeIdAccessor:N,childrenAccessor:E,hierarchySum:B,orientation:D="horizontal",nodeAlign:I="justify",nodePaddingRatio:F=.05,nodeWidth:H=15,iterations:W=300,forceStrength:z=.1,padAngle:Y=.01,groupWidth:G=20,sortGroups:q,edgeSort:X,treeOrientation:V="vertical",edgeType:U="curve",padding:Q,paddingTop:K,tensionConfig:Z,showParticles:J=!1,particleStyle:ee,nodeStyle:te,edgeStyle:ne,colorBy:oe,colorScheme:ie="category10",edgeColorBy:re="source",edgeOpacity:se=.5,colorByDepth:ae=!1,nodeSize:le=8,nodeSizeRange:ce=[5,20],nodeLabel:ue,showLabels:de=!0,labelMode:he,size:ge=Ja,responsiveWidth:fe,responsiveHeight:pe,margin:ye,className:me,background:ve,enableHover:be=!0,tooltipContent:ke,customHoverBehavior:we,customClickBehavior:Ae,onObservation:je,chartId:Se,onTopologyChange:Oe,annotations:Me,autoPlaceAnnotations:Ce,svgAnnotationRules:_e,legend:Pe,legendPosition:Le,legendLayout:Te,legendHoverBehavior:Re,legendClickBehavior:$e,legendHighlightedCategory:Ne,legendIsolatedCategories:Ee,title:Be,foregroundGraphics:De,backgroundGraphics:Ie,decay:Fe,pulse:He,transition:We,animate:ze,staleness:Ye,thresholds:qe,accessibleTable:Xe=!0,description:Ve,summary:Ue,orbitMode:Qe,orbitSize:Ke,orbitSpeed:Ze,orbitRevolution:Je,orbitRevolutionStyle:tt,orbitEccentricity:nt,orbitShowRings:ot,orbitAnimated:rt,customNetworkLayout:st,layoutConfig:at,layoutSelection:lt}=n,ct=Za.has(O)?Ka:Qa,ut=t.useRef(!0),dt=Pi({sizeProp:ge,responsiveWidth:fe,responsiveHeight:pe,userMargin:ye,marginDefault:ct,foregroundGraphics:De,backgroundGraphics:Ie,animate:ze,transitionProp:We,themeDirtyRef:ut}),{reducedMotionRef:ht,responsiveRef:gt,size:ft,margin:pt,adjustedWidth:yt,adjustedHeight:mt,resolvedForeground:bt,resolvedBackground:xt,transition:kt,introEnabled:wt,tableId:At,rafRef:jt,renderFnRef:St,scheduleRender:Ot,currentTheme:Mt}=dt,Ct=Co(),_t=To(),Pt=t.useMemo(()=>k(M),[M]),Lt=t.useMemo(()=>Array.isArray(C)?k(C):C,[C]),Tt=t.useMemo(()=>Object.assign(Object.assign({},ls),Z),[Z]),Rt=t.useMemo(()=>Object.assign(Object.assign({},cs),ee),[ee]),$t=t.useMemo(()=>{var e;return{chartType:O,nodeIDAccessor:L,sourceAccessor:T,targetAccessor:R,valueAccessor:$,edgeIdAccessor:N,childrenAccessor:E,hierarchySum:B,orientation:D,nodeAlign:I,nodePaddingRatio:F,nodeWidth:H,iterations:W,forceStrength:z,padAngle:Y,groupWidth:G,sortGroups:q,edgeSort:X,treeOrientation:V,edgeType:U,padding:Q,paddingTop:K,tensionConfig:Tt,showParticles:J,particleStyle:Rt,nodeStyle:te,edgeStyle:ne,nodeLabel:ue,showLabels:de,labelMode:he,colorBy:oe,colorScheme:ie,themeCategorical:null===(e=null==Mt?void 0:Mt.colors)||void 0===e?void 0:e.categorical,themeSemantic:S(Mt),edgeColorBy:re,edgeOpacity:se,colorByDepth:ae,nodeSize:le,nodeSizeRange:ce,decay:Fe,pulse:He,transition:kt,introAnimation:wt,staleness:Ye,thresholds:qe,orbitMode:Qe,orbitSize:Ke,orbitSpeed:Ze,orbitRevolution:Je,orbitRevolutionStyle:tt,orbitEccentricity:nt,orbitShowRings:ot,orbitAnimated:rt,customNetworkLayout:st,layoutConfig:at}},[O,L,T,R,$,E,B,D,I,F,H,W,z,Y,G,q,X,V,U,Q,K,Tt,J,Rt,te,ne,ue,de,he,oe,ie,re,se,ae,le,ce,Fe,He,null==kt?void 0:kt.duration,null==kt?void 0:kt.easing,wt,Ye,qe,Qe,Ke,Ze,Je,tt,nt,ot,rt,Mt,st,at]),Nt=$o($t),Et=$o({chartType:O,nodeIDAccessor:L,sourceAccessor:T,targetAccessor:R,valueAccessor:$,childrenAccessor:E,hierarchySum:B,orientation:D,nodeAlign:I,nodePaddingRatio:F,nodeWidth:H,iterations:W,forceStrength:z,padAngle:Y,groupWidth:G,sortGroups:q,edgeSort:X,treeOrientation:V,edgeType:U,padding:Q,paddingTop:K,tensionConfig:Tt,orbitMode:Qe,orbitSize:Ke,orbitEccentricity:nt,customNetworkLayout:st}),Ft=t.useRef(null),Wt=t.useRef(0),zt=t.useRef(0),Yt=t.useRef(!1),Gt=t.useRef(null);Gt.current||(Gt.current=new _a(Nt));const[Vt,Ut]=t.useState(null),[Qt,Kt]=t.useState(0),[Zt,Jt]=t.useState(0),[en,tn]=t.useState(!1),nn=t.useRef(null),on=t.useRef(new Map),rn=t.useRef(0),sn=t.useCallback(e=>{if("function"==typeof oe)return oe(e)+"";if("string"==typeof oe&&e.data){const t=e.data[oe];if(void 0!==t){if(!on.current.has(t+"")){const e=Array.isArray(ie)?ie:xe;on.current.set(t+"",e[rn.current++%e.length])}return on.current.get(t+"")}}if(on.current.has(e.id))return on.current.get(e.id);const t=Array.isArray(ie)?ie:xe,n=oe?t[rn.current++%t.length]:t[0];return on.current.set(e.id,n),n},[oe,ie]),an=(null===(i=null==Mt?void 0:Mt.colors)||void 0===i?void 0:i.border)||(null===(r=null==Mt?void 0:Mt.colors)||void 0===r?void 0:r.secondary)||(null===(a=null==Mt?void 0:Mt.colors)||void 0===a?void 0:a.primary)||"#999",ln=t.useCallback(e=>{var t,n;return e?"object"==typeof e?e:null!==(n=null===(t=Gt.current)||void 0===t?void 0:t.nodes.get(e))&&void 0!==n?n:null:null},[]),cn=t.useCallback(e=>{if("function"==typeof re)return re(e);const t=ln(e.source),n=ln(e.target);return"target"===re&&n?sn(n):t?sn(t):an},[re,sn,an,ln]),un=t.useCallback(e=>{if("function"==typeof Rt.color){const t=ln(e.source);return t?Rt.color(e,t):an}if(!(null==ee?void 0:ee.colorBy))return cn(e);const t=Rt.colorBy,n=ln(e.source),o=ln(e.target);return"target"===t&&o?sn(o):n?sn(n):an},[null==ee?void 0:ee.colorBy,Rt.color,Rt.colorBy,sn,cn,an,ln]),dn=("sankey"===O||!!st)&&J||!!He||null!==(c=null===(l=Gt.current)||void 0===l?void 0:l.isAnimating)&&void 0!==c&&c;t.useEffect(()=>{var e;null===(e=Gt.current)||void 0===e||e.updateConfig(Nt),ut.current=!0,Ot()},[Nt,Ot]);const hn=t.useRef(null);t.useEffect(()=>{const e=Gt.current;if(!e)return;const t=null!=lt?lt:null;hn.current!==t&&(hn.current=t,e.setLayoutSelection(t),e.hasCustomRestyle?e.restyleScene(t):ut.current=!0,Ot())},[lt,Ot]),t.useEffect(()=>{var e;const t=Gt.current;if(t){t.buildScene([yt,mt]);for(const n of t.sceneNodes)n.id&&"string"==typeof(null===(e=n.style)||void 0===e?void 0:e.fill)&&on.current.set(n.id,n.style.fill);ut.current=!0,Ot()}},[Mt,yt,mt,Ot]);const gn=t.useCallback(()=>{var e;const t=Gt.current;if(!t)return;t.runLayout([yt,mt]),t.buildScene([yt,mt]),ut.current=!0;for(const n of t.sceneNodes)n.id&&"string"==typeof(null===(e=n.style)||void 0===e?void 0:e.fill)&&on.current.set(n.id,n.style.fill);const n=Array.isArray(ie)?ie:xe,o=Array.from(t.nodes.values());for(let e=0;o.length>e;e++){const t=o[e];on.current.has(t.id)||on.current.set(t.id,n[e%n.length])}if(rn.current=o.length,Kt(t.layoutVersion),Oe){const{nodes:e,edges:n}=t.getLayoutData();Oe(e,n)}},[yt,mt,Oe,ie]),fn=t.useCallback(e=>{if(null==e||"object"!=typeof e)return;const t=Gt.current;t&&(t.ingestEdge(e)&&gn(),Ot())},[gn,Ot]),pn=t.useCallback(e=>{const t=Gt.current;if(!t)return;let n=!1;for(const o of e)null!=o&&"object"==typeof o&&t.ingestEdge(o)&&(n=!0);n&&gn(),Ot()},[gn,Ot]),yn=t.useCallback(()=>{var e,t,n;null===(e=Gt.current)||void 0===e||e.clear(),on.current.clear(),rn.current=0,Kt(null!==(n=null===(t=Gt.current)||void 0===t?void 0:t.layoutVersion)&&void 0!==n?n:0),Ut(null),nn.current=null,ut.current=!0,Ot()},[Ot]),mn=t.useCallback(()=>{const e=Gt.current;e&&(e.tension+=999,gn(),Ot())},[gn,Ot]);t.useImperativeHandle(o,()=>({push:fn,pushMany:pn,removeNode:e=>{var t,n,o;const i=null!==(n=null===(t=Gt.current)||void 0===t?void 0:t.removeNode(e))&&void 0!==n&&n;if(i){const t=(null===(o=nn.current)||void 0===o?void 0:o.data)?"function"==typeof L?L(nn.current.data):nn.current.data[L]:void 0;nn.current&&"node"===nn.current.nodeOrEdge&&t===e&&(nn.current=null,Ut(null)),on.current.delete(e),gn(),ut.current=!0,Ot()}return i},removeEdge:(e,t)=>{var n,o;const i=null!==(o=null===(n=Gt.current)||void 0===n?void 0:n.removeEdge(e,t))&&void 0!==o&&o;if(i){if(nn.current&&"edge"===nn.current.nodeOrEdge){const n=nn.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:!N||!n||("function"==typeof N?N:e=>null==e?void 0:e[N])(n)===e,o&&(nn.current=null,Ut(null))}gn(),ut.current=!0,Ot()}return i},updateNode:(e,t)=>{var n,o;const i=null!==(o=null===(n=Gt.current)||void 0===n?void 0:n.updateNode(e,t))&&void 0!==o?o:null;return i&&(ut.current=!0,Ot()),i},updateEdge:(e,t,n)=>{var o,i;const r=null!==(i=null===(o=Gt.current)||void 0===o?void 0:o.updateEdge(e,t,n))&&void 0!==i?i:[];return r.length>0&&(gn(),ut.current=!0,Ot()),r},clear:yn,getTopology:()=>{var e,t;return null!==(t=null===(e=Gt.current)||void 0===e?void 0:e.getLayoutData())&&void 0!==t?t:{nodes:[],edges:[]}},getTopologyDiff:()=>{const e=Gt.current;return e?{addedNodes:Array.from(e.addedNodes),removedNodes:Array.from(e.removedNodes),addedEdges:Array.from(e.addedEdges),removedEdges:Array.from(e.removedEdges)}:{addedNodes:[],removedNodes:[],addedEdges:[],removedEdges:[]}},relayout:mn,getTension:()=>{var e,t;return null!==(t=null===(e=Gt.current)||void 0===e?void 0:e.tension)&&void 0!==t?t:0}}),[fn,pn,yn,mn,gn,Ot]);const vn=["tree","cluster","treemap","circlepack","partition","orbit"].includes(O),bn=vn?_||(Array.isArray(C)?void 0:C):void 0;t.useEffect(()=>{var e;const t=Gt.current;if(t)if(vn&&bn)t.ingestHierarchy(bn,[yt,mt]),t.buildScene([yt,mt]),ut.current=!0,Ot();else{const n=Pt,o=Array.isArray(Lt)?Lt:[];if(0===n.length&&0===o.length)return;t.ingestBounded(n,o,[yt,mt]),t.buildScene([yt,mt]);for(const n of t.sceneNodes)n.id&&(null===(e=n.style)||void 0===e?void 0:e.fill)&&on.current.set(n.id,n.style.fill+"");const i=Array.isArray(ie)?ie:xe,r=Array.from(t.nodes.values());for(let e=0;r.length>e;e++){const t=r[e];on.current.has(t.id)||on.current.set(t.id,i[e%i.length])}rn.current=r.length,ut.current=!0,Ot()}},[Pt,Lt,_,bn,vn,yt,mt,Et,Ot,ie]),t.useEffect(()=>{P&&P.length>0&&pn(P)},[]);const xn=t.useCallback(e=>{if(we&&we(e),je){const t=Date.now();je(e?{type:"hover",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:Se}:{type:"hover-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:Se})}},[we,je,Se]),kn=t.useCallback(e=>{if(Ae&&Ae(e),je){const t=Date.now();je(e?{type:"click",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:Se}:{type:"click-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:Se})}},[Ae,je,Se]),{hoverHandlerRef:wn,hoverLeaveRef:An,onPointerMove:jn,onPointerLeave:Sn}=dt,On=()=>{var e,t;return!st||null!==(t=null===(e=Gt.current)||void 0===e?void 0:e.hasCustomRestyle)&&void 0!==t&&t};wn.current=e=>{if(!be)return;const t=On(),n=Ft.current;if(!n)return;const o=n.getBoundingClientRect(),i=e.clientX-o.left-pt.left,r=e.clientY-o.top-pt.top;if(0>i||i>yt||0>r||r>mt)return void(nn.current&&(nn.current=null,Ut(null),xn&&(xn(null),t&&(ut.current=!0)),t&&Ot()));const s=Gt.current;if(!s)return;const a=Ra(s.sceneNodes,s.sceneEdges,i,r,30,s.nodeQuadtree,s.maxNodeRadius);if(!a)return void(nn.current&&(nn.current=null,Ut(null),xn&&(xn(null),t&&(ut.current=!0)),t&&Ot()));const l=hi(a.datum||{},a.x,a.y,{nodeOrEdge:a.type});nn.current=l,Ut(l),xn&&(xn(l),t&&(ut.current=!0)),t&&Ot()},An.current=()=>{if(nn.current){const e=On();nn.current=null,Ut(null),xn&&(xn(null),e&&(ut.current=!0)),e&&Ot()}};const Mn=t.useRef(()=>{});Mn.current=e=>{if(!Ae&&!je)return;const t=Ft.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-pt.left,i=e.clientY-n.top-pt.top;if(0>o||o>yt||0>i||i>mt)return;const r=Gt.current;if(!r)return;const s=Ra(r.sceneNodes,r.sceneEdges,o,i,30,r.nodeQuadtree,r.maxNodeRadius);kn(s?hi(s.datum||{},s.x,s.y,{nodeOrEdge:s.type}):null)};const Cn=t.useCallback(e=>Mn.current(e),[]),_n=t.useRef(-1),Pn=t.useRef(null),Ln=t.useRef(-1),Tn=t.useCallback(e=>{var t;const n=Gt.current;if(!n)return;const o=function(e){var t,n,o,i,r,s,a,l;const c=[];for(const u of e)if("circle"===u.type&&null!=u.cx){if(0>=u.r)continue;c.push({x:u.cx,y:u.cy,datum:u.datum,shape:"circle",group:null!==(n=null===(t=u.datum)||void 0===t?void 0:t.id)&&void 0!==n?n:"_default"})}else if("rect"===u.type&&null!=u.x){if(0>=u.w||0>=u.h)continue;c.push({x:u.x+u.w/2,y:u.y+u.h/2,datum:u.datum,shape:"rect",w:u.w,h:u.h,group:null!==(i=null===(o=u.datum)||void 0===o?void 0:o.id)&&void 0!==i?i:"_default"})}else if("arc"===u.type&&null!=u.cx)c.push({x:u.cx,y:u.cy,datum:u.datum,shape:"circle",group:null!==(s=null===(r=u.datum)||void 0===r?void 0:r.id)&&void 0!==s?s:"_default"});else if("symbol"===u.type&&null!=u.cx){if(0>=u.size)continue;c.push({x:u.cx,y:u.cy,datum:u.datum,shape:"circle",group:null!==(l=null===(a=u.datum)||void 0===a?void 0:a.id)&&void 0!==l?l:"_default"})}return c.sort((e,t)=>e.x-t.x||e.y-t.y),c}(n.sceneNodes);if(0===o.length)return;const i=Bt(o),r=_n.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(),_n.current=0,Ln.current=-1;const t=i.flat[0];Pn.current={shape:t.shape,w:t.w,h:t.h};const n=hi(t.datum||{},t.x,t.y,{nodeOrEdge:"node"});return nn.current=n,Ut(n),xn&&(xn(n),ut.current=!0),void Ot()}const s=Dt(i,r),a=function(e,t,n,o,i){var r,s,a;const l=n.flat[t.flatIndex];if(!l)return It(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!==(s=function(e,t,n){let o=null,i=1/0;for(let r=0;e.flat.length>r;r++){const s=e.flat[r];if(s===t)continue;const a=s.x-t.x,l=s.y-t.y;let c=!1;switch(n){case"right":c=a>0&&Math.abs(a)>=Math.abs(l);break;case"left":c=0>a&&Math.abs(a)>=Math.abs(l);break;case"down":c=l>0&&Math.abs(l)>=Math.abs(a);break;case"up":c=0>l&&Math.abs(l)>=Math.abs(a)}if(!c)continue;const u=a*a+l*l;i>u&&(i=u,o=r)}return o}(n,l,"ArrowRight"===e?"right":"ArrowLeft"===e?"left":"ArrowDown"===e?"down":"up"))&&void 0!==s?s: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=Ht(t.source),s=Ht(t.target),a=null!=r,l=null!=s;a&&r+""===o&&l?i.push(s+""):l&&s+""===o&&a&&i.push(r+"")}return i}(c,o);if(0===e.length)return t.flatIndex;const r=null!==(a=n.idToIdx.get(e[(i.current+1)%e.length]))&&void 0!==a?a:-1;return 0>r?t.flatIndex:(i.current=-1,r)}default:{const o=It(e,t,n);return null!==o&&o!==t.flatIndex&&(i.current=-1),o}}}(e.key,s,i,null!==(t=n.sceneEdges)&&void 0!==t?t:[],Ln);if(null===a)return;if(e.preventDefault(),0>a)return _n.current=-1,Pn.current=null,Ln.current=-1,nn.current=null,Ut(null),xn&&(xn(null),ut.current=!0),void Ot();_n.current=a;const l=i.flat[a];Pn.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"};nn.current=c,Ut(c),xn&&(xn(c),ut.current=!0),Ot()},[xn,Ot]),Rn=t.useCallback(e=>{_n.current=-1,Pn.current=null,jn(e)},[jn]);St.current=()=>{var e,t,n,o,i,r,s;jt.current=0;const a=Ft.current;if(!a)return;const l=a.getContext("2d");if(!l)return;const c=Gt.current;if(!c)return;const u=performance.now(),d=Wt.current?Math.min((u-Wt.current)/1e3,.1):.016;Wt.current=u;const h=c.advanceTransition(ht.current?u+1e6:u),g=!ht.current&&h,f=!ht.current&&c.tickAnimation([yt,mt],d);(h||ut.current||f)&&c.buildScene([yt,mt]);const p=Ti();if(!Li(a,ft,pt,p))return;if(l.clearRect(-pt.left,-pt.top,ft[0],ft[1]),ve){const e=vt(l,ve);e&&(l.fillStyle=e,l.fillRect(0,0,yt,mt))}Fe&&c.applyDecay(),He&&c.applyPulse(u),qe&&c.applyThresholds(u),!1!==ze&&c.applyTopologyDiff(u);const y=null!==(e=null==Ye?void 0:Ye.threshold)&&void 0!==e?e:5e3,m=Ye&&c.lastIngestTime>0&&u-c.lastIngestTime>y;if(m&&(l.globalAlpha=null!==(t=null==Ye?void 0:Ye.dimOpacity)&&void 0!==t?t:.5),function(e,t){for(const n of t)switch(n.type){case"bezier":qa(e,n);break;case"line":Xa(e,n);break;case"ribbon":Va(e,n);break;case"curved":Ua(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&&vt(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=vt(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)),Bi(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&&vt(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=vt(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()),Di(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&&vt(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=vt(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),function(e,t){var n,o,i;const r=e.globalAlpha;for(const s of t){if("symbol"!==s.type)continue;const t=s;if(0>=t.size)continue;const a=Ya(t);if(!a)continue;e.save(),e.translate(t.cx,t.cy),t.rotation&&e.rotate(t.rotation);const l=null!==(n=t.style.opacity)&&void 0!==n?n:1;t.style.fill&&(e.globalAlpha=r*l*(null!==(o=t.style.fillOpacity)&&void 0!==o?o:1),e.fillStyle="string"==typeof t.style.fill&&vt(e,t.style.fill)||t.style.fill,e.fill(a)),t.style.stroke&&"none"!==t.style.stroke&&(e.globalAlpha=r*l,e.strokeStyle=vt(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(i=t.style.strokeWidth)&&void 0!==i?i:1,e.stroke(a)),e.restore()}}(l,c.sceneNodes),J&&c.particlePool&&!m){const e=c.edgesArray;if(e.length>0){!function(e,t,n,o){var i,r;const s=null!==(i=o.spawnRate)&&void 0!==i?i:cs.spawnRate,a=null!==(r=o.maxPerEdge)&&void 0!==r?r:cs.maxPerEdge;for(let o=0;t.length>o;o++){const i=t[o];if(!i.bezier)continue;if(e.countForEdge(o)>=a)continue;const r=i.value*s*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)<a;t++)e.spawn(o)}}(c.particlePool,e,d,Rt);const t=.5*(null!==(n=Rt.speedMultiplier)&&void 0!==n?n:1);let o;if(Rt.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,s;const a=null!==(r=o.radius)&&void 0!==r?r:cs.radius,l=null!==(s=o.opacity)&&void 0!==s?s:cs.opacity;e.globalAlpha=l;for(let r=0;t.particles.length>r;r++){const s=t.particles[r];if(!s.active)continue;const l=n[s.edgeIndex];if(!l)continue;let c;c="string"==typeof o.color&&"inherit"!==o.color?o.color:i(l),e.fillStyle=vt(e,c)||c,e.beginPath(),e.arc(s.x,s.y,a,0,2*Math.PI),e.fill()}e.globalAlpha=1}(l,c.particlePool,e,Rt,un)}}m&&(l.globalAlpha=1);const v=ut.current;if(ut.current=!1,v||g||f){const e=Ft.current;e&&e.setAttribute("aria-label",zo(null!==(i=null===(o=c.sceneNodes)||void 0===o?void 0:o.length)&&void 0!==i?i:0,null!==(s=null===(r=c.sceneEdges)||void 0===r?void 0:r.length)&&void 0!==s?s:0,"Network chart"))}const b=v||g||f||Yt.current;b&&u-zt.current>=33?(Jt(e=>e+1),zt.current=u,Yt.current=!1):Yt.current=!!b,(dn||g||null!=c.transition||f||c.hasActivePulses||c.hasActiveThresholds||!1!==ze&&c.hasActiveTopologyDiff||Yt.current)&&(jt.current=requestAnimationFrame(()=>St.current()))},Ro({hydrated:Ct,wasHydratingFromSSR:_t,storeRef:Gt,dirtyRef:ut,renderFnRef:St}),t.useEffect(()=>{ut.current=!0,Ot()},[O,yt,mt,ve,Ot]),qt(Ye,Gt,ut,Ot,en,tn);const $n=be&&Vt?e.jsx(Si,{x:Vt.x,y:Vt.y,containerWidth:yt,containerHeight:mt,margin:pt,className:"stream-network-tooltip",zIndex:2,children:ke?ke(Vt):e.jsx(tl,{data:Vt})}):null;if(Oo||!Ct&&_t){const t=Gt.current;if(t){const e=["tree","cluster","treemap","circlepack","partition","orbit"].includes(O),n=e?_||(Array.isArray(C)?void 0:C):void 0;if(e&&n)t.ingestHierarchy(n,[yt,mt]),t.buildScene([yt,mt]);else{const e=Pt,n=Array.isArray(Lt)?Lt:[];(e.length>0||n.length>0)&&(t.ingestBounded(e,n,[yt,mt]),t.buildScene([yt,mt]))}}const n=null!==(u=null==t?void 0:t.sceneNodes)&&void 0!==u?u:[],o=null!==(d=null==t?void 0:t.sceneEdges)&&void 0!==d?d:[],i=null!==(h=null==t?void 0:t.labels)&&void 0!==h?h:[];return e.jsxs("div",{ref:gt,className:"stream-network-frame"+(me?" "+me:""),role:"img","aria-label":Ve||("string"==typeof Be?Be:"Network chart"),style:{position:"relative",width:fe?"100%":ft[0],height:pe?"100%":ft[1]},children:[e.jsx(si,{summary:Ue}),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:ft[0],height:ft[1],style:{position:"absolute",left:0,top:0},children:[xt&&e.jsx("g",{transform:`translate(${pt.left},${pt.top})`,children:xt}),e.jsxs("g",{transform:`translate(${pt.left},${pt.top})`,children:[ve&&e.jsx("rect",{x:0,y:0,width:yt,height:mt,fill:ve}),o.map((t,n)=>function(t,n){switch(t.type){case"line":return e.jsx("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.stroke||"#999",strokeWidth:t.style.strokeWidth||1,opacity:t.style.opacity},"net-edge-"+n);case"bezier":{const o=t;return e.jsx("path",{d:o.pathD,fill:Ao(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.jsx("path",{d:o.pathD,fill:Ao(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.jsx("path",{d:o.pathD,fill:Ao(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),n.map((t,n)=>function(t,n){switch(t.type){case"circle":{const o=t;return e.jsx("circle",{cx:o.cx,cy:o.cy,r:o.r,fill:Ao(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.jsx("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:Ao(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},"net-rect-"+n)}case"arc":{const o=t,i=s.arc().innerRadius(o.innerR).outerRadius(o.outerR).startAngle(o.startAngle+Math.PI/2).endAngle(o.endAngle+Math.PI/2)(wo)||"";return e.jsx("path",{d:i,transform:`translate(${o.cx},${o.cy})`,fill:Ao(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},"net-arc-"+n)}case"symbol":{const o=t,i=Ge(o.symbolType,o.size,o.path);return e.jsx("path",{d:i,transform:o.rotation?`translate(${o.cx},${o.cy}) rotate(${180*o.rotation/Math.PI})`:`translate(${o.cx},${o.cy})`,fill:o.style.fill?Ao(o.style.fill):"none",stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},"net-symbol-"+n)}default:return null}}(t,n)).filter(Boolean),i.map((t,n)=>function(t,n){return e.jsx("text",{x:t.x,y:t.y,textAnchor:t.anchor||"middle",dominantBaseline:t.baseline||"auto",fontSize:t.fontSize||11,fontWeight:t.fontWeight,fill:t.fill||"#333",stroke:t.stroke,strokeWidth:t.strokeWidth,paintOrder:t.paintOrder,children:t.text},"net-label-"+n)}(t,n)).filter(Boolean)]})]}),e.jsx(Fa,{width:yt,height:mt,totalWidth:ft[0],totalHeight:ft[1],margin:pt,labels:i,sceneNodes:n,title:Be,legend:Pe,legendPosition:Le,legendLayout:Te,legendHoverBehavior:Re,legendClickBehavior:$e,legendHighlightedCategory:Ne,legendIsolatedCategories:Ee,foregroundGraphics:et(bt,it(null===(g=Gt.current)||void 0===g?void 0:g.customLayoutOverlays,null!=lt?lt:null)),annotations:Me,autoPlaceAnnotations:Ce,svgAnnotationRules:_e,annotationFrame:0}),e.jsx(Wa,{marks:null==t?void 0:t.customLayoutHtmlMarks,margin:pt,selection:null!=lt?lt:null})]})}const Nn=Gt.current;return e.jsxs("div",{ref:gt,className:"stream-network-frame"+(me?" "+me:""),role:"group","aria-label":Ve||("string"==typeof Be?Be:"Network chart"),tabIndex:0,style:{position:"relative",width:fe?"100%":ft[0],height:pe?"100%":ft[1],overflow:"visible"},onKeyDown:Tn,children:[Xe&&e.jsx(ai,{tableId:At}),Xe&&e.jsx(ri,{nodes:null!==(f=null==Nn?void 0:Nn.sceneNodes)&&void 0!==f?f:[],edges:null!==(p=null==Nn?void 0:Nn.sceneEdges)&&void 0!==p?p:[],chartType:"Network chart",tableId:At,chartTitle:"string"==typeof Be?Be:void 0}),e.jsx(si,{summary:Ue}),e.jsx(li,{hoverPoint:Vt}),e.jsxs("div",{role:"img","aria-label":Ve||("string"==typeof Be?Be:"Network chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:be?Rn:void 0,onMouseLeave:be?Sn:void 0,onClick:Ae||je?Cn:void 0,children:[xt&&e.jsx("svg",{overflow:"visible",style:{position:"absolute",top:0,left:0,width:ft[0],height:ft[1],pointerEvents:"none",overflow:"visible"},children:e.jsx("g",{transform:`translate(${pt.left},${pt.top})`,children:xt})}),e.jsx("canvas",{ref:Ft,"aria-label":zo(null!==(m=null===(y=null==Nn?void 0:Nn.sceneNodes)||void 0===y?void 0:y.length)&&void 0!==m?m:0,null!==(b=null===(v=null==Nn?void 0:Nn.sceneEdges)||void 0===v?void 0:v.length)&&void 0!==b?b:0,"Network chart"),style:{position:"absolute",top:0,left:0}}),e.jsx(Fa,{width:yt,height:mt,totalWidth:ft[0],totalHeight:ft[1],margin:pt,labels:(null==Nn?void 0:Nn.labels)||[],sceneNodes:null==Nn?void 0:Nn.sceneNodes,title:Be,legend:Pe,legendPosition:Le,legendLayout:Te,legendHoverBehavior:Re,legendClickBehavior:$e,legendHighlightedCategory:Ne,legendIsolatedCategories:Ee,foregroundGraphics:et(bt,it(null===(x=Gt.current)||void 0===x?void 0:x.customLayoutOverlays,null!=lt?lt:null)),annotations:Me,autoPlaceAnnotations:Ce,svgAnnotationRules:_e,annotationFrame:Zt}),e.jsx(Wa,{marks:null==Nn?void 0:Nn.customLayoutHtmlMarks,margin:pt,selection:null!=lt?lt:null}),e.jsx(ui,{active:_n.current>=0,hoverPoint:Vt,margin:pt,size:ft,shape:null===(w=Pn.current)||void 0===w?void 0:w.shape,width:null===(A=Pn.current)||void 0===A?void 0:A.w,height:null===(j=Pn.current)||void 0===j?void 0:j.h}),$n,(null==Ye?void 0:Ye.showBadge)&&e.jsx(Xt,{isStale:en,position:Ye.badgePosition})]})]})});function il(e){const{title:t,description:n,summary:o,accessibleTable:i,className:r,animate:s,axisExtent:a,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!=s&&(c.animate=s),void 0!==a&&(c.axisExtent=a),void 0!==l&&(c.autoPlaceAnnotations=l),c}function rl(e){const{linkedHover:t,onObservation:n,onClick:o,hoverHighlight:i,customHoverBehavior:r,customClickBehavior:s,linkedHoverInClickPredicate:a=!0}=e,l={};return(t||n||o||i)&&(l.customHoverBehavior=r),(a?n||o||t:n||o)&&(l.customClickBehavior=s),l}function sl(e){const{tooltip:t,defaultTooltipContent:n}=e;return{tooltipContent:!1===t?()=>null:ji(t)||n}}ol.displayName="StreamNetworkFrame";const al=t.createContext(null);function ll({colors:n,categories:o,colorScheme:i="category10",children:r}){const s=t.useMemo(()=>{if(n)return n;if(o){const e=Array.isArray(i)?i:be[i]||xe,t={};for(let n=0;o.length>n;n++)t[o[n]]=e[n%e.length];return t}return{}},[n,o,i]);return e.jsx(al.Provider,{value:s,children:r})}function cl(){return t.useContext(al)}function ul(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 dl(e,t){const n=[];for(const[o,i]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(ul(i));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}function hl(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}function gl(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 n of e.values)if(!t.values.has(n))return!1;return!0}return!1}ll.displayName="CategoryColorProvider";const[fl,pl]=A(e=>({selections:new Map,setClause(t,n){e(e=>{const o=e.selections.get(t),i=null==o?void 0:o.clauses.get(n.clientId);if(i&&function(e,t){if(e.clientId!==t.clientId||e.type!==t.type)return!1;const n=Object.entries(e.fields);if(n.length!==function(e){let t=0;for(const n in e)t++;return t}(t.fields))return!1;for(const[e,o]of n){const n=t.fields[e];if(!n||!gl(o,n))return!1}return!0}(i,n))return{};const r=new Map(e.selections),s=hl(r,t),a=new Map(s.clauses);return a.set(n.clientId,n),r.set(t,Object.assign(Object.assign({},s),{clauses:a})),{selections:r}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o||!o.clauses.has(n))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=e.selections.get(t);if((null==o?void 0:o.resolution)===n)return{};const i=new Map(e.selections),r=hl(i,t);return i.set(t,Object.assign(Object.assign({},r),{resolution:n})),{selections:i}})},clearSelection(t){e(e=>{const n=e.selections.get(t);if(!n||0===n.clauses.size)return{};const o=new Map(e.selections);return o.set(t,Object.assign(Object.assign({},n),{clauses:new Map})),{selections:o}})}})),[yl,ml]=A(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 vl(e){const n=t.useId(),o=e.clientId||n,{name:i}=e,r=pl(e=>e.selections.get(i)),s=pl(e=>e.setClause),a=pl(e=>e.clearClause),l=t.useMemo(()=>!!r&&r.clauses.size>0,[r]);return{predicate:t.useMemo(()=>r&&0!==r.clauses.size?dl(r,o):()=>!0,[r,o]),isActive:l,selectPoints:t.useCallback(e=>{const t={};let n=!1;for(const[o,i]of Object.entries(e))t[o]={type:"point",values:new Set(i)},n=!0;n&&s(i,{clientId:o,type:"point",fields:t})},[o,i,s]),selectInterval:t.useCallback(e=>{const t={};let n=!1;for(const[o,i]of Object.entries(e))t[o]={type:"interval",range:i},n=!0;n&&s(i,{clientId:o,type:"interval",fields:t})},[o,i,s]),clear:t.useCallback(()=>{a(i,o)},[a,i,o]),clientId:o}}function bl(e){const n=e.name||"hover",{fields:o}=e,{predicate:i,isActive:r,selectPoints:s,clear:a}=vl({name:n});return{onHover:t.useCallback(e=>{if(!e)return void a();const t={};for(const n of o){const o=e[n];void 0!==o&&(t[n]=[o])}wl(t)&&s(t)},[o,s,a,n]),predicate:i,isActive:r}}function xl(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function kl(e){const{name:n,xField:o,yField:i}=e,{predicate:r,isActive:s,selectInterval:a,clear:l}=vl({name:n}),c=o&&i?"xyBrush":o?"xBrush":"yBrush",u=t.useCallback(e=>{if(!e)return void l();const t={};"xyBrush"===c&&function(e){return 2===e.length&&Array.isArray(e[0])&&2===e[0].length&&Array.isArray(e[1])&&2===e[1].length}(e)?(o&&(t[o]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),i&&(t[i]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===c&&xl(e)?o&&(t[o]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]):"yBrush"===c&&xl(e)&&i&&(t[i]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]),wl(t)&&a(t)},[c,o,i,a,l]);return{brushInteraction:t.useMemo(()=>({brush:c,during:u,end:u}),[c,u]),predicate:r,isActive:s,clear:l}}function wl(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function Al(e={}){const{limit:n=50,types:o,chartId:i}=e,r=ml(e=>e.version),s=ml(e=>e.observations),a=ml(e=>e.clearObservations),l=t.useMemo(()=>{let e=s;if(o&&o.length>0){const t=new Set(o);e=e.filter(e=>t.has(e.type))}return i&&(e=e.filter(e=>e.chartId===i)),e.length>n&&(e=e.slice(e.length-n)),e},[s,o,i,n,r]);return{observations:l,latest:l.length>0?l[l.length-1]:null,clear:a}}const jl=t.createContext(!1),Sl=t.createContext(null),Ol="undefined"==typeof window?t.useEffect:t.useLayoutEffect;function Ml(e){const t=new Set,n=[];for(const o of e)t.has(o)||(t.add(o),n.push(o));return n}function Cl(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 _l(e){const n=t.useContext(Sl),o=t.useId(),i=Ml(e),r=t.useRef([]);Cl(r.current,i)||(r.current=i);const s=r.current;Ol(()=>{if(n)return()=>n.unregisterCategories(o)},[n,o]),Ol(()=>{n&&n.registerCategories(o,s)},[n,o,s])}function Pl({selections:e}){const n=pl(e=>e.setResolution);return t.useEffect(()=>{for(const[t,o]of Object.entries(e))o.resolution&&n(t,o.resolution)},[e,n]),null}function Ll({categoryColors:n,interaction:o,selectionName:i,field:r}){const s=Object.entries(n),a=s.map(([e])=>e),l=[{styleFn:e=>({fill:e.color||"#333",stroke:e.color||"#333"}),type:"fill",items:s.map(([e,t])=>({label:e,color:t})),label:""}],c=bl({name:i,fields:[r]}),u=vl({name:i,clientId:"__linked-legend-isolate__"}),[d,h]=t.useState(new Set),[g,f]=t.useState(null),p=t.useRef(u.selectPoints);p.current=u.selectPoints;const y=t.useRef(u.clear);y.current=u.clear,t.useEffect(()=>{"isolate"===o&&(d.size>0?p.current({[r]:Array.from(d)}):y.current())},[o,d,r]);const m=t.useCallback(e=>{"highlight"===o&&(e?(f(e.label),c.onHover({[r]:e.label})):(f(null),c.onHover(null)))},[o,r,c]),v=t.useCallback(e=>{"isolate"===o&&h(t=>{const n=new Set(t);return n.has(e.label)?n.delete(e.label):n.add(e.label),n.size===a.length?new Set:n})},[o,a.length]),[b,[x]]=Mi([0,0],!0,!1),k=t.useMemo(()=>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}(s.map(([e])=>e),x),[s,x]);return 0===s.length?null:e.jsx("div",{ref:b,style:{width:"100%",display:"block"},children:e.jsx("svg",{width:"100%",height:Math.max(30,22*k+8),style:{display:"block",overflow:"visible"},children:e.jsx(en,{legendGroups:l,title:!1,orientation:"horizontal",width:x,height:20,customHoverBehavior:"highlight"===o?m:void 0,customClickBehavior:"isolate"===o?v:void 0,highlightedCategory:g,isolatedCategories:d})})})}function Tl({children:n,selections:o,showLegend:i,legendPosition:r="top",legendInteraction:s="none",legendSelectionName:a="legend",legendField:l="category"}){const c=cl(),[u,d]=t.useState({}),h=t.useRef({}),g=t.useMemo(()=>({registerCategories:(e,t)=>{const n=Ml(t);d(t=>{var o;return Cl(null!==(o=t[e])&&void 0!==o?o:[],n)?t:Object.assign(Object.assign({},t),{[e]:n})})},unregisterCategories:e=>{d(t=>{if(!(e in t))return t;const n=Object.assign({},t);return delete n[e],n})}}),[]),f=t.useMemo(()=>{const e=[];for(const t of Object.values(u))for(const n of t)e.push(n);return Ml(e)},[u]),p=t.useMemo(()=>{var e;const t=null!=c?c:{},n=h.current;let o=Object.keys(t).length+Object.keys(n).length;for(const e of f)t[e]||n[e]||(n[e]=xe[o%xe.length],o++);const i=Object.assign({},t);for(const o of f)i[o]=null!==(e=t[o])&&void 0!==e?e:n[o];return i},[c,f]),y=void 0===i||i,m=y&&Object.keys(p).length>0;return e.jsx(fl,{children:e.jsxs(yl,{children:[o&&e.jsx(Pl,{selections:o}),e.jsx(Sl.Provider,{value:g,children:e.jsx(ll,{colors:p,children:e.jsxs(jl.Provider,{value:m,children:[y&&"top"===r&&e.jsx(Ll,{categoryColors:p,interaction:s,selectionName:a,field:l}),n,y&&"bottom"===r&&e.jsx(Ll,{categoryColors:p,interaction:s,selectionName:a,field:l})]})})})]})})}function Rl({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:i,strokeWidth:r,categories:s}){const a=(s&&s.length>0?s:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((i,r)=>{const s=e.find("function"==typeof t?e=>t(e)===i:e=>e[t]===i),a=s?o(s,t,n):n?n(i):ke[r%ke.length];return{label:i+"",color:a}});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:a,label:""}]}}function $l(e){return e?"string"==typeof e?{name:e}:e:null}function Nl(e,t,n){return t?(o,...i)=>{var r;const s=Object.assign({},e(o,...i));if(t.isActive)if(t.predicate(o))(null==n?void 0:n.selectedStyle)&&Object.assign(s,n.selectedStyle);else{const e=null!==(r=null==n?void 0:n.unselectedOpacity)&&void 0!==r?r:.5;s.opacity=e,s.fillOpacity=e,s.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(s,n.unselectedStyle)}return s}:e}const El={light:C,dark:_,"high-contrast":P,pastels:{mode:"light",colors:{primary:"#c9a0dc",secondary:"#b8a8c8",categorical:["#f0a0c0","#88d4ab","#b0a0e8","#f0c888"],sequential:"purples",background:"#fdf6f0",surface:"#fff5ee",text:"#4a3728",textSecondary:"#7a644a",grid:"#e8d5c4",border:"#e8d5c4",focus:"#8a5fae",annotation:"#8a5fae",success:"#9ad4a3",danger:"#e8869a",warning:"#f0c888",error:"#c86070",info:"#9cb8e0"},typography:{fontFamily:"Inter, system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#fff5ee",text:"#4a3728",borderRadius:"8px",shadow:"0 2px 8px rgba(0, 0, 0, 0.12)"},borderRadius:"10px"},"pastels-dark":{mode:"dark",colors:{primary:"#c9a0dc",secondary:"#a899c0",categorical:["#f0a0c0","#88d4ab","#b0a0e8","#f0c888"],sequential:"purples",background:"#1a1525",surface:"#251e35",text:"#e8ddf0",textSecondary:"#a899c0",grid:"#3d3455",border:"#3d3455",focus:"#c9a0dc",annotation:"#c9a0dc",success:"#88d4ab",danger:"#f0a0c0",warning:"#f0c888",error:"#e87690",info:"#9cb8e0"},typography:{fontFamily:"Inter, system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#251e35",text:"#e8ddf0",borderRadius:"8px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"10px"},"bi-tool":{mode:"light",colors:{primary:"#2563eb",secondary:"#6b7280",categorical:["#2563eb","#0d9488","#ea580c","#6b7280"],sequential:"blues",background:"#f5f6f8",surface:"#ffffff",text:"#2c3e50",textSecondary:"#64717f",grid:"#d8dce3",border:"#d8dce3",focus:"#2563eb",annotation:"#2563eb",success:"#10b981",danger:"#ef4444",warning:"#f59e0b",error:"#dc2626",info:"#2563eb"},typography:{fontFamily:"'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#ffffff",text:"#2c3e50",borderRadius:"6px",shadow:"0 2px 8px rgba(0, 0, 0, 0.12)"},borderRadius:"8px"},"bi-tool-dark":{mode:"dark",colors:{primary:"#3b82f6",secondary:"#9ca3af",categorical:["#3b82f6","#14b8a6","#f97316","#9ca3af"],sequential:"blues",background:"#111827",surface:"#1f2937",text:"#f3f4f6",textSecondary:"#9ca3af",grid:"#374151",border:"#374151",focus:"#3b82f6",annotation:"#3b82f6",success:"#34d399",danger:"#f87171",warning:"#fbbf24",error:"#ef4444",info:"#60a5fa"},typography:{fontFamily:"'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#1f2937",text:"#f3f4f6",borderRadius:"6px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"8px"},italian:{mode:"light",colors:{primary:"#cc0000",secondary:"#666666",categorical:["#cc0000","#333333","#c8a415","#4682b4"],sequential:"reds",background:"#fafafa",surface:"#ffffff",text:"#1a1a1a",textSecondary:"#666666",grid:"#e0e0e0",border:"#e0e0e0",focus:"#cc0000",annotation:"#cc0000",success:"#556b2f",danger:"#cc0000",warning:"#c8a415",error:"#8b0000",info:"#4682b4"},typography:{fontFamily:"'Helvetica Neue', Helvetica, Arial, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#ffffff",text:"#1a1a1a",borderRadius:"2px",shadow:"0 2px 4px rgba(0, 0, 0, 0.15)"},borderRadius:"2px"},"italian-dark":{mode:"dark",colors:{primary:"#ff3333",secondary:"#aaaaaa",categorical:["#ff3333","#aaaaaa","#d4a843","#6aa4d4"],sequential:"reds",background:"#0a0a0a",surface:"#1a1a1a",text:"#f5f5f5",textSecondary:"#aaaaaa",grid:"#333333",border:"#333333",focus:"#ff3333",annotation:"#ff3333",success:"#7a8b5a",danger:"#ff3333",warning:"#d4a843",error:"#cc0000",info:"#6aa4d4"},typography:{fontFamily:"'Helvetica Neue', Helvetica, Arial, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#1a1a1a",text:"#f5f5f5",borderRadius:"2px",shadow:"0 2px 8px rgba(0, 0, 0, 0.5)"},borderRadius:"2px"},tufte:{mode:"light",colors:{primary:"#8b0000",secondary:"#555555",categorical:["#8b4513","#556b2f","#4a5568","#800020"],sequential:"oranges",background:"#fffff8",surface:"#fffff8",text:"#111111",textSecondary:"#555555",grid:"#e0ddd0",border:"#e0ddd0",focus:"#8b0000",annotation:"#8b0000",success:"#556b2f",danger:"#8b0000",warning:"#b88700",error:"#6b0000",info:"#4a5568"},typography:{fontFamily:"Georgia, 'Times New Roman', serif",titleSize:16,labelSize:12,tickSize:12,tickFontFamily:"'Courier New', Courier, monospace",legendSize:11},tooltip:{background:"#fffff8",text:"#111111",borderRadius:"2px",shadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},borderRadius:"0px"},"tufte-dark":{mode:"dark",colors:{primary:"#c05050",secondary:"#a09880",categorical:["#c08050","#7a8b5a","#8090a0","#a05060"],sequential:"oranges",background:"#1c1b18",surface:"#262520",text:"#e8e4d8",textSecondary:"#a09880",grid:"#3d3c35",border:"#3d3c35",focus:"#c05050",annotation:"#d06a6a",success:"#7a8b5a",danger:"#c05050",warning:"#c8a060",error:"#a04040",info:"#8090a0"},typography:{fontFamily:"Georgia, 'Times New Roman', serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#262520",text:"#e8e4d8",borderRadius:"2px",shadow:"0 2px 6px rgba(0, 0, 0, 0.4)"},borderRadius:"0px"},journalist:{mode:"light",colors:{primary:"#e45050",secondary:"#666666",categorical:["#3a86c8","#e45050","#d4a843","#888888"],sequential:"blues",background:"#ffffff",surface:"#f8f8f8",text:"#222222",textSecondary:"#666666",grid:"#d4d4d4",border:"#d4d4d4",focus:"#e45050",annotation:"#c63b3b",success:"#2d7a3d",danger:"#c8303a",warning:"#d4a843",error:"#a02028",info:"#3a86c8"},typography:{fontFamily:"'Franklin Gothic Medium', 'Libre Franklin', Arial, sans-serif",titleSize:18,labelSize:12,tickSize:12,tickFontFamily:"'Courier New', Courier, monospace",legendSize:11},tooltip:{background:"#f8f8f8",text:"#222222",borderRadius:"4px",shadow:"0 2px 6px rgba(0, 0, 0, 0.12)"},borderRadius:"4px"},"journalist-dark":{mode:"dark",colors:{primary:"#ff6b6b",secondary:"#a0a0a0",categorical:["#5a9fd8","#ff6b6b","#e0c060","#aaaaaa"],sequential:"blues",background:"#141414",surface:"#1e1e1e",text:"#ededed",textSecondary:"#a0a0a0",grid:"#383838",border:"#383838",focus:"#ff6b6b",annotation:"#ff6b6b",success:"#6fba78",danger:"#ff6b6b",warning:"#e0c060",error:"#d04040",info:"#5a9fd8"},typography:{fontFamily:"'Franklin Gothic Medium', 'Libre Franklin', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#1e1e1e",text:"#ededed",borderRadius:"4px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"4px"},playful:{mode:"light",colors:{primary:"#8b5cf6",secondary:"#7c5a9e",categorical:["#8b5cf6","#ec4899","#06b6d4","#84cc16"],sequential:"viridis",background:"#fdf8ff",surface:"#ffffff",text:"#2d1b4e",textSecondary:"#7c5a9e",grid:"#e8d0f8",border:"#e8d0f8",focus:"#8b5cf6",annotation:"#7a47e8",success:"#10d870",danger:"#ff4b6e",warning:"#ffaa33",error:"#e11d48",info:"#06b6d4"},typography:{fontFamily:"'Nunito', 'Poppins', system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#ffffff",text:"#2d1b4e",borderRadius:"12px",shadow:"0 4px 12px rgba(139, 92, 246, 0.15)"},borderRadius:"12px"},"playful-dark":{mode:"dark",colors:{primary:"#a78bfa",secondary:"#b8a0d8",categorical:["#a78bfa","#f472b6","#22d3ee","#a3e635"],sequential:"viridis",background:"#150a28",surface:"#1f1138",text:"#f0e8ff",textSecondary:"#b8a0d8",grid:"#3a2560",border:"#3a2560",focus:"#a78bfa",annotation:"#a78bfa",success:"#4ade80",danger:"#fb7185",warning:"#fbbf24",error:"#f43f5e",info:"#22d3ee"},typography:{fontFamily:"'Nunito', 'Poppins', system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#1f1138",text:"#f0e8ff",borderRadius:"12px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"12px"},carbon:{mode:"light",colors:{primary:"#0f62fe",secondary:"#525252",categorical:["#6929c4","#1192e8","#005d5d","#9f1853"],sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#161616",textSecondary:"#525252",grid:"#e0e0e0",border:"#e0e0e0",focus:"#0f62fe",annotation:"#0f62fe",success:"#24a148",danger:"#da1e28",warning:"#f1c21b",error:"#a2191f",info:"#0043ce"},typography:{fontFamily:"'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#ffffff",text:"#161616",borderRadius:"2px",shadow:"0 2px 6px rgba(0, 0, 0, 0.2)"},borderRadius:"0px"},"carbon-dark":{mode:"dark",colors:{primary:"#4589ff",secondary:"#a8a8a8",categorical:["#a56eff","#33b1ff","#08bdba","#ff7eb6"],sequential:"blues",diverging:"RdBu",background:"#161616",surface:"#262626",text:"#f4f4f4",textSecondary:"#a8a8a8",grid:"#393939",border:"#393939",focus:"#4589ff",annotation:"#4589ff",success:"#42be65",danger:"#fa4d56",warning:"#f1c21b",error:"#da1e28",info:"#4589ff"},typography:{fontFamily:"'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#262626",text:"#f4f4f4",borderRadius:"2px",shadow:"0 4px 12px rgba(0, 0, 0, 0.5)"},borderRadius:"0px"}};function Bl(e){return El[e]}const Dl=p.createContext(void 0),Il="undefined"==typeof window?p.useEffect:p.useLayoutEffect;function Fl(e){if("string"!=typeof e)return e;if("light"===e||"dark"===e||"high-contrast"===e)return e;return Bl(e)||(void 0!==console&&console.warn(`[ThemeProvider] Unknown theme preset "${e}". Falling back to light theme.`),"light")}function Hl({theme:e}){const t=R(e=>e.setTheme),n=R(e=>e.theme),o=p.useRef(n);o.current=n;const i=p.useRef(null);p.useEffect(()=>{if(void 0!==e)return;if("undefined"==typeof window||!window.matchMedia)return;const n=window.matchMedia("(forced-colors: active)");return n.matches&&(i.current=o.current===P?C:o.current,t("high-contrast")),Oi(n,e=>{var n,r;e.matches?(i.current=o.current===P?null!==(n=i.current)&&void 0!==n?n:C:o.current,t("high-contrast")):(function(e,t){e(t===C?"light":t===_?"dark":t===P?"high-contrast":t)}(t,null!==(r=i.current)&&void 0!==r?r:C),i.current=null)})},[e,t]);const r=p.useRef(!1);return Il(()=>{r.current?void 0!==e&&t(Fl(e)):r.current=!0},[e,t]),null}function Wl({children:t}){var n,o,i,r,s;const a=R(e=>e.theme),l=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({position:"relative","--semiotic-bg":a.colors.background,"--semiotic-text":a.colors.text,"--semiotic-text-secondary":a.colors.textSecondary,"--semiotic-grid":a.colors.grid,"--semiotic-border":a.colors.border,"--semiotic-cell-border":a.colors.cellBorder||a.colors.border,"--semiotic-primary":a.colors.primary,"--semiotic-font-family":a.typography.fontFamily},a.colors.focus?{"--semiotic-focus":a.colors.focus}:{}),(null===(n=a.tooltip)||void 0===n?void 0:n.background)?{"--semiotic-tooltip-bg":a.tooltip.background}:{}),(null===(o=a.tooltip)||void 0===o?void 0:o.text)?{"--semiotic-tooltip-text":a.tooltip.text}:{}),(null===(i=a.tooltip)||void 0===i?void 0:i.borderRadius)?{"--semiotic-tooltip-radius":a.tooltip.borderRadius}:{}),(null===(r=a.tooltip)||void 0===r?void 0:r.fontSize)?{"--semiotic-tooltip-font-size":a.tooltip.fontSize}:{}),(null===(s=a.tooltip)||void 0===s?void 0:s.shadow)?{"--semiotic-tooltip-shadow":a.tooltip.shadow}:{}),a.borderRadius?{"--semiotic-border-radius":a.borderRadius}:{}),a.colors.selection?{"--semiotic-selection-color":a.colors.selection}:{}),null!=a.colors.selectionOpacity?{"--semiotic-selection-opacity":a.colors.selectionOpacity+""}:{}),a.colors.diverging?{"--semiotic-diverging":a.colors.diverging}:{}),a.colors.annotation?{"--semiotic-annotation-color":a.colors.annotation}:{}),null!=a.typography.legendSize?{"--semiotic-legend-font-size":a.typography.legendSize+"px"}:{}),null!=a.typography.titleFontSize?{"--semiotic-title-font-size":a.typography.titleFontSize+"px"}:{}),null!=a.typography.tickFontFamily?{"--semiotic-tick-font-family":a.typography.tickFontFamily}:{}),null!=a.typography.tickSize?{"--semiotic-tick-font-size":a.typography.tickSize+"px"}:{}),null!=a.typography.labelSize?{"--semiotic-axis-label-font-size":a.typography.labelSize+"px"}:{}),{"--semiotic-secondary":a.colors.secondary||a.colors.primary,"--semiotic-surface":a.colors.surface||a.colors.background}),a.colors.success?{"--semiotic-success":a.colors.success}:{}),a.colors.danger?{"--semiotic-danger":a.colors.danger}:{}),a.colors.warning?{"--semiotic-warning":a.colors.warning}:{}),a.colors.error?{"--semiotic-error":a.colors.error}:{}),a.colors.info?{"--semiotic-info":a.colors.info}:{}),c=p.useContext(Dl),u={};return c&&(u["data-semiotic-theme"]=c),e.jsx("div",Object.assign({style:l},u,{children:t}))}function zl(){return R(e=>e.theme)}const Yl="#007bff";function Gl(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 ql(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 Xl(e){if(!e)return!1;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function Vl(){var e;const t=zl(),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 Ul(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=be[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]:Yl}function Ql(e,n,o){const i=cl(),r=Vl();return t.useMemo(()=>{var t;if(!n)return;const s=null!=i?i:void 0,a=null!==(t=null!=o?o:r&&r.length>0?r:void 0)&&void 0!==t?t:"category10";if(0!==e.length){if("function"==typeof n){const t=Array.from(new Set(e.map(e=>n(e)+"")));if(s&&Xl(s)){const e=Se(t.map(e=>({_cat:e})),"_cat",a);return t=>s[t]||e(t)}return Se(t.map(e=>({_cat:e})),"_cat",a)}if(s&&Xl(s)){const t=Se(e,n,a);return e=>s[e]||t(e)}return Se(e,n,a)}if(s&&Xl(s)){const e=Se([{_:"a"}],"_",a);return t=>s[t]||e(t)}},[e,n,o,i,r])}function Kl(e,n,o){return t.useMemo(()=>{if(!n||"auto"===n||"function"==typeof n)return e;const t=[...e],i=function(e){return"function"==typeof e?e:t=>t[e]}(o);return t.sort("asc"===n?(e,t)=>i(e)-i(t):(e,t)=>i(t)-i(e))},[e,n,o])}function Zl({selection:e,linkedHover:n,fallbackFields:o=[],unwrapData:i=!1,onObservation:r,chartType:s,chartId:a,onClick:l,hoverHighlight:c,colorByField:u}){const d=t.useId(),h=function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField,seriesField:e.seriesField}:null}(n,o),g="series"===(null==h?void 0:h.mode)?[h.seriesField||u||o[0]].filter(e=>!!e):(null==h?void 0:h.fields)||o||[],f=vl({name:(null==e?void 0:e.name)||"__unused__"}),p=bl({name:(null==h?void 0:h.name)||"hover",fields:g}),y=ml(e=>e.pushObservation),m=e?{isActive:f.isActive,predicate:f.predicate}:null,[v,b]=t.useState(null),x=u||o[0],k=t.useMemo(()=>{if(!c||null==v||!x)return null;const e=v,t=x;return{isActive:!0,predicate:n=>{var o;return("string"==typeof n[t]?n[t]:(null!==(o=n[t])&&void 0!==o?o:"")+"")===e}}},[c,v,x]),w=t.useCallback(e=>{var t,o;if(n)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==h?void 0:h.mode)&&h.xField){const n=Gl(e,t,h.xField);null!=n&&function(e,t,n){const o=Qn.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(Qn={positions:new Map(Qn.positions).set(e,{xValue:t,sourceId:n})},Zn())}(h.name||"hover",n,d)}"x-position"!==(null==h?void 0:h.mode)&&p.onHover(t)}else"x-position"===(null==h?void 0:h.mode)&&Jn(h.name||"hover",d),"x-position"!==(null==h?void 0:h.mode)&&p.onHover(null);if(c&&x)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[x];b(null!=n?n+"":null)}else b(null);if(r||y){const n={timestamp:Date.now(),chartType:s||"unknown",chartId:a};if(e){const i=ql(e),s=Object.assign(Object.assign({},n),{type:"hover",datum:i||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(o=e.y)&&void 0!==o?o:0});r&&r(s),y&&y(s)}else{const e=Object.assign(Object.assign({},n),{type:"hover-end"});r&&r(e),y&&y(e)}}},[n,p,h,d,r,s,a,y,c,x]),A=t.useCallback(e=>{var t,n,o,i;if("x-position"===(null==h?void 0:h.mode)&&h.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=Gl(e,t,h.xField);null!=n&&function(e,t,n){const o=Qn.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(Qn.positions);return t.delete(e),Qn={positions:t},Zn(),!1}Qn={positions:new Map(Qn.positions).set(e,{xValue:t,sourceId:n,locked:!0})},Zn()}(h.name||"hover",n,d)}if(e&&l){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),l(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(r||y){const t={timestamp:Date.now(),chartType:s||"unknown",chartId:a};if(e){const n=ql(e),s=Object.assign(Object.assign({},t),{type:"click",datum:n||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(i=e.y)&&void 0!==i?i:0});r&&r(s),y&&y(s)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});r&&r(e),y&&y(e)}}},[l,r,y,s,a,h,d]);return t.useEffect(()=>{if("x-position"!==(null==h?void 0:h.mode))return;const e=h.name||"hover";return()=>{eo(e,d),Jn(e,d)}},[null==h?void 0:h.mode,null==h?void 0:h.name,d]),{activeSelectionHook:m,hoverSelectionHook:k,customHoverBehavior:w,customClickBehavior:A,crosshairSourceId:d}}function Jl(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 ec({data:e,colorBy:n,colorScale:o,showLegend:i,legendPosition:r="right",userMargin:s,defaults:a={top:50,bottom:60,left:70,right:40},categories:l}){const c=t.useContext(jl),u=null!==t.useContext(Sl),d=void 0!==i?i:!c&&!!n,h=!!n&&(d||u),g=t.useMemo(()=>{if(!h)return[];if(void 0!==l)return l;const t=new Set;for(const o of e){const e="function"==typeof n?n(o):o[n];null!=e&&t.add(e+"")}return Array.from(t)},[l,n,e,h]);_l(u&&n?g:[]);const f=t.useMemo(()=>{if(!d||!n)return;const t=Rl({data:e,colorBy:n,colorScale:o,getColor:je,categories:g});return 0!==t.legendGroups.reduce((e,t)=>e+t.items.length,0)?t:void 0},[d,n,e,o,g]),p=t.useMemo(()=>{const e="number"==typeof s?{top:s,bottom:s,left:s,right:s}:null!=s?s:{},t=t=>{const n=e[t];return"number"==typeof n?n:a[t]},n={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},o=t=>"number"==typeof e[t];return f&&("right"===r&&!o("right")&&110>n.right?n.right=110:"left"===r&&!o("left")&&110>n.left?n.left=110:"top"===r&&!o("top")&&50>n.top?n.top=50:"bottom"===r&&!o("bottom")&&80>n.bottom&&(n.bottom=80)),n},[a,s,f,r]);return{legend:f,margin:p,legendPosition:r}}function tc(e,n,o){const[i,r]=t.useState(null),[s,a]=t.useState(new Set),l=t.useMemo(()=>new Set,[]),c=t.useCallback(t=>{"highlight"===e&&r(t?t.label:null)},[e]),u=t.useCallback(t=>{"isolate"===e&&a(e=>{const n=new Set(e);return n.has(t.label)?n.delete(t.label):n.add(t.label),n.size===o.length?new Set:n})},[e,o.length]),d=t.useMemo(()=>{if(!e||"none"===e||!n)return null;const t="string"==typeof n?n:null;return"highlight"===e&&null!=i?{isActive:!0,predicate:e=>(t?e[t]:"function"==typeof n?n(e):null)===i}:"isolate"===e&&s.size>0?{isActive:!0,predicate:e=>{const o=t?e[t]:"function"==typeof n?n(e):null;return s.has(o)}}:null},[e,n,i,s]);return{highlightedCategory:"highlight"===e?i:null,isolatedCategories:"isolate"===e?s:l,onLegendHover:c,onLegendClick:u,legendSelectionHook:d}}const nc={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 oc(e,t,n){var o,i,r,s,a,l,c;const u=nc[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!==(s=t.showGrid)&&void 0!==s?s:u.showGrid,enableHover:null!==(a=t.enableHover)&&void 0!==a?a:!!t.linkedHover||u.enableHover,showLegend:null!==(l=t.showLegend)&&void 0!==l?l:u.showLegend,showLabels:null!==(c=t.showLabels)&&void 0!==c?c:u.showLabels,title:d?void 0:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:d?void 0:t.xLabel,yLabel:d?void 0:t.yLabel,categoryLabel:d?void 0:t.categoryLabel,valueLabel:d?void 0:t.valueLabel,marginDefaults:ic(u.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:d}}function ic(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 rc({componentName:t,message:n,diagnosticHint:o,width:i,height:r}){return e.jsx("div",{role:"alert",style:{width:i,height:Math.max(r,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:e.jsxs("div",{style:{textAlign:"center",maxWidth:400},children:[e.jsx("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:t}),e.jsx("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:n}),o&&e.jsx("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:o})]})})}class sc extends p.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.jsx(rc,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}var ac;const lc="undefined"!=typeof process&&"production"!==(null===(ac=process.env)||void 0===ac?void 0:ac.NODE_ENV);function cc({componentName:t,width:n,height:o,children:i}){return e.jsx(sc,{fallback:i=>e.jsx(rc,{componentName:t,message:i.message,width:n,height:o}),children:i})}const uc={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"},dc={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function hc(t,n,o,i){return!1===i||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e.jsx("div",{style:Object.assign(Object.assign({},uc),{width:n,height:o}),children:i||"No data available"}):null}function gc(t,n,o,i){if(!t)return null;if(!1===i)return null;if(null!=i)return e.jsx("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)),s=Math.max(8,Math.floor(o/(3*r))),a=Math.max(6,Math.floor(o/(2.5*r))),l=Math.floor((o-(r*(s+a)-a))/2);return e.jsx("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.jsx("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},dc),{position:"absolute",top:l+o*(s+a),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:s,opacity:.5+o%2*.2})},o))})}function fc(e,t,n,o){if(!lc)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 pc(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 s=1;o>=s;s++){const o=i[s];i[s]=e[r-1]===t[s-1]?n:1+Math.min(n,i[s],i[s-1]),n=o}}return i[o]}function yc(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function mc(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=pc(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 vc({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)&&"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(n){const o=yc(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=mc(r,t),o=n?` Try ${i}="${n}".`:"";return`${e}: ${i} "${r}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}function bc({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 xc({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=yc(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=mc(i,t),r=n?` Try ${o}="${n}".`:"";return`${e}: ${o} "${i}" not found in node data. Available fields: ${t.join(", ")}.${r}`}}}return null}function kc(e){const n=R(e=>e.theme.colors.selectionOpacity);return t.useMemo(()=>{var t,o;if(void 0!==e||void 0!==n)return Object.assign(Object.assign({name:null!==(t=null==e?void 0:e.name)&&void 0!==t?t:""},e),{unselectedOpacity:null!==(o=null==e?void 0:e.unselectedOpacity)&&void 0!==o?o:n})},[e,n])}function wc(e){const{data:n,rawData:o,colorBy:i,colorScheme:r,legendInteraction:s,legendPosition:a,selection:l,linkedHover:c,fallbackFields:u,unwrapData:d=!1,onObservation:h,chartType:g,chartId:f,showLegend:p,userMargin:y,marginDefaults:m,onClick:v,hoverHighlight:b,loading:x,loadingContent:w,emptyContent:A,width:j,height:S}=e,O=void 0===o,M=t.useMemo(()=>k(n),[n]),[C,_]=t.useState([]),P=t.useCallback(e=>{_(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[]),L="string"==typeof e.colorBy?e.colorBy:void 0,{activeSelectionHook:T,hoverSelectionHook:R,customHoverBehavior:$,customClickBehavior:N,crosshairSourceId:E}=Zl({selection:l,linkedHover:c,fallbackFields:u,unwrapData:d,onObservation:h,chartType:g,chartId:f,onClick:v,hoverHighlight:b,colorByField:L}),B=Jl(c,E),D=Ql(M,i,r),I=t.useMemo(()=>{if(!i)return[];const e=new Set;for(const t of M){const n="function"==typeof i?i(t):t[i];null!=n&&e.add(n+"")}return Array.from(e)},[M,i]),F=t.useMemo(()=>O&&C.length>0?C:I,[O,C,I]),H=tc(s,i,F),W=t.useMemo(()=>R||(H.legendSelectionHook?H.legendSelectionHook:T),[R,H.legendSelectionHook,T]),z=kc(l),Y=Vl(),G=cl(),q=t.useMemo(()=>{if(D)return D;if(!i||0===F.length)return;const e=Array.isArray(r)&&r.length>0||"string"==typeof r&&r.length>0?r:Y&&Y.length>0?Y:ke,t="__streamCat",n=Se(F.map(e=>({[t]:e})),t,e);return e=>(null==G?void 0:G[e])||n(e)||"#999"},[D,i,F,r,Y,G]),{legend:X,margin:V,legendPosition:U}=ec({data:M,colorBy:i,colorScale:q,showLegend:p,legendPosition:a,userMargin:y,defaults:m,categories:F}),Q=t.useMemo(()=>{const e={};return X&&(e.legend=X,e.legendPosition=U),s&&"none"!==s&&(e.legendHoverBehavior=H.onLegendHover,e.legendClickBehavior=H.onLegendClick,e.legendHighlightedCategory=H.highlightedCategory,e.legendIsolatedCategories=H.isolatedCategories),O&&i&&(e.legendCategoryAccessor=i,e.onCategoriesChange=P),e},[X,U,s,H.onLegendHover,H.onLegendClick,H.highlightedCategory,H.isolatedCategories,O,i,P]),K=Array.isArray(o)?k(o):o,Z=gc(x,j,S,w),J=Z?null:hc(K,j,S,A);return{data:M,colorScale:D,allCategories:F,legendState:H,effectiveSelectionHook:W,activeSelectionHook:T,customHoverBehavior:$,customClickBehavior:N,legend:X,margin:V,legendPosition:U,earlyReturn:Z||J||null,legendBehaviorProps:Q,crosshairProps:B,resolvedSelection:z}}function Ac(e,n){const{variant:o,frameRef:i,overrides:r,deps:s}=n;t.useImperativeHandle(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,s;const a=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 a){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===(s=e.current)||void 0===s||s.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 s=null!==(i=null===(o=e.current)||void 0===o?void 0:o.removePoint(t))&&void 0!==i?i:[];for(const t of s)null===(r=e.current)||void 0===r||r.push(n(t));return s},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 s=null!==(i=null===(o=n.current)||void 0===o?void 0:o.removeLine(e))&&void 0!==i?i:[];for(const e of s)null===(r=n.current)||void 0===r||r.pushLine(t(e));return s},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:[]}}}(o,i);return Object.assign(Object.assign({},e),r)},null!=s?s:[])}function jc(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 Sc(e){const{colorBy:n,colorScale:o,color:i,pointRadius:r=5,radiusFn:s,fillOpacity:a=1,fallbackFill:l,baseStyleExtras:c,stroke:u,strokeWidth:d,opacity:h,effectiveSelectionHook:g,resolvedSelection:f,colorDatumAccessor:p}=e,y=t.useMemo(()=>e=>{const t="function"==typeof c?c(e):c,u=t?Object.assign({},t):{};if(void 0===u.fillOpacity&&(u.fillOpacity=a),void 0===u.fill)if(n){if(o){const t=p?p(e):e;u.fill=je(t,n,o)}}else u.fill=l?l(e):i||Yl;return void 0===u.r&&(u.r=s?s(e):r),u},[n,o,i,r,s,a,l,c,p]),m=t.useMemo(()=>jc(y,{stroke:u,strokeWidth:d,opacity:h}),[y,u,d,h]);return t.useMemo(()=>Nl(m,null!=g?g:null,f),[m,g,f])}function Oc(e){const{accessor:n,data:o,isPushMode:i}=e,r=t.useRef(null),[s,a]=t.useState(0),l=t.useCallback(e=>{if(!i||!n)return;let t=!1;for(const o of e){const e="function"==typeof n?n(o):o[n];if(null==e)continue;const i="number"==typeof e?e:Number(e);Number.isFinite(i)&&(r.current?(r.current[0]>i&&(r.current[0]=i,t=!0),i>r.current[1]&&(r.current[1]=i,t=!0)):(r.current=[i,i],t=!0))}t&&a(e=>e+1)},[i,n]),c=t.useCallback(()=>{i&&(r.current=null,a(e=>e+1))},[i]),u=t.useMemo(()=>{var e;if(i)return null!==(e=r.current)&&void 0!==e?e:void 0;if(!n||0===o.length)return;const t="function"==typeof n?n:e=>e[n];let s=1/0,a=-1/0;for(const e of o){const n=t(e);if(null==n)continue;const o="number"==typeof n?n:Number(n);Number.isFinite(o)&&(s>o&&(s=o),o>a&&(a=o))}return Number.isFinite(s)&&Number.isFinite(a)?[s,a]:void 0},[o,n,i,s]);return{domain:u,trackPushed:l,reset:c}}function Mc(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 Cc(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 _c(e,t,n,o){return new(n||(n=Promise))(function(i,r){function s(e){try{l(o.next(e))}catch(e){r(e)}}function a(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(s,a)}l((o=o.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const Pc="__forecastSegment";let Lc=null;function Tc(){return _c(this,void 0,void 0,function*(){return Lc||(Lc=yield Promise.resolve().then(function(){return Cg})),Lc})}const Rc="__semiotic_resolvedX",$c="__semiotic_resolvedY";function Nc(e){const{data:n,xAccessor:o,yAccessor:i,forecast:r,anomaly:s,groupBy:a}=e,l="string"==typeof o?o:Rc,c="string"==typeof i?i:$c,u=t.useMemo(()=>{if(!r&&!s)return n;const e="function"==typeof o,t="function"==typeof i;return e||t?n.map(n=>{const r=Object.assign({},n);return e&&(r[Rc]=o(n)),t&&(r[$c]=i(n)),r}):n},[n,r,s,o,i]),[d,h]=t.useState(null),[g,f]=t.useState([]),p=t.useRef(r),y=t.useRef(s);return t.useEffect(()=>{if(!r&&!s)return void((p.current||y.current)&&(h(null),f([]),p.current=r,y.current=s));let e=!1;const t=r!==p.current||s!==y.current;if(p.current=r,y.current=s,t&&(h(null),f([])),r){const t=a&&"string"==typeof a&&"object"==typeof r?Object.assign(Object.assign({},r),{_groupBy:a}):r;(function(...e){return _c(this,void 0,void 0,function*(){return(yield Tc()).buildForecast(...e)})})(u,l,c,t,s).then(t=>{e||(h(t),f(t.annotations))}).catch(()=>{e||(h(null),f([]))})}else s&&function(...e){return _c(this,void 0,void 0,function*(){return(yield Tc()).buildAnomalyAnnotations(...e)})}(s).then(t=>{e||(h(null),f(t))}).catch(()=>{e||f([])});return()=>{e=!0}},[u,r,s,l,c,a]),{effectiveData:d?d.processedData:n,statisticalAnnotations:g,hasForecast:!!d,xAccessorKey:l,yAccessorKey:c}}const Ec=t.forwardRef(function(n,o){const i=t.useRef(null),r=oc(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:s,margin:a,className:l,xFormat:c,yFormat:u,xAccessor:d="x",yAccessor:h="y",xScaleType:g,yScaleType:f,colorBy:y,colorScheme:m,sizeBy:v,sizeRange:b=[3,15],symbolBy:x,symbolMap:w,pointRadius:A=5,pointOpacity:j=.8,tooltip:S,marginalGraphics:O,pointIdAccessor:M,annotations:C,regression:_,forecast:P,anomaly:L,xExtent:T,yExtent:R,frameProps:$={},selection:N,linkedHover:E,linkedBrush:B,onObservation:D,onClick:I,hoverHighlight:F,chartId:H,loading:W,loadingContent:z,emptyContent:Y,legendInteraction:G,legendPosition:q,color:X,stroke:V,strokeWidth:U,opacity:Q}=n,{width:K,height:Z,enableHover:J,showGrid:ee,showLegend:te,title:ne,description:oe,summary:ie,accessibleTable:re,xLabel:se,yLabel:ae}=r,le=t.useMemo(()=>k(s),[s]),ce=void 0===s,{domain:ue,trackPushed:de,reset:he}=Oc({accessor:v,data:le,isPushMode:ce}),ge=t.useCallback(e=>{var t;de([e]),null===(t=i.current)||void 0===t||t.push(e)},[de]),fe=t.useCallback(e=>{var t;de(e),null===(t=i.current)||void 0===t||t.pushMany(e)},[de]);Ac(o,{variant:"xy",frameRef:i,overrides:{push:ge,pushMany:fe,clear:()=>{var e;he(),null===(e=i.current)||void 0===e||e.clear()}},deps:[ge,fe,he]});const pe=wc({data:le,rawData:s,colorBy:y,colorScheme:m,legendInteraction:G,legendPosition:q,selection:N,linkedHover:E,fallbackFields:y?["string"==typeof y?y:""]:[],unwrapData:!1,onObservation:D,onClick:I,hoverHighlight:F,chartType:"Scatterplot",chartId:H,showLegend:te,userMargin:a,marginDefaults:r.marginDefaults,loading:W,loadingContent:z,emptyContent:Y,width:K,height:Z}),ye=$l(B),me=kl({name:(null==ye?void 0:ye.name)||"__unused_brush__",xField:(null==ye?void 0:ye.xField)||("string"==typeof d?d:void 0),yField:(null==ye?void 0:ye.yField)||("string"==typeof h?h:void 0)}),ve=ye?"xyBrush"===me.brushInteraction.brush?"xy":"xBrush"===me.brushInteraction.brush?"x":"y":void 0,be=p.useRef(me.brushInteraction);be.current=me.brushInteraction;const xe=t.useCallback(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)},[]);fc("Scatterplot",le,"xAccessor",d),fc("Scatterplot",le,"yAccessor",h);const ke=t.useMemo(()=>v?null!=ue?ue:[0,1]:void 0,[v,ue]),we=t.useMemo(()=>v?e=>Oe(e,v,b,ke):void 0,[v,b,ke]),Ae=Sc({colorBy:y,colorScale:pe.colorScale,color:X,pointRadius:A,fillOpacity:j,radiusFn:we,stroke:V,strokeWidth:U,opacity:Q,effectiveSelectionHook:pe.effectiveSelectionHook,resolvedSelection:pe.resolvedSelection}),je=t.useMemo(()=>ss([{label:se||ts(d),accessor:d,role:"x",format:c},{label:ae||ts(h),accessor:h,role:"y",format:u},...y?[{label:ts(y),accessor:y,role:"color"}]:[],...v?[{label:ts(v),accessor:v,role:"size"}]:[]]),[d,h,se,ae,y,v,c,u]),{effectiveData:Se,statisticalAnnotations:Me}=Nc({data:le,xAccessor:d,yAccessor:h,forecast:P,anomaly:L}),Ce=t.useMemo(()=>{const e=Mc(_);return e||0!==Me.length?[...e?[e]:[],...C||[],...Me]:C},[_,C,Me]);if(pe.earlyReturn)return pe.earlyReturn;const _e=vc({componentName:"Scatterplot",data:s,accessors:{xAccessor:d,yAccessor:h}});if(_e)return e.jsx(rc,{componentName:"Scatterplot",message:_e,width:K,height:Z});const Pe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=s&&{data:Se}),{xAccessor:d,yAccessor:h,xScaleType:g,yScaleType:f,colorAccessor:y||void 0,sizeAccessor:v||void 0}),x&&{symbolAccessor:x}),w&&{symbolMap:w}),{sizeRange:b,pointStyle:Ae,colorScheme:m,size:[K,Z],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:pe.margin,showAxes:r.showAxes,xLabel:se,yLabel:ae,xFormat:c,yFormat:u,enableHover:J,showGrid:ee}),pe.legendBehaviorProps),il({title:ne,description:oe,summary:ie,accessibleTable:re,className:l,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),sl({tooltip:S,defaultTooltipContent:je})),rl({linkedHover:E,onObservation:D,onClick:I,hoverHighlight:F,customHoverBehavior:pe.customHoverBehavior,customClickBehavior:pe.customClickBehavior})),O&&{marginalGraphics:O}),M&&{pointIdAccessor:M}),Ce&&Ce.length>0&&{annotations:Ce}),T&&{xExtent:T}),R&&{yExtent:R}),ye&&{brush:{dimension:ve},onBrush:xe}),pe.crosshairProps),$);return e.jsx(cc,{componentName:"Scatterplot",width:K,height:Z,children:e.jsx(hr,Object.assign({ref:i},Pe))})});function Bc(e,t){return ie(1===t?.5:e/(t-1))}Ec.displayName="Scatterplot";const Dc=t.forwardRef(function(n,o){var i,r;const s=t.useRef(null);Ac(o,{variant:"xy",frameRef:s});const a=oc(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel}),{data:l,margin:c,className:u,xFormat:d,yFormat:h,xAccessor:g="x",yAccessor:f="y",orderAccessor:p,orderLabel:y,pointRadius:m=4,tooltip:v,pointIdAccessor:b,annotations:x,regression:k,forecast:w,anomaly:A,xExtent:j,yExtent:S,frameProps:O={},selection:M,linkedHover:C,onObservation:_,onClick:P,hoverHighlight:L,chartId:T,loading:R,loadingContent:$,emptyContent:N,legendInteraction:E,stroke:B,strokeWidth:D,opacity:I}=n,{width:F,height:H,enableHover:W,showGrid:z,title:Y,description:G,summary:q,accessibleTable:X,xLabel:V,yLabel:U}=a,Q=l||[],{safeData:K,orderMap:Z}=t.useMemo(()=>{const e="function"==typeof g?g:e=>e[g],t="function"==typeof f?f:e=>e[f];let n=Q;if(p&&Q.length>0){const e="function"==typeof p?p:e=>e[p];n=[...Q].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 s of n){const n=e(s),a=t(s);null!=n&&null!=a&&isFinite(n)&&isFinite(a)&&o.set(s,{idx:r++,total:i})}return{safeData:n,orderMap:o}},[Q,p,g,f]);fc("ConnectedScatterplot",K,"xAccessor",g),fc("ConnectedScatterplot",K,"yAccessor",f);const J=wc({data:K,rawData:l,colorBy:void 0,colorScheme:void 0,legendInteraction:E,selection:M,linkedHover:C,fallbackFields:[],unwrapData:!1,onObservation:_,onClick:P,hoverHighlight:L,chartType:"ConnectedScatterplot",chartId:T,showLegend:void 0,userMargin:c,marginDefaults:{top:50,right:40,bottom:60,left:70},loading:R,loadingContent:$,emptyContent:N,width:F,height:H}),ee=null!==(r=null===(i=J.resolvedSelection)||void 0===i?void 0:i.unselectedOpacity)&&void 0!==r?r:.5,te=t.useMemo(()=>(e,t)=>{var n,o,i,r;const s=t.filter(e=>"point"===e.type);if(2>s.length)return;const a=null===(n=J.effectiveSelectionHook)||void 0===n?void 0:n.isActive,l=null===(o=J.effectiveSelectionHook)||void 0===o?void 0:o.predicate,c=100>s.length,u=s.length;e.lineCap="round";for(let t=0;u-1>t;t++){const n=s[t],o=s[t+1],d=Bc(t,u),h=!a||!l||l(null!==(i=n.datum)&&void 0!==i?i:n)||l(null!==(r=o.datum)&&void 0!==r?r:o),g=a?h?1:ee:1;c&&(e.beginPath(),e.moveTo(n.x,n.y),e.lineTo(o.x,o.y),e.strokeStyle="white",e.lineWidth=m+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=m,e.globalAlpha=g,e.stroke()}e.globalAlpha=1},[m,J.effectiveSelectionHook,ee]),ne=t.useMemo(()=>[te],[te]),oe=t.useMemo(()=>(t,n,o)=>{var i,r;const s=t.filter(e=>"point"===e.type);if(2>s.length)return null;const a=s.length,l=100>a,c=[];for(let t=0;a-1>t;t++){const n=s[t],o=s[t+1],u=Bc(t,a),d="number"==typeof(null===(i=n.style)||void 0===i?void 0:i.opacity)?n.style.opacity:1,h="number"==typeof(null===(r=o.style)||void 0===r?void 0:r.opacity)?o.style.opacity:1,g=Math.min(d,h);l&&c.push(e.jsx("line",{x1:n.x,y1:n.y,x2:o.x,y2:o.y,stroke:"white",strokeWidth:m+2,strokeLinecap:"round",opacity:.5*g},"halo-"+t)),c.push(e.jsx("line",{x1:n.x,y1:n.y,x2:o.x,y2:o.y,stroke:u,strokeWidth:m,strokeLinecap:"round",opacity:g},"seg-"+t))}return e.jsx(e.Fragment,{children:c})},[m]),ie=t.useMemo(()=>[oe],[oe]),re=t.useMemo(()=>e=>{var t,n;const o=Z.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?Bc(i,r):"#6366f1",stroke:"white",strokeWidth:1,r:m,fillOpacity:1}},[m,Z]),se=Sc({colorScale:void 0,baseStyleExtras:re,stroke:B,strokeWidth:D,opacity:I,effectiveSelectionHook:J.effectiveSelectionHook,resolvedSelection:J.resolvedSelection}),ae=y||("string"==typeof p?p:"Order"),le=t.useMemo(()=>ss([{label:V||ts(g),accessor:g,role:"x",format:d},{label:U||ts(f),accessor:f,role:"y",format:h},...p?[{label:ae,accessor:p,role:"group"}]:[]]),[g,f,V,U,p,ae,d,h]),ce=vc({componentName:"ConnectedScatterplot",data:l,accessors:{xAccessor:g,yAccessor:f}}),{effectiveData:ue,statisticalAnnotations:de}=Nc({data:K,xAccessor:g,yAccessor:f,forecast:w,anomaly:A});if(J.earlyReturn)return J.earlyReturn;const he=Mc(k),ge=he||de.length>0?[...he?[he]:[],...x||[],...de]:x,fe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=l&&{data:ue}),{xAccessor:g,yAccessor:f,pointStyle:se,size:[F,H],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:J.margin,showAxes:a.showAxes,xLabel:V,yLabel:U,xFormat:d,yFormat:h,enableHover:W,showGrid:z}),il({title:Y,description:G,summary:q,accessibleTable:X,className:u,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),sl({tooltip:v,defaultTooltipContent:le})),rl({linkedHover:C,onObservation:_,onClick:P,hoverHighlight:L,customHoverBehavior:J.customHoverBehavior,customClickBehavior:J.customClickBehavior})),b&&{pointIdAccessor:b}),{canvasPreRenderers:ne,svgPreRenderers:ie}),ge&&ge.length>0&&{annotations:ge}),j&&{xExtent:j}),S&&{yExtent:S}),J.crosshairProps),O);return ce?e.jsx(rc,{componentName:"ConnectedScatterplot",message:ce,width:F,height:H}):e.jsx(cc,{componentName:"ConnectedScatterplot",width:F,height:H,children:e.jsx(hr,Object.assign({ref:s},fe))})});function Ic(e){const{lineWidth:n=2,colorBy:o,colorScale:i,color:r,resolveStroke:s,fillArea:a,areaOpacity:l=.3,stroke:c,strokeWidth:u,opacity:d,effectiveSelectionHook:h,resolvedSelection:g}=e,f=t.useMemo(()=>(e,t)=>{const c={strokeWidth:n},u=!0===a||Array.isArray(a)&&null!=t&&a.includes(t);let d;return s?d=s(e,t):o?i&&(d=je(e,o,i)):d=r||Yl,void 0!==d&&(c.stroke=d,u&&(c.fill=d,c.fillOpacity=l)),c},[n,o,i,r,s,a,l]),p=t.useMemo(()=>jc(f,{stroke:c,strokeWidth:u,opacity:d}),[f,c,u,d]);return t.useMemo(()=>Nl(p,null!=h?h:null,g),[p,h,g])}Dc.displayName="ConnectedScatterplot";const Fc=t.forwardRef(function(n,o){var i,r;const s=t.useRef(null);Ac(o,{variant:"xy",frameRef:s});const a=oc(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,summary:n.summary,accessibleTable:n.accessibleTable,xLabel:n.xLabel,yLabel:n.yLabel}),{data:l,margin:c,className:u,xFormat:d,yFormat:h,axisExtent:g,xAccessor:f="x",yAccessor:p="y",lineBy:y,lineDataAccessor:m="coordinates",colorBy:v,colorScheme:b,curve:x="linear",showPoints:w=!1,pointRadius:A=3,fillArea:j=!1,areaOpacity:S=.3,lineWidth:O=2,lineGradient:M,tooltip:C,pointIdAccessor:_,annotations:P,directLabel:L,gapStrategy:T="break",anomaly:R,forecast:$,band:N,xExtent:E,yExtent:B,frameProps:D={},selection:I,linkedHover:F,onObservation:H,onClick:W,hoverHighlight:z,hoverRadius:Y,chartId:G,loading:q,loadingContent:X,emptyContent:V,legendInteraction:U,legendPosition:Q,xScaleType:K,yScaleType:Z,color:J,stroke:ee,strokeWidth:te,opacity:ne}=n,{width:oe,height:ie,enableHover:re,showGrid:se,showLegend:ae,title:le,description:ce,summary:ue,accessibleTable:de,xLabel:he,yLabel:ge}=a,fe=t.useMemo(()=>k(l),[l]);fc("LineChart",fe,"xAccessor",f),fc("LineChart",fe,"yAccessor",p);const{effectiveData:pe,statisticalAnnotations:ye}=Nc({data:fe,xAccessor:f,yAccessor:p,forecast:$,anomaly:R,groupBy:y}),me="__compoundGroup",ve=!(!$||!y),be=ve?me:$?Pc:y,xe=t.useMemo(()=>{if(!ve)return pe;const e="function"==typeof y?y:e=>e[y];return pe.map(t=>{const n=Object.assign({},t);return n[me]=`${e(t)}__${t[Pc]||"observed"}`,n})},[pe,ve,y]),ke=ve?xe:pe,we=v||y,Ae=t.useMemo(()=>{if(!$)return;const e=$.upperBounds,t=$.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 s=pe;for(const e of s){const t="function"==typeof p?p(e):+e[p];if(isFinite(t)&&(i>t&&(i=t),t>r&&(r=t)),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},[$,pe,p]),Se=t.useCallback(e=>{const t="function"==typeof f?f(e):e[f],n="function"==typeof p?p(e):e[p];return null==t||null==n||Number.isNaN(t)||Number.isNaN(n)},[f,p]),Oe=void 0!==(null===(i=ke[0])||void 0===i?void 0:i[m]),Me=t.useMemo(()=>{if(Oe)return ke;if(be){const e=ke.reduce((e,t)=>{const n="function"==typeof be?be(t):t[be];if(!e[n]){const o={[m]:[]};"string"==typeof be&&(o[be]=n),ve&&(o[Pc]=t[Pc],"string"==typeof y&&(o[y]=t[y])),e[n]=o}return e[n][m].push(t),e},{});return Object.values(e)}return[{[m]:ke}]},[ke,be,m,Oe]),{gapProcessedLineData:Ce,hasGaps:_e}=t.useMemo(()=>{if("interpolate"===T){let e=!1;const t=[];for(const n of Me){const o=(n[m]||[]).filter(t=>!Se(t)||(e=!0,!1));o.length>0&&t.push(Object.assign(Object.assign({},n),{[m]:o}))}return{gapProcessedLineData:t,hasGaps:e}}if("break"===T){let e=!1;const t=[];for(const n of Me){const o=n[m]||[];let i=[],r=0;const s=be&&"string"==typeof be?n[be]:void 0;for(const a of o)if(Se(a))e=!0,i.length>0&&(t.push(Object.assign(Object.assign({},n),{[m]:i})),i=[],r++);else{const e=null!=s?`${s}__seg${r}`:"__seg"+r;i.push(Object.assign(Object.assign({},a),{_gapSegment:e}))}i.length>0&&t.push(Object.assign(Object.assign({},n),{[m]:i}))}return{gapProcessedLineData:t,hasGaps:e}}if("zero"===T){let e=!1;const t="string"==typeof p?p:"y",n=[];for(const o of Me){const i=o[m]||[],r=[];for(const n of i)Se(n)?(e=!0,r.push(Object.assign(Object.assign({},n),{[t]:0}))):r.push(n);n.push(Object.assign(Object.assign({},o),{[m]:r}))}return{gapProcessedLineData:n,hasGaps:e}}return{gapProcessedLineData:Me,hasGaps:!1}},[Me,T,m,Se,be,p]),Pe="object"==typeof L?L:{},Le=Pe.position||"end",Te=Pe.fontSize||11,Re=t.useMemo(()=>{var e;if(!L||!we)return[];const t="function"==typeof we?we:e=>e[we],n=new Set;for(const o of Ce){const i=o[m]||[];if(0===i.length)continue;const r=null!==(e=t("end"===Le?i[i.length-1]:i[0]))&&void 0!==e?e:t(o);if(null==r)continue;const s=r+"";""!==s&&n.add(s)}return Array.from(n)},[L,we,Ce,m,Le]),$e=t.useMemo(()=>{if(!L)return a.marginDefaults;const e=Re.reduce((e,t)=>Math.max(e,t.length*(.6*Te)),0)+10,t="end"===Le?"right":"left";return Object.assign(Object.assign({},a.marginDefaults),{[t]:Math.max(a.marginDefaults[t]||0,e)})},[L,Re,Te,Le,a.marginDefaults]),Ne=wc({data:pe,rawData:l,colorBy:we,colorScheme:b,legendInteraction:U,legendPosition:Q,selection:I,linkedHover:F,fallbackFields:we?["string"==typeof we?we:""]:[],unwrapData:!1,onObservation:H,onClick:W,hoverHighlight:z,chartType:"LineChart",chartId:G,showLegend:(!L||void 0!==ae)&&ae,userMargin:c,marginDefaults:$e,loading:q,loadingContent:X,emptyContent:V,width:oe,height:ie}),Ee=Ne.colorScale,Be=Ne.customHoverBehavior,De=Ne.customClickBehavior,Ie=Ne.crosshairProps,Fe=Ic({lineWidth:O,colorBy:we,colorScale:Ee,color:J,fillArea:j,areaOpacity:S,stroke:ee,strokeWidth:te,opacity:ne,effectiveSelectionHook:Ne.effectiveSelectionHook,resolvedSelection:Ne.resolvedSelection}),[He,We]=t.useState(null);t.useEffect(()=>{if(!$)return void We(null);let e=!1;return function(...e){return _c(this,void 0,void 0,function*(){return(yield Tc()).createSegmentLineStyle(...e)})}(Fe,$).then(t=>{e||We(()=>t)}).catch(()=>{e||We(null)}),()=>{e=!0}},[Fe,$]);const ze=He||Fe,Ye=t.useMemo(()=>{if(w)return e=>{const t={r:A,fillOpacity:1};return we?Ee&&(t.fill=je(e.parentLine||e,we,Ee)):t.fill=J||Yl,t}},[w,A,we,Ee,J]),Ge=Array.isArray(j)?"mixed":j?"area":"line",qe=t.useMemo(()=>{var e;if(!L||!we)return[];const t="function"==typeof f?f:e=>e[f],n="function"==typeof p?p:e=>e[p],o="function"==typeof we?we:e=>e[we],i=new Map;for(const t of Ce){const n=t[m]||[];if(0===n.length)continue;const r="end"===Le?n[n.length-1]:n[0],s=null!==(e=o(r))&&void 0!==e?e:o(t);if(null==s)continue;const a=s+"";""===a||i.has(a)||i.set(a,r)}const r=Array.from(i.entries()).map(([e,o])=>({type:"text",label:e,["string"==typeof f?f:"x"]:t(o),["string"==typeof p?p:"y"]:n(o),dx:"end"===Le?6:-6,dy:0,color:Ee?Ee(e):Yl,fontSize:Te}));r.sort((e,t)=>{const n="string"==typeof p?p:"y";return e[n]-t[n]});for(let e=1;r.length>e;e++){const t="string"==typeof p?p:"y",n=r[e-1],o=r[e];Te+2>Math.abs(o[t]+o.dy-(n[t]+n.dy))&&(o.dy+=Te+2)}return r},[L,we,Ee,Ce,m,f,p,Le,Te]),Xe=Ne.margin,Ve=y||v,Ue=t.useMemo(()=>ss([{label:he||ts(f),accessor:f,role:"x",format:d},{label:ge||ts(p),accessor:p,role:"y",format:h},...Ve?[{label:ts(Ve),accessor:Ve,role:"group"}]:[],...rs(N,h)]),[f,p,he,ge,Ve,d,h,N]),Qe=vc({componentName:"LineChart",data:Oe?(null===(r=pe[0])||void 0===r?void 0:r[m])||[]:l,accessors:{xAccessor:f,yAccessor:p}}),Ke=t.useMemo(()=>Oe||be||_e?Ce.flatMap(e=>{const t=e[m]||[];return be&&"string"==typeof be?t.map(t=>Object.assign(Object.assign({},t),{[be]:e[be]})):t}):ke,[Ce,m,Oe,be,ke,_e]),Ze=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:Ge},Array.isArray(j)&&{areaGroups:j}),M&&{lineGradient:M}),null!=Y&&{hoverRadius:Y}),null!=l&&{data:Ke}),{xAccessor:f,yAccessor:p,xScaleType:K,yScaleType:Z}),E&&{xExtent:E}),!B||null==B[0]&&null==B[1]?Ae?{yExtent:Ae}:{}:{yExtent:B}),{groupAccessor:"break"===T&&_e?"_gapSegment":be||void 0}),N&&{band:N}),{curve:x,lineStyle:ze}),w&&{pointStyle:Ye}),{size:[oe,ie],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:Xe,showAxes:a.showAxes,xLabel:he,yLabel:ge,xFormat:d,yFormat:h}),void 0!==g&&{axisExtent:g}),void 0!==n.autoPlaceAnnotations&&{autoPlaceAnnotations:n.autoPlaceAnnotations}),{enableHover:re,showGrid:se}),Ne.legendBehaviorProps),le&&{title:le}),ce&&{description:ce}),ue&&{summary:ue}),void 0!==de&&{accessibleTable:de}),u&&{className:u}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===C?()=>null:"multi"===C?Ai():ji(C)||Ue}),"multi"===C&&{tooltipMode:"multi"}),(F||H||W||z)&&{customHoverBehavior:Be}),(H||W||F)&&{customClickBehavior:De}),_&&{pointIdAccessor:_}),((null==P?void 0:P.length)||ye.length||qe.length)&&{annotations:[...P||[],...ye,...qe]}),Ie),D);return Ne.earlyReturn?Ne.earlyReturn:Qe?e.jsx(rc,{componentName:"LineChart",message:Qe,width:oe,height:ie}):e.jsx(cc,{componentName:"LineChart",width:oe,height:ie,children:e.jsx(hr,Object.assign({ref:s},Ze))})});function Hc(e){var n;const{safeData:o,data:i,areaBy:r,lineDataAccessor:s,colorBy:a,colorScale:l,color:c,stroke:u,strokeWidth:d,opacity:h,effectiveSelectionHook:g,resolvedSelection:f,areaOpacity:p,showLine:y,lineWidth:m,showPoints:v,pointRadius:b,xAccessor:x,yAccessor:k,xLabel:w,yLabel:A,xFormat:j,yFormat:S,groupField:O}=e,M=void 0!==(null===(n=o[0])||void 0===n?void 0:n[s]),C=t.useMemo(()=>{if(null==i)return[];if(!M&&!r)return o;let e;if(M)e=o;else{const t=r,n=o.reduce((e,n)=>{const o="function"==typeof t?t(n):n[t];if(!e[o]){const n={[s]:[]};"string"==typeof t&&(n[t]=o),e[o]=n}return e[o][s].push(n),e},{});e=Object.values(n)}return e.flatMap(e=>{const t=e[s]||[];return r&&"string"==typeof r?t.map(t=>Object.assign(Object.assign({},t),{[r]:e[r]})):t})},[i,o,r,s,M]),_=t.useMemo(()=>e=>{const t={};if(a){if(l){const n=je(e,a,l);t.fill=n,y?(t.stroke=n,t.strokeWidth=m):t.stroke="none"}}else{const e=c||Yl;t.fill=e,y?(t.stroke=e,t.strokeWidth=m):t.stroke="none"}return t.fillOpacity=p,t},[a,l,c,p,y,m]),P=t.useMemo(()=>jc(_,{stroke:u,strokeWidth:d,opacity:h}),[_,u,d,h]);return{flattenedData:C,lineStyle:t.useMemo(()=>Nl(P,null!=g?g:null,f),[P,g,f]),pointStyle:t.useMemo(()=>{if(v)return e=>{const t={r:b,fillOpacity:1};return a?l&&(t.fill=je(e.parentLine||e,a,l)):t.fill=c||Yl,t}},[v,b,a,l,c]),defaultTooltipContent:t.useMemo(()=>ss([{label:w||ts(x),accessor:x,role:"x",format:j},{label:A||ts(k),accessor:k,role:"y",format:S},...O?[{label:ts(O),accessor:O,role:"group"}]:[],...rs(e.band,S)]),[x,k,w,A,O,j,S,e.band])}}function Wc(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}Fc.displayName="LineChart";const zc=t.forwardRef(function(n,o){const i=t.useRef(null);Ac(o,{variant:"xy",frameRef:i});const r=oc(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:s,margin:a,className:l,xFormat:c,yFormat:u,xAccessor:d="x",yAccessor:h="y",areaBy:g,y0Accessor:f,gradientFill:p=!1,semanticGradient:y,lineDataAccessor:m="coordinates",colorBy:v,colorScheme:b,curve:x="monotoneX",areaOpacity:w=.7,lineGradient:A,showLine:j=!0,lineWidth:S=2,showPoints:O=!1,pointRadius:M=3,tooltip:C,annotations:_,forecast:P,anomaly:L,band:T,xExtent:R,yExtent:$,frameProps:N={},selection:E,linkedHover:B,onObservation:D,onClick:I,hoverHighlight:F,chartId:H,loading:W,loadingContent:z,emptyContent:Y,legendInteraction:G,legendPosition:q,color:X,stroke:V,strokeWidth:U,opacity:Q}=n,{width:K,height:Z,enableHover:J,showGrid:ee,showLegend:te,title:ne,description:oe,summary:ie,accessibleTable:re,xLabel:se,yLabel:ae}=r,le=t.useMemo(()=>k(s),[s]),ce=v||g,ue=t.useMemo(()=>{return y&&y.length>0?{colorStops:(e=y,e.filter(e=>Number.isFinite(e.at)).map(e=>({offset:1-Math.max(0,Math.min(100,e.at))/100,color:Wc(e.color,e.opacity)})).sort((e,t)=>e.offset-t.offset))}:p;var e},[y,p]);fc("AreaChart",le,"xAccessor",d),fc("AreaChart",le,"yAccessor",h);const de=wc({data:le,rawData:s,colorBy:ce,colorScheme:b,legendInteraction:G,legendPosition:q,selection:E,linkedHover:B,fallbackFields:ce?["string"==typeof ce?ce:""]:[],unwrapData:!1,onObservation:D,onClick:I,hoverHighlight:F,chartType:"AreaChart",chartId:H,showLegend:te,userMargin:a,marginDefaults:r.marginDefaults,loading:W,loadingContent:z,emptyContent:Y,width:K,height:Z}),{effectiveData:he,statisticalAnnotations:ge}=Nc({data:le,xAccessor:d,yAccessor:h,forecast:P,anomaly:L,groupBy:g}),{flattenedData:fe,lineStyle:pe,pointStyle:ye,defaultTooltipContent:me}=Hc({safeData:he,data:s,areaBy:g,lineDataAccessor:m,colorBy:ce,colorScale:de.colorScale,color:X,stroke:V,strokeWidth:U,opacity:Q,effectiveSelectionHook:de.effectiveSelectionHook,resolvedSelection:de.resolvedSelection,areaOpacity:w,showLine:j,lineWidth:S,showPoints:O,pointRadius:M,xAccessor:d,yAccessor:h,xLabel:se,yLabel:ae,xFormat:c,yFormat:u,groupField:g||v,band:T}),ve=vc({componentName:"AreaChart",data:s,accessors:{xAccessor:d,yAccessor:h}}),be=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"area"},null!=s&&{data:fe}),{xAccessor:d,yAccessor:h,groupAccessor:g||void 0}),f&&{y0Accessor:f}),T&&{band:T}),ue&&{gradientFill:ue}),A&&{lineGradient:A}),{curve:x,lineStyle:pe}),O&&ye&&{pointStyle:ye}),{size:[K,Z],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:de.margin,showAxes:r.showAxes,xLabel:se,yLabel:ae,xFormat:c,yFormat:u,enableHover:J}),n.pointIdAccessor&&{pointIdAccessor:n.pointIdAccessor}),{showGrid:ee}),de.legendBehaviorProps),il({title:ne,description:oe,summary:ie,accessibleTable:re,className:l,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),"multi"===C?{tooltipContent:Ai(),tooltipMode:"multi"}:sl({tooltip:C,defaultTooltipContent:me})),rl({linkedHover:B,onObservation:D,onClick:I,hoverHighlight:F,customHoverBehavior:de.customHoverBehavior,customClickBehavior:de.customClickBehavior})),(_&&_.length>0||ge.length>0)&&{annotations:[..._||[],...ge]}),R&&{xExtent:R}),$&&{yExtent:$}),de.crosshairProps),N);return de.earlyReturn?de.earlyReturn:ve?e.jsx(rc,{componentName:"AreaChart",message:ve,width:K,height:Z}):e.jsx(cc,{componentName:"AreaChart",width:K,height:Z,children:e.jsx(hr,Object.assign({ref:i},be))})});function Yc(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}zc.displayName="AreaChart";const Gc=t.forwardRef(function(n,o){const i=t.useRef(null),r=oc(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:s,margin:a,className:l,xFormat:c,yFormat:u,xAccessor:d="x",seriesAAccessor:h="a",seriesBAccessor:g="b",seriesALabel:f="A",seriesBLabel:p="B",seriesAColor:y="var(--semiotic-danger, #dc2626)",seriesBColor:m="var(--semiotic-info, #2563eb)",showLines:v=!0,lineWidth:b=1.5,showPoints:x=!1,pointRadius:w=3,curve:A="linear",areaOpacity:j=.6,gradientFill:S,tooltip:O,annotations:M,xExtent:C,yExtent:_,frameProps:P={},selection:L,linkedHover:T,onObservation:R,onClick:$,hoverHighlight:N,chartId:E,loading:B,loadingContent:D,emptyContent:I,legendInteraction:F,legendPosition:H,pointIdAccessor:W,windowSize:z}=n,{width:Y,height:G,enableHover:q,showGrid:X,showLegend:V,title:U,description:Q,summary:K,accessibleTable:Z,xLabel:J,yLabel:ee}=r,te=t.useMemo(()=>"function"==typeof d?e=>Yc(d(e)):e=>Yc(e[d]),[d]),ne=t.useMemo(()=>"function"==typeof h?e=>Yc(h(e)):e=>Yc(e[h]),[h]),oe=t.useMemo(()=>"function"==typeof g?e=>Yc(g(e)):e=>Yc(e[g]),[g]),[ie,re]=t.useState([]),se=t.useRef([]),ae=null==s,le=t.useMemo(()=>k(ae?ie:s),[ae,ie,s]),ce=t.useMemo(()=>function(e,t,n,o){if(!e.length)return[];const i=e.filter(e=>Number.isFinite(t(e))).sort((e,n)=>t(e)-t(n)),r=[];let s=0,a=null,l=null,c=[];const u=(e,t)=>e>t?"A":t>e?"B":null,d=e=>`seg-${s}-${e}`,h=e=>r.push(e),g=(e,t)=>{h({__x:e.x,__y:e.y,__y0:e.y,__diffSegment:d(t),__diffWinner:t,__valA:e.y,__valB:e.y,__sourceDatum:e.datum})};for(let e=0;i.length>e;e++){const r=i[e],f=t(r),p=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!=a){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(a),__diffWinner:a,__valA:t,__valB:t}),s++,a=m,h({__x:e,__y:t,__y0:t,__diffSegment:d(a),__diffWinner:a,__valA:t,__valB:t});for(let e=1;c.length>e;e++)g(c[e],a)}else for(const e of c)g(e,a);c=[],h({__x:f,__y:y>p?y:p,__y0:y>p?p:y,__diffSegment:d(a),__diffWinner:a,__valA:p,__valB:y,__sourceDatum:r}),l={x:f,a:p,b:y,w:m}}else{a=m;for(const e of c)g(e,a);c=[],h({__x:f,__y:y>p?y:p,__y0:y>p?p:y,__diffSegment:d(a),__diffWinner:a,__valA:p,__valB:y,__sourceDatum:r}),l={x:f,a:p,b:y,w:m}}else c.push({x:f,y:p,datum:r})}for(const e of c)g(e,null!=a?a:"A");return r}(le,te,ne,oe),[le,te,ne,oe]),ue=t.useMemo(()=>v?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),s=n(e),a=o(e);Number.isFinite(s)&&r.push({__x:i,__y:s,__diffSegment:"line-A"}),Number.isFinite(a)&&r.push({__x:i,__y:a,__diffSegment:"line-B"})}return r}(le,te,ne,oe):[],[v,le,te,ne,oe]),de=t.useMemo(()=>[...ce,...ue],[ce,ue]),he=t.useMemo(()=>{const e=new Set;for(const t of ce)e.add(t.__diffSegment);return Array.from(e)},[ce]);t.useImperativeHandle(o,()=>{const e=e=>{const t=z&&e.length>z?e.slice(e.length-z):e;se.current=t,re(t)},t=W?"function"==typeof W?W:e=>e[W]:null;return{push:t=>e([...se.current,t]),pushMany:t=>e([...se.current,...t]),remove:n=>{if(!t)return[];const o=Array.isArray(n)?n:[n],i=[],r=[];for(const e of se.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=[],s=se.current.map(e=>{if(i.includes(t(e))){const t=o(e);return r.push(t),t}return e});return e(s),r},clear:()=>e([]),getData:()=>ae?se.current:le,getScales:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}},[ae,le,W,z]);const ge=wc({data:le,rawData:s,colorBy:"__diffWinner",colorScheme:[y,m],legendInteraction:F,legendPosition:H,selection:L,linkedHover:T,fallbackFields:["__diffWinner"],unwrapData:!1,onObservation:R,onClick:$,hoverHighlight:N,chartType:"DifferenceChart",chartId:E,showLegend:V,userMargin:a,marginDefaults:r.marginDefaults,loading:B,loadingContent:D,emptyContent:I,width:Y,height:G}),fe=t.useMemo(()=>{if(!1!==V)return{legendGroups:[{label:"",type:"fill",styleFn:e=>({fill:e.color||"currentColor"}),items:[{label:f,color:y},{label:p,color:m}]}]}},[V,f,p,y,m]),pe=t.useCallback(e=>{const t=e.__diffSegment;return{fill:"A"==((null==t?void 0:t.endsWith("-A"))?"A":"B")?y:m,stroke:"none",fillOpacity:j}},[y,m,j]),ye=t.useCallback(e=>({stroke:"A"==("line-A"===e.__diffSegment?"A":"B")?y:m,strokeWidth:b,fill:"none"}),[y,m,b]),me=t.useCallback(e=>({fill:"A"==("line-A"===e.__diffSegment?"A":"B")?y:m,r:w}),[y,m,w]),ve=t.useCallback(t=>{var n;const o=t.data,i=t.allSeries,r=null!==(n=t.xValue)&&void 0!==n?n:null==o?void 0:o.__x;let s=null==o?void 0:o.__valA,a=null==o?void 0:o.__valB;if(i&&i.length>0){const e=i.find(e=>"line-A"===e.group),t=i.find(e=>"line-B"===e.group);null!=(null==e?void 0:e.value)&&Number.isFinite(e.value)&&(s=e.value),null!=(null==t?void 0:t.value)&&Number.isFinite(t.value)&&(a=t.value)}if(null!=r&&(null==s||null==a)){const e=le.find(e=>te(e)===r);e&&(null==s&&(s=ne(e)),null==a&&(a=oe(e)))}const l=e=>null!=e&&Number.isFinite(e)?""+Math.round(100*e)/100:"—",u=c&&null!=r?c(r):null!=r?r+"":"";return e.jsxs("div",{className:"semiotic-tooltip",style:bi,children:[u&&e.jsx("div",{style:{fontWeight:600,marginBottom:4},children:u}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{style:{width:10,height:10,background:y,display:"inline-block",borderRadius:2}}),e.jsxs("span",{children:[f,": ",l(s)]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{style:{width:10,height:10,background:m,display:"inline-block",borderRadius:2}}),e.jsxs("span",{children:[p,": ",l(a)]})]}),null!=s&&null!=a&&Number.isFinite(s)&&Number.isFinite(a)&&e.jsxs("div",{style:{marginTop:4,opacity:.7},children:["Δ = ",l(s-a)]})]})},[le,te,ne,oe,c,y,m,f,p]),be="multi"===O,xe=t.useMemo(()=>!1===O?()=>null:be?ve:ji(O)||ve,[O,be,ve]);if(ge.earlyReturn)return ge.earlyReturn;const ke=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"mixed",data:de,xAccessor:"__x",yAccessor:"__y",y0Accessor:"__y0",groupAccessor:"__diffSegment",areaGroups:he,curve:A,areaStyle:pe,lineStyle:ye},x&&{pointStyle:me}),{size:[Y,G],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ge.margin,showAxes:r.showAxes,xLabel:J,yLabel:ee,xFormat:c,yFormat:u,enableHover:q,showGrid:X}),S&&{gradientFill:!0===S?{topOpacity:.85,bottomOpacity:.15}:S}),fe&&{legend:fe,legendPosition:ge.legendPosition}),il({title:U,description:Q,summary:K,accessibleTable:Z,className:l,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),{tooltipContent:xe}),be&&{tooltipMode:"multi"}),rl({linkedHover:T,onObservation:R,onClick:$,hoverHighlight:N,customHoverBehavior:ge.customHoverBehavior,customClickBehavior:ge.customClickBehavior})),M&&M.length>0&&{annotations:M}),C&&{xExtent:C}),_&&{yExtent:_}),ge.crosshairProps),P);return e.jsx(cc,{componentName:"DifferenceChart",width:Y,height:G,children:e.jsx(hr,Object.assign({ref:i},ke))})});"function"==typeof Gc&&(Gc.displayName="DifferenceChart");const qc=t.forwardRef(function(n,o){const i=t.useRef(null),r=oc(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:s,margin:a,className:l,xFormat:c,yFormat:u,xAccessor:d="x",yAccessor:h="y",areaBy:g,lineDataAccessor:f="coordinates",colorBy:p,colorScheme:y,curve:m="monotoneX",areaOpacity:v=.7,showLine:b=!0,lineWidth:x=2,showPoints:w=!1,pointRadius:A=3,normalize:j=!1,baseline:S="zero",stackOrder:O,tooltip:M,annotations:C,xExtent:_,yExtent:P,frameProps:L={},selection:T,linkedHover:R,onObservation:$,onClick:N,hoverHighlight:E,chartId:B,loading:D,loadingContent:I,emptyContent:F,legendInteraction:H,legendPosition:W,color:z,stroke:Y,strokeWidth:G,opacity:q}=n,{width:X,height:V,enableHover:U,showGrid:Q,showLegend:K,title:Z,description:J,summary:ee,accessibleTable:te,xLabel:ne,yLabel:oe}=r,ie=t.useMemo(()=>k(s),[s]),re=p||g;Ac(o,{variant:"xy",frameRef:i});const se=wc({data:ie,rawData:s,colorBy:re,colorScheme:y,legendInteraction:H,legendPosition:W,selection:T,linkedHover:R,fallbackFields:re?["string"==typeof re?re:""]:[],unwrapData:!1,onObservation:$,onClick:N,hoverHighlight:E,chartType:"StackedAreaChart",chartId:B,showLegend:K,userMargin:a,marginDefaults:r.marginDefaults,loading:D,loadingContent:I,emptyContent:F,width:X,height:V}),{flattenedData:ae,lineStyle:le,pointStyle:ce,defaultTooltipContent:ue}=Hc({safeData:ie,data:s,areaBy:g,lineDataAccessor:f,colorBy:re,colorScale:se.colorScale,color:z,stroke:Y,strokeWidth:G,opacity:q,effectiveSelectionHook:se.effectiveSelectionHook,resolvedSelection:se.resolvedSelection,areaOpacity:v,showLine:b,lineWidth:x,showPoints:w,pointRadius:A,xAccessor:d,yAccessor:h,xLabel:ne,yLabel:oe,xFormat:c,yFormat:u,groupField:g||p}),de=vc({componentName:"StackedAreaChart",data:s,accessors:{xAccessor:d,yAccessor:h}}),he=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"stackedarea"},null!=s&&{data:ae}),{xAccessor:d,yAccessor:h,groupAccessor:g||void 0,curve:m,normalize:j,baseline:j?"zero":S,stackOrder:O,lineStyle:le}),w&&ce&&{pointStyle:ce}),{size:[X,V],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:se.margin,showAxes:r.showAxes,xLabel:ne,yLabel:oe,xFormat:c,yFormat:u,enableHover:U}),n.pointIdAccessor&&{pointIdAccessor:n.pointIdAccessor}),{showGrid:Q}),se.legendBehaviorProps),il({title:Z,description:J,summary:ee,accessibleTable:te,className:l,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),"multi"===M?{tooltipContent:Ai(),tooltipMode:"multi"}:sl({tooltip:M,defaultTooltipContent:ue})),rl({linkedHover:R,onObservation:$,onClick:N,hoverHighlight:E,customHoverBehavior:se.customHoverBehavior,customClickBehavior:se.customClickBehavior})),C&&C.length>0&&{annotations:C}),_&&{xExtent:_}),P&&{yExtent:P}),se.crosshairProps),L);return se.earlyReturn?se.earlyReturn:de?e.jsx(rc,{componentName:"StackedAreaChart",message:de,width:X,height:V}):e.jsx(cc,{componentName:"StackedAreaChart",width:X,height:V,children:e.jsx(hr,Object.assign({ref:i},he))})});qc.displayName="StackedAreaChart";const Xc=t.forwardRef(function(n,o){var r;const s=t.useRef(null);Ac(o,{variant:"xy",frameRef:s});const a=oc(n.mode,{width:n.width,height:n.height,showGrid:void 0,enableHover:n.enableHover,showLegend:void 0,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel}),{data:l,margin:c,className:u,xAccessor:d="x",yAccessor:h="y",valueAccessor:g="value",xFormat:f,yFormat:p,colorScheme:y,customColorScale:m,showValues:v=!1,valueFormat:b,tooltip:x,annotations:w,xExtent:A,yExtent:j,frameProps:S={},selection:O,linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,chartId:L,loading:T,loadingContent:R,emptyContent:$,showLegend:N,legendPosition:E,legendInteraction:B}=n,{width:D,height:I,enableHover:F,title:H,description:W,summary:z,accessibleTable:Y,xLabel:G,yLabel:q}=a,X=gc(T,D,I,R),V=X?null:hc(l,D,I,$),U=t.useMemo(()=>k(l),[l]),Q=function(){var e;const t=zl();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.sequential)||void 0}(),K=null!==(r=null!=y?y:Q)&&void 0!==r?r:"blues",Z=null!=N&&N,J=null!=E?E:"right",{margin:ee}=ec({data:U,colorBy:Z?"value":void 0,colorScale:void 0,showLegend:Z,legendPosition:J,userMargin:c,defaults:a.marginDefaults}),{customHoverBehavior:te,customClickBehavior:ne,crosshairSourceId:oe}=Zl({selection:O,linkedHover:M,fallbackFields:[],onObservation:C,onClick:_,chartType:"Heatmap",chartId:L,hoverHighlight:P,colorByField:void 0});kc(O);const ie=Jl(M,oe);tc(B,void 0,[]);const re=t.useMemo(()=>"function"==typeof g?e=>g(e):e=>e[g],[g]),se=t.useMemo(()=>rn(U.map(re)),[U,re]),ae=t.useMemo(()=>{if("custom"===K&&m)return m;const e=de(K);return i.scaleSequential(e).domain(se)},[K,m,se]),le=t.useMemo(()=>ss([{label:G||ts(d),accessor:d,role:"x",format:f},{label:q||ts(h),accessor:h,role:"y",format:p},{label:ts(g),accessor:g,role:"value",format:b}]),[d,h,G,q,g,f,p,b]),ce=vc({componentName:"Heatmap",data:l,accessors:{xAccessor:d,yAccessor:h,valueAccessor:g}}),ue=t.useMemo(()=>{if(Z)return{gradient:{colorFn:e=>ae(e),domain:se,label:"string"==typeof g?g:"value",format:b}}},[Z,ae,se,g,b]),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({chartType:"heatmap"},null!=l&&{data:U}),{xAccessor:d,yAccessor:h,valueAccessor:g,colorScheme:"custom"!==K?K:void 0,showValues:v,heatmapValueFormat:b,size:[D,I],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ee,showAxes:a.showAxes,xLabel:G,yLabel:q,xFormat:f,yFormat:p,enableHover:F}),n.pointIdAccessor&&{pointIdAccessor:n.pointIdAccessor}),ue&&{legend:ue,legendPosition:J}),il({title:H,description:W,summary:z,accessibleTable:Y,className:u,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),sl({tooltip:x,defaultTooltipContent:le})),rl({linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,customHoverBehavior:te,customClickBehavior:ne})),w&&w.length>0&&{annotations:w}),A&&{xExtent:A}),j&&{yExtent:j}),ie),S);return X||V||(ce?e.jsx(rc,{componentName:"Heatmap",message:ce,width:D,height:I}):e.jsx(cc,{componentName:"Heatmap",width:D,height:I,children:e.jsx(hr,Object.assign({ref:s},he))}))});Xc.displayName="Heatmap";const Vc=t.forwardRef(function(n,o){const i=t.useRef(null),r=oc(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:s,margin:a,className:l,xFormat:c,yFormat:u,xAccessor:d="x",yAccessor:h="y",sizeBy:g,sizeRange:f=[5,40],colorBy:p,colorScheme:y,bubbleOpacity:m=.6,bubbleStrokeWidth:v=1,bubbleStrokeColor:b="white",tooltip:x,marginalGraphics:w,pointIdAccessor:A,annotations:j,regression:S,xExtent:O,yExtent:M,frameProps:C={},selection:_,linkedHover:P,linkedBrush:L,onObservation:T,onClick:R,hoverHighlight:$,chartId:N,loading:E,loadingContent:B,emptyContent:D,legendInteraction:I,legendPosition:F,color:H,stroke:W,strokeWidth:z,opacity:Y}=n,{width:G,height:q,enableHover:X,showGrid:V,showLegend:U,title:Q,description:K,summary:Z,accessibleTable:J,xLabel:ee,yLabel:te}=r,ne=t.useMemo(()=>k(s),[s]),oe=void 0===s,ie=wc({data:ne,rawData:s,colorBy:p,colorScheme:y,legendInteraction:I,legendPosition:F,selection:_,linkedHover:P,fallbackFields:p?["string"==typeof p?p:""]:[],unwrapData:!1,onObservation:T,onClick:R,hoverHighlight:$,chartType:"BubbleChart",chartId:N,showLegend:U,userMargin:a,marginDefaults:r.marginDefaults,loading:E,loadingContent:B,emptyContent:D,width:G,height:q}),{domain:re,trackPushed:se,reset:ae}=Oc({accessor:g,data:ne,isPushMode:oe}),le=t.useCallback(e=>{var t;se([e]),null===(t=i.current)||void 0===t||t.push(e)},[se]),ce=t.useCallback(e=>{var t;se(e),null===(t=i.current)||void 0===t||t.pushMany(e)},[se]);Ac(o,{variant:"xy",frameRef:i,overrides:{push:le,pushMany:ce,clear:()=>{var e;ae(),null===(e=i.current)||void 0===e||e.clear()}},deps:[le,ce,ae]});const ue=$l(L);kl({name:(null==ue?void 0:ue.name)||"__unused_brush__",xField:(null==ue?void 0:ue.xField)||("string"==typeof d?d:void 0),yField:(null==ue?void 0:ue.yField)||("string"==typeof h?h:void 0)});const de=t.useMemo(()=>({stroke:b,strokeWidth:v}),[b,v]),he=t.useMemo(()=>null!=re?re:[0,1],[re]),ge=t.useCallback(e=>Oe(e,g,f,he),[g,f,he]),fe=Sc({colorBy:p,colorScale:ie.colorScale,color:H,fillOpacity:m,radiusFn:ge,baseStyleExtras:de,stroke:W,strokeWidth:z,opacity:Y,effectiveSelectionHook:ie.effectiveSelectionHook,resolvedSelection:ie.resolvedSelection}),pe=t.useMemo(()=>ss([{label:ee||ts(d),accessor:d,role:"x",format:c},{label:te||ts(h),accessor:h,role:"y",format:u},{label:ts(g),accessor:g,role:"size"},...p?[{label:ts(p),accessor:p,role:"color"}]:[]]),[d,h,ee,te,g,p,c,u]);if(ie.earlyReturn)return ie.earlyReturn;const ye=vc({componentName:"BubbleChart",data:s,accessors:{xAccessor:d,yAccessor:h},requiredProps:{sizeBy:g}});if(ye)return e.jsx(rc,{componentName:"BubbleChart",message:ye,width:G,height:q});const me=Mc(S),ve=me?[me,...j||[]]:j,be=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bubble"},null!=s&&{data:ne}),{xAccessor:d,yAccessor:h,colorAccessor:p||void 0,sizeAccessor:g,sizeRange:f,pointStyle:fe,colorScheme:y,size:[G,q],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ie.margin,showAxes:r.showAxes,xLabel:ee,yLabel:te,xFormat:c,yFormat:u,enableHover:X,showGrid:V}),ie.legendBehaviorProps),il({title:Q,description:K,summary:Z,accessibleTable:J,className:l,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),sl({tooltip:x,defaultTooltipContent:pe})),rl({linkedHover:P,onObservation:T,onClick:R,hoverHighlight:$,customHoverBehavior:ie.customHoverBehavior,customClickBehavior:ie.customClickBehavior})),w&&{marginalGraphics:w}),A&&{pointIdAccessor:A}),ve&&ve.length>0&&{annotations:ve}),O&&{xExtent:O}),M&&{yExtent:M}),ie.crosshairProps),C);return e.jsx(cc,{componentName:"BubbleChart",width:G,height:q,children:e.jsx(hr,Object.assign({ref:i},be))})});Vc.displayName="BubbleChart";const Uc="__splomIdx",Qc={top:4,bottom:4,left:4,right:4};function Kc({frameRef:i,cellSize:r,onBrush:s}){const a=t.useRef(null),l=r-Qc.left-Qc.right,c=r-Qc.top-Qc.bottom;return t.useEffect(()=>{if(!a.current)return;const e=n.select(a.current).select(".brush-g"),t=o.brush().extent([[0,0],[l,c]]).on("brush end",e=>{var t;const n=null===(t=i.current)||void 0===t?void 0:t.getScales();if(!n)return;if(!e.selection)return void s(null);const[[o,r],[a,l]]=e.selection,c=[[n.x.invert(o),n.y.invert(r)],[n.x.invert(a),n.y.invert(l)]];s(c)});return e.call(t),e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null)}},[l,c,i,s]),e.jsx("svg",{ref:a,width:r,height:r,style:{position:"absolute",top:0,left:0},children:e.jsx("g",{className:"brush-g",transform:`translate(${Qc.left},${Qc.top})`})})}function Zc({data:n,xField:o,yField:i,cellSize:r,pointRadius:s,pointOpacity:a,colorBy:l,colorScale:c,brushSelectionName:u,hoverSelectionName:d,unselectedOpacity:h,mode:g,onPointHover:f}){const p=t.useRef(null),y=vl({name:u,clientId:`splom-${o}-${i}`}),m=kl({name:u,xField:o,yField:i}),v=vl({name:d,clientId:"splom-hover-source"}),b=v.selectPoints,x=t.useCallback(e=>{e?m.brushInteraction.during(e):m.brushInteraction.end(null)},[m.brushInteraction]),k=t.useCallback(e=>{if(!e)return void(null==f||f(null));const t=e.data,n=null==t?void 0:t[Uc];void 0!==n&&(b({[Uc]:[n]}),null==f||f(t,e.x+Qc.left,e.y+Qc.top))},[b,f]),w=t.useCallback(e=>{const t={opacity:a,r:s};return t.fill=l?je(e,l,c):Yl,"hover"===g?v.isActive&&v.predicate(e)?(t.opacity=1,t.r=2.5*s,t.stroke="#333",t.strokeWidth=1.5):v.isActive&&(t.opacity=.6*a):y.isActive&&!y.predicate(e)&&(t.opacity=h),t},[l,c,a,s,g,y.isActive,y.predicate,v.isActive,v.predicate,h]);return e.jsxs("div",{style:{position:"relative",width:r,height:r},children:[e.jsx(hr,{ref:p,chartType:"scatter",data:n,size:[r,r],xAccessor:o,yAccessor:i,pointStyle:w,margin:Qc,showAxes:!1,enableHover:"hover"===g,customHoverBehavior:"hover"===g?k:void 0,tooltipContent:"hover"===g?()=>null:void 0}),"brush"===g&&e.jsx(Kc,{frameRef:p,cellSize:r,xField:o,yField:i,onBrush:x})]})}function Jc({data:n,field:o,label:i,cellSize:r,bins:s,colorBy:a,colorScale:l,brushSelectionName:c,hoverSelectionName:u,mode:d}){const h=vl({name:c,clientId:"splom-diag-"+o}),g=vl({name:u,clientId:`splom-diag-${o}-hover`}),f="hover"===d?g:h,p=f.isActive,y=f.predicate,m=t.useMemo(()=>{const e="string"==typeof a?a:null,t=[],i=new Set;for(const r of n){const n=r[o];if(null==n||isNaN(n)||t.push(Number(n)),e){const t=r[e];null!=t&&i.add(t+"")}}if(0===t.length)return{bars:[],selectedBars:[],categoryBars:[],selectedCategoryBars:[],max:0,categories:[]};const[l,c]=rn(t),u=(c-l)/s||1,d=Array.from(i),h=new Map(d.map((e,t)=>[e,t])),g=Array(s).fill(0),f=Array(s).fill(0),m=Array.from({length:s},()=>Array(d.length).fill(0)),v=Array.from({length:s},()=>Array(d.length).fill(0));for(const t of n){const n=t[o];if(null==n||isNaN(n))continue;const i=Math.min(Math.floor((n-l)/u),s-1);if(g[i]++,p&&!y(t)||f[i]++,e){const n=h.get(t[e]+"");void 0!==n&&(m[i][n]++,p&&!y(t)||v[i][n]++)}}const b=sn(g,1),x=m.map((e,t)=>{let n=0;return e.map((e,o)=>{const i=e/b*(r-24),a={x:t/s*r,w:r/s-1,h:i,y0:n,category:d[o]};return n+=i,a})}),k=v.map((e,t)=>{let n=0;return e.map((e,o)=>{const i=e/b*(r-24),a={x:t/s*r,w:r/s-1,h:i,y0:n,category:d[o]};return n+=i,a})});return{bars:g.map((e,t)=>({x:t/s*r,w:r/s-1,h:e/b*(r-24),count:e})),selectedBars:f.map((e,t)=>({x:t/s*r,w:r/s-1,h:e/b*(r-24),count:e})),categoryBars:x,selectedCategoryBars:k,max:b,categories:d}},[n,o,s,r,p,y,a]);return e.jsxs("svg",{width:r,height:r,style:{overflow:"hidden"},children:[e.jsx("text",{x:r/2,y:14,textAnchor:"middle",fontSize:11,fontWeight:"bold",fill:"#333",children:i}),m.categories.length>0?m.categoryBars.map((t,n)=>t.map((t,o)=>e.jsx("rect",{x:t.x,y:r-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:l?l(t.category):Yl,opacity:p?.3:.6},`bg-${n}-${o}`))):m.bars.map((t,n)=>e.jsx("rect",{x:t.x,y:r-t.h,width:Math.max(t.w,1),height:t.h,fill:Yl,opacity:p?.3:.6},"bg-"+n)),p&&(m.categories.length>0?m.selectedCategoryBars.map((t,n)=>t.map((t,o)=>e.jsx("rect",{x:t.x,y:r-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:l?l(t.category):Yl,opacity:.7},`sel-${n}-${o}`))):m.selectedBars.map((t,n)=>e.jsx("rect",{x:t.x,y:r-t.h,width:Math.max(t.w,1),height:t.h,fill:Yl,opacity:.7},"sel-"+n)))]})}function eu({label:t,cellSize:n}){return e.jsx("svg",{width:n,height:n,children:e.jsx("text",{x:n/2,y:n/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:12,fontWeight:"bold",fill:"#333",children:t})})}function tu(n){const{data:o,fields:i,fieldLabels:r={},colorBy:s,colorScheme:a,cellSize:l=150,cellGap:c=4,pointRadius:u=2,pointOpacity:d=.5,diagonal:h="histogram",histogramBins:g=20,brushMode:f="crossfilter",hoverMode:y=!0,unselectedOpacity:m=.1,showGrid:v=!1,tooltip:b,showLegend:x,idAccessor:k,className:w,onObservation:A,chartId:j}=n,S="splom",O="splom-hover",M=y?"hover":f?"brush":"hover",C=pl(e=>e.clearSelection),[_,P]=t.useState(null),L=t.useCallback(()=>{C(O),P(null)},[C,O]),T=t.useMemo(()=>(o||[]).map((e,t)=>void 0!==e[Uc]?e:Object.assign(Object.assign({},e),{[Uc]:t})),[o]),R=Ql(T,s,a),$=void 0!==x?x:!!s,N=t.useMemo(()=>{if(!$||!s)return null;const e="string"==typeof s?s:null;return e?Array.from(new Set(T.map(t=>t[e]).filter(e=>null!=e))).map(e=>({label:e+"",color:R?R(e+""):Yl})):null},[$,s,T,R]),E=t.useMemo(()=>({display:"grid",gridTemplateColumns:"40px "+i.map(()=>l+"px").join(" "),gridTemplateRows:i.map(()=>l+"px").join(" ")+" 40px",gap:c+"px",width:"fit-content"}),[i,l,c,40]);return e.jsxs("div",{className:w,style:{position:"relative"},children:[N&&e.jsx("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"},children:N.map(t=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[e.jsx("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",backgroundColor:t.color}}),e.jsx("span",{style:{fontSize:11},children:t.label})]},t.label))}),e.jsxs("div",{style:E,onMouseLeave:"hover"===M?L:void 0,children:[i.map((t,n)=>e.jsxs(p.Fragment,{children:[e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:11,fontWeight:"bold",color:"#333"},children:r[t]||t}),i.map((o,i)=>n===i?"label"===h?e.jsx(eu,{label:r[t]||t,cellSize:l},"diag-"+t):e.jsx(Jc,{data:T,field:t,label:r[t]||t,cellSize:l,bins:g,colorBy:s,colorScale:R,brushSelectionName:S,hoverSelectionName:O,unselectedOpacity:m,mode:M},"diag-"+t):e.jsx(Zc,{data:T,xField:o,yField:t,fieldLabels:r,cellSize:l,pointRadius:u,pointOpacity:d,colorBy:s,colorScale:R,brushSelectionName:S,hoverSelectionName:O,unselectedOpacity:m,showGrid:v,tooltip:b,mode:M,onPointHover:"hover"===M?(e,r,s)=>{e?(P({datum:e,xField:o,yField:t,colIndex:i,rowIndex:n,px:null!=r?r:0,py:null!=s?s:0}),A&&A({type:"hover",datum:e,x:null!=r?r:0,y:null!=s?s:0,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:j})):(P(null),A&&A({type:"hover-end",timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:j}))}:void 0},`cell-${t}-${o}`))]},"row-"+t)),e.jsx("div",{})," ",i.map(t=>e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:"bold",color:"#333"},children:r[t]||t},"col-label-"+t))]}),_&&"hover"===M&&(()=>{const t=_.datum,n=r[_.xField]||_.xField,o=r[_.yField]||_.yField,i=s?"function"==typeof s?s(t):t[s]:null,a=k?"function"==typeof k?k(t):t[k]:"Row "+t[Uc];return e.jsxs("div",{style:{position:"absolute",left:40+_.colIndex*(l+c)+_.px,top:_.rowIndex*(l+c)+_.py-8,transform:"translate(-50%, -100%)",color:"#333",background:"rgba(255,255,255,0.95)",border:"1px solid #ddd",borderRadius:3,padding:"4px 8px",fontSize:11,lineHeight:1.4,whiteSpace:"nowrap",pointerEvents:"none",zIndex:10},children:[e.jsx("div",{style:{fontWeight:"bold",marginBottom:2},children:a+""}),e.jsxs("div",{children:[n,": ",null!=t[_.xField]?Number(t[_.xField]).toFixed(1):"–"]}),e.jsxs("div",{children:[o,": ",null!=t[_.yField]?Number(t[_.yField]).toFixed(1):"–"]}),null!=i&&e.jsxs("div",{style:{opacity:.8},children:["string"==typeof s?s:"group",": ",i+""]})]})})()]})}function nu(t){const{brushMode:n="crossfilter",hoverMode:o=!0}=t,i={};return!o&&n&&(i.splom={resolution:n}),o&&(i["splom-hover"]={resolution:"union"}),e.jsx(Tl,{selections:i,children:e.jsx(tu,Object.assign({},t))})}function ou({width:i,height:r,margin:s,scales:a,brushDirection:l,extent:c,onBrush:u}){const d=t.useRef(null),h=t.useRef(null),g=t.useRef(!1),f=i+s.left+s.right,p=r+s.top+s.bottom;return t.useEffect(()=>{if(!d.current||!a)return;const e=n.select(d.current).select(".brush-group"),t="x"===l?o.brushX().extent([[0,0],[i,r]]):o.brushY().extent([[0,0],[i,r]]);return t.on("brush end",e=>{if(g.current)return;if(!e.sourceEvent)return;const t=e.selection;if(!t)return void u(null);const n=("x"===l?a.x:a.y).invert;if(!n)return;const o=[n(t[0]),n(t[1])];u(o)}),e.call(t),h.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.2).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null)}},[a,i,r,l,u]),t.useEffect(()=>{if(!h.current||!a||!d.current)return;const e=n.select(d.current).select(".brush-group"),t="x"===l?a.x:a.y;if(g.current=!0,c){const n=[t(c[0]),t(c[1])];e.call(h.current.move,n)}else e.call(h.current.move,null);g.current=!1},[c,a,l]),e.jsx("svg",{ref:d,width:f,height:p,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:e.jsx("g",{className:"brush-group",transform:`translate(${s.left},${s.top})`})})}function iu(n){var o,i;const{data:r,width:s=600,height:a=400,margin:l,className:c,title:u,description:d,summary:h,xLabel:g,yLabel:f,xFormat:p,yFormat:y,xAccessor:m="x",yAccessor:v="y",lineBy:b,lineDataAccessor:x="coordinates",colorBy:w,colorScheme:A,curve:j="linear",lineWidth:S=2,fillArea:O=!1,areaOpacity:M=.3,showPoints:C=!1,pointRadius:_=3,enableHover:P=!0,showGrid:L=!1,showLegend:T,legendPosition:R,tooltip:$,minimap:N={},renderBefore:E=!1,onBrush:B,brushExtent:D,yExtent:I,frameProps:F={},loading:H,loadingContent:W,emptyContent:z}=n,Y=gc(H,s,a,W),G=Y?null:hc(r,s,a,z),q=t.useMemo(()=>k(r),[r]),[X,V]=t.useState(null),U=null!=D?D:X,Q=t.useCallback(e=>{D||V(e),null==B||B(e)},[D,B]),K=t.useRef(null),[Z,J]=t.useState(null);t.useEffect(()=>{let e=0,t=!1;const n=()=>{var o,i;if(t)return;const r=null===(i=null===(o=K.current)||void 0===o?void 0:o.getScales)||void 0===i?void 0:i.call(o);r?J(r):e=requestAnimationFrame(n)};return e=requestAnimationFrame(n),()=>{t=!0,e&&cancelAnimationFrame(e)}},[r]);const ee=void 0!==(null===(o=q[0])||void 0===o?void 0:o[x]),te=t.useMemo(()=>{if(ee)return q;if(b){const e=q.reduce((e,t)=>{const n="function"==typeof b?b(t):t[b];if(!e[n]){const t={[x]:[]};"string"==typeof b&&(t[b]=n),e[n]=t}return e[n][x].push(t),e},{});return Object.values(e)}return[{[x]:q}]},[q,b,x,ee]),ne=t.useMemo(()=>ee||b?te.flatMap(e=>{const t=e[x]||[];return b&&"string"==typeof b?t.map(t=>Object.assign(Object.assign({},t),{[b]:e[b]})):t}):q,[te,x,ee,b,q]),oe=Ql(q,w,A),ie=Ic({lineWidth:S,colorBy:w,colorScale:oe,fillArea:O,areaOpacity:M}),re=t.useMemo(()=>{if(N.lineStyle)return N.lineStyle},[N.lineStyle]),se=Ic({lineWidth:1,colorBy:w,colorScale:oe}),ae=null!=re?re:se,le=t.useMemo(()=>{if(C)return e=>{const t={r:_,fillOpacity:1};return t.fill=w?je(e.parentLine||e,w,oe):Yl,t}},[C,_,w,oe]),{legend:ce,margin:ue,legendPosition:de}=ec({data:te,colorBy:w,colorScale:oe,showLegend:T,legendPosition:R,userMargin:l}),he=N.height||60,ge=t.useMemo(()=>{var e,t,n,o,i,r,s,a;return{top:null!==(t=null===(e=N.margin)||void 0===e?void 0:e.top)&&void 0!==t?t:0,bottom:null!==(o=null===(n=N.margin)||void 0===n?void 0:n.bottom)&&void 0!==o?o:20,left:null!==(r=null===(i=N.margin)||void 0===i?void 0:i.left)&&void 0!==r?r:ue.left,right:null!==(a=null===(s=N.margin)||void 0===s?void 0:s.right)&&void 0!==a?a:ue.right}},[N.margin,ue]),fe=N.brushDirection||"x",pe=t.useMemo(()=>ss([{label:g||ts(m),accessor:m,role:"x",format:p},{label:f||ts(v),accessor:v,role:"y",format:y}]),[m,v,g,f,p,y]),ye=vc({componentName:"MinimapChart",data:r,accessors:{xAccessor:m,yAccessor:v}});if(ye)return e.jsx(rc,{componentName:"MinimapChart",message:ye,width:s,height:a});const me=O?"area":"line",ve=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:me,data:ne,xAccessor:m,yAccessor:v,groupAccessor:b||void 0,curve:j,lineStyle:ie},C&&{pointStyle:le}),{size:[s,a],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ue,showAxes:!0,xLabel:g,yLabel:f,xFormat:p,yFormat:y,enableHover:P,showGrid:L}),ce&&{legend:ce,legendPosition:de}),u&&{title:u}),d&&{description:d}),h&&{summary:h}),{tooltipContent:!1===$?()=>null:ji($)||pe}),U&&{xExtent:U}),I&&{yExtent:I}),void 0!==n.axisExtent&&{axisExtent:n.axisExtent}),void 0!==n.autoPlaceAnnotations&&{autoPlaceAnnotations:n.autoPlaceAnnotations}),F),be=Object.assign({chartType:me,data:ne,xAccessor:m,yAccessor:v,groupAccessor:b||void 0,curve:j,lineStyle:ae,size:[s,he+ge.top+ge.bottom],margin:ge,showAxes:null!==(i=N.showAxes)&&void 0!==i&&i,background:N.background,enableHover:!1},I&&{yExtent:I}),xe=e.jsxs("div",{style:{position:"relative",width:s,overflow:"hidden"},children:[e.jsx(hr,Object.assign({ref:K},be)),e.jsx(ou,{width:s-ge.left-ge.right,height:he,margin:ge,scales:Z,brushDirection:fe,extent:U,onBrush:Q})]},"minimap"),ke=e.jsx("div",{style:{overflow:"hidden"},children:e.jsx(hr,Object.assign({},ve))},"main");return Y||G||e.jsx(cc,{componentName:"MinimapChart",width:s,height:a,children:e.jsxs("div",{className:"minimap-chart"+(c?" "+c:""),children:[E?xe:ke,E?ke:xe]})})}nu.displayName="ScatterplotMatrix",iu.displayName="MinimapChart";const ru={label:"Low / High",color:"#E9C46A",opacity:.08},su={label:"High / High",color:"#2A9D8F",opacity:.08},au={label:"Low / Low",color:"#E76F51",opacity:.08},lu={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 uu=t.forwardRef(function(n,o){const i=t.useRef(null);Ac(o,{variant:"xy",frameRef:i});const r=oc(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:s,margin:a,className:l,xFormat:c,yFormat:u,xAccessor:d="x",yAccessor:h="y",xCenter:g,yCenter:f,quadrants:p,centerlineStyle:y={},showQuadrantLabels:m=!0,quadrantLabelSize:v=12,colorBy:b,colorScheme:x,sizeBy:w,sizeRange:A=[3,15],pointRadius:j=5,pointOpacity:S=.8,tooltip:O,pointIdAccessor:M,annotations:C,frameProps:_={},selection:P,linkedHover:L,onObservation:T,onClick:R,hoverHighlight:$,chartId:N,loading:E,loadingContent:B,emptyContent:D,legendInteraction:I,legendPosition:F,color:H,stroke:W,strokeWidth:z,opacity:Y}=n,{width:G,height:q,enableHover:X,showGrid:V,showLegend:U,title:Q,description:K,summary:Z,accessibleTable:J,xLabel:ee,yLabel:te}=r,ne=t.useMemo(()=>({topLeft:cu(ru,null==p?void 0:p.topLeft),topRight:cu(su,null==p?void 0:p.topRight),bottomLeft:cu(au,null==p?void 0:p.bottomLeft),bottomRight:cu(lu,null==p?void 0:p.bottomRight)}),[p]),oe=t.useMemo(()=>k(s),[s]),ie=wc({data:oe,rawData:s,colorBy:b,colorScheme:x,legendInteraction:I,legendPosition:F,selection:P,linkedHover:L,fallbackFields:"string"==typeof b?[b]:[],unwrapData:!1,onObservation:T,onClick:R,hoverHighlight:$,chartType:"QuadrantChart",chartId:N,showLegend:U,userMargin:a,marginDefaults:r.marginDefaults,loading:E,loadingContent:B,emptyContent:D,width:G,height:q});fc("QuadrantChart",oe,"xAccessor",d),fc("QuadrantChart",oe,"yAccessor",h);const re=t.useMemo(()=>{if(!oe.length)return;const e="function"==typeof d?d:e=>+e[d],t="function"==typeof h?h:e=>+e[h];let n=1/0,o=-1/0,i=1/0,r=-1/0;for(const s of oe){const a=e(s),l=t(s);isFinite(a)&&(n>a&&(n=a),a>o&&(o=a)),isFinite(l)&&(i>l&&(i=l),l>r&&(r=l))}if(null!=g&&isFinite(g)&&(n>g&&(n=g),g>o&&(o=g)),null!=f&&isFinite(f)&&(i>f&&(i=f),f>r&&(r=f)),n===1/0)return;const s=.1*(o-n)||1,a=.1*(r-i)||1;return{xExtent:[n-s,o+s],yExtent:[i-a,r+a]}},[oe,d,h,g,f]),se=t.useMemo(()=>{if(!w||0===oe.length)return;const e=oe.map(e=>"function"==typeof w?w(e):e[w]).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0!==e.length?rn(e):void 0},[oe,w]),ae=t.useMemo(()=>"function"==typeof d?d:e=>+e[d],[d]),le=t.useMemo(()=>"function"==typeof h?h:e=>+e[h],[h]),ce=t.useMemo(()=>e=>{const t=ae(e),n=le(e),o=null!=g?t>=g:void 0,i=null!=f?n>=f:void 0;return void 0===i||void 0===o?H||Yl:i&&o?ne.topRight.color:i&&!o?ne.topLeft.color:!i&&o?ne.bottomRight.color:ne.bottomLeft.color},[ae,le,g,f,ne,H]),ue=t.useMemo(()=>w?e=>Oe(e,w,A,se):void 0,[w,A,se]),de=Sc({colorBy:b,colorScale:ie.colorScale,color:H,pointRadius:j,fillOpacity:S,radiusFn:ue,fallbackFill:ce,stroke:W,strokeWidth:z,opacity:Y,effectiveSelectionHook:ie.effectiveSelectionHook,resolvedSelection:ie.resolvedSelection}),he=t.useMemo(()=>{if(!oe.length)return;const e=new Set;"string"==typeof d&&e.add(d),"string"==typeof h&&e.add(h),"string"==typeof b&&e.add(b),"string"==typeof w&&e.add(w);const t=oe[0];for(const n of Object.keys(t))if(!n.startsWith("_")&&!e.has(n)&&"string"==typeof t[n])return n},[oe,d,h,b,w]),ge=t.useMemo(()=>ss([...he?[{label:he,accessor:he,role:"title"}]:[],{label:ee||ts(d),accessor:d,role:"x",format:c},{label:te||ts(h),accessor:h,role:"y",format:u},...b?[{label:ts(b),accessor:b,role:"color"}]:[],...w?[{label:ts(w),accessor:w,role:"size"}]:[]]),[he,d,h,ee,te,b,w,c,u]),fe=vc({componentName:"QuadrantChart",data:s,accessors:{xAccessor:d,yAccessor:h}}),pe=t.useMemo(()=>{var e;const t={stroke:y.stroke||"#999",strokeWidth:null!==(e=y.strokeWidth)&&void 0!==e?e:1,dashArray:y.strokeDasharray||[]};return[(e,n,o,i)=>{var r;if(!(null==o?void 0:o.x)||!(null==o?void 0:o.y))return;const s=i.width,a=i.height,l=null!=g?o.x(g):s/2,c=null!=f?o.y(f):a/2;if(null!=g&&!isFinite(l))return;if(null!=f&&!isFinite(c))return;const u=Math.max(0,Math.min(s,l)),d=Math.max(0,Math.min(a,c)),h=[{config:ne.topLeft,x:0,y:0,w:u,h:d},{config:ne.topRight,x:u,y:0,w:s-u,h:d},{config:ne.bottomLeft,x:0,y:d,w:u,h:a-d},{config:ne.bottomRight,x:u,y:d,w:s-u,h:a-d}];for(const t of h)t.w>0&&t.h>0&&(e.fillStyle=t.config.color,e.globalAlpha=null!==(r=t.config.opacity)&&void 0!==r?r:.08,e.fillRect(t.x,t.y,t.w,t.h));e.globalAlpha=1,e.strokeStyle=t.stroke,e.lineWidth=t.strokeWidth,t.dashArray.length>0&&e.setLineDash(t.dashArray),e.beginPath(),e.moveTo(u,0),e.lineTo(u,a),e.stroke(),e.beginPath(),e.moveTo(0,d),e.lineTo(s,d),e.stroke(),e.setLineDash([])}]},[g,f,ne,y]),ye=t.useMemo(()=>m?[...pe,(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,s=null!=g?n.x(g):i/2,a=null!=f?n.y(f):r/2;(null==g||isFinite(s))&&(null==f||isFinite(a))&&(e.font=`600 ${v}px sans-serif`,e.globalAlpha=.5,e.fillStyle=ne.topLeft.color,e.textAlign="left",e.textBaseline="top",e.fillText(ne.topLeft.label,8,8),e.fillStyle=ne.topRight.color,e.textAlign="right",e.textBaseline="top",e.fillText(ne.topRight.label,i-8,8),e.fillStyle=ne.bottomLeft.color,e.textAlign="left",e.textBaseline="bottom",e.fillText(ne.bottomLeft.label,8,r-8),e.fillStyle=ne.bottomRight.color,e.textAlign="right",e.textBaseline="bottom",e.fillText(ne.bottomRight.label,i-8,r-8),e.globalAlpha=1)}]:pe,[pe,m,v,ne,g,f]),me=t.useMemo(()=>{const e=_.canvasPreRenderers||[];return[...ye,...e]},[ye,_.canvasPreRenderers]),ve=t.useMemo(()=>{var t;const n={stroke:y.stroke||"#999",strokeWidth:null!==(t=y.strokeWidth)&&void 0!==t?t:1,dashArray:y.strokeDasharray?Array.isArray(y.strokeDasharray)?y.strokeDasharray.join(","):y.strokeDasharray:void 0};return[(t,o,i)=>{if(!(null==o?void 0:o.x)||!(null==o?void 0:o.y))return null;const r=i.width,s=i.height,a=null!=g?o.x(g):r/2,l=null!=f?o.y(f):s/2;if(null!=g&&!isFinite(a))return null;if(null!=f&&!isFinite(l))return null;const c=Math.max(0,Math.min(r,a)),u=Math.max(0,Math.min(s,l));return e.jsxs(e.Fragment,{children:[[{config:ne.topLeft,x:0,y:0,w:c,h:u},{config:ne.topRight,x:c,y:0,w:r-c,h:u},{config:ne.bottomLeft,x:0,y:u,w:c,h:s-u},{config:ne.bottomRight,x:c,y:u,w:r-c,h:s-u}].map((t,n)=>{var o;return t.w>0&&t.h>0?e.jsx("rect",{x:t.x,y:t.y,width:t.w,height:t.h,fill:t.config.color,opacity:null!==(o=t.config.opacity)&&void 0!==o?o:.08},"qf-"+n):null}),e.jsx("line",{x1:c,y1:0,x2:c,y2:s,stroke:n.stroke,strokeWidth:n.strokeWidth,strokeDasharray:n.dashArray}),e.jsx("line",{x1:0,y1:u,x2:r,y2:u,stroke:n.stroke,strokeWidth:n.strokeWidth,strokeDasharray:n.dashArray}),m&&e.jsxs(e.Fragment,{children:[e.jsx("text",{x:8,y:8+v,fill:ne.topLeft.color,fontWeight:600,fontSize:v,opacity:.5,children:ne.topLeft.label}),e.jsx("text",{x:r-8,y:8+v,fill:ne.topRight.color,fontWeight:600,fontSize:v,opacity:.5,textAnchor:"end",children:ne.topRight.label}),e.jsx("text",{x:8,y:s-8,fill:ne.bottomLeft.color,fontWeight:600,fontSize:v,opacity:.5,children:ne.bottomLeft.label}),e.jsx("text",{x:r-8,y:s-8,fill:ne.bottomRight.color,fontWeight:600,fontSize:v,opacity:.5,textAnchor:"end",children:ne.bottomRight.label})]})]})}]},[g,f,ne,y,m,v]);if(ie.earlyReturn)return ie.earlyReturn;const be=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=s&&{data:oe}),{xAccessor:d,yAccessor:h,colorAccessor:b||void 0,sizeAccessor:w||void 0,sizeRange:A,pointStyle:de,colorScheme:x,size:[G,q],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ie.margin,showAxes:r.showAxes,xLabel:ee,yLabel:te,xFormat:c,yFormat:u,enableHover:X,showGrid:V}),re&&{xExtent:re.xExtent,yExtent:re.yExtent}),ie.legendBehaviorProps),Q&&{title:Q}),K&&{description:K}),Z&&{summary:Z}),void 0!==J&&{accessibleTable:J}),l&&{className:l}),null!=n.animate&&{animate:n.animate}),void 0!==n.axisExtent&&{axisExtent:n.axisExtent}),void 0!==n.autoPlaceAnnotations&&{autoPlaceAnnotations:n.autoPlaceAnnotations}),{tooltipContent:!1===O?()=>null:!0===O||void 0===O?ge:ji(O)||ge}),(L||T||R||$)&&{customHoverBehavior:ie.customHoverBehavior}),(T||R||L)&&{customClickBehavior:ie.customClickBehavior}),M&&{pointIdAccessor:M}),C&&C.length>0&&{annotations:C}),{canvasPreRenderers:me}),ie.crosshairProps),_),me.length>0&&{canvasPreRenderers:me}),{svgPreRenderers:ve});return fe?e.jsx(rc,{componentName:"QuadrantChart",message:fe,width:G,height:q}):e.jsx(cc,{componentName:"QuadrantChart",width:G,height:q,children:e.jsx(hr,Object.assign({ref:i},be))})});uu.displayName="QuadrantChart";const du="__ma_unitized",hu="__ma_series";function gu(e,t){const n=t[1]-t[0];return 0===n?.5:(e-t[0])/n}function fu(e,t){return t[0]+e*(t[1]-t[0])}const pu=t.forwardRef(function(n,o){var i;const r=t.useRef(null),s=t.useRef([]),a=t.useRef(n.series);a.current=n.series,t.useImperativeHandle(o,()=>{const e=()=>{var e;return(null!==(e=a.current)&&void 0!==e?e:[]).filter(e=>null!=e&&"object"==typeof e)};return{push:t=>{if(!r.current)return;const n=e(),o=t;for(let e=0;n.length>e&&2>e;e++){const t=n[e],i=t.extent||s.current[e];if(!i)continue;const a=("function"==typeof t.yAccessor?t.yAccessor:e=>e[t.yAccessor])(o);null!=a&&isFinite(a)&&r.current.push(Object.assign(Object.assign({},o),{[du]:gu(a,i),[hu]:t.label||"Series "+(e+1)}))}},pushMany:t=>{if(!r.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||s.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),{[du]:gu(a,r),[hu]:i.label||"Series "+(t+1)}))}r.current.pushMany(o)},remove:e=>{var t,n;return null!==(n=null===(t=r.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=r.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=r.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}},[]);const l=oc(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,xLabel:n.xLabel,accessibleTable:n.accessibleTable},{width:800,height:400}),{data:c,margin:u,className:d,xFormat:h,xAccessor:g="x",series:f,colorScheme:y,curve:m="monotoneX",lineWidth:v=2,tooltip:b,annotations:x,frameProps:w={},selection:A,linkedHover:j,onObservation:S,onClick:O,hoverHighlight:M,chartId:C,loading:_,loadingContent:P,emptyContent:L,legendInteraction:T,legendPosition:R,stroke:$,strokeWidth:N,opacity:E}=n,{width:B,height:D,enableHover:I,showGrid:F,showLegend:H=!0,title:W,description:z,summary:Y,accessibleTable:G,xLabel:q}=l,X=t.useMemo(()=>k(c),[c]),V=t.useMemo(()=>k(f),[f]),U=V,Q=2===V.length;"undefined"==typeof process||"production"===(null===(i=process.env)||void 0===i?void 0:i.NODE_ENV)||Q||console.warn(`[MultiAxisLineChart] Expected exactly 2 series for dual-axis mode, got ${V.length}. Rendering as a standard multi-line chart.`);const K=gc(_,B,D,P),Z=K?null:hc(c,B,D,L),J=Vl(),ee=t.useMemo(()=>{let e;if(Array.isArray(y))e=y;else if(J&&J.length>0)e=J;else{const t=be[y];e=Array.isArray(t)?t:xe}return U.map((t,n)=>t.color||e[n%e.length])},[U,y,J]),te=t.useMemo(()=>V.map((e,t)=>e.label||"Series "+(t+1)),[V]),{unitizedData:ne,extents:oe}=t.useMemo(()=>{if(0===X.length){const e=V.map(e=>e.extent||null).filter(Boolean);return e.length===V.length&&(s.current=e),{unitizedData:[],extents:e.length===V.length?e:[]}}const e=V.map(e=>e.extent||function(e,t){let 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]}(X,e.yAccessor));if(s.current=e,!Q){const t=[];for(const e of X)for(let n=0;V.length>n;n++){const o=V[n],i=("function"==typeof o.yAccessor?o.yAccessor:e=>e[o.yAccessor])(e);null!=i&&t.push(Object.assign(Object.assign({},e),{[du]:i,[hu]:te[n]}))}return{unitizedData:t,extents:e}}const t=[];for(const n of X)for(let o=0;2>o;o++){const i=V[o],r=("function"==typeof i.yAccessor?i.yAccessor:e=>e[i.yAccessor])(n);null!=r&&t.push(Object.assign(Object.assign({},n),{[du]:gu(r,e[o]),[hu]:te[o]}))}return{unitizedData:t,extents:e}},[X,V,Q,te]),ie=t.useMemo(()=>{if(Q&&oe.length>=2)return[{orient:"left",label:te[0],tickFormat:V[0].format||(e=>{const t=fu(e,oe[0]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"right",label:te[1],tickFormat:V[1].format||(e=>{const t=fu(e,oe[1]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"bottom"}]},[Q,oe,V,te]),re=wc({data:t.useMemo(()=>ne.length>0?ne:te.map(e=>({[hu]:e})),[ne,te]),rawData:c,colorBy:hu,colorScheme:ee,legendInteraction:T,legendPosition:R,selection:A,linkedHover:j,fallbackFields:[hu],unwrapData:!1,onObservation:S,onClick:O,hoverHighlight:M,chartType:"MultiAxisLineChart",chartId:C,showLegend:H,userMargin:u,marginDefaults:Q?Object.assign(Object.assign({},l.marginDefaults),{left:70,right:70}):l.marginDefaults,loading:_,loadingContent:P,emptyContent:L,width:B,height:D}),se=t.useMemo(()=>{const e=new Map;return te.forEach((t,n)=>e.set(t,ee[n])),e},[te,ee]),ae=Ic({lineWidth:v,resolveStroke:t.useCallback(e=>se.get(e[hu])||ee[0],[se,ee]),stroke:$,strokeWidth:N,opacity:E,effectiveSelectionHook:re.effectiveSelectionHook,resolvedSelection:re.resolvedSelection}),le=t.useMemo(()=>{if(!1===b)return()=>null;return ji(b)||(e=>{var t;const n=e.data||e,o=n[hu],i=te.indexOf(o),r=n[du],s=Q&&i>=0&&oe[i]?fu(r,oe[i]):r,a=i>=0&&(null===(t=V[i])||void 0===t?void 0:t.format)?V[i].format:e=>Number.isInteger(e)?e+"":e.toFixed(2),l="function"==typeof g?g(n):n[g];return p.createElement("div",{style:{padding:"6px 10px",fontFamily:"var(--semiotic-font-family, sans-serif)",fontSize:"var(--semiotic-tooltip-font-size, 13px)"}},p.createElement("div",{style:{fontWeight:600,marginBottom:4,color:ee[i]||"inherit"}},o),p.createElement("div",null,`${"string"==typeof g?g:"x"}: ${l}`),p.createElement("div",null,`${o}: ${a(s)}`))})},[b,te,ee,oe,Q,V,g]);if(re.earlyReturn)return re.earlyReturn;const ce=vc({componentName:"MultiAxisLineChart",data:c,accessors:{xAccessor:g}}),ue=Q?[0,1]:void 0,de=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"line"},null!=c&&{data:ne}),{xAccessor:g,yAccessor:du,groupAccessor:hu,lineStyle:ae,colorScheme:ee,size:[B,D],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:re.margin,showAxes:l.showAxes}),ie&&{axes:ie}),{xLabel:q}),Q?{}:{yLabel:te[0]}),{xFormat:h}),Q&&ue&&{yExtent:ue}),{enableHover:I}),n.pointIdAccessor&&{pointIdAccessor:n.pointIdAccessor}),{showGrid:F,curve:m}),re.legendBehaviorProps),W&&{title:W}),z&&{description:z}),Y&&{summary:Y}),void 0!==G&&{accessibleTable:G}),d&&{className:d}),null!=n.animate&&{animate:n.animate}),void 0!==n.axisExtent&&{axisExtent:n.axisExtent}),void 0!==n.autoPlaceAnnotations&&{autoPlaceAnnotations:n.autoPlaceAnnotations}),{tooltipContent:le}),x&&{annotations:x}),(j||S||O||M)&&{customHoverBehavior:re.customHoverBehavior}),(S||O||j)&&{customClickBehavior:re.customClickBehavior}),re.crosshairProps),w);return K||Z||(ce?e.jsx(rc,{componentName:"MultiAxisLineChart",message:ce,width:B,height:D}):e.jsx(cc,{componentName:"MultiAxisLineChart",width:B,height:D,children:e.jsx(hr,Object.assign({ref:r},de))}))});function yu(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}pu.displayName="MultiAxisLineChart";const mu=t.forwardRef(function(n,o){const i=t.useRef(null);Ac(o,{variant:"xy",frameRef:i});const r=oc(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel,description:n.description,summary:n.summary,accessibleTable:n.accessibleTable}),{data:s,margin:a,className:l,xFormat:c,yFormat:u,xAccessor:d="x",highAccessor:h="high",lowAccessor:g="low",openAccessor:f,closeAccessor:p,candlestickStyle:y,tooltip:m,annotations:v,xExtent:b,yExtent:x,frameProps:w={},selection:A,linkedHover:j,onObservation:S,onClick:O,chartId:M,loading:C,loadingContent:_,emptyContent:P}=n,{width:L,height:T,enableHover:R,showGrid:$,title:N,description:E,summary:B,accessibleTable:D,xLabel:I,yLabel:F}=r,H=gc(C,L,T,_),W=H?null:hc(s,L,T,P),z=t.useMemo(()=>k(s),[s]),Y=null==f||null==p;fc("CandlestickChart",z,"xAccessor",d),fc("CandlestickChart",z,"highAccessor",h),fc("CandlestickChart",z,"lowAccessor",g),Y||(fc("CandlestickChart",z,"openAccessor",f),fc("CandlestickChart",z,"closeAccessor",p));const{customHoverBehavior:G,customClickBehavior:q,crosshairSourceId:X}=Zl({selection:A,linkedHover:j,onObservation:S,onClick:O,chartType:"CandlestickChart",chartId:M}),V=Jl(j,X),U=t.useMemo(()=>{const e=r.marginDefaults,t="sparkline"===n.mode?Object.assign(Object.assign({},e),{top:0,bottom:0}):e;return null==a?t:Object.assign(Object.assign({},t),yu(a))},[a,r.marginDefaults,n.mode]),Q=t.useMemo(()=>{const e=[{label:I||ts(d),accessor:d,role:"x",format:c}];return Y?(e.push({label:"High",accessor:h,role:"y",format:u}),e.push({label:"Low",accessor:g,format:u})):(e.push({label:"Open",accessor:f,format:u}),e.push({label:"High",accessor:h,format:u}),e.push({label:"Low",accessor:g,format:u}),e.push({label:"Close",accessor:p,format:u})),ss(e)},[d,I,c,u,h,g,f,p,Y]),K=vc({componentName:"CandlestickChart",data:s,accessors:Object.assign({xAccessor:d,highAccessor:h,lowAccessor:g},!Y&&{openAccessor:f,closeAccessor:p})}),Z=Math.max(2,Math.min(12,Math.round(L/40))),J=L>200?.1:.02,ee=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"candlestick"},null!=s&&{data:z}),{xAccessor:d,yAccessor:h,highAccessor:h,lowAccessor:g}),!Y&&{openAccessor:f,closeAccessor:p}),y&&{candlestickStyle:y}),{scalePadding:Z,extentPadding:J,size:[L,T],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:U,showAxes:r.showAxes,xLabel:I,yLabel:F,xFormat:c,yFormat:u,enableHover:R,showGrid:$}),n.pointIdAccessor&&{pointIdAccessor:n.pointIdAccessor}),il({title:N,description:E,summary:B,accessibleTable:D,className:l,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),sl({tooltip:m,defaultTooltipContent:Q})),rl({linkedHover:j,onObservation:S,onClick:O,customHoverBehavior:G,customClickBehavior:q})),v&&v.length>0&&{annotations:v}),b&&{xExtent:b}),x&&{yExtent:x}),V),w);return H||W||(K?e.jsx(rc,{componentName:"CandlestickChart",message:K,width:L,height:T}):e.jsx(cc,{componentName:"CandlestickChart",width:L,height:T,children:e.jsx(hr,Object.assign({ref:i},ee))}))});function vu(e){const n=t.useRef(null);return Ac(e.imperativeRef,{variant:e.imperativeVariant,frameRef:n}),{frameRef:n,resolved:oc(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel}),normalizedMargin:t.useMemo(()=>yu(e.margin),[e.margin])}}function bu(e){var t;const n=vu(e),{resolved:o,normalizedMargin:i}=n,r=wc({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})}mu.displayName="CandlestickChart";const xu=t.forwardRef(function(n,o){const{data:i,layout:r,layoutConfig:s,xExtent:a,yExtent:l,showAxes:c=!1,margin:u,className:d,annotations:h,onObservation:g,onClick:f,selection:p,linkedHover:y,chartId:m,loading:v,loadingContent:b,emptyContent:x,colorScheme:k,frameProps:w={}}=n,{frameRef:A,resolved:j,safeData:S,setup:O,earlyReturn:M}=bu({imperativeRef:o,imperativeVariant:"xy",chartTypeLabel:"XYCustomChart",unwrapData:!1,data:i,colorScheme:k,selection:p,linkedHover:y,onObservation:g,onClick:f,chartId:m,loading:v,loadingContent:b,emptyContent:x,margin:u,width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,mode:n.mode,xLabel:n.xLabel,yLabel:n.yLabel}),C=O.effectiveSelectionHook,_=t.useMemo(()=>(null==C?void 0:C.isActive)?{isActive:!0,predicate:C.predicate}:null,[null==C?void 0:C.isActive,null==C?void 0:C.predicate]);if(M)return M;const{width:P,height:L,enableHover:T,showGrid:R,title:$,description:N,summary:E,accessibleTable:B,xLabel:D,yLabel:I}=j,F=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"custom"},null!=i&&{data:S}),{customLayout:r,layoutConfig:s}),_&&{layoutSelection:_}),{xExtent:a,yExtent:l,colorScheme:k,size:[P,L],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:O.margin,showAxes:c,xLabel:D,yLabel:I,enableHover:T,showGrid:R}),O.legendBehaviorProps),il({title:$,description:N,summary:E,accessibleTable:B,className:d,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),null!=n.tooltip&&{tooltipContent:n.tooltip}),rl({linkedHover:y,onObservation:g,onClick:f,hoverHighlight:!1,customHoverBehavior:O.customHoverBehavior,customClickBehavior:O.customClickBehavior})),h&&h.length>0&&{annotations:h}),O.crosshairProps),w);return e.jsx(cc,{componentName:"XYCustomChart",width:P,height:L,children:e.jsx(hr,Object.assign({ref:A},F))})});xu.displayName="XYCustomChart";const ku=t.forwardRef(function(n,o){const{nodes:i,edges:r,layout:s,layoutConfig:a,nodeIDAccessor:l="id",sourceAccessor:c="source",targetAccessor:u="target",margin:d,className:h,colorScheme:g,selection:f,linkedHover:p,onObservation:y,onClick:m,chartId:v,annotations:b,autoPlaceAnnotations:x,frameProps:w={}}=n,{frameRef:A,resolved:j,normalizedMargin:S}=vu({imperativeRef:o,imperativeVariant:"network",margin:d,width:n.width,height:n.height,enableHover:n.enableHover,title:n.title,mode:n.mode}),O=t.useMemo(()=>k(null!=i?i:[]),[i]),M=t.useMemo(()=>k(null!=r?r:[]),[r]),{customHoverBehavior:C,customClickBehavior:_,activeSelectionHook:P}=Zl({selection:f,linkedHover:p,fallbackFields:[],onObservation:y,onClick:m,chartType:"NetworkCustomChart",chartId:v}),L=t.useMemo(()=>(null==P?void 0:P.isActive)?{isActive:!0,predicate:P.predicate}:null,[null==P?void 0:P.isActive,null==P?void 0:P.predicate]),{width:T,height:R,enableHover:$,title:N,description:E,summary:B,accessibleTable:D}=j,I=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"force"},null!=i&&{nodes:O}),null!=r&&{edges:M}),{customNetworkLayout:s,layoutConfig:a,nodeIDAccessor:l,sourceAccessor:c,targetAccessor:u,colorScheme:g,size:[T,R],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:S,className:h,title:N,description:E,summary:B,accessibleTable:D,enableHover:$,customHoverBehavior:p||y||m?C:void 0,customClickBehavior:y||m?_:void 0,layoutSelection:L}),null!=b&&{annotations:b}),null!=x&&{autoPlaceAnnotations:x}),w);return e.jsx(cc,{componentName:"NetworkCustomChart",width:T,height:R,children:e.jsx(ol,Object.assign({ref:A},I))})});ku.displayName="NetworkCustomChart";const wu=t.forwardRef(function(n,o){const{data:i,layout:r,layoutConfig:s,categoryAccessor:a="category",valueAccessor:l="value",oExtent:c,rExtent:u,projection:d="vertical",margin:h,className:g,colorScheme:f,showAxes:p=!1,annotations:y,onObservation:m,onClick:v,selection:b,linkedHover:x,chartId:k,loading:w,loadingContent:A,emptyContent:j,frameProps:S={}}=n,{frameRef:O,resolved:M,safeData:C,setup:_,earlyReturn:P}=bu({imperativeRef:o,imperativeVariant:"xy",chartTypeLabel:"OrdinalCustomChart",unwrapData:!0,data:i,colorScheme:f,selection:b,linkedHover:x,onObservation:m,onClick:v,chartId:k,loading:w,loadingContent:A,emptyContent:j,margin:h,width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,title:n.title,mode:n.mode}),L=_.effectiveSelectionHook,T=t.useMemo(()=>(null==L?void 0:L.isActive)?{isActive:!0,predicate:L.predicate}:null,[null==L?void 0:L.isActive,null==L?void 0:L.predicate]);if(P)return P;const{width:R,height:$,enableHover:N,showGrid:E,title:B,description:D,summary:I,accessibleTable:F}=M,H=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"custom"},null!=i&&{data:C}),{customLayout:r,layoutConfig:s}),T&&{layoutSelection:T}),{oAccessor:a,rAccessor:l,oExtent:c,rExtent:u,projection:d,colorScheme:f,size:[R,$],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:_.margin,enableHover:N,showAxes:p,showGrid:E,annotations:y}),il({title:B,description:D,summary:I,accessibleTable:F,className:g,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),rl({linkedHover:x,onObservation:m,onClick:v,hoverHighlight:!1,customHoverBehavior:_.customHoverBehavior,customClickBehavior:_.customClickBehavior})),S);return e.jsx(cc,{componentName:"OrdinalCustomChart",width:R,height:$,children:e.jsx(es,Object.assign({ref:O},H))})});function Au({ref:e,frameRef:n,setup:o}){return t.useImperativeHandle(e,()=>({push:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=n.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,i;return null!==(i=null===(o=n.current)||void 0===o?void 0:o.update(e,t))&&void 0!==i?i:[]},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.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=n.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[n]),{effectiveLegendProps:o.legendBehaviorProps,effectiveMargin:o.margin}}function ju(e){const{colorBy:n,colorScale:o,color:i,themeCategorical:r,colorScheme:s,categoryIndexMap:a,userPieceStyle:l,stroke:c,strokeWidth:u,opacity:d,effectiveSelectionHook:h,resolvedSelection:g,cycleByCategory:f=!1,baseStyleExtras:p,linkStrokeToFill:y=!1}=e,m=t.useMemo(()=>(e,t)=>{const l="function"==typeof p?p(e,t):p,c=l?Object.assign({},l):{};if(void 0===c.fill)if(n){if(!o)return c;c.fill=je(e,n,o)}else c.fill=Ul(i,r,s,f?t:void 0,a);return y&&void 0===c.stroke&&void 0!==c.fill&&(c.stroke=c.fill),c},[n,o,i,r,s,a,f,p,y]),v=t.useMemo(()=>jc(l?"function"==typeof l?(e,t)=>Object.assign(Object.assign({},m(e,t)),l(e,t)||{}):(e,t)=>Object.assign(Object.assign({},m(e,t)),l):m,{stroke:c,strokeWidth:u,opacity:d}),[m,l,c,u,d]);return t.useMemo(()=>Nl(v,null!=h?h:null,g),[v,h,g])}wu.displayName="OrdinalCustomChart";const Su=t.forwardRef(function(n,o){const i=oc(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:n.orientation}),r=t.useRef(null),{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="vertical",valueFormat:h,colorBy:g,colorScheme:f,sort:p=!1,barPadding:y=40,roundedTop:m,gradientFill:v=!1,baselinePadding:b=!1,tooltip:x,annotations:w,regression:A,valueExtent:j,frameProps:S={},selection:O,linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,chartId:L,loading:T,loadingContent:R,emptyContent:$,legendInteraction:N,legendPosition:E,color:B,stroke:D,strokeWidth:I,opacity:F,showCategoryTicks:H,categoryFormat:W,dataIdAccessor:z}=n,{width:Y,height:G,enableHover:q,showGrid:X,showLegend:V,title:U,description:Q,summary:K,accessibleTable:Z,categoryLabel:J,valueLabel:ee}=i,te=t.useMemo(()=>k(s),[s]),ne=wc({data:te,rawData:s,colorBy:g,colorScheme:f,legendInteraction:N,legendPosition:E,selection:O,linkedHover:M,fallbackFields:g?["string"==typeof g?g:""]:[],unwrapData:!0,onObservation:C,onClick:_,hoverHighlight:P,chartType:"BarChart",chartId:L,showLegend:V,userMargin:a,marginDefaults:i.marginDefaults,loading:T,loadingContent:R,emptyContent:$,width:Y,height:G}),{effectiveLegendProps:oe,effectiveMargin:ie}=Au({ref:o,frameRef:r,setup:ne});fc("BarChart",te,"categoryAccessor",c),fc("BarChart",te,"valueAccessor",u);const re=Kl(te,p,u),se=Vl(),ae=t.useMemo(()=>new Map,[te]),le=ju({colorBy:g,colorScale:ne.colorScale,color:B,themeCategorical:se,colorScheme:f,categoryIndexMap:ae,userPieceStyle:null==S?void 0:S.pieceStyle,stroke:D,strokeWidth:I,opacity:F,effectiveSelectionHook:ne.effectiveSelectionHook,resolvedSelection:ne.resolvedSelection}),ce=t.useMemo(()=>as({categoryAccessor:c,valueAccessor:u,groupAccessor:g&&g!==c?g:void 0,groupLabel:"string"==typeof g?g:"group",valueFormat:h}),[c,u,g,h]);if(ne.earlyReturn)return ne.earlyReturn;const ue=vc({componentName:"BarChart",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(ue)return e.jsx(rc,{componentName:"BarChart",message:ue,width:Y,height:G});const de=Mc(A),he=de?[de,...w||[]]:w,ge=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=s&&{data:re}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:le,size:[Y,G],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ie,barPadding:y}),null!=m&&{roundedTop:m}),v&&{gradientFill:!0===v?{topOpacity:.8,bottomOpacity:.05}:v}),z&&{dataIdAccessor:z}),{baselinePadding:b,enableHover:q,showAxes:i.showAxes,oLabel:J,rLabel:ee,rFormat:h}),W&&{oFormat:W}),{showGrid:X,showCategoryTicks:H,oSort:p}),oe),il({title:U,description:Q,summary:K,accessibleTable:Z,className:l,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),sl({tooltip:x,defaultTooltipContent:ce})),rl({linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,customHoverBehavior:ne.customHoverBehavior,customClickBehavior:ne.customClickBehavior})),he&&he.length>0&&{annotations:he}),j&&{rExtent:j}),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return e.jsx(cc,{componentName:"BarChart",width:Y,height:G,children:e.jsx(es,Object.assign({ref:r},ge))})});Su.displayName="BarChart";const Ou=t.forwardRef(function(n,o){const i=oc(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:n.orientation}),r=t.useRef(null),{data:s,margin:a,className:l,categoryAccessor:c="category",stackBy:u,valueAccessor:d="value",orientation:h="vertical",valueFormat:g,colorBy:f,colorScheme:p,normalize:y=!1,sort:m=!1,barPadding:v=40,roundedTop:b,baselinePadding:x=!1,tooltip:w,annotations:A,valueExtent:j,frameProps:S={},selection:O,linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,chartId:L,loading:T,loadingContent:R,emptyContent:$,legendInteraction:N,legendPosition:E,color:B,stroke:D,strokeWidth:I,opacity:F,categoryFormat:H}=n,{width:W,height:z,enableHover:Y,showGrid:G,showLegend:q,title:X,description:V,summary:U,accessibleTable:Q,categoryLabel:K,valueLabel:Z}=i,J=t.useMemo(()=>k(s),[s]),ee=f||u,te=wc({data:J,rawData:s,colorBy:ee,colorScheme:p,legendInteraction:N,legendPosition:E,selection:O,linkedHover:M,fallbackFields:ee?["string"==typeof ee?ee:""]:[],unwrapData:!0,onObservation:C,onClick:_,hoverHighlight:P,chartType:"StackedBarChart",chartId:L,showLegend:q,userMargin:a,marginDefaults:i.marginDefaults,loading:T,loadingContent:R,emptyContent:$,width:W,height:z}),ne=Vl(),oe=t.useMemo(()=>new Map,[J]),ie=ju({colorBy:ee,colorScale:te.colorScale,color:B,themeCategorical:ne,colorScheme:p,categoryIndexMap:oe,userPieceStyle:null==S?void 0:S.pieceStyle,stroke:D,strokeWidth:I,opacity:F,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection}),re=t.useMemo(()=>as({categoryAccessor:u,valueAccessor:d,groupAccessor:c,valueFormat:g}),[u,c,d,g]),se=vc({componentName:"StackedBarChart",data:s,accessors:{categoryAccessor:c,valueAccessor:d},requiredProps:{stackBy:u}}),{effectiveLegendProps:ae,effectiveMargin:le}=Au({ref:o,frameRef:r,setup:te});if(te.earlyReturn)return te.earlyReturn;const ce=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=s&&{data:J}),{oAccessor:c,rAccessor:d,stackBy:u,normalize:y,oSort:m,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:ie,size:[W,z],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:le,barPadding:v}),null!=b&&{roundedTop:b}),{baselinePadding:x,enableHover:Y}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:K,rLabel:Z,rFormat:g}),H&&{oFormat:H}),{showGrid:G}),ae),il({title:X,description:V,summary:U,accessibleTable:Q,className:l,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),sl({tooltip:w,defaultTooltipContent:re})),rl({linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior})),A&&A.length>0&&{annotations:A}),j&&{rExtent:j}),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return se?e.jsx(rc,{componentName:"StackedBarChart",message:se,width:W,height:z}):e.jsx(cc,{componentName:"StackedBarChart",width:W,height:z,children:e.jsx(es,Object.assign({ref:r},ce))})});Ou.displayName="StackedBarChart";const Mu={RdBu:he,PiYG:ge,PRGn:fe,BrBG:pe,RdYlBu:ye,RdYlGn:me,Spectral:ve},Cu="__likert_neutral_neg",_u="__likert_neutral_pos";function Pu(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function Lu(e,t,n,o,i,r){const s=new Map,a=new Set(t);for(const l of e){const e=n(l);s.has(e)||s.set(e,new Map);const c=s.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(!a.has(e))continue;c.set(e,(c.get(e)||0)+(Number.isFinite(t)?t:0))}}const l=[];for(const[e,n]of s){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],s=n.get(r)||0;l.push({__likertCategory:e,__likertLevel:r,__likertLevelLabel:r,__likertCount:s,__likertPct:s/o*100,__likertLevelIndex:i})}}return l}function Tu(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:Cu,__likertPct:-e})),r.push(Object.assign(Object.assign({},t),{__likertLevel:_u,__likertPct:e}))}else r.push(i>e?Object.assign(Object.assign({},t),{__likertPct:-t.__likertPct}):t)}return r}function Ru(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 s=[];for(const[,e]of r){const t=new Map;let r,a;for(const n of e)n.__likertLevel===Cu?r=n:n.__likertLevel===_u?a=n:t.set(n.__likertLevelIndex,n);o&&r&&s.push(r);for(let e=i-1;e>=0;e--){const n=t.get(e);n&&s.push(n)}o&&a&&s.push(a);for(let e=o?i+1:i;n>e;e++){const n=t.get(e);n&&s.push(n)}}return s}const $u=["Very Low","Low","Neutral","High","Very High"],Nu=new Map,Eu=t.forwardRef(function(n,o){const i=oc(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:n.orientation}),r=t.useRef(null),{data:s,margin:a,className:l,categoryAccessor:c="question",valueAccessor:u,levelAccessor:d,countAccessor:h="count",levels:g=$u,orientation:f="horizontal",colorScheme:y,barPadding:m=20,tooltip:v,annotations:b,valueExtent:x,frameProps:k={},selection:w,linkedHover:A,onObservation:j,onClick:S,hoverHighlight:O,chartId:M,valueFormat:C,loading:_,loadingContent:P,emptyContent:L,legendInteraction:T,legendPosition:R,categoryFormat:$,stroke:N,strokeWidth:E,opacity:B}=n,{width:D,height:I,enableHover:F,showGrid:H,showLegend:W,title:z,description:Y,summary:G,accessibleTable:q,categoryLabel:X,valueLabel:V}=i,U="horizontal"===f,Q=void 0===s,K=!d,Z=function(){var e;const t=zl();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.diverging)||void 0}(),J=t.useMemo(()=>y&&Array.isArray(y)&&y.length>=g.length?y:function(e,t){if(0>=e)return[];if(t){const n=Mu[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,s=Math.floor(e/2),a=[];for(let e=0;s>e;e++)a.push(n[Math.min(Math.floor(e*n.length/s),n.length-1)]);r&&a.push(i);for(let e=0;s>e;e++)a.push(o[Math.min(Math.floor(e*o.length/s),o.length-1)]);return a}(g.length,Z),[y,g.length,Z]),ee=t.useMemo(()=>{const e=new Map;for(let t=0;g.length>t;t++)e.set(g[t],J[t]||"#888");return e},[g,J]),{processedData:te,reAggregate:ne,accumulatorRef:oe}=function({data:e,levels:n,categoryAccessor:o,valueAccessor:i,levelAccessor:r,countAccessor:s,isDiverging:a,frameRef:l}){const c=!r,u=t.useMemo(()=>Pu(o,"question"),[o]),d=t.useMemo(()=>c?Pu(i,"score"):null,[c,i]),h=t.useMemo(()=>c?null:Pu(r,"level"),[c,r]),g=t.useMemo(()=>c?null:Pu(s,"count"),[c,s]),f=e||[],p=t.useRef([]),y=t.useMemo(()=>{if(0===f.length)return[];let e=Lu(f,n,u,d,h,g);return a&&(e=Tu(e,n),e=Ru(e,n)),e},[f,n,u,d,h,g,a]),m=t.useCallback(e=>{var t;let o=Lu(e,n,u,d,h,g);a&&(o=Tu(o,n),o=Ru(o,n)),null===(t=l.current)||void 0===t||t.replace(o)},[n,u,d,h,g,a,l]);return{processedData:y,reAggregate:m,accumulatorRef:p}}({data:s,levels:g,categoryAccessor:c,valueAccessor:u,levelAccessor:d,countAccessor:h,isDiverging:U,frameRef:r}),ie="__likertLevelLabel",re=function({isPushMode:e,colorBy:n,colorScheme:o,showLegend:i,legendPosition:r="right"}){const s=t.useRef(new Set),a=t.useRef([]),[l,c]=t.useState(0),u=cl(),d=Vl(),h=t.useCallback(e=>{const t=e[n];return null!=t?t+"":null},[n]),g=t.useCallback(t=>{if(!e||!n)return;let o=!1;for(const e of t){if(!e||"object"!=typeof e)continue;const t=h(e);null==t||s.current.has(t)||(s.current.add(t),a.current.push(t),o=!0)}o&&c(e=>e+1)},[e,n,h]),f=t.useCallback(t=>{if(!e||!n)return;const o=Array.from(new Set(t.map(String))),i=a.current;i.length===o.length&&i.every((e,t)=>e===o[t])||(s.current=new Set(o),a.current=o,c(e=>e+1))},[e,n]),p=t.useCallback(e=>t=>{g([t]),e(t)},[g]),y=t.useCallback(e=>t=>{g(t),e(t)},[g]),m=t.useCallback(()=>{s.current=new Set,a.current=[],c(e=>e+1)},[]);_l(e&&n?a.current:[]);const v=t.useMemo(()=>{if(!e||!n||!1===i)return;const t=a.current;if(0===t.length)return;const r=Array.isArray(o)&&o.length>0||"string"==typeof o&&o.length>0?o:d&&d.length>0?d:ke,s=n,l=t.map(e=>({[s]:e})),c=Se(l,s,r);return Rl({data:l,colorBy:s,colorScale:e=>(null==u?void 0:u[e])||c(e)||"#999",getColor:je})},[e,n,i,o,u,d,l]),b=t.useMemo(()=>{if(v)return"right"===r?{right:110}:"left"===r?{left:110}:"top"===r?{top:50}:"bottom"===r?{bottom:80}:{right:110}},[v,r]);return{wrapPush:p,wrapPushMany:y,resetCategories:m,categories:a.current,categoryDomainProps:e&&n?{legendCategoryAccessor:n,onCategoriesChange:f}:{},streamingLegend:v,streamingMarginAdjust:b}}({isPushMode:Q,colorBy:ie,colorScheme:J,showLegend:W,legendPosition:R}),se=t.useCallback(re.wrapPush(e=>{oe.current.push(e),ne(oe.current)}),[re.wrapPush,ne,oe]),ae=t.useCallback(re.wrapPushMany(e=>{oe.current.push(...e),ne(oe.current)}),[re.wrapPushMany,ne,oe]);t.useImperativeHandle(o,()=>({push:se,pushMany:ae,remove:e=>{var t,n;return null!==(n=null===(t=r.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=r.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;oe.current=[],re.resetCategories(),null===(e=r.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[se,ae,re.resetCategories,oe]);const le=wc({data:te,rawData:s,colorBy:ie,colorScheme:J,legendInteraction:T,legendPosition:R,selection:w,linkedHover:A,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:j,onClick:S,hoverHighlight:O,chartType:"LikertChart",chartId:M,showLegend:W,userMargin:a,marginDefaults:i.marginDefaults,loading:_,loadingContent:P,emptyContent:L,width:D,height:I}),ce=t.useMemo(()=>{const e=g.length;return e%2!=0&&ee.get(g[Math.floor(e/2)])||"#888"},[g,ee]),ue=ju({colorBy:void 0,colorScale:void 0,color:void 0,themeCategorical:void 0,colorScheme:void 0,categoryIndexMap:Nu,userPieceStyle:null==k?void 0:k.pieceStyle,stroke:N,strokeWidth:E,opacity:B,effectiveSelectionHook:le.effectiveSelectionHook,resolvedSelection:le.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===Cu||i===_u)return{fill:ce};const r=o||i;return r&&ee.has(r)?{fill:ee.get(r)}:{fill:"#888"}}}),de=t.useMemo(()=>{const e=g.length;return e%2!=0?g[Math.floor(e/2)]:""},[g]),he=t.useMemo(()=>e=>{const t=e.data||e,n=t.__likertLevel||"Unknown",o=n===Cu||n===_u?de:n,i=t.__likertCategory||"",r=Math.abs(t.__likertPct||0),s=n===Cu||n===_u?2*r:r,a=t.__likertCount||0;return p.createElement("div",{className:"semiotic-tooltip",style:bi},p.createElement("div",{style:{fontWeight:"bold"}},i),p.createElement("div",{style:{marginTop:4}},`${o}: ${s.toFixed(1)}% (n=${a})`))},[de]),ge=t.useMemo(()=>{if(!g||2>g.length)return"LikertChart requires `levels` with at least 2 entries.";if(u&&d)return"LikertChart: provide either `valueAccessor` (raw responses) or `levelAccessor` + `countAccessor` (pre-aggregated), not both.";if(d&&!h)return"LikertChart: pre-aggregated mode requires both `levelAccessor` and `countAccessor`.";if(void 0!==s&&0===s.length)return null;const e={categoryAccessor:c};return K?u&&(e.valueAccessor=u):(d&&(e.levelAccessor=d),h&&(e.countAccessor=h)),vc({componentName:"LikertChart",data:s,accessors:e,requiredProps:{levels:g}})},[s,c,u,d,h,g,K]),fe=t.useMemo(()=>[{styleFn:e=>({fill:ee.get(e.label)||"#888"}),items:g.map(e=>({label:e})),label:""}],[g,ee]),pe=t.useMemo(()=>!1!==W?Object.assign(Object.assign({},le.legendBehaviorProps),{legend:{legendGroups:fe},legendPosition:R||le.legendPosition||"bottom"}):le.legendBehaviorProps,[le.legendBehaviorProps,le.legendPosition,R,W,fe]),ye=t.useMemo(()=>{const e=Object.assign({},le.margin);if(Q&&!1!==W){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(re.streamingMarginAdjust)for(const[t,n]of Object.entries(re.streamingMarginAdjust))n>e[t]&&(e[t]=n);return U&&100>e.left&&(e.left=100),e},[le.margin,re.streamingMarginAdjust,U,Q,W,R]),me=t.useMemo(()=>C||(U?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[U,C]);if(le.earlyReturn)return le.earlyReturn;const ve=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=s&&{data:te}),{oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:U?"horizontal":"vertical",pieceStyle:ue,size:[D,I],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ye,barPadding:m,enableHover:F}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:X,rLabel:V||(U?void 0:"Percentage"),rFormat:me}),$&&{oFormat:$}),{showGrid:H}),pe),z&&{title:z}),Y&&{description:Y}),G&&{summary:G}),void 0!==q&&{accessibleTable:q}),l&&{className:l}),null!=n.animate&&{animate:n.animate}),void 0!==n.axisExtent&&{axisExtent:n.axisExtent}),void 0!==n.autoPlaceAnnotations&&{autoPlaceAnnotations:n.autoPlaceAnnotations}),{tooltipContent:!1===v?()=>null:!0===v?he:ji(v)||he}),(A||j||S||O)&&{customHoverBehavior:le.customHoverBehavior}),(j||S||A)&&{customClickBehavior:le.customClickBehavior}),b&&b.length>0&&{annotations:b}),x&&{rExtent:x}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return ge?e.jsx(rc,{componentName:"LikertChart",message:ge,width:D,height:I}):e.jsx(cc,{componentName:"LikertChart",width:D,height:I,children:e.jsx(es,Object.assign({ref:r},ve))})});function Bu({brushProp:e,onBrushProp:n,linkedBrush:o,valueAccessor:i}){const r=$l("string"==typeof o?o:o?{name:o.name,xField:o.rField}:void 0),s=kl({name:(null==r?void 0:r.name)||"__unused_ordinal_brush__",xField:(null==r?void 0:r.xField)||("string"==typeof i?i:"value")}),a=t.useRef(s.brushInteraction);a.current=s.brushInteraction;const l=t.useCallback(e=>{if(r){a.current.end(e?e.r:null)}null==n||n(e)},[n,r]),c=!!(e||o||n);return{hasBrush:c,handleBrush:l,brushStreamProps:c?{brush:{dimension:"r"},onBrush:l}:{}}}Eu.displayName="LikertChart";const Du=t.forwardRef(function(n,o){const i=oc(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:n.orientation}),r=t.useRef(null);Ac(o,{variant:"xy",frameRef:r});const{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="vertical",valueFormat:h,colorBy:g,colorScheme:f,sizeBy:p,sizeRange:y=[3,8],symbolBy:m,symbolMap:v,pointRadius:b=4,pointOpacity:x=.7,categoryPadding:w=20,tooltip:A,annotations:j,valueExtent:S,brush:O,onBrush:M,linkedBrush:C,frameProps:_={},selection:P,linkedHover:L,onObservation:T,onClick:R,hoverHighlight:$,chartId:N,loading:E,loadingContent:B,emptyContent:D,legendInteraction:I,legendPosition:F,color:H,stroke:W,strokeWidth:z,opacity:Y,showCategoryTicks:G,categoryFormat:q}=n,{width:X,height:V,enableHover:U,showGrid:Q,showLegend:K,title:Z,description:J,summary:ee,accessibleTable:te,categoryLabel:ne,valueLabel:oe}=i,ie=t.useMemo(()=>k(s),[s]),re=wc({data:ie,rawData:s,colorBy:g,colorScheme:f,legendInteraction:I,legendPosition:F,selection:P,linkedHover:L,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:T,onClick:R,hoverHighlight:$,chartType:"SwarmPlot",chartId:N,showLegend:K,userMargin:a,marginDefaults:i.marginDefaults,loading:E,loadingContent:B,emptyContent:D,width:X,height:V}),se=Bu({brushProp:O,onBrushProp:M,linkedBrush:C,valueAccessor:u}),ae=t.useMemo(()=>{if(p)return rn(ie.map(e=>"function"==typeof p?p(e):e[p]))},[ie,p]),le=Vl(),ce=t.useMemo(()=>new Map,[ie]),ue=ju({colorBy:g,colorScale:re.colorScale,color:H,themeCategorical:le,colorScheme:f,categoryIndexMap:ce,userPieceStyle:null==_?void 0:_.pieceStyle,stroke:W,strokeWidth:z,opacity:Y,effectiveSelectionHook:re.effectiveSelectionHook,resolvedSelection:re.resolvedSelection,baseStyleExtras:e=>({fillOpacity:x,r:p?Oe(e,p,y,ae):b})}),de=t.useMemo(()=>as({categoryAccessor:c,valueAccessor:u,groupAccessor:g||void 0,valueFormat:h}),[c,u,g,h]);if(re.earlyReturn)return re.earlyReturn;const he=vc({componentName:"SwarmPlot",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(he)return e.jsx(rc,{componentName:"SwarmPlot",message:he,width:X,height:V});const 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({chartType:"swarm"},null!=s&&{data:ie}),{oAccessor:c,rAccessor:u}),m&&{symbolAccessor:m}),v&&{symbolMap:v}),{projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:ue,size:[X,V],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:re.margin,barPadding:w,enableHover:U}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:ne,rLabel:oe,rFormat:h}),q&&{oFormat:q}),{showGrid:Q,showCategoryTicks:G}),re.legendBehaviorProps),il({title:Z,description:J,summary:ee,accessibleTable:te,className:l,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),sl({tooltip:A,defaultTooltipContent:de})),rl({linkedHover:L,onObservation:T,onClick:R,hoverHighlight:$,customHoverBehavior:re.customHoverBehavior,customClickBehavior:re.customClickBehavior})),j&&j.length>0&&{annotations:j}),S&&{rExtent:S}),se.brushStreamProps),Object.fromEntries(Object.entries(_).filter(([e])=>"pieceStyle"!==e)));return e.jsx(cc,{componentName:"SwarmPlot",width:X,height:V,children:e.jsx(es,Object.assign({ref:r},ge))})});function Iu(t){return n=>{var o;const i=n.category||n.data&&(null===(o=n.data[0])||void 0===o?void 0:o.category)||"",r=n.stats||(n.data||n).stats;if(r&&null!=r.median)return e.jsxs("div",{className:"semiotic-tooltip",style:bi,children:[i&&e.jsx("div",{style:{fontWeight:"bold"},children:i+""}),null!=r.n&&e.jsxs("div",{children:["n = ",r.n]}),null!=r.min&&e.jsxs("div",{children:["Min: ",r.min.toLocaleString()]}),null!=r.q1&&e.jsxs("div",{children:["Q1: ",r.q1.toLocaleString()]}),e.jsxs("div",{children:["Median: ",r.median.toLocaleString()]}),null!=r.q3&&e.jsxs("div",{children:["Q3: ",r.q3.toLocaleString()]}),null!=r.max&&e.jsxs("div",{children:["Max: ",r.max.toLocaleString()]}),null!=r.mean&&e.jsxs("div",{style:{opacity:.8},children:["Mean: ",r.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});if(null==t?void 0:t.valueAccessor){const o=t.valueAccessor,r=(Array.isArray(n.data)?n.data:[]).map(e=>Number("function"==typeof o?o(e):e[o])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),s=r.length,a=s>0?s%2!=0?r[Math.floor(s/2)]:(r[s/2-1]+r[s/2])/2:null;return e.jsxs("div",{className:"semiotic-tooltip",style:bi,children:[i&&e.jsx("div",{style:{fontWeight:"bold"},children:i+""}),s>0&&e.jsxs("div",{children:["n = ",s]}),null!=a&&e.jsxs("div",{children:["Median: ",a.toLocaleString()]})]})}return e.jsx("div",{className:"semiotic-tooltip",style:bi,children:e.jsx("div",{style:{fontWeight:"bold"},children:i+""})})}}Du.displayName="SwarmPlot";const Fu=t.forwardRef(function(n,o){const i=oc(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:n.orientation}),r=t.useRef(null);Ac(o,{variant:"xy",frameRef:r});const{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="vertical",valueFormat:h,colorBy:g,colorScheme:f,showOutliers:p=!0,categoryPadding:y=20,tooltip:m,annotations:v,valueExtent:b,frameProps:x={},selection:w,linkedHover:A,onObservation:j,onClick:S,hoverHighlight:O,chartId:M,loading:C,loadingContent:_,emptyContent:P,legendInteraction:L,legendPosition:T,color:R,stroke:$,strokeWidth:N,opacity:E,showCategoryTicks:B,categoryFormat:D}=n,{width:I,height:F,enableHover:H,showGrid:W,showLegend:z,title:Y,description:G,summary:q,accessibleTable:X,categoryLabel:V,valueLabel:U}=i,Q=t.useMemo(()=>k(s),[s]),K=wc({data:Q,rawData:s,colorBy:g,colorScheme:f,legendInteraction:L,legendPosition:T,selection:w,linkedHover:A,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:j,onClick:S,hoverHighlight:O,chartType:"BoxPlot",chartId:M,showLegend:z,userMargin:a,marginDefaults:i.marginDefaults,loading:C,loadingContent:_,emptyContent:P,width:I,height:F}),Z=Vl(),J=t.useMemo(()=>new Map,[Q]),ee=ju({colorBy:g,colorScale:K.colorScale,color:R,themeCategorical:Z,colorScheme:f,categoryIndexMap:J,userPieceStyle:void 0,stroke:$,strokeWidth:N,opacity:E,effectiveSelectionHook:K.effectiveSelectionHook,resolvedSelection:K.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),te=t.useMemo(()=>Iu(),[]);if(K.earlyReturn)return K.earlyReturn;const ne=vc({componentName:"BoxPlot",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(ne)return e.jsx(rc,{componentName:"BoxPlot",message:ne,width:I,height:F});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:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",summaryStyle:ee,showOutliers:p,size:[I,F],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:K.margin,barPadding:y,enableHover:H}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:V,rLabel:U,rFormat:h}),D&&{oFormat:D}),{showGrid:W,showCategoryTicks:B}),K.legendBehaviorProps),il({title:Y,description:G,summary:q,accessibleTable:X,className:l,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),sl({tooltip:m,defaultTooltipContent:te})),rl({linkedHover:A,onObservation:j,onClick:S,hoverHighlight:O,customHoverBehavior:K.customHoverBehavior,customClickBehavior:K.customClickBehavior})),v&&v.length>0&&{annotations:v}),b&&{rExtent:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return e.jsx(cc,{componentName:"BoxPlot",width:I,height:F,children:e.jsx(es,Object.assign({ref:r},oe))})});Fu.displayName="BoxPlot";const Hu=e=>{const t=null==e?void 0:e.category;return null==t?"All":t+""},Wu=t.forwardRef(function(n,o){const i=oc(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"}),r=t.useRef(null);Ac(o,{variant:"xy",frameRef:r});const{data:s,margin:a,className:l,categoryAccessor:c=Hu,valueAccessor:u="value",bins:d=25,relative:h=!1,valueFormat:g,colorBy:f,colorScheme:p,categoryPadding:y=20,tooltip:m,annotations:v,valueExtent:b,brush:x,onBrush:w,linkedBrush:A,frameProps:j={},selection:S,linkedHover:O,onObservation:M,onClick:C,hoverHighlight:_,chartId:P,loading:L,loadingContent:T,emptyContent:R,legendInteraction:$,legendPosition:N,color:E,stroke:B,strokeWidth:D,opacity:I,showCategoryTicks:F,categoryFormat:H}=n,{width:W,height:z,enableHover:Y,showGrid:G,showLegend:q,title:X,description:V,summary:U,accessibleTable:Q,categoryLabel:K,valueLabel:Z}=i,J=t.useMemo(()=>k(s),[s]),ee=wc({data:J,rawData:s,colorBy:f,colorScheme:p,legendInteraction:$,legendPosition:N,selection:S,linkedHover:O,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:M,onClick:C,hoverHighlight:_,chartType:"Histogram",chartId:P,showLegend:q,userMargin:a,marginDefaults:i.marginDefaults,loading:L,loadingContent:T,emptyContent:R,width:W,height:z}),te=Bu({brushProp:x,onBrushProp:w,linkedBrush:A,valueAccessor:u}),ne=t.useMemo(()=>{if(0===J.length)return;const e="function"==typeof u?u:e=>e[u];let t=1/0,n=-1/0;for(const o of J){const i=e(o);null!=i&&isFinite(i)&&(t>i&&(t=i),i>n&&(n=i))}return t>n?void 0:[t,n]},[J,u]),oe=Vl(),ie=t.useMemo(()=>new Map,[J]),re=ju({colorBy:f,colorScale:ee.colorScale,color:E,themeCategorical:oe,colorScheme:p,categoryIndexMap:ie,userPieceStyle:void 0,stroke:B,strokeWidth:D,opacity:I,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),se=t.useMemo(()=>t=>{const n=t.data||t,o=n.category||t.category||"",i=n.count,r=n.range;return e.jsxs("div",{className:"semiotic-tooltip",style:bi,children:[o&&e.jsx("div",{style:{fontWeight:"bold"},children:o+""}),null!=i&&e.jsxs("div",{children:["Count: ",i]}),r&&2===r.length&&e.jsxs("div",{style:{opacity:.8},children:[Number(r[0]).toFixed(1)," – ",Number(r[1]).toFixed(1)]})]})},[]);if(ee.earlyReturn)return ee.earlyReturn;const ae=vc({componentName:"Histogram",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(ae)return e.jsx(rc,{componentName:"Histogram",message:ae,width:W,height:z});const le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"histogram"},null!=s&&{data:J}),{oAccessor:c,rAccessor:u,projection:"horizontal",summaryStyle:re,bins:d,normalize:h}),b?{rExtent:b}:ne&&{rExtent:ne}),{size:[W,z],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ee.margin,barPadding:y,enableHover:Y}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:K,rLabel:Z,rFormat:g}),H&&{oFormat:H}),{showGrid:G,showCategoryTicks:F}),ee.legendBehaviorProps),il({title:X,description:V,summary:U,accessibleTable:Q,className:l,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),sl({tooltip:m,defaultTooltipContent:se})),rl({linkedHover:O,onObservation:M,onClick:C,hoverHighlight:_,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior})),v&&v.length>0&&{annotations:v}),te.brushStreamProps),Object.fromEntries(Object.entries(j).filter(([e])=>"pieceStyle"!==e)));return e.jsx(cc,{componentName:"Histogram",width:W,height:z,children:e.jsx(es,Object.assign({ref:r},le))})});Wu.displayName="Histogram";const zu=t.forwardRef(function(n,o){const i=oc(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:n.orientation}),r=t.useRef(null);Ac(o,{variant:"xy",frameRef:r});const{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="vertical",bins:h=25,showIQR:g=!0,valueFormat:f,colorBy:p,colorScheme:y,categoryPadding:m=20,tooltip:v,annotations:b,valueExtent:x,brush:w,onBrush:A,linkedBrush:j,frameProps:S={},selection:O,linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,chartId:L,loading:T,loadingContent:R,emptyContent:$,legendInteraction:N,legendPosition:E,color:B,stroke:D,strokeWidth:I,opacity:F,showCategoryTicks:H,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}=i,ee=t.useMemo(()=>k(s),[s]),te=wc({data:ee,rawData:s,colorBy:p,colorScheme:y,legendInteraction:N,legendPosition:E,selection:O,linkedHover:M,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:C,onClick:_,hoverHighlight:P,chartType:"ViolinPlot",chartId:L,showLegend:X,userMargin:a,marginDefaults:i.marginDefaults,loading:T,loadingContent:R,emptyContent:$,width:z,height:Y}),ne=Bu({brushProp:w,onBrushProp:A,linkedBrush:j,valueAccessor:u}),oe=Vl(),ie=t.useMemo(()=>new Map,[ee]),re=ju({colorBy:p,colorScale:te.colorScale,color:B,themeCategorical:oe,colorScheme:y,categoryIndexMap:ie,userPieceStyle:void 0,stroke:D,strokeWidth:I,opacity:F,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection,baseStyleExtras:{fillOpacity:.6},linkStrokeToFill:!0}),se=t.useMemo(()=>Iu({valueAccessor:u}),[u]);if(te.earlyReturn)return te.earlyReturn;const ae=vc({componentName:"ViolinPlot",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(ae)return e.jsx(rc,{componentName:"ViolinPlot",message:ae,width:z,height:Y});const le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"violin"},null!=s&&{data:ee}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",summaryStyle:re,bins:h,showIQR:g,size:[z,Y],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:te.margin,barPadding:m,enableHover:G}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:Z,rLabel:J,rFormat:f}),W&&{oFormat:W}),{showGrid:q,showCategoryTicks:H}),te.legendBehaviorProps),il({title:V,description:U,summary:Q,accessibleTable:K,className:l,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),sl({tooltip:v,defaultTooltipContent:se})),rl({linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior})),b&&b.length>0&&{annotations:b}),x&&{rExtent:x}),ne.brushStreamProps),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return e.jsx(cc,{componentName:"ViolinPlot",width:z,height:Y,children:e.jsx(es,Object.assign({ref:r},le))})});zu.displayName="ViolinPlot";const Yu=t.forwardRef(function(n,o){const i=oc(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:n.orientation}),r=t.useRef(null);Ac(o,{variant:"xy",frameRef:r});const{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="horizontal",bins:h=20,amplitude:g=1.5,valueFormat:f,colorBy:p,colorScheme:y,categoryPadding:m=5,tooltip:v,annotations:b,valueExtent:x,frameProps:w={},selection:A,linkedHover:j,onObservation:S,onClick:O,hoverHighlight:M,chartId:C,loading:_,loadingContent:P,emptyContent:L,legendInteraction:T,legendPosition:R,color:$,stroke:N,strokeWidth:E,opacity:B,showCategoryTicks:D,categoryFormat:I}=n,{width:F,height:H,enableHover:W,showGrid:z,showLegend:Y,title:G,description:q,summary:X,accessibleTable:V,categoryLabel:U,valueLabel:Q}=i,K=t.useMemo(()=>k(s),[s]),Z=wc({data:K,rawData:s,colorBy:p,colorScheme:y,legendInteraction:T,legendPosition:R,selection:A,linkedHover:j,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:S,onClick:O,hoverHighlight:M,chartType:"RidgelinePlot",chartId:C,showLegend:Y,userMargin:a,marginDefaults:i.marginDefaults,loading:_,loadingContent:P,emptyContent:L,width:F,height:H}),J=Vl(),ee=t.useMemo(()=>new Map,[K]),te=ju({colorBy:p,colorScale:Z.colorScale,color:$,themeCategorical:J,colorScheme:y,categoryIndexMap:ee,userPieceStyle:void 0,stroke:N,strokeWidth:E,opacity:B,effectiveSelectionHook:Z.effectiveSelectionHook,resolvedSelection:Z.resolvedSelection,baseStyleExtras:{fillOpacity:.5},linkStrokeToFill:!0}),ne=t.useMemo(()=>Iu(),[]);if(Z.earlyReturn)return Z.earlyReturn;const oe=vc({componentName:"RidgelinePlot",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(oe)return e.jsx(rc,{componentName:"RidgelinePlot",message:oe,width:F,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({chartType:"ridgeline"},null!=s&&{data:K}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",summaryStyle:te,bins:h,size:[F,H],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:Z.margin,barPadding:m,enableHover:W}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:U,rLabel:Q,rFormat:f}),I&&{oFormat:I}),{showGrid:z,showCategoryTicks:D,oSort:!1,amplitude:g}),Z.legendBehaviorProps),il({title:G,description:q,summary:X,accessibleTable:V,className:l,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),sl({tooltip:v,defaultTooltipContent:ne})),rl({linkedHover:j,onObservation:S,onClick:O,hoverHighlight:M,customHoverBehavior:Z.customHoverBehavior,customClickBehavior:Z.customClickBehavior})),b&&b.length>0&&{annotations:b}),x&&{rExtent:x}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return e.jsx(cc,{componentName:"RidgelinePlot",width:F,height:H,children:e.jsx(es,Object.assign({ref:r},ie))})});Yu.displayName="RidgelinePlot";const Gu=t.forwardRef(function(n,o){const i=oc(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}),r=t.useRef(null);Ac(o,{variant:"xy",frameRef:r});const{data:s,margin:a,className:l,stepAccessor:c="step",valueAccessor:u="value",categoryAccessor:d,colorBy:h,colorScheme:g,orientation:f="horizontal",connectorOpacity:p=.3,showLabels:y=!0,tooltip:m,annotations:v,frameProps:b={},selection:x,linkedHover:w,onObservation:A,onClick:j,hoverHighlight:S,chartId:O,loading:M,loadingContent:C,emptyContent:_,legendInteraction:P,legendPosition:L,color:T,stroke:R,strokeWidth:$,opacity:N,categoryFormat:E}=n,B="vertical"===f,{width:D,height:I,enableHover:F,showLegend:H,title:W,description:z,summary:Y,accessibleTable:G}=i,q=B?{top:W?60:40,right:20,bottom:60,left:60}:{top:W?40:10,right:10,bottom:10,left:10},X=t.useMemo(()=>k(s),[s]),V=h||d,U=!V,Q=wc({data:X,rawData:s,colorBy:V,colorScheme:g,legendInteraction:P,legendPosition:L,selection:x,linkedHover:w,fallbackFields:V?["string"==typeof V?V:""]:[],unwrapData:!0,onObservation:A,onClick:j,hoverHighlight:S,chartType:"FunnelChart",chartId:O,showLegend:H,userMargin:a,marginDefaults:q,loading:M,loadingContent:C,emptyContent:_,width:D,height:I});fc("FunnelChart",X,"stepAccessor",c),fc("FunnelChart",X,"valueAccessor",u);const K=Vl(),Z=t.useMemo(()=>new Map,[X]),J=t.useMemo(()=>{if(U)return T||((null==K?void 0:K[0])?K[0]:Array.isArray(g)&&g[0]?g[0]:"#4e79a7")},[U,T,K,g]),ee=ju({colorBy:J?void 0:V,colorScale:Q.colorScale,color:null!=J?J:T,themeCategorical:K,colorScheme:g,categoryIndexMap:Z,userPieceStyle:null==b?void 0:b.pieceStyle,stroke:R,strokeWidth:$,opacity:N,effectiveSelectionHook:Q.effectiveSelectionHook,resolvedSelection:Q.resolvedSelection}),te=t.useMemo(()=>t=>{var n,o,i,r,s,a;const l=(null==t?void 0:t.data)||t,c=(null==l?void 0:l.__funnelStep)||(null==l?void 0:l.__barFunnelStep)||(null==l?void 0:l.step)||"",u=null!==(i=null!==(o=null!==(n=null==l?void 0:l.__funnelValue)&&void 0!==n?n:null==l?void 0:l.__barFunnelValue)&&void 0!==o?o:null==l?void 0:l.value)&&void 0!==i?i:"",d=null!==(r=null==l?void 0:l.__funnelPercent)&&void 0!==r?r:null==l?void 0:l.__barFunnelPercent,h=null!==(s=null==l?void 0:l.__funnelIsFirstStep)&&void 0!==s?s:null==l?void 0:l.__barFunnelIsFirstStep,g=null==l?void 0:l.__barFunnelIsDropoff,f=null!==(a=null==l?void 0:l.__barFunnelCategory)&&void 0!==a?a:null==l?void 0:l.category,p=null==d||h?"":` (${.05>Math.abs(d-Math.round(d))?Math.round(d)+"%":d.toFixed(1)+"%"})`;return e.jsxs("div",{className:"semiotic-tooltip",style:bi,children:[c&&e.jsx("div",{style:{fontWeight:"bold"},children:c+""}),f&&f!==c&&e.jsx("div",{style:{marginTop:2,opacity:.8},children:f+""}),g&&e.jsx("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7},children:"Dropoff"}),e.jsxs("div",{style:{marginTop:4},children:[u+"",p]})]})},[]);if(Q.earlyReturn)return Q.earlyReturn;const ne=vc({componentName:"FunnelChart",data:s,accessors:{stepAccessor:c,valueAccessor:u}});if(ne)return e.jsx(rc,{componentName:"FunnelChart",message:ne,width:D,height:I});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(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:B?"bar-funnel":"funnel"},null!=s&&{data:X}),{oAccessor:c,rAccessor:u}),d&&{stackBy:d}),{projection:B?"vertical":"horizontal",barPadding:B?40:0,pieceStyle:ee,size:[D,I],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:Q.margin,enableHover:F}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:B,showCategoryTicks:B}),E&&{oFormat:E}),{showGrid:B}),!B&&{connectorOpacity:p}),{showLabels:y}),Q.legendBehaviorProps),W&&{title:W}),z&&{description:z}),Y&&{summary:Y}),void 0!==G&&{accessibleTable:G}),l&&{className:l}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===m?()=>null:!0===m||null==m?te:ji(m)||te}),(w||A||j||S)&&{customHoverBehavior:Q.customHoverBehavior}),(A||j||w)&&{customClickBehavior:Q.customClickBehavior}),v&&v.length>0&&{annotations:v}),Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e)));return e.jsx(cc,{componentName:"FunnelChart",width:D,height:I,children:e.jsx(es,Object.assign({ref:r},oe))})});Gu.displayName="FunnelChart";const qu=t.forwardRef(function(n,o){var i;const r=oc(n.mode,{width:n.width,height:n.height,showGrid:null===(i=n.showGrid)||void 0===i||i,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:n.orientation}),s=t.useRef(null);Ac(o,{variant:"xy",frameRef:s});const{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="horizontal",valueFormat:g,colorBy:f,colorScheme:p,sort:y="auto",dotRadius:m=5,categoryPadding:v=10,tooltip:b,annotations:x,regression:w,valueExtent:A,frameProps:j={},selection:S,linkedHover:O,onObservation:M,onClick:C,hoverHighlight:_,chartId:P,loading:L,loadingContent:T,emptyContent:R,legendInteraction:$,legendPosition:N,color:E,stroke:B,strokeWidth:D,opacity:I,categoryFormat:F}=n,{width:H,height:W,enableHover:z,showGrid:Y,showLegend:G,title:q,description:X,summary:V,accessibleTable:U,categoryLabel:Q,valueLabel:K}=r,Z=t.useMemo(()=>k(a),[a]),J=wc({data:Z,rawData:a,colorBy:f,colorScheme:p,legendInteraction:$,legendPosition:N,selection:S,linkedHover:O,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:M,onClick:C,hoverHighlight:_,chartType:"DotPlot",chartId:P,showLegend:G,userMargin:l,marginDefaults:r.marginDefaults,loading:L,loadingContent:T,emptyContent:R,width:H,height:W}),ee=Kl(Z,y,d),te=Vl(),ne=t.useMemo(()=>new Map,[Z]),oe=ju({colorBy:f,colorScale:J.colorScale,color:E,themeCategorical:te,colorScheme:p,categoryIndexMap:ne,userPieceStyle:null==j?void 0:j.pieceStyle,stroke:B,strokeWidth:D,opacity:I,effectiveSelectionHook:J.effectiveSelectionHook,resolvedSelection:J.resolvedSelection,baseStyleExtras:{r:m,fillOpacity:.8}}),ie=t.useMemo(()=>as({categoryAccessor:u,valueAccessor:d,valueFormat:g}),[u,d,g]);if(J.earlyReturn)return J.earlyReturn;const re=vc({componentName:"DotPlot",data:a,accessors:{categoryAccessor:u,valueAccessor:d}});if(re)return e.jsx(rc,{componentName:"DotPlot",message:re,width:H,height:W});const se=Mc(w),ae=se?[se,...x||[]]:x,le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"point"},null!=a&&{data:ee}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:oe,size:[H,W],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:J.margin,barPadding:v,enableHover:z}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:r.showAxes,oLabel:Q,rLabel:K,rFormat:g}),F&&{oFormat:F}),{showGrid:Y,oSort:y}),J.legendBehaviorProps),il({title:q,description:X,summary:V,accessibleTable:U,className:c,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),sl({tooltip:b,defaultTooltipContent:ie})),rl({linkedHover:O,onObservation:M,onClick:C,hoverHighlight:_,customHoverBehavior:J.customHoverBehavior,customClickBehavior:J.customClickBehavior})),ae&&ae.length>0&&{annotations:ae}),A&&{rExtent:A}),Object.fromEntries(Object.entries(j).filter(([e])=>"pieceStyle"!==e)));return e.jsx(cc,{componentName:"DotPlot",width:H,height:W,children:e.jsx(es,Object.assign({ref:s},le))})});qu.displayName="DotPlot";const Xu=t.forwardRef(function(n,o){var i,r;const s=oc(n.mode,{width:null!==(i=n.width)&&void 0!==i?i:400,height:null!==(r=n.height)&&void 0!==r?r:400,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,showCategoryTicks:n.showCategoryTicks}),a=t.useRef(null),{data:l,margin:c,className:u,categoryAccessor:d="category",valueAccessor:h="value",colorBy:g,colorScheme:f,startAngle:p=0,cornerRadius:y,tooltip:m,annotations:v,frameProps:b={},selection:x,linkedHover:w,onObservation:A,onClick:j,hoverHighlight:S,chartId:O,loading:M,loadingContent:C,emptyContent:_,legendInteraction:P,legendPosition:L,color:T,stroke:R,strokeWidth:$,opacity:N}=n,{width:E,height:B,enableHover:D,showLegend:I,title:F,description:H,summary:W,accessibleTable:z}=s,Y=t.useMemo(()=>k(l),[l]),G=g||d,q=wc({data:Y,rawData:l,colorBy:G,colorScheme:f,legendInteraction:P,legendPosition:L,selection:x,linkedHover:w,fallbackFields:G?["string"==typeof G?G:""]:[],unwrapData:!0,onObservation:A,onClick:j,hoverHighlight:S,chartType:"PieChart",chartId:O,showLegend:I,userMargin:c,marginDefaults:s.marginDefaults,loading:M,loadingContent:C,emptyContent:_,width:E,height:B}),X=Vl(),V=t.useMemo(()=>new Map,[Y]),U=ju({colorBy:G,colorScale:q.colorScale,color:T,themeCategorical:X,colorScheme:f,categoryIndexMap:V,userPieceStyle:null==b?void 0:b.pieceStyle,stroke:R,strokeWidth:$,opacity:N,effectiveSelectionHook:q.effectiveSelectionHook,resolvedSelection:q.resolvedSelection,cycleByCategory:!0}),Q=t.useMemo(()=>as({categoryAccessor:d,valueAccessor:h,groupAccessor:g&&g!==d?g:void 0,groupLabel:"string"==typeof g?g:"group",pieData:!0}),[d,h,g]),K=vc({componentName:"PieChart",data:l,accessors:{categoryAccessor:d,valueAccessor:h}}),{effectiveLegendProps:Z,effectiveMargin:J}=Au({ref:o,frameRef:a,setup:q});if(q.earlyReturn)return q.earlyReturn;const ee=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"pie"},null!=l&&{data:Y}),{oAccessor:d,rAccessor:h,projection:"radial",pieceStyle:U,startAngle:p}),null!=y&&{cornerRadius:y}),{size:[E,B],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:J,enableHover:D}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:!1}),Z),il({title:F,description:H,summary:W,accessibleTable:z,className:u,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),sl({tooltip:m,defaultTooltipContent:Q})),rl({linkedHover:w,onObservation:A,onClick:j,hoverHighlight:S,customHoverBehavior:q.customHoverBehavior,customClickBehavior:q.customClickBehavior})),v&&v.length>0&&{annotations:v}),Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e)));return K?e.jsx(rc,{componentName:"PieChart",message:K,width:E,height:B}):e.jsx(cc,{componentName:"PieChart",width:E,height:B,children:e.jsx(es,Object.assign({ref:a},ee))})});Xu.displayName="PieChart";const Vu=t.forwardRef(function(n,o){const i=oc(n.mode,{width:n.width,height:n.height,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,linkedHover:n.linkedHover,showCategoryTicks:n.showCategoryTicks},{width:400,height:400}),r=t.useRef(null),{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",innerRadius:d,centerContent:h,colorBy:g,colorScheme:f,startAngle:p=0,cornerRadius:y,tooltip:m,annotations:v,frameProps:b={},selection:x,linkedHover:w,onObservation:A,onClick:j,hoverHighlight:S,chartId:O,loading:M,loadingContent:C,emptyContent:_,legendInteraction:P,legendPosition:L,color:T,stroke:R,strokeWidth:$,opacity:N}=n,{width:E,height:B,enableHover:D,showLegend:I,title:F,description:H,summary:W,accessibleTable:z}=i,Y=t.useMemo(()=>k(s),[s]),G=g||c,q=wc({data:Y,rawData:s,colorBy:G,colorScheme:f,legendInteraction:P,legendPosition:L,selection:x,linkedHover:w,fallbackFields:G?["string"==typeof G?G:""]:[],unwrapData:!0,onObservation:A,onClick:j,hoverHighlight:S,chartType:"DonutChart",chartId:O,showLegend:I,userMargin:a,marginDefaults:i.marginDefaults,loading:M,loadingContent:C,emptyContent:_,width:E,height:B}),X=null!=d?d:Math.max(2,.15*Math.min(E,B)),V=Vl(),U=t.useMemo(()=>new Map,[Y]),Q=ju({colorBy:G,colorScale:q.colorScale,color:T,themeCategorical:V,colorScheme:f,categoryIndexMap:U,userPieceStyle:null==b?void 0:b.pieceStyle,stroke:R,strokeWidth:$,opacity:N,effectiveSelectionHook:q.effectiveSelectionHook,resolvedSelection:q.resolvedSelection,cycleByCategory:!0}),K=t.useMemo(()=>as({categoryAccessor:c,valueAccessor:u,groupAccessor:g&&g!==c?g:void 0,groupLabel:"string"==typeof g?g:"group",pieData:!0}),[c,u,g]),Z=vc({componentName:"DonutChart",data:s,accessors:{categoryAccessor:c,valueAccessor:u}}),{effectiveLegendProps:J,effectiveMargin:ee}=Au({ref:o,frameRef:r,setup:q});if(q.earlyReturn)return q.earlyReturn;const te=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut"},null!=s&&{data:Y}),{oAccessor:c,rAccessor:u,projection:"radial",pieceStyle:Q,innerRadius:X,startAngle:p}),null!=y&&{cornerRadius:y}),{centerContent:h,size:[E,B],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ee,enableHover:D}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:!1}),J),il({title:F,description:H,summary:W,accessibleTable:z,className:l,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),sl({tooltip:m,defaultTooltipContent:K})),rl({linkedHover:w,onObservation:A,onClick:j,hoverHighlight:S,customHoverBehavior:q.customHoverBehavior,customClickBehavior:q.customClickBehavior})),v&&v.length>0&&{annotations:v}),Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e)));return Z?e.jsx(rc,{componentName:"DonutChart",message:Z,width:E,height:B}):e.jsx(cc,{componentName:"DonutChart",width:E,height:B,children:e.jsx(es,Object.assign({ref:r},te))})});function Uu(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 Qu(e){return Math.max(0,Math.min(1,e))}function Ku(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 Zu(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 Ju(e,t){const n=e.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Qu(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=Qu(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,s=r>0?(o-t.offset)/r:0,a=Ku(t.color),l=Ku(i.color);if(!a||!l)return.5>s?t.color:i.color;const[c,u,d]=a,[h,g,f]=l;return Zu(c+(h-c)*s,u+(g-u)*s,d+(f-d)*s)}return n[n.length-1].color}function ed(e,t,n){return`${e}-${t}`}Vu.displayName="DonutChart";const td=t.forwardRef(function(n,o){const i=oc(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}),r=t.useRef(null),s="context"===n.mode,{compactMode:a}=i,{value:l,min:c=0,max:u=100,thresholds:d,gradientFill:h,color:g,backgroundColor:f="var(--semiotic-grid, #e0e0e0)",arcWidth:p=.3,cornerRadius:y,showNeedle:m=!0,needleColor:v="var(--semiotic-text, #333)",centerContent:b,valueFormat:x,showScaleLabels:k=!a,sweep:w=240,fillZones:A=!0,tooltip:j,annotations:S,frameProps:O={},className:M,stroke:C,strokeWidth:_,opacity:P}=n,{width:L,height:T,title:R,description:$,summary:N,accessibleTable:E}=i,B=h&&"object"==typeof h?h:void 0,D=Math.max(c,Math.min(u,l)),I=u-c||1,F=(D-c)/I,{gaugeData:H,pieceStyle:W,gaugeAnnotations:z}=t.useMemo(()=>function(e){const{min:t,max:n,value:o,thresholds:i,fillColor:r,backgroundColor:s,fillZones:a,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=a?h:1,t=ed("bg",0);if(p.push({category:t,value:1,_zone:"Track",_isFill:!1,_pctStart:0,_pct:1,_roundedEnds:{start:!0,end:!0},_nonInteractive:!0}),y.set(t,{fill:s,opacity:.4}),e>0){const t=Math.max(1,Math.floor(u)),n=Math.max(1,Math.min(t,Math.round(e*t))),o=[];for(let t=0;n>t;t++)o.push(Ju(c.colorStops,e*(t+.5)/n));const i=ed("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]||s})}}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,(a?Math.min(h,l):l)-r),u=a?Math.max(0,i-c):0;if(c>0){const e=ed("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=ed("bg",n);p.push({category:e,value:u,_zone:o.label||"Zone "+(n+1),_isFill:!1}),y.set(e,{fill:s,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:s},gaugeAnnotations:m}}({min:c,max:u,value:l,thresholds:d,fillColor:g,backgroundColor:f,fillZones:A,showScaleLabels:k,gradientFill:B}),[l,c,u,d,g,f,k,A,B]),Y=t.useMemo(()=>jc(W,{stroke:C,strokeWidth:_,opacity:P}),[W,C,_,P]),{sweepRad:G,startAngleDeg:q}=Uu(w),X=function(e=240){const{sweepRad:t,offsetRad:n}=Uu(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]),[s,a]=rn(i),[l,c]=rn(r);return{minX:s,maxX:a,minY:l,maxY:c,width:a-s,height:c-l,cx:(s+a)/2,cy:(l+c)/2}}(w),V=Math.min(10,Math.max(1,Math.min(L,T)/12)),U=X.cx,Q=X.cy,K=Math.max(4,Math.min((L-2*V)/X.width,(T-2*V)/X.height)-2),Z=Math.max(0,Math.min(K-1.5,K*(1-p))),J=L/2-U*K,ee=T/2-Q*K,te=2*(K+4),ne=t.useMemo(()=>{if(a&&null==b)return null;if(null!=b)return"function"==typeof b?b(D,c,u):b;const t=x?x(D):Math.round(D)+"";return e.jsxs("div",{style:{textAlign:"center",lineHeight:1.2},children:[e.jsx("div",{style:{fontSize:Math.max(16,.3*K),fontWeight:700,color:"var(--semiotic-text, #333)"},children:t}),k&&e.jsxs("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"},children:[c," – ",u]})]})},[b,D,c,u,x,k,K,a]),oe=t.useMemo(()=>s&&null==b?{type:"gauge-value",text:x?x(D):Math.round(D)+""}:null,[s,b,D,x]),ie=t.useMemo(()=>{if(!m)return null;const e=-Math.PI/2+q*Math.PI/180+F*G,t=Z>20?Z-8:K-1;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:v}},[m,F,q,G,Z,v]),re=t.useMemo(()=>(t,n,o)=>{if("gauge-needle"===t.type){const i=(o.width||L)/2,r=(o.height||T)/2,s=Math.max(1,K-Z),a=Math.max(1,Math.min(2.5,.4*s)),l=Math.max(1,Math.min(5,.6*s));return e.jsxs("g",{transform:`translate(${i},${r})`,children:[e.jsx("line",{x1:0,y1:0,x2:t.tipX,y2:t.tipY,stroke:t.color,strokeWidth:a,strokeLinecap:"round"}),e.jsx("circle",{cx:0,cy:0,r:l,fill:t.color})]},"gauge-needle-"+n)}if("gauge-label"===t.type){const i=-Math.PI/2+q*Math.PI/180+(t.value-c)/I*G,r=(o.width||L)/2,s=(o.height||T)/2,a=Z-1,l=K+1,u=Math.cos(i)*a,d=Math.sin(i)*a,h=Math.cos(i)*l,g=Math.sin(i)*l,f=K+10,p=Math.cos(i)*f,y=Math.sin(i)*f,m=((i+Math.PI/2)/(2*Math.PI)*12+12)%12;let v="middle",b="middle";return m>=11||1>m?(v="middle",b="auto"):m>=1&&5>m?(v="start",b="middle"):m>=5&&7>m?(v="middle",b="hanging"):(v="end",b="middle"),e.jsxs("g",{transform:`translate(${r},${s})`,children:[e.jsx("line",{x1:u,y1:d,x2:h,y2:g,stroke:"var(--semiotic-border)",strokeWidth:2,strokeLinecap:"round"}),e.jsx("text",{x:p,y:y,textAnchor:v,dominantBaseline:b,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none",fontSize:"var(--semiotic-gauge-label-font-size, 10px)"},children:t.label})]},"gauge-label-"+n)}return"gauge-value"===t.type?e.jsx("text",{x:(o.width||L)/2,y:(o.height||T)/2-.2*Z,textAnchor:"middle",dominantBaseline:"middle",fontSize:Math.max(12,Math.min(22,.28*K)),fontWeight:700,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:t.text},"gauge-value-"+n):null},[L,T,c,I,q,G,Z,K]),se=t.useMemo(()=>{const e=[...z,...S||[]];return ie&&e.push(ie),oe&&e.push(oe),e},[z,S,ie,oe]),ae=t.useMemo(()=>t=>{var n;const o=(null===(n=null==t?void 0:t.data)||void 0===n?void 0:n[0])||(null==t?void 0:t.data)||t,i=null==o?void 0:o._isFill;return e.jsxs("div",{className:"semiotic-tooltip",style:{padding:"6px 10px",background:"var(--semiotic-tooltip-bg, white)",borderRadius:"var(--semiotic-tooltip-radius, 6px)",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0,0,0,0.15))"},children:[e.jsx("div",{style:{fontWeight:600},children:(null==o?void 0:o._zone)||""}),e.jsx("div",{style:{fontSize:"0.85em",color:"var(--semiotic-text-secondary, #666)"},children:i?"Current: "+Math.round(D):"Remaining"})]})},[D]);if(0===H.length)return e.jsx(rc,{componentName:"GaugeChart",message:"No data to display",width:L,height:T});const le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut",data:H,oAccessor:"category",rAccessor:"value",oSort:!1,projection:"radial",pieceStyle:Y,innerRadius:Z,startAngle:q,sweepAngle:w},null!=y&&{cornerRadius:y}),{centerContent:ne,size:[L,T],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:{top:ee-te/2,bottom:T-ee-te/2,left:J-te/2,right:L-J-te/2},enableHover:i.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===j?()=>null:ji(j)||ae,svgAnnotationRules:re}),se.length>0&&{annotations:se}),R&&{title:R}),$&&{description:$}),N&&{summary:N}),void 0!==E&&{accessibleTable:E}),M&&{className:M}),null!=n.animate&&{animate:n.animate}),O);return e.jsx(cc,{componentName:"GaugeChart",width:L,height:T,children:e.jsx(es,Object.assign({ref:r},le))})});td.displayName="GaugeChart";const nd=t.forwardRef(function(n,o){const i=oc(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:n.orientation}),r=t.useRef(null),{data:s,margin:a,className:l,categoryAccessor:c="category",groupBy:u,valueAccessor:d="value",orientation:h="vertical",valueFormat:g,colorBy:f,colorScheme:p,sort:y=!1,barPadding:m=60,roundedTop:v,baselinePadding:b=!1,tooltip:x,annotations:w,valueExtent:A,frameProps:j={},selection:S,linkedHover:O,onObservation:M,onClick:C,hoverHighlight:_,chartId:P,loading:L,loadingContent:T,emptyContent:R,legendInteraction:$,legendPosition:N,color:E,stroke:B,strokeWidth:D,opacity:I,categoryFormat:F}=n,{width:H,height:W,enableHover:z,showGrid:Y,showLegend:G,title:q,description:X,summary:V,accessibleTable:U,categoryLabel:Q,valueLabel:K}=i,Z=t.useMemo(()=>k(s),[s]),J=f||u,ee=wc({data:Z,rawData:s,colorBy:J,colorScheme:p,legendInteraction:$,legendPosition:N,selection:S,linkedHover:O,fallbackFields:J?["string"==typeof J?J:""]:[],unwrapData:!0,onObservation:M,onClick:C,hoverHighlight:_,chartType:"GroupedBarChart",chartId:P,showLegend:G,userMargin:a,marginDefaults:i.marginDefaults,loading:L,loadingContent:T,emptyContent:R,width:H,height:W}),te=Vl(),ne=t.useMemo(()=>new Map,[Z]),oe=ju({colorBy:J,colorScale:ee.colorScale,color:E,themeCategorical:te,colorScheme:p,categoryIndexMap:ne,userPieceStyle:j.pieceStyle,stroke:B,strokeWidth:D,opacity:I,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection}),ie=t.useMemo(()=>as({categoryAccessor:u,valueAccessor:d,groupAccessor:c,valueFormat:g}),[u,c,d,g]),re=vc({componentName:"GroupedBarChart",data:s,accessors:{categoryAccessor:c,valueAccessor:d},requiredProps:{groupBy:u}}),{effectiveLegendProps:se,effectiveMargin:ae}=Au({ref:o,frameRef:r,setup:ee});if(ee.earlyReturn)return ee.earlyReturn;const le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"clusterbar"},null!=s&&{data:Z}),{oAccessor:c,rAccessor:d,groupBy:u,oSort:y,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:oe,size:[H,W],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ae,barPadding:m}),null!=v&&{roundedTop:v}),{baselinePadding:b,enableHover:z}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:Q,rLabel:K,rFormat:g}),F&&{oFormat:F}),{showGrid:Y}),se),il({title:q,description:X,summary:V,accessibleTable:U,className:l,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),sl({tooltip:x,defaultTooltipContent:ie})),rl({linkedHover:O,onObservation:M,onClick:C,hoverHighlight:_,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior})),w&&w.length>0&&{annotations:w}),A&&{rExtent:A}),Object.fromEntries(Object.entries(j).filter(([e])=>"pieceStyle"!==e)));return re?e.jsx(rc,{componentName:"GroupedBarChart",message:re,width:H,height:W}):e.jsx(cc,{componentName:"GroupedBarChart",width:H,height:W,children:e.jsx(es,Object.assign({ref:r},le))})});nd.displayName="GroupedBarChart";const od=t.forwardRef(function(n,o){const i=oc(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:n.orientation}),r=t.useRef(null),{data:s,margin:a,className:l,categoryAccessor:c="category",subcategoryAccessor:u,valueAccessor:d="value",orientation:h="horizontal",valueFormat:g,colorBy:f,colorScheme:p,barPadding:y,tooltip:m,annotations:v,brush:b,onBrush:x,linkedBrush:w,frameProps:A={},selection:j,linkedHover:S,onObservation:O,onClick:M,hoverHighlight:C,chartId:_,loading:P,loadingContent:L,emptyContent:T,legendInteraction:R,legendPosition:$,color:N,stroke:E,strokeWidth:B,opacity:D,categoryFormat:I,rTickValues:F,tickLabelEdgeAlign:H,showCategoryTicks:W,gradientFill:z,trackFill:Y,roundedTop:G,valueExtent:q}=n,{width:X,height:V,enableHover:U,showGrid:Q,showLegend:K,title:Z,description:J,summary:ee,accessibleTable:te,categoryLabel:ne,valueLabel:oe}=i,ie=t.useMemo(()=>k(s),[s]),re=f||u,se=t.useMemo(()=>{if(null!=y)return y;if("sparkline"!==n.mode)return 40;const e=new Set(ie.map(e=>"function"==typeof c?c(e):e[c])),t=Math.max(1,e.size);return t>1?Math.max(0,Math.min(1,(("horizontal"===h?V:X)-2*t)/(t-1))):1},[y,n.mode,ie,c,h,X,V]),ae=wc({data:ie,rawData:s,colorBy:re,colorScheme:p,legendInteraction:R,legendPosition:$,selection:j,linkedHover:S,fallbackFields:re?["string"==typeof re?re:""]:[],unwrapData:!0,onObservation:O,onClick:M,hoverHighlight:C,chartType:"SwimlaneChart",chartId:_,showLegend:K,userMargin:a,marginDefaults:i.marginDefaults,loading:P,loadingContent:L,emptyContent:T,width:X,height:V}),le=Bu({brushProp:b,onBrushProp:x,linkedBrush:w,valueAccessor:d}),ce=Vl(),ue=t.useMemo(()=>new Map,[ie]),de=ju({colorBy:re,colorScale:ae.colorScale,color:N,themeCategorical:ce,colorScheme:p,categoryIndexMap:ue,userPieceStyle:null==A?void 0:A.pieceStyle,stroke:E,strokeWidth:B,opacity:D,effectiveSelectionHook:ae.effectiveSelectionHook,resolvedSelection:ae.resolvedSelection,cycleByCategory:!0}),he=t.useMemo(()=>as({categoryAccessor:u,valueAccessor:d,groupAccessor:c,valueFormat:g}),[u,c,d,g]),ge=vc({componentName:"SwimlaneChart",data:s,accessors:{categoryAccessor:c,valueAccessor:d,subcategoryAccessor:u},requiredProps:{subcategoryAccessor:u}}),{effectiveLegendProps:fe,effectiveMargin:pe}=Au({ref:o,frameRef:r,setup:ae});if(ae.earlyReturn)return ae.earlyReturn;const ye=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swimlane"},null!=s&&{data:ie}),{oAccessor:c,rAccessor:d,stackBy:u,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:de,size:[X,V],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:pe,barPadding:se,enableHover:U}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:!1===W?void 0:ne,rLabel:oe,rFormat:g}),F&&{rTickValues:F}),null!=H&&{tickLabelEdgeAlign:H}),I&&{oFormat:I}),void 0!==W&&{showCategoryTicks:W}),{showGrid:Q}),fe),il({title:Z,description:J,summary:ee,accessibleTable:te,className:l,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),sl({tooltip:m,defaultTooltipContent:he})),rl({linkedHover:S,onObservation:O,onClick:M,hoverHighlight:C,customHoverBehavior:ae.customHoverBehavior,customClickBehavior:ae.customClickBehavior})),v&&v.length>0&&{annotations:v}),z&&{gradientFill:!0===z?{topOpacity:.8,bottomOpacity:.05}:z}),null!=Y&&{trackFill:Y}),null!=G&&{roundedTop:G}),q&&{rExtent:q}),le.brushStreamProps),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return ge?e.jsx(rc,{componentName:"SwimlaneChart",message:ge,width:X,height:V}):e.jsx(cc,{componentName:"SwimlaneChart",width:X,height:V,children:e.jsx(es,Object.assign({ref:r},ye))})});function id(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 rd(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 sd(e){return"function"==typeof e?e:t=>t[e]||1}function ad({edgeColorBy:e,colorBy:t,colorScale:n,nodeStyleFn:o,edgeOpacity:i,baseStyle:r={}}){return s=>{const a=Object.assign({fillOpacity:i},r);if("function"==typeof e)a.fill=e(s);else if("source"===e){const e="object"==typeof s.source?s.source:null;t&&e?a.fill=je(e.data||e,t,n):e&&(a.fill=o(e,e.index).fill)}else if("target"===e){const e="object"==typeof s.target?s.target:null;t&&e?a.fill=je(e.data||e,t,n):e&&(a.fill=o(e,e.index).fill)}else"gradient"===e&&(a.fill="#999",a.fillOpacity=.7*i);return a}}function ld(e){const{nodes:n,edges:o,inferNodes:i=!0,sourceAccessor:r="source",targetAccessor:s="target",colorBy:a,colorScheme:l,showLegend:c,legendPosition:u,legendInteraction:d,selection:h,linkedHover:g,onObservation:f,onClick:p,chartType:y,chartId:m,marginDefaults:v,userMargin:b,width:x,height:w,loading:A,loadingContent:j,emptyContent:S,emptyDataKey:O="edges"}=e,M=t.useMemo(()=>k(o),[o]),C=t.useMemo(()=>k(n),[n]),_=gc(A,x,w,j),P=_?null:hc("nodes"===O?void 0===n?void 0:C:void 0===o?void 0:M,x,w,S),L=t.useMemo(()=>i?rd(C,M,r,s):C,[i,C,M,r,s]),T=Ql(L,a,l),R=Vl(),$=t.useMemo(()=>{if(Array.isArray(l))return l;if(R&&R.length>0)return R;if("string"==typeof l){const e=be[l];if(Array.isArray(e)&&e.length>0)return e}return xe},[l,R]),N=t.useMemo(()=>{if(!a)return[];const e=new Set;for(const t of L){const n="function"==typeof a?a(t):t[a];null!=n&&e.add(n+"")}return Array.from(e)},[L,a]),E=tc(d,a,N),{legend:B,margin:D,legendPosition:I}=ec({data:L,colorBy:a,colorScale:T,showLegend:c,legendPosition:u,userMargin:b,defaults:v,categories:N}),F=Zl({selection:h,linkedHover:g,fallbackFields:a?["string"==typeof a?a:""]:[],unwrapData:!0,onObservation:f,onClick:p,chartType:y,chartId:m}),{customHoverBehavior:H,customClickBehavior:W,activeSelectionHook:z,hoverSelectionHook:Y,crosshairSourceId:G}=F;return{safeNodes:L,safeEdges:M,colorScale:T,effectivePalette:$,themeCategorical:R,allCategories:N,legendState:E,legend:B,margin:D,legendPosition:I,customHoverBehavior:H,customClickBehavior:W,activeSelectionHook:z,hoverSelectionHook:Y,crosshairSourceId:G,loadingEl:_,emptyEl:P}}od.displayName="SwimlaneChart";const cd=t.forwardRef(function(n,o){var i;const r=t.useRef(null);Ac(o,{variant:"network",frameRef:r});const s=oc(n.mode,{width:n.width,height:n.height,enableHover:n.enableHover,showLegend:n.showLegend,showLabels:n.showLabels,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary},{width:600,height:600}),{nodes:a,edges:l,margin:c,className:u,nodeIdAccessor:d,nodeIDAccessor:h,sourceAccessor:g="source",targetAccessor:f="target",nodeLabel:p,colorBy:y,colorScheme:m,nodeSize:v=8,nodeSizeRange:b=[5,20],edgeWidth:x=1,edgeColor:k="#999",edgeOpacity:w=.6,iterations:A=300,forceStrength:j=.1,tooltip:S,frameProps:O={},onObservation:M,onClick:C,chartId:_,selection:P,linkedHover:L,loading:T,loadingContent:R,emptyContent:$,legendInteraction:N,legendPosition:E,stroke:B,strokeWidth:D,opacity:I}=n,F=null!==(i=null!=d?d:h)&&void 0!==i?i:"id",{width:H,height:W,enableHover:z,showLegend:Y,showLabels:G=!1,title:q,description:X,summary:V,accessibleTable:U}=s,Q=ld({nodes:a,edges:l,inferNodes:!1,sourceAccessor:g,targetAccessor:f,colorBy:y,colorScheme:m,showLegend:Y,legendPosition:E,legendInteraction:N,selection:P,linkedHover:L,onObservation:M,onClick:C,chartType:"ForceDirectedGraph",chartId:_,marginDefaults:s.marginDefaults,userMargin:c,width:H,height:W,loading:T,loadingContent:R,emptyContent:$,emptyDataKey:"nodes"}),K=t.useMemo(()=>new Map,[]),Z=t.useMemo(()=>e=>{const t={};return t.fill=y?je(e.data||e,y,Q.colorScale):Ul(void 0,Q.themeCategorical,m,void 0,K),"number"==typeof v&&(t.r=v),t},[y,Q.colorScale,v,Q.themeCategorical,m,K]),J=t.useMemo(()=>jc(Z,{stroke:B,strokeWidth:D,opacity:I}),[Z,B,D,I]),ee=t.useMemo(()=>e=>{const t=e.data||e;let n;if("number"==typeof x)n=x;else if("function"==typeof x)n=x(t);else{const e=t[x],o="number"==typeof e?e:Number(e);n=Number.isFinite(o)&&o>0?o:1}return{stroke:k,strokeWidth:n,opacity:w}},[x,k,w]),te=t.useMemo(()=>jc(ee,{stroke:B,strokeWidth:D,opacity:I}),[ee,B,D,I]),ne=t.useMemo(()=>{if(G&&p)return"function"==typeof p?p:e=>{var t,n,o;return null!==(o=null!==(n=null===(t=e.data)||void 0===t?void 0:t[p])&&void 0!==n?n:e[p])&&void 0!==o?o:e.id}},[G,p]),oe=xc({componentName:"ForceDirectedGraph",nodes:a,edges:l,nodesRequired:!0,edgesRequired:!0,accessors:{nodeIDAccessor:F}});return oe?e.jsx(rc,{componentName:"ForceDirectedGraph",message:oe,width:H,height:W}):Q.loadingEl?Q.loadingEl:Q.emptyEl?Q.emptyEl:e.jsx(cc,{componentName:"ForceDirectedGraph",width:H,height:W,children:e.jsx(ol,Object.assign({ref:r,chartType:"force"},null!=a&&{nodes:Q.safeNodes},null!=l&&{edges:Q.safeEdges},{size:[H,W],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:Q.margin,nodeIDAccessor:F,sourceAccessor:g,targetAccessor:f,iterations:A,forceStrength:j,nodeStyle:J,edgeStyle:te,colorBy:y,colorScheme:Q.effectivePalette,nodeSize:v,nodeSizeRange:b,nodeLabel:ne,showLabels:G,enableHover:z,tooltipContent:!1===S?()=>null:ji(S)||void 0,customHoverBehavior:L||M||C?Q.customHoverBehavior:void 0,customClickBehavior:M||C?Q.customClickBehavior:void 0,legend:Q.legend,legendPosition:Q.legendPosition},N&&"none"!==N&&{legendHoverBehavior:Q.legendState.onLegendHover,legendClickBehavior:Q.legendState.onLegendClick,legendHighlightedCategory:Q.legendState.highlightedCategory,legendIsolatedCategories:Q.legendState.isolatedCategories},{className:u,title:q,description:X,summary:V,accessibleTable:U},null!=n.animate&&{animate:n.animate},O))})});cd.displayName="ForceDirectedGraph";const ud=t.forwardRef(function(n,o){const i=t.useRef(null);Ac(o,{variant:"network",frameRef:i,overrides:{getData:()=>{var e,t,n,o;return null!==(o=null===(n=null===(t=null===(e=i.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!==o?o:[]}}});const r=oc(n.mode,{width:n.width,height:n.height,enableHover:n.enableHover,showLabels:n.showLabels,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary},{width:600,height:600}),{nodes:s,edges:a,margin:l,className:c,sourceAccessor:u="source",targetAccessor:d="target",valueAccessor:h="value",nodeIdAccessor:g="id",colorBy:f,colorScheme:p,edgeColorBy:y="source",padAngle:m=.01,groupWidth:v=20,sortGroups:b,nodeLabel:x,edgeOpacity:k=.5,tooltip:w,frameProps:A={},onObservation:j,onClick:S,chartId:O,selection:M,linkedHover:C,loading:_,loadingContent:P,emptyContent:L,legendInteraction:T,stroke:R,strokeWidth:$,opacity:N}=n,{width:E,height:B,enableHover:D,showLabels:I=!0,title:F,description:H,summary:W,accessibleTable:z}=r,Y=ld({nodes:s,edges:a,inferNodes:!0,sourceAccessor:u,targetAccessor:d,colorBy:f,colorScheme:p,showLegend:!1,legendInteraction:T,selection:M,linkedHover:C,onObservation:j,onClick:S,chartType:"ChordDiagram",chartId:O,marginDefaults:r.marginDefaults,userMargin:l,width:E,height:B,loading:_,loadingContent:P,emptyContent:L}),G=t.useMemo(()=>new Map,[]),q=Y.safeNodes.length>0,X=t.useMemo(()=>{if(q)return(e,t)=>{var n,o;const i={stroke:"black",strokeWidth:1};if(f)i.fill=je(e.data||e,f,Y.colorScale);else{const r=Array.isArray(p)?p:be[p]||xe,s=Array.isArray(r)?r:xe,a=null!==(o=null!==(n=e.index)&&void 0!==n?n:t)&&void 0!==o?o:0;i.fill=s[a%s.length]}return i}},[q,f,Y.colorScale,p]),V=t.useMemo(()=>X?jc(X,{stroke:R,strokeWidth:$,opacity:N}):void 0,[X,R,$,N]),U=t.useMemo(()=>{if(q)return ad({edgeColorBy:y,colorBy:f,colorScale:Y.colorScale,nodeStyleFn:V||(e=>({fill:Ul(void 0,Y.themeCategorical,p,void 0,G)})),edgeOpacity:k,baseStyle:{stroke:"black",strokeWidth:.5,strokeOpacity:k}})},[q,y,f,Y.colorScale,V,k,Y.themeCategorical,p,G]),Q=t.useMemo(()=>U?jc(U,{stroke:R,strokeWidth:$,opacity:N}):void 0,[U,R,$,N]),K=t.useMemo(()=>{if(!I)return;const e=x||g;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}},[I,x,g]),Z=xc({componentName:"ChordDiagram",edges:a,edgesRequired:!0});return Z?e.jsx(rc,{componentName:"ChordDiagram",message:Z,width:E,height:B}):Y.loadingEl?Y.loadingEl:Y.emptyEl?Y.emptyEl:e.jsx(cc,{componentName:"ChordDiagram",width:E,height:B,children:e.jsx(ol,Object.assign({ref:i,chartType:"chord"},Y.safeNodes.length>0&&{nodes:Y.safeNodes},null!=a&&{edges:Y.safeEdges},{size:[E,B],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:Y.margin,nodeIDAccessor:g,sourceAccessor:u,targetAccessor:d,valueAccessor:h,padAngle:m,groupWidth:v,sortGroups:b,nodeStyle:V,edgeStyle:Q,colorBy:f,colorScheme:Y.effectivePalette,edgeColorBy:y,edgeOpacity:k,nodeLabel:K,showLabels:I,enableHover:D,tooltipContent:!1===w?()=>null:ji(w)||void 0,customHoverBehavior:C||j||S?Y.customHoverBehavior:void 0,customClickBehavior:j||S?Y.customClickBehavior:void 0},T&&"none"!==T&&{legendHoverBehavior:Y.legendState.onLegendHover,legendClickBehavior:Y.legendState.onLegendClick,legendHighlightedCategory:Y.legendState.highlightedCategory,legendIsolatedCategories:Y.legendState.isolatedCategories},{className:c,title:F,description:H,summary:W,accessibleTable:z},null!=n.animate&&{animate:n.animate},A))})});ud.displayName="ChordDiagram";const dd=t.forwardRef(function(n,o){const i=t.useRef(null);Ac(o,{variant:"network",frameRef:i,overrides:{getData:()=>{var e,t,n,o;return null!==(o=null===(n=null===(t=null===(e=i.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!==o?o:[]}}});const r=oc(n.mode,{width:n.width,height:n.height,enableHover:n.enableHover,showLabels:n.showLabels,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary},{width:800,height:600}),{nodes:s,edges:a,margin:l,className:c,sourceAccessor:u="source",targetAccessor:d="target",valueAccessor:h="value",nodeIdAccessor:g="id",colorBy:f,colorScheme:p,edgeColorBy:y="source",orientation:m="horizontal",nodeAlign:v="justify",nodePaddingRatio:b=.05,nodeWidth:x=15,nodeLabel:k,edgeOpacity:w=.5,edgeSort:A,tooltip:j,frameProps:S={},onObservation:O,onClick:M,chartId:C,selection:_,linkedHover:P,loading:L,loadingContent:T,emptyContent:R,showLegend:$,legendPosition:N,legendInteraction:E,stroke:B,strokeWidth:D,opacity:I}=n,{width:F,height:H,enableHover:W,showLabels:z=!0,title:Y,description:G,summary:q,accessibleTable:X}=r,V=ld({nodes:s,edges:a,inferNodes:!0,sourceAccessor:u,targetAccessor:d,colorBy:f,colorScheme:p,showLegend:$,legendPosition:N,legendInteraction:E,selection:_,linkedHover:P,onObservation:O,onClick:M,chartType:"SankeyDiagram",chartId:C,marginDefaults:r.marginDefaults,userMargin:l,width:F,height:H,loading:L,loadingContent:T,emptyContent:R}),U=t.useMemo(()=>new Map,[]),Q=t.useMemo(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=f?je(e.data||e,f,V.colorScale):Ul(void 0,V.themeCategorical,p,void 0,U),t},[f,V.colorScale,V.themeCategorical,p,U]),K=t.useMemo(()=>jc(Q,{stroke:B,strokeWidth:D,opacity:I}),[Q,B,D,I]),Z=t.useMemo(()=>ad({edgeColorBy:y,colorBy:f,colorScale:V.colorScale,nodeStyleFn:K,edgeOpacity:w,baseStyle:{stroke:"none",strokeWidth:0}}),[y,f,V.colorScale,K,w]),J=t.useMemo(()=>jc(Z,{stroke:B,strokeWidth:D,opacity:I}),[Z,B,D,I]),ee=t.useMemo(()=>{if(!z)return;const e=k||g;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}},[z,k,g]),te=xc({componentName:"SankeyDiagram",edges:a,edgesRequired:!0});return te?e.jsx(rc,{componentName:"SankeyDiagram",message:te,width:F,height:H}):V.loadingEl?V.loadingEl:V.emptyEl?V.emptyEl:e.jsx(cc,{componentName:"SankeyDiagram",width:F,height:H,children:e.jsx(ol,Object.assign({ref:i,chartType:"sankey"},V.safeNodes.length>0&&{nodes:V.safeNodes},null!=a&&{edges:V.safeEdges},{size:[F,H],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:V.margin,nodeIDAccessor:g,sourceAccessor:u,targetAccessor:d,valueAccessor:h,orientation:m,nodeAlign:v,nodePaddingRatio:b,nodeWidth:x,nodeStyle:K,edgeStyle:J,colorBy:f,colorScheme:V.effectivePalette,edgeColorBy:y,edgeOpacity:w,edgeSort:A,nodeLabel:ee,showLabels:z,enableHover:W,tooltipContent:!1===j?()=>null:ji(j)||void 0,customHoverBehavior:P||O||M?V.customHoverBehavior:void 0,customClickBehavior:O||M?V.customClickBehavior:void 0,legend:V.legend,legendPosition:V.legendPosition},E&&"none"!==E&&{legendHoverBehavior:V.legendState.onLegendHover,legendClickBehavior:V.legendState.onLegendClick,legendHighlightedCategory:V.legendState.highlightedCategory,legendIsolatedCategories:V.legendState.isolatedCategories},{className:c,title:Y,description:G,summary:q,accessibleTable:X},null!=n.animate&&{animate:n.animate},S))})});function hd(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 s={create:0,in:1,"transfer-out":2,"transfer-in":3,out:4},a=()=>{r.sort((e,t)=>{var n,o;return e.time-t.time||(null!==(n=s[e.kind])&&void 0!==n?n:99)-(null!==(o=s[t.kind])&&void 0!==o?o:99)})},l=r.length?function(e,t=1/0){let n=t;for(const t of e)n>t&&(n=t);return n}(r.map(e=>e.time)):null,c=Array.isArray(e.xExtent)&&Number.isFinite(e.xExtent[0])?e.xExtent[0]:null,u=null!=c?c-1:null!=l&&Number.isFinite(l)?l-1:null,d=[...new Set(r.map(e=>e.time))].sort((e,t)=>e-t),h=new Map;for(let e=1;d.length>e;e++)h.set(d[e],d[e-1]);const g=e=>{const t=h.get(e);return null!=t?(t+e)/2:null!=u?u:e};a();const f=[];let p=0,y=0;for(const e of r)if("out"===e.kind){const t=Math.abs(e.delta);let 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),a();let m=0,v=0,b=0,x=0,k=0;const w=[],A=new Map;for(const e of r){if(w.push({t:e.time,topMass:m,botMass:v}),("in"===e.kind||"out"===e.kind)&&e.edge){const t="top"===e.side?m:v;A.set(e.edge.id,{side:e.side,time:e.time,sideMassBefore:t,sideMassAfter:t+e.delta,kind:e.kind,value:Math.abs(e.delta)})}"top"===e.side?m+=e.delta:v+=e.delta,m+v>b&&(b=m+v),m>x&&(x=m),v>k&&(k=v),w.push({t:e.time,topMass:m,botMass:v})}const j=[];let S=0;for(;w.length>S;){let e=S;for(;w.length>e+1&&w[e+1].t===w[S].t;)e++;j.push(w[S]);for(let t=S+1;e>=t;t++){const e=j[j.length-1];w[t].topMass===e.topMass&&w[t].botMass===e.botMass||j.push(w[t])}S=e+1}const O=Array.isArray(e.xExtent)&&Number.isFinite(e.xExtent[1])?e.xExtent[1]:null;let M=null;for(const e of i)null!=e.systemInTime&&Number.isFinite(e.systemInTime)&&e.startTime>e.systemInTime&&(null===M||M>e.systemInTime)&&(M=e.systemInTime);let C=null;for(const e of o)null!=e.systemOutTime&&Number.isFinite(e.systemOutTime)&&e.systemOutTime>e.endTime&&(null===C||e.systemOutTime>C)&&(C=e.systemOutTime);if(j.length>0){const e=j[j.length-1],t=Math.max(null!=O?O:-1/0,null!=C?C:-1/0);Number.isFinite(t)&&t>e.t&&e.topMass+e.botMass>0&&j.push({t:t,topMass:e.topMass,botMass:e.botMass});const n=j[0],o=Math.min(null!=c?c:1/0,null!=M?M:1/0);Number.isFinite(o)&&n.t>o&&n.topMass+n.botMass>0&&j.unshift({t:o,topMass:n.topMass,botMass:n.botMass})}return{samples:j,peak:b,topPeak:x,botPeak:k,localAttachments:A}}function gd(e,t){return t?Math.max(t[0],Math.min(t[1],e)):e}function fd(e,t){return e.map(e=>({t:gd(e.t,t),topMass:e.topMass,botMass:e.botMass}))}function pd(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 yd(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],s=t[i];r.source!==s.source&&r.target!==s.target&&r.source!==s.target&&r.target!==s.source&&(Math.min(r.endTime,s.endTime)>Math.max(r.startTime,s.startTime)&&e[s.source]>e[r.source]!=e[s.target]>e[r.target]&&n++)}return n}function md(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 vd(e,t){return 1e3*yd(e,t)+md(e,t)}function bd(e,t){return{slots:e.map(e=>({peak:Object.assign({},e.peak),occupants:e.occupants.slice()})),map:Object.assign({},t)}}function xd(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=bd(e,t),s=vd(t,n);for(let a=0;o>a;a++){const o=Array(i).fill(0),a=Array(i).fill(0);for(const e of n){const n=t[e.source],i=t[e.target];o[n]+=i*(e.value||1),a[n]+=e.value||1,o[i]+=n*(e.value||1),a[i]+=e.value||1}const l=Array.from({length:i},(e,t)=>t).sort((e,t)=>(a[e]>0?o[e]/a[e]:e)-(a[t]>0?o[t]/a[t]:t)),c=l.map(t=>e[t]),u=new Map;l.forEach((e,t)=>u.set(e,t));for(const e of Object.keys(t))t[e]=u.get(t[e]);e.length=0;for(const t of c)e.push(t);const d=vd(t,n);if(s>d)s=d,r=bd(e,t);else if(d===s)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=vd(t,n);for(let s=0;o>s;s++){let o=!1;for(let s=0;i-1>s;s++){const i=e[s];e[s]=e[s+1],e[s+1]=i;for(const e of Object.keys(t))t[e]===s?t[e]=s+1:t[e]===s+1&&(t[e]=s);const a=vd(t,n);if(r>a)r=a,o=!0;else{const n=e[s];e[s]=e[s+1],e[s+1]=n;for(const e of Object.keys(t))t[e]===s?t[e]=s+1:t[e]===s+1&&(t[e]=s)}}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),s=Array.from({length:o},(e,t)=>t),a=s.slice(),l=Object.assign({},i);let c=s.slice(),u=1/0;const d=()=>{for(const e of r)l[e]=a[i[e]];const e=vd(l,n);u>e&&(u=e,c=s.slice())},h=(e,t)=>{const n=s[e],o=s[t];s[e]=o,s[t]=n,a[n]=t,a[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 kd(e,t,n,o,i){var r,s,a,l,c,u,d,h;const{plotH:g,padding:f,valueScale:p,packing:y,laneOrder:m,lifetimeMode:v="full"}=i,b={},x={};for(const t of e)b[t.id]=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={},j=[];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!==(s=i.get(t.id))&&void 0!==s?s:0)&&d.push(t.id);for(;d.length;){const e=d.shift();for(const t of null!==(a=o.outgoing[e])&&void 0!==a?a:[]){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,s=null!==(i=n.get(t.id))&&void 0!==i?i:0;return r!==s?r-s:w[e.id].start-w[t.id].start}),g=e.filter(e=>null===w[e.id].start);for(const e of[...h,...g]){const t=w[e.id];let n=-1;for(let e=0;j.length>e;e++){const o=j[e].occupants[j[e].occupants.length-1];if(null===t.start||void 0===o||t.start>=o.end){n=e;break}}-1===n&&(j.push({occupants:[],peak:{topPeak:0,botPeak:0}}),n=j.length-1),j[n].occupants.push({id:e.id,end:null!==(u=null==t?void 0:t.end)&&void 0!==u?u:-1/0}),j[n].peak.topPeak=Math.max(j[n].peak.topPeak,b[e.id]),j[n].peak.botPeak=Math.max(j[n].peak.botPeak,x[e.id]),A[e.id]=n}}else e.forEach((e,t)=>{var n,o;j.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 S=null,O=null,M=null,C=null;const _=()=>{S=yd(A,t),M=md(A,t)},P=()=>{O=yd(A,t),C=md(A,t)};"crossing-min"===m?(_(),xd(j,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),s=Math.floor((n-1)/2);r[s]=i[0].idx;let a=s-1,l=s+1;for(let e=1;i.length>e;e++)e%2==1&&n>l||0>a?r[l++]=i[e].idx:r[a--]=i[e].idx;const c=r.map(t=>e[t]),u=new Map;r.forEach((e,t)=>u.set(e,t));for(const e of Object.keys(t))t[e]=u.get(t[e]);e.length=0;for(const t of c)e.push(t)}(j,A),P()):"crossing-min+inside-out"===m&&(_(),xd(j,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 s=vd(t,n);for(const{slot:a}of i){const i=e.indexOf(a);if(0>i)continue;const l=r;if(i===l)continue;const c=e[i];e.splice(i,1),e.splice(l,0,c);const u=new Map;for(let e=0;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=vd(t,n);if(d>s){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 s=d}}(j,A,t),P());const L=j.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},R=[];for(let e=0;j.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)}R.push(i)}const $=[];let N=f+(null!==(h=null===(d=j[0])||void 0===d?void 0:d.peak.topPeak)&&void 0!==h?h:0)*p;j.length>0&&$.push(N);for(let e=1;j.length>e;e++)N+=R[e-1]*p+f,$.push(N);if(j.length>0&&(N+=j[j.length-1].peak.botPeak*p+f),N>g){const e=g/N;for(let t=0;$.length>t;t++)$[t]*=e}const E=0===j.length?0:j[0].peak.topPeak+R.reduce((e,t)=>e+t,0)+j[j.length-1].peak.botPeak,B={};for(const t of e)B[t.id]=$[A[t.id]];return{effectiveSlotsHeight:E,centerlines:B,laneLifetime:w,slots:j,slotByNode:A,slotCenter:$,crossingsBefore:S,crossingsAfter:O,lengthBefore:M,lengthAfter:C}}dd.displayName="SankeyDiagram";const wd=e=>{var t,n;const{bands:o=[],ribbons:i=[],showLabels:r=!0}=e.config,s=[];for(const e of i)s.push(Object.assign(Object.assign({type:"bezier",pathD:e.pathD},e.bezier&&{bezierCache:e.bezier}),{style:{fill:e.fill,opacity:e.opacity,stroke:"none"},datum:{__kind:"ribbon",data:e.rawDatum,id:e.id}}));for(const e of o)if(e.gradientStubs)for(let t=0;e.gradientStubs.length>t;t++){const n=e.gradientStubs[t];s.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)s.push({type:"bezier",pathD:e.pathD,style:Object.assign(Object.assign({},e.gradientStubs&&e.gradientStubs.length>0?{fill:"none"}:{fill:e.fill,fillOpacity:.86}),{stroke:null!==(t=e.stroke)&&void 0!==t?t:e.fill,strokeWidth:null!==(n=e.strokeWidth)&&void 0!==n?n:.5}),datum:{__kind:"band",data:e.rawDatum,id:e.id}});const a=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:s,labels:a}};function Ad(e){return"object"==typeof e&&null!==e&&"__kind"in e&&("band"===e.__kind||"ribbon"===e.__kind)}function jd(e){return null==e?NaN:e instanceof Date?e.getTime():"number"==typeof e?e:new Date(e).getTime()}function Sd(e,t){return"function"==typeof e?e(t):t[e]}const Od=t.forwardRef(function(n,o){const{nodes:r,edges:s,domain:a,axisTicks:l=[],nodeIdAccessor:c="id",sourceAccessor:u="source",targetAccessor:d="target",valueAccessor:h="value",startTimeAccessor:g="startTime",endTimeAccessor:f="endTime",systemInTimeAccessor:p,systemOutTimeAccessor:y,xExtentAccessor:m="xExtent",edgeIdAccessor:v="id",colorBy:b,colorScheme:x,showLegend:w,legendPosition:A="right",pairing:j="temporal",packing:S="reuse",laneOrder:O="crossing-min",ribbonLane:M="both",lifetimeMode:C="half",showLaneRails:_=!1,showQualityReadout:P=!1,showLabels:L=!0,width:T=600,height:R=400,margin:$,title:N,description:E,summary:B,accessibleTable:D,responsiveWidth:I,responsiveHeight:F,loading:H,loadingContent:W,emptyContent:z,edgeOpacity:Y=.35,timeFormat:G,valueFormat:q,tooltip:X,enableHover:V=!0,onObservation:U,onClick:Q,showParticles:K=!1,particleStyle:Z,chartId:J,frameProps:ee={}}=n,[te,ne]=t.useState([]),[oe,ie]=t.useState([]),re=t.useRef(te),se=t.useRef(oe);re.current=te,se.current=oe;const ae=t.useCallback(e=>{re.current=e,ne(e)},[]),le=t.useCallback(e=>{se.current=e,ie(e)},[]),ce=void 0!==s,ue=k(ce?s:te),de=t.useMemo(()=>{const e=k(null!=r?r:[]),t=oe;if(0===e.length&&0===t.length)return rd([],ue,u,d);const n=new Set,o=[];for(const t of e){const e=Sd(c,t)+"";n.has(e)||(n.add(e),o.push(t))}for(const e of t){const t=Sd(c,e)+"";n.has(t)||(n.add(t),o.push(e))}const i=rd([],ue,u,d);for(const e of i)n.has(e.id)||(n.add(e.id),o.push(e));return o},[r,oe,ue,c,u,d]),he=t.useRef(null),ge=t.useCallback((e,t)=>{const n=Sd(v,e);return null!=n?n+"":`${Sd(u,e)}-${Sd(d,e)}-${t}`},[v,u,d]),fe=t.useCallback(e=>{if(null==e)return!1;const t=e;return null!=Sd(u,t)&&null!=Sd(d,t)},[u,d]);Ac(o,{variant:"network",frameRef:he,overrides:{push(e){if(fe(e)){if(ce)return void console.warn("ProcessSankey.push: edge ignored — `edges` prop is controlled.");ae([...re.current,e])}else le([...se.current,e])},pushMany(e){const t=[],n=[];for(const o of e)fe(o)?t.push(o):n.push(o);t.length>0&&(ce?console.warn("ProcessSankey.pushMany: edges ignored — `edges` prop is controlled."):ae([...re.current,...t])),n.length>0&&le([...se.current,...n])},remove(e){const t=new Set(Array.isArray(e)?e:[e]),n=[];if(!ce){const e=re.current,o=[];for(let i=0;e.length>i;i++){const r=e[i];t.has(ge(r,i))?n.push(r):o.push(r)}o.length!==e.length&&ae(o)}const o=se.current,i=[];for(const e of o){const o=Sd(c,e)+"";t.has(o)?n.push(e):i.push(e)}return i.length!==o.length&&le(i),n},update(e,t){const n=new Set(Array.isArray(e)?e:[e]),o=[];if(!ce){let e=!1;const i=re.current.map((i,r)=>n.has(ge(i,r))?(o.push(i),e=!0,t(i)):i);e&&ae(i)}let i=!1;const r=se.current.map(e=>{const r=Sd(c,e)+"";return n.has(r)?(o.push(e),i=!0,t(e)):e});return i&&le(r),o},clear(){var e;ce||ae([]),le([]),null===(e=he.current)||void 0===e||e.clear()},getData:()=>null!=ue?ue:[],getScales:()=>null},deps:[ce,fe,ge,c,ue,ae,le]});const pe=ge,ye=t.useCallback(e=>Sd(c,e)+"",[c]),{nodes:me,edges:ve,domain:be,rawNodeById:xe,rawEdgeById:ke}=t.useMemo(()=>{const e=(null!=de?de:[]).map(e=>{const t={id:ye(e),__raw:e},n=m?Sd(m,e):null;if(Array.isArray(n)&&2===n.length){const e=jd(n[0]),o=jd(n[1]);Number.isFinite(e)&&Number.isFinite(o)&&(t.xExtent=[e,o])}return t}),t=(null!=ue?ue:[]).map((e,t)=>{const n={id:pe(e,t),source:Sd(u,e)+"",target:Sd(d,e)+"",value:Number(Sd(h,e)),startTime:jd(Sd(g,e)),endTime:jd(Sd(f,e)),__raw:e};if(p){const t=jd(Sd(p,e));Number.isFinite(t)&&(n.systemInTime=t)}if(y){const t=jd(Sd(y,e));Number.isFinite(t)&&(n.systemOutTime=t)}return n}),n=[jd(a[0]),jd(a[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}},[de,ue,a,ye,pe,m,u,d,h,g,f,p,y]),we=ld({nodes:de,edges:ue,inferNodes:!1,sourceAccessor:u,targetAccessor:d,colorBy:b,colorScheme:x,showLegend:!1,legendPosition:A,selection:void 0,linkedHover:void 0,onObservation:U,onClick:Q,chartType:"ProcessSankey",chartId:J,marginDefaults:{top:30,right:80,bottom:40,left:80},userMargin:$,width:T,height:R,loading:H,loadingContent:W,emptyContent:z}),Ae=(null!=w?w:!!b)&&!!b,Se=t.useCallback(e=>null!=$&&("number"==typeof $||null!=$[e]),[$]),Oe=t.useMemo(()=>{const e=Object.assign({},we.margin);return Ae&&("right"===A&&!Se("right")&&140>e.right?e.right=140:"bottom"===A&&!Se("bottom")&&80>e.bottom&&(e.bottom=80)),e},[we.margin,Ae,A,Se]),Me=T-Oe.left-Oe.right,Ce=R-Oe.top-Oe.bottom,_e=t.useMemo(()=>function(e,t,n){const o=[],i=new Set(e.map(e=>e.id)),r=Array.isArray(n)&&2===n.length,s=r&&Number.isFinite(n[0])&&Number.isFinite(n[1]);r&&s&&s&&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}(me,ve,be),[me,ve,be]),Pe=t.useMemo(()=>_e.length>0?null:function(e,t,n){var o;const{plotH:i,pairing:r="temporal",packing:s="reuse",laneOrder:a="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,s=new Map;for(const e of t)s.set(e.id,{});const a=(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 s=[...n.values()];s.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 s)e.edges.sort("target"===t?r:i);return s};for(const t of e){const e=n.outgoing[t.id],o=n.incoming[t.id];if(0===o.length)a(e,"target").forEach((e,t)=>{const n=t%2==0?"top":"bot";for(const t of e.edges)s.get(t.id).sourceSide=n});else if(0===e.length)a(o,"source").forEach((e,t)=>{const n=t%2==0?"top":"bot";for(const t of e.edges)s.get(t.id).targetSide=n});else{const t=a(o,"source"),n=a(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)s.get(n.id).targetSide=o;if(n[e])for(const t of n[e].edges)s.get(t.id).sourceSide=o}}}return s}(e,t,c,r);let d={};for(const t of e)d[t.id]=hd(t,c,u);const h=kd(e,t,d,c,{plotH:i,padding:12,valueScale:1,packing:s,laneOrder:a,lifetimeMode:l}),g=new Set;for(const e of t){const t=h.slotByNode[e.source],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,s="top"===t?i.inTop-i.outTop:i.inBot-i.outBot;if(0>=r||0>=s)return!1;const a=Math.min(r,s),l=n.filter(t=>!g.has(t.id)&&u.get(t.id).sourceSide===e&&a>=t.value).sort((e,t)=>t.value-e.value);return 0!==l.length&&(u.get(l[0].id).sourceSide=t,!0)};let r=n.length+1;for(;r-- >0&&(i("top","bot")||i("bot","top")););}d={};for(const t of e)d[t.id]=hd(t,c,u);const f=kd(e,t,d,c,{plotH:i,padding:12,valueScale:1,packing:s,laneOrder:a,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=kd(e,t,d,c,{plotH:i,padding:y,valueScale:m,packing:s,laneOrder:a,lifetimeMode:l});return{nodeData:d,sides:u,valueScale:m,padding:y,compressedPadding:12>y,centerlines:v.centerlines,laneLifetime:v.laneLifetime,slots:v.slots,slotByNode:v.slotByNode,crossingsBefore:v.crossingsBefore,crossingsAfter:v.crossingsAfter,lengthBefore:v.lengthBefore,lengthAfter:v.lengthAfter}}(me,ve,{plotH:Ce,pairing:j,packing:S,laneOrder:O,lifetimeMode:C}),[_e,me,ve,Ce,j,S,O,C]),Le=t.useMemo(()=>i.scaleTime().domain(be).range([0,Me]),[be,Me]),Te=t.useCallback((e,t)=>{if(b&&de){const t=xe.get(e);if(t)return je(t,b,we.colorScale)}return we.effectivePalette[t%we.effectivePalette.length]||"#475569"},[b,de,xe,we.colorScale,we.effectivePalette]),Re=t.useMemo(()=>{const e=new Map;return me.forEach((t,n)=>e.set(t.id,n)),e},[me]),$e=t.useMemo(()=>{if(!Pe)return{bands:[],ribbons:[]};const{centerlines:e,nodeData:t,valueScale:n}=Pe,o=[],i=[];return me.forEach((i,r)=>{var s;const a=t[i.id];if(!a||0===a.samples.length)return;const l=function(e,t,n,o,i){if(0===e.length)return null;const r=fd(e,i),s=e=>t-r[e].topMass*n,a=e=>t+r[e].botMass*n;let l=`M${o(r[0].t)},${s(0)}`;for(let e=1;r.length>e;e++)l+=` L${o(r[e].t)},${s(e)}`;l+=` L${o(r[r.length-1].t)},${a(r.length-1)}`;for(let e=r.length-2;e>=0;e--)l+=` L${o(r[e].t)},${a(e)}`;return l+" Z"}(a.samples,e[i.id],n,Le,be);if(!l)return;const c=fd(a.samples,be),u=c.find(e=>e.topMass+e.botMass>0)||c[0],d=e[i.id]+(u.botMass-u.topMass)*n/2,h=Te(i.id,r),g=null!==(s=xe.get(i.id))&&void 0!==s?s:i,f=function(e,t,n,o,i){const r=n.nodeData[e];if(!r||0===r.samples.length)return[];const s=n.valueScale,a=n.centerlines[e],l=fd(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(gd(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]=pd(e,a,s);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]=pd(e,a,s);f.push({pathD:p(o,n,r,l),x0:t,x1:i,from:1,to:0})}}}}return f}(i.id,ve,Pe,Le,be);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:Le(u.t)-4,labelY:d,labelText:i.id}))}),ve.forEach(o=>{var r,s,a,l;const c=null===(r=t[o.source])||void 0===r?void 0:r.localAttachments.get(o.id),u=null===(s=t[o.target])||void 0===s?void 0:s.localAttachments.get(o.id);if(!c||!u)return;const d=null!==(a=Re.get(o.source))&&void 0!==a?a:0,h=Te(o.source,d),g=function(e,t,n,o,i,r,s,a){const l=i,c=e=>a?Math.max(a[0],Math.min(a[1],e)):e,u=r(c(e.time)),d=r(c(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"===s?u+.85*(d-u):"target"===s?u+.15*(d-u):(u+d)/2;return{sx:u,sTop:y,sBot:m,tx:d,tTop:v,tBot:b,cp1X:x,cp2X:x}}(c,e[o.source],u,e[o.target],n,Le,M,be),{pathD:f,bezier:p}=Zs(g),y=null!==(l=ke.get(o.id))&&void 0!==l?l:o;i.push({id:o.id,pathD:f,fill:h,opacity:Y,rawDatum:y,bezier:p})}),{bands:o,ribbons:i}},[Pe,me,ve,Le,be,Te,xe,ke,M,Y,Re]),Ne=t.useMemo(()=>({bands:$e.bands,ribbons:$e.ribbons,showLabels:L}),[$e,L]),Ee=t.useMemo(()=>{if(!Ae||!b)return;const e=new Map;(null!=de?de:[]).forEach((t,n)=>{const o=Sd(b,t),i=null==o?"":o+"";i&&!e.has(i)&&e.set(i,{label:i,color:Te(ye(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},[Ae,b,de,Te,ye]),Be=t.useMemo(()=>!1!==X&&V?void 0===X||!0===X?null:ji(X)||null:null,[X,V]),De=t.useCallback(e=>G?G(new Date(e)):Number.isFinite(e)?1e10>Math.abs(e)?Number.isInteger(e)?e+"":e.toFixed(2):new Date(e).toISOString().slice(0,10):"",[G]),Ie=t.useCallback(e=>q?q(e):e+"",[q]),Fe=t.useCallback(t=>{if(!t||!t.data)return null;const n=t.data;if(!Ad(n))return null;const o=n.data;if(Be)return Be(o);if("band"===n.__kind){const t=n.id,o=Pe?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}(Pe.nodeData[t]):[],i=5,r=o.length>i?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,s=[];for(const e of i)r.has(e.t)||(r.add(e.t),s.push(e));return s.sort((e,t)=>e.t-t.t)}(o,i);return e.jsxs("div",{style:{minWidth:160},children:[e.jsx("div",{style:{fontWeight:600,marginBottom:4},children:t}),s.length>0&&e.jsxs("table",{style:{borderCollapse:"collapse",fontSize:11,width:"100%"},children:[e.jsx("thead",{children:e.jsxs("tr",{style:{opacity:.6},children:[e.jsx("th",{style:{textAlign:"left",fontWeight:500,paddingRight:8},children:"Time"}),e.jsx("th",{style:{textAlign:"right",fontWeight:500},children:"Mass"}),null!=r&&e.jsx("th",{})]})}),e.jsx("tbody",{children:s.map((t,n)=>e.jsxs("tr",{children:[e.jsx("td",{style:{paddingRight:8},children:De(t.t)}),e.jsx("td",{style:{textAlign:"right"},children:Ie(t.total)}),null!=r&&e.jsx("td",{style:{textAlign:"right",paddingLeft:8,opacity:.55},children:t.mark})]},n))})]}),null!=r&&e.jsxs("div",{style:{marginTop:4,fontSize:10,opacity:.55},children:["showing ",s.length," of ",r," samples"]})]})}const i=o,r=Sd(u,i),s=Sd(d,i),a=Sd(h,i),l=Sd(g,i),c=Sd(f,i);return e.jsxs("div",{style:{minWidth:160},children:[e.jsxs("div",{style:{fontWeight:600,marginBottom:4},children:[r+""," → ",s+""]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"auto 1fr",columnGap:8,fontSize:11},children:[null!=a&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{opacity:.6},children:"value"}),e.jsx("span",{style:{textAlign:"right"},children:Ie(Number(a))})]}),null!=l&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{opacity:.6},children:"start"}),e.jsx("span",{style:{textAlign:"right"},children:De(jd(l))})]}),null!=c&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{opacity:.6},children:"end"}),e.jsx("span",{style:{textAlign:"right"},children:De(jd(c))})]})]})]})},[Pe,Be,De,Ie,u,d,h,g,f]),He=t.useMemo(()=>{if(!Pe)return null;const{centerlines:t,laneLifetime:n,nodeData:o,valueScale:i,compressedPadding:r,crossingsBefore:s,crossingsAfter:a,lengthBefore:c,lengthAfter:u}=Pe;let d=null,h=null;for(const e of me){const t=n[e.id];if(!t||null===t.start||null===t.end)continue;const o=Le(t.start),i=Le(t.end);(null===d||d>o)&&(d=o),(null===h||i>h)&&(h=i)}const g=e=>Math.max(0,Math.min(Me,e)),f=g(null!=d?d:0),p=Math.max(f,g(null!=h?h:Me));return e.jsxs("g",{children:[P&&null!==(null!=a?a:null)&&e.jsxs("text",{x:Me,y:-12,fontSize:10,fill:"#94a3b8",textAnchor:"end",children:["crossings: ",s," → ",a," ","edge length: ",Math.round(c)," → ",Math.round(u)]}),r&&e.jsx("text",{x:Me,y:2,fontSize:10,fill:"#94a3b8",textAnchor:"end",children:"dense layout: lane gaps compressed"}),l.map((t,n)=>{const o=Le(jd(t.date));return f-.5>o||o>p+.5?null:e.jsx("line",{x1:o,y1:0,x2:o,y2:Ce,stroke:"#94a3b8",strokeOpacity:.15,strokeDasharray:"2 4"},"grid-"+n)}),_&&me.map((r,s)=>{const a=n[r.id];if(!a||null===a.start)return null;const l=o[r.id],c=l?{topPeak:l.topPeak,botPeak:l.botPeak}:{topPeak:0,botPeak:0},u=t[r.id]+(c.botPeak-c.topPeak)*i/2,d=Le(a.start),h=Le(a.end),g=Te(r.id,s);return e.jsxs("g",{children:[e.jsx("line",{x1:d,y1:u,x2:h,y2:u,stroke:g,strokeOpacity:.35,strokeWidth:1,strokeDasharray:"3 3"}),e.jsx("line",{x1:d,y1:u-4,x2:d,y2:u+4,stroke:g,strokeOpacity:.5}),e.jsx("line",{x1:h,y1:u-4,x2:h,y2:u+4,stroke:g,strokeOpacity:.5})]},"lane-"+r.id)}),e.jsx("line",{x1:f,y1:Ce+4,x2:p,y2:Ce+4,stroke:"#94a3b8"}),l.map((t,n)=>{const o=jd(t.date),i=Le(o);if(f-.5>i||i>p+.5)return null;const r=null!=t.label?t.label:G?G(new Date(o)):"";return e.jsxs("g",{transform:`translate(${i},${Ce+4})`,children:[e.jsx("line",{y2:6,stroke:"#94a3b8"}),e.jsx("text",{y:20,textAnchor:"middle",fontSize:11,fill:"#475569",children:r})]},n)})]})},[Pe,l,Le,Me,Ce,_,me,Te,P,G]),We=t.useMemo(()=>(null!=de?de:[]).map(e=>({id:ye(e),data:e})),[de,ye]),ze=t.useMemo(()=>{const e=new Map;for(const t of $e.ribbons)t.bezier&&e.set(t.id,t.bezier);return e},[$e]),Ye=t.useMemo(()=>(null!=ue?ue:[]).map((e,t)=>{const n=pe(e,t),o=Number(Sd(h,e));return{id:n,source:Sd(u,e)+"",target:Sd(d,e)+"",value:Number.isFinite(o)?o:0,bezier:ze.get(n),data:e}}),[ue,pe,u,d,h,ze]),Ge=we.loadingEl,qe=we.emptyEl;return _e.length>0?e.jsxs("svg",{width:T,height:R,role:"img","aria-label":null!=N?N:"Process Sankey validation failed",children:[e.jsx("text",{x:20,y:30,fontSize:13,fontWeight:600,fill:"var(--semiotic-danger, #dc2626)",children:"ProcessSankey: data invalid"}),_e.map((t,n)=>{return e.jsx("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})]}):Ge||qe||e.jsx(ol,Object.assign({ref:he,chartType:"force",nodes:We,edges:Ye,customNetworkLayout:wd,layoutConfig:Ne,size:[T,R],responsiveWidth:I,responsiveHeight:F,margin:Oe,title:N,description:null!=E?E:"Temporal process flow with lifetime-bounded node lanes, mass bands, and value-scaled ribbons.",summary:B,accessibleTable:D,enableHover:V,tooltipContent:!1===X?()=>null:Fe,backgroundGraphics:He,showParticles:K,particleStyle:Z,legend:Ee,legendPosition:A,onObservation:U,customClickBehavior:Q?e=>{if(!e||!e.data)return;const t=e.data;Ad(t)&&Q(t.data,{x:e.x,y:e.y})}:void 0,chartId:J,colorScheme:Array.isArray(x)?x:void 0},ee))});function Md(n){const o=oc(n.mode,{width:n.width,height:n.height,enableHover:n.enableHover,showLabels:n.showLabels,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary},{width:600,height:600}),{data:i,margin:r,className:s,layout:a="tree",orientation:l="vertical",childrenAccessor:c="children",valueAccessor:u="value",nodeIdAccessor:d="name",colorBy:h,colorScheme:g,colorByDepth:f=!1,edgeStyle:p="curve",nodeLabel:y,nodeSize:m=5,tooltip:v,frameProps:b={},onObservation:x,onClick:k,chartId:w,selection:A,linkedHover:j,loading:S,loadingContent:O,legendInteraction:M,stroke:C,strokeWidth:_,opacity:P}=n,{width:L,height:T,enableHover:R,showLabels:$=!0,title:N,description:E,summary:B,accessibleTable:D}=o,I=ld({nodes:t.useMemo(()=>id(null!=i?i:null,c),[i,c]),edges:void 0,inferNodes:!1,colorBy:f?void 0:h,colorScheme:g,showLegend:!1,legendInteraction:M,selection:A,linkedHover:j,onObservation:x,onClick:k,chartType:"TreeDiagram",chartId:w,marginDefaults:o.marginDefaults,userMargin:r,width:L,height:T,loading:S,loadingContent:O}),F=t.useMemo(()=>new Map,[]),H=t.useMemo(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=f?we[(e.depth||0)%we.length]:h?je(e.data||e,h,I.colorScale):Ul(void 0,I.themeCategorical,g,void 0,F),t},[h,f,I.colorScale,I.themeCategorical,g,F]),W=t.useMemo(()=>jc(H,{stroke:C,strokeWidth:_,opacity:P}),[H,C,_,P]),z=t.useMemo(()=>()=>({stroke:"#999",strokeWidth:1,fill:"none"}),[]),Y=t.useMemo(()=>jc(z,{stroke:C,strokeWidth:_,opacity:P}),[z,C,_,P]),G=t.useMemo(()=>{if("treemap"===a||"circlepack"===a||"partition"===a)return sd(u)},[a,u]),q=bc({componentName:"TreeDiagram",data:i});return q?e.jsx(rc,{componentName:"TreeDiagram",message:q,width:L,height:T}):I.loadingEl?I.loadingEl:e.jsx(cc,{componentName:"TreeDiagram",width:L,height:T,children:e.jsx(ol,Object.assign({chartType:a},null!=i&&{data:i},{size:[L,T],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:I.margin,nodeIDAccessor:d,childrenAccessor:c,hierarchySum:G,treeOrientation:l,edgeType:p,nodeStyle:W,edgeStyle:Y,colorBy:h,colorScheme:I.effectivePalette,colorByDepth:f,nodeSize:m,nodeLabel:$?y||d:void 0,showLabels:$,enableHover:R,tooltipContent:!1===v?()=>null:ji(v)||void 0,customHoverBehavior:j||x||k?I.customHoverBehavior:void 0,customClickBehavior:x||k?I.customClickBehavior:void 0},M&&"none"!==M&&{legendHoverBehavior:I.legendState.onLegendHover,legendClickBehavior:I.legendState.onLegendClick,legendHighlightedCategory:I.legendState.highlightedCategory,legendIsolatedCategories:I.legendState.isolatedCategories},{className:s,title:N,description:E,summary:B,accessibleTable:D},null!=n.animate&&{animate:n.animate},b))})}function Cd(n){const o=oc(n.mode,{width:n.width,height:n.height,enableHover:n.enableHover,showLabels:n.showLabels,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,linkedHover:n.linkedHover},{width:600,height:600}),{data:i,margin:r,className:s,childrenAccessor:a="children",valueAccessor:l="value",nodeIdAccessor:c="name",colorBy:u,colorScheme:d,colorByDepth:h=!1,labelMode:g="leaf",nodeLabel:f,padding:p=4,paddingTop:y,nodeStyle:m,tooltip:v,frameProps:b={},selection:x,linkedHover:k,onObservation:w,onClick:A,chartId:j,loading:S,loadingContent:O,legendInteraction:M,stroke:C,strokeWidth:_,opacity:P}=n,{nodeStyle:L}=b,T=Cc(b,["nodeStyle"]),{width:R,height:$,enableHover:N,showLabels:E=!0,title:B,description:D,summary:I,accessibleTable:F}=o,H=ld({nodes:t.useMemo(()=>id(null!=i?i:null,a),[i,a]),edges:void 0,inferNodes:!1,colorBy:h?void 0:u,colorScheme:d,showLegend:!1,legendInteraction:M,selection:x,linkedHover:k,onObservation:w,onClick:A,chartType:"Treemap",chartId:j,marginDefaults:o.marginDefaults,userMargin:r,width:R,height:$,loading:S,loadingContent:O}),W=kc(x),z=H.customHoverBehavior,Y=t.useCallback(e=>{if(!e)return z(null);const t=e.data||e;z({data:(null==t?void 0:t.data)||t})},[z]),G=t.useMemo(()=>new Map,[]),q=t.useMemo(()=>e=>{const t={stroke:"var(--semiotic-cell-border, var(--semiotic-border, #fff))",strokeWidth:1,strokeOpacity:.8};return t.fill=h?we[(e.depth||0)%we.length]:u?je(e.data||e,u,H.colorScale):Ul(void 0,H.themeCategorical,d,void 0,G),t},[u,h,H.colorScale,H.themeCategorical,d,G]),X=t.useMemo(()=>m||L?e=>{var t,n;return Object.assign(Object.assign(Object.assign({},q(e)),L&&null!==(t=L(e))&&void 0!==t?t:{}),m&&null!==(n=m(e))&&void 0!==n?n:{})}:q,[q,m,L]),V=t.useMemo(()=>jc(X,{stroke:C,strokeWidth:_,opacity:P}),[X,C,_,P]),U=t.useMemo(()=>H.activeSelectionHook?e=>{var t;const n=Object.assign({},V(e));if(H.activeSelectionHook.isActive)if(H.activeSelectionHook.predicate(e.data||e))(null==W?void 0:W.selectedStyle)&&Object.assign(n,W.selectedStyle);else{const e=null!==(t=null==W?void 0:W.unselectedOpacity)&&void 0!==t?t:.5;n.opacity=e,n.fillOpacity=e,n.strokeOpacity=e,(null==W?void 0:W.unselectedStyle)&&Object.assign(n,W.unselectedStyle)}return n}:V,[V,H.activeSelectionHook,W]),Q=t.useMemo(()=>sd(l),[l]),K=void 0!==y?y:!E||"parent"!==g&&"all"!==g?void 0:18,Z=bc({componentName:"Treemap",data:i});return Z?e.jsx(rc,{componentName:"Treemap",message:Z,width:R,height:$}):H.loadingEl?H.loadingEl:e.jsx(cc,{componentName:"Treemap",width:R,height:$,children:e.jsx(ol,Object.assign({chartType:"treemap"},null!=i&&{data:i},{size:[R,$],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:H.margin,nodeIDAccessor:c,childrenAccessor:a,hierarchySum:Q,padding:p,paddingTop:K,nodeStyle:U,colorBy:u,colorScheme:H.effectivePalette,colorByDepth:h,nodeLabel:E?f||c:void 0,showLabels:E,labelMode:g,enableHover:N,tooltipContent:!1===v?()=>null:ji(v)||void 0},(k||w||A)&&{customHoverBehavior:Y},(w||A)&&{customClickBehavior:H.customClickBehavior},M&&"none"!==M&&{legendHoverBehavior:H.legendState.onLegendHover,legendClickBehavior:H.legendState.onLegendClick,legendHighlightedCategory:H.legendState.highlightedCategory,legendIsolatedCategories:H.legendState.isolatedCategories},{className:s,title:B,description:D,summary:I,accessibleTable:F},null!=n.animate&&{animate:n.animate},T))})}function _d(n){const o=oc(n.mode,{width:n.width,height:n.height,enableHover:n.enableHover,showLabels:n.showLabels,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary},{width:600,height:600}),{data:i,margin:r,className:s,childrenAccessor:a="children",valueAccessor:l="value",nodeIdAccessor:c="name",colorBy:u,colorScheme:d,colorByDepth:h=!1,nodeLabel:g,circleOpacity:f=.7,padding:p=4,tooltip:y,frameProps:m={},onObservation:v,onClick:b,chartId:x,selection:k,linkedHover:w,loading:A,loadingContent:j,legendInteraction:S,stroke:O,strokeWidth:M,opacity:C}=n,{width:_,height:P,enableHover:L,showLabels:T=!0,title:R,description:$,summary:N,accessibleTable:E}=o,B=ld({nodes:t.useMemo(()=>id(null!=i?i:null,a),[i,a]),edges:void 0,inferNodes:!1,colorBy:h?void 0:u,colorScheme:d,showLegend:!1,legendInteraction:S,selection:k,linkedHover:w,onObservation:v,onClick:b,chartType:"CirclePack",chartId:x,marginDefaults:o.marginDefaults,userMargin:r,width:_,height:P,loading:A,loadingContent:j}),D=t.useMemo(()=>new Map,[]),I=t.useMemo(()=>e=>{const t={stroke:"currentColor",strokeWidth:1,strokeOpacity:.3,fillOpacity:f};return t.fill=h?we[(e.depth||0)%we.length]:u?je(e.data||e,u,B.colorScale):Ul(void 0,B.themeCategorical,d,void 0,D),t},[u,h,B.colorScale,f,B.themeCategorical,d,D]),F=t.useMemo(()=>jc(I,{stroke:O,strokeWidth:M,opacity:C}),[I,O,M,C]),H=t.useMemo(()=>sd(l),[l]),W=bc({componentName:"CirclePack",data:i});return W?e.jsx(rc,{componentName:"CirclePack",message:W,width:_,height:P}):B.loadingEl?B.loadingEl:e.jsx(cc,{componentName:"CirclePack",width:_,height:P,children:e.jsx(ol,Object.assign({chartType:"circlepack"},null!=i&&{data:i},{size:[_,P],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:B.margin,nodeIDAccessor:c,childrenAccessor:a,hierarchySum:H,padding:p,nodeStyle:F,colorBy:u,colorScheme:B.effectivePalette,colorByDepth:h,nodeLabel:T?g||c:void 0,showLabels:T,enableHover:L,tooltipContent:!1===y?()=>null:ji(y)||void 0,customHoverBehavior:w||v||b?B.customHoverBehavior:void 0,customClickBehavior:v||b?B.customClickBehavior:void 0},S&&"none"!==S&&{legendHoverBehavior:B.legendState.onLegendHover,legendClickBehavior:B.legendState.onLegendClick,legendHighlightedCategory:B.legendState.highlightedCategory,legendIsolatedCategories:B.legendState.isolatedCategories},{className:s,title:R,description:$,summary:N,accessibleTable:E},null!=n.animate&&{animate:n.animate},m))})}Od.displayName="ProcessSankey",Md.displayName="TreeDiagram",Cd.displayName="Treemap",_d.displayName="CirclePack";const Pd=we;function Ld(n){const o=oc(n.mode,{width:n.width,height:n.height,enableHover:n.enableHover,showLabels:n.showLabels,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary},{width:600,height:600}),{data:i,margin:r,className:s,childrenAccessor:a="children",nodeIdAccessor:l="name",colorBy:c,colorScheme:u,colorByDepth:d=!1,orbitMode:h="flat",orbitSize:g=2.95,speed:f=.25,revolution:p,revolutionStyle:y,eccentricity:m=1,showRings:v=!0,nodeRadius:b=6,showLabels:x=!1,animated:k=!0,tooltip:w,foregroundGraphics:A,annotations:j,frameProps:S={},onObservation:O,onClick:M,chartId:C,selection:_,linkedHover:P,loading:L,loadingContent:T,stroke:R,strokeWidth:$,opacity:N}=n,{width:E,height:B,enableHover:D,title:I,description:F,summary:H,accessibleTable:W}=o,z=ld({nodes:t.useMemo(()=>id(i,a),[i,a]),edges:void 0,inferNodes:!1,colorBy:d?void 0:c,colorScheme:u,showLegend:!1,legendInteraction:void 0,selection:_,linkedHover:P,onObservation:O,onClick:M,chartType:"OrbitDiagram",chartId:C,marginDefaults:{top:10,right:10,bottom:10,left:10},userMargin:r,width:E,height:B,loading:L,loadingContent:T}),Y=t.useMemo(()=>new Map,[]),{colorScale:G,customClickBehavior:q,customHoverBehavior:X,themeCategorical:V}=z,U=t.useMemo(()=>{if(Array.isArray(u))return u;const e=be[u];return Array.isArray(e)?e:xe},[u]),Q=t.useMemo(()=>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]:Pd[(e.depth||0)%Pd.length]:c?je(e.data||e,c,G):Ul(void 0,V,u,void 0,Y),n.opacity=o?1:.85,n},[c,d,G,U,V,u,Y]),K=t.useMemo(()=>jc(Q,{stroke:R,strokeWidth:$,opacity:N}),[Q,R,$,N]),Z=t.useMemo(()=>()=>({stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1}),[]),J=t.useMemo(()=>{if(X)return e=>{X(e&&e.data&&void 0!==e.data.data?Object.assign(Object.assign({},e),{data:e.data.data}):e)}},[X]),ee=t.useMemo(()=>{if(q)return e=>{q(e&&e.data&&void 0!==e.data.data?Object.assign(Object.assign({},e),{data:e.data.data}):e)}},[q]),te=bc({componentName:"OrbitDiagram",data:i});return te?e.jsx(rc,{componentName:"OrbitDiagram",message:te,width:E,height:B}):z.loadingEl?z.loadingEl:e.jsx(cc,{componentName:"OrbitDiagram",width:E,height:B,children:e.jsx(ol,Object.assign({chartType:"orbit"},null!=i&&{data:i},{size:[E,B],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:z.margin,nodeIDAccessor:l,childrenAccessor:a,nodeStyle:K,edgeStyle:Z,colorBy:c,colorScheme:z.effectivePalette,colorByDepth:d,nodeSize:b,nodeLabel:x?l:void 0,showLabels:x,enableHover:!k&&D,tooltipContent:k?void 0:!1===w?()=>null:ji(w)||void 0,customHoverBehavior:P||O||M?J:void 0,customClickBehavior:O||M?ee:void 0,foregroundGraphics:A,annotations:j,className:s,title:I,description:F,summary:H,orbitMode:h,orbitSize:g,orbitSpeed:f,orbitRevolution:p,orbitRevolutionStyle:y,orbitEccentricity:m,orbitShowRings:v,orbitAnimated:k,accessibleTable:W},null!=n.animate&&{animate:n.animate},S))})}Ld.displayName="OrbitDiagram";const Td={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"},Rd={opacity:.7,marginRight:4};function $d(e,t,n){if(null!=e)return"function"==typeof t?t(e):e["string"==typeof t?t:n]}function Nd(e){return null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+""}function Ed(t={}){const{timeAccessor:n,valueAccessor:o,xLabel:i="x",yLabel:r="y"}=t;return t=>{var s;const a=null!==(s=null==t?void 0:t.data)&&void 0!==s?s:null,l=$d(a,n,"time"),c=$d(a,o,"value");return e.jsxs("div",{className:"semiotic-tooltip",style:Td,children:[e.jsxs("div",{children:[e.jsxs("span",{style:Rd,children:[i,":"]}),Nd(l)]}),e.jsxs("div",{children:[e.jsxs("span",{style:Rd,children:[r,":"]}),Nd(c)]})]})}}function Bd(e,t){var n;return null!=e?e:Math.max(null!==(n=null==t?void 0:t.length)&&void 0!==n?n:0,200)}class Dd{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,n=e._mean-this._mean;this._mean+=n*e._count/t,this._m2+=e._m2+n*n*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 e=new Dd;return e._count=this._count,e._mean=this._mean,e._m2=this._m2,e._min=this._min,e._max=this._max,e}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}}class Id{constructor(e){var t,n,o;this.windows=new Map,this.sessions=[],this.latest=-1/0,this.type=null!==(t=e.window)&&void 0!==t?t:"tumbling",this.size=e.size;const i=null!==(n=e.hop)&&void 0!==n?n:e.size;this.hop=i>0&&e.size>=i?i:e.size,this.gap=null!==(o=e.gap)&&void 0!==o?o: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 n=this.hop,o=Math.floor(e/n);for(let i=Math.floor((e-this.size)/n)+1;o>=i;i++)this.bump(i*n,t)}bump(e,t){let n=this.windows.get(e);n||(n=new Dd,this.windows.set(e,n)),n.push(t)}pushSession(e,t){const n=this.gap,o=new Dd;o.push(t);let i=e,r=e;const s=[],a={start:i,end:r,stats:o};for(const t of this.sessions)e-n>t.end||t.start>e+n?s.push(t):(a.stats.merge(t.stats),i>t.start&&(i=t.start),t.end>r&&(r=t.end));a.start=i,a.end=r,s.push(a),s.sort((e,t)=>e.start-t.start),this.sessions=s}prune(){if(this.retain===1/0)return;if("session"===this.type)return void(this.sessions.length>this.retain&&(this.sessions=this.sessions.slice(this.sessions.length-this.retain)));if(this.retain>=this.windows.size)return;const e=[...this.windows.keys()].sort((e,t)=>e-t),t=e.length-this.retain;for(let n=0;t>n;n++)this.windows.delete(e[n])}emit(){return"session"===this.type?this.emitSessions():this.emitFixed()}emitFixed(){const e=[];for(const[t,n]of this.windows){const o=t+this.size;e.push(this.row(t,o,n,o>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,n,o){return{start:e,end:t,count:n.count,mean:n.mean,sum:n.sum,min:n.min,max:n.max,stddev:n.stddev,partial:o}}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 Fd(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}}const Hd={ms:1,s:1e3,m:6e4,h:36e5,d:864e5},Wd=/(\d+(?:\.\d+)?)(ms|s|m|h|d)/g;function zd(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;Wd.lastIndex=0;let n,o=0,i=0;for(;null!==(n=Wd.exec(t));){const e=parseFloat(n[1]),t=Hd[n[2]];if(null==t||!Number.isFinite(e))return null;o+=e*t,i+=n[0].length}return i!==t.length?null:o>0?o:null}const Yd="time",Gd="value",qd="__aggLower",Xd="__aggUpper",Vd="__aggPartial",Ud="count",Qd="__aggStart",Kd="__aggEnd";function Zd(e,t){var n,o,i;const r=null!==(n=t.stat)&&void 0!==n?n:"mean",s=null!==(o=t.band)&&void 0!==o?o:"none",a=null!==(i=t.sigma)&&void 0!==i?i:1;return e.emit().map(e=>{const t={[Yd]:(e.start+e.end)/2,[Gd]:Fd(e,r),[Ud]:e.count,[Vd]:e.partial,[Qd]:e.start,[Kd]:e.end},n=function(e,t,n,o=1){if("none"===t)return null;if("minmax"===t)return[e.min,e.max];const i=Fd(e,n),r=e.stddev*o;return[i-r,i+r]}(e,s,r,a);return n&&(t[qd]=n[0],t[Xd]=n[1]),t})}class Jd{constructor(e){var t;this.held=[],this._watermark=-1/0,this._lateCount=0,this.lateness=e.lateness>0?e.lateness:0,this.getTime=e.getTime,this.latePolicy=null!==(t=e.latePolicy)&&void 0!==t?t:"drop"}push(e){const t=this.getTime(e);if(!Number.isFinite(t))return{released:[e],late:[]};const n=[];return this._watermark!==-1/0&&this._watermark-this.lateness>t?(this._lateCount+=1,n.push(e),"drop"===this.latePolicy?{released:[],late:n}:{released:[e],late:n}):(t>this._watermark&&(this._watermark=t),this.held.push(e),{released:this.drain(),late:n})}drain(){const e=this._watermark-this.lateness;if(0===this.held.length)return[];const t=[],n=[];for(const o of this.held)this.getTime(o)>e?n.push(o):t.push(o);return this.held=n,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}}function eh(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();const i=Number(o);return Number.isFinite(i)?i:null}const th=t.forwardRef(function(n,o){var i,r,s,a,l,c,u,d,h,g,f;const p=oc(n.mode,{width:null!==(r=null===(i=n.size)||void 0===i?void 0:i[0])&&void 0!==r?r:n.width,height:null!==(a=null===(s=n.size)||void 0===s?void 0:s[1])&&void 0!==a?a:n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0}),{size:y,margin:m,className:v,arrowOfTime:b="right",windowMode:x="sliding",windowSize:k,data:w,timeAccessor:A,valueAccessor:j,timeExtent:S,valueExtent:O,extentPadding:M,stroke:C="#007bff",strokeWidth:_=2,strokeDasharray:P,opacity:L,background:T,tooltipContent:R,tooltip:$,onHover:N,annotations:E,autoPlaceAnnotations:B,svgAnnotationRules:D,tickFormatTime:I,tickFormatValue:F,decay:H,pulse:W,staleness:z,transition:Y,linkedHover:G,selection:q,onObservation:X,chartId:V,loading:U,loadingContent:Q,emptyContent:K,emphasis:Z,legendPosition:J,aggregate:ee,eventTime:te}=n,ne=p.showAxes,oe=p.enableHover,ie=null!=m?m:p.marginDefaults,re=null!=y?y:[p.width,p.height],se=null!==(l=null!=R?R:$)&&void 0!==l?l:Ed({timeAccessor:A,valueAccessor:j}),ae=t.useRef(null),{customHoverBehavior:le}=Zl({selection:q,linkedHover:G,unwrapData:!0,onObservation:X,chartType:"RealtimeLineChart",chartId:V}),ce=t.useCallback(e=>{N&&N(e),le(e)},[N,le]),ue=null!=ee,[de,he]=t.useState([]),ge=t.useRef(null),fe=t.useRef(ee);fe.current=ee;const pe=t.useRef(ue);pe.current=ue;const ye=t.useRef(de);ye.current=de;const me=t.useRef({timeAccessor:A,valueAccessor:j});me.current={timeAccessor:A,valueAccessor:j};const ve=ue?[null!==(c=ee.window)&&void 0!==c?c:"tumbling",ee.size,null!==(u=ee.hop)&&void 0!==u?u:"",null!==(d=ee.gap)&&void 0!==d?d:"",null!==(h=ee.retain)&&void 0!==h?h:""].join("|"):"";t.useEffect(()=>{if(!ue)return void(ge.current=null);const e=fe.current,t=function(e){var t,n;const o=null!==(t=e.window)&&void 0!==t?t:"tumbling",i=zd("session"===o&&null!==(n=e.gap)&&void 0!==n?n:e.size);if(null==i)return null;const r=null!=e.hop?zd(e.hop):void 0,s=null!=e.gap?zd(e.gap):void 0;return new Id({window:o,size:i,hop:null!=r?r:void 0,gap:null!=s?s:void 0,retain:e.retain})}(e);if(ge.current=t,t&&w){const{timeAccessor:e,valueAccessor:n}=me.current;for(const o of w){const i=eh(o,e,"time"),r=eh(o,n,"value");null!=i&&null!=r&&t.push(i,r)}}he(t?Zd(t,e):[])},[ve,ue,w]),t.useEffect(()=>{ue&&ge.current&&he(Zd(ge.current,fe.current))},[null==ee?void 0:ee.stat,null==ee?void 0:ee.band,null==ee?void 0:ee.sigma]);const be=t.useCallback(e=>{const t=ge.current,n=fe.current;if(!t||!n)return;const{timeAccessor:o,valueAccessor:i}=me.current;for(const n of e){const e=eh(n,o,"time"),r=eh(n,i,"value");null!=e&&null!=r&&t.push(e,r)}he(Zd(t,n))},[]),xe=null!=te,ke=t.useRef(null),we=t.useRef(te);we.current=te;const Ae=t.useRef(xe);Ae.current=xe;const je=t.useRef(X);je.current=X;const Se=t.useRef(V);Se.current=V;const Oe=xe?`${te.lateness}|${null!==(g=te.latePolicy)&&void 0!==g?g:"drop"}`:"";t.useEffect(()=>{ke.current=xe?function(e){var t;const n=zd(e.lateness);return null==n?null:new Jd({lateness:n,getTime:e=>{var t;return null!==(t=eh(e,me.current.timeAccessor,"time"))&&void 0!==t?t:NaN},latePolicy:null!==(t=e.latePolicy)&&void 0!==t?t:"drop"})}(we.current):null},[Oe,xe]);const Me=t.useCallback(e=>{var t;0!==e.length&&(pe.current?be(e):null===(t=ae.current)||void 0===t||t.pushMany(e))},[be]),Ce=t.useCallback(e=>{var t,n,o;const i=ke.current;if(!Ae.current||!i)return void Me(e);const r=[];for(const s of e){const e=i.push(s);if(e.released.length&&r.push(...e.released),e.late.length){const r=je.current;if(r){const{timeAccessor:s}=me.current,a=null!==(n=null===(t=we.current)||void 0===t?void 0:t.latePolicy)&&void 0!==n?n:"drop";for(const t of e.late)r({type:"late-data",datum:t,eventTime:null!==(o=eh(t,s,"time"))&&void 0!==o?o:NaN,watermark:i.watermark,policy:a,lateCount:i.lateCount,timestamp:Date.now(),chartType:"RealtimeLineChart",chartId:Se.current})}}}Me(r)},[Me]);t.useImperativeHandle(o,()=>({push:e=>Ce([e]),pushMany:e=>Ce(e),remove:e=>{var t,n;return pe.current?[]:null!==(n=null===(t=ae.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return pe.current?[]:null!==(o=null===(n=ae.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e,t,n;null===(e=ke.current)||void 0===e||e.clear(),pe.current?(null===(t=ge.current)||void 0===t||t.clear(),he([])):null===(n=ae.current)||void 0===n||n.clear()},getData:()=>{var e,t;return pe.current?ye.current:null!==(t=null===(e=ae.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=ae.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[Ce]);const _e=gc(U,re[0],re[1],Q),Pe=_e?null:hc(ue?void 0:w,re[0],re[1],K),Le={stroke:C,strokeWidth:_,strokeDasharray:P};null!=L&&(Le.opacity=L);const Te=Bd(k,w),Re=Z?`${v||""} semiotic-emphasis-${Z}`.trim():v,$e=ue?de:w,Ne=ue?Yd:A,Ee=ue?Gd:j,Be=ue?"growing":x,De=null!==(f=null==ee?void 0:ee.retain)&&void 0!==f?f:Math.max(de.length,600),Ie=ue?Math.max(1,De):Te,Fe=ue&&ee&&function(e){var t;return"none"!==(null!==(t=e.band)&&void 0!==t?t:"none")}(ee)?{y0Accessor:qd,y1Accessor:Xd,perSeries:!1}:void 0;return _e||Pe||e.jsx(hr,{ref:ae,chartType:"line",runtimeMode:"streaming",size:re,margin:ie,className:Re,arrowOfTime:b,windowMode:Be,windowSize:Ie,data:$e,timeAccessor:Ne,valueAccessor:Ee,xExtent:S,yExtent:O,extentPadding:M,band:Fe,lineStyle:Le,showAxes:ne,background:T,hoverAnnotation:oe,tooltipContent:se,customHoverBehavior:ce,annotations:E,autoPlaceAnnotations:B,svgAnnotationRules:D,tickFormatTime:I,tickFormatValue:F,decay:H,pulse:W,staleness:z,transition:Y,pointIdAccessor:n.pointIdAccessor,legendPosition:J})});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=t.forwardRef(function(n,o){var i,r,s,a,l;const c=oc(n.mode,{width:null!==(r=null===(i=n.size)||void 0===i?void 0:i[0])&&void 0!==r?r:n.width,height:null!==(a=null===(s=n.size)||void 0===s?void 0:s[1])&&void 0!==a?a:n.height,showAxes:n.showAxes,enableHover:null!=n.enableHover?!!n.enableHover:void 0,linkedHover:n.linkedHover}),{binSize:u,size:d,margin:h,className:g,arrowOfTime:f="right",windowMode:p="sliding",windowSize:y,data:m,timeAccessor:v,valueAccessor:b,direction:x="up",timeExtent:k,valueExtent:w,extentPadding:A,categoryAccessor:j,colors:S,fill:O,stroke:M,strokeWidth:C,opacity:_,gap:P,background:L,tooltipContent:T,tooltip:R,onHover:$,annotations:N,autoPlaceAnnotations:E,svgAnnotationRules:B,tickFormatTime:D,tickFormatValue:I,linkedHover:F,selection:H,decay:W,pulse:z,staleness:Y,transition:G,onObservation:q,chartId:X,loading:V,loadingContent:U,emptyContent:Q,emphasis:K,legendPosition:Z,brush:J,onBrush:ee,linkedBrush:te}=n,ne=c.showAxes,oe=c.enableHover,ie=null!=h?h:c.marginDefaults,re=null!=d?d:[c.width,c.height],se=null!==(l=null!=T?T:R)&&void 0!==l?l:function(t={}){const{timeAccessor:n,valueAccessor:o}=t;return t=>{var i;const r=null!==(i=null==t?void 0:t.data)&&void 0!==i?i:null;if(null==(null==r?void 0:r.binStart)||null==(null==r?void 0:r.binEnd)){const t=$d(r,n,"time"),i=$d(r,o,"value");return e.jsxs("div",{className:"semiotic-tooltip",style:Td,children:[e.jsxs("div",{children:[e.jsx("span",{style:Rd,children:"x:"}),Nd(t)]}),e.jsxs("div",{children:[e.jsx("span",{style:Rd,children:"y:"}),Nd(i)]})]})}return e.jsxs("div",{className:"semiotic-tooltip",style:Td,children:[e.jsxs("div",{children:[e.jsx("span",{style:Rd,children:"range:"}),Nd(r.binStart),"–",Nd(r.binEnd)]}),null!=r.total&&e.jsxs("div",{children:[e.jsx("span",{style:Rd,children:"count:"}),Nd(r.total)]}),null!=r.category&&e.jsxs("div",{children:[e.jsx("span",{style:Rd,children:"category:"}),Nd(r.category)]})]})}}({timeAccessor:v,valueAccessor:b}),ae=t.useRef(null),{customHoverBehavior:le}=Zl({selection:H,linkedHover:F,unwrapData:!0,onObservation:q,chartType:"RealtimeHistogram",chartId:X}),ce=t.useCallback(e=>{$&&$(e),le(e)},[$,le]),ue=!0===J?{dimension:"x",snap:"bin"}:"x"===J?{dimension:"x"}:"object"==typeof J?J:void 0,de=$l(te),he=kl(Object.assign({name:(null==de?void 0:de.name)||"__unused_hist_brush__",xField:(null==de?void 0:de.xField)||("string"==typeof v?v:"time")},(null==de?void 0:de.yField)?{yField:de.yField}:{})),ge=t.useRef(he.brushInteraction);ge.current=he.brushInteraction;const fe=t.useCallback(e=>{if(ee&&ee(e),q&&q(e?{type:"brush",extent:e,timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:X}:{type:"brush-end",timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:X}),de){const t=ge.current;t.end(e?"xBrush"===t.brush?e.x:"yBrush"===t.brush?e.y:[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:null)}},[ee,q,X,de]);t.useImperativeHandle(o,()=>({push:e=>{var t;return null===(t=ae.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=ae.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=ae.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=ae.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=ae.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=ae.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=ae.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[]);const pe=gc(V,re[0],re[1],U),ye=pe?null:hc(m,re[0],re[1],Q),me={};null!=O&&(me.fill=O),null!=M&&(me.stroke=M),null!=C&&(me.strokeWidth=C),null!=_&&(me.opacity=_),null!=P&&(me.gap=P);const ve=K?`${g||""} semiotic-emphasis-${K}`.trim():g,be=Bd(y,m),xe=t.useMemo(()=>"down"!==x?w:function({data:e,valueAccessor:t,timeAccessor:n,binSize:o,valueExtent:i,extentPadding:r}){var s;if(i)return[i[1],i[0]];if(!e||0===e.length)return;const a=new Map;for(const i of e){const e=nh(i,n,"time"),r=nh(i,t,"value");if(null==e||null==r)continue;const l=Math.floor(e/o)*o;a.set(l,(null!==(s=a.get(l))&&void 0!==s?s:0)+r)}let l=0;for(const e of a.values())e>l&&(l=e);return[l>0?l+l*(null!=r?r:.1):1,0]}({data:m,valueAccessor:b,timeAccessor:v,binSize:u,valueExtent:w,extentPadding:A}),[x,m,b,v,u,w,A]);return pe||ye||e.jsx(hr,{ref:ae,chartType:"bar",runtimeMode:"streaming",size:re,margin:ie,className:ve,arrowOfTime:f,windowMode:p,windowSize:be,data:m,timeAccessor:v,valueAccessor:b,xExtent:k,yExtent:xe,extentPadding:A,binSize:u,categoryAccessor:j,barColors:S,barStyle:me,showAxes:ne,background:L,hoverAnnotation:oe,tooltipContent:se,customHoverBehavior:ce,annotations:N,autoPlaceAnnotations:E,svgAnnotationRules:B,tickFormatTime:D,tickFormatValue:I,decay:W,pulse:z,staleness:Y,transition:G,pointIdAccessor:n.pointIdAccessor,legendPosition:Z,brush:ue||(te?{dimension:"x"}:void 0),onBrush:ue||te?fe:void 0})});function ih(t){return e.jsx(oh,Object.assign({},t,{windowMode:"growing"}))}oh.displayName="RealtimeHistogram",ih.displayName="TemporalHistogram";const rh=oh,sh=t.forwardRef(function(n,o){var i,r,s,a,l;const c=oc(n.mode,{width:null!==(r=null===(i=n.size)||void 0===i?void 0:i[0])&&void 0!==r?r:n.width,height:null!==(a=null===(s=n.size)||void 0===s?void 0:s[1])&&void 0!==a?a:n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0}),{size:u,margin:d,className:h,arrowOfTime:g="right",windowMode:f="sliding",windowSize:p,data:y,timeAccessor:m,valueAccessor:v,timeExtent:b,valueExtent:x,extentPadding:k,categoryAccessor:w,colors:A,radius:j,fill:S,opacity:O,stroke:M,strokeWidth:C,background:_,tooltipContent:P,tooltip:L,onHover:T,annotations:R,autoPlaceAnnotations:$,svgAnnotationRules:N,tickFormatTime:E,tickFormatValue:B,linkedHover:D,selection:I,onObservation:F,chartId:H,loading:W,loadingContent:z,emptyContent:Y,emphasis:G,legendPosition:q}=n,X=c.showAxes,V=c.enableHover,U=null!=d?d:c.marginDefaults,Q=null!=u?u:[c.width,c.height],K=null!==(l=null!=P?P:L)&&void 0!==l?l:Ed({timeAccessor:m,valueAccessor:v}),Z=t.useRef(null),{customHoverBehavior:J}=Zl({selection:I,linkedHover:D,unwrapData:!0,onObservation:F,chartType:"RealtimeSwarmChart",chartId:H}),ee=t.useCallback(e=>{T&&T(e),J(e)},[T,J]);t.useImperativeHandle(o,()=>({push:e=>{var t;return null===(t=Z.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=Z.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=Z.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=Z.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=Z.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=Z.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Z.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[]);const te=gc(W,Q[0],Q[1],z),ne=te?null:hc(y,Q[0],Q[1],Y),oe={};null!=j&&(oe.radius=j),null!=S&&(oe.fill=S),null!=O&&(oe.opacity=O),null!=M&&(oe.stroke=M),null!=C&&(oe.strokeWidth=C);const ie=G?`${h||""} semiotic-emphasis-${G}`.trim():h,re=Bd(p,y);return te||ne||e.jsx(hr,{ref:Z,chartType:"swarm",runtimeMode:"streaming",size:Q,margin:U,className:ie,arrowOfTime:g,windowMode:f,windowSize:re,data:y,timeAccessor:m,valueAccessor:v,xExtent:b,yExtent:x,extentPadding:k,categoryAccessor:w,barColors:A,swarmStyle:oe,showAxes:X,background:_,hoverAnnotation:V,tooltipContent:K,customHoverBehavior:ee,annotations:R,autoPlaceAnnotations:$,svgAnnotationRules:N,tickFormatTime:E,tickFormatValue:B,legendPosition:q,pointIdAccessor:n.pointIdAccessor})});sh.displayName="RealtimeSwarmChart";const ah=t.forwardRef(function(n,o){var i,r,s,a,l;const c=oc(n.mode,{width:null!==(r=null===(i=n.size)||void 0===i?void 0:i[0])&&void 0!==r?r:n.width,height:null!==(a=null===(s=n.size)||void 0===s?void 0:s[1])&&void 0!==a?a:n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0}),{size:u,margin:d,className:h,arrowOfTime:g="right",windowMode:f="sliding",windowSize:p,data:y,timeAccessor:m,valueAccessor:v,timeExtent:b,valueExtent:x,extentPadding:k,positiveColor:w,negativeColor:A,connectorStroke:j,connectorWidth:S,gap:O,stroke:M,strokeWidth:C,opacity:_,background:P,tooltipContent:L,tooltip:T,onHover:R,annotations:$,autoPlaceAnnotations:N,svgAnnotationRules:E,tickFormatTime:B,tickFormatValue:D,linkedHover:I,selection:F,onObservation:H,chartId:W,loading:z,loadingContent:Y,emptyContent:G,emphasis:q,legendPosition:X}=n,V=c.showAxes,U=c.enableHover,Q=null!=d?d:c.marginDefaults,K=null!=u?u:[c.width,c.height],Z=null!==(l=null!=L?L:T)&&void 0!==l?l:function(t={}){const{timeAccessor:n,valueAccessor:o}=t;return t=>{var i,r;const s=null!==(i=null==t?void 0:t.data)&&void 0!==i?i:null,a=$d(s,n,"time"),l=null!==(r=null==s?void 0:s.delta)&&void 0!==r?r:$d(s,o,"value"),c=null==s?void 0:s.cumEnd,u="number"==typeof l?0>l?Nd(l):"+"+Nd(l):Nd(l);return e.jsxs("div",{className:"semiotic-tooltip",style:Td,children:[e.jsxs("div",{children:[e.jsx("span",{style:Rd,children:"x:"}),Nd(a)]}),e.jsxs("div",{children:[e.jsx("span",{style:Rd,children:"Δ:"}),u]}),null!=c&&e.jsxs("div",{children:[e.jsx("span",{style:Rd,children:"total:"}),Nd(c)]})]})}}({timeAccessor:m,valueAccessor:v}),J=t.useRef(null),{customHoverBehavior:ee}=Zl({selection:F,linkedHover:I,unwrapData:!0,onObservation:H,chartType:"RealtimeWaterfallChart",chartId:W}),te=t.useCallback(e=>{R&&R(e),ee(e)},[R,ee]);t.useImperativeHandle(o,()=>({push:e=>{var t;return null===(t=J.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=J.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=J.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=J.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=J.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=J.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=J.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[]);const ne=gc(z,K[0],K[1],Y),oe=ne?null:hc(y,K[0],K[1],G),ie={};null!=w&&(ie.positiveColor=w),null!=A&&(ie.negativeColor=A),null!=j&&(ie.connectorStroke=j),null!=S&&(ie.connectorWidth=S),null!=O&&(ie.gap=O),null!=M&&(ie.stroke=M),null!=C&&(ie.strokeWidth=C),null!=_&&(ie.opacity=_);const re=q?`${h||""} semiotic-emphasis-${q}`.trim():h,se=Bd(p,y);return ne||oe||e.jsx(hr,{ref:J,chartType:"waterfall",runtimeMode:"streaming",size:K,margin:Q,className:re,arrowOfTime:g,windowMode:f,windowSize:se,data:y,timeAccessor:m,valueAccessor:v,xExtent:b,yExtent:x,extentPadding:k,waterfallStyle:ie,showAxes:V,background:P,hoverAnnotation:U,tooltipContent:Z,customHoverBehavior:te,annotations:$,autoPlaceAnnotations:N,svgAnnotationRules:E,tickFormatTime:B,tickFormatValue:D,legendPosition:X,pointIdAccessor:n.pointIdAccessor})});ah.displayName="RealtimeWaterfallChart";const lh=t.forwardRef(function(n,o){var i,r,s,a,l;const c=oc(n.mode,{width:null!==(r=null===(i=n.size)||void 0===i?void 0:i[0])&&void 0!==r?r:n.width,height:null!==(a=null===(s=n.size)||void 0===s?void 0:s[1])&&void 0!==a?a:n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0}),{size:u,margin:d,className:h,arrowOfTime:g="right",windowMode:f="sliding",windowSize:p,data:y,timeAccessor:m,valueAccessor:v,categoryAccessor:b,timeExtent:x,valueExtent:k,extentPadding:w,heatmapXBins:A=20,heatmapYBins:j=20,aggregation:S="count",background:O,tooltipContent:M,tooltip:C,onHover:_,annotations:P,autoPlaceAnnotations:L,svgAnnotationRules:T,tickFormatTime:R,tickFormatValue:$,decay:N,pulse:E,staleness:B,linkedHover:D,selection:I,onObservation:F,chartId:H,loading:W,loadingContent:z,emptyContent:Y,emphasis:G,legendPosition:q}=n,X=c.showAxes,V=c.enableHover,U=null!=d?d:c.marginDefaults,Q=null!=u?u:[c.width,c.height],K=null!==(l=null!=M?M:C)&&void 0!==l?l:function(t={}){const{timeAccessor:n,valueAccessor:o,xLabel:i="x",yLabel:r="y"}=t;return t=>{var s,a,l,c;const u=null!==(s=null==t?void 0:t.data)&&void 0!==s?s:null,d=null!==(a=null==u?void 0:u.xCenter)&&void 0!==a?a:$d(u,n,"time"),h=null!==(l=null==u?void 0:u.yCenter)&&void 0!==l?l:$d(u,o,"value"),g=null==u?void 0:u.count,f=null==u?void 0:u.sum,p=null==u?void 0:u.value,y=null!==(c=null==u?void 0:u.agg)&&void 0!==c?c:"count";return e.jsxs("div",{className:"semiotic-tooltip",style:Td,children:[e.jsxs("div",{children:[e.jsxs("span",{style:Rd,children:[i,":"]}),Nd(d)]}),e.jsxs("div",{children:[e.jsxs("span",{style:Rd,children:[r,":"]}),Nd(h)]}),null!=g&&e.jsxs("div",{children:[e.jsx("span",{style:Rd,children:"count:"}),Nd(g)]}),"sum"===y&&null!=f&&e.jsxs("div",{children:[e.jsx("span",{style:Rd,children:"sum:"}),Nd(f)]}),"mean"===y&&null!=p&&e.jsxs("div",{children:[e.jsx("span",{style:Rd,children:"mean:"}),Nd(p)]})]})}}({timeAccessor:m,valueAccessor:v}),Z=t.useRef(null),{customHoverBehavior:J}=Zl({selection:I,linkedHover:D,unwrapData:!0,onObservation:F,chartType:"RealtimeHeatmap",chartId:H}),ee=t.useCallback(e=>{_&&_(e),J(e)},[_,J]);t.useImperativeHandle(o,()=>({push:e=>{var t;return null===(t=Z.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=Z.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=Z.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=Z.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=Z.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=Z.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Z.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[]);const te=gc(W,Q[0],Q[1],z),ne=te?null:hc(y,Q[0],Q[1],Y),oe=G?`${h||""} semiotic-emphasis-${G}`.trim():h,ie=Bd(p,y);return te||ne||e.jsx(hr,{ref:Z,chartType:"heatmap",runtimeMode:"streaming",size:Q,margin:U,className:oe,arrowOfTime:g,windowMode:f,windowSize:ie,data:y,timeAccessor:m,valueAccessor:v,categoryAccessor:b,xExtent:x,yExtent:k,extentPadding:w,heatmapXBins:A,heatmapYBins:j,heatmapAggregation:S,showAxes:X,background:O,hoverAnnotation:V,tooltipContent:K,customHoverBehavior:ee,annotations:P,autoPlaceAnnotations:L,svgAnnotationRules:T,tickFormatTime:R,tickFormatValue:$,decay:N,pulse:E,staleness:B,legendPosition:q,pointIdAccessor:n.pointIdAccessor})});lh.displayName="RealtimeHeatmap";const ch=864e5;function uh(e){return 10>e?"0"+e:e+""}const dh=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function hh(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 gh(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 fh(e,t){return _c(this,void 0,void 0,function*(){const{format:n="png",filename:o="chart",scale:i=2,background:r="white"}=t||{},s=e.querySelector("svg");if(!s)throw Error("No SVG element found in the container");const a=s.cloneNode(!0),l=s.getBoundingClientRect();if(a.getAttribute("width")||a.setAttribute("width",l.width+""),a.getAttribute("height")||a.setAttribute("height",l.height+""),a.getAttribute("xmlns")||a.setAttribute("xmlns","http://www.w3.org/2000/svg"),ph(s,a),"svg"===n){const e=(new XMLSerializer).serializeToString(a);yh(new Blob([e],{type:"image/svg+xml;charset=utf-8"}),o+".svg")}else{const t=l.width*i,n=l.height*i,s=document.createElement("canvas");s.width=t,s.height=n;const c=s.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(a),h=new Blob([d],{type:"image/svg+xml;charset=utf-8"}),g=URL.createObjectURL(h),f=new Image;f.width=l.width,f.height=l.height,yield new Promise((e,t)=>{f.onload=()=>{c.drawImage(f,0,0),s.toBlob(n=>{n?(yh(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 ph(e,t){var n;const o=e.children,i=t.children,r=window.getComputedStyle(e),s=["fill","stroke","stroke-width","stroke-dasharray","opacity","fill-opacity","stroke-opacity","font-family","font-size","font-weight","text-anchor","dominant-baseline"];for(const e of s){const 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++)ph(o[e],i[e])}function yh(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 mh={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"}},vh={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"},xScaleType:{type:"string",enum:["linear","log","time"]},yScaleType:{type:"string",enum:["linear","log","time"]}},bh={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"},categoryFormat:{type:"function"}},xh=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],kh=["vertical","horizontal"],wh={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},mh),vh),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:xh},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({},mh),vh),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:xh},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({},mh),vh),{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:xh},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({},mh),vh),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:xh},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({},mh),vh),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},symbolBy:{type:["string","function"]},symbolMap:{type:"object"},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({},mh),vh),{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({},mh),vh),{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({},mh),vh),{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({},mh),vh),{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({},mh),vh),{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({},mh),vh),{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({},mh),bh),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:kh},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({},mh),bh),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:kh},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({},mh),bh),{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:kh},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},mh),bh),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:kh},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({},mh),bh),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:kh},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},symbolBy:{type:["string","function"]},symbolMap:{type:"object"},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({},mh),bh),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:kh},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},mh),bh),{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({},mh),bh),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:kh},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({},mh),bh),{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({},mh),bh),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:kh},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({},mh),{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({},mh),{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({},mh),{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({},mh),bh),{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({},mh),bh),{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({},mh),{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({},mh),{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:kh},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({},mh),{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({},mh),{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({},mh),{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({},mh),{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({},mh),{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({},mh),{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({},mh),{data:{type:"array"},fields:{type:"array"}})},MinimapChart:{required:["data"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},mh),{data:{type:"array"}})},ChoroplethMap:{required:["areas"],dataShape:"array",dataAccessors:["valueAccessor"],props:Object.assign(Object.assign({},mh),{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({},mh),{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({},mh),{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({},mh),{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"}}}},Ah=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"]),jh=new Set(["data","nodes","edges"]),Sh="function"==typeof structuredClone?structuredClone:e=>JSON.parse(JSON.stringify(e));function Oh(e){return _c(this,arguments,void 0,function*(e,t="json"){const n="jsx"===t?Mh(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 Mh(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 Ch(e){return"nominal"===e||"ordinal"===e}function _h(e){return"quantitative"===e||"temporal"===e}const Ph={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"},Lh={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"},Th={sum:"sum",mean:"mean",average:"mean",count:"count",min:"min",max:"max",median:"mean"};function Rh(e,t,n,o,i){var r,s;(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===(s=null==t?void 0:t.axis)||void 0===s?void 0:s.title)&&(n.yLabel=t.axis.title)}function $h(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 Nh=new Set(["LineChart","AreaChart","StackedAreaChart","DifferenceChart","Scatterplot","BubbleChart","ConnectedScatterplot","QuadrantChart","MultiAxisLineChart","MinimapChart"]),Eh=new Set(["BarChart","StackedBarChart","GroupedBarChart","DotPlot"]),Bh=new Set(["PieChart","DonutChart","FunnelChart"]),Dh=new Set(["Histogram","BoxPlot","ViolinPlot","RidgelinePlot","SwarmPlot"]);function Ih(e,t){var n,o;return Eh.has(e)||Bh.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 Fh(e){for(const t of["lineBy","areaBy","stackBy","groupBy","colorBy"]){const n=e[t];if("string"==typeof n&&n)return n}}function Hh(e,t){return null==e?"—":e instanceof Date?e.toISOString().slice(0,10):"number"==typeof e?t(e):e+""}function Wh(e,t={}){var n,o;const i=!0===t.showRetractedAnnotations,r=!0===t.showSupersededAnnotations,s=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)&&s.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&&s.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"},Yh=new Set(["ForceDirectedGraph","SankeyDiagram","ProcessSankey","ChordDiagram"]);function Gh(e){return zh[e]||e.replace(/([a-z])([A-Z])/g,"$1 $2").toLowerCase()+" chart"}const qh=new Set(["Scatterplot","BubbleChart","ConnectedScatterplot","QuadrantChart","ScatterplotMatrix"]),Xh={"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"},Vh={"time-series":"tracking",categorical:"comparing",distribution:"characterizing",relationship:"relating",flow:"tracing",network:"tracing",hierarchy:"nesting",geo:"locating",realtime:"tracking",value:"presenting",custom:"presenting"},Uh=["trend","compare-series","compare-categories","rank","part-to-whole","distribution","correlation","flow","hierarchy","geo","composition-over-time","change-detection","outlier-detection"],Qh={alerting:"alerting",tracking:"trend",comparing:"comparison",ranking:"ranking",apportioning:"composition",characterizing:"distribution",relating:"correlation",tracing:"flow",nesting:"hierarchy",locating:"locator",presenting:"single-value"};const Kh=new Set(["y-threshold","x-threshold","band","callout","label"]),Zh=new Set(["system","agent","watcher"]),Jh=new Set(["ai","agent","system","computed","dbt","great-expectations"]),eg=new Set(["rule","statistical-test","llm-inference","computed"]);function tg(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||!Kh.has(t.type))return!1;const n=t.provenance;return!(!n||"object"!=typeof n)&&(Zh.has(n.authorKind)||Jh.has(n.source)||eg.has(n.basis))})}function ng(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 og={"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 ig(e){const t=og["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 rg(e,t,n={}){var o,i;const r=void 0!==n.levels,s=new Set(null!==(o=n.levels)&&void 0!==o?o:["l1","l2","l3"]);r||!n.capability&&!tg(t)||s.add("l4");const a=ng(null!==(i=n.locale)&&void 0!==i?i:"en"),l=Gh(e),c=Array.isArray(t.data)?t.data:null,u=Fh(t),{measure:d,measureFallback:h,dimension:g,dimensionFallback:f}=Ih(e,t),p="string"==typeof d&&d?d:h,y="string"==typeof g&&g?g:f,m={};if(s.has("l1"))if(Nh.has(e)||Eh.has(e))m.l1=`A ${l} of ${p} by ${y}`+(u?`, split by ${u}.`:".");else if(Bh.has(e))m.l1=`A ${l} showing ${p} across ${y} categories.`;else if(Dh.has(e))m.l1=`A ${l} of the distribution of ${p}`+(u?` by ${u}.`:".");else if(Yh.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} ${ag(e,"node")}`:null,null!=n?`${n} ${ag(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=Nh.has(e)||Eh.has(e)||Bh.has(e)||Dh.has(e);let b=null;if((s.has("l2")||s.has("l3")||s.has("l4"))&&v&&c&&c.length>0&&(b=function(e,t,n,o){let i=0,r=0,s=1/0,a=-1/0,l=null,c=null,u=0,d=0,h=null,g=null,f=NaN,p=NaN;for(const n of e){const e=t(n);Number.isFinite(e)&&(0===i&&(f=e,h=n),p=e,g=n,s>e&&(s=e,l=n,u=i),e>a&&(a=e,c=n,d=i),i++,r+=e)}return 0===i?null:{count:i,min:s,max:a,mean:r/i,minLabel:Hh(null!=l?n(l):null,o),maxLabel:Hh(null!=c?n(c):null,o),first:f,last:p,firstLabel:Hh(null!=h?n(h):null,o),lastLabel:Hh(null!=g?n(g):null,o),minIndex:u,maxIndex:d}}(c,G(d,h),q(g,f),a)),s.has("l2")&&v&&(c&&0!==c.length?b&&(m.l2=Bh.has(e)?`${b.count} segments totaling ${a(function(e){return e.mean*e.count}(b))}. Largest is ${b.maxLabel} at ${a(b.max)}; smallest is ${b.minLabel} at ${a(b.min)}.`:`${p} ranges from ${a(b.min)} (${b.minLabel}) to ${a(b.max)} (${b.maxLabel}), with a mean of ${a(b.mean)} across ${b.count} points.`):m.l2="No data is loaded yet."),s.has("l3")&&b&&Nh.has(e)?m.l3=function(e,t,n){const{first:o,last:i,min:r,max:s,maxLabel:a,minLabel:l,firstLabel:c,lastLabel:u,minIndex:d,maxIndex:h,count:g}=e,f=s-r,p=i-o;if(0===f)return`${sg(t)} is constant at ${n(o)} across the series.`;if(.04>f/(Math.abs(e.mean)||1))return`${sg(t)} ends roughly where it started (${n(o)} at ${c} to ${n(i)} at ${u}), ranging between ${n(r)} and ${n(s)}.`;const y=h>0&&g-1>h,m=d>0&&g-1>d,v=(s-Math.max(o,i))/f,b=(Math.min(o,i)-r)/f;return y&&v>.15?`Overall ${t} climbs to a peak of ${n(s)} (${a}), 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?`${sg(t)} ends roughly where it started (${n(o)} at ${c} to ${n(i)} at ${u}), ranging between ${n(r)} and ${n(s)}.`: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(s)} (${a}).`: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,a):s.has("l3")&&b&&Eh.has(e)&&(m.l3=`The highest ${y} is ${b.maxLabel} and the lowest is ${b.minLabel}.`),s.has("l4")){const o=tg(t)?"alerting":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=Uh.indexOf(o),n=Uh.indexOf(t);-1===e||-1!==n&&e>=n||(t=o)}return t}(o.intentScores);if(e&&Xh[e]&&(null!==(n=o.intentScores[e])&&void 0!==n?n:0)>=3)return Xh[e]}return(null==o?void 0:o.family)?Vh[o.family]:function(e){return Bh.has(e)||"StackedAreaChart"===e?"apportioning":qh.has(e)?"relating":Eh.has(e)?"comparing":Dh.has(e)?"characterizing":Nh.has(e)?"tracking":Yh.has(e)?"tracing":"BigNumber"===e?"presenting":void 0}(e)}(e,n.capability);o&&(m.l4=function(e,t,n,o,i,r,s,a){const l=Qh[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(Eh.has(n)||Bh.has(n))return`${e.maxLabel} stands out at ${t(e.max)} — check it first`;const{first:o,last:i,min:r,max:s,minLabel:a,maxLabel:l,lastLabel:c,minIndex:u,maxIndex:d,count:h}=e,g=s-r;if(g>0){const e=d>0&&h-1>d,n=u>0&&h-1>u,f=(s-Math.max(o,i))/g,p=(Math.min(o,i)-r)/g;if(e&&f>.15)return`the peak of ${t(s)} at ${l} is the point to investigate`;if(n&&p>.15)return`the dip to ${t(r)} at ${a} is the point to investigate`;if(i>=s)return`the climb to ${t(i)} at ${c} warrants a closer look`;if(r>=i)return`the drop to ${t(i)} at ${c} warrants a closer look`}return`the extremes — ${l} (${t(s)}) and ${a} (${t(r)}) — are the points to check`}(t,i,r);case"tracking":return`read it for the trajectory of ${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,s,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 ${Gh(e)} may be unfamiliar${t.name?` to ${t.name.toLowerCase()} readers`:""} — lean on this description.`}(t,a)}`}(o,e,t,b,p,y,a,n.audience))}const x=["l1","l2","l3","l4"].filter(e=>s.has(e)&&m[e]).map(e=>m[e]).join(" "),k=function(e){const t=Array.isArray(e.annotations)?e.annotations:null;if(!t||0===t.length)return;const n=Wh(t.filter(e=>!!e&&"object"==typeof e));if(0===n.length)return;const o=n.map(ig),i=o.slice(0,5),r=o.length-i.length,s=function(e){var t;return e.length>1?2===e.length?`${e[0]} and ${e[1]}`:`${e.slice(0,-1).join(", ")}, and ${e[e.length-1]}`:null!==(t=e[0])&&void 0!==t?t:""}(i)+(r>0?`, and ${r} more`:""),a=n.length;return`The author has marked ${1===a?"one feature":a+" features"} on this chart: ${s}.`}(t);return Object.assign({text:k?`${k} ${x}`.trim():x,levels:m},k?{annotations:k}:{})}function sg(e){return e.length?e[0].toUpperCase()+e.slice(1):e}function ag(e,t){return 1===e?t:t+"s"}function lg(e,t,n={}){var o,i,r;const s=null!==(o=n.locale)&&void 0!==o?o:"en",a=Math.max(1,null!==(i=n.maxLeaves)&&void 0!==i?i:200),l=ng(s),c={id:"root",role:"chart",label:rg(e,t,{locale:s}).text||"Chart.",level:1,children:[]},u=function(e,t){const n=Array.isArray(e.annotations)?e.annotations:null;if(!n)return null;const o=Wh(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=ig(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 s=o.length;return{id:"annotations",role:"annotation",level:2,label:`Annotations: ${1===s?"one marked feature":s+" marked features"}.`,children:r}}(t,a),d=Array.isArray(t.data)?t.data:null,h=Nh.has(e)||Eh.has(e)||Bh.has(e)||Dh.has(e);if(!d||0===d.length||!h)return u&&(c.children=[u]),c;const{measure:g,measureFallback:f,dimension:p,dimensionFallback:y}=Ih(e,t),m=G(g,f),v=q(p,y),b="string"==typeof g&&g?g:f,x="string"==typeof p&&p?p:y,k=Fh(t);let w=0;const A=e=>`${e}-${w++}`,j=(e,t)=>{const n=e.slice(0,a).map(e=>((e,t)=>{const n=m(e),o=Hh(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>a&&n.push({id:A("more"),role:"datum",level:t,label:`…and ${e.length-a} more points`}),n},S=[];if(Nh.has(e)||Eh.has(e)){let t=1/0,n=-1/0,o=1/0,i=-1/0;const r=[];let s=!0;for(const e of d){const a=m(e);Number.isFinite(a)&&(t>a&&(t=a),a>n&&(n=a));const l=v(e);r.push(l),"number"==typeof l&&Number.isFinite(l)?(o>l&&(o=l),l>i&&(i=l)):s=!1}const a=new Set,c=[];for(const e of r){const t=e+"";a.has(t)||(a.add(t),c.push(e))}const u=s?`${l(o)} to ${l(i)}`:`${Hh(c[0],l)} to ${Hh(c[c.length-1],l)} (${Eh.has(e)?c.length+" categories":d.length+" points"})`;S.push({id:A("axis"),role:"axis",level:2,label:`${Eh.has(e)?"Category axis":"X axis"}: ${x}, ${u}.`}),t>n||S.push({id:A("axis"),role:"axis",level:2,label:`Value axis: ${b}, ${l(t)} to ${l(n)}.`})}if(k){const n=q(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=rg(e,Object.assign(Object.assign({},t),{data:r}),{levels:["l2","l3"],locale:s}).text;i.push({id:A("series"),role:"series",level:2,label:`Series ${n}: ${o}`,children:j(r,3)})}c.children=[...S,...i]}else c.children=[...S,...j(d,2)];return u&&c.children.push(u),c}const cg={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0,padding:0,margin:-1};function ug({tree:t,label:n,visible:o=!1,className:i,onActiveChange:r,activeId:s,chartId:a}){const[l,c]=p.useState(()=>new Set([t.id])),[u,d]=p.useState(t.id),h=void 0!==s,g=h?s:u,f=p.useRef(null),y=p.useRef(new Map),m=p.useMemo(()=>function(e){const t=new Map,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}(t),[t]),v=p.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}(t,l),[t,l]);p.useEffect(()=>{h||v.some(e=>e.id===u)||d(t.id)},[v,u,t.id,h]),p.useEffect(()=>{const e=[];let t=m.get(g);for(;t;)e.push(t.id),t=m.get(t.id);e.length>0&&c(t=>{if(e.every(e=>t.has(e)))return t;const n=new Set(t);for(const t of e)n.add(t);return n})},[g,m]),p.useEffect(()=>{var e,t;(null===(e=f.current)||void 0===e?void 0:e.contains(document.activeElement))&&(null===(t=y.current.get(g))||void 0===t||t.focus())},[g]);const b=p.useCallback((e,t,n)=>{},[a]),x=p.useCallback(e=>{e.id!==g&&(h||d(e.id),null==r||r(e),b(e,"focus"))},[r,h,b,g]),k=e=>{c(t=>new Set(t).add(e.id)),b(e,"toggle",!0)},w=e=>{c(t=>{const n=new Set(t);return n.delete(e.id),n}),b(e,"toggle",!1)},A=(t,n,i)=>{const r=!!t.children&&t.children.length>0,s=l.has(t.id);return e.jsxs("li",{role:"treeitem","aria-label":t.label,"aria-level":t.level,"aria-posinset":n,"aria-setsize":i,"aria-expanded":r?s:void 0,"aria-selected":t.id===g,tabIndex:t.id===g?0:-1,ref:e=>{y.current.set(t.id,e)},onClick:e=>{e.stopPropagation(),x(t),r&&(s?w:k)(t)},style:o?{listStyle:"none",padding:"2px 6px",paddingLeft:6+16*(t.level-1),cursor:r?"pointer":"default",fontSize:13,color:"var(--semiotic-text, currentColor)",background:t.id===g?"var(--semiotic-surface, var(--semiotic-grid, var(--semiotic-bg, #f0f4f8)))":"transparent",outline:"none"}:void 0,children:[e.jsxs("span",{className:"semiotic-nav-tree-label semiotic-nav-tree-"+t.role,children:[o&&r?s?"▾ ":"▸ ":"",t.label]}),r&&s&&e.jsx("ul",{role:"group",style:o?{margin:0,padding:0}:void 0,children:t.children.map((e,n)=>A(e,n+1,t.children.length))})]},t.id)};return e.jsx("div",{ref:f,className:"semiotic-nav-tree"+(i?" "+i:""),style:o?void 0:cg,onKeyDown:e=>{const t=v.findIndex(e=>e.id===g);if(-1===t)return;const n=v[t],o=!!n.children&&n.children.length>0,i=l.has(n.id);let r=!0;switch(e.key){case"ArrowDown":x(v[Math.min(t+1,v.length-1)]);break;case"ArrowUp":x(v[Math.max(t-1,0)]);break;case"Home":x(v[0]);break;case"End":x(v[v.length-1]);break;case"ArrowRight":o&&!i?k(n):o&&i?x(n.children[0]):r=!1;break;case"ArrowLeft":if(o&&i)w(n);else{const e=m.get(n.id);e?x(e):r=!1}break;case"Enter":case" ":o?(i?w:k)(n):r=!1;break;default:r=!1}r&&(e.preventDefault(),e.stopPropagation())},children:e.jsx("ul",{role:"tree","aria-label":n||"Chart navigation",style:o?{margin:0,padding:0}:void 0,children:A(t,1,1)})})}const dg={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0,padding:0,margin:-1};function hg(){const t=function(){const e=p.useContext(Do);return e?e.toggle:null}();return t?e.jsx("button",{className:"semiotic-chart-action",onClick:t,title:"Data summary","aria-label":"Toggle data summary",style:mg,children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"1",y:"1",width:"12",height:"3",rx:"0.5"}),e.jsx("rect",{x:"1",y:"6",width:"8",height:"3",rx:"0.5"}),e.jsx("rect",{x:"1",y:"11",width:"5",height:"2",rx:"0.5"})]})}):null}const gg={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 fg({height:t}){return e.jsx("div",{role:"status","aria-busy":"true","aria-label":"Loading chart",style:{width:"100%",height:t,background:"linear-gradient(90deg, var(--semiotic-border, #e0e0e0) 25%, var(--semiotic-bg, #f5f5f5) 50%, var(--semiotic-border, #e0e0e0) 75%)",backgroundSize:"200% 100%",animation:"semiotic-skeleton-pulse 1.5s ease-in-out infinite",borderRadius:4}})}function pg({error:t}){return e.jsx("div",{role:"alert",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",minHeight:120,padding:24,boxSizing:"border-box"},children:e.jsx("div",{style:{textAlign:"center",maxWidth:400,fontSize:14,color:"var(--semiotic-text-secondary, #666)",lineHeight:1.5},children:t})})}const yg=p.forwardRef(function({title:t,subtitle:n,children:o,width:i="100%",height:r=400,actions:s,chartConfig:a,describe:l,navigable:c,controls:u,loading:d=!1,error:h,errorBoundary:g=!1,status:f,detailsPanel:y,className:m,style:v},b){var x;const k=p.useRef(null),w=p.useRef(null),[A,j]=p.useState(!1),S=!1!==(null==s?void 0:s.export)&&void 0!==(null==s?void 0:s.export),O=!1!==(null==s?void 0:s.fullscreen)&&void 0!==(null==s?void 0:s.fullscreen),M=!1!==(null==s?void 0:s.copyConfig)&&void 0!==(null==s?void 0:s.copyConfig)&&a,C=!0===(null==s?void 0:s.dataSummary),_=p.useMemo(()=>{if(!l||!(null==a?void 0:a.component)||!(null==a?void 0:a.props))return"";const e="object"==typeof l?l.levels:void 0;try{return rg(a.component,a.props,e?{levels:e}:{}).text}catch(e){return""}},[l,a]),P="object"==typeof l&&!0===l.visible,L=p.useMemo(()=>{if(!c||!(null==a?void 0:a.component)||!(null==a?void 0:a.props))return null;const e="object"==typeof c?c.maxLeaves:void 0;try{return lg(a.component,a.props,e?{maxLeaves:e}:{})}catch(e){return null}},[c,a]),T="object"==typeof c&&!0===c.visible,R=p.useMemo(()=>"object"==typeof(null==s?void 0:s.export)?s.export:{},[null==s?void 0:s.export]),$="object"==typeof(null==s?void 0:s.copyConfig)?s.copyConfig.format:"json",N=p.useCallback(e=>_c(this,void 0,void 0,function*(){w.current&&(yield fh(w.current,Object.assign(Object.assign({},R),e)))}),[R]),E=p.useCallback(()=>{k.current&&(document.fullscreenElement?document.exitFullscreen().catch(()=>{}):k.current.requestFullscreen().catch(()=>{}))},[]),B=p.useCallback(e=>_c(this,void 0,void 0,function*(){var t,n;a&&(yield Oh(Object.assign(Object.assign({},a),{version:null!==(t=a.version)&&void 0!==t?t:"1",createdAt:null!==(n=a.createdAt)&&void 0!==n?n:(new Date).toISOString()}),e||$||"json"))}),[a,$]);p.useEffect(()=>{const e=()=>{j(!!document.fullscreenElement)};return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[]),p.useImperativeHandle(b,()=>({export:N,toggleFullscreen:E,copyConfig:B,element:k.current}),[N,E,B]);const D=t||n||u||S||O||M||C||f,I=d?e.jsx(fg,{height:r}):h?e.jsx(pg,{error:h}):g?e.jsx(sc,{children:o}):o;return F=e.jsxs(e.Fragment,{children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:"@keyframes semiotic-skeleton-pulse {\n 0% { background-position: 200% 0; }\n 100% { background-position: -200% 0; }\n}"}}),e.jsxs("div",{ref:k,className:"semiotic-chart-container"+(m?" "+m:""),style:Object.assign(Object.assign({width:i,border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:"var(--semiotic-border-radius, 8px)",overflow:"hidden",background:"var(--semiotic-bg, #fff)",fontFamily:"var(--semiotic-font-family, sans-serif)",position:"relative"},A?{display:"flex",flexDirection:"column",width:"100%",height:"100%"}:{}),v),children:[D&&e.jsxs("div",{className:"semiotic-chart-header",style:{padding:"12px 16px",display:"flex",justifyContent:"space-between",alignItems:"flex-start",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},children:[e.jsxs("div",{className:"semiotic-chart-title-area",children:[t&&e.jsx("div",{className:"semiotic-chart-title",style:{fontSize:14,fontWeight:600,color:"var(--semiotic-text, #333)"},children:t}),n&&e.jsx("div",{className:"semiotic-chart-subtitle",style:{fontSize:12,color:"var(--semiotic-text-secondary, #666)",marginTop:t?2:0},children:n})]}),e.jsxs("div",{className:"semiotic-chart-toolbar",style:{display:"flex",alignItems:"center",gap:4},children:[u,S&&e.jsx("button",{className:"semiotic-chart-action",onClick:()=>N(),title:"Export chart","aria-label":"Export chart",style:mg,children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M7 2v8M3.5 7L7 10.5 10.5 7"}),e.jsx("path",{d:"M2 12h10"})]})}),C&&e.jsx(hg,{}),O&&e.jsx("button",{className:"semiotic-chart-action",onClick:E,title:A?"Exit fullscreen":"Fullscreen","aria-label":A?"Exit fullscreen":"Enter fullscreen",style:mg,children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsxs(e.Fragment,A?{children:[e.jsx("path",{d:"M9 1v4h4"}),e.jsx("path",{d:"M5 13V9H1"}),e.jsx("path",{d:"M13 5H9V1"}),e.jsx("path",{d:"M1 9h4v4"})]}:{children:[e.jsx("path",{d:"M1 5V1h4"}),e.jsx("path",{d:"M13 9v4H9"}),e.jsx("path",{d:"M9 1h4v4"}),e.jsx("path",{d:"M5 13H1V9"})]})})}),M&&e.jsx("button",{className:"semiotic-chart-action",onClick:()=>B(),title:"Copy config","aria-label":"Copy chart configuration",style:mg,children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"5",y:"5",width:"8",height:"8",rx:"1"}),e.jsx("path",{d:"M9 5V2a1 1 0 00-1-1H2a1 1 0 00-1 1v6a1 1 0 001 1h3"})]})}),f&&e.jsx("div",{className:"semiotic-chart-status","aria-live":"polite","aria-atomic":"true",style:{padding:"2px 8px",borderRadius:4,fontSize:10,fontWeight:700,letterSpacing:"0.05em",textTransform:"uppercase",background:gg[f].bg,color:gg[f].color,lineHeight:"18px"},children:f})]})]}),_&&e.jsx("div",{className:"semiotic-chart-description",role:"note",style:P?{padding:"8px 16px",fontSize:12,lineHeight:1.5,color:"var(--semiotic-text-secondary, #666)",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"}:dg,children:_}),L&&e.jsx("div",{className:"semiotic-chart-nav",style:T?{padding:"8px 8px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)",maxHeight:240,overflow:"auto"}:void 0,children:e.jsx(ug,{tree:L,label:"string"==typeof t&&t?t+" — navigable structure":"Chart navigable structure",visible:T,chartId:"string"==typeof(null===(x=null==a?void 0:a.props)||void 0===x?void 0:x.chartId)?a.props.chartId:void 0})}),e.jsxs("div",{className:"semiotic-chart-body",ref:w,style:Object.assign({position:"relative",overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center"},A?{flex:1}:{height:r}),children:[I,y]})]})]}),C?e.jsx(Io,{children:F}):F;var F}),mg={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 vg({children:t,columns:n="auto",minCellWidth:o=300,gap:i=16,className:r,style:s}){const a="number"==typeof n?n:void 0;return e.jsx("div",{className:"semiotic-chart-grid"+(r?" "+r:""),style:Object.assign({display:"grid",gridTemplateColumns:"auto"===n?`repeat(auto-fill, minmax(${o}px, 1fr))`:`repeat(${n}, 1fr)`,gap:i,width:"100%"},s),children:p.Children.map(t,t=>p.isValidElement(t)?"primary"!==t.props.emphasis||void 0!==a&&2>a?t:e.jsx("div",{style:{gridColumn:"span 2"},children:t}):t)})}function bg({children:t,context:n,position:o="right",contextSize:i=250,gap:r=12,className:s,style:a}){const l="left"===o||"right"===o,c="left"===o||"top"===o,u=Object.assign({display:"flex",flexDirection:l?c?"row-reverse":"row":c?"column-reverse":"column",gap:r,width:"100%"},a),d=l?{flex:`0 0 ${i}px`,width:i,minHeight:0}:{flex:`0 0 ${i}px`,height:i,minWidth:0};return e.jsxs("div",{className:"semiotic-context-layout"+(s?" "+s:""),style:u,children:[e.jsx("div",{style:{flex:"1 1 0%",minWidth:0,minHeight:0},children:t}),e.jsx("div",{style:d,children:n})]})}vg.displayName="ChartGrid",bg.displayName="ContextLayout";function xg({children:n,position:o="right",size:i=300,trigger:r="click",chartId:s,observation:a,dismissOnEmpty:l=!0,showClose:c=!0,onToggle:u,className:d,style:h}){const[g,f]=t.useState(null),[p,y]=t.useState(null),[m,v]=t.useState(!1),[b,x]=t.useState(!1),k=t.useRef(null),w=t.useRef(void 0),A="click"===r?["click","click-end"]:["hover","hover-end"],{latest:j}=Al({types:A,chartId:s,limit:1}),S=void 0!==a?a:j,O=t.useCallback(()=>{x(!0),v(!1),clearTimeout(w.current),w.current=setTimeout(()=>{x(!1),f(null),y(null)},200)},[]);if(t.useEffect(()=>{if(S)if("click"===S.type||"hover"===S.type){const e=S;f(e.datum),y(e),v(e=>(e||(x(!0),clearTimeout(w.current),w.current=setTimeout(()=>x(!1),200)),!0))}else!l||"click-end"!==S.type&&"hover-end"!==S.type||O()},[l,O,S]),t.useEffect(()=>{null==u||u(m)},[m,u]),t.useEffect(()=>()=>clearTimeout(w.current),[]),!g&&!b)return null;const M=g&&p?n(g,p):null;if(null===M&&!b)return null;const C=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,i,m,b);return e.jsxs("div",{ref:k,className:`semiotic-details-panel semiotic-details-${o}${d?" "+d:""}`,style:Object.assign(Object.assign({},C),h),children:[c&&e.jsx("button",{className:"semiotic-details-close",onClick:O,"aria-label":"Close details",style:kg,children:e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",children:e.jsx("path",{d:"M2 2l8 8M10 2l-8 8"})})}),e.jsx("div",{className:"semiotic-details-content",style:{overflow:"auto",flex:1},children:M})]})}const kg={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 wg(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=wg(n);if(e)return e}return null}function Ag(e,t){return e?t.map(t=>e[t]+"").join(""):""}xg.displayName="DetailsPanel";const jg="__forecastSegment",Sg="__forecastOpacity";function Og(e,t,n,o){var i,r;const s=t.uncertaintyOpacity,a=t.confidenceAccessor;if(!s&&!a)return;const l="object"==typeof s?s:{},c=null!==(i=l.min)&&void 0!==i?i:.15,u=null!==(r=l.max)&&void 0!==r?r:1;if(a){const t="function"==typeof a?a:e=>e[a];for(const n of e){const e=t(n);null!=e&&Number.isFinite(e)&&(n[Sg]=c+Math.max(0,Math.min(1,e))*(u-c))}return}const d=e.map(e=>{const t=n(e),i=o(e);return null!=t&&null!=i&&Number.isFinite(t)&&Number.isFinite(i)?Math.abs(t-i):NaN}),h=d.filter(e=>Number.isFinite(e));if(0===h.length)return;const[g,f]=rn(h),p=f-g;e.forEach((e,t)=>{const n=d[t];Number.isFinite(n)&&(e[Sg]=u-(p>0?(n-g)/p:0)*(u-c))})}function Mg(e,t){return"function"==typeof t?t(e):!!e[t]}const Cg=Object.freeze({__proto__:null,FORECAST_OPACITY_FIELD:Sg,SEGMENT_FIELD:jg,buildAnomalyAnnotations:function(e){var t,n,o;return[{type:"anomaly-band",threshold:null!==(t=e.threshold)&&void 0!==t?t:2,showBand:!1!==e.showBand,fill:e.bandColor||"#6366f1",fillOpacity:null!==(n=e.bandOpacity)&&void 0!==n?n:.1,anomalyColor:e.anomalyColor||"#ef4444",anomalyRadius:null!==(o=e.anomalyRadius)&&void 0!==o?o:6,label:e.label}]},buildForecast:function(e,t,n,o,i){return(r=o).isTraining||r.isForecast||r.isAnomaly||r.upperBounds||r.lowerBounds?function(e,t,n,o,i){var r,s,a,l;const{isTraining:c,isForecast:u,isAnomaly:d,upperBounds:h,lowerBounds:g,color:f="#6366f1",bandOpacity:p=.15,anomalyColor:y="#ef4444",anomalyRadius:m=6,label:v}=o,b=e.map(e=>{let t="observed";return u&&Mg(e,u)?t="forecast":c&&Mg(e,c)&&(t="training"),Object.assign(Object.assign({},e),{[jg]:t})}),x=o._groupBy,k=[];if(x){const e=new Map;for(const t of b){const n=null!==(r=t[x])&&void 0!==r?r:"__default";e.has(n)||e.set(n,[]),e.get(n).push(t)}const t=[];for(const[,n]of e)for(let e=0;n.length-1>e;e++)n[e][jg]!==n[e+1][jg]&&(t.push(Object.assign(Object.assign({},n[e+1]),{[jg]:n[e][jg]})),t.push(Object.assign(Object.assign({},n[e]),{[jg]:n[e+1][jg]})));k.push(...b,...t)}else for(let e=0;b.length>e;e++)k.push(b[e]),b.length-1>e&&b[e][jg]!==b[e+1][jg]&&(k.push(Object.assign(Object.assign({},b[e+1]),{[jg]:b[e][jg]})),k.push(Object.assign(Object.assign({},b[e]),{[jg]:b[e+1][jg]})));if(o.trainUnderline){const e=[];for(const t of k)"training"===t[jg]&&e.push(Object.assign(Object.assign({},t),{[jg]:"training-base"}));k.unshift(...e)}const w=[];if(h&&g){const e="string"==typeof h?h:"__envUpper",t="string"==typeof g?g:"__envLower";if("function"==typeof h||"function"==typeof g)for(const n of k)"function"==typeof h&&(n[e]=h(n)),"function"==typeof g&&(n[t]=g(n));w.push({type:"envelope",upperAccessor:e,lowerAccessor:t,fill:f,fillOpacity:p,label:v})}if(o.uncertaintyOpacity||o.confidenceAccessor){const e=h?"function"==typeof h?h:e=>e[h]:()=>{},t=g?"function"==typeof g?g:e=>e[g]:()=>{};Og(k.filter(e=>"forecast"===e[jg]),o,e,t)}if(d){const e=o.anomalyStyle,t={type:"highlight",filter:e=>Mg(e,d)};e?(t.style=e,t.r=m):"function"==typeof y?(t.style=e=>{const t=y(e);return{stroke:t,strokeWidth:1.5,fill:t,fillOpacity:.7}},t.r=m):(t.color=y,t.r=m,t.style={stroke:y,strokeWidth:1.5,fill:y,fillOpacity:.7}),w.push(t)}return i&&w.push({type:"anomaly-band",threshold:null!==(s=i.threshold)&&void 0!==s?s:2,showBand:!1!==i.showBand,fill:i.bandColor||"#6366f1",fillOpacity:null!==(a=i.bandOpacity)&&void 0!==a?a:.1,anomalyColor:i.anomalyColor||"#ef4444",anomalyRadius:null!==(l=i.anomalyRadius)&&void 0!==l?l:6,label:i.label}),{processedData:k,annotations:w}}(e,0,0,o,i):function(e,t,n,o,i){var r,s,a;const{trainEnd:l,steps:c=10,confidence:u=.95,color:d="#6366f1",bandOpacity:h=.15,label:g}=o;if(null==l)return{processedData:e,annotations:[]};const f=[],p=[];for(const n of e)n[t]>l?p.push(Object.assign(Object.assign({},n),{[jg]:"observed"})):f.push(Object.assign(Object.assign({},n),{[jg]:"training"}));const y=f.map(e=>[e[t],e[n]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]),m=[],v=[];if(y.length>=3){const i=y.length;let r=0,s=0,a=0,l=0;for(const[e,t]of y)r+=e,s+=t,a+=e*e,l+=e*t;const f=i*a-r*r;if(Math.abs(f)>1e-12){const a=(i*l-r*s)/f,p=(s-a*r)/i,b=e=>p+a*e,x=y.map(([e,t])=>t-b(e)).reduce((e,t)=>e+t*t,0),k=Math.sqrt(x/Math.max(i-2,1)),w=y.reduce((e,t)=>e+t[0],0)/i,A=y.reduce((e,t)=>e+Math.pow(t[0]-w,2),0),j=.99>u?.95>u?.9>u?1:1.645:1.96:2.576,S=sn(e.map(e=>e[t]).filter(e=>null!=e&&isFinite(e))),O=y.length>1?(y[i-1][0]-y[0][0])/(i-1):1;for(let e=1;c>=e;e++){const o=S+e*O,r=b(o),s=k*Math.sqrt(1+1/i+(A>0?Math.pow(o-w,2)/A:0))*j;v.push({[t]:o,[n]:r,[jg]:"forecast",__forecastUpper:r+s,__forecastLower:r-s})}Og(v,o,e=>e.__forecastUpper,e=>e.__forecastLower),m.push({type:"envelope",upperAccessor:"__forecastUpper",lowerAccessor:"__forecastLower",fill:d,fillOpacity:h,label:g})}}m.push({type:"x-threshold",x:l,color:"#94a3b8",strokeWidth:1,strokeDasharray:"4,2",label:"Train / Forecast"}),i&&m.push({type:"anomaly-band",threshold:null!==(r=i.threshold)&&void 0!==r?r:2,showBand:!1!==i.showBand,fill:i.bandColor||"#6366f1",fillOpacity:null!==(s=i.bandOpacity)&&void 0!==s?s:.1,anomalyColor:i.anomalyColor||"#ef4444",anomalyRadius:null!==(a=i.anomalyRadius)&&void 0!==a?a:6,label:i.label});const b=[];if(b.push(...f),f.length>0&&p.length>0&&b.push(Object.assign(Object.assign({},f[f.length-1]),{[jg]:"observed"})),b.push(...p),v.length>0){const e=p.length>0?p[p.length-1]:f[f.length-1];e&&b.push(Object.assign(Object.assign({},e),{[jg]:"forecast"})),b.push(...v)}return{processedData:b,annotations:m}}(e,t,n,o,i);var r},createSegmentLineStyle:function(e,t){var n,o;const i=null!==(n=t.trainDasharray)&&void 0!==n?n:"8,4",r=null!==(o=t.forecastDasharray)&&void 0!==o?o:"4,4",s=t.color||"#6366f1",a=t.trainOpacity,l=t.forecastOpacity,c=t.trainStroke,u=t.trainLinecap,d=t.trainUnderline;return t=>{const n=e(t),o=t[jg];if("training"===o){let e=n.stroke;return"darken"===c?e=hh(n.stroke||"#666",.5):c&&(e=c),Object.assign(Object.assign(Object.assign(Object.assign({},n),{stroke:e,strokeDasharray:i}),u&&{strokeLinecap:u}),null!=a&&{strokeOpacity:a})}if("training-base"===o){let e=n.stroke||"#666";return"lighten"===d&&(e=gh(e,.4)),Object.assign(Object.assign({},n),{stroke:e,strokeDasharray:void 0})}if("forecast"===o){const e=t[Sg],o=null!=e?e:l;return Object.assign(Object.assign(Object.assign({},n),{stroke:s,strokeDasharray:r}),null!=o&&{strokeOpacity:o})}return n}},darkenColor:hh,lightenColor:gh,stampForecastOpacity:Og});exports.AccessibleNavTree=ug,exports.AreaChart=zc,exports.BarChart=Su,exports.BoxPlot=Fu,exports.BubbleChart=Vc,exports.CARBON_ALERT={danger:"#da1e28",warning:"#f1c21b",success:"#24a148",info:"#0043ce"},exports.CARBON_CATEGORICAL_14=["#6929c4","#1192e8","#005d5d","#9f1853","#fa4d56","#570408","#198038","#002d9c","#ee538b","#b28600","#009d9a","#012749","#8a3800","#a56eff"],exports.COLOR_BLIND_SAFE_CATEGORICAL=M,exports.CandlestickChart=mu,exports.CategoryColorProvider=ll,exports.ChartContainer=yg,exports.ChartErrorBoundary=sc,exports.ChartGrid=vg,exports.ChordDiagram=ud,exports.CirclePack=_d,exports.ConnectedScatterplot=Dc,exports.ContextLayout=bg,exports.DARK_THEME=_,exports.DetailsPanel=xg,exports.DifferenceChart=Gc,exports.DonutChart=Vu,exports.DotPlot=qu,exports.ForceDirectedGraph=cd,exports.FunnelChart=Gu,exports.GaugeChart=td,exports.GroupedBarChart=nd,exports.HIGH_CONTRAST_THEME=P,exports.Heatmap=Xc,exports.Histogram=Wu,exports.IncrementalExtent=N,exports.LIGHT_THEME=C,exports.LikertChart=Eu,exports.LineChart=Fc,exports.LinkedCharts=Tl,exports.MinimapChart=iu,exports.MultiAxisLineChart=pu,exports.MultiLineTooltip=function(t={}){const{fields:n=[],title:o,format:i,style:r={},className:s="",showLabels:a=!0,separator:l=": "}=t;return t=>{if(!t||"object"!=typeof t)return null;const c=[];if(o){const e=xi(t,o);c.push({value:ki(e,i)})}if(n&&Array.isArray(n)&&n.length>0)n.forEach(e=>{let n,o,r;"string"==typeof e?(n=e,o=e,r=i):(n=e.label,o=e.accessor||e.key||"",r=e.format||i);const s=ki(xi(t,o),r);c.push({label:a?n:void 0,value:s})});else{const e=vi(t,{skipPositional:!1});null!=e.title&&c.push({label:void 0,value:ki(e.title,i),bold:!0}),e.entries.forEach(e=>{c.push({label:a?e.key:void 0,value:ki(e.value,i)})})}const u=Object.assign(Object.assign({},bi),r);return Array.isArray(c)&&0!==c.length?e.jsx("div",{className:("semiotic-tooltip semiotic-tooltip-multiline "+s).trim(),style:u,children:c.map((t,n)=>e.jsxs("div",{style:{marginBottom:c.length-1>n?"4px":0,fontWeight:t.bold?"bold":void 0},children:[t.label&&e.jsxs("strong",{children:[t.label,l]}),t.value]},n))}):null}},exports.NetworkCustomChart=ku,exports.OrbitDiagram=Ld,exports.OrdinalCustomChart=wu,exports.PieChart=Xu,exports.ProcessSankey=Od,exports.QuadrantChart=uu,exports.RealtimeHeatmap=lh,exports.RealtimeHistogram=oh,exports.RealtimeLineChart=th,exports.RealtimeSwarmChart=sh,exports.RealtimeTemporalHistogram=rh,exports.RealtimeWaterfallChart=ah,exports.RidgelinePlot=Yu,exports.RingBuffer=$,exports.SankeyDiagram=dd,exports.Scatterplot=Ec,exports.ScatterplotMatrix=nu,exports.StackedAreaChart=qc,exports.StackedBarChart=Ou,exports.StreamNetworkFrame=ol,exports.StreamOrdinalFrame=es,exports.StreamXYFrame=hr,exports.SwarmPlot=Du,exports.SwimlaneChart=od,exports.THEME_PRESETS=El,exports.TemporalHistogram=ih,exports.ThemeProvider=function({theme:t,children:n}){const o="string"==typeof t&&Bl(t)?t:void 0,i=p.useMemo(()=>function(e){return void 0!==e?L(C,Fl(e)):"undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(forced-colors: active)").matches?P:C}(t),[t]);return e.jsx(T,{initialState:{theme:i},children:e.jsxs(Dl.Provider,{value:o,children:[e.jsx(Hl,{theme:t}),e.jsx(Wl,{children:n})]})})},exports.Tooltip=wi,exports.TreeDiagram=Md,exports.Treemap=Cd,exports.ViolinPlot=zu,exports.XYCustomChart=xu,exports.adaptiveTimeTicks=function(e){let t,n=e;return(o,i,r)=>{const s=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*ch>n?"hours":60*ch>n?"days":400*ch>n?"months":"years"}(r));const a=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(),s=r||e.getUTCHours()!==t.getUTCHours(),a=s||e.getUTCMinutes()!==t.getUTCMinutes(),l=dh[e.getUTCMonth()],c=e.getUTCDate(),u=e.getUTCFullYear(),d=uh(e.getUTCHours()),h=uh(e.getUTCMinutes()),g=uh(e.getUTCSeconds());switch(n){case"seconds":return o?`${l} ${c}, ${u} ${d}:${h}:${g}`:r?`${l} ${c} ${d}:${h}:${g}`:s?`${d}:${h}:${g}`:a?`${h}:${g}`:":"+g;case"minutes":return o?`${l} ${c}, ${u} ${d}:${h}`:r?`${l} ${c} ${d}:${h}`:s?`${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}}(s,new Date(r[i-1]),a):function(e,t){const n=dh[e.getUTCMonth()],o=e.getUTCDate(),i=e.getUTCFullYear(),r=uh(e.getUTCHours()),s=uh(e.getUTCMinutes()),a=uh(e.getUTCSeconds());switch(t){case"seconds":return`${n} ${o}, ${i} ${r}:${s}:${a}`;case"minutes":case"hours":return`${n} ${o}, ${i} ${r}:${s}`;case"days":return`${n} ${o}, ${i}`;case"months":return`${n} ${i}`;case"years":return""+i}}(s,a)}},exports.buildNavigationTree=lg,exports.configToJSX=Mh,exports.copyConfig=Oh,exports.createHatchPattern=Wr,exports.darkenColor=hh,exports.deserializeSelections=function(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},exports.exportChart=fh,exports.fromConfig=function(e){if(!e.component||!e.props)throw Error("Invalid chart config: missing component or props");if(!wh[e.component])throw Error(`Unknown component "${e.component}". This config may require a newer version of semiotic.`);return{componentName:e.component,props:Sh(e.props)}},exports.fromURL=function(e){const t=new URLSearchParams(e.includes("?")?e.split("?")[1]:e).get("sc");if(!t)throw Error("No chart config found in URL (missing 'sc' parameter)");const n=t.replace(/-/g,"+").replace(/_/g,"/"),o=decodeURIComponent(escape(atob(n)));return JSON.parse(o)},exports.fromVegaLite=function(e){var t,n,o,i,r,s,a,l,c,u,d,h;const g=[],{type:f,markProps:p}=function(e){if("string"==typeof e)return{type:e,markProps:{}};const{type:t}=e;return{type:t,markProps:Cc(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 j={};e.width&&(j.width=e.width),e.height&&(j.height=e.height);const S=function(e){if(e)return"string"==typeof e?e:e.text}(e.title);if(S&&(j.title=S),(null==b?void 0:b.field)&&(j.colorBy=b.field,null===(o=b.scale)||void 0===o?void 0:o.scheme)){const e=Ph[b.scale.scheme];e&&(j.colorScheme=e)}void 0!==(null==w?void 0:w.value)&&(j.pointOpacity=w.value);const O=null==m?void 0:m.aggregate,M=null==v?void 0:v.aggregate;if(A&&(O||M)){const e=M?v:m,t=M?m:v,n=Th[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 s=[];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=rn(t)[0];break;case"max":o=rn(t)[1];break;default:o=t.reduce((e,t)=>e+t,0)}s.push({[n]:e,value:o})}return s}(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&&(j.data=A),(null==m?void 0:m.bin)?(j.valueAccessor=m.field,(null==v?void 0:v.field)&&(j.categoryAccessor=v.field),(null===(i=m.axis)||void 0===i?void 0:i.title)&&(j.valueLabel=m.axis.title)):(null==v?void 0:v.bin)&&(j.valueAccessor=v.field,(null==m?void 0:m.field)&&(j.categoryAccessor=m.field),(null===(r=v.axis)||void 0===r?void 0:r.title)&&(j.valueLabel=v.axis.title));const t=(null==m?void 0:m.bin)||(null==v?void 0:v.bin),n="object"==typeof t?t.maxbins:void 0;return n&&(j.bins=n),$h(e,j,g)}let C;switch(f){case"bar":C=function(e,t,n,o,i,r,s){var a,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",Ch(null==e?void 0:e.type)&&_h(null==t?void 0:t.type)?(o.categoryAccessor=e.field,o.valueAccessor=s?"value":t.field,(null===(a=null==e?void 0:e.axis)||void 0===a?void 0:a.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)):_h(null==e?void 0:e.type)&&Ch(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=s?"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,j,A,O,M);break;case"line":if(C="LineChart",Rh(m,v,j,O,M),(null==b?void 0:b.field)&&(j.lineBy=b.field),p.interpolate){const e=Lh[p.interpolate];e&&(j.curve=e)}!0===p.point&&(j.showPoints=!0),A&&(j.data=A);break;case"area":if((null==b?void 0:b.field)?(C="StackedAreaChart",j.areaBy=b.field):C="AreaChart",Rh(m,v,j,O,M),p.interpolate){const e=Lh[p.interpolate];e&&(j.curve=e)}void 0!==p.opacity&&(j.areaOpacity=p.opacity),A&&(j.data=A);break;case"point":case"circle":case"square":(null==x?void 0:x.field)?(C="BubbleChart",j.sizeBy=x.field,(null===(s=x.scale)||void 0===s?void 0:s.range)&&(j.sizeRange=x.scale.range)):C="Scatterplot",Rh(m,v,j,O,M),A&&(j.data=A);break;case"rect":C="Heatmap",(null==m?void 0:m.field)&&(j.xAccessor=m.field),(null==v?void 0:v.field)&&(j.yAccessor=v.field),(null==b?void 0:b.field)&&(j.valueAccessor=b.field,delete j.colorBy),(null===(a=null==m?void 0:m.axis)||void 0===a?void 0:a.title)&&(j.xLabel=m.axis.title),(null===(l=null==v?void 0:v.axis)||void 0===l?void 0:l.title)&&(j.yLabel=v.axis.title),A&&(j.data=A);break;case"arc":p.innerRadius&&p.innerRadius>0?(C="DonutChart",j.innerRadius=p.innerRadius):C="PieChart",(null==k?void 0:k.field)?j.valueAccessor=k.field:(null==v?void 0:v.field)&&(j.valueAccessor=M?"value":v.field),(null==b?void 0:b.field)&&(j.categoryAccessor=b.field),(null==m?void 0:m.field)&&!(null==k?void 0:k.field)&&(j.categoryAccessor=m.field),A&&(j.data=A);break;case"tick":C="DotPlot",Ch(null==m?void 0:m.type)?(j.categoryAccessor=m.field,(null==v?void 0:v.field)&&(j.valueAccessor=M?"value":v.field),(null===(c=null==m?void 0:m.axis)||void 0===c?void 0:c.title)&&(j.categoryLabel=m.axis.title),(null===(u=null==v?void 0:v.axis)||void 0===u?void 0:u.title)&&(j.valueLabel=v.axis.title)):Ch(null==v?void 0:v.type)?(j.categoryAccessor=v.field,(null==m?void 0:m.field)&&(j.valueAccessor=O?"value":m.field),j.orientation="horizontal",(null===(d=null==v?void 0:v.axis)||void 0===d?void 0:d.title)&&(j.categoryLabel=v.axis.title),(null===(h=null==m?void 0:m.axis)||void 0===h?void 0:h.title)&&(j.valueLabel=m.axis.title)):((null==m?void 0:m.field)&&(j.categoryAccessor=m.field),(null==v?void 0:v.field)&&(j.valueAccessor=M?"value":v.field)),A&&(j.data=A);break;default:g.push(`Unsupported mark type "${f}". Defaulting to Scatterplot.`),C="Scatterplot",Rh(m,v,j,O,M),A&&(j.data=A)}return $h(C,j,g)},exports.lightenColor=gh,exports.normalizeTooltip=ji,exports.resolveThemePreset=Bl,exports.serializeSelections=function(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},exports.smartTickFormat=function(e){if(null==e)return"";if("number"!=typeof e)return e+"";if(!isFinite(e))return e+"";if(0===e)return"0";const t=parseFloat(e.toPrecision(12)),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"},exports.smartTooltipEntries=vi,exports.themeToCSS=function(e,t=":root"){var n,o,i,r,s;const a=[];return a.push(` --semiotic-bg: ${e.colors.background};`),a.push(` --semiotic-text: ${e.colors.text};`),a.push(` --semiotic-text-secondary: ${e.colors.textSecondary};`),a.push(` --semiotic-grid: ${e.colors.grid};`),a.push(` --semiotic-border: ${e.colors.border};`),a.push(` --semiotic-primary: ${e.colors.primary};`),a.push(` --semiotic-font-family: ${e.typography.fontFamily};`),e.colors.focus&&a.push(` --semiotic-focus: ${e.colors.focus};`),e.colors.selection&&a.push(` --semiotic-selection-color: ${e.colors.selection};`),null!=e.colors.selectionOpacity&&a.push(` --semiotic-selection-opacity: ${e.colors.selectionOpacity};`),e.colors.diverging&&a.push(` --semiotic-diverging: ${e.colors.diverging};`),(null===(n=e.tooltip)||void 0===n?void 0:n.background)&&a.push(` --semiotic-tooltip-bg: ${e.tooltip.background};`),(null===(o=e.tooltip)||void 0===o?void 0:o.text)&&a.push(` --semiotic-tooltip-text: ${e.tooltip.text};`),(null===(i=e.tooltip)||void 0===i?void 0:i.borderRadius)&&a.push(` --semiotic-tooltip-radius: ${e.tooltip.borderRadius};`),(null===(r=e.tooltip)||void 0===r?void 0:r.fontSize)&&a.push(` --semiotic-tooltip-font-size: ${e.tooltip.fontSize};`),(null===(s=e.tooltip)||void 0===s?void 0:s.shadow)&&a.push(` --semiotic-tooltip-shadow: ${e.tooltip.shadow};`),e.borderRadius&&a.push(` --semiotic-border-radius: ${e.borderRadius};`),e.colors.annotation&&a.push(` --semiotic-annotation-color: ${e.colors.annotation};`),null!=e.typography.legendSize&&a.push(` --semiotic-legend-font-size: ${e.typography.legendSize}px;`),null!=e.typography.titleFontSize&&a.push(` --semiotic-title-font-size: ${e.typography.titleFontSize}px;`),null!=e.typography.tickFontFamily&&a.push(` --semiotic-tick-font-family: ${e.typography.tickFontFamily};`),null!=e.typography.tickSize&&a.push(` --semiotic-tick-font-size: ${e.typography.tickSize}px;`),null!=e.typography.labelSize&&a.push(` --semiotic-axis-label-font-size: ${e.typography.labelSize}px;`),a.push(` --semiotic-secondary: ${e.colors.secondary||e.colors.primary};`),a.push(` --semiotic-surface: ${e.colors.surface||e.colors.background};`),e.colors.success&&a.push(` --semiotic-success: ${e.colors.success};`),e.colors.danger&&a.push(` --semiotic-danger: ${e.colors.danger};`),e.colors.warning&&a.push(` --semiotic-warning: ${e.colors.warning};`),e.colors.error&&a.push(` --semiotic-error: ${e.colors.error};`),e.colors.info&&a.push(` --semiotic-info: ${e.colors.info};`),`${t} {\n${a.join("\n")}\n}`},exports.themeToTokens=function(e){var t,n,o,i,r,s;return{semiotic:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({bg:{$value:e.colors.background,$type:"color"},text:{$value:e.colors.text,$type:"color"},"text-secondary":{$value:e.colors.textSecondary,$type:"color"},grid:{$value:e.colors.grid,$type:"color"},border:{$value:e.colors.border,$type:"color"},primary:{$value:e.colors.primary,$type:"color"},focus:{$value:e.colors.focus||e.colors.primary,$type:"color"},"font-family":{$value:e.typography.fontFamily,$type:"fontFamily"},"border-radius":{$value:e.borderRadius||"8px",$type:"dimension"},tooltip:{bg:{$value:(null===(t=e.tooltip)||void 0===t?void 0:t.background)||e.colors.background,$type:"color"},text:{$value:(null===(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!==(s=e.colors.selectionOpacity)&&void 0!==s?s:.2,$type:"number"}},categorical:{$value:e.colors.categorical,$type:"color",$description:"Categorical color palette"},sequential:{$value:e.colors.sequential,$type:"string",$description:"d3-scale-chromatic sequential scheme name"}},e.colors.diverging?{diverging:{$value:e.colors.diverging,$type:"string",$description:"d3-scale-chromatic diverging scheme name"}}:{}),e.colors.annotation?{"annotation-color":{$value:e.colors.annotation,$type:"color"}}:{}),null!=e.typography.legendSize?{"legend-font-size":{$value:e.typography.legendSize+"px",$type:"dimension"}}:{}),null!=e.typography.titleFontSize?{"title-font-size":{$value:e.typography.titleFontSize+"px",$type:"dimension"}}:{}),null!=e.typography.tickFontFamily?{"tick-font-family":{$value:e.typography.tickFontFamily,$type:"fontFamily"}}:{}),null!=e.typography.tickSize?{"tick-font-size":{$value:e.typography.tickSize+"px",$type:"dimension"}}:{}),null!=e.typography.labelSize?{"axis-label-font-size":{$value:e.typography.labelSize+"px",$type:"dimension"}}:{}),{secondary:{$value:e.colors.secondary||e.colors.primary,$type:"color"},surface:{$value:e.colors.surface||e.colors.background,$type:"color"}}),e.colors.success?{success:{$value:e.colors.success,$type:"color"}}:{}),e.colors.danger?{danger:{$value:e.colors.danger,$type:"color"}}:{}),e.colors.warning?{warning:{$value:e.colors.warning,$type:"color"}}:{}),e.colors.error?{error:{$value:e.colors.error,$type:"color"}}:{}),e.colors.info?{info:{$value:e.colors.info,$type:"color"}}:{})}},exports.toConfig=function(e,t,n){if(!wh[e])throw Error(`Unknown component "${e}". Known components: ${Object.keys(wh).join(", ")}`);const o=!1!==(null==n?void 0:n.includeData),i={};for(const[e,n]of Object.entries(t))null!=n&&(Ah.has(e)||!o&&jh.has(e)||"function"!=typeof n&&((null==n?void 0:n.$$typeof)||(i[e]=Sh(n))));return Object.assign({component:e,props:i,version:"1",createdAt:(new Date).toISOString()},(null==n?void 0:n.selections)?{selections:n.selections}:{})},exports.toURL=function(e){const t=JSON.stringify(e);return"sc="+btoa(unescape(encodeURIComponent(t))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")},exports.useBrushSelection=kl,exports.useCategoryColors=cl,exports.useChartObserver=Al,exports.useCustomLayoutSelection=function(){var e;return null!==(e=p.useContext(nt))&&void 0!==e?e:tt},exports.useFilteredData=function(e,n,o){const i=pl(e=>e.selections.get(n));return t.useMemo(()=>{if(!i||0===i.clauses.size)return e;const t=dl(i,o);return e.filter(t)},[e,i,o])},exports.useLinkedHover=bl,exports.useNavigationSync=function(e){var n;const{tree:o,chartId:i,observe:r=["hover","click"]}=e,s=null!==(n=e.selectionName)&&void 0!==n?n:"__semiotic-nav-sync"+(i?":"+i:""),a=t.useMemo(()=>{if(e.matchFields)return e.matchFields;const t=wg(o);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,o]),l=t.useMemo(()=>{const e=new Map,t=n=>{var o;if("datum"===n.role&&n.datum){const t=Ag(n.datum,a);e.has(t)||e.set(t,n.id)}for(const e of null!==(o=n.children)&&void 0!==o?o:[])t(e)};return t(o),e},[o,a]),{selectPoints:c,clear:u}=vl({name:s}),{latest:d}=Al({chartId:i,types:[...r,"hover-end"],limit:1}),[h,g]=t.useState(o.id);t.useEffect(()=>{g(o.id),u()},[o,u]);const f=t.useCallback(e=>{if(g(e.id),"datum"===e.role&&e.datum&&a.length>0){const t={};for(const n of a)t[n]=[e.datum[n]];c(t)}else u()},[a,c,u]),p=e.annotations,y=t.useMemo(()=>{const e=new Set;if(0===a.length||!p)return e;for(const t of p){const n=l.get(Ag(t,a));n&&e.add(n)}return e},[p,l,a]),m=t.useCallback(e=>{const t="number"==typeof e?null==p?void 0:p[e]:e;if(!t||0===a.length)return!1;const n=l.get(Ag(t,a));if(!n)return!1;g(n);const o={};for(const e of a)o[e]=[t[e]];return c(o),!0},[p,l,a,c]),v=t.useRef(null);return t.useEffect(()=>{if(!d||d===v.current)return;if(v.current=d,"hover-end"===d.type)return;const e=d.datum;if(!e||0===a.length)return;const t=l.get(Ag(e,a));t&&t!==h&&g(t)},[d,l,a,h]),{activeId:h,onActiveChange:f,selection:{name:s},annotatedIds:y,focusAnnotation:m}},exports.useSelection=vl,exports.useSelectionActions=function(e,n){const o=t.useId(),i=n||o,r=pl(e=>e.setClause),s=pl(e=>e.clearClause);return{selectPoints:t.useCallback(t=>{const n={};let o=!1;for(const[e,i]of Object.entries(t))n[e]={type:"point",values:new Set(i)},o=!0;o&&r(e,{clientId:i,type:"point",fields:n})},[e,i,r]),clear:t.useCallback(()=>s(e,i),[e,i,s]),clientId:i}},exports.useTheme=zl;
|
|
2
|
+
"use strict";var e=Object.create,t=Object.defineProperty,o=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,r=Object.getPrototypeOf,i=Object.prototype.hasOwnProperty,s=(e,t,o)=>function(){if(o)throw o[0];try{return e&&(t=(0,e[n(e)[0]])(e=0)),t}catch(e){throw o=[e],e}},a=(e,o)=>{for(var n in o)t(e,n,{get:o[n],enumerable:!0})},l=(e,r,s,a)=>{if(r&&"object"==typeof r||"function"==typeof r)for(let l of n(r))i.call(e,l)||l===s||t(e,l,{get:()=>r[l],enumerable:!(a=o(r,l))||a.enumerable});return e},c=(o,n,i)=>(i=null!=o?e(r(o)):{},l(!n&&o&&o.__esModule?i:t(i,"default",{value:o,enumerable:!0}),o));function u(e){let t=1/0,o=-1/0;for(const n of e)t>n&&(t=n),n>o&&(o=n);return[t,o]}function d(e,t=-1/0){let o=t;for(const t of e)t>o&&(o=t);return o}var h=s({"src/components/charts/shared/minMax.ts"(){}});function f(e,t=.5){const o=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!o)return e;const n=Math.round(parseInt(o[1],16)*(1-t)),r=Math.round(parseInt(o[2],16)*(1-t)),i=Math.round(parseInt(o[3],16)*(1-t));return`#${n.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}`}function p(e,t=.5){const o=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!o)return e;const n=Math.round(parseInt(o[1],16)+(255-parseInt(o[1],16))*t),r=Math.round(parseInt(o[2],16)+(255-parseInt(o[2],16))*t),i=Math.round(parseInt(o[3],16)+(255-parseInt(o[3],16))*t);return`#${n.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}`}var m,g,y=s({"src/components/charts/shared/colorManipulation.ts"(){}}),b={};function v(e,t,o,n){const r=t.uncertaintyOpacity,i=t.confidenceAccessor;if(!r&&!i)return;const s="object"==typeof r?r:{},a=s.min??.15,l=s.max??1;if(i){const t="function"==typeof i?i:e=>e[i];for(const o of e){const e=t(o);null!=e&&Number.isFinite(e)&&(o[g]=a+Math.max(0,Math.min(1,e))*(l-a))}return}const c=e.map(e=>{const t=o(e),r=n(e);return null!=t&&null!=r&&Number.isFinite(t)&&Number.isFinite(r)?Math.abs(t-r):NaN}),d=c.filter(e=>Number.isFinite(e));if(0===d.length)return;const[h,f]=u(d),p=f-h;e.forEach((e,t)=>{const o=c[t];Number.isFinite(o)&&(e[g]=l-(p>0?(o-h)/p:0)*(l-a))})}function x(e,t){return"function"==typeof t?t(e):!!e[t]}function k(e){return[{type:"anomaly-band",threshold:e.threshold??2,showBand:!1!==e.showBand,fill:e.bandColor||"#6366f1",fillOpacity:e.bandOpacity??.1,anomalyColor:e.anomalyColor||"#ef4444",anomalyRadius:e.anomalyRadius??6,label:e.label}]}function w(e,t,o,n,r){return(i=n).isTraining||i.isForecast||i.isAnomaly||i.upperBounds||i.lowerBounds?function(e,t,o,n,r){const{isTraining:i,isForecast:s,isAnomaly:a,upperBounds:l,lowerBounds:c,color:u="#6366f1",bandOpacity:d=.15,anomalyColor:h="#ef4444",anomalyRadius:f=6,label:p}=n,g=e.map(e=>{let t="observed";return s&&x(e,s)?t="forecast":i&&x(e,i)&&(t="training"),{...e,[m]:t}}),y=n._groupBy,b=[];if(y){const e=new Map;for(const t of g){const o=t[y]??"__default";e.has(o)||e.set(o,[]),e.get(o).push(t)}const t=[];for(const[,o]of e)for(let e=0;o.length-1>e;e++)o[e][m]!==o[e+1][m]&&(t.push({...o[e+1],[m]:o[e][m]}),t.push({...o[e],[m]:o[e+1][m]}));b.push(...g,...t)}else for(let e=0;g.length>e;e++)b.push(g[e]),g.length-1>e&&g[e][m]!==g[e+1][m]&&(b.push({...g[e+1],[m]:g[e][m]}),b.push({...g[e],[m]:g[e+1][m]}));if(n.trainUnderline){const e=[];for(const t of b)"training"===t[m]&&e.push({...t,[m]:"training-base"});b.unshift(...e)}const k=[];if(l&&c){const e="string"==typeof l?l:"__envUpper",t="string"==typeof c?c:"__envLower";if("function"==typeof l||"function"==typeof c)for(const o of b)"function"==typeof l&&(o[e]=l(o)),"function"==typeof c&&(o[t]=c(o));k.push({type:"envelope",upperAccessor:e,lowerAccessor:t,fill:u,fillOpacity:d,label:p})}if(n.uncertaintyOpacity||n.confidenceAccessor){const e=l?"function"==typeof l?l:e=>e[l]:()=>{},t=c?"function"==typeof c?c:e=>e[c]:()=>{};v(b.filter(e=>"forecast"===e[m]),n,e,t)}if(a){const e=n.anomalyStyle,t={type:"highlight",filter:e=>x(e,a)};e?(t.style=e,t.r=f):"function"==typeof h?(t.style=e=>{const t=h(e);return{stroke:t,strokeWidth:1.5,fill:t,fillOpacity:.7}},t.r=f):(t.color=h,t.r=f,t.style={stroke:h,strokeWidth:1.5,fill:h,fillOpacity:.7}),k.push(t)}return r&&k.push({type:"anomaly-band",threshold:r.threshold??2,showBand:!1!==r.showBand,fill:r.bandColor||"#6366f1",fillOpacity:r.bandOpacity??.1,anomalyColor:r.anomalyColor||"#ef4444",anomalyRadius:r.anomalyRadius??6,label:r.label}),{processedData:b,annotations:k}}(e,0,0,n,r):function(e,t,o,n,r){const{trainEnd:i,steps:s=10,confidence:a=.95,color:l="#6366f1",bandOpacity:c=.15,label:u}=n;if(null==i)return{processedData:e,annotations:[]};const h=[],f=[];for(const o of e)o[t]>i?f.push({...o,[m]:"observed"}):h.push({...o,[m]:"training"});const p=h.map(e=>[e[t],e[o]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]),g=[],y=[];if(p.length>=3){const r=p.length;let i=0,h=0,f=0,b=0;for(const[e,t]of p)i+=e,h+=t,f+=e*e,b+=e*t;const x=r*f-i*i;if(Math.abs(x)>1e-12){const f=(r*b-i*h)/x,k=(h-f*i)/r,w=e=>k+f*e,S=p.map(([e,t])=>t-w(e)).reduce((e,t)=>e+t*t,0),A=Math.sqrt(S/Math.max(r-2,1)),C=p.reduce((e,t)=>e+t[0],0)/r,M=p.reduce((e,t)=>e+(t[0]-C)**2,0),_=.99>a?.95>a?.9>a?1:1.645:1.96:2.576,j=d(e.map(e=>e[t]).filter(e=>null!=e&&isFinite(e))),R=p.length>1?(p[r-1][0]-p[0][0])/(r-1):1;for(let e=1;s>=e;e++){const n=j+e*R,i=w(n),s=A*Math.sqrt(1+1/r+(M>0?(n-C)**2/M:0))*_;y.push({[t]:n,[o]:i,[m]:"forecast",__forecastUpper:i+s,__forecastLower:i-s})}v(y,n,e=>e.__forecastUpper,e=>e.__forecastLower),g.push({type:"envelope",upperAccessor:"__forecastUpper",lowerAccessor:"__forecastLower",fill:l,fillOpacity:c,label:u})}}g.push({type:"x-threshold",x:i,color:"#94a3b8",strokeWidth:1,strokeDasharray:"4,2",label:"Train / Forecast"}),r&&g.push({type:"anomaly-band",threshold:r.threshold??2,showBand:!1!==r.showBand,fill:r.bandColor||"#6366f1",fillOpacity:r.bandOpacity??.1,anomalyColor:r.anomalyColor||"#ef4444",anomalyRadius:r.anomalyRadius??6,label:r.label});const b=[];if(b.push(...h),h.length>0&&f.length>0&&b.push({...h[h.length-1],[m]:"observed"}),b.push(...f),y.length>0){const e=f.length>0?f[f.length-1]:h[h.length-1];e&&b.push({...e,[m]:"forecast"}),b.push(...y)}return{processedData:b,annotations:g}}(e,t,o,n,r);var i}function S(e,t){const o=t.trainDasharray??"8,4",n=t.forecastDasharray??"4,4",r=t.color||"#6366f1",i=t.trainOpacity,s=t.forecastOpacity,a=t.trainStroke,l=t.trainLinecap,c=t.trainUnderline;return t=>{const u=e(t),d=t[m];if("training"===d){let e=u.stroke;return"darken"===a?e=f(u.stroke||"#666",.5):a&&(e=a),{...u,stroke:e,strokeDasharray:o,...l&&{strokeLinecap:l},...null!=i&&{strokeOpacity:i}}}if("training-base"===d){let e=u.stroke||"#666";return"lighten"===c&&(e=p(e,.4)),{...u,stroke:e,strokeDasharray:void 0}}if("forecast"===d){const e=t[g],o=null!=e?e:s;return{...u,stroke:r,strokeDasharray:n,...null!=o&&{strokeOpacity:o}}}return u}}a(b,{FORECAST_OPACITY_FIELD:()=>g,SEGMENT_FIELD:()=>m,buildAnomalyAnnotations:()=>k,buildForecast:()=>w,createSegmentLineStyle:()=>S,darkenColor:()=>f,lightenColor:()=>p,stampForecastOpacity:()=>v});var A,C=s({"src/components/charts/shared/statisticalOverlays.ts"(){h(),y(),y(),m="__forecastSegment",g="__forecastOpacity"}}),M={};a(M,{AccessibleNavTree:()=>dw,AnnotationLabel:()=>ri,AreaChart:()=>lg,BarChart:()=>_y,BoxPlot:()=>tb,BubbleChart:()=>wg,CARBON_ALERT:()=>Rp,CARBON_CATEGORICAL_14:()=>jp,COLOR_BLIND_SAFE_CATEGORICAL:()=>X,CandlestickChart:()=>ly,CategoryColorProvider:()=>Wf,ChartContainer:()=>Zw,ChartErrorBoundary:()=>Wh,ChartGrid:()=>dS,ChordDiagram:()=>Kb,CirclePack:()=>_v,CircularBrush:()=>wS,ConnectedScatterplot:()=>Km,ContextLayout:()=>pS,DARK_THEME:()=>K,DetailsPanel:()=>LS,DifferenceChart:()=>hg,DirectManipulationControl:()=>_S,DonutChart:()=>Sb,DotPlot:()=>yb,ForceDirectedGraph:()=>Vb,FunnelChart:()=>pb,GaugeChart:()=>Tb,GroupedBarChart:()=>Nb,HIGH_CONTRAST_THEME:()=>Z,Heatmap:()=>vg,Histogram:()=>ib,IncrementalExtent:()=>oe,IntentMark:()=>VS,LIGHT_THEME:()=>U,LikertChart:()=>Yy,LineChart:()=>og,LinkedCharts:()=>xp,MinimapChart:()=>zg,MobileAnnotationCalloutList:()=>iA,MobileChartContainer:()=>tS,MobileStandardControls:()=>Aw,MultiAxisLineChart:()=>ry,MultiLineTooltip:()=>ka,NetworkCustomChart:()=>yy,OrbitDiagram:()=>Lv,OrdinalCustomChart:()=>xy,PieChart:()=>xb,ProcessSankey:()=>bv,QuadrantChart:()=>Kg,RealtimeHeatmap:()=>vx,RealtimeHistogram:()=>lx,RealtimeLineChart:()=>rx,RealtimeSwarmChart:()=>fx,RealtimeTemporalHistogram:()=>ux,RealtimeWaterfallChart:()=>gx,RidgelinePlot:()=>db,RingBuffer:()=>te,SankeyDiagram:()=>Jb,Scatterplot:()=>Gm,ScatterplotMatrix:()=>Dg,SmallMultipleChart:()=>lS,StackedAreaChart:()=>mg,StackedBarChart:()=>Py,StreamNetworkFrame:()=>If,StreamOrdinalFrame:()=>Tu,StreamXYFrame:()=>dc,SwarmPlot:()=>Ky,SwimlaneChart:()=>Bb,THEME_PRESETS:()=>Pp,TemporalHistogram:()=>cx,ThemeProvider:()=>Bp,Tooltip:()=>xa,TreeDiagram:()=>kv,Treemap:()=>Av,VISUALIZATION_CONTROL_TYPES:()=>Ix,ViolinPlot:()=>lb,XYCustomChart:()=>py,adaptiveTimeTicks:()=>Mx,annotationStableId:()=>Zr,auditVisualizationControls:()=>Dx,buildNavigationTree:()=>Xk,clampMobileRange:()=>pw,compileMotionEncoding:()=>Je,composeStyleRules:()=>Rm,configToJSX:()=>ik,copyConfig:()=>rk,createControlObservationAdapter:()=>$x,createHatchPattern:()=>mn,darkenColor:()=>f,deriveMotionVector:()=>nt,deserializeSelections:()=>ak,estimateLabelWidth:()=>ni,exportChart:()=>_x,fromConfig:()=>tk,fromURL:()=>nk,fromVegaLite:()=>fk,hatchFillId:()=>vn,hatchPatternDef:()=>kn,intentManifestFromRecipe:()=>YS,isHatchFill:()=>yn,lightenColor:()=>p,makeNodeRuleContext:()=>Am,makeRuleValueResolver:()=>wm,makeStyleRuleStyleFn:()=>Pm,makeXYRuleContext:()=>Sm,matchesThreshold:()=>Mm,normalizeTooltip:()=>Sa,opacityFromAge:()=>tt,resolveMotionAccessor:()=>Qe,resolveMotionAge:()=>et,resolveMotionVector:()=>ot,resolveResponsiveRules:()=>zp,resolveStyleRules:()=>jm,resolveSvgFill:()=>wn,resolveThemePreset:()=>Lp,responsiveRuleMatches:()=>Op,ruleMatches:()=>_m,serializeSelections:()=>sk,smartTickFormat:()=>xx,smartTooltipEntries:()=>ma,styleRulesToNodeStyle:()=>Lm,styleRulesToPieceStyle:()=>Im,styleRulesToXYStyle:()=>Tm,summarizeIntentManifest:()=>qS,syncPushBuffer:()=>oA,themeToCSS:()=>Mp,themeToTokens:()=>_p,toConfig:()=>ek,toURL:()=>ok,useBrushSelection:()=>np,useCategoryColors:()=>qf,useChartObserver:()=>ap,useCustomLayoutSelection:()=>Fo,useFilteredData:()=>ip,useForceLayout:()=>zS,useLinkedChartsActive:()=>dp,useLinkedHover:()=>tp,useMobileRangeControls:()=>gw,useNavigationSync:()=>eA,useSelection:()=>Jf,useSelectionActions:()=>ep,useSyncedPushData:()=>nA,useTheme:()=>Fp,zoomMobileRange:()=>mw}),module.exports=(A=M,l(t({},"__esModule",{value:!0}),A));var _=c(require("react")),j=require("react"),R=require("react"),P=require("d3-selection"),L=require("d3-brush"),T=c(require("react"));function I({label:e="Data range brush",description:t="Use arrow keys to move the selected range, Shift plus an arrow key to resize it, and Escape to clear it.",onAction:o}={}){const n=T.useId().replace(/:/g,""),r=T.useRef(o);return r.current=o,{description:t,descriptionId:"semiotic-brush-description-"+n,svgProps:{role:"region",tabIndex:0,"aria-label":e,"aria-describedby":"semiotic-brush-description-"+n,onKeyDown:T.useCallback(e=>{const t=function(e){return"Escape"===e.key?{type:"clear"}:"ArrowLeft"===e.key?{type:"nudge",direction:"left",resize:e.shiftKey}:"ArrowRight"===e.key?{type:"nudge",direction:"right",resize:e.shiftKey}:"ArrowUp"===e.key?{type:"nudge",direction:"up",resize:e.shiftKey}:"ArrowDown"===e.key?{type:"nudge",direction:"down",resize:e.shiftKey}:null}(e);t&&(e.preventDefault(),r.current?.(t))},[])}}}var $=require("react/jsx-runtime");function N(e,t,o,n){const[r,i]=[Math.min(...t),Math.max(...t)],s=(i-r)/20;let[a,l]=e;if(n)0>o?a=Math.max(r,a-s):l=Math.min(i,l+s);else{const e=l-a;a=Math.max(r,Math.min(i-e,a+o*s)),l=a+e}return[a,l]}function D(e,t){let o=0,n=t.length-1;for(;n>o;){const r=o+n+1>>1;t[r]>e?n=r-1:o=r}return t[o]}function E(e,t){let o=0,n=t.length-1;for(;n>o;){const r=o+n>>1;e>t[r]?o=r+1:n=r}return t[o]}function B({width:e,height:t,totalWidth:o,totalHeight:n,margin:r,dimension:i,scales:s,onBrush:a,binSize:l,snap:c,binBoundaries:u,snapDuring:d,streaming:h}){const f=(0,R.useRef)(null),p=(0,R.useRef)(null),m=(0,R.useRef)(a);m.current=a;const g=(0,R.useRef)(s);g.current=s;const y=(0,R.useMemo)(()=>u?[...u].sort((e,t)=>e-t):void 0,[u]),b=(0,R.useRef)(y);b.current=y;const v=(0,R.useRef)(!1),x=(0,R.useRef)(null),k=I({label:"xy"===i?"Two-dimensional data range brush":i.toUpperCase()+" data range brush",onAction:e=>{const t=g.current,o=p.current;if(!t||!o||!f.current)return;const n=(0,P.select)(f.current).select(".brush-g");if("clear"===e.type)return v.current=!0,n.call(o.move,null),v.current=!1,x.current=null,void m.current(null);const r=t.x.domain(),s=t.y.domain(),a=x.current;let l=a?.x??[r[0]+.4*(r[1]-r[0]),r[0]+.6*(r[1]-r[0])],c=a?.y??[s[0]+.4*(s[1]-s[0]),s[0]+.6*(s[1]-s[0])];const u="left"===e.direction||"right"===e.direction,d="left"===e.direction||"down"===e.direction?-1:1;if(u&&"y"!==i&&(l=N(l,r,d,e.resize)),u||"x"===i||(c=N(c,s,d,e.resize)),u&&"y"===i||!u&&"x"===i)return;const h={x:l,y:c};v.current=!0,n.call(o.move,"x"===i?[t.x(l[0]),t.x(l[1])]:"y"===i?[t.y(c[1]),t.y(c[0])]:[[t.x(l[0]),t.y(c[1])],[t.x(l[1]),t.y(c[0])]]),v.current=!1,x.current=h,m.current(h)}});return(0,R.useEffect)(()=>{if(!f.current)return;const o=(0,P.select)(f.current).select(".brush-g"),n="x"===i?(0,L.brushX)():"y"===i?(0,L.brushY)():(0,L.brush)();return n.extent([[0,0],[e,t]]),n.on("brush end",r=>{if(v.current)return;const s=g.current;if(!s)return;if(!r.selection)return x.current=null,void m.current(null);let a,u;if("x"===i){const[e,o]=r.selection;a=[s.x.invert(e),s.x.invert(o)],u=[s.y.invert(t),s.y.invert(0)]}else if("y"===i){const[t,o]=r.selection;a=[s.x.invert(0),s.x.invert(e)],u=[s.y.invert(o),s.y.invert(t)]}else{const[[e,t],[o,n]]=r.selection;a=[s.x.invert(e),s.x.invert(o)],u=[s.y.invert(n),s.y.invert(t)]}if("bin"===c&&"y"!==i&&("end"===r.type||"brush"===r.type&&d)){const e=b.current;e&&e.length>0?a=function(e,t){return 0===t.length?e:[D(e[0],t),E(e[1],t)]}(a,e):l&&l>0&&(a=[Math.floor(a[0]/l)*l,Math.ceil(a[1]/l)*l]);const t=s.x(a[0]),c=s.x(a[1]);if(v.current=!0,"x"===i)o.call(n.move,[t,c]);else if("xy"===i){const e=r.selection;o.call(n.move,[[t,e[0][1]],[c,e[1][1]]])}v.current=!1}const h={x:a,y:u};x.current=h,m.current(h)}),o.call(n),p.current=n,o.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{n.on("brush end",null),p.current=null}},[e,t,i,c,l,d]),(0,R.useEffect)(()=>{if(!(h&&s&&p.current&&x.current))return;if(!f.current)return;if("y"===i)return;const e=x.current,t=s.x.domain()[0],o=(0,P.select)(f.current).select(".brush-g");if(t>=e.x[1])return v.current=!0,o.call(p.current.move,null),v.current=!1,x.current=null,void m.current(null);let n=e.x[0],r=!1;if(t>e.x[0]){if(n=t,"bin"===c){const e=b.current;e&&e.length>0?n=E(t,e):l&&l>0&&(n=Math.ceil(t/l)*l)}if(n>=e.x[1])return v.current=!0,o.call(p.current.move,null),v.current=!1,x.current=null,void m.current(null);r=!0}const a=s.x(n),u=s.x(e.x[1]);if(v.current=!0,"x"===i)o.call(p.current.move,[a,u]);else{const t=s.y(e.y[1]),n=s.y(e.y[0]);o.call(p.current.move,[[a,t],[u,n]])}if(v.current=!1,r){const t={x:[n,e.x[1]],y:e.y};x.current=t,m.current(t)}},[s,h,i,c,l]),(0,$.jsxs)("svg",{ref:f,width:o,height:n,...k.svgProps,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:[(0,$.jsx)("title",{children:k.svgProps["aria-label"]}),(0,$.jsx)("desc",{id:k.descriptionId,children:k.description}),(0,$.jsx)("g",{className:"brush-g",transform:`translate(${r.left},${r.top})`})]})}var F=Object.freeze([]);function H(e){if(!e)return F;let t=!1;for(let o=0;e.length>o;o++){const n=e[o];if(null==n||"object"!=typeof n){t=!0;break}}if(!t)return e;const o=[];for(const t of e)null!=t&&"object"==typeof t&&o.push(t);return o}var O=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=H(e),this.lastBoundedData===e)return;if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,totalSize:e.length});let t=this.chunkSize;const o=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const n=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,n),bounded:!1}),t=n,this.chunkTimer=e.length>t?requestAnimationFrame(o):0};this.chunkTimer=requestAnimationFrame(o)}setReplacementData(e){if(e=H(e),this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.pushBuffer=[],this.flushScheduled=!1,this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0,preserveCategoryOrder:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,preserveCategoryOrder:!0,totalSize:e.length});let t=this.chunkSize;const o=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const n=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,n),bounded:!1}),t=n,this.chunkTimer=e.length>t?requestAnimationFrame(o):0};this.chunkTimer=requestAnimationFrame(o)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const e=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:e,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(e){null!=e&&"object"==typeof e&&(this.pushBuffer.push(e),this.scheduleFlush())}pushMany(e){if(0===e.length)return;let t=0;for(let o=0;e.length>o;o++){const n=e[o];null!=n&&"object"==typeof n&&(this.pushBuffer.push(n),t++)}0!==t&&this.scheduleFlush()}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}},z=require("react"),W=require("react/jsx-runtime");function q(e){let t=null;const o=()=>(t||(t=(0,z.createContext)(null)),t),n=Y(e);return[function({children:t,initialState:n}){const r=(0,z.useRef)(n),i=(0,z.useMemo)(()=>Y(e,r.current),[]),s=o();return(0,W.jsx)(s.Provider,{value:i,children:t})},(e,t)=>{const r=o(),i=(0,z.useContext)(r)??n,s=(0,z.useRef)(e);s.current=e;const a=(0,z.useRef)({hasValue:!1,value:void 0}),l=(0,z.useCallback)(()=>{const e=s.current(i.getState()),o=a.current;return o.hasValue&&t&&t(o.value,e)?o.value:(a.current={hasValue:!0,value:e},e)},[i,t]),c=(0,z.useCallback)(()=>s.current(i.getState()),[i]);return(0,z.useSyncExternalStore)(i.subscribe,l,c)}]}function Y(e,t){const o=new Set;let n={...e(function(e){const t=e(n);if(function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}(t)){n={...n,...t};for(const e of o)e()}}),...t??{}};return{getState:()=>n,subscribe:function(e){return o.add(e),()=>{o.delete(e)}}}}function G(e){if(!e?.colors)return;const t=e.colors;return{primary:t.primary,secondary:t.secondary||t.primary,surface:t.surface||t.background,success:t.success,danger:t.danger,warning:t.warning,error:t.error,info:t.info,text:t.text,textSecondary:t.textSecondary,border:t.border,grid:t.grid}}function V(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t={...t,colors:{...t.colors,categorical:X}}),e.accessibility.highContrast){const e="dark"===t.mode;t={...t,colors:{...t.colors,text:e?"#ffffff":"#000000",textSecondary:e?"#cccccc":"#333333",grid:e?"#666666":"#999999",border:e?"#888888":"#000000"}}}return t}var X=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],U={mode:"light",colors:{primary:"#00a2ce",secondary:"#6c757d",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"transparent",surface:"#ffffff",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc",selection:"#00a2ce",selectionOpacity:.15,success:"#2ca02c",danger:"#d62728",warning:"#f0ad4e",error:"#b4181b",info:"#00a2ce"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:12}},K={mode:"dark",colors:{primary:"#4fc3f7",secondary:"#90a4ae",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",diverging:"RdBu",background:"#1a1a2e",surface:"#252540",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555",selection:"#4fc3f7",selectionOpacity:.15,success:"#81c784",danger:"#ef5350",warning:"#ffb74d",error:"#d84848",info:"#4fc3f7"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:12}},Z={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:X,sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#000000",textSecondary:"#333333",grid:"#999999",border:"#000000",focus:"#0000cc",selection:"#0000cc",selectionOpacity:.1,success:"#006400",danger:"#cc0000",warning:"#b15a00",error:"#8b0000",info:"#0000cc"},typography:{fontFamily:"system-ui, sans-serif",titleSize:18,labelSize:14,tickSize:12},tooltip:{background:"#000000",text:"#ffffff",borderRadius:"4px",fontSize:"14px",shadow:"0 2px 8px rgba(0, 0, 0, 0.3)"},borderRadius:"4px"};function Q(e,t){if("light"===t)return U;if("dark"===t)return K;if("high-contrast"===t)return Z;if("string"==typeof t)return void 0!==console&&console.warn(`[ThemeStore] Unknown theme preset "${t}". Keeping current theme.`),e;if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?K:U;return V({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}return V({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}var[J,ee]=q(e=>({theme:U,setTheme(t){e(e=>({theme:Q(e.theme,t)}))}})),te=class{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const o of e){const e=this.push(o);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;return{next:()=>this._size>e?{done:!1,value:this.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let o=0;this._size>o;o++)e(this.buffer[(t+o)%this._capacity],o)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let o=0;this._size>o;o++)e[o]=this.buffer[(t+o)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray();let o=0,n=[];t.length>e&&(o=t.length-e,n=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 n}update(e,t){const o=[],n=(this.head-this._size+this._capacity)%this._capacity;for(let r=0;this._size>r;r++){const i=(n+r)%this._capacity,s=this.buffer[i];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:{...s},o.push(e),this.buffer[i]=t(s)}}return o}remove(e){const t=[],o=[];if(this.forEach(n=>{e(n)?o.push(n):t.push(n)}),0===o.length)return o;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return o}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}},oe=class{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(e){Number.isFinite(e)&&(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}evict(e){e!==this._min&&e!==this._max||(this._dirty=!0)}recalculate(e,t){this._min=1/0,this._max=-1/0;for(const o of e){const e=t?t(o):o;Number.isFinite(e)&&(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}this._dirty=!1}clear(){this._min=1/0,this._max=-1/0,this._dirty=!1}get extent(){return[this._min,this._max]}get min(){return this._min}get max(){return this._max}get dirty(){return this._dirty}};function ne(e,t){return e===t}function re(e,t){if("function"==typeof e)return t=>+e(t);const o=e||t;return e=>+e[o]}function ie(e,t){if("function"==typeof e)return e;const o=e||t;return e=>e[o]}function se(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}var ae=/^\d{4}-\d{1,2}$/;function le(e){const t=e.trim();if(!t||!Number.isNaN(Number(t)))return NaN;const o=ae.test(t)?t+"-01":t;if(o===t&&10>t.length)return NaN;const n=Date.parse(o);return Number.isFinite(n)?n:NaN}function ce(e){return e instanceof Date?e.getTime():"string"==typeof e?le(e):+e}function ue(e){return new Set(Array.isArray(e)?e:[e])}var de=require("d3-scale");function he(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function fe(e,t,o){const n=e=>e.toString(16).padStart(2,"0");return`#${n(e)}${n(t)}${n(o)}`}function pe(e){const t=e.map(he),o=t.length-1;return e=>{if(0>=e){const[e,o,n]=t[0];return fe(e,o,n)}if(e>=1){const[e,n,r]=t[o];return fe(e,n,r)}const n=e*o,r=Math.floor(n),i=n-r,[s,a,l]=t[r],[c,u,d]=t[r+1];return fe(Math.round(s+(c-s)*i),Math.round(a+(u-a)*i),Math.round(l+(d-l)*i))}}var me=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ge=pe(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),ye=pe(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),be=pe(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),ve=pe(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),xe=pe(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),ke=pe(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),we=pe(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),Se=pe(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),Ae=pe(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),Ce=pe(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),Me=pe(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),_e=pe(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]),je={blues:ge,reds:ye,greens:be,viridis:we,oranges:ve,purples:xe,greys:ke,plasma:Se,inferno:Ae,magma:Ce,cividis:Me,turbo:_e};function Re(e){return e&&je[e]||ge}var Pe=pe(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),Le=pe(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),Te=pe(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),Ie=pe(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),$e=pe(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),Ne=pe(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),De=pe(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]),Ee={category10:me,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],...je},Be=me,Fe=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],He=["#f0f0f0","#b5d4ea","#f4c2a1","#b8dab2","#d4b5e0","#f9e0a2","#a8d8d8"],Oe=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 ze(e,t,o){if("function"==typeof t){const n=t(e);return o&&n&&"string"==typeof n&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||Oe.has(t)}(n)?o(n):n}const n=e?.[t]+"";return o?o(n):Be[Math.abs(function(e){let t=0;for(let o=0;e.length>o;o++)t=(t<<5)-t+e.charCodeAt(o),t&=t;return Math.abs(t)}(n))%Be.length]}function We(e,t){if(null==t||!Object.prototype.hasOwnProperty.call(e,t))return;const o=e[t];return"string"==typeof o&&o.length>0?o:void 0}function qe(e,t,o="category10"){if(o&&"object"==typeof o&&!Array.isArray(o)){const e=o;return t=>We(e,t)??"#999"}const n=Array.from(new Set(e.map(e=>e?.[t]).filter(e=>null!=e).map(e=>e+""))),r=n.every(e=>!isNaN(Number(e)));if(Array.isArray(o))return(0,de.scaleOrdinal)().domain(n).range(o).unknown("#999");const i=Ee[o]||Ee.category10;if(r&&"function"==typeof i){let e=-1/0;for(const t of n){const o=Number(t);o>e&&(e=o)}return t=>i(Number(t)/e)}{const e=Array.isArray(i)?i:Be;return(0,de.scaleOrdinal)().domain(n).range(e).unknown("#999")}}function Ye(e,t,o=[3,20],n){let r;if(r="function"==typeof t?t(e):e?.[t],!n)return r;const[i,s]=n,[a,l]=o;if(s===i)return(a+l)/2;let c=(r-i)/(s-i);return 0>c?c=0:c>1&&(c=1),a+c*(l-a)}function Ge(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}function Ve(e,t){return Math.min((e-t.startTime)/t.duration,1)}function Xe(e,t,o){return e+(t-e)*o}function Ue(){return"undefined"!=typeof performance?performance.now():Date.now()}var Ke={fresh:1,aging:1.5,stale:3};function Ze(e,t,o={}){return Number.isFinite(t)&&t>0?Number.isNaN(e)?"fresh":e===1/0?"expired":0>e||t*(o.fresh??Ke.fresh)>e?"fresh":t*(o.aging??Ke.aging)>e?"aging":t*(o.stale??Ke.stale)>e?"stale":"expired":"fresh"}function Qe(e,t,o){if(null!=e)return"function"==typeof e?e(t,o):"object"==typeof e&&null!==e&&"constant"in e?e.constant:t[e]}function Je(e){const{data:t,encoding:o}=e,n=[],r=new Map;return t.forEach((e,t)=>{const i=Qe(o.id,e,t);if(null==i||""===i)throw Error(`[semiotic] Motion encoding row ${t} resolved an empty id.`);const s=i+"";if(r.has(s))throw Error(`[semiotic] Duplicate motion encoding id "${s}".`);const a=Qe(o.process?.group,e,t),l=Qe(o.process?.stage,e,t),c=Qe(o.accessible?.group,e,t)??(null!=a?a+"":null!=l?l+"":void 0),u={};for(const n of Object.keys(o.evidence??{}))u[n]=Qe(o.evidence?.[n],e,t);const d={id:s,datum:e,time:{arrival:Qe(o.time?.arrival,e,t),basis:o.time?.basis,unit:o.time?.unit},placement:{x:Qe(o.placement?.x,e,t),y:Qe(o.placement?.y,e,t),lane:Qe(o.placement?.lane,e,t),space:o.placement?.space},kinematics:{velocityX:Qe(o.kinematics?.velocityX,e,t),velocityY:Qe(o.kinematics?.velocityY,e,t),space:o.kinematics?.space},process:{group:a,stage:l,target:Qe(o.process?.target,e,t),work:Qe(o.process?.work,e,t)},evidence:u,accessible:{description:Qe(o.accessible?.description,e,t),group:c,label:Qe(o.accessible?.label,e,t)??s}};n.push(d),r.set(s,d)}),{rows:n,byId:r}}function et(e){const t=e.now-e.arrival;return{age:t,progress:Number.isFinite(t)&&Number.isFinite(e.ttl)&&e.ttl>0?Math.max(0,t)/e.ttl:t===1/0&&Number.isFinite(e.ttl)&&e.ttl>0?1/0:0,lifecycle:Ze(t,e.ttl,e.thresholds)}}function tt(e){const t=Math.max(0,Math.min(1,e.minOpacity??.1));if(Number.isNaN(e.age))return 1;if(e.age===1/0)return t;if(!Number.isFinite(e.extent)||0>=e.extent)return 1;const o=Math.max(0,e.age);if("step"===e.type)return(e.threshold??.5*e.extent)>o?1:t;if("exponential"===e.type){const n=e.halfLife??e.extent/2;return t+Math.pow(.5,o/(n>0?n:e.extent/2))*(1-t)}return t+Math.max(0,Math.min(1,1-o/e.extent))*(1-t)}function ot(e,t){const o=Number.isFinite(e)?e:0,n=Number.isFinite(t)?t:0;return{velocityX:o,velocityY:n,speed:Math.hypot(o,n),direction:Math.atan2(n,o)}}function nt(e,t,o){return Number.isFinite(o)&&o>0?ot((t.x-e.x)/o,(t.y-e.y)/o):ot(0,0)}function rt(e,t,o){if(1>=o)return 1;const n=o-1;return tt({age:n-t,extent:n,type:e.type,halfLife:e.halfLife??o/2,threshold:e.stepThreshold??.5*o,minOpacity:e.minOpacity??.1})}function it(e){const t=new Map;for(let o=0;e.length>o;o++)t.set(e[o],o);return t}function st(e,t,o){const n=e.duration??500,r=o-t;return n>r?1-r/n:0}function at(e,t,o,n){let r=!1;return t>0?(e._pulseIntensity!==t&&(e._pulseIntensity=t,r=!0),e._pulseColor!==o&&(e._pulseColor=o,r=!0),e._pulseGlowRadius!==n&&(e._pulseGlowRadius=n,r=!0),r):(0!==e._pulseIntensity&&(e._pulseIntensity=0,r=!0),void 0!==e._pulseColor&&(e._pulseColor=void 0,r=!0),void 0!==e._pulseGlowRadius&&(e._pulseGlowRadius=void 0,r=!0),r)}function lt(e,t,o=("undefined"!=typeof performance?performance.now():Date.now())){if(!t||0===t.size)return!1;const n=e.duration??500,r=t.peek();return null!=r&&n>o-r}function ct(e,t,o){if(t._transitionKey)return t._transitionKey;switch(t.type){case"point":if(t.pointId)return"p:"+t.pointId;if("streaming"===e.runtimeMode&&t.datum){const o=e.getX(t.datum),n=e.getY(t.datum);if(e.getCategory)return`p:${e.getCategory(t.datum)}:${o}:${n}`;if(null!=o&&null!=n)return`p:${o}:${n}`}return"p:"+o;case"glyph":return t.pointId?"g:"+t.pointId:"g:"+o;case"rect":return`r:${t.group||""}:${t.datum?.binStart??t.datum?.category??o}`;case"heatcell":return`h:${t.x}_${t.y}`;case"candlestick":return null==t.datum?"c:"+o:"c:"+e.getX(t.datum);case"line":return"l:"+(t.group||"_default");case"area":return"a:"+(t.group||"_default");default:return null}}function ut(e,t,o,n,r,i){const s=[];for(const r of e){const e=o(r),i=n(r);Number.isFinite(e)&&Number.isFinite(i)&&s.push({px:t.x(e),py:t.y(i),rawY:i,d:r})}s.sort((e,t)=>e.px-t.px);const a=Array(s.length),l=Array(s.length),c=Array(s.length);for(let e=0;s.length>e;e++){const t=s[e];a[e]=[t.px,t.py],l[e]=t.rawY,c[e]=t.d}return{type:"line",path:a,rawValues:l,style:r,datum:c,group:i}}function dt(e,t,o,n,r,i,s,a){const l=[];for(const i of e){const e=o(i),s=n(i);if(!Number.isFinite(e)||!Number.isFinite(s))continue;const c=t.x(e),u=a?a(i):r;l.push({px:c,topY:t.y(s),botY:t.y(u)})}l.sort((e,t)=>e.px-t.px);const c=Array(l.length),u=Array(l.length);for(let e=0;l.length>e;e++){const t=l[e];c[e]=[t.px,t.topY],u[e]=[t.px,t.botY]}return{type:"area",topPath:c,bottomPath:u,style:i,datum:e,group:s}}function ht(e,t,o,n){const r=new Map;if("silhouette"===n)for(const n of e){let e=0;for(const r of t)e+=o(r,n)||0;r.set(n,-e/2)}else if("wiggle"===n){e.length>0&&r.set(e[0],0);for(let n=1;e.length>n;n++){const i=e[n-1],s=e[n];let a=0,l=0,c=0;for(const e of t){const t=o(e,s)||0;a+=(2*c+t)*(t-(o(e,i)||0)),l+=t,c+=t}const u=r.get(i)??0;r.set(s,u-(l>0?a/(2*l):0))}if(e.length>0){let n=0;for(const i of e){let e=0;for(const n of t)e+=o(n,i)||0;n+=(r.get(i)??0)+e/2}const i=n/e.length;for(const t of e)r.set(t,(r.get(t)??0)-i)}}else for(const t of e)r.set(t,0);return r}function ft(e,t,o,n,r,i,s){const a=o(e),l=n(e);if(!Number.isFinite(a)||!Number.isFinite(l))return null;const c={type:"point",x:t.x(a),y:t.y(l),r:r,style:i,datum:e};return void 0!==s&&(c.pointId=s),c}function pt(e,t,o,n,r,i,s,a){const l=o(e),c=n(e);if(!Number.isFinite(l)||!Number.isFinite(c))return null;const u={type:"symbol",x:t.x(l),y:t.y(c),size:r,symbolType:i,style:s,datum:e};return void 0!==a&&(u.pointId=a),u}function mt(e,t,o,n,r,i,s){return{type:"rect",x:e,y:t,w:o,h:n,style:r,datum:i,group:s}}function gt(e,t,o,n,r,i,s){const a={type:"heatcell",x:e,y:t,w:o,h:n,fill:r,datum:i};return s?.showValues&&(a.showValues=!0,a.value=s.value,s.valueFormat&&(a.valueFormat=s.valueFormat)),a}function yt(e,t,o,n){return"function"==typeof t.style?t.style(n||{},o):t.style&&"object"==typeof t.style?t.style:e.resolveBoundsStyle(o,n)}function bt(e,t,o,n){if(!e.scales)return null;const r=[],i=[];for(const o of t){const t=e.getX(o);if(!Number.isFinite(t))continue;const s=n.getTop(o),a=n.getBottom(o);if(!Number.isFinite(s)||!Number.isFinite(a))continue;const l=e.scales.x(t),c=e.scales.y(s),u=e.scales.y(a);Number.isFinite(l)&&Number.isFinite(c)&&Number.isFinite(u)&&(r.push([l,c]),i.push([l,u]))}return 2>r.length?null:{type:"area",topPath:r,bottomPath:i,style:yt(e,n,o,t[0]),datum:t,group:o,interactive:n.interactive}}function vt(e){const t=[],o=[];if(!e)return{perSeries:t,aggregate:o};for(const n of e)n.perSeries?t.push(n):o.push(n);return{perSeries:t,aggregate:o}}function xt(e,t,o){const n=[];for(const r of o){const o=bt(e,t,"__ribbon_aggregate",r);o&&n.push(o)}return n}function kt(e,t,o,n){const r=[];for(const i of n){const n=bt(e,t,o,i);n&&r.push(n)}return r}function wt(e,t){if(!e)return{};if(!t||0===t.length)return e;const o=[];for(const n of t){if("band"!==n.kind)continue;const t=n.getTop(e),r=n.getBottom(e);Number.isFinite(r)&&Number.isFinite(t)&&o.push({y0:r,y1:t})}return 0===o.length?e:{...e,band:o[0],bands:o}}function St(e,t,o,n){if(!e.config.pointStyle)return;const r=n??e.getY;for(const n of t){const t=e.resolveGroupColor(n.key);for(const i of n.data){let n=e.config.pointStyle(i);!n.fill&&t&&(n={...n,fill:t});const s=n.r??3,a=e.getPointId?e.getPointId(i)+"":void 0,l=ft(i,e.scales,e.getX,r,s,n,a);l&&o.push(l)}}}function At(e){return"threshold"===e.type&&"string"==typeof e.color&&"number"==typeof e.value}var Ct={topOpacity:.8,bottomOpacity:.05};function Mt(e){if(e)return!0===e?Ct:"colorStops"in e?e:{topOpacity:e.topOpacity??Ct.topOpacity,bottomOpacity:e.bottomOpacity??Ct.bottomOpacity}}var _t=require("d3-shape"),jt={circle:_t.symbolCircle,square:_t.symbolSquare,triangle:_t.symbolTriangle,diamond:_t.symbolDiamond,star:_t.symbolStar,cross:_t.symbolCross,wye:_t.symbolWye},Rt=["circle","triangle","diamond","star","square","chevron","cross","wye"];function Pt(e,t,o){if(o)return o;const n=e??"circle";return"chevron"===n?function(e){const t=1.5*Lt(e),o=.92*t;return`M0,${-t}L${o},${(.78*t).toFixed(3)}L0,${(.28*t).toFixed(3)}L${-o},${(.78*t).toFixed(3)}Z`}(t):(0,_t.symbol)(jt[n]??_t.symbolCircle,Math.max(1,t))()??""}function Lt(e){return Math.sqrt(Math.max(1,e)/Math.PI)}var Tt=new Map;function It(e,t,o,n,r){const i=new Map;for(const s of e){const e=t(s),a=o(s);if(null==e||null==a||Number.isNaN(e)||Number.isNaN(a))continue;const l=Math.floor(e/n)*n;let c=i.get(l);if(c||(c={start:l,end:l+n,total:0,categories:new Map},i.set(l,c)),c.total+=a,r){const e=r(s);c.categories.set(e,(c.categories.get(e)||0)+a)}}return i}function $t(e){if("production"===process.env.NODE_ENV)return;const{label:t,nodes:o,overlays:n,warned:r}=e;Nt(n)&&0===o.length&&Dt(r,"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)&&Dt(r,"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 Nt(e){return null!=e&&!1!==e&&""!==e&&(!Array.isArray(e)||e.some(Nt))}function Dt(e,t,o){e.has(t)||(e.add(t),console.warn(o))}function Et(e,t,o,n){const r=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: ${r.message}`,error:r,recovery:o?"preserved-last-good-scene":"empty-scene",preservedLastGoodScene:o,affectedRevision:n}}function Bt(e,t){const o="function"==typeof e?e:o=>o[e||t];return e=>{const t=o(e);return null==t?NaN:+t}}function Ft(e){const t=[],o=["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode,n=Bt(o&&e.valueAccessor||e.yAccessor,o?"value":"y");if(e.boundsAccessor){const o=re(e.boundsAccessor,"bounds");t.push({kind:"bounds",getTop:e=>{const t=n(e);if(!Number.isFinite(t))return NaN;const r=o(e);return Number.isFinite(r)&&0!==r?t+r:t},getBottom:e=>{const t=n(e);if(!Number.isFinite(t))return NaN;const r=o(e);return Number.isFinite(r)&&0!==r?t-r:t},style:e.boundsStyle,perSeries:!0,interactive:!1})}if(e.band){const o=Array.isArray(e.band)?e.band:[e.band];for(const e of o)t.push({kind:"band",getTop:Bt(e.y1Accessor,"y1"),getBottom:Bt(e.y0Accessor,"y0"),style:e.style,perSeries:!1!==e.perSeries,interactive:!0===e.interactive})}return t}var Ht=require("d3-scale");function Ot(e,t){return t?[t[0]??e[0],t[1]??e[1]]:e}function zt(e,t,o){if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return(0,Ht.scaleLog)().domain(e).range(o).clamp(!0)}return"symlog"===e?(0,Ht.scaleSymlog)().domain(t).range(o):"time"===e?(0,Ht.scaleTime)().domain([new Date(t[0]),new Date(t[1])]).range(o):(0,Ht.scaleLinear)().domain(t).range(o)}function Wt(e,t,o){t>e.capacity&&(e.resize(t),o&&t>o.capacity&&o.resize(t))}function qt(e,t){const o=new te(e.capacity);return e.forEach(()=>o.push(t)),o}function Yt(e,t,o,n){const r=e.push(t);return o&&o.push(n),r}function Gt(e,t,o){if(!t||0===t.size)return;const n=new Set;if(e.forEach((e,t)=>{o(e)&&n.add(t)}),0===n.size)return;const r=t.toArray();t.clear();for(let e=0;r.length>e;e++)n.has(e)||t.push(r[e])}var Vt=new WeakMap;function Xt(){return this.updateResults.last}function Ut(){return this.updateResults.last}function Kt(e){return this.updateResults.subscribe(e)}function Zt(e){this.config.layoutSelection=e}function Qt(){Vt.set(this,!0)}function Jt(){const e=!0===Vt.get(this);return Vt.delete(this),e}function eo(e){Object.assign(e.prototype,{getLastUpdateResult:Xt,getUpdateSnapshot:Ut,subscribeUpdateResult:Kt,setLayoutSelection:Zt,markStylePaintPending:Qt,consumeStylePaintPending:Jt})}var to={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 oo(e,t){const o={...e};for(const e of t)o[to[e]]++;return o}function no(e,t,o){const n=new Set(t);return{changeSet:{...e,...e.keys?{keys:[...e.keys]}:{}},changed:n,revisions:oo(o,n)}}var ro=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=no({kind:"initialize"},[],this.revisions),this.listeners=new Set}get last(){return this.latest}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}record(e,t){const o=no(e,t,this.revisions);this.revisions=o.revisions,this.latest=o;for(const e of[...this.listeners])e();return o}},io=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],so=["scene-style","data-paint","accessibility","evidence"],ao=(e,t)=>({retainedData:e,invalidations:t}),lo=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],co=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],uo=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],ho=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],fo=["scene-geometry","data-paint","accessibility","evidence"],po=["scene-style","data-paint","accessibility","evidence"],mo=[],go={chartType:ao("rebuild",lo),runtimeMode:ao("rebuild",lo),xAccessor:ao("rebuild",lo),yAccessor:ao("rebuild",lo),timeAccessor:ao("rebuild",lo),valueAccessor:ao("rebuild",lo),y0Accessor:ao("rebuild",lo),boundsAccessor:ao("rebuild",lo),band:ao("rebuild",lo),openAccessor:ao("rebuild",lo),highAccessor:ao("rebuild",lo),lowAccessor:ao("rebuild",lo),closeAccessor:ao("rebuild",lo),candlestickRangeMode:ao("rebuild",lo),accessorRevision:ao("rebuild",lo),groupAccessor:ao("rebuild",co),categoryAccessor:ao("rebuild",co),lineDataAccessor:ao("rebuild",co),colorAccessor:ao("rebuild",po),sizeAccessor:ao("rebuild",fo),symbolAccessor:ao("rebuild",fo),pointIdAccessor:ao("rebuild",fo),xScaleType:ao("preserve",uo),yScaleType:ao("preserve",uo),xExtent:ao("preserve",uo),yExtent:ao("preserve",uo),extentPadding:ao("preserve",uo),scalePadding:ao("preserve",uo),axisExtent:ao("preserve",uo),binSize:ao("preserve",uo),normalize:ao("preserve",uo),heatmapAggregation:ao("preserve",uo),heatmapXBins:ao("preserve",uo),heatmapYBins:ao("preserve",uo),arrowOfTime:ao("preserve",ho),baseline:ao("preserve",ho),stackOrder:ao("preserve",ho),sizeRange:ao("preserve",ho),curve:ao("preserve",ho),areaGroups:ao("preserve",ho),customLayout:ao("preserve",ho),layoutConfig:ao("preserve",ho),layoutMargin:ao("preserve",ho),symbolMap:ao("preserve",fo),showValues:ao("preserve",fo),heatmapValueFormat:ao("preserve",fo),lineStyle:ao("preserve",po),pointStyle:ao("preserve",po),areaStyle:ao("preserve",po),barStyle:ao("preserve",po),swarmStyle:ao("preserve",po),waterfallStyle:ao("preserve",po),candlestickStyle:ao("preserve",po),boundsStyle:ao("preserve",po),gradientFill:ao("preserve",po),lineGradient:ao("preserve",po),colorScheme:ao("preserve",po),themeCategorical:ao("preserve",po),themeSemantic:ao("preserve",po),themeSequential:ao("preserve",po),themeDiverging:ao("preserve",po),barColors:ao("preserve",po),decay:ao("preserve",po),pulse:ao("preserve",po),staleness:ao("preserve",po),layoutSelection:ao("preserve",po),annotations:ao("preserve",["overlay","accessibility","evidence"]),windowSize:ao("preserve",mo),windowMode:ao("preserve",mo),maxCapacity:ao("preserve",mo),clock:ao("preserve",mo),transition:ao("preserve",mo),introAnimation:ao("preserve",mo),onLayoutError:ao("preserve",mo)},yo=ao("preserve",ho),bo=class{constructor(){this.tracker=new ro}get last(){return this.tracker.last}subscribe(e){return this.tracker.subscribe(e)}recordData(e,t){return this.tracker.record({kind:e,...void 0===t?{}:{count:t}},io)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},so):this.recordNoop("restyle")}recordConfig(e){const t=function(e){let t="preserve";const o=new Set;for(const n of e){const e=go[n]??yo;"rebuild"===e.retainedData&&(t="rebuild");for(const t of e.invalidations)o.add(t)}return{retainedData:t,invalidations:o}}(e);return this.tracker.record({kind:"config",keys:e},t.invalidations)}},vo=require("d3-quadtree"),xo=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,n=0;for(const e of t)"point"===e.type&&(o++,e.r>n&&(n=e.r));if(this.maxRadius=n,500>=o)return void(this.tree=null);const r=Array(o);let i=0;for(const e of t)"point"===e.type&&(r[i++]=e);this.tree=(0,vo.quadtree)().x(e=>e.x).y(e=>e.y).addAll(r)}},ko=class e{constructor(e){if(this.xExtent=new oe,this.yExtent=new oe,this.growingCapacityWarned=!1,this.windowSizeWarned=!1,this.resolvedRibbons=[],this.timestampBuffer=null,this.activeTransition=null,this._hasRenderedOnce=!1,this.prevPositionMap=new Map,this.prevPathMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this._colorMapCache=null,this._groupDataCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this._ingestVersion=0,this._datumIndexCache=null,this._bufferArrayCache=null,this._bufferDirty=!0,this.needsFullRebuild=!0,this.lastLayout=null,this.updateResults=new bo,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 xo,this._lastBoundedInsertsRef=null,this.applyPulse=(e,t,o)=>!(!this.config.pulse||!this.timestampBuffer)&&function(e,t,o,n,r,i=("undefined"!=typeof performance?performance.now():Date.now())){const s=e.color??"rgba(255,255,255,0.6)",a=e.glowRadius??4;let l=!1;const c=r??(()=>{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 r=0,a=!1;for(const o of t){const t=c.get(o);if(null==t)continue;a=!0;const s=n.get(t);if(null==s)continue;const l=st(e,s,i);l>r&&(r=l)}a&&(l=at(o,r,s)||l);continue}const t=c.get(o.datum);if(null==t)continue;const r=n.get(t);l=at(o,null==r?0:st(e,r,i),s,a)||l}return l}(this.config.pulse,e,t,this.timestampBuffer,this.getDatumIndexMap(t),o),this.config=e,this.buffer=new te(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=re(e.timeAccessor||e.xAccessor,"time"),this.getY=re(e.valueAccessor||e.yAccessor,"value")):(this.getX=re(e.xAccessor,"x"),this.getY=re(e.yAccessor,"y")),this.getGroup=se(e.groupAccessor),this.getCategory=se(e.categoryAccessor),this.getSize=e.sizeAccessor?re(e.sizeAccessor,"size"):void 0,this.getColor=se(e.colorAccessor),this.getSymbol=se(e.symbolAccessor),this.getY0=e.y0Accessor?re(e.y0Accessor,"y0"):void 0,this.resolvedRibbons=Ft(e),this.getPointId=se(e.pointIdAccessor),"candlestick"===e.chartType){const t=null!=e.openAccessor,o=null!=e.closeAccessor;this.getOpen=t?re(e.openAccessor,"open"):void 0,this.getHigh=re(e.highAccessor,"high"),this.getLow=re(e.lowAccessor,"low"),this.getClose=o?re(e.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!t&&!o}e.pulse&&(this.timestampBuffer=new te(e.windowSize))}currentTime(){return this.config.clock?.()??Ue()}syncPulseTimestampBuffer(){this.config.pulse?null!=this.timestampBuffer&&this.timestampBuffer.capacity===this.buffer.capacity&&this.timestampBuffer.size===this.buffer.size||(this.timestampBuffer=qt(this.buffer,this.currentTime())):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),n=t.getBottom(e);Number.isFinite(o)&&this.yExtent.push(o),Number.isFinite(n)&&this.yExtent.push(n)}}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),n=t.getBottom(e);Number.isFinite(o)&&this.yExtent.evict(o),Number.isFinite(n)&&this.yExtent.evict(n)}}rebuildYExtent(){this.yExtent.clear();for(const e of this.buffer)this.pushDatumYExtent(e)}rebuildExtents(){this.xExtent.clear(),this.yExtent.clear();for(const e of this.buffer)this.xExtent.push(this.getX(e)),this.pushDatumYExtent(e)}ingest(e){if(e.bounded&&this._lastBoundedInsertsRef===e.inserts)return this.updateResults.recordNoop("replace"),!1;const t=this.currentTime();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?re(this.config.timeAccessor||this.config.xAccessor,"time"):re(this.config.xAccessor,"x"),this.xIsDate=!1,e.inserts.length>0){const t=e.inserts[0],o=this.config.xAccessor,n="function"==typeof o?o(t):t[o||"x"],r=n instanceof Date,i="string"==typeof n&&Number.isFinite(le(n));if(this.xIsDate=r||i,i){const e="string"==typeof o?o:void 0;this.getX=e?t=>ce(t[e]):e=>ce(o(e))}}Wt(this.buffer,e.totalSize||e.inserts.length,this.timestampBuffer);for(const o of e.inserts)Yt(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=Yt(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,n=this.scales,r=this.lastLayout;if(!this.needsFullRebuild&&!t.customLayout&&this.lastLayout&&this.scene.length>0&&this.scales&&0>=(this.config.scalePadding??0)&&(this.lastLayout.width!==e.width||this.lastLayout.height!==e.height))return void this.remapScene(e);this.xExtent.dirty&&this.xExtent.recalculate(o,this.getX),this.yExtent.dirty&&this.rebuildYExtent();const i=this.getBufferArray(),s=this.yExtent.extent;let a=Ot(this.xExtent.extent,t.xExtent),l=Ot(s,t.yExtent);const c=!(!(u=t.yExtent)||null==u[0]||null==u[1]);var u;const d="exact"===t.axisExtent;if("stackedarea"===t.chartType&&!c&&o.size>0){const e=function(e){const{config:t,groups:o,getX:n,getY:r}=e,i="exact"===t.axisExtent;if(t.normalize){const o=[0,i?1:1+t.extentPadding];return{yDomain:o,stackExtentCache:{key:`${e.bufferSize}:${e.ingestVersion}:norm`,yDomain:o}}}const s=`${e.bufferSize}:${e.ingestVersion}:${t.baseline??"zero"}:${t.stackOrder??"key"}`;if(e.stackExtentCache&&e.stackExtentCache.key===s)return{yDomain:e.stackExtentCache.yDomain,stackExtentCache:e.stackExtentCache};const a=new Map,l=new Set;let c=0;const u=new Map,d=new Map;for(const e of o){const t=new Map;let o=0;for(const i of e.data){const e=n(i),s=r(i);if(!Number.isFinite(e)||!Number.isFinite(s))continue;t.set(e,(t.get(e)||0)+s),l.add(e),o+=s;const a=(u.get(e)||0)+s;u.set(e,a),a>c&&(c=a)}a.set(e.key,t),d.set(e.key,o)}const h=t.stackOrder??"key",f=(e,t)=>t>e?-1:e>t?1:0;let p,m;if("input"===h)p=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:f(e,t)}),t=[],n=[];let r=0,i=0;for(const o of e)i>r?(t.push(o),r+=d.get(o)??0):(n.push(o),i+=d.get(o)??0);p=[...n.reverse(),...t]}else p="asc"===h?o.map(e=>e.key).sort((e,t)=>{const o=(d.get(e)??0)-(d.get(t)??0);return 0!==o?o:f(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:f(e,t)}):o.map(e=>e.key).sort(f);if("wiggle"===t.baseline||"silhouette"===t.baseline){const e=Array.from(l).sort((e,t)=>e-t),o=ht(e,p,(e,t)=>a.get(e)?.get(t)||0,t.baseline);let n=1/0,r=-1/0;for(const t of e){const e=o.get(t)??0,i=u.get(t)??0;n>e&&(n=e),e+i>r&&(r=e+i)}Number.isFinite(n)&&Number.isFinite(r)||(n=0,r=0);const s=r-n,c=i?0:s>0?s*t.extentPadding:1;m=[n-c,r+c]}else if("diverging"===t.baseline){const e=Array.from(l).sort((e,t)=>e-t),[o,n]=function(e,t,o){let n=0,r=0;for(const i of e){let e=0,s=0;for(const n of t){const t=o(n,i)||0;0>t?s+=t:e+=t}n>s&&(n=s),e>r&&(r=e)}return[n,r]}(e,p,(e,t)=>a.get(e)?.get(t)||0),r=n-o,s=i?0:r>0?r*t.extentPadding:1;m=[o-s,n+s]}else m=[0,c+(i?0:c>0?c*t.extentPadding:1)];return{yDomain:m,stackExtentCache:{key:s,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,n,r,i,s){const[,a]=function(e,t,o,n,r){const i=It(e,t,o,n,r);if(0===i.size)return[0,0];let s=0;for(const e of i.values())e.total>s&&(s=e.total);return[0,s]}(e,t,o,n,r);return[0,s?a:a+a*i]}(o,this.getX,this.getY,t.binSize,this.getCategory,t.extentPadding,d):"waterfall"===t.chartType&&!c&&o.size>0?l=function(e,t,o,n){const[r,i]=function(e,t){let o=0,n=0,r=0;for(const i of e){const e=t(i);null==e||Number.isNaN(e)||(r+=e,o>r&&(o=r),r>n&&(n=r))}return[o,n]}(e,t),s=i-r,a=n?0:s>0?s*o:1;return[Math.min(0,r-Math.abs(a)),Math.max(0,i+Math.abs(a))]}(o,this.getY,t.extentPadding,d):c||l[0]===1/0||(l=function(e,t,o){if(!o.length)return e;let[n,r]=e;for(const e of t)for(const t of o){const o=t.getTop(e),i=t.getBottom(e);Number.isFinite(o)&&(n>o&&(n=o),o>r&&(r=o)),Number.isFinite(i)&&(n>i&&(n=i),i>r&&(r=i))}return[n,r]}(l,i,this.resolvedRibbons),l=function(e,t){const o=e[1]-e[0],n=t.exactMode?0:o>0?o*t.extentPadding:1,r=[null!=t.userMin?e[0]:e[0]-n,null!=t.userMax?e[1]:e[1]+n];return"log"!==t.yScaleType||r[0]>0||0>=t.dataYDomain[0]||t.exactMode||null==t.userMin&&(r[0]=t.dataYDomain[0]/(1+t.extentPadding)),r}(l,{exactMode:d,extentPadding:t.extentPadding,userMin:t.yExtent?.[0],userMax:t.yExtent?.[1],yScaleType:t.yScaleType,dataYDomain:s}));l=function(e,t,o){if(!t||o)return e;const n=t[0],r=t[1];return null==n&&null==r?e:[null!=n?n:e[0],null!=r?r:e[1]]}(l,t.yExtent,!!c),({xDomain:a,yDomain:l}=function(e,t,o){let n=e,r=t;if(n[0]===1/0||n[1]===-1/0)if("time"===o){const e=Date.now();n=[e-864e5,e]}else n=[0,1];return r[0]!==1/0&&r[1]!==-1/0||(r=[0,1]),{xDomain:n,yDomain:r}}(a,l,t.xScaleType)),this.scales=function(e){const{config:t,layout:o,xDomain:n,yDomain:r}=e,i="streaming"===t.runtimeMode,s=Math.max(0,Math.min(t.scalePadding||0,Math.min(o.width,o.height)/2-1));if(i){if("x"==("up"===(a=t.arrowOfTime)||"down"===a?"y":"x")){const e="right"===t.arrowOfTime?[s,o.width-s]:[o.width-s,s];return{x:(0,Ht.scaleLinear)().domain(n).range(e),y:zt(t.yScaleType,r,[o.height-s,s])}}const e="down"===t.arrowOfTime?[s,o.height-s]:[o.height-s,s];return{x:zt(t.yScaleType,r,[s,o.width-s]),y:(0,Ht.scaleLinear)().domain(n).range(e)}}var a;return{x:zt(t.xScaleType,n,[s,o.width-s]),y:zt(t.yScaleType,r,[o.height-s,s])}}({config:t,layout:e,xDomain:a,yDomain:l}),this._customLayoutFailedThisBuild=!1;const h=this.buildSceneNodes(e,i);if(this._customLayoutFailedThisBuild)return!0===this.lastCustomLayoutFailure?.preservedLastGoodScene?(this.scales=n,this.lastLayout=r):(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.currentTime()),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 n of e.path)n[0]*=t,n[1]*=o;break;case"area":for(const n of e.topPath)n[0]*=t,n[1]*=o;for(const n of e.bottomPath)n[0]*=t,n[1]*=o;e.clipRect&&(e.clipRect={x:e.clipRect.x*t,y:e.clipRect.y*o,width:e.clipRect.width*t,height:e.clipRect.height*o});break;case"point":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 n=this.scales.x.domain(),r=this.scales.y.domain(),i=this.scales.x.range(),s=this.scales.y.range(),a=zt,l=Math.max(0,Math.min(this.config.scalePadding||0,Math.min(e.width,e.height)/2-1)),c=s[1]>s[0];this.scales={x:a(this.config.xScaleType,n,i[0]>i[1]?[e.width-l,l]:[l,e.width-l]),y:a(this.config.yScaleType,r,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:n}=this;if(!n)return[];if(o.customLayout){const r={data:t,scales:n,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 n=this.resolveGroupColor(e);if(n)return n;const r=this.resolveLineStyle(e,t);return r.stroke?r.stroke:"string"==typeof r.fill?r.fill:o.themeSemantic?.primary??"#4e79a7"},config:o.layoutConfig??{},selection:o.layoutSelection??null};let i;try{i=o.customLayout(r)}catch(e){const t=null!==this.lastCustomLayoutResult,n=Et("xy",e,t,this.version);this.lastCustomLayoutFailure=n,this._customLayoutFailedThisBuild=!0,"production"!==process.env.NODE_ENV&&console.error("[semiotic] customLayout threw:",e);try{o.onLayoutError?.(n)}catch(e){"production"!==process.env.NODE_ENV&&console.error("[semiotic] onLayoutError threw:",e)}return t?this.scene:(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,[])}this.customLayoutOverlays=i.overlays??null,this.lastCustomLayoutResult=i,this.lastCustomLayoutFailure=null;const s=i.nodes??[];if(this._customRestyle=i.restyle,this.hasCustomRestyle=!!i.restyle,this.hasCustomRestyle){this._baseStyles=new WeakMap;for(const e of s)e.style&&this._baseStyles.set(e,e.style);this.applyCustomRestyle(s,o.layoutSelection??null)}return $t({label:"customLayout",nodes:s,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned}),s}if(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,0===t.length)return[];const r={scales:n,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),n=[],r=e.config.annotations?.filter(At).map(e=>({value:e.value,color:e.color,thresholdType:e.thresholdType||"greater"}));if(e.ribbons&&e.ribbons.length>0){const{perSeries:r,aggregate:i}=vt(e.ribbons);if(i.length>0&&n.push(...xt(e,t,i)),r.length>0)for(const t of o)n.push(...kt(e,t.data,t.key,r))}for(const t of o){const o=e.resolveLineStyle(t.key,t.data[0]),i=ut(t.data,e.scales,e.getX,e.getY,o,t.key);r&&r.length>0&&(i.colorThresholds=r),e.config.curve&&"linear"!==e.config.curve&&(i.curve=e.config.curve),e.config.lineGradient&&(i.strokeGradient=e.config.lineGradient),n.push(i)}return St(e,o,n),n}(r,t);case"area":return function(e,t){const o=e.groupData(t),n=[];if(e.ribbons&&e.ribbons.length>0){const{perSeries:r,aggregate:i}=vt(e.ribbons);if(i.length>0&&n.push(...xt(e,t,i)),r.length>0)for(const t of o)n.push(...kt(e,t.data,t.key,r))}const r=e.scales.y.domain()[0],i=e.getY0?t=>{const o=e.getY0(t);return null==o?r:o}:void 0;for(const t of o){const o=e.resolveAreaStyle(t.key,t.data[0]),s=dt(t.data,e.scales,e.getX,e.getY,r,o,t.key,i),a=Mt(e.config.gradientFill);a&&(s.fillGradient=a),e.config.curve&&"linear"!==e.config.curve&&(s.curve=e.config.curve),e.config.lineGradient&&(s.strokeGradient=e.config.lineGradient),n.push(s)}return St(e,o,n),n}(r,t);case"mixed":return function(e,t){const o=e.groupData(t),n=[],r=e.config.areaGroups||new Set;if(e.ribbons&&e.ribbons.length>0){const{perSeries:r,aggregate:i}=vt(e.ribbons);if(i.length>0&&n.push(...xt(e,t,i)),r.length>0)for(const t of o)n.push(...kt(e,t.data,t.key,r))}const i=e.scales.y.domain()[0],s=e.getY0?t=>{const o=e.getY0(t);return null==o?i:o}:void 0;for(const t of o)if(r.has(t.key)){const o=e.resolveAreaStyle(t.key,t.data[0]),r=dt(t.data,e.scales,e.getX,e.getY,i,o,t.key,s),a=Mt(e.config.gradientFill);a&&(r.fillGradient=a),e.config.curve&&"linear"!==e.config.curve&&(r.curve=e.config.curve),e.config.lineGradient&&(r.strokeGradient=e.config.lineGradient),n.push(r)}else{const o=e.resolveLineStyle(t.key,t.data[0]),r=ut(t.data,e.scales,e.getX,e.getY,o,t.key);e.config.curve&&"linear"!==e.config.curve&&(r.curve=e.config.curve),e.config.lineGradient&&(r.strokeGradient=e.config.lineGradient),n.push(r)}return St(e,o,n),n}(r,t);case"stackedarea":return function(e,t){const o=e.groupData(t),n=e.config.stackOrder??"key",r=()=>o.sort((e,t)=>t.key>e.key?-1:e.key>t.key?1:0);if("input"===n);else if("key"===n)r();else if("asc"===n||"desc"===n||"insideOut"===n){const t=new Map;for(const n of o){let o=0;for(const t of n.data){const n=e.getX(t),r=e.getY(t);Number.isFinite(n)&&Number.isFinite(r)&&(o+=r)}t.set(n.key,o)}const r=(e,t)=>t>e?-1:e>t?1:0;if("asc"===n)o.sort((e,o)=>{const n=(t.get(e.key)??0)-(t.get(o.key)??0);return 0!==n?n:r(e.key,o.key)});else if("desc"===n)o.sort((e,o)=>{const n=(t.get(o.key)??0)-(t.get(e.key)??0);return 0!==n?n:r(e.key,o.key)});else{const e=[...o].sort((e,o)=>{const n=(t.get(o.key)??0)-(t.get(e.key)??0);return 0!==n?n:r(e.key,o.key)}),n=[],i=[];let s=0,a=0;for(const o of e)a>s?(n.push(o),s+=t.get(o.key)??0):(i.push(o),a+=t.get(o.key)??0);o.length=0,o.push(...i.reverse(),...n)}}else r();const i=e.config.curve&&"linear"!==e.config.curve?e.config.curve:void 0,s=e.config.normalize?"zero":e.config.baseline??"zero",{nodes:a,stackedTops:l}=function(e,t,o,n,r,i,s,a="zero"){const l=new Set;for(const t of e)for(const e of t.data){const t=o(e);Number.isFinite(t)&&l.add(t)}const c=Array.from(l).sort((e,t)=>e-t),u=new Map;for(const t of e){const e=new Map;for(const r of t.data){const t=o(r),i=n(r);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 n of e)o+=u.get(n.key)?.get(t)||0;d.set(t,o||1)}}const h=ht(c,e.map(e=>e.key),(e,t)=>u.get(e)?.get(t)||0,a),f="diverging"===a&&!i,p=[],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),n=new Map;let a=[],l=[];const h=()=>{if(a.length>=2){const e={type:"area",topPath:a,bottomPath:l,style:r(o.key,o.data[0]),datum:o.data,group:o.key};s&&(e.curve=s),p.push(e)}a=[],l=[]};for(const o of c){const r=e.has(o);let s,c,u=r?e.get(o):0;if(i&&r&&(u/=d.get(o)),!r||!Number.isFinite(u)||0===u){h();continue}f?u>0?(s=y.get(o),c=s+u,y.set(o,c)):(s=b.get(o),c=s+u,b.set(o,c)):(s=g.get(o),c=s+u,g.set(o,c));const p=t.x(o);l.push([p,t.y(s)]),a.push([p,t.y(c)]),n.set(o,c)}h(),m.set(o.key,n)}return{nodes:p,stackedTops:m}}(o,e.scales,e.getX,e.getY,(t,o)=>e.resolveAreaStyle(t,o),e.config.normalize,i,s),c=a;if(e.config.pointStyle){const t=new WeakMap;for(const n of o){const o=l.get(n.key);if(o)for(const r of n.data){const n=e.getX(r),i=e.getY(r);null==n||Number.isNaN(n)||null==i||Number.isNaN(i)||!o.has(n)||t.set(r,o.get(n))}}const n=o=>t.get(o)??e.getY(o);St(e,o,c,n)}return c}(r,t);case"scatter":case"bubble":return function(e,t){const o=[],n="bubble"===e.config.chartType?10:5,r=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 n of o)e>n&&(e=n),n>t&&(t=n);i=o=>e===t?(r[0]+r[1])/2:r[0]+(o-e)/(t-e)*(r[1]-r[0])}}const s=e.getColor?e.resolveColorMap(t):null,a=e.config.themeSemantic?.primary||"#4e79a7",l=e.getSymbol,c=e.config.symbolMap,u=new Map;let d=0;const h=e=>{const t=c?.[e];if(t)return t;let o=u.get(e);return o||(o=Rt[d%Rt.length],d++,u.set(e,o)),o};for(const r of t){let t=e.config.pointStyle?e.config.pointStyle(r):{fill:a,opacity:.8},c=t.r||n;if(i&&e.getSize){const t=e.getSize(r);null==t||Number.isNaN(t)||(c=i(t))}if(s&&e.getColor&&!t.fill){const o=e.getColor(r);o&&s.has(o)&&(t={...t,fill:s.get(o)})}const u=e.getPointId?e.getPointId(r)+"":void 0;if(l){const n=h(l(r)+""),i=pt(r,e.scales,e.getX,e.getY,Math.PI*c*c,n,t,u);i&&o.push(i)}else{const n=ft(r,e.scales,e.getX,e.getY,c,t,u);n&&o.push(n)}}return o}(r,t);case"heatmap":return function(e,t,o){if(e.config.heatmapAggregation)return function(e,t,o){const n=Math.max(1,Math.floor(e.config.heatmapXBins??20)),r=Math.max(1,Math.floor(e.config.heatmapYBins??20)),i=e.config.heatmapAggregation??"count",s=re(e.config.valueAccessor,"value");if(!e.scales||0===t.length)return[];const[a,l]=e.scales.x.domain(),[c,u]=e.scales.y.domain(),d=(l-a||1)/n,h=(u-c||1)/r,f=n*r;if(f>1e6)return[];const p=new Int32Array(f),m=new Float64Array(f);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 f=Math.min(Math.floor((l-a)/d),n-1),g=Math.min(Math.floor((u-c)/h),r-1);if(0>f||0>g)continue;const y=g*n+f;p[y]++;const b=s(i);m[y]+=isFinite(b)?b:0}let g=1/0,y=-1/0;for(let e=0;f>e;e++){if(0===p[e])continue;let t;switch(i){case"sum":t=m[e];break;case"mean":t=m[e]/p[e];break;default:t=p[e]}g>t&&(g=t),t>y&&(y=t)}if(!isFinite(g))return[];const b=y-g||1,v=o.width/n,x=o.height/r,k=e.config.showValues,w=e.config.heatmapValueFormat,S=[];for(let e=0;r>e;e++){const t=e*n;for(let o=0;n>o;o++){const n=t+o;if(0===p[n])continue;let s;switch(i){case"sum":s=m[n];break;case"mean":s=m[n]/p[n];break;default:s=p[n]}const l=(s-g)/b;S.push(gt(o*v,(r-1-e)*x,v,x,`rgb(${220-(180*l+.5)|0},${220-(100*l+.5)|0},${255-(50*l+.5)|0})`,{xi:o,yi:e,value:s,count:p[n],sum:m[n],xCenter:a+(o+.5)*d,yCenter:c+(e+.5)*h,agg:i},k?{value:s,showValues:!0,valueFormat:w}:void 0))}}return S}(e,t,o);if(0===t.length)return[];const n=re(e.config.valueAccessor,"value"),r=ie(e.config.xAccessor,"x"),i=ie(e.config.yAccessor,"y"),s=new Map,a=new Map,l=Array(t.length),c=Array(t.length);for(let e=0;t.length>e;e++){const o=t[e],n=r(o),u=i(o);l[e]=n,c[e]=u,s.has(n)||s.set(n,s.size),a.has(u)||a.set(u,a.size)}const u=s.size,d=a.size;if(0===u||0===d)return[];const h=Array.from(s.keys()),f=Array.from(a.keys()),p=h.every(e=>"number"==typeof e&&!isNaN(e)),m=f.every(e=>"number"==typeof e&&!isNaN(e));if(p){h.sort((e,t)=>Number(e)-Number(t)),s.clear();for(let e=0;h.length>e;e++)s.set(h[e],e)}if(m){f.sort((e,t)=>Number(e)-Number(t)),a.clear();for(let e=0;f.length>e;e++)a.set(f[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],r=s.get(l[e]),i=a.get(c[e]);if(void 0===r||void 0===i)continue;const d=n(o),h=i*u+r,f=v.get(h);let p;void 0!==f?p=f:(p=x++,v.set(h,p)),g[p]=h,y[p]=d,b[p]=o}let k=1/0,w=-1/0;for(let e=0;x>e;e++){const t=y[e];isFinite(t)&&(k>t&&(k=t),t>w&&(w=t))}if(!isFinite(k)||!isFinite(w))return[];const S=function(e){const t=e in je?e:"blues";let o=Tt.get(t);if(o)return o;o=Array(256);const n=Re(t);for(let e=0;256>e;e++)o[e]=n(e/255);return Tt.set(t,o),o}("string"==typeof e.config.colorScheme?e.config.colorScheme:e.config.themeSequential||"blues"),A=255/(w-k||1),C=o.width/u,M=o.height/d,_=e.config.showValues,j=e.config.heatmapValueFormat,R=[];for(let e=0;x>e;e++){const t=y[e];if(!isFinite(t))continue;const o=g[e],n=o%u;R.push(gt(n*C,(d-1-(o-n)/u)*M,C,M,S[Math.min((t-k)*A+.5|0,255)],b[e],_?{value:t,showValues:!0,valueFormat:j}:void 0))}return R}(r,t,e);case"bar":{const e=function(e,t){if(!e.config.binSize)return{nodes:[],binBoundaries:[]};const o=It(t,e.getX,e.getY,e.config.binSize,e.getCategory);if(0===o.size)return{nodes:[],binBoundaries:[]};let n=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 r=e.config.barColors?Object.keys(e.config.barColors):[],i=new Set(r),s=Array.from(t).filter(e=>!i.has(e)).sort(),a=r.filter(e=>t.has(e)),l=a.join("\0")+""+s.join("\0");e.barCategoryCache&&e.barCategoryCache.key===l?n=e.barCategoryCache.order:(n=[...a,...s],e.barCategoryCache={key:l,order:n})}const r=[],i=e.scales,[s,a]=i.x.domain(),l=e.config.barStyle,c=e.config.themeSemantic?.primary,u=l?.gap,d="number"!=typeof u||0>u?1:u,h={};l?.stroke&&(h.stroke=l.stroke),"number"==typeof l?.strokeWidth&&(h.strokeWidth=l.strokeWidth),"number"==typeof l?.opacity&&(h.opacity=l.opacity);for(const t of o.values()){const o=Math.max(t.start,s),u=Math.min(t.end,a);if(o>=u)continue;const f=i.x(o),p=i.x(u),m=Math.abs(p-f),g=m>d+1?d:0,y=Math.min(f,p)+g/2,b=Math.max(m-g,1);if(b>0)if(n&&t.categories.size>0){let o=0;for(const s of n){const n=t.categories.get(s)||0;if(0===n)continue;const a=i.y(o),u=i.y(o+n);r.push(mt(y,Math.min(a,u),b,Math.abs(a-u),{fill:e.config.barColors?.[s]||l?.fill||c||"#4e79a7",...h},{binStart:t.start,binEnd:t.end,total:t.total,category:s,categoryValue:n},s)),o+=n}}else{const e=i.y(0),o=i.y(t.total);r.push(mt(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 f=new Set;for(const e of o.values())f.add(e.start),f.add(e.end);return{nodes:r,binBoundaries:Array.from(f).sort((e,t)=>e-t)}}(r,t);return this._barCategoryCache=r.barCategoryCache??null,this._binBoundaries=e.binBoundaries,e.nodes}case"swarm":return function(e,t){const o=[],n=e.config.swarmStyle||{},r=n.radius??3,i=n.fill??e.config.themeSemantic?.primary??"#007bff",s=n.opacity??.7,a=n.stroke,l=n.strokeWidth;for(const n of t){const t=e.getX(n),c=e.getY(n);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(n);h=e.config.barColors?.[t]||h}const{r:f,...p}=e.config.pointStyle?.(n)??{},m={type:"point",x:u,y:d,r:f??r,style:{fill:h,opacity:s,stroke:a,strokeWidth:l,...p},datum:n};e.getPointId&&(m.pointId=e.getPointId(n)+""),o.push(m)}return o}(r,t);case"waterfall":return function(e,t,o){const n=[],r=e.scales,i=e.config.waterfallStyle,s=t.filter(t=>{const o=e.getY(t),n=e.getX(t);return null!=o&&!Number.isNaN(o)&&null!=n&&isFinite(n)});if(0===s.length)return n;const a=i?.positiveColor??e.config.themeSemantic?.success??"#28a745",l=i?.negativeColor??e.config.themeSemantic?.danger??"#dc3545",c=i?.gap??1,u=i?.stroke,d=i?.strokeWidth,h=i?.opacity;let f=0;for(let t=0;s.length>t;t++){const p=s[t],m=e.getX(p),g=e.getY(p),y=f+g;let b;b=s.length-1>t?e.getX(s[t+1])-m:t>0?m-e.getX(s[t-1]):0;const v=r.x(m),x=0!==b?r.x(m+b):v+o.width/10,k=Math.min(v,x)+c/2,w=Math.max(v,x)-c/2-k;if(0>=w){f=y;continue}const S=r.y(f),A=r.y(y),C=Math.min(S,A),M=Math.abs(S-A),_={fill:0>g?l:a,stroke:u,strokeWidth:d};null!=h&&(_.opacity=h),n.push(mt(k,C,w,M,_,{...p,baseline:f,cumEnd:y,delta:g,_connectorStroke:i?.connectorStroke,_connectorWidth:i?.connectorWidth})),f=y}return n}(r,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 n=[],r=e.config.candlestickStyle||{},i=r.rangeColor||"#6366f1",s=o?i:r.upColor||"#28a745",a=o?i:r.downColor||"#dc3545",l=o?i:r.wickColor||"#333",c=r.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=r.bodyWidth??0;if(null==r.bodyWidth)if(u.length>1){let t=1/0;for(let o=1;u.length>o;o++){const n=Math.abs(e.scales.x(u[o])-e.scales.x(u[o-1]));n>0&&t>n&&(t=n)}d=t!==1/0?Math.max(2,Math.min(.6*t,20)):6}else d=6;for(const r of t){const t=e.getX(r);if(null==t||Number.isNaN(t))continue;const i=e.getHigh(r),u=e.getLow(r);if(null==i||Number.isNaN(i)||null==u||Number.isNaN(u))continue;const h=o?i:e.getOpen(r),f=o?u:e.getClose(r);if(!o&&[h,f].some(e=>null==e||Number.isNaN(e)))continue;const p=f>=h,m={type:"candlestick",x:e.scales.x(t),openY:e.scales.y(h),closeY:e.scales.y(f),highY:e.scales.y(i),lowY:e.scales.y(u),bodyWidth:d,upColor:s,downColor:a,wickColor:l,wickWidth:c,isUp:p,datum:r};o&&(m.isRange=!0),n.push(m)}return n}(r,t);default:return[]}}resolveBoundsStyle(e,t){return function(e,t,o,n){const r=e.boundsStyle;return"function"==typeof r?r(o||{},t):r&&"object"==typeof r?r:{fill:n(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?rt(o,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._ingestVersion)return this._datumIndexCache.map;const t=it(e);return this._datumIndexCache={version:this._ingestVersion,map:t},t}applyDecay(e,t){this.config.decay&&function(e,t,o,n=it(o)){const r=o.length;if(r>1)for(const o of t){if("line"===o.type){const t=Array.isArray(o.datum)?o.datum:[];if(2>t.length)continue;const i=Array(t.length);let s=!1;for(let o=0;t.length>o;o++){const a=n.get(t[o]);null!=a?(i[o]=rt(e,a,r),1>i[o]&&(s=!0)):i[o]=1}s&&(o._decayOpacities=i);continue}if("area"===o.type){const t=Array.isArray(o.datum)?o.datum:[],i=o.topPath?o.topPath.length:t.length;if(2>i)continue;if(t.length===i){const s=Array(i);let a=!1;for(let o=0;t.length>o;o++){const i=n.get(t[o]);null!=i?(s[o]=rt(e,i,r),1>s[o]&&(a=!0)):s[o]=1}a&&(o._decayOpacities=s)}else{let s=1;for(const o of t){const t=n.get(o);if(null!=t){const o=rt(e,t,r);s>o&&(s=o)}}if(1>s){const e=Array(i);e.fill(s),o._decayOpacities=e}}continue}const t=n.get(o.datum);if(null==t)continue;const i=rt(e,t,r);"heatcell"===o.type?o.style={opacity:i}:"candlestick"===o.type?o._decayOpacity=i:o.style={...o.style,opacity:(o.style?.opacity??1)*i}}}(this.config.decay,e,t,this.getDatumIndexMap(t))}refreshPulse(e){return!0!==this.lastCustomLayoutFailure?.preservedLastGoodScene&&this.applyPulse(this.scene,this.getBufferArray(),e)}hasActivePulsesAt(e){return!!this.config.pulse&<(this.config.pulse,this.timestampBuffer,e)}get hasActivePulses(){return this.hasActivePulsesAt(this.currentTime())}get transitionContext(){return{runtimeMode:this.config.runtimeMode,getX:this.getX,getY:this.getY,getCategory:this.getCategory}}snapshotPositions(){!function(e,t,o,n){o.clear(),n.clear();for(let r=0;t.length>r;r++){const i=t[r],s=ct(e,i,r);s&&("point"===i.type?o.set(s,{x:i.x,y:i.y,r:i.r,opacity:i.style.opacity}):"glyph"===i.type?o.set(s,{x:i.x,y:i.y,r:i.size,opacity:i.style.opacity,glyph:i.glyph}):"rect"===i.type?o.set(s,{x:i.x,y:i.y,w:i.w,h:i.h,opacity:i.style.opacity}):"heatcell"===i.type?o.set(s,{x:i.x,y:i.y,w:i.w,h:i.h,opacity:i.style?.opacity}):"candlestick"===i.type?o.set(s,{x:i.x,y:i.openY,w:i.bodyWidth,openY:i.openY,closeY:i.closeY,highY:i.highY,lowY:i.lowY,opacity:i.style?.opacity}):"line"===i.type?n.set(s,{path:i.path.map(e=>[e[0],e[1]]),opacity:i.style?.opacity}):"area"===i.type&&n.set(s,{topPath:i.topPath.map(e=>[e[0],e[1]]),bottomPath:i.bottomPath.map(e=>[e[0],e[1]]),opacity:i.style?.opacity}))}}(this.transitionContext,this.scene,this.prevPositionMap,this.prevPathMap)}synthesizeIntroPositions(){this.prevPositionMap.clear(),this.prevPathMap.clear();const e=this.scales?.y(0)??0;for(let t=0;this.scene.length>t;t++){const o=this.scene[t],n=ct(this.transitionContext,o,t);n&&("point"===o.type?this.prevPositionMap.set(n,{x:o.x,y:o.y,r:0,opacity:0}):"rect"===o.type?this.prevPositionMap.set(n,{x:o.x,y:e,w:o.w,h:0,opacity:o.style.opacity??1}):"heatcell"===o.type?this.prevPositionMap.set(n,{x:o.x,y:o.y,w:o.w,h:o.h,opacity:0}):"line"===o.type?(o._introClipFraction=0,this.prevPathMap.set(n,{path:o.path.map(e=>[e[0],e[1]]),opacity:o.style.opacity})):"area"===o.type&&(o._introClipFraction=0,this.prevPathMap.set(n,{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,n,r,i=Ue()){if(0===n.size&&0===r.size)return o;const s=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 l=new Set,c=new Set;for(let t=0;o.scene.length>t;t++){const i=o.scene[t],s=ct(e,i,t);if(!s)continue;if(i._transitionKey=s,"line"===i.type||"area"===i.type){const e=r.get(s);if(e){if(c.add(s),"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=n.get(s);if("point"===i.type)if(u){l.add(s);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){l.add(s);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){l.add(s);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){l.add(s);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){l.add(s);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 r)if(!c.has(e))if(e.startsWith("l:")&&t.path){const n={type:"line",path:t.path.map(e=>[e[0],e[1]]),group:e.slice(2),style:{stroke:"#999",strokeWidth:1,opacity:t.opacity??1},_targetOpacity:0,_transitionKey:e,datum:null};o.exitNodes.push(n),a=!0}else if(e.startsWith("a:")&&t.topPath&&t.bottomPath){const n={type:"area",topPath:t.topPath.map(e=>[e[0],e[1]]),bottomPath:t.bottomPath.map(e=>[e[0],e[1]]),group:e.slice(2),style:{fill:"#999",opacity:t.opacity??1},_targetOpacity:0,_transitionKey:e,datum:null};o.exitNodes.push(n),a=!0}for(const[e,t]of n)if(!l.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 n=t.openY??t.y;o.exitNodes.push({type:"candlestick",x:t.x,openY:n,closeY:t.closeY??n,highY:t.highY??n,lowY:t.lowY??n,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:i,duration:s}),o}(this.transitionContext,this.config.transition,{scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},this.prevPositionMap,this.prevPathMap,this.currentTime());this.scene=e.scene,this.exitNodes=e.exitNodes,this.activeTransition=e.activeTransition}advanceTransition(e){if(!this.activeTransition||!this.config.transition)return!1;const t={scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},o=function(e,t,o,n){if(!o.activeTransition)return!1;const r=Ve(e,o.activeTransition),i=Ge(r,"linear"===t.easing?"linear":"ease-out-cubic");for(const e of o.scene){const t=e._transitionKey;if("point"===e.type){if(void 0!==e._targetOpacity){const o=t?n.get(t):void 0;e.style.opacity=Xe(o?o.opacity??1:0,e._targetOpacity,i)}if(void 0===e._targetX)continue;if(!t)continue;const o=n.get(t);if(!o)continue;e.x=Xe(o.x,e._targetX,i),e.y=Xe(o.y,e._targetY,i),void 0!==e._targetR&&void 0!==o.r&&(e.r=Xe(o.r,e._targetR,i))}else if("glyph"===e.type){if(void 0!==e._targetOpacity){const o=t?n.get(t):void 0;e.style.opacity=Xe(o?o.opacity??1:0,e._targetOpacity,i)}if(void 0===e._targetX)continue;if(!t)continue;const o=n.get(t);if(!o)continue;e.x=Xe(o.x,e._targetX,i),e.y=Xe(o.y,e._targetY,i),void 0!==e._targetR&&void 0!==o.r&&(e.size=Xe(o.r,e._targetR,i))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const o=t?n.get(t):void 0;e.style.opacity=Xe(o?o.opacity??1:0,e._targetOpacity,i)}if(void 0===e._targetX)continue;if(!t)continue;const o=n.get(t);if(!o)continue;e.x=Xe(o.x,e._targetX,i),e.y=Xe(o.y,e._targetY,i),void 0!==o.w&&(e.w=Xe(o.w,e._targetW,i)),void 0!==o.h&&(e.h=Xe(o.h,e._targetH,i))}else if("heatcell"===e.type){if(void 0!==e._targetOpacity){const o=t?n.get(t):void 0;e.style={...e.style||{},opacity:Xe(o?o.opacity??1:0,e._targetOpacity,i)}}if(void 0===e._targetX)continue;if(!t)continue;const o=n.get(t);if(!o)continue;e.x=Xe(o.x,e._targetX,i),e.y=Xe(o.y,e._targetY,i),void 0!==o.w&&(e.w=Xe(o.w,e._targetW,i)),void 0!==o.h&&(e.h=Xe(o.h,e._targetH,i))}else if("candlestick"===e.type){if(void 0!==e._targetOpacity){const o=t?n.get(t):void 0;e.style={...e.style||{},opacity:Xe(o?o.opacity??1:0,e._targetOpacity,i)}}if(void 0===e._targetX)continue;if(!t)continue;const o=n.get(t);if(!o)continue;e.x=Xe(o.x,e._targetX,i),void 0!==o.openY&&(e.openY=Xe(o.openY,e._targetOpenY,i)),void 0!==o.closeY&&(e.closeY=Xe(o.closeY,e._targetCloseY,i)),void 0!==o.highY&&(e.highY=Xe(o.highY,e._targetHighY,i)),void 0!==o.lowY&&(e.lowY=Xe(o.lowY,e._targetLowY,i))}else if("line"===e.type){void 0!==e._targetOpacity&&(e.style={...e.style,opacity:Xe(e._startOpacity??0,e._targetOpacity,i)}),void 0!==e._introClipFraction&&(e._introClipFraction=i);const t=e._prevPath,o=e._targetPath;if(t&&o&&t.length===e.path.length)for(let n=0;e.path.length>n;n++)e.path[n][0]=Xe(t[n][0],o[n][0],i),e.path[n][1]=Xe(t[n][1],o[n][1],i)}else if("area"===e.type){void 0!==e._targetOpacity&&(e.style={...e.style,opacity:Xe(e._startOpacity??0,e._targetOpacity,i)}),void 0!==e._introClipFraction&&(e._introClipFraction=i);const t=e._prevTopPath,o=e._prevBottomPath,n=e._targetTopPath,r=e._targetBottomPath;if(t&&n&&t.length===e.topPath.length)for(let o=0;e.topPath.length>o;o++)e.topPath[o][0]=Xe(t[o][0],n[o][0],i),e.topPath[o][1]=Xe(t[o][1],n[o][1],i);if(o&&r&&o.length===e.bottomPath.length)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t][0]=Xe(o[t][0],r[t][0],i),e.bottomPath[t][1]=Xe(o[t][1],r[t][1],i)}}if(r>=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,n){if(n&&n.version===o&&n.group===t&&n.data===e)return{result:n.result,cache:n};let r;if(t){const o=new Map;for(const n of e){const e=t(n);o.has(e)||o.set(e,[]),o.get(e).push(n)}r=Array.from(o.entries()).map(([e,t])=>({key:e,data:t}))}else r=[{key:"_default",data:e}];return{result:r,cache:{version:o,group:t,data:e,result:r}}}(e,this.getGroup,this._ingestVersion,this._groupDataCache);return this._groupDataCache=o,t}resolveColorMap(e){const{map:t,cache:o}=function(e,t,o,n,r){if(r&&r.version===n)return{map:r.map,cache:r};const i=new Set;if(t)for(const o of e){const e=t(o);e&&i.add(e)}const s=Array.from(i).sort(),a=s.join("\0");if(r&&r.key===a){const e={...r,version:n};return{map:e.map,cache:e}}const l=Array.isArray(o.colorScheme)?o.colorScheme:o.themeCategorical||Fe,c=new Map;for(let e=0;s.length>e;e++)c.set(s[e],l[e%l.length]);return{map:c,cache:{key:a,map:c,version:n}}}(e,this.getColor,this.config,this._ingestVersion,this._colorMapCache);return this._colorMapCache=o,t}resolveLineStyle(e,t){return function(e,t,o,n){const r=e.lineStyle;if("function"==typeof r){const e=r(o||{},t);if(e&&!e.stroke&&t){const o=n(t);if(o)return{...e,stroke:o}}return e}const i=e.themeSemantic?.primary;return r&&"object"==typeof r?{stroke:r.stroke||i||"#007bff",strokeWidth:r.strokeWidth||2,strokeDasharray:r.strokeDasharray,fill:r.fill,fillOpacity:r.fillOpacity,opacity:r.opacity}:{stroke:n(t)||i||"#007bff",strokeWidth:2}}(this.config,e,t,e=>this.resolveGroupColor(e))}resolveAreaStyle(e,t){return function(e,t,o,n){if(e.areaStyle){const r=e.areaStyle(o||{});if(r&&!r.fill&&t){const e=n(t);if(e)return{...r,fill:e,stroke:r.stroke||e}}return r}const r=e.lineStyle;if("function"==typeof r){const e=r(o||{},t);if(e&&!e.fill&&t){const o=n(t);if(o)return{...e,fill:o,stroke:e.stroke||o}}return e}const i=e.themeSemantic?.primary;if(r&&"object"==typeof r)return{fill:r.fill||r.stroke||i||"#4e79a7",fillOpacity:r.fillOpacity??.7,stroke:r.stroke||i||"#4e79a7",strokeWidth:r.strokeWidth||2};const s=n(t)||i||"#4e79a7";return{fill:s,fillOpacity:.7,stroke:s,strokeWidth:2}}(this.config,e,t,e=>this.resolveGroupColor(e))}resolveGroupColor(t){const{color:o,groupColorCounter:n}=function(e){const{group:t,colorMapCache:o,groupColorMap:n,groupColorMapCap:r,config:i}=e;let{groupColorCounter:s}=e;if(o){const e=o.map.get(t);if(e)return{color:e,groupColorCounter:s}}const a=n.get(t);if(a)return{color:a,groupColorCounter:s};const l=(Array.isArray(i.colorScheme)&&i.colorScheme.length>0?i.colorScheme:null)||(Array.isArray(i.themeCategorical)&&i.themeCategorical.length>0?i.themeCategorical:null)||Fe;if(0===l.length)return{color:null,groupColorCounter:s};const c=l[s%l.length];if(s++,n.set(t,c),n.size>r){const e=n.keys().next().value;void 0!==e&&n.delete(e)}return{color:c,groupColorCounter:s}}({group:t,colorMapCache:this._colorMapCache,groupColorMap:this._groupColorMap,groupColorCounter:this._groupColorCounter,groupColorMapCap:e.GROUP_COLOR_MAP_CAP,config:this.config});return this._groupColorCounter=n,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=ue(e),o=this.getPointId,n=e=>t.has(o(e));Gt(this.buffer,this.timestampBuffer,n);const r=this.buffer.remove(n);if(0===r.length)return this.updateResults.recordNoop("remove"),r;for(const e of r)this.xExtent.evict(this.getX(e)),this.evictDatumYExtent(e);return this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("remove",r.length),r}update(e,t){if(!this.getPointId)throw Error("update() requires pointIdAccessor to be configured");const o=ue(e),n=this.getPointId,r=new Set;this.buffer.forEach((e,t)=>{o.has(n(e))&&r.add(t)});const i=this.buffer.update(e=>o.has(n(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)=>{r.has(t)&&(this.xExtent.push(this.getX(e)),this.pushDatumYExtent(e))}),this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,this.lastIngestTime=this.currentTime(),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}applyCustomRestyle(e,t){const o=this._customRestyle;if(o)for(const n of e){const e=this._baseStyles.get(n)??n.style??{},r=o(n,t);n.style=r?{...e,...r}:e}}restyleScene(e){this._customRestyle?(this.applyCustomRestyle(this.scene,e),this.markStylePaintPending(),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 n=!1,r=!1;Object.assign(this.config,e),"pulse"in e&&this.syncPulseTimestampBuffer();const i="chartType"in e&&e.chartType!==t.chartType||"runtimeMode"in e&&e.runtimeMode!==t.runtimeMode;if(i||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e){const e=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode,o=e&&this.config.valueAccessor||this.config.yAccessor,s=e&&t.valueAccessor||t.yAccessor,a=i||!ne(e&&this.config.timeAccessor||this.config.xAccessor,e&&t.timeAccessor||t.xAccessor),l=i||!ne(o,s);(a||l)&&(e?(this.getX=re(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=re(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=re(this.config.xAccessor,"x"),this.getY=re(this.config.yAccessor,"y")),l&&this.resolvedRibbons.some(e=>"bounds"===e.kind)&&(this.resolvedRibbons=Ft(this.config)),n=!0,r=!0)}if("groupAccessor"in e&&!ne(e.groupAccessor,t.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?se(this.config.groupAccessor):void 0,n=!0),"categoryAccessor"in e&&!ne(e.categoryAccessor,t.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?se(this.config.categoryAccessor):void 0,n=!0),"sizeAccessor"in e&&!ne(e.sizeAccessor,t.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?re(this.config.sizeAccessor,"size"):void 0,n=!0),"symbolAccessor"in e&&!ne(e.symbolAccessor,t.symbolAccessor)&&(this.getSymbol=null!=this.config.symbolAccessor?se(this.config.symbolAccessor):void 0,n=!0),"colorAccessor"in e&&!ne(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?se(this.config.colorAccessor):void 0,n=!0),"y0Accessor"in e&&!ne(e.y0Accessor,t.y0Accessor)&&(this.getY0=this.config.y0Accessor?re(this.config.y0Accessor,"y0"):void 0,n=!0,r=!0),("boundsAccessor"in e&&!ne(e.boundsAccessor,t.boundsAccessor)||"band"in e&&e.band!==t.band||"boundsStyle"in e&&e.boundsStyle!==t.boundsStyle)&&(this.resolvedRibbons=Ft(this.config),n=!0,r=!0),"pointIdAccessor"in e&&!ne(e.pointIdAccessor,t.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?se(this.config.pointIdAccessor):void 0,n=!0),"candlestick"===this.config.chartType&&(i||"openAccessor"in e&&!ne(e.openAccessor,t.openAccessor)||"closeAccessor"in e&&!ne(e.closeAccessor,t.closeAccessor)||"highAccessor"in e&&!ne(e.highAccessor,t.highAccessor)||"lowAccessor"in e&&!ne(e.lowAccessor,t.lowAccessor))){const e=null!=this.config.openAccessor,t=null!=this.config.closeAccessor;this.getOpen=e?re(this.config.openAccessor,"open"):void 0,this.getHigh=re(this.config.highAccessor,"high"),this.getLow=re(this.config.lowAccessor,"low"),this.getClose=t?re(this.config.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!e&&!t,n=!0,r=!0}if("accessorRevision"in e&&e.accessorRevision!==t.accessorRevision&&(n=!0,r=!0),!n){const o=Object.keys(e).filter(e=>!e.endsWith("Accessor")&&"timeAccessor"!==e&&"valueAccessor"!==e);for(const r of o)if(e[r]!==t[r]){n=!0;break}}n&&(r&&this.rebuildExtents(),this.needsFullRebuild=!0),this.updateResults.recordConfig(o)}updateConfigWithResult(e){return this.updateConfig(e),this.updateResults.last}};ko.GROUP_COLOR_MAP_CAP=1e3;var wo=ko;eo(wo);var So=require("react"),Ao={sceneGeometry:0,layout:0,domain:0};function Co(e){const{domain:t,layout:o,sceneGeometry:n}=e.revisions;return{domain:t,layout:o,sceneGeometry:n}}function Mo(e,t){return{sceneGeometry:Math.max(e.sceneGeometry,t.sceneGeometry),layout:Math.max(e.layout,t.layout),domain:Math.max(e.domain,t.domain)}}var _o="production"!==process.env.NODE_ENV,jo={revisions:Ao,signature:"",sawSignals:!1,wasUnconsumed:!1,warnUnconsumed:!1},Ro=class{constructor(e="scene host"){this.hostName=e,this.lastConsumed=Ao,this.lastObserved=Ao,this.lastDuplicateWarning="",this.lastUnconsumedWarning=""}observeUpdateResult(e){_o&&(this.lastObserved=Mo(this.lastObserved,Co(e)))}beforeCompute(e,t){if(!_o)return jo;const o=Mo(Co(e),this.lastObserved),n=function(e){return`${e.sceneGeometry}|${e.layout}|${e.domain}`}(o),r=!((i=o).sceneGeometry===(s=this.lastConsumed).sceneGeometry&&i.layout===s.layout&&i.domain===s.domain);var i,s;return{revisions:o,signature:n,sawSignals:e.changed.has("scene-geometry")||e.changed.has("layout")||e.changed.has("domain"),wasUnconsumed:r,warnUnconsumed:!t&&r&&this.lastUnconsumedWarning!==n}}afterCompute(e,t,o){if(_o){if(t&&e.wasUnconsumed&&(this.lastConsumed=e.revisions),e.warnUnconsumed&&!t)return console.warn(`[semiotic] ${this.hostName} 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] ${this.hostName} performed scene rebuild with unchanged scene revisions: ${e.signature}.`),this.lastDuplicateWarning=e.signature):t&&!e.sawSignals&&(this.lastDuplicateWarning="")}}};function Po(e){return(0,So.useRef)(new Ro(e))}var Lo=(0,So.memo)(function({store:e,diagnostics:t}){return(0,So.useEffect)(()=>{const o=()=>t.observeUpdateResult(e.getUpdateSnapshot());return o(),e.subscribeUpdateResult(o)},[t,e]),null}),To=c(require("react"));function Io(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:To.createElement(To.Fragment,null,...t)}var $o=c(require("react")),No=require("react/jsx-runtime"),Do={isActive:!1,predicate:()=>!0},Eo=$o.createContext(null);function Bo({value:e,children:t}){return(0,No.jsx)(Eo.Provider,{value:e,children:t})}function Fo(){return $o.useContext(Eo)??Do}function Ho(e,t){return null!=e?(0,No.jsx)(Bo,{value:t,children:e}):e}var Oo=require("react");function zo(e,t,o,n){(0,Oo.useEffect)(()=>{e.current?.updateConfig(t),o.current=!0,n()},[t,n,e,o])}function Wo(e,t,o,n){const r=(0,Oo.useRef)(null);(0,Oo.useEffect)(()=>{const i=e.current;if(!i)return;const s=t??null;r.current!==s&&(r.current=s,i.setLayoutSelection(s),i.hasCustomRestyle?i.restyleScene(s):o.current=!0,n())},[t,n,e,o])}function qo(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 Yo(e,t=30){return Math.max((e??4)+5,12,t)}function Go(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function Vo(e,t){const o=Go(e);if(!o)return!1;const n=Go(t);return!n||o.getFullYear()!==n.getFullYear()||o.getMonth()!==n.getMonth()}function Xo(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}var Uo=[40,40],Ko=[.5,.5];function Zo(e,t){const[o,n]=e.viewBox??Uo,[r,i]=e.anchor??Ko,s=n>0?n:1,a=Math.max(0,t)/s,l=(o>0?o:s)*a,c=s*a;return{width:l,height:c,scale:a,offsetX:-r*l,offsetY:-i*c}}function Qo(e,t,o,n){if("none"!==e)return"color"===e||null==e?t??n:"accent"===e?o:e}var Jo=null;function en(e){if("undefined"==typeof Path2D)return null;Jo||(Jo=new Map);const t=Jo.get(e);if(t)return t;const o=new Path2D(e);return Jo.size>1024&&Jo.clear(),Jo.set(e,o),o}function tn(e,t,o=0,n="horizontal"){const[r,i]=e.viewBox??Uo,s=Math.min(1,Math.max(0,o)),a=Math.min(1,Math.max(0,t));return a>s?s>0||1>a?"vertical"===n?{x:0,y:i*(1-a),width:r,height:i*(a-s)}:{x:r*s,y:0,width:r*(a-s),height:i}:null:{x:0,y:0,width:0,height:0}}function on(e,t){const o=Zo(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 nn(e,t,o,n,r,i=e=>e){for(const s of t.parts){const t=en(s.d);if(!t)continue;const a=s.opacity??1,l=e.globalAlpha;1!==a&&(e.globalAlpha=l*a);const c=r?"none"===s.fill?void 0:r:Qo(s.fill,o,n);c&&(e.fillStyle=i(c),e.fill(t));const u=r?s.stroke&&"none"!==s.stroke?r:void 0:Qo(s.stroke??"none",o,n);u&&(e.strokeStyle=i(u),e.lineWidth=s.strokeWidth??1,e.lineCap=s.strokeLinecap??"butt",e.lineJoin=s.strokeLinejoin??"miter",e.stroke(t)),1!==a&&(e.globalAlpha=l)}}function rn(e,t,o,n,r,i=e=>e.x,s=e=>e.y,a=e=>e.r){const l=Math.max(n,r+5,12),c=t-l,u=t+l,d=o-l,h=o+l;let f=null,p=1/0;return e.visit((e,r,l,m,g)=>{if(r>u||c>m||l>h||d>g)return!0;if(!e.length){let r=e;do{const e=r.data,l=i(e)-t,c=s(e)-o,u=Math.sqrt(l*l+c*c);Yo(a(e),n)>=u&&p>u&&(f=e,p=u),r=r.next}while(r)}return!1}),f?{node:f,distance:p}:null}var sn=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,an=new WeakMap,ln=0,cn=!1,un=null,dn=null;function hn(e,t){if(!t)return t;const o=sn.exec(t);if(!o)return t;const n=e.canvas;if(!n)return o[2]?.trim()||t;!function(){if(cn)return;if("undefined"==typeof window||"undefined"==typeof document)return;cn=!0;const e=()=>{ln++};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{un=window.matchMedia("(prefers-color-scheme: dark)"),dn=e,"function"==typeof un.addEventListener?un.addEventListener("change",dn):"function"==typeof un.addListener&&un.addListener(dn)}catch{}}();let r=an.get(n);r&&r.version===ln||(r={version:ln,map:new Map},an.set(n,r));const i=r.map.get(t);if(void 0!==i)return i;const s=getComputedStyle(n).getPropertyValue(o[1]).trim()||o[2]?.trim()||t;return r.map.set(t,s),s}function fn(e,t){const o=e.fillStyle,n="#010203";try{e.fillStyle=n,e.fillStyle=t}catch{return e.fillStyle=o,[78,121,167]}const r=e.fillStyle;if(e.fillStyle=o,"string"!=typeof r)return[78,121,167];if(r.toLowerCase()===n&&t.trim().toLowerCase()!==n)return[78,121,167];if(r.startsWith("#"))return[parseInt(r.slice(1,3),16),parseInt(r.slice(3,5),16),parseInt(r.slice(5,7),16)];const i=r.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return i?[+i[1],+i[2],+i[3]]:[78,121,167]}var pn=null;function mn(e={},t){const{background:o="transparent",stroke:n="#000",lineWidth:r=1.5,spacing:i=6,angle:s=45}=e,a=Math.max(8,Math.ceil(2*i));let l;try{l=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(pn||(pn=document.createElement("canvas")),pn.width=e,pn.height=e,pn)}(a)}catch{return null}const c=l.getContext("2d");if(!c)return null;o&&"transparent"!==o?(c.fillStyle=o,c.fillRect(0,0,a,a)):c.clearRect(0,0,a,a),c.strokeStyle=n,c.lineWidth=r,c.lineCap="square";const u=s*Math.PI/180;if(45===s||-45===s){const e=s>0?1:-1;for(let t=-a;2*a>=t;t+=i)c.beginPath(),c.moveTo(t,0),c.lineTo(t+e*a,a),c.stroke()}else{c.save(),c.translate(a/2,a/2),c.rotate(u);const e=2*a;for(let t=-e;e>=t;t+=i)c.beginPath(),c.moveTo(-e,t),c.lineTo(e,t),c.stroke();c.restore()}return(t||c).createPattern(l,"repeat")}var gn=require("react/jsx-runtime");function yn(e){return"object"==typeof e&&null!==e&&"hatch"===e.type}function bn(e){return["hatch",e.background??"transparent",e.stroke??"#000",e.lineWidth??1.5,e.spacing??6,e.angle??45,e.lineOpacity??1].join("|")}function vn(e,t){let o=2166136261;const n=bn(t);for(let e=0;n.length>e;e++)o^=n.charCodeAt(e),o=Math.imul(o,16777619);return`${e}-hatch-${(o>>>0).toString(36)}`}var xn=new Map;function kn(e,t){const{background:o="transparent",stroke:n="#000",lineWidth:r=1.5,spacing:i=6,angle:s=45,lineOpacity:a=1}=e,l=Math.max(8,Math.ceil(2*i));return(0,gn.jsxs)("pattern",{id:t,width:l,height:l,patternUnits:"userSpaceOnUse",patternTransform:0!==s?`rotate(${s})`:void 0,children:[o&&"transparent"!==o&&(0,gn.jsx)("rect",{width:l,height:l,fill:o}),(0,gn.jsx)("line",{x1:0,y1:0,x2:0,y2:l,stroke:n,strokeWidth:r,strokeOpacity:a}),(0,gn.jsx)("line",{x1:i,y1:0,x2:i,y2:l,stroke:n,strokeWidth:r,strokeOpacity:a})]},t)}function wn(e,t,o="#4e79a7"){if(yn(e)){const o=vn(t,e);return{fill:`url(#${o})`,def:kn(e,o)}}return e&&"string"==typeof e?{fill:e}:{fill:o}}var Sn=require("d3-shape");function An(e){switch(e){case"monotoneX":return Sn.curveMonotoneX;case"monotoneY":return Sn.curveMonotoneY;case"cardinal":return Sn.curveCardinal;case"catmullRom":return Sn.curveCatmullRom;case"step":return Sn.curveStep;case"stepBefore":return Sn.curveStepBefore;case"stepAfter":return Sn.curveStepAfter;case"basis":return Sn.curveBasis;case"natural":return Sn.curveNatural;default:return null}}function Cn(e,t,o){if(null==t)return o;if(yn(t)){const n=function(e,t){const o="undefined"!=typeof window&&window.devicePixelRatio||1,n=`${bn(e)}@${o}`,r=xn.get(n);if(void 0!==r)return r;const i=mn({background:e.background,stroke:e.stroke,lineWidth:e.lineWidth,spacing:e.spacing,angle:e.angle},t);return xn.set(n,i),i}(t,e);return n||t.background&&hn(e,t.background)||o}return"string"!=typeof t?t:hn(e,t)||o}function Mn(e,t){if(null==t)return;const o=Cn(e,t,"");return""===o?void 0:o}function _n(e,t,o,n,r,i,s){if("colorStops"in t){const o=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>o.length)return null;const a=e.createLinearGradient(n,r,i,s);for(const e of o)a.addColorStop(e.offset,e.color);return a}const{topOpacity:a,bottomOpacity:l}=t;if(!Number.isFinite(a)||!Number.isFinite(l))return null;const c=Math.max(0,Math.min(1,a)),u=Math.max(0,Math.min(1,l)),d=e.createLinearGradient(n,r,i,s),[h,f,p]=fn(e,o);return d.addColorStop(0,`rgba(${h},${f},${p},${c})`),d.addColorStop(1,`rgba(${h},${f},${p},${u})`),d}function jn(e,t,o,n,r,i){const s=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>s.length)return null;const a=e.createLinearGradient(o,n,r,i);for(const e of s)a.addColorStop(e.offset,e.color);return a}var Rn=require("d3-shape"),Pn=new WeakMap;function Ln(e,t){const o=An(t);if(!o)return e;const n=Pn.get(e);if(n)return n;const r=function(e,t,o=8){if(!t||2>e.length)return e.map(([e,t])=>[e,t]);const n=[];let r=null;const i={moveTo(e,t){r=[e,t],n.push([e,t])},lineTo(e,t){r=[e,t],n.push([e,t])},bezierCurveTo(e,t,i,s,a,l){if(!r)return r=[a,l],void n.push([a,l]);const[c,u]=r;for(let r=1;o>=r;r++){const d=r/o,h=1-d;n.push([h*h*h*c+3*h*h*d*e+3*h*d*d*i+d*d*d*a,h*h*h*u+3*h*h*d*t+3*h*d*d*s+d*d*d*l])}r=[a,l]},closePath(){},arc(){},rect(){},arcTo(){},quadraticCurveTo(e,t,o,i){r=[o,i],n.push([o,i])}};return(0,Rn.line)().x(e=>e[0]).y(e=>e[1]).curve(t).context(i)(e),n}(e,o);return Pn.set(e,r),r}function Tn(e,t,o,n=30,r,i=0){let s=null;if(r){const e=rn(r,t,o,n,i);e&&(s={node:e.node,datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const i of e){let e=null;switch(i.type){case"point":if(r)break;e=$n(i,t,o,n);break;case"symbol":e=Nn(i,t,o,n);break;case"glyph":e=Dn(i,t,o,n);break;case"line":e=En(i,t,o,n);break;case"rect":if(null==i.datum)break;e=Fn(i,t,o);break;case"heatcell":e=Hn(i,t,o);break;case"area":if(!1===i.interactive)break;e=zn(i,t,o);break;case"candlestick":e=On(i,t,o)}e&&n>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}function In(e,t,o){if(0===e.length)return null;if(e[0][0]>t||t>e[e.length-1][0])return null;const n=Wn(e,t);if(0>n)return null;if(Math.abs(e[n][0]-t)>o)return null;let r=n,i=n;n>0&&e[n][0]>=t?(r=n-1,i=n):e.length-1>n&&(r=n,i=n+1);const[s,a]=e[r],[l,c]=e[i];return l===s?a:a+Math.max(0,Math.min(1,(t-s)/(l-s)))*(c-a)}function $n(e,t,o,n=30){const r=t-e.x,i=o-e.y,s=Math.sqrt(r*r+i*i);return s>Yo(e.r,n)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:s}}function Nn(e,t,o,n=30){const r=t-e.x,i=o-e.y,s=Math.sqrt(r*r+i*i);return s>Yo(Lt(e.size),n)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:s}}function Dn(e,t,o,n=30){if(null==e.datum)return null;const r=on(e.glyph,e.size),i=e.x+r.centerDx,s=e.y+r.centerDy,a=t-i,l=o-s,c=Math.sqrt(a*a+l*l);return c>Yo(r.radius,n)?null:{node:e,datum:e.datum,x:i,y:s,distance:c}}function En(e,t,o,n=30){if(0===e.path.length)return null;const r=Wn(e.path,t);if(0>r)return null;const[i,s]=e.path[r];let a;if(e.path.length>1){let n=1/0;const i=Math.max(0,r-1),s=Math.min(e.path.length-2,r);for(let r=i;s>=r;r++){const[i,s]=e.path[r],[a,l]=e.path[r+1],c=Bn(t,o,i,s,a,l);n>c&&(n=c)}a=n}else{const e=t-i,n=o-s;a=Math.sqrt(e*e+n*n)}const l=e.style;return a>Math.max(5,(l.strokeWidth??l.lineWidth??1)/2+2,n)?null:{node:e,datum:Array.isArray(e.datum)&&e.datum[r]?e.datum[r]:e.datum,x:i,y:s,distance:a}}function Bn(e,t,o,n,r,i){const s=r-o,a=i-n,l=s*s+a*a;if(0===l)return Math.sqrt((e-o)**2+(t-n)**2);let c=((e-o)*s+(t-n)*a)/l;return c=Math.max(0,Math.min(1,c)),Math.sqrt((e-(o+c*s))**2+(t-(n+c*a))**2)}function Fn(e,t,o){const n=qo(t,o,e);return n.hit?{node:e,datum:e.datum,x:n.cx,y:n.cy,distance:0}:null}function Hn(e,t,o){const n=qo(t,o,e);return n.hit?{node:e,datum:e.datum,x:n.cx,y:n.cy,distance:0}:null}function On(e,t,o){const n=e.bodyWidth/2,r=Math.min(e.openY,e.closeY);if(!(e.x-n-3>t||t>e.x+n+3||e.highY-3>o||o>e.lowY+3)){const n=r+Math.max(Math.max(e.openY,e.closeY)-r,1)/2,i=t-e.x,s=o-n;return{node:e,datum:e.datum,x:e.x,y:n,distance:Math.sqrt(i*i+s*s)}}return null}function zn(e,t,o){if(0===e.topPath.length)return null;const n=Wn(e.topPath,t);if(0>n)return null;const[r,i]=e.topPath[n],s=t-r,a=o-i,l=Math.sqrt(s*s+a*a);return{node:e,datum:Array.isArray(e.datum)&&e.datum[n]?e.datum[n]:e.datum,x:r,y:i,distance:l}}function Wn(e,t){if(0===e.length)return-1;let o=0,n=e.length-1;for(;n>o;){const r=o+n>>1;t>e[r][0]?o=r+1:n=r}return o>0&&Math.abs(e[o][0]-t)>=Math.abs(e[o-1][0]-t)?o-1:o}var qn=require("react"),Yn={fresh:1,aging:.7,stale:.45,expired:.25},Gn={alpha:1,band:"fresh",isStale:!1};function Vn(e,t){if(!e||0>=t)return Gn;const o=null!=e.threshold&&e.threshold>0?e.threshold:5e3,n=e.graded;if(n){const e="object"==typeof n?n:{},r=Ze(t,o,e.thresholds);return{alpha:{...Yn,...e.opacities??{}}[r],band:r,isStale:"fresh"!==r}}return t>o?{alpha:e.dimOpacity??.5,band:"stale",isStale:!0}:Gn}function Xn(e,t,o,n,r,i){const s=(0,qn.useRef)("fresh");(0,qn.useEffect)(()=>{if(!e)return;const a=setInterval(()=>{const a=t.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=Vn(e,l-a.lastIngestTime);c.band===s.current&&c.isStale===r||(s.current=c.band,c.isStale!==r&&i(c.isStale),o.current=!0,n())},1e3);return()=>clearInterval(a)},[e,r,n,t,i,o])}var Un=require("react/jsx-runtime");function Kn({isStale:e,position:t}){return(0,Un.jsx)("div",{className:"stream-staleness-badge",style:{position:"absolute",..."top-left"===t?{top:4,left:4}:"bottom-left"===t?{bottom:4,left:4}:"bottom-right"===t?{bottom:4,right:4}:{top:4,right:4},padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",zIndex:3,background:e?"#dc3545":"#28a745",color:"white"},children:e?"STALE":"LIVE"})}var Zn=require("react"),Qn=c(require("react")),Jn=require("react/jsx-runtime"),er=16,tr=6,or=10,nr=22,rr={fill:(e,t)=>(0,Jn.jsx)("rect",{style:e,width:t,height:t}),line:(e,t)=>(0,Jn.jsx)("line",{style:e,x1:0,y1:0,x2:t,y2:t})};function ir(e,t,o,n,r){let i;return i="function"==typeof o?o(e):(0,rr[o])(n(e,t),r),i}function sr({swatchSize:e}){return(0,Jn.jsx)("path",{d:`M${.25*e},${.55*e} L${.45*e},${.75*e} L${.8*e},${.3*e}`,fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function ar(e,t,o){return o&&o.size>0?o.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}var lr=(e,t,o,n,r,i,s,a,l,c,u)=>{const{type:d="fill",styleFn:h,items:f}=e,p=[];let m=0;const g=!(!t&&!o),y="isolate"===c||void 0===c&&null!=r,{swatchSize:b,labelGap:v,rowHeight:x}=u;return f.forEach((e,c)=>{const u=ir(e,c,d,h,b),k=ar(e,n,r),w=r&&r.size>0&&r.has(e.label);p.push((0,Jn.jsxs)("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?a===i&&c===s?0:-1:void 0,role:g?"option":void 0,"aria-selected":g&&y?w||!1:void 0,"aria-current":g&&!y&&null!=n&&e.label===n||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)+f.length)%f.length;l(a,e);const t=o.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:g?t=>{l(a,c),o&&o(e);const n=t.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.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:k,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[g&&(0,Jn.jsx)("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:b+v+2+7*e.label.length,height:b+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),u,w&&(0,Jn.jsx)(sr,{swatchSize:b}),(0,Jn.jsx)("text",{y:b/2,x:b+v,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+c)),m+=x}),p},cr=({legendGroups:e,width:t,customClickBehavior:o,customHoverBehavior:n,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:s,focusedItemIndex:a,onFocusedIndexChange:l,legendInteraction:c,metrics:u})=>{let d=24;const h=[];return e.forEach((e,f)=>{d+=5,h.push((0,Jn.jsx)("line",{stroke:"gray",x1:0,y1:d,x2:t,y2:d},"legend-top-line legend-symbol-"+f)),d+=8,e.label&&(d+=16,h.push((0,Jn.jsx)("text",{y:d,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label},"legend-text-"+f)),d+=8),h.push((0,Jn.jsx)("g",{className:"legend-item",transform:`translate(0,${d})`,children:lr(e,o,n,r,i,s,a,f,l,c,u)},"legend-group-"+f)),d+=e.items.length*u.rowHeight+8}),h},ur=({legendGroups:e,height:t,width:o,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u,metrics:d})=>{let h=0;const f=[];e.forEach((e,t)=>{let p=0;e.label&&(p+=16);const m=((e,t,o,n,r,i,s,a,l,c,u,d)=>{const{type:h="fill",styleFn:f,items:p}=e,m=[],{swatchSize:g,labelGap:y,itemGap:b,rowHeight:v,align:x}=u,k=!(!t&&!o),w="isolate"===c||void 0===c&&null!=r,S=p.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}),p.length>0&&A.push({start:C,end:p.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=p[d],x=ir(e,d,h,f,g),A=ar(e,n,r),C=r&&r.size>0&&r.has(e.label);m.push((0,Jn.jsxs)("g",{transform:`translate(${u},${c*v})`,onClick:t?()=>t(e):void 0,onMouseEnter:o?()=>o(e):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:k?a===i&&d===s?0:-1:void 0,role:k?"option":void 0,"aria-selected":k&&w?C||!1:void 0,"aria-current":k&&!w&&null!=n&&e.label===n||void 0,"aria-label":e.label,onKeyDown:k?o=>{if("Enter"!==o.key&&" "!==o.key||(o.preventDefault(),t&&t(e)),"ArrowRight"===o.key||"ArrowLeft"===o.key){o.preventDefault();const e=(d+("ArrowRight"===o.key?1:-1)+p.length)%p.length;l(a,e);const t=o.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:k?t=>{l(a,d),o&&o(e);const n=t.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:k?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:k?"pointer":"default",opacity:A,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[k&&(0,Jn.jsx)("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&&(0,Jn.jsx)(sr,{swatchSize:g}),(0,Jn.jsx)("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 _=Math.max(0,...A.map(e=>e.width)),j=A.length;return{items:m,offset:_,totalRows:j,totalHeight:j*v}})(e,n,r,i,s,a,l,t,c,u,d,d.maxWidth??o);p+=m.offset+5,f.push({label:e.label,...m,offset:p,totalRows:m.totalRows,totalHeight:m.totalHeight}),h+=p+12});const p=d.maxWidth??o;let m=h>p?0:"center"===d.align?Math.max(0,(p-h)/2):"end"===d.align?Math.max(0,p-h):0;const g=[];return f.forEach((o,n)=>{const r=e[n];r.label&&(g.push((0,Jn.jsx)("text",{transform:`translate(${m},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:r.label},"legend-text-"+n)),m+=16),g.push((0,Jn.jsx)("g",{className:"legend-item",transform:`translate(${m},0)`,children:o.items},"legend-group-"+n)),m+=o.offset+5,e[n+1]&&g.push((0,Jn.jsx)("line",{stroke:"gray",x1:m,y1:-8,x2:m,y2:(o.totalHeight||t)+0+8},"legend-top-line legend-symbol-"+n)),m+=12}),(0,Jn.jsx)("g",{children:g})};function dr({config:e,orientation:t="vertical",width:o=100}){const{colorFn:n,domain:r,label:i,format:s}=e,a=s||(e=>Math.round(100*e)/100+""),l="grad-legend-"+Qn.useId();if("horizontal"===t){const e=12,t=Math.min(o,200),s=Math.max(0,(o-t)/2),c=[];for(let e=0;64>=e;e++){const t=e/64;c.push((0,Jn.jsx)("stop",{offset:100*t+"%",stopColor:n(r[0]+t*(r[1]-r[0]))},e))}return(0,Jn.jsxs)("g",{"aria-label":i||"Gradient legend",children:[(0,Jn.jsx)("defs",{children:(0,Jn.jsx)("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),i&&(0,Jn.jsx)("text",{x:s+t/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),(0,Jn.jsx)("rect",{x:s,y:0,width:t,height:e,fill:`url(#${l})`,rx:2}),(0,Jn.jsx)("text",{x:s,y:e+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[0])}),(0,Jn.jsx)("text",{x:s+t,y:e+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[1])})]})}const c=[];for(let e=0;64>=e;e++){const t=e/64;c.push((0,Jn.jsx)("stop",{offset:100*t+"%",stopColor:n(r[1]-t*(r[1]-r[0]))},e))}return(0,Jn.jsxs)("g",{"aria-label":i||"Gradient legend",children:[i&&(0,Jn.jsx)("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),(0,Jn.jsx)("defs",{children:(0,Jn.jsx)("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:c})}),(0,Jn.jsx)("rect",{x:0,y:0,width:14,height:100,fill:`url(#${l})`,rx:2}),(0,Jn.jsx)("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[1])}),(0,Jn.jsx)("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[0])})]})}function hr(e){const{legendGroups:t,customClickBehavior:o,customHoverBehavior:n,highlightedCategory:r,isolatedCategories:i,legendInteraction:s,title:a="Legend",width:l=100,height:c=20,orientation:u="vertical",legendLayout:d}=e,h=function(e){const t=Math.max(1,e?.swatchSize??er),o=Math.max(t,e?.rowHeight??nr);return{swatchSize:t,labelGap:Math.max(0,e?.labelGap??tr),itemGap:Math.max(0,e?.itemGap??or),rowHeight:o,align:"left"===e?.align?"start":"right"===e?.align?"end":e?.align??"start",maxWidth:e?.maxWidth}}(d),[f,p]=Qn.useState(0),[m,g]=Qn.useState(0),y=Qn.useCallback((e,t)=>{p(e),g(t)},[]),b="vertical"===u?cr({legendGroups:t||[],width:l,customClickBehavior:o,customHoverBehavior:n,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:m,onFocusedIndexChange:y,legendInteraction:s,metrics:h}):ur({legendGroups:t||[],title:a,height:c,width:l,customClickBehavior:o,customHoverBehavior:n,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:m,onFocusedIndexChange:y,legendInteraction:s,metrics:h}),v=!(!o&&!n);return(0,Jn.jsxs)("g",{role:v?"listbox":void 0,"aria-multiselectable":!(!v||"isolate"!==s&&(void 0!==s||null==i))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==a&&""!==a&&"vertical"===u&&(0,Jn.jsx)("text",{className:"legend-title",y:16,x:l/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:a}),b]})}function fr(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}var pr=require("react/jsx-runtime");function mr(e){const{legend:t,totalWidth:o,totalHeight:n,margin:r,legendPosition:i="right",legendLayout:s,title:a,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=e;if(!t)return null;const f="top"===i||"bottom"===i,p=!!a,m=Math.max(0,o-r.left-r.right),g=Math.max(1,f?s?.maxWidth??m:100);let y,b;return"left"===i?(y=Math.max(4,r.left-g-10),b=r.top):"top"===i?(y=r.left,b=p?32:8):"bottom"===i?(y=r.left,b=n-r.bottom+38):(y=o-r.right+10,b=r.top),(0,pr.jsx)("g",{transform:`translate(${y}, ${b})`,children:(v=t,"object"==typeof v&&null!==v&&"gradient"in v?(0,pr.jsx)(dr,{config:t.gradient,orientation:f?"horizontal":"vertical",width:g}):fr(t)?(0,pr.jsx)(hr,{legendGroups:t.legendGroups,title:"",width:g,orientation:f?"horizontal":"vertical",legendLayout:s,customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):t)});var v}var gr=require("react"),yr=require("d3-array");h();var br=require("react/jsx-runtime");function vr(e){return"string"==typeof e?{type:e}:e}function xr({orient:e,config:t,values:o,scale:n,size:r,length:i}){const s=function(e){return{type:e.type,bins:e.bins??20,fill:e.fill??"#4e79a7",fillOpacity:e.fillOpacity??.5,stroke:e.stroke??"none",strokeWidth:e.strokeWidth??1}}(t),a="top"===e||"bottom"===e,l=(0,gr.useMemo)(()=>{if(0===o.length)return null;const t=n.domain(),l=r-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 n=t[Math.floor(.25*o)],r=t[Math.floor(.5*o)],i=t[Math.floor(.75*o)],s=i-n;return{q1:n,median:r,q3:i,whiskerLow:Math.max(t[0],n-1.5*s),whiskerHigh:Math.min(t[o-1],i+1.5*s)}}(o);if(!t)return null;const{q1:r,median:i,q3:c,whiskerLow:u,whiskerHigh:d}=t,h=Math.min(.5*l,20),f=(l-h)/2+4;if(a){const t=n(r),o=n(c),a=n(i),l=n(u),p=n(d),m="top"===e?-1:1,g=0;return(0,br.jsxs)("g",{"data-testid":"marginal-boxplot-"+e,children:[(0,br.jsx)("line",{x1:l,y1:g+m*(f+h/2),x2:p,y2:g+m*(f+h/2),stroke:s.fill,strokeWidth:s.strokeWidth}),(0,br.jsx)("line",{x1:l,y1:g+m*f,x2:l,y2:g+m*(f+h),stroke:s.fill,strokeWidth:s.strokeWidth}),(0,br.jsx)("line",{x1:p,y1:g+m*f,x2:p,y2:g+m*(f+h),stroke:s.fill,strokeWidth:s.strokeWidth}),(0,br.jsx)("rect",{x:Math.min(t,o),y:"top"===e?g-f-h:g+f,width:Math.abs(o-t),height:h,fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth}),(0,br.jsx)("line",{x1:a,y1:"top"===e?g-f-h:g+f,x2:a,y2:"top"===e?g-f:g+f+h,stroke:s.fill,strokeWidth:2})]})}{const t=n(r),o=n(c),a=n(i),l=n(u),p=n(d),m="left"===e?-1:1,g=0;return(0,br.jsxs)("g",{"data-testid":"marginal-boxplot-"+e,children:[(0,br.jsx)("line",{x1:g+m*(f+h/2),y1:l,x2:g+m*(f+h/2),y2:p,stroke:s.fill,strokeWidth:s.strokeWidth}),(0,br.jsx)("line",{x1:g+m*f,y1:l,x2:g+m*(f+h),y2:l,stroke:s.fill,strokeWidth:s.strokeWidth}),(0,br.jsx)("line",{x1:g+m*f,y1:p,x2:g+m*(f+h),y2:p,stroke:s.fill,strokeWidth:s.strokeWidth}),(0,br.jsx)("rect",{x:"left"===e?g-f-h:g+f,y:Math.min(t,o),width:h,height:Math.abs(o-t),fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth}),(0,br.jsx)("line",{x1:"left"===e?g-f-h:g+f,y1:a,x2:"left"===e?g-f:g+f+h,y2:a,stroke:s.fill,strokeWidth:2})]})}}const c=(0,yr.bin)().domain(t).thresholds(s.bins)(o);if(0===c.length)return null;const u=d(c.map(e=>e.length));if(0===u)return null;if("histogram"===s.type)return(0,br.jsx)("g",{"data-testid":"marginal-histogram-"+e,children:c.map((t,o)=>{if(null==t.x0||null==t.x1)return null;const r=t.length/u*l;if(a){const i=n(t.x0),a=n(t.x1)-n(t.x0);return(0,br.jsx)("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(0,br.jsx)("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=l/2+4,o=[];for(const r of c){if(null==r.x0||null==r.x1)continue;const i=r.length/u*(l/2),s=n((r.x0+r.x1)/2);o.push(a?`${s},${"top"===e?-(t-i):t-i}`:`${"left"===e?-(t-i):t-i},${s}`)}for(let r=c.length-1;r>=0;r--){const i=c[r];if(null==i.x0||null==i.x1)continue;const s=i.length/u*(l/2),d=n((i.x0+i.x1)/2);o.push(a?`${d},${"top"===e?-(t+s):t+s}`:`${"left"===e?-(t+s):t+s},${d}`)}return(0,br.jsx)("g",{"data-testid":"marginal-violin-"+e,children:(0,br.jsx)("polygon",{points:o.join(" "),fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth})})}if("ridgeline"===s.type){const t=[];if(a){const o=0,r=null!=c[0].x0?n(c[0].x0):0;t.push(`M${r},${o}`);for(const o of c){if(null==o.x0||null==o.x1)continue;const r=o.length/u*l,i=n((o.x0+o.x1)/2);t.push(`L${i},${"top"===e?-r-4:r+4}`)}const s=null!=c[c.length-1].x1?n(c[c.length-1].x1):i;t.push(`L${s},${o}`),t.push("Z")}else{const o=0,r=null!=c[0].x0?n(c[0].x0):0;t.push(`M${o},${r}`);for(const o of c){if(null==o.x0||null==o.x1)continue;const r=o.length/u*l,i=n((o.x0+o.x1)/2);t.push(`L${"left"===e?-r-4:r+4},${i}`)}const s=null!=c[c.length-1].x1?n(c[c.length-1].x1):i;t.push(`L${o},${s}`),t.push("Z")}return(0,br.jsx)("g",{"data-testid":"marginal-ridgeline-"+e,children:(0,br.jsx)("path",{d:t.join(" "),fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth})})}return null},[o,n,s,r,i,e,a,4]);return l?(0,br.jsx)("g",{className:"marginal-"+e,"data-testid":"marginal-"+e,children:l}):null}var kr=c(require("react")),wr=require("react/jsx-runtime");function Sr(e,t=120,o=8){if(!e)return[];const n=Math.max(1,Math.floor(t/o)),r=e.split(/\s+/),i=[];let s="";for(const e of r)s&&s.length+1+e.length>n?(i.push(s),s=e):s=s?`${s} ${e}`:e;return s&&i.push(s),i}function Ar(e,t,o,n){return"curly"===e?n?`M0,0 C${.6*o},0 ${.4*o},${t/2} ${o},${t/2} C${.4*o},${t/2} ${.6*o},${t} 0,${t}`:`M0,0 C0,${.6*o} ${t/2},${.4*o} ${t/2},${o} C${t/2},${.4*o} ${t},${.6*o} ${t},0`:n?`M0,0 L${o},0 L${o},${t} L0,${t}`:`M0,0 L0,${o} L${t},${o} L${t},0`}function Cr(e,t,o,n){if(!e)return(0,wr.jsx)("g",{className:"annotation-note"});const{label:r,title:i,orientation:s,align:a,wrap:l=120,noWrap:c}=e;if(!r&&!i)return(0,wr.jsx)("g",{className:"annotation-note"});let u=s;u||(u=Math.abs(t)>Math.abs(o)?"leftRight":"topBottom");let d=a;d&&"dynamic"!==d||(d="topBottom"===u?0>t?"right":"left":0>o?"bottom":"top");let h="start";"topBottom"===u?"right"===d?h="end":"middle"===d&&(h="middle"):h=0>t?"end":"start";const f=16,p=i?c?[i]:Sr(i,l):[],m=r?c?[r]:Sr(r,l):[],g="leftRight"===u?"end"===h?-4:4:0;let y=0;const b=[],v=n||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";e.useHTML||e.html?b.push((0,wr.jsx)("foreignObject",{className:"annotation-note-html",x:"end"===h?g-l:"middle"===h?g-l/2:g,y:-16,width:l,height:Math.max(f,(p.length+m.length)*f+(i&&r?2:0))+f,style:{overflow:"visible"},children:(0,wr.jsxs)("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{color:v,fontSize:"12px",lineHeight:"16px",overflow:"visible",textAlign:"end"===h?"right":"middle"===h?"center":"left",whiteSpace:c?"nowrap":"normal",wordBreak:"break-word"},children:[i&&(0,wr.jsx)("div",{className:"annotation-note-title",style:{fontWeight:"bold"},children:i}),r&&(0,wr.jsx)("div",{className:"annotation-note-label",children:r})]})},"annotation-note-html")):(p.length>0&&(b.push((0,wr.jsx)("text",{className:"annotation-note-title",fill:v,textAnchor:h,fontWeight:"bold",children:p.map((e,t)=>(0,wr.jsx)("tspan",{x:g,dy:0===t?0:f,children:e},t))},"annotation-note-title")),y=p.length*f),m.length>0&&b.push((0,wr.jsx)("text",{className:"annotation-note-label",fill:v,textAnchor:h,y:y,children:m.map((e,t)=>(0,wr.jsx)("tspan",{x:g,dy:0===t?0:f,children:e},t))},"annotation-note-label")));let x=null;if((i||r)&&(0!==t||0!==o))if("topBottom"===u){const e=Math.min(l,120);let t=0,o=e;"end"===h?(t=-e,o=0):"middle"===h&&(t=-e/2,o=e/2),x=(0,wr.jsx)("line",{className:"note-line",x1:t,x2:o,y1:0,y2:0,stroke:n||"var(--semiotic-text-secondary, currentColor)"})}else{const e=(p.length+m.length)*f+(m.length>0?f:0);let t=0,o=e;"bottom"===d?(t=-e,o=0):"middle"===d&&(t=-e/2,o=e/2),x=(0,wr.jsx)("line",{className:"note-line",x1:0,x2:0,y1:t,y2:o,stroke:n||"var(--semiotic-text-secondary, currentColor)"})}const k=Math.max(0,p.length+m.length-1)*f;let w=0;return"topBottom"===u?w=0>o?-(k+2):18:"leftRight"===u&&(w="middle"===d?-(k+f+(m.length>0&&p.length>0?2:0))/2+8:"bottom"===d||0>o?-(k+2):18),(0,wr.jsxs)("g",{className:"annotation-note",transform:`translate(${t},${o})`,children:[(0,wr.jsx)("g",{className:"annotation-note-content",transform:0!==w?`translate(0,${w})`:void 0,children:b}),x]})}function Mr(e,t,o,n,r){const i=[];switch(e){case"callout-circle":{const e=(t?.radius||0)+(t?.radiusPadding||0);e>0&&i.push((0,wr.jsx)("circle",{r:e,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const e=t?.width||0,n=t?.height||0;(e>0||n>0)&&i.push((0,wr.jsx)("rect",{width:e,height:n,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=n||0,s=r||0;if(void 0!==t?.x){const n=(t.x||0)-e;i.push((0,wr.jsx)("line",{x1:n,y1:(t.y1||0)-s,x2:n,y2:(t.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==t?.y){const n=(t.y||0)-s;i.push((0,wr.jsx)("line",{x1:(t.x1||0)-e,y1:n,x2:(t.x2||0)-e,y2:n,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==t?.x1||void 0!==t?.x2?i.push((0,wr.jsx)("line",{x1:(t.x1||0)-e,y1:0,x2:(t.x2||0)-e,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===t?.y1&&void 0===t?.y2||i.push((0,wr.jsx)("line",{x1:0,y1:(t.y1||0)-s,x2:0,y2:(t.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const e=t?.type||"curly",n=t?.width??t?.height;void 0!==n&&i.push((0,wr.jsx)("path",{d:Ar(e,n,t?.depth||30,void 0===t?.width),fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return(0,wr.jsx)("g",{className:"annotation-subject",children:i})}function _r(e,t,o,n,r,i){const s=[];let a=0,l=0;if("callout-circle"!==r&&"label"!==r||!i?.radius){if("callout-rect"===r&&i){const o=i.width||0,n=i.height||0;if(o>0||n>0){const r=o/2,i=n/2,s=e-r,c=t-i;if(0!==s||0!==c){const e=Math.abs(s),t=Math.abs(c),u=o/2,d=n/2,h=e*d>t*u?u/e:d/t;a=r+s*h,l=i+c*h}}}else if("bracket"===r&&i){const e=i.width,t=i.height,o=i.depth||30;void 0!==e?(a=e/2,l=o):void 0!==t&&(a=o,l=t/2)}}else{const o=(i.radius||0)+(i.radiusPadding||0);if(o>0&&(0!==e||0!==t)){const n=Math.atan2(t,e);a=Math.cos(n)*o,l=Math.sin(n)*o}}const c=Math.sqrt((e-a)**2+(t-l)**2);if(c>.5){const r=n||"var(--semiotic-text-secondary, currentColor)",i="curve"===o?.type;let u=Math.atan2(t-l,e-a);if(i){const n=(a+e)/2,i=(l+t)/2,d=-(t-l)/c,h=(e-a)/c,f=(o?.curve??.25)*c,p=n+d*f,m=i+h*f;s.push((0,wr.jsx)("path",{className:"connector-curve",d:`M${a},${l}Q${p},${m} ${e},${t}`,fill:"none",stroke:r},"connector-line")),u=Math.atan2(m-l,p-a)}else s.push((0,wr.jsx)("line",{x1:a,y1:l,x2:e,y2:t,stroke:r},"connector-line"));if("arrow"===o?.end){const e=10,t=16/180*Math.PI;s.push((0,wr.jsx)("path",{d:`M${a},${l}L${a+e*Math.cos(u+t)},${l+e*Math.sin(u+t)}L${a+e*Math.cos(u-t)},${l+e*Math.sin(u-t)}Z`,fill:r,stroke:"none"},"connector-arrow"))}}return(0,wr.jsx)("g",{className:"annotation-connector",children:s})}function jr(e){const{x:t=0,y:o=0,dx:n,dy:r,nx:i,ny:s,note:a,connector:l,subject:c,type:u,color:d,className:h,disable:f,opacity:p,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(f)?f:[]);let k=n||0,w=r||0;null!=i&&(k=i-b),null!=s&&(w=s-v);const S="string"==typeof u?u:"label";if("bracket"===S&&c&&0===k&&0===w)if(void 0!==c.width){k=c.width/2;const e=c.depth||30;w=e+(0>e?-5:5)}else if(void 0!==c.height){const e=c.depth||30;k=e+(0>e?-5:5),w=c.height/2}return(0,wr.jsxs)("g",{className:("annotation "+(h||"")).trim(),transform:`translate(${b},${v})`,"data-testid":y,...null!=p&&{opacity:p},...m&&{strokeDasharray:m},...g,children:[!x.has("connector")&&_r(k,w,l,d,S,c),!x.has("subject")&&Mr(S,c,d,b,v),!x.has("note")&&Cr(a,k,w,d)]})}function Rr(e){const{noteData:t}=e,{screenCoordinates:o}=t,n="string"==typeof t.type?t.type:"label",r=t.eventListeners||t.events||{};if(t.coordinates&&o){const e=t.nx||o[0][0]+(t.dx??0),r=t.ny||o[0][1]+(t.dy??0),i=o.map((o,i)=>{const s=Object.assign({},t,{note:0===i?t.note:{label:""},x:o[0],y:o[1],nx:e,ny:r});return(0,wr.jsx)(jr,{"data-testid":"semiotic-annotation",...s,type:n},"multi-annotation-"+i)});return(0,wr.jsx)("g",{children:i})}const i=t.note||{title:"none",label:t.label},s=`${i.label}-${i.title}-${t.i}`;return(0,wr.jsx)(jr,{"data-testid":"semiotic-annotation",events:r,...t,type:n},s)}var Pr=require("d3-hierarchy"),Lr=require("d3-shape");function Tr(e){return Math.round(100*e)/100}function Ir(e,t=2){const o=[],n=[],r=t+1;for(let t=0;r>t;t++){let i=0;for(const[o,n]of e)null!==n&&(i+=o**t*n);o.push(i);const s=[];for(let o=0;r>o;o++){let n=0;for(const[r,i]of e)null!==i&&(n+=r**(t+o));s.push(n)}n.push(s)}n.push(o);const i=function(e,t){const o=e,n=e.length-1,r=[t];for(let e=0;n>e;e++){let t=e;for(let r=e+1;n>r;r++)Math.abs(o[e][r])>Math.abs(o[e][t])&&(t=r);for(let r=e;n+1>r;r++){const n=o[r][e];o[r][e]=o[r][t],o[r][t]=n}for(let t=e+1;n>t;t++)for(let r=n;r>=e;r--)o[r][t]-=o[r][e]*o[e][t]/o[e][e]}for(let e=n-1;e>=0;e--){let t=0;for(let i=e+1;n>i;i++)t+=o[i][e]*r[i];r[e]=(o[n][e]-t)/o[e][e]}return r}(n,r).map(Tr);return{points:e.map(([e])=>[Tr(e),Tr(i.reduce((t,o,n)=>t+o*e**n,0))]),equation:[...i].reverse()}}function $r(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 Nr(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 Dr(e){return null==e?null:e+""}function Er(e,t,o){return t.stickyPositionCache?.set(e,o),o}function Br(e,t,o){const n=e.anchor||e.lifecycle?.anchor||"fixed";if("latest"===n){if(null!=e.pointId&&o.pointNodes&&o.pointNodes.length>0)for(let n=o.pointNodes.length-1;n>=0;n--){const r=o.pointNodes[n];if(r.pointId===e.pointId)return Er(t,o,{x:r.x,y:r.y})}const n=function(e){const t=e.data;if(!t||0===t.length)return null;const o=t[t.length-1],n=e.scales?.x??e.scales?.time,r=e.scales?.y??e.scales?.value;if(!n||!r)return null;const i=o[e.xAccessor||"x"],s=o[e.yAccessor||"y"];return null==i||null==s?null:{x:n(i),y:r(s)}}(o);return n?Er(t,o,n):null}if("semantic"===n){const n=function(e,t,o){const n=function(e){return Dr(e.provenance?.stableId??e.stableId)}(e);if(!n)return null;const r=o.pointNodes?.find(e=>Dr(e.pointId)===n);if(r)return Er(t,o,{x:r.x,y:r.y});const i=o.data?.find(e=>function(e){return Dr(e.stableId??e.id??e.provenance?.stableId)}(e)===n);if(!i)return null;const s=$r(i,o),a=Nr(i,o);return null==s||null==a?null:Er(t,o,{x:s,y:a})}(e,t,o);if(n)return n}let r=null,i=null;if(null!=e.pointId&&o.pointNodes){const t=o.pointNodes.find(t=>t.pointId===e.pointId);t&&(r=t.x,i=t.y)}if(null!=r&&null!=i||(r=$r(e,o),i=Nr(e,o)),null!=r&&null!=i)return Er(t,o,{x:r,y:i});if("sticky"===n){const e=o.stickyPositionCache?.get(t);if(e)return e}return null}function Fr(e,t,o,n=50){return!(-n>e||e>(o.width||0)+n||-n>t||t>(o.height||0)+n)}var Hr=require("react/jsx-runtime"),Or={secondary:0,primary:3},zr=".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 Wr(e){return!0===e?._annotationDeferred}function qr(e){return"blended"===e?.cohesion||"layer"===e?.cohesion?e.cohesion:null}function Yr(e){const t=e?.provenance?.confidence;return"number"==typeof t&&Number.isFinite(t)?Math.max(0,Math.min(1,t)):null}function Gr(e){return Math.max(.72,.95-.06*e)}h();var Vr=c(require("react")),[Xr,Ur]=q(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const o=e.observations;return o.push(t),o.length>e.maxObservations&&o.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));function Kr(e){const t=Ur(e=>e.pushObservation),o=Vr.useCallback(o=>{e.onObservation?.(o),t?.(o)},[e,t]);return Vr.useMemo(()=>({...e,onObservation:o}),[o,e])}function Zr(e){const t=e.provenance,o=e.id??e.stableId??t?.stableId;return null==o||""===o?void 0:o+""}function Qr(e,t={}){const o=Zr(e);return{"data-semiotic-annotation-widget":"",...o?{"data-semiotic-annotation-id":o}:{},onClickCapture(n){const r=function(e){const t=e.nativeEvent;return"touch"===t.pointerType?"touch":0===t.detail?"keyboard":"pointer"}(n);t.onAnnotationActivate?.({annotation:e,annotationId:o,chartId:t.chartId,inputType:r}),o&&t.onObservation&&t.onObservation({type:"annotation-activate",annotationId:o,inputType:r,timestamp:Date.now(),chartType:t.chartType??"unknown",chartId:t.chartId})}}}function Jr(e){return e instanceof Element&&null!=e.closest("[data-semiotic-annotation-widget]")}var ei=require("react/jsx-runtime"),ti="var(--semiotic-bg, #ffffff)",oi=.85;function ni(e,t){return(e+"").length*t*.6}function ri(e){const{x:t,y:o,text:n,fill:r,fontSize:i=12,fontWeight:s,fontFamily:a,textAnchor:l="start",dominantBaseline:c,background:u,className:d}=e,h=function(e){return void 0===e||!0===e||"halo"===e?{type:"halo"}:!1===e||"none"===e?null:"box"===e?{type:"box"}:{type:e.type??"halo",...e}}(u),f=e=>(0,ei.jsx)("text",{x:t,y:o,textAnchor:l,dominantBaseline:c,fill:r,fontSize:i,fontWeight:s,fontFamily:a,className:d,...e?{stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:"stroke"}:{},children:n});if(!h)return f();if("halo"===h.type)return f({stroke:h.fill??ti,strokeWidth:h.haloWidth??3});const p=h.padding??{x:6,y:3},m="number"==typeof p?p:p.x,g="number"==typeof p?p:p.y,y=ni(n,i),b=i+2*g;let v,x;return v="middle"===l?t-y/2-m:"end"===l?t-y-m:t-m,x="middle"===c||"central"===c?o-b/2:"hanging"===c||"text-before-edge"===c?o-g:o-.8*i-g,(0,ei.jsxs)("g",{className:d,children:[(0,ei.jsx)("rect",{x:v,y:x,width:y+2*m,height:b,rx:h.radius??3,ry:h.radius??3,fill:h.fill??ti,fillOpacity:h.opacity??oi,stroke:h.stroke,strokeWidth:h.strokeWidth}),f()]})}var ii=require("react/jsx-runtime"),si={linear:Lr.curveLinear,monotoneX:Lr.curveMonotoneX,monotoneY:Lr.curveMonotoneY,step:Lr.curveStep,stepAfter:Lr.curveStepAfter,stepBefore:Lr.curveStepBefore,basis:Lr.curveBasis,cardinal:Lr.curveCardinal,catmullRom:Lr.curveCatmullRom};function ai(e,t,o,n){const r=[];return e.forEach((e,i)=>{let s;if(o){const r=o(e,i,n);s=null!=r?r:t(e,i,n)}else s=t(e,i,n);s&&r.push({node:s,annotation:e})}),function(e){const t=e.map((e,t)=>{return{p:e,i:t,emphasis:(o=e.annotation,"primary"===o?.emphasis||"secondary"===o?.emphasis?o.emphasis:null),confidence:Yr(e.annotation),readingOrder:null,rank:1};var o}),o=t.some(e=>null!=e.emphasis||null!=e.confidence),n=e.some(e=>Wr(e.annotation)),r=e.some(e=>null!=qr(e.annotation)),i=e.some(e=>"layer"===qr(e.annotation));if(!o&&!n&&!r)return e.map(e=>e.node);const s=t.filter(e=>null==e.emphasis&&null!=e.confidence).slice().sort((e,t)=>(t.confidence??0)-(e.confidence??0)||e.i-t.i);s.forEach((e,t)=>{e.readingOrder=t,e.rank=2-t/Math.max(1,s.length)});for(const e of t)e.emphasis&&(e.rank=Or[e.emphasis]);const a=t.sort((e,t)=>e.rank-t.rank||e.i-t.i).map(e=>{const{p:t,i:o,emphasis:n,readingOrder:r}=e,i=Wr(t.annotation);let s=t.node;if("primary"===n||"secondary"===n||null!=r){const e=null==n&&null!=r;s=(0,Hr.jsx)("g",{className:e?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+n,..."secondary"===n?{opacity:.6,fontSize:"0.88em"}:{},...e?{opacity:Gr(r),"data-annotation-reading-order":r}:{},children:t.node},"annotation-emphasis-"+o)}const a=qr(t.annotation);return a&&(s=(0,Hr.jsx)("g",{className:"annotation-cohesion--"+a,children:s},"annotation-cohesion-"+o)),i&&(s=(0,Hr.jsx)("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:s},"annotation-deferred-"+o)),s});return n&&a.unshift((0,Hr.jsx)("style",{children:zr},"annotation-disclosure-style")),i&&a.unshift((0,Hr.jsx)("style",{children:".annotation-cohesion--layer text,.annotation-cohesion--layer tspan{fill:var(--semiotic-annotation-color,var(--semiotic-text-secondary,#666));font-style:italic}"},"annotation-cohesion-style")),a}(r)}function li(e,t={}){return function(e,o,n){switch(e.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const t=Br(e,o,n);if(!t)return null;const{x:r,y:i}=t;if(!Fr(r,i,n))return null;const s="callout"===e.type?"callout-circle":e.type,a="callout-circle"===s?{radius:e.radius??12,radiusPadding:e.radiusPadding}:"callout-rect"===s?{width:e.width,height:e.height}:void 0;return(0,ii.jsx)(Rr,{noteData:{x:r,y:i,dx:e.dx??30,dy:e.dy??-30,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:s,...a?{subject:a}:{},connector:e.connector||{end:"arrow"},color:e.color,disable:e.disable,opacity:e.opacity,strokeDasharray:e.strokeDasharray,className:e.className}},"ann-"+o)}case"x-threshold":{const t=$r(null!=e.value?{...e,x:e.value}:e,n);if(null==t)return null;const r=e.color||"#f97316",i=e.labelPosition||"top";let s;s="bottom"===i?(n.height||0)-4:"center"===i?(n.height||0)/2:16;const a=t>.6*(n.width||0),l=a?t-4:t+4,c=a?"end":"start";return(0,ii.jsxs)("g",{opacity:e.opacity,children:[(0,ii.jsx)("line",{x1:t,y1:0,x2:t,y2:n.height||0,stroke:r,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,ii.jsx)(ri,{x:l,y:s,text:e.label,textAnchor:c,fill:r,fontSize:12,fontWeight:"bold",background:e.labelBackground??"halo"})]},"ann-"+o)}case"y-threshold":{const t=Nr(null!=e.value?{...e,y:e.value}:e,n);if(null==t)return null;const r=e.color||"#f97316",i=e.labelPosition||"right";let a,l;"left"===i?(a=4,l="start"):"center"===i?(a=(n.width||0)/2,l="middle"):(a=(n.width||0)-4,l="end");const c=20>(s=t)?Math.min((n.height||0)-4,s+16):s-4;return(0,ii.jsxs)("g",{opacity:e.opacity,children:[(0,ii.jsx)("line",{x1:0,y1:t,x2:n.width||0,y2:t,stroke:r,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,ii.jsx)(ri,{x:a,y:c,text:e.label,textAnchor:l,fill:r,fontSize:12,fontWeight:"bold",background:e.labelBackground??"halo"})]},"ann-"+o)}case"enclose":{const t=(e.coordinates||[]).map(e=>({x:$r({...e,type:"point"},n),y:Nr({...e,type:"point"},n),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>t.length)return null;const r=(0,Pr.packEnclose)(t),i=e.padding||10;return(0,ii.jsxs)("g",{children:[(0,ii.jsx)("circle",{cx:r.x,cy:r.y,r:r.r+i,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&(0,ii.jsx)(ri,{x:r.x,y:r.y-r.r-i-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:e.label,background:e.labelBackground??"none"})]},"ann-"+o)}case"rect-enclose":{const t=(e.coordinates||[]).map(e=>({x:$r({...e,type:"point"},n),y:Nr({...e,type:"point"},n)})).filter(e=>null!=e.x&&null!=e.y);if(2>t.length)return null;const r=e.padding||10,i=t.map(e=>e.x),s=t.map(e=>e.y),[a,l]=u(i),[c,d]=u(s),h=a-r,f=l+r,p=c-r;return(0,ii.jsxs)("g",{children:[(0,ii.jsx)("rect",{x:h,y:p,width:f-h,height:d+r-p,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&(0,ii.jsx)(ri,{x:(h+f)/2,y:p-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:e.label,background:e.labelBackground??"none"})]},"ann-"+o)}case"highlight":{const t=n.data||[],r="function"==typeof e.filter?t.filter(e.filter):e.field&&null!=e.value?t.filter(t=>t[e.field]===e.value):[],i={stroke:e.color||"#f97316",strokeWidth:2,fill:"none"};return(0,ii.jsx)("g",{children:r.map((t,o)=>{const r=$r(t,n),s=Nr(t,n);if(null==r||null==s)return null;const a="function"==typeof e.r?e.r(t):e.r||6,l="function"==typeof e.style?e.style(t):e.style||i;return(0,ii.jsx)("circle",{cx:r,cy:s,r:a,...l},"hl-"+o)})},"ann-"+o)}case"bracket":{const t=$r(e,n),r=Nr(e,n);return(0,ii.jsx)(Rr,{noteData:{x:t??0,y:r??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-"+o)}case"trend":{const t=n.data||[];if(2>t.length)return null;const r=n.xAccessor||"x",i=n.yAccessor||"y",s="ordinal"===n.frameType,a="horizontal"===n.projection,l=s?r:null,c=s?i:null;let u;const d=[],h=new Map;if(s&&l&&c){for(const e of t){const t=e[l];if(null==t)continue;const o=t+"";h.has(o)||(h.set(o,d.length),d.push(o))}u=t.map(e=>{const t=e[l],o=e[c];if(null==t||null==o)return null;const n=h.get(t+"");return null!=n?[n,+o]:null}).filter(e=>null!==e)}else u=t.map(e=>[e[r],e[i]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>u.length)return null;const f=n.scales?.x??n.scales?.time,p=n.scales?.y??n.scales?.value;if(!f||!p)return null;const m=e=>t=>{const o=Math.max(0,Math.floor(t)),n=Math.min(d.length-1,o+1),r=t-o,i=e(d[o]);return i+(e(d[n])-i)*r},g=f,y=p;let b;if(s)if(a){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;if("loess"===v)x=function(e,t=.3){const o=e.length;if(2>o)return e.slice();const n=e.slice().sort((e,t)=>e[0]-t[0]),r=n.map(e=>e[0]),i=n.map(e=>e[1]),s=Math.max(2,Math.ceil(t*o)),a=[];for(let e=0;o>e;e++){const t=r[e],n=r.map(e=>Math.abs(e-t)),l=n.slice().sort((e,t)=>e-t)[Math.min(s-1,o-1)]||1,c=[];for(let e=0;o>e;e++){const t=0===l?0:n[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,f=0,p=0;for(let e=0;o>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*r[e],h+=t*i[e],f+=t*r[e]*r[e],p+=t*r[e]*i[e])}if(0===u){a.push([t,i[e]]);continue}const m=u*f-d*d;if(1e-12>Math.abs(m))a.push([t,h/u]);else{const e=(u*p-d*h)/m;a.push([t,(h-e*d)/u+e*t])}}return a}(u,e.bandwidth??.3);else{const t="polynomial"===v?Ir(u,e.order||2):function(e){const t=[0,0,0,0];let o=0;for(const[n,r]of e)null!==r&&(o++,t[0]+=n,t[1]+=r,t[2]+=n*n,t[3]+=n*r);const n=o*t[2]-t[0]*t[0],r=0===n?0:Tr((o*t[3]-t[0]*t[1])/n),i=Tr(t[1]/o-r*t[0]/o);return{points:e.map(([e])=>[Tr(e),Tr(r*e+i)]),equation:[r,i]}}(u);x=t.points}const k=x.map(([e,t])=>{const[o,n]=b(e,t);return`${o},${n}`}).join(" "),w=e.color||"#6366f1",S=x[x.length-1],[A,C]=b(S[0],S[1]);return(0,ii.jsxs)("g",{children:[(0,ii.jsx)("polyline",{points:k,fill:"none",stroke:w,strokeWidth:e.strokeWidth||2,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,ii.jsx)("text",{x:A+4,y:C-4,fill:w,fontSize:11,children:e.label})]},"ann-"+o)}case"band":{const t=n.scales?.y??n.scales?.value,s=t?.(e.y0)??0,a=t?.(e.y1)??(n.height||0),l=wn(e.fill,"ann-"+o,"var(--semiotic-primary, #6366f1)");return(0,ii.jsxs)("g",{opacity:e.opacity,children:[l.def&&(0,ii.jsx)("defs",{children:l.def}),(0,ii.jsx)("rect",{x:0,y:Math.min(s,a),width:n.width||0,height:Math.abs(a-s),fill:l.fill,fillOpacity:e.fillOpacity||.1}),e.label&&(0,ii.jsx)(ri,{x:(n.width||0)-4,y:(r=s,i=a,Math.max(Math.min(r,i),0)+16),textAnchor:"end",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:e.label,background:e.labelBackground??"halo"})]},"ann-"+o)}case"x-band":{const t=n.scales?.x??n.scales?.time,r=null!=e.x0&&t?t(e.x0):null,i=null!=e.x1&&t?t(e.x1):null;if(null==r||null==i)return null;const s=wn(e.fill||e.color,"ann-"+o,"var(--semiotic-primary, #6366f1)");return(0,ii.jsxs)("g",{opacity:e.opacity,children:[s.def&&(0,ii.jsx)("defs",{children:s.def}),(0,ii.jsx)("rect",{x:Math.min(r,i),y:0,width:Math.abs(i-r),height:n.height||0,fill:s.fill,fillOpacity:e.fillOpacity??.1}),e.label&&(0,ii.jsx)(ri,{x:Math.min(r,i)+4,y:16,textAnchor:"start",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:e.label,background:e.labelBackground??"halo"})]},"ann-"+o)}case"envelope":{const t=n.data||[];if(2>t.length)return null;const r=n.xAccessor||"x",i=n.scales?.x??n.scales?.time,s=n.scales?.y??n.scales?.value;if(!i||!s)return null;const a=e.upperAccessor||"upperBounds",l=e.lowerAccessor||"lowerBounds",c=e.filter,u=t.filter(e=>null!=e[a]&&null!=e[l]&&!(c&&!c(e))).sort((e,t)=>e[r]-t[r]);if(2>u.length)return null;const d=si[n.curve||"linear"]||Lr.curveLinear,h=(0,Lr.area)().x(e=>i(e[r])).y0(e=>s(e[l])).y1(e=>s(e[a])).curve(d)(u);if(!h)return null;const f=e.fill||"#6366f1";return(0,ii.jsxs)("g",{children:[(0,ii.jsx)("path",{d:h,fill:f,fillOpacity:e.fillOpacity??.15,stroke:"none"}),e.label&&u.length>0&&(0,ii.jsx)("text",{x:i(u[u.length-1][r])+4,y:s(u[u.length-1][a])-4,fill:f,fontSize:11,children:e.label})]},"ann-"+o)}case"anomaly-band":{const t=n.data||[];if(2>t.length)return null;const r=n.yAccessor||"y",i=n.scales?.x??n.scales?.time,s=n.scales?.y??n.scales?.value;if(!i||!s)return null;const a=t.map(e=>e[r]).filter(e=>null!=e&&isFinite(e));if(2>a.length)return null;const l=a.reduce((e,t)=>e+t,0)/a.length,c=a.reduce((e,t)=>e+(t-l)**2,0)/a.length,u=Math.sqrt(c),d=e.threshold??2,h=l-d*u,f=!1!==e.showBand,p=e.fill||"#6366f1",m=e.fillOpacity??.1,g=e.anomalyColor||"#ef4444",y=e.anomalyRadius??6,b=s(l+d*u),v=s(h),x=t.filter(e=>{const t=e[r];return null!=t&&Math.abs(t-l)>d*u});return(0,ii.jsxs)("g",{children:[f&&(0,ii.jsx)("rect",{x:0,y:Math.min(b,v),width:n.width||0,height:Math.abs(v-b),fill:p,fillOpacity:m}),x.map((e,t)=>{const o=$r(e,n),r=Nr(e,n);return null==o||null==r?null:(0,ii.jsx)("circle",{cx:o,cy:r,r:y,fill:g,fillOpacity:.7,stroke:g,strokeWidth:1.5},"anomaly-"+t)}),e.label&&(0,ii.jsx)("text",{x:(n.width||0)-4,y:Math.min(b,v)-4,textAnchor:"end",fill:p,fontSize:11,children:e.label})]},"ann-"+o)}case"forecast":{const t=n.data||[];if(3>t.length)return null;const r=n.xAccessor||"x",i=n.yAccessor||"y",s=n.scales?.x??n.scales?.time,a=n.scales?.y??n.scales?.value;if(!s||!a)return null;const l=t.map(e=>[e[r],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=Ir(l,e.order||2).equation;c=e=>t.reduce((t,o,n)=>t+o*Math.pow(e,n),0)}else{const e=l.length;let t=0,o=0,n=0,r=0;for(const[e,i]of l)t+=e,o+=i,n+=e*e,r+=e*i;const i=e*n-t*t;if(1e-12>Math.abs(i))return null;const s=(e*r-t*o)/i,a=(o-s*t)/e;c=e=>a+s*e}const u=l.length,d=l.map(([e,t])=>t-c(e)),h=d.reduce((e,t)=>e+t*t,0),f=Math.sqrt(h/Math.max(u-2,1)),p=l.reduce((e,t)=>e+t[0],0)/u,m=l.reduce((e,t)=>e+(t[0]-p)**2,0),g=e.confidence??.95,y=.99>g?.95>g?.9>g?1:1.645:1.96:2.576,b=e.steps??5,v=l[u-1][0],x=(v-l[0][0])/Math.max(u-1,1),k=[];for(let e=1;b>=e;e++)k.push(v+e*x);const w=[];for(const e of k){const t=c(e),o=f*Math.sqrt(1+1/u+(m>0?(e-p)**2/m:0))*y;w.push({x:e,yCenter:t,yUpper:t+o,yLower:t-o})}const S=`M${w.map(e=>`${s(e.x)},${a(e.yUpper)}`).join(" L")} L${w.slice().reverse().map(e=>`${s(e.x)},${a(e.yLower)}`).join(" L")} Z`,A=w.map(e=>`${s(e.x)},${a(e.yCenter)}`).join(" "),C=`${s(v)},${a(c(v))}`,M=e.strokeColor||"#6366f1";return(0,ii.jsxs)("g",{children:[(0,ii.jsx)("path",{d:S,fill:e.fill||"#6366f1",fillOpacity:e.fillOpacity??.15,stroke:"none"}),(0,ii.jsx)("polyline",{points:`${C} ${A}`,fill:"none",stroke:M,strokeWidth:e.strokeWidth??2,strokeDasharray:e.strokeDasharray??"6,3"}),e.label&&w.length>0&&(0,ii.jsx)("text",{x:s(w[w.length-1].x)+4,y:a(w[w.length-1].yCenter)-4,fill:M,fontSize:11,children:e.label})]},"ann-"+o)}case"widget":{let r,i;if(null!=e.px&&null!=e.py)r=e.px,i=e.py;else{const t=Br(e,o,n);if(!t)return null;r=t.x,i=t.y}if(!Fr(r,i,n))return null;const s=e.dx??0,a=e.dy??0,l=e.width??32,c=e.height??32,u=e.content??(0,ii.jsx)("span",{style:{fontSize:18,cursor:"default"},title:e.label||"Info",children:"ℹ️"});return(0,ii.jsx)("foreignObject",{x:r+s-l/2,y:i+a-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:(0,ii.jsx)("div",{...Qr(e,t),style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+o)}case"text":{const t=Br(e,o,n);if(!t)return null;const{x:r,y:i}=t,s=r+(e.dx||0),a=i+(e.dy||0),l=e.color||"var(--semiotic-text, #333)",c=(0,ii.jsx)("text",{x:s,y:a,fill:l,fontSize:e.fontSize||11,opacity:e.opacity,strokeDasharray:e.strokeDasharray,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:e.label});return!0!==e._redundantConnector?kr.cloneElement(c,{key:"ann-text-"+o}):(0,ii.jsxs)("g",{opacity:e.opacity,strokeDasharray:e.strokeDasharray,children:[(0,ii.jsx)("line",{x1:r,y1:i,x2:s,y2:a,stroke:l,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),kr.cloneElement(c,{opacity:void 0,strokeDasharray:void 0})]},"ann-text-"+o)}case"category-highlight":{const t=e.category;if(null==t)return null;const r=e=>"function"==typeof e&&"function"==typeof e.bandwidth,i=n.scales?.o,s=n.scales?.x,a=n.scales?.y,l=r(i)?i:r(s)?s:r(a)?a:null;if(!l)return null;const c=l(t+"");if(null==c)return null;const u=l.bandwidth(),d=e.color||"var(--semiotic-primary, #4589ff)",h=e.opacity??.15,f=e.label;return(0,ii.jsxs)("g",(n.projection?"vertical"===n.projection:l===s)?{children:[(0,ii.jsx)("rect",{x:c,y:0,width:u,height:n.height||0,fill:d,fillOpacity:h}),f&&(0,ii.jsx)(ri,{x:c+u/2,y:16,textAnchor:"middle",fill:d,fontSize:12,fontWeight:"bold",text:f,background:e.labelBackground??"none"})]}:{children:[(0,ii.jsx)("rect",{x:0,y:c,width:n.width||0,height:u,fill:d,fillOpacity:h}),f&&(0,ii.jsx)(ri,{x:12,y:c+u/2,dominantBaseline:"middle",fill:d,fontSize:12,fontWeight:"bold",text:f,background:e.labelBackground??"none"})]},"ann-"+o)}default:return null}var r,i,s}}var ci=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function ui(e){return!!e&&"object"==typeof e&&ci.has(function(e){return"string"==typeof e?.type?e.type:""}(e))}function di(e){return"primary"===e?.emphasis||!0===e?.defensive}function hi(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 fi(e){let t;const o=e?.emphasis;t="primary"===o?100:"secondary"===o?10:50;const n=e?.provenance?.confidence;switch("number"==typeof n&&Number.isFinite(n)&&(t+=15*Math.max(0,Math.min(1,n))),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 pi=32,mi=6,gi=4,yi=8,bi=72;var vi={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function xi(e){if(!ki(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 ki(e){return ui(e)}function wi(e,t){if(!e)return[];const o=Math.max(1,Math.floor(t/7)),n=e.split(/\s+/).filter(Boolean),r=[];let i="";for(const e of n)i&&i.length+e.length+1>o?(r.push(i),i=e):i=i?`${i} ${e}`:e;return i&&r.push(i),r}function Si(e,t,o,n,r){const i=e+o,s=t+n;return Math.abs(o)>Math.abs(n)?{x:0>o?i-r.width-4:i+4,y:0>n?s-r.height:s,width:r.width,height:r.height}:{x:0>o?i-r.width:i,y:0>n?s-r.height-4:s+4,width:r.width,height:r.height}}function Ai(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 Mi(e,t,o,n,r,i,s,a){const l=Ai(e,s);let c=.4*Math.hypot(t.dx,t.dy)+80*function(e,t,o,n){const r=Math.max(0,n-e.x),i=Math.max(0,n-e.y);return(r+Math.max(0,e.x+e.width-(t-n)))*e.height+(i+Math.max(0,e.y+e.height-(o-n)))*e.width}(l,r,i,a);for(const e of o)c+=12*Ci(l,e);for(const e of n)c+=4*Ci(l,e);return c}function _i(e){const{annotations:t,context:o,defaultOffset:n=pi,notePadding:r=mi,markPadding:i=gi,edgePadding:s=yi,preserveManualOffsets:a=!0,routeLongConnectors:l=!0,connectorThreshold:c=bi,density:u,progressiveDisclosure:d=!1,redundantCues:h=!1,responsive:f,mobile:p,cohesion:m,audience:g}=e,y=o.width||0,b=o.height||0,v="object"==typeof p?p:{},x=v.breakpoint??480,k=!!p&&x>=y,w=k&&!1!==v.preferShortText?t.map(xi):t,S=k&&!u?{maxAnnotations:v.maxAnnotations??("callout-list"===v.strategy?1:2),minVisible:v.minVisible??1}:u,A=d||k&&(!1!==v.progressiveDisclosure||"callout-list"===v.strategy),C=k&&!f?v.responsive??{minWidth:x}:f,M=k&&!m?v.cohesion:m;if(0===w.length||0>=y||0>=b)return w.slice();const _=[],j=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 R=!1;const P=w.map((e,t)=>{if(!ki(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 n=e.pointId??e.nodeId;if(null!=n&&o.pointNodes){const e=o.pointNodes.find(e=>e.pointId===n);if(e)return{x:e.x,y:e.y}}const r=e.coordinates,i=o.scales?.geoProjection;if(Array.isArray(r)&&r.length>=2&&i){const e=r[0],t=r[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?Br(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=[...wi("string"==typeof e.title?e.title:void 0,t),...wi("string"==typeof e.label?e.label:void 0,t)],n=o.reduce((e,t)=>Math.max(e,t.length),0);return{width:Math.max(24,Math.min(t,7*n)+10),height:Math.max(18,16*o.length+6)}}(e);if(a&&("number"==typeof(d=e).dx||"number"==typeof d.dy)){const t=function(e){return"text"===e.type||"widget"===e.type?{dx:0,dy:0}:{dx:30,dy:-30}}(e);return _.push(Ai(Si(i.x,i.y,"number"==typeof e.dx?e.dx:t.dx,"number"==typeof e.dy?e.dy:t.dy,u),r)),e}var d;let h=null,f=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}]}(n)){const t=Mi(Si(i.x,i.y,e.dx,e.dy,u),e,_,j,y,b,r,s);f>t&&(h=e,f=t)}if(!h)return e;const p=Ai(Si(i.x,i.y,h.dx,h.dy,u),r);_.push(p);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 R=!0,{...e,dx:h.dx,dy:h.dy,...g?{connector:g}:{}}}),L=R?P:w.slice();let T=L;if(h){let e=!1;const t=L.map(t=>{const o=function(e){return"text"!==e.type||"string"!=typeof e.color||8>Math.hypot("number"==typeof e.dx?e.dx:0,"number"==typeof e.dy?e.dy:0)?e:{...e,_redundantConnector:!0}}(t);return o!==t&&(e=!0),o});T=e?t:L}{let e=!1;const t=T.map(t=>{if(!0!==t?.defensive)return t;const o=function(e){const t=e?.provenance;if(!t||"object"!=typeof t)return e;const o="string"==typeof t.source?vi[t.source]??t.source:null,n="number"==typeof t.confidence&&Number.isFinite(t.confidence)?Math.round(100*Math.max(0,Math.min(1,t.confidence)))+"%":null;if(!o&&!n)return e;if(null!=e.label&&"string"!=typeof e.label)return e;const r=[o,n].filter(Boolean).join(" · "),i="string"==typeof e.label?e.label:"";return i.includes(`(${r})`)?e:{...e,label:i?`${i} (${r})`:`(${r})`}}(t);return o!==t&&(e=!0),o});T=e?t:T}const I=new Set;if(S){const e="object"==typeof S?S:{},t=function(e){if(!e)return 1;const t=function(e){const t=e?.familiarity;if(!t)return 3;const o=Object.values(t).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0===o.length?3:o.reduce((e,t)=>e+t,0)/o.length}(e);return t>2?4>t?1:.6:1.5}(g),o=1===t?e:{...e,maxAnnotations:Math.max(0,Math.round((e.maxAnnotations??hi(y,b,e))*t))},{deferred:n}=function(e){const{annotations:t,width:o,height:n}=e,r=Math.max(0,e.minVisible??1),i=hi(o,n,e),s=t.map((e,t)=>{return{annotation:e,index:t,note:(o=e,ui(o))};var o}),a=s.filter(e=>e.note);if(0===a.length||i>=a.length)return{visible:t.slice(),deferred:[],budget:i};const l=a.filter(e=>di(e.annotation)),c=a.filter(e=>!di(e.annotation)).sort((e,t)=>fi(t.annotation)-fi(e.annotation)||e.index-t.index),u=Math.min(c.length,Math.max(Math.max(0,i-l.length),Math.max(0,r-l.length))),d=new Set([...l.map(e=>e.index),...c.slice(0,u).map(e=>e.index)]),h=[],f=[];for(const{annotation:e,index:t,note:o}of s)!o||d.has(t)?h.push(e):f.push(e);return{visible:h,deferred:f,budget:i}}({annotations:T,width:y,height:b,...o});for(const e of n)I.add(e)}if(C&&("object"==typeof C&&"number"==typeof C.minWidth?C.minWidth:480)>=y)for(const e of T)ki(e)&&"secondary"===e.emphasis&&I.add(e);if(I.size>0)for(const e of T)!0===e?.defensive&&I.delete(e);let $;return $=0===I.size?T:A?T.map(e=>I.has(e)?{...e,_annotationDeferred:!0}:e):T.filter(e=>!I.has(e)),M?function(e,t){let o=!1;const n=e.map(e=>ki(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(o=!0,{...e,cohesion:t}):e);return o?n:e}($,M):$}var ji=require("react"),Ri={positions:new Map},Pi=new Set;function Li(){for(const e of Pi)e()}function Ti(e,t){const o=Ri.positions.get(e);if(o?.locked)return;if(!o||o.sourceId!==t)return;const n=new Map(Ri.positions);n.delete(e),Ri={positions:n},Li()}function Ii(e,t){const o=Ri.positions.get(e);if(!o?.locked)return;if(t&&o.sourceId!==t)return;const n=new Map(Ri.positions);n.delete(e),Ri={positions:n},Li()}function $i(){return Ri}function Ni(e){return Pi.add(e),()=>Pi.delete(e)}var Di={positions:new Map};function Ei(){return()=>{}}function Bi(){return Di}function Fi(e,t,o){return"exact"===o?function(e,t){const o=e.domain(),n=o[0],r=o[o.length-1],i=n instanceof Date,s=n instanceof Date?n.getTime():n,a=r instanceof Date?r.getTime():r;if(2>t||s===a)return i?[new Date(s),new Date(a)]:[s,a];const l=(a-s)/(t-1),c=Array(t);for(let e=0;t>e;e++){const o=e===t-1?a:s+e*l;c[e]=i?new Date(o):o}return c}(e,t):e.ticks(t)}function Hi(e,t,o){if("edges"===e){if(t)return"start";if(o)return"end"}return"middle"}function Oi(e,t,o){if("edges"===e){if(t)return"hanging";if(o)return"auto"}return"middle"}function zi(e){if(0===e.length)return{min:null,max:null};let t=1/0,o=-1/0;for(const n of e)t>n.pixel&&(t=n.pixel),n.pixel>o&&(o=n.pixel);return{min:t,max:o}}function Wi(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function qi(e,t,o){if("left"===e||"right"===e){const n="left"===e?o:0,r="left"===e?-1:1,i=Math.ceil(t/8);let s="M0,"+n;for(let e=0;i>e;e++){const o=8*(e+1);s+=`L${Math.min(8*e+4,t)},${n+4*r}`,s+=`L${Math.min(o,t)},${n}`}return s}const n="bottom"===e?0:t,r="bottom"===e?1:-1,i=Math.ceil(o/8);let s=`M${n},0`;for(let e=0;i>e;e++){const t=8*(e+1);s+=`L${n+4*r},${Math.min(8*e+4,o)}`,s+=`L${n},${Math.min(t,o)}`}return s}var Yi=require("react/jsx-runtime");function Gi(e){const{width:t,height:o,totalWidth:n,totalHeight:r,margin:i,scales:s,showAxes:a,axes:l,showGrid:c,xFormat:u,yFormat:d,axisExtent:h}=e,f=(0,Zn.useMemo)(()=>{if(!s)return[];const e=l?.find(e=>"bottom"===e.orient),o=e?.tickFormat||u||Vi,n=Math.max(2,Math.floor(t/70)),r=e?.ticks??5,i="exact"===h?Math.max(2,r):Math.min(r,n),a=e?.tickValues??Fi(s.x,i,h),c=a.map(e=>e.valueOf()),d=a.map((e,t)=>({value:e,pixel:s.x(e),label:o(e,t,c)})),f=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 Xi(d,Math.max(55,f+8))},[s,l,u,t,h]),p=(0,Zn.useMemo)(()=>{if(!s)return[];const e=l?.find(e=>"left"===e.orient),t=e?.tickFormat||d||Vi,n=Math.max(2,Math.floor(o/30)),r=e?.ticks??5,i="exact"===h?Math.max(2,r):Math.min(r,n);return Xi((e?.tickValues??Fi(s.y,i,h)).map(e=>({value:e,pixel:s.y(e),label:t(e)})),22)},[s,l,d,o,h]),m=c&&s,g=a&&s;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),k=y?.jaggedBase||!1,w=b?.jaggedBase||!1,S="var(--semiotic-border, #ccc)";return(0,Yi.jsx)("svg",{width:n,height:r,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:(0,Yi.jsxs)("g",{transform:`translate(${i.left},${i.top})`,children:[m&&(()=>{const e=Wi(l?.find(e=>"bottom"===e.orient)?.gridStyle),n=Wi(l?.find(e=>"left"===e.orient)?.gridStyle);return(0,Yi.jsxs)("g",{className:"stream-grid",children:[f.map((t,n)=>(0,Yi.jsx)("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:o,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:e},"xgrid-"+n)),p.map((e,o)=>(0,Yi.jsx)("line",{x1:0,y1:e.pixel,x2:t,y2:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:n},"ygrid-"+o))]})})(),v&&!k&&(0,Yi.jsx)("line",{x1:0,y1:o,x2:t,y2:o,stroke:S,strokeWidth:1}),k&&(0,Yi.jsx)("path",{d:qi("bottom",t,o),fill:"none",stroke:S,strokeWidth:1}),x&&!w&&(0,Yi.jsx)("line",{x1:0,y1:0,x2:0,y2:o,stroke:S,strokeWidth:1}),w&&(0,Yi.jsx)("path",{d:qi("left",t,o),fill:"none",stroke:S,strokeWidth:1})]})})}function Vi(e,t,o){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function Xi(e,t){if(2>=e.length)return e;const o=[e[0]];for(let n=1;e.length-1>n;n++)t>Math.abs(e[n].pixel-o[o.length-1].pixel)||o.push(e[n]);const n=e[e.length-1];return t>Math.abs(n.pixel-o[o.length-1].pixel)?o[o.length-1]=n:o.push(n),o}function Ui(e){const{width:t,height:o,totalWidth:n,totalHeight:r,margin:i,scales:s,showAxes:a,axes:l,xLabel:c,yLabel:u,yLabelRight:d,xFormat:h,yFormat:f,axisExtent:p,showGrid:m,title:g,legend:y,legendHoverBehavior:b,legendClickBehavior:v,legendHighlightedCategory:x,legendIsolatedCategories:k,legendPosition:w="right",legendLayout:S,foregroundGraphics:A,marginalGraphics:C,xValues:M,yValues:_,annotations:j,onAnnotationActivate:R,onObservation:P,chartId:L,chartType:T,autoPlaceAnnotations:I,svgAnnotationRules:$,xAccessor:N,yAccessor:D,annotationData:E,pointNodes:B,curve:F,underlayRendered:H,canvasObscuresUnderlay:O=!0,linkedCrosshairName:z,linkedCrosshairSourceId:W,children:q}=e,Y=Kr({onAnnotationActivate:R,onObservation:P,chartId:L,chartType:T}),G=(0,Zn.useMemo)(()=>{if(!a||!s)return[];const e=l?.find(e=>"bottom"===e.orient),o=e?.tickFormat||h||Vi,n=Math.max(2,Math.floor(t/70)),r=e?.ticks??5,i="exact"===p?Math.max(2,r):Math.min(r,n),c=e?.tickValues??Fi(s.x,i,p),u=c.map(e=>e.valueOf()),d=c.map((e,t)=>({value:e,pixel:s.x(e),label:o(e,t,u)})),f=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(f+8,55)):Math.max(55,f+8);let g=Xi(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"!==p&&!e?.tickValues){const e=s.x.domain()[1],t=s.x(e),n=g[g.length-1].pixel;if(Math.abs(t-n)>1){const r=o(e,g.length,u);m>t-n&&g.length>1&&(g=g.slice(0,-1)),g.push({value:e,pixel:t,label:r})}}return g},[a,s,l,h,t,p]),V=(0,Zn.useMemo)(()=>{if(!a||!s)return[];const e=l?.find(e=>"left"===e.orient),t=e?.tickFormat||f||Vi,n=Math.max(2,Math.floor(o/30)),r=e?.ticks??5,i="exact"===p?Math.max(2,r):Math.min(r,n);let c=Xi((e?.tickValues??Fi(s.y,i,p)).map(e=>({value:e,pixel:s.y(e),label:t(e)})),22);if(c.length>1&&(c=c.filter((e,t)=>0===t||e.label+""!=c[t-1].label+"")),e?.includeMax&&c.length>0&&"exact"!==p&&!e?.tickValues){const e=s.y.domain()[1],o=s.y(e),n=c[c.length-1].pixel;if(Math.abs(o-n)>1){const r=t(e);22>Math.abs(o-n)&&c.length>1&&(c=c.slice(0,-1)),c.push({value:e,pixel:o,label:r})}}return c},[a,s,l,f,o,p]),X=(0,Zn.useMemo)(()=>{if(!a||!s)return[];const e=l?.find(e=>"right"===e.orient);if(!e)return[];const t=e.tickFormat||f||Vi,n=Math.max(2,Math.floor(o/30)),r=e.ticks??5;return Xi((e.tickValues??Fi(s.y,"exact"===p?Math.max(2,r):Math.min(r,n),p)).map(e=>({value:e,pixel:s.y(e),label:t(e)})),22)},[a,s,l,f,o,p]),U=(0,Zn.useRef)(new Map),K=(0,Zn.useRef)(j?.length??0),Z=j?.length??0;K.current!==Z&&(K.current=Z,U.current=new Map);const Q=(0,Zn.useMemo)(()=>{if(!j||0===j.length)return null;const e=li(0,Y),n={scales:s?{x:s.x,y:s.y,time:s.x,value:s.y}:null,timeAxis:"x",xAccessor:N,yAccessor:D,width:t,height:o,data:E,frameType:"xy",pointNodes:B,curve:F,stickyPositionCache:U.current};return ai(I?_i({annotations:j,context:n,..."object"==typeof I?I:{}}):j,e,$,n)},[j,I,$,t,o,N,D,E,s,B,F,Y]),J=function(e){const t=(0,ji.useSyncExternalStore)(e?Ni:Ei,e?$i:Bi,e?$i:Bi);return e?t.positions.get(e)??null:null}(z);return(0,Zn.useEffect)(()=>{if(!J?.locked||!z)return;const e=e=>{"Escape"===e.key&&Ii(z)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[J?.locked,z]),a||g||y||A||C||Q&&Q.length>0||m||q||J?(0,Yi.jsxs)("svg",{role:"img",width:n,height:r,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[(0,Yi.jsx)("title",{children:"string"==typeof g?g:"XY Chart"}),(0,Yi.jsx)("desc",{children:"string"==typeof g?g+" — XY data visualization":"XY data visualization"}),(0,Yi.jsxs)("g",{transform:`translate(${i.left},${i.top})`,children:[m&&s&&(!H||O)&&(()=>{const e=Wi(l?.find(e=>"bottom"===e.orient)?.gridStyle),n=Wi(l?.find(e=>"left"===e.orient)?.gridStyle);return(0,Yi.jsxs)("g",{className:"stream-grid",children:[G.map((t,n)=>(0,Yi.jsx)("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:o,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:e},"xgrid-"+n)),V.map((e,o)=>(0,Yi.jsx)("line",{x1:0,y1:e.pixel,x2:t,y2:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:n},"ygrid-"+o))]})})(),a&&s&&(()=>{const e=l?.find(e=>"left"===e.orient),n=l?.find(e=>"bottom"===e.orient),r=!e||!1!==e.baseline,s=!n||!1!==n.baseline,a=e?.jaggedBase||!1,h=n?.jaggedBase||!1,f=n?.landmarkTicks,p=e?.landmarkTicks,m="var(--semiotic-border, #ccc)",g="var(--semiotic-text-secondary, var(--semiotic-text, #666))",y="var(--semiotic-text, #333)",b=!!n?.autoRotate&&G.length>1&&(()=>{const e=t/Math.max(G.length-1,1);return G.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0)+8>e})(),v=b?12:18,x=o+(b?58:40),k={fontSize:"var(--semiotic-tick-font-size, 12px)"},w={fontSize:"calc(var(--semiotic-tick-font-size, 12px) + 1px)"},S={fontSize:"var(--semiotic-axis-label-font-size, 12px)"},A=n?.tickAnchor,C=e?.tickAnchor,M=zi(G),_=zi(V);return(0,Yi.jsxs)("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[(0,Yi.jsxs)("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[(!H||O)&&s&&!h&&(0,Yi.jsx)("line",{x1:0,y1:o,x2:t,y2:o,stroke:m,strokeWidth:1}),(!H||O)&&h&&(0,Yi.jsx)("path",{d:qi("bottom",t,o),fill:"none",stroke:m,strokeWidth:1}),G.map((e,t)=>{const n=!!f&&("function"==typeof f?f(e.value,t):Vo(e.value,t>0?G[t-1].value:void 0));return(0,Yi.jsxs)("g",{transform:`translate(${e.pixel},${o})`,children:[(0,Yi.jsx)("line",{y2:5,stroke:m,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?(0,Yi.jsx)("text",{y:v,textAnchor:b?"end":Hi(A,e.pixel===M.min,e.pixel===M.max),fontWeight:n?600:400,fill:g,className:"semiotic-axis-tick",style:{userSelect:"none",...n?w:k},transform:b?"rotate(-45)":void 0,children:e.label}):(0,Yi.jsx)("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:(0,Yi.jsx)("div",{style:{textAlign:"center",userSelect:"none",...k},children:e.label})})]},"xtick-"+t)}),c&&(0,Yi.jsx)("text",{x:t/2,y:x,textAnchor:"middle",fill:y,className:"semiotic-axis-label",style:{userSelect:"none",...S},children:c})]}),(0,Yi.jsxs)("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[(!H||O)&&r&&!a&&(0,Yi.jsx)("line",{x1:0,y1:0,x2:0,y2:o,stroke:m,strokeWidth:1}),(!H||O)&&a&&(0,Yi.jsx)("path",{d:qi("left",t,o),fill:"none",stroke:m,strokeWidth:1}),V.map((e,t)=>{const o=!!p&&("function"==typeof p?p(e.value,t):Vo(e.value,t>0?V[t-1].value:void 0));return(0,Yi.jsxs)("g",{transform:`translate(0,${e.pixel})`,children:[(0,Yi.jsx)("line",{x2:-5,stroke:m,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?(0,Yi.jsx)("text",{x:-8,textAnchor:"end",dominantBaseline:Oi(C,e.pixel===_.min,e.pixel===_.max),fontWeight:o?600:400,fill:g,className:"semiotic-axis-tick",style:{userSelect:"none",...o?w:k},children:e.label}):(0,Yi.jsx)("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:(0,Yi.jsx)("div",{style:{textAlign:"right",userSelect:"none",...k},children:e.label})})]},"ytick-"+t)}),(()=>{const t=e?.label||u;return t?(0,Yi.jsx)("text",{x:15-i.left,y:o/2,textAnchor:"middle",fill:y,transform:`rotate(-90, ${15-i.left}, ${o/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...S},children:t}):null})()]}),(()=>{const e=l?.find(e=>"right"===e.orient);if(!e||0===X.length)return null;const n=!1!==e.baseline,r=e.landmarkTicks,s=e.label||d,a=e.tickAnchor,c=zi(X);return(0,Yi.jsxs)("g",{className:"semiotic-axis semiotic-axis-right","data-orient":"right",children:[n&&(0,Yi.jsx)("line",{x1:t,y1:0,x2:t,y2:o,stroke:m,strokeWidth:1}),X.map((e,o)=>{const n=!!r&&("function"==typeof r?r(e.value,o):Vo(e.value,o>0?X[o-1].value:void 0));return(0,Yi.jsxs)("g",{transform:`translate(${t},${e.pixel})`,children:[(0,Yi.jsx)("line",{x2:5,stroke:m,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?(0,Yi.jsx)("text",{x:8,textAnchor:"start",dominantBaseline:Oi(a,e.pixel===c.min,e.pixel===c.max),fontWeight:n?600:400,fill:g,className:"semiotic-axis-tick",style:{userSelect:"none",...n?w:k},children:e.label}):(0,Yi.jsx)("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:(0,Yi.jsx)("div",{style:{textAlign:"left",userSelect:"none",...k},children:e.label})})]},"ytick-r-"+o)}),s&&(0,Yi.jsx)("text",{x:t+i.right-15,y:o/2,textAnchor:"middle",fill:y,transform:`rotate(90, ${t+i.right-15}, ${o/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...S},children:s})]})})()]})})(),Q,C&&s&&M&&_&&(0,Yi.jsxs)(Yi.Fragment,{children:[C.top&&(0,Yi.jsx)("g",{transform:"translate(0, 0)",children:(0,Yi.jsx)(xr,{orient:"top",config:vr(C.top),values:M,scale:s.x,size:i.top,length:t})}),C.bottom&&(0,Yi.jsx)("g",{transform:`translate(0, ${o})`,children:(0,Yi.jsx)(xr,{orient:"bottom",config:vr(C.bottom),values:M,scale:s.x,size:i.bottom,length:t})}),C.left&&(0,Yi.jsx)("g",{transform:"translate(0, 0)",children:(0,Yi.jsx)(xr,{orient:"left",config:vr(C.left),values:_,scale:s.y,size:i.left,length:o})}),C.right&&(0,Yi.jsx)("g",{transform:`translate(${t}, 0)`,children:(0,Yi.jsx)(xr,{orient:"right",config:vr(C.right),values:_,scale:s.y,size:i.right,length:o})})]}),A,J&&J.sourceId!==W&&s?.x&&(()=>{const e=s.x(J.xValue);if(null==e||0>e||e>t)return null;const n=J.locked;return(0,Yi.jsx)("line",{x1:e,y1:0,x2:e,y2:o,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"})})(),q]}),g&&"string"==typeof g?(0,Yi.jsx)("text",{x:n/2,y:22,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:g}):g?(0,Yi.jsx)("foreignObject",{x:0,y:0,width:n,height:i.top,children:g}):null,mr({legend:y,totalWidth:n,totalHeight:r,margin:i,legendPosition:w,title:g,legendLayout:S,legendHoverBehavior:b,legendClickBehavior:v,legendHighlightedCategory:x,legendIsolatedCategories:k})]}):null}var Ki=c(require("react")),Zi=require("d3-shape");function Qi(e){return(e.tl??0)>0||(e.tr??0)>0||(e.br??0)>0||(e.bl??0)>0}function Ji(e){const t=e.cornerRadii;if(!t)return{tl:0,tr:0,br:0,bl:0};const o=Math.min(e.w,e.h)/2,n=e=>Math.max(0,Math.min(e??0,o));return{tl:n(t.tl),tr:n(t.tr),br:n(t.br),bl:n(t.bl)}}var es=(e,t)=>({x:e*Math.cos(t),y:e*Math.sin(t)});function ts(e){const{innerRadius:t,outerRadius:o,startAngle:n,endAngle:r}=e,i=0>=t;if(0>=(e.cornerRadius??0)||!e.roundStart&&!e.roundEnd){if(i){const e=es(o,n),t=es(o,r);return`M0,0 L${e.x},${e.y} A${o},${o} 0 ${r-n>Math.PI?1:0} 1 ${t.x},${t.y} Z`}const e=es(o,n),s=es(o,r),a=es(t,r),l=es(t,n),c=r-n>Math.PI?1:0;return`M${e.x},${e.y} A${o},${o} 0 ${c} 1 ${s.x},${s.y} L${a.x},${a.y} A${t},${t} 0 ${c} 0 ${l.x},${l.y} Z`}const s=Math.max(0,Math.min(e.cornerRadius??0,(o-t)/2));if(0===s)return ts({...e,cornerRadius:0,roundStart:!1,roundEnd:!1});const a=Math.asin(Math.min(1,s/Math.max(1e-9,o-s))),l=i?0:Math.asin(Math.min(1,s/Math.max(1e-9,t+s))),c=r-n,u=e.roundStart&&e.roundEnd?c/2:c,d=!!e.roundStart&&u>a,h=!!e.roundEnd&&u>a;if(!d&&!h)return ts({...e,cornerRadius:0,roundStart:!1,roundEnd:!1});const f=n+(d?a:0),p=r-(h?a:0),m=n+(d?l:0),g=r-(h?l:0),y=es(o,f),b=es(o,p),v=(o-s)*Math.cos(a),x=es(v,n),k=es(v,r),w=i?null:es(t,g),S=i?null:es(t,m),A=i?0:(t+s)*Math.cos(l),C=i?null:es(A,n),M=i?null:es(A,r),_=p-f>Math.PI?1:0,j=i?0:g-m>Math.PI?1:0;let R="";if(d)R+=`M${x.x},${x.y}`,R+=` A${s},${s} 0 0 1 ${y.x},${y.y}`;else{const e=es(o,n);R+=`M${e.x},${e.y}`}if(h)R+=` A${o},${o} 0 ${_} 1 ${b.x},${b.y}`,R+=` A${s},${s} 0 0 1 ${k.x},${k.y}`;else{const e=es(o,r);R+=` A${o},${o} 0 ${_} 1 ${e.x},${e.y}`}if(i)R+=" L0,0";else{if(h)R+=` L${M.x},${M.y}`,R+=` A${s},${s} 0 0 1 ${w.x},${w.y}`;else{const e=es(t,r);R+=` L${e.x},${e.y}`}if(d)R+=` A${t},${t} 0 ${j} 0 ${S.x},${S.y}`,R+=` A${s},${s} 0 0 1 ${C.x},${C.y}`;else{const e=es(t,n);R+=` A${t},${t} 0 ${j} 0 ${e.x},${e.y}`}}return R+=" Z",R}function os(e){const t=ts({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle,endAngle:e.endAngle,cornerRadius:e.cornerRadius,roundStart:e.roundStart,roundEnd:e.roundEnd}),o=[],n=e.colors;if(n.length>0){const t=(e.endAngle-e.startAngle)/n.length;for(let r=0;n.length>r;r++)o.push({d:ts({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle+r*t,endAngle:e.endAngle}),color:n[r]})}return{clipPath:t,slices:o}}var ns=require("react/jsx-runtime"),rs={innerRadius:0,outerRadius:0,startAngle:0,endAngle:0};function is(e,t="#4e79a7"){return yn(e)?e.background&&"transparent"!==e.background?e.background:t:e&&"string"==typeof e?e:t}function ss(e,t,o){const n=Pt(e.symbolType,e.size,e.path);return(0,ns.jsx)("path",{d:n,transform:e.rotation?`translate(${e.x},${e.y}) rotate(${180*e.rotation/Math.PI})`:`translate(${e.x},${e.y})`,fill:e.style.fill?is(e.style.fill):"none",opacity:e.style.opacity,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth},`${o??""}symbol-${t}`)}function as(e,t,o,n){const r=e.glyph;if(!r?.parts?.length||0>=e.size)return null;const i=Zo(r,e.size);if(0>=i.scale)return null;const s=`translate(${t},${o})${e.rotation?` rotate(${180*e.rotation/Math.PI})`:""} translate(${i.offsetX},${i.offsetY}) scale(${i.scale})`,a=e.color??("string"==typeof e.style.fill?e.style.fill:void 0),l=tn(r,e.fraction??1,e.fractionStart??0,e.fractionDirection??"horizontal"),c=l?ls(n+"-clip"):void 0,u=(e.style.opacity??1)*(e._decayOpacity??1)*(e.style.fillOpacity??1),d=t=>r.parts.map((o,n)=>{const r=t?"none"===o.fill?void 0:t:Qo(o.fill,a,e.accent),i=t?o.stroke&&"none"!==o.stroke?t:void 0:Qo(o.stroke??"none",a,e.accent);return r||i?(0,ns.jsx)("path",{d:o.d,fill:r??"none",stroke:i,strokeWidth:i?o.strokeWidth??1:void 0,strokeLinecap:o.strokeLinecap,strokeLinejoin:o.strokeLinejoin,opacity:o.opacity},n):null});return(0,ns.jsxs)("g",{transform:s,opacity:1===u?void 0:u,children:[l&&c&&(0,ns.jsx)("clipPath",{id:c,children:(0,ns.jsx)("rect",{x:l.x,y:l.y,width:l.width,height:l.height})}),l&&e.ghostColor?(0,ns.jsx)("g",{children:d(e.ghostColor)}):null,l&&c?(0,ns.jsx)("g",{clipPath:`url(#${c})`,children:d()}):d()]},n)}function ls(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}var cs="undefined"==typeof window||"undefined"==typeof document,us=require("react"),ds="undefined"!=typeof window?us.useLayoutEffect:us.useEffect;function hs(){const[e,t]=(0,us.useState)(!1);return ds(()=>{t(!0)},[]),e}var fs=()=>()=>{},ps=()=>!1,ms=()=>!0;function gs(){const e=(0,us.useSyncExternalStore)(fs,ps,ms);return(0,us.useRef)(e).current}var ys=require("react");function bs(e){const t=(0,ys.useRef)(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return xs(e,t);if(!ks(e)||!ks(t))return!1;const o=Object.keys(e),n=Object.keys(t);if(o.length!==n.length)return!1;for(const n of o){if(!Object.prototype.hasOwnProperty.call(t,n))return!1;const o=e[n],r=t[n];if(!Object.is(o,r))if(Array.isArray(o)&&Array.isArray(r)){if(!xs(o,r))return!1}else{if(!ks(o)||!ks(r))return!1;if(!vs(o,r))return!1}}return!0}(t.current,e)||(t.current=e),t.current}function vs(e,t){const o=Object.keys(e),n=Object.keys(t);if(o.length!==n.length)return!1;for(const n of o){if(!Object.prototype.hasOwnProperty.call(t,n))return!1;if(!Object.is(e[n],t[n]))return!1}return!0}function xs(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 ks(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 ws(e,t){const{background:o,hasBackgroundGraphics:n=!1,themeBackground:r="",x:i=0,y:s=0,width:a,height:l}=t;if("transparent"===o)return!1;if(n)return!1;const c=o||(r&&"transparent"!==r?r:"")||null;if(!c)return!1;const u=hn(e,c);return!!u&&(e.fillStyle=u,e.fillRect(i,s,a,l),!0)}var Ss={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 As(e,t){const o=e.trim();if(/^#[0-9a-f]{3}$/i.test(o)){const e=o[1],n=o[2],r=o[3];return`#${e}${e}${n}${n}${r}${r}${t}`}if(/^#[0-9a-f]{6}$/i.test(o))return`${o}${t}`;const n=o.match(/^rgb\s*\(\s*([^)]+?)\s*\)$/i);return n?`rgba(${n[1]}, ${(parseInt(t,16)/255).toFixed(3)})`:o}var Cs=c(require("react")),Ms=c(require("react")),_s=require("react/jsx-runtime"),js=Ms.createContext(null);function Rs({children:e}){const[t,o]=Ms.useState(!1),n=Ms.useCallback(()=>o(e=>!e),[]),r=Ms.useMemo(()=>({visible:t,setVisible:o,toggle:n}),[t,n]);return(0,_s.jsx)(js.Provider,{value:r,children:e})}function Ps(){return Ms.useContext(js)}var Ls=require("react/jsx-runtime"),Ts={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function Is({hoverPoint:e}){let t="";if(e){const o=e.data||e;t="object"==typeof o?"Data point: "+Object.entries(o).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Data point: "+o}return(0,Ls.jsx)("div",{"aria-live":"polite","aria-atomic":"true",style:Ts,children:t})}function $s(e){const t={};if(null==e||"object"!=typeof e)return t;for(const[o,n]of Object.entries(e))o.startsWith("_")||null!=n&&""!==n&&("number"==typeof n?Number.isFinite(n)&&(t[o]=n):"string"==typeof n?t[o]=n:"boolean"==typeof n?t[o]=n+"":n instanceof Date&&(t[o]=n.toISOString().slice(0,10)));return t}function Ns(e){return e&&"object"==typeof e?e:{}}function Ds(e){return Ns(e.accessibility).tableFields??e.accessibleDatum??e.datum}var Es=require("react/jsx-runtime");function Bs(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 n=[],r={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},i=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],s=Object.keys(o).sort((e,t)=>{const o=i.indexOf(e),n=i.indexOf(t);return(-1===o?999:o)-(-1===n?999:n)});for(const e of s)n.push(`${o[e]} ${r[e]||e}`);return`${t}, ${n.join(", ")}`}function Fs(e,t,o){const n=[];return e>0&&n.push(e+" nodes"),t>0&&n.push(t+" edges"),0===n.length?o+", empty":`${o}, ${n.join(", ")}`}var Hs=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},Os="semiotic-accessible-data-table",zs=Os+" semiotic-accessible-data-table-hidden",Ws=Os+" semiotic-accessible-data-table-visible",qs=Ws+" semiotic-accessible-data-table-network",Ys={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"},Gs={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},Vs={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)"},Xs={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},Us={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))"},Ks={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},Zs={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},Qs={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 Js({scene:e,chartType:t,tableId:o,chartTitle:n}){const[r,i]=Cs.useState(!1),[s,a]=Cs.useState(5),l=Ps(),c=l?.visible??!1,u=r||c,d=Cs.useRef(null),h=n?"Data summary for "+n:o?`Data summary for ${t} ${o}`:"Data summary for "+t;Cs.useEffect(()=>{u||a(5)},[u]);const f=Cs.useCallback(e=>{e.target===e.currentTarget&&(r||c||i(!0))},[r,c]),p=Cs.useCallback(e=>{c||d.current?.contains(e.relatedTarget)||i(!1)},[c]);if(!e||0===e.length)return o?(0,Es.jsx)("span",{id:o,tabIndex:-1,style:Ts}):null;if(!u)return(0,Es.jsx)("div",{id:o,className:zs,tabIndex:-1,onFocus:f,style:Ts,role:"region","aria-label":h,children:(0,Es.jsxs)("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 n of e)if(n&&"object"==typeof n&&null!==n.datum)try{switch(n.type){case"point":if(o)break;t.push({label:"Point",values:$s(Ds(n))});break;case"line":case"area":{const e=Ds(n),o=Array.isArray(e)?e:[],r="line"===n.type?"Line point":"Area point";for(const e of o)t.push({label:r,values:$s(e)});break}case"rect":{const e=Ds(n),o=null!=e&&"object"==typeof e?e:{},r=o.category??n.group??"",i=o.value??o.__aggregateValue??o.total,s=$s(o);null==s.category&&""!==r&&(s.category=r+""),null==s.value&&null!=i&&(s.value="number"==typeof i||"string"==typeof i?i:i+""),t.push({label:"Bar",values:s});break}case"heatcell":{const e=$s(Ds(n));null==e.value&&"number"==typeof n.value&&Number.isFinite(n.value)&&(e.value=n.value),t.push({label:"Cell",values:e});break}case"wedge":{const e=Ds(n),o=$s(e);if(null==o.category){const t=Ns(e),n=t.category??t.label;null!=n&&(o.category=n+"")}t.push({label:"Wedge",values:o});break}case"circle":t.push({label:"Node",values:$s(Ds(n))});break;case"arc":t.push({label:"Arc",values:$s(Ds(n))});break;case"candlestick":t.push({label:"Candlestick",values:$s(Ds(n))});break;case"geoarea":{const e=Ns(Ds(n)),o=$s(e);if(null==o.name){const t=Ns(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 n of t){const t=[],r=new Set;for(const o of e){if(!o||!o.values)continue;const e=o.values[n];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&r.add(e+""))}if(t.length>0){let e=t[0],r=t[0],i=0;for(const o of t)e>o&&(e=o),o>r&&(r=o),i+=o;o.push({name:n,count:t.length,numeric:!0,min:e,max:r,mean:i/t.length})}else if(r.size>0){const e=Array.from(r);o.push({name:n,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}: ${Hs(e.min)} to ${Hs(e.max)}, mean ${Hs(e.mean)}.`);else{const t=e.uniqueValues,n=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");o.push(`${e.name}: ${n}.`)}return o.join(" ")}(m.length,g),b=Math.min(s,m.length),v=m.slice(0,b),x=m.length-b,k=new Set;for(const e of v)for(const t of Object.keys(e.values))k.add(t);const w=Array.from(k);return(0,Es.jsxs)("div",{ref:d,id:o,className:Ws,tabIndex:-1,onBlur:p,style:Ys,role:"region","aria-label":h,children:[(0,Es.jsx)("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{c&&l&&l.setVisible(!1),i(!1)},"aria-label":"Close data summary",style:Vs,children:"×"}),(0,Es.jsx)("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:Gs,children:y}),(0,Es.jsxs)("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+t,style:Xs,children:[(0,Es.jsx)("caption",{className:"semiotic-accessible-data-table-caption",style:Zs,children:x>0?`First ${b} of ${m.length} data points`:`All ${m.length} data points`}),(0,Es.jsx)("thead",{children:(0,Es.jsxs)("tr",{children:[(0,Es.jsx)("th",{style:Us,children:"type"}),w.map(e=>(0,Es.jsx)("th",{style:Us,children:e},e))]})}),(0,Es.jsx)("tbody",{children:v.map((e,t)=>(0,Es.jsxs)("tr",{children:[(0,Es.jsx)("td",{style:Ks,children:e.label}),w.map(t=>{return(0,Es.jsx)("td",{style:Ks,children:(o=e.values[t],null==o||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":Hs(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"")},t);var o})]},t))})]}),x>0&&(0,Es.jsxs)("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>a(e=>e+25),style:Qs,children:["Show ",Math.min(25,x)," more"," ",1===x?"row":"rows"," (",x," remaining)"]})]})}function ea({nodes:e,edges:t,chartType:o,tableId:n,chartTitle:r}){const[i,s]=Cs.useState(!1),[a,l]=Cs.useState(5),c=Ps(),u=c?.visible??!1,d=i||u,h=r?"Data summary for "+r:n?`Data summary for ${o} ${n}`:"Data summary for "+o,f=Cs.useRef(null);Cs.useEffect(()=>{d||l(5)},[d]);const p=Cs.useCallback(e=>{e.target===e.currentTarget&&(i||u||s(!0))},[i,u]),m=Cs.useCallback(e=>{u||f.current?.contains(e.relatedTarget)||s(!1)},[u]);if(!e||0===e.length)return n?(0,Es.jsx)("span",{id:n,tabIndex:-1,style:Ts}):null;if(!d)return(0,Es.jsx)("div",{id:n,className:zs,tabIndex:-1,onFocus:p,style:Ts,role:"region","aria-label":h,children:(0,Es.jsxs)("button",{type:"button",onClick:()=>s(!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,k=new Map;for(const e of y){if(!e||"object"!=typeof e)continue;const t=e.datum??{source:e.source,target:e.target},o="object"==typeof t.source?t.source?.id:t.source,n="object"==typeof t.target?t.target?.id:t.target,r="number"==typeof t.value&&Number.isFinite(t.value)?t.value:0;if(null!=o&&""!==o){const e=o+"";v.set(e,(v.get(e)??0)+1),k.set(e,(k.get(e)??0)+r)}if(null!=n&&""!==n){const e=n+"";b.set(e,(b.get(e)??0)+1),x.set(e,(x.get(e)??0)+r)}}const w=[];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,n=null!=o?o+"":"node-"+e,r=b.get(n)??0,i=v.get(n)??0,s=x.get(n)??0,a=k.get(n)??0;w.push({id:n,degree:r+i,inDeg:r,outDeg:i,wDegree:s+a,wInDeg:s,wOutDeg:a})}w.sort((e,t)=>t.degree-e.degree);let S=0,A=0;if(w.length>0){let e=0;for(const t of w)e+=t.degree,t.degree>A&&(A=t.degree);S=e/w.length}const C=y.some(e=>{const t=e?.datum??{source:e?.source,target:e?.target};return"number"==typeof t?.value&&Number.isFinite(t.value)}),M=[`${w.length} nodes, ${y.length} edges.`];w.length>0&&M.push(`Mean degree: ${Hs(S)}, max degree: ${A}.`);const _=Math.min(a,w.length),j=w.slice(0,_),R=w.length-_;return(0,Es.jsxs)("div",{ref:f,id:n,className:qs,tabIndex:-1,onBlur:m,style:Ys,role:"region","aria-label":h,children:[(0,Es.jsx)("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{u&&c&&c.setVisible(!1),s(!1)},"aria-label":"Close data summary",style:Vs,children:"×"}),(0,Es.jsx)("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:Gs,children:M.join(" ")}),(0,Es.jsxs)("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Node degree summary for "+o,style:Xs,children:[(0,Es.jsx)("caption",{className:"semiotic-accessible-data-table-caption",style:Zs,children:R>0?`Top ${_} of ${w.length} nodes by degree`:`All ${w.length} nodes by degree`}),(0,Es.jsx)("thead",{children:(0,Es.jsxs)("tr",{children:[(0,Es.jsx)("th",{style:Us,children:"id"}),(0,Es.jsx)("th",{style:Us,children:"degree"}),(0,Es.jsx)("th",{style:Us,children:"in"}),(0,Es.jsx)("th",{style:Us,children:"out"}),C&&(0,Es.jsx)("th",{style:Us,children:"w. degree"}),C&&(0,Es.jsx)("th",{style:Us,children:"w. in"}),C&&(0,Es.jsx)("th",{style:Us,children:"w. out"})]})}),(0,Es.jsx)("tbody",{children:j.map((e,t)=>(0,Es.jsxs)("tr",{children:[(0,Es.jsx)("td",{style:Ks,children:e.id}),(0,Es.jsx)("td",{style:Ks,children:e.degree}),(0,Es.jsx)("td",{style:Ks,children:e.inDeg}),(0,Es.jsx)("td",{style:Ks,children:e.outDeg}),C&&(0,Es.jsx)("td",{style:Ks,children:Hs(e.wDegree)}),C&&(0,Es.jsx)("td",{style:Ks,children:Hs(e.wInDeg)}),C&&(0,Es.jsx)("td",{style:Ks,children:Hs(e.wOutDeg)})]},t))})]}),R>0&&(0,Es.jsxs)("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>l(e=>e+25),style:Qs,children:["Show ",Math.min(25,R)," more"," ",1===R?"node":"nodes"," (",R," remaining)"]})]})}function ta({summary:e}){return e?(0,Es.jsx)("div",{role:"note",style:Ts,children:e}):null}function oa({tableId:e}){return(0,Es.jsx)("a",{href:"#"+e,style:Ts,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,Ts)},children:"Skip to data table"})}var na=require("react/jsx-runtime"),ra="var(--semiotic-focus, #005fcc)";function ia({active:e,hoverPoint:t,margin:o,size:n,shape:r="circle",width:i,height:s,pathData:a}){if(!e||!t)return null;const l=t.x+o.left,c=t.y+o.top;let u;if("geoarea"!==r&&"path"!==r||!a)if("rect"===r&&null!=i&&null!=s){const e=Math.max(i,4),t=Math.max(s,4);u=(0,na.jsx)("rect",{x:l-e/2-3,y:c-t/2-3,width:e+6,height:t+6,rx:3,fill:"none",stroke:ra,strokeWidth:2,strokeDasharray:"4,2"})}else u=(0,na.jsx)("circle","wedge"===r?{cx:l,cy:c,r:12,fill:"none",stroke:ra,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:ra,strokeWidth:2,strokeDasharray:"4,2"});else u=(0,na.jsx)("g",{transform:`translate(${o.left},${o.top})`,children:(0,na.jsx)("path",{d:a,fill:"none",stroke:ra,strokeWidth:2.5,strokeDasharray:"6,3"})});return(0,na.jsx)("svg",{style:{position:"absolute",left:0,top:0,width:n[0],height:n[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}var sa=c(require("react"));function aa(e,t){return"touch"===t?Math.max(e,24):e}function la(e){return Array.isArray(e)?e[0]:e}function ca(e,t,o,n){return{data:la(e),x:t,y:o,__semioticHoverData:!0,...n}}var ua=["name","label","title"],da=["type","kind","category","group","class","status","role","shape"],ha=["value","amount","total","count","weight","score"],fa=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 pa(e,t){for(const o of t){const t=e.find(e=>e.lower===o);if(t)return t}}function ma(e,t={}){if(!e||"object"!=typeof e)return{entries:[]};const o=t.maxEntries??6,n=!1!==t.skipPositional,r=[];for(const[t,o]of Object.entries(e)){if(t.startsWith("_"))continue;if("data"===t)continue;if(n&&fa.has(t.toLowerCase()))continue;if(null==o)continue;const e=typeof o;("string"===e||"number"===e||"boolean"===e||o instanceof Date)&&r.push({key:t,lower:t.toLowerCase(),value:o})}if(0===r.length)return{entries:[]};let i=r.findIndex(e=>ua.includes(e.lower));const s=i>=0;0>i&&(i=r.findIndex(e=>"id"===e.lower)),0>i&&(i=r.findIndex(e=>"string"==typeof e.value));const a=0>i?void 0:r[i];let l=r.filter((e,t)=>t!==i);s&&(l=l.filter(e=>"id"!==e.lower));const c=pa(l,da),u=pa(l,ha),d=new Set(da),h=new Set(ha),f=[];c&&f.push({key:c.key,value:c.value}),u&&f.push({key:u.key,value:u.value});for(const e of l){if(f.length>=o)break;e!==c&&e!==u&&(d.has(e.lower)||h.has(e.lower)||f.push({key:e.key,value:e.value}))}return{titleKey:a?.key,title:a?.value,entries:f}}var ga=require("react/jsx-runtime"),ya={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 ba(e,t){return"function"==typeof t?t(e):e[t]}function va(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 xa(e={}){const{fields:t,title:o,format:n,style:r={},className:i=""}=e;return e=>{if(!e||"object"!=typeof e)return null;let s;const a=[];if(o){const t=ba(e,o);s=va(t,n)}if(t&&t.length>0)t.forEach(t=>{let o,r,i;"string"==typeof t?(o=t,r=t,i=n):(o=t.label,r=t.accessor||t.key||"",i=t.format||n);const s=ba(e,r);a.push({label:o,value:va(s,i)})});else if(!o){const t=["value","y","name","id","label"];for(const o of t)if(void 0!==e[o]){s=va(e[o],n);break}if(!s){const t=Object.keys(e).filter(e=>!e.startsWith("_"));t.length>0&&(s=va(e[t[0]],n))}}const l={...ya,...r};return(0,ga.jsxs)("div",{className:("semiotic-tooltip "+i).trim(),style:l,children:[s&&(0,ga.jsx)("div",{style:{fontWeight:a.length>0?"bold":"normal"},children:s}),a.map((e,t)=>(0,ga.jsxs)("div",{style:{marginTop:0===t&&s?"4px":0},children:[e.label&&(0,ga.jsxs)("span",{children:[e.label,": "]}),e.value]},t))]})}}function ka(e={}){const{fields:t=[],title:o,format:n,style:r={},className:i="",showLabels:s=!0,separator:a=": "}=e;return e=>{if(!e||"object"!=typeof e)return null;const l=[];if(o){const t=ba(e,o);l.push({value:va(t,n)})}if(t&&Array.isArray(t)&&t.length>0)t.forEach(t=>{let o,r,i;"string"==typeof t?(o=t,r=t,i=n):(o=t.label,r=t.accessor||t.key||"",i=t.format||n);const a=va(ba(e,r),i);l.push({label:s?o:void 0,value:a})});else{const t=ma(e,{skipPositional:!1});null!=t.title&&l.push({label:void 0,value:va(t.title,n),bold:!0}),t.entries.forEach(e=>{l.push({label:s?e.key:void 0,value:va(e.value,n)})})}const c={...ya,...r};return Array.isArray(l)&&0!==l.length?(0,ga.jsx)("div",{className:("semiotic-tooltip semiotic-tooltip-multiline "+i).trim(),style:c,children:l.map((e,t)=>(0,ga.jsxs)("div",{style:{marginBottom:l.length-1>t?"4px":0,fontWeight:e.bold?"bold":void 0},children:[e.label&&(0,ga.jsxs)("strong",{children:[e.label,a]}),e.value]},t))}):null}}function wa(){return e=>{const t=e.allSeries;if(!t||0===t.length)return(0,ga.jsx)("div",{className:"semiotic-tooltip",style:ya,children:(0,ga.jsx)("div",{children:va(e.data?.value??e.data?.y)})});const o=e.xValue??e.data?.time??e.data?.x;return(0,ga.jsxs)("div",{className:"semiotic-tooltip",style:ya,children:[null!=o&&(0,ga.jsx)("div",{style:{fontWeight:600,marginBottom:4,fontSize:"0.9em",borderBottom:"1px solid var(--semiotic-border, #eee)",paddingBottom:4},children:va(o)}),t.map((e,t)=>(0,ga.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"1px 0"},children:[(0,ga.jsx)("span",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:e.color,flexShrink:0}}),(0,ga.jsx)("span",{style:{flex:1,fontSize:"0.85em"},children:e.group}),(0,ga.jsx)("span",{style:{fontWeight:500,fontSize:"0.85em"},children:va(e.value)})]},t))]})}}function Sa(e){if(!0!==e){if("function"==typeof e){const t=e;return e=>{let o=la(!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);if(!o)return null;if(("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),!o)return null;const n=t(o);return null==n?null:(0,ga.jsx)("div",{className:"semiotic-tooltip",style:ya,children:n})}}return!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?xa(e):xa())}}var Aa=require("react/jsx-runtime");function Ca({x:e,y:t,containerWidth:o,containerHeight:n,margin:r,children:i,className:s="stream-frame-tooltip",zIndex:a=1}){const l=Number.isFinite(e)&&Number.isFinite(t),c=sa.useRef(null),[u,d]=sa.useState(null);sa.useLayoutEffect(()=>{const e=c.current;if(!e)return;const t=()=>{const t=e.getBoundingClientRect();Number.isFinite(t.width)&&Number.isFinite(t.height)&&d(e=>e&&.5>Math.abs(e.width-t.width)&&.5>Math.abs(e.height-t.height)?e:{width:t.width,height:t.height})};if(t(),"undefined"==typeof ResizeObserver)return;const o=new ResizeObserver(t);return o.observe(e),()=>o.disconnect()},[s,o,n,l]);let h;h=u?`translate(${u.width+12>o-e?"calc(-100% - 12px)":"12px"}, ${u.height+12>n-t?"calc(-100% - 4px)":"4px"})`:`translate(${e>.7*o?"calc(-100% - 12px)":"12px"}, ${.3*n>t?"4px":"calc(-100% - 4px)"})`;const f=function(e){if(!sa.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 n=o.style;if(n&&"object"==typeof n){if(null!=n.background&&""!==n.background&&"transparent"!==n.background)return!0;if(null!=n.backgroundColor&&""!==n.backgroundColor&&"transparent"!==n.backgroundColor)return!0}return!1}(i),p=f?null:ya;return l?(0,Aa.jsx)("div",{ref:c,className:f?s:(s+" semiotic-tooltip").trim(),style:{...p||{},position:"absolute",left:r.left+e,top:r.top+t,transform:h,pointerEvents:"none",zIndex:a,width:"max-content"},children:i}):null}var Ma=c(require("react")),_a=require("react"),ja=require("react");function Ra(e,t){if("function"==typeof e.addEventListener)return e.addEventListener("change",t),()=>e.removeEventListener("change",t);const o=e;return o.addListener(t),()=>o.removeListener(t)}var Pa=require("react");function La(e,t,o){const n=(0,Pa.useRef)(null),[r,i]=(0,Pa.useState)(null);return(0,Pa.useEffect)(()=>{if(!t&&!o)return;const e=n.current;if(!e)return;const r=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 r.observe(e),()=>r.disconnect()},[t,o]),[n,[t&&r?r.w:e[0],o&&r?r.h:e[1]]]}var Ta=()=>"undefined"!=typeof performance?performance.now():Date.now();function Ia(e){let t=e>>>0;return()=>{t+=1831565813;let e=t;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}}function $a(e,t){const o=e();return Number.isFinite(o)?o:t}var Na=class{constructor(e={}){this.randomSource=Math.random,this.subscribers=new Set,this.now=()=>this.advance(),this.random=()=>this.randomSource(),this.clock=e.clock??Ta,this.lastWallTime=$a(this.clock,0),this.logicalTime=this.lastWallTime,this.pausedValue=!0===e.paused,this.visibleValue=!1!==e.visible,this.setRandomSource(e.random,e.seed)}get isActive(){return!this.pausedValue&&this.visibleValue}get paused(){return this.pausedValue}get seed(){return this.seedValue}get visible(){return this.visibleValue}configure(e){this.setClock(e.clock),this.setRandomSource(e.random,e.seed)}setPaused(e){this.pausedValue!==e&&(this.advance(),this.pausedValue=e,this.emit())}setVisible(e){this.visibleValue!==e&&(this.advance(),this.visibleValue=e,this.emit())}snapshot(){return{now:this.now(),paused:this.pausedValue,seed:this.seedValue,visible:this.visibleValue}}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}advance(){const e=$a(this.clock,this.lastWallTime),t=Math.max(0,e-this.lastWallTime);return this.lastWallTime=e,this.isActive&&(this.logicalTime+=t),this.logicalTime}emit(){for(const e of this.subscribers)e()}setClock(e){const t=e??Ta;t!==this.clock&&(this.advance(),this.clock=t,this.lastWallTime=$a(t,this.lastWallTime))}setRandomSource(e,t){const o=function(e){return"number"==typeof e&&Number.isFinite(e)?Math.trunc(e):void 0}(t);e===this.randomInput&&o===this.seedValue||(this.randomInput=e,this.seedValue=o,this.randomSource=e??(void 0===o?Math.random:Ia(o)))}},Da="undefined"==typeof window?_a.useEffect:_a.useLayoutEffect,Ea={requestAnimationFrame:e=>("undefined"==typeof window?globalThis:window).requestAnimationFrame(e),cancelAnimationFrame:e=>("undefined"==typeof window?globalThis:window).cancelAnimationFrame(e)};function Ba(e,t,o){return"function"==typeof e?e({size:t,margin:o}):e}function Fa(e){const t=function(){const[e,t]=(0,ja.useState)(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return(0,ja.useEffect)(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),Ra(e,e=>t(e.matches))},[]),e}(),o=(0,_a.useRef)(t);o.current=t;const[n,r]=La(e.sizeProp,e.responsiveWidth,e.responsiveHeight),i=!!e.title,s=!!e.legend&&"top"===e.legendPosition,a=(0,_a.useMemo)(()=>function(e,t,o=!1){const n=o?t?58:34:t?36:0;return n>e.top?{...e,top:n}:e}({...e.marginDefault,...e.userMargin},i,s),[e.marginDefault,e.userMargin,i,s]),l=r[0]-a.left-a.right,c=r[1]-a.top-a.bottom,u=Ba(e.foregroundGraphics,r,a),d=Ba(e.backgroundGraphics,r,a),h=ee(e=>e.theme),{transition:f,introEnabled:p}=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),m="semiotic-table-"+Ma.useId(),g=(0,_a.useRef)(null);if(!g.current){const t=!e.suspendWhenHidden||"undefined"==typeof document||!document.hidden;g.current=new Na({clock:e.clock,random:e.random,seed:e.seed,paused:e.paused,visible:t})}const y=g.current;y.configure({clock:e.clock,random:e.random,seed:e.seed});const b=(0,_a.useRef)(null),v=(0,_a.useRef)(e.frameScheduler??Ea);v.current=e.frameScheduler??Ea;const x=(0,_a.useRef)(null),k=(0,_a.useRef)(!1),w=(0,_a.useRef)(()=>{}),S=(0,_a.useCallback)(()=>{if(null!==b.current||k.current)return;const e=v.current;let t=!1,o=!1;const n=e.requestAnimationFrame(()=>{t=!0;const e=!o;e&&(k.current=!0),b.current=null,x.current=null;try{w.current()}finally{e&&(k.current=!1)}});o=!0,t||(b.current=n,x.current=e)},[]),A=(0,_a.useCallback)(()=>{null!==b.current&&((x.current??v.current).cancelAnimationFrame(b.current),b.current=null,x.current=null)},[]);Da(()=>{y.setPaused(!0===e.paused)},[y,e.paused]),(0,_a.useEffect)(()=>{if(!e.suspendWhenHidden||"undefined"==typeof document)return void y.setVisible(!0);const t=()=>y.setVisible(!document.hidden);return t(),document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},[y,e.suspendWhenHidden]),(0,_a.useEffect)(()=>()=>{A()},[A]);const C=(0,_a.useRef)(()=>{}),M=(0,_a.useRef)(()=>{}),_=(0,_a.useRef)(null),j=(0,_a.useRef)(null),R=(0,_a.useRef)(null),P=(0,_a.useCallback)(()=>{const e=_.current;_.current=null,e&&C.current(e)},[]),L=(0,_a.useCallback)(e=>{if(_.current={clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType},null===j.current){const e=v.current;let t=!1;const o=e.requestAnimationFrame(()=>{t=!0,j.current=null,R.current=null,P()});t||(j.current=o,R.current=e)}},[P]),T=(0,_a.useCallback)(()=>{_.current=null,null!==j.current&&((R.current??v.current).cancelAnimationFrame(j.current),j.current=null,R.current=null),M.current()},[]);(0,_a.useEffect)(()=>()=>{_.current=null,null!==j.current&&((R.current??v.current).cancelAnimationFrame(j.current),j.current=null,R.current=null)},[]);const I=e.themeDirtyRef;return Da(()=>{I&&(ln++,I.current=!0,S())},[h,S,I]),{reducedMotion:t,reducedMotionRef:o,responsiveRef:n,size:r,margin:a,adjustedWidth:l,adjustedHeight:c,resolvedForeground:u,resolvedBackground:d,currentTheme:h,transition:f,introEnabled:p,tableId:m,frameRuntime:y,rafRef:b,renderFnRef:w,scheduleRender:S,cancelRender:A,hoverHandlerRef:C,hoverLeaveRef:M,onPointerMove:L,onPointerLeave:T}}var Ha=require("react"),Oa=require("react/jsx-runtime");function za(e,t){return function(e){const{cancelRender:t,dirtyRef:o,frameRuntime:n,manageFrameRuntime:r,scheduleRender:i}=e,s=(0,Ha.useRef)(null),a=(0,Ha.useRef)(null),l=(0,Ha.useRef)(!1);return function(e){const{hydrated:t,wasHydratingFromSSR:o,storeRef:n,dirtyRef:r,renderFnRef:i,cancelRender:s,cleanup:a}=e;ds(()=>{t&&o&&n.current?.cancelIntroAnimation?.(),r.current=!0,s?.(),i.current()},[t,o]);const l=(0,us.useRef)(a);l.current=a,(0,us.useEffect)(()=>()=>l.current?.(),[])}({hydrated:e.hydrated,wasHydratingFromSSR:e.wasHydratingFromSSR,storeRef:e.storeRef,dirtyRef:e.dirtyRef,renderFnRef:e.renderFnRef,cancelRender:e.cancelRender,cleanup:e.cleanup}),(0,Ha.useEffect)(()=>{if(!1!==r)return n.subscribe(()=>{n.isActive?(o.current=!0,i()):t()})},[t,o,n,r,i]),(0,Ha.useEffect)(()=>{!l.current&&(l.current=!0,e.skipInitialCanvasPaintInvalidation)||(e.dirtyRef.current=!0,e.scheduleRender())},e.canvasPaintDependencies),{canvasRef:s,interactionCanvasRef:a}}({...t,renderFnRef:e.renderFnRef,scheduleRender:e.scheduleRender,cancelRender:e.cancelRender,frameRuntime:e.frameRuntime})}function Wa({children:e,size:t,margin:o,overflowVisible:n=!1}){return e?(0,Oa.jsx)("svg",{style:{position:"absolute",left:0,top:0,width:t[0],height:t[1],pointerEvents:"none",overflow:n?"visible":void 0},children:(0,Oa.jsx)("g",{transform:`translate(${o.left},${o.top})`,children:e})}):null}function qa(e,t,o,n){const r=n.current,i=!0===e.lastCustomLayoutFailure?.preservedLastGoodScene,s=!i&&e.hasActivePulsesAt(t),a=!(o||i||!s&&!r)&&e.refreshPulse(t);return n.current=s,{changed:a,pending:s}}function Ya(e,t,o,n){return"function"==typeof e?e({size:t,margin:o,scales:n}):e}function Ga(e,t,o,n){const r=e.getContext("2d");if(!r)return null;const i=Math.round(t[0]*n),s=Math.round(t[1]*n),a=i/t[0],l=s/t[1],c=t[0]+"px",u=t[1]+"px";return e.style.width!==c&&(e.style.width=c),e.style.height!==u&&(e.style.height=u),e.width===i&&e.height===s||(e.width=i,e.height=s),r.setTransform(a,0,0,l,0,0),r.translate(o.left,o.top),r}function Va(){if("undefined"==typeof window)return 1;const e=window.devicePixelRatio||1,t=function(){if("undefined"==typeof window)return!1;const e="function"==typeof window.matchMedia&&window.matchMedia("(pointer: coarse)").matches,t=768>Math.min(window.innerWidth||1/0,window.innerHeight||1/0);return e||t}()?2:3;return Math.max(1,Math.min(e,t))}var Xa=require("react");function Ua(e,t,o,n){const r=(0,Xa.useRef)({accessor:t,onChange:o,readData:n}),i=(0,Xa.useRef)([]);return r.current={accessor:t,onChange:o,readData:n},(0,Xa.useCallback)(()=>{const{accessor:t,onChange:o,readData:n}=r.current;if(!o||!t)return;const s=function(e,t){if(!t)return[];const o=new Set,n=[];for(const r of e){if(!r||"object"!=typeof r)continue;const e="function"==typeof t?t(r):r[t];if(null==e)continue;const i=e+"";o.has(i)||(o.add(i),n.push(i))}return n}(e.current?n(e.current):[],t);(function(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})(s,i.current)||(i.current=s,o(s))},[e])}function Ka(e,t,o,n){return"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:o,fn:e}:"string"==typeof t?{key:t,fn:null}:"function"==typeof t?{key:n,fn:t}:{key:void 0,fn:null}}function Za(e,t,o){return n=>{if(!n||!o||!e.fn&&!t.fn)return n;let r=!1;const i=n.map(o=>{const n=e.fn&&e.key&&!(e.key in o),i=t.fn&&t.key&&!(t.key in o);if(!n&&!i)return o;r=!0;const s={...o};return n&&(s[e.key]=e.fn(o)),i&&(s[t.key]=t.fn(o)),s});return r?i:n}}var Qa=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Ja=3156e7;function el(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")}`}:Ja>t?e=>{const t=new Date(e);return`${Qa[t.getUTCMonth()]} ${t.getUTCDate()}`}:5*Ja>t?e=>{const t=new Date(e);return`${Qa[t.getUTCMonth()]} ${t.getUTCFullYear()}`}:e=>new Date(e).getUTCFullYear()+""}function tl(e){if(!e)return;const t=[];for(const o of e)if("point"===o.type)t.push(o);else if("symbol"===o.type)t.push({pointId:o.pointId,x:o.x,y:o.y,r:Lt(o.size)});else if("glyph"===o.type){const e=on(o.glyph,o.size);t.push({pointId:o.pointId,x:o.x+e.centerDx,y:o.y+e.centerDy,r:e.radius})}return t}var ol=require("d3-shape");function nl(e,t,o){let n=o;for(const o of t)"lesser"===o.thresholdType?o.value>e&&(n=o.color):e>o.value&&(n=o.color);return n}function rl(e,t,o,n,r,i){if(2>t.length)return;const s=[0];for(let e=1;t.length>e;e++){const o=t[e][0]-t[e-1][0],n=t[e][1]-t[e-1][1];s.push(s[e-1]+Math.sqrt(o*o+n*n))}const a=s[s.length-1];if(0===a)return;const l=Math.min(.2*a,40);e.strokeStyle=o,e.lineWidth=n,e.lineCap=i;for(let o=0;t.length-1>o;o++){const n=(s[o]+s[o+1])/2;let i=r;l>n&&(i*=n/l),l>a-n&&(i*=(a-n)/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 il=(e,t,o,n)=>{const r=t.filter(e=>"line"===e.type);for(const t of r){if(2>t.path.length)continue;const o=t._introClipFraction;void 0!==o&&1>o&&(e.save(),e.beginPath(),e.rect(0,0,n.width*o,n.height),e.clip());const r=t.style.stroke||"#007bff",i=hn(e,r)||r,s=t.style.strokeWidth||2,a=t.colorThresholds,l=t.rawValues;if(e.setLineDash(t.style.strokeDasharray?t.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),e.lineWidth=s,e.lineCap=t.style.strokeLinecap||"butt",t.style._edgeFade){rl(e,t.path,i,s,t.style.opacity??1,t.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const c=An(t.curve),u=a&&a.length>0&&l&&l.length===t.path.length,d=t._decayOpacities;if(d&&d.length===t.path.length&&!u){e.strokeStyle=i;const o=t.style.opacity??1;for(let n=0;t.path.length-1>n;n++)e.globalAlpha=.5*(d[n]+d[n+1])*o,e.beginPath(),e.moveTo(t.path[n][0],t.path[n][1]),e.lineTo(t.path[n+1][0],t.path[n+1][1]),e.stroke()}else if(u){let o=function(t,o,n){e.beginPath(),e.strokeStyle=t,e.moveTo(o,n),d=!0},n=function(){d&&(e.stroke(),d=!1)},r=null,s=null,c=null,u=null,d=!1;for(let d=0;t.path.length>d;d++){const[h,f]=t.path[d],p=l[d],m=nl(p,a,i);if(null!==r&&null!==u&&null!==c){if(m===u)e.lineTo(h,f);else{const t=[];for(const e of a){const o=e.value;(c>o||o>p)&&(o>c||p>o)||c===o||p===o||t.push({t:(o-c)/(p-c)})}t.sort((e,t)=>e.t-t.t);for(const l of t){const t=r+(h-r)*l.t,u=s+(f-s)*l.t,d=nl(c+(p-c)*Math.min(l.t+1e-4,1),a,i);e.lineTo(t,u),n(),o(d,t,u)}e.lineTo(h,f)}r=h,s=f,c=p,u=m}else o(m,h,f),r=h,s=f,c=p,u=m}n()}else{e.beginPath();const o=t.strokeGradient&&t.path.length>=2?jn(e,t.strokeGradient,t.path[0][0],0,t.path[t.path.length-1][0],0):null;if(e.strokeStyle=o||i,c)(0,ol.line)().x(e=>e[0]).y(e=>e[1]).curve(c).context(e)(t.path);else{const[o,n]=t.path[0];e.moveTo(o,n);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=Cn(e,t.style.fill,t.style.fill),c&&!u)(0,ol.line)().x(e=>e[0]).y(e=>e[1]).curve(c).context(e)(t.path);else{const[o,n]=t.path[0];e.moveTo(o,n);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],n.height),e.lineTo(o,n.height),e.closePath(),e.fill()}void 0!==o&&1>o&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}};function sl(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function al(e,t,o=.3){sl(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 ll(e,t,o=.6){if(!sl(t))return;const n=t.r+(t._pulseGlowRadius??4)*t._pulseIntensity,r=t.cx??t.x??0,i=t.cy??t.y??0;e.beginPath(),e.arc(r,i,n,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 cl(e,t,o,n=.35){sl(t)&&(e.globalAlpha=t._pulseIntensity*n,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",o?e.fill(o):e.fill())}var ul=require("d3-shape");function dl(e,t){const o=An(t.curve);if(!o||2>t.topPath.length||2>t.bottomPath.length){e.beginPath(),e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let o=1;t.topPath.length>o;o++)e.lineTo(t.topPath[o][0],t.topPath[o][1]);for(let o=t.bottomPath.length-1;o>=0;o--)e.lineTo(t.bottomPath[o][0],t.bottomPath[o][1]);e.closePath()}else{const n=(0,ul.area)().x(e=>e[0]).y0((e,o)=>t.bottomPath[o][1]).y1(e=>e[1]).curve(o).context(e);e.beginPath(),n(t.topPath)}}var hl=(e,t,o,n)=>{const r=t.filter(e=>"area"===e.type);for(const t of r){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 r=t._introClipFraction;void 0!==r&&1>r&&(e.save(),e.beginPath(),e.rect(0,0,n.width*r,n.height),e.clip());const i=Cn(e,t.style.fill,"#4e79a7"),s=t._decayOpacities;if(s&&s.length===t.topPath.length){const o=t.style.fillOpacity??.7;e.fillStyle=i;for(let n=0;t.topPath.length-1>n;n++)e.globalAlpha=.5*(s[n]+s[n+1])*o,e.beginPath(),e.moveTo(t.topPath[n][0],t.topPath[n][1]),e.lineTo(t.topPath[n+1][0],t.topPath[n+1][1]),e.lineTo(t.bottomPath[n+1][0],t.bottomPath[n+1][1]),e.lineTo(t.bottomPath[n][0],t.bottomPath[n][1]),e.closePath(),e.fill();if(t.style.stroke&&"none"!==t.style.stroke){e.strokeStyle=hn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);for(let o=0;t.topPath.length-1>o;o++)e.globalAlpha=.5*(s[o]+s[o+1]),e.beginPath(),e.moveTo(t.topPath[o][0],t.topPath[o][1]),e.lineTo(t.topPath[o+1][0],t.topPath[o+1][1]),e.stroke()}e.globalAlpha=1;continue}const a=t.style.opacity??1;if(dl(e,t),t.fillGradient&&("colorStops"in t.fillGradient&&t.fillGradient.colorStops.length>=2||"topOpacity"in t.fillGradient)&&t.fillGradient){let o=1/0;for(const e of t.topPath)o>e[1]&&(o=e[1]);let n=-1/0;for(const e of t.bottomPath)e[1]>n&&(n=e[1]);const r=_n(e,t.fillGradient,"string"==typeof i?i:"#4e79a7",0,o,0,n);e.fillStyle=r||i,e.globalAlpha=a}else e.globalAlpha=(t.style.fillOpacity??.7)*a,e.fillStyle=i;if(e.fill(),t._pulseIntensity&&t._pulseIntensity>0&&(dl(e,t),cl(e,t)),t.style.stroke&&"none"!==t.style.stroke){e.globalAlpha=a;const o=t.strokeGradient&&t.topPath.length>=2?jn(e,t.strokeGradient,t.topPath[0][0],0,t.topPath[t.topPath.length-1][0],0):null;e.strokeStyle=o||hn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);const n=An(t.curve);if(e.beginPath(),n)(0,ul.line)().x(e=>e[0]).y(e=>e[1]).curve(n).context(e)(t.topPath);else{e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let o=1;t.topPath.length>o;o++)e.lineTo(t.topPath[o][0],t.topPath[o][1])}e.stroke()}void 0!==r&&1>r&&e.restore(),o&&e.restore(),e.globalAlpha=1}},fl=(e,t,o,n)=>{const r=t.filter(e=>"point"===e.type);if(0!==r.length){e.save();try{const t=e.globalAlpha;for(const o of r)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=Cn(e,o.style.fill,"#4e79a7"),e.fill(),o.style.stroke&&(e.strokeStyle=Cn(e,o.style.stroke,o.style.stroke),e.lineWidth=o.style.strokeWidth||1,e.stroke()),ll(e,o)}finally{e.restore()}}},pl=new Map;function ml(e){try{if(e.path)return new Path2D(e.path);const t=`${e.symbolType??"circle"}:${Math.round(e.size)}`;let o=pl.get(t);return o||(o=new Path2D(Pt(e.symbolType,e.size)),pl.size>256&&pl.clear(),pl.set(t,o)),o}catch{return null}}var gl=(e,t)=>{const o=e.globalAlpha;for(const n of t){if("symbol"!==n.type)continue;const t=n;if(0>=t.size)continue;const r=ml(t);if(!r)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=Cn(e,t.style.fill,"#4e79a7"),e.fill(r)),t.style.stroke&&"none"!==t.style.stroke&&(e.globalAlpha=o*i,e.strokeStyle=Cn(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth??1,e.stroke(r)),e.restore()}e.globalAlpha=o};function yl(e,t,o,n,r){if(0>=t.size)return;const i=t.glyph;if(!i||!i.parts?.length)return;const s=Zo(i,t.size);if(0>=s.scale)return;const a=(t.style.opacity??1)*(t._decayOpacity??1);if(0>=a)return;const l=t=>{const o=Cn(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,n),t.rotation&&e.rotate(t.rotation),e.translate(s.offsetX,s.offsetY),e.scale(s.scale,s.scale),e.globalAlpha=r*a*(t.style.fillOpacity??1);const u=tn(i,t.fraction??1,t.fractionStart??0,t.fractionDirection??"horizontal");u&&t.ghostColor&&nn(e,i,c,t.accent,t.ghostColor,l),u&&(e.beginPath(),e.rect(u.x,u.y,u.width,u.height),e.clip()),nn(e,i,c,t.accent,void 0,l),e.restore()}var bl=(e,t)=>{const o=e.globalAlpha;for(const n of t)"glyph"===n.type&&yl(e,n,n.x,n.y,o);e.globalAlpha=o};function vl(e,t){const{x:o,y:n,w:r,h:i}=t,{tl:s,tr:a,br:l,bl:c}=Ji(t);e.beginPath(),e.moveTo(o+s,n),e.lineTo(o+r-a,n),a>0&&e.arcTo(o+r,n,o+r,n+a,a),e.lineTo(o+r,n+i-l),l>0&&e.arcTo(o+r,n+i,o+r-l,n+i,l),e.lineTo(o+c,n+i),c>0&&e.arcTo(o,n+i,o,n+i-c,c),e.lineTo(o,n+s),s>0&&e.arcTo(o,n,o+s,n,s),e.closePath()}function xl(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 kl=(e,t,o,n)=>{const r=t.filter(e=>"rect"===e.type);for(const t of r){if(null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon)wl(e,t);else if(t.cornerRadii&&Qi(t.cornerRadii)){const o=Cn(e,t.style.fill,hn(e,"var(--semiotic-primary, #007bff)")),n=xl(t),r=t.fillGradient&&"string"==typeof o?_n(e,t.fillGradient,o,n.x0,n.y0,n.x1,n.y1):null;e.fillStyle=r||o,vl(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=hn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else if(t.roundedTop&&t.roundedTop>0){const o=Cn(e,t.style.fill,hn(e,"var(--semiotic-primary, #007bff)")),n=xl(t),r=t.fillGradient&&"string"==typeof o?_n(e,t.fillGradient,o,n.x0,n.y0,n.x1,n.y1):null;e.fillStyle=r||o;const i=Math.min(t.roundedTop,t.w/2,t.h/2);e.beginPath();const{x:s,y:a,w:l,h:c}=t;switch(t.roundedEdge){case"right":e.moveTo(s,a),e.lineTo(s+l-i,a),e.arcTo(s+l,a,s+l,a+i,i),e.lineTo(s+l,a+c-i),e.arcTo(s+l,a+c,s+l-i,a+c,i),e.lineTo(s,a+c);break;case"left":e.moveTo(s+l,a),e.lineTo(s+i,a),e.arcTo(s,a,s,a+i,i),e.lineTo(s,a+c-i),e.arcTo(s,a+c,s+i,a+c,i),e.lineTo(s+l,a+c);break;case"bottom":e.moveTo(s,a),e.lineTo(s+l,a),e.lineTo(s+l,a+c-i),e.arcTo(s+l,a+c,s+l-i,a+c,i),e.lineTo(s+i,a+c),e.arcTo(s,a+c,s,a+c-i,i);break;default:e.moveTo(s,a+c),e.lineTo(s,a+i),e.arcTo(s,a,s+i,a,i),e.lineTo(s+l-i,a),e.arcTo(s+l,a,s+l,a+i,i),e.lineTo(s+l,a+c)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=hn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const o=Cn(e,t.style.fill,hn(e,"var(--semiotic-primary, #007bff)")),n=xl(t),r=t.fillGradient&&"string"==typeof o?_n(e,t.fillGradient,o,n.x0,n.y0,n.x1,n.y1):null;e.fillStyle=r||o,e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=hn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}al(e,t),e.globalAlpha=1}};function wl(e,t){const o=t.style.icon,n=t.style.iconPadding||2,r=Math.min(t.w,t.h)-n;if(0>=r)return;const i=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),i){const i=r+n,s=t.x+(t.w-r)/2;for(let n=t.y+t.h-r;n>=t.y-r;n-=i)e.drawImage(o,s,n,r,r)}else{const i=r+n,s=t.y+(t.h-r)/2;for(let n=t.x;t.x+t.w>n;n+=i)e.drawImage(o,n,s,r,r)}e.restore()}function Sl(e){const[t,o,n]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(e);return.299*t+.587*o+.114*n>128?"#000":"#fff"}function Al(e){return Number.isInteger(e)?e+"":100>Math.abs(e)?1>Math.abs(e)?e.toPrecision(3):e.toFixed(1):e.toFixed(0)}var Cl=(e,t,o,n)=>{const r=t.filter(e=>"heatcell"===e.type);e.save();try{for(const t of r){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=hn(e,"var(--semiotic-surface, #fff)"),e.lineWidth=1,e.strokeRect(t.x,t.y,t.w,t.h),al(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):Al(t.value),n=Math.max(10,Math.min(16,.3*Math.min(t.w,t.h))),r=t.x+t.w/2,i=t.y+t.h/2;e.fillStyle=Sl(t.fill),e.font=n+"px sans-serif",e.textAlign="center",e.textBaseline="middle",e.fillText(o,r,i)}}}finally{e.restore()}},Ml=(e,t,o,n)=>{for(const o of t){if("candlestick"!==o.type)continue;const t=o;e.save();const r=(t._decayOpacity??1)*(t.style?.opacity??1);1!==r&&(e.globalAlpha=r);const i=hn(e,t.wickColor)||t.wickColor,s=60>n.height,a=s?Math.max(t.wickWidth,2):t.wickWidth,l=()=>{e.beginPath(),e.moveTo(t.x,t.highY),e.lineTo(t.x,t.lowY),e.strokeStyle=i,e.lineWidth=a,e.stroke()};if(s||l(),t.isRange){const o=Math.max(2,Math.min(t.bodyWidth/2,.12*n.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),n=Math.abs(t.openY-t.closeY),r=t.isUp?t.upColor:t.downColor,i=hn(e,r)||r;e.fillStyle=i,e.fillRect(t.x-t.bodyWidth/2,o,t.bodyWidth,Math.max(n,1)),e.strokeStyle=i,e.lineWidth=1,e.strokeRect(t.x-t.bodyWidth/2,o,t.bodyWidth,Math.max(n,1))}s&&l(),e.restore()}},_l={line:[hl,il,fl],area:[hl,fl],stackedarea:[hl,fl],scatter:[fl,gl],bubble:[fl,gl],heatmap:[Cl],bar:[kl],swarm:[fl],waterfall:[(e,t,o,n)=>{kl(e,t);const r=t.filter(e=>"rect"===e.type);if(2>r.length)return;const i=r[0].datum,s=i?._connectorStroke;if(s){e.save(),e.strokeStyle=hn(e,s)||s,e.lineWidth=i?._connectorWidth??1,e.setLineDash([]);for(let t=0;r.length-1>t;t++){const n=r[t],i=r[t+1],s=n.datum,a=i.datum;if(null==s?.cumEnd||null==a?.baseline)continue;const l=o.y(s.cumEnd),c=n.x+n.w,u=i.x;e.beginPath(),e.moveTo(c,l),e.lineTo(u,l),e.stroke()}e.restore()}}],candlestick:[Ml],mixed:[hl,il,fl],custom:[hl,kl,Cl,il,fl,gl,bl,Ml]},jl=new Set;function Rl(e,t){const o="function"==typeof e?e(t.datum??null,t):e;return(n=o)&&"object"==typeof n&&"string"==typeof n.id&&"function"==typeof n.cacheKey&&"function"==typeof n.drawCanvas&&"function"==typeof n.renderStaticSVG?o:void 0;var n}function Pl(e,t){if("undefined"!=typeof process&&"production"===process.env?.NODE_ENV)return;const o=`${e}:${t}`;jl.has(o)||(jl.add(o),console.warn(`[Semiotic] Render backend "${e}" does not support scene node "${t}"; using the built-in renderer.`))}function Ll(e){const{context:t,nodes:o,renderMode:n,pixelRatio:r,paintBuiltIn:i}=e;if(!n||"sketchy"===n)return void i(o);let s=[];const a=()=>{s.length&&(i(s),s=[])};for(const e of o){const o=Rl(n,e);if(!o){s.push(e);continue}let l;a(),t.save();try{l=o.drawCanvas({context:t,node:e,style:e.style??{},pixelRatio:r})}finally{t.restore()}l||(Pl(o.id,e.type??"unknown"),i([e]))}a()}function Tl(e){const{node:t,index:o,renderMode:n,fallback:r}=e,i=Rl(n,t);if(!i)return r();const s=i.renderStaticSVG({node:t,style:t.style??{},key:`${i.id}-${o}`});return null!=s?s:(Pl(i.id,t.type??"unknown"),r())}var Il=require("react/jsx-runtime");function $l(e){return"string"==typeof e?e:"value"}function Nl(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function Dl(e,t){if(!t)return Nl(e);try{const o=t(e);return null==o?Nl(e):o}catch{return Nl(e)}}function El(e,t){return"function"==typeof t?t(e):e[t]}function Bl(e,t){if(!e)return[];const o=[];return(Array.isArray(e)?e:[e]).forEach((e,n)=>{const r="string"==typeof e?.y0Accessor?e.y0Accessor:"low",i="string"==typeof e?.y1Accessor?e.y1Accessor:"high";o.push({label:r,accessor:e=>e.bands?.[n]?.y0??(0===n?e.band?.y0:void 0),format:t}),o.push({label:i,accessor:e=>e.bands?.[n]?.y1??(0===n?e.band?.y1:void 0),format:t})}),o}function Fl(e){const t=e.find(e=>"title"===e.role),o=e.filter(e=>"title"!==e.role);return e=>{const n=e.data;if(!n)return null;const r=t?Dl(El(n,t.accessor),t.format):null;return(0,Il.jsxs)("div",{className:"semiotic-tooltip",style:ya,children:[null!=r&&(0,Il.jsx)("div",{style:{fontWeight:"bold",marginBottom:o.length>0?4:0},children:r}),o.map((e,t)=>{const o=Dl(El(n,e.accessor),e.format);return(0,Il.jsxs)("div",{style:t>0?{marginTop:2}:void 0,children:[(0,Il.jsxs)("span",{style:{opacity:.7},children:[e.label,": "]}),(0,Il.jsx)("span",{children:o})]},t)})]})}}function Hl({categoryAccessor:e,valueAccessor:t,groupAccessor:o,groupLabel:n,pieData:r=!1,valueFormat:i}){return s=>{const a=r?s.data?.[0]||s.data||s:s.data||s,l=El(a,e),c=El(a,t),u=o?El(a,o):void 0;return(0,Il.jsxs)("div",{className:"semiotic-tooltip",style:ya,children:[(0,Il.jsx)("div",{style:{fontWeight:"bold"},children:Nl(l)}),(0,Il.jsx)("div",{style:{marginTop:4},children:Dl(c,i)}),null!=u&&(0,Il.jsxs)("div",{style:{marginTop:2,opacity:.8},children:[n||$l(o),": ",Nl(u)]})]})}}var Ol=require("react/jsx-runtime");function zl(e){return null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+""}function Wl({hover:e}){const t=e.data??{},o=t.y??t.value,n=t.x??t.time;if(void 0===o&&void 0===n){const e=ma(t);if(null!=e.title||e.entries.length>0)return(0,Ol.jsxs)("div",{className:"semiotic-tooltip",style:ya,children:[null!=e.title&&(0,Ol.jsx)("div",{style:{fontWeight:600,marginBottom:e.entries.length?2:0},children:e.title+""}),e.entries.map(e=>(0,Ol.jsxs)("div",{style:{opacity:.7,fontSize:11},children:[e.key,":"," ",(0,Ol.jsx)("span",{style:{fontWeight:600},children:zl(e.value)})]},e.key))]})}return(0,Ol.jsxs)("div",{className:"semiotic-tooltip",style:ya,children:[(0,Ol.jsx)("div",{style:{fontWeight:600,marginBottom:2},children:zl(o)}),(0,Ol.jsx)("div",{style:{opacity:.7,fontSize:11},children:zl(n)})]})}function ql(e){return"touch"===e?"touch":"pointer"}function Yl(e){const t=e.target;return t instanceof Element&&t!==e.currentTarget&&null!=t.closest("button, a[href], input, select, textarea, summary, [contenteditable='true'], [role='button'], [role='link'], [role='checkbox'], [role='radio'], [role='switch']")}function Gl(e){const{onObservation:t,datum:o,x:n=0,y:r=0,chartType:i,chartId:s,context:a,timestamp:l=Date.now()}=e;t&&(o?(t({type:"hover",datum:o,x:n,y:r,timestamp:l,chartType:i,chartId:s}),"focus"===a?.type&&t({type:"focus",datum:o,inputType:"touch"===a.inputType?"pointer":a.inputType,timestamp:l,chartType:i,chartId:s})):t({type:"hover-end",timestamp:l,chartType:i,chartId:s}))}function Vl(e){const{onObservation:t,datum:o,x:n=0,y:r=0,chartType:i,chartId:s,context:a,timestamp:l=Date.now()}=e;t&&(o?(t({type:"click",datum:o,x:n,y:r,timestamp:l,chartType:i,chartId:s}),"activate"===a?.type&&t({type:"activate",datum:o,inputType:a.inputType,timestamp:l,chartType:i,chartId:s})):t({type:"click-end",timestamp:l,chartType:i,chartId:s}))}Wl.ownsChrome=!0;var Xl=require("react");function Ul({customHoverBehavior:e,customClickBehavior:t,onObservation:o,chartId:n,chartType:r}){return{customHoverBehavior:(0,Xl.useCallback)((t,i)=>{e?.(t,i),Gl({onObservation:o,datum:t?t.data||t:null,x:t?.x,y:t?.y,chartType:r,chartId:n,context:i})},[n,r,e,o]),customClickBehavior:(0,Xl.useCallback)((e,i)=>{t?.(e,i),Vl({onObservation:o,datum:e?e.data||e:null,x:e?.x,y:e?.y,chartType:r,chartId:n,context:i})},[n,r,t,o]),hasClickBehavior:!(!t&&!o)}}var Kl=require("react");function Zl(e){const t=new Map;for(const o of e){const e=o.group??"_default";let n=t.get(e);n||(n=[],t.set(e,n)),n.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 n=t.get(e),r=t.get(o);return(n.length>0?n[0].y:0)-(r.length>0?r[0].y:0)}),n=Array.from(t.values()).flat();n.sort((e,t)=>e.x-t.x||e.y-t.y);const r=new Map;for(let e=0;n.length>e;e++){n[e]._flatIndex=e;const t=n[e].datum?.id;null!=t&&r.set(t+"",e)}return{flat:n,groups:o,byGroup:t,idToIdx:r}}function Ql(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)),n=e.flat[o];return{flatIndex:o,group:n.group??"_default",indexInGroup:n._groupIndex??0}}function Jl(e,t,o){const{group:n,indexInGroup:r}=t,i=o.byGroup.get(n);switch(e){case"ArrowRight":return i.length-1>r?i[r+1]._flatIndex:t.flatIndex;case"ArrowLeft":return r>0?i[r-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=o.groups.indexOf(n);return o.groups.length-1>e?ec(o,o.groups[e+1],i[r]):t.flatIndex}case"ArrowUp":{const e=o.groups.indexOf(n);return e>0?ec(o,o.groups[e-1],i[r]):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 ec(e,t,o){const n=e.byGroup.get(t);let r=0,i=Math.abs(n[0].x-o.x);for(let e=1;n.length>e;e++){const t=Math.abs(n[e].x-o.x);i>t&&(i=t,r=e)}return n[r]._flatIndex}function tc(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=on(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,n=Array.isArray(e.datum)?e.datum:[],r=e.group??"_default";for(let o=0;e.path.length>o&&n.length>o;o++)t.push({x:e.path[o][0],y:e.path[o][1],datum:n[o],shape:"circle",group:r});break}case"area":{const e=o,n=Array.isArray(e.datum)?e.datum:[],r=e.group??"_default";for(let o=0;e.topPath.length>o&&n.length>o;o++)t.push({x:e.topPath[o][0],y:e.topPath[o][1],datum:n[o],shape:"circle",group:r});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}function oc(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=on(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,n=((o.innerRadius||0)+(o.outerRadius||50))/2;t.push({x:o.cx+Math.cos(e)*n,y:o.cy+Math.sin(e)*n,datum:o.datum,shape:"wedge",group:"_default"})}return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}function nc(e){return"object"==typeof e&&null!==e&&"id"in e?e.id:e}function rc(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}function ic({storeRef:e,hoverRef:t,hoveredNodeRef:o,setHoverPoint:n,customHoverBehavior:r,customClickBehavior:i,scheduleRender:s,extractPoints:a,toHover:l}){const c=(0,Kl.useRef)(-1),u=(0,Kl.useRef)(null),d=(0,Kl.useRef)(null),h=(0,Kl.useCallback)(h=>{if(Yl(h))return;const f=e.current;if(!f)return;const p=()=>{c.current=-1,u.current=null,t.current=null,o&&(o.current=null),n(null),r(null),s()};if(0===f.scene.length)return void(0>c.current||p());let m;if(d.current?.version===f.version)m=d.current.graph;else{const e=a(f.scene);if(0===e.length)return void(0>c.current||p());m=Zl(e),d.current={version:f.version,graph:m}}let g=c.current;if(m.flat.length>g||(p(),g=-1),("Enter"===h.key||" "===h.key)&&g>=0)return h.preventDefault(),void i(l(m.flat[g],f),{type:"activate",inputType:"keyboard"});if(0>g){if("Escape"===h.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(h.key))return;h.preventDefault(),c.current=0;const e=m.flat[0];u.current=e;const o=l(e,f);return t.current=o,n(o),r(o,{type:"focus",inputType:"keyboard"}),void s()}const y=Jl(h.key,Ql(m,g),m);if(null===y)return;if(h.preventDefault(),0>y)return void p();c.current=y;const b=m.flat[y];u.current=b;const v=l(b,f);t.current=v,n(v),r(v,{type:"focus",inputType:"keyboard"}),s()},[i,r,a,t,o,s,n,e,l]);return{kbFocusIndexRef:c,focusedNavPointRef:u,onKeyDown:h}}var sc=require("react/jsx-runtime"),ac={top:20,right:20,bottom:30,left:40},lc=Ss;function cc(e){if(e)return"x"===e.dimension?"pan-y":"y"===e.dimension?"pan-x":"none"}var uc=(0,j.memo)((0,j.forwardRef)(function(e,t){const{chartType:o,runtimeMode:n,data:r,chunkThreshold:i,chunkSize:s,xAccessor:a,yAccessor:l,accessorRevision:c,colorAccessor:u,sizeAccessor:d,symbolAccessor:h,symbolMap:f,groupAccessor:p,lineDataAccessor:m,curve:g,normalize:y,baseline:b,stackOrder:v,binSize:x,valueAccessor:k,arrowOfTime:w="right",windowMode:S="sliding",windowSize:A=200,timeAccessor:C,xExtent:M,yExtent:R,extentPadding:P=.1,scalePadding:L,sizeRange:T,size:I=[500,300],responsiveWidth:$,responsiveHeight:N,margin:D,className:E,background:F,renderMode:z,lineStyle:W,pointStyle:q,areaStyle:Y,barStyle:V,waterfallStyle:X,swarmStyle:U,barColors:K,colorScheme:Z,boundsAccessor:Q,boundsStyle:J,y0Accessor:ee,band:te,gradientFill:oe,lineGradient:ne,areaGroups:re,openAccessor:ie,highAccessor:se,lowAccessor:ae,closeAccessor:le,candlestickStyle:ce,showAxes:ue=!0,axes:de,xLabel:he,yLabel:fe,yLabelRight:pe,xFormat:me,yFormat:ge,axisExtent:ye,tickFormatTime:be,tickFormatValue:ve,hoverAnnotation:xe,tooltipContent:ke,customHoverBehavior:we,customClickBehavior:Se,onObservation:Ae,annotationObservationCallback:Ce,chartId:Me,enableHover:_e,hoverRadius:je=30,tooltipMode:Re,annotations:Pe,onAnnotationActivate:Le,autoPlaceAnnotations:Te,svgAnnotationRules:Ie,showGrid:$e,legend:Ne,legendHoverBehavior:De,legendClickBehavior:Ee,legendHighlightedCategory:Be,legendIsolatedCategories:Fe,legendPosition:He,legendLayout:Oe,legendCategoryAccessor:ze,onCategoriesChange:We,backgroundGraphics:qe,foregroundGraphics:Ye,canvasPreRenderers:Ge,svgPreRenderers:Ve,title:Xe,categoryAccessor:Ue,brush:Ke,onBrush:Ze,decay:Qe,pulse:Je,transition:et,animate:tt,staleness:ot,frameScheduler:nt,clock:rt,random:it,seed:st,paused:at=!1,suspendWhenHidden:lt=!0,heatmapAggregation:ct,heatmapXBins:ut,heatmapYBins:dt,showValues:ht,heatmapValueFormat:ft,marginalGraphics:pt,pointIdAccessor:mt,xScaleType:gt,yScaleType:yt,accessibleTable:bt=!0,description:vt,summary:xt,linkedCrosshairName:kt,linkedCrosshairSourceId:St,customLayout:At,onLayoutError:Ct,layoutConfig:Mt,layoutSelection:_t}=e,{customHoverBehavior:jt,customClickBehavior:Rt,hasClickBehavior:Pt}=Ul({customHoverBehavior:we,customClickBehavior:Se,onObservation:Ae,chartId:Me,chartType:"StreamXYFrame"}),Lt=(0,j.useId)().replace(/:/g,""),Tt=(0,j.useRef)(!1),It=(0,j.useRef)({w:-1,h:-1}),$t=(0,j.useRef)(!1),Nt=Fa({sizeProp:I,responsiveWidth:$,responsiveHeight:N,userMargin:D,marginDefault:ac,title:Xe,legend:Ne,legendPosition:He,animate:tt,transitionProp:et,frameScheduler:nt,clock:rt,random:it,seed:st,paused:at,suspendWhenHidden:lt,themeDirtyRef:Tt}),Dt=hs(),Et=gs(),{reducedMotionRef:Bt,responsiveRef:Ft,size:Ht,currentTheme:Ot,transition:zt,introEnabled:Wt,tableId:qt,rafRef:Yt,renderFnRef:Gt,scheduleRender:Vt,frameRuntime:Xt}=Nt;let Ut=Nt.margin;if(pt){const e=60,t={...Nt.margin};pt.top&&e>t.top&&(t.top=e),pt.bottom&&e>t.bottom&&(t.bottom=e),pt.left&&e>t.left&&(t.left=e),pt.right&&e>t.right&&(t.right=e),Ut=t}const Kt=Ht[0]-Ut.left-Ut.right,Zt=Ht[1]-Ut.top-Ut.bottom,Qt=(0,j.useMemo)(()=>H(r),[r]),Jt=xe??_e,[eo,to]=(0,j.useState)(0),oo=(0,j.useRef)(0),[no,ro]=(0,j.useState)(null),io=Ya(Ye,Ht,Ut,no),so=Ya(qe,Ht,Ut,no),ao=(0,j.useRef)(null),lo=(0,j.useRef)(null),co=(0,j.useRef)(void 0),[uo,ho]=(0,j.useState)(null),fo=(0,j.useRef)(lc.primary),po=(0,j.useRef)(function(){let e=-1,t=Ss;return{resolve(o){if(!o)return Ss;const n=ln;return n===e||(t=function(e){if(!e)return Ss;const t=getComputedStyle(e),o=t.getPropertyValue("--semiotic-border").trim(),n=t.getPropertyValue("--semiotic-text-secondary").trim(),r=t.getPropertyValue("--semiotic-bg").trim(),i=t.getPropertyValue("--semiotic-primary").trim(),s=n||t.getPropertyValue("--text-secondary").trim(),a=t.getPropertyValue("--text-primary").trim(),l=o||t.getPropertyValue("--surface-3").trim(),c=r||t.getPropertyValue("--surface-0").trim();return s||a||o||i?{axisStroke:l||Ss.axisStroke,tickText:s||Ss.tickText,crosshair:s?As(s,"66"):Ss.crosshair,hoverFill:c?As(c,"4D"):Ss.hoverFill,hoverStroke:s?As(s,"99"):Ss.hoverStroke,pointRing:c||Ss.pointRing,primary:i||Ss.primary,background:c||Ss.background}:Ss}(o),e=n),t},invalidate(){e=-1}}}()),mo=(0,j.useRef)(!1),go=Po("StreamXYFrame"),[yo,bo]=(0,j.useState)(!1),[vo,xo]=(0,j.useState)([]),[ko,So]=(0,j.useState)([]),Ao="streaming"===n||["bar","swarm","waterfall"].includes(o),Co=bs((0,j.useMemo)(()=>({chartType:o,runtimeMode:Ao?"streaming":"bounded",windowSize:A,windowMode:S,arrowOfTime:Ao?w:"right",extentPadding:P,scalePadding:L,axisExtent:ye,xAccessor:a,yAccessor:l,accessorRevision:c,timeAccessor:Ao?C:void 0,valueAccessor:k,colorAccessor:u,sizeAccessor:d,symbolAccessor:h,symbolMap:f,groupAccessor:p||(m?"_lineGroup":void 0),categoryAccessor:Ue,lineDataAccessor:m,xScaleType:gt,yScaleType:yt,xExtent:M,yExtent:R,sizeRange:T,binSize:x,normalize:y,baseline:b,stackOrder:v,boundsAccessor:Q,boundsStyle:J,y0Accessor:ee,band:te,gradientFill:!0===oe?{topOpacity:.8,bottomOpacity:.05}:!1===oe?void 0:oe,areaGroups:re?new Set(re):void 0,lineGradient:ne,openAccessor:ie,highAccessor:se,lowAccessor:ae,closeAccessor:le,candlestickStyle:ce,lineStyle:W,pointStyle:q,areaStyle:Y,swarmStyle:U,waterfallStyle:X,colorScheme:Z,barColors:K,barStyle:V,annotations:Pe,decay:Qe,pulse:Je,transition:zt,introAnimation:Wt,staleness:ot,clock:Xt.now,heatmapAggregation:ct,heatmapXBins:ut,heatmapYBins:dt,showValues:ht,heatmapValueFormat:ft,pointIdAccessor:mt,curve:g,themeCategorical:Ot?.colors?.categorical,themeSemantic:G(Ot),themeSequential:Ot?.colors?.sequential,themeDiverging:Ot?.colors?.diverging,customLayout:At,onLayoutError:Ct,layoutConfig:Mt,layoutMargin:Ut}),[o,Ao,A,S,w,P,L,ye,a,l,c,C,k,u,d,h,f,p,m,Ue,gt,yt,M,R,T,x,y,b,v,Q,J,ee,te,oe,re,ne,ie,se,ae,le,ce,W,q,Y,U,X,Z,K,V,Pe,Qe,Je,zt,Wt,ot,Xt.now,ct,ut,dt,ht,ft,mt,g,Ot,At,Ct,Mt,Ut])),Mo=(0,j.useRef)(null);Mo.current||(Mo.current=new wo(Co));const _o=Ua(Mo,ze,We,e=>e.getData());zo(Mo,Co,Tt,Vt),Wo(Mo,_t,Tt,Vt);const jo=(0,j.useRef)(null);jo.current||(jo.current=new O(e=>{const t=Mo.current;t&&t.ingest(e)&&(Tt.current=!0,Vt())},{chunkThreshold:i,chunkSize:s})),(0,j.useEffect)(()=>{jo.current?.updateChunkOptions({chunkThreshold:i,chunkSize:s})},[i,s]);const Ro=(0,j.useCallback)(e=>{jo.current?.push(e)},[]),To=(0,j.useCallback)(e=>{jo.current?.pushMany(e)},[]),$o=(0,j.useCallback)(()=>{jo.current?.clear(),Mo.current?.clear(),Tt.current=!0,Vt()},[Vt]);(0,j.useImperativeHandle)(t,()=>({push:Ro,pushMany:To,remove:e=>{jo.current?.flush();const t=Mo.current?.remove(e)??[];return t.length>0&&(ao.current&&t.some(e=>e===ao.current?.data)&&(ao.current=null,ho(null)),Tt.current=!0,Vt()),t},update:(e,t)=>{jo.current?.flush();const o=Mo.current?.update(e,t)??[];return o.length>0&&(Tt.current=!0,Vt()),o},clear:$o,getData:()=>(jo.current?.flush(),Mo.current?.getData()??[]),getScales:()=>Mo.current?.scales??null,getExtents:()=>Mo.current?.getExtents()??null,getCustomLayout:()=>Mo.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>Mo.current?.lastCustomLayoutFailure??null}),[Ro,To,$o,Vt]),(0,j.useEffect)(()=>{if(r){if(m&&Qt.length>0&&"object"==typeof Qt[0]&&null!==Qt[0]){const e="string"==typeof m?m:"coordinates";if(Array.isArray(Qt[0][e])){const t=[];for(const o of Qt){const n=o[e];if(Array.isArray(n)){const e=o.label||o.id||o.key;if(null!=e)for(const o of n)t.push({...o,_lineGroup:e});else for(const e of n)t.push(e)}}return void jo.current?.setBoundedData(t)}}jo.current?.setBoundedData(Qt)}},[r,Qt,m]);const{canvasRef:No,interactionCanvasRef:Do}=za(Nt,{storeRef:Mo,dirtyRef:Tt,hydrated:Dt,wasHydratingFromSSR:Et,cleanup:()=>jo.current?.clear(),canvasPaintDependencies:[o,Kt,Zt,ue,F,qe,W,z,Ge,Vt]}),{hoverHandlerRef:Eo,hoverLeaveRef:Bo,onPointerMove:Fo,onPointerLeave:Oo}=Nt;Eo.current=e=>{if(!Jt)return;const t=No.current;if(!t)return;const n=t.getBoundingClientRect(),r=e.clientX-n.left-Ut.left,i=e.clientY-n.top-Ut.top;if(0>r||r>Kt||0>i||i>Zt)return void(ao.current&&(ao.current=null,lo.current=null,ho(null),jt&&(jt(null),Tt.current=!0),Vt()));const s=Mo.current;if(!s||0===s.scene.length)return;const l=aa(je,e.pointerType),c=Tn(s.scene,r,i,l,s.quadtree,s.maxPointRadius),u="multi"===Re,d=()=>{ao.current&&(ao.current=null,lo.current=null,ho(null),jt&&jt(null),Vt())};if(!c&&!u)return void d();const h=u||!c?r:c.x,f=u||!c?i:c.y,p=c?.datum?wt(c.datum,s.resolvedRibbons):{},m=s.scales?.x?.invert,g="function"==typeof m?m(h):void 0;let y=ca(p,h,f,null!=g?{xValue:g,xPx:h}:void 0);if(u&&s.scene.length>0&&s.scales){const e=function(e,t,o=30){const n=[];for(const r of e)if("line"===r.type){const e=r;if(2>e.path.length)continue;const i=In(Ln(e.path,e.curve),t,o);if(null===i)continue;const s=Wn(e.path,t);n.push({node:r,datum:Array.isArray(e.datum)&&e.datum[s]?e.datum[s]:e.datum,x:e.path[s][0],y:i,group:e.group,color:e.style.stroke})}else if("area"===r.type){const e=r;if(!1===e.interactive)continue;if(2>e.topPath.length)continue;const i=Ln(e.topPath,e.curve),s=Ln(e.bottomPath,e.curve),a=In(i,t,o);if(null===a)continue;const l=In(s,t,o),c=Wn(e.topPath,t);n.push({node:r,datum:Array.isArray(e.datum)&&e.datum[c]?e.datum[c]:e.datum,x:e.topPath[c][0],y:a,y0:l??void 0,group:e.group,color:"string"==typeof e.style.stroke?e.style.stroke:"string"==typeof e.style.fill?e.style.fill:void 0})}return n}(s.scene,h,Math.max(l,Kt));if(e.length>0){const t=s.scales.y.invert,n=fo.current,r=m?m(h):h;if(c)y.xValue=r,y.xPx=h;else{const e={xValue:r};"string"==typeof a&&(e[a]=r),y=ca(e,h,f,{xValue:r,xPx:h})}y.allSeries=e.map(e=>{const r=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?r-i:r,valuePx:e.y,color:e.color||n,datum:wt(e.datum,s.resolvedRibbons)}})}}c||y.allSeries?.length?(ao.current=y,lo.current=c?.node??null,ho(y),jt&&(jt(y),Tt.current=!0),Vt()):d()},Bo.current=()=>{ao.current&&(ao.current=null,lo.current=null,ho(null),jt&&(jt(null),Tt.current=!0),Vt())};const qo=(0,j.useRef)(()=>{});qo.current=e=>{if(Jr(e.target))return;if(!Rt)return;const t=No.current;if(!t)return;const o=t.getBoundingClientRect(),n=e.clientX-o.left-Ut.left,r=e.clientY-o.top-Ut.top;if(0>n||n>Kt||0>r||r>Zt)return void Rt(null);const i=Mo.current;if(!i||0===i.scene.length)return void Rt(null);const s=aa(je,co.current),a=Tn(i.scene,n,r,s,i.quadtree,i.maxPointRadius);if(!a)return void Rt(null);const l=a.datum||{},c=i.scales?.x?.invert,u="function"==typeof c?c(a.x):void 0;Rt(ca(l,a.x,a.y,null!=u?{xValue:u,xPx:a.x}:void 0),{type:"activate",inputType:ql(co.current)})};const Yo=(0,j.useCallback)(e=>qo.current(e),[]),{kbFocusIndexRef:Go,focusedNavPointRef:Vo,onKeyDown:Xo}=(Uo={storeRef:Mo,hoverRef:ao,hoveredNodeRef:lo,setHoverPoint:ho,customHoverBehavior:jt,customClickBehavior:Rt,scheduleRender:Vt},ic({...Uo,extractPoints:tc,toHover:(e,t)=>rc({...e,datum:wt(e.datum,t.resolvedRibbons)})}));var Uo;const Ko=(0,j.useCallback)(e=>{co.current=e.pointerType,Go.current=-1,Vo.current=null,Fo(e)},[Vo,Go,Fo]),Zo=(0,j.useCallback)(e=>{co.current="mouse",Go.current=-1,Vo.current=null,Fo({clientX:e.clientX,clientY:e.clientY,pointerType:"mouse"})},[Vo,Go,Fo]),Qo=(0,j.useCallback)(e=>{co.current=e.pointerType},[]);Gt.current=()=>{if(Yt.current=null,!Xt.isActive)return;const e=No.current,t=Do.current;if(!e||!t)return;const n=Mo.current;if(!n)return;const r=Xt.now(),i=n.advanceTransition(Bt.current?r+1e6:r),s=!Bt.current&&i,c=It.current.w!==Kt||It.current.h!==Zt,u=Tt.current||i||c,d=n.consumeStylePaintPending();let h=!1;const f=n.getLastUpdateResult(),p=go.current.beforeCompute(f,s);!u||s&&!c||(n.computeScene({width:Kt,height:Zt}),It.current={w:Kt,h:Zt},h=!0,_o()),go.current.afterCompute(p,h,c);const m=qa(n,r,h,$t),g=Va(),y=po.current.resolve(e);fo.current=y.primary;const b=Vn(ot,n.lastIngestTime>0?r-n.lastIngestTime:0),v=ot&&b.isStale;if(u||d||m.changed){const t=Ga(e,Ht,Ut,g);if(t){if(t.clearRect(-Ut.left,-Ut.top,Ht[0],Ht[1]),ot&&1>b.alpha&&(t.globalAlpha=b.alpha),ws(t,{background:F,hasBackgroundGraphics:!!qe,themeBackground:y.background,x:-Ut.left,y:-Ut.top,width:Ht[0],height:Ht[1]}),t.save(),"function"==typeof t.rect&&(t.beginPath(),t.rect(0,0,Kt,Zt),t.clip()),Ge&&n.scales)for(const e of Ge)t.save(),e(t,n.scene,n.scales,{width:Kt,height:Zt}),t.restore();const e=At?_l.custom:_l[o];Ll({context:t,nodes:n.scene,renderMode:z,pixelRatio:g,paintBuiltIn:o=>{if(e&&n.scales)for(const r of e)r(t,o,n.scales,{width:Kt,height:Zt})}}),t.restore(),ot&&1>b.alpha&&(t.globalAlpha=1)}}const x=!!(Jt&&ao.current&&n.scales),k=!!(lo.current&&Array.isArray(xe)&&xe.some(e=>e&&"object"==typeof e&&"highlight"===e.type)),w=x||k;if(w||mo.current){const e=Ga(t,Ht,Ut,g);if(e&&(e.clearRect(-Ut.left,-Ut.top,Ht[0],Ht[1]),x&&ao.current&&function(e,t,o,n,r,i,s){if(!1===r.crosshair)return;const a=t.allSeries,l=a&&a.length>0,c=t.xPx??t.x;e.save();const u="object"==typeof r.crosshair?r.crosshair:{};if(e.strokeStyle=u.stroke||s.crosshair,e.lineWidth=u.strokeWidth||1,e.setLineDash(u.strokeDasharray?u.strokeDasharray.split(/[\s,]+/).map(Number):[4,4]),e.beginPath(),e.moveTo(l?c:t.x,0),e.lineTo(l?c:t.x,n),e.stroke(),l||(e.beginPath(),e.moveTo(0,t.y),e.lineTo(o,t.y),e.stroke()),e.restore(),l){e.lineWidth=2,e.strokeStyle=s.pointRing;for(const t of a)null!=t.valuePx&&(e.beginPath(),e.arc(c,t.valuePx,4,0,2*Math.PI),e.fillStyle=t.color||s.primary,e.fill(),e.stroke())}else{const o=r.pointColor||function(e){if(!e)return null;if("heatcell"===e.type)return e.fill||null;if("candlestick"===e.type)return e.isUp?e.upColor:e.downColor;const{style:t}=e;if(!t)return null;const o="string"==typeof t.fill?t.fill:null;return"line"===e.type||"area"===e.type?t.stroke||o||null:o||t.stroke||null}(i)||s.primary;e.beginPath(),e.arc(t.x,t.y,4,0,2*Math.PI),e.fillStyle=o,e.fill(),e.strokeStyle=s.pointRing,e.lineWidth=2,e.stroke()}}(e,ao.current,Kt,Zt,"object"==typeof Jt?Jt:{},lo.current,y),k&&lo.current&&Array.isArray(xe))){const t=xe.find(e=>e&&"object"==typeof e&&"highlight"===e.type);t&&function(e,t,o,n,r){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 n.style?o.datum?n.style(o.datum):{}:n.style||{};e.save(),e.beginPath(),e.moveTo(o.path[0][0],o.path[0][1]);for(let t=1;o.path.length>t;t++)e.lineTo(o.path[t][0],o.path[t][1]);e.strokeStyle=t.stroke||o.style.stroke||r.primary,e.lineWidth=t.strokeWidth||(o.style.strokeWidth||2)+2,e.globalAlpha=t.opacity??1,e.stroke(),e.restore()}}(e,n.scene,lo.current,t,y)}mo.current=w}u&&e&&e.setAttribute("aria-label",Bs(n.scene,o+" chart"));const S=Tt.current;if(Tt.current=S&&s&&!h,S&&n.scales){const e=e=>"object"==typeof e&&null!==e&&"function"==typeof e.valueOf?e.valueOf():e;if((!no||e(no.x.domain()[0])!==e(n.scales.x.domain()[0])||e(no.x.domain()[1])!==e(n.scales.x.domain()[1])||e(no.y.domain()[0])!==e(n.scales.y.domain()[0])||e(no.y.domain()[1])!==e(n.scales.y.domain()[1])||no.x.range()[0]!==n.scales.x.range()[0]||no.x.range()[1]!==n.scales.x.range()[1]||no.y.range()[0]!==n.scales.y.range()[0]||no.y.range()[1]!==n.scales.y.range()[1])&&ro(n.scales),pt){const e=n.getData(),t="function"==typeof a?a:e=>e[a||"x"],o="function"==typeof l?l:e=>e[l||"y"];xo(e.map(e=>t(e)).filter(e=>"number"==typeof e&&isFinite(e))),So(e.map(e=>o(e)).filter(e=>"number"==typeof e&&isFinite(e)))}}!((Pe&&Pe.length>0||At)&&(h||s))||!h&&33>r-oo.current||(to(e=>e+1),oo.current=r),ot?.showBadge&&bo(!!v),(s||null!=n.activeTransition||m.pending)&&Vt()},Xn(ot,Mo,Tt,Vt,yo,bo);const Jo=(0,j.useMemo)(()=>{if(me||be)return;const e=Mo.current;return e?.xIsDate&&no?el(no.x.domain()):void 0},[me,be,no]),en=me||be||Jo,tn=Jt&&uo?ke?ke(uo):(0,sc.jsx)(Wl,{hover:uo}):null,on=tn?(0,sc.jsx)(Ca,{x:uo.x,y:uo.y,containerWidth:Kt,containerHeight:Zt,margin:Ut,className:"stream-frame-tooltip",children:tn}):null,nn=Vo.current,rn=(0,sc.jsx)(ia,{active:Go.current>=0,hoverPoint:uo,margin:Ut,size:Ht,shape:nn?.shape,width:nn?.w,height:nn?.h}),sn=Ka(a,C,"__semiotic_resolvedX","__semiotic_resolvedTime"),an=Ka(l,k,"__semiotic_resolvedY","__semiotic_resolvedValue"),cn=sn.key,un=an.key,dn=Za(sn,an,Pe&&Pe.length>0||!1);if(cs||!Dt&&Et){const e=Mo.current;e&&r&&(e.ingest({inserts:Qt,bounded:!0}),e.computeScene({width:Kt,height:Zt}));const t=e?.scene??[],o=e?.scales??null,n=Ya(Ye,Ht,Ut,o),i=Ya(qe,Ht,Ut,o),s=en||(()=>{if(e?.xIsDate&&o)return el(o.x.domain())})();return(0,sc.jsxs)("div",{ref:Ft,className:"stream-xy-frame"+(E?" "+E:""),role:"img","aria-label":vt||("string"==typeof Xe?Xe:"XY chart"),style:{position:"relative",width:$?"100%":Ht[0],height:N?"100%":Ht[1]},children:[(0,sc.jsx)(ta,{summary:xt}),(0,sc.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:Ht[0],height:Ht[1],style:{position:"absolute",left:0,top:0},children:[(0,sc.jsx)("g",{transform:`translate(${Ut.left},${Ut.top})`,children:i}),(0,sc.jsxs)("g",{transform:`translate(${Ut.left},${Ut.top})`,children:[F&&(0,sc.jsx)("rect",{x:0,y:0,width:Kt,height:Zt,fill:F}),Ve&&o&&Ve.map((e,n)=>(0,sc.jsx)(_.Fragment,{children:e(t,o,{width:Kt,height:Zt})},"svgpre-"+n)),t.map((e,t)=>Tl({node:e,index:t,renderMode:z,fallback:()=>function(e,t,o){switch(e.type){case"line":{const o=e;if(0===o.path.length)return null;const n="M"+o.path.map(([e,t])=>`${e},${t}`).join("L");return(0,ns.jsx)("path",{d:n,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 n=e;if(0===n.topPath.length)return null;const r=`M${n.topPath.map(([e,t])=>`${e},${t}`).join("L")}L${[...n.bottomPath].reverse().map(([e,t])=>`${e},${t}`).join("L")}Z`,i=`${o?o+"-":""}area-${t}-hatch`,s=yn(n.style.fill)?kn(n.style.fill,i):void 0,a=s?`url(#${i})`:is(n.style.fill);if(n.clipRect){const e=`${o?o+"-":""}area-clip-${t}`;return(0,ns.jsxs)("g",{children:[(0,ns.jsxs)("defs",{children:[s,(0,ns.jsx)("clipPath",{id:e,children:(0,ns.jsx)("rect",{x:n.clipRect.x,y:n.clipRect.y,width:n.clipRect.width,height:n.clipRect.height})})]}),(0,ns.jsx)("path",{d:r,fill:a,fillOpacity:n.style.fillOpacity??n.style.opacity??.7,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,clipPath:`url(#${e})`})]},"area-"+t)}return(0,ns.jsxs)(Ki.Fragment,{children:[s&&(0,ns.jsx)("defs",{children:s}),(0,ns.jsx)("path",{d:r,fill:a,fillOpacity:n.style.fillOpacity??n.style.opacity??.7,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})]},"area-"+t)}case"point":{const n=e,r=`${o?o+"-":""}point-${t}-hatch`,i=yn(n.style.fill)?kn(n.style.fill,r):void 0;return(0,ns.jsxs)(Ki.Fragment,{children:[i&&(0,ns.jsx)("defs",{children:i}),(0,ns.jsx)("circle",{cx:n.x,cy:n.y,r:n.r,fill:i?`url(#${r})`:is(n.style.fill),opacity:n.style.opacity??.8,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})]},"point-"+t)}case"symbol":return ss(e,t);case"glyph":return as(e,e.x,e.y,`${o??""}glyph-${e.pointId??t}`);case"rect":{const n=e,r=`${o?o+"-":""}xyrect-${t}-hatch`,i=yn(n.style.fill)?kn(n.style.fill,r):void 0;return(0,ns.jsxs)(Ki.Fragment,{children:[i&&(0,ns.jsx)("defs",{children:i}),(0,ns.jsx)("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:i?`url(#${r})`:is(n.style.fill),opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.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),[n,r,i]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(o.fill),s=.299*n+.587*r+.114*i>128?"#000":"#fff",a=Math.max(10,Math.min(16,.3*Math.min(o.w,o.h)));return(0,ns.jsxs)("g",{children:[(0,ns.jsx)("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:o.fill}),(0,ns.jsx)("text",{x:o.x+o.w/2,y:o.y+o.h/2,textAnchor:"middle",dominantBaseline:"middle",fill:s,fontSize:a+"px",children:e})]},"heatcell-"+t)}return(0,ns.jsx)("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:o.fill},"heatcell-"+t)}case"candlestick":{const o=e,n=Math.min(o.openY,o.closeY),r=Math.max(Math.abs(o.openY-o.closeY),1),i=o.isUp?o.upColor:o.downColor;return(0,ns.jsxs)("g",{children:[(0,ns.jsx)("line",{x1:o.x,y1:o.highY,x2:o.x,y2:o.lowY,stroke:o.wickColor,strokeWidth:o.wickWidth}),(0,ns.jsx)("rect",{x:o.x-o.bodyWidth/2,y:n,width:o.bodyWidth,height:r,fill:i,stroke:i,strokeWidth:1})]},"candle-"+t)}default:return null}}(e,t,Lt)})).filter(Boolean)]})]}),(0,sc.jsx)(Ui,{width:Kt,height:Zt,totalWidth:Ht[0],totalHeight:Ht[1],margin:Ut,scales:o,showAxes:ue,axes:de,xLabel:he,yLabel:fe,yLabelRight:pe,xFormat:s,yFormat:ge||ve,axisExtent:ye,showGrid:$e,title:Xe,legend:Ne,legendHoverBehavior:De,legendClickBehavior:Ee,legendHighlightedCategory:Be,legendIsolatedCategories:Fe,legendPosition:He,legendLayout:Oe,foregroundGraphics:Io(n,Ho(Mo.current?.customLayoutOverlays,_t??null)),marginalGraphics:pt,xValues:[],yValues:[],annotations:Pe,onAnnotationActivate:Le,onObservation:Ce??Ae,chartId:Me,chartType:"StreamXYFrame",autoPlaceAnnotations:Te,svgAnnotationRules:Ie,annotationFrame:0,xAccessor:cn,yAccessor:un,annotationData:dn(Mo.current?.getData()),pointNodes:tl(Mo.current?.scene),curve:"string"==typeof g?g:void 0,linkedCrosshairName:kt,linkedCrosshairSourceId:St})]})}return(0,sc.jsxs)("div",{ref:Ft,className:"stream-xy-frame"+(E?" "+E:""),role:"group","aria-label":vt||("string"==typeof Xe?Xe:"XY chart"),tabIndex:0,style:{position:"relative",width:$?"100%":Ht[0],height:N?"100%":Ht[1],overflow:"visible",touchAction:cc(Ke)},onKeyDown:Xo,children:["production"!==process.env.NODE_ENV&&Mo.current&&(0,sc.jsx)(Lo,{store:Mo.current,diagnostics:go.current}),bt&&(0,sc.jsx)(oa,{tableId:qt}),bt&&(0,sc.jsx)(Js,{scene:Mo.current?.scene??[],chartType:o+" chart",tableId:qt,chartTitle:"string"==typeof Xe?Xe:void 0}),(0,sc.jsx)(ta,{summary:xt}),(0,sc.jsx)(Is,{hoverPoint:uo}),(0,sc.jsxs)("div",{role:"img","aria-label":vt||("string"==typeof Xe?Xe:"XY chart"),style:{position:"relative",width:"100%",height:"100%"},onPointerMove:Jt?Ko:void 0,onMouseMove:Jt?Zo:void 0,onPointerLeave:Jt?Oo:void 0,onMouseLeave:Jt?Oo:void 0,onPointerDown:Jt||Pt?Qo:void 0,onClick:Pt?Yo:void 0,children:[(0,sc.jsx)(Wa,{size:Ht,margin:Ut,children:so}),(0,sc.jsx)(Gi,{width:Kt,height:Zt,totalWidth:Ht[0],totalHeight:Ht[1],margin:Ut,scales:no,showAxes:ue,axes:de,showGrid:$e,xFormat:en,yFormat:ge||ve,axisExtent:ye}),(0,sc.jsx)("canvas",{ref:No,"aria-label":Bs(Mo.current?.scene??[],o+" chart"),style:{position:"absolute",left:0,top:0}}),(0,sc.jsx)("canvas",{ref:Do,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),(0,sc.jsx)(Ui,{width:Kt,height:Zt,totalWidth:Ht[0],totalHeight:Ht[1],margin:Ut,scales:no,showAxes:ue,axes:de,xLabel:he,yLabel:fe,yLabelRight:pe,xFormat:en,yFormat:ge||ve,axisExtent:ye,showGrid:$e,title:Xe,legend:Ne,legendHoverBehavior:De,legendClickBehavior:Ee,legendHighlightedCategory:Be,legendIsolatedCategories:Fe,legendPosition:He,legendLayout:Oe,foregroundGraphics:Io(io,Ho(Mo.current?.customLayoutOverlays,_t??null)),marginalGraphics:pt,xValues:vo,yValues:ko,annotations:Pe,onAnnotationActivate:Le,onObservation:Ce??Ae,chartId:Me,chartType:"StreamXYFrame",autoPlaceAnnotations:Te,svgAnnotationRules:Ie,annotationFrame:eo,xAccessor:cn,yAccessor:un,annotationData:dn(Mo.current?.getData()),pointNodes:tl(Mo.current?.scene),curve:"string"==typeof g?g:void 0,underlayRendered:!0,canvasObscuresUnderlay:"transparent"!==F&&!qe,linkedCrosshairName:kt,linkedCrosshairSourceId:St}),(Ke||Ze)&&(0,sc.jsx)(B,{width:Kt,height:Zt,totalWidth:Ht[0],totalHeight:Ht[1],margin:Ut,dimension:Ke?.dimension??"xy",scales:no,onBrush:Ze??(()=>{}),binSize:x,snap:Ke?.snap,binBoundaries:Ke?.binBoundaries??("bar"===o?Mo.current?.getBinBoundaries():void 0),snapDuring:Ke?.snapDuring,streaming:"streaming"===n}),ot?.showBadge&&(0,sc.jsx)(Kn,{isStale:yo,position:ot.badgePosition}),rn,on]})]})}));uc.displayName="StreamXYFrame";var dc=uc,hc=require("react"),fc=require("d3-scale"),pc=class{constructor(){this.colorSchemeMap=new Map,this.colorSchemeIndex=0}resetColors(){this.colorSchemeMap.clear(),this.colorSchemeIndex=0}resolvePieceStyle(e,t,o){if(t&&"function"==typeof e.pieceStyle){const n=e.pieceStyle(t,o);return n&&!n.fill&&o?{...n,fill:this.getColorFromScheme(e,o)}:n}return e.pieceStyle&&"object"==typeof e.pieceStyle?e.pieceStyle:e.barColors&&o?{fill:e.barColors[o]||"#007bff"}:{fill:o?this.getColorFromScheme(e,o):"#007bff"}}resolveSummaryStyle(e,t,o){return t&&"function"==typeof e.summaryStyle?e.summaryStyle(t,o):e.summaryStyle&&"object"==typeof e.summaryStyle?e.summaryStyle:{fill:"#007bff",fillOpacity:.6,stroke:"#007bff",strokeWidth:1}}getColorFromScheme(e,t){const o=this.colorSchemeMap.get(t);if(o)return o;const n=Array.isArray(e.colorScheme)?e.colorScheme:e.themeCategorical||Fe,r=n[this.colorSchemeIndex%n.length];return this.colorSchemeIndex++,this.colorSchemeMap.set(t,r),r}};function mc(e){const t=e.getSymbol;if(!t)return null;const o=e.config.symbolMap,n=new Map;let r=0;return e=>{const i=t(e)+"",s=o?.[i];if(s)return s;let a=n.get(i);return a||(a=Rt[r%Rt.length],r++,n.set(i,a)),a}}function gc(e,t,o,n,r,i,s){e.push(t?{type:"symbol",x:n,y:r,size:Math.PI*i*i,symbolType:t(o),style:s,datum:o}:{type:"point",x:n,y:r,r:i,style:s,datum:o})}function yc(e,t){const{columns:o,config:n,resolvePieceStyle:r}=e,i=[],s=Math.min(t.width,t.height)/2-4,a="donut"===n.chartType?n.innerRadius||60:0,l=-Math.PI/2+(n.startAngle||0)*Math.PI/180,c=null!=n.sweepAngle?n.sweepAngle*Math.PI/180:2*Math.PI,u=null!=n.sweepAngle&&360>n.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)}),f=u&&!h&&d.length>1&&(n.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,p=l+(u+("number"==typeof o?._pct?o._pct:t.pct))*c,m=r(t.pieceData[0],t.name),g=0===e,y=e===d.length-1,b={type:"wedge",cx:0,cy:0,innerRadius:a,outerRadius:s,startAngle:h,endAngle:p,...n.cornerRadius&&{cornerRadius:n.cornerRadius},style:m,datum:o?._nonInteractive?null:t.pieceData,category:t.name};o?._roundedEnds?b.roundedEnds=o._roundedEnds:f&&(b.roundedEnds={start:g,end:y}),o?._gradientBand&&(b._gradientBand=o._gradientBand),i.push(b)}return i}var bc=require("d3-array");function vc(e){const t=e.length,o=e[0],n=e[t-1];return{n:t,min:o,q1:(0,bc.quantile)(e,.25)??o,median:(0,bc.quantile)(e,.5)??(o+n)/2,q3:(0,bc.quantile)(e,.75)??n,max:n,mean:e.reduce((e,t)=>e+t,0)/t}}h();var xc=require("d3-scale"),kc={bar:function(e,t){const{scales:o,columns:n,config:r,getR:i,getStack:s,resolvePieceStyle:a}=e,{r:l,projection:c}=o,u=[],d="vertical"===c,h="horizontal"===c,f=r.normalize,p=[];if(s){const e=new Set;for(const t of Object.values(n))for(const o of t.pieceData){const t=s(o);e.has(t)||(e.add(t),p.push(t))}}else p.push("_default");for(const e of Object.values(n)){const t=new Map;for(const o of e.pieceData){const e=s?s(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const n=t.get(e);n.total+=i(o),n.pieces.push(o)}let o=0;if(f)for(const e of t.values())o+=Math.abs(e.total);let n=0,r=0;for(const i of p){const c=t.get(i);if(!c)continue;let p=c.total;f&&o>0&&(p/=o);const m=a(c.pieces[0],s?i:e.name),g={...c.pieces[0],__aggregateValue:c.total,__pieceCount:c.pieces.length,category:e.name};if(d){const t=l(0>p?r:n+p),o=0>p?l(r+p)-l(r):l(n)-l(n+p);u.push(mt(e.x,t,e.width,Math.abs(o),m,g,i)),0>p?r+=p:n+=p}else if(h){const t=l(0>p?r+p:n),o=0>p?l(r)-l(r+p):l(n+p)-l(n);u.push(mt(t,e.x,Math.abs(o),e.width,m,g,i)),0>p?r+=p:n+=p}}}const m="vertical"===c,g=r.roundedTop&&r.roundedTop>0?Math.max(0,r.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",r.gradientFill&&(e.fillGradient=r.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:n,config:r,getR:i,getGroup:s,resolvePieceStyle:a}=e,{r:l,projection:c}=o,u=[],d="vertical"===c,h=[],f=new Set;for(const e of Object.values(n))for(const t of e.pieceData){const e=s?s(t):"_default";f.has(e)||(f.add(e),h.push(e))}const p=h.length||1;for(const e of Object.values(n)){const t=e.width/p,o=.2*t,n=t-o,r=new Map;for(const t of e.pieceData){const e=s?s(t):"_default";r.has(e)||r.set(e,[]),r.get(e).push(t)}for(let s=0;h.length>s;s++){const c=r.get(h[s])||[];for(const r of c){const c=i(r),f=a(r,h[s]);if(d){const i=e.x+s*t+o/2,a=l(0),d=l(c);u.push(mt(i,Math.min(a,d),n,Math.abs(a-d),f,r,h[s]))}else{const i=e.x+s*t+o/2,a=l(0),d=l(c);u.push(mt(Math.min(a,d),i,Math.abs(d-a),n,f,r,h[s]))}}}}const m=r.roundedTop&&r.roundedTop>0?Math.max(0,r.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",r.gradientFill&&(e.fillGradient=r.gradientFill)}return u},point:function(e,t){const{scales:o,columns:n,getR:r,multiScales:i,resolvePieceStyle:s}=e,{r:a,projection:l}=o,c=[],u="vertical"===l,d="radial"===l,h=i.length>0,f=mc(e),p=2*Math.PI,m=-Math.PI/2;for(const e of Object.values(n))for(const t of e.pieceData){const o=t.__rIndex??0,n=t.__rValue??r(t),l=h&&i[o]||a,g=s(t,e.name),y=g.r||5;let b,v;if(d){const t=m+(e.pctStart+e.pct/2)*p,o=l(n);b=Math.cos(t)*o,v=Math.sin(t)*o}else u?(b=e.middle,v=l(n)):(b=l(n),v=e.middle);gc(c,f,t,b,v,y,g)}return c},swarm:function(e,t){const{scales:o,columns:n,getR:r,resolvePieceStyle:i}=e,{r:s,projection:a}=o,l=[],c="vertical"===a,u=mc(e);for(const e of Object.values(n)){const t=e.width/2;for(let o=0;e.pieceData.length>o;o++){const n=e.pieceData[o],a=r(n),d=i(n,e.name),h=d.r||4,f=(7919*o%100/100-.5)*t*.8;gc(l,u,n,c?e.middle+f:s(a),c?s(a):e.middle+f,h,d)}}return l},pie:yc,donut:yc,boxplot:function(e,t){const{scales:o,columns:n,config:r,getR:i,resolveSummaryStyle:s}=e,{r:a,projection:l}=o,c=[],u="vertical"===l,d=!1!==r.showOutliers;for(const t of Object.values(n)){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 n=o[0],r=o[o.length-1],l=(0,bc.quantile)(o,.25)??n,h=(0,bc.quantile)(o,.5)??(n+r)/2,f=(0,bc.quantile)(o,.75)??r,p=f-l,m=l-1.5*p,g=f+1.5*p,y=o.find(e=>e>=m)??n,b=[...o].reverse().find(e=>g>=e)??r,v=s(t.pieceData[0],t.name),x=[];if(d)for(const e of t.pieceData){const o=i(e);if(m>o||o>g){const n=u?t.middle:a(o),r=u?a(o):t.middle;x.push({px:n,py:r,value:o,datum:e})}}if(c.push({type:"boxplot",x:u?t.middle:0,y:u?0:t.middle,projection:u?"vertical":"horizontal",columnWidth:.6*t.width,minPos:a(y),q1Pos:a(l),medianPos:a(h),q3Pos:a(f),maxPos:a(b),stats:{n:o.length,min:y,q1:l,median:h,q3:f,max:b,mean:o.reduce((e,t)=>e+t,0)/o.length},style:v,datum:t.pieceData,category:t.name,outliers:x}),d)for(const t of x)c.push({type:"point",x:t.px,y:t.py,r:3,style:{fill:v.fill||e.config.themeSemantic?.secondary||"#999",opacity:.6},datum:t.datum})}return c},violin:function(e,t){const{scales:o,columns:n,config:r,getR:i,resolveSummaryStyle:s}=e,{r:a,projection:l}=o,c=[],u="vertical"===l,h=r.bins||20,f=!1!==r.showIQR;for(const e of Object.values(n)){const t=e.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const o=t[0],n=t[t.length-1],r=(n-o)/h||1,l=Array(h).fill(0);for(const e of t)l[Math.min(Math.floor((e-o)/r),h-1)]++;const p=d(l,1),m=e.width/2*.9;let g;if(u){g=`M ${e.middle} ${a(o)}`;for(let t=0;h>t;t++){const n=a(o+(t+.5)*r);g+=` L ${e.middle+l[t]/p*m} ${n}`}g+=` L ${e.middle} ${a(n)}`;for(let t=h-1;t>=0;t--){const n=a(o+(t+.5)*r);g+=` L ${e.middle-l[t]/p*m} ${n}`}g+=" Z"}else{g=`M ${a(o)} ${e.middle}`;for(let t=0;h>t;t++)g+=` L ${a(o+(t+.5)*r)} ${e.middle-l[t]/p*m}`;g+=` L ${a(n)} ${e.middle}`;for(let t=h-1;t>=0;t--)g+=` L ${a(o+(t+.5)*r)} ${e.middle+l[t]/p*m}`;g+=" Z"}const y=s(e.pieceData[0],e.name);let b;if(f&&t.length>=4){const r=(0,bc.quantile)(t,.25)??o,i=(0,bc.quantile)(t,.5)??(o+n)/2,s=(0,bc.quantile)(t,.75)??n;b={q1Pos:a(r),medianPos:a(i),q3Pos:a(s),centerPos:e.middle,isVertical:u}}const v=u?{x:e.x,y:Math.min(a(n),a(o)),width:e.width,height:Math.abs(a(n)-a(o))}:{x:Math.min(a(o),a(n)),y:e.x,width:Math.abs(a(n)-a(o)),height:e.width};c.push({type:"violin",pathString:g,translateX:0,translateY:0,bounds:v,iqrLine:b,stats:vc(t),style:y,datum:e.pieceData,category:e.name})}return c},histogram:function(e,t){const{scales:o,columns:n,config:r,getR:i,resolveSummaryStyle:s}=e,{r:a}=o,l=[],c=r.bins||25,h=r.normalize,f=a.domain?.(),p=f?+f[0]:void 0,m=f?+f[1]:void 0;for(const e of Object.values(n)){const t=e.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const[o,n]=u(t),r=null!=p&&isFinite(p)?p:o,f=null!=m&&isFinite(m)?m:n,g=(f-r)/c||1,y=Array(c).fill(0);for(const e of t)r>e||e>f||y[Math.min(Math.floor((e-r)/g),c-1)]++;const b=t.length,v=d(y,1),x=s(e.pieceData[0],e.name);for(let t=0;c>t;t++){if(0===y[t])continue;const o=(h?y[t]/b:y[t]/v)*e.width*.9,n=a(r+t*g),i=a(r+(t+1)*g);l.push(mt(Math.min(n,i),e.x+e.width-o,Math.abs(i-n),o,x,{bin:t,count:y[t],range:[r+t*g,r+(t+1)*g],category:e.name},e.name))}}return l},ridgeline:function(e,t){const{scales:o,columns:n,config:r,getR:i,resolveSummaryStyle:s}=e,{r:a,projection:l}=o,c=[],u=r.bins||20,h="horizontal"===l,f=r.amplitude||1.5;for(const e of Object.values(n)){const t=e.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const o=t[0],n=t[t.length-1],r=(n-o)/u||1,l=Array(u).fill(0);for(const e of t)o>e||e>n||l[Math.min(Math.floor((e-o)/r),u-1)]++;const p=d(l,1),m=s(e.pieceData[0],e.name),g=e.width*f;let y;if(h){const t=e.x+e.width;y=`M ${a(o)} ${t}`;for(let e=0;u>e;e++)y+=` L ${a(o+(e+.5)*r)} ${t-l[e]/p*g}`;y+=` L ${a(n)} ${t} Z`}else{const t=e.x;y=`M ${t} ${a(o)}`;for(let e=0;u>e;e++){const n=a(o+(e+.5)*r);y+=` L ${t+l[e]/p*g} ${n}`}y+=` L ${t} ${a(n)} Z`}const b=h?{x:Math.min(a(o),a(n)),y:e.x,width:Math.abs(a(n)-a(o)),height:e.width}:{x:e.x,y:Math.min(a(n),a(o)),width:e.width,height:Math.abs(a(n)-a(o))};c.push({type:"violin",pathString:y,translateX:0,translateY:0,bounds:b,stats:vc(t),style:{...m,fillOpacity:m.fillOpacity??.5},datum:e.pieceData,category:e.name})}return c},timeline:function(e,t){const{scales:o,columns:n,getRawRange:r,resolvePieceStyle:i}=e,{r:s,projection:a}=o,l=[],c="horizontal"===a;for(const e of Object.values(n))for(const t of e.pieceData){const o=r(t);if(!o)continue;const[n,a]=o,u=i(t,e.name);if(c){const o=s(Math.min(n,a)),r=s(Math.max(n,a));l.push(mt(o,e.x,r-o,e.width,u,t,e.name))}else{const o=s(Math.max(n,a)),r=s(Math.min(n,a));l.push(mt(e.x,o,e.width,r-o,u,t,e.name))}}return l},funnel:function(e,t){const{columns:o,getR:n,getStack:r,resolvePieceStyle:i}=e,s=[],a=t.width/2,l=!1!==e.config.showLabels,c=e.scales.o.domain().map(e=>o[e]).filter(Boolean);if(0===c.length)return s;const u=[],d=new Set;for(const e of c)for(const t of e.pieceData){const e=r?r(t):"_default";d.has(e)||(d.add(e),u.push(e))}const h=u.length>1&&"_default"!==u[0],f=[];let p=0;for(const e of c){const t=new Map;let o=0;for(const i of e.pieceData){const e=r?r(i):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const s=t.get(e),a=n(i);s.total+=a,s.pieces.push(i),o+=a}f.push({col:e,groups:t,stepTotal:o}),h||o>p&&(p=o)}if(h)for(const e of f){let t=0,o=0;for(let n=0;u.length>n;n++){const r=e.groups.get(u[n]);r&&(n%2==0?t+=r.total:o+=r.total)}const n=Math.max(t,o);n>p&&(p=n)}if(0===p)return s;const m=new Map;for(const e of u){const t=f[0].groups.get(e);m.set(e,t?.total??0)}const g=f[0].stepTotal,y=h?.95*a:.9*t.width,b=(0,xc.scaleLinear)().domain([0,p]).range([0,y]),v=e.config.connectorOpacity??.3;let x=new Map;for(let t=0;f.length>t;t++){const o=f[t],n=o.col,r=0===t,c=n.width,d=.55*c,p=n.x+(c-d)/2,y=new Map;if(h){let e=0;for(const t of u){const n=o.groups.get(t);n&&(e+=b(n.total))}let t=a,c=a;for(let h=0;u.length>h;h++){const f=u[h],g=o.groups.get(f);if(!g)continue;const v=b(g.total),x=h%2==0,k=x?t:c-v;x?t+=v:c-=v;const w=i(g.pieces[0],f),S=m.get(f)??g.total,A={...g.pieces[0],__funnelValue:g.total,__funnelPercent:S>0?g.total/S*100:0,__funnelStep:n.name,__funnelIsFirstStep:r,__aggregateValue:g.total,__pieceCount:g.pieces.length,category:f};l&&(0===h&&(A.__funnelStepLabel=n.name,A.__funnelStepLabelX=a,A.__funnelStepLabelY=p,A.__funnelRowWidth=e),A.__funnelValueLabelX=k+v/2,A.__funnelValueLabelY=p,A.__funnelBarW=v),s.push(mt(k,p,v,d,w,A,f)),y.set(f,{x:k,y:p,w:v,h:d})}}else{const e=o.stepTotal,t=b(e),c=a-t/2,h=u[0],f="_default"!==h,m=o.groups.get(h)?.pieces[0]??n.pieceData[0],v=f?h:n.name,x=i(m,v),k=g>0?e/g*100:0,w={...m,__funnelValue:e,__funnelPercent:k,__funnelStep:n.name,__funnelIsFirstStep:r,category:f?h:n.name};l&&(w.__funnelStepLabel=n.name,w.__funnelStepLabelX=a,w.__funnelStepLabelY=p,w.__funnelRowWidth=t,w.__funnelValueLabelX=a,w.__funnelValueLabelY=p,w.__funnelBarW=t),s.push(mt(c,p,t,d,x,w,v)),y.set(h,{x:c,y:p,w:t,h:d})}if(t>0&&x.size>0){const t=h?u:[u[0]];for(const r of t){const t=x.get(r),a=y.get(r);if(!t||!a)continue;const l=(()=>{const e=o.groups.get(r);return i(e?e.pieces[0]:n.pieceData[0],"_default"===r?n.name:r)})(),c={type:"trapezoid",points:[[t.x,t.y+t.h],[t.x+t.w,t.y+t.h],[a.x+a.w,a.y],[a.x,a.y]],style:{fill:l.fill||e.config.themeSemantic?.secondary||"#999",opacity:v},datum:o.groups.get(r)?.pieces[0]??n.pieceData[0],category:"_default"===r?n.name:r};s.push(c)}}x=y}return s},"bar-funnel":function(e,t){const{columns:o,getR:n,getStack:r,resolvePieceStyle:i,scales:s}=e,a=[],l=s.o.domain().map(e=>o[e]).filter(Boolean);if(0===l.length)return a;const c=[],u=new Set;for(const e of l)for(const t of e.pieceData){const e=r?r(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=r?r(i):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const s=t.get(e),a=n(i);s.total+=a,s.pieces.push(i),o+=a}h.push({col:e,groups:t,stepTotal:o})}const f=new Map;for(const e of c){const t=h[0]?.groups.get(e);f.set(e,t?.total??0)}const p=s.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,n=0===e,r=e>0?h[e-1]:null,s=o.width/m,l=s*g,u=s-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=f.get(h)??g,b=y>0?g/y*100:0,v=r?.groups.get(h),x=n?0:Math.max(0,(v?.total??g)-g),k=o.x+e*s+l/2,w=p(g),S=p(0)-w,A=i(m.pieces[0],d?h:o.name),C={...m.pieces[0],__barFunnelValue:g,__barFunnelPercent:b,__barFunnelIsFirstStep:n,__barFunnelIsDropoff:!1,__barFunnelStep:o.name,__barFunnelDropoffValue:x,__barFunnelCategory:"_default"===h?void 0:h,category:d?h:o.name,__barFunnelLabelX:k+u/2,__barFunnelLabelY:p(g+x)};if(a.push(mt(k,w,u,S,A,C,d?h:o.name)),x>0){const e=p(g+x),t=w-e,n={...A},r={...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};a.push(mt(k,e,u,t,n,r,d?h:o.name))}}}return a},swimlane:function(e,t){const{scales:o,columns:n,getR:r,getStack:i,resolvePieceStyle:s}=e,{r:a,projection:l}=o,c=[],u="horizontal"===l,d=e.config.gradientFill,h=u?"left":"bottom",f=e.config.trackFill;if(f){const e="string"==typeof f?f:f.color,t="string"==typeof f?1:f.opacity??1,[o,r]=a.range(),i=Math.min(o,r),s=Math.abs(r-o);for(const o of Object.values(n)){const n={fill:e,opacity:t},r=u?mt(i,o.x,s,o.width,n,null,"__track__"):mt(o.x,i,o.width,s,n,null,"__track__");c.push(r)}}const p=e.config.roundedTop&&e.config.roundedTop>0?Math.max(0,e.config.roundedTop):0;for(const e of Object.values(n)){let t=0;const o=c.length;for(const o of e.pieceData){const n=Math.abs(r(o));if(0===n)continue;const l=i?i(o):e.name,f=s(o,l);let p;if(u){const r=a(t),i=a(t+n);p=mt(r,e.x,i-r,e.width,f,o,l)}else{const r=a(t+n),i=a(t);p=mt(e.x,r,e.width,i-r,f,o,l)}d&&(p.fillGradient=d,p.roundedEdge=h),c.push(p),t+=n}if(p>0&&c.length>o){const e=c.slice(o),t=e[0],n=e[e.length-1];1===e.length?t.cornerRadii={tl:p,tr:p,br:p,bl:p}:u?(t.cornerRadii={tl:p,bl:p},n.cornerRadii={tr:p,br:p}):(t.cornerRadii={bl:p,br:p},n.cornerRadii={tl:p,tr:p})}}return c}};function wc(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=Ee[e];if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:o}function Sc(e,t){const o=t&&"object"==typeof t&&!Array.isArray(t)?t:void 0;return 0===e.length?e=>o&&We(o,e)||"#4e79a7":t=>{if(o){const e=We(o,t);if(e)return e}let n=0;for(let e=0;t.length>e;e++)n=31*n+t.charCodeAt(e)|0;return e[Math.abs(n)%e.length]??"#4e79a7"}}var Ac=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Cc=["scene-style","data-paint","accessibility","evidence"],Mc=(e,t)=>({retainedData:e,invalidations:t}),_c=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],jc=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Rc=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Pc=["scene-geometry","data-paint","accessibility","evidence"],Lc=["scene-style","data-paint","accessibility","evidence"],Tc=[],Ic={chartType:Mc("rebuild",_c),runtimeMode:Mc("rebuild",_c),categoryAccessor:Mc("rebuild",_c),valueAccessor:Mc("rebuild",_c),oAccessor:Mc("rebuild",_c),rAccessor:Mc("rebuild",_c),stackBy:Mc("rebuild",_c),groupBy:Mc("rebuild",_c),timeAccessor:Mc("rebuild",_c),accessorRevision:Mc("rebuild",_c),colorAccessor:Mc("rebuild",Lc),symbolAccessor:Mc("rebuild",Pc),connectorAccessor:Mc("rebuild",Pc),dataIdAccessor:Mc("rebuild",Pc),projection:Mc("preserve",jc),extentPadding:Mc("preserve",jc),axisExtent:Mc("preserve",jc),rExtent:Mc("preserve",jc),oExtent:Mc("preserve",jc),multiAxis:Mc("preserve",jc),normalize:Mc("preserve",jc),bins:Mc("preserve",jc),oSort:Mc("preserve",Rc),barPadding:Mc("preserve",Rc),roundedTop:Mc("preserve",Rc),baselinePadding:Mc("preserve",Rc),innerRadius:Mc("preserve",Rc),cornerRadius:Mc("preserve",Rc),startAngle:Mc("preserve",Rc),sweepAngle:Mc("preserve",Rc),trackFill:Mc("preserve",Rc),showOutliers:Mc("preserve",Rc),showIQR:Mc("preserve",Rc),amplitude:Mc("preserve",Rc),connectorOpacity:Mc("preserve",Rc),showLabels:Mc("preserve",Rc),dynamicColumnWidth:Mc("rebuild",Rc),customLayout:Mc("preserve",Rc),layoutConfig:Mc("preserve",Rc),layoutMargin:Mc("preserve",Rc),symbolMap:Mc("preserve",Pc),pieceStyle:Mc("preserve",Lc),summaryStyle:Mc("preserve",Lc),connectorStyle:Mc("preserve",Lc),gradientFill:Mc("preserve",Lc),colorScheme:Mc("preserve",Lc),themeCategorical:Mc("preserve",Lc),themeSemantic:Mc("preserve",Lc),themeSequential:Mc("preserve",Lc),themeDiverging:Mc("preserve",Lc),barColors:Mc("preserve",Lc),decay:Mc("preserve",Lc),pulse:Mc("preserve",Lc),staleness:Mc("preserve",Lc),layoutSelection:Mc("preserve",Lc),windowSize:Mc("preserve",Tc),windowMode:Mc("preserve",Tc),clock:Mc("preserve",Tc),transition:Mc("preserve",Tc),introAnimation:Mc("preserve",Tc),onLayoutError:Mc("preserve",Tc)},$c=Mc("preserve",Rc),Nc=class{constructor(){this.tracker=new ro}get last(){return this.tracker.last}subscribe(e){return this.tracker.subscribe(e)}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"},Cc):this.recordNoop("restyle")}recordConfig(e){const t=function(e){let t="preserve";const o=new Set;for(const n of e){const e=Ic[n]??$c;"rebuild"===e.retainedData&&(t="rebuild");for(const t of e.invalidations)o.add(t)}return{retainedData:t,invalidations:o}}(e);return this.tracker.record({kind:"config",keys:e},t.invalidations)}},Dc=require("d3-quadtree"),Ec=class{constructor(e){this.rExtent=new oe,this.rExtents=[],this.windowSizeWarned=!1,this.updateResults=new Nc,this.rAccessors=[],this.categories=new Set,this._hasStreamingData=!1,this.styleResolver=new pc,this.timestampBuffer=null,this.activeTransition=null,this.prevPositionMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this.scales=null,this.multiScales=[],this.scene=[],this.columns={},this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customLayoutFailedThisBuild=!1,this._customLayoutDiagnosticsWarned=new Set,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.version=0,this._dataVersion=0,this._bufferArrayCache=null,this._pointQuadtree=null,this._maxPointRadius=0,this._datumIndexCache=null,this._categoryIndexCache=null,this._hasRenderedOnce=!1,this.config=e,this.buffer=new te(e.windowSize),this.getO=se(e.categoryAccessor||e.oAccessor,"category");const t=e.valueAccessor||e.rAccessor;Array.isArray(t)?(this.rAccessors=t.map(e=>re(e,"value")),this.getR=this.rAccessors[0],this.rExtents=t.map(()=>new oe)):(this.getR=re(t,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=se(e.stackBy),this.getGroup=se(e.groupBy),this.getColor=se(e.colorAccessor),this.getSymbol=se(e.symbolAccessor),this.getConnector=se(e.connectorAccessor),this.getDataId=se(e.dataIdAccessor),e.pulse&&(this.timestampBuffer=new te(e.windowSize))}syncPulseTimestampBuffer(){var e,t,o,n;this.timestampBuffer=(e=!!this.config.pulse,t=this.buffer,o=this.timestampBuffer,n=this.currentTime(),e?null!=o&&o.capacity===t.capacity&&o.size===t.size?o:qt(t,n):null)}currentTime(){return this.config.clock?.()??Ue()}ingest(e){const t=this.currentTime();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(),Wt(this.buffer,e.totalSize||e.inserts.length,this.timestampBuffer);for(const o of e.inserts)Yt(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=Yt(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,n=this.scales,r=this.multiScales,i=this.columns;if(0===o.size)return this.scales=null,this.multiScales=[],this.scene=[],this.columns={},this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(o,this.getR);const s=this.getBufferArray(),a=t.projection||"vertical",l=t.oExtent||this.resolveCategories(s),c=this.computeValueDomain(s,l),u="horizontal"===a,d="radial"===a,h=Math.min(.9,Math.max(0,null!=t.barPadding?t.barPadding/("vertical"===a?e.width:e.height):.1));let f,p;if(d){f=(0,fc.scaleBand)().domain(l).range([0,1]).padding(0);const o=Math.min(e.width,e.height)/2,n=t.innerRadius||0;p=(0,fc.scaleLinear)().domain(c).range([n,o])}else u?(f=(0,fc.scaleBand)().domain(l).range([0,e.height]).padding(h),p=(0,fc.scaleLinear)().domain(c).range([0,e.width])):(f=(0,fc.scaleBand)().domain(l).range([0,e.width]).padding(h),p=(0,fc.scaleLinear)().domain(c).range([e.height,0]));this.scales={o:f,r:p,projection:a},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((n,r)=>{const i=this.rExtents[r];i.dirty&&i.recalculate(o,n);let[s,a]=i.extent;s===1/0&&(s=0,a=1);const l=a-s,c=l>0?l*(t.extentPadding??.05):1;return s-=c,a+=c,s>0&&(s=0),u?(0,fc.scaleLinear)().domain([s,a]).range([0,e.width]):(0,fc.scaleLinear)().domain([s,a]).range([e.height,0])}):[];let m=s;this.rAccessors.length>1&&(m=s.flatMap(e=>this.rAccessors.map((t,o)=>({...e,__rIndex:o,__rValue:t(e),__rName:this.resolveRAccessorName(o)})))),this.columns=this.buildColumns(m,l,f,a,e),this._customLayoutFailedThisBuild=!1;const g=this.buildSceneNodes(m,e);this._customLayoutFailedThisBuild?!0===this.lastCustomLayoutFailure?.preservedLastGoodScene?(this.scales=n,this.multiScales=r,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,s),this.config.pulse&&this.applyPulse(this.scene,s),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&this.prevPositionMap.size>0&&this.startTransition(),this.version++)}resolveRAccessorName(e){const t=this.config.valueAccessor||this.config.rAccessor,o=Array.isArray(t)?t[e]:t;return"string"==typeof o?o:"value"+e}resolveCategories(e){const t=this.config.oSort,o="streaming"===this.config.runtimeMode||this._hasStreamingData,n="auto"===t?void 0:t;let r=null;if(o){r=new Set;for(const t of e)r.add(this.getO(t))}const i=r?Array.from(this.categories).filter(e=>r.has(e)):Array.from(this.categories);if(o&&void 0===n){const e=Math.max(50,3*r.size);if(this.categories.size>e){let t=this.categories.size-e;for(const e of this.categories){if(0>=t)break;r.has(e)||(this.categories.delete(e),t--)}}return i}if(!1===n)return i;if("function"==typeof n)return i.sort(n);const s=new Map;for(const t of e){const e=this.getO(t);s.set(e,(s.get(e)||0)+Math.abs(this.getR(t)))}return i.sort("asc"===n?(e,t)=>(s.get(e)||0)-(s.get(t)||0):(e,t)=>(s.get(t)||0)-(s.get(e)||0))}computeValueDomain(e,t){return function(e){const{data:t,chartType:o,projection:n,normalize:r,rExtent:i,extentPadding:s=.05,baselinePadding:a,axisExtent:l,getO:c,getR:u,getStack:d,rawRExtent:h}=e,f=s;if("radial"===n&&("pie"===o||"donut"===o))return[0,1];let p=0,m=0;if("bar"===o&&d&&r)p=0,m=1;else if("bar"===o&&d){const e=new Map,o=new Map;for(const n of t){const t=c(n),r=u(n);0>r?o.set(t,(o.get(t)||0)+r):e.set(t,(e.get(t)||0)+r)}for(const t of e.values())t>m&&(m=t);for(const e of o.values())p>e&&(p=e)}else if("bar"===o){const e=new Map;for(const o of t){const t=c(o),n=u(o);e.set(t,(e.get(t)||0)+n)}for(const t of e.values())t>m&&(m=t),p>t&&(p=t)}else if("swimlane"===o){const e=new Map;for(const o of t){const t=c(o),n=Math.abs(u(o));e.set(t,(e.get(t)||0)+n)}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),p>t&&(p=t)}else{const e=h[0],t=h[1];e!==1/0&&(p=e),t!==-1/0&&(m=t)}i&&(null!=i[0]&&(p=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]&&(p>0&&(p=0),0>m&&(m=0)),"bar-funnel"!==o&&"exact"!==l){const e=m-p,t=e>0?e*f:1,n=g&&!a&&0===p,r=g&&!a&&0===m||"swimlane"===o;null!=i?.[0]||n||(p-=t),null!=i?.[1]||r||(m+=t)}return[p,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,n,r){return function(e){const{data:t,oExtent:o,oScale:n,projection:r,layout:i,dynamicColumnWidth:s,getO:a,getR:l}=e,c={},u=new Map;for(const e of t){const t=a(e);u.has(t)||u.set(t,[]),u.get(t).push(e)}let d=0;if("radial"===r)for(const e of t)d+=Math.abs(l(e));let h=null;if(s&&"radial"!==r){h=new Map;let e=0;for(const t of o){const o=u.get(t)||[];let n;n="string"==typeof s?o.reduce((e,t)=>e+(Number(t[s])||0),0):s(o),h.set(t,n),e+=n}const t=("horizontal"===r?i.height:i.width)-n.padding()*n.step()*o.length;if(e>0)for(const[o,n]of h)h.set(o,n/e*t)}let f=0,p=0;for(const e of o){const t=u.get(e)||[],o=t.reduce((e,t)=>e+Math.abs(l(t)),0),r=d>0?o/d:0;let i,s;h?(i=p,s=h.get(e)||n.bandwidth(),p+=s+n.padding()*n.step()):(i=n(e)??0,s=n.bandwidth()),c[e]={name:e,x:i,y:0,width:s,middle:i+s/2,padding:n.padding()*n.step(),pieceData:t,pct:r,pctStart:f},f+=r}return c}({data:e,oExtent:t,oScale:o,projection:n,layout:r,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.styleResolver.resolvePieceStyle(this.config,e,t),resolveSummaryStyle:(e,t)=>this.styleResolver.resolveSummaryStyle(this.config,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 n;try{n=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=n.overlays??null,this.lastCustomLayoutResult=n,this.lastCustomLayoutFailure=null;const r=n.nodes??[];if(this._customRestyle=n.restyle,this.hasCustomRestyle=!!n.restyle,this.hasCustomRestyle){this._baseStyles=new WeakMap;for(const e of r)e.style&&this._baseStyles.set(e,e.style);this.applyCustomRestyle(r,this.config.layoutSelection??null)}return $t({label:"ordinal customLayout",nodes:r,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned}),r}this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1;const o=this.getSceneContext(),n=kc[this.config.chartType];let r=n?n(o,t):[];if(this.getConnector&&this.scales){const e=function(e,t){const{scales:o,config:n,getConnector:r,getO:i}=e;if(!r||!o)return[];const s=[],{projection:a}=o,l=new Map;for(const e of t){if("point"!==e.type&&"rect"!==e.type)continue;const t=e.datum;if(!t)continue;const o=r(t);if(!o)continue;let n,s;"point"===e.type?(n=e.x,s=e.y):(n=e.x+e.w/2,s=e.y+("vertical"===a?0:e.h/2)),l.has(o)||l.set(o,[]),l.get(o).push({x:n,y:s,datum:t,category:i(t)})}const c=o.o.domain(),u=n.connectorStyle;for(const[t,o]of l)if(o.length>=2){o.sort((e,t)=>c.indexOf(e.category)-c.indexOf(t.category));for(let n=0;o.length-1>n;n++){const r=o[n],i=o[n+1],a="function"==typeof u?u(r.datum):u||{stroke:e.config.themeSemantic?.border||e.config.themeSemantic?.secondary||"#999",strokeWidth:1,opacity:.5};s.push({type:"connector",x1:r.x,y1:r.y,x2:i.x,y2:i.y,style:a,datum:r.datum,group:t})}}return s}(o,r);r=[...e,...r]}return r}buildLayoutContext(e,t){const o=this.config,n=o.layoutMargin??{top:0,right:0,bottom:0,left:0},r=wc(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:n,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:[...r]},resolveColor:Sc(r,o.colorScheme),config:o.layoutConfig??{},selection:o.layoutSelection??null}}computeDecayOpacity(e,t){const o=this.config.decay;return o&&t>1?rt(o,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._dataVersion)return this._datumIndexCache.map;const t=it(e);return this._datumIndexCache={version:this._dataVersion,map:t},t}getCategoryIndexMap(e){if(this._categoryIndexCache&&this._categoryIndexCache.version===this._dataVersion)return this._categoryIndexCache.map;const t=function(e,t){const o="function"==typeof t,n=o?null:t||"category",r=new Map;for(let i=0;e.length>i;i++){const s=e[i],a=o?t(s):s[n],l=r.get(a);l?l.push(i):r.set(a,[i])}return r}(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 n of e)"point"===n.type&&(t++,n.r>o&&(o=n.r));if(500>=t)return{quadtree:null,maxRadius:o};const n=Array(t);let r=0;for(const t of e)"point"===t.type&&(n[r++]=t);return{maxRadius:o,quadtree:(0,Dc.quadtree)().x(e=>e.x).y(e=>e.y).addAll(n)}}(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 n=this.getDatumIndexMap(t);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;if(!t.datum)continue;const e=n.get(t.datum);if(null==e)continue;const r=this.computeDecayOpacity(e,o);t.style={...t.style,opacity:(t.style?.opacity??1)*r}}}applyPulse(e,t,o=this.currentTime()){return!(!this.config.pulse||!this.timestampBuffer)&&function(e,t,o,n,r,i){const s=e.color??"rgba(255,255,255,0.6)",a=e.glowRadius??4;let l=!1;for(const c of t){if("connector"===c.type||"violin"===c.type||"boxplot"===c.type)continue;if("wedge"===c.type){const t=c.category;if(!t)continue;let n=0;for(const s of r(t)??[]){const t=o.get(s);null!=t&&(n=Math.max(n,st(e,t,i)))}l=at(c,n,s)||l;continue}if(null==c.datum)continue;const t=n.get(c.datum);if(null==t)continue;const u=o.get(t);l=at(c,null==u?0:st(e,u,i),s,a)||l}return l}(this.config.pulse,e,this.timestampBuffer,this.getDatumIndexMap(t),e=>this.getCategoryIndexMap(t).get(e),o)}refreshPulse(e){return!0!==this.lastCustomLayoutFailure?.preservedLastGoodScene&&this.applyPulse(this.scene,this.getBufferArray(),e)}hasActivePulsesAt(e){return!!this.config.pulse&<(this.config.pulse,this.timestampBuffer,e)}get hasActivePulses(){return this.hasActivePulsesAt(this.currentTime())}synthesizeIntroPositions(){this.prevPositionMap.clear();const e=new Map,t=this.scales?.r(0)??0,o="horizontal"!==this.scales?.projection;let n;for(let r=0;this.scene.length>r;r++){const i=this.scene[r],s=this.getNodeKey(i,e);s&&("rect"===i.type?this.prevPositionMap.set(s,o?{x:i.x,y:t,w:i.w,h:0,opacity:i.style.opacity??1}:{x:t,y:i.y,w:0,h:i.h,opacity:i.style.opacity??1}):"point"===i.type?this.prevPositionMap.set(s,{x:i.x,y:i.y,r:0,opacity:0}):"wedge"===i.type&&(void 0===n&&(n=i.startAngle),this.prevPositionMap.set(s,{x:i.cx,y:i.cy,startAngle:n,endAngle:n,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}`,n=t.get(o)||0;return t.set(o,n+1),`${o}:${n}`}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],n=this.getNodeKey(o,e);n&&("point"===o.type?this.prevPositionMap.set(n,{x:o.x,y:o.y,r:o.r,opacity:o.style.opacity}):"rect"===o.type?this.prevPositionMap.set(n,{x:o.x,y:o.y,w:o.w,h:o.h,opacity:o.style.opacity}):"wedge"===o.type&&this.prevPositionMap.set(n,{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,n=new Map;for(let e=0;this.scene.length>e;e++){const r=this.scene[e],i=this.getNodeKey(r,n);if(!i)continue;r._transitionKey=i;const s=this.prevPositionMap.get(i);if("point"===r.type)s?(o.add(i),r._targetOpacity=r.style.opacity??1,(s.x!==r.x||s.y!==r.y||void 0!==s.r&&s.r!==r.r)&&(r._targetX=r.x,r._targetY=r.y,r._targetR=r.r,r.x=s.x,r.y=s.y,void 0!==s.r&&(r.r=s.r),t=!0)):(r._targetOpacity=r.style.opacity??1,r._targetR=r.r,r.r=0,r.style={...r.style,opacity:0},t=!0);else if("rect"===r.type)s?(o.add(i),r._targetOpacity=r.style.opacity??1,s.x===r.x&&s.y===r.y&&s.w===r.w&&s.h===r.h||(r._targetX=r.x,r._targetY=r.y,r._targetW=r.w,r._targetH=r.h,r.x=s.x,r.y=s.y,r.w=s.w??r.w,r.h=s.h??r.h,t=!0)):(r._targetOpacity=r.style.opacity??1,r.style={...r.style,opacity:0},t=!0);else if("wedge"===r.type)if(s)o.add(i),r._targetOpacity=r.style.opacity??1,s.startAngle===r.startAngle&&s.endAngle===r.endAngle||(r._targetStartAngle=r.startAngle,r._targetEndAngle=r.endAngle,r.startAngle=s.startAngle,r.endAngle=s.endAngle,t=!0);else{r._targetOpacity=r.style.opacity??1,r._targetStartAngle=r.startAngle,r._targetEndAngle=r.endAngle;const e=r.startAngle;r.startAngle=e,r.endAngle=e,r.style={...r.style,opacity:0},this.prevPositionMap.set(i,{x:r.cx,y:r.cy,startAngle:e,endAngle:e,innerRadius:r.innerRadius,outerRadius:r.outerRadius,opacity:0}),t=!0}}this.exitNodes=[];for(const[e,n]of this.prevPositionMap)if(!o.has(e)){if(e.startsWith("p:"))this.exitNodes.push({type:"point",x:n.x,y:n.y,r:n.r??3,style:{opacity:n.opacity??1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("r:"))this.exitNodes.push({type:"rect",x:n.x,y:n.y,w:n.w??0,h:n.h??0,style:{opacity:n.opacity??1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("w:")){const t=((n.startAngle??0)+(n.endAngle??0))/2,o={type:"wedge",cx:n.x,cy:n.y,innerRadius:n.innerRadius??0,outerRadius:n.outerRadius??100,startAngle:n.startAngle??0,endAngle:n.endAngle??0,style:{opacity:n.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:this.currentTime(),duration:e})}advanceTransition(e){if(!this.activeTransition)return!1;const t=Ve(e,this.activeTransition),o=Ge(t,"linear"===this.config.transition?.easing?"linear":"ease-out-cubic");for(const e of this.scene){const t=e._transitionKey;if(t)if("point"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t);e.style.opacity=Xe(n?n.opacity??1:0,e._targetOpacity,o)}const n=this.prevPositionMap.get(t);void 0!==e._targetX&&n&&(e.x=Xe(n.x,e._targetX,o),e.y=Xe(n.y,e._targetY,o)),void 0!==e._targetR&&void 0!==n?.r&&(e.r=Xe(n.r,e._targetR,o))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t);e.style.opacity=Xe(n?n.opacity??1:0,e._targetOpacity,o)}if(void 0===e._targetX)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=Xe(n.x,e._targetX,o),e.y=Xe(n.y,e._targetY,o),void 0!==n.w&&(e.w=Xe(n.w,e._targetW,o),e.h=Xe(n.h,e._targetH,o))}else if("wedge"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t);e.style={...e.style,opacity:Xe(n?n.opacity??1:0,e._targetOpacity,o)}}if(void 0!==e._targetStartAngle&&void 0!==e._targetEndAngle){const n=this.prevPositionMap.get(t);n&&void 0!==n.startAngle&&(e.startAngle=Xe(n.startAngle,e._targetStartAngle,o),e.endAngle=Xe(n.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()}remove(e){if(!this.getDataId)throw Error("remove() requires dataIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=ue(e),o=this.getDataId,n=e=>t.has(o(e));Gt(this.buffer,this.timestampBuffer,n);const r=this.buffer.remove(n);if(0===r.length)return this.updateResults.recordNoop("remove"),r;for(const e of r)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach(e=>this.categories.add(this.getO(e))),this._dataVersion++,this.version++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("remove",r.length),r}update(e,t){if(!this.getDataId)throw Error("update() requires dataIdAccessor to be configured");const o=ue(e),n=this.getDataId,r=new Set;this.buffer.forEach((e,t)=>{o.has(n(e))&&r.add(t)});const i=this.buffer.update(e=>o.has(n(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)),r.has(t)&&this.pushValueExtent(e)}),this._dataVersion++,this.version++,this.lastIngestTime=this.currentTime(),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.styleResolver.resetColors(),this._dataVersion++,this.version++,this.updateResults.recordData("clear")}get size(){return this.buffer.size}getOAccessor(){return this.getO}getRAccessor(){return this.getR}applyCustomRestyle(e,t){const o=this._customRestyle;if(o)for(const n of e){const e=this._baseStyles.get(n)??n.style??{},r=o(n,t);n.style=r?{...e,...r}: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&&!ne(e.colorAccessor,t.colorAccessor))&&this.styleResolver.resetColors(),("categoryAccessor"in e&&!ne(e.categoryAccessor,t.categoryAccessor)||"oAccessor"in e&&!ne(e.oAccessor,t.oAccessor))&&(this._categoryIndexCache=null),Object.assign(this.config,e),"pulse"in e&&this.syncPulseTimestampBuffer();let n=!1;("categoryAccessor"in e||"oAccessor"in e)&&(ne(this.config.categoryAccessor||this.config.oAccessor,t.categoryAccessor||t.oAccessor)||(this.getO=se(this.config.categoryAccessor||this.config.oAccessor,"category"),n=!0));let r=!1;if("valueAccessor"in e||"rAccessor"in e){const e=this.config.valueAccessor||this.config.rAccessor,o=t.valueAccessor||t.rAccessor,n=Array.isArray(e)?e:[e],i=Array.isArray(o)?o:[o];if(r=n.length!==i.length||n.some((e,t)=>!ne(e,i[t])),r){const e=this.config.valueAccessor||this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>re(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new oe)):(this.getR=re(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!ne(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?se(this.config.stackBy):void 0),"groupBy"in e&&!ne(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?se(this.config.groupBy):void 0),"colorAccessor"in e&&!ne(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?se(this.config.colorAccessor):void 0),"symbolAccessor"in e&&!ne(e.symbolAccessor,t.symbolAccessor)&&(this.getSymbol=null!=this.config.symbolAccessor?se(this.config.symbolAccessor):void 0),"connectorAccessor"in e&&!ne(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?se(this.config.connectorAccessor):void 0),(n||r||"accessorRevision"in e&&e.accessorRevision!==t.accessorRevision)&&this.rebuildAccessorDerivedState(),this.updateResults.recordConfig(o)}updateConfigWithResult(e){return this.updateConfig(e),this.updateResults.last}};function Bc(e,t,o,n=30,r,i=0){let s=null;if(r){const e=rn(r,t,o,n,i);e&&(s={datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const i of e){let e=null;switch(i.type){case"rect":if(null==i.datum)break;e=Fc(i,t,o);break;case"point":if(r)break;e=Hc(i,t,o,n);break;case"symbol":e=Oc(i,t,o,n);break;case"glyph":e=zc(i,t,o,n);break;case"wedge":if(null===i.datum)break;e=Wc(i,t,o);break;case"boxplot":e=qc(i,t,o);break;case"violin":e=Yc(i,t,o)}e&&n>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}function Fc(e,t,o){const n=qo(t,o,e);return n.hit?{datum:e.datum,x:n.cx,y:e.y,distance:0,category:e.group}:null}function Hc(e,t,o,n=30){const r=t-e.x,i=o-e.y,s=Math.sqrt(r*r+i*i);return s>Yo(e.r,n)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function Oc(e,t,o,n=30){const r=t-e.x,i=o-e.y,s=Math.sqrt(r*r+i*i);return s>Yo(Lt(e.size),n)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function zc(e,t,o,n=30){if(null==e.datum)return null;const r=on(e.glyph,e.size),i=e.x+r.centerDx,s=e.y+r.centerDy,a=t-i,l=o-s,c=Math.sqrt(a*a+l*l);return c>Yo(r.radius,n)?null:{datum:e.datum,x:i,y:s,distance:c}}function Wc(e,t,o){const n=t-e.cx,r=o-e.cy,i=Math.sqrt(n*n+r*r);if(e.innerRadius>i||i>e.outerRadius)return null;const s=Xo(Math.atan2(r,n)),a=Xo(e.startAngle),l=Xo(e.endAngle);if(!(a>l?s>=a||l>=s:s>=a&&l>=s))return null;const c=(e.startAngle+e.endAngle)/2,u=(e.innerRadius+e.outerRadius)/2;return{datum:e.datum,x:e.cx+Math.cos(c)*u,y:e.cy+Math.sin(c)*u,distance:0,category:e.category}}function qc(e,t,o){const n=e.columnWidth/2;if("vertical"===e.projection){if(!(e.x-n>t||t>e.x+n||Math.min(e.minPos,e.maxPos)>o||o>Math.max(e.minPos,e.maxPos)))return{datum:e.datum,x:e.x,y:e.medianPos,distance:0,category:e.category,stats:e.stats}}else{const r=e.y-n,i=e.y+n;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||r>o||o>i))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category,stats:e.stats}}return null}function Yc(e,t,o){if(!e.bounds)return null;const{x:n,y:r,width:i,height:s}=e.bounds;return n>t||t>n+i||r>o||o>r+s?null:{datum:e.datum,x:n+i/2,y:r+s/2,distance:0,category:e.category,stats:e.stats}}eo(Ec);var Gc=require("react"),Vc=require("react/jsx-runtime");function Xc(e){const{width:t,height:o,totalWidth:n,totalHeight:r,margin:i,scales:s,showAxes:a,showGrid:l,rFormat:c}=e,{rTickValues:u,axisExtent:d}=e,h="radial"===s?.projection,f="horizontal"===s?.projection,p=(0,Gc.useMemo)(()=>!s||h?[]:(u||Fi(s.r,5,d)).map(e=>({value:e,pixel:s.r(e),label:(c||Uc)(e)})),[s,c,h,u,d]),m=l&&s&&!h,g=a&&s&&!h;return m||g?(0,Vc.jsx)("svg",{width:n,height:r,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:(0,Vc.jsxs)("g",{transform:`translate(${i.left},${i.top})`,children:[m&&(0,Vc.jsx)("g",{className:"ordinal-grid",children:p.map((e,n)=>(0,Vc.jsx)("line",{x1:f?e.pixel:0,y1:f?0:e.pixel,x2:f?e.pixel:t,y2:f?o:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+n))}),g&&(0,Vc.jsx)(Vc.Fragment,{children:(0,Vc.jsxs)(Vc.Fragment,f?{children:[(0,Vc.jsx)("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),(0,Vc.jsx)("line",{x1:0,y1:o,x2:t,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]}:{children:[(0,Vc.jsx)("line",{x1:0,y1:o,x2:t,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),(0,Vc.jsx)("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]})})]})}):null}function Uc(e){return Math.round(100*e)/100+""}function Kc(e){const{width:t,height:o,totalWidth:n,totalHeight:r,margin:i,scales:s,showAxes:a,showCategoryTicks:l,oLabel:c,rLabel:u,oFormat:d,rFormat:h,showGrid:f,title:p,legend:m,legendHoverBehavior:g,legendClickBehavior:y,legendHighlightedCategory:b,legendIsolatedCategories:v,legendPosition:x="right",legendLayout:k,foregroundGraphics:w,annotations:S,onAnnotationActivate:A,onObservation:C,chartId:M,chartType:_,autoPlaceAnnotations:j,svgAnnotationRules:R,xAccessor:P,yAccessor:L,annotationData:T,underlayRendered:I,canvasObscuresUnderlay:$=!0,children:N}=e,D=Kr({onAnnotationActivate:A,onObservation:C,chartId:M,chartType:_}),E="radial"===s?.projection,B="horizontal"===s?.projection,F=!1!==l,H=!I||$,O=(0,Gc.useMemo)(()=>{if(!a||!F||!s||E)return[];const e=s.o.bandwidth(),t=s.o.domain().map((t,o)=>({value:t,pixel:(s.o(t)??0)+e/2,label:d?d(t,o):t}));if(2>=t.length)return t;const o=Math.abs(t[1].pixel-t[0].pixel)||e,n=t.map(e=>{return t=e.label,B?"string"==typeof t||"number"==typeof t?16:24:"string"==typeof t||"number"==typeof t?6.5*(t+"").length:60;var t}),r=B?0:6;if(n.every((e,t)=>0===t||o>=(n[t-1]+e)/2+r))return t;const i=Math.max(...n)+r,l=Math.max(1,Math.ceil(i/o));return 1===l?t:t.filter((e,t)=>t%l===0)},[a,F,s,d,E,B]),z=e.rTickValues,W=e.tickLabelEdgeAlign,q=e.axisExtent,Y=(0,Gc.useMemo)(()=>a&&s&&!E?(z||Fi(s.r,5,q)).map(e=>({value:e,pixel:s.r(e),label:(h||Uc)(e)})):[],[a,s,h,E,z,q]),G=(0,Gc.useRef)(new Map),V=(0,Gc.useRef)(S?.length??0),X=S?.length??0;V.current!==X&&(V.current=X,G.current=new Map);const U=(0,Gc.useMemo)(()=>{if(!S||0===S.length)return null;const e=li(0,D),n="horizontal"===s?.projection,r=s?.o?e=>(s.o(e)??0)+s.o.bandwidth()/2:null,i={scales:s?{x:n?s.r:r||s.r,y:n&&r||s.r,time:s.r,value:s.r,o:s.o}:null,timeAxis:"x",xAccessor:P,yAccessor:L,width:t,height:o,data:T,frameType:"ordinal",projection:n?"horizontal":"vertical",stickyPositionCache:G.current};return ai(j?_i({annotations:S,context:i,..."object"==typeof j?j:{}}):S,e,R,i)},[S,j,R,t,o,s,P,L,T,D]);return a||p||m||w||U&&U.length>0||f||N?(0,Vc.jsxs)("svg",{role:"img",width:n,height:r,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[(0,Vc.jsx)("title",{children:"string"==typeof p?p:"Ordinal Chart"}),(0,Vc.jsx)("desc",{children:"string"==typeof p?p+" — ordinal data visualization":"Ordinal data visualization"}),(0,Vc.jsxs)("g",{transform:`translate(${i.left},${i.top})`,children:[f&&s&&!E&&H&&(0,Vc.jsx)("g",{className:"ordinal-grid",children:Y.map((e,n)=>(0,Vc.jsx)("line",{x1:B?e.pixel:0,y1:B?0:e.pixel,x2:B?e.pixel:t,y2:B?o:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+n))}),a&&s&&!E&&(()=>{const e={fontSize:"var(--semiotic-tick-font-size, 12px)"},n={fontSize:"var(--semiotic-axis-label-font-size, 12px)"};return(0,Vc.jsx)("g",{className:"ordinal-axes",children:(0,Vc.jsxs)(Vc.Fragment,B?{children:[(0,Vc.jsxs)("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[H&&(0,Vc.jsx)("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),O.map((t,o)=>(0,Vc.jsxs)("g",{transform:`translate(0,${t.pixel})`,children:[(0,Vc.jsx)("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?(0,Vc.jsx)("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label}):(0,Vc.jsx)("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:(0,Vc.jsx)("div",{style:{textAlign:"right",userSelect:"none",...e},children:t.label})})]},"cat-"+o)),c&&(0,Vc.jsx)("text",{x:15-i.left,y:o/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-i.left}, ${o/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...n},children:c})]}),(0,Vc.jsxs)("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[H&&(0,Vc.jsx)("line",{x1:0,y1:o,x2:t,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),H&&s?.r&&(()=>{const e=s.r(0);return e>1&&t-1>e?(0,Vc.jsx)("line",{x1:e,y1:0,x2:e,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1,strokeDasharray:"4,4"}):null})(),Y.map((t,n)=>{const r=W?0===n?"start":n===Y.length-1?"end":"middle":"middle";return(0,Vc.jsxs)("g",{transform:`translate(${t.pixel},${o})`,children:[(0,Vc.jsx)("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),(0,Vc.jsx)("text",{y:18,textAnchor:r,fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label})]},"val-"+n)}),u&&(0,Vc.jsx)("text",{x:t/2,y:o+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:{userSelect:"none",...n},children:u})]})]}:{children:[(0,Vc.jsxs)("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[H&&(()=>{const e=s?.r?s.r(0):o,n=0>e||e>o?o:e;return(0,Vc.jsx)("line",{x1:0,y1:n,x2:t,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),O.map((t,n)=>(0,Vc.jsxs)("g",{transform:`translate(${t.pixel},${o})`,children:[(0,Vc.jsx)("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?(0,Vc.jsx)("text",{y:18,textAnchor:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label}):(0,Vc.jsx)("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:(0,Vc.jsx)("div",{style:{textAlign:"center",userSelect:"none",...e},children:t.label})})]},"cat-"+n)),c&&(0,Vc.jsx)("text",{x:t/2,y:o+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:{userSelect:"none",...n},children:c})]}),(0,Vc.jsxs)("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[H&&(0,Vc.jsx)("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),Y.map((t,o)=>(0,Vc.jsxs)("g",{transform:`translate(0,${t.pixel})`,children:[(0,Vc.jsx)("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),(0,Vc.jsx)("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label})]},"val-"+o)),u&&(0,Vc.jsx)("text",{x:15-i.left,y:o/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-i.left}, ${o/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...n},children:u})]})]})})})(),U,w,N]}),p&&"string"==typeof p?(0,Vc.jsx)("text",{x:n/2,y:22,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:p}):p?(0,Vc.jsx)("foreignObject",{x:0,y:0,width:n,height:i.top,children:p}):null,mr({legend:m,totalWidth:n,totalHeight:r,margin:i,legendPosition:x,title:p,legendLayout:k,legendHoverBehavior:g,legendClickBehavior:y,legendHighlightedCategory:b,legendIsolatedCategories:v})]}):null}var Zc=require("react"),Qc=require("d3-selection"),Jc=require("d3-brush"),eu=require("react/jsx-runtime");function tu({width:e,height:t,totalWidth:o,totalHeight:n,margin:r,scales:i,onBrush:s}){const a=(0,Zc.useRef)(null),l=(0,Zc.useRef)(null),c=(0,Zc.useRef)(s);c.current=s;const u=(0,Zc.useRef)(i);u.current=i;const d=(0,Zc.useRef)(!1),h=(0,Zc.useRef)(null),f="horizontal"===i?.projection,p=(0,Zc.useRef)(f);p.current=f;const m=I({label:"Ordinal value range brush",onAction:e=>{const t=u.current,o=l.current;if(!t||!o||!a.current)return;const n=(0,Qc.select)(a.current).select(".brush-g");if("clear"===e.type)return d.current=!0,n.call(o.move,null),d.current=!1,h.current=null,void c.current(null);if(("left"===e.direction||"right"===e.direction)!=!!p.current)return;const r=t.r.domain(),[i,s]=[Math.min(...r),Math.max(...r)],f=(s-i)/20,m=h.current?.r??[i+.4*(s-i),i+.6*(s-i)],g="left"===e.direction||"down"===e.direction?-1:1;let[y,b]=m;if(e.resize)0>g?y=Math.max(i,y-f):b=Math.min(s,b+f);else{const e=b-y;y=Math.max(i,Math.min(s-e,y+g*f)),b=y+e}const v={r:[y,b]};d.current=!0,n.call(o.move,p.current?[t.r(y),t.r(b)]:[t.r(b),t.r(y)]),d.current=!1,h.current=v,c.current(v)}});return(0,Zc.useEffect)(()=>{if(!a.current)return;const o=(0,Qc.select)(a.current).select(".brush-g"),n=f?(0,Jc.brushX)():(0,Jc.brushY)();return n.extent([[0,0],[e,t]]),n.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,n]=e.selection;let r;r=p.current?[t.r.invert(o),t.r.invert(n)]:[t.r.invert(n),t.r.invert(o)];const i={r:r};h.current=i,c.current(i)}),o.call(n),l.current=n,o.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{n.on("brush end",null),l.current=null}},[e,t,f]),(0,Zc.useEffect)(()=>{if(!i||!l.current||!h.current)return;if(!a.current)return;const e=h.current,t=(0,Qc.select)(a.current).select(".brush-g"),o=i.r(e.r[0]),n=i.r(e.r[1]);f?(d.current=!0,t.call(l.current.move,[o,n]),d.current=!1):(d.current=!0,t.call(l.current.move,[n,o]),d.current=!1)},[i,f]),(0,eu.jsxs)("svg",{ref:a,width:o,height:n,...m.svgProps,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[(0,eu.jsx)("title",{children:m.svgProps["aria-label"]}),(0,eu.jsx)("desc",{id:m.descriptionId,children:m.description}),(0,eu.jsx)("g",{className:"brush-g",transform:`translate(${r.left},${r.top})`,style:{pointerEvents:"all"}})]})}var ou=require("d3-shape");function nu(e,t){const o=t._gradientBand.colors;if(0===o.length)return;const{clipPath:n,slices:r}=os({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(n);e.save(),e.translate(t.cx,t.cy),e.clip(i);for(const t of r)e.fillStyle=hn(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=hn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(i),e.restore())}function ru(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 iu(e,t){const o={innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle+Math.PI/2,endAngle:t.endAngle+Math.PI/2},n=(0,ou.arc)().cornerRadius(t.cornerRadius)(o);if(!n)return;e.save(),e.translate(t.cx,t.cy);const r=new Path2D(n);e.fill(r),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(r),e.restore()}var su=(e,t,o,n)=>{const r=t.filter(e=>"wedge"===e.type);for(const t of r)if(e.globalAlpha=(t.style.fillOpacity??1)*(t.style.opacity??1),t._gradientBand&&t._gradientBand.colors.length>0)nu(e,t),t._pulseIntensity&&t._pulseIntensity>0&&(ru(e,t),cl(e,t)),e.globalAlpha=1;else{if(e.fillStyle=Cn(e,t.style.fill,"#007bff"),t.roundedEnds){t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=hn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1);const o=ts({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,cornerRadius:t.cornerRadius,roundStart:t.roundedEnds.start,roundEnd:t.roundedEnds.end});e.save(),e.translate(t.cx,t.cy);const n=new Path2D(o);e.fill(n),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(n),e.restore()}else t.cornerRadius?(t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=hn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1),iu(e,t)):(ru(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=hn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()));t._pulseIntensity&&t._pulseIntensity>0&&(ru(e,t),cl(e,t)),e.globalAlpha=1}},au=(e,t,o,n)=>{const r=t.filter(e=>"boxplot"===e.type);for(const t of r){const o=t.columnWidth/2,n="vertical"===t.projection,r=hn(e,"var(--semiotic-primary, #007bff)"),i=hn(e,"var(--semiotic-text, #333)"),s=Cn(e,t.style.fill,r),a=t.style.stroke,l="string"==typeof a?hn(e,a)||a:i,c=t.style.strokeWidth||1,u=t.style.fillOpacity??t.style.opacity??.6;if(e.save(),e.strokeStyle=l,e.lineWidth=c,e.beginPath(),n?(e.moveTo(t.x,t.minPos),e.lineTo(t.x,t.maxPos)):(e.moveTo(t.minPos,t.y),e.lineTo(t.maxPos,t.y)),e.stroke(),e.beginPath(),n?(e.moveTo(t.x-.4*o,t.minPos),e.lineTo(t.x+.4*o,t.minPos),e.moveTo(t.x-.4*o,t.maxPos),e.lineTo(t.x+.4*o,t.maxPos)):(e.moveTo(t.minPos,t.y-.4*o),e.lineTo(t.minPos,t.y+.4*o),e.moveTo(t.maxPos,t.y-.4*o),e.lineTo(t.maxPos,t.y+.4*o)),e.stroke(),e.globalAlpha=u,e.fillStyle=s,n){const n=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-o,n,t.columnWidth,r),e.globalAlpha=1,e.strokeRect(t.x-o,n,t.columnWidth,r)}else{const n=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(n,t.y-o,r,t.columnWidth),e.globalAlpha=1,e.strokeRect(n,t.y-o,r,t.columnWidth)}e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),n?(e.moveTo(t.x-o,t.medianPos),e.lineTo(t.x+o,t.medianPos)):(e.moveTo(t.medianPos,t.y-o),e.lineTo(t.medianPos,t.y+o)),e.stroke(),e.restore()}},lu=(e,t,o,n)=>{const r=t.filter(e=>"violin"===e.type);for(const t of r){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=Cn(e,t.style.fill,"#007bff"),e.fill(o),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=hn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(o)),t.iqrLine){e.strokeStyle="#333",e.lineWidth=2,e.globalAlpha=.8;const o=t.iqrLine.centerPos,n=!1!==t.iqrLine.isVertical;e.beginPath(),n?(e.moveTo(o,t.iqrLine.q1Pos),e.lineTo(o,t.iqrLine.q3Pos)):(e.moveTo(t.iqrLine.q1Pos,o),e.lineTo(t.iqrLine.q3Pos,o)),e.stroke(),e.beginPath(),n?e.arc(o,t.iqrLine.medianPos,3,0,2*Math.PI):e.arc(t.iqrLine.medianPos,o,3,0,2*Math.PI),e.fillStyle="#fff",e.fill(),e.strokeStyle="#333",e.lineWidth=1,e.stroke(),e.globalAlpha=1}e.restore()}},cu=(e,t,o,n)=>{const r=t.filter(e=>"connector"===e.type);if(0===r.length)return;const i=new Map;for(const e of r){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=Mn(e,o.fill)??"#999",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=hn(e,o.style.stroke)||Cn(e,o.style.fill,"")||hn(e,"var(--semiotic-border, #999)"),e.lineWidth=o.style.strokeWidth||1,e.globalAlpha=o.style.opacity??.5,e.stroke(),e.globalAlpha=1}},uu=(e,t,o,n)=>{const r=t.filter(e=>"trapezoid"===e.type);for(const t of r){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=Mn(e,t.style?.fill)||"#999",e.fill(),t.style?.stroke&&(e.strokeStyle=hn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}};function du(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 hu(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}var fu=new Map;function pu(e,t){const o=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,n=fu.get(o);if(void 0!==n)return n;const r=mn({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return fu.set(o,r),r}function mu(e,t,o,n,r,i){e.moveTo(t+i,o),e.lineTo(t+n-i,o),e.quadraticCurveTo(t+n,o,t+n,o+i),e.lineTo(t+n,o+r-i),e.quadraticCurveTo(t+n,o+r,t+n-i,o+r),e.lineTo(t+i,o+r),e.quadraticCurveTo(t,o+r,t,o+r-i),e.lineTo(t,o+i),e.quadraticCurveTo(t,o,t+i,o),e.closePath()}function gu(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 yu(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}function bu(e){return"rect"===e.type||"point"===e.type||"symbol"===e.type||"glyph"===e.type}function vu(e){return(t,o,n,r)=>{e(t,o.filter(bu),{x:n.r,y:n.r},r)}}var xu=vu(kl),ku=vu(fl),wu=vu(gl),Su=vu(bl),Au=e=>[cu,...e],Cu={bar:Au([xu]),clusterbar:Au([xu]),point:Au([ku,wu]),swarm:Au([ku,wu]),pie:[su],donut:[su],boxplot:Au([au,ku]),violin:Au([lu]),histogram:Au([xu]),ridgeline:Au([lu]),timeline:Au([xu]),funnel:[xu,uu,(e,t,o,n)=>{const r=t.filter(e=>"rect"===e.type&&null!=e.datum);if(0!==r.length&&r.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 r){const o=t.datum;if(!o)continue;if(!o.__funnelStepLabel)continue;const n=o.__funnelStepLabel;if(e.measureText(n).width+16>(o.__funnelRowWidth??o.__funnelBarW??0))continue;const r=o.__funnelStepLabelX,i=o.__funnelStepLabelY+3;e.strokeStyle="rgba(0,0,0,0.6)",e.lineWidth=3,e.strokeText(n,r,i),e.fillStyle="#fff",e.fillText(n,r,i)}e.font="bold 13px sans-serif";for(const t of r){const o=t.datum;if(!o)continue;if(null==o.__funnelValueLabelX)continue;const n=o.__funnelBarW??0;if(60>n)continue;const r=o.__funnelValue;if(null==r||0===r)continue;const i=o.__funnelPercent,s=!0===o.__funnelIsFirstStep;let a;if(a=s?du(r):null!=i?`${du(r)} (${hu(i)})`:du(r),e.measureText(a).width+16>n){if(s||null==i)continue;if(a=du(r),e.measureText(a).width+16>n)continue}const l=o.__funnelValueLabelX,c=(o.__funnelValueLabelY??t.y)+14+5;e.textAlign="center",e.strokeStyle="rgba(0,0,0,0.5)",e.lineWidth=3,e.strokeText(a,l,c),e.fillStyle="#fff",e.fillText(a,l,c)}e.lineWidth=1,e.lineJoin="miter"}}],"bar-funnel":[xu,(e,t,o,n)=>{const r=t.filter(e=>"rect"===e.type&&!0===e.datum?.__barFunnelIsDropoff);for(const t of r){const o=("string"==typeof t.style.fill?t.style.fill:null)||hn(e,"var(--semiotic-border, #999)"),n=pu(o,e);e.globalAlpha=t.style.opacity??1,e.beginPath(),e.rect(t.x,t.y,t.w,t.h),n?e.fillStyle=n:(e.fillStyle=o,e.globalAlpha=.4*(t.style.opacity??1)),e.fill(),e.globalAlpha=1}},(e,t,o,n)=>{const r=t.filter(e=>"rect"===e.type&&!0!==e.datum?.__barFunnelIsDropoff&&null!=e.datum?.__barFunnelLabelX);if(0===r.length)return;const i=function(e,t){const[o,n,r]=fn(e,t);return(.2126*o+.7152*n+.0722*r)/255>.6}(e,hn(e,"var(--semiotic-text, #333)")),s=i?"#1f2937":"#ffffff",a=i?"rgba(255,255,255,0.18)":"rgba(0,0,0,0.12)",l=i?"#f3f4f6":"#1a1a1a",c=l;for(const t of r){const o=t.datum;if(!o)continue;const n=o.__barFunnelValue;if(null==n)continue;if(25>t.w)continue;const r=o.__barFunnelPercent,i=!(!0===o.__barFunnelIsFirstStep)&&null!=r,u=i?yu(r):"",d=gu(n);e.font="bold 13px sans-serif";const h=i?e.measureText(u).width:0;e.font="11px sans-serif";const f=e.measureText(d).width,p=Math.max(h,f)+12,m=i?32:17,g=o.__barFunnelLabelX,y=g-p/2,b=o.__barFunnelLabelY-m-4;e.save(),e.shadowColor="rgba(0,0,0,0.15)",e.shadowBlur=4,e.shadowOffsetY=1,e.fillStyle=s,e.beginPath(),mu(e,y,b,p,m,4),e.fill(),e.restore(),e.strokeStyle=a,e.lineWidth=.5,e.beginPath(),mu(e,y,b,p,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:Au([xu]),custom:Au([xu,ku,wu,Su,su,au,lu,uu])},Mu=require("react/jsx-runtime");function _u(e){const t=ma(e,{skipPositional:!1});return null==t.title&&0===t.entries.length?null:(0,Mu.jsxs)("div",{className:"semiotic-tooltip",style:ya,children:[null!=t.title&&(0,Mu.jsx)("div",{style:{fontWeight:"bold"},children:t.title+""}),t.entries.map(e=>(0,Mu.jsxs)("div",{children:[(0,Mu.jsxs)("span",{style:{opacity:.7},children:[e.key,":"]})," ","number"==typeof e.value?e.value.toLocaleString():e.value+""]},e.key))]})}function ju({hover:e}){const t=e.data||{},o=e.stats,n=e.category;if(Array.isArray(t)){const e=n||t[0]?.category||"";if(o)return(0,Mu.jsxs)("div",{className:"semiotic-tooltip",style:ya,children:[e&&(0,Mu.jsx)("div",{style:{fontWeight:"bold"},children:e+""}),(0,Mu.jsxs)("div",{children:["n = ",o.n]}),(0,Mu.jsxs)("div",{children:["Min: ",o.min.toLocaleString()]}),(0,Mu.jsxs)("div",{children:["Q1: ",o.q1.toLocaleString()]}),(0,Mu.jsxs)("div",{children:["Median: ",o.median.toLocaleString()]}),(0,Mu.jsxs)("div",{children:["Q3: ",o.q3.toLocaleString()]}),(0,Mu.jsxs)("div",{children:["Max: ",o.max.toLocaleString()]}),(0,Mu.jsxs)("div",{style:{opacity:.8},children:["Mean: ",o.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});const r=t.length;return(0,Mu.jsxs)("div",{className:"semiotic-tooltip",style:ya,children:[e&&(0,Mu.jsx)("div",{style:{fontWeight:"bold"},children:e+""}),(0,Mu.jsxs)("div",{children:[r," items"]})]})}if(null!=t.bin&&null!=t.count){const e=t.range||[];return(0,Mu.jsxs)("div",{className:"semiotic-tooltip",style:ya,children:[t.category&&(0,Mu.jsx)("div",{style:{fontWeight:"bold"},children:t.category+""}),(0,Mu.jsxs)("div",{children:["Count: ",t.count]}),2===e.length&&(0,Mu.jsxs)("div",{style:{opacity:.8},children:[Number(e[0]).toFixed(1)," – ",Number(e[1]).toFixed(1)]})]})}const r=e.__oAccessor,i=e.__rAccessor,s=e.__chartType;if("swarm"===s||"point"===s)return _u(t);const a=(r&&null!=t[r]?t[r]:null)||t.category||t.name||t.group||t.__rName||"",l=t.__aggregateValue??(i&&null!=t[i]?t[i]:null)??t.value??t.__rValue??t.pct??"";return a||""!==l?(0,Mu.jsxs)("div",{className:"semiotic-tooltip",style:ya,children:[a&&(0,Mu.jsx)("div",{style:{fontWeight:"bold"},children:a+""}),""!==l&&(0,Mu.jsx)("div",{children:"number"==typeof l?l.toLocaleString():l+""})]}):_u(t)}ju.ownsChrome=!0;var Ru=require("react/jsx-runtime"),Pu={top:50,right:40,bottom:60,left:70},Lu=(0,hc.memo)((0,hc.forwardRef)(function(e,t){const{chartType:o,runtimeMode:n,data:r,oAccessor:i="category",rAccessor:s="value",colorAccessor:a,symbolAccessor:l,symbolMap:c,stackBy:u,groupBy:d,multiAxis:h,timeAccessor:f,valueAccessor:p,categoryAccessor:m,accessorRevision:g,projection:y="vertical",size:b=[600,400],responsiveWidth:v,responsiveHeight:x,margin:k,barPadding:w,roundedTop:S,gradientFill:A,trackFill:C,baselinePadding:M,innerRadius:_,cornerRadius:j,normalize:R,startAngle:P,sweepAngle:L,dynamicColumnWidth:T,bins:I,showOutliers:$,showIQR:N,amplitude:D,connectorOpacity:E,showLabels:B,connectorAccessor:F,connectorStyle:z,dataIdAccessor:W,rExtent:q,oExtent:Y,extentPadding:V=.05,oSort:X,windowMode:U="sliding",windowSize:K=200,pieceStyle:Z,summaryStyle:Q,renderMode:J,colorScheme:ee,barColors:te,showAxes:oe=!0,showCategoryTicks:ne,categoryLabel:re,valueLabel:ie,categoryFormat:se,valueFormat:ae,oLabel:le,rLabel:ce,oFormat:ue,rFormat:de,rTickValues:he,tickLabelEdgeAlign:fe,axisExtent:pe,enableHover:me=!0,hoverAnnotation:ge,tooltipContent:ye,customHoverBehavior:be,customClickBehavior:ve,onObservation:xe,annotationObservationCallback:ke,chartId:we,annotations:Se,onAnnotationActivate:Ae,autoPlaceAnnotations:Ce,svgAnnotationRules:Me,showGrid:_e=!1,legend:je,legendHoverBehavior:Re,legendClickBehavior:Pe,legendHighlightedCategory:Le,legendIsolatedCategories:Te,legendPosition:Ie,legendLayout:$e,legendCategoryAccessor:Ne,onCategoriesChange:De,backgroundGraphics:Ee,foregroundGraphics:Be,title:Fe,className:He,background:Oe,centerContent:ze,decay:We,pulse:qe,transition:Ye,animate:Ge,staleness:Ve,frameScheduler:Xe,clock:Ue,random:Ke,seed:Ze,paused:Qe=!1,suspendWhenHidden:Je=!0,brush:et,onBrush:tt,accessibleTable:ot=!0,description:nt,summary:rt,customLayout:it,onLayoutError:st,layoutConfig:at,layoutSelection:lt}=e,{customHoverBehavior:ct,customClickBehavior:ut,hasClickBehavior:dt}=Ul({customHoverBehavior:be,customClickBehavior:ve,onObservation:xe,chartId:we,chartType:"StreamOrdinalFrame"}),ht=m??i,ft=p??s,pt=(0,hc.useRef)(!0),mt=Fa({sizeProp:b,responsiveWidth:v,responsiveHeight:x,userMargin:k,marginDefault:Pu,title:Fe,legend:je,legendPosition:Ie,animate:Ge,transitionProp:Ye,frameScheduler:Xe,clock:Ue,random:Ke,seed:Ze,paused:Qe,suspendWhenHidden:Je,themeDirtyRef:pt}),{reducedMotionRef:gt,responsiveRef:yt,size:bt,margin:vt,adjustedWidth:xt,adjustedHeight:kt,currentTheme:wt,transition:St,introEnabled:At,tableId:Ct,rafRef:Mt,renderFnRef:_t,scheduleRender:jt,frameRuntime:Rt}=mt,Pt=hs(),Lt=gs(),Tt=(0,hc.useMemo)(()=>H(r),[r]),It=re??le,$t=ie??ce,Nt=se??ue,Dt=ae??de,Et=(0,hc.useRef)(null),[Bt,Ft]=(0,hc.useState)(null),[Ht,Ot]=(0,hc.useState)(null),zt=Ya(Be,bt,vt,Ht),Wt=Ya(Ee,bt,vt,Ht),qt=Ee||"transparent"===Oe?null:(0,Ru.jsx)("rect",{className:"semiotic-canvas-background","data-semiotic-layer":"canvas-background",x:-vt.left,y:-vt.top,width:bt[0],height:bt[1],fill:Oe||"var(--semiotic-bg, transparent)"}),[Yt,Gt]=(0,hc.useState)(0),Vt=(0,hc.useRef)(0),[Xt,Ut]=(0,hc.useState)(!1),Kt=(0,hc.useRef)({w:-1,h:-1}),Zt=(0,hc.useRef)(!1),Qt=Po("StreamOrdinalFrame"),Jt=me||ge,eo="streaming"===n,to=bs((0,hc.useMemo)(()=>({chartType:o,runtimeMode:eo?"streaming":"bounded",windowSize:K,windowMode:U,extentPadding:V,projection:y,oAccessor:eo?void 0:ht,rAccessor:eo?void 0:ft,accessorRevision:g,colorAccessor:a,symbolAccessor:l,symbolMap:c,stackBy:u,groupBy:d,multiAxis:h,timeAccessor:eo?f:void 0,valueAccessor:eo?p||("string"==typeof ft||"function"==typeof ft?ft:void 0):void 0,categoryAccessor:eo?ht:void 0,rExtent:q,oExtent:Y,axisExtent:pe,barPadding:w,roundedTop:S,gradientFill:A,trackFill:C,baselinePadding:M,innerRadius:_,cornerRadius:j,normalize:R,startAngle:P,sweepAngle:L,dynamicColumnWidth:T,bins:I,showOutliers:$,showIQR:N,amplitude:D,connectorOpacity:E,showLabels:B,connectorAccessor:F,connectorStyle:z,dataIdAccessor:W,oSort:X,pieceStyle:Z,summaryStyle:Q,colorScheme:ee,themeCategorical:wt?.colors?.categorical,themeSemantic:G(wt),themeSequential:wt?.colors?.sequential,themeDiverging:wt?.colors?.diverging,barColors:te,decay:We,pulse:qe,transition:St,introAnimation:At,staleness:Ve,clock:Rt.now,customLayout:it,onLayoutError:st,layoutConfig:at,layoutMargin:vt}),[o,eo,K,U,V,y,ht,ft,g,a,l,c,u,d,h,f,p,q,Y,pe,w,S,A,C,M,_,j,R,P,L,T,I,$,N,D,E,B,F,z,W,X,Z,Q,ee,wt,te,We,qe,St,At,Ve,Rt.now,it,st,at,vt])),oo=(0,hc.useRef)(null);oo.current||(oo.current=new Ec(to));const no=Ua(oo,Ne,De,e=>e.getData());zo(oo,to,pt,jt),Wo(oo,lt,pt,jt);const ro=(0,hc.useRef)(null);ro.current||(ro.current=new O(e=>{const t=oo.current;t&&t.ingest(e)&&(pt.current=!0,jt())}));const io=(0,hc.useCallback)(e=>{ro.current?.push(e)},[]),so=(0,hc.useCallback)(e=>{ro.current?.pushMany(e)},[]),ao=(0,hc.useCallback)(()=>{ro.current?.clear(),oo.current?.clear(),pt.current=!0,jt()},[jt]),lo=(0,hc.useCallback)(e=>{ro.current?.clearLastData(),ro.current?.setReplacementData(e)},[]);(0,hc.useImperativeHandle)(t,()=>({push:io,pushMany:so,replace:lo,remove:e=>{ro.current?.flush();const t=oo.current?.remove(e)??[];if(t.length>0){const e=Et.current?.data;!!Et.current&&t.some(Array.isArray(e)?t=>e.includes(t):t=>t===e)&&(Et.current=null,Ft(null)),pt.current=!0,jt()}return t},update:(e,t)=>{ro.current?.flush();const o=oo.current?.update(e,t)??[];return o.length>0&&(pt.current=!0,jt()),o},clear:ao,getData:()=>(ro.current?.flush(),oo.current?.getData()??[]),getScales:()=>oo.current?.scales??null,getCustomLayout:()=>oo.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>oo.current?.lastCustomLayoutFailure??null}),[io,so,lo,ao,jt]),(0,hc.useEffect)(()=>{r&&ro.current?.setBoundedData(Tt)},[r,Tt]);const{canvasRef:co}=za(mt,{storeRef:oo,dirtyRef:pt,hydrated:Pt,wasHydratingFromSSR:Lt,cleanup:()=>ro.current?.clear(),canvasPaintDependencies:[o,xt,kt,oe,Oe,Ee,J,jt]}),{hoverHandlerRef:uo,hoverLeaveRef:ho,onPointerMove:fo,onPointerLeave:po}=mt;uo.current=e=>{if(!Jt)return;const t=co.current;if(!t)return;const n=t.getBoundingClientRect(),r=e.clientX-n.left-vt.left,i=e.clientY-n.top-vt.top;if(0>r||r>xt||0>i||i>kt)return void(Et.current&&(Et.current=null,Ft(null),ct&&ct(null),jt()));const s=oo.current;if(!s||0===s.scene.length)return;const a="radial"===y,l=Bc(s.scene,a?r-xt/2:r,a?i-kt/2:i,30,s.pointQuadtree,s.maxPointRadius);if(!l)return void(Et.current&&(Et.current=null,Ft(null),ct&&ct(null),jt()));const c=ca(l.datum||{},l.x,l.y,{...l.stats&&{stats:l.stats},...l.category&&{category:l.category},__oAccessor:"string"==typeof ht?ht:void 0,__rAccessor:"string"==typeof ft?ft:void 0,__chartType:o});Et.current=c,Ft(c),ct&&(ct(c),pt.current=!0),jt()},ho.current=()=>{Et.current&&(Et.current=null,Ft(null),ct&&(ct(null),pt.current=!0),jt())};const mo=(0,hc.useCallback)(e=>{if(Jr(e.target))return;if(!ut)return;const t=co.current;if(!t)return ut(null),pt.current=!0,void jt();const n=t.getBoundingClientRect(),r=e.clientX-n.left-vt.left,i=e.clientY-n.top-vt.top;if(0>r||r>xt||0>i||i>kt)return ut(null),pt.current=!0,void jt();const s=oo.current;if(!s||0===s.scene.length)return ut(null),pt.current=!0,void jt();const a="radial"===y,l=Bc(s.scene,a?r-xt/2:r,a?i-kt/2:i,30,s.pointQuadtree,s.maxPointRadius);if(!l)return ut(null),pt.current=!0,void jt();ut(ca(l.datum||{},l.x,l.y,{...l.stats&&{stats:l.stats},...l.category&&{category:l.category},__oAccessor:"string"==typeof ht?ht:void 0,__rAccessor:"string"==typeof ft?ft:void 0,__chartType:o}),{type:"activate",inputType:ql(e.nativeEvent.pointerType)}),pt.current=!0,jt()},[ut,co,vt.left,vt.top,xt,kt,y,ht,ft,o,jt]),{kbFocusIndexRef:go,focusedNavPointRef:yo,onKeyDown:bo}=function({chartType:e,oAccessor:t,rAccessor:o,...n}){return ic({...n,extractPoints:oc,toHover:n=>({...rc(n),__oAccessor:"string"==typeof t?t:void 0,__rAccessor:"string"==typeof o?o:void 0,__chartType:e})})}({storeRef:oo,hoverRef:Et,setHoverPoint:Ft,customHoverBehavior:ct,customClickBehavior:ut,scheduleRender:jt,chartType:o,oAccessor:ht,rAccessor:ft}),vo=(0,hc.useCallback)(e=>{go.current=-1,yo.current=null,fo(e)},[yo,go,fo]);_t.current=()=>{if(Mt.current=null,!Rt.isActive)return;const e=co.current;if(!e)return;const t=e.getContext("2d");if(!t)return;const n=oo.current;if(!n)return;const r=Rt.now(),i=n.advanceTransition(gt.current?r+1e6:r),s=!gt.current&&i,a=Kt.current.w!==xt||Kt.current.h!==kt,l=pt.current;let c=!1;const u=Qt.current.beforeCompute(n.getLastUpdateResult(),s);!l&&!a||s&&!a||(n.computeScene({width:xt,height:kt}),Kt.current={w:xt,h:kt},c=!0,no()),Qt.current.afterCompute(u,c,a),pt.current=l&&s&&!c;const d=qa(n,r,c,Zt);(c||s)&&e.setAttribute("aria-label",Bs(n.scene,o+" chart"));const h=Va(),f=bt[0]*h,p=bt[1]*h;e.width===f&&e.height===p||(e.width=f,e.height=p,e.style.width=bt[0]+"px",e.style.height=bt[1]+"px"),t.setTransform(h,0,0,h,0,0),t.clearRect(0,0,bt[0],bt[1]);const m=Ve&&n.lastIngestTime>0&&r-n.lastIngestTime>(Ve?.threshold??5e3);m&&(t.globalAlpha=Ve?.dimOpacity??.5);const g="radial"===y;t.save(),t.beginPath(),t.rect(vt.left,vt.top,xt,kt),t.clip(),g?(t.save(),t.translate(vt.left+xt/2,vt.top+kt/2)):t.translate(vt.left,vt.top);const b=it?Cu.custom:Cu[o]||[],v={width:xt,height:kt},x=n.scales;x&&Ll({context:t,nodes:n.scene,renderMode:J,pixelRatio:h,paintBuiltIn:e=>{for(const o of b)o(t,e,x,v)}}),g&&t.restore(),t.restore(),m&&(t.globalAlpha=1),c&&n.scales?(Ot(n.scales),Gt(e=>e+1),Vt.current=r):s&&n.scales&&r-Vt.current>=33&&(Gt(e=>e+1),Vt.current=r),Ve?.showBadge&&Ut(!!m),(s||null!=n.activeTransition||d.pending)&&jt()},Xn(Ve,oo,pt,jt,Xt,Ut);const xo=Jt&&Bt?ye?ye(Bt):(0,Ru.jsx)(ju,{hover:Bt}):null,ko="radial"===y,wo=xo?(0,Ru.jsx)(Ca,{x:Bt?ko?Bt.x+xt/2:Bt.x:0,y:Bt?ko?Bt.y+kt/2:Bt.y:0,containerWidth:xt,containerHeight:kt,margin:vt,className:"stream-ordinal-tooltip",children:xo}):null,So="horizontal"===y?ht:ft,Ao=Ka("horizontal"===y?ft:ht,void 0,"__semiotic_resolvedO",""),Co=Ka(So,void 0,"__semiotic_resolvedR",""),Mo=Ao.key,_o=Co.key,jo=Za(Ao,Co,Se&&Se.length>0||!1);if(cs||!Pt&&Lt){const e=oo.current;e&&r&&(e.ingest({inserts:Tt,bounded:!0}),e.computeScene({width:xt,height:kt}));const t=e?.scene??[],o=e?.scales??null,n=Ya(Be,bt,vt,o),i=Ya(Ee,bt,vt,o),s="radial"===y,a=s?vt.left+xt/2:vt.left,l=s?vt.top+kt/2:vt.top;return(0,Ru.jsxs)("div",{ref:yt,className:"stream-ordinal-frame"+(He?" "+He:""),role:"img","aria-label":nt||("string"==typeof Fe?Fe:"Ordinal chart"),style:{position:"relative",width:v?"100%":bt[0],height:x?"100%":bt[1]},children:[(0,Ru.jsx)(ta,{summary:rt}),(0,Ru.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:bt[0],height:bt[1],style:{position:"absolute",left:0,top:0},children:[i&&(0,Ru.jsx)("g",{transform:`translate(${vt.left},${vt.top})`,children:i}),(0,Ru.jsxs)("g",{transform:`translate(${a},${l})`,children:[Oe&&(0,Ru.jsx)("rect",{x:0,y:0,width:xt,height:kt,fill:Oe}),t.map((e,t)=>Tl({node:e,index:t,renderMode:J,fallback:()=>function(e,t,o){const n=("category"in e?e.category:void 0)||("group"in e?e.group:void 0)||"",r=o=>`ord-${e.type}-${n}-${t}-${o}`,i=`ord-${e.type}-${n}-${t}`;switch(e.type){case"rect":{const t=e,o=ls(i)+"-grad",n=function(e,t){const o=e.fillGradient;if(!o)return null;let n=e.x,r=e.y,i=e.x,s=e.y+e.h;"bottom"===e.roundedEdge?(r=e.y+e.h,s=e.y):"right"===e.roundedEdge?(n=e.x+e.w,r=e.y,i=e.x,s=e.y):"left"===e.roundedEdge&&(n=e.x,r=e.y,i=e.x+e.w,s=e.y);const a=[];if("colorStops"in o){const e=o.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>e.length)return null;for(let t=0;e.length>t;t++)a.push((0,ns.jsx)("stop",{offset:e[t].offset,stopColor:e[t].color},t))}else{const t=is(e.style.fill);a.push((0,ns.jsx)("stop",{offset:0,stopColor:t,stopOpacity:o.topOpacity},"0")),a.push((0,ns.jsx)("stop",{offset:1,stopColor:t,stopOpacity:o.bottomOpacity},"1"))}return(0,ns.jsx)("linearGradient",{id:t,gradientUnits:"userSpaceOnUse",x1:n,y1:r,x2:i,y2:s,children:a})}(t,o);let r,s;if(n)s=`url(#${o})`;else if(yn(t.style.fill)){const e=ls(i)+"-hatch";r=kn(t.style.fill,e),s=`url(#${e})`}else s=is(t.style.fill);const a=n||r?(0,ns.jsxs)("defs",{children:[n,r]}):null;if(t.cornerRadii&&Qi(t.cornerRadii)){const e=function(e){const{x:t,y:o,w:n,h:r}=e,{tl:i,tr:s,br:a,bl:l}=Ji(e);let c=`M${t+i},${o}`;return c+=` L${t+n-s},${o}`,s>0&&(c+=` A${s},${s} 0 0 1 ${t+n},${o+s}`),c+=` L${t+n},${o+r-a}`,a>0&&(c+=` A${a},${a} 0 0 1 ${t+n-a},${o+r}`),c+=` L${t+l},${o+r}`,l>0&&(c+=` A${l},${l} 0 0 1 ${t},${o+r-l}`),c+=` L${t},${o+i}`,i>0&&(c+=` A${i},${i} 0 0 1 ${t+i},${o}`),c+=" Z",c}(t);return(0,ns.jsxs)(Ki.Fragment,{children:[a,(0,ns.jsx)("path",{d:e,fill:s,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:n,w:r,h:l}=t;let c;switch(t.roundedEdge){case"right":c=`M${o},${n} L${o+r-e},${n} A${e},${e} 0 0 1 ${o+r},${n+e} L${o+r},${n+l-e} A${e},${e} 0 0 1 ${o+r-e},${n+l} L${o},${n+l} Z`;break;case"left":c=`M${o+r},${n} L${o+e},${n} A${e},${e} 0 0 0 ${o},${n+e} L${o},${n+l-e} A${e},${e} 0 0 0 ${o+e},${n+l} L${o+r},${n+l} Z`;break;case"bottom":c=`M${o},${n} L${o+r},${n} L${o+r},${n+l-e} A${e},${e} 0 0 1 ${o+r-e},${n+l} L${o+e},${n+l} A${e},${e} 0 0 1 ${o},${n+l-e} Z`;break;default:c=`M${o},${n+l} L${o},${n+e} A${e},${e} 0 0 1 ${o+e},${n} L${o+r-e},${n} A${e},${e} 0 0 1 ${o+r},${n+e} L${o+r},${n+l} Z`}return(0,ns.jsxs)(Ki.Fragment,{children:[a,(0,ns.jsx)("path",{d:c,fill:s,opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})]},i)}return(0,ns.jsxs)(Ki.Fragment,{children:[a,(0,ns.jsx)("rect",{x:t.x,y:t.y,width:t.w,height:t.h,fill:s,opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})]},i)}case"point":{const t=e;return(0,ns.jsx)("circle",{cx:t.x,cy:t.y,r:t.r,fill:is(t.style.fill),opacity:t.style.opacity??.8,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},i)}case"symbol":return ss(e,t,o);case"glyph":return as(e,e.x,e.y,`${o??""}ord-glyph-${e.pointId??t}`);case"wedge":{const n=e;if(n._gradientBand&&n._gradientBand.colors.length>0){const e=ls(`${o?o+"-":""}gauge-grad-${n.category||i}-${t}`),{clipPath:r,slices:s}=os({innerRadius:n.innerRadius,outerRadius:n.outerRadius,startAngle:n.startAngle,endAngle:n.endAngle,cornerRadius:n.cornerRadius,roundStart:n.roundedEnds?.start??!0,roundEnd:n.roundedEnds?.end??!0,colors:n._gradientBand.colors});return(0,ns.jsxs)("g",{transform:`translate(${n.cx},${n.cy})`,opacity:n.style.opacity,fillOpacity:n.style.fillOpacity,children:[(0,ns.jsx)("defs",{children:(0,ns.jsx)("clipPath",{id:e,children:(0,ns.jsx)("path",{d:r})})}),(0,ns.jsx)("g",{clipPath:`url(#${e})`,children:s.map((e,t)=>(0,ns.jsx)("path",{d:e.d,fill:is(e.color)},t))}),n.style.stroke&&"none"!==n.style.stroke&&(0,ns.jsx)("path",{d:r,fill:"none",stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})]},i)}let r;if(n.roundedEnds)r=ts({innerRadius:n.innerRadius,outerRadius:n.outerRadius,startAngle:n.startAngle,endAngle:n.endAngle,cornerRadius:n.cornerRadius,roundStart:n.roundedEnds.start,roundEnd:n.roundedEnds.end});else{const e=(0,Zi.arc)().innerRadius(n.innerRadius).outerRadius(n.outerRadius).startAngle(n.startAngle+Math.PI/2).endAngle(n.endAngle+Math.PI/2);n.cornerRadius&&e.cornerRadius(n.cornerRadius),r=e(rs)||""}return(0,ns.jsx)("path",{d:r,transform:`translate(${n.cx},${n.cy})`,fill:is(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},i)}case"boxplot":{const t=e,o=t.columnWidth/2;return(0,ns.jsxs)("g","vertical"===t.projection?{children:[(0,ns.jsx)("line",{x1:t.x,y1:t.minPos,x2:t.x,y2:t.maxPos,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,ns.jsx)("rect",{x:t.x-o,y:Math.min(t.q1Pos,t.q3Pos),width:t.columnWidth,height:Math.abs(t.q3Pos-t.q1Pos),fill:is(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,ns.jsx)("line",{x1:t.x-o,y1:t.medianPos,x2:t.x+o,y2:t.medianPos,stroke:t.style.stroke||"#333",strokeWidth:2}),(0,ns.jsx)("line",{x1:t.x-.5*o,y1:t.minPos,x2:t.x+.5*o,y2:t.minPos,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,ns.jsx)("line",{x1:t.x-.5*o,y1:t.maxPos,x2:t.x+.5*o,y2:t.maxPos,stroke:t.style.stroke||"#333",strokeWidth:1})]}:{children:[(0,ns.jsx)("line",{x1:t.minPos,y1:t.y,x2:t.maxPos,y2:t.y,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,ns.jsx)("rect",{x:Math.min(t.q1Pos,t.q3Pos),y:t.y-o,width:Math.abs(t.q3Pos-t.q1Pos),height:t.columnWidth,fill:is(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,ns.jsx)("line",{x1:t.medianPos,y1:t.y-o,x2:t.medianPos,y2:t.y+o,stroke:t.style.stroke||"#333",strokeWidth:2}),(0,ns.jsx)("line",{x1:t.minPos,y1:t.y-.5*o,x2:t.minPos,y2:t.y+.5*o,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,ns.jsx)("line",{x1:t.maxPos,y1:t.y-.5*o,x2:t.maxPos,y2:t.y+.5*o,stroke:t.style.stroke||"#333",strokeWidth:1})]},i)}case"violin":{const t=e,o=[(0,ns.jsx)("path",{d:t.pathString,transform:t.translateX||t.translateY?`translate(${t.translateX},${t.translateY})`:void 0,fill:is(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:t.style.strokeWidth||1},r("path"))];if(t.iqrLine&&t.bounds){const e=t.bounds,n=e.x+e.width/2,i=e.y+e.height/2;e.height>e.width?o.push((0,ns.jsx)("line",{x1:n,y1:t.iqrLine.q1Pos,x2:n,y2:t.iqrLine.q3Pos,stroke:t.style.stroke||"#333",strokeWidth:2},r("iqr")),(0,ns.jsx)("circle",{cx:n,cy:t.iqrLine.medianPos,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},r("med"))):o.push((0,ns.jsx)("line",{x1:t.iqrLine.q1Pos,y1:i,x2:t.iqrLine.q3Pos,y2:i,stroke:t.style.stroke||"#333",strokeWidth:2},r("iqr")),(0,ns.jsx)("circle",{cx:t.iqrLine.medianPos,cy:i,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},r("med")))}return(0,ns.jsx)("g",{children:o},i)}case"connector":return(0,ns.jsx)("line",{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stroke:e.style.stroke||"#999",strokeWidth:e.style.strokeWidth||1,opacity:e.style.opacity??.5},i);case"trapezoid":{const t=e,o=t.points.map(e=>`${e[0]},${e[1]}`).join(" ");return(0,ns.jsx)("polygon",{points:o,fill:is(t.style.fill,"#999"),opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},i)}default:return null}}(e,t,Ct)})).filter(Boolean)]})]}),(0,Ru.jsx)(Kc,{width:xt,height:kt,totalWidth:bt[0],totalHeight:bt[1],margin:vt,scales:o,showAxes:oe,showCategoryTicks:ne,oLabel:It,rLabel:$t,oFormat:Nt,rFormat:Dt,rTickValues:he,tickLabelEdgeAlign:fe,axisExtent:pe,showGrid:_e,title:Fe,legend:je,legendHoverBehavior:Re,legendClickBehavior:Pe,legendHighlightedCategory:Le,legendIsolatedCategories:Te,legendPosition:Ie,legendLayout:$e,foregroundGraphics:Io(n,Ho(oo.current?.customLayoutOverlays,lt??null)),annotations:Se,onAnnotationActivate:Ae,onObservation:ke??xe,chartId:we,chartType:"StreamOrdinalFrame",autoPlaceAnnotations:Ce,svgAnnotationRules:Me,annotationFrame:0,xAccessor:Mo,yAccessor:_o,annotationData:jo(e?.getData())}),ze&&"radial"===y&&(0,Ru.jsx)("div",{style:{position:"absolute",left:vt.left+xt/2,top:vt.top+kt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:ze})]})}return(0,Ru.jsxs)("div",{ref:yt,className:"stream-ordinal-frame"+(He?" "+He:""),role:"group","aria-label":nt||("string"==typeof Fe?Fe:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:v?"100%":bt[0],height:x?"100%":bt[1],overflow:"visible"},onKeyDown:bo,children:["production"!==process.env.NODE_ENV&&oo.current&&(0,Ru.jsx)(Lo,{store:oo.current,diagnostics:Qt.current}),ot&&(0,Ru.jsx)(oa,{tableId:Ct}),ot&&(0,Ru.jsx)(Js,{scene:oo.current?.scene??[],chartType:o+" chart",tableId:Ct,chartTitle:"string"==typeof Fe?Fe:void 0}),(0,Ru.jsx)(ta,{summary:rt}),(0,Ru.jsx)(Is,{hoverPoint:Bt}),(0,Ru.jsxs)("div",{role:"img","aria-label":nt||("string"==typeof Fe?Fe:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Jt?vo:void 0,onMouseLeave:Jt?po:void 0,onClick:dt?mo:void 0,children:[(0,Ru.jsxs)(Wa,{size:bt,margin:vt,children:[qt,Wt]}),(0,Ru.jsx)(Xc,{width:xt,height:kt,totalWidth:bt[0],totalHeight:bt[1],margin:vt,scales:Ht,showAxes:oe,showGrid:_e,rFormat:Dt,rTickValues:he,axisExtent:pe}),(0,Ru.jsx)("canvas",{ref:co,"aria-label":Bs(oo.current?.scene??[],o+" chart"),style:{position:"absolute",top:0,left:0,width:bt[0],height:bt[1]}}),(0,Ru.jsx)(Kc,{width:xt,height:kt,totalWidth:bt[0],totalHeight:bt[1],margin:vt,scales:Ht,showAxes:oe,showCategoryTicks:ne,oLabel:It,rLabel:$t,oFormat:Nt,rFormat:Dt,rTickValues:he,axisExtent:pe,showGrid:_e,title:Fe,legend:je,legendHoverBehavior:Re,legendClickBehavior:Pe,legendHighlightedCategory:Le,legendIsolatedCategories:Te,legendPosition:Ie,legendLayout:$e,foregroundGraphics:Io(zt,Ho(oo.current?.customLayoutOverlays,lt??null)),annotations:Se,onAnnotationActivate:Ae,onObservation:ke??xe,chartId:we,chartType:"StreamOrdinalFrame",autoPlaceAnnotations:Ce,svgAnnotationRules:Me,annotationFrame:Yt,xAccessor:Mo,yAccessor:_o,annotationData:jo(oo.current?.getData()),underlayRendered:!0,canvasObscuresUnderlay:!1}),(et||tt)&&"radial"!==y&&(0,Ru.jsx)(tu,{width:xt,height:kt,totalWidth:bt[0],totalHeight:bt[1],margin:vt,scales:Ht,onBrush:tt||(()=>{})}),ze&&"radial"===y&&(0,Ru.jsx)("div",{style:{position:"absolute",left:vt.left+xt/2,top:vt.top+kt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:ze}),Ve?.showBadge&&(0,Ru.jsx)(Kn,{isStale:Xt,position:Ve.badgePosition}),(0,Ru.jsx)(ia,{active:go.current>=0,hoverPoint:Bt,margin:vt,size:bt,shape:yo.current?.shape,width:yo.current?.w,height:yo.current?.h}),wo]})]})}));Lu.displayName="StreamOrdinalFrame";var Tu=Lu,Iu=require("react"),$u={weightChange:.1,newEdge:.5,newNode:1,threshold:3,transitionDuration:500},Nu={radius:3,opacity:.7,speedMultiplier:1,maxPerEdge:50,spawnRate:.1},Du=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,t=Math.random){const o=this._freeIndices.pop();if(void 0===o)return null;const n=this.particles[o];return n.active=!0,n.t=0,n.offset=t()-.5,n.edgeIndex=e,n.x=0,n.y=0,n}step(e,t,o,n){for(let r=0;this.capacity>r;r++){const i=this.particles[r];if(!i.active)continue;const s=o[i.edgeIndex];s&&s.bezier?(i.t+=e*t*(n?n[i.edgeIndex]??1:1)*(s.bezier.circular?.3:1),1>i.t?Eu(s.bezier,i.t,i.offset,i):(i.active=!1,this._freeIndices.push(r))):(i.active=!1,this._freeIndices.push(r))}}countForEdge(e){let t=0;for(let o=0;this.capacity>o;o++)this.particles[o].active&&this.particles[o].edgeIndex===e&&t++;return t}clear(){for(let e=0;this.capacity>e;e++)this.particles[e].active=!1;this._freeIndices.length=0;for(let e=this.capacity-1;e>=0;e--)this._freeIndices.push(e)}resize(e){if(this.capacity>=e)return;const t=this.particles;this.particles=Array(e);for(let o=0;e>o;o++)t.length>o?this.particles[o]=t[o]:(this.particles[o]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0},this._freeIndices.push(o));this.capacity=e}};function Eu(e,t,o,n){if(e.circular&&e.segments)return void function(e,t,o,n,r){const i=e.length,s=t*i,a=Math.min(Math.floor(s),i-1),l=s-a,[c,u,d,h]=e[a];Bu(c,u,d,h,l,r);const f=h.x-c.x,p=h.y-c.y,m=Math.sqrt(f*f+p*p);if(m>.001){const e=f/m;r.x+=-p/m*o*n*2,r.y+=e*o*n*2}}(e.segments,t,o,e.halfWidth,n);if(!e.points)return n.x=0,void(n.y=0);const[r,i,s,a]=e.points;Bu(r,i,s,a,t,n);const l=a.x-r.x,c=a.y-r.y,u=Math.sqrt(l*l+c*c);if(u>.001){const t=l/u;n.x+=-c/u*o*e.halfWidth*2,n.y+=t*o*e.halfWidth*2}}function Bu(e,t,o,n,r,i){const s=1-r,a=s*s,l=a*s,c=r*r,u=c*r;i.x=l*e.x+3*a*r*t.x+3*s*c*o.x+u*n.x,i.y=l*e.y+3*a*r*t.y+3*s*c*o.y+u*n.y}function Fu(e,t){var o=e.get(t);if(!o)throw Error("missing: "+t);return o}function Hu(e,t){var o,n=[],r=[],i=[],s={},a=[];function l(e){i[e]=!1,s.hasOwnProperty(e)&&Object.keys(s[e]).forEach(function(t){delete s[e][t],i[t]&&l(t)})}function c(e){var t,n,d=!1;for(r.push(e),i[e]=!0,t=0;a[e].length>t;t++)(n=a[e][t])===o?(u(o,r),d=!0):i[n]||(d=c(n));if(d)l(e);else for(t=0;a[e].length>t;t++){var h=s[n=a[e][t]];h||(s[n]=h={}),h[n]=!0}return r.pop(),d}function u(e,o){var r=[].concat(o).concat(e);t?t(r):n.push(r)}function d(t){!function(t){for(var o=0;e.length>o;o++)o>=t&&e[o]||(e[o]=[]),e[o]=e[o].filter(function(e){return e>=t})}(t);for(var o,n=function(e){for(var t=e.length,o=Array(t),n=Array(t),r=Array(t),i=Array(t),s=Array(t),a=Array(t),l=0;t>l;++l)o[l]=-1,n[l]=0,r[l]=!1,i[l]=0,s[l]=-1,a[l]=[];var c,u=0,d=[],h=[];function f(t){var l=[t],c=[t];for(o[t]=n[t]=u,r[t]=!0,u+=1;c.length>0;){var f=e[t=c[c.length-1]];if(f.length>i[t]){for(var p=i[t];f.length>p;++p){var m=f[p];if(0>o[m]){o[m]=n[m]=u,r[m]=!0,u+=1,l.push(m),c.push(m);break}r[m]&&(n[t]=0|Math.min(n[t],n[m])),0>s[m]||a[t].push(s[m])}i[t]=p}else{if(n[t]===o[t]){var g=[],y=[],b=0;for(p=l.length-1;p>=0;--p){var v=l[p];if(r[v]=!1,g.push(v),y.push(a[v]),b+=a[v].length,s[v]=d.length,v===t){l.length=p;break}}d.push(g);var x=Array(b);for(p=0;y.length>p;p++)for(var k=0;y[p].length>k;k++)x[--b]=y[p][k];h.push(x)}c.pop()}}}for(l=0;t>l;++l)0>o[l]&&f(l);for(l=0;h.length>l;l++){var p=h[l];if(0!==p.length){p.sort(function(e,t){return e-t}),c=[p[0]];for(var m=1;p.length>m;m++)p[m]!==p[m-1]&&c.push(p[m]);h[l]=c}}return{components:d,adjacencyList:h}}(e),r=n.components.filter(function(e){return e.length>1}),i=1/0,s=0;r.length>s;s++)for(var a=0;r[s].length>a;a++)i>r[s][a]&&(i=r[s][a],o=s);var l=r[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 f=d(o);if(o=f.leastVertex,a=f.adjList){for(var p=0;a.length>p;p++)for(var m=0;a[p].length>m;m++){var g=a[p][m];i[+g]=!1,s[g]={}}c(o),o+=1}else o=h}return t?void 0:n}function Ou(e){return e.y0-e.y1>0?"up":"down"}function zu(e,t){return t(e.source)==t(e.target)}function Wu(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 qu(e){return e.target.x0-e.source.x1}function Yu(e,t){var o=Vu(e),n=qu(t)/Math.tan(o);return"up"==Ou(e)?e.y1-n:e.y1+n}function Gu(e,t){var o=Vu(e),n=qu(t)/Math.tan(o);return"up"==Ou(e)?e.y1+n:e.y1-n}function Vu(e){var t=Math.abs(e.y1-e.y0);return Math.atan(Math.abs(e.target.x0-e.source.x1)/t)}function Xu(e,t){return t(e)}function Uu(e){return Zu(e.source)}function Ku(e){return Zu(e.target)}function Zu(e){return(e.y0+e.y1)/2}function Qu(e){return e.virtual?0:e.value}function Ju(e,t){var o=0;e.sourceLinks.forEach(function(e){o=e.circular&&!zu(e,t)?o+1:o});var n=0;return e.targetLinks.forEach(function(e){n=e.circular&&!zu(e,t)?n+1:n}),o+n}function ed(e){return e.target.depth}function td(e,t){return e.sourceLinks.length?e.depth:t-1}function od(e,t){return e.y0-t.y0}function nd(e,t){return t.y0-e.y0}function rd(e,t){return e.y1-t.y1}function id(e,t){return t.y1-e.y1}function sd(e,t){return ld(e.source,t.source)||e.index-t.index}function ad(e,t){return ld(e.target,t.target)||e.index-t.index}function ld(e,t){return e.partOfCycle===t.partOfCycle?e.y0-t.y0:"top"===e.circularLinkType||"bottom"===t.circularLinkType?-1:1}function cd(e,t){return ud(e)==ud(t)?"bottom"==e.circularLinkType?nd(e,t):od(e,t):ud(t)-ud(e)}function ud(e){return e.target.column-e.source.column}function dd(e,t){return hd(e)==hd(t)}function hd(e){return e.y0-e.y1>0?"up":"down"}var fd=require("d3-array");function pd(e,t,o,n,r){let i=e;var s=Math.max(8,.15*(i.y1-i.y0));i.links.forEach(function(e){e.circular&&(e._circularWidth=Math.min(e.width,s))});var a=(0,fd.min)(i.links,function(e){return e.source.y0});i.links.forEach(function(e){e.circular&&(e.circularPathData={})});var l=i.links.filter(function(e){return e.circular});return l.sort(function(e,t){return t.value-e.value}),l.forEach(function(e,t){e._circularStub=t>=4}),md(i.links.filter(function(e){return"top"==e.circularLinkType}),t,o),md(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+n,e.circularPathData.rightNodeBuffer=5,e.circularPathData.leftNodeBuffer=5,e.circularPathData.sourceWidth=e.source.x1-e.source.x0,e.circularPathData.sourceX=e.source.x0+e.circularPathData.sourceWidth,e.circularPathData.targetX=e.target.x0,e.circularPathData.sourceY=e.y0,e.circularPathData.targetY=e.y1,zu(e,t)&&Wu(e))e.circularPathData.rightSmallArcRadius=n+e._circularWidth/2,e.circularPathData.rightLargeArcRadius=n+e._circularWidth/2,e.circularPathData.leftSmallArcRadius=n+e._circularWidth/2,e.circularPathData.leftLargeArcRadius=n+e._circularWidth/2,"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=e.source.y1+r+e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius):(e.circularPathData.verticalFullExtent=e.source.y0-r-e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius);else{var s=e.source.column,l=e.circularLinkType,c=i.links.filter(function(e){return e.source.column==s&&e.circularLinkType==l});c.sort("bottom"==e.circularLinkType?nd:od);var u=0;c.forEach(function(t,r){t.circularLinkID==e.circularLinkID&&(e.circularPathData.rightSmallArcRadius=n+e._circularWidth/2+u,e.circularPathData.rightLargeArcRadius=n+e._circularWidth/2+r*o+u),u+=t._circularWidth||t.width}),s=e.target.column,(c=i.links.filter(function(e){return e.target.column==s&&e.circularLinkType==l})).sort("bottom"==e.circularLinkType?id:rd),u=0,c.forEach(function(t,r){t.circularLinkID==e.circularLinkID&&(e.circularPathData.leftSmallArcRadius=n+e._circularWidth/2+u,e.circularPathData.leftLargeArcRadius=n+e._circularWidth/2+r*o+u),u+=t._circularWidth||t.width}),"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=Math.max(i.y1,e.source.y1,e.target.y1)+r+e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius):(e.circularPathData.verticalFullExtent=a-r-e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius)}e.circularPathData.rightInnerExtent=e.circularPathData.sourceX+e.circularPathData.rightNodeBuffer,e.circularPathData.leftInnerExtent=e.circularPathData.targetX-e.circularPathData.leftNodeBuffer,e.circularPathData.rightFullExtent=e.circularPathData.sourceX+e.circularPathData.rightLargeArcRadius+e.circularPathData.rightNodeBuffer,e.circularPathData.leftFullExtent=e.circularPathData.targetX-e.circularPathData.leftLargeArcRadius-e.circularPathData.leftNodeBuffer}e.path=e.circular?function(e){return"top"==e.circularLinkType?"M"+e.circularPathData.sourceX+" "+e.circularPathData.sourceY+" L"+e.circularPathData.rightInnerExtent+" "+e.circularPathData.sourceY+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightSmallArcRadius+" 0 0 0 "+e.circularPathData.rightFullExtent+" "+(e.circularPathData.sourceY-e.circularPathData.rightSmallArcRadius)+" L"+e.circularPathData.rightFullExtent+" "+e.circularPathData.verticalRightInnerExtent+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightLargeArcRadius+" 0 0 0 "+e.circularPathData.rightInnerExtent+" "+e.circularPathData.verticalFullExtent+" L"+e.circularPathData.leftInnerExtent+" "+e.circularPathData.verticalFullExtent+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftLargeArcRadius+" 0 0 0 "+e.circularPathData.leftFullExtent+" "+e.circularPathData.verticalLeftInnerExtent+" L"+e.circularPathData.leftFullExtent+" "+(e.circularPathData.targetY-e.circularPathData.leftSmallArcRadius)+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftSmallArcRadius+" 0 0 0 "+e.circularPathData.leftInnerExtent+" "+e.circularPathData.targetY+" L"+e.circularPathData.targetX+" "+e.circularPathData.targetY:"M"+e.circularPathData.sourceX+" "+e.circularPathData.sourceY+" L"+e.circularPathData.rightInnerExtent+" "+e.circularPathData.sourceY+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightSmallArcRadius+" 0 0 1 "+e.circularPathData.rightFullExtent+" "+(e.circularPathData.sourceY+e.circularPathData.rightSmallArcRadius)+" L"+e.circularPathData.rightFullExtent+" "+e.circularPathData.verticalRightInnerExtent+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightLargeArcRadius+" 0 0 1 "+e.circularPathData.rightInnerExtent+" "+e.circularPathData.verticalFullExtent+" L"+e.circularPathData.leftInnerExtent+" "+e.circularPathData.verticalFullExtent+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftLargeArcRadius+" 0 0 1 "+e.circularPathData.leftFullExtent+" "+e.circularPathData.verticalLeftInnerExtent+" L"+e.circularPathData.leftFullExtent+" "+(e.circularPathData.targetY+e.circularPathData.leftSmallArcRadius)+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftSmallArcRadius+" 0 0 1 "+e.circularPathData.leftInnerExtent+" "+e.circularPathData.targetY+" L"+e.circularPathData.targetX+" "+e.circularPathData.targetY}(e):function(e){var t=e.source.x1,o=e.y0,n=e.target.x0,r=e.y1,i=(t+n)/2;return"M"+t+","+o+"C"+i+","+o+" "+i+","+r+" "+n+","+r}(e)}),i}function md(e,t,o){e.sort(cd);var n=e.filter(function(e){return!e._circularStub});return e.forEach(function(e,r){var i=0;if(e._circularStub)e.circularPathData.verticalBuffer=0;else if(zu(e,t)&&Wu(e))e.circularPathData.verticalBuffer=i+e._circularWidth/2;else{for(var s=0;n.length>s;s++){var a=n[s];if(a!==e&&a.circularPathData&&void 0!==a.circularPathData.verticalBuffer&&gd(e,a)){var l=a.circularPathData.verticalBuffer+(a._circularWidth||a.width)/2+o;i=l>i?l:i}}e.circularPathData.verticalBuffer=i+e._circularWidth/2}}),e}function gd(e,t){return e.source.column>=t.target.column&&t.source.column>=e.target.column}var yd=require("d3-array");function bd(e){return function(){return e}}function vd(e){return e.index}function xd(e){return e.nodes}function kd(e){return e.links}function wd(e,t,o){var n=(0,yd.groups)(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});n.forEach(function(r,i){var s=r.length;if(t)r.sort(t);else if(i>0){var a=new Map;r.forEach(function(e,t){var o,n,r,i=(n=0,r=0,(o=e).targetLinks.forEach(function(e){if(!e.circular){var t=e.value||1;r+=Zu(e.source)*t,n+=t}}),o.sourceLinks.forEach(function(e){if(!e.circular){var t=e.value||1;r+=Zu(e.target)*t,n+=t}}),n>0?r/n:NaN);a.set(e,{bc:i,idx:t})}),r.sort(function(e,t){var o=a.get(e),n=a.get(t),r=o.bc,i=n.bc;if(e.circularLinkType!==t.circularLinkType){if("top"==e.circularLinkType&&"bottom"==t.circularLinkType)return-1;if("bottom"==e.circularLinkType&&"top"==t.circularLinkType)return 1;if("top"==e.circularLinkType)return-1;if("top"==t.circularLinkType)return 1;if("bottom"==e.circularLinkType)return 1;if("bottom"==t.circularLinkType)return-1}return isNaN(r)||isNaN(i)?isNaN(r)?isNaN(i)?o.idx-n.idx:1:-1:r-i})}else r.sort(function(e,t){return e.circularLinkType==t.circularLinkType?Ju(t,o)-Ju(e,o):"top"==e.circularLinkType&&"bottom"==t.circularLinkType||"top"==e.circularLinkType&&0==t.partOfCycle||0==e.partOfCycle&&"bottom"==t.circularLinkType?-1:0});r.forEach(function(t,r){t.depth==n.length-1&&1==s||0==t.depth&&1==s?(t.y0=e.y1/2-t.value*e.ky,t.y1=t.y0+t.value*e.ky):t.partOfCycle?0==Ju(t,o)?(t.y0=e.y1/2+r,t.y1=t.y0+t.value*e.ky):"top"==t.circularLinkType?(t.y0=e.y0+r,t.y1=t.y0+t.value*e.ky):(t.y0=e.y1-t.value*e.ky-r,t.y1=t.y0+t.value*e.ky):0==e.y0||0==e.y1?(t.y0=(e.y1-e.y0)/s*r,t.y1=t.y0+t.value*e.ky):(t.y0=(e.y1-e.y0)/2-s/2+r,t.y1=t.y0+t.value*e.ky)})})}function Sd(e,t,o,n,r,i){var s=(0,yd.groups)(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});u();for(var a=1,l=i;l>0;--l)c(a*=.99,o),u();function c(t,o){var n=s.length;s.forEach(function(r){var i=r.length,s=r[0].depth;r.forEach(function(r){var a;if(r.sourceLinks.length||r.targetLinks.length)if(r.partOfCycle&&Ju(r,o)>0){var l=(0,yd.mean)(r.sourceLinks,Ku),c=(0,yd.mean)(r.targetLinks,Uu),u=l&&c?(l+c)/2:l||c;if(u){var d=(u-Zu(r))*t*.3;r.y0+=d,r.y1+=d}}else if(0==s&&1==i)r.y0=e.y1/2-(a=r.y1-r.y0)/2,r.y1=e.y1/2+a/2;else if(s==n-1&&1==i)r.y0=e.y1/2-(a=r.y1-r.y0)/2,r.y1=e.y1/2+a/2;else if(1==r.targetLinks.length&&1==r.targetLinks[0].source.sourceLinks.length)a=r.y1-r.y0,r.y0=r.targetLinks[0].source.y0,r.y1=r.y0+a;else{var h=(0,yd.mean)(r.sourceLinks,Ku),f=(0,yd.mean)(r.targetLinks,Uu),p=((h&&f?(h+f)/2:h||f)-Zu(r))*t;r.y0+=p,r.y1+=p}})})}function u(){s.forEach(function(o){var i,s,a,l=e.y0,c=o.length;for(o.sort(t||ld),a=0;c>a;++a)(s=l-(i=o[a]).y0)>0&&(i.y0+=s,i.y1+=s),l=i.y1+n;if((s=l-n-e.y1)>0)for(l=i.y0-=s,i.y1-=s,a=c-2;a>=0;--a)(s=(i=o[a]).y1+r-l)>0&&(i.y0-=s,i.y1-=s),l=i.y0})}}function Ad(e){e.nodes.forEach(function(e){e.sourceLinks.sort(ad),e.targetLinks.sort(sd)}),e.nodes.forEach(function(e){var t=e.y0,o=t,n=e.y1,r=n;e.sourceLinks.forEach(function(e){e.circular?(e.y0=n-e.width/2,n-=e.width):(e.y0=t+e.width/2,t+=e.width)}),e.targetLinks.forEach(function(e){e.circular?(e.y1=r-e.width/2,r-=e.width):(e.y1=o+e.width/2,o+=e.width)})})}function Cd(){var e=0,t=0,o=1,n=1,r=24,i=8,s=null,a=vd,l=td,c=void 0,u=32,d=2,h=xd,f=kd;function p(){var p={nodes:h.apply(null,arguments),links:f.apply(null,arguments)};return function(h){h.x0=e,h.y0=t,h.x1=o,h.y1=n,h.py=0,function(e,t){e.nodes.forEach(function(e,t){e.index=t,e.sourceLinks=[],e.targetLinks=[]});var o=function(e,t){var o=new Map;return(0,yd.group)(e,t).forEach(function(e,t){o.set(t,e[0])}),o}(e.nodes,t);e.links.forEach(function(e,t){e.index=t;var n=e.source,r=e.target;"object"!=typeof n&&(n=e.source=Fu(o,n)),"object"!=typeof r&&(r=e.target=Fu(o,r)),n.sourceLinks.push(e),r.targetLinks.push(e)})}(h,a),function(e,t){var o=0;if(null==t){for(var n=[],r=0;e.links.length>r;r++){var i=e.links[r],s=i.source.index,a=i.target.index;n[s]||(n[s]=[]),n[a]||(n[a]=[]),-1===n[s].indexOf(a)&&n[s].push(a)}var l=Hu(n);l.sort(function(e,t){return e.length-t.length});var c={};for(r=0;l.length>r;r++){var u=l[r].slice(-2);c[u[0]]||(c[u[0]]={}),c[u[0]][u[1]]=!0}e.links.forEach(function(e){var t=e.target.index,n=e.source.index;t===n||c[n]&&c[n][t]?(e.circular=!0,e.circularLinkID=o++):e.circular=!1})}else e.links.forEach(function(e){t(e.source)<t(e.target)?e.circular=!1:(e.circular=!0,e.circularLinkID=o++)})}(h,c),function(e,t){var o=0,n=0;e.links.forEach(function(r){r.circular&&(r.circularLinkType=r.source.circularLinkType||r.target.circularLinkType?r.source.circularLinkType?r.source.circularLinkType:r.target.circularLinkType:n>o?"top":"bottom","top"==r.circularLinkType?o++:n++,e.nodes.forEach(function(e){Xu(e,t)!=Xu(r.source,t)&&Xu(e,t)!=Xu(r.target,t)||(e.circularLinkType=r.circularLinkType)}))}),e.links.forEach(function(e){e.circular&&(e.source.circularLinkType==e.target.circularLinkType&&(e.circularLinkType=e.source.circularLinkType),zu(e,t)&&(e.circularLinkType=e.source.circularLinkType))})}(h,a),function(e){e.nodes.forEach(function(e){e.partOfCycle=!1,e.value=Math.max((0,yd.sum)(e.sourceLinks,Qu),(0,yd.sum)(e.targetLinks,Qu)),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 n,r,i;if(null!=t){e.nodes.sort(function(e,o){return t(e)<t(o)?-1:1});var s=0,a=t(e.nodes[0]);e.nodes.forEach(function(e){s=t(e)==a?s:s+1,a=t(e)==a?a:t(e),e.column=s})}for(n=e.nodes,r=[],i=0;n.length;++i,n=r,r=[])n.forEach(function(e){e.depth=i,e.sourceLinks.forEach(function(e){0>r.indexOf(e.target)&&!e.circular&&r.push(e.target)})});for(n=e.nodes,r=[],i=0;n.length;++i,n=r,r=[])n.forEach(function(e){e.height=i,e.targetLinks.forEach(function(e){0>r.indexOf(e.source)&&!e.circular&&r.push(e.source)})});e.nodes.forEach(function(e){e.column=null==t?o(e,i):e.column})}(h,c,l);var f=i;if(null!==s){var p=(0,yd.groups)(h.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]}),m=(0,yd.max)(p,function(e){return e.length});m>1&&(f=Math.max(1,(n-t)*s/(m-1)))}(function(e,t,o){var n=(0,yd.groups)(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});e.py=t;var r=(0,yd.min)(n,function(t){return(e.y1-e.y0-(t.length-1)*e.py)/(0,yd.sum)(t,function(e){return e.value})});e.ky=r,e.links.forEach(function(t){t.width=t.value*e.ky});var i=(0,yd.max)(e.nodes,function(e){return e.column});e.nodes.forEach(i>0?function(t){t.x0=e.x0+t.column*((e.x1-e.x0-o)/i),t.x1=t.x0+o}:function(t){t.x0=e.x0,t.x1=t.x0+o})})(h,f,r),wd(h,c,a),Sd(h,c,a,f,f,u),Ad(h),pd(h,a,d,10,8),wd(h,c,a),Sd(h,c,a,f,f,u),Ad(h),pd(h,a,d,10,8),function(e,t){let o=e;o.nodes.forEach(function(e){e.y+(e.y1-e.y0)>o.y1&&(e.y=e.y-(e.y+(e.y1-e.y0)-o.y1));var n=o.links.filter(function(o){return Xu(o.source,t)==Xu(e,t)}),r=n.length;r>1&&n.sort(function(e,t){if(!e.circular&&!t.circular){if(e.target.column==t.target.column)return e.y1-t.y1;if(!dd(e,t))return e.y1-t.y1;if(e.target.column>t.target.column){var o=Yu(t,e);return e.y1-o}if(t.target.column>e.target.column)return Yu(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;n.forEach(function(e){e.y0=i+e.width/2,i+=e.width}),n.forEach(function(t,o){if("bottom"==t.circularLinkType){for(var i=o+1,s=0;r>i;i++)s+=n[i].width;t.y0=e.y1-s-t.width/2}})})}(h,a),function(e,t){let o=e;o.nodes.forEach(function(e){var n=o.links.filter(function(o){return Xu(o.target,t)==Xu(e,t)}),r=n.length;r>1&&n.sort(function(e,t){if(!e.circular&&!t.circular){if(e.source.column==t.source.column)return e.y0-t.y0;if(!dd(e,t))return e.y0-t.y0;if(e.source.column>t.source.column){var o=Gu(t,e);return e.y0-o}if(t.source.column>e.source.column)return Gu(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;n.forEach(function(e){e.y1=i+e.width/2,i+=e.width}),n.forEach(function(t,o){if("bottom"==t.circularLinkType){for(var i=o+1,s=0;r>i;i++)s+=n[i].width;t.y1=e.y1-s-t.width/2}})})}(h,a),function(e){var t=e.nodes,o=e.links,n=!1,r=!1;if(o.forEach(function(e){"top"==e.circularLinkType?n=!0:"bottom"==e.circularLinkType&&(r=!0)}),0==n||0==r){let n=function(t){return(t-i)/(s-i)*(e.y1-e.y0)+e.y0};var i=(0,yd.min)(t,function(e){return e.y0}),s=(0,yd.max)(t,function(e){return e.y1}),a=(e.y1-e.y0)/(s-i);1>a?(t.forEach(function(e){e.y0=n(e.y0),e.y1=n(e.y1)}),o.forEach(function(e){e.y0=n(e.y0),e.y1=n(e.y1),e.width=e.width*a})):t.forEach(function(e){var t=e.y1-e.y0,o=n(e.y0)-e.y0;e.y0=n(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),pd(h,a,d,10,8)}(p),p}return p.update=function(e){return Ad(e),pd(e,a,d,10,8),e},p.nodeWidth=function(e){return arguments.length?(r=+e,p):r},p.nodePadding=function(e){return arguments.length?(i=+e,p):i},p.nodePaddingRatio=function(e){return arguments.length?(s=+e,p):s},p.nodes=function(e){return arguments.length?(h="function"==typeof e?e:bd(e),p):h},p.links=function(e){return arguments.length?(f="function"==typeof e?e:bd(e),p):f},p.nodeId=function(e){return arguments.length?(a="function"==typeof e?e:bd(e),p):a},p.nodeAlign=function(e){return arguments.length?(l="function"==typeof e?e:bd(e),p):l},p.nodeSort=function(e){return arguments.length?(c=e,p):c},p.iterations=function(e){return arguments.length?(u=+e,p):u},p.circularLinkGap=function(e){return arguments.length?(d=+e,p):d},p.extent=function(r){return arguments.length?(e=+r[0][0],t=+r[0][1],o=+r[1][0],n=+r[1][1],p):[[e,t],[o,n]]},p.size=function(r){return arguments.length?(e=t=0,o=+r[0],n=+r[1],p):[o-e,n-t]},p}var Md=require("d3-interpolate");function _d(e){const{sx:t,sTop:o,sBot:n,tx:r,tTop:i,tBot:s,cp1X:a,cp2X:l}=e,c=(o+n)/2,u=(i+s)/2;return{pathD:[`M${t},${o}`,`C${a},${o} ${l},${i} ${r},${i}`,`L${r},${s}`,`C${l},${s} ${a},${n} ${t},${n}`,"Z"].join(" "),bezier:{circular:!1,points:[{x:t,y:c},{x:a,y:c},{x:l,y:u},{x:r,y:u}],halfWidth:(n-o)/2}}}require("d3-shape");var jd=e=>{let t,o,n,r,i,s,a,l,c;if("down"===e.direction)return t=e.y0-e.sankeyWidth/2,o=e.y1-e.sankeyWidth/2,n=e.y1+e.sankeyWidth/2,r=e.y0+e.sankeyWidth/2,i=e.source.x1,s=e.target.x0,a=(0,Md.interpolateNumber)(i,s),l=a(.5),c=a(.5),`M${t},${i}C${t},${l} ${o},${c} ${o},${s}L${n},${s}C${n},${c} ${r},${l} ${r},${i}Z`;const u=e.sankeyWidth/2,d=(0,Md.interpolateNumber)(e.source.x1,e.target.x0),{pathD:h}=_d({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 Rd(e){const t=e.sankeyWidth/2,o=(e._circularWidth??e.sankeyWidth)/2,n=e.circularPathData;if(!n)return null;if("down"===e.direction)return null;if(e._circularStub){const o=n.sourceX,r=n.sourceY,i=n.targetX,s=n.targetY;if("object"!=typeof e.source||!e.source||"object"!=typeof e.target||!e.target)return null;const a=Math.max(15,Math.min(40,.33*(n.rightFullExtent-o))),l=Math.max(15,Math.min(40,.33*(i-n.leftFullExtent)));return`M${o},${r-t}L${o+a},${r-t}L${o+a},${r+t}L${o},${r+t}ZM${i},${s-t}L${i-l},${s-t}L${i-l},${s+t}L${i},${s+t}Z`}const r=n.sourceX,i=n.sourceY,s=n.targetX,a=n.targetY,l=n.rightFullExtent,c=n.leftFullExtent,u=n.verticalFullExtent,d="bottom"===e.circularLinkType?1:-1,h=Math.max(4,Math.min(o,15));return`M${r},${i-d*t}L${l},${i-d*t}L${l+o},${i-d*t+d*h}L${l+o},${u+d*o-d*h}L${l+o-h},${u+d*o}L${c-o+h},${u+d*o}L${c-o},${u+d*o-d*h}L${c-o},${a-d*t+d*h}L${c-o+h},${a-d*t}L${s},${a-d*t}L${s},${a+d*t}L${c+o},${a+d*t}L${c+o},${u-d*o}L${l-o},${u-d*o}L${l-o},${i+d*t}L${r},${i+d*t}Z`}var Pd=new Set,Ld=new WeakMap;function Td(e,t){if("production"===process.env.NODE_ENV)return e;if(!e||!e.data||"object"!=typeof e.data)return e;let o=Ld.get(e);if(o){const e=o.get(t);if(e)return e}else o=new Map,Ld.set(e,o);const n=new Proxy(e,{get(e,o,n){if("string"==typeof o&&!(o in e)&&e.data&&o in e.data){const e=`${t}:${o}`;Pd.has(e)||(Pd.add(e),console.warn(`[Semiotic] "${t}" callback accessed "${o}" on the wrapper object, but it only exists on ".data". Use d.data.${o} (or d.data?.${o}) instead. Frame callbacks receive RealtimeNode/RealtimeEdge wrappers, not your raw data.`))}return Reflect.get(e,o,n)}});return o.set(t,n),n}var Id={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(ed))-1:0},justify:td};function $d(e){return"string"==typeof e?e:e.id}var Nd={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,o,n){if(0===e.length)return;const r="vertical"===o.orientation?"down":"right",i=o.nodeAlign||"justify",s=o.nodeWidth??15,a=o.nodePaddingRatio??.05,l=o.iterations??100,c=e.map(e=>({...e})),u=t.map(e=>({...e,source:"string"==typeof e.source?e.source:e.source.id,target:"string"==typeof e.target?e.target:e.target.id,value:Math.sqrt(Math.max(1,e.value||1))}));let d;d="down"===r?[[0,0],[n[1],n[0]]]:[[0,0],[n[0],n[1]]];const h=Cd().extent(d).links(u).nodes(c).nodeAlign(Id[i]||td).nodeId(e=>e.id).nodeWidth(s).iterations(l);h.nodePaddingRatio&&h.nodePaddingRatio(a),h();{let e=1/0,t=-1/0,o=1/0,r=-1/0;for(const n of c)e>n.x0&&(e=n.x0),n.x1>t&&(t=n.x1),o>n.y0&&(o=n.y0),n.y1>r&&(r=n.y1);for(const n of u){if(!n.circular||!n.circularPathData)continue;const i=n.circularPathData,s=(n._circularWidth??n.width??0)/2;e>i.leftFullExtent-s&&(e=i.leftFullExtent-s),i.rightFullExtent+s>t&&(t=i.rightFullExtent+s),o>i.verticalFullExtent-s&&(o=i.verticalFullExtent-s),i.verticalFullExtent+s>r&&(r=i.verticalFullExtent+s)}const i=t-e,s=r-o,a=n[0],l=n[1];if(i>0&&s>0&&(0>e||0>o||t>a||r>l)){const t=Math.min(a/i,l/s),n=-e*t+(a-i*t)/2,r=-o*t+(l-s*t)/2;for(const e of c)e.x0=e.x0*t+n,e.x1=e.x1*t+n,e.y0=e.y0*t+r,e.y1=e.y1*t+r;for(const e of u)if(e.y0=e.y0*t+r,e.y1=e.y1*t+r,e.width=(e.width??0)*t,e._circularWidth&&(e._circularWidth*=t),e.circular&&e.circularPathData){const o=e.circularPathData;o.sourceX=o.sourceX*t+n,o.targetX=o.targetX*t+n,o.sourceY=o.sourceY*t+r,o.targetY=o.targetY*t+r,o.rightFullExtent=o.rightFullExtent*t+n,o.leftFullExtent=o.leftFullExtent*t+n,o.verticalFullExtent=o.verticalFullExtent*t+r,o.rightInnerExtent=o.rightInnerExtent*t+n,o.leftInnerExtent=o.leftInnerExtent*t+n,o.verticalRightInnerExtent=o.verticalRightInnerExtent*t+r,o.verticalLeftInnerExtent=o.verticalLeftInnerExtent*t+r,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 f=new Map;for(const t of e)f.set(t.id,t);for(const e of c){const t=f.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 p=new Map;for(const e of t)p.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),n=p.get(e._edgeKey?e._edgeKey:`${t}\0${o}`);if(n){n.y0=e.y0,n.y1=e.y1,n.sankeyWidth=e.width??0,n.circular=!!e.circular,n.circularPathData=e.circularPathData,n._circularWidth=e._circularWidth,n._circularStub=e._circularStub,n.path=e.path,n.circularLinkType=e.circularLinkType,n.direction=r;const i=f.get(t),s=f.get(o);i&&(n.source=i),s&&(n.target=s)}}},buildScene(e,t,o,n){const r="vertical"===o.orientation?"down":"right",i=o.nodeStyle,s=o.edgeStyle,a=o.edgeOpacity??.5,l=o.edgeColorBy||"source",c=Array.isArray(o.colorScheme)?o.colorScheme:o.themeCategorical&&o.themeCategorical.length>0?o.themeCategorical:me,u=new Map;e.forEach((e,t)=>{u.set(e.id,c[t%c.length])});const d=[],h=[],f=[],p=new Map;for(const t of e){const e=t.x1-t.x0,o=t.y1-t.y0;if(0>=e||0>=o)continue;const n=i?i(Td(t,"nodeStyle")):{},s={fill:n.fill||u.get(t.id)||"#4d430c",stroke:n.stroke,strokeWidth:n.strokeWidth,opacity:n.opacity};p.set(t.id,("string"==typeof s.fill?s.fill:null)||u.get(t.id)||"#4d430c"),d.push("down"===r?{type:"rect",x:t.y0,y:t.x0,w:o,h:e,style:s,datum:t,id:t.id,label:t.id}:{type:"rect",x:t.x0,y:t.y0,w:e,h:o,style:s,datum:t,id:t.id,label:t.id})}const 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,n="object"==typeof e.target?e.target:null;if(!t||!n)continue;let r=o.themeSemantic?.border||o.themeSemantic?.secondary||"#999";r="function"==typeof l?l(e)||r:"target"===l?p.get(n.id)||u.get(n.id)||r:p.get(t.id)||u.get(t.id)||r;const i=s?s(Td(e,"edgeStyle")):{};if(e._circularStub&&e.circular&&e.circularPathData){const t=e.circularPathData,o=e.sankeyWidth/2,n=Math.max(15,Math.min(40,.33*(t.rightFullExtent-t.sourceX))),s=Math.max(15,Math.min(40,.33*(t.targetX-t.leftFullExtent))),l=i.fill||r;h.push({type:"bezier",pathD:`M${t.sourceX},${t.sourceY-o}L${t.sourceX+n},${t.sourceY-o}L${t.sourceX+n},${t.sourceY+o}L${t.sourceX},${t.sourceY+o}Z`,style:{fill:l,fillOpacity:i.fillOpacity??a,stroke:"none",opacity:i.opacity},datum:e,_gradient:{direction:"right",from:1,to:0,x0:t.sourceX,x1:t.sourceX+n}}),h.push({type:"bezier",pathD:`M${t.targetX},${t.targetY-o}L${t.targetX-s},${t.targetY-o}L${t.targetX-s},${t.targetY+o}L${t.targetX},${t.targetY+o}Z`,style:{fill:l,fillOpacity:i.fillOpacity??a,stroke:"none",opacity:i.opacity},datum:e,_gradient:{direction:"left",from:0,to:1,x0:t.targetX-s,x1:t.targetX}});continue}let c;(c=e.circular&&e.circularPathData?Rd(e):jd(e),c)&&h.push({type:"bezier",pathD:c,bezierCache:e.bezier,style:{fill:i.fill||r,fillOpacity:i.fillOpacity??a,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 s=t?t(o):o.id;if(!s)continue;let a,l,c;"down"===r?(a=o.y0+(o.y1-o.y0)/2,l=o.x1+14,c="start"):(n[0]/2>o.x0+e/2?(a=o.x0-6,c="end"):(a=o.x1+6,c="start"),l=o.y0+i/2),f.push({x:a,y:l,text:s+"",anchor:"down"===r?"middle":c,baseline:"middle",fontSize:11})}}var g;return{sceneNodes:d,sceneEdges:h,labels:f}}},Dd=require("d3-force"),Ed=require("d3-scale");h();var Bd={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,o,n){if(0===e.length)return;const r=o.forceStrength??.1,i=n[0]/2,s=n[1]/2,a=o.__previousPositions;let l=0;const c=[];for(const t of e){const e=null!=t.x&&null!=t.y&&(0!==t.x||0!==t.y),o=a?.get(t.id);e?l++:o?(t.x=o.x,t.y=o.y,l++):c.push(t)}const u=l>0&&.3>=(e.length>0?c.length/e.length:1);if(u){const o=new Map;for(const t of e)o.set(t.id,t);for(const e of c){const n=Fd(e.id,t,o);if(n.length>0){let t=0,o=0;for(const e of n)t+=e.x,o+=e.y;const r=Hd(e.id),i=r%360*(Math.PI/180),s=10+r%20;e.x=t/n.length+s*Math.cos(i),e.y=o/n.length+s*Math.sin(i)}else{const t=Hd(e.id),o=t%360*(Math.PI/180),n=15+t%30;e.x=i+n*Math.cos(o),e.y=s+n*Math.sin(o)}}}else{const t=2.399963229728653;for(let o=0;e.length>o;o++){const n=e[o];if(null==n.x||null==n.y||0===n.x&&0===n.y){const e=10*Math.sqrt(o+.5),r=o*t;n.x=i+e*Math.cos(r),n.y=s+e*Math.sin(r)}}}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),f=e=>h(e);if(d>0){const n=new Map,a=new Map;for(const t of e)n.set(t.id,0),a.set(t.id,t);for(const e of t){const t="string"==typeof e.source?e.source:e.source.id,o="string"==typeof e.target?e.target:e.target.id;n.set(t,(n.get(t)??0)+1),n.set(o,(n.get(o)??0)+1)}const l=(0,Dd.forceLink)().strength(e=>{const t=e.weight,o="string"==typeof e.target?e.target:e.target.id,i=Math.max(1,Math.min(n.get("string"==typeof e.source?e.source:e.source.id)??1,n.get(o)??1));return Math.min(2.5,(t&&t>0?Math.sqrt(t):1)*r/(.1*i))}).distance(e=>{const t="string"==typeof e.source?a.get(e.source):e.source,o="string"==typeof e.target?a.get(e.target):e.target,n=(t?f(t):0)+(o?f(o):0)+12;return Math.max(40,n)}).id(e=>e.id),c=(0,Dd.forceSimulation)();if(void 0===o.random&&void 0===o.seed||c.randomSource(o.random??Ia(o.seed)),c.force("charge",(0,Dd.forceManyBody)().strength(e=>{const t=n.get(e.id)??0;return-15*f(e)*Math.sqrt(t+1)})).force("collide",(0,Dd.forceCollide)(e=>f(e)+3).strength(.9).iterations(2)).force("center",(0,Dd.forceCenter)(i,s).strength(.8)).force("x",(0,Dd.forceX)(i).strength(.06)).force("y",(0,Dd.forceY)(s).strength(.06)),c.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}));l.links(e),c.force("link",l)}u?c.alpha(.3):.1>c.alpha()&&c.alpha(1),c.stop();for(let e=0;d>e;++e)c.tick()}for(const t of e){if(null==t.x||null==t.y)continue;const e=f(t);t.x=Math.max(e,Math.min(n[0]-e,t.x)),t.y=Math.max(e,Math.min(n[1]-e,t.y)),t.x0=0,t.x1=0,t.y0=0,t.y1=0}const p=new Map;for(const t of e)p.set(t.id,t);for(const e of t){if("string"==typeof e.source){const t=p.get(e.source);t&&(e.source=t)}if("string"==typeof e.target){const t=p.get(e.target);t&&(e.target=t)}}},buildScene(e,t,o,n){const r=o.nodeStyle,i=o.edgeStyle,s=Od(o.nodeSize,o.nodeSizeRange,e),a=Array.isArray(o.colorScheme)?o.colorScheme:o.themeCategorical&&o.themeCategorical.length>0?o.themeCategorical:me,l=new Map;e.forEach((e,t)=>{l.set(e.id,a[t%a.length])});const c=[],u=[],d=[];for(const t of e){if(null==t.x||null==t.y)continue;const e=s(Td(t,"nodeSize")),n=r?r(Td(t,"nodeStyle")):{},i={fill:n.fill||l.get(t.id)||o.themeSemantic?.primary||"#007bff",stroke:n.stroke||o.themeSemantic?.surface||"#fff",strokeWidth:n.strokeWidth??2,opacity:n.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),n="object"==typeof e.target?e.target:h.get(e.target);if(!t||!n)continue;if(null==t.x||null==t.y)continue;if(null==n.x||null==n.y)continue;const r=i?i(Td(e,"edgeStyle")):{};u.push({type:"line",x1:t.x,y1:t.y,x2:n.x,y2:n.y,style:{stroke:r.stroke||o.themeSemantic?.border||o.themeSemantic?.secondary||"#999",strokeWidth:r.strokeWidth??1,opacity:r.opacity??.6},datum:e})}if(!1!==o.showLabels){const t=(f=o.nodeLabel)?"function"==typeof f?f:e=>e[f]||e.id:null;for(const o of e){if(null==o.x||null==o.y)continue;const e=t?t(o):o.id;if(!e)continue;const n=s(Td(o,"nodeSize"));d.push({x:o.x,y:o.y-n-4,text:e+"",anchor:"middle",baseline:"auto",fontSize:11})}}var f;return{sceneNodes:c,sceneEdges:u,labels:d}}};function Fd(e,t,o){const n=[];for(const r of t){const t="string"==typeof r.source?r.source:r.source.id,i="string"==typeof r.target?r.target:r.target.id;let s=null;if(t===e?s=i:i===e&&(s=t),s){const e=o.get(s);!e||0===e.x&&0===e.y||n.push({x:e.x,y:e.y})}}return n}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],r=[];for(const t of o){const o=t.data?.[e];"number"==typeof o&&r.push(o)}if(0===r.length)return()=>n[0];const[i,s]=u(r);if(i===s)return()=>(n[0]+n[1])/2;const a=(0,Ed.scaleLinear)().domain([i,s]).range(n).clamp(!0);return t=>{const o=t.data?.[e];return null==o||"number"!=typeof o?n[0]:a(o)}}var zd=require("d3-chord"),Wd=require("d3-shape"),qd=me,Yd={supportsStreaming:!1,hierarchical:!1,computeLayout(e,t,o,n){if(0===e.length)return;const{padAngle:r=.01,groupWidth:i=20,sortGroups:s}=o,a=Math.min(n[0],n[1])/2,l=a-i,c=n[0]/2,u=n[1]/2,d=(h=o.valueAccessor)?"function"==typeof h?h:e=>e[h]??1:e=>e.value??1;var h;const f=new Map;for(let t=0;e.length>t;t++)f.set(e[t].id,t);const p=e.length,m=Array.from({length:p},()=>Array.from({length:p},()=>0));for(const e of t){const t="string"==typeof e.target?e.target:e.target.id,o=f.get("string"==typeof e.source?e.source:e.source.id),n=f.get(t);if(void 0===o||void 0===n)continue;const r=d(e);m[o][n]=r}const g=(0,zd.chord)().padAngle(r);s&&g.sortGroups(s);const y=g(m),b=y.groups,v=(0,Wd.arc)().innerRadius(l).outerRadius(a);for(const t of b){const o=e[t.index],n=v.centroid({innerRadius:l,outerRadius:a,startAngle:t.startAngle,endAngle:t.endAngle});o.x=n[0]+c,o.y=n[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),n=x.get(t);o&&(e.source=o),n&&(e.target=n)}const k=new Map;for(const e of t)k.set(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,e);for(const t of y){const o=e[t.source.index].id,n=e[t.target.index].id,r=k.get(`${o}\0${n}`)||k.get(`${n}\0${o}`);r&&(r.__chordData=t)}},buildScene(e,t,o,n){const{groupWidth:r=20,edgeOpacity:i=.5}=o,s=Math.min(n[0],n[1])/2,a=s-r,l=n[0]/2,c=n[1]/2,u=o.nodeStyle,d=o.edgeStyle,h=o.edgeColorBy||"source",f=Array.isArray(o.colorScheme)?o.colorScheme:o.themeCategorical&&o.themeCategorical.length>0?o.themeCategorical:qd,p=new Map;e.forEach((e,t)=>{p.set(e.id,f[t%f.length])});const m=(0,zd.ribbon)().radius(a),g=[],y=[],b=[];for(let t=0;e.length>t;t++){const o=e[t],n=o.__arcData;if(!n)continue;let r;r=u?u(Td(o,"nodeStyle")).fill||p.get(o.id)||f[t%f.length]:p.get(o.id)||f[t%f.length];const i=u?u(Td(o,"nodeStyle")):{};g.push({type:"arc",cx:l,cy:c,innerR:a,outerR:s,startAngle:n.startAngle-Math.PI/2,endAngle:n.endAngle-Math.PI/2,style:{fill:r,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 n=m(t);if(!n)continue;const r=Gd(n,l,c);let s=o.themeSemantic?.border||o.themeSemantic?.secondary||"#999";if(d)s=d(Td(e,"edgeStyle")).fill||s;else{const t="object"==typeof e.source?e.source:null,o="object"==typeof e.target?e.target:null;"target"===h&&o?s=p.get(o.id)||s:t&&(s=p.get(t.id)||s)}const a=d?d(Td(e,"edgeStyle")):{};y.push({type:"ribbon",pathD:r,style:{fill:s,fillOpacity:a.fillOpacity??i,stroke:a.stroke||"none",strokeWidth:a.strokeWidth,opacity:a.opacity},datum:e})}if(!1!==o.showLabels){const t=(v=o.nodeLabel)?"function"==typeof v?v:e=>e[v]||e.id:null,n=s+12;for(const o of e){const e=o.__arcData;if(!e)continue;const r=t?t(o):o.id;if(!r)continue;const i=(e.startAngle+e.endAngle)/2,s=i-Math.PI/2;b.push({x:l+Math.cos(s)*n,y:c+Math.sin(s)*n,text:r+"",anchor:i>Math.PI?"end":"start",baseline:"middle",fontSize:11})}}var v;return{sceneNodes:g,sceneEdges:y,labels:b}}};function Gd(e,t,o){const n=e.match(/[a-zA-Z]|[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?/g);if(!n)return e;const r=[];let i=0;for(;n.length>i;){const e=n[i];if("M"===e||"L"===e)for(r.push(e),i++;n.length>i&&!isNaN(Number(n[i]));)r.push(Number(n[i])+t+""),i++,n.length>i&&!isNaN(Number(n[i]))&&(r.push(Number(n[i])+o+""),i++);else if("C"===e)for(r.push(e),i++;n.length>i&&!isNaN(Number(n[i]));)for(let e=0;3>e&&n.length>i&&!isNaN(Number(n[i]));e++)r.push(Number(n[i])+t+""),i++,n.length>i&&!isNaN(Number(n[i]))&&(r.push(Number(n[i])+o+""),i++);else if("Q"===e)for(r.push(e),i++;n.length>i&&!isNaN(Number(n[i]));)for(let e=0;2>e&&n.length>i&&!isNaN(Number(n[i]));e++)r.push(Number(n[i])+t+""),i++,n.length>i&&!isNaN(Number(n[i]))&&(r.push(Number(n[i])+o+""),i++);else if("A"===e)for(r.push(e),i++;n.length>i&&!isNaN(Number(n[i]));)r.push(n[i++]),n.length>i&&r.push(n[i++]),n.length>i&&r.push(n[i++]),n.length>i&&r.push(n[i++]),n.length>i&&r.push(n[i++]),n.length>i&&(r.push(Number(n[i])+t+""),i++),n.length>i&&(r.push(Number(n[i])+o+""),i++);else"Z"===e||"z"===e?(r.push(e),i++):(r.push(n[i]),i++)}return r.join(" ")}var Vd=require("d3-hierarchy"),Xd=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];function Ud(e){const[t,o,n]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(e);return.299*t+.587*o+.114*n>150?"#222":"#fff"}function Kd(e,t,o){const n=t.nodeIDAccessor;return"function"==typeof n?n(e.data)+"":"string"==typeof n&&void 0!==e.data[n]?e.data[n]+"":void 0!==e.data.name?e.data.name+"":void 0!==e.data.id?e.data.id+"":"node-"+o}function Zd(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 Qd(e){return Array.isArray(e.colorScheme)?e.colorScheme:e.themeCategorical&&e.themeCategorical.length>0?e.themeCategorical:Xd}function Jd(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 eh(e,t,o,n,r){if("horizontal"===r){const r=(e+o)/2;return`M ${e},${t} C ${r},${t} ${r},${n} ${o},${n}`}if("radial"===r){const r=(e+o)/2;return`M ${e},${t} Q ${r},${t} ${r},${(t+n)/2} T ${o},${n}`}{const r=(t+n)/2;return`M ${e},${t} C ${e},${r} ${o},${r} ${o},${n}`}}var th={supportsStreaming:!1,hierarchical:!0,computeLayout(e,t,o,n){const r=o.__hierarchyRoot;if(!r)return;const i=o.chartType,s=function(e){if(e)return"function"==typeof e?e:t=>t[e]}(o.childrenAccessor),a=o.hierarchySum,l="function"==typeof a?a:"string"==typeof a?e=>Number(e[a])||0:e=>Number(e.value)||0,c=(0,Vd.hierarchy)(r,s);c.sum(l),c.sort((e,t)=>(t.value??0)-(e.value??0));const[u,d]=n;switch(i){case"tree":!function(e,t,o,n){const r=t.treeOrientation||"vertical",i=(0,Vd.tree)();i.size("horizontal"===r?[n,o]:"radial"===r?[2*Math.PI,Math.min(o,n)/2*.8]:[o,n]),i(e)}(c,o,u,d);break;case"cluster":!function(e,t,o,n){const r=t.treeOrientation||"vertical",i=(0,Vd.cluster)();i.size("horizontal"===r?[n,o]:"radial"===r?[2*Math.PI,Math.min(o,n)/2*.8]:[o,n]),i(e)}(c,o,u,d);break;case"treemap":!function(e,t,o,n){const r=t.padding??4,i=t.paddingTop??0,s=(0,Vd.treemap)().size([o,n]).tile(Vd.treemapBinary).padding(r);i>0&&s.paddingTop(i),s(e)}(c,o,u,d);break;case"circlepack":!function(e,t,o,n){const r=t.padding??4;(0,Vd.pack)().size([o,n]).padding(r)(e)}(c,o,u,d);break;case"partition":!function(e,t,o,n){(0,Vd.partition)().size([o,n]).padding(t.padding??1)(e)}(c,o,u,d)}const h=c.descendants();e.length=0,t.length=0;const f=new Map;for(let t=0;h.length>t;t++){const n=h[t],r={id:Kd(n,o,t),x:0,y:0,x0:0,x1:0,y0:0,y1:0,width:0,height:0,value:n.value??0,depth:n.depth,data:n.data,createdByFrame:!0};"tree"===i||"cluster"===i?oh(r,n,o):"treemap"===i||"partition"===i?nh(r,n):"circlepack"===i&&rh(r,n),r.__hierarchyNode=n,e.push(r),f.set(n,r)}if("tree"===i||"cluster"===i)for(const e of h)if(e.parent){const o=f.get(e.parent),n=f.get(e);o&&n&&t.push({source:o,target:n,value:1,y0:0,y1:0,sankeyWidth:0,data:{depth:e.depth}})}},buildScene(e,t,o,n){const r=o.nodeStyle||(()=>({})),i=o.edgeStyle||(()=>({}));switch(o.chartType){case"tree":case"cluster":return function(e,t,o,n,r,i){const s=[],a=[],l=[],c=o.treeOrientation||"vertical",u="radial"===c,d=n[0]/2,h=n[1]/2,f="number"==typeof(p=o.nodeSize)?p:5;var p;for(const t of e){let e=t.x,n=t.y;u&&(e+=d,n+=h);const i=r(Td(t,"nodeStyle"));let a=i.fill||Jd(o);if(o.colorByDepth&&void 0!==t.depth){const e=Qd(o);a=e[t.depth%e.length]}s.push({type:"circle",cx:e,cy:n,r:f,style:{fill:a,stroke:i.stroke||o.themeSemantic?.surface||"#fff",strokeWidth:i.strokeWidth??1,opacity:i.opacity},datum:t,id:t.id,label:t.id,depth:t.depth})}const m=o.edgeOpacity??.5;for(const e of t){const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;if(!t||!n)continue;let r=t.x,s=t.y,l=n.x,f=n.y;u&&(r+=d,s+=h,l+=d,f+=h);const p=eh(r,s,l,f,c),g=i(Td(e,"edgeStyle"));a.push({type:"curved",pathD:p,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=Zd(o.nodeLabel);for(const o of e){const e=t?t(o):o.id;if(!e)continue;let n,r,i,s=o.x,a=o.y;if(u&&(s+=d,a+=h),u){const e=s-d,t=a-h,o=Math.sqrt(e*e+t*t);o>0?(n=s+e/o*10,r=a+t/o*10,i=0>e?"end":"start"):(n=s,r=a-12,i="middle")}else"horizontal"===c?(o.data?.children&&0!==o.data.children.length?(n=s-f-6,i="end"):(n=s+f+6,i="start"),r=a):(n=s,r=a+f+14,i="middle");l.push({x:n,y:r,text:e+"",anchor:i,baseline:"middle",fontSize:11})}}return{sceneNodes:s,sceneEdges:a,labels:l}}(e,t,o,n,r,i);case"treemap":case"partition":return function(e,t,o,n){const r=[],i=[];for(const o of e){const e=o.x1-o.x0,i=o.y1-o.y0;if(0>=e||0>=i)continue;const s=n(Td(o,"nodeStyle"));let a=s.fill||Jd(t);if(t.colorByDepth&&void 0!==o.depth){const e=Qd(t);a=e[o.depth%e.length]}r.push({type:"rect",x:o.x0,y:o.y0,w:e,h:i,style:{fill:a,stroke:s.stroke||t.themeSemantic?.surface||"#fff",strokeWidth:s.strokeWidth??1,opacity:s.opacity},datum:o,id:o.id,label:o.id,depth:o.depth})}if(!1!==t.showLabels){const o=Zd(t.nodeLabel),r=t.labelMode||"leaf",s="partition"===t.chartType;for(const a of e){const e=a.x1-a.x0,l=a.y1-a.y0;if(0>=e||0>=l)continue;const c=!(a.data?.children&&a.data.children.length>0);if(!s){if("leaf"===r&&!c)continue;if("parent"===r&&c)continue}const u=o?o(a):a.id;if(!u)continue;if((c?30:40)>e||(c?16:14)>l)continue;let d=n(Td(a,"nodeStyle")).fill||Jd(t);if(t.colorByDepth&&void 0!==a.depth){const e=Qd(t);d=e[a.depth%e.length]}const h="string"==typeof d?Ud(d):t.themeSemantic?.text??"#000";i.push(c?{x:a.x0+e/2,y:a.y0+l/2,text:u+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,Math.min(e,l)/6)),fill:h}:{x:a.x0+4,y:a.y0+12,text:u+"",anchor:"start",baseline:"auto",fontSize:11,fontWeight:600,fill:h})}}return{sceneNodes:r,sceneEdges:[],labels:i}}(e,o,0,r);case"circlepack":return function(e,t,o,n){const r=[],i=[];for(const o of e){const e=o.__radius??5;if(0>=e)continue;const i=n(Td(o,"nodeStyle"));let s=i.fill||Jd(t);if(t.colorByDepth&&void 0!==o.depth){const e=Qd(t);s=e[o.depth%e.length]}r.push({type:"circle",cx:o.x,cy:o.y,r:e,style:{fill:s,stroke:i.stroke||t.themeSemantic?.surface||"#fff",strokeWidth:i.strokeWidth??1,opacity:i.opacity??.7},datum:o,id:o.id,label:o.id,depth:o.depth})}if(!1!==t.showLabels){const o=Zd(t.nodeLabel);for(const r of e){const e=r.__radius??5,s=o?o(r):r.id;if(!s)continue;if(15>e)continue;const a=!(r.data?.children&&r.data.children.length>0);let l=n(Td(r,"nodeStyle")).fill||Jd(t);if(t.colorByDepth&&void 0!==r.depth){const e=Qd(t);l=e[r.depth%e.length]}if(a){const o="string"==typeof l?Ud(l):t.themeSemantic?.text??"#000";i.push({x:r.x,y:r.y,text:s+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,e/3)),fill:o})}else i.push({x:r.x,y:r.y-e+14,text:s+"",anchor:"middle",baseline:"hanging",fontSize:Math.min(11,Math.max(8,e/3)),fill:t.themeSemantic?.text||"#000",stroke:t.themeSemantic?.surface||"#fff",strokeWidth:3,paintOrder:"stroke"})}}return{sceneNodes:r,sceneEdges:[],labels:i}}(e,o,0,r);default:return{sceneNodes:[],sceneEdges:[],labels:[]}}}};function oh(e,t,o){const n=o.treeOrientation||"vertical";if("radial"===n){const o=t.x,n=t.y;e.x=n*Math.cos(o-Math.PI/2),e.y=n*Math.sin(o-Math.PI/2)}else"horizontal"===n?(e.x=t.y,e.y=t.x):(e.x=t.x,e.y=t.y);e.x0=e.x-5,e.x1=e.x+5,e.y0=e.y-5,e.y1=e.y+5,e.width=10,e.height=10}function nh(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 rh(e,t){const o=t.r??0;e.x=t.x,e.y=t.y,e.x0=t.x-o,e.x1=t.x+o,e.y0=t.y-o,e.y1=t.y+o,e.width=2*o,e.height=2*o,e.__radius=o}var ih=require("d3-shape");function sh(e){let t=e.__orbitState;return t||(t={metaMap:new Map,startTime:"undefined"!=typeof performance?performance.now():Date.now()},e.__orbitState=t),t}var ah={sankey:Nd,force:Bd,chord:Yd,tree:th,cluster:th,treemap:th,circlepack:th,partition:th,orbit:{supportsStreaming:!1,hierarchical:!0,supportsAnimation:!0,computeLayout(e,t,o,n){const r=o.__hierarchyRoot;r&&function(e,t,o,n,r){const i=function(e){if("function"==typeof e)return e;const t=e||"children";return e=>e[t]||null}(o.childrenAccessor),s=function(e){if("function"==typeof e)return e;const t=e||"name";return e=>(e[t]??"")+""}(o.nodeIDAccessor),a=function(e){if(Array.isArray(e))return e;switch(e){case"solar":return[1];case"atomic":return[2,8];default:return[9999]}}(o.orbitMode),l=o.orbitSize??2.95,c=o.orbitEccentricity??1,u="number"==typeof l?()=>l:l,d="number"==typeof c?()=>c:c,h=sh(o);h.metaMap.clear(),n.length=0,r.length=0;const f=new Map;function p(e){const t=f.get(e)??0;return f.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=p(s(e));n.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,f,m,g){const y=i(t);if(!y?.length)return;const b=y.length;let v=0,x=0,k=0;for(;b>x;)x+=a[Math.min(k,a.length-1)],k++,v++;let w=0;for(let b=0;v>b;b++){const x=a[Math.min(b,a.length-1)],k=y.slice(w,w+x);if(!k.length)break;const S=(b+1)/v,A={id:o,depth:m,data:t,parentId:o},C=g?f/u(A)*S:f*S,M=(0,ih.pie)().value(e=>{const t=i(e)?.length;return t?4:1}).sort(null)(k),_=d(A);for(let t=0;k.length>t;t++){const i=(M[t].startAngle+M[t].endAngle)/2,a=k[t],u=p(s(a)),d=l+C*Math.sin(i),f=c+C*Math.cos(i)*_;n.push({id:u,x:d,y:f,x0:d,x1:d,y0:f,y1:f,width:0,height:0,value:0,depth:m,data:a}),h.metaMap.set(u,{ring:C,angle:i,depth:m,parentId:o,eccentricity:_}),r.push({source:o,target:u,value:1,y0:0,y1:0,sankeyWidth:0,data:{source:o,target:u}}),e(a,u,d,f,C,m+1,!0)}w+=x}}(e,b,m,g,y,1,!1)}(r,n,o,e,t)},buildScene(e,t,o,n){const r=o.nodeStyle,i=o.nodeSize,s="number"==typeof i?()=>i:"function"==typeof i?i:()=>6,a=[],l=[],c=[];if(!1!==o.orbitShowRings){const t=sh(o),n=new Map;for(const t of e)n.set(t.id,t);const r=new Map;for(const[,e]of t.metaMap){if(!e.parentId)continue;const t=n.get(e.parentId);if(!t)continue;const o=`${e.parentId}:${e.ring}`;r.has(o)||r.set(o,{parentX:t.x,parentY:t.y,ring:e.ring,ecc:e.eccentricity})}const i=48,s={stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1};for(const[,{parentX:e,parentY:t,ring:o,ecc:n}]of r)for(let r=0;i>r;r++){const a=r/i*Math.PI*2,c=(r+1)/i*Math.PI*2;l.push({type:"line",x1:e+o*Math.sin(a),y1:t+o*Math.cos(a)*n,x2:e+o*Math.sin(c),y2:t+o*Math.cos(c)*n,style:s,datum:null})}}for(const t of e){if(null==t.x||null==t.y)continue;const e=s(Td(t,"nodeSize")),n=r?r(Td(t,"nodeStyle")):{};a.push({type:"circle",cx:t.x,cy:t.y,r:e,style:{fill:n.fill||o.themeSemantic?.primary||"#6366f1",stroke:n.stroke||o.themeSemantic?.surface||"#fff",strokeWidth:n.strokeWidth??1,opacity:n.opacity??(0===(t.depth??0)?1:.85)},datum:t,id:t.id,label:t.id,depth:t.depth})}const u=new Map;for(const t of e)u.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:u.get(e.source),o="object"==typeof e.target?e.target:u.get(e.target);t&&o&&(null!=t.x&&null!=o.x&&l.push({type:"line",x1:t.x,y1:t.y,x2:o.x,y2:o.y,style:{stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1},datum:e}))}if(o.showLabels){const t=o.nodeLabel;for(const o of e){const e=s(Td(o,"nodeSize"));if(4>=e)continue;const n="function"==typeof t?t(o):t?o.data?.[t]??o.id:o.id;c.push({x:o.x,y:o.y+e+12,text:n+"",anchor:"middle",fontSize:10,fill:"currentColor"})}}return{sceneNodes:a,sceneEdges:l,labels:c}},tick:(e,t,o,n,r)=>!1!==o.orbitAnimated&&(function(e,t){const o=sh(t),n=t.orbitSpeed??.25,r=t.orbitRevolution??function(e){switch(e){case"decay":return e=>Math.pow(.6,e.depth??0);case"alternate":return e=>{const t=e.depth??0;return(t%2==0?1:-1)/(t+1)};default:return e=>1/((e.depth??0)+1)}}(t.orbitRevolutionStyle),i=(("undefined"!=typeof performance?performance.now():Date.now())-o.startTime)/1e3,s=n*(Math.PI/6),a=new Map;for(const t of e)a.set(t.id,t);for(const t of e){const e=o.metaMap.get(t.id);if(!e||!e.parentId)continue;const n=a.get(e.parentId);if(!n)continue;const l=e.angle+i*s*r({id:t.id,depth:e.depth,data:t.data,parentId:e.parentId});t.x=n.x+e.ring*Math.sin(l),t.y=n.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 lh(e){return ah[e]}var ch=require("d3-quadtree");function uh(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 dh(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(!hh(e))return!1;return!0}return hh(t.points)}function hh(e){if(!Array.isArray(e)||4!==e.length)return!1;for(const t of e){if(!t||"object"!=typeof t)return!1;const e=t;if("number"!=typeof e.x||!Number.isFinite(e.x))return!1;if("number"!=typeof e.y||!Number.isFinite(e.y))return!1}return!0}var fh=require("d3-interpolate");var ph="rgba(34, 197, 94, 0.7)",mh=2e3,gh=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],yh=["scene-style","data-paint","accessibility","evidence"],bh=(e,t)=>({retainedData:e,invalidations:t}),vh=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],xh=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],kh=["scene-geometry","data-paint","overlay","accessibility","evidence"],wh=["scene-style","data-paint","accessibility","evidence"],Sh=["scene-geometry","data-paint","overlay","accessibility","evidence"],Ah=[],Ch={chartType:bh("rebuild",vh),nodeIDAccessor:bh("rebuild",vh),sourceAccessor:bh("rebuild",vh),targetAccessor:bh("rebuild",vh),valueAccessor:bh("rebuild",vh),edgeIdAccessor:bh("rebuild",vh),childrenAccessor:bh("rebuild",vh),hierarchySum:bh("rebuild",vh),orientation:bh("preserve",xh),nodeAlign:bh("preserve",xh),nodePaddingRatio:bh("preserve",xh),nodeWidth:bh("preserve",xh),edgeSort:bh("preserve",xh),iterations:bh("preserve",xh),forceStrength:bh("preserve",xh),padAngle:bh("preserve",xh),groupWidth:bh("preserve",xh),sortGroups:bh("preserve",xh),treeOrientation:bh("preserve",xh),edgeType:bh("preserve",xh),padding:bh("preserve",xh),paddingTop:bh("preserve",xh),orbitMode:bh("preserve",xh),orbitSize:bh("preserve",xh),orbitSpeed:bh("preserve",xh),orbitRevolution:bh("preserve",xh),orbitRevolutionStyle:bh("preserve",xh),orbitEccentricity:bh("preserve",xh),orbitShowRings:bh("preserve",xh),orbitAnimated:bh("preserve",xh),customNetworkLayout:bh("preserve",xh),layoutConfig:bh("preserve",xh),nodeSize:bh("preserve",kh),nodeSizeRange:bh("preserve",kh),colorByDepth:bh("preserve",kh),nodeLabel:bh("preserve",Sh),showLabels:bh("preserve",Sh),labelMode:bh("preserve",Sh),nodeStyle:bh("preserve",wh),edgeStyle:bh("preserve",wh),colorBy:bh("preserve",wh),colorScheme:bh("preserve",wh),themeCategorical:bh("preserve",wh),themeSemantic:bh("preserve",wh),edgeColorBy:bh("preserve",wh),edgeOpacity:bh("preserve",wh),showParticles:bh("preserve",wh),particleStyle:bh("preserve",wh),decay:bh("preserve",wh),pulse:bh("preserve",wh),thresholds:bh("preserve",wh),staleness:bh("preserve",wh),layoutSelection:bh("preserve",wh),clock:bh("preserve",Ah),random:bh("preserve",Ah),seed:bh("preserve",Ah),tensionConfig:bh("preserve",Ah),transition:bh("preserve",Ah),introAnimation:bh("preserve",Ah),onLayoutError:bh("preserve",Ah),__skipForceSimulation:bh("preserve",Ah),__hierarchyRoot:bh("preserve",Ah),__orbitState:bh("preserve",Ah),__previousPositions:bh("preserve",Ah)},Mh=bh("preserve",xh),_h=class{constructor(){this.tracker=new ro}get last(){return this.tracker.last}subscribe(e){return this.tracker.subscribe(e)}recordData(e,t){return this.tracker.record({kind:e,...void 0===t?{}:{count:t}},gh)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},yh):this.recordNoop("restyle")}recordConfig(e){const t=function(e){let t="preserve";const o=new Set;for(const n of e){const e=Ch[n]??Mh;"rebuild"===e.retainedData&&(t="rebuild");for(const t of e.invalidations)o.add(t)}return{retainedData:t,invalidations:o}}(e);return this.tracker.record({kind:"config",keys:e},t.invalidations)}},jh=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.updateResults=new _h,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.config=e,this.tensionConfig={...$u,...e.tensionConfig},e.showParticles&&("sankey"===e.chartType||e.customNetworkLayout)&&(this.particlePool=new Du(2e3))}currentTime(){return this.config.clock?.()??Ue()}updateConfig(e){const t=this.config,o={...t,...e};t.__orbitState&&(o.__orbitState=t.__orbitState),t.__hierarchyRoot&&(o.__hierarchyRoot=t.__hierarchyRoot),void 0===e.layoutSelection&&null!=t.layoutSelection&&(o.layoutSelection=t.layoutSelection);const n=[...new Set([...Object.keys(t),...Object.keys(o)])].filter(e=>t[e]!==o[e]);this.config=o,this.tensionConfig={...$u,...o.tensionConfig},!o.showParticles||"sankey"!==o.chartType&&!o.customNetworkLayout||this.particlePool||(this.particlePool=new Du(2e3)),this.updateResults.recordConfig(n)}updateConfigWithResult(e){return this.updateConfig(e),this.updateResults.last}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,this.updateResults.recordData("replace",1)}ingestBounded(e,t,o,n){const{nodeIDAccessor:r="id",sourceAccessor:i="source",targetAccessor:s="target",valueAccessor:a="value"}=this.config,l="function"==typeof r?r:e=>e[r],c="function"==typeof i?i:e=>e[i],u="function"==typeof s?s:e=>e[s],d="function"==typeof a?a:e=>e[a]??1;this._boundedPrevSnapshot=new Map;for(const[e,t]of this.nodes)0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1||this._boundedPrevSnapshot.set(e,{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});this._boundedEdgeSnapshot=new Map;for(const[,e]of this.edges)e.sankeyWidth>0&&this._boundedEdgeSnapshot.set(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,{y0:e.y0,y1:e.y1,sankeyWidth:e.sankeyWidth});this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this._networkDecayCache=null;for(const t of e){const e=l(t)+"";this.nodes.set(e,{...uh(e),data:t})}for(let e=0;t.length>e;e++){const o=t[e],n=c(o)+"",r=u(o)+"",i=d(o),s=null==i?NaN:Number(i),a=Number.isFinite(s)?s:1;this.nodes.has(n)||this.nodes.set(n,{...uh(n),data:o}),this.nodes.has(r)||this.nodes.set(r,{...uh(r),data:o});const l=`${n}\0${r}\0${e}`,h={source:n,target:r,value:a,y0:0,y1:0,sankeyWidth:0,data:o,_edgeKey:l};o&&"object"==typeof o&&dh(o.bezier)&&(h.bezier=o.bezier),this.edges.set(l,h)}n?.deferLayout||this.runLayout(o),this.updateResults.recordData("replace",e.length+t.length)}ingestBoundedWithResult(e,t,o,n){return this.ingestBounded(e,t,o,n),this.updateResults.last}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:n}=e,r=0===this.nodes.size;let i=!1;const s=this.currentTime();this.lastIngestTime=s,this._decaySortedNodes=null,this._networkDecayCache=null,this.nodes.has(t)||(this.nodes.set(t,uh(t)),this.nodeTimestamps.set(t,s),this.tension+=this.tensionConfig.newNode,i=!0),this.nodes.has(o)||(this.nodes.set(o,uh(o)),this.nodeTimestamps.set(o,s),this.tension+=this.tensionConfig.newNode,i=!0);const a=this.edgeKey(t,o),l=this.edges.get(a);let c=!1;l?(l.value+=n,this.edgeTimestamps.set(a,s),this.tension+=this.tensionConfig.weightChange,c=!0):(this.edges.set(a,{source:t,target:o,value:n,y0:0,y1:0,sankeyWidth:0}),this.edgeTimestamps.set(a,s),this.tension+=this.tensionConfig.newEdge,i=!0);const u=r||i||c||this.tension>=this.tensionConfig.threshold;return this.updateResults.recordData("ingest",1),u}ingestEdgeWithResult(e){return this.ingestEdge(e),this.updateResults.last}runLayout(e){if(this.config.customNetworkLayout)return this.recordTopologyDiff(),void this.layoutVersion++;const t=lh(this.config.chartType);if(!t)return;let o=Array.from(this.nodes.values());const n=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,n,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;n.length>e;e++){const t=n[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 r=new Map;for(const e of this.nodes.values())0===e.x&&0===e.y||r.set(e.id,{x:e.x,y:e.y});this._lastPositionSnapshot=r,this.saveTargetPositions();const i=o.some(e=>void 0!==e._prevX0&&(0!==e._prevX0||0!==e._prevX1||0!==e._prevY0||0!==e._prevY1)),s=this.config.transition?.duration??this.tensionConfig.transitionDuration,a=["sankey","tree","treemap","circlepack","partition"].includes(this.config.chartType);if(!this._hasRenderedOnce&&this.config.introAnimation&&a&&o.length>0&&s>0){const t=e[0]/2,o=e[1]/2;for(const e of this.nodes.values())e._prevX0=t,e._prevX1=t,e._prevY0=o,e._prevY1=o;for(const e of this.edges.values())e._prevY0=o,e._prevY1=o,e._prevSankeyWidth=0,e._introFromZero=!0;this.restorePreviousPositions(),this.transition={startTime:this.currentTime(),duration:s}}else i&&s>0&&(this.restorePreviousPositions(),this.transition={startTime:this.currentTime(),duration:s});this._hasRenderedOnce=!0,this.recordTopologyDiff(),this.layoutVersion++}recordTopologyDiff(){const e=new Set(this.nodes.keys()),t=new Set(this.edges.keys());this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set;for(const t of e)this.previousNodeIds.has(t)||this.addedNodes.add(t);for(const t of this.previousNodeIds)e.has(t)||this.removedNodes.add(t);for(const e of t)this.previousEdgeKeys.has(e)||this.addedEdges.add(e);for(const e of this.previousEdgeKeys)t.has(e)||this.removedEdges.add(e);(this.addedNodes.size>0||this.removedNodes.size>0||this.addedEdges.size>0||this.removedEdges.size>0)&&(this.lastTopologyChangeTime=this.currentTime()),this.previousNodeIds=e,this.previousEdgeKeys=t}restyleScene(e){const t=function({nodes:e,edges:t,restyle:o,restyleEdge:n,baseStyles:r,selection:i}){const s=!(!o&&!n);if(o)for(const t of e){const e=r.get(t)??t.style,n=o(t,i);t.style=n?{...e,...n}:e}if(n)for(const e of t){const t=r.get(e)??e.style,o=n(e,i);e.style=o?{...t,...o}:t}return s}({nodes:this.sceneNodes,edges:this.sceneEdges,restyle:this._customRestyle,restyleEdge:this._customRestyleEdge,baseStyles:this._baseStyles,selection:e});this.markStylePaintPending(),this.updateResults.recordRestyle(t)}buildScene(e){if(this.config.customNetworkLayout){const t=function({config:e,customLayout:t,size:o,nodes:n,edges:r,previousResult:i,revision:s}){const a=wc(e.colorScheme,e.themeCategorical,me),l={nodes:n,edges:r,dimensions:{width:o[0],height:o[1],plot:{x:0,y:0,width:o[0],height:o[1]}},theme:{semantic:e.themeSemantic??{},categorical:[...a]},resolveColor:Sc(a,e.colorScheme),config:e.layoutConfig??{},selection:e.layoutSelection??null};try{return{kind:"success",result:t(l)}}catch(t){const o=null!==i,n=Et("network",t,o,s);"production"!==process.env.NODE_ENV&&console.error("[semiotic] customNetworkLayout threw:",t);try{e.onLayoutError?.(n)}catch(e){"production"!==process.env.NODE_ENV&&console.error("[semiotic] onLayoutError threw:",e)}return{kind:"failure",diagnostic:n,preservedLastGoodScene:o}}}({config:this.config,customLayout:this.config.customNetworkLayout,size:e,nodes:Array.from(this.nodes.values()),edges:Array.from(this.edges.values()),previousResult:this.lastCustomLayoutResult,revision:this.layoutVersion});if("failure"===t.kind)return this.lastCustomLayoutFailure=t.diagnostic,void(t.preservedLastGoodScene||(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++));const o=t.result;return this.sceneNodes=o.sceneNodes??[],this.sceneEdges=o.sceneEdges??[],this.labels=o.labels??[],this.customLayoutOverlays=o.overlays??null,this.customLayoutHtmlMarks=o.htmlMarks??[],this.lastCustomLayoutResult=o,this.lastCustomLayoutFailure=null,this._sceneNodesRevision++,this._customRestyle=o.restyle,this._customRestyleEdge=o.restyleEdge,this.hasCustomRestyle=!(!o.restyle&&!o.restyleEdge),this.hasCustomRestyle&&(this._baseStyles=function(e,t){const o=new WeakMap;for(const t of e)o.set(t,t.style);for(const e of t)o.set(e,e.style);return o}(this.sceneNodes,this.sceneEdges),this.restyleScene(this.config.layoutSelection??null)),void $t({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=lh(this.config.chartType);if(!t)return void this._sceneNodesRevision++;const o=t.hierarchical?Array.from(this.nodes.values()):this.nodesArray,n=t.hierarchical?Array.from(this.edges.values()):this.edgesArray,{sceneNodes:r,sceneEdges:i,labels:s}=t.buildScene(o,n,this.config,e);this.sceneNodes=r,this.sceneEdges=i,this.labels=s,this._sceneNodesRevision++}rebuildNodeQuadtree(){let t=0,o=0;for(const e of this.sceneNodes)"circle"===e.type&&(t++,e.r>o&&(o=e.r));if(this._maxNodeRadius=o,e.QUADTREE_THRESHOLD>=t)return void(this._nodeQuadtree=null);const n=Array(t);let r=0;for(const e of this.sceneNodes)"circle"===e.type&&(n[r++]=e);this._nodeQuadtree=(0,ch.quadtree)().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=lh(this.config.chartType);return!!e?.supportsAnimation&&!1!==this.config.orbitAnimated}tickAnimation(e,t){const o=lh(this.config.chartType);if(!o?.tick)return!1;const n=o.hierarchical?Array.from(this.nodes.values()):this.nodesArray,r=o.hierarchical?Array.from(this.edges.values()):this.edgesArray;return o.tick(n,r,this.config,e,t)}cancelIntroAnimation(){this.transition=null;for(const e of this.nodes.values())e._prevX0=void 0,e._prevX1=void 0,e._prevY0=void 0,e._prevY1=void 0;for(const e of this.edges.values())e._prevY0=void 0,e._prevY1=void 0,e._prevSankeyWidth=void 0,e._introFromZero=!1}advanceTransition(e){if(!this.transition)return!1;const t=Ve(e,this.transition),o=Ge(t);for(const e of this.nodes.values())void 0===e._targetX0||void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=Xe(e._prevX0,e._targetX0,o),e.x1=Xe(e._prevX1,e._targetX1,o),e.y0=Xe(e._prevY0,e._targetY0,o),e.y1=Xe(e._prevY1,e._targetY1,o));for(const e of this.edges.values())void 0!==e._targetY0&&void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&(e._prevSankeyWidth>0||e._introFromZero)&&(e.y0=Xe(e._prevY0,e._targetY0,o),e.y1=Xe(e._prevY1,e._targetY1,o),e.sankeyWidth=Xe(e._prevSankeyWidth,e._targetSankeyWidth,o));return this.rebuildAllBeziers(),1>t||(this.snapToTargets(),this.transition=null,!1)}prepareForRelayout(){const e=this._boundedPrevSnapshot;for(const t of this.nodes.values()){const o=e?.get(t.id);o&&0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1?(t._prevX0=o.x0,t._prevX1=o.x1,t._prevY0=o.y0,t._prevY1=o.y1):(t._prevX0=t.x0,t._prevX1=t.x1,t._prevY0=t.y0,t._prevY1=t.y1)}const t=this._boundedEdgeSnapshot;for(const e of this.edges.values()){if(t&&0===e.sankeyWidth){const o=t.get(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`);if(o){e._prevY0=o.y0,e._prevY1=o.y1,e._prevSankeyWidth=o.sankeyWidth;continue}}e._prevY0=e.y0,e._prevY1=e.y1,e._prevSankeyWidth=e.sankeyWidth}this.nodes.size>0&&(this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null)}finalizeLayout(){const e="vertical"===this.config.orientation?"down":"right";for(const e of this.nodes.values())if(0!==e.x0||0!==e.x1||0!==e.y0||0!==e.y1)e.width=e.x1-e.x0,e.height=e.y1-e.y0,e.x=e.x0+e.width/2,e.y=e.y0+e.height/2;else{const t=5;e.x0=e.x-t,e.x1=e.x+t,e.y0=e.y-t,e.y1=e.y+t,e.width=2*t,e.height=2*t}for(const t of this.edges.values())t.direction=e,this.updateEdgeBezier(t);this.tension=0}saveTargetPositions(){for(const e of this.nodes.values())e._targetX0=e.x0,e._targetX1=e.x1,e._targetY0=e.y0,e._targetY1=e.y1;for(const e of this.edges.values())e._targetY0=e.y0,e._targetY1=e.y1,e._targetSankeyWidth=e.sankeyWidth}restorePreviousPositions(){for(const e of this.nodes.values())void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=e._prevX0,e.x1=e._prevX1,e.y0=e._prevY0,e.y1=e._prevY1);for(const e of this.edges.values())void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&e._prevSankeyWidth>0&&(e.y0=e._prevY0,e.y1=e._prevY1,e.sankeyWidth=e._prevSankeyWidth);this.rebuildAllBeziers()}snapToTargets(){for(const e of this.nodes.values())void 0!==e._targetX0&&(e.x0=e._targetX0,e.x1=e._targetX1,e.y0=e._targetY0,e.y1=e._targetY1);for(const e of this.edges.values())void 0!==e._targetY0&&(e.y0=e._targetY0,e.y1=e._targetY1,e.sankeyWidth=e._targetSankeyWidth),e._introFromZero=void 0;this.rebuildAllBeziers()}updateEdgeBezier(e){!function(e,t,o=.5){const n="string"==typeof e.source?t.get(e.source):e.source,r="string"==typeof e.target?t.get(e.target):e.target;!n||!r||(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))),n=Math.max(15,Math.min(40,.33*(o.targetX-o.leftFullExtent)));return{circular:!0,segments:[[{x:o.sourceX,y:o.sourceY},{x:o.sourceX+.33*e,y:o.sourceY},{x:o.sourceX+.66*e,y:o.sourceY},{x:o.sourceX+e,y:o.sourceY}],[{x:o.targetX-n,y:o.targetY},{x:o.targetX-.66*n,y:o.targetY},{x:o.targetX-.33*n,y:o.targetY},{x:o.targetX,y:o.targetY}]],halfWidth:t}}let n;n="down"===e.direction?[{x:o.sourceY,y:o.sourceX},{x:o.sourceY,y:o.rightFullExtent},{x:o.verticalFullExtent,y:o.rightFullExtent},{x:o.verticalFullExtent,y:o.leftFullExtent},{x:o.targetY,y:o.leftFullExtent},{x:o.targetY,y:o.targetX}]:[{x:o.sourceX,y:o.sourceY},{x:o.rightFullExtent,y:o.sourceY},{x:o.rightFullExtent,y:o.verticalFullExtent},{x:o.leftFullExtent,y:o.verticalFullExtent},{x:o.leftFullExtent,y:o.targetY},{x:o.targetX,y:o.targetY}];const r=[];for(let e=0;n.length-1>e;e++){const t=n[e],o=n[e+1],i=o.x-t.x,s=o.y-t.y;r.push([t,{x:t.x+i/3,y:t.y+s/3},{x:t.x+2*i/3,y:t.y+2*s/3},o])}return{circular:!0,segments:r,halfWidth:t}}(e):function(e,t,o,n=.5){const r=(e.sankeyWidth||1)/2;if("down"===e.direction){const i=t.x1,s=o.x0,a=(0,fh.interpolateNumber)(i,s);return{circular:!1,points:[{x:e.y0,y:i},{x:e.y0,y:a(n)},{x:e.y1,y:a(1-n)},{x:e.y1,y:s}],halfWidth:r}}const i=t.x1,s=o.x0,a=(0,fh.interpolateNumber)(i,s);return{circular:!1,points:[{x:i,y:e.y0},{x:a(n),y:e.y0},{x:a(1-n),y:e.y1},{x:s,y:e.y1}],halfWidth:r}}(e,n,r,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,n=t.color??"rgba(255,255,255,0.6)",r=t.glowRadius??4,{now:i}=e;for(const t of e.sceneNodes){const s=t.id;if(!s)continue;const a=e.nodeTimestamps.get(s);if(!a)continue;const l=i-a;o>l&&(t._pulseIntensity=1-l/o,t._pulseColor=n,t._pulseGlowRadius=r)}for(const t of e.sceneEdges){const r=t.datum;if(!r)continue;const s="object"==typeof r.source?r.source?.id:r.source,a="object"==typeof r.target?r.target?.id:r.target;if(!s||!a)continue;const l=e.edgeTimestamps.get(`${s}\0${a}`);if(!l)continue;const c=i-l;o>c&&(t._pulseIntensity=1-c/o,t._pulseColor=n)}}({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 n=e.cache.ageMap;for(const r of e.sceneNodes){const e=r.id;if(!e)continue;const i=n.get(e);if(void 0===i)continue;const s=rt(t,i,o);r.style={...r.style,opacity:(r.style?.opacity??1)*s}}}({sceneNodes:this.sceneNodes,nodeTimestamps:this.nodeTimestamps,decay:this.config.decay,cache:this._networkDecayCache}),this._decaySortedNodes=this._networkDecayCache.sortedNodes,this._decayAgeMap=this._networkDecayCache.ageMap}applyTopologyDiff(e){!function(e){for(const t of e.sceneNodes)t._pulseColor===ph&&(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>=mh)return;const o=1-t/mh;for(const t of e.sceneNodes){const n=t.id;n&&e.addedNodes.has(n)&&(t._pulseIntensity=Math.max(t._pulseIntensity??0,o),t._pulseColor=ph,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&&mh>o-t}(this.addedNodes,this.lastTopologyChangeTime)}applyThresholds(e){!function(e){const t=e.thresholds;if(!t)return;const o=t.warningColor??"#f59e0b",n=t.criticalColor??"#ef4444",r=!1!==t.pulse;for(const i of e.sceneNodes){const s=i.id;if(!s)continue;const a=e.nodes.get(s);if(!a)continue;const l=t.metric(a);let c=null;void 0===t.critical||t.critical>l?void 0===t.warning||t.warning>l||(c=o):c=n,c&&(i.style={...i.style,fill:c},r&&(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 this.updateResults.recordNoop("update"),null;const n=o.data?{...o.data}:{};return o.data=t(o.data??{}),this.layoutVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("update",1),n}updateEdge(e,t,o){const n=this.config.valueAccessor,r="function"==typeof n?n:n?e=>e[n]:e=>e.value,i=[];for(const[,n]of this.edges)if(("string"==typeof n.source?n.source:n.source.id)===e&&("string"==typeof n.target?n.target:n.target.id)===t){i.push(n.data?{...n.data}:{}),n.data=o(n.data??{});const e=r(n.data);null!=e&&(n.value=Number(e))}return i.length>0?(this.layoutVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("update",i.length)):this.updateResults.recordNoop("update"),i}removeNode(e){if(!this.nodes.has(e))return this.updateResults.recordNoop("remove"),!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=this.currentTime(),this.updateResults.recordData("remove",1),!0}removeEdge(e,t){const o=[];if(void 0===t){const t=this.config.edgeIdAccessor;if(!t)throw Error("removeEdge(edgeId) requires edgeIdAccessor to be configured. Use removeEdge(sourceId, targetId) instead.");const n="function"==typeof t?t:e=>e?.[t];for(const[t,r]of this.edges)r.data&&n(r.data)===e&&o.push(t)}else for(const[n,r]of this.edges)("string"==typeof r.source?r.source:r.source.id)===e&&("string"==typeof r.target?r.target:r.target.id)===t&&o.push(n);for(const e of o)this.edges.delete(e),this.edgeTimestamps.delete(e);return o.length>0?(this.layoutVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("remove",o.length)):this.updateResults.recordNoop("remove"),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(),this.updateResults.recordData("clear")}};jh.QUADTREE_THRESHOLD=500;var Rh=jh;eo(Rh);var Ph=c(require("react")),Lh=require("react/jsx-runtime");function Th(e){const{width:t,height:o,totalWidth:n,totalHeight:r,margin:i,labels:s,title:a,legend:l,legendHoverBehavior:c,legendClickBehavior:u,legendHighlightedCategory:d,legendIsolatedCategories:h,legendPosition:f="right",legendLayout:p,foregroundGraphics:m,sceneNodes:g,annotations:y,onAnnotationActivate:b,onObservation:v,chartId:x,chartType:k,autoPlaceAnnotations:w,svgAnnotationRules:S}=e,A=Kr({onAnnotationActivate:b,onObservation:v,chartId:x,chartType:k}),C=Ph.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 n=on(e.glyph,e.size);return{x:t+n.centerDx,y:o+n.centerDy,r:Math.max(1,n.radius)}}const t=e.cx??(null!=e.x&&null!=e.w?e.x+e.w/2:e.x),o=e.cy??(null!=e.y&&null!=e.h?e.y+e.h/2:e.y);return"number"!=typeof t||"number"!=typeof o?null:{x:t,y:o,r:"number"==typeof e.r?Math.max(1,e.r):"number"==typeof e.outerR?Math.max(1,e.outerR):"number"==typeof e.size?Math.max(1,Lt(e.size)):Math.max(1,e.w??0,e.h??0)/2}}(e),o=function(e){const t=e.id??e.datum?.id??e.datum?.data?.id??e.datum?.data?.name;return null==t?void 0:t+""}(e);return t?[{pointId:o,...t}]:[]});return{scales:null,width:t,height:o,frameType:"network",pointNodes:e,sceneNodes:g}},[o,g,t]),M=Ph.useMemo(()=>y&&w?_i({annotations:y,context:C,..."object"==typeof w?w:{}}):y,[y,w,C]),_=Ph.useMemo(()=>li(),[]),j=M?ai(M.filter(e=>"widget"!==e.type),_,S,C):null,R=!0===M?.some(e=>"widget"===e.type&&!0===e._annotationDeferred);return(0,Lh.jsxs)(Lh.Fragment,{children:[R&&(0,Lh.jsx)("style",{children:zr},"annotation-widget-disclosure-style"),(0,Lh.jsxs)("svg",{role:"img",width:n,height:r,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[(0,Lh.jsx)("title",{children:"string"==typeof a?a:"Network Chart"}),(0,Lh.jsx)("desc",{children:"string"==typeof a?a+" — network data visualization":"Network data visualization"}),(0,Lh.jsxs)("g",{transform:`translate(${i.left},${i.top})`,children:[s.map((e,t)=>(0,Lh.jsx)("text",{x:e.x,y:e.y,textAnchor:e.anchor||"start",dominantBaseline:e.baseline||"middle",fontSize:e.fontSize||11,fontWeight:e.fontWeight,fill:e.fill||"var(--semiotic-text, #333)",stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:e.paintOrder,style:{pointerEvents:"none"},children:e.text},"label-"+t)),j,m]}),a&&"string"==typeof a?(0,Lh.jsx)("text",{x:n/2,y:22,textAnchor:"middle",fontWeight:600,fill:"currentColor",className:"semiotic-chart-title",style:{fontSize:"var(--semiotic-title-font-size, 14px)"},children:a}):a?(0,Lh.jsx)("foreignObject",{x:0,y:0,width:n,height:i.top,children:a}):null,mr({legend:l,totalWidth:n,totalHeight:r,margin:i,legendPosition:f,title:a,legendLayout:p,legendHoverBehavior:c,legendClickBehavior:u,legendHighlightedCategory:d,legendIsolatedCategories:h})]}),M?.filter(e=>"widget"===e.type&&e.nodeId&&g).map((e,t)=>{const o=!0===e._annotationDeferred,n=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(!n)return null;const r=i.left+(n.cx??(null!=n.x&&null!=n.w?n.x+n.w/2:n.x??0)),s=i.top+(n.cy??(null!=n.y&&null!=n.h?n.y+n.h/2:n.y??0)),a=e.dx??0,l=e.dy??-16,c=e.width??32,u=e.height??32,d=e.content??(0,Lh.jsx)("span",{style:{fontSize:18,cursor:"default"},children:"ℹ️"});return(0,Lh.jsx)("div",{...Qr(e,A),className:o?"annotation-deferred":void 0,"data-annotation-disclosure":o?"deferred":void 0,style:{position:"absolute",left:r+a-c/2,top:s+l-u/2,width:c,height:u,display:"flex",alignItems:"center",justifyContent:"center",zIndex:5},children:d},"widget-"+t)})]})}Th.displayName="NetworkSVGOverlay";var Ih=c(require("react")),$h=require("react/jsx-runtime"),Nh={position:"absolute",top:0,left:0,pointerEvents:"none"};function Dh({marks:e,margin:t,selection:o=null,overscan:n=400}){const r=Ih.useRef(null),i=function(e,t,o){const[n,r]=Ih.useState(null);return Ih.useLayoutEffect(()=>{const e=t.current,o=function(e){let t=e?.parentElement??null;for(;t;){const{overflow:e,overflowX:o,overflowY:n}=window.getComputedStyle(t);if(/(auto|scroll|overlay)/.test(`${e} ${n} ${o}`))return t;t=t.parentElement}return null}(e);if(!e||!o)return void r(null);let n=0;const i=()=>{n=0;const t=o.getBoundingClientRect(),i=e.getBoundingClientRect();r(0!==t.width&&0!==t.height?{scroll:{left:t.left,top:t.top,right:t.right,bottom:t.bottom},originX:i.left,originY:i.top}:null)},s=()=>{0===n&&(n=window.requestAnimationFrame(i))};i(),o.addEventListener("scroll",s,{passive:!0});const a=new ResizeObserver(s);return a.observe(o),()=>{0!==n&&window.cancelAnimationFrame(n),o.removeEventListener("scroll",s),a.disconnect()}},[t,e,o]),Ih.useMemo(()=>{if(!e||!n)return e;const{scroll:t,originX:r,originY:i}=n,s=t.left-o,a=t.right+o,l=t.top-o,c=t.bottom+o;return e.filter(e=>{const t=r+e.x,o=i+e.y;return!(s>t+e.width||t>a||l>o+e.height||o>c)})},[e,n,o])}(e,r,n);if(!e||0===e.length)return null;const s=(0,$h.jsx)("div",{className:"semiotic-network-html-marks",ref:r,style:{...Nh,transform:`translate(${t.left}px, ${t.top}px)`},children:(i??e).map(e=>(0,$h.jsx)("div",{className:"semiotic-network-html-mark","data-mark-id":e.id,style:{position:"absolute",transform:`translate(${e.x}px, ${e.y}px)`,width:e.width,height:e.height,pointerEvents:"none"},children:e.content},e.id))});return null!=o?(0,$h.jsx)(Bo,{value:o,children:s}):s}var Eh=require("react/jsx-runtime");function Bh({props:e,store:t,responsiveRef:o,size:n,margin:r,adjustedWidth:i,adjustedHeight:s,resolvedBackground:a,resolvedForeground:l}){const{chartType:c,nodes:u,edges:d,data:h,className:f,description:p,title:m,responsiveWidth:g,responsiveHeight:y,summary:b,background:v,renderMode:x,legend:k,legendPosition:w,legendLayout:S,legendHoverBehavior:A,legendClickBehavior:C,legendHighlightedCategory:M,legendIsolatedCategories:_,layoutSelection:j,annotations:R,onAnnotationActivate:P,annotationObservationCallback:L,onObservation:T,chartId:I,autoPlaceAnnotations:$,svgAnnotationRules:N}=e;if(t){const e=["tree","cluster","treemap","circlepack","partition","orbit"].includes(c),o=e?h||(Array.isArray(d)?void 0:d):void 0;if(e&&o)t.ingestHierarchy(o,[i,s]),t.buildScene([i,s]);else{const e=H(u),o=Array.isArray(d)?H(d):[];(e.length>0||o.length>0)&&(t.ingestBounded(e,o,[i,s]),t.buildScene([i,s]))}}const D=t?.sceneNodes??[],E=t?.sceneEdges??[],B=t?.labels??[];return(0,Eh.jsxs)("div",{ref:o,className:"stream-network-frame"+(f?" "+f:""),role:"img","aria-label":p||("string"==typeof m?m:"Network chart"),style:{position:"relative",width:g?"100%":n[0],height:y?"100%":n[1]},children:[(0,Eh.jsx)(ta,{summary:b}),(0,Eh.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:n[0],height:n[1],style:{position:"absolute",left:0,top:0},children:[a&&(0,Eh.jsx)("g",{transform:`translate(${r.left},${r.top})`,children:a}),(0,Eh.jsxs)("g",{transform:`translate(${r.left},${r.top})`,children:[v&&(0,Eh.jsx)("rect",{x:0,y:0,width:i,height:s,fill:v}),E.map((e,t)=>Tl({node:e,index:t,renderMode:x,fallback:()=>function(e,t){switch(e.type){case"line":return(0,ns.jsx)("line",{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stroke:e.style.stroke||"#999",strokeWidth:e.style.strokeWidth||1,opacity:e.style.opacity},"net-edge-"+t);case"bezier":{const o=e;return(0,ns.jsx)("path",{d:o.pathD,fill:is(o.style.fill,"#999"),fillOpacity:o.style.fillOpacity,stroke:o.style.stroke||"none",strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},"net-edge-"+t)}case"ribbon":{const o=e;return(0,ns.jsx)("path",{d:o.pathD,fill:is(o.style.fill,"#999"),fillOpacity:o.style.fillOpacity,stroke:o.style.stroke||"none",strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},"net-edge-"+t)}case"curved":{const o=e;return(0,ns.jsx)("path",{d:o.pathD,fill:is(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),D.map((e,t)=>Tl({node:e,index:t,renderMode:x,fallback:()=>function(e,t){switch(e.type){case"circle":{const o=e,n=yn(o.style.fill)?kn(o.style.fill,`net-circle-${t}-hatch`):void 0;return(0,ns.jsxs)(Ki.Fragment,{children:[n&&(0,ns.jsx)("defs",{children:n}),(0,ns.jsx)("circle",{cx:o.cx,cy:o.cy,r:o.r,fill:n?`url(#net-circle-${t}-hatch)`:is(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity})]},"net-circle-"+t)}case"rect":{const o=e,n=yn(o.style.fill)?kn(o.style.fill,`net-rect-${t}-hatch`):void 0;return(0,ns.jsxs)(Ki.Fragment,{children:[n&&(0,ns.jsx)("defs",{children:n}),(0,ns.jsx)("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:n?`url(#net-rect-${t}-hatch)`:is(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity})]},"net-rect-"+t)}case"arc":{const o=e,n=(0,Zi.arc)().innerRadius(o.innerR).outerRadius(o.outerR).startAngle(o.startAngle+Math.PI/2).endAngle(o.endAngle+Math.PI/2)(rs)||"",r=yn(o.style.fill)?kn(o.style.fill,`net-arc-${t}-hatch`):void 0;return(0,ns.jsxs)(Ki.Fragment,{children:[r&&(0,ns.jsx)("defs",{children:r}),(0,ns.jsx)("path",{d:n,transform:`translate(${o.cx},${o.cy})`,fill:r?`url(#net-arc-${t}-hatch)`:is(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity})]},"net-arc-"+t)}case"symbol":{const o=e,n=Pt(o.symbolType,o.size,o.path);return(0,ns.jsx)("path",{d:n,transform:o.rotation?`translate(${o.cx},${o.cy}) rotate(${180*o.rotation/Math.PI})`:`translate(${o.cx},${o.cy})`,fill:o.style.fill?is(o.style.fill):"none",stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},"net-symbol-"+t)}case"glyph":return as(e,e.cx,e.cy,"net-glyph-"+(e.id??t));default:return null}}(e,t)})).filter(Boolean),B.map((e,t)=>function(e,t){return(0,ns.jsx)("text",{x:e.x,y:e.y,textAnchor:e.anchor||"middle",dominantBaseline:e.baseline||"auto",fontSize:e.fontSize||11,fontWeight:e.fontWeight,fill:e.fill||"var(--semiotic-text, #333)",stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:e.paintOrder,children:e.text},"net-label-"+t)}(e,t)).filter(Boolean)]})]}),(0,Eh.jsx)(Th,{width:i,height:s,totalWidth:n[0],totalHeight:n[1],margin:r,labels:B,sceneNodes:D,title:m,legend:k,legendPosition:w,legendLayout:S,legendHoverBehavior:A,legendClickBehavior:C,legendHighlightedCategory:M,legendIsolatedCategories:_,foregroundGraphics:Io(l,Ho(t?.customLayoutOverlays,j??null)),annotations:R,onAnnotationActivate:P,onObservation:L??T,chartId:I,chartType:"StreamNetworkFrame",autoPlaceAnnotations:$,svgAnnotationRules:N,annotationFrame:0}),(0,Eh.jsx)(Dh,{marks:t?.customLayoutHtmlMarks,margin:r,selection:j??null})]})}var Fh=c(require("react")),Hh=require("react/jsx-runtime");function Oh({componentName:e,message:t,diagnosticHint:o,width:n,height:r}){return(0,Hh.jsx)("div",{role:"alert",style:{width:n,height:Math.max(r,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:(0,Hh.jsxs)("div",{style:{textAlign:"center",maxWidth:400},children:[(0,Hh.jsx)("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:e}),(0,Hh.jsx)("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:t}),o&&(0,Hh.jsx)("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:o})]})})}var zh=require("react/jsx-runtime"),Wh=class extends Fh.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){this.props.onError?.(e,t)}render(){if(this.state.error){const{fallback:e}=this.props,t=this.state.error;return"function"==typeof e?e(t):void 0!==e?e:(0,zh.jsx)(Oh,{componentName:"ChartErrorBoundary",message:t.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}},qh=require("react/jsx-runtime"),Yh="undefined"!=typeof process&&"production"!==process.env?.NODE_ENV;function Gh({componentName:e,width:t,height:o,children:n}){return(0,qh.jsx)(Wh,{fallback:n=>(0,qh.jsx)(Oh,{componentName:e,message:n.message,width:t,height:o}),children:n})}var Vh={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"},Xh={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Uh(e,t,o,n){return!1===n||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?(0,qh.jsx)("div",{style:{...Vh,width:t,height:o},children:n||"No data available"}):null}function Kh(e,t,o,n){if(!e)return null;if(!1===n)return null;if(null!=n)return(0,qh.jsx)("div",{style:{width:t,height:o,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:n});const r=Math.min(5,Math.floor(o/40)),i=Math.max(8,Math.floor(o/(3*r))),s=Math.max(6,Math.floor(o/(2.5*r))),a=Math.floor((o-(r*(i+s)-s))/2);return(0,qh.jsx)("div",{style:{width:t,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:r},(e,o)=>(0,qh.jsx)("div",{className:"semiotic-loading-bar",style:{...Xh,position:"absolute",top:a+o*(i+s),left:Math.floor(.1*t),width:30+(37*o+13)%50+"%",height:i,opacity:.5+o%2*.2}},o))})}function Zh(e,t,o,n){if(!Yh)return;if(!t||0===t.length)return;if("string"!=typeof n)return;const r=t[0];if(!r||"object"!=typeof r)return;if(n in r)return;const i=Object.keys(r).join(", ");console.warn(`[semiotic] ${e}: ${o} "${n}" not found in data. Available keys: ${i}`)}var Qh={},Jh=4e4;function ef(e,t,o,n,r=Jh){return"sync"!==e&&("worker"===e||n*(t+o)>=r)}function tf(){return"undefined"!=typeof window&&"undefined"!=typeof Worker}function of(){if("undefined"!=typeof DOMException)return new DOMException("Force layout aborted","AbortError");const e=Error("Force layout aborted");return e.name="AbortError",e}var nf=class{constructor(e=function(){const e="string"==typeof Qh.url&&Qh.url?new URL("./forceLayoutWorker.js",Qh.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,n=null!=o?this.pending.get(o):this.pending.values().next().value;if(n){if(null!=o?this.pending.delete(o):this.pending.clear(),n.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 n.reject(e)}n.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(of());const o=this.nextRequestId;this.nextRequestId+=1;const n={requestId:o,request:e};return new Promise((e,r)=>{const i=()=>{this.pending.delete(o),t?.removeEventListener("abort",i),r(of())},s=()=>t?.removeEventListener("abort",i);this.pending.set(o,{cleanup:s,reject:r,resolve:e}),t?.addEventListener("abort",i,{once:!0});try{this.worker.postMessage(n)}catch(e){this.pending.delete(o),s(),r(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()}},rf=null;function sf(e,t){return tf()?t?.aborted?Promise.reject(of()):(rf&&!rf.isDead||(rf=new nf),rf).request(e,t):Promise.reject(Error("Web Workers are unavailable"))}var af=require("react/jsx-runtime"),lf=/^(value|amount|total|count|weight|score)$/i;function cf({data:e}){if("edge"===e.nodeOrEdge){const t=e.data;return t?(0,af.jsxs)("div",{className:"semiotic-tooltip",style:ya,children:[(0,af.jsxs)("div",{style:{fontWeight:600},children:["object"==typeof t.source?t.source.id:t.source," → ","object"==typeof t.target?t.target.id:t.target]}),null!=t.value&&(0,af.jsxs)("div",{style:{marginTop:4,opacity:.8},children:["Value:"," ","number"==typeof t.value?t.value.toLocaleString():t.value+""]})]}):null}const t=e.data;if(!t)return null;const o=t.__hierarchyNode;if(o){const e=[];let n=o;for(;n;){const o=n.data?.name??n.data?.id??t.id;null!=o&&e.unshift(o+""),n=n.parent}e.length>1&&e.shift();const r=e.length-1;return(0,af.jsxs)("div",{className:"semiotic-tooltip",style:ya,children:[(0,af.jsx)("div",{children:e.map((e,t)=>(0,af.jsxs)("span",{children:[t>0&&(0,af.jsx)("span",{style:{margin:"0 3px",opacity:.5},children:" → "}),t===r?(0,af.jsx)("strong",{children:e}):(0,af.jsx)("span",{style:{opacity:.7},children:e})]},t))}),null!=t.value&&t.value>0&&(0,af.jsx)("div",{style:{marginTop:4,opacity:.8},children:"number"==typeof t.value?t.value.toLocaleString():t.value+""})]})}const n=(t.sourceLinks?.length||0)+(t.targetLinks?.length||0),r=(t.sourceLinks||[]).reduce((e,t)=>e+(t.value||0),0)+(t.targetLinks||[]).reduce((e,t)=>e+(t.value||0),0),i=ma(t.data??t),s=null!=i.title?i.title+"":t.id,a=i.entries.some(e=>lf.test(e.key));return(0,af.jsxs)("div",{className:"semiotic-tooltip",style:ya,children:[(0,af.jsx)("div",{style:{fontWeight:600},children:s}),i.entries.map(e=>(0,af.jsxs)("div",{style:{marginTop:4,opacity:.8},children:[e.key,": ",Nl(e.value)]},e.key)),!a&&null!=t.value&&t.value>0&&(0,af.jsxs)("div",{style:{marginTop:4,opacity:.8},children:["Total:"," ","number"==typeof t.value?t.value.toLocaleString():t.value+""]}),n>0&&(0,af.jsxs)("div",{style:{marginTop:4,opacity:.8},children:["Connections: ",n,r!==n&&` (weighted: ${r.toLocaleString()})`]})]})}function uf(e){return e._cachedPath2D&&e._cachedPath2DSource===e.pathD||(e._cachedPath2D=new Path2D(e.pathD),e._cachedPath2DSource=e.pathD),e._cachedPath2D}function df(e,t){if(!t.pathD)return;e.save();const o=uf(t);if(t.style.fill&&"none"!==t.style.fill){const n=t._gradient;if(n){const o=e.createLinearGradient(n.x0,0,n.x1,0),r=t.style.fillOpacity??t.style.opacity??.5,i="string"==typeof t.style.fill?t.style.fill:"#999",s=hn(e,i)||i;o.addColorStop(0,1===n.from?s:"transparent"),o.addColorStop(1,1===n.to?s:"transparent"),e.fillStyle=o,e.globalAlpha=r}else e.fillStyle=Cn(e,t.style.fill,"#007bff"),e.globalAlpha=t.style.fillOpacity??t.style.opacity??.5;e.fill(o)}t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=hn(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 hf(e,t){e.save();const o=t.style.stroke||"#999";e.strokeStyle=hn(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 ff(e,t){if(!t.pathD)return;e.save();const o=uf(t);t.style.fill&&"none"!==t.style.fill&&(e.fillStyle=Cn(e,t.style.fill,"#007bff"),e.globalAlpha=t.style.fillOpacity??t.style.opacity??.5,e.fill(o)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=hn(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 pf(e,t){if(!t.pathD)return;e.save();const o=uf(t),n=t.style.stroke||"#999";e.strokeStyle=hn(e,n)||n,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=Cn(e,t.style.fill,"#007bff"),e.globalAlpha=t.style.fillOpacity??.1,e.fill(o)),e.restore()}cf.ownsChrome=!0;var mf=new Map;function gf(e){try{if(e.path)return new Path2D(e.path);const t=`${e.symbolType??"circle"}:${Math.round(e.size)}`;let o=mf.get(t);return o||(o=new Path2D(Pt(e.symbolType,e.size)),mf.size>256&&mf.clear(),mf.set(t,o)),o}catch{return null}}function yf(e){const{sceneNodes:t,nodes:o,nodeColorMap:n,colorScheme:r}=e;for(const e of t)e.id&&"string"==typeof e.style?.fill&&n.set(e.id,e.style.fill);const i=Array.isArray(r)?r:Be,s=Array.from(o);for(let e=0;s.length>e;e++){const t=s[e];n.has(t.id)||n.set(t.id,i[e%i.length])}return s.length}function bf(e,t,o,n=30){switch(e.type){case"circle":return function(e,t,o,n=30){const r=t-e.cx,i=o-e.cy,s=Math.sqrt(r*r+i*i);return s>Yo(e.r,n)?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:s}}(e,t,o,n);case"rect":return function(e,t,o){const n=qo(t,o,e);return n.hit?{type:"node",datum:e.datum,x:n.cx,y:n.cy,distance:0}:null}(e,t,o);case"arc":return function(e,t,o){const n=t-e.cx,r=o-e.cy,i=Math.sqrt(n*n+r*r);if(e.innerR-2>i||i>e.outerR+2)return null;const s=Xo(Math.atan2(r,n)),a=Xo(e.startAngle),l=Xo(e.endAngle);if(a>l?s>=a||l>=s:s>=a&&l>=s){const t=(e.startAngle+e.endAngle)/2,o=(e.innerR+e.outerR)/2;return{type:"node",datum:e.datum,x:e.cx+o*Math.cos(t),y:e.cy+o*Math.sin(t),distance:0}}return null}(e,t,o);case"symbol":return function(e,t,o,n=30){const r=t-e.cx,i=o-e.cy,s=Math.sqrt(r*r+i*i);return s>Yo(Lt(e.size),n)?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:s}}(e,t,o,n);case"glyph":return function(e,t,o,n=30){if(null==e.datum)return null;const r=on(e.glyph,e.size),i=e.cx+r.centerDx,s=e.cy+r.centerDy,a=t-i,l=o-s,c=Math.sqrt(a*a+l*l);return c>Yo(r.radius,n)?null:{type:"node",datum:e.datum,x:i,y:s,distance:c}}(e,t,o,n);default:return null}}var vf=null,xf=null;function kf(){return xf||((vf=document.createElement("canvas")).width=1,vf.height=1,xf=vf.getContext("2d")),xf}function wf(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 Sf(e,t,o){switch(e.type){case"bezier":return function(e,t,o){if(!e.pathD)return null;const n=wf(e),r=kf();if(!n||!r)return null;try{if(r.isPointInPath(n,t,o))return{type:"edge",datum:e.datum,x:t,y:o,distance:0};const i=r.lineWidth;r.lineWidth=10;const s=r.isPointInStroke(n,t,o);if(r.lineWidth=i,s)return{type:"edge",datum:e.datum,x:t,y:o,distance:4}}catch{}return null}(e,t,o);case"line":return function(e,t,o){const n=e.x2-e.x1,r=e.y2-e.y1,i=n*n+r*r;if(0===i)return null;let s=((t-e.x1)*n+(o-e.y1)*r)/i;s=Math.max(0,Math.min(1,s));const a=e.x1+s*n,l=e.y1+s*r,c=Math.sqrt((t-a)**2+(o-l)**2);return c>5?null:{type:"edge",datum:e.datum,x:a,y:l,distance:c}}(e,t,o);case"ribbon":case"curved":return function(e,t,o){if(!e.pathD)return null;const n=wf(e),r=kf();if(!n||!r)return null;try{if(r.isPointInPath(n,t,o))return{type:"edge",datum:e.datum,x:t,y:o,distance:0};const i=r.lineWidth;r.lineWidth=10;const s=r.isPointInStroke(n,t,o);if(r.lineWidth=i,s)return{type:"edge",datum:e.datum,x:t,y:o,distance:4}}catch{}return null}(e,t,o);default:return null}}function Af(e){const{clientX:t,clientY:o,canvasRect:n,margin:r,adjustedWidth:i,adjustedHeight:s,sceneNodes:a,sceneEdges:l,nodeQuadtree:c,maxNodeRadius:u,hitRadius:d=30}=e,h=t-n.left-r.left,f=o-n.top-r.top;if(0>h||h>i||0>f||f>s)return{kind:"miss-outside"};const p=function(e,t,o,n,r=30,i,s=0){let a=null,l=r,c=1/0;if(i){const e=rn(i,o,n,r,s,e=>e.cx,e=>e.cy,e=>e.r);e&&(a={type:"node",datum:e.node.datum,x:e.node.cx,y:e.node.cy,distance:e.distance},l=e.distance)}for(const t of e){if(i&&"circle"===t.type)continue;const e=bf(t,o,n,r);if(e)if("rect"===t.type){const o=t.w*t.h;c>o&&(a=e,c=o)}else l>e.distance&&(a=e,l=e.distance)}if(a)return a;for(const e of t){if(!1===e.interactive)continue;const t=Sf(e,o,n);t&&l>t.distance&&(a=t,l=t.distance)}return a}(a,l,h,f,d,c,u);return p?{kind:"hit",hover:ca(p.datum||{},p.x,p.y,{nodeOrEdge:p.type})}:{kind:"miss"}}var Cf=require("react"),Mf="StreamNetworkFrame",_f=require("react/jsx-runtime"),jf={top:20,right:80,bottom:20,left:80},Rf={top:40,right:40,bottom:40,left:40},Pf=new Set(["chord","force","circlepack","orbit"]),Lf=[800,600],Tf=(0,Iu.memo)((0,Iu.forwardRef)(function(e,t){const{chartType:o,nodes:n,edges:r,data:i,initialEdges:s,nodeIDAccessor:a="id",sourceAccessor:l="source",targetAccessor:c="target",valueAccessor:u="value",edgeIdAccessor:d,childrenAccessor:h,hierarchySum:f,orientation:p="horizontal",nodeAlign:m="justify",nodePaddingRatio:g=.05,nodeWidth:y=15,iterations:b=300,forceStrength:v=.1,layoutExecution:x="auto",layoutLoadingContent:k,onLayoutStateChange:w,padAngle:S=.01,groupWidth:A=20,sortGroups:C,edgeSort:M,treeOrientation:_="vertical",edgeType:j="curve",padding:R,paddingTop:P,tensionConfig:L,showParticles:T=!1,particleStyle:I,renderMode:$,nodeStyle:N,edgeStyle:D,colorBy:E,colorScheme:B="category10",edgeColorBy:F="source",edgeOpacity:O=.5,colorByDepth:z=!1,nodeSize:W=8,nodeSizeRange:q=[5,20],nodeLabel:Y,showLabels:V=!0,labelMode:X,size:U=Lf,responsiveWidth:K,responsiveHeight:Z,margin:Q,className:J,background:ee,enableHover:te=!0,tooltipContent:oe,customHoverBehavior:ne,customClickBehavior:re,onObservation:ie,annotationObservationCallback:se,chartId:ae,onTopologyChange:le,annotations:ce,onAnnotationActivate:ue,autoPlaceAnnotations:de,svgAnnotationRules:he,legend:fe,legendPosition:pe,legendLayout:me,legendHoverBehavior:ge,legendClickBehavior:ye,legendHighlightedCategory:be,legendIsolatedCategories:ve,title:xe,foregroundGraphics:ke,backgroundGraphics:we,decay:Se,pulse:Ae,transition:Ce,animate:Me,staleness:_e,frameScheduler:je,clock:Re,random:Pe,seed:Le,paused:Te=!1,suspendWhenHidden:Ie=!0,thresholds:$e,accessibleTable:Ne=!0,description:De,summary:Ee,orbitMode:Fe,orbitSize:He,orbitSpeed:Oe,orbitRevolution:ze,orbitRevolutionStyle:We,orbitEccentricity:qe,orbitShowRings:Ye,orbitAnimated:Ge,customNetworkLayout:Ve,onLayoutError:Xe,layoutConfig:Ue,layoutSelection:Ke}=e,Ze=Pf.has(o)?Rf:jf,Qe=(0,Iu.useRef)(!0),Je=Fa({sizeProp:U,responsiveWidth:K,responsiveHeight:Z,userMargin:Q,marginDefault:Ze,title:xe,legend:fe,legendPosition:pe,foregroundGraphics:ke,backgroundGraphics:we,animate:Me,transitionProp:Ce,frameScheduler:je,clock:Re,random:Pe,seed:Le,paused:Te,suspendWhenHidden:Ie,themeDirtyRef:Qe}),{reducedMotionRef:et,responsiveRef:tt,size:ot,margin:nt,adjustedWidth:rt,adjustedHeight:it,resolvedForeground:st,resolvedBackground:at,transition:lt,introEnabled:ct,tableId:ut,rafRef:dt,renderFnRef:ht,scheduleRender:ft,frameRuntime:pt,currentTheme:mt}=Je,gt=hs(),yt=gs(),bt=(0,Iu.useMemo)(()=>H(n),[n]),vt=(0,Iu.useMemo)(()=>Array.isArray(r)?H(r):r,[r]),xt=(0,Iu.useMemo)(()=>({...$u,...L}),[L]),kt=(0,Iu.useMemo)(()=>({...Nu,...I}),[I]),wt=(0,Iu.useMemo)(()=>{return{chartType:(e={chartType:o,clock:pt.now,random:Pe,seed:Le,nodeIDAccessor:a,sourceAccessor:l,targetAccessor:c,valueAccessor:u,edgeIdAccessor:d,childrenAccessor:h,hierarchySum:f,orientation:p,nodeAlign:m,nodePaddingRatio:g,nodeWidth:y,iterations:b,forceStrength:v,padAngle:S,groupWidth:A,sortGroups:C,edgeSort:M,treeOrientation:_,edgeType:j,padding:R,paddingTop:P,tensionConfig:xt,showParticles:T,particleStyle:kt,nodeStyle:N,edgeStyle:D,nodeLabel:Y,showLabels:V,labelMode:X,colorBy:E,colorScheme:B,edgeColorBy:F,edgeOpacity:O,colorByDepth:z,nodeSize:W,nodeSizeRange:q,decay:Se,pulse:Ae,transition:lt,introAnimation:ct,staleness:_e,thresholds:$e,orbitMode:Fe,orbitSize:He,orbitSpeed:Oe,orbitRevolution:ze,orbitRevolutionStyle:We,orbitEccentricity:qe,orbitShowRings:Ye,orbitAnimated:Ge,customNetworkLayout:Ve,onLayoutError:Xe,layoutConfig:Ue,currentTheme:mt}).chartType,clock:e.clock,random:e.random,seed:e.seed,nodeIDAccessor:e.nodeIDAccessor,sourceAccessor:e.sourceAccessor,targetAccessor:e.targetAccessor,valueAccessor:e.valueAccessor,edgeIdAccessor:e.edgeIdAccessor,childrenAccessor:e.childrenAccessor,hierarchySum:e.hierarchySum,orientation:e.orientation,nodeAlign:e.nodeAlign,nodePaddingRatio:e.nodePaddingRatio,nodeWidth:e.nodeWidth,iterations:e.iterations,forceStrength:e.forceStrength,padAngle:e.padAngle,groupWidth:e.groupWidth,sortGroups:e.sortGroups,edgeSort:e.edgeSort,treeOrientation:e.treeOrientation,edgeType:e.edgeType,padding:e.padding,paddingTop:e.paddingTop,tensionConfig:e.tensionConfig,showParticles:e.showParticles,particleStyle:e.particleStyle,nodeStyle:e.nodeStyle,edgeStyle:e.edgeStyle,nodeLabel:e.nodeLabel,showLabels:e.showLabels,labelMode:e.labelMode,colorBy:e.colorBy,colorScheme:e.colorScheme,themeCategorical:e.currentTheme?.colors?.categorical,themeSemantic:G(e.currentTheme),edgeColorBy:e.edgeColorBy,edgeOpacity:e.edgeOpacity,colorByDepth:e.colorByDepth,nodeSize:e.nodeSize,nodeSizeRange:e.nodeSizeRange,decay:e.decay,pulse:e.pulse,transition:e.transition,introAnimation:e.introAnimation,staleness:e.staleness,thresholds:e.thresholds,orbitMode:e.orbitMode,orbitSize:e.orbitSize,orbitSpeed:e.orbitSpeed,orbitRevolution:e.orbitRevolution,orbitRevolutionStyle:e.orbitRevolutionStyle,orbitEccentricity:e.orbitEccentricity,orbitShowRings:e.orbitShowRings,orbitAnimated:e.orbitAnimated,customNetworkLayout:e.customNetworkLayout,onLayoutError:e.onLayoutError,layoutConfig:e.layoutConfig};var e},[o,pt.now,Pe,Le,a,l,c,u,d,h,f,p,m,g,y,b,v,S,A,C,M,_,j,R,P,xt,T,kt,N,D,Y,V,X,E,B,F,O,z,W,q,Se,Ae,lt,ct,_e,$e,Fe,He,Oe,ze,We,qe,Ye,Ge,Ve,Xe,Ue,mt]),St=bs(wt),At=bs({chartType:(Ct={chartType:o,nodeIDAccessor:a,sourceAccessor:l,targetAccessor:c,valueAccessor:u,edgeIdAccessor:d,childrenAccessor:h,hierarchySum:f,orientation:p,nodeAlign:m,nodePaddingRatio:g,nodeWidth:y,iterations:b,forceStrength:v,padAngle:S,groupWidth:A,sortGroups:C,edgeSort:M,treeOrientation:_,edgeType:j,padding:R,paddingTop:P,random:Pe,seed:Le,tensionConfig:xt,customNetworkLayout:Ve,orbitMode:Fe,orbitSize:He,orbitEccentricity:qe}).chartType,nodeIDAccessor:Ct.nodeIDAccessor,sourceAccessor:Ct.sourceAccessor,targetAccessor:Ct.targetAccessor,valueAccessor:Ct.valueAccessor,edgeIdAccessor:Ct.edgeIdAccessor,childrenAccessor:Ct.childrenAccessor,hierarchySum:Ct.hierarchySum,orientation:Ct.orientation,nodeAlign:Ct.nodeAlign,nodePaddingRatio:Ct.nodePaddingRatio,nodeWidth:Ct.nodeWidth,iterations:Ct.iterations,forceStrength:Ct.forceStrength,padAngle:Ct.padAngle,groupWidth:Ct.groupWidth,sortGroups:Ct.sortGroups,edgeSort:Ct.edgeSort,treeOrientation:Ct.treeOrientation,edgeType:Ct.edgeType,padding:Ct.padding,paddingTop:Ct.paddingTop,random:Ct.random,seed:Ct.seed,tensionConfig:Ct.tensionConfig,customNetworkLayout:Ct.customNetworkLayout,orbitMode:Ct.orbitMode,orbitSize:Ct.orbitSize,orbitEccentricity:Ct.orbitEccentricity});var Ct;const Mt=(0,Iu.useRef)(0),_t=(0,Iu.useRef)(0),jt=(0,Iu.useRef)(!1),Rt=(0,Iu.useRef)(null);Rt.current||(Rt.current=new Rh(St));const Pt=Po("StreamNetworkFrame"),Lt=(0,Iu.useCallback)((e,t,o=!1)=>function(e,t,o,n=!1,r=!1){const i=e.beforeCompute(t.getLastUpdateResult(),n);o(),e.afterCompute(i,!0,r)}(Pt.current,e,()=>e.buildScene(t),o),[Pt]),[Tt,It]=(0,Iu.useState)(null),[$t,Nt]=(0,Iu.useState)(0),[Dt,Et]=(0,Iu.useState)(0),[Bt,Ft]=(0,Iu.useState)(!1),[Ht,Ot]=(0,Iu.useState)(!1),zt=(0,Iu.useRef)(0),Wt=(0,Iu.useRef)(null),qt=(0,Iu.useRef)(!1),Yt=(0,Iu.useRef)(w);Yt.current=w;const Gt=(0,Iu.useRef)(St);Gt.current=St;const Vt=(0,Iu.useRef)(null),Xt=(0,Iu.useRef)(new Map),Ut=(0,Iu.useRef)(0),Kt=(0,Iu.useCallback)(e=>function(e){const{node:t,colorBy:o,colorScheme:n,nodeColorMap:r,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(!r.has(e+"")){const t=Array.isArray(n)?n:Be;r.set(e+"",t[i.current++%t.length])}return r.get(e+"")}}if(r.has(t.id))return r.get(t.id);const s=Array.isArray(n)?n:Be,a=o?s[i.current++%s.length]:s[0];return r.set(t.id,a),a}({node:e,colorBy:E,colorScheme:B,nodeColorMap:Xt.current,colorIndexRef:Ut}),[E,B]),Zt=(Qt=mt,Qt?.colors?.border||Qt?.colors?.secondary||Qt?.colors?.primary||"#999");var Qt;const Jt=(0,Iu.useCallback)(e=>function(e,t){return e?"object"==typeof e?e:t?.get(e)??null:null}(e,Rt.current?.nodes),[]),eo=(0,Iu.useCallback)(e=>function(e){const{edge:t,edgeColorBy:o,getNodeColor:n,resolveEndpoint:r,fallback:i}=e;if("function"==typeof o)return o(t);const s=r(t.source),a=r(t.target);return"target"===o&&a?n(a):s?n(s):i}({edge:e,edgeColorBy:F,getNodeColor:Kt,resolveEndpoint:Jt,fallback:Zt}),[F,Kt,Zt,Jt]),to=(0,Iu.useCallback)(e=>function(e){const{edge:t,particleStyleColor:o,particleColorBy:n,hasExplicitParticleColorBy:r,getEdgeColor:i,getNodeColor:s,resolveEndpoint:a,fallback:l}=e;if("function"==typeof o){const e=a(t.source);return e?o(t,e):l}if(!r)return i(t);const c=n,u=a(t.source),d=a(t.target);return"target"===c&&d?s(d):u?s(u):l}({edge:e,particleStyleColor:kt.color,particleColorBy:kt.colorBy,hasExplicitParticleColorBy:!!I?.colorBy,getEdgeColor:eo,getNodeColor:Kt,resolveEndpoint:Jt,fallback:Zt}),[I?.colorBy,kt.color,kt.colorBy,Kt,eo,Zt,Jt]),oo=function(e,t,o,n,r){return("sankey"===e||t)&&o||n||r}(o,!!Ve,T,!!Ae,Rt.current?.isAnimating??!1);zo(Rt,St,Qe,ft),Wo(Rt,Ke,Qe,ft),(0,Iu.useEffect)(()=>{const e=Rt.current;e&&(Lt(e,[rt,it]),Ut.current=yf({sceneNodes:e.sceneNodes,nodes:e.nodes.values(),nodeColorMap:Xt.current,colorScheme:B}),Qe.current=!0,ft())},[mt,rt,it,Lt,ft,B]);const no=(0,Iu.useCallback)(()=>{const e=Rt.current;if(e&&(e.runLayout([rt,it]),Lt(e,[rt,it]),Qe.current=!0,Ut.current=yf({sceneNodes:e.sceneNodes,nodes:e.nodes.values(),nodeColorMap:Xt.current,colorScheme:B}),Nt(e.layoutVersion),le)){const{nodes:t,edges:o}=e.getLayoutData();le(t,o)}},[rt,it,Lt,le,B]),ro=(0,Iu.useCallback)(e=>{if(null==e||"object"!=typeof e)return;const t=Rt.current;t&&(t.ingestEdge(e)&&no(),ft())},[no,ft]),io=(0,Iu.useCallback)(e=>{const t=Rt.current;if(!t)return;let o=!1;for(const n of e)null!=n&&"object"==typeof n&&t.ingestEdge(n)&&(o=!0);o&&no(),ft()},[no,ft]),so=(0,Iu.useCallback)(()=>{Rt.current?.clear(),Xt.current.clear(),Ut.current=0,Nt(Rt.current?.layoutVersion??0),It(null),Vt.current=null,Qe.current=!0,ft()},[ft]),ao=(0,Iu.useCallback)(()=>{const e=Rt.current;e&&(e.tension+=999,no(),ft())},[no,ft]);(0,Iu.useImperativeHandle)(t,()=>({push:ro,pushMany:io,removeNode:e=>{const t=Rt.current?.removeNode(e)??!1;if(t){const t=Vt.current?.data?"function"==typeof a?a(Vt.current.data):Vt.current.data[a]:void 0;Vt.current&&"node"===Vt.current.nodeOrEdge&&t===e&&(Vt.current=null,It(null)),Xt.current.delete(e),no(),Qe.current=!0,ft()}return t},removeEdge:(e,t)=>{const o=Rt.current?.removeEdge(e,t)??!1;if(o){if(Vt.current&&"edge"===Vt.current.nodeOrEdge){const o=Vt.current.data;let n;n=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,n&&(Vt.current=null,It(null))}no(),Qe.current=!0,ft()}return o},updateNode:(e,t)=>{const o=Rt.current?.updateNode(e,t)??null;return o&&(Qe.current=!0,ft()),o},updateEdge:(e,t,o)=>{const n=Rt.current?.updateEdge(e,t,o)??[];return n.length>0&&(no(),Qe.current=!0,ft()),n},clear:so,getTopology:()=>Rt.current?.getLayoutData()??{nodes:[],edges:[]},getCustomLayout:()=>Rt.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>Rt.current?.lastCustomLayoutFailure??null,getTopologyDiff:()=>{const e=Rt.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:ao,getTension:()=>Rt.current?.tension??0}),[ro,io,so,ao,a,no,ft,d]);const lo=["tree","cluster","treemap","circlepack","partition","orbit"].includes(o),co=lo?i||(Array.isArray(r)?void 0:r):void 0;(0,Iu.useEffect)(()=>{const e=Rt.current;if(!e)return;const t=++zt.current;if(Wt.current?.abort(),Wt.current=null,lo&&co)e.ingestHierarchy(co,[rt,it]),Lt(e,[rt,it]),Ot(!1),Yt.current?.("ready"),Qe.current=!0,ft();else{const i=bt,s=Array.isArray(vt)?vt:[];if(0===i.length&&0===s.length)return null==n&&null==r||0>=e.nodes.size&&0>=e.edges.size||so(),Ot(!1),void Yt.current?.("ready");const a=[rt,it],l="force"===o&&!Ve&&tf()&&!Pe&&ef(x,i.length,s.length,b);if(l&&yt&&!qt.current&&e.sceneNodes.length>0)return qt.current=!0,Ot(!1),Yt.current?.("ready"),Qe.current=!0,void ft();if(l){const o=new AbortController;Wt.current=o;const n=e._lastPositionSnapshot;e.ingestBounded(i,s,a,{deferLayout:!0});const r=e.getLayoutData(),l=function(e,t,o,n,r){const i=Od(o.nodeSize,o.nodeSizeRange,e);return{kind:"frame",nodes:e.map(e=>{const t=r?.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,n=e.data?.weight,r="number"==typeof n&&Number.isFinite(n)?n:e.value;return{source:t,target:o,value:e.value,y0:0,y1:0,sankeyWidth:0,weight:r}}),config:{chartType:"force",iterations:o.iterations,forceStrength:o.forceStrength,seed:o.seed},size:n}}(r.nodes,r.edges,Gt.current,a,n);return Ot(!0),Yt.current?.("pending"),sf(l,o.signal).then(({positions:o})=>{t===zt.current&&(e.applyForceLayoutPositions(o,a),Lt(e,a),Ut.current=yf({sceneNodes:e.sceneNodes,nodes:e.nodes.values(),nodeColorMap:Xt.current,colorScheme:B}),Ot(!1),Yt.current?.("ready"),Nt(e.layoutVersion),Qe.current=!0,ft())}).catch(o=>{"AbortError"!==o.name&&t===zt.current&&(e.runLayout(a),Lt(e,a),Ut.current=yf({sceneNodes:e.sceneNodes,nodes:e.nodes.values(),nodeColorMap:Xt.current,colorScheme:B}),Ot(!1),Yt.current?.("error"),Nt(e.layoutVersion),Qe.current=!0,ft())}),()=>o.abort()}e.ingestBounded(i,s,a),Lt(e,a),Ot(!1),Yt.current?.("ready"),Ut.current=yf({sceneNodes:e.sceneNodes,nodes:e.nodes.values(),nodeColorMap:Xt.current,colorScheme:B}),Qe.current=!0,ft()}},[bt,vt,n,r,i,co,lo,rt,it,At,x,b,yt,o,Ve,Pe,ft,so,B,Lt]),(0,Iu.useEffect)(()=>{s&&s.length>0&&io(s)},[s,io]);const{customHoverBehavior:uo,customClickBehavior:ho}=function({customHoverBehavior:e,customClickBehavior:t,onObservation:o,chartId:n}){return{customHoverBehavior:(0,Cf.useCallback)((t,r)=>{e?.(t,r),Gl({onObservation:o,datum:t?t.data||t:null,x:t?.x,y:t?.y,chartType:Mf,chartId:n,context:r})},[e,o,n]),customClickBehavior:(0,Cf.useCallback)((e,r)=>{t?.(e,r),Vl({onObservation:o,datum:e?e.data||e:null,x:e?.x,y:e?.y,chartType:Mf,chartId:n,context:r})},[t,o,n])}}({customHoverBehavior:ne,customClickBehavior:re,onObservation:ie,chartId:ae}),{hoverHandlerRef:fo,hoverLeaveRef:po,onPointerMove:mo,onPointerLeave:go}=Je,yo=()=>!Ve||(Rt.current?.hasCustomRestyle??!1);fo.current=e=>{if(!te)return;const t=yo(),o=Co.current;if(!o)return;const n=Rt.current;if(!n)return;const r=Af({clientX:e.clientX,clientY:e.clientY,canvasRect:o.getBoundingClientRect(),margin:nt,adjustedWidth:rt,adjustedHeight:it,sceneNodes:n.sceneNodes,sceneEdges:n.sceneEdges,nodeQuadtree:n.nodeQuadtree,maxNodeRadius:n.maxNodeRadius});"hit"===r.kind?(Vt.current=r.hover,It(r.hover),uo&&(uo(r.hover),t&&(Qe.current=!0)),t&&ft()):Vt.current&&(Vt.current=null,It(null),uo&&(uo(null),t&&(Qe.current=!0)),t&&ft())},po.current=()=>{if(Vt.current){const e=yo();Vt.current=null,It(null),uo&&(uo(null),e&&(Qe.current=!0)),e&&ft()}};const bo=(0,Iu.useRef)(()=>{});bo.current=e=>{if(Jr(e.target))return;if(!re&&!ie)return;const t=Co.current;if(!t)return;const o=Rt.current;if(!o)return;const n=Af({clientX:e.clientX,clientY:e.clientY,canvasRect:t.getBoundingClientRect(),margin:nt,adjustedWidth:rt,adjustedHeight:it,sceneNodes:o.sceneNodes,sceneEdges:o.sceneEdges,nodeQuadtree:o.nodeQuadtree,maxNodeRadius:o.maxNodeRadius});"hit"===n.kind?ho(n.hover,{type:"activate",inputType:ql(e.nativeEvent.pointerType)}):"miss"===n.kind&&ho(null)};const vo=(0,Iu.useCallback)(e=>bo.current(e),[]),xo=(0,Iu.useRef)(-1),ko=(0,Iu.useRef)(null),wo=(0,Iu.useRef)(-1),So=(0,Iu.useCallback)(e=>{if(Yl(e))return;const t=Rt.current;if(!t)return;const o=()=>{xo.current=-1,ko.current=null,wo.current=-1,Vt.current=null,It(null),uo&&(uo(null),Qe.current=!0),ft()},n=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=on(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===n.length)return void(0>xo.current||o());const r=Zl(n);let i=xo.current;if(r.flat.length>i||(o(),i=-1)," "===e.key&&i>=0){e.preventDefault();const t=r.flat[i];return void ho(ca(t.datum||{},t.x,t.y,{nodeOrEdge:"node"}),{type:"activate",inputType:"keyboard"})}if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown","Enter"].includes(e.key))return;e.preventDefault(),xo.current=0,wo.current=-1;const t=r.flat[0];ko.current={shape:t.shape,w:t.w,h:t.h};const o=ca(t.datum||{},t.x,t.y,{nodeOrEdge:"node"});return Vt.current=o,It(o),uo&&(uo(o,{type:"focus",inputType:"keyboard"}),Qe.current=!0),void ft()}const s=Ql(r,i),a=function(e,t,o,n,r){const i=o.flat[t.flatIndex];if(!i)return Jl(e,t,o);const s=i.datum?.id;switch(e){case"ArrowRight":case"ArrowLeft":case"ArrowDown":case"ArrowUp":{const n=function(e,t,o){let n=null,r=1/0;for(let i=0;e.flat.length>i;i++){const s=e.flat[i];if(s===t)continue;const a=s.x-t.x,l=s.y-t.y;let c=!1;switch(o){case"right":c=a>0&&Math.abs(a)>=Math.abs(l);break;case"left":c=0>a&&Math.abs(a)>=Math.abs(l);break;case"down":c=l>0&&Math.abs(l)>=Math.abs(a);break;case"up":c=0>l&&Math.abs(l)>=Math.abs(a)}if(!c)continue;const u=a*a+l*l;r>u&&(r=u,n=i)}return n}(o,i,"ArrowRight"===e?"right":"ArrowLeft"===e?"left":"ArrowDown"===e?"down":"up")??t.flatIndex;return n!==t.flatIndex&&(r.current=-1),n}case"Enter":{if(null==s)return t.flatIndex;const e=function(e,t){const o=e+"",n=[];for(const e of t){const t=e.datum??e,r=nc(t.source),i=nc(t.target),s=null!=r,a=null!=i;s&&r+""===o&&a?n.push(i+""):a&&i+""===o&&s&&n.push(r+"")}return n}(s,n);if(0===e.length)return t.flatIndex;const i=o.idToIdx.get(e[(r.current+1)%e.length])??-1;return 0>i?t.flatIndex:(r.current=-1,i)}default:{const n=Jl(e,t,o);return null!==n&&n!==t.flatIndex&&(r.current=-1),n}}}(e.key,s,r,t.sceneEdges??[],wo);if(null===a)return;if(e.preventDefault(),0>a)return void o();xo.current=a;const l=r.flat[a];ko.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"};Vt.current=c,It(c),uo&&(uo(c,{type:"focus",inputType:"keyboard"}),Qe.current=!0),ft()},[ho,uo,ft]),Ao=(0,Iu.useCallback)(e=>{xo.current=-1,ko.current=null,mo(e)},[mo]);ht.current=()=>{if(dt.current=null,!pt.isActive)return;const e=Co.current;if(!e)return;const t=Rt.current;t&&function(e){const{canvas:t,store:o,sceneRevisionDiagnostics:n,size:r,margin:i,adjustedWidth:s,adjustedHeight:a,background:l,renderMode:c,hasBackgroundGraphics:u=!1,dirtyRef:d,lastFrameTimeRef:h,now:f,random:p,reducedMotion:m,showParticles:g,isContinuous:y,animate:b,decay:v,pulse:x,thresholds:k,staleness:w,particleStyle:S,getParticleColor:A,pendingAnnotationFrameRef:C,lastAnnotationFrameTimeRef:M,setAnnotationFrame:_,scheduleNextFrame:j}=e,R=t.getContext("2d");if(!R)return;const P=h.current?Math.min((f-h.current)/1e3,.1):.016;h.current=f;const L=o.advanceTransition(m?f+1e6:f),T=!m&&L,I=!m&&o.tickAnimation([s,a],P),$=d.current,N=n?.beforeCompute(o.getLastUpdateResult(),T),D=L||$||I;D&&o.buildScene([s,a]),N&&n?.afterCompute(N,D,!1);const E=g&&!m&&!!o.particlePool,B=!!((F={dirtyOrRebuilt:$,transitioning:T,animationTicked:I,continuous:E||y,liveEncoding:!!v||!!x||!!k||!1!==b&&o.hasActiveTopologyDiff||o.hasActivePulses||o.hasActiveThresholds,forced:o.consumeStylePaintPending()}).dirtyOrRebuilt||F.transitioning||F.animationTicked||F.continuous||F.liveEncoding||F.forced);var F;const H=!!w&&o.lastIngestTime>0&&f-o.lastIngestTime>(w?.threshold??5e3);if(B){const e=Va();if(!Ga(t,r,i,e))return;if(R.clearRect(-i.left,-i.top,r[0],r[1]),ws(R,{background:l,hasBackgroundGraphics:u,width:s,height:a}),v&&o.applyDecay(),x&&o.applyPulse(f),k&&o.applyThresholds(f),!1!==b&&o.applyTopologyDiff(f),H&&(R.globalAlpha=w?.dimOpacity??.5),Ll({context:R,nodes:o.sceneEdges,renderMode:c,pixelRatio:e,paintBuiltIn:e=>function(e,t){for(const o of t)switch(o.type){case"bezier":df(e,o);break;case"line":hf(e,o);break;case"ribbon":ff(e,o);break;case"curved":pf(e,o)}}(R,e)}),Ll({context:R,nodes:o.sceneNodes,renderMode:c,pixelRatio:e,paintBuiltIn:e=>{const t=e;!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=Cn(e,t.style.fill,"#007bff"),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=hn(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)),al(e,t),e.restore())}}(R,t),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=Cn(e,t.style.fill,"#007bff"),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=hn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??1,e.globalAlpha=t.style.opacity??1,e.stroke()),ll(e,t),e.restore())}}(R,t),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=Cn(e,t.style.fill,"#007bff"),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=hn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??1,e.globalAlpha=t.style.opacity??1,e.stroke()),e.restore()}}(R,t),function(e,t){const o=e.globalAlpha;for(const n of t){if("symbol"!==n.type)continue;const t=n;if(0>=t.size)continue;const r=gf(t);if(!r)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=Cn(e,t.style.fill,"#007bff"),e.fill(r)),t.style.stroke&&"none"!==t.style.stroke&&(e.globalAlpha=o*i,e.strokeStyle=hn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??1,e.stroke(r)),e.restore()}}(R,t),function(e,t){const o=e.globalAlpha;for(const n of t)"glyph"===n.type&&yl(e,n,n.cx,n.cy,o);e.globalAlpha=o}(R,t)}}),E&&!H){const e=o.edgesArray;if(e.length>0){!function(e,t,o,n,r=Math.random){const i=n.spawnRate??.1,s=n.maxPerEdge??50;for(let n=0;t.length>n;n++){const a=t[n];if(!a.bezier)continue;if(e.countForEdge(n)>=s)continue;const l=a.value*i*o*(a.bezier.circular?.3:1),c=Math.floor(l),u=l-c;let d=c;r()<u&&d++;for(let t=0;d>t&&e.countForEdge(n)<s;t++)e.spawn(n,r)}}(o.particlePool,e,P,S,p);const t=.5*(S.speedMultiplier??1);let n;if(S.proportionalSpeed){const t=e.reduce((e,t)=>Math.max(e,t.value||1),1);n=e.map(e=>.3+(e.value||1)/t*1.7)}o.particlePool.step(P,t,e,n),function(e,t,o,n,r){const i=n.radius??3;e.globalAlpha=n.opacity??.7;for(let s=0;t.particles.length>s;s++){const a=t.particles[s];if(!a.active)continue;const l=o[a.edgeIndex];if(!l)continue;let c;c="string"==typeof n.color&&"inherit"!==n.color?n.color:r(l),e.fillStyle=hn(e,c)||c,e.beginPath(),e.arc(a.x,a.y,i,0,2*Math.PI),e.fill()}e.globalAlpha=1}(R,o.particlePool,e,S,A)}}H&&(R.globalAlpha=1)}d.current=!1,($||T||I)&&t.setAttribute("aria-label",Fs(o.sceneNodes?.length??0,o.sceneEdges?.length??0,"Network chart"));const O=$||T||I||C.current;O&&f-M.current>=33?(_(e=>e+1),M.current=f,C.current=!1):C.current=!!O,(y||T||null!=o.transition||I||o.hasActivePulses||o.hasActiveThresholds||!1!==b&&o.hasActiveTopologyDiff||C.current)&&j()}({canvas:e,store:t,sceneRevisionDiagnostics:Pt.current,size:ot,margin:nt,adjustedWidth:rt,adjustedHeight:it,background:ee,renderMode:$,hasBackgroundGraphics:!!we,dirtyRef:Qe,lastFrameTimeRef:Mt,now:pt.now(),random:pt.random,reducedMotion:!!et.current,showParticles:T,isContinuous:oo,animate:Me,decay:Se,pulse:Ae,thresholds:$e,staleness:_e,particleStyle:kt,getParticleColor:to,pendingAnnotationFrameRef:jt,lastAnnotationFrameTimeRef:_t,setAnnotationFrame:Et,scheduleNextFrame:()=>{ft()}})};const{canvasRef:Co}=za(Je,{hydrated:gt,wasHydratingFromSSR:yt,storeRef:Rt,dirtyRef:Qe,canvasPaintDependencies:[o,rt,it,ee,we,$,ft]});Xn(_e,Rt,Qe,ft,Bt,Ft);const Mo=te&&Tt?(0,_f.jsx)(Ca,{x:Tt.x,y:Tt.y,containerWidth:rt,containerHeight:it,margin:nt,className:"stream-network-tooltip",zIndex:2,children:oe?oe(Tt):(0,_f.jsx)(cf,{data:Tt})}):null;if(cs||!gt&&yt)return(0,_f.jsx)(Bh,{props:e,store:Rt.current,responsiveRef:tt,size:ot,margin:nt,adjustedWidth:rt,adjustedHeight:it,resolvedBackground:at,resolvedForeground:st});const _o=Rt.current;return(0,_f.jsxs)("div",{ref:tt,className:"stream-network-frame"+(J?" "+J:""),role:"group","aria-label":De||("string"==typeof xe?xe:"Network chart"),tabIndex:0,"aria-busy":Ht||void 0,style:{position:"relative",width:K?"100%":ot[0],height:Z?"100%":ot[1],overflow:"visible"},onKeyDown:So,children:["production"!==process.env.NODE_ENV&&Rt.current&&(0,_f.jsx)(Lo,{store:Rt.current,diagnostics:Pt.current}),Ne&&(0,_f.jsx)(oa,{tableId:ut}),Ne&&(0,_f.jsx)(ea,{nodes:_o?.sceneNodes??[],edges:_o?.sceneEdges??[],chartType:"Network chart",tableId:ut,chartTitle:"string"==typeof xe?xe:void 0}),(0,_f.jsx)(ta,{summary:Ee}),(0,_f.jsx)(Is,{hoverPoint:Tt}),(0,_f.jsxs)("div",{role:"img","aria-label":De||("string"==typeof xe?xe:"Network chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:te?Ao:void 0,onMouseLeave:te?go:void 0,onClick:re||ie?vo:void 0,children:[Ht&&!1!==k&&(0,_f.jsx)("div",{style:{position:"absolute",inset:0,zIndex:3,background:"var(--semiotic-bg, #fff)"},children:Kh(!0,ot[0],ot[1],k)}),(0,_f.jsx)(Wa,{size:ot,margin:nt,overflowVisible:!0,children:at}),(0,_f.jsx)("canvas",{ref:Co,"aria-label":Fs(_o?.sceneNodes?.length??0,_o?.sceneEdges?.length??0,"Network chart"),style:{position:"absolute",top:0,left:0}}),(0,_f.jsx)(Th,{width:rt,height:it,totalWidth:ot[0],totalHeight:ot[1],margin:nt,labels:_o?.labels||[],sceneNodes:_o?.sceneNodes,title:xe,legend:fe,legendPosition:pe,legendLayout:me,legendHoverBehavior:ge,legendClickBehavior:ye,legendHighlightedCategory:be,legendIsolatedCategories:ve,foregroundGraphics:Io(st,Ho(Rt.current?.customLayoutOverlays,Ke??null)),annotations:ce,onAnnotationActivate:ue,onObservation:se??ie,chartId:ae,chartType:"StreamNetworkFrame",autoPlaceAnnotations:de,svgAnnotationRules:he,annotationFrame:Dt}),(0,_f.jsx)(Dh,{marks:_o?.customLayoutHtmlMarks,margin:nt,selection:Ke??null}),(0,_f.jsx)(ia,{active:xo.current>=0,hoverPoint:Tt,margin:nt,size:ot,shape:ko.current?.shape,width:ko.current?.w,height:ko.current?.h}),Mo,_e?.showBadge&&(0,_f.jsx)(Kn,{isStale:Bt,position:_e.badgePosition})]})]})}));Tf.displayName="StreamNetworkFrame";var If=Tf;function $f(e){const{title:t,description:o,summary:n,accessibleTable:r,className:i,animate:s,axisExtent:a,autoPlaceAnnotations:l}=e,c={};return t&&(c.title=t),o&&(c.description=o),n&&(c.summary=n),void 0!==r&&(c.accessibleTable=r),i&&(c.className=i),null!=s&&(c.animate=s),void 0!==a&&(c.axisExtent=a),void 0!==l&&(c.autoPlaceAnnotations=l),c}function Nf(e){const{linkedHover:t,selection:o,onObservation:n,onClick:r,hoverRadius:i,hoverHighlight:s,forceHoverBehavior:a,forceClickBehavior:l,mobileInteraction:c,customHoverBehavior:u,customClickBehavior:d,linkedHoverInClickPredicate:h=!0}=e,f={};n&&(f.annotationObservationCallback=n);const p=c?.enabled?Math.max(i??30,Math.ceil((c.targetSize||44)/2),24):i;return(a||t||n||r||s)&&(f.customHoverBehavior=u),d&&(l||(h?n||r||t:n||r)||c?.enabled&&(c.tapToSelect||c.tapToLockTooltip)&&(t||s||o))&&(f.customClickBehavior=d),null!=p&&(f.hoverRadius=p),f}function Df(e){const{tooltip:t,defaultTooltipContent:o}=e;return{tooltipContent:!1===t?()=>null:Sa(t)||o}}var Ef=c(require("react")),Bf=require("react"),Ff=require("react"),Hf=require("react"),Of=require("react/jsx-runtime"),zf=(0,Hf.createContext)(null);function Wf({colors:e,categories:t,colorScheme:o="category10",children:n}){const r=(0,Hf.useMemo)(()=>{if(e)return e;if(t){if(o&&"object"==typeof o&&!Array.isArray(o)){const e=o,n={};let r=0;for(const o of t)n[o]=We(e,o)??Be[r++%Be.length];return n}const e=Array.isArray(o)?o:Ee[o]||Be,n={};for(let o=0;t.length>o;o++)n[t[o]]=e[o%e.length];return n}return{}},[e,t,o]);return(0,Of.jsx)(zf.Provider,{value:r,children:n})}function qf(){return(0,Hf.useContext)(zf)}Wf.displayName="CategoryColorProvider";var Yf=require("react");function Gf(e){const t=[];for(const[o,n]of Object.entries(e.fields))if("point"===n.type)t.push(e=>n.values.has(e[o]));else{const[e,r]=n.range;t.push(t=>{const n=t[o];return n>=e&&r>=n})}return e=>t.every(t=>t(e))}function Vf(e,t){const o=[];for(const[n,r]of e.clauses)"crossfilter"===e.resolution&&n===t||o.push(Gf(r));return 0===o.length?()=>!0:"intersect"===e.resolution?e=>o.every(t=>t(e)):e=>o.some(t=>t(e))}function Xf(e,t){let o=e.get(t);return o||(o={name:t,resolution:"union",clauses:new Map},e.set(t,o)),o}function Uf(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[Kf,Zf]=q(e=>({selections:new Map,setClause(t,o){e(e=>{const n=e.selections.get(t),r=n?.clauses.get(o.clientId);if(r&&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,n]of o){const o=t.fields[e];if(!o||!Uf(n,o))return!1}return!0}(r,o))return{};const i=new Map(e.selections),s=Xf(i,t),a=new Map(s.clauses);return a.set(o.clientId,o),i.set(t,{...s,clauses:a}),{selections:i}})},clearClause(t,o){e(e=>{const n=e.selections.get(t);if(!n||!n.clauses.has(o))return{};const r=new Map(e.selections),i=new Map(n.clauses);return i.delete(o),r.set(t,{...n,clauses:i}),{selections:r}})},setResolution(t,o){e(e=>{const n=e.selections.get(t);if(n?.resolution===o)return{};const r=new Map(e.selections),i=Xf(r,t);return r.set(t,{...i,resolution:o}),{selections:r}})},clearSelection(t){e(e=>{const o=e.selections.get(t);if(!o||0===o.clauses.size)return{};const n=new Map(e.selections);return n.set(t,{...o,clauses:new Map}),{selections:n}})}})),Qf=require("react");function Jf(e){const t=(0,Qf.useId)(),o=e.clientId||t,{name:n}=e,r=Zf(e=>e.selections.get(n)),i=Zf(e=>e.setClause),s=Zf(e=>e.clearClause),a=(0,Qf.useMemo)(()=>!!r&&r.clauses.size>0,[r]);return{predicate:(0,Qf.useMemo)(()=>r&&0!==r.clauses.size?Vf(r,o):()=>!0,[r,o]),isActive:a,selectPoints:(0,Qf.useCallback)(e=>{const t={};let r=!1;for(const[o,n]of Object.entries(e))t[o]={type:"point",values:new Set(n)},r=!0;r&&i(n,{clientId:o,type:"point",fields:t})},[o,n,i]),selectInterval:(0,Qf.useCallback)(e=>{const t={};let r=!1;for(const[o,n]of Object.entries(e))t[o]={type:"interval",range:n},r=!0;r&&i(n,{clientId:o,type:"interval",fields:t})},[o,n,i]),clear:(0,Qf.useCallback)(()=>{s(n,o)},[s,n,o]),clientId:o}}function ep(e,t){const o=(0,Qf.useId)(),n=t||o,r=Zf(e=>e.setClause),i=Zf(e=>e.clearClause);return{selectPoints:(0,Qf.useCallback)(t=>{const o={};let i=!1;for(const[e,n]of Object.entries(t))o[e]={type:"point",values:new Set(n)},i=!0;i&&r(e,{clientId:n,type:"point",fields:o})},[e,n,r]),clear:(0,Qf.useCallback)(()=>i(e,n),[e,n,i]),clientId:n}}function tp(e){const t=e.name||"hover",{fields:o}=e,{predicate:n,isActive:r,selectPoints:i,clear:s}=Jf({name:t,fields:o});return{onHover:(0,Qf.useCallback)(e=>{if(!e)return void s();const t={};for(const n of o){const o=e[n];void 0!==o&&(t[n]=[o])}rp(t)&&i(t)},[o,i,s]),predicate:n,isActive:r}}function op(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function np(e){const{name:t,xField:o,yField:n}=e,{predicate:r,isActive:i,selectInterval:s,clear:a}=Jf({name:t,fields:[o,n].filter(Boolean)}),l=o&&n?"xyBrush":o?"xBrush":"yBrush",c=(0,Qf.useCallback)(e=>{if(!e)return void a();const t={};"xyBrush"===l&&function(e){return 2===e.length&&Array.isArray(e[0])&&2===e[0].length&&Array.isArray(e[1])&&2===e[1].length}(e)?(o&&(t[o]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),n&&(t[n]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===l&&op(e)?o&&(t[o]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]):"yBrush"===l&&op(e)&&n&&(t[n]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]),rp(t)&&s(t)},[l,o,n,s,a]);return{brushInteraction:(0,Qf.useMemo)(()=>({brush:l,during:c,end:c}),[l,c]),predicate:r,isActive:i,clear:a}}function rp(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function ip(e,t,o){const n=Zf(e=>e.selections.get(t));return(0,Qf.useMemo)(()=>{if(!n||0===n.clauses.size)return e;const t=Vf(n,o);return e.filter(t)},[e,n,o])}var sp=require("react");function ap(e={}){const{limit:t=50,types:o,chartId:n}=e,r=Ur(e=>e.version),i=Ur(e=>e.observations),s=Ur(e=>e.clearObservations),a=(0,sp.useMemo)(()=>{let e=i;if(o&&o.length>0){const t=new Set(o);e=e.filter(e=>t.has(e.type))}return n&&(e=e.filter(e=>e.chartId===n)),e.length>t&&(e=e.slice(e.length-t)),e},[i,o,n,t,r]);return{observations:a,latest:a.length>0?a[a.length-1]:null,clear:s}}var lp=require("react/jsx-runtime"),cp=(0,Yf.createContext)(!1),up=(0,Yf.createContext)(!1);function dp(){return(0,Yf.useContext)(up)}var hp=(0,Yf.createContext)(null),fp="undefined"==typeof window?Yf.useEffect:Yf.useLayoutEffect;function pp(e){const t=new Set,o=[];for(const n of e)t.has(n)||(t.add(n),o.push(n));return o}function mp(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 gp(e){const t=(0,Yf.useContext)(hp),o=(0,Yf.useId)(),n=pp(e),r=(0,Yf.useRef)([]);mp(r.current,n)||(r.current=n);const i=r.current;fp(()=>{if(t)return()=>t.unregisterCategories(o)},[t,o]),fp(()=>{t&&t.registerCategories(o,i)},[t,o,i])}var yp="__linked-legend-isolate__",bp="__linked-legend-highlight__";function vp({categoryColors:e,interaction:t,selectionName:o,field:n}){const r=Object.entries(e),i=r.map(([e])=>e),s=[{styleFn:e=>({fill:e.color||"#333",stroke:e.color||"#333"}),type:"fill",items:r.map(([e,t])=>({label:e,color:t})),label:""}],{selectPoints:a,clear:l}=Jf({name:o,fields:[n],clientId:yp}),{selectPoints:c,clear:u}=Jf({name:o,fields:[n],clientId:bp}),d=Zf(e=>e.selections.get(o)),{isolatedCategories:h,highlightedCategory:f}=(0,Yf.useMemo)(()=>{const e=new Set;let t=null;const o=d?.clauses.get(yp)?.fields[n];if("point"===o?.type)for(const t of o.values)e.add(t+"");const r=d?.clauses.get(bp)?.fields[n];if("point"===r?.type){const e=r.values.values().next().value;null!=e&&(t=e+"")}return{isolatedCategories:e,highlightedCategory:t}},[d,n]),p=(0,Yf.useCallback)(e=>{"highlight"===t&&(e?c({[n]:[e.label]}):u())},[t,n,c,u]),m=(0,Yf.useCallback)(e=>{if("isolate"!==t)return;const o=new Set(h);o.has(e.label)?o.delete(e.label):o.add(e.label),0===o.size||o.size===i.length?l():a({[n]:Array.from(o)})},[t,n,h,i.length,a,l]),[g,[y]]=La([0,0],!0,!1),b=(0,Yf.useMemo)(()=>function(e,t){if(!t||0===e.length)return 1;let o=0,n=1;for(const r of e){const e=26+7*r.length;o>0&&o+e>t&&(n++,o=0),o+=e}return n}(r.map(([e])=>e),y),[r,y]);return 0===r.length?null:(0,lp.jsx)("div",{ref:g,style:{width:"100%",display:"block"},children:(0,lp.jsx)("svg",{width:"100%",height:Math.max(30,22*b+8),style:{display:"block",overflow:"visible"},children:(0,lp.jsx)(hr,{legendGroups:s,title:!1,orientation:"horizontal",width:y,height:20,customHoverBehavior:"highlight"===t?p:void 0,customClickBehavior:"isolate"===t?m:void 0,highlightedCategory:f,isolatedCategories:h})})})}function xp({children:e,selections:t,showLegend:o,legendPosition:n="top",legendInteraction:r="none",legendSelectionName:i="legend",legendField:s="category"}){const a=(0,Yf.useMemo)(()=>{if(!t)return;const e=new Map;for(const[o,n]of Object.entries(t))n.resolution&&e.set(o,{name:o,resolution:n.resolution,clauses:new Map});return e.size>0?{selections:e}:void 0},[t]),l=qf(),[c,u]=(0,Yf.useState)({}),d=(0,Yf.useRef)({}),h=(0,Yf.useMemo)(()=>({registerCategories:(e,t)=>{const o=pp(t);u(t=>mp(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})}}),[]),f=(0,Yf.useMemo)(()=>{const e=[];for(const t of Object.values(c))for(const o of t)e.push(o);return pp(e)},[c]),p=(0,Yf.useMemo)(()=>{const e=l??{},t=d.current;let o=Object.keys(e).length+Object.keys(t).length;for(const n of f)e[n]||t[n]||(t[n]=Be[o%Be.length],o++);const n={...e};for(const o of f)n[o]=e[o]??t[o];return n},[l,f]),m=void 0===o||o,g=Object.keys(p).length>0;return(0,lp.jsx)(Kf,{initialState:a,children:(0,lp.jsx)(Xr,{children:(0,lp.jsx)(up.Provider,{value:!0,children:(0,lp.jsx)(hp.Provider,{value:h,children:(0,lp.jsx)(Wf,{colors:p,children:(0,lp.jsxs)(cp.Provider,{value:m&&g,children:[m&&"top"===n&&(0,lp.jsx)(vp,{categoryColors:p,interaction:r,selectionName:i,field:s}),e,m&&"bottom"===n&&(0,lp.jsx)(vp,{categoryColors:p,interaction:r,selectionName:i,field:s})]})})})})})})}function kp({data:e,colorBy:t,colorScale:o,getColor:n,strokeColor:r,strokeWidth:i,categories:s}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",o={fill:t,stroke:t};return void 0!==r&&(o.stroke=r),void 0!==i&&(o.strokeWidth=i),o},type:"fill",items:(s&&s.length>0?s:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((r,i)=>{const s=e.find("function"==typeof t?e=>t(e)===r:e=>e[t]===r),a=s?n(s,t,o):o?o(r):Fe[i%Fe.length];return{label:r+"",color:a}}),label:""}]}}function wp(e){return e?"string"==typeof e?{name:e}:e:null}var Sp=.5;function Ap(e,t,o){return t?(n,...r)=>{const i={...e(n,...r)};if(t.isActive)if(t.predicate(n))o?.selectedStyle&&Object.assign(i,o.selectedStyle);else{const e=o?.unselectedOpacity??Sp;i.opacity=e,i.fillOpacity=e,i.strokeOpacity=e,o?.unselectedStyle&&Object.assign(i,o.unselectedStyle)}return i}:e}var Cp=c(require("react"));function Mp(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 _p(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 jp=["#6929c4","#1192e8","#005d5d","#9f1853","#fa4d56","#570408","#198038","#002d9c","#ee538b","#b28600","#009d9a","#012749","#8a3800","#a56eff"],Rp={danger:"#da1e28",warning:"#f1c21b",success:"#24a148",info:"#0043ce"},Pp={light:U,dark:K,"high-contrast":Z,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 Lp(e){return Pp[e]}var Tp=require("react/jsx-runtime"),Ip=Cp.createContext(void 0),$p="undefined"==typeof window?Cp.useEffect:Cp.useLayoutEffect;function Np(e){if("string"!=typeof e)return e;if("light"===e||"dark"===e||"high-contrast"===e)return e;return Lp(e)||(void 0!==console&&console.warn(`[ThemeProvider] Unknown theme preset "${e}". Falling back to light theme.`),"light")}function Dp({theme:e}){const t=ee(e=>e.setTheme),o=ee(e=>e.theme),n=Cp.useRef(o);n.current=o;const r=Cp.useRef(null);Cp.useEffect(()=>{if(void 0!==e)return;if("undefined"==typeof window||!window.matchMedia)return;const o=window.matchMedia("(forced-colors: active)");return o.matches&&(r.current=n.current===Z?U:n.current,t("high-contrast")),Ra(o,e=>{e.matches?(r.current=n.current===Z?r.current??U:n.current,t("high-contrast")):(function(e,t){e(t===U?"light":t===K?"dark":t===Z?"high-contrast":t)}(t,r.current??U),r.current=null)})},[e,t]);const i=Cp.useRef(!1);return $p(()=>{i.current?void 0!==e&&t(Np(e)):i.current=!0},[e,t]),null}function Ep({children:e}){const t=ee(e=>e.theme),o={position:"relative","--semiotic-bg":t.colors.background,"--semiotic-text":t.colors.text,"--semiotic-text-secondary":t.colors.textSecondary,"--semiotic-grid":t.colors.grid,"--semiotic-border":t.colors.border,"--semiotic-cell-border":t.colors.cellBorder||t.colors.border,"--semiotic-primary":t.colors.primary,"--semiotic-font-family":t.typography.fontFamily,...t.colors.focus?{"--semiotic-focus":t.colors.focus}:{},...t.tooltip?.background?{"--semiotic-tooltip-bg":t.tooltip.background}:{},...t.tooltip?.text?{"--semiotic-tooltip-text":t.tooltip.text}:{},...t.tooltip?.borderRadius?{"--semiotic-tooltip-radius":t.tooltip.borderRadius}:{},...t.tooltip?.fontSize?{"--semiotic-tooltip-font-size":t.tooltip.fontSize}:{},...t.tooltip?.shadow?{"--semiotic-tooltip-shadow":t.tooltip.shadow}:{},...t.borderRadius?{"--semiotic-border-radius":t.borderRadius}:{},...t.colors.selection?{"--semiotic-selection-color":t.colors.selection}:{},...null!=t.colors.selectionOpacity?{"--semiotic-selection-opacity":t.colors.selectionOpacity+""}:{},...t.colors.diverging?{"--semiotic-diverging":t.colors.diverging}:{},...t.colors.annotation?{"--semiotic-annotation-color":t.colors.annotation}:{},...null!=t.typography.legendSize?{"--semiotic-legend-font-size":t.typography.legendSize+"px"}:{},...null!=t.typography.titleFontSize?{"--semiotic-title-font-size":t.typography.titleFontSize+"px"}:{},...null!=t.typography.tickFontFamily?{"--semiotic-tick-font-family":t.typography.tickFontFamily}:{},...null!=t.typography.tickSize?{"--semiotic-tick-font-size":t.typography.tickSize+"px"}:{},...null!=t.typography.labelSize?{"--semiotic-axis-label-font-size":t.typography.labelSize+"px"}:{},"--semiotic-secondary":t.colors.secondary||t.colors.primary,"--semiotic-surface":t.colors.surface||t.colors.background,...t.colors.success?{"--semiotic-success":t.colors.success}:{},...t.colors.danger?{"--semiotic-danger":t.colors.danger}:{},...t.colors.warning?{"--semiotic-warning":t.colors.warning}:{},...t.colors.error?{"--semiotic-error":t.colors.error}:{},...t.colors.info?{"--semiotic-info":t.colors.info}:{}},n=Cp.useContext(Ip),r={};return n&&(r["data-semiotic-theme"]=n),(0,Tp.jsx)("div",{style:o,...r,children:e})}function Bp({theme:e,children:t}){const o="string"==typeof e&&Lp(e)?e:void 0,n=Cp.useMemo(()=>function(e){return void 0!==e?Q(U,Np(e)):"undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(forced-colors: active)").matches?Z:U}(e),[e]);return(0,Tp.jsx)(J,{initialState:{theme:n},children:(0,Tp.jsxs)(Ip.Provider,{value:o,children:[(0,Tp.jsx)(Dp,{theme:e}),(0,Tp.jsx)(Ep,{children:t})]})})}function Fp(){return ee(e=>e.theme)}function Hp(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function Op(e,t){const{when:o}=e,n=t.width,r=t.height,i=function(e){if("number"==typeof e.height&&e.height>0)return e.width/e.height}(t),s=function(e){if("number"==typeof e.height&&e.height>0)return e.height>e.width?"portrait":"landscape"}(t);return!("number"==typeof o.minWidth&&o.minWidth>n||"number"==typeof o.maxWidth&&n>o.maxWidth||"number"==typeof o.minHeight&&("number"!=typeof r||o.minHeight>r)||"number"==typeof o.maxHeight&&("number"!=typeof r||r>o.maxHeight)||"number"==typeof o.minAspectRatio&&("number"!=typeof i||o.minAspectRatio>i)||"number"==typeof o.maxAspectRatio&&("number"!=typeof i||i>o.maxAspectRatio)||o.orientation&&s!==o.orientation)}function zp(e,t,o=e.responsiveRules){if(!Array.isArray(o)||0===o.length)return{props:e,matches:[]};const n=o.map((e,t)=>({rule:e,index:t})).filter(e=>Op(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:n.reduce((e,t)=>function(e,t){const o={...e,...t};for(const n of["margin","frameProps","mobileSemantics","style"])Hp(e[n])&&Hp(t[n])&&(o[n]={...e[n],...t[n]});return"string"==typeof e.className&&"string"==typeof t.className&&(o.className=`${e.className} ${t.className}`),o}(e,t.rule.transform),e),matches:n}}function Wp(e,t,o){const n=e.xValue??t?.[o];if(null==n)return null;const r=Number(n);return Number.isFinite(r)?r:null}function qp(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 Yp(e){if(!e)return!1;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}var Gp="#007bff",Vp=[],Xp=44,Up={enabled:!0,tapToSelect:!0,tapToLockTooltip:!0,clearSelection:"backgroundTap",targetSize:Xp,snap:"nearestDatum",brushHandleSize:Xp,standardControls:!1,enabled:!1,tapToSelect:!1,tapToLockTooltip:!1};function Kp(e,t={}){const o=t.mobileSemantics?.interaction,n="number"==typeof o?.targetSize?o.targetSize:"number"==typeof t.mobileSemantics?.minimumHitTarget?t.mobileSemantics.minimumHitTarget:void 0,r="mobile"===t.mode||"number"==typeof t.width&&480>=t.width,i=!!o||void 0!==n,s=e&&"object"==typeof e?e:void 0;if(!1===e||!1===s?.enabled||void 0===e&&!r&&!i)return Up;const a=s??{};return{enabled:!0,tapToSelect:a.tapToSelect??!0,tapToLockTooltip:a.tapToLockTooltip??!0,clearSelection:a.clearSelection??"backgroundTap",targetSize:a.targetSize??n??Xp,snap:a.snap??"nearestDatum",brushHandleSize:a.brushHandleSize??Xp,standardControls:a.standardControls??!1}}function Zp(){const e=Fp(),t=e?.colors?.categorical;return t&&t.length>0?t:void 0}function Qp(e,t,o,n,r){if(e)return e;if(o&&"object"==typeof o&&!Array.isArray(o)){const e=We(o,n);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=Ee[o];Array.isArray(e)&&(i=e)}return i&&0!==i.length?null!=n?(r.has(n)||r.set(n,r.size),i[r.get(n)%i.length]):i[0]:Gp}function Jp(e,t,o){const n=qf(),r=Zp();return(0,Ff.useMemo)(()=>{if(!t)return;const i=n??void 0,s=o??(r&&r.length>0?r:void 0)??"category10";if(0!==e.length){if("function"==typeof t){const o=Array.from(new Set(e.map(e=>t(e)+"")));if(i&&Yp(i)){const e=qe(o.map(e=>({_cat:e})),"_cat",s);return t=>i[t]||e(t)}return qe(o.map(e=>({_cat:e})),"_cat",s)}if(i&&Yp(i)){const o=qe(e,t,s);return e=>i[e]||o(e)}return qe(e,t,s)}if(i&&Yp(i)){const e=qe([{_:"a"}],"_",s);return t=>i[t]||e(t)}},[e,t,o,n,r])}function em(e,t,o){return(0,Ff.useMemo)(()=>{if(!t||"auto"===t||"function"==typeof t)return e;const n=[...e],r="function"==typeof(i=o)?i:e=>e[i];var i;return n.sort("asc"===t?(e,t)=>r(e)-r(t):(e,t)=>r(t)-r(e))},[e,t,o])}function tm({selection:e,linkedHover:t,fallbackFields:o=Vp,unwrapData:n=!1,onObservation:r,chartType:i,chartId:s,onClick:a,hoverHighlight:l,colorByField:c,mobileInteraction:u}){const d=(0,Ff.useId)(),h=(0,Ff.useMemo)(()=>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),[t,o]),f=(0,Ff.useMemo)(()=>"series"===h?.mode?[h.seriesField||c||o[0]].filter(e=>!!e):h?.fields||o,[h,c,o]),p=Jf({name:e?.name||"__unused__",fields:f}),m=tp({name:h?.name||"hover",fields:f}),g=Ur(e=>e.pushObservation),y=(0,Ff.useCallback)(e=>{r?.(e),g?.(e)},[r,g]),b=e?{isActive:p.isActive,predicate:p.predicate}:null,[v,x]=(0,Ff.useState)(null),k=(0,Ff.useRef)(!1),w=c||o[0],S=(0,Ff.useMemo)(()=>{if(!l||null==v||!w)return null;const e=v,t=w;return{isActive:!0,predicate:o=>("string"==typeof o[t]?o[t]:(o[t]??"")+"")===e}},[l,v,w]),A=(0,Ff.useCallback)((e,o)=>{const n=!e&&k.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=Wp(e,t,h.xField);null!=o&&function(e,t,o){const n=Ri.positions.get(e);n?.locked||n&&n.xValue===t&&n.sourceId===o||(Ri={positions:new Map(Ri.positions).set(e,{xValue:t,sourceId:o})},Li())}(h.name||"hover",o,d)}"x-position"!==h?.mode&&m.onHover(t)}else"x-position"!==h?.mode||n||Ti(h.name||"hover",d),"x-position"===h?.mode||n||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];x(null!=o?o+"":null)}else n||x(null);(r||g)&&Gl({onObservation:y,datum:e?qp(e):null,x:e?.x,y:e?.y,chartType:i||"unknown",chartId:s,context:o})},[t,m,h,d,r,i,s,g,y,l,w,u]),C=(0,Ff.useCallback)((o=!0)=>{k.current=!1,t&&"x-position"!==h?.mode&&m.onHover(null),e&&u?.tapToSelect&&p.clear(),o&&l&&x(null),"x-position"===h?.mode&&(Ii(h.name||"hover",d),Ti(h.name||"hover",d))},[t,h,m,e,u,p,l,d]),M=(0,Ff.useCallback)((o,n)=>{const c=!!u?.enabled&&(u.tapToLockTooltip||u.tapToSelect),b=!!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=Wp(o,e,h.xField);null!=t&&function(e,t,o){const n=Ri.positions.get(e);if(n?.locked){const t=new Map(Ri.positions);return t.delete(e),Ri={positions:t},Li(),!1}Ri={positions:new Map(Ri.positions).set(e,{xValue:t,sourceId:o,locked:!0})},Li()}(h.name||"hover",t,d)}if(c)if(o){k.current=!0;const n=qp(o);if(t&&"x-position"!==h?.mode&&m.onHover(n),e&&u?.tapToSelect&&f.length>0){const e={};for(const t of f){const o=n[t];void 0!==o&&(e[t]=[o])}Yp(e)&&p.selectPoints(e)}if(l&&w){const e=n?.[w];x(null!=e?e+"":null)}}else b&&C();if(o||b){if(o&&a){let e=o.data||o.datum||o;Array.isArray(e)&&(e=e[0]),a(e,{x:o.x??0,y:o.y??0})}(r||g)&&Vl({onObservation:y,datum:o?qp(o):null,x:o?.x,y:o?.y,chartType:i||"unknown",chartId:s,context:n})}},[a,r,g,y,i,s,h,d,u,t,m,e,p,f,l,w,C]);return(0,Ff.useEffect)(()=>{if(!u?.enabled||"undefined"==typeof document)return;const e=e=>{"Escape"===e.key&&k.current&&C()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[u?.enabled,C]),(0,Ff.useEffect)(()=>()=>{k.current&&C(!1)},[C]),(0,Ff.useEffect)(()=>{if("x-position"!==h?.mode)return;const e=h.name||"hover";return()=>{Ii(e,d),Ti(e,d)}},[h?.mode,h?.name,d]),{activeSelectionHook:b,hoverSelectionHook:S,customHoverBehavior:A,customClickBehavior:M,crosshairSourceId:d}}function om(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 nm({data:e,colorBy:t,colorScale:o,showLegend:n,legendPosition:r="right",userMargin:i,defaults:s={top:50,bottom:60,left:70,right:40},categories:a}){const l=(0,Yf.useContext)(cp),c=null!==(0,Yf.useContext)(hp),u=void 0!==n?n:!l&&!!t,d=!!t&&(u||c),h=(0,Ff.useMemo)(()=>{if(!d)return[];if(void 0!==a)return a;const o=new Set;for(const n of e){const e="function"==typeof t?t(n):n[t];null!=e&&o.add(e+"")}return Array.from(o)},[a,t,e,d]);gp(c&&t?h:[]);const f=(0,Ff.useMemo)(()=>{if(!u||!t)return;const n=kp({data:e,colorBy:t,colorScale:o,getColor:ze,categories:h});return 0!==n.legendGroups.reduce((e,t)=>e+t.items.length,0)?n:void 0},[u,t,e,o,h]),p=(0,Ff.useMemo)(()=>{const e="number"==typeof i?{top:i,bottom:i,left:i,right:i}:i??{},t=t=>{const o=e[t];return"number"==typeof o?o:s[t]},o={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},n=t=>"number"==typeof e[t];return f&&("right"===r&&!n("right")&&110>o.right?o.right=110:"left"===r&&!n("left")&&110>o.left?o.left=110:"top"===r&&!n("top")&&50>o.top?o.top=50:"bottom"===r&&!n("bottom")&&80>o.bottom&&(o.bottom=80)),o},[s,i,f,r]);return{legend:f,margin:p,legendPosition:r}}function rm(e,t,o){const[n,r]=(0,Ff.useState)(null),[i,s]=(0,Ff.useState)(new Set),a=(0,Ff.useMemo)(()=>new Set,[]),l=(0,Ff.useCallback)(t=>{"highlight"===e&&r(t?t.label:null)},[e]),c=(0,Ff.useCallback)(t=>{"isolate"===e&&s(e=>{const n=new Set(e);return n.has(t.label)?n.delete(t.label):n.add(t.label),n.size===o.length?new Set:n})},[e,o.length]),u=(0,Ff.useMemo)(()=>{if(!e||"none"===e||!t)return null;const o="string"==typeof t?t:null;return"highlight"===e&&null!=n?{isActive:!0,predicate:e=>(o?e[o]:"function"==typeof t?t(e):null)===n}:"isolate"===e&&i.size>0?{isActive:!0,predicate:e=>{const n=o?e[o]:"function"==typeof t?t(e):null;return i.has(n)}}:null},[e,t,n,i]);return{highlightedCategory:"highlight"===e?n:null,isolatedCategories:"isolate"===e?i:a,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}var im={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 sm(e,t,o){const n=im[e||"primary"],r=e&&"primary"!==e||!o?.width?n.width:o.width,i=e&&"primary"!==e||!o?.height?n.height:o.height,s=zp({...t,mode:e},{width:t.width??r,height:t.height??i}).props,a=s.mode||e,l=im[a||"primary"],c="context"===a||"sparkline"===a,u=a&&"primary"!==a||!o?.width?l.width:o.width;return{width:s.width??u,height:s.height??(a&&"primary"!==a||!o?.height?l.height:o.height),showAxes:s.showAxes??l.showAxes,showGrid:s.showGrid??l.showGrid,enableHover:s.enableHover??(!!s.linkedHover||l.enableHover),showLegend:s.showLegend??l.showLegend,showLabels:s.showLabels??l.showLabels,title:c?void 0:s.title,description:s.description,summary:s.summary,accessibleTable:s.accessibleTable,xLabel:c?void 0:s.xLabel,yLabel:c?void 0:s.yLabel,categoryLabel:c?void 0:s.categoryLabel,valueLabel:c?void 0:s.valueLabel,marginDefaults:am(l.marginDefaults,s.showCategoryTicks,s.orientation),compactMode:c,mobileInteraction:Kp(s.mobileInteraction,{mode:a,width:s.width??u,mobileSemantics:s.mobileSemantics}),mobileSemantics:s.mobileSemantics}}function am(e,t,o){if(!1!==t)return e;const n={...e};return"horizontal"===o?n.left=Math.min(n.left,15):n.bottom=Math.min(n.bottom,15),n}function lm(e,t){const o=e.length,n=t.length,r=Array(n+1);for(let e=0;n>=e;e++)r[e]=e;for(let i=1;o>=i;i++){let o=r[0];r[0]=i;for(let s=1;n>=s;s++){const n=r[s];r[s]=e[i-1]===t[s-1]?o:1+Math.min(o,r[s],r[s-1]),o=n}}return r[n]}function cm(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:[...e]}function um(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 n,r=o+1;for(const o of t){const t=lm(e.toLowerCase(),o.toLowerCase());r>t&&(r=t,n=o)}return r>o?void 0:n}(e,t,3)??null)}function dm({componentName:e,data:t,accessors:o,requiredProps:n}){if(n)for(const[t,o]of Object.entries(n))if(null==o)return`${e}: ${t} is required. Provide a field name or function.`;if(null==t)return null;if(!Array.isArray(t)&&"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 n=cm(t).find(e=>e&&"object"==typeof e);if(n){const t=Object.keys(n);for(const[r,i]of Object.entries(o))if(i&&"string"==typeof i&&!(i in n)){const o=um(i,t),n=o?` Try ${r}="${o}".`:"";return`${e}: ${r} "${i}" not found in data. Available fields: ${t.join(", ")}.${n}`}}}return null}function hm({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 fm({componentName:e,nodes:t,edges:o,nodesRequired:n=!1,edgesRequired:r=!0,accessors:i}){if(null==t&&null==o)return null;if(r&&(!o||!Array.isArray(o)||0===o.length))return e+': No edges provided. Pass a non-empty array: edges={[{ source: "A", target: "B", value: 10 }, ...]}.';if(n&&(!t||!Array.isArray(t)||0===t.length))return e+': No nodes provided. Pass a non-empty array: nodes={[{ id: "A" }, { id: "B" }, ...]}.';if(i&&t&&t.length>0){const o=cm(t).find(e=>e&&"object"==typeof e);if(o){const t=Object.keys(o);for(const[n,r]of Object.entries(i))if(r&&"string"==typeof r&&!(r in o)){const o=um(r,t),i=o?` Try ${n}="${o}".`:"";return`${e}: ${n} "${r}" not found in node data. Available fields: ${t.join(", ")}.${i}`}}}return null}var pm=require("react"),mm=require("react");function gm(e){const t=ee(e=>e.theme.colors.selectionOpacity);return(0,mm.useMemo)(()=>{if(void 0!==e||void 0!==t)return{name:e?.name??"",...e,unselectedOpacity:e?.unselectedOpacity??t}},[e,t])}function ym(e){const{data:t,rawData:o,colorBy:n,colorScheme:r,legendInteraction:i,legendPosition:s,selection:a,linkedHover:l,fallbackFields:c,unwrapData:u=!1,onObservation:d,chartType:h,chartId:f,showLegend:p,userMargin:m,marginDefaults:g,onClick:y,hoverHighlight:b,mobileInteraction:v,mobileSemantics:x,loading:k,loadingContent:w,emptyContent:S,width:A,height:C}=e,M=void 0===o,_=(0,pm.useMemo)(()=>H(t),[t]),[j,R]=(0,pm.useState)([]),P=(0,pm.useCallback)(e=>{R(t=>t.length===e.length&&t.every((t,o)=>t===e[o])?t:e)},[]),L="string"==typeof e.colorBy?e.colorBy:void 0,T=(0,pm.useMemo)(()=>Kp(v,{width:A,mobileSemantics:x}),[v,A,x]),{activeSelectionHook:I,hoverSelectionHook:$,customHoverBehavior:N,customClickBehavior:D,crosshairSourceId:E}=tm({selection:a,linkedHover:l,fallbackFields:c,unwrapData:u,onObservation:d,chartType:h,chartId:f,onClick:y,hoverHighlight:b,colorByField:L,mobileInteraction:T}),B=om(l,E),F=Jp(_,n,r),O=(0,pm.useMemo)(()=>{if(!n)return[];const e=new Set;for(const t of _){const o="function"==typeof n?n(t):t[n];null!=o&&e.add(o+"")}return Array.from(e)},[_,n]),z=(0,pm.useMemo)(()=>M&&j.length>0?j:O,[M,j,O]),W=rm(i,n,z),q=(0,pm.useMemo)(()=>$||(W.legendSelectionHook?W.legendSelectionHook:I),[$,W.legendSelectionHook,I]),Y=gm(a),G=Zp(),V=qf(),X=(0,pm.useMemo)(()=>{if(F)return F;if(!n||0===z.length)return;const e=Array.isArray(r)&&r.length>0||"string"==typeof r&&r.length>0?r:G&&G.length>0?G:Fe,t="__streamCat",o=qe(z.map(e=>({[t]:e})),t,e);return e=>V?.[e]||o(e)||"#999"},[F,n,z,r,G,V]),{legend:U,margin:K,legendPosition:Z}=nm({data:_,colorBy:n,colorScale:X,showLegend:p,legendPosition:s,userMargin:m,defaults:g,categories:z}),Q=(0,pm.useMemo)(()=>{const e={};return U&&(e.legend=U,e.legendPosition=Z),i&&"none"!==i&&(e.legendHoverBehavior=W.onLegendHover,e.legendClickBehavior=W.onLegendClick,e.legendHighlightedCategory=W.highlightedCategory,e.legendIsolatedCategories=W.isolatedCategories),M&&n&&(e.legendCategoryAccessor=n,e.onCategoriesChange=P),e},[U,Z,i,W.onLegendHover,W.onLegendClick,W.highlightedCategory,W.isolatedCategories,M,n,P]),J=Array.isArray(o)?H(o):o,ee=Kh(k,A,C,w),te=ee?null:Uh(J,A,C,S);return{data:_,colorScale:F,allCategories:z,legendState:W,effectiveSelectionHook:q,activeSelectionHook:I,customHoverBehavior:N,customClickBehavior:D,mobileInteraction:T,legend:U,margin:K,legendPosition:Z,earlyReturn:ee||te||null,legendBehaviorProps:Q,crosshairProps:B,resolvedSelection:Y}}var bm=require("react");function vm(e,t){const{variant:o,frameRef:n,overrides:r}=t;(0,bm.useImperativeHandle)(e,()=>{const e=function(e,t){if("xy"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>e.current?.remove(t)??[],update:(t,o)=>e.current?.update(t,o)??[],clear:()=>e.current?.clear(),getData:()=>e.current?.getData()??[],getScales:()=>e.current?.getScales()??null,getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}if("network"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>{const o=Array.isArray(t)?t:[t],n=e.current?.getTopology()?.nodes??[],r=[];for(const t of o){const o=n.find(e=>e.id===t);o&&r.push({...o.data??{},id:t}),e.current?.removeNode(t)}return r},update:(t,o)=>(Array.isArray(t)?t:[t]).flatMap(t=>{const n=e.current?.updateNode(t,o);return n?[{...n,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 n=e.current?.removePoint(t)??[];for(const t of n)e.current?.push(o(t));return n},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 n=o.current?.removeLine(e)??[];for(const e of n)o.current?.pushLine(t(e));return n},clear:()=>o.current?.clear(),getData:()=>o.current?.getLines()??[],getCustomLayout:()=>o.current?.getCustomLayout?.()??null,getLayoutFailure:()=>o.current?.getLayoutFailure?.()??null}}(o,n);return{...e,...r}},[n,r,o])}var xm=require("react");function km(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return e??((...e)=>({}));const o={};return void 0!==t.stroke&&(o.stroke=t.stroke),void 0!==t.strokeWidth&&(o.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(o.opacity=t.opacity),e?(...t)=>({...e(...t)||{},...o}):(...e)=>({...o})}function wm(e){if(null==e)return()=>{};const t="function"==typeof e?e:t=>t[e];return e=>Cm(t(e))}function Sm(e,t){const o=wm(e),n=wm(t);return(e,t)=>{const r=n(e);return{value:r,x:o(e),y:r,category:t}}}function Am(e,t){const o=wm(t??"value"),n=null==e?void 0:"function"==typeof e?e:t=>t[e];return e=>{const t=n?n(e):void 0;return{value:o(e),category:null==t?void 0:t+""}}}function Cm(e){if("number"==typeof e)return Number.isFinite(e)?e:void 0;if("string"==typeof e&&""!==e.trim()){const t=Number(e);return Number.isFinite(t)?t:void 0}}function Mm(e,t,o){const n=null!=e.axis?o[e.axis]:null!=e.field?t[e.field]:o.value;if(void 0!==e.eq&&n!==e.eq)return!1;if(void 0!==e.ne&&n===e.ne)return!1;if(void 0!==e.in&&!e.in.includes(n))return!1;if(void 0===e.gt&&void 0===e.gte&&void 0===e.lt&&void 0===e.lte&&void 0===e.within&&void 0===e.outside)return!0;const r=Cm(n);if(void 0===r)return!1;if(void 0!==e.gt&&e.gt>=r)return!1;if(void 0!==e.gte&&e.gte>r)return!1;if(void 0!==e.lt&&r>=e.lt)return!1;if(void 0!==e.lte&&r>e.lte)return!1;if(void 0!==e.within){const[t,o]=e.within;if(t>r||r>o)return!1}if(void 0!==e.outside){const[t,o]=e.outside;if(r>=t&&o>=r)return!1}return!0}function _m(e,t,o){const n=e.when;return void 0===n||!0===n||!1!==n&&("function"==typeof n?n(t,o):Mm(n,t,o))}function jm(e,t,o){if(!t||0===t.length)return{};let n={};for(const r of t){if(!_m(r,e,o))continue;const t="function"==typeof r.style?r.style(e,o):r.style;t&&(n={...n,...t})}return n}function Rm(e,t,o,n=e=>e){const r=e??(()=>({}));return t&&0!==t.length?(e,i)=>{const s=n(e),a={...r(e,i)};return Object.assign(a,jm(s,t,o(s,i))),a}:r}function Pm(e,t,o){return e&&0!==e.length?(n,r)=>{const i=jm(n,e,t(n,r)),s=o?o(n,r):void 0;return s?{...i,...s}:i}:o}function Lm(e,t,o,n){if(!e||0===e.length)return n;const r=Am(t,o);return(t,o)=>{const i=t&&t.data||t,s=jm(i,e,r(i)),a=n?n(t,o):void 0;return a?{...s,...a}:s}}function Tm(e,t,o,n){return Pm(e,Sm(t,o),n)}function Im(e,t,o){const n=wm(t);return Pm(e,(e,t)=>({value:n(e),category:t}),o)}function $m(e){const{colorBy:t,colorScale:o,color:n,pointRadius:r=5,radiusFn:i,fillOpacity:s=1,fallbackFill:a,baseStyleExtras:l,stroke:c,strokeWidth:u,opacity:d,effectiveSelectionHook:h,resolvedSelection:f,colorDatumAccessor:p,styleRules:m,ruleContext:g}=e,y=(0,xm.useMemo)(()=>e=>{const c="function"==typeof l?l(e):l,u=c?{...c}:{};if(void 0===u.fillOpacity&&(u.fillOpacity=s),void 0===u.fill)if(t){if(o){const n=p?p(e):e;u.fill=ze(n,t,o)}}else u.fill=a?a(e):n||Gp;return void 0===u.r&&(u.r=i?i(e):r),m&&m.length>0&&Object.assign(u,jm(e,m,g?g(e):{value:void 0})),u},[t,o,n,r,i,s,a,l,p,m,g]),b=(0,xm.useMemo)(()=>km(y,{stroke:c,strokeWidth:u,opacity:d}),[y,c,u,d]);return(0,xm.useMemo)(()=>Ap(b,h??null,f),[b,h,f])}var Nm=require("react");function Dm(e){const{accessor:t,data:o,isPushMode:n}=e,r=(0,Nm.useRef)(null),[i,s]=(0,Nm.useState)(0),a=(0,Nm.useCallback)(e=>{if(!n||!t)return;let o=!1;for(const n of e){const e="function"==typeof t?t(n):n[t];if(null==e)continue;const i="number"==typeof e?e:Number(e);Number.isFinite(i)&&(r.current?(r.current[0]>i&&(r.current[0]=i,o=!0),i>r.current[1]&&(r.current[1]=i,o=!0)):(r.current=[i,i],o=!0))}o&&s(e=>e+1)},[n,t]),l=(0,Nm.useCallback)(()=>{n&&(r.current=null,s(e=>e+1))},[n]);return{domain:(0,Nm.useMemo)(()=>{if(n)return r.current??void 0;if(!t||0===o.length)return;const e="function"==typeof t?t:e=>e[t];let i=1/0,s=-1/0;for(const t of o){const o=e(t);if(null==o)continue;const n="number"==typeof o?o:Number(o);Number.isFinite(n)&&(i>n&&(i=n),n>s&&(s=n))}return Number.isFinite(i)&&Number.isFinite(s)?[i,s]:void 0},[o,t,n,i]),trackPushed:a,reset:l}}function Em(e){if(!e)return;const t="boolean"==typeof e?{}:"string"==typeof e?{method:e}:e;return{type:"trend",method:t.method??"linear",...null!=t.bandwidth&&{bandwidth:t.bandwidth},...null!=t.order&&{order:t.order},...null!=t.color&&{color:t.color},...null!=t.strokeWidth&&{strokeWidth:t.strokeWidth},...null!=t.strokeDasharray&&{strokeDasharray:t.strokeDasharray},...null!=t.label&&{label:t.label}}}var Bm=require("react"),Fm="__forecastSegment",Hm=null;async function Om(){return Hm||(Hm=await Promise.resolve().then(()=>(C(),b))),Hm}var zm="__semiotic_resolvedX",Wm="__semiotic_resolvedY";function qm(e){const{data:t,xAccessor:o,yAccessor:n,forecast:r,anomaly:i,groupBy:s}=e,a="string"==typeof o?o:zm,l="string"==typeof n?n:Wm,c=(0,Bm.useMemo)(()=>{if(!r&&!i)return t;const e="function"==typeof o,s="function"==typeof n;return e||s?t.map(t=>{const r={...t};return e&&(r[zm]=o(t)),s&&(r[Wm]=n(t)),r}):t},[t,r,i,o,n]),[u,d]=(0,Bm.useState)(null),[h,f]=(0,Bm.useState)([]),p=(0,Bm.useRef)(r),m=(0,Bm.useRef)(i);return(0,Bm.useEffect)(()=>{if(!r&&!i)return void((p.current||m.current)&&(d(null),f([]),p.current=r,m.current=i));let e=!1;const t=r!==p.current||i!==m.current;if(p.current=r,m.current=i,t&&(d(null),f([])),r){const t=s&&"string"==typeof s&&"object"==typeof r?{...r,_groupBy:s}:r;(async function(...e){return(await Om()).buildForecast(...e)})(c,a,l,t,i).then(t=>{e||(d(t),f(t.annotations))}).catch(()=>{e||(d(null),f([]))})}else i&&async function(...e){return(await Om()).buildAnomalyAnnotations(...e)}(i).then(t=>{e||(d(null),f(t))}).catch(()=>{e||f([])});return()=>{e=!0}},[c,r,i,a,l,s]),{effectiveData:u?u.processedData:t,statisticalAnnotations:h,hasForecast:!!u,xAccessorKey:a,yAccessorKey:l}}var Ym=require("react/jsx-runtime"),Gm=(0,Bf.forwardRef)(function(e,t){const o=(0,Bf.useRef)(null),n=sm(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:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:u="y",xScaleType:d,yScaleType:h,colorBy:f,colorScheme:p,styleRules:m,sizeBy:g,sizeRange:y=[3,15],symbolBy:b,symbolMap:v,pointRadius:x=5,pointOpacity:k=.8,tooltip:w,marginalGraphics:S,pointIdAccessor:A,annotations:C,regression:M,forecast:_,anomaly:j,xExtent:R,yExtent:P,frameProps:L={},selection:T,linkedHover:I,linkedBrush:$,onObservation:N,onClick:D,hoverHighlight:E,chartId:B,loading:F,loadingContent:O,emptyContent:z,legendInteraction:W,legendPosition:q,color:Y,stroke:G,strokeWidth:V,opacity:X}=e,{width:U,height:K,enableHover:Z,showGrid:Q,showLegend:J,title:ee,description:te,summary:oe,accessibleTable:ne,xLabel:re,yLabel:ie}=n,se=(0,Bf.useMemo)(()=>H(r),[r]),ae=void 0===r,{domain:le,trackPushed:ce,reset:ue}=Dm({accessor:g,data:se,isPushMode:ae}),de=(0,Bf.useCallback)(e=>{ce([e]),o.current?.push(e)},[ce]),he=(0,Bf.useCallback)(e=>{ce(e),o.current?.pushMany(e)},[ce]);vm(t,{variant:"xy",frameRef:o,overrides:{push:de,pushMany:he,clear:()=>{ue(),o.current?.clear()}}});const fe=ym({data:se,rawData:r,colorBy:f,colorScheme:p,legendInteraction:W,legendPosition:q,selection:T,linkedHover:I,fallbackFields:f?["string"==typeof f?f:""]:[],unwrapData:!1,onObservation:N,onClick:D,hoverHighlight:E,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"Scatterplot",chartId:B,showLegend:J,userMargin:i,marginDefaults:n.marginDefaults,loading:F,loadingContent:O,emptyContent:z,width:U,height:K}),pe=wp($),me=np({name:pe?.name||"__unused_brush__",xField:pe?.xField||("string"==typeof c?c:void 0),yField:pe?.yField||("string"==typeof u?u:void 0)}),ge=pe?"xyBrush"===me.brushInteraction.brush?"xy":"xBrush"===me.brushInteraction.brush?"x":"y":void 0,ye=Ef.useRef(me.brushInteraction);ye.current=me.brushInteraction;const be=(0,Bf.useCallback)(e=>{const t=ye.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)},[]);Zh("Scatterplot",se,"xAccessor",c),Zh("Scatterplot",se,"yAccessor",u);const ve=(0,Bf.useMemo)(()=>g?le??[0,1]:void 0,[g,le]),xe=(0,Bf.useMemo)(()=>g?e=>Ye(e,g,y,ve):void 0,[g,y,ve]),ke=(0,Bf.useMemo)(()=>Sm(c,u),[c,u]),we=$m({colorBy:f,colorScale:fe.colorScale,color:Y,pointRadius:x,fillOpacity:k,radiusFn:xe,stroke:G,strokeWidth:V,opacity:X,styleRules:m,ruleContext:ke,effectiveSelectionHook:fe.effectiveSelectionHook,resolvedSelection:fe.resolvedSelection}),Se=(0,Bf.useMemo)(()=>Fl([{label:re||$l(c),accessor:c,role:"x",format:a},{label:ie||$l(u),accessor:u,role:"y",format:l},...f?[{label:$l(f),accessor:f,role:"color"}]:[],...g?[{label:$l(g),accessor:g,role:"size"}]:[]]),[c,u,re,ie,f,g,a,l]),{effectiveData:Ae,statisticalAnnotations:Ce}=qm({data:se,xAccessor:c,yAccessor:u,forecast:_,anomaly:j}),Me=(0,Bf.useMemo)(()=>{const e=Em(M);return e||0!==Ce.length?[...e?[e]:[],...C||[],...Ce]:C},[M,C,Ce]);if(fe.earlyReturn)return fe.earlyReturn;const _e=dm({componentName:"Scatterplot",data:r,accessors:{xAccessor:c,yAccessor:u}});if(_e)return(0,Ym.jsx)(Oh,{componentName:"Scatterplot",message:_e,width:U,height:K});const je={chartType:"scatter",...null!=r&&{data:Ae},xAccessor:c,yAccessor:u,xScaleType:d,yScaleType:h,colorAccessor:f||void 0,sizeAccessor:g||void 0,...b&&{symbolAccessor:b},...v&&{symbolMap:v},sizeRange:y,pointStyle:we,colorScheme:p,size:[U,K],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:fe.margin,showAxes:n.showAxes,xLabel:re,yLabel:ie,xFormat:a,yFormat:l,enableHover:Z,showGrid:Q,...fe.legendBehaviorProps,...$f({title:ee,description:te,summary:oe,accessibleTable:ne,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Df({tooltip:w,defaultTooltipContent:Se}),...Nf({linkedHover:I,selection:T,onObservation:N,onClick:D,hoverHighlight:E,mobileInteraction:fe.mobileInteraction,customHoverBehavior:fe.customHoverBehavior,customClickBehavior:fe.customClickBehavior}),...S&&{marginalGraphics:S},...A&&{pointIdAccessor:A},...Me&&Me.length>0&&{annotations:Me},...R&&{xExtent:R},...P&&{yExtent:P},...pe&&{brush:{dimension:ge},onBrush:be},...fe.crosshairProps,...L};return(0,Ym.jsx)(Gh,{componentName:"Scatterplot",width:U,height:K,children:(0,Ym.jsx)(dc,{ref:o,...je})})});Gm.displayName="Scatterplot";var Vm=require("react"),Xm=require("react/jsx-runtime");function Um(e,t){return we(1===t?.5:e/(t-1))}var Km=(0,Vm.forwardRef)(function(e,t){const o=(0,Vm.useRef)(null);vm(t,{variant:"xy",frameRef:o});const n=sm(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:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:u="y",orderAccessor:d,orderLabel:h,styleRules:f,pointRadius:p=4,tooltip:m,pointIdAccessor:g,annotations:y,regression:b,forecast:v,anomaly:x,xExtent:k,yExtent:w,frameProps:S={},selection:A,linkedHover:C,onObservation:M,onClick:_,hoverHighlight:j,chartId:R,loading:P,loadingContent:L,emptyContent:T,legendInteraction:I,stroke:$,strokeWidth:N,opacity:D}=e,{width:E,height:B,enableHover:F,showGrid:H,title:O,description:z,summary:W,accessibleTable:q,xLabel:Y,yLabel:G}=n,{safeData:V,orderMap:X}=(0,Vm.useMemo)(()=>{const e=r||[],t="function"==typeof c?c:e=>e[c],o="function"==typeof u?u:e=>e[u];let n=e;if(d&&e.length>0){const t="function"==typeof d?d:e=>e[d];n=[...e].sort((e,o)=>{const n=t(e),r=t(o);return(n instanceof Date?n.getTime():+n)-(r instanceof Date?r.getTime():+r)})}const i=new WeakMap;let s=0;for(const e of n){const n=t(e),r=o(e);null!=n&&null!=r&&isFinite(n)&&isFinite(r)&&s++}let a=0;for(const e of n){const n=t(e),r=o(e);null!=n&&null!=r&&isFinite(n)&&isFinite(r)&&i.set(e,{idx:a++,total:s})}return{safeData:n,orderMap:i}},[r,d,c,u]);Zh("ConnectedScatterplot",V,"xAccessor",c),Zh("ConnectedScatterplot",V,"yAccessor",u);const U=ym({data:V,rawData:r,colorBy:void 0,colorScheme:void 0,legendInteraction:I,selection:A,linkedHover:C,fallbackFields:[],unwrapData:!1,onObservation:M,onClick:_,hoverHighlight:j,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"ConnectedScatterplot",chartId:R,showLegend:void 0,userMargin:i,marginDefaults:{top:50,right:40,bottom:60,left:70},loading:P,loadingContent:L,emptyContent:T,width:E,height:B}),K=U.resolvedSelection?.unselectedOpacity??Sp,Z=(0,Vm.useMemo)(()=>(e,t)=>{const o=t.filter(e=>"point"===e.type);if(2>o.length)return;const n=U.effectiveSelectionHook?.isActive,r=U.effectiveSelectionHook?.predicate,i=100>o.length,s=o.length;e.lineCap="round";for(let t=0;s-1>t;t++){const a=o[t],l=o[t+1],c=Um(t,s),u=!n||!r||r(a.datum??a)||r(l.datum??l),d=n?u?1:K:1;i&&(e.beginPath(),e.moveTo(a.x,a.y),e.lineTo(l.x,l.y),e.strokeStyle="white",e.lineWidth=p+2,e.globalAlpha=.5*d,e.stroke()),e.beginPath(),e.moveTo(a.x,a.y),e.lineTo(l.x,l.y),e.strokeStyle=c,e.lineWidth=p,e.globalAlpha=d,e.stroke()}e.globalAlpha=1},[p,U.effectiveSelectionHook,K]),Q=(0,Vm.useMemo)(()=>[Z],[Z]),J=(0,Vm.useMemo)(()=>(e,t,o)=>{const n=e.filter(e=>"point"===e.type);if(2>n.length)return null;const r=n.length,i=100>r,s=[];for(let e=0;r-1>e;e++){const t=n[e],o=n[e+1],a=Um(e,r),l=Math.min("number"==typeof t.style?.opacity?t.style.opacity:1,"number"==typeof o.style?.opacity?o.style.opacity:1);i&&s.push((0,Xm.jsx)("line",{x1:t.x,y1:t.y,x2:o.x,y2:o.y,stroke:"white",strokeWidth:p+2,strokeLinecap:"round",opacity:.5*l},"halo-"+e)),s.push((0,Xm.jsx)("line",{x1:t.x,y1:t.y,x2:o.x,y2:o.y,stroke:a,strokeWidth:p,strokeLinecap:"round",opacity:l},"seg-"+e))}return(0,Xm.jsx)(Xm.Fragment,{children:s})},[p]),ee=(0,Vm.useMemo)(()=>[J],[J]),te=$m({colorScale:void 0,baseStyleExtras:(0,Vm.useMemo)(()=>e=>{const t=X.get(e),o=t?.idx??0,n=t?.total??1;return{fill:n>0?Um(o,n):"#6366f1",stroke:"white",strokeWidth:1,r:p,fillOpacity:1}},[p,X]),stroke:$,strokeWidth:N,opacity:D,styleRules:f,ruleContext:(0,Vm.useMemo)(()=>Sm(c,u),[c,u]),effectiveSelectionHook:U.effectiveSelectionHook,resolvedSelection:U.resolvedSelection}),oe=h||("string"==typeof d?d:"Order"),ne=(0,Vm.useMemo)(()=>Fl([{label:Y||$l(c),accessor:c,role:"x",format:a},{label:G||$l(u),accessor:u,role:"y",format:l},...d?[{label:oe,accessor:d,role:"group"}]:[]]),[c,u,Y,G,d,oe,a,l]),re=dm({componentName:"ConnectedScatterplot",data:r,accessors:{xAccessor:c,yAccessor:u}}),{effectiveData:ie,statisticalAnnotations:se}=qm({data:V,xAccessor:c,yAccessor:u,forecast:v,anomaly:x});if(U.earlyReturn)return U.earlyReturn;const ae=Em(b),le=ae||se.length>0?[...ae?[ae]:[],...y||[],...se]:y,ce={chartType:"scatter",...null!=r&&{data:ie},xAccessor:c,yAccessor:u,pointStyle:te,size:[E,B],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:U.margin,showAxes:n.showAxes,xLabel:Y,yLabel:G,xFormat:a,yFormat:l,enableHover:F,showGrid:H,...$f({title:O,description:z,summary:W,accessibleTable:q,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Df({tooltip:m,defaultTooltipContent:ne}),...Nf({linkedHover:C,selection:A,onObservation:M,onClick:_,hoverHighlight:j,mobileInteraction:U.mobileInteraction,customHoverBehavior:U.customHoverBehavior,customClickBehavior:U.customClickBehavior}),...g&&{pointIdAccessor:g},canvasPreRenderers:Q,svgPreRenderers:ee,...le&&le.length>0&&{annotations:le},...k&&{xExtent:k},...w&&{yExtent:w},...U.crosshairProps,...S};return re?(0,Xm.jsx)(Oh,{componentName:"ConnectedScatterplot",message:re,width:E,height:B}):(0,Xm.jsx)(Gh,{componentName:"ConnectedScatterplot",width:E,height:B,children:(0,Xm.jsx)(dc,{ref:o,...ce})})});Km.displayName="ConnectedScatterplot";var Zm=require("react"),Qm=require("react");function Jm(e){const{lineWidth:t=2,colorBy:o,colorScale:n,color:r,resolveStroke:i,fillArea:s,areaOpacity:a=.3,stroke:l,strokeWidth:c,opacity:u,effectiveSelectionHook:d,resolvedSelection:h,styleRules:f,ruleContext:p}=e,m=(0,Qm.useMemo)(()=>(e,l)=>{const c={strokeWidth:t},u=!0===s||Array.isArray(s)&&null!=l&&s.includes(l);let d;return i?d=i(e,l):o?n&&(d=ze(e,o,n)):d=r||Gp,void 0!==d&&(c.stroke=d,u&&(c.fill=d,c.fillOpacity=a)),f&&f.length>0&&Object.assign(c,jm(e,f,p?p(e,l):{value:void 0,category:l})),c},[t,o,n,r,i,s,a,f,p]),g=(0,Qm.useMemo)(()=>km(m,{stroke:l,strokeWidth:c,opacity:u}),[m,l,c,u]);return(0,Qm.useMemo)(()=>Ap(g,d??null,h),[g,d,h])}var eg=require("react/jsx-runtime"),tg="__lineObjectSeries",og=(0,Zm.forwardRef)(function(e,t){const o=(0,Zm.useRef)(null);vm(t,{variant:"xy",frameRef:o});const n=sm(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:r,margin:i,className:s,xFormat:a,yFormat:l,axisExtent:c,xAccessor:u="x",yAccessor:d="y",lineBy:h,lineDataAccessor:f="coordinates",colorBy:p,colorScheme:m,styleRules:g,curve:y="linear",showPoints:b=!1,pointRadius:v=3,fillArea:x=!1,areaOpacity:k=.3,lineWidth:w=2,lineGradient:S,tooltip:A,pointIdAccessor:C,annotations:M,directLabel:_,gapStrategy:j="break",anomaly:R,forecast:P,band:L,xExtent:T,yExtent:I,frameProps:$={},selection:N,linkedHover:D,onObservation:E,onClick:B,hoverHighlight:F,hoverRadius:O,chartId:z,loading:W,loadingContent:q,emptyContent:Y,legendInteraction:G,legendPosition:V,xScaleType:X,yScaleType:U,color:K,stroke:Z,strokeWidth:Q,opacity:J}=e,{width:ee,height:te,enableHover:oe,showGrid:ne,showLegend:re,title:ie,description:se,summary:ae,accessibleTable:le,xLabel:ce,yLabel:ue}=n,de=(0,Zm.useMemo)(()=>H(r),[r]),he=Array.isArray(de[0]?.[f])?de[0][f]:de;Zh("LineChart",he,"xAccessor",u),Zh("LineChart",he,"yAccessor",d);const{effectiveData:fe,statisticalAnnotations:pe}=qm({data:de,xAccessor:u,yAccessor:d,forecast:P,anomaly:R,groupBy:h}),me="__compoundGroup",ge=!(!P||!h),ye=ge?me:P?Fm:h,be=(0,Zm.useMemo)(()=>{if(!ge)return fe;const e="function"==typeof h?h:e=>e[h];return fe.map(t=>{const o={...t};return o[me]=`${e(t)}__${t[Fm]||"observed"}`,o})},[fe,ge,h]),ve=ge?be:fe,xe=p||h,ke=(0,Zm.useMemo)(()=>{if(!P)return;const e=P.upperBounds,t=P.lowerBounds;if(!e&&!t)return;const o="function"==typeof e?e:"string"==typeof e?t=>t[e]:null,n="function"==typeof t?t:"string"==typeof t?e=>e[t]:null;let r=1/0,i=-1/0;const s=fe;for(const e of s){const t="function"==typeof d?d(e):+e[d];if(isFinite(t)&&(r>t&&(r=t),t>i&&(i=t)),o){const t=o(e);null!=t&&isFinite(t)&&(t>i&&(i=t),r>t&&(r=t))}if(n){const t=n(e);null!=t&&isFinite(t)&&(r>t&&(r=t),t>i&&(i=t))}}return isFinite(r)&&isFinite(i)?[r,i]:void 0},[P,fe,d]),we=(0,Zm.useCallback)(e=>{const t="function"==typeof u?u(e):e[u],o="function"==typeof d?d(e):e[d];return null==t||null==o||Number.isNaN(t)||Number.isNaN(o)},[u,d]),Se=void 0!==ve[0]?.[f],Ae=Se?tg:ye,Ce=(0,Zm.useMemo)(()=>{if(Se)return ve.map((e,t)=>{const o="function"==typeof h?h(e):"string"==typeof h?e[h]:void 0,n=null==o?"line-"+t:o+"",r=Array.isArray(e[f])?e[f]:[];return{...e,[tg]:n,[f]:r.map(t=>({...t,[tg]:n,parentLine:e,..."string"==typeof h&&void 0!==e[h]?{[h]:e[h]}:{}}))}});if(ye){const e=ve.reduce((e,t)=>{const o="function"==typeof ye?ye(t):t[ye];if(!e[o]){const n={[f]:[]};"string"==typeof ye&&(n[ye]=o),ge&&(n[Fm]=t[Fm],"string"==typeof h&&(n[h]=t[h])),e[o]=n}return e[o][f].push(t),e},{});return Object.values(e)}return[{[f]:ve}]},[Se,ye,f,ve,h,ge]),{gapProcessedLineData:Me,hasGaps:_e}=(0,Zm.useMemo)(()=>{if("interpolate"===j){let e=!1;const t=[];for(const o of Ce){const n=(o[f]||[]).filter(t=>!we(t)||(e=!0,!1));n.length>0&&t.push({...o,[f]:n})}return{gapProcessedLineData:t,hasGaps:e}}if("break"===j){let e=!1;const t=[];for(const o of Ce){const n=o[f]||[];let r=[],i=0;const s=Ae&&"string"==typeof Ae?o[Ae]:void 0;for(const a of n)if(we(a))e=!0,r.length>0&&(t.push({...o,[f]:r}),r=[],i++);else{const e=null!=s?`${s}__seg${i}`:"__seg"+i;r.push({...a,_gapSegment:e})}r.length>0&&t.push({...o,[f]:r})}return{gapProcessedLineData:t,hasGaps:e}}if("zero"===j){let e=!1;const t="string"==typeof d?d:"y",o=[];for(const n of Ce){const r=n[f]||[],i=[];for(const o of r)we(o)?(e=!0,i.push({...o,[t]:0})):i.push(o);o.push({...n,[f]:i})}return{gapProcessedLineData:o,hasGaps:e}}return{gapProcessedLineData:Ce,hasGaps:!1}},[Ce,j,f,we,Ae,d]),je="object"==typeof _?_:{},Re=je.position||"end",Pe=je.fontSize||11,Le=(0,Zm.useMemo)(()=>{if(!_||!xe)return[];const e="function"==typeof xe?xe:e=>e[xe],t=new Set;for(const o of Me){const n=o[f]||[];if(0===n.length)continue;const r=e("end"===Re?n[n.length-1]:n[0])??e(o);if(null==r)continue;const i=r+"";""!==i&&t.add(i)}return Array.from(t)},[_,xe,Me,f,Re]),Te=(0,Zm.useMemo)(()=>{if(!_)return n.marginDefaults;const e=Le.reduce((e,t)=>Math.max(e,t.length*(.6*Pe)),0)+10,t="end"===Re?"right":"left";return{...n.marginDefaults,[t]:Math.max(n.marginDefaults[t]||0,e)}},[_,Le,Pe,Re,n.marginDefaults]),Ie=ym({data:fe,rawData:r,colorBy:xe,colorScheme:m,legendInteraction:G,legendPosition:V,selection:N,linkedHover:D,fallbackFields:xe?["string"==typeof xe?xe:""]:[],unwrapData:!1,onObservation:E,onClick:B,hoverHighlight:F,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"LineChart",chartId:z,showLegend:(!_||void 0!==re)&&re,userMargin:i,marginDefaults:Te,loading:W,loadingContent:q,emptyContent:Y,width:ee,height:te}),$e=Ie.colorScale,Ne=Ie.effectiveSelectionHook,De=Ie.resolvedSelection,Ee=Ie.customHoverBehavior,Be=Ie.customClickBehavior,Fe=Ie.crosshairProps,He=(0,Zm.useMemo)(()=>{if(xe)return Se?e=>{const t=e.parentLine||e;return"function"==typeof xe?xe(t):t[xe]}:xe},[xe,Se]),Oe=(0,Zm.useMemo)(()=>Sm(u,d),[u,d]),We=Jm({lineWidth:w,colorBy:He,colorScale:$e,color:K,fillArea:x,areaOpacity:k,stroke:Z,strokeWidth:Q,opacity:J,effectiveSelectionHook:Ne,resolvedSelection:De,styleRules:g,ruleContext:Oe}),[qe,Ye]=(0,Zm.useState)(null);(0,Zm.useEffect)(()=>{if(!P)return void Ye(null);let e=!1;return async function(...e){return(await Om()).createSegmentLineStyle(...e)}(We,P).then(t=>{e||Ye(()=>t)}).catch(()=>{e||Ye(null)}),()=>{e=!0}},[We,P]);const Ge=qe||We,Ve=(0,Zm.useMemo)(()=>{if(b)return e=>{const t={r:v,fillOpacity:1};return xe?$e&&(t.fill=ze(e.parentLine||e,xe,$e)):t.fill=K||Gp,t}},[b,v,xe,$e,K]),Xe=Array.isArray(x)?"mixed":x?"area":"line",Ue=(0,Zm.useMemo)(()=>{if(!_||!xe)return[];const e="function"==typeof u?u:e=>e[u],t="function"==typeof d?d:e=>e[d],o="function"==typeof xe?xe:e=>e[xe],n=new Map;for(const e of Me){const t=e[f]||[];if(0===t.length)continue;const r="end"===Re?t[t.length-1]:t[0],i=o(r)??o(e);if(null==i)continue;const s=i+"";""===s||n.has(s)||n.set(s,r)}const r=Array.from(n.entries()).map(([o,n])=>({type:"text",label:o,["string"==typeof u?u:"x"]:e(n),["string"==typeof d?d:"y"]:t(n),dx:"end"===Re?6:-6,dy:0,color:$e?$e(o):Gp,fontSize:Pe}));r.sort((e,t)=>{const o="string"==typeof d?d:"y";return e[o]-t[o]});for(let e=1;r.length>e;e++){const t="string"==typeof d?d:"y",o=r[e-1],n=r[e];Pe+2>Math.abs(n[t]+n.dy-(o[t]+o.dy))&&(n.dy+=Pe+2)}return r},[_,xe,$e,Me,f,u,d,Re,Pe]),Ke=Ie.margin,Ze=h||p,Qe=(0,Zm.useMemo)(()=>Fl([{label:ce||$l(u),accessor:u,role:"x",format:a},{label:ue||$l(d),accessor:d,role:"y",format:l},...Ze?[{label:$l(Ze),accessor:Ze,role:"group"}]:[],...Bl(L,l)]),[u,d,ce,ue,Ze,a,l,L]),Je=dm({componentName:"LineChart",data:Se?fe[0]?.[f]||[]:r,accessors:{xAccessor:u,yAccessor:d}}),et=(0,Zm.useMemo)(()=>Se||Ae||_e?Me.flatMap(e=>{const t=e[f]||[];return Ae&&"string"==typeof Ae?t.map(t=>({...t,[Ae]:t[Ae]??e[Ae]})):t}):ve,[Me,f,Se,Ae,ve,_e]),tt={chartType:Xe,...Array.isArray(x)&&{areaGroups:x},...S&&{lineGradient:S},...null!=r&&{data:et},xAccessor:u,yAccessor:d,xScaleType:X,yScaleType:U,...T&&{xExtent:T},...!I||null==I[0]&&null==I[1]?ke?{yExtent:ke}:{}:{yExtent:I},groupAccessor:"break"===j&&_e?"_gapSegment":Ae||void 0,...L&&{band:L},curve:y,lineStyle:Ge,...b&&{pointStyle:Ve},size:[ee,te],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Ke,showAxes:n.showAxes,xLabel:ce,yLabel:ue,xFormat:a,yFormat:l,...void 0!==c&&{axisExtent:c},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},enableHover:oe,showGrid:ne,...Ie.legendBehaviorProps,...ie&&{title:ie},...se&&{description:se},...ae&&{summary:ae},...void 0!==le&&{accessibleTable:le},...s&&{className:s},...null!=e.animate&&{animate:e.animate},tooltipContent:!1===A?()=>null:"multi"===A?wa():Sa(A)||Qe,..."multi"===A&&{tooltipMode:"multi"},...Nf({linkedHover:D,selection:N,onObservation:E,onClick:B,hoverRadius:O,hoverHighlight:F,mobileInteraction:Ie.mobileInteraction,customHoverBehavior:Ee,customClickBehavior:Be}),...C&&{pointIdAccessor:C},...(M?.length||pe.length||Ue.length)&&{annotations:[...M||[],...pe,...Ue]},...Fe,...$};return Ie.earlyReturn?Ie.earlyReturn:Je?(0,eg.jsx)(Oh,{componentName:"LineChart",message:Je,width:ee,height:te}):(0,eg.jsx)(Gh,{componentName:"LineChart",width:ee,height:te,children:(0,eg.jsx)(dc,{ref:o,...tt})})});og.displayName="LineChart";var ng=require("react"),rg=require("react");function ig(e){const{safeData:t,data:o,areaBy:n,lineDataAccessor:r,colorBy:i,colorScale:s,color:a,stroke:l,strokeWidth:c,opacity:u,effectiveSelectionHook:d,resolvedSelection:h,areaOpacity:f,showLine:p,lineWidth:m,showPoints:g,pointRadius:y,xAccessor:b,yAccessor:v,xLabel:x,yLabel:k,xFormat:w,yFormat:S,groupField:A,styleRules:C,ruleContext:M}=e,_=void 0!==t[0]?.[r],j=(0,rg.useMemo)(()=>{if(null==o)return[];if(!_&&!n)return t;let e;if(_)e=t;else{const o=n,i=t.reduce((e,t)=>{const n="function"==typeof o?o(t):t[o];if(!e[n]){const t={[r]:[]};"string"==typeof o&&(t[o]=n),e[n]=t}return e[n][r].push(t),e},{});e=Object.values(i)}return e.flatMap(e=>{const t=e[r]||[];return n&&"string"==typeof n?t.map(t=>({...t,[n]:e[n]})):t})},[o,t,n,r,_]),R=(0,rg.useMemo)(()=>e=>{const t={};if(i){if(s){const o=ze(e,i,s);t.fill=o,p?(t.stroke=o,t.strokeWidth=m):t.stroke="none"}}else{const e=a||Gp;t.fill=e,p?(t.stroke=e,t.strokeWidth=m):t.stroke="none"}return t.fillOpacity=f,C&&C.length>0&&Object.assign(t,jm(e,C,M?M(e):{value:void 0})),t},[i,s,a,f,p,m,C,M]),P=(0,rg.useMemo)(()=>km(R,{stroke:l,strokeWidth:c,opacity:u}),[R,l,c,u]);return{flattenedData:j,lineStyle:(0,rg.useMemo)(()=>Ap(P,d??null,h),[P,d,h]),pointStyle:(0,rg.useMemo)(()=>{if(g)return e=>{const t={r:y,fillOpacity:1};return i?s&&(t.fill=ze(e.parentLine||e,i,s)):t.fill=a||Gp,t}},[g,y,i,s,a]),defaultTooltipContent:(0,rg.useMemo)(()=>Fl([{label:x||$l(b),accessor:b,role:"x",format:w},{label:k||$l(v),accessor:v,role:"y",format:S},...A?[{label:$l(A),accessor:A,role:"group"}]:[],...Bl(e.band,S)]),[b,v,x,k,A,w,S,e.band])}}var sg=require("react/jsx-runtime");function ag(e,t){if(null==t)return e;const o=e.trim(),n=o.match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i);if(n){const e=n[1],o=3===e.length?e.split("").map(e=>e+e).join(""):e;return`rgba(${parseInt(o.slice(0,2),16)}, ${parseInt(o.slice(2,4),16)}, ${parseInt(o.slice(4,6),16)}, ${t})`}if(o.startsWith("rgba(")){const e=o.lastIndexOf(","),n=o.lastIndexOf(")");if(-1!==e&&n>e)return`${o.slice(0,e+1)} ${t})`}return o.startsWith("rgb(")?o.replace(/^rgb\(/,"rgba(").replace(/\)$/,`, ${t})`):e}var lg=(0,ng.forwardRef)(function(e,t){const o=(0,ng.useRef)(null);vm(t,{variant:"xy",frameRef:o});const n=sm(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:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:u="y",areaBy:d,y0Accessor:h,gradientFill:f=!1,semanticGradient:p,lineDataAccessor:m="coordinates",colorBy:g,colorScheme:y,styleRules:b,curve:v="monotoneX",areaOpacity:x=.7,lineGradient:k,showLine:w=!0,lineWidth:S=2,showPoints:A=!1,pointRadius:C=3,tooltip:M,annotations:_,forecast:j,anomaly:R,band:P,xExtent:L,yExtent:T,frameProps:I={},selection:$,linkedHover:N,onObservation:D,onClick:E,hoverHighlight:B,chartId:F,loading:O,loadingContent:z,emptyContent:W,legendInteraction:q,legendPosition:Y,color:G,stroke:V,strokeWidth:X,opacity:U}=e,{width:K,height:Z,enableHover:Q,showGrid:J,showLegend:ee,title:te,description:oe,summary:ne,accessibleTable:re,xLabel:ie,yLabel:se}=n,ae=(0,ng.useMemo)(()=>H(r),[r]),le=g||d,ce=(0,ng.useMemo)(()=>{return p&&p.length>0?{colorStops:(e=p,e.filter(e=>Number.isFinite(e.at)).map(e=>({offset:1-Math.max(0,Math.min(100,e.at))/100,color:ag(e.color,e.opacity)})).sort((e,t)=>e.offset-t.offset))}:f;var e},[p,f]);Zh("AreaChart",ae,"xAccessor",c),Zh("AreaChart",ae,"yAccessor",u);const ue=ym({data:ae,rawData:r,colorBy:le,colorScheme:y,legendInteraction:q,legendPosition:Y,selection:$,linkedHover:N,fallbackFields:le?["string"==typeof le?le:""]:[],unwrapData:!1,onObservation:D,onClick:E,hoverHighlight:B,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"AreaChart",chartId:F,showLegend:ee,userMargin:i,marginDefaults:n.marginDefaults,loading:O,loadingContent:z,emptyContent:W,width:K,height:Z}),{effectiveData:de,statisticalAnnotations:he}=qm({data:ae,xAccessor:c,yAccessor:u,forecast:j,anomaly:R,groupBy:d}),fe=(0,ng.useMemo)(()=>Sm(c,u),[c,u]),{flattenedData:pe,lineStyle:me,pointStyle:ge,defaultTooltipContent:ye}=ig({safeData:de,data:r,areaBy:d,lineDataAccessor:m,colorBy:le,colorScale:ue.colorScale,color:G,stroke:V,strokeWidth:X,opacity:U,effectiveSelectionHook:ue.effectiveSelectionHook,resolvedSelection:ue.resolvedSelection,areaOpacity:x,showLine:w,lineWidth:S,showPoints:A,pointRadius:C,xAccessor:c,yAccessor:u,xLabel:ie,yLabel:se,xFormat:a,yFormat:l,groupField:d||g,band:P,styleRules:b,ruleContext:fe}),be=dm({componentName:"AreaChart",data:r,accessors:{xAccessor:c,yAccessor:u}}),ve={chartType:"area",...null!=r&&{data:pe},xAccessor:c,yAccessor:u,groupAccessor:d||void 0,...h&&{y0Accessor:h},...P&&{band:P},...ce&&{gradientFill:ce},...k&&{lineGradient:k},curve:v,lineStyle:me,...A&&ge&&{pointStyle:ge},size:[K,Z],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ue.margin,showAxes:n.showAxes,xLabel:ie,yLabel:se,xFormat:a,yFormat:l,enableHover:Q,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:J,...ue.legendBehaviorProps,...$f({title:te,description:oe,summary:ne,accessibleTable:re,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),..."multi"===M?{tooltipContent:wa(),tooltipMode:"multi"}:Df({tooltip:M,defaultTooltipContent:ye}),...Nf({linkedHover:N,selection:$,onObservation:D,onClick:E,hoverHighlight:B,mobileInteraction:ue.mobileInteraction,customHoverBehavior:ue.customHoverBehavior,customClickBehavior:ue.customClickBehavior}),...(_&&_.length>0||he.length>0)&&{annotations:[..._||[],...he]},...L&&{xExtent:L},...T&&{yExtent:T},...ue.crosshairProps,...I};return ue.earlyReturn?ue.earlyReturn:be?(0,sg.jsx)(Oh,{componentName:"AreaChart",message:be,width:K,height:Z}):(0,sg.jsx)(Gh,{componentName:"AreaChart",width:K,height:Z,children:(0,sg.jsx)(dc,{ref:o,...ve})})});lg.displayName="AreaChart";var cg=require("react"),ug=require("react/jsx-runtime");function dg(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 hg=(0,cg.forwardRef)(function(e,t){const o=(0,cg.useRef)(null),n=sm(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:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",seriesAAccessor:u="a",seriesBAccessor:d="b",seriesALabel:h="A",seriesBLabel:f="B",seriesAColor:p="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:k=.6,gradientFill:w,tooltip:S,annotations:A,xExtent:C,yExtent:M,frameProps:_={},selection:j,linkedHover:R,onObservation:P,onClick:L,hoverHighlight:T,chartId:I,loading:$,loadingContent:N,emptyContent:D,legendInteraction:E,legendPosition:B,pointIdAccessor:F,windowSize:O}=e,{width:z,height:W,enableHover:q,showGrid:Y,showLegend:G,title:V,description:X,summary:U,accessibleTable:K,xLabel:Z,yLabel:Q}=n,J=(0,cg.useMemo)(()=>"function"==typeof c?e=>dg(c(e)):e=>dg(e[c]),[c]),ee=(0,cg.useMemo)(()=>"function"==typeof u?e=>dg(u(e)):e=>dg(e[u]),[u]),te=(0,cg.useMemo)(()=>"function"==typeof d?e=>dg(d(e)):e=>dg(e[d]),[d]),[oe,ne]=(0,cg.useState)([]),re=(0,cg.useRef)([]),ie=null==r,se=(0,cg.useMemo)(()=>H(ie?oe:r),[ie,oe,r]),ae=(0,cg.useMemo)(()=>function(e,t,o,n){if(!e.length)return[];const r=e.filter(e=>Number.isFinite(t(e))).sort((e,o)=>t(e)-t(o)),i=[];let s=0,a=null,l=null,c=[];const u=(e,t)=>e>t?"A":t>e?"B":null,d=e=>`seg-${s}-${e}`,h=e=>i.push(e),f=(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;r.length>e;e++){const i=r[e],p=t(i),m=o(i),g=n(i);if(!Number.isFinite(p)||!Number.isFinite(m)||!Number.isFinite(g))continue;const y=u(m,g);if(null!==y)if(null!=a){if(l&&l.w!==y){let e,t;if(c.length>0)e=c[0].x,t=c[0].y;else{const o=m-l.a-(g-l.b);if(0!==o){const n=Math.max(0,Math.min(1,(l.b-l.a)/o));e=l.x+n*(p-l.x),t=l.a+n*(m-l.a)}else e=l.x,t=l.a}h({__x:e,__y:t,__y0:t,__diffSegment:d(a),__diffWinner:a,__valA:t,__valB:t}),s++,a=y,h({__x:e,__y:t,__y0:t,__diffSegment:d(a),__diffWinner:a,__valA:t,__valB:t});for(let e=1;c.length>e;e++)f(c[e],a)}else for(const e of c)f(e,a);c=[],h({__x:p,__y:g>m?g:m,__y0:g>m?m:g,__diffSegment:d(a),__diffWinner:a,__valA:m,__valB:g,__sourceDatum:i}),l={x:p,a:m,b:g,w:y}}else{a=y;for(const e of c)f(e,a);c=[],h({__x:p,__y:g>m?g:m,__y0:g>m?m:g,__diffSegment:d(a),__diffWinner:a,__valA:m,__valB:g,__sourceDatum:i}),l={x:p,a:m,b:g,w:y}}else c.push({x:p,y:m,datum:i})}for(const e of c)f(e,a??"A");return i}(se,J,ee,te),[se,J,ee,te]),le=(0,cg.useMemo)(()=>g?function(e,t,o,n){if(!e.length)return[];const r=e.filter(e=>Number.isFinite(t(e))).sort((e,o)=>t(e)-t(o)),i=[];for(const e of r){const r=t(e),s=o(e),a=n(e);Number.isFinite(s)&&i.push({__x:r,__y:s,__diffSegment:"line-A"}),Number.isFinite(a)&&i.push({__x:r,__y:a,__diffSegment:"line-B"})}return i}(se,J,ee,te):[],[g,se,J,ee,te]),ce=(0,cg.useMemo)(()=>[...ae,...le],[ae,le]),ue=(0,cg.useMemo)(()=>{const e=new Set;for(const t of ae)e.add(t.__diffSegment);return Array.from(e)},[ae]);(0,cg.useImperativeHandle)(t,()=>{const e=e=>{const t=O&&e.length>O?e.slice(e.length-O):e;re.current=t,ne(t)},t=F?"function"==typeof F?F:e=>e[F]:null;return{push:t=>e([...re.current,t]),pushMany:t=>e([...re.current,...t]),remove:o=>{if(!t)return[];const n=Array.isArray(o)?o:[o],r=[],i=[];for(const e of re.current)n.includes(t(e))?r.push(e):i.push(e);return e(i),r},update:(o,n)=>{if(!t)return[];const r=Array.isArray(o)?o:[o],i=[],s=re.current.map(e=>{if(r.includes(t(e))){const t=n(e);return i.push(t),t}return e});return e(s),i},clear:()=>e([]),getData:()=>ie?re.current:se,getScales:()=>o.current?.getScales()??null}},[ie,se,F,O]);const de=ym({data:se,rawData:r,colorBy:"__diffWinner",colorScheme:[p,m],legendInteraction:E,legendPosition:B,selection:j,linkedHover:R,fallbackFields:["__diffWinner"],unwrapData:!1,onObservation:P,onClick:L,hoverHighlight:T,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"DifferenceChart",chartId:I,showLegend:G,userMargin:i,marginDefaults:n.marginDefaults,loading:$,loadingContent:N,emptyContent:D,width:z,height:W}),he=(0,cg.useMemo)(()=>{if(!1!==G)return{legendGroups:[{label:"",type:"fill",styleFn:e=>({fill:e.color||"currentColor"}),items:[{label:h,color:p},{label:f,color:m}]}]}},[G,h,f,p,m]),fe=(0,cg.useCallback)(e=>{const t=e.__diffSegment;return{fill:"A"==(t?.endsWith("-A")?"A":"B")?p:m,stroke:"none",fillOpacity:k}},[p,m,k]),pe=(0,cg.useCallback)(e=>({stroke:"A"==("line-A"===e.__diffSegment?"A":"B")?p:m,strokeWidth:y,fill:"none"}),[p,m,y]),me=(0,cg.useCallback)(e=>({fill:"A"==("line-A"===e.__diffSegment?"A":"B")?p:m,r:v}),[p,m,v]),ge=(0,cg.useCallback)(e=>{const t=e.data,o=e.allSeries,n=e.xValue??t?.__x;let r=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)&&(r=e.value),null!=t?.value&&Number.isFinite(t.value)&&(i=t.value)}if(null!=n&&(null==r||null==i)){const e=se.find(e=>J(e)===n);e&&(null==r&&(r=ee(e)),null==i&&(i=te(e)))}const s=e=>null!=e&&Number.isFinite(e)?""+Math.round(100*e)/100:"—",l=a&&null!=n?a(n):null!=n?n+"":"";return(0,ug.jsxs)("div",{className:"semiotic-tooltip",style:ya,children:[l&&(0,ug.jsx)("div",{style:{fontWeight:600,marginBottom:4},children:l}),(0,ug.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6},children:[(0,ug.jsx)("span",{style:{width:10,height:10,background:p,display:"inline-block",borderRadius:2}}),(0,ug.jsxs)("span",{children:[h,": ",s(r)]})]}),(0,ug.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6},children:[(0,ug.jsx)("span",{style:{width:10,height:10,background:m,display:"inline-block",borderRadius:2}}),(0,ug.jsxs)("span",{children:[f,": ",s(i)]})]}),null!=r&&null!=i&&Number.isFinite(r)&&Number.isFinite(i)&&(0,ug.jsxs)("div",{style:{marginTop:4,opacity:.7},children:["Δ = ",s(r-i)]})]})},[se,J,ee,te,a,p,m,h,f]),ye="multi"===S,be=(0,cg.useMemo)(()=>!1===S?()=>null:ye?ge:Sa(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:fe,lineStyle:pe,...b&&{pointStyle:me},size:[z,W],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:de.margin,showAxes:n.showAxes,xLabel:Z,yLabel:Q,xFormat:a,yFormat:l,enableHover:q,showGrid:Y,...w&&{gradientFill:!0===w?{topOpacity:.85,bottomOpacity:.15}:w},...he&&{legend:he,legendPosition:de.legendPosition},...$f({title:V,description:X,summary:U,accessibleTable:K,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),tooltipContent:be,...ye&&{tooltipMode:"multi"},...Nf({linkedHover:R,selection:j,onObservation:P,onClick:L,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,..._};return(0,ug.jsx)(Gh,{componentName:"DifferenceChart",width:z,height:W,children:(0,ug.jsx)(dc,{ref:o,...ve})})});"function"==typeof hg&&(hg.displayName="DifferenceChart");var fg=require("react"),pg=require("react/jsx-runtime"),mg=(0,fg.forwardRef)(function(e,t){const o=(0,fg.useRef)(null),n=sm(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:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:u="y",areaBy:d,lineDataAccessor:h="coordinates",colorBy:f,colorScheme:p,styleRules:m,curve:g="monotoneX",areaOpacity:y=.7,showLine:b=!0,lineWidth:v=2,showPoints:x=!1,pointRadius:k=3,normalize:w=!1,baseline:S="zero",stackOrder:A,tooltip:C,annotations:M,xExtent:_,yExtent:j,frameProps:R={},selection:P,linkedHover:L,onObservation:T,onClick:I,hoverHighlight:$,chartId:N,loading:D,loadingContent:E,emptyContent:B,legendInteraction:F,legendPosition:O,color:z,stroke:W,strokeWidth:q,opacity:Y}=e,{width:G,height:V,enableHover:X,showGrid:U,showLegend:K,title:Z,description:Q,summary:J,accessibleTable:ee,xLabel:te,yLabel:oe}=n,ne=(0,fg.useMemo)(()=>H(r),[r]),re=f||d;vm(t,{variant:"xy",frameRef:o});const ie=ym({data:ne,rawData:r,colorBy:re,colorScheme:p,legendInteraction:F,legendPosition:O,selection:P,linkedHover:L,fallbackFields:re?["string"==typeof re?re:""]:[],unwrapData:!1,onObservation:T,onClick:I,hoverHighlight:$,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"StackedAreaChart",chartId:N,showLegend:K,userMargin:i,marginDefaults:n.marginDefaults,loading:D,loadingContent:E,emptyContent:B,width:G,height:V}),se=(0,fg.useMemo)(()=>Sm(c,u),[c,u]),{flattenedData:ae,lineStyle:le,pointStyle:ce,defaultTooltipContent:ue}=ig({safeData:ne,data:r,areaBy:d,lineDataAccessor:h,colorBy:re,colorScale:ie.colorScale,color:z,stroke:W,strokeWidth:q,opacity:Y,effectiveSelectionHook:ie.effectiveSelectionHook,resolvedSelection:ie.resolvedSelection,areaOpacity:y,showLine:b,lineWidth:v,showPoints:x,pointRadius:k,xAccessor:c,yAccessor:u,xLabel:te,yLabel:oe,xFormat:a,yFormat:l,groupField:d||f,styleRules:m,ruleContext:se}),de=dm({componentName:"StackedAreaChart",data:r,accessors:{xAccessor:c,yAccessor:u}}),he={chartType:"stackedarea",...null!=r&&{data:ae},xAccessor:c,yAccessor:u,groupAccessor:d||void 0,curve:g,normalize:w,baseline:w?"zero":S,stackOrder:A,lineStyle:le,...x&&ce&&{pointStyle:ce},size:[G,V],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ie.margin,showAxes:n.showAxes,xLabel:te,yLabel:oe,xFormat:a,yFormat:l,enableHover:X,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:U,...ie.legendBehaviorProps,...$f({title:Z,description:Q,summary:J,accessibleTable:ee,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),..."multi"===C?{tooltipContent:wa(),tooltipMode:"multi"}:Df({tooltip:C,defaultTooltipContent:ue}),...Nf({linkedHover:L,selection:P,onObservation:T,onClick:I,hoverHighlight:$,mobileInteraction:ie.mobileInteraction,customHoverBehavior:ie.customHoverBehavior,customClickBehavior:ie.customClickBehavior}),...M&&M.length>0&&{annotations:M},..._&&{xExtent:_},...j&&{yExtent:j},...ie.crosshairProps,...R};return ie.earlyReturn?ie.earlyReturn:de?(0,pg.jsx)(Oh,{componentName:"StackedAreaChart",message:de,width:G,height:V}):(0,pg.jsx)(Gh,{componentName:"StackedAreaChart",width:G,height:V,children:(0,pg.jsx)(dc,{ref:o,...he})})});mg.displayName="StackedAreaChart";var gg=require("react"),yg=require("d3-scale");h();var bg=require("react/jsx-runtime"),vg=(0,gg.forwardRef)(function(e,t){const o=(0,gg.useRef)(null);vm(t,{variant:"xy",frameRef:o});const n=sm(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:r,margin:i,className:s,xAccessor:a="x",yAccessor:l="y",valueAccessor:c="value",xFormat:d,yFormat:h,colorScheme:f,customColorScale:p,showValues:m=!1,valueFormat:g,cellBorderColor:y="#fff",cellBorderWidth:b=1,tooltip:v,annotations:x,xExtent:k,yExtent:w,frameProps:S={},selection:A,linkedHover:C,onObservation:M,onClick:_,hoverHighlight:j,chartId:R,loading:P,loadingContent:L,emptyContent:T,showLegend:I,legendPosition:$,legendInteraction:N}=e,{width:D,height:E,enableHover:B,title:F,description:O,summary:z,accessibleTable:W,xLabel:q,yLabel:Y}=n,G=Kh(P,D,E,L),V=G?null:Uh(r,D,E,T),X=(0,gg.useMemo)(()=>H(r),[r]),U=function(){const e=Fp();return e?.colors?.sequential||void 0}(),K=f??U??"blues",Z=I??!1,Q=$??"right",{margin:J}=nm({data:X,colorBy:Z?"value":void 0,colorScale:void 0,showLegend:Z,legendPosition:Q,userMargin:i,defaults:n.marginDefaults}),{customHoverBehavior:ee,customClickBehavior:te,crosshairSourceId:oe}=tm({selection:A,linkedHover:C,fallbackFields:[],onObservation:M,onClick:_,chartType:"Heatmap",chartId:R,hoverHighlight:j,colorByField:void 0,mobileInteraction:n.mobileInteraction});gm(A);const ne=om(C,oe);rm(N,void 0,[]);const re=(0,gg.useMemo)(()=>"function"==typeof c?e=>c(e):e=>e[c],[c]),ie=(0,gg.useMemo)(()=>u(X.map(re)),[X,re]),se=(0,gg.useMemo)(()=>{if("custom"===K&&p)return p;const e=Re(K);return(0,yg.scaleSequential)(e).domain(ie)},[K,p,ie]),ae=(0,gg.useMemo)(()=>Fl([{label:q||$l(a),accessor:a,role:"x",format:d},{label:Y||$l(l),accessor:l,role:"y",format:h},{label:$l(c),accessor:c,role:"value",format:g}]),[a,l,q,Y,c,d,h,g]),le=dm({componentName:"Heatmap",data:r,accessors:{xAccessor:a,yAccessor:l,valueAccessor:c}}),ce=(0,gg.useMemo)(()=>{if(Z)return{gradient:{colorFn:e=>se(e),domain:ie,label:"string"==typeof c?c:"value",format:g}}},[Z,se,ie,c,g]),ue={chartType:"heatmap",...null!=r&&{data:X},xAccessor:a,yAccessor:l,valueAccessor:c,colorScheme:"custom"!==K?K:void 0,showValues:m,heatmapValueFormat:g,size:[D,E],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:J,showAxes:n.showAxes,xLabel:q,yLabel:Y,xFormat:d,yFormat:h,enableHover:B,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...ce&&{legend:ce,legendPosition:Q},...$f({title:F,description:O,summary:z,accessibleTable:W,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Df({tooltip:v,defaultTooltipContent:ae}),...Nf({linkedHover:C,selection:A,onObservation:M,onClick:_,hoverHighlight:j,mobileInteraction:n.mobileInteraction,customHoverBehavior:ee,customClickBehavior:te}),...x&&x.length>0&&{annotations:x},...k&&{xExtent:k},...w&&{yExtent:w},...ne,...S};return G||V||(le?(0,bg.jsx)(Oh,{componentName:"Heatmap",message:le,width:D,height:E}):(0,bg.jsx)(Gh,{componentName:"Heatmap",width:D,height:E,children:(0,bg.jsx)(dc,{ref:o,...ue})}))});vg.displayName="Heatmap";var xg=require("react"),kg=require("react/jsx-runtime"),wg=(0,xg.forwardRef)(function(e,t){const o=(0,xg.useRef)(null),n=sm(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:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:u="y",sizeBy:d,sizeRange:h=[5,40],colorBy:f,colorScheme:p,styleRules:m,bubbleOpacity:g=.6,bubbleStrokeWidth:y=1,bubbleStrokeColor:b="white",tooltip:v,marginalGraphics:x,pointIdAccessor:k,annotations:w,regression:S,xExtent:A,yExtent:C,frameProps:M={},selection:_,linkedHover:j,linkedBrush:R,onObservation:P,onClick:L,hoverHighlight:T,chartId:I,loading:$,loadingContent:N,emptyContent:D,legendInteraction:E,legendPosition:B,color:F,stroke:O,strokeWidth:z,opacity:W}=e,{width:q,height:Y,enableHover:G,showGrid:V,showLegend:X,title:U,description:K,summary:Z,accessibleTable:Q,xLabel:J,yLabel:ee}=n,te=(0,xg.useMemo)(()=>H(r),[r]),oe=void 0===r,ne=ym({data:te,rawData:r,colorBy:f,colorScheme:p,legendInteraction:E,legendPosition:B,selection:_,linkedHover:j,fallbackFields:f?["string"==typeof f?f:""]:[],unwrapData:!1,onObservation:P,onClick:L,hoverHighlight:T,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"BubbleChart",chartId:I,showLegend:X,userMargin:i,marginDefaults:n.marginDefaults,loading:$,loadingContent:N,emptyContent:D,width:q,height:Y}),{domain:re,trackPushed:ie,reset:se}=Dm({accessor:d,data:te,isPushMode:oe}),ae=(0,xg.useCallback)(e=>{ie([e]),o.current?.push(e)},[ie]),le=(0,xg.useCallback)(e=>{ie(e),o.current?.pushMany(e)},[ie]);vm(t,{variant:"xy",frameRef:o,overrides:{push:ae,pushMany:le,clear:()=>{se(),o.current?.clear()}}});const ce=wp(R),ue=(np({name:ce?.name||"__unused_brush__",xField:ce?.xField||("string"==typeof c?c:void 0),yField:ce?.yField||("string"==typeof u?u:void 0)}),(0,xg.useMemo)(()=>({stroke:b,strokeWidth:y}),[b,y])),de=(0,xg.useMemo)(()=>re??[0,1],[re]),he=(0,xg.useCallback)(e=>Ye(e,d,h,de),[d,h,de]),fe=(0,xg.useMemo)(()=>Sm(c,u),[c,u]),pe=$m({colorBy:f,colorScale:ne.colorScale,color:F,fillOpacity:g,radiusFn:he,baseStyleExtras:ue,stroke:O,strokeWidth:z,opacity:W,styleRules:m,ruleContext:fe,effectiveSelectionHook:ne.effectiveSelectionHook,resolvedSelection:ne.resolvedSelection}),me=(0,xg.useMemo)(()=>Fl([{label:J||$l(c),accessor:c,role:"x",format:a},{label:ee||$l(u),accessor:u,role:"y",format:l},{label:$l(d),accessor:d,role:"size"},...f?[{label:$l(f),accessor:f,role:"color"}]:[]]),[c,u,J,ee,d,f,a,l]);if(ne.earlyReturn)return ne.earlyReturn;const ge=dm({componentName:"BubbleChart",data:r,accessors:{xAccessor:c,yAccessor:u},requiredProps:{sizeBy:d}});if(ge)return(0,kg.jsx)(Oh,{componentName:"BubbleChart",message:ge,width:q,height:Y});const ye=Em(S),be=ye?[ye,...w||[]]:w,ve={chartType:"bubble",...null!=r&&{data:te},xAccessor:c,yAccessor:u,colorAccessor:f||void 0,sizeAccessor:d,sizeRange:h,pointStyle:pe,colorScheme:p,size:[q,Y],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ne.margin,showAxes:n.showAxes,xLabel:J,yLabel:ee,xFormat:a,yFormat:l,enableHover:G,showGrid:V,...ne.legendBehaviorProps,...$f({title:U,description:K,summary:Z,accessibleTable:Q,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Df({tooltip:v,defaultTooltipContent:me}),...Nf({linkedHover:j,selection:_,onObservation:P,onClick:L,hoverHighlight:T,mobileInteraction:ne.mobileInteraction,customHoverBehavior:ne.customHoverBehavior,customClickBehavior:ne.customClickBehavior}),...x&&{marginalGraphics:x},...k&&{pointIdAccessor:k},...be&&be.length>0&&{annotations:be},...A&&{xExtent:A},...C&&{yExtent:C},...ne.crosshairProps,...M};return(0,kg.jsx)(Gh,{componentName:"BubbleChart",width:q,height:Y,children:(0,kg.jsx)(dc,{ref:o,...ve})})});wg.displayName="BubbleChart";var Sg=c(require("react")),Ag=require("react"),Cg=require("d3-brush"),Mg=require("d3-selection");h();var _g=require("react/jsx-runtime"),jg="__splomIdx",Rg="splom-hover-source",Pg={top:4,bottom:4,left:4,right:4};function Lg({frameRef:e,cellSize:t,onBrush:o}){const n=(0,Ag.useRef)(null),r=t-Pg.left-Pg.right,i=t-Pg.top-Pg.bottom;return(0,Ag.useEffect)(()=>{if(!n.current)return;const t=(0,Mg.select)(n.current).select(".brush-g"),s=(0,Cg.brush)().extent([[0,0],[r,i]]).on("brush end",t=>{const n=e.current?.getScales();if(!n)return;if(!(r=t.selection)||!Array.isArray(r[0]))return void o(null);var r;const[[i,s],[a,l]]=t.selection,c=[[n.x.invert(i),n.y.invert(s)],[n.x.invert(a),n.y.invert(l)]];o(c)});return t.call(s),t.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{s.on("brush end",null)}},[r,i,e,o]),(0,_g.jsx)("svg",{ref:n,width:t,height:t,style:{position:"absolute",top:0,left:0},children:(0,_g.jsx)("g",{className:"brush-g",transform:`translate(${Pg.left},${Pg.top})`})})}function Tg({data:e,xField:t,yField:o,cellSize:n,pointRadius:r,pointOpacity:i,colorBy:s,colorScale:a,brushSelectionName:l,hoverSelectionName:c,unselectedOpacity:u,mobileInteraction:d,mode:h,onPointHover:f,onPointClick:p}){const m=(0,Ag.useRef)(null),g=Jf({name:l,clientId:`splom-${t}-${o}`,fields:[t,o]}),y=np({name:l,xField:t,yField:o}),b=Jf({name:c,clientId:Rg,fields:[jg]}),v=b.selectPoints,x=(0,Ag.useCallback)(e=>{e?y.brushInteraction.during(e):y.brushInteraction.end(null)},[y.brushInteraction]),k=(0,Ag.useCallback)(e=>{if(!e)return void f?.(null);const t=e.data,o=t?.[jg];void 0!==o&&(v({[jg]:[o]}),f?.(t,e.x+Pg.left,e.y+Pg.top))},[v,f]),w=(0,Ag.useCallback)(e=>{if(!e)return void p?.(null);const t=e.data;t&&p?.(t,e.x+Pg.left,e.y+Pg.top)},[p]),S=(0,Ag.useCallback)(e=>{const t={opacity:i,r:r};return t.fill=s?ze(e,s,a):Gp,"hover"===h?b.isActive&&b.predicate(e)?(t.opacity=1,t.r=2.5*r,t.stroke="#333",t.strokeWidth=1.5):b.isActive&&(t.opacity=.6*i):g.isActive&&!g.predicate(e)&&(t.opacity=u),t},[i,r,s,h,a,b,g,u]);return(0,_g.jsxs)("div",{style:{position:"relative",width:n,height:n},children:[(0,_g.jsx)(dc,{ref:m,chartType:"scatter",data:e,size:[n,n],xAccessor:t,yAccessor:o,pointStyle:S,margin:Pg,showAxes:!1,enableHover:"hover"===h,...Nf({forceHoverBehavior:"hover"===h,forceClickBehavior:!!p,mobileInteraction:d,customHoverBehavior:k,customClickBehavior:w}),tooltipContent:"hover"===h?()=>null:void 0}),"brush"===h&&(0,_g.jsx)(Lg,{frameRef:m,cellSize:n,xField:t,yField:o,onBrush:x})]})}function Ig({data:e,field:t,label:o,cellSize:n,bins:r,colorBy:i,colorScale:s,brushSelectionName:a,hoverSelectionName:l,mode:c}){const h=Jf({name:a,clientId:"splom-diag-"+t,fields:[t]}),f=Jf({name:l,clientId:`splom-diag-${t}-hover`,fields:[jg]}),p="hover"===c?f:h,m=p.isActive,g=p.predicate,y=(0,Ag.useMemo)(()=>{const o="string"==typeof i?i:null,s=[],a=new Set;for(const n of e){const e=n[t];if(null==e||isNaN(e)||s.push(Number(e)),o){const e=n[o];null!=e&&a.add(e+"")}}if(0===s.length)return{bars:[],selectedBars:[],categoryBars:[],selectedCategoryBars:[],max:0,categories:[]};const[l,c]=u(s),h=(c-l)/r||1,f=Array.from(a),p=new Map(f.map((e,t)=>[e,t])),y=Array(r).fill(0),b=Array(r).fill(0),v=Array.from({length:r},()=>Array(f.length).fill(0)),x=Array.from({length:r},()=>Array(f.length).fill(0));for(const n of e){const e=n[t];if(null==e||isNaN(e))continue;const i=Math.min(Math.floor((e-l)/h),r-1);if(y[i]++,m&&!g(n)||b[i]++,o){const e=p.get(n[o]+"");void 0!==e&&(v[i][e]++,m&&!g(n)||x[i][e]++)}}const k=d(y,1),w=v.map((e,t)=>{let o=0;return e.map((e,i)=>{const s=e/k*(n-24),a={x:t/r*n,w:n/r-1,h:s,y0:o,category:f[i]};return o+=s,a})}),S=x.map((e,t)=>{let o=0;return e.map((e,i)=>{const s=e/k*(n-24),a={x:t/r*n,w:n/r-1,h:s,y0:o,category:f[i]};return o+=s,a})});return{bars:y.map((e,t)=>({x:t/r*n,w:n/r-1,h:e/k*(n-24),count:e})),selectedBars:b.map((e,t)=>({x:t/r*n,w:n/r-1,h:e/k*(n-24),count:e})),categoryBars:w,selectedCategoryBars:S,max:k,categories:f}},[e,t,r,n,m,g,i]);return(0,_g.jsxs)("svg",{width:n,height:n,style:{overflow:"hidden"},children:[(0,_g.jsx)("text",{x:n/2,y:14,textAnchor:"middle",fontSize:11,fontWeight:"bold",fill:"#333",children:o}),y.categories.length>0?y.categoryBars.map((e,t)=>e.map((e,o)=>(0,_g.jsx)("rect",{x:e.x,y:n-e.y0-e.h,width:Math.max(e.w,1),height:e.h,fill:s?s(e.category):Gp,opacity:m?.3:.6},`bg-${t}-${o}`))):y.bars.map((e,t)=>(0,_g.jsx)("rect",{x:e.x,y:n-e.h,width:Math.max(e.w,1),height:e.h,fill:Gp,opacity:m?.3:.6},"bg-"+t)),m&&(y.categories.length>0?y.selectedCategoryBars.map((e,t)=>e.map((e,o)=>(0,_g.jsx)("rect",{x:e.x,y:n-e.y0-e.h,width:Math.max(e.w,1),height:e.h,fill:s?s(e.category):Gp,opacity:.7},`sel-${t}-${o}`))):y.selectedBars.map((e,t)=>(0,_g.jsx)("rect",{x:e.x,y:n-e.h,width:Math.max(e.w,1),height:e.h,fill:Gp,opacity:.7},"sel-"+t)))]})}function $g({label:e,cellSize:t}){return(0,_g.jsx)("svg",{width:t,height:t,children:(0,_g.jsx)("text",{x:t/2,y:t/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:12,fontWeight:"bold",fill:"#333",children:e})})}function Ng(e){const{data:t,fields:o,fieldLabels:n={},colorBy:r,colorScheme:i,cellSize:s=150,cellGap:a=4,pointRadius:l=2,pointOpacity:c=.5,diagonal:u="histogram",histogramBins:d=20,brushMode:h="crossfilter",hoverMode:f=!0,unselectedOpacity:p=.1,showGrid:m=!1,tooltip:g,showLegend:y,idAccessor:b,width:v,className:x,onObservation:k,onClick:w,chartId:S}=e,A="splom",C="splom-hover",M=Kp(e.mobileInteraction,{mode:e.mode,width:v??o.length*s,mobileSemantics:e.mobileSemantics}),_=f?"hover":h?"brush":"hover",j=Zf(e=>e.clearSelection),[R,P]=(0,Ag.useState)(null),L=(0,Ag.useCallback)(()=>{j(C),P(null)},[j,C]),T=(0,Ag.useMemo)(()=>(t||[]).map((e,t)=>void 0!==e[jg]?e:{...e,[jg]:t}),[t]),I=Jp(T,r,i),$=(0,Ag.useCallback)((e,t,o,n)=>[40+e*(s+a)+(o??0),t*(s+a)+(n??0)],[40,s,a]),N=void 0!==y?y:!!r,D=(0,Ag.useMemo)(()=>{if(!N||!r)return null;const e="string"==typeof r?r:null;return e?Array.from(new Set(T.map(t=>t[e]).filter(e=>null!=e))).map(e=>({label:e+"",color:I?I(e+""):Gp})):null},[N,r,T,I]),E=(0,Ag.useMemo)(()=>({display:"grid",gridTemplateColumns:"40px "+o.map(()=>s+"px").join(" "),gridTemplateRows:o.map(()=>s+"px").join(" ")+" 40px",gap:a+"px",width:"fit-content"}),[o,s,a,40]);return(0,_g.jsxs)("div",{className:x,style:{position:"relative"},children:[D&&(0,_g.jsx)("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"},children:D.map(e=>(0,_g.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4},children:[(0,_g.jsx)("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",backgroundColor:e.color}}),(0,_g.jsx)("span",{style:{fontSize:11},children:e.label})]},e.label))}),(0,_g.jsxs)("div",{style:E,onMouseLeave:"hover"===_?L:void 0,children:[o.map((e,t)=>(0,_g.jsxs)(Sg.Fragment,{children:[(0,_g.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:11,fontWeight:"bold",color:"#333"},children:n[e]||e}),o.map((o,i)=>t===i?"label"===u?(0,_g.jsx)($g,{label:n[e]||e,cellSize:s},"diag-"+e):(0,_g.jsx)(Ig,{data:T,field:e,label:n[e]||e,cellSize:s,bins:d,colorBy:r,colorScale:I,brushSelectionName:A,hoverSelectionName:C,unselectedOpacity:p,mode:_},"diag-"+e):(0,_g.jsx)(Tg,{data:T,xField:o,yField:e,fieldLabels:n,cellSize:s,pointRadius:l,pointOpacity:c,colorBy:r,colorScale:I,brushSelectionName:A,hoverSelectionName:C,unselectedOpacity:p,showGrid:m,tooltip:g,mobileInteraction:M,mode:_,onPointHover:"hover"===_?(n,r,s)=>{if(n){if(P({datum:n,xField:o,yField:e,colIndex:i,rowIndex:t,px:r??0,py:s??0}),k){const[e,o]=$(i,t,r,s);k({type:"hover",datum:n,x:e,y:o,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:S})}}else P(null),k&&k({type:"hover-end",timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:S})}:void 0,onPointClick:w||k?(e,o,n)=>{if(!e)return;const[r,s]=$(i,t,o,n);w&&w(e,{x:r,y:s}),k&&k({type:"click",datum:e,x:r,y:s,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:S})}:void 0},`cell-${e}-${o}`))]},"row-"+e)),(0,_g.jsx)("div",{})," ",o.map(e=>(0,_g.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:"bold",color:"#333"},children:n[e]||e},"col-label-"+e))]}),R&&"hover"===_&&(()=>{const e=R.datum,t=n[R.xField]||R.xField,o=n[R.yField]||R.yField,i=r?"function"==typeof r?r(e):e[r]:null,l=b?"function"==typeof b?b(e):e[b]:"Row "+e[jg];return(0,_g.jsxs)("div",{style:{position:"absolute",left:40+R.colIndex*(s+a)+R.px,top:R.rowIndex*(s+a)+R.py-8,transform:"translate(-50%, -100%)",color:"#333",background:"rgba(255,255,255,0.95)",border:"1px solid #ddd",borderRadius:3,padding:"4px 8px",fontSize:11,lineHeight:1.4,whiteSpace:"nowrap",pointerEvents:"none",zIndex:10},children:[(0,_g.jsx)("div",{style:{fontWeight:"bold",marginBottom:2},children:l+""}),(0,_g.jsxs)("div",{children:[t,": ",null!=e[R.xField]?Number(e[R.xField]).toFixed(1):"–"]}),(0,_g.jsxs)("div",{children:[o,": ",null!=e[R.yField]?Number(e[R.yField]).toFixed(1):"–"]}),null!=i&&(0,_g.jsxs)("div",{style:{opacity:.8},children:["string"==typeof r?r:"group",": ",i+""]})]})})()]})}function Dg(e){const{brushMode:t="crossfilter",hoverMode:o=!0}=e,n={};return!o&&t&&(n.splom={resolution:t}),o&&(n["splom-hover"]={resolution:"union"}),(0,_g.jsx)(xp,{selections:n,children:(0,_g.jsx)(Ng,{...e})})}Dg.displayName="ScatterplotMatrix";var Eg=require("react"),Bg=require("d3-brush"),Fg=require("d3-selection"),Hg=require("react/jsx-runtime");function Og({width:e,height:t,margin:o,scales:n,brushDirection:r,extent:i,onBrush:s}){const a=(0,Eg.useRef)(null),l=(0,Eg.useRef)(null),c=(0,Eg.useRef)(!1),u=e+o.left+o.right,d=t+o.top+o.bottom;return(0,Eg.useEffect)(()=>{if(!a.current||!n)return;const o=(0,Fg.select)(a.current).select(".brush-group"),i="x"===r?(0,Bg.brushX)().extent([[0,0],[e,t]]):(0,Bg.brushY)().extent([[0,0],[e,t]]);return i.on("brush end",e=>{if(c.current)return;if(!e.sourceEvent)return;const t=e.selection;if(!t)return void s(null);const o=("x"===r?n.x:n.y).invert;if(!o)return;const i=[o(t[0]),o(t[1])];s(i)}),o.call(i),l.current=e=>{o.call(i.move,e)},o.select(".selection").attr("fill","steelblue").attr("fill-opacity",.2).attr("stroke","steelblue").attr("stroke-width",1),()=>{l.current=null,i.on("brush end",null)}},[n,e,t,r,s]),(0,Eg.useEffect)(()=>{if(!l.current||!n||!a.current)return;const e="x"===r?n.x:n.y;if(c.current=!0,i){const t=[e(i[0]),e(i[1])];l.current(t)}else l.current(null);c.current=!1},[i,n,r]),(0,Hg.jsx)("svg",{ref:a,width:u,height:d,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:(0,Hg.jsx)("g",{className:"brush-group",transform:`translate(${o.left},${o.top})`})})}function zg(e){const{data:t,width:o=600,height:n=400,margin:r,className:i,title:s,description:a,summary:l,xLabel:c,yLabel:u,xFormat:d,yFormat:h,xAccessor:f="x",yAccessor:p="y",lineBy:m,lineDataAccessor:g="coordinates",colorBy:y,colorScheme:b,curve:v="linear",lineWidth:x=2,fillArea:k=!1,areaOpacity:w=.3,showPoints:S=!1,pointRadius:A=3,enableHover:C=!0,showGrid:M=!1,showLegend:_,legendPosition:j,tooltip:R,minimap:P={},renderBefore:L=!1,onBrush:T,brushExtent:I,yExtent:$,frameProps:N={},loading:D,loadingContent:E,emptyContent:B}=e,F=Kh(D,o,n,E),O=F?null:Uh(t,o,n,B),z=(0,Eg.useMemo)(()=>H(t),[t]),[W,q]=(0,Eg.useState)(null),Y=I??W,G=(0,Eg.useCallback)(e=>{I||q(e),T?.(e)},[I,T]),V=(0,Eg.useRef)(null),[X,U]=(0,Eg.useState)(null);(0,Eg.useEffect)(()=>{let e=0,t=!1;const o=()=>{if(t)return;const n=V.current?.getScales?.();n?U(n):e=requestAnimationFrame(o)};return e=requestAnimationFrame(o),()=>{t=!0,e&&cancelAnimationFrame(e)}},[t]);const K=void 0!==z[0]?.[g],Z=(0,Eg.useMemo)(()=>{if(K)return z;if(m){const e=z.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]:z}]},[z,m,g,K]),Q=(0,Eg.useMemo)(()=>K||m?Z.flatMap(e=>{const t=e[g]||[];return m&&"string"==typeof m?t.map(t=>({...t,[m]:e[m]})):t}):z,[Z,g,K,m,z]),J=Jp(z,y,b),ee=Jm({lineWidth:x,colorBy:y,colorScale:J,fillArea:k,areaOpacity:w}),te=(0,Eg.useMemo)(()=>{if(P.lineStyle)return P.lineStyle},[P.lineStyle]),oe=Jm({lineWidth:1,colorBy:y,colorScale:J}),ne=te??oe,re=(0,Eg.useMemo)(()=>{if(S)return e=>{const t={r:A,fillOpacity:1};return t.fill=y?ze(e.parentLine||e,y,J):Gp,t}},[S,A,y,J]),{legend:ie,margin:se,legendPosition:ae}=nm({data:Z,colorBy:y,colorScale:J,showLegend:_,legendPosition:j,userMargin:r}),le=P.height||60,ce=(0,Eg.useMemo)(()=>({top:P.margin?.top??0,bottom:P.margin?.bottom??20,left:P.margin?.left??se.left,right:P.margin?.right??se.right}),[P.margin,se]),ue=P.brushDirection||"x",de=(0,Eg.useMemo)(()=>Fl([{label:c||$l(f),accessor:f,role:"x",format:d},{label:u||$l(p),accessor:p,role:"y",format:h}]),[f,p,c,u,d,h]),he=dm({componentName:"MinimapChart",data:t,accessors:{xAccessor:f,yAccessor:p}});if(he)return(0,Hg.jsx)(Oh,{componentName:"MinimapChart",message:he,width:o,height:n});const fe=k?"area":"line",pe={chartType:fe,data:Q,xAccessor:f,yAccessor:p,groupAccessor:m||void 0,curve:v,lineStyle:ee,...S&&{pointStyle:re},size:[o,n],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:se,showAxes:!0,xLabel:c,yLabel:u,xFormat:d,yFormat:h,enableHover:C,showGrid:M,...ie&&{legend:ie,legendPosition:ae},...s&&{title:s},...a&&{description:a},...l&&{summary:l},tooltipContent:!1===R?()=>null:Sa(R)||de,...Y&&{xExtent:Y},...$&&{yExtent:$},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...N},me={chartType:fe,data:Q,xAccessor:f,yAccessor:p,groupAccessor:m||void 0,curve:v,lineStyle:ne,size:[o,le+ce.top+ce.bottom],margin:ce,showAxes:P.showAxes??!1,background:P.background,enableHover:!1,...$&&{yExtent:$}},ge=(0,Hg.jsxs)("div",{style:{position:"relative",width:o,overflow:"hidden"},children:[(0,Hg.jsx)(dc,{ref:V,...me}),(0,Hg.jsx)(Og,{width:o-ce.left-ce.right,height:le,margin:ce,scales:X,brushDirection:ue,extent:Y,onBrush:G})]},"minimap"),ye=(0,Hg.jsx)("div",{style:{overflow:"hidden"},children:(0,Hg.jsx)(dc,{...pe})},"main");return F||O||(0,Hg.jsx)(Gh,{componentName:"MinimapChart",width:o,height:n,children:(0,Hg.jsxs)("div",{className:"minimap-chart"+(i?" "+i:""),children:[L?ge:ye,L?ye:ge]})})}zg.displayName="MinimapChart";var Wg=require("react"),qg={label:"Low / High",color:"#E9C46A",opacity:.08},Yg={label:"High / High",color:"#2A9D8F",opacity:.08},Gg={label:"Low / Low",color:"#E76F51",opacity:.08},Vg={label:"High / Low",color:"#86BBD8",opacity:.08};h();var Xg=require("react/jsx-runtime");function Ug(e,t){return{label:t?.label??e.label,color:t?.color??e.color,opacity:t?.opacity??e.opacity}}var Kg=(0,Wg.forwardRef)(function(e,t){const o=(0,Wg.useRef)(null);vm(t,{variant:"xy",frameRef:o});const n=sm(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:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:d="y",xCenter:h,yCenter:f,quadrants:p,centerlineStyle:m={},showQuadrantLabels:g=!0,quadrantLabelSize:y=12,colorBy:b,colorScheme:v,styleRules:x,sizeBy:k,sizeRange:w=[3,15],pointRadius:S=5,pointOpacity:A=.8,tooltip:C,pointIdAccessor:M,annotations:_,frameProps:j={},selection:R,linkedHover:P,onObservation:L,onClick:T,hoverHighlight:I,chartId:$,loading:N,loadingContent:D,emptyContent:E,legendInteraction:B,legendPosition:F,color:O,stroke:z,strokeWidth:W,opacity:q}=e,{width:Y,height:G,enableHover:V,showGrid:X,showLegend:U,title:K,description:Z,summary:Q,accessibleTable:J,xLabel:ee,yLabel:te}=n,oe=(0,Wg.useMemo)(()=>({topLeft:Ug(qg,p?.topLeft),topRight:Ug(Yg,p?.topRight),bottomLeft:Ug(Gg,p?.bottomLeft),bottomRight:Ug(Vg,p?.bottomRight)}),[p]),ne=(0,Wg.useMemo)(()=>H(r),[r]),re=ym({data:ne,rawData:r,colorBy:b,colorScheme:v,legendInteraction:B,legendPosition:F,selection:R,linkedHover:P,fallbackFields:"string"==typeof b?[b]:[],unwrapData:!1,onObservation:L,onClick:T,hoverHighlight:I,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"QuadrantChart",chartId:$,showLegend:U,userMargin:i,marginDefaults:n.marginDefaults,loading:N,loadingContent:D,emptyContent:E,width:Y,height:G});Zh("QuadrantChart",ne,"xAccessor",c),Zh("QuadrantChart",ne,"yAccessor",d);const ie=(0,Wg.useMemo)(()=>{if(!ne.length)return;const e="function"==typeof c?c:e=>+e[c],t="function"==typeof d?d:e=>+e[d];let o=1/0,n=-1/0,r=1/0,i=-1/0;for(const s of ne){const a=e(s),l=t(s);isFinite(a)&&(o>a&&(o=a),a>n&&(n=a)),isFinite(l)&&(r>l&&(r=l),l>i&&(i=l))}if(null!=h&&isFinite(h)&&(o>h&&(o=h),h>n&&(n=h)),null!=f&&isFinite(f)&&(r>f&&(r=f),f>i&&(i=f)),o===1/0)return;const s=.1*(n-o)||1,a=.1*(i-r)||1;return{xExtent:[o-s,n+s],yExtent:[r-a,i+a]}},[ne,c,d,h,f]),se=(0,Wg.useMemo)(()=>{if(!k||0===ne.length)return;const e=ne.map(e=>"function"==typeof k?k(e):e[k]).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0!==e.length?u(e):void 0},[ne,k]),ae=(0,Wg.useMemo)(()=>"function"==typeof c?c:e=>+e[c],[c]),le=(0,Wg.useMemo)(()=>"function"==typeof d?d:e=>+e[d],[d]),ce=(0,Wg.useMemo)(()=>e=>{const t=ae(e),o=le(e),n=null!=h?t>=h:void 0,r=null!=f?o>=f:void 0;return void 0===r||void 0===n?O||Gp:r&&n?oe.topRight.color:r&&!n?oe.topLeft.color:!r&&n?oe.bottomRight.color:oe.bottomLeft.color},[ae,le,h,f,oe,O]),ue=(0,Wg.useMemo)(()=>k?e=>Ye(e,k,w,se):void 0,[k,w,se]),de=(0,Wg.useMemo)(()=>Sm(c,d),[c,d]),he=$m({colorBy:b,colorScale:re.colorScale,color:O,pointRadius:S,fillOpacity:A,radiusFn:ue,fallbackFill:ce,stroke:z,strokeWidth:W,opacity:q,styleRules:x,ruleContext:de,effectiveSelectionHook:re.effectiveSelectionHook,resolvedSelection:re.resolvedSelection}),fe=(0,Wg.useMemo)(()=>{if(!ne.length)return;const e=new Set;"string"==typeof c&&e.add(c),"string"==typeof d&&e.add(d),"string"==typeof b&&e.add(b),"string"==typeof k&&e.add(k);const t=ne[0];for(const o of Object.keys(t))if(!o.startsWith("_")&&!e.has(o)&&"string"==typeof t[o])return o},[ne,c,d,b,k]),pe=(0,Wg.useMemo)(()=>Fl([...fe?[{label:fe,accessor:fe,role:"title"}]:[],{label:ee||$l(c),accessor:c,role:"x",format:a},{label:te||$l(d),accessor:d,role:"y",format:l},...b?[{label:$l(b),accessor:b,role:"color"}]:[],...k?[{label:$l(k),accessor:k,role:"size"}]:[]]),[fe,c,d,ee,te,b,k,a,l]),me=dm({componentName:"QuadrantChart",data:r,accessors:{xAccessor:c,yAccessor:d}}),ge=(0,Wg.useMemo)(()=>{const e={stroke:m.stroke||"#999",strokeWidth:m.strokeWidth??1,dashArray:m.strokeDasharray||[]};return[(t,o,n,r)=>{if(!n?.x||!n?.y)return;const i=r.width,s=r.height,a=null!=h?n.x(h):i/2,l=null!=f?n.y(f):s/2;if(null!=h&&!isFinite(a))return;if(null!=f&&!isFinite(l))return;const c=Math.max(0,Math.min(i,a)),u=Math.max(0,Math.min(s,l)),d=[{config:oe.topLeft,x:0,y:0,w:c,h:u},{config:oe.topRight,x:c,y:0,w:i-c,h:u},{config:oe.bottomLeft,x:0,y:u,w:c,h:s-u},{config:oe.bottomRight,x:c,y:u,w:i-c,h:s-u}];for(const e of d)e.w>0&&e.h>0&&(t.fillStyle=e.config.color,t.globalAlpha=e.config.opacity??.08,t.fillRect(e.x,e.y,e.w,e.h));t.globalAlpha=1,t.strokeStyle=e.stroke,t.lineWidth=e.strokeWidth,e.dashArray.length>0&&t.setLineDash(e.dashArray),t.beginPath(),t.moveTo(c,0),t.lineTo(c,s),t.stroke(),t.beginPath(),t.moveTo(0,u),t.lineTo(i,u),t.stroke(),t.setLineDash([])}]},[h,f,oe,m]),ye=(0,Wg.useMemo)(()=>g?[...ge,(e,t,o,n)=>{if(!o?.x||!o?.y)return;const r=n.width,i=n.height,s=null!=h?o.x(h):r/2,a=null!=f?o.y(f):i/2;(null==h||isFinite(s))&&(null==f||isFinite(a))&&(e.font=`600 ${y}px sans-serif`,e.globalAlpha=.5,e.fillStyle=oe.topLeft.color,e.textAlign="left",e.textBaseline="top",e.fillText(oe.topLeft.label,8,8),e.fillStyle=oe.topRight.color,e.textAlign="right",e.textBaseline="top",e.fillText(oe.topRight.label,r-8,8),e.fillStyle=oe.bottomLeft.color,e.textAlign="left",e.textBaseline="bottom",e.fillText(oe.bottomLeft.label,8,i-8),e.fillStyle=oe.bottomRight.color,e.textAlign="right",e.textBaseline="bottom",e.fillText(oe.bottomRight.label,r-8,i-8),e.globalAlpha=1)}]:ge,[ge,g,y,oe,h,f]),be=(0,Wg.useMemo)(()=>{const e=j.canvasPreRenderers||[];return[...ye,...e]},[ye,j.canvasPreRenderers]),ve=(0,Wg.useMemo)(()=>{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,n)=>{if(!o?.x||!o?.y)return null;const r=n.width,i=n.height,s=null!=h?o.x(h):r/2,a=null!=f?o.y(f):i/2;if(null!=h&&!isFinite(s))return null;if(null!=f&&!isFinite(a))return null;const l=Math.max(0,Math.min(r,s)),c=Math.max(0,Math.min(i,a));return(0,Xg.jsxs)(Xg.Fragment,{children:[[{config:oe.topLeft,x:0,y:0,w:l,h:c},{config:oe.topRight,x:l,y:0,w:r-l,h:c},{config:oe.bottomLeft,x:0,y:c,w:l,h:i-c},{config:oe.bottomRight,x:l,y:c,w:r-l,h:i-c}].map((e,t)=>e.w>0&&e.h>0?(0,Xg.jsx)("rect",{x:e.x,y:e.y,width:e.w,height:e.h,fill:e.config.color,opacity:e.config.opacity??.08},"qf-"+t):null),(0,Xg.jsx)("line",{x1:l,y1:0,x2:l,y2:i,stroke:e.stroke,strokeWidth:e.strokeWidth,strokeDasharray:e.dashArray}),(0,Xg.jsx)("line",{x1:0,y1:c,x2:r,y2:c,stroke:e.stroke,strokeWidth:e.strokeWidth,strokeDasharray:e.dashArray}),g&&(0,Xg.jsxs)(Xg.Fragment,{children:[(0,Xg.jsx)("text",{x:8,y:8+y,fill:oe.topLeft.color,fontWeight:600,fontSize:y,opacity:.5,children:oe.topLeft.label}),(0,Xg.jsx)("text",{x:r-8,y:8+y,fill:oe.topRight.color,fontWeight:600,fontSize:y,opacity:.5,textAnchor:"end",children:oe.topRight.label}),(0,Xg.jsx)("text",{x:8,y:i-8,fill:oe.bottomLeft.color,fontWeight:600,fontSize:y,opacity:.5,children:oe.bottomLeft.label}),(0,Xg.jsx)("text",{x:r-8,y:i-8,fill:oe.bottomRight.color,fontWeight:600,fontSize:y,opacity:.5,textAnchor:"end",children:oe.bottomRight.label})]})]})}]},[h,f,oe,m,g,y]);if(re.earlyReturn)return re.earlyReturn;const xe={chartType:"scatter",...null!=r&&{data:ne},xAccessor:c,yAccessor:d,colorAccessor:b||void 0,sizeAccessor:k||void 0,sizeRange:w,pointStyle:he,colorScheme:v,size:[Y,G],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:re.margin,showAxes:n.showAxes,xLabel:ee,yLabel:te,xFormat:a,yFormat:l,enableHover:V,showGrid:X,...ie&&{xExtent:ie.xExtent,yExtent:ie.yExtent},...re.legendBehaviorProps,...K&&{title:K},...Z&&{description:Z},...Q&&{summary:Q},...void 0!==J&&{accessibleTable:J},...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===C?()=>null:!0===C||void 0===C?pe:Sa(C)||pe,...Nf({linkedHover:P,selection:R,onObservation:L,onClick:T,hoverHighlight:I,mobileInteraction:re.mobileInteraction,customHoverBehavior:re.customHoverBehavior,customClickBehavior:re.customClickBehavior}),...M&&{pointIdAccessor:M},..._&&_.length>0&&{annotations:_},canvasPreRenderers:be,...re.crosshairProps,...j,...be.length>0&&{canvasPreRenderers:be},svgPreRenderers:ve};return me?(0,Xg.jsx)(Oh,{componentName:"QuadrantChart",message:me,width:Y,height:G}):(0,Xg.jsx)(Gh,{componentName:"QuadrantChart",width:Y,height:G,children:(0,Xg.jsx)(dc,{ref:o,...xe})})});Kg.displayName="QuadrantChart";var Zg=c(require("react")),Qg=require("react"),Jg=require("react/jsx-runtime"),ey="__ma_unitized",ty="__ma_series";function oy(e,t){const o=t[1]-t[0];return 0===o?.5:(e-t[0])/o}function ny(e,t){return t[0]+e*(t[1]-t[0])}var ry=(0,Qg.forwardRef)(function(e,t){const o=(0,Qg.useRef)(null),n=(0,Qg.useRef)([]),r=(0,Qg.useRef)(e.series);r.current=e.series,(0,Qg.useImperativeHandle)(t,()=>{const e=()=>(r.current??[]).filter(e=>null!=e&&"object"==typeof e);return{push:t=>{if(!o.current)return;const r=e(),i=t;for(let e=0;r.length>e&&2>e;e++){const t=r[e],s=t.extent||n.current[e];if(!s)continue;const a=("function"==typeof t.yAccessor?t.yAccessor:e=>e[t.yAccessor])(i);null!=a&&isFinite(a)&&o.current.push({...i,[ey]:oy(a,s),[ty]:t.label||"Series "+(e+1)})}},pushMany:t=>{if(!o.current)return;const r=e(),i=[];for(const e of t)for(let t=0;r.length>t&&2>t;t++){const o=r[t],s=o.extent||n.current[t];if(!s)continue;const a=("function"==typeof o.yAccessor?o.yAccessor:e=>e[o.yAccessor])(e);null!=a&&isFinite(a)&&i.push({...e,[ey]:oy(a,s),[ty]: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=sm(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,accessibleTable:e.accessibleTable,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:800,height:400}),{data:s,margin:a,className:l,xFormat:c,xAccessor:u="x",series:d,colorScheme:h,curve:f="monotoneX",lineWidth:p=2,tooltip:m,annotations:g,frameProps:y={},selection:b,linkedHover:v,onObservation:x,onClick:k,hoverHighlight:w,chartId:S,loading:A,loadingContent:C,emptyContent:M,legendInteraction:_,legendPosition:j,stroke:R,strokeWidth:P,opacity:L}=e,{width:T,height:I,enableHover:$,showGrid:N,showLegend:D=!0,title:E,description:B,summary:F,accessibleTable:O,xLabel:z}=i,W=(0,Qg.useMemo)(()=>H(s),[s]),q=(0,Qg.useMemo)(()=>H(d),[d]),Y=q,G=2===q.length;"undefined"==typeof process||"production"===process.env?.NODE_ENV||G||console.warn(`[MultiAxisLineChart] Expected exactly 2 series for dual-axis mode, got ${q.length}. Rendering as a standard multi-line chart.`);const V=Kh(A,T,I,C),X=V?null:Uh(s,T,I,M),U=Zp(),K=(0,Qg.useMemo)(()=>{let e;if(Array.isArray(h))e=h;else if(U&&U.length>0)e=U;else{const t=Ee[h];e=Array.isArray(t)?t:Be}return Y.map((t,o)=>t.color||e[o%e.length])},[Y,h,U]),Z=(0,Qg.useMemo)(()=>q.map((e,t)=>e.label||"Series "+(t+1)),[q]),{unitizedData:Q,extents:J}=(0,Qg.useMemo)(()=>{if(0===W.length){const e=q.map(e=>e.extent||null).filter(Boolean);return e.length===q.length&&(n.current=e),{unitizedData:[],extents:e.length===q.length?e:[]}}const e=q.map(e=>e.extent||function(e,t){let o=1/0,n=-1/0;const r="function"==typeof t?t:e=>e[t];for(const t of e){const e=r(t);null!=e&&isFinite(e)&&(o>e&&(o=e),e>n&&(n=e))}if(!isFinite(o)||!isFinite(n))return[0,1];if(o===n){const e=0===o?1:.1*Math.abs(o);return[o-e,n+e]}return[o,n]}(W,e.yAccessor));if(n.current=e,!G){const t=[];for(const e of W)for(let o=0;q.length>o;o++){const n=q[o],r=("function"==typeof n.yAccessor?n.yAccessor:e=>e[n.yAccessor])(e);null!=r&&t.push({...e,[ey]:r,[ty]:Z[o]})}return{unitizedData:t,extents:e}}const t=[];for(const o of W)for(let n=0;2>n;n++){const r=q[n],i=("function"==typeof r.yAccessor?r.yAccessor:e=>e[r.yAccessor])(o);null!=i&&t.push({...o,[ey]:oy(i,e[n]),[ty]:Z[n]})}return{unitizedData:t,extents:e}},[W,q,G,Z]),ee=(0,Qg.useMemo)(()=>{if(G&&J.length>=2)return[{orient:"left",label:Z[0],tickFormat:q[0].format||(e=>{const t=ny(e,J[0]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"right",label:Z[1],tickFormat:q[1].format||(e=>{const t=ny(e,J[1]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"bottom"}]},[G,J,q,Z]),te=ym({data:(0,Qg.useMemo)(()=>Q.length>0?Q:Z.map(e=>({[ty]:e})),[Q,Z]),rawData:s,colorBy:ty,colorScheme:K,legendInteraction:_,legendPosition:j,selection:b,linkedHover:v,fallbackFields:[ty],unwrapData:!1,onObservation:x,onClick:k,hoverHighlight:w,mobileInteraction:i.mobileInteraction,mobileSemantics:i.mobileSemantics,chartType:"MultiAxisLineChart",chartId:S,showLegend:D,userMargin:a,marginDefaults:G?{...i.marginDefaults,left:70,right:70}:i.marginDefaults,loading:A,loadingContent:C,emptyContent:M,width:T,height:I}),oe=(0,Qg.useMemo)(()=>{const e=new Map;return Z.forEach((t,o)=>e.set(t,K[o])),e},[Z,K]),ne=Jm({lineWidth:p,resolveStroke:(0,Qg.useCallback)(e=>oe.get(e[ty])||K[0],[oe,K]),stroke:R,strokeWidth:P,opacity:L,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection}),re=(0,Qg.useMemo)(()=>{if(!1===m)return()=>null;return Sa(m)||(e=>{const t=e.data||e,o=t[ty],n=Z.indexOf(o),r=t[ey],i=G&&n>=0&&J[n]?ny(r,J[n]):r,s=n>=0&&q[n]?.format?q[n].format:e=>Number.isInteger(e)?e+"":e.toFixed(2),a="function"==typeof u?u(t):t[u];return Zg.createElement("div",{style:{padding:"6px 10px",fontFamily:"var(--semiotic-font-family, sans-serif)",fontSize:"var(--semiotic-tooltip-font-size, 13px)"}},Zg.createElement("div",{style:{fontWeight:600,marginBottom:4,color:K[n]||"inherit"}},o),Zg.createElement("div",null,`${"string"==typeof u?u:"x"}: ${a}`),Zg.createElement("div",null,`${o}: ${s(i)}`))})},[m,Z,K,J,G,q,u]);if(te.earlyReturn)return te.earlyReturn;const ie=dm({componentName:"MultiAxisLineChart",data:s,accessors:{xAccessor:u}}),se=G?[0,1]:void 0,ae={chartType:"line",...null!=s&&{data:Q},xAccessor:u,yAccessor:ey,groupAccessor:ty,lineStyle:ne,colorScheme:K,size:[T,I],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:te.margin,showAxes:i.showAxes,...ee&&{axes:ee},xLabel:z,...G?{}:{yLabel:Z[0]},xFormat:c,...G&&se&&{yExtent:se},enableHover:$,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:N,curve:f,...te.legendBehaviorProps,...E&&{title:E},...B&&{description:B},...F&&{summary:F},...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:re,...g&&{annotations:g},...Nf({linkedHover:v,selection:b,onObservation:x,onClick:k,hoverHighlight:w,mobileInteraction:te.mobileInteraction,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior}),...te.crosshairProps,...y};return V||X||(ie?(0,Jg.jsx)(Oh,{componentName:"MultiAxisLineChart",message:ie,width:T,height:I}):(0,Jg.jsx)(Gh,{componentName:"MultiAxisLineChart",width:T,height:I,children:(0,Jg.jsx)(dc,{ref:o,...ae})}))});ry.displayName="MultiAxisLineChart";var iy=require("react");function sy(e){if(null==e)return;if("number"==typeof e)return{top:e,right:e,bottom:e,left:e};const t={};return"number"==typeof e.top&&(t.top=e.top),"number"==typeof e.right&&(t.right=e.right),"number"==typeof e.bottom&&(t.bottom=e.bottom),"number"==typeof e.left&&(t.left=e.left),t}var ay=require("react/jsx-runtime"),ly=(0,iy.forwardRef)(function(e,t){const o=(0,iy.useRef)(null);vm(t,{variant:"xy",frameRef:o});const n=sm(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:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",highAccessor:u="high",lowAccessor:d="low",openAccessor:h,closeAccessor:f,candlestickStyle:p,tooltip:m,annotations:g,xExtent:y,yExtent:b,frameProps:v={},selection:x,linkedHover:k,onObservation:w,onClick:S,chartId:A,loading:C,loadingContent:M,emptyContent:_}=e,{width:j,height:R,enableHover:P,showGrid:L,title:T,description:I,summary:$,accessibleTable:N,xLabel:D,yLabel:E}=n,B=Kh(C,j,R,M),F=B?null:Uh(r,j,R,_),O=(0,iy.useMemo)(()=>H(r),[r]),z=null==h||null==f;Zh("CandlestickChart",O,"xAccessor",c),Zh("CandlestickChart",O,"highAccessor",u),Zh("CandlestickChart",O,"lowAccessor",d),z||(Zh("CandlestickChart",O,"openAccessor",h),Zh("CandlestickChart",O,"closeAccessor",f));const{customHoverBehavior:W,customClickBehavior:q,crosshairSourceId:Y}=tm({selection:x,linkedHover:k,onObservation:w,onClick:S,chartType:"CandlestickChart",chartId:A,mobileInteraction:n.mobileInteraction}),G=om(k,Y),V=(0,iy.useMemo)(()=>{const t=n.marginDefaults,o="sparkline"===e.mode?{...t,top:0,bottom:0}:t;return null==i?o:{...o,...sy(i)}},[i,n.marginDefaults,e.mode]),X=(0,iy.useMemo)(()=>{const e=[{label:D||$l(c),accessor:c,role:"x",format:a}];return z?(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:f,format:l})),Fl(e)},[c,D,a,l,u,d,h,f,z]),U=dm({componentName:"CandlestickChart",data:r,accessors:{xAccessor:c,highAccessor:u,lowAccessor:d,...!z&&{openAccessor:h,closeAccessor:f}}}),K={chartType:"candlestick",...null!=r&&{data:O},xAccessor:c,yAccessor:u,highAccessor:u,lowAccessor:d,...!z&&{openAccessor:h,closeAccessor:f},...p&&{candlestickStyle:p},scalePadding:Math.max(2,Math.min(12,Math.round(j/40))),extentPadding:j>200?.1:.02,size:[j,R],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:V,showAxes:n.showAxes,xLabel:D,yLabel:E,xFormat:a,yFormat:l,enableHover:P,showGrid:L,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...$f({title:T,description:I,summary:$,accessibleTable:N,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Df({tooltip:m,defaultTooltipContent:X}),...Nf({linkedHover:k,selection:x,onObservation:w,onClick:S,mobileInteraction:n.mobileInteraction,customHoverBehavior:W,customClickBehavior:q}),...g&&g.length>0&&{annotations:g},...y&&{xExtent:y},...b&&{yExtent:b},...G,...v};return B||F||(U?(0,ay.jsx)(Oh,{componentName:"CandlestickChart",message:U,width:j,height:R}):(0,ay.jsx)(Gh,{componentName:"CandlestickChart",width:j,height:R,children:(0,ay.jsx)(dc,{ref:o,...K})}))});ly.displayName="CandlestickChart";var cy=require("react"),uy=require("react");function dy(e){const t=(0,uy.useRef)(null);return vm(e.imperativeRef,{variant:e.imperativeVariant,frameRef:t}),{frameRef:t,resolved:sm(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}),normalizedMargin:(0,uy.useMemo)(()=>sy(e.margin),[e.margin])}}function hy(e){const t=dy(e),{resolved:o,normalizedMargin:n}=t,r=ym({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:n,marginDefaults:o.marginDefaults,loading:e.loading,loadingContent:e.loadingContent,emptyContent:e.emptyContent,width:o.width,height:o.height});return{...t,safeData:r.data,setup:r,earlyReturn:r.earlyReturn}}var fy=require("react/jsx-runtime"),py=(0,cy.forwardRef)(function(e,t){const{data:o,layout:n,layoutConfig:r,onLayoutError:i,xExtent:s,yExtent:a,showAxes:l=!1,margin:c,className:u,annotations:d,onObservation:h,onClick:f,selection:p,linkedHover:m,chartId:g,loading:y,loadingContent:b,emptyContent:v,colorBy:x,colorScheme:k,frameProps:w={}}=e,{frameRef:S,resolved:A,safeData:C,setup:M,earlyReturn:_}=hy({imperativeRef:t,imperativeVariant:"xy",chartTypeLabel:"XYCustomChart",unwrapData:!1,data:o,colorBy:x,colorScheme:k,selection:p,linkedHover:m,onObservation:h,onClick:f,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,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,mode:e.mode,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules,xLabel:e.xLabel,yLabel:e.yLabel}),j=M.effectiveSelectionHook,R=(0,cy.useMemo)(()=>j?.isActive?{isActive:!0,predicate:j.predicate}:null,[j?.isActive,j?.predicate]);if(_)return _;const{width:P,height:L,enableHover:T,showGrid:I,title:$,description:N,summary:D,accessibleTable:E,xLabel:B,yLabel:F}=A,H={chartType:"custom",...null!=o&&{data:C},customLayout:n,layoutConfig:r,onLayoutError:i,...R&&{layoutSelection:R},xExtent:s,yExtent:a,colorAccessor:x,colorScheme:k,size:[P,L],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:M.margin,showAxes:l,xLabel:B,yLabel:F,enableHover:T,showGrid:I,...M.legendBehaviorProps,...$f({title:$,description:N,summary:D,accessibleTable:E,className:u,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...null!=e.tooltip&&{tooltipContent:e.tooltip},...Nf({linkedHover:m,selection:p,onObservation:h,onClick:f,hoverHighlight:!1,mobileInteraction:M.mobileInteraction,customHoverBehavior:M.customHoverBehavior,customClickBehavior:M.customClickBehavior}),...d&&d.length>0&&{annotations:d},...M.crosshairProps,...w};return(0,fy.jsx)(Gh,{componentName:"XYCustomChart",width:P,height:L,children:(0,fy.jsx)(dc,{ref:S,...H})})});py.displayName="XYCustomChart";var my=require("react"),gy=require("react/jsx-runtime"),yy=(0,my.forwardRef)(function(e,t){const{nodes:o,edges:n,layout:r,layoutConfig:i,onLayoutError:s,nodeIDAccessor:a="id",sourceAccessor:l="source",targetAccessor:c="target",margin:u,className:d,colorBy:h,colorScheme:f,selection:p,linkedHover:m,onObservation:g,onClick:y,chartId:b,annotations:v,autoPlaceAnnotations:x,frameProps:k={}}=e,{frameRef:w,resolved:S,normalizedMargin:A}=dy({imperativeRef:t,imperativeVariant:"network",margin:u,width:e.width,height:e.height,enableHover:e.enableHover,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,mode:e.mode,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),C=(0,my.useMemo)(()=>H(o),[o]),M=(0,my.useMemo)(()=>H(n),[n]),_=(0,my.useMemo)(()=>void 0===o&&void 0===n?void 0:[...C,...M],[n,o,M,C]),j=Kp(e.mobileInteraction,{mode:e.mode,width:S.width,mobileSemantics:e.mobileSemantics}),{customHoverBehavior:R,customClickBehavior:P,activeSelectionHook:L}=tm({selection:p,linkedHover:m,fallbackFields:"string"==typeof h?[h]:[],onObservation:g,onClick:y,chartType:"NetworkCustomChart",chartId:b,colorByField:"string"==typeof h?h:void 0,mobileInteraction:j}),T=(0,my.useMemo)(()=>L?.isActive?{isActive:!0,predicate:L.predicate}:null,[L?.isActive,L?.predicate]),{width:I,height:$,enableHover:N,title:D,description:E,summary:B,accessibleTable:F}=S,O=Kh(e.loading,I,$,e.loadingContent),z=O?null:Uh(_,I,$,e.emptyContent);if(O||z)return O||z;const W={chartType:"force",...null!=o&&{nodes:C},...null!=n&&{edges:M},customNetworkLayout:r,layoutConfig:i,onLayoutError:s,nodeIDAccessor:a,sourceAccessor:l,targetAccessor:c,colorBy:h,colorScheme:f,size:[I,$],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:A,enableHover:N,...$f({title:D,description:E,summary:B,accessibleTable:F,className:d,animate:e.animate,autoPlaceAnnotations:x}),...Nf({linkedHover:m,selection:p,onObservation:g,onClick:y,mobileInteraction:j,customHoverBehavior:R,customClickBehavior:P,linkedHoverInClickPredicate:!1}),layoutSelection:T,...null!=v&&{annotations:v},...k};return(0,gy.jsx)(Gh,{componentName:"NetworkCustomChart",width:I,height:$,children:(0,gy.jsx)(If,{ref:w,...W})})});yy.displayName="NetworkCustomChart";var by=require("react"),vy=require("react/jsx-runtime"),xy=(0,by.forwardRef)(function(e,t){const{data:o,layout:n,layoutConfig:r,onLayoutError:i,categoryAccessor:s="category",valueAccessor:a="value",oExtent:l,rExtent:c,projection:u="vertical",margin:d,className:h,colorBy:f,colorScheme:p,showAxes:m=!1,annotations:g,onObservation:y,onClick:b,selection:v,linkedHover:x,chartId:k,loading:w,loadingContent:S,emptyContent:A,frameProps:C={}}=e,{frameRef:M,resolved:_,safeData:j,setup:R,earlyReturn:P}=hy({imperativeRef:t,imperativeVariant:"xy",chartTypeLabel:"OrdinalCustomChart",unwrapData:!0,data:o,colorBy:f,colorScheme:p,selection:v,linkedHover:x,onObservation:y,onClick:b,chartId:k,loading:w,loadingContent:S,emptyContent:A,margin:d,width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,mode:e.mode,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),L=R.effectiveSelectionHook,T=(0,by.useMemo)(()=>L?.isActive?{isActive:!0,predicate:L.predicate}:null,[L?.isActive,L?.predicate]);if(P)return P;const{width:I,height:$,enableHover:N,showGrid:D,title:E,description:B,summary:F,accessibleTable:H}=_,O={chartType:"custom",...null!=o&&{data:j},customLayout:n,layoutConfig:r,onLayoutError:i,...T&&{layoutSelection:T},oAccessor:s,rAccessor:a,oExtent:l,rExtent:c,projection:u,colorAccessor:f,colorScheme:p,size:[I,$],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:R.margin,enableHover:N,showAxes:m,showGrid:D,annotations:g,...$f({title:E,description:B,summary:F,accessibleTable:H,className:h,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Nf({linkedHover:x,selection:v,onObservation:y,onClick:b,hoverHighlight:!1,mobileInteraction:R.mobileInteraction,customHoverBehavior:R.customHoverBehavior,customClickBehavior:R.customClickBehavior}),...C};return(0,vy.jsx)(Gh,{componentName:"OrdinalCustomChart",width:I,height:$,children:(0,vy.jsx)(Tu,{ref:M,...O})})});xy.displayName="OrdinalCustomChart";var ky=require("react"),wy=require("react");function Sy({ref:e,frameRef:t,setup:o}){return(0,wy.useImperativeHandle)(e,()=>({push:e=>t.current?.push(e),pushMany:e=>t.current?.pushMany(e),remove:e=>t.current?.remove(e)??[],update:(e,o)=>t.current?.update(e,o)??[],clear:()=>t.current?.clear(),getData:()=>t.current?.getData()??[],getScales:()=>t.current?.getScales()??null}),[t]),{effectiveLegendProps:o.legendBehaviorProps,effectiveMargin:o.margin}}var Ay=require("react");function Cy(e){const{colorBy:t,colorScale:o,color:n,themeCategorical:r,colorScheme:i,categoryIndexMap:s,userPieceStyle:a,stroke:l,strokeWidth:c,opacity:u,effectiveSelectionHook:d,resolvedSelection:h,cycleByCategory:f=!1,baseStyleExtras:p,linkStrokeToFill:m=!1,styleRules:g,resolveRuleValue:y}=e,b=(0,Ay.useMemo)(()=>(e,a)=>{const l="function"==typeof p?p(e,a):p,c=l?{...l}:{};if(void 0===c.fill)if(t){if(!o)return c;c.fill=ze(e,t,o)}else c.fill=Qp(n,r,i,f?a:void 0,s);if(g&&g.length>0){const t=jm(e,g,{value:y?y(e):void 0,category:a});Object.assign(c,t)}return m&&void 0===c.stroke&&void 0!==c.fill&&(c.stroke=c.fill),c},[t,o,n,r,i,s,f,p,m,g,y]),v=(0,Ay.useMemo)(()=>km(a?"function"==typeof a?(e,t)=>({...b(e,t),...a(e,t)||{}}):(e,t)=>({...b(e,t),...a}):b,{stroke:l,strokeWidth:c,opacity:u}),[b,a,l,c,u]);return(0,Ay.useMemo)(()=>Ap(v,d??null,h),[v,d,h])}var My=require("react/jsx-runtime"),_y=(0,ky.forwardRef)(function(e,t){const o=sm(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=(0,ky.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="vertical",valueFormat:u,colorBy:d,colorScheme:h,sort:f=!1,barPadding:p=40,roundedTop:m,gradientFill:g=!1,styleRules:y,baselinePadding:b=!1,tooltip:v,annotations:x,regression:k,valueExtent:w,frameProps:S={},selection:A,linkedHover:C,onObservation:M,onClick:_,hoverHighlight:j,chartId:R,loading:P,loadingContent:L,emptyContent:T,legendInteraction:I,legendPosition:$,color:N,stroke:D,strokeWidth:E,opacity:B,showCategoryTicks:F,categoryFormat:O,dataIdAccessor:z}=e,{width:W,height:q,enableHover:Y,showGrid:G,showLegend:V,title:X,description:U,summary:K,accessibleTable:Z,categoryLabel:Q,valueLabel:J}=o,ee=(0,ky.useMemo)(()=>H(r),[r]),te=ym({data:ee,rawData:r,colorBy:d,colorScheme:h,legendInteraction:I,legendPosition:$,selection:A,linkedHover:C,fallbackFields:d?["string"==typeof d?d:""]:[],unwrapData:!0,onObservation:M,onClick:_,hoverHighlight:j,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"BarChart",chartId:R,showLegend:V,userMargin:i,marginDefaults:o.marginDefaults,loading:P,loadingContent:L,emptyContent:T,width:W,height:q}),{effectiveLegendProps:oe,effectiveMargin:ne}=Sy({ref:t,frameRef:n,setup:te});Zh("BarChart",ee,"categoryAccessor",a),Zh("BarChart",ee,"valueAccessor",l);const re=em(ee,f,l),ie=Zp(),se=(0,ky.useMemo)(()=>new Map,[]),ae=(0,ky.useMemo)(()=>wm(l),[l]),le=Cy({colorBy:d,colorScale:te.colorScale,color:N,themeCategorical:ie,colorScheme:h,categoryIndexMap:se,userPieceStyle:S?.pieceStyle,stroke:D,strokeWidth:E,opacity:B,styleRules:y,resolveRuleValue:ae,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection}),ce=(0,ky.useMemo)(()=>Hl({categoryAccessor:a,valueAccessor:l,groupAccessor:d&&d!==a?d:void 0,groupLabel:"string"==typeof d?d:"group",valueFormat:u}),[a,l,d,u]);if(te.earlyReturn)return te.earlyReturn;const ue=dm({componentName:"BarChart",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(ue)return(0,My.jsx)(Oh,{componentName:"BarChart",message:ue,width:W,height:q});const de=Em(k),he=de?[de,...x||[]]:x,fe={chartType:"bar",...null!=r&&{data:re},oAccessor:a,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",pieceStyle:le,size:[W,q],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ne,barPadding:p,...null!=m&&{roundedTop:m},...g&&{gradientFill:!0===g?{topOpacity:.8,bottomOpacity:.05}:g},...z&&{dataIdAccessor:z},baselinePadding:b,enableHover:Y,showAxes:o.showAxes,oLabel:Q,rLabel:J,rFormat:u,...O&&{oFormat:O},showGrid:G,showCategoryTicks:F,oSort:f,...oe,...$f({title:X,description:U,summary:K,accessibleTable:Z,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Df({tooltip:v,defaultTooltipContent:ce}),...Nf({linkedHover:C,selection:A,onObservation:M,onClick:_,hoverHighlight:j,mobileInteraction:te.mobileInteraction,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior}),...he&&he.length>0&&{annotations:he},...w&&{rExtent:w},...Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e))};return(0,My.jsx)(Gh,{componentName:"BarChart",width:W,height:q,children:(0,My.jsx)(Tu,{ref:n,...fe})})});_y.displayName="BarChart";var jy=require("react"),Ry=require("react/jsx-runtime"),Py=(0,jy.forwardRef)(function(e,t){const o=sm(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=(0,jy.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="category",stackBy:l,valueAccessor:c="value",orientation:u="vertical",valueFormat:d,colorBy:h,colorScheme:f,normalize:p=!1,sort:m=!1,barPadding:g=40,roundedTop:y,styleRules:b,baselinePadding:v=!1,tooltip:x,annotations:k,valueExtent:w,frameProps:S={},selection:A,linkedHover:C,onObservation:M,onClick:_,hoverHighlight:j,chartId:R,loading:P,loadingContent:L,emptyContent:T,legendInteraction:I,legendPosition:$,color:N,stroke:D,strokeWidth:E,opacity:B,categoryFormat:F}=e,{width:O,height:z,enableHover:W,showGrid:q,showLegend:Y,title:G,description:V,summary:X,accessibleTable:U,categoryLabel:K,valueLabel:Z}=o,Q=(0,jy.useMemo)(()=>H(r),[r]),J=h||l,ee=ym({data:Q,rawData:r,colorBy:J,colorScheme:f,legendInteraction:I,legendPosition:$,selection:A,linkedHover:C,fallbackFields:J?["string"==typeof J?J:""]:[],unwrapData:!0,onObservation:M,onClick:_,hoverHighlight:j,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"StackedBarChart",chartId:R,showLegend:Y,userMargin:i,marginDefaults:o.marginDefaults,loading:P,loadingContent:L,emptyContent:T,width:O,height:z}),te=Zp(),oe=(0,jy.useMemo)(()=>new Map,[]),ne=(0,jy.useMemo)(()=>wm(c),[c]),re=Cy({colorBy:J,colorScale:ee.colorScale,color:N,themeCategorical:te,colorScheme:f,categoryIndexMap:oe,userPieceStyle:S?.pieceStyle,stroke:D,strokeWidth:E,opacity:B,styleRules:b,resolveRuleValue:ne,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection}),ie=(0,jy.useMemo)(()=>Hl({categoryAccessor:l,valueAccessor:c,groupAccessor:a,valueFormat:d}),[l,a,c,d]),se=dm({componentName:"StackedBarChart",data:r,accessors:{categoryAccessor:a,valueAccessor:c},requiredProps:{stackBy:l}}),{effectiveLegendProps:ae,effectiveMargin:le}=Sy({ref:t,frameRef:n,setup:ee});if(ee.earlyReturn)return ee.earlyReturn;const ce={chartType:"bar",...null!=r&&{data:Q},oAccessor:a,rAccessor:c,stackBy:l,normalize:p,oSort:m,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:re,size:[O,z],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:le,barPadding:g,...null!=y&&{roundedTop:y},baselinePadding:v,enableHover:W,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:K,rLabel:Z,rFormat:d,...F&&{oFormat:F},showGrid:q,...ae,...$f({title:G,description:V,summary:X,accessibleTable:U,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Df({tooltip:x,defaultTooltipContent:ie}),...Nf({linkedHover:C,selection:A,onObservation:M,onClick:_,hoverHighlight:j,mobileInteraction:ee.mobileInteraction,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior}),...k&&k.length>0&&{annotations:k},...w&&{rExtent:w},...Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e))};return se?(0,Ry.jsx)(Oh,{componentName:"StackedBarChart",message:se,width:O,height:z}):(0,Ry.jsx)(Gh,{componentName:"StackedBarChart",width:O,height:z,children:(0,Ry.jsx)(Tu,{ref:n,...ce})})});Py.displayName="StackedBarChart";var Ly=c(require("react")),Ty=require("react"),Iy=require("react"),$y=require("react"),Ny={RdBu:Pe,PiYG:Le,PRGn:Te,BrBG:Ie,RdYlBu:$e,RdYlGn:Ne,Spectral:De},Dy="__likert_neutral_neg",Ey="__likert_neutral_pos";function By(e,t){if("function"==typeof e)return e;const o=e||t;return e=>e[o]}function Fy(e,t,o,n,r,i){const s=new Map,a=new Set(t);for(const l of e){const e=o(l);s.has(e)||s.set(e,new Map);const c=s.get(e);if(n){const e=n(l);if(null==e||!Number.isFinite(e))continue;if(!Number.isInteger(e)){"production"!==process.env.NODE_ENV&&console.warn("[LikertChart] Ignoring non-integer Likert score:",e);continue}const o=e-1;if(0>o||o>=t.length)continue;const r=t[o];c.set(r,(c.get(r)||0)+1)}else if(r&&i){const e=r(l),t=i(l);if(!a.has(e))continue;c.set(e,(c.get(e)||0)+(Number.isFinite(t)?t:0))}}const l=[];for(const[e,o]of s){let n=0;for(const e of t)n+=o.get(e)||0;if(0!==n)for(let r=0;t.length>r;r++){const i=t[r],s=o.get(i)||0;l.push({__likertCategory:e,__likertLevel:i,__likertLevelLabel:i,__likertCount:s,__likertPct:s/n*100,__likertLevelIndex:r})}}return l}function Hy(e,t){const o=t.length,n=o%2!=0,r=Math.floor(o/2),i=[];for(const t of e){const e=t.__likertLevelIndex;if(n&&e===r){const e=t.__likertPct/2;i.push({...t,__likertLevel:Dy,__likertPct:-e}),i.push({...t,__likertLevel:Ey,__likertPct:e})}else i.push(r>e?{...t,__likertPct:-t.__likertPct}:t)}return i}function Oy(e,t){const o=t.length,n=o%2!=0,r=Math.floor(o/2),i=new Map;for(const t of e){const e=i.get(t.__likertCategory)||[];e.push(t),i.set(t.__likertCategory,e)}const s=[];for(const[,e]of i){const t=new Map;let i,a;for(const o of e)o.__likertLevel===Dy?i=o:o.__likertLevel===Ey?a=o:t.set(o.__likertLevelIndex,o);n&&i&&s.push(i);for(let e=r-1;e>=0;e--){const o=t.get(e);o&&s.push(o)}n&&a&&s.push(a);for(let e=n?r+1:r;o>e;e++){const o=t.get(e);o&&s.push(o)}}return s}var zy=["Very Low","Low","Neutral","High","Very High"],Wy=require("react/jsx-runtime"),qy=new Map,Yy=(0,Ty.forwardRef)(function(e,t){const o=sm(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=(0,Ty.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="question",valueAccessor:l,levelAccessor:c,countAccessor:u="count",levels:d=zy,orientation:h="horizontal",colorScheme:f,barPadding:p=20,tooltip:m,annotations:g,valueExtent:y,frameProps:b={},selection:v,linkedHover:x,onObservation:k,onClick:w,hoverHighlight:S,chartId:A,valueFormat:C,loading:M,loadingContent:_,emptyContent:j,legendInteraction:R,legendPosition:P,categoryFormat:L,stroke:T,strokeWidth:I,opacity:$}=e,{width:N,height:D,enableHover:E,showGrid:B,showLegend:F,title:H,description:O,summary:z,accessibleTable:W,categoryLabel:q,valueLabel:Y}=o,G="horizontal"===h,V=void 0===r,X=!c,U=function(){const e=Fp();return e?.colors?.diverging||void 0}(),K=(0,Ty.useMemo)(()=>f&&Array.isArray(f)&&f.length>=d.length?f:function(e,t){if(0>=e)return[];if(t){const o=Ny[t];if(o){if(1===e)return[o(.5)];const t=[];for(let n=0;e>n;n++)t.push(o(n/(e-1)));return t}}const o=["#da1e28","#ff8389","#ffb3b8"],n=["#a6c8ff","#4589ff","#0043ce"],r="#a8a8a8";if(1===e)return[r];const i=e%2!=0,s=Math.floor(e/2),a=[];for(let e=0;s>e;e++)a.push(o[Math.min(Math.floor(e*o.length/s),o.length-1)]);i&&a.push(r);for(let e=0;s>e;e++)a.push(n[Math.min(Math.floor(e*n.length/s),n.length-1)]);return a}(d.length,U),[f,d.length,U]),Z=(0,Ty.useMemo)(()=>{const e=new Map;for(let t=0;d.length>t;t++)e.set(d[t],K[t]||"#888");return e},[d,K]),{processedData:Q,reAggregate:J,accumulatorRef:ee}=function({data:e,levels:t,categoryAccessor:o,valueAccessor:n,levelAccessor:r,countAccessor:i,isDiverging:s,frameRef:a}){const l=!r,c=(0,$y.useMemo)(()=>By(o,"question"),[o]),u=(0,$y.useMemo)(()=>l?By(n,"score"):null,[l,n]),d=(0,$y.useMemo)(()=>l?null:By(r,"level"),[l,r]),h=(0,$y.useMemo)(()=>l?null:By(i,"count"),[l,i]),f=(0,$y.useRef)([]);return{processedData:(0,$y.useMemo)(()=>{const o=e||[];if(0===o.length)return[];let n=Fy(o,t,c,u,d,h);return s&&(n=Hy(n,t),n=Oy(n,t)),n},[e,t,c,u,d,h,s]),reAggregate:(0,$y.useCallback)(e=>{let o=Fy(e,t,c,u,d,h);s&&(o=Hy(o,t),o=Oy(o,t)),a.current?.replace(o)},[t,c,u,d,h,s,a]),accumulatorRef:f}}({data:r,levels:d,categoryAccessor:a,valueAccessor:l,levelAccessor:c,countAccessor:u,isDiverging:G,frameRef:n}),te="__likertLevelLabel",oe=function({isPushMode:e,colorBy:t,colorScheme:o,showLegend:n,legendPosition:r="right"}){const i=(0,Iy.useRef)(new Set),s=(0,Iy.useRef)([]),[a,l]=(0,Iy.useState)(0),c=qf(),u=Zp(),d=(0,Iy.useCallback)(e=>{if(!t)return null;const o="function"==typeof t?t(e):e[t];return null!=o?o+"":null},[t]),h=(0,Iy.useCallback)(o=>{if(!e||!t)return;let n=!1;for(const e of o){if(!e||"object"!=typeof e)continue;const t=d(e);null==t||i.current.has(t)||(i.current.add(t),s.current.push(t),n=!0)}n&&l(e=>e+1)},[e,t,d]),f=(0,Iy.useCallback)(o=>{if(!e||!t)return;const n=Array.from(new Set(o.map(String))),r=s.current;r.length===n.length&&r.every((e,t)=>e===n[t])||(i.current=new Set(n),s.current=n,l(e=>e+1))},[e,t]),p=(0,Iy.useCallback)(e=>t=>{h([t]),e(t)},[h]),m=(0,Iy.useCallback)(e=>t=>{h(t),e(t)},[h]),g=(0,Iy.useCallback)(()=>{i.current=new Set,s.current=[],l(e=>e+1)},[]);gp(e&&t?s.current:[]);const y=(0,Iy.useMemo)(()=>{if(!e||!t||!1===n)return;const r=s.current;if(0===r.length)return;const i=Array.isArray(o)&&o.length>0||"string"==typeof o&&o.length>0?o:u&&u.length>0?u:Fe,a="string"==typeof t?t:"__streamCat",l=r.map(e=>({[a]:e})),d=qe(l,a,i);return kp({data:l,colorBy:a,colorScale:e=>c?.[e]||d(e)||"#999",getColor:ze})},[e,t,n,o,c,u,a]),b=(0,Iy.useMemo)(()=>{if(y)return"right"===r?{right:110}:"left"===r?{left:110}:"top"===r?{top:50}:"bottom"===r?{bottom:80}:{right:110}},[y,r]);return{wrapPush:p,wrapPushMany:m,resetCategories:g,categories:s.current,categoryDomainProps:e&&t?{legendCategoryAccessor:t,onCategoriesChange:f}:{},streamingLegend:y,streamingMarginAdjust:b}}({isPushMode:V,colorBy:te,colorScheme:K,showLegend:F,legendPosition:P}),{wrapPush:ne,wrapPushMany:re}=oe,ie=(0,Ty.useCallback)(e=>ne(e=>{ee.current.push(e),J(ee.current)})(e),[ne,J,ee]),se=(0,Ty.useCallback)(e=>re(e=>{ee.current.push(...e),J(ee.current)})(e),[re,J,ee]);(0,Ty.useImperativeHandle)(t,()=>({push:ie,pushMany:se,remove:e=>n.current?.remove(e)??[],update:(e,t)=>n.current?.update(e,t)??[],clear:()=>{ee.current=[],oe.resetCategories(),n.current?.clear()},getData:()=>n.current?.getData()??[],getScales:()=>n.current?.getScales()??null}),[ie,se,ee,oe]);const ae=ym({data:Q,rawData:r,colorBy:te,colorScheme:K,legendInteraction:R,legendPosition:P,selection:v,linkedHover:x,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:k,onClick:w,hoverHighlight:S,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"LikertChart",chartId:A,showLegend:F,userMargin:i,marginDefaults:o.marginDefaults,loading:M,loadingContent:_,emptyContent:j,width:N,height:D}),le=(0,Ty.useMemo)(()=>{const e=d.length;return e%2!=0&&Z.get(d[Math.floor(e/2)])||"#888"},[d,Z]),ce=Cy({colorBy:void 0,colorScale:void 0,color:void 0,themeCategorical:void 0,colorScheme:void 0,categoryIndexMap:qy,userPieceStyle:b?.pieceStyle,stroke:T,strokeWidth:I,opacity:$,effectiveSelectionHook:ae.effectiveSelectionHook,resolvedSelection:ae.resolvedSelection,baseStyleExtras:e=>{const t=e.__likertLevelLabel||e.data?.__likertLevelLabel,o=e.__likertLevel||e.data?.__likertLevel;if(o===Dy||o===Ey)return{fill:le};const n=t||o;return n&&Z.has(n)?{fill:Z.get(n)}:{fill:"#888"}}}),ue=(0,Ty.useMemo)(()=>{const e=d.length;return e%2!=0?d[Math.floor(e/2)]:""},[d]),de=(0,Ty.useMemo)(()=>e=>{const t=e.data||e,o=t.__likertLevel||"Unknown",n=o===Dy||o===Ey?ue:o,r=t.__likertCategory||"",i=Math.abs(t.__likertPct||0),s=o===Dy||o===Ey?2*i:i,a=t.__likertCount||0;return Ly.createElement("div",{className:"semiotic-tooltip",style:ya},Ly.createElement("div",{style:{fontWeight:"bold"}},r),Ly.createElement("div",{style:{marginTop:4}},`${n}: ${s.toFixed(1)}% (n=${a})`))},[ue]),he=(0,Ty.useMemo)(()=>{if(!d||2>d.length)return"LikertChart requires `levels` with at least 2 entries.";if(l&&c)return"LikertChart: provide either `valueAccessor` (raw responses) or `levelAccessor` + `countAccessor` (pre-aggregated), not both.";if(c&&!u)return"LikertChart: pre-aggregated mode requires both `levelAccessor` and `countAccessor`.";if(void 0!==r&&0===r.length)return null;const e={categoryAccessor:a};return X?l&&(e.valueAccessor=l):(c&&(e.levelAccessor=c),u&&(e.countAccessor=u)),dm({componentName:"LikertChart",data:r,accessors:e,requiredProps:{levels:d}})},[r,a,l,c,u,d,X]),fe=(0,Ty.useMemo)(()=>[{styleFn:e=>({fill:Z.get(e.label)||"#888"}),items:d.map(e=>({label:e})),label:""}],[d,Z]),pe=(0,Ty.useMemo)(()=>!1!==F?{...ae.legendBehaviorProps,legend:{legendGroups:fe},legendPosition:P||ae.legendPosition||"bottom"}:ae.legendBehaviorProps,[ae.legendBehaviorProps,ae.legendPosition,P,F,fe]),me=(0,Ty.useMemo)(()=>{const e={...ae.margin};if(V&&!1!==F){const t=P||"bottom";"bottom"===t&&80>e.bottom?e.bottom=80:"top"===t&&50>e.top?e.top=50:"right"===t&&110>e.right?e.right=110:"left"===t&&110>e.left&&(e.left=110)}else if(oe.streamingMarginAdjust)for(const[t,o]of Object.entries(oe.streamingMarginAdjust))o>e[t]&&(e[t]=o);return G&&100>e.left&&(e.left=100),e},[ae.margin,oe.streamingMarginAdjust,G,V,F,P]),ge=(0,Ty.useMemo)(()=>C||(G?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[G,C]);if(ae.earlyReturn)return ae.earlyReturn;const ye={chartType:"bar",...null!=r&&{data:Q},oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:G?"horizontal":"vertical",pieceStyle:ce,size:[N,D],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:me,barPadding:p,enableHover:E,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:q,rLabel:Y||(G?void 0:"Percentage"),rFormat:ge,...L&&{oFormat:L},showGrid:B,...pe,...H&&{title:H},...O&&{description:O},...z&&{summary:z},...void 0!==W&&{accessibleTable:W},...s&&{className:s},...null!=e.animate&&{animate:e.animate},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},tooltipContent:!1===m?()=>null:!0===m?de:Sa(m)||de,...Nf({linkedHover:x,selection:v,onObservation:k,onClick:w,hoverHighlight:S,mobileInteraction:ae.mobileInteraction,customHoverBehavior:ae.customHoverBehavior,customClickBehavior:ae.customClickBehavior}),...g&&g.length>0&&{annotations:g},...y&&{rExtent:y},...Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e))};return he?(0,Wy.jsx)(Oh,{componentName:"LikertChart",message:he,width:N,height:D}):(0,Wy.jsx)(Gh,{componentName:"LikertChart",width:N,height:D,children:(0,Wy.jsx)(Tu,{ref:n,...ye})})});Yy.displayName="LikertChart";var Gy=require("react"),Vy=require("react");function Xy({brushProp:e,onBrushProp:t,linkedBrush:o,valueAccessor:n}){const r=wp("string"==typeof o?o:o?{name:o.name,xField:o.rField}:void 0),i="string"==typeof n?n:"value",s=np({name:r?.name||"__unused_ordinal_brush__",xField:r?.xField||i}),a=(0,Vy.useRef)(s.brushInteraction);a.current=s.brushInteraction;const l=(0,Vy.useCallback)(e=>{if(r){a.current.end(e?e.r:null)}t?.(e)},[t,r]),c=!!(e||o||t);return{hasBrush:c,handleBrush:l,brushStreamProps:c?{brush:{dimension:"r"},onBrush:l}:{}}}h();var Uy=require("react/jsx-runtime"),Ky=(0,Gy.forwardRef)(function(e,t){const o=sm(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=(0,Gy.useRef)(null);vm(t,{variant:"xy",frameRef:n});const{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="vertical",valueFormat:d,colorBy:h,colorScheme:f,sizeBy:p,sizeRange:m=[3,8],symbolBy:g,symbolMap:y,pointRadius:b=4,pointOpacity:v=.7,categoryPadding:x=20,tooltip:k,annotations:w,valueExtent:S,brush:A,onBrush:C,linkedBrush:M,frameProps:_={},selection:j,linkedHover:R,onObservation:P,onClick:L,hoverHighlight:T,chartId:I,loading:$,loadingContent:N,emptyContent:D,legendInteraction:E,legendPosition:B,color:F,stroke:O,strokeWidth:z,opacity:W,showCategoryTicks:q,categoryFormat:Y}=e,{width:G,height:V,enableHover:X,showGrid:U,showLegend:K,title:Z,description:Q,summary:J,accessibleTable:ee,categoryLabel:te,valueLabel:oe}=o,ne=(0,Gy.useMemo)(()=>H(r),[r]),re=ym({data:ne,rawData:r,colorBy:h,colorScheme:f,legendInteraction:E,legendPosition:B,selection:j,linkedHover:R,fallbackFields:h?["string"==typeof h?h:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:P,onClick:L,hoverHighlight:T,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"SwarmPlot",chartId:I,showLegend:K,userMargin:i,marginDefaults:o.marginDefaults,loading:$,loadingContent:N,emptyContent:D,width:G,height:V}),ie=Xy({brushProp:A,onBrushProp:C,linkedBrush:M,valueAccessor:l}),se=(0,Gy.useMemo)(()=>{if(p)return u(ne.map(e=>"function"==typeof p?p(e):e[p]))},[ne,p]),ae=Zp(),le=(0,Gy.useMemo)(()=>new Map,[]),ce=Cy({colorBy:h,colorScale:re.colorScale,color:F,themeCategorical:ae,colorScheme:f,categoryIndexMap:le,userPieceStyle:_?.pieceStyle,stroke:O,strokeWidth:z,opacity:W,effectiveSelectionHook:re.effectiveSelectionHook,resolvedSelection:re.resolvedSelection,baseStyleExtras:e=>({fillOpacity:v,r:p?Ye(e,p,m,se):b})}),ue=(0,Gy.useMemo)(()=>Hl({categoryAccessor:a,valueAccessor:l,groupAccessor:h||void 0,valueFormat:d}),[a,l,h,d]);if(re.earlyReturn)return re.earlyReturn;const de=dm({componentName:"SwarmPlot",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(de)return(0,Uy.jsx)(Oh,{componentName:"SwarmPlot",message:de,width:G,height:V});const he={chartType:"swarm",...null!=r&&{data:ne},oAccessor:a,rAccessor:l,...g&&{symbolAccessor:g},...y&&{symbolMap:y},projection:"horizontal"===c?"horizontal":"vertical",pieceStyle:ce,size:[G,V],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:re.margin,barPadding:x,enableHover:X,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:te,rLabel:oe,rFormat:d,...Y&&{oFormat:Y},showGrid:U,showCategoryTicks:q,...re.legendBehaviorProps,...$f({title:Z,description:Q,summary:J,accessibleTable:ee,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Df({tooltip:k,defaultTooltipContent:ue}),...Nf({linkedHover:R,selection:j,onObservation:P,onClick:L,hoverHighlight:T,mobileInteraction:re.mobileInteraction,customHoverBehavior:re.customHoverBehavior,customClickBehavior:re.customClickBehavior}),...w&&w.length>0&&{annotations:w},...S&&{rExtent:S},...ie.brushStreamProps,...Object.fromEntries(Object.entries(_).filter(([e])=>"pieceStyle"!==e))};return(0,Uy.jsx)(Gh,{componentName:"SwarmPlot",width:G,height:V,children:(0,Uy.jsx)(Tu,{ref:n,...he})})});Ky.displayName="SwarmPlot";var Zy=require("react"),Qy=require("react/jsx-runtime");function Jy(e){return t=>{const o=t.category||t.data&&t.data[0]?.category||"",n=t.stats||(t.data||t).stats;if(n&&null!=n.median)return(0,Qy.jsxs)("div",{className:"semiotic-tooltip",style:ya,children:[o&&(0,Qy.jsx)("div",{style:{fontWeight:"bold"},children:o+""}),null!=n.n&&(0,Qy.jsxs)("div",{children:["n = ",n.n]}),null!=n.min&&(0,Qy.jsxs)("div",{children:["Min: ",n.min.toLocaleString()]}),null!=n.q1&&(0,Qy.jsxs)("div",{children:["Q1: ",n.q1.toLocaleString()]}),(0,Qy.jsxs)("div",{children:["Median: ",n.median.toLocaleString()]}),null!=n.q3&&(0,Qy.jsxs)("div",{children:["Q3: ",n.q3.toLocaleString()]}),null!=n.max&&(0,Qy.jsxs)("div",{children:["Max: ",n.max.toLocaleString()]}),null!=n.mean&&(0,Qy.jsxs)("div",{style:{opacity:.8},children:["Mean: ",n.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});if(e?.valueAccessor){const n=e.valueAccessor,r=(Array.isArray(t.data)?t.data:[]).map(e=>Number("function"==typeof n?n(e):e[n])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),i=r.length,s=i>0?i%2!=0?r[Math.floor(i/2)]:(r[i/2-1]+r[i/2])/2:null;return(0,Qy.jsxs)("div",{className:"semiotic-tooltip",style:ya,children:[o&&(0,Qy.jsx)("div",{style:{fontWeight:"bold"},children:o+""}),i>0&&(0,Qy.jsxs)("div",{children:["n = ",i]}),null!=s&&(0,Qy.jsxs)("div",{children:["Median: ",s.toLocaleString()]})]})}return(0,Qy.jsx)("div",{className:"semiotic-tooltip",style:ya,children:(0,Qy.jsx)("div",{style:{fontWeight:"bold"},children:o+""})})}}var eb=require("react/jsx-runtime"),tb=(0,Zy.forwardRef)(function(e,t){const o=sm(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=(0,Zy.useRef)(null);vm(t,{variant:"xy",frameRef:n});const{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="vertical",valueFormat:u,colorBy:d,colorScheme:h,showOutliers:f=!0,outlierRadius:p=3,categoryPadding:m=20,tooltip:g,annotations:y,valueExtent:b,frameProps:v={},selection:x,linkedHover:k,onObservation:w,onClick:S,hoverHighlight:A,chartId:C,loading:M,loadingContent:_,emptyContent:j,legendInteraction:R,legendPosition:P,color:L,stroke:T,strokeWidth:I,opacity:$,showCategoryTicks:N,categoryFormat:D}=e,{width:E,height:B,enableHover:F,showGrid:O,showLegend:z,title:W,description:q,summary:Y,accessibleTable:G,categoryLabel:V,valueLabel:X}=o,U=(0,Zy.useMemo)(()=>H(r),[r]),K=ym({data:U,rawData:r,colorBy:d,colorScheme:h,legendInteraction:R,legendPosition:P,selection:x,linkedHover:k,fallbackFields:d?["string"==typeof d?d:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:w,onClick:S,hoverHighlight:A,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"BoxPlot",chartId:C,showLegend:z,userMargin:i,marginDefaults:o.marginDefaults,loading:M,loadingContent:_,emptyContent:j,width:E,height:B}),Z=Zp(),Q=(0,Zy.useMemo)(()=>new Map,[]),J=Cy({colorBy:d,colorScale:K.colorScale,color:L,themeCategorical:Z,colorScheme:h,categoryIndexMap:Q,userPieceStyle:void 0,stroke:T,strokeWidth:I,opacity:$,effectiveSelectionHook:K.effectiveSelectionHook,resolvedSelection:K.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),ee=(0,Zy.useMemo)(()=>Jy(),[]);if(K.earlyReturn)return K.earlyReturn;const te=dm({componentName:"BoxPlot",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(te)return(0,eb.jsx)(Oh,{componentName:"BoxPlot",message:te,width:E,height:B});const oe={chartType:"boxplot",...null!=r&&{data:U},oAccessor:a,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",summaryStyle:J,showOutliers:f,size:[E,B],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:K.margin,barPadding:m,enableHover:F,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:V,rLabel:X,rFormat:u,...D&&{oFormat:D},showGrid:O,showCategoryTicks:N,...K.legendBehaviorProps,...$f({title:W,description:q,summary:Y,accessibleTable:G,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Df({tooltip:g,defaultTooltipContent:ee}),...Nf({linkedHover:k,selection:x,onObservation:w,onClick:S,hoverHighlight:A,mobileInteraction:K.mobileInteraction,customHoverBehavior:K.customHoverBehavior,customClickBehavior:K.customClickBehavior}),...y&&y.length>0&&{annotations:y},...b&&{rExtent:b},...Object.fromEntries(Object.entries(v).filter(([e])=>"pieceStyle"!==e))};return(0,eb.jsx)(Gh,{componentName:"BoxPlot",width:E,height:B,children:(0,eb.jsx)(Tu,{ref:n,...oe})})});tb.displayName="BoxPlot";var ob=require("react"),nb=require("react/jsx-runtime"),rb=e=>{const t=e?.category;return null==t?"All":t+""},ib=(0,ob.forwardRef)(function(e,t){const o=sm(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}),n=(0,ob.useRef)(null);vm(t,{variant:"xy",frameRef:n});const{data:r,margin:i,className:s,categoryAccessor:a=rb,valueAccessor:l="value",bins:c=25,relative:u=!1,valueFormat:d,colorBy:h,colorScheme:f,categoryPadding:p=20,tooltip:m,annotations:g,valueExtent:y,brush:b,onBrush:v,linkedBrush:x,frameProps:k={},selection:w,linkedHover:S,onObservation:A,onClick:C,hoverHighlight:M,chartId:_,loading:j,loadingContent:R,emptyContent:P,legendInteraction:L,legendPosition:T,color:I,stroke:$,strokeWidth:N,opacity:D,showCategoryTicks:E,categoryFormat:B}=e,{width:F,height:O,enableHover:z,showGrid:W,showLegend:q,title:Y,description:G,summary:V,accessibleTable:X,categoryLabel:U,valueLabel:K}=o,Z=(0,ob.useMemo)(()=>H(r),[r]),Q=ym({data:Z,rawData:r,colorBy:h,colorScheme:f,legendInteraction:L,legendPosition:T,selection:w,linkedHover:S,fallbackFields:h?["string"==typeof h?h:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:A,onClick:C,hoverHighlight:M,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"Histogram",chartId:_,showLegend:q,userMargin:i,marginDefaults:o.marginDefaults,loading:j,loadingContent:R,emptyContent:P,width:F,height:O}),J=Xy({brushProp:b,onBrushProp:v,linkedBrush:x,valueAccessor:l}),ee=(0,ob.useMemo)(()=>{if(0===Z.length)return;const e="function"==typeof l?l:e=>e[l];let t=1/0,o=-1/0;for(const n of Z){const r=e(n);null!=r&&isFinite(r)&&(t>r&&(t=r),r>o&&(o=r))}return t>o?void 0:[t,o]},[Z,l]),te=Zp(),oe=(0,ob.useMemo)(()=>new Map,[]),ne=Cy({colorBy:h,colorScale:Q.colorScale,color:I,themeCategorical:te,colorScheme:f,categoryIndexMap:oe,userPieceStyle:void 0,stroke:$,strokeWidth:N,opacity:D,effectiveSelectionHook:Q.effectiveSelectionHook,resolvedSelection:Q.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),re=(0,ob.useMemo)(()=>e=>{const t=e.data||e,o=t.category||e.category||"",n=t.count,r=t.range;return(0,nb.jsxs)("div",{className:"semiotic-tooltip",style:ya,children:[o&&(0,nb.jsx)("div",{style:{fontWeight:"bold"},children:o+""}),null!=n&&(0,nb.jsxs)("div",{children:["Count: ",n]}),r&&2===r.length&&(0,nb.jsxs)("div",{style:{opacity:.8},children:[Number(r[0]).toFixed(1)," – ",Number(r[1]).toFixed(1)]})]})},[]);if(Q.earlyReturn)return Q.earlyReturn;const ie=dm({componentName:"Histogram",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(ie)return(0,nb.jsx)(Oh,{componentName:"Histogram",message:ie,width:F,height:O});const se={chartType:"histogram",...null!=r&&{data:Z},oAccessor:a,rAccessor:l,projection:"horizontal",summaryStyle:ne,bins:c,normalize:u,...y?{rExtent:y}:ee&&{rExtent:ee},size:[F,O],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Q.margin,barPadding:p,enableHover:z,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:U,rLabel:K,rFormat:d,...B&&{oFormat:B},showGrid:W,showCategoryTicks:E,...Q.legendBehaviorProps,...$f({title:Y,description:G,summary:V,accessibleTable:X,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Df({tooltip:m,defaultTooltipContent:re}),...Nf({linkedHover:S,selection:w,onObservation:A,onClick:C,hoverHighlight:M,mobileInteraction:Q.mobileInteraction,customHoverBehavior:Q.customHoverBehavior,customClickBehavior:Q.customClickBehavior}),...g&&g.length>0&&{annotations:g},...J.brushStreamProps,...Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e))};return(0,nb.jsx)(Gh,{componentName:"Histogram",width:F,height:O,children:(0,nb.jsx)(Tu,{ref:n,...se})})});ib.displayName="Histogram";var sb=require("react"),ab=require("react/jsx-runtime"),lb=(0,sb.forwardRef)(function(e,t){const o=sm(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=(0,sb.useRef)(null);vm(t,{variant:"xy",frameRef:n});const{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="vertical",bins:u=25,curve:d="catmullRom",showIQR:h=!0,valueFormat:f,colorBy:p,colorScheme:m,categoryPadding:g=20,tooltip:y,annotations:b,valueExtent:v,brush:x,onBrush:k,linkedBrush:w,frameProps:S={},selection:A,linkedHover:C,onObservation:M,onClick:_,hoverHighlight:j,chartId:R,loading:P,loadingContent:L,emptyContent:T,legendInteraction:I,legendPosition:$,color:N,stroke:D,strokeWidth:E,opacity:B,showCategoryTicks:F,categoryFormat:O}=e,{width:z,height:W,enableHover:q,showGrid:Y,showLegend:G,title:V,description:X,summary:U,accessibleTable:K,categoryLabel:Z,valueLabel:Q}=o,J=(0,sb.useMemo)(()=>H(r),[r]),ee=ym({data:J,rawData:r,colorBy:p,colorScheme:m,legendInteraction:I,legendPosition:$,selection:A,linkedHover:C,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:M,onClick:_,hoverHighlight:j,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"ViolinPlot",chartId:R,showLegend:G,userMargin:i,marginDefaults:o.marginDefaults,loading:P,loadingContent:L,emptyContent:T,width:z,height:W}),te=Xy({brushProp:x,onBrushProp:k,linkedBrush:w,valueAccessor:l}),oe=Zp(),ne=(0,sb.useMemo)(()=>new Map,[]),re=Cy({colorBy:p,colorScale:ee.colorScale,color:N,themeCategorical:oe,colorScheme:m,categoryIndexMap:ne,userPieceStyle:void 0,stroke:D,strokeWidth:E,opacity:B,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection,baseStyleExtras:{fillOpacity:.6},linkStrokeToFill:!0}),ie=(0,sb.useMemo)(()=>Jy({valueAccessor:l}),[l]);if(ee.earlyReturn)return ee.earlyReturn;const se=dm({componentName:"ViolinPlot",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(se)return(0,ab.jsx)(Oh,{componentName:"ViolinPlot",message:se,width:z,height:W});const ae={chartType:"violin",...null!=r&&{data:J},oAccessor:a,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",summaryStyle:re,bins:u,showIQR:h,size:[z,W],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ee.margin,barPadding:g,enableHover:q,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:Z,rLabel:Q,rFormat:f,...O&&{oFormat:O},showGrid:Y,showCategoryTicks:F,...ee.legendBehaviorProps,...$f({title:V,description:X,summary:U,accessibleTable:K,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Df({tooltip:y,defaultTooltipContent:ie}),...Nf({linkedHover:C,selection:A,onObservation:M,onClick:_,hoverHighlight:j,mobileInteraction:ee.mobileInteraction,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior}),...b&&b.length>0&&{annotations:b},...v&&{rExtent:v},...te.brushStreamProps,...Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e))};return(0,ab.jsx)(Gh,{componentName:"ViolinPlot",width:z,height:W,children:(0,ab.jsx)(Tu,{ref:n,...ae})})});lb.displayName="ViolinPlot";var cb=require("react"),ub=require("react/jsx-runtime"),db=(0,cb.forwardRef)(function(e,t){const o=sm(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=(0,cb.useRef)(null);vm(t,{variant:"xy",frameRef:n});const{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="horizontal",bins:u=20,amplitude:d=1.5,valueFormat:h,colorBy:f,colorScheme:p,categoryPadding:m=5,tooltip:g,annotations:y,valueExtent:b,frameProps:v={},selection:x,linkedHover:k,onObservation:w,onClick:S,hoverHighlight:A,chartId:C,loading:M,loadingContent:_,emptyContent:j,legendInteraction:R,legendPosition:P,color:L,stroke:T,strokeWidth:I,opacity:$,showCategoryTicks:N,categoryFormat:D}=e,{width:E,height:B,enableHover:F,showGrid:O,showLegend:z,title:W,description:q,summary:Y,accessibleTable:G,categoryLabel:V,valueLabel:X}=o,U=(0,cb.useMemo)(()=>H(r),[r]),K=ym({data:U,rawData:r,colorBy:f,colorScheme:p,legendInteraction:R,legendPosition:P,selection:x,linkedHover:k,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:w,onClick:S,hoverHighlight:A,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"RidgelinePlot",chartId:C,showLegend:z,userMargin:i,marginDefaults:o.marginDefaults,loading:M,loadingContent:_,emptyContent:j,width:E,height:B}),Z=Zp(),Q=(0,cb.useMemo)(()=>new Map,[]),J=Cy({colorBy:f,colorScale:K.colorScale,color:L,themeCategorical:Z,colorScheme:p,categoryIndexMap:Q,userPieceStyle:void 0,stroke:T,strokeWidth:I,opacity:$,effectiveSelectionHook:K.effectiveSelectionHook,resolvedSelection:K.resolvedSelection,baseStyleExtras:{fillOpacity:.5},linkStrokeToFill:!0}),ee=(0,cb.useMemo)(()=>Jy(),[]);if(K.earlyReturn)return K.earlyReturn;const te=dm({componentName:"RidgelinePlot",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(te)return(0,ub.jsx)(Oh,{componentName:"RidgelinePlot",message:te,width:E,height:B});const oe={chartType:"ridgeline",...null!=r&&{data:U},oAccessor:a,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",summaryStyle:J,bins:u,size:[E,B],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:K.margin,barPadding:m,enableHover:F,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:V,rLabel:X,rFormat:h,...D&&{oFormat:D},showGrid:O,showCategoryTicks:N,oSort:!1,amplitude:d,...K.legendBehaviorProps,...$f({title:W,description:q,summary:Y,accessibleTable:G,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Df({tooltip:g,defaultTooltipContent:ee}),...Nf({linkedHover:k,selection:x,onObservation:w,onClick:S,hoverHighlight:A,mobileInteraction:K.mobileInteraction,customHoverBehavior:K.customHoverBehavior,customClickBehavior:K.customClickBehavior}),...y&&y.length>0&&{annotations:y},...b&&{rExtent:b},...Object.fromEntries(Object.entries(v).filter(([e])=>"pieceStyle"!==e))};return(0,ub.jsx)(Gh,{componentName:"RidgelinePlot",width:E,height:B,children:(0,ub.jsx)(Tu,{ref:n,...oe})})});db.displayName="RidgelinePlot";var hb=require("react"),fb=require("react/jsx-runtime"),pb=(0,hb.forwardRef)(function(e,t){const o=sm(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}),n=(0,hb.useRef)(null);vm(t,{variant:"xy",frameRef:n});const{data:r,margin:i,className:s,stepAccessor:a="step",valueAccessor:l="value",categoryAccessor:c,colorBy:u,colorScheme:d,orientation:h="horizontal",connectorOpacity:f=.3,showLabels:p=!0,tooltip:m,annotations:g,frameProps:y={},selection:b,linkedHover:v,onObservation:x,onClick:k,hoverHighlight:w,chartId:S,loading:A,loadingContent:C,emptyContent:M,legendInteraction:_,legendPosition:j,color:R,stroke:P,strokeWidth:L,opacity:T,categoryFormat:I}=e,$="vertical"===h,{width:N,height:D,enableHover:E,showLegend:B,title:F,description:O,summary:z,accessibleTable:W}=o,q=$?{top:F?60:40,right:20,bottom:60,left:60}:{top:F?40:10,right:10,bottom:10,left:10},Y=(0,hb.useMemo)(()=>H(r),[r]),G=u||c,V=!G,X=ym({data:Y,rawData:r,colorBy:G,colorScheme:d,legendInteraction:_,legendPosition:j,selection:b,linkedHover:v,fallbackFields:G?["string"==typeof G?G:""]:[],unwrapData:!0,onObservation:x,onClick:k,hoverHighlight:w,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"FunnelChart",chartId:S,showLegend:B,userMargin:i,marginDefaults:q,loading:A,loadingContent:C,emptyContent:M,width:N,height:D});Zh("FunnelChart",Y,"stepAccessor",a),Zh("FunnelChart",Y,"valueAccessor",l);const U=Zp(),K=(0,hb.useMemo)(()=>new Map,[]),Z=(0,hb.useMemo)(()=>{if(V)return R||(U?.[0]?U[0]:Array.isArray(d)&&d[0]?d[0]:"#4e79a7")},[V,R,U,d]),Q=Cy({colorBy:Z?void 0:G,colorScale:X.colorScale,color:Z??R,themeCategorical:U,colorScheme:d,categoryIndexMap:K,userPieceStyle:y?.pieceStyle,stroke:P,strokeWidth:L,opacity:T,effectiveSelectionHook:X.effectiveSelectionHook,resolvedSelection:X.resolvedSelection}),J=(0,hb.useMemo)(()=>e=>{const t=e?.data||e,o=t?.__funnelStep||t?.__barFunnelStep||t?.step||"",n=t?.__funnelValue??t?.__barFunnelValue??t?.value??"",r=t?.__funnelPercent??t?.__barFunnelPercent,i=t?.__funnelIsFirstStep??t?.__barFunnelIsFirstStep,s=t?.__barFunnelIsDropoff,a=t?.__barFunnelCategory??t?.category,l=null==r||i?"":` (${.05>Math.abs(r-Math.round(r))?Math.round(r)+"%":r.toFixed(1)+"%"})`;return(0,fb.jsxs)("div",{className:"semiotic-tooltip",style:ya,children:[o&&(0,fb.jsx)("div",{style:{fontWeight:"bold"},children:o+""}),a&&a!==o&&(0,fb.jsx)("div",{style:{marginTop:2,opacity:.8},children:a+""}),s&&(0,fb.jsx)("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7},children:"Dropoff"}),(0,fb.jsxs)("div",{style:{marginTop:4},children:[n+"",l]})]})},[]);if(X.earlyReturn)return X.earlyReturn;const ee=dm({componentName:"FunnelChart",data:r,accessors:{stepAccessor:a,valueAccessor:l}});if(ee)return(0,fb.jsx)(Oh,{componentName:"FunnelChart",message:ee,width:N,height:D});const te={chartType:$?"bar-funnel":"funnel",...null!=r&&{data:Y},oAccessor:a,rAccessor:l,...c&&{stackBy:c},projection:$?"vertical":"horizontal",barPadding:$?40:0,pieceStyle:Q,size:[N,D],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:X.margin,enableHover:E,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:$,showCategoryTicks:$,...I&&{oFormat:I},showGrid:$,...!$&&{connectorOpacity:f},showLabels:p,...X.legendBehaviorProps,...F&&{title:F},...O&&{description:O},...z&&{summary:z},...void 0!==W&&{accessibleTable:W},...s&&{className:s},...null!=e.animate&&{animate:e.animate},tooltipContent:!1===m?()=>null:!0===m||null==m?J:Sa(m)||J,...Nf({linkedHover:v,selection:b,onObservation:x,onClick:k,hoverHighlight:w,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(0,fb.jsx)(Gh,{componentName:"FunnelChart",width:N,height:D,children:(0,fb.jsx)(Tu,{ref:n,...te})})});pb.displayName="FunnelChart";var mb=require("react"),gb=require("react/jsx-runtime"),yb=(0,mb.forwardRef)(function(e,t){const o=sm(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}),n=(0,mb.useRef)(null);vm(t,{variant:"xy",frameRef:n});const{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="horizontal",valueFormat:u,colorBy:d,colorScheme:h,sort:f="auto",dotRadius:p=5,categoryPadding:m=10,tooltip:g,annotations:y,regression:b,valueExtent:v,frameProps:x={},selection:k,linkedHover:w,onObservation:S,onClick:A,hoverHighlight:C,chartId:M,loading:_,loadingContent:j,emptyContent:R,legendInteraction:P,legendPosition:L,color:T,stroke:I,strokeWidth:$,opacity:N,categoryFormat:D}=e,{width:E,height:B,enableHover:F,showGrid:O,showLegend:z,title:W,description:q,summary:Y,accessibleTable:G,categoryLabel:V,valueLabel:X}=o,U=(0,mb.useMemo)(()=>H(r),[r]),K=ym({data:U,rawData:r,colorBy:d,colorScheme:h,legendInteraction:P,legendPosition:L,selection:k,linkedHover:w,fallbackFields:d?["string"==typeof d?d:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:S,onClick:A,hoverHighlight:C,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"DotPlot",chartId:M,showLegend:z,userMargin:i,marginDefaults:o.marginDefaults,loading:_,loadingContent:j,emptyContent:R,width:E,height:B}),Z=em(U,f,l),Q=Zp(),J=(0,mb.useMemo)(()=>new Map,[]),ee=Cy({colorBy:d,colorScale:K.colorScale,color:T,themeCategorical:Q,colorScheme:h,categoryIndexMap:J,userPieceStyle:x?.pieceStyle,stroke:I,strokeWidth:$,opacity:N,effectiveSelectionHook:K.effectiveSelectionHook,resolvedSelection:K.resolvedSelection,baseStyleExtras:{r:p,fillOpacity:.8}}),te=(0,mb.useMemo)(()=>Hl({categoryAccessor:a,valueAccessor:l,valueFormat:u}),[a,l,u]);if(K.earlyReturn)return K.earlyReturn;const oe=dm({componentName:"DotPlot",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(oe)return(0,gb.jsx)(Oh,{componentName:"DotPlot",message:oe,width:E,height:B});const ne=Em(b),re=ne?[ne,...y||[]]:y,ie={chartType:"point",...null!=r&&{data:Z},oAccessor:a,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",pieceStyle:ee,size:[E,B],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:K.margin,barPadding:m,enableHover:F,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:V,rLabel:X,rFormat:u,...D&&{oFormat:D},showGrid:O,oSort:f,...K.legendBehaviorProps,...$f({title:W,description:q,summary:Y,accessibleTable:G,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Df({tooltip:g,defaultTooltipContent:te}),...Nf({linkedHover:w,selection:k,onObservation:S,onClick:A,hoverHighlight:C,mobileInteraction:K.mobileInteraction,customHoverBehavior:K.customHoverBehavior,customClickBehavior:K.customClickBehavior}),...re&&re.length>0&&{annotations:re},...v&&{rExtent:v},...Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e))};return(0,gb.jsx)(Gh,{componentName:"DotPlot",width:E,height:B,children:(0,gb.jsx)(Tu,{ref:n,...ie})})});yb.displayName="DotPlot";var bb=require("react"),vb=require("react/jsx-runtime"),xb=(0,bb.forwardRef)(function(e,t){const o=sm(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}),n=(0,bb.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",colorBy:c,colorScheme:u,startAngle:d=0,cornerRadius:h,tooltip:f,annotations:p,frameProps:m={},selection:g,linkedHover:y,onObservation:b,onClick:v,hoverHighlight:x,chartId:k,loading:w,loadingContent:S,emptyContent:A,legendInteraction:C,legendPosition:M,color:_,stroke:j,strokeWidth:R,opacity:P}=e,{width:L,height:T,enableHover:I,showLegend:$,title:N,description:D,summary:E,accessibleTable:B}=o,F=(0,bb.useMemo)(()=>H(r),[r]),O=c||a,z=ym({data:F,rawData:r,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:k,showLegend:$,userMargin:i,marginDefaults:o.marginDefaults,loading:w,loadingContent:S,emptyContent:A,width:L,height:T}),W=Zp(),q=(0,bb.useMemo)(()=>new Map,[]),Y=Cy({colorBy:O,colorScale:z.colorScale,color:_,themeCategorical:W,colorScheme:u,categoryIndexMap:q,userPieceStyle:m?.pieceStyle,stroke:j,strokeWidth:R,opacity:P,effectiveSelectionHook:z.effectiveSelectionHook,resolvedSelection:z.resolvedSelection,cycleByCategory:!0}),G=(0,bb.useMemo)(()=>Hl({categoryAccessor:a,valueAccessor:l,groupAccessor:c&&c!==a?c:void 0,groupLabel:"string"==typeof c?c:"group",pieData:!0}),[a,l,c]),V=dm({componentName:"PieChart",data:r,accessors:{categoryAccessor:a,valueAccessor:l}}),{effectiveLegendProps:X,effectiveMargin:U}=Sy({ref:t,frameRef:n,setup:z});if(z.earlyReturn)return z.earlyReturn;const K={chartType:"pie",...null!=r&&{data:F},oAccessor:a,rAccessor:l,projection:"radial",pieceStyle:Y,startAngle:d,...null!=h&&{cornerRadius:h},size:[L,T],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:U,enableHover:I,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:!1,...X,...$f({title:N,description:D,summary:E,accessibleTable:B,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Df({tooltip:f,defaultTooltipContent:G}),...Nf({linkedHover:y,selection:g,onObservation:b,onClick:v,hoverHighlight:x,mobileInteraction:z.mobileInteraction,customHoverBehavior:z.customHoverBehavior,customClickBehavior:z.customClickBehavior}),...p&&p.length>0&&{annotations:p},...Object.fromEntries(Object.entries(m).filter(([e])=>"pieceStyle"!==e))};return V?(0,vb.jsx)(Oh,{componentName:"PieChart",message:V,width:L,height:T}):(0,vb.jsx)(Gh,{componentName:"PieChart",width:L,height:T,children:(0,vb.jsx)(Tu,{ref:n,...K})})});xb.displayName="PieChart";var kb=require("react"),wb=require("react/jsx-runtime"),Sb=(0,kb.forwardRef)(function(e,t){const o=sm(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}),n=(0,kb.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",innerRadius:c,centerContent:u,colorBy:d,colorScheme:h,startAngle:f=0,cornerRadius:p,tooltip:m,annotations:g,frameProps:y={},selection:b,linkedHover:v,onObservation:x,onClick:k,hoverHighlight:w,chartId:S,loading:A,loadingContent:C,emptyContent:M,legendInteraction:_,legendPosition:j,color:R,stroke:P,strokeWidth:L,opacity:T}=e,{width:I,height:$,enableHover:N,showLegend:D,title:E,description:B,summary:F,accessibleTable:O}=o,z=(0,kb.useMemo)(()=>H(r),[r]),W=d||a,q=ym({data:z,rawData:r,colorBy:W,colorScheme:h,legendInteraction:_,legendPosition:j,selection:b,linkedHover:v,fallbackFields:W?["string"==typeof W?W:""]:[],unwrapData:!0,onObservation:x,onClick:k,hoverHighlight:w,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"DonutChart",chartId:S,showLegend:D,userMargin:i,marginDefaults:o.marginDefaults,loading:A,loadingContent:C,emptyContent:M,width:I,height:$}),Y=c??Math.max(2,.15*Math.min(I,$)),G=Zp(),V=(0,kb.useMemo)(()=>new Map,[]),X=Cy({colorBy:W,colorScale:q.colorScale,color:R,themeCategorical:G,colorScheme:h,categoryIndexMap:V,userPieceStyle:y?.pieceStyle,stroke:P,strokeWidth:L,opacity:T,effectiveSelectionHook:q.effectiveSelectionHook,resolvedSelection:q.resolvedSelection,cycleByCategory:!0}),U=(0,kb.useMemo)(()=>Hl({categoryAccessor:a,valueAccessor:l,groupAccessor:d&&d!==a?d:void 0,groupLabel:"string"==typeof d?d:"group",pieData:!0}),[a,l,d]),K=dm({componentName:"DonutChart",data:r,accessors:{categoryAccessor:a,valueAccessor:l}}),{effectiveLegendProps:Z,effectiveMargin:Q}=Sy({ref:t,frameRef:n,setup:q});if(q.earlyReturn)return q.earlyReturn;const J={chartType:"donut",...null!=r&&{data:z},oAccessor:a,rAccessor:l,projection:"radial",pieceStyle:X,innerRadius:Y,startAngle:f,...null!=p&&{cornerRadius:p},centerContent:u,size:[I,$],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Q,enableHover:N,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:!1,...Z,...$f({title:E,description:B,summary:F,accessibleTable:O,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Df({tooltip:m,defaultTooltipContent:U}),...Nf({linkedHover:v,selection:b,onObservation:x,onClick:k,hoverHighlight:w,mobileInteraction:q.mobileInteraction,customHoverBehavior:q.customHoverBehavior,customClickBehavior:q.customClickBehavior}),...g&&g.length>0&&{annotations:g},...Object.fromEntries(Object.entries(y).filter(([e])=>"pieceStyle"!==e))};return K?(0,wb.jsx)(Oh,{componentName:"DonutChart",message:K,width:I,height:$}):(0,wb.jsx)(Gh,{componentName:"DonutChart",width:I,height:$,children:(0,wb.jsx)(Tu,{ref:n,...J})})});Sb.displayName="DonutChart";var Ab=require("react");function Cb(e=240){const t=360-e,o=180+t/2,n=o*Math.PI/180;return{sweepRad:e*Math.PI/180,gapDeg:t,startAngleDeg:o,startAngleRad:n,offsetRad:-Math.PI/2+n}}function Mb(e){return Math.max(0,Math.min(1,e))}function _b(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 jb(e,t,o){const n=e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0");return`#${n(e)}${n(t)}${n(o)}`}function Rb(e,t){const o=e.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Mb(e.offset),color:e.color})).sort((e,t)=>e.offset-t.offset);if(0===o.length)return"#999999";if(1===o.length)return o[0].color;const n=Mb(t);if(o[0].offset>=n)return o[0].color;if(n>=o[o.length-1].offset)return o[o.length-1].color;for(let e=0;o.length-1>e;e++){const t=o[e],r=o[e+1];if(t.offset>n||n>r.offset)continue;const i=r.offset-t.offset,s=i>0?(n-t.offset)/i:0,a=_b(t.color),l=_b(r.color);if(!a||!l)return.5>s?t.color:r.color;const[c,u,d]=a,[h,f,p]=l;return jb(c+(h-c)*s,u+(f-u)*s,d+(p-d)*s)}return o[o.length-1].color}function Pb(e,t,o){return null==o?`${e}-${t}`:`${e}-${t}-${o}`}h();var Lb=require("react/jsx-runtime"),Tb=(0,Ab.forwardRef)(function(e,t){const o=sm(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=(0,Ab.useRef)(null),r="context"===e.mode,{compactMode:i}=o,{value:s,min:a=0,max:l=100,thresholds:c,gradientFill:d,color:h,backgroundColor:f="var(--semiotic-grid, #e0e0e0)",arcWidth:p=.3,cornerRadius:m,showNeedle:g=!0,needleColor:y="var(--semiotic-text, #333)",centerContent:b,valueFormat:v,showScaleLabels:x=!i,sweep:k=240,fillZones:w=!0,tooltip:S,annotations:A,frameProps:C={},className:M,stroke:_,strokeWidth:j,opacity:R}=e,{width:P,height:L,title:T,description:I,summary:$,accessibleTable:N}=o,D=d&&"object"==typeof d?d:void 0,E=Math.max(a,Math.min(l,s)),B=l-a||1,F=(E-a)/B,{gaugeData:H,pieceStyle:O,gaugeAnnotations:z}=(0,Ab.useMemo)(()=>function(e){const{min:t,max:o,value:n,thresholds:r,fillColor:i,backgroundColor:s,fillZones:a,showScaleLabels:l,gradientFill:c,gradientSteps:u=240}=e,d=o-t||1,h=(Math.max(t,Math.min(o,n))-t)/d;let f=r&&r.length>0?[...r].sort((e,t)=>e.value-t.value):[{value:o,color:i||"#007bff"}];f=f.map(e=>({...e,value:Math.max(t,Math.min(o,e.value))})),o>f[f.length-1].value&&f.push({value:o,color:f[f.length-1].color});const p=!!c&&c.colorStops.length>=2,m=[],g=new Map,y=[];if(p){const e=a?h:1,t=Pb("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:s,opacity:.4}),e>0){const t=Math.max(1,Math.floor(u)),o=Math.max(1,Math.min(t,Math.round(e*t))),n=[];for(let t=0;o>t;t++)n.push(Rb(c.colorStops,e*(t+.5)/o));const r=Pb("fill",0);m.push({category:r,value:e,_zone:"Gradient",_isFill:!0,_pctStart:0,_pct:e,_roundedEnds:{start:!0,end:!0},_nonInteractive:!0,_gradientBand:{colors:n}}),g.set(r,{fill:n[0]||s})}}else{let e=t;for(let o=0;f.length>o;o++){const n=f[o],r=(n.value-e)/d,i=(e-t)/d,l=(n.value-t)/d,c=Math.max(0,(a?Math.min(h,l):l)-i),u=a?Math.max(0,r-c):0;if(c>0){const e=Pb("fill",o);m.push({category:e,value:c,_zone:n.label||"Zone "+(o+1),_isFill:!0}),g.set(e,{fill:n.color})}if(u>0){const e=Pb("bg",o);m.push({category:e,value:u,_zone:n.label||"Zone "+(o+1),_isFill:!1}),g.set(e,{fill:s,opacity:.4})}e=n.value}}if(l&&r&&r.length>0)for(const e of r)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:s},gaugeAnnotations:y}}({min:a,max:l,value:s,thresholds:c,fillColor:h,backgroundColor:f,fillZones:w,showScaleLabels:x,gradientFill:D}),[s,a,l,c,h,f,x,w,D]),W=(0,Ab.useMemo)(()=>km(O,{stroke:_,strokeWidth:j,opacity:R}),[O,_,j,R]),{sweepRad:q,startAngleDeg:Y}=Cb(k),G=function(e=240){const{sweepRad:t,offsetRad:o}=Cb(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 r=n.map(e=>e[0]),i=n.map(e=>e[1]),[s,a]=u(r),[l,c]=u(i);return{minX:s,maxX:a,minY:l,maxY:c,width:a-s,height:c-l,cx:(s+a)/2,cy:(l+c)/2}}(k),V=Math.min(10,Math.max(1,Math.min(P,L)/12)),X=G.cx,U=G.cy,K=Math.max(4,Math.min((P-2*V)/G.width,(L-2*V)/G.height)-2),Z=Math.max(0,Math.min(K-1.5,K*(1-p))),Q=P/2-X*K,J=L/2-U*K,ee=2*(K+4),te=(0,Ab.useMemo)(()=>{if(i&&null==b)return null;if(null!=b)return"function"==typeof b?b(E,a,l):b;const e=v?v(E):Math.round(E)+"";return(0,Lb.jsxs)("div",{style:{textAlign:"center",lineHeight:1.2},children:[(0,Lb.jsx)("div",{style:{fontSize:Math.max(16,.3*K),fontWeight:700,color:"var(--semiotic-text, #333)"},children:e}),x&&(0,Lb.jsxs)("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"},children:[a," – ",l]})]})},[b,E,a,l,v,x,K,i]),oe=(0,Ab.useMemo)(()=>r&&null==b?{type:"gauge-value",text:v?v(E):Math.round(E)+""}:null,[r,b,E,v]),ne=(0,Ab.useMemo)(()=>{if(!g)return null;const e=-Math.PI/2+Y*Math.PI/180+F*q,t=Z>20?Z-8:K-1;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:y}},[g,Y,F,q,Z,K,y]),re=(0,Ab.useMemo)(()=>(e,t,o)=>{if("gauge-needle"===e.type){const n=(o.width||P)/2,r=(o.height||L)/2,i=Math.max(1,K-Z),s=Math.max(1,Math.min(2.5,.4*i)),a=Math.max(1,Math.min(5,.6*i));return(0,Lb.jsxs)("g",{transform:`translate(${n},${r})`,children:[(0,Lb.jsx)("line",{x1:0,y1:0,x2:e.tipX,y2:e.tipY,stroke:e.color,strokeWidth:s,strokeLinecap:"round"}),(0,Lb.jsx)("circle",{cx:0,cy:0,r:a,fill:e.color})]},"gauge-needle-"+t)}if("gauge-label"===e.type){const n=-Math.PI/2+Y*Math.PI/180+(e.value-a)/B*q,r=(o.width||P)/2,i=(o.height||L)/2,s=Z-1,l=K+1,c=Math.cos(n)*s,u=Math.sin(n)*s,d=Math.cos(n)*l,h=Math.sin(n)*l,f=K+10,p=Math.cos(n)*f,m=Math.sin(n)*f,g=((n+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"),(0,Lb.jsxs)("g",{transform:`translate(${r},${i})`,children:[(0,Lb.jsx)("line",{x1:c,y1:u,x2:d,y2:h,stroke:"var(--semiotic-border)",strokeWidth:2,strokeLinecap:"round"}),(0,Lb.jsx)("text",{x:p,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?(0,Lb.jsx)("text",{x:(o.width||P)/2,y:(o.height||L)/2-.2*Z,textAnchor:"middle",dominantBaseline:"middle",fontSize:Math.max(12,Math.min(22,.28*K)),fontWeight:700,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:e.text},"gauge-value-"+t):null},[P,L,a,B,Y,q,Z,K]),ie=(0,Ab.useMemo)(()=>{const e=[...z,...A||[]];return ne&&e.push(ne),oe&&e.push(oe),e},[z,A,ne,oe]),se=(0,Ab.useMemo)(()=>e=>{const t=e?.data?.[0]||e?.data||e,o=t?._zone||"",n=t?._isFill;return(0,Lb.jsxs)("div",{className:"semiotic-tooltip",style:{padding:"6px 10px",background:"var(--semiotic-tooltip-bg, white)",borderRadius:"var(--semiotic-tooltip-radius, 6px)",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0,0,0,0.15))"},children:[(0,Lb.jsx)("div",{style:{fontWeight:600},children:o}),(0,Lb.jsx)("div",{style:{fontSize:"0.85em",color:"var(--semiotic-text-secondary, #666)"},children:n?"Current: "+Math.round(E):"Remaining"})]})},[E]);if(0===H.length)return(0,Lb.jsx)(Oh,{componentName:"GaugeChart",message:"No data to display",width:P,height:L});const ae={chartType:"donut",data:H,oAccessor:"category",rAccessor:"value",oSort:!1,projection:"radial",pieceStyle:W,innerRadius:Z,startAngle:Y,sweepAngle:k,...null!=m&&{cornerRadius:m},centerContent:te,size:[P,L],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:{top:J-ee/2,bottom:L-J-ee/2,left:Q-ee/2,right:P-Q-ee/2},enableHover:o.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===S?()=>null:Sa(S)||se,svgAnnotationRules:re,...ie.length>0&&{annotations:ie},...T&&{title:T},...I&&{description:I},...$&&{summary:$},...void 0!==N&&{accessibleTable:N},...M&&{className:M},...null!=e.animate&&{animate:e.animate},...C};return(0,Lb.jsx)(Gh,{componentName:"GaugeChart",width:P,height:L,children:(0,Lb.jsx)(Tu,{ref:n,...ae})})});Tb.displayName="GaugeChart";var Ib=require("react"),$b=require("react/jsx-runtime"),Nb=(0,Ib.forwardRef)(function(e,t){const o=sm(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=(0,Ib.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="category",groupBy:l,valueAccessor:c="value",orientation:u="vertical",valueFormat:d,colorBy:h,colorScheme:f,sort:p=!1,barPadding:m=60,roundedTop:g,styleRules:y,baselinePadding:b=!1,tooltip:v,annotations:x,valueExtent:k,frameProps:w={},selection:S,linkedHover:A,onObservation:C,onClick:M,hoverHighlight:_,chartId:j,loading:R,loadingContent:P,emptyContent:L,legendInteraction:T,legendPosition:I,color:$,stroke:N,strokeWidth:D,opacity:E,categoryFormat:B}=e,{width:F,height:O,enableHover:z,showGrid:W,showLegend:q,title:Y,description:G,summary:V,accessibleTable:X,categoryLabel:U,valueLabel:K}=o,Z=(0,Ib.useMemo)(()=>H(r),[r]),Q=h||l,J=ym({data:Z,rawData:r,colorBy:Q,colorScheme:f,legendInteraction:T,legendPosition:I,selection:S,linkedHover:A,fallbackFields:Q?["string"==typeof Q?Q:""]:[],unwrapData:!0,onObservation:C,onClick:M,hoverHighlight:_,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"GroupedBarChart",chartId:j,showLegend:q,userMargin:i,marginDefaults:o.marginDefaults,loading:R,loadingContent:P,emptyContent:L,width:F,height:O}),ee=Zp(),te=(0,Ib.useMemo)(()=>new Map,[]),oe=(0,Ib.useMemo)(()=>wm(c),[c]),ne=Cy({colorBy:Q,colorScale:J.colorScale,color:$,themeCategorical:ee,colorScheme:f,categoryIndexMap:te,userPieceStyle:w.pieceStyle,stroke:N,strokeWidth:D,opacity:E,styleRules:y,resolveRuleValue:oe,effectiveSelectionHook:J.effectiveSelectionHook,resolvedSelection:J.resolvedSelection}),re=(0,Ib.useMemo)(()=>Hl({categoryAccessor:l,valueAccessor:c,groupAccessor:a,valueFormat:d}),[l,a,c,d]),ie=dm({componentName:"GroupedBarChart",data:r,accessors:{categoryAccessor:a,valueAccessor:c},requiredProps:{groupBy:l}}),{effectiveLegendProps:se,effectiveMargin:ae}=Sy({ref:t,frameRef:n,setup:J});if(J.earlyReturn)return J.earlyReturn;const le={chartType:"clusterbar",...null!=r&&{data:Z},oAccessor:a,rAccessor:c,groupBy:l,oSort:p,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:ne,size:[F,O],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ae,barPadding:m,...null!=g&&{roundedTop:g},baselinePadding:b,enableHover:z,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:U,rLabel:K,rFormat:d,...B&&{oFormat:B},showGrid:W,...se,...$f({title:Y,description:G,summary:V,accessibleTable:X,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Df({tooltip:v,defaultTooltipContent:re}),...Nf({linkedHover:A,selection:S,onObservation:C,onClick:M,hoverHighlight:_,mobileInteraction:J.mobileInteraction,customHoverBehavior:J.customHoverBehavior,customClickBehavior:J.customClickBehavior}),...x&&x.length>0&&{annotations:x},...k&&{rExtent:k},...Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e))};return ie?(0,$b.jsx)(Oh,{componentName:"GroupedBarChart",message:ie,width:F,height:O}):(0,$b.jsx)(Gh,{componentName:"GroupedBarChart",width:F,height:O,children:(0,$b.jsx)(Tu,{ref:n,...le})})});Nb.displayName="GroupedBarChart";var Db=require("react"),Eb=require("react/jsx-runtime"),Bb=(0,Db.forwardRef)(function(e,t){const o=sm(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=(0,Db.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="category",subcategoryAccessor:l,valueAccessor:c="value",orientation:u="horizontal",valueFormat:d,colorBy:h,colorScheme:f,barPadding:p,tooltip:m,annotations:g,brush:y,onBrush:b,linkedBrush:v,frameProps:x={},selection:k,linkedHover:w,onObservation:S,onClick:A,hoverHighlight:C,chartId:M,loading:_,loadingContent:j,emptyContent:R,legendInteraction:P,legendPosition:L,color:T,stroke:I,strokeWidth:$,opacity:N,categoryFormat:D,rTickValues:E,tickLabelEdgeAlign:B,showCategoryTicks:F,gradientFill:O,trackFill:z,roundedTop:W,valueExtent:q}=e,{width:Y,height:G,enableHover:V,showGrid:X,showLegend:U,title:K,description:Z,summary:Q,accessibleTable:J,categoryLabel:ee,valueLabel:te}=o,oe=(0,Db.useMemo)(()=>H(r),[r]),ne=h||l,re=(0,Db.useMemo)(()=>{if(null!=p)return p;if("sparkline"!==e.mode)return 40;const t=new Set(oe.map(e=>"function"==typeof a?a(e):e[a])),o=Math.max(1,t.size);return o>1?Math.max(0,Math.min(1,(("horizontal"===u?G:Y)-2*o)/(o-1))):1},[p,e.mode,oe,a,u,Y,G]),ie=ym({data:oe,rawData:r,colorBy:ne,colorScheme:f,legendInteraction:P,legendPosition:L,selection:k,linkedHover:w,fallbackFields:ne?["string"==typeof ne?ne:""]:[],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:_,loadingContent:j,emptyContent:R,width:Y,height:G}),se=Xy({brushProp:y,onBrushProp:b,linkedBrush:v,valueAccessor:c}),ae=Zp(),le=(0,Db.useMemo)(()=>new Map,[]),ce=Cy({colorBy:ne,colorScale:ie.colorScale,color:T,themeCategorical:ae,colorScheme:f,categoryIndexMap:le,userPieceStyle:x?.pieceStyle,stroke:I,strokeWidth:$,opacity:N,effectiveSelectionHook:ie.effectiveSelectionHook,resolvedSelection:ie.resolvedSelection,cycleByCategory:!0}),ue=(0,Db.useMemo)(()=>Hl({categoryAccessor:l,valueAccessor:c,groupAccessor:a,valueFormat:d}),[l,a,c,d]),de=dm({componentName:"SwimlaneChart",data:r,accessors:{categoryAccessor:a,valueAccessor:c,subcategoryAccessor:l},requiredProps:{subcategoryAccessor:l}}),{effectiveLegendProps:he,effectiveMargin:fe}=Sy({ref:t,frameRef:n,setup:ie});if(ie.earlyReturn)return ie.earlyReturn;const pe={chartType:"swimlane",...null!=r&&{data:oe},oAccessor:a,rAccessor:c,stackBy:l,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:ce,size:[Y,G],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:fe,barPadding:re,enableHover:V,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:!1===F?void 0:ee,rLabel:te,rFormat:d,...E&&{rTickValues:E},...null!=B&&{tickLabelEdgeAlign:B},...D&&{oFormat:D},...void 0!==F&&{showCategoryTicks:F},showGrid:X,...he,...$f({title:K,description:Z,summary:Q,accessibleTable:J,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Df({tooltip:m,defaultTooltipContent:ue}),...Nf({linkedHover:w,selection:k,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!=z&&{trackFill:z},...null!=W&&{roundedTop:W},...q&&{rExtent:q},...se.brushStreamProps,...Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e))};return de?(0,Eb.jsx)(Oh,{componentName:"SwimlaneChart",message:de,width:Y,height:G}):(0,Eb.jsx)(Gh,{componentName:"SwimlaneChart",width:Y,height:G,children:(0,Eb.jsx)(Tu,{ref:n,...pe})})});Bb.displayName="SwimlaneChart";var Fb=require("react"),Hb=require("react");function Ob(e,t){if(!e)return[];const o=[],n=e=>{o.push(e);const r="function"==typeof t?t(e):e[t];r&&Array.isArray(r)&&r.forEach(n)};return n(e),o}function zb(e,t,o,n){if(e&&e.length>0)return e;const r=new Set;return t.forEach(e=>{const t="function"==typeof o?o(e):e[o],i="function"==typeof n?n(e):e[n];r.add(t),r.add(i)}),Array.from(r).map(e=>({id:e}))}function Wb(e){return"function"==typeof e?e:t=>t[e]||1}function qb({edgeColorBy:e,colorBy:t,colorScale:o,nodeStyleFn:n,edgeOpacity:r,baseStyle:i={}}){return s=>{const a={fillOpacity:r,...i};if("function"==typeof e)a.fill=e(s);else if("source"===e){const e="object"==typeof s.source?s.source:null;t&&e?a.fill=ze(e.data||e,t,o):e&&(a.fill=n(e,e.index).fill)}else if("target"===e){const e="object"==typeof s.target?s.target:null;t&&e?a.fill=ze(e.data||e,t,o):e&&(a.fill=n(e,e.index).fill)}else"gradient"===e&&(a.fill="#999",a.fillOpacity=.7*r);return a}}function Yb(e){const{nodes:t,edges:o,inferNodes:n=!0,sourceAccessor:r="source",targetAccessor:i="target",colorBy:s,colorScheme:a,showLegend:l,legendPosition:c,legendInteraction:u,selection:d,linkedHover:h,onObservation:f,onClick:p,mobileInteraction:m,mobileSemantics:g,chartType:y,chartId:b,marginDefaults:v,userMargin:x,width:k,height:w,loading:S,loadingContent:A,emptyContent:C,emptyDataKey:M="edges"}=e,_=(0,Hb.useMemo)(()=>H(o),[o]),j=(0,Hb.useMemo)(()=>H(t),[t]),R=Kh(S,k,w,A),P=R?null:Uh("nodes"===M?void 0===t?void 0:j:void 0===o?void 0:_,k,w,C),L=(0,Hb.useMemo)(()=>n?zb(j,_,r,i):j,[n,j,_,r,i]),T=Jp(L,s,a),I=Zp(),$=(0,Hb.useMemo)(()=>{if(Array.isArray(a))return a;if(I&&I.length>0)return I;if("string"==typeof a){const e=Ee[a];if(Array.isArray(e)&&e.length>0)return e}return Be},[a,I]),N=(0,Hb.useMemo)(()=>{if(!s)return[];const e=new Set;for(const t of L){const o="function"==typeof s?s(t):t[s];null!=o&&e.add(o+"")}return Array.from(e)},[L,s]),D=rm(u,s,N),{legend:E,margin:B,legendPosition:F}=nm({data:L,colorBy:s,colorScale:T,showLegend:l,legendPosition:c,userMargin:x,defaults:v,categories:N}),O=(0,Hb.useMemo)(()=>Kp(m,{width:k,mobileSemantics:g}),[m,k,g]),z=tm({selection:d,linkedHover:h,fallbackFields:s?["string"==typeof s?s:""]:[],unwrapData:!0,onObservation:f,onClick:p,mobileInteraction:O,chartType:y,chartId:b}),{customHoverBehavior:W,customClickBehavior:q,activeSelectionHook:Y,hoverSelectionHook:G,crosshairSourceId:V}=z;return{safeNodes:L,safeEdges:_,colorScale:T,effectivePalette:$,themeCategorical:I,allCategories:N,legendState:D,legend:E,margin:B,legendPosition:F,mobileInteraction:O,customHoverBehavior:W,customClickBehavior:q,activeSelectionHook:Y,hoverSelectionHook:G,crosshairSourceId:V,loadingEl:R,emptyEl:P}}var Gb=require("react/jsx-runtime"),Vb=(0,Fb.forwardRef)(function(e,t){const o=(0,Fb.useRef)(null);vm(t,{variant:"network",frameRef:o});const n=sm(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:r,edges:i,margin:s,className:a,nodeIdAccessor:l,nodeIDAccessor:c,sourceAccessor:u="source",targetAccessor:d="target",nodeLabel:h,colorBy:f,colorScheme:p,styleRules:m,nodeSize:g=8,nodeSizeRange:y=[5,20],edgeWidth:b=1,edgeColor:v="#999",edgeOpacity:x=.6,iterations:k=300,forceStrength:w=.1,layoutExecution:S="auto",layoutLoadingContent:A,onLayoutStateChange:C,tooltip:M,frameProps:_={},onObservation:j,onClick:R,chartId:P,selection:L,linkedHover:T,loading:I,loadingContent:$,emptyContent:N,legendInteraction:D,legendPosition:E,stroke:B,strokeWidth:F,opacity:H}=e,O=l??c??"id",{width:z,height:W,enableHover:q,showLegend:Y,showLabels:G=!1,title:V,description:X,summary:U,accessibleTable:K}=n,Z=Yb({nodes:r,edges:i,inferNodes:!1,nodeIdAccessor:O,sourceAccessor:u,targetAccessor:d,colorBy:f,colorScheme:p,showLegend:Y,legendPosition:E,legendInteraction:D,selection:L,linkedHover:T,onObservation:j,onClick:R,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"ForceDirectedGraph",chartId:P,marginDefaults:n.marginDefaults,userMargin:s,width:z,height:W,loading:I,loadingContent:$,emptyContent:N,emptyDataKey:"nodes"}),Q=(0,Fb.useMemo)(()=>new Map,[]),J=(0,Fb.useMemo)(()=>e=>{const t={};return t.fill=f?ze(e.data||e,f,Z.colorScale):Qp(void 0,Z.themeCategorical,p,void 0,Q),"number"==typeof g&&(t.r=g),t},[f,Z.colorScale,g,Z.themeCategorical,p,Q]),ee=(0,Fb.useMemo)(()=>Am(f,"number"==typeof g?void 0:g),[f,g]),te=(0,Fb.useMemo)(()=>km(Rm(J,m,ee,e=>e.data||e),{stroke:B,strokeWidth:F,opacity:H}),[J,m,ee,B,F,H]),oe=(0,Fb.useMemo)(()=>e=>{const t=e.data||e;let o;if("number"==typeof b)o=b;else if("function"==typeof b)o=b(t);else{const e=t[b],n="number"==typeof e?e:Number(e);o=Number.isFinite(n)&&n>0?n:1}return{stroke:v,strokeWidth:o,opacity:x}},[b,v,x]),ne=(0,Fb.useMemo)(()=>km(oe,{stroke:B,strokeWidth:F,opacity:H}),[oe,B,F,H]),re=(0,Fb.useMemo)(()=>{if(G&&h)return"function"==typeof h?h:e=>e.data?.[h]??e[h]??e.id},[G,h]),ie=fm({componentName:"ForceDirectedGraph",nodes:r,edges:i,nodesRequired:!0,edgesRequired:!0,accessors:{nodeIDAccessor:O}});return ie?(0,Gb.jsx)(Oh,{componentName:"ForceDirectedGraph",message:ie,width:z,height:W}):Z.loadingEl?Z.loadingEl:Z.emptyEl?Z.emptyEl:(0,Gb.jsx)(Gh,{componentName:"ForceDirectedGraph",width:z,height:W,children:(0,Gb.jsx)(If,{ref:o,chartType:"force",...null!=r&&{nodes:Z.safeNodes},...null!=i&&{edges:Z.safeEdges},size:[z,W],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Z.margin,nodeIDAccessor:O,sourceAccessor:u,targetAccessor:d,iterations:k,forceStrength:w,layoutExecution:S,layoutLoadingContent:A,onLayoutStateChange:C,nodeStyle:te,edgeStyle:ne,colorBy:f,colorScheme:Z.effectivePalette,nodeSize:g,nodeSizeRange:y,nodeLabel:re,showLabels:G,enableHover:q,tooltipContent:!1===M?()=>null:Sa(M)||void 0,...Nf({linkedHover:T,selection:L,onObservation:j,onClick:R,mobileInteraction:Z.mobileInteraction,customHoverBehavior:Z.customHoverBehavior,customClickBehavior:Z.customClickBehavior,linkedHoverInClickPredicate:!1}),legend:Z.legend,legendPosition:Z.legendPosition,...D&&"none"!==D&&{legendHoverBehavior:Z.legendState.onLegendHover,legendClickBehavior:Z.legendState.onLegendClick,legendHighlightedCategory:Z.legendState.highlightedCategory,legendIsolatedCategories:Z.legendState.isolatedCategories},className:a,title:V,description:X,summary:U,accessibleTable:K,...null!=e.animate&&{animate:e.animate},..._})})});Vb.displayName="ForceDirectedGraph";var Xb=require("react"),Ub=require("react/jsx-runtime"),Kb=(0,Xb.forwardRef)(function(e,t){const o=(0,Xb.useRef)(null);vm(t,{variant:"network",frameRef:o,overrides:{getData:()=>o.current?.getTopology()?.edges?.map(e=>e.data)??[]}});const n=sm(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:r,edges:i,margin:s,className:a,sourceAccessor:l="source",targetAccessor:c="target",valueAccessor:u="value",nodeIdAccessor:d="id",colorBy:h,colorScheme:f,styleRules:p,edgeColorBy:m="source",padAngle:g=.01,groupWidth:y=20,sortGroups:b,nodeLabel:v,edgeOpacity:x=.5,tooltip:k,frameProps:w={},onObservation:S,onClick:A,chartId:C,selection:M,linkedHover:_,loading:j,loadingContent:R,emptyContent:P,legendInteraction:L,stroke:T,strokeWidth:I,opacity:$}=e,{width:N,height:D,enableHover:E,showLabels:B=!0,title:F,description:H,summary:O,accessibleTable:z}=n,W=Yb({nodes:r,edges:i,inferNodes:!0,nodeIdAccessor:d,sourceAccessor:l,targetAccessor:c,colorBy:h,colorScheme:f,showLegend:!1,legendInteraction:L,selection:M,linkedHover:_,onObservation:S,onClick:A,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"ChordDiagram",chartId:C,marginDefaults:n.marginDefaults,userMargin:s,width:N,height:D,loading:j,loadingContent:R,emptyContent:P}),q=(0,Xb.useMemo)(()=>new Map,[]),Y=W.safeNodes.length>0,G=(0,Xb.useMemo)(()=>{if(Y)return(e,t)=>{const o={stroke:"black",strokeWidth:1};if(h)o.fill=ze(e.data||e,h,W.colorScale);else{const n=Array.isArray(f)?f:Ee[f]||Be,r=Array.isArray(n)?n:Be;o.fill=r[(e.index??t??0)%r.length]}return o}},[Y,h,W.colorScale,f]),V=(0,Xb.useMemo)(()=>Am(h),[h]),X=(0,Xb.useMemo)(()=>{if(G||p&&p.length>0)return km(Rm(G,p,V,e=>e.data||e),{stroke:T,strokeWidth:I,opacity:$})},[G,p,V,T,I,$]),U=(0,Xb.useMemo)(()=>{if(Y)return qb({edgeColorBy:m,colorBy:h,colorScale:W.colorScale,nodeStyleFn:X||(e=>({fill:Qp(void 0,W.themeCategorical,f,void 0,q)})),edgeOpacity:x,baseStyle:{stroke:"black",strokeWidth:.5,strokeOpacity:x}})},[Y,m,h,W.colorScale,X,x,W.themeCategorical,f,q]),K=(0,Xb.useMemo)(()=>U?km(U,{stroke:T,strokeWidth:I,opacity:$}):void 0,[U,T,I,$]),Z=(0,Xb.useMemo)(()=>{if(!B)return;const e=v||d;return"function"==typeof e?e:t=>t.data?.[e]??t[e]??t.id},[B,v,d]),Q=fm({componentName:"ChordDiagram",edges:i,edgesRequired:!0});return Q?(0,Ub.jsx)(Oh,{componentName:"ChordDiagram",message:Q,width:N,height:D}):W.loadingEl?W.loadingEl:W.emptyEl?W.emptyEl:(0,Ub.jsx)(Gh,{componentName:"ChordDiagram",width:N,height:D,children:(0,Ub.jsx)(If,{ref:o,chartType:"chord",...W.safeNodes.length>0&&{nodes:W.safeNodes},...null!=i&&{edges:W.safeEdges},size:[N,D],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:W.margin,nodeIDAccessor:d,sourceAccessor:l,targetAccessor:c,valueAccessor:u,padAngle:g,groupWidth:y,sortGroups:b,nodeStyle:X,edgeStyle:K,colorBy:h,colorScheme:W.effectivePalette,edgeColorBy:m,edgeOpacity:x,nodeLabel:Z,showLabels:B,enableHover:E,tooltipContent:!1===k?()=>null:Sa(k)||void 0,...Nf({linkedHover:_,selection:M,onObservation:S,onClick:A,mobileInteraction:W.mobileInteraction,customHoverBehavior:W.customHoverBehavior,customClickBehavior:W.customClickBehavior,linkedHoverInClickPredicate:!1}),...L&&"none"!==L&&{legendHoverBehavior:W.legendState.onLegendHover,legendClickBehavior:W.legendState.onLegendClick,legendHighlightedCategory:W.legendState.highlightedCategory,legendIsolatedCategories:W.legendState.isolatedCategories},className:a,title:F,description:H,summary:O,accessibleTable:z,...null!=e.animate&&{animate:e.animate},...w})})});Kb.displayName="ChordDiagram";var Zb=require("react"),Qb=require("react/jsx-runtime"),Jb=(0,Zb.forwardRef)(function(e,t){const o=(0,Zb.useRef)(null);vm(t,{variant:"network",frameRef:o,overrides:{getData:()=>o.current?.getTopology()?.edges?.map(e=>e.data)??[]}});const n=sm(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:r,edges:i,margin:s,className:a,sourceAccessor:l="source",targetAccessor:c="target",valueAccessor:u="value",nodeIdAccessor:d="id",colorBy:h,colorScheme:f,styleRules:p,edgeColorBy:m="source",orientation:g="horizontal",nodeAlign:y="justify",nodePaddingRatio:b=.05,nodeWidth:v=15,nodeLabel:x,edgeOpacity:k=.5,edgeSort:w,tooltip:S,frameProps:A={},onObservation:C,onClick:M,chartId:_,selection:j,linkedHover:R,loading:P,loadingContent:L,emptyContent:T,showLegend:I,legendPosition:$,legendInteraction:N,stroke:D,strokeWidth:E,opacity:B}=e,{width:F,height:H,enableHover:O,showLabels:z=!0,title:W,description:q,summary:Y,accessibleTable:G}=n,V=Yb({nodes:r,edges:i,inferNodes:!0,nodeIdAccessor:d,sourceAccessor:l,targetAccessor:c,colorBy:h,colorScheme:f,showLegend:I,legendPosition:$,legendInteraction:N,selection:j,linkedHover:R,onObservation:C,onClick:M,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"SankeyDiagram",chartId:_,marginDefaults:n.marginDefaults,userMargin:s,width:F,height:H,loading:P,loadingContent:L,emptyContent:T}),X=(0,Zb.useMemo)(()=>new Map,[]),U=(0,Zb.useMemo)(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=h?ze(e.data||e,h,V.colorScale):Qp(void 0,V.themeCategorical,f,void 0,X),t},[h,V.colorScale,V.themeCategorical,f,X]),K=(0,Zb.useMemo)(()=>Am(h,u),[h,u]),Z=(0,Zb.useMemo)(()=>km(Rm(U,p,K,e=>e.data||e),{stroke:D,strokeWidth:E,opacity:B}),[U,p,K,D,E,B]),Q=(0,Zb.useMemo)(()=>qb({edgeColorBy:m,colorBy:h,colorScale:V.colorScale,nodeStyleFn:Z,edgeOpacity:k,baseStyle:{stroke:"none",strokeWidth:0}}),[m,h,V.colorScale,Z,k]),J=(0,Zb.useMemo)(()=>km(Q,{stroke:D,strokeWidth:E,opacity:B}),[Q,D,E,B]),ee=(0,Zb.useMemo)(()=>{if(!z)return;const e=x||d;return"function"==typeof e?e:t=>t.data?.[e]??t[e]??t.id},[z,x,d]),te=fm({componentName:"SankeyDiagram",edges:i,edgesRequired:!0});return te?(0,Qb.jsx)(Oh,{componentName:"SankeyDiagram",message:te,width:F,height:H}):V.loadingEl?V.loadingEl:V.emptyEl?V.emptyEl:(0,Qb.jsx)(Gh,{componentName:"SankeyDiagram",width:F,height:H,children:(0,Qb.jsx)(If,{ref:o,chartType:"sankey",...V.safeNodes.length>0&&{nodes:V.safeNodes},...null!=i&&{edges:V.safeEdges},size:[F,H],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:V.margin,nodeIDAccessor:d,sourceAccessor:l,targetAccessor:c,valueAccessor:u,orientation:g,nodeAlign:y,nodePaddingRatio:b,nodeWidth:v,nodeStyle:Z,edgeStyle:J,colorBy:h,colorScheme:V.effectivePalette,edgeColorBy:m,edgeOpacity:k,edgeSort:w,nodeLabel:ee,showLabels:z,enableHover:O,tooltipContent:!1===S?()=>null:Sa(S)||void 0,...Nf({linkedHover:R,selection:j,onObservation:C,onClick:M,mobileInteraction:V.mobileInteraction,customHoverBehavior:V.customHoverBehavior,customClickBehavior:V.customClickBehavior,linkedHoverInClickPredicate:!1}),legend:V.legend,legendPosition:V.legendPosition,...N&&"none"!==N&&{legendHoverBehavior:V.legendState.onLegendHover,legendClickBehavior:V.legendState.onLegendClick,legendHighlightedCategory:V.legendState.highlightedCategory,legendIsolatedCategories:V.legendState.isolatedCategories},className:a,title:W,description:q,summary:Y,accessibleTable:G,...null!=e.animate&&{animate:e.animate},...A})})});Jb.displayName="SankeyDiagram";var ev=require("react"),tv=require("d3-scale"),ov=require("react");function nv(e,t,o){const n=t.incoming[e.id],r=t.outgoing[e.id],i=[];for(const e of n)i.push({time:e.endTime,delta:+e.value,edge:e,kind:"in",side:o.get(e.id).targetSide});for(const e of r)i.push({time:e.startTime,delta:-e.value,edge:e,kind:"out",side:o.get(e.id).sourceSide});const s={create:0,in:1,"transfer-out":2,"transfer-in":3,out:4},a=()=>{i.sort((e,t)=>e.time-t.time||(s[e.kind]??99)-(s[t.kind]??99))},l=i.length?function(e,t=1/0){let o=t;for(const t of e)o>t&&(o=t);return o}(i.map(e=>e.time)):null,c=Array.isArray(e.xExtent)&&Number.isFinite(e.xExtent[0])?e.xExtent[0]:null,u=null!=c?c-1:null!=l&&Number.isFinite(l)?l-1:null,d=[...new Set(i.map(e=>e.time))].sort((e,t)=>e-t),h=new Map;for(let e=1;d.length>e;e++)h.set(d[e],d[e-1]);const f=e=>{const t=h.get(e);return null!=t?(t+e)/2:null!=u?u:e};a();const p=[];let m=0,g=0;for(const e of i)if("out"===e.kind){const t=Math.abs(e.delta);let o=t-("top"===e.side?m:g);if(o>0){const t="top"===e.side?"bot":"top",n=Math.min(o,"top"===t?m:g);if(n>0){const r=f(e.time);p.push({time:r,delta:-n,kind:"transfer-out",side:t}),p.push({time:r,delta:+n,kind:"transfer-in",side:e.side}),"top"===t?m-=n:g-=n,"top"===e.side?m+=n:g+=n,o-=n}o>0&&null!==u&&(p.push({time:u,delta:+o,kind:"create",side:e.side}),"top"===e.side?m+=o:g+=o)}"top"===e.side?m-=t:g-=t}else if("in"===e.kind){const t=Math.abs(e.delta);"top"===e.side?m+=t:g+=t}i.push(...p),a();let y=0,b=0,v=0,x=0,k=0;const w=[],S=new Map;for(const e of i){if(w.push({t:e.time,topMass:y,botMass:b}),("in"===e.kind||"out"===e.kind)&&e.edge){const t="top"===e.side?y:b;S.set(e.edge.id,{side:e.side,time:e.time,sideMassBefore:t,sideMassAfter:t+e.delta,kind:e.kind,value:Math.abs(e.delta)})}"top"===e.side?y+=e.delta:b+=e.delta,y+b>v&&(v=y+b),y>x&&(x=y),b>k&&(k=b),w.push({t:e.time,topMass:y,botMass:b})}const A=[];let C=0;for(;w.length>C;){let e=C;for(;w.length>e+1&&w[e+1].t===w[C].t;)e++;A.push(w[C]);for(let t=C+1;e>=t;t++){const e=A[A.length-1];w[t].topMass===e.topMass&&w[t].botMass===e.botMass||A.push(w[t])}C=e+1}const M=Array.isArray(e.xExtent)&&Number.isFinite(e.xExtent[1])?e.xExtent[1]:null;let _=null;for(const e of r)null!=e.systemInTime&&Number.isFinite(e.systemInTime)&&e.startTime>e.systemInTime&&(null===_||_>e.systemInTime)&&(_=e.systemInTime);let j=null;for(const e of n)null!=e.systemOutTime&&Number.isFinite(e.systemOutTime)&&e.systemOutTime>e.endTime&&(null===j||e.systemOutTime>j)&&(j=e.systemOutTime);if(A.length>0){const e=A[A.length-1],t=Math.max(null!=M?M:-1/0,null!=j?j:-1/0);Number.isFinite(t)&&t>e.t&&e.topMass+e.botMass>0&&A.push({t:t,topMass:e.topMass,botMass:e.botMass});const o=A[0],n=Math.min(null!=c?c:1/0,null!=_?_:1/0);Number.isFinite(n)&&o.t>n&&o.topMass+o.botMass>0&&A.unshift({t:n,topMass:o.topMass,botMass:o.botMass})}return{samples:A,peak:v,topPeak:x,botPeak:k,localAttachments:S}}function rv(e,t){return t?Math.max(t[0],Math.min(t[1],e)):e}function iv(e,t){return e.map(e=>({t:rv(e.t,t),topMass:e.topMass,botMass:e.botMass}))}function sv(e,t,o){const n=e.value*o;if("out"===e.kind){const r=e.sideMassBefore*o;if("top"===e.side){const e=t-r;return[e,e+n]}const i=t+r;return[i-n,i]}const r=e.sideMassAfter*o;if("top"===e.side){const e=t-r;return[e,e+n]}const i=t+r;return[i-n,i]}function av(e,t){let o=0;for(let n=0;t.length>n;n++)for(let r=n+1;t.length>r;r++){const i=t[n],s=t[r];i.source!==s.source&&i.target!==s.target&&i.source!==s.target&&i.target!==s.source&&(Math.min(i.endTime,s.endTime)>Math.max(i.startTime,s.startTime)&&e[s.source]>e[i.source]!=e[s.target]>e[i.target]&&o++)}return o}function lv(e,t){let o=0;for(const n of t)o+=Math.abs(e[n.source]-e[n.target])*(n.value||1);return o}function cv(e,t){return 1e3*av(e,t)+lv(e,t)}function uv(e,t){return{slots:e.map(e=>({peak:{...e.peak},occupants:e.occupants.slice()})),map:{...t}}}function dv(e,t,o){e.length>8||o.length>40?(function(e,t,o,n=6){const r=e.length;if(1>=r)return;let i=uv(e,t),s=cv(t,o);for(let a=0;n>a;a++){const n=Array(r).fill(0),a=Array(r).fill(0);for(const e of o){const o=t[e.source],r=t[e.target];n[o]+=r*(e.value||1),a[o]+=e.value||1,n[r]+=o*(e.value||1),a[r]+=e.value||1}const l=Array.from({length:r},(e,t)=>t).sort((e,t)=>(a[e]>0?n[e]/a[e]:e)-(a[t]>0?n[t]/a[t]:t)),c=l.map(t=>e[t]),u=new Map;l.forEach((e,t)=>u.set(e,t));for(const e of Object.keys(t))t[e]=u.get(t[e]);e.length=0;for(const t of c)e.push(t);const d=cv(t,o);if(s>d)s=d,i=uv(e,t);else if(d===s)break}!function(e,t,o){e.length=0;for(const t of o.slots)e.push(t);for(const e of Object.keys(t))delete t[e];for(const e of Object.keys(o.map))t[e]=o.map[e]}(e,t,i)}(e,t,o,6),function(e,t,o,n=6){const r=e.length;if(1>=r)return;let i=cv(t,o);for(let s=0;n>s;s++){let n=!1;for(let s=0;r-1>s;s++){const r=e[s];e[s]=e[s+1],e[s+1]=r;for(const e of Object.keys(t))t[e]===s?t[e]=s+1:t[e]===s+1&&(t[e]=s);const a=cv(t,o);if(i>a)i=a,n=!0;else{const o=e[s];e[s]=e[s+1],e[s+1]=o;for(const e of Object.keys(t))t[e]===s?t[e]=s+1:t[e]===s+1&&(t[e]=s)}}if(!n)break}}(e,t,o,6)):function(e,t,o){const n=e.length;if(1>=n)return;const r={...t},i=Object.keys(r),s=Array.from({length:n},(e,t)=>t),a=s.slice(),l={...r};let c=s.slice(),u=1/0;const d=()=>{for(const e of i)l[e]=a[r[e]];const e=cv(l,o);u>e&&(u=e,c=s.slice())},h=(e,t)=>{const o=s[e],n=s[t];s[e]=n,s[t]=o,a[o]=t,a[n]=e};d();const f=Array(n).fill(0);let p=0;for(;n>p;)p>f[p]?(h(p%2==0?0:f[p],p),d(),f[p]++,p=0):(f[p]=0,p++);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 hv(e,t,o,n,r){const{plotH:i,padding:s,valueScale:a,packing:l,laneOrder:c,lifetimeMode:u="full"}=r,d={},h={};for(const t of e)d[t.id]=o[t.id].topPeak||0,h[t.id]=o[t.id].botPeak||0;const f="half"===u,p={};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 r=null!=e&&Number.isFinite(e)?e:1/0,i=null!=o&&Number.isFinite(o)?o:-1/0;for(const e of n.outgoing[t.id]){r>e.startTime&&(r=e.startTime),null!=e.systemInTime&&Number.isFinite(e.systemInTime)&&r>e.systemInTime&&(r=e.systemInTime);const t=f?(e.startTime+e.endTime)/2:e.endTime;t>i&&(i=t)}for(const e of n.incoming[t.id]){const t=f?(e.startTime+e.endTime)/2:e.startTime;r>t&&(r=t),e.endTime>i&&(i=e.endTime),null!=e.systemOutTime&&Number.isFinite(e.systemOutTime)&&e.systemOutTime>i&&(i=e.systemOutTime)}p[t.id]={start:Number.isFinite(r)?r: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 r=new Map;for(const t of e)r.set(t.id,0);for(const e of t)r.set(e.target,(r.get(e.target)??0)+1);const i=[];for(const t of e)0===(r.get(t.id)??0)&&i.push(t.id);for(;i.length;){const e=i.shift();for(const t of n.outgoing[e]??[]){const n=(o.get(e)??0)+1;n>(o.get(t.target)??0)&&o.set(t.target,n),r.set(t.target,r.get(t.target)-1),0===r.get(t.target)&&i.push(t.target)}}const s=[...e].filter(e=>null!==p[e.id].start).sort((e,t)=>{const n=o.get(e.id)??0,r=o.get(t.id)??0;return n!==r?n-r:p[e.id].start-p[t.id].start}),a=e.filter(e=>null===p[e.id].start);for(const e of[...s,...a]){const t=p[e.id];let o=-1;for(let e=0;g.length>e;e++){const n=g[e].occupants[g[e].occupants.length-1];if(null===t.start||void 0===n||t.start>=n.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:p[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 k=()=>{y=av(m,t),v=lv(m,t)},w=()=>{b=av(m,t),x=lv(m,t)};"crossing-min"===c?(k(),dv(g,m,t),w()):"inside-out"===c?(k(),function(e,t){const o=e.length;if(1>=o)return;const n=e=>e.peak.topPeak+e.peak.botPeak,r=e.map((e,t)=>({slot:e,idx:t})).sort((e,t)=>n(t.slot)-n(e.slot)),i=Array(o),s=Math.floor((o-1)/2);i[s]=r[0].idx;let a=s-1,l=s+1;for(let e=1;r.length>e;e++)e%2==1&&o>l||0>a?i[l++]=r[e].idx:i[a--]=r[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),w()):"crossing-min+inside-out"===c&&(k(),dv(g,m,t),function(e,t,o){const n=e.length;if(1>=n)return;const r=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((n-1)/2);let s=cv(t,o);for(const{slot:a}of r){const r=e.indexOf(a);if(0>r)continue;const l=i;if(r===l)continue;const c=e[r];e.splice(r,1),e.splice(l,0,c);const u=new Map;for(let e=0;n>e;e++)u.set(e,e);if(l>r){for(let e=r+1;l>=e;e++)u.set(e,e-1);u.set(r,l)}else{for(let e=l;r>e;e++)u.set(e,e+1);u.set(r,l)}for(const e of Object.keys(t))t[e]=u.get(t[e]);const d=cv(t,o);if(d>s){const o=e[l];e.splice(l,1),e.splice(r,0,o);const i=new Map;for(let e=0;n>e;e++)i.set(e,e);if(r>l){for(let e=l+1;r>=e;e++)i.set(e,e-1);i.set(l,r)}else{for(let e=r;l>e;e++)i.set(e,e+1);i.set(l,r)}for(const e of Object.keys(t))t[e]=i.get(t[e])}else s=d}}(g,m,t),w());const S=g.map(e=>{const t=new Map;for(const n of e.occupants){const e=o[n.id];if(e)for(const o of e.samples){const e=t.get(o.t)||{top:0,bot:0};t.set(o.t,{top:Math.max(e.top,o.topMass),bot:Math.max(e.bot,o.botMass)})}}return[...t.entries()].sort((e,t)=>e[0]-t[0])}),A=(e,t)=>{let o={top:0,bot:0};for(const[n,r]of e){if(n>t)break;o=r}return o},C=[];for(let e=0;g.length-1>e;e++){const t=S[e],o=S[e+1],n=new Set([...t.map(e=>e[0]),...o.map(e=>e[0])]);let r=0;for(const e of n){const n=A(t,e),i=A(o,e);n.bot+i.top>r&&(r=n.bot+i.top)}C.push(r)}const M=[];let _=s+(g[0]?.peak.topPeak??0)*a;g.length>0&&M.push(_);for(let e=1;g.length>e;e++)_+=C[e-1]*a+s,M.push(_);if(g.length>0&&(_+=g[g.length-1].peak.botPeak*a+s),_>i){const e=i/_;for(let t=0;M.length>t;t++)M[t]*=e}const j=0===g.length?0:g[0].peak.topPeak+C.reduce((e,t)=>e+t,0)+g[g.length-1].peak.botPeak,R={};for(const t of e)R[t.id]=M[m[t.id]];return{effectiveSlotsHeight:j,centerlines:R,laneLifetime:p,slots:g,slotByNode:m,slotCenter:M,crossingsBefore:y,crossingsAfter:b,lengthBefore:v,lengthAfter:x}}h();var fv=e=>{const{bands:t=[],ribbons:o=[],showLabels:n=!0}=e.config,r=[];for(const e of o)r.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];r.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)r.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=n?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:r,labels:i}};function pv(e){return"object"==typeof e&&null!==e&&"__kind"in e&&("band"===e.__kind||"ribbon"===e.__kind)}var mv=require("react/jsx-runtime");function gv(e){return null==e?NaN:e instanceof Date?e.getTime():"number"==typeof e?e:new Date(e).getTime()}function yv(e,t){return"function"==typeof e?e(t):t[e]}var bv=(0,ov.forwardRef)(function(e,t){const{nodes:o,edges:n,domain:r,axisTicks:i=[],nodeIdAccessor:s="id",sourceAccessor:a="source",targetAccessor:l="target",valueAccessor:c="value",startTimeAccessor:u="startTime",endTimeAccessor:d="endTime",systemInTimeAccessor:h,systemOutTimeAccessor:f,xExtentAccessor:p="xExtent",edgeIdAccessor:m="id",colorBy:g,colorScheme:y,showLegend:b,legendPosition:v="right",pairing:x="temporal",packing:k="reuse",laneOrder:w="crossing-min",ribbonLane:S="both",lifetimeMode:A="half",showLaneRails:C=!1,showQualityReadout:M=!1,showLabels:_=!0,width:j=600,height:R=400,margin:P,title:L,description:T,summary:I,accessibleTable:$,responsiveWidth:N,responsiveHeight:D,loading:E,loadingContent:B,emptyContent:F,edgeOpacity:O=.35,timeFormat:z,valueFormat:W,tooltip:q,enableHover:Y=!0,onObservation:G,onClick:V,showParticles:X=!1,particleStyle:U,chartId:K,frameProps:Z={}}=e,[Q,J]=(0,ev.useState)([]),[ee,te]=(0,ev.useState)([]),oe=(0,ev.useRef)(Q),ne=(0,ev.useRef)(ee);oe.current=Q,ne.current=ee;const re=(0,ev.useCallback)(e=>{oe.current=e,J(e)},[]),ie=(0,ev.useCallback)(e=>{ne.current=e,te(e)},[]),se=void 0!==n,ae=H(se?n:Q),le=(0,ev.useMemo)(()=>{const e=H(o??[]),t=ee;if(0===e.length&&0===t.length)return zb([],ae,a,l);const n=new Set,r=[];for(const t of e){const e=yv(s,t)+"";n.has(e)||(n.add(e),r.push(t))}for(const e of t){const t=yv(s,e)+"";n.has(t)||(n.add(t),r.push(e))}const i=zb([],ae,a,l);for(const e of i)n.has(e.id)||(n.add(e.id),r.push(e));return r},[o,ee,ae,s,a,l]),ce=(0,ev.useRef)(null),ue=(0,ev.useCallback)((e,t)=>{const o=yv(m,e);return null!=o?o+"":`${yv(a,e)}-${yv(l,e)}-${t}`},[m,a,l]),de=(0,ev.useCallback)(e=>{if(null==e)return!1;const t=e;return null!=yv(a,t)&&null!=yv(l,t)},[a,l]);vm(t,{variant:"network",frameRef:ce,overrides:{push(e){if(de(e)){if(se)return void console.warn("ProcessSankey.push: edge ignored — `edges` prop is controlled.");re([...oe.current,e])}else ie([...ne.current,e])},pushMany(e){const t=[],o=[];for(const n of e)de(n)?t.push(n):o.push(n);t.length>0&&(se?console.warn("ProcessSankey.pushMany: edges ignored — `edges` prop is controlled."):re([...oe.current,...t])),o.length>0&&ie([...ne.current,...o])},remove(e){const t=new Set(Array.isArray(e)?e:[e]),o=[];if(!se){const e=oe.current,n=[];for(let r=0;e.length>r;r++){const i=e[r];t.has(ue(i,r))?o.push(i):n.push(i)}n.length!==e.length&&re(n)}const n=ne.current,r=[];for(const e of n){const n=yv(s,e)+"";t.has(n)?o.push(e):r.push(e)}return r.length!==n.length&&ie(r),o},update(e,t){const o=new Set(Array.isArray(e)?e:[e]),n=[];if(!se){let e=!1;const r=oe.current.map((r,i)=>o.has(ue(r,i))?(n.push(r),e=!0,t(r)):r);e&&re(r)}let r=!1;const i=ne.current.map(e=>{const i=yv(s,e)+"";return o.has(i)?(n.push(e),r=!0,t(e)):e});return r&&ie(i),n},clear(){se||re([]),ie([]),ce.current?.clear()},getData:()=>ae??[],getScales:()=>null}});const he=ue,fe=(0,ev.useCallback)(e=>yv(s,e)+"",[s]),{nodes:pe,edges:me,domain:ge,rawNodeById:ye,rawEdgeById:be}=(0,ev.useMemo)(()=>{const e=(le??[]).map(e=>{const t={id:fe(e),__raw:e},o=p?yv(p,e):null;if(Array.isArray(o)&&2===o.length){const e=gv(o[0]),n=gv(o[1]);Number.isFinite(e)&&Number.isFinite(n)&&(t.xExtent=[e,n])}return t}),t=(ae??[]).map((e,t)=>{const o={id:he(e,t),source:yv(a,e)+"",target:yv(l,e)+"",value:Number(yv(c,e)),startTime:gv(yv(u,e)),endTime:gv(yv(d,e)),__raw:e};if(h){const t=gv(yv(h,e));Number.isFinite(t)&&(o.systemInTime=t)}if(f){const t=gv(yv(f,e));Number.isFinite(t)&&(o.systemOutTime=t)}return o}),o=[gv(r[0]),gv(r[1])],n=new Map;for(const t of e)null!=t.__raw&&n.set(t.id,t.__raw);const i=new Map;for(const e of t)null!=e.__raw&&i.set(e.id,e.__raw);return{nodes:e,edges:t,domain:o,rawNodeById:n,rawEdgeById:i}},[le,ae,r,fe,he,p,a,l,c,u,d,h,f]),ve=Yb({nodes:le,edges:ae,inferNodes:!1,nodeIdAccessor:s,sourceAccessor:a,targetAccessor:l,colorBy:g,colorScheme:y,showLegend:!1,legendPosition:v,selection:void 0,linkedHover:void 0,onObservation:G,onClick:V,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,chartType:"ProcessSankey",chartId:K,marginDefaults:{top:30,right:80,bottom:40,left:80},userMargin:P,width:j,height:R,loading:E,loadingContent:B,emptyContent:F}),xe=(b??!!g)&&!!g,ke=(0,ev.useCallback)(e=>null!=P&&("number"==typeof P||null!=P[e]),[P]),we=(0,ev.useMemo)(()=>{const e={...ve.margin};return xe&&("right"===v&&!ke("right")&&140>e.right?e.right=140:"bottom"===v&&!ke("bottom")&&80>e.bottom&&(e.bottom=80)),e},[ve.margin,xe,v,ke]),Se=j-we.left-we.right,Ae=R-we.top-we.bottom,Ce=(0,ev.useMemo)(()=>function(e,t,o){const n=[],r=new Set(e.map(e=>e.id)),i=Array.isArray(o)&&2===o.length,s=i&&Number.isFinite(o[0])&&Number.isFinite(o[1]);i&&s&&s&&o[1]>=o[0]||n.push({kind:"invalid-domain"});for(const t of e)null!=t.xExtent&&(Array.isArray(t.xExtent)&&2===t.xExtent.length&&Number.isFinite(t.xExtent[0])&&Number.isFinite(t.xExtent[1])&&t.xExtent[1]>=t.xExtent[0]||n.push({kind:"invalid-node-time",id:t.id}));for(const e of t)r.has(e.source)||n.push({kind:"missing-node",id:e.id,endpoint:"source",nodeId:e.source}),r.has(e.target)||n.push({kind:"missing-node",id:e.id,endpoint:"target",nodeId:e.target}),Number.isFinite(e.startTime)&&Number.isFinite(e.endTime)?(Number.isFinite(e.value)&&e.value>0||n.push({kind:"invalid-value",id:e.id}),e.endTime>e.startTime||n.push({kind:"backward-edge",id:e.id,source:e.source,target:e.target})):n.push({kind:"invalid-edge-time",id:e.id});return n}(pe,me,ge),[pe,me,ge]),Me=(0,ev.useMemo)(()=>Ce.length>0?null:function(e,t,o){const{plotH:n,pairing:r="temporal",packing:i="reuse",laneOrder:s="crossing-min",lifetimeMode:a="half"}=o,l=function(e,t){const o={},n={};for(const t of e)o[t.id]=[],n[t.id]=[];for(const e of t)n[e.source]&&n[e.source].push(e),o[e.target]&&o[e.target].push(e);return{incoming:o,outgoing:n}}(e,t),c=function(e,t,o,n="value"){const r="temporal"===n?(e,t)=>e.endTime-t.endTime:(e,t)=>t.value-e.value,i="temporal"===n?(e,t)=>e.startTime-t.startTime:(e,t)=>t.value-e.value,s=new Map;for(const e of t)s.set(e.id,{});const a=(e,t)=>{const o=new Map;for(const n of e){const e=n[t];o.has(e)||o.set(e,{partner:e,edges:[],total:0,earliestStart:1/0,latestEnd:-1/0});const r=o.get(e);r.edges.push(n),r.total+=n.value,r.earliestStart=Math.min(r.earliestStart,n.startTime),r.latestEnd=Math.max(r.latestEnd,n.endTime)}const s=[...o.values()];s.sort("temporal"===n?(e,o)=>"target"===t?e.earliestStart-o.earliestStart:e.latestEnd-o.latestEnd:(e,t)=>t.total-e.total);for(const e of s)e.edges.sort("target"===t?i:r);return s};for(const t of e){const e=o.outgoing[t.id],n=o.incoming[t.id];if(0===n.length)a(e,"target").forEach((e,t)=>{const o=t%2==0?"top":"bot";for(const t of e.edges)s.get(t.id).sourceSide=o});else if(0===e.length)a(n,"source").forEach((e,t)=>{const o=t%2==0?"top":"bot";for(const t of e.edges)s.get(t.id).targetSide=o});else{const t=a(n,"source"),o=a(e,"target"),r=Math.max(t.length,o.length);for(let e=0;r>e;e++){const n=e%2==0?"top":"bot";if(t[e])for(const o of t[e].edges)s.get(o.id).targetSide=n;if(o[e])for(const t of o[e].edges)s.get(t.id).sourceSide=n}}}return s}(e,t,l,r);let u={};for(const t of e)u[t.id]=nv(t,l,c);const d=hv(e,t,u,l,{plotH:n,padding:12,valueScale:1,packing:i,laneOrder:s,lifetimeMode:a}),h=new Set;for(const e of t){const t=d.slotByNode[e.source],o=d.slotByNode[e.target];if(void 0===t||void 0===o)continue;const n=c.get(e.id);t!==o?t>o?(n.sourceSide="top",n.targetSide="bot"):(n.sourceSide="bot",n.targetSide="top"):(h.add(e.id),n.sourceSide="bot",n.targetSide="bot")}for(const t of e){const e=l.outgoing[t.id],o=l.incoming[t.id],n=new Set(e.map(e=>c.get(e.id).sourceSide)),r=new Set(o.map(e=>c.get(e.id).targetSide));if(1===n.size&&o.length>0){const e=[...n][0];for(const t of o)d.slotByNode[t.source]===d.slotByNode[t.target]&&(c.get(t.id).targetSide=e)}if(1===r.size&&e.length>0){const t=[...r][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 n=()=>{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},r=(e,t)=>{const r=n(),i="top"===e?r.outTop-r.inTop:r.outBot-r.inBot,s="top"===t?r.inTop-r.outTop:r.inBot-r.outBot;if(0>=i||0>=s)return!1;const a=Math.min(i,s),l=o.filter(t=>!h.has(t.id)&&c.get(t.id).sourceSide===e&&a>=t.value).sort((e,t)=>t.value-e.value);return 0!==l.length&&(c.get(l[0].id).sourceSide=t,!0)};let i=o.length+1;for(;i-- >0&&(r("top","bot")||r("bot","top")););}u={};for(const t of e)u[t.id]=nv(t,l,c);const f=hv(e,t,u,l,{plotH:n,padding:12,valueScale:1,packing:i,laneOrder:s,lifetimeMode:a}),p=f.effectiveSlotsHeight??f.slots.reduce((e,t)=>e+t.peak.topPeak+t.peak.botPeak,0),m=Math.min(12,.35*n/Math.max(f.slots.length+1,1)),g=p>0?Math.max(0,(n-m*(f.slots.length+1))/p):1,y=hv(e,t,u,l,{plotH:n,padding:m,valueScale:g,packing:i,laneOrder:s,lifetimeMode:a});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}}(pe,me,{plotH:Ae,pairing:x,packing:k,laneOrder:w,lifetimeMode:A}),[Ce,pe,me,Ae,x,k,w,A]),_e=(0,ev.useMemo)(()=>(0,tv.scaleTime)().domain(ge).range([0,Se]),[ge,Se]),je=(0,ev.useCallback)((e,t)=>{if(g&&le){const t=ye.get(e);if(t)return ze(t,g,ve.colorScale)}return ve.effectivePalette[t%ve.effectivePalette.length]||"#475569"},[g,le,ye,ve.colorScale,ve.effectivePalette]),Re=(0,ev.useMemo)(()=>{const e=new Map;return pe.forEach((t,o)=>e.set(t.id,o)),e},[pe]),Pe=(0,ev.useMemo)(()=>{if(!Me)return{bands:[],ribbons:[]};const{centerlines:e,nodeData:t,valueScale:o}=Me,n=[],r=[];return pe.forEach((r,i)=>{const s=t[r.id];if(!s||0===s.samples.length)return;const a=function(e,t,o,n,r){if(0===e.length)return null;const i=iv(e,r),s=e=>t-i[e].topMass*o,a=e=>t+i[e].botMass*o;let l=`M${n(i[0].t)},${s(0)}`;for(let e=1;i.length>e;e++)l+=` L${n(i[e].t)},${s(e)}`;l+=` L${n(i[i.length-1].t)},${a(i.length-1)}`;for(let e=i.length-2;e>=0;e--)l+=` L${n(i[e].t)},${a(e)}`;return l+" Z"}(s.samples,e[r.id],o,_e,ge);if(!a)return;const l=iv(s.samples,ge),c=l.find(e=>e.topMass+e.botMass>0)||l[0],u=e[r.id]+(c.botMass-c.topMass)*o/2,d=je(r.id,i),h=ye.get(r.id)??r,f=function(e,t,o,n,r){const i=o.nodeData[e];if(!i||0===i.samples.length)return[];const s=o.valueScale,a=o.centerlines[e],l=iv(i.samples,r),c=l.find(e=>e.topMass+e.botMass>0)||l[0],u=[...l].reverse().find(e=>e.topMass+e.botMass>0)||l[l.length-1],d=n(c.t),h=n(u.t),f=e=>n(rv(e,r)),p=[],m=(e,t,o,n)=>`M${e},${t} L${o},${t} L${o},${n} L${e},${n} Z`;for(const o of t){if(o.source===e&&null!=o.systemInTime&&Number.isFinite(o.systemInTime)){const e=i.localAttachments.get(o.id);if(e&&"out"===e.kind&&o.startTime>o.systemInTime){const t=f(o.systemInTime),n=f(o.startTime),r=t-20,i=Math.max(d,r);if(n>i){const[o,l]=sv(e,a,s);p.push({pathD:m(i,o,n,l),x0:r,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=f(o.systemOutTime),n=f(o.endTime),r=t+20,i=Math.min(h,r);if(i>n){const[o,l]=sv(e,a,s);p.push({pathD:m(n,o,i,l),x0:t,x1:r,from:1,to:0})}}}}return p}(r.id,me,Me,_e,ge);n.push({id:r.id,pathD:a,fill:d,stroke:d,strokeWidth:.5,...f.length>0&&{gradientStubs:f},rawDatum:h,labelX:_e(c.t)-4,labelY:u,labelText:r.id})}),me.forEach(n=>{const i=t[n.source]?.localAttachments.get(n.id),s=t[n.target]?.localAttachments.get(n.id);if(!i||!s)return;const a=Re.get(n.source)??0,l=je(n.source,a),c=function(e,t,o,n,r,i,s,a){const l=r,c=e=>a?Math.max(a[0],Math.min(a[1],e)):e,u=i(c(e.time)),d=i(c(o.time)),h=e.value*l,f=o.value*l,p=e.sideMassBefore*l,m=o.sideMassAfter*l;let g,y,b,v;"top"===e.side?(g=t-p,y=g+h):(y=t+p,g=y-h),"top"===o.side?(b=n-m,v=b+f):(v=n+m,b=v-f);const x="source"===s?u+.85*(d-u):"target"===s?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[n.source],s,e[n.target],o,_e,S,ge),{pathD:u,bezier:d}=_d(c),h=be.get(n.id)??n;r.push({id:n.id,pathD:u,fill:l,opacity:O,rawDatum:h,bezier:d})}),{bands:n,ribbons:r}},[Me,pe,me,_e,ge,je,ye,be,S,O,Re]),Le=(0,ev.useMemo)(()=>({bands:Pe.bands,ribbons:Pe.ribbons,showLabels:_}),[Pe,_]),Te=(0,ev.useMemo)(()=>{if(!xe||!g)return;const e=new Map;(le??[]).forEach((t,o)=>{const n=yv(g,t),r=null==n?"":n+"";r&&!e.has(r)&&e.set(r,{label:r,color:je(fe(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,je,fe]),Ie=(0,ev.useMemo)(()=>!1!==q&&Y?void 0===q||!0===q?null:Sa(q)||null:null,[q,Y]),$e=(0,ev.useCallback)(e=>z?z(new Date(e)):Number.isFinite(e)?1e10>Math.abs(e)?Number.isInteger(e)?e+"":e.toFixed(2):new Date(e).toISOString().slice(0,10):"",[z]),Ne=(0,ev.useCallback)(e=>W?W(e):e+"",[W]),De=(0,ev.useCallback)(e=>{if(!e||!e.data)return null;const t=e.data;if(!pv(t))return null;const o=t.data;if(Ie)return Ie(o);if("band"===t.__kind){const e=t.id,o=Me?function(e){if(!e)return[];const t=new Set,o=[];for(const n of e.samples){const e=n.topMass+n.botMass,r=`${n.t}:${e}`;t.has(r)||(t.add(r),o.push({t:n.t,total:e}))}return o}(Me.nodeData[e]):[],n=5,r=o.length>n?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),n=o.length-1,r=[{...o[0],mark:"min"},{...o[Math.floor(.25*n)],mark:"q25"},{...o[Math.floor(.5*n)],mark:"median"},{...o[Math.floor(.75*n)],mark:"q75"},{...o[n],mark:"max"}],i=new Set,s=[];for(const e of r)i.has(e.t)||(i.add(e.t),s.push(e));return s.sort((e,t)=>e.t-t.t)}(o,n);return(0,mv.jsxs)("div",{style:{minWidth:160},children:[(0,mv.jsx)("div",{style:{fontWeight:600,marginBottom:4},children:e}),i.length>0&&(0,mv.jsxs)("table",{style:{borderCollapse:"collapse",fontSize:11,width:"100%"},children:[(0,mv.jsx)("thead",{children:(0,mv.jsxs)("tr",{style:{opacity:.6},children:[(0,mv.jsx)("th",{style:{textAlign:"left",fontWeight:500,paddingRight:8},children:"Time"}),(0,mv.jsx)("th",{style:{textAlign:"right",fontWeight:500},children:"Mass"}),null!=r&&(0,mv.jsx)("th",{})]})}),(0,mv.jsx)("tbody",{children:i.map((e,t)=>(0,mv.jsxs)("tr",{children:[(0,mv.jsx)("td",{style:{paddingRight:8},children:$e(e.t)}),(0,mv.jsx)("td",{style:{textAlign:"right"},children:Ne(e.total)}),null!=r&&(0,mv.jsx)("td",{style:{textAlign:"right",paddingLeft:8,opacity:.55},children:e.mark})]},t))})]}),null!=r&&(0,mv.jsxs)("div",{style:{marginTop:4,fontSize:10,opacity:.55},children:["showing ",i.length," of ",r," samples"]})]})}const n=o,r=yv(a,n),i=yv(l,n),s=yv(c,n),h=yv(u,n),f=yv(d,n);return(0,mv.jsxs)("div",{style:{minWidth:160},children:[(0,mv.jsxs)("div",{style:{fontWeight:600,marginBottom:4},children:[r+""," → ",i+""]}),(0,mv.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"auto 1fr",columnGap:8,fontSize:11},children:[null!=s&&(0,mv.jsxs)(mv.Fragment,{children:[(0,mv.jsx)("span",{style:{opacity:.6},children:"value"}),(0,mv.jsx)("span",{style:{textAlign:"right"},children:Ne(Number(s))})]}),null!=h&&(0,mv.jsxs)(mv.Fragment,{children:[(0,mv.jsx)("span",{style:{opacity:.6},children:"start"}),(0,mv.jsx)("span",{style:{textAlign:"right"},children:$e(gv(h))})]}),null!=f&&(0,mv.jsxs)(mv.Fragment,{children:[(0,mv.jsx)("span",{style:{opacity:.6},children:"end"}),(0,mv.jsx)("span",{style:{textAlign:"right"},children:$e(gv(f))})]})]})]})},[Me,Ie,$e,Ne,a,l,c,u,d]),Ee=(0,ev.useMemo)(()=>{if(!Me)return null;const{centerlines:e,laneLifetime:t,nodeData:o,valueScale:n,compressedPadding:r,crossingsBefore:s,crossingsAfter:a,lengthBefore:l,lengthAfter:c}=Me;let u=null,d=null;for(const e of pe){const o=t[e.id];if(!o||null===o.start||null===o.end)continue;const n=_e(o.start),r=_e(o.end);(null===u||u>n)&&(u=n),(null===d||r>d)&&(d=r)}const h=e=>Math.max(0,Math.min(Se,e)),f=h(u??0),p=Math.max(f,h(d??Se));return(0,mv.jsxs)("g",{children:[M&&null!==(a??null)&&(0,mv.jsxs)("text",{x:Se,y:-12,fontSize:10,fill:"#94a3b8",textAnchor:"end",children:["crossings: ",s," → ",a," ","edge length: ",Math.round(l)," → ",Math.round(c)]}),r&&(0,mv.jsx)("text",{x:Se,y:2,fontSize:10,fill:"#94a3b8",textAnchor:"end",children:"dense layout: lane gaps compressed"}),i.map((e,t)=>{const o=_e(gv(e.date));return f-.5>o||o>p+.5?null:(0,mv.jsx)("line",{x1:o,y1:0,x2:o,y2:Ae,stroke:"#94a3b8",strokeOpacity:.15,strokeDasharray:"2 4"},"grid-"+t)}),C&&pe.map((r,i)=>{const s=t[r.id];if(!s||null===s.start)return null;const a=o[r.id],l=a?{topPeak:a.topPeak,botPeak:a.botPeak}:{topPeak:0,botPeak:0},c=e[r.id]+(l.botPeak-l.topPeak)*n/2,u=_e(s.start),d=_e(s.end),h=je(r.id,i);return(0,mv.jsxs)("g",{children:[(0,mv.jsx)("line",{x1:u,y1:c,x2:d,y2:c,stroke:h,strokeOpacity:.35,strokeWidth:1,strokeDasharray:"3 3"}),(0,mv.jsx)("line",{x1:u,y1:c-4,x2:u,y2:c+4,stroke:h,strokeOpacity:.5}),(0,mv.jsx)("line",{x1:d,y1:c-4,x2:d,y2:c+4,stroke:h,strokeOpacity:.5})]},"lane-"+r.id)}),(0,mv.jsx)("line",{x1:f,y1:Ae+4,x2:p,y2:Ae+4,stroke:"#94a3b8"}),i.map((e,t)=>{const o=gv(e.date),n=_e(o);if(f-.5>n||n>p+.5)return null;const r=null!=e.label?e.label:z?z(new Date(o)):"";return(0,mv.jsxs)("g",{transform:`translate(${n},${Ae+4})`,children:[(0,mv.jsx)("line",{y2:6,stroke:"#94a3b8"}),(0,mv.jsx)("text",{y:20,textAnchor:"middle",fontSize:11,fill:"#475569",children:r})]},t)})]})},[Me,i,_e,Se,Ae,C,pe,je,M,z]),Be=(0,ev.useMemo)(()=>(le??[]).map(e=>({id:fe(e),data:e})),[le,fe]),Fe=(0,ev.useMemo)(()=>{const e=new Map;for(const t of Pe.ribbons)t.bezier&&e.set(t.id,t.bezier);return e},[Pe]),He=(0,ev.useMemo)(()=>(ae??[]).map((e,t)=>{const o=he(e,t),n=Number(yv(c,e));return{id:o,source:yv(a,e)+"",target:yv(l,e)+"",value:Number.isFinite(n)?n:0,bezier:Fe.get(o),data:e}}),[ae,he,a,l,c,Fe]),Oe=ve.loadingEl,We=ve.emptyEl;return Ce.length>0?(0,mv.jsxs)("svg",{width:j,height:R,role:"img","aria-label":L??"Process Sankey validation failed",children:[(0,mv.jsx)("text",{x:20,y:30,fontSize:13,fontWeight:600,fill:"var(--semiotic-danger, #dc2626)",children:"ProcessSankey: data invalid"}),Ce.map((e,t)=>{return(0,mv.jsx)("text",{x:20,y:56+18*t,fontSize:12,fill:"#64748b",children:"• "+(o=e,"invalid-node-time"===o.kind?`node ${o.id} has an invalid xExtent (must be [start, end] with start <= end)`:"invalid-edge-time"===o.kind?`edge ${o.id} has an invalid startTime or endTime`:"invalid-domain"===o.kind?"time domain must be a 2-tuple of finite times [start, end] with start <= end":"invalid-value"===o.kind?`edge ${o.id} must have a positive finite value`:"missing-node"===o.kind?`edge ${o.id} references missing ${o.endpoint} node "${o.nodeId}"`:"backward-edge"===o.kind?`edge ${o.id} (${o.source}->${o.target}) ends before it starts`:o.kind)},t);var o})]}):Oe||We||(0,mv.jsx)(If,{ref:ce,chartType:"force",nodes:Be,edges:He,customNetworkLayout:fv,layoutConfig:Le,size:[j,R],responsiveWidth:N,responsiveHeight:D,margin:we,title:L,description:T??"Temporal process flow with lifetime-bounded node lanes, mass bands, and value-scaled ribbons.",summary:I,accessibleTable:$,enableHover:Y,tooltipContent:!1===q?()=>null:De,backgroundGraphics:Ee,showParticles:X,particleStyle:U,legend:Te,legendPosition:v,onObservation:G,...V&&{customClickBehavior:e=>{if(!e||!e.data||!V)return;const t=e.data;pv(t)&&V(t.data,{x:e.x,y:e.y})}},chartId:K,colorScheme:Array.isArray(y)?y:void 0,...Z})});bv.displayName="ProcessSankey";var vv=require("react"),xv=require("react/jsx-runtime");function kv(e){const t=sm(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:n,className:r,layout:i="tree",orientation:s="vertical",childrenAccessor:a="children",valueAccessor:l="value",nodeIdAccessor:c="name",colorBy:u,colorScheme:d,colorByDepth:h=!1,edgeStyle:f="curve",nodeLabel:p,nodeSize:m=5,tooltip:g,frameProps:y={},onObservation:b,onClick:v,chartId:x,selection:k,linkedHover:w,loading:S,loadingContent:A,legendInteraction:C,stroke:M,strokeWidth:_,opacity:j}=e,{width:R,height:P,enableHover:L,showLabels:T=!0,title:I,description:$,summary:N,accessibleTable:D}=t,E=Yb({nodes:(0,vv.useMemo)(()=>Ob(o??null,a),[o,a]),edges:void 0,inferNodes:!1,colorBy:h?void 0:u,colorScheme:d,showLegend:!1,legendInteraction:C,selection:k,linkedHover:w,onObservation:b,onClick:v,mobileInteraction:t.mobileInteraction,mobileSemantics:t.mobileSemantics,chartType:"TreeDiagram",chartId:x,marginDefaults:t.marginDefaults,userMargin:n,width:R,height:P,loading:S,loadingContent:A}),B=(0,vv.useMemo)(()=>new Map,[]),F=(0,vv.useMemo)(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=h?He[(e.depth||0)%He.length]:u?ze(e.data||e,u,E.colorScale):Qp(void 0,E.themeCategorical,d,void 0,B),t},[u,h,E.colorScale,E.themeCategorical,d,B]),H=(0,vv.useMemo)(()=>km(F,{stroke:M,strokeWidth:_,opacity:j}),[F,M,_,j]),O=(0,vv.useMemo)(()=>()=>({stroke:"#999",strokeWidth:1,fill:"none"}),[]),z=(0,vv.useMemo)(()=>km(O,{stroke:M,strokeWidth:_,opacity:j}),[O,M,_,j]),W=(0,vv.useMemo)(()=>{if("treemap"===i||"circlepack"===i||"partition"===i)return Wb(l)},[i,l]),q=hm({componentName:"TreeDiagram",data:o});return q?(0,xv.jsx)(Oh,{componentName:"TreeDiagram",message:q,width:R,height:P}):E.loadingEl?E.loadingEl:(0,xv.jsx)(Gh,{componentName:"TreeDiagram",width:R,height:P,children:(0,xv.jsx)(If,{chartType:i,...null!=o&&{data:o},size:[R,P],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:E.margin,nodeIDAccessor:c,childrenAccessor:a,hierarchySum:W,treeOrientation:s,edgeType:f,nodeStyle:H,edgeStyle:z,colorBy:u,colorScheme:E.effectivePalette,colorByDepth:h,nodeSize:m,nodeLabel:T?p||c:void 0,showLabels:T,enableHover:L,tooltipContent:!1===g?()=>null:Sa(g)||void 0,...Nf({linkedHover:w,selection:k,onObservation:b,onClick:v,mobileInteraction:E.mobileInteraction,customHoverBehavior:E.customHoverBehavior,customClickBehavior:E.customClickBehavior,linkedHoverInClickPredicate:!1}),...C&&"none"!==C&&{legendHoverBehavior:E.legendState.onLegendHover,legendClickBehavior:E.legendState.onLegendClick,legendHighlightedCategory:E.legendState.highlightedCategory,legendIsolatedCategories:E.legendState.isolatedCategories},className:r,title:I,description:$,summary:N,accessibleTable:D,...null!=e.animate&&{animate:e.animate},...y})})}kv.displayName="TreeDiagram";var wv=require("react"),Sv=require("react/jsx-runtime");function Av(e){const t=sm(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:n,className:r,childrenAccessor:i="children",valueAccessor:s="value",nodeIdAccessor:a="name",colorBy:l,colorScheme:c,colorByDepth:u=!1,labelMode:d="leaf",nodeLabel:h,padding:f=4,paddingTop:p,nodeStyle:m,tooltip:g,frameProps:y={},selection:b,linkedHover:v,onObservation:x,onClick:k,chartId:w,loading:S,loadingContent:A,legendInteraction:C,stroke:M,strokeWidth:_,opacity:j}=e,{nodeStyle:R,...P}=y,{width:L,height:T,enableHover:I,showLabels:$=!0,title:N,description:D,summary:E,accessibleTable:B}=t,F=Yb({nodes:(0,wv.useMemo)(()=>Ob(o??null,i),[o,i]),edges:void 0,inferNodes:!1,colorBy:u?void 0:l,colorScheme:c,showLegend:!1,legendInteraction:C,selection:b,linkedHover:v,onObservation:x,onClick:k,mobileInteraction:t.mobileInteraction,mobileSemantics:t.mobileSemantics,chartType:"Treemap",chartId:w,marginDefaults:t.marginDefaults,userMargin:n,width:L,height:T,loading:S,loadingContent:A}),H=gm(b),O=F.customHoverBehavior,z=(0,wv.useCallback)(e=>{if(!e)return O(null);const t=e.data||e;O({data:t?.data||t})},[O]),W=(0,wv.useMemo)(()=>new Map,[]),q=(0,wv.useMemo)(()=>e=>{const t={stroke:"var(--semiotic-cell-border, var(--semiotic-border, #fff))",strokeWidth:1,strokeOpacity:.8};return t.fill=u?He[(e.depth||0)%He.length]:l?ze(e.data||e,l,F.colorScale):Qp(void 0,F.themeCategorical,c,void 0,W),t},[l,u,F.colorScale,F.themeCategorical,c,W]),Y=(0,wv.useMemo)(()=>m||R?e=>({...q(e),...R?R(e)??{}:{},...m?m(e)??{}:{}}):q,[q,m,R]),G=(0,wv.useMemo)(()=>km(Y,{stroke:M,strokeWidth:_,opacity:j}),[Y,M,_,j]),V=(0,wv.useMemo)(()=>F.activeSelectionHook?e=>{const t={...G(e)};if(F.activeSelectionHook.isActive)if(F.activeSelectionHook.predicate(e.data||e))H?.selectedStyle&&Object.assign(t,H.selectedStyle);else{const e=H?.unselectedOpacity??Sp;t.opacity=e,t.fillOpacity=e,t.strokeOpacity=e,H?.unselectedStyle&&Object.assign(t,H.unselectedStyle)}return t}:G,[G,F.activeSelectionHook,H]),X=(0,wv.useMemo)(()=>Wb(s),[s]),U=void 0!==p?p:!$||"parent"!==d&&"all"!==d?void 0:18,K=hm({componentName:"Treemap",data:o});return K?(0,Sv.jsx)(Oh,{componentName:"Treemap",message:K,width:L,height:T}):F.loadingEl?F.loadingEl:(0,Sv.jsx)(Gh,{componentName:"Treemap",width:L,height:T,children:(0,Sv.jsx)(If,{chartType:"treemap",...null!=o&&{data:o},size:[L,T],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:F.margin,nodeIDAccessor:a,childrenAccessor:i,hierarchySum:X,padding:f,paddingTop:U,nodeStyle:V,colorBy:l,colorScheme:F.effectivePalette,colorByDepth:u,nodeLabel:$?h||a:void 0,showLabels:$,labelMode:d,enableHover:I,tooltipContent:!1===g?()=>null:Sa(g)||void 0,...Nf({linkedHover:v,selection:b,onObservation:x,onClick:k,mobileInteraction:F.mobileInteraction,customHoverBehavior:z,customClickBehavior:F.customClickBehavior,linkedHoverInClickPredicate:!1}),...C&&"none"!==C&&{legendHoverBehavior:F.legendState.onLegendHover,legendClickBehavior:F.legendState.onLegendClick,legendHighlightedCategory:F.legendState.highlightedCategory,legendIsolatedCategories:F.legendState.isolatedCategories},className:r,title:N,description:D,summary:E,accessibleTable:B,...null!=e.animate&&{animate:e.animate},...P})})}Av.displayName="Treemap";var Cv=require("react"),Mv=require("react/jsx-runtime");function _v(e){const t=sm(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:n,className:r,childrenAccessor:i="children",valueAccessor:s="value",nodeIdAccessor:a="name",colorBy:l,colorScheme:c,colorByDepth:u=!1,nodeLabel:d,circleOpacity:h=.7,padding:f=4,tooltip:p,frameProps:m={},onObservation:g,onClick:y,chartId:b,selection:v,linkedHover:x,loading:k,loadingContent:w,legendInteraction:S,stroke:A,strokeWidth:C,opacity:M}=e,{width:_,height:j,enableHover:R,showLabels:P=!0,title:L,description:T,summary:I,accessibleTable:$}=t,N=Yb({nodes:(0,Cv.useMemo)(()=>Ob(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:n,width:_,height:j,loading:k,loadingContent:w}),D=(0,Cv.useMemo)(()=>new Map,[]),E=(0,Cv.useMemo)(()=>e=>{const t={stroke:"currentColor",strokeWidth:1,strokeOpacity:.3,fillOpacity:h};return t.fill=u?He[(e.depth||0)%He.length]:l?ze(e.data||e,l,N.colorScale):Qp(void 0,N.themeCategorical,c,void 0,D),t},[l,u,N.colorScale,h,N.themeCategorical,c,D]),B=(0,Cv.useMemo)(()=>km(E,{stroke:A,strokeWidth:C,opacity:M}),[E,A,C,M]),F=(0,Cv.useMemo)(()=>Wb(s),[s]),H=hm({componentName:"CirclePack",data:o});return H?(0,Mv.jsx)(Oh,{componentName:"CirclePack",message:H,width:_,height:j}):N.loadingEl?N.loadingEl:(0,Mv.jsx)(Gh,{componentName:"CirclePack",width:_,height:j,children:(0,Mv.jsx)(If,{chartType:"circlepack",...null!=o&&{data:o},size:[_,j],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:N.margin,nodeIDAccessor:a,childrenAccessor:i,hierarchySum:F,padding:f,nodeStyle:B,colorBy:l,colorScheme:N.effectivePalette,colorByDepth:u,nodeLabel:P?d||a:void 0,showLabels:P,enableHover:R,tooltipContent:!1===p?()=>null:Sa(p)||void 0,...Nf({linkedHover:x,selection:v,onObservation:g,onClick:y,mobileInteraction:N.mobileInteraction,customHoverBehavior:N.customHoverBehavior,customClickBehavior:N.customClickBehavior,linkedHoverInClickPredicate:!1}),...S&&"none"!==S&&{legendHoverBehavior:N.legendState.onLegendHover,legendClickBehavior:N.legendState.onLegendClick,legendHighlightedCategory:N.legendState.highlightedCategory,legendIsolatedCategories:N.legendState.isolatedCategories},className:r,title:L,description:T,summary:I,accessibleTable:$,...null!=e.animate&&{animate:e.animate},...m})})}_v.displayName="CirclePack";var jv=require("react"),Rv=require("react/jsx-runtime"),Pv=He;function Lv(e){const t=sm(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:n,className:r,childrenAccessor:i="children",nodeIdAccessor:s="name",colorBy:a,colorScheme:l,colorByDepth:c=!1,orbitMode:u="flat",orbitSize:d=2.95,speed:h=.25,revolution:f,revolutionStyle:p,eccentricity:m=1,showRings:g=!0,nodeRadius:y=6,showLabels:b=!1,animated:v=!0,tooltip:x,foregroundGraphics:k,annotations:w,frameProps:S={},onObservation:A,onClick:C,chartId:M,selection:_,linkedHover:j,loading:R,loadingContent:P,stroke:L,strokeWidth:T,opacity:I}=e,{width:$,height:N,enableHover:D,title:E,description:B,summary:F,accessibleTable:H}=t,O=Yb({nodes:(0,jv.useMemo)(()=>Ob(o,i),[o,i]),edges:void 0,inferNodes:!1,colorBy:c?void 0:a,colorScheme:l,showLegend:!1,legendInteraction:void 0,selection:_,linkedHover:j,onObservation:A,onClick:C,mobileInteraction:t.mobileInteraction,mobileSemantics:t.mobileSemantics,chartType:"OrbitDiagram",chartId:M,marginDefaults:{top:10,right:10,bottom:10,left:10},userMargin:n,width:$,height:N,loading:R,loadingContent:P}),z=(0,jv.useMemo)(()=>new Map,[]),{colorScale:W,customClickBehavior:q,customHoverBehavior:Y,themeCategorical:G}=O,V=(0,jv.useMemo)(()=>{if(Array.isArray(l))return l;const e=Ee[l];return Array.isArray(e)?e:Be},[l]),X=(0,jv.useMemo)(()=>e=>{const t={stroke:"#fff",strokeWidth:1},o=0===(e.depth??0);return t.fill=c?o?V[0]:Pv[(e.depth||0)%Pv.length]:a?ze(e.data||e,a,W):Qp(void 0,G,l,void 0,z),t.opacity=o?1:.85,t},[a,c,W,V,G,l,z]),U=(0,jv.useMemo)(()=>km(X,{stroke:L,strokeWidth:T,opacity:I}),[X,L,T,I]),K=(0,jv.useMemo)(()=>()=>({stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1}),[]),Z=(0,jv.useMemo)(()=>e=>{Y(e&&e.data&&void 0!==e.data.data?{...e,data:e.data.data}:e)},[Y]),Q=(0,jv.useMemo)(()=>e=>{q(e&&e.data&&void 0!==e.data.data?{...e,data:e.data.data}:e)},[q]),J=hm({componentName:"OrbitDiagram",data:o});return J?(0,Rv.jsx)(Oh,{componentName:"OrbitDiagram",message:J,width:$,height:N}):O.loadingEl?O.loadingEl:(0,Rv.jsx)(Gh,{componentName:"OrbitDiagram",width:$,height:N,children:(0,Rv.jsx)(If,{chartType:"orbit",...null!=o&&{data:o},size:[$,N],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:O.margin,nodeIDAccessor:s,childrenAccessor:i,nodeStyle:U,edgeStyle:K,colorBy:a,colorScheme:O.effectivePalette,colorByDepth:c,nodeSize:y,nodeLabel:b?s:void 0,showLabels:b,enableHover:!v&&D,tooltipContent:v?void 0:!1===x?()=>null:Sa(x)||void 0,...Nf({linkedHover:j,selection:_,onObservation:A,onClick:C,mobileInteraction:O.mobileInteraction,customHoverBehavior:Z,customClickBehavior:Q,linkedHoverInClickPredicate:!1}),foregroundGraphics:k,annotations:w,className:r,title:E,description:B,summary:F,orbitMode:u,orbitSize:d,orbitSpeed:h,orbitRevolution:f,orbitRevolutionStyle:p,orbitEccentricity:m,orbitShowRings:g,orbitAnimated:v,accessibleTable:H,...null!=e.animate&&{animate:e.animate},...S})})}Lv.displayName="OrbitDiagram";var Tv=require("react"),Iv=require("react/jsx-runtime"),$v={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"},Nv={opacity:.7,marginRight:4};function Dv(e,t,o){if(null!=e)return"function"==typeof t?t(e):e["string"==typeof t?t:o]}function Ev(e){return null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+""}function Bv(e={}){const{timeAccessor:t,valueAccessor:o,xLabel:n="x",yLabel:r="y"}=e;return e=>{const i=e?.data??null,s=Dv(i,t,"time"),a=Dv(i,o,"value");return(0,Iv.jsxs)("div",{className:"semiotic-tooltip",style:$v,children:[(0,Iv.jsxs)("div",{children:[(0,Iv.jsxs)("span",{style:Nv,children:[n,":"]}),Ev(s)]}),(0,Iv.jsxs)("div",{children:[(0,Iv.jsxs)("span",{style:Nv,children:[r,":"]}),Ev(a)]})]})}}function Fv(e,t){return null!=e?e:Math.max(t?.length??0,200)}var Hv=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}},Ov=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,n=Math.floor(e/o);for(let r=Math.floor((e-this.size)/o)+1;n>=r;r++)this.bump(r*o,t)}bump(e,t){let o=this.windows.get(e);o||(o=new Hv,this.windows.set(e,o)),o.push(t)}pushSession(e,t){const o=this.gap,n=new Hv;n.push(t);let r=e,i=e;const s=[],a={start:r,end:i,stats:n};for(const t of this.sessions)e-o>t.end||t.start>e+o?s.push(t):(a.stats.merge(t.stats),r>t.start&&(r=t.start),t.end>i&&(i=t.end));a.start=r,a.end=i,s.push(a),s.sort((e,t)=>e.start-t.start),this.sessions=s}prune(){if(this.retain===1/0)return;if("session"===this.type)return void(this.sessions.length>this.retain&&(this.sessions=this.sessions.slice(this.sessions.length-this.retain)));if(this.retain>=this.windows.size)return;const e=[...this.windows.keys()].sort((e,t)=>e-t),t=e.length-this.retain;for(let o=0;t>o;o++)this.windows.delete(e[o])}emit(){return"session"===this.type?this.emitSessions():this.emitFixed()}emitFixed(){const e=[];for(const[t,o]of this.windows){const n=t+this.size;e.push(this.row(t,n,o,n>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,n){return{start:e,end:t,count:o.count,mean:o.mean,sum:o.sum,min:o.min,max:o.max,stddev:o.stddev,partial:n}}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 zv(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 Wv={ms:1,s:1e3,m:6e4,h:36e5,d:864e5},qv=/(\d+(?:\.\d+)?)(ms|s|m|h|d)/g;function Yv(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;qv.lastIndex=0;let o,n=0,r=0;for(;null!==(o=qv.exec(t));){const e=parseFloat(o[1]),t=Wv[o[2]];if(null==t||!Number.isFinite(e))return null;n+=e*t,r+=o[0].length}return r!==t.length?null:n>0?n:null}var Gv="time",Vv="value",Xv="__aggLower",Uv="__aggUpper",Kv="__aggPartial",Zv="count",Qv="__aggStart",Jv="__aggEnd";function ex(e,t){const o=t.stat??"mean",n=t.band??"none",r=t.sigma??1;return e.emit().map(e=>{const t={[Gv]:(e.start+e.end)/2,[Vv]:zv(e,o),[Zv]:e.count,[Kv]:e.partial,[Qv]:e.start,[Jv]:e.end},i=function(e,t,o,n=1){if("none"===t)return null;if("minmax"===t)return[e.min,e.max];const r=zv(e,o),i=e.stddev*n;return[r-i,r+i]}(e,n,o,r);return i&&(t[Xv]=i[0],t[Uv]=i[1]),t})}var tx=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 n of this.held)this.getTime(n)>e?o.push(n):t.push(n);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}},ox=require("react/jsx-runtime");function nx(e,t,o){const n="function"==typeof t?t(e):e[t??o];if(null==n)return null;if(n instanceof Date)return n.getTime();const r=Number(n);return Number.isFinite(r)?r:null}var rx=(0,Tv.forwardRef)(function(e,t){const o=sm(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:n,margin:r,className:i,arrowOfTime:s="right",windowMode:a="sliding",windowSize:l,data:c,timeAccessor:u,valueAccessor:d,timeExtent:h,valueExtent:f,extentPadding:p,stroke:m="#007bff",strokeWidth:g=2,strokeDasharray:y,opacity:b,background:v,tooltipContent:x,tooltip:k,onHover:w,annotations:S,autoPlaceAnnotations:A,svgAnnotationRules:C,tickFormatTime:M,tickFormatValue:_,decay:j,pulse:R,staleness:P,transition:L,linkedHover:T,selection:I,onObservation:$,chartId:N,loading:D,loadingContent:E,emptyContent:B,emphasis:F,legendPosition:H,aggregate:O,eventTime:z}=e,W=o.showAxes,q=o.enableHover,Y=r??o.marginDefaults,G=n??[o.width,o.height],V=x??k??Bv({timeAccessor:u,valueAccessor:d}),X=(0,Tv.useRef)(null),{customHoverBehavior:U}=tm({selection:I,linkedHover:T,unwrapData:!0,onObservation:$,chartType:"RealtimeLineChart",chartId:N}),K=(0,Tv.useCallback)(e=>{w&&w(e),U(e)},[w,U]),Z=null!=O,[Q,J]=(0,Tv.useState)([]),ee=(0,Tv.useRef)(null),te=(0,Tv.useRef)(O);te.current=O;const oe=(0,Tv.useRef)(Z);oe.current=Z;const ne=(0,Tv.useRef)(Q);ne.current=Q;const re=(0,Tv.useRef)({timeAccessor:u,valueAccessor:d});re.current={timeAccessor:u,valueAccessor:d},(0,Tv.useEffect)(()=>{if(!Z)return void(ee.current=null);const e=te.current,t=function(e){const t=e.window??"tumbling",o=Yv("session"===t?e.gap??e.size:e.size);if(null==o)return null;const n=null!=e.hop?Yv(e.hop):void 0,r=null!=e.gap?Yv(e.gap):void 0;return new Ov({window:t,size:o,hop:n??void 0,gap:r??void 0,retain:e.retain})}(e);if(ee.current=t,t&&c){const{timeAccessor:e,valueAccessor:o}=re.current;for(const n of c){const r=nx(n,e,"time"),i=nx(n,o,"value");null!=r&&null!=i&&t.push(r,i)}}J(t?ex(t,e):[])},[Z?[O.window??"tumbling",O.size,O.hop??"",O.gap??"",O.retain??""].join("|"):"",Z,c]),(0,Tv.useEffect)(()=>{Z&&ee.current&&J(ex(ee.current,te.current))},[O?.stat,O?.band,O?.sigma]);const ie=(0,Tv.useCallback)(e=>{const t=ee.current,o=te.current;if(!t||!o)return;const{timeAccessor:n,valueAccessor:r}=re.current;for(const o of e){const e=nx(o,n,"time"),i=nx(o,r,"value");null!=e&&null!=i&&t.push(e,i)}J(ex(t,o))},[]),se=null!=z,ae=(0,Tv.useRef)(null),le=(0,Tv.useRef)(z);le.current=z;const ce=(0,Tv.useRef)(se);ce.current=se;const ue=(0,Tv.useRef)($);ue.current=$;const de=(0,Tv.useRef)(N);de.current=N,(0,Tv.useEffect)(()=>{ae.current=se?function(e){const t=Yv(e.lateness);return null==t?null:new tx({lateness:t,getTime:e=>nx(e,re.current.timeAccessor,"time")??NaN,latePolicy:e.latePolicy??"drop"})}(le.current):null},[se?`${z.lateness}|${z.latePolicy??"drop"}`:"",se]);const he=(0,Tv.useCallback)(e=>{0!==e.length&&(oe.current?ie(e):X.current?.pushMany(e))},[ie]),fe=(0,Tv.useCallback)(e=>{const t=ae.current;if(!ce.current||!t)return void he(e);const o=[];for(const n of e){const e=t.push(n);if(e.released.length&&o.push(...e.released),e.late.length){const o=ue.current;if(o){const{timeAccessor:n}=re.current,r=le.current?.latePolicy??"drop";for(const i of e.late)o({type:"late-data",datum:i,eventTime:nx(i,n,"time")??NaN,watermark:t.watermark,policy:r,lateCount:t.lateCount,timestamp:Date.now(),chartType:"RealtimeLineChart",chartId:de.current})}}}he(o)},[he]);(0,Tv.useImperativeHandle)(t,()=>({push:e=>fe([e]),pushMany:e=>fe(e),remove:e=>oe.current?[]:X.current?.remove(e)??[],update:(e,t)=>oe.current?[]:X.current?.update(e,t)??[],clear:()=>{ae.current?.clear(),oe.current?(ee.current?.clear(),J([])):X.current?.clear()},getData:()=>oe.current?ne.current:X.current?.getData()??[],getScales:()=>X.current?.getScales()??null}),[fe]);const pe=Kh(D,G[0],G[1],E),me=pe?null:Uh(Z?void 0:c,G[0],G[1],B),ge={stroke:m,strokeWidth:g,strokeDasharray:y};null!=b&&(ge.opacity=b);const ye=Fv(l,c),be=Z?Q:c,ve=Z?Gv:u,xe=Z?Vv:d,ke=Z&&O&&"none"!==(O.band??"none")?{y0Accessor:Xv,y1Accessor:Uv,perSeries:!1}:void 0;return pe||me||(0,ox.jsx)(dc,{ref:X,chartType:"line",runtimeMode:"streaming",size:G,margin:Y,className:F?`${i||""} semiotic-emphasis-${F}`.trim():i,arrowOfTime:s,windowMode:Z?"growing":a,windowSize:Z?Math.max(1,O?.retain??Math.max(Q.length,600)):ye,data:be,timeAccessor:ve,valueAccessor:xe,xExtent:h,yExtent:f,extentPadding:p,band:ke,lineStyle:ge,showAxes:W,background:v,hoverAnnotation:q,tooltipContent:V,...Nf({linkedHover:T,selection:I,onObservation:$,forceHoverBehavior:!0,mobileInteraction:o.mobileInteraction,customHoverBehavior:K}),annotations:S,autoPlaceAnnotations:A,svgAnnotationRules:C,tickFormatTime:M,tickFormatValue:_,decay:j,pulse:R,staleness:P,transition:L,pointIdAccessor:e.pointIdAccessor,legendPosition:H})});rx.displayName="RealtimeLineChart";var ix=require("react"),sx=require("react/jsx-runtime");function ax(e,t,o){const n="function"==typeof t?t(e):e[t??o];if(null==n)return null;if(n instanceof Date)return n.getTime();if("string"==typeof n&&""===n.trim())return null;const r=Number(n);return Number.isFinite(r)?r:null}var lx=(0,ix.forwardRef)(function(e,t){const o=sm(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:n,size:r,margin:i,className:s,arrowOfTime:a="right",windowMode:l="sliding",windowSize:c,data:u,timeAccessor:d,valueAccessor:h,direction:f="up",timeExtent:p,valueExtent:m,extentPadding:g,categoryAccessor:y,colors:b,fill:v,stroke:x,strokeWidth:k,opacity:w,gap:S,background:A,tooltipContent:C,tooltip:M,onHover:_,annotations:j,autoPlaceAnnotations:R,svgAnnotationRules:P,tickFormatTime:L,tickFormatValue:T,linkedHover:I,selection:$,decay:N,pulse:D,staleness:E,transition:B,onObservation:F,chartId:H,loading:O,loadingContent:z,emptyContent:W,emphasis:q,legendPosition:Y,brush:G,onBrush:V,linkedBrush:X}=e,U=o.showAxes,K=o.enableHover,Z=i??o.marginDefaults,Q=r??[o.width,o.height],J=C??M??function(e={}){const{timeAccessor:t,valueAccessor:o}=e;return e=>{const n=e?.data??null;if(null==n?.binStart||null==n?.binEnd){const e=Dv(n,t,"time"),r=Dv(n,o,"value");return(0,Iv.jsxs)("div",{className:"semiotic-tooltip",style:$v,children:[(0,Iv.jsxs)("div",{children:[(0,Iv.jsx)("span",{style:Nv,children:"x:"}),Ev(e)]}),(0,Iv.jsxs)("div",{children:[(0,Iv.jsx)("span",{style:Nv,children:"y:"}),Ev(r)]})]})}return(0,Iv.jsxs)("div",{className:"semiotic-tooltip",style:$v,children:[(0,Iv.jsxs)("div",{children:[(0,Iv.jsx)("span",{style:Nv,children:"range:"}),Ev(n.binStart),"–",Ev(n.binEnd)]}),null!=n.total&&(0,Iv.jsxs)("div",{children:[(0,Iv.jsx)("span",{style:Nv,children:"count:"}),Ev(n.total)]}),null!=n.category&&(0,Iv.jsxs)("div",{children:[(0,Iv.jsx)("span",{style:Nv,children:"category:"}),Ev(n.category)]})]})}}({timeAccessor:d,valueAccessor:h}),ee=(0,ix.useRef)(null),{customHoverBehavior:te}=tm({selection:$,linkedHover:I,unwrapData:!0,onObservation:F,chartType:"RealtimeHistogram",chartId:H}),oe=(0,ix.useCallback)(e=>{_&&_(e),te(e)},[_,te]),ne=!0===G?{dimension:"x",snap:"bin"}:"x"===G?{dimension:"x"}:"object"==typeof G?G:void 0,re=wp(X),ie="string"==typeof d?d:"time",se=np({name:re?.name||"__unused_hist_brush__",xField:re?.xField||ie,...re?.yField?{yField:re.yField}:{}}),ae=(0,ix.useRef)(se.brushInteraction);ae.current=se.brushInteraction;const le=(0,ix.useCallback)(e=>{if(V&&V(e),F&&F(e?{type:"brush",extent:e,timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:H}:{type:"brush-end",timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:H}),re){const t=ae.current;t.end(e?"xBrush"===t.brush?e.x:"yBrush"===t.brush?e.y:[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:null)}},[V,F,H,re]);(0,ix.useImperativeHandle)(t,()=>({push:e=>ee.current?.push(e),pushMany:e=>ee.current?.pushMany(e),remove:e=>ee.current?.remove(e)??[],update:(e,t)=>ee.current?.update(e,t)??[],clear:()=>ee.current?.clear(),getData:()=>ee.current?.getData()??[],getScales:()=>ee.current?.getScales()??null}),[]);const ce=Kh(O,Q[0],Q[1],z),ue=ce?null:Uh(u,Q[0],Q[1],W),de={};null!=v&&(de.fill=v),null!=x&&(de.stroke=x),null!=k&&(de.strokeWidth=k),null!=w&&(de.opacity=w),null!=S&&(de.gap=S);const he=q?`${s||""} semiotic-emphasis-${q}`.trim():s,fe=Fv(c,u),pe=(0,ix.useMemo)(()=>"down"!==f?m:function({data:e,valueAccessor:t,timeAccessor:o,binSize:n,valueExtent:r,extentPadding:i}){if(r)return[r[1],r[0]];if(!e||0===e.length)return;const s=new Map;for(const r of e){const e=ax(r,o,"time"),i=ax(r,t,"value");if(null==e||null==i)continue;const a=Math.floor(e/n)*n;s.set(a,(s.get(a)??0)+i)}let a=0;for(const e of s.values())e>a&&(a=e);return[a>0?a+a*(i??.1):1,0]}({data:u,valueAccessor:h,timeAccessor:d,binSize:n,valueExtent:m,extentPadding:g}),[f,u,h,d,n,m,g]);return ce||ue||(0,sx.jsx)(dc,{ref:ee,chartType:"bar",runtimeMode:"streaming",size:Q,margin:Z,className:he,arrowOfTime:a,windowMode:l,windowSize:fe,data:u,timeAccessor:d,valueAccessor:h,xExtent:p,yExtent:pe,extentPadding:g,binSize:n,categoryAccessor:y,barColors:b,barStyle:de,showAxes:U,background:A,hoverAnnotation:K,tooltipContent:J,...Nf({linkedHover:I,selection:$,onObservation:F,forceHoverBehavior:!0,mobileInteraction:o.mobileInteraction,customHoverBehavior:oe}),annotations:j,autoPlaceAnnotations:R,svgAnnotationRules:P,tickFormatTime:L,tickFormatValue:T,decay:N,pulse:D,staleness:E,transition:B,pointIdAccessor:e.pointIdAccessor,legendPosition:Y,brush:ne||(X?{dimension:"x"}:void 0),onBrush:ne||X?le:void 0})});function cx(e){return(0,sx.jsx)(lx,{...e,windowMode:"growing"})}lx.displayName="RealtimeHistogram",cx.displayName="TemporalHistogram";var ux=lx,dx=require("react"),hx=require("react/jsx-runtime"),fx=(0,dx.forwardRef)(function(e,t){const o=sm(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:n,margin:r,className:i,arrowOfTime:s="right",windowMode:a="sliding",windowSize:l,data:c,timeAccessor:u,valueAccessor:d,timeExtent:h,valueExtent:f,yScaleType:p,extentPadding:m,categoryAccessor:g,colors:y,radius:b,fill:v,opacity:x,stroke:k,strokeWidth:w,pointStyle:S,background:A,tooltipContent:C,tooltip:M,onHover:_,annotations:j,autoPlaceAnnotations:R,svgAnnotationRules:P,tickFormatTime:L,tickFormatValue:T,linkedHover:I,selection:$,onObservation:N,chartId:D,loading:E,loadingContent:B,emptyContent:F,emphasis:H,legendPosition:O}=e,z=o.showAxes,W=o.enableHover,q=r??o.marginDefaults,Y=n??[o.width,o.height],G=C??M??Bv({timeAccessor:u,valueAccessor:d}),V=(0,dx.useRef)(null),{customHoverBehavior:X}=tm({selection:$,linkedHover:I,unwrapData:!0,onObservation:N,chartType:"RealtimeSwarmChart",chartId:D}),U=(0,dx.useCallback)(e=>{_&&_(e),X(e)},[_,X]);(0,dx.useImperativeHandle)(t,()=>({push:e=>V.current?.push(e),pushMany:e=>V.current?.pushMany(e),remove:e=>V.current?.remove(e)??[],update:(e,t)=>V.current?.update(e,t)??[],clear:()=>V.current?.clear(),getData:()=>V.current?.getData()??[],getScales:()=>V.current?.getScales()??null}),[]);const K=Kh(E,Y[0],Y[1],B),Z=K?null:Uh(c,Y[0],Y[1],F),Q={};null!=b&&(Q.radius=b),null!=v&&(Q.fill=v),null!=x&&(Q.opacity=x),null!=k&&(Q.stroke=k),null!=w&&(Q.strokeWidth=w);const J=S,ee=H?`${i||""} semiotic-emphasis-${H}`.trim():i,te=Fv(l,c);return K||Z||(0,hx.jsx)(dc,{ref:V,chartType:"swarm",runtimeMode:"streaming",size:Y,margin:q,className:ee,arrowOfTime:s,windowMode:a,windowSize:te,data:c,timeAccessor:u,valueAccessor:d,xExtent:h,yExtent:f,yScaleType:p,extentPadding:m,categoryAccessor:g,barColors:y,swarmStyle:Q,pointStyle:J,showAxes:z,background:A,hoverAnnotation:W,tooltipContent:G,...Nf({linkedHover:I,selection:$,onObservation:N,forceHoverBehavior:!0,mobileInteraction:o.mobileInteraction,customHoverBehavior:U}),annotations:j,autoPlaceAnnotations:R,svgAnnotationRules:P,tickFormatTime:L,tickFormatValue:T,legendPosition:O,pointIdAccessor:e.pointIdAccessor})});fx.displayName="RealtimeSwarmChart";var px=require("react"),mx=require("react/jsx-runtime"),gx=(0,px.forwardRef)(function(e,t){const o=sm(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:n,margin:r,className:i,arrowOfTime:s="right",windowMode:a="sliding",windowSize:l,data:c,timeAccessor:u,valueAccessor:d,timeExtent:h,valueExtent:f,extentPadding:p,positiveColor:m,negativeColor:g,connectorStroke:y,connectorWidth:b,gap:v,stroke:x,strokeWidth:k,opacity:w,background:S,tooltipContent:A,tooltip:C,onHover:M,annotations:_,autoPlaceAnnotations:j,svgAnnotationRules:R,tickFormatTime:P,tickFormatValue:L,linkedHover:T,selection:I,onObservation:$,chartId:N,loading:D,loadingContent:E,emptyContent:B,emphasis:F,legendPosition:H}=e,O=o.showAxes,z=o.enableHover,W=r??o.marginDefaults,q=n??[o.width,o.height],Y=A??C??function(e={}){const{timeAccessor:t,valueAccessor:o}=e;return e=>{const n=e?.data??null,r=Dv(n,t,"time"),i=n?.delta??Dv(n,o,"value"),s=n?.cumEnd,a="number"==typeof i?0>i?Ev(i):"+"+Ev(i):Ev(i);return(0,Iv.jsxs)("div",{className:"semiotic-tooltip",style:$v,children:[(0,Iv.jsxs)("div",{children:[(0,Iv.jsx)("span",{style:Nv,children:"x:"}),Ev(r)]}),(0,Iv.jsxs)("div",{children:[(0,Iv.jsx)("span",{style:Nv,children:"Δ:"}),a]}),null!=s&&(0,Iv.jsxs)("div",{children:[(0,Iv.jsx)("span",{style:Nv,children:"total:"}),Ev(s)]})]})}}({timeAccessor:u,valueAccessor:d}),G=(0,px.useRef)(null),{customHoverBehavior:V}=tm({selection:I,linkedHover:T,unwrapData:!0,onObservation:$,chartType:"RealtimeWaterfallChart",chartId:N}),X=(0,px.useCallback)(e=>{M&&M(e),V(e)},[M,V]);(0,px.useImperativeHandle)(t,()=>({push:e=>G.current?.push(e),pushMany:e=>G.current?.pushMany(e),remove:e=>G.current?.remove(e)??[],update:(e,t)=>G.current?.update(e,t)??[],clear:()=>G.current?.clear(),getData:()=>G.current?.getData()??[],getScales:()=>G.current?.getScales()??null}),[]);const U=Kh(D,q[0],q[1],E),K=U?null:Uh(c,q[0],q[1],B),Z={};null!=m&&(Z.positiveColor=m),null!=g&&(Z.negativeColor=g),null!=y&&(Z.connectorStroke=y),null!=b&&(Z.connectorWidth=b),null!=v&&(Z.gap=v),null!=x&&(Z.stroke=x),null!=k&&(Z.strokeWidth=k),null!=w&&(Z.opacity=w);const Q=F?`${i||""} semiotic-emphasis-${F}`.trim():i,J=Fv(l,c);return U||K||(0,mx.jsx)(dc,{ref:G,chartType:"waterfall",runtimeMode:"streaming",size:q,margin:W,className:Q,arrowOfTime:s,windowMode:a,windowSize:J,data:c,timeAccessor:u,valueAccessor:d,xExtent:h,yExtent:f,extentPadding:p,waterfallStyle:Z,showAxes:O,background:S,hoverAnnotation:z,tooltipContent:Y,...Nf({linkedHover:T,selection:I,onObservation:$,forceHoverBehavior:!0,mobileInteraction:o.mobileInteraction,customHoverBehavior:X}),annotations:_,autoPlaceAnnotations:j,svgAnnotationRules:R,tickFormatTime:P,tickFormatValue:L,legendPosition:H,pointIdAccessor:e.pointIdAccessor})});gx.displayName="RealtimeWaterfallChart";var yx=require("react"),bx=require("react/jsx-runtime"),vx=(0,yx.forwardRef)(function(e,t){const o=sm(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:n,margin:r,className:i,arrowOfTime:s="right",windowMode:a="sliding",windowSize:l,data:c,timeAccessor:u,valueAccessor:d,categoryAccessor:h,timeExtent:f,valueExtent:p,extentPadding:m,heatmapXBins:g=20,heatmapYBins:y=20,aggregation:b="count",background:v,tooltipContent:x,tooltip:k,onHover:w,annotations:S,autoPlaceAnnotations:A,svgAnnotationRules:C,tickFormatTime:M,tickFormatValue:_,decay:j,pulse:R,staleness:P,linkedHover:L,selection:T,onObservation:I,chartId:$,loading:N,loadingContent:D,emptyContent:E,emphasis:B,legendPosition:F}=e,H=o.showAxes,O=o.enableHover,z=r??o.marginDefaults,W=n??[o.width,o.height],q=x??k??function(e={}){const{timeAccessor:t,valueAccessor:o,xLabel:n="x",yLabel:r="y"}=e;return e=>{const i=e?.data??null,s=i?.xCenter??Dv(i,t,"time"),a=i?.yCenter??Dv(i,o,"value"),l=i?.count,c=i?.sum,u=i?.value,d=i?.agg??"count";return(0,Iv.jsxs)("div",{className:"semiotic-tooltip",style:$v,children:[(0,Iv.jsxs)("div",{children:[(0,Iv.jsxs)("span",{style:Nv,children:[n,":"]}),Ev(s)]}),(0,Iv.jsxs)("div",{children:[(0,Iv.jsxs)("span",{style:Nv,children:[r,":"]}),Ev(a)]}),null!=l&&(0,Iv.jsxs)("div",{children:[(0,Iv.jsx)("span",{style:Nv,children:"count:"}),Ev(l)]}),"sum"===d&&null!=c&&(0,Iv.jsxs)("div",{children:[(0,Iv.jsx)("span",{style:Nv,children:"sum:"}),Ev(c)]}),"mean"===d&&null!=u&&(0,Iv.jsxs)("div",{children:[(0,Iv.jsx)("span",{style:Nv,children:"mean:"}),Ev(u)]})]})}}({timeAccessor:u,valueAccessor:d}),Y=(0,yx.useRef)(null),{customHoverBehavior:G}=tm({selection:T,linkedHover:L,unwrapData:!0,onObservation:I,chartType:"RealtimeHeatmap",chartId:$}),V=(0,yx.useCallback)(e=>{w&&w(e),G(e)},[w,G]);(0,yx.useImperativeHandle)(t,()=>({push:e=>Y.current?.push(e),pushMany:e=>Y.current?.pushMany(e),remove:e=>Y.current?.remove(e)??[],update:(e,t)=>Y.current?.update(e,t)??[],clear:()=>Y.current?.clear(),getData:()=>Y.current?.getData()??[],getScales:()=>Y.current?.getScales()??null}),[]);const X=Kh(N,W[0],W[1],D),U=X?null:Uh(c,W[0],W[1],E),K=B?`${i||""} semiotic-emphasis-${B}`.trim():i,Z=Fv(l,c);return X||U||(0,bx.jsx)(dc,{ref:Y,chartType:"heatmap",runtimeMode:"streaming",size:W,margin:z,className:K,arrowOfTime:s,windowMode:a,windowSize:Z,data:c,timeAccessor:u,valueAccessor:d,categoryAccessor:h,xExtent:f,yExtent:p,extentPadding:m,heatmapXBins:g,heatmapYBins:y,heatmapAggregation:b,showAxes:H,background:v,hoverAnnotation:O,tooltipContent:q,...Nf({linkedHover:L,selection:T,onObservation:I,forceHoverBehavior:!0,mobileInteraction:o.mobileInteraction,customHoverBehavior:V}),annotations:S,autoPlaceAnnotations:A,svgAnnotationRules:C,tickFormatTime:M,tickFormatValue:_,decay:j,pulse:R,staleness:P,legendPosition:F,pointIdAccessor:e.pointIdAccessor})});function xx(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"}vx.displayName="RealtimeHeatmap",c(require("react"));var kx=6e4,wx=60*kx,Sx=24*wx;function Ax(e){return 10>e?"0"+e:e+""}var Cx=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Mx(e){let t,o=e;return(n,r,i)=>{const s=n instanceof Date?n:new Date(n);e||!i||2>i.length||i===t||(t=i,o=function(e){if(2>e.length)return"days";const t=[];for(let o=1;e.length>o;o++)t.push(e[o]-e[o-1]);t.sort((e,t)=>e-t);const o=t[Math.floor(t.length/2)];return 2*kx>o?"seconds":2*wx>o?"minutes":2*Sx>o?"hours":60*Sx>o?"days":400*Sx>o?"months":"years"}(i));const a=o||"days";return null!=r&&0!==r&&i&&0!==i.length?function(e,t,o){const n=e.getUTCFullYear()!==t.getUTCFullYear(),r=n||e.getUTCMonth()!==t.getUTCMonth(),i=r||e.getUTCDate()!==t.getUTCDate(),s=i||e.getUTCHours()!==t.getUTCHours(),a=s||e.getUTCMinutes()!==t.getUTCMinutes(),l=Cx[e.getUTCMonth()],c=e.getUTCDate(),u=e.getUTCFullYear(),d=Ax(e.getUTCHours()),h=Ax(e.getUTCMinutes()),f=Ax(e.getUTCSeconds());switch(o){case"seconds":return n?`${l} ${c}, ${u} ${d}:${h}:${f}`:i?`${l} ${c} ${d}:${h}:${f}`:s?`${d}:${h}:${f}`:a?`${h}:${f}`:":"+f;case"minutes":return n?`${l} ${c}, ${u} ${d}:${h}`:i?`${l} ${c} ${d}:${h}`:s?`${d}:${h}`:":"+h;case"hours":return n?`${l} ${c}, ${u} ${d}:00`:r?`${l} ${c} ${d}:${h}`:i?`${l} ${c} ${d}:00`:d+":00";case"days":return n?`${l} ${c}, ${u}`:r?`${l} ${c}`:""+c;case"months":return n?`${l} ${u}`:""+l;case"years":return""+u}}(s,new Date(i[r-1]),a):function(e,t){const o=Cx[e.getUTCMonth()],n=e.getUTCDate(),r=e.getUTCFullYear(),i=Ax(e.getUTCHours()),s=Ax(e.getUTCMinutes()),a=Ax(e.getUTCSeconds());switch(t){case"seconds":return`${o} ${n}, ${r} ${i}:${s}:${a}`;case"minutes":case"hours":return`${o} ${n}, ${r} ${i}:${s}`;case"days":return`${o} ${n}, ${r}`;case"months":return`${o} ${r}`;case"years":return""+r}}(s,a)}}async function _x(e,t){const{format:o="png",filename:n="chart",scale:r=2,background:i="white"}=t||{},s=e.querySelector("svg");if(!s)throw Error("No SVG element found in the container");const a=s.cloneNode(!0),l=s.getBoundingClientRect();if(a.getAttribute("width")||a.setAttribute("width",l.width+""),a.getAttribute("height")||a.setAttribute("height",l.height+""),a.getAttribute("xmlns")||a.setAttribute("xmlns","http://www.w3.org/2000/svg"),jx(s,a),"svg"===o){const e=(new XMLSerializer).serializeToString(a);Rx(new Blob([e],{type:"image/svg+xml;charset=utf-8"}),n+".svg")}else{const t=l.width*r,o=l.height*r,s=document.createElement("canvas");s.width=t,s.height=o;const c=s.getContext("2d");c.fillStyle=i,c.fillRect(0,0,t,o),c.scale(r,r);const u=e.querySelector("canvas");u&&c.drawImage(u,0,0,l.width,l.height);const d=(new XMLSerializer).serializeToString(a),h=new Blob([d],{type:"image/svg+xml;charset=utf-8"}),f=URL.createObjectURL(h),p=new Image;p.width=l.width,p.height=l.height,await new Promise((e,t)=>{p.onload=()=>{c.drawImage(p,0,0),s.toBlob(o=>{o?(Rx(o,n+".png"),e()):t(Error("Failed to create PNG blob"))},"image/png"),URL.revokeObjectURL(f)},p.onerror=()=>{URL.revokeObjectURL(f),t(Error("Failed to load SVG image"))},p.src=f})}}function jx(e,t){const o=e.children,n=t.children,r=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=r.getPropertyValue(e);o&&"none"!==o&&""!==o&&t.style?.setProperty(e,o)}for(let e=0;Math.min(o.length,n.length)>e;e++)jx(o[e],n[e])}function Rx(e,t){const o=URL.createObjectURL(e),n=document.createElement("a");n.href=o,n.download=t,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(o)}var Px=["BarChart","StackedBarChart","GroupedBarChart","SwarmPlot","BoxPlot","Histogram","ViolinPlot","RidgelinePlot","DotPlot","PieChart","DonutChart","GaugeChart","FunnelChart","SwimlaneChart","LikertChart","LineChart","AreaChart","DifferenceChart","StackedAreaChart","Scatterplot","BubbleChart","Heatmap","QuadrantChart","MultiAxisLineChart","CandlestickChart","ConnectedScatterplot","ScatterplotMatrix","MinimapChart","ForceDirectedGraph","SankeyDiagram","ProcessSankey","ChordDiagram","TreeDiagram","Treemap","CirclePack","OrbitDiagram","ChoroplethMap","ProportionalSymbolMap","FlowMap","DistanceCartogram","RealtimeLineChart","RealtimeHistogram","TemporalHistogram","RealtimeSwarmChart","RealtimeWaterfallChart","RealtimeHeatmap","GaltonBoardChart","EventDropChart","PhysicsPileChart","CollisionSwarmChart","GauntletChart","ProcessFlowChart","PhysicalFlowChart","BigNumber"],Lx=new Set(Px);function Tx(e){return Lx.has(e)}var Ix=["value","threshold","partition-boundary","time-window","range-boundary"];function $x({controlType:e,controlId:t,chartId:o,chartType:n="VisualizationControl",onObservation:r}){return(i,s,a)=>{r?.({type:i,controlType:e,value:s,chartType:n,timestamp:Date.now(),...t?{controlId:t}:{},...o?{chartId:o}:{},...a?{source:a}:{}})}}function Nx(e,t,o,n,r){return{id:e,...t?{controlId:t}:{},status:o,message:n,...r?{remediation:r}:{}}}function Dx({controls:e=[],minimumTargetSize:t=24}){const o=[],n=new Set;for(const r of e){const e=r?.id,i="controls."+(e||"unknown"),s=r?.domain,a=Array.isArray(s)&&2===s.length&&Number.isFinite(s[0])&&Number.isFinite(s[1])&&s[1]>s[0],l=Ix.includes(r?.type),c="string"==typeof r?.target&&r.target.trim().length>0,u=["slider","buttons","native-range"].includes(r?.keyboard??""),d=r?.minimumTargetSize;o.push(Nx(i+".semantic-type",e,l?"pass":"fail",l?`Control uses the semantic type "${r.type}".`:"Control has no recognized semantic type.","Use one of VISUALIZATION_CONTROL_TYPES.")),o.push(Nx(i+".state-binding",e,c?"pass":"fail",c?`Control is bound to "${r.target}".`:"Control has no declarative state binding.","Declare the controlled state key with target.")),o.push(Nx(i+".domain",e,a?"pass":"fail",a?"Control has a finite ordered value domain.":"Control has no finite ordered value domain.","Declare domain as [minimum, maximum].")),o.push(Nx(i+".keyboard",e,u?"pass":"fail",u?`Control declares a ${r.keyboard} keyboard path.`:"Control does not declare a keyboard path.","Declare slider, buttons, or native-range keyboard interaction.")),o.push(Nx(i+".value-text",e,"string"==typeof r?.valueText&&r.valueText.trim().length>0?"pass":"fail","string"==typeof r?.valueText&&r.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(Nx(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!=r?.step&&o.push(Nx(i+".step",e,Number.isFinite(r.step)&&r.step>0?"pass":"fail",Number.isFinite(r.step)&&r.step>0?"Control has a positive quantization step.":"Control step must be a positive finite number.","Use a positive finite step.")),r?.observations?.length&&o.push(Nx(i+".observations",e,r.observations.includes("control-change")?"pass":"warn",r.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&&!n.has(e)||o.push(Nx(i+".identity",e,"fail",e?"Control id is duplicated.":"Control id is missing.","Use a unique stable control id.")),e&&n.add(e)}return{ok:o.every(e=>"fail"!==e.status),findings:o}}function Ex(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 n=Array.isArray(e)?e.every(e=>Ex(e,t)):Object.entries(e).every(([,e])=>Ex(e,t));return t.delete(e),n}var Bx=Symbol.for("semiotic.chartRecipeRegistry");function Fx(e){return function(){const e=globalThis;return e[Bx]||(e[Bx]={recipes:new Map,capabilities:new Map,layouts:new Map}),e[Bx]}().recipes.get(e)}function Hx(e){return"string"==typeof e?Fx(e):e&&"object"==typeof e&&"string"==typeof e.id?e:void 0}function Ox(e){return"string"==typeof e?e:e.id??e.name}function zx(e){return e.layoutConfig&&"object"==typeof e.layoutConfig?e.layoutConfig:{}}function Wx(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 qx(e,t,o){return o??Hx(t.recipe)??Hx(t.recipeId)??Fx(e)}function Yx(e,t,o=[]){const n=e.accessor?t[e.accessor]:void 0;if("string"==typeof n&&n)return n;if(e.field)return e.field;const r=o.find(e=>e&&"object"==typeof e);if(!r)return;const i=Object.entries(r).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 r):i.find(([,e])=>"string"==typeof e)?.[0]}function Gx(e,t){return e.dataRoles.find(e=>e.role===t)}function Vx(e,t){return e.dataRoles.find(e=>t.includes(e.semanticType))}function Xx(e,t,o,n,r,i={}){const s={...i};if(t)for(const[e,o]of Object.entries(t))s[e]=o;for(const e of o.dataRoles){const o=Yx(e,n,r),i=t&&o?t[o]:o;void 0!==i&&(s[e.role]=i)}return e.replace(/\{([^}]+)\}/g,(e,t)=>{const o=s[t];return null==o?`{${t}}`:o+""})}var Ux="1",Kx=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"]),Zx=new Set(["data","nodes","edges","points","areas","lines","flows"]);function Qx(e,t){return!!Zx.has(e)&&("areas"!==e||"string"!=typeof t)}var Jx="function"==typeof structuredClone?structuredClone:e=>JSON.parse(JSON.stringify(e));function ek(e,t,o){const n=Fx(e)??Hx(t.recipe)??Hx(t.recipeId);if(n)return function(e,t,o){const n=function(e,t,o){const n={};for(const[r,i]of Object.entries(e))if(null!=i&&!Kx.has(r)&&"recipeId"!==r&&(t||!Qx(r,i)))if("function"==typeof i||i?.$$typeof){if(o)throw Error(`Portable recipe prop "${r}" is not JSON-safe.`)}else if(Ex(i))n[r]=Jx(i);else if(o)throw Error(`Portable recipe prop "${r}" is not JSON-safe.`);return n}(t,!1!==o?.includeData,"portable"===e.portability),r=e.intents.map(Ox).filter(e=>!!e),i={name:e.name,intents:r,...e.audience?.primary?{audience:[e.audience.primary]}:{},frameFamily:e.frameFamily};if("portable"===e.portability){if(!Ex(n))throw Error(`Portable recipe "${e.id}" contains non-JSON-safe props or layoutConfig.`);return{component:"ChartRecipe",recipeId:e.id,portable:!0,props:n,manifest:i,version:Ux,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:n,manifest:i,version:Ux,createdAt:(new Date).toISOString(),...o?.selections?{selections:o.selections}:{}}}(n,t,o);if(!Tx(e))throw Error(`Unknown component "${e}". Known components: ${Px.join(", ")}`);const r=!1!==o?.includeData,i={};for(const[e,o]of Object.entries(t))null!=o&&(Kx.has(e)||!r&&Qx(e,o)||"function"!=typeof o&&(o?.$$typeof||(i[e]=Jx(o))));return{component:e,props:i,version:Ux,createdAt:(new Date).toISOString(),...o?.selections?{selections:o.selections}:{}}}function tk(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=Fx(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:{...Jx(e.props),recipeId:e.recipeId}}}if(!Tx(e.component))throw Error(`Unknown component "${e.component}". This config may require a newer version of semiotic.`);return{componentName:e.component,props:Jx(e.props)}}function ok(e){const t=JSON.stringify(e);return"sc="+btoa(unescape(encodeURIComponent(t))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function nk(e){const t=new URLSearchParams(e.includes("?")?e.split("?")[1]:e).get("sc");if(!t)throw Error("No chart config found in URL (missing 'sc' parameter)");const o=t.replace(/-/g,"+").replace(/_/g,"/"),n=decodeURIComponent(escape(atob(o)));return JSON.parse(n)}async function rk(e,t="json"){const o="jsx"===t?ik(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 ik(e){const{props:t}=e,o=["<"+("LocalChartRecipe"===e.component?"ChartRecipe":e.component)];e.recipeId&&o.push(` recipeId="${e.recipeId}"`);for(const[e,n]of Object.entries(t))if("string"==typeof n)o.push(` ${e}="${n}"`);else if("boolean"==typeof n&&!0===n)o.push(" "+e);else if("boolean"==typeof n&&!1===n)o.push(` ${e}={false}`);else if("number"==typeof n)o.push(` ${e}={${n}}`);else{const t=JSON.stringify(n);o.push(80>t.length?` ${e}={${t}}`:` ${e}={${JSON.stringify(n,null,2)}}`)}return o.push("/>"),o.join("\n")}function sk(e){const t={};for(const[o,n]of e){const e=[];for(const[,t]of n.clauses){const o={};for(const[e,n]of Object.entries(t.fields))o[e]="point"===n.type?{type:"point",values:Array.from(n.values)}:{type:"interval",range:n.range};e.push({clientId:t.clientId,type:t.type,fields:o})}t[o]={name:n.name,resolution:n.resolution,clauses:e}}return t}function ak(e){const t=new Map;for(const[o,n]of Object.entries(e)){const e=new Map;for(const t of n.clauses){const o={};for(const[e,n]of Object.entries(t.fields))o[e]="point"===n.type?{type:"point",values:new Set(n.values)}:{type:"interval",range:n.range};e.set(t.clientId,{clientId:t.clientId,type:t.type,fields:o})}t.set(o,{name:n.name,resolution:n.resolution,clauses:e})}return t}function lk(e){return"nominal"===e||"ordinal"===e}function ck(e){return"quantitative"===e||"temporal"===e}h();var uk={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"},dk={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"},hk={sum:"sum",mean:"mean",average:"mean",count:"count",min:"min",max:"max",median:"mean"};function fk(e){e=function(e){if(!function(e){return e.usermeta?.idid}(e)||!Array.isArray(e.layer))return e;const t=e.layer.filter(e=>!function(e){return"annotation-layer"===e.usermeta?.idid?.role}(e));if(1!==t.length)return e;const{layer:o,...n}=e,{usermeta:r,...i}=t[0];return{...n,...i}}(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),r=e.encoding||{},i=r.x,s=r.y,a=r.color,l=r.size,c=r.theta,d=r.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||r.facet||r.row||r.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 f={};e.width&&(f.width=e.width),e.height&&(f.height=e.height);const p=function(e){if(e)return"string"==typeof e?e:e.text}(e.title);if(p&&(f.title=p),a?.field&&(f.colorBy=a.field,a.scale?.scheme)){const e=uk[a.scale.scheme];e&&(f.colorScheme=e)}void 0!==d?.value&&(f.pointOpacity=d.value);const m=i?.aggregate,g=s?.aggregate;if(h&&(m||g)){const e=g?s:i,t=g?i:s,o=hk[e.aggregate];if(o&&t?.field&&e.field)h=function(e,t){const{groupBy:o,value:n,agg:r="sum"}=t,i=new Map;for(const t of e){const e=t[o]+"";i.has(e)||i.set(e,[]),i.get(e).push(Number(t[n]))}const s=[];for(const[e,t]of i){let n;switch(r){case"count":n=t.length;break;case"mean":n=t.reduce((e,t)=>e+t,0)/t.length;break;case"min":n=u(t)[0];break;case"max":n=u(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 n=o[t.field]+"";e.set(n,(e.get(n)||0)+1)}h=Array.from(e,([e,o])=>({[t.field]:e,value:o}))}}if(i?.bin||s?.bin){const e="Histogram";h&&(f.data=h),i?.bin?(f.valueAccessor=i.field,s?.field&&(f.categoryAccessor=s.field),i.axis?.title&&(f.valueLabel=i.axis.title)):s?.bin&&(f.valueAccessor=s.field,i?.field&&(f.categoryAccessor=i.field),s.axis?.title&&(f.valueLabel=s.axis.title));const o=i?.bin||s?.bin,n="object"==typeof o?o.maxbins:void 0;return n&&(f.bins=n),mk(e,f,t)}let y;switch(o){case"bar":y=function(e,t,o,n,r,i,s){let a;return o?.field&&!1!==e?.stack&&!1!==t?.stack&&null!==e?.stack&&null!==t?.stack?(a="StackedBarChart",n.stackBy=o.field):a="BarChart",lk(e?.type)&&ck(t?.type)?(n.categoryAccessor=e.field,n.valueAccessor=s?"value":t.field,e?.axis?.title&&(n.categoryLabel=e.axis.title),t?.axis?.title&&(n.valueLabel=t.axis.title)):ck(e?.type)&&lk(t?.type)?(n.categoryAccessor=t.field,n.valueAccessor=i?"value":e.field,n.orientation="horizontal",t?.axis?.title&&(n.categoryLabel=t.axis.title),e?.axis?.title&&(n.valueLabel=e.axis.title)):(e?.field&&(n.categoryAccessor=e.field),t?.field&&(n.valueAccessor=s?"value":t.field),e?.axis?.title&&(n.categoryLabel=e.axis.title),t?.axis?.title&&(n.valueLabel=t.axis.title)),r&&(n.data=r),a}(i,s,a,f,h,m,g);break;case"line":if(y="LineChart",pk(i,s,f,m,g),a?.field&&(f.lineBy=a.field),n.interpolate){const e=dk[n.interpolate];e&&(f.curve=e)}!0===n.point&&(f.showPoints=!0),h&&(f.data=h);break;case"area":if(a?.field?(y="StackedAreaChart",f.areaBy=a.field):y="AreaChart",pk(i,s,f,m,g),n.interpolate){const e=dk[n.interpolate];e&&(f.curve=e)}void 0!==n.opacity&&(f.areaOpacity=n.opacity),h&&(f.data=h);break;case"point":case"circle":case"square":l?.field?(y="BubbleChart",f.sizeBy=l.field,l.scale?.range&&(f.sizeRange=l.scale.range)):y="Scatterplot",pk(i,s,f,m,g),h&&(f.data=h);break;case"rect":y="Heatmap",i?.field&&(f.xAccessor=i.field),s?.field&&(f.yAccessor=s.field),a?.field&&(f.valueAccessor=a.field,delete f.colorBy),i?.axis?.title&&(f.xLabel=i.axis.title),s?.axis?.title&&(f.yLabel=s.axis.title),h&&(f.data=h);break;case"arc":n.innerRadius&&n.innerRadius>0?(y="DonutChart",f.innerRadius=n.innerRadius):y="PieChart",c?.field?f.valueAccessor=c.field:s?.field&&(f.valueAccessor=g?"value":s.field),a?.field&&(f.categoryAccessor=a.field),i?.field&&!c?.field&&(f.categoryAccessor=i.field),h&&(f.data=h);break;case"tick":y="DotPlot",lk(i?.type)?(f.categoryAccessor=i.field,s?.field&&(f.valueAccessor=g?"value":s.field),i?.axis?.title&&(f.categoryLabel=i.axis.title),s?.axis?.title&&(f.valueLabel=s.axis.title)):lk(s?.type)?(f.categoryAccessor=s.field,i?.field&&(f.valueAccessor=m?"value":i.field),f.orientation="horizontal",s?.axis?.title&&(f.categoryLabel=s.axis.title),i?.axis?.title&&(f.valueLabel=i.axis.title)):(i?.field&&(f.categoryAccessor=i.field),s?.field&&(f.valueAccessor=g?"value":s.field)),h&&(f.data=h);break;default:t.push(`Unsupported mark type "${o}". Defaulting to Scatterplot.`),y="Scatterplot",pk(i,s,f,m,g),h&&(f.data=h)}return mk(y,f,t)}function pk(e,t,o,n,r){e?.field&&(o.xAccessor=n?"value":e.field),t?.field&&(o.yAccessor=r?"value":t.field),e?.axis?.title&&(o.xLabel=e.axis.title),t?.axis?.title&&(o.yLabel=t.axis.title)}function mk(e,t,o){const n={component:e,props:t,version:"1",createdAt:(new Date).toISOString()};if(o.length>0){n.warnings=o;for(const e of o)console.warn("[semiotic/fromVegaLite] "+e)}return n}var gk=c(require("react")),yk=new Set(["LineChart","AreaChart","StackedAreaChart","DifferenceChart","Scatterplot","BubbleChart","ConnectedScatterplot","QuadrantChart","MultiAxisLineChart","MinimapChart"]),bk=new Set(["BarChart","StackedBarChart","GroupedBarChart","DotPlot"]),vk=new Set(["PieChart","DonutChart","FunnelChart"]),xk=new Set(["Histogram","BoxPlot","ViolinPlot","RidgelinePlot","SwarmPlot"]);function kk(e,t){return bk.has(e)||vk.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 wk(e){for(const t of["lineBy","areaBy","stackBy","groupBy","colorBy"]){const o=e[t];if("string"==typeof o&&o)return o}}function Sk(e,t){return null==e?"—":e instanceof Date?e.toISOString().slice(0,10):"number"==typeof e?t(e):e+""}function Ak(e,t={}){const o=!0===t.showRetractedAnnotations,n=!0===t.showSupersededAnnotations,r=new Set;for(const t of e){const e=t?.lifecycle?.supersedes;e&&"retracted"!==t?.lifecycle?.status&&r.add(e)}return e.filter(e=>{if("retracted"===e?.lifecycle?.status&&!o)return!1;const t=e?.provenance?.stableId;return!(t&&r.has(t)&&!n)})}var Ck={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"},Mk=new Set(["ForceDirectedGraph","SankeyDiagram","ProcessSankey","ChordDiagram"]),_k=new Set(["StreamPhysicsFrame","EventDropChart","GaltonBoardChart","PhysicsPileChart","CollisionSwarmChart","PhysicalFlowChart","ProcessFlowChart","GauntletChart","PhysicsCustomChart"]);function jk(e){return Ck[e]||e.replace(/([a-z])([A-Z])/g,"$1 $2").toLowerCase()+" chart"}function Rk(e){const t="number"==typeof e?e:"string"==typeof e?Number(e):NaN;return Number.isFinite(t)?t:void 0}var Pk=new Set(["Scatterplot","BubbleChart","ConnectedScatterplot","QuadrantChart","ScatterplotMatrix"]),Lk={"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"},Tk={"time-series":"tracking",categorical:"comparing",distribution:"characterizing",relationship:"relating",flow:"tracing",network:"tracing",hierarchy:"nesting",geo:"locating",realtime:"tracking",value:"presenting",custom:"presenting"},Ik=["trend","compare-series","compare-categories","rank","part-to-whole","distribution","correlation","flow","hierarchy","geo","composition-over-time","change-detection","outlier-detection"],$k={alerting:"alerting",tracking:"trend",comparing:"comparison",ranking:"ranking",apportioning:"composition",characterizing:"distribution",relating:"correlation",tracing:"flow",nesting:"hierarchy",locating:"locator",presenting:"single-value"};var Nk=new Set(["y-threshold","x-threshold","band","x-band","callout","label"]),Dk=new Set(["system","agent","watcher"]),Ek=new Set(["ai","agent","system","computed","dbt","great-expectations"]),Bk=new Set(["rule","statistical-test","llm-inference","computed"]);function Fk(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||!Nk.has(t.type))return!1;const o=t.provenance;return!(!o||"object"!=typeof o)&&(Dk.has(o.authorKind)||Ek.has(o.source)||Bk.has(o.basis))})}function Hk(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 Ok={"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 zk(e){const t=Ok["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),n=o?o+t.replace(/^an? /,""):t,r="string"==typeof e.label?e.label:"string"==typeof e.title?e.title:void 0;return r?`${n} labeled "${r}"`:n}function Wk(e){const t=Array.isArray(e.annotations)?e.annotations:null;if(!t||0===t.length)return;const o=Ak(t.filter(e=>!!e&&"object"==typeof e));if(0===o.length)return;const n=o.map(zk),r=n.slice(0,5),i=n.length-r.length,s=function(e){return e.length>1?2===e.length?`${e[0]} and ${e[1]}`:`${e.slice(0,-1).join(", ")}, and ${e[e.length-1]}`:e[0]??""}(r)+(i>0?`, and ${i} more`:""),a=o.length;return`The author has marked ${1===a?"one feature":a+" features"} on this chart: ${s}.`}function qk(e,t,o={}){const n=void 0!==o.levels,r=new Set(o.levels??["l1","l2","l3"]);n||!o.capability&&!Fk(t)||r.add("l4");const i=qx(e,t,o.recipe);if(i){const e=["l1","l2","l3","l4"].filter(e=>r.has(e));n||e.includes("l4")||e.push("l4");const s=function(e,t,o={}){const n=Wx(t),r=zx(t),i=o.locale??"en",s="function"==typeof e.description?e.description({data:n,config:r,locale:i}):void 0,a=s?.levels??function(e,t,o,n){const r=Vx(e,["nominal","ordinal"]),i=Vx(e,["quantitative"]),s=r?Yx(r,o,t):void 0,a=i?Yx(i,o,t):void 0,l=r?.role??s??"category",c=i?.role??a??"value",u=e.encodings??[],d=u.length?u.slice(0,3).map(e=>e.meaning.replace(/\.$/,"")).join("; "):`${l} and ${c} are mapped through the recipe's declared visual semantics`,{number:h,percent:f}=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})}}}(n),p=new Map;if(s&&a)for(const e of t){const t=(e[s]??"Uncategorized")+"",o=Number(e[a]);Number.isFinite(o)&&p.set(t,(p.get(t)??0)+o)}const m=[...p].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:Ox(e),strength:"string"==typeof e?void 0:e.strength})).sort((e,t)=>"primary"===e.strength?-1:"primary"===t.strength?1:0)[0]?.id,k=e.audience?.primary??e.audienceFit?.find(e=>"strong"===e.fit)?.audience;return{l1:`A ${e.name.toLowerCase()} encodes ${l} and ${c}. ${w=d,w?w.charAt(0).toUpperCase()+w.slice(1):w}.`,l2:m.length>0?`${m.length} categories total ${h.format(g)}. ${y[0]} accounts for ${h.format(y[1])}${g>0?` (${f.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 ${f.format(v)}.`,l4:`The chart is intended for ${x??"explanation"}${k?` with a ${k} audience`:""}: ${e.designContract.whyCustom}`};var w}(e,n,r,i),l=o.levels??["l1","l2","l3","l4"],c={};for(const e of l)a[e]&&(c[e]=a[e]);const u=["l1","l2","l3","l4"].map(e=>c[e]).filter(e=>!!e).join(" "),d=o.includeCaveats?[...e.reception?.risks??[],...e.caveats??[],...(e.designContract.misuse??[]).map(e=>"Misuse: "+e)]:void 0;return{text:u,levels:c,...d?.length?{caveats:d}:{}}}(i,t,{levels:e,locale:o.locale,audience:o.audience,includeCaveats:o.includeCaveats}),a=Wk(t);return{...s,text:a?`${a} ${s.text}`.trim():s.text,...a?{annotations:a}:{}}}const s=Hk(o.locale??"en"),a=jk(e),l=Array.isArray(t.data)?t.data:null,c=wk(t),u=_k.has(e)?function(e,t){const o=e.physics&&"object"==typeof e.physics?e.physics:null,n=e.settledProjection&&"object"==typeof e.settledProjection?e.settledProjection:null,r=[e.settledProjectionRows,e.projectionRows,n?.rows,o?.settledProjectionRows,o?.projectionRows,o?.settledProjection&&"object"==typeof o.settledProjection?o.settledProjection.rows:void 0].find(e=>Array.isArray(e));return Array.isArray(r)?r.map((e,o)=>{if(!e||"object"!=typeof e)return null;const n=e,r=Rk(n.count??n.value??n.total??n.bodies??n.events);if(null==r)return null;const i=n.label??n.id??n.name??"container "+(o+1),s=Rk(n.secondary??n.secondaryCount),a=Rk(n.observed??n.observedCount);return{label:Sk(i,t),count:r,...null!=s?{secondary:s}:{},..."string"==typeof n.secondaryLabel&&n.secondaryLabel?{secondaryLabel:n.secondaryLabel}:{},...null!=a?{observed:a}:{}}}).filter(e=>null!=e):null}(t,s):null,{measure:d,measureFallback:h,dimension:f,dimensionFallback:p}=kk(e,t),m="string"==typeof d&&d?d:h,g="string"==typeof f&&f?f:p,y={};if(_k.has(e)&&function(e,t,o,n,r,i){const s=function(e){return"EventDropChart"===e?"time window":"GaltonBoardChart"===e?"bin":"CollisionSwarmChart"===e?"group lane":"PhysicalFlowChart"===e?"flow node":"container"}(e),a=function(e){return"EventDropChart"===e?"event":"GaltonBoardChart"===e?"sample":"CollisionSwarmChart"===e?"point":"PhysicalFlowChart"===e?"packet":"body"}(e);if(r.has("l1")&&(n.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)),!r.has("l2")&&!r.has("l3"))return;if(!o||0===o.length)return void(r.has("l2")&&(n.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(r.has("l2"))if(0===c.length)n.l2=`The settled projection contains ${i(l)} ${Gk(l,a)} across ${o.length} ${Gk(o.length,s)}; no ${Gk(2,s)} are non-empty yet.`;else{const e=d>0?` ${i(d)} ${Gk(d,a)} ${1===d?"is":"are"} marked ${h}.`:"";n.l2=`The settled projection contains ${i(l)} ${Gk(l,a)} across ${o.length} ${Gk(o.length,s)}; ${c.length} ${Gk(c.length,s)} ${1===c.length?"is":"are"} non-empty. The largest ${s} is ${u.label} with ${i(u.count)} ${Gk(u.count,a)}.${e}`}if(r.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);n.l3=e?`The settled projection is most concentrated in ${u.label}, which holds ${i(u.count)} ${Gk(u.count,a)} (${t}); ${e.label} follows with ${i(e.count)} ${Gk(e.count,a)}.`:`The settled projection is concentrated in ${u.label}, which holds all ${i(u.count)} ${Gk(u.count,a)}.`}}(e,a,u,y,r,s),r.has("l1")&&!_k.has(e))if(yk.has(e)||bk.has(e))y.l1=`A ${a} of ${m} by ${g}`+(c?`, split by ${c}.`:".");else if(vk.has(e))y.l1=`A ${a} showing ${m} across ${g} categories.`;else if(xk.has(e))y.l1=`A ${a} of the distribution of ${m}`+(c?` by ${c}.`:".");else if(Mk.has(e)){const e=Array.isArray(t.nodes)?t.nodes.length:void 0,o=Array.isArray(t.edges)?t.edges.length:void 0,n=[null!=e?`${e} ${Gk(e,"node")}`:null,null!=o?`${o} ${Gk(o,"edge")}`:null].filter(Boolean);y.l1=`A ${a}${n.length?" with "+n.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 ${a}.`;const b=yk.has(e)||bk.has(e)||vk.has(e)||xk.has(e);let v=null;if((r.has("l2")||r.has("l3")||r.has("l4"))&&b&&l&&l.length>0&&(v=function(e,t,o,n){let r=0,i=0,s=1/0,a=-1/0,l=null,c=null,u=0,d=0,h=null,f=null,p=NaN,m=NaN;for(const o of e){const e=t(o);Number.isFinite(e)&&(0===r&&(p=e,h=o),m=e,f=o,s>e&&(s=e,l=o,u=r),e>a&&(a=e,c=o,d=r),r++,i+=e)}return 0===r?null:{count:r,min:s,max:a,mean:i/r,minLabel:Sk(null!=l?o(l):null,n),maxLabel:Sk(null!=c?o(c):null,n),first:p,last:m,firstLabel:Sk(null!=h?o(h):null,n),lastLabel:Sk(null!=f?o(f):null,n),minIndex:u,maxIndex:d}}(l,re(d,h),ie(f,p),s)),r.has("l2")&&b&&(l&&0!==l.length?v&&(y.l2=vk.has(e)?`${v.count} segments totaling ${s(function(e){return e.mean*e.count}(v))}. Largest is ${v.maxLabel} at ${s(v.max)}; smallest is ${v.minLabel} at ${s(v.min)}.`:`${m} ranges from ${s(v.min)} (${v.minLabel}) to ${s(v.max)} (${v.maxLabel}), with a mean of ${s(v.mean)} across ${v.count} points.`):y.l2="No data is loaded yet."),r.has("l3")&&v&&!c&&yk.has(e)?y.l3=function(e,t,o){const{first:n,last:r,min:i,max:s,maxLabel:a,minLabel:l,firstLabel:c,lastLabel:u,minIndex:d,maxIndex:h,count:f}=e,p=s-i,m=r-n;if(0===p)return`${Yk(t)} is constant at ${o(n)} across the series.`;if(.04>p/(Math.abs(e.mean)||1))return`${Yk(t)} ends roughly where it started (${o(n)} at ${c} to ${o(r)} at ${u}), ranging between ${o(i)} and ${o(s)}.`;const g=h>0&&f-1>h,y=d>0&&f-1>d,b=(s-Math.max(n,r))/p,v=(Math.min(n,r)-i)/p;return g&&b>.15?`Overall ${t} climbs to a peak of ${o(s)} (${a}), then falls to ${o(r)} (${u}).`:y&&v>.15?`Overall ${t} drops to a low of ${o(i)} (${l}), then recovers to ${o(r)} (${u}).`:.05>Math.abs(m)/p?`${Yk(t)} ends roughly where it started (${o(n)} at ${c} to ${o(r)} at ${u}), ranging between ${o(i)} and ${o(s)}.`:m>0?h===f-1?`Overall ${t} rises from ${o(n)} (${c}) to a peak of ${o(r)} (${u}).`:`Overall ${t} rises from ${o(n)} (${c}) to ${o(r)} (${u}), after peaking at ${o(s)} (${a}).`:d===f-1?`Overall ${t} falls from ${o(n)} (${c}) to a low of ${o(r)} (${u}).`:`Overall ${t} falls from ${o(n)} (${c}) to ${o(r)} (${u}), after dipping to ${o(i)} (${l}).`}(v,m,s):r.has("l3")&&v&&!c&&bk.has(e)&&(y.l3=`The highest ${g} is ${v.maxLabel} and the lowest is ${v.minLabel}.`),r.has("l4")){const n=Fk(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,n]of Object.entries(t.intentScores))"number"==typeof n&&Number.isFinite(n)&&(o[e]=n);return{family:t.family,intentScores:Object.keys(o).length?o:void 0}}return e}}(t);if(o?.act)return o.act;if(o?.intentScores){const e=function(e){let t,o=0;for(const[n,r]of Object.entries(e))if("number"==typeof r&&r>0)if(r>o)t=n,o=r;else if(r===o&&void 0!==t){const e=Ik.indexOf(n),o=Ik.indexOf(t);-1===e||-1!==o&&e>=o||(t=n)}return t}(o.intentScores);if(e&&Lk[e]&&(o.intentScores[e]??0)>=3)return Lk[e]}return o?.family?Tk[o.family]:function(e){return vk.has(e)||"StackedAreaChart"===e?"apportioning":Pk.has(e)?"relating":bk.has(e)?"comparing":xk.has(e)?"characterizing":yk.has(e)?"tracking":Mk.has(e)?"tracing":"BigNumber"===e?"presenting":void 0}(e)}(e,o.capability);n&&(y.l4=function(e,t,o,n,r,i,s,a){const l=$k[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:r} 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 ${r} move together`;break;default:u=`This is ${c} ${l} chart`,d=function(e,t,o,n,r,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 ${n}`;case"ranking":return"read it top to bottom by "+o;case"apportioning":return`read each ${n}'s share of the whole`;case"characterizing":return"read it for the spread and shape of "+o;default:return"read the highlighted features"}switch(e){case"alerting":return function(e,t,o){if(bk.has(o)||vk.has(o))return`${e.maxLabel} stands out at ${t(e.max)} — check it first`;const{first:n,last:r,min:i,max:s,minLabel:a,maxLabel:l,lastLabel:c,minIndex:u,maxIndex:d,count:h}=e,f=s-i;if(f>0){const e=d>0&&h-1>d,o=u>0&&h-1>u,p=(s-Math.max(n,r))/f,m=(Math.min(n,r)-i)/f;if(e&&p>.15)return`the peak of ${t(s)} at ${l} is the point to investigate`;if(o&&m>.15)return`the dip to ${t(i)} at ${a} is the point to investigate`;if(r>=s)return`the climb to ${t(r)} at ${c} warrants a closer look`;if(i>=r)return`the drop to ${t(r)} at ${c} warrants a closer look`}return`the extremes — ${l} (${t(s)}) and ${a} (${t(i)}) — are the points to check`}(t,r,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 ${r(t.first)} (${t.firstLabel}) to ${r(t.last)} (${t.lastLabel})`;case"comparing":return`compare ${o} across ${n}; ${t.maxLabel} leads at ${r(t.max)}`;case"ranking":return`read it top to bottom by ${o}; ${t.maxLabel} ranks highest at ${r(t.max)}`;case"apportioning":{const e=t.mean*t.count,o=e>0?Math.round(t.max/e*100):null;return`read each ${n}'s share of the ${r(e)} total; ${t.maxLabel} is the largest at ${r(t.max)}${null!=o?` (${o}%)`:""}`}case"characterizing":return`read it for the spread of ${o}, from ${r(t.min)} to ${r(t.max)}`;default:return"read the highlighted features"}}(e,n,r,i,s,t)}return`${u}; ${d}.${function(e,t){if(!t)return"";const o=t.familiarity?.[e];return"number"!=typeof o||o>2?"":` This ${jk(e)} may be unfamiliar${t.name?` to ${t.name.toLowerCase()} readers`:""} — lean on this description.`}(t,a)}`}(n,e,t,c?null:v,m,g,s,o.audience))}const x=["l1","l2","l3","l4"].filter(e=>r.has(e)&&y[e]).map(e=>y[e]).join(" "),k=Wk(t);return{text:k?`${k} ${x}`.trim():x,levels:y,...k?{annotations:k}:{}}}function Yk(e){return e.length?e[0].toUpperCase()+e.slice(1):e}function Gk(e,t){return 1!==e&&"body"===t?"bodies":1===e?t:t+"s"}function Vk(e){return((e??"unknown")+"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"unknown"}function Xk(e,t,o={}){const n=o.locale??"en",r=Math.max(1,o.maxLeaves??200),i=Hk(n),s=qx(e,t,o.recipe);if(s)return function(e,t,o={}){const n=Wx(t),r=zx(t),i=Math.max(1,o.maxLeaves??200);if("function"==typeof e.navigation)return e.navigation({data:n,config:r,locale:o.locale??"en"});const s=(a=e.navigation)&&"object"==typeof a?e.navigation:void 0;var a;const l=(s?.groupByRole?Gx(e,s.groupByRole):void 0)??(s?.groupBy?.[0]?Gx(e,s.groupBy[0])??e.dataRoles.find(e=>e.field===s.groupBy?.[0]):void 0)??Vx(e,["nominal","ordinal"]),c=l?Yx(l,r,n):void 0,u=(s?.idRole?Gx(e,s.idRole):void 0)??Vx(e,["identifier"]),d=u?Yx(u,r,n):void 0,h={id:"root",role:"chart",label:s?.summaryTemplate?Xx(s.summaryTemplate,void 0,e,r,n,{count:n.length}):`${e.name}: ${n.length} ${1===n.length?"item":"items"} represented.`,level:1,children:[]};let f=0;const p=(t,o,i)=>{const a=d?t[d]:void 0,l=s?.itemLabelTemplate?Xx(s.itemLabelTemplate,t,e,r,n,{count:n.length}):function(e,t,o,n){const r=Vx(t,["nominal","ordinal"]),i=t.dataRoles.filter(e=>"quantitative"===e.semanticType),s=r?Yx(r,o,n):void 0,a=[];s&&null!=e[s]&&a.push(e[s]+"");for(const t of i){const r=Yx(t,o,n);r&&null!=e[r]&&a.push(`${t.role}: ${e[r]+""}`)}return a.length>0?a.join(", "):"Data item"}(t,e,r,n);return{id:"datum-"+Vk(a??o),role:"datum",label:l,level:i,datum:t}};if(c){const e=new Map;for(const t of n){const o=(t[c]??"Uncategorized")+"",n=e.get(o);n?n.push(t):e.set(o,[t])}h.children=[...e].map(([e,t],o)=>{const n=t.slice(0,Math.max(0,i-f));f+=n.length;const r=n.map((e,t)=>p(e,1e5*o+t,3));return t.length>n.length&&r.push({id:"more-"+Vk(e),role:"datum",label:`…and ${t.length-n.length} more items`,level:3}),{id:"group-"+Vk(e),role:"series",label:`${e}: ${t.length} ${1===t.length?"item":"items"}.`,level:2,children:r}})}else{const e=n.slice(0,i);h.children=e.map((e,t)=>p(e,t,2)),n.length>e.length&&h.children.push({id:"more",role:"datum",label:`…and ${n.length-e.length} more items`,level:2})}return h}(s,t,{maxLeaves:r,locale:n});const a={id:"root",role:"chart",label:qk(e,t,{locale:n}).text||"Chart.",level:1,children:[]},l=function(e,t){const o=Array.isArray(e.annotations)?e.annotations:null;if(!o)return null;const n=Ak(o.filter(e=>!!e&&"object"==typeof e));if(0===n.length)return null;let r=0;const i=n.slice(0,t).map(e=>{const t=e.lifecycle?.status,o=t&&"accepted"!==t?` (${t})`:"";return{id:"annotation-"+r++,role:"annotation",level:3,label:`${n=zk(e),n?n.charAt(0).toUpperCase()+n.slice(1):n}${o}.`,datum:e};var n});n.length>t&&i.push({id:"annotation-"+r++,role:"annotation",level:3,label:`…and ${n.length-t} more annotations.`});const s=n.length;return{id:"annotations",role:"annotation",level:2,label:`Annotations: ${1===s?"one marked feature":s+" marked features"}.`,children:i}}(t,r),c=Array.isArray(t.data)?t.data:null,u=yk.has(e)||bk.has(e)||vk.has(e)||xk.has(e);if(!c||0===c.length||!u)return l&&(a.children=[l]),a;const{measure:d,measureFallback:h,dimension:f,dimensionFallback:p}=kk(e,t),m=re(d,h),g=ie(f,p),y="string"==typeof d&&d?d:h,b="string"==typeof f&&f?f:p,v=wk(t);let x=0;const k=e=>`${e}-${x++}`,w=(e,t)=>{const o=e.slice(0,r).map(e=>((e,t)=>{const o=m(e),n=Sk(g(e),i);return{id:k("datum"),role:"datum",level:t,label:`${n}: ${Number.isFinite(o)?i(o):"—"}`,value:Number.isFinite(o)?o:void 0,datum:e}})(e,t));return e.length>r&&o.push({id:k("more"),role:"datum",level:t,label:`…and ${e.length-r} more points`}),o},S=[];if(yk.has(e)||bk.has(e)){let t=1/0,o=-1/0,n=1/0,r=-1/0;const s=[];let a=!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);s.push(l),"number"==typeof l&&Number.isFinite(l)?(n>l&&(n=l),l>r&&(r=l)):a=!1}const l=new Set,u=[];for(const e of s){const t=e+"";l.has(t)||(l.add(t),u.push(e))}const d=a?`${i(n)} to ${i(r)}`:`${Sk(u[0],i)} to ${Sk(u[u.length-1],i)} (${bk.has(e)?u.length+" categories":c.length+" points"})`;S.push({id:k("axis"),role:"axis",level:2,label:`${bk.has(e)?"Category axis":"X axis"}: ${b}, ${d}.`}),t>o||S.push({id:k("axis"),role:"axis",level:2,label:`Value axis: ${y}, ${i(t)} to ${i(o)}.`})}if(v){const o=ie(v,v),r=new Map;for(const e of c){const t=(o(e)??"—")+"",n=r.get(t);n?n.push(e):r.set(t,[e])}const i=[];for(const[o,s]of r){const r=qk(e,{...t,data:s},{levels:["l2","l3"],locale:n}).text;i.push({id:k("series"),role:"series",level:2,label:`Series ${o}: ${r}`,children:w(s,3)})}a.children=[...S,...i]}else a.children=[...S,...w(c,2)];return l&&a.children.push(l),a}var Uk=c(require("react")),Kk=null,Zk=new Set,Qk=new Set;function Jk(e,t){void 0!==console&&console.warn(`[conversationArc] ${e} failed:`,t)}function ew(e,t){try{const o=t();o&&"function"==typeof o.then&&Promise.resolve(o).catch(t=>Jk(e,t))}catch(t){Jk(e,t)}}var tw=Object.freeze([]),ow=tw,nw=!1;function rw(){nw=!0}var iw=new Set;function sw(){for(const e of iw)try{e()}catch(e){void 0!==console&&console.warn("[conversationArc] change subscriber threw:",e)}}function aw(){return Kk}var lw={get enabled(){return Kk?.enabled??!1},get sessionId(){return Kk?.sessionId??null},get capacity(){return Kk?.capacity??0},record(e){const t=aw();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();rw(),sw();for(const e of Zk)try{e(o)}catch(e){void 0!==console&&console.warn("[conversationArc] subscriber threw:",e)}return function(e){for(const t of Qk)t.record&&ew("sink record",()=>t.record?.(e))}(o),o},flush(){const e=aw();if(!e)return[];const t=e.buffer.slice();return e.buffer=[],rw(),sw(),function(e){for(const t of Qk)t.flush&&ew("sink flush",()=>t.flush?.(e))}(t),t},getEvents:()=>nw?(ow=Kk?Object.freeze(Kk.buffer.slice()):tw,nw=!1,ow):ow,subscribe:e=>(Zk.add(e),()=>{Zk.delete(e)}),clear(){const e=aw();e&&(e.buffer=[],rw(),sw()),function(){for(const e of Qk)e.clear&&ew("sink clear",()=>e.clear?.())}()},reset(){if(Zk.clear(),Qk.clear(),ow=tw,nw=!1,!Kk)return sw(),void iw.clear();Kk.buffer=[],Kk.enabled=!1,Kk=null,sw(),iw.clear()}},cw=require("react/jsx-runtime"),uw={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0,padding:0,margin:-1};function dw({tree:e,label:t,visible:o=!1,className:n,onActiveChange:r,activeId:i,chartId:s,onObservation:a,onAnnotationActivate:l}){const[c,u]=Uk.useState(()=>new Set([e.id])),[d,h]=Uk.useState(e.id),f=void 0!==i,p=f?i:d,m=Uk.useRef(null),g=Uk.useRef(new Map),y=Ur(e=>e.pushObservation),b=Uk.useCallback(e=>{a?.(e),y?.(e)},[a,y]),v=Uk.useMemo(()=>function(e){const t=new Map,o=e=>{for(const n of e.children??[])t.set(n.id,e),o(n)};return o(e),t}(e),[e]),x=Uk.useMemo(()=>function(e,t){const o=[],n=e=>{if(o.push(e),e.children&&e.children.length>0&&t.has(e.id))for(const t of e.children)n(t)};return n(e),o}(e,c),[e,c]);Uk.useEffect(()=>{f||x.some(e=>e.id===d)||h(e.id)},[x,d,e.id,f]),Uk.useEffect(()=>{const e=[];let t=v.get(p);for(;t;)e.push(t.id),t=v.get(t.id);e.length>0&&u(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})},[p,v]),Uk.useEffect(()=>{m.current?.contains(document.activeElement)&&g.current.get(p)?.focus()},[p]);const k=Uk.useCallback((e,t,o)=>{lw.enabled&&lw.record("focus"===t?{type:"nav-node-focused",chartId:s,nodeId:e.id,role:e.role,level:e.level,label:e.label.length>200?e.label.slice(0,200):e.label}:{type:"nav-branch-expanded",chartId:s,nodeId:e.id,role:e.role,level:e.level,expanded:!!o})},[s]),w=Uk.useCallback(e=>{e.id!==p&&(f||h(e.id),r?.(e),k(e,"focus"),e.datum&&b({type:"focus",datum:e.datum,inputType:"navigation-tree",timestamp:Date.now(),chartType:"AccessibleNavTree",chartId:s}))},[r,f,k,p,b,s]),S=Uk.useCallback(e=>{if(e.datum){if("annotation"===e.role){const t=Zr(e.datum);return l?.({annotation:e.datum,annotationId:t,chartId:s,inputType:"navigation-tree"}),void(t&&b({type:"annotation-activate",annotationId:t,inputType:"navigation-tree",timestamp:Date.now(),chartType:"AccessibleNavTree",chartId:s}))}b({type:"activate",datum:e.datum,inputType:"navigation-tree",timestamp:Date.now(),chartType:"AccessibleNavTree",chartId:s})}},[s,b,l]),A=e=>{u(t=>new Set(t).add(e.id)),k(e,"toggle",!0)},C=e=>{u(t=>{const o=new Set(t);return o.delete(e.id),o}),k(e,"toggle",!1)},M=(e,t,n)=>{const r=!!e.children&&e.children.length>0,i=c.has(e.id);return(0,cw.jsxs)("li",{role:"treeitem","aria-label":e.label,"aria-level":e.level,"aria-posinset":t,"aria-setsize":n,"aria-expanded":r?i:void 0,"aria-selected":e.id===p,tabIndex:e.id===p?0:-1,ref:t=>{g.current.set(e.id,t)},onClick:t=>{t.stopPropagation(),w(e),r?(i?C:A)(e):S(e)},style:o?{listStyle:"none",padding:"2px 6px",paddingLeft:6+16*(e.level-1),cursor:r?"pointer":"default",fontSize:13,color:"var(--semiotic-text, currentColor)",background:e.id===p?"var(--semiotic-surface, var(--semiotic-grid, var(--semiotic-bg, #f0f4f8)))":"transparent",outline:"none"}:void 0,children:[(0,cw.jsxs)("span",{className:"semiotic-nav-tree-label semiotic-nav-tree-"+e.role,children:[o&&r?i?"▾ ":"▸ ":"",e.label]}),r&&i&&(0,cw.jsx)("ul",{role:"group",style:o?{margin:0,padding:0}:void 0,children:e.children.map((t,o)=>M(t,o+1,e.children.length))})]},e.id)};return(0,cw.jsx)("div",{ref:m,className:"semiotic-nav-tree"+(n?" "+n:""),style:o?void 0:uw,onKeyDown:e=>{const t=x.findIndex(e=>e.id===p);if(-1===t)return;const o=x[t],n=!!o.children&&o.children.length>0,r=c.has(o.id);let i=!0;switch(e.key){case"ArrowDown":w(x[Math.min(t+1,x.length-1)]);break;case"ArrowUp":w(x[Math.max(t-1,0)]);break;case"Home":w(x[0]);break;case"End":w(x[x.length-1]);break;case"ArrowRight":n&&!r?A(o):n&&r?w(o.children[0]):i=!1;break;case"ArrowLeft":if(n&&r)C(o);else{const e=v.get(o.id);e?w(e):i=!1}break;case"Enter":case" ":n?(r?C:A)(o):S(o);break;default:i=!1}i&&(e.preventDefault(),e.stopPropagation())},children:(0,cw.jsx)("ul",{role:"tree","aria-label":t||"Chart navigation",style:o?{margin:0,padding:0}:void 0,children:M(e,1,1)})})}var hw=c(require("react")),fw=require("react/jsx-runtime");function pw(e,t,o=0){const n=Math.min(t[0],t[1]),r=Math.max(t[0],t[1]),i=Math.max(n,Math.min(r,e[0])),s=Math.max(n,Math.min(r,e[1])),a=i>s?[s,i]:[i,s];if(a[1]-a[0]>=o)return a;const l=(a[0]+a[1])/2,c=o/2;return[Math.max(n,Math.min(r-o,l-c)),Math.min(r,Math.max(n+o,l+c))]}function mw(e,t,o,n=1,r=n){const i="in"===o?n:-n;return pw([e[0]+i,e[1]-i],t,r)}function gw(e){const{domain:t,initialValue:o=t,step:n=1,minSpan:r=n,label:i,formatValue:s,onChange:a}=e,[l,c]=hw.useState(()=>pw(o,t,r)),u=pw(l,t,r),d=hw.useCallback(e=>{const o=pw(e,t,r);c(o),a?.(o)},[t,r,a]),h=hw.useMemo(()=>({label:i,domain:t,value:u,step:n,formatValue:s,onChange:d,onClear:()=>d(t)}),[t,s,i,d,n,u]),f=hw.useMemo(()=>({onZoomIn:()=>d(mw(u,t,"in",n,r)),onZoomOut:()=>d(mw(u,t,"out",n,r)),onReset:()=>d(t)}),[t,r,d,n,u]);return{value:u,setValue:d,xExtent:u,brush:h,zoom:f}}var yw={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)))"},bw={fontSize:11,fontWeight:700,letterSpacing:"0.04em",textTransform:"uppercase",color:"var(--semiotic-text-secondary, #57606a)"};function vw(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 xw(e){return"function"==typeof e}function kw({brush:e,targetSize:t}){const o=e?.value,n=e?.domain,r=!!o&&!!n,i=!0===e?.disabled,s=e?.formatValue??(e=>e),a=!!e?.onChange&&r&&!i,l=n?.[0]??0,c=n?.[1]??1,u=o?.[0]??l,d=o?.[1]??c,h=e?.step??((c-l)/100||1);return(0,fw.jsxs)("section",{style:yw,"aria-label":"Brush controls",children:[(0,fw.jsx)("div",{style:bw,children:e?.label??"Filter range"}),r?(0,fw.jsxs)("div",{style:{display:"grid",gap:8},children:[(0,fw.jsxs)("label",{style:{display:"grid",gap:4,fontSize:12},children:[(0,fw.jsxs)("span",{children:["Start: ",s(u)]}),(0,fw.jsx)("input",{type:"range",min:l,max:c,step:h,value:u,disabled:!a,style:{minHeight:t},onChange:t=>{const o=Number(t.currentTarget.value);e?.onChange?.([Math.min(o,d),d])}})]}),(0,fw.jsxs)("label",{style:{display:"grid",gap:4,fontSize:12},children:[(0,fw.jsxs)("span",{children:["End: ",s(d)]}),(0,fw.jsx)("input",{type:"range",min:l,max:c,step:h,value:d,disabled:!a,style:{minHeight:t},onChange:t=>{const o=Number(t.currentTarget.value);e?.onChange?.([u,Math.max(o,u)])}})]})]}):(0,fw.jsx)("div",{style:{fontSize:12,color:"var(--semiotic-text-secondary, #57606a)"},children:"Provide a brush domain and value to expose range inputs beside the drag gesture."}),(0,fw.jsx)("button",{type:"button",disabled:i||!xw(e?.onClear),onClick:e?.onClear,style:vw(t),children:"Clear range"})]})}function ww({zoom:e,targetSize:t}){const o=!0===e?.disabled;return(0,fw.jsxs)("section",{style:yw,"aria-label":"Zoom controls",children:[(0,fw.jsx)("div",{style:bw,children:e?.label??"Zoom"}),(0,fw.jsxs)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[(0,fw.jsx)("button",{type:"button","aria-label":"Zoom out",disabled:o||!xw(e?.onZoomOut),onClick:e?.onZoomOut,style:vw(t),children:"-"}),(0,fw.jsx)("button",{type:"button","aria-label":"Reset zoom",disabled:o||!xw(e?.onReset),onClick:e?.onReset,style:vw(t),children:"Reset"}),(0,fw.jsx)("button",{type:"button","aria-label":"Zoom in",disabled:o||!xw(e?.onZoomIn),onClick:e?.onZoomIn,style:vw(t),children:"+"})]})]})}function Sw({legend:e,targetSize:t}){const o=!0===e?.disabled,n=e?.items??[];return(0,fw.jsxs)("section",{style:yw,"aria-label":"Legend controls",children:[(0,fw.jsx)("div",{style:bw,children:e?.label??"Series"}),n.length>0&&(0,fw.jsx)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:n.map(n=>{const r=!1!==n.active;return(0,fw.jsxs)("button",{type:"button",disabled:o||n.disabled||!e?.onToggle,onClick:()=>e?.onToggle?.(n.id,!r),style:vw(t,r),"aria-pressed":r,children:[n.color&&(0,fw.jsx)("span",{"aria-hidden":"true",style:{display:"inline-block",width:9,height:9,marginRight:6,borderRadius:999,background:n.color}}),n.label??n.id]},n.id)})}),(0,fw.jsxs)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[(0,fw.jsx)("button",{type:"button",disabled:o||!xw(e?.onShowAll),onClick:e?.onShowAll,style:vw(t),children:"Show all"}),(0,fw.jsx)("button",{type:"button",disabled:o||!xw(e?.onHideAll),onClick:e?.onHideAll,style:vw(t),children:"Hide all"})]})]})}function Aw({controls:e,targetSize:t=44,compact:o=!1,className:n,style:r,ariaLabel:i="Mobile chart controls",brush:s,zoom:a,legend:l}){const c=function(e,t){if(!1===e)return[];if(!0===e||"all"===e)return["brush","zoom","legend"];if(Array.isArray(e))return e;if(e)return[e];const o=[];return t.brush&&o.push("brush"),t.zoom&&o.push("zoom"),t.legend&&o.push("legend"),o}(e,{brush:s,zoom:a,legend:l});return 0===c.length?null:(0,fw.jsxs)("div",{className:n,role:"group","aria-label":i,style:{display:"grid",gridTemplateColumns:o?"1fr":"repeat(auto-fit, minmax(180px, 1fr))",gap:10,...r},children:[c.includes("brush")&&(0,fw.jsx)(kw,{brush:s,targetSize:t}),c.includes("zoom")&&(0,fw.jsx)(ww,{zoom:a,targetSize:t}),c.includes("legend")&&(0,fw.jsx)(Sw,{legend:l,targetSize:t})]})}var Cw=new Set(["LineChart","AreaChart","DifferenceChart","StackedAreaChart","Scatterplot","ConnectedScatterplot","BubbleChart","QuadrantChart","MultiAxisLineChart","CandlestickChart","Heatmap","MinimapChart","RealtimeLineChart","RealtimeHeatmap"]),Mw=new Set(["BarChart","StackedBarChart","GroupedBarChart","SwarmPlot","BoxPlot","Histogram","ViolinPlot","DotPlot","RidgelinePlot","FunnelChart","LikertChart","SwimlaneChart"]),_w={Scatterplot:["pointRadius","hoverRadius"],BubbleChart:["pointRadius","hoverRadius"],ConnectedScatterplot:["pointRadius","hoverRadius"],QuadrantChart:["pointRadius","hoverRadius"],SwarmPlot:["pointRadius","hoverRadius"],DotPlot:["dotRadius","hoverRadius"]};function jw(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function Rw(e){return"string"==typeof e&&e.trim().length>0}function Pw(e){const t=jw(e.capability)?e.capability:null,o=jw(e.recipe)?e.recipe:null,n=[e.mobileSemantics,e.mobileVisualization,e.mobile,t?.mobile,o?.mobile];for(const e of n)if(jw(e))return e;return null}function Lw(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 Tw(e){return Lw(e.size)||Lw(jw(e.frameProps)?e.frameProps.size:void 0)||("number"==typeof e.width&&"number"==typeof e.height?[e.width,e.height]:null)}function Iw(e,t){e.push({...t,status:"pass"})}function $w(e,t){e.push({...t,status:"warn"})}function Nw(e,t){e.push({...t,status:"manual"})}function Dw(e,t={},o={}){const n=o.viewportWidth??390,r=o.targetSize??44,i=Tw(t),s=zp(t,{width:n,height:i?.[1]}),a=[],l=Tw(t=s.props),c=Pw(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=Pw(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,f=Rw(t.title)||Rw(t.summary)||Rw(t.description)||!0===c?.summary||Rw(c?.summary);if(s.matches.length>0&&Iw(a,{id:"layout.responsive-rule-applied",category:"layout",impact:"medium",message:`${s.matches.length} responsive rule(s) applied for the ${n}px mobile audit.`}),l){const[t,o]=l;t>n&&!d?$w(a,{id:"layout.fixed-desktop-size",category:"layout",impact:"high",message:`Chart size is ${t}px wide against a ${n}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."}):Iw(a,{id:"layout.fixed-desktop-size",category:"layout",impact:"high",message:"No fixed desktop-width overflow risk is visible from the config."}),"number"==typeof c?.minViewportWidth&&c.minViewportWidth>n&&$w(a,{id:"layout.mobile-min-width",category:"layout",impact:"high",message:`The declared mobile contract supports ${c.minViewportWidth}px minimum, wider than the audited ${n}px viewport.`,fix:"Add a narrower breakpoint, summary-card fallback, or explicit horizontal-scroll affordance with a non-visual equivalent."});const r=t/Math.max(1,o);430>=n&&r>2.4&&"BigNumber"!==e&&$w(a,{id:"layout.wide-aspect-ratio",category:"layout",impact:"medium",message:`Chart aspect ratio is ${r.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&&$w(a,{id:"layout.too-short-for-reading",category:"layout",impact:"medium",message:`Chart height is ${o}px; most phone charts need enough vertical room for marks plus readable labels.`,fix:"Reserve more vertical space, remove nonessential axes, or switch to a card/sparkline pattern with external labels."})}else Nw(a,{id:"layout.unknown-size",category:"layout",impact:"medium",message:"No explicit size is available to audit. This may be responsive, but static mobile overflow cannot be checked.",fix:"Audit rendered widths at 320, 360, 390, and 430px, or pass size/responsiveRules metadata into the config."});const p=function(e){const t=[e.data,e.points,e.lines,e.nodes,e.edges,e.areas,jw(e.frameProps)?e.frameProps.data:void 0];let o=0;for(const e of t)Array.isArray(e)&&(o+=e.length);return o}(t);p>0&&(p>("number"==typeof c?.maxMarks?c.maxMarks:Cw.has(e)?1.25*n:Mw.has(e)?Math.max(8,Math.floor(n/34)):n)?$w(a,{id:"density.mark-budget",category:"density",impact:Cw.has(e)?"medium":"high",message:`${p} data item(s) exceed the rough mobile density budget for ${e} at ${n}px.`,fix:"Aggregate, filter, facet into small multiples, switch to a summary-card plus detail view, or use progressive disclosure."}):Iw(a,{id:"density.mark-budget",category:"density",impact:"medium",message:p+" 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(n/58));m>e&&$w(a,{id:"density.explicit-tick-count",category:"density",impact:"medium",message:`${m} explicit tick(s) exceed a phone-friendly budget of about ${e} at ${n}px.`,fix:"Use adaptive ticks, fewer tickValues, direct labels, or move exact values into a tap-accessible detail panel."})}else g&&(Cw.has(e)||Mw.has(e))&&Nw(a,{id:"density.axis-label-collision",category:"density",impact:"medium",message:"Axes are enabled, but label collision depends on rendered tick text and cannot be checked statically.",fix:"Verify tick labels at phone widths or provide explicit mobile tick density."});!function(e){const t=jw(e.frameProps)?e.frameProps:{};return(!0===e.enableHover||null!=e.tooltipContent||null!=e.tooltip||null!=t.tooltipContent||!0===t.enableHover)&&!function(e){const t=Pw(e),o=jw(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||Rw(t?.interaction?.hoverFallback)}(e)}(t)?Iw(a,{id:"interaction.hover-only-detail",category:"interaction",impact:"high",message:"No hover-only detail path is visible from the config."}):$w(a,{id:"interaction.hover-only-detail",category:"interaction",impact:"high",message:"The chart exposes tooltip/hover detail without an obvious tap, selection, or control alternative.",fix:"Enable tap-to-select, a persistent details panel, visible segment buttons, or another non-hover path for the same information."});const y=function(e,t){const o=_w[e];if(!o)return null;let n=o.includes("hoverRadius")?30:null;for(const e of o){const o=t[e];"number"==typeof o&&Number.isFinite(o)&&o>0&&(n=null==n?o:Math.max(n,o))}return null==n?null:2*n}(e,t),b=jw(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?$w(a,{id:"interaction.target-size-minimum",category:"interaction",impact:"high",message:`Small interactive marks expose an estimated ${v}px pointer target, below WCAG's 24px minimum.`,fix:"Increase mark radius/hoverRadius, add tap snapping to nearest datum, or provide larger external controls."}):r>v?$w(a,{id:"interaction.target-size-comfort",category:"interaction",impact:"medium",message:`Pointer target is about ${v}px, above 24px but below the ${r}px comfortable phone target.`,fix:"Use hoverRadius/tapRadius near 44px while keeping the visible mark small if needed."}):Iw(a,{id:"interaction.target-size-comfort",category:"interaction",impact:"medium",message:`Pointer target is about ${v}px, meeting the configured ${r}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=Pw(e),n=jw(e.mobileInteraction)?e.mobileInteraction:null,r=n?.standardControls;return!!(null!=e.controls||null!=e.mobileControls||!0===e.alternativeControls||Array.isArray(o?.interaction?.alternatives)&&o.interaction.alternatives.length>0)||!0===r||"all"===r||t.every(e=>"brush"===e?Array.isArray(r)?r.includes("brush"):"brush"===r:"pan/zoom"===e?Array.isArray(r)?r.includes("zoom"):"zoom"===r:"legend filtering"===e&&(Array.isArray(r)?r.includes("legend"):"legend"===r))}(t,x)&&$w(a,{id:"interaction.complex-gesture-alternative",category:"interaction",impact:"high",message:`Mobile-hostile complex interaction detected: ${x.join(", ")} without standard control alternatives.`,fix:"Pair gestures with buttons, range inputs, chips, or a details panel that works with touch and keyboard."}),!1===t.showLegend||!1===t.legend||!0!==t.showLegend&&!0!==t.legend&&null==t.colorBy&&null==t.groupBy&&null==t.lineBy&&null==t.areaBy&&null==t.stackBy||!0===t.directLabel||!0===t.showLabels||"direct"===t.labelStrategy||"direct-end"===t.labelStrategy||"direct"===c?.labels?.strategy||"inline"===c?.labels?.strategy||"external"===c?.labels?.strategy||n>430||$w(a,{id:"semantics.legend-over-direct-labels",category:"semantics",impact:"medium",message:"The chart appears to rely on a legend instead of direct labels at phone width.",fix:"Prefer direct end labels, inline labels, or a compact chip selector so readers do not bounce between plot and legend."});const k=Array.isArray(t.annotations)?t.annotations.filter(e=>jw(e)):[];if(k.length>("number"==typeof c?.maxAnnotations?c.maxAnnotations:3)&&430>=n&&$w(a,{id:"annotation.mobile-density",category:"annotation",impact:"medium",message:k.length+" annotation(s) compete for phone plot space.",fix:"Assign annotation priority, collapse secondary notes into a callout list, or provide shorter mobileText."}),k.length>0){const e=k.filter(e=>!Rw(e.mobileText)&&!Rw(e.shortText)&&!Rw(e.label));e.length>0&&Nw(a,{id:"annotation.mobile-copy",category:"annotation",impact:"low",message:e.length+" annotation(s) lack explicit short/mobile copy.",fix:"Add mobileText or shortText for notes that need to survive narrow layouts."})}d||"BigNumber"===e||Nw(a,{id:"layout.no-responsive-transform",category:"layout",impact:"low",message:"No explicit responsive transformation hint is present.",fix:"Declare responsiveRules/mobileLayout or a density/label strategy so the mobile version is a designed transformation, not an accidental resize."}),u&&(c?(Iw(a,{id:"semantics.custom-mobile-contract",category:"semantics",impact:"medium",message:"Custom chart/recipe provides a mobileSemantics/mobile contract, so the audit can inspect its authored phone behavior."}),!1===c.custom?.dataBearingSceneNodes?$w(a,{id:"semantics.custom-data-bearing-scene",category:"semantics",impact:"medium",message:"Custom mobile contract says emitted scene nodes are not data-bearing.",fix:"Preserve datum references, semantic roles, or accessible-table fields so intelligence, navigation, and tap details can recover the chart's meaning."}):!0!==c.custom?.dataBearingSceneNodes&&Nw(a,{id:"semantics.custom-data-bearing-scene",category:"semantics",impact:"low",message:"Custom chart mobile contract does not state whether scene nodes are data-bearing.",fix:"Set mobile.custom.dataBearingSceneNodes and mobile.custom.navigationGranularity for custom layouts and interoperability adapters."})):Nw(a,{id:"semantics.custom-mobile-contract",category:"semantics",impact:"medium",message:"Custom chart layout is opaque to static mobile analysis because no mobileSemantics/mobile contract is present.",fix:"Declare mobileSemantics with strategy, breakpoints, mark budgets, touch target size, interaction alternatives, and custom scene semantics."})),f||h||$w(a,{id:"semantics.no-mobile-summary",category:"semantics",impact:"medium",message:"No title, summary, description, or ChartContainer context is visible from the config.",fix:"Add title/summary text or wrap in ChartContainer so the small-screen reader gets the task before the chart."});const w=a.filter(e=>"warn"===e.status),S={highRisk:w.filter(e=>"high"===e.impact).length,warnings:w.length,manual:a.filter(e=>"manual"===e.status).length,passes:a.filter(e=>"pass"===e.status).length};return{component:e,viewportWidth:n,ok:0===S.highRisk,summary:S,findings:a,reference:"Mobile visualization audit: informed by MobileVisFixer, mobile exploratory interaction research, small-multiple mobile studies, responsive visualization grammars, constraint-based breakpoints, and WCAG 2.2 input modalities."}}function Ew(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function Bw(e){return e&&"object"==typeof e&&"number"==typeof e.targetSize?e.targetSize:void 0}function Fw(e){return Array.isArray(e)?e.length>0:!!e}var Hw=require("react/jsx-runtime"),Ow={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0,padding:0,margin:-1};function zw(){const e=function(){const e=Ms.useContext(js);return e?e.toggle:null}();return e?(0,Hw.jsx)("button",{className:"semiotic-chart-action",onClick:e,title:"Data summary","aria-label":"Toggle data summary",style:Qw,children:(0,Hw.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,Hw.jsx)("rect",{x:"1",y:"1",width:"12",height:"3",rx:"0.5"}),(0,Hw.jsx)("rect",{x:"1",y:"6",width:"8",height:"3",rx:"0.5"}),(0,Hw.jsx)("rect",{x:"1",y:"11",width:"5",height:"2",rx:"0.5"})]})}):null}var Ww={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)"},qw={error:4,warning:3,info:2,success:1,neutral:0};function Yw({level:e}){const t={width:15,height:15,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0};switch(e){case"error":case"warning":return(0,Hw.jsxs)("svg",{...t,children:[(0,Hw.jsx)("path",{d:"M8 1.8 15 14H1L8 1.8Z"}),(0,Hw.jsx)("path",{d:"M8 6.4v3.4"}),(0,Hw.jsx)("circle",{cx:"8",cy:"11.8",r:"0.5",fill:"currentColor",stroke:"none"})]});case"success":return(0,Hw.jsxs)("svg",{...t,children:[(0,Hw.jsx)("circle",{cx:"8",cy:"8",r:"6.4"}),(0,Hw.jsx)("path",{d:"M5 8.2 7 10.2 11 5.8"})]});case"info":return(0,Hw.jsxs)("svg",{...t,children:[(0,Hw.jsx)("circle",{cx:"8",cy:"8",r:"6.4"}),(0,Hw.jsx)("path",{d:"M8 7.4V11"}),(0,Hw.jsx)("circle",{cx:"8",cy:"5",r:"0.5",fill:"currentColor",stroke:"none"})]});default:return(0,Hw.jsxs)("svg",{...t,children:[(0,Hw.jsx)("path",{d:"M8 2a3.5 3.5 0 0 0-3.5 3.5c0 4-1.5 5-1.5 5h10s-1.5-1-1.5-5A3.5 3.5 0 0 0 8 2Z"}),(0,Hw.jsx)("path",{d:"M6.5 13a1.5 1.5 0 0 0 3 0"})]})}}function Gw({notification:e,level:t,onDismiss:o}){const n=Ww[t]??Ww.info,r=!1!==e.dismissible;return(0,Hw.jsxs)("div",{className:"semiotic-chart-notification semiotic-chart-notification--"+t,style:{display:"flex",alignItems:"flex-start",gap:8,padding:"6px 10px",borderRadius:4,borderLeft:"3px solid "+n,background:"var(--semiotic-surface, rgba(127, 127, 127, 0.08))"},children:[(0,Hw.jsxs)("div",{style:{flex:1,minWidth:0},children:[e.source&&(0,Hw.jsx)("div",{className:"semiotic-chart-notification-source",style:{fontSize:9,fontWeight:700,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--semiotic-text-secondary, #666)"},children:e.source}),e.title&&(0,Hw.jsx)("div",{className:"semiotic-chart-notification-title",style:{fontSize:12,fontWeight:600,color:n},children:e.title}),(0,Hw.jsx)("div",{className:"semiotic-chart-notification-message",style:{fontSize:12,lineHeight:1.45,color:"var(--semiotic-text, #333)"},children:e.message})]}),r&&(0,Hw.jsx)("button",{className:"semiotic-chart-notification-dismiss","aria-label":e.title?"Dismiss notification: "+e.title:"Dismiss notification",title:"Dismiss",onClick:o,style:{...Qw,width:18,height:18,fontSize:13,lineHeight:1,flex:"none"},children:"×"})]})}function Vw({visible:e,onDismiss:t}){const[o,n]=gk.useState(!1),r=gk.useRef(null),i=gk.useRef(null);if(gk.useEffect(()=>{0===e.length&&o&&n(!1)},[e.length,o]),gk.useEffect(()=>{if(!o)return;const e=e=>{r.current&&!r.current.contains(e.target)&&n(!1)},t=e=>{"Escape"===e.key&&(n(!1),i.current?.focus())};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)}},[o]),0===e.length)return null;const s=e.reduce((e,t)=>qw[t.level]>qw[e]?t.level:e,e[0].level),a=Ww[s]??Ww.info,l=e.length,c=`${l} chart notification${1===l?"":"s"}, most severe: ${s}`;return(0,Hw.jsxs)("div",{ref:r,className:"semiotic-chart-notifications",style:{position:"relative",display:"inline-flex"},children:[(0,Hw.jsx)("span",{style:Ow,role:"status","aria-live":"polite",children:c}),(0,Hw.jsxs)("button",{ref:i,className:"semiotic-chart-action semiotic-chart-notifications-toggle","aria-haspopup":"dialog","aria-expanded":o,"aria-label":`${c}. ${o?"Hide":"Show"} notifications`,title:c,onClick:()=>n(e=>!e),style:{...Qw,color:a,position:"relative"},children:[(0,Hw.jsx)(Yw,{level:s}),(0,Hw.jsx)("span",{className:"semiotic-chart-notifications-badge","aria-hidden":"true",style:{position:"absolute",top:-3,right:-3,minWidth:15,height:15,padding:"0 3px",boxSizing:"border-box",borderRadius:8,background:a,color:"#fff",fontSize:9,fontWeight:700,lineHeight:"15px",textAlign:"center"},children:l>99?"99+":l})]}),o&&(0,Hw.jsx)("div",{className:"semiotic-chart-notifications-popover",role:"dialog","aria-label":"Chart notifications",style:{position:"absolute",top:"calc(100% + 6px)",right:0,zIndex:20,width:320,maxWidth:"min(360px, 90vw)",maxHeight:320,overflowY:"auto",display:"flex",flexDirection:"column",gap:6,padding:10,textAlign:"left",background:"var(--semiotic-bg, #fff)",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:6,boxShadow:"0 6px 24px rgba(0, 0, 0, 0.16)"},children:e.map(e=>(0,Hw.jsx)(Gw,{notification:e.notification,level:e.level,onDismiss:()=>t(e)},e.key))})]})}var Xw={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 Uw({height:e}){return(0,Hw.jsx)("div",{role:"status","aria-busy":"true","aria-label":"Loading chart",style:{width:"100%",height:e,background:"linear-gradient(90deg, var(--semiotic-border, #e0e0e0) 25%, var(--semiotic-bg, #f5f5f5) 50%, var(--semiotic-border, #e0e0e0) 75%)",backgroundSize:"200% 100%",animation:"semiotic-skeleton-pulse 1.5s ease-in-out infinite",borderRadius:4}})}function Kw({error:e}){return(0,Hw.jsx)("div",{role:"alert",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",minHeight:120,padding:24,boxSizing:"border-box"},children:(0,Hw.jsx)("div",{style:{textAlign:"center",maxWidth:400,fontSize:14,color:"var(--semiotic-text-secondary, #666)",lineHeight:1.5},children:e})})}var Zw=gk.forwardRef(function({title:e,subtitle:t,children:o,width:n="100%",height:r=400,actions:i,chartConfig:s,describe:a,navigable:l,controls:c,banner:u,notifications:d,onNotificationDismiss:h,loading:f=!1,error:p,errorBoundary:m=!1,status:g,detailsPanel:y,mobile:b,mobileAudit:v,className:x,style:k},w){const S=gk.useRef(null),A=gk.useRef(null),[C,M]=gk.useState(!1),[_,j]=gk.useState(()=>new Set);gk.useEffect(()=>{j(e=>{if(0===e.size)return e;const t=new Set((d??[]).map((e,t)=>e.id??t+""));let o=!1;const n=new Set;for(const r of e)t.has(r)?n.add(r):o=!0;return o?n:e})},[d]);const R=gk.useMemo(()=>d?d.map((e,t)=>({notification:e,index:t,key:e.id??t+"",level:e.level??"info"})).filter(({key:e})=>!_.has(e)):[],[d,_]),P=gk.useCallback(e=>{j(t=>new Set(t).add(e.key)),h?.(e.notification,e.index)},[h]),L=!1!==i?.export&&void 0!==i?.export,T=!1!==i?.fullscreen&&void 0!==i?.fullscreen,I=!1!==i?.copyConfig&&void 0!==i?.copyConfig&&s,$=!0===i?.dataSummary,N=gk.useMemo(()=>{if(!a||!s?.component||!s?.props)return"";const e="object"==typeof a?a.levels:void 0;try{return qk(s.component,s.props,e?{levels:e}:{}).text}catch{return""}},[a,s]),D="object"==typeof a&&!0===a.visible,E=gk.useMemo(()=>{if(!l||!s?.component||!s?.props)return null;const e="object"==typeof l?l.maxLeaves:void 0;try{return Xk(s.component,s.props,e?{maxLeaves:e}:{})}catch{return null}},[l,s]),B="object"==typeof l&&!0===l.visible,F=gk.useMemo(()=>"object"==typeof i?.export?i.export:{},[i?.export]),H="object"==typeof i?.copyConfig?i.copyConfig.format:"json",O=gk.useCallback(async e=>{A.current&&await _x(A.current,{...F,...e})},[F]),z=gk.useCallback(()=>{S.current&&(document.fullscreenElement?document.exitFullscreen().catch(()=>{}):S.current.requestFullscreen().catch(()=>{}))},[]),W=gk.useCallback(async e=>{s&&await rk({...s,version:s.version??"1",createdAt:s.createdAt??(new Date).toISOString()},e||H||"json")},[s,H]);gk.useEffect(()=>{const e=()=>{M(!!document.fullscreenElement)};return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[]),gk.useImperativeHandle(w,()=>({export:O,toggleFullscreen:z,copyConfig:W,element:S.current}),[O,z,W]);const q=!0===b?{}:b&&"object"==typeof b?b:null,Y=!!b,G=q?.breakpoint??480,V=void 0===q?.chartMode?"mobile":q.chartMode,X=q?.semantics,U=q?.mobileInteraction??(!!Y||void 0),K=q?.standardControls,Z=Ew(K)?K:null,Q=Z?.controls??(Ew(K)?void 0:K)??function(e){return e&&"object"==typeof e?e.standardControls:void 0}(U),J=gk.useMemo(()=>function(e,t){return Fw(t)?e&&"object"==typeof e?{...e,standardControls:t}:!1===e||null==e?e:{standardControls:t}:e}(U,Q),[U,Q]),ee=Y&&Fw(Q)?(0,Hw.jsx)(Aw,{controls:Q,targetSize:Z?.targetSize??Bw(U)??44,compact:Z?.compact??!0,className:Z?.className,style:Z?.style,ariaLabel:Z?.ariaLabel,brush:Z?.brush,zoom:Z?.zoom,legend:Z?.legend}):null,te=q?.summary,oe=!0===q?.allowHorizontalScroll,ne=!0===q?.hideToolbar,re=gk.useMemo(()=>{if(!v||!s?.component||!s?.props)return null;const e="object"==typeof v?v:{},t=s.props;try{return Dw(s.component,{...t,mobileSemantics:t.mobileSemantics??X,mobileInteraction:t.mobileInteraction??J},{viewportWidth:e.viewportWidth??390,targetSize:e.targetSize??44,inChartContainer:!0})}catch{return null}},[v,s,X,J]);gk.useEffect(()=>{if(!re||re.ok)return;const e=re.findings.filter(e=>"pass"!==e.status).slice(0,5);console.warn(`[Semiotic mobile audit] ${s?.component}: ${re.summary.highRisk} high-risk mobile finding(s), ${re.summary.warnings} warning(s).`,e)},[re,s?.component]);const ie=re&&!re.ok&&"object"==typeof v&&!0===v.visible?(0,Hw.jsxs)("div",{className:"semiotic-chart-mobile-audit",role:"status",style:{padding:"8px 12px",fontSize:12,lineHeight:1.45,color:"var(--semiotic-warning, #6b3f00)",background:"color-mix(in srgb, var(--semiotic-warning, #d97706) 14%, var(--semiotic-bg, #fff))",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},children:["Mobile audit: ",re.summary.highRisk," high-risk finding",1===re.summary.highRisk?"":"s"," and"," ",re.summary.warnings," warning",1===re.summary.warnings?"":"s"," at"," ",("object"==typeof v?v.viewportWidth:void 0)??390,"px."]}):null,se=R.length>0,ae=e||t||c||L||T||I||$||g||se,le=gk.useMemo(()=>{if(!Y||!gk.isValidElement(o))return o;if(!function(e){const t=e.type;return"function"==typeof t||"object"==typeof t&&null!==t}(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?gk.cloneElement(o,t):o},[o,Y,V,X,J]),ce=f?(0,Hw.jsx)(Uw,{height:r}):p?(0,Hw.jsx)(Kw,{error:p}):m?(0,Hw.jsx)(Wh,{children:le}):le;return ue=(0,Hw.jsxs)(Hw.Fragment,{children:[(0,Hw.jsx)("style",{dangerouslySetInnerHTML:{__html:`@keyframes semiotic-skeleton-pulse {\n 0% { background-position: 200% 0; }\n 100% { background-position: -200% 0; }\n}\n@media (max-width: ${G}px) {\n .semiotic-chart-container[data-semiotic-mobile="true"] .semiotic-chart-header {\n padding: 10px 12px !important;\n gap: 10px !important;\n }\n .semiotic-chart-container[data-semiotic-mobile="true"] .semiotic-chart-title-area {\n flex-basis: 100% !important;\n }\n .semiotic-chart-container[data-semiotic-mobile="true"] .semiotic-chart-toolbar {\n width: 100% !important;\n margin-left: 0 !important;\n justify-content: flex-start !important;\n overflow-x: auto !important;\n -webkit-overflow-scrolling: touch;\n }\n .semiotic-chart-container[data-semiotic-mobile="true"][data-semiotic-mobile-hide-toolbar="true"] .semiotic-chart-toolbar {\n display: none !important;\n }\n .semiotic-chart-container[data-semiotic-mobile="true"] .semiotic-chart-action {\n min-width: 32px !important;\n min-height: 32px !important;\n }\n .semiotic-chart-container[data-semiotic-mobile="true"] .semiotic-chart-mobile-summary {\n display: block !important;\n }\n .semiotic-chart-container[data-semiotic-mobile="true"] .semiotic-chart-mobile-standard-controls {\n display: block !important;\n }\n .semiotic-chart-container[data-semiotic-mobile="true"][data-semiotic-mobile-scroll="true"] .semiotic-chart-body {\n overflow-x: auto !important;\n justify-content: flex-start !important;\n -webkit-overflow-scrolling: touch;\n }\n}`}}),(0,Hw.jsxs)("div",{ref:S,className:"semiotic-chart-container"+(x?" "+x:""),"data-semiotic-mobile":Y?"true":void 0,"data-semiotic-mobile-scroll":oe?"true":void 0,"data-semiotic-mobile-hide-toolbar":ne?"true":void 0,style:{width:n,border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:"var(--semiotic-border-radius, 8px)",overflow:"hidden",background:"var(--semiotic-bg, #fff)",fontFamily:"var(--semiotic-font-family, sans-serif)",position:"relative",...C?{display:"flex",flexDirection:"column",width:"100%",height:"100%"}:{},...k},children:[ae&&(0,Hw.jsxs)("div",{className:"semiotic-chart-header",style:{padding:"12px 16px",display:"flex",justifyContent:"space-between",alignItems:"flex-start",flexWrap:"wrap",gap:8,borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},children:[(0,Hw.jsxs)("div",{className:"semiotic-chart-title-area",style:{minWidth:0,flex:"1 1 200px"},children:[e&&(0,Hw.jsx)("div",{className:"semiotic-chart-title",style:{fontSize:14,fontWeight:600,color:"var(--semiotic-text, #333)"},children:e}),t&&(0,Hw.jsx)("div",{className:"semiotic-chart-subtitle",style:{fontSize:12,color:"var(--semiotic-text-secondary, #666)",marginTop:e?2:0},children:t})]}),(0,Hw.jsxs)("div",{className:"semiotic-chart-toolbar",style:{display:"flex",alignItems:"center",gap:4,marginLeft:"auto"},children:[c,se&&(0,Hw.jsx)(Vw,{visible:R,onDismiss:P}),L&&(0,Hw.jsx)("button",{className:"semiotic-chart-action",onClick:()=>O(),title:"Export chart","aria-label":"Export chart",style:Qw,children:(0,Hw.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,Hw.jsx)("path",{d:"M7 2v8M3.5 7L7 10.5 10.5 7"}),(0,Hw.jsx)("path",{d:"M2 12h10"})]})}),$&&(0,Hw.jsx)(zw,{}),T&&(0,Hw.jsx)("button",{className:"semiotic-chart-action",onClick:z,title:C?"Exit fullscreen":"Fullscreen","aria-label":C?"Exit fullscreen":"Enter fullscreen",style:Qw,children:(0,Hw.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,Hw.jsxs)(Hw.Fragment,C?{children:[(0,Hw.jsx)("path",{d:"M9 1v4h4"}),(0,Hw.jsx)("path",{d:"M5 13V9H1"}),(0,Hw.jsx)("path",{d:"M13 5H9V1"}),(0,Hw.jsx)("path",{d:"M1 9h4v4"})]}:{children:[(0,Hw.jsx)("path",{d:"M1 5V1h4"}),(0,Hw.jsx)("path",{d:"M13 9v4H9"}),(0,Hw.jsx)("path",{d:"M9 1h4v4"}),(0,Hw.jsx)("path",{d:"M5 13H1V9"})]})})}),I&&(0,Hw.jsx)("button",{className:"semiotic-chart-action",onClick:()=>W(),title:"Copy config","aria-label":"Copy chart configuration",style:Qw,children:(0,Hw.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,Hw.jsx)("rect",{x:"5",y:"5",width:"8",height:"8",rx:"1"}),(0,Hw.jsx)("path",{d:"M9 5V2a1 1 0 00-1-1H2a1 1 0 00-1 1v6a1 1 0 001 1h3"})]})}),g&&(0,Hw.jsx)("div",{className:"semiotic-chart-status","aria-live":"polite","aria-atomic":"true",style:{padding:"2px 8px",borderRadius:4,fontSize:10,fontWeight:700,letterSpacing:"0.05em",textTransform:"uppercase",background:Xw[g].bg,color:Xw[g].color,lineHeight:"18px"},children:g})]})]}),u&&(0,Hw.jsx)("div",{className:"semiotic-chart-banner",children:u}),ie,te&&(0,Hw.jsx)("div",{className:"semiotic-chart-mobile-summary",style:{display:"none",padding:"8px 12px",fontSize:12,lineHeight:1.45,color:"var(--semiotic-text-secondary, #666)",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},children:te}),ee&&(0,Hw.jsx)("div",{className:"semiotic-chart-mobile-standard-controls",style:{display:"none",padding:"10px 12px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)",background:"var(--semiotic-surface, var(--semiotic-bg, #f6f8fa))"},children:ee}),N&&(0,Hw.jsx)("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)"}:Ow,children:N}),E&&(0,Hw.jsx)("div",{className:"semiotic-chart-nav",style:B?{padding:"8px 8px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)",maxHeight:240,overflow:"auto"}:void 0,children:(0,Hw.jsx)(dw,{tree:E,label:"string"==typeof e&&e?e+" — navigable structure":"Chart navigable structure",visible:B,chartId:"string"==typeof s?.props?.chartId?s.props.chartId:void 0})}),(0,Hw.jsxs)("div",{className:"semiotic-chart-body",ref:A,style:{position:"relative",overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center",...C?{flex:1}:{height:r}},children:[ce,y]})]})]}),$?(0,Hw.jsx)(Rs,{children:ue}):ue;var ue}),Qw={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},Jw=c(require("react")),eS=require("react/jsx-runtime");function tS({children:e,controls:t,mobile:o,breakpoint:n=480,chartMode:r="mobile",mobileInteraction:i=!0,mobileSemantics:s,mobileSummary:a,chips:l=[],activeChip:c,onChipChange:u,detail:d,detailTitle:h="Details",detailMode:f="sheet",initialDetailOpen:p=!1,allowHorizontalScroll:m=!1,hideToolbar:g=!1,chartDefaults:y,...b}){const[v,x]=Jw.useState(()=>c??l.find(e=>!e.disabled)?.id),[k,w]=Jw.useState(p);Jw.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=Jw.useCallback(e=>{e.disabled||(void 0===c&&x(e.id),u?.(e))},[c,u]),C=l.length?(0,eS.jsx)("div",{className:"semiotic-mobile-chip-row",role:"list","aria-label":"Mobile chart controls",children:l.map(e=>(0,eS.jsxs)("button",{type:"button",className:"semiotic-mobile-chip","aria-pressed":e.id===S,disabled:e.disabled,onClick:()=>A(e),title:"string"==typeof e.description?e.description:void 0,children:[(0,eS.jsx)("span",{children:e.label}),e.description&&(0,eS.jsx)("small",{className:"semiotic-mobile-chip-description",children:e.description})]},e.id))}):null,M=a||C?(0,eS.jsxs)("div",{className:"semiotic-mobile-summary-card",children:[a&&(0,eS.jsx)("div",{className:"semiotic-mobile-summary-copy",children:a}),C]}):o?.summary,_={breakpoint:n,chartMode:r,mobileInteraction:i,semantics:s,allowHorizontalScroll:m,hideToolbar:g,...o,summary:M},j=Jw.useMemo(()=>{if(!y||!Jw.isValidElement(e))return e;const t=e.props,o={};for(const[e,n]of Object.entries(y))null==t[e]&&(o[e]=n);return Object.keys(o).length>0?Jw.cloneElement(e,o):e},[e,y]),R=!!d&&"sheet"===f,P=!!d&&"inline"===f||R&&k,L=R?(0,eS.jsx)("button",{type:"button",className:"semiotic-mobile-detail-toggle","aria-expanded":k,onClick:()=>w(e=>!e),children:k?"Hide details":"Show details"}):null,T=t||L?(0,eS.jsxs)("div",{className:"semiotic-mobile-control-stack",children:[t,L]}):void 0;return(0,eS.jsxs)("div",{className:"semiotic-mobile-chart-shell",children:[(0,eS.jsx)("style",{children:`\n .semiotic-mobile-chart-shell {\n display: grid;\n gap: 10px;\n width: 100%;\n }\n .semiotic-mobile-summary-card {\n display: grid;\n gap: 10px;\n }\n .semiotic-mobile-summary-copy {\n font-size: 13px;\n line-height: 1.45;\n }\n .semiotic-mobile-chip-row {\n display: flex;\n gap: 8px;\n overflow-x: auto;\n padding-bottom: 2px;\n -webkit-overflow-scrolling: touch;\n }\n .semiotic-mobile-chip {\n display: inline-flex;\n flex: 0 0 auto;\n flex-direction: column;\n align-items: flex-start;\n justify-content: center;\n min-height: 40px;\n min-width: 44px;\n border: 1px solid var(--semiotic-border, #d8d8d8);\n border-radius: 999px;\n padding: 7px 12px;\n background: var(--semiotic-bg, #fff);\n color: var(--semiotic-text, #222);\n font: inherit;\n font-size: 12px;\n font-weight: 700;\n cursor: pointer;\n }\n .semiotic-mobile-chip[aria-pressed="true"] {\n border-color: var(--semiotic-accent, #1f7a6d);\n background: color-mix(in srgb, var(--semiotic-accent, #1f7a6d) 14%, transparent);\n }\n .semiotic-mobile-chip:disabled {\n cursor: not-allowed;\n opacity: 0.45;\n }\n .semiotic-mobile-chip-description {\n display: block;\n max-width: 160px;\n margin-top: 2px;\n color: var(--semiotic-text-secondary, #666);\n font-size: 10px;\n font-weight: 500;\n line-height: 1.2;\n }\n .semiotic-mobile-control-stack {\n display: inline-flex;\n align-items: center;\n gap: 8px;\n flex-wrap: wrap;\n }\n .semiotic-mobile-detail-toggle {\n min-height: 32px;\n border: 1px solid var(--semiotic-border, #d8d8d8);\n border-radius: 999px;\n padding: 5px 10px;\n background: transparent;\n color: var(--semiotic-text, #222);\n font: inherit;\n font-size: 12px;\n font-weight: 700;\n cursor: pointer;\n }\n .semiotic-mobile-detail-panel {\n border: 1px solid var(--semiotic-border, #d8d8d8);\n border-radius: 16px;\n background: var(--semiotic-bg, #fff);\n color: var(--semiotic-text, #222);\n box-shadow: 0 18px 48px rgba(0, 0, 0, 0.16);\n overflow: hidden;\n }\n .semiotic-mobile-detail-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 12px;\n padding: 10px 12px;\n border-bottom: 1px solid var(--semiotic-border, #d8d8d8);\n font-size: 13px;\n font-weight: 800;\n }\n .semiotic-mobile-detail-body {\n padding: 12px;\n font-size: 13px;\n line-height: 1.5;\n }\n @media (max-width: ${n}px) {\n .semiotic-mobile-detail-panel[data-mode="sheet"] {\n position: sticky;\n bottom: 8px;\n z-index: 2;\n max-height: min(55vh, 420px);\n overflow: auto;\n }\n }\n `}),(0,eS.jsx)(Zw,{...b,controls:T,mobile:_,children:j}),P&&(0,eS.jsxs)("section",{className:"semiotic-mobile-detail-panel","data-mode":f,"aria-label":"string"==typeof h?h:"Chart details",children:[(0,eS.jsxs)("div",{className:"semiotic-mobile-detail-header",children:[(0,eS.jsx)("span",{children:h}),R&&(0,eS.jsx)("button",{type:"button",className:"semiotic-mobile-detail-toggle",onClick:()=>w(!1),children:"Close"})]}),(0,eS.jsx)("div",{className:"semiotic-mobile-detail-body",children:d})]})]})}var oS=c(require("react")),nS=require("react/jsx-runtime");function rS(e,t){if(t)return"function"==typeof t?t(e):e?.[t]}function iS(e,t){const o="function"==typeof t?t(e):e[t];return Array.isArray(o)?o:[]}function sS(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 aS(e,t){if(!oS.isValidElement(e))return e;const o=e.props,n={};for(const[e,r]of Object.entries(t))void 0!==r&&null==o[e]&&(n[e]=r);return Object.keys(n).length>0?oS.cloneElement(e,n):e}function lS({items:e,children:t,columns:o=3,tabletColumns:n=2,mobileColumns:r=1,mobileBreakpoint:i=480,tabletBreakpoint:s=860,gap:a=12,mode:l="mobile",chartHeight:c=220,sharedExtent:u=!0,valueAccessor:d,dataAccessor:h="data",extentProps:f=["yExtent","valueExtent"],linkedHover:p,selection:m,linkedBy:g,linkProvider:y="auto",selections:b,showLegend:v=!1,legendPosition:x,legendInteraction:k,legendSelectionName:w,legendField:S,mobileInteraction:A=!0,mobileSemantics:C,labelMode:M="panel",chartDefaults:_,className:j,style:R}){const P=dp(),L=e||"function"==typeof t?[]:oS.Children.toArray(t),T=e??L.map((e,t)=>({id:"panel-"+(t+1)})),I=T.length,$=oS.useMemo(()=>function(e,t,o,n){if(t&&"object"==typeof t)return t;if(!1===t)return{};const r=[],i=[];for(const t of e)if(t.extent&&r.push(t.extent[0],t.extent[1]),n)for(const e of iS(t,o))i.push(rS(e,n));const s=function(e){let t=1/0,o=-1/0;for(const n of e){const e=Number(n);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:r);return s?{yExtent:s,valueExtent:s}:{}}(T,u,h,d),[T,u,h,d]),N=oS.useMemo(()=>{if(!g)return{name:void 0,fields:void 0,linkedHover:p,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:p??{name:e,fields:t},selection:m??{name:e}}},[g,p,m]),D=oS.useMemo(()=>({linkedHover:N.linkedHover,selection:N.selection}),[N.linkedHover,N.selection]),E=oS.useMemo(()=>{const e={mode:l,height:c,responsiveWidth:!0,mobileInteraction:A,mobileSemantics:C??sS(I),...D,..._};"legend"!==M&&(e.showLegend=!1),"direct"===M&&(e.directLabel=!0);for(const t of f)t in $&&(e[t]=$[t]);return e},[l,c,A,C,I,D,_,M,f,$]),B=(0,nS.jsxs)("section",{className:["semiotic-small-multiple-chart",j].filter(Boolean).join(" "),style:R,"data-semiotic-small-multiple":"true",children:[(0,nS.jsx)("style",{children:`\n .semiotic-small-multiple-chart {\n --semiotic-small-multiple-columns: ${o};\n --semiotic-small-multiple-gap: ${a}px;\n display: grid;\n grid-template-columns: repeat(var(--semiotic-small-multiple-columns), minmax(0, 1fr));\n gap: var(--semiotic-small-multiple-gap);\n width: 100%;\n }\n .semiotic-small-multiple-panel {\n min-width: 0;\n border: 1px solid var(--semiotic-border, #d8d8d8);\n border-radius: 16px;\n background: var(--semiotic-bg, #fff);\n overflow: hidden;\n }\n .semiotic-small-multiple-heading {\n display: grid;\n gap: 3px;\n padding: 10px 12px 0;\n }\n .semiotic-small-multiple-title {\n margin: 0;\n color: var(--semiotic-text, #222);\n font-size: 13px;\n font-weight: 800;\n line-height: 1.25;\n }\n .semiotic-small-multiple-subtitle,\n .semiotic-small-multiple-summary {\n margin: 0;\n color: var(--semiotic-text-secondary, #666);\n font-size: 11px;\n line-height: 1.35;\n }\n .semiotic-small-multiple-plot {\n min-width: 0;\n padding: 4px 6px 8px;\n overflow: hidden;\n }\n @media (max-width: ${s}px) {\n .semiotic-small-multiple-chart {\n --semiotic-small-multiple-columns: ${n};\n }\n }\n @media (max-width: ${i}px) {\n .semiotic-small-multiple-chart {\n --semiotic-small-multiple-columns: ${r};\n }\n .semiotic-small-multiple-panel {\n border-radius: 14px;\n }\n .semiotic-small-multiple-heading {\n padding: 9px 10px 0;\n }\n }\n `}),T.map((e,o)=>{const n={...E},r="function"==typeof t?t(e,{item:e,index:o,count:I,chartProps:n,sharedExtent:$}):L[o];return(0,nS.jsxs)("article",{className:"semiotic-small-multiple-panel","aria-label":"string"==typeof e.title?e.title:void 0,children:[(e.title||e.subtitle||e.summary)&&(0,nS.jsxs)("header",{className:"semiotic-small-multiple-heading",children:[e.title&&(0,nS.jsx)("h3",{className:"semiotic-small-multiple-title",children:e.title}),e.subtitle&&(0,nS.jsx)("p",{className:"semiotic-small-multiple-subtitle",children:e.subtitle}),e.summary&&(0,nS.jsx)("p",{className:"semiotic-small-multiple-summary",children:e.summary})]}),(0,nS.jsx)("div",{className:"semiotic-small-multiple-plot",children:aS(r,n)})]},e.id??o)})]});return!0===y||"auto"===y&&(g||p||m||b||!0===v)&&!P?(0,nS.jsx)(xp,{selections:b,showLegend:v,legendPosition:x,legendInteraction:k,legendSelectionName:w??N.name??"small-multiples",legendField:S??N.fields?.[0]??"category",children:B}):B}var cS=c(require("react")),uS=require("react/jsx-runtime");function dS({children:e,columns:t="auto",minCellWidth:o=300,gap:n=16,tabletColumns:r,mobileColumns:i=1,mobileBreakpoint:s=480,tabletBreakpoint:a=860,chartDefaults:l,className:c,style:u}){const d="semiotic-chart-grid-"+cS.useId().replace(/[^a-zA-Z0-9_-]/g,""),h="number"==typeof t?t:void 0,f="auto"===t?`repeat(auto-fill, minmax(${o}px, 1fr))`:`repeat(${t}, 1fr)`,p=["semiotic-chart-grid",d,c].filter(Boolean).join(" ");return(0,uS.jsxs)(uS.Fragment,{children:[(0,uS.jsx)("style",{children:`\n ${r?`\n @media (max-width: ${a}px) {\n .${d} {\n grid-template-columns: repeat(${r}, minmax(0, 1fr)) !important;\n }\n }`:""}\n @media (max-width: ${s}px) {\n .${d} {\n grid-template-columns: repeat(${i}, minmax(0, 1fr)) !important;\n }\n .${d} > [data-semiotic-chart-grid-primary="true"] {\n grid-column: span ${i} !important;\n }\n }\n `}),(0,uS.jsx)("div",{className:p,style:{display:"grid",gridTemplateColumns:f,gap:n,width:"100%",...u},children:cS.Children.map(e,e=>{if(!cS.isValidElement(e))return e;const t=e.props,o={};if(l)for(const[e,n]of Object.entries(l))null==t[e]&&(o[e]=n);const n=Object.keys(o).length>0?cS.cloneElement(e,o):e;return"primary"!==e.props.emphasis||void 0!==h&&2>h?n:(0,uS.jsx)("div",{"data-semiotic-chart-grid-primary":"true",style:{gridColumn:"span 2",minWidth:0},children:n})})})]})}dS.displayName="ChartGrid";var hS=c(require("react")),fS=require("react/jsx-runtime");function pS({children:e,context:t,position:o="right",contextSize:n=250,mobilePosition:r="bottom",mobileBreakpoint:i=480,gap:s=12,className:a,style:l}){const c="semiotic-context-layout-"+hS.useId().replace(/[^a-zA-Z0-9_-]/g,""),u="left"===o||"right"===o,d="left"===o||"top"===o,h={display:"flex",flexDirection:u?d?"row-reverse":"row":d?"column-reverse":"column",gap:s,width:"100%",...l},f=u?{flex:`0 0 ${n}px`,width:n,minHeight:0}:{flex:`0 0 ${n}px`,height:n,minWidth:0};return(0,fS.jsxs)(fS.Fragment,{children:[(0,fS.jsx)("style",{children:`\n @media (max-width: ${i}px) {\n .${c}[data-mobile-position="bottom"] {\n flex-direction: column !important;\n }\n .${c}[data-mobile-position="top"] {\n flex-direction: column-reverse !important;\n }\n .${c}[data-mobile-position="bottom"] > .semiotic-context-panel,\n .${c}[data-mobile-position="top"] > .semiotic-context-panel {\n flex: 0 0 auto !important;\n width: 100% !important;\n height: auto !important;\n }\n }\n `}),(0,fS.jsxs)("div",{className:["semiotic-context-layout",c,a].filter(Boolean).join(" "),"data-mobile-position":r,style:h,children:[(0,fS.jsx)("div",{className:"semiotic-context-primary",style:{flex:"1 1 0%",minWidth:0,minHeight:0},children:e}),(0,fS.jsx)("div",{className:"semiotic-context-panel",style:f,children:t})]})]})}pS.displayName="ContextLayout";var mS=require("react"),gS=2*Math.PI;function yS(e,t,o){const n=o?.center?.x??0,r=o?.center?.y??0;return{x:n+Math.sin(e)*t,y:r-Math.cos(e)*t}}function bS(e,t,o,n,r){const i=r?.center,s=(e,t)=>{const{x:o,y:n}=yS(e,t,{center:i});return`${vS(o)},${vS(n)}`},a=Math.max(0,o),l=Math.max(a,n),c=Math.abs(t-e),u=e>t?0:1;if(c>=gS-1e-6){const e=i?.x??0,t=i?.y??0,o=`${vS(e)},${vS(t-l)}`,n=`${vS(e)},${vS(t+l)}`;let r=`M${o} A${vS(l)},${vS(l)} 0 1 1 ${n} A${vS(l)},${vS(l)} 0 1 1 ${o} Z`;if(a>0){const o=`${vS(e)},${vS(t-a)}`,n=`${vS(e)},${vS(t+a)}`;r+=` M${o} A${vS(a)},${vS(a)} 0 1 0 ${n} A${vS(a)},${vS(a)} 0 1 0 ${o} Z`}return r}const d=c>Math.PI?1:0,h=s(e,l),f=s(t,l);if(0>=a){const e=i?.x??0,t=i?.y??0;return`M${vS(e)},${vS(t)} L${h} A${vS(l)},${vS(l)} 0 ${d} ${u} ${f} Z`}const p=s(t,a),m=s(e,a);return`M${h} A${vS(l)},${vS(l)} 0 ${d} ${u} ${f} L${p} A${vS(a)},${vS(a)} 0 ${d} ${1===u?0:1} ${m} Z`}function vS(e){return Math.round(1e3*e)/1e3}function xS(e,t,o=0){return t>0?((e-o)%t+t)%t+o:e}var kS=require("react/jsx-runtime");function wS({value:e,onChange:t,period:o=365,radius:n=180,innerRadius:r=14,width:i,height:s,step:a=1,largeStep:l=7,label:c="Range",formatValue:u,arcFill:d="var(--semiotic-primary, #4e79a7)",stroke:h="var(--semiotic-bg, #ffffff)",className:f,style:p}){const m=i??2*n+40,g=s??2*n+40,y=m/2,b=g/2,v=function(e){const[t,o]=e,n=o-t||1,r=gS;return e=>0+(e-t)/n*(r-0)}([0,o]),x=(0,mS.useRef)(null),k=e=>{const t=e.currentTarget.ownerSVGElement??e.currentTarget,n=t.getBoundingClientRect(),r=t.viewBox?.baseVal;return Math.round((Math.atan2((r?.width||m)/(n.width||1)*(e.clientX-n.left)-y-0,-((r?.height||g)/(n.height||1)*(e.clientY-n.top)-b-0))+gS)%gS/gS*o)%o},w=(e,t)=>{e.preventDefault(),e.stopPropagation();const o=e.currentTarget.ownerSVGElement;o?.setPointerCapture?.(e.pointerId),x.current={mode:t,lastValue:k(e)}},S=e=>{const t=e.currentTarget.ownerSVGElement??e.currentTarget;t?.hasPointerCapture?.(e.pointerId)&&t.releasePointerCapture(e.pointerId),x.current=null},A=(e,n)=>{t("range"===e?e=>({start:xS(e.start+n,o),end:xS(e.end+n,o)}):t=>({...t,[e]:xS(t[e]+n,o)}))},C=e=>t=>{const o=t.shiftKey?l:a;"ArrowRight"===t.key||"ArrowUp"===t.key?(t.preventDefault(),A(e,o)):"ArrowLeft"!==t.key&&"ArrowDown"!==t.key||(t.preventDefault(),A(e,-o))},M=e.start>e.end?[[e.start,o],[0,e.end]]:[[e.start,e.end]],_=e=>u?u(e):e+"";return(0,kS.jsx)("svg",{viewBox:`0 0 ${m} ${g}`,width:m,height:g,className:f,onPointerMove:e=>{const n=x.current;if(!n)return;const r=k(e);if("range"===n.mode){const e=function(e,t,o){if(0>=o)return t-e;let n=(t-e)%o;return n>o/2?n-=o:-o/2>n&&(n+=o),n}(n.lastValue,r,o);if(0===e)return;return n.lastValue=r,void t(t=>({start:xS(t.start+e,o),end:xS(t.end+e,o)}))}t(e=>({...e,[n.mode]:r}))},onPointerUp:S,onPointerCancel:S,onLostPointerCapture:S,style:{touchAction:"none",...p},"aria-label":c+" brush",children:(0,kS.jsxs)("g",{transform:`translate(${y},${b})`,children:[(0,kS.jsx)("g",{role:"slider",tabIndex:0,"aria-label":c+" (move both ends)","aria-valuemin":0,"aria-valuemax":o-1,"aria-valuenow":e.start,"aria-valuetext":`${_(e.start)} to ${_(e.end)}`,onPointerDown:e=>w(e,"range"),onKeyDown:C("range"),style:{cursor:"grab"},children:M.map(([e,t],o)=>(0,kS.jsx)("path",{d:bS(v(e),v(t),r,n),fill:d,fillOpacity:.35,stroke:h,strokeWidth:1},o))}),["start","end"].map(t=>{const i=e[t],s=(e=>yS(v(e),r))(i),a=(e=>yS(v(e),n+8))(i);return(0,kS.jsxs)("g",{role:"slider",tabIndex:0,"aria-label":`${c} ${t}`,"aria-valuemin":0,"aria-valuemax":o-1,"aria-valuenow":i,"aria-valuetext":_(i),onPointerDown:e=>w(e,t),onKeyDown:C(t),style:{cursor:"grab"},children:[(0,kS.jsx)("line",{x1:s.x,y1:s.y,x2:a.x,y2:a.y,stroke:"transparent",strokeWidth:20}),(0,kS.jsx)("line",{x1:s.x,y1:s.y,x2:a.x,y2:a.y,stroke:h,strokeWidth:1.5}),(0,kS.jsx)("circle",{cx:a.x,cy:a.y,r:4.5,fill:h,stroke:d,strokeWidth:1})]},t)})]})})}var SS=c(require("react")),AS=require("react"),CS=require("react/jsx-runtime");function MS(e,t,o,n){return Math.min(o,Math.max(t,Number((t+Math.round((Math.min(o,Math.max(t,e))-t)/n)*n).toFixed(12))))}function _S({value:e,onChange:t,pointerToValue:o,min:n,max:r,step:i=1,largeStep:s=5*i,x:a,y:l,controlType:c="value",controlId:u,label:d,valueText:h,radius:f=12,fill:p="var(--semiotic-bg, #ffffff)",stroke:m="var(--semiotic-primary, #4e79a7)",strokeWidth:g=4,labelText:y,labelDx:b=16,labelDy:v=-16,labelClassName:x,className:k,disabled:w=!1,onChangeStart:S,onChangeEnd:A,onObservation:C,chartId:M,chartType:_}){const j=(0,AS.useRef)(null),R=(0,AS.useRef)(e);R.current=e;const P=SS.useMemo(()=>$x({controlType:c,controlId:u,chartId:M,chartType:_,onObservation:C}),[M,_,u,c,C]),L=e=>{if(w)return;const s=o(e);if(null==s||!Number.isFinite(s))return;const a=MS(s,n,r,i);R.current=a,t(a),P("control-change",a,"pointer")},T=e=>{e.stopPropagation(),j.current===e.pointerId&&(e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture?.(e.pointerId),j.current=null,A?.(R.current),P("control-end",R.current,"pointer"))},I=["semiotic-direct-manipulation-control",k].filter(Boolean).join(" ");return(0,CS.jsxs)("g",{className:I,role:"slider",tabIndex:w?-1:0,"aria-disabled":w||void 0,"aria-label":d,"aria-valuemin":n,"aria-valuemax":r,"aria-valuenow":e,"aria-valuetext":h??`${d}: ${e}`,"aria-roledescription":"visualization control","data-viz-control":c,"data-viz-control-id":u,"data-viz-control-state":"controlled",pointerEvents:"all",onPointerDown:e=>{w||(e.preventDefault(),e.stopPropagation(),e.currentTarget.setPointerCapture?.(e.pointerId),j.current=e.pointerId,S?.(R.current),P("control-start",R.current,"pointer"),L(e))},onPointerMove:e=>{e.stopPropagation(),j.current===e.pointerId&&L(e)},onPointerUp:T,onPointerCancel:T,onLostPointerCapture:T,onKeyDown:e=>{if(w)return;const o=e.shiftKey?s:i,a=R.current;let l=null;if("ArrowLeft"!==e.key&&"ArrowDown"!==e.key||(l=a-o),"ArrowRight"!==e.key&&"ArrowUp"!==e.key||(l=a+o),"Home"===e.key&&(l=n),"End"===e.key&&(l=r),null===l)return;e.preventDefault();const c=MS(l,n,r,i);R.current=c,t(c),P("control-change",c,"keyboard")},style:{cursor:w?"default":"grab",touchAction:"none"},children:[(0,CS.jsx)("circle",{className:"semiotic-direct-manipulation-control__hit",cx:a,cy:l,r:f+10,fill:"transparent"}),(0,CS.jsx)("circle",{className:"semiotic-direct-manipulation-control__handle",cx:a,cy:l,r:f,fill:p,stroke:m,strokeWidth:g}),y?(0,CS.jsx)("text",{className:x,x:a+b,y:l+v,fill:m,children:y}):null]})}var jS=require("react"),RS=require("react/jsx-runtime"),PS=200;function LS({children:e,position:t="right",size:o=300,trigger:n="click",chartId:r,observation:i,dismissOnEmpty:s=!0,showClose:a=!0,onToggle:l,className:c,style:u}){const[d,h]=(0,jS.useState)(null),[f,p]=(0,jS.useState)(null),[m,g]=(0,jS.useState)(!1),[y,b]=(0,jS.useState)(!1),v=(0,jS.useRef)(null),x=(0,jS.useRef)(void 0),k="click"===n?["click","click-end"]:["hover","hover-end"],{latest:w}=ap({types:k,chartId:r,limit:1}),S=void 0!==i?i:w,A=(0,jS.useCallback)(()=>{b(!0),g(!1),clearTimeout(x.current),x.current=setTimeout(()=>{b(!1),h(null),p(null)},PS)},[]);if((0,jS.useEffect)(()=>{if(S)if("click"===S.type||"hover"===S.type){const e=S;h(e.datum),p(e),g(e=>(e||(b(!0),clearTimeout(x.current),x.current=setTimeout(()=>b(!1),PS)),!0))}else!s||"click-end"!==S.type&&"hover-end"!==S.type||A()},[s,A,S]),(0,jS.useEffect)(()=>{l?.(m)},[m,l]),(0,jS.useEffect)(()=>()=>clearTimeout(x.current),[]),!d&&!y)return null;const C=d&&f?e(d,f):null;if(null===C&&!y)return null;const M=function(e,t,o,n){const r={position:"absolute",background:"var(--semiotic-bg, #fff)",borderColor:"var(--semiotic-border, #e0e0e0)",borderStyle:"solid",borderWidth:0,boxSizing:"border-box",zIndex:10,display:"flex",flexDirection:"column",transition:n?`transform ${PS}ms ease-out, opacity ${PS}ms ease-out`:void 0};return"right"===e?{...r,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?{...r,bottom:0,left:0,width:"100%",height:t,borderTopWidth:1,padding:"12px 16px",transform:o?"translateY(0)":`translateY(${t}px)`,opacity:o?1:0}:{...r,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(0,RS.jsxs)("div",{ref:v,className:`semiotic-details-panel semiotic-details-${t}${c?" "+c:""}`,style:{...M,...u},children:[a&&(0,RS.jsx)("button",{className:"semiotic-details-close",onClick:A,"aria-label":"Close details",style:TS,children:(0,RS.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",children:(0,RS.jsx)("path",{d:"M2 2l8 8M10 2l-8 8"})})}),(0,RS.jsx)("div",{className:"semiotic-details-content",style:{overflow:"auto",flex:1},children:C})]})}var TS={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};LS.displayName="DetailsPanel";var IS=require("react"),$S=require("d3-force"),NS=1e3;function DS(e,t,o={}){const n=o.iterations??260,r=o.repulsion??5200,i=o.linkDistance??165,s=o.linkStrength??.045,a=o.centerStrength??.018,l=o.damping??.84,c=o.nodeRadius??12,u=o.nodePadding??3,d=o.inset??.06,h=function(e){let t=e>>>0;return function(){t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}(o.seed??1),f=new Map;for(const t of e)f.set(t.id,0);for(const e of t)f.set(e.source,(f.get(e.source)??0)+1),f.set(e.target,(f.get(e.target)??0)+1);const p=NS/2,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(n>0){const e=(0,$S.forceSimulation)(m).randomSource(h).alphaDecay(1-Math.pow(.001,1/n)).velocityDecay(Math.max(0,Math.min(1,1-l))).force("charge",(0,$S.forceManyBody)().strength(e=>{const t=f.get(e.id)??0;return 2.5*-Math.sqrt(r)*Math.sqrt(t+1)})).force("collide",(0,$S.forceCollide)(e=>(e=>"function"==typeof c?c(e.data):c)(e)+u).strength(.9).iterations(2)).force("center",(0,$S.forceCenter)(p,p).strength(.8)).force("x",(0,$S.forceX)(p).strength(a)).force("y",(0,$S.forceY)(p).strength(a));y.length>0&&e.force("link",(0,$S.forceLink)(y).id(e=>e.id).distance(i).strength(e=>{const t="string"==typeof e.target?e.target:e.target.id,o=Math.max(1,Math.min(f.get("string"==typeof e.source?e.source:e.source.id)??1,f.get(t)??1));return s/.045/o})),e.stop();for(let t=0;n>t;t+=1)e.tick()}let b=1/0,v=1/0,x=-1/0,k=-1/0;for(const e of m){const t=e.x??p,o=e.y??p;b>t&&(b=t),v>o&&(v=o),t>x&&(x=t),o>k&&(k=o)}const w=x-b,S=k-v,A={};for(const e of m)A[e.id]={x:0===w?.5:d+((e.x??p)-b)/w*(1-2*d),y:0===S?.5:d+((e.y??p)-v)/S*(1-2*d)};return A}var ES=16,BS=new WeakMap;function FS(e){const t=[];for(const o of Object.keys(e).sort()){const n=e[o];if(void 0!==n){if("function"==typeof n)return null;t.push(`${o}:${n+""}`)}}return t.join("|")}function HS(e,t,o){return null==o?null:BS.get(e)?.get(t)?.get(o)??null}function OS(e,t,o,n){if(null==o)return;let r=BS.get(e);r||(r=new WeakMap,BS.set(e,r));let i=r.get(t);if(i||(i=new Map,r.set(t,i)),!i.has(o)&&i.size>=ES){const e=i.keys().next().value;void 0!==e&&i.delete(e)}i.set(o,n)}function zS(e,t,o={}){const n=gs(),{seed:r,iterations:i,repulsion:s,linkDistance:a,linkStrength:l,centerStrength:c,damping:u,nodeRadius:d,nodePadding:h,inset:f,execution:p,workerThreshold:m}=o,g=(0,IS.useMemo)(()=>({seed:r,iterations:i,repulsion:s,linkDistance:a,linkStrength:l,centerStrength:c,damping:u,nodeRadius:d,nodePadding:h,inset:f,execution:p,workerThreshold:m}),[r,i,s,a,l,c,u,d,h,f,p,m]),y=(0,IS.useRef)(n),[b,v]=(0,IS.useState)(()=>{if("undefined"==typeof window||n){const o=DS(e,t,g);return OS(e,t,FS(g),o),{positions:o,status:"ready",error:null}}const o=HS(e,t,FS(g));return o?{positions:o,status:"ready",error:null}:{positions:null,status:"pending",error:null}});return(0,IS.useEffect)(()=>{if(y.current)return void(y.current=!1);const o=FS(g),n=HS(e,t,o);if(n)return void v(e=>"ready"===e.status&&e.positions===n?e:{positions:n,status:"ready",error:null});const r=new AbortController;return v(e=>({positions:e.positions,status:"pending",error:null})),async function(e,t,o={}){const{execution:n="auto",signal:r,workerThreshold:i,nodeRadius:s,...a}=o,l=a.iterations??260;if(!tf()||!ef(n,e.length,t.length,l,i))return DS(e,t,{...a,nodeRadius:s});const c={kind:"normalized",nodes:e.map(e=>({...e})),edges:t.map(e=>({...e})),options:a,nodeRadii:"function"==typeof s?Object.fromEntries(e.map(e=>[e.id,s(e)])):null==s?void 0:Object.fromEntries(e.map(e=>[e.id,s]))};try{return(await sf(c,r)).positions}catch(o){if("AbortError"===o?.name)throw o;return DS(e,t,{...a,nodeRadius:s})}}(e,t,{...g,signal:r.signal}).then(n=>{OS(e,t,o,n),v({positions:n,status:"ready",error:null})}).catch(e=>{"AbortError"!==e.name&&v(t=>({positions:t.positions,status:"error",error:e}))}),()=>r.abort()},[e,t,g]),b}var WS=c(require("react"));function qS(e){const t=e.designContract?.chartFamily??e.title??"chart",o=e.audience?.primary?" for "+e.audience.primary:"",n=e.designContract?.whyThisForm;return`${t}: ${e.intent.primary}${o}${n?". "+n:""}`}function YS(e,t){const o=e.intents.map(e=>"string"==typeof e?e:e.id??e.name).filter(e=>!!e),n=e.intents.find(e=>"string"!=typeof e&&"primary"===e.strength),r=("object"==typeof n?n.id??n.name:void 0)??o[0]??"explanation";return{ididVersion:"0.1",chartId:t.chartId,title:t.title??e.name,intent:{primary:r,secondary:o.filter(e=>e!==r)},audience:{primary:e.audience?.primary,familiarityAssumptions:Object.fromEntries(Object.entries(e.audience?.familiarity??{}).map(([e,t])=>[e,t+""])),literacyTargets:e.audience?.literacyTargets?.map(e=>({feature:e.concept,rationale:e.rationale}))},reception:e.reception?{channels:e.reception.channels,strengths:e.reception.strengths,risks:e.reception.risks,scaffolds:e.reception.scaffolds,memorableForm:e.reception.memorableForm}:void 0,designContract:{chartFamily:e.frameFamily,whyThisForm:e.designContract.whyThisForm??e.designContract.whyCustom,whyNotDefault:e.designContract.whyNotDefault,risks:e.reception?.risks,misuse:e.designContract.misuse},accessibility:{description:t.description,navigation:"required"===e.accessibility.keyboardNavigation||null!=e.navigation,dataFallback:!0===e.accessibility.fallbackTable||"required"===e.accessibility.accessibleTable||!0===e.accessibility.requiresAccessibleTable,manualChecks:["real screen-reader behavior","keyboard order quality","custom metaphor comprehension","animation distraction"]},provenance:t.dataSources||t.reviewStatus?{dataSources:t.dataSources,reviewStatus:t.reviewStatus,generatedBy:"Semiotic recipe intelligence"}:void 0}}var GS=require("react/jsx-runtime");function VS({manifest:e,label:t="Intent Mark",className:o,showSummary:n=!0}){const[r,i]=WS.useState(!1),s=WS.useMemo(()=>JSON.stringify(e,null,2),[e]),a=WS.useCallback(async()=>{"undefined"!=typeof navigator&&navigator.clipboard&&(await navigator.clipboard.writeText(s),i(!0),window.setTimeout(()=>i(!1),1200))},[s]);return(0,GS.jsxs)("details",{className:o?"semiotic-intent-mark "+o:"semiotic-intent-mark",style:{border:"1px solid var(--semiotic-border, #c8c8c8)",borderRadius:6,background:"var(--semiotic-surface, #fff)",color:"var(--semiotic-text, #222)",fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[(0,GS.jsxs)("summary",{style:{cursor:"pointer",padding:"7px 10px",fontSize:12,fontWeight:700,letterSpacing:"0.04em",textTransform:"uppercase"},children:[t," · ",e.intent.primary]}),(0,GS.jsxs)("div",{style:{padding:"0 10px 10px"},children:[n&&(0,GS.jsx)("p",{style:{margin:"4px 0 10px",fontSize:13,lineHeight:1.45},children:qS(e)}),(0,GS.jsx)("button",{type:"button",onClick:a,style:{border:"1px solid currentColor",borderRadius:4,background:"transparent",color:"inherit",padding:"4px 8px",font:"inherit",fontSize:12,cursor:"pointer"},children:r?"Copied":"Copy manifest"}),(0,GS.jsx)("pre",{style:{maxHeight:280,overflow:"auto",margin:"10px 0 0",padding:10,background:"var(--semiotic-background, #f5f5f5)",fontSize:11,lineHeight:1.45,whiteSpace:"pre-wrap"},children:s})]})]})}var XS=require("react"),US="",KS=["hover","click","focus","activate"];function ZS(e){if("datum"===e.role&&e.datum)return e.datum;for(const t of e.children??[]){const e=ZS(t);if(e)return e}return null}function QS(e,t){return e?t.map(t=>e[t]+"").join(US):""}function JS(e,t){if(e.id===t)return e;for(const o of e.children??[]){const e=JS(o,t);if(e)return e}return null}function eA(e){const{tree:t,chartId:o,observe:n=KS}=e,r=e.selectionName??"__semiotic-nav-sync"+(o?":"+o:""),i=(0,XS.useMemo)(()=>{if(e.matchFields)return e.matchFields;const o=ZS(t);return o?Object.keys(o).filter(e=>{return!e.startsWith("_")&&(null==(t=o[e])||"string"==typeof t||"number"==typeof t||"boolean"==typeof t);var t}):[]},[e.matchFields,t]),s=(0,XS.useMemo)(()=>{const e=new Map,o=t=>{if("datum"===t.role&&t.datum){const o=QS(t.datum,i);e.has(o)||e.set(o,t.id)}for(const e of t.children??[])o(e)};return o(t),e},[t,i]),{selectPoints:a,clear:l}=Jf({name:r,fields:i}),c=(0,XS.useMemo)(()=>[...n,"hover-end"],[n]),{latest:u}=ap({chartId:o,types:c,limit:1}),[d,h]=(0,XS.useState)(t.id),f=(0,XS.useRef)(d);f.current=d;const p=(0,XS.useRef)(t);(0,XS.useEffect)(()=>{const e=p.current;p.current=t;const o=JS(e,f.current),n=JS(t,f.current);"datum"===o?.role&&"datum"===n?.role&&o.datum&&n.datum&&i.length>0&&QS(o.datum,i)===QS(n.datum,i)||o&&n&&"datum"!==o.role&&"datum"!==n.role||(h(t.id),l())},[t,l,i]);const m=(0,XS.useCallback)(e=>{if(h(e.id),"datum"===e.role&&e.datum&&i.length>0){const t={};for(const o of i)t[o]=[e.datum[o]];a(t)}else l()},[i,a,l]),g=e.annotations,y=(0,XS.useMemo)(()=>{const e=new Set;if(0===i.length||!g)return e;for(const t of g){const o=s.get(QS(t,i));o&&e.add(o)}return e},[g,s,i]),b=(0,XS.useCallback)(e=>{const t="number"==typeof e?g?.[e]:e;if(!t||0===i.length)return!1;const o=s.get(QS(t,i));if(!o)return!1;h(o);const n={};for(const e of i)n[e]=[t[e]];return a(n),!0},[g,s,i,a]),v=(0,XS.useRef)(null),x=(0,XS.useCallback)(e=>{if(o&&e.chartId!==o)return;if("hover-end"===e.type){if(e===v.current)return;return void(v.current=e)}if(!function(e){return"hover"===e.type||"click"===e.type||"focus"===e.type||"activate"===e.type}(e))return;if(!n.includes(e.type))return;if(e===v.current)return;if(v.current=e,0===i.length)return;const t=function(e){const t=e,o=t.data;if(!o||"object"!=typeof o||Array.isArray(o))return e;const n=e=>e.every(e=>"number"==typeof t[e]),r=n(["x0","x1","y0","y1","width","height","value"]),i=n(["y0","y1","sankeyWidth","value"])&&"source"in t&&"target"in t;return r||i?o:e}(e.datum),r=s.get(QS(t,i));r&&h(e=>e===r?e:r)},[o,n,s,i]),k=(0,XS.useRef)(null);return(0,XS.useEffect)(()=>{u&&u!==k.current&&(k.current=u,x(u))},[u,x]),{activeId:d,onActiveChange:m,selection:{name:r},onObservation:x,handleObservation:x,annotatedIds:y,focusAnnotation:b}}y();var tA=require("react");function oA(e,t,o,n){const r=new Map;o.forEach((e,t)=>{r.set(n?n(e,t):t+"",e)});const i=[];t.forEach((e,t)=>{r.has(t)||i.push(t)}),i.length>0&&e.remove?.(i);const s=[];if(r.forEach((o,n)=>{const r=t.get(n);void 0===r?s.push(o):r!==o&&(e.update?e.update(n,()=>o):(e.remove?.(n),s.push(o)))}),s.length>0)if(e.pushMany)e.pushMany(s);else if(e.push)for(const t of s)e.push(t);return r}function nA(e,t,o={}){const{id:n,resetKey:r}=o,i=(0,tA.useMemo)(()=>function(e){return null==e?null:"function"==typeof e?(t,o)=>{const n=e(t,o);return null==n?o+"":n+""}:(t,o)=>{const n=t[e];return null==n?o+"":n+""}}(n),[n]),s=(0,tA.useRef)({map:new Map,handle:null,resetKey:void 0});(0,tA.useEffect)(()=>{const o=e.current;if(!o)return;const n=s.current;n.handle===o&&n.resetKey===r||(o.clear?.(),n.map=new Map,n.handle=o,n.resetKey=r),n.map=oA(o,n.map,t,i)},[e,t,i,r])}var rA=require("react/jsx-runtime");function iA({items:e,title:t="Additional notes",empty:o=null,ordered:n=!0,renderItem:r,className:i,style:s}){if(!e.length)return o?(0,rA.jsx)(rA.Fragment,{children:o}):null;const a=n?"ol":"ul";return(0,rA.jsxs)("section",{className:["semiotic-mobile-annotation-callouts",i].filter(Boolean).join(" "),style:s,children:[(0,rA.jsx)("style",{children:"\n .semiotic-mobile-annotation-callouts {\n display: grid;\n gap: 8px;\n padding: 10px 12px;\n border: 1px solid var(--semiotic-border, #d8d8d8);\n border-radius: 14px;\n background: var(--semiotic-bg, #fff);\n color: var(--semiotic-text, #222);\n }\n .semiotic-mobile-annotation-callouts h3 {\n margin: 0;\n font-size: 13px;\n font-weight: 800;\n line-height: 1.25;\n }\n .semiotic-mobile-annotation-callouts ol,\n .semiotic-mobile-annotation-callouts ul {\n display: grid;\n gap: 8px;\n margin: 0;\n padding-left: 18px;\n }\n .semiotic-mobile-annotation-callouts li {\n font-size: 13px;\n line-height: 1.45;\n }\n .semiotic-mobile-annotation-callouts small {\n display: block;\n margin-top: 2px;\n color: var(--semiotic-text-secondary, #666);\n font-size: 11px;\n line-height: 1.3;\n }\n "}),t&&(0,rA.jsx)("h3",{children:t}),(0,rA.jsx)(a,{children:e.map((e,t)=>(0,rA.jsx)("li",{children:r?r(e,t):(0,rA.jsxs)(rA.Fragment,{children:[(0,rA.jsx)("span",{children:e.label}),(e.source||e.emphasis)&&(0,rA.jsx)("small",{children:[e.emphasis,e.source].filter(Boolean).join(" - ")})]})},e.id))})]})}
|