semiotic 3.7.5 → 3.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +54 -12
- 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 +1651 -154
- package/ai/examples.md +174 -0
- package/ai/schema.json +2733 -536
- package/ai/surface-manifest.json +200 -0
- package/ai/system-prompt.md +18 -3
- 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/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/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/DistanceCartogram.d.ts +1 -1
- package/dist/components/charts/geo/FlowMap.d.ts +1 -1
- package/dist/components/charts/geo/ProportionalSymbolMap.d.ts +1 -1
- package/dist/components/charts/geo/index.d.ts +2 -0
- package/dist/components/charts/index.d.ts +29 -1
- package/dist/components/charts/network/ChordDiagram.d.ts +1 -1
- package/dist/components/charts/network/CirclePack.d.ts +1 -1
- package/dist/components/charts/network/ForceDirectedGraph.d.ts +15 -5
- package/dist/components/charts/network/OrbitDiagram.d.ts +1 -1
- package/dist/components/charts/network/ProcessSankey.d.ts +1 -1
- package/dist/components/charts/network/SankeyDiagram.d.ts +1 -1
- package/dist/components/charts/network/TreeDiagram.d.ts +1 -1
- package/dist/components/charts/network/Treemap.d.ts +1 -1
- package/dist/components/charts/network/useForceLayout.d.ts +17 -0
- package/dist/components/charts/ordinal/BarChart.d.ts +1 -1
- package/dist/components/charts/ordinal/BoxPlot.d.ts +1 -1
- package/dist/components/charts/ordinal/DonutChart.d.ts +1 -1
- package/dist/components/charts/ordinal/DotPlot.d.ts +1 -1
- package/dist/components/charts/ordinal/FunnelChart.d.ts +1 -1
- package/dist/components/charts/ordinal/GroupedBarChart.d.ts +1 -1
- package/dist/components/charts/ordinal/Histogram.d.ts +1 -1
- package/dist/components/charts/ordinal/PieChart.d.ts +1 -1
- package/dist/components/charts/ordinal/RidgelinePlot.d.ts +1 -1
- package/dist/components/charts/ordinal/StackedBarChart.d.ts +1 -1
- package/dist/components/charts/ordinal/SwarmPlot.d.ts +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 +47 -0
- package/dist/components/charts/physics/EventDropChart.capability.d.ts +2 -0
- package/dist/components/charts/physics/EventDropChart.d.ts +53 -0
- package/dist/components/charts/physics/GaltonBoardChart.capability.d.ts +2 -0
- package/dist/components/charts/physics/GaltonBoardChart.d.ts +66 -0
- package/dist/components/charts/physics/GauntletChart.capability.d.ts +2 -0
- package/dist/components/charts/physics/GauntletChart.d.ts +73 -0
- package/dist/components/charts/physics/PhysicalFlowChart.capability.d.ts +2 -0
- package/dist/components/charts/physics/PhysicalFlowChart.d.ts +63 -0
- package/dist/components/charts/physics/PhysicsCustomChart.d.ts +120 -0
- package/dist/components/charts/physics/PhysicsPileChart.capability.d.ts +2 -0
- package/dist/components/charts/physics/PhysicsPileChart.d.ts +53 -0
- package/dist/components/charts/physics/ProcessFlowChart.capability.d.ts +2 -0
- package/dist/components/charts/physics/ProcessFlowChart.d.ts +96 -0
- package/dist/components/charts/physics/chainReactionOverlay.d.ts +22 -0
- package/dist/components/charts/physics/chainReactionRuntime.d.ts +37 -0
- package/dist/components/charts/physics/chainReactionTypes.d.ts +97 -0
- package/dist/components/charts/physics/collisionSwarmPhysics.d.ts +27 -0
- package/dist/components/charts/physics/dependencyMachine.d.ts +188 -0
- package/dist/components/charts/physics/eventDropPhysics.d.ts +64 -0
- package/dist/components/charts/physics/galtonBoardPhysics.d.ts +28 -0
- package/dist/components/charts/physics/gauntletChartProps.d.ts +67 -0
- package/dist/components/charts/physics/gauntletChrome.d.ts +33 -0
- package/dist/components/charts/physics/gauntletController.d.ts +73 -0
- package/dist/components/charts/physics/gauntletEffects.d.ts +36 -0
- package/dist/components/charts/physics/gauntletPhysics.d.ts +71 -0
- package/dist/components/charts/physics/gauntletRuntime.d.ts +42 -0
- package/dist/components/charts/physics/gauntletTypes.d.ts +213 -0
- package/dist/components/charts/physics/physicalFlowPhysics.d.ts +57 -0
- package/dist/components/charts/physics/physicsChartShared.d.ts +41 -0
- package/dist/components/charts/physics/physicsChartUtils.d.ts +18 -0
- package/dist/components/charts/physics/physicsEncoding.d.ts +142 -0
- package/dist/components/charts/physics/physicsHocHandle.d.ts +53 -0
- package/dist/components/charts/physics/physicsHocUtils.d.ts +128 -0
- package/dist/components/charts/physics/physicsPilePhysics.d.ts +41 -0
- package/dist/components/charts/physics/physicsProcessPrimitives.d.ts +38 -0
- package/dist/components/charts/physics/processFlowPhysics.d.ts +97 -0
- package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +9 -1
- package/dist/components/charts/realtime/RealtimeHistogram.d.ts +9 -1
- package/dist/components/charts/realtime/RealtimeLineChart.d.ts +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/auditMobileVisualization.d.ts +91 -0
- package/dist/components/charts/shared/chartDefinitionPilot.d.ts +145 -0
- package/dist/components/charts/shared/chartFamilySets.d.ts +20 -0
- package/dist/components/charts/shared/chartSpecCore.d.ts +165 -0
- package/dist/components/charts/shared/chartSpecs.d.ts +8 -127
- package/dist/components/charts/shared/chartSpecsGeo.d.ts +2 -0
- package/dist/components/charts/shared/chartSpecsNetwork.d.ts +2 -0
- package/dist/components/charts/shared/chartSpecsOrdinal.d.ts +2 -0
- package/dist/components/charts/shared/chartSpecsPhysics.d.ts +2 -0
- package/dist/components/charts/shared/chartSpecsRealtime.d.ts +2 -0
- package/dist/components/charts/shared/chartSpecsValue.d.ts +2 -0
- package/dist/components/charts/shared/chartSpecsXY.d.ts +2 -0
- package/dist/components/charts/shared/colorContrast.d.ts +3 -0
- package/dist/components/charts/shared/colorUtils.d.ts +16 -1
- package/dist/components/charts/shared/diagnoseAnnotationChecks.d.ts +4 -0
- package/dist/components/charts/shared/diagnoseConfig.d.ts +9 -14
- package/dist/components/charts/shared/diagnoseMisleadingChecks.d.ts +9 -0
- package/dist/components/charts/shared/diagnosePhysicsChecks.d.ts +3 -0
- package/dist/components/charts/shared/diagnoseTypes.d.ts +10 -0
- package/dist/components/charts/shared/hooks.d.ts +28 -5
- package/dist/components/charts/shared/motionEncoding.d.ts +145 -0
- package/dist/components/charts/shared/responsiveRules.d.ts +56 -0
- package/dist/components/charts/shared/streamPropsHelpers.d.ts +12 -2
- package/dist/components/charts/shared/temporalStrings.d.ts +7 -0
- package/dist/components/charts/shared/types.d.ts +49 -1
- package/dist/components/charts/shared/useChartSetup.d.ts +9 -2
- package/dist/components/charts/shared/useCustomChartSetup.d.ts +14 -5
- package/dist/components/charts/shared/useNetworkChartSetup.d.ts +6 -2
- package/dist/components/charts/shared/useOrdinalPieceStyle.d.ts +1 -1
- package/dist/components/charts/shared/useStreamingLegend.d.ts +1 -1
- package/dist/components/charts/shared/useSyncedPushData.d.ts +49 -0
- package/dist/components/charts/shared/validationMap.d.ts +0 -11
- package/dist/components/charts/xy/AreaChart.d.ts +1 -1
- package/dist/components/charts/xy/BubbleChart.d.ts +1 -1
- package/dist/components/charts/xy/LineChart.d.ts +1 -1
- package/dist/components/charts/xy/MinimapChart.d.ts +1 -1
- package/dist/components/charts/xy/MultiAxisLineChart.d.ts +2 -2
- package/dist/components/charts/xy/QuadrantChart.d.ts +1 -1
- package/dist/components/charts/xy/Scatterplot.d.ts +1 -1
- package/dist/components/charts/xy/ScatterplotMatrix.d.ts +11 -1
- package/dist/components/charts/xy/StackedAreaChart.d.ts +9 -4
- package/dist/components/controls/controlAudit.d.ts +24 -0
- package/dist/components/controls/controlContract.d.ts +57 -0
- package/dist/components/data/fromFlintChart.d.ts +74 -0
- package/dist/components/data/fromVegaLite.d.ts +27 -0
- 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/semiotic-ai-core.d.ts +47 -0
- package/dist/components/semiotic-ai.d.ts +50 -8
- package/dist/components/semiotic-controls.d.ts +18 -0
- package/dist/components/semiotic-experimental.d.ts +38 -9
- package/dist/components/semiotic-geo.d.ts +11 -0
- package/dist/components/semiotic-network.d.ts +11 -0
- package/dist/components/semiotic-ordinal.d.ts +8 -0
- package/dist/components/semiotic-physics-matter.d.ts +10 -0
- package/dist/components/semiotic-physics-rapier.d.ts +9 -0
- package/dist/components/semiotic-physics.d.ts +56 -0
- package/dist/components/semiotic-realtime-core.d.ts +34 -0
- package/dist/components/semiotic-realtime-react.d.ts +10 -0
- package/dist/components/semiotic-realtime.d.ts +4 -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-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 +46 -0
- package/dist/components/semiotic-utils-react.d.ts +5 -0
- package/dist/components/semiotic-utils.d.ts +3 -39
- package/dist/components/semiotic-xy.d.ts +8 -0
- package/dist/components/semiotic.d.ts +35 -7
- package/dist/components/server/animatedGif.d.ts +36 -0
- package/dist/components/server/renderEvidence.d.ts +1 -1
- package/dist/components/server/renderToStaticSVG.d.ts +3 -35
- package/dist/components/server/serverChartConfigShared.d.ts +17 -0
- package/dist/components/server/serverChartConfigs.d.ts +19 -9
- package/dist/components/server/serverChartConfigsCustom.d.ts +5 -0
- package/dist/components/server/serverChartConfigsGeo.d.ts +9 -0
- package/dist/components/server/serverChartConfigsNetwork.d.ts +8 -0
- package/dist/components/server/serverChartConfigsOrdinal.d.ts +16 -0
- package/dist/components/server/serverChartConfigsPhysics.d.ts +9 -0
- package/dist/components/server/serverChartConfigsXY.d.ts +11 -0
- package/dist/components/server/staticGeo.d.ts +4 -0
- package/dist/components/server/staticLegend.d.ts +1 -1
- package/dist/components/server/staticNetwork.d.ts +8 -0
- package/dist/components/server/staticOrdinal.d.ts +11 -0
- package/dist/components/server/staticPhysics.d.ts +3 -0
- package/dist/components/server/staticSVGChrome.d.ts +110 -0
- package/dist/components/server/staticXY.d.ts +4 -0
- package/dist/components/store/ObservationStore.d.ts +3 -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 +3 -13
- package/dist/components/stream/FocusRing.d.ts +4 -2
- package/dist/components/stream/GeoCanvasHitTester.d.ts +1 -1
- package/dist/components/stream/GeoPipelineStore.d.ts +28 -0
- package/dist/components/stream/NetworkPipelineStore.d.ts +31 -26
- package/dist/components/stream/NetworkSVGOverlay.d.ts +4 -1
- package/dist/components/stream/OrdinalPipelineStore.d.ts +46 -2
- package/dist/components/stream/PipelineStore.d.ts +81 -170
- package/dist/components/stream/SceneGraph.d.ts +9 -1
- package/dist/components/stream/StreamGeoFrame.d.ts +1 -1
- package/dist/components/stream/StreamNetworkFrame.d.ts +1 -1
- package/dist/components/stream/StreamOrdinalFrame.d.ts +1 -1
- package/dist/components/stream/StreamXYFrame.d.ts +2 -18
- package/dist/components/stream/accessibleDataRows.d.ts +33 -0
- package/dist/components/stream/accessorUtils.d.ts +23 -10
- package/dist/components/stream/brushAccessibility.d.ts +25 -0
- package/dist/components/stream/canvasBackground.d.ts +24 -0
- package/dist/components/stream/canvasSetup.d.ts +4 -1
- package/dist/components/stream/customLayoutFailure.d.ts +33 -0
- package/dist/components/stream/customLayoutPalette.d.ts +19 -9
- package/dist/components/stream/frameThemeColors.d.ts +24 -0
- package/dist/components/stream/geoAnnotationAnchors.d.ts +14 -0
- package/dist/components/stream/geoCartogram.d.ts +17 -0
- package/dist/components/stream/geoCustomLayout.d.ts +59 -0
- package/dist/components/stream/geoDefaultTooltip.d.ts +11 -0
- package/dist/components/stream/geoFrameHelpers.d.ts +34 -0
- package/dist/components/stream/geoPipelineHelpers.d.ts +46 -0
- package/dist/components/stream/geoTypes.d.ts +56 -7
- package/dist/components/stream/glyphDef.d.ts +98 -0
- package/dist/components/stream/hitTarget.d.ts +170 -0
- package/dist/components/stream/hoverUtils.d.ts +3 -0
- package/dist/components/stream/keyboardNav.d.ts +4 -1
- package/dist/components/stream/layouts/forceLayoutPlugin.d.ts +9 -1
- package/dist/components/stream/layouts/forceLayoutWorkerClient.d.ts +57 -0
- package/dist/components/stream/networkBezier.d.ts +10 -0
- package/dist/components/stream/networkColorAccessors.d.ts +49 -0
- package/dist/components/stream/networkDefaultTooltip.d.ts +10 -0
- package/dist/components/stream/networkFrameInteraction.d.ts +37 -0
- package/dist/components/stream/networkFramePaint.d.ts +43 -0
- package/dist/components/stream/networkPipelineConfig.d.ts +22 -0
- package/dist/components/stream/networkPipelineHelpers.d.ts +12 -0
- package/dist/components/stream/networkRealtimeEncoding.d.ts +41 -0
- package/dist/components/stream/networkTypes.d.ts +76 -5
- 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 +12 -0
- package/dist/components/stream/ordinalPulse.d.ts +10 -0
- package/dist/components/stream/ordinalPulseResources.d.ts +3 -0
- package/dist/components/stream/ordinalSceneBuilders/sceneBuilderMap.d.ts +5 -0
- package/dist/components/stream/ordinalSpatialIndex.d.ts +9 -0
- package/dist/components/stream/ordinalTypes.d.ts +40 -8
- package/dist/components/stream/paintNeeds.d.ts +31 -0
- package/dist/components/stream/physics/CapacityQueueController.d.ts +5 -0
- package/dist/components/stream/physics/CapacityQueueTypes.d.ts +134 -0
- package/dist/components/stream/physics/MatterPhysicsEngineAdapter.d.ts +42 -0
- package/dist/components/stream/physics/PhysicsAccessibility.d.ts +48 -0
- package/dist/components/stream/physics/PhysicsAnnotations.d.ts +58 -0
- package/dist/components/stream/physics/PhysicsBodyBudget.d.ts +26 -0
- package/dist/components/stream/physics/PhysicsBodySpatialIndex.d.ts +10 -0
- package/dist/components/stream/physics/PhysicsCanvasTheme.d.ts +26 -0
- package/dist/components/stream/physics/PhysicsControllers.d.ts +75 -0
- package/dist/components/stream/physics/PhysicsEngineAdapter.d.ts +59 -0
- package/dist/components/stream/physics/PhysicsEngineConformance.d.ts +23 -0
- package/dist/components/stream/physics/PhysicsEvidence.d.ts +25 -0
- package/dist/components/stream/physics/PhysicsKernel.d.ts +207 -0
- package/dist/components/stream/physics/PhysicsOptionalEngineAdapters.d.ts +12 -0
- package/dist/components/stream/physics/PhysicsPipelineStore.d.ts +84 -0
- package/dist/components/stream/physics/PhysicsPipelineTypes.d.ts +181 -0
- package/dist/components/stream/physics/PhysicsSVGOverlay.d.ts +72 -0
- package/dist/components/stream/physics/PhysicsSediment.d.ts +69 -0
- package/dist/components/stream/physics/PhysicsSettledSVG.d.ts +18 -0
- package/dist/components/stream/physics/PhysicsSettledScene.d.ts +21 -0
- package/dist/components/stream/physics/PhysicsWorkerClient.d.ts +24 -0
- package/dist/components/stream/physics/PhysicsWorkerProtocol.d.ts +101 -0
- package/dist/components/stream/physics/PhysicsWorkerRuntime.d.ts +5 -0
- package/dist/components/stream/physics/RapierPhysicsEngineAdapter.d.ts +18 -0
- package/dist/components/stream/physics/ServiceOperationsControllers.d.ts +27 -0
- package/dist/components/stream/physics/ServiceOperationsTypes.d.ts +89 -0
- package/dist/components/stream/physics/StreamPhysicsFrame.d.ts +6 -0
- package/dist/components/stream/physics/StreamPhysicsTypes.d.ts +302 -0
- package/dist/components/stream/physics/physicsBodyCanvas.d.ts +27 -0
- package/dist/components/stream/physics/physicsPipelineControls.d.ts +4 -0
- package/dist/components/stream/physics/physicsPipelineHelpers.d.ts +41 -0
- package/dist/components/stream/physics/physicsPipelineObservations.d.ts +14 -0
- package/dist/components/stream/physics/physicsPipelineUpdateResults.d.ts +9 -0
- package/dist/components/stream/physics/physicsRegionRuntime.d.ts +54 -0
- package/dist/components/stream/physics/physicsSemanticUI.d.ts +20 -0
- package/dist/components/stream/physics/usePhysicsFrameLifecyclePolicy.d.ts +16 -0
- package/dist/components/stream/pipelineBufferUtils.d.ts +26 -0
- package/dist/components/stream/pipelineConfig.d.ts +177 -0
- package/dist/components/stream/pipelineDecay.d.ts +20 -2
- package/dist/components/stream/pipelineDomainResolution.d.ts +62 -0
- package/dist/components/stream/pipelineIdentityOps.d.ts +26 -0
- package/dist/components/stream/pipelinePulse.d.ts +16 -2
- package/dist/components/stream/pipelineRibbons.d.ts +41 -0
- package/dist/components/stream/pipelineSpatialIndex.d.ts +12 -0
- package/dist/components/stream/pipelineStoreUpdateResults.d.ts +12 -0
- package/dist/components/stream/pipelineStyleResolvers.d.ts +46 -0
- package/dist/components/stream/pipelineTransitions.d.ts +2 -0
- package/dist/components/stream/pipelineUpdateContract.d.ts +62 -0
- package/dist/components/stream/pulseFrameRefresh.d.ts +22 -0
- package/dist/components/stream/renderers/glyphCanvasRenderer.d.ts +6 -0
- package/dist/components/stream/renderers/resolveCSSColor.d.ts +6 -0
- package/dist/components/stream/sceneRevisionDiagnostics.d.ts +18 -0
- package/dist/components/stream/streamStoreSync.d.ts +37 -0
- package/dist/components/stream/types.d.ts +135 -7
- package/dist/components/stream/useFrame.d.ts +21 -2
- package/dist/components/stream/useHydration.d.ts +6 -0
- package/dist/components/stream/useLegendCategoryEmission.d.ts +5 -0
- package/dist/components/stream/workerModuleUrl.d.ts +10 -0
- package/dist/components/stream/xyAnnotationAnchors.d.ts +13 -0
- package/dist/components/stream/xyCanvasRenderers.d.ts +7 -0
- package/dist/components/stream/xyCrosshair.d.ts +11 -0
- package/dist/components/stream/xyDateTicks.d.ts +9 -0
- package/dist/components/stream/xyDefaultTooltip.d.ts +10 -0
- package/dist/components/stream/xySceneBuilders/types.d.ts +4 -4
- package/dist/controls.min.js +2 -0
- package/dist/controls.module.min.js +2 -0
- package/dist/forceLayoutWorker.js +1 -0
- package/dist/geo.min.js +1 -1
- package/dist/geo.module.min.js +1 -1
- package/dist/network.min.js +1 -1
- package/dist/network.module.min.js +1 -1
- package/dist/ordinal.min.js +1 -1
- package/dist/ordinal.module.min.js +1 -1
- package/dist/physics-matter.min.js +1 -0
- package/dist/physics-matter.module.min.js +1 -0
- package/dist/physics-rapier.min.js +1 -0
- package/dist/physics-rapier.module.min.js +1 -0
- package/dist/physics.min.js +2 -0
- package/dist/physics.module.min.js +2 -0
- package/dist/physicsWorker.js +1 -0
- package/dist/realtime.min.js +1 -1
- package/dist/realtime.module.min.js +1 -1
- package/dist/semiotic-ai-chunk-OG7BQUUW.module.min.js +2 -0
- package/dist/semiotic-ai-core.d.ts +47 -0
- package/dist/semiotic-ai-core.min.js +1 -0
- package/dist/semiotic-ai-core.module.min.js +1 -0
- package/dist/semiotic-ai-statisticalOverlays-CY4WKR4A.module.min.js +2 -0
- package/dist/semiotic-ai.d.ts +50 -8
- package/dist/semiotic-ai.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-chunk-3FSVZ46U.module.min.js +2 -0
- package/dist/semiotic-controls.d.ts +18 -0
- package/dist/semiotic-data.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 +11 -0
- package/dist/semiotic-network.d.ts +11 -0
- package/dist/semiotic-ordinal.d.ts +8 -0
- package/dist/semiotic-physics-matter.d.ts +10 -0
- package/dist/semiotic-physics-rapier.d.ts +9 -0
- package/dist/semiotic-physics.d.ts +56 -0
- package/dist/semiotic-realtime-core.d.ts +34 -0
- package/dist/semiotic-realtime-core.min.js +1 -0
- package/dist/semiotic-realtime-core.module.min.js +1 -0
- package/dist/semiotic-realtime-react.d.ts +10 -0
- package/dist/semiotic-realtime-react.min.js +2 -0
- package/dist/semiotic-realtime-react.module.min.js +2 -0
- package/dist/semiotic-realtime.d.ts +4 -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-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 +46 -0
- package/dist/semiotic-utils-core.min.js +1 -0
- package/dist/semiotic-utils-core.module.min.js +1 -0
- package/dist/semiotic-utils-react.d.ts +5 -0
- package/dist/semiotic-utils-react.min.js +2 -0
- package/dist/semiotic-utils-react.module.min.js +2 -0
- package/dist/semiotic-utils.d.ts +3 -39
- package/dist/semiotic-utils.min.js +1 -2
- package/dist/semiotic-utils.module.min.js +1 -2
- package/dist/semiotic-value.min.js +1 -1
- package/dist/semiotic-value.module.min.js +1 -1
- package/dist/semiotic-xy.d.ts +8 -0
- package/dist/semiotic.d.ts +35 -7
- package/dist/semiotic.min.js +1 -1
- package/dist/semiotic.module.min.js +1 -1
- package/dist/server.min.js +1 -1
- package/dist/server.module.min.js +1 -1
- package/dist/xy-chunk-IWD6IB6V.module.min.js +2 -0
- package/dist/xy-statisticalOverlays-7RWG6LJT.module.min.js +2 -0
- package/dist/xy.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +239 -87
- 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,r=Object.getOwnPropertyNames,n=Object.getPrototypeOf,i=Object.prototype.hasOwnProperty,s=(e,t,o)=>function(){if(o)throw o[0];try{return e&&(t=(0,e[r(e)[0]])(e=0)),t}catch(e){throw o=[e],e}},a=(e,o)=>{for(var r in o)t(e,r,{get:o[r],enumerable:!0})},l=(e,n,s,a)=>{if(n&&"object"==typeof n||"function"==typeof n)for(let l of r(n))i.call(e,l)||l===s||t(e,l,{get:()=>n[l],enumerable:!(a=o(n,l))||a.enumerable});return e},c=(o,r,i)=>(i=null!=o?e(n(o)):{},l(!r&&o&&o.__esModule?i:t(i,"default",{value:o,enumerable:!0}),o));function u(e){let t=1/0,o=-1/0;for(const r of e)t>r&&(t=r),r>o&&(o=r);return[t,o]}function d(e,t=-1/0){let o=t;for(const t of e)t>o&&(o=t);return o}var h=s({"src/components/charts/shared/minMax.ts"(){}});function p(e,t=.5){const o=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!o)return e;const r=Math.round(parseInt(o[1],16)*(1-t)),n=Math.round(parseInt(o[2],16)*(1-t)),i=Math.round(parseInt(o[3],16)*(1-t));return`#${r.toString(16).padStart(2,"0")}${n.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}`}function f(e,t=.5){const o=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!o)return e;const r=Math.round(parseInt(o[1],16)+(255-parseInt(o[1],16))*t),n=Math.round(parseInt(o[2],16)+(255-parseInt(o[2],16))*t),i=Math.round(parseInt(o[3],16)+(255-parseInt(o[3],16))*t);return`#${r.toString(16).padStart(2,"0")}${n.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}`}var g,m,y=s({"src/components/charts/shared/colorManipulation.ts"(){}}),b={};function v(e,t,o,r){const n=t.uncertaintyOpacity,i=t.confidenceAccessor;if(!n&&!i)return;const s="object"==typeof n?n:{},a=s.min??.15,l=s.max??1;if(i){const t="function"==typeof i?i:e=>e[i];for(const o of e){const e=t(o);null!=e&&Number.isFinite(e)&&(o[m]=a+Math.max(0,Math.min(1,e))*(l-a))}return}const c=e.map(e=>{const t=o(e),n=r(e);return null!=t&&null!=n&&Number.isFinite(t)&&Number.isFinite(n)?Math.abs(t-n):NaN}),d=c.filter(e=>Number.isFinite(e));if(0===d.length)return;const[h,p]=u(d),f=p-h;e.forEach((e,t)=>{const o=c[t];Number.isFinite(o)&&(e[m]=l-(f>0?(o-h)/f:0)*(l-a))})}function x(e,t){return"function"==typeof t?t(e):!!e[t]}function k(e){return[{type:"anomaly-band",threshold:e.threshold??2,showBand:!1!==e.showBand,fill:e.bandColor||"#6366f1",fillOpacity:e.bandOpacity??.1,anomalyColor:e.anomalyColor||"#ef4444",anomalyRadius:e.anomalyRadius??6,label:e.label}]}function w(e,t,o,r,n){return(i=r).isTraining||i.isForecast||i.isAnomaly||i.upperBounds||i.lowerBounds?function(e,t,o,r,n){const{isTraining:i,isForecast:s,isAnomaly:a,upperBounds:l,lowerBounds:c,color:u="#6366f1",bandOpacity:d=.15,anomalyColor:h="#ef4444",anomalyRadius:p=6,label:f}=r,m=e.map(e=>{let t="observed";return s&&x(e,s)?t="forecast":i&&x(e,i)&&(t="training"),{...e,[g]:t}}),y=r._groupBy,b=[];if(y){const e=new Map;for(const t of m){const o=t[y]??"__default";e.has(o)||e.set(o,[]),e.get(o).push(t)}const t=[];for(const[,o]of e)for(let e=0;o.length-1>e;e++)o[e][g]!==o[e+1][g]&&(t.push({...o[e+1],[g]:o[e][g]}),t.push({...o[e],[g]:o[e+1][g]}));b.push(...m,...t)}else for(let e=0;m.length>e;e++)b.push(m[e]),m.length-1>e&&m[e][g]!==m[e+1][g]&&(b.push({...m[e+1],[g]:m[e][g]}),b.push({...m[e],[g]:m[e+1][g]}));if(r.trainUnderline){const e=[];for(const t of b)"training"===t[g]&&e.push({...t,[g]:"training-base"});b.unshift(...e)}const k=[];if(l&&c){const e="string"==typeof l?l:"__envUpper",t="string"==typeof c?c:"__envLower";if("function"==typeof l||"function"==typeof c)for(const o of b)"function"==typeof l&&(o[e]=l(o)),"function"==typeof c&&(o[t]=c(o));k.push({type:"envelope",upperAccessor:e,lowerAccessor:t,fill:u,fillOpacity:d,label:f})}if(r.uncertaintyOpacity||r.confidenceAccessor){const e=l?"function"==typeof l?l:e=>e[l]:()=>{},t=c?"function"==typeof c?c:e=>e[c]:()=>{};v(b.filter(e=>"forecast"===e[g]),r,e,t)}if(a){const e=r.anomalyStyle,t={type:"highlight",filter:e=>x(e,a)};e?(t.style=e,t.r=p):"function"==typeof h?(t.style=e=>{const t=h(e);return{stroke:t,strokeWidth:1.5,fill:t,fillOpacity:.7}},t.r=p):(t.color=h,t.r=p,t.style={stroke:h,strokeWidth:1.5,fill:h,fillOpacity:.7}),k.push(t)}return n&&k.push({type:"anomaly-band",threshold:n.threshold??2,showBand:!1!==n.showBand,fill:n.bandColor||"#6366f1",fillOpacity:n.bandOpacity??.1,anomalyColor:n.anomalyColor||"#ef4444",anomalyRadius:n.anomalyRadius??6,label:n.label}),{processedData:b,annotations:k}}(e,0,0,r,n):function(e,t,o,r,n){const{trainEnd:i,steps:s=10,confidence:a=.95,color:l="#6366f1",bandOpacity:c=.15,label:u}=r;if(null==i)return{processedData:e,annotations:[]};const h=[],p=[];for(const o of e)o[t]>i?p.push({...o,[g]:"observed"}):h.push({...o,[g]:"training"});const f=h.map(e=>[e[t],e[o]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]),m=[],y=[];if(f.length>=3){const n=f.length;let i=0,h=0,p=0,b=0;for(const[e,t]of f)i+=e,h+=t,p+=e*e,b+=e*t;const x=n*p-i*i;if(Math.abs(x)>1e-12){const p=(n*b-i*h)/x,k=(h-p*i)/n,w=e=>k+p*e,S=f.map(([e,t])=>t-w(e)).reduce((e,t)=>e+t*t,0),A=Math.sqrt(S/Math.max(n-2,1)),C=f.reduce((e,t)=>e+t[0],0)/n,M=f.reduce((e,t)=>e+(t[0]-C)**2,0),j=.99>a?.95>a?.9>a?1:1.645:1.96:2.576,P=d(e.map(e=>e[t]).filter(e=>null!=e&&isFinite(e))),_=f.length>1?(f[n-1][0]-f[0][0])/(n-1):1;for(let e=1;s>=e;e++){const r=P+e*_,i=w(r),s=A*Math.sqrt(1+1/n+(M>0?(r-C)**2/M:0))*j;y.push({[t]:r,[o]:i,[g]:"forecast",__forecastUpper:i+s,__forecastLower:i-s})}v(y,r,e=>e.__forecastUpper,e=>e.__forecastLower),m.push({type:"envelope",upperAccessor:"__forecastUpper",lowerAccessor:"__forecastLower",fill:l,fillOpacity:c,label:u})}}m.push({type:"x-threshold",x:i,color:"#94a3b8",strokeWidth:1,strokeDasharray:"4,2",label:"Train / Forecast"}),n&&m.push({type:"anomaly-band",threshold:n.threshold??2,showBand:!1!==n.showBand,fill:n.bandColor||"#6366f1",fillOpacity:n.bandOpacity??.1,anomalyColor:n.anomalyColor||"#ef4444",anomalyRadius:n.anomalyRadius??6,label:n.label});const b=[];if(b.push(...h),h.length>0&&p.length>0&&b.push({...h[h.length-1],[g]:"observed"}),b.push(...p),y.length>0){const e=p.length>0?p[p.length-1]:h[h.length-1];e&&b.push({...e,[g]:"forecast"}),b.push(...y)}return{processedData:b,annotations:m}}(e,t,o,r,n);var i}function S(e,t){const o=t.trainDasharray??"8,4",r=t.forecastDasharray??"4,4",n=t.color||"#6366f1",i=t.trainOpacity,s=t.forecastOpacity,a=t.trainStroke,l=t.trainLinecap,c=t.trainUnderline;return t=>{const u=e(t),d=t[g];if("training"===d){let e=u.stroke;return"darken"===a?e=p(u.stroke||"#666",.5):a&&(e=a),{...u,stroke:e,strokeDasharray:o,...l&&{strokeLinecap:l},...null!=i&&{strokeOpacity:i}}}if("training-base"===d){let e=u.stroke||"#666";return"lighten"===c&&(e=f(e,.4)),{...u,stroke:e,strokeDasharray:void 0}}if("forecast"===d){const e=t[m],o=null!=e?e:s;return{...u,stroke:n,strokeDasharray:r,...null!=o&&{strokeOpacity:o}}}return u}}a(b,{FORECAST_OPACITY_FIELD:()=>m,SEGMENT_FIELD:()=>g,buildAnomalyAnnotations:()=>k,buildForecast:()=>w,createSegmentLineStyle:()=>S,darkenColor:()=>p,lightenColor:()=>f,stampForecastOpacity:()=>v});var A,C=s({"src/components/charts/shared/statisticalOverlays.ts"(){h(),y(),y(),g="__forecastSegment",m="__forecastOpacity"}}),M={};a(M,{AccessibleNavTree:()=>gx,AreaChart:()=>cf,BarChart:()=>Cg,BoxPlot:()=>Jg,BubbleChart:()=>Sf,CARBON_ALERT:()=>Oh,CARBON_CATEGORICAL_14:()=>Hh,COLOR_BLIND_SAFE_CATEGORICAL:()=>X,CandlestickChart:()=>sg,CategoryColorProvider:()=>eh,ChartContainer:()=>tk,ChartErrorBoundary:()=>rd,ChartGrid:()=>gk,ChordDiagram:()=>Xm,CirclePack:()=>Cy,CircularBrush:()=>Mk,ConnectedScatterplot:()=>Kp,ContextLayout:()=>bk,DARK_THEME:()=>K,DetailsPanel:()=>Nk,DifferenceChart:()=>pf,DirectManipulationControl:()=>Rk,DonutChart:()=>km,DotPlot:()=>gm,ForceDirectedGraph:()=>Ym,FunnelChart:()=>hm,GaugeChart:()=>Lm,GroupedBarChart:()=>Im,HIGH_CONTRAST_THEME:()=>Q,Heatmap:()=>xf,Histogram:()=>rm,IncrementalExtent:()=>oe,IntentMark:()=>Qk,LIGHT_THEME:()=>U,LikertChart:()=>Wg,LineChart:()=>of,LinkedCharts:()=>Ih,MinimapChart:()=>Wf,MobileAnnotationCalloutList:()=>aw,MobileChartContainer:()=>ik,MobileStandardControls:()=>Px,MultiAxisLineChart:()=>og,MultiLineTooltip:()=>Ns,NetworkCustomChart:()=>gg,OrbitDiagram:()=>_y,OrdinalCustomChart:()=>bg,PieChart:()=>bm,ProcessSankey:()=>my,QuadrantChart:()=>Xf,RealtimeHeatmap:()=>yb,RealtimeHistogram:()=>sb,RealtimeLineChart:()=>ob,RealtimeSwarmChart:()=>db,RealtimeTemporalHistogram:()=>lb,RealtimeWaterfallChart:()=>fb,RidgelinePlot:()=>cm,RingBuffer:()=>te,SankeyDiagram:()=>Qm,Scatterplot:()=>Gp,ScatterplotMatrix:()=>Bf,SmallMultipleChart:()=>hk,StackedAreaChart:()=>mf,StackedBarChart:()=>Pg,StreamNetworkFrame:()=>qd,StreamOrdinalFrame:()=>sc,StreamXYFrame:()=>Ka,SwarmPlot:()=>Xg,SwimlaneChart:()=>Fm,THEME_PRESETS:()=>Wh,TemporalHistogram:()=>ab,ThemeProvider:()=>Qh,Tooltip:()=>$s,TreeDiagram:()=>vy,Treemap:()=>wy,VISUALIZATION_CONTROL_TYPES:()=>Fb,ViolinPlot:()=>sm,XYCustomChart:()=>hg,adaptiveTimeTicks:()=>Ab,auditVisualizationControls:()=>Eb,buildNavigationTree:()=>Zv,clampMobileRange:()=>bx,compileMotionEncoding:()=>Je,configToJSX:()=>lv,copyConfig:()=>av,createControlObservationAdapter:()=>Bb,createHatchPattern:()=>Gl,darkenColor:()=>p,deriveMotionVector:()=>rt,deserializeSelections:()=>uv,exportChart:()=>Cb,fromConfig:()=>nv,fromURL:()=>sv,fromVegaLite:()=>yv,intentManifestFromRecipe:()=>Uk,lightenColor:()=>f,normalizeTooltip:()=>Bs,opacityFromAge:()=>tt,resolveMotionAccessor:()=>Ze,resolveMotionAge:()=>et,resolveMotionVector:()=>ot,resolveResponsiveRules:()=>tp,resolveThemePreset:()=>qh,responsiveRuleMatches:()=>ep,serializeSelections:()=>cv,smartTickFormat:()=>bb,smartTooltipEntries:()=>_s,summarizeIntentManifest:()=>Xk,syncPushBuffer:()=>nw,themeToCSS:()=>Eh,themeToTokens:()=>zh,toConfig:()=>rv,toURL:()=>iv,useBrushSelection:()=>mh,useCategoryColors:()=>th,useChartObserver:()=>xh,useCustomLayoutSelection:()=>mo,useFilteredData:()=>bh,useForceLayout:()=>Gk,useLinkedChartsActive:()=>Ah,useLinkedHover:()=>fh,useMobileRangeControls:()=>xx,useNavigationSync:()=>ow,useSelection:()=>hh,useSelectionActions:()=>ph,useSyncedPushData:()=>iw,useTheme:()=>Zh,zoomMobileRange:()=>vx}),module.exports=(A=M,l(t({},"__esModule",{value:!0}),A));var j=c(require("react")),P=require("react"),_=require("react"),L=require("d3-selection"),R=require("d3-brush"),T=c(require("react"));function I({label:e="Data range brush",description:t="Use arrow keys to move the selected range, Shift plus an arrow key to resize it, and Escape to clear it.",onAction:o}={}){const r=T.useId().replace(/:/g,""),n=T.useRef(o);return n.current=o,{description:t,descriptionId:"semiotic-brush-description-"+r,svgProps:{role:"region",tabIndex:0,"aria-label":e,"aria-describedby":"semiotic-brush-description-"+r,onKeyDown:T.useCallback(e=>{const t=function(e){return"Escape"===e.key?{type:"clear"}:"ArrowLeft"===e.key?{type:"nudge",direction:"left",resize:e.shiftKey}:"ArrowRight"===e.key?{type:"nudge",direction:"right",resize:e.shiftKey}:"ArrowUp"===e.key?{type:"nudge",direction:"up",resize:e.shiftKey}:"ArrowDown"===e.key?{type:"nudge",direction:"down",resize:e.shiftKey}:null}(e);t&&(e.preventDefault(),n.current?.(t))},[])}}}var $=require("react/jsx-runtime");function N(e,t,o,r){const[n,i]=[Math.min(...t),Math.max(...t)],s=(i-n)/20;let[a,l]=e;if(r)0>o?a=Math.max(n,a-s):l=Math.min(i,l+s);else{const e=l-a;a=Math.max(n,Math.min(i-e,a+o*s)),l=a+e}return[a,l]}function F(e,t){let o=0,r=t.length-1;for(;r>o;){const n=o+r+1>>1;t[n]>e?r=n-1:o=n}return t[o]}function B(e,t){let o=0,r=t.length-1;for(;r>o;){const n=o+r>>1;e>t[n]?o=n+1:r=n}return t[o]}function D({width:e,height:t,totalWidth:o,totalHeight:r,margin:n,dimension:i,scales:s,onBrush:a,binSize:l,snap:c,binBoundaries:u,snapDuring:d,streaming:h}){const p=(0,_.useRef)(null),f=(0,_.useRef)(null),g=(0,_.useRef)(a);g.current=a;const m=(0,_.useRef)(s);m.current=s;const y=(0,_.useMemo)(()=>u?[...u].sort((e,t)=>e-t):void 0,[u]),b=(0,_.useRef)(y);b.current=y;const v=(0,_.useRef)(!1),x=(0,_.useRef)(null),k=I({label:"xy"===i?"Two-dimensional data range brush":i.toUpperCase()+" data range brush",onAction:e=>{const t=m.current,o=f.current;if(!t||!o||!p.current)return;const r=(0,L.select)(p.current).select(".brush-g");if("clear"===e.type)return v.current=!0,r.call(o.move,null),v.current=!1,x.current=null,void g.current(null);const n=t.x.domain(),s=t.y.domain(),a=x.current;let l=a?.x??[n[0]+.4*(n[1]-n[0]),n[0]+.6*(n[1]-n[0])],c=a?.y??[s[0]+.4*(s[1]-s[0]),s[0]+.6*(s[1]-s[0])];const u="left"===e.direction||"right"===e.direction,d="left"===e.direction||"down"===e.direction?-1:1;if(u&&"y"!==i&&(l=N(l,n,d,e.resize)),u||"x"===i||(c=N(c,s,d,e.resize)),u&&"y"===i||!u&&"x"===i)return;const h={x:l,y:c};v.current=!0,r.call(o.move,"x"===i?[t.x(l[0]),t.x(l[1])]:"y"===i?[t.y(c[1]),t.y(c[0])]:[[t.x(l[0]),t.y(c[1])],[t.x(l[1]),t.y(c[0])]]),v.current=!1,x.current=h,g.current(h)}});return(0,_.useEffect)(()=>{if(!p.current)return;const o=(0,L.select)(p.current).select(".brush-g"),r="x"===i?(0,R.brushX)():"y"===i?(0,R.brushY)():(0,R.brush)();return r.extent([[0,0],[e,t]]),r.on("brush end",n=>{if(v.current)return;const s=m.current;if(!s)return;if(!n.selection)return x.current=null,void g.current(null);let a,u;if("x"===i){const[e,o]=n.selection;a=[s.x.invert(e),s.x.invert(o)],u=[s.y.invert(t),s.y.invert(0)]}else if("y"===i){const[t,o]=n.selection;a=[s.x.invert(0),s.x.invert(e)],u=[s.y.invert(o),s.y.invert(t)]}else{const[[e,t],[o,r]]=n.selection;a=[s.x.invert(e),s.x.invert(o)],u=[s.y.invert(r),s.y.invert(t)]}if("bin"===c&&"y"!==i&&("end"===n.type||"brush"===n.type&&d)){const e=b.current;e&&e.length>0?a=function(e,t){return 0===t.length?e:[F(e[0],t),B(e[1],t)]}(a,e):l&&l>0&&(a=[Math.floor(a[0]/l)*l,Math.ceil(a[1]/l)*l]);const t=s.x(a[0]),c=s.x(a[1]);if(v.current=!0,"x"===i)o.call(r.move,[t,c]);else if("xy"===i){const e=n.selection;o.call(r.move,[[t,e[0][1]],[c,e[1][1]]])}v.current=!1}const h={x:a,y:u};x.current=h,g.current(h)}),o.call(r),f.current=r,o.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{r.on("brush end",null),f.current=null}},[e,t,i,c,l,d]),(0,_.useEffect)(()=>{if(!(h&&s&&f.current&&x.current))return;if(!p.current)return;if("y"===i)return;const e=x.current,t=s.x.domain()[0],o=(0,L.select)(p.current).select(".brush-g");if(t>=e.x[1])return v.current=!0,o.call(f.current.move,null),v.current=!1,x.current=null,void g.current(null);let r=e.x[0],n=!1;if(t>e.x[0]){if(r=t,"bin"===c){const e=b.current;e&&e.length>0?r=B(t,e):l&&l>0&&(r=Math.ceil(t/l)*l)}if(r>=e.x[1])return v.current=!0,o.call(f.current.move,null),v.current=!1,x.current=null,void g.current(null);n=!0}const a=s.x(r),u=s.x(e.x[1]);if(v.current=!0,"x"===i)o.call(f.current.move,[a,u]);else{const t=s.y(e.y[1]),r=s.y(e.y[0]);o.call(f.current.move,[[a,t],[u,r]])}if(v.current=!1,n){const t={x:[r,e.x[1]],y:e.y};x.current=t,g.current(t)}},[s,h,i,c,l]),(0,$.jsxs)("svg",{ref:p,width:o,height:r,...k.svgProps,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:[(0,$.jsx)("title",{children:k.svgProps["aria-label"]}),(0,$.jsx)("desc",{id:k.descriptionId,children:k.description}),(0,$.jsx)("g",{className:"brush-g",transform:`translate(${n.left},${n.top})`})]})}var E=Object.freeze([]);function z(e){if(!e)return E;let t=!1;for(let o=0;e.length>o;o++){const r=e[o];if(null==r||"object"!=typeof r){t=!0;break}}if(!t)return e;const o=[];for(const t of e)null!=t&&"object"==typeof t&&o.push(t);return o}var H=class{constructor(e,t){this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=e,this.chunkThreshold=t?.chunkThreshold??5e3,this.chunkSize=t?.chunkSize??5e3}updateChunkOptions(e){null!=e.chunkThreshold&&(this.chunkThreshold=e.chunkThreshold),null!=e.chunkSize&&(this.chunkSize=e.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(e){if(e=z(e),this.lastBoundedData===e)return;if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,totalSize:e.length});let t=this.chunkSize;const o=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const r=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,r),bounded:!1}),t=r,this.chunkTimer=e.length>t?requestAnimationFrame(o):0};this.chunkTimer=requestAnimationFrame(o)}setReplacementData(e){if(e=z(e),this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.pushBuffer=[],this.flushScheduled=!1,this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0,preserveCategoryOrder:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,preserveCategoryOrder:!0,totalSize:e.length});let t=this.chunkSize;const o=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const r=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,r),bounded:!1}),t=r,this.chunkTimer=e.length>t?requestAnimationFrame(o):0};this.chunkTimer=requestAnimationFrame(o)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const e=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:e,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(e){null!=e&&"object"==typeof e&&(this.pushBuffer.push(e),this.scheduleFlush())}pushMany(e){if(0===e.length)return;let t=0;for(let o=0;e.length>o;o++){const r=e[o];null!=r&&"object"==typeof r&&(this.pushBuffer.push(r),t++)}0!==t&&this.scheduleFlush()}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}},O=require("react"),W=require("react/jsx-runtime");function q(e){let t=null;const o=()=>(t||(t=(0,O.createContext)(null)),t),r=Y(e);return[function({children:t,initialState:r}){const n=(0,O.useRef)(r),i=(0,O.useMemo)(()=>Y(e,n.current),[]),s=o();return(0,W.jsx)(s.Provider,{value:i,children:t})},(e,t)=>{const n=o(),i=(0,O.useContext)(n)??r,s=(0,O.useRef)(e);s.current=e;const a=(0,O.useRef)({hasValue:!1,value:void 0}),l=(0,O.useCallback)(()=>{const e=s.current(i.getState()),o=a.current;return o.hasValue&&t&&t(o.value,e)?o.value:(a.current={hasValue:!0,value:e},e)},[i,t]),c=(0,O.useCallback)(()=>s.current(i.getState()),[i]);return(0,O.useSyncExternalStore)(i.subscribe,l,c)}]}function Y(e,t){const o=new Set;let r={...e(function(e){const t=e(r);if(function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}(t)){r={...r,...t};for(const e of o)e()}}),...t??{}};return{getState:()=>r,subscribe:function(e){return o.add(e),()=>{o.delete(e)}}}}function G(e){if(!e?.colors)return;const t=e.colors;return{primary:t.primary,secondary:t.secondary||t.primary,surface:t.surface||t.background,success:t.success,danger:t.danger,warning:t.warning,error:t.error,info:t.info,text:t.text,textSecondary:t.textSecondary,border:t.border,grid:t.grid}}function V(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t={...t,colors:{...t.colors,categorical:X}}),e.accessibility.highContrast){const e="dark"===t.mode;t={...t,colors:{...t.colors,text:e?"#ffffff":"#000000",textSecondary:e?"#cccccc":"#333333",grid:e?"#666666":"#999999",border:e?"#888888":"#000000"}}}return t}var X=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],U={mode:"light",colors:{primary:"#00a2ce",secondary:"#6c757d",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"transparent",surface:"#ffffff",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc",selection:"#00a2ce",selectionOpacity:.15,success:"#2ca02c",danger:"#d62728",warning:"#f0ad4e",error:"#b4181b",info:"#00a2ce"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:12}},K={mode:"dark",colors:{primary:"#4fc3f7",secondary:"#90a4ae",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",diverging:"RdBu",background:"#1a1a2e",surface:"#252540",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555",selection:"#4fc3f7",selectionOpacity:.15,success:"#81c784",danger:"#ef5350",warning:"#ffb74d",error:"#d84848",info:"#4fc3f7"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:12}},Q={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:X,sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#000000",textSecondary:"#333333",grid:"#999999",border:"#000000",focus:"#0000cc",selection:"#0000cc",selectionOpacity:.1,success:"#006400",danger:"#cc0000",warning:"#b15a00",error:"#8b0000",info:"#0000cc"},typography:{fontFamily:"system-ui, sans-serif",titleSize:18,labelSize:14,tickSize:12},tooltip:{background:"#000000",text:"#ffffff",borderRadius:"4px",fontSize:"14px",shadow:"0 2px 8px rgba(0, 0, 0, 0.3)"},borderRadius:"4px"};function Z(e,t){if("light"===t)return U;if("dark"===t)return K;if("high-contrast"===t)return Q;if("string"==typeof t)return void 0!==console&&console.warn(`[ThemeStore] Unknown theme preset "${t}". Keeping current theme.`),e;if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?K:U;return V({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}return V({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}var[J,ee]=q(e=>({theme:U,setTheme(t){e(e=>({theme:Z(e.theme,t)}))}})),te=class{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const o of e){const e=this.push(o);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;return{next:()=>this._size>e?{done:!1,value:this.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let o=0;this._size>o;o++)e(this.buffer[(t+o)%this._capacity],o)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let o=0;this._size>o;o++)e[o]=this.buffer[(t+o)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray();let o=0,r=[];t.length>e&&(o=t.length-e,r=t.slice(0,o)),this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(let e=o;t.length>e;e++)this.push(t[e]);return r}update(e,t){const o=[],r=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++){const i=(r+n)%this._capacity,s=this.buffer[i];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:{...s},o.push(e),this.buffer[i]=t(s)}}return o}remove(e){const t=[],o=[];if(this.forEach(r=>{e(r)?o.push(r):t.push(r)}),0===o.length)return o;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return o}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}},oe=class{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(e){Number.isFinite(e)&&(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}evict(e){e!==this._min&&e!==this._max||(this._dirty=!0)}recalculate(e,t){this._min=1/0,this._max=-1/0;for(const o of e){const e=t?t(o):o;Number.isFinite(e)&&(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}this._dirty=!1}clear(){this._min=1/0,this._max=-1/0,this._dirty=!1}get extent(){return[this._min,this._max]}get min(){return this._min}get max(){return this._max}get dirty(){return this._dirty}};function re(e,t){return e===t}function ne(e,t){if("function"==typeof e)return t=>+e(t);const o=e||t;return e=>+e[o]}function ie(e,t){if("function"==typeof e)return e;const o=e||t;return e=>e[o]}function se(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}var ae=/^\d{4}-\d{1,2}$/;function le(e){const t=e.trim();if(!t||!Number.isNaN(Number(t)))return NaN;const o=ae.test(t)?t+"-01":t;if(o===t&&10>t.length)return NaN;const r=Date.parse(o);return Number.isFinite(r)?r:NaN}function ce(e){return e instanceof Date?e.getTime():"string"==typeof e?le(e):+e}function ue(e){return new Set(Array.isArray(e)?e:[e])}var de=require("d3-scale");function he(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function pe(e,t,o){const r=e=>e.toString(16).padStart(2,"0");return`#${r(e)}${r(t)}${r(o)}`}function fe(e){const t=e.map(he),o=t.length-1;return e=>{if(0>=e){const[e,o,r]=t[0];return pe(e,o,r)}if(e>=1){const[e,r,n]=t[o];return pe(e,r,n)}const r=e*o,n=Math.floor(r),i=r-n,[s,a,l]=t[n],[c,u,d]=t[n+1];return pe(Math.round(s+(c-s)*i),Math.round(a+(u-a)*i),Math.round(l+(d-l)*i))}}var ge=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],me=fe(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),ye=fe(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),be=fe(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),ve=fe(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),xe=fe(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),ke=fe(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),we=fe(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),Se=fe(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),Ae=fe(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),Ce=fe(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),Me=fe(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),je=fe(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]),Pe={blues:me,reds:ye,greens:be,viridis:we,oranges:ve,purples:xe,greys:ke,plasma:Se,inferno:Ae,magma:Ce,cividis:Me,turbo:je};function _e(e){return e&&Pe[e]||me}var Le=fe(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),Re=fe(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),Te=fe(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),Ie=fe(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),$e=fe(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),Ne=fe(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),Fe=fe(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]),Be={category10:ge,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],...Pe},De=ge,Ee=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],ze=["#f0f0f0","#b5d4ea","#f4c2a1","#b8dab2","#d4b5e0","#f9e0a2","#a8d8d8"],He=new Set(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","transparent","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]);function Oe(e,t,o){if("function"==typeof t){const r=t(e);return o&&r&&"string"==typeof r&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||He.has(t)}(r)?o(r):r}const r=e?.[t]+"";return o?o(r):De[Math.abs(function(e){let t=0;for(let o=0;e.length>o;o++)t=(t<<5)-t+e.charCodeAt(o),t&=t;return Math.abs(t)}(r))%De.length]}function We(e,t){if(null==t||!Object.prototype.hasOwnProperty.call(e,t))return;const o=e[t];return"string"==typeof o&&o.length>0?o:void 0}function qe(e,t,o="category10"){if(o&&"object"==typeof o&&!Array.isArray(o)){const e=o;return t=>We(e,t)??"#999"}const r=Array.from(new Set(e.map(e=>e?.[t]).filter(e=>null!=e).map(e=>e+""))),n=r.every(e=>!isNaN(Number(e)));if(Array.isArray(o))return(0,de.scaleOrdinal)().domain(r).range(o).unknown("#999");const i=Be[o]||Be.category10;if(n&&"function"==typeof i){let e=-1/0;for(const t of r){const o=Number(t);o>e&&(e=o)}return t=>i(Number(t)/e)}{const e=Array.isArray(i)?i:De;return(0,de.scaleOrdinal)().domain(r).range(e).unknown("#999")}}function Ye(e,t,o=[3,20],r){let n;if(n="function"==typeof t?t(e):e?.[t],!r)return n;const[i,s]=r,[a,l]=o;if(s===i)return(a+l)/2;let c=(n-i)/(s-i);return 0>c?c=0:c>1&&(c=1),a+c*(l-a)}function Ge(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}function Ve(e,t){return Math.min((e-t.startTime)/t.duration,1)}function Xe(e,t,o){return e+(t-e)*o}function Ue(){return"undefined"!=typeof performance?performance.now():Date.now()}var Ke={fresh:1,aging:1.5,stale:3};function Qe(e,t,o={}){return Number.isFinite(t)&&t>0?Number.isNaN(e)?"fresh":e===1/0?"expired":0>e||t*(o.fresh??Ke.fresh)>e?"fresh":t*(o.aging??Ke.aging)>e?"aging":t*(o.stale??Ke.stale)>e?"stale":"expired":"fresh"}function Ze(e,t,o){if(null!=e)return"function"==typeof e?e(t,o):"object"==typeof e&&null!==e&&"constant"in e?e.constant:t[e]}function Je(e){const{data:t,encoding:o}=e,r=[],n=new Map;return t.forEach((e,t)=>{const i=Ze(o.id,e,t);if(null==i||""===i)throw Error(`[semiotic] Motion encoding row ${t} resolved an empty id.`);const s=i+"";if(n.has(s))throw Error(`[semiotic] Duplicate motion encoding id "${s}".`);const a=Ze(o.process?.group,e,t),l=Ze(o.process?.stage,e,t),c=Ze(o.accessible?.group,e,t)??(null!=a?a+"":null!=l?l+"":void 0),u={};for(const r of Object.keys(o.evidence??{}))u[r]=Ze(o.evidence?.[r],e,t);const d={id:s,datum:e,time:{arrival:Ze(o.time?.arrival,e,t),basis:o.time?.basis,unit:o.time?.unit},placement:{x:Ze(o.placement?.x,e,t),y:Ze(o.placement?.y,e,t),lane:Ze(o.placement?.lane,e,t),space:o.placement?.space},kinematics:{velocityX:Ze(o.kinematics?.velocityX,e,t),velocityY:Ze(o.kinematics?.velocityY,e,t),space:o.kinematics?.space},process:{group:a,stage:l,target:Ze(o.process?.target,e,t),work:Ze(o.process?.work,e,t)},evidence:u,accessible:{description:Ze(o.accessible?.description,e,t),group:c,label:Ze(o.accessible?.label,e,t)??s}};r.push(d),n.set(s,d)}),{rows:r,byId:n}}function et(e){const t=e.now-e.arrival;return{age:t,progress:Number.isFinite(t)&&Number.isFinite(e.ttl)&&e.ttl>0?Math.max(0,t)/e.ttl:t===1/0&&Number.isFinite(e.ttl)&&e.ttl>0?1/0:0,lifecycle:Qe(t,e.ttl,e.thresholds)}}function tt(e){const t=Math.max(0,Math.min(1,e.minOpacity??.1));if(Number.isNaN(e.age))return 1;if(e.age===1/0)return t;if(!Number.isFinite(e.extent)||0>=e.extent)return 1;const o=Math.max(0,e.age);if("step"===e.type)return(e.threshold??.5*e.extent)>o?1:t;if("exponential"===e.type){const r=e.halfLife??e.extent/2;return t+Math.pow(.5,o/(r>0?r:e.extent/2))*(1-t)}return t+Math.max(0,Math.min(1,1-o/e.extent))*(1-t)}function ot(e,t){const o=Number.isFinite(e)?e:0,r=Number.isFinite(t)?t:0;return{velocityX:o,velocityY:r,speed:Math.hypot(o,r),direction:Math.atan2(r,o)}}function rt(e,t,o){return Number.isFinite(o)&&o>0?ot((t.x-e.x)/o,(t.y-e.y)/o):ot(0,0)}function nt(e,t,o){if(1>=o)return 1;const r=o-1;return tt({age:r-t,extent:r,type:e.type,halfLife:e.halfLife??o/2,threshold:e.stepThreshold??.5*o,minOpacity:e.minOpacity??.1})}function it(e){const t=new Map;for(let o=0;e.length>o;o++)t.set(e[o],o);return t}function st(e,t,o){const r=e.duration??500,n=o-t;return r>n?1-n/r:0}function at(e,t,o,r){let n=!1;return t>0?(e._pulseIntensity!==t&&(e._pulseIntensity=t,n=!0),e._pulseColor!==o&&(e._pulseColor=o,n=!0),e._pulseGlowRadius!==r&&(e._pulseGlowRadius=r,n=!0),n):(0!==e._pulseIntensity&&(e._pulseIntensity=0,n=!0),void 0!==e._pulseColor&&(e._pulseColor=void 0,n=!0),void 0!==e._pulseGlowRadius&&(e._pulseGlowRadius=void 0,n=!0),n)}function lt(e,t,o=("undefined"!=typeof performance?performance.now():Date.now())){if(!t||0===t.size)return!1;const r=e.duration??500,n=t.peek();return null!=n&&r>o-n}function ct(e,t,o){if(t._transitionKey)return t._transitionKey;switch(t.type){case"point":if(t.pointId)return"p:"+t.pointId;if("streaming"===e.runtimeMode&&t.datum){const o=e.getX(t.datum),r=e.getY(t.datum);if(e.getCategory)return`p:${e.getCategory(t.datum)}:${o}:${r}`;if(null!=o&&null!=r)return`p:${o}:${r}`}return"p:"+o;case"glyph":return t.pointId?"g:"+t.pointId:"g:"+o;case"rect":return`r:${t.group||""}:${t.datum?.binStart??t.datum?.category??o}`;case"heatcell":return`h:${t.x}_${t.y}`;case"candlestick":return null==t.datum?"c:"+o:"c:"+e.getX(t.datum);case"line":return"l:"+(t.group||"_default");case"area":return"a:"+(t.group||"_default");default:return null}}function ut(e,t,o,r,n,i){const s=[];for(const n of e){const e=o(n),i=r(n);Number.isFinite(e)&&Number.isFinite(i)&&s.push({px:t.x(e),py:t.y(i),rawY:i,d:n})}s.sort((e,t)=>e.px-t.px);const a=Array(s.length),l=Array(s.length),c=Array(s.length);for(let e=0;s.length>e;e++){const t=s[e];a[e]=[t.px,t.py],l[e]=t.rawY,c[e]=t.d}return{type:"line",path:a,rawValues:l,style:n,datum:c,group:i}}function dt(e,t,o,r,n,i,s,a){const l=[];for(const i of e){const e=o(i),s=r(i);if(!Number.isFinite(e)||!Number.isFinite(s))continue;const c=t.x(e),u=a?a(i):n;l.push({px:c,topY:t.y(s),botY:t.y(u)})}l.sort((e,t)=>e.px-t.px);const c=Array(l.length),u=Array(l.length);for(let e=0;l.length>e;e++){const t=l[e];c[e]=[t.px,t.topY],u[e]=[t.px,t.botY]}return{type:"area",topPath:c,bottomPath:u,style:i,datum:e,group:s}}function ht(e,t,o,r){const n=new Map;if("silhouette"===r)for(const r of e){let e=0;for(const n of t)e+=o(n,r)||0;n.set(r,-e/2)}else if("wiggle"===r){e.length>0&&n.set(e[0],0);for(let r=1;e.length>r;r++){const i=e[r-1],s=e[r];let a=0,l=0,c=0;for(const e of t){const t=o(e,s)||0;a+=(2*c+t)*(t-(o(e,i)||0)),l+=t,c+=t}const u=n.get(i)??0;n.set(s,u-(l>0?a/(2*l):0))}if(e.length>0){let r=0;for(const i of e){let e=0;for(const r of t)e+=o(r,i)||0;r+=(n.get(i)??0)+e/2}const i=r/e.length;for(const t of e)n.set(t,(n.get(t)??0)-i)}}else for(const t of e)n.set(t,0);return n}function pt(e,t,o,r,n,i,s){const a=o(e),l=r(e);if(!Number.isFinite(a)||!Number.isFinite(l))return null;const c={type:"point",x:t.x(a),y:t.y(l),r:n,style:i,datum:e};return void 0!==s&&(c.pointId=s),c}function ft(e,t,o,r,n,i,s,a){const l=o(e),c=r(e);if(!Number.isFinite(l)||!Number.isFinite(c))return null;const u={type:"symbol",x:t.x(l),y:t.y(c),size:n,symbolType:i,style:s,datum:e};return void 0!==a&&(u.pointId=a),u}function gt(e,t,o,r,n,i,s){return{type:"rect",x:e,y:t,w:o,h:r,style:n,datum:i,group:s}}function mt(e,t,o,r,n,i,s){const a={type:"heatcell",x:e,y:t,w:o,h:r,fill:n,datum:i};return s?.showValues&&(a.showValues=!0,a.value=s.value,s.valueFormat&&(a.valueFormat=s.valueFormat)),a}function yt(e,t,o,r){return"function"==typeof t.style?t.style(r||{},o):t.style&&"object"==typeof t.style?t.style:e.resolveBoundsStyle(o,r)}function bt(e,t,o,r){if(!e.scales)return null;const n=[],i=[];for(const o of t){const t=e.getX(o);if(!Number.isFinite(t))continue;const s=r.getTop(o),a=r.getBottom(o);if(!Number.isFinite(s)||!Number.isFinite(a))continue;const l=e.scales.x(t),c=e.scales.y(s),u=e.scales.y(a);Number.isFinite(l)&&Number.isFinite(c)&&Number.isFinite(u)&&(n.push([l,c]),i.push([l,u]))}return 2>n.length?null:{type:"area",topPath:n,bottomPath:i,style:yt(e,r,o,t[0]),datum:t,group:o,interactive:r.interactive}}function vt(e){const t=[],o=[];if(!e)return{perSeries:t,aggregate:o};for(const r of e)r.perSeries?t.push(r):o.push(r);return{perSeries:t,aggregate:o}}function xt(e,t,o){const r=[];for(const n of o){const o=bt(e,t,"__ribbon_aggregate",n);o&&r.push(o)}return r}function kt(e,t,o,r){const n=[];for(const i of r){const r=bt(e,t,o,i);r&&n.push(r)}return n}function wt(e,t){if(!e)return{};if(!t||0===t.length)return e;const o=[];for(const r of t){if("band"!==r.kind)continue;const t=r.getTop(e),n=r.getBottom(e);Number.isFinite(n)&&Number.isFinite(t)&&o.push({y0:n,y1:t})}return 0===o.length?e:{...e,band:o[0],bands:o}}function St(e,t,o,r){if(!e.config.pointStyle)return;const n=r??e.getY;for(const r of t){const t=e.resolveGroupColor(r.key);for(const i of r.data){let r=e.config.pointStyle(i);!r.fill&&t&&(r={...r,fill:t});const s=r.r??3,a=e.getPointId?e.getPointId(i)+"":void 0,l=pt(i,e.scales,e.getX,n,s,r,a);l&&o.push(l)}}}var At={topOpacity:.8,bottomOpacity:.05};function Ct(e){if(e)return!0===e?At:"colorStops"in e?e:{topOpacity:e.topOpacity??At.topOpacity,bottomOpacity:e.bottomOpacity??At.bottomOpacity}}var Mt=require("d3-shape"),jt={circle:Mt.symbolCircle,square:Mt.symbolSquare,triangle:Mt.symbolTriangle,diamond:Mt.symbolDiamond,star:Mt.symbolStar,cross:Mt.symbolCross,wye:Mt.symbolWye},Pt=["circle","triangle","diamond","star","square","chevron","cross","wye"];function _t(e,t,o){if(o)return o;const r=e??"circle";return"chevron"===r?function(e){const t=1.5*Lt(e),o=.92*t;return`M0,${-t}L${o},${(.78*t).toFixed(3)}L0,${(.28*t).toFixed(3)}L${-o},${(.78*t).toFixed(3)}Z`}(t):(0,Mt.symbol)(jt[r]??Mt.symbolCircle,Math.max(1,t))()??""}function Lt(e){return Math.sqrt(Math.max(1,e)/Math.PI)}var Rt=new Map;function Tt(e,t,o,r,n){const i=new Map;for(const s of e){const e=t(s),a=o(s);if(null==e||null==a||Number.isNaN(e)||Number.isNaN(a))continue;const l=Math.floor(e/r)*r;let c=i.get(l);if(c||(c={start:l,end:l+r,total:0,categories:new Map},i.set(l,c)),c.total+=a,n){const e=n(s);c.categories.set(e,(c.categories.get(e)||0)+a)}}return i}function It(e){if("production"===process.env.NODE_ENV)return;const{label:t,nodes:o,overlays:r,warned:n}=e;$t(r)&&0===o.length&&Nt(n,"overlay-only",`[semiotic] ${t} returned overlays but no data-bearing scene nodes. Overlays do not participate in hover, selection, transitions, SSR evidence, or accessibility tables. Emit at least one scene node with a datum, or mark the overlay-only chart as intentionally decorative.`),o.length>0&&o.every(e=>null==e.datum)&&Nt(n,"null-datums",`[semiotic] ${t} returned scene nodes, but every scene-node datum is null. Hover, callbacks, selection, and tooltip helpers need data-bearing nodes. Attach a user-facing datum to each interactive node, or set interactive overlays outside the chart.`)}function $t(e){return null!=e&&!1!==e&&""!==e&&(!Array.isArray(e)||e.some($t))}function Nt(e,t,o){e.has(t)||(e.add(t),console.warn(o))}function Ft(e,t,o,r){const n=function(e){if(e instanceof Error)return{name:e.name||"Error",message:e.message||"Custom layout threw."};if("string"==typeof e)return{name:"Error",message:e};if(null==e)return{name:"Error",message:"Custom layout threw a nullish value."};try{return{name:"Error",message:e+""}}catch{return{name:"Error",message:"Custom layout threw a non-stringifiable value."}}}(t),i="network"===e?"customNetworkLayout":"customLayout";return{code:"CUSTOM_LAYOUT_ERROR",severity:"error",phase:"layout",component:e,source:i,message:`Semiotic ${e} ${i} failed: ${n.message}`,error:n,recovery:o?"preserved-last-good-scene":"empty-scene",preservedLastGoodScene:o,affectedRevision:r}}function Bt(e,t){const o="function"==typeof e?e:o=>o[e||t];return e=>{const t=o(e);return null==t?NaN:+t}}function Dt(e){const t=[],o=["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode,r=Bt(o&&e.valueAccessor||e.yAccessor,o?"value":"y");if(e.boundsAccessor){const o=ne(e.boundsAccessor,"bounds");t.push({kind:"bounds",getTop:e=>{const t=r(e);if(!Number.isFinite(t))return NaN;const n=o(e);return Number.isFinite(n)&&0!==n?t+n:t},getBottom:e=>{const t=r(e);if(!Number.isFinite(t))return NaN;const n=o(e);return Number.isFinite(n)&&0!==n?t-n:t},style:e.boundsStyle,perSeries:!0,interactive:!1})}if(e.band){const o=Array.isArray(e.band)?e.band:[e.band];for(const e of o)t.push({kind:"band",getTop:Bt(e.y1Accessor,"y1"),getBottom:Bt(e.y0Accessor,"y0"),style:e.style,perSeries:!1!==e.perSeries,interactive:!0===e.interactive})}return t}var Et=require("d3-scale");function zt(e,t){return t?[t[0]??e[0],t[1]??e[1]]:e}function Ht(e,t,o){if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return(0,Et.scaleLog)().domain(e).range(o).clamp(!0)}return"symlog"===e?(0,Et.scaleSymlog)().domain(t).range(o):"time"===e?(0,Et.scaleTime)().domain([new Date(t[0]),new Date(t[1])]).range(o):(0,Et.scaleLinear)().domain(t).range(o)}function Ot(e,t,o){t>e.capacity&&(e.resize(t),o&&t>o.capacity&&o.resize(t))}function Wt(e,t){const o=new te(e.capacity);return e.forEach(()=>o.push(t)),o}function qt(e,t,o,r){const n=e.push(t);return o&&o.push(r),n}function Yt(e,t,o){if(!t||0===t.size)return;const r=new Set;if(e.forEach((e,t)=>{o(e)&&r.add(t)}),0===r.size)return;const n=t.toArray();t.clear();for(let e=0;n.length>e;e++)r.has(e)||t.push(n[e])}var Gt={data:"data",domain:"domain",layout:"layout","scene-geometry":"sceneGeometry","scene-style":"sceneStyle","data-paint":"dataPaint","interaction-paint":"interactionPaint",overlay:"overlay",accessibility:"accessibility",evidence:"evidence"};function Vt(e,t){const o={...e};for(const e of t)o[Gt[e]]++;return o}function Xt(e,t,o){const r=new Set(t);return{changeSet:{...e,...e.keys?{keys:[...e.keys]}:{}},changed:r,revisions:Vt(o,r)}}var Ut=class{constructor(){this.revisions={data:0,domain:0,layout:0,sceneGeometry:0,sceneStyle:0,dataPaint:0,interactionPaint:0,overlay:0,accessibility:0,evidence:0},this.latest=Xt({kind:"initialize"},[],this.revisions)}get last(){return this.latest}record(e,t){const o=Xt(e,t,this.revisions);return this.revisions=o.revisions,this.latest=o,o}},Kt=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Qt=["scene-style","data-paint","accessibility","evidence"],Zt=new Set(["lineStyle","pointStyle","areaStyle","barStyle","swarmStyle","waterfallStyle","candlestickStyle","boundsStyle","colorScheme","themeCategorical","themeSemantic","barColors"]),Jt=class{constructor(){this.tracker=new Ut}get last(){return this.tracker.last}recordData(e,t){return this.tracker.record({kind:e,...void 0===t?{}:{count:t}},Kt)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},Qt):this.recordNoop("restyle")}recordConfig(e,t,o){return this.tracker.record({kind:"config",keys:e},t?function(e,t){const o=new Set(["layout","scene-geometry","data-paint","overlay","accessibility","evidence"]);return t&&o.add("domain"),e.some(e=>Zt.has(e))&&o.add("scene-style"),o}(e,o):[])}},eo=require("d3-quadtree"),to=class{constructor(){this.maxRadius=0,this.tree=null}get quadtree(){return this.tree}get maxPointRadius(){return this.maxRadius}clear(){this.tree=null,this.maxRadius=0}rebuild(e,t){if("scatter"!==e&&"bubble"!==e&&"custom"!==e)return void this.clear();let o=0,r=0;for(const e of t)"point"===e.type&&(o++,e.r>r&&(r=e.r));if(this.maxRadius=r,500>=o)return void(this.tree=null);const n=Array(o);let i=0;for(const e of t)"point"===e.type&&(n[i++]=e);this.tree=(0,eo.quadtree)().x(e=>e.x).y(e=>e.y).addAll(n)}},oo=class e{constructor(e){if(this.xExtent=new oe,this.yExtent=new oe,this.growingCapacityWarned=!1,this.windowSizeWarned=!1,this.resolvedRibbons=[],this.timestampBuffer=null,this.activeTransition=null,this._hasRenderedOnce=!1,this.prevPositionMap=new Map,this.prevPathMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this._colorMapCache=null,this._groupDataCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this._ingestVersion=0,this._datumIndexCache=null,this._bufferArrayCache=null,this._bufferDirty=!0,this.needsFullRebuild=!0,this.lastLayout=null,this.updateResults=new Jt,this.scales=null,this.scene=[],this.version=0,this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customLayoutFailedThisBuild=!1,this._customLayoutDiagnosticsWarned=new Set,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.xIsDate=!1,this.spatialIndex=new to,this._lastBoundedInsertsRef=null,this.applyPulse=(e,t,o)=>!(!this.config.pulse||!this.timestampBuffer)&&function(e,t,o,r,n,i=("undefined"!=typeof performance?performance.now():Date.now())){const s=e.color??"rgba(255,255,255,0.6)",a=e.glowRadius??4;let l=!1;const c=n??(()=>{const e=new Map;for(let t=0;o.length>t;t++)e.set(o[t],t);return e})();for(const o of t){if("line"===o.type)continue;if("area"===o.type){const t=Array.isArray(o.datum)?o.datum:[o.datum];let n=0,a=!1;for(const o of t){const t=c.get(o);if(null==t)continue;a=!0;const s=r.get(t);if(null==s)continue;const l=st(e,s,i);l>n&&(n=l)}a&&(l=at(o,n,s)||l);continue}const t=c.get(o.datum);if(null==t)continue;const n=r.get(t);l=at(o,null==n?0:st(e,n,i),s,a)||l}return l}(this.config.pulse,e,t,this.timestampBuffer,this.getDatumIndexMap(t),o),this._stylePaintPending=!1,this.config=e,this.buffer=new te(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=ne(e.timeAccessor||e.xAccessor,"time"),this.getY=ne(e.valueAccessor||e.yAccessor,"value")):(this.getX=ne(e.xAccessor,"x"),this.getY=ne(e.yAccessor,"y")),this.getGroup=se(e.groupAccessor),this.getCategory=se(e.categoryAccessor),this.getSize=e.sizeAccessor?ne(e.sizeAccessor,"size"):void 0,this.getColor=se(e.colorAccessor),this.getSymbol=se(e.symbolAccessor),this.getY0=e.y0Accessor?ne(e.y0Accessor,"y0"):void 0,this.resolvedRibbons=Dt(e),this.getPointId=se(e.pointIdAccessor),"candlestick"===e.chartType){const t=null!=e.openAccessor,o=null!=e.closeAccessor;this.getOpen=t?ne(e.openAccessor,"open"):void 0,this.getHigh=ne(e.highAccessor,"high"),this.getLow=ne(e.lowAccessor,"low"),this.getClose=o?ne(e.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!t&&!o}e.pulse&&(this.timestampBuffer=new te(e.windowSize))}syncPulseTimestampBuffer(){this.config.pulse?null!=this.timestampBuffer&&this.timestampBuffer.capacity===this.buffer.capacity&&this.timestampBuffer.size===this.buffer.size||(this.timestampBuffer=Wt(this.buffer,Ue())):this.timestampBuffer=null}pushDatumYExtent(e){if("candlestick"===this.config.chartType&&this.getHigh&&this.getLow)return this.yExtent.push(this.getHigh(e)),void this.yExtent.push(this.getLow(e));this.yExtent.push(this.getY(e)),this.getY0&&this.yExtent.push(this.getY0(e));for(const t of this.resolvedRibbons){const o=t.getTop(e),r=t.getBottom(e);Number.isFinite(o)&&this.yExtent.push(o),Number.isFinite(r)&&this.yExtent.push(r)}}evictDatumYExtent(e){if("candlestick"===this.config.chartType&&this.getHigh&&this.getLow)return this.yExtent.evict(this.getHigh(e)),void this.yExtent.evict(this.getLow(e));this.yExtent.evict(this.getY(e)),this.getY0&&this.yExtent.evict(this.getY0(e));for(const t of this.resolvedRibbons){const o=t.getTop(e),r=t.getBottom(e);Number.isFinite(o)&&this.yExtent.evict(o),Number.isFinite(r)&&this.yExtent.evict(r)}}rebuildYExtent(){this.yExtent.clear();for(const e of this.buffer)this.pushDatumYExtent(e)}rebuildExtents(){this.xExtent.clear(),this.yExtent.clear();for(const e of this.buffer)this.xExtent.push(this.getX(e)),this.pushDatumYExtent(e)}ingest(e){if(e.bounded&&this._lastBoundedInsertsRef===e.inserts)return this.updateResults.recordNoop("replace"),!1;const t=Ue();if(this.lastIngestTime=t,this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,e.bounded){this._lastBoundedInsertsRef=e.inserts,this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this.timestampBuffer&&this.timestampBuffer.clear();const o=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode;if(this.getX=o?ne(this.config.timeAccessor||this.config.xAccessor,"time"):ne(this.config.xAccessor,"x"),this.xIsDate=!1,e.inserts.length>0){const t=e.inserts[0],o=this.config.xAccessor,r="function"==typeof o?o(t):t[o||"x"],n=r instanceof Date,i="string"==typeof r&&Number.isFinite(le(r));if(this.xIsDate=n||i,i){const e="string"==typeof o?o:void 0;this.getX=e?t=>ce(t[e]):e=>ce(o(e))}}Ot(this.buffer,e.totalSize||e.inserts.length,this.timestampBuffer);for(const o of e.inserts)qt(this.buffer,o,this.timestampBuffer,t),this.xExtent.push(this.getX(o)),this.pushDatumYExtent(o)}else for(const o of e.inserts){if("growing"===this.config.windowMode&&this.buffer.full){const e=this.config.maxCapacity??1e5;e>this.growingCap&&(this.growingCap=Math.min(2*this.growingCap,e),this.buffer.resize(this.growingCap),this.timestampBuffer&&this.timestampBuffer.resize(this.growingCap),"production"===process.env.NODE_ENV||this.growingCapacityWarned||5e4>this.growingCap||(this.growingCapacityWarned=!0,console.warn(`[Semiotic] Growing window buffer reached ${this.growingCap} points (cap ${e}). Large canvas scenes are expensive — prefer a sliding window, aggregation, or an explicit maxCapacity if this is intentional.`)))}const e=qt(this.buffer,o,this.timestampBuffer,t);this.xExtent.push(this.getX(o)),this.pushDatumYExtent(o),null!=e&&(this.xExtent.evict(this.getX(e)),this.evictDatumYExtent(e))}return this.updateResults.recordData(e.bounded?"replace":"ingest",e.inserts.length),!0}ingestWithResult(e){return this.ingest(e),this.updateResults.last}computeScene(e){const{config:t,buffer:o}=this,r=this.scales,n=this.lastLayout;if(!this.needsFullRebuild&&!t.customLayout&&this.lastLayout&&this.scene.length>0&&this.scales&&0>=(this.config.scalePadding??0)&&(this.lastLayout.width!==e.width||this.lastLayout.height!==e.height))return void this.remapScene(e);this.xExtent.dirty&&this.xExtent.recalculate(o,this.getX),this.yExtent.dirty&&this.rebuildYExtent();const i=this.getBufferArray(),s=this.yExtent.extent;let a=zt(this.xExtent.extent,t.xExtent),l=zt(s,t.yExtent);const c=!(!(u=t.yExtent)||null==u[0]||null==u[1]);var u;const d="exact"===t.axisExtent;if("stackedarea"===t.chartType&&!c&&o.size>0){const e=function(e){const{config:t,groups:o,getX:r,getY:n}=e,i="exact"===t.axisExtent;if(t.normalize){const o=[0,i?1:1+t.extentPadding];return{yDomain:o,stackExtentCache:{key:`${e.bufferSize}:${e.ingestVersion}:norm`,yDomain:o}}}const s=`${e.bufferSize}:${e.ingestVersion}:${t.baseline??"zero"}:${t.stackOrder??"key"}`;if(e.stackExtentCache&&e.stackExtentCache.key===s)return{yDomain:e.stackExtentCache.yDomain,stackExtentCache:e.stackExtentCache};const a=new Map,l=new Set;let c=0;const u=new Map,d=new Map;for(const e of o){const t=new Map;let o=0;for(const i of e.data){const e=r(i),s=n(i);if(!Number.isFinite(e)||!Number.isFinite(s))continue;t.set(e,(t.get(e)||0)+s),l.add(e),o+=s;const a=(u.get(e)||0)+s;u.set(e,a),a>c&&(c=a)}a.set(e.key,t),d.set(e.key,o)}const h=t.stackOrder??"key",p=(e,t)=>t>e?-1:e>t?1:0;let f,g;if("input"===h)f=o.map(e=>e.key);else if("insideOut"===h){const e=[...o].map(e=>e.key).sort((e,t)=>{const o=(d.get(t)??0)-(d.get(e)??0);return 0!==o?o:p(e,t)}),t=[],r=[];let n=0,i=0;for(const o of e)i>n?(t.push(o),n+=d.get(o)??0):(r.push(o),i+=d.get(o)??0);f=[...r.reverse(),...t]}else f="asc"===h?o.map(e=>e.key).sort((e,t)=>{const o=(d.get(e)??0)-(d.get(t)??0);return 0!==o?o:p(e,t)}):"desc"===h?o.map(e=>e.key).sort((e,t)=>{const o=(d.get(t)??0)-(d.get(e)??0);return 0!==o?o:p(e,t)}):o.map(e=>e.key).sort(p);if("wiggle"===t.baseline||"silhouette"===t.baseline){const e=Array.from(l).sort((e,t)=>e-t),o=ht(e,f,(e,t)=>a.get(e)?.get(t)||0,t.baseline);let r=1/0,n=-1/0;for(const t of e){const e=o.get(t)??0,i=u.get(t)??0;r>e&&(r=e),e+i>n&&(n=e+i)}Number.isFinite(r)&&Number.isFinite(n)||(r=0,n=0);const s=n-r,c=i?0:s>0?s*t.extentPadding:1;g=[r-c,n+c]}else if("diverging"===t.baseline){const e=Array.from(l).sort((e,t)=>e-t),[o,r]=function(e,t,o){let r=0,n=0;for(const i of e){let e=0,s=0;for(const r of t){const t=o(r,i)||0;0>t?s+=t:e+=t}r>s&&(r=s),e>n&&(n=e)}return[r,n]}(e,f,(e,t)=>a.get(e)?.get(t)||0),n=r-o,s=i?0:n>0?n*t.extentPadding:1;g=[o-s,r+s]}else g=[0,c+(i?0:c>0?c*t.extentPadding:1)];return{yDomain:g,stackExtentCache:{key:s,yDomain:g}}}({config:t,groups:this.groupData(i),getX:this.getX,getY:this.getY,bufferSize:o.size,ingestVersion:this._ingestVersion,stackExtentCache:this._stackExtentCache});l=e.yDomain,this._stackExtentCache=e.stackExtentCache}else"bar"===t.chartType&&t.binSize&&!c&&o.size>0?l=function(e,t,o,r,n,i,s){const[,a]=function(e,t,o,r,n){const i=Tt(e,t,o,r,n);if(0===i.size)return[0,0];let s=0;for(const e of i.values())e.total>s&&(s=e.total);return[0,s]}(e,t,o,r,n);return[0,s?a:a+a*i]}(o,this.getX,this.getY,t.binSize,this.getCategory,t.extentPadding,d):"waterfall"===t.chartType&&!c&&o.size>0?l=function(e,t,o,r){const[n,i]=function(e,t){let o=0,r=0,n=0;for(const i of e){const e=t(i);null==e||Number.isNaN(e)||(n+=e,o>n&&(o=n),n>r&&(r=n))}return[o,r]}(e,t),s=i-n,a=r?0:s>0?s*o:1;return[Math.min(0,n-Math.abs(a)),Math.max(0,i+Math.abs(a))]}(o,this.getY,t.extentPadding,d):c||l[0]===1/0||(l=function(e,t,o){if(!o.length)return e;let[r,n]=e;for(const e of t)for(const t of o){const o=t.getTop(e),i=t.getBottom(e);Number.isFinite(o)&&(r>o&&(r=o),o>n&&(n=o)),Number.isFinite(i)&&(r>i&&(r=i),i>n&&(n=i))}return[r,n]}(l,i,this.resolvedRibbons),l=function(e,t){const o=e[1]-e[0],r=t.exactMode?0:o>0?o*t.extentPadding:1,n=[null!=t.userMin?e[0]:e[0]-r,null!=t.userMax?e[1]:e[1]+r];return"log"!==t.yScaleType||n[0]>0||0>=t.dataYDomain[0]||t.exactMode||null==t.userMin&&(n[0]=t.dataYDomain[0]/(1+t.extentPadding)),n}(l,{exactMode:d,extentPadding:t.extentPadding,userMin:t.yExtent?.[0],userMax:t.yExtent?.[1],yScaleType:t.yScaleType,dataYDomain:s}));l=function(e,t,o){if(!t||o)return e;const r=t[0],n=t[1];return null==r&&null==n?e:[null!=r?r:e[0],null!=n?n:e[1]]}(l,t.yExtent,!!c),({xDomain:a,yDomain:l}=function(e,t,o){let r=e,n=t;if(r[0]===1/0||r[1]===-1/0)if("time"===o){const e=Date.now();r=[e-864e5,e]}else r=[0,1];return n[0]!==1/0&&n[1]!==-1/0||(n=[0,1]),{xDomain:r,yDomain:n}}(a,l,t.xScaleType)),this.scales=function(e){const{config:t,layout:o,xDomain:r,yDomain:n}=e,i="streaming"===t.runtimeMode,s=Math.max(0,Math.min(t.scalePadding||0,Math.min(o.width,o.height)/2-1));if(i){if("x"==("up"===(a=t.arrowOfTime)||"down"===a?"y":"x")){const e="right"===t.arrowOfTime?[s,o.width-s]:[o.width-s,s];return{x:(0,Et.scaleLinear)().domain(r).range(e),y:Ht(t.yScaleType,n,[o.height-s,s])}}const e="down"===t.arrowOfTime?[s,o.height-s]:[o.height-s,s];return{x:Ht(t.yScaleType,n,[s,o.width-s]),y:(0,Et.scaleLinear)().domain(r).range(e)}}var a;return{x:Ht(t.xScaleType,r,[s,o.width-s]),y:Ht(t.yScaleType,n,[o.height-s,s])}}({config:t,layout:e,xDomain:a,yDomain:l}),this._customLayoutFailedThisBuild=!1;const h=this.buildSceneNodes(e,i);if(this._customLayoutFailedThisBuild)return!0===this.lastCustomLayoutFailure?.preservedLastGoodScene?(this.scales=r,this.lastLayout=n):(this.scene=[],this.spatialIndex.rebuild(this.config.chartType,this.scene)),void(this.needsFullRebuild=!0);this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=h,this.config.decay&&this.applyDecay(this.scene,i),this.config.pulse&&this.applyPulse(this.scene,i),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&(this.prevPositionMap.size>0||this.prevPathMap.size>0)&&this.startTransition(),this.spatialIndex.rebuild(this.config.chartType,this.scene),this.needsFullRebuild=!1,this.lastLayout={width:e.width,height:e.height},this.version++}get quadtree(){return this.spatialIndex.quadtree}get maxPointRadius(){return this.spatialIndex.maxPointRadius}remapScene(e){const t=e.width/this.lastLayout.width,o=e.height/this.lastLayout.height;for(const e of this.scene)switch(e.type){case"line":for(const r of e.path)r[0]*=t,r[1]*=o;break;case"area":for(const r of e.topPath)r[0]*=t,r[1]*=o;for(const r of e.bottomPath)r[0]*=t,r[1]*=o;e.clipRect&&(e.clipRect={x:e.clipRect.x*t,y:e.clipRect.y*o,width:e.clipRect.width*t,height:e.clipRect.height*o});break;case"point":case"glyph":e.x*=t,e.y*=o;break;case"rect":case"heatcell":e.x*=t,e.y*=o,e.w*=t,e.h*=o;break;case"candlestick":e.x*=t,e.openY*=o,e.closeY*=o,e.highY*=o,e.lowY*=o}const r=this.scales.x.domain(),n=this.scales.y.domain(),i=this.scales.x.range(),s=this.scales.y.range(),a=Ht,l=Math.max(0,Math.min(this.config.scalePadding||0,Math.min(e.width,e.height)/2-1)),c=s[1]>s[0];this.scales={x:a(this.config.xScaleType,r,i[0]>i[1]?[e.width-l,l]:[l,e.width-l]),y:a(this.config.yScaleType,n,c?[l,e.height-l]:[e.height-l,l])},this.lastLayout={width:e.width,height:e.height},this.spatialIndex.rebuild(this.config.chartType,this.scene),this.version++}buildSceneNodes(e,t){const{config:o,scales:r}=this;if(!r)return[];if(o.customLayout){const n={data:t,scales:r,dimensions:{width:e.width,height:e.height,margin:o.layoutMargin??{top:0,right:0,bottom:0,left:0},plot:{x:0,y:0,width:e.width,height:e.height}},theme:{semantic:o.themeSemantic??{},categorical:o.themeCategorical??Ee},resolveColor:(e,t)=>{const r=this.resolveGroupColor(e);if(r)return r;const n=this.resolveLineStyle(e,t);return n.stroke?n.stroke:"string"==typeof n.fill?n.fill:o.themeSemantic?.primary??"#4e79a7"},config:o.layoutConfig??{},selection:o.layoutSelection??null};let i;try{i=o.customLayout(n)}catch(e){const t=null!==this.lastCustomLayoutResult,r=Ft("xy",e,t,this.version);this.lastCustomLayoutFailure=r,this._customLayoutFailedThisBuild=!0,"production"!==process.env.NODE_ENV&&console.error("[semiotic] customLayout threw:",e);try{o.onLayoutError?.(r)}catch(e){"production"!==process.env.NODE_ENV&&console.error("[semiotic] onLayoutError threw:",e)}return t?this.scene:(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,[])}this.customLayoutOverlays=i.overlays??null,this.lastCustomLayoutResult=i,this.lastCustomLayoutFailure=null;const s=i.nodes??[];if(this._customRestyle=i.restyle,this.hasCustomRestyle=!!i.restyle,this.hasCustomRestyle){this._baseStyles=new WeakMap;for(const e of s)e.style&&this._baseStyles.set(e,e.style);this.applyCustomRestyle(s,o.layoutSelection??null)}return It({label:"customLayout",nodes:s,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned}),s}if(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,0===t.length)return[];const n={scales:r,config:o,getX:this.getX,getY:this.getY,getY0:this.getY0,getSize:this.getSize,getColor:this.getColor,getSymbol:this.getSymbol,getGroup:this.getGroup,getCategory:this.getCategory,getPointId:this.getPointId,ribbons:this.resolvedRibbons,getOpen:this.getOpen,getHigh:this.getHigh,getLow:this.getLow,getClose:this.getClose,resolveLineStyle:(e,t)=>this.resolveLineStyle(e,t),resolveAreaStyle:(e,t)=>this.resolveAreaStyle(e,t),resolveBoundsStyle:(e,t)=>this.resolveBoundsStyle(e,t),resolveColorMap:e=>this.resolveColorMap(e),resolveGroupColor:e=>this.resolveGroupColor(e),groupData:e=>this.groupData(e),barCategoryCache:this._barCategoryCache};switch(o.chartType){case"line":return function(e,t){const o=e.groupData(t),r=[],n=e.config.annotations?.filter(e=>"threshold"===e.type&&e.color).map(e=>({value:e.value,color:e.color,thresholdType:e.thresholdType||"greater"}));if(e.ribbons&&e.ribbons.length>0){const{perSeries:n,aggregate:i}=vt(e.ribbons);if(i.length>0&&r.push(...xt(e,t,i)),n.length>0)for(const t of o)r.push(...kt(e,t.data,t.key,n))}for(const t of o){const o=e.resolveLineStyle(t.key,t.data[0]),i=ut(t.data,e.scales,e.getX,e.getY,o,t.key);n&&n.length>0&&(i.colorThresholds=n),e.config.curve&&"linear"!==e.config.curve&&(i.curve=e.config.curve),e.config.lineGradient&&(i.strokeGradient=e.config.lineGradient),r.push(i)}return St(e,o,r),r}(n,t);case"area":return function(e,t){const o=e.groupData(t),r=[];if(e.ribbons&&e.ribbons.length>0){const{perSeries:n,aggregate:i}=vt(e.ribbons);if(i.length>0&&r.push(...xt(e,t,i)),n.length>0)for(const t of o)r.push(...kt(e,t.data,t.key,n))}const n=e.scales.y.domain()[0],i=e.getY0?t=>{const o=e.getY0(t);return null==o?n:o}:void 0;for(const t of o){const o=e.resolveAreaStyle(t.key,t.data[0]),s=dt(t.data,e.scales,e.getX,e.getY,n,o,t.key,i),a=Ct(e.config.gradientFill);a&&(s.fillGradient=a),e.config.curve&&"linear"!==e.config.curve&&(s.curve=e.config.curve),e.config.lineGradient&&(s.strokeGradient=e.config.lineGradient),r.push(s)}return St(e,o,r),r}(n,t);case"mixed":return function(e,t){const o=e.groupData(t),r=[],n=e.config.areaGroups||new Set;if(e.ribbons&&e.ribbons.length>0){const{perSeries:n,aggregate:i}=vt(e.ribbons);if(i.length>0&&r.push(...xt(e,t,i)),n.length>0)for(const t of o)r.push(...kt(e,t.data,t.key,n))}const i=e.scales.y.domain()[0],s=e.getY0?t=>{const o=e.getY0(t);return null==o?i:o}:void 0;for(const t of o)if(n.has(t.key)){const o=e.resolveAreaStyle(t.key,t.data[0]),n=dt(t.data,e.scales,e.getX,e.getY,i,o,t.key,s),a=Ct(e.config.gradientFill);a&&(n.fillGradient=a),e.config.curve&&"linear"!==e.config.curve&&(n.curve=e.config.curve),e.config.lineGradient&&(n.strokeGradient=e.config.lineGradient),r.push(n)}else{const o=e.resolveLineStyle(t.key,t.data[0]),n=ut(t.data,e.scales,e.getX,e.getY,o,t.key);e.config.curve&&"linear"!==e.config.curve&&(n.curve=e.config.curve),e.config.lineGradient&&(n.strokeGradient=e.config.lineGradient),r.push(n)}return St(e,o,r),r}(n,t);case"stackedarea":return function(e,t){const o=e.groupData(t),r=e.config.stackOrder??"key",n=()=>o.sort((e,t)=>t.key>e.key?-1:e.key>t.key?1:0);if("input"===r);else if("key"===r)n();else if("asc"===r||"desc"===r||"insideOut"===r){const t=new Map;for(const r of o){let o=0;for(const t of r.data){const r=e.getX(t),n=e.getY(t);Number.isFinite(r)&&Number.isFinite(n)&&(o+=n)}t.set(r.key,o)}const n=(e,t)=>t>e?-1:e>t?1:0;if("asc"===r)o.sort((e,o)=>{const r=(t.get(e.key)??0)-(t.get(o.key)??0);return 0!==r?r:n(e.key,o.key)});else if("desc"===r)o.sort((e,o)=>{const r=(t.get(o.key)??0)-(t.get(e.key)??0);return 0!==r?r:n(e.key,o.key)});else{const e=[...o].sort((e,o)=>{const r=(t.get(o.key)??0)-(t.get(e.key)??0);return 0!==r?r:n(e.key,o.key)}),r=[],i=[];let s=0,a=0;for(const o of e)a>s?(r.push(o),s+=t.get(o.key)??0):(i.push(o),a+=t.get(o.key)??0);o.length=0,o.push(...i.reverse(),...r)}}else n();const i=e.config.curve&&"linear"!==e.config.curve?e.config.curve:void 0,s=e.config.normalize?"zero":e.config.baseline??"zero",{nodes:a,stackedTops:l}=function(e,t,o,r,n,i,s,a="zero"){const l=new Set;for(const t of e)for(const e of t.data){const t=o(e);Number.isFinite(t)&&l.add(t)}const c=Array.from(l).sort((e,t)=>e-t),u=new Map;for(const t of e){const e=new Map;for(const n of t.data){const t=o(n),i=r(n);Number.isFinite(t)&&Number.isFinite(i)&&e.set(t,(e.get(t)||0)+i)}u.set(t.key,e)}let d;if(i){d=new Map;for(const t of c){let o=0;for(const r of e)o+=u.get(r.key)?.get(t)||0;d.set(t,o||1)}}const h=ht(c,e.map(e=>e.key),(e,t)=>u.get(e)?.get(t)||0,a),p="diverging"===a&&!i,f=[],g=new Map,m=new Map,y=new Map,b=new Map;for(const e of c)m.set(e,h.get(e)??0),y.set(e,0),b.set(e,0);for(const o of e){const e=u.get(o.key),r=new Map;let a=[],l=[];const h=()=>{if(a.length>=2){const e={type:"area",topPath:a,bottomPath:l,style:n(o.key,o.data[0]),datum:o.data,group:o.key};s&&(e.curve=s),f.push(e)}a=[],l=[]};for(const o of c){const n=e.has(o);let s,c,u=n?e.get(o):0;if(i&&n&&(u/=d.get(o)),!n||!Number.isFinite(u)||0===u){h();continue}p?u>0?(s=y.get(o),c=s+u,y.set(o,c)):(s=b.get(o),c=s+u,b.set(o,c)):(s=m.get(o),c=s+u,m.set(o,c));const f=t.x(o);l.push([f,t.y(s)]),a.push([f,t.y(c)]),r.set(o,c)}h(),g.set(o.key,r)}return{nodes:f,stackedTops:g}}(o,e.scales,e.getX,e.getY,(t,o)=>e.resolveAreaStyle(t,o),e.config.normalize,i,s),c=a;if(e.config.pointStyle){const t=new WeakMap;for(const r of o){const o=l.get(r.key);if(o)for(const n of r.data){const r=e.getX(n),i=e.getY(n);null==r||Number.isNaN(r)||null==i||Number.isNaN(i)||!o.has(r)||t.set(n,o.get(r))}}const r=o=>t.get(o)??e.getY(o);St(e,o,c,r)}return c}(n,t);case"scatter":case"bubble":return function(e,t){const o=[],r="bubble"===e.config.chartType?10:5,n=e.config.sizeRange||[3,15];let i=null;if(e.getSize&&!e.config.pointStyle){const o=t.map(t=>e.getSize(t)).filter(e=>null!=e&&!Number.isNaN(e));if(o.length>0){let e=1/0,t=-1/0;for(const r of o)e>r&&(e=r),r>t&&(t=r);i=o=>e===t?(n[0]+n[1])/2:n[0]+(o-e)/(t-e)*(n[1]-n[0])}}const s=e.getColor?e.resolveColorMap(t):null,a=e.config.themeSemantic?.primary||"#4e79a7",l=e.getSymbol,c=e.config.symbolMap,u=new Map;let d=0;const h=e=>{const t=c?.[e];if(t)return t;let o=u.get(e);return o||(o=Pt[d%Pt.length],d++,u.set(e,o)),o};for(const n of t){let t=e.config.pointStyle?e.config.pointStyle(n):{fill:a,opacity:.8},c=t.r||r;if(i&&e.getSize){const t=e.getSize(n);null==t||Number.isNaN(t)||(c=i(t))}if(s&&e.getColor&&!t.fill){const o=e.getColor(n);o&&s.has(o)&&(t={...t,fill:s.get(o)})}const u=e.getPointId?e.getPointId(n)+"":void 0;if(l){const r=h(l(n)+""),i=ft(n,e.scales,e.getX,e.getY,Math.PI*c*c,r,t,u);i&&o.push(i)}else{const r=pt(n,e.scales,e.getX,e.getY,c,t,u);r&&o.push(r)}}return o}(n,t);case"heatmap":return function(e,t,o){if(e.config.heatmapAggregation)return function(e,t,o){const r=Math.max(1,Math.floor(e.config.heatmapXBins??20)),n=Math.max(1,Math.floor(e.config.heatmapYBins??20)),i=e.config.heatmapAggregation??"count",s=ne(e.config.valueAccessor,"value");if(!e.scales||0===t.length)return[];const[a,l]=e.scales.x.domain(),[c,u]=e.scales.y.domain(),d=(l-a||1)/r,h=(u-c||1)/n,p=r*n;if(p>1e6)return[];const f=new Int32Array(p),g=new Float64Array(p);for(let o=0;t.length>o;o++){const i=t[o],l=e.getX(i),u=e.getY(i);if(!isFinite(l)||!isFinite(u))continue;const p=Math.min(Math.floor((l-a)/d),r-1),m=Math.min(Math.floor((u-c)/h),n-1);if(0>p||0>m)continue;const y=m*r+p;f[y]++;const b=s(i);g[y]+=isFinite(b)?b:0}let m=1/0,y=-1/0;for(let e=0;p>e;e++){if(0===f[e])continue;let t;switch(i){case"sum":t=g[e];break;case"mean":t=g[e]/f[e];break;default:t=f[e]}m>t&&(m=t),t>y&&(y=t)}if(!isFinite(m))return[];const b=y-m||1,v=o.width/r,x=o.height/n,k=e.config.showValues,w=e.config.heatmapValueFormat,S=[];for(let e=0;n>e;e++){const t=e*r;for(let o=0;r>o;o++){const r=t+o;if(0===f[r])continue;let s;switch(i){case"sum":s=g[r];break;case"mean":s=g[r]/f[r];break;default:s=f[r]}const l=(s-m)/b;S.push(mt(o*v,(n-1-e)*x,v,x,`rgb(${220-(180*l+.5)|0},${220-(100*l+.5)|0},${255-(50*l+.5)|0})`,{xi:o,yi:e,value:s,count:f[r],sum:g[r],xCenter:a+(o+.5)*d,yCenter:c+(e+.5)*h,agg:i},k?{value:s,showValues:!0,valueFormat:w}:void 0))}}return S}(e,t,o);if(0===t.length)return[];const r=ne(e.config.valueAccessor,"value"),n=ie(e.config.xAccessor,"x"),i=ie(e.config.yAccessor,"y"),s=new Map,a=new Map,l=Array(t.length),c=Array(t.length);for(let e=0;t.length>e;e++){const o=t[e],r=n(o),u=i(o);l[e]=r,c[e]=u,s.has(r)||s.set(r,s.size),a.has(u)||a.set(u,a.size)}const u=s.size,d=a.size;if(0===u||0===d)return[];const h=Array.from(s.keys()),p=Array.from(a.keys()),f=h.every(e=>"number"==typeof e&&!isNaN(e)),g=p.every(e=>"number"==typeof e&&!isNaN(e));if(f){h.sort((e,t)=>e-t),s.clear();for(let e=0;h.length>e;e++)s.set(h[e],e)}if(g){p.sort((e,t)=>e-t),a.clear();for(let e=0;p.length>e;e++)a.set(p[e],e)}const m=new Float64Array(t.length),y=new Float64Array(t.length),b=Array(t.length),v=new Map;let x=0;for(let e=0;t.length>e;e++){const o=t[e],n=s.get(l[e]),i=a.get(c[e]);if(void 0===n||void 0===i)continue;const d=r(o),h=i*u+n,p=v.get(h);let f;void 0!==p?f=p:(f=x++,v.set(h,f)),m[f]=h,y[f]=d,b[f]=o}let k=1/0,w=-1/0;for(let e=0;x>e;e++){const t=y[e];isFinite(t)&&(k>t&&(k=t),t>w&&(w=t))}if(!isFinite(k)||!isFinite(w))return[];const S=function(e){const t=e in Pe?e:"blues";let o=Rt.get(t);if(o)return o;o=Array(256);const r=_e(t);for(let e=0;256>e;e++)o[e]=r(e/255);return Rt.set(t,o),o}("string"==typeof e.config.colorScheme?e.config.colorScheme:e.config.themeSequential||"blues"),A=255/(w-k||1),C=o.width/u,M=o.height/d,j=e.config.showValues,P=e.config.heatmapValueFormat,_=[];for(let e=0;x>e;e++){const t=y[e];if(!isFinite(t))continue;const o=m[e],r=o%u;_.push(mt(r*C,(d-1-(o-r)/u)*M,C,M,S[Math.min((t-k)*A+.5|0,255)],b[e],j?{value:t,showValues:!0,valueFormat:P}:void 0))}return _}(n,t,e);case"bar":{const e=function(e,t){if(!e.config.binSize)return{nodes:[],binBoundaries:[]};const o=Tt(t,e.getX,e.getY,e.config.binSize,e.getCategory);if(0===o.size)return{nodes:[],binBoundaries:[]};let r=null;if(e.getCategory){const t=new Set;for(const e of o.values())for(const o of e.categories.keys())t.add(o);const n=e.config.barColors?Object.keys(e.config.barColors):[],i=new Set(n),s=Array.from(t).filter(e=>!i.has(e)).sort(),a=n.filter(e=>t.has(e)),l=a.join("\0")+""+s.join("\0");e.barCategoryCache&&e.barCategoryCache.key===l?r=e.barCategoryCache.order:(r=[...a,...s],e.barCategoryCache={key:l,order:r})}const n=[],i=e.scales,[s,a]=i.x.domain(),l=e.config.barStyle,c=e.config.themeSemantic?.primary,u=l?.gap,d="number"!=typeof u||0>u?1:u,h={};l?.stroke&&(h.stroke=l.stroke),"number"==typeof l?.strokeWidth&&(h.strokeWidth=l.strokeWidth),"number"==typeof l?.opacity&&(h.opacity=l.opacity);for(const t of o.values()){const o=Math.max(t.start,s),u=Math.min(t.end,a);if(o>=u)continue;const p=i.x(o),f=i.x(u),g=Math.abs(f-p),m=g>d+1?d:0,y=Math.min(p,f)+m/2,b=Math.max(g-m,1);if(b>0)if(r&&t.categories.size>0){let o=0;for(const s of r){const r=t.categories.get(s)||0;if(0===r)continue;const a=i.y(o),u=i.y(o+r);n.push(gt(y,Math.min(a,u),b,Math.abs(a-u),{fill:e.config.barColors?.[s]||l?.fill||c||"#4e79a7",...h},{binStart:t.start,binEnd:t.end,total:t.total,category:s,categoryValue:r},s)),o+=r}}else{const e=i.y(0),o=i.y(t.total);n.push(gt(y,Math.min(e,o),b,Math.abs(e-o),{fill:l?.fill||c||"#007bff",...h},{binStart:t.start,binEnd:t.end,total:t.total}))}}const p=new Set;for(const e of o.values())p.add(e.start),p.add(e.end);return{nodes:n,binBoundaries:Array.from(p).sort((e,t)=>e-t)}}(n,t);return this._barCategoryCache=n.barCategoryCache??null,this._binBoundaries=e.binBoundaries,e.nodes}case"swarm":return function(e,t){const o=[],r=e.config.swarmStyle||{},n=r.radius??3,i=r.fill??e.config.themeSemantic?.primary??"#007bff",s=r.opacity??.7,a=r.stroke,l=r.strokeWidth;for(const r of t){const t=e.getX(r),c=e.getY(r);if(null==c||Number.isNaN(c))continue;const u=e.scales.x(t),d=e.scales.y(c);let h=i;if(e.getCategory){const t=e.getCategory(r);h=e.config.barColors?.[t]||h}const{r:p,...f}=e.config.pointStyle?.(r)??{},g={type:"point",x:u,y:d,r:p??n,style:{fill:h,opacity:s,stroke:a,strokeWidth:l,...f},datum:r};e.getPointId&&(g.pointId=e.getPointId(r)+""),o.push(g)}return o}(n,t);case"waterfall":return function(e,t,o){const r=[],n=e.scales,i=e.config.waterfallStyle,s=t.filter(t=>{const o=e.getY(t),r=e.getX(t);return null!=o&&!Number.isNaN(o)&&null!=r&&isFinite(r)});if(0===s.length)return r;const a=i?.positiveColor??e.config.themeSemantic?.success??"#28a745",l=i?.negativeColor??e.config.themeSemantic?.danger??"#dc3545",c=i?.gap??1,u=i?.stroke,d=i?.strokeWidth,h=i?.opacity;let p=0;for(let t=0;s.length>t;t++){const f=s[t],g=e.getX(f),m=e.getY(f),y=p+m;let b;b=s.length-1>t?e.getX(s[t+1])-g:t>0?g-e.getX(s[t-1]):0;const v=n.x(g),x=0!==b?n.x(g+b):v+o.width/10,k=Math.min(v,x)+c/2,w=Math.max(v,x)-c/2-k;if(0>=w){p=y;continue}const S=n.y(p),A=n.y(y),C=Math.min(S,A),M=Math.abs(S-A),j={fill:0>m?l:a,stroke:u,strokeWidth:d};null!=h&&(j.opacity=h),r.push(gt(k,C,w,M,j,{...f,baseline:p,cumEnd:y,delta:m,_connectorStroke:i?.connectorStroke,_connectorWidth:i?.connectorWidth})),p=y}return r}(n,t,e);case"candlestick":return function(e,t){if(!e.getHigh||!e.getLow||!e.scales)return[];const o=e.config.candlestickRangeMode??!1;if(!(o||e.getOpen&&e.getClose))return[];const r=[],n=e.config.candlestickStyle||{},i=n.rangeColor||"#6366f1",s=o?i:n.upColor||"#28a745",a=o?i:n.downColor||"#dc3545",l=o?i:n.wickColor||"#333",c=n.wickWidth||(o?2:1),u=t.map(t=>e.getX(t)).filter(e=>null!=e&&!Number.isNaN(e)).sort((e,t)=>e-t);let d=n.bodyWidth??0;if(null==n.bodyWidth)if(u.length>1){let t=1/0;for(let o=1;u.length>o;o++){const r=Math.abs(e.scales.x(u[o])-e.scales.x(u[o-1]));r>0&&t>r&&(t=r)}d=t!==1/0?Math.max(2,Math.min(.6*t,20)):6}else d=6;for(const n of t){const t=e.getX(n);if(null==t||Number.isNaN(t))continue;const i=e.getHigh(n),u=e.getLow(n);if(null==i||Number.isNaN(i)||null==u||Number.isNaN(u))continue;const h=o?i:e.getOpen(n),p=o?u:e.getClose(n);if(!o&&[h,p].some(e=>null==e||Number.isNaN(e)))continue;const f=p>=h,g={type:"candlestick",x:e.scales.x(t),openY:e.scales.y(h),closeY:e.scales.y(p),highY:e.scales.y(i),lowY:e.scales.y(u),bodyWidth:d,upColor:s,downColor:a,wickColor:l,wickWidth:c,isUp:f,datum:n};o&&(g.isRange=!0),r.push(g)}return r}(n,t);default:return[]}}resolveBoundsStyle(e,t){return function(e,t,o,r){const n=e.boundsStyle;return"function"==typeof n?n(o||{},t):n&&"object"==typeof n?n:{fill:r(t,o).stroke||e.themeSemantic?.primary||"#4e79a7",fillOpacity:.2,stroke:"none"}}(this.config,e,t,(e,t)=>this.resolveLineStyle(e,t))}computeDecayOpacity(e,t){const o=this.config.decay;return o&&t>1?nt(o,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._ingestVersion)return this._datumIndexCache.map;const t=it(e);return this._datumIndexCache={version:this._ingestVersion,map:t},t}applyDecay(e,t){this.config.decay&&function(e,t,o,r=it(o)){const n=o.length;if(n>1)for(const o of t){if("line"===o.type){const t=Array.isArray(o.datum)?o.datum:[];if(2>t.length)continue;const i=Array(t.length);let s=!1;for(let o=0;t.length>o;o++){const a=r.get(t[o]);null!=a?(i[o]=nt(e,a,n),1>i[o]&&(s=!0)):i[o]=1}s&&(o._decayOpacities=i);continue}if("area"===o.type){const t=Array.isArray(o.datum)?o.datum:[],i=o.topPath?o.topPath.length:t.length;if(2>i)continue;if(t.length===i){const s=Array(i);let a=!1;for(let o=0;t.length>o;o++){const i=r.get(t[o]);null!=i?(s[o]=nt(e,i,n),1>s[o]&&(a=!0)):s[o]=1}a&&(o._decayOpacities=s)}else{let s=1;for(const o of t){const t=r.get(o);if(null!=t){const o=nt(e,t,n);s>o&&(s=o)}}if(1>s){const e=Array(i);e.fill(s),o._decayOpacities=e}}continue}const t=r.get(o.datum);if(null==t)continue;const i=nt(e,t,n);"heatcell"===o.type?o.style={opacity:i}:"candlestick"===o.type?o._decayOpacity=i:o.style={...o.style,opacity:(o.style?.opacity??1)*i}}}(this.config.decay,e,t,this.getDatumIndexMap(t))}refreshPulse(e){return!0!==this.lastCustomLayoutFailure?.preservedLastGoodScene&&this.applyPulse(this.scene,this.getBufferArray(),e)}hasActivePulsesAt(e){return!!this.config.pulse&<(this.config.pulse,this.timestampBuffer,e)}get hasActivePulses(){return this.hasActivePulsesAt(Ue())}get transitionContext(){return{runtimeMode:this.config.runtimeMode,getX:this.getX,getY:this.getY,getCategory:this.getCategory}}snapshotPositions(){!function(e,t,o,r){o.clear(),r.clear();for(let n=0;t.length>n;n++){const i=t[n],s=ct(e,i,n);s&&("point"===i.type?o.set(s,{x:i.x,y:i.y,r:i.r,opacity:i.style.opacity}):"glyph"===i.type?o.set(s,{x:i.x,y:i.y,r:i.size,opacity:i.style.opacity,glyph:i.glyph}):"rect"===i.type?o.set(s,{x:i.x,y:i.y,w:i.w,h:i.h,opacity:i.style.opacity}):"heatcell"===i.type?o.set(s,{x:i.x,y:i.y,w:i.w,h:i.h,opacity:i.style?.opacity}):"candlestick"===i.type?o.set(s,{x:i.x,y:i.openY,w:i.bodyWidth,openY:i.openY,closeY:i.closeY,highY:i.highY,lowY:i.lowY,opacity:i.style?.opacity}):"line"===i.type?r.set(s,{path:i.path.map(e=>[e[0],e[1]]),opacity:i.style?.opacity}):"area"===i.type&&r.set(s,{topPath:i.topPath.map(e=>[e[0],e[1]]),bottomPath:i.bottomPath.map(e=>[e[0],e[1]]),opacity:i.style?.opacity}))}}(this.transitionContext,this.scene,this.prevPositionMap,this.prevPathMap)}synthesizeIntroPositions(){this.prevPositionMap.clear(),this.prevPathMap.clear();const e=this.scales?.y(0)??0;for(let t=0;this.scene.length>t;t++){const o=this.scene[t],r=ct(this.transitionContext,o,t);r&&("point"===o.type?this.prevPositionMap.set(r,{x:o.x,y:o.y,r:0,opacity:0}):"rect"===o.type?this.prevPositionMap.set(r,{x:o.x,y:e,w:o.w,h:0,opacity:o.style.opacity??1}):"heatcell"===o.type?this.prevPositionMap.set(r,{x:o.x,y:o.y,w:o.w,h:o.h,opacity:0}):"line"===o.type?(o._introClipFraction=0,this.prevPathMap.set(r,{path:o.path.map(e=>[e[0],e[1]]),opacity:o.style.opacity})):"area"===o.type&&(o._introClipFraction=0,this.prevPathMap.set(r,{topPath:o.topPath.map(e=>[e[0],e[1]]),bottomPath:o.bottomPath.map(e=>[e[0],e[1]]),opacity:o.style.opacity})))}}startTransition(){if(!this.config.transition)return;const e=function(e,t,o,r,n){if(0===r.size&&0===n.size)return o;const i=t.duration??300;if(o.exitNodes.length>0){const e=new Set(o.exitNodes);o.scene=o.scene.filter(t=>!e.has(t)),o.exitNodes=[]}let s=!1;const a=new Set,l=new Set;for(let t=0;o.scene.length>t;t++){const i=o.scene[t],c=ct(e,i,t);if(!c)continue;if(i._transitionKey=c,"line"===i.type||"area"===i.type){const e=n.get(c);if(e){if(l.add(c),"line"===i.type&&e.path&&e.path.length===i.path.length){i._targetPath=i.path.map(e=>[e[0],e[1]]),i._prevPath=e.path;for(let t=0;i.path.length>t;t++)i.path[t]=[e.path[t][0],e.path[t][1]];s=!0}else if("area"===i.type&&e.topPath&&e.bottomPath&&e.topPath.length===i.topPath.length&&e.bottomPath.length===i.bottomPath.length){i._targetTopPath=i.topPath.map(e=>[e[0],e[1]]),i._targetBottomPath=i.bottomPath.map(e=>[e[0],e[1]]),i._prevTopPath=e.topPath,i._prevBottomPath=e.bottomPath;for(let t=0;i.topPath.length>t;t++)i.topPath[t]=[e.topPath[t][0],e.topPath[t][1]];for(let t=0;i.bottomPath.length>t;t++)i.bottomPath[t]=[e.bottomPath[t][0],e.bottomPath[t][1]];s=!0}i._targetOpacity=i.style.opacity??1,i._startOpacity=e.opacity??i.style.opacity??1}else i._targetOpacity=i.style.opacity??1,i._startOpacity=0,i.style={...i.style,opacity:0},s=!0;continue}const u=r.get(c);if("point"===i.type)if(u){a.add(c);const e={x:i.x,y:i.y,r:i.r};i._targetOpacity=i.style.opacity??1,u.x===e.x&&u.y===e.y&&u.r===e.r||(i._targetX=e.x,i._targetY=e.y,i._targetR=e.r,i.x=u.x,i.y=u.y,i.r=u.r??i.r,s=!0)}else i._targetOpacity=i.style.opacity??1,i.style={...i.style,opacity:0},s=!0;else if("glyph"===i.type)if(u){a.add(c);const e={x:i.x,y:i.y,size:i.size};i._targetOpacity=i.style.opacity??1,u.x===e.x&&u.y===e.y&&u.r===e.size||(i._targetX=e.x,i._targetY=e.y,i._targetR=e.size,i.x=u.x,i.y=u.y,i.size=u.r??i.size,s=!0)}else i._targetOpacity=i.style.opacity??1,i.style={...i.style,opacity:0},s=!0;else if("rect"===i.type)if(u){a.add(c);const e={x:i.x,y:i.y,w:i.w,h:i.h};i._targetOpacity=i.style.opacity??1,u.x===e.x&&u.y===e.y&&u.w===e.w&&u.h===e.h||(i._targetX=e.x,i._targetY=e.y,i._targetW=e.w,i._targetH=e.h,i.x=u.x,i.y=u.y,i.w=u.w??i.w,i.h=u.h??i.h,s=!0)}else i._targetOpacity=i.style.opacity??1,i.style={...i.style,opacity:0},s=!0;else if("heatcell"===i.type)if(u){a.add(c);const e={x:i.x,y:i.y,w:i.w,h:i.h};i._targetOpacity=i.style?.opacity??1,u.x===e.x&&u.y===e.y&&u.w===e.w&&u.h===e.h||(i._targetX=e.x,i._targetY=e.y,i._targetW=e.w,i._targetH=e.h,i.x=u.x,i.y=u.y,i.w=u.w??i.w,i.h=u.h??i.h,s=!0)}else i._targetOpacity=i.style?.opacity??1,i.style={...i.style||{},opacity:0},s=!0;else if("candlestick"===i.type)if(u&&null!=u.openY){a.add(c);const e={x:i.x,openY:i.openY,closeY:i.closeY,highY:i.highY,lowY:i.lowY};i._targetOpacity=i.style?.opacity??1,(u.x!==e.x||u.openY!==e.openY||u.closeY!==e.closeY||u.highY!==e.highY||u.lowY!==e.lowY)&&(i._targetX=e.x,i._targetOpenY=e.openY,i._targetCloseY=e.closeY,i._targetHighY=e.highY,i._targetLowY=e.lowY,i.x=u.x,i.openY=u.openY,i.closeY=u.closeY??i.closeY,i.highY=u.highY??i.highY,i.lowY=u.lowY??i.lowY,s=!0)}else i._targetOpacity=i.style?.opacity??1,i.style={...i.style||{},opacity:0},s=!0}for(const[e,t]of n)if(!l.has(e))if(e.startsWith("l:")&&t.path){const r={type:"line",path:t.path.map(e=>[e[0],e[1]]),group:e.slice(2),style:{stroke:"#999",strokeWidth:1,opacity:t.opacity??1},_targetOpacity:0,_transitionKey:e,datum:null};o.exitNodes.push(r),s=!0}else if(e.startsWith("a:")&&t.topPath&&t.bottomPath){const r={type:"area",topPath:t.topPath.map(e=>[e[0],e[1]]),bottomPath:t.bottomPath.map(e=>[e[0],e[1]]),group:e.slice(2),style:{fill:"#999",opacity:t.opacity??1},_targetOpacity:0,_transitionKey:e,datum:null};o.exitNodes.push(r),s=!0}for(const[e,t]of r)if(!a.has(e)){if(e.startsWith("p:"))o.exitNodes.push({type:"point",x:t.x,y:t.y,r:t.r??3,style:{opacity:t.opacity??1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("g:")&&t.glyph)o.exitNodes.push({type:"glyph",x:t.x,y:t.y,size:t.r??12,glyph:t.glyph,color:"#999",accent:"#999",style:{opacity:t.opacity??1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("r:"))o.exitNodes.push({type:"rect",x:t.x,y:t.y,w:t.w??0,h:t.h??0,style:{opacity:t.opacity??1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("h:"))o.exitNodes.push({type:"heatcell",x:t.x,y:t.y,w:t.w??0,h:t.h??0,fill:"#999",datum:null,style:{opacity:t.opacity??1},_targetOpacity:0,_transitionKey:e});else if(e.startsWith("c:")){const r=t.openY??t.y;o.exitNodes.push({type:"candlestick",x:t.x,openY:r,closeY:t.closeY??r,highY:t.highY??r,lowY:t.lowY??r,bodyWidth:t.w??6,upColor:"#999",downColor:"#999",wickColor:"#999",wickWidth:1,isUp:!0,datum:null,style:{opacity:t.opacity??1},_targetOpacity:0,_transitionKey:e})}s=!0}return o.exitNodes.length>0&&(o.scene=[...o.scene,...o.exitNodes]),s&&(o.activeTransition={startTime:Ue(),duration:i}),o}(this.transitionContext,this.config.transition,{scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},this.prevPositionMap,this.prevPathMap);this.scene=e.scene,this.exitNodes=e.exitNodes,this.activeTransition=e.activeTransition}advanceTransition(e){if(!this.activeTransition||!this.config.transition)return!1;const t={scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},o=function(e,t,o,r){if(!o.activeTransition)return!1;const n=Ve(e,o.activeTransition),i=Ge(n,"linear"===t.easing?"linear":"ease-out-cubic");for(const e of o.scene){const t=e._transitionKey;if("point"===e.type){if(void 0!==e._targetOpacity){const o=t?r.get(t):void 0;e.style.opacity=Xe(o?o.opacity??1:0,e._targetOpacity,i)}if(void 0===e._targetX)continue;if(!t)continue;const o=r.get(t);if(!o)continue;e.x=Xe(o.x,e._targetX,i),e.y=Xe(o.y,e._targetY,i),void 0!==e._targetR&&void 0!==o.r&&(e.r=Xe(o.r,e._targetR,i))}else if("glyph"===e.type){if(void 0!==e._targetOpacity){const o=t?r.get(t):void 0;e.style.opacity=Xe(o?o.opacity??1:0,e._targetOpacity,i)}if(void 0===e._targetX)continue;if(!t)continue;const o=r.get(t);if(!o)continue;e.x=Xe(o.x,e._targetX,i),e.y=Xe(o.y,e._targetY,i),void 0!==e._targetR&&void 0!==o.r&&(e.size=Xe(o.r,e._targetR,i))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const o=t?r.get(t):void 0;e.style.opacity=Xe(o?o.opacity??1:0,e._targetOpacity,i)}if(void 0===e._targetX)continue;if(!t)continue;const o=r.get(t);if(!o)continue;e.x=Xe(o.x,e._targetX,i),e.y=Xe(o.y,e._targetY,i),void 0!==o.w&&(e.w=Xe(o.w,e._targetW,i)),void 0!==o.h&&(e.h=Xe(o.h,e._targetH,i))}else if("heatcell"===e.type){if(void 0!==e._targetOpacity){const o=t?r.get(t):void 0;e.style={...e.style||{},opacity:Xe(o?o.opacity??1:0,e._targetOpacity,i)}}if(void 0===e._targetX)continue;if(!t)continue;const o=r.get(t);if(!o)continue;e.x=Xe(o.x,e._targetX,i),e.y=Xe(o.y,e._targetY,i),void 0!==o.w&&(e.w=Xe(o.w,e._targetW,i)),void 0!==o.h&&(e.h=Xe(o.h,e._targetH,i))}else if("candlestick"===e.type){if(void 0!==e._targetOpacity){const o=t?r.get(t):void 0;e.style={...e.style||{},opacity:Xe(o?o.opacity??1:0,e._targetOpacity,i)}}if(void 0===e._targetX)continue;if(!t)continue;const o=r.get(t);if(!o)continue;e.x=Xe(o.x,e._targetX,i),void 0!==o.openY&&(e.openY=Xe(o.openY,e._targetOpenY,i)),void 0!==o.closeY&&(e.closeY=Xe(o.closeY,e._targetCloseY,i)),void 0!==o.highY&&(e.highY=Xe(o.highY,e._targetHighY,i)),void 0!==o.lowY&&(e.lowY=Xe(o.lowY,e._targetLowY,i))}else if("line"===e.type){void 0!==e._targetOpacity&&(e.style={...e.style,opacity:Xe(e._startOpacity??0,e._targetOpacity,i)}),void 0!==e._introClipFraction&&(e._introClipFraction=i);const t=e._prevPath,o=e._targetPath;if(t&&o&&t.length===e.path.length)for(let r=0;e.path.length>r;r++)e.path[r][0]=Xe(t[r][0],o[r][0],i),e.path[r][1]=Xe(t[r][1],o[r][1],i)}else if("area"===e.type){void 0!==e._targetOpacity&&(e.style={...e.style,opacity:Xe(e._startOpacity??0,e._targetOpacity,i)}),void 0!==e._introClipFraction&&(e._introClipFraction=i);const t=e._prevTopPath,o=e._prevBottomPath,r=e._targetTopPath,n=e._targetBottomPath;if(t&&r&&t.length===e.topPath.length)for(let o=0;e.topPath.length>o;o++)e.topPath[o][0]=Xe(t[o][0],r[o][0],i),e.topPath[o][1]=Xe(t[o][1],r[o][1],i);if(o&&n&&o.length===e.bottomPath.length)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t][0]=Xe(o[t][0],n[t][0],i),e.bottomPath[t][1]=Xe(o[t][1],n[t][1],i)}}if(n>=1){for(const e of o.scene){if(void 0!==e._targetOpacity){const t=e._targetOpacity;e.style="line"===e.type||"area"===e.type?{...e.style,opacity:0===t?0:t}:{...e.style||{},opacity:0===t?0:t},e._targetOpacity=void 0}if("point"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("glyph"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,void 0!==e._targetR&&(e.size=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else if("heatcell"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else if("candlestick"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,void 0!==e._targetOpenY&&(e.openY=e._targetOpenY),void 0!==e._targetCloseY&&(e.closeY=e._targetCloseY),void 0!==e._targetHighY&&(e.highY=e._targetHighY),void 0!==e._targetLowY&&(e.lowY=e._targetLowY),e._targetX=void 0,e._targetOpenY=void 0,e._targetCloseY=void 0,e._targetHighY=void 0,e._targetLowY=void 0}else if("line"===e.type){const t=e._targetPath;if(t)for(let o=0;e.path.length>o;o++)e.path[o]=t[o];e._prevPath=void 0,e._targetPath=void 0,e._introClipFraction=void 0}else if("area"===e.type){const t=e._targetTopPath,o=e._targetBottomPath;if(t)for(let o=0;e.topPath.length>o;o++)e.topPath[o]=t[o];if(o)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t]=o[t];e._prevTopPath=void 0,e._prevBottomPath=void 0,e._targetTopPath=void 0,e._targetBottomPath=void 0,e._introClipFraction=void 0}}if(o.exitNodes.length>0){const e=new Set(o.exitNodes);o.scene=o.scene.filter(t=>!e.has(t)),o.exitNodes=[]}return o.activeTransition=null,!1}return!0}(e,this.config.transition,t,this.prevPositionMap);return this.scene=t.scene,this.exitNodes=t.exitNodes,this.activeTransition=t.activeTransition,o}cancelIntroAnimation(){this.prevPositionMap.clear(),this.prevPathMap.clear(),this.activeTransition=null;for(const e of this.scene)"line"!==e.type&&"area"!==e.type||(e._introClipFraction=void 0)}groupData(e){const{result:t,cache:o}=function(e,t,o,r){if(r&&r.version===o&&r.group===t&&r.data===e)return{result:r.result,cache:r};let n;if(t){const o=new Map;for(const r of e){const e=t(r);o.has(e)||o.set(e,[]),o.get(e).push(r)}n=Array.from(o.entries()).map(([e,t])=>({key:e,data:t}))}else n=[{key:"_default",data:e}];return{result:n,cache:{version:o,group:t,data:e,result:n}}}(e,this.getGroup,this._ingestVersion,this._groupDataCache);return this._groupDataCache=o,t}resolveColorMap(e){const{map:t,cache:o}=function(e,t,o,r,n){if(n&&n.version===r)return{map:n.map,cache:n};const i=new Set;if(t)for(const o of e){const e=t(o);e&&i.add(e)}const s=Array.from(i).sort(),a=s.join("\0");if(n&&n.key===a){const e={...n,version:r};return{map:e.map,cache:e}}const l=Array.isArray(o.colorScheme)?o.colorScheme:o.themeCategorical||Ee,c=new Map;for(let e=0;s.length>e;e++)c.set(s[e],l[e%l.length]);return{map:c,cache:{key:a,map:c,version:r}}}(e,this.getColor,this.config,this._ingestVersion,this._colorMapCache);return this._colorMapCache=o,t}resolveLineStyle(e,t){return function(e,t,o,r){const n=e.lineStyle;if("function"==typeof n){const e=n(o||{},t);if(e&&!e.stroke&&t){const o=r(t);if(o)return{...e,stroke:o}}return e}const i=e.themeSemantic?.primary;return n&&"object"==typeof n?{stroke:n.stroke||i||"#007bff",strokeWidth:n.strokeWidth||2,strokeDasharray:n.strokeDasharray,fill:n.fill,fillOpacity:n.fillOpacity,opacity:n.opacity}:{stroke:r(t)||i||"#007bff",strokeWidth:2}}(this.config,e,t,e=>this.resolveGroupColor(e))}resolveAreaStyle(e,t){return function(e,t,o,r){if(e.areaStyle){const n=e.areaStyle(o||{});if(n&&!n.fill&&t){const e=r(t);if(e)return{...n,fill:e,stroke:n.stroke||e}}return n}const n=e.lineStyle;if("function"==typeof n){const e=n(o||{},t);if(e&&!e.fill&&t){const o=r(t);if(o)return{...e,fill:o,stroke:e.stroke||o}}return e}const i=e.themeSemantic?.primary;if(n&&"object"==typeof n)return{fill:n.fill||n.stroke||i||"#4e79a7",fillOpacity:n.fillOpacity??.7,stroke:n.stroke||i||"#4e79a7",strokeWidth:n.strokeWidth||2};const s=r(t)||i||"#4e79a7";return{fill:s,fillOpacity:.7,stroke:s,strokeWidth:2}}(this.config,e,t,e=>this.resolveGroupColor(e))}resolveGroupColor(t){const{color:o,groupColorCounter:r}=function(e){const{group:t,colorMapCache:o,groupColorMap:r,groupColorMapCap:n,config:i}=e;let{groupColorCounter:s}=e;if(o){const e=o.map.get(t);if(e)return{color:e,groupColorCounter:s}}const a=r.get(t);if(a)return{color:a,groupColorCounter:s};const l=(Array.isArray(i.colorScheme)&&i.colorScheme.length>0?i.colorScheme:null)||(Array.isArray(i.themeCategorical)&&i.themeCategorical.length>0?i.themeCategorical:null)||Ee;if(0===l.length)return{color:null,groupColorCounter:s};const c=l[s%l.length];if(s++,r.set(t,c),r.size>n){const e=r.keys().next().value;void 0!==e&&r.delete(e)}return{color:c,groupColorCounter:s}}({group:t,colorMapCache:this._colorMapCache,groupColorMap:this._groupColorMap,groupColorCounter:this._groupColorCounter,groupColorMapCap:e.GROUP_COLOR_MAP_CAP,config:this.config});return this._groupColorCounter=r,o}getBufferArray(){return!this._bufferDirty&&this._bufferArrayCache||(this._bufferArrayCache=this.buffer.toArray(),this._bufferDirty=!1),this._bufferArrayCache}getData(){return this.getBufferArray()}getLastUpdateResult(){return this.updateResults.last}remove(e){if(!this.getPointId)throw Error("remove() requires pointIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=ue(e),o=this.getPointId,r=e=>t.has(o(e));Yt(this.buffer,this.timestampBuffer,r);const n=this.buffer.remove(r);if(0===n.length)return this.updateResults.recordNoop("remove"),n;for(const e of n)this.xExtent.evict(this.getX(e)),this.evictDatumYExtent(e);return this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,this.lastIngestTime=Ue(),this.updateResults.recordData("remove",n.length),n}update(e,t){if(!this.getPointId)throw Error("update() requires pointIdAccessor to be configured");const o=ue(e),r=this.getPointId,n=new Set;this.buffer.forEach((e,t)=>{o.has(r(e))&&n.add(t)});const i=this.buffer.update(e=>o.has(r(e)),t);if(0===i.length)return this.updateResults.recordNoop("update"),i;for(const e of i)this.xExtent.evict(this.getX(e)),this.evictDatumYExtent(e);return this.buffer.forEach((e,t)=>{n.has(t)&&(this.xExtent.push(this.getX(e)),this.pushDatumYExtent(e))}),this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,this.lastIngestTime=Ue(),this.updateResults.recordData("update",i.length),i}getBinBoundaries(){return this._binBoundaries}getExtents(){return this.xExtent.min===1/0?null:{x:this.xExtent.extent,y:this.yExtent.extent}}clear(){this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.prevPathMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this._lastBoundedInsertsRef=null,this.needsFullRebuild=!0,this._bufferDirty=!0,this._bufferArrayCache=null,this._datumIndexCache=null,this.lastLayout=null,this.scales=null,this.scene=[],this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.spatialIndex.clear(),this._colorMapCache=null,this._groupDataCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this.version++,this.updateResults.recordData("clear")}get size(){return this.buffer.size}getBuffer(){return this.buffer}getXAccessor(){return this.getX}getYAccessor(){return this.getY}getCategoryAccessor(){return this.getCategory}setLayoutSelection(e){this.config.layoutSelection=e}applyCustomRestyle(e,t){const o=this._customRestyle;if(o)for(const r of e){const e=this._baseStyles.get(r)??r.style??{},n=o(r,t);r.style=n?{...e,...n}:e}}consumeStylePaintPending(){const e=this._stylePaintPending;return this._stylePaintPending=!1,e}restyleScene(e){this._customRestyle?(this.applyCustomRestyle(this.scene,e),this._stylePaintPending=!0,this.updateResults.recordRestyle(!0)):this.updateResults.recordRestyle(!1)}updateConfig(e){const t={...this.config},o=Object.keys(e).filter(o=>e[o]!==t[o]);"production"!==process.env.NODE_ENV&&!this.windowSizeWarned&&"windowSize"in e&&e.windowSize!==t.windowSize&&(this.windowSizeWarned=!0,console.warn(`[Semiotic] windowSize changed after mount (${t.windowSize} → ${e.windowSize}) but it is a mount-only setting — the ring buffer keeps its original capacity. Remount the chart (e.g. via a React key) to apply a new windowSize.`)),("colorScheme"in e||"themeCategorical"in e||"colorAccessor"in e)&&(this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0),("barColors"in e||"colorScheme"in e)&&(this._barCategoryCache=null),("normalize"in e||"extentPadding"in e||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e||"boundsAccessor"in e||"band"in e||"y0Accessor"in e||"openAccessor"in e||"highAccessor"in e||"lowAccessor"in e||"closeAccessor"in e||"groupAccessor"in e||"categoryAccessor"in e||"chartType"in e||"runtimeMode"in e)&&(this._stackExtentCache=null);let r=!1,n=!1;Object.assign(this.config,e),"pulse"in e&&this.syncPulseTimestampBuffer();const i="chartType"in e&&e.chartType!==t.chartType||"runtimeMode"in e&&e.runtimeMode!==t.runtimeMode;if(i||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e){const e=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode,o=e&&this.config.valueAccessor||this.config.yAccessor,s=e&&t.valueAccessor||t.yAccessor,a=i||!re(e&&this.config.timeAccessor||this.config.xAccessor,e&&t.timeAccessor||t.xAccessor),l=i||!re(o,s);(a||l)&&(e?(this.getX=ne(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=ne(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=ne(this.config.xAccessor,"x"),this.getY=ne(this.config.yAccessor,"y")),l&&this.resolvedRibbons.some(e=>"bounds"===e.kind)&&(this.resolvedRibbons=Dt(this.config)),r=!0,n=!0)}if("groupAccessor"in e&&!re(e.groupAccessor,t.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?se(this.config.groupAccessor):void 0,r=!0),"categoryAccessor"in e&&!re(e.categoryAccessor,t.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?se(this.config.categoryAccessor):void 0,r=!0),"sizeAccessor"in e&&!re(e.sizeAccessor,t.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?ne(this.config.sizeAccessor,"size"):void 0,r=!0),"symbolAccessor"in e&&!re(e.symbolAccessor,t.symbolAccessor)&&(this.getSymbol=null!=this.config.symbolAccessor?se(this.config.symbolAccessor):void 0,r=!0),"colorAccessor"in e&&!re(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?se(this.config.colorAccessor):void 0,r=!0),"y0Accessor"in e&&!re(e.y0Accessor,t.y0Accessor)&&(this.getY0=this.config.y0Accessor?ne(this.config.y0Accessor,"y0"):void 0,r=!0,n=!0),("boundsAccessor"in e&&!re(e.boundsAccessor,t.boundsAccessor)||"band"in e&&e.band!==t.band||"boundsStyle"in e&&e.boundsStyle!==t.boundsStyle)&&(this.resolvedRibbons=Dt(this.config),r=!0,n=!0),"pointIdAccessor"in e&&!re(e.pointIdAccessor,t.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?se(this.config.pointIdAccessor):void 0,r=!0),"candlestick"===this.config.chartType&&(i||"openAccessor"in e&&!re(e.openAccessor,t.openAccessor)||"closeAccessor"in e&&!re(e.closeAccessor,t.closeAccessor)||"highAccessor"in e&&!re(e.highAccessor,t.highAccessor)||"lowAccessor"in e&&!re(e.lowAccessor,t.lowAccessor))){const e=null!=this.config.openAccessor,t=null!=this.config.closeAccessor;this.getOpen=e?ne(this.config.openAccessor,"open"):void 0,this.getHigh=ne(this.config.highAccessor,"high"),this.getLow=ne(this.config.lowAccessor,"low"),this.getClose=t?ne(this.config.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!e&&!t,r=!0,n=!0}if("accessorRevision"in e&&e.accessorRevision!==t.accessorRevision&&(r=!0,n=!0),!r){const o=Object.keys(e).filter(e=>!e.endsWith("Accessor")&&"timeAccessor"!==e&&"valueAccessor"!==e);for(const n of o)if(e[n]!==t[n]){r=!0;break}}r&&(n&&this.rebuildExtents(),this.needsFullRebuild=!0),this.updateResults.recordConfig(o,r,n)}updateConfigWithResult(e){return this.updateConfig(e),this.updateResults.last}};oo.GROUP_COLOR_MAP_CAP=1e3;var ro=oo,no={sceneGeometry:0,layout:0,domain:0},io="production"!==process.env.NODE_ENV,so={revisions:no,signature:"",sawSignals:!1,wasUnconsumed:!1,warnUnconsumed:!1},ao=class{constructor(){this.lastConsumed=no,this.lastDuplicateWarning="",this.lastUnconsumedWarning=""}beforeCompute(e,t){if(!io)return so;const o=function(e){const{domain:t,layout:o,sceneGeometry:r}=e.revisions;return{domain:t,layout:o,sceneGeometry:r}}(e),r=function(e){return`${e.sceneGeometry}|${e.layout}|${e.domain}`}(o),n=!((i=o).sceneGeometry===(s=this.lastConsumed).sceneGeometry&&i.layout===s.layout&&i.domain===s.domain);var i,s;return{revisions:o,signature:r,sawSignals:e.changed.has("scene-geometry")||e.changed.has("layout")||e.changed.has("domain"),wasUnconsumed:n,warnUnconsumed:!t&&n&&this.lastUnconsumedWarning!==r}}afterCompute(e,t,o){if(io){if(t&&e.wasUnconsumed&&(this.lastConsumed=e.revisions),e.warnUnconsumed&&!t)return console.warn(`[semiotic] StreamXYFrame observed scene-affecting revisions without a scene rebuild: ${e.signature}.`),void(this.lastUnconsumedWarning=e.signature);t&&e.sawSignals&&!e.wasUnconsumed&&!o&&this.lastDuplicateWarning!==e.signature?(console.warn(`[semiotic] StreamXYFrame performed scene rebuild with unchanged scene revisions: ${e.signature}.`),this.lastDuplicateWarning=e.signature):t&&!e.sawSignals&&(this.lastDuplicateWarning="")}}},lo=c(require("react"));function co(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:lo.createElement(lo.Fragment,null,...t)}var uo=c(require("react")),ho=require("react/jsx-runtime"),po={isActive:!1,predicate:()=>!0},fo=uo.createContext(null);function go({value:e,children:t}){return(0,ho.jsx)(fo.Provider,{value:e,children:t})}function mo(){return uo.useContext(fo)??po}function yo(e,t){return null!=e?(0,ho.jsx)(go,{value:t,children:e}):e}var bo=require("react");function vo(e,t,o,r){(0,bo.useEffect)(()=>{e.current?.updateConfig(t),o.current=!0,r()},[t,r,e,o])}function xo(e,t,o,r){const n=(0,bo.useRef)(null);(0,bo.useEffect)(()=>{const i=e.current;if(!i)return;const s=t??null;n.current!==s&&(n.current=s,i.setLayoutSelection(s),i.hasCustomRestyle?i.restyleScene(s):o.current=!0,r())},[t,r,e,o])}function ko(e,t,o){return o.x>e||e>o.x+o.w||o.y>t||t>o.y+o.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:o.x+o.w/2,cy:o.y+o.h/2}}function wo(e,t=30){return Math.max((e??4)+5,12,t)}function So(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function Ao(e,t){const o=So(e);if(!o)return!1;const r=So(t);return!r||o.getFullYear()!==r.getFullYear()||o.getMonth()!==r.getMonth()}function Co(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}var Mo=[40,40],jo=[.5,.5];function Po(e,t){const[o,r]=e.viewBox??Mo,[n,i]=e.anchor??jo,s=r>0?r:1,a=Math.max(0,t)/s,l=(o>0?o:s)*a,c=s*a;return{width:l,height:c,scale:a,offsetX:-n*l,offsetY:-i*c}}function _o(e,t,o,r){if("none"!==e)return"color"===e||null==e?t??r:"accent"===e?o:e}var Lo=null;function Ro(e){if("undefined"==typeof Path2D)return null;Lo||(Lo=new Map);const t=Lo.get(e);if(t)return t;const o=new Path2D(e);return Lo.size>1024&&Lo.clear(),Lo.set(e,o),o}function To(e,t,o=0,r="horizontal"){const[n,i]=e.viewBox??Mo,s=Math.min(1,Math.max(0,o)),a=Math.min(1,Math.max(0,t));return a>s?s>0||1>a?"vertical"===r?{x:0,y:i*(1-a),width:n,height:i*(a-s)}:{x:n*s,y:0,width:n*(a-s),height:i}:null:{x:0,y:0,width:0,height:0}}function Io(e,t){const o=Po(e,t);return{centerDx:o.offsetX+o.width/2,centerDy:o.offsetY+o.height/2,halfWidth:o.width/2,halfHeight:o.height/2,radius:Math.hypot(o.width,o.height)/2}}function $o(e,t,o,r,n,i=e=>e){for(const s of t.parts){const t=Ro(s.d);if(!t)continue;const a=s.opacity??1,l=e.globalAlpha;1!==a&&(e.globalAlpha=l*a);const c=n?"none"===s.fill?void 0:n:_o(s.fill,o,r);c&&(e.fillStyle=i(c),e.fill(t));const u=n?s.stroke&&"none"!==s.stroke?n:void 0:_o(s.stroke??"none",o,r);u&&(e.strokeStyle=i(u),e.lineWidth=s.strokeWidth??1,e.lineCap=s.strokeLinecap??"butt",e.lineJoin=s.strokeLinejoin??"miter",e.stroke(t)),1!==a&&(e.globalAlpha=l)}}function No(e,t,o,r,n,i=e=>e.x,s=e=>e.y,a=e=>e.r){const l=Math.max(r,n+5,12),c=t-l,u=t+l,d=o-l,h=o+l;let p=null,f=1/0;return e.visit((e,n,l,g,m)=>{if(n>u||c>g||l>h||d>m)return!0;if(!e.length){let n=e;do{const e=n.data,l=i(e)-t,c=s(e)-o,u=Math.sqrt(l*l+c*c);wo(a(e),r)>=u&&f>u&&(p=e,f=u),n=n.next}while(n)}return!1}),p?{node:p,distance:f}:null}var Fo=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,Bo=new WeakMap,Do=0,Eo=!1,zo=null,Ho=null;function Oo(e,t){if(!t)return t;const o=Fo.exec(t);if(!o)return t;const r=e.canvas;if(!r)return o[2]?.trim()||t;!function(){if(Eo)return;if("undefined"==typeof window||"undefined"==typeof document)return;Eo=!0;const e=()=>{Do++};if("undefined"!=typeof MutationObserver&&document.documentElement&&new MutationObserver(e).observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]}),"function"==typeof window.matchMedia)try{zo=window.matchMedia("(prefers-color-scheme: dark)"),Ho=e,"function"==typeof zo.addEventListener?zo.addEventListener("change",Ho):"function"==typeof zo.addListener&&zo.addListener(Ho)}catch{}}();let n=Bo.get(r);n&&n.version===Do||(n={version:Do,map:new Map},Bo.set(r,n));const i=n.map.get(t);if(void 0!==i)return i;const s=getComputedStyle(r).getPropertyValue(o[1]).trim()||o[2]?.trim()||t;return n.map.set(t,s),s}function Wo(e,t){const o=e.fillStyle,r="#010203";try{e.fillStyle=r,e.fillStyle=t}catch{return e.fillStyle=o,[78,121,167]}const n=e.fillStyle;if(e.fillStyle=o,"string"!=typeof n)return[78,121,167];if(n.toLowerCase()===r&&t.trim().toLowerCase()!==r)return[78,121,167];if(n.startsWith("#"))return[parseInt(n.slice(1,3),16),parseInt(n.slice(3,5),16),parseInt(n.slice(5,7),16)];const i=n.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return i?[+i[1],+i[2],+i[3]]:[78,121,167]}var qo=require("d3-shape");function Yo(e){switch(e){case"monotoneX":return qo.curveMonotoneX;case"monotoneY":return qo.curveMonotoneY;case"cardinal":return qo.curveCardinal;case"catmullRom":return qo.curveCatmullRom;case"step":return qo.curveStep;case"stepBefore":return qo.curveStepBefore;case"stepAfter":return qo.curveStepAfter;case"basis":return qo.curveBasis;case"natural":return qo.curveNatural;default:return null}}function Go(e,t,o){return null==t?o:"string"!=typeof t?t:Oo(e,t)||o}function Vo(e,t,o,r,n,i,s){if("colorStops"in t){const o=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>o.length)return null;const a=e.createLinearGradient(r,n,i,s);for(const e of o)a.addColorStop(e.offset,e.color);return a}const{topOpacity:a,bottomOpacity:l}=t;if(!Number.isFinite(a)||!Number.isFinite(l))return null;const c=Math.max(0,Math.min(1,a)),u=Math.max(0,Math.min(1,l)),d=e.createLinearGradient(r,n,i,s),[h,p,f]=Wo(e,o);return d.addColorStop(0,`rgba(${h},${p},${f},${c})`),d.addColorStop(1,`rgba(${h},${p},${f},${u})`),d}function Xo(e,t,o,r,n,i){const s=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>s.length)return null;const a=e.createLinearGradient(o,r,n,i);for(const e of s)a.addColorStop(e.offset,e.color);return a}var Uo=require("d3-shape"),Ko=new WeakMap;function Qo(e,t){const o=Yo(t);if(!o)return e;const r=Ko.get(e);if(r)return r;const n=function(e,t,o=8){if(!t||2>e.length)return e.map(([e,t])=>[e,t]);const r=[];let n=null;const i={moveTo(e,t){n=[e,t],r.push([e,t])},lineTo(e,t){n=[e,t],r.push([e,t])},bezierCurveTo(e,t,i,s,a,l){if(!n)return n=[a,l],void r.push([a,l]);const[c,u]=n;for(let n=1;o>=n;n++){const d=n/o,h=1-d;r.push([h*h*h*c+3*h*h*d*e+3*h*d*d*i+d*d*d*a,h*h*h*u+3*h*h*d*t+3*h*d*d*s+d*d*d*l])}n=[a,l]},closePath(){},arc(){},rect(){},arcTo(){},quadraticCurveTo(e,t,o,i){n=[o,i],r.push([o,i])}};return(0,Uo.line)().x(e=>e[0]).y(e=>e[1]).curve(t).context(i)(e),r}(e,o);return Ko.set(e,n),n}function Zo(e,t,o,r=30,n,i=0){let s=null;if(n){const e=No(n,t,o,r,i);e&&(s={node:e.node,datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const i of e){let e=null;switch(i.type){case"point":if(n)break;e=er(i,t,o,r);break;case"symbol":e=tr(i,t,o,r);break;case"glyph":e=or(i,t,o,r);break;case"line":e=rr(i,t,o,r);break;case"rect":if(null==i.datum)break;e=ir(i,t,o);break;case"heatcell":e=sr(i,t,o);break;case"area":if(!1===i.interactive)break;e=lr(i,t,o);break;case"candlestick":e=ar(i,t,o)}e&&r>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}function Jo(e,t,o){if(0===e.length)return null;if(e[0][0]>t||t>e[e.length-1][0])return null;const r=cr(e,t);if(0>r)return null;if(Math.abs(e[r][0]-t)>o)return null;let n=r,i=r;r>0&&e[r][0]>=t?(n=r-1,i=r):e.length-1>r&&(n=r,i=r+1);const[s,a]=e[n],[l,c]=e[i];return l===s?a:a+Math.max(0,Math.min(1,(t-s)/(l-s)))*(c-a)}function er(e,t,o,r=30){const n=t-e.x,i=o-e.y,s=Math.sqrt(n*n+i*i);return s>wo(e.r,r)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:s}}function tr(e,t,o,r=30){const n=t-e.x,i=o-e.y,s=Math.sqrt(n*n+i*i);return s>wo(Lt(e.size),r)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:s}}function or(e,t,o,r=30){if(null==e.datum)return null;const n=Io(e.glyph,e.size),i=e.x+n.centerDx,s=e.y+n.centerDy,a=t-i,l=o-s,c=Math.sqrt(a*a+l*l);return c>wo(n.radius,r)?null:{node:e,datum:e.datum,x:i,y:s,distance:c}}function rr(e,t,o,r=30){if(0===e.path.length)return null;const n=cr(e.path,t);if(0>n)return null;const[i,s]=e.path[n];let a;if(e.path.length>1){let r=1/0;const i=Math.max(0,n-1),s=Math.min(e.path.length-2,n);for(let n=i;s>=n;n++){const[i,s]=e.path[n],[a,l]=e.path[n+1],c=nr(t,o,i,s,a,l);r>c&&(r=c)}a=r}else{const e=t-i,r=o-s;a=Math.sqrt(e*e+r*r)}const l=e.style;return a>Math.max(5,(l.strokeWidth??l.lineWidth??1)/2+2,r)?null:{node:e,datum:Array.isArray(e.datum)&&e.datum[n]?e.datum[n]:e.datum,x:i,y:s,distance:a}}function nr(e,t,o,r,n,i){const s=n-o,a=i-r,l=s*s+a*a;if(0===l)return Math.sqrt((e-o)**2+(t-r)**2);let c=((e-o)*s+(t-r)*a)/l;return c=Math.max(0,Math.min(1,c)),Math.sqrt((e-(o+c*s))**2+(t-(r+c*a))**2)}function ir(e,t,o){const r=ko(t,o,e);return r.hit?{node:e,datum:e.datum,x:r.cx,y:r.cy,distance:0}:null}function sr(e,t,o){const r=ko(t,o,e);return r.hit?{node:e,datum:e.datum,x:r.cx,y:r.cy,distance:0}:null}function ar(e,t,o){const r=e.bodyWidth/2,n=Math.min(e.openY,e.closeY);if(!(e.x-r-3>t||t>e.x+r+3||e.highY-3>o||o>e.lowY+3)){const r=n+Math.max(Math.max(e.openY,e.closeY)-n,1)/2,i=t-e.x,s=o-r;return{node:e,datum:e.datum,x:e.x,y:r,distance:Math.sqrt(i*i+s*s)}}return null}function lr(e,t,o){if(0===e.topPath.length)return null;const r=cr(e.topPath,t);if(0>r)return null;const[n,i]=e.topPath[r],s=t-n,a=o-i,l=Math.sqrt(s*s+a*a);return{node:e,datum:Array.isArray(e.datum)&&e.datum[r]?e.datum[r]:e.datum,x:n,y:i,distance:l}}function cr(e,t){if(0===e.length)return-1;let o=0,r=e.length-1;for(;r>o;){const n=o+r>>1;t>e[n][0]?o=n+1:r=n}return o>0&&Math.abs(e[o][0]-t)>=Math.abs(e[o-1][0]-t)?o-1:o}function ur(e){const t=new Map;for(const o of e){const e=o.group??"_default";let r=t.get(e);r||(r=[],t.set(e,r)),r.push(o)}for(const e of t.values()){e.sort((e,t)=>e.x-t.x||e.y-t.y);for(let t=0;e.length>t;t++)e[t]._groupIndex=t}const o=Array.from(t.keys()).sort((e,o)=>{const r=t.get(e),n=t.get(o);return(r.length>0?r[0].y:0)-(n.length>0?n[0].y:0)}),r=Array.from(t.values()).flat();r.sort((e,t)=>e.x-t.x||e.y-t.y);const n=new Map;for(let e=0;r.length>e;e++){r[e]._flatIndex=e;const t=r[e].datum?.id;null!=t&&n.set(t+"",e)}return{flat:r,groups:o,byGroup:t,idToIdx:n}}function dr(e,t){if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const o=Math.max(0,Math.min(t,e.flat.length-1)),r=e.flat[o];return{flatIndex:o,group:r.group??"_default",indexInGroup:r._groupIndex??0}}function hr(e,t,o){const{group:r,indexInGroup:n}=t,i=o.byGroup.get(r);switch(e){case"ArrowRight":return i.length-1>n?i[n+1]._flatIndex:t.flatIndex;case"ArrowLeft":return n>0?i[n-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=o.groups.indexOf(r);return o.groups.length-1>e?pr(o,o.groups[e+1],i[n]):t.flatIndex}case"ArrowUp":{const e=o.groups.indexOf(r);return e>0?pr(o,o.groups[e-1],i[n]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*o.flat.length)),o.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*o.flat.length)),0);case"Home":return 0;case"End":return o.flat.length-1;case"Escape":return-1;default:return null}}function pr(e,t,o){const r=e.byGroup.get(t);let n=0,i=Math.abs(r[0].x-o.x);for(let e=1;r.length>e;e++){const t=Math.abs(r[e].x-o.x);i>t&&(i=t,n=e)}return r[n]._flatIndex}function fr(e){return"object"==typeof e&&null!==e&&"id"in e?e.id:e}function gr(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}var mr=require("react"),yr={fresh:1,aging:.7,stale:.45,expired:.25},br={alpha:1,band:"fresh",isStale:!1};function vr(e,t){if(!e||0>=t)return br;const o=null!=e.threshold&&e.threshold>0?e.threshold:5e3,r=e.graded;if(r){const e="object"==typeof r?r:{},n=Qe(t,o,e.thresholds);return{alpha:{...yr,...e.opacities??{}}[n],band:n,isStale:"fresh"!==n}}return t>o?{alpha:e.dimOpacity??.5,band:"stale",isStale:!0}:br}function xr(e,t,o,r,n,i){const s=(0,mr.useRef)("fresh");(0,mr.useEffect)(()=>{if(!e)return;const a=setInterval(()=>{const a=t.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=vr(e,l-a.lastIngestTime);c.band===s.current&&c.isStale===n||(s.current=c.band,c.isStale!==n&&i(c.isStale),o.current=!0,r())},1e3);return()=>clearInterval(a)},[e,n,r])}var kr=require("react/jsx-runtime");function wr({isStale:e,position:t}){return(0,kr.jsx)("div",{className:"stream-staleness-badge",style:{position:"absolute",..."top-left"===t?{top:4,left:4}:"bottom-left"===t?{bottom:4,left:4}:"bottom-right"===t?{bottom:4,right:4}:{top:4,right:4},padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",zIndex:3,background:e?"#dc3545":"#28a745",color:"white"},children:e?"STALE":"LIVE"})}var Sr=require("react"),Ar=c(require("react")),Cr=require("react/jsx-runtime"),Mr=16,jr=6,Pr=10,_r=22,Lr={fill:(e,t)=>(0,Cr.jsx)("rect",{style:e,width:t,height:t}),line:(e,t)=>(0,Cr.jsx)("line",{style:e,x1:0,y1:0,x2:t,y2:t})};function Rr(e,t,o,r,n){let i;return i="function"==typeof o?o(e):(0,Lr[o])(r(e,t),n),i}function Tr({swatchSize:e}){return(0,Cr.jsx)("path",{d:`M${.25*e},${.55*e} L${.45*e},${.75*e} L${.8*e},${.3*e}`,fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function Ir(e,t,o){return o&&o.size>0?o.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}var $r=(e,t,o,r,n,i,s,a,l,c,u)=>{const{type:d="fill",styleFn:h,items:p}=e,f=[];let g=0;const m=!(!t&&!o),y="isolate"===c||void 0===c&&null!=n,{swatchSize:b,labelGap:v,rowHeight:x}=u;return p.forEach((e,c)=>{const u=Rr(e,c,d,h,b),k=Ir(e,r,n),w=n&&n.size>0&&n.has(e.label);f.push((0,Cr.jsxs)("g",{transform:`translate(0,${g})`,onClick:t?()=>t(e):void 0,onMouseEnter:o?()=>o(e):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:m?a===i&&c===s?0:-1:void 0,role:m?"option":void 0,"aria-selected":m&&y?w||!1:void 0,"aria-current":m&&!y&&null!=r&&e.label===r||void 0,"aria-label":e.label,onKeyDown:m?o=>{if("Enter"!==o.key&&" "!==o.key||(o.preventDefault(),t&&t(e)),"ArrowDown"===o.key||"ArrowUp"===o.key){o.preventDefault();const e=(c+("ArrowDown"===o.key?1:-1)+p.length)%p.length;l(a,e);const t=o.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:m?t=>{l(a,c),o&&o(e);const r=t.currentTarget.querySelector(".semiotic-legend-focus-ring");r&&r.setAttribute("visibility","visible")}:void 0,onBlur:m?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:m?"pointer":"default",opacity:k,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[m&&(0,Cr.jsx)("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:b+v+2+7*e.label.length,height:b+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),u,w&&(0,Cr.jsx)(Tr,{swatchSize:b}),(0,Cr.jsx)("text",{y:b/2,x:b+v,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+c)),g+=x}),f},Nr=({legendGroups:e,width:t,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:n,isolatedCategories:i,focusedGroupIndex:s,focusedItemIndex:a,onFocusedIndexChange:l,legendInteraction:c,metrics:u})=>{let d=24;const h=[];return e.forEach((e,p)=>{d+=5,h.push((0,Cr.jsx)("line",{stroke:"gray",x1:0,y1:d,x2:t,y2:d},"legend-top-line legend-symbol-"+p)),d+=8,e.label&&(d+=16,h.push((0,Cr.jsx)("text",{y:d,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label},"legend-text-"+p)),d+=8),h.push((0,Cr.jsx)("g",{className:"legend-item",transform:`translate(0,${d})`,children:$r(e,o,r,n,i,s,a,p,l,c,u)},"legend-group-"+p)),d+=e.items.length*u.rowHeight+8}),h},Fr=({legendGroups:e,height:t,width:o,customClickBehavior:r,customHoverBehavior:n,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u,metrics:d})=>{let h=0;const p=[];e.forEach((e,t)=>{let f=0;e.label&&(f+=16);const g=((e,t,o,r,n,i,s,a,l,c,u,d)=>{const{type:h="fill",styleFn:p,items:f}=e,g=[],{swatchSize:m,labelGap:y,itemGap:b,rowHeight:v,align:x}=u,k=!(!t&&!o),w="isolate"===c||void 0===c&&null!=n,S=f.map(e=>m+y+7*e.label.length),A=[];let C=0,M=0;S.forEach((e,t)=>{const o=0===M?e:M+b+e;d&&d>0&&M>0&&o>d?(A.push({start:C,end:t,width:M}),C=t,M=e):M=o}),f.length>0&&A.push({start:C,end:f.length,width:M}),A.forEach((e,c)=>{let u="center"===x?Math.max(0,((d??e.width)-e.width)/2):"end"===x?Math.max(0,(d??e.width)-e.width):0;for(let d=e.start;e.end>d;d++){const e=f[d],x=Rr(e,d,h,p,m),A=Ir(e,r,n),C=n&&n.size>0&&n.has(e.label);g.push((0,Cr.jsxs)("g",{transform:`translate(${u},${c*v})`,onClick:t?()=>t(e):void 0,onMouseEnter:o?()=>o(e):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:k?a===i&&d===s?0:-1:void 0,role:k?"option":void 0,"aria-selected":k&&w?C||!1:void 0,"aria-current":k&&!w&&null!=r&&e.label===r||void 0,"aria-label":e.label,onKeyDown:k?o=>{if("Enter"!==o.key&&" "!==o.key||(o.preventDefault(),t&&t(e)),"ArrowRight"===o.key||"ArrowLeft"===o.key){o.preventDefault();const e=(d+("ArrowRight"===o.key?1:-1)+f.length)%f.length;l(a,e);const t=o.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:k?t=>{l(a,d),o&&o(e);const r=t.currentTarget.querySelector(".semiotic-legend-focus-ring");r&&r.setAttribute("visibility","visible")}:void 0,onBlur:k?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:k?"pointer":"default",opacity:A,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[k&&(0,Cr.jsx)("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:m+y+2+7*e.label.length,height:m+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),x,C&&(0,Cr.jsx)(Tr,{swatchSize:m}),(0,Cr.jsx)("text",{y:m/2,x:m+y,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+d)),u+=S[d]+b}});const j=Math.max(0,...A.map(e=>e.width)),P=A.length;return{items:g,offset:j,totalRows:P,totalHeight:P*v}})(e,r,n,i,s,a,l,t,c,u,d,d.maxWidth??o);f+=g.offset+5,p.push({label:e.label,...g,offset:f,totalRows:g.totalRows,totalHeight:g.totalHeight}),h+=f+12});const f=d.maxWidth??o;let g=h>f?0:"center"===d.align?Math.max(0,(f-h)/2):"end"===d.align?Math.max(0,f-h):0;const m=[];return p.forEach((o,r)=>{const n=e[r];n.label&&(m.push((0,Cr.jsx)("text",{transform:`translate(${g},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:n.label},"legend-text-"+r)),g+=16),m.push((0,Cr.jsx)("g",{className:"legend-item",transform:`translate(${g},0)`,children:o.items},"legend-group-"+r)),g+=o.offset+5,e[r+1]&&m.push((0,Cr.jsx)("line",{stroke:"gray",x1:g,y1:-8,x2:g,y2:(o.totalHeight||t)+0+8},"legend-top-line legend-symbol-"+r)),g+=12}),(0,Cr.jsx)("g",{children:m})};function Br({config:e,orientation:t="vertical",width:o=100}){const{colorFn:r,domain:n,label:i,format:s}=e,a=s||(e=>Math.round(100*e)/100+""),l="grad-legend-"+Ar.useId();if("horizontal"===t){const e=12,t=Math.min(o,200),s=Math.max(0,(o-t)/2),c=[];for(let e=0;64>=e;e++){const t=e/64;c.push((0,Cr.jsx)("stop",{offset:100*t+"%",stopColor:r(n[0]+t*(n[1]-n[0]))},e))}return(0,Cr.jsxs)("g",{"aria-label":i||"Gradient legend",children:[(0,Cr.jsx)("defs",{children:(0,Cr.jsx)("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),i&&(0,Cr.jsx)("text",{x:s+t/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),(0,Cr.jsx)("rect",{x:s,y:0,width:t,height:e,fill:`url(#${l})`,rx:2}),(0,Cr.jsx)("text",{x:s,y:e+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(n[0])}),(0,Cr.jsx)("text",{x:s+t,y:e+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(n[1])})]})}const c=[];for(let e=0;64>=e;e++){const t=e/64;c.push((0,Cr.jsx)("stop",{offset:100*t+"%",stopColor:r(n[1]-t*(n[1]-n[0]))},e))}return(0,Cr.jsxs)("g",{"aria-label":i||"Gradient legend",children:[i&&(0,Cr.jsx)("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),(0,Cr.jsx)("defs",{children:(0,Cr.jsx)("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:c})}),(0,Cr.jsx)("rect",{x:0,y:0,width:14,height:100,fill:`url(#${l})`,rx:2}),(0,Cr.jsx)("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(n[1])}),(0,Cr.jsx)("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(n[0])})]})}function Dr(e){const{legendGroups:t,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:n,isolatedCategories:i,legendInteraction:s,title:a="Legend",width:l=100,height:c=20,orientation:u="vertical",legendLayout:d}=e,h=function(e){const t=Math.max(1,e?.swatchSize??Mr),o=Math.max(t,e?.rowHeight??_r);return{swatchSize:t,labelGap:Math.max(0,e?.labelGap??jr),itemGap:Math.max(0,e?.itemGap??Pr),rowHeight:o,align:"left"===e?.align?"start":"right"===e?.align?"end":e?.align??"start",maxWidth:e?.maxWidth}}(d),[p,f]=Ar.useState(0),[g,m]=Ar.useState(0),y=Ar.useCallback((e,t)=>{f(e),m(t)},[]),b="vertical"===u?Nr({legendGroups:t||[],width:l,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:n,isolatedCategories:i,focusedGroupIndex:p,focusedItemIndex:g,onFocusedIndexChange:y,legendInteraction:s,metrics:h}):Fr({legendGroups:t||[],title:a,height:c,width:l,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:n,isolatedCategories:i,focusedGroupIndex:p,focusedItemIndex:g,onFocusedIndexChange:y,legendInteraction:s,metrics:h}),v=!(!o&&!r);return(0,Cr.jsxs)("g",{role:v?"listbox":void 0,"aria-multiselectable":!(!v||"isolate"!==s&&(void 0!==s||null==i))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==a&&""!==a&&"vertical"===u&&(0,Cr.jsx)("text",{className:"legend-title",y:16,x:l/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:a}),b]})}function Er(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}var zr=require("react/jsx-runtime");function Hr(e){const{legend:t,totalWidth:o,totalHeight:r,margin:n,legendPosition:i="right",legendLayout:s,title:a,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=e;if(!t)return null;const p="top"===i||"bottom"===i,f=!!a,g=Math.max(0,o-n.left-n.right),m=Math.max(1,p?s?.maxWidth??g:100);let y,b;return"left"===i?(y=Math.max(4,n.left-m-10),b=n.top):"top"===i?(y=n.left,b=f?32:8):"bottom"===i?(y=n.left,b=r-n.bottom+38):(y=o-n.right+10,b=n.top),(0,zr.jsx)("g",{transform:`translate(${y}, ${b})`,children:(v=t,"object"==typeof v&&null!==v&&"gradient"in v?(0,zr.jsx)(Br,{config:t.gradient,orientation:p?"horizontal":"vertical",width:m}):Er(t)?(0,zr.jsx)(Dr,{legendGroups:t.legendGroups,title:"",width:m,orientation:p?"horizontal":"vertical",legendLayout:s,customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):t)});var v}var Or=require("react"),Wr=require("d3-array");h();var qr=require("react/jsx-runtime");function Yr(e){return"string"==typeof e?{type:e}:e}function Gr({orient:e,config:t,values:o,scale:r,size:n,length:i}){const s=function(e){return{type:e.type,bins:e.bins??20,fill:e.fill??"#4e79a7",fillOpacity:e.fillOpacity??.5,stroke:e.stroke??"none",strokeWidth:e.strokeWidth??1}}(t),a="top"===e||"bottom"===e,l=(0,Or.useMemo)(()=>{if(0===o.length)return null;const t=r.domain(),l=n-8;if("boxplot"===s.type){const t=function(e){const t=[...e].sort((e,t)=>e-t),o=t.length;if(0===o)return null;const r=t[Math.floor(.25*o)],n=t[Math.floor(.5*o)],i=t[Math.floor(.75*o)],s=i-r;return{q1:r,median:n,q3:i,whiskerLow:Math.max(t[0],r-1.5*s),whiskerHigh:Math.min(t[o-1],i+1.5*s)}}(o);if(!t)return null;const{q1:n,median:i,q3:c,whiskerLow:u,whiskerHigh:d}=t,h=Math.min(.5*l,20),p=(l-h)/2+4;if(a){const t=r(n),o=r(c),a=r(i),l=r(u),f=r(d),g="top"===e?-1:1,m=0;return(0,qr.jsxs)("g",{"data-testid":"marginal-boxplot-"+e,children:[(0,qr.jsx)("line",{x1:l,y1:m+g*(p+h/2),x2:f,y2:m+g*(p+h/2),stroke:s.fill,strokeWidth:s.strokeWidth}),(0,qr.jsx)("line",{x1:l,y1:m+g*p,x2:l,y2:m+g*(p+h),stroke:s.fill,strokeWidth:s.strokeWidth}),(0,qr.jsx)("line",{x1:f,y1:m+g*p,x2:f,y2:m+g*(p+h),stroke:s.fill,strokeWidth:s.strokeWidth}),(0,qr.jsx)("rect",{x:Math.min(t,o),y:"top"===e?m-p-h:m+p,width:Math.abs(o-t),height:h,fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth}),(0,qr.jsx)("line",{x1:a,y1:"top"===e?m-p-h:m+p,x2:a,y2:"top"===e?m-p:m+p+h,stroke:s.fill,strokeWidth:2})]})}{const t=r(n),o=r(c),a=r(i),l=r(u),f=r(d),g="left"===e?-1:1,m=0;return(0,qr.jsxs)("g",{"data-testid":"marginal-boxplot-"+e,children:[(0,qr.jsx)("line",{x1:m+g*(p+h/2),y1:l,x2:m+g*(p+h/2),y2:f,stroke:s.fill,strokeWidth:s.strokeWidth}),(0,qr.jsx)("line",{x1:m+g*p,y1:l,x2:m+g*(p+h),y2:l,stroke:s.fill,strokeWidth:s.strokeWidth}),(0,qr.jsx)("line",{x1:m+g*p,y1:f,x2:m+g*(p+h),y2:f,stroke:s.fill,strokeWidth:s.strokeWidth}),(0,qr.jsx)("rect",{x:"left"===e?m-p-h:m+p,y:Math.min(t,o),width:h,height:Math.abs(o-t),fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth}),(0,qr.jsx)("line",{x1:"left"===e?m-p-h:m+p,y1:a,x2:"left"===e?m-p:m+p+h,y2:a,stroke:s.fill,strokeWidth:2})]})}}const c=(0,Wr.bin)().domain(t).thresholds(s.bins)(o);if(0===c.length)return null;const u=d(c.map(e=>e.length));if(0===u)return null;if("histogram"===s.type)return(0,qr.jsx)("g",{"data-testid":"marginal-histogram-"+e,children:c.map((t,o)=>{if(null==t.x0||null==t.x1)return null;const n=t.length/u*l;if(a){const i=r(t.x0),a=r(t.x1)-r(t.x0);return(0,qr.jsx)("rect",{x:i,y:"top"===e?-4-n:4,width:Math.max(a,.5),height:n,fill:s.fill,fillOpacity:s.fillOpacity,stroke:s.stroke,strokeWidth:s.strokeWidth},o)}{const i=r(t.x0),a=r(t.x1)-r(t.x0);return(0,qr.jsx)("rect",{x:"left"===e?-4-n:4,y:Math.min(i,i+a),width:n,height:Math.abs(a),fill:s.fill,fillOpacity:s.fillOpacity,stroke:s.stroke,strokeWidth:s.strokeWidth},o)}})});if("violin"===s.type){const t=l/2+4,o=[];for(const n of c){if(null==n.x0||null==n.x1)continue;const i=n.length/u*(l/2),s=r((n.x0+n.x1)/2);o.push(a?`${s},${"top"===e?-(t-i):t-i}`:`${"left"===e?-(t-i):t-i},${s}`)}for(let n=c.length-1;n>=0;n--){const i=c[n];if(null==i.x0||null==i.x1)continue;const s=i.length/u*(l/2),d=r((i.x0+i.x1)/2);o.push(a?`${d},${"top"===e?-(t+s):t+s}`:`${"left"===e?-(t+s):t+s},${d}`)}return(0,qr.jsx)("g",{"data-testid":"marginal-violin-"+e,children:(0,qr.jsx)("polygon",{points:o.join(" "),fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth})})}if("ridgeline"===s.type){const t=[];if(a){const o=0,n=null!=c[0].x0?r(c[0].x0):0;t.push(`M${n},${o}`);for(const o of c){if(null==o.x0||null==o.x1)continue;const n=o.length/u*l,i=r((o.x0+o.x1)/2);t.push(`L${i},${"top"===e?-n-4:n+4}`)}const s=null!=c[c.length-1].x1?r(c[c.length-1].x1):i;t.push(`L${s},${o}`),t.push("Z")}else{const o=0,n=null!=c[0].x0?r(c[0].x0):0;t.push(`M${o},${n}`);for(const o of c){if(null==o.x0||null==o.x1)continue;const n=o.length/u*l,i=r((o.x0+o.x1)/2);t.push(`L${"left"===e?-n-4:n+4},${i}`)}const s=null!=c[c.length-1].x1?r(c[c.length-1].x1):i;t.push(`L${o},${s}`),t.push("Z")}return(0,qr.jsx)("g",{"data-testid":"marginal-ridgeline-"+e,children:(0,qr.jsx)("path",{d:t.join(" "),fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth})})}return null},[o,r,s,n,i,e,a,4]);return l?(0,qr.jsx)("g",{className:"marginal-"+e,"data-testid":"marginal-"+e,children:l}):null}var Vr=c(require("react")),Xr=require("react/jsx-runtime");function Ur(e,t=120,o=8){if(!e)return[];const r=Math.max(1,Math.floor(t/o)),n=e.split(/\s+/),i=[];let s="";for(const e of n)s&&s.length+1+e.length>r?(i.push(s),s=e):s=s?`${s} ${e}`:e;return s&&i.push(s),i}function Kr(e,t,o,r){return"curly"===e?r?`M0,0 C${.6*o},0 ${.4*o},${t/2} ${o},${t/2} C${.4*o},${t/2} ${.6*o},${t} 0,${t}`:`M0,0 C0,${.6*o} ${t/2},${.4*o} ${t/2},${o} C${t/2},${.4*o} ${t},${.6*o} ${t},0`:r?`M0,0 L${o},0 L${o},${t} L0,${t}`:`M0,0 L0,${o} L${t},${o} L${t},0`}function Qr(e,t,o,r){if(!e)return(0,Xr.jsx)("g",{className:"annotation-note"});const{label:n,title:i,orientation:s,align:a,wrap:l=120,noWrap:c}=e;if(!n&&!i)return(0,Xr.jsx)("g",{className:"annotation-note"});let u=s;u||(u=Math.abs(t)>Math.abs(o)?"leftRight":"topBottom");let d=a;d&&"dynamic"!==d||(d="topBottom"===u?0>t?"right":"left":0>o?"bottom":"top");let h="start";"topBottom"===u?"right"===d?h="end":"middle"===d&&(h="middle"):h=0>t?"end":"start";const p=16,f=i?c?[i]:Ur(i,l):[],g=n?c?[n]:Ur(n,l):[],m="leftRight"===u?"end"===h?-4:4:0;let y=0;const b=[],v=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";e.useHTML||e.html?b.push((0,Xr.jsx)("foreignObject",{className:"annotation-note-html",x:"end"===h?m-l:"middle"===h?m-l/2:m,y:-16,width:l,height:Math.max(p,(f.length+g.length)*p+(i&&n?2:0))+p,style:{overflow:"visible"},children:(0,Xr.jsxs)("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{color:v,fontSize:"12px",lineHeight:"16px",overflow:"visible",textAlign:"end"===h?"right":"middle"===h?"center":"left",whiteSpace:c?"nowrap":"normal",wordBreak:"break-word"},children:[i&&(0,Xr.jsx)("div",{className:"annotation-note-title",style:{fontWeight:"bold"},children:i}),n&&(0,Xr.jsx)("div",{className:"annotation-note-label",children:n})]})},"annotation-note-html")):(f.length>0&&(b.push((0,Xr.jsx)("text",{className:"annotation-note-title",fill:v,textAnchor:h,fontWeight:"bold",children:f.map((e,t)=>(0,Xr.jsx)("tspan",{x:m,dy:0===t?0:p,children:e},t))},"annotation-note-title")),y=f.length*p),g.length>0&&b.push((0,Xr.jsx)("text",{className:"annotation-note-label",fill:v,textAnchor:h,y:y,children:g.map((e,t)=>(0,Xr.jsx)("tspan",{x:m,dy:0===t?0:p,children:e},t))},"annotation-note-label")));let x=null;if((i||n)&&(0!==t||0!==o))if("topBottom"===u){const e=Math.min(l,120);let t=0,o=e;"end"===h?(t=-e,o=0):"middle"===h&&(t=-e/2,o=e/2),x=(0,Xr.jsx)("line",{className:"note-line",x1:t,x2:o,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const e=(f.length+g.length)*p+(g.length>0?p:0);let t=0,o=e;"bottom"===d?(t=-e,o=0):"middle"===d&&(t=-e/2,o=e/2),x=(0,Xr.jsx)("line",{className:"note-line",x1:0,x2:0,y1:t,y2:o,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const k=Math.max(0,f.length+g.length-1)*p;let w=0;return"topBottom"===u?w=0>o?-(k+2):18:"leftRight"===u&&(w="middle"===d?-(k+p+(g.length>0&&f.length>0?2:0))/2+8:"bottom"===d||0>o?-(k+2):18),(0,Xr.jsxs)("g",{className:"annotation-note",transform:`translate(${t},${o})`,children:[(0,Xr.jsx)("g",{className:"annotation-note-content",transform:0!==w?`translate(0,${w})`:void 0,children:b}),x]})}function Zr(e,t,o,r,n){const i=[];switch(e){case"callout-circle":{const e=(t?.radius||0)+(t?.radiusPadding||0);e>0&&i.push((0,Xr.jsx)("circle",{r:e,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const e=t?.width||0,r=t?.height||0;(e>0||r>0)&&i.push((0,Xr.jsx)("rect",{width:e,height:r,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":t?.custom&&i.push(...Array.isArray(t.custom)?t.custom:[t.custom]);break;case"xy-threshold":{const e=r||0,s=n||0;if(void 0!==t?.x){const r=(t.x||0)-e;i.push((0,Xr.jsx)("line",{x1:r,y1:(t.y1||0)-s,x2:r,y2:(t.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==t?.y){const r=(t.y||0)-s;i.push((0,Xr.jsx)("line",{x1:(t.x1||0)-e,y1:r,x2:(t.x2||0)-e,y2:r,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==t?.x1||void 0!==t?.x2?i.push((0,Xr.jsx)("line",{x1:(t.x1||0)-e,y1:0,x2:(t.x2||0)-e,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===t?.y1&&void 0===t?.y2||i.push((0,Xr.jsx)("line",{x1:0,y1:(t.y1||0)-s,x2:0,y2:(t.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const e=t?.type||"curly",r=t?.width??t?.height;void 0!==r&&i.push((0,Xr.jsx)("path",{d:Kr(e,r,t?.depth||30,void 0===t?.width),fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return(0,Xr.jsx)("g",{className:"annotation-subject",children:i})}function Jr(e,t,o,r,n,i){const s=[];let a=0,l=0;if("callout-circle"!==n&&"label"!==n||!i?.radius){if("callout-rect"===n&&i){const o=i.width||0,r=i.height||0;if(o>0||r>0){const n=o/2,i=r/2,s=e-n,c=t-i;if(0!==s||0!==c){const e=Math.abs(s),t=Math.abs(c),u=o/2,d=r/2,h=e*d>t*u?u/e:d/t;a=n+s*h,l=i+c*h}}}else if("bracket"===n&&i){const e=i.width,t=i.height,o=i.depth||30;void 0!==e?(a=e/2,l=o):void 0!==t&&(a=o,l=t/2)}}else{const o=(i.radius||0)+(i.radiusPadding||0);if(o>0&&(0!==e||0!==t)){const r=Math.atan2(t,e);a=Math.cos(r)*o,l=Math.sin(r)*o}}const c=Math.sqrt((e-a)**2+(t-l)**2);if(c>.5){const n=r||"var(--semiotic-text-secondary, currentColor)",i="curve"===o?.type;let u=Math.atan2(t-l,e-a);if(i){const r=(a+e)/2,i=(l+t)/2,d=-(t-l)/c,h=(e-a)/c,p=(o?.curve??.25)*c,f=r+d*p,g=i+h*p;s.push((0,Xr.jsx)("path",{className:"connector-curve",d:`M${a},${l}Q${f},${g} ${e},${t}`,fill:"none",stroke:n},"connector-line")),u=Math.atan2(g-l,f-a)}else s.push((0,Xr.jsx)("line",{x1:a,y1:l,x2:e,y2:t,stroke:n},"connector-line"));if("arrow"===o?.end){const e=10,t=16/180*Math.PI;s.push((0,Xr.jsx)("path",{d:`M${a},${l}L${a+e*Math.cos(u+t)},${l+e*Math.sin(u+t)}L${a+e*Math.cos(u-t)},${l+e*Math.sin(u-t)}Z`,fill:n,stroke:"none"},"connector-arrow"))}}return(0,Xr.jsx)("g",{className:"annotation-connector",children:s})}function en(e){const{x:t=0,y:o=0,dx:r,dy:n,nx:i,ny:s,note:a,connector:l,subject:c,type:u,color:d,className:h,disable:p,opacity:f,strokeDasharray:g,events:m={},"data-testid":y}=e,b=Array.isArray(t)?t[0]??0:t,v=Array.isArray(o)?o[0]??0:o,x=new Set(Array.isArray(p)?p:[]);let k=r||0,w=n||0;null!=i&&(k=i-b),null!=s&&(w=s-v);const S="string"==typeof u?u:"label";if("bracket"===S&&c&&0===k&&0===w)if(void 0!==c.width){k=c.width/2;const e=c.depth||30;w=e+(0>e?-5:5)}else if(void 0!==c.height){const e=c.depth||30;k=e+(0>e?-5:5),w=c.height/2}return(0,Xr.jsxs)("g",{className:("annotation "+(h||"")).trim(),transform:`translate(${b},${v})`,"data-testid":y,...null!=f&&{opacity:f},...g&&{strokeDasharray:g},...m,children:[!x.has("connector")&&Jr(k,w,l,d,S,c),!x.has("subject")&&Zr(S,c,d,b,v),!x.has("note")&&Qr(a,k,w,d)]})}function tn(e){const{noteData:t}=e,{screenCoordinates:o}=t,r="string"==typeof t.type?t.type:"label",n=t.eventListeners||t.events||{};if(t.coordinates&&o){const e=t.nx||o[0][0]+(t.dx??0),n=t.ny||o[0][1]+(t.dy??0),i=o.map((o,i)=>{const s=Object.assign({},t,{note:0===i?t.note:{label:""},x:o[0],y:o[1],nx:e,ny:n});return(0,Xr.jsx)(en,{"data-testid":"semiotic-annotation",...s,type:r},"multi-annotation-"+i)});return(0,Xr.jsx)("g",{children:i})}const i=t.note||{title:"none",label:t.label},s=`${i.label}-${i.title}-${t.i}`;return(0,Xr.jsx)(en,{"data-testid":"semiotic-annotation",events:n,...t,type:r},s)}var on=require("d3-hierarchy"),rn=require("d3-shape"),nn=c(require("regression"));function sn(e,t){const o=t.scales?.x??t.scales?.time;return o?null!=e.x?o(e.x):t.xAccessor&&null!=e[t.xAccessor]?o(e[t.xAccessor]):null:null}function an(e,t){const o=t.scales?.y??t.scales?.value;return o?null!=e.y?o(e.y):t.yAccessor&&null!=e[t.yAccessor]?o(e[t.yAccessor]):null:null}function ln(e){return null==e?null:e+""}function cn(e,t,o){return t.stickyPositionCache?.set(e,o),o}function un(e,t,o){const r=e.anchor||e.lifecycle?.anchor||"fixed";if("latest"===r){if(null!=e.pointId&&o.pointNodes&&o.pointNodes.length>0)for(let r=o.pointNodes.length-1;r>=0;r--){const n=o.pointNodes[r];if(n.pointId===e.pointId)return cn(t,o,{x:n.x,y:n.y})}const r=function(e){const t=e.data;if(!t||0===t.length)return null;const o=t[t.length-1],r=e.scales?.x??e.scales?.time,n=e.scales?.y??e.scales?.value;if(!r||!n)return null;const i=o[e.xAccessor||"x"],s=o[e.yAccessor||"y"];return null==i||null==s?null:{x:r(i),y:n(s)}}(o);return r?cn(t,o,r):null}if("semantic"===r){const r=function(e,t,o){const r=function(e){return ln(e.provenance?.stableId??e.stableId)}(e);if(!r)return null;const n=o.pointNodes?.find(e=>ln(e.pointId)===r);if(n)return cn(t,o,{x:n.x,y:n.y});const i=o.data?.find(e=>function(e){return ln(e.stableId??e.id??e.provenance?.stableId)}(e)===r);if(!i)return null;const s=sn(i,o),a=an(i,o);return null==s||null==a?null:cn(t,o,{x:s,y:a})}(e,t,o);if(r)return r}let n=null,i=null;if(null!=e.pointId&&o.pointNodes){const t=o.pointNodes.find(t=>t.pointId===e.pointId);t&&(n=t.x,i=t.y)}if(null!=n&&null!=i||(n=sn(e,o),i=an(e,o)),null!=n&&null!=i)return cn(t,o,{x:n,y:i});if("sticky"===r){const e=o.stickyPositionCache?.get(t);if(e)return e}return null}function dn(e,t,o,r=50){return!(-r>e||e>(o.width||0)+r||-r>t||t>(o.height||0)+r)}var hn=require("react/jsx-runtime"),pn={secondary:0,primary:3},fn=".annotation-deferred{opacity:0;pointer-events:none;transition:opacity .12s ease}.stream-xy-frame:hover .annotation-deferred,.stream-ordinal-frame:hover .annotation-deferred,.stream-network-frame:hover .annotation-deferred,.stream-geo-frame:hover .annotation-deferred,.stream-xy-frame:focus-within .annotation-deferred,.stream-ordinal-frame:focus-within .annotation-deferred,.stream-network-frame:focus-within .annotation-deferred,.stream-geo-frame:focus-within .annotation-deferred{opacity:1;pointer-events:auto}@media (prefers-reduced-motion:reduce){.annotation-deferred{transition:none}}";function gn(e){return!0===e?._annotationDeferred}function mn(e){return"blended"===e?.cohesion||"layer"===e?.cohesion?e.cohesion:null}function yn(e){const t=e?.provenance?.confidence;return"number"==typeof t&&Number.isFinite(t)?Math.max(0,Math.min(1,t)):null}function bn(e){return Math.max(.72,.95-.06*e)}h();var vn=require("react/jsx-runtime"),xn={linear:rn.curveLinear,monotoneX:rn.curveMonotoneX,monotoneY:rn.curveMonotoneY,step:rn.curveStep,stepAfter:rn.curveStepAfter,stepBefore:rn.curveStepBefore,basis:rn.curveBasis,cardinal:rn.curveCardinal,catmullRom:rn.curveCatmullRom};function kn(e,t,o,r){const n=[];return e.forEach((e,i)=>{let s;if(o){const n=o(e,i,r);s=null!=n?n:t(e,i,r)}else s=t(e,i,r);s&&n.push({node:s,annotation:e})}),function(e){const t=e.map((e,t)=>{return{p:e,i:t,emphasis:(o=e.annotation,"primary"===o?.emphasis||"secondary"===o?.emphasis?o.emphasis:null),confidence:yn(e.annotation),readingOrder:null,rank:1};var o}),o=t.some(e=>null!=e.emphasis||null!=e.confidence),r=e.some(e=>gn(e.annotation)),n=e.some(e=>null!=mn(e.annotation)),i=e.some(e=>"layer"===mn(e.annotation));if(!o&&!r&&!n)return e.map(e=>e.node);const s=t.filter(e=>null==e.emphasis&&null!=e.confidence).slice().sort((e,t)=>(t.confidence??0)-(e.confidence??0)||e.i-t.i);s.forEach((e,t)=>{e.readingOrder=t,e.rank=2-t/Math.max(1,s.length)});for(const e of t)e.emphasis&&(e.rank=pn[e.emphasis]);const a=t.sort((e,t)=>e.rank-t.rank||e.i-t.i).map(e=>{const{p:t,i:o,emphasis:r,readingOrder:n}=e,i=gn(t.annotation);let s=t.node;if("primary"===r||"secondary"===r||null!=n){const e=null==r&&null!=n;s=(0,hn.jsx)("g",{className:e?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+r,..."secondary"===r?{opacity:.6,fontSize:"0.88em"}:{},...e?{opacity:bn(n),"data-annotation-reading-order":n}:{},children:t.node},"annotation-emphasis-"+o)}const a=mn(t.annotation);return a&&(s=(0,hn.jsx)("g",{className:"annotation-cohesion--"+a,children:s},"annotation-cohesion-"+o)),i&&(s=(0,hn.jsx)("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:s},"annotation-deferred-"+o)),s});return r&&a.unshift((0,hn.jsx)("style",{children:fn},"annotation-disclosure-style")),i&&a.unshift((0,hn.jsx)("style",{children:".annotation-cohesion--layer text,.annotation-cohesion--layer tspan{fill:var(--semiotic-annotation-color,var(--semiotic-text-secondary,#666));font-style:italic}"},"annotation-cohesion-style")),a}(n)}function wn(e){return function(e,t,o){switch(e.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const r=un(e,t,o);if(!r)return null;const{x:n,y:i}=r;if(!dn(n,i,o))return null;const s="callout"===e.type?"callout-circle":e.type,a="callout-circle"===s?{radius:e.radius??12,radiusPadding:e.radiusPadding}:"callout-rect"===s?{width:e.width,height:e.height}:void 0;return(0,vn.jsx)(tn,{noteData:{x:n,y:i,dx:e.dx??30,dy:e.dy??-30,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:s,...a?{subject:a}:{},connector:e.connector||{end:"arrow"},color:e.color,disable:e.disable,opacity:e.opacity,strokeDasharray:e.strokeDasharray,className:e.className}},"ann-"+t)}case"x-threshold":{const r=sn(null!=e.value?{...e,x:e.value}:e,o);if(null==r)return null;const n=e.color||"#f97316",i=e.labelPosition||"top";let s;s="bottom"===i?(o.height||0)-4:"center"===i?(o.height||0)/2:12;const a=r>.6*(o.width||0),l=a?r-4:r+4,c=a?"end":"start";return(0,vn.jsxs)("g",{opacity:e.opacity,children:[(0,vn.jsx)("line",{x1:r,y1:0,x2:r,y2:o.height||0,stroke:n,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,vn.jsx)("text",{x:l,y:s,textAnchor:c,fill:n,fontSize:12,fontWeight:"bold",stroke:"var(--semiotic-bg, #ffffff)",strokeWidth:3,paintOrder:"stroke",children:e.label})]},"ann-"+t)}case"y-threshold":{const r=an(null!=e.value?{...e,y:e.value}:e,o);if(null==r)return null;const n=e.color||"#f97316",i=e.labelPosition||"right";let s,a;return"left"===i?(s=4,a="start"):"center"===i?(s=(o.width||0)/2,a="middle"):(s=(o.width||0)-4,a="end"),(0,vn.jsxs)("g",{opacity:e.opacity,children:[(0,vn.jsx)("line",{x1:0,y1:r,x2:o.width||0,y2:r,stroke:n,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,vn.jsx)("text",{x:s,y:r-4,textAnchor:a,fill:n,fontSize:12,fontWeight:"bold",stroke:"var(--semiotic-bg, #ffffff)",strokeWidth:3,paintOrder:"stroke",children:e.label})]},"ann-"+t)}case"enclose":{const r=(e.coordinates||[]).map(e=>({x:sn({...e,type:"point"},o),y:an({...e,type:"point"},o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const n=(0,on.packEnclose)(r),i=e.padding||10;return(0,vn.jsxs)("g",{children:[(0,vn.jsx)("circle",{cx:n.x,cy:n.y,r:n.r+i,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&(0,vn.jsx)("text",{x:n.x,y:n.y-n.r-i-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:e.label})]},"ann-"+t)}case"rect-enclose":{const r=(e.coordinates||[]).map(e=>({x:sn({...e,type:"point"},o),y:an({...e,type:"point"},o)})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const n=e.padding||10,i=r.map(e=>e.x),s=r.map(e=>e.y),[a,l]=u(i),[c,d]=u(s),h=a-n,p=l+n,f=c-n;return(0,vn.jsxs)("g",{children:[(0,vn.jsx)("rect",{x:h,y:f,width:p-h,height:d+n-f,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&(0,vn.jsx)("text",{x:(h+p)/2,y:f-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:e.label})]},"ann-"+t)}case"highlight":{const r=o.data||[],n="function"==typeof e.filter?r.filter(e.filter):e.field&&null!=e.value?r.filter(t=>t[e.field]===e.value):[],i={stroke:e.color||"#f97316",strokeWidth:2,fill:"none"};return(0,vn.jsx)("g",{children:n.map((t,r)=>{const n=sn(t,o),s=an(t,o);if(null==n||null==s)return null;const a="function"==typeof e.r?e.r(t):e.r||6,l="function"==typeof e.style?e.style(t):e.style||i;return(0,vn.jsx)("circle",{cx:n,cy:s,r:a,...l},"hl-"+r)})},"ann-"+t)}case"bracket":{const r=sn(e,o),n=an(e,o);return(0,vn.jsx)(tn,{noteData:{x:r??0,y:n??0,dx:e.dx||0,dy:e.dy||0,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"bracket",subject:{type:e.bracketType||"curly",width:e.width,height:e.height,depth:e.depth||30},color:e.color}},"ann-"+t)}case"trend":{const r=o.data||[];if(2>r.length)return null;const n=o.xAccessor||"x",i=o.yAccessor||"y",s="ordinal"===o.frameType,a="horizontal"===o.projection,l=s?n:null,c=s?i:null;let u;const d=[],h=new Map;if(s&&l&&c){for(const e of r){const t=e[l];if(null==t)continue;const o=t+"";h.has(o)||(h.set(o,d.length),d.push(o))}u=r.map(e=>{const t=e[l],o=e[c];if(null==t||null==o)return null;const r=h.get(t+"");return null!=r?[r,+o]:null}).filter(e=>null!==e)}else u=r.map(e=>[e[n],e[i]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>u.length)return null;const p=o.scales?.x??o.scales?.time,f=o.scales?.y??o.scales?.value;if(!p||!f)return null;const g=e=>t=>{const o=Math.max(0,Math.floor(t)),r=Math.min(d.length-1,o+1),n=t-o,i=e(d[o]);return i+(e(d[r])-i)*n},m=p,y=f;let b;if(s)if(a){const e=g(y);b=(t,o)=>[m(o),e(t)]}else{const e=g(m);b=(t,o)=>[e(t),y(o)]}else b=(e,t)=>[m(e),y(t)];const v=e.method||"linear";let x;x="loess"===v?function(e,t=.3){const o=e.length;if(2>o)return e.slice();const r=e.slice().sort((e,t)=>e[0]-t[0]),n=r.map(e=>e[0]),i=r.map(e=>e[1]),s=Math.max(2,Math.ceil(t*o)),a=[];for(let e=0;o>e;e++){const t=n[e],r=n.map(e=>Math.abs(e-t)),l=r.slice().sort((e,t)=>e-t)[Math.min(s-1,o-1)]||1,c=[];for(let e=0;o>e;e++){const t=0===l?0:r[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,p=0,f=0;for(let e=0;o>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*n[e],h+=t*i[e],p+=t*n[e]*n[e],f+=t*n[e]*i[e])}if(0===u){a.push([t,i[e]]);continue}const g=u*p-d*d;if(1e-12>Math.abs(g))a.push([t,h/u]);else{const e=(u*f-d*h)/g;a.push([t,(h-e*d)/u+e*t])}}return a}(u,e.bandwidth??.3):("polynomial"===v?nn.default.polynomial(u,{order:e.order||2}):nn.default.linear(u)).points;const k=x.map(([e,t])=>{const[o,r]=b(e,t);return`${o},${r}`}).join(" "),w=e.color||"#6366f1",S=x[x.length-1],[A,C]=b(S[0],S[1]);return(0,vn.jsxs)("g",{children:[(0,vn.jsx)("polyline",{points:k,fill:"none",stroke:w,strokeWidth:e.strokeWidth||2,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,vn.jsx)("text",{x:A+4,y:C-4,fill:w,fontSize:11,children:e.label})]},"ann-"+t)}case"band":{const r=o.scales?.y??o.scales?.value,n=r?.(e.y0)??0,i=r?.(e.y1)??(o.height||0);return(0,vn.jsxs)("g",{opacity:e.opacity,children:[(0,vn.jsx)("rect",{x:0,y:Math.min(n,i),width:o.width||0,height:Math.abs(i-n),fill:e.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:e.fillOpacity||.1}),e.label&&(0,vn.jsx)("text",{x:(o.width||0)-4,y:Math.max(Math.min(n,i),0)+13,textAnchor:"end",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",stroke:"var(--semiotic-bg, #ffffff)",strokeWidth:3,paintOrder:"stroke",children:e.label})]},"ann-"+t)}case"x-band":{const r=o.scales?.x??o.scales?.time,n=null!=e.x0&&r?r(e.x0):null,i=null!=e.x1&&r?r(e.x1):null;return null==n||null==i?null:(0,vn.jsxs)("g",{opacity:e.opacity,children:[(0,vn.jsx)("rect",{x:Math.min(n,i),y:0,width:Math.abs(i-n),height:o.height||0,fill:e.fill||e.color||"var(--semiotic-primary, #6366f1)",fillOpacity:e.fillOpacity??.1}),e.label&&(0,vn.jsx)("text",{x:Math.min(n,i)+4,y:13,textAnchor:"start",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",stroke:"var(--semiotic-bg, #ffffff)",strokeWidth:3,paintOrder:"stroke",children:e.label})]},"ann-"+t)}case"envelope":{const r=o.data||[];if(2>r.length)return null;const n=o.xAccessor||"x",i=o.scales?.x??o.scales?.time,s=o.scales?.y??o.scales?.value;if(!i||!s)return null;const a=e.upperAccessor||"upperBounds",l=e.lowerAccessor||"lowerBounds",c=e.filter,u=r.filter(e=>null!=e[a]&&null!=e[l]&&!(c&&!c(e))).sort((e,t)=>e[n]-t[n]);if(2>u.length)return null;const d=xn[o.curve||"linear"]||rn.curveLinear,h=(0,rn.area)().x(e=>i(e[n])).y0(e=>s(e[l])).y1(e=>s(e[a])).curve(d)(u);if(!h)return null;const p=e.fill||"#6366f1";return(0,vn.jsxs)("g",{children:[(0,vn.jsx)("path",{d:h,fill:p,fillOpacity:e.fillOpacity??.15,stroke:"none"}),e.label&&u.length>0&&(0,vn.jsx)("text",{x:i(u[u.length-1][n])+4,y:s(u[u.length-1][a])-4,fill:p,fontSize:11,children:e.label})]},"ann-"+t)}case"anomaly-band":{const r=o.data||[];if(2>r.length)return null;const n=o.yAccessor||"y",i=o.scales?.x??o.scales?.time,s=o.scales?.y??o.scales?.value;if(!i||!s)return null;const a=r.map(e=>e[n]).filter(e=>null!=e&&isFinite(e));if(2>a.length)return null;const l=a.reduce((e,t)=>e+t,0)/a.length,c=a.reduce((e,t)=>e+(t-l)**2,0)/a.length,u=Math.sqrt(c),d=e.threshold??2,h=l-d*u,p=!1!==e.showBand,f=e.fill||"#6366f1",g=e.fillOpacity??.1,m=e.anomalyColor||"#ef4444",y=e.anomalyRadius??6,b=s(l+d*u),v=s(h),x=r.filter(e=>{const t=e[n];return null!=t&&Math.abs(t-l)>d*u});return(0,vn.jsxs)("g",{children:[p&&(0,vn.jsx)("rect",{x:0,y:Math.min(b,v),width:o.width||0,height:Math.abs(v-b),fill:f,fillOpacity:g}),x.map((e,t)=>{const r=sn(e,o),n=an(e,o);return null==r||null==n?null:(0,vn.jsx)("circle",{cx:r,cy:n,r:y,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5},"anomaly-"+t)}),e.label&&(0,vn.jsx)("text",{x:(o.width||0)-4,y:Math.min(b,v)-4,textAnchor:"end",fill:f,fontSize:11,children:e.label})]},"ann-"+t)}case"forecast":{const r=o.data||[];if(3>r.length)return null;const n=o.xAccessor||"x",i=o.yAccessor||"y",s=o.scales?.x??o.scales?.time,a=o.scales?.y??o.scales?.value;if(!s||!a)return null;const l=r.map(e=>[e[n],e[i]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>l.length)return null;let c;if("polynomial"===(e.method||"linear")){const t=nn.default.polynomial(l,{order:e.order||2}).equation;c=e=>t.reduce((t,o,r)=>t+o*Math.pow(e,r),0)}else{const e=l.length;let t=0,o=0,r=0,n=0;for(const[e,i]of l)t+=e,o+=i,r+=e*e,n+=e*i;const i=e*r-t*t;if(1e-12>Math.abs(i))return null;const s=(e*n-t*o)/i,a=(o-s*t)/e;c=e=>a+s*e}const u=l.length,d=l.map(([e,t])=>t-c(e)).reduce((e,t)=>e+t*t,0),h=Math.sqrt(d/Math.max(u-2,1)),p=l.reduce((e,t)=>e+t[0],0)/u,f=l.reduce((e,t)=>e+(t[0]-p)**2,0),g=e.confidence??.95,m=.99>g?.95>g?.9>g?1:1.645:1.96:2.576,y=e.steps??5,b=l[u-1][0],v=(b-l[0][0])/Math.max(u-1,1),x=[];for(let e=1;y>=e;e++)x.push(b+e*v);const k=[];for(const e of x){const t=c(e),o=h*Math.sqrt(1+1/u+(f>0?(e-p)**2/f:0))*m;k.push({x:e,yCenter:t,yUpper:t+o,yLower:t-o})}const w=`M${k.map(e=>`${s(e.x)},${a(e.yUpper)}`).join(" L")} L${k.slice().reverse().map(e=>`${s(e.x)},${a(e.yLower)}`).join(" L")} Z`,S=k.map(e=>`${s(e.x)},${a(e.yCenter)}`).join(" "),A=`${s(b)},${a(c(b))}`,C=e.strokeColor||"#6366f1";return(0,vn.jsxs)("g",{children:[(0,vn.jsx)("path",{d:w,fill:e.fill||"#6366f1",fillOpacity:e.fillOpacity??.15,stroke:"none"}),(0,vn.jsx)("polyline",{points:`${A} ${S}`,fill:"none",stroke:C,strokeWidth:e.strokeWidth??2,strokeDasharray:e.strokeDasharray??"6,3"}),e.label&&k.length>0&&(0,vn.jsx)("text",{x:s(k[k.length-1].x)+4,y:a(k[k.length-1].yCenter)-4,fill:C,fontSize:11,children:e.label})]},"ann-"+t)}case"widget":{let r,n;if(null!=e.px&&null!=e.py)r=e.px,n=e.py;else{const i=un(e,t,o);if(!i)return null;r=i.x,n=i.y}if(!dn(r,n,o))return null;const i=e.width??32,s=e.height??32;return(0,vn.jsx)("foreignObject",{x:r+(e.dx??0)-i/2,y:n+(e.dy??0)-s/2,width:i,height:s,style:{overflow:"visible",pointerEvents:"auto"},children:(0,vn.jsx)("div",{style:{width:i,height:s,display:"flex",alignItems:"center",justifyContent:"center"},children:e.content??(0,vn.jsx)("span",{style:{fontSize:18,cursor:"default"},title:e.label||"Info",children:"ℹ️"})})},"ann-"+t)}case"text":{const r=un(e,t,o);if(!r)return null;const{x:n,y:i}=r,s=n+(e.dx||0),a=i+(e.dy||0),l=e.color||"var(--semiotic-text, #333)",c=(0,vn.jsx)("text",{x:s,y:a,fill:l,fontSize:e.fontSize||11,opacity:e.opacity,strokeDasharray:e.strokeDasharray,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:e.label});return!0!==e._redundantConnector?Vr.cloneElement(c,{key:"ann-text-"+t}):(0,vn.jsxs)("g",{opacity:e.opacity,strokeDasharray:e.strokeDasharray,children:[(0,vn.jsx)("line",{x1:n,y1:i,x2:s,y2:a,stroke:l,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),Vr.cloneElement(c,{opacity:void 0,strokeDasharray:void 0})]},"ann-text-"+t)}case"category-highlight":{const r=e.category;if(null==r)return null;const n=e=>"function"==typeof e&&"function"==typeof e.bandwidth,i=o.scales?.o,s=o.scales?.x,a=o.scales?.y,l=n(i)?i:n(s)?s:n(a)?a:null;if(!l)return null;const c=l(r+"");if(null==c)return null;const u=l.bandwidth(),d=e.color||"var(--semiotic-primary, #4589ff)",h=e.opacity??.15,p=e.label;return(0,vn.jsxs)("g",(o.projection?"vertical"===o.projection:l===s)?{children:[(0,vn.jsx)("rect",{x:c,y:0,width:u,height:o.height||0,fill:d,fillOpacity:h}),p&&(0,vn.jsx)("text",{x:c+u/2,y:12,textAnchor:"middle",fill:d,fontSize:12,fontWeight:"bold",children:p})]}:{children:[(0,vn.jsx)("rect",{x:0,y:c,width:o.width||0,height:u,fill:d,fillOpacity:h}),p&&(0,vn.jsx)("text",{x:12,y:c+u/2,dominantBaseline:"middle",fill:d,fontSize:12,fontWeight:"bold",children:p})]},"ann-"+t)}default:return null}}}var Sn=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function An(e){return!!e&&"object"==typeof e&&Sn.has(function(e){return"string"==typeof e?.type?e.type:""}(e))}function Cn(e){return"primary"===e?.emphasis||!0===e?.defensive}function Mn(e,t,o={}){return"number"==typeof o.maxAnnotations&&Number.isFinite(o.maxAnnotations)?Math.max(0,Math.floor(o.maxAnnotations)):e>0&&t>0?Math.max(1,Math.round(e*t/(o.areaPerAnnotation&&o.areaPerAnnotation>0?o.areaPerAnnotation:2e4))):1/0}function jn(e){let t;const o=e?.emphasis;t="primary"===o?100:"secondary"===o?10:50;const r=e?.provenance?.confidence;switch("number"==typeof r&&Number.isFinite(r)&&(t+=15*Math.max(0,Math.min(1,r))),e?.lifecycle?.freshness){case"fresh":t+=8;break;case"aging":t+=4;break;case"stale":t+=1;break;case"expired":t-=200}return t}new Set(["label","callout","callout-circle","callout-rect"]);var Pn=32,_n=6,Ln=4,Rn=8,Tn=72;var In={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function $n(e){if(!Nn(e))return e;const t=("string"==typeof e.mobileText?e.mobileText:void 0)??("string"==typeof e.shortText?e.shortText:void 0);return!t||"string"!=typeof e.label&&null!=e.label?e:{...e,label:t}}function Nn(e){return An(e)}function Fn(e,t){if(!e)return[];const o=Math.max(1,Math.floor(t/7)),r=e.split(/\s+/).filter(Boolean),n=[];let i="";for(const e of r)i&&i.length+e.length+1>o?(n.push(i),i=e):i=i?`${i} ${e}`:e;return i&&n.push(i),n}function Bn(e,t,o,r,n){const i=e+o,s=t+r;return Math.abs(o)>Math.abs(r)?{x:0>o?i-n.width-4:i+4,y:0>r?s-n.height:s,width:n.width,height:n.height}:{x:0>o?i-n.width:i,y:0>r?s-n.height-4:s+4,width:n.width,height:n.height}}function Dn(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function En(e,t){return Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x))*Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y))}function zn(e,t,o,r,n,i,s,a){const l=Dn(e,s);let c=.4*Math.hypot(t.dx,t.dy)+80*function(e,t,o,r){const n=Math.max(0,r-e.x),i=Math.max(0,r-e.y);return(n+Math.max(0,e.x+e.width-(t-r)))*e.height+(i+Math.max(0,e.y+e.height-(o-r)))*e.width}(l,n,i,a);for(const e of o)c+=12*En(l,e);for(const e of r)c+=4*En(l,e);return c}function Hn(e){const{annotations:t,context:o,defaultOffset:r=Pn,notePadding:n=_n,markPadding:i=Ln,edgePadding:s=Rn,preserveManualOffsets:a=!0,routeLongConnectors:l=!0,connectorThreshold:c=Tn,density:u,progressiveDisclosure:d=!1,redundantCues:h=!1,responsive:p,mobile:f,cohesion:g,audience:m}=e,y=o.width||0,b=o.height||0,v="object"==typeof f?f:{},x=v.breakpoint??480,k=!!f&&x>=y,w=k&&!1!==v.preferShortText?t.map($n):t,S=k&&!u?{maxAnnotations:v.maxAnnotations??("callout-list"===v.strategy?1:2),minVisible:v.minVisible??1}:u,A=d||k&&(!1!==v.progressiveDisclosure||"callout-list"===v.strategy),C=k&&!p?v.responsive??{minWidth:x}:p,M=k&&!g?v.cohesion:g;if(0===w.length||0>=y||0>=b)return w.slice();const j=[],P=function(e,t){return(e.pointNodes||[]).map(e=>{const o=Math.max(1,e.r||1)+t;return{x:e.x-o,y:e.y-o,width:2*o,height:2*o}})}(o,i);let _=!1;const L=w.map((e,t)=>{if(!Nn(e))return e;const i=function(e,t,o){if("widget"===e.type&&"number"==typeof e.px&&"number"==typeof e.py)return{x:e.px,y:e.py};const r=e.pointId??e.nodeId;if(null!=r&&o.pointNodes){const e=o.pointNodes.find(e=>e.pointId===r);if(e)return{x:e.x,y:e.y}}const n=e.coordinates,i=o.scales?.geoProjection;if(Array.isArray(n)&&n.length>=2&&i){const e=n[0],t=n[1];if("number"==typeof e&&"number"==typeof t){const o=i([e,t]);if(o&&"number"==typeof o[0]&&"number"==typeof o[1])return{x:o[0],y:o[1]}}}return o.scales||"number"!=typeof e.x||"number"!=typeof e.y?un(e,t,o):{x:e.x,y:e.y}}(e,t,o);if(!i)return e;const u=function(e){if("widget"===e.type)return{width:"number"==typeof e.width?e.width:32,height:"number"==typeof e.height?e.height:32};const t="number"==typeof e.wrap?e.wrap:120,o=[...Fn("string"==typeof e.title?e.title:void 0,t),...Fn("string"==typeof e.label?e.label:void 0,t)],r=o.reduce((e,t)=>Math.max(e,t.length),0);return{width:Math.max(24,Math.min(t,7*r)+10),height:Math.max(18,16*o.length+6)}}(e);if(a&&("number"==typeof(d=e).dx||"number"==typeof d.dy)){const t=function(e){return"text"===e.type||"widget"===e.type?{dx:0,dy:0}:{dx:30,dy:-30}}(e);return j.push(Dn(Bn(i.x,i.y,"number"==typeof e.dx?e.dx:t.dx,"number"==typeof e.dy?e.dy:t.dy,u),n)),e}var d;let h=null,p=1/0;for(const e of function(e){const t=1.6*e;return[{dx:e,dy:-e},{dx:-e,dy:-e},{dx:e,dy:e},{dx:-e,dy:e},{dx:e,dy:0},{dx:-e,dy:0},{dx:0,dy:-e},{dx:0,dy:e},{dx:t,dy:-t},{dx:-t,dy:-t},{dx:t,dy:t},{dx:-t,dy:t}]}(r)){const t=zn(Bn(i.x,i.y,e.dx,e.dy,u),e,j,P,y,b,n,s);p>t&&(h=e,p=t)}if(!h)return e;const f=Dn(Bn(i.x,i.y,h.dx,h.dy,u),n);j.push(f);const g=Math.hypot(h.dx,h.dy),m=l&&g>=c&&"text"!==e.type&&"widget"!==e.type?{...e.connector||{end:"arrow"},type:"curve"}:e.connector;return _=!0,{...e,dx:h.dx,dy:h.dy,...m?{connector:m}:{}}}),R=_?L:w.slice();let T=R;if(h){let e=!1;const t=R.map(t=>{const o=function(e){return"text"!==e.type||"string"!=typeof e.color||8>Math.hypot("number"==typeof e.dx?e.dx:0,"number"==typeof e.dy?e.dy:0)?e:{...e,_redundantConnector:!0}}(t);return o!==t&&(e=!0),o});T=e?t:R}{let e=!1;const t=T.map(t=>{if(!0!==t?.defensive)return t;const o=function(e){const t=e?.provenance;if(!t||"object"!=typeof t)return e;const o="string"==typeof t.source?In[t.source]??t.source:null,r="number"==typeof t.confidence&&Number.isFinite(t.confidence)?Math.round(100*Math.max(0,Math.min(1,t.confidence)))+"%":null;if(!o&&!r)return e;if(null!=e.label&&"string"!=typeof e.label)return e;const n=[o,r].filter(Boolean).join(" · "),i="string"==typeof e.label?e.label:"";return i.includes(`(${n})`)?e:{...e,label:i?`${i} (${n})`:`(${n})`}}(t);return o!==t&&(e=!0),o});T=e?t:T}const I=new Set;if(S){const e="object"==typeof S?S:{},t=function(e){if(!e)return 1;const t=function(e){const t=e?.familiarity;if(!t)return 3;const o=Object.values(t).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0===o.length?3:o.reduce((e,t)=>e+t,0)/o.length}(e);return t>2?4>t?1:.6:1.5}(m),o=1===t?e:{...e,maxAnnotations:Math.max(0,Math.round((e.maxAnnotations??Mn(y,b,e))*t))},{deferred:r}=function(e){const{annotations:t,width:o,height:r}=e,n=Math.max(0,e.minVisible??1),i=Mn(o,r,e),s=t.map((e,t)=>{return{annotation:e,index:t,note:(o=e,An(o))};var o}),a=s.filter(e=>e.note);if(0===a.length||i>=a.length)return{visible:t.slice(),deferred:[],budget:i};const l=a.filter(e=>Cn(e.annotation)),c=a.filter(e=>!Cn(e.annotation)).sort((e,t)=>jn(t.annotation)-jn(e.annotation)||e.index-t.index),u=Math.min(c.length,Math.max(Math.max(0,i-l.length),Math.max(0,n-l.length))),d=new Set([...l.map(e=>e.index),...c.slice(0,u).map(e=>e.index)]),h=[],p=[];for(const{annotation:e,index:t,note:o}of s)!o||d.has(t)?h.push(e):p.push(e);return{visible:h,deferred:p,budget:i}}({annotations:T,width:y,height:b,...o});for(const e of r)I.add(e)}if(C&&("object"==typeof C&&"number"==typeof C.minWidth?C.minWidth:480)>=y)for(const e of T)Nn(e)&&"secondary"===e.emphasis&&I.add(e);if(I.size>0)for(const e of T)!0===e?.defensive&&I.delete(e);let $;return $=0===I.size?T:A?T.map(e=>I.has(e)?{...e,_annotationDeferred:!0}:e):T.filter(e=>!I.has(e)),M?function(e,t){let o=!1;const r=e.map(e=>Nn(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(o=!0,{...e,cohesion:t}):e);return o?r:e}($,M):$}var On=require("react"),Wn={positions:new Map},qn=new Set;function Yn(){for(const e of qn)e()}function Gn(e,t){const o=Wn.positions.get(e);if(o?.locked)return;if(!o||o.sourceId!==t)return;const r=new Map(Wn.positions);r.delete(e),Wn={positions:r},Yn()}function Vn(e,t){const o=Wn.positions.get(e);if(!o?.locked)return;if(t&&o.sourceId!==t)return;const r=new Map(Wn.positions);r.delete(e),Wn={positions:r},Yn()}function Xn(){return Wn}function Un(e){return qn.add(e),()=>qn.delete(e)}var Kn={positions:new Map};function Qn(){return()=>{}}function Zn(){return Kn}function Jn(e,t,o){return"exact"===o?function(e,t){const o=e.domain(),r=o[0],n=o[o.length-1],i=r instanceof Date,s=r instanceof Date?r.getTime():r,a=n instanceof Date?n.getTime():n;if(2>t||s===a)return i?[new Date(s),new Date(a)]:[s,a];const l=(a-s)/(t-1),c=Array(t);for(let e=0;t>e;e++){const o=e===t-1?a:s+e*l;c[e]=i?new Date(o):o}return c}(e,t):e.ticks(t)}var ei=require("react/jsx-runtime");function ti(e,t,o){if("edges"===e){if(t)return"start";if(o)return"end"}return"middle"}function oi(e,t,o){if("edges"===e){if(t)return"hanging";if(o)return"auto"}return"middle"}function ri(e){if(0===e.length)return{min:null,max:null};let t=1/0,o=-1/0;for(const r of e)t>r.pixel&&(t=r.pixel),r.pixel>o&&(o=r.pixel);return{min:t,max:o}}function ni(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function ii(e,t,o){if("left"===e||"right"===e){const r="left"===e?o:0,n="left"===e?-1:1,i=Math.ceil(t/8);let s="M0,"+r;for(let e=0;i>e;e++){const o=8*(e+1);s+=`L${Math.min(8*e+4,t)},${r+4*n}`,s+=`L${Math.min(o,t)},${r}`}return s}{const r="bottom"===e?0:t,n="bottom"===e?1:-1,i=Math.ceil(o/8);let s=`M${r},0`;for(let e=0;i>e;e++){const t=8*(e+1);s+=`L${r+4*n},${Math.min(8*e+4,o)}`,s+=`L${r},${Math.min(t,o)}`}return s}}function si(e){const{width:t,height:o,totalWidth:r,totalHeight:n,margin:i,scales:s,showAxes:a,axes:l,showGrid:c,xFormat:u,yFormat:d,axisExtent:h}=e,p=(0,Sr.useMemo)(()=>{if(!s)return[];const e=l?.find(e=>"bottom"===e.orient),o=e?.tickFormat||u||ai,r=Math.max(2,Math.floor(t/70)),n=e?.ticks??5,i="exact"===h?Math.max(2,n):Math.min(n,r),a=e?.tickValues??Jn(s.x,i,h),c=a.map(e=>e.valueOf()),d=a.map((e,t)=>({value:e,pixel:s.x(e),label:o(e,t,c)})),p=d.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0);return li(d,Math.max(55,p+8))},[s,l,u,t,h]),f=(0,Sr.useMemo)(()=>{if(!s)return[];const e=l?.find(e=>"left"===e.orient),t=e?.tickFormat||d||ai,r=Math.max(2,Math.floor(o/30)),n=e?.ticks??5,i="exact"===h?Math.max(2,n):Math.min(n,r);return li((e?.tickValues??Jn(s.y,i,h)).map(e=>({value:e,pixel:s.y(e),label:t(e)})),22)},[s,l,d,o,h]),g=c&&s,m=a&&s;if(!g&&!m)return null;const y=l?.find(e=>"bottom"===e.orient),b=l?.find(e=>"left"===e.orient),v=m&&(!y||!1!==y.baseline),x=m&&(!b||!1!==b.baseline),k=y?.jaggedBase||!1,w=b?.jaggedBase||!1,S="var(--semiotic-border, #ccc)";return(0,ei.jsx)("svg",{width:r,height:n,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:(0,ei.jsxs)("g",{transform:`translate(${i.left},${i.top})`,children:[g&&(()=>{const e=ni(l?.find(e=>"bottom"===e.orient)?.gridStyle),r=ni(l?.find(e=>"left"===e.orient)?.gridStyle);return(0,ei.jsxs)("g",{className:"stream-grid",children:[p.map((t,r)=>(0,ei.jsx)("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:o,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:e},"xgrid-"+r)),f.map((e,o)=>(0,ei.jsx)("line",{x1:0,y1:e.pixel,x2:t,y2:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:r},"ygrid-"+o))]})})(),v&&!k&&(0,ei.jsx)("line",{x1:0,y1:o,x2:t,y2:o,stroke:S,strokeWidth:1}),k&&(0,ei.jsx)("path",{d:ii("bottom",t,o),fill:"none",stroke:S,strokeWidth:1}),x&&!w&&(0,ei.jsx)("line",{x1:0,y1:0,x2:0,y2:o,stroke:S,strokeWidth:1}),w&&(0,ei.jsx)("path",{d:ii("left",t,o),fill:"none",stroke:S,strokeWidth:1})]})})}function ai(e,t,o){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function li(e,t){if(2>=e.length)return e;const o=[e[0]];for(let r=1;e.length-1>r;r++)t>Math.abs(e[r].pixel-o[o.length-1].pixel)||o.push(e[r]);const r=e[e.length-1];return t>Math.abs(r.pixel-o[o.length-1].pixel)?o[o.length-1]=r:o.push(r),o}function ci(e){const{width:t,height:o,totalWidth:r,totalHeight:n,margin:i,scales:s,showAxes:a,axes:l,xLabel:c,yLabel:u,yLabelRight:d,xFormat:h,yFormat:p,axisExtent:f,showGrid:g,title:m,legend:y,legendHoverBehavior:b,legendClickBehavior:v,legendHighlightedCategory:x,legendIsolatedCategories:k,legendPosition:w="right",legendLayout:S,foregroundGraphics:A,marginalGraphics:C,xValues:M,yValues:j,annotations:P,autoPlaceAnnotations:_,svgAnnotationRules:L,xAccessor:R,yAccessor:T,annotationData:I,pointNodes:$,curve:N,underlayRendered:F,canvasObscuresUnderlay:B=!0,linkedCrosshairName:D,linkedCrosshairSourceId:E,children:z}=e,H=(0,Sr.useMemo)(()=>{if(!a||!s)return[];const e=l?.find(e=>"bottom"===e.orient),o=e?.tickFormat||h||ai,r=Math.max(2,Math.floor(t/70)),n=e?.ticks??5,i="exact"===f?Math.max(2,n):Math.min(n,r),c=e?.tickValues??Jn(s.x,i,f),u=c.map(e=>e.valueOf()),d=c.map((e,t)=>({value:e,pixel:s.x(e),label:o(e,t,u)})),p=d.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0),g=e?.autoRotate?Math.max(20,Math.min(p+8,55)):Math.max(55,p+8);let m=li(d,g);if(m.length>1&&(m=m.filter((e,t)=>0===t||e.label+""!=m[t-1].label+"")),e?.includeMax&&m.length>0&&"exact"!==f&&!e?.tickValues){const e=s.x.domain()[1],t=s.x(e),r=m[m.length-1].pixel;if(Math.abs(t-r)>1){const n=o(e,m.length,u);g>t-r&&m.length>1&&(m=m.slice(0,-1)),m.push({value:e,pixel:t,label:n})}}return m},[a,s,l,h,t,f]),O=(0,Sr.useMemo)(()=>{if(!a||!s)return[];const e=l?.find(e=>"left"===e.orient),t=e?.tickFormat||p||ai,r=Math.max(2,Math.floor(o/30)),n=e?.ticks??5,i="exact"===f?Math.max(2,n):Math.min(n,r);let c=li((e?.tickValues??Jn(s.y,i,f)).map(e=>({value:e,pixel:s.y(e),label:t(e)})),22);if(c.length>1&&(c=c.filter((e,t)=>0===t||e.label+""!=c[t-1].label+"")),e?.includeMax&&c.length>0&&"exact"!==f&&!e?.tickValues){const e=s.y.domain()[1],o=s.y(e),r=c[c.length-1].pixel;if(Math.abs(o-r)>1){const n=t(e);22>Math.abs(o-r)&&c.length>1&&(c=c.slice(0,-1)),c.push({value:e,pixel:o,label:n})}}return c},[a,s,l,p,o,f]),W=(0,Sr.useMemo)(()=>{if(!a||!s)return[];const e=l?.find(e=>"right"===e.orient);if(!e)return[];const t=e.tickFormat||p||ai,r=Math.max(2,Math.floor(o/30)),n=e.ticks??5;return li((e.tickValues??Jn(s.y,"exact"===f?Math.max(2,n):Math.min(n,r),f)).map(e=>({value:e,pixel:s.y(e),label:t(e)})),22)},[a,s,l,p,o,f]),q=(0,Sr.useRef)(new Map),Y=(0,Sr.useRef)(P?.length??0),G=P?.length??0;Y.current!==G&&(Y.current=G,q.current=new Map);const V=(0,Sr.useMemo)(()=>{if(!P||0===P.length)return null;const e=wn(),r={scales:s?{x:s.x,y:s.y,time:s.x,value:s.y}:null,timeAxis:"x",xAccessor:R,yAccessor:T,width:t,height:o,data:I,frameType:"xy",pointNodes:$,curve:N,stickyPositionCache:q.current};return kn(_?Hn({annotations:P,context:r,..."object"==typeof _?_:{}}):P,e,L,r)},[P,_,L,t,o,R,T,I,s,$,N]),X=function(e){const t=(0,On.useSyncExternalStore)(e?Un:Qn,e?Xn:Zn,e?Xn:Zn);return e?t.positions.get(e)??null:null}(D);return(0,Sr.useEffect)(()=>{if(!X?.locked||!D)return;const e=e=>{"Escape"===e.key&&Vn(D)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[X?.locked,D]),a||m||y||A||C||V&&V.length>0||g||z||X?(0,ei.jsxs)("svg",{role:"img",width:r,height:n,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[(0,ei.jsx)("title",{children:"string"==typeof m?m:"XY Chart"}),(0,ei.jsx)("desc",{children:"string"==typeof m?m+" — XY data visualization":"XY data visualization"}),(0,ei.jsxs)("g",{transform:`translate(${i.left},${i.top})`,children:[g&&s&&(!F||B)&&(()=>{const e=ni(l?.find(e=>"bottom"===e.orient)?.gridStyle),r=ni(l?.find(e=>"left"===e.orient)?.gridStyle);return(0,ei.jsxs)("g",{className:"stream-grid",children:[H.map((t,r)=>(0,ei.jsx)("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:o,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:e},"xgrid-"+r)),O.map((e,o)=>(0,ei.jsx)("line",{x1:0,y1:e.pixel,x2:t,y2:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:r},"ygrid-"+o))]})})(),a&&s&&(()=>{const e=l?.find(e=>"left"===e.orient),r=l?.find(e=>"bottom"===e.orient),n=!e||!1!==e.baseline,s=!r||!1!==r.baseline,a=e?.jaggedBase||!1,h=r?.jaggedBase||!1,p=r?.landmarkTicks,f=e?.landmarkTicks,g="var(--semiotic-border, #ccc)",m="var(--semiotic-text-secondary, var(--semiotic-text, #666))",y="var(--semiotic-text, #333)",b=!!r?.autoRotate&&H.length>1&&(()=>{const e=t/Math.max(H.length-1,1);return H.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0)+8>e})(),v=b?12:18,x=o+(b?58:40),k={fontSize:"var(--semiotic-tick-font-size, 12px)"},w={fontSize:"calc(var(--semiotic-tick-font-size, 12px) + 1px)"},S={fontSize:"var(--semiotic-axis-label-font-size, 12px)"},A=r?.tickAnchor,C=e?.tickAnchor,M=ri(H),j=ri(O);return(0,ei.jsxs)("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[(0,ei.jsxs)("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[(!F||B)&&s&&!h&&(0,ei.jsx)("line",{x1:0,y1:o,x2:t,y2:o,stroke:g,strokeWidth:1}),(!F||B)&&h&&(0,ei.jsx)("path",{d:ii("bottom",t,o),fill:"none",stroke:g,strokeWidth:1}),H.map((e,t)=>{const r=!!p&&("function"==typeof p?p(e.value,t):Ao(e.value,t>0?H[t-1].value:void 0));return(0,ei.jsxs)("g",{transform:`translate(${e.pixel},${o})`,children:[(0,ei.jsx)("line",{y2:5,stroke:g,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?(0,ei.jsx)("text",{y:v,textAnchor:b?"end":ti(A,e.pixel===M.min,e.pixel===M.max),fontWeight:r?600:400,fill:m,className:"semiotic-axis-tick",style:{userSelect:"none",...r?w:k},transform:b?"rotate(-45)":void 0,children:e.label}):(0,ei.jsx)("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:(0,ei.jsx)("div",{style:{textAlign:"center",userSelect:"none",...k},children:e.label})})]},"xtick-"+t)}),c&&(0,ei.jsx)("text",{x:t/2,y:x,textAnchor:"middle",fill:y,className:"semiotic-axis-label",style:{userSelect:"none",...S},children:c})]}),(0,ei.jsxs)("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[(!F||B)&&n&&!a&&(0,ei.jsx)("line",{x1:0,y1:0,x2:0,y2:o,stroke:g,strokeWidth:1}),(!F||B)&&a&&(0,ei.jsx)("path",{d:ii("left",t,o),fill:"none",stroke:g,strokeWidth:1}),O.map((e,t)=>{const o=!!f&&("function"==typeof f?f(e.value,t):Ao(e.value,t>0?O[t-1].value:void 0));return(0,ei.jsxs)("g",{transform:`translate(0,${e.pixel})`,children:[(0,ei.jsx)("line",{x2:-5,stroke:g,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?(0,ei.jsx)("text",{x:-8,textAnchor:"end",dominantBaseline:oi(C,e.pixel===j.min,e.pixel===j.max),fontWeight:o?600:400,fill:m,className:"semiotic-axis-tick",style:{userSelect:"none",...o?w:k},children:e.label}):(0,ei.jsx)("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:(0,ei.jsx)("div",{style:{textAlign:"right",userSelect:"none",...k},children:e.label})})]},"ytick-"+t)}),(()=>{const t=e?.label||u;return t?(0,ei.jsx)("text",{x:15-i.left,y:o/2,textAnchor:"middle",fill:y,transform:`rotate(-90, ${15-i.left}, ${o/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...S},children:t}):null})()]}),(()=>{const e=l?.find(e=>"right"===e.orient);if(!e||0===W.length)return null;const r=!1!==e.baseline,n=e.landmarkTicks,s=e.label||d,a=e.tickAnchor,c=ri(W);return(0,ei.jsxs)("g",{className:"semiotic-axis semiotic-axis-right","data-orient":"right",children:[r&&(0,ei.jsx)("line",{x1:t,y1:0,x2:t,y2:o,stroke:g,strokeWidth:1}),W.map((e,o)=>{const r=!!n&&("function"==typeof n?n(e.value,o):Ao(e.value,o>0?W[o-1].value:void 0));return(0,ei.jsxs)("g",{transform:`translate(${t},${e.pixel})`,children:[(0,ei.jsx)("line",{x2:5,stroke:g,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?(0,ei.jsx)("text",{x:8,textAnchor:"start",dominantBaseline:oi(a,e.pixel===c.min,e.pixel===c.max),fontWeight:r?600:400,fill:m,className:"semiotic-axis-tick",style:{userSelect:"none",...r?w:k},children:e.label}):(0,ei.jsx)("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:(0,ei.jsx)("div",{style:{textAlign:"left",userSelect:"none",...k},children:e.label})})]},"ytick-r-"+o)}),s&&(0,ei.jsx)("text",{x:t+i.right-15,y:o/2,textAnchor:"middle",fill:y,transform:`rotate(90, ${t+i.right-15}, ${o/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...S},children:s})]})})()]})})(),V,C&&s&&M&&j&&(0,ei.jsxs)(ei.Fragment,{children:[C.top&&(0,ei.jsx)("g",{transform:"translate(0, 0)",children:(0,ei.jsx)(Gr,{orient:"top",config:Yr(C.top),values:M,scale:s.x,size:i.top,length:t})}),C.bottom&&(0,ei.jsx)("g",{transform:`translate(0, ${o})`,children:(0,ei.jsx)(Gr,{orient:"bottom",config:Yr(C.bottom),values:M,scale:s.x,size:i.bottom,length:t})}),C.left&&(0,ei.jsx)("g",{transform:"translate(0, 0)",children:(0,ei.jsx)(Gr,{orient:"left",config:Yr(C.left),values:j,scale:s.y,size:i.left,length:o})}),C.right&&(0,ei.jsx)("g",{transform:`translate(${t}, 0)`,children:(0,ei.jsx)(Gr,{orient:"right",config:Yr(C.right),values:j,scale:s.y,size:i.right,length:o})})]}),A,X&&X.sourceId!==E&&s?.x&&(()=>{const e=s.x(X.xValue);if(null==e||0>e||e>t)return null;const r=X.locked;return(0,ei.jsx)("line",{x1:e,y1:0,x2:e,y2:o,stroke:r?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:r?1.5:1,strokeDasharray:r?"6,3":"4,4",pointerEvents:"none"})})(),z]}),m&&(0,ei.jsx)("text",{x:r/2,y:20,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:"string"==typeof m?m:null}),Hr({legend:y,totalWidth:r,totalHeight:n,margin:i,legendPosition:w,title:m,legendLayout:S,legendHoverBehavior:b,legendClickBehavior:v,legendHighlightedCategory:x,legendIsolatedCategories:k})]}):null}var ui=c(require("react")),di=require("d3-shape");function hi(e){return(e.tl??0)>0||(e.tr??0)>0||(e.br??0)>0||(e.bl??0)>0}function pi(e){const t=e.cornerRadii;if(!t)return{tl:0,tr:0,br:0,bl:0};const o=Math.min(e.w,e.h)/2,r=e=>Math.max(0,Math.min(e??0,o));return{tl:r(t.tl),tr:r(t.tr),br:r(t.br),bl:r(t.bl)}}var fi=(e,t)=>({x:e*Math.cos(t),y:e*Math.sin(t)});function gi(e){const{innerRadius:t,outerRadius:o,startAngle:r,endAngle:n}=e,i=0>=t;if(0>=(e.cornerRadius??0)||!e.roundStart&&!e.roundEnd){if(i){const e=fi(o,r),t=fi(o,n);return`M0,0 L${e.x},${e.y} A${o},${o} 0 ${n-r>Math.PI?1:0} 1 ${t.x},${t.y} Z`}const e=fi(o,r),s=fi(o,n),a=fi(t,n),l=fi(t,r),c=n-r>Math.PI?1:0;return`M${e.x},${e.y} A${o},${o} 0 ${c} 1 ${s.x},${s.y} L${a.x},${a.y} A${t},${t} 0 ${c} 0 ${l.x},${l.y} Z`}const s=Math.max(0,Math.min(e.cornerRadius??0,(o-t)/2));if(0===s)return gi({...e,cornerRadius:0,roundStart:!1,roundEnd:!1});const a=Math.asin(Math.min(1,s/Math.max(1e-9,o-s))),l=i?0:Math.asin(Math.min(1,s/Math.max(1e-9,t+s))),c=n-r,u=e.roundStart&&e.roundEnd?c/2:c,d=!!e.roundStart&&u>a,h=!!e.roundEnd&&u>a;if(!d&&!h)return gi({...e,cornerRadius:0,roundStart:!1,roundEnd:!1});const p=r+(d?a:0),f=n-(h?a:0),g=r+(d?l:0),m=n-(h?l:0),y=fi(o,p),b=fi(o,f),v=(o-s)*Math.cos(a),x=fi(v,r),k=fi(v,n),w=i?null:fi(t,m),S=i?null:fi(t,g),A=i?0:(t+s)*Math.cos(l),C=i?null:fi(A,r),M=i?null:fi(A,n),j=f-p>Math.PI?1:0,P=i?0:m-g>Math.PI?1:0;let _="";if(d)_+=`M${x.x},${x.y}`,_+=` A${s},${s} 0 0 1 ${y.x},${y.y}`;else{const e=fi(o,r);_+=`M${e.x},${e.y}`}if(h)_+=` A${o},${o} 0 ${j} 1 ${b.x},${b.y}`,_+=` A${s},${s} 0 0 1 ${k.x},${k.y}`;else{const e=fi(o,n);_+=` A${o},${o} 0 ${j} 1 ${e.x},${e.y}`}if(i)_+=" L0,0";else{if(h)_+=` L${M.x},${M.y}`,_+=` A${s},${s} 0 0 1 ${w.x},${w.y}`;else{const e=fi(t,n);_+=` L${e.x},${e.y}`}if(d)_+=` A${t},${t} 0 ${P} 0 ${S.x},${S.y}`,_+=` A${s},${s} 0 0 1 ${C.x},${C.y}`;else{const e=fi(t,r);_+=` A${t},${t} 0 ${P} 0 ${e.x},${e.y}`}}return _+=" Z",_}function mi(e){const t=gi({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle,endAngle:e.endAngle,cornerRadius:e.cornerRadius,roundStart:e.roundStart,roundEnd:e.roundEnd}),o=[],r=e.colors;if(r.length>0){const t=(e.endAngle-e.startAngle)/r.length;for(let n=0;r.length>n;n++)o.push({d:gi({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle+n*t,endAngle:e.endAngle}),color:r[n]})}return{clipPath:t,slices:o}}var yi=require("react/jsx-runtime"),bi={innerRadius:0,outerRadius:0,startAngle:0,endAngle:0};function vi(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}function xi(e,t,o){const r=_t(e.symbolType,e.size,e.path);return(0,yi.jsx)("path",{d:r,transform:e.rotation?`translate(${e.x},${e.y}) rotate(${180*e.rotation/Math.PI})`:`translate(${e.x},${e.y})`,fill:e.style.fill?vi(e.style.fill):"none",opacity:e.style.opacity,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth},`${o??""}symbol-${t}`)}function ki(e,t,o,r){const n=e.glyph;if(!n?.parts?.length||0>=e.size)return null;const i=Po(n,e.size);if(0>=i.scale)return null;const s=`translate(${t},${o})${e.rotation?` rotate(${180*e.rotation/Math.PI})`:""} translate(${i.offsetX},${i.offsetY}) scale(${i.scale})`,a=e.color??("string"==typeof e.style.fill?e.style.fill:void 0),l=To(n,e.fraction??1,e.fractionStart??0,e.fractionDirection??"horizontal"),c=l?wi(r+"-clip"):void 0,u=(e.style.opacity??1)*(e._decayOpacity??1)*(e.style.fillOpacity??1),d=t=>n.parts.map((o,r)=>{const n=t?"none"===o.fill?void 0:t:_o(o.fill,a,e.accent),i=t?o.stroke&&"none"!==o.stroke?t:void 0:_o(o.stroke??"none",a,e.accent);return n||i?(0,yi.jsx)("path",{d:o.d,fill:n??"none",stroke:i,strokeWidth:i?o.strokeWidth??1:void 0,strokeLinecap:o.strokeLinecap,strokeLinejoin:o.strokeLinejoin,opacity:o.opacity},r):null});return(0,yi.jsxs)("g",{transform:s,opacity:1===u?void 0:u,children:[l&&c&&(0,yi.jsx)("clipPath",{id:c,children:(0,yi.jsx)("rect",{x:l.x,y:l.y,width:l.width,height:l.height})}),l&&e.ghostColor?(0,yi.jsx)("g",{children:d(e.ghostColor)}):null,l&&c?(0,yi.jsx)("g",{clipPath:`url(#${c})`,children:d()}):d()]},r)}function wi(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}var Si="undefined"==typeof window||"undefined"==typeof document,Ai=require("react"),Ci="undefined"!=typeof window?Ai.useLayoutEffect:Ai.useEffect;function Mi(){const[e,t]=(0,Ai.useState)(!1);return Ci(()=>{t(!0)},[]),e}var ji=()=>()=>{},Pi=()=>!1,_i=()=>!0;function Li(){const e=(0,Ai.useSyncExternalStore)(ji,Pi,_i);return(0,Ai.useRef)(e).current}function Ri(e){const{hydrated:t,wasHydratingFromSSR:o,storeRef:r,dirtyRef:n,renderFnRef:i,cancelRender:s,cleanup:a}=e;Ci(()=>{t&&o&&r.current?.cancelIntroAnimation?.(),n.current=!0,s?.(),i.current()},[t,o]);const l=(0,Ai.useRef)(a);l.current=a,(0,Ai.useEffect)(()=>()=>l.current?.(),[])}var Ti=require("react");function Ii(e){const t=(0,Ti.useRef)(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return Ni(e,t);if(!Fi(e)||!Fi(t))return!1;const o=Object.keys(e),r=Object.keys(t);if(o.length!==r.length)return!1;for(const r of o){if(!Object.prototype.hasOwnProperty.call(t,r))return!1;const o=e[r],n=t[r];if(!Object.is(o,n))if(Array.isArray(o)&&Array.isArray(n)){if(!Ni(o,n))return!1}else{if(!Fi(o)||!Fi(n))return!1;if(!$i(o,n))return!1}}return!0}(t.current,e)||(t.current=e),t.current}function $i(e,t){const o=Object.keys(e),r=Object.keys(t);if(o.length!==r.length)return!1;for(const r of o){if(!Object.prototype.hasOwnProperty.call(t,r))return!1;if(!Object.is(e[r],t[r]))return!1}return!0}function Ni(e,t){if(e.length!==t.length)return!1;for(let o=0;e.length>o;o++)if(!Object.is(e[o],t[o]))return!1;return!0}function Fi(e){if(null===e||"object"!=typeof e)return!1;if(Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}function Bi(e,t){const{background:o,hasBackgroundGraphics:r=!1,themeBackground:n="",x:i=0,y:s=0,width:a,height:l}=t;if("transparent"===o)return!1;if(r)return!1;const c=o||(n&&"transparent"!==n?n:"")||null;if(!c)return!1;const u=Oo(e,c);return!!u&&(e.fillStyle=u,e.fillRect(i,s,a,l),!0)}var Di={axisStroke:"#ccc",tickText:"#666",crosshair:"rgba(0, 0, 0, 0.25)",hoverFill:"rgba(255, 255, 255, 0.3)",hoverStroke:"rgba(0, 0, 0, 0.4)",pointRing:"white",primary:"#007bff",background:""};function Ei(e,t){const o=e.trim();if(/^#[0-9a-f]{3}$/i.test(o)){const e=o[1],r=o[2],n=o[3];return`#${e}${e}${r}${r}${n}${n}${t}`}if(/^#[0-9a-f]{6}$/i.test(o))return`${o}${t}`;const r=o.match(/^rgb\s*\(\s*([^)]+?)\s*\)$/i);return r?`rgba(${r[1]}, ${(parseInt(t,16)/255).toFixed(3)})`:o}var zi=c(require("react")),Hi=c(require("react")),Oi=require("react/jsx-runtime"),Wi=Hi.createContext(null);function qi({children:e}){const[t,o]=Hi.useState(!1),r=Hi.useCallback(()=>o(e=>!e),[]),n=Hi.useMemo(()=>({visible:t,setVisible:o,toggle:r}),[t,r]);return(0,Oi.jsx)(Wi.Provider,{value:n,children:e})}function Yi(){return Hi.useContext(Wi)}function Gi(e){const t={};if(null==e||"object"!=typeof e)return t;for(const[o,r]of Object.entries(e))o.startsWith("_")||null!=r&&""!==r&&("number"==typeof r?Number.isFinite(r)&&(t[o]=r):"string"==typeof r?t[o]=r:"boolean"==typeof r?t[o]=r+"":r instanceof Date&&(t[o]=r.toISOString().slice(0,10)));return t}function Vi(e){return e&&"object"==typeof e?e:{}}function Xi(e){return Vi(e.accessibility).tableFields??e.accessibleDatum??e.datum}var Ui=require("react/jsx-runtime"),Ki={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function Qi(e,t){if(!e||0===e.length)return t+", empty";const o={};for(const t of e){if(null===t?.datum)continue;const e=t.type+"";o[e]=(o[e]||0)+1}if(0===Object.keys(o).length)return t+", empty";const r=[],n={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},i=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],s=Object.keys(o).sort((e,t)=>{const o=i.indexOf(e),r=i.indexOf(t);return(-1===o?999:o)-(-1===r?999:r)});for(const e of s)r.push(`${o[e]} ${n[e]||e}`);return`${t}, ${r.join(", ")}`}function Zi(e,t,o){const r=[];return e>0&&r.push(e+" nodes"),t>0&&r.push(t+" edges"),0===r.length?o+", empty":`${o}, ${r.join(", ")}`}var Ji=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},es="semiotic-accessible-data-table",ts=es+" semiotic-accessible-data-table-hidden",os=es+" semiotic-accessible-data-table-visible",rs=os+" semiotic-accessible-data-table-network",ns={position:"absolute",top:0,left:0,right:0,zIndex:"var(--semiotic-data-table-z-index, var(--semiotic-overlay-z-index, 20))",padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",fontFamily:"var(--semiotic-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",fontSize:13,lineHeight:1.5,color:"var(--semiotic-data-table-text, var(--semiotic-text, #333))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},is={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},ss={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",cursor:"pointer",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},as={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},ls={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))"},cs={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},us={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},ds={marginTop:8,padding:"4px 10px",fontSize:12,cursor:"pointer",border:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",borderRadius:"var(--semiotic-border-radius, 4px)",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",color:"var(--semiotic-data-table-text, var(--semiotic-text, #333))",fontFamily:"inherit"};function hs({scene:e,chartType:t,tableId:o,chartTitle:r}){const[n,i]=zi.useState(!1),[s,a]=zi.useState(5),l=Yi(),c=l?.visible??!1,u=n||c,d=zi.useRef(null),h=r?"Data summary for "+r:o?`Data summary for ${t} ${o}`:"Data summary for "+t;zi.useEffect(()=>{u||a(5)},[u]);const p=zi.useCallback(e=>{e.target===e.currentTarget&&(n||c||i(!0))},[n,c]),f=zi.useCallback(e=>{c||d.current?.contains(e.relatedTarget)||i(!1)},[c]);if(!e||0===e.length)return o?(0,Ui.jsx)("span",{id:o,tabIndex:-1,style:Ki}):null;if(!u)return(0,Ui.jsx)("div",{id:o,className:ts,tabIndex:-1,onFocus:p,style:Ki,role:"region","aria-label":h,children:(0,Ui.jsxs)("button",{type:"button",onClick:()=>i(!0),children:["View data summary (",e.length," elements)"]})});const g=function(e){const t=[];if(!Array.isArray(e))return t;const o=e.some(e=>e&&("line"===e.type||"area"===e.type));for(const r of e)if(r&&"object"==typeof r&&null!==r.datum)try{switch(r.type){case"point":if(o)break;t.push({label:"Point",values:Gi(Xi(r))});break;case"line":case"area":{const e=Xi(r),o=Array.isArray(e)?e:[],n="line"===r.type?"Line point":"Area point";for(const e of o)t.push({label:n,values:Gi(e)});break}case"rect":{const e=Xi(r),o=null!=e&&"object"==typeof e?e:{},n=o.category??r.group??"",i=o.value??o.__aggregateValue??o.total,s=Gi(o);null==s.category&&""!==n&&(s.category=n+""),null==s.value&&null!=i&&(s.value="number"==typeof i||"string"==typeof i?i:i+""),t.push({label:"Bar",values:s});break}case"heatcell":{const e=Gi(Xi(r));null==e.value&&"number"==typeof r.value&&Number.isFinite(r.value)&&(e.value=r.value),t.push({label:"Cell",values:e});break}case"wedge":{const e=Xi(r),o=Gi(e);if(null==o.category){const t=Vi(e),r=t.category??t.label;null!=r&&(o.category=r+"")}t.push({label:"Wedge",values:o});break}case"circle":t.push({label:"Node",values:Gi(Xi(r))});break;case"arc":t.push({label:"Arc",values:Gi(Xi(r))});break;case"candlestick":t.push({label:"Candlestick",values:Gi(Xi(r))});break;case"geoarea":{const e=Vi(Xi(r)),o=Gi(e);if(null==o.name){const t=Vi(e.properties).name??e.name;null!=t&&(o.name=t+"")}t.push({label:"Region",values:o});break}}}catch{}return t}(e),m=function(e){if(!e||0===e.length)return[];const t=new Set;for(const o of e)if(o&&o.values)for(const e of Object.keys(o.values))t.add(e);const o=[];for(const r of t){const t=[],n=new Set;for(const o of e){if(!o||!o.values)continue;const e=o.values[r];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&n.add(e+""))}if(t.length>0){let e=t[0],n=t[0],i=0;for(const o of t)e>o&&(e=o),o>n&&(n=o),i+=o;o.push({name:r,count:t.length,numeric:!0,min:e,max:n,mean:i/t.length})}else if(n.size>0){const e=Array.from(n);o.push({name:r,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return o}(g),y=function(e,t){const o=[e+" data points."];for(const e of t)if(e.numeric)o.push(`${e.name}: ${Ji(e.min)} to ${Ji(e.max)}, mean ${Ji(e.mean)}.`);else{const t=e.uniqueValues,r=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");o.push(`${e.name}: ${r}.`)}return o.join(" ")}(g.length,m),b=Math.min(s,g.length),v=g.slice(0,b),x=g.length-b,k=new Set;for(const e of v)for(const t of Object.keys(e.values))k.add(t);const w=Array.from(k);return(0,Ui.jsxs)("div",{ref:d,id:o,className:os,tabIndex:-1,onBlur:f,style:ns,role:"region","aria-label":h,children:[(0,Ui.jsx)("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{c&&l&&l.setVisible(!1),i(!1)},"aria-label":"Close data summary",style:ss,children:"×"}),(0,Ui.jsx)("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:is,children:y}),(0,Ui.jsxs)("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+t,style:as,children:[(0,Ui.jsx)("caption",{className:"semiotic-accessible-data-table-caption",style:us,children:x>0?`First ${b} of ${g.length} data points`:`All ${g.length} data points`}),(0,Ui.jsx)("thead",{children:(0,Ui.jsxs)("tr",{children:[(0,Ui.jsx)("th",{style:ls,children:"type"}),w.map(e=>(0,Ui.jsx)("th",{style:ls,children:e},e))]})}),(0,Ui.jsx)("tbody",{children:v.map((e,t)=>(0,Ui.jsxs)("tr",{children:[(0,Ui.jsx)("td",{style:cs,children:e.label}),w.map(t=>{return(0,Ui.jsx)("td",{style:cs,children:(o=e.values[t],null==o||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":Ji(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"")},t);var o})]},t))})]}),x>0&&(0,Ui.jsxs)("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>a(e=>e+25),style:ds,children:["Show ",Math.min(25,x)," more"," ",1===x?"row":"rows"," (",x," remaining)"]})]})}function ps({nodes:e,edges:t,chartType:o,tableId:r,chartTitle:n}){const[i,s]=zi.useState(!1),[a,l]=zi.useState(5),c=Yi(),u=c?.visible??!1,d=i||u,h=n?"Data summary for "+n:r?`Data summary for ${o} ${r}`:"Data summary for "+o,p=zi.useRef(null);zi.useEffect(()=>{d||l(5)},[d]);const f=zi.useCallback(e=>{e.target===e.currentTarget&&(i||u||s(!0))},[i,u]),g=zi.useCallback(e=>{u||p.current?.contains(e.relatedTarget)||s(!1)},[u]);if(!e||0===e.length)return r?(0,Ui.jsx)("span",{id:r,tabIndex:-1,style:Ki}):null;if(!d)return(0,Ui.jsx)("div",{id:r,className:ts,tabIndex:-1,onFocus:f,style:Ki,role:"region","aria-label":h,children:(0,Ui.jsxs)("button",{type:"button",onClick:()=>s(!0),children:["View data summary (",e.length," nodes, ",t.length," edges)"]})});const m=Array.isArray(e)?e:[],y=Array.isArray(t)?t:[],b=new Map,v=new Map,x=new Map,k=new Map;for(const e of y){if(!e||"object"!=typeof e)continue;const t=e.datum??e,o="object"==typeof t.source?t.source?.id:t.source,r="object"==typeof t.target?t.target?.id:t.target,n="number"==typeof t.value&&Number.isFinite(t.value)?t.value:0;if(null!=o&&""!==o){const e=o+"";v.set(e,(v.get(e)??0)+1),k.set(e,(k.get(e)??0)+n)}if(null!=r&&""!==r){const e=r+"";b.set(e,(b.get(e)??0)+1),x.set(e,(x.get(e)??0)+n)}}const w=[];for(let e=0;m.length>e;e++){const t=m[e];if(!t||"object"!=typeof t)continue;const o=t.datum?.id??t.id,r=null!=o?o+"":"node-"+e,n=b.get(r)??0,i=v.get(r)??0,s=x.get(r)??0,a=k.get(r)??0;w.push({id:r,degree:n+i,inDeg:n,outDeg:i,wDegree:s+a,wInDeg:s,wOutDeg:a})}w.sort((e,t)=>t.degree-e.degree);let S=0,A=0;if(w.length>0){let e=0;for(const t of w)e+=t.degree,t.degree>A&&(A=t.degree);S=e/w.length}const C=y.some(e=>{const t=e?.datum??e;return"number"==typeof t?.value&&Number.isFinite(t.value)}),M=[`${w.length} nodes, ${y.length} edges.`];w.length>0&&M.push(`Mean degree: ${Ji(S)}, max degree: ${A}.`);const j=Math.min(a,w.length),P=w.slice(0,j),_=w.length-j;return(0,Ui.jsxs)("div",{ref:p,id:r,className:rs,tabIndex:-1,onBlur:g,style:ns,role:"region","aria-label":h,children:[(0,Ui.jsx)("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{u&&c&&c.setVisible(!1),s(!1)},"aria-label":"Close data summary",style:ss,children:"×"}),(0,Ui.jsx)("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:is,children:M.join(" ")}),(0,Ui.jsxs)("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Node degree summary for "+o,style:as,children:[(0,Ui.jsx)("caption",{className:"semiotic-accessible-data-table-caption",style:us,children:_>0?`Top ${j} of ${w.length} nodes by degree`:`All ${w.length} nodes by degree`}),(0,Ui.jsx)("thead",{children:(0,Ui.jsxs)("tr",{children:[(0,Ui.jsx)("th",{style:ls,children:"id"}),(0,Ui.jsx)("th",{style:ls,children:"degree"}),(0,Ui.jsx)("th",{style:ls,children:"in"}),(0,Ui.jsx)("th",{style:ls,children:"out"}),C&&(0,Ui.jsx)("th",{style:ls,children:"w. degree"}),C&&(0,Ui.jsx)("th",{style:ls,children:"w. in"}),C&&(0,Ui.jsx)("th",{style:ls,children:"w. out"})]})}),(0,Ui.jsx)("tbody",{children:P.map((e,t)=>(0,Ui.jsxs)("tr",{children:[(0,Ui.jsx)("td",{style:cs,children:e.id}),(0,Ui.jsx)("td",{style:cs,children:e.degree}),(0,Ui.jsx)("td",{style:cs,children:e.inDeg}),(0,Ui.jsx)("td",{style:cs,children:e.outDeg}),C&&(0,Ui.jsx)("td",{style:cs,children:Ji(e.wDegree)}),C&&(0,Ui.jsx)("td",{style:cs,children:Ji(e.wInDeg)}),C&&(0,Ui.jsx)("td",{style:cs,children:Ji(e.wOutDeg)})]},t))})]}),_>0&&(0,Ui.jsxs)("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>l(e=>e+25),style:ds,children:["Show ",Math.min(25,_)," more"," ",1===_?"node":"nodes"," (",_," remaining)"]})]})}function fs({summary:e}){return e?(0,Ui.jsx)("div",{role:"note",style:Ki,children:e}):null}function gs({tableId:e}){return(0,Ui.jsx)("a",{href:"#"+e,style:Ki,onClick:t=>{t.preventDefault();const o=document.getElementById(e);o&&requestAnimationFrame(()=>o.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,Ki)},children:"Skip to data table"})}function ms({hoverPoint:e}){let t="";if(e){const o=e.data||e;t="object"==typeof o?"Data point: "+Object.entries(o).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Data point: "+o}return(0,Ui.jsx)("div",{"aria-live":"polite","aria-atomic":"true",style:Ki,children:t})}var ys=require("react/jsx-runtime"),bs="var(--semiotic-focus, #005fcc)";function vs({active:e,hoverPoint:t,margin:o,size:r,shape:n="circle",width:i,height:s,pathData:a}){if(!e||!t)return null;const l=t.x+o.left,c=t.y+o.top;let u;if("geoarea"!==n&&"path"!==n||!a)if("rect"===n&&null!=i&&null!=s){const e=Math.max(i,4),t=Math.max(s,4);u=(0,ys.jsx)("rect",{x:l-e/2-3,y:c-t/2-3,width:e+6,height:t+6,rx:3,fill:"none",stroke:bs,strokeWidth:2,strokeDasharray:"4,2"})}else u=(0,ys.jsx)("circle","wedge"===n?{cx:l,cy:c,r:12,fill:"none",stroke:bs,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:bs,strokeWidth:2,strokeDasharray:"4,2"});else u=(0,ys.jsx)("g",{transform:`translate(${o.left},${o.top})`,children:(0,ys.jsx)("path",{d:a,fill:"none",stroke:bs,strokeWidth:2.5,strokeDasharray:"6,3"})});return(0,ys.jsx)("svg",{style:{position:"absolute",left:0,top:0,width:r[0],height:r[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}var xs=c(require("react"));function ks(e,t){return"touch"===t?Math.max(e,24):e}function ws(e){return Array.isArray(e)?e[0]:e}function Ss(e,t,o,r){return{data:ws(e),x:t,y:o,__semioticHoverData:!0,...r}}var As=["name","label","title"],Cs=["type","kind","category","group","class","status","role","shape"],Ms=["value","amount","total","count","weight","score"],js=new Set(["x","y","z","x0","x1","y0","y1","r","cx","cy","radius","layer","row","rowindex","col","column","depth","index","order","sankeywidth","coincidentpoints","sourcelinks","targetlinks","parent","children","fx","fy","vx","vy"]);function Ps(e,t){for(const o of t){const t=e.find(e=>e.lower===o);if(t)return t}}function _s(e,t={}){if(!e||"object"!=typeof e)return{entries:[]};const o=t.maxEntries??6,r=!1!==t.skipPositional,n=[];for(const[t,o]of Object.entries(e)){if(t.startsWith("_"))continue;if("data"===t)continue;if(r&&js.has(t.toLowerCase()))continue;if(null==o)continue;const e=typeof o;("string"===e||"number"===e||"boolean"===e||o instanceof Date)&&n.push({key:t,lower:t.toLowerCase(),value:o})}if(0===n.length)return{entries:[]};let i=n.findIndex(e=>As.includes(e.lower));const s=i>=0;0>i&&(i=n.findIndex(e=>"id"===e.lower)),0>i&&(i=n.findIndex(e=>"string"==typeof e.value));const a=0>i?void 0:n[i];let l=n.filter((e,t)=>t!==i);s&&(l=l.filter(e=>"id"!==e.lower));const c=Ps(l,Cs),u=Ps(l,Ms),d=new Set(Cs),h=new Set(Ms),p=[];c&&p.push({key:c.key,value:c.value}),u&&p.push({key:u.key,value:u.value});for(const e of l){if(p.length>=o)break;e!==c&&e!==u&&(d.has(e.lower)||h.has(e.lower)||p.push({key:e.key,value:e.value}))}return{titleKey:a?.key,title:a?.value,entries:p}}var Ls=require("react/jsx-runtime"),Rs={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, white)",padding:"8px 12px",borderRadius:"var(--semiotic-tooltip-radius, 6px)",fontSize:"var(--semiotic-tooltip-font-size, 14px)",fontFamily:"var(--semiotic-font-family, inherit)",lineHeight:"1.5",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.15))",pointerEvents:"none",maxWidth:"300px",wordWrap:"break-word"};function Ts(e,t){return"function"==typeof t?t(e):e[t]}function Is(e,t){if(t)return t(e);if(null==e)return"";if("number"==typeof e){if(!Number.isFinite(e))return e+"";const t=Number.isInteger(e)?e:parseFloat(e.toPrecision(6));return Math.abs(t)>9999?t.toLocaleString():t+""}return e instanceof Date?e.toLocaleDateString():"object"==typeof e&&null!==e?void 0!==e.id?e.id+"":void 0!==e.name?e.name+"":JSON.stringify(e):e+""}function $s(e={}){const{fields:t,title:o,format:r,style:n={},className:i=""}=e;return e=>{if(!e||"object"!=typeof e)return null;let s;const a=[];if(o){const t=Ts(e,o);s=Is(t,r)}if(t&&t.length>0)t.forEach(t=>{let o,n,i;"string"==typeof t?(o=t,n=t,i=r):(o=t.label,n=t.accessor||t.key||"",i=t.format||r);const s=Ts(e,n);a.push({label:o,value:Is(s,i)})});else if(!o){const t=["value","y","name","id","label"];for(const o of t)if(void 0!==e[o]){s=Is(e[o],r);break}if(!s){const t=Object.keys(e).filter(e=>!e.startsWith("_"));t.length>0&&(s=Is(e[t[0]],r))}}const l={...Rs,...n};return(0,Ls.jsxs)("div",{className:("semiotic-tooltip "+i).trim(),style:l,children:[s&&(0,Ls.jsx)("div",{style:{fontWeight:a.length>0?"bold":"normal"},children:s}),a.map((e,t)=>(0,Ls.jsxs)("div",{style:{marginTop:0===t&&s?"4px":0},children:[e.label&&(0,Ls.jsxs)("span",{children:[e.label,": "]}),e.value]},t))]})}}function Ns(e={}){const{fields:t=[],title:o,format:r,style:n={},className:i="",showLabels:s=!0,separator:a=": "}=e;return e=>{if(!e||"object"!=typeof e)return null;const l=[];if(o){const t=Ts(e,o);l.push({value:Is(t,r)})}if(t&&Array.isArray(t)&&t.length>0)t.forEach(t=>{let o,n,i;"string"==typeof t?(o=t,n=t,i=r):(o=t.label,n=t.accessor||t.key||"",i=t.format||r);const a=Is(Ts(e,n),i);l.push({label:s?o:void 0,value:a})});else{const t=_s(e,{skipPositional:!1});null!=t.title&&l.push({label:void 0,value:Is(t.title,r),bold:!0}),t.entries.forEach(e=>{l.push({label:s?e.key:void 0,value:Is(e.value,r)})})}const c={...Rs,...n};return Array.isArray(l)&&0!==l.length?(0,Ls.jsx)("div",{className:("semiotic-tooltip semiotic-tooltip-multiline "+i).trim(),style:c,children:l.map((e,t)=>(0,Ls.jsxs)("div",{style:{marginBottom:l.length-1>t?"4px":0,fontWeight:e.bold?"bold":void 0},children:[e.label&&(0,Ls.jsxs)("strong",{children:[e.label,a]}),e.value]},t))}):null}}function Fs(){return e=>{const t=e.allSeries;if(!t||0===t.length)return(0,Ls.jsx)("div",{className:"semiotic-tooltip",style:Rs,children:(0,Ls.jsx)("div",{children:Is(e.data?.value??e.data?.y)})});const o=e.xValue??e.data?.time??e.data?.x;return(0,Ls.jsxs)("div",{className:"semiotic-tooltip",style:Rs,children:[null!=o&&(0,Ls.jsx)("div",{style:{fontWeight:600,marginBottom:4,fontSize:"0.9em",borderBottom:"1px solid var(--semiotic-border, #eee)",paddingBottom:4},children:Is(o)}),t.map((e,t)=>(0,Ls.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"1px 0"},children:[(0,Ls.jsx)("span",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:e.color,flexShrink:0}}),(0,Ls.jsx)("span",{style:{flex:1,fontSize:"0.85em"},children:e.group}),(0,Ls.jsx)("span",{style:{fontWeight:500,fontSize:"0.85em"},children:Is(e.value)})]},t))]})}}function Bs(e){if(!0!==e){if("function"==typeof e){const t=e;return e=>{let o=ws(!0===e?.__semioticHoverData||e&&void 0!==e.data&&"number"==typeof e.x&&"number"==typeof e.y&&e&&("node"===e.type||"edge"===e.type||void 0!==e.nodeOrEdge||void 0!==e.allSeries||void 0!==e.stats||void 0!==e.__chartType)?e.data??{}:e);("node"===e?.nodeOrEdge&&"number"==typeof o?.x0&&"number"==typeof o?.x1||"edge"===e?.nodeOrEdge&&"number"==typeof o?.sankeyWidth)&&o.data&&"object"==typeof o.data&&(o=o.data);const r=t(o);return null==r?null:(0,Ls.jsx)("div",{className:"semiotic-tooltip",style:Rs,children:r})}}return!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?$s(e):$s())}}var Ds=require("react/jsx-runtime");function Es({x:e,y:t,containerWidth:o,containerHeight:r,margin:n,children:i,className:s="stream-frame-tooltip",zIndex:a=1}){const l=Number.isFinite(e)&&Number.isFinite(t),c=xs.useRef(null),[u,d]=xs.useState(null);xs.useLayoutEffect(()=>{const e=c.current;if(!e)return;const t=e.getBoundingClientRect();d(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[i,s,o,r]);let h;h=u?`translate(${u.width+12>o-e?"calc(-100% - 12px)":"12px"}, ${u.height+12>r-t?"calc(-100% - 4px)":"4px"})`:`translate(${e>.7*o?"calc(-100% - 12px)":"12px"}, ${.3*r>t?"4px":"calc(-100% - 4px)"})`;const p=function(e){if(!xs.isValidElement(e))return!1;const t=e.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;const o=e.props;if(!0===o["data-semiotic-tooltip-chrome"])return!0;if("true"===o["data-semiotic-tooltip-chrome"])return!0;const r=o.style;if(r&&"object"==typeof r){if(null!=r.background&&""!==r.background&&"transparent"!==r.background)return!0;if(null!=r.backgroundColor&&""!==r.backgroundColor&&"transparent"!==r.backgroundColor)return!0}return!1}(i),f=p?null:Rs;return l?(0,Ds.jsx)("div",{ref:c,className:p?s:(s+" semiotic-tooltip").trim(),style:{...f||{},position:"absolute",left:n.left+e,top:n.top+t,transform:h,pointerEvents:"none",zIndex:a,width:"max-content"},children:i}):null}var zs=c(require("react")),Hs=require("react"),Os=require("react");function Ws(e,t){if("function"==typeof e.addEventListener)return e.addEventListener("change",t),()=>e.removeEventListener("change",t);const o=e;return o.addListener(t),()=>o.removeListener(t)}var qs=require("react");function Ys(e,t,o){const r=(0,qs.useRef)(null),[n,i]=(0,qs.useState)(null);return(0,qs.useEffect)(()=>{if(!t&&!o)return;const e=r.current;if(!e)return;const n=new ResizeObserver(e=>{for(const t of e){const{width:e,height:o}=t.contentRect;i(t=>t&&t.w===e&&t.h===o?t:{w:e,h:o})}});return n.observe(e),()=>n.disconnect()},[t,o]),[r,[t&&n?n.w:e[0],o&&n?n.h:e[1]]]}var Gs="undefined"==typeof window?Hs.useEffect:Hs.useLayoutEffect,Vs={requestAnimationFrame:e=>("undefined"==typeof window?globalThis:window).requestAnimationFrame(e),cancelAnimationFrame:e=>("undefined"==typeof window?globalThis:window).cancelAnimationFrame(e)};function Xs(e,t,o){return"function"==typeof e?e({size:t,margin:o}):e}function Us(e){const t=function(){const[e,t]=(0,Os.useState)(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return(0,Os.useEffect)(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),Ws(e,e=>t(e.matches))},[]),e}(),o=(0,Hs.useRef)(t);o.current=t;const[r,n]=Ys(e.sizeProp,e.responsiveWidth,e.responsiveHeight),i=(0,Hs.useMemo)(()=>({...e.marginDefault,...e.userMargin}),[e.marginDefault,e.userMargin]),s=n[0]-i.left-i.right,a=n[1]-i.top-i.bottom,l=Xs(e.foregroundGraphics,n,i),c=Xs(e.backgroundGraphics,n,i),u=ee(e=>e.theme),{transition:d,introEnabled:h}=function(e,t){if(!1===e)return{transition:void 0,introEnabled:!1};const o="undefined"!=typeof window&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;return{transition:e?!0===e?{duration:300}:{duration:e.duration??300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(o||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),p="semiotic-table-"+zs.useId(),f=(0,Hs.useRef)(null),g=(0,Hs.useRef)(e.frameScheduler??Vs);g.current=e.frameScheduler??Vs;const m=(0,Hs.useRef)(null),y=(0,Hs.useRef)(!1),b=(0,Hs.useRef)(()=>{}),v=(0,Hs.useCallback)(()=>{if(null!==f.current||y.current)return;const e=g.current;let t=!1,o=!1;const r=e.requestAnimationFrame(()=>{t=!0;const e=!o;e&&(y.current=!0),f.current=null,m.current=null;try{b.current()}finally{e&&(y.current=!1)}});o=!0,t||(f.current=r,m.current=e)},[]),x=(0,Hs.useCallback)(()=>{null!==f.current&&((m.current??g.current).cancelAnimationFrame(f.current),f.current=null,m.current=null)},[]);(0,Hs.useEffect)(()=>()=>{x()},[x]);const k=(0,Hs.useRef)(()=>{}),w=(0,Hs.useRef)(()=>{}),S=(0,Hs.useRef)(null),A=(0,Hs.useRef)(null),C=(0,Hs.useRef)(null),M=(0,Hs.useCallback)(()=>{const e=S.current;S.current=null,e&&k.current(e)},[]),j=(0,Hs.useCallback)(e=>{if(S.current={clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType},null===A.current){const e=g.current;let t=!1;const o=e.requestAnimationFrame(()=>{t=!0,A.current=null,C.current=null,M()});t||(A.current=o,C.current=e)}},[M]),P=(0,Hs.useCallback)(()=>{S.current=null,null!==A.current&&((C.current??g.current).cancelAnimationFrame(A.current),A.current=null,C.current=null),w.current()},[]);(0,Hs.useEffect)(()=>()=>{S.current=null,null!==A.current&&((C.current??g.current).cancelAnimationFrame(A.current),A.current=null,C.current=null)},[]);const _=e.themeDirtyRef;return Gs(()=>{_&&(Do++,_.current=!0,v())},[u,v,_]),{reducedMotion:t,reducedMotionRef:o,responsiveRef:r,size:n,margin:i,adjustedWidth:s,adjustedHeight:a,resolvedForeground:l,resolvedBackground:c,currentTheme:u,transition:d,introEnabled:h,tableId:p,rafRef:f,renderFnRef:b,scheduleRender:v,cancelRender:x,hoverHandlerRef:k,hoverLeaveRef:w,onPointerMove:j,onPointerLeave:P}}function Ks(e,t,o,r){const n=r.current,i=!0===e.lastCustomLayoutFailure?.preservedLastGoodScene,s=!i&&e.hasActivePulsesAt(t),a=!(o||i||!s&&!n)&&e.refreshPulse(t);return r.current=s,{changed:a,pending:s}}function Qs(e,t,o,r){const n=e.getContext("2d");if(!n)return null;const i=Math.round(t[0]*r),s=Math.round(t[1]*r),a=i/t[0],l=s/t[1],c=t[0]+"px",u=t[1]+"px";return e.style.width!==c&&(e.style.width=c),e.style.height!==u&&(e.style.height=u),e.width===i&&e.height===s||(e.width=i,e.height=s),n.setTransform(a,0,0,l,0,0),n.translate(o.left,o.top),n}function Zs(){if("undefined"==typeof window)return 1;const e=window.devicePixelRatio||1,t=function(){if("undefined"==typeof window)return!1;const e="function"==typeof window.matchMedia&&window.matchMedia("(pointer: coarse)").matches,t=768>Math.min(window.innerWidth||1/0,window.innerHeight||1/0);return e||t}()?2:3;return Math.max(1,Math.min(e,t))}var Js=require("react");function ea(e,t){if(!t)return[];const o=new Set,r=[];for(const n of e){if(!n||"object"!=typeof n)continue;const e="function"==typeof t?t(n):n[t];if(null==e)continue;const i=e+"";o.has(i)||(o.add(i),r.push(i))}return r}function ta(e,t){if(e.length!==t.length)return!1;for(let o=0;e.length>o;o++)if(e[o]!==t[o])return!1;return!0}function oa(e,t,o,r){return"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:o,fn:e}:"string"==typeof t?{key:t,fn:null}:"function"==typeof t?{key:r,fn:t}:{key:void 0,fn:null}}function ra(e,t,o){return r=>{if(!r||!o||!e.fn&&!t.fn)return r;let n=!1;const i=r.map(o=>{const r=e.fn&&e.key&&!(e.key in o),i=t.fn&&t.key&&!(t.key in o);if(!r&&!i)return o;n=!0;const s={...o};return r&&(s[e.key]=e.fn(o)),i&&(s[t.key]=t.fn(o)),s});return n?i:r}}var na=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],ia=3156e7;function sa(e){const t=e[1]-e[0];return 864e5>t?e=>{const t=new Date(e);return`${(t.getUTCHours()+"").padStart(2,"0")}:${(t.getUTCMinutes()+"").padStart(2,"0")}`}:ia>t?e=>{const t=new Date(e);return`${na[t.getUTCMonth()]} ${t.getUTCDate()}`}:5*ia>t?e=>{const t=new Date(e);return`${na[t.getUTCMonth()]} ${t.getUTCFullYear()}`}:e=>new Date(e).getUTCFullYear()+""}function aa(e){if(!e)return;const t=[];for(const o of e)if("point"===o.type)t.push(o);else if("symbol"===o.type)t.push({pointId:o.pointId,x:o.x,y:o.y,r:Lt(o.size)});else if("glyph"===o.type){const e=Io(o.glyph,o.size);t.push({pointId:o.pointId,x:o.x+e.centerDx,y:o.y+e.centerDy,r:e.radius})}return t}var la=require("d3-shape");function ca(e,t,o){let r=o;for(const o of t)"lesser"===o.thresholdType?o.value>e&&(r=o.color):e>o.value&&(r=o.color);return r}function ua(e,t,o,r,n,i){if(2>t.length)return;const s=[0];for(let e=1;t.length>e;e++){const o=t[e][0]-t[e-1][0],r=t[e][1]-t[e-1][1];s.push(s[e-1]+Math.sqrt(o*o+r*r))}const a=s[s.length-1];if(0===a)return;const l=Math.min(.2*a,40);e.strokeStyle=o,e.lineWidth=r,e.lineCap=i;for(let o=0;t.length-1>o;o++){const r=(s[o]+s[o+1])/2;let i=n;l>r&&(i*=r/l),l>a-r&&(i*=(a-r)/l),e.globalAlpha=Math.max(0,i),e.beginPath(),e.moveTo(t[o][0],t[o][1]),e.lineTo(t[o+1][0],t[o+1][1]),e.stroke()}}var da=(e,t,o,r)=>{const n=t.filter(e=>"line"===e.type);for(const t of n){if(2>t.path.length)continue;const o=t._introClipFraction;void 0!==o&&1>o&&(e.save(),e.beginPath(),e.rect(0,0,r.width*o,r.height),e.clip());const n=t.style.stroke||"#007bff",i=Oo(e,n)||n,s=t.style.strokeWidth||2,a=t.colorThresholds,l=t.rawValues;if(e.setLineDash(t.style.strokeDasharray?t.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),e.lineWidth=s,e.lineCap=t.style.strokeLinecap||"butt",t.style._edgeFade){ua(e,t.path,i,s,t.style.opacity??1,t.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const c=Yo(t.curve),u=a&&a.length>0&&l&&l.length===t.path.length,d=t._decayOpacities;if(d&&d.length===t.path.length&&!u){e.strokeStyle=i;const o=t.style.opacity??1;for(let r=0;t.path.length-1>r;r++)e.globalAlpha=.5*(d[r]+d[r+1])*o,e.beginPath(),e.moveTo(t.path[r][0],t.path[r][1]),e.lineTo(t.path[r+1][0],t.path[r+1][1]),e.stroke()}else if(u){let o=function(t,o,r){e.beginPath(),e.strokeStyle=t,e.moveTo(o,r),d=!0},r=function(){d&&(e.stroke(),d=!1)},n=null,s=null,c=null,u=null,d=!1;for(let d=0;t.path.length>d;d++){const[h,p]=t.path[d],f=l[d],g=ca(f,a,i);if(null!==n&&null!==u&&null!==c){if(g===u)e.lineTo(h,p);else{const t=[];for(const e of a){const o=e.value;(c>o||o>f)&&(o>c||f>o)||c===o||f===o||t.push({t:(o-c)/(f-c)})}t.sort((e,t)=>e.t-t.t);for(const l of t){const t=n+(h-n)*l.t,u=s+(p-s)*l.t,d=ca(c+(f-c)*Math.min(l.t+1e-4,1),a,i);e.lineTo(t,u),r(),o(d,t,u)}e.lineTo(h,p)}n=h,s=p,c=f,u=g}else o(g,h,p),n=h,s=p,c=f,u=g}r()}else{e.beginPath();const o=t.strokeGradient&&t.path.length>=2?Xo(e,t.strokeGradient,t.path[0][0],0,t.path[t.path.length-1][0],0):null;if(e.strokeStyle=o||i,c)(0,la.line)().x(e=>e[0]).y(e=>e[1]).curve(c).context(e)(t.path);else{const[o,r]=t.path[0];e.moveTo(o,r);for(let o=1;t.path.length>o;o++)e.lineTo(t.path[o][0],t.path[o][1])}e.stroke()}if(t.style.fill&&t.style.fillOpacity&&t.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=t.style.fillOpacity,e.fillStyle=Go(e,t.style.fill,t.style.fill),c&&!u)(0,la.line)().x(e=>e[0]).y(e=>e[1]).curve(c).context(e)(t.path);else{const[o,r]=t.path[0];e.moveTo(o,r);for(let o=1;t.path.length>o;o++)e.lineTo(t.path[o][0],t.path[o][1])}const o=t.path[0][0];e.lineTo(t.path[t.path.length-1][0],r.height),e.lineTo(o,r.height),e.closePath(),e.fill()}void 0!==o&&1>o&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}};function ha(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function pa(e,t,o=.3){ha(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h))}function fa(e,t,o=.6){if(!ha(t))return;const r=t.r+(t._pulseGlowRadius??4)*t._pulseIntensity,n=t.cx??t.x??0,i=t.cy??t.y??0;e.beginPath(),e.arc(n,i,r,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*o,e.stroke()}function ga(e,t,o,r=.35){ha(t)&&(e.globalAlpha=t._pulseIntensity*r,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",o?e.fill(o):e.fill())}var ma=require("d3-shape");function ya(e,t){const o=Yo(t.curve);if(!o||2>t.topPath.length||2>t.bottomPath.length){e.beginPath(),e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let o=1;t.topPath.length>o;o++)e.lineTo(t.topPath[o][0],t.topPath[o][1]);for(let o=t.bottomPath.length-1;o>=0;o--)e.lineTo(t.bottomPath[o][0],t.bottomPath[o][1]);e.closePath()}else{const r=(0,ma.area)().x(e=>e[0]).y0((e,o)=>t.bottomPath[o][1]).y1(e=>e[1]).curve(o).context(e);e.beginPath(),r(t.topPath)}}var ba=(e,t,o,r)=>{const n=t.filter(e=>"area"===e.type);for(const t of n){if(2>t.topPath.length)continue;let o=!1;t.clipRect&&(e.save(),e.beginPath(),e.rect(t.clipRect.x,t.clipRect.y,t.clipRect.width,t.clipRect.height),e.clip(),o=!0);const n=t._introClipFraction;void 0!==n&&1>n&&(e.save(),e.beginPath(),e.rect(0,0,r.width*n,r.height),e.clip());const i=Go(e,t.style.fill,"#4e79a7"),s=t._decayOpacities;if(s&&s.length===t.topPath.length){const o=t.style.fillOpacity??.7;e.fillStyle=i;for(let r=0;t.topPath.length-1>r;r++)e.globalAlpha=.5*(s[r]+s[r+1])*o,e.beginPath(),e.moveTo(t.topPath[r][0],t.topPath[r][1]),e.lineTo(t.topPath[r+1][0],t.topPath[r+1][1]),e.lineTo(t.bottomPath[r+1][0],t.bottomPath[r+1][1]),e.lineTo(t.bottomPath[r][0],t.bottomPath[r][1]),e.closePath(),e.fill();if(t.style.stroke&&"none"!==t.style.stroke){e.strokeStyle=Oo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);for(let o=0;t.topPath.length-1>o;o++)e.globalAlpha=.5*(s[o]+s[o+1]),e.beginPath(),e.moveTo(t.topPath[o][0],t.topPath[o][1]),e.lineTo(t.topPath[o+1][0],t.topPath[o+1][1]),e.stroke()}e.globalAlpha=1;continue}const a=t.style.opacity??1;if(ya(e,t),t.fillGradient&&("colorStops"in t.fillGradient&&t.fillGradient.colorStops.length>=2||"topOpacity"in t.fillGradient)&&t.fillGradient){let o=1/0;for(const e of t.topPath)o>e[1]&&(o=e[1]);let r=-1/0;for(const e of t.bottomPath)e[1]>r&&(r=e[1]);const n=Vo(e,t.fillGradient,"string"==typeof i?i:"#4e79a7",0,o,0,r);e.fillStyle=n||i,e.globalAlpha=a}else e.globalAlpha=(t.style.fillOpacity??.7)*a,e.fillStyle=i;if(e.fill(),t._pulseIntensity&&t._pulseIntensity>0&&(ya(e,t),ga(e,t)),t.style.stroke&&"none"!==t.style.stroke){e.globalAlpha=a;const o=t.strokeGradient&&t.topPath.length>=2?Xo(e,t.strokeGradient,t.topPath[0][0],0,t.topPath[t.topPath.length-1][0],0):null;e.strokeStyle=o||Oo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);const r=Yo(t.curve);if(e.beginPath(),r)(0,ma.line)().x(e=>e[0]).y(e=>e[1]).curve(r).context(e)(t.topPath);else{e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let o=1;t.topPath.length>o;o++)e.lineTo(t.topPath[o][0],t.topPath[o][1])}e.stroke()}void 0!==n&&1>n&&e.restore(),o&&e.restore(),e.globalAlpha=1}},va=(e,t,o,r)=>{const n=t.filter(e=>"point"===e.type);if(0!==n.length){e.save();try{const t=e.globalAlpha;for(const o of n)e.beginPath(),e.arc(o.x,o.y,o.r,0,2*Math.PI),e.globalAlpha=t*(o.style.opacity??o.style.fillOpacity??1),e.fillStyle=Go(e,o.style.fill,"#4e79a7"),e.fill(),o.style.stroke&&(e.strokeStyle=Go(e,o.style.stroke,o.style.stroke),e.lineWidth=o.style.strokeWidth||1,e.stroke()),fa(e,o)}finally{e.restore()}}},xa=new Map;function ka(e){try{if(e.path)return new Path2D(e.path);const t=`${e.symbolType??"circle"}:${Math.round(e.size)}`;let o=xa.get(t);return o||(o=new Path2D(_t(e.symbolType,e.size)),xa.size>256&&xa.clear(),xa.set(t,o)),o}catch{return null}}var wa=(e,t)=>{const o=e.globalAlpha;for(const r of t){if("symbol"!==r.type)continue;const t=r;if(0>=t.size)continue;const n=ka(t);if(!n)continue;e.save(),e.translate(t.x,t.y),t.rotation&&e.rotate(t.rotation);const i=(t.style.opacity??1)*(t._decayOpacity??1);t.style.fill&&(e.globalAlpha=o*i*(t.style.fillOpacity??1),e.fillStyle=Go(e,t.style.fill,"#4e79a7"),e.fill(n)),t.style.stroke&&"none"!==t.style.stroke&&(e.globalAlpha=o*i,e.strokeStyle=Go(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth??1,e.stroke(n)),e.restore()}e.globalAlpha=o};function Sa(e,t,o,r,n){if(0>=t.size)return;const i=t.glyph;if(!i||!i.parts?.length)return;const s=Po(i,t.size);if(0>=s.scale)return;const a=(t.style.opacity??1)*(t._decayOpacity??1);if(0>=a)return;const l=t=>{const o=Go(e,t,t);return"string"==typeof o?o:t},c=t.color??("string"==typeof t.style.fill?t.style.fill:void 0);e.save(),e.translate(o,r),t.rotation&&e.rotate(t.rotation),e.translate(s.offsetX,s.offsetY),e.scale(s.scale,s.scale),e.globalAlpha=n*a*(t.style.fillOpacity??1);const u=To(i,t.fraction??1,t.fractionStart??0,t.fractionDirection??"horizontal");u&&t.ghostColor&&$o(e,i,c,t.accent,t.ghostColor,l),u&&(e.beginPath(),e.rect(u.x,u.y,u.width,u.height),e.clip()),$o(e,i,c,t.accent,void 0,l),e.restore()}var Aa=(e,t)=>{const o=e.globalAlpha;for(const r of t)"glyph"===r.type&&Sa(e,r,r.x,r.y,o);e.globalAlpha=o};function Ca(e,t){const{x:o,y:r,w:n,h:i}=t,{tl:s,tr:a,br:l,bl:c}=pi(t);e.beginPath(),e.moveTo(o+s,r),e.lineTo(o+n-a,r),a>0&&e.arcTo(o+n,r,o+n,r+a,a),e.lineTo(o+n,r+i-l),l>0&&e.arcTo(o+n,r+i,o+n-l,r+i,l),e.lineTo(o+c,r+i),c>0&&e.arcTo(o,r+i,o,r+i-c,c),e.lineTo(o,r+s),s>0&&e.arcTo(o,r,o+s,r,s),e.closePath()}function Ma(e){switch(e.roundedEdge){case"bottom":return{x0:e.x,y0:e.y+e.h,x1:e.x,y1:e.y};case"right":return{x0:e.x+e.w,y0:e.y,x1:e.x,y1:e.y};case"left":return{x0:e.x,y0:e.y,x1:e.x+e.w,y1:e.y};default:return{x0:e.x,y0:e.y,x1:e.x,y1:e.y+e.h}}}var ja=(e,t,o,r)=>{const n=t.filter(e=>"rect"===e.type);for(const t of n){if(null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon)Pa(e,t);else if(t.cornerRadii&&hi(t.cornerRadii)){const o=Go(e,t.style.fill,Oo(e,"var(--semiotic-primary, #007bff)")),r=Ma(t),n=t.fillGradient&&"string"==typeof o?Vo(e,t.fillGradient,o,r.x0,r.y0,r.x1,r.y1):null;e.fillStyle=n||o,Ca(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Oo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else if(t.roundedTop&&t.roundedTop>0){const o=Go(e,t.style.fill,Oo(e,"var(--semiotic-primary, #007bff)")),r=Ma(t),n=t.fillGradient&&"string"==typeof o?Vo(e,t.fillGradient,o,r.x0,r.y0,r.x1,r.y1):null;e.fillStyle=n||o;const i=Math.min(t.roundedTop,t.w/2,t.h/2);e.beginPath();const{x:s,y:a,w:l,h:c}=t;switch(t.roundedEdge){case"right":e.moveTo(s,a),e.lineTo(s+l-i,a),e.arcTo(s+l,a,s+l,a+i,i),e.lineTo(s+l,a+c-i),e.arcTo(s+l,a+c,s+l-i,a+c,i),e.lineTo(s,a+c);break;case"left":e.moveTo(s+l,a),e.lineTo(s+i,a),e.arcTo(s,a,s,a+i,i),e.lineTo(s,a+c-i),e.arcTo(s,a+c,s+i,a+c,i),e.lineTo(s+l,a+c);break;case"bottom":e.moveTo(s,a),e.lineTo(s+l,a),e.lineTo(s+l,a+c-i),e.arcTo(s+l,a+c,s+l-i,a+c,i),e.lineTo(s+i,a+c),e.arcTo(s,a+c,s,a+c-i,i);break;default:e.moveTo(s,a+c),e.lineTo(s,a+i),e.arcTo(s,a,s+i,a,i),e.lineTo(s+l-i,a),e.arcTo(s+l,a,s+l,a+i,i),e.lineTo(s+l,a+c)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Oo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const o=Go(e,t.style.fill,Oo(e,"var(--semiotic-primary, #007bff)")),r=Ma(t),n=t.fillGradient&&"string"==typeof o?Vo(e,t.fillGradient,o,r.x0,r.y0,r.x1,r.y1):null;e.fillStyle=n||o,e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Oo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}pa(e,t),e.globalAlpha=1}};function Pa(e,t){const o=t.style.icon,r=t.style.iconPadding||2,n=Math.min(t.w,t.h)-r;if(0>=n)return;const i=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),i){const i=n+r,s=t.x+(t.w-n)/2;for(let r=t.y+t.h-n;r>=t.y-n;r-=i)e.drawImage(o,s,r,n,n)}else{const i=n+r,s=t.y+(t.h-n)/2;for(let r=t.x;t.x+t.w>r;r+=i)e.drawImage(o,r,s,n,n)}e.restore()}function _a(e){const[t,o,r]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(e);return.299*t+.587*o+.114*r>128?"#000":"#fff"}function La(e){return Number.isInteger(e)?e+"":100>Math.abs(e)?1>Math.abs(e)?e.toPrecision(3):e.toFixed(1):e.toFixed(0)}var Ra=(e,t,o,r)=>{const n=t.filter(e=>"heatcell"===e.type);e.save();try{for(const t of n){const o=t.style;if(null!=o?.opacity&&(e.globalAlpha=o.opacity),e.fillStyle=t.fill,e.fillRect(t.x,t.y,t.w,t.h),e.strokeStyle=Oo(e,"var(--semiotic-surface, #fff)"),e.lineWidth=1,e.strokeRect(t.x,t.y,t.w,t.h),pa(e,t),e.globalAlpha=1,t.showValues&&null!=t.value){if(20>t.w||20>t.h)continue;const o=t.valueFormat?t.valueFormat(t.value):La(t.value),r=Math.max(10,Math.min(16,.3*Math.min(t.w,t.h))),n=t.x+t.w/2,i=t.y+t.h/2;e.fillStyle=_a(t.fill),e.font=r+"px sans-serif",e.textAlign="center",e.textBaseline="middle",e.fillText(o,n,i)}}}finally{e.restore()}},Ta=(e,t,o,r)=>{for(const o of t){if("candlestick"!==o.type)continue;const t=o;e.save();const n=(t._decayOpacity??1)*(t.style?.opacity??1);1!==n&&(e.globalAlpha=n);const i=Oo(e,t.wickColor)||t.wickColor,s=60>r.height,a=s?Math.max(t.wickWidth,2):t.wickWidth,l=()=>{e.beginPath(),e.moveTo(t.x,t.highY),e.lineTo(t.x,t.lowY),e.strokeStyle=i,e.lineWidth=a,e.stroke()};if(s||l(),t.isRange){const o=Math.max(2,Math.min(t.bodyWidth/2,.12*r.height));e.fillStyle=i,e.beginPath(),e.arc(t.x,t.highY,o,0,2*Math.PI),e.fill(),e.beginPath(),e.arc(t.x,t.lowY,o,0,2*Math.PI),e.fill()}else if(t.bodyWidth>0){const o=Math.min(t.openY,t.closeY),r=Math.abs(t.openY-t.closeY),n=t.isUp?t.upColor:t.downColor,i=Oo(e,n)||n;e.fillStyle=i,e.fillRect(t.x-t.bodyWidth/2,o,t.bodyWidth,Math.max(r,1)),e.strokeStyle=i,e.lineWidth=1,e.strokeRect(t.x-t.bodyWidth/2,o,t.bodyWidth,Math.max(r,1))}s&&l(),e.restore()}},Ia={line:[ba,da,va],area:[ba,va],stackedarea:[ba,va],scatter:[va,wa],bubble:[va,wa],heatmap:[Ra],bar:[ja],swarm:[va],waterfall:[(e,t,o,r)=>{ja(e,t);const n=t.filter(e=>"rect"===e.type);if(2>n.length)return;const i=n[0].datum,s=i?._connectorStroke;if(s){e.save(),e.strokeStyle=Oo(e,s)||s,e.lineWidth=i?._connectorWidth??1,e.setLineDash([]);for(let t=0;n.length-1>t;t++){const r=n[t],i=n[t+1],s=r.datum,a=i.datum;if(null==s?.cumEnd||null==a?.baseline)continue;const l=o.y(s.cumEnd),c=r.x+r.w,u=i.x;e.beginPath(),e.moveTo(c,l),e.lineTo(u,l),e.stroke()}e.restore()}}],candlestick:[Ta],mixed:[ba,da,va],custom:[ba,ja,Ra,da,va,wa,Aa,Ta]},$a=require("react/jsx-runtime");function Na(e){return"string"==typeof e?e:"value"}function Fa(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function Ba(e,t){if(!t)return Fa(e);try{const o=t(e);return null==o?Fa(e):o}catch{return Fa(e)}}function Da(e,t){return"function"==typeof t?t(e):e[t]}function Ea(e,t){if(!e)return[];const o=[];return(Array.isArray(e)?e:[e]).forEach((e,r)=>{const n="string"==typeof e?.y0Accessor?e.y0Accessor:"low",i="string"==typeof e?.y1Accessor?e.y1Accessor:"high";o.push({label:n,accessor:e=>e?.bands?.[r]?.y0??(0===r?e?.band?.y0:void 0),format:t}),o.push({label:i,accessor:e=>e?.bands?.[r]?.y1??(0===r?e?.band?.y1:void 0),format:t})}),o}function za(e){const t=e.find(e=>"title"===e.role),o=e.filter(e=>"title"!==e.role);return e=>{const r=e.data;if(!r)return null;const n=t?Ba(Da(r,t.accessor),t.format):null;return(0,$a.jsxs)("div",{className:"semiotic-tooltip",style:Rs,children:[null!=n&&(0,$a.jsx)("div",{style:{fontWeight:"bold",marginBottom:o.length>0?4:0},children:n}),o.map((e,t)=>{const o=Ba(Da(r,e.accessor),e.format);return(0,$a.jsxs)("div",{style:t>0?{marginTop:2}:void 0,children:[(0,$a.jsxs)("span",{style:{opacity:.7},children:[e.label,": "]}),(0,$a.jsx)("span",{children:o})]},t)})]})}}function Ha({categoryAccessor:e,valueAccessor:t,groupAccessor:o,groupLabel:r,pieData:n=!1,valueFormat:i}){return s=>{const a=n?s.data?.[0]||s.data||s:s.data||s,l=Da(a,e),c=Da(a,t),u=o?Da(a,o):void 0;return(0,$a.jsxs)("div",{className:"semiotic-tooltip",style:Rs,children:[(0,$a.jsx)("div",{style:{fontWeight:"bold"},children:Fa(l)}),(0,$a.jsx)("div",{style:{marginTop:4},children:Ba(c,i)}),null!=u&&(0,$a.jsxs)("div",{style:{marginTop:2,opacity:.8},children:[r||Na(o),": ",Fa(u)]})]})}}var Oa=require("react/jsx-runtime");function Wa(e){return null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+""}function qa({hover:e}){const t=e.data??{},o=t.y??t.value,r=t.x??t.time;if(void 0===o&&void 0===r){const e=_s(t);if(null!=e.title||e.entries.length>0)return(0,Oa.jsxs)("div",{className:"semiotic-tooltip",style:Rs,children:[null!=e.title&&(0,Oa.jsx)("div",{style:{fontWeight:600,marginBottom:e.entries.length?2:0},children:e.title+""}),e.entries.map(e=>(0,Oa.jsxs)("div",{style:{opacity:.7,fontSize:11},children:[e.key,":"," ",(0,Oa.jsx)("span",{style:{fontWeight:600},children:Wa(e.value)})]},e.key))]})}return(0,Oa.jsxs)("div",{className:"semiotic-tooltip",style:Rs,children:[(0,Oa.jsx)("div",{style:{fontWeight:600,marginBottom:2},children:Wa(o)}),(0,Oa.jsx)("div",{style:{opacity:.7,fontSize:11},children:Wa(r)})]})}qa.ownsChrome=!0;var Ya=require("react/jsx-runtime"),Ga={top:20,right:20,bottom:30,left:40},Va=Di;function Xa(e){if(e)return"x"===e.dimension?"pan-y":"y"===e.dimension?"pan-x":"none"}var Ua=(0,P.memo)((0,P.forwardRef)(function(e,t){const{chartType:o,runtimeMode:r,data:n,chunkThreshold:i,chunkSize:s,xAccessor:a,yAccessor:l,accessorRevision:c,colorAccessor:u,sizeAccessor:d,symbolAccessor:h,symbolMap:p,groupAccessor:f,lineDataAccessor:g,curve:m,normalize:y,baseline:b,stackOrder:v,binSize:x,valueAccessor:k,arrowOfTime:w="right",windowMode:S="sliding",windowSize:A=200,timeAccessor:C,xExtent:M,yExtent:_,extentPadding:L=.1,scalePadding:R,sizeRange:T,size:I=[500,300],responsiveWidth:$,responsiveHeight:N,margin:F,className:B,background:E,lineStyle:O,pointStyle:W,areaStyle:q,barStyle:Y,waterfallStyle:V,swarmStyle:X,barColors:U,colorScheme:K,boundsAccessor:Q,boundsStyle:Z,y0Accessor:J,band:ee,gradientFill:te,lineGradient:oe,areaGroups:re,openAccessor:ne,highAccessor:ie,lowAccessor:se,closeAccessor:ae,candlestickStyle:le,showAxes:ce=!0,axes:ue,xLabel:de,yLabel:he,yLabelRight:pe,xFormat:fe,yFormat:ge,axisExtent:me,tickFormatTime:ye,tickFormatValue:be,hoverAnnotation:ve,tooltipContent:xe,customHoverBehavior:ke,customClickBehavior:we,enableHover:Se,hoverRadius:Ae=30,tooltipMode:Ce,annotations:Me,autoPlaceAnnotations:je,svgAnnotationRules:Pe,showGrid:_e,legend:Le,legendHoverBehavior:Re,legendClickBehavior:Te,legendHighlightedCategory:Ie,legendIsolatedCategories:$e,legendPosition:Ne,legendLayout:Fe,legendCategoryAccessor:Be,onCategoriesChange:De,backgroundGraphics:Ee,foregroundGraphics:ze,canvasPreRenderers:He,svgPreRenderers:Oe,title:We,categoryAccessor:qe,brush:Ye,onBrush:Ge,decay:Ve,pulse:Xe,transition:Ue,animate:Ke,staleness:Qe,heatmapAggregation:Ze,heatmapXBins:Je,heatmapYBins:et,showValues:tt,heatmapValueFormat:ot,marginalGraphics:rt,pointIdAccessor:nt,xScaleType:it,yScaleType:st,accessibleTable:at=!0,description:lt,summary:ct,linkedCrosshairName:ut,linkedCrosshairSourceId:dt,customLayout:ht,onLayoutError:pt,layoutConfig:ft,layoutSelection:gt}=e,mt=(0,P.useId)().replace(/:/g,""),yt=(0,P.useRef)(!1),bt=(0,P.useRef)({w:-1,h:-1}),vt=(0,P.useRef)(!1),xt=Us({sizeProp:I,responsiveWidth:$,responsiveHeight:N,userMargin:F,marginDefault:Ga,animate:Ke,transitionProp:Ue,themeDirtyRef:yt}),kt=Mi(),St=Li(),{reducedMotionRef:At,responsiveRef:Ct,size:Mt,currentTheme:jt,transition:Pt,introEnabled:_t,tableId:Lt,rafRef:Rt,renderFnRef:Tt,scheduleRender:It,cancelRender:$t}=xt;let Nt=xt.margin;if(rt){const e=60,t={...xt.margin};rt.top&&e>t.top&&(t.top=e),rt.bottom&&e>t.bottom&&(t.bottom=e),rt.left&&e>t.left&&(t.left=e),rt.right&&e>t.right&&(t.right=e),Nt=t}const Ft=Mt[0]-Nt.left-Nt.right,Bt=Mt[1]-Nt.top-Nt.bottom,Dt=(0,P.useMemo)(()=>z(n),[n]),Et=ve??Se,zt=(0,P.useRef)(null),Ht=(0,P.useRef)(null),[Ot,Wt]=(0,P.useState)(0),qt=(0,P.useRef)(0),[Yt,Gt]=(0,P.useState)(null),Vt=(e,t)=>"function"==typeof e?e({size:Mt,margin:Nt,scales:t}):e,Xt=Vt(ze,Yt),Ut=Vt(Ee,Yt),Kt=(0,P.useRef)(null),Qt=(0,P.useRef)(null),Zt=(0,P.useRef)(void 0),[Jt,eo]=(0,P.useState)(null),to=(0,P.useRef)(Va.primary),oo=(0,P.useRef)(function(){let e=-1,t=Di;return{resolve(o){if(!o)return Di;const r=Do;return r===e||(t=function(e){if(!e)return Di;const t=getComputedStyle(e),o=t.getPropertyValue("--semiotic-border").trim(),r=t.getPropertyValue("--semiotic-text-secondary").trim(),n=t.getPropertyValue("--semiotic-bg").trim(),i=t.getPropertyValue("--semiotic-primary").trim(),s=r||t.getPropertyValue("--text-secondary").trim(),a=t.getPropertyValue("--text-primary").trim(),l=o||t.getPropertyValue("--surface-3").trim(),c=n||t.getPropertyValue("--surface-0").trim();return s||a||o||i?{axisStroke:l||Di.axisStroke,tickText:s||Di.tickText,crosshair:s?Ei(s,"66"):Di.crosshair,hoverFill:c?Ei(c,"4D"):Di.hoverFill,hoverStroke:s?Ei(s,"99"):Di.hoverStroke,pointRing:c||Di.pointRing,primary:i||Di.primary,background:c||Di.background}:Di}(o),e=r),t},invalidate(){e=-1}}}()),no=(0,P.useRef)(!1),io=(0,P.useRef)(new ao),so=(0,P.useRef)([]),lo=(0,P.useRef)(Be),uo=(0,P.useRef)(De);lo.current=Be,uo.current=De;const[ho,po]=(0,P.useState)(!1),[fo,go]=(0,P.useState)([]),[mo,bo]=(0,P.useState)([]),ko="streaming"===r||["bar","swarm","waterfall"].includes(o),wo=Ii((0,P.useMemo)(()=>({chartType:o,runtimeMode:ko?"streaming":"bounded",windowSize:A,windowMode:S,arrowOfTime:ko?w:"right",extentPadding:L,scalePadding:R,axisExtent:me,xAccessor:a,yAccessor:l,accessorRevision:c,timeAccessor:ko?C:void 0,valueAccessor:k,colorAccessor:u,sizeAccessor:d,symbolAccessor:h,symbolMap:p,groupAccessor:f||(g?"_lineGroup":void 0),categoryAccessor:qe,lineDataAccessor:g,xScaleType:it,yScaleType:st,xExtent:M,yExtent:_,sizeRange:T,binSize:x,normalize:y,baseline:b,stackOrder:v,boundsAccessor:Q,boundsStyle:Z,y0Accessor:J,band:ee,gradientFill:!0===te?{topOpacity:.8,bottomOpacity:.05}:!1===te?void 0:te,areaGroups:re?new Set(re):void 0,lineGradient:oe,openAccessor:ne,highAccessor:ie,lowAccessor:se,closeAccessor:ae,candlestickStyle:le,lineStyle:O,pointStyle:W,areaStyle:q,swarmStyle:X,waterfallStyle:V,colorScheme:K,barColors:U,barStyle:Y,annotations:Me,decay:Ve,pulse:Xe,transition:Pt,introAnimation:_t,staleness:Qe,heatmapAggregation:Ze,heatmapXBins:Je,heatmapYBins:et,showValues:tt,heatmapValueFormat:ot,pointIdAccessor:nt,curve:m,themeCategorical:jt?.colors?.categorical,themeSemantic:G(jt),themeSequential:jt?.colors?.sequential,themeDiverging:jt?.colors?.diverging,customLayout:ht,onLayoutError:pt,layoutConfig:ft,layoutMargin:Nt}),[o,A,S,w,L,R,me,a,l,c,C,k,it,st,u,d,h,p,f,qe,g,M,_,T,x,y,b,v,Q,Z,J,ee,te,oe,re,ne,ie,se,ae,le,O,W,q,X,V,Y,K,U,Me,Ve,Xe,Pt?.duration,Pt?.easing,_t,Qe,Ze,Je,et,tt,ot,ko,nt,m,jt,ht,pt,ft,Nt])),So=(0,P.useRef)(null);So.current||(So.current=new ro(wo));const Ao=function(e,t,o,r){return(0,Js.useCallback)(()=>{const n=t.current,i=o.current;if(!i||!n)return;const s=ea(e.current?.getData()??[],n);ta(s,r.current)||(r.current=s,i(s))},[t,o,r,e])}(So,lo,uo,so);vo(So,wo,yt,It),xo(So,gt,yt,It);const Co=(0,P.useRef)(null);Co.current||(Co.current=new H(e=>{const t=So.current;t&&t.ingest(e)&&(yt.current=!0,It())},{chunkThreshold:i,chunkSize:s})),(0,P.useEffect)(()=>{Co.current?.updateChunkOptions({chunkThreshold:i,chunkSize:s})},[i,s]);const Mo=(0,P.useCallback)(e=>{Co.current?.push(e)},[]),jo=(0,P.useCallback)(e=>{Co.current?.pushMany(e)},[]),Po=(0,P.useCallback)(()=>{Co.current?.clear(),So.current?.clear(),yt.current=!0,It()},[It]);(0,P.useImperativeHandle)(t,()=>({push:Mo,pushMany:jo,remove:e=>{Co.current?.flush();const t=So.current?.remove(e)??[];return t.length>0&&(Kt.current&&t.some(e=>e===Kt.current?.data)&&(Kt.current=null,eo(null)),yt.current=!0,It()),t},update:(e,t)=>{Co.current?.flush();const o=So.current?.update(e,t)??[];return o.length>0&&(yt.current=!0,It()),o},clear:Po,getData:()=>(Co.current?.flush(),So.current?.getData()??[]),getScales:()=>So.current?.scales??null,getExtents:()=>So.current?.getExtents()??null,getCustomLayout:()=>So.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>So.current?.lastCustomLayoutFailure??null}),[Mo,jo,Po,It]),(0,P.useEffect)(()=>{if(n){if(g&&Dt.length>0&&"object"==typeof Dt[0]&&null!==Dt[0]){const e="string"==typeof g?g:"coordinates";if(Array.isArray(Dt[0][e])){const t=[];for(const o of Dt){const r=o[e];if(Array.isArray(r)){const e=o.label||o.id||o.key;if(null!=e)for(const o of r)t.push({...o,_lineGroup:e});else for(const e of r)t.push(e)}}return void Co.current?.setBoundedData(t)}}Co.current?.setBoundedData(Dt)}},[n,Dt,g]);const{hoverHandlerRef:_o,hoverLeaveRef:Lo,onPointerMove:Ro,onPointerLeave:To}=xt;_o.current=e=>{if(!Et)return;const t=zt.current;if(!t)return;const r=t.getBoundingClientRect(),n=e.clientX-r.left-Nt.left,i=e.clientY-r.top-Nt.top;if(0>n||n>Ft||0>i||i>Bt)return void(Kt.current&&(Kt.current=null,Qt.current=null,eo(null),ke&&(ke(null),yt.current=!0),It()));const s=So.current;if(!s||0===s.scene.length)return;const l=ks(Ae,e.pointerType),c=Zo(s.scene,n,i,l,s.quadtree,s.maxPointRadius),u="multi"===Ce,d=()=>{Kt.current&&(Kt.current=null,Qt.current=null,eo(null),ke&&ke(null),It())};if(!c&&!u)return void d();const h=u||!c?n:c.x,p=u||!c?i:c.y,f=c?.datum?wt(c.datum,s.resolvedRibbons):{},g=s.scales?.x?.invert,m="function"==typeof g?g(h):void 0;let y=Ss(f,h,p,null!=m?{xValue:m,xPx:h}:void 0);if(u&&s.scene.length>0&&s.scales){const e=function(e,t,o=30){const r=[];for(const n of e)if("line"===n.type){const e=n;if(2>e.path.length)continue;const i=Jo(Qo(e.path,e.curve),t,o);if(null===i)continue;const s=cr(e.path,t);r.push({node:n,datum:Array.isArray(e.datum)&&e.datum[s]?e.datum[s]:e.datum,x:e.path[s][0],y:i,group:e.group,color:e.style.stroke})}else if("area"===n.type){const e=n;if(!1===e.interactive)continue;if(2>e.topPath.length)continue;const i=Qo(e.topPath,e.curve),s=Qo(e.bottomPath,e.curve),a=Jo(i,t,o);if(null===a)continue;const l=Jo(s,t,o),c=cr(e.topPath,t);r.push({node:n,datum:Array.isArray(e.datum)&&e.datum[c]?e.datum[c]:e.datum,x:e.topPath[c][0],y:a,y0:l??void 0,group:e.group,color:"string"==typeof e.style.stroke?e.style.stroke:"string"==typeof e.style.fill?e.style.fill:void 0})}return r}(s.scene,h,Math.max(l,Ft));if(e.length>0){const t=s.scales.y.invert,r=to.current,n=g?g(h):h;if(c)y.xValue=n,y.xPx=h;else{const e={xValue:n};"string"==typeof a&&(e[a]=n),y=Ss(e,h,p,{xValue:n,xPx:h})}y.allSeries=e.map(e=>{const n=t?t(e.y):e.y,i=null!=e.y0?t?t(e.y0):e.y0:void 0;return{group:e.group||"",value:"stackedarea"===o&&null!=i?n-i:n,valuePx:e.y,color:e.color||r,datum:wt(e.datum,s.resolvedRibbons)}})}}c||y.allSeries?.length?(Kt.current=y,Qt.current=c?.node??null,eo(y),ke&&(ke(y),yt.current=!0),It()):d()},Lo.current=()=>{Kt.current&&(Kt.current=null,Qt.current=null,eo(null),ke&&(ke(null),yt.current=!0),It())};const $o=(0,P.useRef)(()=>{});$o.current=e=>{if(!we)return;const t=zt.current;if(!t)return;const o=t.getBoundingClientRect(),r=e.clientX-o.left-Nt.left,n=e.clientY-o.top-Nt.top;if(0>r||r>Ft||0>n||n>Bt)return void we(null);const i=So.current;if(!i||0===i.scene.length)return void we(null);const s=ks(Ae,Zt.current),a=Zo(i.scene,r,n,s,i.quadtree,i.maxPointRadius);if(!a)return void we(null);const l=a.datum||{},c=i.scales?.x?.invert,u="function"==typeof c?c(a.x):void 0;we(Ss(l,a.x,a.y,null!=u?{xValue:u,xPx:a.x}:void 0))};const No=(0,P.useCallback)(e=>$o.current(e),[]),Fo=(0,P.useRef)(-1),Bo=(0,P.useRef)(null),Eo=(0,P.useRef)(null),zo=(0,P.useCallback)(e=>{const t=So.current;if(!t||0===t.scene.length)return;const o=t.version;let r;if(Eo.current&&Eo.current.version===o)r=Eo.current.graph;else{const e=function(e){const t=[];for(const o of e)switch(o.type){case"point":t.push({x:o.x,y:o.y,datum:o.datum,shape:"circle",group:"_default"});break;case"symbol":if(0>=o.size)break;t.push({x:o.x,y:o.y,datum:o.datum,shape:"circle",group:"_default"});break;case"glyph":{if(0>=o.size||null==o.datum)break;const e=Io(o.glyph,o.size);t.push({x:o.x+e.centerDx,y:o.y+e.centerDy,datum:o.datum,shape:"rect",w:2*e.halfWidth,h:2*e.halfHeight,group:"_default"});break}case"line":{const e=o,r=Array.isArray(e.datum)?e.datum:[],n=e.group??"_default";for(let o=0;e.path.length>o&&r.length>o;o++)t.push({x:e.path[o][0],y:e.path[o][1],datum:r[o],shape:"circle",group:n});break}case"area":{const e=o,r=Array.isArray(e.datum)?e.datum:[],n=e.group??"_default";for(let o=0;e.topPath.length>o&&r.length>o;o++)t.push({x:e.topPath[o][0],y:e.topPath[o][1],datum:r[o],shape:"circle",group:n});break}case"rect":t.push({x:o.x+o.w/2,y:o.y+o.h/2,datum:o.datum,shape:"rect",w:o.w,h:o.h,group:o.group??"_default"});break;case"heatcell":t.push({x:o.x+o.w/2,y:o.y+o.h/2,datum:o.datum,shape:"rect",w:o.w,h:o.h,group:"_default"})}return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}(t.scene);if(0===e.length)return;r=ur(e),Eo.current={version:o,graph:r}}const n=Fo.current;if(0>n){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),Fo.current=0;const o=r.flat[0];Bo.current={shape:o.shape,w:o.w,h:o.h};const n=gr({...o,datum:wt(o.datum,t.resolvedRibbons)});return Kt.current=n,eo(n),ke&&ke(n),void It()}const i=dr(r,n),s=hr(e.key,i,r);if(null===s)return;if(e.preventDefault(),0>s)return Fo.current=-1,Bo.current=null,Kt.current=null,Qt.current=null,eo(null),ke&&ke(null),void It();Fo.current=s;const a=r.flat[s];Bo.current={shape:a.shape,w:a.w,h:a.h};const l=gr({...a,datum:wt(a.datum,t.resolvedRibbons)});Kt.current=l,eo(l),ke&&ke(l),It()},[ke,It]),Ho=(0,P.useCallback)(e=>{Zt.current=e.pointerType,Fo.current=-1,Bo.current=null,Ro(e)},[Ro]),Oo=(0,P.useCallback)(e=>{Zt.current="mouse",Fo.current=-1,Bo.current=null,Ro({clientX:e.clientX,clientY:e.clientY,pointerType:"mouse"})},[Ro]),Wo=(0,P.useCallback)(e=>{Zt.current=e.pointerType},[]);Tt.current=()=>{Rt.current=null;const e=zt.current,t=Ht.current;if(!e||!t)return;const r=So.current;if(!r)return;const n="undefined"!=typeof performance?performance.now():Date.now(),i=r.advanceTransition(At.current?n+1e6:n),s=!At.current&&i,c=bt.current.w!==Ft||bt.current.h!==Bt,u=yt.current||i||c,d=r.consumeStylePaintPending();let h=!1;const p=r.getLastUpdateResult(),f=io.current.beforeCompute(p,s);!u||s&&!c||(r.computeScene({width:Ft,height:Bt}),bt.current={w:Ft,h:Bt},h=!0,Ao()),io.current.afterCompute(f,h,c);const g=Ks(r,n,h,vt),m=Zs(),y=oo.current.resolve(e);to.current=y.primary;const b=vr(Qe,r.lastIngestTime>0?n-r.lastIngestTime:0),v=Qe&&b.isStale;if(u||d||g.changed){const t=Qs(e,Mt,Nt,m);if(t){if(t.clearRect(-Nt.left,-Nt.top,Mt[0],Mt[1]),Qe&&1>b.alpha&&(t.globalAlpha=b.alpha),Bi(t,{background:E,hasBackgroundGraphics:!!Ee,themeBackground:y.background,x:-Nt.left,y:-Nt.top,width:Mt[0],height:Mt[1]}),t.save(),"function"==typeof t.rect&&(t.beginPath(),t.rect(0,0,Ft,Bt),t.clip()),He&&r.scales)for(const e of He)t.save(),e(t,r.scene,r.scales,{width:Ft,height:Bt}),t.restore();const e=ht?Ia.custom:Ia[o];if(e&&r.scales)for(const o of e)o(t,r.scene,r.scales,{width:Ft,height:Bt});t.restore(),Qe&&1>b.alpha&&(t.globalAlpha=1)}}const x=!!(Et&&Kt.current&&r.scales),k=!!(Qt.current&&Array.isArray(ve)&&ve.some(e=>e&&"object"==typeof e&&"highlight"===e.type)),w=x||k;if(w||no.current){const e=Qs(t,Mt,Nt,m);if(e&&(e.clearRect(-Nt.left,-Nt.top,Mt[0],Mt[1]),x&&Kt.current&&function(e,t,o,r,n,i,s){if(!1===n.crosshair)return;const a=t.allSeries,l=a&&a.length>0,c=t.xPx??t.x;e.save();const u="object"==typeof n.crosshair?n.crosshair:{};if(e.strokeStyle=u.stroke||s.crosshair,e.lineWidth=u.strokeWidth||1,e.setLineDash(u.strokeDasharray?u.strokeDasharray.split(/[\s,]+/).map(Number):[4,4]),e.beginPath(),e.moveTo(l?c:t.x,0),e.lineTo(l?c:t.x,r),e.stroke(),l||(e.beginPath(),e.moveTo(0,t.y),e.lineTo(o,t.y),e.stroke()),e.restore(),l){e.lineWidth=2,e.strokeStyle=s.pointRing;for(const t of a)null!=t.valuePx&&(e.beginPath(),e.arc(c,t.valuePx,4,0,2*Math.PI),e.fillStyle=t.color||s.primary,e.fill(),e.stroke())}else{const o=n.pointColor||function(e){if(!e)return null;if("heatcell"===e.type)return e.fill||null;if("candlestick"===e.type)return e.isUp?e.upColor:e.downColor;const{style:t}=e;if(!t)return null;const o="string"==typeof t.fill?t.fill:null;return"line"===e.type||"area"===e.type?t.stroke||o||null:o||t.stroke||null}(i)||s.primary;e.beginPath(),e.arc(t.x,t.y,4,0,2*Math.PI),e.fillStyle=o,e.fill(),e.strokeStyle=s.pointRing,e.lineWidth=2,e.stroke()}}(e,Kt.current,Ft,Bt,"object"==typeof Et?Et:{},Qt.current,y),k&&Qt.current&&Array.isArray(ve))){const t=ve.find(e=>e&&"object"==typeof e&&"highlight"===e.type);t&&function(e,t,o,r,n){if(!o)return;const i="group"in o?o.group:void 0;if(void 0!==i)for(const o of t){if("line"!==o.type)continue;if(o.group!==i)continue;if(2>o.path.length)continue;const t="function"==typeof r.style?o.datum?r.style(o.datum):{}:r.style||{};e.save(),e.beginPath(),e.moveTo(o.path[0][0],o.path[0][1]);for(let t=1;o.path.length>t;t++)e.lineTo(o.path[t][0],o.path[t][1]);e.strokeStyle=t.stroke||o.style.stroke||n.primary,e.lineWidth=t.strokeWidth||(o.style.strokeWidth||2)+2,e.globalAlpha=t.opacity??1,e.stroke(),e.restore()}}(e,r.scene,Qt.current,t,y)}no.current=w}u&&e&&e.setAttribute("aria-label",Qi(r.scene,o+" chart"));const S=yt.current;if(yt.current=S&&s&&!h,S&&r.scales){const e=e=>"object"==typeof e&&null!==e&&"function"==typeof e.valueOf?e.valueOf():e;if((!Yt||e(Yt.x.domain()[0])!==e(r.scales.x.domain()[0])||e(Yt.x.domain()[1])!==e(r.scales.x.domain()[1])||e(Yt.y.domain()[0])!==e(r.scales.y.domain()[0])||e(Yt.y.domain()[1])!==e(r.scales.y.domain()[1])||Yt.x.range()[0]!==r.scales.x.range()[0]||Yt.x.range()[1]!==r.scales.x.range()[1]||Yt.y.range()[0]!==r.scales.y.range()[0]||Yt.y.range()[1]!==r.scales.y.range()[1])&&Gt(r.scales),rt){const e=r.getData(),t="function"==typeof a?a:e=>e[a||"x"],o="function"==typeof l?l:e=>e[l||"y"];go(e.map(e=>t(e)).filter(e=>"number"==typeof e&&isFinite(e))),bo(e.map(e=>o(e)).filter(e=>"number"==typeof e&&isFinite(e)))}}!((Me&&Me.length>0||ht)&&(h||s))||!h&&33>n-qt.current||(Wt(e=>e+1),qt.current=n),Qe?.showBadge&&po(!!v),(s||null!=r.activeTransition||g.pending)&&It()},Ri({hydrated:kt,wasHydratingFromSSR:St,storeRef:So,dirtyRef:yt,renderFnRef:Tt,cancelRender:$t,cleanup:()=>Co.current?.clear()}),(0,P.useEffect)(()=>{yt.current=!0,It()},[o,Ft,Bt,ce,E,Ee,O,He,It]),xr(Qe,So,yt,It,ho,po);const qo=(0,P.useMemo)(()=>{if(fe||ye)return;const e=So.current;return e?.xIsDate&&Yt?sa(Yt.x.domain()):void 0},[fe,ye,Yt]),Yo=fe||ye||qo,Go=Et&&Jt?xe?xe(Jt):(0,Ya.jsx)(qa,{hover:Jt}):null,Vo=Go?(0,Ya.jsx)(Es,{x:Jt.x,y:Jt.y,containerWidth:Ft,containerHeight:Bt,margin:Nt,className:"stream-frame-tooltip",children:Go}):null,Xo=Bo.current,Uo=(0,Ya.jsx)(vs,{active:Fo.current>=0,hoverPoint:Jt,margin:Nt,size:Mt,shape:Xo?.shape,width:Xo?.w,height:Xo?.h}),Ko=oa(a,C,"__semiotic_resolvedX","__semiotic_resolvedTime"),er=oa(l,k,"__semiotic_resolvedY","__semiotic_resolvedValue"),tr=Ko.key,or=er.key,rr=ra(Ko,er,Me&&Me.length>0||!1);if(Si||!kt&&St){const e=So.current;e&&n&&(e.ingest({inserts:Dt,bounded:!0}),e.computeScene({width:Ft,height:Bt}));const t=e?.scene??[],o=e?.scales??null,r=Vt(ze,o),i=Vt(Ee,o),s=Yo||(()=>{if(e?.xIsDate&&o)return sa(o.x.domain())})();return(0,Ya.jsxs)("div",{ref:Ct,className:"stream-xy-frame"+(B?" "+B:""),role:"img","aria-label":lt||("string"==typeof We?We:"XY chart"),style:{position:"relative",width:$?"100%":Mt[0],height:N?"100%":Mt[1]},children:[(0,Ya.jsx)(fs,{summary:ct}),(0,Ya.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:Mt[0],height:Mt[1],style:{position:"absolute",left:0,top:0},children:[(0,Ya.jsx)("g",{transform:`translate(${Nt.left},${Nt.top})`,children:i}),(0,Ya.jsxs)("g",{transform:`translate(${Nt.left},${Nt.top})`,children:[E&&(0,Ya.jsx)("rect",{x:0,y:0,width:Ft,height:Bt,fill:E}),Oe&&o&&Oe.map((e,r)=>(0,Ya.jsx)(j.Fragment,{children:e(t,o,{width:Ft,height:Bt})},"svgpre-"+r)),t.map((e,t)=>function(e,t,o){switch(e.type){case"line":{const o=e;if(0===o.path.length)return null;const r="M"+o.path.map(([e,t])=>`${e},${t}`).join("L");return(0,yi.jsx)("path",{d:r,fill:"none",stroke:o.style.stroke||"#4e79a7",strokeWidth:o.style.strokeWidth||2,strokeDasharray:o.style.strokeDasharray,opacity:o.style.opacity},"line-"+t)}case"area":{const r=e;if(0===r.topPath.length)return null;const n=`M${r.topPath.map(([e,t])=>`${e},${t}`).join("L")}L${[...r.bottomPath].reverse().map(([e,t])=>`${e},${t}`).join("L")}Z`;if(r.clipRect){const e=`${o?o+"-":""}area-clip-${t}`;return(0,yi.jsxs)("g",{children:[(0,yi.jsx)("defs",{children:(0,yi.jsx)("clipPath",{id:e,children:(0,yi.jsx)("rect",{x:r.clipRect.x,y:r.clipRect.y,width:r.clipRect.width,height:r.clipRect.height})})}),(0,yi.jsx)("path",{d:n,fill:vi(r.style.fill),fillOpacity:r.style.fillOpacity??r.style.opacity??.7,stroke:r.style.stroke,strokeWidth:r.style.strokeWidth,clipPath:`url(#${e})`})]},"area-"+t)}return(0,yi.jsx)("path",{d:n,fill:vi(r.style.fill),fillOpacity:r.style.fillOpacity??r.style.opacity??.7,stroke:r.style.stroke,strokeWidth:r.style.strokeWidth},"area-"+t)}case"point":{const o=e;return(0,yi.jsx)("circle",{cx:o.x,cy:o.y,r:o.r,fill:vi(o.style.fill),opacity:o.style.opacity??.8,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth},"point-"+t)}case"symbol":return xi(e,t);case"glyph":return ki(e,e.x,e.y,`${o??""}glyph-${e.pointId??t}`);case"rect":{const o=e;return(0,yi.jsx)("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:vi(o.style.fill),opacity:o.style.opacity,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth},"rect-"+t)}case"heatcell":{const o=e;if(o.showValues&&null!=o.value&&o.w>=20&&o.h>=20){const e=o.valueFormat?o.valueFormat(o.value):Number.isInteger(o.value)?o.value+"":100>Math.abs(o.value)?1>Math.abs(o.value)?o.value.toPrecision(3):o.value.toFixed(1):o.value.toFixed(0),[r,n,i]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(o.fill),s=.299*r+.587*n+.114*i>128?"#000":"#fff",a=Math.max(10,Math.min(16,.3*Math.min(o.w,o.h)));return(0,yi.jsxs)("g",{children:[(0,yi.jsx)("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:o.fill}),(0,yi.jsx)("text",{x:o.x+o.w/2,y:o.y+o.h/2,textAnchor:"middle",dominantBaseline:"middle",fill:s,fontSize:a+"px",children:e})]},"heatcell-"+t)}return(0,yi.jsx)("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:o.fill},"heatcell-"+t)}case"candlestick":{const o=e,r=Math.min(o.openY,o.closeY),n=Math.max(Math.abs(o.openY-o.closeY),1),i=o.isUp?o.upColor:o.downColor;return(0,yi.jsxs)("g",{children:[(0,yi.jsx)("line",{x1:o.x,y1:o.highY,x2:o.x,y2:o.lowY,stroke:o.wickColor,strokeWidth:o.wickWidth}),(0,yi.jsx)("rect",{x:o.x-o.bodyWidth/2,y:r,width:o.bodyWidth,height:n,fill:i,stroke:i,strokeWidth:1})]},"candle-"+t)}default:return null}}(e,t,mt)).filter(Boolean)]})]}),(0,Ya.jsx)(ci,{width:Ft,height:Bt,totalWidth:Mt[0],totalHeight:Mt[1],margin:Nt,scales:o,showAxes:ce,axes:ue,xLabel:de,yLabel:he,yLabelRight:pe,xFormat:s,yFormat:ge||be,axisExtent:me,showGrid:_e,title:We,legend:Le,legendHoverBehavior:Re,legendClickBehavior:Te,legendHighlightedCategory:Ie,legendIsolatedCategories:$e,legendPosition:Ne,legendLayout:Fe,foregroundGraphics:co(r,yo(So.current?.customLayoutOverlays,gt??null)),marginalGraphics:rt,xValues:[],yValues:[],annotations:Me,autoPlaceAnnotations:je,svgAnnotationRules:Pe,annotationFrame:0,xAccessor:tr,yAccessor:or,annotationData:rr(e?.getData()),pointNodes:aa(e?.scene),curve:"string"==typeof m?m:void 0,linkedCrosshairName:ut,linkedCrosshairSourceId:dt})]})}return(0,Ya.jsxs)("div",{ref:Ct,className:"stream-xy-frame"+(B?" "+B:""),role:"group","aria-label":lt||("string"==typeof We?We:"XY chart"),tabIndex:0,style:{position:"relative",width:$?"100%":Mt[0],height:N?"100%":Mt[1],overflow:"visible",touchAction:Xa(Ye)},onKeyDown:zo,children:[at&&(0,Ya.jsx)(gs,{tableId:Lt}),at&&(0,Ya.jsx)(hs,{scene:So.current?.scene??[],chartType:o+" chart",tableId:Lt,chartTitle:"string"==typeof We?We:void 0}),(0,Ya.jsx)(fs,{summary:ct}),(0,Ya.jsx)(ms,{hoverPoint:Jt}),(0,Ya.jsxs)("div",{role:"img","aria-label":lt||("string"==typeof We?We:"XY chart"),style:{position:"relative",width:"100%",height:"100%"},onPointerMove:Et?Ho:void 0,onMouseMove:Et?Oo:void 0,onPointerLeave:Et?To:void 0,onMouseLeave:Et?To:void 0,onPointerDown:Et||we?Wo:void 0,onClick:we?No:void 0,children:[Ut&&(0,Ya.jsx)("svg",{style:{position:"absolute",left:0,top:0,width:Mt[0],height:Mt[1],pointerEvents:"none"},children:(0,Ya.jsx)("g",{transform:`translate(${Nt.left},${Nt.top})`,children:Ut})}),(0,Ya.jsx)(si,{width:Ft,height:Bt,totalWidth:Mt[0],totalHeight:Mt[1],margin:Nt,scales:Yt,showAxes:ce,axes:ue,showGrid:_e,xFormat:Yo,yFormat:ge||be,axisExtent:me}),(0,Ya.jsx)("canvas",{ref:zt,"aria-label":Qi(So.current?.scene??[],o+" chart"),style:{position:"absolute",left:0,top:0}}),(0,Ya.jsx)("canvas",{ref:Ht,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),(0,Ya.jsx)(ci,{width:Ft,height:Bt,totalWidth:Mt[0],totalHeight:Mt[1],margin:Nt,scales:Yt,showAxes:ce,axes:ue,xLabel:de,yLabel:he,yLabelRight:pe,xFormat:Yo,yFormat:ge||be,axisExtent:me,showGrid:_e,title:We,legend:Le,legendHoverBehavior:Re,legendClickBehavior:Te,legendHighlightedCategory:Ie,legendIsolatedCategories:$e,legendPosition:Ne,legendLayout:Fe,foregroundGraphics:co(Xt,yo(So.current?.customLayoutOverlays,gt??null)),marginalGraphics:rt,xValues:fo,yValues:mo,annotations:Me,autoPlaceAnnotations:je,svgAnnotationRules:Pe,annotationFrame:Ot,xAccessor:tr,yAccessor:or,annotationData:rr(So.current?.getData()),pointNodes:aa(So.current?.scene),curve:"string"==typeof m?m:void 0,underlayRendered:!0,canvasObscuresUnderlay:"transparent"!==E&&!Ee,linkedCrosshairName:ut,linkedCrosshairSourceId:dt}),(Ye||Ge)&&(0,Ya.jsx)(D,{width:Ft,height:Bt,totalWidth:Mt[0],totalHeight:Mt[1],margin:Nt,dimension:Ye?.dimension??"xy",scales:Yt,onBrush:Ge??(()=>{}),binSize:x,snap:Ye?.snap,binBoundaries:Ye?.binBoundaries??("bar"===o?So.current?.getBinBoundaries():void 0),snapDuring:Ye?.snapDuring,streaming:"streaming"===r}),Qe?.showBadge&&(0,Ya.jsx)(wr,{isStale:ho,position:Qe.badgePosition}),Uo,Vo]})]})}));Ua.displayName="StreamXYFrame";var Ka=Ua,Qa=require("react"),Za=require("d3-scale");function Ja(e){const t=e.getSymbol;if(!t)return null;const o=e.config.symbolMap,r=new Map;let n=0;return e=>{const i=t(e)+"",s=o?.[i];if(s)return s;let a=r.get(i);return a||(a=Pt[n%Pt.length],n++,r.set(i,a)),a}}function el(e,t,o,r,n,i,s){e.push(t?{type:"symbol",x:r,y:n,size:Math.PI*i*i,symbolType:t(o),style:s,datum:o}:{type:"point",x:r,y:n,r:i,style:s,datum:o})}function tl(e,t){const{columns:o,config:r,resolvePieceStyle:n}=e,i=[],s=Math.min(t.width,t.height)/2-4,a="donut"===r.chartType?r.innerRadius||60:0,l=-Math.PI/2+(r.startAngle||0)*Math.PI/180,c=null!=r.sweepAngle?r.sweepAngle*Math.PI/180:2*Math.PI,u=null!=r.sweepAngle&&360>r.sweepAngle,d=Object.values(o),h=d.some(e=>{const t=e.pieceData[0];return t&&("number"==typeof t._pct||"number"==typeof t._pctStart||null!=t._roundedEnds)}),p=u&&!h&&d.length>1&&(r.cornerRadius??0)>0;for(let e=0;d.length>e;e++){const t=d[e],o=t.pieceData[0],u="number"==typeof o?._pctStart?o._pctStart:t.pctStart,h=l+u*c,f=l+(u+("number"==typeof o?._pct?o._pct:t.pct))*c,g=n(t.pieceData[0],t.name),m=0===e,y=e===d.length-1,b={type:"wedge",cx:0,cy:0,innerRadius:a,outerRadius:s,startAngle:h,endAngle:f,...r.cornerRadius&&{cornerRadius:r.cornerRadius},style:g,datum:o?._nonInteractive?null:t.pieceData,category:t.name};o?._roundedEnds?b.roundedEnds=o._roundedEnds:p&&(b.roundedEnds={start:m,end:y}),o?._gradientBand&&(b._gradientBand=o._gradientBand),i.push(b)}return i}var ol=require("d3-array");function rl(e){const t=e.length,o=e[0],r=e[t-1];return{n:t,min:o,q1:(0,ol.quantile)(e,.25)??o,median:(0,ol.quantile)(e,.5)??(o+r)/2,q3:(0,ol.quantile)(e,.75)??r,max:r,mean:e.reduce((e,t)=>e+t,0)/t}}h();var nl=require("d3-scale"),il={bar:function(e,t){const{scales:o,columns:r,config:n,getR:i,getStack:s,resolvePieceStyle:a}=e,{r:l,projection:c}=o,u=[],d="vertical"===c,h="horizontal"===c,p=n.normalize,f=[];if(s){const e=new Set;for(const t of Object.values(r))for(const o of t.pieceData){const t=s(o);e.has(t)||(e.add(t),f.push(t))}}else f.push("_default");for(const e of Object.values(r)){const t=new Map;for(const o of e.pieceData){const e=s?s(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const r=t.get(e);r.total+=i(o),r.pieces.push(o)}let o=0;if(p)for(const e of t.values())o+=Math.abs(e.total);let r=0,n=0;for(const i of f){const c=t.get(i);if(!c)continue;let f=c.total;p&&o>0&&(f/=o);const g=a(c.pieces[0],s?i:e.name),m={...c.pieces[0],__aggregateValue:c.total,__pieceCount:c.pieces.length,category:e.name};if(d){const t=l(0>f?n:r+f),o=0>f?l(n+f)-l(n):l(r)-l(r+f);u.push(gt(e.x,t,e.width,Math.abs(o),g,m,i)),0>f?n+=f:r+=f}else if(h){const t=l(0>f?n+f:r),o=0>f?l(n)-l(n+f):l(r+f)-l(r);u.push(gt(t,e.x,Math.abs(o),e.width,g,m,i)),0>f?n+=f:r+=f}}}const g="vertical"===c,m=n.roundedTop&&n.roundedTop>0?Math.max(0,n.roundedTop):0;for(const e of u){if("rect"!==e.type)continue;const t=e.datum?.__aggregateValue??0;e.roundedEdge=g?0>t?"bottom":"top":0>t?"left":"right",n.gradientFill&&(e.fillGradient=n.gradientFill)}if(m>0){const e=new Map;for(const t of u){if("rect"!==t.type)continue;const o=t.datum?.category||"";e.has(o)||e.set(o,[]),e.get(o).push(t)}for(const t of e.values()){if(0===t.length)continue;const e=t.filter(e=>(e.datum?.__aggregateValue??0)>=0),o=t.filter(e=>0>(e.datum?.__aggregateValue??0));e.length>0&&(e.reduce(g?(e,t)=>t.y>e.y?e:t:(e,t)=>e.x+e.w>t.x+t.w?e:t).roundedTop=m),o.length>0&&(o.reduce(g?(e,t)=>e.y+e.h>t.y+t.h?e:t:(e,t)=>t.x>e.x?e:t).roundedTop=m)}}return u},clusterbar:function(e,t){const{scales:o,columns:r,config:n,getR:i,getGroup:s,resolvePieceStyle:a}=e,{r:l,projection:c}=o,u=[],d="vertical"===c,h=[],p=new Set;for(const e of Object.values(r))for(const t of e.pieceData){const e=s?s(t):"_default";p.has(e)||(p.add(e),h.push(e))}const f=h.length||1;for(const e of Object.values(r)){const t=e.width/f,o=.2*t,r=t-o,n=new Map;for(const t of e.pieceData){const e=s?s(t):"_default";n.has(e)||n.set(e,[]),n.get(e).push(t)}for(let s=0;h.length>s;s++){const c=n.get(h[s])||[];for(const n of c){const c=i(n),p=a(n,h[s]);if(d){const i=e.x+s*t+o/2,a=l(0),d=l(c);u.push(gt(i,Math.min(a,d),r,Math.abs(a-d),p,n,h[s]))}else{const i=e.x+s*t+o/2,a=l(0),d=l(c);u.push(gt(Math.min(a,d),i,Math.abs(d-a),r,p,n,h[s]))}}}}const g=n.roundedTop&&n.roundedTop>0?Math.max(0,n.roundedTop):0;for(const e of u){if("rect"!==e.type)continue;if(null==e.datum)continue;const t=i(e.datum);g>0&&(e.roundedTop=g),e.roundedEdge=d?0>t?"bottom":"top":0>t?"left":"right",n.gradientFill&&(e.fillGradient=n.gradientFill)}return u},point:function(e,t){const{scales:o,columns:r,getR:n,multiScales:i,resolvePieceStyle:s}=e,{r:a,projection:l}=o,c=[],u="vertical"===l,d="radial"===l,h=i.length>0,p=Ja(e),f=2*Math.PI,g=-Math.PI/2;for(const e of Object.values(r))for(const t of e.pieceData){const o=t.__rIndex??0,r=t.__rValue??n(t),l=h&&i[o]||a,m=s(t,e.name),y=m.r||5;let b,v;if(d){const t=g+(e.pctStart+e.pct/2)*f,o=l(r);b=Math.cos(t)*o,v=Math.sin(t)*o}else u?(b=e.middle,v=l(r)):(b=l(r),v=e.middle);el(c,p,t,b,v,y,m)}return c},swarm:function(e,t){const{scales:o,columns:r,getR:n,resolvePieceStyle:i}=e,{r:s,projection:a}=o,l=[],c="vertical"===a,u=Ja(e);for(const e of Object.values(r)){const t=e.width/2;for(let o=0;e.pieceData.length>o;o++){const r=e.pieceData[o],a=n(r),d=i(r,e.name),h=d.r||4,p=(7919*o%100/100-.5)*t*.8;el(l,u,r,c?e.middle+p:s(a),c?s(a):e.middle+p,h,d)}}return l},pie:tl,donut:tl,boxplot:function(e,t){const{scales:o,columns:r,config:n,getR:i,resolveSummaryStyle:s}=e,{r:a,projection:l}=o,c=[],u="vertical"===l,d=!1!==n.showOutliers;for(const t of Object.values(r)){const o=t.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===o.length)continue;const r=o[0],n=o[o.length-1],l=(0,ol.quantile)(o,.25)??r,h=(0,ol.quantile)(o,.5)??(r+n)/2,p=(0,ol.quantile)(o,.75)??n,f=p-l,g=l-1.5*f,m=p+1.5*f,y=o.find(e=>e>=g)??r,b=[...o].reverse().find(e=>m>=e)??n,v=s(t.pieceData[0],t.name),x=[];if(d)for(const e of t.pieceData){const o=i(e);if(g>o||o>m){const r=u?t.middle:a(o),n=u?a(o):t.middle;x.push({px:r,py:n,value:o,datum:e})}}if(c.push({type:"boxplot",x:u?t.middle:0,y:u?0:t.middle,projection:u?"vertical":"horizontal",columnWidth:.6*t.width,minPos:a(y),q1Pos:a(l),medianPos:a(h),q3Pos:a(p),maxPos:a(b),stats:{n:o.length,min:y,q1:l,median:h,q3:p,max:b,mean:o.reduce((e,t)=>e+t,0)/o.length},style:v,datum:t.pieceData,category:t.name,outliers:x}),d)for(const t of x)c.push({type:"point",x:t.px,y:t.py,r:3,style:{fill:v.fill||e.config.themeSemantic?.secondary||"#999",opacity:.6},datum:t.datum})}return c},violin:function(e,t){const{scales:o,columns:r,config:n,getR:i,resolveSummaryStyle:s}=e,{r:a,projection:l}=o,c=[],u="vertical"===l,h=n.bins||20,p=!1!==n.showIQR;for(const e of Object.values(r)){const t=e.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const o=t[0],r=t[t.length-1],n=(r-o)/h||1,l=Array(h).fill(0);for(const e of t)l[Math.min(Math.floor((e-o)/n),h-1)]++;const f=d(l,1),g=e.width/2*.9;let m;if(u){m=`M ${e.middle} ${a(o)}`;for(let t=0;h>t;t++){const r=a(o+(t+.5)*n);m+=` L ${e.middle+l[t]/f*g} ${r}`}m+=` L ${e.middle} ${a(r)}`;for(let t=h-1;t>=0;t--){const r=a(o+(t+.5)*n);m+=` L ${e.middle-l[t]/f*g} ${r}`}m+=" Z"}else{m=`M ${a(o)} ${e.middle}`;for(let t=0;h>t;t++)m+=` L ${a(o+(t+.5)*n)} ${e.middle-l[t]/f*g}`;m+=` L ${a(r)} ${e.middle}`;for(let t=h-1;t>=0;t--)m+=` L ${a(o+(t+.5)*n)} ${e.middle+l[t]/f*g}`;m+=" Z"}const y=s(e.pieceData[0],e.name);let b;if(p&&t.length>=4){const n=(0,ol.quantile)(t,.25)??o,i=(0,ol.quantile)(t,.5)??(o+r)/2,s=(0,ol.quantile)(t,.75)??r;b={q1Pos:a(n),medianPos:a(i),q3Pos:a(s),centerPos:e.middle,isVertical:u}}const v=u?{x:e.x,y:Math.min(a(r),a(o)),width:e.width,height:Math.abs(a(r)-a(o))}:{x:Math.min(a(o),a(r)),y:e.x,width:Math.abs(a(r)-a(o)),height:e.width};c.push({type:"violin",pathString:m,translateX:0,translateY:0,bounds:v,iqrLine:b,stats:rl(t),style:y,datum:e.pieceData,category:e.name})}return c},histogram:function(e,t){const{scales:o,columns:r,config:n,getR:i,resolveSummaryStyle:s}=e,{r:a}=o,l=[],c=n.bins||25,h=n.normalize,p=a.domain?.(),f=p?+p[0]:void 0,g=p?+p[1]:void 0;for(const e of Object.values(r)){const t=e.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const[o,r]=u(t),n=null!=f&&isFinite(f)?f:o,p=null!=g&&isFinite(g)?g:r,m=(p-n)/c||1,y=Array(c).fill(0);for(const e of t)n>e||e>p||y[Math.min(Math.floor((e-n)/m),c-1)]++;const b=t.length,v=d(y,1),x=s(e.pieceData[0],e.name);for(let t=0;c>t;t++){if(0===y[t])continue;const o=(h?y[t]/b:y[t]/v)*e.width*.9,r=a(n+t*m),i=a(n+(t+1)*m);l.push(gt(Math.min(r,i),e.x+e.width-o,Math.abs(i-r),o,x,{bin:t,count:y[t],range:[n+t*m,n+(t+1)*m],category:e.name},e.name))}}return l},ridgeline:function(e,t){const{scales:o,columns:r,config:n,getR:i,resolveSummaryStyle:s}=e,{r:a,projection:l}=o,c=[],u=n.bins||20,h="horizontal"===l,p=n.amplitude||1.5;for(const e of Object.values(r)){const t=e.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const o=t[0],r=t[t.length-1],n=(r-o)/u||1,l=Array(u).fill(0);for(const e of t)o>e||e>r||l[Math.min(Math.floor((e-o)/n),u-1)]++;const f=d(l,1),g=s(e.pieceData[0],e.name),m=e.width*p;let y;if(h){const t=e.x+e.width;y=`M ${a(o)} ${t}`;for(let e=0;u>e;e++)y+=` L ${a(o+(e+.5)*n)} ${t-l[e]/f*m}`;y+=` L ${a(r)} ${t} Z`}else{const t=e.x;y=`M ${t} ${a(o)}`;for(let e=0;u>e;e++){const r=a(o+(e+.5)*n);y+=` L ${t+l[e]/f*m} ${r}`}y+=` L ${t} ${a(r)} Z`}const b=h?{x:Math.min(a(o),a(r)),y:e.x,width:Math.abs(a(r)-a(o)),height:e.width}:{x:e.x,y:Math.min(a(r),a(o)),width:e.width,height:Math.abs(a(r)-a(o))};c.push({type:"violin",pathString:y,translateX:0,translateY:0,bounds:b,stats:rl(t),style:{...g,fillOpacity:g.fillOpacity??.5},datum:e.pieceData,category:e.name})}return c},timeline:function(e,t){const{scales:o,columns:r,getRawRange:n,resolvePieceStyle:i}=e,{r:s,projection:a}=o,l=[],c="horizontal"===a;for(const e of Object.values(r))for(const t of e.pieceData){const o=n(t);if(!o)continue;const[r,a]=o,u=i(t,e.name);if(c){const o=s(Math.min(r,a)),n=s(Math.max(r,a));l.push(gt(o,e.x,n-o,e.width,u,t,e.name))}else{const o=s(Math.max(r,a)),n=s(Math.min(r,a));l.push(gt(e.x,o,e.width,n-o,u,t,e.name))}}return l},funnel:function(e,t){const{columns:o,getR:r,getStack:n,resolvePieceStyle:i}=e,s=[],a=t.width/2,l=!1!==e.config.showLabels,c=e.scales.o.domain().map(e=>o[e]).filter(Boolean);if(0===c.length)return s;const u=[],d=new Set;for(const e of c)for(const t of e.pieceData){const e=n?n(t):"_default";d.has(e)||(d.add(e),u.push(e))}const h=u.length>1&&"_default"!==u[0],p=[];let f=0;for(const e of c){const t=new Map;let o=0;for(const i of e.pieceData){const e=n?n(i):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const s=t.get(e),a=r(i);s.total+=a,s.pieces.push(i),o+=a}p.push({col:e,groups:t,stepTotal:o}),h||o>f&&(f=o)}if(h)for(const e of p){let t=0,o=0;for(let r=0;u.length>r;r++){const n=e.groups.get(u[r]);n&&(r%2==0?t+=n.total:o+=n.total)}const r=Math.max(t,o);r>f&&(f=r)}if(0===f)return s;const g=new Map;for(const e of u){const t=p[0].groups.get(e);g.set(e,t?.total??0)}const m=p[0].stepTotal,y=h?.95*a:.9*t.width,b=(0,nl.scaleLinear)().domain([0,f]).range([0,y]),v=e.config.connectorOpacity??.3;let x=new Map;for(let t=0;p.length>t;t++){const o=p[t],r=o.col,n=0===t,c=r.width,d=.55*c,f=r.x+(c-d)/2,y=new Map;if(h){let e=0;for(const t of u){const r=o.groups.get(t);r&&(e+=b(r.total))}let t=a,c=a;for(let h=0;u.length>h;h++){const p=u[h],m=o.groups.get(p);if(!m)continue;const v=b(m.total),x=h%2==0,k=x?t:c-v;x?t+=v:c-=v;const w=i(m.pieces[0],p),S=g.get(p)??m.total,A={...m.pieces[0],__funnelValue:m.total,__funnelPercent:S>0?m.total/S*100:0,__funnelStep:r.name,__funnelIsFirstStep:n,__aggregateValue:m.total,__pieceCount:m.pieces.length,category:p};l&&(0===h&&(A.__funnelStepLabel=r.name,A.__funnelStepLabelX=a,A.__funnelStepLabelY=f,A.__funnelRowWidth=e),A.__funnelValueLabelX=k+v/2,A.__funnelValueLabelY=f,A.__funnelBarW=v),s.push(gt(k,f,v,d,w,A,p)),y.set(p,{x:k,y:f,w:v,h:d})}}else{const e=o.stepTotal,t=b(e),c=a-t/2,h=u[0],p="_default"!==h,g=o.groups.get(h)?.pieces[0]??r.pieceData[0],v=p?h:r.name,x=i(g,v),k=m>0?e/m*100:0,w={...g,__funnelValue:e,__funnelPercent:k,__funnelStep:r.name,__funnelIsFirstStep:n,category:p?h:r.name};l&&(w.__funnelStepLabel=r.name,w.__funnelStepLabelX=a,w.__funnelStepLabelY=f,w.__funnelRowWidth=t,w.__funnelValueLabelX=a,w.__funnelValueLabelY=f,w.__funnelBarW=t),s.push(gt(c,f,t,d,x,w,v)),y.set(h,{x:c,y:f,w:t,h:d})}if(t>0&&x.size>0){const t=h?u:[u[0]];for(const n of t){const t=x.get(n),a=y.get(n);if(!t||!a)continue;const l=(()=>{const e=o.groups.get(n);return i(e?e.pieces[0]:r.pieceData[0],"_default"===n?r.name:n)})(),c={type:"trapezoid",points:[[t.x,t.y+t.h],[t.x+t.w,t.y+t.h],[a.x+a.w,a.y],[a.x,a.y]],style:{fill:l.fill||e.config.themeSemantic?.secondary||"#999",opacity:v},datum:o.groups.get(n)?.pieces[0]??r.pieceData[0],category:"_default"===n?r.name:n};s.push(c)}}x=y}return s},"bar-funnel":function(e,t){const{columns:o,getR:r,getStack:n,resolvePieceStyle:i,scales:s}=e,a=[],l=s.o.domain().map(e=>o[e]).filter(Boolean);if(0===l.length)return a;const c=[],u=new Set;for(const e of l)for(const t of e.pieceData){const e=n?n(t):"_default";u.has(e)||(u.add(e),c.push(e))}const d=c.length>1&&"_default"!==c[0],h=[];for(const e of l){const t=new Map;let o=0;for(const i of e.pieceData){const e=n?n(i):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const s=t.get(e),a=r(i);s.total+=a,s.pieces.push(i),o+=a}h.push({col:e,groups:t,stepTotal:o})}const p=new Map;for(const e of c){const t=h[0]?.groups.get(e);p.set(e,t?.total??0)}const f=s.r,g=d?c.length:1,m=d?.15:0;for(let e=0;h.length>e;e++){const t=h[e],o=t.col,r=0===e,n=e>0?h[e-1]:null,s=o.width/g,l=s*m,u=s-l;for(let e=0;c.length>e;e++){const h=c[e],g=t.groups.get(h);if(!g)continue;const m=g.total,y=p.get(h)??m,b=y>0?m/y*100:0,v=n?.groups.get(h),x=r?0:Math.max(0,(v?.total??m)-m),k=o.x+e*s+l/2,w=f(m),S=f(0)-w,A=i(g.pieces[0],d?h:o.name),C={...g.pieces[0],__barFunnelValue:m,__barFunnelPercent:b,__barFunnelIsFirstStep:r,__barFunnelIsDropoff:!1,__barFunnelStep:o.name,__barFunnelDropoffValue:x,__barFunnelCategory:"_default"===h?void 0:h,category:d?h:o.name,__barFunnelLabelX:k+u/2,__barFunnelLabelY:f(m+x)};if(a.push(gt(k,w,u,S,A,C,d?h:o.name)),x>0){const e=f(m+x),t=w-e,r={...A},n={...g.pieces[0],__barFunnelValue:x,__barFunnelPercent:y>0?x/y*100:0,__barFunnelIsFirstStep:!1,__barFunnelIsDropoff:!0,__barFunnelStep:o.name,__barFunnelCategory:"_default"===h?void 0:h,category:d?h:o.name};a.push(gt(k,e,u,t,r,n,d?h:o.name))}}}return a},swimlane:function(e,t){const{scales:o,columns:r,getR:n,getStack:i,resolvePieceStyle:s}=e,{r:a,projection:l}=o,c=[],u="horizontal"===l,d=e.config.gradientFill,h=u?"left":"bottom",p=e.config.trackFill;if(p){const e="string"==typeof p?p:p.color,t="string"==typeof p?1:p.opacity??1,[o,n]=a.range(),i=Math.min(o,n),s=Math.abs(n-o);for(const o of Object.values(r)){const r={fill:e,opacity:t},n=u?gt(i,o.x,s,o.width,r,null,"__track__"):gt(o.x,i,o.width,s,r,null,"__track__");c.push(n)}}const f=e.config.roundedTop&&e.config.roundedTop>0?Math.max(0,e.config.roundedTop):0;for(const e of Object.values(r)){let t=0;const o=c.length;for(const o of e.pieceData){const r=Math.abs(n(o));if(0===r)continue;const l=i?i(o):e.name,p=s(o,l);let f;if(u){const n=a(t),i=a(t+r);f=gt(n,e.x,i-n,e.width,p,o,l)}else{const n=a(t+r),i=a(t);f=gt(e.x,n,e.width,i-n,p,o,l)}d&&(f.fillGradient=d,f.roundedEdge=h),c.push(f),t+=r}if(f>0&&c.length>o){const e=c.slice(o),t=e[0],r=e[e.length-1];1===e.length?t.cornerRadii={tl:f,tr:f,br:f,bl:f}:u?(t.cornerRadii={tl:f,bl:f},r.cornerRadii={tr:f,br:f}):(t.cornerRadii={bl:f,br:f},r.cornerRadii={tl:f,tr:f})}}return c}};function sl(e,t,o){if(e&&"object"==typeof e&&!Array.isArray(e)){const t=Object.values(e).filter(e=>"string"==typeof e&&e.length>0);if(t.length>0)return t}if(Array.isArray(e)&&e.length>0)return e;if("string"==typeof e){const t=Be[e];if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:o}function al(e,t){const o=t&&"object"==typeof t&&!Array.isArray(t)?t:void 0;return 0===e.length?e=>o&&We(o,e)||"#4e79a7":t=>{if(o){const e=We(o,t);if(e)return e}let r=0;for(let e=0;t.length>e;e++)r=31*r+t.charCodeAt(e)|0;return e[Math.abs(r)%e.length]??"#4e79a7"}}var ll=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],cl=["scene-style","data-paint","accessibility","evidence"],ul=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],dl=new Set(["accessorRevision","axisExtent","categoryAccessor","chartType","extentPadding","groupBy","multiAxis","normalize","oAccessor","oExtent","oSort","rAccessor","rExtent","runtimeMode","stackBy","timeAccessor","valueAccessor"]),hl=new Set(["barColors","colorScheme","connectorStyle","pieceStyle","summaryStyle","themeCategorical","themeDiverging","themeSemantic","themeSequential"]),pl=class{constructor(){this.tracker=new Ut}get last(){return this.tracker.last}recordData(e,t){return this.tracker.record({kind:e,...void 0===t?{}:{count:t}},ll)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},cl):this.recordNoop("restyle")}recordConfig(e){if(0===e.length)return this.tracker.record({kind:"config",keys:e},[]);const t=new Set(ul);return e.some(e=>dl.has(e))&&t.add("domain"),e.some(e=>hl.has(e))&&t.add("scene-style"),this.tracker.record({kind:"config",keys:e},t)}},fl=require("d3-quadtree"),gl=class{constructor(e){this.rExtent=new oe,this.rExtents=[],this.windowSizeWarned=!1,this.updateResults=new pl,this.rAccessors=[],this.categories=new Set,this._hasStreamingData=!1,this._colorSchemeMap=null,this._colorSchemeIndex=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositionMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this.scales=null,this.multiScales=[],this.scene=[],this.columns={},this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customLayoutFailedThisBuild=!1,this._customLayoutDiagnosticsWarned=new Set,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.version=0,this._dataVersion=0,this._bufferArrayCache=null,this._pointQuadtree=null,this._maxPointRadius=0,this._datumIndexCache=null,this._categoryIndexCache=null,this._hasRenderedOnce=!1,this.config=e,this.buffer=new te(e.windowSize),this.getO=se(e.categoryAccessor||e.oAccessor,"category");const t=e.valueAccessor||e.rAccessor;Array.isArray(t)?(this.rAccessors=t.map(e=>ne(e,"value")),this.getR=this.rAccessors[0],this.rExtents=t.map(()=>new oe)):(this.getR=ne(t,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=se(e.stackBy),this.getGroup=se(e.groupBy),this.getColor=se(e.colorAccessor),this.getSymbol=se(e.symbolAccessor),this.getConnector=se(e.connectorAccessor),this.getDataId=se(e.dataIdAccessor),e.pulse&&(this.timestampBuffer=new te(e.windowSize))}syncPulseTimestampBuffer(){var e,t,o,r;this.timestampBuffer=(e=!!this.config.pulse,t=this.buffer,o=this.timestampBuffer,r=Ue(),e?null!=o&&o.capacity===t.capacity&&o.size===t.size?o:Wt(t,r):null)}ingest(e){const t=Ue();if(this.lastIngestTime=t,this._dataVersion++,e.bounded){this.buffer.clear(),this.rExtent.clear();for(const e of this.rExtents)e.clear();e.preserveCategoryOrder?this._hasStreamingData=!0:this.categories.clear(),this.timestampBuffer&&this.timestampBuffer.clear(),Ot(this.buffer,e.totalSize||e.inserts.length,this.timestampBuffer);for(const o of e.inserts)qt(this.buffer,o,this.timestampBuffer,t),this.categories.add(this.getO(o)),this.pushValueExtent(o)}else{this._hasStreamingData=!0;for(const o of e.inserts){const e=qt(this.buffer,o,this.timestampBuffer,t);this.categories.add(this.getO(o)),this.pushValueExtent(o),null!=e&&this.evictValueExtent(e)}}return this.updateResults.recordData(e.bounded?"replace":"ingest",e.inserts.length),!0}ingestWithResult(e){return this.ingest(e),this.updateResults.last}pushValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.push(t[0]),this.rExtent.push(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].push(this.rAccessors[t](e));this.rExtent.push(this.getR(e))}else this.rExtent.push(this.getR(e))}evictValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.evict(t[0]),this.rExtent.evict(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].evict(this.rAccessors[t](e));this.rExtent.evict(this.getR(e))}else this.rExtent.evict(this.getR(e))}getRawRange(e){const t=this.config.valueAccessor||this.config.rAccessor;if(!t)return null;const o="function"==typeof t?t(e):e[t];return Array.isArray(o)&&o.length>=2?[+o[0],+o[1]]:null}computeScene(e){const{config:t,buffer:o}=this,r=this.scales,n=this.multiScales,i=this.columns;if(0===o.size)return this.scales=null,this.multiScales=[],this.scene=[],this.columns={},this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(o,this.getR);const s=this.getBufferArray(),a=t.projection||"vertical",l=t.oExtent||this.resolveCategories(s),c=this.computeValueDomain(s,l),u="horizontal"===a,d="radial"===a,h=Math.min(.9,Math.max(0,null!=t.barPadding?t.barPadding/("vertical"===a?e.width:e.height):.1));let p,f;if(d){p=(0,Za.scaleBand)().domain(l).range([0,1]).padding(0);const o=Math.min(e.width,e.height)/2,r=t.innerRadius||0;f=(0,Za.scaleLinear)().domain(c).range([r,o])}else u?(p=(0,Za.scaleBand)().domain(l).range([0,e.height]).padding(h),f=(0,Za.scaleLinear)().domain(c).range([0,e.width])):(p=(0,Za.scaleBand)().domain(l).range([0,e.width]).padding(h),f=(0,Za.scaleLinear)().domain(c).range([e.height,0]));this.scales={o:p,r:f,projection:a},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((r,n)=>{const i=this.rExtents[n];i.dirty&&i.recalculate(o,r);let[s,a]=i.extent;s===1/0&&(s=0,a=1);const l=a-s,c=l>0?l*(t.extentPadding??.05):1;return s-=c,a+=c,s>0&&(s=0),u?(0,Za.scaleLinear)().domain([s,a]).range([0,e.width]):(0,Za.scaleLinear)().domain([s,a]).range([e.height,0])}):[];let g=s;this.rAccessors.length>1&&(g=s.flatMap(e=>this.rAccessors.map((t,o)=>({...e,__rIndex:o,__rValue:t(e),__rName:this.resolveRAccessorName(o)})))),this.columns=this.buildColumns(g,l,p,a,e),this._customLayoutFailedThisBuild=!1;const m=this.buildSceneNodes(g,e);this._customLayoutFailedThisBuild?!0===this.lastCustomLayoutFailure?.preservedLastGoodScene?(this.scales=r,this.multiScales=n,this.columns=i):(this.scene=[],this.rebuildPointQuadtree()):(this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=m,this.rebuildPointQuadtree(),this.config.decay&&this.applyDecay(this.scene,s),this.config.pulse&&this.applyPulse(this.scene,s),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&this.prevPositionMap.size>0&&this.startTransition(),this.version++)}resolveRAccessorName(e){const t=this.config.valueAccessor||this.config.rAccessor,o=Array.isArray(t)?t[e]:t;return"string"==typeof o?o:"value"+e}resolveCategories(e){const t=this.config.oSort,o="streaming"===this.config.runtimeMode||this._hasStreamingData,r="auto"===t?void 0:t;let n=null;if(o){n=new Set;for(const t of e)n.add(this.getO(t))}const i=n?Array.from(this.categories).filter(e=>n.has(e)):Array.from(this.categories);if(o&&void 0===r){const e=Math.max(50,3*n.size);if(this.categories.size>e){let t=this.categories.size-e;for(const e of this.categories){if(0>=t)break;n.has(e)||(this.categories.delete(e),t--)}}return i}if(!1===r)return i;if("function"==typeof r)return i.sort(r);const s=new Map;for(const t of e){const e=this.getO(t);s.set(e,(s.get(e)||0)+Math.abs(this.getR(t)))}return i.sort("asc"===r?(e,t)=>(s.get(e)||0)-(s.get(t)||0):(e,t)=>(s.get(t)||0)-(s.get(e)||0))}computeValueDomain(e,t){return function(e){const{data:t,chartType:o,projection:r,normalize:n,rExtent:i,extentPadding:s=.05,baselinePadding:a,axisExtent:l,getO:c,getR:u,getStack:d,rawRExtent:h}=e,p=s;if("radial"===r&&("pie"===o||"donut"===o))return[0,1];let f=0,g=0;if("bar"===o&&d&&n)f=0,g=1;else if("bar"===o&&d){const e=new Map,o=new Map;for(const r of t){const t=c(r),n=u(r);0>n?o.set(t,(o.get(t)||0)+n):e.set(t,(e.get(t)||0)+n)}for(const t of e.values())t>g&&(g=t);for(const e of o.values())f>e&&(f=e)}else if("bar"===o){const e=new Map;for(const o of t){const t=c(o),r=u(o);e.set(t,(e.get(t)||0)+r)}for(const t of e.values())t>g&&(g=t),f>t&&(f=t)}else if("swimlane"===o){const e=new Map;for(const o of t){const t=c(o),r=Math.abs(u(o));e.set(t,(e.get(t)||0)+r)}for(const t of e.values())t>g&&(g=t)}else if("clusterbar"===o||"bar-funnel"===o)for(const e of t){const t=u(e);t>g&&(g=t),f>t&&(f=t)}else{const e=h[0],t=h[1];e!==1/0&&(f=e),t!==-1/0&&(g=t)}i&&(null!=i[0]&&(f=i[0]),null!=i[1]&&(g=i[1]));const m="bar"===o||"clusterbar"===o||"bar-funnel"===o||"swimlane"===o;if(m&&null==i?.[0]&&null==i?.[1]&&(f>0&&(f=0),0>g&&(g=0)),"bar-funnel"!==o&&"exact"!==l){const e=g-f,t=e>0?e*p:1,r=m&&!a&&0===f,n=m&&!a&&0===g||"swimlane"===o;null!=i?.[0]||r||(f-=t),null!=i?.[1]||n||(g+=t)}return[f,g]}({data:e,chartType:this.config.chartType,projection:this.config.projection,normalize:this.config.normalize,rExtent:this.config.rExtent,extentPadding:this.config.extentPadding,baselinePadding:this.config.baselinePadding,axisExtent:this.config.axisExtent,getO:this.getO,getR:this.getR,getStack:this.getStack,rawRExtent:this.rExtent.extent})}buildColumns(e,t,o,r,n){return function(e){const{data:t,oExtent:o,oScale:r,projection:n,layout:i,dynamicColumnWidth:s,getO:a,getR:l}=e,c={},u=new Map;for(const e of t){const t=a(e);u.has(t)||u.set(t,[]),u.get(t).push(e)}let d=0;if("radial"===n)for(const e of t)d+=Math.abs(l(e));let h=null;if(s&&"radial"!==n){h=new Map;let e=0;for(const t of o){const o=u.get(t)||[];let r;r="string"==typeof s?o.reduce((e,t)=>e+(Number(t[s])||0),0):s(o),h.set(t,r),e+=r}const t=("horizontal"===n?i.height:i.width)-r.padding()*r.step()*o.length;if(e>0)for(const[o,r]of h)h.set(o,r/e*t)}let p=0,f=0;for(const e of o){const t=u.get(e)||[],o=t.reduce((e,t)=>e+Math.abs(l(t)),0),n=d>0?o/d:0;let i,s;h?(i=f,s=h.get(e)||r.bandwidth(),f+=s+r.padding()*r.step()):(i=r(e)??0,s=r.bandwidth()),c[e]={name:e,x:i,y:0,width:s,middle:i+s/2,padding:r.padding()*r.step(),pieceData:t,pct:n,pctStart:p},p+=n}return c}({data:e,oExtent:t,oScale:o,projection:r,layout:n,dynamicColumnWidth:this.config.dynamicColumnWidth,getO:this.getO,getR:this.getR})}getSceneContext(){return{scales:this.scales,columns:this.columns,config:this.config,getR:this.getR,getStack:this.getStack,getGroup:this.getGroup,getColor:this.getColor,getSymbol:this.getSymbol,getConnector:this.getConnector,getO:this.getO,multiScales:this.multiScales,rAccessors:this.rAccessors,resolvePieceStyle:(e,t)=>this.resolvePieceStyle(e,t),resolveSummaryStyle:(e,t)=>this.resolveSummaryStyle(e,t),getRawRange:e=>this.getRawRange(e)}}buildSceneNodes(e,t){if(!this.scales)return[];if(this.config.customLayout){const o=this.buildLayoutContext(e,t);let r;try{r=this.config.customLayout(o)}catch(e){const t=null!==this.lastCustomLayoutResult,o=Ft("ordinal",e,t,this.version);this.lastCustomLayoutFailure=o,this._customLayoutFailedThisBuild=!0,"production"!==process.env.NODE_ENV&&console.error("[semiotic] ordinal customLayout threw:",e);try{this.config.onLayoutError?.(o)}catch(e){"production"!==process.env.NODE_ENV&&console.error("[semiotic] onLayoutError threw:",e)}return t?this.scene:(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,[])}this.customLayoutOverlays=r.overlays??null,this.lastCustomLayoutResult=r,this.lastCustomLayoutFailure=null;const n=r.nodes??[];if(this._customRestyle=r.restyle,this.hasCustomRestyle=!!r.restyle,this.hasCustomRestyle){this._baseStyles=new WeakMap;for(const e of n)e.style&&this._baseStyles.set(e,e.style);this.applyCustomRestyle(n,this.config.layoutSelection??null)}return It({label:"ordinal customLayout",nodes:n,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned}),n}this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1;const o=this.getSceneContext(),r=il[this.config.chartType];let n=r?r(o,t):[];if(this.getConnector&&this.scales){const e=function(e,t){const{scales:o,config:r,getConnector:n,getO:i}=e;if(!n||!o)return[];const s=[],{projection:a}=o,l=new Map;for(const e of t){if("point"!==e.type&&"rect"!==e.type)continue;const t=e.datum;if(!t)continue;const o=n(t);if(!o)continue;let r,s;"point"===e.type?(r=e.x,s=e.y):(r=e.x+e.w/2,s=e.y+("vertical"===a?0:e.h/2)),l.has(o)||l.set(o,[]),l.get(o).push({x:r,y:s,datum:t,category:i(t)})}const c=o.o.domain(),u=r.connectorStyle;for(const[t,o]of l)if(o.length>=2){o.sort((e,t)=>c.indexOf(e.category)-c.indexOf(t.category));for(let r=0;o.length-1>r;r++){const n=o[r],i=o[r+1],a="function"==typeof u?u(n.datum):u||{stroke:e.config.themeSemantic?.border||e.config.themeSemantic?.secondary||"#999",strokeWidth:1,opacity:.5};s.push({type:"connector",x1:n.x,y1:n.y,x2:i.x,y2:i.y,style:a,datum:n.datum,group:t})}}return s}(o,n);n=[...e,...n]}return n}buildLayoutContext(e,t){const o=this.config,r=o.layoutMargin??{top:0,right:0,bottom:0,left:0},n=sl(o.colorScheme,o.themeCategorical,Ee),i=this.scales;return{data:e,scales:{o:i.o,r:i.r,projection:i.projection},dimensions:{width:t.width,height:t.height,margin:r,plot:"radial"===i.projection?{x:-t.width/2,y:-t.height/2,width:t.width,height:t.height}:{x:0,y:0,width:t.width,height:t.height}},theme:{semantic:o.themeSemantic??{},categorical:[...n]},resolveColor:al(n,o.colorScheme),config:o.layoutConfig??{},selection:o.layoutSelection??null}}resolvePieceStyle(e,t){if("function"==typeof this.config.pieceStyle){const o=this.config.pieceStyle(e,t);return o&&!o.fill&&t?{...o,fill:this.getColorFromScheme(t)}:o}return this.config.pieceStyle&&"object"==typeof this.config.pieceStyle?this.config.pieceStyle:this.config.barColors&&t?{fill:this.config.barColors[t]||"#007bff"}:t?{fill:this.getColorFromScheme(t)}:{fill:"#007bff"}}getColorFromScheme(e){this._colorSchemeMap||(this._colorSchemeMap=new Map);const t=this._colorSchemeMap.get(e);if(t)return t;const o=Array.isArray(this.config.colorScheme)?this.config.colorScheme:this.config.themeCategorical||Ee,r=o[this._colorSchemeIndex%o.length];return this._colorSchemeIndex++,this._colorSchemeMap.set(e,r),r}resolveSummaryStyle(e,t){return"function"==typeof this.config.summaryStyle?this.config.summaryStyle(e,t):this.config.summaryStyle&&"object"==typeof this.config.summaryStyle?this.config.summaryStyle:{fill:"#007bff",fillOpacity:.6,stroke:"#007bff",strokeWidth:1}}computeDecayOpacity(e,t){const o=this.config.decay;return o&&t>1?nt(o,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._dataVersion)return this._datumIndexCache.map;const t=it(e);return this._datumIndexCache={version:this._dataVersion,map:t},t}getCategoryIndexMap(e){if(this._categoryIndexCache&&this._categoryIndexCache.version===this._dataVersion)return this._categoryIndexCache.map;const t=function(e,t){const o="function"==typeof t,r=o?null:t||"category",n=new Map;for(let i=0;e.length>i;i++){const s=e[i],a=o?t(s):s[r],l=n.get(a);l?l.push(i):n.set(a,[i])}return n}(e,this.config.categoryAccessor||this.config.oAccessor);return this._categoryIndexCache={version:this._dataVersion,map:t},t}rebuildPointQuadtree(){const e=function(e){let t=0,o=0;for(const r of e)"point"===r.type&&(t++,r.r>o&&(o=r.r));if(500>=t)return{quadtree:null,maxRadius:o};const r=Array(t);let n=0;for(const t of e)"point"===t.type&&(r[n++]=t);return{maxRadius:o,quadtree:(0,fl.quadtree)().x(e=>e.x).y(e=>e.y).addAll(r)}}(this.scene);this._pointQuadtree=e.quadtree,this._maxPointRadius=e.maxRadius}get pointQuadtree(){return this._pointQuadtree}get maxPointRadius(){return this._maxPointRadius}applyDecay(e,t){if(!this.config.decay)return;const o=t.length;if(1>=o)return;const r=this.getDatumIndexMap(t);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;const e=r.get(t.datum);if(null==e)continue;const n=this.computeDecayOpacity(e,o);t.style={...t.style,opacity:(t.style?.opacity??1)*n}}}applyPulse(e,t,o=Ue()){return!(!this.config.pulse||!this.timestampBuffer)&&function(e,t,o,r,n,i){const s=e.color??"rgba(255,255,255,0.6)",a=e.glowRadius??4;let l=!1;for(const c of t){if("connector"===c.type||"violin"===c.type||"boxplot"===c.type)continue;if("wedge"===c.type){const t=c.category;if(!t)continue;let r=0;for(const s of n(t)??[]){const t=o.get(s);null!=t&&(r=Math.max(r,st(e,t,i)))}l=at(c,r,s)||l;continue}if(null==c.datum)continue;const t=r.get(c.datum);if(null==t)continue;const u=o.get(t);l=at(c,null==u?0:st(e,u,i),s,a)||l}return l}(this.config.pulse,e,this.timestampBuffer,this.getDatumIndexMap(t),e=>this.getCategoryIndexMap(t).get(e),o)}refreshPulse(e){return!0!==this.lastCustomLayoutFailure?.preservedLastGoodScene&&this.applyPulse(this.scene,this.getBufferArray(),e)}hasActivePulsesAt(e){return!!this.config.pulse&<(this.config.pulse,this.timestampBuffer,e)}get hasActivePulses(){return this.hasActivePulsesAt(Ue())}synthesizeIntroPositions(){this.prevPositionMap.clear();const e=new Map,t=this.scales?.r(0)??0,o="horizontal"!==this.scales?.projection;let r;for(let n=0;this.scene.length>n;n++){const i=this.scene[n],s=this.getNodeKey(i,e);s&&("rect"===i.type?this.prevPositionMap.set(s,o?{x:i.x,y:t,w:i.w,h:0,opacity:i.style.opacity??1}:{x:t,y:i.y,w:0,h:i.h,opacity:i.style.opacity??1}):"point"===i.type?this.prevPositionMap.set(s,{x:i.x,y:i.y,r:0,opacity:0}):"wedge"===i.type&&(void 0===r&&(r=i.startAngle),this.prevPositionMap.set(s,{x:i.cx,y:i.cy,startAngle:r,endAngle:r,innerRadius:i.innerRadius,outerRadius:i.outerRadius,opacity:0})))}}getNodeKey(e,t){if("point"===e.type){const o=`p:${e.datum?this.getO(e.datum):""}:${e.datum?this.getR(e.datum):0}`,r=t.get(o)||0;return t.set(o,r+1),`${o}:${r}`}return"rect"===e.type?`r:${e.group||""}:${e.datum?.category??""}`:"wedge"===e.type?"w:"+(e.category??""):null}snapshotPositions(){this.prevPositionMap.clear();const e=new Map;for(let t=0;this.scene.length>t;t++){const o=this.scene[t],r=this.getNodeKey(o,e);r&&("point"===o.type?this.prevPositionMap.set(r,{x:o.x,y:o.y,r:o.r,opacity:o.style.opacity}):"rect"===o.type?this.prevPositionMap.set(r,{x:o.x,y:o.y,w:o.w,h:o.h,opacity:o.style.opacity}):"wedge"===o.type&&this.prevPositionMap.set(r,{x:o.cx,y:o.cy,startAngle:o.startAngle,endAngle:o.endAngle,innerRadius:o.innerRadius,outerRadius:o.outerRadius,opacity:o.style.opacity??1}))}}startTransition(){if(!this.config.transition||0===this.prevPositionMap.size)return;const e=this.config.transition.duration??300;if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}let t=!1;const o=new Set,r=new Map;for(let e=0;this.scene.length>e;e++){const n=this.scene[e],i=this.getNodeKey(n,r);if(!i)continue;n._transitionKey=i;const s=this.prevPositionMap.get(i);if("point"===n.type)s?(o.add(i),n._targetOpacity=n.style.opacity??1,(s.x!==n.x||s.y!==n.y||void 0!==s.r&&s.r!==n.r)&&(n._targetX=n.x,n._targetY=n.y,n._targetR=n.r,n.x=s.x,n.y=s.y,void 0!==s.r&&(n.r=s.r),t=!0)):(n._targetOpacity=n.style.opacity??1,n._targetR=n.r,n.r=0,n.style={...n.style,opacity:0},t=!0);else if("rect"===n.type)s?(o.add(i),n._targetOpacity=n.style.opacity??1,s.x===n.x&&s.y===n.y&&s.w===n.w&&s.h===n.h||(n._targetX=n.x,n._targetY=n.y,n._targetW=n.w,n._targetH=n.h,n.x=s.x,n.y=s.y,n.w=s.w??n.w,n.h=s.h??n.h,t=!0)):(n._targetOpacity=n.style.opacity??1,n.style={...n.style,opacity:0},t=!0);else if("wedge"===n.type)if(s)o.add(i),n._targetOpacity=n.style.opacity??1,s.startAngle===n.startAngle&&s.endAngle===n.endAngle||(n._targetStartAngle=n.startAngle,n._targetEndAngle=n.endAngle,n.startAngle=s.startAngle,n.endAngle=s.endAngle,t=!0);else{n._targetOpacity=n.style.opacity??1,n._targetStartAngle=n.startAngle,n._targetEndAngle=n.endAngle;const e=n.startAngle;n.startAngle=e,n.endAngle=e,n.style={...n.style,opacity:0},this.prevPositionMap.set(i,{x:n.cx,y:n.cy,startAngle:e,endAngle:e,innerRadius:n.innerRadius,outerRadius:n.outerRadius,opacity:0}),t=!0}}this.exitNodes=[];for(const[e,r]of this.prevPositionMap)if(!o.has(e)){if(e.startsWith("p:"))this.exitNodes.push({type:"point",x:r.x,y:r.y,r:r.r??3,style:{opacity:r.opacity??1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("r:"))this.exitNodes.push({type:"rect",x:r.x,y:r.y,w:r.w??0,h:r.h??0,style:{opacity:r.opacity??1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("w:")){const t=((r.startAngle??0)+(r.endAngle??0))/2,o={type:"wedge",cx:r.x,cy:r.y,innerRadius:r.innerRadius??0,outerRadius:r.outerRadius??100,startAngle:r.startAngle??0,endAngle:r.endAngle??0,style:{opacity:r.opacity??1},datum:null,category:e.slice(2),_targetStartAngle:t,_targetEndAngle:t,_targetOpacity:0,_transitionKey:e};this.exitNodes.push(o)}t=!0}this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),t&&(this.activeTransition={startTime:Ue(),duration:e})}advanceTransition(e){if(!this.activeTransition)return!1;const t=Ve(e,this.activeTransition),o=Ge(t,"linear"===this.config.transition?.easing?"linear":"ease-out-cubic");for(const e of this.scene){const t=e._transitionKey;if(t)if("point"===e.type){if(void 0!==e._targetOpacity){const r=this.prevPositionMap.get(t);e.style.opacity=Xe(r?r.opacity??1:0,e._targetOpacity,o)}const r=this.prevPositionMap.get(t);void 0!==e._targetX&&r&&(e.x=Xe(r.x,e._targetX,o),e.y=Xe(r.y,e._targetY,o)),void 0!==e._targetR&&void 0!==r?.r&&(e.r=Xe(r.r,e._targetR,o))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const r=this.prevPositionMap.get(t);e.style.opacity=Xe(r?r.opacity??1:0,e._targetOpacity,o)}if(void 0===e._targetX)continue;const r=this.prevPositionMap.get(t);if(!r)continue;e.x=Xe(r.x,e._targetX,o),e.y=Xe(r.y,e._targetY,o),void 0!==r.w&&(e.w=Xe(r.w,e._targetW,o),e.h=Xe(r.h,e._targetH,o))}else if("wedge"===e.type){if(void 0!==e._targetOpacity){const r=this.prevPositionMap.get(t);e.style={...e.style,opacity:Xe(r?r.opacity??1:0,e._targetOpacity,o)}}if(void 0!==e._targetStartAngle&&void 0!==e._targetEndAngle){const r=this.prevPositionMap.get(t);r&&void 0!==r.startAngle&&(e.startAngle=Xe(r.startAngle,e._targetStartAngle,o),e.endAngle=Xe(r.endAngle,e._targetEndAngle,o))}}}if(t>=1){for(const e of this.scene)if(void 0!==e._targetOpacity&&(e.style={...e.style||{},opacity:0===e._targetOpacity?0:e._targetOpacity},e._targetOpacity=void 0),"point"===e.type){if(void 0===e._targetX&&void 0===e._targetR)continue;void 0!==e._targetX&&(e.x=e._targetX,e.y=e._targetY),void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else"wedge"===e.type&&void 0!==e._targetStartAngle&&(e.startAngle=e._targetStartAngle,e.endAngle=e._targetEndAngle,e._targetStartAngle=void 0,e._targetEndAngle=void 0);if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}return this.activeTransition=null,!1}return!0}cancelIntroAnimation(){this.prevPositionMap.clear(),this.activeTransition=null}getBufferArray(){return this._bufferArrayCache?.version!==this._dataVersion&&(this._bufferArrayCache={version:this._dataVersion,data:this.buffer.toArray()}),this._bufferArrayCache.data}getData(){return this.buffer.toArray()}getLastUpdateResult(){return this.updateResults.last}remove(e){if(!this.getDataId)throw Error("remove() requires dataIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=ue(e),o=this.getDataId,r=e=>t.has(o(e));Yt(this.buffer,this.timestampBuffer,r);const n=this.buffer.remove(r);if(0===n.length)return this.updateResults.recordNoop("remove"),n;for(const e of n)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach(e=>this.categories.add(this.getO(e))),this._dataVersion++,this.version++,this.lastIngestTime=Ue(),this.updateResults.recordData("remove",n.length),n}update(e,t){if(!this.getDataId)throw Error("update() requires dataIdAccessor to be configured");const o=ue(e),r=this.getDataId,n=new Set;this.buffer.forEach((e,t)=>{o.has(r(e))&&n.add(t)});const i=this.buffer.update(e=>o.has(r(e)),t);if(0===i.length)return this.updateResults.recordNoop("update"),i;for(const e of i)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach((e,t)=>{this.categories.add(this.getO(e)),n.has(t)&&this.pushValueExtent(e)}),this._dataVersion++,this.version++,this.lastIngestTime=Ue(),this.updateResults.recordData("update",i.length),i}clear(){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this._hasStreamingData=!1,this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this.scales=null,this.scene=[],this.columns={},this.multiScales=[],this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this._pointQuadtree=null,this._maxPointRadius=0,this._colorSchemeMap=null,this._colorSchemeIndex=0,this._dataVersion++,this.version++,this.updateResults.recordData("clear")}get size(){return this.buffer.size}getOAccessor(){return this.getO}getRAccessor(){return this.getR}setLayoutSelection(e){this.config.layoutSelection=e}applyCustomRestyle(e,t){const o=this._customRestyle;if(o)for(const r of e){const e=this._baseStyles.get(r)??r.style??{},n=o(r,t);r.style=n?{...e,...n}:e}}restyleScene(e){this._customRestyle?(this.applyCustomRestyle(this.scene,e),this.updateResults.recordRestyle(!0)):this.updateResults.recordRestyle(!1)}rebuildAccessorDerivedState(){this.categories.clear(),this.rExtent.clear();for(const e of this.rExtents)e.clear();this._categoryIndexCache=null,this.buffer.forEach(e=>{this.categories.add(this.getO(e)),this.pushValueExtent(e)})}updateConfig(e){const t={...this.config},o=Object.keys(e).filter(o=>e[o]!==t[o]);"production"!==process.env.NODE_ENV&&!this.windowSizeWarned&&"windowSize"in e&&e.windowSize!==t.windowSize&&(this.windowSizeWarned=!0,console.warn(`[Semiotic] windowSize changed after mount (${t.windowSize} → ${e.windowSize}) but it is a mount-only setting — the ring buffer keeps its original capacity. Remount the chart (e.g. via a React key) to apply a new windowSize.`)),("colorScheme"in e&&e.colorScheme!==t.colorScheme||"themeCategorical"in e&&e.themeCategorical!==t.themeCategorical||"colorAccessor"in e&&!re(e.colorAccessor,t.colorAccessor))&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),("categoryAccessor"in e&&!re(e.categoryAccessor,t.categoryAccessor)||"oAccessor"in e&&!re(e.oAccessor,t.oAccessor))&&(this._categoryIndexCache=null),Object.assign(this.config,e),"pulse"in e&&this.syncPulseTimestampBuffer();let r=!1;("categoryAccessor"in e||"oAccessor"in e)&&(re(this.config.categoryAccessor||this.config.oAccessor,t.categoryAccessor||t.oAccessor)||(this.getO=se(this.config.categoryAccessor||this.config.oAccessor,"category"),r=!0));let n=!1;if("valueAccessor"in e||"rAccessor"in e){const e=this.config.valueAccessor||this.config.rAccessor,o=t.valueAccessor||t.rAccessor,r=Array.isArray(e)?e:[e],i=Array.isArray(o)?o:[o];if(n=r.length!==i.length||r.some((e,t)=>!re(e,i[t])),n){const e=this.config.valueAccessor||this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>ne(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new oe)):(this.getR=ne(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!re(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?se(this.config.stackBy):void 0),"groupBy"in e&&!re(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?se(this.config.groupBy):void 0),"colorAccessor"in e&&!re(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?se(this.config.colorAccessor):void 0),"symbolAccessor"in e&&!re(e.symbolAccessor,t.symbolAccessor)&&(this.getSymbol=null!=this.config.symbolAccessor?se(this.config.symbolAccessor):void 0),"connectorAccessor"in e&&!re(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?se(this.config.connectorAccessor):void 0),(r||n||"accessorRevision"in e&&e.accessorRevision!==t.accessorRevision)&&this.rebuildAccessorDerivedState(),this.updateResults.recordConfig(o)}updateConfigWithResult(e){return this.updateConfig(e),this.updateResults.last}};function ml(e,t,o,r=30,n,i=0){let s=null;if(n){const e=No(n,t,o,r,i);e&&(s={datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const i of e){let e=null;switch(i.type){case"rect":if(null==i.datum)break;e=yl(i,t,o);break;case"point":if(n)break;e=bl(i,t,o,r);break;case"symbol":e=vl(i,t,o,r);break;case"glyph":e=xl(i,t,o,r);break;case"wedge":if(null===i.datum)break;e=kl(i,t,o);break;case"boxplot":e=wl(i,t,o);break;case"violin":e=Sl(i,t,o)}e&&r>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}function yl(e,t,o){const r=ko(t,o,e);return r.hit?{datum:e.datum,x:r.cx,y:e.y,distance:0,category:e.group}:null}function bl(e,t,o,r=30){const n=t-e.x,i=o-e.y,s=Math.sqrt(n*n+i*i);return s>wo(e.r,r)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function vl(e,t,o,r=30){const n=t-e.x,i=o-e.y,s=Math.sqrt(n*n+i*i);return s>wo(Lt(e.size),r)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function xl(e,t,o,r=30){if(null==e.datum)return null;const n=Io(e.glyph,e.size),i=e.x+n.centerDx,s=e.y+n.centerDy,a=t-i,l=o-s,c=Math.sqrt(a*a+l*l);return c>wo(n.radius,r)?null:{datum:e.datum,x:i,y:s,distance:c}}function kl(e,t,o){const r=t-e.cx,n=o-e.cy,i=Math.sqrt(r*r+n*n);if(e.innerRadius>i||i>e.outerRadius)return null;const s=Co(Math.atan2(n,r)),a=Co(e.startAngle),l=Co(e.endAngle);if(!(a>l?s>=a||l>=s:s>=a&&l>=s))return null;const c=(e.startAngle+e.endAngle)/2,u=(e.innerRadius+e.outerRadius)/2;return{datum:e.datum,x:e.cx+Math.cos(c)*u,y:e.cy+Math.sin(c)*u,distance:0,category:e.category}}function wl(e,t,o){const r=e.columnWidth/2;if("vertical"===e.projection){if(!(e.x-r>t||t>e.x+r||Math.min(e.minPos,e.maxPos)>o||o>Math.max(e.minPos,e.maxPos)))return{datum:e.datum,x:e.x,y:e.medianPos,distance:0,category:e.category,stats:e.stats}}else{const n=e.y-r,i=e.y+r;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||n>o||o>i))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category,stats:e.stats}}return null}function Sl(e,t,o){if(!e.bounds)return null;const{x:r,y:n,width:i,height:s}=e.bounds;return r>t||t>r+i||n>o||o>n+s?null:{datum:e.datum,x:r+i/2,y:n+s/2,distance:0,category:e.category,stats:e.stats}}var Al=require("react"),Cl=require("react/jsx-runtime");function Ml(e){const{width:t,height:o,totalWidth:r,totalHeight:n,margin:i,scales:s,showAxes:a,showGrid:l,rFormat:c}=e,{rTickValues:u,axisExtent:d}=e,h="radial"===s?.projection,p="horizontal"===s?.projection,f=(0,Al.useMemo)(()=>!s||h?[]:(u||Jn(s.r,5,d)).map(e=>({value:e,pixel:s.r(e),label:(c||jl)(e)})),[s,c,h,u,d]),g=l&&s&&!h,m=a&&s&&!h;return g||m?(0,Cl.jsx)("svg",{width:r,height:n,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:(0,Cl.jsxs)("g",{transform:`translate(${i.left},${i.top})`,children:[g&&(0,Cl.jsx)("g",{className:"ordinal-grid",children:f.map((e,r)=>(0,Cl.jsx)("line",{x1:p?e.pixel:0,y1:p?0:e.pixel,x2:p?e.pixel:t,y2:p?o:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+r))}),m&&(0,Cl.jsx)(Cl.Fragment,{children:(0,Cl.jsxs)(Cl.Fragment,p?{children:[(0,Cl.jsx)("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),(0,Cl.jsx)("line",{x1:0,y1:o,x2:t,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]}:{children:[(0,Cl.jsx)("line",{x1:0,y1:o,x2:t,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),(0,Cl.jsx)("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]})})]})}):null}function jl(e){return Math.round(100*e)/100+""}function Pl(e){const{width:t,height:o,totalWidth:r,totalHeight:n,margin:i,scales:s,showAxes:a,showCategoryTicks:l,oLabel:c,rLabel:u,oFormat:d,rFormat:h,showGrid:p,title:f,legend:g,legendHoverBehavior:m,legendClickBehavior:y,legendHighlightedCategory:b,legendIsolatedCategories:v,legendPosition:x="right",legendLayout:k,foregroundGraphics:w,annotations:S,autoPlaceAnnotations:A,svgAnnotationRules:C,xAccessor:M,yAccessor:j,annotationData:P,underlayRendered:_,children:L}=e,R="radial"===s?.projection,T="horizontal"===s?.projection,I=!1!==l,$=(0,Al.useMemo)(()=>{if(!a||!I||!s||R)return[];const e=s.o.bandwidth(),t=s.o.domain().map((t,o)=>({value:t,pixel:(s.o(t)??0)+e/2,label:d?d(t,o):t}));if(2>=t.length)return t;const o=Math.abs(t[1].pixel-t[0].pixel)||e;let r,n=0,i=!1;for(const e of t)"string"==typeof e.label?n=Math.max(n,e.label.length):"number"==typeof e.label?n=Math.max(n,(e.label+"").length):i=!0;r=T?i?24:16:Math.max(6.5*n,i?60:0)+6;const l=Math.max(1,Math.ceil(r/o));return 1===l?t:t.filter((e,t)=>t%l===0)},[a,I,s,d,R,T]),N=e.rTickValues,F=e.tickLabelEdgeAlign,B=e.axisExtent,D=(0,Al.useMemo)(()=>a&&s&&!R?(N||Jn(s.r,5,B)).map(e=>({value:e,pixel:s.r(e),label:(h||jl)(e)})):[],[a,s,h,R,N,B]),E=(0,Al.useRef)(new Map),z=(0,Al.useRef)(S?.length??0),H=S?.length??0;z.current!==H&&(z.current=H,E.current=new Map);const O=(0,Al.useMemo)(()=>{if(!S||0===S.length)return null;const e=wn(),r="horizontal"===s?.projection,n=s?.o?e=>(s.o(e)??0)+s.o.bandwidth()/2:null,i={scales:s?{x:r?s.r:n||s.r,y:r&&n||s.r,time:s.r,value:s.r,o:s.o}:null,timeAxis:"x",xAccessor:M,yAccessor:j,width:t,height:o,data:P,frameType:"ordinal",projection:r?"horizontal":"vertical",stickyPositionCache:E.current};return kn(A?Hn({annotations:S,context:i,..."object"==typeof A?A:{}}):S,e,C,i)},[S,A,C,t,o,s,M,j,P]);return a||f||g||w||O&&O.length>0||p||L?(0,Cl.jsxs)("svg",{role:"img",width:r,height:n,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[(0,Cl.jsx)("title",{children:"string"==typeof f?f:"Ordinal Chart"}),(0,Cl.jsx)("desc",{children:"string"==typeof f?f+" — ordinal data visualization":"Ordinal data visualization"}),(0,Cl.jsxs)("g",{transform:`translate(${i.left},${i.top})`,children:[p&&s&&!R&&!_&&(0,Cl.jsx)("g",{className:"ordinal-grid",children:D.map((e,r)=>(0,Cl.jsx)("line",{x1:T?e.pixel:0,y1:T?0:e.pixel,x2:T?e.pixel:t,y2:T?o:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+r))}),a&&s&&!R&&(()=>{const e={fontSize:"var(--semiotic-tick-font-size, 12px)"},r={fontSize:"var(--semiotic-axis-label-font-size, 12px)"};return(0,Cl.jsx)("g",{className:"ordinal-axes",children:(0,Cl.jsxs)(Cl.Fragment,T?{children:[(0,Cl.jsxs)("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[!_&&(0,Cl.jsx)("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),$.map((t,o)=>(0,Cl.jsxs)("g",{transform:`translate(0,${t.pixel})`,children:[(0,Cl.jsx)("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?(0,Cl.jsx)("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label}):(0,Cl.jsx)("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:(0,Cl.jsx)("div",{style:{textAlign:"right",userSelect:"none",...e},children:t.label})})]},"cat-"+o)),c&&(0,Cl.jsx)("text",{x:15-i.left,y:o/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-i.left}, ${o/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...r},children:c})]}),(0,Cl.jsxs)("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[!_&&(0,Cl.jsx)("line",{x1:0,y1:o,x2:t,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),!_&&s?.r&&(()=>{const e=s.r(0);return e>1&&t-1>e?(0,Cl.jsx)("line",{x1:e,y1:0,x2:e,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1,strokeDasharray:"4,4"}):null})(),D.map((t,r)=>{const n=F?0===r?"start":r===D.length-1?"end":"middle":"middle";return(0,Cl.jsxs)("g",{transform:`translate(${t.pixel},${o})`,children:[(0,Cl.jsx)("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),(0,Cl.jsx)("text",{y:18,textAnchor:n,fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label})]},"val-"+r)}),u&&(0,Cl.jsx)("text",{x:t/2,y:o+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:{userSelect:"none",...r},children:u})]})]}:{children:[(0,Cl.jsxs)("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[!_&&(()=>{const e=s?.r?s.r(0):o,r=0>e||e>o?o:e;return(0,Cl.jsx)("line",{x1:0,y1:r,x2:t,y2:r,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),$.map((t,r)=>(0,Cl.jsxs)("g",{transform:`translate(${t.pixel},${o})`,children:[(0,Cl.jsx)("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?(0,Cl.jsx)("text",{y:18,textAnchor:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label}):(0,Cl.jsx)("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:(0,Cl.jsx)("div",{style:{textAlign:"center",userSelect:"none",...e},children:t.label})})]},"cat-"+r)),c&&(0,Cl.jsx)("text",{x:t/2,y:o+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:{userSelect:"none",...r},children:c})]}),(0,Cl.jsxs)("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[!_&&(0,Cl.jsx)("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),D.map((t,o)=>(0,Cl.jsxs)("g",{transform:`translate(0,${t.pixel})`,children:[(0,Cl.jsx)("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),(0,Cl.jsx)("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label})]},"val-"+o)),u&&(0,Cl.jsx)("text",{x:15-i.left,y:o/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-i.left}, ${o/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...r},children:u})]})]})})})(),O,w,L]}),f&&(0,Cl.jsx)("text",{x:r/2,y:20,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:"string"==typeof f?f:null}),Hr({legend:g,totalWidth:r,totalHeight:n,margin:i,legendPosition:x,title:f,legendLayout:k,legendHoverBehavior:m,legendClickBehavior:y,legendHighlightedCategory:b,legendIsolatedCategories:v})]}):null}var _l=require("react"),Ll=require("d3-selection"),Rl=require("d3-brush"),Tl=require("react/jsx-runtime");function Il({width:e,height:t,totalWidth:o,totalHeight:r,margin:n,scales:i,onBrush:s}){const a=(0,_l.useRef)(null),l=(0,_l.useRef)(null),c=(0,_l.useRef)(s);c.current=s;const u=(0,_l.useRef)(i);u.current=i;const d=(0,_l.useRef)(!1),h=(0,_l.useRef)(null),p="horizontal"===i?.projection,f=(0,_l.useRef)(p);f.current=p;const g=I({label:"Ordinal value range brush",onAction:e=>{const t=u.current,o=l.current;if(!t||!o||!a.current)return;const r=(0,Ll.select)(a.current).select(".brush-g");if("clear"===e.type)return d.current=!0,r.call(o.move,null),d.current=!1,h.current=null,void c.current(null);if(("left"===e.direction||"right"===e.direction)!=!!f.current)return;const n=t.r.domain(),[i,s]=[Math.min(...n),Math.max(...n)],p=(s-i)/20,g=h.current?.r??[i+.4*(s-i),i+.6*(s-i)],m="left"===e.direction||"down"===e.direction?-1:1;let[y,b]=g;if(e.resize)0>m?y=Math.max(i,y-p):b=Math.min(s,b+p);else{const e=b-y;y=Math.max(i,Math.min(s-e,y+m*p)),b=y+e}const v={r:[y,b]};d.current=!0,r.call(o.move,f.current?[t.r(y),t.r(b)]:[t.r(b),t.r(y)]),d.current=!1,h.current=v,c.current(v)}});return(0,_l.useEffect)(()=>{if(!a.current)return;const o=(0,Ll.select)(a.current).select(".brush-g"),r=p?(0,Rl.brushX)():(0,Rl.brushY)();return r.extent([[0,0],[e,t]]),r.on("brush end",e=>{if(d.current)return;const t=u.current;if(!t)return;if(!e.selection)return h.current=null,void c.current(null);const[o,r]=e.selection;let n;n=f.current?[t.r.invert(o),t.r.invert(r)]:[t.r.invert(r),t.r.invert(o)];const i={r:n};h.current=i,c.current(i)}),o.call(r),l.current=r,o.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{r.on("brush end",null),l.current=null}},[e,t,p]),(0,_l.useEffect)(()=>{if(!i||!l.current||!h.current)return;if(!a.current)return;const e=h.current,t=(0,Ll.select)(a.current).select(".brush-g"),o=i.r(e.r[0]),r=i.r(e.r[1]);p?(d.current=!0,t.call(l.current.move,[o,r]),d.current=!1):(d.current=!0,t.call(l.current.move,[r,o]),d.current=!1)},[i,p]),(0,Tl.jsxs)("svg",{ref:a,width:o,height:r,...g.svgProps,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[(0,Tl.jsx)("title",{children:g.svgProps["aria-label"]}),(0,Tl.jsx)("desc",{id:g.descriptionId,children:g.description}),(0,Tl.jsx)("g",{className:"brush-g",transform:`translate(${n.left},${n.top})`,style:{pointerEvents:"all"}})]})}var $l=require("d3-shape");function Nl(e,t){const o=t._gradientBand.colors;if(0===o.length)return;const{clipPath:r,slices:n}=mi({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,cornerRadius:t.cornerRadius,roundStart:t.roundedEnds?.start??!0,roundEnd:t.roundedEnds?.end??!0,colors:o}),i=new Path2D(r);e.save(),e.translate(t.cx,t.cy),e.clip(i);for(const t of n)e.fillStyle=Oo(e,t.color)||t.color||"#007bff",e.fill(new Path2D(t.d));e.restore(),t.style.stroke&&"none"!==t.style.stroke&&(e.save(),e.translate(t.cx,t.cy),e.strokeStyle=Oo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(i),e.restore())}function Fl(e,t){e.beginPath(),t.innerRadius>0?(e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerRadius,t.endAngle,t.startAngle,!0)):(e.moveTo(t.cx,t.cy),e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle)),e.closePath()}function Bl(e,t){const o={innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle+Math.PI/2,endAngle:t.endAngle+Math.PI/2},r=(0,$l.arc)().cornerRadius(t.cornerRadius)(o);if(!r)return;e.save(),e.translate(t.cx,t.cy);const n=new Path2D(r);e.fill(n),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(n),e.restore()}var Dl=(e,t,o,r)=>{const n=t.filter(e=>"wedge"===e.type);for(const t of n)if(e.globalAlpha=(t.style.fillOpacity??1)*(t.style.opacity??1),t._gradientBand&&t._gradientBand.colors.length>0)Nl(e,t),t._pulseIntensity&&t._pulseIntensity>0&&(Fl(e,t),ga(e,t)),e.globalAlpha=1;else{if(e.fillStyle=("string"==typeof t.style.fill?Oo(e,t.style.fill):t.style.fill)||"#007bff",t.roundedEnds){t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Oo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1);const o=gi({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,cornerRadius:t.cornerRadius,roundStart:t.roundedEnds.start,roundEnd:t.roundedEnds.end});e.save(),e.translate(t.cx,t.cy);const r=new Path2D(o);e.fill(r),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(r),e.restore()}else t.cornerRadius?(t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Oo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1),Bl(e,t)):(Fl(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Oo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()));t._pulseIntensity&&t._pulseIntensity>0&&(Fl(e,t),ga(e,t)),e.globalAlpha=1}},El=(e,t,o,r)=>{const n=t.filter(e=>"boxplot"===e.type);for(const t of n){const o=t.columnWidth/2,r="vertical"===t.projection,n=Oo(e,"var(--semiotic-primary, #007bff)"),i=Oo(e,"var(--semiotic-text, #333)"),s=t.style.fill,a="string"==typeof s?Oo(e,s)||s:s??n,l=t.style.stroke,c="string"==typeof l?Oo(e,l)||l:i,u=t.style.strokeWidth||1,d=t.style.fillOpacity??t.style.opacity??.6;if(e.save(),e.strokeStyle=c,e.lineWidth=u,e.beginPath(),r?(e.moveTo(t.x,t.minPos),e.lineTo(t.x,t.maxPos)):(e.moveTo(t.minPos,t.y),e.lineTo(t.maxPos,t.y)),e.stroke(),e.beginPath(),r?(e.moveTo(t.x-.4*o,t.minPos),e.lineTo(t.x+.4*o,t.minPos),e.moveTo(t.x-.4*o,t.maxPos),e.lineTo(t.x+.4*o,t.maxPos)):(e.moveTo(t.minPos,t.y-.4*o),e.lineTo(t.minPos,t.y+.4*o),e.moveTo(t.maxPos,t.y-.4*o),e.lineTo(t.maxPos,t.y+.4*o)),e.stroke(),e.globalAlpha=d,e.fillStyle=a,r){const r=Math.min(t.q1Pos,t.q3Pos),n=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-o,r,t.columnWidth,n),e.globalAlpha=1,e.strokeRect(t.x-o,r,t.columnWidth,n)}else{const r=Math.min(t.q1Pos,t.q3Pos),n=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(r,t.y-o,n,t.columnWidth),e.globalAlpha=1,e.strokeRect(r,t.y-o,n,t.columnWidth)}e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),r?(e.moveTo(t.x-o,t.medianPos),e.lineTo(t.x+o,t.medianPos)):(e.moveTo(t.medianPos,t.y-o),e.lineTo(t.medianPos,t.y+o)),e.stroke(),e.restore()}},zl=(e,t,o,r)=>{const n=t.filter(e=>"violin"===e.type);for(const t of n){e.save(),(t.translateX||t.translateY)&&e.translate(t.translateX,t.translateY);const o=new Path2D(t.pathString);if(e.globalAlpha=t.style.fillOpacity??t.style.opacity??.6,e.fillStyle=("string"==typeof t.style.fill?Oo(e,t.style.fill):t.style.fill)||"#007bff",e.fill(o),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Oo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(o)),t.iqrLine){e.strokeStyle="#333",e.lineWidth=2,e.globalAlpha=.8;const o=t.iqrLine.centerPos,r=!1!==t.iqrLine.isVertical;e.beginPath(),r?(e.moveTo(o,t.iqrLine.q1Pos),e.lineTo(o,t.iqrLine.q3Pos)):(e.moveTo(t.iqrLine.q1Pos,o),e.lineTo(t.iqrLine.q3Pos,o)),e.stroke(),e.beginPath(),r?e.arc(o,t.iqrLine.medianPos,3,0,2*Math.PI):e.arc(t.iqrLine.medianPos,o,3,0,2*Math.PI),e.fillStyle="#fff",e.fill(),e.strokeStyle="#333",e.lineWidth=1,e.stroke(),e.globalAlpha=1}e.restore()}},Hl=(e,t,o,r)=>{const n=t.filter(e=>"connector"===e.type);if(0===n.length)return;const i=new Map;for(const e of n){const t=e.group||"_default";i.has(t)||i.set(t,[]),i.get(t).push(e)}for(const[,t]of i){if(0===t.length)continue;const o=t[0].style;if(o.fill&&"none"!==o.fill){e.beginPath(),e.moveTo(t[0].x1,t[0].y1);for(const o of t)e.lineTo(o.x2,o.y2);e.closePath(),e.globalAlpha=o.fillOpacity??o.opacity??.3,e.fillStyle=o.fill,e.fill(),e.globalAlpha=1}for(const o of t)e.beginPath(),e.moveTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.strokeStyle=Oo(e,o.style.stroke)||("string"==typeof o.style.fill?Oo(e,o.style.fill):o.style.fill)||Oo(e,"var(--semiotic-border, #999)"),e.lineWidth=o.style.strokeWidth||1,e.globalAlpha=o.style.opacity??.5,e.stroke(),e.globalAlpha=1}},Ol=(e,t,o,r)=>{const n=t.filter(e=>"trapezoid"===e.type);for(const t of n){const o=t.points;if(o.length>=4){e.globalAlpha=t.style?.opacity??1,e.beginPath(),e.moveTo(o[0][0],o[0][1]);for(let t=1;o.length>t;t++)e.lineTo(o[t][0],o[t][1]);e.closePath(),e.fillStyle=t.style?.fill||"#999",e.fill(),t.style?.stroke&&(e.strokeStyle=Oo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}};function Wl(e){return 1e6>e?1e4>e?1e3>e?e+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function ql(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}var Yl=null;function Gl(e={},t){const{background:o="transparent",stroke:r="#000",lineWidth:n=1.5,spacing:i=6,angle:s=45}=e,a=Math.max(8,Math.ceil(2*i));let l;try{l=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(Yl||(Yl=document.createElement("canvas")),Yl.width=e,Yl.height=e,Yl)}(a)}catch{return null}const c=l.getContext("2d");if(!c)return null;o&&"transparent"!==o?(c.fillStyle=o,c.fillRect(0,0,a,a)):c.clearRect(0,0,a,a),c.strokeStyle=r,c.lineWidth=n,c.lineCap="square";const u=s*Math.PI/180;if(45===s||-45===s){const e=s>0?1:-1;for(let t=-a;2*a>=t;t+=i)c.beginPath(),c.moveTo(t,0),c.lineTo(t+e*a,a),c.stroke()}else{c.save(),c.translate(a/2,a/2),c.rotate(u);const e=2*a;for(let t=-e;e>=t;t+=i)c.beginPath(),c.moveTo(-e,t),c.lineTo(e,t),c.stroke();c.restore()}return(t||c).createPattern(l,"repeat")}var Vl=new Map;function Xl(e,t){const o=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,r=Vl.get(o);if(void 0!==r)return r;const n=Gl({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return Vl.set(o,n),n}function Ul(e,t,o,r,n,i){e.moveTo(t+i,o),e.lineTo(t+r-i,o),e.quadraticCurveTo(t+r,o,t+r,o+i),e.lineTo(t+r,o+n-i),e.quadraticCurveTo(t+r,o+n,t+r-i,o+n),e.lineTo(t+i,o+n),e.quadraticCurveTo(t,o+n,t,o+n-i),e.lineTo(t,o+i),e.quadraticCurveTo(t,o,t+i,o),e.closePath()}function Kl(e){return 1e6>e?1e4>e?1e3>e?Math.round(e)+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function Ql(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}var Zl=e=>[Hl,...e],Jl={bar:Zl([ja]),clusterbar:Zl([ja]),point:Zl([va,wa]),swarm:Zl([va,wa]),pie:[Dl],donut:[Dl],boxplot:Zl([El,va]),violin:Zl([zl]),histogram:Zl([ja]),ridgeline:Zl([zl]),timeline:Zl([ja]),funnel:[ja,Ol,(e,t,o,r)=>{const n=t.filter(e=>"rect"===e.type&&null!=e.datum);if(0!==n.length&&n.some(e=>null!=e.datum?.__funnelStepLabel||null!=e.datum?.__funnelValueLabelX)){e.textBaseline="top",e.lineJoin="round",e.textAlign="center",e.font="bold 14px sans-serif";for(const t of n){const o=t.datum;if(!o)continue;if(!o.__funnelStepLabel)continue;const r=o.__funnelStepLabel;if(e.measureText(r).width+16>(o.__funnelRowWidth??o.__funnelBarW??0))continue;const n=o.__funnelStepLabelX,i=o.__funnelStepLabelY+3;e.strokeStyle="rgba(0,0,0,0.6)",e.lineWidth=3,e.strokeText(r,n,i),e.fillStyle="#fff",e.fillText(r,n,i)}e.font="bold 13px sans-serif";for(const t of n){const o=t.datum;if(!o)continue;if(null==o.__funnelValueLabelX)continue;const r=o.__funnelBarW??0;if(60>r)continue;const n=o.__funnelValue;if(null==n||0===n)continue;const i=o.__funnelPercent,s=!0===o.__funnelIsFirstStep;let a;if(a=s?Wl(n):null!=i?`${Wl(n)} (${ql(i)})`:Wl(n),e.measureText(a).width+16>r){if(s||null==i)continue;if(a=Wl(n),e.measureText(a).width+16>r)continue}const l=o.__funnelValueLabelX,c=(o.__funnelValueLabelY??t.y)+14+5;e.textAlign="center",e.strokeStyle="rgba(0,0,0,0.5)",e.lineWidth=3,e.strokeText(a,l,c),e.fillStyle="#fff",e.fillText(a,l,c)}e.lineWidth=1,e.lineJoin="miter"}}],"bar-funnel":[ja,(e,t,o,r)=>{const n=t.filter(e=>"rect"===e.type&&!0===e.datum?.__barFunnelIsDropoff);for(const t of n){const o=("string"==typeof t.style.fill?t.style.fill:null)||Oo(e,"var(--semiotic-border, #999)"),r=Xl(o,e);e.globalAlpha=t.style.opacity??1,e.beginPath(),e.rect(t.x,t.y,t.w,t.h),r?e.fillStyle=r:(e.fillStyle=o,e.globalAlpha=.4*(t.style.opacity??1)),e.fill(),e.globalAlpha=1}},(e,t,o,r)=>{const n=t.filter(e=>"rect"===e.type&&!0!==e.datum?.__barFunnelIsDropoff&&null!=e.datum?.__barFunnelLabelX);if(0===n.length)return;const i=function(e,t){const[o,r,n]=Wo(e,t);return(.2126*o+.7152*r+.0722*n)/255>.6}(e,Oo(e,"var(--semiotic-text, #333)")),s=i?"#1f2937":"#ffffff",a=i?"rgba(255,255,255,0.18)":"rgba(0,0,0,0.12)",l=i?"#f3f4f6":"#1a1a1a",c=l;for(const t of n){const o=t.datum;if(!o)continue;const r=o.__barFunnelValue;if(null==r)continue;if(25>t.w)continue;const n=o.__barFunnelPercent,i=!(!0===o.__barFunnelIsFirstStep)&&null!=n,u=i?Ql(n):"",d=Kl(r);e.font="bold 13px sans-serif";const h=i?e.measureText(u).width:0;e.font="11px sans-serif";const p=e.measureText(d).width,f=Math.max(h,p)+12,g=i?32:17,m=o.__barFunnelLabelX,y=m-f/2,b=o.__barFunnelLabelY-g-4;e.save(),e.shadowColor="rgba(0,0,0,0.15)",e.shadowBlur=4,e.shadowOffsetY=1,e.fillStyle=s,e.beginPath(),Ul(e,y,b,f,g,4),e.fill(),e.restore(),e.strokeStyle=a,e.lineWidth=.5,e.beginPath(),Ul(e,y,b,f,g,4),e.stroke(),e.textAlign="center",e.textBaseline="top",i?(e.font="bold 13px sans-serif",e.fillStyle=l,e.fillText(u,m,b+3),e.font="11px sans-serif",e.fillStyle=c,e.fillText(d,m,b+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle=l,e.fillText(d,m,b+3))}e.lineWidth=1}],swimlane:Zl([ja]),custom:Zl([ja,va,wa,Aa,Dl,El,zl,Ol])},ec=require("react/jsx-runtime");function tc(e){const t=_s(e,{skipPositional:!1});return null==t.title&&0===t.entries.length?null:(0,ec.jsxs)("div",{className:"semiotic-tooltip",style:Rs,children:[null!=t.title&&(0,ec.jsx)("div",{style:{fontWeight:"bold"},children:t.title+""}),t.entries.map(e=>(0,ec.jsxs)("div",{children:[(0,ec.jsxs)("span",{style:{opacity:.7},children:[e.key,":"]})," ","number"==typeof e.value?e.value.toLocaleString():e.value+""]},e.key))]})}function oc({hover:e}){const t=e.data||{},o=e.stats,r=e.category;if(Array.isArray(t)){const e=r||t[0]?.category||"";if(o)return(0,ec.jsxs)("div",{className:"semiotic-tooltip",style:Rs,children:[e&&(0,ec.jsx)("div",{style:{fontWeight:"bold"},children:e+""}),(0,ec.jsxs)("div",{children:["n = ",o.n]}),(0,ec.jsxs)("div",{children:["Min: ",o.min.toLocaleString()]}),(0,ec.jsxs)("div",{children:["Q1: ",o.q1.toLocaleString()]}),(0,ec.jsxs)("div",{children:["Median: ",o.median.toLocaleString()]}),(0,ec.jsxs)("div",{children:["Q3: ",o.q3.toLocaleString()]}),(0,ec.jsxs)("div",{children:["Max: ",o.max.toLocaleString()]}),(0,ec.jsxs)("div",{style:{opacity:.8},children:["Mean: ",o.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});const n=t.length;return(0,ec.jsxs)("div",{className:"semiotic-tooltip",style:Rs,children:[e&&(0,ec.jsx)("div",{style:{fontWeight:"bold"},children:e+""}),(0,ec.jsxs)("div",{children:[n," items"]})]})}if(null!=t.bin&&null!=t.count){const e=t.range||[];return(0,ec.jsxs)("div",{className:"semiotic-tooltip",style:Rs,children:[t.category&&(0,ec.jsx)("div",{style:{fontWeight:"bold"},children:t.category+""}),(0,ec.jsxs)("div",{children:["Count: ",t.count]}),2===e.length&&(0,ec.jsxs)("div",{style:{opacity:.8},children:[Number(e[0]).toFixed(1)," – ",Number(e[1]).toFixed(1)]})]})}const n=e.__oAccessor,i=e.__rAccessor,s=e.__chartType;if("swarm"===s||"point"===s)return tc(t);const a=(n&&null!=t[n]?t[n]:null)||t.category||t.name||t.group||t.__rName||"",l=t.__aggregateValue??(i&&null!=t[i]?t[i]:null)??t.value??t.__rValue??t.pct??"";return a||""!==l?(0,ec.jsxs)("div",{className:"semiotic-tooltip",style:Rs,children:[a&&(0,ec.jsx)("div",{style:{fontWeight:"bold"},children:a+""}),""!==l&&(0,ec.jsx)("div",{children:"number"==typeof l?l.toLocaleString():l+""})]}):tc(t)}oc.ownsChrome=!0;var rc=require("react/jsx-runtime"),nc={top:50,right:40,bottom:60,left:70},ic=(0,Qa.memo)((0,Qa.forwardRef)(function(e,t){const{chartType:o,runtimeMode:r,data:n,oAccessor:i="category",rAccessor:s="value",colorAccessor:a,symbolAccessor:l,symbolMap:c,stackBy:u,groupBy:d,multiAxis:h,timeAccessor:p,valueAccessor:f,categoryAccessor:g,accessorRevision:m,projection:y="vertical",size:b=[600,400],responsiveWidth:v,responsiveHeight:x,margin:k,barPadding:w,roundedTop:S,gradientFill:A,trackFill:C,baselinePadding:M,innerRadius:j,cornerRadius:P,normalize:_,startAngle:L,sweepAngle:R,dynamicColumnWidth:T,bins:I,showOutliers:$,showIQR:N,amplitude:F,connectorOpacity:B,showLabels:D,connectorAccessor:E,connectorStyle:O,dataIdAccessor:W,rExtent:q,oExtent:Y,extentPadding:V=.05,oSort:X,windowMode:U="sliding",windowSize:K=200,pieceStyle:Q,summaryStyle:Z,colorScheme:J,barColors:ee,showAxes:te=!0,showCategoryTicks:oe,categoryLabel:re,valueLabel:ne,categoryFormat:ie,valueFormat:se,oLabel:ae,rLabel:le,oFormat:ce,rFormat:ue,rTickValues:de,tickLabelEdgeAlign:he,axisExtent:pe,enableHover:fe=!0,hoverAnnotation:ge,tooltipContent:me,customHoverBehavior:ye,customClickBehavior:be,annotations:ve,autoPlaceAnnotations:xe,svgAnnotationRules:ke,showGrid:we=!1,legend:Se,legendHoverBehavior:Ae,legendClickBehavior:Ce,legendHighlightedCategory:Me,legendIsolatedCategories:je,legendPosition:Pe,legendLayout:_e,legendCategoryAccessor:Le,onCategoriesChange:Re,backgroundGraphics:Te,foregroundGraphics:Ie,title:$e,className:Ne,background:Fe,centerContent:Be,decay:De,pulse:Ee,transition:ze,animate:He,staleness:Oe,brush:We,onBrush:qe,accessibleTable:Ye=!0,description:Ge,summary:Ve,customLayout:Xe,onLayoutError:Ue,layoutConfig:Ke,layoutSelection:Qe}=e,Ze=(0,Qa.useRef)(!0),Je=Us({sizeProp:b,responsiveWidth:v,responsiveHeight:x,userMargin:k,marginDefault:nc,animate:He,transitionProp:ze,themeDirtyRef:Ze}),{reducedMotionRef:et,responsiveRef:tt,size:ot,margin:rt,adjustedWidth:nt,adjustedHeight:it,currentTheme:st,transition:at,introEnabled:lt,tableId:ct,rafRef:ut,renderFnRef:dt,scheduleRender:ht,cancelRender:pt}=Je,ft=Mi(),gt=Li(),mt=(0,Qa.useMemo)(()=>z(n),[n]),yt=re??ae,bt=ne??le,vt=ie??ce,xt=se??ue,kt=(0,Qa.useRef)(null),wt=(0,Qa.useRef)(null),St=(0,Qa.useRef)([]),At=(0,Qa.useRef)(Le),Ct=(0,Qa.useRef)(Re);At.current=Le,Ct.current=Re;const[Mt,jt]=(0,Qa.useState)(null),[Pt,_t]=(0,Qa.useState)(null),Lt=(e,t)=>"function"==typeof e?e({size:ot,margin:rt,scales:t}):e,Rt=Lt(Ie,Pt),Tt=Lt(Te,Pt),[It,$t]=(0,Qa.useState)(0),Nt=(0,Qa.useRef)(0),[Ft,Bt]=(0,Qa.useState)(!1),Dt=(0,Qa.useRef)({w:-1,h:-1}),Et=(0,Qa.useRef)(!1),zt=fe||ge,Ht="streaming"===r,Ot=Ii((0,Qa.useMemo)(()=>({chartType:o,runtimeMode:Ht?"streaming":"bounded",windowSize:K,windowMode:U,extentPadding:V,projection:y,oAccessor:Ht?void 0:i,rAccessor:Ht?void 0:s,accessorRevision:m,colorAccessor:a,symbolAccessor:l,symbolMap:c,stackBy:u,groupBy:d,multiAxis:h,timeAccessor:Ht?p:void 0,valueAccessor:Ht?f||("string"==typeof s||"function"==typeof s?s:void 0):void 0,categoryAccessor:Ht?g||i:void 0,rExtent:q,oExtent:Y,axisExtent:pe,barPadding:w,roundedTop:S,gradientFill:A,trackFill:C,baselinePadding:M,innerRadius:j,cornerRadius:P,normalize:_,startAngle:L,sweepAngle:R,dynamicColumnWidth:T,bins:I,showOutliers:$,showIQR:N,amplitude:F,connectorOpacity:B,showLabels:D,connectorAccessor:E,connectorStyle:O,dataIdAccessor:W,oSort:X,pieceStyle:Q,summaryStyle:Z,colorScheme:J,themeCategorical:st?.colors?.categorical,themeSemantic:G(st),themeSequential:st?.colors?.sequential,themeDiverging:st?.colors?.diverging,barColors:ee,decay:De,pulse:Ee,transition:at,introAnimation:lt,staleness:Oe,customLayout:Xe,onLayoutError:Ue,layoutConfig:Ke,layoutMargin:rt}),[o,K,U,V,y,i,s,m,a,l,c,u,d,h,p,f,g,q,Y,pe,w,S,A,C,M,j,P,_,L,R,T,I,$,N,F,B,D,E,O,W,X,Q,Z,J,ee,De,Ee,at?.duration,at?.easing,lt,Oe,Ht,st,Xe,Ue,Ke,rt])),Wt=(0,Qa.useRef)(null);Wt.current||(Wt.current=new gl(Ot));const qt=(0,Qa.useCallback)(()=>{const e=At.current,t=Ct.current;if(!t||!e)return;const o=ea(Wt.current?.getData()??[],e);ta(o,St.current)||(St.current=o,t(o))},[]);vo(Wt,Ot,Ze,ht),xo(Wt,Qe,Ze,ht);const Yt=(0,Qa.useRef)(null);Yt.current||(Yt.current=new H(e=>{const t=Wt.current;t&&t.ingest(e)&&(Ze.current=!0,ht())}));const Gt=(0,Qa.useCallback)(e=>{Yt.current?.push(e)},[]),Vt=(0,Qa.useCallback)(e=>{Yt.current?.pushMany(e)},[]),Xt=(0,Qa.useCallback)(()=>{Yt.current?.clear(),Wt.current?.clear(),Ze.current=!0,ht()},[ht]),Ut=(0,Qa.useCallback)(e=>{Yt.current?.clearLastData(),Yt.current?.setReplacementData(e)},[]);(0,Qa.useImperativeHandle)(t,()=>({push:Gt,pushMany:Vt,replace:Ut,remove:e=>{Yt.current?.flush();const t=Wt.current?.remove(e)??[];if(t.length>0){const e=wt.current?.data;!!wt.current&&t.some(Array.isArray(e)?t=>e.includes(t):t=>t===e)&&(wt.current=null,jt(null)),Ze.current=!0,ht()}return t},update:(e,t)=>{Yt.current?.flush();const o=Wt.current?.update(e,t)??[];return o.length>0&&(Ze.current=!0,ht()),o},clear:Xt,getData:()=>(Yt.current?.flush(),Wt.current?.getData()??[]),getScales:()=>Wt.current?.scales??null,getCustomLayout:()=>Wt.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>Wt.current?.lastCustomLayoutFailure??null}),[Gt,Vt,Ut,Xt,ht]),(0,Qa.useEffect)(()=>{n&&Yt.current?.setBoundedData(mt)},[n,mt]);const{hoverHandlerRef:Kt,hoverLeaveRef:Qt,onPointerMove:Zt,onPointerLeave:Jt}=Je;Kt.current=e=>{if(!zt)return;const t=kt.current;if(!t)return;const r=t.getBoundingClientRect(),n=e.clientX-r.left-rt.left,a=e.clientY-r.top-rt.top;if(0>n||n>nt||0>a||a>it)return void(wt.current&&(wt.current=null,jt(null),ye&&ye(null),ht()));const l=Wt.current;if(!l||0===l.scene.length)return;const c="radial"===y,u=ml(l.scene,c?n-nt/2:n,c?a-it/2:a,30,l.pointQuadtree,l.maxPointRadius);if(!u)return void(wt.current&&(wt.current=null,jt(null),ye&&ye(null),ht()));const d=Ss(u.datum||{},u.x,u.y,{...u.stats&&{stats:u.stats},...u.category&&{category:u.category},__oAccessor:"string"==typeof i?i:void 0,__rAccessor:"string"==typeof s?s:void 0,__chartType:o});wt.current=d,jt(d),ye&&(ye(d),Ze.current=!0),ht()},Qt.current=()=>{wt.current&&(wt.current=null,jt(null),ye&&(ye(null),Ze.current=!0),ht())};const eo=(0,Qa.useCallback)(e=>{if(!be)return;const t=kt.current;if(!t)return be(null),Ze.current=!0,void ht();const r=t.getBoundingClientRect(),n=e.clientX-r.left-rt.left,a=e.clientY-r.top-rt.top;if(0>n||n>nt||0>a||a>it)return be(null),Ze.current=!0,void ht();const l=Wt.current;if(!l||0===l.scene.length)return be(null),Ze.current=!0,void ht();const c="radial"===y,u=ml(l.scene,c?n-nt/2:n,c?a-it/2:a,30,l.pointQuadtree,l.maxPointRadius);if(!u)return be(null),Ze.current=!0,void ht();be(Ss(u.datum||{},u.x,u.y,{...u.stats&&{stats:u.stats},...u.category&&{category:u.category},__oAccessor:"string"==typeof i?i:void 0,__rAccessor:"string"==typeof s?s:void 0,__chartType:o})),Ze.current=!0,ht()},[it,nt,o,be,rt,i,y,s,ht]),to=(0,Qa.useRef)(-1),oo=(0,Qa.useRef)(null),ro=(0,Qa.useRef)(null),no=(0,Qa.useCallback)(e=>{const t=Wt.current;if(!t||0===t.scene.length)return;const r=t.version;let n;if(ro.current&&ro.current.version===r)n=ro.current.graph;else{const e=function(e){const t=[];for(const o of e)if("rect"===o.type&&null!=o.x){if(null==o.datum)continue;t.push({x:o.x+o.w/2,y:o.y+o.h/2,datum:o.datum,shape:"rect",w:o.w,h:o.h,group:o.group??o.datum?.category??""})}else if("point"===o.type)t.push({x:o.x,y:o.y,datum:o.datum,shape:"circle",group:"_default"});else if("symbol"===o.type){if(0>=o.size)continue;t.push({x:o.x,y:o.y,datum:o.datum,shape:"circle",group:"_default"})}else if("glyph"===o.type){if(0>=o.size||null==o.datum)continue;const e=Io(o.glyph,o.size);t.push({x:o.x+e.centerDx,y:o.y+e.centerDy,datum:o.datum,shape:"rect",w:2*e.halfWidth,h:2*e.halfHeight,group:"_default"})}else if("wedge"===o.type&&null!=o.cx){if(null===o.datum)continue;const e=((o.startAngle||0)+(o.endAngle||0))/2,r=((o.innerRadius||0)+(o.outerRadius||50))/2;t.push({x:o.cx+Math.cos(e)*r,y:o.cy+Math.sin(e)*r,datum:o.datum,shape:"wedge",group:"_default"})}return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}(t.scene);if(0===e.length)return;n=ur(e),ro.current={version:r,graph:n}}const a=to.current;if(0>a){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),to.current=0;const t=n.flat[0];oo.current={shape:t.shape,w:t.w,h:t.h};const r={...gr(t),__oAccessor:"string"==typeof i?i:void 0,__rAccessor:"string"==typeof s?s:void 0,__chartType:o};return wt.current=r,jt(r),ye&&ye(r),void ht()}const l=dr(n,a),c=hr(e.key,l,n);if(null===c)return;if(e.preventDefault(),0>c)return to.current=-1,oo.current=null,wt.current=null,jt(null),ye&&ye(null),void ht();to.current=c;const u=n.flat[c];oo.current={shape:u.shape,w:u.w,h:u.h};const d={...gr(u),__oAccessor:"string"==typeof i?i:void 0,__rAccessor:"string"==typeof s?s:void 0,__chartType:o};wt.current=d,jt(d),ye&&ye(d),ht()},[ye,ht]),io=(0,Qa.useCallback)(e=>{to.current=-1,oo.current=null,Zt(e)},[Zt]);dt.current=()=>{ut.current=null;const e=kt.current;if(!e)return;const t=e.getContext("2d");if(!t)return;const r=Wt.current;if(!r)return;const n="undefined"!=typeof performance?performance.now():Date.now(),i=r.advanceTransition(et.current?n+1e6:n),s=!et.current&&i,a=Dt.current.w!==nt||Dt.current.h!==it,l=Ze.current;let c=!1;!l&&!a||s&&!a||(r.computeScene({width:nt,height:it}),Dt.current={w:nt,h:it},c=!0,qt()),Ze.current=l&&s&&!c;const u=Ks(r,n,c,Et);(c||s)&&e.setAttribute("aria-label",Qi(r.scene,o+" chart"));const d=Zs(),h=ot[0]*d,p=ot[1]*d;e.width===h&&e.height===p||(e.width=h,e.height=p,e.style.width=ot[0]+"px",e.style.height=ot[1]+"px"),t.setTransform(d,0,0,d,0,0),t.clearRect(0,0,ot[0],ot[1]);const f=Oe&&r.lastIngestTime>0&&n-r.lastIngestTime>(Oe?.threshold??5e3);f&&(t.globalAlpha=Oe?.dimOpacity??.5),Bi(t,{background:Fe,hasBackgroundGraphics:!!Te,themeBackground:Te||"transparent"===Fe||Fe?"":getComputedStyle(e).getPropertyValue("--semiotic-bg").trim(),width:ot[0],height:ot[1]});const g="radial"===y;t.save(),t.beginPath(),t.rect(rt.left,rt.top,nt,it),t.clip(),g?(t.save(),t.translate(rt.left+nt/2,rt.top+it/2)):t.translate(rt.left,rt.top);const m=Xe?Jl.custom:Jl[o]||[],b={width:nt,height:it};for(const e of m)e(t,r.scene,r.scales,b);g&&t.restore(),t.restore(),f&&(t.globalAlpha=1),c&&r.scales?(_t(r.scales),$t(e=>e+1),Nt.current=n):s&&r.scales&&n-Nt.current>=33&&($t(e=>e+1),Nt.current=n),Oe?.showBadge&&Bt(!!f),(s||null!=r.activeTransition||u.pending)&&ht()},Ri({hydrated:ft,wasHydratingFromSSR:gt,storeRef:Wt,dirtyRef:Ze,renderFnRef:dt,cancelRender:pt,cleanup:()=>Yt.current?.clear()}),(0,Qa.useEffect)(()=>{Ze.current=!0,ht()},[o,nt,it,te,Fe,ht]),xr(Oe,Wt,Ze,ht,Ft,Bt);const so=zt&&Mt?me?me(Mt):(0,rc.jsx)(oc,{hover:Mt}):null,ao="radial"===y,lo=so?(0,rc.jsx)(Es,{x:Mt?ao?Mt.x+nt/2:Mt.x:0,y:Mt?ao?Mt.y+it/2:Mt.y:0,containerWidth:nt,containerHeight:it,margin:rt,className:"stream-ordinal-tooltip",children:so}):null,uo=oa(i,void 0,"__semiotic_resolvedO",""),ho=oa(s,void 0,"__semiotic_resolvedR",""),po=uo.key,fo=ho.key,go=ra(uo,ho,ve&&ve.length>0||!1);if(Si||!ft&>){const e=Wt.current;e&&n&&(e.ingest({inserts:mt,bounded:!0}),e.computeScene({width:nt,height:it}));const t=e?.scene??[],o=e?.scales??null,r=Lt(Ie,o),i=Lt(Te,o),s="radial"===y,a=s?rt.left+nt/2:rt.left,l=s?rt.top+it/2:rt.top;return(0,rc.jsxs)("div",{ref:tt,className:"stream-ordinal-frame"+(Ne?" "+Ne:""),role:"img","aria-label":Ge||("string"==typeof $e?$e:"Ordinal chart"),style:{position:"relative",width:v?"100%":ot[0],height:x?"100%":ot[1]},children:[(0,rc.jsx)(fs,{summary:Ve}),(0,rc.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:ot[0],height:ot[1],style:{position:"absolute",left:0,top:0},children:[i&&(0,rc.jsx)("g",{transform:`translate(${rt.left},${rt.top})`,children:i}),(0,rc.jsxs)("g",{transform:`translate(${a},${l})`,children:[Fe&&(0,rc.jsx)("rect",{x:0,y:0,width:nt,height:it,fill:Fe}),t.map((e,t)=>function(e,t,o){const r=("category"in e?e.category:void 0)||("group"in e?e.group:void 0)||"",n=o=>`ord-${e.type}-${r}-${t}-${o}`,i=`ord-${e.type}-${r}-${t}`;switch(e.type){case"rect":{const t=e,o=wi(i)+"-grad",r=function(e,t){const o=e.fillGradient;if(!o)return null;let r=e.x,n=e.y,i=e.x,s=e.y+e.h;"bottom"===e.roundedEdge?(n=e.y+e.h,s=e.y):"right"===e.roundedEdge?(r=e.x+e.w,n=e.y,i=e.x,s=e.y):"left"===e.roundedEdge&&(r=e.x,n=e.y,i=e.x+e.w,s=e.y);const a=[];if("colorStops"in o){const e=o.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>e.length)return null;for(let t=0;e.length>t;t++)a.push((0,yi.jsx)("stop",{offset:e[t].offset,stopColor:e[t].color},t))}else{const t=vi(e.style.fill);a.push((0,yi.jsx)("stop",{offset:0,stopColor:t,stopOpacity:o.topOpacity},"0")),a.push((0,yi.jsx)("stop",{offset:1,stopColor:t,stopOpacity:o.bottomOpacity},"1"))}return(0,yi.jsx)("linearGradient",{id:t,gradientUnits:"userSpaceOnUse",x1:r,y1:n,x2:i,y2:s,children:a})}(t,o),n=r?`url(#${o})`:vi(t.style.fill);if(t.cornerRadii&&hi(t.cornerRadii)){const e=function(e){const{x:t,y:o,w:r,h:n}=e,{tl:i,tr:s,br:a,bl:l}=pi(e);let c=`M${t+i},${o}`;return c+=` L${t+r-s},${o}`,s>0&&(c+=` A${s},${s} 0 0 1 ${t+r},${o+s}`),c+=` L${t+r},${o+n-a}`,a>0&&(c+=` A${a},${a} 0 0 1 ${t+r-a},${o+n}`),c+=` L${t+l},${o+n}`,l>0&&(c+=` A${l},${l} 0 0 1 ${t},${o+n-l}`),c+=` L${t},${o+i}`,i>0&&(c+=` A${i},${i} 0 0 1 ${t+i},${o}`),c+=" Z",c}(t);return(0,yi.jsxs)(ui.Fragment,{children:[r&&(0,yi.jsx)("defs",{children:r}),(0,yi.jsx)("path",{d:e,fill:n,opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})]},i)}if(t.roundedTop&&t.roundedTop>0){const e=Math.min(t.roundedTop,t.w/2,t.h/2),{x:o,y:s,w:a,h:l}=t;let c;switch(t.roundedEdge){case"right":c=`M${o},${s} L${o+a-e},${s} A${e},${e} 0 0 1 ${o+a},${s+e} L${o+a},${s+l-e} A${e},${e} 0 0 1 ${o+a-e},${s+l} L${o},${s+l} Z`;break;case"left":c=`M${o+a},${s} L${o+e},${s} A${e},${e} 0 0 0 ${o},${s+e} L${o},${s+l-e} A${e},${e} 0 0 0 ${o+e},${s+l} L${o+a},${s+l} Z`;break;case"bottom":c=`M${o},${s} L${o+a},${s} L${o+a},${s+l-e} A${e},${e} 0 0 1 ${o+a-e},${s+l} L${o+e},${s+l} A${e},${e} 0 0 1 ${o},${s+l-e} Z`;break;default:c=`M${o},${s+l} L${o},${s+e} A${e},${e} 0 0 1 ${o+e},${s} L${o+a-e},${s} A${e},${e} 0 0 1 ${o+a},${s+e} L${o+a},${s+l} Z`}return(0,yi.jsxs)(ui.Fragment,{children:[r&&(0,yi.jsx)("defs",{children:r}),(0,yi.jsx)("path",{d:c,fill:n,opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})]},i)}return(0,yi.jsxs)(ui.Fragment,{children:[r&&(0,yi.jsx)("defs",{children:r}),(0,yi.jsx)("rect",{x:t.x,y:t.y,width:t.w,height:t.h,fill:n,opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})]},i)}case"point":{const t=e;return(0,yi.jsx)("circle",{cx:t.x,cy:t.y,r:t.r,fill:vi(t.style.fill),opacity:t.style.opacity??.8,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},i)}case"symbol":return xi(e,t,o);case"glyph":return ki(e,e.x,e.y,`${o??""}ord-glyph-${e.pointId??t}`);case"wedge":{const r=e;if(r._gradientBand&&r._gradientBand.colors.length>0){const e=wi(`${o?o+"-":""}gauge-grad-${r.category||i}-${t}`),{clipPath:n,slices:s}=mi({innerRadius:r.innerRadius,outerRadius:r.outerRadius,startAngle:r.startAngle,endAngle:r.endAngle,cornerRadius:r.cornerRadius,roundStart:r.roundedEnds?.start??!0,roundEnd:r.roundedEnds?.end??!0,colors:r._gradientBand.colors});return(0,yi.jsxs)("g",{transform:`translate(${r.cx},${r.cy})`,opacity:r.style.opacity,fillOpacity:r.style.fillOpacity,children:[(0,yi.jsx)("defs",{children:(0,yi.jsx)("clipPath",{id:e,children:(0,yi.jsx)("path",{d:n})})}),(0,yi.jsx)("g",{clipPath:`url(#${e})`,children:s.map((e,t)=>(0,yi.jsx)("path",{d:e.d,fill:vi(e.color)},t))}),r.style.stroke&&"none"!==r.style.stroke&&(0,yi.jsx)("path",{d:n,fill:"none",stroke:r.style.stroke,strokeWidth:r.style.strokeWidth})]},i)}let n;if(r.roundedEnds)n=gi({innerRadius:r.innerRadius,outerRadius:r.outerRadius,startAngle:r.startAngle,endAngle:r.endAngle,cornerRadius:r.cornerRadius,roundStart:r.roundedEnds.start,roundEnd:r.roundedEnds.end});else{const e=(0,di.arc)().innerRadius(r.innerRadius).outerRadius(r.outerRadius).startAngle(r.startAngle+Math.PI/2).endAngle(r.endAngle+Math.PI/2);r.cornerRadius&&e.cornerRadius(r.cornerRadius),n=e(bi)||""}return(0,yi.jsx)("path",{d:n,transform:`translate(${r.cx},${r.cy})`,fill:vi(r.style.fill),stroke:r.style.stroke,strokeWidth:r.style.strokeWidth,opacity:r.style.opacity},i)}case"boxplot":{const t=e,o=t.columnWidth/2;return(0,yi.jsxs)("g","vertical"===t.projection?{children:[(0,yi.jsx)("line",{x1:t.x,y1:t.minPos,x2:t.x,y2:t.maxPos,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,yi.jsx)("rect",{x:t.x-o,y:Math.min(t.q1Pos,t.q3Pos),width:t.columnWidth,height:Math.abs(t.q3Pos-t.q1Pos),fill:vi(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,yi.jsx)("line",{x1:t.x-o,y1:t.medianPos,x2:t.x+o,y2:t.medianPos,stroke:t.style.stroke||"#333",strokeWidth:2}),(0,yi.jsx)("line",{x1:t.x-.5*o,y1:t.minPos,x2:t.x+.5*o,y2:t.minPos,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,yi.jsx)("line",{x1:t.x-.5*o,y1:t.maxPos,x2:t.x+.5*o,y2:t.maxPos,stroke:t.style.stroke||"#333",strokeWidth:1})]}:{children:[(0,yi.jsx)("line",{x1:t.minPos,y1:t.y,x2:t.maxPos,y2:t.y,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,yi.jsx)("rect",{x:Math.min(t.q1Pos,t.q3Pos),y:t.y-o,width:Math.abs(t.q3Pos-t.q1Pos),height:t.columnWidth,fill:vi(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,yi.jsx)("line",{x1:t.medianPos,y1:t.y-o,x2:t.medianPos,y2:t.y+o,stroke:t.style.stroke||"#333",strokeWidth:2}),(0,yi.jsx)("line",{x1:t.minPos,y1:t.y-.5*o,x2:t.minPos,y2:t.y+.5*o,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,yi.jsx)("line",{x1:t.maxPos,y1:t.y-.5*o,x2:t.maxPos,y2:t.y+.5*o,stroke:t.style.stroke||"#333",strokeWidth:1})]},i)}case"violin":{const t=e,o=[(0,yi.jsx)("path",{d:t.pathString,transform:t.translateX||t.translateY?`translate(${t.translateX},${t.translateY})`:void 0,fill:vi(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:t.style.strokeWidth||1},n("path"))];if(t.iqrLine&&t.bounds){const e=t.bounds,r=e.x+e.width/2,i=e.y+e.height/2;e.height>e.width?o.push((0,yi.jsx)("line",{x1:r,y1:t.iqrLine.q1Pos,x2:r,y2:t.iqrLine.q3Pos,stroke:t.style.stroke||"#333",strokeWidth:2},n("iqr")),(0,yi.jsx)("circle",{cx:r,cy:t.iqrLine.medianPos,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},n("med"))):o.push((0,yi.jsx)("line",{x1:t.iqrLine.q1Pos,y1:i,x2:t.iqrLine.q3Pos,y2:i,stroke:t.style.stroke||"#333",strokeWidth:2},n("iqr")),(0,yi.jsx)("circle",{cx:t.iqrLine.medianPos,cy:i,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},n("med")))}return(0,yi.jsx)("g",{children:o},i)}case"connector":return(0,yi.jsx)("line",{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stroke:e.style.stroke||"#999",strokeWidth:e.style.strokeWidth||1,opacity:e.style.opacity??.5},i);case"trapezoid":{const t=e,o=t.points.map(e=>`${e[0]},${e[1]}`).join(" ");return(0,yi.jsx)("polygon",{points:o,fill:vi(t.style.fill,"#999"),opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},i)}default:return null}}(e,t,ct)).filter(Boolean)]})]}),(0,rc.jsx)(Pl,{width:nt,height:it,totalWidth:ot[0],totalHeight:ot[1],margin:rt,scales:o,showAxes:te,showCategoryTicks:oe,oLabel:yt,rLabel:bt,oFormat:vt,rFormat:xt,rTickValues:de,tickLabelEdgeAlign:he,axisExtent:pe,showGrid:we,title:$e,legend:Se,legendHoverBehavior:Ae,legendClickBehavior:Ce,legendHighlightedCategory:Me,legendIsolatedCategories:je,legendPosition:Pe,legendLayout:_e,foregroundGraphics:co(r,yo(Wt.current?.customLayoutOverlays,Qe??null)),annotations:ve,autoPlaceAnnotations:xe,svgAnnotationRules:ke,annotationFrame:0,xAccessor:po,yAccessor:fo,annotationData:go(e?.getData())}),Be&&"radial"===y&&(0,rc.jsx)("div",{style:{position:"absolute",left:rt.left+nt/2,top:rt.top+it/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:Be})]})}return(0,rc.jsxs)("div",{ref:tt,className:"stream-ordinal-frame"+(Ne?" "+Ne:""),role:"group","aria-label":Ge||("string"==typeof $e?$e:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:v?"100%":ot[0],height:x?"100%":ot[1],overflow:"visible"},onKeyDown:no,children:[Ye&&(0,rc.jsx)(gs,{tableId:ct}),Ye&&(0,rc.jsx)(hs,{scene:Wt.current?.scene??[],chartType:o+" chart",tableId:ct,chartTitle:"string"==typeof $e?$e:void 0}),(0,rc.jsx)(fs,{summary:Ve}),(0,rc.jsx)(ms,{hoverPoint:Mt}),(0,rc.jsxs)("div",{role:"img","aria-label":Ge||("string"==typeof $e?$e:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:zt?io:void 0,onMouseLeave:zt?Jt:void 0,onClick:be?eo:void 0,children:[Tt&&(0,rc.jsx)("svg",{style:{position:"absolute",top:0,left:0,width:ot[0],height:ot[1],pointerEvents:"none"},children:(0,rc.jsx)("g",{transform:`translate(${rt.left},${rt.top})`,children:Tt})}),(0,rc.jsx)(Ml,{width:nt,height:it,totalWidth:ot[0],totalHeight:ot[1],margin:rt,scales:Pt,showAxes:te,showGrid:we,rFormat:xt,rTickValues:de,axisExtent:pe}),(0,rc.jsx)("canvas",{ref:kt,"aria-label":Qi(Wt.current?.scene??[],o+" chart"),style:{position:"absolute",top:0,left:0,width:ot[0],height:ot[1]}}),(0,rc.jsx)(Pl,{width:nt,height:it,totalWidth:ot[0],totalHeight:ot[1],margin:rt,scales:Pt,showAxes:te,showCategoryTicks:oe,oLabel:yt,rLabel:bt,oFormat:vt,rFormat:xt,rTickValues:de,axisExtent:pe,showGrid:we,title:$e,legend:Se,legendHoverBehavior:Ae,legendClickBehavior:Ce,legendHighlightedCategory:Me,legendIsolatedCategories:je,legendPosition:Pe,legendLayout:_e,foregroundGraphics:co(Rt,yo(Wt.current?.customLayoutOverlays,Qe??null)),annotations:ve,autoPlaceAnnotations:xe,svgAnnotationRules:ke,annotationFrame:It,xAccessor:po,yAccessor:fo,annotationData:go(Wt.current?.getData()),underlayRendered:!0}),(We||qe)&&"radial"!==y&&(0,rc.jsx)(Il,{width:nt,height:it,totalWidth:ot[0],totalHeight:ot[1],margin:rt,scales:Pt,onBrush:qe||(()=>{})}),Be&&"radial"===y&&(0,rc.jsx)("div",{style:{position:"absolute",left:rt.left+nt/2,top:rt.top+it/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:Be}),Oe?.showBadge&&(0,rc.jsx)(wr,{isStale:Ft,position:Oe.badgePosition}),(0,rc.jsx)(vs,{active:to.current>=0,hoverPoint:Mt,margin:rt,size:ot,shape:oo.current?.shape,width:oo.current?.w,height:oo.current?.h}),lo]})]})}));ic.displayName="StreamOrdinalFrame";var sc=ic,ac=require("react"),lc={weightChange:.1,newEdge:.5,newNode:1,threshold:3,transitionDuration:500},cc={radius:3,opacity:.7,speedMultiplier:1,maxPerEdge:50,spawnRate:.1},uc=class{constructor(e){this.capacity=e,this.particles=Array(e),this._freeIndices=Array(e);for(let t=0;e>t;t++)this.particles[t]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0},this._freeIndices[t]=e-1-t}spawn(e){const t=this._freeIndices.pop();if(void 0===t)return null;const o=this.particles[t];return o.active=!0,o.t=0,o.offset=Math.random()-.5,o.edgeIndex=e,o.x=0,o.y=0,o}step(e,t,o,r){for(let n=0;this.capacity>n;n++){const i=this.particles[n];if(!i.active)continue;const s=o[i.edgeIndex];s&&s.bezier?(i.t+=e*t*(r?r[i.edgeIndex]??1:1)*(s.bezier.circular?.3:1),1>i.t?dc(s.bezier,i.t,i.offset,i):(i.active=!1,this._freeIndices.push(n))):(i.active=!1,this._freeIndices.push(n))}}countForEdge(e){let t=0;for(let o=0;this.capacity>o;o++)this.particles[o].active&&this.particles[o].edgeIndex===e&&t++;return t}clear(){for(let e=0;this.capacity>e;e++)this.particles[e].active=!1;this._freeIndices.length=0;for(let e=this.capacity-1;e>=0;e--)this._freeIndices.push(e)}resize(e){if(this.capacity>=e)return;const t=this.particles;this.particles=Array(e);for(let o=0;e>o;o++)t.length>o?this.particles[o]=t[o]:(this.particles[o]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0},this._freeIndices.push(o));this.capacity=e}};function dc(e,t,o,r){if(e.circular&&e.segments)return void function(e,t,o,r,n){const i=e.length,s=t*i,a=Math.min(Math.floor(s),i-1),l=s-a,[c,u,d,h]=e[a];hc(c,u,d,h,l,n);const p=h.x-c.x,f=h.y-c.y,g=Math.sqrt(p*p+f*f);if(g>.001){const e=p/g;n.x+=-f/g*o*r*2,n.y+=e*o*r*2}}(e.segments,t,o,e.halfWidth,r);if(!e.points)return r.x=0,void(r.y=0);const[n,i,s,a]=e.points;hc(n,i,s,a,t,r);const l=a.x-n.x,c=a.y-n.y,u=Math.sqrt(l*l+c*c);if(u>.001){const t=l/u;r.x+=-c/u*o*e.halfWidth*2,r.y+=t*o*e.halfWidth*2}}function hc(e,t,o,r,n,i){const s=1-n,a=s*s,l=a*s,c=n*n,u=c*n;i.x=l*e.x+3*a*n*t.x+3*s*c*o.x+u*r.x,i.y=l*e.y+3*a*n*t.y+3*s*c*o.y+u*r.y}function pc(e,t){var o=e.get(t);if(!o)throw Error("missing: "+t);return o}function fc(e,t){var o,r=[],n=[],i=[],s={},a=[];function l(e){i[e]=!1,s.hasOwnProperty(e)&&Object.keys(s[e]).forEach(function(t){delete s[e][t],i[t]&&l(t)})}function c(e){var t,r,d=!1;for(n.push(e),i[e]=!0,t=0;a[e].length>t;t++)(r=a[e][t])===o?(u(o,n),d=!0):i[r]||(d=c(r));if(d)l(e);else for(t=0;a[e].length>t;t++){var h=s[r=a[e][t]];h||(s[r]=h={}),h[r]=!0}return n.pop(),d}function u(e,o){var n=[].concat(o).concat(e);t?t(n):r.push(n)}function d(t){!function(t){for(var o=0;e.length>o;o++)o>=t&&e[o]||(e[o]=[]),e[o]=e[o].filter(function(e){return e>=t})}(t);for(var o,r=function(e){for(var t=e.length,o=Array(t),r=Array(t),n=Array(t),i=Array(t),s=Array(t),a=Array(t),l=0;t>l;++l)o[l]=-1,r[l]=0,n[l]=!1,i[l]=0,s[l]=-1,a[l]=[];var c,u=0,d=[],h=[];function p(t){var l=[t],c=[t];for(o[t]=r[t]=u,n[t]=!0,u+=1;c.length>0;){var p=e[t=c[c.length-1]];if(p.length>i[t]){for(var f=i[t];p.length>f;++f){var g=p[f];if(0>o[g]){o[g]=r[g]=u,n[g]=!0,u+=1,l.push(g),c.push(g);break}n[g]&&(r[t]=0|Math.min(r[t],r[g])),0>s[g]||a[t].push(s[g])}i[t]=f}else{if(r[t]===o[t]){var m=[],y=[],b=0;for(f=l.length-1;f>=0;--f){var v=l[f];if(n[v]=!1,m.push(v),y.push(a[v]),b+=a[v].length,s[v]=d.length,v===t){l.length=f;break}}d.push(m);var x=Array(b);for(f=0;y.length>f;f++)for(var k=0;y[f].length>k;k++)x[--b]=y[f][k];h.push(x)}c.pop()}}}for(l=0;t>l;++l)0>o[l]&&p(l);for(l=0;h.length>l;l++){var f=h[l];if(0!==f.length){f.sort(function(e,t){return e-t}),c=[f[0]];for(var g=1;f.length>g;g++)f[g]!==f[g-1]&&c.push(f[g]);h[l]=c}}return{components:d,adjacencyList:h}}(e),n=r.components.filter(function(e){return e.length>1}),i=1/0,s=0;n.length>s;s++)for(var a=0;n[s].length>a;a++)i>n[s][a]&&(i=n[s][a],o=s);var l=n[o];return!!l&&{leastVertex:i,adjList:e.map(function(e,t){return-1===l.indexOf(t)?[]:e.filter(function(e){return-1!==l.indexOf(e)})})}}o=0;for(var h=e.length;h>o;){var p=d(o);if(o=p.leastVertex,a=p.adjList){for(var f=0;a.length>f;f++)for(var g=0;a[f].length>g;g++){var m=a[f][g];i[+m]=!1,s[m]={}}c(o),o+=1}else o=h}return t?void 0:r}function gc(e){return e.y0-e.y1>0?"up":"down"}function mc(e,t){return t(e.source)==t(e.target)}function yc(e){var t=0;e.source.sourceLinks.forEach(function(e){t=e.circular?t+1:t});var o=0;return e.target.targetLinks.forEach(function(e){o=e.circular?o+1:o}),1>=t&&1>=o}function bc(e){return e.target.x0-e.source.x1}function vc(e,t){var o=kc(e),r=bc(t)/Math.tan(o);return"up"==gc(e)?e.y1-r:e.y1+r}function xc(e,t){var o=kc(e),r=bc(t)/Math.tan(o);return"up"==gc(e)?e.y1+r:e.y1-r}function kc(e){var t=Math.abs(e.y1-e.y0);return Math.atan(Math.abs(e.target.x0-e.source.x1)/t)}function wc(e,t){return t(e)}function Sc(e){return Cc(e.source)}function Ac(e){return Cc(e.target)}function Cc(e){return(e.y0+e.y1)/2}function Mc(e){return e.virtual?0:e.value}function jc(e,t){var o=0;e.sourceLinks.forEach(function(e){o=e.circular&&!mc(e,t)?o+1:o});var r=0;return e.targetLinks.forEach(function(e){r=e.circular&&!mc(e,t)?r+1:r}),o+r}function Pc(e){return e.target.depth}function _c(e,t){return e.sourceLinks.length?e.depth:t-1}function Lc(e,t){return e.y0-t.y0}function Rc(e,t){return t.y0-e.y0}function Tc(e,t){return e.y1-t.y1}function Ic(e,t){return t.y1-e.y1}function $c(e,t){return Fc(e.source,t.source)||e.index-t.index}function Nc(e,t){return Fc(e.target,t.target)||e.index-t.index}function Fc(e,t){return e.partOfCycle===t.partOfCycle?e.y0-t.y0:"top"===e.circularLinkType||"bottom"===t.circularLinkType?-1:1}function Bc(e,t){return Dc(e)==Dc(t)?"bottom"==e.circularLinkType?Rc(e,t):Lc(e,t):Dc(t)-Dc(e)}function Dc(e){return e.target.column-e.source.column}function Ec(e,t){return zc(e)==zc(t)}function zc(e){return e.y0-e.y1>0?"up":"down"}var Hc=require("d3-array");function Oc(e,t,o,r,n){let i=e;var s=Math.max(8,.15*(i.y1-i.y0));i.links.forEach(function(e){e.circular&&(e._circularWidth=Math.min(e.width,s))});var a=(0,Hc.min)(i.links,function(e){return e.source.y0});i.links.forEach(function(e){e.circular&&(e.circularPathData={})});var l=i.links.filter(function(e){return e.circular});return l.sort(function(e,t){return t.value-e.value}),l.forEach(function(e,t){e._circularStub=t>=4}),Wc(i.links.filter(function(e){return"top"==e.circularLinkType}),t,o),Wc(i.links.filter(function(e){return"bottom"==e.circularLinkType}),t,o),i.links.forEach(function(e){if(e.circular){if(e.circularPathData.arcRadius=e._circularWidth+r,e.circularPathData.rightNodeBuffer=5,e.circularPathData.leftNodeBuffer=5,e.circularPathData.sourceWidth=e.source.x1-e.source.x0,e.circularPathData.sourceX=e.source.x0+e.circularPathData.sourceWidth,e.circularPathData.targetX=e.target.x0,e.circularPathData.sourceY=e.y0,e.circularPathData.targetY=e.y1,mc(e,t)&&yc(e))e.circularPathData.rightSmallArcRadius=r+e._circularWidth/2,e.circularPathData.rightLargeArcRadius=r+e._circularWidth/2,e.circularPathData.leftSmallArcRadius=r+e._circularWidth/2,e.circularPathData.leftLargeArcRadius=r+e._circularWidth/2,"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=e.source.y1+n+e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius):(e.circularPathData.verticalFullExtent=e.source.y0-n-e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius);else{var s=e.source.column,l=e.circularLinkType,c=i.links.filter(function(e){return e.source.column==s&&e.circularLinkType==l});c.sort("bottom"==e.circularLinkType?Rc:Lc);var u=0;c.forEach(function(t,n){t.circularLinkID==e.circularLinkID&&(e.circularPathData.rightSmallArcRadius=r+e._circularWidth/2+u,e.circularPathData.rightLargeArcRadius=r+e._circularWidth/2+n*o+u),u+=t._circularWidth||t.width}),s=e.target.column,(c=i.links.filter(function(e){return e.target.column==s&&e.circularLinkType==l})).sort("bottom"==e.circularLinkType?Ic:Tc),u=0,c.forEach(function(t,n){t.circularLinkID==e.circularLinkID&&(e.circularPathData.leftSmallArcRadius=r+e._circularWidth/2+u,e.circularPathData.leftLargeArcRadius=r+e._circularWidth/2+n*o+u),u+=t._circularWidth||t.width}),"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=Math.max(i.y1,e.source.y1,e.target.y1)+n+e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius):(e.circularPathData.verticalFullExtent=a-n-e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius)}e.circularPathData.rightInnerExtent=e.circularPathData.sourceX+e.circularPathData.rightNodeBuffer,e.circularPathData.leftInnerExtent=e.circularPathData.targetX-e.circularPathData.leftNodeBuffer,e.circularPathData.rightFullExtent=e.circularPathData.sourceX+e.circularPathData.rightLargeArcRadius+e.circularPathData.rightNodeBuffer,e.circularPathData.leftFullExtent=e.circularPathData.targetX-e.circularPathData.leftLargeArcRadius-e.circularPathData.leftNodeBuffer}e.path=e.circular?function(e){return"top"==e.circularLinkType?"M"+e.circularPathData.sourceX+" "+e.circularPathData.sourceY+" L"+e.circularPathData.rightInnerExtent+" "+e.circularPathData.sourceY+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightSmallArcRadius+" 0 0 0 "+e.circularPathData.rightFullExtent+" "+(e.circularPathData.sourceY-e.circularPathData.rightSmallArcRadius)+" L"+e.circularPathData.rightFullExtent+" "+e.circularPathData.verticalRightInnerExtent+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightLargeArcRadius+" 0 0 0 "+e.circularPathData.rightInnerExtent+" "+e.circularPathData.verticalFullExtent+" L"+e.circularPathData.leftInnerExtent+" "+e.circularPathData.verticalFullExtent+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftLargeArcRadius+" 0 0 0 "+e.circularPathData.leftFullExtent+" "+e.circularPathData.verticalLeftInnerExtent+" L"+e.circularPathData.leftFullExtent+" "+(e.circularPathData.targetY-e.circularPathData.leftSmallArcRadius)+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftSmallArcRadius+" 0 0 0 "+e.circularPathData.leftInnerExtent+" "+e.circularPathData.targetY+" L"+e.circularPathData.targetX+" "+e.circularPathData.targetY:"M"+e.circularPathData.sourceX+" "+e.circularPathData.sourceY+" L"+e.circularPathData.rightInnerExtent+" "+e.circularPathData.sourceY+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightSmallArcRadius+" 0 0 1 "+e.circularPathData.rightFullExtent+" "+(e.circularPathData.sourceY+e.circularPathData.rightSmallArcRadius)+" L"+e.circularPathData.rightFullExtent+" "+e.circularPathData.verticalRightInnerExtent+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightLargeArcRadius+" 0 0 1 "+e.circularPathData.rightInnerExtent+" "+e.circularPathData.verticalFullExtent+" L"+e.circularPathData.leftInnerExtent+" "+e.circularPathData.verticalFullExtent+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftLargeArcRadius+" 0 0 1 "+e.circularPathData.leftFullExtent+" "+e.circularPathData.verticalLeftInnerExtent+" L"+e.circularPathData.leftFullExtent+" "+(e.circularPathData.targetY+e.circularPathData.leftSmallArcRadius)+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftSmallArcRadius+" 0 0 1 "+e.circularPathData.leftInnerExtent+" "+e.circularPathData.targetY+" L"+e.circularPathData.targetX+" "+e.circularPathData.targetY}(e):function(e){var t=e.source.x1,o=e.y0,r=e.target.x0,n=e.y1,i=(t+r)/2;return"M"+t+","+o+"C"+i+","+o+" "+i+","+n+" "+r+","+n}(e)}),i}function Wc(e,t,o){e.sort(Bc);var r=e.filter(function(e){return!e._circularStub});return e.forEach(function(e,n){var i=0;if(e._circularStub)e.circularPathData.verticalBuffer=0;else if(mc(e,t)&&yc(e))e.circularPathData.verticalBuffer=i+e._circularWidth/2;else{for(var s=0;r.length>s;s++){var a=r[s];if(a!==e&&a.circularPathData&&void 0!==a.circularPathData.verticalBuffer&&qc(e,a)){var l=a.circularPathData.verticalBuffer+(a._circularWidth||a.width)/2+o;i=l>i?l:i}}e.circularPathData.verticalBuffer=i+e._circularWidth/2}}),e}function qc(e,t){return e.source.column>=t.target.column&&t.source.column>=e.target.column}var Yc=require("d3-array");function Gc(e){return function(){return e}}function Vc(e){return e.index}function Xc(e){return e.nodes}function Uc(e){return e.links}function Kc(e,t,o){var r=(0,Yc.groups)(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});r.forEach(function(n,i){var s=n.length;if(t)n.sort(t);else if(i>0){var a=new Map;n.forEach(function(e,t){var o,r,n,i=(r=0,n=0,(o=e).targetLinks.forEach(function(e){if(!e.circular){var t=e.value||1;n+=Cc(e.source)*t,r+=t}}),o.sourceLinks.forEach(function(e){if(!e.circular){var t=e.value||1;n+=Cc(e.target)*t,r+=t}}),r>0?n/r:NaN);a.set(e,{bc:i,idx:t})}),n.sort(function(e,t){var o=a.get(e),r=a.get(t),n=o.bc,i=r.bc;if(e.circularLinkType!==t.circularLinkType){if("top"==e.circularLinkType&&"bottom"==t.circularLinkType)return-1;if("bottom"==e.circularLinkType&&"top"==t.circularLinkType)return 1;if("top"==e.circularLinkType)return-1;if("top"==t.circularLinkType)return 1;if("bottom"==e.circularLinkType)return 1;if("bottom"==t.circularLinkType)return-1}return isNaN(n)||isNaN(i)?isNaN(n)?isNaN(i)?o.idx-r.idx:1:-1:n-i})}else n.sort(function(e,t){return e.circularLinkType==t.circularLinkType?jc(t,o)-jc(e,o):"top"==e.circularLinkType&&"bottom"==t.circularLinkType||"top"==e.circularLinkType&&0==t.partOfCycle||0==e.partOfCycle&&"bottom"==t.circularLinkType?-1:0});n.forEach(function(t,n){t.depth==r.length-1&&1==s||0==t.depth&&1==s?(t.y0=e.y1/2-t.value*e.ky,t.y1=t.y0+t.value*e.ky):t.partOfCycle?0==jc(t,o)?(t.y0=e.y1/2+n,t.y1=t.y0+t.value*e.ky):"top"==t.circularLinkType?(t.y0=e.y0+n,t.y1=t.y0+t.value*e.ky):(t.y0=e.y1-t.value*e.ky-n,t.y1=t.y0+t.value*e.ky):0==e.y0||0==e.y1?(t.y0=(e.y1-e.y0)/s*n,t.y1=t.y0+t.value*e.ky):(t.y0=(e.y1-e.y0)/2-s/2+n,t.y1=t.y0+t.value*e.ky)})})}function Qc(e,t,o,r,n,i){var s=(0,Yc.groups)(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});u();for(var a=1,l=i;l>0;--l)c(a*=.99,o),u();function c(t,o){var r=s.length;s.forEach(function(n){var i=n.length,s=n[0].depth;n.forEach(function(n){var a;if(n.sourceLinks.length||n.targetLinks.length)if(n.partOfCycle&&jc(n,o)>0){var l=(0,Yc.mean)(n.sourceLinks,Ac),c=(0,Yc.mean)(n.targetLinks,Sc),u=l&&c?(l+c)/2:l||c;if(u){var d=(u-Cc(n))*t*.3;n.y0+=d,n.y1+=d}}else if(0==s&&1==i)n.y0=e.y1/2-(a=n.y1-n.y0)/2,n.y1=e.y1/2+a/2;else if(s==r-1&&1==i)n.y0=e.y1/2-(a=n.y1-n.y0)/2,n.y1=e.y1/2+a/2;else if(1==n.targetLinks.length&&1==n.targetLinks[0].source.sourceLinks.length)a=n.y1-n.y0,n.y0=n.targetLinks[0].source.y0,n.y1=n.y0+a;else{var h=(0,Yc.mean)(n.sourceLinks,Ac),p=(0,Yc.mean)(n.targetLinks,Sc),f=((h&&p?(h+p)/2:h||p)-Cc(n))*t;n.y0+=f,n.y1+=f}})})}function u(){s.forEach(function(o){var i,s,a,l=e.y0,c=o.length;for(o.sort(t||Fc),a=0;c>a;++a)(s=l-(i=o[a]).y0)>0&&(i.y0+=s,i.y1+=s),l=i.y1+r;if((s=l-r-e.y1)>0)for(l=i.y0-=s,i.y1-=s,a=c-2;a>=0;--a)(s=(i=o[a]).y1+n-l)>0&&(i.y0-=s,i.y1-=s),l=i.y0})}}function Zc(e){e.nodes.forEach(function(e){e.sourceLinks.sort(Nc),e.targetLinks.sort($c)}),e.nodes.forEach(function(e){var t=e.y0,o=t,r=e.y1,n=r;e.sourceLinks.forEach(function(e){e.circular?(e.y0=r-e.width/2,r-=e.width):(e.y0=t+e.width/2,t+=e.width)}),e.targetLinks.forEach(function(e){e.circular?(e.y1=n-e.width/2,n-=e.width):(e.y1=o+e.width/2,o+=e.width)})})}function Jc(){var e=0,t=0,o=1,r=1,n=24,i=8,s=null,a=Vc,l=_c,c=void 0,u=32,d=2,h=Xc,p=Uc;function f(){var f={nodes:h.apply(null,arguments),links:p.apply(null,arguments)};return function(h){h.x0=e,h.y0=t,h.x1=o,h.y1=r,h.py=0,function(e,t){e.nodes.forEach(function(e,t){e.index=t,e.sourceLinks=[],e.targetLinks=[]});var o=function(e,t){var o=new Map;return(0,Yc.group)(e,t).forEach(function(e,t){o.set(t,e[0])}),o}(e.nodes,t);e.links.forEach(function(e,t){e.index=t;var r=e.source,n=e.target;"object"!=typeof r&&(r=e.source=pc(o,r)),"object"!=typeof n&&(n=e.target=pc(o,n)),r.sourceLinks.push(e),n.targetLinks.push(e)})}(h,a),function(e,t){var o=0;if(null==t){for(var r=[],n=0;e.links.length>n;n++){var i=e.links[n],s=i.source.index,a=i.target.index;r[s]||(r[s]=[]),r[a]||(r[a]=[]),-1===r[s].indexOf(a)&&r[s].push(a)}var l=fc(r);l.sort(function(e,t){return e.length-t.length});var c={};for(n=0;l.length>n;n++){var u=l[n].slice(-2);c[u[0]]||(c[u[0]]={}),c[u[0]][u[1]]=!0}e.links.forEach(function(e){var t=e.target.index,r=e.source.index;t===r||c[r]&&c[r][t]?(e.circular=!0,e.circularLinkID=o++):e.circular=!1})}else e.links.forEach(function(e){t(e.source)<t(e.target)?e.circular=!1:(e.circular=!0,e.circularLinkID=o++)})}(h,c),function(e,t){var o=0,r=0;e.links.forEach(function(n){n.circular&&(n.circularLinkType=n.source.circularLinkType||n.target.circularLinkType?n.source.circularLinkType?n.source.circularLinkType:n.target.circularLinkType:r>o?"top":"bottom","top"==n.circularLinkType?o++:r++,e.nodes.forEach(function(e){wc(e,t)!=wc(n.source,t)&&wc(e,t)!=wc(n.target,t)||(e.circularLinkType=n.circularLinkType)}))}),e.links.forEach(function(e){e.circular&&(e.source.circularLinkType==e.target.circularLinkType&&(e.circularLinkType=e.source.circularLinkType),mc(e,t)&&(e.circularLinkType=e.source.circularLinkType))})}(h,a),function(e){e.nodes.forEach(function(e){e.partOfCycle=!1,e.value=Math.max((0,Yc.sum)(e.sourceLinks,Mc),(0,Yc.sum)(e.targetLinks,Mc)),e.sourceLinks.forEach(function(t){t.circular&&(e.partOfCycle=!0,e.circularLinkType=t.circularLinkType)}),e.targetLinks.forEach(function(t){t.circular&&(e.partOfCycle=!0,e.circularLinkType=t.circularLinkType)})})}(h),function(e,t,o){var r,n,i;if(null!=t){e.nodes.sort(function(e,o){return t(e)<t(o)?-1:1});var s=0,a=t(e.nodes[0]);e.nodes.forEach(function(e){s=t(e)==a?s:s+1,a=t(e)==a?a:t(e),e.column=s})}for(r=e.nodes,n=[],i=0;r.length;++i,r=n,n=[])r.forEach(function(e){e.depth=i,e.sourceLinks.forEach(function(e){0>n.indexOf(e.target)&&!e.circular&&n.push(e.target)})});for(r=e.nodes,n=[],i=0;r.length;++i,r=n,n=[])r.forEach(function(e){e.height=i,e.targetLinks.forEach(function(e){0>n.indexOf(e.source)&&!e.circular&&n.push(e.source)})});e.nodes.forEach(function(e){e.column=null==t?o(e,i):e.column})}(h,c,l);var p=i;if(null!==s){var f=(0,Yc.groups)(h.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]}),g=(0,Yc.max)(f,function(e){return e.length});g>1&&(p=Math.max(1,(r-t)*s/(g-1)))}(function(e,t,o){var r=(0,Yc.groups)(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});e.py=t;var n=(0,Yc.min)(r,function(t){return(e.y1-e.y0-(t.length-1)*e.py)/(0,Yc.sum)(t,function(e){return e.value})});e.ky=n,e.links.forEach(function(t){t.width=t.value*e.ky});var i=(0,Yc.max)(e.nodes,function(e){return e.column});e.nodes.forEach(i>0?function(t){t.x0=e.x0+t.column*((e.x1-e.x0-o)/i),t.x1=t.x0+o}:function(t){t.x0=e.x0,t.x1=t.x0+o})})(h,p,n),Kc(h,c,a),Qc(h,c,a,p,p,u),Zc(h),Oc(h,a,d,10,8),Kc(h,c,a),Qc(h,c,a,p,p,u),Zc(h),Oc(h,a,d,10,8),function(e,t){let o=e;o.nodes.forEach(function(e){e.y+(e.y1-e.y0)>o.y1&&(e.y=e.y-(e.y+(e.y1-e.y0)-o.y1));var r=o.links.filter(function(o){return wc(o.source,t)==wc(e,t)}),n=r.length;n>1&&r.sort(function(e,t){if(!e.circular&&!t.circular){if(e.target.column==t.target.column)return e.y1-t.y1;if(!Ec(e,t))return e.y1-t.y1;if(e.target.column>t.target.column){var o=vc(t,e);return e.y1-o}if(t.target.column>e.target.column)return vc(e,t)-t.y1}return e.circular&&!t.circular?"top"==e.circularLinkType?-1:1:t.circular&&!e.circular?"top"==t.circularLinkType?1:-1:e.circular&&t.circular?e.circularLinkType===t.circularLinkType&&"top"==e.circularLinkType?e.target.column===t.target.column?e.target.y1-t.target.y1:t.target.column-e.target.column:e.circularLinkType===t.circularLinkType&&"bottom"==e.circularLinkType?e.target.column===t.target.column?t.target.y1-e.target.y1:e.target.column-t.target.column:"top"==e.circularLinkType?-1:1:void 0});var i=e.y0;r.forEach(function(e){e.y0=i+e.width/2,i+=e.width}),r.forEach(function(t,o){if("bottom"==t.circularLinkType){for(var i=o+1,s=0;n>i;i++)s+=r[i].width;t.y0=e.y1-s-t.width/2}})})}(h,a),function(e,t){let o=e;o.nodes.forEach(function(e){var r=o.links.filter(function(o){return wc(o.target,t)==wc(e,t)}),n=r.length;n>1&&r.sort(function(e,t){if(!e.circular&&!t.circular){if(e.source.column==t.source.column)return e.y0-t.y0;if(!Ec(e,t))return e.y0-t.y0;if(e.source.column>t.source.column){var o=xc(t,e);return e.y0-o}if(t.source.column>e.source.column)return xc(e,t)-t.y0}return e.circular&&!t.circular?"top"==e.circularLinkType?-1:1:t.circular&&!e.circular?"top"==t.circularLinkType?1:-1:e.circular&&t.circular?e.circularLinkType===t.circularLinkType&&"top"==e.circularLinkType?e.source.column===t.source.column?e.source.y1-t.source.y1:e.source.column-t.source.column:e.circularLinkType===t.circularLinkType&&"bottom"==e.circularLinkType?e.source.column===t.source.column?e.source.y1-t.source.y1:t.source.column-e.source.column:"top"==e.circularLinkType?-1:1:void 0});var i=e.y0;r.forEach(function(e){e.y1=i+e.width/2,i+=e.width}),r.forEach(function(t,o){if("bottom"==t.circularLinkType){for(var i=o+1,s=0;n>i;i++)s+=r[i].width;t.y1=e.y1-s-t.width/2}})})}(h,a),function(e){var t=e.nodes,o=e.links,r=!1,n=!1;if(o.forEach(function(e){"top"==e.circularLinkType?r=!0:"bottom"==e.circularLinkType&&(n=!0)}),0==r||0==n){let r=function(t){return(t-i)/(s-i)*(e.y1-e.y0)+e.y0};var i=(0,Yc.min)(t,function(e){return e.y0}),s=(0,Yc.max)(t,function(e){return e.y1}),a=(e.y1-e.y0)/(s-i);1>a?(t.forEach(function(e){e.y0=r(e.y0),e.y1=r(e.y1)}),o.forEach(function(e){e.y0=r(e.y0),e.y1=r(e.y1),e.width=e.width*a})):t.forEach(function(e){var t=e.y1-e.y0,o=r(e.y0)-e.y0;e.y0=r(e.y0),e.y1=e.y0+t,e.sourceLinks.forEach(function(e){e.y0=e.y0+o}),e.targetLinks.forEach(function(e){e.y1=e.y1+o})})}}(h),Oc(h,a,d,10,8)}(f),f}return f.update=function(e){return Zc(e),Oc(e,a,d,10,8),e},f.nodeWidth=function(e){return arguments.length?(n=+e,f):n},f.nodePadding=function(e){return arguments.length?(i=+e,f):i},f.nodePaddingRatio=function(e){return arguments.length?(s=+e,f):s},f.nodes=function(e){return arguments.length?(h="function"==typeof e?e:Gc(e),f):h},f.links=function(e){return arguments.length?(p="function"==typeof e?e:Gc(e),f):p},f.nodeId=function(e){return arguments.length?(a="function"==typeof e?e:Gc(e),f):a},f.nodeAlign=function(e){return arguments.length?(l="function"==typeof e?e:Gc(e),f):l},f.nodeSort=function(e){return arguments.length?(c=e,f):c},f.iterations=function(e){return arguments.length?(u=+e,f):u},f.circularLinkGap=function(e){return arguments.length?(d=+e,f):d},f.extent=function(n){return arguments.length?(e=+n[0][0],t=+n[0][1],o=+n[1][0],r=+n[1][1],f):[[e,t],[o,r]]},f.size=function(n){return arguments.length?(e=t=0,o=+n[0],r=+n[1],f):[o-e,r-t]},f}var eu=require("d3-interpolate");function tu(e){const{sx:t,sTop:o,sBot:r,tx:n,tTop:i,tBot:s,cp1X:a,cp2X:l}=e,c=(o+r)/2,u=(i+s)/2;return{pathD:[`M${t},${o}`,`C${a},${o} ${l},${i} ${n},${i}`,`L${n},${s}`,`C${l},${s} ${a},${r} ${t},${r}`,"Z"].join(" "),bezier:{circular:!1,points:[{x:t,y:c},{x:a,y:c},{x:l,y:u},{x:n,y:u}],halfWidth:(r-o)/2}}}require("d3-shape");var ou=e=>{let t,o,r,n,i,s,a,l,c;if("down"===e.direction)return t=e.y0-e.sankeyWidth/2,o=e.y1-e.sankeyWidth/2,r=e.y1+e.sankeyWidth/2,n=e.y0+e.sankeyWidth/2,i=e.source.x1,s=e.target.x0,a=(0,eu.interpolateNumber)(i,s),l=a(.5),c=a(.5),`M${t},${i}C${t},${l} ${o},${c} ${o},${s}L${r},${s}C${r},${c} ${n},${l} ${n},${i}Z`;const u=e.sankeyWidth/2,d=(0,eu.interpolateNumber)(e.source.x1,e.target.x0),{pathD:h}=tu({sx:e.source.x1,sTop:e.y0-u,sBot:e.y0+u,tx:e.target.x0,tTop:e.y1-u,tBot:e.y1+u,cp1X:d(.5),cp2X:d(.5)});return h};function ru(e){const t=e.sankeyWidth/2,o=(e._circularWidth??e.sankeyWidth)/2,r=e.circularPathData;if(!r)return null;if("down"===e.direction)return null;if(e._circularStub){const o=r.sourceX,n=r.sourceY,i=r.targetX,s=r.targetY;if("object"!=typeof e.source||!e.source||"object"!=typeof e.target||!e.target)return null;const a=Math.max(15,Math.min(40,.33*(r.rightFullExtent-o))),l=Math.max(15,Math.min(40,.33*(i-r.leftFullExtent)));return`M${o},${n-t}L${o+a},${n-t}L${o+a},${n+t}L${o},${n+t}ZM${i},${s-t}L${i-l},${s-t}L${i-l},${s+t}L${i},${s+t}Z`}const n=r.sourceX,i=r.sourceY,s=r.targetX,a=r.targetY,l=r.rightFullExtent,c=r.leftFullExtent,u=r.verticalFullExtent,d="bottom"===e.circularLinkType?1:-1,h=Math.max(4,Math.min(o,15));return`M${n},${i-d*t}L${l},${i-d*t}L${l+o},${i-d*t+d*h}L${l+o},${u+d*o-d*h}L${l+o-h},${u+d*o}L${c-o+h},${u+d*o}L${c-o},${u+d*o-d*h}L${c-o},${a-d*t+d*h}L${c-o+h},${a-d*t}L${s},${a-d*t}L${s},${a+d*t}L${c+o},${a+d*t}L${c+o},${u-d*o}L${l-o},${u-d*o}L${l-o},${i+d*t}L${n},${i+d*t}Z`}var nu=new Set,iu=new WeakMap;function su(e,t){if("production"===process.env.NODE_ENV)return e;if(!e||!e.data||"object"!=typeof e.data)return e;let o=iu.get(e);if(o){const e=o.get(t);if(e)return e}else o=new Map,iu.set(e,o);const r=new Proxy(e,{get(e,o,r){if("string"==typeof o&&!(o in e)&&e.data&&o in e.data){const e=`${t}:${o}`;nu.has(e)||(nu.add(e),console.warn(`[Semiotic] "${t}" callback accessed "${o}" on the wrapper object, but it only exists on ".data". Use d.data.${o} (or d.data?.${o}) instead. Frame callbacks receive RealtimeNode/RealtimeEdge wrappers, not your raw data.`))}return Reflect.get(e,o,r)}});return o.set(t,r),r}var au={left:function(e){return e.depth},right:function(e,t){return t-1-e.height},center:function(e){return e.targetLinks.length?e.depth:e.sourceLinks.length?Math.min.apply(Math,e.sourceLinks.map(Pc))-1:0},justify:_c};function lu(e){return"string"==typeof e?e:e.id}var cu={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,o,r){if(0===e.length)return;const n="vertical"===o.orientation?"down":"right",i=o.nodeAlign||"justify",s=o.nodeWidth??15,a=o.nodePaddingRatio??.05,l=o.iterations??100,c=e.map(e=>({...e})),u=t.map(e=>({...e,source:"string"==typeof e.source?e.source:e.source.id,target:"string"==typeof e.target?e.target:e.target.id,value:Math.sqrt(Math.max(1,e.value||1))}));let d;d="down"===n?[[0,0],[r[1],r[0]]]:[[0,0],[r[0],r[1]]];const h=Jc().extent(d).links(u).nodes(c).nodeAlign(au[i]||_c).nodeId(e=>e.id).nodeWidth(s).iterations(l);h.nodePaddingRatio&&h.nodePaddingRatio(a),h();{let e=1/0,t=-1/0,o=1/0,n=-1/0;for(const r of c)e>r.x0&&(e=r.x0),r.x1>t&&(t=r.x1),o>r.y0&&(o=r.y0),r.y1>n&&(n=r.y1);for(const r of u){if(!r.circular||!r.circularPathData)continue;const i=r.circularPathData,s=(r._circularWidth??r.width??0)/2;e>i.leftFullExtent-s&&(e=i.leftFullExtent-s),i.rightFullExtent+s>t&&(t=i.rightFullExtent+s),o>i.verticalFullExtent-s&&(o=i.verticalFullExtent-s),i.verticalFullExtent+s>n&&(n=i.verticalFullExtent+s)}const i=t-e,s=n-o,a=r[0],l=r[1];if(i>0&&s>0&&(0>e||0>o||t>a||n>l)){const t=Math.min(a/i,l/s),r=-e*t+(a-i*t)/2,n=-o*t+(l-s*t)/2;for(const e of c)e.x0=e.x0*t+r,e.x1=e.x1*t+r,e.y0=e.y0*t+n,e.y1=e.y1*t+n;for(const e of u)if(e.y0=e.y0*t+n,e.y1=e.y1*t+n,e.width=(e.width??0)*t,e._circularWidth&&(e._circularWidth*=t),e.circular&&e.circularPathData){const o=e.circularPathData;o.sourceX=o.sourceX*t+r,o.targetX=o.targetX*t+r,o.sourceY=o.sourceY*t+n,o.targetY=o.targetY*t+n,o.rightFullExtent=o.rightFullExtent*t+r,o.leftFullExtent=o.leftFullExtent*t+r,o.verticalFullExtent=o.verticalFullExtent*t+n,o.rightInnerExtent=o.rightInnerExtent*t+r,o.leftInnerExtent=o.leftInnerExtent*t+r,o.verticalRightInnerExtent=o.verticalRightInnerExtent*t+n,o.verticalLeftInnerExtent=o.verticalLeftInnerExtent*t+n,o.rightSmallArcRadius*=t,o.rightLargeArcRadius*=t,o.leftSmallArcRadius*=t,o.leftLargeArcRadius*=t,o.sourceWidth*=t,o.rightNodeBuffer*=t,o.leftNodeBuffer*=t,o.arcRadius*=t}}}const p=new Map;for(const t of e)p.set(t.id,t);for(const e of c){const t=p.get(e.id);t&&(t.x0=e.x0,t.x1=e.x1,t.y0=e.y0,t.y1=e.y1,t.value=e.value,t.depth=e.depth,t.sourceLinks=e.sourceLinks,t.targetLinks=e.targetLinks,t.width=e.x1-e.x0,t.height=e.y1-e.y0,t.x=e.x0+(e.x1-e.x0)/2,t.y=e.y0+(e.y1-e.y0)/2)}const f=new Map;for(const e of t)f.set(e._edgeKey?e._edgeKey:`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,e);for(const e of u){const t=lu(e.source),o=lu(e.target),r=f.get(e._edgeKey?e._edgeKey:`${t}\0${o}`);if(r){r.y0=e.y0,r.y1=e.y1,r.sankeyWidth=e.width??0,r.circular=!!e.circular,r.circularPathData=e.circularPathData,r._circularWidth=e._circularWidth,r._circularStub=e._circularStub,r.path=e.path,r.circularLinkType=e.circularLinkType,r.direction=n;const i=p.get(t),s=p.get(o);i&&(r.source=i),s&&(r.target=s)}}},buildScene(e,t,o,r){const n="vertical"===o.orientation?"down":"right",i=o.nodeStyle,s=o.edgeStyle,a=o.edgeOpacity??.5,l=o.edgeColorBy||"source",c=Array.isArray(o.colorScheme)?o.colorScheme:o.themeCategorical&&o.themeCategorical.length>0?o.themeCategorical:ge,u=new Map;e.forEach((e,t)=>{u.set(e.id,c[t%c.length])});const d=[],h=[],p=[],f=new Map;for(const t of e){const e=t.x1-t.x0,o=t.y1-t.y0;if(0>=e||0>=o)continue;const r=i?i(su(t,"nodeStyle")):{},s={fill:r.fill||u.get(t.id)||"#4d430c",stroke:r.stroke,strokeWidth:r.strokeWidth,opacity:r.opacity};f.set(t.id,("string"==typeof s.fill?s.fill:null)||u.get(t.id)||"#4d430c"),d.push("down"===n?{type:"rect",x:t.y0,y:t.x0,w:o,h:e,style:s,datum:t,id:t.id,label:t.id}:{type:"rect",x:t.x0,y:t.y0,w:e,h:o,style:s,datum:t,id:t.id,label:t.id})}const g=[...t].sort((e,t)=>(t.sankeyWidth||0)-(e.sankeyWidth||0));for(const e of g){if(!e.sankeyWidth||0>=e.sankeyWidth)continue;const t="object"==typeof e.source?e.source:null,r="object"==typeof e.target?e.target:null;if(!t||!r)continue;let n=o.themeSemantic?.border||o.themeSemantic?.secondary||"#999";n="function"==typeof l?l(e)||n:"target"===l?f.get(r.id)||u.get(r.id)||n:f.get(t.id)||u.get(t.id)||n;const i=s?s(su(e,"edgeStyle")):{};if(e._circularStub&&e.circular&&e.circularPathData){const t=e.circularPathData,o=e.sankeyWidth/2,r=Math.max(15,Math.min(40,.33*(t.rightFullExtent-t.sourceX))),s=Math.max(15,Math.min(40,.33*(t.targetX-t.leftFullExtent))),l=i.fill||n;h.push({type:"bezier",pathD:`M${t.sourceX},${t.sourceY-o}L${t.sourceX+r},${t.sourceY-o}L${t.sourceX+r},${t.sourceY+o}L${t.sourceX},${t.sourceY+o}Z`,style:{fill:l,fillOpacity:i.fillOpacity??a,stroke:"none",opacity:i.opacity},datum:e,_gradient:{direction:"right",from:1,to:0,x0:t.sourceX,x1:t.sourceX+r}}),h.push({type:"bezier",pathD:`M${t.targetX},${t.targetY-o}L${t.targetX-s},${t.targetY-o}L${t.targetX-s},${t.targetY+o}L${t.targetX},${t.targetY+o}Z`,style:{fill:l,fillOpacity:i.fillOpacity??a,stroke:"none",opacity:i.opacity},datum:e,_gradient:{direction:"left",from:0,to:1,x0:t.targetX-s,x1:t.targetX}});continue}let c;(c=e.circular&&e.circularPathData?ru(e):ou(e),c)&&h.push({type:"bezier",pathD:c,bezierCache:e.bezier,style:{fill:i.fill||n,fillOpacity:i.fillOpacity??a,stroke:i.stroke||"none",strokeWidth:i.strokeWidth,opacity:i.opacity},datum:e})}if(!1!==o.showLabels){const t=(m=o.nodeLabel)?"function"==typeof m?m:e=>e[m]||e.id:null;for(const o of e){const e=o.x1-o.x0,i=o.y1-o.y0;if(0>=e||0>=i)continue;const s=t?t(o):o.id;if(!s)continue;let a,l,c;"down"===n?(a=o.y0+(o.y1-o.y0)/2,l=o.x1+14,c="start"):(r[0]/2>o.x0+e/2?(a=o.x0-6,c="end"):(a=o.x1+6,c="start"),l=o.y0+i/2),p.push({x:a,y:l,text:s+"",anchor:"down"===n?"middle":c,baseline:"middle",fontSize:11})}}var m;return{sceneNodes:d,sceneEdges:h,labels:p}}},uu=require("d3-force"),du=require("d3-scale");h();var hu={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,o,r){if(0===e.length)return;const n=o.forceStrength??.1,i=r[0]/2,s=r[1]/2,a=o.__previousPositions;let l=0;const c=[];for(const t of e){const e=null!=t.x&&null!=t.y&&(0!==t.x||0!==t.y),o=a?.get(t.id);e?l++:o?(t.x=o.x,t.y=o.y,l++):c.push(t)}const u=l>0&&.3>=(e.length>0?c.length/e.length:1);if(u){const o=new Map;for(const t of e)o.set(t.id,t);for(const e of c){const r=pu(e.id,t,o);if(r.length>0){let t=0,o=0;for(const e of r)t+=e.x,o+=e.y;const n=fu(e.id),i=n%360*(Math.PI/180),s=10+n%20;e.x=t/r.length+s*Math.cos(i),e.y=o/r.length+s*Math.sin(i)}else{const t=fu(e.id),o=t%360*(Math.PI/180),r=15+t%30;e.x=i+r*Math.cos(o),e.y=s+r*Math.sin(o)}}}else{const t=2.399963229728653;for(let o=0;e.length>o;o++){const r=e[o];if(null==r.x||null==r.y||0===r.x&&0===r.y){const e=10*Math.sqrt(o+.5),n=o*t;r.x=i+e*Math.cos(n),r.y=s+e*Math.sin(n)}}}const d=o.__skipForceSimulation||0===o.iterations?0:u?40:o.iterations??Math.max(50,Math.min(300,Math.floor(300-2*(e.length-30)))),h=gu(o.nodeSize,o.nodeSizeRange,e),p=e=>h(e);if(d>0){const o=new Map,r=new Map;for(const t of e)o.set(t.id,0),r.set(t.id,t);for(const e of t){const t="string"==typeof e.source?e.source:e.source.id,r="string"==typeof e.target?e.target:e.target.id;o.set(t,(o.get(t)??0)+1),o.set(r,(o.get(r)??0)+1)}const a=(0,uu.forceLink)().strength(e=>{const t=e.weight,r="string"==typeof e.target?e.target:e.target.id,i=Math.max(1,Math.min(o.get("string"==typeof e.source?e.source:e.source.id)??1,o.get(r)??1));return Math.min(2.5,(t&&t>0?Math.sqrt(t):1)*n/(.1*i))}).distance(e=>{const t="string"==typeof e.source?r.get(e.source):e.source,o="string"==typeof e.target?r.get(e.target):e.target,n=(t?p(t):0)+(o?p(o):0)+12;return Math.max(40,n)}).id(e=>e.id),l=(0,uu.forceSimulation)().force("charge",(0,uu.forceManyBody)().strength(e=>{const t=o.get(e.id)??0;return-15*p(e)*Math.sqrt(t+1)})).force("collide",(0,uu.forceCollide)(e=>p(e)+3).strength(.9).iterations(2)).force("center",(0,uu.forceCenter)(i,s).strength(.8)).force("x",(0,uu.forceX)(i).strength(.06)).force("y",(0,uu.forceY)(s).strength(.06));if(l.nodes(e),t.length>0){const e=t.map(e=>({...e,source:"string"==typeof e.source?e.source:e.source.id,target:"string"==typeof e.target?e.target:e.target.id}));a.links(e),l.force("link",a)}u?l.alpha(.3):.1>l.alpha()&&l.alpha(1),l.stop();for(let e=0;d>e;++e)l.tick()}for(const t of e){if(null==t.x||null==t.y)continue;const e=p(t);t.x=Math.max(e,Math.min(r[0]-e,t.x)),t.y=Math.max(e,Math.min(r[1]-e,t.y)),t.x0=0,t.x1=0,t.y0=0,t.y1=0}const f=new Map;for(const t of e)f.set(t.id,t);for(const e of t){if("string"==typeof e.source){const t=f.get(e.source);t&&(e.source=t)}if("string"==typeof e.target){const t=f.get(e.target);t&&(e.target=t)}}},buildScene(e,t,o,r){const n=o.nodeStyle,i=o.edgeStyle,s=gu(o.nodeSize,o.nodeSizeRange,e),a=Array.isArray(o.colorScheme)?o.colorScheme:o.themeCategorical&&o.themeCategorical.length>0?o.themeCategorical:ge,l=new Map;e.forEach((e,t)=>{l.set(e.id,a[t%a.length])});const c=[],u=[],d=[];for(const t of e){if(null==t.x||null==t.y)continue;const e=s(su(t,"nodeSize")),r=n?n(su(t,"nodeStyle")):{},i={fill:r.fill||l.get(t.id)||o.themeSemantic?.primary||"#007bff",stroke:r.stroke||o.themeSemantic?.surface||"#fff",strokeWidth:r.strokeWidth??2,opacity:r.opacity};c.push({type:"circle",cx:t.x,cy:t.y,r:e,style:i,datum:t,id:t.id,label:t.id})}const h=new Map;for(const t of e)h.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:h.get(e.source),r="object"==typeof e.target?e.target:h.get(e.target);if(!t||!r)continue;if(null==t.x||null==t.y)continue;if(null==r.x||null==r.y)continue;const n=i?i(su(e,"edgeStyle")):{};u.push({type:"line",x1:t.x,y1:t.y,x2:r.x,y2:r.y,style:{stroke:n.stroke||o.themeSemantic?.border||o.themeSemantic?.secondary||"#999",strokeWidth:n.strokeWidth??1,opacity:n.opacity??.6},datum:e})}if(!1!==o.showLabels){const t=(p=o.nodeLabel)?"function"==typeof p?p:e=>e[p]||e.id:null;for(const o of e){if(null==o.x||null==o.y)continue;const e=t?t(o):o.id;if(!e)continue;const r=s(su(o,"nodeSize"));d.push({x:o.x,y:o.y-r-4,text:e+"",anchor:"middle",baseline:"auto",fontSize:11})}}var p;return{sceneNodes:c,sceneEdges:u,labels:d}}};function pu(e,t,o){const r=[];for(const n of t){const t="string"==typeof n.source?n.source:n.source.id,i="string"==typeof n.target?n.target:n.target.id;let s=null;if(t===e?s=i:i===e&&(s=t),s){const e=o.get(s);!e||0===e.x&&0===e.y||r.push({x:e.x,y:e.y})}}return r}function fu(e){let t=0;for(let o=0;e.length>o;o++)t=(t<<5)-t+e.charCodeAt(o)|0;return Math.abs(t)}function gu(e,t,o){if(o.some(e=>null!=e.__forceRadius))return e=>e.__forceRadius??8;if(null==e)return()=>8;if("number"==typeof e)return()=>e;if("function"==typeof e)return t=>e(t)||8;const r=t||[5,20],n=[];for(const t of o){const o=t.data?.[e];"number"==typeof o&&n.push(o)}if(0===n.length)return()=>r[0];const[i,s]=u(n);if(i===s)return()=>(r[0]+r[1])/2;const a=(0,du.scaleLinear)().domain([i,s]).range(r).clamp(!0);return t=>{const o=t.data?.[e];return null==o||"number"!=typeof o?r[0]:a(o)}}var mu=require("d3-chord"),yu=require("d3-shape"),bu=ge,vu={supportsStreaming:!1,hierarchical:!1,computeLayout(e,t,o,r){if(0===e.length)return;const{padAngle:n=.01,groupWidth:i=20,sortGroups:s}=o,a=Math.min(r[0],r[1])/2,l=a-i,c=r[0]/2,u=r[1]/2,d=(h=o.valueAccessor)?"function"==typeof h?h:e=>e[h]??1:e=>e.value??1;var h;const p=new Map;for(let t=0;e.length>t;t++)p.set(e[t].id,t);const f=e.length,g=Array.from({length:f},()=>Array.from({length:f},()=>0));for(const e of t){const t="string"==typeof e.target?e.target:e.target.id,o=p.get("string"==typeof e.source?e.source:e.source.id),r=p.get(t);if(void 0===o||void 0===r)continue;const n=d(e);g[o][r]=n}const m=(0,mu.chord)().padAngle(n);s&&m.sortGroups(s);const y=m(g),b=y.groups,v=(0,yu.arc)().innerRadius(l).outerRadius(a);for(const t of b){const o=e[t.index],r=v.centroid({innerRadius:l,outerRadius:a,startAngle:t.startAngle,endAngle:t.endAngle});o.x=r[0]+c,o.y=r[1]+u,o.__arcData={startAngle:t.startAngle,endAngle:t.endAngle}}const x=new Map;for(const t of e)x.set(t.id,t);for(const e of t){const t="string"==typeof e.target?e.target:e.target.id,o=x.get("string"==typeof e.source?e.source:e.source.id),r=x.get(t);o&&(e.source=o),r&&(e.target=r)}const k=new Map;for(const e of t)k.set(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,e);for(const t of y){const o=e[t.source.index].id,r=e[t.target.index].id,n=k.get(`${o}\0${r}`)||k.get(`${r}\0${o}`);n&&(n.__chordData=t)}},buildScene(e,t,o,r){const{groupWidth:n=20,edgeOpacity:i=.5}=o,s=Math.min(r[0],r[1])/2,a=s-n,l=r[0]/2,c=r[1]/2,u=o.nodeStyle,d=o.edgeStyle,h=o.edgeColorBy||"source",p=Array.isArray(o.colorScheme)?o.colorScheme:o.themeCategorical&&o.themeCategorical.length>0?o.themeCategorical:bu,f=new Map;e.forEach((e,t)=>{f.set(e.id,p[t%p.length])});const g=(0,mu.ribbon)().radius(a),m=[],y=[],b=[];for(let t=0;e.length>t;t++){const o=e[t],r=o.__arcData;if(!r)continue;let n;n=u?u(su(o,"nodeStyle")).fill||f.get(o.id)||p[t%p.length]:f.get(o.id)||p[t%p.length];const i=u?u(su(o,"nodeStyle")):{};m.push({type:"arc",cx:l,cy:c,innerR:a,outerR:s,startAngle:r.startAngle-Math.PI/2,endAngle:r.endAngle-Math.PI/2,style:{fill:n,stroke:i.stroke||"black",strokeWidth:i.strokeWidth??1,opacity:i.opacity},datum:o,id:o.id,label:o.id})}for(const e of t){const t=e.__chordData;if(!t)continue;const r=g(t);if(!r)continue;const n=xu(r,l,c);let s=o.themeSemantic?.border||o.themeSemantic?.secondary||"#999";if(d)s=d(su(e,"edgeStyle")).fill||s;else{const t="object"==typeof e.source?e.source:null,o="object"==typeof e.target?e.target:null;"target"===h&&o?s=f.get(o.id)||s:t&&(s=f.get(t.id)||s)}const a=d?d(su(e,"edgeStyle")):{};y.push({type:"ribbon",pathD:n,style:{fill:s,fillOpacity:a.fillOpacity??i,stroke:a.stroke||"none",strokeWidth:a.strokeWidth,opacity:a.opacity},datum:e})}if(!1!==o.showLabels){const t=(v=o.nodeLabel)?"function"==typeof v?v:e=>e[v]||e.id:null,r=s+12;for(const o of e){const e=o.__arcData;if(!e)continue;const n=t?t(o):o.id;if(!n)continue;const i=(e.startAngle+e.endAngle)/2,s=i-Math.PI/2;b.push({x:l+Math.cos(s)*r,y:c+Math.sin(s)*r,text:n+"",anchor:i>Math.PI?"end":"start",baseline:"middle",fontSize:11})}}var v;return{sceneNodes:m,sceneEdges:y,labels:b}}};function xu(e,t,o){const r=e.match(/[a-zA-Z]|[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?/g);if(!r)return e;const n=[];let i=0;for(;r.length>i;){const e=r[i];if("M"===e||"L"===e)for(n.push(e),i++;r.length>i&&!isNaN(Number(r[i]));)n.push(Number(r[i])+t+""),i++,r.length>i&&!isNaN(Number(r[i]))&&(n.push(Number(r[i])+o+""),i++);else if("C"===e)for(n.push(e),i++;r.length>i&&!isNaN(Number(r[i]));)for(let e=0;3>e&&r.length>i&&!isNaN(Number(r[i]));e++)n.push(Number(r[i])+t+""),i++,r.length>i&&!isNaN(Number(r[i]))&&(n.push(Number(r[i])+o+""),i++);else if("Q"===e)for(n.push(e),i++;r.length>i&&!isNaN(Number(r[i]));)for(let e=0;2>e&&r.length>i&&!isNaN(Number(r[i]));e++)n.push(Number(r[i])+t+""),i++,r.length>i&&!isNaN(Number(r[i]))&&(n.push(Number(r[i])+o+""),i++);else if("A"===e)for(n.push(e),i++;r.length>i&&!isNaN(Number(r[i]));)n.push(r[i++]),r.length>i&&n.push(r[i++]),r.length>i&&n.push(r[i++]),r.length>i&&n.push(r[i++]),r.length>i&&n.push(r[i++]),r.length>i&&(n.push(Number(r[i])+t+""),i++),r.length>i&&(n.push(Number(r[i])+o+""),i++);else"Z"===e||"z"===e?(n.push(e),i++):(n.push(r[i]),i++)}return n.join(" ")}var ku=require("d3-hierarchy"),wu=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];function Su(e){const[t,o,r]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(e);return.299*t+.587*o+.114*r>150?"#222":"#fff"}function Au(e,t,o){const r=t.nodeIDAccessor;return"function"==typeof r?r(e.data)+"":"string"==typeof r&&void 0!==e.data[r]?e.data[r]+"":void 0!==e.data.name?e.data.name+"":void 0!==e.data.id?e.data.id+"":"node-"+o}function Cu(e){if(!e)return null;if("function"==typeof e){const t=e;return e=>t(e.data??e)}return t=>t.data?.[e]||t[e]||t.id}function Mu(e){return Array.isArray(e.colorScheme)?e.colorScheme:e.themeCategorical&&e.themeCategorical.length>0?e.themeCategorical:wu}function ju(e){return Array.isArray(e.colorScheme)&&e.colorScheme.length>0?e.colorScheme[0]:e.themeSemantic?.primary?e.themeSemantic.primary:e.themeCategorical&&e.themeCategorical.length>0?e.themeCategorical[0]:"#4d430c"}function Pu(e,t,o,r,n){if("horizontal"===n){const n=(e+o)/2;return`M ${e},${t} C ${n},${t} ${n},${r} ${o},${r}`}if("radial"===n){const n=(e+o)/2;return`M ${e},${t} Q ${n},${t} ${n},${(t+r)/2} T ${o},${r}`}{const n=(t+r)/2;return`M ${e},${t} C ${e},${n} ${o},${n} ${o},${r}`}}var _u={supportsStreaming:!1,hierarchical:!0,computeLayout(e,t,o,r){const n=o.__hierarchyRoot;if(!n)return;const i=o.chartType,s=function(e){if(e)return"function"==typeof e?e:t=>t[e]}(o.childrenAccessor),a=o.hierarchySum,l="function"==typeof a?a:"string"==typeof a?e=>Number(e[a])||0:e=>Number(e.value)||0,c=(0,ku.hierarchy)(n,s);c.sum(l),c.sort((e,t)=>(t.value??0)-(e.value??0));const[u,d]=r;switch(i){case"tree":!function(e,t,o,r){const n=t.treeOrientation||"vertical",i=(0,ku.tree)();i.size("horizontal"===n?[r,o]:"radial"===n?[2*Math.PI,Math.min(o,r)/2*.8]:[o,r]),i(e)}(c,o,u,d);break;case"cluster":!function(e,t,o,r){const n=t.treeOrientation||"vertical",i=(0,ku.cluster)();i.size("horizontal"===n?[r,o]:"radial"===n?[2*Math.PI,Math.min(o,r)/2*.8]:[o,r]),i(e)}(c,o,u,d);break;case"treemap":!function(e,t,o,r){const n=t.padding??4,i=t.paddingTop??0,s=(0,ku.treemap)().size([o,r]).tile(ku.treemapBinary).padding(n);i>0&&s.paddingTop(i),s(e)}(c,o,u,d);break;case"circlepack":!function(e,t,o,r){const n=t.padding??4;(0,ku.pack)().size([o,r]).padding(n)(e)}(c,o,u,d);break;case"partition":!function(e,t,o,r){(0,ku.partition)().size([o,r]).padding(t.padding??1)(e)}(c,o,u,d)}const h=c.descendants();e.length=0,t.length=0;const p=new Map;for(let t=0;h.length>t;t++){const r=h[t],n={id:Au(r,o,t),x:0,y:0,x0:0,x1:0,y0:0,y1:0,width:0,height:0,value:r.value??0,depth:r.depth,data:r.data,createdByFrame:!0};"tree"===i||"cluster"===i?Lu(n,r,o):"treemap"===i||"partition"===i?Ru(n,r):"circlepack"===i&&Tu(n,r),n.__hierarchyNode=r,e.push(n),p.set(r,n)}if("tree"===i||"cluster"===i)for(const e of h)if(e.parent){const o=p.get(e.parent),r=p.get(e);o&&r&&t.push({source:o,target:r,value:1,y0:0,y1:0,sankeyWidth:0,data:{depth:e.depth}})}},buildScene(e,t,o,r){const n=o.nodeStyle||(()=>({})),i=o.edgeStyle||(()=>({}));switch(o.chartType){case"tree":case"cluster":return function(e,t,o,r,n,i){const s=[],a=[],l=[],c=o.treeOrientation||"vertical",u="radial"===c,d=r[0]/2,h=r[1]/2,p="number"==typeof(f=o.nodeSize)?f:5;var f;for(const t of e){let e=t.x,r=t.y;u&&(e+=d,r+=h);const i=n(su(t,"nodeStyle"));let a=i.fill||ju(o);if(o.colorByDepth&&void 0!==t.depth){const e=Mu(o);a=e[t.depth%e.length]}s.push({type:"circle",cx:e,cy:r,r:p,style:{fill:a,stroke:i.stroke||o.themeSemantic?.surface||"#fff",strokeWidth:i.strokeWidth??1,opacity:i.opacity},datum:t,id:t.id,label:t.id,depth:t.depth})}const g=o.edgeOpacity??.5;for(const e of t){const t="object"==typeof e.source?e.source:null,r="object"==typeof e.target?e.target:null;if(!t||!r)continue;let n=t.x,s=t.y,l=r.x,p=r.y;u&&(n+=d,s+=h,l+=d,p+=h);const f=Pu(n,s,l,p,c),m=i(su(e,"edgeStyle"));a.push({type:"curved",pathD:f,style:{fill:"none",stroke:m.stroke||o.themeSemantic?.border||o.themeSemantic?.secondary||"#999",strokeWidth:m.strokeWidth??1.5,opacity:m.opacity??g},datum:e})}if(!1!==o.showLabels){const t=Cu(o.nodeLabel);for(const o of e){const e=t?t(o):o.id;if(!e)continue;let r,n,i,s=o.x,a=o.y;if(u&&(s+=d,a+=h),u){const e=s-d,t=a-h,o=Math.sqrt(e*e+t*t);o>0?(r=s+e/o*10,n=a+t/o*10,i=0>e?"end":"start"):(r=s,n=a-12,i="middle")}else"horizontal"===c?(o.data?.children&&0!==o.data.children.length?(r=s-p-6,i="end"):(r=s+p+6,i="start"),n=a):(r=s,n=a+p+14,i="middle");l.push({x:r,y:n,text:e+"",anchor:i,baseline:"middle",fontSize:11})}}return{sceneNodes:s,sceneEdges:a,labels:l}}(e,t,o,r,n,i);case"treemap":case"partition":return function(e,t,o,r){const n=[],i=[];for(const o of e){const e=o.x1-o.x0,i=o.y1-o.y0;if(0>=e||0>=i)continue;const s=r(su(o,"nodeStyle"));let a=s.fill||ju(t);if(t.colorByDepth&&void 0!==o.depth){const e=Mu(t);a=e[o.depth%e.length]}n.push({type:"rect",x:o.x0,y:o.y0,w:e,h:i,style:{fill:a,stroke:s.stroke||t.themeSemantic?.surface||"#fff",strokeWidth:s.strokeWidth??1,opacity:s.opacity},datum:o,id:o.id,label:o.id,depth:o.depth})}if(!1!==t.showLabels){const o=Cu(t.nodeLabel),n=t.labelMode||"leaf",s="partition"===t.chartType;for(const a of e){const e=a.x1-a.x0,l=a.y1-a.y0;if(0>=e||0>=l)continue;const c=!(a.data?.children&&a.data.children.length>0);if(!s){if("leaf"===n&&!c)continue;if("parent"===n&&c)continue}const u=o?o(a):a.id;if(!u)continue;if((c?30:40)>e||(c?16:14)>l)continue;let d=r(su(a,"nodeStyle")).fill||ju(t);if(t.colorByDepth&&void 0!==a.depth){const e=Mu(t);d=e[a.depth%e.length]}const h="string"==typeof d?Su(d):t.themeSemantic?.text??"#000";i.push(c?{x:a.x0+e/2,y:a.y0+l/2,text:u+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,Math.min(e,l)/6)),fill:h}:{x:a.x0+4,y:a.y0+12,text:u+"",anchor:"start",baseline:"auto",fontSize:11,fontWeight:600,fill:h})}}return{sceneNodes:n,sceneEdges:[],labels:i}}(e,o,0,n);case"circlepack":return function(e,t,o,r){const n=[],i=[];for(const o of e){const e=o.__radius??5;if(0>=e)continue;const i=r(su(o,"nodeStyle"));let s=i.fill||ju(t);if(t.colorByDepth&&void 0!==o.depth){const e=Mu(t);s=e[o.depth%e.length]}n.push({type:"circle",cx:o.x,cy:o.y,r:e,style:{fill:s,stroke:i.stroke||t.themeSemantic?.surface||"#fff",strokeWidth:i.strokeWidth??1,opacity:i.opacity??.7},datum:o,id:o.id,label:o.id,depth:o.depth})}if(!1!==t.showLabels){const o=Cu(t.nodeLabel);for(const n of e){const e=n.__radius??5,s=o?o(n):n.id;if(!s)continue;if(15>e)continue;const a=!(n.data?.children&&n.data.children.length>0);let l=r(su(n,"nodeStyle")).fill||ju(t);if(t.colorByDepth&&void 0!==n.depth){const e=Mu(t);l=e[n.depth%e.length]}if(a){const o="string"==typeof l?Su(l):t.themeSemantic?.text??"#000";i.push({x:n.x,y:n.y,text:s+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,e/3)),fill:o})}else i.push({x:n.x,y:n.y-e+14,text:s+"",anchor:"middle",baseline:"hanging",fontSize:Math.min(11,Math.max(8,e/3)),fill:t.themeSemantic?.text||"#000",stroke:t.themeSemantic?.surface||"#fff",strokeWidth:3,paintOrder:"stroke"})}}return{sceneNodes:n,sceneEdges:[],labels:i}}(e,o,0,n);default:return{sceneNodes:[],sceneEdges:[],labels:[]}}}};function Lu(e,t,o){const r=o.treeOrientation||"vertical";if("radial"===r){const o=t.x,r=t.y;e.x=r*Math.cos(o-Math.PI/2),e.y=r*Math.sin(o-Math.PI/2)}else"horizontal"===r?(e.x=t.y,e.y=t.x):(e.x=t.x,e.y=t.y);e.x0=e.x-5,e.x1=e.x+5,e.y0=e.y-5,e.y1=e.y+5,e.width=10,e.height=10}function Ru(e,t){e.x0=t.x0,e.x1=t.x1,e.y0=t.y0,e.y1=t.y1,e.x=(t.x0+t.x1)/2,e.y=(t.y0+t.y1)/2,e.width=t.x1-t.x0,e.height=t.y1-t.y0}function Tu(e,t){const o=t.r??0;e.x=t.x,e.y=t.y,e.x0=t.x-o,e.x1=t.x+o,e.y0=t.y-o,e.y1=t.y+o,e.width=2*o,e.height=2*o,e.__radius=o}var Iu=require("d3-shape");function $u(e){let t=e.__orbitState;return t||(t={metaMap:new Map,startTime:"undefined"!=typeof performance?performance.now():Date.now()},e.__orbitState=t),t}var Nu={sankey:cu,force:hu,chord:vu,tree:_u,cluster:_u,treemap:_u,circlepack:_u,partition:_u,orbit:{supportsStreaming:!1,hierarchical:!0,supportsAnimation:!0,computeLayout(e,t,o,r){const n=o.__hierarchyRoot;n&&function(e,t,o,r,n){const i=function(e){if("function"==typeof e)return e;const t=e||"children";return e=>e[t]||null}(o.childrenAccessor),s=function(e){if("function"==typeof e)return e;const t=e||"name";return e=>(e[t]??"")+""}(o.nodeIDAccessor),a=function(e){if(Array.isArray(e))return e;switch(e){case"solar":return[1];case"atomic":return[2,8];default:return[9999]}}(o.orbitMode),l=o.orbitSize??2.95,c=o.orbitEccentricity??1,u="number"==typeof l?()=>l:l,d="number"==typeof c?()=>c:c,h=$u(o);h.metaMap.clear(),r.length=0,n.length=0;const p=new Map;function f(e){const t=p.get(e)??0;return p.set(e,t+1),0===t?e:`${e}__${t}`}const g=t[0]/2,m=t[1]/2,y=Math.min(t[0],t[1])/2*.85,b=f(s(e));r.push({id:b,x:g,y:m,x0:g,x1:g,y0:m,y1:m,width:0,height:0,value:0,depth:0,data:e}),h.metaMap.set(b,{ring:y,angle:0,depth:0,parentId:null,eccentricity:1}),function e(t,o,l,c,p,g,m){const y=i(t);if(!y?.length)return;const b=y.length;let v=0,x=0,k=0;for(;b>x;)x+=a[Math.min(k,a.length-1)],k++,v++;let w=0;for(let b=0;v>b;b++){const x=a[Math.min(b,a.length-1)],k=y.slice(w,w+x);if(!k.length)break;const S=(b+1)/v,A={id:o,depth:g,data:t,parentId:o},C=m?p/u(A)*S:p*S,M=(0,Iu.pie)().value(e=>{const t=i(e)?.length;return t?4:1}).sort(null)(k),j=d(A);for(let t=0;k.length>t;t++){const i=(M[t].startAngle+M[t].endAngle)/2,a=k[t],u=f(s(a)),d=l+C*Math.sin(i),p=c+C*Math.cos(i)*j;r.push({id:u,x:d,y:p,x0:d,x1:d,y0:p,y1:p,width:0,height:0,value:0,depth:g,data:a}),h.metaMap.set(u,{ring:C,angle:i,depth:g,parentId:o,eccentricity:j}),n.push({source:o,target:u,value:1,y0:0,y1:0,sankeyWidth:0,data:{source:o,target:u}}),e(a,u,d,p,C,g+1,!0)}w+=x}}(e,b,g,m,y,1,!1)}(n,r,o,e,t)},buildScene(e,t,o,r){const n=o.nodeStyle,i=o.nodeSize,s="number"==typeof i?()=>i:"function"==typeof i?i:()=>6,a=[],l=[],c=[];if(!1!==o.orbitShowRings){const t=$u(o),r=new Map;for(const t of e)r.set(t.id,t);const n=new Map;for(const[,e]of t.metaMap){if(!e.parentId)continue;const t=r.get(e.parentId);if(!t)continue;const o=`${e.parentId}:${e.ring}`;n.has(o)||n.set(o,{parentX:t.x,parentY:t.y,ring:e.ring,ecc:e.eccentricity})}const i=48,s={stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1};for(const[,{parentX:e,parentY:t,ring:o,ecc:r}]of n)for(let n=0;i>n;n++){const a=n/i*Math.PI*2,c=(n+1)/i*Math.PI*2;l.push({type:"line",x1:e+o*Math.sin(a),y1:t+o*Math.cos(a)*r,x2:e+o*Math.sin(c),y2:t+o*Math.cos(c)*r,style:s,datum:null})}}for(const t of e){if(null==t.x||null==t.y)continue;const e=s(su(t,"nodeSize")),r=n?n(su(t,"nodeStyle")):{};a.push({type:"circle",cx:t.x,cy:t.y,r:e,style:{fill:r.fill||o.themeSemantic?.primary||"#6366f1",stroke:r.stroke||o.themeSemantic?.surface||"#fff",strokeWidth:r.strokeWidth??1,opacity:r.opacity??(0===(t.depth??0)?1:.85)},datum:t,id:t.id,label:t.id,depth:t.depth})}const u=new Map;for(const t of e)u.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:u.get(e.source),o="object"==typeof e.target?e.target:u.get(e.target);t&&o&&(null!=t.x&&null!=o.x&&l.push({type:"line",x1:t.x,y1:t.y,x2:o.x,y2:o.y,style:{stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1},datum:e}))}if(o.showLabels){const t=o.nodeLabel;for(const o of e){const e=s(su(o,"nodeSize"));if(4>=e)continue;const r="function"==typeof t?t(o):t?o.data?.[t]??o.id:o.id;c.push({x:o.x,y:o.y+e+12,text:r+"",anchor:"middle",fontSize:10,fill:"currentColor"})}}return{sceneNodes:a,sceneEdges:l,labels:c}},tick:(e,t,o,r,n)=>!1!==o.orbitAnimated&&(function(e,t){const o=$u(t),r=t.orbitSpeed??.25,n=t.orbitRevolution??function(e){switch(e){case"decay":return e=>Math.pow(.6,e.depth??0);case"alternate":return e=>{const t=e.depth??0;return(t%2==0?1:-1)/(t+1)};default:return e=>1/((e.depth??0)+1)}}(t.orbitRevolutionStyle),i=(("undefined"!=typeof performance?performance.now():Date.now())-o.startTime)/1e3,s=r*(Math.PI/6),a=new Map;for(const t of e)a.set(t.id,t);for(const t of e){const e=o.metaMap.get(t.id);if(!e||!e.parentId)continue;const r=a.get(e.parentId);if(!r)continue;const l=e.angle+i*s*n({id:t.id,depth:e.depth,data:t.data,parentId:e.parentId});t.x=r.x+e.ring*Math.sin(l),t.y=r.y+e.ring*Math.cos(l)*e.eccentricity,t.x0=t.x,t.x1=t.x,t.y0=t.y,t.y1=t.y}}(e,o),!0)}};function Fu(e){return Nu[e]}var Bu=require("d3-quadtree");function Du(e){return{id:e,x0:0,x1:0,y0:0,y1:0,x:0,y:0,width:0,height:0,value:0,createdByFrame:!0}}function Eu(e){if(!e||"object"!=typeof e)return!1;const t=e;if("boolean"!=typeof t.circular)return!1;if("number"!=typeof t.halfWidth||!Number.isFinite(t.halfWidth))return!1;if(t.circular){if(!Array.isArray(t.segments)||0===t.segments.length)return!1;for(const e of t.segments)if(!zu(e))return!1;return!0}return zu(t.points)}function zu(e){if(!Array.isArray(e)||4!==e.length)return!1;for(const t of e){if(!t||"object"!=typeof t)return!1;const e=t;if("number"!=typeof e.x||!Number.isFinite(e.x))return!1;if("number"!=typeof e.y||!Number.isFinite(e.y))return!1}return!0}var Hu=require("d3-interpolate");var Ou="rgba(34, 197, 94, 0.7)",Wu=2e3,qu=class e{constructor(e){this.nodes=new Map,this.edges=new Map,this.tension=0,this.layoutVersion=0,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this.customLayoutHtmlMarks=[],this._customLayoutDiagnosticsWarned=new Set,this._customRestyle=void 0,this._customRestyleEdge=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this._nodeQuadtree=null,this._maxNodeRadius=0,this._sceneNodesRevision=0,this._nodeQuadtreeRevision=-1,this._nodesArrCache=null,this._edgesArrCache=null,this._arrCacheVersion=-1,this.particlePool=null,this.transition=null,this._hasRenderedOnce=!1,this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,this.lastIngestTime=0,this.nodeTimestamps=new Map,this.edgeTimestamps=new Map,this._decaySortedNodes=null,this._decayAgeMap=null,this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set,this.lastTopologyChangeTime=0,this.previousNodeIds=new Set,this.previousEdgeKeys=new Set,this._networkDecayCache=null,this._lastPositionSnapshot=null,this._stylePaintPending=!1,this.config=e,this.tensionConfig={...lc,...e.tensionConfig},e.showParticles&&("sankey"===e.chartType||e.customNetworkLayout)&&(this.particlePool=new uc(2e3))}updateConfig(e){const t=this.config;t.__orbitState&&(e.__orbitState=t.__orbitState),t.__hierarchyRoot&&(e.__hierarchyRoot=t.__hierarchyRoot),void 0===e.layoutSelection&&null!=t.layoutSelection&&(e.layoutSelection=t.layoutSelection),this.config=e,this.tensionConfig={...lc,...e.tensionConfig},!e.showParticles||"sankey"!==e.chartType&&!e.customNetworkLayout||this.particlePool||(this.particlePool=new uc(2e3))}ingestHierarchy(e,t){this._boundedPrevSnapshot=new Map;for(const[e,t]of this.nodes)0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1||this._boundedPrevSnapshot.set(e,{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this._networkDecayCache=null,this.config.__hierarchyRoot=e,this.runLayout(t),this._boundedPrevSnapshot=null}ingestBounded(e,t,o,r){const{nodeIDAccessor:n="id",sourceAccessor:i="source",targetAccessor:s="target",valueAccessor:a="value"}=this.config,l="function"==typeof n?n:e=>e[n],c="function"==typeof i?i:e=>e[i],u="function"==typeof s?s:e=>e[s],d="function"==typeof a?a:e=>e[a]??1;this._boundedPrevSnapshot=new Map;for(const[e,t]of this.nodes)0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1||this._boundedPrevSnapshot.set(e,{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});this._boundedEdgeSnapshot=new Map;for(const[,e]of this.edges)e.sankeyWidth>0&&this._boundedEdgeSnapshot.set(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,{y0:e.y0,y1:e.y1,sankeyWidth:e.sankeyWidth});this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this._networkDecayCache=null;for(const t of e){const e=l(t)+"";this.nodes.set(e,{...Du(e),data:t})}for(let e=0;t.length>e;e++){const o=t[e],r=c(o)+"",n=u(o)+"",i=d(o),s=null==i?NaN:Number(i),a=Number.isFinite(s)?s:1;this.nodes.has(r)||this.nodes.set(r,{...Du(r),data:o}),this.nodes.has(n)||this.nodes.set(n,{...Du(n),data:o});const l=`${r}\0${n}\0${e}`,h={source:r,target:n,value:a,y0:0,y1:0,sankeyWidth:0,data:o,_edgeKey:l};o&&"object"==typeof o&&Eu(o.bezier)&&(h.bezier=o.bezier),this.edges.set(l,h)}r?.deferLayout||this.runLayout(o)}applyForceLayoutPositions(e,t){for(const[t,o]of Object.entries(e)){const e=this.nodes.get(t);e&&(e.x=o.x,e.y=o.y)}this.config.__skipForceSimulation=!0;try{this.runLayout(t)}finally{this.config.__skipForceSimulation=void 0}}edgeKey(e,t){return`${e}\0${t}`}ingestEdge(e){const{source:t,target:o,value:r}=e,n=0===this.nodes.size;let i=!1;const s=Ue();this.lastIngestTime=s,this._decaySortedNodes=null,this._networkDecayCache=null,this.nodes.has(t)||(this.nodes.set(t,Du(t)),this.nodeTimestamps.set(t,s),this.tension+=this.tensionConfig.newNode,i=!0),this.nodes.has(o)||(this.nodes.set(o,Du(o)),this.nodeTimestamps.set(o,s),this.tension+=this.tensionConfig.newNode,i=!0);const a=this.edgeKey(t,o),l=this.edges.get(a);let c=!1;return l?(l.value+=r,this.edgeTimestamps.set(a,s),this.tension+=this.tensionConfig.weightChange,c=!0):(this.edges.set(a,{source:t,target:o,value:r,y0:0,y1:0,sankeyWidth:0}),this.edgeTimestamps.set(a,s),this.tension+=this.tensionConfig.newEdge,i=!0),n||i||c||this.tension>=this.tensionConfig.threshold}runLayout(e){if(this.config.customNetworkLayout)return this.recordTopologyDiff(),void this.layoutVersion++;const t=Fu(this.config.chartType);if(!t)return;let o=Array.from(this.nodes.values());const r=Array.from(this.edges.values());if(0===o.length&&!t.hierarchical)return;if(this.prepareForRelayout(),t.supportsStreaming&&!t.hierarchical){const e=new Map;for(const t of o)void 0!==t._prevX0?e.set(t.id,{x:(t._prevX0??0)+((t._prevX1??0)-(t._prevX0??0))/2,y:(t._prevY0??0)+((t._prevY1??0)-(t._prevY0??0))/2}):0===t.x&&0===t.y||e.set(t.id,{x:t.x,y:t.y});if(this._lastPositionSnapshot)for(const[t,o]of this._lastPositionSnapshot)e.has(t)||e.set(t,o);this.config.__previousPositions=e.size>0?e:void 0}if(t.computeLayout(o,r,this.config,e),this.config.__previousPositions=void 0,t.hierarchical&&o.length>0){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this._networkDecayCache=null;for(const e of o)this.nodes.set(e.id,e);for(let e=0;r.length>e;e++){const t=r[e],o=t._edgeKey||`${"string"==typeof t.source?t.source:t.source.id}\0${"string"==typeof t.target?t.target:t.target.id}\0${e}`;t._edgeKey=o,this.edges.set(o,t)}const e=this._boundedPrevSnapshot;if(e&&e.size>0)for(const t of this.nodes.values()){const o=e.get(t.id);o&&(t._prevX0=o.x0,t._prevX1=o.x1,t._prevY0=o.y0,t._prevY1=o.y1)}this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,o=Array.from(this.nodes.values())}this.finalizeLayout();const n=new Map;for(const e of this.nodes.values())0===e.x&&0===e.y||n.set(e.id,{x:e.x,y:e.y});this._lastPositionSnapshot=n,this.saveTargetPositions();const i=o.some(e=>void 0!==e._prevX0&&(0!==e._prevX0||0!==e._prevX1||0!==e._prevY0||0!==e._prevY1)),s=this.config.transition?.duration??this.tensionConfig.transitionDuration,a=["sankey","tree","treemap","circlepack","partition"].includes(this.config.chartType);if(!this._hasRenderedOnce&&this.config.introAnimation&&a&&o.length>0&&s>0){const t=e[0]/2,o=e[1]/2;for(const e of this.nodes.values())e._prevX0=t,e._prevX1=t,e._prevY0=o,e._prevY1=o;for(const e of this.edges.values())e._prevY0=o,e._prevY1=o,e._prevSankeyWidth=0,e._introFromZero=!0;this.restorePreviousPositions(),this.transition={startTime:Ue(),duration:s}}else i&&s>0&&(this.restorePreviousPositions(),this.transition={startTime:Ue(),duration:s});this._hasRenderedOnce=!0,this.recordTopologyDiff(),this.layoutVersion++}recordTopologyDiff(){const e=new Set(this.nodes.keys()),t=new Set(this.edges.keys());this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set;for(const t of e)this.previousNodeIds.has(t)||this.addedNodes.add(t);for(const t of this.previousNodeIds)e.has(t)||this.removedNodes.add(t);for(const e of t)this.previousEdgeKeys.has(e)||this.addedEdges.add(e);for(const e of this.previousEdgeKeys)t.has(e)||this.removedEdges.add(e);(this.addedNodes.size>0||this.removedNodes.size>0||this.addedEdges.size>0||this.removedEdges.size>0)&&(this.lastTopologyChangeTime=Ue()),this.previousNodeIds=e,this.previousEdgeKeys=t}setLayoutSelection(e){this.config.layoutSelection=e}snapshotBaseStyles(){this._baseStyles=new WeakMap;for(const e of this.sceneNodes)this._baseStyles.set(e,e.style);for(const e of this.sceneEdges)this._baseStyles.set(e,e.style)}consumeStylePaintPending(){const e=this._stylePaintPending;return this._stylePaintPending=!1,e}restyleScene(e){if(this._customRestyle){const t=this._customRestyle;for(const o of this.sceneNodes){const r=this._baseStyles.get(o)??o.style,n=t(o,e);o.style=n?{...r,...n}:r}}if(this._customRestyleEdge){const t=this._customRestyleEdge;for(const o of this.sceneEdges){const r=this._baseStyles.get(o)??o.style,n=t(o,e);o.style=n?{...r,...n}:r}}this._stylePaintPending=!0}buildScene(e){if(this.config.customNetworkLayout){const t=Array.from(this.nodes.values()),o=Array.from(this.edges.values()),r=sl(this.config.colorScheme,this.config.themeCategorical,ge),n={nodes:t,edges:o,dimensions:{width:e[0],height:e[1],plot:{x:0,y:0,width:e[0],height:e[1]}},theme:{semantic:this.config.themeSemantic??{},categorical:[...r]},resolveColor:al(r,this.config.colorScheme),config:this.config.layoutConfig??{},selection:this.config.layoutSelection??null};let i;try{i=this.config.customNetworkLayout(n)}catch(e){const t=null!==this.lastCustomLayoutResult,o=Ft("network",e,t,this.layoutVersion);this.lastCustomLayoutFailure=o,"production"!==process.env.NODE_ENV&&console.error("[semiotic] customNetworkLayout threw:",e);try{this.config.onLayoutError?.(o)}catch(e){"production"!==process.env.NODE_ENV&&console.error("[semiotic] onLayoutError threw:",e)}return void(t||(this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.customLayoutOverlays=null,this.customLayoutHtmlMarks=[],this.lastCustomLayoutResult=null,this._customRestyle=void 0,this._customRestyleEdge=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this._sceneNodesRevision++))}return this.sceneNodes=i.sceneNodes??[],this.sceneEdges=i.sceneEdges??[],this.labels=i.labels??[],this.customLayoutOverlays=i.overlays??null,this.customLayoutHtmlMarks=i.htmlMarks??[],this.lastCustomLayoutResult=i,this.lastCustomLayoutFailure=null,this._sceneNodesRevision++,this._customRestyle=i.restyle,this._customRestyleEdge=i.restyleEdge,this.hasCustomRestyle=!(!i.restyle&&!i.restyleEdge),this.hasCustomRestyle&&(this.snapshotBaseStyles(),this.restyleScene(this.config.layoutSelection??null)),void It({label:"customNetworkLayout",nodes:this.sceneNodes,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned})}this._customRestyle=void 0,this._customRestyleEdge=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.customLayoutOverlays=null,this.customLayoutHtmlMarks=[],this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null;const t=Fu(this.config.chartType);if(!t)return void this._sceneNodesRevision++;const o=t.hierarchical?Array.from(this.nodes.values()):this.nodesArray,r=t.hierarchical?Array.from(this.edges.values()):this.edgesArray,{sceneNodes:n,sceneEdges:i,labels:s}=t.buildScene(o,r,this.config,e);this.sceneNodes=n,this.sceneEdges=i,this.labels=s,this._sceneNodesRevision++}rebuildNodeQuadtree(){let t=0,o=0;for(const e of this.sceneNodes)"circle"===e.type&&(t++,e.r>o&&(o=e.r));if(this._maxNodeRadius=o,e.QUADTREE_THRESHOLD>=t)return void(this._nodeQuadtree=null);const r=Array(t);let n=0;for(const e of this.sceneNodes)"circle"===e.type&&(r[n++]=e);this._nodeQuadtree=(0,Bu.quadtree)().x(e=>e.cx).y(e=>e.cy).addAll(r)}get nodeQuadtree(){return this._nodeQuadtreeRevision!==this._sceneNodesRevision&&(this.rebuildNodeQuadtree(),this._nodeQuadtreeRevision=this._sceneNodesRevision),this._nodeQuadtree}get maxNodeRadius(){return this._maxNodeRadius}_ensureArrays(){this._arrCacheVersion===this.layoutVersion&&this._nodesArrCache&&this._edgesArrCache||(this._nodesArrCache=Array.from(this.nodes.values()),this._edgesArrCache=Array.from(this.edges.values()),this._arrCacheVersion=this.layoutVersion)}get nodesArray(){return this._ensureArrays(),this._nodesArrCache}get edgesArray(){return this._ensureArrays(),this._edgesArrCache}get isAnimating(){const e=Fu(this.config.chartType);return!!e?.supportsAnimation&&!1!==this.config.orbitAnimated}tickAnimation(e,t){const o=Fu(this.config.chartType);if(!o?.tick)return!1;const r=o.hierarchical?Array.from(this.nodes.values()):this.nodesArray,n=o.hierarchical?Array.from(this.edges.values()):this.edgesArray;return o.tick(r,n,this.config,e,t)}cancelIntroAnimation(){this.transition=null;for(const e of this.nodes.values())e._prevX0=void 0,e._prevX1=void 0,e._prevY0=void 0,e._prevY1=void 0;for(const e of this.edges.values())e._prevY0=void 0,e._prevY1=void 0,e._prevSankeyWidth=void 0,e._introFromZero=!1}advanceTransition(e){if(!this.transition)return!1;const t=Ve(e,this.transition),o=Ge(t);for(const e of this.nodes.values())void 0===e._targetX0||void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=Xe(e._prevX0,e._targetX0,o),e.x1=Xe(e._prevX1,e._targetX1,o),e.y0=Xe(e._prevY0,e._targetY0,o),e.y1=Xe(e._prevY1,e._targetY1,o));for(const e of this.edges.values())void 0!==e._targetY0&&void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&(e._prevSankeyWidth>0||e._introFromZero)&&(e.y0=Xe(e._prevY0,e._targetY0,o),e.y1=Xe(e._prevY1,e._targetY1,o),e.sankeyWidth=Xe(e._prevSankeyWidth,e._targetSankeyWidth,o));return this.rebuildAllBeziers(),1>t||(this.snapToTargets(),this.transition=null,!1)}prepareForRelayout(){const e=this._boundedPrevSnapshot;for(const t of this.nodes.values()){const o=e?.get(t.id);o&&0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1?(t._prevX0=o.x0,t._prevX1=o.x1,t._prevY0=o.y0,t._prevY1=o.y1):(t._prevX0=t.x0,t._prevX1=t.x1,t._prevY0=t.y0,t._prevY1=t.y1)}const t=this._boundedEdgeSnapshot;for(const e of this.edges.values()){if(t&&0===e.sankeyWidth){const o=t.get(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`);if(o){e._prevY0=o.y0,e._prevY1=o.y1,e._prevSankeyWidth=o.sankeyWidth;continue}}e._prevY0=e.y0,e._prevY1=e.y1,e._prevSankeyWidth=e.sankeyWidth}this.nodes.size>0&&(this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null)}finalizeLayout(){const e="vertical"===this.config.orientation?"down":"right";for(const e of this.nodes.values())if(0!==e.x0||0!==e.x1||0!==e.y0||0!==e.y1)e.width=e.x1-e.x0,e.height=e.y1-e.y0,e.x=e.x0+e.width/2,e.y=e.y0+e.height/2;else{const t=5;e.x0=e.x-t,e.x1=e.x+t,e.y0=e.y-t,e.y1=e.y+t,e.width=2*t,e.height=2*t}for(const t of this.edges.values())t.direction=e,this.updateEdgeBezier(t);this.tension=0}saveTargetPositions(){for(const e of this.nodes.values())e._targetX0=e.x0,e._targetX1=e.x1,e._targetY0=e.y0,e._targetY1=e.y1;for(const e of this.edges.values())e._targetY0=e.y0,e._targetY1=e.y1,e._targetSankeyWidth=e.sankeyWidth}restorePreviousPositions(){for(const e of this.nodes.values())void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=e._prevX0,e.x1=e._prevX1,e.y0=e._prevY0,e.y1=e._prevY1);for(const e of this.edges.values())void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&e._prevSankeyWidth>0&&(e.y0=e._prevY0,e.y1=e._prevY1,e.sankeyWidth=e._prevSankeyWidth);this.rebuildAllBeziers()}snapToTargets(){for(const e of this.nodes.values())void 0!==e._targetX0&&(e.x0=e._targetX0,e.x1=e._targetX1,e.y0=e._targetY0,e.y1=e._targetY1);for(const e of this.edges.values())void 0!==e._targetY0&&(e.y0=e._targetY0,e.y1=e._targetY1,e.sankeyWidth=e._targetSankeyWidth),e._introFromZero=void 0;this.rebuildAllBeziers()}updateEdgeBezier(e){!function(e,t,o=.5){const r="string"==typeof e.source?t.get(e.source):e.source,n="string"==typeof e.target?t.get(e.target):e.target;!r||!n||(e.bezier=e.circular&&e.circularPathData?function(e){const t=(e._circularWidth||e.sankeyWidth||1)/2,o=e.circularPathData;if(!o)throw Error("buildCircularBezier requires circularPathData");if(e._circularStub){const e=Math.max(15,Math.min(40,.33*(o.rightFullExtent-o.sourceX))),r=Math.max(15,Math.min(40,.33*(o.targetX-o.leftFullExtent)));return{circular:!0,segments:[[{x:o.sourceX,y:o.sourceY},{x:o.sourceX+.33*e,y:o.sourceY},{x:o.sourceX+.66*e,y:o.sourceY},{x:o.sourceX+e,y:o.sourceY}],[{x:o.targetX-r,y:o.targetY},{x:o.targetX-.66*r,y:o.targetY},{x:o.targetX-.33*r,y:o.targetY},{x:o.targetX,y:o.targetY}]],halfWidth:t}}let r;r="down"===e.direction?[{x:o.sourceY,y:o.sourceX},{x:o.sourceY,y:o.rightFullExtent},{x:o.verticalFullExtent,y:o.rightFullExtent},{x:o.verticalFullExtent,y:o.leftFullExtent},{x:o.targetY,y:o.leftFullExtent},{x:o.targetY,y:o.targetX}]:[{x:o.sourceX,y:o.sourceY},{x:o.rightFullExtent,y:o.sourceY},{x:o.rightFullExtent,y:o.verticalFullExtent},{x:o.leftFullExtent,y:o.verticalFullExtent},{x:o.leftFullExtent,y:o.targetY},{x:o.targetX,y:o.targetY}];const n=[];for(let e=0;r.length-1>e;e++){const t=r[e],o=r[e+1],i=o.x-t.x,s=o.y-t.y;n.push([t,{x:t.x+i/3,y:t.y+s/3},{x:t.x+2*i/3,y:t.y+2*s/3},o])}return{circular:!0,segments:n,halfWidth:t}}(e):function(e,t,o,r=.5){const n=(e.sankeyWidth||1)/2;if("down"===e.direction){const i=t.x1,s=o.x0,a=(0,Hu.interpolateNumber)(i,s);return{circular:!1,points:[{x:e.y0,y:i},{x:e.y0,y:a(r)},{x:e.y1,y:a(1-r)},{x:e.y1,y:s}],halfWidth:n}}const i=t.x1,s=o.x0,a=(0,Hu.interpolateNumber)(i,s);return{circular:!1,points:[{x:i,y:e.y0},{x:a(r),y:e.y0},{x:a(1-r),y:e.y1},{x:s,y:e.y1}],halfWidth:n}}(e,r,n,o))}(e,this.nodes,.5)}rebuildAllBeziers(){for(const e of this.nodes.values())e.width=e.x1-e.x0,e.height=e.y1-e.y0,e.x=e.x0+e.width/2,e.y=e.y0+e.height/2;for(const e of this.edges.values())this.updateEdgeBezier(e)}applyPulse(e){!function(e){const t=e.pulse;if(!t)return;const o=t.duration??500,r=t.color??"rgba(255,255,255,0.6)",n=t.glowRadius??4,{now:i}=e;for(const t of e.sceneNodes){const s=t.id;if(!s)continue;const a=e.nodeTimestamps.get(s);if(!a)continue;const l=i-a;o>l&&(t._pulseIntensity=1-l/o,t._pulseColor=r,t._pulseGlowRadius=n)}for(const t of e.sceneEdges){const n=t.datum;if(!n)continue;const s="object"==typeof n.source?n.source?.id:n.source,a="object"==typeof n.target?n.target?.id:n.target;if(!s||!a)continue;const l=e.edgeTimestamps.get(`${s}\0${a}`);if(!l)continue;const c=i-l;o>c&&(t._pulseIntensity=1-c/o,t._pulseColor=r)}}({sceneNodes:this.sceneNodes,sceneEdges:this.sceneEdges,nodeTimestamps:this.nodeTimestamps,edgeTimestamps:this.edgeTimestamps,pulse:this.config.pulse,now:e})}applyDecay(){this._networkDecayCache||(this._networkDecayCache={sortedNodes:null,ageMap:null}),this._decaySortedNodes||(this._networkDecayCache.sortedNodes=null,this._networkDecayCache.ageMap=null),function(e){const t=e.decay;if(!t)return;const o=e.nodeTimestamps.size;if(1>=o)return;if(!e.cache.sortedNodes){e.cache.sortedNodes=Array.from(e.nodeTimestamps.entries()).sort((e,t)=>e[1]-t[1]);const t=new Map;for(let o=0;e.cache.sortedNodes.length>o;o++)t.set(e.cache.sortedNodes[o][0],o);e.cache.ageMap=t}const r=e.cache.ageMap;for(const n of e.sceneNodes){const e=n.id;if(!e)continue;const i=r.get(e);if(void 0===i)continue;const s=nt(t,i,o);n.style={...n.style,opacity:(n.style?.opacity??1)*s}}}({sceneNodes:this.sceneNodes,nodeTimestamps:this.nodeTimestamps,decay:this.config.decay,cache:this._networkDecayCache}),this._decaySortedNodes=this._networkDecayCache.sortedNodes,this._decayAgeMap=this._networkDecayCache.ageMap}applyTopologyDiff(e){!function(e){for(const t of e.sceneNodes)t._pulseColor===Ou&&(t._pulseIntensity=0,t._pulseColor=void 0,t._pulseGlowRadius=void 0);if(0===e.addedNodes.size)return;const t=e.now-e.lastTopologyChangeTime;if(t>=Wu)return;const o=1-t/Wu;for(const t of e.sceneNodes){const r=t.id;r&&e.addedNodes.has(r)&&(t._pulseIntensity=Math.max(t._pulseIntensity??0,o),t._pulseColor=Ou,t._pulseGlowRadius=8)}}({sceneNodes:this.sceneNodes,addedNodes:this.addedNodes,lastTopologyChangeTime:this.lastTopologyChangeTime,now:e})}get hasActiveTopologyDiff(){return function(e,t,o=("undefined"!=typeof performance?performance.now():Date.now())){return 0!==e.size&&Wu>o-t}(this.addedNodes,this.lastTopologyChangeTime)}applyThresholds(e){!function(e){const t=e.thresholds;if(!t)return;const o=t.warningColor??"#f59e0b",r=t.criticalColor??"#ef4444",n=!1!==t.pulse;for(const i of e.sceneNodes){const s=i.id;if(!s)continue;const a=e.nodes.get(s);if(!a)continue;const l=t.metric(a);let c=null;void 0===t.critical||t.critical>l?void 0===t.warning||t.warning>l||(c=o):c=r,c&&(i.style={...i.style,fill:c},n&&(i._pulseIntensity=.6+.4*Math.sin(e.now/300),i._pulseColor=c,i._pulseGlowRadius=6))}}({sceneNodes:this.sceneNodes,nodes:this.nodes,thresholds:this.config.thresholds,now:e})}get hasActiveThresholds(){return function(e,t){if(!t)return!1;for(const o of e){const e=t.metric(o);if(void 0!==t.warning&&e>=t.warning||void 0!==t.critical&&e>=t.critical)return!0}return!1}(this.nodes.values(),this.config.thresholds)}get hasActivePulses(){return function(e){const t=e.pulse;if(!t||0===e.lastIngestTime)return!1;const o=e.now??("undefined"!=typeof performance?performance.now():Date.now());return(t.duration??500)>o-e.lastIngestTime}({pulse:this.config.pulse,lastIngestTime:this.lastIngestTime})}getLayoutData(){return{nodes:Array.from(this.nodes.values()),edges:Array.from(this.edges.values())}}updateNode(e,t){const o=this.nodes.get(e);if(!o)return null;const r=o.data?{...o.data}:{};return o.data=t(o.data??{}),this.layoutVersion++,this.lastIngestTime=Ue(),r}updateEdge(e,t,o){const r=this.config.valueAccessor,n="function"==typeof r?r:r?e=>e[r]:e=>e.value,i=[];for(const[,r]of this.edges)if(("string"==typeof r.source?r.source:r.source.id)===e&&("string"==typeof r.target?r.target:r.target.id)===t){i.push(r.data?{...r.data}:{}),r.data=o(r.data??{});const e=n(r.data);null!=e&&(r.value=Number(e))}return i.length>0&&(this.layoutVersion++,this.lastIngestTime=Ue()),i}removeNode(e){if(!this.nodes.has(e))return!1;this.nodes.delete(e),this.nodeTimestamps.delete(e);for(const[t,o]of this.edges)("string"==typeof o.source?o.source:o.source.id)!==e&&("string"==typeof o.target?o.target:o.target.id)!==e||(this.edges.delete(t),this.edgeTimestamps.delete(t));return this.layoutVersion++,this.lastIngestTime=Ue(),!0}removeEdge(e,t){const o=[];if(void 0===t){const t=this.config.edgeIdAccessor;if(!t)throw Error("removeEdge(edgeId) requires edgeIdAccessor to be configured. Use removeEdge(sourceId, targetId) instead.");const r="function"==typeof t?t:e=>e?.[t];for(const[t,n]of this.edges)n.data&&r(n.data)===e&&o.push(t)}else for(const[r,n]of this.edges)("string"==typeof n.source?n.source:n.source.id)===e&&("string"==typeof n.target?n.target:n.target.id)===t&&o.push(r);for(const e of o)this.edges.delete(e),this.edgeTimestamps.delete(e);return o.length>0&&(this.layoutVersion++,this.lastIngestTime=Ue()),o.length>0}clear(){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this._networkDecayCache=null,this._decayAgeMap=null,this._nodeQuadtree=null,this._nodesArrCache=null,this._edgesArrCache=null,this._sceneNodesRevision++,this.tension=0,this.layoutVersion++,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.customLayoutOverlays=null,this.customLayoutHtmlMarks=[],this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this._customRestyleEdge=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.transition=null,this._hasRenderedOnce=!1,this.lastIngestTime=0,this._lastPositionSnapshot=null,this.nodeTimestamps.clear(),this.edgeTimestamps.clear(),this.previousNodeIds=new Set,this.previousEdgeKeys=new Set,this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set,this.lastTopologyChangeTime=0,this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,this.particlePool&&this.particlePool.clear()}};qu.QUADTREE_THRESHOLD=500;var Yu=qu,Gu=c(require("react")),Vu=require("react/jsx-runtime");function Xu(e){const{width:t,height:o,totalWidth:r,totalHeight:n,margin:i,labels:s,title:a,legend:l,legendHoverBehavior:c,legendClickBehavior:u,legendHighlightedCategory:d,legendIsolatedCategories:h,legendPosition:p="right",legendLayout:f,foregroundGraphics:g,sceneNodes:m,annotations:y,autoPlaceAnnotations:b,svgAnnotationRules:v}=e,x=Gu.useMemo(()=>{const e=(m||[]).flatMap(e=>{const t=function(e){if("glyph"===e.type&&e.glyph&&"number"==typeof e.size){const t=e.cx??e.x,o=e.cy??e.y;if("number"!=typeof t||"number"!=typeof o)return null;const r=Io(e.glyph,e.size);return{x:t+r.centerDx,y:o+r.centerDy,r:Math.max(1,r.radius)}}const t=e.cx??(null!=e.x&&null!=e.w?e.x+e.w/2:e.x),o=e.cy??(null!=e.y&&null!=e.h?e.y+e.h/2:e.y);return"number"!=typeof t||"number"!=typeof o?null:{x:t,y:o,r:"number"==typeof e.r?Math.max(1,e.r):"number"==typeof e.outerR?Math.max(1,e.outerR):"number"==typeof e.size?Math.max(1,Lt(e.size)):Math.max(1,e.w??0,e.h??0)/2}}(e),o=function(e){const t=e.id??e.datum?.id??e.datum?.data?.id??e.datum?.data?.name;return null==t?void 0:t+""}(e);return t?[{pointId:o,...t}]:[]});return{scales:null,width:t,height:o,frameType:"network",pointNodes:e,sceneNodes:m}},[o,m,t]),k=Gu.useMemo(()=>y&&b?Hn({annotations:y,context:x,..."object"==typeof b?b:{}}):y,[y,b,x]),w=Gu.useMemo(()=>wn(),[]),S=k?kn(k.filter(e=>"widget"!==e.type),w,v,x):null,A=!0===k?.some(e=>"widget"===e.type&&!0===e._annotationDeferred);return(0,Vu.jsxs)(Vu.Fragment,{children:[A&&(0,Vu.jsx)("style",{children:fn},"annotation-widget-disclosure-style"),(0,Vu.jsxs)("svg",{role:"img",width:r,height:n,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[(0,Vu.jsx)("title",{children:"string"==typeof a?a:"Network Chart"}),(0,Vu.jsx)("desc",{children:"string"==typeof a?a+" — network data visualization":"Network data visualization"}),(0,Vu.jsxs)("g",{transform:`translate(${i.left},${i.top})`,children:[s.map((e,t)=>(0,Vu.jsx)("text",{x:e.x,y:e.y,textAnchor:e.anchor||"start",dominantBaseline:e.baseline||"middle",fontSize:e.fontSize||11,fontWeight:e.fontWeight,fill:e.fill||"var(--semiotic-text, #333)",stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:e.paintOrder,style:{pointerEvents:"none"},children:e.text},"label-"+t)),S,g]}),a&&"string"==typeof a?(0,Vu.jsx)("text",{x:r/2,y:16,textAnchor:"middle",fontWeight:600,fill:"currentColor",className:"semiotic-chart-title",style:{fontSize:"var(--semiotic-title-font-size, 14px)"},children:a}):a?(0,Vu.jsx)("foreignObject",{x:0,y:0,width:r,height:i.top,children:a}):null,Hr({legend:l,totalWidth:r,totalHeight:n,margin:i,legendPosition:p,title:a,legendLayout:f,legendHoverBehavior:c,legendClickBehavior:u,legendHighlightedCategory:d,legendIsolatedCategories:h})]}),k?.filter(e=>"widget"===e.type&&e.nodeId&&m).map((e,t)=>{const o=!0===e._annotationDeferred,r=m.find(t=>t.id===e.nodeId||t.datum?.id===e.nodeId||t.datum?.data?.id===e.nodeId||t.datum?.data?.name===e.nodeId);if(!r)return null;const n=e.width??32,s=e.height??32;return(0,Vu.jsx)("div",{className:o?"annotation-deferred":void 0,"data-annotation-disclosure":o?"deferred":void 0,style:{position:"absolute",left:i.left+(r.cx??(null!=r.x&&null!=r.w?r.x+r.w/2:r.x??0))+(e.dx??0)-n/2,top:i.top+(r.cy??(null!=r.y&&null!=r.h?r.y+r.h/2:r.y??0))+(e.dy??-16)-s/2,width:n,height:s,display:"flex",alignItems:"center",justifyContent:"center",zIndex:5},children:e.content??(0,Vu.jsx)("span",{style:{fontSize:18,cursor:"default"},children:"ℹ️"})},"widget-"+t)})]})}Xu.displayName="NetworkSVGOverlay";var Uu=c(require("react")),Ku=require("react/jsx-runtime"),Qu={position:"absolute",top:0,left:0,pointerEvents:"none"};function Zu({marks:e,margin:t,selection:o=null,overscan:r=400}){const n=Uu.useRef(null),i=function(e,t,o){const[r,n]=Uu.useState(null);return Uu.useLayoutEffect(()=>{const e=t.current,o=function(e){let t=e?.parentElement??null;for(;t;){const{overflow:e,overflowX:o,overflowY:r}=window.getComputedStyle(t);if(/(auto|scroll|overlay)/.test(`${e} ${r} ${o}`))return t;t=t.parentElement}return null}(e);if(!e||!o)return void n(null);let r=0;const i=()=>{r=0;const t=o.getBoundingClientRect(),i=e.getBoundingClientRect();n(0!==t.width&&0!==t.height?{scroll:{left:t.left,top:t.top,right:t.right,bottom:t.bottom},originX:i.left,originY:i.top}:null)},s=()=>{0===r&&(r=window.requestAnimationFrame(i))};i(),o.addEventListener("scroll",s,{passive:!0});const a=new ResizeObserver(s);return a.observe(o),()=>{0!==r&&window.cancelAnimationFrame(r),o.removeEventListener("scroll",s),a.disconnect()}},[t,e,o]),Uu.useMemo(()=>{if(!e||!r)return e;const{scroll:t,originX:n,originY:i}=r,s=t.left-o,a=t.right+o,l=t.top-o,c=t.bottom+o;return e.filter(e=>{const t=n+e.x,o=i+e.y;return!(s>t+e.width||t>a||l>o+e.height||o>c)})},[e,r,o])}(e,n,r);if(!e||0===e.length)return null;const s=(0,Ku.jsx)("div",{className:"semiotic-network-html-marks",ref:n,style:{...Qu,transform:`translate(${t.left}px, ${t.top}px)`},children:(i??e).map(e=>(0,Ku.jsx)("div",{className:"semiotic-network-html-mark","data-mark-id":e.id,style:{position:"absolute",transform:`translate(${e.x}px, ${e.y}px)`,width:e.width,height:e.height,pointerEvents:"none"},children:e.content},e.id))});return null!=o?(0,Ku.jsx)(go,{value:o,children:s}):s}var Ju=c(require("react")),ed=require("react/jsx-runtime");function td({componentName:e,message:t,diagnosticHint:o,width:r,height:n}){return(0,ed.jsx)("div",{role:"alert",style:{width:r,height:Math.max(n,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:(0,ed.jsxs)("div",{style:{textAlign:"center",maxWidth:400},children:[(0,ed.jsx)("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:e}),(0,ed.jsx)("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:t}),o&&(0,ed.jsx)("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:o})]})})}var od=require("react/jsx-runtime"),rd=class extends Ju.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){this.props.onError?.(e,t)}render(){if(this.state.error){const{fallback:e}=this.props,t=this.state.error;return"function"==typeof e?e(t):void 0!==e?e:(0,od.jsx)(td,{componentName:"ChartErrorBoundary",message:t.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}},nd=require("react/jsx-runtime"),id="undefined"!=typeof process&&"production"!==process.env?.NODE_ENV;function sd({componentName:e,width:t,height:o,children:r}){return(0,nd.jsx)(rd,{fallback:r=>(0,nd.jsx)(td,{componentName:e,message:r.message,width:t,height:o}),children:r})}var ad={display:"flex",alignItems:"center",justifyContent:"center",color:"var(--semiotic-text-secondary, #666)",fontSize:13,fontFamily:"inherit",border:"1px dashed var(--semiotic-border, #ddd)",borderRadius:4,boxSizing:"border-box"},ld={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function cd(e,t,o,r){return!1===r||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?(0,nd.jsx)("div",{style:{...ad,width:t,height:o},children:r||"No data available"}):null}function ud(e,t,o,r){if(!e)return null;if(!1===r)return null;if(null!=r)return(0,nd.jsx)("div",{style:{width:t,height:o,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:r});const n=Math.min(5,Math.floor(o/40)),i=Math.max(8,Math.floor(o/(3*n))),s=Math.max(6,Math.floor(o/(2.5*n))),a=Math.floor((o-(n*(i+s)-s))/2);return(0,nd.jsx)("div",{style:{width:t,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:n},(e,o)=>(0,nd.jsx)("div",{className:"semiotic-loading-bar",style:{...ld,position:"absolute",top:a+o*(i+s),left:Math.floor(.1*t),width:30+(37*o+13)%50+"%",height:i,opacity:.5+o%2*.2}},o))})}function dd(e,t,o,r){if(!id)return;if(!t||0===t.length)return;if("string"!=typeof r)return;const n=t[0];if(!n||"object"!=typeof n)return;if(r in n)return;const i=Object.keys(n).join(", ");console.warn(`[semiotic] ${e}: ${o} "${r}" not found in data. Available keys: ${i}`)}var hd={},pd=4e4;function fd(e,t,o,r,n=pd){return"sync"!==e&&("worker"===e||r*(t+o)>=n)}function gd(){return"undefined"!=typeof window&&"undefined"!=typeof Worker}function md(){if("undefined"!=typeof DOMException)return new DOMException("Force layout aborted","AbortError");const e=Error("Force layout aborted");return e.name="AbortError",e}var yd=class{constructor(e=function(){const e="string"==typeof hd.url&&hd.url?new URL("./forceLayoutWorker.js",hd.url):function(e){if("undefined"!=typeof __filename){const t=__filename.replace(/\\/g,"/"),o=t.startsWith("/")?t:"/"+t;return new URL("./"+e,"file:"+o)}throw Error("Cannot resolve module worker asset: "+e)}("forceLayoutWorker.js");return new Worker(e,{type:"module",name:"semiotic-force-layout"})}()){this.nextRequestId=1,this.pending=new Map,this.dead=!1,this.worker=e,this.worker.onmessage=e=>{const t=e.data,o=t.requestId,r=null!=o?this.pending.get(o):this.pending.values().next().value;if(r){if(null!=o?this.pending.delete(o):this.pending.clear(),r.cleanup(),t.error){const e=Error(t.error.message);return e.name=t.error.name??"Error",t.error.stack&&(e.stack=t.error.stack),void r.reject(e)}r.resolve({positions:t.positions??{}})}},this.worker.onerror=e=>{this.rejectAll(Error(e.message||"Force layout worker failed")),this.terminate()}}get isDead(){return this.dead}request(e,t){if(this.dead)return Promise.reject(Error("Force layout worker session is closed"));if(t?.aborted)return Promise.reject(md());const o=this.nextRequestId;this.nextRequestId+=1;const r={requestId:o,request:e};return new Promise((e,n)=>{const i=()=>{this.pending.delete(o),t?.removeEventListener("abort",i),n(md())},s=()=>t?.removeEventListener("abort",i);this.pending.set(o,{cleanup:s,reject:n,resolve:e}),t?.addEventListener("abort",i,{once:!0});try{this.worker.postMessage(r)}catch(e){this.pending.delete(o),s(),n(e instanceof Error?e:Error(e+""))}})}terminate(){this.dead||(this.dead=!0,this.rejectAll(Error("Force layout worker terminated")),this.worker.terminate())}rejectAll(e){for(const t of this.pending.values())t.cleanup(),t.reject(e);this.pending.clear()}},bd=null;function vd(e,t){return gd()?t?.aborted?Promise.reject(md()):(bd&&!bd.isDead||(bd=new yd),bd).request(e,t):Promise.reject(Error("Web Workers are unavailable"))}var xd=require("react/jsx-runtime"),kd=/^(value|amount|total|count|weight|score)$/i;function wd({data:e}){if("edge"===e.nodeOrEdge){const t=e.data;return t?(0,xd.jsxs)("div",{className:"semiotic-tooltip",style:Rs,children:[(0,xd.jsxs)("div",{style:{fontWeight:600},children:["object"==typeof t.source?t.source.id:t.source," → ","object"==typeof t.target?t.target.id:t.target]}),null!=t.value&&(0,xd.jsxs)("div",{style:{marginTop:4,opacity:.8},children:["Value:"," ","number"==typeof t.value?t.value.toLocaleString():t.value+""]})]}):null}const t=e.data;if(!t)return null;const o=t.__hierarchyNode;if(o){const e=[];let r=o;for(;r;){const o=r.data?.name??r.data?.id??t.id;null!=o&&e.unshift(o+""),r=r.parent}e.length>1&&e.shift();const n=e.length-1;return(0,xd.jsxs)("div",{className:"semiotic-tooltip",style:Rs,children:[(0,xd.jsx)("div",{children:e.map((e,t)=>(0,xd.jsxs)("span",{children:[t>0&&(0,xd.jsx)("span",{style:{margin:"0 3px",opacity:.5},children:" → "}),t===n?(0,xd.jsx)("strong",{children:e}):(0,xd.jsx)("span",{style:{opacity:.7},children:e})]},t))}),null!=t.value&&t.value>0&&(0,xd.jsx)("div",{style:{marginTop:4,opacity:.8},children:"number"==typeof t.value?t.value.toLocaleString():t.value+""})]})}const r=(t.sourceLinks?.length||0)+(t.targetLinks?.length||0),n=(t.sourceLinks||[]).reduce((e,t)=>e+(t.value||0),0)+(t.targetLinks||[]).reduce((e,t)=>e+(t.value||0),0),i=_s(t.data??t),s=null!=i.title?i.title+"":t.id,a=i.entries.some(e=>kd.test(e.key));return(0,xd.jsxs)("div",{className:"semiotic-tooltip",style:Rs,children:[(0,xd.jsx)("div",{style:{fontWeight:600},children:s}),i.entries.map(e=>(0,xd.jsxs)("div",{style:{marginTop:4,opacity:.8},children:[e.key,": ",Fa(e.value)]},e.key)),!a&&null!=t.value&&t.value>0&&(0,xd.jsxs)("div",{style:{marginTop:4,opacity:.8},children:["Total:"," ","number"==typeof t.value?t.value.toLocaleString():t.value+""]}),r>0&&(0,xd.jsxs)("div",{style:{marginTop:4,opacity:.8},children:["Connections: ",r,n!==r&&` (weighted: ${n.toLocaleString()})`]})]})}function Sd(e){return e._cachedPath2D&&e._cachedPath2DSource===e.pathD||(e._cachedPath2D=new Path2D(e.pathD),e._cachedPath2DSource=e.pathD),e._cachedPath2D}function Ad(e,t){if(!t.pathD)return;e.save();const o=Sd(t);if(t.style.fill&&"none"!==t.style.fill){const r=t._gradient;if(r){const o=e.createLinearGradient(r.x0,0,r.x1,0),n=t.style.fillOpacity??t.style.opacity??.5,i="string"==typeof t.style.fill?t.style.fill:"#999",s=Oo(e,i)||i;o.addColorStop(0,1===r.from?s:"transparent"),o.addColorStop(1,1===r.to?s:"transparent"),e.fillStyle=o,e.globalAlpha=n}else e.fillStyle="string"==typeof t.style.fill&&Oo(e,t.style.fill)||t.style.fill,e.globalAlpha=t.style.fillOpacity??t.style.opacity??.5;e.fill(o)}t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Oo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??.5,e.globalAlpha=.5*(t.style.opacity??1),e.stroke(o)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.2*t._pulseIntensity,e.fill(o)),e.restore()}function Cd(e,t){e.save();const o=t.style.stroke||"#999";e.strokeStyle=Oo(e,o)||o,e.lineWidth=t.style.strokeWidth??1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.strokeDasharray&&e.setLineDash(t.style.strokeDasharray.split(/[\s,]+/).map(Number)),e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.stroke(),t._pulseIntensity&&t._pulseIntensity>0&&(e.setLineDash([]),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=(t.style.strokeWidth??1)+3*t._pulseIntensity,e.globalAlpha=.4*t._pulseIntensity,e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.stroke()),e.restore()}function Md(e,t){if(!t.pathD)return;e.save();const o=Sd(t);t.style.fill&&"none"!==t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&Oo(e,t.style.fill)||t.style.fill,e.globalAlpha=t.style.fillOpacity??t.style.opacity??.5,e.fill(o)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Oo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??.5,e.globalAlpha=.3*(t.style.opacity??1),e.stroke(o)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.25*t._pulseIntensity,e.fill(o)),e.restore()}function jd(e,t){if(!t.pathD)return;e.save();const o=Sd(t),r=t.style.stroke||"#999";e.strokeStyle=Oo(e,r)||r,e.lineWidth=t.style.strokeWidth??1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.stroke(o),t.style.fill&&"none"!==t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&Oo(e,t.style.fill)||t.style.fill,e.globalAlpha=t.style.fillOpacity??.1,e.fill(o)),e.restore()}wd.ownsChrome=!0;var Pd=new Map;function _d(e){try{if(e.path)return new Path2D(e.path);const t=`${e.symbolType??"circle"}:${Math.round(e.size)}`;let o=Pd.get(t);return o||(o=new Path2D(_t(e.symbolType,e.size)),Pd.size>256&&Pd.clear(),Pd.set(t,o)),o}catch{return null}}function Ld(e){const{sceneNodes:t,nodes:o,nodeColorMap:r,colorScheme:n}=e;for(const e of t)e.id&&"string"==typeof e.style?.fill&&r.set(e.id,e.style.fill);const i=Array.isArray(n)?n:De,s=Array.from(o);for(let e=0;s.length>e;e++){const t=s[e];r.has(t.id)||r.set(t.id,i[e%i.length])}return s.length}function Rd(e,t,o,r=30){switch(e.type){case"circle":return function(e,t,o,r=30){const n=t-e.cx,i=o-e.cy,s=Math.sqrt(n*n+i*i);return s>wo(e.r,r)?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:s}}(e,t,o,r);case"rect":return function(e,t,o){const r=ko(t,o,e);return r.hit?{type:"node",datum:e.datum,x:r.cx,y:r.cy,distance:0}:null}(e,t,o);case"arc":return function(e,t,o){const r=t-e.cx,n=o-e.cy,i=Math.sqrt(r*r+n*n);if(e.innerR-2>i||i>e.outerR+2)return null;const s=Co(Math.atan2(n,r)),a=Co(e.startAngle),l=Co(e.endAngle);if(a>l?s>=a||l>=s:s>=a&&l>=s){const t=(e.startAngle+e.endAngle)/2,o=(e.innerR+e.outerR)/2;return{type:"node",datum:e.datum,x:e.cx+o*Math.cos(t),y:e.cy+o*Math.sin(t),distance:0}}return null}(e,t,o);case"symbol":return function(e,t,o,r=30){const n=t-e.cx,i=o-e.cy,s=Math.sqrt(n*n+i*i);return s>wo(Lt(e.size),r)?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:s}}(e,t,o,r);case"glyph":return function(e,t,o,r=30){if(null==e.datum)return null;const n=Io(e.glyph,e.size),i=e.cx+n.centerDx,s=e.cy+n.centerDy,a=t-i,l=o-s,c=Math.sqrt(a*a+l*l);return c>wo(n.radius,r)?null:{type:"node",datum:e.datum,x:i,y:s,distance:c}}(e,t,o,r);default:return null}}var Td=null,Id=null;function $d(){return Id||((Td=document.createElement("canvas")).width=1,Td.height=1,Id=Td.getContext("2d")),Id}function Nd(e){if(e._cachedPath2D&&e._cachedPath2DSource===e.pathD)return e._cachedPath2D;try{return e._cachedPath2D=new Path2D(e.pathD),e._cachedPath2DSource=e.pathD,e._cachedPath2D}catch{return null}}function Fd(e,t,o){switch(e.type){case"bezier":return function(e,t,o){if(!e.pathD)return null;const r=Nd(e),n=$d();if(!r||!n)return null;try{if(n.isPointInPath(r,t,o))return{type:"edge",datum:e.datum,x:t,y:o,distance:0};const i=n.lineWidth;n.lineWidth=10;const s=n.isPointInStroke(r,t,o);if(n.lineWidth=i,s)return{type:"edge",datum:e.datum,x:t,y:o,distance:4}}catch{}return null}(e,t,o);case"line":return function(e,t,o){const r=e.x2-e.x1,n=e.y2-e.y1,i=r*r+n*n;if(0===i)return null;let s=((t-e.x1)*r+(o-e.y1)*n)/i;s=Math.max(0,Math.min(1,s));const a=e.x1+s*r,l=e.y1+s*n,c=Math.sqrt((t-a)**2+(o-l)**2);return c>5?null:{type:"edge",datum:e.datum,x:a,y:l,distance:c}}(e,t,o);case"ribbon":case"curved":return function(e,t,o){if(!e.pathD)return null;const r=Nd(e),n=$d();if(!r||!n)return null;try{if(n.isPointInPath(r,t,o))return{type:"edge",datum:e.datum,x:t,y:o,distance:0};const i=n.lineWidth;n.lineWidth=10;const s=n.isPointInStroke(r,t,o);if(n.lineWidth=i,s)return{type:"edge",datum:e.datum,x:t,y:o,distance:4}}catch{}return null}(e,t,o);default:return null}}function Bd(e){const{clientX:t,clientY:o,canvasRect:r,margin:n,adjustedWidth:i,adjustedHeight:s,sceneNodes:a,sceneEdges:l,nodeQuadtree:c,maxNodeRadius:u,hitRadius:d=30}=e,h=t-r.left-n.left,p=o-r.top-n.top;if(0>h||h>i||0>p||p>s)return{kind:"miss-outside"};const f=function(e,t,o,r,n=30,i,s=0){let a=null,l=n,c=1/0;if(i){const e=No(i,o,r,n,s,e=>e.cx,e=>e.cy,e=>e.r);e&&(a={type:"node",datum:e.node.datum,x:e.node.cx,y:e.node.cy,distance:e.distance},l=e.distance)}for(const t of e){if(i&&"circle"===t.type)continue;const e=Rd(t,o,r,n);if(e)if("rect"===t.type){const o=t.w*t.h;c>o&&(a=e,c=o)}else l>e.distance&&(a=e,l=e.distance)}if(a)return a;for(const e of t){if(!1===e.interactive)continue;const t=Fd(e,o,r);t&&l>t.distance&&(a=t,l=t.distance)}return a}(a,l,h,p,d,c,u);return f?{kind:"hit",hover:Ss(f.datum||{},f.x,f.y,{nodeOrEdge:f.type})}:{kind:"miss"}}var Dd=require("react/jsx-runtime"),Ed={top:20,right:80,bottom:20,left:80},zd={top:40,right:40,bottom:40,left:40},Hd=new Set(["chord","force","circlepack","orbit"]),Od=[800,600],Wd=(0,ac.memo)((0,ac.forwardRef)(function(e,t){const{chartType:o,nodes:r,edges:n,data:i,initialEdges:s,nodeIDAccessor:a="id",sourceAccessor:l="source",targetAccessor:c="target",valueAccessor:u="value",edgeIdAccessor:d,childrenAccessor:h,hierarchySum:p,orientation:f="horizontal",nodeAlign:g="justify",nodePaddingRatio:m=.05,nodeWidth:y=15,iterations:b=300,forceStrength:v=.1,layoutExecution:x="auto",layoutLoadingContent:k,onLayoutStateChange:w,padAngle:S=.01,groupWidth:A=20,sortGroups:C,edgeSort:M,treeOrientation:j="vertical",edgeType:P="curve",padding:_,paddingTop:L,tensionConfig:R,showParticles:T=!1,particleStyle:I,nodeStyle:$,edgeStyle:N,colorBy:F,colorScheme:B="category10",edgeColorBy:D="source",edgeOpacity:E=.5,colorByDepth:H=!1,nodeSize:O=8,nodeSizeRange:W=[5,20],nodeLabel:q,showLabels:Y=!0,labelMode:V,size:X=Od,responsiveWidth:U,responsiveHeight:K,margin:Q,className:Z,background:J,enableHover:ee=!0,tooltipContent:te,customHoverBehavior:oe,customClickBehavior:re,onObservation:ne,chartId:ie,onTopologyChange:se,annotations:ae,autoPlaceAnnotations:le,svgAnnotationRules:ce,legend:ue,legendPosition:de,legendLayout:he,legendHoverBehavior:pe,legendClickBehavior:fe,legendHighlightedCategory:ge,legendIsolatedCategories:me,title:ye,foregroundGraphics:be,backgroundGraphics:ve,decay:xe,pulse:ke,transition:we,animate:Se,staleness:Ae,thresholds:Ce,accessibleTable:Me=!0,description:je,summary:Pe,orbitMode:_e,orbitSize:Le,orbitSpeed:Re,orbitRevolution:Te,orbitRevolutionStyle:Ie,orbitEccentricity:$e,orbitShowRings:Ne,orbitAnimated:Fe,customNetworkLayout:Be,onLayoutError:Ee,layoutConfig:ze,layoutSelection:He}=e,Oe=Hd.has(o)?zd:Ed,We=(0,ac.useRef)(!0),qe=Us({sizeProp:X,responsiveWidth:U,responsiveHeight:K,userMargin:Q,marginDefault:Oe,foregroundGraphics:be,backgroundGraphics:ve,animate:Se,transitionProp:we,themeDirtyRef:We}),{reducedMotionRef:Ye,responsiveRef:Ge,size:Ve,margin:Xe,adjustedWidth:Ue,adjustedHeight:Ke,resolvedForeground:Qe,resolvedBackground:Ze,transition:Je,introEnabled:et,tableId:tt,rafRef:ot,renderFnRef:rt,scheduleRender:nt,cancelRender:it,currentTheme:st}=qe,at=Mi(),lt=Li(),ct=(0,ac.useMemo)(()=>z(r),[r]),ut=(0,ac.useMemo)(()=>Array.isArray(n)?z(n):n,[n]),dt=(0,ac.useMemo)(()=>({...lc,...R}),[R]),ht=(0,ac.useMemo)(()=>({...cc,...I}),[I]),pt=(0,ac.useMemo)(()=>{return{chartType:(e={chartType:o,nodeIDAccessor:a,sourceAccessor:l,targetAccessor:c,valueAccessor:u,edgeIdAccessor:d,childrenAccessor:h,hierarchySum:p,orientation:f,nodeAlign:g,nodePaddingRatio:m,nodeWidth:y,iterations:b,forceStrength:v,padAngle:S,groupWidth:A,sortGroups:C,edgeSort:M,treeOrientation:j,edgeType:P,padding:_,paddingTop:L,tensionConfig:dt,showParticles:T,particleStyle:ht,nodeStyle:$,edgeStyle:N,nodeLabel:q,showLabels:Y,labelMode:V,colorBy:F,colorScheme:B,edgeColorBy:D,edgeOpacity:E,colorByDepth:H,nodeSize:O,nodeSizeRange:W,decay:xe,pulse:ke,transition:Je,introAnimation:et,staleness:Ae,thresholds:Ce,orbitMode:_e,orbitSize:Le,orbitSpeed:Re,orbitRevolution:Te,orbitRevolutionStyle:Ie,orbitEccentricity:$e,orbitShowRings:Ne,orbitAnimated:Fe,customNetworkLayout:Be,onLayoutError:Ee,layoutConfig:ze,currentTheme:st}).chartType,nodeIDAccessor:e.nodeIDAccessor,sourceAccessor:e.sourceAccessor,targetAccessor:e.targetAccessor,valueAccessor:e.valueAccessor,edgeIdAccessor:e.edgeIdAccessor,childrenAccessor:e.childrenAccessor,hierarchySum:e.hierarchySum,orientation:e.orientation,nodeAlign:e.nodeAlign,nodePaddingRatio:e.nodePaddingRatio,nodeWidth:e.nodeWidth,iterations:e.iterations,forceStrength:e.forceStrength,padAngle:e.padAngle,groupWidth:e.groupWidth,sortGroups:e.sortGroups,edgeSort:e.edgeSort,treeOrientation:e.treeOrientation,edgeType:e.edgeType,padding:e.padding,paddingTop:e.paddingTop,tensionConfig:e.tensionConfig,showParticles:e.showParticles,particleStyle:e.particleStyle,nodeStyle:e.nodeStyle,edgeStyle:e.edgeStyle,nodeLabel:e.nodeLabel,showLabels:e.showLabels,labelMode:e.labelMode,colorBy:e.colorBy,colorScheme:e.colorScheme,themeCategorical:e.currentTheme?.colors?.categorical,themeSemantic:G(e.currentTheme),edgeColorBy:e.edgeColorBy,edgeOpacity:e.edgeOpacity,colorByDepth:e.colorByDepth,nodeSize:e.nodeSize,nodeSizeRange:e.nodeSizeRange,decay:e.decay,pulse:e.pulse,transition:e.transition,introAnimation:e.introAnimation,staleness:e.staleness,thresholds:e.thresholds,orbitMode:e.orbitMode,orbitSize:e.orbitSize,orbitSpeed:e.orbitSpeed,orbitRevolution:e.orbitRevolution,orbitRevolutionStyle:e.orbitRevolutionStyle,orbitEccentricity:e.orbitEccentricity,orbitShowRings:e.orbitShowRings,orbitAnimated:e.orbitAnimated,customNetworkLayout:e.customNetworkLayout,onLayoutError:e.onLayoutError,layoutConfig:e.layoutConfig};var e},[o,a,l,c,u,h,p,f,g,m,y,b,v,S,A,C,M,j,P,_,L,dt,T,ht,$,N,q,Y,V,F,B,D,E,H,O,W,xe,ke,Je?.duration,Je?.easing,et,Ae,Ce,_e,Le,Re,Te,Ie,$e,Ne,Fe,st,Be,Ee,ze]),ft=Ii(pt),gt=Ii({chartType:(mt={chartType:o,nodeIDAccessor:a,sourceAccessor:l,targetAccessor:c,valueAccessor:u,edgeIdAccessor:d,childrenAccessor:h,hierarchySum:p,orientation:f,nodeAlign:g,nodePaddingRatio:m,nodeWidth:y,iterations:b,forceStrength:v,padAngle:S,groupWidth:A,sortGroups:C,edgeSort:M,treeOrientation:j,edgeType:P,padding:_,paddingTop:L,tensionConfig:dt,customNetworkLayout:Be,orbitMode:_e,orbitSize:Le,orbitEccentricity:$e}).chartType,nodeIDAccessor:mt.nodeIDAccessor,sourceAccessor:mt.sourceAccessor,targetAccessor:mt.targetAccessor,valueAccessor:mt.valueAccessor,edgeIdAccessor:mt.edgeIdAccessor,childrenAccessor:mt.childrenAccessor,hierarchySum:mt.hierarchySum,orientation:mt.orientation,nodeAlign:mt.nodeAlign,nodePaddingRatio:mt.nodePaddingRatio,nodeWidth:mt.nodeWidth,iterations:mt.iterations,forceStrength:mt.forceStrength,padAngle:mt.padAngle,groupWidth:mt.groupWidth,sortGroups:mt.sortGroups,edgeSort:mt.edgeSort,treeOrientation:mt.treeOrientation,edgeType:mt.edgeType,padding:mt.padding,paddingTop:mt.paddingTop,tensionConfig:mt.tensionConfig,customNetworkLayout:mt.customNetworkLayout,orbitMode:mt.orbitMode,orbitSize:mt.orbitSize,orbitEccentricity:mt.orbitEccentricity});var mt;const yt=(0,ac.useRef)(null),bt=(0,ac.useRef)(0),vt=(0,ac.useRef)(0),xt=(0,ac.useRef)(!1),kt=(0,ac.useRef)(null);kt.current||(kt.current=new Yu(ft));const[wt,St]=(0,ac.useState)(null),[At,Ct]=(0,ac.useState)(0),[Mt,jt]=(0,ac.useState)(0),[Pt,Lt]=(0,ac.useState)(!1),[Rt,Tt]=(0,ac.useState)(!1),It=(0,ac.useRef)(0),$t=(0,ac.useRef)(null),Nt=(0,ac.useRef)(!1),Ft=(0,ac.useRef)(w);Ft.current=w;const Bt=(0,ac.useRef)(ft);Bt.current=ft;const Dt=(0,ac.useRef)(null),Et=(0,ac.useRef)(new Map),zt=(0,ac.useRef)(0),Ht=(0,ac.useCallback)(e=>function(e){const{node:t,colorBy:o,colorScheme:r,nodeColorMap:n,colorIndexRef:i}=e;if("function"==typeof o)return o(t)+"";if("string"==typeof o&&t.data){const e=t.data[o];if(void 0!==e){if(!n.has(e+"")){const t=Array.isArray(r)?r:De;n.set(e+"",t[i.current++%t.length])}return n.get(e+"")}}if(n.has(t.id))return n.get(t.id);const s=Array.isArray(r)?r:De,a=o?s[i.current++%s.length]:s[0];return n.set(t.id,a),a}({node:e,colorBy:F,colorScheme:B,nodeColorMap:Et.current,colorIndexRef:zt}),[F,B]),Ot=(Wt=st,Wt?.colors?.border||Wt?.colors?.secondary||Wt?.colors?.primary||"#999");var Wt;const qt=(0,ac.useCallback)(e=>function(e,t){return e?"object"==typeof e?e:t?.get(e)??null:null}(e,kt.current?.nodes),[]),Yt=(0,ac.useCallback)(e=>function(e){const{edge:t,edgeColorBy:o,getNodeColor:r,resolveEndpoint:n,fallback:i}=e;if("function"==typeof o)return o(t);const s=n(t.source),a=n(t.target);return"target"===o&&a?r(a):s?r(s):i}({edge:e,edgeColorBy:D,getNodeColor:Ht,resolveEndpoint:qt,fallback:Ot}),[D,Ht,Ot,qt]),Gt=(0,ac.useCallback)(e=>function(e){const{edge:t,particleStyleColor:o,particleColorBy:r,hasExplicitParticleColorBy:n,getEdgeColor:i,getNodeColor:s,resolveEndpoint:a,fallback:l}=e;if("function"==typeof o){const e=a(t.source);return e?o(t,e):l}if(!n)return i(t);const c=r,u=a(t.source),d=a(t.target);return"target"===c&&d?s(d):u?s(u):l}({edge:e,particleStyleColor:ht.color,particleColorBy:ht.colorBy,hasExplicitParticleColorBy:!!I?.colorBy,getEdgeColor:Yt,getNodeColor:Ht,resolveEndpoint:qt,fallback:Ot}),[I?.colorBy,ht.color,ht.colorBy,Ht,Yt,Ot,qt]),Vt=("sankey"===o||!!Be)&&T||!!ke||(kt.current?.isAnimating??!1);vo(kt,ft,We,nt),xo(kt,He,We,nt),(0,ac.useEffect)(()=>{const e=kt.current;e&&(e.buildScene([Ue,Ke]),zt.current=Ld({sceneNodes:e.sceneNodes,nodes:e.nodes.values(),nodeColorMap:Et.current,colorScheme:B}),We.current=!0,nt())},[st,Ue,Ke,nt]);const Xt=(0,ac.useCallback)(()=>{const e=kt.current;if(e&&(e.runLayout([Ue,Ke]),e.buildScene([Ue,Ke]),We.current=!0,zt.current=Ld({sceneNodes:e.sceneNodes,nodes:e.nodes.values(),nodeColorMap:Et.current,colorScheme:B}),Ct(e.layoutVersion),se)){const{nodes:t,edges:o}=e.getLayoutData();se(t,o)}},[Ue,Ke,se,B]),Ut=(0,ac.useCallback)(e=>{if(null==e||"object"!=typeof e)return;const t=kt.current;t&&(t.ingestEdge(e)&&Xt(),nt())},[Xt,nt]),Kt=(0,ac.useCallback)(e=>{const t=kt.current;if(!t)return;let o=!1;for(const r of e)null!=r&&"object"==typeof r&&t.ingestEdge(r)&&(o=!0);o&&Xt(),nt()},[Xt,nt]),Qt=(0,ac.useCallback)(()=>{kt.current?.clear(),Et.current.clear(),zt.current=0,Ct(kt.current?.layoutVersion??0),St(null),Dt.current=null,We.current=!0,nt()},[nt]),Zt=(0,ac.useCallback)(()=>{const e=kt.current;e&&(e.tension+=999,Xt(),nt())},[Xt,nt]);(0,ac.useImperativeHandle)(t,()=>({push:Ut,pushMany:Kt,removeNode:e=>{const t=kt.current?.removeNode(e)??!1;if(t){const t=Dt.current?.data?"function"==typeof a?a(Dt.current.data):Dt.current.data[a]:void 0;Dt.current&&"node"===Dt.current.nodeOrEdge&&t===e&&(Dt.current=null,St(null)),Et.current.delete(e),Xt(),We.current=!0,nt()}return t},removeEdge:(e,t)=>{const o=kt.current?.removeEdge(e,t)??!1;if(o){if(Dt.current&&"edge"===Dt.current.nodeOrEdge){const o=Dt.current.data;let r;r=void 0!==t?("object"==typeof o?.source?o.source.id:o?.source)===e&&("object"==typeof o?.target?o.target.id:o?.target)===t:!d||!o||("function"==typeof d?d:e=>e?.[d])(o)===e,r&&(Dt.current=null,St(null))}Xt(),We.current=!0,nt()}return o},updateNode:(e,t)=>{const o=kt.current?.updateNode(e,t)??null;return o&&(We.current=!0,nt()),o},updateEdge:(e,t,o)=>{const r=kt.current?.updateEdge(e,t,o)??[];return r.length>0&&(Xt(),We.current=!0,nt()),r},clear:Qt,getTopology:()=>kt.current?.getLayoutData()??{nodes:[],edges:[]},getCustomLayout:()=>kt.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>kt.current?.lastCustomLayoutFailure??null,getTopologyDiff:()=>{const e=kt.current;return e?{addedNodes:Array.from(e.addedNodes),removedNodes:Array.from(e.removedNodes),addedEdges:Array.from(e.addedEdges),removedEdges:Array.from(e.removedEdges)}:{addedNodes:[],removedNodes:[],addedEdges:[],removedEdges:[]}},relayout:Zt,getTension:()=>kt.current?.tension??0}),[Ut,Kt,Qt,Zt,Xt,nt]);const Jt=["tree","cluster","treemap","circlepack","partition","orbit"].includes(o),eo=Jt?i||(Array.isArray(n)?void 0:n):void 0;(0,ac.useEffect)(()=>{const e=kt.current;if(!e)return;const t=++It.current;if($t.current?.abort(),$t.current=null,Jt&&eo)e.ingestHierarchy(eo,[Ue,Ke]),e.buildScene([Ue,Ke]),Tt(!1),Ft.current?.("ready"),We.current=!0,nt();else{const i=ct,s=Array.isArray(ut)?ut:[];if(0===i.length&&0===s.length)return null==r&&null==n||0>=e.nodes.size&&0>=e.edges.size||Qt(),Tt(!1),void Ft.current?.("ready");const a=[Ue,Ke],l="force"===o&&!Be&&gd()&&fd(x,i.length,s.length,b);if(l&<&&!Nt.current&&e.sceneNodes.length>0)return Nt.current=!0,Tt(!1),Ft.current?.("ready"),We.current=!0,void nt();if(l){const o=new AbortController;$t.current=o;const r=e._lastPositionSnapshot;e.ingestBounded(i,s,a,{deferLayout:!0});const n=e.getLayoutData(),l=function(e,t,o,r,n){const i=gu(o.nodeSize,o.nodeSizeRange,e);return{kind:"frame",nodes:e.map(e=>{const t=n?.get(e.id);return{id:e.id,x:0!==e.x||0!==e.y?e.x:t?.x??0,y:0!==e.x||0!==e.y?e.y:t?.y??0,x0:0,x1:0,y0:0,y1:0,width:0,height:0,value:e.value,__forceRadius:i(e)}}),edges:t.map(e=>{const t="string"==typeof e.source?e.source:e.source.id,o="string"==typeof e.target?e.target:e.target.id,r=e.data?.weight,n="number"==typeof r&&Number.isFinite(r)?r:e.value;return{source:t,target:o,value:e.value,y0:0,y1:0,sankeyWidth:0,weight:n}}),config:{chartType:"force",iterations:o.iterations,forceStrength:o.forceStrength},size:r}}(n.nodes,n.edges,Bt.current,a,r);return Tt(!0),Ft.current?.("pending"),vd(l,o.signal).then(({positions:o})=>{t===It.current&&(e.applyForceLayoutPositions(o,a),e.buildScene(a),zt.current=Ld({sceneNodes:e.sceneNodes,nodes:e.nodes.values(),nodeColorMap:Et.current,colorScheme:B}),Tt(!1),Ft.current?.("ready"),Ct(e.layoutVersion),We.current=!0,nt())}).catch(o=>{"AbortError"!==o.name&&t===It.current&&(e.runLayout(a),e.buildScene(a),zt.current=Ld({sceneNodes:e.sceneNodes,nodes:e.nodes.values(),nodeColorMap:Et.current,colorScheme:B}),Tt(!1),Ft.current?.("error"),Ct(e.layoutVersion),We.current=!0,nt())}),()=>o.abort()}e.ingestBounded(i,s,a),e.buildScene(a),Tt(!1),Ft.current?.("ready"),zt.current=Ld({sceneNodes:e.sceneNodes,nodes:e.nodes.values(),nodeColorMap:Et.current,colorScheme:B}),We.current=!0,nt()}},[ct,ut,r,n,i,eo,Jt,Ue,Ke,gt,x,b,lt,o,Be,nt,Qt,B]),(0,ac.useEffect)(()=>{s&&s.length>0&&Kt(s)},[]);const to=(0,ac.useCallback)(e=>{if(oe&&oe(e),ne){const t=Date.now();ne(e?{type:"hover",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:ie}:{type:"hover-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:ie})}},[oe,ne,ie]),oo=(0,ac.useCallback)(e=>{if(re&&re(e),ne){const t=Date.now();ne(e?{type:"click",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:ie}:{type:"click-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:ie})}},[re,ne,ie]),{hoverHandlerRef:ro,hoverLeaveRef:no,onPointerMove:io,onPointerLeave:so}=qe,ao=()=>!Be||(kt.current?.hasCustomRestyle??!1);ro.current=e=>{if(!ee)return;const t=ao(),o=yt.current;if(!o)return;const r=kt.current;if(!r)return;const n=Bd({clientX:e.clientX,clientY:e.clientY,canvasRect:o.getBoundingClientRect(),margin:Xe,adjustedWidth:Ue,adjustedHeight:Ke,sceneNodes:r.sceneNodes,sceneEdges:r.sceneEdges,nodeQuadtree:r.nodeQuadtree,maxNodeRadius:r.maxNodeRadius});"hit"===n.kind?(Dt.current=n.hover,St(n.hover),to&&(to(n.hover),t&&(We.current=!0)),t&&nt()):Dt.current&&(Dt.current=null,St(null),to&&(to(null),t&&(We.current=!0)),t&&nt())},no.current=()=>{if(Dt.current){const e=ao();Dt.current=null,St(null),to&&(to(null),e&&(We.current=!0)),e&&nt()}};const lo=(0,ac.useRef)(()=>{});lo.current=e=>{if(!re&&!ne)return;const t=yt.current;if(!t)return;const o=kt.current;if(!o)return;const r=Bd({clientX:e.clientX,clientY:e.clientY,canvasRect:t.getBoundingClientRect(),margin:Xe,adjustedWidth:Ue,adjustedHeight:Ke,sceneNodes:o.sceneNodes,sceneEdges:o.sceneEdges,nodeQuadtree:o.nodeQuadtree,maxNodeRadius:o.maxNodeRadius});"hit"===r.kind?oo(r.hover):"miss"===r.kind&&oo(null)};const uo=(0,ac.useCallback)(e=>lo.current(e),[]),ho=(0,ac.useRef)(-1),po=(0,ac.useRef)(null),fo=(0,ac.useRef)(-1),go=(0,ac.useCallback)(e=>{const t=kt.current;if(!t)return;const o=function(e){const t=[];for(const o of e)if("circle"===o.type&&null!=o.cx){if(0>=o.r)continue;t.push({x:o.cx,y:o.cy,datum:o.datum,shape:"circle",group:o.datum?.id??"_default"})}else if("rect"===o.type&&null!=o.x){if(0>=o.w||0>=o.h)continue;t.push({x:o.x+o.w/2,y:o.y+o.h/2,datum:o.datum,shape:"rect",w:o.w,h:o.h,group:o.datum?.id??"_default"})}else if("arc"===o.type&&null!=o.cx)t.push({x:o.cx,y:o.cy,datum:o.datum,shape:"circle",group:o.datum?.id??"_default"});else if("symbol"===o.type&&null!=o.cx){if(0>=o.size)continue;t.push({x:o.cx,y:o.cy,datum:o.datum,shape:"circle",group:o.datum?.id??"_default"})}else if("glyph"===o.type&&null!=o.cx){if(0>=o.size||null==o.datum)continue;const e=Io(o.glyph,o.size);t.push({x:o.cx+e.centerDx,y:o.cy+e.centerDy,datum:o.datum,shape:"rect",w:2*e.halfWidth,h:2*e.halfHeight,group:o.datum?.id??"_default"})}return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}(t.sceneNodes);if(0===o.length)return;const r=ur(o),n=ho.current;if(0>n){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown","Enter"].includes(e.key))return;e.preventDefault(),ho.current=0,fo.current=-1;const t=r.flat[0];po.current={shape:t.shape,w:t.w,h:t.h};const o=Ss(t.datum||{},t.x,t.y,{nodeOrEdge:"node"});return Dt.current=o,St(o),to&&(to(o),We.current=!0),void nt()}const i=dr(r,n),s=function(e,t,o,r,n){const i=o.flat[t.flatIndex];if(!i)return hr(e,t,o);const s=i.datum?.id;switch(e){case"ArrowRight":case"ArrowLeft":case"ArrowDown":case"ArrowUp":{const r=function(e,t,o){let r=null,n=1/0;for(let i=0;e.flat.length>i;i++){const s=e.flat[i];if(s===t)continue;const a=s.x-t.x,l=s.y-t.y;let c=!1;switch(o){case"right":c=a>0&&Math.abs(a)>=Math.abs(l);break;case"left":c=0>a&&Math.abs(a)>=Math.abs(l);break;case"down":c=l>0&&Math.abs(l)>=Math.abs(a);break;case"up":c=0>l&&Math.abs(l)>=Math.abs(a)}if(!c)continue;const u=a*a+l*l;n>u&&(n=u,r=i)}return r}(o,i,"ArrowRight"===e?"right":"ArrowLeft"===e?"left":"ArrowDown"===e?"down":"up")??t.flatIndex;return r!==t.flatIndex&&(n.current=-1),r}case"Enter":{if(null==s)return t.flatIndex;const e=function(e,t){const o=e+"",r=[];for(const e of t){const t=e.datum??e,n=fr(t.source),i=fr(t.target),s=null!=n,a=null!=i;s&&n+""===o&&a?r.push(i+""):a&&i+""===o&&s&&r.push(n+"")}return r}(s,r);if(0===e.length)return t.flatIndex;const i=o.idToIdx.get(e[(n.current+1)%e.length])??-1;return 0>i?t.flatIndex:(n.current=-1,i)}default:{const r=hr(e,t,o);return null!==r&&r!==t.flatIndex&&(n.current=-1),r}}}(e.key,i,r,t.sceneEdges??[],fo);if(null===s)return;if(e.preventDefault(),0>s)return ho.current=-1,po.current=null,fo.current=-1,Dt.current=null,St(null),to&&(to(null),We.current=!0),void nt();ho.current=s;const a=r.flat[s];po.current={shape:a.shape,w:a.w,h:a.h};const l={data:a.datum||{},x:a.x,y:a.y,__semioticHoverData:!0,nodeOrEdge:"node"};Dt.current=l,St(l),to&&(to(l),We.current=!0),nt()},[to,nt]),mo=(0,ac.useCallback)(e=>{ho.current=-1,po.current=null,io(e)},[io]);rt.current=()=>{ot.current=null;const e=yt.current;if(!e)return;const t=kt.current;t&&function(e){const{canvas:t,store:o,size:r,margin:n,adjustedWidth:i,adjustedHeight:s,background:a,dirtyRef:l,lastFrameTimeRef:c,reducedMotion:u,showParticles:d,isContinuous:h,animate:p,decay:f,pulse:g,thresholds:m,staleness:y,particleStyle:b,getParticleColor:v,pendingAnnotationFrameRef:x,lastAnnotationFrameTimeRef:k,setAnnotationFrame:w,scheduleNextFrame:S}=e,A=t.getContext("2d");if(!A)return;const C=performance.now(),M=c.current?Math.min((C-c.current)/1e3,.1):.016;c.current=C;const j=o.advanceTransition(u?C+1e6:C),P=!u&&j,_=!u&&o.tickAnimation([i,s],M),L=l.current;(j||L||_)&&o.buildScene([i,s]);const R=d&&!u&&!!o.particlePool,T=!!((I={dirtyOrRebuilt:L,transitioning:P,animationTicked:_,continuous:R||h,liveEncoding:!!f||!!g||!!m||!1!==p&&o.hasActiveTopologyDiff||o.hasActivePulses||o.hasActiveThresholds,forced:o.consumeStylePaintPending()}).dirtyOrRebuilt||I.transitioning||I.animationTicked||I.continuous||I.liveEncoding||I.forced);var I;const $=!!y&&o.lastIngestTime>0&&C-o.lastIngestTime>(y?.threshold??5e3);if(T){if(!Qs(t,r,n,Zs()))return;if(A.clearRect(-n.left,-n.top,r[0],r[1]),Bi(A,{background:a,width:i,height:s}),f&&o.applyDecay(),g&&o.applyPulse(C),m&&o.applyThresholds(C),!1!==p&&o.applyTopologyDiff(C),$&&(A.globalAlpha=y?.dimOpacity??.5),function(e,t){for(const o of t)switch(o.type){case"bezier":Ad(e,o);break;case"line":Cd(e,o);break;case"ribbon":Md(e,o);break;case"curved":jd(e,o)}}(A,o.sceneEdges),function(e,t){for(const o of t){if("rect"!==o.type)continue;const t=o;t.w>0&&t.h>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&Oo(e,t.style.fill)||t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(t.style.opacity??1)*t.style.fillOpacity),e.fillRect(t.x,t.y,t.w,t.h)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Oo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??1,e.globalAlpha=t.style.opacity??1,e.strokeRect(t.x,t.y,t.w,t.h)),pa(e,t),e.restore())}}(A,o.sceneNodes),function(e,t){for(const o of t){if("circle"!==o.type)continue;const t=o;t.r>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.r,0,2*Math.PI),t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&Oo(e,t.style.fill)||t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(t.style.opacity??1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Oo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??1,e.globalAlpha=t.style.opacity??1,e.stroke()),fa(e,t),e.restore())}}(A,o.sceneNodes),function(e,t){for(const o of t){if("arc"!==o.type)continue;const t=o;e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.outerR,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerR,t.endAngle,t.startAngle,!0),e.closePath(),t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&Oo(e,t.style.fill)||t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(t.style.opacity??1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Oo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??1,e.globalAlpha=t.style.opacity??1,e.stroke()),e.restore()}}(A,o.sceneNodes),function(e,t){const o=e.globalAlpha;for(const r of t){if("symbol"!==r.type)continue;const t=r;if(0>=t.size)continue;const n=_d(t);if(!n)continue;e.save(),e.translate(t.cx,t.cy),t.rotation&&e.rotate(t.rotation);const i=t.style.opacity??1;t.style.fill&&(e.globalAlpha=o*i*(t.style.fillOpacity??1),e.fillStyle="string"==typeof t.style.fill&&Oo(e,t.style.fill)||t.style.fill,e.fill(n)),t.style.stroke&&"none"!==t.style.stroke&&(e.globalAlpha=o*i,e.strokeStyle=Oo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??1,e.stroke(n)),e.restore()}}(A,o.sceneNodes),function(e,t){const o=e.globalAlpha;for(const r of t)"glyph"===r.type&&Sa(e,r,r.cx,r.cy,o);e.globalAlpha=o}(A,o.sceneNodes),R&&!$){const e=o.edgesArray;if(e.length>0){!function(e,t,o,r){const n=r.spawnRate??.1,i=r.maxPerEdge??50;for(let r=0;t.length>r;r++){const s=t[r];if(!s.bezier)continue;if(e.countForEdge(r)>=i)continue;const a=s.value*n*o*(s.bezier.circular?.3:1),l=Math.floor(a),c=a-l;let u=l;Math.random()<c&&u++;for(let t=0;u>t&&e.countForEdge(r)<i;t++)e.spawn(r)}}(o.particlePool,e,M,b);const t=.5*(b.speedMultiplier??1);let r;if(b.proportionalSpeed){const t=e.reduce((e,t)=>Math.max(e,t.value||1),1);r=e.map(e=>.3+(e.value||1)/t*1.7)}o.particlePool.step(M,t,e,r),function(e,t,o,r,n){const i=r.radius??3;e.globalAlpha=r.opacity??.7;for(let s=0;t.particles.length>s;s++){const a=t.particles[s];if(!a.active)continue;const l=o[a.edgeIndex];if(!l)continue;let c;c="string"==typeof r.color&&"inherit"!==r.color?r.color:n(l),e.fillStyle=Oo(e,c)||c,e.beginPath(),e.arc(a.x,a.y,i,0,2*Math.PI),e.fill()}e.globalAlpha=1}(A,o.particlePool,e,b,v)}}$&&(A.globalAlpha=1)}l.current=!1,(L||P||_)&&t.setAttribute("aria-label",Zi(o.sceneNodes?.length??0,o.sceneEdges?.length??0,"Network chart"));const N=L||P||_||x.current;N&&C-k.current>=33?(w(e=>e+1),k.current=C,x.current=!1):x.current=!!N,(h||P||null!=o.transition||_||o.hasActivePulses||o.hasActiveThresholds||!1!==p&&o.hasActiveTopologyDiff||x.current)&&S()}({canvas:e,store:t,size:Ve,margin:Xe,adjustedWidth:Ue,adjustedHeight:Ke,background:J,dirtyRef:We,lastFrameTimeRef:bt,reducedMotion:!!Ye.current,showParticles:T,isContinuous:Vt,animate:Se,decay:xe,pulse:ke,thresholds:Ce,staleness:Ae,particleStyle:ht,getParticleColor:Gt,pendingAnnotationFrameRef:xt,lastAnnotationFrameTimeRef:vt,setAnnotationFrame:jt,scheduleNextFrame:()=>{nt()}})},Ri({hydrated:at,wasHydratingFromSSR:lt,storeRef:kt,dirtyRef:We,renderFnRef:rt,cancelRender:it}),(0,ac.useEffect)(()=>{We.current=!0,nt()},[o,Ue,Ke,J,nt]),xr(Ae,kt,We,nt,Pt,Lt);const bo=ee&&wt?(0,Dd.jsx)(Es,{x:wt.x,y:wt.y,containerWidth:Ue,containerHeight:Ke,margin:Xe,className:"stream-network-tooltip",zIndex:2,children:te?te(wt):(0,Dd.jsx)(wd,{data:wt})}):null;if(Si||!at&<){const e=kt.current;if(e){const t=["tree","cluster","treemap","circlepack","partition","orbit"].includes(o),r=t?i||(Array.isArray(n)?void 0:n):void 0;if(t&&r)e.ingestHierarchy(r,[Ue,Ke]),e.buildScene([Ue,Ke]);else{const t=ct,o=Array.isArray(ut)?ut:[];(t.length>0||o.length>0)&&(e.ingestBounded(t,o,[Ue,Ke]),e.buildScene([Ue,Ke]))}}const t=e?.sceneNodes??[],r=e?.sceneEdges??[],s=e?.labels??[];return(0,Dd.jsxs)("div",{ref:Ge,className:"stream-network-frame"+(Z?" "+Z:""),role:"img","aria-label":je||("string"==typeof ye?ye:"Network chart"),style:{position:"relative",width:U?"100%":Ve[0],height:K?"100%":Ve[1]},children:[(0,Dd.jsx)(fs,{summary:Pe}),(0,Dd.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:Ve[0],height:Ve[1],style:{position:"absolute",left:0,top:0},children:[Ze&&(0,Dd.jsx)("g",{transform:`translate(${Xe.left},${Xe.top})`,children:Ze}),(0,Dd.jsxs)("g",{transform:`translate(${Xe.left},${Xe.top})`,children:[J&&(0,Dd.jsx)("rect",{x:0,y:0,width:Ue,height:Ke,fill:J}),r.map((e,t)=>function(e,t){switch(e.type){case"line":return(0,yi.jsx)("line",{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stroke:e.style.stroke||"#999",strokeWidth:e.style.strokeWidth||1,opacity:e.style.opacity},"net-edge-"+t);case"bezier":{const o=e;return(0,yi.jsx)("path",{d:o.pathD,fill:vi(o.style.fill,"#999"),fillOpacity:o.style.fillOpacity,stroke:o.style.stroke||"none",strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},"net-edge-"+t)}case"ribbon":{const o=e;return(0,yi.jsx)("path",{d:o.pathD,fill:vi(o.style.fill,"#999"),fillOpacity:o.style.fillOpacity,stroke:o.style.stroke||"none",strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},"net-edge-"+t)}case"curved":{const o=e;return(0,yi.jsx)("path",{d:o.pathD,fill:vi(o.style.fill,"none"),stroke:o.style.stroke||"#999",strokeWidth:o.style.strokeWidth||1,opacity:o.style.opacity},"net-edge-"+t)}default:return null}}(e,t)).filter(Boolean),t.map((e,t)=>function(e,t){switch(e.type){case"circle":{const o=e;return(0,yi.jsx)("circle",{cx:o.cx,cy:o.cy,r:o.r,fill:vi(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},"net-circle-"+t)}case"rect":{const o=e;return(0,yi.jsx)("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:vi(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},"net-rect-"+t)}case"arc":{const o=e,r=(0,di.arc)().innerRadius(o.innerR).outerRadius(o.outerR).startAngle(o.startAngle+Math.PI/2).endAngle(o.endAngle+Math.PI/2)(bi)||"";return(0,yi.jsx)("path",{d:r,transform:`translate(${o.cx},${o.cy})`,fill:vi(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},"net-arc-"+t)}case"symbol":{const o=e,r=_t(o.symbolType,o.size,o.path);return(0,yi.jsx)("path",{d:r,transform:o.rotation?`translate(${o.cx},${o.cy}) rotate(${180*o.rotation/Math.PI})`:`translate(${o.cx},${o.cy})`,fill:o.style.fill?vi(o.style.fill):"none",stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},"net-symbol-"+t)}case"glyph":return ki(e,e.cx,e.cy,"net-glyph-"+(e.id??t));default:return null}}(e,t)).filter(Boolean),s.map((e,t)=>function(e,t){return(0,yi.jsx)("text",{x:e.x,y:e.y,textAnchor:e.anchor||"middle",dominantBaseline:e.baseline||"auto",fontSize:e.fontSize||11,fontWeight:e.fontWeight,fill:e.fill||"var(--semiotic-text, #333)",stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:e.paintOrder,children:e.text},"net-label-"+t)}(e,t)).filter(Boolean)]})]}),(0,Dd.jsx)(Xu,{width:Ue,height:Ke,totalWidth:Ve[0],totalHeight:Ve[1],margin:Xe,labels:s,sceneNodes:t,title:ye,legend:ue,legendPosition:de,legendLayout:he,legendHoverBehavior:pe,legendClickBehavior:fe,legendHighlightedCategory:ge,legendIsolatedCategories:me,foregroundGraphics:co(Qe,yo(kt.current?.customLayoutOverlays,He??null)),annotations:ae,autoPlaceAnnotations:le,svgAnnotationRules:ce,annotationFrame:0}),(0,Dd.jsx)(Zu,{marks:e?.customLayoutHtmlMarks,margin:Xe,selection:He??null})]})}const ko=kt.current;return(0,Dd.jsxs)("div",{ref:Ge,className:"stream-network-frame"+(Z?" "+Z:""),role:"group","aria-label":je||("string"==typeof ye?ye:"Network chart"),tabIndex:0,"aria-busy":Rt||void 0,style:{position:"relative",width:U?"100%":Ve[0],height:K?"100%":Ve[1],overflow:"visible"},onKeyDown:go,children:[Me&&(0,Dd.jsx)(gs,{tableId:tt}),Me&&(0,Dd.jsx)(ps,{nodes:ko?.sceneNodes??[],edges:ko?.sceneEdges??[],chartType:"Network chart",tableId:tt,chartTitle:"string"==typeof ye?ye:void 0}),(0,Dd.jsx)(fs,{summary:Pe}),(0,Dd.jsx)(ms,{hoverPoint:wt}),(0,Dd.jsxs)("div",{role:"img","aria-label":je||("string"==typeof ye?ye:"Network chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:ee?mo:void 0,onMouseLeave:ee?so:void 0,onClick:re||ne?uo:void 0,children:[Rt&&!1!==k&&(0,Dd.jsx)("div",{style:{position:"absolute",inset:0,zIndex:3,background:"var(--semiotic-bg, #fff)"},children:ud(!0,Ve[0],Ve[1],k)}),Ze&&(0,Dd.jsx)("svg",{overflow:"visible",style:{position:"absolute",top:0,left:0,width:Ve[0],height:Ve[1],pointerEvents:"none",overflow:"visible"},children:(0,Dd.jsx)("g",{transform:`translate(${Xe.left},${Xe.top})`,children:Ze})}),(0,Dd.jsx)("canvas",{ref:yt,"aria-label":Zi(ko?.sceneNodes?.length??0,ko?.sceneEdges?.length??0,"Network chart"),style:{position:"absolute",top:0,left:0}}),(0,Dd.jsx)(Xu,{width:Ue,height:Ke,totalWidth:Ve[0],totalHeight:Ve[1],margin:Xe,labels:ko?.labels||[],sceneNodes:ko?.sceneNodes,title:ye,legend:ue,legendPosition:de,legendLayout:he,legendHoverBehavior:pe,legendClickBehavior:fe,legendHighlightedCategory:ge,legendIsolatedCategories:me,foregroundGraphics:co(Qe,yo(kt.current?.customLayoutOverlays,He??null)),annotations:ae,autoPlaceAnnotations:le,svgAnnotationRules:ce,annotationFrame:Mt}),(0,Dd.jsx)(Zu,{marks:ko?.customLayoutHtmlMarks,margin:Xe,selection:He??null}),(0,Dd.jsx)(vs,{active:ho.current>=0,hoverPoint:wt,margin:Xe,size:Ve,shape:po.current?.shape,width:po.current?.w,height:po.current?.h}),bo,Ae?.showBadge&&(0,Dd.jsx)(wr,{isStale:Pt,position:Ae.badgePosition})]})]})}));Wd.displayName="StreamNetworkFrame";var qd=Wd;function Yd(e){const{title:t,description:o,summary:r,accessibleTable:n,className:i,animate:s,axisExtent:a,autoPlaceAnnotations:l}=e,c={};return t&&(c.title=t),o&&(c.description=o),r&&(c.summary=r),void 0!==n&&(c.accessibleTable=n),i&&(c.className=i),null!=s&&(c.animate=s),void 0!==a&&(c.axisExtent=a),void 0!==l&&(c.autoPlaceAnnotations=l),c}function Gd(e){const{linkedHover:t,selection:o,onObservation:r,onClick:n,hoverRadius:i,hoverHighlight:s,forceHoverBehavior:a,forceClickBehavior:l,mobileInteraction:c,customHoverBehavior:u,customClickBehavior:d,linkedHoverInClickPredicate:h=!0}=e,p={},f=c?.enabled?Math.max(i??30,Math.ceil((c.targetSize||44)/2),24):i;return(a||t||r||n||s)&&(p.customHoverBehavior=u),d&&(l||(h?r||n||t:r||n)||c?.enabled&&(c.tapToSelect||c.tapToLockTooltip)&&(t||s||o))&&(p.customClickBehavior=d),null!=f&&(p.hoverRadius=f),p}function Vd(e){const{tooltip:t,defaultTooltipContent:o}=e;return{tooltipContent:!1===t?()=>null:Bs(t)||o}}var Xd=c(require("react")),Ud=require("react"),Kd=require("react"),Qd=require("react"),Zd=require("react/jsx-runtime"),Jd=(0,Qd.createContext)(null);function eh({colors:e,categories:t,colorScheme:o="category10",children:r}){const n=(0,Qd.useMemo)(()=>{if(e)return e;if(t){if(o&&"object"==typeof o&&!Array.isArray(o)){const e=o,r={};let n=0;for(const o of t)r[o]=We(e,o)??De[n++%De.length];return r}const e=Array.isArray(o)?o:Be[o]||De,r={};for(let o=0;t.length>o;o++)r[t[o]]=e[o%e.length];return r}return{}},[e,t,o]);return(0,Zd.jsx)(Jd.Provider,{value:n,children:r})}function th(){return(0,Qd.useContext)(Jd)}eh.displayName="CategoryColorProvider";var oh=require("react");function rh(e){const t=[];for(const[o,r]of Object.entries(e.fields))if("point"===r.type)t.push(e=>r.values.has(e[o]));else{const[e,n]=r.range;t.push(t=>{const r=t[o];return r>=e&&n>=r})}return e=>t.every(t=>t(e))}function nh(e,t){const o=[];for(const[r,n]of e.clauses)"crossfilter"===e.resolution&&r===t||o.push(rh(n));return 0===o.length?()=>!0:"intersect"===e.resolution?e=>o.every(t=>t(e)):e=>o.some(t=>t(e))}function ih(e,t){let o=e.get(t);return o||(o={name:t,resolution:"union",clauses:new Map},e.set(t,o)),o}function sh(e,t){if(e.type!==t.type)return!1;if("interval"===e.type&&"interval"===t.type)return e.range[0]===t.range[0]&&e.range[1]===t.range[1];if("point"===e.type&&"point"===t.type){if(e.values.size!==t.values.size)return!1;for(const o of e.values)if(!t.values.has(o))return!1;return!0}return!1}var[ah,lh]=q(e=>({selections:new Map,setClause(t,o){e(e=>{const r=e.selections.get(t),n=r?.clauses.get(o.clientId);if(n&&function(e,t){if(e.clientId!==t.clientId||e.type!==t.type)return!1;const o=Object.entries(e.fields);if(o.length!==function(e){let t=0;for(const o in e)t++;return t}(t.fields))return!1;for(const[e,r]of o){const o=t.fields[e];if(!o||!sh(r,o))return!1}return!0}(n,o))return{};const i=new Map(e.selections),s=ih(i,t),a=new Map(s.clauses);return a.set(o.clientId,o),i.set(t,{...s,clauses:a}),{selections:i}})},clearClause(t,o){e(e=>{const r=e.selections.get(t);if(!r||!r.clauses.has(o))return{};const n=new Map(e.selections),i=new Map(r.clauses);return i.delete(o),n.set(t,{...r,clauses:i}),{selections:n}})},setResolution(t,o){e(e=>{const r=e.selections.get(t);if(r?.resolution===o)return{};const n=new Map(e.selections),i=ih(n,t);return n.set(t,{...i,resolution:o}),{selections:n}})},clearSelection(t){e(e=>{const o=e.selections.get(t);if(!o||0===o.clauses.size)return{};const r=new Map(e.selections);return r.set(t,{...o,clauses:new Map}),{selections:r}})}})),[ch,uh]=q(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const o=e.observations;return o.push(t),o.length>e.maxObservations&&o.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}})),dh=require("react");function hh(e){const t=(0,dh.useId)(),o=e.clientId||t,{name:r}=e,n=lh(e=>e.selections.get(r)),i=lh(e=>e.setClause),s=lh(e=>e.clearClause),a=(0,dh.useMemo)(()=>!!n&&n.clauses.size>0,[n]);return{predicate:(0,dh.useMemo)(()=>n&&0!==n.clauses.size?nh(n,o):()=>!0,[n,o]),isActive:a,selectPoints:(0,dh.useCallback)(e=>{const t={};let n=!1;for(const[o,r]of Object.entries(e))t[o]={type:"point",values:new Set(r)},n=!0;n&&i(r,{clientId:o,type:"point",fields:t})},[o,r,i]),selectInterval:(0,dh.useCallback)(e=>{const t={};let n=!1;for(const[o,r]of Object.entries(e))t[o]={type:"interval",range:r},n=!0;n&&i(r,{clientId:o,type:"interval",fields:t})},[o,r,i]),clear:(0,dh.useCallback)(()=>{s(r,o)},[s,r,o]),clientId:o}}function ph(e,t){const o=(0,dh.useId)(),r=t||o,n=lh(e=>e.setClause),i=lh(e=>e.clearClause);return{selectPoints:(0,dh.useCallback)(t=>{const o={};let i=!1;for(const[e,r]of Object.entries(t))o[e]={type:"point",values:new Set(r)},i=!0;i&&n(e,{clientId:r,type:"point",fields:o})},[e,r,n]),clear:(0,dh.useCallback)(()=>i(e,r),[e,r,i]),clientId:r}}function fh(e){const t=e.name||"hover",{fields:o}=e,{predicate:r,isActive:n,selectPoints:i,clear:s}=hh({name:t,fields:o});return{onHover:(0,dh.useCallback)(e=>{if(!e)return void s();const t={};for(const r of o){const o=e[r];void 0!==o&&(t[r]=[o])}yh(t)&&i(t)},[o,i,s,t]),predicate:r,isActive:n}}function gh(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function mh(e){const{name:t,xField:o,yField:r}=e,{predicate:n,isActive:i,selectInterval:s,clear:a}=hh({name:t,fields:[o,r].filter(Boolean)}),l=o&&r?"xyBrush":o?"xBrush":"yBrush",c=(0,dh.useCallback)(e=>{if(!e)return void a();const t={};"xyBrush"===l&&function(e){return 2===e.length&&Array.isArray(e[0])&&2===e[0].length&&Array.isArray(e[1])&&2===e[1].length}(e)?(o&&(t[o]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),r&&(t[r]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===l&&gh(e)?o&&(t[o]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]):"yBrush"===l&&gh(e)&&r&&(t[r]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]),yh(t)&&s(t)},[l,o,r,s,a]);return{brushInteraction:(0,dh.useMemo)(()=>({brush:l,during:c,end:c}),[l,c]),predicate:n,isActive:i,clear:a}}function yh(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function bh(e,t,o){const r=lh(e=>e.selections.get(t));return(0,dh.useMemo)(()=>{if(!r||0===r.clauses.size)return e;const t=nh(r,o);return e.filter(t)},[e,r,o])}var vh=require("react");function xh(e={}){const{limit:t=50,types:o,chartId:r}=e,n=uh(e=>e.version),i=uh(e=>e.observations),s=uh(e=>e.clearObservations),a=(0,vh.useMemo)(()=>{let e=i;if(o&&o.length>0){const t=new Set(o);e=e.filter(e=>t.has(e.type))}return r&&(e=e.filter(e=>e.chartId===r)),e.length>t&&(e=e.slice(e.length-t)),e},[i,o,r,t,n]);return{observations:a,latest:a.length>0?a[a.length-1]:null,clear:s}}var kh=require("react/jsx-runtime"),wh=(0,oh.createContext)(!1),Sh=(0,oh.createContext)(!1);function Ah(){return(0,oh.useContext)(Sh)}var Ch=(0,oh.createContext)(null),Mh="undefined"==typeof window?oh.useEffect:oh.useLayoutEffect;function jh(e){const t=new Set,o=[];for(const r of e)t.has(r)||(t.add(r),o.push(r));return o}function Ph(e,t){if(e.length!==t.length)return!1;for(let o=0;e.length>o;o++)if(e[o]!==t[o])return!1;return!0}function _h(e){const t=(0,oh.useContext)(Ch),o=(0,oh.useId)(),r=jh(e),n=(0,oh.useRef)([]);Ph(n.current,r)||(n.current=r);const i=n.current;Mh(()=>{if(t)return()=>t.unregisterCategories(o)},[t,o]),Mh(()=>{t&&t.registerCategories(o,i)},[t,o,i])}var Lh="__linked-legend-isolate__",Rh="__linked-legend-highlight__";function Th({categoryColors:e,interaction:t,selectionName:o,field:r}){const n=Object.entries(e),i=n.map(([e])=>e),s=[{styleFn:e=>({fill:e.color||"#333",stroke:e.color||"#333"}),type:"fill",items:n.map(([e,t])=>({label:e,color:t})),label:""}],{selectPoints:a,clear:l}=hh({name:o,fields:[r],clientId:Lh}),{selectPoints:c,clear:u}=hh({name:o,fields:[r],clientId:Rh}),d=lh(e=>e.selections.get(o)),{isolatedCategories:h,highlightedCategory:p}=(0,oh.useMemo)(()=>{const e=new Set;let t=null;const o=d?.clauses.get(Lh)?.fields[r];if("point"===o?.type)for(const t of o.values)e.add(t+"");const n=d?.clauses.get(Rh)?.fields[r];if("point"===n?.type){const e=n.values.values().next().value;null!=e&&(t=e+"")}return{isolatedCategories:e,highlightedCategory:t}},[d,r]),f=(0,oh.useCallback)(e=>{"highlight"===t&&(e?c({[r]:[e.label]}):u())},[t,r,c,u]),g=(0,oh.useCallback)(e=>{if("isolate"!==t)return;const o=new Set(h);o.has(e.label)?o.delete(e.label):o.add(e.label),0===o.size||o.size===i.length?l():a({[r]:Array.from(o)})},[t,r,h,i.length,a,l]),[m,[y]]=Ys([0,0],!0,!1),b=(0,oh.useMemo)(()=>function(e,t){if(!t||0===e.length)return 1;let o=0,r=1;for(const n of e){const e=26+7*n.length;o>0&&o+e>t&&(r++,o=0),o+=e}return r}(n.map(([e])=>e),y),[n,y]);return 0===n.length?null:(0,kh.jsx)("div",{ref:m,style:{width:"100%",display:"block"},children:(0,kh.jsx)("svg",{width:"100%",height:Math.max(30,22*b+8),style:{display:"block",overflow:"visible"},children:(0,kh.jsx)(Dr,{legendGroups:s,title:!1,orientation:"horizontal",width:y,height:20,customHoverBehavior:"highlight"===t?f:void 0,customClickBehavior:"isolate"===t?g:void 0,highlightedCategory:p,isolatedCategories:h})})})}function Ih({children:e,selections:t,showLegend:o,legendPosition:r="top",legendInteraction:n="none",legendSelectionName:i="legend",legendField:s="category"}){const a=(0,oh.useMemo)(()=>{if(!t)return;const e=new Map;for(const[o,r]of Object.entries(t))r.resolution&&e.set(o,{name:o,resolution:r.resolution,clauses:new Map});return e.size>0?{selections:e}:void 0},[t]),l=th(),[c,u]=(0,oh.useState)({}),d=(0,oh.useRef)({}),h=(0,oh.useMemo)(()=>({registerCategories:(e,t)=>{const o=jh(t);u(t=>Ph(t[e]??[],o)?t:{...t,[e]:o})},unregisterCategories:e=>{u(t=>{if(!(e in t))return t;const o={...t};return delete o[e],o})}}),[]),p=(0,oh.useMemo)(()=>{const e=[];for(const t of Object.values(c))for(const o of t)e.push(o);return jh(e)},[c]),f=(0,oh.useMemo)(()=>{const e=l??{},t=d.current;let o=Object.keys(e).length+Object.keys(t).length;for(const r of p)e[r]||t[r]||(t[r]=De[o%De.length],o++);const r={...e};for(const o of p)r[o]=e[o]??t[o];return r},[l,p]),g=void 0===o||o,m=Object.keys(f).length>0;return(0,kh.jsx)(ah,{initialState:a,children:(0,kh.jsx)(ch,{children:(0,kh.jsx)(Sh.Provider,{value:!0,children:(0,kh.jsx)(Ch.Provider,{value:h,children:(0,kh.jsx)(eh,{colors:f,children:(0,kh.jsxs)(wh.Provider,{value:g&&m,children:[g&&"top"===r&&(0,kh.jsx)(Th,{categoryColors:f,interaction:n,selectionName:i,field:s}),e,g&&"bottom"===r&&(0,kh.jsx)(Th,{categoryColors:f,interaction:n,selectionName:i,field:s})]})})})})})})}function $h({data:e,colorBy:t,colorScale:o,getColor:r,strokeColor:n,strokeWidth:i,categories:s}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",o={fill:t,stroke:t};return void 0!==n&&(o.stroke=n),void 0!==i&&(o.strokeWidth=i),o},type:"fill",items:(s&&s.length>0?s:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((n,i)=>{const s=e.find("function"==typeof t?e=>t(e)===n:e=>e[t]===n),a=s?r(s,t,o):o?o(n):Ee[i%Ee.length];return{label:n+"",color:a}}),label:""}]}}function Nh(e){return e?"string"==typeof e?{name:e}:e:null}var Fh=.5;function Bh(e,t,o){return t?(r,...n)=>{const i={...e(r,...n)};if(t.isActive)if(t.predicate(r))o?.selectedStyle&&Object.assign(i,o.selectedStyle);else{const e=o?.unselectedOpacity??Fh;i.opacity=e,i.fillOpacity=e,i.strokeOpacity=e,o?.unselectedStyle&&Object.assign(i,o.unselectedStyle)}return i}:e}var Dh=c(require("react"));function Eh(e,t=":root"){const o=[];return o.push(` --semiotic-bg: ${e.colors.background};`),o.push(` --semiotic-text: ${e.colors.text};`),o.push(` --semiotic-text-secondary: ${e.colors.textSecondary};`),o.push(` --semiotic-grid: ${e.colors.grid};`),o.push(` --semiotic-border: ${e.colors.border};`),o.push(` --semiotic-primary: ${e.colors.primary};`),o.push(` --semiotic-font-family: ${e.typography.fontFamily};`),e.colors.focus&&o.push(` --semiotic-focus: ${e.colors.focus};`),e.colors.selection&&o.push(` --semiotic-selection-color: ${e.colors.selection};`),null!=e.colors.selectionOpacity&&o.push(` --semiotic-selection-opacity: ${e.colors.selectionOpacity};`),e.colors.diverging&&o.push(` --semiotic-diverging: ${e.colors.diverging};`),e.tooltip?.background&&o.push(` --semiotic-tooltip-bg: ${e.tooltip.background};`),e.tooltip?.text&&o.push(` --semiotic-tooltip-text: ${e.tooltip.text};`),e.tooltip?.borderRadius&&o.push(` --semiotic-tooltip-radius: ${e.tooltip.borderRadius};`),e.tooltip?.fontSize&&o.push(` --semiotic-tooltip-font-size: ${e.tooltip.fontSize};`),e.tooltip?.shadow&&o.push(` --semiotic-tooltip-shadow: ${e.tooltip.shadow};`),e.borderRadius&&o.push(` --semiotic-border-radius: ${e.borderRadius};`),e.colors.annotation&&o.push(` --semiotic-annotation-color: ${e.colors.annotation};`),null!=e.typography.legendSize&&o.push(` --semiotic-legend-font-size: ${e.typography.legendSize}px;`),null!=e.typography.titleFontSize&&o.push(` --semiotic-title-font-size: ${e.typography.titleFontSize}px;`),null!=e.typography.tickFontFamily&&o.push(` --semiotic-tick-font-family: ${e.typography.tickFontFamily};`),null!=e.typography.tickSize&&o.push(` --semiotic-tick-font-size: ${e.typography.tickSize}px;`),null!=e.typography.labelSize&&o.push(` --semiotic-axis-label-font-size: ${e.typography.labelSize}px;`),o.push(` --semiotic-secondary: ${e.colors.secondary||e.colors.primary};`),o.push(` --semiotic-surface: ${e.colors.surface||e.colors.background};`),e.colors.success&&o.push(` --semiotic-success: ${e.colors.success};`),e.colors.danger&&o.push(` --semiotic-danger: ${e.colors.danger};`),e.colors.warning&&o.push(` --semiotic-warning: ${e.colors.warning};`),e.colors.error&&o.push(` --semiotic-error: ${e.colors.error};`),e.colors.info&&o.push(` --semiotic-info: ${e.colors.info};`),`${t} {\n${o.join("\n")}\n}`}function zh(e){return{semiotic:{bg:{$value:e.colors.background,$type:"color"},text:{$value:e.colors.text,$type:"color"},"text-secondary":{$value:e.colors.textSecondary,$type:"color"},grid:{$value:e.colors.grid,$type:"color"},border:{$value:e.colors.border,$type:"color"},primary:{$value:e.colors.primary,$type:"color"},focus:{$value:e.colors.focus||e.colors.primary,$type:"color"},"font-family":{$value:e.typography.fontFamily,$type:"fontFamily"},"border-radius":{$value:e.borderRadius||"8px",$type:"dimension"},tooltip:{bg:{$value:e.tooltip?.background||e.colors.background,$type:"color"},text:{$value:e.tooltip?.text||e.colors.text,$type:"color"},radius:{$value:e.tooltip?.borderRadius||"6px",$type:"dimension"},"font-size":{$value:e.tooltip?.fontSize||"14px",$type:"dimension"},shadow:{$value:e.tooltip?.shadow||"0 2px 8px rgba(0,0,0,0.15)",$type:"shadow"}},selection:{color:{$value:e.colors.selection||e.colors.primary,$type:"color"},opacity:{$value:e.colors.selectionOpacity??.2,$type:"number"}},categorical:{$value:e.colors.categorical,$type:"color",$description:"Categorical color palette"},sequential:{$value:e.colors.sequential,$type:"string",$description:"d3-scale-chromatic sequential scheme name"},...e.colors.diverging?{diverging:{$value:e.colors.diverging,$type:"string",$description:"d3-scale-chromatic diverging scheme name"}}:{},...e.colors.annotation?{"annotation-color":{$value:e.colors.annotation,$type:"color"}}:{},...null!=e.typography.legendSize?{"legend-font-size":{$value:e.typography.legendSize+"px",$type:"dimension"}}:{},...null!=e.typography.titleFontSize?{"title-font-size":{$value:e.typography.titleFontSize+"px",$type:"dimension"}}:{},...null!=e.typography.tickFontFamily?{"tick-font-family":{$value:e.typography.tickFontFamily,$type:"fontFamily"}}:{},...null!=e.typography.tickSize?{"tick-font-size":{$value:e.typography.tickSize+"px",$type:"dimension"}}:{},...null!=e.typography.labelSize?{"axis-label-font-size":{$value:e.typography.labelSize+"px",$type:"dimension"}}:{},secondary:{$value:e.colors.secondary||e.colors.primary,$type:"color"},surface:{$value:e.colors.surface||e.colors.background,$type:"color"},...e.colors.success?{success:{$value:e.colors.success,$type:"color"}}:{},...e.colors.danger?{danger:{$value:e.colors.danger,$type:"color"}}:{},...e.colors.warning?{warning:{$value:e.colors.warning,$type:"color"}}:{},...e.colors.error?{error:{$value:e.colors.error,$type:"color"}}:{},...e.colors.info?{info:{$value:e.colors.info,$type:"color"}}:{}}}}var Hh=["#6929c4","#1192e8","#005d5d","#9f1853","#fa4d56","#570408","#198038","#002d9c","#ee538b","#b28600","#009d9a","#012749","#8a3800","#a56eff"],Oh={danger:"#da1e28",warning:"#f1c21b",success:"#24a148",info:"#0043ce"},Wh={light:U,dark:K,"high-contrast":Q,pastels:{mode:"light",colors:{primary:"#c9a0dc",secondary:"#b8a8c8",categorical:["#f0a0c0","#88d4ab","#b0a0e8","#f0c888"],sequential:"purples",background:"#fdf6f0",surface:"#fff5ee",text:"#4a3728",textSecondary:"#7a644a",grid:"#e8d5c4",border:"#e8d5c4",focus:"#8a5fae",annotation:"#8a5fae",success:"#9ad4a3",danger:"#e8869a",warning:"#f0c888",error:"#c86070",info:"#9cb8e0"},typography:{fontFamily:"Inter, system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#fff5ee",text:"#4a3728",borderRadius:"8px",shadow:"0 2px 8px rgba(0, 0, 0, 0.12)"},borderRadius:"10px"},"pastels-dark":{mode:"dark",colors:{primary:"#c9a0dc",secondary:"#a899c0",categorical:["#f0a0c0","#88d4ab","#b0a0e8","#f0c888"],sequential:"purples",background:"#1a1525",surface:"#251e35",text:"#e8ddf0",textSecondary:"#a899c0",grid:"#3d3455",border:"#3d3455",focus:"#c9a0dc",annotation:"#c9a0dc",success:"#88d4ab",danger:"#f0a0c0",warning:"#f0c888",error:"#e87690",info:"#9cb8e0"},typography:{fontFamily:"Inter, system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#251e35",text:"#e8ddf0",borderRadius:"8px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"10px"},"bi-tool":{mode:"light",colors:{primary:"#2563eb",secondary:"#6b7280",categorical:["#2563eb","#0d9488","#ea580c","#6b7280"],sequential:"blues",background:"#f5f6f8",surface:"#ffffff",text:"#2c3e50",textSecondary:"#64717f",grid:"#d8dce3",border:"#d8dce3",focus:"#2563eb",annotation:"#2563eb",success:"#10b981",danger:"#ef4444",warning:"#f59e0b",error:"#dc2626",info:"#2563eb"},typography:{fontFamily:"'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#ffffff",text:"#2c3e50",borderRadius:"6px",shadow:"0 2px 8px rgba(0, 0, 0, 0.12)"},borderRadius:"8px"},"bi-tool-dark":{mode:"dark",colors:{primary:"#3b82f6",secondary:"#9ca3af",categorical:["#3b82f6","#14b8a6","#f97316","#9ca3af"],sequential:"blues",background:"#111827",surface:"#1f2937",text:"#f3f4f6",textSecondary:"#9ca3af",grid:"#374151",border:"#374151",focus:"#3b82f6",annotation:"#3b82f6",success:"#34d399",danger:"#f87171",warning:"#fbbf24",error:"#ef4444",info:"#60a5fa"},typography:{fontFamily:"'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#1f2937",text:"#f3f4f6",borderRadius:"6px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"8px"},italian:{mode:"light",colors:{primary:"#cc0000",secondary:"#666666",categorical:["#cc0000","#333333","#c8a415","#4682b4"],sequential:"reds",background:"#fafafa",surface:"#ffffff",text:"#1a1a1a",textSecondary:"#666666",grid:"#e0e0e0",border:"#e0e0e0",focus:"#cc0000",annotation:"#cc0000",success:"#556b2f",danger:"#cc0000",warning:"#c8a415",error:"#8b0000",info:"#4682b4"},typography:{fontFamily:"'Helvetica Neue', Helvetica, Arial, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#ffffff",text:"#1a1a1a",borderRadius:"2px",shadow:"0 2px 4px rgba(0, 0, 0, 0.15)"},borderRadius:"2px"},"italian-dark":{mode:"dark",colors:{primary:"#ff3333",secondary:"#aaaaaa",categorical:["#ff3333","#aaaaaa","#d4a843","#6aa4d4"],sequential:"reds",background:"#0a0a0a",surface:"#1a1a1a",text:"#f5f5f5",textSecondary:"#aaaaaa",grid:"#333333",border:"#333333",focus:"#ff3333",annotation:"#ff3333",success:"#7a8b5a",danger:"#ff3333",warning:"#d4a843",error:"#cc0000",info:"#6aa4d4"},typography:{fontFamily:"'Helvetica Neue', Helvetica, Arial, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#1a1a1a",text:"#f5f5f5",borderRadius:"2px",shadow:"0 2px 8px rgba(0, 0, 0, 0.5)"},borderRadius:"2px"},tufte:{mode:"light",colors:{primary:"#8b0000",secondary:"#555555",categorical:["#8b4513","#556b2f","#4a5568","#800020"],sequential:"oranges",background:"#fffff8",surface:"#fffff8",text:"#111111",textSecondary:"#555555",grid:"#e0ddd0",border:"#e0ddd0",focus:"#8b0000",annotation:"#8b0000",success:"#556b2f",danger:"#8b0000",warning:"#b88700",error:"#6b0000",info:"#4a5568"},typography:{fontFamily:"Georgia, 'Times New Roman', serif",titleSize:16,labelSize:12,tickSize:12,tickFontFamily:"'Courier New', Courier, monospace",legendSize:11},tooltip:{background:"#fffff8",text:"#111111",borderRadius:"2px",shadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},borderRadius:"0px"},"tufte-dark":{mode:"dark",colors:{primary:"#c05050",secondary:"#a09880",categorical:["#c08050","#7a8b5a","#8090a0","#a05060"],sequential:"oranges",background:"#1c1b18",surface:"#262520",text:"#e8e4d8",textSecondary:"#a09880",grid:"#3d3c35",border:"#3d3c35",focus:"#c05050",annotation:"#d06a6a",success:"#7a8b5a",danger:"#c05050",warning:"#c8a060",error:"#a04040",info:"#8090a0"},typography:{fontFamily:"Georgia, 'Times New Roman', serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#262520",text:"#e8e4d8",borderRadius:"2px",shadow:"0 2px 6px rgba(0, 0, 0, 0.4)"},borderRadius:"0px"},journalist:{mode:"light",colors:{primary:"#e45050",secondary:"#666666",categorical:["#3a86c8","#e45050","#d4a843","#888888"],sequential:"blues",background:"#ffffff",surface:"#f8f8f8",text:"#222222",textSecondary:"#666666",grid:"#d4d4d4",border:"#d4d4d4",focus:"#e45050",annotation:"#c63b3b",success:"#2d7a3d",danger:"#c8303a",warning:"#d4a843",error:"#a02028",info:"#3a86c8"},typography:{fontFamily:"'Franklin Gothic Medium', 'Libre Franklin', Arial, sans-serif",titleSize:18,labelSize:12,tickSize:12,tickFontFamily:"'Courier New', Courier, monospace",legendSize:11},tooltip:{background:"#f8f8f8",text:"#222222",borderRadius:"4px",shadow:"0 2px 6px rgba(0, 0, 0, 0.12)"},borderRadius:"4px"},"journalist-dark":{mode:"dark",colors:{primary:"#ff6b6b",secondary:"#a0a0a0",categorical:["#5a9fd8","#ff6b6b","#e0c060","#aaaaaa"],sequential:"blues",background:"#141414",surface:"#1e1e1e",text:"#ededed",textSecondary:"#a0a0a0",grid:"#383838",border:"#383838",focus:"#ff6b6b",annotation:"#ff6b6b",success:"#6fba78",danger:"#ff6b6b",warning:"#e0c060",error:"#d04040",info:"#5a9fd8"},typography:{fontFamily:"'Franklin Gothic Medium', 'Libre Franklin', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#1e1e1e",text:"#ededed",borderRadius:"4px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"4px"},playful:{mode:"light",colors:{primary:"#8b5cf6",secondary:"#7c5a9e",categorical:["#8b5cf6","#ec4899","#06b6d4","#84cc16"],sequential:"viridis",background:"#fdf8ff",surface:"#ffffff",text:"#2d1b4e",textSecondary:"#7c5a9e",grid:"#e8d0f8",border:"#e8d0f8",focus:"#8b5cf6",annotation:"#7a47e8",success:"#10d870",danger:"#ff4b6e",warning:"#ffaa33",error:"#e11d48",info:"#06b6d4"},typography:{fontFamily:"'Nunito', 'Poppins', system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#ffffff",text:"#2d1b4e",borderRadius:"12px",shadow:"0 4px 12px rgba(139, 92, 246, 0.15)"},borderRadius:"12px"},"playful-dark":{mode:"dark",colors:{primary:"#a78bfa",secondary:"#b8a0d8",categorical:["#a78bfa","#f472b6","#22d3ee","#a3e635"],sequential:"viridis",background:"#150a28",surface:"#1f1138",text:"#f0e8ff",textSecondary:"#b8a0d8",grid:"#3a2560",border:"#3a2560",focus:"#a78bfa",annotation:"#a78bfa",success:"#4ade80",danger:"#fb7185",warning:"#fbbf24",error:"#f43f5e",info:"#22d3ee"},typography:{fontFamily:"'Nunito', 'Poppins', system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#1f1138",text:"#f0e8ff",borderRadius:"12px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"12px"},carbon:{mode:"light",colors:{primary:"#0f62fe",secondary:"#525252",categorical:["#6929c4","#1192e8","#005d5d","#9f1853"],sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#161616",textSecondary:"#525252",grid:"#e0e0e0",border:"#e0e0e0",focus:"#0f62fe",annotation:"#0f62fe",success:"#24a148",danger:"#da1e28",warning:"#f1c21b",error:"#a2191f",info:"#0043ce"},typography:{fontFamily:"'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#ffffff",text:"#161616",borderRadius:"2px",shadow:"0 2px 6px rgba(0, 0, 0, 0.2)"},borderRadius:"0px"},"carbon-dark":{mode:"dark",colors:{primary:"#4589ff",secondary:"#a8a8a8",categorical:["#a56eff","#33b1ff","#08bdba","#ff7eb6"],sequential:"blues",diverging:"RdBu",background:"#161616",surface:"#262626",text:"#f4f4f4",textSecondary:"#a8a8a8",grid:"#393939",border:"#393939",focus:"#4589ff",annotation:"#4589ff",success:"#42be65",danger:"#fa4d56",warning:"#f1c21b",error:"#da1e28",info:"#4589ff"},typography:{fontFamily:"'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#262626",text:"#f4f4f4",borderRadius:"2px",shadow:"0 4px 12px rgba(0, 0, 0, 0.5)"},borderRadius:"0px"}};function qh(e){return Wh[e]}var Yh=require("react/jsx-runtime"),Gh=Dh.createContext(void 0),Vh="undefined"==typeof window?Dh.useEffect:Dh.useLayoutEffect;function Xh(e){if("string"!=typeof e)return e;if("light"===e||"dark"===e||"high-contrast"===e)return e;return qh(e)||(void 0!==console&&console.warn(`[ThemeProvider] Unknown theme preset "${e}". Falling back to light theme.`),"light")}function Uh({theme:e}){const t=ee(e=>e.setTheme),o=ee(e=>e.theme),r=Dh.useRef(o);r.current=o;const n=Dh.useRef(null);Dh.useEffect(()=>{if(void 0!==e)return;if("undefined"==typeof window||!window.matchMedia)return;const o=window.matchMedia("(forced-colors: active)");return o.matches&&(n.current=r.current===Q?U:r.current,t("high-contrast")),Ws(o,e=>{e.matches?(n.current=r.current===Q?n.current??U:r.current,t("high-contrast")):(function(e,t){e(t===U?"light":t===K?"dark":t===Q?"high-contrast":t)}(t,n.current??U),n.current=null)})},[e,t]);const i=Dh.useRef(!1);return Vh(()=>{i.current?void 0!==e&&t(Xh(e)):i.current=!0},[e,t]),null}function Kh({children:e}){const t=ee(e=>e.theme),o={position:"relative","--semiotic-bg":t.colors.background,"--semiotic-text":t.colors.text,"--semiotic-text-secondary":t.colors.textSecondary,"--semiotic-grid":t.colors.grid,"--semiotic-border":t.colors.border,"--semiotic-cell-border":t.colors.cellBorder||t.colors.border,"--semiotic-primary":t.colors.primary,"--semiotic-font-family":t.typography.fontFamily,...t.colors.focus?{"--semiotic-focus":t.colors.focus}:{},...t.tooltip?.background?{"--semiotic-tooltip-bg":t.tooltip.background}:{},...t.tooltip?.text?{"--semiotic-tooltip-text":t.tooltip.text}:{},...t.tooltip?.borderRadius?{"--semiotic-tooltip-radius":t.tooltip.borderRadius}:{},...t.tooltip?.fontSize?{"--semiotic-tooltip-font-size":t.tooltip.fontSize}:{},...t.tooltip?.shadow?{"--semiotic-tooltip-shadow":t.tooltip.shadow}:{},...t.borderRadius?{"--semiotic-border-radius":t.borderRadius}:{},...t.colors.selection?{"--semiotic-selection-color":t.colors.selection}:{},...null!=t.colors.selectionOpacity?{"--semiotic-selection-opacity":t.colors.selectionOpacity+""}:{},...t.colors.diverging?{"--semiotic-diverging":t.colors.diverging}:{},...t.colors.annotation?{"--semiotic-annotation-color":t.colors.annotation}:{},...null!=t.typography.legendSize?{"--semiotic-legend-font-size":t.typography.legendSize+"px"}:{},...null!=t.typography.titleFontSize?{"--semiotic-title-font-size":t.typography.titleFontSize+"px"}:{},...null!=t.typography.tickFontFamily?{"--semiotic-tick-font-family":t.typography.tickFontFamily}:{},...null!=t.typography.tickSize?{"--semiotic-tick-font-size":t.typography.tickSize+"px"}:{},...null!=t.typography.labelSize?{"--semiotic-axis-label-font-size":t.typography.labelSize+"px"}:{},"--semiotic-secondary":t.colors.secondary||t.colors.primary,"--semiotic-surface":t.colors.surface||t.colors.background,...t.colors.success?{"--semiotic-success":t.colors.success}:{},...t.colors.danger?{"--semiotic-danger":t.colors.danger}:{},...t.colors.warning?{"--semiotic-warning":t.colors.warning}:{},...t.colors.error?{"--semiotic-error":t.colors.error}:{},...t.colors.info?{"--semiotic-info":t.colors.info}:{}},r=Dh.useContext(Gh),n={};return r&&(n["data-semiotic-theme"]=r),(0,Yh.jsx)("div",{style:o,...n,children:e})}function Qh({theme:e,children:t}){const o="string"==typeof e&&qh(e)?e:void 0,r=Dh.useMemo(()=>function(e){return void 0!==e?Z(U,Xh(e)):"undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(forced-colors: active)").matches?Q:U}(e),[e]);return(0,Yh.jsx)(J,{initialState:{theme:r},children:(0,Yh.jsxs)(Gh.Provider,{value:o,children:[(0,Yh.jsx)(Uh,{theme:e}),(0,Yh.jsx)(Kh,{children:t})]})})}function Zh(){return ee(e=>e.theme)}function Jh(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function ep(e,t){const{when:o}=e,r=t.width,n=t.height,i=function(e){if("number"==typeof e.height&&e.height>0)return e.width/e.height}(t),s=function(e){if("number"==typeof e.height&&e.height>0)return e.height>e.width?"portrait":"landscape"}(t);return!("number"==typeof o.minWidth&&o.minWidth>r||"number"==typeof o.maxWidth&&r>o.maxWidth||"number"==typeof o.minHeight&&("number"!=typeof n||o.minHeight>n)||"number"==typeof o.maxHeight&&("number"!=typeof n||n>o.maxHeight)||"number"==typeof o.minAspectRatio&&("number"!=typeof i||o.minAspectRatio>i)||"number"==typeof o.maxAspectRatio&&("number"!=typeof i||i>o.maxAspectRatio)||o.orientation&&s!==o.orientation)}function tp(e,t,o=e.responsiveRules){if(!Array.isArray(o)||0===o.length)return{props:e,matches:[]};const r=o.map((e,t)=>({rule:e,index:t})).filter(e=>ep(e.rule,t)).sort((e,t)=>("number"==typeof e.rule.priority?e.rule.priority:e.index)-("number"==typeof t.rule.priority?t.rule.priority:t.index));return{props:r.reduce((e,t)=>function(e,t){const o={...e,...t};for(const r of["margin","frameProps","mobileSemantics","style"])Jh(e[r])&&Jh(t[r])&&(o[r]={...e[r],...t[r]});return"string"==typeof e.className&&"string"==typeof t.className&&(o.className=`${e.className} ${t.className}`),o}(e,t.rule.transform),e),matches:r}}var op="#007bff";function rp(e,t,o){const r=e.xValue??t?.[o];if(null==r)return null;const n=Number(r);return Number.isFinite(n)?n:null}function np(e){let t=e.data||e.datum||e;return Array.isArray(t)&&(t=t[0]),null!=e.xValue&&t&&"object"==typeof t&&!Array.isArray(t)&&null==t.xValue?{...t,xValue:e.xValue}:t||{}}function ip(e){if(!e)return!1;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}var sp=44,ap={enabled:!0,tapToSelect:!0,tapToLockTooltip:!0,clearSelection:"backgroundTap",targetSize:sp,snap:"nearestDatum",brushHandleSize:sp,standardControls:!1,enabled:!1,tapToSelect:!1,tapToLockTooltip:!1};function lp(e,t={}){const o=t.mobileSemantics?.interaction,r="number"==typeof o?.targetSize?o.targetSize:"number"==typeof t.mobileSemantics?.minimumHitTarget?t.mobileSemantics.minimumHitTarget:void 0,n="mobile"===t.mode||"number"==typeof t.width&&480>=t.width,i=!!o||void 0!==r,s=e&&"object"==typeof e?e:void 0;if(!1===e||!1===s?.enabled||void 0===e&&!n&&!i)return ap;const a=s??{};return{enabled:!0,tapToSelect:a.tapToSelect??!0,tapToLockTooltip:a.tapToLockTooltip??!0,clearSelection:a.clearSelection??"backgroundTap",targetSize:a.targetSize??r??sp,snap:a.snap??"nearestDatum",brushHandleSize:a.brushHandleSize??sp,standardControls:a.standardControls??!1}}function cp(){const e=Zh(),t=e?.colors?.categorical;return t&&t.length>0?t:void 0}function up(e,t,o,r,n){if(e)return e;if(o&&"object"==typeof o&&!Array.isArray(o)){const e=We(o,r);if(e)return e}let i;if(Array.isArray(o))i=o;else if(t&&t.length>0)i=t;else if("string"==typeof o){const e=Be[o];Array.isArray(e)&&(i=e)}return i&&0!==i.length?null!=r?(n.has(r)||n.set(r,n.size),i[n.get(r)%i.length]):i[0]:op}function dp(e,t,o){const r=th(),n=cp();return(0,Kd.useMemo)(()=>{if(!t)return;const i=r??void 0,s=o??(n&&n.length>0?n:void 0)??"category10";if(0!==e.length){if("function"==typeof t){const o=Array.from(new Set(e.map(e=>t(e)+"")));if(i&&ip(i)){const e=qe(o.map(e=>({_cat:e})),"_cat",s);return t=>i[t]||e(t)}return qe(o.map(e=>({_cat:e})),"_cat",s)}if(i&&ip(i)){const o=qe(e,t,s);return e=>i[e]||o(e)}return qe(e,t,s)}if(i&&ip(i)){const e=qe([{_:"a"}],"_",s);return t=>i[t]||e(t)}},[e,t,o,r,n])}function hp(e,t,o){return(0,Kd.useMemo)(()=>{if(!t||"auto"===t||"function"==typeof t)return e;const r=[...e],n="function"==typeof(i=o)?i:e=>e[i];var i;return r.sort("asc"===t?(e,t)=>n(e)-n(t):(e,t)=>n(t)-n(e))},[e,t,o])}function pp({selection:e,linkedHover:t,fallbackFields:o=[],unwrapData:r=!1,onObservation:n,chartType:i,chartId:s,onClick:a,hoverHighlight:l,colorByField:c,mobileInteraction:u}){const d=(0,Kd.useId)(),h=function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField,seriesField:e.seriesField}:null}(t,o),p="series"===h?.mode?[h.seriesField||c||o[0]].filter(e=>!!e):h?.fields||o||[],f=hh({name:e?.name||"__unused__",fields:p}),g=fh({name:h?.name||"hover",fields:p}),m=uh(e=>e.pushObservation),y=e?{isActive:f.isActive,predicate:f.predicate}:null,[b,v]=(0,Kd.useState)(null),x=(0,Kd.useRef)(!1),k=c||o[0],w=(0,Kd.useMemo)(()=>{if(!l||null==b||!k)return null;const e=b,t=k;return{isActive:!0,predicate:o=>("string"==typeof o[t]?o[t]:(o[t]??"")+"")===e}},[l,b,k]),S=(0,Kd.useCallback)(e=>{const o=!e&&x.current&&!!u?.enabled&&u.tapToLockTooltip;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===h?.mode&&h.xField){const o=rp(e,t,h.xField);null!=o&&function(e,t,o){const r=Wn.positions.get(e);r?.locked||r&&r.xValue===t&&r.sourceId===o||(Wn={positions:new Map(Wn.positions).set(e,{xValue:t,sourceId:o})},Yn())}(h.name||"hover",o,d)}"x-position"!==h?.mode&&g.onHover(t)}else"x-position"!==h?.mode||o||Gn(h.name||"hover",d),"x-position"===h?.mode||o||g.onHover(null);if(l&&k)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const o=t?.[k];v(null!=o?o+"":null)}else o||v(null);if(n||m){const t={timestamp:Date.now(),chartType:i||"unknown",chartId:s};if(e){const o=np(e),r={...t,type:"hover",datum:o||{},x:e.x??0,y:e.y??0};n&&n(r),m&&m(r)}else{const e={...t,type:"hover-end"};n&&n(e),m&&m(e)}}},[t,g,h,d,n,i,s,m,l,k,u]),A=(0,Kd.useCallback)((o=!0)=>{x.current=!1,t&&"x-position"!==h?.mode&&g.onHover(null),e&&u?.tapToSelect&&f.clear(),o&&l&&v(null),"x-position"===h?.mode&&(Vn(h.name||"hover",d),Gn(h.name||"hover",d))},[t,h,g,e,u,f,l,d]),C=(0,Kd.useCallback)(o=>{const r=!!u?.enabled&&(u.tapToLockTooltip||u.tapToSelect),c=!!u?.enabled&&"backgroundTap"===u.clearSelection;if("x-position"===h?.mode&&h.xField&&o){let e=o.data||o.datum||o;Array.isArray(e)&&(e=e[0]);const t=rp(o,e,h.xField);null!=t&&function(e,t,o){const r=Wn.positions.get(e);if(r?.locked){const t=new Map(Wn.positions);return t.delete(e),Wn={positions:t},Yn(),!1}Wn={positions:new Map(Wn.positions).set(e,{xValue:t,sourceId:o,locked:!0})},Yn()}(h.name||"hover",t,d)}if(r)if(o){x.current=!0;const r=np(o);if(t&&"x-position"!==h?.mode&&g.onHover(r),e&&u?.tapToSelect&&p.length>0){const e={};for(const t of p){const o=r[t];void 0!==o&&(e[t]=[o])}ip(e)&&f.selectPoints(e)}if(l&&k){const e=r?.[k];v(null!=e?e+"":null)}}else c&&A();if(o||c){if(o&&a){let e=o.data||o.datum||o;Array.isArray(e)&&(e=e[0]),a(e,{x:o.x??0,y:o.y??0})}if(n||m){const e={timestamp:Date.now(),chartType:i||"unknown",chartId:s};if(o){const t=np(o),r={...e,type:"click",datum:t||{},x:o.x??0,y:o.y??0};n&&n(r),m&&m(r)}else{const t={...e,type:"click-end"};n&&n(t),m&&m(t)}}}},[a,n,m,i,s,h,d,u,t,g,e,f,p,l,k,A]);return(0,Kd.useEffect)(()=>{if(!u?.enabled||"undefined"==typeof document)return;const e=e=>{"Escape"===e.key&&x.current&&A()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[u?.enabled,A]),(0,Kd.useEffect)(()=>()=>{x.current&&A(!1)},[A]),(0,Kd.useEffect)(()=>{if("x-position"!==h?.mode)return;const e=h.name||"hover";return()=>{Vn(e,d),Gn(e,d)}},[h?.mode,h?.name,d]),{activeSelectionHook:y,hoverSelectionHook:w,customHoverBehavior:S,customClickBehavior:C,crosshairSourceId:d}}function fp(e,t){const o="object"==typeof e&&null!==e?e:void 0;if("x-position"===o?.mode)return{linkedCrosshairName:o.name||"hover",linkedCrosshairSourceId:t}}function gp({data:e,colorBy:t,colorScale:o,showLegend:r,legendPosition:n="right",userMargin:i,defaults:s={top:50,bottom:60,left:70,right:40},categories:a}){const l=(0,oh.useContext)(wh),c=null!==(0,oh.useContext)(Ch),u=void 0!==r?r:!l&&!!t,d=!!t&&(u||c),h=(0,Kd.useMemo)(()=>{if(!d)return[];if(void 0!==a)return a;const o=new Set;for(const r of e){const e="function"==typeof t?t(r):r[t];null!=e&&o.add(e+"")}return Array.from(o)},[a,t,e,d]);_h(c&&t?h:[]);const p=(0,Kd.useMemo)(()=>{if(!u||!t)return;const r=$h({data:e,colorBy:t,colorScale:o,getColor:Oe,categories:h});return 0!==r.legendGroups.reduce((e,t)=>e+t.items.length,0)?r:void 0},[u,t,e,o,h]),f=(0,Kd.useMemo)(()=>{const e="number"==typeof i?{top:i,bottom:i,left:i,right:i}:i??{},t=t=>{const o=e[t];return"number"==typeof o?o:s[t]},o={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},r=t=>"number"==typeof e[t];return p&&("right"===n&&!r("right")&&110>o.right?o.right=110:"left"===n&&!r("left")&&110>o.left?o.left=110:"top"===n&&!r("top")&&50>o.top?o.top=50:"bottom"===n&&!r("bottom")&&80>o.bottom&&(o.bottom=80)),o},[s,i,p,n]);return{legend:p,margin:f,legendPosition:n}}function mp(e,t,o){const[r,n]=(0,Kd.useState)(null),[i,s]=(0,Kd.useState)(new Set),a=(0,Kd.useMemo)(()=>new Set,[]),l=(0,Kd.useCallback)(t=>{"highlight"===e&&n(t?t.label:null)},[e]),c=(0,Kd.useCallback)(t=>{"isolate"===e&&s(e=>{const r=new Set(e);return r.has(t.label)?r.delete(t.label):r.add(t.label),r.size===o.length?new Set:r})},[e,o.length]),u=(0,Kd.useMemo)(()=>{if(!e||"none"===e||!t)return null;const o="string"==typeof t?t:null;return"highlight"===e&&null!=r?{isActive:!0,predicate:e=>(o?e[o]:"function"==typeof t?t(e):null)===r}:"isolate"===e&&i.size>0?{isActive:!0,predicate:e=>{const r=o?e[o]:"function"==typeof t?t(e):null;return i.has(r)}}:null},[e,t,r,i]);return{highlightedCategory:"highlight"===e?r:null,isolatedCategories:"isolate"===e?i:a,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}var yp={primary:{width:600,height:400,showAxes:!0,showGrid:!1,enableHover:!0,showLegend:void 0,showLabels:void 0,marginDefaults:{top:50,bottom:60,left:70,right:40}},context:{width:400,height:250,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:10,bottom:10,left:10,right:10}},sparkline:{width:120,height:24,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:2,bottom:2,left:0,right:0}},mobile:{width:390,height:300,showAxes:!0,showGrid:!1,enableHover:!0,showLegend:!1,showLabels:!0,marginDefaults:{top:28,bottom:42,left:44,right:16}}};function bp(e,t,o){const r=yp[e||"primary"],n=e&&"primary"!==e||!o?.width?r.width:o.width,i=e&&"primary"!==e||!o?.height?r.height:o.height,s=tp({...t,mode:e},{width:t.width??n,height:t.height??i}).props,a=s.mode||e,l=yp[a||"primary"],c="context"===a||"sparkline"===a,u=a&&"primary"!==a||!o?.width?l.width:o.width;return{width:s.width??u,height:s.height??(a&&"primary"!==a||!o?.height?l.height:o.height),showAxes:s.showAxes??l.showAxes,showGrid:s.showGrid??l.showGrid,enableHover:s.enableHover??(!!s.linkedHover||l.enableHover),showLegend:s.showLegend??l.showLegend,showLabels:s.showLabels??l.showLabels,title:c?void 0:s.title,description:s.description,summary:s.summary,accessibleTable:s.accessibleTable,xLabel:c?void 0:s.xLabel,yLabel:c?void 0:s.yLabel,categoryLabel:c?void 0:s.categoryLabel,valueLabel:c?void 0:s.valueLabel,marginDefaults:vp(l.marginDefaults,s.showCategoryTicks,s.orientation),compactMode:c,mobileInteraction:lp(s.mobileInteraction,{mode:a,width:s.width??u,mobileSemantics:s.mobileSemantics}),mobileSemantics:s.mobileSemantics}}function vp(e,t,o){if(!1!==t)return e;const r={...e};return"horizontal"===o?r.left=Math.min(r.left,15):r.bottom=Math.min(r.bottom,15),r}function xp(e,t){const o=e.length,r=t.length,n=Array(r+1);for(let e=0;r>=e;e++)n[e]=e;for(let i=1;o>=i;i++){let o=n[0];n[0]=i;for(let s=1;r>=s;s++){const r=n[s];n[s]=e[i-1]===t[s-1]?o:1+Math.min(o,n[s],n[s-1]),o=r}}return n[r]}function kp(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function wp(e,t){if(0===t.length)return null;const o=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(o)||o.includes(e.toLowerCase()))||(function(e,t,o=3){let r,n=o+1;for(const o of t){const t=xp(e.toLowerCase(),o.toLowerCase());n>t&&(n=t,r=o)}return n>o?void 0:r}(e,t,3)??null)}function Sp({componentName:e,data:t,accessors:o,requiredProps:r}){if(r)for(const[t,o]of Object.entries(r))if(null==o)return`${e}: ${t} is required. Provide a field name or function.`;if(null==t)return null;if(!Array.isArray(t)&&"object"==typeof t)return e+": data should be an array, but received an object. If this is hierarchical data, use TreeDiagram, Treemap, or CirclePack instead.";if(!Array.isArray(t)||0===t.length)return e+": No data provided. Pass a non-empty array to the data prop.";if(o){const r=kp(t).find(e=>e&&"object"==typeof e);if(r){const t=Object.keys(r);for(const[n,i]of Object.entries(o))if(i&&"string"==typeof i&&!(i in r)){const o=wp(i,t),r=o?` Try ${n}="${o}".`:"";return`${e}: ${n} "${i}" not found in data. Available fields: ${t.join(", ")}.${r}`}}}return null}function Ap({componentName:e,data:t,dataLabel:o="data"}){return null==t?`${e}: No ${o} provided. Pass a hierarchical object with children: { name: "root", children: [...] }.`:Array.isArray(t)?`${e}: ${o} should be a single root object, not an array. Expected: { name: "root", children: [...] }. If you have flat data, use LineChart, BarChart, or Scatterplot instead.`:null}function Cp({componentName:e,nodes:t,edges:o,nodesRequired:r=!1,edgesRequired:n=!0,accessors:i}){if(null==t&&null==o)return null;if(n&&(!o||!Array.isArray(o)||0===o.length))return e+': No edges provided. Pass a non-empty array: edges={[{ source: "A", target: "B", value: 10 }, ...]}.';if(r&&(!t||!Array.isArray(t)||0===t.length))return e+': No nodes provided. Pass a non-empty array: nodes={[{ id: "A" }, { id: "B" }, ...]}.';if(i&&t&&t.length>0){const o=kp(t).find(e=>e&&"object"==typeof e);if(o){const t=Object.keys(o);for(const[r,n]of Object.entries(i))if(n&&"string"==typeof n&&!(n in o)){const o=wp(n,t),i=o?` Try ${r}="${o}".`:"";return`${e}: ${r} "${n}" not found in node data. Available fields: ${t.join(", ")}.${i}`}}}return null}var Mp=require("react"),jp=require("react");function Pp(e){const t=ee(e=>e.theme.colors.selectionOpacity);return(0,jp.useMemo)(()=>{if(void 0!==e||void 0!==t)return{name:e?.name??"",...e,unselectedOpacity:e?.unselectedOpacity??t}},[e,t])}function _p(e){const{data:t,rawData:o,colorBy:r,colorScheme:n,legendInteraction:i,legendPosition:s,selection:a,linkedHover:l,fallbackFields:c,unwrapData:u=!1,onObservation:d,chartType:h,chartId:p,showLegend:f,userMargin:g,marginDefaults:m,onClick:y,hoverHighlight:b,mobileInteraction:v,mobileSemantics:x,loading:k,loadingContent:w,emptyContent:S,width:A,height:C}=e,M=void 0===o,j=(0,Mp.useMemo)(()=>z(t),[t]),[P,_]=(0,Mp.useState)([]),L=(0,Mp.useCallback)(e=>{_(t=>t.length===e.length&&t.every((t,o)=>t===e[o])?t:e)},[]),R="string"==typeof e.colorBy?e.colorBy:void 0,T=(0,Mp.useMemo)(()=>lp(v,{width:A,mobileSemantics:x}),[v,A,x]),{activeSelectionHook:I,hoverSelectionHook:$,customHoverBehavior:N,customClickBehavior:F,crosshairSourceId:B}=pp({selection:a,linkedHover:l,fallbackFields:c,unwrapData:u,onObservation:d,chartType:h,chartId:p,onClick:y,hoverHighlight:b,colorByField:R,mobileInteraction:T}),D=fp(l,B),E=dp(j,r,n),H=(0,Mp.useMemo)(()=>{if(!r)return[];const e=new Set;for(const t of j){const o="function"==typeof r?r(t):t[r];null!=o&&e.add(o+"")}return Array.from(e)},[j,r]),O=(0,Mp.useMemo)(()=>M&&P.length>0?P:H,[M,P,H]),W=mp(i,r,O),q=(0,Mp.useMemo)(()=>$||(W.legendSelectionHook?W.legendSelectionHook:I),[$,W.legendSelectionHook,I]),Y=Pp(a),G=cp(),V=th(),X=(0,Mp.useMemo)(()=>{if(E)return E;if(!r||0===O.length)return;const e=Array.isArray(n)&&n.length>0||"string"==typeof n&&n.length>0?n:G&&G.length>0?G:Ee,t="__streamCat",o=qe(O.map(e=>({[t]:e})),t,e);return e=>V?.[e]||o(e)||"#999"},[E,r,O,n,G,V]),{legend:U,margin:K,legendPosition:Q}=gp({data:j,colorBy:r,colorScale:X,showLegend:f,legendPosition:s,userMargin:g,defaults:m,categories:O}),Z=(0,Mp.useMemo)(()=>{const e={};return U&&(e.legend=U,e.legendPosition=Q),i&&"none"!==i&&(e.legendHoverBehavior=W.onLegendHover,e.legendClickBehavior=W.onLegendClick,e.legendHighlightedCategory=W.highlightedCategory,e.legendIsolatedCategories=W.isolatedCategories),M&&r&&(e.legendCategoryAccessor=r,e.onCategoriesChange=L),e},[U,Q,i,W.onLegendHover,W.onLegendClick,W.highlightedCategory,W.isolatedCategories,M,r,L]),J=Array.isArray(o)?z(o):o,ee=ud(k,A,C,w),te=ee?null:cd(J,A,C,S);return{data:j,colorScale:E,allCategories:O,legendState:W,effectiveSelectionHook:q,activeSelectionHook:I,customHoverBehavior:N,customClickBehavior:F,mobileInteraction:T,legend:U,margin:K,legendPosition:Q,earlyReturn:ee||te||null,legendBehaviorProps:Z,crosshairProps:D,resolvedSelection:Y}}var Lp=require("react");function Rp(e,t){const{variant:o,frameRef:r,overrides:n,deps:i}=t;(0,Lp.useImperativeHandle)(e,()=>{const e=function(e,t){if("xy"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>e.current?.remove(t)??[],update:(t,o)=>e.current?.update(t,o)??[],clear:()=>e.current?.clear(),getData:()=>e.current?.getData()??[],getScales:()=>e.current?.getScales()??null,getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}if("network"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>{const o=Array.isArray(t)?t:[t],r=e.current?.getTopology()?.nodes??[],n=[];for(const t of o){const o=r.find(e=>e.id===t);o&&n.push({...o.data??{},id:t}),e.current?.removeNode(t)}return n},update:(t,o)=>(Array.isArray(t)?t:[t]).flatMap(t=>{const r=e.current?.updateNode(t,o);return r?[{...r,id:t}]:[]}),clear:()=>e.current?.clear(),getData:()=>e.current?.getTopology()?.nodes?.map(e=>e.data)??[],getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}if("geo-points"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>e.current?.removePoint(t)??[],update:(t,o)=>{const r=e.current?.removePoint(t)??[];for(const t of r)e.current?.push(o(t));return r},clear:()=>e.current?.clear(),getData:()=>e.current?.getData()??[],getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}const o=t;return{push:e=>o.current?.pushLine(e),pushMany:e=>o.current?.pushManyLines(e),remove:e=>o.current?.removeLine(e)??[],update:(e,t)=>{const r=o.current?.removeLine(e)??[];for(const e of r)o.current?.pushLine(t(e));return r},clear:()=>o.current?.clear(),getData:()=>o.current?.getLines()??[],getCustomLayout:()=>o.current?.getCustomLayout?.()??null,getLayoutFailure:()=>o.current?.getLayoutFailure?.()??null}}(o,r);return{...e,...n}},i??[])}var Tp=require("react");function Ip(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return e??(()=>({}));const o={};return void 0!==t.stroke&&(o.stroke=t.stroke),void 0!==t.strokeWidth&&(o.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(o.opacity=t.opacity),e?(...t)=>({...e(...t)||{},...o}):(...e)=>({...o})}function $p(e){const{colorBy:t,colorScale:o,color:r,pointRadius:n=5,radiusFn:i,fillOpacity:s=1,fallbackFill:a,baseStyleExtras:l,stroke:c,strokeWidth:u,opacity:d,effectiveSelectionHook:h,resolvedSelection:p,colorDatumAccessor:f}=e,g=(0,Tp.useMemo)(()=>e=>{const c="function"==typeof l?l(e):l,u=c?{...c}:{};if(void 0===u.fillOpacity&&(u.fillOpacity=s),void 0===u.fill)if(t){if(o){const r=f?f(e):e;u.fill=Oe(r,t,o)}}else u.fill=a?a(e):r||op;return void 0===u.r&&(u.r=i?i(e):n),u},[t,o,r,n,i,s,a,l,f]),m=(0,Tp.useMemo)(()=>Ip(g,{stroke:c,strokeWidth:u,opacity:d}),[g,c,u,d]);return(0,Tp.useMemo)(()=>Bh(m,h??null,p),[m,h,p])}var Np=require("react");function Fp(e){const{accessor:t,data:o,isPushMode:r}=e,n=(0,Np.useRef)(null),[i,s]=(0,Np.useState)(0),a=(0,Np.useCallback)(e=>{if(!r||!t)return;let o=!1;for(const r of e){const e="function"==typeof t?t(r):r[t];if(null==e)continue;const i="number"==typeof e?e:Number(e);Number.isFinite(i)&&(n.current?(n.current[0]>i&&(n.current[0]=i,o=!0),i>n.current[1]&&(n.current[1]=i,o=!0)):(n.current=[i,i],o=!0))}o&&s(e=>e+1)},[r,t]),l=(0,Np.useCallback)(()=>{r&&(n.current=null,s(e=>e+1))},[r]);return{domain:(0,Np.useMemo)(()=>{if(r)return n.current??void 0;if(!t||0===o.length)return;const e="function"==typeof t?t:e=>e[t];let i=1/0,s=-1/0;for(const t of o){const o=e(t);if(null==o)continue;const r="number"==typeof o?o:Number(o);Number.isFinite(r)&&(i>r&&(i=r),r>s&&(s=r))}return Number.isFinite(i)&&Number.isFinite(s)?[i,s]:void 0},[o,t,r,i]),trackPushed:a,reset:l}}function Bp(e){if(!e)return;const t="boolean"==typeof e?{}:"string"==typeof e?{method:e}:e;return{type:"trend",method:t.method??"linear",...null!=t.bandwidth&&{bandwidth:t.bandwidth},...null!=t.order&&{order:t.order},...null!=t.color&&{color:t.color},...null!=t.strokeWidth&&{strokeWidth:t.strokeWidth},...null!=t.strokeDasharray&&{strokeDasharray:t.strokeDasharray},...null!=t.label&&{label:t.label}}}var Dp=require("react"),Ep="__forecastSegment",zp=null;async function Hp(){return zp||(zp=await Promise.resolve().then(()=>(C(),b))),zp}var Op="__semiotic_resolvedX",Wp="__semiotic_resolvedY";function qp(e){const{data:t,xAccessor:o,yAccessor:r,forecast:n,anomaly:i,groupBy:s}=e,a="string"==typeof o?o:Op,l="string"==typeof r?r:Wp,c=(0,Dp.useMemo)(()=>{if(!n&&!i)return t;const e="function"==typeof o,s="function"==typeof r;return e||s?t.map(t=>{const n={...t};return e&&(n[Op]=o(t)),s&&(n[Wp]=r(t)),n}):t},[t,n,i,o,r]),[u,d]=(0,Dp.useState)(null),[h,p]=(0,Dp.useState)([]),f=(0,Dp.useRef)(n),g=(0,Dp.useRef)(i);return(0,Dp.useEffect)(()=>{if(!n&&!i)return void((f.current||g.current)&&(d(null),p([]),f.current=n,g.current=i));let e=!1;const t=n!==f.current||i!==g.current;if(f.current=n,g.current=i,t&&(d(null),p([])),n){const t=s&&"string"==typeof s&&"object"==typeof n?{...n,_groupBy:s}:n;(async function(...e){return(await Hp()).buildForecast(...e)})(c,a,l,t,i).then(t=>{e||(d(t),p(t.annotations))}).catch(()=>{e||(d(null),p([]))})}else i&&async function(...e){return(await Hp()).buildAnomalyAnnotations(...e)}(i).then(t=>{e||(d(null),p(t))}).catch(()=>{e||p([])});return()=>{e=!0}},[c,n,i,a,l,s]),{effectiveData:u?u.processedData:t,statisticalAnnotations:h,hasForecast:!!u,xAccessorKey:a,yAccessorKey:l}}var Yp=require("react/jsx-runtime"),Gp=(0,Ud.forwardRef)(function(e,t){const o=(0,Ud.useRef)(null),r=bp(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:n,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:u="y",xScaleType:d,yScaleType:h,colorBy:p,colorScheme:f,sizeBy:g,sizeRange:m=[3,15],symbolBy:y,symbolMap:b,pointRadius:v=5,pointOpacity:x=.8,tooltip:k,marginalGraphics:w,pointIdAccessor:S,annotations:A,regression:C,forecast:M,anomaly:j,xExtent:P,yExtent:_,frameProps:L={},selection:R,linkedHover:T,linkedBrush:I,onObservation:$,onClick:N,hoverHighlight:F,chartId:B,loading:D,loadingContent:E,emptyContent:H,legendInteraction:O,legendPosition:W,color:q,stroke:Y,strokeWidth:G,opacity:V}=e,{width:X,height:U,enableHover:K,showGrid:Q,showLegend:Z,title:J,description:ee,summary:te,accessibleTable:oe,xLabel:re,yLabel:ne}=r,ie=(0,Ud.useMemo)(()=>z(n),[n]),se=void 0===n,{domain:ae,trackPushed:le,reset:ce}=Fp({accessor:g,data:ie,isPushMode:se}),ue=(0,Ud.useCallback)(e=>{le([e]),o.current?.push(e)},[le]),de=(0,Ud.useCallback)(e=>{le(e),o.current?.pushMany(e)},[le]);Rp(t,{variant:"xy",frameRef:o,overrides:{push:ue,pushMany:de,clear:()=>{ce(),o.current?.clear()}},deps:[ue,de,ce]});const he=_p({data:ie,rawData:n,colorBy:p,colorScheme:f,legendInteraction:O,legendPosition:W,selection:R,linkedHover:T,fallbackFields:p?["string"==typeof p?p:""]:[],unwrapData:!1,onObservation:$,onClick:N,hoverHighlight:F,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"Scatterplot",chartId:B,showLegend:Z,userMargin:i,marginDefaults:r.marginDefaults,loading:D,loadingContent:E,emptyContent:H,width:X,height:U}),pe=Nh(I),fe=mh({name:pe?.name||"__unused_brush__",xField:pe?.xField||("string"==typeof c?c:void 0),yField:pe?.yField||("string"==typeof u?u:void 0)}),ge=pe?"xyBrush"===fe.brushInteraction.brush?"xy":"xBrush"===fe.brushInteraction.brush?"x":"y":void 0,me=Xd.useRef(fe.brushInteraction);me.current=fe.brushInteraction;const ye=(0,Ud.useCallback)(e=>{const t=me.current;t.end(e?"xyBrush"===t.brush?[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:"xBrush"===t.brush?e.x:e.y:null)},[]);dd("Scatterplot",ie,"xAccessor",c),dd("Scatterplot",ie,"yAccessor",u);const be=(0,Ud.useMemo)(()=>g?ae??[0,1]:void 0,[g,ae]),ve=(0,Ud.useMemo)(()=>g?e=>Ye(e,g,m,be):void 0,[g,m,be]),xe=$p({colorBy:p,colorScale:he.colorScale,color:q,pointRadius:v,fillOpacity:x,radiusFn:ve,stroke:Y,strokeWidth:G,opacity:V,effectiveSelectionHook:he.effectiveSelectionHook,resolvedSelection:he.resolvedSelection}),ke=(0,Ud.useMemo)(()=>za([{label:re||Na(c),accessor:c,role:"x",format:a},{label:ne||Na(u),accessor:u,role:"y",format:l},...p?[{label:Na(p),accessor:p,role:"color"}]:[],...g?[{label:Na(g),accessor:g,role:"size"}]:[]]),[c,u,re,ne,p,g,a,l]),{effectiveData:we,statisticalAnnotations:Se}=qp({data:ie,xAccessor:c,yAccessor:u,forecast:M,anomaly:j}),Ae=(0,Ud.useMemo)(()=>{const e=Bp(C);return e||0!==Se.length?[...e?[e]:[],...A||[],...Se]:A},[C,A,Se]);if(he.earlyReturn)return he.earlyReturn;const Ce=Sp({componentName:"Scatterplot",data:n,accessors:{xAccessor:c,yAccessor:u}});if(Ce)return(0,Yp.jsx)(td,{componentName:"Scatterplot",message:Ce,width:X,height:U});const Me={chartType:"scatter",...null!=n&&{data:we},xAccessor:c,yAccessor:u,xScaleType:d,yScaleType:h,colorAccessor:p||void 0,sizeAccessor:g||void 0,...y&&{symbolAccessor:y},...b&&{symbolMap:b},sizeRange:m,pointStyle:xe,colorScheme:f,size:[X,U],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:he.margin,showAxes:r.showAxes,xLabel:re,yLabel:ne,xFormat:a,yFormat:l,enableHover:K,showGrid:Q,...he.legendBehaviorProps,...Yd({title:J,description:ee,summary:te,accessibleTable:oe,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Vd({tooltip:k,defaultTooltipContent:ke}),...Gd({linkedHover:T,selection:R,onObservation:$,onClick:N,hoverHighlight:F,mobileInteraction:he.mobileInteraction,customHoverBehavior:he.customHoverBehavior,customClickBehavior:he.customClickBehavior}),...w&&{marginalGraphics:w},...S&&{pointIdAccessor:S},...Ae&&Ae.length>0&&{annotations:Ae},...P&&{xExtent:P},..._&&{yExtent:_},...pe&&{brush:{dimension:ge},onBrush:ye},...he.crosshairProps,...L};return(0,Yp.jsx)(sd,{componentName:"Scatterplot",width:X,height:U,children:(0,Yp.jsx)(Ka,{ref:o,...Me})})});Gp.displayName="Scatterplot";var Vp=require("react"),Xp=require("react/jsx-runtime");function Up(e,t){return we(1===t?.5:e/(t-1))}var Kp=(0,Vp.forwardRef)(function(e,t){const o=(0,Vp.useRef)(null);Rp(t,{variant:"xy",frameRef:o});const r=bp(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:n,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:u="y",orderAccessor:d,orderLabel:h,pointRadius:p=4,tooltip:f,pointIdAccessor:g,annotations:m,regression:y,forecast:b,anomaly:v,xExtent:x,yExtent:k,frameProps:w={},selection:S,linkedHover:A,onObservation:C,onClick:M,hoverHighlight:j,chartId:P,loading:_,loadingContent:L,emptyContent:R,legendInteraction:T,stroke:I,strokeWidth:$,opacity:N}=e,{width:F,height:B,enableHover:D,showGrid:E,title:z,description:H,summary:O,accessibleTable:W,xLabel:q,yLabel:Y}=r,G=n||[],{safeData:V,orderMap:X}=(0,Vp.useMemo)(()=>{const e="function"==typeof c?c:e=>e[c],t="function"==typeof u?u:e=>e[u];let o=G;if(d&&G.length>0){const e="function"==typeof d?d:e=>e[d];o=[...G].sort((t,o)=>{const r=e(t),n=e(o);return(r instanceof Date?r.getTime():+r)-(n instanceof Date?n.getTime():+n)})}const r=new WeakMap;let n=0;for(const r of o){const o=e(r),i=t(r);null!=o&&null!=i&&isFinite(o)&&isFinite(i)&&n++}let i=0;for(const s of o){const o=e(s),a=t(s);null!=o&&null!=a&&isFinite(o)&&isFinite(a)&&r.set(s,{idx:i++,total:n})}return{safeData:o,orderMap:r}},[G,d,c,u]);dd("ConnectedScatterplot",V,"xAccessor",c),dd("ConnectedScatterplot",V,"yAccessor",u);const U=_p({data:V,rawData:n,colorBy:void 0,colorScheme:void 0,legendInteraction:T,selection:S,linkedHover:A,fallbackFields:[],unwrapData:!1,onObservation:C,onClick:M,hoverHighlight:j,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"ConnectedScatterplot",chartId:P,showLegend:void 0,userMargin:i,marginDefaults:{top:50,right:40,bottom:60,left:70},loading:_,loadingContent:L,emptyContent:R,width:F,height:B}),K=U.resolvedSelection?.unselectedOpacity??Fh,Q=(0,Vp.useMemo)(()=>(e,t)=>{const o=t.filter(e=>"point"===e.type);if(2>o.length)return;const r=U.effectiveSelectionHook?.isActive,n=U.effectiveSelectionHook?.predicate,i=100>o.length,s=o.length;e.lineCap="round";for(let t=0;s-1>t;t++){const a=o[t],l=o[t+1],c=Up(t,s),u=!r||!n||n(a.datum??a)||n(l.datum??l),d=r?u?1:K:1;i&&(e.beginPath(),e.moveTo(a.x,a.y),e.lineTo(l.x,l.y),e.strokeStyle="white",e.lineWidth=p+2,e.globalAlpha=.5*d,e.stroke()),e.beginPath(),e.moveTo(a.x,a.y),e.lineTo(l.x,l.y),e.strokeStyle=c,e.lineWidth=p,e.globalAlpha=d,e.stroke()}e.globalAlpha=1},[p,U.effectiveSelectionHook,K]),Z=(0,Vp.useMemo)(()=>[Q],[Q]),J=(0,Vp.useMemo)(()=>(e,t,o)=>{const r=e.filter(e=>"point"===e.type);if(2>r.length)return null;const n=r.length,i=100>n,s=[];for(let e=0;n-1>e;e++){const t=r[e],o=r[e+1],a=Up(e,n),l=Math.min("number"==typeof t.style?.opacity?t.style.opacity:1,"number"==typeof o.style?.opacity?o.style.opacity:1);i&&s.push((0,Xp.jsx)("line",{x1:t.x,y1:t.y,x2:o.x,y2:o.y,stroke:"white",strokeWidth:p+2,strokeLinecap:"round",opacity:.5*l},"halo-"+e)),s.push((0,Xp.jsx)("line",{x1:t.x,y1:t.y,x2:o.x,y2:o.y,stroke:a,strokeWidth:p,strokeLinecap:"round",opacity:l},"seg-"+e))}return(0,Xp.jsx)(Xp.Fragment,{children:s})},[p]),ee=(0,Vp.useMemo)(()=>[J],[J]),te=$p({colorScale:void 0,baseStyleExtras:(0,Vp.useMemo)(()=>e=>{const t=X.get(e),o=t?.idx??0,r=t?.total??1;return{fill:r>0?Up(o,r):"#6366f1",stroke:"white",strokeWidth:1,r:p,fillOpacity:1}},[p,X]),stroke:I,strokeWidth:$,opacity:N,effectiveSelectionHook:U.effectiveSelectionHook,resolvedSelection:U.resolvedSelection}),oe=h||("string"==typeof d?d:"Order"),re=(0,Vp.useMemo)(()=>za([{label:q||Na(c),accessor:c,role:"x",format:a},{label:Y||Na(u),accessor:u,role:"y",format:l},...d?[{label:oe,accessor:d,role:"group"}]:[]]),[c,u,q,Y,d,oe,a,l]),ne=Sp({componentName:"ConnectedScatterplot",data:n,accessors:{xAccessor:c,yAccessor:u}}),{effectiveData:ie,statisticalAnnotations:se}=qp({data:V,xAccessor:c,yAccessor:u,forecast:b,anomaly:v});if(U.earlyReturn)return U.earlyReturn;const ae=Bp(y),le=ae||se.length>0?[...ae?[ae]:[],...m||[],...se]:m,ce={chartType:"scatter",...null!=n&&{data:ie},xAccessor:c,yAccessor:u,pointStyle:te,size:[F,B],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:U.margin,showAxes:r.showAxes,xLabel:q,yLabel:Y,xFormat:a,yFormat:l,enableHover:D,showGrid:E,...Yd({title:z,description:H,summary:O,accessibleTable:W,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Vd({tooltip:f,defaultTooltipContent:re}),...Gd({linkedHover:A,selection:S,onObservation:C,onClick:M,hoverHighlight:j,mobileInteraction:U.mobileInteraction,customHoverBehavior:U.customHoverBehavior,customClickBehavior:U.customClickBehavior}),...g&&{pointIdAccessor:g},canvasPreRenderers:Z,svgPreRenderers:ee,...le&&le.length>0&&{annotations:le},...x&&{xExtent:x},...k&&{yExtent:k},...U.crosshairProps,...w};return ne?(0,Xp.jsx)(td,{componentName:"ConnectedScatterplot",message:ne,width:F,height:B}):(0,Xp.jsx)(sd,{componentName:"ConnectedScatterplot",width:F,height:B,children:(0,Xp.jsx)(Ka,{ref:o,...ce})})});Kp.displayName="ConnectedScatterplot";var Qp=require("react"),Zp=require("react");function Jp(e){const{lineWidth:t=2,colorBy:o,colorScale:r,color:n,resolveStroke:i,fillArea:s,areaOpacity:a=.3,stroke:l,strokeWidth:c,opacity:u,effectiveSelectionHook:d,resolvedSelection:h}=e,p=(0,Zp.useMemo)(()=>(e,l)=>{const c={strokeWidth:t},u=!0===s||Array.isArray(s)&&null!=l&&s.includes(l);let d;return i?d=i(e,l):o?r&&(d=Oe(e,o,r)):d=n||op,void 0!==d&&(c.stroke=d,u&&(c.fill=d,c.fillOpacity=a)),c},[t,o,r,n,i,s,a]),f=(0,Zp.useMemo)(()=>Ip(p,{stroke:l,strokeWidth:c,opacity:u}),[p,l,c,u]);return(0,Zp.useMemo)(()=>Bh(f,d??null,h),[f,d,h])}var ef=require("react/jsx-runtime"),tf="__lineObjectSeries",of=(0,Qp.forwardRef)(function(e,t){const o=(0,Qp.useRef)(null);Rp(t,{variant:"xy",frameRef:o});const r=bp(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:n,margin:i,className:s,xFormat:a,yFormat:l,axisExtent:c,xAccessor:u="x",yAccessor:d="y",lineBy:h,lineDataAccessor:p="coordinates",colorBy:f,colorScheme:g,curve:m="linear",showPoints:y=!1,pointRadius:b=3,fillArea:v=!1,areaOpacity:x=.3,lineWidth:k=2,lineGradient:w,tooltip:S,pointIdAccessor:A,annotations:C,directLabel:M,gapStrategy:j="break",anomaly:P,forecast:_,band:L,xExtent:R,yExtent:T,frameProps:I={},selection:$,linkedHover:N,onObservation:F,onClick:B,hoverHighlight:D,hoverRadius:E,chartId:H,loading:O,loadingContent:W,emptyContent:q,legendInteraction:Y,legendPosition:G,xScaleType:V,yScaleType:X,color:U,stroke:K,strokeWidth:Q,opacity:Z}=e,{width:J,height:ee,enableHover:te,showGrid:oe,showLegend:re,title:ne,description:ie,summary:se,accessibleTable:ae,xLabel:le,yLabel:ce}=r,ue=(0,Qp.useMemo)(()=>z(n),[n]),de=Array.isArray(ue[0]?.[p])?ue[0][p]:ue;dd("LineChart",de,"xAccessor",u),dd("LineChart",de,"yAccessor",d);const{effectiveData:he,statisticalAnnotations:pe}=qp({data:ue,xAccessor:u,yAccessor:d,forecast:_,anomaly:P,groupBy:h}),fe="__compoundGroup",ge=!(!_||!h),me=ge?fe:_?Ep:h,ye=(0,Qp.useMemo)(()=>{if(!ge)return he;const e="function"==typeof h?h:e=>e[h];return he.map(t=>{const o={...t};return o[fe]=`${e(t)}__${t[Ep]||"observed"}`,o})},[he,ge,h]),be=ge?ye:he,ve=f||h,xe=(0,Qp.useMemo)(()=>{if(!_)return;const e=_.upperBounds,t=_.lowerBounds;if(!e&&!t)return;const o="function"==typeof e?e:"string"==typeof e?t=>t[e]:null,r="function"==typeof t?t:"string"==typeof t?e=>e[t]:null;let n=1/0,i=-1/0;const s=he;for(const e of s){const t="function"==typeof d?d(e):+e[d];if(isFinite(t)&&(n>t&&(n=t),t>i&&(i=t)),o){const t=o(e);null!=t&&isFinite(t)&&(t>i&&(i=t),n>t&&(n=t))}if(r){const t=r(e);null!=t&&isFinite(t)&&(n>t&&(n=t),t>i&&(i=t))}}return isFinite(n)&&isFinite(i)?[n,i]:void 0},[_,he,d]),ke=(0,Qp.useCallback)(e=>{const t="function"==typeof u?u(e):e[u],o="function"==typeof d?d(e):e[d];return null==t||null==o||Number.isNaN(t)||Number.isNaN(o)},[u,d]),we=void 0!==be[0]?.[p],Se=we?tf:me,Ae=(0,Qp.useMemo)(()=>{if(we)return be.map((e,t)=>{const o="function"==typeof h?h(e):"string"==typeof h?e[h]:void 0,r=null==o?"line-"+t:o+"",n=Array.isArray(e[p])?e[p]:[];return{...e,[tf]:r,[p]:n.map(t=>({...t,[tf]:r,parentLine:e,..."string"==typeof h&&void 0!==e[h]?{[h]:e[h]}:{}}))}});if(me){const e=be.reduce((e,t)=>{const o="function"==typeof me?me(t):t[me];if(!e[o]){const r={[p]:[]};"string"==typeof me&&(r[me]=o),ge&&(r[Ep]=t[Ep],"string"==typeof h&&(r[h]=t[h])),e[o]=r}return e[o][p].push(t),e},{});return Object.values(e)}return[{[p]:be}]},[be,me,p,we,h]),{gapProcessedLineData:Ce,hasGaps:Me}=(0,Qp.useMemo)(()=>{if("interpolate"===j){let e=!1;const t=[];for(const o of Ae){const r=(o[p]||[]).filter(t=>!ke(t)||(e=!0,!1));r.length>0&&t.push({...o,[p]:r})}return{gapProcessedLineData:t,hasGaps:e}}if("break"===j){let e=!1;const t=[];for(const o of Ae){const r=o[p]||[];let n=[],i=0;const s=Se&&"string"==typeof Se?o[Se]:void 0;for(const a of r)if(ke(a))e=!0,n.length>0&&(t.push({...o,[p]:n}),n=[],i++);else{const e=null!=s?`${s}__seg${i}`:"__seg"+i;n.push({...a,_gapSegment:e})}n.length>0&&t.push({...o,[p]:n})}return{gapProcessedLineData:t,hasGaps:e}}if("zero"===j){let e=!1;const t="string"==typeof d?d:"y",o=[];for(const r of Ae){const n=r[p]||[],i=[];for(const o of n)ke(o)?(e=!0,i.push({...o,[t]:0})):i.push(o);o.push({...r,[p]:i})}return{gapProcessedLineData:o,hasGaps:e}}return{gapProcessedLineData:Ae,hasGaps:!1}},[Ae,j,p,ke,Se,d]),je="object"==typeof M?M:{},Pe=je.position||"end",_e=je.fontSize||11,Le=(0,Qp.useMemo)(()=>{if(!M||!ve)return[];const e="function"==typeof ve?ve:e=>e[ve],t=new Set;for(const o of Ce){const r=o[p]||[];if(0===r.length)continue;const n=e("end"===Pe?r[r.length-1]:r[0])??e(o);if(null==n)continue;const i=n+"";""!==i&&t.add(i)}return Array.from(t)},[M,ve,Ce,p,Pe]),Re=(0,Qp.useMemo)(()=>{if(!M)return r.marginDefaults;const e=Le.reduce((e,t)=>Math.max(e,t.length*(.6*_e)),0)+10,t="end"===Pe?"right":"left";return{...r.marginDefaults,[t]:Math.max(r.marginDefaults[t]||0,e)}},[M,Le,_e,Pe,r.marginDefaults]),Te=_p({data:he,rawData:n,colorBy:ve,colorScheme:g,legendInteraction:Y,legendPosition:G,selection:$,linkedHover:N,fallbackFields:ve?["string"==typeof ve?ve:""]:[],unwrapData:!1,onObservation:F,onClick:B,hoverHighlight:D,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"LineChart",chartId:H,showLegend:(!M||void 0!==re)&&re,userMargin:i,marginDefaults:Re,loading:O,loadingContent:W,emptyContent:q,width:J,height:ee}),Ie=Te.colorScale,$e=Te.effectiveSelectionHook,Ne=Te.resolvedSelection,Fe=Te.customHoverBehavior,Be=Te.customClickBehavior,De=Te.crosshairProps,Ee=Jp({lineWidth:k,colorBy:(0,Qp.useMemo)(()=>{if(ve)return we?e=>{const t=e.parentLine||e;return"function"==typeof ve?ve(t):t[ve]}:ve},[ve,we]),colorScale:Ie,color:U,fillArea:v,areaOpacity:x,stroke:K,strokeWidth:Q,opacity:Z,effectiveSelectionHook:$e,resolvedSelection:Ne}),[ze,He]=(0,Qp.useState)(null);(0,Qp.useEffect)(()=>{if(!_)return void He(null);let e=!1;return async function(...e){return(await Hp()).createSegmentLineStyle(...e)}(Ee,_).then(t=>{e||He(()=>t)}).catch(()=>{e||He(null)}),()=>{e=!0}},[Ee,_]);const We=ze||Ee,qe=(0,Qp.useMemo)(()=>{if(y)return e=>{const t={r:b,fillOpacity:1};return ve?Ie&&(t.fill=Oe(e.parentLine||e,ve,Ie)):t.fill=U||op,t}},[y,b,ve,Ie,U]),Ye=Array.isArray(v)?"mixed":v?"area":"line",Ge=(0,Qp.useMemo)(()=>{if(!M||!ve)return[];const e="function"==typeof u?u:e=>e[u],t="function"==typeof d?d:e=>e[d],o="function"==typeof ve?ve:e=>e[ve],r=new Map;for(const e of Ce){const t=e[p]||[];if(0===t.length)continue;const n="end"===Pe?t[t.length-1]:t[0],i=o(n)??o(e);if(null==i)continue;const s=i+"";""===s||r.has(s)||r.set(s,n)}const n=Array.from(r.entries()).map(([o,r])=>({type:"text",label:o,["string"==typeof u?u:"x"]:e(r),["string"==typeof d?d:"y"]:t(r),dx:"end"===Pe?6:-6,dy:0,color:Ie?Ie(o):op,fontSize:_e}));n.sort((e,t)=>{const o="string"==typeof d?d:"y";return e[o]-t[o]});for(let e=1;n.length>e;e++){const t="string"==typeof d?d:"y",o=n[e-1],r=n[e];_e+2>Math.abs(r[t]+r.dy-(o[t]+o.dy))&&(r.dy+=_e+2)}return n},[M,ve,Ie,Ce,p,u,d,Pe,_e]),Ve=Te.margin,Xe=h||f,Ue=(0,Qp.useMemo)(()=>za([{label:le||Na(u),accessor:u,role:"x",format:a},{label:ce||Na(d),accessor:d,role:"y",format:l},...Xe?[{label:Na(Xe),accessor:Xe,role:"group"}]:[],...Ea(L,l)]),[u,d,le,ce,Xe,a,l,L]),Ke=Sp({componentName:"LineChart",data:we?he[0]?.[p]||[]:n,accessors:{xAccessor:u,yAccessor:d}}),Qe=(0,Qp.useMemo)(()=>we||Se||Me?Ce.flatMap(e=>{const t=e[p]||[];return Se&&"string"==typeof Se?t.map(t=>({...t,[Se]:t[Se]??e[Se]})):t}):be,[Ce,p,we,Se,be,Me]),Ze={chartType:Ye,...Array.isArray(v)&&{areaGroups:v},...w&&{lineGradient:w},...null!=n&&{data:Qe},xAccessor:u,yAccessor:d,xScaleType:V,yScaleType:X,...R&&{xExtent:R},...!T||null==T[0]&&null==T[1]?xe?{yExtent:xe}:{}:{yExtent:T},groupAccessor:"break"===j&&Me?"_gapSegment":Se||void 0,...L&&{band:L},curve:m,lineStyle:We,...y&&{pointStyle:qe},size:[J,ee],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Ve,showAxes:r.showAxes,xLabel:le,yLabel:ce,xFormat:a,yFormat:l,...void 0!==c&&{axisExtent:c},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},enableHover:te,showGrid:oe,...Te.legendBehaviorProps,...ne&&{title:ne},...ie&&{description:ie},...se&&{summary:se},...void 0!==ae&&{accessibleTable:ae},...s&&{className:s},...null!=e.animate&&{animate:e.animate},tooltipContent:!1===S?()=>null:"multi"===S?Fs():Bs(S)||Ue,..."multi"===S&&{tooltipMode:"multi"},...Gd({linkedHover:N,selection:$,onObservation:F,onClick:B,hoverRadius:E,hoverHighlight:D,mobileInteraction:Te.mobileInteraction,customHoverBehavior:Fe,customClickBehavior:Be}),...A&&{pointIdAccessor:A},...(C?.length||pe.length||Ge.length)&&{annotations:[...C||[],...pe,...Ge]},...De,...I};return Te.earlyReturn?Te.earlyReturn:Ke?(0,ef.jsx)(td,{componentName:"LineChart",message:Ke,width:J,height:ee}):(0,ef.jsx)(sd,{componentName:"LineChart",width:J,height:ee,children:(0,ef.jsx)(Ka,{ref:o,...Ze})})});of.displayName="LineChart";var rf=require("react"),nf=require("react");function sf(e){const{safeData:t,data:o,areaBy:r,lineDataAccessor:n,colorBy:i,colorScale:s,color:a,stroke:l,strokeWidth:c,opacity:u,effectiveSelectionHook:d,resolvedSelection:h,areaOpacity:p,showLine:f,lineWidth:g,showPoints:m,pointRadius:y,xAccessor:b,yAccessor:v,xLabel:x,yLabel:k,xFormat:w,yFormat:S,groupField:A}=e,C=void 0!==t[0]?.[n],M=(0,nf.useMemo)(()=>{if(null==o)return[];if(!C&&!r)return t;let e;if(C)e=t;else{const o=r,i=t.reduce((e,t)=>{const r="function"==typeof o?o(t):t[o];if(!e[r]){const t={[n]:[]};"string"==typeof o&&(t[o]=r),e[r]=t}return e[r][n].push(t),e},{});e=Object.values(i)}return e.flatMap(e=>{const t=e[n]||[];return r&&"string"==typeof r?t.map(t=>({...t,[r]:e[r]})):t})},[o,t,r,n,C]),j=(0,nf.useMemo)(()=>e=>{const t={};if(i){if(s){const o=Oe(e,i,s);t.fill=o,f?(t.stroke=o,t.strokeWidth=g):t.stroke="none"}}else{const e=a||op;t.fill=e,f?(t.stroke=e,t.strokeWidth=g):t.stroke="none"}return t.fillOpacity=p,t},[i,s,a,p,f,g]),P=(0,nf.useMemo)(()=>Ip(j,{stroke:l,strokeWidth:c,opacity:u}),[j,l,c,u]);return{flattenedData:M,lineStyle:(0,nf.useMemo)(()=>Bh(P,d??null,h),[P,d,h]),pointStyle:(0,nf.useMemo)(()=>{if(m)return e=>{const t={r:y,fillOpacity:1};return i?s&&(t.fill=Oe(e.parentLine||e,i,s)):t.fill=a||op,t}},[m,y,i,s,a]),defaultTooltipContent:(0,nf.useMemo)(()=>za([{label:x||Na(b),accessor:b,role:"x",format:w},{label:k||Na(v),accessor:v,role:"y",format:S},...A?[{label:Na(A),accessor:A,role:"group"}]:[],...Ea(e.band,S)]),[b,v,x,k,A,w,S,e.band])}}var af=require("react/jsx-runtime");function lf(e,t){if(null==t)return e;const o=e.trim(),r=o.match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i);if(r){const e=r[1],o=3===e.length?e.split("").map(e=>e+e).join(""):e;return`rgba(${parseInt(o.slice(0,2),16)}, ${parseInt(o.slice(2,4),16)}, ${parseInt(o.slice(4,6),16)}, ${t})`}if(o.startsWith("rgba(")){const e=o.lastIndexOf(","),r=o.lastIndexOf(")");if(-1!==e&&r>e)return`${o.slice(0,e+1)} ${t})`}return o.startsWith("rgb(")?o.replace(/^rgb\(/,"rgba(").replace(/\)$/,`, ${t})`):e}var cf=(0,rf.forwardRef)(function(e,t){const o=(0,rf.useRef)(null);Rp(t,{variant:"xy",frameRef:o});const r=bp(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:n,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:u="y",areaBy:d,y0Accessor:h,gradientFill:p=!1,semanticGradient:f,lineDataAccessor:g="coordinates",colorBy:m,colorScheme:y,curve:b="monotoneX",areaOpacity:v=.7,lineGradient:x,showLine:k=!0,lineWidth:w=2,showPoints:S=!1,pointRadius:A=3,tooltip:C,annotations:M,forecast:j,anomaly:P,band:_,xExtent:L,yExtent:R,frameProps:T={},selection:I,linkedHover:$,onObservation:N,onClick:F,hoverHighlight:B,chartId:D,loading:E,loadingContent:H,emptyContent:O,legendInteraction:W,legendPosition:q,color:Y,stroke:G,strokeWidth:V,opacity:X}=e,{width:U,height:K,enableHover:Q,showGrid:Z,showLegend:J,title:ee,description:te,summary:oe,accessibleTable:re,xLabel:ne,yLabel:ie}=r,se=(0,rf.useMemo)(()=>z(n),[n]),ae=m||d,le=(0,rf.useMemo)(()=>{return f&&f.length>0?{colorStops:(e=f,e.filter(e=>Number.isFinite(e.at)).map(e=>({offset:1-Math.max(0,Math.min(100,e.at))/100,color:lf(e.color,e.opacity)})).sort((e,t)=>e.offset-t.offset))}:p;var e},[f,p]);dd("AreaChart",se,"xAccessor",c),dd("AreaChart",se,"yAccessor",u);const ce=_p({data:se,rawData:n,colorBy:ae,colorScheme:y,legendInteraction:W,legendPosition:q,selection:I,linkedHover:$,fallbackFields:ae?["string"==typeof ae?ae:""]:[],unwrapData:!1,onObservation:N,onClick:F,hoverHighlight:B,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"AreaChart",chartId:D,showLegend:J,userMargin:i,marginDefaults:r.marginDefaults,loading:E,loadingContent:H,emptyContent:O,width:U,height:K}),{effectiveData:ue,statisticalAnnotations:de}=qp({data:se,xAccessor:c,yAccessor:u,forecast:j,anomaly:P,groupBy:d}),{flattenedData:he,lineStyle:pe,pointStyle:fe,defaultTooltipContent:ge}=sf({safeData:ue,data:n,areaBy:d,lineDataAccessor:g,colorBy:ae,colorScale:ce.colorScale,color:Y,stroke:G,strokeWidth:V,opacity:X,effectiveSelectionHook:ce.effectiveSelectionHook,resolvedSelection:ce.resolvedSelection,areaOpacity:v,showLine:k,lineWidth:w,showPoints:S,pointRadius:A,xAccessor:c,yAccessor:u,xLabel:ne,yLabel:ie,xFormat:a,yFormat:l,groupField:d||m,band:_}),me=Sp({componentName:"AreaChart",data:n,accessors:{xAccessor:c,yAccessor:u}}),ye={chartType:"area",...null!=n&&{data:he},xAccessor:c,yAccessor:u,groupAccessor:d||void 0,...h&&{y0Accessor:h},..._&&{band:_},...le&&{gradientFill:le},...x&&{lineGradient:x},curve:b,lineStyle:pe,...S&&fe&&{pointStyle:fe},size:[U,K],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ce.margin,showAxes:r.showAxes,xLabel:ne,yLabel:ie,xFormat:a,yFormat:l,enableHover:Q,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:Z,...ce.legendBehaviorProps,...Yd({title:ee,description:te,summary:oe,accessibleTable:re,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),..."multi"===C?{tooltipContent:Fs(),tooltipMode:"multi"}:Vd({tooltip:C,defaultTooltipContent:ge}),...Gd({linkedHover:$,selection:I,onObservation:N,onClick:F,hoverHighlight:B,mobileInteraction:ce.mobileInteraction,customHoverBehavior:ce.customHoverBehavior,customClickBehavior:ce.customClickBehavior}),...(M&&M.length>0||de.length>0)&&{annotations:[...M||[],...de]},...L&&{xExtent:L},...R&&{yExtent:R},...ce.crosshairProps,...T};return ce.earlyReturn?ce.earlyReturn:me?(0,af.jsx)(td,{componentName:"AreaChart",message:me,width:U,height:K}):(0,af.jsx)(sd,{componentName:"AreaChart",width:U,height:K,children:(0,af.jsx)(Ka,{ref:o,...ye})})});cf.displayName="AreaChart";var uf=require("react"),df=require("react/jsx-runtime");function hf(e){if(null==e)return NaN;if("number"==typeof e)return e;if(e instanceof Date)return e.getTime();if("string"==typeof e){if(""===e.trim())return NaN;const t=+e;return Number.isFinite(t)?t:NaN}return NaN}var pf=(0,uf.forwardRef)(function(e,t){const o=(0,uf.useRef)(null),r=bp(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:n,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",seriesAAccessor:u="a",seriesBAccessor:d="b",seriesALabel:h="A",seriesBLabel:p="B",seriesAColor:f="var(--semiotic-danger, #dc2626)",seriesBColor:g="var(--semiotic-info, #2563eb)",showLines:m=!0,lineWidth:y=1.5,showPoints:b=!1,pointRadius:v=3,curve:x="linear",areaOpacity:k=.6,gradientFill:w,tooltip:S,annotations:A,xExtent:C,yExtent:M,frameProps:j={},selection:P,linkedHover:_,onObservation:L,onClick:R,hoverHighlight:T,chartId:I,loading:$,loadingContent:N,emptyContent:F,legendInteraction:B,legendPosition:D,pointIdAccessor:E,windowSize:H}=e,{width:O,height:W,enableHover:q,showGrid:Y,showLegend:G,title:V,description:X,summary:U,accessibleTable:K,xLabel:Q,yLabel:Z}=r,J=(0,uf.useMemo)(()=>"function"==typeof c?e=>hf(c(e)):e=>hf(e[c]),[c]),ee=(0,uf.useMemo)(()=>"function"==typeof u?e=>hf(u(e)):e=>hf(e[u]),[u]),te=(0,uf.useMemo)(()=>"function"==typeof d?e=>hf(d(e)):e=>hf(e[d]),[d]),[oe,re]=(0,uf.useState)([]),ne=(0,uf.useRef)([]),ie=null==n,se=(0,uf.useMemo)(()=>z(ie?oe:n),[ie,oe,n]),ae=(0,uf.useMemo)(()=>function(e,t,o,r){if(!e.length)return[];const n=e.filter(e=>Number.isFinite(t(e))).sort((e,o)=>t(e)-t(o)),i=[];let s=0,a=null,l=null,c=[];const u=(e,t)=>e>t?"A":t>e?"B":null,d=e=>`seg-${s}-${e}`,h=e=>i.push(e),p=(e,t)=>{h({__x:e.x,__y:e.y,__y0:e.y,__diffSegment:d(t),__diffWinner:t,__valA:e.y,__valB:e.y,__sourceDatum:e.datum})};for(let e=0;n.length>e;e++){const i=n[e],f=t(i),g=o(i),m=r(i);if(!Number.isFinite(f)||!Number.isFinite(g)||!Number.isFinite(m))continue;const y=u(g,m);if(null!==y)if(null!=a){if(l&&l.w!==y){let e,t;if(c.length>0)e=c[0].x,t=c[0].y;else{const o=g-l.a-(m-l.b);if(0!==o){const r=Math.max(0,Math.min(1,(l.b-l.a)/o));e=l.x+r*(f-l.x),t=l.a+r*(g-l.a)}else e=l.x,t=l.a}h({__x:e,__y:t,__y0:t,__diffSegment:d(a),__diffWinner:a,__valA:t,__valB:t}),s++,a=y,h({__x:e,__y:t,__y0:t,__diffSegment:d(a),__diffWinner:a,__valA:t,__valB:t});for(let e=1;c.length>e;e++)p(c[e],a)}else for(const e of c)p(e,a);c=[],h({__x:f,__y:m>g?m:g,__y0:m>g?g:m,__diffSegment:d(a),__diffWinner:a,__valA:g,__valB:m,__sourceDatum:i}),l={x:f,a:g,b:m,w:y}}else{a=y;for(const e of c)p(e,a);c=[],h({__x:f,__y:m>g?m:g,__y0:m>g?g:m,__diffSegment:d(a),__diffWinner:a,__valA:g,__valB:m,__sourceDatum:i}),l={x:f,a:g,b:m,w:y}}else c.push({x:f,y:g,datum:i})}for(const e of c)p(e,a??"A");return i}(se,J,ee,te),[se,J,ee,te]),le=(0,uf.useMemo)(()=>m?function(e,t,o,r){if(!e.length)return[];const n=e.filter(e=>Number.isFinite(t(e))).sort((e,o)=>t(e)-t(o)),i=[];for(const e of n){const n=t(e),s=o(e),a=r(e);Number.isFinite(s)&&i.push({__x:n,__y:s,__diffSegment:"line-A"}),Number.isFinite(a)&&i.push({__x:n,__y:a,__diffSegment:"line-B"})}return i}(se,J,ee,te):[],[m,se,J,ee,te]),ce=(0,uf.useMemo)(()=>[...ae,...le],[ae,le]),ue=(0,uf.useMemo)(()=>{const e=new Set;for(const t of ae)e.add(t.__diffSegment);return Array.from(e)},[ae]);(0,uf.useImperativeHandle)(t,()=>{const e=e=>{const t=H&&e.length>H?e.slice(e.length-H):e;ne.current=t,re(t)},t=E?"function"==typeof E?E:e=>e[E]:null;return{push:t=>e([...ne.current,t]),pushMany:t=>e([...ne.current,...t]),remove:o=>{if(!t)return[];const r=Array.isArray(o)?o:[o],n=[],i=[];for(const e of ne.current)r.includes(t(e))?n.push(e):i.push(e);return e(i),n},update:(o,r)=>{if(!t)return[];const n=Array.isArray(o)?o:[o],i=[],s=ne.current.map(e=>{if(n.includes(t(e))){const t=r(e);return i.push(t),t}return e});return e(s),i},clear:()=>e([]),getData:()=>ie?ne.current:se,getScales:()=>o.current?.getScales()??null}},[ie,se,E,H]);const de=_p({data:se,rawData:n,colorBy:"__diffWinner",colorScheme:[f,g],legendInteraction:B,legendPosition:D,selection:P,linkedHover:_,fallbackFields:["__diffWinner"],unwrapData:!1,onObservation:L,onClick:R,hoverHighlight:T,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"DifferenceChart",chartId:I,showLegend:G,userMargin:i,marginDefaults:r.marginDefaults,loading:$,loadingContent:N,emptyContent:F,width:O,height:W}),he=(0,uf.useMemo)(()=>{if(!1!==G)return{legendGroups:[{label:"",type:"fill",styleFn:e=>({fill:e.color||"currentColor"}),items:[{label:h,color:f},{label:p,color:g}]}]}},[G,h,p,f,g]),pe=(0,uf.useCallback)(e=>{const t=e.__diffSegment;return{fill:"A"==(t?.endsWith("-A")?"A":"B")?f:g,stroke:"none",fillOpacity:k}},[f,g,k]),fe=(0,uf.useCallback)(e=>({stroke:"A"==("line-A"===e.__diffSegment?"A":"B")?f:g,strokeWidth:y,fill:"none"}),[f,g,y]),ge=(0,uf.useCallback)(e=>({fill:"A"==("line-A"===e.__diffSegment?"A":"B")?f:g,r:v}),[f,g,v]),me=(0,uf.useCallback)(e=>{const t=e.data,o=e.allSeries,r=e.xValue??t?.__x;let n=t?.__valA,i=t?.__valB;if(o&&o.length>0){const e=o.find(e=>"line-A"===e.group),t=o.find(e=>"line-B"===e.group);null!=e?.value&&Number.isFinite(e.value)&&(n=e.value),null!=t?.value&&Number.isFinite(t.value)&&(i=t.value)}if(null!=r&&(null==n||null==i)){const e=se.find(e=>J(e)===r);e&&(null==n&&(n=ee(e)),null==i&&(i=te(e)))}const s=e=>null!=e&&Number.isFinite(e)?""+Math.round(100*e)/100:"—",l=a&&null!=r?a(r):null!=r?r+"":"";return(0,df.jsxs)("div",{className:"semiotic-tooltip",style:Rs,children:[l&&(0,df.jsx)("div",{style:{fontWeight:600,marginBottom:4},children:l}),(0,df.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6},children:[(0,df.jsx)("span",{style:{width:10,height:10,background:f,display:"inline-block",borderRadius:2}}),(0,df.jsxs)("span",{children:[h,": ",s(n)]})]}),(0,df.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6},children:[(0,df.jsx)("span",{style:{width:10,height:10,background:g,display:"inline-block",borderRadius:2}}),(0,df.jsxs)("span",{children:[p,": ",s(i)]})]}),null!=n&&null!=i&&Number.isFinite(n)&&Number.isFinite(i)&&(0,df.jsxs)("div",{style:{marginTop:4,opacity:.7},children:["Δ = ",s(n-i)]})]})},[se,J,ee,te,a,f,g,h,p]),ye="multi"===S,be=(0,uf.useMemo)(()=>!1===S?()=>null:ye?me:Bs(S)||me,[S,ye,me]);if(de.earlyReturn)return de.earlyReturn;const ve={chartType:"mixed",data:ce,xAccessor:"__x",yAccessor:"__y",y0Accessor:"__y0",groupAccessor:"__diffSegment",areaGroups:ue,curve:x,areaStyle:pe,lineStyle:fe,...b&&{pointStyle:ge},size:[O,W],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:de.margin,showAxes:r.showAxes,xLabel:Q,yLabel:Z,xFormat:a,yFormat:l,enableHover:q,showGrid:Y,...w&&{gradientFill:!0===w?{topOpacity:.85,bottomOpacity:.15}:w},...he&&{legend:he,legendPosition:de.legendPosition},...Yd({title:V,description:X,summary:U,accessibleTable:K,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),tooltipContent:be,...ye&&{tooltipMode:"multi"},...Gd({linkedHover:_,selection:P,onObservation:L,onClick:R,hoverHighlight:T,mobileInteraction:de.mobileInteraction,customHoverBehavior:de.customHoverBehavior,customClickBehavior:de.customClickBehavior}),...A&&A.length>0&&{annotations:A},...C&&{xExtent:C},...M&&{yExtent:M},...de.crosshairProps,...j};return(0,df.jsx)(sd,{componentName:"DifferenceChart",width:O,height:W,children:(0,df.jsx)(Ka,{ref:o,...ve})})});"function"==typeof pf&&(pf.displayName="DifferenceChart");var ff=require("react"),gf=require("react/jsx-runtime"),mf=(0,ff.forwardRef)(function(e,t){const o=(0,ff.useRef)(null),r=bp(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:n,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:u="y",areaBy:d,lineDataAccessor:h="coordinates",colorBy:p,colorScheme:f,curve:g="monotoneX",areaOpacity:m=.7,showLine:y=!0,lineWidth:b=2,showPoints:v=!1,pointRadius:x=3,normalize:k=!1,baseline:w="zero",stackOrder:S,tooltip:A,annotations:C,xExtent:M,yExtent:j,frameProps:P={},selection:_,linkedHover:L,onObservation:R,onClick:T,hoverHighlight:I,chartId:$,loading:N,loadingContent:F,emptyContent:B,legendInteraction:D,legendPosition:E,color:H,stroke:O,strokeWidth:W,opacity:q}=e,{width:Y,height:G,enableHover:V,showGrid:X,showLegend:U,title:K,description:Q,summary:Z,accessibleTable:J,xLabel:ee,yLabel:te}=r,oe=(0,ff.useMemo)(()=>z(n),[n]),re=p||d;Rp(t,{variant:"xy",frameRef:o});const ne=_p({data:oe,rawData:n,colorBy:re,colorScheme:f,legendInteraction:D,legendPosition:E,selection:_,linkedHover:L,fallbackFields:re?["string"==typeof re?re:""]:[],unwrapData:!1,onObservation:R,onClick:T,hoverHighlight:I,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"StackedAreaChart",chartId:$,showLegend:U,userMargin:i,marginDefaults:r.marginDefaults,loading:N,loadingContent:F,emptyContent:B,width:Y,height:G}),{flattenedData:ie,lineStyle:se,pointStyle:ae,defaultTooltipContent:le}=sf({safeData:oe,data:n,areaBy:d,lineDataAccessor:h,colorBy:re,colorScale:ne.colorScale,color:H,stroke:O,strokeWidth:W,opacity:q,effectiveSelectionHook:ne.effectiveSelectionHook,resolvedSelection:ne.resolvedSelection,areaOpacity:m,showLine:y,lineWidth:b,showPoints:v,pointRadius:x,xAccessor:c,yAccessor:u,xLabel:ee,yLabel:te,xFormat:a,yFormat:l,groupField:d||p}),ce=Sp({componentName:"StackedAreaChart",data:n,accessors:{xAccessor:c,yAccessor:u}}),ue={chartType:"stackedarea",...null!=n&&{data:ie},xAccessor:c,yAccessor:u,groupAccessor:d||void 0,curve:g,normalize:k,baseline:k?"zero":w,stackOrder:S,lineStyle:se,...v&&ae&&{pointStyle:ae},size:[Y,G],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ne.margin,showAxes:r.showAxes,xLabel:ee,yLabel:te,xFormat:a,yFormat:l,enableHover:V,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:X,...ne.legendBehaviorProps,...Yd({title:K,description:Q,summary:Z,accessibleTable:J,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),..."multi"===A?{tooltipContent:Fs(),tooltipMode:"multi"}:Vd({tooltip:A,defaultTooltipContent:le}),...Gd({linkedHover:L,selection:_,onObservation:R,onClick:T,hoverHighlight:I,mobileInteraction:ne.mobileInteraction,customHoverBehavior:ne.customHoverBehavior,customClickBehavior:ne.customClickBehavior}),...C&&C.length>0&&{annotations:C},...M&&{xExtent:M},...j&&{yExtent:j},...ne.crosshairProps,...P};return ne.earlyReturn?ne.earlyReturn:ce?(0,gf.jsx)(td,{componentName:"StackedAreaChart",message:ce,width:Y,height:G}):(0,gf.jsx)(sd,{componentName:"StackedAreaChart",width:Y,height:G,children:(0,gf.jsx)(Ka,{ref:o,...ue})})});mf.displayName="StackedAreaChart";var yf=require("react"),bf=require("d3-scale");h();var vf=require("react/jsx-runtime"),xf=(0,yf.forwardRef)(function(e,t){const o=(0,yf.useRef)(null);Rp(t,{variant:"xy",frameRef:o});const r=bp(e.mode,{width:e.width,height:e.height,showGrid:void 0,enableHover:e.enableHover,showLegend:void 0,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:n,margin:i,className:s,xAccessor:a="x",yAccessor:l="y",valueAccessor:c="value",xFormat:d,yFormat:h,colorScheme:p,customColorScale:f,showValues:g=!1,valueFormat:m,cellBorderColor:y="#fff",cellBorderWidth:b=1,tooltip:v,annotations:x,xExtent:k,yExtent:w,frameProps:S={},selection:A,linkedHover:C,onObservation:M,onClick:j,hoverHighlight:P,chartId:_,loading:L,loadingContent:R,emptyContent:T,showLegend:I,legendPosition:$,legendInteraction:N}=e,{width:F,height:B,enableHover:D,title:E,description:H,summary:O,accessibleTable:W,xLabel:q,yLabel:Y}=r,G=ud(L,F,B,R),V=G?null:cd(n,F,B,T),X=(0,yf.useMemo)(()=>z(n),[n]),U=function(){const e=Zh();return e?.colors?.sequential||void 0}(),K=p??U??"blues",Q=I??!1,Z=$??"right",{margin:J}=gp({data:X,colorBy:Q?"value":void 0,colorScale:void 0,showLegend:Q,legendPosition:Z,userMargin:i,defaults:r.marginDefaults}),{customHoverBehavior:ee,customClickBehavior:te,crosshairSourceId:oe}=pp({selection:A,linkedHover:C,fallbackFields:[],onObservation:M,onClick:j,chartType:"Heatmap",chartId:_,hoverHighlight:P,colorByField:void 0,mobileInteraction:r.mobileInteraction});Pp(A);const re=fp(C,oe);mp(N,void 0,[]);const ne=(0,yf.useMemo)(()=>"function"==typeof c?e=>c(e):e=>e[c],[c]),ie=(0,yf.useMemo)(()=>u(X.map(ne)),[X,ne]),se=(0,yf.useMemo)(()=>{if("custom"===K&&f)return f;const e=_e(K);return(0,bf.scaleSequential)(e).domain(ie)},[K,f,ie]),ae=(0,yf.useMemo)(()=>za([{label:q||Na(a),accessor:a,role:"x",format:d},{label:Y||Na(l),accessor:l,role:"y",format:h},{label:Na(c),accessor:c,role:"value",format:m}]),[a,l,q,Y,c,d,h,m]),le=Sp({componentName:"Heatmap",data:n,accessors:{xAccessor:a,yAccessor:l,valueAccessor:c}}),ce=(0,yf.useMemo)(()=>{if(Q)return{gradient:{colorFn:e=>se(e),domain:ie,label:"string"==typeof c?c:"value",format:m}}},[Q,se,ie,c,m]),ue={chartType:"heatmap",...null!=n&&{data:X},xAccessor:a,yAccessor:l,valueAccessor:c,colorScheme:"custom"!==K?K:void 0,showValues:g,heatmapValueFormat:m,size:[F,B],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:J,showAxes:r.showAxes,xLabel:q,yLabel:Y,xFormat:d,yFormat:h,enableHover:D,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...ce&&{legend:ce,legendPosition:Z},...Yd({title:E,description:H,summary:O,accessibleTable:W,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Vd({tooltip:v,defaultTooltipContent:ae}),...Gd({linkedHover:C,selection:A,onObservation:M,onClick:j,hoverHighlight:P,mobileInteraction:r.mobileInteraction,customHoverBehavior:ee,customClickBehavior:te}),...x&&x.length>0&&{annotations:x},...k&&{xExtent:k},...w&&{yExtent:w},...re,...S};return G||V||(le?(0,vf.jsx)(td,{componentName:"Heatmap",message:le,width:F,height:B}):(0,vf.jsx)(sd,{componentName:"Heatmap",width:F,height:B,children:(0,vf.jsx)(Ka,{ref:o,...ue})}))});xf.displayName="Heatmap";var kf=require("react"),wf=require("react/jsx-runtime"),Sf=(0,kf.forwardRef)(function(e,t){const o=(0,kf.useRef)(null),r=bp(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:n,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:u="y",sizeBy:d,sizeRange:h=[5,40],colorBy:p,colorScheme:f,bubbleOpacity:g=.6,bubbleStrokeWidth:m=1,bubbleStrokeColor:y="white",tooltip:b,marginalGraphics:v,pointIdAccessor:x,annotations:k,regression:w,xExtent:S,yExtent:A,frameProps:C={},selection:M,linkedHover:j,linkedBrush:P,onObservation:_,onClick:L,hoverHighlight:R,chartId:T,loading:I,loadingContent:$,emptyContent:N,legendInteraction:F,legendPosition:B,color:D,stroke:E,strokeWidth:H,opacity:O}=e,{width:W,height:q,enableHover:Y,showGrid:G,showLegend:V,title:X,description:U,summary:K,accessibleTable:Q,xLabel:Z,yLabel:J}=r,ee=(0,kf.useMemo)(()=>z(n),[n]),te=void 0===n,oe=_p({data:ee,rawData:n,colorBy:p,colorScheme:f,legendInteraction:F,legendPosition:B,selection:M,linkedHover:j,fallbackFields:p?["string"==typeof p?p:""]:[],unwrapData:!1,onObservation:_,onClick:L,hoverHighlight:R,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"BubbleChart",chartId:T,showLegend:V,userMargin:i,marginDefaults:r.marginDefaults,loading:I,loadingContent:$,emptyContent:N,width:W,height:q}),{domain:re,trackPushed:ne,reset:ie}=Fp({accessor:d,data:ee,isPushMode:te}),se=(0,kf.useCallback)(e=>{ne([e]),o.current?.push(e)},[ne]),ae=(0,kf.useCallback)(e=>{ne(e),o.current?.pushMany(e)},[ne]);Rp(t,{variant:"xy",frameRef:o,overrides:{push:se,pushMany:ae,clear:()=>{ie(),o.current?.clear()}},deps:[se,ae,ie]});const le=Nh(P),ce=(mh({name:le?.name||"__unused_brush__",xField:le?.xField||("string"==typeof c?c:void 0),yField:le?.yField||("string"==typeof u?u:void 0)}),(0,kf.useMemo)(()=>({stroke:y,strokeWidth:m}),[y,m])),ue=(0,kf.useMemo)(()=>re??[0,1],[re]),de=(0,kf.useCallback)(e=>Ye(e,d,h,ue),[d,h,ue]),he=$p({colorBy:p,colorScale:oe.colorScale,color:D,fillOpacity:g,radiusFn:de,baseStyleExtras:ce,stroke:E,strokeWidth:H,opacity:O,effectiveSelectionHook:oe.effectiveSelectionHook,resolvedSelection:oe.resolvedSelection}),pe=(0,kf.useMemo)(()=>za([{label:Z||Na(c),accessor:c,role:"x",format:a},{label:J||Na(u),accessor:u,role:"y",format:l},{label:Na(d),accessor:d,role:"size"},...p?[{label:Na(p),accessor:p,role:"color"}]:[]]),[c,u,Z,J,d,p,a,l]);if(oe.earlyReturn)return oe.earlyReturn;const fe=Sp({componentName:"BubbleChart",data:n,accessors:{xAccessor:c,yAccessor:u},requiredProps:{sizeBy:d}});if(fe)return(0,wf.jsx)(td,{componentName:"BubbleChart",message:fe,width:W,height:q});const ge=Bp(w),me=ge?[ge,...k||[]]:k,ye={chartType:"bubble",...null!=n&&{data:ee},xAccessor:c,yAccessor:u,colorAccessor:p||void 0,sizeAccessor:d,sizeRange:h,pointStyle:he,colorScheme:f,size:[W,q],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:oe.margin,showAxes:r.showAxes,xLabel:Z,yLabel:J,xFormat:a,yFormat:l,enableHover:Y,showGrid:G,...oe.legendBehaviorProps,...Yd({title:X,description:U,summary:K,accessibleTable:Q,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Vd({tooltip:b,defaultTooltipContent:pe}),...Gd({linkedHover:j,selection:M,onObservation:_,onClick:L,hoverHighlight:R,mobileInteraction:oe.mobileInteraction,customHoverBehavior:oe.customHoverBehavior,customClickBehavior:oe.customClickBehavior}),...v&&{marginalGraphics:v},...x&&{pointIdAccessor:x},...me&&me.length>0&&{annotations:me},...S&&{xExtent:S},...A&&{yExtent:A},...oe.crosshairProps,...C};return(0,wf.jsx)(sd,{componentName:"BubbleChart",width:W,height:q,children:(0,wf.jsx)(Ka,{ref:o,...ye})})});Sf.displayName="BubbleChart";var Af=c(require("react")),Cf=require("react"),Mf=require("d3-brush"),jf=require("d3-selection");h();var Pf=require("react/jsx-runtime"),_f="__splomIdx",Lf="splom-hover-source",Rf={top:4,bottom:4,left:4,right:4};function Tf({frameRef:e,cellSize:t,onBrush:o}){const r=(0,Cf.useRef)(null),n=t-Rf.left-Rf.right,i=t-Rf.top-Rf.bottom;return(0,Cf.useEffect)(()=>{if(!r.current)return;const t=(0,jf.select)(r.current).select(".brush-g"),s=(0,Mf.brush)().extent([[0,0],[n,i]]).on("brush end",t=>{const r=e.current?.getScales();if(!r)return;if(!t.selection)return void o(null);const[[n,i],[s,a]]=t.selection,l=[[r.x.invert(n),r.y.invert(i)],[r.x.invert(s),r.y.invert(a)]];o(l)});return t.call(s),t.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{s.on("brush end",null)}},[n,i,e,o]),(0,Pf.jsx)("svg",{ref:r,width:t,height:t,style:{position:"absolute",top:0,left:0},children:(0,Pf.jsx)("g",{className:"brush-g",transform:`translate(${Rf.left},${Rf.top})`})})}function If({data:e,xField:t,yField:o,cellSize:r,pointRadius:n,pointOpacity:i,colorBy:s,colorScale:a,brushSelectionName:l,hoverSelectionName:c,unselectedOpacity:u,mobileInteraction:d,mode:h,onPointHover:p,onPointClick:f}){const g=(0,Cf.useRef)(null),m=hh({name:l,clientId:`splom-${t}-${o}`,fields:[t,o]}),y=mh({name:l,xField:t,yField:o}),b=hh({name:c,clientId:Lf,fields:[_f]}),v=b.selectPoints,x=(0,Cf.useCallback)(e=>{e?y.brushInteraction.during(e):y.brushInteraction.end(null)},[y.brushInteraction]),k=(0,Cf.useCallback)(e=>{if(!e)return void p?.(null);const t=e.data,o=t?.[_f];void 0!==o&&(v({[_f]:[o]}),p?.(t,e.x+Rf.left,e.y+Rf.top))},[v,p]),w=(0,Cf.useCallback)(e=>{if(!e)return void f?.(null);const t=e.data;t&&f?.(t,e.x+Rf.left,e.y+Rf.top)},[f]),S=(0,Cf.useCallback)(e=>{const t={opacity:i,r:n};return t.fill=s?Oe(e,s,a):op,"hover"===h?b.isActive&&b.predicate(e)?(t.opacity=1,t.r=2.5*n,t.stroke="#333",t.strokeWidth=1.5):b.isActive&&(t.opacity=.6*i):m.isActive&&!m.predicate(e)&&(t.opacity=u),t},[s,a,i,n,h,m.isActive,m.predicate,b.isActive,b.predicate,u]);return(0,Pf.jsxs)("div",{style:{position:"relative",width:r,height:r},children:[(0,Pf.jsx)(Ka,{ref:g,chartType:"scatter",data:e,size:[r,r],xAccessor:t,yAccessor:o,pointStyle:S,margin:Rf,showAxes:!1,enableHover:"hover"===h,...Gd({forceHoverBehavior:"hover"===h,forceClickBehavior:!!f,mobileInteraction:d,customHoverBehavior:k,customClickBehavior:w}),tooltipContent:"hover"===h?()=>null:void 0}),"brush"===h&&(0,Pf.jsx)(Tf,{frameRef:g,cellSize:r,xField:t,yField:o,onBrush:x})]})}function $f({data:e,field:t,label:o,cellSize:r,bins:n,colorBy:i,colorScale:s,brushSelectionName:a,hoverSelectionName:l,mode:c}){const h=hh({name:a,clientId:"splom-diag-"+t,fields:[t]}),p=hh({name:l,clientId:`splom-diag-${t}-hover`,fields:[_f]}),f="hover"===c?p:h,g=f.isActive,m=f.predicate,y=(0,Cf.useMemo)(()=>{const o="string"==typeof i?i:null,s=[],a=new Set;for(const r of e){const e=r[t];if(null==e||isNaN(e)||s.push(Number(e)),o){const e=r[o];null!=e&&a.add(e+"")}}if(0===s.length)return{bars:[],selectedBars:[],categoryBars:[],selectedCategoryBars:[],max:0,categories:[]};const[l,c]=u(s),h=(c-l)/n||1,p=Array.from(a),f=new Map(p.map((e,t)=>[e,t])),y=Array(n).fill(0),b=Array(n).fill(0),v=Array.from({length:n},()=>Array(p.length).fill(0)),x=Array.from({length:n},()=>Array(p.length).fill(0));for(const r of e){const e=r[t];if(null==e||isNaN(e))continue;const i=Math.min(Math.floor((e-l)/h),n-1);if(y[i]++,g&&!m(r)||b[i]++,o){const e=f.get(r[o]+"");void 0!==e&&(v[i][e]++,g&&!m(r)||x[i][e]++)}}const k=d(y,1),w=v.map((e,t)=>{let o=0;return e.map((e,i)=>{const s=e/k*(r-24),a={x:t/n*r,w:r/n-1,h:s,y0:o,category:p[i]};return o+=s,a})}),S=x.map((e,t)=>{let o=0;return e.map((e,i)=>{const s=e/k*(r-24),a={x:t/n*r,w:r/n-1,h:s,y0:o,category:p[i]};return o+=s,a})});return{bars:y.map((e,t)=>({x:t/n*r,w:r/n-1,h:e/k*(r-24),count:e})),selectedBars:b.map((e,t)=>({x:t/n*r,w:r/n-1,h:e/k*(r-24),count:e})),categoryBars:w,selectedCategoryBars:S,max:k,categories:p}},[e,t,n,r,g,m,i]);return(0,Pf.jsxs)("svg",{width:r,height:r,style:{overflow:"hidden"},children:[(0,Pf.jsx)("text",{x:r/2,y:14,textAnchor:"middle",fontSize:11,fontWeight:"bold",fill:"#333",children:o}),y.categories.length>0?y.categoryBars.map((e,t)=>e.map((e,o)=>(0,Pf.jsx)("rect",{x:e.x,y:r-e.y0-e.h,width:Math.max(e.w,1),height:e.h,fill:s?s(e.category):op,opacity:g?.3:.6},`bg-${t}-${o}`))):y.bars.map((e,t)=>(0,Pf.jsx)("rect",{x:e.x,y:r-e.h,width:Math.max(e.w,1),height:e.h,fill:op,opacity:g?.3:.6},"bg-"+t)),g&&(y.categories.length>0?y.selectedCategoryBars.map((e,t)=>e.map((e,o)=>(0,Pf.jsx)("rect",{x:e.x,y:r-e.y0-e.h,width:Math.max(e.w,1),height:e.h,fill:s?s(e.category):op,opacity:.7},`sel-${t}-${o}`))):y.selectedBars.map((e,t)=>(0,Pf.jsx)("rect",{x:e.x,y:r-e.h,width:Math.max(e.w,1),height:e.h,fill:op,opacity:.7},"sel-"+t)))]})}function Nf({label:e,cellSize:t}){return(0,Pf.jsx)("svg",{width:t,height:t,children:(0,Pf.jsx)("text",{x:t/2,y:t/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:12,fontWeight:"bold",fill:"#333",children:e})})}function Ff(e){const{data:t,fields:o,fieldLabels:r={},colorBy:n,colorScheme:i,cellSize:s=150,cellGap:a=4,pointRadius:l=2,pointOpacity:c=.5,diagonal:u="histogram",histogramBins:d=20,brushMode:h="crossfilter",hoverMode:p=!0,unselectedOpacity:f=.1,showGrid:g=!1,tooltip:m,showLegend:y,idAccessor:b,width:v,className:x,onObservation:k,onClick:w,chartId:S}=e,A="splom",C="splom-hover",M=lp(e.mobileInteraction,{mode:e.mode,width:v??o.length*s,mobileSemantics:e.mobileSemantics}),j=p?"hover":h?"brush":"hover",P=lh(e=>e.clearSelection),[_,L]=(0,Cf.useState)(null),R=(0,Cf.useCallback)(()=>{P(C),L(null)},[P,C]),T=(0,Cf.useMemo)(()=>(t||[]).map((e,t)=>void 0!==e[_f]?e:{...e,[_f]:t}),[t]),I=dp(T,n,i),$=(0,Cf.useCallback)((e,t,o,r)=>[40+e*(s+a)+(o??0),t*(s+a)+(r??0)],[40,s,a]),N=void 0!==y?y:!!n,F=(0,Cf.useMemo)(()=>{if(!N||!n)return null;const e="string"==typeof n?n:null;return e?Array.from(new Set(T.map(t=>t[e]).filter(e=>null!=e))).map(e=>({label:e+"",color:I?I(e+""):op})):null},[N,n,T,I]),B=(0,Cf.useMemo)(()=>({display:"grid",gridTemplateColumns:"40px "+o.map(()=>s+"px").join(" "),gridTemplateRows:o.map(()=>s+"px").join(" ")+" 40px",gap:a+"px",width:"fit-content"}),[o,s,a,40]);return(0,Pf.jsxs)("div",{className:x,style:{position:"relative"},children:[F&&(0,Pf.jsx)("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"},children:F.map(e=>(0,Pf.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4},children:[(0,Pf.jsx)("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",backgroundColor:e.color}}),(0,Pf.jsx)("span",{style:{fontSize:11},children:e.label})]},e.label))}),(0,Pf.jsxs)("div",{style:B,onMouseLeave:"hover"===j?R:void 0,children:[o.map((e,t)=>(0,Pf.jsxs)(Af.Fragment,{children:[(0,Pf.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:11,fontWeight:"bold",color:"#333"},children:r[e]||e}),o.map((o,i)=>t===i?"label"===u?(0,Pf.jsx)(Nf,{label:r[e]||e,cellSize:s},"diag-"+e):(0,Pf.jsx)($f,{data:T,field:e,label:r[e]||e,cellSize:s,bins:d,colorBy:n,colorScale:I,brushSelectionName:A,hoverSelectionName:C,unselectedOpacity:f,mode:j},"diag-"+e):(0,Pf.jsx)(If,{data:T,xField:o,yField:e,fieldLabels:r,cellSize:s,pointRadius:l,pointOpacity:c,colorBy:n,colorScale:I,brushSelectionName:A,hoverSelectionName:C,unselectedOpacity:f,showGrid:g,tooltip:m,mobileInteraction:M,mode:j,onPointHover:"hover"===j?(r,n,s)=>{if(r){if(L({datum:r,xField:o,yField:e,colIndex:i,rowIndex:t,px:n??0,py:s??0}),k){const[e,o]=$(i,t,n,s);k({type:"hover",datum:r,x:e,y:o,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:S})}}else L(null),k&&k({type:"hover-end",timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:S})}:void 0,onPointClick:w||k?(e,o,r)=>{if(!e)return;const[n,s]=$(i,t,o,r);w&&w(e,{x:n,y:s}),k&&k({type:"click",datum:e,x:n,y:s,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:S})}:void 0},`cell-${e}-${o}`))]},"row-"+e)),(0,Pf.jsx)("div",{})," ",o.map(e=>(0,Pf.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:"bold",color:"#333"},children:r[e]||e},"col-label-"+e))]}),_&&"hover"===j&&(()=>{const e=_.datum,t=r[_.xField]||_.xField,o=r[_.yField]||_.yField,i=n?"function"==typeof n?n(e):e[n]:null,l=b?"function"==typeof b?b(e):e[b]:"Row "+e[_f];return(0,Pf.jsxs)("div",{style:{position:"absolute",left:40+_.colIndex*(s+a)+_.px,top:_.rowIndex*(s+a)+_.py-8,transform:"translate(-50%, -100%)",color:"#333",background:"rgba(255,255,255,0.95)",border:"1px solid #ddd",borderRadius:3,padding:"4px 8px",fontSize:11,lineHeight:1.4,whiteSpace:"nowrap",pointerEvents:"none",zIndex:10},children:[(0,Pf.jsx)("div",{style:{fontWeight:"bold",marginBottom:2},children:l+""}),(0,Pf.jsxs)("div",{children:[t,": ",null!=e[_.xField]?Number(e[_.xField]).toFixed(1):"–"]}),(0,Pf.jsxs)("div",{children:[o,": ",null!=e[_.yField]?Number(e[_.yField]).toFixed(1):"–"]}),null!=i&&(0,Pf.jsxs)("div",{style:{opacity:.8},children:["string"==typeof n?n:"group",": ",i+""]})]})})()]})}function Bf(e){const{brushMode:t="crossfilter",hoverMode:o=!0}=e,r={};return!o&&t&&(r.splom={resolution:t}),o&&(r["splom-hover"]={resolution:"union"}),(0,Pf.jsx)(Ih,{selections:r,children:(0,Pf.jsx)(Ff,{...e})})}Bf.displayName="ScatterplotMatrix";var Df=require("react"),Ef=require("d3-brush"),zf=require("d3-selection"),Hf=require("react/jsx-runtime");function Of({width:e,height:t,margin:o,scales:r,brushDirection:n,extent:i,onBrush:s}){const a=(0,Df.useRef)(null),l=(0,Df.useRef)(null),c=(0,Df.useRef)(!1),u=e+o.left+o.right,d=t+o.top+o.bottom;return(0,Df.useEffect)(()=>{if(!a.current||!r)return;const o=(0,zf.select)(a.current).select(".brush-group"),i="x"===n?(0,Ef.brushX)().extent([[0,0],[e,t]]):(0,Ef.brushY)().extent([[0,0],[e,t]]);return i.on("brush end",e=>{if(c.current)return;if(!e.sourceEvent)return;const t=e.selection;if(!t)return void s(null);const o=("x"===n?r.x:r.y).invert;if(!o)return;const i=[o(t[0]),o(t[1])];s(i)}),o.call(i),l.current=i,o.select(".selection").attr("fill","steelblue").attr("fill-opacity",.2).attr("stroke","steelblue").attr("stroke-width",1),()=>{i.on("brush end",null)}},[r,e,t,n,s]),(0,Df.useEffect)(()=>{if(!l.current||!r||!a.current)return;const e=(0,zf.select)(a.current).select(".brush-group"),t="x"===n?r.x:r.y;if(c.current=!0,i){const o=[t(i[0]),t(i[1])];e.call(l.current.move,o)}else e.call(l.current.move,null);c.current=!1},[i,r,n]),(0,Hf.jsx)("svg",{ref:a,width:u,height:d,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:(0,Hf.jsx)("g",{className:"brush-group",transform:`translate(${o.left},${o.top})`})})}function Wf(e){const{data:t,width:o=600,height:r=400,margin:n,className:i,title:s,description:a,summary:l,xLabel:c,yLabel:u,xFormat:d,yFormat:h,xAccessor:p="x",yAccessor:f="y",lineBy:g,lineDataAccessor:m="coordinates",colorBy:y,colorScheme:b,curve:v="linear",lineWidth:x=2,fillArea:k=!1,areaOpacity:w=.3,showPoints:S=!1,pointRadius:A=3,enableHover:C=!0,showGrid:M=!1,showLegend:j,legendPosition:P,tooltip:_,minimap:L={},renderBefore:R=!1,onBrush:T,brushExtent:I,yExtent:$,frameProps:N={},loading:F,loadingContent:B,emptyContent:D}=e,E=ud(F,o,r,B),H=E?null:cd(t,o,r,D),O=(0,Df.useMemo)(()=>z(t),[t]),[W,q]=(0,Df.useState)(null),Y=I??W,G=(0,Df.useCallback)(e=>{I||q(e),T?.(e)},[I,T]),V=(0,Df.useRef)(null),[X,U]=(0,Df.useState)(null);(0,Df.useEffect)(()=>{let e=0,t=!1;const o=()=>{if(t)return;const r=V.current?.getScales?.();r?U(r):e=requestAnimationFrame(o)};return e=requestAnimationFrame(o),()=>{t=!0,e&&cancelAnimationFrame(e)}},[t]);const K=void 0!==O[0]?.[m],Q=(0,Df.useMemo)(()=>{if(K)return O;if(g){const e=O.reduce((e,t)=>{const o="function"==typeof g?g(t):t[g];if(!e[o]){const t={[m]:[]};"string"==typeof g&&(t[g]=o),e[o]=t}return e[o][m].push(t),e},{});return Object.values(e)}return[{[m]:O}]},[O,g,m,K]),Z=(0,Df.useMemo)(()=>K||g?Q.flatMap(e=>{const t=e[m]||[];return g&&"string"==typeof g?t.map(t=>({...t,[g]:e[g]})):t}):O,[Q,m,K,g,O]),J=dp(O,y,b),ee=Jp({lineWidth:x,colorBy:y,colorScale:J,fillArea:k,areaOpacity:w}),te=(0,Df.useMemo)(()=>{if(L.lineStyle)return L.lineStyle},[L.lineStyle]),oe=Jp({lineWidth:1,colorBy:y,colorScale:J}),re=te??oe,ne=(0,Df.useMemo)(()=>{if(S)return e=>{const t={r:A,fillOpacity:1};return t.fill=y?Oe(e.parentLine||e,y,J):op,t}},[S,A,y,J]),{legend:ie,margin:se,legendPosition:ae}=gp({data:Q,colorBy:y,colorScale:J,showLegend:j,legendPosition:P,userMargin:n}),le=L.height||60,ce=(0,Df.useMemo)(()=>({top:L.margin?.top??0,bottom:L.margin?.bottom??20,left:L.margin?.left??se.left,right:L.margin?.right??se.right}),[L.margin,se]),ue=L.brushDirection||"x",de=(0,Df.useMemo)(()=>za([{label:c||Na(p),accessor:p,role:"x",format:d},{label:u||Na(f),accessor:f,role:"y",format:h}]),[p,f,c,u,d,h]),he=Sp({componentName:"MinimapChart",data:t,accessors:{xAccessor:p,yAccessor:f}});if(he)return(0,Hf.jsx)(td,{componentName:"MinimapChart",message:he,width:o,height:r});const pe=k?"area":"line",fe={chartType:pe,data:Z,xAccessor:p,yAccessor:f,groupAccessor:g||void 0,curve:v,lineStyle:ee,...S&&{pointStyle:ne},size:[o,r],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:se,showAxes:!0,xLabel:c,yLabel:u,xFormat:d,yFormat:h,enableHover:C,showGrid:M,...ie&&{legend:ie,legendPosition:ae},...s&&{title:s},...a&&{description:a},...l&&{summary:l},tooltipContent:!1===_?()=>null:Bs(_)||de,...Y&&{xExtent:Y},...$&&{yExtent:$},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...N},ge={chartType:pe,data:Z,xAccessor:p,yAccessor:f,groupAccessor:g||void 0,curve:v,lineStyle:re,size:[o,le+ce.top+ce.bottom],margin:ce,showAxes:L.showAxes??!1,background:L.background,enableHover:!1,...$&&{yExtent:$}},me=(0,Hf.jsxs)("div",{style:{position:"relative",width:o,overflow:"hidden"},children:[(0,Hf.jsx)(Ka,{ref:V,...ge}),(0,Hf.jsx)(Of,{width:o-ce.left-ce.right,height:le,margin:ce,scales:X,brushDirection:ue,extent:Y,onBrush:G})]},"minimap"),ye=(0,Hf.jsx)("div",{style:{overflow:"hidden"},children:(0,Hf.jsx)(Ka,{...fe})},"main");return E||H||(0,Hf.jsx)(sd,{componentName:"MinimapChart",width:o,height:r,children:(0,Hf.jsxs)("div",{className:"minimap-chart"+(i?" "+i:""),children:[R?me:ye,R?ye:me]})})}Wf.displayName="MinimapChart";var qf=require("react"),Yf={topLeft:{label:"Low / High",color:"#E9C46A",opacity:.08},topRight:{label:"High / High",color:"#2A9D8F",opacity:.08},bottomLeft:{label:"Low / Low",color:"#E76F51",opacity:.08},bottomRight:{label:"High / Low",color:"#86BBD8",opacity:.08}};h();var Gf=require("react/jsx-runtime");function Vf(e,t){return{label:t?.label??e.label,color:t?.color??e.color,opacity:t?.opacity??e.opacity}}var Xf=(0,qf.forwardRef)(function(e,t){const o=(0,qf.useRef)(null);Rp(t,{variant:"xy",frameRef:o});const r=bp(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:n,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:d="y",xCenter:h,yCenter:p,quadrants:f,centerlineStyle:g={},showQuadrantLabels:m=!0,quadrantLabelSize:y=12,colorBy:b,colorScheme:v,sizeBy:x,sizeRange:k=[3,15],pointRadius:w=5,pointOpacity:S=.8,tooltip:A,pointIdAccessor:C,annotations:M,frameProps:j={},selection:P,linkedHover:_,onObservation:L,onClick:R,hoverHighlight:T,chartId:I,loading:$,loadingContent:N,emptyContent:F,legendInteraction:B,legendPosition:D,color:E,stroke:H,strokeWidth:O,opacity:W}=e,{width:q,height:Y,enableHover:G,showGrid:V,showLegend:X,title:U,description:K,summary:Q,accessibleTable:Z,xLabel:J,yLabel:ee}=r,te=(0,qf.useMemo)(()=>({topLeft:Vf(Yf.topLeft,f?.topLeft),topRight:Vf(Yf.topRight,f?.topRight),bottomLeft:Vf(Yf.bottomLeft,f?.bottomLeft),bottomRight:Vf(Yf.bottomRight,f?.bottomRight)}),[f]),oe=(0,qf.useMemo)(()=>z(n),[n]),re=_p({data:oe,rawData:n,colorBy:b,colorScheme:v,legendInteraction:B,legendPosition:D,selection:P,linkedHover:_,fallbackFields:"string"==typeof b?[b]:[],unwrapData:!1,onObservation:L,onClick:R,hoverHighlight:T,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"QuadrantChart",chartId:I,showLegend:X,userMargin:i,marginDefaults:r.marginDefaults,loading:$,loadingContent:N,emptyContent:F,width:q,height:Y});dd("QuadrantChart",oe,"xAccessor",c),dd("QuadrantChart",oe,"yAccessor",d);const ne=(0,qf.useMemo)(()=>{if(!oe.length)return;const e="function"==typeof c?c:e=>+e[c],t="function"==typeof d?d:e=>+e[d];let o=1/0,r=-1/0,n=1/0,i=-1/0;for(const s of oe){const a=e(s),l=t(s);isFinite(a)&&(o>a&&(o=a),a>r&&(r=a)),isFinite(l)&&(n>l&&(n=l),l>i&&(i=l))}if(null!=h&&isFinite(h)&&(o>h&&(o=h),h>r&&(r=h)),null!=p&&isFinite(p)&&(n>p&&(n=p),p>i&&(i=p)),o===1/0)return;const s=.1*(r-o)||1,a=.1*(i-n)||1;return{xExtent:[o-s,r+s],yExtent:[n-a,i+a]}},[oe,c,d,h,p]),ie=(0,qf.useMemo)(()=>{if(!x||0===oe.length)return;const e=oe.map(e=>"function"==typeof x?x(e):e[x]).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0!==e.length?u(e):void 0},[oe,x]),se=(0,qf.useMemo)(()=>"function"==typeof c?c:e=>+e[c],[c]),ae=(0,qf.useMemo)(()=>"function"==typeof d?d:e=>+e[d],[d]),le=(0,qf.useMemo)(()=>e=>{const t=se(e),o=ae(e),r=null!=h?t>=h:void 0,n=null!=p?o>=p:void 0;return void 0===n||void 0===r?E||op:n&&r?te.topRight.color:n&&!r?te.topLeft.color:!n&&r?te.bottomRight.color:te.bottomLeft.color},[se,ae,h,p,te,E]),ce=(0,qf.useMemo)(()=>x?e=>Ye(e,x,k,ie):void 0,[x,k,ie]),ue=$p({colorBy:b,colorScale:re.colorScale,color:E,pointRadius:w,fillOpacity:S,radiusFn:ce,fallbackFill:le,stroke:H,strokeWidth:O,opacity:W,effectiveSelectionHook:re.effectiveSelectionHook,resolvedSelection:re.resolvedSelection}),de=(0,qf.useMemo)(()=>{if(!oe.length)return;const e=new Set;"string"==typeof c&&e.add(c),"string"==typeof d&&e.add(d),"string"==typeof b&&e.add(b),"string"==typeof x&&e.add(x);const t=oe[0];for(const o of Object.keys(t))if(!o.startsWith("_")&&!e.has(o)&&"string"==typeof t[o])return o},[oe,c,d,b,x]),he=(0,qf.useMemo)(()=>za([...de?[{label:de,accessor:de,role:"title"}]:[],{label:J||Na(c),accessor:c,role:"x",format:a},{label:ee||Na(d),accessor:d,role:"y",format:l},...b?[{label:Na(b),accessor:b,role:"color"}]:[],...x?[{label:Na(x),accessor:x,role:"size"}]:[]]),[de,c,d,J,ee,b,x,a,l]),pe=Sp({componentName:"QuadrantChart",data:n,accessors:{xAccessor:c,yAccessor:d}}),fe=(0,qf.useMemo)(()=>{const e={stroke:g.stroke||"#999",strokeWidth:g.strokeWidth??1,dashArray:g.strokeDasharray||[]};return[(t,o,r,n)=>{if(!r?.x||!r?.y)return;const i=n.width,s=n.height,a=null!=h?r.x(h):i/2,l=null!=p?r.y(p):s/2;if(null!=h&&!isFinite(a))return;if(null!=p&&!isFinite(l))return;const c=Math.max(0,Math.min(i,a)),u=Math.max(0,Math.min(s,l)),d=[{config:te.topLeft,x:0,y:0,w:c,h:u},{config:te.topRight,x:c,y:0,w:i-c,h:u},{config:te.bottomLeft,x:0,y:u,w:c,h:s-u},{config:te.bottomRight,x:c,y:u,w:i-c,h:s-u}];for(const e of d)e.w>0&&e.h>0&&(t.fillStyle=e.config.color,t.globalAlpha=e.config.opacity??.08,t.fillRect(e.x,e.y,e.w,e.h));t.globalAlpha=1,t.strokeStyle=e.stroke,t.lineWidth=e.strokeWidth,e.dashArray.length>0&&t.setLineDash(e.dashArray),t.beginPath(),t.moveTo(c,0),t.lineTo(c,s),t.stroke(),t.beginPath(),t.moveTo(0,u),t.lineTo(i,u),t.stroke(),t.setLineDash([])}]},[h,p,te,g]),ge=(0,qf.useMemo)(()=>m?[...fe,(e,t,o,r)=>{if(!o?.x||!o?.y)return;const n=r.width,i=r.height,s=null!=h?o.x(h):n/2,a=null!=p?o.y(p):i/2;(null==h||isFinite(s))&&(null==p||isFinite(a))&&(e.font=`600 ${y}px sans-serif`,e.globalAlpha=.5,e.fillStyle=te.topLeft.color,e.textAlign="left",e.textBaseline="top",e.fillText(te.topLeft.label,8,8),e.fillStyle=te.topRight.color,e.textAlign="right",e.textBaseline="top",e.fillText(te.topRight.label,n-8,8),e.fillStyle=te.bottomLeft.color,e.textAlign="left",e.textBaseline="bottom",e.fillText(te.bottomLeft.label,8,i-8),e.fillStyle=te.bottomRight.color,e.textAlign="right",e.textBaseline="bottom",e.fillText(te.bottomRight.label,n-8,i-8),e.globalAlpha=1)}]:fe,[fe,m,y,te,h,p]),me=(0,qf.useMemo)(()=>{const e=j.canvasPreRenderers||[];return[...ge,...e]},[ge,j.canvasPreRenderers]),ye=(0,qf.useMemo)(()=>{const e={stroke:g.stroke||"#999",strokeWidth:g.strokeWidth??1,dashArray:g.strokeDasharray?Array.isArray(g.strokeDasharray)?g.strokeDasharray.join(","):g.strokeDasharray:void 0};return[(t,o,r)=>{if(!o?.x||!o?.y)return null;const n=r.width,i=r.height,s=null!=h?o.x(h):n/2,a=null!=p?o.y(p):i/2;if(null!=h&&!isFinite(s))return null;if(null!=p&&!isFinite(a))return null;const l=Math.max(0,Math.min(n,s)),c=Math.max(0,Math.min(i,a));return(0,Gf.jsxs)(Gf.Fragment,{children:[[{config:te.topLeft,x:0,y:0,w:l,h:c},{config:te.topRight,x:l,y:0,w:n-l,h:c},{config:te.bottomLeft,x:0,y:c,w:l,h:i-c},{config:te.bottomRight,x:l,y:c,w:n-l,h:i-c}].map((e,t)=>e.w>0&&e.h>0?(0,Gf.jsx)("rect",{x:e.x,y:e.y,width:e.w,height:e.h,fill:e.config.color,opacity:e.config.opacity??.08},"qf-"+t):null),(0,Gf.jsx)("line",{x1:l,y1:0,x2:l,y2:i,stroke:e.stroke,strokeWidth:e.strokeWidth,strokeDasharray:e.dashArray}),(0,Gf.jsx)("line",{x1:0,y1:c,x2:n,y2:c,stroke:e.stroke,strokeWidth:e.strokeWidth,strokeDasharray:e.dashArray}),m&&(0,Gf.jsxs)(Gf.Fragment,{children:[(0,Gf.jsx)("text",{x:8,y:8+y,fill:te.topLeft.color,fontWeight:600,fontSize:y,opacity:.5,children:te.topLeft.label}),(0,Gf.jsx)("text",{x:n-8,y:8+y,fill:te.topRight.color,fontWeight:600,fontSize:y,opacity:.5,textAnchor:"end",children:te.topRight.label}),(0,Gf.jsx)("text",{x:8,y:i-8,fill:te.bottomLeft.color,fontWeight:600,fontSize:y,opacity:.5,children:te.bottomLeft.label}),(0,Gf.jsx)("text",{x:n-8,y:i-8,fill:te.bottomRight.color,fontWeight:600,fontSize:y,opacity:.5,textAnchor:"end",children:te.bottomRight.label})]})]})}]},[h,p,te,g,m,y]);if(re.earlyReturn)return re.earlyReturn;const be={chartType:"scatter",...null!=n&&{data:oe},xAccessor:c,yAccessor:d,colorAccessor:b||void 0,sizeAccessor:x||void 0,sizeRange:k,pointStyle:ue,colorScheme:v,size:[q,Y],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:re.margin,showAxes:r.showAxes,xLabel:J,yLabel:ee,xFormat:a,yFormat:l,enableHover:G,showGrid:V,...ne&&{xExtent:ne.xExtent,yExtent:ne.yExtent},...re.legendBehaviorProps,...U&&{title:U},...K&&{description:K},...Q&&{summary:Q},...void 0!==Z&&{accessibleTable:Z},...s&&{className:s},...null!=e.animate&&{animate:e.animate},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},tooltipContent:!1===A?()=>null:!0===A||void 0===A?he:Bs(A)||he,...Gd({linkedHover:_,selection:P,onObservation:L,onClick:R,hoverHighlight:T,mobileInteraction:re.mobileInteraction,customHoverBehavior:re.customHoverBehavior,customClickBehavior:re.customClickBehavior}),...C&&{pointIdAccessor:C},...M&&M.length>0&&{annotations:M},canvasPreRenderers:me,...re.crosshairProps,...j,...me.length>0&&{canvasPreRenderers:me},svgPreRenderers:ye};return pe?(0,Gf.jsx)(td,{componentName:"QuadrantChart",message:pe,width:q,height:Y}):(0,Gf.jsx)(sd,{componentName:"QuadrantChart",width:q,height:Y,children:(0,Gf.jsx)(Ka,{ref:o,...be})})});Xf.displayName="QuadrantChart";var Uf=c(require("react")),Kf=require("react"),Qf=require("react/jsx-runtime"),Zf="__ma_unitized",Jf="__ma_series";function eg(e,t){const o=t[1]-t[0];return 0===o?.5:(e-t[0])/o}function tg(e,t){return t[0]+e*(t[1]-t[0])}var og=(0,Kf.forwardRef)(function(e,t){const o=(0,Kf.useRef)(null),r=(0,Kf.useRef)([]),n=(0,Kf.useRef)(e.series);n.current=e.series,(0,Kf.useImperativeHandle)(t,()=>{const e=()=>(n.current??[]).filter(e=>null!=e&&"object"==typeof e);return{push:t=>{if(!o.current)return;const n=e(),i=t;for(let e=0;n.length>e&&2>e;e++){const t=n[e],s=t.extent||r.current[e];if(!s)continue;const a=("function"==typeof t.yAccessor?t.yAccessor:e=>e[t.yAccessor])(i);null!=a&&isFinite(a)&&o.current.push({...i,[Zf]:eg(a,s),[Jf]:t.label||"Series "+(e+1)})}},pushMany:t=>{if(!o.current)return;const n=e(),i=[];for(const e of t)for(let t=0;n.length>t&&2>t;t++){const o=n[t],s=o.extent||r.current[t];if(!s)continue;const a=("function"==typeof o.yAccessor?o.yAccessor:e=>e[o.yAccessor])(e);null!=a&&isFinite(a)&&i.push({...e,[Zf]:eg(a,s),[Jf]:o.label||"Series "+(t+1)})}o.current.pushMany(i)},remove:e=>o.current?.remove(e)??[],update:(e,t)=>o.current?.update(e,t)??[],clear:()=>o.current?.clear(),getData:()=>o.current?.getData()??[],getScales:()=>o.current?.getScales()??null}},[]);const i=bp(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,accessibleTable:e.accessibleTable,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:800,height:400}),{data:s,margin:a,className:l,xFormat:c,xAccessor:u="x",series:d,colorScheme:h,curve:p="monotoneX",lineWidth:f=2,tooltip:g,annotations:m,frameProps:y={},selection:b,linkedHover:v,onObservation:x,onClick:k,hoverHighlight:w,chartId:S,loading:A,loadingContent:C,emptyContent:M,legendInteraction:j,legendPosition:P,stroke:_,strokeWidth:L,opacity:R}=e,{width:T,height:I,enableHover:$,showGrid:N,showLegend:F=!0,title:B,description:D,summary:E,accessibleTable:H,xLabel:O}=i,W=(0,Kf.useMemo)(()=>z(s),[s]),q=(0,Kf.useMemo)(()=>z(d),[d]),Y=q,G=2===q.length;"undefined"==typeof process||"production"===process.env?.NODE_ENV||G||console.warn(`[MultiAxisLineChart] Expected exactly 2 series for dual-axis mode, got ${q.length}. Rendering as a standard multi-line chart.`);const V=ud(A,T,I,C),X=V?null:cd(s,T,I,M),U=cp(),K=(0,Kf.useMemo)(()=>{let e;if(Array.isArray(h))e=h;else if(U&&U.length>0)e=U;else{const t=Be[h];e=Array.isArray(t)?t:De}return Y.map((t,o)=>t.color||e[o%e.length])},[Y,h,U]),Q=(0,Kf.useMemo)(()=>q.map((e,t)=>e.label||"Series "+(t+1)),[q]),{unitizedData:Z,extents:J}=(0,Kf.useMemo)(()=>{if(0===W.length){const e=q.map(e=>e.extent||null).filter(Boolean);return e.length===q.length&&(r.current=e),{unitizedData:[],extents:e.length===q.length?e:[]}}const e=q.map(e=>e.extent||function(e,t){let o=1/0,r=-1/0;const n="function"==typeof t?t:e=>e[t];for(const t of e){const e=n(t);null!=e&&isFinite(e)&&(o>e&&(o=e),e>r&&(r=e))}if(!isFinite(o)||!isFinite(r))return[0,1];if(o===r){const e=0===o?1:.1*Math.abs(o);return[o-e,r+e]}return[o,r]}(W,e.yAccessor));if(r.current=e,!G){const t=[];for(const e of W)for(let o=0;q.length>o;o++){const r=q[o],n=("function"==typeof r.yAccessor?r.yAccessor:e=>e[r.yAccessor])(e);null!=n&&t.push({...e,[Zf]:n,[Jf]:Q[o]})}return{unitizedData:t,extents:e}}const t=[];for(const o of W)for(let r=0;2>r;r++){const n=q[r],i=("function"==typeof n.yAccessor?n.yAccessor:e=>e[n.yAccessor])(o);null!=i&&t.push({...o,[Zf]:eg(i,e[r]),[Jf]:Q[r]})}return{unitizedData:t,extents:e}},[W,q,G,Q]),ee=(0,Kf.useMemo)(()=>{if(G&&J.length>=2)return[{orient:"left",label:Q[0],tickFormat:q[0].format||(e=>{const t=tg(e,J[0]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"right",label:Q[1],tickFormat:q[1].format||(e=>{const t=tg(e,J[1]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"bottom"}]},[G,J,q,Q]),te=_p({data:(0,Kf.useMemo)(()=>Z.length>0?Z:Q.map(e=>({[Jf]:e})),[Z,Q]),rawData:s,colorBy:Jf,colorScheme:K,legendInteraction:j,legendPosition:P,selection:b,linkedHover:v,fallbackFields:[Jf],unwrapData:!1,onObservation:x,onClick:k,hoverHighlight:w,mobileInteraction:i.mobileInteraction,mobileSemantics:i.mobileSemantics,chartType:"MultiAxisLineChart",chartId:S,showLegend:F,userMargin:a,marginDefaults:G?{...i.marginDefaults,left:70,right:70}:i.marginDefaults,loading:A,loadingContent:C,emptyContent:M,width:T,height:I}),oe=(0,Kf.useMemo)(()=>{const e=new Map;return Q.forEach((t,o)=>e.set(t,K[o])),e},[Q,K]),re=Jp({lineWidth:f,resolveStroke:(0,Kf.useCallback)(e=>oe.get(e[Jf])||K[0],[oe,K]),stroke:_,strokeWidth:L,opacity:R,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection}),ne=(0,Kf.useMemo)(()=>{if(!1===g)return()=>null;return Bs(g)||(e=>{const t=e.data||e,o=t[Jf],r=Q.indexOf(o),n=t[Zf],i=G&&r>=0&&J[r]?tg(n,J[r]):n,s=r>=0&&q[r]?.format?q[r].format:e=>Number.isInteger(e)?e+"":e.toFixed(2),a="function"==typeof u?u(t):t[u];return Uf.createElement("div",{style:{padding:"6px 10px",fontFamily:"var(--semiotic-font-family, sans-serif)",fontSize:"var(--semiotic-tooltip-font-size, 13px)"}},Uf.createElement("div",{style:{fontWeight:600,marginBottom:4,color:K[r]||"inherit"}},o),Uf.createElement("div",null,`${"string"==typeof u?u:"x"}: ${a}`),Uf.createElement("div",null,`${o}: ${s(i)}`))})},[g,Q,K,J,G,q,u]);if(te.earlyReturn)return te.earlyReturn;const ie=Sp({componentName:"MultiAxisLineChart",data:s,accessors:{xAccessor:u}}),se=G?[0,1]:void 0,ae={chartType:"line",...null!=s&&{data:Z},xAccessor:u,yAccessor:Zf,groupAccessor:Jf,lineStyle:re,colorScheme:K,size:[T,I],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:te.margin,showAxes:i.showAxes,...ee&&{axes:ee},xLabel:O,...G?{}:{yLabel:Q[0]},xFormat:c,...G&&se&&{yExtent:se},enableHover:$,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:N,curve:p,...te.legendBehaviorProps,...B&&{title:B},...D&&{description:D},...E&&{summary:E},...void 0!==H&&{accessibleTable:H},...l&&{className:l},...null!=e.animate&&{animate:e.animate},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},tooltipContent:ne,...m&&{annotations:m},...Gd({linkedHover:v,selection:b,onObservation:x,onClick:k,hoverHighlight:w,mobileInteraction:te.mobileInteraction,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior}),...te.crosshairProps,...y};return V||X||(ie?(0,Qf.jsx)(td,{componentName:"MultiAxisLineChart",message:ie,width:T,height:I}):(0,Qf.jsx)(sd,{componentName:"MultiAxisLineChart",width:T,height:I,children:(0,Qf.jsx)(Ka,{ref:o,...ae})}))});og.displayName="MultiAxisLineChart";var rg=require("react");function ng(e){if(null==e)return;if("number"==typeof e)return{top:e,right:e,bottom:e,left:e};const t={};return"number"==typeof e.top&&(t.top=e.top),"number"==typeof e.right&&(t.right=e.right),"number"==typeof e.bottom&&(t.bottom=e.bottom),"number"==typeof e.left&&(t.left=e.left),t}var ig=require("react/jsx-runtime"),sg=(0,rg.forwardRef)(function(e,t){const o=(0,rg.useRef)(null);Rp(t,{variant:"xy",frameRef:o});const r=bp(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:n,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",highAccessor:u="high",lowAccessor:d="low",openAccessor:h,closeAccessor:p,candlestickStyle:f,tooltip:g,annotations:m,xExtent:y,yExtent:b,frameProps:v={},selection:x,linkedHover:k,onObservation:w,onClick:S,chartId:A,loading:C,loadingContent:M,emptyContent:j}=e,{width:P,height:_,enableHover:L,showGrid:R,title:T,description:I,summary:$,accessibleTable:N,xLabel:F,yLabel:B}=r,D=ud(C,P,_,M),E=D?null:cd(n,P,_,j),H=(0,rg.useMemo)(()=>z(n),[n]),O=null==h||null==p;dd("CandlestickChart",H,"xAccessor",c),dd("CandlestickChart",H,"highAccessor",u),dd("CandlestickChart",H,"lowAccessor",d),O||(dd("CandlestickChart",H,"openAccessor",h),dd("CandlestickChart",H,"closeAccessor",p));const{customHoverBehavior:W,customClickBehavior:q,crosshairSourceId:Y}=pp({selection:x,linkedHover:k,onObservation:w,onClick:S,chartType:"CandlestickChart",chartId:A,mobileInteraction:r.mobileInteraction}),G=fp(k,Y),V=(0,rg.useMemo)(()=>{const t=r.marginDefaults,o="sparkline"===e.mode?{...t,top:0,bottom:0}:t;return null==i?o:{...o,...ng(i)}},[i,r.marginDefaults,e.mode]),X=(0,rg.useMemo)(()=>{const e=[{label:F||Na(c),accessor:c,role:"x",format:a}];return O?(e.push({label:"High",accessor:u,role:"y",format:l}),e.push({label:"Low",accessor:d,format:l})):(e.push({label:"Open",accessor:h,format:l}),e.push({label:"High",accessor:u,format:l}),e.push({label:"Low",accessor:d,format:l}),e.push({label:"Close",accessor:p,format:l})),za(e)},[c,F,a,l,u,d,h,p,O]),U=Sp({componentName:"CandlestickChart",data:n,accessors:{xAccessor:c,highAccessor:u,lowAccessor:d,...!O&&{openAccessor:h,closeAccessor:p}}}),K={chartType:"candlestick",...null!=n&&{data:H},xAccessor:c,yAccessor:u,highAccessor:u,lowAccessor:d,...!O&&{openAccessor:h,closeAccessor:p},...f&&{candlestickStyle:f},scalePadding:Math.max(2,Math.min(12,Math.round(P/40))),extentPadding:P>200?.1:.02,size:[P,_],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:V,showAxes:r.showAxes,xLabel:F,yLabel:B,xFormat:a,yFormat:l,enableHover:L,showGrid:R,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...Yd({title:T,description:I,summary:$,accessibleTable:N,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Vd({tooltip:g,defaultTooltipContent:X}),...Gd({linkedHover:k,selection:x,onObservation:w,onClick:S,mobileInteraction:r.mobileInteraction,customHoverBehavior:W,customClickBehavior:q}),...m&&m.length>0&&{annotations:m},...y&&{xExtent:y},...b&&{yExtent:b},...G,...v};return D||E||(U?(0,ig.jsx)(td,{componentName:"CandlestickChart",message:U,width:P,height:_}):(0,ig.jsx)(sd,{componentName:"CandlestickChart",width:P,height:_,children:(0,ig.jsx)(Ka,{ref:o,...K})}))});sg.displayName="CandlestickChart";var ag=require("react"),lg=require("react");function cg(e){const t=(0,lg.useRef)(null);return Rp(e.imperativeRef,{variant:e.imperativeVariant,frameRef:t}),{frameRef:t,resolved:bp(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),normalizedMargin:(0,lg.useMemo)(()=>ng(e.margin),[e.margin])}}function ug(e){const t=cg(e),{resolved:o,normalizedMargin:r}=t,n=_p({data:e.data??[],rawData:e.data,colorBy:e.colorBy,colorScheme:e.colorScheme,legendInteraction:void 0,selection:e.selection,linkedHover:e.linkedHover,fallbackFields:"string"==typeof e.colorBy?[e.colorBy]:[],unwrapData:e.unwrapData,onObservation:e.onObservation,onClick:e.onClick,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,chartType:e.chartTypeLabel,chartId:e.chartId,showLegend:o.showLegend,userMargin:r,marginDefaults:o.marginDefaults,loading:e.loading,loadingContent:e.loadingContent,emptyContent:e.emptyContent,width:o.width,height:o.height});return{...t,safeData:n.data,setup:n,earlyReturn:n.earlyReturn}}var dg=require("react/jsx-runtime"),hg=(0,ag.forwardRef)(function(e,t){const{data:o,layout:r,layoutConfig:n,onLayoutError:i,xExtent:s,yExtent:a,showAxes:l=!1,margin:c,className:u,annotations:d,onObservation:h,onClick:p,selection:f,linkedHover:g,chartId:m,loading:y,loadingContent:b,emptyContent:v,colorBy:x,colorScheme:k,frameProps:w={}}=e,{frameRef:S,resolved:A,safeData:C,setup:M,earlyReturn:j}=ug({imperativeRef:t,imperativeVariant:"xy",chartTypeLabel:"XYCustomChart",unwrapData:!1,data:o,colorBy:x,colorScheme:k,selection:f,linkedHover:g,onObservation:h,onClick:p,chartId:m,loading:y,loadingContent:b,emptyContent:v,margin:c,width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,mode:e.mode,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules,xLabel:e.xLabel,yLabel:e.yLabel}),P=M.effectiveSelectionHook,_=(0,ag.useMemo)(()=>P?.isActive?{isActive:!0,predicate:P.predicate}:null,[P?.isActive,P?.predicate]);if(j)return j;const{width:L,height:R,enableHover:T,showGrid:I,title:$,description:N,summary:F,accessibleTable:B,xLabel:D,yLabel:E}=A,z={chartType:"custom",...null!=o&&{data:C},customLayout:r,layoutConfig:n,onLayoutError:i,..._&&{layoutSelection:_},xExtent:s,yExtent:a,colorAccessor:x,colorScheme:k,size:[L,R],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:M.margin,showAxes:l,xLabel:D,yLabel:E,enableHover:T,showGrid:I,...M.legendBehaviorProps,...Yd({title:$,description:N,summary:F,accessibleTable:B,className:u,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...null!=e.tooltip&&{tooltipContent:e.tooltip},...Gd({linkedHover:g,selection:f,onObservation:h,onClick:p,hoverHighlight:!1,mobileInteraction:M.mobileInteraction,customHoverBehavior:M.customHoverBehavior,customClickBehavior:M.customClickBehavior}),...d&&d.length>0&&{annotations:d},...M.crosshairProps,...w};return(0,dg.jsx)(sd,{componentName:"XYCustomChart",width:L,height:R,children:(0,dg.jsx)(Ka,{ref:S,...z})})});hg.displayName="XYCustomChart";var pg=require("react"),fg=require("react/jsx-runtime"),gg=(0,pg.forwardRef)(function(e,t){const{nodes:o,edges:r,layout:n,layoutConfig:i,onLayoutError:s,nodeIDAccessor:a="id",sourceAccessor:l="source",targetAccessor:c="target",margin:u,className:d,colorBy:h,colorScheme:p,selection:f,linkedHover:g,onObservation:m,onClick:y,chartId:b,annotations:v,autoPlaceAnnotations:x,frameProps:k={}}=e,{frameRef:w,resolved:S,normalizedMargin:A}=cg({imperativeRef:t,imperativeVariant:"network",margin:u,width:e.width,height:e.height,enableHover:e.enableHover,title:e.title,mode:e.mode,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),C=(0,pg.useMemo)(()=>z(o??[]),[o]),M=(0,pg.useMemo)(()=>z(r??[]),[r]),j=lp(e.mobileInteraction,{mode:e.mode,width:S.width,mobileSemantics:e.mobileSemantics}),{customHoverBehavior:P,customClickBehavior:_,activeSelectionHook:L}=pp({selection:f,linkedHover:g,fallbackFields:"string"==typeof h?[h]:[],onObservation:m,onClick:y,chartType:"NetworkCustomChart",chartId:b,colorByField:"string"==typeof h?h:void 0,mobileInteraction:j}),R=(0,pg.useMemo)(()=>L?.isActive?{isActive:!0,predicate:L.predicate}:null,[L?.isActive,L?.predicate]),{width:T,height:I,enableHover:$,title:N,description:F,summary:B,accessibleTable:D}=S,E={chartType:"force",...null!=o&&{nodes:C},...null!=r&&{edges:M},customNetworkLayout:n,layoutConfig:i,onLayoutError:s,nodeIDAccessor:a,sourceAccessor:l,targetAccessor:c,colorBy:h,colorScheme:p,size:[T,I],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:A,className:d,title:N,description:F,summary:B,accessibleTable:D,enableHover:$,...Gd({linkedHover:g,selection:f,onObservation:m,onClick:y,mobileInteraction:j,customHoverBehavior:P,customClickBehavior:_,linkedHoverInClickPredicate:!1}),layoutSelection:R,...null!=v&&{annotations:v},...null!=x&&{autoPlaceAnnotations:x},...k};return(0,fg.jsx)(sd,{componentName:"NetworkCustomChart",width:T,height:I,children:(0,fg.jsx)(qd,{ref:w,...E})})});gg.displayName="NetworkCustomChart";var mg=require("react"),yg=require("react/jsx-runtime"),bg=(0,mg.forwardRef)(function(e,t){const{data:o,layout:r,layoutConfig:n,onLayoutError:i,categoryAccessor:s="category",valueAccessor:a="value",oExtent:l,rExtent:c,projection:u="vertical",margin:d,className:h,colorBy:p,colorScheme:f,showAxes:g=!1,annotations:m,onObservation:y,onClick:b,selection:v,linkedHover:x,chartId:k,loading:w,loadingContent:S,emptyContent:A,frameProps:C={}}=e,{frameRef:M,resolved:j,safeData:P,setup:_,earlyReturn:L}=ug({imperativeRef:t,imperativeVariant:"xy",chartTypeLabel:"OrdinalCustomChart",unwrapData:!0,data:o,colorBy:p,colorScheme:f,selection:v,linkedHover:x,onObservation:y,onClick:b,chartId:k,loading:w,loadingContent:S,emptyContent:A,margin:d,width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,title:e.title,mode:e.mode,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),R=_.effectiveSelectionHook,T=(0,mg.useMemo)(()=>R?.isActive?{isActive:!0,predicate:R.predicate}:null,[R?.isActive,R?.predicate]);if(L)return L;const{width:I,height:$,enableHover:N,showGrid:F,title:B,description:D,summary:E,accessibleTable:z}=j,H={chartType:"custom",...null!=o&&{data:P},customLayout:r,layoutConfig:n,onLayoutError:i,...T&&{layoutSelection:T},oAccessor:s,rAccessor:a,oExtent:l,rExtent:c,projection:u,colorAccessor:p,colorScheme:f,size:[I,$],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:_.margin,enableHover:N,showAxes:g,showGrid:F,annotations:m,...Yd({title:B,description:D,summary:E,accessibleTable:z,className:h,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Gd({linkedHover:x,selection:v,onObservation:y,onClick:b,hoverHighlight:!1,mobileInteraction:_.mobileInteraction,customHoverBehavior:_.customHoverBehavior,customClickBehavior:_.customClickBehavior}),...C};return(0,yg.jsx)(sd,{componentName:"OrdinalCustomChart",width:I,height:$,children:(0,yg.jsx)(sc,{ref:M,...H})})});bg.displayName="OrdinalCustomChart";var vg=require("react"),xg=require("react");function kg({ref:e,frameRef:t,setup:o}){return(0,xg.useImperativeHandle)(e,()=>({push:e=>t.current?.push(e),pushMany:e=>t.current?.pushMany(e),remove:e=>t.current?.remove(e)??[],update:(e,o)=>t.current?.update(e,o)??[],clear:()=>t.current?.clear(),getData:()=>t.current?.getData()??[],getScales:()=>t.current?.getScales()??null}),[t]),{effectiveLegendProps:o.legendBehaviorProps,effectiveMargin:o.margin}}var wg=require("react");function Sg(e){const{colorBy:t,colorScale:o,color:r,themeCategorical:n,colorScheme:i,categoryIndexMap:s,userPieceStyle:a,stroke:l,strokeWidth:c,opacity:u,effectiveSelectionHook:d,resolvedSelection:h,cycleByCategory:p=!1,baseStyleExtras:f,linkStrokeToFill:g=!1}=e,m=(0,wg.useMemo)(()=>(e,a)=>{const l="function"==typeof f?f(e,a):f,c=l?{...l}:{};if(void 0===c.fill)if(t){if(!o)return c;c.fill=Oe(e,t,o)}else c.fill=up(r,n,i,p?a:void 0,s);return g&&void 0===c.stroke&&void 0!==c.fill&&(c.stroke=c.fill),c},[t,o,r,n,i,s,p,f,g]),y=(0,wg.useMemo)(()=>Ip(a?"function"==typeof a?(e,t)=>({...m(e,t),...a(e,t)||{}}):(e,t)=>({...m(e,t),...a}):m,{stroke:l,strokeWidth:c,opacity:u}),[m,a,l,c,u]);return(0,wg.useMemo)(()=>Bh(y,d??null,h),[y,d,h])}var Ag=require("react/jsx-runtime"),Cg=(0,vg.forwardRef)(function(e,t){const o=bp(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),r=(0,vg.useRef)(null),{data:n,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="vertical",valueFormat:u,colorBy:d,colorScheme:h,sort:p=!1,barPadding:f=40,roundedTop:g,gradientFill:m=!1,baselinePadding:y=!1,tooltip:b,annotations:v,regression:x,valueExtent:k,frameProps:w={},selection:S,linkedHover:A,onObservation:C,onClick:M,hoverHighlight:j,chartId:P,loading:_,loadingContent:L,emptyContent:R,legendInteraction:T,legendPosition:I,color:$,stroke:N,strokeWidth:F,opacity:B,showCategoryTicks:D,categoryFormat:E,dataIdAccessor:H}=e,{width:O,height:W,enableHover:q,showGrid:Y,showLegend:G,title:V,description:X,summary:U,accessibleTable:K,categoryLabel:Q,valueLabel:Z}=o,J=(0,vg.useMemo)(()=>z(n),[n]),ee=_p({data:J,rawData:n,colorBy:d,colorScheme:h,legendInteraction:T,legendPosition:I,selection:S,linkedHover:A,fallbackFields:d?["string"==typeof d?d:""]:[],unwrapData:!0,onObservation:C,onClick:M,hoverHighlight:j,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"BarChart",chartId:P,showLegend:G,userMargin:i,marginDefaults:o.marginDefaults,loading:_,loadingContent:L,emptyContent:R,width:O,height:W}),{effectiveLegendProps:te,effectiveMargin:oe}=kg({ref:t,frameRef:r,setup:ee});dd("BarChart",J,"categoryAccessor",a),dd("BarChart",J,"valueAccessor",l);const re=hp(J,p,l),ne=cp(),ie=(0,vg.useMemo)(()=>new Map,[J]),se=Sg({colorBy:d,colorScale:ee.colorScale,color:$,themeCategorical:ne,colorScheme:h,categoryIndexMap:ie,userPieceStyle:w?.pieceStyle,stroke:N,strokeWidth:F,opacity:B,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection}),ae=(0,vg.useMemo)(()=>Ha({categoryAccessor:a,valueAccessor:l,groupAccessor:d&&d!==a?d:void 0,groupLabel:"string"==typeof d?d:"group",valueFormat:u}),[a,l,d,u]);if(ee.earlyReturn)return ee.earlyReturn;const le=Sp({componentName:"BarChart",data:n,accessors:{categoryAccessor:a,valueAccessor:l}});if(le)return(0,Ag.jsx)(td,{componentName:"BarChart",message:le,width:O,height:W});const ce=Bp(x),ue=ce?[ce,...v||[]]:v,de={chartType:"bar",...null!=n&&{data:re},oAccessor:a,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",pieceStyle:se,size:[O,W],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:oe,barPadding:f,...null!=g&&{roundedTop:g},...m&&{gradientFill:!0===m?{topOpacity:.8,bottomOpacity:.05}:m},...H&&{dataIdAccessor:H},baselinePadding:y,enableHover:q,showAxes:o.showAxes,oLabel:Q,rLabel:Z,rFormat:u,...E&&{oFormat:E},showGrid:Y,showCategoryTicks:D,oSort:p,...te,...Yd({title:V,description:X,summary:U,accessibleTable:K,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Vd({tooltip:b,defaultTooltipContent:ae}),...Gd({linkedHover:A,selection:S,onObservation:C,onClick:M,hoverHighlight:j,mobileInteraction:ee.mobileInteraction,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior}),...ue&&ue.length>0&&{annotations:ue},...k&&{rExtent:k},...Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e))};return(0,Ag.jsx)(sd,{componentName:"BarChart",width:O,height:W,children:(0,Ag.jsx)(sc,{ref:r,...de})})});Cg.displayName="BarChart";var Mg=require("react"),jg=require("react/jsx-runtime"),Pg=(0,Mg.forwardRef)(function(e,t){const o=bp(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),r=(0,Mg.useRef)(null),{data:n,margin:i,className:s,categoryAccessor:a="category",stackBy:l,valueAccessor:c="value",orientation:u="vertical",valueFormat:d,colorBy:h,colorScheme:p,normalize:f=!1,sort:g=!1,barPadding:m=40,roundedTop:y,baselinePadding:b=!1,tooltip:v,annotations:x,valueExtent:k,frameProps:w={},selection:S,linkedHover:A,onObservation:C,onClick:M,hoverHighlight:j,chartId:P,loading:_,loadingContent:L,emptyContent:R,legendInteraction:T,legendPosition:I,color:$,stroke:N,strokeWidth:F,opacity:B,categoryFormat:D}=e,{width:E,height:H,enableHover:O,showGrid:W,showLegend:q,title:Y,description:G,summary:V,accessibleTable:X,categoryLabel:U,valueLabel:K}=o,Q=(0,Mg.useMemo)(()=>z(n),[n]),Z=h||l,J=_p({data:Q,rawData:n,colorBy:Z,colorScheme:p,legendInteraction:T,legendPosition:I,selection:S,linkedHover:A,fallbackFields:Z?["string"==typeof Z?Z:""]:[],unwrapData:!0,onObservation:C,onClick:M,hoverHighlight:j,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"StackedBarChart",chartId:P,showLegend:q,userMargin:i,marginDefaults:o.marginDefaults,loading:_,loadingContent:L,emptyContent:R,width:E,height:H}),ee=cp(),te=(0,Mg.useMemo)(()=>new Map,[Q]),oe=Sg({colorBy:Z,colorScale:J.colorScale,color:$,themeCategorical:ee,colorScheme:p,categoryIndexMap:te,userPieceStyle:w?.pieceStyle,stroke:N,strokeWidth:F,opacity:B,effectiveSelectionHook:J.effectiveSelectionHook,resolvedSelection:J.resolvedSelection}),re=(0,Mg.useMemo)(()=>Ha({categoryAccessor:l,valueAccessor:c,groupAccessor:a,valueFormat:d}),[l,a,c,d]),ne=Sp({componentName:"StackedBarChart",data:n,accessors:{categoryAccessor:a,valueAccessor:c},requiredProps:{stackBy:l}}),{effectiveLegendProps:ie,effectiveMargin:se}=kg({ref:t,frameRef:r,setup:J});if(J.earlyReturn)return J.earlyReturn;const ae={chartType:"bar",...null!=n&&{data:Q},oAccessor:a,rAccessor:c,stackBy:l,normalize:f,oSort:g,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:oe,size:[E,H],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:se,barPadding:m,...null!=y&&{roundedTop:y},baselinePadding:b,enableHover:O,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:U,rLabel:K,rFormat:d,...D&&{oFormat:D},showGrid:W,...ie,...Yd({title:Y,description:G,summary:V,accessibleTable:X,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Vd({tooltip:v,defaultTooltipContent:re}),...Gd({linkedHover:A,selection:S,onObservation:C,onClick:M,hoverHighlight:j,mobileInteraction:J.mobileInteraction,customHoverBehavior:J.customHoverBehavior,customClickBehavior:J.customClickBehavior}),...x&&x.length>0&&{annotations:x},...k&&{rExtent:k},...Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e))};return ne?(0,jg.jsx)(td,{componentName:"StackedBarChart",message:ne,width:E,height:H}):(0,jg.jsx)(sd,{componentName:"StackedBarChart",width:E,height:H,children:(0,jg.jsx)(sc,{ref:r,...ae})})});Pg.displayName="StackedBarChart";var _g=c(require("react")),Lg=require("react"),Rg=require("react"),Tg=require("react"),Ig={RdBu:Le,PiYG:Re,PRGn:Te,BrBG:Ie,RdYlBu:$e,RdYlGn:Ne,Spectral:Fe},$g="__likert_neutral_neg",Ng="__likert_neutral_pos";function Fg(e,t){if("function"==typeof e)return e;const o=e||t;return e=>e[o]}function Bg(e,t,o,r,n,i){const s=new Map,a=new Set(t);for(const l of e){const e=o(l);s.has(e)||s.set(e,new Map);const c=s.get(e);if(r){const e=r(l);if(null==e||!Number.isFinite(e))continue;if(!Number.isInteger(e)){"production"!==process.env.NODE_ENV&&console.warn("[LikertChart] Ignoring non-integer Likert score:",e);continue}const o=e-1;if(0>o||o>=t.length)continue;const n=t[o];c.set(n,(c.get(n)||0)+1)}else if(n&&i){const e=n(l),t=i(l);if(!a.has(e))continue;c.set(e,(c.get(e)||0)+(Number.isFinite(t)?t:0))}}const l=[];for(const[e,o]of s){let r=0;for(const e of t)r+=o.get(e)||0;if(0!==r)for(let n=0;t.length>n;n++){const i=t[n],s=o.get(i)||0;l.push({__likertCategory:e,__likertLevel:i,__likertLevelLabel:i,__likertCount:s,__likertPct:s/r*100,__likertLevelIndex:n})}}return l}function Dg(e,t){const o=t.length,r=o%2!=0,n=Math.floor(o/2),i=[];for(const t of e){const e=t.__likertLevelIndex;if(r&&e===n){const e=t.__likertPct/2;i.push({...t,__likertLevel:$g,__likertPct:-e}),i.push({...t,__likertLevel:Ng,__likertPct:e})}else i.push(n>e?{...t,__likertPct:-t.__likertPct}:t)}return i}function Eg(e,t){const o=t.length,r=o%2!=0,n=Math.floor(o/2),i=new Map;for(const t of e){const e=i.get(t.__likertCategory)||[];e.push(t),i.set(t.__likertCategory,e)}const s=[];for(const[,e]of i){const t=new Map;let i,a;for(const o of e)o.__likertLevel===$g?i=o:o.__likertLevel===Ng?a=o:t.set(o.__likertLevelIndex,o);r&&i&&s.push(i);for(let e=n-1;e>=0;e--){const o=t.get(e);o&&s.push(o)}r&&a&&s.push(a);for(let e=r?n+1:n;o>e;e++){const o=t.get(e);o&&s.push(o)}}return s}var zg=["Very Low","Low","Neutral","High","Very High"],Hg=require("react/jsx-runtime"),Og=new Map,Wg=(0,Lg.forwardRef)(function(e,t){const o=bp(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),r=(0,Lg.useRef)(null),{data:n,margin:i,className:s,categoryAccessor:a="question",valueAccessor:l,levelAccessor:c,countAccessor:u="count",levels:d=zg,orientation:h="horizontal",colorScheme:p,barPadding:f=20,tooltip:g,annotations:m,valueExtent:y,frameProps:b={},selection:v,linkedHover:x,onObservation:k,onClick:w,hoverHighlight:S,chartId:A,valueFormat:C,loading:M,loadingContent:j,emptyContent:P,legendInteraction:_,legendPosition:L,categoryFormat:R,stroke:T,strokeWidth:I,opacity:$}=e,{width:N,height:F,enableHover:B,showGrid:D,showLegend:E,title:z,description:H,summary:O,accessibleTable:W,categoryLabel:q,valueLabel:Y}=o,G="horizontal"===h,V=void 0===n,X=!c,U=function(){const e=Zh();return e?.colors?.diverging||void 0}(),K=(0,Lg.useMemo)(()=>p&&Array.isArray(p)&&p.length>=d.length?p:function(e,t){if(0>=e)return[];if(t){const o=Ig[t];if(o){if(1===e)return[o(.5)];const t=[];for(let r=0;e>r;r++)t.push(o(r/(e-1)));return t}}const o=["#da1e28","#ff8389","#ffb3b8"],r=["#a6c8ff","#4589ff","#0043ce"],n="#a8a8a8";if(1===e)return[n];const i=e%2!=0,s=Math.floor(e/2),a=[];for(let e=0;s>e;e++)a.push(o[Math.min(Math.floor(e*o.length/s),o.length-1)]);i&&a.push(n);for(let e=0;s>e;e++)a.push(r[Math.min(Math.floor(e*r.length/s),r.length-1)]);return a}(d.length,U),[p,d.length,U]),Q=(0,Lg.useMemo)(()=>{const e=new Map;for(let t=0;d.length>t;t++)e.set(d[t],K[t]||"#888");return e},[d,K]),{processedData:Z,reAggregate:J,accumulatorRef:ee}=function({data:e,levels:t,categoryAccessor:o,valueAccessor:r,levelAccessor:n,countAccessor:i,isDiverging:s,frameRef:a}){const l=!n,c=(0,Tg.useMemo)(()=>Fg(o,"question"),[o]),u=(0,Tg.useMemo)(()=>l?Fg(r,"score"):null,[l,r]),d=(0,Tg.useMemo)(()=>l?null:Fg(n,"level"),[l,n]),h=(0,Tg.useMemo)(()=>l?null:Fg(i,"count"),[l,i]),p=e||[],f=(0,Tg.useRef)([]);return{processedData:(0,Tg.useMemo)(()=>{if(0===p.length)return[];let e=Bg(p,t,c,u,d,h);return s&&(e=Dg(e,t),e=Eg(e,t)),e},[p,t,c,u,d,h,s]),reAggregate:(0,Tg.useCallback)(e=>{let o=Bg(e,t,c,u,d,h);s&&(o=Dg(o,t),o=Eg(o,t)),a.current?.replace(o)},[t,c,u,d,h,s,a]),accumulatorRef:f}}({data:n,levels:d,categoryAccessor:a,valueAccessor:l,levelAccessor:c,countAccessor:u,isDiverging:G,frameRef:r}),te="__likertLevelLabel",oe=function({isPushMode:e,colorBy:t,colorScheme:o,showLegend:r,legendPosition:n="right"}){const i=(0,Rg.useRef)(new Set),s=(0,Rg.useRef)([]),[a,l]=(0,Rg.useState)(0),c=th(),u=cp(),d=(0,Rg.useCallback)(e=>{if(!t)return null;const o="function"==typeof t?t(e):e[t];return null!=o?o+"":null},[t]),h=(0,Rg.useCallback)(o=>{if(!e||!t)return;let r=!1;for(const e of o){if(!e||"object"!=typeof e)continue;const t=d(e);null==t||i.current.has(t)||(i.current.add(t),s.current.push(t),r=!0)}r&&l(e=>e+1)},[e,t,d]),p=(0,Rg.useCallback)(o=>{if(!e||!t)return;const r=Array.from(new Set(o.map(String))),n=s.current;n.length===r.length&&n.every((e,t)=>e===r[t])||(i.current=new Set(r),s.current=r,l(e=>e+1))},[e,t]),f=(0,Rg.useCallback)(e=>t=>{h([t]),e(t)},[h]),g=(0,Rg.useCallback)(e=>t=>{h(t),e(t)},[h]),m=(0,Rg.useCallback)(()=>{i.current=new Set,s.current=[],l(e=>e+1)},[]);_h(e&&t?s.current:[]);const y=(0,Rg.useMemo)(()=>{if(!e||!t||!1===r)return;const n=s.current;if(0===n.length)return;const i=Array.isArray(o)&&o.length>0||"string"==typeof o&&o.length>0?o:u&&u.length>0?u:Ee,a="string"==typeof t?t:"__streamCat",l=n.map(e=>({[a]:e})),d=qe(l,a,i);return $h({data:l,colorBy:a,colorScale:e=>c?.[e]||d(e)||"#999",getColor:Oe})},[e,t,r,o,c,u,a]),b=(0,Rg.useMemo)(()=>{if(y)return"right"===n?{right:110}:"left"===n?{left:110}:"top"===n?{top:50}:"bottom"===n?{bottom:80}:{right:110}},[y,n]);return{wrapPush:f,wrapPushMany:g,resetCategories:m,categories:s.current,categoryDomainProps:e&&t?{legendCategoryAccessor:t,onCategoriesChange:p}:{},streamingLegend:y,streamingMarginAdjust:b}}({isPushMode:V,colorBy:te,colorScheme:K,showLegend:E,legendPosition:L}),re=(0,Lg.useCallback)(oe.wrapPush(e=>{ee.current.push(e),J(ee.current)}),[oe.wrapPush,J,ee]),ne=(0,Lg.useCallback)(oe.wrapPushMany(e=>{ee.current.push(...e),J(ee.current)}),[oe.wrapPushMany,J,ee]);(0,Lg.useImperativeHandle)(t,()=>({push:re,pushMany:ne,remove:e=>r.current?.remove(e)??[],update:(e,t)=>r.current?.update(e,t)??[],clear:()=>{ee.current=[],oe.resetCategories(),r.current?.clear()},getData:()=>r.current?.getData()??[],getScales:()=>r.current?.getScales()??null}),[re,ne,oe.resetCategories,ee]);const ie=_p({data:Z,rawData:n,colorBy:te,colorScheme:K,legendInteraction:_,legendPosition:L,selection:v,linkedHover:x,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:k,onClick:w,hoverHighlight:S,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"LikertChart",chartId:A,showLegend:E,userMargin:i,marginDefaults:o.marginDefaults,loading:M,loadingContent:j,emptyContent:P,width:N,height:F}),se=(0,Lg.useMemo)(()=>{const e=d.length;return e%2!=0&&Q.get(d[Math.floor(e/2)])||"#888"},[d,Q]),ae=Sg({colorBy:void 0,colorScale:void 0,color:void 0,themeCategorical:void 0,colorScheme:void 0,categoryIndexMap:Og,userPieceStyle:b?.pieceStyle,stroke:T,strokeWidth:I,opacity:$,effectiveSelectionHook:ie.effectiveSelectionHook,resolvedSelection:ie.resolvedSelection,baseStyleExtras:e=>{const t=e.__likertLevelLabel||e.data?.__likertLevelLabel,o=e.__likertLevel||e.data?.__likertLevel;if(o===$g||o===Ng)return{fill:se};const r=t||o;return r&&Q.has(r)?{fill:Q.get(r)}:{fill:"#888"}}}),le=(0,Lg.useMemo)(()=>{const e=d.length;return e%2!=0?d[Math.floor(e/2)]:""},[d]),ce=(0,Lg.useMemo)(()=>e=>{const t=e.data||e,o=t.__likertLevel||"Unknown",r=o===$g||o===Ng?le:o,n=t.__likertCategory||"",i=Math.abs(t.__likertPct||0),s=o===$g||o===Ng?2*i:i,a=t.__likertCount||0;return _g.createElement("div",{className:"semiotic-tooltip",style:Rs},_g.createElement("div",{style:{fontWeight:"bold"}},n),_g.createElement("div",{style:{marginTop:4}},`${r}: ${s.toFixed(1)}% (n=${a})`))},[le]),ue=(0,Lg.useMemo)(()=>{if(!d||2>d.length)return"LikertChart requires `levels` with at least 2 entries.";if(l&&c)return"LikertChart: provide either `valueAccessor` (raw responses) or `levelAccessor` + `countAccessor` (pre-aggregated), not both.";if(c&&!u)return"LikertChart: pre-aggregated mode requires both `levelAccessor` and `countAccessor`.";if(void 0!==n&&0===n.length)return null;const e={categoryAccessor:a};return X?l&&(e.valueAccessor=l):(c&&(e.levelAccessor=c),u&&(e.countAccessor=u)),Sp({componentName:"LikertChart",data:n,accessors:e,requiredProps:{levels:d}})},[n,a,l,c,u,d,X]),de=(0,Lg.useMemo)(()=>[{styleFn:e=>({fill:Q.get(e.label)||"#888"}),items:d.map(e=>({label:e})),label:""}],[d,Q]),he=(0,Lg.useMemo)(()=>!1!==E?{...ie.legendBehaviorProps,legend:{legendGroups:de},legendPosition:L||ie.legendPosition||"bottom"}:ie.legendBehaviorProps,[ie.legendBehaviorProps,ie.legendPosition,L,E,de]),pe=(0,Lg.useMemo)(()=>{const e={...ie.margin};if(V&&!1!==E){const t=L||"bottom";"bottom"===t&&80>e.bottom?e.bottom=80:"top"===t&&50>e.top?e.top=50:"right"===t&&110>e.right?e.right=110:"left"===t&&110>e.left&&(e.left=110)}else if(oe.streamingMarginAdjust)for(const[t,o]of Object.entries(oe.streamingMarginAdjust))o>e[t]&&(e[t]=o);return G&&100>e.left&&(e.left=100),e},[ie.margin,oe.streamingMarginAdjust,G,V,E,L]),fe=(0,Lg.useMemo)(()=>C||(G?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[G,C]);if(ie.earlyReturn)return ie.earlyReturn;const ge={chartType:"bar",...null!=n&&{data:Z},oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:G?"horizontal":"vertical",pieceStyle:ae,size:[N,F],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:pe,barPadding:f,enableHover:B,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:q,rLabel:Y||(G?void 0:"Percentage"),rFormat:fe,...R&&{oFormat:R},showGrid:D,...he,...z&&{title:z},...H&&{description:H},...O&&{summary:O},...void 0!==W&&{accessibleTable:W},...s&&{className:s},...null!=e.animate&&{animate:e.animate},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},tooltipContent:!1===g?()=>null:!0===g?ce:Bs(g)||ce,...Gd({linkedHover:x,selection:v,onObservation:k,onClick:w,hoverHighlight:S,mobileInteraction:ie.mobileInteraction,customHoverBehavior:ie.customHoverBehavior,customClickBehavior:ie.customClickBehavior}),...m&&m.length>0&&{annotations:m},...y&&{rExtent:y},...Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e))};return ue?(0,Hg.jsx)(td,{componentName:"LikertChart",message:ue,width:N,height:F}):(0,Hg.jsx)(sd,{componentName:"LikertChart",width:N,height:F,children:(0,Hg.jsx)(sc,{ref:r,...ge})})});Wg.displayName="LikertChart";var qg=require("react"),Yg=require("react");function Gg({brushProp:e,onBrushProp:t,linkedBrush:o,valueAccessor:r}){const n=Nh("string"==typeof o?o:o?{name:o.name,xField:o.rField}:void 0),i="string"==typeof r?r:"value",s=mh({name:n?.name||"__unused_ordinal_brush__",xField:n?.xField||i}),a=(0,Yg.useRef)(s.brushInteraction);a.current=s.brushInteraction;const l=(0,Yg.useCallback)(e=>{if(n){a.current.end(e?e.r:null)}t?.(e)},[t,n]),c=!!(e||o||t);return{hasBrush:c,handleBrush:l,brushStreamProps:c?{brush:{dimension:"r"},onBrush:l}:{}}}h();var Vg=require("react/jsx-runtime"),Xg=(0,qg.forwardRef)(function(e,t){const o=bp(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),r=(0,qg.useRef)(null);Rp(t,{variant:"xy",frameRef:r});const{data:n,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="vertical",valueFormat:d,colorBy:h,colorScheme:p,sizeBy:f,sizeRange:g=[3,8],symbolBy:m,symbolMap:y,pointRadius:b=4,pointOpacity:v=.7,categoryPadding:x=20,tooltip:k,annotations:w,valueExtent:S,brush:A,onBrush:C,linkedBrush:M,frameProps:j={},selection:P,linkedHover:_,onObservation:L,onClick:R,hoverHighlight:T,chartId:I,loading:$,loadingContent:N,emptyContent:F,legendInteraction:B,legendPosition:D,color:E,stroke:H,strokeWidth:O,opacity:W,showCategoryTicks:q,categoryFormat:Y}=e,{width:G,height:V,enableHover:X,showGrid:U,showLegend:K,title:Q,description:Z,summary:J,accessibleTable:ee,categoryLabel:te,valueLabel:oe}=o,re=(0,qg.useMemo)(()=>z(n),[n]),ne=_p({data:re,rawData:n,colorBy:h,colorScheme:p,legendInteraction:B,legendPosition:D,selection:P,linkedHover:_,fallbackFields:h?["string"==typeof h?h:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:L,onClick:R,hoverHighlight:T,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"SwarmPlot",chartId:I,showLegend:K,userMargin:i,marginDefaults:o.marginDefaults,loading:$,loadingContent:N,emptyContent:F,width:G,height:V}),ie=Gg({brushProp:A,onBrushProp:C,linkedBrush:M,valueAccessor:l}),se=(0,qg.useMemo)(()=>{if(f)return u(re.map(e=>"function"==typeof f?f(e):e[f]))},[re,f]),ae=cp(),le=(0,qg.useMemo)(()=>new Map,[re]),ce=Sg({colorBy:h,colorScale:ne.colorScale,color:E,themeCategorical:ae,colorScheme:p,categoryIndexMap:le,userPieceStyle:j?.pieceStyle,stroke:H,strokeWidth:O,opacity:W,effectiveSelectionHook:ne.effectiveSelectionHook,resolvedSelection:ne.resolvedSelection,baseStyleExtras:e=>({fillOpacity:v,r:f?Ye(e,f,g,se):b})}),ue=(0,qg.useMemo)(()=>Ha({categoryAccessor:a,valueAccessor:l,groupAccessor:h||void 0,valueFormat:d}),[a,l,h,d]);if(ne.earlyReturn)return ne.earlyReturn;const de=Sp({componentName:"SwarmPlot",data:n,accessors:{categoryAccessor:a,valueAccessor:l}});if(de)return(0,Vg.jsx)(td,{componentName:"SwarmPlot",message:de,width:G,height:V});const he={chartType:"swarm",...null!=n&&{data:re},oAccessor:a,rAccessor:l,...m&&{symbolAccessor:m},...y&&{symbolMap:y},projection:"horizontal"===c?"horizontal":"vertical",pieceStyle:ce,size:[G,V],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ne.margin,barPadding:x,enableHover:X,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:te,rLabel:oe,rFormat:d,...Y&&{oFormat:Y},showGrid:U,showCategoryTicks:q,...ne.legendBehaviorProps,...Yd({title:Q,description:Z,summary:J,accessibleTable:ee,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Vd({tooltip:k,defaultTooltipContent:ue}),...Gd({linkedHover:_,selection:P,onObservation:L,onClick:R,hoverHighlight:T,mobileInteraction:ne.mobileInteraction,customHoverBehavior:ne.customHoverBehavior,customClickBehavior:ne.customClickBehavior}),...w&&w.length>0&&{annotations:w},...S&&{rExtent:S},...ie.brushStreamProps,...Object.fromEntries(Object.entries(j).filter(([e])=>"pieceStyle"!==e))};return(0,Vg.jsx)(sd,{componentName:"SwarmPlot",width:G,height:V,children:(0,Vg.jsx)(sc,{ref:r,...he})})});Xg.displayName="SwarmPlot";var Ug=require("react"),Kg=require("react/jsx-runtime");function Qg(e){return t=>{const o=t.category||t.data&&t.data[0]?.category||"",r=t.stats||(t.data||t).stats;if(r&&null!=r.median)return(0,Kg.jsxs)("div",{className:"semiotic-tooltip",style:Rs,children:[o&&(0,Kg.jsx)("div",{style:{fontWeight:"bold"},children:o+""}),null!=r.n&&(0,Kg.jsxs)("div",{children:["n = ",r.n]}),null!=r.min&&(0,Kg.jsxs)("div",{children:["Min: ",r.min.toLocaleString()]}),null!=r.q1&&(0,Kg.jsxs)("div",{children:["Q1: ",r.q1.toLocaleString()]}),(0,Kg.jsxs)("div",{children:["Median: ",r.median.toLocaleString()]}),null!=r.q3&&(0,Kg.jsxs)("div",{children:["Q3: ",r.q3.toLocaleString()]}),null!=r.max&&(0,Kg.jsxs)("div",{children:["Max: ",r.max.toLocaleString()]}),null!=r.mean&&(0,Kg.jsxs)("div",{style:{opacity:.8},children:["Mean: ",r.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});if(e?.valueAccessor){const r=e.valueAccessor,n=(Array.isArray(t.data)?t.data:[]).map(e=>Number("function"==typeof r?r(e):e[r])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),i=n.length,s=i>0?i%2!=0?n[Math.floor(i/2)]:(n[i/2-1]+n[i/2])/2:null;return(0,Kg.jsxs)("div",{className:"semiotic-tooltip",style:Rs,children:[o&&(0,Kg.jsx)("div",{style:{fontWeight:"bold"},children:o+""}),i>0&&(0,Kg.jsxs)("div",{children:["n = ",i]}),null!=s&&(0,Kg.jsxs)("div",{children:["Median: ",s.toLocaleString()]})]})}return(0,Kg.jsx)("div",{className:"semiotic-tooltip",style:Rs,children:(0,Kg.jsx)("div",{style:{fontWeight:"bold"},children:o+""})})}}var Zg=require("react/jsx-runtime"),Jg=(0,Ug.forwardRef)(function(e,t){const o=bp(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),r=(0,Ug.useRef)(null);Rp(t,{variant:"xy",frameRef:r});const{data:n,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="vertical",valueFormat:u,colorBy:d,colorScheme:h,showOutliers:p=!0,outlierRadius:f=3,categoryPadding:g=20,tooltip:m,annotations:y,valueExtent:b,frameProps:v={},selection:x,linkedHover:k,onObservation:w,onClick:S,hoverHighlight:A,chartId:C,loading:M,loadingContent:j,emptyContent:P,legendInteraction:_,legendPosition:L,color:R,stroke:T,strokeWidth:I,opacity:$,showCategoryTicks:N,categoryFormat:F}=e,{width:B,height:D,enableHover:E,showGrid:H,showLegend:O,title:W,description:q,summary:Y,accessibleTable:G,categoryLabel:V,valueLabel:X}=o,U=(0,Ug.useMemo)(()=>z(n),[n]),K=_p({data:U,rawData:n,colorBy:d,colorScheme:h,legendInteraction:_,legendPosition:L,selection:x,linkedHover:k,fallbackFields:d?["string"==typeof d?d:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:w,onClick:S,hoverHighlight:A,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"BoxPlot",chartId:C,showLegend:O,userMargin:i,marginDefaults:o.marginDefaults,loading:M,loadingContent:j,emptyContent:P,width:B,height:D}),Q=cp(),Z=(0,Ug.useMemo)(()=>new Map,[U]),J=Sg({colorBy:d,colorScale:K.colorScale,color:R,themeCategorical:Q,colorScheme:h,categoryIndexMap:Z,userPieceStyle:void 0,stroke:T,strokeWidth:I,opacity:$,effectiveSelectionHook:K.effectiveSelectionHook,resolvedSelection:K.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),ee=(0,Ug.useMemo)(()=>Qg(),[]);if(K.earlyReturn)return K.earlyReturn;const te=Sp({componentName:"BoxPlot",data:n,accessors:{categoryAccessor:a,valueAccessor:l}});if(te)return(0,Zg.jsx)(td,{componentName:"BoxPlot",message:te,width:B,height:D});const oe={chartType:"boxplot",...null!=n&&{data:U},oAccessor:a,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",summaryStyle:J,showOutliers:p,size:[B,D],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:K.margin,barPadding:g,enableHover:E,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:V,rLabel:X,rFormat:u,...F&&{oFormat:F},showGrid:H,showCategoryTicks:N,...K.legendBehaviorProps,...Yd({title:W,description:q,summary:Y,accessibleTable:G,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Vd({tooltip:m,defaultTooltipContent:ee}),...Gd({linkedHover:k,selection:x,onObservation:w,onClick:S,hoverHighlight:A,mobileInteraction:K.mobileInteraction,customHoverBehavior:K.customHoverBehavior,customClickBehavior:K.customClickBehavior}),...y&&y.length>0&&{annotations:y},...b&&{rExtent:b},...Object.fromEntries(Object.entries(v).filter(([e])=>"pieceStyle"!==e))};return(0,Zg.jsx)(sd,{componentName:"BoxPlot",width:B,height:D,children:(0,Zg.jsx)(sc,{ref:r,...oe})})});Jg.displayName="BoxPlot";var em=require("react"),tm=require("react/jsx-runtime"),om=e=>{const t=e?.category;return null==t?"All":t+""},rm=(0,em.forwardRef)(function(e,t){const o=bp(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:"horizontal",mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),r=(0,em.useRef)(null);Rp(t,{variant:"xy",frameRef:r});const{data:n,margin:i,className:s,categoryAccessor:a=om,valueAccessor:l="value",bins:c=25,relative:u=!1,valueFormat:d,colorBy:h,colorScheme:p,categoryPadding:f=20,tooltip:g,annotations:m,valueExtent:y,brush:b,onBrush:v,linkedBrush:x,frameProps:k={},selection:w,linkedHover:S,onObservation:A,onClick:C,hoverHighlight:M,chartId:j,loading:P,loadingContent:_,emptyContent:L,legendInteraction:R,legendPosition:T,color:I,stroke:$,strokeWidth:N,opacity:F,showCategoryTicks:B,categoryFormat:D}=e,{width:E,height:H,enableHover:O,showGrid:W,showLegend:q,title:Y,description:G,summary:V,accessibleTable:X,categoryLabel:U,valueLabel:K}=o,Q=(0,em.useMemo)(()=>z(n),[n]),Z=_p({data:Q,rawData:n,colorBy:h,colorScheme:p,legendInteraction:R,legendPosition:T,selection:w,linkedHover:S,fallbackFields:h?["string"==typeof h?h:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:A,onClick:C,hoverHighlight:M,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"Histogram",chartId:j,showLegend:q,userMargin:i,marginDefaults:o.marginDefaults,loading:P,loadingContent:_,emptyContent:L,width:E,height:H}),J=Gg({brushProp:b,onBrushProp:v,linkedBrush:x,valueAccessor:l}),ee=(0,em.useMemo)(()=>{if(0===Q.length)return;const e="function"==typeof l?l:e=>e[l];let t=1/0,o=-1/0;for(const r of Q){const n=e(r);null!=n&&isFinite(n)&&(t>n&&(t=n),n>o&&(o=n))}return t>o?void 0:[t,o]},[Q,l]),te=cp(),oe=(0,em.useMemo)(()=>new Map,[Q]),re=Sg({colorBy:h,colorScale:Z.colorScale,color:I,themeCategorical:te,colorScheme:p,categoryIndexMap:oe,userPieceStyle:void 0,stroke:$,strokeWidth:N,opacity:F,effectiveSelectionHook:Z.effectiveSelectionHook,resolvedSelection:Z.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),ne=(0,em.useMemo)(()=>e=>{const t=e.data||e,o=t.category||e.category||"",r=t.count,n=t.range;return(0,tm.jsxs)("div",{className:"semiotic-tooltip",style:Rs,children:[o&&(0,tm.jsx)("div",{style:{fontWeight:"bold"},children:o+""}),null!=r&&(0,tm.jsxs)("div",{children:["Count: ",r]}),n&&2===n.length&&(0,tm.jsxs)("div",{style:{opacity:.8},children:[Number(n[0]).toFixed(1)," – ",Number(n[1]).toFixed(1)]})]})},[]);if(Z.earlyReturn)return Z.earlyReturn;const ie=Sp({componentName:"Histogram",data:n,accessors:{categoryAccessor:a,valueAccessor:l}});if(ie)return(0,tm.jsx)(td,{componentName:"Histogram",message:ie,width:E,height:H});const se={chartType:"histogram",...null!=n&&{data:Q},oAccessor:a,rAccessor:l,projection:"horizontal",summaryStyle:re,bins:c,normalize:u,...y?{rExtent:y}:ee&&{rExtent:ee},size:[E,H],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Z.margin,barPadding:f,enableHover:O,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:U,rLabel:K,rFormat:d,...D&&{oFormat:D},showGrid:W,showCategoryTicks:B,...Z.legendBehaviorProps,...Yd({title:Y,description:G,summary:V,accessibleTable:X,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Vd({tooltip:g,defaultTooltipContent:ne}),...Gd({linkedHover:S,selection:w,onObservation:A,onClick:C,hoverHighlight:M,mobileInteraction:Z.mobileInteraction,customHoverBehavior:Z.customHoverBehavior,customClickBehavior:Z.customClickBehavior}),...m&&m.length>0&&{annotations:m},...J.brushStreamProps,...Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e))};return(0,tm.jsx)(sd,{componentName:"Histogram",width:E,height:H,children:(0,tm.jsx)(sc,{ref:r,...se})})});rm.displayName="Histogram";var nm=require("react"),im=require("react/jsx-runtime"),sm=(0,nm.forwardRef)(function(e,t){const o=bp(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),r=(0,nm.useRef)(null);Rp(t,{variant:"xy",frameRef:r});const{data:n,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="vertical",bins:u=25,curve:d="catmullRom",showIQR:h=!0,valueFormat:p,colorBy:f,colorScheme:g,categoryPadding:m=20,tooltip:y,annotations:b,valueExtent:v,brush:x,onBrush:k,linkedBrush:w,frameProps:S={},selection:A,linkedHover:C,onObservation:M,onClick:j,hoverHighlight:P,chartId:_,loading:L,loadingContent:R,emptyContent:T,legendInteraction:I,legendPosition:$,color:N,stroke:F,strokeWidth:B,opacity:D,showCategoryTicks:E,categoryFormat:H}=e,{width:O,height:W,enableHover:q,showGrid:Y,showLegend:G,title:V,description:X,summary:U,accessibleTable:K,categoryLabel:Q,valueLabel:Z}=o,J=(0,nm.useMemo)(()=>z(n),[n]),ee=_p({data:J,rawData:n,colorBy:f,colorScheme:g,legendInteraction:I,legendPosition:$,selection:A,linkedHover:C,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:M,onClick:j,hoverHighlight:P,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"ViolinPlot",chartId:_,showLegend:G,userMargin:i,marginDefaults:o.marginDefaults,loading:L,loadingContent:R,emptyContent:T,width:O,height:W}),te=Gg({brushProp:x,onBrushProp:k,linkedBrush:w,valueAccessor:l}),oe=cp(),re=(0,nm.useMemo)(()=>new Map,[J]),ne=Sg({colorBy:f,colorScale:ee.colorScale,color:N,themeCategorical:oe,colorScheme:g,categoryIndexMap:re,userPieceStyle:void 0,stroke:F,strokeWidth:B,opacity:D,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection,baseStyleExtras:{fillOpacity:.6},linkStrokeToFill:!0}),ie=(0,nm.useMemo)(()=>Qg({valueAccessor:l}),[l]);if(ee.earlyReturn)return ee.earlyReturn;const se=Sp({componentName:"ViolinPlot",data:n,accessors:{categoryAccessor:a,valueAccessor:l}});if(se)return(0,im.jsx)(td,{componentName:"ViolinPlot",message:se,width:O,height:W});const ae={chartType:"violin",...null!=n&&{data:J},oAccessor:a,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",summaryStyle:ne,bins:u,showIQR:h,size:[O,W],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ee.margin,barPadding:m,enableHover:q,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:Q,rLabel:Z,rFormat:p,...H&&{oFormat:H},showGrid:Y,showCategoryTicks:E,...ee.legendBehaviorProps,...Yd({title:V,description:X,summary:U,accessibleTable:K,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Vd({tooltip:y,defaultTooltipContent:ie}),...Gd({linkedHover:C,selection:A,onObservation:M,onClick:j,hoverHighlight:P,mobileInteraction:ee.mobileInteraction,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior}),...b&&b.length>0&&{annotations:b},...v&&{rExtent:v},...te.brushStreamProps,...Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e))};return(0,im.jsx)(sd,{componentName:"ViolinPlot",width:O,height:W,children:(0,im.jsx)(sc,{ref:r,...ae})})});sm.displayName="ViolinPlot";var am=require("react"),lm=require("react/jsx-runtime"),cm=(0,am.forwardRef)(function(e,t){const o=bp(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),r=(0,am.useRef)(null);Rp(t,{variant:"xy",frameRef:r});const{data:n,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="horizontal",bins:u=20,amplitude:d=1.5,valueFormat:h,colorBy:p,colorScheme:f,categoryPadding:g=5,tooltip:m,annotations:y,valueExtent:b,frameProps:v={},selection:x,linkedHover:k,onObservation:w,onClick:S,hoverHighlight:A,chartId:C,loading:M,loadingContent:j,emptyContent:P,legendInteraction:_,legendPosition:L,color:R,stroke:T,strokeWidth:I,opacity:$,showCategoryTicks:N,categoryFormat:F}=e,{width:B,height:D,enableHover:E,showGrid:H,showLegend:O,title:W,description:q,summary:Y,accessibleTable:G,categoryLabel:V,valueLabel:X}=o,U=(0,am.useMemo)(()=>z(n),[n]),K=_p({data:U,rawData:n,colorBy:p,colorScheme:f,legendInteraction:_,legendPosition:L,selection:x,linkedHover:k,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:w,onClick:S,hoverHighlight:A,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"RidgelinePlot",chartId:C,showLegend:O,userMargin:i,marginDefaults:o.marginDefaults,loading:M,loadingContent:j,emptyContent:P,width:B,height:D}),Q=cp(),Z=(0,am.useMemo)(()=>new Map,[U]),J=Sg({colorBy:p,colorScale:K.colorScale,color:R,themeCategorical:Q,colorScheme:f,categoryIndexMap:Z,userPieceStyle:void 0,stroke:T,strokeWidth:I,opacity:$,effectiveSelectionHook:K.effectiveSelectionHook,resolvedSelection:K.resolvedSelection,baseStyleExtras:{fillOpacity:.5},linkStrokeToFill:!0}),ee=(0,am.useMemo)(()=>Qg(),[]);if(K.earlyReturn)return K.earlyReturn;const te=Sp({componentName:"RidgelinePlot",data:n,accessors:{categoryAccessor:a,valueAccessor:l}});if(te)return(0,lm.jsx)(td,{componentName:"RidgelinePlot",message:te,width:B,height:D});const oe={chartType:"ridgeline",...null!=n&&{data:U},oAccessor:a,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",summaryStyle:J,bins:u,size:[B,D],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:K.margin,barPadding:g,enableHover:E,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:V,rLabel:X,rFormat:h,...F&&{oFormat:F},showGrid:H,showCategoryTicks:N,oSort:!1,amplitude:d,...K.legendBehaviorProps,...Yd({title:W,description:q,summary:Y,accessibleTable:G,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Vd({tooltip:m,defaultTooltipContent:ee}),...Gd({linkedHover:k,selection:x,onObservation:w,onClick:S,hoverHighlight:A,mobileInteraction:K.mobileInteraction,customHoverBehavior:K.customHoverBehavior,customClickBehavior:K.customClickBehavior}),...y&&y.length>0&&{annotations:y},...b&&{rExtent:b},...Object.fromEntries(Object.entries(v).filter(([e])=>"pieceStyle"!==e))};return(0,lm.jsx)(sd,{componentName:"RidgelinePlot",width:B,height:D,children:(0,lm.jsx)(sc,{ref:r,...oe})})});cm.displayName="RidgelinePlot";var um=require("react"),dm=require("react/jsx-runtime"),hm=(0,um.forwardRef)(function(e,t){const o=bp(e.mode,{width:e.width,height:e.height,showGrid:!1,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,showCategoryTicks:!1,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),r=(0,um.useRef)(null);Rp(t,{variant:"xy",frameRef:r});const{data:n,margin:i,className:s,stepAccessor:a="step",valueAccessor:l="value",categoryAccessor:c,colorBy:u,colorScheme:d,orientation:h="horizontal",connectorOpacity:p=.3,showLabels:f=!0,tooltip:g,annotations:m,frameProps:y={},selection:b,linkedHover:v,onObservation:x,onClick:k,hoverHighlight:w,chartId:S,loading:A,loadingContent:C,emptyContent:M,legendInteraction:j,legendPosition:P,color:_,stroke:L,strokeWidth:R,opacity:T,categoryFormat:I}=e,$="vertical"===h,{width:N,height:F,enableHover:B,showLegend:D,title:E,description:H,summary:O,accessibleTable:W}=o,q=$?{top:E?60:40,right:20,bottom:60,left:60}:{top:E?40:10,right:10,bottom:10,left:10},Y=(0,um.useMemo)(()=>z(n),[n]),G=u||c,V=!G,X=_p({data:Y,rawData:n,colorBy:G,colorScheme:d,legendInteraction:j,legendPosition:P,selection:b,linkedHover:v,fallbackFields:G?["string"==typeof G?G:""]:[],unwrapData:!0,onObservation:x,onClick:k,hoverHighlight:w,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"FunnelChart",chartId:S,showLegend:D,userMargin:i,marginDefaults:q,loading:A,loadingContent:C,emptyContent:M,width:N,height:F});dd("FunnelChart",Y,"stepAccessor",a),dd("FunnelChart",Y,"valueAccessor",l);const U=cp(),K=(0,um.useMemo)(()=>new Map,[Y]),Q=(0,um.useMemo)(()=>{if(V)return _||(U?.[0]?U[0]:Array.isArray(d)&&d[0]?d[0]:"#4e79a7")},[V,_,U,d]),Z=Sg({colorBy:Q?void 0:G,colorScale:X.colorScale,color:Q??_,themeCategorical:U,colorScheme:d,categoryIndexMap:K,userPieceStyle:y?.pieceStyle,stroke:L,strokeWidth:R,opacity:T,effectiveSelectionHook:X.effectiveSelectionHook,resolvedSelection:X.resolvedSelection}),J=(0,um.useMemo)(()=>e=>{const t=e?.data||e,o=t?.__funnelStep||t?.__barFunnelStep||t?.step||"",r=t?.__funnelValue??t?.__barFunnelValue??t?.value??"",n=t?.__funnelPercent??t?.__barFunnelPercent,i=t?.__funnelIsFirstStep??t?.__barFunnelIsFirstStep,s=t?.__barFunnelIsDropoff,a=t?.__barFunnelCategory??t?.category,l=null==n||i?"":` (${.05>Math.abs(n-Math.round(n))?Math.round(n)+"%":n.toFixed(1)+"%"})`;return(0,dm.jsxs)("div",{className:"semiotic-tooltip",style:Rs,children:[o&&(0,dm.jsx)("div",{style:{fontWeight:"bold"},children:o+""}),a&&a!==o&&(0,dm.jsx)("div",{style:{marginTop:2,opacity:.8},children:a+""}),s&&(0,dm.jsx)("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7},children:"Dropoff"}),(0,dm.jsxs)("div",{style:{marginTop:4},children:[r+"",l]})]})},[]);if(X.earlyReturn)return X.earlyReturn;const ee=Sp({componentName:"FunnelChart",data:n,accessors:{stepAccessor:a,valueAccessor:l}});if(ee)return(0,dm.jsx)(td,{componentName:"FunnelChart",message:ee,width:N,height:F});const te={chartType:$?"bar-funnel":"funnel",...null!=n&&{data:Y},oAccessor:a,rAccessor:l,...c&&{stackBy:c},projection:$?"vertical":"horizontal",barPadding:$?40:0,pieceStyle:Z,size:[N,F],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:X.margin,enableHover:B,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:$,showCategoryTicks:$,...I&&{oFormat:I},showGrid:$,...!$&&{connectorOpacity:p},showLabels:f,...X.legendBehaviorProps,...E&&{title:E},...H&&{description:H},...O&&{summary:O},...void 0!==W&&{accessibleTable:W},...s&&{className:s},...null!=e.animate&&{animate:e.animate},tooltipContent:!1===g?()=>null:!0===g||null==g?J:Bs(g)||J,...Gd({linkedHover:v,selection:b,onObservation:x,onClick:k,hoverHighlight:w,mobileInteraction:X.mobileInteraction,customHoverBehavior:X.customHoverBehavior,customClickBehavior:X.customClickBehavior}),...m&&m.length>0&&{annotations:m},...Object.fromEntries(Object.entries(y).filter(([e])=>"pieceStyle"!==e))};return(0,dm.jsx)(sd,{componentName:"FunnelChart",width:N,height:F,children:(0,dm.jsx)(sc,{ref:r,...te})})});hm.displayName="FunnelChart";var pm=require("react"),fm=require("react/jsx-runtime"),gm=(0,pm.forwardRef)(function(e,t){const o=bp(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid??!0,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),r=(0,pm.useRef)(null);Rp(t,{variant:"xy",frameRef:r});const{data:n,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="horizontal",valueFormat:u,colorBy:d,colorScheme:h,sort:p="auto",dotRadius:f=5,categoryPadding:g=10,tooltip:m,annotations:y,regression:b,valueExtent:v,frameProps:x={},selection:k,linkedHover:w,onObservation:S,onClick:A,hoverHighlight:C,chartId:M,loading:j,loadingContent:P,emptyContent:_,legendInteraction:L,legendPosition:R,color:T,stroke:I,strokeWidth:$,opacity:N,categoryFormat:F}=e,{width:B,height:D,enableHover:E,showGrid:H,showLegend:O,title:W,description:q,summary:Y,accessibleTable:G,categoryLabel:V,valueLabel:X}=o,U=(0,pm.useMemo)(()=>z(n),[n]),K=_p({data:U,rawData:n,colorBy:d,colorScheme:h,legendInteraction:L,legendPosition:R,selection:k,linkedHover:w,fallbackFields:d?["string"==typeof d?d:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:S,onClick:A,hoverHighlight:C,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"DotPlot",chartId:M,showLegend:O,userMargin:i,marginDefaults:o.marginDefaults,loading:j,loadingContent:P,emptyContent:_,width:B,height:D}),Q=hp(U,p,l),Z=cp(),J=(0,pm.useMemo)(()=>new Map,[U]),ee=Sg({colorBy:d,colorScale:K.colorScale,color:T,themeCategorical:Z,colorScheme:h,categoryIndexMap:J,userPieceStyle:x?.pieceStyle,stroke:I,strokeWidth:$,opacity:N,effectiveSelectionHook:K.effectiveSelectionHook,resolvedSelection:K.resolvedSelection,baseStyleExtras:{r:f,fillOpacity:.8}}),te=(0,pm.useMemo)(()=>Ha({categoryAccessor:a,valueAccessor:l,valueFormat:u}),[a,l,u]);if(K.earlyReturn)return K.earlyReturn;const oe=Sp({componentName:"DotPlot",data:n,accessors:{categoryAccessor:a,valueAccessor:l}});if(oe)return(0,fm.jsx)(td,{componentName:"DotPlot",message:oe,width:B,height:D});const re=Bp(b),ne=re?[re,...y||[]]:y,ie={chartType:"point",...null!=n&&{data:Q},oAccessor:a,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",pieceStyle:ee,size:[B,D],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:K.margin,barPadding:g,enableHover:E,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:V,rLabel:X,rFormat:u,...F&&{oFormat:F},showGrid:H,oSort:p,...K.legendBehaviorProps,...Yd({title:W,description:q,summary:Y,accessibleTable:G,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Vd({tooltip:m,defaultTooltipContent:te}),...Gd({linkedHover:w,selection:k,onObservation:S,onClick:A,hoverHighlight:C,mobileInteraction:K.mobileInteraction,customHoverBehavior:K.customHoverBehavior,customClickBehavior:K.customClickBehavior}),...ne&&ne.length>0&&{annotations:ne},...v&&{rExtent:v},...Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e))};return(0,fm.jsx)(sd,{componentName:"DotPlot",width:B,height:D,children:(0,fm.jsx)(sc,{ref:r,...ie})})});gm.displayName="DotPlot";var mm=require("react"),ym=require("react/jsx-runtime"),bm=(0,mm.forwardRef)(function(e,t){const o=bp(e.mode,{width:e.width??400,height:e.height??400,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,showCategoryTicks:e.showCategoryTicks,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),r=(0,mm.useRef)(null),{data:n,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",colorBy:c,colorScheme:u,startAngle:d=0,cornerRadius:h,tooltip:p,annotations:f,frameProps:g={},selection:m,linkedHover:y,onObservation:b,onClick:v,hoverHighlight:x,chartId:k,loading:w,loadingContent:S,emptyContent:A,legendInteraction:C,legendPosition:M,color:j,stroke:P,strokeWidth:_,opacity:L}=e,{width:R,height:T,enableHover:I,showLegend:$,title:N,description:F,summary:B,accessibleTable:D}=o,E=(0,mm.useMemo)(()=>z(n),[n]),H=c||a,O=_p({data:E,rawData:n,colorBy:H,colorScheme:u,legendInteraction:C,legendPosition:M,selection:m,linkedHover:y,fallbackFields:H?["string"==typeof H?H:""]:[],unwrapData:!0,onObservation:b,onClick:v,hoverHighlight:x,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"PieChart",chartId:k,showLegend:$,userMargin:i,marginDefaults:o.marginDefaults,loading:w,loadingContent:S,emptyContent:A,width:R,height:T}),W=cp(),q=(0,mm.useMemo)(()=>new Map,[E]),Y=Sg({colorBy:H,colorScale:O.colorScale,color:j,themeCategorical:W,colorScheme:u,categoryIndexMap:q,userPieceStyle:g?.pieceStyle,stroke:P,strokeWidth:_,opacity:L,effectiveSelectionHook:O.effectiveSelectionHook,resolvedSelection:O.resolvedSelection,cycleByCategory:!0}),G=(0,mm.useMemo)(()=>Ha({categoryAccessor:a,valueAccessor:l,groupAccessor:c&&c!==a?c:void 0,groupLabel:"string"==typeof c?c:"group",pieData:!0}),[a,l,c]),V=Sp({componentName:"PieChart",data:n,accessors:{categoryAccessor:a,valueAccessor:l}}),{effectiveLegendProps:X,effectiveMargin:U}=kg({ref:t,frameRef:r,setup:O});if(O.earlyReturn)return O.earlyReturn;const K={chartType:"pie",...null!=n&&{data:E},oAccessor:a,rAccessor:l,projection:"radial",pieceStyle:Y,startAngle:d,...null!=h&&{cornerRadius:h},size:[R,T],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:U,enableHover:I,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:!1,...X,...Yd({title:N,description:F,summary:B,accessibleTable:D,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Vd({tooltip:p,defaultTooltipContent:G}),...Gd({linkedHover:y,selection:m,onObservation:b,onClick:v,hoverHighlight:x,mobileInteraction:O.mobileInteraction,customHoverBehavior:O.customHoverBehavior,customClickBehavior:O.customClickBehavior}),...f&&f.length>0&&{annotations:f},...Object.fromEntries(Object.entries(g).filter(([e])=>"pieceStyle"!==e))};return V?(0,ym.jsx)(td,{componentName:"PieChart",message:V,width:R,height:T}):(0,ym.jsx)(sd,{componentName:"PieChart",width:R,height:T,children:(0,ym.jsx)(sc,{ref:r,...K})})});bm.displayName="PieChart";var vm=require("react"),xm=require("react/jsx-runtime"),km=(0,vm.forwardRef)(function(e,t){const o=bp(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,linkedHover:e.linkedHover,showCategoryTicks:e.showCategoryTicks,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:400,height:400}),r=(0,vm.useRef)(null),{data:n,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",innerRadius:c,centerContent:u,colorBy:d,colorScheme:h,startAngle:p=0,cornerRadius:f,tooltip:g,annotations:m,frameProps:y={},selection:b,linkedHover:v,onObservation:x,onClick:k,hoverHighlight:w,chartId:S,loading:A,loadingContent:C,emptyContent:M,legendInteraction:j,legendPosition:P,color:_,stroke:L,strokeWidth:R,opacity:T}=e,{width:I,height:$,enableHover:N,showLegend:F,title:B,description:D,summary:E,accessibleTable:H}=o,O=(0,vm.useMemo)(()=>z(n),[n]),W=d||a,q=_p({data:O,rawData:n,colorBy:W,colorScheme:h,legendInteraction:j,legendPosition:P,selection:b,linkedHover:v,fallbackFields:W?["string"==typeof W?W:""]:[],unwrapData:!0,onObservation:x,onClick:k,hoverHighlight:w,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"DonutChart",chartId:S,showLegend:F,userMargin:i,marginDefaults:o.marginDefaults,loading:A,loadingContent:C,emptyContent:M,width:I,height:$}),Y=c??Math.max(2,.15*Math.min(I,$)),G=cp(),V=(0,vm.useMemo)(()=>new Map,[O]),X=Sg({colorBy:W,colorScale:q.colorScale,color:_,themeCategorical:G,colorScheme:h,categoryIndexMap:V,userPieceStyle:y?.pieceStyle,stroke:L,strokeWidth:R,opacity:T,effectiveSelectionHook:q.effectiveSelectionHook,resolvedSelection:q.resolvedSelection,cycleByCategory:!0}),U=(0,vm.useMemo)(()=>Ha({categoryAccessor:a,valueAccessor:l,groupAccessor:d&&d!==a?d:void 0,groupLabel:"string"==typeof d?d:"group",pieData:!0}),[a,l,d]),K=Sp({componentName:"DonutChart",data:n,accessors:{categoryAccessor:a,valueAccessor:l}}),{effectiveLegendProps:Q,effectiveMargin:Z}=kg({ref:t,frameRef:r,setup:q});if(q.earlyReturn)return q.earlyReturn;const J={chartType:"donut",...null!=n&&{data:O},oAccessor:a,rAccessor:l,projection:"radial",pieceStyle:X,innerRadius:Y,startAngle:p,...null!=f&&{cornerRadius:f},centerContent:u,size:[I,$],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Z,enableHover:N,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:!1,...Q,...Yd({title:B,description:D,summary:E,accessibleTable:H,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Vd({tooltip:g,defaultTooltipContent:U}),...Gd({linkedHover:v,selection:b,onObservation:x,onClick:k,hoverHighlight:w,mobileInteraction:q.mobileInteraction,customHoverBehavior:q.customHoverBehavior,customClickBehavior:q.customClickBehavior}),...m&&m.length>0&&{annotations:m},...Object.fromEntries(Object.entries(y).filter(([e])=>"pieceStyle"!==e))};return K?(0,xm.jsx)(td,{componentName:"DonutChart",message:K,width:I,height:$}):(0,xm.jsx)(sd,{componentName:"DonutChart",width:I,height:$,children:(0,xm.jsx)(sc,{ref:r,...J})})});km.displayName="DonutChart";var wm=require("react");function Sm(e=240){const t=360-e,o=180+t/2,r=o*Math.PI/180;return{sweepRad:e*Math.PI/180,gapDeg:t,startAngleDeg:o,startAngleRad:r,offsetRad:-Math.PI/2+r}}function Am(e){return Math.max(0,Math.min(1,e))}function Cm(e){const t=e.trim();if(t.startsWith("#")){let e=t.slice(1);if(3===e.length&&(e=e.split("").map(e=>e+e).join("")),6===e.length&&/^[0-9a-f]{6}$/i.test(e))return[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16)]}const o=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);if(o){const e=[Number(o[1]),Number(o[2]),Number(o[3])];if(e.every(Number.isFinite))return e}return null}function Mm(e,t,o){const r=e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0");return`#${r(e)}${r(t)}${r(o)}`}function jm(e,t){const o=e.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Am(e.offset),color:e.color})).sort((e,t)=>e.offset-t.offset);if(0===o.length)return"#999999";if(1===o.length)return o[0].color;const r=Am(t);if(o[0].offset>=r)return o[0].color;if(r>=o[o.length-1].offset)return o[o.length-1].color;for(let e=0;o.length-1>e;e++){const t=o[e],n=o[e+1];if(t.offset>r||r>n.offset)continue;const i=n.offset-t.offset,s=i>0?(r-t.offset)/i:0,a=Cm(t.color),l=Cm(n.color);if(!a||!l)return.5>s?t.color:n.color;const[c,u,d]=a,[h,p,f]=l;return Mm(c+(h-c)*s,u+(p-u)*s,d+(f-d)*s)}return o[o.length-1].color}function Pm(e,t,o){return null==o?`${e}-${t}`:`${e}-${t}-${o}`}h();var _m=require("react/jsx-runtime"),Lm=(0,wm.forwardRef)(function(e,t){const o=bp(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLegend:!1,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:300,height:250}),r=(0,wm.useRef)(null),n="context"===e.mode,{compactMode:i}=o,{value:s,min:a=0,max:l=100,thresholds:c,gradientFill:d,color:h,backgroundColor:p="var(--semiotic-grid, #e0e0e0)",arcWidth:f=.3,cornerRadius:g,showNeedle:m=!0,needleColor:y="var(--semiotic-text, #333)",centerContent:b,valueFormat:v,showScaleLabels:x=!i,sweep:k=240,fillZones:w=!0,tooltip:S,annotations:A,frameProps:C={},className:M,stroke:j,strokeWidth:P,opacity:_}=e,{width:L,height:R,title:T,description:I,summary:$,accessibleTable:N}=o,F=d&&"object"==typeof d?d:void 0,B=Math.max(a,Math.min(l,s)),D=l-a||1,E=(B-a)/D,{gaugeData:z,pieceStyle:H,gaugeAnnotations:O}=(0,wm.useMemo)(()=>function(e){const{min:t,max:o,value:r,thresholds:n,fillColor:i,backgroundColor:s,fillZones:a,showScaleLabels:l,gradientFill:c,gradientSteps:u=240}=e,d=o-t||1,h=(Math.max(t,Math.min(o,r))-t)/d;let p=n&&n.length>0?[...n].sort((e,t)=>e.value-t.value):[{value:o,color:i||"#007bff"}];p=p.map(e=>({...e,value:Math.max(t,Math.min(o,e.value))})),o>p[p.length-1].value&&p.push({value:o,color:p[p.length-1].color});const f=!!c&&c.colorStops.length>=2,g=[],m=new Map,y=[];if(f){const e=a?h:1,t=Pm("bg",0);if(g.push({category:t,value:1,_zone:"Track",_isFill:!1,_pctStart:0,_pct:1,_roundedEnds:{start:!0,end:!0},_nonInteractive:!0}),m.set(t,{fill:s,opacity:.4}),e>0){const t=Math.max(1,Math.floor(u)),o=Math.max(1,Math.min(t,Math.round(e*t))),r=[];for(let t=0;o>t;t++)r.push(jm(c.colorStops,e*(t+.5)/o));const n=Pm("fill",0);g.push({category:n,value:e,_zone:"Gradient",_isFill:!0,_pctStart:0,_pct:e,_roundedEnds:{start:!0,end:!0},_nonInteractive:!0,_gradientBand:{colors:r}}),m.set(n,{fill:r[0]||s})}}else{let e=t;for(let o=0;p.length>o;o++){const r=p[o],n=(r.value-e)/d,i=(e-t)/d,l=(r.value-t)/d,c=Math.max(0,(a?Math.min(h,l):l)-i),u=a?Math.max(0,n-c):0;if(c>0){const e=Pm("fill",o);g.push({category:e,value:c,_zone:r.label||"Zone "+(o+1),_isFill:!0}),m.set(e,{fill:r.color})}if(u>0){const e=Pm("bg",o);g.push({category:e,value:u,_zone:r.label||"Zone "+(o+1),_isFill:!1}),m.set(e,{fill:s,opacity:.4})}e=r.value}}if(l&&n&&n.length>0)for(const e of n)e.value>t&&o>e.value&&y.push({type:"gauge-label",value:e.value,label:e.label||e.value+""});return{gaugeData:g,pieceStyle:(e,t)=>m.get(t||e.category)||{fill:s},gaugeAnnotations:y}}({min:a,max:l,value:s,thresholds:c,fillColor:h,backgroundColor:p,fillZones:w,showScaleLabels:x,gradientFill:F}),[s,a,l,c,h,p,x,w,F]),W=(0,wm.useMemo)(()=>Ip(H,{stroke:j,strokeWidth:P,opacity:_}),[H,j,P,_]),{sweepRad:q,startAngleDeg:Y}=Sm(k),G=function(e=240){const{sweepRad:t,offsetRad:o}=Sm(e),r=[[Math.cos(o),Math.sin(o)],[Math.cos(o+t),Math.sin(o+t)],[0,0]];for(let e=0;2*Math.PI>e;e+=Math.PI/2)((e-o)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)>t+.001||r.push([Math.cos(e),Math.sin(e)]);const n=r.map(e=>e[0]),i=r.map(e=>e[1]),[s,a]=u(n),[l,c]=u(i);return{minX:s,maxX:a,minY:l,maxY:c,width:a-s,height:c-l,cx:(s+a)/2,cy:(l+c)/2}}(k),V=Math.min(10,Math.max(1,Math.min(L,R)/12)),X=G.cx,U=G.cy,K=Math.max(4,Math.min((L-2*V)/G.width,(R-2*V)/G.height)-2),Q=Math.max(0,Math.min(K-1.5,K*(1-f))),Z=L/2-X*K,J=R/2-U*K,ee=2*(K+4),te=(0,wm.useMemo)(()=>{if(i&&null==b)return null;if(null!=b)return"function"==typeof b?b(B,a,l):b;const e=v?v(B):Math.round(B)+"";return(0,_m.jsxs)("div",{style:{textAlign:"center",lineHeight:1.2},children:[(0,_m.jsx)("div",{style:{fontSize:Math.max(16,.3*K),fontWeight:700,color:"var(--semiotic-text, #333)"},children:e}),x&&(0,_m.jsxs)("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"},children:[a," – ",l]})]})},[b,B,a,l,v,x,K,i]),oe=(0,wm.useMemo)(()=>n&&null==b?{type:"gauge-value",text:v?v(B):Math.round(B)+""}:null,[n,b,B,v]),re=(0,wm.useMemo)(()=>{if(!m)return null;const e=-Math.PI/2+Y*Math.PI/180+E*q,t=Q>20?Q-8:K-1;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:y}},[m,E,Y,q,Q,y]),ne=(0,wm.useMemo)(()=>(e,t,o)=>{if("gauge-needle"===e.type){const r=(o.width||L)/2,n=(o.height||R)/2,i=Math.max(1,K-Q),s=Math.max(1,Math.min(2.5,.4*i)),a=Math.max(1,Math.min(5,.6*i));return(0,_m.jsxs)("g",{transform:`translate(${r},${n})`,children:[(0,_m.jsx)("line",{x1:0,y1:0,x2:e.tipX,y2:e.tipY,stroke:e.color,strokeWidth:s,strokeLinecap:"round"}),(0,_m.jsx)("circle",{cx:0,cy:0,r:a,fill:e.color})]},"gauge-needle-"+t)}if("gauge-label"===e.type){const r=-Math.PI/2+Y*Math.PI/180+(e.value-a)/D*q,n=(o.width||L)/2,i=(o.height||R)/2,s=Q-1,l=K+1,c=Math.cos(r)*s,u=Math.sin(r)*s,d=Math.cos(r)*l,h=Math.sin(r)*l,p=K+10,f=Math.cos(r)*p,g=Math.sin(r)*p,m=((r+Math.PI/2)/(2*Math.PI)*12+12)%12;let y,b;return m>=11||1>m?(y="middle",b="auto"):m>=1&&5>m?(y="start",b="middle"):m>=5&&7>m?(y="middle",b="hanging"):(y="end",b="middle"),(0,_m.jsxs)("g",{transform:`translate(${n},${i})`,children:[(0,_m.jsx)("line",{x1:c,y1:u,x2:d,y2:h,stroke:"var(--semiotic-border)",strokeWidth:2,strokeLinecap:"round"}),(0,_m.jsx)("text",{x:f,y:g,textAnchor:y,dominantBaseline:b,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none",fontSize:"var(--semiotic-gauge-label-font-size, 10px)"},children:e.label})]},"gauge-label-"+t)}return"gauge-value"===e.type?(0,_m.jsx)("text",{x:(o.width||L)/2,y:(o.height||R)/2-.2*Q,textAnchor:"middle",dominantBaseline:"middle",fontSize:Math.max(12,Math.min(22,.28*K)),fontWeight:700,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:e.text},"gauge-value-"+t):null},[L,R,a,D,Y,q,Q,K]),ie=(0,wm.useMemo)(()=>{const e=[...O,...A||[]];return re&&e.push(re),oe&&e.push(oe),e},[O,A,re,oe]),se=(0,wm.useMemo)(()=>e=>{const t=e?.data?.[0]||e?.data||e,o=t?._zone||"",r=t?._isFill;return(0,_m.jsxs)("div",{className:"semiotic-tooltip",style:{padding:"6px 10px",background:"var(--semiotic-tooltip-bg, white)",borderRadius:"var(--semiotic-tooltip-radius, 6px)",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0,0,0,0.15))"},children:[(0,_m.jsx)("div",{style:{fontWeight:600},children:o}),(0,_m.jsx)("div",{style:{fontSize:"0.85em",color:"var(--semiotic-text-secondary, #666)"},children:r?"Current: "+Math.round(B):"Remaining"})]})},[B]);if(0===z.length)return(0,_m.jsx)(td,{componentName:"GaugeChart",message:"No data to display",width:L,height:R});const ae={chartType:"donut",data:z,oAccessor:"category",rAccessor:"value",oSort:!1,projection:"radial",pieceStyle:W,innerRadius:Q,startAngle:Y,sweepAngle:k,...null!=g&&{cornerRadius:g},centerContent:te,size:[L,R],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:{top:J-ee/2,bottom:R-J-ee/2,left:Z-ee/2,right:L-Z-ee/2},enableHover:o.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===S?()=>null:Bs(S)||se,svgAnnotationRules:ne,...ie.length>0&&{annotations:ie},...T&&{title:T},...I&&{description:I},...$&&{summary:$},...void 0!==N&&{accessibleTable:N},...M&&{className:M},...null!=e.animate&&{animate:e.animate},...C};return(0,_m.jsx)(sd,{componentName:"GaugeChart",width:L,height:R,children:(0,_m.jsx)(sc,{ref:r,...ae})})});Lm.displayName="GaugeChart";var Rm=require("react"),Tm=require("react/jsx-runtime"),Im=(0,Rm.forwardRef)(function(e,t){const o=bp(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),r=(0,Rm.useRef)(null),{data:n,margin:i,className:s,categoryAccessor:a="category",groupBy:l,valueAccessor:c="value",orientation:u="vertical",valueFormat:d,colorBy:h,colorScheme:p,sort:f=!1,barPadding:g=60,roundedTop:m,baselinePadding:y=!1,tooltip:b,annotations:v,valueExtent:x,frameProps:k={},selection:w,linkedHover:S,onObservation:A,onClick:C,hoverHighlight:M,chartId:j,loading:P,loadingContent:_,emptyContent:L,legendInteraction:R,legendPosition:T,color:I,stroke:$,strokeWidth:N,opacity:F,categoryFormat:B}=e,{width:D,height:E,enableHover:H,showGrid:O,showLegend:W,title:q,description:Y,summary:G,accessibleTable:V,categoryLabel:X,valueLabel:U}=o,K=(0,Rm.useMemo)(()=>z(n),[n]),Q=h||l,Z=_p({data:K,rawData:n,colorBy:Q,colorScheme:p,legendInteraction:R,legendPosition:T,selection:w,linkedHover:S,fallbackFields:Q?["string"==typeof Q?Q:""]:[],unwrapData:!0,onObservation:A,onClick:C,hoverHighlight:M,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"GroupedBarChart",chartId:j,showLegend:W,userMargin:i,marginDefaults:o.marginDefaults,loading:P,loadingContent:_,emptyContent:L,width:D,height:E}),J=cp(),ee=(0,Rm.useMemo)(()=>new Map,[K]),te=Sg({colorBy:Q,colorScale:Z.colorScale,color:I,themeCategorical:J,colorScheme:p,categoryIndexMap:ee,userPieceStyle:k.pieceStyle,stroke:$,strokeWidth:N,opacity:F,effectiveSelectionHook:Z.effectiveSelectionHook,resolvedSelection:Z.resolvedSelection}),oe=(0,Rm.useMemo)(()=>Ha({categoryAccessor:l,valueAccessor:c,groupAccessor:a,valueFormat:d}),[l,a,c,d]),re=Sp({componentName:"GroupedBarChart",data:n,accessors:{categoryAccessor:a,valueAccessor:c},requiredProps:{groupBy:l}}),{effectiveLegendProps:ne,effectiveMargin:ie}=kg({ref:t,frameRef:r,setup:Z});if(Z.earlyReturn)return Z.earlyReturn;const se={chartType:"clusterbar",...null!=n&&{data:K},oAccessor:a,rAccessor:c,groupBy:l,oSort:f,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:te,size:[D,E],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ie,barPadding:g,...null!=m&&{roundedTop:m},baselinePadding:y,enableHover:H,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:X,rLabel:U,rFormat:d,...B&&{oFormat:B},showGrid:O,...ne,...Yd({title:q,description:Y,summary:G,accessibleTable:V,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Vd({tooltip:b,defaultTooltipContent:oe}),...Gd({linkedHover:S,selection:w,onObservation:A,onClick:C,hoverHighlight:M,mobileInteraction:Z.mobileInteraction,customHoverBehavior:Z.customHoverBehavior,customClickBehavior:Z.customClickBehavior}),...v&&v.length>0&&{annotations:v},...x&&{rExtent:x},...Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e))};return re?(0,Tm.jsx)(td,{componentName:"GroupedBarChart",message:re,width:D,height:E}):(0,Tm.jsx)(sd,{componentName:"GroupedBarChart",width:D,height:E,children:(0,Tm.jsx)(sc,{ref:r,...se})})});Im.displayName="GroupedBarChart";var $m=require("react"),Nm=require("react/jsx-runtime"),Fm=(0,$m.forwardRef)(function(e,t){const o=bp(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),r=(0,$m.useRef)(null),{data:n,margin:i,className:s,categoryAccessor:a="category",subcategoryAccessor:l,valueAccessor:c="value",orientation:u="horizontal",valueFormat:d,colorBy:h,colorScheme:p,barPadding:f,tooltip:g,annotations:m,brush:y,onBrush:b,linkedBrush:v,frameProps:x={},selection:k,linkedHover:w,onObservation:S,onClick:A,hoverHighlight:C,chartId:M,loading:j,loadingContent:P,emptyContent:_,legendInteraction:L,legendPosition:R,color:T,stroke:I,strokeWidth:$,opacity:N,categoryFormat:F,rTickValues:B,tickLabelEdgeAlign:D,showCategoryTicks:E,gradientFill:H,trackFill:O,roundedTop:W,valueExtent:q}=e,{width:Y,height:G,enableHover:V,showGrid:X,showLegend:U,title:K,description:Q,summary:Z,accessibleTable:J,categoryLabel:ee,valueLabel:te}=o,oe=(0,$m.useMemo)(()=>z(n),[n]),re=h||l,ne=(0,$m.useMemo)(()=>{if(null!=f)return f;if("sparkline"!==e.mode)return 40;const t=new Set(oe.map(e=>"function"==typeof a?a(e):e[a])),o=Math.max(1,t.size);return o>1?Math.max(0,Math.min(1,(("horizontal"===u?G:Y)-2*o)/(o-1))):1},[f,e.mode,oe,a,u,Y,G]),ie=_p({data:oe,rawData:n,colorBy:re,colorScheme:p,legendInteraction:L,legendPosition:R,selection:k,linkedHover:w,fallbackFields:re?["string"==typeof re?re:""]:[],unwrapData:!0,onObservation:S,onClick:A,hoverHighlight:C,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"SwimlaneChart",chartId:M,showLegend:U,userMargin:i,marginDefaults:o.marginDefaults,loading:j,loadingContent:P,emptyContent:_,width:Y,height:G}),se=Gg({brushProp:y,onBrushProp:b,linkedBrush:v,valueAccessor:c}),ae=cp(),le=(0,$m.useMemo)(()=>new Map,[oe]),ce=Sg({colorBy:re,colorScale:ie.colorScale,color:T,themeCategorical:ae,colorScheme:p,categoryIndexMap:le,userPieceStyle:x?.pieceStyle,stroke:I,strokeWidth:$,opacity:N,effectiveSelectionHook:ie.effectiveSelectionHook,resolvedSelection:ie.resolvedSelection,cycleByCategory:!0}),ue=(0,$m.useMemo)(()=>Ha({categoryAccessor:l,valueAccessor:c,groupAccessor:a,valueFormat:d}),[l,a,c,d]),de=Sp({componentName:"SwimlaneChart",data:n,accessors:{categoryAccessor:a,valueAccessor:c,subcategoryAccessor:l},requiredProps:{subcategoryAccessor:l}}),{effectiveLegendProps:he,effectiveMargin:pe}=kg({ref:t,frameRef:r,setup:ie});if(ie.earlyReturn)return ie.earlyReturn;const fe={chartType:"swimlane",...null!=n&&{data:oe},oAccessor:a,rAccessor:c,stackBy:l,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:ce,size:[Y,G],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:pe,barPadding:ne,enableHover:V,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:!1===E?void 0:ee,rLabel:te,rFormat:d,...B&&{rTickValues:B},...null!=D&&{tickLabelEdgeAlign:D},...F&&{oFormat:F},...void 0!==E&&{showCategoryTicks:E},showGrid:X,...he,...Yd({title:K,description:Q,summary:Z,accessibleTable:J,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Vd({tooltip:g,defaultTooltipContent:ue}),...Gd({linkedHover:w,selection:k,onObservation:S,onClick:A,hoverHighlight:C,mobileInteraction:ie.mobileInteraction,customHoverBehavior:ie.customHoverBehavior,customClickBehavior:ie.customClickBehavior}),...m&&m.length>0&&{annotations:m},...H&&{gradientFill:!0===H?{topOpacity:.8,bottomOpacity:.05}:H},...null!=O&&{trackFill:O},...null!=W&&{roundedTop:W},...q&&{rExtent:q},...se.brushStreamProps,...Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e))};return de?(0,Nm.jsx)(td,{componentName:"SwimlaneChart",message:de,width:Y,height:G}):(0,Nm.jsx)(sd,{componentName:"SwimlaneChart",width:Y,height:G,children:(0,Nm.jsx)(sc,{ref:r,...fe})})});Fm.displayName="SwimlaneChart";var Bm=require("react"),Dm=require("react");function Em(e,t){if(!e)return[];const o=[],r=e=>{o.push(e);const n="function"==typeof t?t(e):e[t];n&&Array.isArray(n)&&n.forEach(r)};return r(e),o}function zm(e,t,o,r){if(e&&e.length>0)return e;const n=new Set;return t.forEach(e=>{const t="function"==typeof o?o(e):e[o],i="function"==typeof r?r(e):e[r];n.add(t),n.add(i)}),Array.from(n).map(e=>({id:e}))}function Hm(e){return"function"==typeof e?e:t=>t[e]||1}function Om({edgeColorBy:e,colorBy:t,colorScale:o,nodeStyleFn:r,edgeOpacity:n,baseStyle:i={}}){return s=>{const a={fillOpacity:n,...i};if("function"==typeof e)a.fill=e(s);else if("source"===e){const e="object"==typeof s.source?s.source:null;t&&e?a.fill=Oe(e.data||e,t,o):e&&(a.fill=r(e,e.index).fill)}else if("target"===e){const e="object"==typeof s.target?s.target:null;t&&e?a.fill=Oe(e.data||e,t,o):e&&(a.fill=r(e,e.index).fill)}else"gradient"===e&&(a.fill="#999",a.fillOpacity=.7*n);return a}}function Wm(e){const{nodes:t,edges:o,inferNodes:r=!0,sourceAccessor:n="source",targetAccessor:i="target",colorBy:s,colorScheme:a,showLegend:l,legendPosition:c,legendInteraction:u,selection:d,linkedHover:h,onObservation:p,onClick:f,mobileInteraction:g,mobileSemantics:m,chartType:y,chartId:b,marginDefaults:v,userMargin:x,width:k,height:w,loading:S,loadingContent:A,emptyContent:C,emptyDataKey:M="edges"}=e,j=(0,Dm.useMemo)(()=>z(o),[o]),P=(0,Dm.useMemo)(()=>z(t),[t]),_=ud(S,k,w,A),L=_?null:cd("nodes"===M?void 0===t?void 0:P:void 0===o?void 0:j,k,w,C),R=(0,Dm.useMemo)(()=>r?zm(P,j,n,i):P,[r,P,j,n,i]),T=dp(R,s,a),I=cp(),$=(0,Dm.useMemo)(()=>{if(Array.isArray(a))return a;if(I&&I.length>0)return I;if("string"==typeof a){const e=Be[a];if(Array.isArray(e)&&e.length>0)return e}return De},[a,I]),N=(0,Dm.useMemo)(()=>{if(!s)return[];const e=new Set;for(const t of R){const o="function"==typeof s?s(t):t[s];null!=o&&e.add(o+"")}return Array.from(e)},[R,s]),F=mp(u,s,N),{legend:B,margin:D,legendPosition:E}=gp({data:R,colorBy:s,colorScale:T,showLegend:l,legendPosition:c,userMargin:x,defaults:v,categories:N}),H=(0,Dm.useMemo)(()=>lp(g,{width:k,mobileSemantics:m}),[g,k,m]),O=pp({selection:d,linkedHover:h,fallbackFields:s?["string"==typeof s?s:""]:[],unwrapData:!0,onObservation:p,onClick:f,mobileInteraction:H,chartType:y,chartId:b}),{customHoverBehavior:W,customClickBehavior:q,activeSelectionHook:Y,hoverSelectionHook:G,crosshairSourceId:V}=O;return{safeNodes:R,safeEdges:j,colorScale:T,effectivePalette:$,themeCategorical:I,allCategories:N,legendState:F,legend:B,margin:D,legendPosition:E,mobileInteraction:H,customHoverBehavior:W,customClickBehavior:q,activeSelectionHook:Y,hoverSelectionHook:G,crosshairSourceId:V,loadingEl:_,emptyEl:L}}var qm=require("react/jsx-runtime"),Ym=(0,Bm.forwardRef)(function(e,t){const o=(0,Bm.useRef)(null);Rp(t,{variant:"network",frameRef:o});const r=bp(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLegend:e.showLegend,showLabels:e.showLabels,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:600,height:600}),{nodes:n,edges:i,margin:s,className:a,nodeIdAccessor:l,nodeIDAccessor:c,sourceAccessor:u="source",targetAccessor:d="target",nodeLabel:h,colorBy:p,colorScheme:f,nodeSize:g=8,nodeSizeRange:m=[5,20],edgeWidth:y=1,edgeColor:b="#999",edgeOpacity:v=.6,iterations:x=300,forceStrength:k=.1,layoutExecution:w="auto",layoutLoadingContent:S,onLayoutStateChange:A,tooltip:C,frameProps:M={},onObservation:j,onClick:P,chartId:_,selection:L,linkedHover:R,loading:T,loadingContent:I,emptyContent:$,legendInteraction:N,legendPosition:F,stroke:B,strokeWidth:D,opacity:E}=e,z=l??c??"id",{width:H,height:O,enableHover:W,showLegend:q,showLabels:Y=!1,title:G,description:V,summary:X,accessibleTable:U}=r,K=Wm({nodes:n,edges:i,inferNodes:!1,nodeIdAccessor:z,sourceAccessor:u,targetAccessor:d,colorBy:p,colorScheme:f,showLegend:q,legendPosition:F,legendInteraction:N,selection:L,linkedHover:R,onObservation:j,onClick:P,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"ForceDirectedGraph",chartId:_,marginDefaults:r.marginDefaults,userMargin:s,width:H,height:O,loading:T,loadingContent:I,emptyContent:$,emptyDataKey:"nodes"}),Q=(0,Bm.useMemo)(()=>new Map,[]),Z=(0,Bm.useMemo)(()=>e=>{const t={};return t.fill=p?Oe(e.data||e,p,K.colorScale):up(void 0,K.themeCategorical,f,void 0,Q),"number"==typeof g&&(t.r=g),t},[p,K.colorScale,g,K.themeCategorical,f,Q]),J=(0,Bm.useMemo)(()=>Ip(Z,{stroke:B,strokeWidth:D,opacity:E}),[Z,B,D,E]),ee=(0,Bm.useMemo)(()=>e=>{const t=e.data||e;let o;if("number"==typeof y)o=y;else if("function"==typeof y)o=y(t);else{const e=t[y],r="number"==typeof e?e:Number(e);o=Number.isFinite(r)&&r>0?r:1}return{stroke:b,strokeWidth:o,opacity:v}},[y,b,v]),te=(0,Bm.useMemo)(()=>Ip(ee,{stroke:B,strokeWidth:D,opacity:E}),[ee,B,D,E]),oe=(0,Bm.useMemo)(()=>{if(Y&&h)return"function"==typeof h?h:e=>e.data?.[h]??e[h]??e.id},[Y,h]),re=Cp({componentName:"ForceDirectedGraph",nodes:n,edges:i,nodesRequired:!0,edgesRequired:!0,accessors:{nodeIDAccessor:z}});return re?(0,qm.jsx)(td,{componentName:"ForceDirectedGraph",message:re,width:H,height:O}):K.loadingEl?K.loadingEl:K.emptyEl?K.emptyEl:(0,qm.jsx)(sd,{componentName:"ForceDirectedGraph",width:H,height:O,children:(0,qm.jsx)(qd,{ref:o,chartType:"force",...null!=n&&{nodes:K.safeNodes},...null!=i&&{edges:K.safeEdges},size:[H,O],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:K.margin,nodeIDAccessor:z,sourceAccessor:u,targetAccessor:d,iterations:x,forceStrength:k,layoutExecution:w,layoutLoadingContent:S,onLayoutStateChange:A,nodeStyle:J,edgeStyle:te,colorBy:p,colorScheme:K.effectivePalette,nodeSize:g,nodeSizeRange:m,nodeLabel:oe,showLabels:Y,enableHover:W,tooltipContent:!1===C?()=>null:Bs(C)||void 0,...Gd({linkedHover:R,selection:L,onObservation:j,onClick:P,mobileInteraction:K.mobileInteraction,customHoverBehavior:K.customHoverBehavior,customClickBehavior:K.customClickBehavior,linkedHoverInClickPredicate:!1}),legend:K.legend,legendPosition:K.legendPosition,...N&&"none"!==N&&{legendHoverBehavior:K.legendState.onLegendHover,legendClickBehavior:K.legendState.onLegendClick,legendHighlightedCategory:K.legendState.highlightedCategory,legendIsolatedCategories:K.legendState.isolatedCategories},className:a,title:G,description:V,summary:X,accessibleTable:U,...null!=e.animate&&{animate:e.animate},...M})})});Ym.displayName="ForceDirectedGraph";var Gm=require("react"),Vm=require("react/jsx-runtime"),Xm=(0,Gm.forwardRef)(function(e,t){const o=(0,Gm.useRef)(null);Rp(t,{variant:"network",frameRef:o,overrides:{getData:()=>o.current?.getTopology()?.edges?.map(e=>e.data)??[]}});const r=bp(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLabels:e.showLabels,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:600,height:600}),{nodes:n,edges:i,margin:s,className:a,sourceAccessor:l="source",targetAccessor:c="target",valueAccessor:u="value",nodeIdAccessor:d="id",colorBy:h,colorScheme:p,edgeColorBy:f="source",padAngle:g=.01,groupWidth:m=20,sortGroups:y,nodeLabel:b,edgeOpacity:v=.5,tooltip:x,frameProps:k={},onObservation:w,onClick:S,chartId:A,selection:C,linkedHover:M,loading:j,loadingContent:P,emptyContent:_,legendInteraction:L,stroke:R,strokeWidth:T,opacity:I}=e,{width:$,height:N,enableHover:F,showLabels:B=!0,title:D,description:E,summary:z,accessibleTable:H}=r,O=Wm({nodes:n,edges:i,inferNodes:!0,nodeIdAccessor:d,sourceAccessor:l,targetAccessor:c,colorBy:h,colorScheme:p,showLegend:!1,legendInteraction:L,selection:C,linkedHover:M,onObservation:w,onClick:S,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"ChordDiagram",chartId:A,marginDefaults:r.marginDefaults,userMargin:s,width:$,height:N,loading:j,loadingContent:P,emptyContent:_}),W=(0,Gm.useMemo)(()=>new Map,[]),q=O.safeNodes.length>0,Y=(0,Gm.useMemo)(()=>{if(q)return(e,t)=>{const o={stroke:"black",strokeWidth:1};if(h)o.fill=Oe(e.data||e,h,O.colorScale);else{const r=Array.isArray(p)?p:Be[p]||De,n=Array.isArray(r)?r:De;o.fill=n[(e.index??t??0)%n.length]}return o}},[q,h,O.colorScale,p]),G=(0,Gm.useMemo)(()=>Y?Ip(Y,{stroke:R,strokeWidth:T,opacity:I}):void 0,[Y,R,T,I]),V=(0,Gm.useMemo)(()=>{if(q)return Om({edgeColorBy:f,colorBy:h,colorScale:O.colorScale,nodeStyleFn:G||(e=>({fill:up(void 0,O.themeCategorical,p,void 0,W)})),edgeOpacity:v,baseStyle:{stroke:"black",strokeWidth:.5,strokeOpacity:v}})},[q,f,h,O.colorScale,G,v,O.themeCategorical,p,W]),X=(0,Gm.useMemo)(()=>V?Ip(V,{stroke:R,strokeWidth:T,opacity:I}):void 0,[V,R,T,I]),U=(0,Gm.useMemo)(()=>{if(!B)return;const e=b||d;return"function"==typeof e?e:t=>t.data?.[e]??t[e]??t.id},[B,b,d]),K=Cp({componentName:"ChordDiagram",edges:i,edgesRequired:!0});return K?(0,Vm.jsx)(td,{componentName:"ChordDiagram",message:K,width:$,height:N}):O.loadingEl?O.loadingEl:O.emptyEl?O.emptyEl:(0,Vm.jsx)(sd,{componentName:"ChordDiagram",width:$,height:N,children:(0,Vm.jsx)(qd,{ref:o,chartType:"chord",...O.safeNodes.length>0&&{nodes:O.safeNodes},...null!=i&&{edges:O.safeEdges},size:[$,N],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:O.margin,nodeIDAccessor:d,sourceAccessor:l,targetAccessor:c,valueAccessor:u,padAngle:g,groupWidth:m,sortGroups:y,nodeStyle:G,edgeStyle:X,colorBy:h,colorScheme:O.effectivePalette,edgeColorBy:f,edgeOpacity:v,nodeLabel:U,showLabels:B,enableHover:F,tooltipContent:!1===x?()=>null:Bs(x)||void 0,...Gd({linkedHover:M,selection:C,onObservation:w,onClick:S,mobileInteraction:O.mobileInteraction,customHoverBehavior:O.customHoverBehavior,customClickBehavior:O.customClickBehavior,linkedHoverInClickPredicate:!1}),...L&&"none"!==L&&{legendHoverBehavior:O.legendState.onLegendHover,legendClickBehavior:O.legendState.onLegendClick,legendHighlightedCategory:O.legendState.highlightedCategory,legendIsolatedCategories:O.legendState.isolatedCategories},className:a,title:D,description:E,summary:z,accessibleTable:H,...null!=e.animate&&{animate:e.animate},...k})})});Xm.displayName="ChordDiagram";var Um=require("react"),Km=require("react/jsx-runtime"),Qm=(0,Um.forwardRef)(function(e,t){const o=(0,Um.useRef)(null);Rp(t,{variant:"network",frameRef:o,overrides:{getData:()=>o.current?.getTopology()?.edges?.map(e=>e.data)??[]}});const r=bp(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLabels:e.showLabels,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:800,height:600}),{nodes:n,edges:i,margin:s,className:a,sourceAccessor:l="source",targetAccessor:c="target",valueAccessor:u="value",nodeIdAccessor:d="id",colorBy:h,colorScheme:p,edgeColorBy:f="source",orientation:g="horizontal",nodeAlign:m="justify",nodePaddingRatio:y=.05,nodeWidth:b=15,nodeLabel:v,edgeOpacity:x=.5,edgeSort:k,tooltip:w,frameProps:S={},onObservation:A,onClick:C,chartId:M,selection:j,linkedHover:P,loading:_,loadingContent:L,emptyContent:R,showLegend:T,legendPosition:I,legendInteraction:$,stroke:N,strokeWidth:F,opacity:B}=e,{width:D,height:E,enableHover:z,showLabels:H=!0,title:O,description:W,summary:q,accessibleTable:Y}=r,G=Wm({nodes:n,edges:i,inferNodes:!0,nodeIdAccessor:d,sourceAccessor:l,targetAccessor:c,colorBy:h,colorScheme:p,showLegend:T,legendPosition:I,legendInteraction:$,selection:j,linkedHover:P,onObservation:A,onClick:C,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"SankeyDiagram",chartId:M,marginDefaults:r.marginDefaults,userMargin:s,width:D,height:E,loading:_,loadingContent:L,emptyContent:R}),V=(0,Um.useMemo)(()=>new Map,[]),X=(0,Um.useMemo)(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=h?Oe(e.data||e,h,G.colorScale):up(void 0,G.themeCategorical,p,void 0,V),t},[h,G.colorScale,G.themeCategorical,p,V]),U=(0,Um.useMemo)(()=>Ip(X,{stroke:N,strokeWidth:F,opacity:B}),[X,N,F,B]),K=(0,Um.useMemo)(()=>Om({edgeColorBy:f,colorBy:h,colorScale:G.colorScale,nodeStyleFn:U,edgeOpacity:x,baseStyle:{stroke:"none",strokeWidth:0}}),[f,h,G.colorScale,U,x]),Q=(0,Um.useMemo)(()=>Ip(K,{stroke:N,strokeWidth:F,opacity:B}),[K,N,F,B]),Z=(0,Um.useMemo)(()=>{if(!H)return;const e=v||d;return"function"==typeof e?e:t=>t.data?.[e]??t[e]??t.id},[H,v,d]),J=Cp({componentName:"SankeyDiagram",edges:i,edgesRequired:!0});return J?(0,Km.jsx)(td,{componentName:"SankeyDiagram",message:J,width:D,height:E}):G.loadingEl?G.loadingEl:G.emptyEl?G.emptyEl:(0,Km.jsx)(sd,{componentName:"SankeyDiagram",width:D,height:E,children:(0,Km.jsx)(qd,{ref:o,chartType:"sankey",...G.safeNodes.length>0&&{nodes:G.safeNodes},...null!=i&&{edges:G.safeEdges},size:[D,E],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:G.margin,nodeIDAccessor:d,sourceAccessor:l,targetAccessor:c,valueAccessor:u,orientation:g,nodeAlign:m,nodePaddingRatio:y,nodeWidth:b,nodeStyle:U,edgeStyle:Q,colorBy:h,colorScheme:G.effectivePalette,edgeColorBy:f,edgeOpacity:x,edgeSort:k,nodeLabel:Z,showLabels:H,enableHover:z,tooltipContent:!1===w?()=>null:Bs(w)||void 0,...Gd({linkedHover:P,selection:j,onObservation:A,onClick:C,mobileInteraction:G.mobileInteraction,customHoverBehavior:G.customHoverBehavior,customClickBehavior:G.customClickBehavior,linkedHoverInClickPredicate:!1}),legend:G.legend,legendPosition:G.legendPosition,...$&&"none"!==$&&{legendHoverBehavior:G.legendState.onLegendHover,legendClickBehavior:G.legendState.onLegendClick,legendHighlightedCategory:G.legendState.highlightedCategory,legendIsolatedCategories:G.legendState.isolatedCategories},className:a,title:O,description:W,summary:q,accessibleTable:Y,...null!=e.animate&&{animate:e.animate},...S})})});Qm.displayName="SankeyDiagram";var Zm=require("react"),Jm=require("d3-scale"),ey=require("react");function ty(e,t,o){const r=t.incoming[e.id],n=t.outgoing[e.id],i=[];for(const e of r)i.push({time:e.endTime,delta:+e.value,edge:e,kind:"in",side:o.get(e.id).targetSide});for(const e of n)i.push({time:e.startTime,delta:-e.value,edge:e,kind:"out",side:o.get(e.id).sourceSide});const s={create:0,in:1,"transfer-out":2,"transfer-in":3,out:4},a=()=>{i.sort((e,t)=>e.time-t.time||(s[e.kind]??99)-(s[t.kind]??99))},l=i.length?function(e,t=1/0){let o=t;for(const t of e)o>t&&(o=t);return o}(i.map(e=>e.time)):null,c=Array.isArray(e.xExtent)&&Number.isFinite(e.xExtent[0])?e.xExtent[0]:null,u=null!=c?c-1:null!=l&&Number.isFinite(l)?l-1:null,d=[...new Set(i.map(e=>e.time))].sort((e,t)=>e-t),h=new Map;for(let e=1;d.length>e;e++)h.set(d[e],d[e-1]);const p=e=>{const t=h.get(e);return null!=t?(t+e)/2:null!=u?u:e};a();const f=[];let g=0,m=0;for(const e of i)if("out"===e.kind){const t=Math.abs(e.delta);let o=t-("top"===e.side?g:m);if(o>0){const t="top"===e.side?"bot":"top",r=Math.min(o,"top"===t?g:m);if(r>0){const n=p(e.time);f.push({time:n,delta:-r,kind:"transfer-out",side:t}),f.push({time:n,delta:+r,kind:"transfer-in",side:e.side}),"top"===t?g-=r:m-=r,"top"===e.side?g+=r:m+=r,o-=r}o>0&&null!==u&&(f.push({time:u,delta:+o,kind:"create",side:e.side}),"top"===e.side?g+=o:m+=o)}"top"===e.side?g-=t:m-=t}else if("in"===e.kind){const t=Math.abs(e.delta);"top"===e.side?g+=t:m+=t}i.push(...f),a();let y=0,b=0,v=0,x=0,k=0;const w=[],S=new Map;for(const e of i){if(w.push({t:e.time,topMass:y,botMass:b}),("in"===e.kind||"out"===e.kind)&&e.edge){const t="top"===e.side?y:b;S.set(e.edge.id,{side:e.side,time:e.time,sideMassBefore:t,sideMassAfter:t+e.delta,kind:e.kind,value:Math.abs(e.delta)})}"top"===e.side?y+=e.delta:b+=e.delta,y+b>v&&(v=y+b),y>x&&(x=y),b>k&&(k=b),w.push({t:e.time,topMass:y,botMass:b})}const A=[];let C=0;for(;w.length>C;){let e=C;for(;w.length>e+1&&w[e+1].t===w[C].t;)e++;A.push(w[C]);for(let t=C+1;e>=t;t++){const e=A[A.length-1];w[t].topMass===e.topMass&&w[t].botMass===e.botMass||A.push(w[t])}C=e+1}const M=Array.isArray(e.xExtent)&&Number.isFinite(e.xExtent[1])?e.xExtent[1]:null;let j=null;for(const e of n)null!=e.systemInTime&&Number.isFinite(e.systemInTime)&&e.startTime>e.systemInTime&&(null===j||j>e.systemInTime)&&(j=e.systemInTime);let P=null;for(const e of r)null!=e.systemOutTime&&Number.isFinite(e.systemOutTime)&&e.systemOutTime>e.endTime&&(null===P||e.systemOutTime>P)&&(P=e.systemOutTime);if(A.length>0){const e=A[A.length-1],t=Math.max(null!=M?M:-1/0,null!=P?P:-1/0);Number.isFinite(t)&&t>e.t&&e.topMass+e.botMass>0&&A.push({t:t,topMass:e.topMass,botMass:e.botMass});const o=A[0],r=Math.min(null!=c?c:1/0,null!=j?j:1/0);Number.isFinite(r)&&o.t>r&&o.topMass+o.botMass>0&&A.unshift({t:r,topMass:o.topMass,botMass:o.botMass})}return{samples:A,peak:v,topPeak:x,botPeak:k,localAttachments:S}}function oy(e,t){return t?Math.max(t[0],Math.min(t[1],e)):e}function ry(e,t){return e.map(e=>({t:oy(e.t,t),topMass:e.topMass,botMass:e.botMass}))}function ny(e,t,o){const r=e.value*o;if("out"===e.kind){const n=e.sideMassBefore*o;if("top"===e.side){const e=t-n;return[e,e+r]}const i=t+n;return[i-r,i]}const n=e.sideMassAfter*o;if("top"===e.side){const e=t-n;return[e,e+r]}const i=t+n;return[i-r,i]}function iy(e,t){let o=0;for(let r=0;t.length>r;r++)for(let n=r+1;t.length>n;n++){const i=t[r],s=t[n];i.source!==s.source&&i.target!==s.target&&i.source!==s.target&&i.target!==s.source&&(Math.min(i.endTime,s.endTime)>Math.max(i.startTime,s.startTime)&&e[s.source]>e[i.source]!=e[s.target]>e[i.target]&&o++)}return o}function sy(e,t){let o=0;for(const r of t)o+=Math.abs(e[r.source]-e[r.target])*(r.value||1);return o}function ay(e,t){return 1e3*iy(e,t)+sy(e,t)}function ly(e,t){return{slots:e.map(e=>({peak:{...e.peak},occupants:e.occupants.slice()})),map:{...t}}}function cy(e,t,o){e.length>8||o.length>40?(function(e,t,o,r=6){const n=e.length;if(1>=n)return;let i=ly(e,t),s=ay(t,o);for(let a=0;r>a;a++){const r=Array(n).fill(0),a=Array(n).fill(0);for(const e of o){const o=t[e.source],n=t[e.target];r[o]+=n*(e.value||1),a[o]+=e.value||1,r[n]+=o*(e.value||1),a[n]+=e.value||1}const l=Array.from({length:n},(e,t)=>t).sort((e,t)=>(a[e]>0?r[e]/a[e]:e)-(a[t]>0?r[t]/a[t]:t)),c=l.map(t=>e[t]),u=new Map;l.forEach((e,t)=>u.set(e,t));for(const e of Object.keys(t))t[e]=u.get(t[e]);e.length=0;for(const t of c)e.push(t);const d=ay(t,o);if(s>d)s=d,i=ly(e,t);else if(d===s)break}!function(e,t,o){e.length=0;for(const t of o.slots)e.push(t);for(const e of Object.keys(t))delete t[e];for(const e of Object.keys(o.map))t[e]=o.map[e]}(e,t,i)}(e,t,o,6),function(e,t,o,r=6){const n=e.length;if(1>=n)return;let i=ay(t,o);for(let s=0;r>s;s++){let r=!1;for(let s=0;n-1>s;s++){const n=e[s];e[s]=e[s+1],e[s+1]=n;for(const e of Object.keys(t))t[e]===s?t[e]=s+1:t[e]===s+1&&(t[e]=s);const a=ay(t,o);if(i>a)i=a,r=!0;else{const o=e[s];e[s]=e[s+1],e[s+1]=o;for(const e of Object.keys(t))t[e]===s?t[e]=s+1:t[e]===s+1&&(t[e]=s)}}if(!r)break}}(e,t,o,6)):function(e,t,o){const r=e.length;if(1>=r)return;const n={...t},i=Object.keys(n),s=Array.from({length:r},(e,t)=>t),a=s.slice(),l={...n};let c=s.slice(),u=1/0;const d=()=>{for(const e of i)l[e]=a[n[e]];const e=ay(l,o);u>e&&(u=e,c=s.slice())},h=(e,t)=>{const o=s[e],r=s[t];s[e]=r,s[t]=o,a[o]=t,a[r]=e};d();const p=Array(r).fill(0);let f=0;for(;r>f;)f>p[f]?(h(f%2==0?0:p[f],f),d(),p[f]++,f=0):(p[f]=0,f++);const g=c.map(t=>e[t]),m=new Map;c.forEach((e,t)=>m.set(e,t));for(const e of Object.keys(t))t[e]=m.get(t[e]);e.length=0;for(const t of g)e.push(t)}(e,t,o)}function uy(e,t,o,r,n){const{plotH:i,padding:s,valueScale:a,packing:l,laneOrder:c,lifetimeMode:u="full"}=n,d={},h={};for(const t of e)d[t.id]=o[t.id].topPeak||0,h[t.id]=o[t.id].botPeak||0;const p="half"===u,f={};for(const t of e){const e=Array.isArray(t.xExtent)?t.xExtent[0]:null,o=Array.isArray(t.xExtent)?t.xExtent[1]:null;let n=null!=e&&Number.isFinite(e)?e:1/0,i=null!=o&&Number.isFinite(o)?o:-1/0;for(const e of r.outgoing[t.id]){n>e.startTime&&(n=e.startTime),null!=e.systemInTime&&Number.isFinite(e.systemInTime)&&n>e.systemInTime&&(n=e.systemInTime);const t=p?(e.startTime+e.endTime)/2:e.endTime;t>i&&(i=t)}for(const e of r.incoming[t.id]){const t=p?(e.startTime+e.endTime)/2:e.startTime;n>t&&(n=t),e.endTime>i&&(i=e.endTime),null!=e.systemOutTime&&Number.isFinite(e.systemOutTime)&&e.systemOutTime>i&&(i=e.systemOutTime)}f[t.id]={start:Number.isFinite(n)?n:null,end:Number.isFinite(i)?i:null}}const g={},m=[];if("reuse"===l){const o=new Map;for(const t of e)o.set(t.id,0);const n=new Map;for(const t of e)n.set(t.id,0);for(const e of t)n.set(e.target,(n.get(e.target)??0)+1);const i=[];for(const t of e)0===(n.get(t.id)??0)&&i.push(t.id);for(;i.length;){const e=i.shift();for(const t of r.outgoing[e]??[]){const r=(o.get(e)??0)+1;r>(o.get(t.target)??0)&&o.set(t.target,r),n.set(t.target,n.get(t.target)-1),0===n.get(t.target)&&i.push(t.target)}}const s=[...e].filter(e=>null!==f[e.id].start).sort((e,t)=>{const r=o.get(e.id)??0,n=o.get(t.id)??0;return r!==n?r-n:f[e.id].start-f[t.id].start}),a=e.filter(e=>null===f[e.id].start);for(const e of[...s,...a]){const t=f[e.id];let o=-1;for(let e=0;m.length>e;e++){const r=m[e].occupants[m[e].occupants.length-1];if(null===t.start||void 0===r||t.start>=r.end){o=e;break}}-1===o&&(m.push({occupants:[],peak:{topPeak:0,botPeak:0}}),o=m.length-1),m[o].occupants.push({id:e.id,end:t?.end??-1/0}),m[o].peak.topPeak=Math.max(m[o].peak.topPeak,d[e.id]),m[o].peak.botPeak=Math.max(m[o].peak.botPeak,h[e.id]),g[e.id]=o}}else e.forEach((e,t)=>{m.push({occupants:[{id:e.id,end:f[e.id]?.end??-1/0}],peak:{topPeak:d[e.id],botPeak:h[e.id]}}),g[e.id]=t});let y=null,b=null,v=null,x=null;const k=()=>{y=iy(g,t),v=sy(g,t)},w=()=>{b=iy(g,t),x=sy(g,t)};"crossing-min"===c?(k(),cy(m,g,t),w()):"inside-out"===c?(k(),function(e,t){const o=e.length;if(1>=o)return;const r=e=>e.peak.topPeak+e.peak.botPeak,n=e.map((e,t)=>({slot:e,idx:t})).sort((e,t)=>r(t.slot)-r(e.slot)),i=Array(o),s=Math.floor((o-1)/2);i[s]=n[0].idx;let a=s-1,l=s+1;for(let e=1;n.length>e;e++)e%2==1&&o>l||0>a?i[l++]=n[e].idx:i[a--]=n[e].idx;const c=i.map(t=>e[t]),u=new Map;i.forEach((e,t)=>u.set(e,t));for(const e of Object.keys(t))t[e]=u.get(t[e]);e.length=0;for(const t of c)e.push(t)}(m,g),w()):"crossing-min+inside-out"===c&&(k(),cy(m,g,t),function(e,t,o){const r=e.length;if(1>=r)return;const n=e.map(e=>{return{slot:e,size:(t=e,t.peak.topPeak+t.peak.botPeak)};var t}).sort((e,t)=>t.size-e.size),i=Math.floor((r-1)/2);let s=ay(t,o);for(const{slot:a}of n){const n=e.indexOf(a);if(0>n)continue;const l=i;if(n===l)continue;const c=e[n];e.splice(n,1),e.splice(l,0,c);const u=new Map;for(let e=0;r>e;e++)u.set(e,e);if(l>n){for(let e=n+1;l>=e;e++)u.set(e,e-1);u.set(n,l)}else{for(let e=l;n>e;e++)u.set(e,e+1);u.set(n,l)}for(const e of Object.keys(t))t[e]=u.get(t[e]);const d=ay(t,o);if(d>s){const o=e[l];e.splice(l,1),e.splice(n,0,o);const i=new Map;for(let e=0;r>e;e++)i.set(e,e);if(n>l){for(let e=l+1;n>=e;e++)i.set(e,e-1);i.set(l,n)}else{for(let e=n;l>e;e++)i.set(e,e+1);i.set(l,n)}for(const e of Object.keys(t))t[e]=i.get(t[e])}else s=d}}(m,g,t),w());const S=m.map(e=>{const t=new Map;for(const r of e.occupants){const e=o[r.id];if(e)for(const o of e.samples){const e=t.get(o.t)||{top:0,bot:0};t.set(o.t,{top:Math.max(e.top,o.topMass),bot:Math.max(e.bot,o.botMass)})}}return[...t.entries()].sort((e,t)=>e[0]-t[0])}),A=(e,t)=>{let o={top:0,bot:0};for(const[r,n]of e){if(r>t)break;o=n}return o},C=[];for(let e=0;m.length-1>e;e++){const t=S[e],o=S[e+1],r=new Set([...t.map(e=>e[0]),...o.map(e=>e[0])]);let n=0;for(const e of r){const r=A(t,e),i=A(o,e);r.bot+i.top>n&&(n=r.bot+i.top)}C.push(n)}const M=[];let j=s+(m[0]?.peak.topPeak??0)*a;m.length>0&&M.push(j);for(let e=1;m.length>e;e++)j+=C[e-1]*a+s,M.push(j);if(m.length>0&&(j+=m[m.length-1].peak.botPeak*a+s),j>i){const e=i/j;for(let t=0;M.length>t;t++)M[t]*=e}const P=0===m.length?0:m[0].peak.topPeak+C.reduce((e,t)=>e+t,0)+m[m.length-1].peak.botPeak,_={};for(const t of e)_[t.id]=M[g[t.id]];return{effectiveSlotsHeight:P,centerlines:_,laneLifetime:f,slots:m,slotByNode:g,slotCenter:M,crossingsBefore:y,crossingsAfter:b,lengthBefore:v,lengthAfter:x}}h();var dy=e=>{const{bands:t=[],ribbons:o=[],showLabels:r=!0}=e.config,n=[];for(const e of o)n.push({type:"bezier",pathD:e.pathD,...e.bezier&&{bezierCache:e.bezier},style:{fill:e.fill,opacity:e.opacity,stroke:"none"},datum:{__kind:"ribbon",data:e.rawDatum,id:e.id}});for(const e of t)if(e.gradientStubs)for(let t=0;e.gradientStubs.length>t;t++){const o=e.gradientStubs[t];n.push({type:"bezier",pathD:o.pathD,interactive:!1,style:{fill:e.fill,fillOpacity:.86,stroke:"none"},_gradient:{x0:o.x0,x1:o.x1,from:o.from,to:o.to},datum:{__kind:"band",data:e.rawDatum,id:`${e.id}__stub${t}`}})}for(const e of t)n.push({type:"bezier",pathD:e.pathD,style:{...e.gradientStubs&&e.gradientStubs.length>0?{fill:"none"}:{fill:e.fill,fillOpacity:.86},stroke:e.stroke??e.fill,strokeWidth:e.strokeWidth??.5},datum:{__kind:"band",data:e.rawDatum,id:e.id}});const i=r?t.map(e=>({x:e.labelX,y:e.labelY,text:e.labelText,anchor:"end",baseline:"middle",fontSize:11,fontWeight:600})):[];return{sceneNodes:t.map(e=>({type:"circle",id:e.id,cx:-1e4,cy:-1e4,r:0,style:{fill:e.fill},datum:{__kind:"band",data:e.rawDatum,id:e.id}})),sceneEdges:n,labels:i}};function hy(e){return"object"==typeof e&&null!==e&&"__kind"in e&&("band"===e.__kind||"ribbon"===e.__kind)}var py=require("react/jsx-runtime");function fy(e){return null==e?NaN:e instanceof Date?e.getTime():"number"==typeof e?e:new Date(e).getTime()}function gy(e,t){return"function"==typeof e?e(t):t[e]}var my=(0,ey.forwardRef)(function(e,t){const{nodes:o,edges:r,domain:n,axisTicks:i=[],nodeIdAccessor:s="id",sourceAccessor:a="source",targetAccessor:l="target",valueAccessor:c="value",startTimeAccessor:u="startTime",endTimeAccessor:d="endTime",systemInTimeAccessor:h,systemOutTimeAccessor:p,xExtentAccessor:f="xExtent",edgeIdAccessor:g="id",colorBy:m,colorScheme:y,showLegend:b,legendPosition:v="right",pairing:x="temporal",packing:k="reuse",laneOrder:w="crossing-min",ribbonLane:S="both",lifetimeMode:A="half",showLaneRails:C=!1,showQualityReadout:M=!1,showLabels:j=!0,width:P=600,height:_=400,margin:L,title:R,description:T,summary:I,accessibleTable:$,responsiveWidth:N,responsiveHeight:F,loading:B,loadingContent:D,emptyContent:E,edgeOpacity:H=.35,timeFormat:O,valueFormat:W,tooltip:q,enableHover:Y=!0,onObservation:G,onClick:V,showParticles:X=!1,particleStyle:U,chartId:K,frameProps:Q={}}=e,[Z,J]=(0,Zm.useState)([]),[ee,te]=(0,Zm.useState)([]),oe=(0,Zm.useRef)(Z),re=(0,Zm.useRef)(ee);oe.current=Z,re.current=ee;const ne=(0,Zm.useCallback)(e=>{oe.current=e,J(e)},[]),ie=(0,Zm.useCallback)(e=>{re.current=e,te(e)},[]),se=void 0!==r,ae=z(se?r:Z),le=(0,Zm.useMemo)(()=>{const e=z(o??[]),t=ee;if(0===e.length&&0===t.length)return zm([],ae,a,l);const r=new Set,n=[];for(const t of e){const e=gy(s,t)+"";r.has(e)||(r.add(e),n.push(t))}for(const e of t){const t=gy(s,e)+"";r.has(t)||(r.add(t),n.push(e))}const i=zm([],ae,a,l);for(const e of i)r.has(e.id)||(r.add(e.id),n.push(e));return n},[o,ee,ae,s,a,l]),ce=(0,Zm.useRef)(null),ue=(0,Zm.useCallback)((e,t)=>{const o=gy(g,e);return null!=o?o+"":`${gy(a,e)}-${gy(l,e)}-${t}`},[g,a,l]),de=(0,Zm.useCallback)(e=>{if(null==e)return!1;const t=e;return null!=gy(a,t)&&null!=gy(l,t)},[a,l]);Rp(t,{variant:"network",frameRef:ce,overrides:{push(e){if(de(e)){if(se)return void console.warn("ProcessSankey.push: edge ignored — `edges` prop is controlled.");ne([...oe.current,e])}else ie([...re.current,e])},pushMany(e){const t=[],o=[];for(const r of e)de(r)?t.push(r):o.push(r);t.length>0&&(se?console.warn("ProcessSankey.pushMany: edges ignored — `edges` prop is controlled."):ne([...oe.current,...t])),o.length>0&&ie([...re.current,...o])},remove(e){const t=new Set(Array.isArray(e)?e:[e]),o=[];if(!se){const e=oe.current,r=[];for(let n=0;e.length>n;n++){const i=e[n];t.has(ue(i,n))?o.push(i):r.push(i)}r.length!==e.length&&ne(r)}const r=re.current,n=[];for(const e of r){const r=gy(s,e)+"";t.has(r)?o.push(e):n.push(e)}return n.length!==r.length&&ie(n),o},update(e,t){const o=new Set(Array.isArray(e)?e:[e]),r=[];if(!se){let e=!1;const n=oe.current.map((n,i)=>o.has(ue(n,i))?(r.push(n),e=!0,t(n)):n);e&&ne(n)}let n=!1;const i=re.current.map(e=>{const i=gy(s,e)+"";return o.has(i)?(r.push(e),n=!0,t(e)):e});return n&&ie(i),r},clear(){se||ne([]),ie([]),ce.current?.clear()},getData:()=>ae??[],getScales:()=>null},deps:[se,de,ue,s,ae,ne,ie]});const he=ue,pe=(0,Zm.useCallback)(e=>gy(s,e)+"",[s]),{nodes:fe,edges:ge,domain:me,rawNodeById:ye,rawEdgeById:be}=(0,Zm.useMemo)(()=>{const e=(le??[]).map(e=>{const t={id:pe(e),__raw:e},o=f?gy(f,e):null;if(Array.isArray(o)&&2===o.length){const e=fy(o[0]),r=fy(o[1]);Number.isFinite(e)&&Number.isFinite(r)&&(t.xExtent=[e,r])}return t}),t=(ae??[]).map((e,t)=>{const o={id:he(e,t),source:gy(a,e)+"",target:gy(l,e)+"",value:Number(gy(c,e)),startTime:fy(gy(u,e)),endTime:fy(gy(d,e)),__raw:e};if(h){const t=fy(gy(h,e));Number.isFinite(t)&&(o.systemInTime=t)}if(p){const t=fy(gy(p,e));Number.isFinite(t)&&(o.systemOutTime=t)}return o}),o=[fy(n[0]),fy(n[1])],r=new Map;for(const t of e)null!=t.__raw&&r.set(t.id,t.__raw);const i=new Map;for(const e of t)null!=e.__raw&&i.set(e.id,e.__raw);return{nodes:e,edges:t,domain:o,rawNodeById:r,rawEdgeById:i}},[le,ae,n,pe,he,f,a,l,c,u,d,h,p]),ve=Wm({nodes:le,edges:ae,inferNodes:!1,nodeIdAccessor:s,sourceAccessor:a,targetAccessor:l,colorBy:m,colorScheme:y,showLegend:!1,legendPosition:v,selection:void 0,linkedHover:void 0,onObservation:G,onClick:V,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,chartType:"ProcessSankey",chartId:K,marginDefaults:{top:30,right:80,bottom:40,left:80},userMargin:L,width:P,height:_,loading:B,loadingContent:D,emptyContent:E}),xe=(b??!!m)&&!!m,ke=(0,Zm.useCallback)(e=>null!=L&&("number"==typeof L||null!=L[e]),[L]),we=(0,Zm.useMemo)(()=>{const e={...ve.margin};return xe&&("right"===v&&!ke("right")&&140>e.right?e.right=140:"bottom"===v&&!ke("bottom")&&80>e.bottom&&(e.bottom=80)),e},[ve.margin,xe,v,ke]),Se=P-we.left-we.right,Ae=_-we.top-we.bottom,Ce=(0,Zm.useMemo)(()=>function(e,t,o){const r=[],n=new Set(e.map(e=>e.id)),i=Array.isArray(o)&&2===o.length,s=i&&Number.isFinite(o[0])&&Number.isFinite(o[1]);i&&s&&s&&o[1]>=o[0]||r.push({kind:"invalid-domain"});for(const t of e)null!=t.xExtent&&(Array.isArray(t.xExtent)&&2===t.xExtent.length&&Number.isFinite(t.xExtent[0])&&Number.isFinite(t.xExtent[1])&&t.xExtent[1]>=t.xExtent[0]||r.push({kind:"invalid-node-time",id:t.id}));for(const e of t)n.has(e.source)||r.push({kind:"missing-node",id:e.id,endpoint:"source",nodeId:e.source}),n.has(e.target)||r.push({kind:"missing-node",id:e.id,endpoint:"target",nodeId:e.target}),Number.isFinite(e.startTime)&&Number.isFinite(e.endTime)?(Number.isFinite(e.value)&&e.value>0||r.push({kind:"invalid-value",id:e.id}),e.endTime>e.startTime||r.push({kind:"backward-edge",id:e.id,source:e.source,target:e.target})):r.push({kind:"invalid-edge-time",id:e.id});return r}(fe,ge,me),[fe,ge,me]),Me=(0,Zm.useMemo)(()=>Ce.length>0?null:function(e,t,o){const{plotH:r,pairing:n="temporal",packing:i="reuse",laneOrder:s="crossing-min",lifetimeMode:a="half"}=o,l=function(e,t){const o={},r={};for(const t of e)o[t.id]=[],r[t.id]=[];for(const e of t)r[e.source]&&r[e.source].push(e),o[e.target]&&o[e.target].push(e);return{incoming:o,outgoing:r}}(e,t),c=function(e,t,o,r="value"){const n="temporal"===r?(e,t)=>e.endTime-t.endTime:(e,t)=>t.value-e.value,i="temporal"===r?(e,t)=>e.startTime-t.startTime:(e,t)=>t.value-e.value,s=new Map;for(const e of t)s.set(e.id,{});const a=(e,t)=>{const o=new Map;for(const r of e){const e=r[t];o.has(e)||o.set(e,{partner:e,edges:[],total:0,earliestStart:1/0,latestEnd:-1/0});const n=o.get(e);n.edges.push(r),n.total+=r.value,n.earliestStart=Math.min(n.earliestStart,r.startTime),n.latestEnd=Math.max(n.latestEnd,r.endTime)}const s=[...o.values()];s.sort("temporal"===r?(e,o)=>"target"===t?e.earliestStart-o.earliestStart:e.latestEnd-o.latestEnd:(e,t)=>t.total-e.total);for(const e of s)e.edges.sort("target"===t?i:n);return s};for(const t of e){const e=o.outgoing[t.id],r=o.incoming[t.id];if(0===r.length)a(e,"target").forEach((e,t)=>{const o=t%2==0?"top":"bot";for(const t of e.edges)s.get(t.id).sourceSide=o});else if(0===e.length)a(r,"source").forEach((e,t)=>{const o=t%2==0?"top":"bot";for(const t of e.edges)s.get(t.id).targetSide=o});else{const t=a(r,"source"),o=a(e,"target"),n=Math.max(t.length,o.length);for(let e=0;n>e;e++){const r=e%2==0?"top":"bot";if(t[e])for(const o of t[e].edges)s.get(o.id).targetSide=r;if(o[e])for(const t of o[e].edges)s.get(t.id).sourceSide=r}}}return s}(e,t,l,n);let u={};for(const t of e)u[t.id]=ty(t,l,c);const d=uy(e,t,u,l,{plotH:r,padding:12,valueScale:1,packing:i,laneOrder:s,lifetimeMode:a}),h=new Set;for(const e of t){const t=d.slotByNode[e.source],o=d.slotByNode[e.target];if(void 0===t||void 0===o)continue;const r=c.get(e.id);t!==o?t>o?(r.sourceSide="top",r.targetSide="bot"):(r.sourceSide="bot",r.targetSide="top"):(h.add(e.id),r.sourceSide="bot",r.targetSide="bot")}for(const t of e){const e=l.outgoing[t.id],o=l.incoming[t.id],r=new Set(e.map(e=>c.get(e.id).sourceSide)),n=new Set(o.map(e=>c.get(e.id).targetSide));if(1===r.size&&o.length>0){const e=[...r][0];for(const t of o)d.slotByNode[t.source]===d.slotByNode[t.target]&&(c.get(t.id).targetSide=e)}if(1===n.size&&e.length>0){const t=[...n][0];for(const o of e)d.slotByNode[o.source]===d.slotByNode[o.target]&&(c.get(o.id).sourceSide=t)}}for(const t of e){const e=l.incoming[t.id],o=l.outgoing[t.id];if(0===e.length||0===o.length)continue;const r=()=>{const t={inTop:0,inBot:0,outTop:0,outBot:0};for(const o of e)"top"===c.get(o.id).targetSide?t.inTop+=o.value:t.inBot+=o.value;for(const e of o)"top"===c.get(e.id).sourceSide?t.outTop+=e.value:t.outBot+=e.value;return t},n=(e,t)=>{const n=r(),i="top"===e?n.outTop-n.inTop:n.outBot-n.inBot,s="top"===t?n.inTop-n.outTop:n.inBot-n.outBot;if(0>=i||0>=s)return!1;const a=Math.min(i,s),l=o.filter(t=>!h.has(t.id)&&c.get(t.id).sourceSide===e&&a>=t.value).sort((e,t)=>t.value-e.value);return 0!==l.length&&(c.get(l[0].id).sourceSide=t,!0)};let i=o.length+1;for(;i-- >0&&(n("top","bot")||n("bot","top")););}u={};for(const t of e)u[t.id]=ty(t,l,c);const p=uy(e,t,u,l,{plotH:r,padding:12,valueScale:1,packing:i,laneOrder:s,lifetimeMode:a}),f=p.effectiveSlotsHeight??p.slots.reduce((e,t)=>e+t.peak.topPeak+t.peak.botPeak,0),g=Math.min(12,.35*r/Math.max(p.slots.length+1,1)),m=f>0?Math.max(0,(r-g*(p.slots.length+1))/f):1,y=uy(e,t,u,l,{plotH:r,padding:g,valueScale:m,packing:i,laneOrder:s,lifetimeMode:a});return{nodeData:u,sides:c,valueScale:m,padding:g,compressedPadding:12>g,centerlines:y.centerlines,laneLifetime:y.laneLifetime,slots:y.slots,slotByNode:y.slotByNode,crossingsBefore:y.crossingsBefore,crossingsAfter:y.crossingsAfter,lengthBefore:y.lengthBefore,lengthAfter:y.lengthAfter}}(fe,ge,{plotH:Ae,pairing:x,packing:k,laneOrder:w,lifetimeMode:A}),[Ce,fe,ge,Ae,x,k,w,A]),je=(0,Zm.useMemo)(()=>(0,Jm.scaleTime)().domain(me).range([0,Se]),[me,Se]),Pe=(0,Zm.useCallback)((e,t)=>{if(m&&le){const t=ye.get(e);if(t)return Oe(t,m,ve.colorScale)}return ve.effectivePalette[t%ve.effectivePalette.length]||"#475569"},[m,le,ye,ve.colorScale,ve.effectivePalette]),_e=(0,Zm.useMemo)(()=>{const e=new Map;return fe.forEach((t,o)=>e.set(t.id,o)),e},[fe]),Le=(0,Zm.useMemo)(()=>{if(!Me)return{bands:[],ribbons:[]};const{centerlines:e,nodeData:t,valueScale:o}=Me,r=[],n=[];return fe.forEach((n,i)=>{const s=t[n.id];if(!s||0===s.samples.length)return;const a=function(e,t,o,r,n){if(0===e.length)return null;const i=ry(e,n),s=e=>t-i[e].topMass*o,a=e=>t+i[e].botMass*o;let l=`M${r(i[0].t)},${s(0)}`;for(let e=1;i.length>e;e++)l+=` L${r(i[e].t)},${s(e)}`;l+=` L${r(i[i.length-1].t)},${a(i.length-1)}`;for(let e=i.length-2;e>=0;e--)l+=` L${r(i[e].t)},${a(e)}`;return l+" Z"}(s.samples,e[n.id],o,je,me);if(!a)return;const l=ry(s.samples,me),c=l.find(e=>e.topMass+e.botMass>0)||l[0],u=e[n.id]+(c.botMass-c.topMass)*o/2,d=Pe(n.id,i),h=ye.get(n.id)??n,p=function(e,t,o,r,n){const i=o.nodeData[e];if(!i||0===i.samples.length)return[];const s=o.valueScale,a=o.centerlines[e],l=ry(i.samples,n),c=l.find(e=>e.topMass+e.botMass>0)||l[0],u=[...l].reverse().find(e=>e.topMass+e.botMass>0)||l[l.length-1],d=r(c.t),h=r(u.t),p=e=>r(oy(e,n)),f=[],g=(e,t,o,r)=>`M${e},${t} L${o},${t} L${o},${r} L${e},${r} Z`;for(const o of t){if(o.source===e&&null!=o.systemInTime&&Number.isFinite(o.systemInTime)){const e=i.localAttachments.get(o.id);if(e&&"out"===e.kind&&o.startTime>o.systemInTime){const t=p(o.systemInTime),r=p(o.startTime),n=t-20,i=Math.max(d,n);if(r>i){const[o,l]=ny(e,a,s);f.push({pathD:g(i,o,r,l),x0:n,x1:t,from:0,to:1})}}}if(o.target===e&&null!=o.systemOutTime&&Number.isFinite(o.systemOutTime)){const e=i.localAttachments.get(o.id);if(e&&"in"===e.kind&&o.systemOutTime>o.endTime){const t=p(o.systemOutTime),r=p(o.endTime),n=t+20,i=Math.min(h,n);if(i>r){const[o,l]=ny(e,a,s);f.push({pathD:g(r,o,i,l),x0:t,x1:n,from:1,to:0})}}}}return f}(n.id,ge,Me,je,me);r.push({id:n.id,pathD:a,fill:d,stroke:d,strokeWidth:.5,...p.length>0&&{gradientStubs:p},rawDatum:h,labelX:je(c.t)-4,labelY:u,labelText:n.id})}),ge.forEach(r=>{const i=t[r.source]?.localAttachments.get(r.id),s=t[r.target]?.localAttachments.get(r.id);if(!i||!s)return;const a=_e.get(r.source)??0,l=Pe(r.source,a),c=function(e,t,o,r,n,i,s,a){const l=n,c=e=>a?Math.max(a[0],Math.min(a[1],e)):e,u=i(c(e.time)),d=i(c(o.time)),h=e.value*l,p=o.value*l,f=e.sideMassBefore*l,g=o.sideMassAfter*l;let m,y,b,v;"top"===e.side?(m=t-f,y=m+h):(y=t+f,m=y-h),"top"===o.side?(b=r-g,v=b+p):(v=r+g,b=v-p);const x="source"===s?u+.85*(d-u):"target"===s?u+.15*(d-u):(u+d)/2;return{sx:u,sTop:m,sBot:y,tx:d,tTop:b,tBot:v,cp1X:x,cp2X:x}}(i,e[r.source],s,e[r.target],o,je,S,me),{pathD:u,bezier:d}=tu(c),h=be.get(r.id)??r;n.push({id:r.id,pathD:u,fill:l,opacity:H,rawDatum:h,bezier:d})}),{bands:r,ribbons:n}},[Me,fe,ge,je,me,Pe,ye,be,S,H,_e]),Re=(0,Zm.useMemo)(()=>({bands:Le.bands,ribbons:Le.ribbons,showLabels:j}),[Le,j]),Te=(0,Zm.useMemo)(()=>{if(!xe||!m)return;const e=new Map;(le??[]).forEach((t,o)=>{const r=gy(m,t),n=null==r?"":r+"";n&&!e.has(n)&&e.set(n,{label:n,color:Pe(pe(t),o)})});const t=Array.from(e.values());return 0!==t.length?{legendGroups:[{type:"fill",label:"",items:t,styleFn:e=>{const t=e.color||"#333";return{fill:t,stroke:t}}}]}:void 0},[xe,m,le,Pe,pe]),Ie=(0,Zm.useMemo)(()=>!1!==q&&Y?void 0===q||!0===q?null:Bs(q)||null:null,[q,Y]),$e=(0,Zm.useCallback)(e=>O?O(new Date(e)):Number.isFinite(e)?1e10>Math.abs(e)?Number.isInteger(e)?e+"":e.toFixed(2):new Date(e).toISOString().slice(0,10):"",[O]),Ne=(0,Zm.useCallback)(e=>W?W(e):e+"",[W]),Fe=(0,Zm.useCallback)(e=>{if(!e||!e.data)return null;const t=e.data;if(!hy(t))return null;const o=t.data;if(Ie)return Ie(o);if("band"===t.__kind){const e=t.id,o=Me?function(e){if(!e)return[];const t=new Set,o=[];for(const r of e.samples){const e=r.topMass+r.botMass,n=`${r.t}:${e}`;t.has(n)||(t.add(n),o.push({t:r.t,total:e}))}return o}(Me.nodeData[e]):[],r=5,n=o.length>r?o.length:null,i=function(e,t=5){if(t>=e.length)return e.slice();const o=[...e].sort((e,t)=>e.total-t.total),r=o.length-1,n=[{...o[0],mark:"min"},{...o[Math.floor(.25*r)],mark:"q25"},{...o[Math.floor(.5*r)],mark:"median"},{...o[Math.floor(.75*r)],mark:"q75"},{...o[r],mark:"max"}],i=new Set,s=[];for(const e of n)i.has(e.t)||(i.add(e.t),s.push(e));return s.sort((e,t)=>e.t-t.t)}(o,r);return(0,py.jsxs)("div",{style:{minWidth:160},children:[(0,py.jsx)("div",{style:{fontWeight:600,marginBottom:4},children:e}),i.length>0&&(0,py.jsxs)("table",{style:{borderCollapse:"collapse",fontSize:11,width:"100%"},children:[(0,py.jsx)("thead",{children:(0,py.jsxs)("tr",{style:{opacity:.6},children:[(0,py.jsx)("th",{style:{textAlign:"left",fontWeight:500,paddingRight:8},children:"Time"}),(0,py.jsx)("th",{style:{textAlign:"right",fontWeight:500},children:"Mass"}),null!=n&&(0,py.jsx)("th",{})]})}),(0,py.jsx)("tbody",{children:i.map((e,t)=>(0,py.jsxs)("tr",{children:[(0,py.jsx)("td",{style:{paddingRight:8},children:$e(e.t)}),(0,py.jsx)("td",{style:{textAlign:"right"},children:Ne(e.total)}),null!=n&&(0,py.jsx)("td",{style:{textAlign:"right",paddingLeft:8,opacity:.55},children:e.mark})]},t))})]}),null!=n&&(0,py.jsxs)("div",{style:{marginTop:4,fontSize:10,opacity:.55},children:["showing ",i.length," of ",n," samples"]})]})}const r=o,n=gy(a,r),i=gy(l,r),s=gy(c,r),h=gy(u,r),p=gy(d,r);return(0,py.jsxs)("div",{style:{minWidth:160},children:[(0,py.jsxs)("div",{style:{fontWeight:600,marginBottom:4},children:[n+""," → ",i+""]}),(0,py.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"auto 1fr",columnGap:8,fontSize:11},children:[null!=s&&(0,py.jsxs)(py.Fragment,{children:[(0,py.jsx)("span",{style:{opacity:.6},children:"value"}),(0,py.jsx)("span",{style:{textAlign:"right"},children:Ne(Number(s))})]}),null!=h&&(0,py.jsxs)(py.Fragment,{children:[(0,py.jsx)("span",{style:{opacity:.6},children:"start"}),(0,py.jsx)("span",{style:{textAlign:"right"},children:$e(fy(h))})]}),null!=p&&(0,py.jsxs)(py.Fragment,{children:[(0,py.jsx)("span",{style:{opacity:.6},children:"end"}),(0,py.jsx)("span",{style:{textAlign:"right"},children:$e(fy(p))})]})]})]})},[Me,Ie,$e,Ne,a,l,c,u,d]),Be=(0,Zm.useMemo)(()=>{if(!Me)return null;const{centerlines:e,laneLifetime:t,nodeData:o,valueScale:r,compressedPadding:n,crossingsBefore:s,crossingsAfter:a,lengthBefore:l,lengthAfter:c}=Me;let u=null,d=null;for(const e of fe){const o=t[e.id];if(!o||null===o.start||null===o.end)continue;const r=je(o.start),n=je(o.end);(null===u||u>r)&&(u=r),(null===d||n>d)&&(d=n)}const h=e=>Math.max(0,Math.min(Se,e)),p=h(u??0),f=Math.max(p,h(d??Se));return(0,py.jsxs)("g",{children:[M&&null!==(a??null)&&(0,py.jsxs)("text",{x:Se,y:-12,fontSize:10,fill:"#94a3b8",textAnchor:"end",children:["crossings: ",s," → ",a," ","edge length: ",Math.round(l)," → ",Math.round(c)]}),n&&(0,py.jsx)("text",{x:Se,y:2,fontSize:10,fill:"#94a3b8",textAnchor:"end",children:"dense layout: lane gaps compressed"}),i.map((e,t)=>{const o=je(fy(e.date));return p-.5>o||o>f+.5?null:(0,py.jsx)("line",{x1:o,y1:0,x2:o,y2:Ae,stroke:"#94a3b8",strokeOpacity:.15,strokeDasharray:"2 4"},"grid-"+t)}),C&&fe.map((n,i)=>{const s=t[n.id];if(!s||null===s.start)return null;const a=o[n.id],l=a?{topPeak:a.topPeak,botPeak:a.botPeak}:{topPeak:0,botPeak:0},c=e[n.id]+(l.botPeak-l.topPeak)*r/2,u=je(s.start),d=je(s.end),h=Pe(n.id,i);return(0,py.jsxs)("g",{children:[(0,py.jsx)("line",{x1:u,y1:c,x2:d,y2:c,stroke:h,strokeOpacity:.35,strokeWidth:1,strokeDasharray:"3 3"}),(0,py.jsx)("line",{x1:u,y1:c-4,x2:u,y2:c+4,stroke:h,strokeOpacity:.5}),(0,py.jsx)("line",{x1:d,y1:c-4,x2:d,y2:c+4,stroke:h,strokeOpacity:.5})]},"lane-"+n.id)}),(0,py.jsx)("line",{x1:p,y1:Ae+4,x2:f,y2:Ae+4,stroke:"#94a3b8"}),i.map((e,t)=>{const o=fy(e.date),r=je(o);if(p-.5>r||r>f+.5)return null;const n=null!=e.label?e.label:O?O(new Date(o)):"";return(0,py.jsxs)("g",{transform:`translate(${r},${Ae+4})`,children:[(0,py.jsx)("line",{y2:6,stroke:"#94a3b8"}),(0,py.jsx)("text",{y:20,textAnchor:"middle",fontSize:11,fill:"#475569",children:n})]},t)})]})},[Me,i,je,Se,Ae,C,fe,Pe,M,O]),De=(0,Zm.useMemo)(()=>(le??[]).map(e=>({id:pe(e),data:e})),[le,pe]),Ee=(0,Zm.useMemo)(()=>{const e=new Map;for(const t of Le.ribbons)t.bezier&&e.set(t.id,t.bezier);return e},[Le]),ze=(0,Zm.useMemo)(()=>(ae??[]).map((e,t)=>{const o=he(e,t),r=Number(gy(c,e));return{id:o,source:gy(a,e)+"",target:gy(l,e)+"",value:Number.isFinite(r)?r:0,bezier:Ee.get(o),data:e}}),[ae,he,a,l,c,Ee]),He=ve.loadingEl,We=ve.emptyEl;return Ce.length>0?(0,py.jsxs)("svg",{width:P,height:_,role:"img","aria-label":R??"Process Sankey validation failed",children:[(0,py.jsx)("text",{x:20,y:30,fontSize:13,fontWeight:600,fill:"var(--semiotic-danger, #dc2626)",children:"ProcessSankey: data invalid"}),Ce.map((e,t)=>{return(0,py.jsx)("text",{x:20,y:56+18*t,fontSize:12,fill:"#64748b",children:"• "+(o=e,"invalid-node-time"===o.kind?`node ${o.id} has an invalid xExtent (must be [start, end] with start <= end)`:"invalid-edge-time"===o.kind?`edge ${o.id} has an invalid startTime or endTime`:"invalid-domain"===o.kind?"time domain must be a 2-tuple of finite times [start, end] with start <= end":"invalid-value"===o.kind?`edge ${o.id} must have a positive finite value`:"missing-node"===o.kind?`edge ${o.id} references missing ${o.endpoint} node "${o.nodeId}"`:"backward-edge"===o.kind?`edge ${o.id} (${o.source}->${o.target}) ends before it starts`:o.kind)},t);var o})]}):He||We||(0,py.jsx)(qd,{ref:ce,chartType:"force",nodes:De,edges:ze,customNetworkLayout:dy,layoutConfig:Re,size:[P,_],responsiveWidth:N,responsiveHeight:F,margin:we,title:R,description:T??"Temporal process flow with lifetime-bounded node lanes, mass bands, and value-scaled ribbons.",summary:I,accessibleTable:$,enableHover:Y,tooltipContent:!1===q?()=>null:Fe,backgroundGraphics:Be,showParticles:X,particleStyle:U,legend:Te,legendPosition:v,onObservation:G,...V&&{customClickBehavior:e=>{if(!e||!e.data||!V)return;const t=e.data;hy(t)&&V(t.data,{x:e.x,y:e.y})}},chartId:K,colorScheme:Array.isArray(y)?y:void 0,...Q})});my.displayName="ProcessSankey";var yy=require("react"),by=require("react/jsx-runtime");function vy(e){const t=bp(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLabels:e.showLabels,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:600,height:600}),{data:o,margin:r,className:n,layout:i="tree",orientation:s="vertical",childrenAccessor:a="children",valueAccessor:l="value",nodeIdAccessor:c="name",colorBy:u,colorScheme:d,colorByDepth:h=!1,edgeStyle:p="curve",nodeLabel:f,nodeSize:g=5,tooltip:m,frameProps:y={},onObservation:b,onClick:v,chartId:x,selection:k,linkedHover:w,loading:S,loadingContent:A,legendInteraction:C,stroke:M,strokeWidth:j,opacity:P}=e,{width:_,height:L,enableHover:R,showLabels:T=!0,title:I,description:$,summary:N,accessibleTable:F}=t,B=Wm({nodes:(0,yy.useMemo)(()=>Em(o??null,a),[o,a]),edges:void 0,inferNodes:!1,colorBy:h?void 0:u,colorScheme:d,showLegend:!1,legendInteraction:C,selection:k,linkedHover:w,onObservation:b,onClick:v,mobileInteraction:t.mobileInteraction,mobileSemantics:t.mobileSemantics,chartType:"TreeDiagram",chartId:x,marginDefaults:t.marginDefaults,userMargin:r,width:_,height:L,loading:S,loadingContent:A}),D=(0,yy.useMemo)(()=>new Map,[]),E=(0,yy.useMemo)(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=h?ze[(e.depth||0)%ze.length]:u?Oe(e.data||e,u,B.colorScale):up(void 0,B.themeCategorical,d,void 0,D),t},[u,h,B.colorScale,B.themeCategorical,d,D]),z=(0,yy.useMemo)(()=>Ip(E,{stroke:M,strokeWidth:j,opacity:P}),[E,M,j,P]),H=(0,yy.useMemo)(()=>()=>({stroke:"#999",strokeWidth:1,fill:"none"}),[]),O=(0,yy.useMemo)(()=>Ip(H,{stroke:M,strokeWidth:j,opacity:P}),[H,M,j,P]),W=(0,yy.useMemo)(()=>{if("treemap"===i||"circlepack"===i||"partition"===i)return Hm(l)},[i,l]),q=Ap({componentName:"TreeDiagram",data:o});return q?(0,by.jsx)(td,{componentName:"TreeDiagram",message:q,width:_,height:L}):B.loadingEl?B.loadingEl:(0,by.jsx)(sd,{componentName:"TreeDiagram",width:_,height:L,children:(0,by.jsx)(qd,{chartType:i,...null!=o&&{data:o},size:[_,L],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:B.margin,nodeIDAccessor:c,childrenAccessor:a,hierarchySum:W,treeOrientation:s,edgeType:p,nodeStyle:z,edgeStyle:O,colorBy:u,colorScheme:B.effectivePalette,colorByDepth:h,nodeSize:g,nodeLabel:T?f||c:void 0,showLabels:T,enableHover:R,tooltipContent:!1===m?()=>null:Bs(m)||void 0,...Gd({linkedHover:w,selection:k,onObservation:b,onClick:v,mobileInteraction:B.mobileInteraction,customHoverBehavior:B.customHoverBehavior,customClickBehavior:B.customClickBehavior,linkedHoverInClickPredicate:!1}),...C&&"none"!==C&&{legendHoverBehavior:B.legendState.onLegendHover,legendClickBehavior:B.legendState.onLegendClick,legendHighlightedCategory:B.legendState.highlightedCategory,legendIsolatedCategories:B.legendState.isolatedCategories},className:n,title:I,description:$,summary:N,accessibleTable:F,...null!=e.animate&&{animate:e.animate},...y})})}vy.displayName="TreeDiagram";var xy=require("react"),ky=require("react/jsx-runtime");function wy(e){const t=bp(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLabels:e.showLabels,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,linkedHover:e.linkedHover,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:600,height:600}),{data:o,margin:r,className:n,childrenAccessor:i="children",valueAccessor:s="value",nodeIdAccessor:a="name",colorBy:l,colorScheme:c,colorByDepth:u=!1,labelMode:d="leaf",nodeLabel:h,padding:p=4,paddingTop:f,nodeStyle:g,tooltip:m,frameProps:y={},selection:b,linkedHover:v,onObservation:x,onClick:k,chartId:w,loading:S,loadingContent:A,legendInteraction:C,stroke:M,strokeWidth:j,opacity:P}=e,{nodeStyle:_,...L}=y,{width:R,height:T,enableHover:I,showLabels:$=!0,title:N,description:F,summary:B,accessibleTable:D}=t,E=Wm({nodes:(0,xy.useMemo)(()=>Em(o??null,i),[o,i]),edges:void 0,inferNodes:!1,colorBy:u?void 0:l,colorScheme:c,showLegend:!1,legendInteraction:C,selection:b,linkedHover:v,onObservation:x,onClick:k,mobileInteraction:t.mobileInteraction,mobileSemantics:t.mobileSemantics,chartType:"Treemap",chartId:w,marginDefaults:t.marginDefaults,userMargin:r,width:R,height:T,loading:S,loadingContent:A}),z=Pp(b),H=E.customHoverBehavior,O=(0,xy.useCallback)(e=>{if(!e)return H(null);const t=e.data||e;H({data:t?.data||t})},[H]),W=(0,xy.useMemo)(()=>new Map,[]),q=(0,xy.useMemo)(()=>e=>{const t={stroke:"var(--semiotic-cell-border, var(--semiotic-border, #fff))",strokeWidth:1,strokeOpacity:.8};return t.fill=u?ze[(e.depth||0)%ze.length]:l?Oe(e.data||e,l,E.colorScale):up(void 0,E.themeCategorical,c,void 0,W),t},[l,u,E.colorScale,E.themeCategorical,c,W]),Y=(0,xy.useMemo)(()=>g||_?e=>({...q(e),..._?_(e)??{}:{},...g?g(e)??{}:{}}):q,[q,g,_]),G=(0,xy.useMemo)(()=>Ip(Y,{stroke:M,strokeWidth:j,opacity:P}),[Y,M,j,P]),V=(0,xy.useMemo)(()=>E.activeSelectionHook?e=>{const t={...G(e)};if(E.activeSelectionHook.isActive)if(E.activeSelectionHook.predicate(e.data||e))z?.selectedStyle&&Object.assign(t,z.selectedStyle);else{const e=z?.unselectedOpacity??Fh;t.opacity=e,t.fillOpacity=e,t.strokeOpacity=e,z?.unselectedStyle&&Object.assign(t,z.unselectedStyle)}return t}:G,[G,E.activeSelectionHook,z]),X=(0,xy.useMemo)(()=>Hm(s),[s]),U=void 0!==f?f:!$||"parent"!==d&&"all"!==d?void 0:18,K=Ap({componentName:"Treemap",data:o});return K?(0,ky.jsx)(td,{componentName:"Treemap",message:K,width:R,height:T}):E.loadingEl?E.loadingEl:(0,ky.jsx)(sd,{componentName:"Treemap",width:R,height:T,children:(0,ky.jsx)(qd,{chartType:"treemap",...null!=o&&{data:o},size:[R,T],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:E.margin,nodeIDAccessor:a,childrenAccessor:i,hierarchySum:X,padding:p,paddingTop:U,nodeStyle:V,colorBy:l,colorScheme:E.effectivePalette,colorByDepth:u,nodeLabel:$?h||a:void 0,showLabels:$,labelMode:d,enableHover:I,tooltipContent:!1===m?()=>null:Bs(m)||void 0,...Gd({linkedHover:v,selection:b,onObservation:x,onClick:k,mobileInteraction:E.mobileInteraction,customHoverBehavior:O,customClickBehavior:E.customClickBehavior,linkedHoverInClickPredicate:!1}),...C&&"none"!==C&&{legendHoverBehavior:E.legendState.onLegendHover,legendClickBehavior:E.legendState.onLegendClick,legendHighlightedCategory:E.legendState.highlightedCategory,legendIsolatedCategories:E.legendState.isolatedCategories},className:n,title:N,description:F,summary:B,accessibleTable:D,...null!=e.animate&&{animate:e.animate},...L})})}wy.displayName="Treemap";var Sy=require("react"),Ay=require("react/jsx-runtime");function Cy(e){const t=bp(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLabels:e.showLabels,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:600,height:600}),{data:o,margin:r,className:n,childrenAccessor:i="children",valueAccessor:s="value",nodeIdAccessor:a="name",colorBy:l,colorScheme:c,colorByDepth:u=!1,nodeLabel:d,circleOpacity:h=.7,padding:p=4,tooltip:f,frameProps:g={},onObservation:m,onClick:y,chartId:b,selection:v,linkedHover:x,loading:k,loadingContent:w,legendInteraction:S,stroke:A,strokeWidth:C,opacity:M}=e,{width:j,height:P,enableHover:_,showLabels:L=!0,title:R,description:T,summary:I,accessibleTable:$}=t,N=Wm({nodes:(0,Sy.useMemo)(()=>Em(o??null,i),[o,i]),edges:void 0,inferNodes:!1,colorBy:u?void 0:l,colorScheme:c,showLegend:!1,legendInteraction:S,selection:v,linkedHover:x,onObservation:m,onClick:y,mobileInteraction:t.mobileInteraction,mobileSemantics:t.mobileSemantics,chartType:"CirclePack",chartId:b,marginDefaults:t.marginDefaults,userMargin:r,width:j,height:P,loading:k,loadingContent:w}),F=(0,Sy.useMemo)(()=>new Map,[]),B=(0,Sy.useMemo)(()=>e=>{const t={stroke:"currentColor",strokeWidth:1,strokeOpacity:.3,fillOpacity:h};return t.fill=u?ze[(e.depth||0)%ze.length]:l?Oe(e.data||e,l,N.colorScale):up(void 0,N.themeCategorical,c,void 0,F),t},[l,u,N.colorScale,h,N.themeCategorical,c,F]),D=(0,Sy.useMemo)(()=>Ip(B,{stroke:A,strokeWidth:C,opacity:M}),[B,A,C,M]),E=(0,Sy.useMemo)(()=>Hm(s),[s]),z=Ap({componentName:"CirclePack",data:o});return z?(0,Ay.jsx)(td,{componentName:"CirclePack",message:z,width:j,height:P}):N.loadingEl?N.loadingEl:(0,Ay.jsx)(sd,{componentName:"CirclePack",width:j,height:P,children:(0,Ay.jsx)(qd,{chartType:"circlepack",...null!=o&&{data:o},size:[j,P],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:N.margin,nodeIDAccessor:a,childrenAccessor:i,hierarchySum:E,padding:p,nodeStyle:D,colorBy:l,colorScheme:N.effectivePalette,colorByDepth:u,nodeLabel:L?d||a:void 0,showLabels:L,enableHover:_,tooltipContent:!1===f?()=>null:Bs(f)||void 0,...Gd({linkedHover:x,selection:v,onObservation:m,onClick:y,mobileInteraction:N.mobileInteraction,customHoverBehavior:N.customHoverBehavior,customClickBehavior:N.customClickBehavior,linkedHoverInClickPredicate:!1}),...S&&"none"!==S&&{legendHoverBehavior:N.legendState.onLegendHover,legendClickBehavior:N.legendState.onLegendClick,legendHighlightedCategory:N.legendState.highlightedCategory,legendIsolatedCategories:N.legendState.isolatedCategories},className:n,title:R,description:T,summary:I,accessibleTable:$,...null!=e.animate&&{animate:e.animate},...g})})}Cy.displayName="CirclePack";var My=require("react"),jy=require("react/jsx-runtime"),Py=ze;function _y(e){const t=bp(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLabels:e.showLabels,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:600,height:600}),{data:o,margin:r,className:n,childrenAccessor:i="children",nodeIdAccessor:s="name",colorBy:a,colorScheme:l,colorByDepth:c=!1,orbitMode:u="flat",orbitSize:d=2.95,speed:h=.25,revolution:p,revolutionStyle:f,eccentricity:g=1,showRings:m=!0,nodeRadius:y=6,showLabels:b=!1,animated:v=!0,tooltip:x,foregroundGraphics:k,annotations:w,frameProps:S={},onObservation:A,onClick:C,chartId:M,selection:j,linkedHover:P,loading:_,loadingContent:L,stroke:R,strokeWidth:T,opacity:I}=e,{width:$,height:N,enableHover:F,title:B,description:D,summary:E,accessibleTable:z}=t,H=Wm({nodes:(0,My.useMemo)(()=>Em(o,i),[o,i]),edges:void 0,inferNodes:!1,colorBy:c?void 0:a,colorScheme:l,showLegend:!1,legendInteraction:void 0,selection:j,linkedHover:P,onObservation:A,onClick:C,mobileInteraction:t.mobileInteraction,mobileSemantics:t.mobileSemantics,chartType:"OrbitDiagram",chartId:M,marginDefaults:{top:10,right:10,bottom:10,left:10},userMargin:r,width:$,height:N,loading:_,loadingContent:L}),O=(0,My.useMemo)(()=>new Map,[]),{colorScale:W,customClickBehavior:q,customHoverBehavior:Y,themeCategorical:G}=H,V=(0,My.useMemo)(()=>{if(Array.isArray(l))return l;const e=Be[l];return Array.isArray(e)?e:De},[l]),X=(0,My.useMemo)(()=>e=>{const t={stroke:"#fff",strokeWidth:1},o=0===(e.depth??0);return t.fill=c?o?V[0]:Py[(e.depth||0)%Py.length]:a?Oe(e.data||e,a,W):up(void 0,G,l,void 0,O),t.opacity=o?1:.85,t},[a,c,W,V,G,l,O]),U=(0,My.useMemo)(()=>Ip(X,{stroke:R,strokeWidth:T,opacity:I}),[X,R,T,I]),K=(0,My.useMemo)(()=>()=>({stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1}),[]),Q=(0,My.useMemo)(()=>e=>{Y(e&&e.data&&void 0!==e.data.data?{...e,data:e.data.data}:e)},[Y]),Z=(0,My.useMemo)(()=>e=>{q(e&&e.data&&void 0!==e.data.data?{...e,data:e.data.data}:e)},[q]),J=Ap({componentName:"OrbitDiagram",data:o});return J?(0,jy.jsx)(td,{componentName:"OrbitDiagram",message:J,width:$,height:N}):H.loadingEl?H.loadingEl:(0,jy.jsx)(sd,{componentName:"OrbitDiagram",width:$,height:N,children:(0,jy.jsx)(qd,{chartType:"orbit",...null!=o&&{data:o},size:[$,N],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:H.margin,nodeIDAccessor:s,childrenAccessor:i,nodeStyle:U,edgeStyle:K,colorBy:a,colorScheme:H.effectivePalette,colorByDepth:c,nodeSize:y,nodeLabel:b?s:void 0,showLabels:b,enableHover:!v&&F,tooltipContent:v?void 0:!1===x?()=>null:Bs(x)||void 0,...Gd({linkedHover:P,selection:j,onObservation:A,onClick:C,mobileInteraction:H.mobileInteraction,customHoverBehavior:Q,customClickBehavior:Z,linkedHoverInClickPredicate:!1}),foregroundGraphics:k,annotations:w,className:n,title:B,description:D,summary:E,orbitMode:u,orbitSize:d,orbitSpeed:h,orbitRevolution:p,orbitRevolutionStyle:f,orbitEccentricity:g,orbitShowRings:m,orbitAnimated:v,accessibleTable:z,...null!=e.animate&&{animate:e.animate},...S})})}_y.displayName="OrbitDiagram";var Ly=require("react"),Ry=require("react/jsx-runtime"),Ty={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, #f3f4f6)",padding:"6px 10px",borderRadius:"var(--semiotic-tooltip-radius, 4px)",fontSize:"var(--semiotic-tooltip-font-size, 12px)",fontFamily:"var(--semiotic-tick-font-family, var(--semiotic-font-family, sans-serif))",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.25))",lineHeight:1.4,pointerEvents:"none",whiteSpace:"nowrap"},Iy={opacity:.7,marginRight:4};function $y(e,t,o){if(null!=e)return"function"==typeof t?t(e):e["string"==typeof t?t:o]}function Ny(e){return null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+""}function Fy(e={}){const{timeAccessor:t,valueAccessor:o,xLabel:r="x",yLabel:n="y"}=e;return e=>{const i=e?.data??null,s=$y(i,t,"time"),a=$y(i,o,"value");return(0,Ry.jsxs)("div",{className:"semiotic-tooltip",style:Ty,children:[(0,Ry.jsxs)("div",{children:[(0,Ry.jsxs)("span",{style:Iy,children:[r,":"]}),Ny(s)]}),(0,Ry.jsxs)("div",{children:[(0,Ry.jsxs)("span",{style:Iy,children:[n,":"]}),Ny(a)]})]})}}function By(e,t){return null!=e?e:Math.max(t?.length??0,200)}var Dy=class e{constructor(){this._count=0,this._mean=0,this._m2=0,this._min=1/0,this._max=-1/0}push(e){if(!Number.isFinite(e))return;this._count+=1;const t=e-this._mean;this._mean+=t/this._count,this._m2+=t*(e-this._mean),this._min>e&&(this._min=e),e>this._max&&(this._max=e)}merge(e){if(0===e._count)return;if(0===this._count)return this._count=e._count,this._mean=e._mean,this._m2=e._m2,this._min=e._min,void(this._max=e._max);const t=this._count+e._count,o=e._mean-this._mean;this._mean+=o*e._count/t,this._m2+=e._m2+o*o*this._count*e._count/t,this._count=t,this._min>e._min&&(this._min=e._min),e._max>this._max&&(this._max=e._max)}clear(){this._count=0,this._mean=0,this._m2=0,this._min=1/0,this._max=-1/0}clone(){const t=new e;return t._count=this._count,t._mean=this._mean,t._m2=this._m2,t._min=this._min,t._max=this._max,t}get count(){return this._count}get mean(){return 0===this._count?0:this._mean}get sum(){return 0===this._count?0:this._mean*this._count}get variance(){return 2>this._count?0:this._m2/this._count}get stddev(){return Math.sqrt(this.variance)}get sampleVariance(){return 2>this._count?0:this._m2/(this._count-1)}get sampleStddev(){return Math.sqrt(this.sampleVariance)}get min(){return this._min}get max(){return this._max}},Ey=class{constructor(e){this.windows=new Map,this.sessions=[],this.latest=-1/0,this.type=e.window??"tumbling",this.size=e.size;const t=e.hop??e.size;this.hop=t>0&&e.size>=t?t:e.size,this.gap=e.gap??e.size,this.retain=null!=e.retain&&e.retain>0?e.retain:1/0}push(e,t){Number.isFinite(e)&&Number.isFinite(t)&&(e>this.latest&&(this.latest=e),"session"===this.type?this.pushSession(e,t):this.pushFixed(e,t),this.prune())}pushFixed(e,t){if("tumbling"===this.type||this.hop>=this.size)return void this.bump(Math.floor(e/this.size)*this.size,t);const o=this.hop,r=Math.floor(e/o);for(let n=Math.floor((e-this.size)/o)+1;r>=n;n++)this.bump(n*o,t)}bump(e,t){let o=this.windows.get(e);o||(o=new Dy,this.windows.set(e,o)),o.push(t)}pushSession(e,t){const o=this.gap,r=new Dy;r.push(t);let n=e,i=e;const s=[],a={start:n,end:i,stats:r};for(const t of this.sessions)e-o>t.end||t.start>e+o?s.push(t):(a.stats.merge(t.stats),n>t.start&&(n=t.start),t.end>i&&(i=t.end));a.start=n,a.end=i,s.push(a),s.sort((e,t)=>e.start-t.start),this.sessions=s}prune(){if(this.retain===1/0)return;if("session"===this.type)return void(this.sessions.length>this.retain&&(this.sessions=this.sessions.slice(this.sessions.length-this.retain)));if(this.retain>=this.windows.size)return;const e=[...this.windows.keys()].sort((e,t)=>e-t),t=e.length-this.retain;for(let o=0;t>o;o++)this.windows.delete(e[o])}emit(){return"session"===this.type?this.emitSessions():this.emitFixed()}emitFixed(){const e=[];for(const[t,o]of this.windows){const r=t+this.size;e.push(this.row(t,r,o,r>this.latest))}return e.sort((e,t)=>e.start-t.start),e}emitSessions(){return this.sessions.map(e=>this.row(e.start,e.end,e.stats,this.gap>this.latest-e.end))}row(e,t,o,r){return{start:e,end:t,count:o.count,mean:o.mean,sum:o.sum,min:o.min,max:o.max,stddev:o.stddev,partial:r}}get windowCount(){return"session"===this.type?this.sessions.length:this.windows.size}get watermark(){return this.latest}clear(){this.windows.clear(),this.sessions=[],this.latest=-1/0}};function zy(e,t){switch(t){case"sum":return e.sum;case"min":return e.min;case"max":return e.max;case"count":return e.count;default:return e.mean}}var Hy={ms:1,s:1e3,m:6e4,h:36e5,d:864e5},Oy=/(\d+(?:\.\d+)?)(ms|s|m|h|d)/g;function Wy(e){if("number"==typeof e)return Number.isFinite(e)&&e>0?e:null;if("string"!=typeof e)return null;const t=e.trim();if(""===t)return null;Oy.lastIndex=0;let o,r=0,n=0;for(;null!==(o=Oy.exec(t));){const e=parseFloat(o[1]),t=Hy[o[2]];if(null==t||!Number.isFinite(e))return null;r+=e*t,n+=o[0].length}return n!==t.length?null:r>0?r:null}var qy="time",Yy="value",Gy="__aggLower",Vy="__aggUpper",Xy="__aggPartial",Uy="count",Ky="__aggStart",Qy="__aggEnd";function Zy(e,t){const o=t.stat??"mean",r=t.band??"none",n=t.sigma??1;return e.emit().map(e=>{const t={[qy]:(e.start+e.end)/2,[Yy]:zy(e,o),[Uy]:e.count,[Xy]:e.partial,[Ky]:e.start,[Qy]:e.end},i=function(e,t,o,r=1){if("none"===t)return null;if("minmax"===t)return[e.min,e.max];const n=zy(e,o),i=e.stddev*r;return[n-i,n+i]}(e,r,o,n);return i&&(t[Gy]=i[0],t[Vy]=i[1]),t})}var Jy=class{constructor(e){this.held=[],this._watermark=-1/0,this._lateCount=0,this.lateness=e.lateness>0?e.lateness:0,this.getTime=e.getTime,this.latePolicy=e.latePolicy??"drop"}push(e){const t=this.getTime(e);if(!Number.isFinite(t))return{released:[e],late:[]};const o=[];return this._watermark!==-1/0&&this._watermark-this.lateness>t?(this._lateCount+=1,o.push(e),"drop"===this.latePolicy?{released:[],late:o}:{released:[e],late:o}):(t>this._watermark&&(this._watermark=t),this.held.push(e),{released:this.drain(),late:o})}drain(){const e=this._watermark-this.lateness;if(0===this.held.length)return[];const t=[],o=[];for(const r of this.held)this.getTime(r)>e?o.push(r):t.push(r);return this.held=o,t.sort((e,t)=>this.getTime(e)-this.getTime(t)),t}flush(){const e=this.held;return this.held=[],e.sort((e,t)=>this.getTime(e)-this.getTime(t)),e}clear(){this.held=[],this._watermark=-1/0,this._lateCount=0}get watermark(){return this._watermark}get lateCount(){return this._lateCount}get heldCount(){return this.held.length}},eb=require("react/jsx-runtime");function tb(e,t,o){const r="function"==typeof t?t(e):e[t??o];if(null==r)return null;if(r instanceof Date)return r.getTime();const n=Number(r);return Number.isFinite(n)?n:null}var ob=(0,Ly.forwardRef)(function(e,t){const o=bp(e.mode,{width:e.size?.[0]??e.width,height:e.size?.[1]??e.height,enableHover:null!=e.enableHover?!!e.enableHover:void 0,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{size:r,margin:n,className:i,arrowOfTime:s="right",windowMode:a="sliding",windowSize:l,data:c,timeAccessor:u,valueAccessor:d,timeExtent:h,valueExtent:p,extentPadding:f,stroke:g="#007bff",strokeWidth:m=2,strokeDasharray:y,opacity:b,background:v,tooltipContent:x,tooltip:k,onHover:w,annotations:S,autoPlaceAnnotations:A,svgAnnotationRules:C,tickFormatTime:M,tickFormatValue:j,decay:P,pulse:_,staleness:L,transition:R,linkedHover:T,selection:I,onObservation:$,chartId:N,loading:F,loadingContent:B,emptyContent:D,emphasis:E,legendPosition:z,aggregate:H,eventTime:O}=e,W=o.showAxes,q=o.enableHover,Y=n??o.marginDefaults,G=r??[o.width,o.height],V=x??k??Fy({timeAccessor:u,valueAccessor:d}),X=(0,Ly.useRef)(null),{customHoverBehavior:U}=pp({selection:I,linkedHover:T,unwrapData:!0,onObservation:$,chartType:"RealtimeLineChart",chartId:N}),K=(0,Ly.useCallback)(e=>{w&&w(e),U(e)},[w,U]),Q=null!=H,[Z,J]=(0,Ly.useState)([]),ee=(0,Ly.useRef)(null),te=(0,Ly.useRef)(H);te.current=H;const oe=(0,Ly.useRef)(Q);oe.current=Q;const re=(0,Ly.useRef)(Z);re.current=Z;const ne=(0,Ly.useRef)({timeAccessor:u,valueAccessor:d});ne.current={timeAccessor:u,valueAccessor:d},(0,Ly.useEffect)(()=>{if(!Q)return void(ee.current=null);const e=te.current,t=function(e){const t=e.window??"tumbling",o=Wy("session"===t?e.gap??e.size:e.size);if(null==o)return null;const r=null!=e.hop?Wy(e.hop):void 0,n=null!=e.gap?Wy(e.gap):void 0;return new Ey({window:t,size:o,hop:r??void 0,gap:n??void 0,retain:e.retain})}(e);if(ee.current=t,t&&c){const{timeAccessor:e,valueAccessor:o}=ne.current;for(const r of c){const n=tb(r,e,"time"),i=tb(r,o,"value");null!=n&&null!=i&&t.push(n,i)}}J(t?Zy(t,e):[])},[Q?[H.window??"tumbling",H.size,H.hop??"",H.gap??"",H.retain??""].join("|"):"",Q,c]),(0,Ly.useEffect)(()=>{Q&&ee.current&&J(Zy(ee.current,te.current))},[H?.stat,H?.band,H?.sigma]);const ie=(0,Ly.useCallback)(e=>{const t=ee.current,o=te.current;if(!t||!o)return;const{timeAccessor:r,valueAccessor:n}=ne.current;for(const o of e){const e=tb(o,r,"time"),i=tb(o,n,"value");null!=e&&null!=i&&t.push(e,i)}J(Zy(t,o))},[]),se=null!=O,ae=(0,Ly.useRef)(null),le=(0,Ly.useRef)(O);le.current=O;const ce=(0,Ly.useRef)(se);ce.current=se;const ue=(0,Ly.useRef)($);ue.current=$;const de=(0,Ly.useRef)(N);de.current=N,(0,Ly.useEffect)(()=>{ae.current=se?function(e){const t=Wy(e.lateness);return null==t?null:new Jy({lateness:t,getTime:e=>tb(e,ne.current.timeAccessor,"time")??NaN,latePolicy:e.latePolicy??"drop"})}(le.current):null},[se?`${O.lateness}|${O.latePolicy??"drop"}`:"",se]);const he=(0,Ly.useCallback)(e=>{0!==e.length&&(oe.current?ie(e):X.current?.pushMany(e))},[ie]),pe=(0,Ly.useCallback)(e=>{const t=ae.current;if(!ce.current||!t)return void he(e);const o=[];for(const r of e){const e=t.push(r);if(e.released.length&&o.push(...e.released),e.late.length){const o=ue.current;if(o){const{timeAccessor:r}=ne.current,n=le.current?.latePolicy??"drop";for(const i of e.late)o({type:"late-data",datum:i,eventTime:tb(i,r,"time")??NaN,watermark:t.watermark,policy:n,lateCount:t.lateCount,timestamp:Date.now(),chartType:"RealtimeLineChart",chartId:de.current})}}}he(o)},[he]);(0,Ly.useImperativeHandle)(t,()=>({push:e=>pe([e]),pushMany:e=>pe(e),remove:e=>oe.current?[]:X.current?.remove(e)??[],update:(e,t)=>oe.current?[]:X.current?.update(e,t)??[],clear:()=>{ae.current?.clear(),oe.current?(ee.current?.clear(),J([])):X.current?.clear()},getData:()=>oe.current?re.current:X.current?.getData()??[],getScales:()=>X.current?.getScales()??null}),[pe]);const fe=ud(F,G[0],G[1],B),ge=fe?null:cd(Q?void 0:c,G[0],G[1],D),me={stroke:g,strokeWidth:m,strokeDasharray:y};null!=b&&(me.opacity=b);const ye=By(l,c),be=Q?Z:c,ve=Q?qy:u,xe=Q?Yy:d,ke=Q&&H&&"none"!==(H.band??"none")?{y0Accessor:Gy,y1Accessor:Vy,perSeries:!1}:void 0;return fe||ge||(0,eb.jsx)(Ka,{ref:X,chartType:"line",runtimeMode:"streaming",size:G,margin:Y,className:E?`${i||""} semiotic-emphasis-${E}`.trim():i,arrowOfTime:s,windowMode:Q?"growing":a,windowSize:Q?Math.max(1,H?.retain??Math.max(Z.length,600)):ye,data:be,timeAccessor:ve,valueAccessor:xe,xExtent:h,yExtent:p,extentPadding:f,band:ke,lineStyle:me,showAxes:W,background:v,hoverAnnotation:q,tooltipContent:V,...Gd({linkedHover:T,selection:I,onObservation:$,forceHoverBehavior:!0,mobileInteraction:o.mobileInteraction,customHoverBehavior:K}),annotations:S,autoPlaceAnnotations:A,svgAnnotationRules:C,tickFormatTime:M,tickFormatValue:j,decay:P,pulse:_,staleness:L,transition:R,pointIdAccessor:e.pointIdAccessor,legendPosition:z})});ob.displayName="RealtimeLineChart";var rb=require("react"),nb=require("react/jsx-runtime");function ib(e,t,o){const r="function"==typeof t?t(e):e[t??o];if(null==r)return null;if(r instanceof Date)return r.getTime();if("string"==typeof r&&""===r.trim())return null;const n=Number(r);return Number.isFinite(n)?n:null}var sb=(0,rb.forwardRef)(function(e,t){const o=bp(e.mode,{width:e.size?.[0]??e.width,height:e.size?.[1]??e.height,showAxes:e.showAxes,enableHover:null!=e.enableHover?!!e.enableHover:void 0,linkedHover:e.linkedHover,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{binSize:r,size:n,margin:i,className:s,arrowOfTime:a="right",windowMode:l="sliding",windowSize:c,data:u,timeAccessor:d,valueAccessor:h,direction:p="up",timeExtent:f,valueExtent:g,extentPadding:m,categoryAccessor:y,colors:b,fill:v,stroke:x,strokeWidth:k,opacity:w,gap:S,background:A,tooltipContent:C,tooltip:M,onHover:j,annotations:P,autoPlaceAnnotations:_,svgAnnotationRules:L,tickFormatTime:R,tickFormatValue:T,linkedHover:I,selection:$,decay:N,pulse:F,staleness:B,transition:D,onObservation:E,chartId:z,loading:H,loadingContent:O,emptyContent:W,emphasis:q,legendPosition:Y,brush:G,onBrush:V,linkedBrush:X}=e,U=o.showAxes,K=o.enableHover,Q=i??o.marginDefaults,Z=n??[o.width,o.height],J=C??M??function(e={}){const{timeAccessor:t,valueAccessor:o}=e;return e=>{const r=e?.data??null;if(null==r?.binStart||null==r?.binEnd){const e=$y(r,t,"time"),n=$y(r,o,"value");return(0,Ry.jsxs)("div",{className:"semiotic-tooltip",style:Ty,children:[(0,Ry.jsxs)("div",{children:[(0,Ry.jsx)("span",{style:Iy,children:"x:"}),Ny(e)]}),(0,Ry.jsxs)("div",{children:[(0,Ry.jsx)("span",{style:Iy,children:"y:"}),Ny(n)]})]})}return(0,Ry.jsxs)("div",{className:"semiotic-tooltip",style:Ty,children:[(0,Ry.jsxs)("div",{children:[(0,Ry.jsx)("span",{style:Iy,children:"range:"}),Ny(r.binStart),"–",Ny(r.binEnd)]}),null!=r.total&&(0,Ry.jsxs)("div",{children:[(0,Ry.jsx)("span",{style:Iy,children:"count:"}),Ny(r.total)]}),null!=r.category&&(0,Ry.jsxs)("div",{children:[(0,Ry.jsx)("span",{style:Iy,children:"category:"}),Ny(r.category)]})]})}}({timeAccessor:d,valueAccessor:h}),ee=(0,rb.useRef)(null),{customHoverBehavior:te}=pp({selection:$,linkedHover:I,unwrapData:!0,onObservation:E,chartType:"RealtimeHistogram",chartId:z}),oe=(0,rb.useCallback)(e=>{j&&j(e),te(e)},[j,te]),re=!0===G?{dimension:"x",snap:"bin"}:"x"===G?{dimension:"x"}:"object"==typeof G?G:void 0,ne=Nh(X),ie="string"==typeof d?d:"time",se=mh({name:ne?.name||"__unused_hist_brush__",xField:ne?.xField||ie,...ne?.yField?{yField:ne.yField}:{}}),ae=(0,rb.useRef)(se.brushInteraction);ae.current=se.brushInteraction;const le=(0,rb.useCallback)(e=>{if(V&&V(e),E&&E(e?{type:"brush",extent:e,timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:z}:{type:"brush-end",timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:z}),ne){const t=ae.current;t.end(e?"xBrush"===t.brush?e.x:"yBrush"===t.brush?e.y:[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:null)}},[V,E,z,ne]);(0,rb.useImperativeHandle)(t,()=>({push:e=>ee.current?.push(e),pushMany:e=>ee.current?.pushMany(e),remove:e=>ee.current?.remove(e)??[],update:(e,t)=>ee.current?.update(e,t)??[],clear:()=>ee.current?.clear(),getData:()=>ee.current?.getData()??[],getScales:()=>ee.current?.getScales()??null}),[]);const ce=ud(H,Z[0],Z[1],O),ue=ce?null:cd(u,Z[0],Z[1],W),de={};null!=v&&(de.fill=v),null!=x&&(de.stroke=x),null!=k&&(de.strokeWidth=k),null!=w&&(de.opacity=w),null!=S&&(de.gap=S);const he=q?`${s||""} semiotic-emphasis-${q}`.trim():s,pe=By(c,u),fe=(0,rb.useMemo)(()=>"down"!==p?g:function({data:e,valueAccessor:t,timeAccessor:o,binSize:r,valueExtent:n,extentPadding:i}){if(n)return[n[1],n[0]];if(!e||0===e.length)return;const s=new Map;for(const n of e){const e=ib(n,o,"time"),i=ib(n,t,"value");if(null==e||null==i)continue;const a=Math.floor(e/r)*r;s.set(a,(s.get(a)??0)+i)}let a=0;for(const e of s.values())e>a&&(a=e);return[a>0?a+a*(i??.1):1,0]}({data:u,valueAccessor:h,timeAccessor:d,binSize:r,valueExtent:g,extentPadding:m}),[p,u,h,d,r,g,m]);return ce||ue||(0,nb.jsx)(Ka,{ref:ee,chartType:"bar",runtimeMode:"streaming",size:Z,margin:Q,className:he,arrowOfTime:a,windowMode:l,windowSize:pe,data:u,timeAccessor:d,valueAccessor:h,xExtent:f,yExtent:fe,extentPadding:m,binSize:r,categoryAccessor:y,barColors:b,barStyle:de,showAxes:U,background:A,hoverAnnotation:K,tooltipContent:J,...Gd({linkedHover:I,selection:$,onObservation:E,forceHoverBehavior:!0,mobileInteraction:o.mobileInteraction,customHoverBehavior:oe}),annotations:P,autoPlaceAnnotations:_,svgAnnotationRules:L,tickFormatTime:R,tickFormatValue:T,decay:N,pulse:F,staleness:B,transition:D,pointIdAccessor:e.pointIdAccessor,legendPosition:Y,brush:re||(X?{dimension:"x"}:void 0),onBrush:re||X?le:void 0})});function ab(e){return(0,nb.jsx)(sb,{...e,windowMode:"growing"})}sb.displayName="RealtimeHistogram",ab.displayName="TemporalHistogram";var lb=sb,cb=require("react"),ub=require("react/jsx-runtime"),db=(0,cb.forwardRef)(function(e,t){const o=bp(e.mode,{width:e.size?.[0]??e.width,height:e.size?.[1]??e.height,enableHover:null!=e.enableHover?!!e.enableHover:void 0,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{size:r,margin:n,className:i,arrowOfTime:s="right",windowMode:a="sliding",windowSize:l,data:c,timeAccessor:u,valueAccessor:d,timeExtent:h,valueExtent:p,yScaleType:f,extentPadding:g,categoryAccessor:m,colors:y,radius:b,fill:v,opacity:x,stroke:k,strokeWidth:w,pointStyle:S,background:A,tooltipContent:C,tooltip:M,onHover:j,annotations:P,autoPlaceAnnotations:_,svgAnnotationRules:L,tickFormatTime:R,tickFormatValue:T,linkedHover:I,selection:$,onObservation:N,chartId:F,loading:B,loadingContent:D,emptyContent:E,emphasis:z,legendPosition:H}=e,O=o.showAxes,W=o.enableHover,q=n??o.marginDefaults,Y=r??[o.width,o.height],G=C??M??Fy({timeAccessor:u,valueAccessor:d}),V=(0,cb.useRef)(null),{customHoverBehavior:X}=pp({selection:$,linkedHover:I,unwrapData:!0,onObservation:N,chartType:"RealtimeSwarmChart",chartId:F}),U=(0,cb.useCallback)(e=>{j&&j(e),X(e)},[j,X]);(0,cb.useImperativeHandle)(t,()=>({push:e=>V.current?.push(e),pushMany:e=>V.current?.pushMany(e),remove:e=>V.current?.remove(e)??[],update:(e,t)=>V.current?.update(e,t)??[],clear:()=>V.current?.clear(),getData:()=>V.current?.getData()??[],getScales:()=>V.current?.getScales()??null}),[]);const K=ud(B,Y[0],Y[1],D),Q=K?null:cd(c,Y[0],Y[1],E),Z={};null!=b&&(Z.radius=b),null!=v&&(Z.fill=v),null!=x&&(Z.opacity=x),null!=k&&(Z.stroke=k),null!=w&&(Z.strokeWidth=w);const J=S,ee=z?`${i||""} semiotic-emphasis-${z}`.trim():i,te=By(l,c);return K||Q||(0,ub.jsx)(Ka,{ref:V,chartType:"swarm",runtimeMode:"streaming",size:Y,margin:q,className:ee,arrowOfTime:s,windowMode:a,windowSize:te,data:c,timeAccessor:u,valueAccessor:d,xExtent:h,yExtent:p,yScaleType:f,extentPadding:g,categoryAccessor:m,barColors:y,swarmStyle:Z,pointStyle:J,showAxes:O,background:A,hoverAnnotation:W,tooltipContent:G,...Gd({linkedHover:I,selection:$,onObservation:N,forceHoverBehavior:!0,mobileInteraction:o.mobileInteraction,customHoverBehavior:U}),annotations:P,autoPlaceAnnotations:_,svgAnnotationRules:L,tickFormatTime:R,tickFormatValue:T,legendPosition:H,pointIdAccessor:e.pointIdAccessor})});db.displayName="RealtimeSwarmChart";var hb=require("react"),pb=require("react/jsx-runtime"),fb=(0,hb.forwardRef)(function(e,t){const o=bp(e.mode,{width:e.size?.[0]??e.width,height:e.size?.[1]??e.height,enableHover:null!=e.enableHover?!!e.enableHover:void 0,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{size:r,margin:n,className:i,arrowOfTime:s="right",windowMode:a="sliding",windowSize:l,data:c,timeAccessor:u,valueAccessor:d,timeExtent:h,valueExtent:p,extentPadding:f,positiveColor:g,negativeColor:m,connectorStroke:y,connectorWidth:b,gap:v,stroke:x,strokeWidth:k,opacity:w,background:S,tooltipContent:A,tooltip:C,onHover:M,annotations:j,autoPlaceAnnotations:P,svgAnnotationRules:_,tickFormatTime:L,tickFormatValue:R,linkedHover:T,selection:I,onObservation:$,chartId:N,loading:F,loadingContent:B,emptyContent:D,emphasis:E,legendPosition:z}=e,H=o.showAxes,O=o.enableHover,W=n??o.marginDefaults,q=r??[o.width,o.height],Y=A??C??function(e={}){const{timeAccessor:t,valueAccessor:o}=e;return e=>{const r=e?.data??null,n=$y(r,t,"time"),i=r?.delta??$y(r,o,"value"),s=r?.cumEnd,a="number"==typeof i?0>i?Ny(i):"+"+Ny(i):Ny(i);return(0,Ry.jsxs)("div",{className:"semiotic-tooltip",style:Ty,children:[(0,Ry.jsxs)("div",{children:[(0,Ry.jsx)("span",{style:Iy,children:"x:"}),Ny(n)]}),(0,Ry.jsxs)("div",{children:[(0,Ry.jsx)("span",{style:Iy,children:"Δ:"}),a]}),null!=s&&(0,Ry.jsxs)("div",{children:[(0,Ry.jsx)("span",{style:Iy,children:"total:"}),Ny(s)]})]})}}({timeAccessor:u,valueAccessor:d}),G=(0,hb.useRef)(null),{customHoverBehavior:V}=pp({selection:I,linkedHover:T,unwrapData:!0,onObservation:$,chartType:"RealtimeWaterfallChart",chartId:N}),X=(0,hb.useCallback)(e=>{M&&M(e),V(e)},[M,V]);(0,hb.useImperativeHandle)(t,()=>({push:e=>G.current?.push(e),pushMany:e=>G.current?.pushMany(e),remove:e=>G.current?.remove(e)??[],update:(e,t)=>G.current?.update(e,t)??[],clear:()=>G.current?.clear(),getData:()=>G.current?.getData()??[],getScales:()=>G.current?.getScales()??null}),[]);const U=ud(F,q[0],q[1],B),K=U?null:cd(c,q[0],q[1],D),Q={};null!=g&&(Q.positiveColor=g),null!=m&&(Q.negativeColor=m),null!=y&&(Q.connectorStroke=y),null!=b&&(Q.connectorWidth=b),null!=v&&(Q.gap=v),null!=x&&(Q.stroke=x),null!=k&&(Q.strokeWidth=k),null!=w&&(Q.opacity=w);const Z=E?`${i||""} semiotic-emphasis-${E}`.trim():i,J=By(l,c);return U||K||(0,pb.jsx)(Ka,{ref:G,chartType:"waterfall",runtimeMode:"streaming",size:q,margin:W,className:Z,arrowOfTime:s,windowMode:a,windowSize:J,data:c,timeAccessor:u,valueAccessor:d,xExtent:h,yExtent:p,extentPadding:f,waterfallStyle:Q,showAxes:H,background:S,hoverAnnotation:O,tooltipContent:Y,...Gd({linkedHover:T,selection:I,onObservation:$,forceHoverBehavior:!0,mobileInteraction:o.mobileInteraction,customHoverBehavior:X}),annotations:j,autoPlaceAnnotations:P,svgAnnotationRules:_,tickFormatTime:L,tickFormatValue:R,legendPosition:z,pointIdAccessor:e.pointIdAccessor})});fb.displayName="RealtimeWaterfallChart";var gb=require("react"),mb=require("react/jsx-runtime"),yb=(0,gb.forwardRef)(function(e,t){const o=bp(e.mode,{width:e.size?.[0]??e.width,height:e.size?.[1]??e.height,enableHover:null!=e.enableHover?!!e.enableHover:void 0,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{size:r,margin:n,className:i,arrowOfTime:s="right",windowMode:a="sliding",windowSize:l,data:c,timeAccessor:u,valueAccessor:d,categoryAccessor:h,timeExtent:p,valueExtent:f,extentPadding:g,heatmapXBins:m=20,heatmapYBins:y=20,aggregation:b="count",background:v,tooltipContent:x,tooltip:k,onHover:w,annotations:S,autoPlaceAnnotations:A,svgAnnotationRules:C,tickFormatTime:M,tickFormatValue:j,decay:P,pulse:_,staleness:L,linkedHover:R,selection:T,onObservation:I,chartId:$,loading:N,loadingContent:F,emptyContent:B,emphasis:D,legendPosition:E}=e,z=o.showAxes,H=o.enableHover,O=n??o.marginDefaults,W=r??[o.width,o.height],q=x??k??function(e={}){const{timeAccessor:t,valueAccessor:o,xLabel:r="x",yLabel:n="y"}=e;return e=>{const i=e?.data??null,s=i?.xCenter??$y(i,t,"time"),a=i?.yCenter??$y(i,o,"value"),l=i?.count,c=i?.sum,u=i?.value,d=i?.agg??"count";return(0,Ry.jsxs)("div",{className:"semiotic-tooltip",style:Ty,children:[(0,Ry.jsxs)("div",{children:[(0,Ry.jsxs)("span",{style:Iy,children:[r,":"]}),Ny(s)]}),(0,Ry.jsxs)("div",{children:[(0,Ry.jsxs)("span",{style:Iy,children:[n,":"]}),Ny(a)]}),null!=l&&(0,Ry.jsxs)("div",{children:[(0,Ry.jsx)("span",{style:Iy,children:"count:"}),Ny(l)]}),"sum"===d&&null!=c&&(0,Ry.jsxs)("div",{children:[(0,Ry.jsx)("span",{style:Iy,children:"sum:"}),Ny(c)]}),"mean"===d&&null!=u&&(0,Ry.jsxs)("div",{children:[(0,Ry.jsx)("span",{style:Iy,children:"mean:"}),Ny(u)]})]})}}({timeAccessor:u,valueAccessor:d}),Y=(0,gb.useRef)(null),{customHoverBehavior:G}=pp({selection:T,linkedHover:R,unwrapData:!0,onObservation:I,chartType:"RealtimeHeatmap",chartId:$}),V=(0,gb.useCallback)(e=>{w&&w(e),G(e)},[w,G]);(0,gb.useImperativeHandle)(t,()=>({push:e=>Y.current?.push(e),pushMany:e=>Y.current?.pushMany(e),remove:e=>Y.current?.remove(e)??[],update:(e,t)=>Y.current?.update(e,t)??[],clear:()=>Y.current?.clear(),getData:()=>Y.current?.getData()??[],getScales:()=>Y.current?.getScales()??null}),[]);const X=ud(N,W[0],W[1],F),U=X?null:cd(c,W[0],W[1],B),K=D?`${i||""} semiotic-emphasis-${D}`.trim():i,Q=By(l,c);return X||U||(0,mb.jsx)(Ka,{ref:Y,chartType:"heatmap",runtimeMode:"streaming",size:W,margin:O,className:K,arrowOfTime:s,windowMode:a,windowSize:Q,data:c,timeAccessor:u,valueAccessor:d,categoryAccessor:h,xExtent:p,yExtent:f,extentPadding:g,heatmapXBins:m,heatmapYBins:y,heatmapAggregation:b,showAxes:z,background:v,hoverAnnotation:H,tooltipContent:q,...Gd({linkedHover:R,selection:T,onObservation:I,forceHoverBehavior:!0,mobileInteraction:o.mobileInteraction,customHoverBehavior:V}),annotations:S,autoPlaceAnnotations:A,svgAnnotationRules:C,tickFormatTime:M,tickFormatValue:j,decay:P,pulse:_,staleness:L,legendPosition:E,pointIdAccessor:e.pointIdAccessor})});function bb(e){if(null==e)return"";if("number"!=typeof e)return e+"";if(!isFinite(e))return e+"";if(0===e)return"0";const t=parseFloat(e.toPrecision(12)),o=Math.abs(t);return 1e9>o?1e6>o?1e4>o?Number.isInteger(t)?t+"":parseFloat(t.toPrecision(6))+"":parseFloat((t/1e3).toPrecision(3))+"K":parseFloat((t/1e6).toPrecision(3))+"M":parseFloat((t/1e9).toPrecision(3))+"B"}yb.displayName="RealtimeHeatmap",c(require("react"));var vb=6e4,xb=60*vb,kb=24*xb;function wb(e){return 10>e?"0"+e:e+""}var Sb=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ab(e){let t,o=e;return(r,n,i)=>{const s=r instanceof Date?r:new Date(r);e||!i||2>i.length||i===t||(t=i,o=function(e){if(2>e.length)return"days";const t=[];for(let o=1;e.length>o;o++)t.push(e[o]-e[o-1]);t.sort((e,t)=>e-t);const o=t[Math.floor(t.length/2)];return 2*vb>o?"seconds":2*xb>o?"minutes":2*kb>o?"hours":60*kb>o?"days":400*kb>o?"months":"years"}(i));const a=o||"days";return null!=n&&0!==n&&i&&0!==i.length?function(e,t,o){const r=e.getUTCFullYear()!==t.getUTCFullYear(),n=r||e.getUTCMonth()!==t.getUTCMonth(),i=n||e.getUTCDate()!==t.getUTCDate(),s=i||e.getUTCHours()!==t.getUTCHours(),a=s||e.getUTCMinutes()!==t.getUTCMinutes(),l=Sb[e.getUTCMonth()],c=e.getUTCDate(),u=e.getUTCFullYear(),d=wb(e.getUTCHours()),h=wb(e.getUTCMinutes()),p=wb(e.getUTCSeconds());switch(o){case"seconds":return r?`${l} ${c}, ${u} ${d}:${h}:${p}`:i?`${l} ${c} ${d}:${h}:${p}`:s?`${d}:${h}:${p}`:a?`${h}:${p}`:":"+p;case"minutes":return r?`${l} ${c}, ${u} ${d}:${h}`:i?`${l} ${c} ${d}:${h}`:s?`${d}:${h}`:":"+h;case"hours":return r?`${l} ${c}, ${u} ${d}:00`:n?`${l} ${c} ${d}:${h}`:i?`${l} ${c} ${d}:00`:d+":00";case"days":return r?`${l} ${c}, ${u}`:n?`${l} ${c}`:""+c;case"months":return r?`${l} ${u}`:""+l;case"years":return""+u}}(s,new Date(i[n-1]),a):function(e,t){const o=Sb[e.getUTCMonth()],r=e.getUTCDate(),n=e.getUTCFullYear(),i=wb(e.getUTCHours()),s=wb(e.getUTCMinutes()),a=wb(e.getUTCSeconds());switch(t){case"seconds":return`${o} ${r}, ${n} ${i}:${s}:${a}`;case"minutes":case"hours":return`${o} ${r}, ${n} ${i}:${s}`;case"days":return`${o} ${r}, ${n}`;case"months":return`${o} ${n}`;case"years":return""+n}}(s,a)}}async function Cb(e,t){const{format:o="png",filename:r="chart",scale:n=2,background:i="white"}=t||{},s=e.querySelector("svg");if(!s)throw Error("No SVG element found in the container");const a=s.cloneNode(!0),l=s.getBoundingClientRect();if(a.getAttribute("width")||a.setAttribute("width",l.width+""),a.getAttribute("height")||a.setAttribute("height",l.height+""),a.getAttribute("xmlns")||a.setAttribute("xmlns","http://www.w3.org/2000/svg"),Mb(s,a),"svg"===o){const e=(new XMLSerializer).serializeToString(a);jb(new Blob([e],{type:"image/svg+xml;charset=utf-8"}),r+".svg")}else{const t=l.width*n,o=l.height*n,s=document.createElement("canvas");s.width=t,s.height=o;const c=s.getContext("2d");c.fillStyle=i,c.fillRect(0,0,t,o),c.scale(n,n);const u=e.querySelector("canvas");u&&c.drawImage(u,0,0,l.width,l.height);const d=(new XMLSerializer).serializeToString(a),h=new Blob([d],{type:"image/svg+xml;charset=utf-8"}),p=URL.createObjectURL(h),f=new Image;f.width=l.width,f.height=l.height,await new Promise((e,t)=>{f.onload=()=>{c.drawImage(f,0,0),s.toBlob(o=>{o?(jb(o,r+".png"),e()):t(Error("Failed to create PNG blob"))},"image/png"),URL.revokeObjectURL(p)},f.onerror=()=>{URL.revokeObjectURL(p),t(Error("Failed to load SVG image"))},f.src=p})}}function Mb(e,t){const o=e.children,r=t.children,n=window.getComputedStyle(e),i=["fill","stroke","stroke-width","stroke-dasharray","opacity","fill-opacity","stroke-opacity","font-family","font-size","font-weight","text-anchor","dominant-baseline"];for(const e of i){const o=n.getPropertyValue(e);o&&"none"!==o&&""!==o&&t.style?.setProperty(e,o)}for(let e=0;Math.min(o.length,r.length)>e;e++)Mb(o[e],r[e])}function jb(e,t){const o=URL.createObjectURL(e),r=document.createElement("a");r.href=o,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(o)}var Pb={common:{width:{type:"number",default:600},height:{type:"number",default:400},margin:{type:"object",description:'Object margin. A side value of "auto" or null leaves that side available for auto-reservation.'},className:{type:"string"},title:{type:"string"},enableHover:{type:"boolean",default:!0},showLegend:{type:"boolean"},showGrid:{type:"boolean",default:!1},colorBy:{type:["string","function"]},colorScheme:{type:["string","array"],default:"category10"},tooltip:{type:["boolean","function","object"]},annotations:{type:"array"},autoPlaceAnnotations:{type:["boolean","object"],default:!1,description:"Opt-in annotation placement pass. Chooses dx/dy for note-like annotations without manual offsets and avoids note/mark/edge overlaps where possible."},responsiveRules:{type:"array",description:"Semantic responsive transforms applied before chart-mode defaults."},mobileSemantics:{type:"object",description:"Phone/mobile contract consumed by audits, recipes, adapters, and agents."},mobileInteraction:{type:["boolean","object"],description:"Touch-first interaction policy for phone-sized chart slots."},axisExtent:{type:"string",enum:["nice","exact"],default:"nice",description:'Tick endpoint mode. "nice" rounds endpoints to readable values; "exact" pins the first and last tick to the actual data min and max with equidistant intermediates. Affects XY x/y axes and ordinal value axis only.'},frameProps:{type:"object",omitFromSchema:!0},onClick:{type:"function",omitFromSchema:!0}},xyAxis:{xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function",omitFromSchema:!0},yFormat:{type:"function",omitFromSchema:!0},xScaleType:{type:"string",enum:["linear","log","time"],description:'x scale type. "time" builds a scaleTime (required for landmark ticks on timestamps).'},yScaleType:{type:"string",enum:["linear","log","time"],description:"y scale type."}},ordinalAxis:{categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"},categoryFormat:{type:"function",omitFromSchema:!0}},realtime:{size:{type:"array",description:"[width, height] in pixels"},width:{type:"number",description:"Alias for size[0]"},height:{type:"number",description:"Alias for size[1]"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"],description:"Key for time/x values"},valueAccessor:{type:["string","function"],description:"Key for y values"},windowSize:{type:"number",description:"Number of data points visible"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltip:{type:["function","object"],description:"Tooltip content function or config"},tooltipContent:{type:"function",omitFromSchema:!0},onHover:{type:"function",omitFromSchema:!0},annotations:{type:"array"},autoPlaceAnnotations:{type:["boolean","object"],description:"Opt-in annotation placement pass for note-like annotations without manual offsets."},responsiveRules:{type:"array",description:"Semantic responsive transforms applied before chart-mode defaults."},mobileSemantics:{type:"object",description:"Phone/mobile contract consumed by audits, recipes, adapters, and agents."},mobileInteraction:{type:["boolean","object"],description:"Touch-first interaction policy for phone-sized chart slots."},svgAnnotationRules:{type:"function",omitFromSchema:!0},tickFormatTime:{type:"function",omitFromSchema:!0},tickFormatValue:{type:"function",omitFromSchema:!0},decay:{type:"object",description:"Decay config: { type, halfLife, minOpacity }"},pulse:{type:"object",description:"Pulse config: { duration, color, glowRadius }"},staleness:{type:"object",description:"Staleness config: { threshold, dimOpacity, showBadge }"}},physics:{data:{type:"array",description:"Array of source records. Each record becomes one or more simulated bodies."},size:{type:"array",description:"[width, height] in pixels"},width:{type:"number",description:"Alias for size[0]"},height:{type:"number",description:"Alias for size[1]"},className:{type:"string"},title:{type:"string"},responsiveWidth:{type:"boolean"},responsiveHeight:{type:"boolean"},colorBy:{type:["string","function"],description:"Categorical field or accessor used to color simulated bodies."},seed:{type:"number",default:1,description:"Deterministic simulation seed."},ballRadius:{type:"number",description:"Radius of each simulated circular body in pixels."},hoverRadius:{type:"number",description:"Pixel hit radius for body hover tooltips."},paused:{type:"boolean",description:"Pause the simulation at mount or on prop update."},tooltip:{type:["boolean","function","object"],description:"Tooltip content function/config, true for the default body tooltip, or false to disable hover tooltips."},frameProps:{type:"object",omitFromSchema:!0}}},_b=["vertical","horizontal"],Lb=["horizontal","vertical"],Rb=["right","left","top","bottom"],Tb=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"];function Ib(e){const t={type:e.type};return e.enum&&(t.enum=[...e.enum]),t}function $b(e){const t={};for(const[o,r]of Object.entries(function(e){const t={};for(const o of e.propBags)Object.assign(t,Pb[o]);return Object.assign(t,e.ownProps),t}(e)))t[o]=Ib(r);return{required:[...e.required],dataShape:e.dataShape,dataAccessors:[...e.dataAccessors],props:t}}var Nb=Object.fromEntries(Object.entries({BarChart:{name:"BarChart",category:"ordinal",description:"Vertical or horizontal bars for categorical comparisons.",required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],propBags:["common","ordinalAxis"],ownProps:{data:{type:"array",description:"Array of data objects"},categoryAccessor:{type:["string","function"],default:"category",description:"Key for category labels"},valueAccessor:{type:["string","function"],default:"value",description:"Key for bar values"},orientation:{type:"string",enum:_b,default:"vertical"},sort:{type:["boolean","string","function"],default:!1,description:"Sort bars: false, true, 'asc', 'desc', or comparator function"},barPadding:{type:"number",default:40},roundedTop:{type:"number",omitFromSchema:!0},valueExtent:{type:"array",omitFromSchema:!0},regression:{type:["boolean","string","object"],description:"Overlay a regression line through the bar tops. Accepts true (linear), a method ('linear' | 'polynomial' | 'loess'), or a full RegressionConfig. Pixels resolve through the band scale."}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["regression-overlay"]}},StackedBarChart:{name:"StackedBarChart",category:"ordinal",description:"Stacked bars for part-to-whole comparisons across categories. Requires stackBy to define the stacking dimension.",required:["data","stackBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],propBags:["common","ordinalAxis"],ownProps:{data:{type:"array",description:"Array of data objects"},stackBy:{type:["string","function"],description:"Key to define the stacking dimension (required)"},categoryAccessor:{type:["string","function"],default:"category"},valueAccessor:{type:["string","function"],default:"value"},orientation:{type:"string",enum:_b,default:"vertical"},normalize:{type:"boolean",default:!1,description:"Normalize stacks to 100%"},sort:{type:["boolean","string","function"],omitFromSchema:!0},barPadding:{type:"number",default:40},roundedTop:{type:"number",omitFromSchema:!0},showLegend:{type:"boolean",default:!0}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["stack"]}},GroupedBarChart:{name:"GroupedBarChart",category:"ordinal",description:"Side-by-side bars for comparing sub-categories within categories. Requires groupBy to define grouping.",required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],propBags:["common","ordinalAxis"],ownProps:{data:{type:"array",description:"Array of data objects"},groupBy:{type:["string","function"],description:"Key to define the grouping dimension (required)"},categoryAccessor:{type:["string","function"],default:"category"},valueAccessor:{type:["string","function"],default:"value"},orientation:{type:"string",enum:_b,default:"vertical"},sort:{type:["boolean","string","function"],omitFromSchema:!0},barPadding:{type:"number",default:60},roundedTop:{type:"number",omitFromSchema:!0},showLegend:{type:"boolean",default:!0}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:[]}},SwarmPlot:{name:"SwarmPlot",category:"ordinal",description:"Beeswarm/jittered dot plot showing individual data points within categories. Good for distributions.",required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],propBags:["common","ordinalAxis"],ownProps:{data:{type:"array",description:"Array of data objects"},categoryAccessor:{type:["string","function"],default:"category"},valueAccessor:{type:["string","function"],default:"value"},orientation:{type:"string",enum:_b,default:"vertical"},sizeBy:{type:["string","function"],description:"Key for variable point sizing"},sizeRange:{type:"array",default:[3,8]},symbolBy:{type:["string","function"],description:"Categorical field → glyph shape; each point renders as a d3-shape glyph instead of a circle."},symbolMap:{type:"object",description:"Explicit {category → shape} map for symbolBy; unmapped categories auto-assign."},pointRadius:{type:"number",default:4},pointOpacity:{type:"number",default:.7},categoryPadding:{type:"number",default:20},brush:{type:"boolean",omitFromSchema:!0},onBrush:{type:"function",omitFromSchema:!0},linkedBrush:{type:["string","object"],omitFromSchema:!0}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:[]}},BoxPlot:{name:"BoxPlot",category:"ordinal",description:"Box-and-whisker plots showing statistical distribution (median, quartiles, outliers) per category.",required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],propBags:["common","ordinalAxis"],ownProps:{data:{type:"array",description:"Array of data objects"},categoryAccessor:{type:["string","function"],default:"category"},valueAccessor:{type:["string","function"],default:"value"},orientation:{type:"string",enum:_b,default:"vertical"},showOutliers:{type:"boolean",default:!0,description:"Show outlier points"},outlierRadius:{type:"number",default:3},categoryPadding:{type:"number",default:20}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["statistical"]}},Histogram:{name:"Histogram",category:"ordinal",description:"Binned frequency distribution chart. Shows how data values are distributed across bins within categories.",required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],propBags:["common","ordinalAxis"],ownProps:{data:{type:"array",description:"Array of data objects"},categoryAccessor:{type:["string","function"],default:"category"},valueAccessor:{type:["string","function"],default:"value"},bins:{type:"number",default:25,description:"Number of bins for the histogram"},relative:{type:"boolean",default:!1,description:"Normalize counts per category to show relative frequency"},categoryPadding:{type:"number",default:20},brush:{type:"boolean",omitFromSchema:!0},onBrush:{type:"function",omitFromSchema:!0},linkedBrush:{type:["string","object"],omitFromSchema:!0}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:[]}},ViolinPlot:{name:"ViolinPlot",category:"ordinal",description:"Violin plots showing the full distribution shape (kernel density) per category. Combines density estimation with optional IQR lines.",required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],propBags:["common","ordinalAxis"],ownProps:{data:{type:"array",description:"Array of data objects"},categoryAccessor:{type:["string","function"],default:"category"},valueAccessor:{type:["string","function"],default:"value"},orientation:{type:"string",enum:_b,default:"vertical"},bins:{type:"number",default:25,description:"Number of bins for density estimation"},curve:{type:"string",default:"catmullRom",description:"Interpolation curve for the violin shape"},showIQR:{type:"boolean",default:!0,description:"Show interquartile range lines"},categoryPadding:{type:"number",default:20},brush:{type:"boolean",omitFromSchema:!0},onBrush:{type:"function",omitFromSchema:!0},linkedBrush:{type:["string","object"],omitFromSchema:!0}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["statistical"]}},RidgelinePlot:{name:"RidgelinePlot",category:"ordinal",description:"Overlapping density distributions for comparing distributions across categories. Each category gets a density curve that can overlap with adjacent rows.",required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],propBags:["common","ordinalAxis"],ownProps:{data:{type:"array",description:"Array of data objects"},categoryAccessor:{type:["string","function"],description:"Key for category grouping"},valueAccessor:{type:["string","function"],description:"Key for numeric values to build distributions from"},bins:{type:"number",description:"Number of bins for density estimation"},amplitude:{type:"number",default:1.5,description:"Unitless multiplier of row height (>1 creates overlap)"},categoryPadding:{type:"number",omitFromSchema:!0}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:[]}},DotPlot:{name:"DotPlot",category:"ordinal",description:"Cleveland-style dot plot for comparing values across categories. Sorted by default.",required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],propBags:["common","ordinalAxis"],ownProps:{data:{type:"array",description:"Array of data objects"},categoryAccessor:{type:["string","function"],default:"category"},valueAccessor:{type:["string","function"],default:"value"},orientation:{type:"string",enum:_b,default:"horizontal"},sort:{type:["boolean","string","function"],default:!0,description:"Sort dots: true, false, 'asc', 'desc'"},dotRadius:{type:"number",default:5},categoryPadding:{type:"number",default:10},showGrid:{type:"boolean",default:!0},regression:{type:["boolean","string","object"],description:"Overlay a regression line through the dots. Same shape as Scatterplot's regression prop."}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["regression-overlay"]}},PieChart:{name:"PieChart",category:"ordinal",description:"Proportional slices in a circle for part-to-whole relationships.",required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],propBags:["common"],ownProps:{data:{type:"array",description:"Array of data objects"},categoryAccessor:{type:["string","function"],default:"category"},valueAccessor:{type:["string","function"],default:"value"},startAngle:{type:"number",default:0,description:"Starting angle in radians"},cornerRadius:{type:"number",omitFromSchema:!0}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:[]}},DonutChart:{name:"DonutChart",category:"ordinal",description:"Pie chart with a hole in the center. Supports center content like summary statistics.",required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],propBags:["common"],ownProps:{data:{type:"array",description:"Array of data objects"},categoryAccessor:{type:["string","function"],default:"category"},valueAccessor:{type:["string","function"],default:"value"},innerRadius:{type:"number",default:60,description:"Inner radius of the donut hole in pixels"},centerContent:{type:["object","string","number"],description:"React node to render in the center of the donut (accepts string key or JSX)"},startAngle:{type:"number",default:0},cornerRadius:{type:"number",omitFromSchema:!0}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:[]}},GaugeChart:{name:"GaugeChart",category:"ordinal",description:"Single-value gauge with threshold zones, needle indicator, and configurable sweep angle. Built on StreamOrdinalFrame radial projection.",required:["value"],dataShape:"none",dataAccessors:[],propBags:["common"],ownProps:{value:{type:"number",description:"Current gauge value"},min:{type:"number",default:0},max:{type:"number",default:100},thresholds:{type:"array",description:"Array of { value, color, label? } defining threshold zones. Last value should equal max."},gradientFill:{type:"object",description:"Arc-length gradient for the gauge band. Color stops are sampled along the sweep from start to end."},arcWidth:{type:"number",default:.3,description:"Arc thickness as fraction of radius (0-1)"},cornerRadius:{type:"number",description:"Pixel radius for rounded segment ends. Same semantics as DonutChart's cornerRadius. Omit for sharp corners."},sweep:{type:"number",default:240,description:"Arc sweep angle in degrees (gap centered at bottom)"},fillZones:{type:"boolean",default:!0,description:"When true, the arc fills up to the current value; when false, the full arc is shown."},showNeedle:{type:"boolean",default:!0},needleColor:{type:"string"},color:{type:"string",description:"Fallback fill color used when no thresholds are defined"},valueFormat:{type:"function"},centerContent:{type:["object","string","number","function"],omitFromSchema:!0},showScaleLabels:{type:"boolean",default:!0},backgroundColor:{type:"string",omitFromSchema:!0}},capabilities:{renderModes:["hybrid"],supportsLegend:!1,supportsSelection:!1,supportsLinkedHover:!1,supportsPush:!1,supportsSSR:!0,colorModel:"threshold",layoutMode:"synthetic",specialFeatures:["threshold-zones","value-only","controlled-prop-streaming"]}},FunnelChart:{name:"FunnelChart",category:"ordinal",description:"Funnel visualization with two orientations. Horizontal (default): steps top-to-bottom with centered bars and trapezoid connectors; multi-category mirrors around center axis. Vertical: steps on x-axis as vertical bars with hatched dropoff stacking (solid = retained, hatched = dropoff from previous step); multi-category renders grouped bars.",required:["data"],dataShape:"array",dataAccessors:["stepAccessor","valueAccessor"],propBags:["common","ordinalAxis"],ownProps:{data:{type:"array",description:"Array of data objects with step and value fields"},stepAccessor:{type:["string","function"],default:"step",description:"Key for funnel step/stage name"},valueAccessor:{type:["string","function"],default:"value",description:"Key for numeric value per step"},categoryAccessor:{type:["string","function"],description:"Key to split each step into mirrored categories (optional)"},orientation:{type:"string",enum:Lb,default:"horizontal",description:"Horizontal (default): centered bars top-to-bottom with trapezoid connectors. Vertical: vertical bars with hatched dropoff stacking — solid = retained, hatched = dropoff from previous step. Multi-category renders grouped bars in vertical mode."},connectorOpacity:{type:"number",default:.3,description:"Opacity of trapezoid connectors between steps (0-1). Horizontal orientation only."},showCategoryTicks:{type:"boolean",default:!1,description:"Show category tick labels on ordinal axis"},responsiveWidth:{type:"boolean"},legendPosition:{type:"string",enum:Rb}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:[]}},SwimlaneChart:{name:"SwimlaneChart",category:"ordinal",description:"Categorical lanes with sequentially stacked items colored by subcategory. Unlike StackedBarChart, the same subcategory can appear multiple times in the same lane — items stack left-to-right (horizontal) or bottom-to-top (vertical) in data order. Supports brush for value-axis selection and push API for streaming.",required:["subcategoryAccessor"],dataShape:"array",dataAccessors:["categoryAccessor","subcategoryAccessor","valueAccessor"],propBags:["common","ordinalAxis"],ownProps:{data:{type:"array",description:"Array of data objects. Omit for push API mode."},categoryAccessor:{type:["string","function"],default:"category",description:"Key for lane categories (swim lanes)"},subcategoryAccessor:{type:["string","function"],description:"Key for item subcategory (color grouping within lanes). Required. Duplicate subcategories in the same lane stack sequentially."},valueAccessor:{type:["string","function"],default:"value",description:"Key for item size/duration along the value axis"},orientation:{type:"string",enum:Lb,default:"horizontal",description:"Horizontal renders lanes as rows; vertical as columns."},barPadding:{type:"number",default:40,description:"Padding between lanes in pixels"},roundedTop:{type:"number",description:"Rounded corner radius (px) applied to the outermost ends of each lane — left+right for horizontal, top+bottom for vertical. Middle segments stay square; single-segment lanes round all four corners."},brush:{type:"boolean",description:"Enable value-axis brush selection"},onBrush:{type:"function",description:"Callback with { r: [min, max] } or null when brush clears"},linkedBrush:{type:["string","object"],description:"LinkedCharts brush integration name"},showCategoryTicks:{type:"boolean",description:"Show lane labels on the category axis"},responsiveWidth:{type:"boolean"},legendPosition:{type:"string",enum:Rb}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["brush"]}},LikertChart:{name:"LikertChart",category:"ordinal",description:"Visualize Likert scale survey responses. Horizontal (default): diverging bar chart centered at 0% — negative levels extend left, positive right, neutral (if odd count) split 50/50 across centerline. Vertical: stacked 100% bar chart. Supports raw integer scores (1-based, aggregated automatically) or pre-aggregated (question, level, count) data. The levels array defines polarity: first half = negative, second half = positive, center = neutral (if odd). Works with any scale size (3-point to 7-point+). Supports push API for streaming — accumulates raw data and re-aggregates on each push.",required:[],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor","levelAccessor","countAccessor"],propBags:["common","ordinalAxis"],ownProps:{data:{type:"array",description:"Array of raw response or pre-aggregated data objects"},levels:{type:"array",default:zg,description:"Ordered response labels, most negative to most positive. Defaults to a 5-point Very Low to Very High scale. Odd count = center is neutral."},categoryAccessor:{type:["string","function"],default:"question",description:"Question/item field (ordinal axis)"},valueAccessor:{type:["string","function"],default:"score",description:"Integer score field for raw response mode (1-based: score 1 → levels[0])"},levelAccessor:{type:["string","function"],description:"Level name field for pre-aggregated mode. Each value must match an entry in levels."},countAccessor:{type:["string","function"],default:"count",description:"Count/frequency field for pre-aggregated mode"},orientation:{type:"string",enum:_b,default:"horizontal"},barPadding:{type:"number",default:20}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:[]}},LineChart:{name:"LineChart",category:"xy",description:"Line traces with curve interpolation, area fill, and point markers. Use for time series, trends, and continuous data.",required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],propBags:["common","xyAxis"],ownProps:{data:{type:"array",description:"Array of data objects"},xAccessor:{type:["string","function"],default:"x",description:"Key or accessor function for x-axis values"},yAccessor:{type:["string","function"],default:"y",description:"Key or accessor function for y-axis values"},lineBy:{type:["string","function"],description:"Key to group data into separate lines"},lineDataAccessor:{type:"string",default:"coordinates",description:"Key for the coordinates array within each line object"},curve:{type:"string",enum:Tb,default:"linear",description:"Curve interpolation method"},lineWidth:{type:"number",default:2,description:"Stroke width of the line"},showPoints:{type:"boolean",default:!1,description:"Show data point markers on the line"},pointRadius:{type:"number",default:3,description:"Radius of point markers when showPoints is true"},fillArea:{type:"boolean",default:!1,description:"Fill the area under the line"},areaOpacity:{type:"number",default:.3,description:"Opacity of the filled area (0-1)"},forecast:{type:"object",description:"Forecast overlay config — tagged training/observed/forecast region with optional envelope. See ForecastConfig."},anomaly:{type:"object",description:"Anomaly overlay config — ±σ band + anomaly dot annotations. See AnomalyConfig."},band:{type:["object","array"],description:"Asymmetric min/max envelope drawn under the line. `{ y0Accessor, y1Accessor, style?, perSeries?, interactive? }` or an array of those for percentile fans. Distinct from `forecast`/`anomaly` (computed) — band is pure data passthrough. Hovered datum is enriched with `band: { y0, y1 }` and `bands: [...]`."}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["forecast","anomaly","band","series-features","gap-handling","direct-labels","endpoint-labels"]}},AreaChart:{name:"AreaChart",category:"xy",description:"Filled area chart with optional stroke line. Use for showing volume or magnitude over time.",required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],propBags:["common","xyAxis"],ownProps:{data:{type:"array",description:"Array of data objects"},xAccessor:{type:["string","function"],default:"x",description:"Key for x-axis values"},yAccessor:{type:["string","function"],default:"y",description:"Key for y-axis values"},areaBy:{type:["string","function"],description:"Key to group data into separate areas"},lineDataAccessor:{type:"string",default:"coordinates",description:"Key for the coordinates array within each area object"},curve:{type:"string",enum:Tb,default:"monotoneX"},gradientFill:{type:["boolean","object"],description:"Renderer-space area gradient. true uses default opacity; object supports opacity or colorStops."},semanticGradient:{type:"array",description:"User-facing gradient stops: [{ at: 0-100, color, opacity? }], where 0 is baseline and 100 is line/top. Takes precedence over gradientFill."},areaOpacity:{type:"number",default:.7,description:"Area fill opacity (0-1)"},showLine:{type:"boolean",default:!0,description:"Show stroke line on top of area"},lineWidth:{type:"number",default:2},forecast:{type:"object",description:"Forecast overlay config — tagged training/observed/forecast region with optional envelope. See ForecastConfig."},anomaly:{type:"object",description:"Anomaly overlay config — ±σ band + anomaly dot annotations. See AnomalyConfig."},band:{type:["object","array"],description:"Asymmetric min/max envelope drawn under the area. See LineChart.band — same shape, same enrichment."}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["forecast","anomaly","band","series-features"]}},DifferenceChart:{name:"DifferenceChart",category:"xy",description:"Two-series difference chart: fills the area between series A and series B with a color that switches at each crossover — A's color where A > B, B's color where B > A. Crossovers are linearly interpolated so segments meet at zero-width vertices. Both series can be drawn as overlay lines on top of the fill. Classic uses: temperature anomaly (actual vs. normal), forecast accuracy (actual vs. predicted), budget variance.",required:[],dataShape:"array",dataAccessors:["xAccessor","seriesAAccessor","seriesBAccessor"],propBags:["common","xyAxis"],ownProps:{data:{type:"array",description:"Array of `{x, a, b}` objects. Omit for push API mode."},xAccessor:{type:["string","function"],default:"x",description:"Key for x values"},seriesAAccessor:{type:["string","function"],default:"a",description:"Key for series A values"},seriesBAccessor:{type:["string","function"],default:"b",description:"Key for series B values"},seriesALabel:{type:"string",default:"A",description:"Display label for series A in legend + tooltip"},seriesBLabel:{type:"string",default:"B",description:"Display label for series B"},seriesAColor:{type:"string",description:"Fill color when series A is higher. Defaults to var(--semiotic-danger)."},seriesBColor:{type:"string",description:"Fill color when series B is higher. Defaults to var(--semiotic-info)."},showLines:{type:"boolean",default:!0,description:"Draw the two series as overlay lines on top of the fill"},lineWidth:{type:"number",default:1.5},showPoints:{type:"boolean",default:!1,description:"Show points at each data vertex on the overlay lines"},pointRadius:{type:"number",default:3},curve:{type:"string",enum:Tb,default:"linear"},areaOpacity:{type:"number",default:.6,description:"Difference fill opacity (0-1)"},gradientFill:{type:["boolean","object"],description:"Tip→base gradient across each segment; same shape as AreaChart.gradientFill"},xExtent:{type:"array",description:"Fixed x domain `[min, max]`. Either bound may be `undefined`."},yExtent:{type:"array",description:"Fixed y domain `[min, max]`. Either bound may be `undefined`."},pointIdAccessor:{type:["string","function"],description:"Stable ID for push-mode remove()/update()"},windowSize:{type:"number",description:"Max raw rows in the push buffer; older rows evict FIFO. Recommended for long-running streams."}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["crossover-segmentation"]}},StackedAreaChart:{name:"StackedAreaChart",category:"xy",description:"Stacked area chart with optional normalization to 100%. Use for part-to-whole trends over time.",required:["data","areaBy"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],propBags:["common","xyAxis"],ownProps:{data:{type:"array",description:"Array of data objects"},xAccessor:{type:["string","function"],default:"x"},yAccessor:{type:["string","function"],default:"y"},areaBy:{type:["string","function"],description:"Key to group data into stacked areas"},lineDataAccessor:{type:"string",default:"coordinates"},curve:{type:"string",enum:Tb,default:"monotoneX"},areaOpacity:{type:"number",default:.7},showLine:{type:"boolean",default:!0},lineWidth:{type:"number",default:2},normalize:{type:"boolean",default:!1,description:"Normalize stacks to 100%"}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["stack","streamgraph"]}},Scatterplot:{name:"Scatterplot",category:"xy",description:"Individual data points plotted by x/y position with optional size and color encoding.",required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],propBags:["common","xyAxis"],ownProps:{data:{type:"array",description:"Array of data objects"},xAccessor:{type:["string","function"],default:"x"},yAccessor:{type:["string","function"],default:"y"},sizeBy:{type:["string","function"],description:"Key for variable point sizing"},sizeRange:{type:"array",default:[3,15],description:"Min and max radius for sizeBy scaling"},symbolBy:{type:["string","function"],description:"Categorical field → glyph shape; each mark renders as a d3-shape glyph (circle/square/triangle/diamond/star/cross/wye/chevron) instead of a circle."},symbolMap:{type:"object",description:"Explicit {category → shape} map for symbolBy; unmapped categories auto-assign."},pointRadius:{type:"number",default:5,description:"Fixed point radius"},pointOpacity:{type:"number",default:.8},regression:{type:["boolean","string","object"],description:"Overlay a regression line. true = linear, 'linear' | 'polynomial' | 'loess' = method, or full RegressionConfig object. Sugar over the trend annotation."},forecast:{type:"object",description:"Forecast overlay config — tagged future points + optional envelope. See ForecastConfig."},anomaly:{type:"object",description:"Anomaly overlay config — ±σ band + anomaly dot annotations. See AnomalyConfig."}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["regression-overlay","forecast","anomaly","series-features"]}},BubbleChart:{name:"BubbleChart",category:"xy",description:"Scatterplot with required size dimension for three-variable comparison. Bubble area encodes a numeric value.",required:["data","sizeBy"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],propBags:["common","xyAxis"],ownProps:{data:{type:"array",description:"Array of data objects"},sizeBy:{type:["string","function"],description:"Key for bubble size (required)"},xAccessor:{type:["string","function"],default:"x"},yAccessor:{type:["string","function"],default:"y"},sizeRange:{type:"array",default:[5,40]},bubbleOpacity:{type:"number",default:.6},bubbleStrokeWidth:{type:"number",default:1},bubbleStrokeColor:{type:"string",default:"white"},regression:{type:["boolean","string","object"],description:"Overlay a regression line on the bubbles. Same shape as Scatterplot's regression prop."}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["size-encoding","streaming-domain","regression-overlay"]}},Heatmap:{name:"Heatmap",category:"xy",description:"Grid/matrix visualization with color-encoded cell values. Use for correlation matrices, time-frequency analysis.",required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor","valueAccessor"],propBags:["common","xyAxis"],ownProps:{data:{type:"array",description:"Array of data objects with x, y, and value"},xAccessor:{type:["string","function"],default:"x"},yAccessor:{type:["string","function"],default:"y"},valueAccessor:{type:["string","function"],default:"value",description:"Key for the cell value"},colorScheme:{type:"string",enum:["blues","reds","greens","viridis","custom"]},customColorScale:{type:["object","function"],omitFromSchema:!0},showValues:{type:"boolean",default:!1,description:"Display numeric values in cells"},valueFormat:{type:"function"},cellBorderColor:{type:"string",default:"#fff"},cellBorderWidth:{type:"number",default:1},legendPosition:{type:"string",enum:Rb,default:"right",description:"Position of the gradient legend"}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"sequential",layoutMode:"plugin",specialFeatures:[]}},QuadrantChart:{name:"QuadrantChart",category:"xy",description:"Scatterplot divided into four labeled, colored quadrants by center lines. Use for BCG matrices, priority matrices, and any 2x2 strategic framework.",required:[],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],propBags:["common","xyAxis"],ownProps:{data:{type:"array",description:"Array of data objects"},xAccessor:{type:["string","function"],default:"x"},yAccessor:{type:["string","function"],default:"y"},xCenter:{type:"number",description:"X-coordinate of the vertical center line. Defaults to midpoint of x domain."},yCenter:{type:"number",description:"Y-coordinate of the horizontal center line. Defaults to midpoint of y domain."},quadrants:{type:"object",default:Yf,description:"Optional configuration overrides for the four quadrants: { topRight, topLeft, bottomRight, bottomLeft }, each with partial { label, color, opacity }. Omitted quadrants and fields use built-in defaults."},centerlineStyle:{type:"object",omitFromSchema:!0},showQuadrantLabels:{type:"boolean",default:!0},quadrantLabelSize:{type:"number",default:12},sizeBy:{type:["string","function"],description:"Key for variable point sizing"},sizeRange:{type:"array",default:[3,15]},pointRadius:{type:"number",default:5},pointOpacity:{type:"number",default:.8}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["quadrants"]}},MultiAxisLineChart:{name:"MultiAxisLineChart",category:"xy",description:"Dual Y-axis line chart for comparing two series with different scales on the same x axis. Data is unitized (normalized to [0,1]) internally; left axis shows series[0] values and right axis shows series[1] values in original units. Falls back to standard multi-line if not exactly 2 series.",required:["series"],dataShape:"array",dataAccessors:["xAccessor"],propBags:["common","xyAxis"],ownProps:{data:{type:"array",description:"Array of data objects shared by both series"},xAccessor:{type:["string","function"],default:"x",description:"Key for x values"},series:{type:"array",description:"Exactly 2 series configs for dual-axis mode. Each: { yAccessor, label?, color?, format?, extent? }"},colorScheme:{type:["string","array"]},curve:{type:"string",default:"monotoneX"},lineWidth:{type:"number",default:2}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!1,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["dual-axis","hoc-ssr-only"]}},CandlestickChart:{name:"CandlestickChart",category:"xy",description:"OHLC candlestick bars, or a range chart when open/close are omitted. Honors mode (primary/context/sparkline). Range variant degrades cleanly: endpoint dots + wick, sized against canvas height so sparkline rows don't render marble-sized dots.",required:["highAccessor","lowAccessor"],dataShape:"array",dataAccessors:["xAccessor","highAccessor","lowAccessor"],propBags:["common","xyAxis"],ownProps:{data:{type:"array"},xAccessor:{type:["string","function"],default:"x"},highAccessor:{type:["string","function"],default:"high",description:"Required. Upper bound (candlestick high or range top)."},lowAccessor:{type:["string","function"],default:"low",description:"Required. Lower bound (candlestick low or range bottom)."},openAccessor:{type:["string","function"],description:"Optional. Pair with closeAccessor for OHLC; omit both to render a range chart."},closeAccessor:{type:["string","function"],description:"Optional. See openAccessor."},candlestickStyle:{type:"object",description:"Style overrides."},mode:{type:"string",enum:["primary","context","sparkline"]}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["ohlc"]}},ConnectedScatterplot:{name:"ConnectedScatterplot",category:"xy",description:"Scatterplot where points are connected in order, showing trajectories through 2D space. Viridis-colored start→end, white halo under lines.",required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],propBags:["common","xyAxis"],ownProps:{data:{type:"array",description:"Array of data objects"},xAccessor:{type:["string","function"],default:"x",description:"Key for x-axis values"},yAccessor:{type:["string","function"],default:"y",description:"Key for y-axis values"},orderAccessor:{type:["string","function"],description:"Key for point ordering (number or Date field)"},orderLabel:{type:"string",description:"Label for the ordering metric in tooltips"},pointRadius:{type:"number",default:4,description:"Point radius"},pointIdAccessor:{type:["string","function"],description:"Accessor for unique point IDs, used by point-anchored annotations"},regression:{type:["boolean","string","object"],description:"Overlay a regression line under the connected path. Same shape as Scatterplot's regression prop."},forecast:{type:"object",description:"Forecast overlay config — same shape as LineChart's forecast prop."},anomaly:{type:"object",description:"Anomaly overlay config — ±σ band + anomaly dot annotations."}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["regression-overlay","forecast","anomaly","series-features"]}},ScatterplotMatrix:{name:"ScatterplotMatrix",category:"xy",description:"Multi-panel scatterplot grid with crossfilter brushing. Requires data array with numeric fields.",required:["data","fields"],dataShape:"array",dataAccessors:[],propBags:["common"],ownProps:{data:{type:"array"},fields:{type:"array"}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!1,supportsLinkedHover:!1,supportsPush:!1,supportsSSR:!1,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["matrix","brush","composite-delegates-interaction","hoc-ssr-only"]}},MinimapChart:{name:"MinimapChart",category:"xy",description:"Overview + detail chart with linked zoom. Wraps an XY chart with a minimap navigation pane.",required:["data"],dataShape:"array",dataAccessors:[],propBags:["common"],ownProps:{data:{type:"array"}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!1,supportsLinkedHover:!1,supportsPush:!1,supportsSSR:!1,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["brush","overview-detail","composite-delegates-interaction","hoc-ssr-only"]}},ForceDirectedGraph:{name:"ForceDirectedGraph",category:"network",description:"Physics-based node-link diagram. Use for relationships, social networks, knowledge graphs.",required:["nodes","edges"],dataShape:"network",dataAccessors:["nodeIDAccessor","sourceAccessor","targetAccessor"],propBags:["common"],ownProps:{nodes:{type:"array",description:"Array of node objects"},edges:{type:"array",description:"Array of edge objects with source and target"},nodeIDAccessor:{type:["string","function"],default:"id",description:"Key for node unique identifier"},sourceAccessor:{type:["string","function"],default:"source",description:"Key for edge source node ID"},targetAccessor:{type:["string","function"],default:"target",description:"Key for edge target node ID"},nodeLabel:{type:["string","function"],description:"Key or accessor for node labels"},nodeSize:{type:["number","string","function"],default:8,description:"Fixed node radius or key for variable sizing"},nodeSizeRange:{type:"array",default:[5,20]},edgeWidth:{type:["number","string","function"],default:1,description:"Fixed edge width or key for variable width"},edgeColor:{type:"string",default:"#999"},edgeOpacity:{type:"number",default:.6},iterations:{type:"number",default:300,description:"Force simulation iterations"},forceStrength:{type:"number",default:.1},layoutExecution:{type:"string",enum:["auto","worker","sync"],default:"auto",description:"Force layout execution: auto, worker, or sync"},showLabels:{type:"boolean",default:!1}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["force-simulation"]}},SankeyDiagram:{name:"SankeyDiagram",category:"network",description:"Flow diagram showing weighted connections between nodes. Use for flows, budgets, process mapping.",required:["edges"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],propBags:["common"],ownProps:{edges:{type:"array",description:"Array of edge objects with source, target, and value"},nodes:{type:"array",description:"Optional array of node objects (auto-derived from edges if omitted)"},sourceAccessor:{type:["string","function"],default:"source"},targetAccessor:{type:["string","function"],default:"target"},valueAccessor:{type:["string","function"],default:"value",description:"Key for edge flow value"},nodeIdAccessor:{type:["string","function"],default:"id"},edgeColorBy:{type:["string","function"],enum:["source","target","gradient"],default:"source",description:"How to color edges"},orientation:{type:"string",enum:_b,default:"horizontal"},nodeAlign:{type:"string",enum:["justify","left","right","center"],default:"justify"},nodePaddingRatio:{type:"number",default:.05},nodeWidth:{type:"number",default:15},nodeLabel:{type:["string","function"],description:"Key for node labels"},showLabels:{type:"boolean",default:!0},edgeOpacity:{type:"number",default:.5},edgeSort:{type:"function",omitFromSchema:!0}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:[]}},ProcessSankey:{name:"ProcessSankey",category:"network",description:"Temporal sankey with a real time x-axis. Edges carry startTime/endTime; nodes can declare an explicit xExtent lifetime. Use for timestamped flow events (PR commits, campaign-finance contributions, supply-chain shipments).",required:["domain"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],propBags:["common"],ownProps:{edges:{type:"array",description:"Array of timed edge records with source, target, value, startTime, endTime. Omit for push-mode."},nodes:{type:"array",description:"Optional array of node objects. Nodes may carry an `xExtent: [start, end]` to bound the lane explicitly."},domain:{type:"array",description:"[tStart, tEnd] of the chart's x-axis (required)."},axisTicks:{type:"array",description:"Optional [{ date, label }] tick array for the time axis."},sourceAccessor:{type:["string","function"],default:"source"},targetAccessor:{type:["string","function"],default:"target"},valueAccessor:{type:["string","function"],default:"value"},nodeIdAccessor:{type:["string","function"],default:"id"},startTimeAccessor:{type:["string","function"],default:"startTime"},endTimeAccessor:{type:["string","function"],default:"endTime"},xExtentAccessor:{type:["string","function"],default:"xExtent"},edgeIdAccessor:{type:["string","function"],default:"id"},legendPosition:{type:"string",enum:["right","left","top","bottom"],default:"right"},pairing:{type:"string",enum:["value","temporal"],default:"temporal",description:"Edge-side pairing strategy at transit nodes."},packing:{type:"string",enum:["off","reuse"],default:"reuse",description:"Lane reuse — pack lifetime-disjoint nodes into the same row."},laneOrder:{type:"string",enum:["insertion","crossing-min","inside-out","crossing-min+inside-out"],default:"crossing-min"},ribbonLane:{type:"string",enum:["source","target","both"],default:"both"},lifetimeMode:{type:"string",enum:["full","half"],default:"half"},showLaneRails:{type:"boolean",default:!1},showQualityReadout:{type:"boolean",default:!1},edgeOpacity:{type:"number",default:.35},timeFormat:{type:"function",omitFromSchema:!0},valueFormat:{type:"function",omitFromSchema:!0},showParticles:{type:"boolean",default:!1},particleStyle:{type:"object",description:"ParticleStyle config — same shape as SankeyDiagram. Defaults from DEFAULT_PARTICLE_STYLE (radius 3, opacity 0.7, spawnRate 0.1, maxPerEdge 50)."}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"custom",specialFeatures:["temporal","particles","lane-reuse"]}},ChordDiagram:{name:"ChordDiagram",category:"network",description:"Circular diagram showing inter-relationships and flow volumes between groups.",required:["edges"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],propBags:["common"],ownProps:{edges:{type:"array",description:"Array of edge objects with source, target, and value"},nodes:{type:"array",description:"Optional array of node objects"},sourceAccessor:{type:["string","function"],default:"source"},targetAccessor:{type:["string","function"],default:"target"},valueAccessor:{type:["string","function"],default:"value"},nodeIdAccessor:{type:["string","function"],default:"id"},edgeColorBy:{type:["string","function"],enum:["source","target"],default:"source"},padAngle:{type:"number",default:.01},groupWidth:{type:"number",default:20},sortGroups:{type:"function",omitFromSchema:!0},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean",default:!0},edgeOpacity:{type:"number",default:.5}},capabilities:{renderModes:["hybrid"],supportsLegend:!1,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:[]}},TreeDiagram:{name:"TreeDiagram",category:"network",description:"Hierarchical tree layout. Supports tree, cluster, partition, and radial orientations. Data is a single root node with children.",required:["data"],dataShape:"object",dataAccessors:[],propBags:["common"],ownProps:{data:{type:"object",description:"Root node object with nested children"},layout:{type:"string",enum:["tree","cluster","partition","treemap","circlepack"],default:"tree"},orientation:{type:"string",enum:["vertical","horizontal","radial"],default:"vertical"},childrenAccessor:{type:["string","function"],default:"children",description:"Key for the children array in each node"},valueAccessor:{type:["string","function"],default:"value"},nodeIdAccessor:{type:["string","function"],default:"name"},colorByDepth:{type:"boolean",default:!1,description:"Color nodes by their depth in the hierarchy"},edgeStyle:{type:"string",enum:["line","curve"],default:"curve"},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean",default:!0},nodeSize:{type:"number",default:5}},capabilities:{renderModes:["hybrid"],supportsLegend:!1,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!1,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["hierarchy"]}},Treemap:{name:"Treemap",category:"network",description:"Space-filling rectangular hierarchy visualization. Data is a single root node with nested children.",required:["data"],dataShape:"object",dataAccessors:[],propBags:["common"],ownProps:{data:{type:"object",description:"Root node object with nested children"},childrenAccessor:{type:["string","function"],default:"children"},valueAccessor:{type:["string","function"],default:"value"},nodeIdAccessor:{type:["string","function"],default:"name"},colorByDepth:{type:"boolean",default:!1},showLabels:{type:"boolean",default:!0},nodeLabel:{type:["string","function"]},nodeStyle:{type:"function",omitFromSchema:!0,description:"Per-node style overlay merged on top of Treemap's built-in color encoding"}},capabilities:{renderModes:["hybrid"],supportsLegend:!1,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!1,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["hierarchy"]}},CirclePack:{name:"CirclePack",category:"network",description:"Nested circles representing hierarchical data. Data is a single root node with nested children.",required:["data"],dataShape:"object",dataAccessors:[],propBags:["common"],ownProps:{data:{type:"object",description:"Root node object with nested children"},childrenAccessor:{type:["string","function"],default:"children"},valueAccessor:{type:["string","function"],default:"value"},nodeIdAccessor:{type:["string","function"],default:"name"},colorByDepth:{type:"boolean",default:!1},showLabels:{type:"boolean",default:!0},nodeLabel:{type:["string","function"]},circleOpacity:{type:"number",default:.7}},capabilities:{renderModes:["hybrid"],supportsLegend:!1,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!1,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["hierarchy"]}},OrbitDiagram:{name:"OrbitDiagram",category:"network",description:"Animated orbital diagram showing hierarchical data as nodes orbiting a center. Supports flat, solar, atomic, and custom ring arrangements.",required:["data"],dataShape:"object",dataAccessors:[],propBags:["common"],ownProps:{data:{type:"object",description:"Hierarchical root object with children: { name: 'root', children: [...] }"},childrenAccessor:{type:["string","function"],default:"children",description:"Key to access children from each datum"},nodeIdAccessor:{type:["string","function"],default:"name",description:"Key to identify each node"},colorByDepth:{type:"boolean",default:!1,description:"Color by hierarchy depth"},orbitMode:{type:["string","array"],default:"flat",description:"Ring arrangement: 'flat', 'solar', 'atomic', or number[]"},orbitSize:{type:["number","function"],default:2.95,description:"Ring size divisor per depth"},speed:{type:"number",default:.25,description:"Orbit speed in degrees per frame"},eccentricity:{type:["number","function"],default:1,description:"Vertical squash for elliptical orbits (1 = circle)"},showRings:{type:"boolean",default:!0,description:"Show orbital ring paths"},nodeRadius:{type:["number","function"],default:6,description:"Node radius"},showLabels:{type:"boolean",default:!1,description:"Show node labels"},animated:{type:"boolean",default:!0,description:"Enable animation"},revolution:{type:"function",omitFromSchema:!0},foregroundGraphics:{type:"object",omitFromSchema:!0}},capabilities:{renderModes:["hybrid"],supportsLegend:!1,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!1,supportsSSR:!1,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["hierarchy","animated","hoc-ssr-only"]}},ChoroplethMap:{name:"ChoroplethMap",category:"geo",description:"Geographic choropleth map with colored regions based on data values.",required:["areas"],dataShape:"array",dataAccessors:["valueAccessor"],propBags:["common"],ownProps:{areas:{type:["array","string"],description:"GeoJSON features or reference geography name"},valueAccessor:{type:["string","function"]},colorScheme:{type:["string","array"]},projection:{type:"string",default:"equalEarth"}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!1,supportsSSR:!0,colorModel:"sequential",layoutMode:"plugin",specialFeatures:["controlled-prop-streaming"]}},ProportionalSymbolMap:{name:"ProportionalSymbolMap",category:"geo",description:"Geographic map with sized symbols at point locations.",required:["points"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],propBags:["common"],ownProps:{points:{type:"array"},xAccessor:{type:["string","function"],default:"lon"},yAccessor:{type:["string","function"],default:"lat"},sizeBy:{type:["string","function"]},areas:{type:["array","string"]}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"sequential",layoutMode:"plugin",specialFeatures:[]}},FlowMap:{name:"FlowMap",category:"geo",description:"Geographic flow map showing movement between locations with animated particles.",required:["flows"],dataShape:"array",dataAccessors:[],propBags:["common"],ownProps:{flows:{type:"array"},nodes:{type:"array"},valueAccessor:{type:["string","function"]},lineIdAccessor:{type:["string","function"]}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["particles"]}},DistanceCartogram:{name:"DistanceCartogram",category:"geo",description:"Cartogram distorting geographic positions based on travel time or cost from a center point.",required:["points"],dataShape:"array",dataAccessors:[],propBags:["common"],ownProps:{points:{type:"array"},center:{type:"array"},costAccessor:{type:["string","function"]}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!1,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["distortion","hoc-ssr-only"]}},RealtimeLineChart:{name:"RealtimeLineChart",category:"realtime",description:"Streaming line chart rendered on canvas. Uses ref-based push API for high-frequency data.",required:[],dataShape:"realtime",dataAccessors:[],propBags:["realtime"],ownProps:{stroke:{type:"string"},strokeWidth:{type:"number"},strokeDasharray:{type:"string"},transition:{type:"object",description:"Transition config: { duration, easing }"}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!1,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["live-stream"]}},RealtimeHistogram:{name:"RealtimeHistogram",category:"realtime",description:"Streaming bar chart with binned aggregation. Uses ref-based push API.",required:["binSize"],dataShape:"realtime",dataAccessors:[],propBags:["realtime"],ownProps:{binSize:{type:"number",description:"Time bin size in milliseconds (required)"},direction:{type:"string",enum:["up","down"],default:"up",description:'Bar growth direction. Use "down" for mirrored histograms; explicit valueExtent is reversed.'},categoryAccessor:{type:["string","function"],description:"Key for category grouping"},colors:{type:"object",description:"Map of category to color string"},fill:{type:"string"},stroke:{type:"string"},strokeWidth:{type:"number"},gap:{type:"number"},brush:{type:["boolean","string","object"],description:'Enable brush selection. true defaults to { dimension: "x", snap: "bin" }. String: "x". Object: { dimension, snap: "continuous"|"bin", snapDuring }.'},onBrush:{type:"function",description:"Callback when brush extent changes: (extent | null) => void"},linkedBrush:{type:["string","object"],description:"Cross-chart brush coordination via LinkedCharts. String: selection name. Object: { name, xField, yField }."},transition:{type:"object",description:"Transition config: { duration, easing }"}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!1,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["live-stream","brush"]}},TemporalHistogram:{name:"TemporalHistogram",category:"realtime",description:"Static-data temporal histogram with binned aggregation. Use when data is a bounded array rather than a push stream.",required:["data","binSize"],dataShape:"array",dataAccessors:["timeAccessor","valueAccessor","categoryAccessor"],propBags:[],ownProps:{data:{type:"array",description:"Array of temporal observations"},binSize:{type:"number",description:"Time bin size in milliseconds (required)"},size:{type:"array",description:"[width, height] in pixels"},width:{type:"number",description:"Alias for size[0]"},height:{type:"number",description:"Alias for size[1]"},margin:{type:"object",description:'Object margin. A side value of "auto" or null leaves that side available for auto-reservation.'},className:{type:"string"},timeAccessor:{type:["string","function"],description:"Key for time/x values"},valueAccessor:{type:["string","function"],description:"Key for y values"},direction:{type:"string",enum:["up","down"],default:"up",description:'Bar growth direction. Use "down" for mirrored histograms; explicit valueExtent is reversed.'},categoryAccessor:{type:["string","function"],description:"Key for category grouping"},colors:{type:"object",description:"Map of category to color string"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltip:{type:["function","object"],description:"Tooltip content function or config"},tooltipContent:{type:"function",omitFromSchema:!0},onHover:{type:"function",omitFromSchema:!0},annotations:{type:"array"},autoPlaceAnnotations:{type:["boolean","object"],description:"Opt-in annotation placement pass for note-like annotations without manual offsets."},responsiveRules:{type:"array",description:"Semantic responsive transforms applied before chart-mode defaults."},mobileSemantics:{type:"object",description:"Phone/mobile contract consumed by audits, recipes, adapters, and agents."},mobileInteraction:{type:["boolean","object"],description:"Touch-first interaction policy for phone-sized chart slots."},svgAnnotationRules:{type:"function",omitFromSchema:!0},tickFormatTime:{type:"function",omitFromSchema:!0},tickFormatValue:{type:"function",omitFromSchema:!0},fill:{type:"string"},stroke:{type:"string"},strokeWidth:{type:"number"},gap:{type:"number"},linkedHover:{type:["boolean","string","object"]},linkedBrush:{type:["string","object"],description:"Cross-chart brush coordination via LinkedCharts. String: selection name. Object: { name, xField, yField }."},brush:{type:["boolean","string","object"],description:'Enable brush selection. true defaults to { dimension: "x", snap: "bin" }. String: "x". Object: { dimension, snap: "continuous"|"bin", snapDuring }.'},onBrush:{type:"function",description:"Callback when brush extent changes: (extent | null) => void",omitFromSchema:!0}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!1,supportsSSR:!1,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["brush"]}},RealtimeSwarmChart:{name:"RealtimeSwarmChart",category:"realtime",description:"Streaming swarm/scatter chart showing individual data points over time.",required:[],dataShape:"realtime",dataAccessors:[],propBags:["realtime"],ownProps:{categoryAccessor:{type:["string","function"]},colors:{type:"object"},radius:{type:"number"},fill:{type:"string"},opacity:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},pointStyle:{type:"function",description:"Per-datum style callback. Overrides fill, stroke, strokeWidth, opacity, and radius via r.",omitFromSchema:!0},yScaleType:{type:"string",enum:["linear","log","symlog"],description:"Value-axis scale. symlog preserves zero and negative values while compressing large magnitudes."},transition:{type:"object",description:"Transition config: { duration, easing }"}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!1,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["live-stream"]}},RealtimeWaterfallChart:{name:"RealtimeWaterfallChart",category:"realtime",description:"Streaming waterfall chart with positive/negative bars and connectors.",required:[],dataShape:"realtime",dataAccessors:[],propBags:["realtime"],ownProps:{positiveColor:{type:"string"},negativeColor:{type:"string"},connectorStroke:{type:"string"},connectorWidth:{type:"number"},gap:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},transition:{type:"object",description:"Transition config: { duration, easing }"}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!1,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["live-stream"]}},RealtimeHeatmap:{name:"RealtimeHeatmap",category:"realtime",description:"Streaming 2D heatmap with binned time and value aggregation.",required:[],dataShape:"realtime",dataAccessors:[],propBags:["realtime"],ownProps:{heatmapXBins:{type:"number"},heatmapYBins:{type:"number"},aggregation:{type:"string",enum:["count","sum","mean"]}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!1,colorModel:"sequential",layoutMode:"plugin",specialFeatures:["live-stream"]}},GaltonBoardChart:{name:"GaltonBoardChart",category:"physics",description:"Physics-backed Galton board / Plinko-style dot distribution. Values enter deterministic bins and settle into a readable histogram-like projection; mechanical mode can generate a seeded no-data demonstration.",required:[],dataShape:"array",dataAccessors:["valueAccessor"],propBags:["physics"],ownProps:{valueAccessor:{type:["string","function"],default:"value",description:"Numeric field used to assign bodies to Galton bins."},valueExtent:{type:"array",description:"Stable numeric [min, max] domain for binning and reference-line placement."},bins:{type:"number",default:21,description:"Number of landing bins / histogram columns."},mode:{type:"string",enum:["sample","mechanical"],default:"sample",description:"sample uses data values; mechanical emits a deterministic demonstration when no data is supplied."},pegRows:{type:"number",description:"Number of Bernoulli branch rows used by mechanical mode."},mechanicalCount:{type:"number",description:"Number of generated bodies in mechanical mode."},branchProbability:{type:"number",default:.5,description:"Probability that each mechanical sample branches right at a peg."},referenceLines:{type:["object","array"],description:"One or more value markers drawn over the board: { value, label, color, strokeWidth, strokeDasharray, labelPosition }."},showProjection:{type:"boolean",description:"Whether companion docs or wrappers should show the settled projection."}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!1,supportsLinkedHover:!1,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"synthetic",specialFeatures:["physics-simulation","settled-projection","deterministic-seed"]}},EventDropChart:{name:"EventDropChart",category:"physics",description:"Physics-backed event-time drop chart for arrival replay, window barriers, and late/watermark handling.",required:["data"],dataShape:"array",dataAccessors:["timeAccessor","arrivalAccessor"],propBags:["physics"],ownProps:{timeAccessor:{type:["string","function"],default:"time",description:"Event-time field used to assign drops to windows."},arrivalAccessor:{type:["string","function"],default:"arrivalTime",description:"Arrival-time field used to pace event ingestion."},windows:{type:"object",description:"Windowing config, currently { size, gapPolicy? }."},watermark:{type:["object","function"],description:"Watermark config: { delay }, { value }, or a function of latest event time."},timeExtent:{type:"array",description:"Optional stable event-time extent [min, max] for the window layout."},timeScale:{type:"number",default:1,description:"Playback speed for event-arrival pacing; higher is faster (1 = real event-time)."}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!1,supportsLinkedHover:!1,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"synthetic",specialFeatures:["physics-simulation","event-time","watermark","arrival-pacing","settled-projection"]}},PhysicsPileChart:{name:"PhysicsPileChart",category:"physics",description:"Physics-backed unit pile chart. Numeric values are unitized into repeated bodies that settle into category piles.",required:[],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],propBags:["physics"],ownProps:{categoryAccessor:{type:["string","function"],default:"category",description:"Categorical field that chooses the pile / bin."},valueAccessor:{type:["string","function"],default:"value",description:"Numeric field converted into repeated unit bodies."},mode:{type:"string",enum:["sample","mechanical"],default:"sample",description:"sample uses data values; mechanical emits a deterministic no-data unit pile for design sketches."},mechanicalCount:{type:"number",description:"Number of generated unit bodies in mechanical mode."},mechanicalCategories:{type:"array",description:"Category labels generated by mechanical mode."},unitValue:{type:"number",default:1,description:"Value represented by one simulated body."},showProjection:{type:"boolean",default:!0,description:"Draw an exact settled-projection overlay behind the moving units so category totals remain readable."},sediment:{type:"boolean",description:"Reserved for future sediment/aggregation mode."}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!1,supportsLinkedHover:!1,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"synthetic",specialFeatures:["physics-simulation","unitized","settled-projection"]}},CollisionSwarmChart:{name:"CollisionSwarmChart",category:"physics",description:"Physics-backed swarm / dot-strip chart. Quantitative records spring toward an x-position while collisions separate overlapping dots into a readable distribution.",required:[],dataShape:"array",dataAccessors:["xAccessor","groupAccessor","radiusAccessor"],propBags:["physics"],ownProps:{xAccessor:{type:["string","function"],default:"x",description:"Quantitative field that anchors each body along the x-axis."},groupAccessor:{type:["string","function"],description:"Optional categorical field that creates separate swarm lanes."},radiusAccessor:{type:["string","function"],description:"Optional numeric field used as per-body radius in pixels."},pointRadius:{type:"number",default:5,description:"Fallback radius for each simulated body."},xExtent:{type:"array",description:"Optional [min, max] domain for the quantitative axis."},collisionIterations:{type:"number",default:6,description:"Collision solver iterations per fixed physics step."},settle:{type:"boolean",description:"Start bodies near their target positions for a calmer first paint or reduced-motion demo."},showProjection:{type:"boolean",default:!0,description:"Draw x-axis and group-lane guides behind the moving bodies."}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!1,supportsLinkedHover:!1,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"synthetic",specialFeatures:["physics-simulation","collision-layout","settled-projection"]}},GauntletChart:{name:"GauntletChart",category:"physics",description:"Physics-backed compound-plan gauntlet. A project core carries tethered positive/negative property bodies through timed gate events; settled projection is viability and outcome, not trajectories.",required:["negativeProperties"],dataShape:"array",dataAccessors:["idAccessor","positiveAccessor","negativeAccessor","metricsAccessor","startTimeAccessor"],propBags:["physics"],ownProps:{positiveProperties:{type:"array",default:[],description:"Optional lift/value property definitions attached to each project core. Omit or pass an empty array for negative-only compound bodies."},negativeProperties:{type:"array",description:"Drag/cost property definitions attached to each project core."},gates:{type:"array",description:"Named process gates along the route, with optional shared FIFO capacity."},events:{type:["array","function"],description:"Timed gate effects that add/pop properties and set outcomes."},startTimeAccessor:{type:["string","function"],description:"Optional per-project simulation second used as the local event-timeline origin."},onCapacityChange:{type:"function",description:"Receives visit-aware queue work, wait, overflow, throughput, utilization, and pressure snapshots."},crashDetection:{type:"boolean",default:!0,description:"Treat the crash line as a live failure trigger."},showChrome:{type:"boolean",default:!0,description:"Draw route, socket, and graveyard chrome."},showProjection:{type:"boolean",default:!0,description:"Draw settled viability/outcome strip."},showTethers:{type:"boolean",default:!0,description:"Draw tethers between cores and property bodies."},coreForceMode:{type:"string",enum:["route","net"],default:"route",description:"Core-body vertical force model: authored route guidance or net lift/drag drift."},terminalBehavior:{type:"string",enum:["outcome","hold-last"],default:"outcome"}},capabilities:{renderModes:["hybrid"],supportsLegend:!1,supportsSelection:!1,supportsLinkedHover:!1,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"synthetic",specialFeatures:["physics-simulation","process-gauntlet","settled-projection"]}},ProcessFlowChart:{name:"ProcessFlowChart",category:"physics",description:"Physics-backed multi-body process flow. Work items move through ordered stages with optional capacity, pressure, portals, absorb sinks, and feature groups that complete only when every member is absorbed.",required:["stages"],dataShape:"array",dataAccessors:["idAccessor","stageAccessor","groupBy","workAccessor","radiusAccessor"],propBags:["physics"],ownProps:{stages:{type:"array",description:"Ordered process stages: { id, label?, force?, damping?, capacity?, pressure?, portal?, absorb? }."},stageAccessor:{type:["string","function"],default:"stage",description:"Field or accessor for each work item's current stage id."},idAccessor:{type:["string","function"],description:"Stable work-item id."},groupBy:{type:["string","function"],description:"Optional feature/group key. Groups complete when all members reach an absorb stage."},groupLabelAccessor:{type:["string","function"],description:"Display label for group anchors."},workAccessor:{type:["string","function"],description:"Work-units field stamped for capacity metadata."},radiusAccessor:{type:["string","function"],description:"Optional per-body radius in pixels."},ballRadius:{type:"number",default:6,description:"Fallback body radius."},groupCompletion:{type:"string",enum:["allAbsorbed","none"],default:"allAbsorbed when groupBy is set",description:"How feature groups report completion."},groupAnchorAlong:{type:"number",description:"0–1 position along the lane for group anchors."},showProjection:{type:"boolean",default:!0,description:"Draw settled stage-count bars."},showChrome:{type:"boolean",default:!0,description:"Draw stage labels, capacity notes, and group anchors."},settle:{type:"boolean",description:"Start bodies at stage targets for a calmer first paint."},seed:{type:"number",default:1,description:"Deterministic seed for placement jitter."}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!1,supportsLinkedHover:!1,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"synthetic",specialFeatures:["physics-simulation","process-flow","capacitated-stages","group-completion","settled-projection"]}},PhysicalFlowChart:{name:"PhysicalFlowChart",category:"physics",description:"Experimental physics-backed flow chart. Packets move along authored node coordinates or link paths while a static throughput layer keeps the route quantities readable.",required:[],dataShape:"network",dataAccessors:["nodeIdAccessor","nodeXAccessor","nodeYAccessor","sourceAccessor","targetAccessor","throughputAccessor","pathAccessor"],propBags:["common"],ownProps:{size:{type:"array",description:"[width, height] in pixels"},nodes:{type:"array",description:"Route nodes with explicit x/y geometry. x/y may be normalized 0-1 coordinates or chart pixels."},links:{type:"array",description:"Flow links with source, target, throughput, and optional path geometry."},edges:{type:"array",description:"Alias for links, for network-shaped inputs."},data:{type:"array",description:"Alias for links when using chart-generator style data props."},nodeIdAccessor:{type:["string","function"],default:"id",description:"Key for node unique identifier."},nodeXAccessor:{type:["string","function"],default:"x",description:"Node x-coordinate. Use 0-1 normalized values by default."},nodeYAccessor:{type:["string","function"],default:"y",description:"Node y-coordinate. Use 0-1 normalized values by default."},sourceAccessor:{type:["string","function"],default:"source",description:"Link source node id."},targetAccessor:{type:["string","function"],default:"target",description:"Link target node id."},throughputAccessor:{type:["string","function"],default:"value",description:"Numeric throughput field that controls pipe width and packet count."},pathAccessor:{type:["string","function"],default:"path",description:"Optional link path as [{x,y}, ...] or [[x,y], ...]."},coordinateMode:{type:"string",enum:["auto","normalized","pixels"],default:"auto",description:"How node and path coordinates are mapped into the plot area."},particleRate:{type:"number",default:.16,description:"Packets generated per throughput unit before maxParticles downsampling."},maxParticles:{type:"number",default:180,description:"Maximum live packets generated for the initial flow scene."},particleRadius:{type:"number",default:4,description:"Packet body radius in pixels."},flowSpeed:{type:"number",default:90,description:"Initial packet velocity along each authored route."},pathConstraint:{type:"string",enum:["path","none"],default:"path",description:"Whether live packets are steered along authored route paths."},reducedMotion:{type:"boolean",default:!1,description:"Start packets on their route positions and pause the simulation."},showStaticFlow:{type:"boolean",default:!0,description:"Draw the route/pipe throughput layer behind animated packets."},showNodeLabels:{type:"boolean",default:!0},showSensors:{type:"boolean",default:!1,description:"Draw destination/node proximity sensors used for observation events."},paused:{type:"boolean",default:!1,description:"Pause the physics simulation."},seed:{type:"number",default:1,description:"Deterministic seed for packet jitter and initial flow."}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!1,supportsLinkedHover:!1,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"synthetic",specialFeatures:["physics-simulation","path-constrained-flow","static-flow","proximity-sensors","settled-projection"]}},BigNumber:{name:"BigNumber",category:"value",description:"Focal-value display: one number, optionally with comparison / target / threshold zones (mapped to semantic theme roles) / four layout modes (tile / presentation / inline / thumbnail). Ships with NO chart-family dependency — embed your own Semiotic chart via two slots: `trendSlot` for wide / rectangular charts (LineChart, AreaChart) under the value, and `chartSlot` for square charts (DonutChart, PieChart, Scatterplot, Treemap) beside the value. The slot context exposes the resolved threshold colour + sentiment + push buffer so embedded charts can theme-link. Forward-looking POC for a future SingleValueFrame.",required:[],dataShape:"none",dataAccessors:[],propBags:[],ownProps:{width:{type:["number","string"],default:280,description:"Reserved width in pixels (or any CSS length). Mode-keyed defaults: 280 (tile) / 540 (presentation) / unset (inline / thumbnail)."},height:{type:["number","string"],default:184,description:"Reserved height in pixels (or any CSS length). Mode-keyed defaults: 184 (tile) / 320 (presentation) / unset (inline / thumbnail)."},className:{type:"string",description:"Composed with the BEM root class on the outer container."},value:{type:"number",description:"The focal number this card exists to display"},label:{type:"string",description:"Top-line descriptor rendered above the value"},caption:{type:"string",description:"Secondary descriptor, smaller, below the label"},format:{type:["string","function"],enum:["number","currency","percent","compact","duration"],default:"number",description:"Number-format shortcut or custom (value) => string"},locale:{type:"string",default:"en-US",description:"BCP-47 locale for Intl.NumberFormat"},currency:{type:"string",default:"USD",description:'ISO 4217 code for format: "currency"'},precision:{type:"number",description:"maximumFractionDigits passed to Intl.NumberFormat"},prefix:{type:"string",description:"Prepend to formatted value"},suffix:{type:"string",description:"Append to formatted value"},unit:{type:"string",description:'Unit label rendered after the value as small text (e.g. "USD", "req/s")'},comparison:{type:"object",description:"Comparison value: { value, label?, format?, direction? }. Drives the delta when explicit delta is not set."},target:{type:"object",description:'Target value: { value, label?, format?, direction? }. Renders "X% of target" next to the comparison row.'},delta:{type:"number",description:"Explicit delta override; bypasses comparison-derived subtraction"},deltaFormat:{type:["string","function"],enum:["number","currency","percent","compact","duration"],description:"Format the delta; defaults to format"},showDeltaPercent:{type:"boolean",default:!0,description:"Render percent change next to absolute delta when a comparison is present"},direction:{type:"string",enum:["higher-is-better","lower-is-better","neutral"],default:"higher-is-better",description:"Default direction used to infer sentiment from the sign of the delta"},sentiment:{type:"string",enum:["auto","positive","negative","neutral"],default:"auto",description:'Force sentiment; "auto" infers from direction + delta sign'},thresholds:{type:"array",description:"Threshold zones: [{ at, level, color?, label? }] ordered ascending by `at`. Resolved by highest `at` ≤ value. `level` maps to a semantic CSS variable (--semiotic-{success|warning|danger|info})."},chartSlot:{type:["string","number","array","object","function"],omitFromSchema:!0,description:"Square chart to render beside the value — e.g. a DonutChart / PieChart / Scatterplot / Treemap. ReactNode or (ctx) => ReactNode; the function form receives the resolved level / color / sentiment / pushBuffer."},chartSize:{type:"number",description:"Pixel size reserved for chartSlot (rendered as a square). Mode-keyed defaults: 44 (tile) / 80 (presentation) — sparkline scale; pass a larger value for a hero anchor."},windowSize:{type:"number",default:60,description:"Cap on the trend buffer when fed via push API"},mode:{type:"string",enum:["tile","presentation","inline","thumbnail"],default:"tile",description:"Layout mode — chrome envelope around the value"},align:{type:"string",enum:["start","center","end"],description:"Horizontal alignment within the card"},padding:{type:["number","object"],description:"Inner padding: number for uniform, or { top, right, bottom, left }"},emphasis:{type:"string",enum:["primary","secondary"],description:'Visual emphasis hint; "primary" spans two ChartGrid columns'},color:{type:"string",description:"Override the value text colour. CSS variables work."},background:{type:"string",description:"Card background. CSS variables work."},borderColor:{type:"string"},borderRadius:{type:["number","string"]},animate:{type:["boolean","object"],description:'Tween between value changes. true = 300ms ease-out + intro. Object: { duration?, easing?: "linear"|"ease-out", intro? }'},stalenessThreshold:{type:"number",description:"Mark stale (dimmed) when no push occurs for this many ms"},staleLabel:{type:"string",default:"stale"},headerSlot:{type:["string","number","array","object","function"],omitFromSchema:!0,description:"Replace the entire header (label + caption) slot"},valueSlot:{type:["string","number","array","object","function"],omitFromSchema:!0,description:"Replace the focal value slot"},deltaSlot:{type:["string","number","array","object","function"],omitFromSchema:!0,description:"Replace the delta / comparison / target row"},trendSlot:{type:["string","number","array","object","function"],omitFromSchema:!0,description:'Wide / rectangular chart embedded beneath the value — e.g. a LineChart / AreaChart in mode="sparkline". ReactNode or (ctx) => ReactNode; the function form receives the resolved level / color / sentiment / pushBuffer.'},footerSlot:{type:["string","number","array","object","function"],omitFromSchema:!0,description:"Free-form footer below the trend"},onClick:{type:"function",omitFromSchema:!0},onObservation:{type:"function",omitFromSchema:!0}},capabilities:{renderModes:["svg"],supportsLegend:!1,supportsSelection:!1,supportsLinkedHover:!1,supportsPush:!0,supportsSSR:!1,colorModel:"threshold",layoutMode:"synthetic",specialFeatures:["threshold-zones","value-only","comparison","target","staleness","intl-format","chart-slot","trend-slot","hoc-ssr-only"]}}}).map(([e,t])=>[e,$b(t)])),Fb=["value","threshold","partition-boundary","time-window","range-boundary"];function Bb({controlType:e,controlId:t,chartId:o,chartType:r="VisualizationControl",onObservation:n}){return(i,s,a)=>{n?.({type:i,controlType:e,value:s,chartType:r,timestamp:Date.now(),...t?{controlId:t}:{},...o?{chartId:o}:{},...a?{source:a}:{}})}}function Db(e,t,o,r,n){return{id:e,...t?{controlId:t}:{},status:o,message:r,...n?{remediation:n}:{}}}function Eb({controls:e=[],minimumTargetSize:t=24}){const o=[],r=new Set;for(const n of e){const e=n?.id,i="controls."+(e||"unknown"),s=n?.domain,a=Array.isArray(s)&&2===s.length&&Number.isFinite(s[0])&&Number.isFinite(s[1])&&s[1]>s[0],l=Fb.includes(n?.type),c="string"==typeof n?.target&&n.target.trim().length>0,u=["slider","buttons","native-range"].includes(n?.keyboard??""),d=n?.minimumTargetSize;o.push(Db(i+".semantic-type",e,l?"pass":"fail",l?`Control uses the semantic type "${n.type}".`:"Control has no recognized semantic type.","Use one of VISUALIZATION_CONTROL_TYPES.")),o.push(Db(i+".state-binding",e,c?"pass":"fail",c?`Control is bound to "${n.target}".`:"Control has no declarative state binding.","Declare the controlled state key with target.")),o.push(Db(i+".domain",e,a?"pass":"fail",a?"Control has a finite ordered value domain.":"Control has no finite ordered value domain.","Declare domain as [minimum, maximum].")),o.push(Db(i+".keyboard",e,u?"pass":"fail",u?`Control declares a ${n.keyboard} keyboard path.`:"Control does not declare a keyboard path.","Declare slider, buttons, or native-range keyboard interaction.")),o.push(Db(i+".value-text",e,"string"==typeof n?.valueText&&n.valueText.trim().length>0?"pass":"fail","string"==typeof n?.valueText&&n.valueText.trim().length>0?"Control declares human-readable value text.":"Control does not declare human-readable value text.","Provide valueText, typically with a {value} placeholder.")),o.push(Db(i+".target-size",e,"number"!=typeof d||t>d?"fail":"pass","number"!=typeof d||t>d?`Control target is below the ${t}px minimum or undeclared.`:`Control declares a ${d}px target.`,`Declare minimumTargetSize of at least ${t}.`)),null!=n?.step&&o.push(Db(i+".step",e,Number.isFinite(n.step)&&n.step>0?"pass":"fail",Number.isFinite(n.step)&&n.step>0?"Control has a positive quantization step.":"Control step must be a positive finite number.","Use a positive finite step.")),n?.observations?.length&&o.push(Db(i+".observations",e,n.observations.includes("control-change")?"pass":"warn",n.observations.includes("control-change")?"Control declares control-change observation coverage.":"Control declares observations but omits control-change.","Include control-change so observable state changes are represented.")),e&&!r.has(e)||o.push(Db(i+".identity",e,"fail",e?"Control id is duplicated.":"Control id is missing.","Use a unique stable control id.")),e&&r.add(e)}return{ok:o.every(e=>"fail"!==e.status),findings:o}}function zb(e,t=new Set){if(null===e)return!0;const o=typeof e;if("string"===o||"boolean"===o)return!0;if("number"===o)return Number.isFinite(e);if("object"!==o)return!1;if(t.has(e))return!1;t.add(e);const r=Array.isArray(e)?e.every(e=>zb(e,t)):Object.entries(e).every(([,e])=>zb(e,t));return t.delete(e),r}var Hb=Symbol.for("semiotic.chartRecipeRegistry");function Ob(e){return function(){const e=globalThis;return e[Hb]||(e[Hb]={recipes:new Map,capabilities:new Map,layouts:new Map}),e[Hb]}().recipes.get(e)}function Wb(e){return"string"==typeof e?Ob(e):e&&"object"==typeof e&&"string"==typeof e.id?e:void 0}function qb(e){return"string"==typeof e?e:e.id??e.name}function Yb(e){return e.layoutConfig&&"object"==typeof e.layoutConfig?e.layoutConfig:{}}function Gb(e){return Array.isArray(e.data)?e.data:Array.isArray(e.nodes)?e.nodes:Array.isArray(e.points)?e.points:Array.isArray(e.areas)?e.areas:[]}function Vb(e,t,o){return o??Wb(t.recipe)??Wb(t.recipeId)??Ob(e)}function Xb(e,t,o=[]){const r=e.accessor?t[e.accessor]:void 0;if("string"==typeof r&&r)return r;if(e.field)return e.field;const n=o.find(e=>e&&"object"==typeof e);if(!n)return;const i=Object.entries(n).filter(([e,t])=>!e.startsWith("_")&&null!=t);return"quantitative"===e.semanticType?i.find(([,e])=>"number"==typeof e)?.[0]:"identifier"===e.semanticType?["id","key","name"].find(e=>e in n):i.find(([,e])=>"string"==typeof e)?.[0]}function Ub(e,t){return e.dataRoles.find(e=>e.role===t)}function Kb(e,t){return e.dataRoles.find(e=>t.includes(e.semanticType))}function Qb(e,t,o,r,n,i={}){const s={...i};if(t)for(const[e,o]of Object.entries(t))s[e]=o;for(const e of o.dataRoles){const o=Xb(e,r,n),i=t&&o?t[o]:o;void 0!==i&&(s[e.role]=i)}return e.replace(/\{([^}]+)\}/g,(e,t)=>{const o=s[t];return null==o?`{${t}}`:o+""})}var Zb="1",Jb=new Set(["tooltip","onObservation","xFormat","yFormat","valueFormat","svgAnnotationRules","tooltipContent","onHover","tickFormatTime","tickFormatValue","edgeSort","sortGroups","centerContent","frameProps","controls","oFormat","rFormat","oSort","pieceStyle","summaryStyle","nodeStyle","edgeStyle","customHoverBehavior","customClickBehavior","customDoubleClickBehavior","onBrush","onTopologyChange","backgroundGraphics","foregroundGraphics","legend","recipe","layout"]),ev=new Set(["data","nodes","edges","points","areas","lines","flows"]);function tv(e,t){return!!ev.has(e)&&("areas"!==e||"string"!=typeof t)}var ov="function"==typeof structuredClone?structuredClone:e=>JSON.parse(JSON.stringify(e));function rv(e,t,o){const r=Ob(e)??Wb(t.recipe)??Wb(t.recipeId);if(r)return function(e,t,o){const r=function(e,t,o){const r={};for(const[n,i]of Object.entries(e))if(null!=i&&!Jb.has(n)&&"recipeId"!==n&&(t||!tv(n,i)))if("function"==typeof i||i?.$$typeof){if(o)throw Error(`Portable recipe prop "${n}" is not JSON-safe.`)}else if(zb(i))r[n]=ov(i);else if(o)throw Error(`Portable recipe prop "${n}" is not JSON-safe.`);return r}(t,!1!==o?.includeData,"portable"===e.portability),n=e.intents.map(qb).filter(e=>!!e),i={name:e.name,intents:n,...e.audience?.primary?{audience:[e.audience.primary]}:{},frameFamily:e.frameFamily};if("portable"===e.portability){if(!zb(r))throw Error(`Portable recipe "${e.id}" contains non-JSON-safe props or layoutConfig.`);return{component:"ChartRecipe",recipeId:e.id,portable:!0,props:r,manifest:i,version:Zb,createdAt:(new Date).toISOString(),...o?.selections?{selections:o.selections}:{}}}return{component:"ChartRecipe",recipeId:e.id,portable:!1,reason:"Recipe contains or may depend on non-serializable local layout callbacks.",warnings:["This config is inspectable but cannot be rendered remotely by CLI or MCP."],props:r,manifest:i,version:Zb,createdAt:(new Date).toISOString(),...o?.selections?{selections:o.selections}:{}}}(r,t,o);if(!Nb[e])throw Error(`Unknown component "${e}". Known components: ${Object.keys(Nb).join(", ")}`);const n=!1!==o?.includeData,i={};for(const[e,o]of Object.entries(t))null!=o&&(Jb.has(e)||!n&&tv(e,o)||"function"!=typeof o&&(o?.$$typeof||(i[e]=ov(o))));return{component:e,props:i,version:Zb,createdAt:(new Date).toISOString(),...o?.selections?{selections:o.selections}:{}}}function nv(e){if(!e.component||!e.props)throw Error("Invalid chart config: missing component or props");if("ChartRecipe"===e.component||"LocalChartRecipe"===e.component){if(!e.recipeId)throw Error("Invalid chart recipe config: missing recipeId");const t=Ob(e.recipeId);if(!t)throw Error(`Unknown chart recipe "${e.recipeId}". Register it before deserializing this config.`);if("LocalChartRecipe"!==e.component&&!1!==e.portable&&"portable"!==t.portability)throw Error(`Chart recipe "${e.recipeId}" is registered as local, not portable.`);return{componentName:"ChartRecipe",props:{...ov(e.props),recipeId:e.recipeId}}}if(!Nb[e.component])throw Error(`Unknown component "${e.component}". This config may require a newer version of semiotic.`);return{componentName:e.component,props:ov(e.props)}}function iv(e){const t=JSON.stringify(e);return"sc="+btoa(unescape(encodeURIComponent(t))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function sv(e){const t=new URLSearchParams(e.includes("?")?e.split("?")[1]:e).get("sc");if(!t)throw Error("No chart config found in URL (missing 'sc' parameter)");const o=t.replace(/-/g,"+").replace(/_/g,"/"),r=decodeURIComponent(escape(atob(o)));return JSON.parse(r)}async function av(e,t="json"){const o="jsx"===t?lv(e):JSON.stringify(e,null,2);if("undefined"==typeof navigator||!navigator.clipboard)throw Error("Clipboard API not available. copyConfig requires a browser environment.");await navigator.clipboard.writeText(o)}function lv(e){const{props:t}=e,o=["<"+("LocalChartRecipe"===e.component?"ChartRecipe":e.component)];e.recipeId&&o.push(` recipeId="${e.recipeId}"`);for(const[e,r]of Object.entries(t))if("string"==typeof r)o.push(` ${e}="${r}"`);else if("boolean"==typeof r&&!0===r)o.push(" "+e);else if("boolean"==typeof r&&!1===r)o.push(` ${e}={false}`);else if("number"==typeof r)o.push(` ${e}={${r}}`);else{const t=JSON.stringify(r);o.push(80>t.length?` ${e}={${t}}`:` ${e}={${JSON.stringify(r,null,2)}}`)}return o.push("/>"),o.join("\n")}function cv(e){const t={};for(const[o,r]of e){const e=[];for(const[,t]of r.clauses){const o={};for(const[e,r]of Object.entries(t.fields))o[e]="point"===r.type?{type:"point",values:Array.from(r.values)}:{type:"interval",range:r.range};e.push({clientId:t.clientId,type:t.type,fields:o})}t[o]={name:r.name,resolution:r.resolution,clauses:e}}return t}function uv(e){const t=new Map;for(const[o,r]of Object.entries(e)){const e=new Map;for(const t of r.clauses){const o={};for(const[e,r]of Object.entries(t.fields))o[e]="point"===r.type?{type:"point",values:new Set(r.values)}:{type:"interval",range:r.range};e.set(t.clientId,{clientId:t.clientId,type:t.type,fields:o})}t.set(o,{name:r.name,resolution:r.resolution,clauses:e})}return t}function dv(e){return"nominal"===e||"ordinal"===e}function hv(e){return"quantitative"===e||"temporal"===e}function pv(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}h();var fv={category10:"category10",category20:"category20",category20b:"category20",category20c:"category20",accent:"accent",dark2:"dark2",paired:"paired",pastel1:"pastel1",pastel2:"pastel2",set1:"set1",set2:"set2",set3:"set3",tableau10:"category10",tableau20:"category20"},gv={linear:"linear","monotone-x":"monotoneX","monotone-y":"monotoneY",monotone:"monotoneX",step:"step","step-after":"stepAfter","step-before":"stepBefore",basis:"basis",cardinal:"cardinal","catmull-rom":"catmullRom"},mv={sum:"sum",mean:"mean",average:"mean",count:"count",min:"min",max:"max",median:"mean"};function yv(e){e=function(e){const t=e;if(!function(e){const t=e.usermeta;if(pv(t)&&pv(t.idid))return t.idid}(e)||!Array.isArray(t.layer))return e;const o=t.layer.filter(e=>pv(e)&&!function(e){return!!(pv(e)&&pv(e.usermeta)&&pv(e.usermeta.idid))&&"annotation-layer"===e.usermeta.idid.role}(e));if(1!==o.length||void 0===o[0].mark)return e;const{layer:r,...n}=t,{usermeta:i,...s}=o[0];return{...n,...s}}(e);const t=[],{type:o,markProps:r}=function(e){if(!e)return{type:"",markProps:{}};if("string"==typeof e)return{type:e,markProps:{}};const{type:t,...o}=e;return{type:t,markProps:o}}(e.mark),n=e.encoding||{},i=n.x,s=n.y,a=n.color,l=n.size,c=n.theta,d=n.opacity;let h;e.data?.values?h=e.data.values:e.data?.url&&t.push("data.url is not supported — only inline data.values can be translated. Provide data manually."),e.transform&&e.transform.length>0&&t.push("Vega-Lite transforms are not supported. Pre-transform your data before passing to fromVegaLite()."),e.layer&&t.push('Layered specs ("layer") are not supported. Only single-mark specs can be translated.'),(e.hconcat||e.vconcat||e.concat)&&t.push('Concatenated views ("hconcat"/"vconcat"/"concat") are not supported. Translate each sub-spec individually.'),(e.facet||n.facet||n.row||n.column)&&t.push("Faceted views are not supported. Use Semiotic's LinkedCharts or render multiple charts manually."),e.repeat&&t.push('Repeated views ("repeat") are not supported. Translate each field combination individually.'),(e.params||e.selection)&&t.push("Selections/params are not supported. Use Semiotic's LinkedCharts and selection props for interactivity.");const p={};e.width&&(p.width=e.width),e.height&&(p.height=e.height);const f=function(e){if(e)return"string"==typeof e?e:e.text}(e.title);if(f&&(p.title=f),a?.field&&(p.colorBy=a.field,a.scale?.scheme)){const e=fv[a.scale.scheme];e&&(p.colorScheme=e)}void 0!==d?.value&&(p.pointOpacity=d.value);const g=i?.aggregate,m=s?.aggregate;if(h&&(g||m)){const e=m?s:i,t=m?i:s,o=mv[e.aggregate];if(o&&t?.field&&e.field)h=function(e,t){const{groupBy:o,value:r,agg:n="sum"}=t,i=new Map;for(const t of e){const e=t[o]+"";i.has(e)||i.set(e,[]),i.get(e).push(Number(t[r]))}const s=[];for(const[e,t]of i){let r;switch(n){case"count":r=t.length;break;case"mean":r=t.reduce((e,t)=>e+t,0)/t.length;break;case"min":r=u(t)[0];break;case"max":r=u(t)[1];break;default:r=t.reduce((e,t)=>e+t,0)}s.push({[o]:e,value:r})}return s}(h,{groupBy:t.field,value:e.field,agg:o});else if(("count"===o||"count"===e.aggregate)&&t?.field&&h){const e=new Map;for(const o of h){const r=o[t.field]+"";e.set(r,(e.get(r)||0)+1)}h=Array.from(e,([e,o])=>({[t.field]:e,value:o}))}}if(i?.bin||s?.bin){const e="Histogram";h&&(p.data=h),i?.bin?(p.valueAccessor=i.field,s?.field&&(p.categoryAccessor=s.field),i.axis?.title&&(p.valueLabel=i.axis.title)):s?.bin&&(p.valueAccessor=s.field,i?.field&&(p.categoryAccessor=i.field),s.axis?.title&&(p.valueLabel=s.axis.title));const o=i?.bin||s?.bin,r="object"==typeof o?o.maxbins:void 0;return r&&(p.bins=r),vv(e,p,t)}let y;switch(o){case"bar":y=function(e,t,o,r,n,i,s){let a;return o?.field&&!1!==e?.stack&&!1!==t?.stack&&null!==e?.stack&&null!==t?.stack?(a="StackedBarChart",r.stackBy=o.field):a="BarChart",dv(e?.type)&&hv(t?.type)?(r.categoryAccessor=e.field,r.valueAccessor=s?"value":t.field,e?.axis?.title&&(r.categoryLabel=e.axis.title),t?.axis?.title&&(r.valueLabel=t.axis.title)):hv(e?.type)&&dv(t?.type)?(r.categoryAccessor=t.field,r.valueAccessor=i?"value":e.field,r.orientation="horizontal",t?.axis?.title&&(r.categoryLabel=t.axis.title),e?.axis?.title&&(r.valueLabel=e.axis.title)):(e?.field&&(r.categoryAccessor=e.field),t?.field&&(r.valueAccessor=s?"value":t.field),e?.axis?.title&&(r.categoryLabel=e.axis.title),t?.axis?.title&&(r.valueLabel=t.axis.title)),n&&(r.data=n),a}(i,s,a,p,h,g,m);break;case"line":if(y="LineChart",bv(i,s,p,g,m),a?.field&&(p.lineBy=a.field),r.interpolate){const e=gv[r.interpolate];e&&(p.curve=e)}!0===r.point&&(p.showPoints=!0),h&&(p.data=h);break;case"area":if(a?.field?(y="StackedAreaChart",p.areaBy=a.field):y="AreaChart",bv(i,s,p,g,m),r.interpolate){const e=gv[r.interpolate];e&&(p.curve=e)}void 0!==r.opacity&&(p.areaOpacity=r.opacity),h&&(p.data=h);break;case"point":case"circle":case"square":l?.field?(y="BubbleChart",p.sizeBy=l.field,l.scale?.range&&(p.sizeRange=l.scale.range)):y="Scatterplot",bv(i,s,p,g,m),h&&(p.data=h);break;case"rect":y="Heatmap",i?.field&&(p.xAccessor=i.field),s?.field&&(p.yAccessor=s.field),a?.field&&(p.valueAccessor=a.field,delete p.colorBy),i?.axis?.title&&(p.xLabel=i.axis.title),s?.axis?.title&&(p.yLabel=s.axis.title),h&&(p.data=h);break;case"arc":r.innerRadius&&r.innerRadius>0?(y="DonutChart",p.innerRadius=r.innerRadius):y="PieChart",c?.field?p.valueAccessor=c.field:s?.field&&(p.valueAccessor=m?"value":s.field),a?.field&&(p.categoryAccessor=a.field),i?.field&&!c?.field&&(p.categoryAccessor=i.field),h&&(p.data=h);break;case"tick":y="DotPlot",dv(i?.type)?(p.categoryAccessor=i.field,s?.field&&(p.valueAccessor=m?"value":s.field),i?.axis?.title&&(p.categoryLabel=i.axis.title),s?.axis?.title&&(p.valueLabel=s.axis.title)):dv(s?.type)?(p.categoryAccessor=s.field,i?.field&&(p.valueAccessor=g?"value":i.field),p.orientation="horizontal",s?.axis?.title&&(p.categoryLabel=s.axis.title),i?.axis?.title&&(p.valueLabel=i.axis.title)):(i?.field&&(p.categoryAccessor=i.field),s?.field&&(p.valueAccessor=m?"value":s.field)),h&&(p.data=h);break;default:t.push(`Unsupported mark type "${o}". Defaulting to Scatterplot.`),y="Scatterplot",bv(i,s,p,g,m),h&&(p.data=h)}return vv(y,p,t)}function bv(e,t,o,r,n){e?.field&&(o.xAccessor=r?"value":e.field),t?.field&&(o.yAccessor=n?"value":t.field),e?.axis?.title&&(o.xLabel=e.axis.title),t?.axis?.title&&(o.yLabel=t.axis.title)}function vv(e,t,o){const r={component:e,props:t,version:"1",createdAt:(new Date).toISOString()};if(o.length>0){r.warnings=o;for(const e of o)console.warn("[semiotic/fromVegaLite] "+e)}return r}var xv=c(require("react")),kv=new Set(["LineChart","AreaChart","StackedAreaChart","DifferenceChart","Scatterplot","BubbleChart","ConnectedScatterplot","QuadrantChart","MultiAxisLineChart","MinimapChart"]),wv=new Set(["BarChart","StackedBarChart","GroupedBarChart","DotPlot"]),Sv=new Set(["PieChart","DonutChart","FunnelChart"]),Av=new Set(["Histogram","BoxPlot","ViolinPlot","RidgelinePlot","SwarmPlot"]);function Cv(e,t){return wv.has(e)||Sv.has(e)||"SwimlaneChart"===e||"GaugeChart"===e?{measure:t.valueAccessor,measureFallback:"value",dimension:t.categoryAccessor??t.stepAccessor,dimensionFallback:"category"}:{measure:t.yAccessor??t.valueAccessor,measureFallback:"y",dimension:t.xAccessor,dimensionFallback:"x"}}function Mv(e){for(const t of["lineBy","areaBy","stackBy","groupBy","colorBy"]){const o=e[t];if("string"==typeof o&&o)return o}}function jv(e,t){return null==e?"—":e instanceof Date?e.toISOString().slice(0,10):"number"==typeof e?t(e):e+""}function Pv(e,t={}){const o=!0===t.showRetractedAnnotations,r=!0===t.showSupersededAnnotations,n=new Set;for(const t of e){const e=t?.lifecycle?.supersedes;e&&"retracted"!==t?.lifecycle?.status&&n.add(e)}return e.filter(e=>{if("retracted"===e?.lifecycle?.status&&!o)return!1;const t=e?.provenance?.stableId;return!(t&&n.has(t)&&!r)})}var _v={LineChart:"line chart",AreaChart:"area chart",StackedAreaChart:"stacked area chart",DifferenceChart:"difference chart",Scatterplot:"scatter plot",BubbleChart:"bubble chart",ConnectedScatterplot:"connected scatter plot",QuadrantChart:"quadrant chart",MultiAxisLineChart:"dual-axis line chart",CandlestickChart:"candlestick chart",Heatmap:"heatmap",MinimapChart:"line chart",BarChart:"bar chart",StackedBarChart:"stacked bar chart",GroupedBarChart:"grouped bar chart",DotPlot:"dot plot",Histogram:"histogram",BoxPlot:"box plot",ViolinPlot:"violin plot",RidgelinePlot:"ridgeline plot",SwarmPlot:"swarm plot",PieChart:"pie chart",DonutChart:"donut chart",FunnelChart:"funnel chart",GaugeChart:"gauge",LikertChart:"Likert chart",SwimlaneChart:"swimlane chart",ForceDirectedGraph:"network graph",SankeyDiagram:"Sankey diagram",ProcessSankey:"temporal Sankey diagram",ChordDiagram:"chord diagram",TreeDiagram:"tree diagram",Treemap:"treemap",CirclePack:"circle-packing chart",OrbitDiagram:"orbit diagram",ChoroplethMap:"choropleth map",ProportionalSymbolMap:"proportional-symbol map",FlowMap:"flow map",DistanceCartogram:"distance cartogram",BigNumber:"single value",StreamPhysicsFrame:"physics stream frame",EventDropChart:"event-drop physics chart",GaltonBoardChart:"Galton board chart",PhysicsPileChart:"physics pile chart",CollisionSwarmChart:"collision swarm chart",PhysicalFlowChart:"physical flow chart",ProcessFlowChart:"process flow physics chart",PhysicsCustomChart:"custom physics chart"},Lv=new Set(["ForceDirectedGraph","SankeyDiagram","ProcessSankey","ChordDiagram"]),Rv=new Set(["StreamPhysicsFrame","EventDropChart","GaltonBoardChart","PhysicsPileChart","CollisionSwarmChart","PhysicalFlowChart","ProcessFlowChart","GauntletChart","PhysicsCustomChart"]);function Tv(e){return _v[e]||e.replace(/([a-z])([A-Z])/g,"$1 $2").toLowerCase()+" chart"}function Iv(e){const t="number"==typeof e?e:"string"==typeof e?Number(e):NaN;return Number.isFinite(t)?t:void 0}var $v=new Set(["Scatterplot","BubbleChart","ConnectedScatterplot","QuadrantChart","ScatterplotMatrix"]),Nv={"outlier-detection":"alerting","change-detection":"alerting",trend:"tracking","composition-over-time":"apportioning","compare-series":"comparing","compare-categories":"comparing",rank:"ranking","part-to-whole":"apportioning",distribution:"characterizing",correlation:"relating",flow:"tracing",hierarchy:"nesting",geo:"locating"},Fv={"time-series":"tracking",categorical:"comparing",distribution:"characterizing",relationship:"relating",flow:"tracing",network:"tracing",hierarchy:"nesting",geo:"locating",realtime:"tracking",value:"presenting",custom:"presenting"},Bv=["trend","compare-series","compare-categories","rank","part-to-whole","distribution","correlation","flow","hierarchy","geo","composition-over-time","change-detection","outlier-detection"],Dv={alerting:"alerting",tracking:"trend",comparing:"comparison",ranking:"ranking",apportioning:"composition",characterizing:"distribution",relating:"correlation",tracing:"flow",nesting:"hierarchy",locating:"locator",presenting:"single-value"};var Ev=new Set(["y-threshold","x-threshold","band","x-band","callout","label"]),zv=new Set(["system","agent","watcher"]),Hv=new Set(["ai","agent","system","computed","dbt","great-expectations"]),Ov=new Set(["rule","statistical-test","llm-inference","computed"]);function Wv(e){const t=e.annotations;return!!Array.isArray(t)&&t.some(e=>{if(!e||"object"!=typeof e)return!1;const t=e;if("string"!=typeof t.type||!Ev.has(t.type))return!1;const o=t.provenance;return!(!o||"object"!=typeof o)&&(zv.has(o.authorKind)||Hv.has(o.source)||Ov.has(o.basis))})}function qv(e="en"){let t,o;try{t=new Intl.NumberFormat(e,{notation:"compact",maximumFractionDigits:1}),o=new Intl.NumberFormat(e,{maximumFractionDigits:2})}catch{t=new Intl.NumberFormat("en",{notation:"compact",maximumFractionDigits:1}),o=new Intl.NumberFormat("en",{maximumFractionDigits:2})}return e=>Number.isFinite(e)?1e4>Math.abs(e)?o.format(e):t.format(e):e+""}var Yv={"y-threshold":"a threshold line","x-threshold":"a threshold line",band:"a highlighted band","x-band":"a highlighted band",label:"a label",callout:"a callout","callout-circle":"a callout","callout-rect":"a callout",text:"a text note",bracket:"a bracket",enclose:"an enclosure","rect-enclose":"an enclosure",highlight:"a highlight",widget:"a widget",trend:"a trend line",envelope:"an envelope","anomaly-band":"an anomaly band",forecast:"a forecast","category-highlight":"a category highlight"};function Gv(e){const t=Yv["string"==typeof e.type?e.type:"annotation"]||"an annotation",o=function(e){const t=e.provenance&&"object"==typeof e.provenance?e.provenance:null,o=t?.authorKind??t?.source??t?.basis;return"watcher"===o?"a watcher-flagged ":"agent"===o||"ai"===o||"llm-inference"===o?"an AI-suggested ":""}(e),r=o?o+t.replace(/^an? /,""):t,n="string"==typeof e.label?e.label:"string"==typeof e.title?e.title:void 0;return n?`${r} labeled "${n}"`:r}function Vv(e){const t=Array.isArray(e.annotations)?e.annotations:null;if(!t||0===t.length)return;const o=Pv(t.filter(e=>!!e&&"object"==typeof e));if(0===o.length)return;const r=o.map(Gv),n=r.slice(0,5),i=r.length-n.length,s=function(e){return e.length>1?2===e.length?`${e[0]} and ${e[1]}`:`${e.slice(0,-1).join(", ")}, and ${e[e.length-1]}`:e[0]??""}(n)+(i>0?`, and ${i} more`:""),a=o.length;return`The author has marked ${1===a?"one feature":a+" features"} on this chart: ${s}.`}function Xv(e,t,o={}){const r=void 0!==o.levels,n=new Set(o.levels??["l1","l2","l3"]);r||!o.capability&&!Wv(t)||n.add("l4");const i=Vb(e,t,o.recipe);if(i){const e=["l1","l2","l3","l4"].filter(e=>n.has(e));r||e.includes("l4")||e.push("l4");const s=function(e,t,o={}){const r=Gb(t),n=Yb(t),i=o.locale??"en",s="function"==typeof e.description?e.description({data:r,config:n,locale:i}):void 0,a=s?.levels??function(e,t,o,r){const n=Kb(e,["nominal","ordinal"]),i=Kb(e,["quantitative"]),s=n?Xb(n,o,t):void 0,a=i?Xb(i,o,t):void 0,l=n?.role??s??"category",c=i?.role??a??"value",u=e.encodings??[],d=u.length?u.slice(0,3).map(e=>e.meaning.replace(/\.$/,"")).join("; "):`${l} and ${c} are mapped through the recipe's declared visual semantics`,{number:h,percent:p}=function(e){try{return{number:new Intl.NumberFormat(e,{maximumFractionDigits:2}),percent:new Intl.NumberFormat(e,{style:"percent",maximumFractionDigits:1})}}catch{return{number:new Intl.NumberFormat("en",{maximumFractionDigits:2}),percent:new Intl.NumberFormat("en",{style:"percent",maximumFractionDigits:1})}}}(r),f=new Map;if(s&&a)for(const e of t){const t=(e[s]??"Uncategorized")+"",o=Number(e[a]);Number.isFinite(o)&&f.set(t,(f.get(t)??0)+o)}const g=[...f].sort((e,t)=>t[1]-e[1]),m=g.reduce((e,[,t])=>e+t,0),y=g[0],b=g[1],v=m>0?((y?.[1]??0)+(b?.[1]??0))/m:0,x=e.intents.map(e=>({id:qb(e),strength:"string"==typeof e?void 0:e.strength})).sort((e,t)=>"primary"===e.strength?-1:"primary"===t.strength?1:0)[0]?.id,k=e.audience?.primary??e.audienceFit?.find(e=>"strong"===e.fit)?.audience;return{l1:`A ${e.name.toLowerCase()} encodes ${l} and ${c}. ${w=d,w?w.charAt(0).toUpperCase()+w.slice(1):w}.`,l2:g.length>0?`${g.length} categories total ${h.format(m)}. ${y[0]} accounts for ${h.format(y[1])}${m>0?` (${p.format(y[1]/m)})`:""}${b?`, followed by ${b[0]} at ${h.format(b[1])}`:""}.`:`${t.length} data ${1===t.length?"item is":"items are"} represented.`,l3:2>g.length?y?y[0]+" is the only represented category.":"No quantitative pattern can be derived from the available data.":.5>v?`The total is distributed across ${g.length} categories without the first two forming a majority.`:`Most of the total is concentrated in ${y[0]} and ${b[0]}, which together account for ${p.format(v)}.`,l4:`The chart is intended for ${x??"explanation"}${k?` with a ${k} audience`:""}: ${e.designContract.whyCustom}`};var w}(e,r,n,i),l=o.levels??["l1","l2","l3","l4"],c={};for(const e of l)a[e]&&(c[e]=a[e]);const u=["l1","l2","l3","l4"].map(e=>c[e]).filter(e=>!!e).join(" "),d=o.includeCaveats?[...e.reception?.risks??[],...e.caveats??[],...(e.designContract.misuse??[]).map(e=>"Misuse: "+e)]:void 0;return{text:u,levels:c,...d?.length?{caveats:d}:{}}}(i,t,{levels:e,locale:o.locale,audience:o.audience,includeCaveats:o.includeCaveats}),a=Vv(t);return{...s,text:a?`${a} ${s.text}`.trim():s.text,...a?{annotations:a}:{}}}const s=qv(o.locale??"en"),a=Tv(e),l=Array.isArray(t.data)?t.data:null,c=Mv(t),u=Rv.has(e)?function(e,t){const o=e.physics&&"object"==typeof e.physics?e.physics:null,r=e.settledProjection&&"object"==typeof e.settledProjection?e.settledProjection:null,n=[e.settledProjectionRows,e.projectionRows,r?.rows,o?.settledProjectionRows,o?.projectionRows,o?.settledProjection&&"object"==typeof o.settledProjection?o.settledProjection.rows:void 0].find(e=>Array.isArray(e));return Array.isArray(n)?n.map((e,o)=>{if(!e||"object"!=typeof e)return null;const r=e,n=Iv(r.count??r.value??r.total??r.bodies??r.events);if(null==n)return null;const i=r.label??r.id??r.name??"container "+(o+1),s=Iv(r.secondary??r.secondaryCount),a=Iv(r.observed??r.observedCount);return{label:jv(i,t),count:n,...null!=s?{secondary:s}:{},..."string"==typeof r.secondaryLabel&&r.secondaryLabel?{secondaryLabel:r.secondaryLabel}:{},...null!=a?{observed:a}:{}}}).filter(e=>null!=e):null}(t,s):null,{measure:d,measureFallback:h,dimension:p,dimensionFallback:f}=Cv(e,t),g="string"==typeof d&&d?d:h,m="string"==typeof p&&p?p:f,y={};if(Rv.has(e)&&function(e,t,o,r,n,i){const s=function(e){return"EventDropChart"===e?"time window":"GaltonBoardChart"===e?"bin":"CollisionSwarmChart"===e?"group lane":"PhysicalFlowChart"===e?"flow node":"container"}(e),a=function(e){return"EventDropChart"===e?"event":"GaltonBoardChart"===e?"sample":"CollisionSwarmChart"===e?"point":"PhysicalFlowChart"===e?"packet":"body"}(e);if(n.has("l1")&&(r.l1=function(e,t){return"EventDropChart"===e?"An event-drop physics chart that collapses moving events into a settled projection by event-time window.":"GaltonBoardChart"===e?"A Galton board chart that collapses falling samples into a settled histogram projection.":"PhysicsPileChart"===e?"A physics pile chart that collapses moving bodies into a settled bar-style projection by container.":"CollisionSwarmChart"===e?"A collision swarm chart that separates overlapping points while preserving their quantitative axis position.":"PhysicalFlowChart"===e?"A physical flow chart that keeps authored routes visible while packet bodies show throughput and proximity events.":`A ${t} whose accessible reading is the settled projection rather than individual trajectories.`}(e,t)),!n.has("l2")&&!n.has("l3"))return;if(!o||0===o.length)return void(n.has("l2")&&(r.l2="No settled projection is loaded yet."));const l=o.reduce((e,t)=>e+t.count,0),c=o.filter(e=>e.count>0).sort((e,t)=>t.count-e.count),u=c[0]??o.slice().sort((e,t)=>t.count-e.count)[0];if(!u)return;const d=o.reduce((e,t)=>e+(t.secondary??0),0),h=o.find(e=>e.secondaryLabel)?.secondaryLabel??"secondary";if(n.has("l2"))if(0===c.length)r.l2=`The settled projection contains ${i(l)} ${Kv(l,a)} across ${o.length} ${Kv(o.length,s)}; no ${Kv(2,s)} are non-empty yet.`;else{const e=d>0?` ${i(d)} ${Kv(d,a)} ${1===d?"is":"are"} marked ${h}.`:"";r.l2=`The settled projection contains ${i(l)} ${Kv(l,a)} across ${o.length} ${Kv(o.length,s)}; ${c.length} ${Kv(c.length,s)} ${1===c.length?"is":"are"} non-empty. The largest ${s} is ${u.label} with ${i(u.count)} ${Kv(u.count,a)}.${e}`}if(n.has("l3")&&l>0&&c.length>0){const e=c.find(e=>e!==u),t=function(e,t){if(0>=t)return"0%";const o=e/t*100;return(10>o?Math.round(10*o)/10:Math.round(o))+"%"}(u.count,l);r.l3=e?`The settled projection is most concentrated in ${u.label}, which holds ${i(u.count)} ${Kv(u.count,a)} (${t}); ${e.label} follows with ${i(e.count)} ${Kv(e.count,a)}.`:`The settled projection is concentrated in ${u.label}, which holds all ${i(u.count)} ${Kv(u.count,a)}.`}}(e,a,u,y,n,s),n.has("l1")&&!Rv.has(e))if(kv.has(e)||wv.has(e))y.l1=`A ${a} of ${g} by ${m}`+(c?`, split by ${c}.`:".");else if(Sv.has(e))y.l1=`A ${a} showing ${g} across ${m} categories.`;else if(Av.has(e))y.l1=`A ${a} of the distribution of ${g}`+(c?` by ${c}.`:".");else if(Lv.has(e)){const e=Array.isArray(t.nodes)?t.nodes.length:void 0,o=Array.isArray(t.edges)?t.edges.length:void 0,r=[null!=e?`${e} ${Kv(e,"node")}`:null,null!=o?`${o} ${Kv(o,"edge")}`:null].filter(Boolean);y.l1=`A ${a}${r.length?" with "+r.join(" and "):""}.`}else if("BigNumber"===e){const e="string"==typeof t.label?t.label:g;y.l1=`A single value${e?" for "+e:""}.`}else y.l1=`A ${a}.`;const b=kv.has(e)||wv.has(e)||Sv.has(e)||Av.has(e);let v=null;if((n.has("l2")||n.has("l3")||n.has("l4"))&&b&&l&&l.length>0&&(v=function(e,t,o,r){let n=0,i=0,s=1/0,a=-1/0,l=null,c=null,u=0,d=0,h=null,p=null,f=NaN,g=NaN;for(const o of e){const e=t(o);Number.isFinite(e)&&(0===n&&(f=e,h=o),g=e,p=o,s>e&&(s=e,l=o,u=n),e>a&&(a=e,c=o,d=n),n++,i+=e)}return 0===n?null:{count:n,min:s,max:a,mean:i/n,minLabel:jv(null!=l?o(l):null,r),maxLabel:jv(null!=c?o(c):null,r),first:f,last:g,firstLabel:jv(null!=h?o(h):null,r),lastLabel:jv(null!=p?o(p):null,r),minIndex:u,maxIndex:d}}(l,ne(d,h),ie(p,f),s)),n.has("l2")&&b&&(l&&0!==l.length?v&&(y.l2=Sv.has(e)?`${v.count} segments totaling ${s(function(e){return e.mean*e.count}(v))}. Largest is ${v.maxLabel} at ${s(v.max)}; smallest is ${v.minLabel} at ${s(v.min)}.`:`${g} ranges from ${s(v.min)} (${v.minLabel}) to ${s(v.max)} (${v.maxLabel}), with a mean of ${s(v.mean)} across ${v.count} points.`):y.l2="No data is loaded yet."),n.has("l3")&&v&&!c&&kv.has(e)?y.l3=function(e,t,o){const{first:r,last:n,min:i,max:s,maxLabel:a,minLabel:l,firstLabel:c,lastLabel:u,minIndex:d,maxIndex:h,count:p}=e,f=s-i,g=n-r;if(0===f)return`${Uv(t)} is constant at ${o(r)} across the series.`;if(.04>f/(Math.abs(e.mean)||1))return`${Uv(t)} ends roughly where it started (${o(r)} at ${c} to ${o(n)} at ${u}), ranging between ${o(i)} and ${o(s)}.`;const m=h>0&&p-1>h,y=d>0&&p-1>d,b=(s-Math.max(r,n))/f,v=(Math.min(r,n)-i)/f;return m&&b>.15?`Overall ${t} climbs to a peak of ${o(s)} (${a}), then falls to ${o(n)} (${u}).`:y&&v>.15?`Overall ${t} drops to a low of ${o(i)} (${l}), then recovers to ${o(n)} (${u}).`:.05>Math.abs(g)/f?`${Uv(t)} ends roughly where it started (${o(r)} at ${c} to ${o(n)} at ${u}), ranging between ${o(i)} and ${o(s)}.`:g>0?h===p-1?`Overall ${t} rises from ${o(r)} (${c}) to a peak of ${o(n)} (${u}).`:`Overall ${t} rises from ${o(r)} (${c}) to ${o(n)} (${u}), after peaking at ${o(s)} (${a}).`:d===p-1?`Overall ${t} falls from ${o(r)} (${c}) to a low of ${o(n)} (${u}).`:`Overall ${t} falls from ${o(r)} (${c}) to ${o(n)} (${u}), after dipping to ${o(i)} (${l}).`}(v,g,s):n.has("l3")&&v&&!c&&wv.has(e)&&(y.l3=`The highest ${m} is ${v.maxLabel} and the lowest is ${v.minLabel}.`),n.has("l4")){const r=Wv(t)?"alerting":function(e,t){const o=function(e){if(e){if("fits"in e||"buildProps"in e){const t=e,o={};for(const[e,r]of Object.entries(t.intentScores))"number"==typeof r&&Number.isFinite(r)&&(o[e]=r);return{family:t.family,intentScores:Object.keys(o).length?o:void 0}}return e}}(t);if(o?.act)return o.act;if(o?.intentScores){const e=function(e){let t,o=0;for(const[r,n]of Object.entries(e))if("number"==typeof n&&n>0)if(n>o)t=r,o=n;else if(n===o&&void 0!==t){const e=Bv.indexOf(r),o=Bv.indexOf(t);-1===e||-1!==o&&e>=o||(t=r)}return t}(o.intentScores);if(e&&Nv[e]&&(o.intentScores[e]??0)>=3)return Nv[e]}return o?.family?Fv[o.family]:function(e){return Sv.has(e)||"StackedAreaChart"===e?"apportioning":$v.has(e)?"relating":wv.has(e)?"comparing":Av.has(e)?"characterizing":kv.has(e)?"tracking":Lv.has(e)?"tracing":"BigNumber"===e?"presenting":void 0}(e)}(e,o.capability);r&&(y.l4=function(e,t,o,r,n,i,s,a){const l=Dv[e],c=/^[aeiou]/i.test(l)?"an":"a";let u,d;switch(e){case"locating":u="This is a map",d="read values by location";break;case"presenting":u="This is a single-value display",d=`read ${"string"==typeof o.label&&o.label?o.label:n} as the headline number`;break;case"tracing":u=`This is ${c} ${l} chart`,d="follow the movement between states";break;case"nesting":u=`This is ${c} ${l} chart`,d="read it for nested structure and how children sum into their parents";break;case"relating":u=`This is ${c} ${l} chart`,d=`read it for whether ${i} and ${n} move together`;break;default:u=`This is ${c} ${l} chart`,d=function(e,t,o,r,n,i){if(!t)switch(e){case"alerting":return"watch for points that break from the rest";case"tracking":return"read it for the overall direction of "+o;case"comparing":return`compare ${o} across ${r}`;case"ranking":return"read it top to bottom by "+o;case"apportioning":return`read each ${r}'s share of the whole`;case"characterizing":return"read it for the spread and shape of "+o;default:return"read the highlighted features"}switch(e){case"alerting":return function(e,t,o){if(wv.has(o)||Sv.has(o))return`${e.maxLabel} stands out at ${t(e.max)} — check it first`;const{first:r,last:n,min:i,max:s,minLabel:a,maxLabel:l,lastLabel:c,minIndex:u,maxIndex:d,count:h}=e,p=s-i;if(p>0){const e=d>0&&h-1>d,o=u>0&&h-1>u,f=(s-Math.max(r,n))/p,g=(Math.min(r,n)-i)/p;if(e&&f>.15)return`the peak of ${t(s)} at ${l} is the point to investigate`;if(o&&g>.15)return`the dip to ${t(i)} at ${a} is the point to investigate`;if(n>=s)return`the climb to ${t(n)} at ${c} warrants a closer look`;if(i>=n)return`the drop to ${t(n)} at ${c} warrants a closer look`}return`the extremes — ${l} (${t(s)}) and ${a} (${t(i)}) — are the points to check`}(t,n,i);case"tracking":return`read it for the trajectory of ${o}, which ${function(e){const t=e.max-e.min,o=e.last-e.first;return 0===t||.05>Math.abs(o)/t?"holds roughly steady":o>0?"rises":"falls"}(t)} from ${n(t.first)} (${t.firstLabel}) to ${n(t.last)} (${t.lastLabel})`;case"comparing":return`compare ${o} across ${r}; ${t.maxLabel} leads at ${n(t.max)}`;case"ranking":return`read it top to bottom by ${o}; ${t.maxLabel} ranks highest at ${n(t.max)}`;case"apportioning":{const e=t.mean*t.count,o=e>0?Math.round(t.max/e*100):null;return`read each ${r}'s share of the ${n(e)} total; ${t.maxLabel} is the largest at ${n(t.max)}${null!=o?` (${o}%)`:""}`}case"characterizing":return`read it for the spread of ${o}, from ${n(t.min)} to ${n(t.max)}`;default:return"read the highlighted features"}}(e,r,n,i,s,t)}return`${u}; ${d}.${function(e,t){if(!t)return"";const o=t.familiarity?.[e];return"number"!=typeof o||o>2?"":` This ${Tv(e)} may be unfamiliar${t.name?` to ${t.name.toLowerCase()} readers`:""} — lean on this description.`}(t,a)}`}(r,e,t,c?null:v,g,m,s,o.audience))}const x=["l1","l2","l3","l4"].filter(e=>n.has(e)&&y[e]).map(e=>y[e]).join(" "),k=Vv(t);return{text:k?`${k} ${x}`.trim():x,levels:y,...k?{annotations:k}:{}}}function Uv(e){return e.length?e[0].toUpperCase()+e.slice(1):e}function Kv(e,t){return 1!==e&&"body"===t?"bodies":1===e?t:t+"s"}function Qv(e){return((e??"unknown")+"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"unknown"}function Zv(e,t,o={}){const r=o.locale??"en",n=Math.max(1,o.maxLeaves??200),i=qv(r),s=Vb(e,t,o.recipe);if(s)return function(e,t,o={}){const r=Gb(t),n=Yb(t),i=Math.max(1,o.maxLeaves??200);if("function"==typeof e.navigation)return e.navigation({data:r,config:n,locale:o.locale??"en"});const s=(a=e.navigation)&&"object"==typeof a?e.navigation:void 0;var a;const l=(s?.groupByRole?Ub(e,s.groupByRole):void 0)??(s?.groupBy?.[0]?Ub(e,s.groupBy[0])??e.dataRoles.find(e=>e.field===s.groupBy?.[0]):void 0)??Kb(e,["nominal","ordinal"]),c=l?Xb(l,n,r):void 0,u=(s?.idRole?Ub(e,s.idRole):void 0)??Kb(e,["identifier"]),d=u?Xb(u,n,r):void 0,h={id:"root",role:"chart",label:s?.summaryTemplate?Qb(s.summaryTemplate,void 0,e,n,r,{count:r.length}):`${e.name}: ${r.length} ${1===r.length?"item":"items"} represented.`,level:1,children:[]};let p=0;const f=(t,o,i)=>{const a=d?t[d]:void 0,l=s?.itemLabelTemplate?Qb(s.itemLabelTemplate,t,e,n,r,{count:r.length}):function(e,t,o,r){const n=Kb(t,["nominal","ordinal"]),i=t.dataRoles.filter(e=>"quantitative"===e.semanticType),s=n?Xb(n,o,r):void 0,a=[];s&&null!=e[s]&&a.push(e[s]+"");for(const t of i){const n=Xb(t,o,r);n&&null!=e[n]&&a.push(`${t.role}: ${e[n]+""}`)}return a.length>0?a.join(", "):"Data item"}(t,e,n,r);return{id:"datum-"+Qv(a??o),role:"datum",label:l,level:i,datum:t}};if(c){const e=new Map;for(const t of r){const o=(t[c]??"Uncategorized")+"",r=e.get(o);r?r.push(t):e.set(o,[t])}h.children=[...e].map(([e,t],o)=>{const r=t.slice(0,Math.max(0,i-p));p+=r.length;const n=r.map((e,t)=>f(e,1e5*o+t,3));return t.length>r.length&&n.push({id:"more-"+Qv(e),role:"datum",label:`…and ${t.length-r.length} more items`,level:3}),{id:"group-"+Qv(e),role:"series",label:`${e}: ${t.length} ${1===t.length?"item":"items"}.`,level:2,children:n}})}else{const e=r.slice(0,i);h.children=e.map((e,t)=>f(e,t,2)),r.length>e.length&&h.children.push({id:"more",role:"datum",label:`…and ${r.length-e.length} more items`,level:2})}return h}(s,t,{maxLeaves:n,locale:r});const a={id:"root",role:"chart",label:Xv(e,t,{locale:r}).text||"Chart.",level:1,children:[]},l=function(e,t){const o=Array.isArray(e.annotations)?e.annotations:null;if(!o)return null;const r=Pv(o.filter(e=>!!e&&"object"==typeof e));if(0===r.length)return null;let n=0;const i=r.slice(0,t).map(e=>{const t=e.lifecycle?.status,o=t&&"accepted"!==t?` (${t})`:"";return{id:"annotation-"+n++,role:"annotation",level:3,label:`${r=Gv(e),r?r.charAt(0).toUpperCase()+r.slice(1):r}${o}.`,datum:e};var r});r.length>t&&i.push({id:"annotation-"+n++,role:"annotation",level:3,label:`…and ${r.length-t} more annotations.`});const s=r.length;return{id:"annotations",role:"annotation",level:2,label:`Annotations: ${1===s?"one marked feature":s+" marked features"}.`,children:i}}(t,n),c=Array.isArray(t.data)?t.data:null,u=kv.has(e)||wv.has(e)||Sv.has(e)||Av.has(e);if(!c||0===c.length||!u)return l&&(a.children=[l]),a;const{measure:d,measureFallback:h,dimension:p,dimensionFallback:f}=Cv(e,t),g=ne(d,h),m=ie(p,f),y="string"==typeof d&&d?d:h,b="string"==typeof p&&p?p:f,v=Mv(t);let x=0;const k=e=>`${e}-${x++}`,w=(e,t)=>{const o=e.slice(0,n).map(e=>((e,t)=>{const o=g(e),r=jv(m(e),i);return{id:k("datum"),role:"datum",level:t,label:`${r}: ${Number.isFinite(o)?i(o):"—"}`,value:Number.isFinite(o)?o:void 0,datum:e}})(e,t));return e.length>n&&o.push({id:k("more"),role:"datum",level:t,label:`…and ${e.length-n} more points`}),o},S=[];if(kv.has(e)||wv.has(e)){let t=1/0,o=-1/0,r=1/0,n=-1/0;const s=[];let a=!0;for(const e of c){const i=g(e);Number.isFinite(i)&&(t>i&&(t=i),i>o&&(o=i));const l=m(e);s.push(l),"number"==typeof l&&Number.isFinite(l)?(r>l&&(r=l),l>n&&(n=l)):a=!1}const l=new Set,u=[];for(const e of s){const t=e+"";l.has(t)||(l.add(t),u.push(e))}const d=a?`${i(r)} to ${i(n)}`:`${jv(u[0],i)} to ${jv(u[u.length-1],i)} (${wv.has(e)?u.length+" categories":c.length+" points"})`;S.push({id:k("axis"),role:"axis",level:2,label:`${wv.has(e)?"Category axis":"X axis"}: ${b}, ${d}.`}),t>o||S.push({id:k("axis"),role:"axis",level:2,label:`Value axis: ${y}, ${i(t)} to ${i(o)}.`})}if(v){const o=ie(v,v),n=new Map;for(const e of c){const t=(o(e)??"—")+"",r=n.get(t);r?r.push(e):n.set(t,[e])}const i=[];for(const[o,s]of n){const n=Xv(e,{...t,data:s},{levels:["l2","l3"],locale:r}).text;i.push({id:k("series"),role:"series",level:2,label:`Series ${o}: ${n}`,children:w(s,3)})}a.children=[...S,...i]}else a.children=[...S,...w(c,2)];return l&&a.children.push(l),a}var Jv=c(require("react")),ex=null,tx=new Set,ox=new Set;function rx(e,t){void 0!==console&&console.warn(`[conversationArc] ${e} failed:`,t)}function nx(e,t){try{const o=t();o&&"function"==typeof o.then&&Promise.resolve(o).catch(t=>rx(e,t))}catch(t){rx(e,t)}}var ix=Object.freeze([]),sx=ix,ax=!1;function lx(){ax=!0}var cx=new Set;function ux(){for(const e of cx)try{e()}catch(e){void 0!==console&&console.warn("[conversationArc] change subscriber threw:",e)}}function dx(){return ex}var hx={get enabled(){return ex?.enabled??!1},get sessionId(){return ex?.sessionId??null},get capacity(){return ex?.capacity??0},record(e){const t=dx();if(!t||!t.enabled)return null;const o={...e,timestamp:e.timestamp??Date.now(),sessionId:e.sessionId??t.sessionId};for(t.buffer.push(o);t.buffer.length>t.capacity;)t.buffer.shift();lx(),ux();for(const e of tx)try{e(o)}catch(e){void 0!==console&&console.warn("[conversationArc] subscriber threw:",e)}return function(e){for(const t of ox)t.record&&nx("sink record",()=>t.record?.(e))}(o),o},flush(){const e=dx();if(!e)return[];const t=e.buffer.slice();return e.buffer=[],lx(),ux(),function(e){for(const t of ox)t.flush&&nx("sink flush",()=>t.flush?.(e))}(t),t},getEvents:()=>ax?(sx=ex?Object.freeze(ex.buffer.slice()):ix,ax=!1,sx):sx,subscribe:e=>(tx.add(e),()=>{tx.delete(e)}),clear(){const e=dx();e&&(e.buffer=[],lx(),ux()),function(){for(const e of ox)e.clear&&nx("sink clear",()=>e.clear?.())}()},reset(){if(tx.clear(),ox.clear(),sx=ix,ax=!1,!ex)return ux(),void cx.clear();ex.buffer=[],ex.enabled=!1,ex=null,ux(),cx.clear()}},px=require("react/jsx-runtime"),fx={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0,padding:0,margin:-1};function gx({tree:e,label:t,visible:o=!1,className:r,onActiveChange:n,activeId:i,chartId:s}){const[a,l]=Jv.useState(()=>new Set([e.id])),[c,u]=Jv.useState(e.id),d=void 0!==i,h=d?i:c,p=Jv.useRef(null),f=Jv.useRef(new Map),g=Jv.useMemo(()=>function(e){const t=new Map,o=e=>{for(const r of e.children??[])t.set(r.id,e),o(r)};return o(e),t}(e),[e]),m=Jv.useMemo(()=>function(e,t){const o=[],r=e=>{if(o.push(e),e.children&&e.children.length>0&&t.has(e.id))for(const t of e.children)r(t)};return r(e),o}(e,a),[e,a]);Jv.useEffect(()=>{d||m.some(e=>e.id===c)||u(e.id)},[m,c,e.id,d]),Jv.useEffect(()=>{const e=[];let t=g.get(h);for(;t;)e.push(t.id),t=g.get(t.id);e.length>0&&l(t=>{if(e.every(e=>t.has(e)))return t;const o=new Set(t);for(const t of e)o.add(t);return o})},[h,g]),Jv.useEffect(()=>{p.current?.contains(document.activeElement)&&f.current.get(h)?.focus()},[h]);const y=Jv.useCallback((e,t,o)=>{hx.enabled&&hx.record("focus"===t?{type:"nav-node-focused",chartId:s,nodeId:e.id,role:e.role,level:e.level,label:e.label.length>200?e.label.slice(0,200):e.label}:{type:"nav-branch-expanded",chartId:s,nodeId:e.id,role:e.role,level:e.level,expanded:!!o})},[s]),b=Jv.useCallback(e=>{e.id!==h&&(d||u(e.id),n?.(e),y(e,"focus"))},[n,d,y,h]),v=e=>{l(t=>new Set(t).add(e.id)),y(e,"toggle",!0)},x=e=>{l(t=>{const o=new Set(t);return o.delete(e.id),o}),y(e,"toggle",!1)},k=(e,t,r)=>{const n=!!e.children&&e.children.length>0,i=a.has(e.id);return(0,px.jsxs)("li",{role:"treeitem","aria-label":e.label,"aria-level":e.level,"aria-posinset":t,"aria-setsize":r,"aria-expanded":n?i:void 0,"aria-selected":e.id===h,tabIndex:e.id===h?0:-1,ref:t=>{f.current.set(e.id,t)},onClick:t=>{t.stopPropagation(),b(e),n&&(i?x:v)(e)},style:o?{listStyle:"none",padding:"2px 6px",paddingLeft:6+16*(e.level-1),cursor:n?"pointer":"default",fontSize:13,color:"var(--semiotic-text, currentColor)",background:e.id===h?"var(--semiotic-surface, var(--semiotic-grid, var(--semiotic-bg, #f0f4f8)))":"transparent",outline:"none"}:void 0,children:[(0,px.jsxs)("span",{className:"semiotic-nav-tree-label semiotic-nav-tree-"+e.role,children:[o&&n?i?"▾ ":"▸ ":"",e.label]}),n&&i&&(0,px.jsx)("ul",{role:"group",style:o?{margin:0,padding:0}:void 0,children:e.children.map((t,o)=>k(t,o+1,e.children.length))})]},e.id)};return(0,px.jsx)("div",{ref:p,className:"semiotic-nav-tree"+(r?" "+r:""),style:o?void 0:fx,onKeyDown:e=>{const t=m.findIndex(e=>e.id===h);if(-1===t)return;const o=m[t],r=!!o.children&&o.children.length>0,n=a.has(o.id);let i=!0;switch(e.key){case"ArrowDown":b(m[Math.min(t+1,m.length-1)]);break;case"ArrowUp":b(m[Math.max(t-1,0)]);break;case"Home":b(m[0]);break;case"End":b(m[m.length-1]);break;case"ArrowRight":r&&!n?v(o):r&&n?b(o.children[0]):i=!1;break;case"ArrowLeft":if(r&&n)x(o);else{const e=g.get(o.id);e?b(e):i=!1}break;case"Enter":case" ":r?(n?x:v)(o):i=!1;break;default:i=!1}i&&(e.preventDefault(),e.stopPropagation())},children:(0,px.jsx)("ul",{role:"tree","aria-label":t||"Chart navigation",style:o?{margin:0,padding:0}:void 0,children:k(e,1,1)})})}var mx=c(require("react")),yx=require("react/jsx-runtime");function bx(e,t,o=0){const r=Math.min(t[0],t[1]),n=Math.max(t[0],t[1]),i=Math.max(r,Math.min(n,e[0])),s=Math.max(r,Math.min(n,e[1])),a=i>s?[s,i]:[i,s];if(a[1]-a[0]>=o)return a;const l=(a[0]+a[1])/2,c=o/2;return[Math.max(r,Math.min(n-o,l-c)),Math.min(n,Math.max(r+o,l+c))]}function vx(e,t,o,r=1,n=r){const i="in"===o?r:-r;return bx([e[0]+i,e[1]-i],t,n)}function xx(e){const{domain:t,initialValue:o=t,step:r=1,minSpan:n=r,label:i,formatValue:s,onChange:a}=e,[l,c]=mx.useState(()=>bx(o,t,n)),u=bx(l,t,n),d=mx.useCallback(e=>{const o=bx(e,t,n);c(o),a?.(o)},[t,n,a]),h=mx.useMemo(()=>({label:i,domain:t,value:u,step:r,formatValue:s,onChange:d,onClear:()=>d(t)}),[t,s,i,d,r,u]),p=mx.useMemo(()=>({onZoomIn:()=>d(vx(u,t,"in",r,n)),onZoomOut:()=>d(vx(u,t,"out",r,n)),onReset:()=>d(t)}),[t,n,d,r,u]);return{value:u,setValue:d,xExtent:u,brush:h,zoom:p}}var kx={display:"grid",gap:8,padding:"10px 12px",border:"1px solid var(--semiotic-border, #d8dee4)",borderRadius:12,background:"var(--semiotic-surface, var(--semiotic-bg, rgba(255,255,255,0.92)))"},wx={fontSize:11,fontWeight:700,letterSpacing:"0.04em",textTransform:"uppercase",color:"var(--semiotic-text-secondary, #57606a)"};function Sx(e,t){return{minWidth:e,minHeight:e,padding:"0 12px",borderRadius:999,border:"1px solid var(--semiotic-border, #d8dee4)",background:t?"var(--semiotic-primary, #0969da)":"var(--semiotic-bg, #fff)",color:t?"var(--semiotic-on-primary, #fff)":"var(--semiotic-text, #24292f)",fontSize:13,fontWeight:650,touchAction:"manipulation"}}function Ax(e){return"function"==typeof e}function Cx({brush:e,targetSize:t}){const o=e?.value,r=e?.domain,n=!!o&&!!r,i=!0===e?.disabled,s=e?.formatValue??(e=>e),a=!!e?.onChange&&n&&!i,l=r?.[0]??0,c=r?.[1]??1,u=o?.[0]??l,d=o?.[1]??c,h=e?.step??((c-l)/100||1);return(0,yx.jsxs)("section",{style:kx,"aria-label":"Brush controls",children:[(0,yx.jsx)("div",{style:wx,children:e?.label??"Filter range"}),n?(0,yx.jsxs)("div",{style:{display:"grid",gap:8},children:[(0,yx.jsxs)("label",{style:{display:"grid",gap:4,fontSize:12},children:[(0,yx.jsxs)("span",{children:["Start: ",s(u)]}),(0,yx.jsx)("input",{type:"range",min:l,max:c,step:h,value:u,disabled:!a,style:{minHeight:t},onChange:t=>{const o=Number(t.currentTarget.value);e?.onChange?.([Math.min(o,d),d])}})]}),(0,yx.jsxs)("label",{style:{display:"grid",gap:4,fontSize:12},children:[(0,yx.jsxs)("span",{children:["End: ",s(d)]}),(0,yx.jsx)("input",{type:"range",min:l,max:c,step:h,value:d,disabled:!a,style:{minHeight:t},onChange:t=>{const o=Number(t.currentTarget.value);e?.onChange?.([u,Math.max(o,u)])}})]})]}):(0,yx.jsx)("div",{style:{fontSize:12,color:"var(--semiotic-text-secondary, #57606a)"},children:"Provide a brush domain and value to expose range inputs beside the drag gesture."}),(0,yx.jsx)("button",{type:"button",disabled:i||!Ax(e?.onClear),onClick:e?.onClear,style:Sx(t),children:"Clear range"})]})}function Mx({zoom:e,targetSize:t}){const o=!0===e?.disabled;return(0,yx.jsxs)("section",{style:kx,"aria-label":"Zoom controls",children:[(0,yx.jsx)("div",{style:wx,children:e?.label??"Zoom"}),(0,yx.jsxs)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[(0,yx.jsx)("button",{type:"button","aria-label":"Zoom out",disabled:o||!Ax(e?.onZoomOut),onClick:e?.onZoomOut,style:Sx(t),children:"-"}),(0,yx.jsx)("button",{type:"button","aria-label":"Reset zoom",disabled:o||!Ax(e?.onReset),onClick:e?.onReset,style:Sx(t),children:"Reset"}),(0,yx.jsx)("button",{type:"button","aria-label":"Zoom in",disabled:o||!Ax(e?.onZoomIn),onClick:e?.onZoomIn,style:Sx(t),children:"+"})]})]})}function jx({legend:e,targetSize:t}){const o=!0===e?.disabled,r=e?.items??[];return(0,yx.jsxs)("section",{style:kx,"aria-label":"Legend controls",children:[(0,yx.jsx)("div",{style:wx,children:e?.label??"Series"}),r.length>0&&(0,yx.jsx)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:r.map(r=>{const n=!1!==r.active;return(0,yx.jsxs)("button",{type:"button",disabled:o||r.disabled||!e?.onToggle,onClick:()=>e?.onToggle?.(r.id,!n),style:Sx(t,n),"aria-pressed":n,children:[r.color&&(0,yx.jsx)("span",{"aria-hidden":"true",style:{display:"inline-block",width:9,height:9,marginRight:6,borderRadius:999,background:r.color}}),r.label??r.id]},r.id)})}),(0,yx.jsxs)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[(0,yx.jsx)("button",{type:"button",disabled:o||!Ax(e?.onShowAll),onClick:e?.onShowAll,style:Sx(t),children:"Show all"}),(0,yx.jsx)("button",{type:"button",disabled:o||!Ax(e?.onHideAll),onClick:e?.onHideAll,style:Sx(t),children:"Hide all"})]})]})}function Px({controls:e,targetSize:t=44,compact:o=!1,className:r,style:n,ariaLabel:i="Mobile chart controls",brush:s,zoom:a,legend:l}){const c=function(e,t){if(!1===e)return[];if(!0===e||"all"===e)return["brush","zoom","legend"];if(Array.isArray(e))return e;if(e)return[e];const o=[];return t.brush&&o.push("brush"),t.zoom&&o.push("zoom"),t.legend&&o.push("legend"),o}(e,{brush:s,zoom:a,legend:l});return 0===c.length?null:(0,yx.jsxs)("div",{className:r,role:"group","aria-label":i,style:{display:"grid",gridTemplateColumns:o?"1fr":"repeat(auto-fit, minmax(180px, 1fr))",gap:10,...n},children:[c.includes("brush")&&(0,yx.jsx)(Cx,{brush:s,targetSize:t}),c.includes("zoom")&&(0,yx.jsx)(Mx,{zoom:a,targetSize:t}),c.includes("legend")&&(0,yx.jsx)(jx,{legend:l,targetSize:t})]})}var _x=new Set(["LineChart","AreaChart","DifferenceChart","StackedAreaChart","Scatterplot","ConnectedScatterplot","BubbleChart","QuadrantChart","MultiAxisLineChart","CandlestickChart","Heatmap","MinimapChart","RealtimeLineChart","RealtimeHeatmap"]),Lx=new Set(["BarChart","StackedBarChart","GroupedBarChart","SwarmPlot","BoxPlot","Histogram","ViolinPlot","DotPlot","RidgelinePlot","FunnelChart","LikertChart","SwimlaneChart"]),Rx={Scatterplot:["pointRadius","hoverRadius"],BubbleChart:["pointRadius","hoverRadius"],ConnectedScatterplot:["pointRadius","hoverRadius"],QuadrantChart:["pointRadius","hoverRadius"],SwarmPlot:["pointRadius","hoverRadius"],DotPlot:["dotRadius","hoverRadius"]};function Tx(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function Ix(e){return"string"==typeof e&&e.trim().length>0}function $x(e){const t=Tx(e.capability)?e.capability:null,o=Tx(e.recipe)?e.recipe:null,r=[e.mobileSemantics,e.mobileVisualization,e.mobile,t?.mobile,o?.mobile];for(const e of r)if(Tx(e))return e;return null}function Nx(e){return Array.isArray(e)&&e.length>=2&&"number"==typeof e[0]&&"number"==typeof e[1]&&Number.isFinite(e[0])&&Number.isFinite(e[1])?[e[0],e[1]]:null}function Fx(e){return Nx(e.size)||Nx(Tx(e.frameProps)?e.frameProps.size:void 0)||("number"==typeof e.width&&"number"==typeof e.height?[e.width,e.height]:null)}function Bx(e,t){e.push({...t,status:"pass"})}function Dx(e,t){e.push({...t,status:"warn"})}function Ex(e,t){e.push({...t,status:"manual"})}function zx(e,t={},o={}){const r=o.viewportWidth??390,n=o.targetSize??44,i=Fx(t),s=tp(t,{width:r,height:i?.[1]}),a=[],l=Fx(t=s.props),c=$x(t),u=function(e,t){return e.includes("CustomChart")||e.includes("Custom")||null!=t.recipeId||null!=t.mobileSemantics}(e,t),d=function(e){const t=$x(e);return!0===e.responsive||!0===e.mobile||!0===t?.responsive||!0===t?.supportsResponsiveLayout||Array.isArray(t?.breakpoints)||"number"==typeof t?.minViewportWidth||"responsive"===t?.strategy||"small-multiples"===t?.strategy||"summary-cards"===t?.strategy||null!=e.mobileLayout||null!=e.responsiveRules||"mobile-readable"===e.density}(t),h=!0===o.inChartContainer,p=Ix(t.title)||Ix(t.summary)||Ix(t.description)||!0===c?.summary||Ix(c?.summary);if(s.matches.length>0&&Bx(a,{id:"layout.responsive-rule-applied",category:"layout",impact:"medium",message:`${s.matches.length} responsive rule(s) applied for the ${r}px mobile audit.`}),l){const[t,o]=l;t>r&&!d?Dx(a,{id:"layout.fixed-desktop-size",category:"layout",impact:"high",message:`Chart size is ${t}px wide against a ${r}px mobile viewport with no responsive/mobile transform hint.`,fix:"Use responsive sizing, responsiveRules/mobileLayout, or an explicit mobile variant that preserves the task instead of clipping the desktop chart."}):Bx(a,{id:"layout.fixed-desktop-size",category:"layout",impact:"high",message:"No fixed desktop-width overflow risk is visible from the config."}),"number"==typeof c?.minViewportWidth&&c.minViewportWidth>r&&Dx(a,{id:"layout.mobile-min-width",category:"layout",impact:"high",message:`The declared mobile contract supports ${c.minViewportWidth}px minimum, wider than the audited ${r}px viewport.`,fix:"Add a narrower breakpoint, summary-card fallback, or explicit horizontal-scroll affordance with a non-visual equivalent."});const n=t/Math.max(1,o);430>=r&&n>2.4&&"BigNumber"!==e&&Dx(a,{id:"layout.wide-aspect-ratio",category:"layout",impact:"medium",message:`Chart aspect ratio is ${n.toFixed(1)}:1, which tends to compress phone charts vertically.`,fix:"Prefer stacked sections, small multiples, cards plus a sparkline, or a taller mobile-specific chart ratio."}),160>o&&"BigNumber"!==e&&Dx(a,{id:"layout.too-short-for-reading",category:"layout",impact:"medium",message:`Chart height is ${o}px; most phone charts need enough vertical room for marks plus readable labels.`,fix:"Reserve more vertical space, remove nonessential axes, or switch to a card/sparkline pattern with external labels."})}else Ex(a,{id:"layout.unknown-size",category:"layout",impact:"medium",message:"No explicit size is available to audit. This may be responsive, but static mobile overflow cannot be checked.",fix:"Audit rendered widths at 320, 360, 390, and 430px, or pass size/responsiveRules metadata into the config."});const f=function(e){const t=[e.data,e.points,e.lines,e.nodes,e.edges,e.areas,Tx(e.frameProps)?e.frameProps.data:void 0];let o=0;for(const e of t)Array.isArray(e)&&(o+=e.length);return o}(t);f>0&&(f>("number"==typeof c?.maxMarks?c.maxMarks:_x.has(e)?1.25*r:Lx.has(e)?Math.max(8,Math.floor(r/34)):r)?Dx(a,{id:"density.mark-budget",category:"density",impact:_x.has(e)?"medium":"high",message:`${f} data item(s) exceed the rough mobile density budget for ${e} at ${r}px.`,fix:"Aggregate, filter, facet into small multiples, switch to a summary-card plus detail view, or use progressive disclosure."}):Bx(a,{id:"density.mark-budget",category:"density",impact:"medium",message:f+" data item(s) are within the rough mobile density budget for this component."}));const g=function(e){const t=[e.tickValues,e.xTickValues,e.yTickValues,e.rTickValues,e.oTickValues];let o=0;for(const e of t)Array.isArray(e)&&(o+=e.length);return o>0?o:null}(t),m=!1!==t.showAxes&&!1!==t.axis;if(m&&null!=g){const e=Math.max(3,Math.floor(r/58));g>e&&Dx(a,{id:"density.explicit-tick-count",category:"density",impact:"medium",message:`${g} explicit tick(s) exceed a phone-friendly budget of about ${e} at ${r}px.`,fix:"Use adaptive ticks, fewer tickValues, direct labels, or move exact values into a tap-accessible detail panel."})}else m&&(_x.has(e)||Lx.has(e))&&Ex(a,{id:"density.axis-label-collision",category:"density",impact:"medium",message:"Axes are enabled, but label collision depends on rendered tick text and cannot be checked statically.",fix:"Verify tick labels at phone widths or provide explicit mobile tick density."});!function(e){const t=Tx(e.frameProps)?e.frameProps:{};return(!0===e.enableHover||null!=e.tooltipContent||null!=e.tooltip||null!=t.tooltipContent||!0===t.enableHover)&&!function(e){const t=$x(e),o=Tx(e.mobileInteraction)?e.mobileInteraction:null;return null!=e.controls||null!=e.mobileControls||!0===e.alternativeControls||null!=e.selection||null!=e.onClick||null!=e.onSelect||!0===e.mobileInteraction||!0===o?.tapToSelect||!0===o?.tapToLockTooltip||Array.isArray(t?.interaction?.alternatives)&&t.interaction.alternatives.length>0||"tap"===t?.interaction?.primary||"button"===t?.interaction?.primary||Ix(t?.interaction?.hoverFallback)}(e)}(t)?Bx(a,{id:"interaction.hover-only-detail",category:"interaction",impact:"high",message:"No hover-only detail path is visible from the config."}):Dx(a,{id:"interaction.hover-only-detail",category:"interaction",impact:"high",message:"The chart exposes tooltip/hover detail without an obvious tap, selection, or control alternative.",fix:"Enable tap-to-select, a persistent details panel, visible segment buttons, or another non-hover path for the same information."});const y=function(e,t){const o=Rx[e];if(!o)return null;let r=o.includes("hoverRadius")?30:null;for(const e of o){const o=t[e];"number"==typeof o&&Number.isFinite(o)&&o>0&&(r=null==r?o:Math.max(r,o))}return null==r?null:2*r}(e,t),b=Tx(t.mobileInteraction)?t.mobileInteraction:null,v=y??("number"==typeof b?.targetSize?b.targetSize:!0===t.mobileInteraction?44:"number"==typeof c?.minimumHitTarget?c.minimumHitTarget:"number"==typeof c?.interaction?.targetSize?c.interaction.targetSize:null);null!=v&&(24>v?Dx(a,{id:"interaction.target-size-minimum",category:"interaction",impact:"high",message:`Small interactive marks expose an estimated ${v}px pointer target, below WCAG's 24px minimum.`,fix:"Increase mark radius/hoverRadius, add tap snapping to nearest datum, or provide larger external controls."}):n>v?Dx(a,{id:"interaction.target-size-comfort",category:"interaction",impact:"medium",message:`Pointer target is about ${v}px, above 24px but below the ${n}px comfortable phone target.`,fix:"Use hoverRadius/tapRadius near 44px while keeping the visible mark small if needed."}):Bx(a,{id:"interaction.target-size-comfort",category:"interaction",impact:"medium",message:`Pointer target is about ${v}px, meeting the configured ${n}px target.`}));const x=[];null==t.brush&&null==t.onBrush||x.push("brush"),!0===t.zoomable&&x.push("pan/zoom"),"isolate"!==t.legendInteraction&&"highlight"!==t.legendInteraction||x.push("legend filtering"),x.length>0&&!function(e,t){const o=$x(e),r=Tx(e.mobileInteraction)?e.mobileInteraction:null,n=r?.standardControls;return!!(null!=e.controls||null!=e.mobileControls||!0===e.alternativeControls||Array.isArray(o?.interaction?.alternatives)&&o.interaction.alternatives.length>0)||!0===n||"all"===n||t.every(e=>"brush"===e?Array.isArray(n)?n.includes("brush"):"brush"===n:"pan/zoom"===e?Array.isArray(n)?n.includes("zoom"):"zoom"===n:"legend filtering"===e&&(Array.isArray(n)?n.includes("legend"):"legend"===n))}(t,x)&&Dx(a,{id:"interaction.complex-gesture-alternative",category:"interaction",impact:"high",message:`Mobile-hostile complex interaction detected: ${x.join(", ")} without standard control alternatives.`,fix:"Pair gestures with buttons, range inputs, chips, or a details panel that works with touch and keyboard."}),!1===t.showLegend||!1===t.legend||!0!==t.showLegend&&!0!==t.legend&&null==t.colorBy&&null==t.groupBy&&null==t.lineBy&&null==t.areaBy&&null==t.stackBy||!0===t.directLabel||!0===t.showLabels||"direct"===t.labelStrategy||"direct-end"===t.labelStrategy||"direct"===c?.labels?.strategy||"inline"===c?.labels?.strategy||"external"===c?.labels?.strategy||r>430||Dx(a,{id:"semantics.legend-over-direct-labels",category:"semantics",impact:"medium",message:"The chart appears to rely on a legend instead of direct labels at phone width.",fix:"Prefer direct end labels, inline labels, or a compact chip selector so readers do not bounce between plot and legend."});const k=Array.isArray(t.annotations)?t.annotations.filter(e=>Tx(e)):[];if(k.length>("number"==typeof c?.maxAnnotations?c.maxAnnotations:3)&&430>=r&&Dx(a,{id:"annotation.mobile-density",category:"annotation",impact:"medium",message:k.length+" annotation(s) compete for phone plot space.",fix:"Assign annotation priority, collapse secondary notes into a callout list, or provide shorter mobileText."}),k.length>0){const e=k.filter(e=>!Ix(e.mobileText)&&!Ix(e.shortText)&&!Ix(e.label));e.length>0&&Ex(a,{id:"annotation.mobile-copy",category:"annotation",impact:"low",message:e.length+" annotation(s) lack explicit short/mobile copy.",fix:"Add mobileText or shortText for notes that need to survive narrow layouts."})}d||"BigNumber"===e||Ex(a,{id:"layout.no-responsive-transform",category:"layout",impact:"low",message:"No explicit responsive transformation hint is present.",fix:"Declare responsiveRules/mobileLayout or a density/label strategy so the mobile version is a designed transformation, not an accidental resize."}),u&&(c?(Bx(a,{id:"semantics.custom-mobile-contract",category:"semantics",impact:"medium",message:"Custom chart/recipe provides a mobileSemantics/mobile contract, so the audit can inspect its authored phone behavior."}),!1===c.custom?.dataBearingSceneNodes?Dx(a,{id:"semantics.custom-data-bearing-scene",category:"semantics",impact:"medium",message:"Custom mobile contract says emitted scene nodes are not data-bearing.",fix:"Preserve datum references, semantic roles, or accessible-table fields so intelligence, navigation, and tap details can recover the chart's meaning."}):!0!==c.custom?.dataBearingSceneNodes&&Ex(a,{id:"semantics.custom-data-bearing-scene",category:"semantics",impact:"low",message:"Custom chart mobile contract does not state whether scene nodes are data-bearing.",fix:"Set mobile.custom.dataBearingSceneNodes and mobile.custom.navigationGranularity for custom layouts and interoperability adapters."})):Ex(a,{id:"semantics.custom-mobile-contract",category:"semantics",impact:"medium",message:"Custom chart layout is opaque to static mobile analysis because no mobileSemantics/mobile contract is present.",fix:"Declare mobileSemantics with strategy, breakpoints, mark budgets, touch target size, interaction alternatives, and custom scene semantics."})),p||h||Dx(a,{id:"semantics.no-mobile-summary",category:"semantics",impact:"medium",message:"No title, summary, description, or ChartContainer context is visible from the config.",fix:"Add title/summary text or wrap in ChartContainer so the small-screen reader gets the task before the chart."});const w=a.filter(e=>"warn"===e.status),S={highRisk:w.filter(e=>"high"===e.impact).length,warnings:w.length,manual:a.filter(e=>"manual"===e.status).length,passes:a.filter(e=>"pass"===e.status).length};return{component:e,viewportWidth:r,ok:0===S.highRisk,summary:S,findings:a,reference:"Mobile visualization audit: informed by MobileVisFixer, mobile exploratory interaction research, small-multiple mobile studies, responsive visualization grammars, constraint-based breakpoints, and WCAG 2.2 input modalities."}}var Hx=require("react/jsx-runtime"),Ox={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0,padding:0,margin:-1};function Wx(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function qx(e){return e&&"object"==typeof e&&"number"==typeof e.targetSize?e.targetSize:void 0}function Yx(e){return Array.isArray(e)?e.length>0:!!e}function Gx(){const e=function(){const e=Hi.useContext(Wi);return e?e.toggle:null}();return e?(0,Hx.jsx)("button",{className:"semiotic-chart-action",onClick:e,title:"Data summary","aria-label":"Toggle data summary",style:ok,children:(0,Hx.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,Hx.jsx)("rect",{x:"1",y:"1",width:"12",height:"3",rx:"0.5"}),(0,Hx.jsx)("rect",{x:"1",y:"6",width:"8",height:"3",rx:"0.5"}),(0,Hx.jsx)("rect",{x:"1",y:"11",width:"5",height:"2",rx:"0.5"})]})}):null}var Vx={info:"var(--semiotic-info, #2563eb)",success:"var(--semiotic-success, #16a34a)",warning:"var(--semiotic-warning, #d97706)",error:"var(--semiotic-error, var(--semiotic-danger, #dc2626))",neutral:"var(--semiotic-text-secondary, #6b7280)"},Xx={error:4,warning:3,info:2,success:1,neutral:0};function Ux({level:e}){const t={width:15,height:15,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0};switch(e){case"error":case"warning":return(0,Hx.jsxs)("svg",{...t,children:[(0,Hx.jsx)("path",{d:"M8 1.8 15 14H1L8 1.8Z"}),(0,Hx.jsx)("path",{d:"M8 6.4v3.4"}),(0,Hx.jsx)("circle",{cx:"8",cy:"11.8",r:"0.5",fill:"currentColor",stroke:"none"})]});case"success":return(0,Hx.jsxs)("svg",{...t,children:[(0,Hx.jsx)("circle",{cx:"8",cy:"8",r:"6.4"}),(0,Hx.jsx)("path",{d:"M5 8.2 7 10.2 11 5.8"})]});case"info":return(0,Hx.jsxs)("svg",{...t,children:[(0,Hx.jsx)("circle",{cx:"8",cy:"8",r:"6.4"}),(0,Hx.jsx)("path",{d:"M8 7.4V11"}),(0,Hx.jsx)("circle",{cx:"8",cy:"5",r:"0.5",fill:"currentColor",stroke:"none"})]});default:return(0,Hx.jsxs)("svg",{...t,children:[(0,Hx.jsx)("path",{d:"M8 2a3.5 3.5 0 0 0-3.5 3.5c0 4-1.5 5-1.5 5h10s-1.5-1-1.5-5A3.5 3.5 0 0 0 8 2Z"}),(0,Hx.jsx)("path",{d:"M6.5 13a1.5 1.5 0 0 0 3 0"})]})}}function Kx({notification:e,level:t,onDismiss:o}){const r=Vx[t]??Vx.info,n=!1!==e.dismissible;return(0,Hx.jsxs)("div",{className:"semiotic-chart-notification semiotic-chart-notification--"+t,style:{display:"flex",alignItems:"flex-start",gap:8,padding:"6px 10px",borderRadius:4,borderLeft:"3px solid "+r,background:"var(--semiotic-surface, rgba(127, 127, 127, 0.08))"},children:[(0,Hx.jsxs)("div",{style:{flex:1,minWidth:0},children:[e.source&&(0,Hx.jsx)("div",{className:"semiotic-chart-notification-source",style:{fontSize:9,fontWeight:700,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--semiotic-text-secondary, #666)"},children:e.source}),e.title&&(0,Hx.jsx)("div",{className:"semiotic-chart-notification-title",style:{fontSize:12,fontWeight:600,color:r},children:e.title}),(0,Hx.jsx)("div",{className:"semiotic-chart-notification-message",style:{fontSize:12,lineHeight:1.45,color:"var(--semiotic-text, #333)"},children:e.message})]}),n&&(0,Hx.jsx)("button",{className:"semiotic-chart-notification-dismiss","aria-label":e.title?"Dismiss notification: "+e.title:"Dismiss notification",title:"Dismiss",onClick:o,style:{...ok,width:18,height:18,fontSize:13,lineHeight:1,flex:"none"},children:"×"})]})}function Qx({visible:e,onDismiss:t}){const[o,r]=xv.useState(!1),n=xv.useRef(null),i=xv.useRef(null);if(xv.useEffect(()=>{0===e.length&&o&&r(!1)},[e.length,o]),xv.useEffect(()=>{if(!o)return;const e=e=>{n.current&&!n.current.contains(e.target)&&r(!1)},t=e=>{"Escape"===e.key&&(r(!1),i.current?.focus())};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)}},[o]),0===e.length)return null;const s=e.reduce((e,t)=>Xx[t.level]>Xx[e]?t.level:e,e[0].level),a=Vx[s]??Vx.info,l=e.length,c=`${l} chart notification${1===l?"":"s"}, most severe: ${s}`;return(0,Hx.jsxs)("div",{ref:n,className:"semiotic-chart-notifications",style:{position:"relative",display:"inline-flex"},children:[(0,Hx.jsx)("span",{style:Ox,role:"status","aria-live":"polite",children:c}),(0,Hx.jsxs)("button",{ref:i,className:"semiotic-chart-action semiotic-chart-notifications-toggle","aria-haspopup":"dialog","aria-expanded":o,"aria-label":`${c}. ${o?"Hide":"Show"} notifications`,title:c,onClick:()=>r(e=>!e),style:{...ok,color:a,position:"relative"},children:[(0,Hx.jsx)(Ux,{level:s}),(0,Hx.jsx)("span",{className:"semiotic-chart-notifications-badge","aria-hidden":"true",style:{position:"absolute",top:-3,right:-3,minWidth:15,height:15,padding:"0 3px",boxSizing:"border-box",borderRadius:8,background:a,color:"#fff",fontSize:9,fontWeight:700,lineHeight:"15px",textAlign:"center"},children:l>99?"99+":l})]}),o&&(0,Hx.jsx)("div",{className:"semiotic-chart-notifications-popover",role:"dialog","aria-label":"Chart notifications",style:{position:"absolute",top:"calc(100% + 6px)",right:0,zIndex:20,width:320,maxWidth:"min(360px, 90vw)",maxHeight:320,overflowY:"auto",display:"flex",flexDirection:"column",gap:6,padding:10,textAlign:"left",background:"var(--semiotic-bg, #fff)",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:6,boxShadow:"0 6px 24px rgba(0, 0, 0, 0.16)"},children:e.map(e=>(0,Hx.jsx)(Kx,{notification:e.notification,level:e.level,onDismiss:()=>t(e)},e.key))})]})}var Zx={live:{bg:"#22c55e",color:"#fff"},stale:{bg:"#ef4444",color:"#fff"},paused:{bg:"#eab308",color:"#000"},error:{bg:"#ef4444",color:"#fff"},static:{bg:"#6b7280",color:"#fff"}};function Jx({height:e}){return(0,Hx.jsx)("div",{role:"status","aria-busy":"true","aria-label":"Loading chart",style:{width:"100%",height:e,background:"linear-gradient(90deg, var(--semiotic-border, #e0e0e0) 25%, var(--semiotic-bg, #f5f5f5) 50%, var(--semiotic-border, #e0e0e0) 75%)",backgroundSize:"200% 100%",animation:"semiotic-skeleton-pulse 1.5s ease-in-out infinite",borderRadius:4}})}function ek({error:e}){return(0,Hx.jsx)("div",{role:"alert",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",minHeight:120,padding:24,boxSizing:"border-box"},children:(0,Hx.jsx)("div",{style:{textAlign:"center",maxWidth:400,fontSize:14,color:"var(--semiotic-text-secondary, #666)",lineHeight:1.5},children:e})})}var tk=xv.forwardRef(function({title:e,subtitle:t,children:o,width:r="100%",height:n=400,actions:i,chartConfig:s,describe:a,navigable:l,controls:c,banner:u,notifications:d,onNotificationDismiss:h,loading:p=!1,error:f,errorBoundary:g=!1,status:m,detailsPanel:y,mobile:b,mobileAudit:v,className:x,style:k},w){const S=xv.useRef(null),A=xv.useRef(null),[C,M]=xv.useState(!1),[j,P]=xv.useState(()=>new Set);xv.useEffect(()=>{P(e=>{if(0===e.size)return e;const t=new Set((d??[]).map((e,t)=>e.id??t+""));let o=!1;const r=new Set;for(const n of e)t.has(n)?r.add(n):o=!0;return o?r:e})},[d]);const _=xv.useMemo(()=>d?d.map((e,t)=>({notification:e,index:t,key:e.id??t+"",level:e.level??"info"})).filter(({key:e})=>!j.has(e)):[],[d,j]),L=xv.useCallback(e=>{P(t=>new Set(t).add(e.key)),h?.(e.notification,e.index)},[h]),R=!1!==i?.export&&void 0!==i?.export,T=!1!==i?.fullscreen&&void 0!==i?.fullscreen,I=!1!==i?.copyConfig&&void 0!==i?.copyConfig&&s,$=!0===i?.dataSummary,N=xv.useMemo(()=>{if(!a||!s?.component||!s?.props)return"";const e="object"==typeof a?a.levels:void 0;try{return Xv(s.component,s.props,e?{levels:e}:{}).text}catch{return""}},[a,s]),F="object"==typeof a&&!0===a.visible,B=xv.useMemo(()=>{if(!l||!s?.component||!s?.props)return null;const e="object"==typeof l?l.maxLeaves:void 0;try{return Zv(s.component,s.props,e?{maxLeaves:e}:{})}catch{return null}},[l,s]),D="object"==typeof l&&!0===l.visible,E=xv.useMemo(()=>"object"==typeof i?.export?i.export:{},[i?.export]),z="object"==typeof i?.copyConfig?i.copyConfig.format:"json",H=xv.useCallback(async e=>{A.current&&await Cb(A.current,{...E,...e})},[E]),O=xv.useCallback(()=>{S.current&&(document.fullscreenElement?document.exitFullscreen().catch(()=>{}):S.current.requestFullscreen().catch(()=>{}))},[]),W=xv.useCallback(async e=>{s&&await av({...s,version:s.version??"1",createdAt:s.createdAt??(new Date).toISOString()},e||z||"json")},[s,z]);xv.useEffect(()=>{const e=()=>{M(!!document.fullscreenElement)};return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[]),xv.useImperativeHandle(w,()=>({export:H,toggleFullscreen:O,copyConfig:W,element:S.current}),[H,O,W]);const q=!0===b?{}:b&&"object"==typeof b?b:null,Y=!!b,G=q?.breakpoint??480,V=void 0===q?.chartMode?"mobile":q.chartMode,X=q?.semantics,U=q?.mobileInteraction??(!!Y||void 0),K=q?.standardControls,Q=Wx(K)?K:null,Z=Q?.controls??(Wx(K)?void 0:K)??function(e){return e&&"object"==typeof e?e.standardControls:void 0}(U),J=Yx(Z)?U&&"object"==typeof U?{...U,standardControls:Z}:!1===U||null==U?U:{standardControls:Z}:U,ee=Y&&Yx(Z)?(0,Hx.jsx)(Px,{controls:Z,targetSize:Q?.targetSize??qx(U)??44,compact:Q?.compact??!0,className:Q?.className,style:Q?.style,ariaLabel:Q?.ariaLabel,brush:Q?.brush,zoom:Q?.zoom,legend:Q?.legend}):null,te=q?.summary,oe=!0===q?.allowHorizontalScroll,re=!0===q?.hideToolbar,ne=xv.useMemo(()=>{if(!v||!s?.component||!s?.props)return null;const e="object"==typeof v?v:{},t=s.props;try{return zx(s.component,{...t,mobileSemantics:t.mobileSemantics??X,mobileInteraction:t.mobileInteraction??J},{viewportWidth:e.viewportWidth??390,targetSize:e.targetSize??44,inChartContainer:!0})}catch{return null}},[v,s,X,J]);xv.useEffect(()=>{if(!ne||ne.ok)return;const e=ne.findings.filter(e=>"pass"!==e.status).slice(0,5);console.warn(`[Semiotic mobile audit] ${s?.component}: ${ne.summary.highRisk} high-risk mobile finding(s), ${ne.summary.warnings} warning(s).`,e)},[ne,s?.component]);const ie=ne&&!ne.ok&&"object"==typeof v&&!0===v.visible?(0,Hx.jsxs)("div",{className:"semiotic-chart-mobile-audit",role:"status",style:{padding:"8px 12px",fontSize:12,lineHeight:1.45,color:"var(--semiotic-warning, #6b3f00)",background:"color-mix(in srgb, var(--semiotic-warning, #d97706) 14%, var(--semiotic-bg, #fff))",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},children:["Mobile audit: ",ne.summary.highRisk," high-risk finding",1===ne.summary.highRisk?"":"s"," and"," ",ne.summary.warnings," warning",1===ne.summary.warnings?"":"s"," at"," ",("object"==typeof v?v.viewportWidth:void 0)??390,"px."]}):null,se=_.length>0,ae=e||t||c||R||T||I||$||m||se,le=xv.useMemo(()=>{if(!Y||!xv.isValidElement(o))return o;const e=o.props,t={};return V&&null==e.mode&&(t.mode=V),X&&null==e.mobileSemantics&&(t.mobileSemantics=X),void 0!==J&&null==e.mobileInteraction&&(t.mobileInteraction=J),Object.keys(t).length>0?xv.cloneElement(o,t):o},[o,Y,V,X,J]),ce=p?(0,Hx.jsx)(Jx,{height:n}):f?(0,Hx.jsx)(ek,{error:f}):g?(0,Hx.jsx)(rd,{children:le}):le;return ue=(0,Hx.jsxs)(Hx.Fragment,{children:[(0,Hx.jsx)("style",{dangerouslySetInnerHTML:{__html:`@keyframes semiotic-skeleton-pulse {\n 0% { background-position: 200% 0; }\n 100% { background-position: -200% 0; }\n}\n@media (max-width: ${G}px) {\n .semiotic-chart-container[data-semiotic-mobile="true"] .semiotic-chart-header {\n padding: 10px 12px !important;\n gap: 10px !important;\n }\n .semiotic-chart-container[data-semiotic-mobile="true"] .semiotic-chart-title-area {\n flex-basis: 100% !important;\n }\n .semiotic-chart-container[data-semiotic-mobile="true"] .semiotic-chart-toolbar {\n width: 100% !important;\n margin-left: 0 !important;\n justify-content: flex-start !important;\n overflow-x: auto !important;\n -webkit-overflow-scrolling: touch;\n }\n .semiotic-chart-container[data-semiotic-mobile="true"][data-semiotic-mobile-hide-toolbar="true"] .semiotic-chart-toolbar {\n display: none !important;\n }\n .semiotic-chart-container[data-semiotic-mobile="true"] .semiotic-chart-action {\n min-width: 32px !important;\n min-height: 32px !important;\n }\n .semiotic-chart-container[data-semiotic-mobile="true"] .semiotic-chart-mobile-summary {\n display: block !important;\n }\n .semiotic-chart-container[data-semiotic-mobile="true"] .semiotic-chart-mobile-standard-controls {\n display: block !important;\n }\n .semiotic-chart-container[data-semiotic-mobile="true"][data-semiotic-mobile-scroll="true"] .semiotic-chart-body {\n overflow-x: auto !important;\n justify-content: flex-start !important;\n -webkit-overflow-scrolling: touch;\n }\n}`}}),(0,Hx.jsxs)("div",{ref:S,className:"semiotic-chart-container"+(x?" "+x:""),"data-semiotic-mobile":Y?"true":void 0,"data-semiotic-mobile-scroll":oe?"true":void 0,"data-semiotic-mobile-hide-toolbar":re?"true":void 0,style:{width:r,border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:"var(--semiotic-border-radius, 8px)",overflow:"hidden",background:"var(--semiotic-bg, #fff)",fontFamily:"var(--semiotic-font-family, sans-serif)",position:"relative",...C?{display:"flex",flexDirection:"column",width:"100%",height:"100%"}:{},...k},children:[ae&&(0,Hx.jsxs)("div",{className:"semiotic-chart-header",style:{padding:"12px 16px",display:"flex",justifyContent:"space-between",alignItems:"flex-start",flexWrap:"wrap",gap:8,borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},children:[(0,Hx.jsxs)("div",{className:"semiotic-chart-title-area",style:{minWidth:0,flex:"1 1 200px"},children:[e&&(0,Hx.jsx)("div",{className:"semiotic-chart-title",style:{fontSize:14,fontWeight:600,color:"var(--semiotic-text, #333)"},children:e}),t&&(0,Hx.jsx)("div",{className:"semiotic-chart-subtitle",style:{fontSize:12,color:"var(--semiotic-text-secondary, #666)",marginTop:e?2:0},children:t})]}),(0,Hx.jsxs)("div",{className:"semiotic-chart-toolbar",style:{display:"flex",alignItems:"center",gap:4,marginLeft:"auto"},children:[c,se&&(0,Hx.jsx)(Qx,{visible:_,onDismiss:L}),R&&(0,Hx.jsx)("button",{className:"semiotic-chart-action",onClick:()=>H(),title:"Export chart","aria-label":"Export chart",style:ok,children:(0,Hx.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,Hx.jsx)("path",{d:"M7 2v8M3.5 7L7 10.5 10.5 7"}),(0,Hx.jsx)("path",{d:"M2 12h10"})]})}),$&&(0,Hx.jsx)(Gx,{}),T&&(0,Hx.jsx)("button",{className:"semiotic-chart-action",onClick:O,title:C?"Exit fullscreen":"Fullscreen","aria-label":C?"Exit fullscreen":"Enter fullscreen",style:ok,children:(0,Hx.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,Hx.jsxs)(Hx.Fragment,C?{children:[(0,Hx.jsx)("path",{d:"M9 1v4h4"}),(0,Hx.jsx)("path",{d:"M5 13V9H1"}),(0,Hx.jsx)("path",{d:"M13 5H9V1"}),(0,Hx.jsx)("path",{d:"M1 9h4v4"})]}:{children:[(0,Hx.jsx)("path",{d:"M1 5V1h4"}),(0,Hx.jsx)("path",{d:"M13 9v4H9"}),(0,Hx.jsx)("path",{d:"M9 1h4v4"}),(0,Hx.jsx)("path",{d:"M5 13H1V9"})]})})}),I&&(0,Hx.jsx)("button",{className:"semiotic-chart-action",onClick:()=>W(),title:"Copy config","aria-label":"Copy chart configuration",style:ok,children:(0,Hx.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,Hx.jsx)("rect",{x:"5",y:"5",width:"8",height:"8",rx:"1"}),(0,Hx.jsx)("path",{d:"M9 5V2a1 1 0 00-1-1H2a1 1 0 00-1 1v6a1 1 0 001 1h3"})]})}),m&&(0,Hx.jsx)("div",{className:"semiotic-chart-status","aria-live":"polite","aria-atomic":"true",style:{padding:"2px 8px",borderRadius:4,fontSize:10,fontWeight:700,letterSpacing:"0.05em",textTransform:"uppercase",background:Zx[m].bg,color:Zx[m].color,lineHeight:"18px"},children:m})]})]}),u&&(0,Hx.jsx)("div",{className:"semiotic-chart-banner",children:u}),ie,te&&(0,Hx.jsx)("div",{className:"semiotic-chart-mobile-summary",style:{display:"none",padding:"8px 12px",fontSize:12,lineHeight:1.45,color:"var(--semiotic-text-secondary, #666)",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},children:te}),ee&&(0,Hx.jsx)("div",{className:"semiotic-chart-mobile-standard-controls",style:{display:"none",padding:"10px 12px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)",background:"var(--semiotic-surface, var(--semiotic-bg, #f6f8fa))"},children:ee}),N&&(0,Hx.jsx)("div",{className:"semiotic-chart-description",role:"note",style:F?{padding:"8px 16px",fontSize:12,lineHeight:1.5,color:"var(--semiotic-text-secondary, #666)",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"}:Ox,children:N}),B&&(0,Hx.jsx)("div",{className:"semiotic-chart-nav",style:D?{padding:"8px 8px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)",maxHeight:240,overflow:"auto"}:void 0,children:(0,Hx.jsx)(gx,{tree:B,label:"string"==typeof e&&e?e+" — navigable structure":"Chart navigable structure",visible:D,chartId:"string"==typeof s?.props?.chartId?s.props.chartId:void 0})}),(0,Hx.jsxs)("div",{className:"semiotic-chart-body",ref:A,style:{position:"relative",overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center",...C?{flex:1}:{height:n}},children:[ce,y]})]})]}),$?(0,Hx.jsx)(qi,{children:ue}):ue;var ue}),ok={width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",cursor:"pointer",borderRadius:4,color:"var(--semiotic-text-secondary, #666)",padding:0},rk=c(require("react")),nk=require("react/jsx-runtime");function ik({children:e,controls:t,mobile:o,breakpoint:r=480,chartMode:n="mobile",mobileInteraction:i=!0,mobileSemantics:s,mobileSummary:a,chips:l=[],activeChip:c,onChipChange:u,detail:d,detailTitle:h="Details",detailMode:p="sheet",initialDetailOpen:f=!1,allowHorizontalScroll:g=!1,hideToolbar:m=!1,chartDefaults:y,...b}){const[v,x]=rk.useState(()=>c??l.find(e=>!e.disabled)?.id),[k,w]=rk.useState(f);rk.useEffect(()=>{void 0===c&&(l.length?l.some(e=>e.id===v&&!e.disabled)||x(l.find(e=>!e.disabled)?.id):x(void 0))},[c,l,v]);const S=c??v,A=rk.useCallback(e=>{e.disabled||(void 0===c&&x(e.id),u?.(e))},[c,u]),C=l.length?(0,nk.jsx)("div",{className:"semiotic-mobile-chip-row",role:"list","aria-label":"Mobile chart controls",children:l.map(e=>(0,nk.jsxs)("button",{type:"button",className:"semiotic-mobile-chip","aria-pressed":e.id===S,disabled:e.disabled,onClick:()=>A(e),title:"string"==typeof e.description?e.description:void 0,children:[(0,nk.jsx)("span",{children:e.label}),e.description&&(0,nk.jsx)("small",{className:"semiotic-mobile-chip-description",children:e.description})]},e.id))}):null,M=a||C?(0,nk.jsxs)("div",{className:"semiotic-mobile-summary-card",children:[a&&(0,nk.jsx)("div",{className:"semiotic-mobile-summary-copy",children:a}),C]}):o?.summary,j={breakpoint:r,chartMode:n,mobileInteraction:i,semantics:s,allowHorizontalScroll:g,hideToolbar:m,...o,summary:M},P=rk.useMemo(()=>{if(!y||!rk.isValidElement(e))return e;const t=e.props,o={};for(const[e,r]of Object.entries(y))null==t[e]&&(o[e]=r);return Object.keys(o).length>0?rk.cloneElement(e,o):e},[e,y]),_=!!d&&"sheet"===p,L=!!d&&"inline"===p||_&&k,R=_?(0,nk.jsx)("button",{type:"button",className:"semiotic-mobile-detail-toggle","aria-expanded":k,onClick:()=>w(e=>!e),children:k?"Hide details":"Show details"}):null,T=t||R?(0,nk.jsxs)("div",{className:"semiotic-mobile-control-stack",children:[t,R]}):void 0;return(0,nk.jsxs)("div",{className:"semiotic-mobile-chart-shell",children:[(0,nk.jsx)("style",{children:`\n .semiotic-mobile-chart-shell {\n display: grid;\n gap: 10px;\n width: 100%;\n }\n .semiotic-mobile-summary-card {\n display: grid;\n gap: 10px;\n }\n .semiotic-mobile-summary-copy {\n font-size: 13px;\n line-height: 1.45;\n }\n .semiotic-mobile-chip-row {\n display: flex;\n gap: 8px;\n overflow-x: auto;\n padding-bottom: 2px;\n -webkit-overflow-scrolling: touch;\n }\n .semiotic-mobile-chip {\n display: inline-flex;\n flex: 0 0 auto;\n flex-direction: column;\n align-items: flex-start;\n justify-content: center;\n min-height: 40px;\n min-width: 44px;\n border: 1px solid var(--semiotic-border, #d8d8d8);\n border-radius: 999px;\n padding: 7px 12px;\n background: var(--semiotic-bg, #fff);\n color: var(--semiotic-text, #222);\n font: inherit;\n font-size: 12px;\n font-weight: 700;\n cursor: pointer;\n }\n .semiotic-mobile-chip[aria-pressed="true"] {\n border-color: var(--semiotic-accent, #1f7a6d);\n background: color-mix(in srgb, var(--semiotic-accent, #1f7a6d) 14%, transparent);\n }\n .semiotic-mobile-chip:disabled {\n cursor: not-allowed;\n opacity: 0.45;\n }\n .semiotic-mobile-chip-description {\n display: block;\n max-width: 160px;\n margin-top: 2px;\n color: var(--semiotic-text-secondary, #666);\n font-size: 10px;\n font-weight: 500;\n line-height: 1.2;\n }\n .semiotic-mobile-control-stack {\n display: inline-flex;\n align-items: center;\n gap: 8px;\n flex-wrap: wrap;\n }\n .semiotic-mobile-detail-toggle {\n min-height: 32px;\n border: 1px solid var(--semiotic-border, #d8d8d8);\n border-radius: 999px;\n padding: 5px 10px;\n background: transparent;\n color: var(--semiotic-text, #222);\n font: inherit;\n font-size: 12px;\n font-weight: 700;\n cursor: pointer;\n }\n .semiotic-mobile-detail-panel {\n border: 1px solid var(--semiotic-border, #d8d8d8);\n border-radius: 16px;\n background: var(--semiotic-bg, #fff);\n color: var(--semiotic-text, #222);\n box-shadow: 0 18px 48px rgba(0, 0, 0, 0.16);\n overflow: hidden;\n }\n .semiotic-mobile-detail-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 12px;\n padding: 10px 12px;\n border-bottom: 1px solid var(--semiotic-border, #d8d8d8);\n font-size: 13px;\n font-weight: 800;\n }\n .semiotic-mobile-detail-body {\n padding: 12px;\n font-size: 13px;\n line-height: 1.5;\n }\n @media (max-width: ${r}px) {\n .semiotic-mobile-detail-panel[data-mode="sheet"] {\n position: sticky;\n bottom: 8px;\n z-index: 2;\n max-height: min(55vh, 420px);\n overflow: auto;\n }\n }\n `}),(0,nk.jsx)(tk,{...b,controls:T,mobile:j,children:P}),L&&(0,nk.jsxs)("section",{className:"semiotic-mobile-detail-panel","data-mode":p,"aria-label":"string"==typeof h?h:"Chart details",children:[(0,nk.jsxs)("div",{className:"semiotic-mobile-detail-header",children:[(0,nk.jsx)("span",{children:h}),_&&(0,nk.jsx)("button",{type:"button",className:"semiotic-mobile-detail-toggle",onClick:()=>w(!1),children:"Close"})]}),(0,nk.jsx)("div",{className:"semiotic-mobile-detail-body",children:d})]})]})}var sk=c(require("react")),ak=require("react/jsx-runtime");function lk(e,t){if(t)return"function"==typeof t?t(e):e?.[t]}function ck(e,t){const o="function"==typeof t?t(e):e[t];return Array.isArray(o)?o:[]}function uk(e){return{strategy:"small-multiples",responsive:!0,supportsResponsiveLayout:!0,summary:`${e} vertically stacked small multiple panel${1===e?"":"s"} with shared scale guidance.`,interaction:{primary:"tap",alternatives:["panel summary","linked selection"],hoverFallback:"tap-to-lock",targetSize:44},labels:{strategy:"external",minFontSize:12}}}function dk(e,t){if(!sk.isValidElement(e))return e;const o=e.props,r={};for(const[e,n]of Object.entries(t))void 0!==n&&null==o[e]&&(r[e]=n);return Object.keys(r).length>0?sk.cloneElement(e,r):e}function hk({items:e,children:t,columns:o=3,tabletColumns:r=2,mobileColumns:n=1,mobileBreakpoint:i=480,tabletBreakpoint:s=860,gap:a=12,mode:l="mobile",chartHeight:c=220,sharedExtent:u=!0,valueAccessor:d,dataAccessor:h="data",extentProps:p=["yExtent","valueExtent"],linkedHover:f,selection:g,linkedBy:m,linkProvider:y="auto",selections:b,showLegend:v=!1,legendPosition:x,legendInteraction:k,legendSelectionName:w,legendField:S,mobileInteraction:A=!0,mobileSemantics:C,labelMode:M="panel",chartDefaults:j,className:P,style:_}){const L=Ah(),R=e||"function"==typeof t?[]:sk.Children.toArray(t),T=e??R.map((e,t)=>({id:"panel-"+(t+1)})),I=T.length,$=sk.useMemo(()=>function(e,t,o,r){if(t&&"object"==typeof t)return t;if(!1===t)return{};const n=[],i=[];for(const t of e)if(t.extent&&n.push(t.extent[0],t.extent[1]),r)for(const e of ck(t,o))i.push(lk(e,r));const s=function(e){let t=1/0,o=-1/0;for(const r of e){const e=Number(r);Number.isFinite(e)&&(t>e&&(t=e),e>o&&(o=e))}if(Number.isFinite(t)&&Number.isFinite(o))return t===o?[t-1,o+1]:[t,o]}(i.length?i:n);return s?{yExtent:s,valueExtent:s}:{}}(T,u,h,d),[T,u,h,d]),N=sk.useMemo(()=>{if(!m)return{name:void 0,fields:void 0,linkedHover:f,selection:g};const e=Array.isArray(m)?"small-multiples":m.name||"small-multiples",t=Array.isArray(m)?m:m.fields||[];return{name:e,fields:t,linkedHover:f??{name:e,fields:t},selection:g??{name:e}}},[m,f,g]),F=sk.useMemo(()=>({linkedHover:N.linkedHover,selection:N.selection}),[N.linkedHover,N.selection]),B=sk.useMemo(()=>{const e={mode:l,height:c,responsiveWidth:!0,mobileInteraction:A,mobileSemantics:C??uk(I),...F,...j};"legend"!==M&&(e.showLegend=!1),"direct"===M&&(e.directLabel=!0);for(const t of p)t in $&&(e[t]=$[t]);return e},[l,c,A,C,I,F,j,M,p,$]),D=(0,ak.jsxs)("section",{className:["semiotic-small-multiple-chart",P].filter(Boolean).join(" "),style:_,"data-semiotic-small-multiple":"true",children:[(0,ak.jsx)("style",{children:`\n .semiotic-small-multiple-chart {\n --semiotic-small-multiple-columns: ${o};\n --semiotic-small-multiple-gap: ${a}px;\n display: grid;\n grid-template-columns: repeat(var(--semiotic-small-multiple-columns), minmax(0, 1fr));\n gap: var(--semiotic-small-multiple-gap);\n width: 100%;\n }\n .semiotic-small-multiple-panel {\n min-width: 0;\n border: 1px solid var(--semiotic-border, #d8d8d8);\n border-radius: 16px;\n background: var(--semiotic-bg, #fff);\n overflow: hidden;\n }\n .semiotic-small-multiple-heading {\n display: grid;\n gap: 3px;\n padding: 10px 12px 0;\n }\n .semiotic-small-multiple-title {\n margin: 0;\n color: var(--semiotic-text, #222);\n font-size: 13px;\n font-weight: 800;\n line-height: 1.25;\n }\n .semiotic-small-multiple-subtitle,\n .semiotic-small-multiple-summary {\n margin: 0;\n color: var(--semiotic-text-secondary, #666);\n font-size: 11px;\n line-height: 1.35;\n }\n .semiotic-small-multiple-plot {\n min-width: 0;\n padding: 4px 6px 8px;\n overflow: hidden;\n }\n @media (max-width: ${s}px) {\n .semiotic-small-multiple-chart {\n --semiotic-small-multiple-columns: ${r};\n }\n }\n @media (max-width: ${i}px) {\n .semiotic-small-multiple-chart {\n --semiotic-small-multiple-columns: ${n};\n }\n .semiotic-small-multiple-panel {\n border-radius: 14px;\n }\n .semiotic-small-multiple-heading {\n padding: 9px 10px 0;\n }\n }\n `}),T.map((e,o)=>{const r={...B},n="function"==typeof t?t(e,{item:e,index:o,count:I,chartProps:r,sharedExtent:$}):R[o];return(0,ak.jsxs)("article",{className:"semiotic-small-multiple-panel","aria-label":"string"==typeof e.title?e.title:void 0,children:[(e.title||e.subtitle||e.summary)&&(0,ak.jsxs)("header",{className:"semiotic-small-multiple-heading",children:[e.title&&(0,ak.jsx)("h3",{className:"semiotic-small-multiple-title",children:e.title}),e.subtitle&&(0,ak.jsx)("p",{className:"semiotic-small-multiple-subtitle",children:e.subtitle}),e.summary&&(0,ak.jsx)("p",{className:"semiotic-small-multiple-summary",children:e.summary})]}),(0,ak.jsx)("div",{className:"semiotic-small-multiple-plot",children:dk(n,r)})]},e.id??o)})]});return!0===y||"auto"===y&&(m||f||g||b||!0===v)&&!L?(0,ak.jsx)(Ih,{selections:b,showLegend:v,legendPosition:x,legendInteraction:k,legendSelectionName:w??N.name??"small-multiples",legendField:S??N.fields?.[0]??"category",children:D}):D}var pk=c(require("react")),fk=require("react/jsx-runtime");function gk({children:e,columns:t="auto",minCellWidth:o=300,gap:r=16,tabletColumns:n,mobileColumns:i=1,mobileBreakpoint:s=480,tabletBreakpoint:a=860,chartDefaults:l,className:c,style:u}){const d="semiotic-chart-grid-"+pk.useId().replace(/[^a-zA-Z0-9_-]/g,""),h="number"==typeof t?t:void 0,p="auto"===t?`repeat(auto-fill, minmax(${o}px, 1fr))`:`repeat(${t}, 1fr)`,f=["semiotic-chart-grid",d,c].filter(Boolean).join(" ");return(0,fk.jsxs)(fk.Fragment,{children:[(0,fk.jsx)("style",{children:`\n ${n?`\n @media (max-width: ${a}px) {\n .${d} {\n grid-template-columns: repeat(${n}, minmax(0, 1fr)) !important;\n }\n }`:""}\n @media (max-width: ${s}px) {\n .${d} {\n grid-template-columns: repeat(${i}, minmax(0, 1fr)) !important;\n }\n .${d} > [data-semiotic-chart-grid-primary="true"] {\n grid-column: span ${i} !important;\n }\n }\n `}),(0,fk.jsx)("div",{className:f,style:{display:"grid",gridTemplateColumns:p,gap:r,width:"100%",...u},children:pk.Children.map(e,e=>{if(!pk.isValidElement(e))return e;const t=e.props,o={};if(l)for(const[e,r]of Object.entries(l))null==t[e]&&(o[e]=r);const r=Object.keys(o).length>0?pk.cloneElement(e,o):e;return"primary"!==e.props.emphasis||void 0!==h&&2>h?r:(0,fk.jsx)("div",{"data-semiotic-chart-grid-primary":"true",style:{gridColumn:"span 2",minWidth:0},children:r})})})]})}gk.displayName="ChartGrid";var mk=c(require("react")),yk=require("react/jsx-runtime");function bk({children:e,context:t,position:o="right",contextSize:r=250,mobilePosition:n="bottom",mobileBreakpoint:i=480,gap:s=12,className:a,style:l}){const c="semiotic-context-layout-"+mk.useId().replace(/[^a-zA-Z0-9_-]/g,""),u="left"===o||"right"===o,d="left"===o||"top"===o,h={display:"flex",flexDirection:u?d?"row-reverse":"row":d?"column-reverse":"column",gap:s,width:"100%",...l},p=u?{flex:`0 0 ${r}px`,width:r,minHeight:0}:{flex:`0 0 ${r}px`,height:r,minWidth:0};return(0,yk.jsxs)(yk.Fragment,{children:[(0,yk.jsx)("style",{children:`\n @media (max-width: ${i}px) {\n .${c}[data-mobile-position="bottom"] {\n flex-direction: column !important;\n }\n .${c}[data-mobile-position="top"] {\n flex-direction: column-reverse !important;\n }\n .${c}[data-mobile-position="bottom"] > .semiotic-context-panel,\n .${c}[data-mobile-position="top"] > .semiotic-context-panel {\n flex: 0 0 auto !important;\n width: 100% !important;\n height: auto !important;\n }\n }\n `}),(0,yk.jsxs)("div",{className:["semiotic-context-layout",c,a].filter(Boolean).join(" "),"data-mobile-position":n,style:h,children:[(0,yk.jsx)("div",{className:"semiotic-context-primary",style:{flex:"1 1 0%",minWidth:0,minHeight:0},children:e}),(0,yk.jsx)("div",{className:"semiotic-context-panel",style:p,children:t})]})]})}bk.displayName="ContextLayout";var vk=require("react"),xk=2*Math.PI;function kk(e,t,o){const r=o?.center?.x??0,n=o?.center?.y??0;return{x:r+Math.sin(e)*t,y:n-Math.cos(e)*t}}function wk(e,t,o,r,n){const i=n?.center,s=(e,t)=>{const{x:o,y:r}=kk(e,t,{center:i});return`${Sk(o)},${Sk(r)}`},a=Math.max(0,o),l=Math.max(a,r),c=Math.abs(t-e),u=e>t?0:1;if(c>=xk-1e-6){const e=i?.x??0,t=i?.y??0,o=`${Sk(e)},${Sk(t-l)}`,r=`${Sk(e)},${Sk(t+l)}`;let n=`M${o} A${Sk(l)},${Sk(l)} 0 1 1 ${r} A${Sk(l)},${Sk(l)} 0 1 1 ${o} Z`;if(a>0){const o=`${Sk(e)},${Sk(t-a)}`,r=`${Sk(e)},${Sk(t+a)}`;n+=` M${o} A${Sk(a)},${Sk(a)} 0 1 0 ${r} A${Sk(a)},${Sk(a)} 0 1 0 ${o} Z`}return n}const d=c>Math.PI?1:0,h=s(e,l),p=s(t,l);if(0>=a){const e=i?.x??0,t=i?.y??0;return`M${Sk(e)},${Sk(t)} L${h} A${Sk(l)},${Sk(l)} 0 ${d} ${u} ${p} Z`}const f=s(t,a),g=s(e,a);return`M${h} A${Sk(l)},${Sk(l)} 0 ${d} ${u} ${p} L${f} A${Sk(a)},${Sk(a)} 0 ${d} ${1===u?0:1} ${g} Z`}function Sk(e){return Math.round(1e3*e)/1e3}function Ak(e,t,o=0){return t>0?((e-o)%t+t)%t+o:e}var Ck=require("react/jsx-runtime");function Mk({value:e,onChange:t,period:o=365,radius:r=180,innerRadius:n=14,width:i,height:s,step:a=1,largeStep:l=7,label:c="Range",formatValue:u,arcFill:d="var(--semiotic-primary, #4e79a7)",stroke:h="var(--semiotic-bg, #ffffff)",className:p,style:f}){const g=i??2*r+40,m=s??2*r+40,y=g/2,b=m/2,v=function(e){const[t,o]=e,r=o-t||1,n=xk;return e=>0+(e-t)/r*(n-0)}([0,o]),x=(0,vk.useRef)(null),k=e=>{const t=e.currentTarget.ownerSVGElement??e.currentTarget,r=t.getBoundingClientRect(),n=t.viewBox?.baseVal;return Math.round((Math.atan2((n?.width||g)/(r.width||1)*(e.clientX-r.left)-y-0,-((n?.height||m)/(r.height||1)*(e.clientY-r.top)-b-0))+xk)%xk/xk*o)%o},w=(e,t)=>{e.preventDefault(),e.stopPropagation();const o=e.currentTarget.ownerSVGElement;o?.setPointerCapture?.(e.pointerId),x.current={mode:t,lastValue:k(e)}},S=e=>{const t=e.currentTarget.ownerSVGElement??e.currentTarget;t?.hasPointerCapture?.(e.pointerId)&&t.releasePointerCapture(e.pointerId),x.current=null},A=(e,r)=>{t("range"===e?e=>({start:Ak(e.start+r,o),end:Ak(e.end+r,o)}):t=>({...t,[e]:Ak(t[e]+r,o)}))},C=e=>t=>{const o=t.shiftKey?l:a;"ArrowRight"===t.key||"ArrowUp"===t.key?(t.preventDefault(),A(e,o)):"ArrowLeft"!==t.key&&"ArrowDown"!==t.key||(t.preventDefault(),A(e,-o))},M=e.start>e.end?[[e.start,o],[0,e.end]]:[[e.start,e.end]],j=e=>u?u(e):e+"";return(0,Ck.jsx)("svg",{viewBox:`0 0 ${g} ${m}`,width:g,height:m,className:p,onPointerMove:e=>{const r=x.current;if(!r)return;const n=k(e);if("range"===r.mode){const e=function(e,t,o){if(0>=o)return t-e;let r=(t-e)%o;return r>o/2?r-=o:-o/2>r&&(r+=o),r}(r.lastValue,n,o);if(0===e)return;return r.lastValue=n,void t(t=>({start:Ak(t.start+e,o),end:Ak(t.end+e,o)}))}t(e=>({...e,[r.mode]:n}))},onPointerUp:S,onPointerCancel:S,onLostPointerCapture:S,style:{touchAction:"none",...f},"aria-label":c+" brush",children:(0,Ck.jsxs)("g",{transform:`translate(${y},${b})`,children:[(0,Ck.jsx)("g",{role:"slider",tabIndex:0,"aria-label":c+" (move both ends)","aria-valuemin":0,"aria-valuemax":o-1,"aria-valuenow":e.start,"aria-valuetext":`${j(e.start)} to ${j(e.end)}`,onPointerDown:e=>w(e,"range"),onKeyDown:C("range"),style:{cursor:"grab"},children:M.map(([e,t],o)=>(0,Ck.jsx)("path",{d:wk(v(e),v(t),n,r),fill:d,fillOpacity:.35,stroke:h,strokeWidth:1},o))}),["start","end"].map(t=>{const i=e[t],s=(e=>kk(v(e),n))(i),a=(e=>kk(v(e),r+8))(i);return(0,Ck.jsxs)("g",{role:"slider",tabIndex:0,"aria-label":`${c} ${t}`,"aria-valuemin":0,"aria-valuemax":o-1,"aria-valuenow":i,"aria-valuetext":j(i),onPointerDown:e=>w(e,t),onKeyDown:C(t),style:{cursor:"grab"},children:[(0,Ck.jsx)("line",{x1:s.x,y1:s.y,x2:a.x,y2:a.y,stroke:"transparent",strokeWidth:20}),(0,Ck.jsx)("line",{x1:s.x,y1:s.y,x2:a.x,y2:a.y,stroke:h,strokeWidth:1.5}),(0,Ck.jsx)("circle",{cx:a.x,cy:a.y,r:4.5,fill:h,stroke:d,strokeWidth:1})]},t)})]})})}var jk=c(require("react")),Pk=require("react"),_k=require("react/jsx-runtime");function Lk(e,t,o,r){return Math.min(o,Math.max(t,Number((t+Math.round((Math.min(o,Math.max(t,e))-t)/r)*r).toFixed(12))))}function Rk({value:e,onChange:t,pointerToValue:o,min:r,max:n,step:i=1,largeStep:s=5*i,x:a,y:l,controlType:c="value",controlId:u,label:d,valueText:h,radius:p=12,fill:f="var(--semiotic-bg, #ffffff)",stroke:g="var(--semiotic-primary, #4e79a7)",strokeWidth:m=4,labelText:y,labelDx:b=16,labelDy:v=-16,labelClassName:x,className:k,disabled:w=!1,onChangeStart:S,onChangeEnd:A,onObservation:C,chartId:M,chartType:j}){const P=(0,Pk.useRef)(null),_=(0,Pk.useRef)(e);_.current=e;const L=jk.useMemo(()=>Bb({controlType:c,controlId:u,chartId:M,chartType:j,onObservation:C}),[M,j,u,c,C]),R=e=>{if(w)return;const s=o(e);if(null==s||!Number.isFinite(s))return;const a=Lk(s,r,n,i);_.current=a,t(a),L("control-change",a,"pointer")},T=e=>{e.stopPropagation(),P.current===e.pointerId&&(e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture?.(e.pointerId),P.current=null,A?.(_.current),L("control-end",_.current,"pointer"))},I=["semiotic-direct-manipulation-control",k].filter(Boolean).join(" ");return(0,_k.jsxs)("g",{className:I,role:"slider",tabIndex:w?-1:0,"aria-disabled":w||void 0,"aria-label":d,"aria-valuemin":r,"aria-valuemax":n,"aria-valuenow":e,"aria-valuetext":h??`${d}: ${e}`,"aria-roledescription":"visualization control","data-viz-control":c,"data-viz-control-id":u,"data-viz-control-state":"controlled",pointerEvents:"all",onPointerDown:e=>{w||(e.preventDefault(),e.stopPropagation(),e.currentTarget.setPointerCapture?.(e.pointerId),P.current=e.pointerId,S?.(_.current),L("control-start",_.current,"pointer"),R(e))},onPointerMove:e=>{e.stopPropagation(),P.current===e.pointerId&&R(e)},onPointerUp:T,onPointerCancel:T,onLostPointerCapture:T,onKeyDown:e=>{if(w)return;const o=e.shiftKey?s:i,a=_.current;let l=null;if("ArrowLeft"!==e.key&&"ArrowDown"!==e.key||(l=a-o),"ArrowRight"!==e.key&&"ArrowUp"!==e.key||(l=a+o),"Home"===e.key&&(l=r),"End"===e.key&&(l=n),null===l)return;e.preventDefault();const c=Lk(l,r,n,i);_.current=c,t(c),L("control-change",c,"keyboard")},style:{cursor:w?"default":"grab",touchAction:"none"},children:[(0,_k.jsx)("circle",{className:"semiotic-direct-manipulation-control__hit",cx:a,cy:l,r:p+10,fill:"transparent"}),(0,_k.jsx)("circle",{className:"semiotic-direct-manipulation-control__handle",cx:a,cy:l,r:p,fill:f,stroke:g,strokeWidth:m}),y?(0,_k.jsx)("text",{className:x,x:a+b,y:l+v,fill:g,children:y}):null]})}var Tk=require("react"),Ik=require("react/jsx-runtime"),$k=200;function Nk({children:e,position:t="right",size:o=300,trigger:r="click",chartId:n,observation:i,dismissOnEmpty:s=!0,showClose:a=!0,onToggle:l,className:c,style:u}){const[d,h]=(0,Tk.useState)(null),[p,f]=(0,Tk.useState)(null),[g,m]=(0,Tk.useState)(!1),[y,b]=(0,Tk.useState)(!1),v=(0,Tk.useRef)(null),x=(0,Tk.useRef)(void 0),k="click"===r?["click","click-end"]:["hover","hover-end"],{latest:w}=xh({types:k,chartId:n,limit:1}),S=void 0!==i?i:w,A=(0,Tk.useCallback)(()=>{b(!0),m(!1),clearTimeout(x.current),x.current=setTimeout(()=>{b(!1),h(null),f(null)},$k)},[]);if((0,Tk.useEffect)(()=>{if(S)if("click"===S.type||"hover"===S.type){const e=S;h(e.datum),f(e),m(e=>(e||(b(!0),clearTimeout(x.current),x.current=setTimeout(()=>b(!1),$k)),!0))}else!s||"click-end"!==S.type&&"hover-end"!==S.type||A()},[s,A,S]),(0,Tk.useEffect)(()=>{l?.(g)},[g,l]),(0,Tk.useEffect)(()=>()=>clearTimeout(x.current),[]),!d&&!y)return null;const C=d&&p?e(d,p):null;if(null===C&&!y)return null;const M=function(e,t,o,r){const n={position:"absolute",background:"var(--semiotic-bg, #fff)",borderColor:"var(--semiotic-border, #e0e0e0)",borderStyle:"solid",borderWidth:0,boxSizing:"border-box",zIndex:10,display:"flex",flexDirection:"column",transition:r?`transform ${$k}ms ease-out, opacity ${$k}ms ease-out`:void 0};return"right"===e?{...n,top:0,right:0,width:t,height:"100%",borderLeftWidth:1,padding:"12px 16px",transform:o?"translateX(0)":`translateX(${t}px)`,opacity:o?1:0}:"bottom"===e?{...n,bottom:0,left:0,width:"100%",height:t,borderTopWidth:1,padding:"12px 16px",transform:o?"translateY(0)":`translateY(${t}px)`,opacity:o?1:0}:{...n,top:"50%",left:"50%",transform:o?"translate(-50%, -50%) scale(1)":"translate(-50%, -50%) scale(0.95)",opacity:o?1:0,width:Math.min(t,400),maxHeight:"80%",borderWidth:1,borderRadius:8,padding:"16px 20px",boxShadow:"0 8px 32px rgba(0,0,0,0.12)"}}(t,o,g,y);return(0,Ik.jsxs)("div",{ref:v,className:`semiotic-details-panel semiotic-details-${t}${c?" "+c:""}`,style:{...M,...u},children:[a&&(0,Ik.jsx)("button",{className:"semiotic-details-close",onClick:A,"aria-label":"Close details",style:Fk,children:(0,Ik.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",children:(0,Ik.jsx)("path",{d:"M2 2l8 8M10 2l-8 8"})})}),(0,Ik.jsx)("div",{className:"semiotic-details-content",style:{overflow:"auto",flex:1},children:C})]})}var Fk={position:"absolute",top:8,right:8,width:20,height:20,display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",cursor:"pointer",borderRadius:4,color:"var(--semiotic-text-secondary, #666)",padding:0,zIndex:1};Nk.displayName="DetailsPanel";var Bk=require("react"),Dk=require("d3-force"),Ek=1e3;function zk(e,t,o={}){const r=o.iterations??260,n=o.repulsion??5200,i=o.linkDistance??165,s=o.linkStrength??.045,a=o.centerStrength??.018,l=o.damping??.84,c=o.nodeRadius??12,u=o.nodePadding??3,d=o.inset??.06,h=function(e){let t=e>>>0;return function(){t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}(o.seed??1),p=new Map;for(const t of e)p.set(t.id,0);for(const e of t)p.set(e.source,(p.get(e.source)??0)+1),p.set(e.target,(p.get(e.target)??0)+1);const f=Ek/2,g=e.map(e=>({id:e.id,data:e,x:200+600*h(),y:200+600*h()})),m=new Set(e.map(e=>e.id)),y=t.filter(e=>m.has(e.source)&&m.has(e.target)).map(e=>({source:e.source,target:e.target}));if(r>0){const e=(0,Dk.forceSimulation)(g).randomSource(h).alphaDecay(1-Math.pow(.001,1/r)).velocityDecay(Math.max(0,Math.min(1,1-l))).force("charge",(0,Dk.forceManyBody)().strength(e=>{const t=p.get(e.id)??0;return 2.5*-Math.sqrt(n)*Math.sqrt(t+1)})).force("collide",(0,Dk.forceCollide)(e=>(e=>"function"==typeof c?c(e.data):c)(e)+u).strength(.9).iterations(2)).force("center",(0,Dk.forceCenter)(f,f).strength(.8)).force("x",(0,Dk.forceX)(f).strength(a)).force("y",(0,Dk.forceY)(f).strength(a));y.length>0&&e.force("link",(0,Dk.forceLink)(y).id(e=>e.id).distance(i).strength(e=>{const t="string"==typeof e.target?e.target:e.target.id,o=Math.max(1,Math.min(p.get("string"==typeof e.source?e.source:e.source.id)??1,p.get(t)??1));return s/.045/o})),e.stop();for(let t=0;r>t;t+=1)e.tick()}let b=1/0,v=1/0,x=-1/0,k=-1/0;for(const e of g){const t=e.x??f,o=e.y??f;b>t&&(b=t),v>o&&(v=o),t>x&&(x=t),o>k&&(k=o)}const w=x-b,S=k-v,A={};for(const e of g)A[e.id]={x:0===w?.5:d+((e.x??f)-b)/w*(1-2*d),y:0===S?.5:d+((e.y??f)-v)/S*(1-2*d)};return A}var Hk=16,Ok=new WeakMap;function Wk(e){const t=[];for(const o of Object.keys(e).sort()){const r=e[o];if(void 0!==r){if("function"==typeof r)return null;t.push(`${o}:${r+""}`)}}return t.join("|")}function qk(e,t,o){return null==o?null:Ok.get(e)?.get(t)?.get(o)??null}function Yk(e,t,o,r){if(null==o)return;let n=Ok.get(e);n||(n=new WeakMap,Ok.set(e,n));let i=n.get(t);if(i||(i=new Map,n.set(t,i)),!i.has(o)&&i.size>=Hk){const e=i.keys().next().value;void 0!==e&&i.delete(e)}i.set(o,r)}function Gk(e,t,o={}){const r=Li(),{seed:n,iterations:i,repulsion:s,linkDistance:a,linkStrength:l,centerStrength:c,damping:u,nodeRadius:d,nodePadding:h,inset:p,execution:f,workerThreshold:g}=o,m=(0,Bk.useMemo)(()=>({seed:n,iterations:i,repulsion:s,linkDistance:a,linkStrength:l,centerStrength:c,damping:u,nodeRadius:d,nodePadding:h,inset:p,execution:f,workerThreshold:g}),[n,i,s,a,l,c,u,d,h,p,f,g]),y=(0,Bk.useRef)(r),[b,v]=(0,Bk.useState)(()=>{if("undefined"==typeof window||r){const o=zk(e,t,m);return Yk(e,t,Wk(m),o),{positions:o,status:"ready",error:null}}const o=qk(e,t,Wk(m));return o?{positions:o,status:"ready",error:null}:{positions:null,status:"pending",error:null}});return(0,Bk.useEffect)(()=>{if(y.current)return void(y.current=!1);const o=Wk(m),r=qk(e,t,o);if(r)return void v(e=>"ready"===e.status&&e.positions===r?e:{positions:r,status:"ready",error:null});const n=new AbortController;return v(e=>({positions:e.positions,status:"pending",error:null})),async function(e,t,o={}){const{execution:r="auto",signal:n,workerThreshold:i,nodeRadius:s,...a}=o,l=a.iterations??260;if(!gd()||!fd(r,e.length,t.length,l,i))return zk(e,t,{...a,nodeRadius:s});const c={kind:"normalized",nodes:e.map(e=>({...e})),edges:t.map(e=>({...e})),options:a,nodeRadii:"function"==typeof s?Object.fromEntries(e.map(e=>[e.id,s(e)])):null==s?void 0:Object.fromEntries(e.map(e=>[e.id,s]))};try{return(await vd(c,n)).positions}catch(o){if("AbortError"===o?.name)throw o;return zk(e,t,{...a,nodeRadius:s})}}(e,t,{...m,signal:n.signal}).then(r=>{Yk(e,t,o,r),v({positions:r,status:"ready",error:null})}).catch(e=>{"AbortError"!==e.name&&v(t=>({positions:t.positions,status:"error",error:e}))}),()=>n.abort()},[e,t,m]),b}var Vk=c(require("react"));function Xk(e){const t=e.designContract?.chartFamily??e.title??"chart",o=e.audience?.primary?" for "+e.audience.primary:"",r=e.designContract?.whyThisForm;return`${t}: ${e.intent.primary}${o}${r?". "+r:""}`}function Uk(e,t){const o=e.intents.map(e=>"string"==typeof e?e:e.id??e.name).filter(e=>!!e),r=e.intents.find(e=>"string"!=typeof e&&"primary"===e.strength),n=("object"==typeof r?r.id??r.name:void 0)??o[0]??"explanation";return{ididVersion:"0.1",chartId:t.chartId,title:t.title??e.name,intent:{primary:n,secondary:o.filter(e=>e!==n)},audience:{primary:e.audience?.primary,familiarityAssumptions:Object.fromEntries(Object.entries(e.audience?.familiarity??{}).map(([e,t])=>[e,t+""])),literacyTargets:e.audience?.literacyTargets?.map(e=>({feature:e.concept,rationale:e.rationale}))},reception:e.reception?{channels:e.reception.channels,strengths:e.reception.strengths,risks:e.reception.risks,scaffolds:e.reception.scaffolds,memorableForm:e.reception.memorableForm}:void 0,designContract:{chartFamily:e.frameFamily,whyThisForm:e.designContract.whyThisForm??e.designContract.whyCustom,whyNotDefault:e.designContract.whyNotDefault,risks:e.reception?.risks,misuse:e.designContract.misuse},accessibility:{description:t.description,navigation:"required"===e.accessibility.keyboardNavigation||null!=e.navigation,dataFallback:!0===e.accessibility.fallbackTable||"required"===e.accessibility.accessibleTable||!0===e.accessibility.requiresAccessibleTable,manualChecks:["real screen-reader behavior","keyboard order quality","custom metaphor comprehension","animation distraction"]},provenance:t.dataSources||t.reviewStatus?{dataSources:t.dataSources,reviewStatus:t.reviewStatus,generatedBy:"Semiotic recipe intelligence"}:void 0}}var Kk=require("react/jsx-runtime");function Qk({manifest:e,label:t="Intent Mark",className:o,showSummary:r=!0}){const[n,i]=Vk.useState(!1),s=Vk.useMemo(()=>JSON.stringify(e,null,2),[e]),a=Vk.useCallback(async()=>{"undefined"!=typeof navigator&&navigator.clipboard&&(await navigator.clipboard.writeText(s),i(!0),window.setTimeout(()=>i(!1),1200))},[s]);return(0,Kk.jsxs)("details",{className:o?"semiotic-intent-mark "+o:"semiotic-intent-mark",style:{border:"1px solid var(--semiotic-border, #c8c8c8)",borderRadius:6,background:"var(--semiotic-surface, #fff)",color:"var(--semiotic-text, #222)",fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[(0,Kk.jsxs)("summary",{style:{cursor:"pointer",padding:"7px 10px",fontSize:12,fontWeight:700,letterSpacing:"0.04em",textTransform:"uppercase"},children:[t," · ",e.intent.primary]}),(0,Kk.jsxs)("div",{style:{padding:"0 10px 10px"},children:[r&&(0,Kk.jsx)("p",{style:{margin:"4px 0 10px",fontSize:13,lineHeight:1.45},children:Xk(e)}),(0,Kk.jsx)("button",{type:"button",onClick:a,style:{border:"1px solid currentColor",borderRadius:4,background:"transparent",color:"inherit",padding:"4px 8px",font:"inherit",fontSize:12,cursor:"pointer"},children:n?"Copied":"Copy manifest"}),(0,Kk.jsx)("pre",{style:{maxHeight:280,overflow:"auto",margin:"10px 0 0",padding:10,background:"var(--semiotic-background, #f5f5f5)",fontSize:11,lineHeight:1.45,whiteSpace:"pre-wrap"},children:s})]})]})}var Zk=require("react"),Jk="";function ew(e){if("datum"===e.role&&e.datum)return e.datum;for(const t of e.children??[]){const e=ew(t);if(e)return e}return null}function tw(e,t){return e?t.map(t=>e[t]+"").join(Jk):""}function ow(e){const{tree:t,chartId:o,observe:r=["hover","click"]}=e,n=e.selectionName??"__semiotic-nav-sync"+(o?":"+o:""),i=(0,Zk.useMemo)(()=>{if(e.matchFields)return e.matchFields;const o=ew(t);return o?Object.keys(o).filter(e=>{return!e.startsWith("_")&&(null==(t=o[e])||"string"==typeof t||"number"==typeof t||"boolean"==typeof t);var t}):[]},[e.matchFields,t]),s=(0,Zk.useMemo)(()=>{const e=new Map,o=t=>{if("datum"===t.role&&t.datum){const o=tw(t.datum,i);e.has(o)||e.set(o,t.id)}for(const e of t.children??[])o(e)};return o(t),e},[t,i]),{selectPoints:a,clear:l}=hh({name:n,fields:i}),{latest:c}=xh({chartId:o,types:[...r,"hover-end"],limit:1}),[u,d]=(0,Zk.useState)(t.id);(0,Zk.useEffect)(()=>{d(t.id),l()},[t,l]);const h=(0,Zk.useCallback)(e=>{if(d(e.id),"datum"===e.role&&e.datum&&i.length>0){const t={};for(const o of i)t[o]=[e.datum[o]];a(t)}else l()},[i,a,l]),p=e.annotations,f=(0,Zk.useMemo)(()=>{const e=new Set;if(0===i.length||!p)return e;for(const t of p){const o=s.get(tw(t,i));o&&e.add(o)}return e},[p,s,i]),g=(0,Zk.useCallback)(e=>{const t="number"==typeof e?p?.[e]:e;if(!t||0===i.length)return!1;const o=s.get(tw(t,i));if(!o)return!1;d(o);const r={};for(const e of i)r[e]=[t[e]];return a(r),!0},[p,s,i,a]),m=(0,Zk.useRef)(null);return(0,Zk.useEffect)(()=>{if(!c||c===m.current)return;if(m.current=c,"hover-end"===c.type)return;const e=c.datum;if(!e||0===i.length)return;const t=s.get(tw(e,i));t&&t!==u&&d(t)},[c,s,i,u]),{activeId:u,onActiveChange:h,selection:{name:n},annotatedIds:f,focusAnnotation:g}}y();var rw=require("react");function nw(e,t,o,r){const n=new Map;o.forEach((e,t)=>{n.set(r?r(e,t):t+"",e)});const i=[];t.forEach((e,t)=>{n.has(t)||i.push(t)}),i.length>0&&e.remove?.(i);const s=[];if(n.forEach((o,r)=>{const n=t.get(r);void 0===n?s.push(o):n!==o&&(e.update?e.update(r,()=>o):(e.remove?.(r),s.push(o)))}),s.length>0)if(e.pushMany)e.pushMany(s);else if(e.push)for(const t of s)e.push(t);return n}function iw(e,t,o={}){const{id:r,resetKey:n}=o,i=(0,rw.useMemo)(()=>function(e){return null==e?null:"function"==typeof e?(t,o)=>{const r=e(t,o);return null==r?o+"":r+""}:(t,o)=>{const r=t[e];return null==r?o+"":r+""}}(r),[r]),s=(0,rw.useRef)({map:new Map,handle:null,resetKey:void 0});(0,rw.useEffect)(()=>{const o=e.current;if(!o)return;const r=s.current;r.handle===o&&r.resetKey===n||(o.clear?.(),r.map=new Map,r.handle=o,r.resetKey=n),r.map=nw(o,r.map,t,i)},[e,t,i,n])}var sw=require("react/jsx-runtime");function aw({items:e,title:t="Additional notes",empty:o=null,ordered:r=!0,renderItem:n,className:i,style:s}){if(!e.length)return o?(0,sw.jsx)(sw.Fragment,{children:o}):null;const a=r?"ol":"ul";return(0,sw.jsxs)("section",{className:["semiotic-mobile-annotation-callouts",i].filter(Boolean).join(" "),style:s,children:[(0,sw.jsx)("style",{children:"\n .semiotic-mobile-annotation-callouts {\n display: grid;\n gap: 8px;\n padding: 10px 12px;\n border: 1px solid var(--semiotic-border, #d8d8d8);\n border-radius: 14px;\n background: var(--semiotic-bg, #fff);\n color: var(--semiotic-text, #222);\n }\n .semiotic-mobile-annotation-callouts h3 {\n margin: 0;\n font-size: 13px;\n font-weight: 800;\n line-height: 1.25;\n }\n .semiotic-mobile-annotation-callouts ol,\n .semiotic-mobile-annotation-callouts ul {\n display: grid;\n gap: 8px;\n margin: 0;\n padding-left: 18px;\n }\n .semiotic-mobile-annotation-callouts li {\n font-size: 13px;\n line-height: 1.45;\n }\n .semiotic-mobile-annotation-callouts small {\n display: block;\n margin-top: 2px;\n color: var(--semiotic-text-secondary, #666);\n font-size: 11px;\n line-height: 1.3;\n }\n "}),t&&(0,sw.jsx)("h3",{children:t}),(0,sw.jsx)(a,{children:e.map((e,t)=>(0,sw.jsx)("li",{children:n?n(e,t):(0,sw.jsxs)(sw.Fragment,{children:[(0,sw.jsx)("span",{children:e.label}),(e.source||e.emphasis)&&(0,sw.jsx)("small",{children:[e.emphasis,e.source].filter(Boolean).join(" - ")})]})},e.id))})]})}
|