semiotic 3.7.5 → 3.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +63 -18
- package/README.md +121 -27
- package/agent-skill/semiotic-charts/SKILL.md +146 -0
- package/ai/cli.js +133 -45
- package/ai/componentMetadata.cjs +6 -1
- package/ai/dist/mcp-server.js +1741 -163
- package/ai/examples.md +174 -0
- package/ai/schema.json +2733 -536
- package/ai/surface-manifest.json +201 -0
- package/ai/system-prompt.md +20 -4
- package/dist/__tests__/scenarios/mcpProtocolTypes.d.ts +20 -0
- package/dist/components/AccessibleNavTree.d.ts +7 -1
- package/dist/components/CategoryColors.d.ts +1 -1
- package/dist/components/ChartContainer.d.ts +91 -0
- package/dist/components/ChartGrid.d.ts +11 -1
- package/dist/components/CircularBrush.d.ts +61 -0
- package/dist/components/ContextLayout.d.ts +5 -1
- package/dist/components/DirectManipulationControl.d.ts +63 -0
- package/dist/components/LinkedCharts.d.ts +3 -1
- package/dist/components/MobileAnnotationCalloutList.d.ts +13 -0
- package/dist/components/MobileChartContainer.d.ts +51 -0
- package/dist/components/MobileStandardControls.d.ts +68 -0
- package/dist/components/SmallMultipleChart.d.ts +84 -0
- package/dist/components/Tooltip/FlippingTooltip.d.ts +21 -0
- package/dist/components/ai/ChartRecipe.d.ts +16 -0
- package/dist/components/ai/IntentMark.d.ts +15 -0
- package/dist/components/ai/chartCapabilities.d.ts +8 -1
- package/dist/components/ai/chartCapabilityTypes.d.ts +26 -1
- package/dist/components/ai/chartClinic.d.ts +91 -0
- package/dist/components/ai/chartClinicMetadata.generated.d.ts +15 -0
- package/dist/components/ai/chartRecipeRegistry.d.ts +14 -0
- package/dist/components/ai/chartRecipes.d.ts +278 -0
- package/dist/components/ai/dataPitfallsBridge.d.ts +102 -0
- package/dist/components/ai/describeChart.d.ts +7 -0
- package/dist/components/ai/describeRecipeChart.d.ts +16 -0
- package/dist/components/ai/generativeChart.d.ts +28 -3
- package/dist/components/ai/intentManifest.d.ts +62 -0
- package/dist/components/ai/navigationTree.d.ts +3 -0
- package/dist/components/ai/observedSceneAudit.d.ts +72 -0
- package/dist/components/ai/readerGrounding.d.ts +83 -0
- package/dist/components/ai/recipeCapability.d.ts +8 -0
- package/dist/components/ai/recipeNavigation.d.ts +13 -0
- package/dist/components/ai/recipeSemantics.d.ts +11 -0
- package/dist/components/ai/repairChartConfig.d.ts +9 -0
- package/dist/components/ai/suggestCharts.d.ts +11 -1
- package/dist/components/ai/useNavigationSync.d.ts +17 -2
- package/dist/components/chartContainerMobile.d.ts +9 -0
- package/dist/components/charts/custom/GeoCustomChart.d.ts +48 -0
- package/dist/components/charts/custom/NetworkCustomChart.d.ts +8 -2
- package/dist/components/charts/custom/OrdinalCustomChart.d.ts +8 -2
- package/dist/components/charts/custom/XYCustomChart.d.ts +11 -2
- package/dist/components/charts/geo/ChoroplethMap.d.ts +19 -2
- package/dist/components/charts/geo/DistanceCartogram.d.ts +15 -3
- package/dist/components/charts/geo/FlowMap.d.ts +11 -7
- package/dist/components/charts/geo/ProportionalSymbolMap.d.ts +15 -3
- package/dist/components/charts/geo/index.d.ts +2 -0
- package/dist/components/charts/index.d.ts +35 -1
- package/dist/components/charts/network/ChordDiagram.d.ts +10 -2
- package/dist/components/charts/network/CirclePack.d.ts +1 -1
- package/dist/components/charts/network/ForceDirectedGraph.d.ts +26 -5
- package/dist/components/charts/network/OrbitDiagram.d.ts +1 -1
- package/dist/components/charts/network/ProcessSankey.d.ts +1 -1
- package/dist/components/charts/network/SankeyDiagram.d.ts +10 -2
- package/dist/components/charts/network/TreeDiagram.d.ts +1 -1
- package/dist/components/charts/network/Treemap.d.ts +1 -1
- package/dist/components/charts/network/useForceLayout.d.ts +17 -0
- package/dist/components/charts/ordinal/BarChart.d.ts +22 -1
- package/dist/components/charts/ordinal/BoxPlot.d.ts +1 -1
- package/dist/components/charts/ordinal/DonutChart.d.ts +1 -1
- package/dist/components/charts/ordinal/DotPlot.d.ts +1 -1
- package/dist/components/charts/ordinal/FunnelChart.d.ts +1 -1
- package/dist/components/charts/ordinal/GroupedBarChart.d.ts +12 -1
- package/dist/components/charts/ordinal/Histogram.d.ts +1 -1
- package/dist/components/charts/ordinal/PieChart.d.ts +1 -1
- package/dist/components/charts/ordinal/RidgelinePlot.d.ts +1 -1
- package/dist/components/charts/ordinal/StackedBarChart.d.ts +12 -1
- package/dist/components/charts/ordinal/SwarmPlot.d.ts +1 -1
- package/dist/components/charts/ordinal/SwimlaneChart.d.ts +1 -1
- package/dist/components/charts/ordinal/ViolinPlot.d.ts +1 -1
- package/dist/components/charts/physics/ChainReactionChart.d.ts +9 -0
- package/dist/components/charts/physics/CollisionSwarmChart.capability.d.ts +2 -0
- package/dist/components/charts/physics/CollisionSwarmChart.d.ts +54 -0
- package/dist/components/charts/physics/EventDropChart.capability.d.ts +2 -0
- package/dist/components/charts/physics/EventDropChart.d.ts +60 -0
- package/dist/components/charts/physics/GaltonBoardChart.capability.d.ts +2 -0
- package/dist/components/charts/physics/GaltonBoardChart.d.ts +74 -0
- package/dist/components/charts/physics/GauntletChart.capability.d.ts +2 -0
- package/dist/components/charts/physics/GauntletChart.d.ts +73 -0
- package/dist/components/charts/physics/PhysicalFlowChart.capability.d.ts +2 -0
- package/dist/components/charts/physics/PhysicalFlowChart.d.ts +63 -0
- package/dist/components/charts/physics/PhysicsCustomChart.d.ts +99 -0
- package/dist/components/charts/physics/PhysicsPileChart.capability.d.ts +2 -0
- package/dist/components/charts/physics/PhysicsPileChart.d.ts +60 -0
- package/dist/components/charts/physics/ProcessFlowChart.capability.d.ts +2 -0
- package/dist/components/charts/physics/ProcessFlowChart.d.ts +96 -0
- package/dist/components/charts/physics/chainReactionOverlay.d.ts +22 -0
- package/dist/components/charts/physics/chainReactionRuntime.d.ts +37 -0
- package/dist/components/charts/physics/chainReactionTypes.d.ts +97 -0
- package/dist/components/charts/physics/collisionSwarmPhysics.d.ts +27 -0
- package/dist/components/charts/physics/dependencyMachine.d.ts +188 -0
- package/dist/components/charts/physics/eventDropPhysics.d.ts +64 -0
- package/dist/components/charts/physics/galtonBoardPhysics.d.ts +28 -0
- package/dist/components/charts/physics/gauntletChartProps.d.ts +67 -0
- package/dist/components/charts/physics/gauntletChrome.d.ts +33 -0
- package/dist/components/charts/physics/gauntletController.d.ts +73 -0
- package/dist/components/charts/physics/gauntletEffects.d.ts +36 -0
- package/dist/components/charts/physics/gauntletPhysics.d.ts +71 -0
- package/dist/components/charts/physics/gauntletRuntime.d.ts +42 -0
- package/dist/components/charts/physics/gauntletTypes.d.ts +213 -0
- package/dist/components/charts/physics/physicalFlowPhysics.d.ts +57 -0
- package/dist/components/charts/physics/physicsChartShared.d.ts +57 -0
- package/dist/components/charts/physics/physicsChartUtils.d.ts +18 -0
- package/dist/components/charts/physics/physicsCustomLayout.d.ts +32 -0
- package/dist/components/charts/physics/physicsEncoding.d.ts +142 -0
- package/dist/components/charts/physics/physicsHocHandle.d.ts +53 -0
- package/dist/components/charts/physics/physicsHocUtils.d.ts +128 -0
- package/dist/components/charts/physics/physicsPilePhysics.d.ts +41 -0
- package/dist/components/charts/physics/physicsProcessPrimitives.d.ts +38 -0
- package/dist/components/charts/physics/processFlowPhysics.d.ts +97 -0
- package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +9 -1
- package/dist/components/charts/realtime/RealtimeHistogram.d.ts +9 -1
- package/dist/components/charts/realtime/RealtimeLineChart.d.ts +9 -1
- package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +16 -2
- package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +9 -1
- package/dist/components/charts/shared/AnnotationLabel.d.ts +88 -0
- package/dist/components/charts/shared/annotationActivation.d.ts +35 -0
- package/dist/components/charts/shared/annotationLabelLayout.d.ts +5 -0
- package/dist/components/charts/shared/annotationRules.d.ts +2 -1
- package/dist/components/charts/shared/auditMobileVisualization.d.ts +91 -0
- package/dist/components/charts/shared/chartDefinitionPilot.d.ts +145 -0
- package/dist/components/charts/shared/chartFamilySets.d.ts +20 -0
- package/dist/components/charts/shared/chartSelectionUtils.d.ts +4 -0
- package/dist/components/charts/shared/chartSpecCore.d.ts +165 -0
- package/dist/components/charts/shared/chartSpecs.d.ts +8 -127
- package/dist/components/charts/shared/chartSpecsGeo.d.ts +2 -0
- package/dist/components/charts/shared/chartSpecsNetwork.d.ts +2 -0
- package/dist/components/charts/shared/chartSpecsOrdinal.d.ts +2 -0
- package/dist/components/charts/shared/chartSpecsPhysics.d.ts +2 -0
- package/dist/components/charts/shared/chartSpecsRealtime.d.ts +2 -0
- package/dist/components/charts/shared/chartSpecsValue.d.ts +2 -0
- package/dist/components/charts/shared/chartSpecsXY.d.ts +2 -0
- package/dist/components/charts/shared/colorContrast.d.ts +3 -0
- package/dist/components/charts/shared/colorUtils.d.ts +16 -1
- package/dist/components/charts/shared/datumTypes.d.ts +2 -0
- package/dist/components/charts/shared/diagnoseAnnotationChecks.d.ts +6 -0
- package/dist/components/charts/shared/diagnoseConfig.d.ts +9 -14
- package/dist/components/charts/shared/diagnoseMisleadingChecks.d.ts +9 -0
- package/dist/components/charts/shared/diagnosePhysicsChecks.d.ts +3 -0
- package/dist/components/charts/shared/diagnoseTypes.d.ts +10 -0
- package/dist/components/charts/shared/formatUtils.d.ts +3 -3
- package/dist/components/charts/shared/hatchFill.d.ts +87 -0
- package/dist/components/charts/shared/hooks.d.ts +34 -10
- package/dist/components/charts/shared/knownChartComponents.d.ts +9 -0
- package/dist/components/charts/shared/leastSquaresRegression.d.ts +16 -0
- package/dist/components/charts/shared/mergeShapeStyle.d.ts +3 -2
- package/dist/components/charts/shared/motionEncoding.d.ts +145 -0
- package/dist/components/charts/shared/responsiveRules.d.ts +56 -0
- package/dist/components/charts/shared/semanticInteractions.d.ts +42 -0
- package/dist/components/charts/shared/sparseArray.d.ts +1 -1
- package/dist/components/charts/shared/streamPropsHelpers.d.ts +17 -5
- package/dist/components/charts/shared/styleRules.d.ts +205 -0
- package/dist/components/charts/shared/temporalStrings.d.ts +7 -0
- package/dist/components/charts/shared/tooltipUtils.d.ts +22 -9
- package/dist/components/charts/shared/types.d.ts +58 -7
- package/dist/components/charts/shared/useAreaSeriesSetup.d.ts +16 -2
- package/dist/components/charts/shared/useChartSetup.d.ts +11 -4
- package/dist/components/charts/shared/useCustomChartSetup.d.ts +17 -5
- package/dist/components/charts/shared/useFrameImperativeHandle.d.ts +1 -2
- package/dist/components/charts/shared/useLikertAggregation.d.ts +4 -4
- package/dist/components/charts/shared/useNetworkChartSetup.d.ts +6 -2
- package/dist/components/charts/shared/useOrdinalBrush.d.ts +2 -1
- package/dist/components/charts/shared/useOrdinalPieceStyle.d.ts +25 -2
- package/dist/components/charts/shared/useStreamingLegend.d.ts +2 -2
- package/dist/components/charts/shared/useSyncedPushData.d.ts +49 -0
- package/dist/components/charts/shared/useXYLineStyle.d.ts +10 -0
- package/dist/components/charts/shared/useXYPointStyle.d.ts +19 -1
- package/dist/components/charts/shared/validateChartData.d.ts +7 -5
- package/dist/components/charts/shared/validationMap.d.ts +7 -9
- package/dist/components/charts/shared/validationMap.generated.d.ts +6 -0
- package/dist/components/charts/shared/withChartWrapper.d.ts +4 -3
- package/dist/components/charts/value/targetPresentation.d.ts +22 -0
- package/dist/components/charts/value/types.d.ts +5 -6
- package/dist/components/charts/xy/AreaChart.d.ts +9 -1
- package/dist/components/charts/xy/BubbleChart.d.ts +10 -1
- package/dist/components/charts/xy/ConnectedScatterplot.d.ts +7 -0
- package/dist/components/charts/xy/DifferenceChart.d.ts +1 -52
- package/dist/components/charts/xy/Heatmap.d.ts +2 -2
- package/dist/components/charts/xy/LineChart.d.ts +12 -1
- package/dist/components/charts/xy/MinimapChart.d.ts +1 -1
- package/dist/components/charts/xy/MultiAxisLineChart.d.ts +2 -2
- package/dist/components/charts/xy/QuadrantChart.d.ts +8 -1
- package/dist/components/charts/xy/Scatterplot.d.ts +11 -1
- package/dist/components/charts/xy/ScatterplotMatrix.d.ts +11 -1
- package/dist/components/charts/xy/StackedAreaChart.d.ts +16 -4
- package/dist/components/charts/xy/differenceSegments.d.ts +49 -0
- package/dist/components/charts/xy/scatterplotMatrixInteractionTypes.d.ts +12 -0
- package/dist/components/controls/SentenceFilter.d.ts +97 -0
- package/dist/components/controls/controlAudit.d.ts +24 -0
- package/dist/components/controls/controlContract.d.ts +57 -0
- package/dist/components/data/fromFlintChart.d.ts +74 -0
- package/dist/components/data/fromVegaLite.d.ts +46 -9
- package/dist/components/data/portability/index.d.ts +6 -3
- package/dist/components/data/portability/result.d.ts +52 -0
- package/dist/components/data/portability/spec.d.ts +31 -0
- package/dist/components/data/portability/vegaLite.d.ts +24 -6
- package/dist/components/export/chartConfig.d.ts +11 -0
- package/dist/components/realtime/types.d.ts +11 -0
- package/dist/components/recipes/annotationLayout.d.ts +29 -0
- package/dist/components/recipes/axisFixedForce.d.ts +119 -0
- package/dist/components/recipes/{gofishBoba.d.ts → boba.d.ts} +2 -2
- package/dist/components/recipes/cyclical.d.ts +39 -0
- package/dist/components/recipes/edgeRouter.d.ts +103 -0
- package/dist/components/recipes/forceLayout.d.ts +48 -0
- package/dist/components/recipes/forceLayoutAsync.d.ts +17 -0
- package/dist/components/recipes/gofishBobaHandwritten.d.ts +3 -0
- package/dist/components/recipes/gofishDisplayListFixtures.generated.d.ts +37 -0
- package/dist/components/recipes/gofishIR.d.ts +178 -132
- package/dist/components/recipes/gofishIRExamples.d.ts +30 -81
- package/dist/components/recipes/intervalLanes.d.ts +87 -0
- package/dist/components/recipes/intervals.d.ts +80 -0
- package/dist/components/recipes/isometricLandmarks.d.ts +88 -0
- package/dist/components/recipes/isotypeGlyphs.d.ts +17 -0
- package/dist/components/recipes/mobileAnnotationStrategy.d.ts +48 -0
- package/dist/components/recipes/mobileChartFamilyRecipes.d.ts +59 -0
- package/dist/components/recipes/networkAnalysis.d.ts +102 -0
- package/dist/components/recipes/networkLayouts.d.ts +83 -0
- package/dist/components/recipes/physics.d.ts +122 -0
- package/dist/components/recipes/physicsReference.d.ts +102 -0
- package/dist/components/recipes/processAggregates.d.ts +32 -0
- package/dist/components/recipes/processChrome.d.ts +67 -0
- package/dist/components/recipes/processJourney.d.ts +54 -0
- package/dist/components/recipes/processPhysics.d.ts +300 -0
- package/dist/components/recipes/processVolumeGeometry.d.ts +28 -0
- package/dist/components/recipes/radialCoords.d.ts +69 -0
- package/dist/components/recipes/random.d.ts +2 -0
- package/dist/components/recipes/recipeChrome.d.ts +91 -0
- package/dist/components/recipes/recipeGlyph.d.ts +42 -0
- package/dist/components/recipes/recipeLegend.d.ts +53 -1
- package/dist/components/recipes/recipeUtils.d.ts +52 -0
- package/dist/components/recipes/runs.d.ts +59 -0
- package/dist/components/recipes/tokenEncoding.d.ts +157 -0
- package/dist/components/recipes/tokenLayer.d.ts +79 -0
- package/dist/components/recipes/unitize.d.ts +108 -0
- package/dist/components/recipes/vector.d.ts +28 -0
- package/dist/components/recipes/waffle.d.ts +43 -0
- package/dist/components/rough/createRoughRenderMode.d.ts +46 -0
- package/dist/components/semiotic-ai-core.d.ts +47 -0
- package/dist/components/semiotic-ai.d.ts +53 -9
- package/dist/components/semiotic-controls.d.ts +20 -0
- package/dist/components/semiotic-experimental.d.ts +38 -9
- package/dist/components/semiotic-geo.d.ts +15 -0
- package/dist/components/semiotic-network.d.ts +15 -0
- package/dist/components/semiotic-ordinal.d.ts +14 -0
- package/dist/components/semiotic-physics-matter.d.ts +10 -0
- package/dist/components/semiotic-physics-rapier.d.ts +9 -0
- package/dist/components/semiotic-physics.d.ts +60 -0
- package/dist/components/semiotic-realtime-core.d.ts +34 -0
- package/dist/components/semiotic-realtime-react.d.ts +10 -0
- package/dist/components/semiotic-realtime.d.ts +4 -30
- package/dist/components/semiotic-recipes-core.d.ts +92 -0
- package/dist/components/semiotic-recipes-react.d.ts +7 -0
- package/dist/components/semiotic-recipes.d.ts +4 -43
- package/dist/components/semiotic-rough.d.ts +4 -0
- package/dist/components/semiotic-server-edge.d.ts +8 -0
- package/dist/components/semiotic-server-node.d.ts +5 -0
- package/dist/components/semiotic-server.d.ts +2 -2
- package/dist/components/semiotic-themes-core.d.ts +53 -0
- package/dist/components/semiotic-themes-react.d.ts +4 -0
- package/dist/components/semiotic-themes.d.ts +6 -76
- package/dist/components/semiotic-utils-core.d.ts +50 -0
- package/dist/components/semiotic-utils-react.d.ts +5 -0
- package/dist/components/semiotic-utils.d.ts +3 -39
- package/dist/components/semiotic-xy.d.ts +12 -0
- package/dist/components/semiotic.d.ts +44 -8
- package/dist/components/server/animatedGif.d.ts +36 -0
- package/dist/components/server/optionalImageTypes.d.ts +37 -0
- package/dist/components/server/renderEvidence.d.ts +1 -1
- package/dist/components/server/renderToStaticSVG.d.ts +3 -35
- package/dist/components/server/serverChartConfigShared.d.ts +21 -0
- package/dist/components/server/serverChartConfigs.d.ts +22 -12
- package/dist/components/server/serverChartConfigsCustom.d.ts +5 -0
- package/dist/components/server/serverChartConfigsGeo.d.ts +9 -0
- package/dist/components/server/serverChartConfigsNetwork.d.ts +8 -0
- package/dist/components/server/serverChartConfigsOrdinal.d.ts +16 -0
- package/dist/components/server/serverChartConfigsPhysics.d.ts +9 -0
- package/dist/components/server/serverChartConfigsXY.d.ts +11 -0
- package/dist/components/server/staticAnnotations.d.ts +6 -3
- package/dist/components/server/staticGeo.d.ts +4 -0
- package/dist/components/server/staticLegend.d.ts +2 -2
- package/dist/components/server/staticNetwork.d.ts +8 -0
- package/dist/components/server/staticOrdinal.d.ts +11 -0
- package/dist/components/server/staticPhysics.d.ts +3 -0
- package/dist/components/server/staticSVGChrome.d.ts +110 -0
- package/dist/components/server/staticXY.d.ts +4 -0
- package/dist/components/store/ObservationStore.d.ts +23 -2
- package/dist/components/store/themeSerialization.d.ts +32 -0
- package/dist/components/store/useChartInterrogation.d.ts +9 -0
- package/dist/components/stream/AccessibleDataTable.d.ts +7 -23
- package/dist/components/stream/AriaLiveTooltip.d.ts +9 -0
- package/dist/components/stream/CanvasHitTester.d.ts +4 -4
- package/dist/components/stream/DataSourceAdapter.d.ts +1 -1
- package/dist/components/stream/FocusRing.d.ts +4 -2
- package/dist/components/stream/FrameRuntime.d.ts +57 -0
- package/dist/components/stream/GeoCanvasHitTester.d.ts +1 -1
- package/dist/components/stream/GeoParticlePool.d.ts +1 -1
- package/dist/components/stream/GeoPipelineStore.d.ts +62 -3
- package/dist/components/stream/GeoSVGOverlay.d.ts +64 -0
- package/dist/components/stream/NetworkCanvasHitTester.d.ts +2 -1
- package/dist/components/stream/NetworkPipelineStore.d.ts +44 -36
- package/dist/components/stream/NetworkSSRFrame.d.ts +17 -0
- package/dist/components/stream/NetworkSVGOverlay.d.ts +10 -1
- package/dist/components/stream/OrdinalCanvasHitTester.d.ts +2 -2
- package/dist/components/stream/OrdinalPipelineStore.d.ts +55 -11
- package/dist/components/stream/OrdinalSVGOverlay.d.ts +9 -1
- package/dist/components/stream/OrdinalStyleResolver.d.ts +12 -0
- package/dist/components/stream/ParticlePool.d.ts +1 -1
- package/dist/components/stream/PipelineStore.d.ts +81 -174
- package/dist/components/stream/SVGOverlay.d.ts +6 -0
- package/dist/components/stream/SceneGraph.d.ts +12 -4
- package/dist/components/stream/StreamGeoFrame.d.ts +1 -1
- package/dist/components/stream/StreamNetworkFrame.d.ts +1 -1
- package/dist/components/stream/StreamOrdinalFrame.d.ts +1 -1
- package/dist/components/stream/StreamXYFrame.d.ts +2 -18
- package/dist/components/stream/accessibleDataRows.d.ts +33 -0
- package/dist/components/stream/accessorUtils.d.ts +25 -12
- package/dist/components/stream/annotationAccessorResolver.d.ts +2 -2
- package/dist/components/stream/brushAccessibility.d.ts +25 -0
- package/dist/components/stream/canvasBackground.d.ts +24 -0
- package/dist/components/stream/canvasSetup.d.ts +4 -1
- package/dist/components/stream/customLayoutFailure.d.ts +33 -0
- package/dist/components/stream/customLayoutPalette.d.ts +19 -9
- package/dist/components/stream/frameGraphics.d.ts +4 -0
- package/dist/components/stream/frameKeyboardNavigation.d.ts +45 -0
- package/dist/components/stream/frameThemeColors.d.ts +24 -0
- package/dist/components/stream/geoAnnotationAnchors.d.ts +14 -0
- package/dist/components/stream/geoCartogram.d.ts +17 -0
- package/dist/components/stream/geoCustomLayout.d.ts +59 -0
- package/dist/components/stream/geoDefaultTooltip.d.ts +11 -0
- package/dist/components/stream/geoFrameHelpers.d.ts +34 -0
- package/dist/components/stream/geoPipelineHelpers.d.ts +46 -0
- package/dist/components/stream/geoPipelineUpdateResults.d.ts +34 -0
- package/dist/components/stream/geoSceneBuilder.d.ts +16 -0
- package/dist/components/stream/geoTypes.d.ts +97 -15
- package/dist/components/stream/glyphDef.d.ts +98 -0
- package/dist/components/stream/hitTarget.d.ts +170 -0
- package/dist/components/stream/hitTestUtils.d.ts +2 -2
- package/dist/components/stream/hoverUtils.d.ts +7 -2
- package/dist/components/stream/keyboardNav.d.ts +4 -1
- package/dist/components/stream/layouts/forceLayoutPlugin.d.ts +9 -1
- package/dist/components/stream/layouts/forceLayoutWorkerClient.d.ts +58 -0
- package/dist/components/stream/layouts/hierarchyUtils.d.ts +2 -2
- package/dist/components/stream/networkBezier.d.ts +10 -0
- package/dist/components/stream/networkColorAccessors.d.ts +49 -0
- package/dist/components/stream/networkCustomLayoutRunner.d.ts +23 -0
- package/dist/components/stream/networkCustomRestyle.d.ts +15 -0
- package/dist/components/stream/networkDefaultTooltip.d.ts +10 -0
- package/dist/components/stream/networkFrameAnimation.d.ts +7 -0
- package/dist/components/stream/networkFrameHandleTypes.d.ts +39 -0
- package/dist/components/stream/networkFrameInteraction.d.ts +37 -0
- package/dist/components/stream/networkFrameObservations.d.ts +15 -0
- package/dist/components/stream/networkFramePaint.d.ts +52 -0
- package/dist/components/stream/networkInteractionTypes.d.ts +26 -0
- package/dist/components/stream/networkPipelineConfig.d.ts +22 -0
- package/dist/components/stream/networkPipelineHelpers.d.ts +12 -0
- package/dist/components/stream/networkPipelineUpdateResults.d.ts +38 -0
- package/dist/components/stream/networkRealtimeEncoding.d.ts +41 -0
- package/dist/components/stream/networkTypes.d.ts +103 -51
- package/dist/components/stream/ordinalCanvasRenderers.d.ts +7 -0
- package/dist/components/stream/ordinalDataIndex.d.ts +5 -0
- package/dist/components/stream/ordinalDefaultTooltip.d.ts +10 -0
- package/dist/components/stream/ordinalDomain.d.ts +38 -0
- package/dist/components/stream/ordinalPipelineUpdateResults.d.ts +31 -0
- package/dist/components/stream/ordinalPulse.d.ts +10 -0
- package/dist/components/stream/ordinalPulseResources.d.ts +3 -0
- package/dist/components/stream/ordinalSceneBuilders/sceneBuilderMap.d.ts +5 -0
- package/dist/components/stream/ordinalSceneBuilders/types.d.ts +2 -2
- package/dist/components/stream/ordinalSpatialIndex.d.ts +9 -0
- package/dist/components/stream/ordinalTypes.d.ts +68 -9
- package/dist/components/stream/paintNeeds.d.ts +31 -0
- package/dist/components/stream/physics/CapacityQueueController.d.ts +5 -0
- package/dist/components/stream/physics/CapacityQueueTypes.d.ts +134 -0
- package/dist/components/stream/physics/MatterPhysicsEngineAdapter.d.ts +42 -0
- package/dist/components/stream/physics/PhysicsAccessibility.d.ts +48 -0
- package/dist/components/stream/physics/PhysicsAnnotations.d.ts +58 -0
- package/dist/components/stream/physics/PhysicsBodyBudget.d.ts +26 -0
- package/dist/components/stream/physics/PhysicsBodySpatialIndex.d.ts +10 -0
- package/dist/components/stream/physics/PhysicsCanvasTheme.d.ts +26 -0
- package/dist/components/stream/physics/PhysicsControllers.d.ts +75 -0
- package/dist/components/stream/physics/PhysicsEngineAdapter.d.ts +59 -0
- package/dist/components/stream/physics/PhysicsEngineConformance.d.ts +23 -0
- package/dist/components/stream/physics/PhysicsEvidence.d.ts +25 -0
- package/dist/components/stream/physics/PhysicsKernel.d.ts +207 -0
- package/dist/components/stream/physics/PhysicsOptionalEngineAdapters.d.ts +12 -0
- package/dist/components/stream/physics/PhysicsPipelineStore.d.ts +86 -0
- package/dist/components/stream/physics/PhysicsPipelineTypes.d.ts +181 -0
- package/dist/components/stream/physics/PhysicsSVGOverlay.d.ts +78 -0
- package/dist/components/stream/physics/PhysicsSediment.d.ts +69 -0
- package/dist/components/stream/physics/PhysicsSettledSVG.d.ts +18 -0
- package/dist/components/stream/physics/PhysicsSettledScene.d.ts +21 -0
- package/dist/components/stream/physics/PhysicsWorkerClient.d.ts +24 -0
- package/dist/components/stream/physics/PhysicsWorkerProtocol.d.ts +101 -0
- package/dist/components/stream/physics/PhysicsWorkerRuntime.d.ts +5 -0
- package/dist/components/stream/physics/RapierPhysicsEngineAdapter.d.ts +18 -0
- package/dist/components/stream/physics/ServiceOperationsControllers.d.ts +27 -0
- package/dist/components/stream/physics/ServiceOperationsTypes.d.ts +89 -0
- package/dist/components/stream/physics/StreamPhysicsFrame.d.ts +6 -0
- package/dist/components/stream/physics/StreamPhysicsTypes.d.ts +317 -0
- package/dist/components/stream/physics/physicsBodyCanvas.d.ts +27 -0
- package/dist/components/stream/physics/physicsFrameObservations.d.ts +19 -0
- package/dist/components/stream/physics/physicsFrameSetup.d.ts +4 -0
- package/dist/components/stream/physics/physicsPipelineControls.d.ts +4 -0
- package/dist/components/stream/physics/physicsPipelineHelpers.d.ts +41 -0
- package/dist/components/stream/physics/physicsPipelineObservations.d.ts +14 -0
- package/dist/components/stream/physics/physicsPipelineUpdateResults.d.ts +27 -0
- package/dist/components/stream/physics/physicsRegionRuntime.d.ts +54 -0
- package/dist/components/stream/physics/physicsSemanticUI.d.ts +20 -0
- package/dist/components/stream/physics/usePhysicsFrameLifecyclePolicy.d.ts +18 -0
- package/dist/components/stream/pipelineBufferUtils.d.ts +26 -0
- package/dist/components/stream/pipelineConfig.d.ts +179 -0
- package/dist/components/stream/pipelineDecay.d.ts +21 -3
- package/dist/components/stream/pipelineDomainResolution.d.ts +62 -0
- package/dist/components/stream/pipelineIdentityOps.d.ts +26 -0
- package/dist/components/stream/pipelinePulse.d.ts +17 -3
- package/dist/components/stream/pipelineRibbons.d.ts +41 -0
- package/dist/components/stream/pipelineSpatialIndex.d.ts +12 -0
- package/dist/components/stream/pipelineStoreUpdateResults.d.ts +33 -0
- package/dist/components/stream/pipelineStyleResolvers.d.ts +46 -0
- package/dist/components/stream/pipelineTransitions.d.ts +3 -1
- package/dist/components/stream/pipelineUpdateContract.d.ts +69 -0
- package/dist/components/stream/pipelineUpdateStore.d.ts +21 -0
- package/dist/components/stream/pulseFrameRefresh.d.ts +22 -0
- package/dist/components/stream/renderBackend.d.ts +27 -0
- package/dist/components/stream/renderers/canvasRenderHelpers.d.ts +15 -1
- package/dist/components/stream/renderers/geoCanvasRenderer.d.ts +3 -2
- package/dist/components/stream/renderers/glyphCanvasRenderer.d.ts +6 -0
- package/dist/components/stream/renderers/networkParticleRenderer.d.ts +1 -1
- package/dist/components/stream/renderers/resolveCSSColor.d.ts +6 -0
- package/dist/components/stream/sceneRenderBackendTypes.d.ts +28 -0
- package/dist/components/stream/sceneRevisionDiagnostics.d.ts +45 -0
- package/dist/components/stream/streamSemanticTypes.d.ts +16 -0
- package/dist/components/stream/streamStoreSync.d.ts +37 -0
- package/dist/components/stream/streamThemeTypes.d.ts +14 -0
- package/dist/components/stream/svgOverlayUtils.d.ts +10 -0
- package/dist/components/stream/test-utils/frameScheduler.d.ts +12 -0
- package/dist/components/stream/test-utils/revisionConsumption.d.ts +13 -0
- package/dist/components/stream/titleLayout.d.ts +31 -0
- package/dist/components/stream/types.d.ts +165 -72
- package/dist/components/stream/useCanvasFrameHost.d.ts +71 -0
- package/dist/components/stream/useFrame.d.ts +44 -2
- package/dist/components/stream/useHydration.d.ts +6 -0
- package/dist/components/stream/useLegendCategoryEmission.d.ts +5 -0
- package/dist/components/stream/useSemanticFrameInteractions.d.ts +22 -0
- package/dist/components/stream/useUpdateResultSnapshot.d.ts +7 -0
- package/dist/components/stream/workerModuleUrl.d.ts +10 -0
- package/dist/components/stream/xyAnnotationAnchors.d.ts +13 -0
- package/dist/components/stream/xyCanvasRenderers.d.ts +7 -0
- package/dist/components/stream/xyCrosshair.d.ts +11 -0
- package/dist/components/stream/xyDateTicks.d.ts +9 -0
- package/dist/components/stream/xyDefaultTooltip.d.ts +10 -0
- package/dist/components/stream/xyFrameAxisTypes.d.ts +50 -0
- package/dist/components/stream/xySceneBuilders/types.d.ts +10 -9
- package/dist/controls.min.js +2 -0
- package/dist/controls.module.min.js +2 -0
- package/dist/forceLayoutWorker.js +1 -0
- package/dist/geo.min.js +1 -1
- package/dist/geo.module.min.js +1 -1
- package/dist/network.min.js +1 -1
- package/dist/network.module.min.js +1 -1
- package/dist/ordinal.min.js +1 -1
- package/dist/ordinal.module.min.js +1 -1
- package/dist/physics-matter.min.js +1 -0
- package/dist/physics-matter.module.min.js +1 -0
- package/dist/physics-rapier.min.js +1 -0
- package/dist/physics-rapier.module.min.js +1 -0
- package/dist/physics.min.js +2 -0
- package/dist/physics.module.min.js +2 -0
- package/dist/physicsWorker.js +1 -0
- package/dist/realtime.min.js +1 -1
- package/dist/realtime.module.min.js +1 -1
- package/dist/rough.min.js +1 -0
- package/dist/rough.module.min.js +1 -0
- package/dist/semiotic-ai-chunk-OG7BQUUW.module.min.js +2 -0
- package/dist/semiotic-ai-core.d.ts +47 -0
- package/dist/semiotic-ai-core.min.js +1 -0
- package/dist/semiotic-ai-core.module.min.js +1 -0
- package/dist/semiotic-ai-statisticalOverlays-CY4WKR4A.module.min.js +2 -0
- package/dist/semiotic-ai.d.ts +53 -9
- package/dist/semiotic-ai.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-chunk-3FSVZ46U.module.min.js +2 -0
- package/dist/semiotic-controls.d.ts +20 -0
- package/dist/semiotic-data.min.js +1 -1
- package/dist/semiotic-data.module.min.js +1 -1
- package/dist/semiotic-experimental.d.ts +38 -9
- package/dist/semiotic-experimental.min.js +1 -1
- package/dist/semiotic-experimental.module.min.js +1 -1
- package/dist/semiotic-geo.d.ts +15 -0
- package/dist/semiotic-network.d.ts +15 -0
- package/dist/semiotic-ordinal.d.ts +14 -0
- package/dist/semiotic-physics-matter.d.ts +10 -0
- package/dist/semiotic-physics-rapier.d.ts +9 -0
- package/dist/semiotic-physics.d.ts +60 -0
- package/dist/semiotic-realtime-core.d.ts +34 -0
- package/dist/semiotic-realtime-core.min.js +1 -0
- package/dist/semiotic-realtime-core.module.min.js +1 -0
- package/dist/semiotic-realtime-react.d.ts +10 -0
- package/dist/semiotic-realtime-react.min.js +2 -0
- package/dist/semiotic-realtime-react.module.min.js +2 -0
- package/dist/semiotic-realtime.d.ts +4 -30
- package/dist/semiotic-recipes-core.d.ts +92 -0
- package/dist/semiotic-recipes-core.min.js +1 -0
- package/dist/semiotic-recipes-core.module.min.js +1 -0
- package/dist/semiotic-recipes-react.d.ts +7 -0
- package/dist/semiotic-recipes-react.min.js +2 -0
- package/dist/semiotic-recipes-react.module.min.js +2 -0
- package/dist/semiotic-recipes.d.ts +4 -43
- package/dist/semiotic-recipes.min.js +1 -1
- package/dist/semiotic-recipes.module.min.js +1 -1
- package/dist/semiotic-rough.d.ts +4 -0
- package/dist/semiotic-server-edge.d.ts +8 -0
- package/dist/semiotic-server-edge.min.js +1 -0
- package/dist/semiotic-server-edge.module.min.js +1 -0
- package/dist/semiotic-server-node.d.ts +5 -0
- package/dist/semiotic-server-node.min.js +1 -0
- package/dist/semiotic-server-node.module.min.js +1 -0
- package/dist/semiotic-server.d.ts +2 -2
- package/dist/semiotic-statisticalOverlays-UOMSFKVJ.module.min.js +2 -0
- package/dist/semiotic-themes-core.d.ts +53 -0
- package/dist/semiotic-themes-core.min.js +1 -0
- package/dist/semiotic-themes-core.module.min.js +1 -0
- package/dist/semiotic-themes-react.d.ts +4 -0
- package/dist/semiotic-themes-react.min.js +2 -0
- package/dist/semiotic-themes-react.module.min.js +2 -0
- package/dist/semiotic-themes.d.ts +6 -76
- package/dist/semiotic-themes.min.js +1 -2
- package/dist/semiotic-themes.module.min.js +1 -2
- package/dist/semiotic-utils-core.d.ts +50 -0
- package/dist/semiotic-utils-core.min.js +1 -0
- package/dist/semiotic-utils-core.module.min.js +1 -0
- package/dist/semiotic-utils-react.d.ts +5 -0
- package/dist/semiotic-utils-react.min.js +2 -0
- package/dist/semiotic-utils-react.module.min.js +2 -0
- package/dist/semiotic-utils.d.ts +3 -39
- package/dist/semiotic-utils.min.js +1 -2
- package/dist/semiotic-utils.module.min.js +1 -2
- package/dist/semiotic-value.min.js +1 -1
- package/dist/semiotic-value.module.min.js +1 -1
- package/dist/semiotic-xy.d.ts +12 -0
- package/dist/semiotic.d.ts +44 -8
- package/dist/semiotic.min.js +1 -1
- package/dist/semiotic.module.min.js +1 -1
- package/dist/server.min.js +1 -1
- package/dist/server.module.min.js +1 -1
- package/dist/test-utils/capturedFrameProps.d.ts +67 -0
- package/dist/test-utils/frameMock.d.ts +12 -9
- package/dist/xy-chunk-IWD6IB6V.module.min.js +2 -0
- package/dist/xy-statisticalOverlays-7RWG6LJT.module.min.js +2 -0
- package/dist/xy.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +259 -88
- package/spec/README.md +152 -0
- package/spec/bindings/README.md +35 -0
- package/spec/bindings/vega-lite.mjs +112 -0
- package/spec/v0.1/annotation-provenance.schema.json +127 -0
- package/spec/v0.1/audience-profile.schema.json +67 -0
- package/spec/v0.1/chart-capability.schema.json +186 -0
- package/dist/components/recipes/gofish.d.ts +0 -207
- package/dist/components/recipes/gofishInterpreter.d.ts +0 -52
- package/dist/components/recipes/gofishLambdas.d.ts +0 -145
- package/dist/semiotic-ai-semiotic-ai-u954ylUn.js +0 -2
- package/dist/semiotic-ai-statisticalOverlays-CU7jW05Q.js +0 -1
- package/dist/semiotic-semiotic-BmrYbi99.js +0 -2
- package/dist/semiotic-statisticalOverlays-IjZw8Lsu.js +0 -1
- package/dist/xy-semiotic-xy-Dufu3D0-.js +0 -2
- package/dist/xy-statisticalOverlays-3Ni9bRph.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as o from"react";import{useRef as r,useMemo as i,useContext as a,useCallback as s,useSyncExternalStore as l,createContext as c,useState as d,useEffect as u,useLayoutEffect as h,forwardRef as f,useImperativeHandle as g,useId as y}from"react";import{interpolateNumber as p}from"d3-interpolate";import{min as v,groups as m,max as b,sum as x,mean as k,group as w}from"d3-array";import{forceLink as S,forceSimulation as A,forceManyBody as M,forceCenter as L,forceX as O,forceY as D}from"d3-force";import{scaleLinear as E,scaleOrdinal as _,scaleTime as N}from"d3-scale";import{ribbon as P,chord as T}from"d3-chord";import{arc as C,pie as I,symbol as j,symbolCircle as W,symbolWye as $,symbolCross as B,symbolStar as R,symbolDiamond as z,symbolTriangle as H,symbolSquare as F}from"d3-shape";import{hierarchy as Y,partition as X,pack as G,treemap as q,treemapBinary as V,cluster as K,tree as Q}from"d3-hierarchy";import{quadtree as Z}from"d3-quadtree";function U(e){return Array.isArray(e)?e[0]:e}function J(e,t,n,o){return Object.assign({data:U(e),x:t,y:n,__semioticHoverData:!0},o)}const ee=["name","label","title"],te=["type","kind","category","group","class","status","role","shape"],ne=["value","amount","total","count","weight","score"],oe=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 re(e,t){for(const n of t){const t=e.find(e=>e.lower===n);if(t)return t}}const ie={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 ae(e,t){return"function"==typeof t?t(e):e[t]}function se(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 le(n={}){const{fields:o,title:r,format:i,style:a={},className:s=""}=n;return n=>{if(!n||"object"!=typeof n)return null;let l;const c=[];if(r){const e=ae(n,r);l=se(e,i)}if(o&&o.length>0)o.forEach(e=>{let t,o,r;"string"==typeof e?(t=e,o=e,r=i):(t=e.label,o=e.accessor||e.key||"",r=e.format||i);const a=ae(n,o);c.push({label:t,value:se(a,r)})});else if(!r){const e=["value","y","name","id","label"];for(const t of e)if(void 0!==n[t]){l=se(n[t],i);break}if(!l){const e=Object.keys(n).filter(e=>!e.startsWith("_"));e.length>0&&(l=se(n[e[0]],i))}}const d=Object.assign(Object.assign({},ie),a);return t("div",{className:("semiotic-tooltip "+s).trim(),style:d,children:[l&&e("div",{style:{fontWeight:c.length>0?"bold":"normal"},children:l}),c.map((e,n)=>t("div",{style:{marginTop:0===n&&l?"4px":0},children:[e.label&&t("span",{children:[e.label,": "]}),e.value]},n))]})}}function ce(t){if(!0!==t){if("function"==typeof t){const n=t;return t=>{var o;let r=U(!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==r?void 0:r.x0)&&"number"==typeof(null==r?void 0:r.x1)||"edge"===(null==t?void 0:t.nodeOrEdge)&&"number"==typeof(null==r?void 0:r.sankeyWidth))&&r.data&&"object"==typeof r.data&&(r=r.data);const i=n(r);return null==i?null:e("div",{className:"semiotic-tooltip",style:ie,children:i})}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?le(t):le())}}const de={weightChange:.1,newEdge:.5,newNode:1,threshold:3,transitionDuration:500},ue={radius:3,opacity:.7,speedMultiplier:1,maxPerEdge:50,spawnRate:.1};function he(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function fe(e,t,n){const o=e=>e.toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function ge(e){const t=e.map(he),n=t.length-1;return e=>{if(0>=e){const[e,n,o]=t[0];return fe(e,n,o)}if(e>=1){const[e,o,r]=t[n];return fe(e,o,r)}const o=e*n,r=Math.floor(o),i=o-r,[a,s,l]=t[r],[c,d,u]=t[r+1];return fe(Math.round(a+(c-a)*i),Math.round(s+(d-s)*i),Math.round(l+(u-l)*i))}}const ye=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],pe=ge(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),ve=ge(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),me=ge(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),be=ge(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),xe=ge(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),ke=ge(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),we={blues:pe,reds:ve,greens:me,viridis:ge(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),oranges:be,purples:xe,greys:ke,plasma:ge(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),inferno:ge(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),magma:ge(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),cividis:ge(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),turbo:ge(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"])};ge(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),ge(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),ge(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),ge(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),ge(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),ge(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),ge(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]);class Se{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 r;for(let i=0;this.capacity>i;i++){const a=this.particles[i];if(!a.active)continue;const s=n[a.edgeIndex];if(!s||!s.bezier){a.active=!1,this._freeIndices.push(i);continue}const l=o&&null!==(r=o[a.edgeIndex])&&void 0!==r?r:1;a.t+=e*t*l*(s.bezier.circular?.3:1),1>a.t?Ae(s.bezier,a.t,a.offset,a):(a.active=!1,this._freeIndices.push(i))}}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 Ae(e,t,n,o){if(e.circular&&e.segments)return void function(e,t,n,o,r){const i=e.length,a=t*i,s=Math.min(Math.floor(a),i-1),l=a-s,[c,d,u,h]=e[s];Me(c,d,u,h,l,r);const f=h.x-c.x,g=h.y-c.y,y=Math.sqrt(f*f+g*g);if(y>.001){const e=f/y;r.x+=-g/y*n*o*2,r.y+=e*n*o*2}}(e.segments,t,n,e.halfWidth,o);if(!e.points)return o.x=0,void(o.y=0);const[r,i,a,s]=e.points;Me(r,i,a,s,t,o);const l=s.x-r.x,c=s.y-r.y,d=Math.sqrt(l*l+c*c);if(d>.001){const t=l/d;o.x+=-c/d*n*e.halfWidth*2,o.y+=t*n*e.halfWidth*2}}function Me(e,t,n,o,r,i){const a=1-r,s=a*a,l=s*a,c=r*r,d=c*r;i.x=l*e.x+3*s*r*t.x+3*a*c*n.x+d*o.x,i.y=l*e.y+3*s*r*t.y+3*a*c*n.y+d*o.y}function Le(e,t){var n=e.get(t);if(!n)throw Error("missing: "+t);return n}function Oe(e,t){var n,o=[],r=[],i=[],a={},s=[];function l(e){i[e]=!1,a.hasOwnProperty(e)&&Object.keys(a[e]).forEach(function(t){delete a[e][t],i[t]&&l(t)})}function c(e){var t,o,u=!1;for(r.push(e),i[e]=!0,t=0;s[e].length>t;t++)(o=s[e][t])===n?(d(n,r),u=!0):i[o]||(u=c(o));if(u)l(e);else for(t=0;s[e].length>t;t++){var h=a[o=s[e][t]];h||(a[o]=h={}),h[o]=!0}return r.pop(),u}function d(e,t){var n=[].concat(t).concat(e);o.push(n)}function u(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),r=Array(t),i=Array(t),a=Array(t),s=Array(t),l=0;t>l;++l)n[l]=-1,o[l]=0,r[l]=!1,i[l]=0,a[l]=-1,s[l]=[];var c,d=0,u=[],h=[];function f(t){var l=[t],c=[t];for(n[t]=o[t]=d,r[t]=!0,d+=1;c.length>0;){var f=e[t=c[c.length-1]];if(f.length>i[t]){for(var g=i[t];f.length>g;++g){var y=f[g];if(0>n[y]){n[y]=o[y]=d,r[y]=!0,d+=1,l.push(y),c.push(y);break}r[y]&&(o[t]=0|Math.min(o[t],o[y])),0>a[y]||s[t].push(a[y])}i[t]=g}else{if(o[t]===n[t]){var p=[],v=[],m=0;for(g=l.length-1;g>=0;--g){var b=l[g];if(r[b]=!1,p.push(b),v.push(s[b]),m+=s[b].length,a[b]=u.length,b===t){l.length=g;break}}u.push(p);var x=Array(m);for(g=0;v.length>g;g++)for(var k=0;v[g].length>k;k++)x[--m]=v[g][k];h.push(x)}c.pop()}}}for(l=0;t>l;++l)0>n[l]&&f(l);for(l=0;h.length>l;l++){var g=h[l];if(0!==g.length){g.sort(function(e,t){return e-t}),c=[g[0]];for(var y=1;g.length>y;y++)g[y]!==g[y-1]&&c.push(g[y]);h[l]=c}}return{components:u,adjacencyList:h}}(e),r=o.components.filter(function(e){return e.length>1}),i=1/0,a=0;r.length>a;a++)for(var s=0;r[a].length>s;s++)i>r[a][s]&&(i=r[a][s],n=a);var l=r[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:i,adjList:c}}n=0;for(var h=e.length;h>n;){var f=u(n);if(n=f.leastVertex,s=f.adjList){for(var g=0;s.length>g;g++)for(var y=0;s[g].length>y;y++){var p=s[g][y];i[+p]=!1,a[p]={}}c(n),n+=1}else n=h}return o}function De(e){return e.y0-e.y1>0?"up":"down"}function Ee(e,t){return t(e.source)==t(e.target)}function _e(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 Ne(e){return e.target.x0-e.source.x1}function Pe(e,t){var n=Ce(e),o=Ne(t)/Math.tan(n);return"up"==De(e)?e.y1-o:e.y1+o}function Te(e,t){var n=Ce(e),o=Ne(t)/Math.tan(n);return"up"==De(e)?e.y1+o:e.y1-o}function Ce(e){var t=Math.abs(e.y1-e.y0);return Math.atan(Math.abs(e.target.x0-e.source.x1)/t)}function Ie(e,t){return t(e)}function je(e){return $e(e.source)}function We(e){return $e(e.target)}function $e(e){return(e.y0+e.y1)/2}function Be(e){return e.virtual?0:e.value}function Re(e,t){var n=0;e.sourceLinks.forEach(function(e){n=e.circular&&!Ee(e,t)?n+1:n});var o=0;return e.targetLinks.forEach(function(e){o=e.circular&&!Ee(e,t)?o+1:o}),n+o}function ze(e){return e.target.depth}function He(e,t){return e.sourceLinks.length?e.depth:t-1}function Fe(e,t){return e.y0-t.y0}function Ye(e,t){return t.y0-e.y0}function Xe(e,t){return e.y1-t.y1}function Ge(e,t){return t.y1-e.y1}function qe(e,t){return Ke(e.source,t.source)||e.index-t.index}function Ve(e,t){return Ke(e.target,t.target)||e.index-t.index}function Ke(e,t){return e.partOfCycle===t.partOfCycle?e.y0-t.y0:"top"===e.circularLinkType||"bottom"===t.circularLinkType?-1:1}function Qe(e,t){return Ze(e)==Ze(t)?"bottom"==e.circularLinkType?Ye(e,t):Fe(e,t):Ze(t)-Ze(e)}function Ze(e){return e.target.column-e.source.column}function Ue(e,t){return Je(e)==Je(t)}function Je(e){return e.y0-e.y1>0?"up":"down"}function et(e,t,n,o,r){let i=e;var a=Math.max(8,.15*(i.y1-i.y0));i.links.forEach(function(e){e.circular&&(e._circularWidth=Math.min(e.width,a))});var s=v(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}),tt(i.links.filter(function(e){return"top"==e.circularLinkType}),t,n),tt(i.links.filter(function(e){return"bottom"==e.circularLinkType}),t,n),i.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,Ee(e,t)&&_e(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+r+e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius):(e.circularPathData.verticalFullExtent=e.source.y0-r-e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius);else{var a=e.source.column,l=e.circularLinkType,c=i.links.filter(function(e){return e.source.column==a&&e.circularLinkType==l});c.sort("bottom"==e.circularLinkType?Ye:Fe);var d=0;c.forEach(function(t,r){t.circularLinkID==e.circularLinkID&&(e.circularPathData.rightSmallArcRadius=o+e._circularWidth/2+d,e.circularPathData.rightLargeArcRadius=o+e._circularWidth/2+r*n+d),d+=t._circularWidth||t.width}),a=e.target.column,(c=i.links.filter(function(e){return e.target.column==a&&e.circularLinkType==l})).sort("bottom"==e.circularLinkType?Ge:Xe),d=0,c.forEach(function(t,r){t.circularLinkID==e.circularLinkID&&(e.circularPathData.leftSmallArcRadius=o+e._circularWidth/2+d,e.circularPathData.leftLargeArcRadius=o+e._circularWidth/2+r*n+d),d+=t._circularWidth||t.width}),"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=Math.max(i.y1,e.source.y1,e.target.y1)+r+e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius):(e.circularPathData.verticalFullExtent=s-r-e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius)}e.circularPathData.rightInnerExtent=e.circularPathData.sourceX+e.circularPathData.rightNodeBuffer,e.circularPathData.leftInnerExtent=e.circularPathData.targetX-e.circularPathData.leftNodeBuffer,e.circularPathData.rightFullExtent=e.circularPathData.sourceX+e.circularPathData.rightLargeArcRadius+e.circularPathData.rightNodeBuffer,e.circularPathData.leftFullExtent=e.circularPathData.targetX-e.circularPathData.leftLargeArcRadius-e.circularPathData.leftNodeBuffer}e.path=e.circular?function(e){return"top"==e.circularLinkType?"M"+e.circularPathData.sourceX+" "+e.circularPathData.sourceY+" L"+e.circularPathData.rightInnerExtent+" "+e.circularPathData.sourceY+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightSmallArcRadius+" 0 0 0 "+e.circularPathData.rightFullExtent+" "+(e.circularPathData.sourceY-e.circularPathData.rightSmallArcRadius)+" L"+e.circularPathData.rightFullExtent+" "+e.circularPathData.verticalRightInnerExtent+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightLargeArcRadius+" 0 0 0 "+e.circularPathData.rightInnerExtent+" "+e.circularPathData.verticalFullExtent+" L"+e.circularPathData.leftInnerExtent+" "+e.circularPathData.verticalFullExtent+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftLargeArcRadius+" 0 0 0 "+e.circularPathData.leftFullExtent+" "+e.circularPathData.verticalLeftInnerExtent+" L"+e.circularPathData.leftFullExtent+" "+(e.circularPathData.targetY-e.circularPathData.leftSmallArcRadius)+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftSmallArcRadius+" 0 0 0 "+e.circularPathData.leftInnerExtent+" "+e.circularPathData.targetY+" L"+e.circularPathData.targetX+" "+e.circularPathData.targetY:"M"+e.circularPathData.sourceX+" "+e.circularPathData.sourceY+" L"+e.circularPathData.rightInnerExtent+" "+e.circularPathData.sourceY+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightSmallArcRadius+" 0 0 1 "+e.circularPathData.rightFullExtent+" "+(e.circularPathData.sourceY+e.circularPathData.rightSmallArcRadius)+" L"+e.circularPathData.rightFullExtent+" "+e.circularPathData.verticalRightInnerExtent+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightLargeArcRadius+" 0 0 1 "+e.circularPathData.rightInnerExtent+" "+e.circularPathData.verticalFullExtent+" L"+e.circularPathData.leftInnerExtent+" "+e.circularPathData.verticalFullExtent+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftLargeArcRadius+" 0 0 1 "+e.circularPathData.leftFullExtent+" "+e.circularPathData.verticalLeftInnerExtent+" L"+e.circularPathData.leftFullExtent+" "+(e.circularPathData.targetY+e.circularPathData.leftSmallArcRadius)+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftSmallArcRadius+" 0 0 1 "+e.circularPathData.leftInnerExtent+" "+e.circularPathData.targetY+" L"+e.circularPathData.targetX+" "+e.circularPathData.targetY}(e):function(e){var t=e.source.x1,n=e.y0,o=e.target.x0,r=e.y1,i=(t+o)/2;return"M"+t+","+n+"C"+i+","+n+" "+i+","+r+" "+o+","+r}(e)}),i}function tt(e,t,n){e.sort(Qe);var o=e.filter(function(e){return!e._circularStub});return e.forEach(function(e,r){var i=0;if(e._circularStub)e.circularPathData.verticalBuffer=0;else if(Ee(e,t)&&_e(e))e.circularPathData.verticalBuffer=i+e._circularWidth/2;else{for(var a=0;o.length>a;a++){var s=o[a];if(s!==e&&s.circularPathData&&void 0!==s.circularPathData.verticalBuffer&&nt(e,s)){var l=s.circularPathData.verticalBuffer+(s._circularWidth||s.width)/2+n;i=l>i?l:i}}e.circularPathData.verticalBuffer=i+e._circularWidth/2}}),e}function nt(e,t){return e.source.column>=t.target.column&&t.source.column>=e.target.column}function ot(e){return function(){return e}}function rt(e){return e.index}function it(e){return e.nodes}function at(e){return e.links}function st(e,t,n){var o=m(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(r,i){var a=r.length;if(t)r.sort(t);else if(i>0){var s=new Map;r.forEach(function(e,t){var n,o,r,i=(o=0,r=0,(n=e).targetLinks.forEach(function(e){if(!e.circular){var t=e.value||1;r+=$e(e.source)*t,o+=t}}),n.sourceLinks.forEach(function(e){if(!e.circular){var t=e.value||1;r+=$e(e.target)*t,o+=t}}),o>0?r/o:NaN);s.set(e,{bc:i,idx:t})}),r.sort(function(e,t){var n=s.get(e),o=s.get(t),r=n.bc,i=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(r)||isNaN(i)?isNaN(r)?isNaN(i)?n.idx-o.idx:1:-1:r-i})}else r.sort(function(e,t){return e.circularLinkType==t.circularLinkType?Re(t,n)-Re(e,n):"top"==e.circularLinkType&&"bottom"==t.circularLinkType||"top"==e.circularLinkType&&0==t.partOfCycle||0==e.partOfCycle&&"bottom"==t.circularLinkType?-1:0});r.forEach(function(t,r){t.depth==o.length-1&&1==a||0==t.depth&&1==a?(t.y0=e.y1/2-t.value*e.ky,t.y1=t.y0+t.value*e.ky):t.partOfCycle?0==Re(t,n)?(t.y0=e.y1/2+r,t.y1=t.y0+t.value*e.ky):"top"==t.circularLinkType?(t.y0=e.y0+r,t.y1=t.y0+t.value*e.ky):(t.y0=e.y1-t.value*e.ky-r,t.y1=t.y0+t.value*e.ky):0==e.y0||0==e.y1?(t.y0=(e.y1-e.y0)/a*r,t.y1=t.y0+t.value*e.ky):(t.y0=(e.y1-e.y0)/2-a/2+r,t.y1=t.y0+t.value*e.ky)})})}function lt(e,t,n,o,r,i){var a=m(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 s=1,l=i;l>0;--l)c(s*=.99,n),d();function c(t,n){var o=a.length;a.forEach(function(r){var i=r.length,a=r[0].depth;r.forEach(function(r){var s;if(r.sourceLinks.length||r.targetLinks.length)if(r.partOfCycle&&Re(r,n)>0){var l=k(r.sourceLinks,We),c=k(r.targetLinks,je),d=l&&c?(l+c)/2:l||c;if(d){var u=(d-$e(r))*t*.3;r.y0+=u,r.y1+=u}}else if(0==a&&1==i)r.y0=e.y1/2-(s=r.y1-r.y0)/2,r.y1=e.y1/2+s/2;else if(a==o-1&&1==i)r.y0=e.y1/2-(s=r.y1-r.y0)/2,r.y1=e.y1/2+s/2;else if(1==r.targetLinks.length&&1==r.targetLinks[0].source.sourceLinks.length)s=r.y1-r.y0,r.y0=r.targetLinks[0].source.y0,r.y1=r.y0+s;else{var h=k(r.sourceLinks,We),f=k(r.targetLinks,je),g=((h&&f?(h+f)/2:h||f)-$e(r))*t;r.y0+=g,r.y1+=g}})})}function d(){a.forEach(function(n){var i,a,s,l=e.y0,c=n.length;for(n.sort(t||Ke),s=0;c>s;++s)(a=l-(i=n[s]).y0)>0&&(i.y0+=a,i.y1+=a),l=i.y1+o;if((a=l-o-e.y1)>0)for(l=i.y0-=a,i.y1-=a,s=c-2;s>=0;--s)(a=(i=n[s]).y1+r-l)>0&&(i.y0-=a,i.y1-=a),l=i.y0})}}function ct(e){e.nodes.forEach(function(e){e.sourceLinks.sort(Ve),e.targetLinks.sort(qe)}),e.nodes.forEach(function(e){var t=e.y0,n=t,o=e.y1,r=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=r-e.width/2,r-=e.width):(e.y1=n+e.width/2,n+=e.width)})})}function dt(){var e=0,t=0,n=1,o=1,r=24,i=8,a=null,s=rt,l=He,c=void 0,d=32,u=2,h=it,f=at;function g(){var g={nodes:h.apply(null,arguments),links:f.apply(null,arguments)};return function(h){h.x0=e,h.y0=t,h.x1=n,h.y1=o,h.py=0,function(e,t){e.nodes.forEach(function(e,t){e.index=t,e.sourceLinks=[],e.targetLinks=[]});var n=function(e,t){var n=new Map;return w(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,r=e.target;"object"!=typeof o&&(o=e.source=Le(n,o)),"object"!=typeof r&&(r=e.target=Le(n,r)),o.sourceLinks.push(e),r.targetLinks.push(e)})}(h,s),function(e,t){var n=0;if(null==t){for(var o=[],r=0;e.links.length>r;r++){var i=e.links[r],a=i.source.index,s=i.target.index;o[a]||(o[a]=[]),o[s]||(o[s]=[]),-1===o[a].indexOf(s)&&o[a].push(s)}var l=Oe(o);l.sort(function(e,t){return e.length-t.length});var c={};for(r=0;l.length>r;r++){var d=l[r].slice(-2);c[d[0]]||(c[d[0]]={}),c[d[0]][d[1]]=!0}e.links.forEach(function(e){var t=e.target.index,o=e.source.index;t===o||c[o]&&c[o][t]?(e.circular=!0,e.circularLinkID=n++):e.circular=!1})}else e.links.forEach(function(e){t(e.source)<t(e.target)?e.circular=!1:(e.circular=!0,e.circularLinkID=n++)})}(h,c),function(e,t){var n=0,o=0;e.links.forEach(function(r){r.circular&&(r.circularLinkType=r.source.circularLinkType||r.target.circularLinkType?r.source.circularLinkType?r.source.circularLinkType:r.target.circularLinkType:o>n?"top":"bottom","top"==r.circularLinkType?n++:o++,e.nodes.forEach(function(e){Ie(e,t)!=Ie(r.source,t)&&Ie(e,t)!=Ie(r.target,t)||(e.circularLinkType=r.circularLinkType)}))}),e.links.forEach(function(e){e.circular&&(e.source.circularLinkType==e.target.circularLinkType&&(e.circularLinkType=e.source.circularLinkType),Ee(e,t)&&(e.circularLinkType=e.source.circularLinkType))})}(h,s),function(e){e.nodes.forEach(function(e){e.partOfCycle=!1,e.value=Math.max(x(e.sourceLinks,Be),x(e.targetLinks,Be)),e.sourceLinks.forEach(function(t){t.circular&&(e.partOfCycle=!0,e.circularLinkType=t.circularLinkType)}),e.targetLinks.forEach(function(t){t.circular&&(e.partOfCycle=!0,e.circularLinkType=t.circularLinkType)})})}(h),function(e,t,n){var o,r,i;if(null!=t){e.nodes.sort(function(e,n){return t(e)<t(n)?-1:1});var a=0,s=t(e.nodes[0]);e.nodes.forEach(function(e){a=t(e)==s?a:a+1,s=t(e)==s?s:t(e),e.column=a})}for(o=e.nodes,r=[],i=0;o.length;++i,o=r,r=[])o.forEach(function(e){e.depth=i,e.sourceLinks.forEach(function(e){0>r.indexOf(e.target)&&!e.circular&&r.push(e.target)})});for(o=e.nodes,r=[],i=0;o.length;++i,o=r,r=[])o.forEach(function(e){e.height=i,e.targetLinks.forEach(function(e){0>r.indexOf(e.source)&&!e.circular&&r.push(e.source)})});e.nodes.forEach(function(e){e.column=null==t?n(e,i):e.column})}(h,c,l);var f=i;if(null!==a){var g=m(h.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]}),y=b(g,function(e){return e.length});y>1&&(f=Math.max(1,(o-t)*a/(y-1)))}(function(e,t,n){var o=m(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});e.py=t;var r=v(o,function(t){return(e.y1-e.y0-(t.length-1)*e.py)/x(t,function(e){return e.value})});e.ky=r,e.links.forEach(function(t){t.width=t.value*e.ky});var i=b(e.nodes,function(e){return e.column});e.nodes.forEach(i>0?function(t){t.x0=e.x0+t.column*((e.x1-e.x0-n)/i),t.x1=t.x0+n}:function(t){t.x0=e.x0,t.x1=t.x0+n})})(h,f,r),st(h,c,s),lt(h,c,s,f,f,d),ct(h),et(h,s,u,10,8),st(h,c,s),lt(h,c,s,f,f,d),ct(h),et(h,s,u,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 Ie(n.source,t)==Ie(e,t)}),r=o.length;r>1&&o.sort(function(e,t){if(!e.circular&&!t.circular){if(e.target.column==t.target.column)return e.y1-t.y1;if(!Ue(e,t))return e.y1-t.y1;if(e.target.column>t.target.column){var n=Pe(t,e);return e.y1-n}if(t.target.column>e.target.column)return Pe(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;o.forEach(function(e){e.y0=i+e.width/2,i+=e.width}),o.forEach(function(t,n){if("bottom"==t.circularLinkType){for(var i=n+1,a=0;r>i;i++)a+=o[i].width;t.y0=e.y1-a-t.width/2}})})}(h,s),function(e,t){let n=e;n.nodes.forEach(function(e){var o=n.links.filter(function(n){return Ie(n.target,t)==Ie(e,t)}),r=o.length;r>1&&o.sort(function(e,t){if(!e.circular&&!t.circular){if(e.source.column==t.source.column)return e.y0-t.y0;if(!Ue(e,t))return e.y0-t.y0;if(e.source.column>t.source.column){var n=Te(t,e);return e.y0-n}if(t.source.column>e.source.column)return Te(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;o.forEach(function(e){e.y1=i+e.width/2,i+=e.width}),o.forEach(function(t,n){if("bottom"==t.circularLinkType){for(var i=n+1,a=0;r>i;i++)a+=o[i].width;t.y1=e.y1-a-t.width/2}})})}(h,s),function(e){var t=e.nodes,n=e.links,o=!1,r=!1;if(n.forEach(function(e){"top"==e.circularLinkType?o=!0:"bottom"==e.circularLinkType&&(r=!0)}),0==o||0==r){var i=v(t,function(e){return e.y0}),a=b(t,function(e){return e.y1}),s=(e.y1-e.y0)/(a-i);function l(t){return(t-i)/(a-i)*(e.y1-e.y0)+e.y0}1>s?(t.forEach(function(e){e.y0=l(e.y0),e.y1=l(e.y1)}),n.forEach(function(e){e.y0=l(e.y0),e.y1=l(e.y1),e.width=e.width*s})):t.forEach(function(e){var t=e.y1-e.y0,n=l(e.y0)-e.y0;e.y0=l(e.y0),e.y1=e.y0+t,e.sourceLinks.forEach(function(e){e.y0=e.y0+n}),e.targetLinks.forEach(function(e){e.y1=e.y1+n})})}}(h),et(h,s,u,10,8)}(g),g}return g.update=function(e){return ct(e),et(e,s,u,10,8),e},g.nodeWidth=function(e){return arguments.length?(r=+e,g):r},g.nodePadding=function(e){return arguments.length?(i=+e,g):i},g.nodePaddingRatio=function(e){return arguments.length?(a=+e,g):a},g.nodes=function(e){return arguments.length?(h="function"==typeof e?e:ot(e),g):h},g.links=function(e){return arguments.length?(f="function"==typeof e?e:ot(e),g):f},g.nodeId=function(e){return arguments.length?(s="function"==typeof e?e:ot(e),g):s},g.nodeAlign=function(e){return arguments.length?(l="function"==typeof e?e:ot(e),g):l},g.nodeSort=function(e){return arguments.length?(c=e,g):c},g.iterations=function(e){return arguments.length?(d=+e,g):d},g.circularLinkGap=function(e){return arguments.length?(u=+e,g):u},g.extent=function(r){return arguments.length?(e=+r[0][0],t=+r[0][1],n=+r[1][0],o=+r[1][1],g):[[e,t],[n,o]]},g.size=function(r){return arguments.length?(e=t=0,n=+r[0],o=+r[1],g):[n-e,o-t]},g}function ut(e){const{sx:t,sTop:n,sBot:o,tx:r,tTop:i,tBot:a,cp1X:s,cp2X:l}=e,c=(n+o)/2,d=(i+a)/2;return{pathD:[`M${t},${n}`,`C${s},${n} ${l},${i} ${r},${i}`,`L${r},${a}`,`C${l},${a} ${s},${o} ${t},${o}`,"Z"].join(" "),bezier:{circular:!1,points:[{x:t,y:c},{x:s,y:c},{x:l,y:d},{x:r,y:d}],halfWidth:(o-n)/2}}}const ht=e=>{let t,n,o,r,i,a,s,l,c;if("down"===e.direction)return t=e.y0-e.sankeyWidth/2,n=e.y1-e.sankeyWidth/2,o=e.y1+e.sankeyWidth/2,r=e.y0+e.sankeyWidth/2,i=e.source.x1,a=e.target.x0,s=p(i,a),l=s(.5),c=s(.5),`M${t},${i}C${t},${l} ${n},${c} ${n},${a}L${o},${a}C${o},${c} ${r},${l} ${r},${i}Z`;const d=e.sankeyWidth/2,u=p(e.source.x1,e.target.x0),{pathD:h}=ut({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:u(.5),cp2X:u(.5)});return h};function ft(e){var t;const n=e.sankeyWidth/2,o=(null!==(t=e._circularWidth)&&void 0!==t?t:e.sankeyWidth)/2,r=e.circularPathData;if(!r)return null;if("down"===e.direction)return null;if(e._circularStub){const t=r.sourceX,o=r.sourceY,i=r.targetX,a=r.targetY;if("object"!=typeof e.source||!e.source||"object"!=typeof e.target||!e.target)return null;const s=Math.max(15,Math.min(40,.33*(r.rightFullExtent-t))),l=Math.max(15,Math.min(40,.33*(i-r.leftFullExtent)));return`M${t},${o-n}L${t+s},${o-n}L${t+s},${o+n}L${t},${o+n}ZM${i},${a-n}L${i-l},${a-n}L${i-l},${a+n}L${i},${a+n}Z`}const i=r.sourceX,a=r.sourceY,s=r.targetX,l=r.targetY,c=r.rightFullExtent,d=r.leftFullExtent,u=r.verticalFullExtent,h="bottom"===e.circularLinkType?1:-1,f=Math.max(4,Math.min(o,15));return`M${i},${a-h*n}L${c},${a-h*n}L${c+o},${a-h*n+h*f}L${c+o},${u+h*o-h*f}L${c+o-f},${u+h*o}L${d-o+f},${u+h*o}L${d-o},${u+h*o-h*f}L${d-o},${l-h*n+h*f}L${d-o+f},${l-h*n}L${s},${l-h*n}L${s},${l+h*n}L${d+o},${l+h*n}L${d+o},${u-h*o}L${c-o},${u-h*o}L${c-o},${a+h*n}L${i},${a+h*n}Z`}const gt=new Set,yt=new WeakMap;function pt(e,t){if("production"===process.env.NODE_ENV)return e;if(!e||!e.data||"object"!=typeof e.data)return e;let n=yt.get(e);if(n){const e=n.get(t);if(e)return e}else n=new Map,yt.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}`;gt.has(e)||(gt.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 vt={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(ze))-1:0},justify:He};function mt(e){return"string"==typeof e?e:e.id}const bt={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,n,o){var r,i,a,s,l,c,d;if(0===e.length)return;const u="vertical"===n.orientation?"down":"right",h=n.nodeAlign||"justify",f=null!==(r=n.nodeWidth)&&void 0!==r?r:15,g=null!==(i=n.nodePaddingRatio)&&void 0!==i?i:.05,y=null!==(a=n.iterations)&&void 0!==a?a:100,p=e.map(e=>Object.assign({},e)),v=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 m;m="down"===u?[[0,0],[o[1],o[0]]]:[[0,0],[o[0],o[1]]];const b=dt().extent(m).links(v).nodes(p).nodeAlign(vt[h]||He).nodeId(e=>e.id).nodeWidth(f).iterations(y);b.nodePaddingRatio&&b.nodePaddingRatio(g),b();{let e=1/0,t=-1/0,n=1/0,r=-1/0;for(const o of p)e>o.x0&&(e=o.x0),o.x1>t&&(t=o.x1),n>o.y0&&(n=o.y0),o.y1>r&&(r=o.y1);for(const o of v){if(!o.circular||!o.circularPathData)continue;const i=o.circularPathData,a=(null!==(l=null!==(s=o._circularWidth)&&void 0!==s?s:o.width)&&void 0!==l?l:0)/2;e>i.leftFullExtent-a&&(e=i.leftFullExtent-a),i.rightFullExtent+a>t&&(t=i.rightFullExtent+a),n>i.verticalFullExtent-a&&(n=i.verticalFullExtent-a),i.verticalFullExtent+a>r&&(r=i.verticalFullExtent+a)}const i=t-e,a=r-n,d=o[0],u=o[1];if(i>0&&a>0&&(0>e||0>n||t>d||r>u)){const t=Math.min(d/i,u/a),o=-e*t+(d-i*t)/2,r=-n*t+(u-a*t)/2;for(const e of p)e.x0=e.x0*t+o,e.x1=e.x1*t+o,e.y0=e.y0*t+r,e.y1=e.y1*t+r;for(const e of v)if(e.y0=e.y0*t+r,e.y1=e.y1*t+r,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+r,n.targetY=n.targetY*t+r,n.rightFullExtent=n.rightFullExtent*t+o,n.leftFullExtent=n.leftFullExtent*t+o,n.verticalFullExtent=n.verticalFullExtent*t+r,n.rightInnerExtent=n.rightInnerExtent*t+o,n.leftInnerExtent=n.leftInnerExtent*t+o,n.verticalRightInnerExtent=n.verticalRightInnerExtent*t+r,n.verticalLeftInnerExtent=n.verticalLeftInnerExtent*t+r,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 p){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 v){const t=mt(e.source),n=mt(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!==(d=e.width)&&void 0!==d?d: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=u;const r=x.get(t),i=x.get(n);r&&(o.source=r),i&&(o.target=i)}}},buildScene(e,t,n,o){var r,i,a,s,l,c;const d="vertical"===n.orientation?"down":"right",u=n.nodeStyle,h=n.edgeStyle,f=null!==(r=n.edgeOpacity)&&void 0!==r?r:.5,g=n.edgeColorBy||"source",y=Array.isArray(n.colorScheme)?n.colorScheme:n.themeCategorical&&n.themeCategorical.length>0?n.themeCategorical:ye,p=new Map;e.forEach((e,t)=>{p.set(e.id,y[t%y.length])});const v=[],m=[],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=u?u(pt(t,"nodeStyle")):{},r={fill:o.fill||p.get(t.id)||"#4d430c",stroke:o.stroke,strokeWidth:o.strokeWidth,opacity:o.opacity};x.set(t.id,("string"==typeof r.fill?r.fill:null)||p.get(t.id)||"#4d430c"),v.push("down"===d?{type:"rect",x:t.y0,y:t.x0,w:n,h:e,style:r,datum:t,id:t.id,label:t.id}:{type:"rect",x:t.x0,y:t.y0,w:e,h:n,style:r,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 r=(null===(i=n.themeSemantic)||void 0===i?void 0:i.border)||(null===(a=n.themeSemantic)||void 0===a?void 0:a.secondary)||"#999";r="function"==typeof g?g(e)||r:"target"===g?x.get(o.id)||p.get(o.id)||r:x.get(t.id)||p.get(t.id)||r;const d=h?h(pt(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))),i=Math.max(15,Math.min(40,.33*(t.targetX-t.leftFullExtent))),a=d.fill||r;m.push({type:"bezier",pathD:`M${t.sourceX},${t.sourceY-n}L${t.sourceX+o},${t.sourceY-n}L${t.sourceX+o},${t.sourceY+n}L${t.sourceX},${t.sourceY+n}Z`,style:{fill:a,fillOpacity:null!==(s=d.fillOpacity)&&void 0!==s?s:f,stroke:"none",opacity:d.opacity},datum:e,_gradient:{direction:"right",from:1,to:0,x0:t.sourceX,x1:t.sourceX+o}}),m.push({type:"bezier",pathD:`M${t.targetX},${t.targetY-n}L${t.targetX-i},${t.targetY-n}L${t.targetX-i},${t.targetY+n}L${t.targetX},${t.targetY+n}Z`,style:{fill:a,fillOpacity:null!==(l=d.fillOpacity)&&void 0!==l?l:f,stroke:"none",opacity:d.opacity},datum:e,_gradient:{direction:"left",from:0,to:1,x0:t.targetX-i,x1:t.targetX}});continue}let u;if(u=e.circular&&e.circularPathData?ft(e):ht(e),!u)continue;const y={fill:d.fill||r,fillOpacity:null!==(c=d.fillOpacity)&&void 0!==c?c:f,stroke:d.stroke||"none",strokeWidth:d.strokeWidth,opacity:d.opacity};m.push({type:"bezier",pathD:u,bezierCache:e.bezier,style:y,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,r=n.y1-n.y0;if(0>=e||0>=r)continue;const i=t?t(n):n.id;if(!i)continue;let a,s,l;"down"===d?(a=n.y0+(n.y1-n.y0)/2,s=n.x1+14,l="start"):(o[0]/2>n.x0+e/2?(a=n.x0-6,l="end"):(a=n.x1+6,l="start"),s=n.y0+r/2),b.push({x:a,y:s,text:i+"",anchor:"down"===d?"middle":l,baseline:"middle",fontSize:11})}}var w;return{sceneNodes:v,sceneEdges:m,labels:b}}},xt={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,n,o){var r,i;if(0===e.length)return;const a=null!==(r=n.forceStrength)&&void 0!==r?r:.1,s=o[0]/2,l=o[1]/2,c=n.__previousPositions;let d=0;const u=[];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?d++:n?(t.x=n.x,t.y=n.y,d++):u.push(t)}const h=d>0&&.3>=(e.length>0?u.length/e.length:1);if(h){const n=new Map;for(const t of e)n.set(t.id,t);for(const e of u){const o=kt(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 r=wt(e.id),i=r%360*(Math.PI/180),a=10+r%20;e.x=t/o.length+a*Math.cos(i),e.y=n/o.length+a*Math.sin(i)}else{const t=wt(e.id),n=t%360*(Math.PI/180),o=15+t%30;e.x=s+o*Math.cos(n),e.y=l+o*Math.sin(n)}}}else{const t=2.399963229728653;for(let n=0;e.length>n;n++){const o=e[n];if(null==o.x||null==o.y||0===o.x&&0===o.y){const e=10*Math.sqrt(n+.5),r=n*t;o.x=s+e*Math.cos(r),o.y=l+e*Math.sin(r)}}}const f=null!==(i=n.iterations)&&void 0!==i?i:Math.max(50,Math.min(300,Math.floor(300-2*(e.length-30)))),g=0===n.iterations?0:h?40:f,y=St(n.nodeSize,n.nodeSizeRange,e),p=e=>y(e);if(g>0){const n=S().strength(e=>{const t=e.weight;return Math.min(2.5,t?t*a:a)}).id(e=>e.id),o=A().force("charge",M().strength(e=>-25*p(e))).force("center",L(s,l).strength(.8)).force("x",O(s).strength(.15)).force("y",D(l).strength(.15));if(o.nodes(e),t.length>0){const e=t.map(e=>Object.assign(Object.assign({},e),{source:"string"==typeof e.source?e.source:e.source.id,target:"string"==typeof e.target?e.target:e.target.id}));n.links(e),o.force("link",n)}h?o.alpha(.3):.1>o.alpha()&&o.alpha(1),o.stop();for(let e=0;g>e;++e)o.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(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 r,i,a,s,l,c,d;const u=n.nodeStyle,h=n.edgeStyle,f=St(n.nodeSize,n.nodeSizeRange,e),g=Array.isArray(n.colorScheme)?n.colorScheme:n.themeCategorical&&n.themeCategorical.length>0?n.themeCategorical:ye,y=new Map;e.forEach((e,t)=>{y.set(e.id,g[t%g.length])});const p=[],v=[],m=[];for(const t of e){if(null==t.x||null==t.y)continue;const e=f(pt(t,"nodeSize")),o=u?u(pt(t,"nodeStyle")):{},s={fill:o.fill||y.get(t.id)||(null===(r=n.themeSemantic)||void 0===r?void 0:r.primary)||"#007bff",stroke:o.stroke||(null===(i=n.themeSemantic)||void 0===i?void 0:i.surface)||"#fff",strokeWidth:null!==(a=o.strokeWidth)&&void 0!==a?a:2,opacity:o.opacity};p.push({type:"circle",cx:t.x,cy:t.y,r:e,style:s,datum:t,id:t.id,label:t.id})}const b=new Map;for(const t of e)b.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:b.get(e.source),o="object"==typeof e.target?e.target:b.get(e.target);if(!t||!o)continue;if(null==t.x||null==t.y)continue;if(null==o.x||null==o.y)continue;const r=h?h(pt(e,"edgeStyle")):{},i={stroke:r.stroke||(null===(s=n.themeSemantic)||void 0===s?void 0:s.border)||(null===(l=n.themeSemantic)||void 0===l?void 0:l.secondary)||"#999",strokeWidth:null!==(c=r.strokeWidth)&&void 0!==c?c:1,opacity:null!==(d=r.opacity)&&void 0!==d?d:.6};v.push({type:"line",x1:t.x,y1:t.y,x2:o.x,y2:o.y,style:i,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=f(pt(n,"nodeSize"));m.push({x:n.x,y:n.y-o-4,text:e+"",anchor:"middle",baseline:"auto",fontSize:11})}}var x;return{sceneNodes:p,sceneEdges:v,labels:m}}};function kt(e,t,n){const o=[];for(const r of t){const t="string"==typeof r.source?r.source:r.source.id,i="string"==typeof r.target?r.target:r.target.id;let a=null;if(t===e?a=i:i===e&&(a=t),a){const e=n.get(a);!e||0===e.x&&0===e.y||o.push({x:e.x,y:e.y})}}return o}function wt(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 St(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],i=[];for(const t of n){const n=null===(o=t.data)||void 0===o?void 0:o[e];"number"==typeof n&&i.push(n)}if(0===i.length)return()=>r[0];const[a,s]=function(e){let t=1/0,n=-1/0;for(const o of e)t>o&&(t=o),o>n&&(n=o);return[t,n]}(i);if(a===s)return()=>(r[0]+r[1])/2;const l=E().domain([a,s]).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]:l(o)}}const At=ye,Mt={supportsStreaming:!1,hierarchical:!1,computeLayout(e,t,n,o){if(0===e.length)return;const{padAngle:r=.01,groupWidth:i=20,sortGroups:a}=n,s=Math.min(o[0],o[1])/2,l=s-i,c=o[0]/2,d=o[1]/2,u=(h=n.valueAccessor)?"function"==typeof h?h:e=>{var t;return null!==(t=e[h])&&void 0!==t?t:1}:e=>{var t;return null!==(t=e.value)&&void 0!==t?t:1};var h;const f=new Map;for(let t=0;e.length>t;t++)f.set(e[t].id,t);const g=e.length,y=Array.from({length:g},()=>Array.from({length:g},()=>0));for(const e of t){const t="string"==typeof e.target?e.target:e.target.id,n=f.get("string"==typeof e.source?e.source:e.source.id),o=f.get(t);if(void 0===n||void 0===o)continue;const r=u(e);y[n][o]=r}const p=T().padAngle(r);a&&p.sortGroups(a);const v=p(y),m=v.groups,b=C().innerRadius(l).outerRadius(s);for(const t of m){const n=e[t.index],o=b.centroid({innerRadius:l,outerRadius:s,startAngle:t.startAngle,endAngle:t.endAngle});n.x=o[0]+c,n.y=o[1]+d,n.__arcData={startAngle:t.startAngle,endAngle:t.endAngle}}const x=new Map;for(const t of e)x.set(t.id,t);for(const e of t){const t="string"==typeof e.target?e.target:e.target.id,n=x.get("string"==typeof e.source?e.source:e.source.id),o=x.get(t);n&&(e.source=n),o&&(e.target=o)}const k=new Map;for(const e of t)k.set(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,e);for(const t of v){const n=e[t.source.index].id,o=e[t.target.index].id,r=k.get(`${n}\0${o}`)||k.get(`${o}\0${n}`);r&&(r.__chordData=t)}},buildScene(e,t,n,o){var r,i,a,s;const{groupWidth:l=20,edgeOpacity:c=.5}=n,d=Math.min(o[0],o[1])/2,u=d-l,h=o[0]/2,f=o[1]/2,g=n.nodeStyle,y=n.edgeStyle,p=n.edgeColorBy||"source",v=Array.isArray(n.colorScheme)?n.colorScheme:n.themeCategorical&&n.themeCategorical.length>0?n.themeCategorical:At,m=new Map;e.forEach((e,t)=>{m.set(e.id,v[t%v.length])});const b=P().radius(u),x=[],k=[],w=[];for(let t=0;e.length>t;t++){const n=e[t],o=n.__arcData;if(!o)continue;let i;i=g?g(pt(n,"nodeStyle")).fill||m.get(n.id)||v[t%v.length]:m.get(n.id)||v[t%v.length];const a=g?g(pt(n,"nodeStyle")):{},s={fill:i,stroke:a.stroke||"black",strokeWidth:null!==(r=a.strokeWidth)&&void 0!==r?r:1,opacity:a.opacity};x.push({type:"arc",cx:h,cy:f,innerR:u,outerR:d,startAngle:o.startAngle-Math.PI/2,endAngle:o.endAngle-Math.PI/2,style:s,datum:n,id:n.id,label:n.id})}for(const e of t){const t=e.__chordData;if(!t)continue;const o=b(t);if(!o)continue;const r=Lt(o,h,f);let l=(null===(i=n.themeSemantic)||void 0===i?void 0:i.border)||(null===(a=n.themeSemantic)||void 0===a?void 0:a.secondary)||"#999";if(y)l=y(pt(e,"edgeStyle")).fill||l;else{const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;"target"===p&&n?l=m.get(n.id)||l:t&&(l=m.get(t.id)||l)}const d=y?y(pt(e,"edgeStyle")):{},u={fill:l,fillOpacity:null!==(s=d.fillOpacity)&&void 0!==s?s:c,stroke:d.stroke||"none",strokeWidth:d.strokeWidth,opacity:d.opacity};k.push({type:"ribbon",pathD:r,style:u,datum:e})}if(!1!==n.showLabels){const t=(S=n.nodeLabel)?"function"==typeof S?S:e=>e[S]||e.id:null,o=d+12;for(const n of e){const e=n.__arcData;if(!e)continue;const r=t?t(n):n.id;if(!r)continue;const i=(e.startAngle+e.endAngle)/2,a=i-Math.PI/2;w.push({x:h+Math.cos(a)*o,y:f+Math.sin(a)*o,text:r+"",anchor:i>Math.PI?"end":"start",baseline:"middle",fontSize:11})}}var S;return{sceneNodes:x,sceneEdges:k,labels:w}}};function Lt(e,t,n){const o=e.match(/[a-zA-Z]|[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?/g);if(!o)return e;const r=[];let i=0;for(;o.length>i;){const e=o[i];if("M"===e||"L"===e)for(r.push(e),i++;o.length>i&&!isNaN(Number(o[i]));)r.push(Number(o[i])+t+""),i++,o.length>i&&!isNaN(Number(o[i]))&&(r.push(Number(o[i])+n+""),i++);else if("C"===e)for(r.push(e),i++;o.length>i&&!isNaN(Number(o[i]));)for(let e=0;3>e&&o.length>i&&!isNaN(Number(o[i]));e++)r.push(Number(o[i])+t+""),i++,o.length>i&&!isNaN(Number(o[i]))&&(r.push(Number(o[i])+n+""),i++);else if("Q"===e)for(r.push(e),i++;o.length>i&&!isNaN(Number(o[i]));)for(let e=0;2>e&&o.length>i&&!isNaN(Number(o[i]));e++)r.push(Number(o[i])+t+""),i++,o.length>i&&!isNaN(Number(o[i]))&&(r.push(Number(o[i])+n+""),i++);else if("A"===e)for(r.push(e),i++;o.length>i&&!isNaN(Number(o[i]));)r.push(o[i++]),o.length>i&&r.push(o[i++]),o.length>i&&r.push(o[i++]),o.length>i&&r.push(o[i++]),o.length>i&&r.push(o[i++]),o.length>i&&(r.push(Number(o[i])+t+""),i++),o.length>i&&(r.push(Number(o[i])+n+""),i++);else"Z"===e||"z"===e?(r.push(e),i++):(r.push(o[i]),i++)}return r.join(" ")}const Ot=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];function Dt(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 Et(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 _t(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 Nt(e){return Array.isArray(e.colorScheme)?e.colorScheme:e.themeCategorical&&e.themeCategorical.length>0?e.themeCategorical:Ot}function Pt(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 Tt(e,t,n,o,r){if("horizontal"===r){const r=(e+n)/2;return`M ${e},${t} C ${r},${t} ${r},${o} ${n},${o}`}if("radial"===r){const r=(e+n)/2;return`M ${e},${t} Q ${r},${t} ${r},${(t+o)/2} T ${n},${o}`}{const r=(t+o)/2;return`M ${e},${t} C ${e},${r} ${n},${r} ${n},${o}`}}const Ct={supportsStreaming:!1,hierarchical:!0,computeLayout(e,t,n,o){var r;const i=n.__hierarchyRoot;if(!i)return;const a=n.chartType,s=function(e){if(e)return"function"==typeof e?e:t=>t[e]}(n.childrenAccessor),l=n.hierarchySum,c="function"==typeof l?l:"string"==typeof l?e=>Number(e[l])||0:e=>Number(e.value)||0,d=Y(i,s);d.sum(c),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[u,h]=o;switch(a){case"tree":!function(e,t,n,o){const r=t.treeOrientation||"vertical",i=Q();i.size("horizontal"===r?[o,n]:"radial"===r?[2*Math.PI,Math.min(n,o)/2*.8]:[n,o]),i(e)}(d,n,u,h);break;case"cluster":!function(e,t,n,o){const r=t.treeOrientation||"vertical",i=K();i.size("horizontal"===r?[o,n]:"radial"===r?[2*Math.PI,Math.min(n,o)/2*.8]:[n,o]),i(e)}(d,n,u,h);break;case"treemap":!function(e,t,n,o){var r,i;const a=null!==(r=t.padding)&&void 0!==r?r:4,s=null!==(i=t.paddingTop)&&void 0!==i?i:0,l=q().size([n,o]).tile(V).padding(a);s>0&&l.paddingTop(s),l(e)}(d,n,u,h);break;case"circlepack":!function(e,t,n,o){var r;const i=null!==(r=t.padding)&&void 0!==r?r:4;G().size([n,o]).padding(i)(e)}(d,n,u,h);break;case"partition":!function(e,t,n,o){var r;X().size([n,o]).padding(null!==(r=t.padding)&&void 0!==r?r:1)(e)}(d,n,u,h)}const f=d.descendants();e.length=0,t.length=0;const g=new Map;for(let t=0;f.length>t;t++){const o=f[t],i={id:Et(o,n,t),x:0,y:0,x0:0,x1:0,y0:0,y1:0,width:0,height:0,value:null!==(r=o.value)&&void 0!==r?r:0,depth:o.depth,data:o.data,createdByFrame:!0};"tree"===a||"cluster"===a?It(i,o,n):"treemap"===a||"partition"===a?jt(i,o):"circlepack"===a&&Wt(i,o),i.__hierarchyNode=o,e.push(i),g.set(o,i)}if("tree"===a||"cluster"===a)for(const e of f)if(e.parent){const n=g.get(e.parent),o=g.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 r=n.nodeStyle||(()=>({})),i=n.edgeStyle||(()=>({}));switch(n.chartType){case"tree":case"cluster":return function(e,t,n,o,r,i){var a,s,l,c,d,u,h,f;const g=[],y=[],p=[],v=n.treeOrientation||"vertical",m="radial"===v,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;m&&(e+=b,o+=x);const i=r(pt(t,"nodeStyle"));let l=i.fill||Pt(n);if(n.colorByDepth&&void 0!==t.depth){const e=Nt(n);l=e[t.depth%e.length]}const c={fill:l,stroke:i.stroke||(null===(a=n.themeSemantic)||void 0===a?void 0:a.surface)||"#fff",strokeWidth:null!==(s=i.strokeWidth)&&void 0!==s?s:1,opacity:i.opacity};g.push({type:"circle",cx:e,cy:o,r:k,style:c,datum:t,id:t.id,label:t.id,depth:t.depth})}const S=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 r=t.x,a=t.y,s=o.x,l=o.y;m&&(r+=b,a+=x,s+=b,l+=x);const f=Tt(r,a,s,l,v),g=i(pt(e,"edgeStyle")),p={fill:"none",stroke:g.stroke||(null===(c=n.themeSemantic)||void 0===c?void 0:c.border)||(null===(d=n.themeSemantic)||void 0===d?void 0:d.secondary)||"#999",strokeWidth:null!==(u=g.strokeWidth)&&void 0!==u?u:1.5,opacity:null!==(h=g.opacity)&&void 0!==h?h:S};y.push({type:"curved",pathD:f,style:p,datum:e})}if(!1!==n.showLabels){const t=_t(n.nodeLabel);for(const n of e){const e=t?t(n):n.id;if(!e)continue;let o,r,i,a=n.x,s=n.y;if(m&&(a+=b,s+=x),m){const e=a-b,t=s-x,n=Math.sqrt(e*e+t*t);n>0?(o=a+e/n*10,r=s+t/n*10,i=0>e?"end":"start"):(o=a,r=s-12,i="middle")}else"horizontal"===v?((null===(f=n.data)||void 0===f?void 0:f.children)&&0!==n.data.children.length?(o=a-k-6,i="end"):(o=a+k+6,i="start"),r=s):(o=a,r=s+k+14,i="middle");p.push({x:o,y:r,text:e+"",anchor:i,baseline:"middle",fontSize:11})}}return{sceneNodes:g,sceneEdges:y,labels:p}}(e,t,n,o,r,i);case"treemap":case"partition":return function(e,t,n,o){var r,i,a,s,l;const c=[],d=[];for(const n of e){const e=n.x1-n.x0,a=n.y1-n.y0;if(0>=e||0>=a)continue;const s=o(pt(n,"nodeStyle"));let l=s.fill||Pt(t);if(t.colorByDepth&&void 0!==n.depth){const e=Nt(t);l=e[n.depth%e.length]}const d={fill:l,stroke:s.stroke||(null===(r=t.themeSemantic)||void 0===r?void 0:r.surface)||"#fff",strokeWidth:null!==(i=s.strokeWidth)&&void 0!==i?i:1,opacity:s.opacity};c.push({type:"rect",x:n.x0,y:n.y0,w:e,h:a,style:d,datum:n,id:n.id,label:n.id,depth:n.depth})}if(!1!==t.showLabels){const n=_t(t.nodeLabel),r=t.labelMode||"leaf",i="partition"===t.chartType;for(const c of e){const e=c.x1-c.x0,u=c.y1-c.y0;if(0>=e||0>=u)continue;const h=!((null===(a=c.data)||void 0===a?void 0:a.children)&&c.data.children.length>0);if(!i){if("leaf"===r&&!h)continue;if("parent"===r&&h)continue}const f=n?n(c):c.id;if(!f)continue;if((h?30:40)>e||(h?16:14)>u)continue;let g=o(pt(c,"nodeStyle")).fill||Pt(t);if(t.colorByDepth&&void 0!==c.depth){const e=Nt(t);g=e[c.depth%e.length]}const y="string"==typeof g?Dt(g):null!==(l=null===(s=t.themeSemantic)||void 0===s?void 0:s.text)&&void 0!==l?l:"#000";d.push(h?{x:c.x0+e/2,y:c.y0+u/2,text:f+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,Math.min(e,u)/6)),fill:y}:{x:c.x0+4,y:c.y0+12,text:f+"",anchor:"start",baseline:"auto",fontSize:11,fontWeight:600,fill:y})}}return{sceneNodes:c,sceneEdges:[],labels:d}}(e,n,0,r);case"circlepack":return function(e,t,n,o){var r,i,a,s,l,c,d,u,h,f;const g=[],y=[];for(const n of e){const e=null!==(r=n.__radius)&&void 0!==r?r:5;if(0>=e)continue;const l=o(pt(n,"nodeStyle"));let c=l.fill||Pt(t);if(t.colorByDepth&&void 0!==n.depth){const e=Nt(t);c=e[n.depth%e.length]}const d={fill:c,stroke:l.stroke||(null===(i=t.themeSemantic)||void 0===i?void 0:i.surface)||"#fff",strokeWidth:null!==(a=l.strokeWidth)&&void 0!==a?a:1,opacity:null!==(s=l.opacity)&&void 0!==s?s:.7};g.push({type:"circle",cx:n.x,cy:n.y,r:e,style:d,datum:n,id:n.id,label:n.id,depth:n.depth})}if(!1!==t.showLabels){const n=_t(t.nodeLabel);for(const r of e){const e=null!==(l=r.__radius)&&void 0!==l?l:5,i=n?n(r):r.id;if(!i)continue;if(15>e)continue;const a=!((null===(c=r.data)||void 0===c?void 0:c.children)&&r.data.children.length>0);let s=o(pt(r,"nodeStyle")).fill||Pt(t);if(t.colorByDepth&&void 0!==r.depth){const e=Nt(t);s=e[r.depth%e.length]}if(a){const n="string"==typeof s?Dt(s):null!==(u=null===(d=t.themeSemantic)||void 0===d?void 0:d.text)&&void 0!==u?u:"#000";y.push({x:r.x,y:r.y,text:i+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,e/3)),fill:n})}else y.push({x:r.x,y:r.y-e+14,text:i+"",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===(f=t.themeSemantic)||void 0===f?void 0:f.surface)||"#fff",strokeWidth:3,paintOrder:"stroke"})}}return{sceneNodes:g,sceneEdges:[],labels:y}}(e,n,0,r);default:return{sceneNodes:[],sceneEdges:[],labels:[]}}}};function It(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 jt(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 Wt(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 $t(e){let t=e.__orbitState;return t||(t={metaMap:new Map,startTime:"undefined"!=typeof performance?performance.now():Date.now()},e.__orbitState=t),t}const Bt={supportsStreaming:!1,hierarchical:!0,supportsAnimation:!0,computeLayout(e,t,n,o){const r=n.__hierarchyRoot;r&&function(e,t,n,o,r){var i,a;const s=function(e){if("function"==typeof e)return e;const t=e||"children";return e=>e[t]||null}(n.childrenAccessor),l=function(e){if("function"==typeof e)return e;const t=e||"name";return e=>{var n;return(null!==(n=e[t])&&void 0!==n?n:"")+""}}(n.nodeIDAccessor),c=function(e){if(Array.isArray(e))return e;switch(e){case"solar":return[1];case"atomic":return[2,8];default:return[9999]}}(n.orbitMode),d=null!==(i=n.orbitSize)&&void 0!==i?i:2.95,u=null!==(a=n.orbitEccentricity)&&void 0!==a?a:1,h="number"==typeof d?()=>d:d,f="number"==typeof u?()=>u:u,g=$t(n);g.metaMap.clear(),o.length=0,r.length=0;const y=new Map;function p(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,m=t[1]/2,b=Math.min(t[0],t[1])/2*.85,x=p(l(e));o.push({id:x,x:v,y:m,x0:v,x1:v,y0:m,y1:m,width:0,height:0,value:0,depth:0,data:e}),g.metaMap.set(x,{ring:b,angle:0,depth:0,parentId:null,eccentricity:1}),function e(t,n,i,a,d,u,y){const v=s(t);if(!(null==v?void 0:v.length))return;const m=v.length;let b=0,x=0,k=0;for(;m>x;)x+=c[Math.min(k,c.length-1)],k++,b++;let w=0;for(let m=0;b>m;m++){const x=c[Math.min(m,c.length-1)],k=v.slice(w,w+x);if(!k.length)break;const S=(m+1)/b,A={id:n,depth:u,data:t,parentId:n},M=y?d/h(A)*S:d*S,L=I().value(e=>{var t;return(null===(t=s(e))||void 0===t?void 0:t.length)?4:1}).sort(null),O=L(k),D=f(A);for(let t=0;k.length>t;t++){const s=(O[t].startAngle+O[t].endAngle)/2,c=k[t],d=p(l(c)),h=i+M*Math.sin(s),f=a+M*Math.cos(s)*D;o.push({id:d,x:h,y:f,x0:h,x1:h,y0:f,y1:f,width:0,height:0,value:0,depth:u,data:c}),g.metaMap.set(d,{ring:M,angle:s,depth:u,parentId:n,eccentricity:D}),r.push({source:n,target:d,value:1,y0:0,y1:0,sankeyWidth:0,data:{source:n,target:d}}),e(c,d,h,f,M,u+1,!0)}w+=x}}(e,x,v,m,b,1,!1)}(r,o,n,e,t)},buildScene(e,t,n,o){var r,i,a,s,l,c,d;const u=n.nodeStyle,h=n.nodeSize,f="number"==typeof h?()=>h:"function"==typeof h?h:()=>6,g=[],y=[],p=[];if(!1!==n.orbitShowRings){const t=$t(n),o=new Map;for(const t of e)o.set(t.id,t);const r=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}`;r.has(n)||r.set(n,{parentX:t.x,parentY:t.y,ring:e.ring,ecc:e.eccentricity})}const i=48,a={stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1};for(const[,{parentX:e,parentY:t,ring:n,ecc:o}]of r)for(let r=0;i>r;r++){const s=r/i*Math.PI*2,l=(r+1)/i*Math.PI*2;y.push({type:"line",x1:e+n*Math.sin(s),y1:t+n*Math.cos(s)*o,x2:e+n*Math.sin(l),y2:t+n*Math.cos(l)*o,style:a,datum:null})}}for(const t of e){if(null==t.x||null==t.y)continue;const e=f(pt(t,"nodeSize")),o=u?u(pt(t,"nodeStyle")):{},c={fill:o.fill||(null===(r=n.themeSemantic)||void 0===r?void 0:r.primary)||"#6366f1",stroke:o.stroke||(null===(i=n.themeSemantic)||void 0===i?void 0:i.surface)||"#fff",strokeWidth:null!==(a=o.strokeWidth)&&void 0!==a?a:1,opacity:null!==(s=o.opacity)&&void 0!==s?s:0===(null!==(l=t.depth)&&void 0!==l?l:0)?1:.85};g.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 v=new Map;for(const t of e)v.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:v.get(e.source),n="object"==typeof e.target?e.target:v.get(e.target);t&&n&&(null!=t.x&&null!=n.x&&y.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=f(pt(n,"nodeSize"));if(4>=e)continue;const o="function"==typeof t?t(n):t&&null!==(d=null===(c=n.data)||void 0===c?void 0:c[t])&&void 0!==d?d:n.id;p.push({x:n.x,y:n.y+e+12,text:o+"",anchor:"middle",fontSize:10,fill:"currentColor"})}}return{sceneNodes:g,sceneEdges:y,labels:p}},tick:(e,t,n,o,r)=>!1!==n.orbitAnimated&&(function(e,t){var n,o;const r=$t(t),i=null!==(n=t.orbitSpeed)&&void 0!==n?n:.25,a=null!==(o=t.orbitRevolution)&&void 0!==o?o:function(e){switch(e){case"decay":return e=>{var t;return Math.pow(.6,null!==(t=e.depth)&&void 0!==t?t:0)};case"alternate":return e=>{var t;const n=null!==(t=e.depth)&&void 0!==t?t:0;return(n%2==0?1:-1)/(n+1)};default:return e=>{var t;return 1/((null!==(t=e.depth)&&void 0!==t?t:0)+1)}}}(t.orbitRevolutionStyle),s=(("undefined"!=typeof performance?performance.now():Date.now())-r.startTime)/1e3,l=i*(Math.PI/6),c=new Map;for(const t of e)c.set(t.id,t);for(const t of e){const e=r.metaMap.get(t.id);if(!e||!e.parentId)continue;const n=c.get(e.parentId);if(!n)continue;const o=e.angle+s*l*a({id:t.id,depth:e.depth,data:t.data,parentId:e.parentId});t.x=n.x+e.ring*Math.sin(o),t.y=n.y+e.ring*Math.cos(o)*e.eccentricity,t.x0=t.x,t.x1=t.x,t.y0=t.y,t.y1=t.y}}(e,n),!0)},Rt={sankey:bt,force:xt,chord:Mt,tree:Ct,cluster:Ct,treemap:Ct,circlepack:Ct,partition:Ct,orbit:Bt};function zt(e){return Rt[e]}const Ht=Object.assign({category10:ye,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"]},we),Ft=ye,Yt=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],Xt=["#f0f0f0","#b5d4ea","#f4c2a1","#b8dab2","#d4b5e0","#f9e0a2","#a8d8d8"],Gt=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 qt(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")||Gt.has(t)}(o)?n(o):o}const o=(null==e?void 0:e[t])+"";return n?n(o):Ft[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))%Ft.length]}function Vt(e,t,n="category10"){const o=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e).map(e=>e+""))),r=o.every(e=>!isNaN(Number(e)));if(Array.isArray(n))return _().domain(o).range(n).unknown("#999");const i=Ht[n]||Ht.category10;if(r&&"function"==typeof i){let e=-1/0;for(const t of o){const n=Number(t);n>e&&(e=n)}return t=>i(Number(t)/e)}{const e=Array.isArray(i)?i:Ft;return _().domain(o).range(e).unknown("#999")}}function Kt(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"}}function Qt(e){return null!=e&&!1!==e&&""!==e&&(!Array.isArray(e)||e.some(Qt))}function Zt(e,t,n){e.has(t)||(e.add(t),console.warn(n))}function Ut(e,t,n){return e+(t-e)*n}function Jt(e,t,n){var o,r,i;if(1>=n)return 1;const a=null!==(o=e.minOpacity)&&void 0!==o?o:.1,s=n-1-t;switch(e.type){case"linear":return a+(1-s/(n-1))*(1-a);case"exponential":{const t=null!==(r=e.halfLife)&&void 0!==r?r:n/2;return a+Math.pow(.5,s/t)*(1-a)}case"step":return(null!==(i=e.stepThreshold)&&void 0!==i?i:.5*n)>s?1:a;default:return 1}}class en{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({},de),e.tensionConfig),e.showParticles&&("sankey"===e.chartType||e.customNetworkLayout)&&(this.particlePool=new Se(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({},de),e.tensionConfig),!e.showParticles||"sankey"!==e.chartType&&!e.customNetworkLayout||this.particlePool||(this.particlePool=new Se(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:r="source",targetAccessor:i="target",valueAccessor:a="value"}=this.config,s="function"==typeof o?o:e=>e[o],l="function"==typeof r?r:e=>e[r],c="function"==typeof i?i:e=>e[i],d="function"==typeof a?a:e=>{var t;return null!==(t=e[a])&&void 0!==t?t:1};this._boundedPrevSnapshot=new Map;for(const[e,t]of this.nodes)0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1||this._boundedPrevSnapshot.set(e,{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});this._boundedEdgeSnapshot=new Map;for(const[,e]of this.edges)e.sankeyWidth>0&&this._boundedEdgeSnapshot.set(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,{y0:e.y0,y1:e.y1,sankeyWidth:e.sankeyWidth});this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null;for(const t of e){const e=s(t)+"";this.nodes.set(e,Object.assign(Object.assign({},tn(e)),{data:t}))}for(let e=0;t.length>e;e++){const n=t[e],o=l(n)+"",r=c(n)+"",i=d(n),a=null==i?NaN:Number(i),s=Number.isFinite(a)?a:1;this.nodes.has(o)||this.nodes.set(o,Object.assign(Object.assign({},tn(o)),{data:n})),this.nodes.has(r)||this.nodes.set(r,Object.assign(Object.assign({},tn(r)),{data:n}));const u=`${o}\0${r}\0${e}`,h={source:o,target:r,value:s,y0:0,y1:0,sankeyWidth:0,data:n,_edgeKey:u};n&&"object"==typeof n&&nn(n.bezier)&&(h.bezier=n.bezier),this.edges.set(u,h)}this.runLayout(n)}edgeKey(e,t){return`${e}\0${t}`}ingestEdge(e){const{source:t,target:n,value:o}=e,r=0===this.nodes.size;let i=!1;const a="undefined"!=typeof performance?performance.now():Date.now();this.lastIngestTime=a,this._decaySortedNodes=null,this.nodes.has(t)||(this.nodes.set(t,tn(t)),this.nodeTimestamps.set(t,a),this.tension+=this.tensionConfig.newNode,i=!0),this.nodes.has(n)||(this.nodes.set(n,tn(n)),this.nodeTimestamps.set(n,a),this.tension+=this.tensionConfig.newNode,i=!0);const s=this.edgeKey(t,n),l=this.edges.get(s);let c=!1;return l?(l.value+=o,this.edgeTimestamps.set(s,a),this.tension+=this.tensionConfig.weightChange,c=!0):(this.edges.set(s,{source:t,target:n,value:o,y0:0,y1:0,sankeyWidth:0}),this.edgeTimestamps.set(s,a),this.tension+=this.tensionConfig.newEdge,i=!0),r||i||c||this.tension>=this.tensionConfig.threshold}runLayout(e){var t,n,o,r,i,a,s,l;if(this.config.customNetworkLayout)return this.recordTopologyDiff(),void this.layoutVersion++;const c=zt(this.config.chartType);if(!c)return;let d=Array.from(this.nodes.values());const u=Array.from(this.edges.values());if(0===d.length&&!c.hierarchical)return;if(this.prepareForRelayout(),c.supportsStreaming&&!c.hierarchical){const e=new Map;for(const s of d)if(void 0!==s._prevX0){const l=(null!==(t=s._prevX1)&&void 0!==t?t:0)-(null!==(n=s._prevX0)&&void 0!==n?n:0),c=(null!==(o=s._prevY1)&&void 0!==o?o:0)-(null!==(r=s._prevY0)&&void 0!==r?r:0);e.set(s.id,{x:(null!==(i=s._prevX0)&&void 0!==i?i:0)+l/2,y:(null!==(a=s._prevY0)&&void 0!==a?a:0)+c/2})}else 0===s.x&&0===s.y||e.set(s.id,{x:s.x,y:s.y});if(this._lastPositionSnapshot)for(const[t,n]of this._lastPositionSnapshot)e.has(t)||e.set(t,n);this.config.__previousPositions=e.size>0?e:void 0}if(c.computeLayout(d,u,this.config,e),this.config.__previousPositions=void 0,c.hierarchical&&d.length>0){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null;for(const e of d)this.nodes.set(e.id,e);for(let e=0;u.length>e;e++){const t=u[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,d=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 f=d.some(e=>void 0!==e._prevX0&&(0!==e._prevX0||0!==e._prevX1||0!==e._prevY0||0!==e._prevY1)),g=null!==(l=null===(s=this.config.transition)||void 0===s?void 0:s.duration)&&void 0!==l?l:this.tensionConfig.transitionDuration;if(!this._hasRenderedOnce&&this.config.introAnimation&&["sankey","tree","treemap","circlepack","partition"].includes(this.config.chartType)&&d.length>0&&g>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:g}}else f&&g>0&&(this.restorePreviousPositions(),this.transition={startTime:performance.now(),duration:g});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 r=null!==(t=this._baseStyles.get(o))&&void 0!==t?t:o.style,i=n(o,e);o.style=i?Object.assign(Object.assign({},r),i):r}}if(this._customRestyleEdge){const t=this._customRestyleEdge;for(const o of this.sceneEdges){const r=null!==(n=this._baseStyles.get(o))&&void 0!==n?n:o.style,i=t(o,e);o.style=i?Object.assign(Object.assign({},r),i):r}}}buildScene(e){var t,n,o,r,i,a,s,l,c;if(this._sceneNodesRevision++,this.config.customNetworkLayout){const d=Array.from(this.nodes.values()),u=Array.from(this.edges.values()),h=function(e,t,n){if(Array.isArray(e)&&e.length>0)return e;if("string"==typeof e){const t=Ht[e];if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:n}(this.config.colorScheme,this.config.themeCategorical,ye),f={nodes:d,edges:u,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:Kt(h),config:null!==(n=this.config.layoutConfig)&&void 0!==n?n:{},selection:null!==(o=this.config.layoutSelection)&&void 0!==o?o:null};let g;try{g=this.config.customNetworkLayout(f)}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!==(r=g.sceneNodes)&&void 0!==r?r:[],this.sceneEdges=null!==(i=g.sceneEdges)&&void 0!==i?i:[],this.labels=null!==(a=g.labels)&&void 0!==a?a:[],this.customLayoutOverlays=null!==(s=g.overlays)&&void 0!==s?s:null,this.customLayoutHtmlMarks=null!==(l=g.htmlMarks)&&void 0!==l?l:[],this._customRestyle=g.restyle,this._customRestyleEdge=g.restyleEdge,this.hasCustomRestyle=!(!g.restyle&&!g.restyleEdge),this.hasCustomRestyle&&(this.snapshotBaseStyles(),this.restyleScene(null!==(c=this.config.layoutSelection)&&void 0!==c?c:null)),void function(e){if("production"===process.env.NODE_ENV)return;const{label:t,nodes:n,overlays:o,warned:r}=e;Qt(o)&&0===n.length&&Zt(r,"overlay-only",`[semiotic] ${t} returned overlays but no data-bearing scene nodes. Overlays do not participate in hover, selection, transitions, SSR evidence, or accessibility tables. Emit at least one scene node with a datum, or mark the overlay-only chart as intentionally decorative.`),n.length>0&&n.every(e=>null==e.datum)&&Zt(r,"null-datums",`[semiotic] ${t} returned scene nodes, but every scene-node datum is null. Hover, callbacks, selection, and tooltip helpers need data-bearing nodes. Attach a user-facing datum to each interactive node, or set interactive overlays outside the chart.`)}({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 d=zt(this.config.chartType);if(!d)return;const u=d.hierarchical?Array.from(this.nodes.values()):this.nodesArray,h=d.hierarchical?Array.from(this.edges.values()):this.edgesArray,{sceneNodes:f,sceneEdges:g,labels:y}=d.buildScene(u,h,this.config,e);this.sceneNodes=f,this.sceneEdges=g,this.labels=y}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,en.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=Z().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=zt(this.config.chartType);return!!(null==e?void 0:e.supportsAnimation)&&!1!==this.config.orbitAnimated}tickAnimation(e,t){const n=zt(this.config.chartType);if(!(null==n?void 0:n.tick))return!1;const o=n.hierarchical?Array.from(this.nodes.values()):this.nodesArray,r=n.hierarchical?Array.from(this.edges.values()):this.edgesArray;return n.tick(o,r,this.config,e,t)}cancelIntroAnimation(){this.transition=null;for(const e of this.nodes.values())e._prevX0=void 0,e._prevX1=void 0,e._prevY0=void 0,e._prevY1=void 0;for(const e of this.edges.values())e._prevY0=void 0,e._prevY1=void 0,e._prevSankeyWidth=void 0,e._introFromZero=!1}advanceTransition(e){if(!this.transition)return!1;const t=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,this.transition),n=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(t);for(const e of this.nodes.values())void 0===e._targetX0||void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=Ut(e._prevX0,e._targetX0,n),e.x1=Ut(e._prevX1,e._targetX1,n),e.y0=Ut(e._prevY0,e._targetY0,n),e.y1=Ut(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=Ut(e._prevY0,e._targetY0,n),e.y1=Ut(e._prevY1,e._targetY1,n),e.sankeyWidth=Ut(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 r=t.x1,i=n.x0,a=p(r,i);return{circular:!1,points:[{x:e.y0,y:r},{x:e.y0,y:a(.5)},{x:e.y1,y:a(.5)},{x:e.y1,y:i}],halfWidth:o}}const r=t.x1,i=n.x0,a=p(r,i);return{circular:!1,points:[{x:r,y:e.y0},{x:a(.5),y:e.y0},{x:a(.5),y:e.y1},{x:i,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 r=[];for(let e=0;o.length-1>e;e++){const t=o[e],n=o[e+1],i=n.x-t.x,a=n.y-t.y;r.push([t,{x:t.x+i/3,y:t.y+a/3},{x:t.x+2*i/3,y:t.y+2*a/3},n])}return{circular:!0,segments:r,halfWidth:t}}rebuildAllBeziers(){for(const e of this.nodes.values())e.width=e.x1-e.x0,e.height=e.y1-e.y0,e.x=e.x0+e.width/2,e.y=e.y0+e.height/2;for(const e of this.edges.values())this.updateEdgeBezier(e)}applyPulse(e){var t,n,o,r,i;const a=this.config.pulse;if(!a)return;const s=null!==(t=a.duration)&&void 0!==t?t:500,l=null!==(n=a.color)&&void 0!==n?n:"rgba(255,255,255,0.6)",c=null!==(o=a.glowRadius)&&void 0!==o?o:4;for(const t of this.sceneNodes){const n=t.id;if(!n)continue;const o=this.nodeTimestamps.get(n);if(!o)continue;const r=e-o;s>r&&(t._pulseIntensity=1-r/s,t._pulseColor=l,t._pulseGlowRadius=c)}for(const t of this.sceneEdges){const n=t.datum;if(!n)continue;const o="object"==typeof n.source?null===(r=n.source)||void 0===r?void 0:r.id:n.source,a="object"==typeof n.target?null===(i=n.target)||void 0===i?void 0:i.id:n.target;if(!o||!a)continue;const c=this.edgeTimestamps.get(`${o}\0${a}`);if(!c)continue;const d=e-c;s>d&&(t._pulseIntensity=1-d/s,t._pulseColor=l)}}applyDecay(){var e,t;const n=this.config.decay;if(!n)return;const o=this.nodeTimestamps.size;if(1>=o)return;if(!this._decaySortedNodes){this._decaySortedNodes=Array.from(this.nodeTimestamps.entries()).sort((e,t)=>e[1]-t[1]);const e=new Map;for(let t=0;this._decaySortedNodes.length>t;t++)e.set(this._decaySortedNodes[t][0],t);this._decayAgeMap=e}const r=this._decayAgeMap;for(const i of this.sceneNodes){const a=i.id;if(!a)continue;const s=r.get(a);if(void 0===s)continue;const l=Jt(n,s,o),c=null!==(t=null===(e=i.style)||void 0===e?void 0:e.opacity)&&void 0!==t?t:1;i.style=Object.assign(Object.assign({},i.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 r=null!==(t=o.warningColor)&&void 0!==t?t:"#f59e0b",i=null!==(n=o.criticalColor)&&void 0!==n?n:"#ef4444",a=!1!==o.pulse;for(const t of this.sceneNodes){const n=t.id;if(!n)continue;const s=this.nodes.get(n);if(!s)continue;const l=o.metric(s);let c=null;void 0===o.critical||o.critical>l?void 0===o.warning||o.warning>l||(c=r):c=i,c&&(t.style=Object.assign(Object.assign({},t.style),{fill:c}),a&&(t._pulseIntensity=.6+.4*Math.sin(e/300),t._pulseColor=c,t._pulseGlowRadius=6))}}get hasActiveThresholds(){const e=this.config.thresholds;if(!e)return!1;for(const t of this.nodes.values()){const n=e.metric(t);if(void 0!==e.warning&&n>=e.warning||void 0!==e.critical&&n>=e.critical)return!0}return!1}get hasActivePulses(){var e;const t=this.config.pulse;if(!t||0===this.lastIngestTime)return!1;const n="undefined"!=typeof performance?performance.now():Date.now();return(null!==(e=t.duration)&&void 0!==e?e:500)>n-this.lastIngestTime}getLayoutData(){return{nodes:Array.from(this.nodes.values()),edges:Array.from(this.edges.values())}}updateNode(e,t){var n;const o=this.nodes.get(e);if(!o)return null;const r=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(),r}updateEdge(e,t,n){var o;const r=this.config.valueAccessor,i="function"==typeof r?r:r?e=>e[r]:e=>e.value,a=[];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){a.push(r.data?Object.assign({},r.data):{}),r.data=n(null!==(o=r.data)&&void 0!==o?o:{});const e=i(r.data);null!=e&&(r.value=Number(e))}return a.length>0&&(this.layoutVersion++,this.lastIngestTime="undefined"!=typeof performance?performance.now():Date.now()),a}removeNode(e){if(!this.nodes.has(e))return!1;this.nodes.delete(e),this.nodeTimestamps.delete(e);for(const[t,n]of this.edges)("string"==typeof n.source?n.source:n.source.id)!==e&&("string"==typeof n.target?n.target:n.target.id)!==e||(this.edges.delete(t),this.edgeTimestamps.delete(t));return this.layoutVersion++,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,r]of this.edges)r.data&&o(r.data)===e&&n.push(t)}else for(const[o,r]of this.edges)("string"==typeof r.source?r.source:r.source.id)===e&&("string"==typeof r.target?r.target:r.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 tn(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 nn(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(!on(e))return!1;return!0}return on(t.points)}function on(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 rn(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:o.createElement(o.Fragment,null,...t)}en.QUADTREE_THRESHOLD=500;const an={isActive:!1,predicate:()=>!0},sn=o.createContext(null);function ln({value:t,children:n}){return e(sn.Provider,{value:t,children:n})}function cn(){var e;return null!==(e=o.useContext(sn))&&void 0!==e?e:an}function dn(t,n){return null!=t?e(ln,{value:n,children:t}):t}function un(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function hn(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}const fn={circle:W,square:F,triangle:H,diamond:z,star:R,cross:B,wye:$};function gn(e,t,n){var o,r;if(n)return n;const i=null!=e?e:"circle";if("chevron"===i)return function(e){const t=1.5*yn(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=fn[i])&&void 0!==o?o:W;return null!==(r=j(a,Math.max(1,t))())&&void 0!==r?r:""}function yn(e){return Math.sqrt(Math.max(1,e)/Math.PI)}function pn(e,t,n,o,r=30,i,a=0){let s=null,l=r,c=1/0;if(i){const e=function(e,t,n,o,r,i=e=>e.x,a=e=>e.y,s=e=>e.r){const l=Math.max(o,r+5,12),c=t-l,d=t+l,u=n-l,h=n+l;let f=null,g=1/0;return e.visit((e,r,l,y,p)=>{if(r>d||c>y||l>h||u>p)return!0;if(!e.length){let r=e;do{const e=r.data,l=i(e)-t,c=a(e)-n,d=Math.sqrt(l*l+c*c);un(s(e),o)>=d&&g>d&&(f=e,g=d),r=r.next}while(r)}return!1}),f?{node:f,distance:g}:null}(i,n,o,r,a,e=>e.cx,e=>e.cy,e=>e.r);e&&(s={type:"node",datum:e.node.datum,x:e.node.cx,y:e.node.cy,distance:e.distance},l=e.distance)}for(const t of e){if(i&&"circle"===t.type)continue;const e=vn(t,n,o,r);if(e)if("rect"===t.type){const n=t.w*t.h;c>n&&(s=e,c=n)}else l>e.distance&&(s=e,l=e.distance)}if(s)return s;for(const e of t){if(!1===e.interactive)continue;const t=wn(e,n,o);t&&l>t.distance&&(s=t,l=t.distance)}return s}function vn(e,t,n,o=30){switch(e.type){case"circle":return function(e,t,n,o=30){const r=t-e.cx,i=n-e.cy,a=Math.sqrt(r*r+i*i);return a>un(e.r,o)?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:a}}(e,t,n,o);case"rect":return function(e,t,n){const o=function(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}}(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,r=n-e.cy,i=Math.sqrt(o*o+r*r);if(e.innerR-2>i||i>e.outerR+2)return null;const a=hn(Math.atan2(r,o)),s=hn(e.startAngle),l=hn(e.endAngle);if(s>l?a>=s||l>=a:a>=s&&l>=a){const t=(e.startAngle+e.endAngle)/2,n=(e.innerR+e.outerR)/2;return{type:"node",datum:e.datum,x:e.cx+n*Math.cos(t),y:e.cy+n*Math.sin(t),distance:0}}return null}(e,t,n);case"symbol":return function(e,t,n,o=30){const r=t-e.cx,i=n-e.cy,a=Math.sqrt(r*r+i*i);return a>un(yn(e.size),o)?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:a}}(e,t,n,o);default:return null}}let mn=null,bn=null;function xn(){return bn||(mn=document.createElement("canvas"),mn.width=1,mn.height=1,bn=mn.getContext("2d")),bn}function kn(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 wn(e,t,n){switch(e.type){case"bezier":return function(e,t,n){if(!e.pathD)return null;const o=kn(e),r=xn();if(!o||!r)return null;try{if(r.isPointInPath(o,t,n))return{type:"edge",datum:e.datum,x:t,y:n,distance:0};const i=r.lineWidth;r.lineWidth=10;const a=r.isPointInStroke(o,t,n);if(r.lineWidth=i,a)return{type:"edge",datum:e.datum,x:t,y:n,distance:4}}catch(e){}return null}(e,t,n);case"line":return function(e,t,n){const o=e.x2-e.x1,r=e.y2-e.y1,i=o*o+r*r;if(0===i)return null;let a=((t-e.x1)*o+(n-e.y1)*r)/i;a=Math.max(0,Math.min(1,a));const s=e.x1+a*o,l=e.y1+a*r,c=Math.sqrt(Math.pow(t-s,2)+Math.pow(n-l,2));return c>5?null:{type:"edge",datum:e.datum,x:s,y:l,distance:c}}(e,t,n);case"ribbon":case"curved":return function(e,t,n){if(!e.pathD)return null;const o=kn(e),r=xn();if(!o||!r)return null;try{if(r.isPointInPath(o,t,n))return{type:"edge",datum:e.datum,x:t,y:n,distance:0};const i=r.lineWidth;r.lineWidth=10;const a=r.isPointInStroke(o,t,n);if(r.lineWidth=i,a)return{type:"edge",datum:e.datum,x:t,y:n,distance:4}}catch(e){}return null}(e,t,n);default:return null}}function Sn(e,t,n){const{group:o,indexInGroup:r}=t,i=n.byGroup.get(o);switch(e){case"ArrowRight":return i.length-1>r?i[r+1]._flatIndex:t.flatIndex;case"ArrowLeft":return r>0?i[r-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=n.groups.indexOf(o);return n.groups.length-1>e?An(n,n.groups[e+1],i[r]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?An(n,n.groups[e-1],i[r]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*n.flat.length)),n.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*n.flat.length)),0);case"Home":return 0;case"End":return n.flat.length-1;case"Escape":return-1;default:return null}}function An(e,t,n){const o=e.byGroup.get(t);let r=0,i=Math.abs(o[0].x-n.x);for(let e=1;o.length>e;e++){const t=Math.abs(o[e].x-n.x);i>t&&(i=t,r=e)}return o[r]._flatIndex}function Mn(e){return"object"==typeof e&&null!==e&&"id"in e?e.id:e}const Ln="var(--semiotic-focus, #005fcc)";function On({active:t,hoverPoint:n,margin:o,size:r,shape:i="circle",width:a,height:s}){if(!t||!n)return null;const l=n.x+o.left,c=n.y+o.top;let d;if("rect"===i&&null!=a&&null!=s){const t=Math.max(a,4),n=Math.max(s,4);d=e("rect",{x:l-t/2-3,y:c-n/2-3,width:t+6,height:n+6,rx:3,fill:"none",stroke:Ln,strokeWidth:2,strokeDasharray:"4,2"})}else d=e("circle","wedge"===i?{cx:l,cy:c,r:12,fill:"none",stroke:Ln,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:Ln,strokeWidth:2,strokeDasharray:"4,2"});return e("svg",{style:{position:"absolute",left:0,top:0,width:r[0],height:r[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:d})}function Dn({x:t,y:n,containerWidth:r,containerHeight:i,margin:a,children:s,className:l="stream-frame-tooltip",zIndex:c=1}){const d=Number.isFinite(t)&&Number.isFinite(n),u=o.useRef(null),[h,f]=o.useState(null);o.useLayoutEffect(()=>{const e=u.current;if(!e)return;const t=e.getBoundingClientRect();f(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[s,l,r,i]);let g;g=h?`translate(${h.width+12>r-t?"calc(-100% - 12px)":"12px"}, ${h.height+12>i-n?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*r?"calc(-100% - 12px)":"12px"}, ${.3*i>n?"4px":"calc(-100% - 4px)"})`;const y=function(e){if(!o.isValidElement(e))return!1;const t=e.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;const n=e.props;if("string"==typeof n.className&&n.className.trim().length>0)return!0;const r=n.style;if(r&&"object"==typeof r){if(null!=r.background&&""!==r.background)return!0;if(null!=r.backgroundColor&&""!==r.backgroundColor)return!0}return!1}(s),p=y?null:ie;return d?e("div",{ref:u,className:y?l:(l+" semiotic-tooltip").trim(),style:Object.assign(Object.assign({},p||{}),{position:"absolute",left:a.left+t,top:a.top+n,transform:g,pointerEvents:"none",zIndex:c,width:"max-content"}),children:s}):null}function En(t){let n=null;const o=()=>(n||(n=c(null)),n),d=_n(t);return[function({children:n,initialState:a}){const s=r(a),l=i(()=>_n(t,s.current),[]),c=o();return e(c.Provider,{value:l,children:n})},(e,t)=>{var n;const i=o(),c=null!==(n=a(i))&&void 0!==n?n:d,u=r(e);u.current=e;const h=r({hasValue:!1,value:void 0}),f=s(()=>{const e=u.current(c.getState()),n=h.current;return n.hasValue&&t&&t(n.value,e)?n.value:(h.current={hasValue:!0,value:e},e)},[c,t]),g=s(()=>u.current(c.getState()),[c]);return l(c.subscribe,f,g)}]}function _n(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 Nn(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 Pn(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:Tn})})),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 Tn=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],Cn={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}},In={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}},jn={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:Tn,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 Wn(e,t){if("light"===t)return Cn;if("dark"===t)return In;if("high-contrast"===t)return jn;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?In:Cn;return Pn(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 Pn(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[$n,Bn]=En(e=>({theme:Cn,setTheme(t){e(e=>({theme:Wn(e.theme,t)}))}}));const Rn=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,zn=new WeakMap;let Hn=0,Fn=!1,Yn=null,Xn=null,Gn=null;function qn(e,t){var n,o;if(!t)return t;const r=Rn.exec(t);if(!r)return t;const i=e.canvas;if(!i)return(null===(n=r[2])||void 0===n?void 0:n.trim())||t;!function(){if(Fn)return;if("undefined"==typeof window||"undefined"==typeof document)return;Fn=!0;const e=()=>{Hn++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(Yn=new MutationObserver(e),Yn.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{Xn=window.matchMedia("(prefers-color-scheme: dark)"),Gn=e,"function"==typeof Xn.addEventListener?Xn.addEventListener("change",Gn):"function"==typeof Xn.addListener&&Xn.addListener(Gn)}catch(e){}}();let a=zn.get(i);a&&a.version===Hn||(a={version:Hn,map:new Map},zn.set(i,a));const s=a.map.get(t);if(void 0!==s)return s;const l=getComputedStyle(i).getPropertyValue(r[1]).trim()||(null===(o=r[2])||void 0===o?void 0:o.trim())||t;return a.map.set(t,l),l}const Vn="undefined"==typeof window?u:h;function Kn(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function Qn(e){const t=function(){const[e,t]=d(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return u(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),function(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)}(e,e=>t(e.matches))},[]),e}(),n=r(t);n.current=t;const[a,l]=function(e,t,n){const o=r(null),[i,a]=d(null);return u(()=>{if(!t&&!n)return;const e=o.current;if(!e)return;const r=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;a(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return r.observe(e),()=>r.disconnect()},[t,n]),[o,[t&&i?i.w:e[0],n&&i?i.h:e[1]]]}(e.sizeProp,e.responsiveWidth,e.responsiveHeight),c=i(()=>Object.assign(Object.assign({},e.marginDefault),e.userMargin),[e.marginDefault,e.userMargin]),h=l[0]-c.left-c.right,f=l[1]-c.top-c.bottom,g=Kn(e.foregroundGraphics,l,c),y=Kn(e.backgroundGraphics,l,c),p=Bn(e=>e.theme),{transition:v,introEnabled:m}=function(e,t){var n,o;if(!1===e)return{transition:void 0,introEnabled:!1};const r="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:!(r||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),b="semiotic-table-"+o.useId(),x=r(0),k=r(()=>{}),w=s(()=>{x.current||(x.current=requestAnimationFrame(()=>k.current()))},[]);u(()=>()=>{x.current&&(cancelAnimationFrame(x.current),x.current=0)},[]);const S=r(()=>{}),A=r(()=>{}),M=r(null),L=r(0),O=s(()=>{L.current=0;const e=M.current;M.current=null,e&&S.current(e)},[]),D=s(e=>{M.current={clientX:e.clientX,clientY:e.clientY},0===L.current&&(L.current=requestAnimationFrame(O))},[O]),E=s(()=>{M.current=null,0!==L.current&&(cancelAnimationFrame(L.current),L.current=0),A.current()},[]);u(()=>()=>{M.current=null,0!==L.current&&(cancelAnimationFrame(L.current),L.current=0)},[]);const _=e.themeDirtyRef;return Vn(()=>{_&&(Hn++,_.current=!0,w())},[p,w,_]),{reducedMotion:t,reducedMotionRef:n,responsiveRef:a,size:l,margin:c,adjustedWidth:h,adjustedHeight:f,resolvedForeground:g,resolvedBackground:y,currentTheme:p,transition:v,introEnabled:m,tableId:b,rafRef:x,renderFnRef:k,scheduleRender:w,hoverHandlerRef:S,hoverLeaveRef:A,onPointerMove:D,onPointerLeave:E}}const Zn={fresh:1,aging:.7,stale:.45,expired:.25},Un={alpha:1,band:"fresh",isStale:!1};function Jn({isStale:t,position:n}){return e("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===n?{top:4,left:4}:"bottom-left"===n?{bottom:4,left:4}:"bottom-right"===n?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",zIndex:3,background:t?"#dc3545":"#28a745",color:"white"}),children:t?"STALE":"LIVE"})}const eo={fill:(t,n)=>e("rect",{style:t,width:n,height:n}),line:(t,n)=>e("line",{style:t,x1:0,y1:0,x2:n,y2:n})};function to(e,t,n,o,r){let i;return i="function"==typeof n?n(e):(0,eo[n])(o(e,t),r),i}function no({swatchSize:t}){return e("path",{d:`M${.25*t},${.55*t} L${.45*t},${.75*t} L${.8*t},${.3*t}`,fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function oo(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const ro=(n,o,r,i,a,s,l,c,d,u,h)=>{const{type:f="fill",styleFn:g,items:y}=n,p=[];let v=0;const m=!(!o&&!r),b="isolate"===u||void 0===u&&null!=a,{swatchSize:x,labelGap:k,rowHeight:w}=h;return y.forEach((n,u)=>{const h=to(n,u,f,g,x),S=oo(n,i,a),A=a&&a.size>0&&a.has(n.label);p.push(t("g",{transform:`translate(0,${v})`,onClick:o?()=>o(n):void 0,onMouseEnter:r?()=>r(n):void 0,onMouseLeave:r?()=>r(null):void 0,tabIndex:m?c===s&&u===l?0:-1:void 0,role:m?"option":void 0,"aria-selected":m&&b?A||!1:void 0,"aria-current":m&&!b&&null!=i&&n.label===i||void 0,"aria-label":n.label,onKeyDown:m?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(n)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const n=(u+("ArrowDown"===e.key?1:-1)+y.length)%y.length;d(c,n);const o=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[n];o instanceof SVGElement&&o.focus()}}:void 0,onFocus:m?e=>{d(c,u),r&&r(n);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:m?e=>{r&&r(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:m?"pointer":"default",opacity:S,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[m&&e("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:x+k+2+7*n.label.length,height:x+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),h,A&&e(no,{swatchSize:x}),e("text",{y:x/2,x:x+k,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:n.label})]},"legend-item-"+u)),v+=w}),p};function io({config:n,orientation:r="vertical",width:i=100}){const{colorFn:a,domain:s,label:l,format:c}=n,d=c||(e=>Math.round(100*e)/100+""),u="grad-legend-"+o.useId();if("horizontal"===r){const n=12,o=Math.min(i,200),r=Math.max(0,(i-o)/2),c=[];for(let t=0;64>=t;t++){const n=t/64;c.push(e("stop",{offset:100*n+"%",stopColor:a(s[0]+n*(s[1]-s[0]))},t))}return t("g",{"aria-label":l||"Gradient legend",children:[e("defs",{children:e("linearGradient",{id:u,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),l&&e("text",{x:r+o/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:l}),e("rect",{x:r,y:0,width:o,height:n,fill:`url(#${u})`,rx:2}),e("text",{x:r,y:n+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:d(s[0])}),e("text",{x:r+o,y:n+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:d(s[1])})]})}const h=[];for(let t=0;64>=t;t++){const n=t/64;h.push(e("stop",{offset:100*n+"%",stopColor:a(s[1]-n*(s[1]-s[0]))},t))}return t("g",{"aria-label":l||"Gradient legend",children:[l&&e("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:l}),e("defs",{children:e("linearGradient",{id:u,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:h})}),e("rect",{x:0,y:0,width:14,height:100,fill:`url(#${u})`,rx:2}),e("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:d(s[1])}),e("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:d(s[0])})]})}function ao(n){const{legendGroups:r,customClickBehavior:i,customHoverBehavior:a,highlightedCategory:s,isolatedCategories:l,legendInteraction:c,title:d="Legend",width:u=100,height:h=20,orientation:f="vertical",legendLayout:g}=n,y=function(e){var t,n,o,r,i;const a=Math.max(1,null!==(t=null==e?void 0:e.swatchSize)&&void 0!==t?t:16),s=Math.max(a,null!==(n=null==e?void 0:e.rowHeight)&&void 0!==n?n:22);return{swatchSize:a,labelGap:Math.max(0,null!==(o=null==e?void 0:e.labelGap)&&void 0!==o?o:6),itemGap:Math.max(0,null!==(r=null==e?void 0:e.itemGap)&&void 0!==r?r:10),rowHeight:s,align:"left"===(null==e?void 0:e.align)?"start":"right"===(null==e?void 0:e.align)?"end":null!==(i=null==e?void 0:e.align)&&void 0!==i?i:"start",maxWidth:null==e?void 0:e.maxWidth}}(g),[p,v]=o.useState(0),[m,b]=o.useState(0),x=o.useCallback((e,t)=>{v(e),b(t)},[]),k="vertical"===f?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:s,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:d,metrics:u})=>{let h=24;const f=[];return t.forEach((t,g)=>{h+=5,f.push(e("line",{stroke:"gray",x1:0,y1:h,x2:n,y2:h},"legend-top-line legend-symbol-"+g)),h+=8,t.label&&(h+=16,f.push(e("text",{y:h,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label},"legend-text-"+g)),h+=8),f.push(e("g",{className:"legend-item",transform:`translate(0,${h})`,children:ro(t,o,r,i,a,s,l,g,c,d,u)},"legend-group-"+g)),h+=t.items.length*u.rowHeight+8}),f})({legendGroups:r||[],width:u,customClickBehavior:i,customHoverBehavior:a,highlightedCategory:s,isolatedCategories:l,focusedGroupIndex:p,focusedItemIndex:m,onFocusedIndexChange:x,legendInteraction:c,metrics:y}):(({legendGroups:n,height:o,width:r,customClickBehavior:i,customHoverBehavior:a,highlightedCategory:s,isolatedCategories:l,focusedGroupIndex:c,focusedItemIndex:d,onFocusedIndexChange:u,legendInteraction:h,metrics:f})=>{var g;let y=0;const p=[];n.forEach((n,o)=>{var g;let v=0;n.label&&(v+=16);const m=((n,o,r,i,a,s,l,c,d,u,h,f)=>{const{type:g="fill",styleFn:y,items:p}=n,v=[],{swatchSize:m,labelGap:b,itemGap:x,rowHeight:k,align:w}=h,S=!(!o&&!r),A="isolate"===u||void 0===u&&null!=a,M=p.map(e=>m+b+7*e.label.length),L=[];let O=0,D=0;M.forEach((e,t)=>{const n=0===D?e:D+x+e;f&&f>0&&D>0&&n>f?(L.push({start:O,end:t,width:D}),O=t,D=e):D=n}),p.length>0&&L.push({start:O,end:p.length,width:D}),L.forEach((n,u)=>{let h="center"===w?Math.max(0,((null!=f?f:n.width)-n.width)/2):"end"===w?Math.max(0,(null!=f?f:n.width)-n.width):0;for(let f=n.start;n.end>f;f++){const n=p[f],w=to(n,f,g,y,m),L=oo(n,i,a),O=a&&a.size>0&&a.has(n.label);v.push(t("g",{transform:`translate(${h},${u*k})`,onClick:o?()=>o(n):void 0,onMouseEnter:r?()=>r(n):void 0,onMouseLeave:r?()=>r(null):void 0,tabIndex:S?c===s&&f===l?0:-1:void 0,role:S?"option":void 0,"aria-selected":S&&A?O||!1:void 0,"aria-current":S&&!A&&null!=i&&n.label===i||void 0,"aria-label":n.label,onKeyDown:S?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(n)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const n=(f+("ArrowRight"===e.key?1:-1)+p.length)%p.length;d(c,n);const o=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[n];o instanceof SVGElement&&o.focus()}}:void 0,onFocus:S?e=>{d(c,f),r&&r(n);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:S?e=>{r&&r(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:S?"pointer":"default",opacity:L,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[S&&e("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:m+b+2+7*n.label.length,height:m+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),w,O&&e(no,{swatchSize:m}),e("text",{y:m/2,x:m+b,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:n.label})]},"legend-item-"+f)),h+=M[f]+x}});const E=Math.max(0,...L.map(e=>e.width)),_=L.length;return{items:v,offset:E,totalRows:_,totalHeight:_*k}})(n,i,a,s,l,c,d,o,u,h,f,null!==(g=f.maxWidth)&&void 0!==g?g:r);v+=m.offset+5,p.push(Object.assign(Object.assign({label:n.label},m),{offset:v,totalRows:m.totalRows,totalHeight:m.totalHeight})),y+=v+12});const v=null!==(g=f.maxWidth)&&void 0!==g?g:r;let m=y>v?0:"center"===f.align?Math.max(0,(v-y)/2):"end"===f.align?Math.max(0,v-y):0;const b=[];return p.forEach((t,r)=>{const i=n[r];i.label&&(b.push(e("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:i.label},"legend-text-"+r)),m+=16),b.push(e("g",{className:"legend-item",transform:`translate(${m},0)`,children:t.items},"legend-group-"+r)),m+=t.offset+5,n[r+1]&&b.push(e("line",{stroke:"gray",x1:m,y1:-8,x2:m,y2:(t.totalHeight||o)+0+8},"legend-top-line legend-symbol-"+r)),m+=12}),e("g",{children:b})})({legendGroups:r||[],title:d,height:h,width:u,customClickBehavior:i,customHoverBehavior:a,highlightedCategory:s,isolatedCategories:l,focusedGroupIndex:p,focusedItemIndex:m,onFocusedIndexChange:x,legendInteraction:c,metrics:y}),w=!(!i&&!a);return t("g",{role:w?"listbox":void 0,"aria-multiselectable":!(!w||"isolate"!==c&&(void 0!==c||null==l))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==d&&""!==d&&"vertical"===f&&e("text",{className:"legend-title",y:16,x:u/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:d}),k]})}function so(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function lo(e){return"object"==typeof e&&null!==e&&"gradient"in e}function co(t){var n;const{legend:o,totalWidth:r,totalHeight:i,margin:a,legendPosition:s="right",legendLayout:l,title:c,legendHoverBehavior:d,legendClickBehavior:u,legendHighlightedCategory:h,legendIsolatedCategories:f,legendInteraction:g}=t;if(!o)return null;const y="top"===s||"bottom"===s,p=!!c,v=Math.max(1,y?null!==(n=null==l?void 0:l.maxWidth)&&void 0!==n?n:Math.max(0,r-a.left-a.right):100);let m,b;return"left"===s?(m=Math.max(4,a.left-v-10),b=a.top):"top"===s?(m=a.left,b=p?32:8):"bottom"===s?(m=a.left,b=i-a.bottom+38):(m=r-a.right+10,b=a.top),e("g",{transform:`translate(${m}, ${b})`,children:lo(o)?e(io,{config:o.gradient,orientation:y?"horizontal":"vertical",width:v}):so(o)?e(ao,{legendGroups:o.legendGroups,title:"",width:v,orientation:y?"horizontal":"vertical",legendLayout:l,customHoverBehavior:d,customClickBehavior:u,highlightedCategory:h,isolatedCategories:f,legendInteraction:g}):o})}const uo={secondary:0,primary:3},ho=".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 fo(e){return!0===(null==e?void 0:e._annotationDeferred)}function go(e){return"blended"===(null==e?void 0:e.cohesion)||"layer"===(null==e?void 0:e.cohesion)?e.cohesion:null}function yo(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 po(e){return Math.max(.72,.95-.06*e)}function vo(e,t){var n,o,r;const i=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.x)&&void 0!==o?o:null===(r=t.scales)||void 0===r?void 0:r.time;return i?null!=e.x?i(e.x):t.xAccessor&&null!=e[t.xAccessor]?i(e[t.xAccessor]):null:null}function mo(e,t){var n,o,r;const i=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.y)&&void 0!==o?o:null===(r=t.scales)||void 0===r?void 0:r.value;return i?null!=e.y?i(e.y):t.yAccessor&&null!=e[t.yAccessor]?i(e[t.yAccessor]):null:null}function bo(e){return null==e?null:e+""}function xo(e,t,n){var o;return null===(o=t.stickyPositionCache)||void 0===o||o.set(e,n),n}const ko=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function wo(e){return!!e&&"object"==typeof e&&ko.has(function(e){return"string"==typeof(null==e?void 0:e.type)?e.type:""}(e))}function So(e){return"primary"===(null==e?void 0:e.emphasis)||!0===(null==e?void 0:e.defensive)}function Ao(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 Mo(e){var t,n;let o;const r=null==e?void 0:e.emphasis;o="primary"===r?100:"secondary"===r?10:50;const i=null===(t=null==e?void 0:e.provenance)||void 0===t?void 0:t.confidence;switch("number"==typeof i&&Number.isFinite(i)&&(o+=15*function(e){return Math.max(0,Math.min(1,e))}(i)),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 Lo=32,Oo=6,Do=4,Eo=8,_o=72;const No={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function Po(e){return wo(e)}function To(e,t){if(!e)return[];const n=Math.max(1,Math.floor(t/7)),o=e.split(/\s+/).filter(Boolean),r=[];let i="";for(const e of o)i&&i.length+e.length+1>n?(r.push(i),i=e):i=i?`${i} ${e}`:e;return i&&r.push(i),r}function Co(e,t,n,o,r){const i=e+n,a=t+o;return Math.abs(n)>Math.abs(o)?{x:0>n?i-r.width-4:i+4,y:0>o?a-r.height:a,width:r.width,height:r.height}:{x:0>n?i-r.width:i,y:0>o?a-r.height-4:a+4,width:r.width,height:r.height}}function Io(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function jo(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 Wo(e,t,n,o,r,i,a,s){const l=Io(e,a);let c=.4*Math.hypot(t.dx,t.dy)+80*function(e,t,n,o){const r=Math.max(0,o-e.x),i=Math.max(0,o-e.y);return(r+Math.max(0,e.x+e.width-(t-o)))*e.height+(i+Math.max(0,e.y+e.height-(n-o)))*e.width}(l,r,i,s);for(const e of n)c+=12*jo(l,e);for(const e of o)c+=4*jo(l,e);return c}function $o(e,t,n){var o,r;if("widget"===e.type&&"number"==typeof e.px&&"number"==typeof e.py)return{x:e.px,y:e.py};const i=null!==(o=e.pointId)&&void 0!==o?o:e.nodeId;if(null!=i&&n.pointNodes){const e=n.pointNodes.find(e=>e.pointId===i);if(e)return{x:e.x,y:e.y}}const a=e.coordinates,s=null===(r=n.scales)||void 0===r?void 0:r.geoProjection;if(Array.isArray(a)&&a.length>=2&&s){const e=a[0],t=a[1];if("number"==typeof e&&"number"==typeof t){const n=s([e,t]);if(n&&"number"==typeof n[0]&&"number"==typeof n[1])return{x:n[0],y:n[1]}}}return n.scales||"number"!=typeof e.x||"number"!=typeof e.y?function(e,t,n){var o,r;const i=e.anchor||(null===(o=e.lifecycle)||void 0===o?void 0:o.anchor)||"fixed";if("latest"===i){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let o=n.pointNodes.length-1;o>=0;o--){const r=n.pointNodes[o];if(r.pointId===e.pointId)return xo(t,n,{x:r.x,y:r.y})}const o=function(e){var t,n,o,r,i,a;const s=e.data;if(!s||0===s.length)return null;const l=s[s.length-1],c=null!==(n=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==n?n:null===(o=e.scales)||void 0===o?void 0:o.time,d=null!==(i=null===(r=e.scales)||void 0===r?void 0:r.y)&&void 0!==i?i:null===(a=e.scales)||void 0===a?void 0:a.value;if(!c||!d)return null;const u=l[e.xAccessor||"x"],h=l[e.yAccessor||"y"];return null==u||null==h?null:{x:c(u),y:d(h)}}(n);return o?xo(t,n,o):null}if("semantic"===i){const o=function(e,t,n){var o,r;const i=function(e){var t,n;return bo(null!==(n=null===(t=e.provenance)||void 0===t?void 0:t.stableId)&&void 0!==n?n:e.stableId)}(e);if(!i)return null;const a=null===(o=n.pointNodes)||void 0===o?void 0:o.find(e=>bo(e.pointId)===i);if(a)return xo(t,n,{x:a.x,y:a.y});const s=null===(r=n.data)||void 0===r?void 0:r.find(e=>function(e){var t,n,o;return bo(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)===i);if(!s)return null;const l=vo(s,n),c=mo(s,n);return null==l||null==c?null:xo(t,n,{x:l,y:c})}(e,t,n);if(o)return o}let a=null,s=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(a=t.x,s=t.y)}if(null!=a&&null!=s||(a=vo(e,n),s=mo(e,n)),null!=a&&null!=s)return xo(t,n,{x:a,y:s});if("sticky"===i){const e=null===(r=n.stickyPositionCache)||void 0===r?void 0:r.get(t);if(e)return e}return null}(e,t,n):{x:e.x,y:e.y}}function Bo(e){var t;const{annotations:n,context:o,defaultOffset:r=Lo,notePadding:i=Oo,markPadding:a=Do,edgePadding:s=Eo,preserveManualOffsets:l=!0,routeLongConnectors:c=!0,connectorThreshold:d=_o,density:u,progressiveDisclosure:h=!1,redundantCues:f=!1,responsive:g,cohesion:y,audience:p}=e,v=o.width||0,m=o.height||0;if(0===n.length||0>=v||0>=m)return n.slice();const b=[],x=function(e,t){return(e.pointNodes||[]).map(e=>{const n=Math.max(1,e.r||1)+t;return{x:e.x-n,y:e.y-n,width:2*n,height:2*n}})}(o,a);let k=!1;const w=n.map((e,t)=>{if(!Po(e))return e;const n=$o(e,t,o);if(!n)return e;const a=function(e){if("widget"===e.type)return{width:"number"==typeof e.width?e.width:32,height:"number"==typeof e.height?e.height:32};const t="number"==typeof e.wrap?e.wrap:120,n=[...To("string"==typeof e.title?e.title:void 0,t),...To("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(u=e).dx||"number"==typeof u.dy)){const t=function(e){return"text"===e.type||"widget"===e.type?{dx:0,dy:0}:{dx:30,dy:-30}}(e);return b.push(Io(Co(n.x,n.y,"number"==typeof e.dx?e.dx:t.dx,"number"==typeof e.dy?e.dy:t.dy,a),i)),e}var u;let h=null,f=1/0;for(const e of function(e){const t=1.6*e;return[{dx:e,dy:-e},{dx:-e,dy:-e},{dx:e,dy:e},{dx:-e,dy:e},{dx:e,dy:0},{dx:-e,dy:0},{dx:0,dy:-e},{dx:0,dy:e},{dx:t,dy:-t},{dx:-t,dy:-t},{dx:t,dy:t},{dx:-t,dy:t}]}(r)){const t=Wo(Co(n.x,n.y,e.dx,e.dy,a),e,b,x,v,m,i,s);f>t&&(h=e,f=t)}if(!h)return e;const g=Io(Co(n.x,n.y,h.dx,h.dy,a),i);b.push(g);const y=Math.hypot(h.dx,h.dy),p=c&&y>=d&&"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}),p?{connector:p}:{})}),S=k?w:n.slice();let A=S;if(f){let e=!1;const t=S.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});A=e?t:S}{let e=!1;const t=A.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=No[n.source])&&void 0!==t?t:n.source:null,r="number"==typeof n.confidence&&Number.isFinite(n.confidence)?Math.round(100*Math.max(0,Math.min(1,n.confidence)))+"%":null;if(!o&&!r)return e;if(null!=e.label&&"string"!=typeof e.label)return e;const i=[o,r].filter(Boolean).join(" · "),a="string"==typeof e.label?e.label:"";return a.includes(`(${i})`)?e:Object.assign(Object.assign({},e),{label:a?`${a} (${i})`:`(${i})`})}(t);return n!==t&&(e=!0),n});A=e?t:A}const M=new Set;if(u){const e="object"==typeof u?u:{},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}(p),o=1===n?e:Object.assign(Object.assign({},e),{maxAnnotations:Math.max(0,Math.round((null!==(t=e.maxAnnotations)&&void 0!==t?t:Ao(v,m,e))*n))}),{deferred:r}=function(e){var t;const{annotations:n,width:o,height:r}=e,i=Math.max(0,null!==(t=e.minVisible)&&void 0!==t?t:1),a=Ao(o,r,e),s=n.map((e,t)=>{return{annotation:e,index:t,note:(n=e,wo(n))};var n}),l=s.filter(e=>e.note);if(0===l.length||a>=l.length)return{visible:n.slice(),deferred:[],budget:a};const c=l.filter(e=>So(e.annotation)),d=l.filter(e=>!So(e.annotation)).sort((e,t)=>Mo(t.annotation)-Mo(e.annotation)||e.index-t.index),u=Math.min(d.length,Math.max(Math.max(0,a-c.length),Math.max(0,i-c.length))),h=new Set([...c.map(e=>e.index),...d.slice(0,u).map(e=>e.index)]),f=[],g=[];for(const{annotation:e,index:t,note:n}of s)!n||h.has(t)?f.push(e):g.push(e);return{visible:f,deferred:g,budget:a}}(Object.assign({annotations:A,width:v,height:m},o));for(const e of r)M.add(e)}if(g&&("object"==typeof g&&"number"==typeof g.minWidth?g.minWidth:480)>=v)for(const e of A)Po(e)&&"secondary"===e.emphasis&&M.add(e);if(M.size>0)for(const e of A)!0===(null==e?void 0:e.defensive)&&M.delete(e);let L;return L=0===M.size?A:h?A.map(e=>M.has(e)?Object.assign(Object.assign({},e),{_annotationDeferred:!0}):e):A.filter(e=>!M.has(e)),y?function(e,t){let n=!1;const o=e.map(e=>Po(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(n=!0,Object.assign(Object.assign({},e),{cohesion:t})):e);return n?o:e}(L,y):L}function Ro(r){const{width:i,height:a,totalWidth:s,totalHeight:l,margin:c,labels:d,title:u,legend:h,legendHoverBehavior:f,legendClickBehavior:g,legendHighlightedCategory:y,legendIsolatedCategories:p,legendPosition:v="right",legendLayout:m,foregroundGraphics:b,sceneNodes:x,annotations:k,autoPlaceAnnotations:w,svgAnnotationRules:S}=r,A=o.useMemo(()=>{const e=(x||[]).flatMap(e=>{const t=function(e){var t,n,o,r;const i=null!==(t=e.cx)&&void 0!==t?t:null!=e.x&&null!=e.w?e.x+e.w/2:e.x,a=null!==(n=e.cy)&&void 0!==n?n:null!=e.y&&null!=e.h?e.y+e.h/2:e.y;return"number"!=typeof i||"number"!=typeof a?null:{x:i,y:a,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,yn(e.size)):Math.max(1,null!==(o=e.w)&&void 0!==o?o:0,null!==(r=e.h)&&void 0!==r?r:0)/2}}(e),n=function(e){var t,n,o,r,i,a,s,l;const c=null!==(a=null!==(o=null!==(t=e.id)&&void 0!==t?t:null===(n=e.datum)||void 0===n?void 0:n.id)&&void 0!==o?o:null===(i=null===(r=e.datum)||void 0===r?void 0:r.data)||void 0===i?void 0:i.id)&&void 0!==a?a:null===(l=null===(s=e.datum)||void 0===s?void 0:s.data)||void 0===l?void 0:l.name;return null==c?void 0:c+""}(e);return t?[Object.assign({pointId:n},t)]:[]});return{scales:null,width:i,height:a,frameType:"network",pointNodes:e,sceneNodes:x}},[a,x,i]),M=o.useMemo(()=>k&&w?Bo(Object.assign({annotations:k,context:A},"object"==typeof w?w:{})):k,[k,w,A]),L=M?function(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:yo(e.annotation),readingOrder:null,rank:1};var n}),o=n.some(e=>null!=e.emphasis||null!=e.confidence),r=t.some(e=>fo(e.annotation)),i=t.some(e=>null!=go(e.annotation)),a=t.some(e=>"layer"===go(e.annotation));if(!o&&!r&&!i)return t.map(e=>e.node);const s=n.filter(e=>null==e.emphasis&&null!=e.confidence).slice().sort((e,t)=>{var n,o;return(null!==(n=t.confidence)&&void 0!==n?n:0)-(null!==(o=e.confidence)&&void 0!==o?o:0)||e.i-t.i});s.forEach((e,t)=>{e.readingOrder=t,e.rank=2-t/Math.max(1,s.length)});for(const e of n)e.emphasis&&(e.rank=uo[e.emphasis]);const l=n.sort((e,t)=>e.rank-t.rank||e.i-t.i).map(t=>{const{p:n,i:o,emphasis:r,readingOrder:i}=t,a=fo(n.annotation);let s=n.node;if("primary"===r||"secondary"===r||null!=i){const t=null==r&&null!=i;s=e("g",Object.assign({className:t?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+r},"secondary"===r?{opacity:.6,fontSize:"0.88em"}:{},t?{opacity:po(i),"data-annotation-reading-order":i}:{},{children:n.node}),"annotation-emphasis-"+o)}const l=go(n.annotation);return l&&(s=e("g",{className:"annotation-cohesion--"+l,children:s},"annotation-cohesion-"+o)),a&&(s=e("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:s},"annotation-deferred-"+o)),s});return r&&l.unshift(e("style",{children:ho},"annotation-disclosure-style")),a&&l.unshift(e("style",{children:".annotation-cohesion--layer text,.annotation-cohesion--layer tspan{fill:var(--semiotic-annotation-color,var(--semiotic-text-secondary,#666));font-style:italic}"},"annotation-cohesion-style")),l}(M.reduce((t,n,r)=>{if("widget"===n.type||!S)return t;const i=S(n,r,A);return i&&t.push({node:e(o.Fragment,{children:i},"annotation-"+r),annotation:n}),t},[])):null,O=!0===(null==M?void 0:M.some(e=>"widget"===e.type&&!0===e._annotationDeferred));return t(n,{children:[O&&e("style",{children:ho},"annotation-widget-disclosure-style"),t("svg",{role:"img",width:s,height:l,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[e("title",{children:"string"==typeof u?u:"Network Chart"}),e("desc",{children:"string"==typeof u?u+" — network data visualization":"Network data visualization"}),t("g",{transform:`translate(${c.left},${c.top})`,children:[d.map((t,n)=>e("text",{x:t.x,y:t.y,textAnchor:t.anchor||"start",dominantBaseline:t.baseline||"middle",fontSize:t.fontSize||11,fontWeight:t.fontWeight,fill:t.fill||"currentColor",stroke:t.stroke,strokeWidth:t.strokeWidth,paintOrder:t.paintOrder,style:{pointerEvents:"none"},children:t.text},"label-"+n)),L,b]}),u&&"string"==typeof u?e("text",{x:s/2,y:16,textAnchor:"middle",fontWeight:600,fill:"currentColor",className:"semiotic-chart-title",style:{fontSize:"var(--semiotic-title-font-size, 14px)"},children:u}):u?e("foreignObject",{x:0,y:0,width:s,height:c.top,children:u}):null,co({legend:h,totalWidth:s,totalHeight:l,margin:c,legendPosition:v,title:u,legendLayout:m,legendHoverBehavior:f,legendClickBehavior:g,legendHighlightedCategory:y,legendIsolatedCategories:p})]}),null==M?void 0:M.filter(e=>"widget"===e.type&&e.nodeId&&x).map((t,n)=>{var o,r,i,a,s,l,d,u,h;const f=!0===t._annotationDeferred,g=x.find(e=>{var n,o,r,i,a;return e.id===t.nodeId||(null===(n=e.datum)||void 0===n?void 0:n.id)===t.nodeId||(null===(r=null===(o=e.datum)||void 0===o?void 0:o.data)||void 0===r?void 0:r.id)===t.nodeId||(null===(a=null===(i=e.datum)||void 0===i?void 0:i.data)||void 0===a?void 0:a.name)===t.nodeId});if(!g)return null;const y=c.left+(null!==(o=g.cx)&&void 0!==o?o:null!=g.x&&null!=g.w?g.x+g.w/2:null!==(r=g.x)&&void 0!==r?r:0),p=c.top+(null!==(i=g.cy)&&void 0!==i?i:null!=g.y&&null!=g.h?g.y+g.h/2:null!==(a=g.y)&&void 0!==a?a:0),v=null!==(s=t.dx)&&void 0!==s?s:0,m=null!==(l=t.dy)&&void 0!==l?l:-16,b=null!==(d=t.width)&&void 0!==d?d:32,k=null!==(u=t.height)&&void 0!==u?u:32,w=null!==(h=t.content)&&void 0!==h?h:e("span",{style:{fontSize:18,cursor:"default"},children:"ℹ️"});return e("div",{className:f?"annotation-deferred":void 0,"data-annotation-disclosure":f?"deferred":void 0,style:{position:"absolute",left:y+v-b/2,top:p+m-k/2,width:b,height:k,display:"flex",alignItems:"center",justifyContent:"center",zIndex:5},children:w},"widget-"+n)})]})}Ro.displayName="NetworkSVGOverlay";const zo={position:"absolute",top:0,left:0,pointerEvents:"none"};function Ho({marks:t,margin:n,selection:r=null,overscan:i=400}){const a=o.useRef(null),s=function(e,t,n){const[r,i]=o.useState(null);return o.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)},a=()=>{0===o&&(o=window.requestAnimationFrame(r))};r(),n.addEventListener("scroll",a,{passive:!0});const s=new ResizeObserver(a);return s.observe(n),()=>{0!==o&&window.cancelAnimationFrame(o),n.removeEventListener("scroll",a),s.disconnect()}},[t,e,n]),o.useMemo(()=>{if(!e||!r)return e;const{scroll:t,originX:o,originY:i}=r,a=t.left-n,s=t.right+n,l=t.top-n,c=t.bottom+n;return e.filter(e=>{const t=o+e.x,n=i+e.y;return!(a>t+e.width||t>s||l>n+e.height||n>c)})},[e,r,n])}(t,a,i);if(!t||0===t.length)return null;const l=e("div",{className:"semiotic-network-html-marks",ref:a,style:Object.assign(Object.assign({},zo),{transform:`translate(${n.left}px, ${n.top}px)`}),children:(null!=s?s:t).map(t=>e("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!=r?e(ln,{value:r,children:l}):l}const Fo={innerRadius:0,outerRadius:0,startAngle:0,endAngle:0};function Yo(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const Xo="undefined"==typeof window||"undefined"==typeof document,Go="undefined"!=typeof window?h:u,qo=()=>()=>{},Vo=()=>!1,Ko=()=>!0;function Qo(e){const t=r(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return Uo(e,t);if(!Jo(e)||!Jo(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],r=t[o];if(!Object.is(n,r))if(Array.isArray(n)&&Array.isArray(r)){if(!Uo(n,r))return!1}else{if(!Jo(n)||!Jo(r))return!1;if(!Zo(n,r))return!1}}return!0}(t.current,e)||(t.current=e),t.current}function Zo(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 Uo(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 Jo(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 er=o.createContext(null),tr={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function nr(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 or=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},rr="semiotic-accessible-data-table",ir=rr+" semiotic-accessible-data-table-hidden",ar=rr+" semiotic-accessible-data-table-visible semiotic-accessible-data-table-network",sr={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"},lr={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},cr={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)"},dr={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},ur={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))"},hr={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},fr={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},gr={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 yr({nodes:n,edges:r,chartType:i,tableId:a,chartTitle:s}){var l,c,d,u,h,f,g,y,p,v,m,b,x,k;const[w,S]=o.useState(!1),[A,M]=o.useState(5),L=o.useContext(er),O=null!==(l=null==L?void 0:L.visible)&&void 0!==l&&l,D=w||O,E=s?"Data summary for "+s:a?`Data summary for ${i} ${a}`:"Data summary for "+i,_=o.useRef(null);o.useEffect(()=>{D||M(5)},[D]);const N=o.useCallback(e=>{e.target===e.currentTarget&&(w||O||S(!0))},[w,O]),P=o.useCallback(e=>{var t;O||(null===(t=_.current)||void 0===t?void 0:t.contains(e.relatedTarget))||S(!1)},[O]);if(!n||0===n.length)return a?e("span",{id:a,tabIndex:-1,style:tr}):null;if(!D)return e("div",{id:a,className:ir,tabIndex:-1,onFocus:N,style:tr,role:"region","aria-label":E,children:t("button",{type:"button",onClick:()=>S(!0),children:["View data summary (",n.length," nodes, ",r.length," edges)"]})});const T=Array.isArray(n)?n:[],C=Array.isArray(r)?r:[],I=new Map,j=new Map,W=new Map,$=new Map;for(const e of C){if(!e||"object"!=typeof e)continue;const t=null!==(c=e.datum)&&void 0!==c?c:e,n="object"==typeof t.source?null===(d=t.source)||void 0===d?void 0:d.id:t.source,o="object"==typeof t.target?null===(u=t.target)||void 0===u?void 0:u.id:t.target,r="number"==typeof t.value&&Number.isFinite(t.value)?t.value:0;if(null!=n&&""!==n){const e=n+"";j.set(e,(null!==(h=j.get(e))&&void 0!==h?h:0)+1),$.set(e,(null!==(f=$.get(e))&&void 0!==f?f:0)+r)}if(null!=o&&""!==o){const e=o+"";I.set(e,(null!==(g=I.get(e))&&void 0!==g?g:0)+1),W.set(e,(null!==(y=W.get(e))&&void 0!==y?y:0)+r)}}const B=[];for(let e=0;T.length>e;e++){const t=T[e];if(!t||"object"!=typeof t)continue;const n=null!==(v=null===(p=t.datum)||void 0===p?void 0:p.id)&&void 0!==v?v:t.id,o=null!=n?n+"":"node-"+e,r=null!==(m=I.get(o))&&void 0!==m?m:0,i=null!==(b=j.get(o))&&void 0!==b?b:0,a=null!==(x=W.get(o))&&void 0!==x?x:0,s=null!==(k=$.get(o))&&void 0!==k?k:0;B.push({id:o,degree:r+i,inDeg:r,outDeg:i,wDegree:a+s,wInDeg:a,wOutDeg:s})}B.sort((e,t)=>t.degree-e.degree);let R=0,z=0;if(B.length>0){let e=0;for(const t of B)e+=t.degree,t.degree>z&&(z=t.degree);R=e/B.length}const H=C.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)}),F=[`${B.length} nodes, ${C.length} edges.`];B.length>0&&F.push(`Mean degree: ${or(R)}, max degree: ${z}.`);const Y=Math.min(A,B.length),X=B.slice(0,Y),G=B.length-Y;return t("div",{ref:_,id:a,className:ar,tabIndex:-1,onBlur:P,style:sr,role:"region","aria-label":E,children:[e("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{O&&L&&L.setVisible(!1),S(!1)},"aria-label":"Close data summary",style:cr,children:"×"}),e("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:lr,children:F.join(" ")}),t("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Node degree summary for "+i,style:dr,children:[e("caption",{className:"semiotic-accessible-data-table-caption",style:fr,children:G>0?`Top ${Y} of ${B.length} nodes by degree`:`All ${B.length} nodes by degree`}),e("thead",{children:t("tr",{children:[e("th",{style:ur,children:"id"}),e("th",{style:ur,children:"degree"}),e("th",{style:ur,children:"in"}),e("th",{style:ur,children:"out"}),H&&e("th",{style:ur,children:"w. degree"}),H&&e("th",{style:ur,children:"w. in"}),H&&e("th",{style:ur,children:"w. out"})]})}),e("tbody",{children:X.map((n,o)=>t("tr",{children:[e("td",{style:hr,children:n.id}),e("td",{style:hr,children:n.degree}),e("td",{style:hr,children:n.inDeg}),e("td",{style:hr,children:n.outDeg}),H&&e("td",{style:hr,children:or(n.wDegree)}),H&&e("td",{style:hr,children:or(n.wInDeg)}),H&&e("td",{style:hr,children:or(n.wOutDeg)})]},o))})]}),G>0&&t("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>M(e=>e+25),style:gr,children:["Show ",Math.min(25,G)," more"," ",1===G?"node":"nodes"," (",G," remaining)"]})]})}function pr({summary:t}){return t?e("div",{role:"note",style:tr,children:t}):null}function vr({tableId:t}){return e("a",{href:"#"+t,style:tr,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,tr)},children:"Skip to data table"})}function mr({hoverPoint:t}){let n="";if(t){const e=t.data||t;n="object"==typeof e?"Data point: "+Object.entries(e).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Data point: "+e}return e("div",{"aria-live":"polite","aria-atomic":"true",style:tr,children:n})}const br=Object.freeze([]);function xr(e){if(!e)return br;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}function kr(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function wr(e,t,n=.3){kr(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 Sr(e,t,n=.6){var o,r,i,a,s;if(!kr(t))return;const l=null!==(o=t._pulseGlowRadius)&&void 0!==o?o:4,c=t.r+l*t._pulseIntensity,d=null!==(i=null!==(r=t.cx)&&void 0!==r?r:t.x)&&void 0!==i?i:0,u=null!==(s=null!==(a=t.cy)&&void 0!==a?a:t.y)&&void 0!==s?s:0;e.beginPath(),e.arc(d,u,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()}const Ar=new Map;function Mr(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=Ar.get(n);return o||(o=new Path2D(gn(e.symbolType,e.size)),Ar.size>256&&Ar.clear(),Ar.set(n,o)),o}catch(e){return null}}function Lr(e){return e._cachedPath2D&&e._cachedPath2DSource===e.pathD||(e._cachedPath2D=new Path2D(e.pathD),e._cachedPath2DSource=e.pathD),e._cachedPath2D}function Or(e,t){var n,o,r,i,a,s;if(!t.pathD)return;e.save();const l=Lr(t);if(t.style.fill&&"none"!==t.style.fill){const a=t._gradient;if(a){const r=e.createLinearGradient(a.x0,0,a.x1,0),i=null!==(o=null!==(n=t.style.fillOpacity)&&void 0!==n?n:t.style.opacity)&&void 0!==o?o:.5,s="string"==typeof t.style.fill?t.style.fill:"#999",l=qn(e,s)||s;r.addColorStop(0,1===a.from?l:"transparent"),r.addColorStop(1,1===a.to?l:"transparent"),e.fillStyle=r,e.globalAlpha=i}else e.fillStyle="string"==typeof t.style.fill&&qn(e,t.style.fill)||t.style.fill,e.globalAlpha=null!==(i=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==i?i:.5;e.fill(l)}t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=qn(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(a=t.style.strokeWidth)&&void 0!==a?a:.5,e.globalAlpha=.5*(null!==(s=t.style.opacity)&&void 0!==s?s:1),e.stroke(l)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.2*t._pulseIntensity,e.fill(l)),e.restore()}function Dr(e,t){var n,o;e.save();const r=t.style.stroke||"#999";e.strokeStyle=qn(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),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 Er(e,t){var n,o,r,i;if(!t.pathD)return;e.save();const a=Lr(t);t.style.fill&&"none"!==t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&qn(e,t.style.fill)||t.style.fill,e.globalAlpha=null!==(o=null!==(n=t.style.fillOpacity)&&void 0!==n?n:t.style.opacity)&&void 0!==o?o:.5,e.fill(a)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=qn(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(r=t.style.strokeWidth)&&void 0!==r?r:.5,e.globalAlpha=.3*(null!==(i=t.style.opacity)&&void 0!==i?i:1),e.stroke(a)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.25*t._pulseIntensity,e.fill(a)),e.restore()}function _r(e,t){var n,o;if(!t.pathD)return;e.save();const r=Lr(t),i=t.style.stroke||"#999";e.strokeStyle=qn(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),e.stroke(r),t.style.fill&&"none"!==t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&qn(e,t.style.fill)||t.style.fill,e.globalAlpha=null!==(o=t.style.fillOpacity)&&void 0!==o?o:.1,e.fill(r)),e.restore()}const Nr={top:20,right:80,bottom:20,left:80},Pr={top:40,right:40,bottom:40,left:40},Tr=new Set(["chord","force","circlepack","orbit"]),Cr=[800,600],Ir={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 jr({data:n}){var o,r,i,a,s,l,c;if("edge"===n.nodeOrEdge){const e=n.data;return e?t("div",{className:"semiotic-tooltip",style:Ir,children:[t("div",{style:{fontWeight:600},children:["object"==typeof e.source?e.source.id:e.source," → ","object"==typeof e.target?e.target.id:e.target]}),null!=e.value&&t("div",{style:{marginTop:4,opacity:.8},children:["Value:"," ","number"==typeof e.value?e.value.toLocaleString():e.value+""]})]}):null}const d=n.data;if(!d)return null;const u=d.__hierarchyNode;if(u){const n=[];let s=u;for(;s;){const e=null!==(a=null!==(r=null===(o=s.data)||void 0===o?void 0:o.name)&&void 0!==r?r:null===(i=s.data)||void 0===i?void 0:i.id)&&void 0!==a?a:d.id;null!=e&&n.unshift(e+""),s=s.parent}n.length>1&&n.shift();const l=n.length-1;return t("div",{className:"semiotic-tooltip",style:Ir,children:[e("div",{children:n.map((n,o)=>t("span",{children:[o>0&&e("span",{style:{margin:"0 3px",opacity:.5},children:" → "}),o===l?e("strong",{children:n}):e("span",{style:{opacity:.7},children:n})]},o))}),null!=d.value&&d.value>0&&e("div",{style:{marginTop:4,opacity:.8},children:"number"==typeof d.value?d.value.toLocaleString():d.value+""})]})}const h=((null===(s=d.sourceLinks)||void 0===s?void 0:s.length)||0)+((null===(l=d.targetLinks)||void 0===l?void 0:l.length)||0),f=(d.sourceLinks||[]).reduce((e,t)=>e+(t.value||0),0)+(d.targetLinks||[]).reduce((e,t)=>e+(t.value||0),0),g=function(e,t={}){var n;if(!e||"object"!=typeof e)return{entries:[]};const o=null!==(n=t.maxEntries)&&void 0!==n?n:6,r=!1!==t.skipPositional,i=[];for(const[t,n]of Object.entries(e)){if(t.startsWith("_"))continue;if("data"===t)continue;if(r&&oe.has(t.toLowerCase()))continue;if(null==n)continue;const e=typeof n;("string"===e||"number"===e||"boolean"===e||n instanceof Date)&&i.push({key:t,lower:t.toLowerCase(),value:n})}if(0===i.length)return{entries:[]};let a=i.findIndex(e=>ee.includes(e.lower));const s=a>=0;0>a&&(a=i.findIndex(e=>"id"===e.lower)),0>a&&(a=i.findIndex(e=>"string"==typeof e.value));const l=0>a?void 0:i[a];let c=i.filter((e,t)=>t!==a);s&&(c=c.filter(e=>"id"!==e.lower));const d=re(c,te),u=re(c,ne),h=new Set(te),f=new Set(ne),g=[];d&&g.push({key:d.key,value:d.value}),u&&g.push({key:u.key,value:u.value});for(const e of c){if(g.length>=o)break;e!==d&&e!==u&&(h.has(e.lower)||f.has(e.lower)||g.push({key:e.key,value:e.value}))}return{titleKey:null==l?void 0:l.key,title:null==l?void 0:l.value,entries:g}}(null!==(c=d.data)&&void 0!==c?c:d),y=null!=g.title?g.title+"":d.id,p=g.entries.some(e=>Wr.test(e.key));return t("div",{className:"semiotic-tooltip",style:Ir,children:[e("div",{style:{fontWeight:600},children:y}),g.entries.map(e=>{return t("div",{style:{marginTop:4,opacity:.8},children:[e.key,": ",(n=e.value,null==n?"–":"number"==typeof n?Math.abs(n)>9999?n.toLocaleString():n+"":n instanceof Date?n.toLocaleDateString():n+"")]},e.key);var n}),!p&&null!=d.value&&d.value>0&&t("div",{style:{marginTop:4,opacity:.8},children:["Total:"," ","number"==typeof d.value?d.value.toLocaleString():d.value+""]}),h>0&&t("div",{style:{marginTop:4,opacity:.8},children:["Connections: ",h,f!==h&&` (weighted: ${f.toLocaleString()})`]})]})}const Wr=/^(value|amount|total|count|weight|score)$/i;jr.ownsChrome=!0;const $r=f(function(n,o){var a,c,h,f,y,p,v,m,b,x,k,w,S,A,M,L,O,D,E;const{chartType:_,nodes:N,edges:P,data:T,initialEdges:I,nodeIDAccessor:j="id",sourceAccessor:W="source",targetAccessor:$="target",valueAccessor:B="value",edgeIdAccessor:R,childrenAccessor:z,hierarchySum:H,orientation:F="horizontal",nodeAlign:Y="justify",nodePaddingRatio:X=.05,nodeWidth:G=15,iterations:q=300,forceStrength:V=.1,padAngle:K=.01,groupWidth:Q=20,sortGroups:Z,edgeSort:U,treeOrientation:ee="vertical",edgeType:te="curve",padding:ne,paddingTop:oe,tensionConfig:re,showParticles:ie=!1,particleStyle:ae,nodeStyle:se,edgeStyle:le,colorBy:ce,colorScheme:he="category10",edgeColorBy:fe="source",edgeOpacity:ge=.5,colorByDepth:ye=!1,nodeSize:pe=8,nodeSizeRange:ve=[5,20],nodeLabel:me,showLabels:be=!0,labelMode:xe,size:ke=Cr,responsiveWidth:we,responsiveHeight:Se,margin:Ae,className:Me,background:Le,enableHover:Oe=!0,tooltipContent:De,customHoverBehavior:Ee,customClickBehavior:_e,onObservation:Ne,chartId:Pe,onTopologyChange:Te,annotations:Ce,autoPlaceAnnotations:Ie,svgAnnotationRules:je,legend:We,legendPosition:$e,legendLayout:Be,legendHoverBehavior:Re,legendClickBehavior:ze,legendHighlightedCategory:He,legendIsolatedCategories:Fe,title:Ye,foregroundGraphics:Xe,backgroundGraphics:Ge,decay:qe,pulse:Ve,transition:Ke,animate:Qe,staleness:Ze,thresholds:Ue,accessibleTable:Je=!0,description:et,summary:tt,orbitMode:nt,orbitSize:ot,orbitSpeed:rt,orbitRevolution:it,orbitRevolutionStyle:at,orbitEccentricity:st,orbitShowRings:lt,orbitAnimated:ct,customNetworkLayout:dt,layoutConfig:ut,layoutSelection:ht}=n,ft=Tr.has(_)?Pr:Nr,gt=r(!0),yt=Qn({sizeProp:ke,responsiveWidth:we,responsiveHeight:Se,userMargin:Ae,marginDefault:ft,foregroundGraphics:Xe,backgroundGraphics:Ge,animate:Qe,transitionProp:Ke,themeDirtyRef:gt}),{reducedMotionRef:pt,responsiveRef:vt,size:mt,margin:bt,adjustedWidth:xt,adjustedHeight:kt,resolvedForeground:wt,resolvedBackground:St,transition:At,introEnabled:Mt,tableId:Lt,rafRef:Ot,renderFnRef:Dt,scheduleRender:Et,currentTheme:_t}=yt,Nt=function(){const[e,t]=d(!1);return Go(()=>{t(!0)},[]),e}(),Pt=function(){const e=l(qo,Vo,Ko);return r(e).current}(),Tt=i(()=>xr(N),[N]),Ct=i(()=>Array.isArray(P)?xr(P):P,[P]),It=i(()=>Object.assign(Object.assign({},de),re),[re]),jt=i(()=>Object.assign(Object.assign({},ue),ae),[ae]),Wt=i(()=>{var e;return{chartType:_,nodeIDAccessor:j,sourceAccessor:W,targetAccessor:$,valueAccessor:B,edgeIdAccessor:R,childrenAccessor:z,hierarchySum:H,orientation:F,nodeAlign:Y,nodePaddingRatio:X,nodeWidth:G,iterations:q,forceStrength:V,padAngle:K,groupWidth:Q,sortGroups:Z,edgeSort:U,treeOrientation:ee,edgeType:te,padding:ne,paddingTop:oe,tensionConfig:It,showParticles:ie,particleStyle:jt,nodeStyle:se,edgeStyle:le,nodeLabel:me,showLabels:be,labelMode:xe,colorBy:ce,colorScheme:he,themeCategorical:null===(e=null==_t?void 0:_t.colors)||void 0===e?void 0:e.categorical,themeSemantic:Nn(_t),edgeColorBy:fe,edgeOpacity:ge,colorByDepth:ye,nodeSize:pe,nodeSizeRange:ve,decay:qe,pulse:Ve,transition:At,introAnimation:Mt,staleness:Ze,thresholds:Ue,orbitMode:nt,orbitSize:ot,orbitSpeed:rt,orbitRevolution:it,orbitRevolutionStyle:at,orbitEccentricity:st,orbitShowRings:lt,orbitAnimated:ct,customNetworkLayout:dt,layoutConfig:ut}},[_,j,W,$,B,z,H,F,Y,X,G,q,V,K,Q,Z,U,ee,te,ne,oe,It,ie,jt,se,le,me,be,xe,ce,he,fe,ge,ye,pe,ve,qe,Ve,null==At?void 0:At.duration,null==At?void 0:At.easing,Mt,Ze,Ue,nt,ot,rt,it,at,st,lt,ct,_t,dt,ut]),$t=Qo(Wt),Bt=Qo({chartType:_,nodeIDAccessor:j,sourceAccessor:W,targetAccessor:$,valueAccessor:B,childrenAccessor:z,hierarchySum:H,orientation:F,nodeAlign:Y,nodePaddingRatio:X,nodeWidth:G,iterations:q,forceStrength:V,padAngle:K,groupWidth:Q,sortGroups:Z,edgeSort:U,treeOrientation:ee,edgeType:te,padding:ne,paddingTop:oe,tensionConfig:It,orbitMode:nt,orbitSize:ot,orbitEccentricity:st,customNetworkLayout:dt}),Rt=r(null),zt=r(0),Ht=r(0),Yt=r(!1),Xt=r(null);Xt.current||(Xt.current=new en($t));const[Gt,qt]=d(null),[Vt,Kt]=d(0),[Qt,Zt]=d(0),[Ut,Jt]=d(!1),tn=r(null),nn=r(new Map),on=r(0),an=s(e=>{if("function"==typeof ce)return ce(e)+"";if("string"==typeof ce&&e.data){const t=e.data[ce];if(void 0!==t){if(!nn.current.has(t+"")){const e=Array.isArray(he)?he:Ft;nn.current.set(t+"",e[on.current++%e.length])}return nn.current.get(t+"")}}if(nn.current.has(e.id))return nn.current.get(e.id);const t=Array.isArray(he)?he:Ft,n=ce?t[on.current++%t.length]:t[0];return nn.current.set(e.id,n),n},[ce,he]),sn=(null===(a=null==_t?void 0:_t.colors)||void 0===a?void 0:a.border)||(null===(c=null==_t?void 0:_t.colors)||void 0===c?void 0:c.secondary)||(null===(h=null==_t?void 0:_t.colors)||void 0===h?void 0:h.primary)||"#999",ln=s(e=>{var t,n;return e?"object"==typeof e?e:null!==(n=null===(t=Xt.current)||void 0===t?void 0:t.nodes.get(e))&&void 0!==n?n:null:null},[]),cn=s(e=>{if("function"==typeof fe)return fe(e);const t=ln(e.source),n=ln(e.target);return"target"===fe&&n?an(n):t?an(t):sn},[fe,an,sn,ln]),un=s(e=>{if("function"==typeof jt.color){const t=ln(e.source);return t?jt.color(e,t):sn}if(!(null==ae?void 0:ae.colorBy))return cn(e);const t=jt.colorBy,n=ln(e.source),o=ln(e.target);return"target"===t&&o?an(o):n?an(n):sn},[null==ae?void 0:ae.colorBy,jt.color,jt.colorBy,an,cn,sn,ln]),hn=("sankey"===_||!!dt)&&ie||!!Ve||null!==(y=null===(f=Xt.current)||void 0===f?void 0:f.isAnimating)&&void 0!==y&&y;u(()=>{var e;null===(e=Xt.current)||void 0===e||e.updateConfig($t),gt.current=!0,Et()},[$t,Et]);const fn=r(null);u(()=>{const e=Xt.current;if(!e)return;const t=null!=ht?ht:null;fn.current!==t&&(fn.current=t,e.setLayoutSelection(t),e.hasCustomRestyle?e.restyleScene(t):gt.current=!0,Et())},[ht,Et]),u(()=>{var e;const t=Xt.current;if(t){t.buildScene([xt,kt]);for(const n of t.sceneNodes)n.id&&"string"==typeof(null===(e=n.style)||void 0===e?void 0:e.fill)&&nn.current.set(n.id,n.style.fill);gt.current=!0,Et()}},[_t,xt,kt,Et]);const yn=s(()=>{var e;const t=Xt.current;if(!t)return;t.runLayout([xt,kt]),t.buildScene([xt,kt]),gt.current=!0;for(const n of t.sceneNodes)n.id&&"string"==typeof(null===(e=n.style)||void 0===e?void 0:e.fill)&&nn.current.set(n.id,n.style.fill);const n=Array.isArray(he)?he:Ft,o=Array.from(t.nodes.values());for(let e=0;o.length>e;e++){const t=o[e];nn.current.has(t.id)||nn.current.set(t.id,n[e%n.length])}if(on.current=o.length,Kt(t.layoutVersion),Te){const{nodes:e,edges:n}=t.getLayoutData();Te(e,n)}},[xt,kt,Te,he]),vn=s(e=>{if(null==e||"object"!=typeof e)return;const t=Xt.current;t&&(t.ingestEdge(e)&&yn(),Et())},[yn,Et]),mn=s(e=>{const t=Xt.current;if(!t)return;let n=!1;for(const o of e)null!=o&&"object"==typeof o&&t.ingestEdge(o)&&(n=!0);n&&yn(),Et()},[yn,Et]),bn=s(()=>{var e,t,n;null===(e=Xt.current)||void 0===e||e.clear(),nn.current.clear(),on.current=0,Kt(null!==(n=null===(t=Xt.current)||void 0===t?void 0:t.layoutVersion)&&void 0!==n?n:0),qt(null),tn.current=null,gt.current=!0,Et()},[Et]),xn=s(()=>{const e=Xt.current;e&&(e.tension+=999,yn(),Et())},[yn,Et]);g(o,()=>({push:vn,pushMany:mn,removeNode:e=>{var t,n,o;const r=null!==(n=null===(t=Xt.current)||void 0===t?void 0:t.removeNode(e))&&void 0!==n&&n;if(r){const t=(null===(o=tn.current)||void 0===o?void 0:o.data)?"function"==typeof j?j(tn.current.data):tn.current.data[j]:void 0;tn.current&&"node"===tn.current.nodeOrEdge&&t===e&&(tn.current=null,qt(null)),nn.current.delete(e),yn(),gt.current=!0,Et()}return r},removeEdge:(e,t)=>{var n,o;const r=null!==(o=null===(n=Xt.current)||void 0===n?void 0:n.removeEdge(e,t))&&void 0!==o&&o;if(r){if(tn.current&&"edge"===tn.current.nodeOrEdge){const n=tn.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:!R||!n||("function"==typeof R?R:e=>null==e?void 0:e[R])(n)===e,o&&(tn.current=null,qt(null))}yn(),gt.current=!0,Et()}return r},updateNode:(e,t)=>{var n,o;const r=null!==(o=null===(n=Xt.current)||void 0===n?void 0:n.updateNode(e,t))&&void 0!==o?o:null;return r&&(gt.current=!0,Et()),r},updateEdge:(e,t,n)=>{var o,r;const i=null!==(r=null===(o=Xt.current)||void 0===o?void 0:o.updateEdge(e,t,n))&&void 0!==r?r:[];return i.length>0&&(yn(),gt.current=!0,Et()),i},clear:bn,getTopology:()=>{var e,t;return null!==(t=null===(e=Xt.current)||void 0===e?void 0:e.getLayoutData())&&void 0!==t?t:{nodes:[],edges:[]}},getTopologyDiff:()=>{const e=Xt.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:xn,getTension:()=>{var e,t;return null!==(t=null===(e=Xt.current)||void 0===e?void 0:e.tension)&&void 0!==t?t:0}}),[vn,mn,bn,xn,yn,Et]);const kn=["tree","cluster","treemap","circlepack","partition","orbit"].includes(_),wn=kn?T||(Array.isArray(P)?void 0:P):void 0;u(()=>{var e;const t=Xt.current;if(t)if(kn&&wn)t.ingestHierarchy(wn,[xt,kt]),t.buildScene([xt,kt]),gt.current=!0,Et();else{const n=Tt,o=Array.isArray(Ct)?Ct:[];if(0===n.length&&0===o.length)return;t.ingestBounded(n,o,[xt,kt]),t.buildScene([xt,kt]);for(const n of t.sceneNodes)n.id&&(null===(e=n.style)||void 0===e?void 0:e.fill)&&nn.current.set(n.id,n.style.fill+"");const r=Array.isArray(he)?he:Ft,i=Array.from(t.nodes.values());for(let e=0;i.length>e;e++){const t=i[e];nn.current.has(t.id)||nn.current.set(t.id,r[e%r.length])}on.current=i.length,gt.current=!0,Et()}},[Tt,Ct,T,wn,kn,xt,kt,Bt,Et,he]),u(()=>{I&&I.length>0&&mn(I)},[]);const An=s(e=>{if(Ee&&Ee(e),Ne){const t=Date.now();Ne(e?{type:"hover",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:Pe}:{type:"hover-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:Pe})}},[Ee,Ne,Pe]),Ln=s(e=>{if(_e&&_e(e),Ne){const t=Date.now();Ne(e?{type:"click",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:Pe}:{type:"click-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:Pe})}},[_e,Ne,Pe]),{hoverHandlerRef:En,hoverLeaveRef:_n,onPointerMove:Pn,onPointerLeave:Tn}=yt,Cn=()=>{var e,t;return!dt||null!==(t=null===(e=Xt.current)||void 0===e?void 0:e.hasCustomRestyle)&&void 0!==t&&t};En.current=e=>{if(!Oe)return;const t=Cn(),n=Rt.current;if(!n)return;const o=n.getBoundingClientRect(),r=e.clientX-o.left-bt.left,i=e.clientY-o.top-bt.top;if(0>r||r>xt||0>i||i>kt)return void(tn.current&&(tn.current=null,qt(null),An&&(An(null),t&&(gt.current=!0)),t&&Et()));const a=Xt.current;if(!a)return;const s=pn(a.sceneNodes,a.sceneEdges,r,i,30,a.nodeQuadtree,a.maxNodeRadius);if(!s)return void(tn.current&&(tn.current=null,qt(null),An&&(An(null),t&&(gt.current=!0)),t&&Et()));const l=J(s.datum||{},s.x,s.y,{nodeOrEdge:s.type});tn.current=l,qt(l),An&&(An(l),t&&(gt.current=!0)),t&&Et()},_n.current=()=>{if(tn.current){const e=Cn();tn.current=null,qt(null),An&&(An(null),e&&(gt.current=!0)),e&&Et()}};const In=r(()=>{});In.current=e=>{if(!_e&&!Ne)return;const t=Rt.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-bt.left,r=e.clientY-n.top-bt.top;if(0>o||o>xt||0>r||r>kt)return;const i=Xt.current;if(!i)return;const a=pn(i.sceneNodes,i.sceneEdges,o,r,30,i.nodeQuadtree,i.maxNodeRadius);Ln(a?J(a.datum||{},a.x,a.y,{nodeOrEdge:a.type}):null)};const jn=s(e=>In.current(e),[]),Wn=r(-1),$n=r(null),Bn=r(-1),Rn=s(e=>{var t;const n=Xt.current;if(!n)return;const o=function(e){var t,n,o,r,i,a,s,l;const c=[];for(const d of e)if("circle"===d.type&&null!=d.cx){if(0>=d.r)continue;c.push({x:d.cx,y:d.cy,datum:d.datum,shape:"circle",group:null!==(n=null===(t=d.datum)||void 0===t?void 0:t.id)&&void 0!==n?n:"_default"})}else if("rect"===d.type&&null!=d.x){if(0>=d.w||0>=d.h)continue;c.push({x:d.x+d.w/2,y:d.y+d.h/2,datum:d.datum,shape:"rect",w:d.w,h:d.h,group:null!==(r=null===(o=d.datum)||void 0===o?void 0:o.id)&&void 0!==r?r:"_default"})}else if("arc"===d.type&&null!=d.cx)c.push({x:d.cx,y:d.cy,datum:d.datum,shape:"circle",group:null!==(a=null===(i=d.datum)||void 0===i?void 0:i.id)&&void 0!==a?a:"_default"});else if("symbol"===d.type&&null!=d.cx){if(0>=d.size)continue;c.push({x:d.cx,y:d.cy,datum:d.datum,shape:"circle",group:null!==(l=null===(s=d.datum)||void 0===s?void 0:s.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 r=function(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 r=o.get(e);r||(r=[],o.set(e,r)),r.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 r=Array.from(o.keys()).sort((e,t)=>{const n=o.get(e),r=o.get(t);return(n.length>0?n[0].y:0)-(r.length>0?r[0].y:0)}),i=Array.from(o.values()).flat();i.sort((e,t)=>e.x-t.x||e.y-t.y);const a=new Map;for(let e=0;i.length>e;e++){i[e]._flatIndex=e;const t=null===(n=i[e].datum)||void 0===n?void 0:n.id;null!=t&&a.set(t+"",e)}return{flat:i,groups:r,byGroup:o,idToIdx:a}}(o),i=Wn.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown","Enter"].includes(e.key))return;e.preventDefault(),Wn.current=0,Bn.current=-1;const t=r.flat[0];$n.current={shape:t.shape,w:t.w,h:t.h};const n=J(t.datum||{},t.x,t.y,{nodeOrEdge:"node"});return tn.current=n,qt(n),An&&(An(n),gt.current=!0),void Et()}const a=function(e,t){var n,o;if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const r=Math.max(0,Math.min(t,e.flat.length-1)),i=e.flat[r];return{flatIndex:r,group:null!==(n=i.group)&&void 0!==n?n:"_default",indexInGroup:null!==(o=i._groupIndex)&&void 0!==o?o:0}}(r,i),s=function(e,t,n,o,r){var i,a,s;const l=n.flat[t.flatIndex];if(!l)return Sn(e,t,n);const c=null===(i=l.datum)||void 0===i?void 0:i.id;switch(e){case"ArrowRight":case"ArrowLeft":case"ArrowDown":case"ArrowUp":{const o=null!==(a=function(e,t,n){let o=null,r=1/0;for(let i=0;e.flat.length>i;i++){const a=e.flat[i];if(a===t)continue;const s=a.x-t.x,l=a.y-t.y;let c=!1;switch(n){case"right":c=s>0&&Math.abs(s)>=Math.abs(l);break;case"left":c=0>s&&Math.abs(s)>=Math.abs(l);break;case"down":c=l>0&&Math.abs(l)>=Math.abs(s);break;case"up":c=0>l&&Math.abs(l)>=Math.abs(s)}if(!c)continue;const d=s*s+l*l;r>d&&(r=d,o=i)}return o}(n,l,"ArrowRight"===e?"right":"ArrowLeft"===e?"left":"ArrowDown"===e?"down":"up"))&&void 0!==a?a:t.flatIndex;return o!==t.flatIndex&&(r.current=-1),o}case"Enter":{if(null==c)return t.flatIndex;const e=function(e,t){var n;const o=e+"",r=[];for(const e of t){const t=null!==(n=e.datum)&&void 0!==n?n:e,i=Mn(t.source),a=Mn(t.target),s=null!=i,l=null!=a;s&&i+""===o&&l?r.push(a+""):l&&a+""===o&&s&&r.push(i+"")}return r}(c,o);if(0===e.length)return t.flatIndex;const i=null!==(s=n.idToIdx.get(e[(r.current+1)%e.length]))&&void 0!==s?s:-1;return 0>i?t.flatIndex:(r.current=-1,i)}default:{const o=Sn(e,t,n);return null!==o&&o!==t.flatIndex&&(r.current=-1),o}}}(e.key,a,r,null!==(t=n.sceneEdges)&&void 0!==t?t:[],Bn);if(null===s)return;if(e.preventDefault(),0>s)return Wn.current=-1,$n.current=null,Bn.current=-1,tn.current=null,qt(null),An&&(An(null),gt.current=!0),void Et();Wn.current=s;const l=r.flat[s];$n.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"};tn.current=c,qt(c),An&&(An(c),gt.current=!0),Et()},[An,Et]),zn=s(e=>{Wn.current=-1,$n.current=null,Pn(e)},[Pn]);Dt.current=()=>{var e,t,n,o,r,i,a;Ot.current=0;const s=Rt.current;if(!s)return;const l=s.getContext("2d");if(!l)return;const c=Xt.current;if(!c)return;const d=performance.now(),u=zt.current?Math.min((d-zt.current)/1e3,.1):.016;zt.current=d;const h=c.advanceTransition(pt.current?d+1e6:d),f=!pt.current&&h,g=!pt.current&&c.tickAnimation([xt,kt],u);(h||gt.current||g)&&c.buildScene([xt,kt]);const y="undefined"!=typeof window&&window.devicePixelRatio||1;if(!function(e,t,n,o){const r=e.getContext("2d");if(!r)return null;const i=t[0]*o,a=t[1]*o,s=t[0]+"px",l=t[1]+"px";return e.style.width!==s&&(e.style.width=s),e.style.height!==l&&(e.style.height=l),e.width===i&&e.height===a||(e.width=i,e.height=a),r.setTransform(o,0,0,o,0,0),r.translate(n.left,n.top),r}(s,mt,bt,y))return;if(l.clearRect(-bt.left,-bt.top,mt[0],mt[1]),Le){const e=qn(l,Le);e&&(l.fillStyle=e,l.fillRect(0,0,xt,kt))}qe&&c.applyDecay(),Ve&&c.applyPulse(d),Ue&&c.applyThresholds(d),!1!==Qe&&c.applyTopologyDiff(d);const p=null!==(e=null==Ze?void 0:Ze.threshold)&&void 0!==e?e:5e3,v=Ze&&c.lastIngestTime>0&&d-c.lastIngestTime>p;if(v&&(l.globalAlpha=null!==(t=null==Ze?void 0:Ze.dimOpacity)&&void 0!==t?t:.5),function(e,t){for(const n of t)switch(n.type){case"bezier":Or(e,n);break;case"line":Dr(e,n);break;case"ribbon":Er(e,n);break;case"curved":_r(e,n)}}(l,c.sceneEdges),function(e,t){var n,o,r;for(const i of t){if("rect"!==i.type)continue;const t=i;t.w>0&&t.h>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&qn(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=qn(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,e.globalAlpha=null!==(r=t.style.opacity)&&void 0!==r?r:1,e.strokeRect(t.x,t.y,t.w,t.h)),wr(e,t),e.restore())}}(l,c.sceneNodes),function(e,t){var n,o,r;for(const i of t){if("circle"!==i.type)continue;const t=i;t.r>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.r,0,2*Math.PI),t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&qn(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=qn(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,e.globalAlpha=null!==(r=t.style.opacity)&&void 0!==r?r:1,e.stroke()),Sr(e,t),e.restore())}}(l,c.sceneNodes),function(e,t){var n,o,r;for(const i of t){if("arc"!==i.type)continue;const t=i;e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.outerR,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerR,t.endAngle,t.startAngle,!0),e.closePath(),t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&qn(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=qn(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,e.globalAlpha=null!==(r=t.style.opacity)&&void 0!==r?r:1,e.stroke()),e.restore()}}(l,c.sceneNodes),function(e,t){var n,o,r;const i=e.globalAlpha;for(const a of t){if("symbol"!==a.type)continue;const t=a;if(0>=t.size)continue;const s=Mr(t);if(!s)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=i*l*(null!==(o=t.style.fillOpacity)&&void 0!==o?o:1),e.fillStyle="string"==typeof t.style.fill&&qn(e,t.style.fill)||t.style.fill,e.fill(s)),t.style.stroke&&"none"!==t.style.stroke&&(e.globalAlpha=i*l,e.strokeStyle=qn(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(r=t.style.strokeWidth)&&void 0!==r?r:1,e.stroke(s)),e.restore()}}(l,c.sceneNodes),ie&&c.particlePool&&!v){const e=c.edgesArray;if(e.length>0){!function(e,t,n,o){var r,i;const a=null!==(r=o.spawnRate)&&void 0!==r?r:ue.spawnRate,s=null!==(i=o.maxPerEdge)&&void 0!==i?i:ue.maxPerEdge;for(let o=0;t.length>o;o++){const r=t[o];if(!r.bezier)continue;if(e.countForEdge(o)>=s)continue;const i=r.value*a*n*(r.bezier.circular?.3:1),l=Math.floor(i),c=i-l;let d=l;Math.random()<c&&d++;for(let t=0;d>t&&e.countForEdge(o)<s;t++)e.spawn(o)}}(c.particlePool,e,u,jt);const t=.5*(null!==(n=jt.speedMultiplier)&&void 0!==n?n:1);let o;if(jt.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(u,t,e,o),function(e,t,n,o,r){var i,a;const s=null!==(i=o.radius)&&void 0!==i?i:ue.radius,l=null!==(a=o.opacity)&&void 0!==a?a:ue.opacity;e.globalAlpha=l;for(let i=0;t.particles.length>i;i++){const a=t.particles[i];if(!a.active)continue;const l=n[a.edgeIndex];if(!l)continue;let c;c="string"==typeof o.color&&"inherit"!==o.color?o.color:r(l),e.fillStyle=qn(e,c)||c,e.beginPath(),e.arc(a.x,a.y,s,0,2*Math.PI),e.fill()}e.globalAlpha=1}(l,c.particlePool,e,jt,un)}}v&&(l.globalAlpha=1);const m=gt.current;if(gt.current=!1,m||f||g){const e=Rt.current;e&&e.setAttribute("aria-label",nr(null!==(r=null===(o=c.sceneNodes)||void 0===o?void 0:o.length)&&void 0!==r?r:0,null!==(a=null===(i=c.sceneEdges)||void 0===i?void 0:i.length)&&void 0!==a?a:0,"Network chart"))}const b=m||f||g||Yt.current;b&&d-Ht.current>=33?(Zt(e=>e+1),Ht.current=d,Yt.current=!1):Yt.current=!!b,(hn||f||null!=c.transition||g||c.hasActivePulses||c.hasActiveThresholds||!1!==Qe&&c.hasActiveTopologyDiff||Yt.current)&&(Ot.current=requestAnimationFrame(()=>Dt.current()))},function(e){const{hydrated:t,wasHydratingFromSSR:n,storeRef:o,dirtyRef:i,renderFnRef:a,cleanup:s}=e;Go(()=>{var e,r;t&&n&&(null===(r=null===(e=o.current)||void 0===e?void 0:e.cancelIntroAnimation)||void 0===r||r.call(e)),i.current=!0,a.current()},[t,n]);const l=r(s);l.current=s,u(()=>()=>{var e;return null===(e=l.current)||void 0===e?void 0:e.call(l)},[])}({hydrated:Nt,wasHydratingFromSSR:Pt,storeRef:Xt,dirtyRef:gt,renderFnRef:Dt}),u(()=>{gt.current=!0,Et()},[_,xt,kt,Le,Et]),function(e,t,n,o,i,a){const s=r("fresh");u(()=>{if(!e)return;const r=setInterval(()=>{const r=t.current;if(!r||0===r.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=function(e,t){var n,o;if(!e||0>=t)return Un;const r=null!=e.threshold&&e.threshold>0?e.threshold:5e3,i=e.graded;if(i){const e="object"==typeof i?i:{},o=function(e,t,n={}){var o,r,i;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 a=null!==(o=n.fresh)&&void 0!==o?o:1,s=null!==(r=n.aging)&&void 0!==r?r:1.5,l=null!==(i=n.stale)&&void 0!==i?i:3;return t*a>e?"fresh":t*s>e?"aging":t*l>e?"stale":"expired"}(t,r,e.thresholds);return{alpha:Object.assign(Object.assign({},Zn),null!==(n=e.opacities)&&void 0!==n?n:{})[o],band:o,isStale:"fresh"!==o}}return t>r?{alpha:null!==(o=e.dimOpacity)&&void 0!==o?o:.5,band:"stale",isStale:!0}:Un}(e,l-r.lastIngestTime);c.band===s.current&&c.isStale===i||(s.current=c.band,c.isStale!==i&&a(c.isStale),n.current=!0,o())},1e3);return()=>clearInterval(r)},[e,i,o])}(Ze,Xt,gt,Et,Ut,Jt);const Hn=Oe&&Gt?e(Dn,{x:Gt.x,y:Gt.y,containerWidth:xt,containerHeight:kt,margin:bt,className:"stream-network-tooltip",zIndex:2,children:De?De(Gt):e(jr,{data:Gt})}):null;if(Xo||!Nt&&Pt){const n=Xt.current;if(n){const e=["tree","cluster","treemap","circlepack","partition","orbit"].includes(_),t=e?T||(Array.isArray(P)?void 0:P):void 0;if(e&&t)n.ingestHierarchy(t,[xt,kt]),n.buildScene([xt,kt]);else{const e=Tt,t=Array.isArray(Ct)?Ct:[];(e.length>0||t.length>0)&&(n.ingestBounded(e,t,[xt,kt]),n.buildScene([xt,kt]))}}const o=null!==(p=null==n?void 0:n.sceneNodes)&&void 0!==p?p:[],r=null!==(v=null==n?void 0:n.sceneEdges)&&void 0!==v?v:[],i=null!==(m=null==n?void 0:n.labels)&&void 0!==m?m:[];return t("div",{ref:vt,className:"stream-network-frame"+(Me?" "+Me:""),role:"img","aria-label":et||("string"==typeof Ye?Ye:"Network chart"),style:{position:"relative",width:we?"100%":mt[0],height:Se?"100%":mt[1]},children:[e(pr,{summary:tt}),t("svg",{xmlns:"http://www.w3.org/2000/svg",width:mt[0],height:mt[1],style:{position:"absolute",left:0,top:0},children:[St&&e("g",{transform:`translate(${bt.left},${bt.top})`,children:St}),t("g",{transform:`translate(${bt.left},${bt.top})`,children:[Le&&e("rect",{x:0,y:0,width:xt,height:kt,fill:Le}),r.map((t,n)=>function(t,n){switch(t.type){case"line":return e("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.stroke||"#999",strokeWidth:t.style.strokeWidth||1,opacity:t.style.opacity},"net-edge-"+n);case"bezier":{const o=t;return e("path",{d:o.pathD,fill:Yo(o.style.fill,"#999"),fillOpacity:o.style.fillOpacity,stroke:o.style.stroke||"none",strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},"net-edge-"+n)}case"ribbon":{const o=t;return e("path",{d:o.pathD,fill:Yo(o.style.fill,"#999"),fillOpacity:o.style.fillOpacity,stroke:o.style.stroke||"none",strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},"net-edge-"+n)}case"curved":{const o=t;return e("path",{d:o.pathD,fill:Yo(o.style.fill,"none"),stroke:o.style.stroke||"#999",strokeWidth:o.style.strokeWidth||1,opacity:o.style.opacity},"net-edge-"+n)}default:return null}}(t,n)).filter(Boolean),o.map((t,n)=>function(t,n){switch(t.type){case"circle":{const o=t;return e("circle",{cx:o.cx,cy:o.cy,r:o.r,fill:Yo(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},"net-circle-"+n)}case"rect":{const o=t;return e("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:Yo(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},"net-rect-"+n)}case"arc":{const o=t,r=C().innerRadius(o.innerR).outerRadius(o.outerR).startAngle(o.startAngle+Math.PI/2).endAngle(o.endAngle+Math.PI/2)(Fo)||"";return e("path",{d:r,transform:`translate(${o.cx},${o.cy})`,fill:Yo(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},"net-arc-"+n)}case"symbol":{const o=t,r=gn(o.symbolType,o.size,o.path);return e("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?Yo(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("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(Ro,{width:xt,height:kt,totalWidth:mt[0],totalHeight:mt[1],margin:bt,labels:i,sceneNodes:o,title:Ye,legend:We,legendPosition:$e,legendLayout:Be,legendHoverBehavior:Re,legendClickBehavior:ze,legendHighlightedCategory:He,legendIsolatedCategories:Fe,foregroundGraphics:rn(wt,dn(null===(b=Xt.current)||void 0===b?void 0:b.customLayoutOverlays,null!=ht?ht:null)),annotations:Ce,autoPlaceAnnotations:Ie,svgAnnotationRules:je,annotationFrame:0}),e(Ho,{marks:null==n?void 0:n.customLayoutHtmlMarks,margin:bt,selection:null!=ht?ht:null})]})}const Fn=Xt.current;return t("div",{ref:vt,className:"stream-network-frame"+(Me?" "+Me:""),role:"group","aria-label":et||("string"==typeof Ye?Ye:"Network chart"),tabIndex:0,style:{position:"relative",width:we?"100%":mt[0],height:Se?"100%":mt[1],overflow:"visible"},onKeyDown:Rn,children:[Je&&e(vr,{tableId:Lt}),Je&&e(yr,{nodes:null!==(x=null==Fn?void 0:Fn.sceneNodes)&&void 0!==x?x:[],edges:null!==(k=null==Fn?void 0:Fn.sceneEdges)&&void 0!==k?k:[],chartType:"Network chart",tableId:Lt,chartTitle:"string"==typeof Ye?Ye:void 0}),e(pr,{summary:tt}),e(mr,{hoverPoint:Gt}),t("div",{role:"img","aria-label":et||("string"==typeof Ye?Ye:"Network chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Oe?zn:void 0,onMouseLeave:Oe?Tn:void 0,onClick:_e||Ne?jn:void 0,children:[St&&e("svg",{overflow:"visible",style:{position:"absolute",top:0,left:0,width:mt[0],height:mt[1],pointerEvents:"none",overflow:"visible"},children:e("g",{transform:`translate(${bt.left},${bt.top})`,children:St})}),e("canvas",{ref:Rt,"aria-label":nr(null!==(S=null===(w=null==Fn?void 0:Fn.sceneNodes)||void 0===w?void 0:w.length)&&void 0!==S?S:0,null!==(M=null===(A=null==Fn?void 0:Fn.sceneEdges)||void 0===A?void 0:A.length)&&void 0!==M?M:0,"Network chart"),style:{position:"absolute",top:0,left:0}}),e(Ro,{width:xt,height:kt,totalWidth:mt[0],totalHeight:mt[1],margin:bt,labels:(null==Fn?void 0:Fn.labels)||[],sceneNodes:null==Fn?void 0:Fn.sceneNodes,title:Ye,legend:We,legendPosition:$e,legendLayout:Be,legendHoverBehavior:Re,legendClickBehavior:ze,legendHighlightedCategory:He,legendIsolatedCategories:Fe,foregroundGraphics:rn(wt,dn(null===(L=Xt.current)||void 0===L?void 0:L.customLayoutOverlays,null!=ht?ht:null)),annotations:Ce,autoPlaceAnnotations:Ie,svgAnnotationRules:je,annotationFrame:Qt}),e(Ho,{marks:null==Fn?void 0:Fn.customLayoutHtmlMarks,margin:bt,selection:null!=ht?ht:null}),e(On,{active:Wn.current>=0,hoverPoint:Gt,margin:bt,size:mt,shape:null===(O=$n.current)||void 0===O?void 0:O.shape,width:null===(D=$n.current)||void 0===D?void 0:D.w,height:null===(E=$n.current)||void 0===E?void 0:E.h}),Hn,(null==Ze?void 0:Ze.showBadge)&&e(Jn,{isStale:Ut,position:Ze.badgePosition})]})]})});function Br(e,t){const{variant:n,frameRef:o,overrides:r,deps:i}=t;g(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,r;return null!==(r=null===(o=e.current)||void 0===o?void 0:o.update(t,n))&&void 0!==r?r:[]},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,r,i,a;const s=Array.isArray(t)?t:[t],l=null!==(r=null===(o=null===(n=e.current)||void 0===n?void 0:n.getTopology())||void 0===o?void 0:o.nodes)&&void 0!==r?r:[],c=[];for(const t of s){const n=l.find(e=>e.id===t);n&&c.push(Object.assign(Object.assign({},null!==(i=n.data)&&void 0!==i?i:{}),{id:t})),null===(a=e.current)||void 0===a||a.removeNode(t)}return c},update:(t,n)=>(Array.isArray(t)?t:[t]).flatMap(t=>{var o;const r=null===(o=e.current)||void 0===o?void 0:o.updateNode(t,n);return r?[Object.assign(Object.assign({},r),{id:t})]:[]}),clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n,o,r;return null!==(r=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!==r?r:[]}}}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,r,i;const a=null!==(r=null===(o=e.current)||void 0===o?void 0:o.removePoint(t))&&void 0!==r?r:[];for(const t of a)null===(i=e.current)||void 0===i||i.push(n(t));return a},clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]}}}const n=t;return{push:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.pushLine(e)},pushMany:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.pushManyLines(e)},remove:e=>{var t,o;return null!==(o=null===(t=n.current)||void 0===t?void 0:t.removeLine(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,r,i;const a=null!==(r=null===(o=n.current)||void 0===o?void 0:o.removeLine(e))&&void 0!==r?r:[];for(const e of a)null===(i=n.current)||void 0===i||i.pushLine(t(e));return a},clear:()=>{var e;return null===(e=n.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=n.current)||void 0===e?void 0:e.getLines())&&void 0!==t?t:[]}}}(n,o);return Object.assign(Object.assign({},e),r)},null!=i?i:[])}$r.displayName="StreamNetworkFrame";const Rr=c(null);function zr(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,r]=o.range;t.push(t=>{const o=t[n];return o>=e&&r>=o})}return e=>t.every(t=>t(e))}function Hr(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}function Fr(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}const[Yr,Xr]=En(e=>({selections:new Map,setClause(t,n){e(e=>{const o=e.selections.get(t),r=null==o?void 0:o.clauses.get(n.clientId);if(r&&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||!Fr(o,n))return!1}return!0}(r,n))return{};const i=new Map(e.selections),a=Hr(i,t),s=new Map(a.clauses);return s.set(n.clientId,n),i.set(t,Object.assign(Object.assign({},a),{clauses:s})),{selections:i}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o||!o.clauses.has(n))return{};const r=new Map(e.selections),i=new Map(o.clauses);return i.delete(n),r.set(t,Object.assign(Object.assign({},o),{clauses:i})),{selections:r}})},setResolution(t,n){e(e=>{const o=e.selections.get(t);if((null==o?void 0:o.resolution)===n)return{};const r=new Map(e.selections),i=Hr(r,t);return r.set(t,Object.assign(Object.assign({},i),{resolution:n})),{selections:r}})},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}})}})),[Gr,qr]=En(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}))}}));let Vr={positions:new Map};const Kr=new Set;function Qr(){for(const e of Kr)e()}function Zr(e,t){const n=Vr.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(Vr.positions);o.delete(e),Vr={positions:o},Qr()}function Ur(e){const t=y(),n=e.clientId||t,{name:o}=e,r=Xr(e=>e.selections.get(o)),a=Xr(e=>e.setClause),l=Xr(e=>e.clearClause),c=i(()=>!!r&&r.clauses.size>0,[r]);return{predicate:i(()=>r&&0!==r.clauses.size?function(e,t){const n=[];for(const[o,r]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(zr(r));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(r,n):()=>!0,[r,n]),isActive:c,selectPoints:s(e=>{const t={};let r=!1;for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)},r=!0;r&&a(o,{clientId:n,type:"point",fields:t})},[n,o,a]),selectInterval:s(e=>{const t={};let r=!1;for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o},r=!0;r&&a(o,{clientId:n,type:"interval",fields:t})},[n,o,a]),clear:s(()=>{l(o,n)},[l,o,n]),clientId:n}}const Jr=c(!1),ei=c(null),ti="undefined"==typeof window?u:h;function ni(e,t,n){var o;const r=null!==(o=e.xValue)&&void 0!==o?o:null==t?void 0:t[n];if(null==r)return null;const i=Number(r);return Number.isFinite(i)?i:null}function oi(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 ri(e){if(!e)return!1;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function ii(){var e;const t=Bn(e=>e.theme),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 ai(e,t,n,o,r){let i;if(Array.isArray(n))i=n;else if(t&&t.length>0)i=t;else if("string"==typeof n){const e=Ht[n];Array.isArray(e)&&(i=e)}return i&&0!==i.length?i[0]:"#007bff"}function si({selection:e,linkedHover:t,fallbackFields:n=[],unwrapData:o=!1,onObservation:r,chartType:a,chartId:l,onClick:c,hoverHighlight:h,colorByField:f}){const g=y(),p=function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField,seriesField:e.seriesField}:null}(t,n),v="series"===(null==p?void 0:p.mode)?[p.seriesField||f||n[0]].filter(e=>!!e):(null==p?void 0:p.fields)||n||[],m=Ur({name:(null==e?void 0:e.name)||"__unused__"}),b=function(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:r,selectPoints:i,clear:a}=Ur({name:t}),l=s(e=>{if(!e)return void a();const t={};for(const o of n){const n=e[o];void 0!==n&&(t[o]=[n])}(function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1})(t)&&i(t)},[n,i,a,t]);return{onHover:l,predicate:o,isActive:r}}({name:(null==p?void 0:p.name)||"hover",fields:v}),x=qr(e=>e.pushObservation),k=e?{isActive:m.isActive,predicate:m.predicate}:null,[w,S]=d(null),A=f||n[0],M=i(()=>{if(!h||null==w||!A)return null;const e=w,t=A;return{isActive:!0,predicate:n=>{var o;return("string"==typeof n[t]?n[t]:(null!==(o=n[t])&&void 0!==o?o:"")+"")===e}}},[h,w,A]),L=s(e=>{var n,o;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==p?void 0:p.mode)&&p.xField){const n=ni(e,t,p.xField);null!=n&&function(e,t,n){const o=Vr.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(Vr={positions:new Map(Vr.positions).set(e,{xValue:t,sourceId:n})},Qr())}(p.name||"hover",n,g)}"x-position"!==(null==p?void 0:p.mode)&&b.onHover(t)}else"x-position"===(null==p?void 0:p.mode)&&Zr(p.name||"hover",g),"x-position"!==(null==p?void 0:p.mode)&&b.onHover(null);if(h&&A)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[A];S(null!=n?n+"":null)}else S(null);if(r||x){const t={timestamp:Date.now(),chartType:a||"unknown",chartId:l};if(e){const i=oi(e),a=Object.assign(Object.assign({},t),{type:"hover",datum:i||{},x:null!==(n=e.x)&&void 0!==n?n:0,y:null!==(o=e.y)&&void 0!==o?o:0});r&&r(a),x&&x(a)}else{const e=Object.assign(Object.assign({},t),{type:"hover-end"});r&&r(e),x&&x(e)}}},[t,b,p,g,r,a,l,x,h,A]),O=s(e=>{var t,n,o,i;if("x-position"===(null==p?void 0:p.mode)&&p.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=ni(e,t,p.xField);null!=n&&function(e,t,n){const o=Vr.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(Vr.positions);return t.delete(e),Vr={positions:t},Qr(),!1}Vr={positions:new Map(Vr.positions).set(e,{xValue:t,sourceId:n,locked:!0})},Qr()}(p.name||"hover",n,g)}if(e&&c){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),c(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(r||x){const t={timestamp:Date.now(),chartType:a||"unknown",chartId:l};if(e){const n=oi(e),a=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(a),x&&x(a)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});r&&r(e),x&&x(e)}}},[c,r,x,a,l,p,g]);return u(()=>{if("x-position"!==(null==p?void 0:p.mode))return;const e=p.name||"hover";return()=>{!function(e,t){const n=Vr.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(Vr.positions);o.delete(e),Vr={positions:o},Qr()}(e,g),Zr(e,g)}},[null==p?void 0:p.mode,null==p?void 0:p.name,g]),{activeSelectionHook:k,hoverSelectionHook:M,customHoverBehavior:L,customClickBehavior:O,crosshairSourceId:g}}function li({data:e,colorBy:t,colorScale:n,showLegend:o,legendPosition:s="right",userMargin:l,defaults:c={top:50,bottom:60,left:70,right:40},categories:d}){const u=a(Jr),h=null!==a(ei),f=void 0!==o?o:!u&&!!t,g=!!t&&(f||h),p=i(()=>{if(!g)return[];if(void 0!==d)return d;const n=new Set;for(const o of e){const e="function"==typeof t?t(o):o[t];null!=e&&n.add(e+"")}return Array.from(n)},[d,t,e,g]);!function(e){const t=a(ei),n=y(),o=function(e){const t=new Set,n=[];for(const o of e)t.has(o)||(t.add(o),n.push(o));return n}(e),i=r([]);(function(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})(i.current,o)||(i.current=o);const s=i.current;ti(()=>{if(t)return()=>t.unregisterCategories(n)},[t,n]),ti(()=>{t&&t.registerCategories(n,s)},[t,n,s])}(h&&t?p:[]);const v=i(()=>{if(!f||!t)return;const o=function({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:r,strokeWidth:i,categories:a}){const s=(a&&a.length>0?a:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((r,i)=>{const a=e.find("function"==typeof t?e=>t(e)===r:e=>e[t]===r),s=a?o(a,t,n):n?n(r):Yt[i%Yt.length];return{label:r+"",color:s}});return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==r&&(n.stroke=r),void 0!==i&&(n.strokeWidth=i),n},type:"fill",items:s,label:""}]}}({data:e,colorBy:t,colorScale:n,getColor:qt,categories:p}),r=o.legendGroups.reduce((e,t)=>e+t.items.length,0);return 0!==r?o:void 0},[f,t,e,n,p]),m=i(()=>{const e="number"==typeof l?{top:l,bottom:l,left:l,right:l}:null!=l?l:{},t=t=>{const n=e[t];return"number"==typeof n?n:c[t]},n={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},o=t=>"number"==typeof e[t];return v&&("right"===s&&!o("right")&&110>n.right?n.right=110:"left"===s&&!o("left")&&110>n.left?n.left=110:"top"===s&&!o("top")&&50>n.top?n.top=50:"bottom"===s&&!o("bottom")&&80>n.bottom&&(n.bottom=80)),n},[c,l,v,s]);return{legend:v,margin:m,legendPosition:s}}o.createContext(void 0);const ci={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 di(e,t,n){var o,r,i,a,s,l,c;const d=ci[e||"primary"],u="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:e&&"primary"!==e||!(null==n?void 0:n.width)?d.width:n.width,height:null!==(r=t.height)&&void 0!==r?r:e&&"primary"!==e||!(null==n?void 0:n.height)?d.height:n.height,showAxes:null!==(i=t.showAxes)&&void 0!==i?i:d.showAxes,showGrid:null!==(a=t.showGrid)&&void 0!==a?a:d.showGrid,enableHover:null!==(s=t.enableHover)&&void 0!==s?s:!!t.linkedHover||d.enableHover,showLegend:null!==(l=t.showLegend)&&void 0!==l?l:d.showLegend,showLabels:null!==(c=t.showLabels)&&void 0!==c?c:d.showLabels,title:u?void 0:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:u?void 0:t.xLabel,yLabel:u?void 0:t.yLabel,categoryLabel:u?void 0:t.categoryLabel,valueLabel:u?void 0:t.valueLabel,marginDefaults:ui(d.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:u}}function ui(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 hi(e,t){if(!e)return[];const n=[],o=e=>{n.push(e);const r="function"==typeof t?t(e):e[t];r&&Array.isArray(r)&&r.forEach(o)};return o(e),n}function fi(e,t,n,o){if(e&&e.length>0)return e;const r=new Set;return t.forEach(e=>{const t="function"==typeof n?n(e):e[n],i="function"==typeof o?o(e):e[o];r.add(t),r.add(i)}),Array.from(r).map(e=>({id:e}))}function gi(e){return"function"==typeof e?e:t=>t[e]||1}function yi({edgeColorBy:e,colorBy:t,colorScale:n,nodeStyleFn:o,edgeOpacity:r,baseStyle:i={}}){return a=>{const s=Object.assign({fillOpacity:r},i);if("function"==typeof e)s.fill=e(a);else if("source"===e){const e="object"==typeof a.source?a.source:null;t&&e?s.fill=qt(e.data||e,t,n):e&&(s.fill=o(e,e.index).fill)}else if("target"===e){const e="object"==typeof a.target?a.target:null;t&&e?s.fill=qt(e.data||e,t,n):e&&(s.fill=o(e,e.index).fill)}else"gradient"===e&&(s.fill="#999",s.fillOpacity=.7*r);return s}}function pi({componentName:n,message:o,diagnosticHint:r,width:i,height:a}){return e("div",{role:"alert",style:{width:i,height:Math.max(a,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:t("div",{style:{textAlign:"center",maxWidth:400},children:[e("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:n}),e("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:o}),r&&e("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:r})]})})}class vi extends o.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var n,o;null===(o=(n=this.props).onError)||void 0===o||o.call(n,e,t)}render(){if(this.state.error){const{fallback:t}=this.props,n=this.state.error;return"function"==typeof t?t(n):void 0!==t?t:e(pi,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}function mi({componentName:t,width:n,height:o,children:r}){return e(vi,{fallback:r=>e(pi,{componentName:t,message:r.message,width:n,height:o}),children:r})}"undefined"!=typeof process&&process;const bi={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"},xi={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function ki(t){const{nodes:n,edges:o,inferNodes:r=!0,sourceAccessor:l="source",targetAccessor:c="target",colorBy:u,colorScheme:h,showLegend:f,legendPosition:g,legendInteraction:y,selection:p,linkedHover:v,onObservation:m,onClick:b,chartType:x,chartId:k,marginDefaults:w,userMargin:S,width:A,height:M,loading:L,loadingContent:O,emptyContent:D,emptyDataKey:E="edges"}=t,_=i(()=>xr(o),[o]),N=i(()=>xr(n),[n]),P=function(t,n,o,r){if(!t)return null;if(!1===r)return null;if(null!=r)return e("div",{style:{width:n,height:o,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:r});const i=Math.min(5,Math.floor(o/40)),a=Math.max(8,Math.floor(o/(3*i))),s=Math.max(6,Math.floor(o/(2.5*i))),l=Math.floor((o-(i*(a+s)-s))/2);return e("div",{style:{width:n,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:i},(t,o)=>e("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},xi),{position:"absolute",top:l+o*(a+s),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:a,opacity:.5+o%2*.2})},o))})}(L,A,M,O),T=P?null:function(t,n,o,r){return!1===r||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e("div",{style:Object.assign(Object.assign({},bi),{width:n,height:o}),children:r||"No data available"}):null}("nodes"===E?void 0===n?void 0:N:void 0===o?void 0:_,A,M,D),C=i(()=>r?fi(N,_,l,c):N,[r,N,_,l,c]),I=function(e,t,n){const o=a(Rr),r=ii();return i(()=>{var i;if(!t)return;const a=null!=o?o:void 0,s=null!==(i=null!=n?n:r&&r.length>0?r:void 0)&&void 0!==i?i:"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>t(e)+"")));if(a&&ri(a)){const e=Vt(n.map(e=>({_cat:e})),"_cat",s);return t=>a[t]||e(t)}return Vt(n.map(e=>({_cat:e})),"_cat",s)}if(a&&ri(a)){const n=Vt(e,t,s);return e=>a[e]||n(e)}return Vt(e,t,s)}if(a&&ri(a)){const e=Vt([{_:"a"}],"_",s);return t=>a[t]||e(t)}},[e,t,n,o,r])}(C,u,h),j=ii(),W=i(()=>{if(Array.isArray(h))return h;if(j&&j.length>0)return j;if("string"==typeof h){const e=Ht[h];if(Array.isArray(e)&&e.length>0)return e}return Ft},[h,j]),$=i(()=>{if(!u)return[];const e=new Set;for(const t of C){const n="function"==typeof u?u(t):t[u];null!=n&&e.add(n+"")}return Array.from(e)},[C,u]),B=function(e,t,n){const[o,r]=d(null),[a,l]=d(new Set),c=i(()=>new Set,[]),u=s(t=>{"highlight"===e&&r(t?t.label:null)},[e]),h=s(t=>{"isolate"===e&&l(e=>{const o=new Set(e);return o.has(t.label)?o.delete(t.label):o.add(t.label),o.size===n.length?new Set:o})},[e,n.length]),f=i(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=o?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===o}:"isolate"===e&&a.size>0?{isActive:!0,predicate:e=>{const o=n?e[n]:"function"==typeof t?t(e):null;return a.has(o)}}:null},[e,t,o,a]);return{highlightedCategory:"highlight"===e?o:null,isolatedCategories:"isolate"===e?a:c,onLegendHover:u,onLegendClick:h,legendSelectionHook:f}}(y,u,$),{legend:R,margin:z,legendPosition:H}=li({data:C,colorBy:u,colorScale:I,showLegend:f,legendPosition:g,userMargin:S,defaults:w,categories:$}),F=si({selection:p,linkedHover:v,fallbackFields:u?["string"==typeof u?u:""]:[],unwrapData:!0,onObservation:m,onClick:b,chartType:x,chartId:k}),{customHoverBehavior:Y,customClickBehavior:X,activeSelectionHook:G,hoverSelectionHook:q,crosshairSourceId:V}=F;return{safeNodes:C,safeEdges:_,colorScale:I,effectivePalette:W,themeCategorical:j,allCategories:$,legendState:B,legend:R,margin:z,legendPosition:H,customHoverBehavior:Y,customClickBehavior:X,activeSelectionHook:G,hoverSelectionHook:q,crosshairSourceId:V,loadingEl:P,emptyEl:T}}function wi(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 Si(e,t){const n=e.length,o=t.length,r=Array(o+1);for(let e=0;o>=e;e++)r[e]=e;for(let i=1;n>=i;i++){let n=r[0];r[0]=i;for(let a=1;o>=a;a++){const o=r[a];r[a]=e[i-1]===t[a-1]?n:1+Math.min(n,r[a],r[a-1]),n=o}}return r[o]}function Ai(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,r=n+1;for(const n of t){const t=Si(e.toLowerCase(),n.toLowerCase());r>t&&(r=t,o=n)}return r>n?void 0:o}(e,t,3))&&void 0!==n?n:null)}function Mi({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 Li({componentName:e,nodes:t,edges:n,nodesRequired:o=!1,edgesRequired:r=!0,accessors:i}){if(null==t&&null==n)return null;if(r&&(!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(i&&t&&t.length>0){const n=(a=t,a.length>3?[a[0],a[Math.floor(a.length/2)],a[a.length-1]]:a).find(e=>e&&"object"==typeof e);if(n){const t=Object.keys(n);for(const[o,r]of Object.entries(i))if(r&&"string"==typeof r&&!(r in n)){const n=Ai(r,t),i=n?` Try ${o}="${n}".`:"";return`${e}: ${o} "${r}" not found in node data. Available fields: ${t.join(", ")}.${i}`}}}var a;return null}const Oi=f(function(t,n){var o;const a=r(null);Br(n,{variant:"network",frameRef:a});const s=di(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLegend:t.showLegend,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{nodes:l,edges:c,margin:d,className:u,nodeIdAccessor:h,nodeIDAccessor:f,sourceAccessor:g="source",targetAccessor:y="target",nodeLabel:p,colorBy:v,colorScheme:m,nodeSize:b=8,nodeSizeRange:x=[5,20],edgeWidth:k=1,edgeColor:w="#999",edgeOpacity:S=.6,iterations:A=300,forceStrength:M=.1,tooltip:L,frameProps:O={},onObservation:D,onClick:E,chartId:_,selection:N,linkedHover:P,loading:T,loadingContent:C,emptyContent:I,legendInteraction:j,legendPosition:W,stroke:$,strokeWidth:B,opacity:R}=t,z=null!==(o=null!=h?h:f)&&void 0!==o?o:"id",{width:H,height:F,enableHover:Y,showLegend:X,showLabels:G=!1,title:q,description:V,summary:K,accessibleTable:Q}=s,Z=ki({nodes:l,edges:c,inferNodes:!1,sourceAccessor:g,targetAccessor:y,colorBy:v,colorScheme:m,showLegend:X,legendPosition:W,legendInteraction:j,selection:N,linkedHover:P,onObservation:D,onClick:E,chartType:"ForceDirectedGraph",chartId:_,marginDefaults:s.marginDefaults,userMargin:d,width:H,height:F,loading:T,loadingContent:C,emptyContent:I,emptyDataKey:"nodes"}),U=i(()=>new Map,[]),J=i(()=>e=>{const t={};return t.fill=v?qt(e.data||e,v,Z.colorScale):ai(0,Z.themeCategorical,m),"number"==typeof b&&(t.r=b),t},[v,Z.colorScale,b,Z.themeCategorical,m,U]),ee=i(()=>wi(J,{stroke:$,strokeWidth:B,opacity:R}),[J,$,B,R]),te=i(()=>e=>{const t=e.data||e;let n;if("number"==typeof k)n=k;else if("function"==typeof k)n=k(t);else{const e=t[k],o="number"==typeof e?e:Number(e);n=Number.isFinite(o)&&o>0?o:1}return{stroke:w,strokeWidth:n,opacity:S}},[k,w,S]),ne=i(()=>wi(te,{stroke:$,strokeWidth:B,opacity:R}),[te,$,B,R]),oe=i(()=>{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]),re=Li({componentName:"ForceDirectedGraph",nodes:l,edges:c,nodesRequired:!0,edgesRequired:!0,accessors:{nodeIDAccessor:z}});return re?e(pi,{componentName:"ForceDirectedGraph",message:re,width:H,height:F}):Z.loadingEl?Z.loadingEl:Z.emptyEl?Z.emptyEl:e(mi,{componentName:"ForceDirectedGraph",width:H,height:F,children:e($r,Object.assign({ref:a,chartType:"force"},null!=l&&{nodes:Z.safeNodes},null!=c&&{edges:Z.safeEdges},{size:[H,F],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Z.margin,nodeIDAccessor:z,sourceAccessor:g,targetAccessor:y,iterations:A,forceStrength:M,nodeStyle:ee,edgeStyle:ne,colorBy:v,colorScheme:Z.effectivePalette,nodeSize:b,nodeSizeRange:x,nodeLabel:oe,showLabels:G,enableHover:Y,tooltipContent:!1===L?()=>null:ce(L)||void 0,customHoverBehavior:P||D||E?Z.customHoverBehavior:void 0,customClickBehavior:D||E?Z.customClickBehavior:void 0,legend:Z.legend,legendPosition:Z.legendPosition},j&&"none"!==j&&{legendHoverBehavior:Z.legendState.onLegendHover,legendClickBehavior:Z.legendState.onLegendClick,legendHighlightedCategory:Z.legendState.highlightedCategory,legendIsolatedCategories:Z.legendState.isolatedCategories},{className:u,title:q,description:V,summary:K,accessibleTable:Q},null!=t.animate&&{animate:t.animate},O))})});Oi.displayName="ForceDirectedGraph";const Di=f(function(t,n){const o=r(null);Br(n,{variant:"network",frameRef:o,overrides:{getData:()=>{var e,t,n,r;return null!==(r=null===(n=null===(t=null===(e=o.current)||void 0===e?void 0:e.getTopology())||void 0===t?void 0:t.edges)||void 0===n?void 0:n.map(e=>e.data))&&void 0!==r?r:[]}}});const a=di(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:800,height:600}),{nodes:s,edges:l,margin:c,className:d,sourceAccessor:u="source",targetAccessor:h="target",valueAccessor:f="value",nodeIdAccessor:g="id",colorBy:y,colorScheme:p,edgeColorBy:v="source",orientation:m="horizontal",nodeAlign:b="justify",nodePaddingRatio:x=.05,nodeWidth:k=15,nodeLabel:w,edgeOpacity:S=.5,edgeSort:A,tooltip:M,frameProps:L={},onObservation:O,onClick:D,chartId:E,selection:_,linkedHover:N,loading:P,loadingContent:T,emptyContent:C,showLegend:I,legendPosition:j,legendInteraction:W,stroke:$,strokeWidth:B,opacity:R}=t,{width:z,height:H,enableHover:F,showLabels:Y=!0,title:X,description:G,summary:q,accessibleTable:V}=a,K=ki({nodes:s,edges:l,inferNodes:!0,sourceAccessor:u,targetAccessor:h,colorBy:y,colorScheme:p,showLegend:I,legendPosition:j,legendInteraction:W,selection:_,linkedHover:N,onObservation:O,onClick:D,chartType:"SankeyDiagram",chartId:E,marginDefaults:a.marginDefaults,userMargin:c,width:z,height:H,loading:P,loadingContent:T,emptyContent:C}),Q=i(()=>new Map,[]),Z=i(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=y?qt(e.data||e,y,K.colorScale):ai(0,K.themeCategorical,p),t},[y,K.colorScale,K.themeCategorical,p,Q]),U=i(()=>wi(Z,{stroke:$,strokeWidth:B,opacity:R}),[Z,$,B,R]),J=i(()=>yi({edgeColorBy:v,colorBy:y,colorScale:K.colorScale,nodeStyleFn:U,edgeOpacity:S,baseStyle:{stroke:"none",strokeWidth:0}}),[v,y,K.colorScale,U,S]),ee=i(()=>wi(J,{stroke:$,strokeWidth:B,opacity:R}),[J,$,B,R]),te=i(()=>{if(!Y)return;const e=w||g;return"function"==typeof e?e:t=>{var n,o,r;return null!==(r=null!==(o=null===(n=t.data)||void 0===n?void 0:n[e])&&void 0!==o?o:t[e])&&void 0!==r?r:t.id}},[Y,w,g]),ne=Li({componentName:"SankeyDiagram",edges:l,edgesRequired:!0});return ne?e(pi,{componentName:"SankeyDiagram",message:ne,width:z,height:H}):K.loadingEl?K.loadingEl:K.emptyEl?K.emptyEl:e(mi,{componentName:"SankeyDiagram",width:z,height:H,children:e($r,Object.assign({ref:o,chartType:"sankey"},K.safeNodes.length>0&&{nodes:K.safeNodes},null!=l&&{edges:K.safeEdges},{size:[z,H],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:K.margin,nodeIDAccessor:g,sourceAccessor:u,targetAccessor:h,valueAccessor:f,orientation:m,nodeAlign:b,nodePaddingRatio:x,nodeWidth:k,nodeStyle:U,edgeStyle:ee,colorBy:y,colorScheme:K.effectivePalette,edgeColorBy:v,edgeOpacity:S,edgeSort:A,nodeLabel:te,showLabels:Y,enableHover:F,tooltipContent:!1===M?()=>null:ce(M)||void 0,customHoverBehavior:N||O||D?K.customHoverBehavior:void 0,customClickBehavior:O||D?K.customClickBehavior:void 0,legend:K.legend,legendPosition:K.legendPosition},W&&"none"!==W&&{legendHoverBehavior:K.legendState.onLegendHover,legendClickBehavior:K.legendState.onLegendClick,legendHighlightedCategory:K.legendState.highlightedCategory,legendIsolatedCategories:K.legendState.isolatedCategories},{className:d,title:X,description:G,summary:q,accessibleTable:V},null!=t.animate&&{animate:t.animate},L))})});Di.displayName="SankeyDiagram";const Ei=f(function(t,n){const o=r(null);Br(n,{variant:"network",frameRef:o,overrides:{getData:()=>{var e,t,n,r;return null!==(r=null===(n=null===(t=null===(e=o.current)||void 0===e?void 0:e.getTopology())||void 0===t?void 0:t.edges)||void 0===n?void 0:n.map(e=>e.data))&&void 0!==r?r:[]}}});const a=di(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{nodes:s,edges:l,margin:c,className:d,sourceAccessor:u="source",targetAccessor:h="target",valueAccessor:f="value",nodeIdAccessor:g="id",colorBy:y,colorScheme:p,edgeColorBy:v="source",padAngle:m=.01,groupWidth:b=20,sortGroups:x,nodeLabel:k,edgeOpacity:w=.5,tooltip:S,frameProps:A={},onObservation:M,onClick:L,chartId:O,selection:D,linkedHover:E,loading:_,loadingContent:N,emptyContent:P,legendInteraction:T,stroke:C,strokeWidth:I,opacity:j}=t,{width:W,height:$,enableHover:B,showLabels:R=!0,title:z,description:H,summary:F,accessibleTable:Y}=a,X=ki({nodes:s,edges:l,inferNodes:!0,sourceAccessor:u,targetAccessor:h,colorBy:y,colorScheme:p,showLegend:!1,legendInteraction:T,selection:D,linkedHover:E,onObservation:M,onClick:L,chartType:"ChordDiagram",chartId:O,marginDefaults:a.marginDefaults,userMargin:c,width:W,height:$,loading:_,loadingContent:N,emptyContent:P}),G=i(()=>new Map,[]),q=X.safeNodes.length>0,V=i(()=>{if(q)return(e,t)=>{var n,o;const r={stroke:"black",strokeWidth:1};if(y)r.fill=qt(e.data||e,y,X.colorScale);else{const i=Array.isArray(p)?p:Ht[p]||Ft,a=Array.isArray(i)?i:Ft,s=null!==(o=null!==(n=e.index)&&void 0!==n?n:t)&&void 0!==o?o:0;r.fill=a[s%a.length]}return r}},[q,y,X.colorScale,p]),K=i(()=>V?wi(V,{stroke:C,strokeWidth:I,opacity:j}):void 0,[V,C,I,j]),Q=i(()=>{if(q)return yi({edgeColorBy:v,colorBy:y,colorScale:X.colorScale,nodeStyleFn:K||(e=>({fill:ai(0,X.themeCategorical,p)})),edgeOpacity:w,baseStyle:{stroke:"black",strokeWidth:.5,strokeOpacity:w}})},[q,v,y,X.colorScale,K,w,X.themeCategorical,p,G]),Z=i(()=>Q?wi(Q,{stroke:C,strokeWidth:I,opacity:j}):void 0,[Q,C,I,j]),U=i(()=>{if(!R)return;const e=k||g;return"function"==typeof e?e:t=>{var n,o,r;return null!==(r=null!==(o=null===(n=t.data)||void 0===n?void 0:n[e])&&void 0!==o?o:t[e])&&void 0!==r?r:t.id}},[R,k,g]),J=Li({componentName:"ChordDiagram",edges:l,edgesRequired:!0});return J?e(pi,{componentName:"ChordDiagram",message:J,width:W,height:$}):X.loadingEl?X.loadingEl:X.emptyEl?X.emptyEl:e(mi,{componentName:"ChordDiagram",width:W,height:$,children:e($r,Object.assign({ref:o,chartType:"chord"},X.safeNodes.length>0&&{nodes:X.safeNodes},null!=l&&{edges:X.safeEdges},{size:[W,$],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:X.margin,nodeIDAccessor:g,sourceAccessor:u,targetAccessor:h,valueAccessor:f,padAngle:m,groupWidth:b,sortGroups:x,nodeStyle:K,edgeStyle:Z,colorBy:y,colorScheme:X.effectivePalette,edgeColorBy:v,edgeOpacity:w,nodeLabel:U,showLabels:R,enableHover:B,tooltipContent:!1===S?()=>null:ce(S)||void 0,customHoverBehavior:E||M||L?X.customHoverBehavior:void 0,customClickBehavior:M||L?X.customClickBehavior:void 0},T&&"none"!==T&&{legendHoverBehavior:X.legendState.onLegendHover,legendClickBehavior:X.legendState.onLegendClick,legendHighlightedCategory:X.legendState.highlightedCategory,legendIsolatedCategories:X.legendState.isolatedCategories},{className:d,title:z,description:H,summary:F,accessibleTable:Y},null!=t.animate&&{animate:t.animate},A))})});function _i(t){const n=di(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{data:o,margin:r,className:a,layout:s="tree",orientation:l="vertical",childrenAccessor:c="children",valueAccessor:d="value",nodeIdAccessor:u="name",colorBy:h,colorScheme:f,colorByDepth:g=!1,edgeStyle:y="curve",nodeLabel:p,nodeSize:v=5,tooltip:m,frameProps:b={},onObservation:x,onClick:k,chartId:w,selection:S,linkedHover:A,loading:M,loadingContent:L,legendInteraction:O,stroke:D,strokeWidth:E,opacity:_}=t,{width:N,height:P,enableHover:T,showLabels:C=!0,title:I,description:j,summary:W,accessibleTable:$}=n,B=ki({nodes:i(()=>hi(null!=o?o:null,c),[o,c]),edges:void 0,inferNodes:!1,colorBy:g?void 0:h,colorScheme:f,showLegend:!1,legendInteraction:O,selection:S,linkedHover:A,onObservation:x,onClick:k,chartType:"TreeDiagram",chartId:w,marginDefaults:n.marginDefaults,userMargin:r,width:N,height:P,loading:M,loadingContent:L}),R=i(()=>new Map,[]),z=i(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=g?Xt[(e.depth||0)%Xt.length]:h?qt(e.data||e,h,B.colorScale):ai(0,B.themeCategorical,f),t},[h,g,B.colorScale,B.themeCategorical,f,R]),H=i(()=>wi(z,{stroke:D,strokeWidth:E,opacity:_}),[z,D,E,_]),F=i(()=>()=>({stroke:"#999",strokeWidth:1,fill:"none"}),[]),Y=i(()=>wi(F,{stroke:D,strokeWidth:E,opacity:_}),[F,D,E,_]),X=i(()=>{if("treemap"===s||"circlepack"===s||"partition"===s)return gi(d)},[s,d]),G=Mi({componentName:"TreeDiagram",data:o});return G?e(pi,{componentName:"TreeDiagram",message:G,width:N,height:P}):B.loadingEl?B.loadingEl:e(mi,{componentName:"TreeDiagram",width:N,height:P,children:e($r,Object.assign({chartType:s},null!=o&&{data:o},{size:[N,P],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:B.margin,nodeIDAccessor:u,childrenAccessor:c,hierarchySum:X,treeOrientation:l,edgeType:y,nodeStyle:H,edgeStyle:Y,colorBy:h,colorScheme:B.effectivePalette,colorByDepth:g,nodeSize:v,nodeLabel:C?p||u:void 0,showLabels:C,enableHover:T,tooltipContent:!1===m?()=>null:ce(m)||void 0,customHoverBehavior:A||x||k?B.customHoverBehavior:void 0,customClickBehavior:x||k?B.customClickBehavior:void 0},O&&"none"!==O&&{legendHoverBehavior:B.legendState.onLegendHover,legendClickBehavior:B.legendState.onLegendClick,legendHighlightedCategory:B.legendState.highlightedCategory,legendIsolatedCategories:B.legendState.isolatedCategories},{className:a,title:I,description:j,summary:W,accessibleTable:$},null!=t.animate&&{animate:t.animate},b))})}function Ni(t){const n=di(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,linkedHover:t.linkedHover},{width:600,height:600}),{data:o,margin:r,className:a,childrenAccessor:l="children",valueAccessor:c="value",nodeIdAccessor:d="name",colorBy:u,colorScheme:h,colorByDepth:f=!1,labelMode:g="leaf",nodeLabel:y,padding:p=4,paddingTop:v,nodeStyle:m,tooltip:b,frameProps:x={},selection:k,linkedHover:w,onObservation:S,onClick:A,chartId:M,loading:L,loadingContent:O,legendInteraction:D,stroke:E,strokeWidth:_,opacity:N}=t,{nodeStyle:P}=x,T=function(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 r=0;for(o=Object.getOwnPropertySymbols(e);o.length>r;r++)0>t.indexOf(o[r])&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n}(x,["nodeStyle"]),{width:C,height:I,enableHover:j,showLabels:W=!0,title:$,description:B,summary:R,accessibleTable:z}=n,H=ki({nodes:i(()=>hi(null!=o?o:null,l),[o,l]),edges:void 0,inferNodes:!1,colorBy:f?void 0:u,colorScheme:h,showLegend:!1,legendInteraction:D,selection:k,linkedHover:w,onObservation:S,onClick:A,chartType:"Treemap",chartId:M,marginDefaults:n.marginDefaults,userMargin:r,width:C,height:I,loading:L,loadingContent:O}),F=function(e){const t=Bn(e=>e.theme.colors.selectionOpacity);return i(()=>{var n,o;if(void 0!==e||void 0!==t)return Object.assign(Object.assign({name:null!==(n=null==e?void 0:e.name)&&void 0!==n?n:""},e),{unselectedOpacity:null!==(o=null==e?void 0:e.unselectedOpacity)&&void 0!==o?o:t})},[e,t])}(k),Y=H.customHoverBehavior,X=s(e=>{if(!e)return Y(null);const t=e.data||e;Y({data:(null==t?void 0:t.data)||t})},[Y]),G=i(()=>new Map,[]),q=i(()=>e=>{const t={stroke:"var(--semiotic-cell-border, var(--semiotic-border, #fff))",strokeWidth:1,strokeOpacity:.8};return t.fill=f?Xt[(e.depth||0)%Xt.length]:u?qt(e.data||e,u,H.colorScale):ai(0,H.themeCategorical,h),t},[u,f,H.colorScale,H.themeCategorical,h,G]),V=i(()=>m||P?e=>{var t,n;return Object.assign(Object.assign(Object.assign({},q(e)),P&&null!==(t=P(e))&&void 0!==t?t:{}),m&&null!==(n=m(e))&&void 0!==n?n:{})}:q,[q,m,P]),K=i(()=>wi(V,{stroke:E,strokeWidth:_,opacity:N}),[V,E,_,N]),Q=i(()=>H.activeSelectionHook?e=>{var t;const n=Object.assign({},K(e));if(H.activeSelectionHook.isActive)if(H.activeSelectionHook.predicate(e.data||e))(null==F?void 0:F.selectedStyle)&&Object.assign(n,F.selectedStyle);else{const e=null!==(t=null==F?void 0:F.unselectedOpacity)&&void 0!==t?t:.5;n.opacity=e,n.fillOpacity=e,n.strokeOpacity=e,(null==F?void 0:F.unselectedStyle)&&Object.assign(n,F.unselectedStyle)}return n}:K,[K,H.activeSelectionHook,F]),Z=i(()=>gi(c),[c]),U=void 0!==v?v:!W||"parent"!==g&&"all"!==g?void 0:18,J=Mi({componentName:"Treemap",data:o});return J?e(pi,{componentName:"Treemap",message:J,width:C,height:I}):H.loadingEl?H.loadingEl:e(mi,{componentName:"Treemap",width:C,height:I,children:e($r,Object.assign({chartType:"treemap"},null!=o&&{data:o},{size:[C,I],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:H.margin,nodeIDAccessor:d,childrenAccessor:l,hierarchySum:Z,padding:p,paddingTop:U,nodeStyle:Q,colorBy:u,colorScheme:H.effectivePalette,colorByDepth:f,nodeLabel:W?y||d:void 0,showLabels:W,labelMode:g,enableHover:j,tooltipContent:!1===b?()=>null:ce(b)||void 0},(w||S||A)&&{customHoverBehavior:X},(S||A)&&{customClickBehavior:H.customClickBehavior},D&&"none"!==D&&{legendHoverBehavior:H.legendState.onLegendHover,legendClickBehavior:H.legendState.onLegendClick,legendHighlightedCategory:H.legendState.highlightedCategory,legendIsolatedCategories:H.legendState.isolatedCategories},{className:a,title:$,description:B,summary:R,accessibleTable:z},null!=t.animate&&{animate:t.animate},T))})}function Pi(t){const n=di(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{data:o,margin:r,className:a,childrenAccessor:s="children",valueAccessor:l="value",nodeIdAccessor:c="name",colorBy:d,colorScheme:u,colorByDepth:h=!1,nodeLabel:f,circleOpacity:g=.7,padding:y=4,tooltip:p,frameProps:v={},onObservation:m,onClick:b,chartId:x,selection:k,linkedHover:w,loading:S,loadingContent:A,legendInteraction:M,stroke:L,strokeWidth:O,opacity:D}=t,{width:E,height:_,enableHover:N,showLabels:P=!0,title:T,description:C,summary:I,accessibleTable:j}=n,W=ki({nodes:i(()=>hi(null!=o?o:null,s),[o,s]),edges:void 0,inferNodes:!1,colorBy:h?void 0:d,colorScheme:u,showLegend:!1,legendInteraction:M,selection:k,linkedHover:w,onObservation:m,onClick:b,chartType:"CirclePack",chartId:x,marginDefaults:n.marginDefaults,userMargin:r,width:E,height:_,loading:S,loadingContent:A}),$=i(()=>new Map,[]),B=i(()=>e=>{const t={stroke:"currentColor",strokeWidth:1,strokeOpacity:.3,fillOpacity:g};return t.fill=h?Xt[(e.depth||0)%Xt.length]:d?qt(e.data||e,d,W.colorScale):ai(0,W.themeCategorical,u),t},[d,h,W.colorScale,g,W.themeCategorical,u,$]),R=i(()=>wi(B,{stroke:L,strokeWidth:O,opacity:D}),[B,L,O,D]),z=i(()=>gi(l),[l]),H=Mi({componentName:"CirclePack",data:o});return H?e(pi,{componentName:"CirclePack",message:H,width:E,height:_}):W.loadingEl?W.loadingEl:e(mi,{componentName:"CirclePack",width:E,height:_,children:e($r,Object.assign({chartType:"circlepack"},null!=o&&{data:o},{size:[E,_],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:W.margin,nodeIDAccessor:c,childrenAccessor:s,hierarchySum:z,padding:y,nodeStyle:R,colorBy:d,colorScheme:W.effectivePalette,colorByDepth:h,nodeLabel:P?f||c:void 0,showLabels:P,enableHover:N,tooltipContent:!1===p?()=>null:ce(p)||void 0,customHoverBehavior:w||m||b?W.customHoverBehavior:void 0,customClickBehavior:m||b?W.customClickBehavior:void 0},M&&"none"!==M&&{legendHoverBehavior:W.legendState.onLegendHover,legendClickBehavior:W.legendState.onLegendClick,legendHighlightedCategory:W.legendState.highlightedCategory,legendIsolatedCategories:W.legendState.isolatedCategories},{className:a,title:T,description:C,summary:I,accessibleTable:j},null!=t.animate&&{animate:t.animate},v))})}Ei.displayName="ChordDiagram",_i.displayName="TreeDiagram","function"==typeof SuppressedError&&SuppressedError,Ni.displayName="Treemap",Pi.displayName="CirclePack";const Ti=Xt;function Ci(t){const n=di(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary},{width:600,height:600}),{data:o,margin:r,className:a,childrenAccessor:s="children",nodeIdAccessor:l="name",colorBy:c,colorScheme:d,colorByDepth:u=!1,orbitMode:h="flat",orbitSize:f=2.95,speed:g=.25,revolution:y,revolutionStyle:p,eccentricity:v=1,showRings:m=!0,nodeRadius:b=6,showLabels:x=!1,animated:k=!0,tooltip:w,foregroundGraphics:S,annotations:A,frameProps:M={},onObservation:L,onClick:O,chartId:D,selection:E,linkedHover:_,loading:N,loadingContent:P,stroke:T,strokeWidth:C,opacity:I}=t,{width:j,height:W,enableHover:$,title:B,description:R,summary:z,accessibleTable:H}=n,F=ki({nodes:i(()=>hi(o,s),[o,s]),edges:void 0,inferNodes:!1,colorBy:u?void 0:c,colorScheme:d,showLegend:!1,legendInteraction:void 0,selection:E,linkedHover:_,onObservation:L,onClick:O,chartType:"OrbitDiagram",chartId:D,marginDefaults:{top:10,right:10,bottom:10,left:10},userMargin:r,width:j,height:W,loading:N,loadingContent:P}),Y=i(()=>new Map,[]),{colorScale:X,customClickBehavior:G,customHoverBehavior:q,themeCategorical:V}=F,K=i(()=>{if(Array.isArray(d))return d;const e=Ht[d];return Array.isArray(e)?e:Ft},[d]),Q=i(()=>e=>{var t;const n={stroke:"#fff",strokeWidth:1},o=0===(null!==(t=e.depth)&&void 0!==t?t:0);return n.fill=u?o?K[0]:Ti[(e.depth||0)%Ti.length]:c?qt(e.data||e,c,X):ai(0,V,d),n.opacity=o?1:.85,n},[c,u,X,K,V,d,Y]),Z=i(()=>wi(Q,{stroke:T,strokeWidth:C,opacity:I}),[Q,T,C,I]),U=i(()=>()=>({stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1}),[]),J=i(()=>{if(q)return e=>{q(e&&e.data&&void 0!==e.data.data?Object.assign(Object.assign({},e),{data:e.data.data}):e)}},[q]),ee=i(()=>{if(G)return e=>{G(e&&e.data&&void 0!==e.data.data?Object.assign(Object.assign({},e),{data:e.data.data}):e)}},[G]),te=Mi({componentName:"OrbitDiagram",data:o});return te?e(pi,{componentName:"OrbitDiagram",message:te,width:j,height:W}):F.loadingEl?F.loadingEl:e(mi,{componentName:"OrbitDiagram",width:j,height:W,children:e($r,Object.assign({chartType:"orbit"},null!=o&&{data:o},{size:[j,W],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:F.margin,nodeIDAccessor:l,childrenAccessor:s,nodeStyle:Z,edgeStyle:U,colorBy:c,colorScheme:F.effectivePalette,colorByDepth:u,nodeSize:b,nodeLabel:x?l:void 0,showLabels:x,enableHover:!k&&$,tooltipContent:k?void 0:!1===w?()=>null:ce(w)||void 0,customHoverBehavior:_||L||O?J:void 0,customClickBehavior:L||O?ee:void 0,foregroundGraphics:S,annotations:A,className:a,title:B,description:R,summary:z,orbitMode:h,orbitSize:f,orbitSpeed:g,orbitRevolution:y,orbitRevolutionStyle:p,orbitEccentricity:v,orbitShowRings:m,orbitAnimated:k,accessibleTable:H},null!=t.animate&&{animate:t.animate},M))})}function Ii(e,t,n){const o=[],r=new Set(e.map(e=>e.id)),i=Array.isArray(n)&&2===n.length,a=i&&Number.isFinite(n[0])&&Number.isFinite(n[1]);i&&a&&a&&n[1]>=n[0]||o.push({kind:"invalid-domain"});for(const t of e)null!=t.xExtent&&(Array.isArray(t.xExtent)&&2===t.xExtent.length&&Number.isFinite(t.xExtent[0])&&Number.isFinite(t.xExtent[1])&&t.xExtent[1]>=t.xExtent[0]||o.push({kind:"invalid-node-time",id:t.id}));for(const e of t)r.has(e.source)||o.push({kind:"missing-node",id:e.id,endpoint:"source",nodeId:e.source}),r.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}function ji(e){return"invalid-node-time"===e.kind?`node ${e.id} has an invalid xExtent (must be [start, end] with start <= end)`:"invalid-edge-time"===e.kind?`edge ${e.id} has an invalid startTime or endTime`:"invalid-domain"===e.kind?"time domain must be a 2-tuple of finite times [start, end] with start <= end":"invalid-value"===e.kind?`edge ${e.id} must have a positive finite value`:"missing-node"===e.kind?`edge ${e.id} references missing ${e.endpoint} node "${e.nodeId}"`:"backward-edge"===e.kind?`edge ${e.id} (${e.source}->${e.target}) ends before it starts`:e.kind}function Wi(e,t,n){const o=t.incoming[e.id],r=t.outgoing[e.id],i=[];for(const e of o)i.push({time:e.endTime,delta:+e.value,edge:e,kind:"in",side:n.get(e.id).targetSide});for(const e of r)i.push({time:e.startTime,delta:-e.value,edge:e,kind:"out",side:n.get(e.id).sourceSide});const a={create:0,in:1,"transfer-out":2,"transfer-in":3,out:4},s=()=>{i.sort((e,t)=>{var n,o;return e.time-t.time||(null!==(n=a[e.kind])&&void 0!==n?n:99)-(null!==(o=a[t.kind])&&void 0!==o?o:99)})},l=i.length?function(e,t=1/0){let n=t;for(const t of e)n>t&&(n=t);return n}(i.map(e=>e.time)):null,c=Array.isArray(e.xExtent)&&Number.isFinite(e.xExtent[0])?e.xExtent[0]:null,d=null!=c?c-1:null!=l&&Number.isFinite(l)?l-1:null,u=[...new Set(i.map(e=>e.time))].sort((e,t)=>e-t),h=new Map;for(let e=1;u.length>e;e++)h.set(u[e],u[e-1]);const f=e=>{const t=h.get(e);return null!=t?(t+e)/2:null!=d?d:e};s();const g=[];let y=0,p=0;for(const e of i)if("out"===e.kind){const t=Math.abs(e.delta);let n=t-("top"===e.side?y:p);if(n>0){const t="top"===e.side?"bot":"top",o=Math.min(n,"top"===t?y:p);if(o>0){const r=f(e.time);g.push({time:r,delta:-o,kind:"transfer-out",side:t}),g.push({time:r,delta:+o,kind:"transfer-in",side:e.side}),"top"===t?y-=o:p-=o,"top"===e.side?y+=o:p+=o,n-=o}n>0&&null!==d&&(g.push({time:d,delta:+n,kind:"create",side:e.side}),"top"===e.side?y+=n:p+=n)}"top"===e.side?y-=t:p-=t}else if("in"===e.kind){const t=Math.abs(e.delta);"top"===e.side?y+=t:p+=t}i.push(...g),s();let v=0,m=0,b=0,x=0,k=0;const w=[],S=new Map;for(const e of i){if(w.push({t:e.time,topMass:v,botMass:m}),("in"===e.kind||"out"===e.kind)&&e.edge){const t="top"===e.side?v:m;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?v+=e.delta:m+=e.delta,v+m>b&&(b=v+m),v>x&&(x=v),m>k&&(k=m),w.push({t:e.time,topMass:v,botMass:m})}const A=[];let M=0;for(;w.length>M;){let e=M;for(;w.length>e+1&&w[e+1].t===w[M].t;)e++;A.push(w[M]);for(let t=M+1;e>=t;t++){const e=A[A.length-1];w[t].topMass===e.topMass&&w[t].botMass===e.botMass||A.push(w[t])}M=e+1}const L=Array.isArray(e.xExtent)&&Number.isFinite(e.xExtent[1])?e.xExtent[1]:null;let O=null;for(const e of r)null!=e.systemInTime&&Number.isFinite(e.systemInTime)&&e.startTime>e.systemInTime&&(null===O||O>e.systemInTime)&&(O=e.systemInTime);let D=null;for(const e of o)null!=e.systemOutTime&&Number.isFinite(e.systemOutTime)&&e.systemOutTime>e.endTime&&(null===D||e.systemOutTime>D)&&(D=e.systemOutTime);if(A.length>0){const e=A[A.length-1],t=Math.max(null!=L?L:-1/0,null!=D?D:-1/0);Number.isFinite(t)&&t>e.t&&e.topMass+e.botMass>0&&A.push({t:t,topMass:e.topMass,botMass:e.botMass});const n=A[0],o=Math.min(null!=c?c:1/0,null!=O?O:1/0);Number.isFinite(o)&&n.t>o&&n.topMass+n.botMass>0&&A.unshift({t:o,topMass:n.topMass,botMass:n.botMass})}return{samples:A,peak:b,topPeak:x,botPeak:k,localAttachments:S}}function $i(e,t){return t?Math.max(t[0],Math.min(t[1],e)):e}function Bi(e,t){return e.map(e=>({t:$i(e.t,t),topMass:e.topMass,botMass:e.botMass}))}function Ri(e,t,n){const o=e.value*n;if("out"===e.kind){const r=e.sideMassBefore*n;if("top"===e.side){const e=t-r;return[e,e+o]}const i=t+r;return[i-o,i]}const r=e.sideMassAfter*n;if("top"===e.side){const e=t-r;return[e,e+o]}const i=t+r;return[i-o,i]}function zi(e,t){let n=0;for(let o=0;t.length>o;o++)for(let r=o+1;t.length>r;r++){const i=t[o],a=t[r];i.source!==a.source&&i.target!==a.target&&i.source!==a.target&&i.target!==a.source&&(Math.min(i.endTime,a.endTime)>Math.max(i.startTime,a.startTime)&&e[a.source]>e[i.source]!=e[a.target]>e[i.target]&&n++)}return n}function Hi(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 Fi(e,t){return 1e3*zi(e,t)+Hi(e,t)}function Yi(e,t){return{slots:e.map(e=>({peak:Object.assign({},e.peak),occupants:e.occupants.slice()})),map:Object.assign({},t)}}function Xi(e,t,n){e.length>8||n.length>40?(function(e,t,n,o=6){const r=e.length;if(1>=r)return;let i=Yi(e,t),a=Fi(t,n);for(let s=0;o>s;s++){const o=Array(r).fill(0),s=Array(r).fill(0);for(const e of n){const n=t[e.source],r=t[e.target];o[n]+=r*(e.value||1),s[n]+=e.value||1,o[r]+=n*(e.value||1),s[r]+=e.value||1}const l=Array.from({length:r},(e,t)=>t).sort((e,t)=>(s[e]>0?o[e]/s[e]:e)-(s[t]>0?o[t]/s[t]:t)),c=l.map(t=>e[t]),d=new Map;l.forEach((e,t)=>d.set(e,t));for(const e of Object.keys(t))t[e]=d.get(t[e]);e.length=0;for(const t of c)e.push(t);const u=Fi(t,n);if(a>u)a=u,i=Yi(e,t);else if(u===a)break}!function(e,t,n){e.length=0;for(const t of n.slots)e.push(t);for(const e of Object.keys(t))delete t[e];for(const e of Object.keys(n.map))t[e]=n.map[e]}(e,t,i)}(e,t,n,6),function(e,t,n,o=6){const r=e.length;if(1>=r)return;let i=Fi(t,n);for(let a=0;o>a;a++){let o=!1;for(let a=0;r-1>a;a++){const r=e[a];e[a]=e[a+1],e[a+1]=r;for(const e of Object.keys(t))t[e]===a?t[e]=a+1:t[e]===a+1&&(t[e]=a);const s=Fi(t,n);if(i>s)i=s,o=!0;else{const n=e[a];e[a]=e[a+1],e[a+1]=n;for(const e of Object.keys(t))t[e]===a?t[e]=a+1:t[e]===a+1&&(t[e]=a)}}if(!o)break}}(e,t,n,6)):function(e,t,n){const o=e.length;if(1>=o)return;const r=Object.assign({},t),i=Object.keys(r),a=Array.from({length:o},(e,t)=>t),s=a.slice(),l=Object.assign({},r);let c=a.slice(),d=1/0;const u=()=>{for(const e of i)l[e]=s[r[e]];const e=Fi(l,n);d>e&&(d=e,c=a.slice())},h=(e,t)=>{const n=a[e],o=a[t];a[e]=o,a[t]=n,s[n]=t,s[o]=e};u();const f=Array(o).fill(0);let g=0;for(;o>g;)g>f[g]?(h(g%2==0?0:f[g],g),u(),f[g]++,g=0):(f[g]=0,g++);const y=c.map(t=>e[t]),p=new Map;c.forEach((e,t)=>p.set(e,t));for(const e of Object.keys(t))t[e]=p.get(t[e]);e.length=0;for(const t of y)e.push(t)}(e,t,n)}function Gi(e,t,n,o,r){var i,a,s,l,c,d,u,h;const{plotH:f,padding:g,valueScale:y,packing:p,laneOrder:v,lifetimeMode:m="full"}=r,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"===m,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 r=null!=e&&Number.isFinite(e)?e:1/0,i=null!=n&&Number.isFinite(n)?n:-1/0;for(const e of o.outgoing[t.id]){r>e.startTime&&(r=e.startTime),null!=e.systemInTime&&Number.isFinite(e.systemInTime)&&r>e.systemInTime&&(r=e.systemInTime);const t=k?(e.startTime+e.endTime)/2:e.endTime;t>i&&(i=t)}for(const e of o.incoming[t.id]){const t=k?(e.startTime+e.endTime)/2:e.startTime;r>t&&(r=t),e.endTime>i&&(i=e.endTime),null!=e.systemOutTime&&Number.isFinite(e.systemOutTime)&&e.systemOutTime>i&&(i=e.systemOutTime)}w[t.id]={start:Number.isFinite(r)?r:null,end:Number.isFinite(i)?i:null}}const S={},A=[];if("reuse"===p){const n=new Map;for(const t of e)n.set(t.id,0);const r=new Map;for(const t of e)r.set(t.id,0);for(const e of t)r.set(e.target,(null!==(i=r.get(e.target))&&void 0!==i?i:0)+1);const u=[];for(const t of e)0===(null!==(a=r.get(t.id))&&void 0!==a?a:0)&&u.push(t.id);for(;u.length;){const e=u.shift();for(const t of null!==(s=o.outgoing[e])&&void 0!==s?s:[]){const o=(null!==(l=n.get(e))&&void 0!==l?l:0)+1;o>(null!==(c=n.get(t.target))&&void 0!==c?c:0)&&n.set(t.target,o),r.set(t.target,r.get(t.target)-1),0===r.get(t.target)&&u.push(t.target)}}const h=[...e].filter(e=>null!==w[e.id].start).sort((e,t)=>{var o,r;const i=null!==(o=n.get(e.id))&&void 0!==o?o:0,a=null!==(r=n.get(t.id))&&void 0!==r?r:0;return i!==a?i-a:w[e.id].start-w[t.id].start}),f=e.filter(e=>null===w[e.id].start);for(const e of[...h,...f]){const t=w[e.id];let n=-1;for(let e=0;A.length>e;e++){const o=A[e].occupants[A[e].occupants.length-1];if(null===t.start||void 0===o||t.start>=o.end){n=e;break}}-1===n&&(A.push({occupants:[],peak:{topPeak:0,botPeak:0}}),n=A.length-1),A[n].occupants.push({id:e.id,end:null!==(d=null==t?void 0:t.end)&&void 0!==d?d:-1/0}),A[n].peak.topPeak=Math.max(A[n].peak.topPeak,b[e.id]),A[n].peak.botPeak=Math.max(A[n].peak.botPeak,x[e.id]),S[e.id]=n}}else e.forEach((e,t)=>{var n,o;A.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]}}),S[e.id]=t});let M=null,L=null,O=null,D=null;const E=()=>{M=zi(S,t),O=Hi(S,t)},_=()=>{L=zi(S,t),D=Hi(S,t)};"crossing-min"===v?(E(),Xi(A,S,t),_()):"inside-out"===v?(E(),function(e,t){const n=e.length;if(1>=n)return;const o=e=>e.peak.topPeak+e.peak.botPeak,r=e.map((e,t)=>({slot:e,idx:t})).sort((e,t)=>o(t.slot)-o(e.slot)),i=Array(n),a=Math.floor((n-1)/2);i[a]=r[0].idx;let s=a-1,l=a+1;for(let e=1;r.length>e;e++)e%2==1&&n>l||0>s?i[l++]=r[e].idx:i[s--]=r[e].idx;const c=i.map(t=>e[t]),d=new Map;i.forEach((e,t)=>d.set(e,t));for(const e of Object.keys(t))t[e]=d.get(t[e]);e.length=0;for(const t of c)e.push(t)}(A,S),_()):"crossing-min+inside-out"===v&&(E(),Xi(A,S,t),function(e,t,n){const o=e.length;if(1>=o)return;const r=e.map(e=>{return{slot:e,size:(t=e,t.peak.topPeak+t.peak.botPeak)};var t}).sort((e,t)=>t.size-e.size),i=Math.floor((o-1)/2);let a=Fi(t,n);for(const{slot:s}of r){const r=e.indexOf(s);if(0>r)continue;const l=i;if(r===l)continue;const c=e[r];e.splice(r,1),e.splice(l,0,c);const d=new Map;for(let e=0;o>e;e++)d.set(e,e);if(l>r){for(let e=r+1;l>=e;e++)d.set(e,e-1);d.set(r,l)}else{for(let e=l;r>e;e++)d.set(e,e+1);d.set(r,l)}for(const e of Object.keys(t))t[e]=d.get(t[e]);const u=Fi(t,n);if(u>a){const n=e[l];e.splice(l,1),e.splice(r,0,n);const i=new Map;for(let e=0;o>e;e++)i.set(e,e);if(r>l){for(let e=l+1;r>=e;e++)i.set(e,e-1);i.set(l,r)}else{for(let e=r;l>e;e++)i.set(e,e+1);i.set(l,r)}for(const e of Object.keys(t))t[e]=i.get(t[e])}else a=u}}(A,S,t),_());const N=A.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])}),P=(e,t)=>{let n={top:0,bot:0};for(const[o,r]of e){if(o>t)break;n=r}return n},T=[];for(let e=0;A.length-1>e;e++){const t=N[e],n=N[e+1],o=new Set([...t.map(e=>e[0]),...n.map(e=>e[0])]);let r=0;for(const e of o){const o=P(t,e),i=P(n,e);o.bot+i.top>r&&(r=o.bot+i.top)}T.push(r)}const C=[];let I=g+(null!==(h=null===(u=A[0])||void 0===u?void 0:u.peak.topPeak)&&void 0!==h?h:0)*y;A.length>0&&C.push(I);for(let e=1;A.length>e;e++)I+=T[e-1]*y+g,C.push(I);if(A.length>0&&(I+=A[A.length-1].peak.botPeak*y+g),I>f){const e=f/I;for(let t=0;C.length>t;t++)C[t]*=e}const j=0===A.length?0:A[0].peak.topPeak+T.reduce((e,t)=>e+t,0)+A[A.length-1].peak.botPeak,W={};for(const t of e)W[t.id]=C[S[t.id]];return{effectiveSlotsHeight:j,centerlines:W,laneLifetime:w,slots:A,slotByNode:S,slotCenter:C,crossingsBefore:M,crossingsAfter:L,lengthBefore:O,lengthAfter:D}}Ci.displayName="OrbitDiagram";const qi=e=>{var t,n;const{bands:o=[],ribbons:r=[],showLabels:i=!0}=e.config,a=[];for(const e of r)a.push(Object.assign(Object.assign({type:"bezier",pathD:e.pathD},e.bezier&&{bezierCache:e.bezier}),{style:{fill:e.fill,opacity:e.opacity,stroke:"none"},datum:{__kind:"ribbon",data:e.rawDatum,id:e.id}}));for(const e of o)if(e.gradientStubs)for(let t=0;e.gradientStubs.length>t;t++){const n=e.gradientStubs[t];a.push({type:"bezier",pathD:n.pathD,interactive:!1,style:{fill:e.fill,fillOpacity:.86,stroke:"none"},_gradient:{x0:n.x0,x1:n.x1,from:n.from,to:n.to},datum:{__kind:"band",data:e.rawDatum,id:`${e.id}__stub${t}`}})}for(const e of o)a.push({type:"bezier",pathD:e.pathD,style:Object.assign(Object.assign({},e.gradientStubs&&e.gradientStubs.length>0?{fill:"none"}:{fill:e.fill,fillOpacity:.86}),{stroke:null!==(t=e.stroke)&&void 0!==t?t:e.fill,strokeWidth:null!==(n=e.strokeWidth)&&void 0!==n?n:.5}),datum:{__kind:"band",data:e.rawDatum,id:e.id}});const s=i?o.map(e=>({x:e.labelX,y:e.labelY,text:e.labelText,anchor:"end",baseline:"middle",fontSize:11,fontWeight:600})):[];return{sceneNodes:o.map(e=>({type:"circle",id:e.id,cx:-1e4,cy:-1e4,r:0,style:{fill:e.fill},datum:{__kind:"band",data:e.rawDatum,id:e.id}})),sceneEdges:a,labels:s}};function Vi(e){return"object"==typeof e&&null!==e&&"__kind"in e&&("band"===e.__kind||"ribbon"===e.__kind)}function Ki(e){return null==e?NaN:e instanceof Date?e.getTime():"number"==typeof e?e:new Date(e).getTime()}function Qi(e,t){return"function"==typeof e?e(t):t[e]}const Zi=f(function(o,a){const{nodes:l,edges:c,domain:u,axisTicks:h=[],nodeIdAccessor:f="id",sourceAccessor:g="source",targetAccessor:y="target",valueAccessor:p="value",startTimeAccessor:v="startTime",endTimeAccessor:m="endTime",systemInTimeAccessor:b,systemOutTimeAccessor:x,xExtentAccessor:k="xExtent",edgeIdAccessor:w="id",colorBy:S,colorScheme:A,showLegend:M,legendPosition:L="right",pairing:O="temporal",packing:D="reuse",laneOrder:E="crossing-min",ribbonLane:_="both",lifetimeMode:P="half",showLaneRails:T=!1,showQualityReadout:C=!1,showLabels:I=!0,width:j=600,height:W=400,margin:$,title:B,description:R,summary:z,accessibleTable:H,responsiveWidth:F,responsiveHeight:Y,loading:X,loadingContent:G,emptyContent:q,edgeOpacity:V=.35,timeFormat:K,valueFormat:Q,tooltip:Z,enableHover:U=!0,onObservation:J,onClick:ee,showParticles:te=!1,particleStyle:ne,chartId:oe,frameProps:re={}}=o,[ie,ae]=d([]),[se,le]=d([]),de=r(ie),ue=r(se);de.current=ie,ue.current=se;const he=s(e=>{de.current=e,ae(e)},[]),fe=s(e=>{ue.current=e,le(e)},[]),ge=void 0!==c,ye=xr(ge?c:ie),pe=i(()=>{const e=xr(null!=l?l:[]),t=se;if(0===e.length&&0===t.length)return fi([],ye,g,y);const n=new Set,o=[];for(const t of e){const e=Qi(f,t)+"";n.has(e)||(n.add(e),o.push(t))}for(const e of t){const t=Qi(f,e)+"";n.has(t)||(n.add(t),o.push(e))}const r=fi([],ye,g,y);for(const e of r)n.has(e.id)||(n.add(e.id),o.push(e));return o},[l,se,ye,f,g,y]),ve=r(null),me=s((e,t)=>{const n=Qi(w,e);return null!=n?n+"":`${Qi(g,e)}-${Qi(y,e)}-${t}`},[w,g,y]),be=s(e=>{if(null==e)return!1;const t=e;return null!=Qi(g,t)&&null!=Qi(y,t)},[g,y]);Br(a,{variant:"network",frameRef:ve,overrides:{push(e){if(be(e)){if(ge)return void console.warn("ProcessSankey.push: edge ignored — `edges` prop is controlled.");he([...de.current,e])}else fe([...ue.current,e])},pushMany(e){const t=[],n=[];for(const o of e)be(o)?t.push(o):n.push(o);t.length>0&&(ge?console.warn("ProcessSankey.pushMany: edges ignored — `edges` prop is controlled."):he([...de.current,...t])),n.length>0&&fe([...ue.current,...n])},remove(e){const t=new Set(Array.isArray(e)?e:[e]),n=[];if(!ge){const e=de.current,o=[];for(let r=0;e.length>r;r++){const i=e[r];t.has(me(i,r))?n.push(i):o.push(i)}o.length!==e.length&&he(o)}const o=ue.current,r=[];for(const e of o){const o=Qi(f,e)+"";t.has(o)?n.push(e):r.push(e)}return r.length!==o.length&&fe(r),n},update(e,t){const n=new Set(Array.isArray(e)?e:[e]),o=[];if(!ge){let e=!1;const r=de.current.map((r,i)=>n.has(me(r,i))?(o.push(r),e=!0,t(r)):r);e&&he(r)}let r=!1;const i=ue.current.map(e=>{const i=Qi(f,e)+"";return n.has(i)?(o.push(e),r=!0,t(e)):e});return r&&fe(i),o},clear(){var e;ge||he([]),fe([]),null===(e=ve.current)||void 0===e||e.clear()},getData:()=>null!=ye?ye:[],getScales:()=>null},deps:[ge,be,me,f,ye,he,fe]});const xe=me,ke=s(e=>Qi(f,e)+"",[f]),{nodes:we,edges:Se,domain:Ae,rawNodeById:Me,rawEdgeById:Le}=i(()=>{const e=(null!=pe?pe:[]).map(e=>{const t={id:ke(e),__raw:e},n=k?Qi(k,e):null;if(Array.isArray(n)&&2===n.length){const e=Ki(n[0]),o=Ki(n[1]);Number.isFinite(e)&&Number.isFinite(o)&&(t.xExtent=[e,o])}return t}),t=(null!=ye?ye:[]).map((e,t)=>{const n={id:xe(e,t),source:Qi(g,e)+"",target:Qi(y,e)+"",value:Number(Qi(p,e)),startTime:Ki(Qi(v,e)),endTime:Ki(Qi(m,e)),__raw:e};if(b){const t=Ki(Qi(b,e));Number.isFinite(t)&&(n.systemInTime=t)}if(x){const t=Ki(Qi(x,e));Number.isFinite(t)&&(n.systemOutTime=t)}return n}),n=[Ki(u[0]),Ki(u[1])],o=new Map;for(const t of e)null!=t.__raw&&o.set(t.id,t.__raw);const r=new Map;for(const e of t)null!=e.__raw&&r.set(e.id,e.__raw);return{nodes:e,edges:t,domain:n,rawNodeById:o,rawEdgeById:r}},[pe,ye,u,ke,xe,k,g,y,p,v,m,b,x]),Oe=ki({nodes:pe,edges:ye,inferNodes:!1,sourceAccessor:g,targetAccessor:y,colorBy:S,colorScheme:A,showLegend:!1,legendPosition:L,selection:void 0,linkedHover:void 0,onObservation:J,onClick:ee,chartType:"ProcessSankey",chartId:oe,marginDefaults:{top:30,right:80,bottom:40,left:80},userMargin:$,width:j,height:W,loading:X,loadingContent:G,emptyContent:q}),De=(null!=M?M:!!S)&&!!S,Ee=s(e=>null!=$&&("number"==typeof $||null!=$[e]),[$]),_e=i(()=>{const e=Object.assign({},Oe.margin);return De&&("right"===L&&!Ee("right")&&140>e.right?e.right=140:"bottom"===L&&!Ee("bottom")&&80>e.bottom&&(e.bottom=80)),e},[Oe.margin,De,L,Ee]),Ne=j-_e.left-_e.right,Pe=W-_e.top-_e.bottom,Te=i(()=>Ii(we,Se,Ae),[we,Se,Ae]),Ce=i(()=>Te.length>0?null:function(e,t,n){var o;const{plotH:r,pairing:i="temporal",packing:a="reuse",laneOrder:s="crossing-min",lifetimeMode:l="half"}=n,c=function(e,t){const n={},o={};for(const t of e)n[t.id]=[],o[t.id]=[];for(const e of t)o[e.source]&&o[e.source].push(e),n[e.target]&&n[e.target].push(e);return{incoming:n,outgoing:o}}(e,t),d=function(e,t,n,o="value"){const r="temporal"===o?(e,t)=>e.endTime-t.endTime:(e,t)=>t.value-e.value,i="temporal"===o?(e,t)=>e.startTime-t.startTime:(e,t)=>t.value-e.value,a=new Map;for(const e of t)a.set(e.id,{});const s=(e,t)=>{const n=new Map;for(const o of e){const e=o[t];n.has(e)||n.set(e,{partner:e,edges:[],total:0,earliestStart:1/0,latestEnd:-1/0});const r=n.get(e);r.edges.push(o),r.total+=o.value,r.earliestStart=Math.min(r.earliestStart,o.startTime),r.latestEnd=Math.max(r.latestEnd,o.endTime)}const a=[...n.values()];a.sort("temporal"===o?(e,n)=>"target"===t?e.earliestStart-n.earliestStart:e.latestEnd-n.latestEnd:(e,t)=>t.total-e.total);for(const e of a)e.edges.sort("target"===t?i:r);return a};for(const t of e){const e=n.outgoing[t.id],o=n.incoming[t.id];if(0===o.length)s(e,"target").forEach((e,t)=>{const n=t%2==0?"top":"bot";for(const t of e.edges)a.get(t.id).sourceSide=n});else if(0===e.length)s(o,"source").forEach((e,t)=>{const n=t%2==0?"top":"bot";for(const t of e.edges)a.get(t.id).targetSide=n});else{const t=s(o,"source"),n=s(e,"target"),r=Math.max(t.length,n.length);for(let e=0;r>e;e++){const o=e%2==0?"top":"bot";if(t[e])for(const n of t[e].edges)a.get(n.id).targetSide=o;if(n[e])for(const t of n[e].edges)a.get(t.id).sourceSide=o}}}return a}(e,t,c,i);let u={};for(const t of e)u[t.id]=Wi(t,c,d);const h=Gi(e,t,u,c,{plotH:r,padding:12,valueScale:1,packing:a,laneOrder:s,lifetimeMode:l}),f=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=d.get(e.id);t!==n?t>n?(o.sourceSide="top",o.targetSide="bot"):(o.sourceSide="bot",o.targetSide="top"):(f.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=>d.get(e.id).sourceSide)),r=new Set(n.map(e=>d.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]&&(d.get(t.id).targetSide=e)}if(1===r.size&&e.length>0){const t=[...r][0];for(const n of e)h.slotByNode[n.source]===h.slotByNode[n.target]&&(d.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"===d.get(n.id).targetSide?t.inTop+=n.value:t.inBot+=n.value;for(const e of n)"top"===d.get(e.id).sourceSide?t.outTop+=e.value:t.outBot+=e.value;return t},r=(e,t)=>{const r=o(),i="top"===e?r.outTop-r.inTop:r.outBot-r.inBot,a="top"===t?r.inTop-r.outTop:r.inBot-r.outBot;if(0>=i||0>=a)return!1;const s=Math.min(i,a),l=n.filter(t=>!f.has(t.id)&&d.get(t.id).sourceSide===e&&s>=t.value).sort((e,t)=>t.value-e.value);return 0!==l.length&&(d.get(l[0].id).sourceSide=t,!0)};let i=n.length+1;for(;i-- >0&&(r("top","bot")||r("bot","top")););}u={};for(const t of e)u[t.id]=Wi(t,c,d);const g=Gi(e,t,u,c,{plotH:r,padding:12,valueScale:1,packing:a,laneOrder:s,lifetimeMode:l}),y=null!==(o=g.effectiveSlotsHeight)&&void 0!==o?o:g.slots.reduce((e,t)=>e+t.peak.topPeak+t.peak.botPeak,0),p=Math.min(12,.35*r/Math.max(g.slots.length+1,1)),v=y>0?Math.max(0,(r-p*(g.slots.length+1))/y):1,m=Gi(e,t,u,c,{plotH:r,padding:p,valueScale:v,packing:a,laneOrder:s,lifetimeMode:l});return{nodeData:u,sides:d,valueScale:v,padding:p,compressedPadding:12>p,centerlines:m.centerlines,laneLifetime:m.laneLifetime,slots:m.slots,slotByNode:m.slotByNode,crossingsBefore:m.crossingsBefore,crossingsAfter:m.crossingsAfter,lengthBefore:m.lengthBefore,lengthAfter:m.lengthAfter}}(we,Se,{plotH:Pe,pairing:O,packing:D,laneOrder:E,lifetimeMode:P}),[Te,we,Se,Pe,O,D,E,P]),Ie=i(()=>N().domain(Ae).range([0,Ne]),[Ae,Ne]),je=s((e,t)=>{if(S&&pe){const t=Me.get(e);if(t)return qt(t,S,Oe.colorScale)}return Oe.effectivePalette[t%Oe.effectivePalette.length]||"#475569"},[S,pe,Me,Oe.colorScale,Oe.effectivePalette]),We=i(()=>{const e=new Map;return we.forEach((t,n)=>e.set(t.id,n)),e},[we]),$e=i(()=>{if(!Ce)return{bands:[],ribbons:[]};const{centerlines:e,nodeData:t,valueScale:n}=Ce,o=[],r=[];return we.forEach((r,i)=>{var a;const s=t[r.id];if(!s||0===s.samples.length)return;const l=function(e,t,n,o,r){if(0===e.length)return null;const i=Bi(e,r),a=e=>t-i[e].topMass*n,s=e=>t+i[e].botMass*n;let l=`M${o(i[0].t)},${a(0)}`;for(let e=1;i.length>e;e++)l+=` L${o(i[e].t)},${a(e)}`;l+=` L${o(i[i.length-1].t)},${s(i.length-1)}`;for(let e=i.length-2;e>=0;e--)l+=` L${o(i[e].t)},${s(e)}`;return l+" Z"}(s.samples,e[r.id],n,Ie,Ae);if(!l)return;const c=Bi(s.samples,Ae),d=c.find(e=>e.topMass+e.botMass>0)||c[0],u=e[r.id]+(d.botMass-d.topMass)*n/2,h=je(r.id,i),f=null!==(a=Me.get(r.id))&&void 0!==a?a:r,g=function(e,t,n,o,r){const i=n.nodeData[e];if(!i||0===i.samples.length)return[];const a=n.valueScale,s=n.centerlines[e],l=Bi(i.samples,r),c=l.find(e=>e.topMass+e.botMass>0)||l[0],d=[...l].reverse().find(e=>e.topMass+e.botMass>0)||l[l.length-1],u=o(c.t),h=o(d.t),f=e=>o($i(e,r)),g=[],y=(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=i.localAttachments.get(n.id);if(e&&"out"===e.kind&&n.startTime>n.systemInTime){const t=f(n.systemInTime),o=f(n.startTime),r=t-20,i=Math.max(u,r);if(o>i){const[n,l]=Ri(e,s,a);g.push({pathD:y(i,n,o,l),x0:r,x1:t,from:0,to:1})}}}if(n.target===e&&null!=n.systemOutTime&&Number.isFinite(n.systemOutTime)){const e=i.localAttachments.get(n.id);if(e&&"in"===e.kind&&n.systemOutTime>n.endTime){const t=f(n.systemOutTime),o=f(n.endTime),r=t+20,i=Math.min(h,r);if(i>o){const[n,l]=Ri(e,s,a);g.push({pathD:y(o,n,i,l),x0:t,x1:r,from:1,to:0})}}}}return g}(r.id,Se,Ce,Ie,Ae);o.push(Object.assign(Object.assign({id:r.id,pathD:l,fill:h,stroke:h,strokeWidth:.5},g.length>0&&{gradientStubs:g}),{rawDatum:f,labelX:Ie(d.t)-4,labelY:u,labelText:r.id}))}),Se.forEach(o=>{var i,a,s,l;const c=null===(i=t[o.source])||void 0===i?void 0:i.localAttachments.get(o.id),d=null===(a=t[o.target])||void 0===a?void 0:a.localAttachments.get(o.id);if(!c||!d)return;const u=null!==(s=We.get(o.source))&&void 0!==s?s:0,h=je(o.source,u),f=function(e,t,n,o,r,i,a,s){const l=r,c=e=>s?Math.max(s[0],Math.min(s[1],e)):e,d=i(c(e.time)),u=i(c(n.time)),h=e.value*l,f=n.value*l,g=e.sideMassBefore*l,y=n.sideMassAfter*l;let p,v,m,b;"top"===e.side?(p=t-g,v=p+h):(v=t+g,p=v-h),"top"===n.side?(m=o-y,b=m+f):(b=o+y,m=b-f);const x="source"===a?d+.85*(u-d):"target"===a?d+.15*(u-d):(d+u)/2;return{sx:d,sTop:p,sBot:v,tx:u,tTop:m,tBot:b,cp1X:x,cp2X:x}}(c,e[o.source],d,e[o.target],n,Ie,_,Ae),{pathD:g,bezier:y}=ut(f),p=null!==(l=Le.get(o.id))&&void 0!==l?l:o;r.push({id:o.id,pathD:g,fill:h,opacity:V,rawDatum:p,bezier:y})}),{bands:o,ribbons:r}},[Ce,we,Se,Ie,Ae,je,Me,Le,_,V,We]),Be=i(()=>({bands:$e.bands,ribbons:$e.ribbons,showLabels:I}),[$e,I]),Re=i(()=>{if(!De||!S)return;const e=new Map;(null!=pe?pe:[]).forEach((t,n)=>{const o=Qi(S,t),r=null==o?"":o+"";r&&!e.has(r)&&e.set(r,{label:r,color:je(ke(t),n)})});const t=Array.from(e.values());return 0!==t.length?{legendGroups:[{type:"fill",label:"",items:t,styleFn:e=>{const t=e.color||"#333";return{fill:t,stroke:t}}}]}:void 0},[De,S,pe,je,ke]),ze=i(()=>!1!==Z&&U?void 0===Z||!0===Z?null:ce(Z)||null:null,[Z,U]),He=s(e=>K?K(new Date(e)):Number.isFinite(e)?1e10>Math.abs(e)?Number.isInteger(e)?e+"":e.toFixed(2):new Date(e).toISOString().slice(0,10):"",[K]),Fe=s(e=>Q?Q(e):e+"",[Q]),Ye=s(o=>{if(!o||!o.data)return null;const r=o.data;if(!Vi(r))return null;const i=r.data;if(ze)return ze(i);if("band"===r.__kind){const n=r.id,o=Ce?function(e){if(!e)return[];const t=new Set,n=[];for(const o of e.samples){const e=o.topMass+o.botMass,r=`${o.t}:${e}`;t.has(r)||(t.add(r),n.push({t:o.t,total:e}))}return n}(Ce.nodeData[n]):[],i=5,a=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,r=[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"})],i=new Set,a=[];for(const e of r)i.has(e.t)||(i.add(e.t),a.push(e));return a.sort((e,t)=>e.t-t.t)}(o,i);return t("div",{style:{minWidth:160},children:[e("div",{style:{fontWeight:600,marginBottom:4},children:n}),s.length>0&&t("table",{style:{borderCollapse:"collapse",fontSize:11,width:"100%"},children:[e("thead",{children:t("tr",{style:{opacity:.6},children:[e("th",{style:{textAlign:"left",fontWeight:500,paddingRight:8},children:"Time"}),e("th",{style:{textAlign:"right",fontWeight:500},children:"Mass"}),null!=a&&e("th",{})]})}),e("tbody",{children:s.map((n,o)=>t("tr",{children:[e("td",{style:{paddingRight:8},children:He(n.t)}),e("td",{style:{textAlign:"right"},children:Fe(n.total)}),null!=a&&e("td",{style:{textAlign:"right",paddingLeft:8,opacity:.55},children:n.mark})]},o))})]}),null!=a&&t("div",{style:{marginTop:4,fontSize:10,opacity:.55},children:["showing ",s.length," of ",a," samples"]})]})}const a=i,s=Qi(g,a),l=Qi(y,a),c=Qi(p,a),d=Qi(v,a),u=Qi(m,a);return t("div",{style:{minWidth:160},children:[t("div",{style:{fontWeight:600,marginBottom:4},children:[s+""," → ",l+""]}),t("div",{style:{display:"grid",gridTemplateColumns:"auto 1fr",columnGap:8,fontSize:11},children:[null!=c&&t(n,{children:[e("span",{style:{opacity:.6},children:"value"}),e("span",{style:{textAlign:"right"},children:Fe(Number(c))})]}),null!=d&&t(n,{children:[e("span",{style:{opacity:.6},children:"start"}),e("span",{style:{textAlign:"right"},children:He(Ki(d))})]}),null!=u&&t(n,{children:[e("span",{style:{opacity:.6},children:"end"}),e("span",{style:{textAlign:"right"},children:He(Ki(u))})]})]})]})},[Ce,ze,He,Fe,g,y,p,v,m]),Xe=i(()=>{if(!Ce)return null;const{centerlines:n,laneLifetime:o,nodeData:r,valueScale:i,compressedPadding:a,crossingsBefore:s,crossingsAfter:l,lengthBefore:c,lengthAfter:d}=Ce;let u=null,f=null;for(const e of we){const t=o[e.id];if(!t||null===t.start||null===t.end)continue;const n=Ie(t.start),r=Ie(t.end);(null===u||u>n)&&(u=n),(null===f||r>f)&&(f=r)}const g=e=>Math.max(0,Math.min(Ne,e)),y=g(null!=u?u:0),p=Math.max(y,g(null!=f?f:Ne));return t("g",{children:[C&&null!==(null!=l?l:null)&&t("text",{x:Ne,y:-12,fontSize:10,fill:"#94a3b8",textAnchor:"end",children:["crossings: ",s," → ",l," ","edge length: ",Math.round(c)," → ",Math.round(d)]}),a&&e("text",{x:Ne,y:2,fontSize:10,fill:"#94a3b8",textAnchor:"end",children:"dense layout: lane gaps compressed"}),h.map((t,n)=>{const o=Ie(Ki(t.date));return y-.5>o||o>p+.5?null:e("line",{x1:o,y1:0,x2:o,y2:Pe,stroke:"#94a3b8",strokeOpacity:.15,strokeDasharray:"2 4"},"grid-"+n)}),T&&we.map((a,s)=>{const l=o[a.id];if(!l||null===l.start)return null;const c=r[a.id],d=c?{topPeak:c.topPeak,botPeak:c.botPeak}:{topPeak:0,botPeak:0},u=n[a.id]+(d.botPeak-d.topPeak)*i/2,h=Ie(l.start),f=Ie(l.end),g=je(a.id,s);return t("g",{children:[e("line",{x1:h,y1:u,x2:f,y2:u,stroke:g,strokeOpacity:.35,strokeWidth:1,strokeDasharray:"3 3"}),e("line",{x1:h,y1:u-4,x2:h,y2:u+4,stroke:g,strokeOpacity:.5}),e("line",{x1:f,y1:u-4,x2:f,y2:u+4,stroke:g,strokeOpacity:.5})]},"lane-"+a.id)}),e("line",{x1:y,y1:Pe+4,x2:p,y2:Pe+4,stroke:"#94a3b8"}),h.map((n,o)=>{const r=Ki(n.date),i=Ie(r);if(y-.5>i||i>p+.5)return null;const a=null!=n.label?n.label:K?K(new Date(r)):"";return t("g",{transform:`translate(${i},${Pe+4})`,children:[e("line",{y2:6,stroke:"#94a3b8"}),e("text",{y:20,textAnchor:"middle",fontSize:11,fill:"#475569",children:a})]},o)})]})},[Ce,h,Ie,Ne,Pe,T,we,je,C,K]),Ge=i(()=>(null!=pe?pe:[]).map(e=>({id:ke(e),data:e})),[pe,ke]),qe=i(()=>{const e=new Map;for(const t of $e.ribbons)t.bezier&&e.set(t.id,t.bezier);return e},[$e]),Ve=i(()=>(null!=ye?ye:[]).map((e,t)=>{const n=xe(e,t),o=Number(Qi(p,e));return{id:n,source:Qi(g,e)+"",target:Qi(y,e)+"",value:Number.isFinite(o)?o:0,bezier:qe.get(n),data:e}}),[ye,xe,g,y,p,qe]),Ke=Oe.loadingEl,Qe=Oe.emptyEl;return Te.length>0?t("svg",{width:j,height:W,role:"img","aria-label":null!=B?B:"Process Sankey validation failed",children:[e("text",{x:20,y:30,fontSize:13,fontWeight:600,fill:"var(--semiotic-danger, #dc2626)",children:"ProcessSankey: data invalid"}),Te.map((t,n)=>e("text",{x:20,y:56+18*n,fontSize:12,fill:"#64748b",children:"• "+ji(t)},n))]}):Ke||Qe||e($r,Object.assign({ref:ve,chartType:"force",nodes:Ge,edges:Ve,customNetworkLayout:qi,layoutConfig:Be,size:[j,W],responsiveWidth:F,responsiveHeight:Y,margin:_e,title:B,description:null!=R?R:"Temporal process flow with lifetime-bounded node lanes, mass bands, and value-scaled ribbons.",summary:z,accessibleTable:H,enableHover:U,tooltipContent:!1===Z?()=>null:Ye,backgroundGraphics:Xe,showParticles:te,particleStyle:ne,legend:Re,legendPosition:L,onObservation:J,customClickBehavior:ee?e=>{if(!e||!e.data)return;const t=e.data;Vi(t)&&ee(t.data,{x:e.x,y:e.y})}:void 0,chartId:oe,colorScheme:Array.isArray(A)?A:void 0},re))});Zi.displayName="ProcessSankey";const Ui=f(function(t,n){const{nodes:o,edges:a,layout:s,layoutConfig:l,nodeIDAccessor:c="id",sourceAccessor:d="source",targetAccessor:u="target",margin:h,className:f,colorScheme:g,selection:y,linkedHover:p,onObservation:v,onClick:m,chartId:b,annotations:x,autoPlaceAnnotations:k,frameProps:w={}}=t,{frameRef:S,resolved:A,normalizedMargin:M}=function(e){const t=r(null);return Br(e.imperativeRef,{variant:e.imperativeVariant,frameRef:t}),{frameRef:t,resolved:di(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:i(()=>function(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}(e.margin),[e.margin])}}({imperativeRef:n,imperativeVariant:"network",margin:h,width:t.width,height:t.height,enableHover:t.enableHover,title:t.title,mode:t.mode}),L=i(()=>xr(null!=o?o:[]),[o]),O=i(()=>xr(null!=a?a:[]),[a]),{customHoverBehavior:D,customClickBehavior:E,activeSelectionHook:_}=si({selection:y,linkedHover:p,fallbackFields:[],onObservation:v,onClick:m,chartType:"NetworkCustomChart",chartId:b}),N=i(()=>(null==_?void 0:_.isActive)?{isActive:!0,predicate:_.predicate}:null,[null==_?void 0:_.isActive,null==_?void 0:_.predicate]),{width:P,height:T,enableHover:C,title:I,description:j,summary:W,accessibleTable:$}=A,B=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"force"},null!=o&&{nodes:L}),null!=a&&{edges:O}),{customNetworkLayout:s,layoutConfig:l,nodeIDAccessor:c,sourceAccessor:d,targetAccessor:u,colorScheme:g,size:[P,T],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:M,className:f,title:I,description:j,summary:W,accessibleTable:$,enableHover:C,customHoverBehavior:p||v||m?D:void 0,customClickBehavior:v||m?E:void 0,layoutSelection:N}),null!=x&&{annotations:x}),null!=k&&{autoPlaceAnnotations:k}),w);return e(mi,{componentName:"NetworkCustomChart",width:P,height:T,children:e($r,Object.assign({ref:S},B))})});Ui.displayName="NetworkCustomChart";export{Ei as ChordDiagram,Pi as CirclePack,Oi as ForceDirectedGraph,Ui as NetworkCustomChart,Ci as OrbitDiagram,Zi as ProcessSankey,Di as SankeyDiagram,$r as StreamNetworkFrame,_i as TreeDiagram,Ni as Treemap,ji as formatProcessSankeyIssue,cn as useCustomLayoutSelection,Ii as validateProcessSankey};
|
|
2
|
+
import{useRef as e,useState as t,useEffect as n,useMemo as r,useCallback as o,useImperativeHandle as i,forwardRef as a,memo as s}from"react";function c(e){return Array.isArray(e)?e[0]:e}function l(e,t,n,r){return{data:c(e),x:t,y:n,__semioticHoverData:!0,...r}}var u={weightChange:.1,newEdge:.5,newNode:1,threshold:3,transitionDuration:500},d={radius:3,opacity:.7,speedMultiplier:1,maxPerEdge:50,spawnRate:.1},h=class{constructor(e){this.capacity=e,this.particles=Array(e),this._freeIndices=Array(e);for(let t=0;e>t;t++)this.particles[t]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0},this._freeIndices[t]=e-1-t}spawn(e,t=Math.random){const n=this._freeIndices.pop();if(void 0===n)return null;const r=this.particles[n];return r.active=!0,r.t=0,r.offset=t()-.5,r.edgeIndex=e,r.x=0,r.y=0,r}step(e,t,n,r){for(let o=0;this.capacity>o;o++){const i=this.particles[o];if(!i.active)continue;const a=n[i.edgeIndex];a&&a.bezier?(i.t+=e*t*(r?r[i.edgeIndex]??1:1)*(a.bezier.circular?.3:1),1>i.t?f(a.bezier,i.t,i.offset,i):(i.active=!1,this._freeIndices.push(o))):(i.active=!1,this._freeIndices.push(o))}}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 f(e,t,n,r){if(e.circular&&e.segments)return void function(e,t,n,r,o){const i=e.length,a=t*i,s=Math.min(Math.floor(a),i-1),c=a-s,[l,u,d,h]=e[s];g(l,u,d,h,c,o);const f=h.x-l.x,p=h.y-l.y,y=Math.sqrt(f*f+p*p);if(y>.001){const e=f/y;o.x+=-p/y*n*r*2,o.y+=e*n*r*2}}(e.segments,t,n,e.halfWidth,r);if(!e.points)return r.x=0,void(r.y=0);const[o,i,a,s]=e.points;g(o,i,a,s,t,r);const c=s.x-o.x,l=s.y-o.y,u=Math.sqrt(c*c+l*l);if(u>.001){const t=c/u;r.x+=-l/u*n*e.halfWidth*2,r.y+=t*n*e.halfWidth*2}}function g(e,t,n,r,o,i){const a=1-o,s=a*a,c=s*a,l=o*o,u=l*o;i.x=c*e.x+3*s*o*t.x+3*a*l*n.x+u*r.x,i.y=c*e.y+3*s*o*t.y+3*a*l*n.y+u*r.y}function p(e,t){var n=e.get(t);if(!n)throw Error("missing: "+t);return n}function y(e,t){var n,r=[],o=[],i=[],a={},s=[];function c(e){i[e]=!1,a.hasOwnProperty(e)&&Object.keys(a[e]).forEach(function(t){delete a[e][t],i[t]&&c(t)})}function l(e){var t,r,d=!1;for(o.push(e),i[e]=!0,t=0;s[e].length>t;t++)(r=s[e][t])===n?(u(n,o),d=!0):i[r]||(d=l(r));if(d)c(e);else for(t=0;s[e].length>t;t++){var h=a[r=s[e][t]];h||(a[r]=h={}),h[r]=!0}return o.pop(),d}function u(e,n){var o=[].concat(n).concat(e);t?t(o):r.push(o)}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,r=function(e){for(var t=e.length,n=Array(t),r=Array(t),o=Array(t),i=Array(t),a=Array(t),s=Array(t),c=0;t>c;++c)n[c]=-1,r[c]=0,o[c]=!1,i[c]=0,a[c]=-1,s[c]=[];var l,u=0,d=[],h=[];function f(t){var c=[t],l=[t];for(n[t]=r[t]=u,o[t]=!0,u+=1;l.length>0;){var f=e[t=l[l.length-1]];if(f.length>i[t]){for(var g=i[t];f.length>g;++g){var p=f[g];if(0>n[p]){n[p]=r[p]=u,o[p]=!0,u+=1,c.push(p),l.push(p);break}o[p]&&(r[t]=0|Math.min(r[t],r[p])),0>a[p]||s[t].push(a[p])}i[t]=g}else{if(r[t]===n[t]){var y=[],m=[],v=0;for(g=c.length-1;g>=0;--g){var b=c[g];if(o[b]=!1,y.push(b),m.push(s[b]),v+=s[b].length,a[b]=d.length,b===t){c.length=g;break}}d.push(y);var x=Array(v);for(g=0;m.length>g;g++)for(var k=0;m[g].length>k;k++)x[--v]=m[g][k];h.push(x)}l.pop()}}}for(c=0;t>c;++c)0>n[c]&&f(c);for(c=0;h.length>c;c++){var g=h[c];if(0!==g.length){g.sort(function(e,t){return e-t}),l=[g[0]];for(var p=1;g.length>p;p++)g[p]!==g[p-1]&&l.push(g[p]);h[c]=l}}return{components:d,adjacencyList:h}}(e),o=r.components.filter(function(e){return e.length>1}),i=1/0,a=0;o.length>a;a++)for(var s=0;o[a].length>s;s++)i>o[a][s]&&(i=o[a][s],n=a);var c=o[n];return!!c&&{leastVertex:i,adjList:e.map(function(e,t){return-1===c.indexOf(t)?[]:e.filter(function(e){return-1!==c.indexOf(e)})})}}n=0;for(var h=e.length;h>n;){var f=d(n);if(n=f.leastVertex,s=f.adjList){for(var g=0;s.length>g;g++)for(var p=0;s[g].length>p;p++){var y=s[g][p];i[+y]=!1,a[y]={}}l(n),n+=1}else n=h}return t?void 0:r}function m(e){return e.y0-e.y1>0?"up":"down"}function v(e,t){return t(e.source)==t(e.target)}function b(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 x(e){return e.target.x0-e.source.x1}function k(e,t){var n=S(e),r=x(t)/Math.tan(n);return"up"==m(e)?e.y1-r:e.y1+r}function w(e,t){var n=S(e),r=x(t)/Math.tan(n);return"up"==m(e)?e.y1+r:e.y1-r}function S(e){var t=Math.abs(e.y1-e.y0);return Math.atan(Math.abs(e.target.x0-e.source.x1)/t)}function A(e,t){return t(e)}function M(e){return L(e.source)}function C(e){return L(e.target)}function L(e){return(e.y0+e.y1)/2}function T(e){return e.virtual?0:e.value}function E(e,t){var n=0;e.sourceLinks.forEach(function(e){n=e.circular&&!v(e,t)?n+1:n});var r=0;return e.targetLinks.forEach(function(e){r=e.circular&&!v(e,t)?r+1:r}),n+r}function D(e){return e.target.depth}function I(e,t){return e.sourceLinks.length?e.depth:t-1}function N(e,t){return e.y0-t.y0}function P(e,t){return t.y0-e.y0}function _(e,t){return e.y1-t.y1}function R(e,t){return t.y1-e.y1}function W(e,t){return O(e.source,t.source)||e.index-t.index}function $(e,t){return O(e.target,t.target)||e.index-t.index}function O(e,t){return e.partOfCycle===t.partOfCycle?e.y0-t.y0:"top"===e.circularLinkType||"bottom"===t.circularLinkType?-1:1}function B(e,t){return z(e)==z(t)?"bottom"==e.circularLinkType?P(e,t):N(e,t):z(t)-z(e)}function z(e){return e.target.column-e.source.column}function j(e,t){return H(e)==H(t)}function H(e){return e.y0-e.y1>0?"up":"down"}import{min as F}from"d3-array";function Y(e,t,n,r,o){let i=e;var a=Math.max(8,.15*(i.y1-i.y0));i.links.forEach(function(e){e.circular&&(e._circularWidth=Math.min(e.width,a))});var s=F(i.links,function(e){return e.source.y0});i.links.forEach(function(e){e.circular&&(e.circularPathData={})});var c=i.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}),X(i.links.filter(function(e){return"top"==e.circularLinkType}),t,n),X(i.links.filter(function(e){return"bottom"==e.circularLinkType}),t,n),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,v(e,t)&&b(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+o+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-o-e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius);else{var a=e.source.column,c=e.circularLinkType,l=i.links.filter(function(e){return e.source.column==a&&e.circularLinkType==c});l.sort("bottom"==e.circularLinkType?P:N);var u=0;l.forEach(function(t,o){t.circularLinkID==e.circularLinkID&&(e.circularPathData.rightSmallArcRadius=r+e._circularWidth/2+u,e.circularPathData.rightLargeArcRadius=r+e._circularWidth/2+o*n+u),u+=t._circularWidth||t.width}),a=e.target.column,(l=i.links.filter(function(e){return e.target.column==a&&e.circularLinkType==c})).sort("bottom"==e.circularLinkType?R:_),u=0,l.forEach(function(t,o){t.circularLinkID==e.circularLinkID&&(e.circularPathData.leftSmallArcRadius=r+e._circularWidth/2+u,e.circularPathData.leftLargeArcRadius=r+e._circularWidth/2+o*n+u),u+=t._circularWidth||t.width}),"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=Math.max(i.y1,e.source.y1,e.target.y1)+o+e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius):(e.circularPathData.verticalFullExtent=s-o-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,r=e.target.x0,o=e.y1,i=(t+r)/2;return"M"+t+","+n+"C"+i+","+n+" "+i+","+o+" "+r+","+o}(e)}),i}function X(e,t,n){e.sort(B);var r=e.filter(function(e){return!e._circularStub});return e.forEach(function(e,o){var i=0;if(e._circularStub)e.circularPathData.verticalBuffer=0;else if(v(e,t)&&b(e))e.circularPathData.verticalBuffer=i+e._circularWidth/2;else{for(var a=0;r.length>a;a++){var s=r[a];if(s!==e&&s.circularPathData&&void 0!==s.circularPathData.verticalBuffer&&G(e,s)){var c=s.circularPathData.verticalBuffer+(s._circularWidth||s.width)/2+n;i=c>i?c:i}}e.circularPathData.verticalBuffer=i+e._circularWidth/2}}),e}function G(e,t){return e.source.column>=t.target.column&&t.source.column>=e.target.column}import{min as V,max as q,sum as U,mean as K,group as Q,groups as Z}from"d3-array";function J(e){return function(){return e}}function ee(e){return e.index}function te(e){return e.nodes}function ne(e){return e.links}function re(e,t,n){var r=Z(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(o,i){var a=o.length;if(t)o.sort(t);else if(i>0){var s=new Map;o.forEach(function(e,t){var n,r,o,i=(r=0,o=0,(n=e).targetLinks.forEach(function(e){if(!e.circular){var t=e.value||1;o+=L(e.source)*t,r+=t}}),n.sourceLinks.forEach(function(e){if(!e.circular){var t=e.value||1;o+=L(e.target)*t,r+=t}}),r>0?o/r:NaN);s.set(e,{bc:i,idx:t})}),o.sort(function(e,t){var n=s.get(e),r=s.get(t),o=n.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(o)||isNaN(i)?isNaN(o)?isNaN(i)?n.idx-r.idx:1:-1:o-i})}else o.sort(function(e,t){return e.circularLinkType==t.circularLinkType?E(t,n)-E(e,n):"top"==e.circularLinkType&&"bottom"==t.circularLinkType||"top"==e.circularLinkType&&0==t.partOfCycle||0==e.partOfCycle&&"bottom"==t.circularLinkType?-1:0});o.forEach(function(t,o){t.depth==r.length-1&&1==a||0==t.depth&&1==a?(t.y0=e.y1/2-t.value*e.ky,t.y1=t.y0+t.value*e.ky):t.partOfCycle?0==E(t,n)?(t.y0=e.y1/2+o,t.y1=t.y0+t.value*e.ky):"top"==t.circularLinkType?(t.y0=e.y0+o,t.y1=t.y0+t.value*e.ky):(t.y0=e.y1-t.value*e.ky-o,t.y1=t.y0+t.value*e.ky):0==e.y0||0==e.y1?(t.y0=(e.y1-e.y0)/a*o,t.y1=t.y0+t.value*e.ky):(t.y0=(e.y1-e.y0)/2-a/2+o,t.y1=t.y0+t.value*e.ky)})})}function oe(e,t,n,r,o,i){var a=Z(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});u();for(var s=1,c=i;c>0;--c)l(s*=.99,n),u();function l(t,n){var r=a.length;a.forEach(function(o){var i=o.length,a=o[0].depth;o.forEach(function(o){var s;if(o.sourceLinks.length||o.targetLinks.length)if(o.partOfCycle&&E(o,n)>0){var c=K(o.sourceLinks,C),l=K(o.targetLinks,M),u=c&&l?(c+l)/2:c||l;if(u){var d=(u-L(o))*t*.3;o.y0+=d,o.y1+=d}}else if(0==a&&1==i)o.y0=e.y1/2-(s=o.y1-o.y0)/2,o.y1=e.y1/2+s/2;else if(a==r-1&&1==i)o.y0=e.y1/2-(s=o.y1-o.y0)/2,o.y1=e.y1/2+s/2;else if(1==o.targetLinks.length&&1==o.targetLinks[0].source.sourceLinks.length)s=o.y1-o.y0,o.y0=o.targetLinks[0].source.y0,o.y1=o.y0+s;else{var h=K(o.sourceLinks,C),f=K(o.targetLinks,M),g=((h&&f?(h+f)/2:h||f)-L(o))*t;o.y0+=g,o.y1+=g}})})}function u(){a.forEach(function(n){var i,a,s,c=e.y0,l=n.length;for(n.sort(t||O),s=0;l>s;++s)(a=c-(i=n[s]).y0)>0&&(i.y0+=a,i.y1+=a),c=i.y1+r;if((a=c-r-e.y1)>0)for(c=i.y0-=a,i.y1-=a,s=l-2;s>=0;--s)(a=(i=n[s]).y1+o-c)>0&&(i.y0-=a,i.y1-=a),c=i.y0})}}function ie(e){e.nodes.forEach(function(e){e.sourceLinks.sort($),e.targetLinks.sort(W)}),e.nodes.forEach(function(e){var t=e.y0,n=t,r=e.y1,o=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=o-e.width/2,o-=e.width):(e.y1=n+e.width/2,n+=e.width)})})}function ae(){var e=0,t=0,n=1,r=1,o=24,i=8,a=null,s=ee,c=I,l=void 0,u=32,d=2,h=te,f=ne;function g(){var g={nodes:h.apply(null,arguments),links:f.apply(null,arguments)};return function(h){h.x0=e,h.y0=t,h.x1=n,h.y1=r,h.py=0,function(e,t){e.nodes.forEach(function(e,t){e.index=t,e.sourceLinks=[],e.targetLinks=[]});var n=function(e,t){var n=new Map;return Q(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 r=e.source,o=e.target;"object"!=typeof r&&(r=e.source=p(n,r)),"object"!=typeof o&&(o=e.target=p(n,o)),r.sourceLinks.push(e),o.targetLinks.push(e)})}(h,s),function(e,t){var n=0;if(null==t){for(var r=[],o=0;e.links.length>o;o++){var i=e.links[o],a=i.source.index,s=i.target.index;r[a]||(r[a]=[]),r[s]||(r[s]=[]),-1===r[a].indexOf(s)&&r[a].push(s)}var c=y(r);c.sort(function(e,t){return e.length-t.length});var l={};for(o=0;c.length>o;o++){var u=c[o].slice(-2);l[u[0]]||(l[u[0]]={}),l[u[0]][u[1]]=!0}e.links.forEach(function(e){var t=e.target.index,r=e.source.index;t===r||l[r]&&l[r][t]?(e.circular=!0,e.circularLinkID=n++):e.circular=!1})}else e.links.forEach(function(e){t(e.source)<t(e.target)?e.circular=!1:(e.circular=!0,e.circularLinkID=n++)})}(h,l),function(e,t){var n=0,r=0;e.links.forEach(function(o){o.circular&&(o.circularLinkType=o.source.circularLinkType||o.target.circularLinkType?o.source.circularLinkType?o.source.circularLinkType:o.target.circularLinkType:r>n?"top":"bottom","top"==o.circularLinkType?n++:r++,e.nodes.forEach(function(e){A(e,t)!=A(o.source,t)&&A(e,t)!=A(o.target,t)||(e.circularLinkType=o.circularLinkType)}))}),e.links.forEach(function(e){e.circular&&(e.source.circularLinkType==e.target.circularLinkType&&(e.circularLinkType=e.source.circularLinkType),v(e,t)&&(e.circularLinkType=e.source.circularLinkType))})}(h,s),function(e){e.nodes.forEach(function(e){e.partOfCycle=!1,e.value=Math.max(U(e.sourceLinks,T),U(e.targetLinks,T)),e.sourceLinks.forEach(function(t){t.circular&&(e.partOfCycle=!0,e.circularLinkType=t.circularLinkType)}),e.targetLinks.forEach(function(t){t.circular&&(e.partOfCycle=!0,e.circularLinkType=t.circularLinkType)})})}(h),function(e,t,n){var r,o,i;if(null!=t){e.nodes.sort(function(e,n){return t(e)<t(n)?-1:1});var a=0,s=t(e.nodes[0]);e.nodes.forEach(function(e){a=t(e)==s?a:a+1,s=t(e)==s?s:t(e),e.column=a})}for(r=e.nodes,o=[],i=0;r.length;++i,r=o,o=[])r.forEach(function(e){e.depth=i,e.sourceLinks.forEach(function(e){0>o.indexOf(e.target)&&!e.circular&&o.push(e.target)})});for(r=e.nodes,o=[],i=0;r.length;++i,r=o,o=[])r.forEach(function(e){e.height=i,e.targetLinks.forEach(function(e){0>o.indexOf(e.source)&&!e.circular&&o.push(e.source)})});e.nodes.forEach(function(e){e.column=null==t?n(e,i):e.column})}(h,l,c);var f=i;if(null!==a){var g=Z(h.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]}),m=q(g,function(e){return e.length});m>1&&(f=Math.max(1,(r-t)*a/(m-1)))}(function(e,t,n){var r=Z(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 o=V(r,function(t){return(e.y1-e.y0-(t.length-1)*e.py)/U(t,function(e){return e.value})});e.ky=o,e.links.forEach(function(t){t.width=t.value*e.ky});var i=q(e.nodes,function(e){return e.column});e.nodes.forEach(i>0?function(t){t.x0=e.x0+t.column*((e.x1-e.x0-n)/i),t.x1=t.x0+n}:function(t){t.x0=e.x0,t.x1=t.x0+n})})(h,f,o),re(h,l,s),oe(h,l,s,f,f,u),ie(h),Y(h,s,d,10,8),re(h,l,s),oe(h,l,s,f,f,u),ie(h),Y(h,s,d,10,8),function(e,t){let n=e;n.nodes.forEach(function(e){e.y+(e.y1-e.y0)>n.y1&&(e.y=e.y-(e.y+(e.y1-e.y0)-n.y1));var r=n.links.filter(function(n){return A(n.source,t)==A(e,t)}),o=r.length;o>1&&r.sort(function(e,t){if(!e.circular&&!t.circular){if(e.target.column==t.target.column)return e.y1-t.y1;if(!j(e,t))return e.y1-t.y1;if(e.target.column>t.target.column){var n=k(t,e);return e.y1-n}if(t.target.column>e.target.column)return k(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,n){if("bottom"==t.circularLinkType){for(var i=n+1,a=0;o>i;i++)a+=r[i].width;t.y0=e.y1-a-t.width/2}})})}(h,s),function(e,t){let n=e;n.nodes.forEach(function(e){var r=n.links.filter(function(n){return A(n.target,t)==A(e,t)}),o=r.length;o>1&&r.sort(function(e,t){if(!e.circular&&!t.circular){if(e.source.column==t.source.column)return e.y0-t.y0;if(!j(e,t))return e.y0-t.y0;if(e.source.column>t.source.column){var n=w(t,e);return e.y0-n}if(t.source.column>e.source.column)return w(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,n){if("bottom"==t.circularLinkType){for(var i=n+1,a=0;o>i;i++)a+=r[i].width;t.y1=e.y1-a-t.width/2}})})}(h,s),function(e){var t=e.nodes,n=e.links,r=!1,o=!1;if(n.forEach(function(e){"top"==e.circularLinkType?r=!0:"bottom"==e.circularLinkType&&(o=!0)}),0==r||0==o){let r=function(t){return(t-i)/(a-i)*(e.y1-e.y0)+e.y0};var i=V(t,function(e){return e.y0}),a=q(t,function(e){return e.y1}),s=(e.y1-e.y0)/(a-i);1>s?(t.forEach(function(e){e.y0=r(e.y0),e.y1=r(e.y1)}),n.forEach(function(e){e.y0=r(e.y0),e.y1=r(e.y1),e.width=e.width*s})):t.forEach(function(e){var t=e.y1-e.y0,n=r(e.y0)-e.y0;e.y0=r(e.y0),e.y1=e.y0+t,e.sourceLinks.forEach(function(e){e.y0=e.y0+n}),e.targetLinks.forEach(function(e){e.y1=e.y1+n})})}}(h),Y(h,s,d,10,8)}(g),g}return g.update=function(e){return ie(e),Y(e,s,d,10,8),e},g.nodeWidth=function(e){return arguments.length?(o=+e,g):o},g.nodePadding=function(e){return arguments.length?(i=+e,g):i},g.nodePaddingRatio=function(e){return arguments.length?(a=+e,g):a},g.nodes=function(e){return arguments.length?(h="function"==typeof e?e:J(e),g):h},g.links=function(e){return arguments.length?(f="function"==typeof e?e:J(e),g):f},g.nodeId=function(e){return arguments.length?(s="function"==typeof e?e:J(e),g):s},g.nodeAlign=function(e){return arguments.length?(c="function"==typeof e?e:J(e),g):c},g.nodeSort=function(e){return arguments.length?(l=e,g):l},g.iterations=function(e){return arguments.length?(u=+e,g):u},g.circularLinkGap=function(e){return arguments.length?(d=+e,g):d},g.extent=function(o){return arguments.length?(e=+o[0][0],t=+o[0][1],n=+o[1][0],r=+o[1][1],g):[[e,t],[n,r]]},g.size=function(o){return arguments.length?(e=t=0,n=+o[0],r=+o[1],g):[n-e,r-t]},g}function se(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function ce(e,t,n){const r=e=>e.toString(16).padStart(2,"0");return`#${r(e)}${r(t)}${r(n)}`}function le(e){const t=e.map(se),n=t.length-1;return e=>{if(0>=e){const[e,n,r]=t[0];return ce(e,n,r)}if(e>=1){const[e,r,o]=t[n];return ce(e,r,o)}const r=e*n,o=Math.floor(r),i=r-o,[a,s,c]=t[o],[l,u,d]=t[o+1];return ce(Math.round(a+(l-a)*i),Math.round(s+(u-s)*i),Math.round(c+(d-c)*i))}}var ue=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],de=le(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),he=le(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),fe=le(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),ge=le(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),pe=le(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),ye=le(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),me={blues:de,reds:he,greens:fe,viridis:le(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),oranges:ge,purples:pe,greys:ye,plasma:le(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),inferno:le(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),magma:le(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),cividis:le(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),turbo:le(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"])};le(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),le(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),le(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),le(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),le(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),le(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),le(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]);import{interpolateNumber as ve}from"d3-interpolate";import{line as be,curveLinearClosed as xe}from"d3-shape";function ke(e){const{sx:t,sTop:n,sBot:r,tx:o,tTop:i,tBot:a,cp1X:s,cp2X:c}=e,l=(n+r)/2,u=(i+a)/2;return{pathD:[`M${t},${n}`,`C${s},${n} ${c},${i} ${o},${i}`,`L${o},${a}`,`C${c},${a} ${s},${r} ${t},${r}`,"Z"].join(" "),bezier:{circular:!1,points:[{x:t,y:l},{x:s,y:l},{x:c,y:u},{x:o,y:u}],halfWidth:(r-n)/2}}}var we=e=>{let t,n,r,o,i,a,s,c,l;if("down"===e.direction)return t=e.y0-e.sankeyWidth/2,n=e.y1-e.sankeyWidth/2,r=e.y1+e.sankeyWidth/2,o=e.y0+e.sankeyWidth/2,i=e.source.x1,a=e.target.x0,s=ve(i,a),c=s(.5),l=s(.5),`M${t},${i}C${t},${c} ${n},${l} ${n},${a}L${r},${a}C${r},${l} ${o},${c} ${o},${i}Z`;const u=e.sankeyWidth/2,d=ve(e.source.x1,e.target.x0),{pathD:h}=ke({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 Se(e){const t=e.sankeyWidth/2,n=(e._circularWidth??e.sankeyWidth)/2,r=e.circularPathData;if(!r)return null;if("down"===e.direction)return null;if(e._circularStub){const n=r.sourceX,o=r.sourceY,i=r.targetX,a=r.targetY;if("object"!=typeof e.source||!e.source||"object"!=typeof e.target||!e.target)return null;const s=Math.max(15,Math.min(40,.33*(r.rightFullExtent-n))),c=Math.max(15,Math.min(40,.33*(i-r.leftFullExtent)));return`M${n},${o-t}L${n+s},${o-t}L${n+s},${o+t}L${n},${o+t}ZM${i},${a-t}L${i-c},${a-t}L${i-c},${a+t}L${i},${a+t}Z`}const o=r.sourceX,i=r.sourceY,a=r.targetX,s=r.targetY,c=r.rightFullExtent,l=r.leftFullExtent,u=r.verticalFullExtent,d="bottom"===e.circularLinkType?1:-1,h=Math.max(4,Math.min(n,15));return`M${o},${i-d*t}L${c},${i-d*t}L${c+n},${i-d*t+d*h}L${c+n},${u+d*n-d*h}L${c+n-h},${u+d*n}L${l-n+h},${u+d*n}L${l-n},${u+d*n-d*h}L${l-n},${s-d*t+d*h}L${l-n+h},${s-d*t}L${a},${s-d*t}L${a},${s+d*t}L${l+n},${s+d*t}L${l+n},${u-d*n}L${c-n},${u-d*n}L${c-n},${i+d*t}L${o},${i+d*t}Z`}var Ae=new Set,Me=new WeakMap;function Ce(e,t){if("production"===process.env.NODE_ENV)return e;if(!e||!e.data||"object"!=typeof e.data)return e;let n=Me.get(e);if(n){const e=n.get(t);if(e)return e}else n=new Map,Me.set(e,n);const r=new Proxy(e,{get(e,n,r){if("string"==typeof n&&!(n in e)&&e.data&&n in e.data){const e=`${t}:${n}`;Ae.has(e)||(Ae.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,r)}});return n.set(t,r),r}var Le={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(D))-1:0},justify:I};function Te(e){return"string"==typeof e?e:e.id}var Ee={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,n,r){if(0===e.length)return;const o="vertical"===n.orientation?"down":"right",i=n.nodeAlign||"justify",a=n.nodeWidth??15,s=n.nodePaddingRatio??.05,c=n.iterations??100,l=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"===o?[[0,0],[r[1],r[0]]]:[[0,0],[r[0],r[1]]];const h=ae().extent(d).links(u).nodes(l).nodeAlign(Le[i]||I).nodeId(e=>e.id).nodeWidth(a).iterations(c);h.nodePaddingRatio&&h.nodePaddingRatio(s),h();{let e=1/0,t=-1/0,n=1/0,o=-1/0;for(const r of l)e>r.x0&&(e=r.x0),r.x1>t&&(t=r.x1),n>r.y0&&(n=r.y0),r.y1>o&&(o=r.y1);for(const r of u){if(!r.circular||!r.circularPathData)continue;const i=r.circularPathData,a=(r._circularWidth??r.width??0)/2;e>i.leftFullExtent-a&&(e=i.leftFullExtent-a),i.rightFullExtent+a>t&&(t=i.rightFullExtent+a),n>i.verticalFullExtent-a&&(n=i.verticalFullExtent-a),i.verticalFullExtent+a>o&&(o=i.verticalFullExtent+a)}const i=t-e,a=o-n,s=r[0],c=r[1];if(i>0&&a>0&&(0>e||0>n||t>s||o>c)){const t=Math.min(s/i,c/a),r=-e*t+(s-i*t)/2,o=-n*t+(c-a*t)/2;for(const e of l)e.x0=e.x0*t+r,e.x1=e.x1*t+r,e.y0=e.y0*t+o,e.y1=e.y1*t+o;for(const e of u)if(e.y0=e.y0*t+o,e.y1=e.y1*t+o,e.width=(e.width??0)*t,e._circularWidth&&(e._circularWidth*=t),e.circular&&e.circularPathData){const n=e.circularPathData;n.sourceX=n.sourceX*t+r,n.targetX=n.targetX*t+r,n.sourceY=n.sourceY*t+o,n.targetY=n.targetY*t+o,n.rightFullExtent=n.rightFullExtent*t+r,n.leftFullExtent=n.leftFullExtent*t+r,n.verticalFullExtent=n.verticalFullExtent*t+o,n.rightInnerExtent=n.rightInnerExtent*t+r,n.leftInnerExtent=n.leftInnerExtent*t+r,n.verticalRightInnerExtent=n.verticalRightInnerExtent*t+o,n.verticalLeftInnerExtent=n.verticalLeftInnerExtent*t+o,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 f=new Map;for(const t of e)f.set(t.id,t);for(const e of l){const t=f.get(e.id);t&&(t.x0=e.x0,t.x1=e.x1,t.y0=e.y0,t.y1=e.y1,t.value=e.value,t.depth=e.depth,t.sourceLinks=e.sourceLinks,t.targetLinks=e.targetLinks,t.width=e.x1-e.x0,t.height=e.y1-e.y0,t.x=e.x0+(e.x1-e.x0)/2,t.y=e.y0+(e.y1-e.y0)/2)}const g=new Map;for(const e of t)g.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=Te(e.source),n=Te(e.target),r=g.get(e._edgeKey?e._edgeKey:`${t}\0${n}`);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=o;const i=f.get(t),a=f.get(n);i&&(r.source=i),a&&(r.target=a)}}},buildScene(e,t,n,r){const o="vertical"===n.orientation?"down":"right",i=n.nodeStyle,a=n.edgeStyle,s=n.edgeOpacity??.5,c=n.edgeColorBy||"source",l=Array.isArray(n.colorScheme)?n.colorScheme:n.themeCategorical&&n.themeCategorical.length>0?n.themeCategorical:ue,u=new Map;e.forEach((e,t)=>{u.set(e.id,l[t%l.length])});const d=[],h=[],f=[],g=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 r=i?i(Ce(t,"nodeStyle")):{},a={fill:r.fill||u.get(t.id)||"#4d430c",stroke:r.stroke,strokeWidth:r.strokeWidth,opacity:r.opacity};g.set(t.id,("string"==typeof a.fill?a.fill:null)||u.get(t.id)||"#4d430c"),d.push("down"===o?{type:"rect",x:t.y0,y:t.x0,w:n,h:e,style:a,datum:t,id:t.id,label:t.id}:{type:"rect",x:t.x0,y:t.y0,w:e,h:n,style:a,datum:t,id:t.id,label:t.id})}const p=[...t].sort((e,t)=>(t.sankeyWidth||0)-(e.sankeyWidth||0));for(const e of p){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 o=n.themeSemantic?.border||n.themeSemantic?.secondary||"#999";o="function"==typeof c?c(e)||o:"target"===c?g.get(r.id)||u.get(r.id)||o:g.get(t.id)||u.get(t.id)||o;const i=a?a(Ce(e,"edgeStyle")):{};if(e._circularStub&&e.circular&&e.circularPathData){const t=e.circularPathData,n=e.sankeyWidth/2,r=Math.max(15,Math.min(40,.33*(t.rightFullExtent-t.sourceX))),a=Math.max(15,Math.min(40,.33*(t.targetX-t.leftFullExtent))),c=i.fill||o;h.push({type:"bezier",pathD:`M${t.sourceX},${t.sourceY-n}L${t.sourceX+r},${t.sourceY-n}L${t.sourceX+r},${t.sourceY+n}L${t.sourceX},${t.sourceY+n}Z`,style:{fill:c,fillOpacity:i.fillOpacity??s,stroke:"none",opacity:i.opacity},datum:e,_gradient:{direction:"right",from:1,to:0,x0:t.sourceX,x1:t.sourceX+r}}),h.push({type:"bezier",pathD:`M${t.targetX},${t.targetY-n}L${t.targetX-a},${t.targetY-n}L${t.targetX-a},${t.targetY+n}L${t.targetX},${t.targetY+n}Z`,style:{fill:c,fillOpacity:i.fillOpacity??s,stroke:"none",opacity:i.opacity},datum:e,_gradient:{direction:"left",from:0,to:1,x0:t.targetX-a,x1:t.targetX}});continue}let l;(l=e.circular&&e.circularPathData?Se(e):we(e),l)&&h.push({type:"bezier",pathD:l,bezierCache:e.bezier,style:{fill:i.fill||o,fillOpacity:i.fillOpacity??s,stroke:i.stroke||"none",strokeWidth:i.strokeWidth,opacity:i.opacity},datum:e})}if(!1!==n.showLabels){const t=(y=n.nodeLabel)?"function"==typeof y?y:e=>e[y]||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 a=t?t(n):n.id;if(!a)continue;let s,c,l;"down"===o?(s=n.y0+(n.y1-n.y0)/2,c=n.x1+14,l="start"):(r[0]/2>n.x0+e/2?(s=n.x0-6,l="end"):(s=n.x1+6,l="start"),c=n.y0+i/2),f.push({x:s,y:c,text:a+"",anchor:"down"===o?"middle":l,baseline:"middle",fontSize:11})}}var y;return{sceneNodes:d,sceneEdges:h,labels:f}}};import{forceSimulation as De,forceCenter as Ie,forceX as Ne,forceY as Pe,forceLink as _e,forceManyBody as Re,forceCollide as We}from"d3-force";import{scaleLinear as $e}from"d3-scale";function Oe(e){let t=1/0,n=-1/0;for(const r of e)t>r&&(t=r),r>n&&(n=r);return[t,n]}var Be=()=>"undefined"!=typeof performance?performance.now():Date.now();function ze(e){let t=e>>>0;return()=>{t+=1831565813;let e=t;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}}function je(e,t){const n=e();return Number.isFinite(n)?n:t}var He=class{constructor(e={}){this.randomSource=Math.random,this.subscribers=new Set,this.now=()=>this.advance(),this.random=()=>this.randomSource(),this.clock=e.clock??Be,this.lastWallTime=je(this.clock,0),this.logicalTime=this.lastWallTime,this.pausedValue=!0===e.paused,this.visibleValue=!1!==e.visible,this.setRandomSource(e.random,e.seed)}get isActive(){return!this.pausedValue&&this.visibleValue}get paused(){return this.pausedValue}get seed(){return this.seedValue}get visible(){return this.visibleValue}configure(e){this.setClock(e.clock),this.setRandomSource(e.random,e.seed)}setPaused(e){this.pausedValue!==e&&(this.advance(),this.pausedValue=e,this.emit())}setVisible(e){this.visibleValue!==e&&(this.advance(),this.visibleValue=e,this.emit())}snapshot(){return{now:this.now(),paused:this.pausedValue,seed:this.seedValue,visible:this.visibleValue}}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}advance(){const e=je(this.clock,this.lastWallTime),t=Math.max(0,e-this.lastWallTime);return this.lastWallTime=e,this.isActive&&(this.logicalTime+=t),this.logicalTime}emit(){for(const e of this.subscribers)e()}setClock(e){const t=e??Be;t!==this.clock&&(this.advance(),this.clock=t,this.lastWallTime=je(t,this.lastWallTime))}setRandomSource(e,t){const n=function(e){return"number"==typeof e&&Number.isFinite(e)?Math.trunc(e):void 0}(t);e===this.randomInput&&n===this.seedValue||(this.randomInput=e,this.seedValue=n,this.randomSource=e??(void 0===n?Math.random:ze(n)))}},Fe={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,n,r){if(0===e.length)return;const o=n.forceStrength??.1,i=r[0]/2,a=r[1]/2,s=n.__previousPositions;let c=0;const l=[];for(const t of e){const e=null!=t.x&&null!=t.y&&(0!==t.x||0!==t.y),n=s?.get(t.id);e?c++:n?(t.x=n.x,t.y=n.y,c++):l.push(t)}const u=c>0&&.3>=(e.length>0?l.length/e.length:1);if(u){const n=new Map;for(const t of e)n.set(t.id,t);for(const e of l){const r=Ye(e.id,t,n);if(r.length>0){let t=0,n=0;for(const e of r)t+=e.x,n+=e.y;const o=Xe(e.id),i=o%360*(Math.PI/180),a=10+o%20;e.x=t/r.length+a*Math.cos(i),e.y=n/r.length+a*Math.sin(i)}else{const t=Xe(e.id),n=t%360*(Math.PI/180),r=15+t%30;e.x=i+r*Math.cos(n),e.y=a+r*Math.sin(n)}}}else{const t=2.399963229728653;for(let n=0;e.length>n;n++){const r=e[n];if(null==r.x||null==r.y||0===r.x&&0===r.y){const e=10*Math.sqrt(n+.5),o=n*t;r.x=i+e*Math.cos(o),r.y=a+e*Math.sin(o)}}}const d=n.__skipForceSimulation||0===n.iterations?0:u?40:n.iterations??Math.max(50,Math.min(300,Math.floor(300-2*(e.length-30)))),h=Ge(n.nodeSize,n.nodeSizeRange,e),f=e=>h(e);if(d>0){const r=new Map,s=new Map;for(const t of e)r.set(t.id,0),s.set(t.id,t);for(const e of t){const t="string"==typeof e.source?e.source:e.source.id,n="string"==typeof e.target?e.target:e.target.id;r.set(t,(r.get(t)??0)+1),r.set(n,(r.get(n)??0)+1)}const c=_e().strength(e=>{const t=e.weight,n="string"==typeof e.target?e.target:e.target.id,i=Math.max(1,Math.min(r.get("string"==typeof e.source?e.source:e.source.id)??1,r.get(n)??1));return Math.min(2.5,(t&&t>0?Math.sqrt(t):1)*o/(.1*i))}).distance(e=>{const t="string"==typeof e.source?s.get(e.source):e.source,n="string"==typeof e.target?s.get(e.target):e.target,r=(t?f(t):0)+(n?f(n):0)+12;return Math.max(40,r)}).id(e=>e.id),l=De();if(void 0===n.random&&void 0===n.seed||l.randomSource(n.random??ze(n.seed)),l.force("charge",Re().strength(e=>{const t=r.get(e.id)??0;return-15*f(e)*Math.sqrt(t+1)})).force("collide",We(e=>f(e)+3).strength(.9).iterations(2)).force("center",Ie(i,a).strength(.8)).force("x",Ne(i).strength(.06)).force("y",Pe(a).strength(.06)),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}));c.links(e),l.force("link",c)}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=f(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 g=new Map;for(const t of e)g.set(t.id,t);for(const e of t){if("string"==typeof e.source){const t=g.get(e.source);t&&(e.source=t)}if("string"==typeof e.target){const t=g.get(e.target);t&&(e.target=t)}}},buildScene(e,t,n,r){const o=n.nodeStyle,i=n.edgeStyle,a=Ge(n.nodeSize,n.nodeSizeRange,e),s=Array.isArray(n.colorScheme)?n.colorScheme:n.themeCategorical&&n.themeCategorical.length>0?n.themeCategorical:ue,c=new Map;e.forEach((e,t)=>{c.set(e.id,s[t%s.length])});const l=[],u=[],d=[];for(const t of e){if(null==t.x||null==t.y)continue;const e=a(Ce(t,"nodeSize")),r=o?o(Ce(t,"nodeStyle")):{},i={fill:r.fill||c.get(t.id)||n.themeSemantic?.primary||"#007bff",stroke:r.stroke||n.themeSemantic?.surface||"#fff",strokeWidth:r.strokeWidth??2,opacity:r.opacity};l.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 o=i?i(Ce(e,"edgeStyle")):{};u.push({type:"line",x1:t.x,y1:t.y,x2:r.x,y2:r.y,style:{stroke:o.stroke||n.themeSemantic?.border||n.themeSemantic?.secondary||"#999",strokeWidth:o.strokeWidth??1,opacity:o.opacity??.6},datum:e})}if(!1!==n.showLabels){const t=(f=n.nodeLabel)?"function"==typeof f?f:e=>e[f]||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 r=a(Ce(n,"nodeSize"));d.push({x:n.x,y:n.y-r-4,text:e+"",anchor:"middle",baseline:"auto",fontSize:11})}}var f;return{sceneNodes:l,sceneEdges:u,labels:d}}};function Ye(e,t,n){const r=[];for(const o of t){const t="string"==typeof o.source?o.source:o.source.id,i="string"==typeof o.target?o.target:o.target.id;let a=null;if(t===e?a=i:i===e&&(a=t),a){const e=n.get(a);!e||0===e.x&&0===e.y||r.push({x:e.x,y:e.y})}}return r}function Xe(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 Ge(e,t,n){if(n.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],o=[];for(const t of n){const n=t.data?.[e];"number"==typeof n&&o.push(n)}if(0===o.length)return()=>r[0];const[i,a]=Oe(o);if(i===a)return()=>(r[0]+r[1])/2;const s=$e().domain([i,a]).range(r).clamp(!0);return t=>{const n=t.data?.[e];return null==n||"number"!=typeof n?r[0]:s(n)}}import{chord as Ve,ribbon as qe}from"d3-chord";import{arc as Ue}from"d3-shape";var Ke=ue,Qe={supportsStreaming:!1,hierarchical:!1,computeLayout(e,t,n,r){if(0===e.length)return;const{padAngle:o=.01,groupWidth:i=20,sortGroups:a}=n,s=Math.min(r[0],r[1])/2,c=s-i,l=r[0]/2,u=r[1]/2,d=(h=n.valueAccessor)?"function"==typeof h?h:e=>e[h]??1:e=>e.value??1;var h;const f=new Map;for(let t=0;e.length>t;t++)f.set(e[t].id,t);const g=e.length,p=Array.from({length:g},()=>Array.from({length:g},()=>0));for(const e of t){const t="string"==typeof e.target?e.target:e.target.id,n=f.get("string"==typeof e.source?e.source:e.source.id),r=f.get(t);if(void 0===n||void 0===r)continue;const o=d(e);p[n][r]=o}const y=Ve().padAngle(o);a&&y.sortGroups(a);const m=y(p),v=m.groups,b=Ue().innerRadius(c).outerRadius(s);for(const t of v){const n=e[t.index],r=b.centroid({innerRadius:c,outerRadius:s,startAngle:t.startAngle,endAngle:t.endAngle});n.x=r[0]+l,n.y=r[1]+u,n.__arcData={startAngle:t.startAngle,endAngle:t.endAngle}}const x=new Map;for(const t of e)x.set(t.id,t);for(const e of t){const t="string"==typeof e.target?e.target:e.target.id,n=x.get("string"==typeof e.source?e.source:e.source.id),r=x.get(t);n&&(e.source=n),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 m){const n=e[t.source.index].id,r=e[t.target.index].id,o=k.get(`${n}\0${r}`)||k.get(`${r}\0${n}`);o&&(o.__chordData=t)}},buildScene(e,t,n,r){const{groupWidth:o=20,edgeOpacity:i=.5}=n,a=Math.min(r[0],r[1])/2,s=a-o,c=r[0]/2,l=r[1]/2,u=n.nodeStyle,d=n.edgeStyle,h=n.edgeColorBy||"source",f=Array.isArray(n.colorScheme)?n.colorScheme:n.themeCategorical&&n.themeCategorical.length>0?n.themeCategorical:Ke,g=new Map;e.forEach((e,t)=>{g.set(e.id,f[t%f.length])});const p=qe().radius(s),y=[],m=[],v=[];for(let t=0;e.length>t;t++){const n=e[t],r=n.__arcData;if(!r)continue;let o;o=u?u(Ce(n,"nodeStyle")).fill||g.get(n.id)||f[t%f.length]:g.get(n.id)||f[t%f.length];const i=u?u(Ce(n,"nodeStyle")):{};y.push({type:"arc",cx:c,cy:l,innerR:s,outerR:a,startAngle:r.startAngle-Math.PI/2,endAngle:r.endAngle-Math.PI/2,style:{fill:o,stroke:i.stroke||"black",strokeWidth:i.strokeWidth??1,opacity:i.opacity},datum:n,id:n.id,label:n.id})}for(const e of t){const t=e.__chordData;if(!t)continue;const r=p(t);if(!r)continue;const o=Ze(r,c,l);let a=n.themeSemantic?.border||n.themeSemantic?.secondary||"#999";if(d)a=d(Ce(e,"edgeStyle")).fill||a;else{const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;"target"===h&&n?a=g.get(n.id)||a:t&&(a=g.get(t.id)||a)}const s=d?d(Ce(e,"edgeStyle")):{};m.push({type:"ribbon",pathD:o,style:{fill:a,fillOpacity:s.fillOpacity??i,stroke:s.stroke||"none",strokeWidth:s.strokeWidth,opacity:s.opacity},datum:e})}if(!1!==n.showLabels){const t=(b=n.nodeLabel)?"function"==typeof b?b:e=>e[b]||e.id:null,r=a+12;for(const n of e){const e=n.__arcData;if(!e)continue;const o=t?t(n):n.id;if(!o)continue;const i=(e.startAngle+e.endAngle)/2,a=i-Math.PI/2;v.push({x:c+Math.cos(a)*r,y:l+Math.sin(a)*r,text:o+"",anchor:i>Math.PI?"end":"start",baseline:"middle",fontSize:11})}}var b;return{sceneNodes:y,sceneEdges:m,labels:v}}};function Ze(e,t,n){const r=e.match(/[a-zA-Z]|[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?/g);if(!r)return e;const o=[];let i=0;for(;r.length>i;){const e=r[i];if("M"===e||"L"===e)for(o.push(e),i++;r.length>i&&!isNaN(Number(r[i]));)o.push(Number(r[i])+t+""),i++,r.length>i&&!isNaN(Number(r[i]))&&(o.push(Number(r[i])+n+""),i++);else if("C"===e)for(o.push(e),i++;r.length>i&&!isNaN(Number(r[i]));)for(let e=0;3>e&&r.length>i&&!isNaN(Number(r[i]));e++)o.push(Number(r[i])+t+""),i++,r.length>i&&!isNaN(Number(r[i]))&&(o.push(Number(r[i])+n+""),i++);else if("Q"===e)for(o.push(e),i++;r.length>i&&!isNaN(Number(r[i]));)for(let e=0;2>e&&r.length>i&&!isNaN(Number(r[i]));e++)o.push(Number(r[i])+t+""),i++,r.length>i&&!isNaN(Number(r[i]))&&(o.push(Number(r[i])+n+""),i++);else if("A"===e)for(o.push(e),i++;r.length>i&&!isNaN(Number(r[i]));)o.push(r[i++]),r.length>i&&o.push(r[i++]),r.length>i&&o.push(r[i++]),r.length>i&&o.push(r[i++]),r.length>i&&o.push(r[i++]),r.length>i&&(o.push(Number(r[i])+t+""),i++),r.length>i&&(o.push(Number(r[i])+n+""),i++);else"Z"===e||"z"===e?(o.push(e),i++):(o.push(r[i]),i++)}return o.join(" ")}import{hierarchy as Je,tree as et,cluster as tt,treemap as nt,pack as rt,partition as ot,treemapBinary as it}from"d3-hierarchy";var at=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];function st(e){const[t,n,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*n+.114*r>150?"#222":"#fff"}function ct(e,t,n){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-"+n}function lt(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 ut(e){return Array.isArray(e.colorScheme)?e.colorScheme:e.themeCategorical&&e.themeCategorical.length>0?e.themeCategorical:at}function dt(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 ht(e,t,n,r,o){if("horizontal"===o){const o=(e+n)/2;return`M ${e},${t} C ${o},${t} ${o},${r} ${n},${r}`}if("radial"===o){const o=(e+n)/2;return`M ${e},${t} Q ${o},${t} ${o},${(t+r)/2} T ${n},${r}`}{const o=(t+r)/2;return`M ${e},${t} C ${e},${o} ${n},${o} ${n},${r}`}}var ft={supportsStreaming:!1,hierarchical:!0,computeLayout(e,t,n,r){const o=n.__hierarchyRoot;if(!o)return;const i=n.chartType,a=function(e){if(e)return"function"==typeof e?e:t=>t[e]}(n.childrenAccessor),s=n.hierarchySum,c="function"==typeof s?s:"string"==typeof s?e=>Number(e[s])||0:e=>Number(e.value)||0,l=Je(o,a);l.sum(c),l.sort((e,t)=>(t.value??0)-(e.value??0));const[u,d]=r;switch(i){case"tree":!function(e,t,n,r){const o=t.treeOrientation||"vertical",i=et();i.size("horizontal"===o?[r,n]:"radial"===o?[2*Math.PI,Math.min(n,r)/2*.8]:[n,r]),i(e)}(l,n,u,d);break;case"cluster":!function(e,t,n,r){const o=t.treeOrientation||"vertical",i=tt();i.size("horizontal"===o?[r,n]:"radial"===o?[2*Math.PI,Math.min(n,r)/2*.8]:[n,r]),i(e)}(l,n,u,d);break;case"treemap":!function(e,t,n,r){const o=t.padding??4,i=t.paddingTop??0,a=nt().size([n,r]).tile(it).padding(o);i>0&&a.paddingTop(i),a(e)}(l,n,u,d);break;case"circlepack":!function(e,t,n,r){const o=t.padding??4;rt().size([n,r]).padding(o)(e)}(l,n,u,d);break;case"partition":!function(e,t,n,r){ot().size([n,r]).padding(t.padding??1)(e)}(l,n,u,d)}const h=l.descendants();e.length=0,t.length=0;const f=new Map;for(let t=0;h.length>t;t++){const r=h[t],o={id:ct(r,n,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?gt(o,r,n):"treemap"===i||"partition"===i?pt(o,r):"circlepack"===i&&yt(o,r),o.__hierarchyNode=r,e.push(o),f.set(r,o)}if("tree"===i||"cluster"===i)for(const e of h)if(e.parent){const n=f.get(e.parent),r=f.get(e);n&&r&&t.push({source:n,target:r,value:1,y0:0,y1:0,sankeyWidth:0,data:{depth:e.depth}})}},buildScene(e,t,n,r){const o=n.nodeStyle||(()=>({})),i=n.edgeStyle||(()=>({}));switch(n.chartType){case"tree":case"cluster":return function(e,t,n,r,o,i){const a=[],s=[],c=[],l=n.treeOrientation||"vertical",u="radial"===l,d=r[0]/2,h=r[1]/2,f="number"==typeof(g=n.nodeSize)?g:5;var g;for(const t of e){let e=t.x,r=t.y;u&&(e+=d,r+=h);const i=o(Ce(t,"nodeStyle"));let s=i.fill||dt(n);if(n.colorByDepth&&void 0!==t.depth){const e=ut(n);s=e[t.depth%e.length]}a.push({type:"circle",cx:e,cy:r,r:f,style:{fill:s,stroke:i.stroke||n.themeSemantic?.surface||"#fff",strokeWidth:i.strokeWidth??1,opacity:i.opacity},datum:t,id:t.id,label:t.id,depth:t.depth})}const p=n.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 o=t.x,a=t.y,c=r.x,f=r.y;u&&(o+=d,a+=h,c+=d,f+=h);const g=ht(o,a,c,f,l),y=i(Ce(e,"edgeStyle"));s.push({type:"curved",pathD:g,style:{fill:"none",stroke:y.stroke||n.themeSemantic?.border||n.themeSemantic?.secondary||"#999",strokeWidth:y.strokeWidth??1.5,opacity:y.opacity??p},datum:e})}if(!1!==n.showLabels){const t=lt(n.nodeLabel);for(const n of e){const e=t?t(n):n.id;if(!e)continue;let r,o,i,a=n.x,s=n.y;if(u&&(a+=d,s+=h),u){const e=a-d,t=s-h,n=Math.sqrt(e*e+t*t);n>0?(r=a+e/n*10,o=s+t/n*10,i=0>e?"end":"start"):(r=a,o=s-12,i="middle")}else"horizontal"===l?(n.data?.children&&0!==n.data.children.length?(r=a-f-6,i="end"):(r=a+f+6,i="start"),o=s):(r=a,o=s+f+14,i="middle");c.push({x:r,y:o,text:e+"",anchor:i,baseline:"middle",fontSize:11})}}return{sceneNodes:a,sceneEdges:s,labels:c}}(e,t,n,r,o,i);case"treemap":case"partition":return function(e,t,n,r){const o=[],i=[];for(const n of e){const e=n.x1-n.x0,i=n.y1-n.y0;if(0>=e||0>=i)continue;const a=r(Ce(n,"nodeStyle"));let s=a.fill||dt(t);if(t.colorByDepth&&void 0!==n.depth){const e=ut(t);s=e[n.depth%e.length]}o.push({type:"rect",x:n.x0,y:n.y0,w:e,h:i,style:{fill:s,stroke:a.stroke||t.themeSemantic?.surface||"#fff",strokeWidth:a.strokeWidth??1,opacity:a.opacity},datum:n,id:n.id,label:n.id,depth:n.depth})}if(!1!==t.showLabels){const n=lt(t.nodeLabel),o=t.labelMode||"leaf",a="partition"===t.chartType;for(const s of e){const e=s.x1-s.x0,c=s.y1-s.y0;if(0>=e||0>=c)continue;const l=!(s.data?.children&&s.data.children.length>0);if(!a){if("leaf"===o&&!l)continue;if("parent"===o&&l)continue}const u=n?n(s):s.id;if(!u)continue;if((l?30:40)>e||(l?16:14)>c)continue;let d=r(Ce(s,"nodeStyle")).fill||dt(t);if(t.colorByDepth&&void 0!==s.depth){const e=ut(t);d=e[s.depth%e.length]}const h="string"==typeof d?st(d):t.themeSemantic?.text??"#000";i.push(l?{x:s.x0+e/2,y:s.y0+c/2,text:u+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,Math.min(e,c)/6)),fill:h}:{x:s.x0+4,y:s.y0+12,text:u+"",anchor:"start",baseline:"auto",fontSize:11,fontWeight:600,fill:h})}}return{sceneNodes:o,sceneEdges:[],labels:i}}(e,n,0,o);case"circlepack":return function(e,t,n,r){const o=[],i=[];for(const n of e){const e=n.__radius??5;if(0>=e)continue;const i=r(Ce(n,"nodeStyle"));let a=i.fill||dt(t);if(t.colorByDepth&&void 0!==n.depth){const e=ut(t);a=e[n.depth%e.length]}o.push({type:"circle",cx:n.x,cy:n.y,r:e,style:{fill:a,stroke:i.stroke||t.themeSemantic?.surface||"#fff",strokeWidth:i.strokeWidth??1,opacity:i.opacity??.7},datum:n,id:n.id,label:n.id,depth:n.depth})}if(!1!==t.showLabels){const n=lt(t.nodeLabel);for(const o of e){const e=o.__radius??5,a=n?n(o):o.id;if(!a)continue;if(15>e)continue;const s=!(o.data?.children&&o.data.children.length>0);let c=r(Ce(o,"nodeStyle")).fill||dt(t);if(t.colorByDepth&&void 0!==o.depth){const e=ut(t);c=e[o.depth%e.length]}if(s){const n="string"==typeof c?st(c):t.themeSemantic?.text??"#000";i.push({x:o.x,y:o.y,text:a+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,e/3)),fill:n})}else i.push({x:o.x,y:o.y-e+14,text:a+"",anchor:"middle",baseline:"hanging",fontSize:Math.min(11,Math.max(8,e/3)),fill:t.themeSemantic?.text||"#000",stroke:t.themeSemantic?.surface||"#fff",strokeWidth:3,paintOrder:"stroke"})}}return{sceneNodes:o,sceneEdges:[],labels:i}}(e,n,0,o);default:return{sceneNodes:[],sceneEdges:[],labels:[]}}}};function gt(e,t,n){const r=n.treeOrientation||"vertical";if("radial"===r){const n=t.x,r=t.y;e.x=r*Math.cos(n-Math.PI/2),e.y=r*Math.sin(n-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 pt(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 yt(e,t){const n=t.r??0;e.x=t.x,e.y=t.y,e.x0=t.x-n,e.x1=t.x+n,e.y0=t.y-n,e.y1=t.y+n,e.width=2*n,e.height=2*n,e.__radius=n}import{pie as mt}from"d3-shape";function vt(e){let t=e.__orbitState;return t||(t={metaMap:new Map,startTime:"undefined"!=typeof performance?performance.now():Date.now()},e.__orbitState=t),t}var bt={sankey:Ee,force:Fe,chord:Qe,tree:ft,cluster:ft,treemap:ft,circlepack:ft,partition:ft,orbit:{supportsStreaming:!1,hierarchical:!0,supportsAnimation:!0,computeLayout(e,t,n,r){const o=n.__hierarchyRoot;o&&function(e,t,n,r,o){const i=function(e){if("function"==typeof e)return e;const t=e||"children";return e=>e[t]||null}(n.childrenAccessor),a=function(e){if("function"==typeof e)return e;const t=e||"name";return e=>(e[t]??"")+""}(n.nodeIDAccessor),s=function(e){if(Array.isArray(e))return e;switch(e){case"solar":return[1];case"atomic":return[2,8];default:return[9999]}}(n.orbitMode),c=n.orbitSize??2.95,l=n.orbitEccentricity??1,u="number"==typeof c?()=>c:c,d="number"==typeof l?()=>l:l,h=vt(n);h.metaMap.clear(),r.length=0,o.length=0;const f=new Map;function g(e){const t=f.get(e)??0;return f.set(e,t+1),0===t?e:`${e}__${t}`}const p=t[0]/2,y=t[1]/2,m=Math.min(t[0],t[1])/2*.85,v=g(a(e));r.push({id:v,x:p,y:y,x0:p,x1:p,y0:y,y1:y,width:0,height:0,value:0,depth:0,data:e}),h.metaMap.set(v,{ring:m,angle:0,depth:0,parentId:null,eccentricity:1}),function e(t,n,c,l,f,p,y){const m=i(t);if(!m?.length)return;const v=m.length;let b=0,x=0,k=0;for(;v>x;)x+=s[Math.min(k,s.length-1)],k++,b++;let w=0;for(let v=0;b>v;v++){const x=s[Math.min(v,s.length-1)],k=m.slice(w,w+x);if(!k.length)break;const S=(v+1)/b,A={id:n,depth:p,data:t,parentId:n},M=y?f/u(A)*S:f*S,C=mt().value(e=>{const t=i(e)?.length;return t?4:1}).sort(null)(k),L=d(A);for(let t=0;k.length>t;t++){const i=(C[t].startAngle+C[t].endAngle)/2,s=k[t],u=g(a(s)),d=c+M*Math.sin(i),f=l+M*Math.cos(i)*L;r.push({id:u,x:d,y:f,x0:d,x1:d,y0:f,y1:f,width:0,height:0,value:0,depth:p,data:s}),h.metaMap.set(u,{ring:M,angle:i,depth:p,parentId:n,eccentricity:L}),o.push({source:n,target:u,value:1,y0:0,y1:0,sankeyWidth:0,data:{source:n,target:u}}),e(s,u,d,f,M,p+1,!0)}w+=x}}(e,v,p,y,m,1,!1)}(o,r,n,e,t)},buildScene(e,t,n,r){const o=n.nodeStyle,i=n.nodeSize,a="number"==typeof i?()=>i:"function"==typeof i?i:()=>6,s=[],c=[],l=[];if(!1!==n.orbitShowRings){const t=vt(n),r=new Map;for(const t of e)r.set(t.id,t);const o=new Map;for(const[,e]of t.metaMap){if(!e.parentId)continue;const t=r.get(e.parentId);if(!t)continue;const n=`${e.parentId}:${e.ring}`;o.has(n)||o.set(n,{parentX:t.x,parentY:t.y,ring:e.ring,ecc:e.eccentricity})}const i=48,a={stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1};for(const[,{parentX:e,parentY:t,ring:n,ecc:r}]of o)for(let o=0;i>o;o++){const s=o/i*Math.PI*2,l=(o+1)/i*Math.PI*2;c.push({type:"line",x1:e+n*Math.sin(s),y1:t+n*Math.cos(s)*r,x2:e+n*Math.sin(l),y2:t+n*Math.cos(l)*r,style:a,datum:null})}}for(const t of e){if(null==t.x||null==t.y)continue;const e=a(Ce(t,"nodeSize")),r=o?o(Ce(t,"nodeStyle")):{};s.push({type:"circle",cx:t.x,cy:t.y,r:e,style:{fill:r.fill||n.themeSemantic?.primary||"#6366f1",stroke:r.stroke||n.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),n="object"==typeof e.target?e.target:u.get(e.target);t&&n&&(null!=t.x&&null!=n.x&&c.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=a(Ce(n,"nodeSize"));if(4>=e)continue;const r="function"==typeof t?t(n):t?n.data?.[t]??n.id:n.id;l.push({x:n.x,y:n.y+e+12,text:r+"",anchor:"middle",fontSize:10,fill:"currentColor"})}}return{sceneNodes:s,sceneEdges:c,labels:l}},tick:(e,t,n,r,o)=>!1!==n.orbitAnimated&&(function(e,t){const n=vt(t),r=t.orbitSpeed??.25,o=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())-n.startTime)/1e3,a=r*(Math.PI/6),s=new Map;for(const t of e)s.set(t.id,t);for(const t of e){const e=n.metaMap.get(t.id);if(!e||!e.parentId)continue;const r=s.get(e.parentId);if(!r)continue;const c=e.angle+i*a*o({id:t.id,depth:e.depth,data:t.data,parentId:e.parentId});t.x=r.x+e.ring*Math.sin(c),t.y=r.y+e.ring*Math.cos(c)*e.eccentricity,t.x0=t.x,t.x1=t.x,t.y0=t.y,t.y1=t.y}}(e,n),!0)}};function xt(e){return bt[e]}function kt(e){return null!=e&&!1!==e&&""!==e&&(!Array.isArray(e)||e.some(kt))}function wt(e,t,n){e.has(t)||(e.add(t),console.warn(n))}function St(e,t,n){return e+(t-e)*n}import{quadtree as At}from"d3-quadtree";function Mt(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 Ct(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(!Lt(e))return!1;return!0}return Lt(t.points)}function Lt(e){if(!Array.isArray(e)||4!==e.length)return!1;for(const t of e){if(!t||"object"!=typeof t)return!1;const e=t;if("number"!=typeof e.x||!Number.isFinite(e.x))return!1;if("number"!=typeof e.y||!Number.isFinite(e.y))return!1}return!0}import{interpolateNumber as Tt}from"d3-interpolate";function Et(e,t,n){if(1>=n)return 1;const r=n-1;return function(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 n=Math.max(0,e.age);if("step"===e.type)return(e.threshold??.5*e.extent)>n?1:t;if("exponential"===e.type){const r=e.halfLife??e.extent/2;return t+Math.pow(.5,n/(r>0?r:e.extent/2))*(1-t)}return t+Math.max(0,Math.min(1,1-n/e.extent))*(1-t)}({age:r-t,extent:r,type:e.type,halfLife:e.halfLife??n/2,threshold:e.stepThreshold??.5*n,minOpacity:e.minOpacity??.1})}var Dt="rgba(34, 197, 94, 0.7)",It=2e3,Nt={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 Pt(e,t){const n={...e};for(const e of t)n[Nt[e]]++;return n}function _t(e,t,n){const r=new Set(t);return{changeSet:{...e,...e.keys?{keys:[...e.keys]}:{}},changed:r,revisions:Pt(n,r)}}var Rt=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=_t({kind:"initialize"},[],this.revisions),this.listeners=new Set}get last(){return this.latest}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}record(e,t){const n=_t(e,t,this.revisions);this.revisions=n.revisions,this.latest=n;for(const e of[...this.listeners])e();return n}},Wt=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],$t=["scene-style","data-paint","accessibility","evidence"],Ot=(e,t)=>({retainedData:e,invalidations:t}),Bt=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],zt=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],jt=["scene-geometry","data-paint","overlay","accessibility","evidence"],Ht=["scene-style","data-paint","accessibility","evidence"],Ft=["scene-geometry","data-paint","overlay","accessibility","evidence"],Yt=[],Xt={chartType:Ot("rebuild",Bt),nodeIDAccessor:Ot("rebuild",Bt),sourceAccessor:Ot("rebuild",Bt),targetAccessor:Ot("rebuild",Bt),valueAccessor:Ot("rebuild",Bt),edgeIdAccessor:Ot("rebuild",Bt),childrenAccessor:Ot("rebuild",Bt),hierarchySum:Ot("rebuild",Bt),orientation:Ot("preserve",zt),nodeAlign:Ot("preserve",zt),nodePaddingRatio:Ot("preserve",zt),nodeWidth:Ot("preserve",zt),edgeSort:Ot("preserve",zt),iterations:Ot("preserve",zt),forceStrength:Ot("preserve",zt),padAngle:Ot("preserve",zt),groupWidth:Ot("preserve",zt),sortGroups:Ot("preserve",zt),treeOrientation:Ot("preserve",zt),edgeType:Ot("preserve",zt),padding:Ot("preserve",zt),paddingTop:Ot("preserve",zt),orbitMode:Ot("preserve",zt),orbitSize:Ot("preserve",zt),orbitSpeed:Ot("preserve",zt),orbitRevolution:Ot("preserve",zt),orbitRevolutionStyle:Ot("preserve",zt),orbitEccentricity:Ot("preserve",zt),orbitShowRings:Ot("preserve",zt),orbitAnimated:Ot("preserve",zt),customNetworkLayout:Ot("preserve",zt),layoutConfig:Ot("preserve",zt),nodeSize:Ot("preserve",jt),nodeSizeRange:Ot("preserve",jt),colorByDepth:Ot("preserve",jt),nodeLabel:Ot("preserve",Ft),showLabels:Ot("preserve",Ft),labelMode:Ot("preserve",Ft),nodeStyle:Ot("preserve",Ht),edgeStyle:Ot("preserve",Ht),colorBy:Ot("preserve",Ht),colorScheme:Ot("preserve",Ht),themeCategorical:Ot("preserve",Ht),themeSemantic:Ot("preserve",Ht),edgeColorBy:Ot("preserve",Ht),edgeOpacity:Ot("preserve",Ht),showParticles:Ot("preserve",Ht),particleStyle:Ot("preserve",Ht),decay:Ot("preserve",Ht),pulse:Ot("preserve",Ht),thresholds:Ot("preserve",Ht),staleness:Ot("preserve",Ht),layoutSelection:Ot("preserve",Ht),clock:Ot("preserve",Yt),random:Ot("preserve",Yt),seed:Ot("preserve",Yt),tensionConfig:Ot("preserve",Yt),transition:Ot("preserve",Yt),introAnimation:Ot("preserve",Yt),onLayoutError:Ot("preserve",Yt),__skipForceSimulation:Ot("preserve",Yt),__hierarchyRoot:Ot("preserve",Yt),__orbitState:Ot("preserve",Yt),__previousPositions:Ot("preserve",Yt)},Gt=Ot("preserve",zt),Vt=class{constructor(){this.tracker=new Rt}get last(){return this.tracker.last}subscribe(e){return this.tracker.subscribe(e)}recordData(e,t){return this.tracker.record({kind:e,...void 0===t?{}:{count:t}},Wt)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},$t):this.recordNoop("restyle")}recordConfig(e){const t=function(e){let t="preserve";const n=new Set;for(const r of e){const e=Xt[r]??Gt;"rebuild"===e.retainedData&&(t="rebuild");for(const t of e.invalidations)n.add(t)}return{retainedData:t,invalidations:n}}(e);return this.tracker.record({kind:"config",keys:e},t.invalidations)}},qt=new WeakMap;import{scaleOrdinal as Ut}from"d3-scale";var Kt={category10:ue,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],...me},Qt=ue,Zt=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],Jt=["#f0f0f0","#b5d4ea","#f4c2a1","#b8dab2","#d4b5e0","#f9e0a2","#a8d8d8"],en=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 tn(e,t,n){if("function"==typeof t){const r=t(e);return n&&r&&"string"==typeof r&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||en.has(t)}(r)?n(r):r}const r=e?.[t]+"";return n?n(r):Qt[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)}(r))%Qt.length]}function nn(e,t){if(null==t||!Object.prototype.hasOwnProperty.call(e,t))return;const n=e[t];return"string"==typeof n&&n.length>0?n:void 0}function rn(e,t,n="category10"){if(n&&"object"==typeof n&&!Array.isArray(n)){const e=n;return t=>nn(e,t)??"#999"}const r=Array.from(new Set(e.map(e=>e?.[t]).filter(e=>null!=e).map(e=>e+""))),o=r.every(e=>!isNaN(Number(e)));if(Array.isArray(n))return Ut().domain(r).range(n).unknown("#999");const i=Kt[n]||Kt.category10;if(o&&"function"==typeof i){let e=-1/0;for(const t of r){const n=Number(t);n>e&&(e=n)}return t=>i(Number(t)/e)}{const e=Array.isArray(i)?i:Qt;return Ut().domain(r).range(e).unknown("#999")}}function on(e,t){const n=t&&"object"==typeof t&&!Array.isArray(t)?t:void 0;return 0===e.length?e=>n&&nn(n,e)||"#4e79a7":t=>{if(n){const e=nn(n,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"}}function an({config:e,customLayout:t,size:n,nodes:r,edges:o,previousResult:i,revision:a}){const s=function(e,t,n){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=Kt[e];if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:n}(e.colorScheme,e.themeCategorical,ue),c={nodes:r,edges:o,dimensions:{width:n[0],height:n[1],plot:{x:0,y:0,width:n[0],height:n[1]}},theme:{semantic:e.themeSemantic??{},categorical:[...s]},resolveColor:on(s,e.colorScheme),config:e.layoutConfig??{},selection:e.layoutSelection??null};try{return{kind:"success",result:t(c)}}catch(t){const n=null!==i,r=function(e,t,n,r){const o=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: ${o.message}`,error:o,recovery:n?"preserved-last-good-scene":"empty-scene",preservedLastGoodScene:n,affectedRevision:r}}("network",t,n,a);"production"!==process.env.NODE_ENV&&console.error("[semiotic] customNetworkLayout threw:",t);try{e.onLayoutError?.(r)}catch(e){"production"!==process.env.NODE_ENV&&console.error("[semiotic] onLayoutError threw:",e)}return{kind:"failure",diagnostic:r,preservedLastGoodScene:n}}}var sn=class e{constructor(e){this.nodes=new Map,this.edges=new Map,this.tension=0,this.layoutVersion=0,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this.customLayoutHtmlMarks=[],this._customLayoutDiagnosticsWarned=new Set,this._customRestyle=void 0,this._customRestyleEdge=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this._nodeQuadtree=null,this._maxNodeRadius=0,this._sceneNodesRevision=0,this._nodeQuadtreeRevision=-1,this._nodesArrCache=null,this._edgesArrCache=null,this._arrCacheVersion=-1,this.particlePool=null,this.updateResults=new Vt,this.transition=null,this._hasRenderedOnce=!1,this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,this.lastIngestTime=0,this.nodeTimestamps=new Map,this.edgeTimestamps=new Map,this._decaySortedNodes=null,this._decayAgeMap=null,this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set,this.lastTopologyChangeTime=0,this.previousNodeIds=new Set,this.previousEdgeKeys=new Set,this._networkDecayCache=null,this._lastPositionSnapshot=null,this.config=e,this.tensionConfig={...u,...e.tensionConfig},e.showParticles&&("sankey"===e.chartType||e.customNetworkLayout)&&(this.particlePool=new h(2e3))}currentTime(){return this.config.clock?.()??("undefined"!=typeof performance?performance.now():Date.now())}updateConfig(e){const t=this.config,n={...t,...e};t.__orbitState&&(n.__orbitState=t.__orbitState),t.__hierarchyRoot&&(n.__hierarchyRoot=t.__hierarchyRoot),void 0===e.layoutSelection&&null!=t.layoutSelection&&(n.layoutSelection=t.layoutSelection);const r=[...new Set([...Object.keys(t),...Object.keys(n)])].filter(e=>t[e]!==n[e]);this.config=n,this.tensionConfig={...u,...n.tensionConfig},!n.showParticles||"sankey"!==n.chartType&&!n.customNetworkLayout||this.particlePool||(this.particlePool=new h(2e3)),this.updateResults.recordConfig(r)}updateConfigWithResult(e){return this.updateConfig(e),this.updateResults.last}ingestHierarchy(e,t){this._boundedPrevSnapshot=new Map;for(const[e,t]of this.nodes)0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1||this._boundedPrevSnapshot.set(e,{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this._networkDecayCache=null,this.config.__hierarchyRoot=e,this.runLayout(t),this._boundedPrevSnapshot=null,this.updateResults.recordData("replace",1)}ingestBounded(e,t,n,r){const{nodeIDAccessor:o="id",sourceAccessor:i="source",targetAccessor:a="target",valueAccessor:s="value"}=this.config,c="function"==typeof o?o:e=>e[o],l="function"==typeof i?i:e=>e[i],u="function"==typeof a?a:e=>e[a],d="function"==typeof s?s:e=>e[s]??1;this._boundedPrevSnapshot=new Map;for(const[e,t]of this.nodes)0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1||this._boundedPrevSnapshot.set(e,{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});this._boundedEdgeSnapshot=new Map;for(const[,e]of this.edges)e.sankeyWidth>0&&this._boundedEdgeSnapshot.set(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,{y0:e.y0,y1:e.y1,sankeyWidth:e.sankeyWidth});this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this._networkDecayCache=null;for(const t of e){const e=c(t)+"";this.nodes.set(e,{...Mt(e),data:t})}for(let e=0;t.length>e;e++){const n=t[e],r=l(n)+"",o=u(n)+"",i=d(n),a=null==i?NaN:Number(i),s=Number.isFinite(a)?a:1;this.nodes.has(r)||this.nodes.set(r,{...Mt(r),data:n}),this.nodes.has(o)||this.nodes.set(o,{...Mt(o),data:n});const c=`${r}\0${o}\0${e}`,h={source:r,target:o,value:s,y0:0,y1:0,sankeyWidth:0,data:n,_edgeKey:c};n&&"object"==typeof n&&Ct(n.bezier)&&(h.bezier=n.bezier),this.edges.set(c,h)}r?.deferLayout||this.runLayout(n),this.updateResults.recordData("replace",e.length+t.length)}ingestBoundedWithResult(e,t,n,r){return this.ingestBounded(e,t,n,r),this.updateResults.last}applyForceLayoutPositions(e,t){for(const[t,n]of Object.entries(e)){const e=this.nodes.get(t);e&&(e.x=n.x,e.y=n.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:n,value:r}=e,o=0===this.nodes.size;let i=!1;const a=this.currentTime();this.lastIngestTime=a,this._decaySortedNodes=null,this._networkDecayCache=null,this.nodes.has(t)||(this.nodes.set(t,Mt(t)),this.nodeTimestamps.set(t,a),this.tension+=this.tensionConfig.newNode,i=!0),this.nodes.has(n)||(this.nodes.set(n,Mt(n)),this.nodeTimestamps.set(n,a),this.tension+=this.tensionConfig.newNode,i=!0);const s=this.edgeKey(t,n),c=this.edges.get(s);let l=!1;c?(c.value+=r,this.edgeTimestamps.set(s,a),this.tension+=this.tensionConfig.weightChange,l=!0):(this.edges.set(s,{source:t,target:n,value:r,y0:0,y1:0,sankeyWidth:0}),this.edgeTimestamps.set(s,a),this.tension+=this.tensionConfig.newEdge,i=!0);const u=o||i||l||this.tension>=this.tensionConfig.threshold;return this.updateResults.recordData("ingest",1),u}ingestEdgeWithResult(e){return this.ingestEdge(e),this.updateResults.last}runLayout(e){if(this.config.customNetworkLayout)return this.recordTopologyDiff(),void this.layoutVersion++;const t=xt(this.config.chartType);if(!t)return;let n=Array.from(this.nodes.values());const r=Array.from(this.edges.values());if(0===n.length&&!t.hierarchical)return;if(this.prepareForRelayout(),t.supportsStreaming&&!t.hierarchical){const e=new Map;for(const t of n)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,n]of this._lastPositionSnapshot)e.has(t)||e.set(t,n);this.config.__previousPositions=e.size>0?e:void 0}if(t.computeLayout(n,r,this.config,e),this.config.__previousPositions=void 0,t.hierarchical&&n.length>0){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this._networkDecayCache=null;for(const e of n)this.nodes.set(e.id,e);for(let e=0;r.length>e;e++){const t=r[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,n=Array.from(this.nodes.values())}this.finalizeLayout();const o=new Map;for(const e of this.nodes.values())0===e.x&&0===e.y||o.set(e.id,{x:e.x,y:e.y});this._lastPositionSnapshot=o,this.saveTargetPositions();const i=n.some(e=>void 0!==e._prevX0&&(0!==e._prevX0||0!==e._prevX1||0!==e._prevY0||0!==e._prevY1)),a=this.config.transition?.duration??this.tensionConfig.transitionDuration,s=["sankey","tree","treemap","circlepack","partition"].includes(this.config.chartType);if(!this._hasRenderedOnce&&this.config.introAnimation&&s&&n.length>0&&a>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:this.currentTime(),duration:a}}else i&&a>0&&(this.restorePreviousPositions(),this.transition={startTime:this.currentTime(),duration:a});this._hasRenderedOnce=!0,this.recordTopologyDiff(),this.layoutVersion++}recordTopologyDiff(){const e=new Set(this.nodes.keys()),t=new Set(this.edges.keys());this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set;for(const t of e)this.previousNodeIds.has(t)||this.addedNodes.add(t);for(const t of this.previousNodeIds)e.has(t)||this.removedNodes.add(t);for(const e of t)this.previousEdgeKeys.has(e)||this.addedEdges.add(e);for(const e of this.previousEdgeKeys)t.has(e)||this.removedEdges.add(e);(this.addedNodes.size>0||this.removedNodes.size>0||this.addedEdges.size>0||this.removedEdges.size>0)&&(this.lastTopologyChangeTime=this.currentTime()),this.previousNodeIds=e,this.previousEdgeKeys=t}restyleScene(e){const t=function({nodes:e,edges:t,restyle:n,restyleEdge:r,baseStyles:o,selection:i}){const a=!(!n&&!r);if(n)for(const t of e){const e=o.get(t)??t.style,r=n(t,i);t.style=r?{...e,...r}:e}if(r)for(const e of t){const t=o.get(e)??e.style,n=r(e,i);e.style=n?{...t,...n}:t}return a}({nodes:this.sceneNodes,edges:this.sceneEdges,restyle:this._customRestyle,restyleEdge:this._customRestyleEdge,baseStyles:this._baseStyles,selection:e});this.markStylePaintPending(),this.updateResults.recordRestyle(t)}buildScene(e){if(this.config.customNetworkLayout){const t=an({config:this.config,customLayout:this.config.customNetworkLayout,size:e,nodes:Array.from(this.nodes.values()),edges:Array.from(this.edges.values()),previousResult:this.lastCustomLayoutResult,revision:this.layoutVersion});if("failure"===t.kind)return this.lastCustomLayoutFailure=t.diagnostic,void(t.preservedLastGoodScene||(this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.customLayoutOverlays=null,this.customLayoutHtmlMarks=[],this.lastCustomLayoutResult=null,this._customRestyle=void 0,this._customRestyleEdge=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this._sceneNodesRevision++));const n=t.result;return this.sceneNodes=n.sceneNodes??[],this.sceneEdges=n.sceneEdges??[],this.labels=n.labels??[],this.customLayoutOverlays=n.overlays??null,this.customLayoutHtmlMarks=n.htmlMarks??[],this.lastCustomLayoutResult=n,this.lastCustomLayoutFailure=null,this._sceneNodesRevision++,this._customRestyle=n.restyle,this._customRestyleEdge=n.restyleEdge,this.hasCustomRestyle=!(!n.restyle&&!n.restyleEdge),this.hasCustomRestyle&&(this._baseStyles=function(e,t){const n=new WeakMap;for(const t of e)n.set(t,t.style);for(const e of t)n.set(e,e.style);return n}(this.sceneNodes,this.sceneEdges),this.restyleScene(this.config.layoutSelection??null)),void function(e){if("production"===process.env.NODE_ENV)return;const{label:t,nodes:n,overlays:r,warned:o}=e;kt(r)&&0===n.length&&wt(o,"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)&&wt(o,"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.`)}({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=xt(this.config.chartType);if(!t)return void this._sceneNodesRevision++;const n=t.hierarchical?Array.from(this.nodes.values()):this.nodesArray,r=t.hierarchical?Array.from(this.edges.values()):this.edgesArray,{sceneNodes:o,sceneEdges:i,labels:a}=t.buildScene(n,r,this.config,e);this.sceneNodes=o,this.sceneEdges=i,this.labels=a,this._sceneNodesRevision++}rebuildNodeQuadtree(){let t=0,n=0;for(const e of this.sceneNodes)"circle"===e.type&&(t++,e.r>n&&(n=e.r));if(this._maxNodeRadius=n,e.QUADTREE_THRESHOLD>=t)return void(this._nodeQuadtree=null);const r=Array(t);let o=0;for(const e of this.sceneNodes)"circle"===e.type&&(r[o++]=e);this._nodeQuadtree=At().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=xt(this.config.chartType);return!!e?.supportsAnimation&&!1!==this.config.orbitAnimated}tickAnimation(e,t){const n=xt(this.config.chartType);if(!n?.tick)return!1;const r=n.hierarchical?Array.from(this.nodes.values()):this.nodesArray,o=n.hierarchical?Array.from(this.edges.values()):this.edgesArray;return n.tick(r,o,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=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,this.transition),n=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(t);for(const e of this.nodes.values())void 0===e._targetX0||void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=St(e._prevX0,e._targetX0,n),e.x1=St(e._prevX1,e._targetX1,n),e.y0=St(e._prevY0,e._targetY0,n),e.y1=St(e._prevY1,e._targetY1,n));for(const e of this.edges.values())void 0!==e._targetY0&&void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&(e._prevSankeyWidth>0||e._introFromZero)&&(e.y0=St(e._prevY0,e._targetY0,n),e.y1=St(e._prevY1,e._targetY1,n),e.sankeyWidth=St(e._prevSankeyWidth,e._targetSankeyWidth,n));return this.rebuildAllBeziers(),1>t||(this.snapToTargets(),this.transition=null,!1)}prepareForRelayout(){const e=this._boundedPrevSnapshot;for(const t of this.nodes.values()){const n=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){!function(e,t,n=.5){const r="string"==typeof e.source?t.get(e.source):e.source,o="string"==typeof e.target?t.get(e.target):e.target;!r||!o||(e.bezier=e.circular&&e.circularPathData?function(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))),r=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-r,y:n.targetY},{x:n.targetX-.66*r,y:n.targetY},{x:n.targetX-.33*r,y:n.targetY},{x:n.targetX,y:n.targetY}]],halfWidth:t}}let r;r="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 o=[];for(let e=0;r.length-1>e;e++){const t=r[e],n=r[e+1],i=n.x-t.x,a=n.y-t.y;o.push([t,{x:t.x+i/3,y:t.y+a/3},{x:t.x+2*i/3,y:t.y+2*a/3},n])}return{circular:!0,segments:o,halfWidth:t}}(e):function(e,t,n,r=.5){const o=(e.sankeyWidth||1)/2;if("down"===e.direction){const i=t.x1,a=n.x0,s=Tt(i,a);return{circular:!1,points:[{x:e.y0,y:i},{x:e.y0,y:s(r)},{x:e.y1,y:s(1-r)},{x:e.y1,y:a}],halfWidth:o}}const i=t.x1,a=n.x0,s=Tt(i,a);return{circular:!1,points:[{x:i,y:e.y0},{x:s(r),y:e.y0},{x:s(1-r),y:e.y1},{x:a,y:e.y1}],halfWidth:o}}(e,r,o,n))}(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 n=t.duration??500,r=t.color??"rgba(255,255,255,0.6)",o=t.glowRadius??4,{now:i}=e;for(const t of e.sceneNodes){const a=t.id;if(!a)continue;const s=e.nodeTimestamps.get(a);if(!s)continue;const c=i-s;n>c&&(t._pulseIntensity=1-c/n,t._pulseColor=r,t._pulseGlowRadius=o)}for(const t of e.sceneEdges){const o=t.datum;if(!o)continue;const a="object"==typeof o.source?o.source?.id:o.source,s="object"==typeof o.target?o.target?.id:o.target;if(!a||!s)continue;const c=e.edgeTimestamps.get(`${a}\0${s}`);if(!c)continue;const l=i-c;n>l&&(t._pulseIntensity=1-l/n,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 n=e.nodeTimestamps.size;if(1>=n)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 n=0;e.cache.sortedNodes.length>n;n++)t.set(e.cache.sortedNodes[n][0],n);e.cache.ageMap=t}const r=e.cache.ageMap;for(const o of e.sceneNodes){const e=o.id;if(!e)continue;const i=r.get(e);if(void 0===i)continue;const a=Et(t,i,n);o.style={...o.style,opacity:(o.style?.opacity??1)*a}}}({sceneNodes:this.sceneNodes,nodeTimestamps:this.nodeTimestamps,decay:this.config.decay,cache:this._networkDecayCache}),this._decaySortedNodes=this._networkDecayCache.sortedNodes,this._decayAgeMap=this._networkDecayCache.ageMap}applyTopologyDiff(e){!function(e){for(const t of e.sceneNodes)t._pulseColor===Dt&&(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>=It)return;const n=1-t/It;for(const t of e.sceneNodes){const r=t.id;r&&e.addedNodes.has(r)&&(t._pulseIntensity=Math.max(t._pulseIntensity??0,n),t._pulseColor=Dt,t._pulseGlowRadius=8)}}({sceneNodes:this.sceneNodes,addedNodes:this.addedNodes,lastTopologyChangeTime:this.lastTopologyChangeTime,now:e})}get hasActiveTopologyDiff(){return function(e,t,n=("undefined"!=typeof performance?performance.now():Date.now())){return 0!==e.size&&It>n-t}(this.addedNodes,this.lastTopologyChangeTime)}applyThresholds(e){!function(e){const t=e.thresholds;if(!t)return;const n=t.warningColor??"#f59e0b",r=t.criticalColor??"#ef4444",o=!1!==t.pulse;for(const i of e.sceneNodes){const a=i.id;if(!a)continue;const s=e.nodes.get(a);if(!s)continue;const c=t.metric(s);let l=null;void 0===t.critical||t.critical>c?void 0===t.warning||t.warning>c||(l=n):l=r,l&&(i.style={...i.style,fill:l},o&&(i._pulseIntensity=.6+.4*Math.sin(e.now/300),i._pulseColor=l,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 n of e){const e=t.metric(n);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 n=e.now??("undefined"!=typeof performance?performance.now():Date.now());return(t.duration??500)>n-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 n=this.nodes.get(e);if(!n)return this.updateResults.recordNoop("update"),null;const r=n.data?{...n.data}:{};return n.data=t(n.data??{}),this.layoutVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("update",1),r}updateEdge(e,t,n){const r=this.config.valueAccessor,o="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=n(r.data??{});const e=o(r.data);null!=e&&(r.value=Number(e))}return i.length>0?(this.layoutVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("update",i.length)):this.updateResults.recordNoop("update"),i}removeNode(e){if(!this.nodes.has(e))return this.updateResults.recordNoop("remove"),!1;this.nodes.delete(e),this.nodeTimestamps.delete(e);for(const[t,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=this.currentTime(),this.updateResults.recordData("remove",1),!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 r="function"==typeof t?t:e=>e?.[t];for(const[t,o]of this.edges)o.data&&r(o.data)===e&&n.push(t)}else for(const[r,o]of this.edges)("string"==typeof o.source?o.source:o.source.id)===e&&("string"==typeof o.target?o.target:o.target.id)===t&&n.push(r);for(const e of n)this.edges.delete(e),this.edgeTimestamps.delete(e);return n.length>0?(this.layoutVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("remove",n.length)):this.updateResults.recordNoop("remove"),n.length>0}clear(){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this._networkDecayCache=null,this._decayAgeMap=null,this._nodeQuadtree=null,this._nodesArrCache=null,this._edgesArrCache=null,this._sceneNodesRevision++,this.tension=0,this.layoutVersion++,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.customLayoutOverlays=null,this.customLayoutHtmlMarks=[],this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this._customRestyleEdge=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.transition=null,this._hasRenderedOnce=!1,this.lastIngestTime=0,this._lastPositionSnapshot=null,this.nodeTimestamps.clear(),this.edgeTimestamps.clear(),this.previousNodeIds=new Set,this.previousEdgeKeys=new Set,this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set,this.lastTopologyChangeTime=0,this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,this.particlePool&&this.particlePool.clear(),this.updateResults.recordData("clear")}};sn.QUADTREE_THRESHOLD=500;var cn=sn;Object.assign(cn.prototype,{getLastUpdateResult:function(){return this.updateResults.last},getUpdateSnapshot:function(){return this.updateResults.last},subscribeUpdateResult:function(e){return this.updateResults.subscribe(e)},setLayoutSelection:function(e){this.config.layoutSelection=e},markStylePaintPending:function(){qt.set(this,!0)},consumeStylePaintPending:function(){const e=!0===qt.get(this);return qt.delete(this),e}});import{memo as ln,useEffect as un,useRef as dn}from"react";var hn={sceneGeometry:0,layout:0,domain:0};function fn(e){const{domain:t,layout:n,sceneGeometry:r}=e.revisions;return{domain:t,layout:n,sceneGeometry:r}}function gn(e,t){return{sceneGeometry:Math.max(e.sceneGeometry,t.sceneGeometry),layout:Math.max(e.layout,t.layout),domain:Math.max(e.domain,t.domain)}}var pn="production"!==process.env.NODE_ENV,yn={revisions:hn,signature:"",sawSignals:!1,wasUnconsumed:!1,warnUnconsumed:!1},mn=class{constructor(e="scene host"){this.hostName=e,this.lastConsumed=hn,this.lastObserved=hn,this.lastDuplicateWarning="",this.lastUnconsumedWarning=""}observeUpdateResult(e){pn&&(this.lastObserved=gn(this.lastObserved,fn(e)))}beforeCompute(e,t){if(!pn)return yn;const n=gn(fn(e),this.lastObserved),r=function(e){return`${e.sceneGeometry}|${e.layout}|${e.domain}`}(n),o=!((i=n).sceneGeometry===(a=this.lastConsumed).sceneGeometry&&i.layout===a.layout&&i.domain===a.domain);var i,a;return{revisions:n,signature:r,sawSignals:e.changed.has("scene-geometry")||e.changed.has("layout")||e.changed.has("domain"),wasUnconsumed:o,warnUnconsumed:!t&&o&&this.lastUnconsumedWarning!==r}}afterCompute(e,t,n){if(pn){if(t&&e.wasUnconsumed&&(this.lastConsumed=e.revisions),e.warnUnconsumed&&!t)return console.warn(`[semiotic] ${this.hostName} observed scene-affecting revisions without a scene rebuild: ${e.signature}.`),void(this.lastUnconsumedWarning=e.signature);t&&e.sawSignals&&!e.wasUnconsumed&&!n&&this.lastDuplicateWarning!==e.signature?(console.warn(`[semiotic] ${this.hostName} performed scene rebuild with unchanged scene revisions: ${e.signature}.`),this.lastDuplicateWarning=e.signature):t&&!e.sawSignals&&(this.lastDuplicateWarning="")}}},vn=ln(function({store:e,diagnostics:t}){return un(()=>{const n=()=>t.observeUpdateResult(e.getUpdateSnapshot());return n(),e.subscribeUpdateResult(n)},[t,e]),null});import*as bn from"react";function xn(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:bn.createElement(bn.Fragment,null,...t)}import*as kn from"react";import{jsx as wn}from"react/jsx-runtime";var Sn={isActive:!1,predicate:()=>!0},An=kn.createContext(null);function Mn({value:e,children:t}){return wn(An.Provider,{value:e,children:t})}function Cn(){return kn.useContext(An)??Sn}function Ln(e,t){return null!=e?wn(Mn,{value:t,children:e}):e}import{useEffect as Tn,useRef as En}from"react";var Dn=[40,40],In=[.5,.5];function Nn(e,t){const[n,r]=e.viewBox??Dn,[o,i]=e.anchor??In,a=r>0?r:1,s=Math.max(0,t)/a,c=(n>0?n:a)*s,l=a*s;return{width:c,height:l,scale:s,offsetX:-o*c,offsetY:-i*l}}function Pn(e,t){const n=Nn(e,t),r=[[n.offsetX,n.offsetY],[n.offsetX+n.width,n.offsetY],[n.offsetX,n.offsetY+n.height],[n.offsetX+n.width,n.offsetY+n.height]];let o=0;for(const[e,t]of r){const n=Math.sqrt(e*e+t*t);n>o&&(o=n)}return o}function _n(e,t,n,r){if("none"!==e)return"color"===e||null==e?t??r:"accent"===e?n:e}var Rn=null;function Wn(e){if("undefined"==typeof Path2D)return null;Rn||(Rn=new Map);const t=Rn.get(e);if(t)return t;const n=new Path2D(e);return Rn.size>1024&&Rn.clear(),Rn.set(e,n),n}function $n(e,t,n=0,r="horizontal"){const[o,i]=e.viewBox??Dn,a=Math.min(1,Math.max(0,n)),s=Math.min(1,Math.max(0,t));return s>a?a>0||1>s?"vertical"===r?{x:0,y:i*(1-s),width:o,height:i*(s-a)}:{x:o*a,y:0,width:o*(s-a),height:i}:null:{x:0,y:0,width:0,height:0}}function On(e,t){const n=Nn(e,t);return{centerDx:n.offsetX+n.width/2,centerDy:n.offsetY+n.height/2,halfWidth:n.width/2,halfHeight:n.height/2,radius:Math.hypot(n.width,n.height)/2}}function Bn(e,t,n,r,o,i=e=>e){for(const a of t.parts){const t=Wn(a.d);if(!t)continue;const s=a.opacity??1,c=e.globalAlpha;1!==s&&(e.globalAlpha=c*s);const l=o?"none"===a.fill?void 0:o:_n(a.fill,n,r);l&&(e.fillStyle=i(l),e.fill(t));const u=o?a.stroke&&"none"!==a.stroke?o:void 0:_n(a.stroke??"none",n,r);u&&(e.strokeStyle=i(u),e.lineWidth=a.strokeWidth??1,e.lineCap=a.strokeLinecap??"butt",e.lineJoin=a.strokeLinejoin??"miter",e.stroke(t)),1!==s&&(e.globalAlpha=c)}}function zn(e,t,n){const{group:r,indexInGroup:o}=t,i=n.byGroup.get(r);switch(e){case"ArrowRight":return i.length-1>o?i[o+1]._flatIndex:t.flatIndex;case"ArrowLeft":return o>0?i[o-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=n.groups.indexOf(r);return n.groups.length-1>e?jn(n,n.groups[e+1],i[o]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(r);return e>0?jn(n,n.groups[e-1],i[o]):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 jn(e,t,n){const r=e.byGroup.get(t);let o=0,i=Math.abs(r[0].x-n.x);for(let e=1;r.length>e;e++){const t=Math.abs(r[e].x-n.x);i>t&&(i=t,o=e)}return r[o]._flatIndex}function Hn(e){return"object"==typeof e&&null!==e&&"id"in e?e.id:e}import{jsx as Fn}from"react/jsx-runtime";var Yn="var(--semiotic-focus, #005fcc)";function Xn({active:e,hoverPoint:t,margin:n,size:r,shape:o="circle",width:i,height:a,pathData:s}){if(!e||!t)return null;const c=t.x+n.left,l=t.y+n.top;let u;if("geoarea"!==o&&"path"!==o||!s)if("rect"===o&&null!=i&&null!=a){const e=Math.max(i,4),t=Math.max(a,4);u=Fn("rect",{x:c-e/2-3,y:l-t/2-3,width:e+6,height:t+6,rx:3,fill:"none",stroke:Yn,strokeWidth:2,strokeDasharray:"4,2"})}else u=Fn("circle","wedge"===o?{cx:c,cy:l,r:12,fill:"none",stroke:Yn,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:c,cy:l,r:8,fill:"none",stroke:Yn,strokeWidth:2,strokeDasharray:"4,2"});else u=Fn("g",{transform:`translate(${n.left},${n.top})`,children:Fn("path",{d:s,fill:"none",stroke:Yn,strokeWidth:2.5,strokeDasharray:"6,3"})});return Fn("svg",{style:{position:"absolute",left:0,top:0,width:r[0],height:r[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}import*as Gn from"react";var Vn=["name","label","title"],qn=["type","kind","category","group","class","status","role","shape"],Un=["value","amount","total","count","weight","score"],Kn=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 Qn(e,t){for(const n of t){const t=e.find(e=>e.lower===n);if(t)return t}}import{jsx as Zn,jsxs as Jn}from"react/jsx-runtime";var er={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 tr(e,t){return"function"==typeof t?t(e):e[t]}function nr(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 rr(e={}){const{fields:t,title:n,format:r,style:o={},className:i=""}=e;return e=>{if(!e||"object"!=typeof e)return null;let a;const s=[];if(n){const t=tr(e,n);a=nr(t,r)}if(t&&t.length>0)t.forEach(t=>{let n,o,i;"string"==typeof t?(n=t,o=t,i=r):(n=t.label,o=t.accessor||t.key||"",i=t.format||r);const a=tr(e,o);s.push({label:n,value:nr(a,i)})});else if(!n){const t=["value","y","name","id","label"];for(const n of t)if(void 0!==e[n]){a=nr(e[n],r);break}if(!a){const t=Object.keys(e).filter(e=>!e.startsWith("_"));t.length>0&&(a=nr(e[t[0]],r))}}const c={...er,...o};return Jn("div",{className:("semiotic-tooltip "+i).trim(),style:c,children:[a&&Zn("div",{style:{fontWeight:s.length>0?"bold":"normal"},children:a}),s.map((e,t)=>Jn("div",{style:{marginTop:0===t&&a?"4px":0},children:[e.label&&Jn("span",{children:[e.label,": "]}),e.value]},t))]})}}function or(e){if(!0!==e){if("function"==typeof e){const t=e;return e=>{let n=c(!0===e?.__semioticHoverData||e&&void 0!==e.data&&"number"==typeof e.x&&"number"==typeof e.y&&e&&("node"===e.type||"edge"===e.type||void 0!==e.nodeOrEdge||void 0!==e.allSeries||void 0!==e.stats||void 0!==e.__chartType)?e.data??{}:e);if(!n)return null;if(("node"===e?.nodeOrEdge&&"number"==typeof n?.x0&&"number"==typeof n?.x1||"edge"===e?.nodeOrEdge&&"number"==typeof n?.sankeyWidth)&&n.data&&"object"==typeof n.data&&(n=n.data),!n)return null;const r=t(n);return null==r?null:Zn("div",{className:"semiotic-tooltip",style:er,children:r})}}return!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?rr(e):rr())}}import{jsx as ir}from"react/jsx-runtime";function ar({x:e,y:t,containerWidth:n,containerHeight:r,margin:o,children:i,className:a="stream-frame-tooltip",zIndex:s=1}){const c=Number.isFinite(e)&&Number.isFinite(t),l=Gn.useRef(null),[u,d]=Gn.useState(null);Gn.useLayoutEffect(()=>{const e=l.current;if(!e)return;const t=()=>{const t=e.getBoundingClientRect();Number.isFinite(t.width)&&Number.isFinite(t.height)&&d(e=>e&&.5>Math.abs(e.width-t.width)&&.5>Math.abs(e.height-t.height)?e:{width:t.width,height:t.height})};if(t(),"undefined"==typeof ResizeObserver)return;const n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[a,n,r,c]);let h;h=u?`translate(${u.width+12>n-e?"calc(-100% - 12px)":"12px"}, ${u.height+12>r-t?"calc(-100% - 4px)":"4px"})`:`translate(${e>.7*n?"calc(-100% - 12px)":"12px"}, ${.3*r>t?"4px":"calc(-100% - 4px)"})`;const f=function(e){if(!Gn.isValidElement(e))return!1;const t=e.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;const n=e.props;if(!0===n["data-semiotic-tooltip-chrome"])return!0;if("true"===n["data-semiotic-tooltip-chrome"])return!0;const r=n.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),g=f?null:er;return c?ir("div",{ref:l,className:f?a:(a+" semiotic-tooltip").trim(),style:{...g||{},position:"absolute",left:o.left+e,top:o.top+t,transform:h,pointerEvents:"none",zIndex:s,width:"max-content"},children:i}):null}import*as sr from"react";import{useCallback as cr,useEffect as lr,useLayoutEffect as ur,useMemo as dr,useRef as hr}from"react";import{createContext as fr,useCallback as gr,useContext as pr,useMemo as yr,useRef as mr,useSyncExternalStore as vr}from"react";import{jsx as br}from"react/jsx-runtime";function xr(e){let t=null;const n=()=>(t||(t=fr(null)),t),r=kr(e);return[function({children:t,initialState:r}){const o=mr(r),i=yr(()=>kr(e,o.current),[]),a=n();return br(a.Provider,{value:i,children:t})},(e,t)=>{const o=n(),i=pr(o)??r,a=mr(e);a.current=e;const s=mr({hasValue:!1,value:void 0}),c=gr(()=>{const e=a.current(i.getState()),n=s.current;return n.hasValue&&t&&t(n.value,e)?n.value:(s.current={hasValue:!0,value:e},e)},[i,t]),l=gr(()=>a.current(i.getState()),[i]);return vr(i.subscribe,c,l)}]}function kr(e,t){const n=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 n)e()}}),...t??{}};return{getState:()=>r,subscribe:function(e){return n.add(e),()=>{n.delete(e)}}}}function wr(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 Sr(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t={...t,colors:{...t.colors,categorical:Ar}}),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 Ar=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],Mr={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}},Cr={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}},Lr={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:Ar,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 Tr(e,t){if("light"===t)return Mr;if("dark"===t)return Cr;if("high-contrast"===t)return Lr;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?Cr:Mr;return Sr({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}return Sr({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}var[Er,Dr]=xr(e=>({theme:Mr,setTheme(t){e(e=>({theme:Tr(e.theme,t)}))}}));import{useState as Ir,useEffect as Nr}from"react";import{useRef as Pr,useState as _r,useEffect as Rr}from"react";var Wr=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,$r=new WeakMap,Or=0,Br=!1,zr=null,jr=null;function Hr(e,t){if(!t)return t;const n=Wr.exec(t);if(!n)return t;const r=e.canvas;if(!r)return n[2]?.trim()||t;!function(){if(Br)return;if("undefined"==typeof window||"undefined"==typeof document)return;Br=!0;const e=()=>{Or++};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{zr=window.matchMedia("(prefers-color-scheme: dark)"),jr=e,"function"==typeof zr.addEventListener?zr.addEventListener("change",jr):"function"==typeof zr.addListener&&zr.addListener(jr)}catch{}}();let o=$r.get(r);o&&o.version===Or||(o={version:Or,map:new Map},$r.set(r,o));const i=o.map.get(t);if(void 0!==i)return i;const a=getComputedStyle(r).getPropertyValue(n[1]).trim()||n[2]?.trim()||t;return o.map.set(t,a),a}var Fr="undefined"==typeof window?lr:ur,Yr={requestAnimationFrame:e=>("undefined"==typeof window?globalThis:window).requestAnimationFrame(e),cancelAnimationFrame:e=>("undefined"==typeof window?globalThis:window).cancelAnimationFrame(e)};function Xr(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function Gr(e){const t=function(){const[e,t]=Ir(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return Nr(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),function(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)}(e,e=>t(e.matches))},[]),e}(),n=hr(t);n.current=t;const[r,o]=function(e,t,n){const r=Pr(null),[o,i]=_r(null);return Rr(()=>{if(!t&&!n)return;const e=r.current;if(!e)return;const o=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;i(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return o.observe(e),()=>o.disconnect()},[t,n]),[r,[t&&o?o.w:e[0],n&&o?o.h:e[1]]]}(e.sizeProp,e.responsiveWidth,e.responsiveHeight),i=!!e.title,a=!!e.legend&&"top"===e.legendPosition,s=dr(()=>function(e,t,n=!1){const r=n?t?58:34:t?36:0;return r>e.top?{...e,top:r}:e}({...e.marginDefault,...e.userMargin},i,a),[e.marginDefault,e.userMargin,i,a]),c=o[0]-s.left-s.right,l=o[1]-s.top-s.bottom,u=Xr(e.foregroundGraphics,o,s),d=Xr(e.backgroundGraphics,o,s),h=Dr(e=>e.theme),{transition:f,introEnabled:g}=function(e,t){if(!1===e)return{transition:void 0,introEnabled:!1};const n="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:!(n||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),p="semiotic-table-"+sr.useId(),y=hr(null);if(!y.current){const t=!e.suspendWhenHidden||"undefined"==typeof document||!document.hidden;y.current=new He({clock:e.clock,random:e.random,seed:e.seed,paused:e.paused,visible:t})}const m=y.current;m.configure({clock:e.clock,random:e.random,seed:e.seed});const v=hr(null),b=hr(e.frameScheduler??Yr);b.current=e.frameScheduler??Yr;const x=hr(null),k=hr(!1),w=hr(()=>{}),S=cr(()=>{if(null!==v.current||k.current)return;const e=b.current;let t=!1,n=!1;const r=e.requestAnimationFrame(()=>{t=!0;const e=!n;e&&(k.current=!0),v.current=null,x.current=null;try{w.current()}finally{e&&(k.current=!1)}});n=!0,t||(v.current=r,x.current=e)},[]),A=cr(()=>{null!==v.current&&((x.current??b.current).cancelAnimationFrame(v.current),v.current=null,x.current=null)},[]);Fr(()=>{m.setPaused(!0===e.paused)},[m,e.paused]),lr(()=>{if(!e.suspendWhenHidden||"undefined"==typeof document)return void m.setVisible(!0);const t=()=>m.setVisible(!document.hidden);return t(),document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},[m,e.suspendWhenHidden]),lr(()=>()=>{A()},[A]);const M=hr(()=>{}),C=hr(()=>{}),L=hr(null),T=hr(null),E=hr(null),D=cr(()=>{const e=L.current;L.current=null,e&&M.current(e)},[]),I=cr(e=>{if(L.current={clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType},null===T.current){const e=b.current;let t=!1;const n=e.requestAnimationFrame(()=>{t=!0,T.current=null,E.current=null,D()});t||(T.current=n,E.current=e)}},[D]),N=cr(()=>{L.current=null,null!==T.current&&((E.current??b.current).cancelAnimationFrame(T.current),T.current=null,E.current=null),C.current()},[]);lr(()=>()=>{L.current=null,null!==T.current&&((E.current??b.current).cancelAnimationFrame(T.current),T.current=null,E.current=null)},[]);const P=e.themeDirtyRef;return Fr(()=>{P&&(Or++,P.current=!0,S())},[h,S,P]),{reducedMotion:t,reducedMotionRef:n,responsiveRef:r,size:o,margin:s,adjustedWidth:c,adjustedHeight:l,resolvedForeground:u,resolvedBackground:d,currentTheme:h,transition:f,introEnabled:g,tableId:p,frameRuntime:m,rafRef:v,renderFnRef:w,scheduleRender:S,cancelRender:A,hoverHandlerRef:M,hoverLeaveRef:C,onPointerMove:I,onPointerLeave:N}}import{useEffect as Vr,useRef as qr}from"react";var Ur={fresh:1,aging:.7,stale:.45,expired:.25},Kr={alpha:1,band:"fresh",isStale:!1};import{jsx as Qr}from"react/jsx-runtime";function Zr({isStale:e,position:t}){return Qr("div",{className:"stream-staleness-badge",style:{position:"absolute",..."top-left"===t?{top:4,left:4}:"bottom-left"===t?{bottom:4,left:4}:"bottom-right"===t?{bottom:4,right:4}:{top:4,right:4},padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",zIndex:3,background:e?"#dc3545":"#28a745",color:"white"},children:e?"STALE":"LIVE"})}import*as Jr from"react";import*as eo from"react";import{jsx as to,jsxs as no}from"react/jsx-runtime";var ro={fill:(e,t)=>to("rect",{style:e,width:t,height:t}),line:(e,t)=>to("line",{style:e,x1:0,y1:0,x2:t,y2:t})};function oo(e,t,n,r,o){let i;return i="function"==typeof n?n(e):(0,ro[n])(r(e,t),o),i}function io({swatchSize:e}){return to("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 ao(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}var so=(e,t,n,r,o,i,a,s,c,l,u)=>{const{type:d="fill",styleFn:h,items:f}=e,g=[];let p=0;const y=!(!t&&!n),m="isolate"===l||void 0===l&&null!=o,{swatchSize:v,labelGap:b,rowHeight:x}=u;return f.forEach((e,l)=>{const u=oo(e,l,d,h,v),k=ao(e,r,o),w=o&&o.size>0&&o.has(e.label);g.push(no("g",{transform:`translate(0,${p})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:y?s===i&&l===a?0:-1:void 0,role:y?"option":void 0,"aria-selected":y&&m?w||!1:void 0,"aria-current":y&&!m&&null!=r&&e.label===r||void 0,"aria-label":e.label,onKeyDown:y?n=>{if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowDown"===n.key||"ArrowUp"===n.key){n.preventDefault();const e=(l+("ArrowDown"===n.key?1:-1)+f.length)%f.length;c(s,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:y?t=>{c(s,l),n&&n(e);const r=t.currentTarget.querySelector(".semiotic-legend-focus-ring");r&&r.setAttribute("visibility","visible")}:void 0,onBlur:y?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:y?"pointer":"default",opacity:k,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[y&&to("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:v+b+2+7*e.label.length,height:v+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),u,w&&to(io,{swatchSize:v}),to("text",{y:v/2,x:v+b,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+l)),p+=x}),g};function co({config:e,orientation:t="vertical",width:n=100}){const{colorFn:r,domain:o,label:i,format:a}=e,s=a||(e=>Math.round(100*e)/100+""),c="grad-legend-"+eo.useId();if("horizontal"===t){const e=12,t=Math.min(n,200),a=Math.max(0,(n-t)/2),l=[];for(let e=0;64>=e;e++){const t=e/64;l.push(to("stop",{offset:100*t+"%",stopColor:r(o[0]+t*(o[1]-o[0]))},e))}return no("g",{"aria-label":i||"Gradient legend",children:[to("defs",{children:to("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:l})}),i&&to("text",{x:a+t/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),to("rect",{x:a,y:0,width:t,height:e,fill:`url(#${c})`,rx:2}),to("text",{x:a,y:e+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:s(o[0])}),to("text",{x:a+t,y:e+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:s(o[1])})]})}const l=[];for(let e=0;64>=e;e++){const t=e/64;l.push(to("stop",{offset:100*t+"%",stopColor:r(o[1]-t*(o[1]-o[0]))},e))}return no("g",{"aria-label":i||"Gradient legend",children:[i&&to("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),to("defs",{children:to("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:l})}),to("rect",{x:0,y:0,width:14,height:100,fill:`url(#${c})`,rx:2}),to("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:s(o[1])}),to("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:s(o[0])})]})}function lo(e){const{legendGroups:t,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:o,isolatedCategories:i,legendInteraction:a,title:s="Legend",width:c=100,height:l=20,orientation:u="vertical",legendLayout:d}=e,h=function(e){const t=Math.max(1,e?.swatchSize??16),n=Math.max(t,e?.rowHeight??22);return{swatchSize:t,labelGap:Math.max(0,e?.labelGap??6),itemGap:Math.max(0,e?.itemGap??10),rowHeight:n,align:"left"===e?.align?"start":"right"===e?.align?"end":e?.align??"start",maxWidth:e?.maxWidth}}(d),[f,g]=eo.useState(0),[p,y]=eo.useState(0),m=eo.useCallback((e,t)=>{g(e),y(t)},[]),v="vertical"===u?(({legendGroups:e,width:t,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:o,isolatedCategories:i,focusedGroupIndex:a,focusedItemIndex:s,onFocusedIndexChange:c,legendInteraction:l,metrics:u})=>{let d=24;const h=[];return e.forEach((e,f)=>{d+=5,h.push(to("line",{stroke:"gray",x1:0,y1:d,x2:t,y2:d},"legend-top-line legend-symbol-"+f)),d+=8,e.label&&(d+=16,h.push(to("text",{y:d,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label},"legend-text-"+f)),d+=8),h.push(to("g",{className:"legend-item",transform:`translate(0,${d})`,children:so(e,n,r,o,i,a,s,f,c,l,u)},"legend-group-"+f)),d+=e.items.length*u.rowHeight+8}),h})({legendGroups:t||[],width:c,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:o,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:p,onFocusedIndexChange:m,legendInteraction:a,metrics:h}):(({legendGroups:e,height:t,width:n,customClickBehavior:r,customHoverBehavior:o,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:s,focusedItemIndex:c,onFocusedIndexChange:l,legendInteraction:u,metrics:d})=>{let h=0;const f=[];e.forEach((e,t)=>{let g=0;e.label&&(g+=16);const p=((e,t,n,r,o,i,a,s,c,l,u,d)=>{const{type:h="fill",styleFn:f,items:g}=e,p=[],{swatchSize:y,labelGap:m,itemGap:v,rowHeight:b,align:x}=u,k=!(!t&&!n),w="isolate"===l||void 0===l&&null!=o,S=g.map(e=>y+m+7*e.label.length),A=[];let M=0,C=0;S.forEach((e,t)=>{const n=0===C?e:C+v+e;d&&d>0&&C>0&&n>d?(A.push({start:M,end:t,width:C}),M=t,C=e):C=n}),g.length>0&&A.push({start:M,end:g.length,width:C}),A.forEach((e,l)=>{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=g[d],x=oo(e,d,h,f,y),A=ao(e,r,o),M=o&&o.size>0&&o.has(e.label);p.push(no("g",{transform:`translate(${u},${l*b})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:k?s===i&&d===a?0:-1:void 0,role:k?"option":void 0,"aria-selected":k&&w?M||!1:void 0,"aria-current":k&&!w&&null!=r&&e.label===r||void 0,"aria-label":e.label,onKeyDown:k?n=>{if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowRight"===n.key||"ArrowLeft"===n.key){n.preventDefault();const e=(d+("ArrowRight"===n.key?1:-1)+g.length)%g.length;c(s,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:k?t=>{c(s,d),n&&n(e);const r=t.currentTarget.querySelector(".semiotic-legend-focus-ring");r&&r.setAttribute("visibility","visible")}:void 0,onBlur:k?e=>{n&&n(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&&to("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:y+m+2+7*e.label.length,height:y+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),x,M&&to(io,{swatchSize:y}),to("text",{y:y/2,x:y+m,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+d)),u+=S[d]+v}});const L=Math.max(0,...A.map(e=>e.width)),T=A.length;return{items:p,offset:L,totalRows:T,totalHeight:T*b}})(e,r,o,i,a,s,c,t,l,u,d,d.maxWidth??n);g+=p.offset+5,f.push({label:e.label,...p,offset:g,totalRows:p.totalRows,totalHeight:p.totalHeight}),h+=g+12});const g=d.maxWidth??n;let p=h>g?0:"center"===d.align?Math.max(0,(g-h)/2):"end"===d.align?Math.max(0,g-h):0;const y=[];return f.forEach((n,r)=>{const o=e[r];o.label&&(y.push(to("text",{transform:`translate(${p},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:o.label},"legend-text-"+r)),p+=16),y.push(to("g",{className:"legend-item",transform:`translate(${p},0)`,children:n.items},"legend-group-"+r)),p+=n.offset+5,e[r+1]&&y.push(to("line",{stroke:"gray",x1:p,y1:-8,x2:p,y2:(n.totalHeight||t)+0+8},"legend-top-line legend-symbol-"+r)),p+=12}),to("g",{children:y})})({legendGroups:t||[],title:s,height:l,width:c,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:o,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:p,onFocusedIndexChange:m,legendInteraction:a,metrics:h}),b=!(!n&&!r);return no("g",{role:b?"listbox":void 0,"aria-multiselectable":!(!b||"isolate"!==a&&(void 0!==a||null==i))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==s&&""!==s&&"vertical"===u&&to("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:s}),v]})}function uo(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}import{jsx as ho}from"react/jsx-runtime";function fo(e){const{legend:t,totalWidth:n,totalHeight:r,margin:o,legendPosition:i="right",legendLayout:a,title:s,legendHoverBehavior:c,legendClickBehavior:l,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=e;if(!t)return null;const f="top"===i||"bottom"===i,g=!!s,p=Math.max(0,n-o.left-o.right),y=Math.max(1,f?a?.maxWidth??p:100);let m,v;return"left"===i?(m=Math.max(4,o.left-y-10),v=o.top):"top"===i?(m=o.left,v=g?32:8):"bottom"===i?(m=o.left,v=r-o.bottom+38):(m=n-o.right+10,v=o.top),ho("g",{transform:`translate(${m}, ${v})`,children:(b=t,"object"==typeof b&&null!==b&&"gradient"in b?ho(co,{config:t.gradient,orientation:f?"horizontal":"vertical",width:y}):uo(t)?ho(lo,{legendGroups:t.legendGroups,title:"",width:y,orientation:f?"horizontal":"vertical",legendLayout:a,customHoverBehavior:c,customClickBehavior:l,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):t)});var b}import{jsx as go}from"react/jsx-runtime";var po={secondary:0,primary:3},yo=".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 mo(e){return!0===e?._annotationDeferred}function vo(e){return"blended"===e?.cohesion||"layer"===e?.cohesion?e.cohesion:null}function bo(e){const t=e?.provenance?.confidence;return"number"==typeof t&&Number.isFinite(t)?Math.max(0,Math.min(1,t)):null}function xo(e){return Math.max(.72,.95-.06*e)}import*as ko from"react";import{jsx as wo,jsxs as So}from"react/jsx-runtime";function Ao(e,t=120,n=8){if(!e)return[];const r=Math.max(1,Math.floor(t/n)),o=e.split(/\s+/),i=[];let a="";for(const e of o)a&&a.length+1+e.length>r?(i.push(a),a=e):a=a?`${a} ${e}`:e;return a&&i.push(a),i}function Mo(e,t,n,r){return"curly"===e?r?`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`:r?`M0,0 L${n},0 L${n},${t} L0,${t}`:`M0,0 L0,${n} L${t},${n} L${t},0`}function Co(e,t,n,r){if(!e)return wo("g",{className:"annotation-note"});const{label:o,title:i,orientation:a,align:s,wrap:c=120,noWrap:l}=e;if(!o&&!i)return wo("g",{className:"annotation-note"});let u=a;u||(u=Math.abs(t)>Math.abs(n)?"leftRight":"topBottom");let d=s;d&&"dynamic"!==d||(d="topBottom"===u?0>t?"right":"left":0>n?"bottom":"top");let h="start";"topBottom"===u?"right"===d?h="end":"middle"===d&&(h="middle"):h=0>t?"end":"start";const f=16,g=i?l?[i]:Ao(i,c):[],p=o?l?[o]:Ao(o,c):[],y="leftRight"===u?"end"===h?-4:4:0;let m=0;const v=[],b=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";e.useHTML||e.html?v.push(wo("foreignObject",{className:"annotation-note-html",x:"end"===h?y-c:"middle"===h?y-c/2:y,y:-16,width:c,height:Math.max(f,(g.length+p.length)*f+(i&&o?2:0))+f,style:{overflow:"visible"},children:So("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{color:b,fontSize:"12px",lineHeight:"16px",overflow:"visible",textAlign:"end"===h?"right":"middle"===h?"center":"left",whiteSpace:l?"nowrap":"normal",wordBreak:"break-word"},children:[i&&wo("div",{className:"annotation-note-title",style:{fontWeight:"bold"},children:i}),o&&wo("div",{className:"annotation-note-label",children:o})]})},"annotation-note-html")):(g.length>0&&(v.push(wo("text",{className:"annotation-note-title",fill:b,textAnchor:h,fontWeight:"bold",children:g.map((e,t)=>wo("tspan",{x:y,dy:0===t?0:f,children:e},t))},"annotation-note-title")),m=g.length*f),p.length>0&&v.push(wo("text",{className:"annotation-note-label",fill:b,textAnchor:h,y:m,children:p.map((e,t)=>wo("tspan",{x:y,dy:0===t?0:f,children:e},t))},"annotation-note-label")));let x=null;if((i||o)&&(0!==t||0!==n))if("topBottom"===u){const e=Math.min(c,120);let t=0,n=e;"end"===h?(t=-e,n=0):"middle"===h&&(t=-e/2,n=e/2),x=wo("line",{className:"note-line",x1:t,x2:n,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const e=(g.length+p.length)*f+(p.length>0?f:0);let t=0,n=e;"bottom"===d?(t=-e,n=0):"middle"===d&&(t=-e/2,n=e/2),x=wo("line",{className:"note-line",x1:0,x2:0,y1:t,y2:n,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const k=Math.max(0,g.length+p.length-1)*f;let w=0;return"topBottom"===u?w=0>n?-(k+2):18:"leftRight"===u&&(w="middle"===d?-(k+f+(p.length>0&&g.length>0?2:0))/2+8:"bottom"===d||0>n?-(k+2):18),So("g",{className:"annotation-note",transform:`translate(${t},${n})`,children:[wo("g",{className:"annotation-note-content",transform:0!==w?`translate(0,${w})`:void 0,children:v}),x]})}function Lo(e,t,n,r,o){const i=[];switch(e){case"callout-circle":{const e=(t?.radius||0)+(t?.radiusPadding||0);e>0&&i.push(wo("circle",{r:e,fill:"none",stroke:n||"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(wo("rect",{width:e,height:r,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":t?.custom&&i.push(...Array.isArray(t.custom)?t.custom:[t.custom]);break;case"xy-threshold":{const e=r||0,a=o||0;if(void 0!==t?.x){const r=(t.x||0)-e;i.push(wo("line",{x1:r,y1:(t.y1||0)-a,x2:r,y2:(t.y2||0)-a,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==t?.y){const r=(t.y||0)-a;i.push(wo("line",{x1:(t.x1||0)-e,y1:r,x2:(t.x2||0)-e,y2:r,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==t?.x1||void 0!==t?.x2?i.push(wo("line",{x1:(t.x1||0)-e,y1:0,x2:(t.x2||0)-e,y2:0,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===t?.y1&&void 0===t?.y2||i.push(wo("line",{x1:0,y1:(t.y1||0)-a,x2:0,y2:(t.y2||0)-a,stroke:n||"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(wo("path",{d:Mo(e,r,t?.depth||30,void 0===t?.width),fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return wo("g",{className:"annotation-subject",children:i})}function To(e,t,n,r,o,i){const a=[];let s=0,c=0;if("callout-circle"!==o&&"label"!==o||!i?.radius){if("callout-rect"===o&&i){const n=i.width||0,r=i.height||0;if(n>0||r>0){const o=n/2,i=r/2,a=e-o,l=t-i;if(0!==a||0!==l){const e=Math.abs(a),t=Math.abs(l),u=n/2,d=r/2,h=e*d>t*u?u/e:d/t;s=o+a*h,c=i+l*h}}}else if("bracket"===o&&i){const e=i.width,t=i.height,n=i.depth||30;void 0!==e?(s=e/2,c=n):void 0!==t&&(s=n,c=t/2)}}else{const n=(i.radius||0)+(i.radiusPadding||0);if(n>0&&(0!==e||0!==t)){const r=Math.atan2(t,e);s=Math.cos(r)*n,c=Math.sin(r)*n}}const l=Math.sqrt((e-s)**2+(t-c)**2);if(l>.5){const o=r||"var(--semiotic-text-secondary, currentColor)",i="curve"===n?.type;let u=Math.atan2(t-c,e-s);if(i){const r=(s+e)/2,i=(c+t)/2,d=-(t-c)/l,h=(e-s)/l,f=(n?.curve??.25)*l,g=r+d*f,p=i+h*f;a.push(wo("path",{className:"connector-curve",d:`M${s},${c}Q${g},${p} ${e},${t}`,fill:"none",stroke:o},"connector-line")),u=Math.atan2(p-c,g-s)}else a.push(wo("line",{x1:s,y1:c,x2:e,y2:t,stroke:o},"connector-line"));if("arrow"===n?.end){const e=10,t=16/180*Math.PI;a.push(wo("path",{d:`M${s},${c}L${s+e*Math.cos(u+t)},${c+e*Math.sin(u+t)}L${s+e*Math.cos(u-t)},${c+e*Math.sin(u-t)}Z`,fill:o,stroke:"none"},"connector-arrow"))}}return wo("g",{className:"annotation-connector",children:a})}function Eo(e){const{x:t=0,y:n=0,dx:r,dy:o,nx:i,ny:a,note:s,connector:c,subject:l,type:u,color:d,className:h,disable:f,opacity:g,strokeDasharray:p,events:y={},"data-testid":m}=e,v=Array.isArray(t)?t[0]??0:t,b=Array.isArray(n)?n[0]??0:n,x=new Set(Array.isArray(f)?f:[]);let k=r||0,w=o||0;null!=i&&(k=i-v),null!=a&&(w=a-b);const S="string"==typeof u?u:"label";if("bracket"===S&&l&&0===k&&0===w)if(void 0!==l.width){k=l.width/2;const e=l.depth||30;w=e+(0>e?-5:5)}else if(void 0!==l.height){const e=l.depth||30;k=e+(0>e?-5:5),w=l.height/2}return So("g",{className:("annotation "+(h||"")).trim(),transform:`translate(${v},${b})`,"data-testid":m,...null!=g&&{opacity:g},...p&&{strokeDasharray:p},...y,children:[!x.has("connector")&&To(k,w,c,d,S,l),!x.has("subject")&&Lo(S,l,d,v,b),!x.has("note")&&Co(s,k,w,d)]})}function Do(e){const{noteData:t}=e,{screenCoordinates:n}=t,r="string"==typeof t.type?t.type:"label",o=t.eventListeners||t.events||{};if(t.coordinates&&n){const e=t.nx||n[0][0]+(t.dx??0),o=t.ny||n[0][1]+(t.dy??0),i=n.map((n,i)=>{const a=Object.assign({},t,{note:0===i?t.note:{label:""},x:n[0],y:n[1],nx:e,ny:o});return wo(Eo,{"data-testid":"semiotic-annotation",...a,type:r},"multi-annotation-"+i)});return wo("g",{children:i})}const i=t.note||{title:"none",label:t.label},a=`${i.label}-${i.title}-${t.i}`;return wo(Eo,{"data-testid":"semiotic-annotation",events:o,...t,type:r},a)}import{packEnclose as Io}from"d3-hierarchy";import{area as No,curveLinear as Po,curveMonotoneX as _o,curveMonotoneY as Ro,curveStep as Wo,curveStepAfter as $o,curveStepBefore as Oo,curveBasis as Bo,curveCardinal as zo,curveCatmullRom as jo}from"d3-shape";function Ho(e){return Math.round(100*e)/100}function Fo(e,t=2){const n=[],r=[],o=t+1;for(let t=0;o>t;t++){let i=0;for(const[n,r]of e)null!==r&&(i+=n**t*r);n.push(i);const a=[];for(let n=0;o>n;n++){let r=0;for(const[o,i]of e)null!==i&&(r+=o**(t+n));a.push(r)}r.push(a)}r.push(n);const i=function(e,t){const n=e,r=e.length-1,o=[t];for(let e=0;r>e;e++){let t=e;for(let o=e+1;r>o;o++)Math.abs(n[e][o])>Math.abs(n[e][t])&&(t=o);for(let o=e;r+1>o;o++){const r=n[o][e];n[o][e]=n[o][t],n[o][t]=r}for(let t=e+1;r>t;t++)for(let o=r;o>=e;o--)n[o][t]-=n[o][e]*n[e][t]/n[e][e]}for(let e=r-1;e>=0;e--){let t=0;for(let i=e+1;r>i;i++)t+=n[i][e]*o[i];o[e]=(n[r][e]-t)/n[e][e]}return o}(r,o).map(Ho);return{points:e.map(([e])=>[Ho(e),Ho(i.reduce((t,n,r)=>t+n*e**r,0))]),equation:[...i].reverse()}}function Yo(e,t){const n=t.scales?.x??t.scales?.time;return n?null!=e.x?n(e.x):t.xAccessor&&null!=e[t.xAccessor]?n(e[t.xAccessor]):null:null}function Xo(e,t){const n=t.scales?.y??t.scales?.value;return n?null!=e.y?n(e.y):t.yAccessor&&null!=e[t.yAccessor]?n(e[t.yAccessor]):null:null}function Go(e){return null==e?null:e+""}function Vo(e,t,n){return t.stickyPositionCache?.set(e,n),n}function qo(e,t,n){const r=e.anchor||e.lifecycle?.anchor||"fixed";if("latest"===r){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let r=n.pointNodes.length-1;r>=0;r--){const o=n.pointNodes[r];if(o.pointId===e.pointId)return Vo(t,n,{x:o.x,y:o.y})}const r=function(e){const t=e.data;if(!t||0===t.length)return null;const n=t[t.length-1],r=e.scales?.x??e.scales?.time,o=e.scales?.y??e.scales?.value;if(!r||!o)return null;const i=n[e.xAccessor||"x"],a=n[e.yAccessor||"y"];return null==i||null==a?null:{x:r(i),y:o(a)}}(n);return r?Vo(t,n,r):null}if("semantic"===r){const r=function(e,t,n){const r=function(e){return Go(e.provenance?.stableId??e.stableId)}(e);if(!r)return null;const o=n.pointNodes?.find(e=>Go(e.pointId)===r);if(o)return Vo(t,n,{x:o.x,y:o.y});const i=n.data?.find(e=>function(e){return Go(e.stableId??e.id??e.provenance?.stableId)}(e)===r);if(!i)return null;const a=Yo(i,n),s=Xo(i,n);return null==a||null==s?null:Vo(t,n,{x:a,y:s})}(e,t,n);if(r)return r}let o=null,i=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(o=t.x,i=t.y)}if(null!=o&&null!=i||(o=Yo(e,n),i=Xo(e,n)),null!=o&&null!=i)return Vo(t,n,{x:o,y:i});if("sticky"===r){const e=n.stickyPositionCache?.get(t);if(e)return e}return null}function Uo(e,t,n,r=50){return!(-r>e||e>(n.width||0)+r||-r>t||t>(n.height||0)+r)}import*as Ko from"react";var[Qo,Zo]=xr(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 Jo(e,t={}){const n=function(e){const t=e.provenance,n=e.id??e.stableId??t?.stableId;return null==n||""===n?void 0:n+""}(e);return{"data-semiotic-annotation-widget":"",...n?{"data-semiotic-annotation-id":n}:{},onClickCapture(r){const o=function(e){const t=e.nativeEvent;return"touch"===t.pointerType?"touch":0===t.detail?"keyboard":"pointer"}(r);t.onAnnotationActivate?.({annotation:e,annotationId:n,chartId:t.chartId,inputType:o}),n&&t.onObservation&&t.onObservation({type:"annotation-activate",annotationId:n,inputType:o,timestamp:Date.now(),chartType:t.chartType??"unknown",chartId:t.chartId})}}}import{jsx as ei,jsxs as ti}from"react/jsx-runtime";var ni="var(--semiotic-bg, #ffffff)";function ri(e){const{x:t,y:n,text:r,fill:o,fontSize:i=12,fontWeight:a,fontFamily:s,textAnchor:c="start",dominantBaseline:l,background:u,className:d}=e,h=function(e){return void 0===e||!0===e||"halo"===e?{type:"halo"}:!1===e||"none"===e?null:"box"===e?{type:"box"}:{type:e.type??"halo",...e}}(u),f=e=>ei("text",{x:t,y:n,textAnchor:c,dominantBaseline:l,fill:o,fontSize:i,fontWeight:a,fontFamily:s,className:d,...e?{stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:"stroke"}:{},children:r});if(!h)return f();if("halo"===h.type)return f({stroke:h.fill??ni,strokeWidth:h.haloWidth??3});const g=h.padding??{x:6,y:3},p="number"==typeof g?g:g.x,y="number"==typeof g?g:g.y,m=function(e,t){return(e+"").length*t*.6}(r,i),v=i+2*y;let b,x;return b="middle"===c?t-m/2-p:"end"===c?t-m-p:t-p,x="middle"===l||"central"===l?n-v/2:"hanging"===l||"text-before-edge"===l?n-y:n-.8*i-y,ti("g",{className:d,children:[ei("rect",{x:b,y:x,width:m+2*p,height:v,rx:h.radius??3,ry:h.radius??3,fill:h.fill??ni,fillOpacity:h.opacity??.85,stroke:h.stroke,strokeWidth:h.strokeWidth}),f()]})}var oi=null;import{jsx as ii,jsxs as ai}from"react/jsx-runtime";function si(e){return"object"==typeof e&&null!==e&&"hatch"===e.type}function ci(e){return["hatch",e.background??"transparent",e.stroke??"#000",e.lineWidth??1.5,e.spacing??6,e.angle??45,e.lineOpacity??1].join("|")}function li(e,t){let n=2166136261;const r=ci(t);for(let e=0;r.length>e;e++)n^=r.charCodeAt(e),n=Math.imul(n,16777619);return`${e}-hatch-${(n>>>0).toString(36)}`}var ui=new Map;function di(e,t){const{background:n="transparent",stroke:r="#000",lineWidth:o=1.5,spacing:i=6,angle:a=45,lineOpacity:s=1}=e,c=Math.max(8,Math.ceil(2*i));return ai("pattern",{id:t,width:c,height:c,patternUnits:"userSpaceOnUse",patternTransform:0!==a?`rotate(${a})`:void 0,children:[n&&"transparent"!==n&&ii("rect",{width:c,height:c,fill:n}),ii("line",{x1:0,y1:0,x2:0,y2:c,stroke:r,strokeWidth:o,strokeOpacity:s}),ii("line",{x1:i,y1:0,x2:i,y2:c,stroke:r,strokeWidth:o,strokeOpacity:s})]},t)}function hi(e,t,n="#4e79a7"){if(si(e)){const n=li(t,e);return{fill:`url(#${n})`,def:di(e,n)}}return e&&"string"==typeof e?{fill:e}:{fill:n}}import{jsx as fi,jsxs as gi}from"react/jsx-runtime";var pi={linear:Po,monotoneX:_o,monotoneY:Ro,step:Wo,stepAfter:$o,stepBefore:Oo,basis:Bo,cardinal:zo,catmullRom:jo};var yi=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function mi(e){return!!e&&"object"==typeof e&&yi.has(function(e){return"string"==typeof e?.type?e.type:""}(e))}function vi(e){return"primary"===e?.emphasis||!0===e?.defensive}function bi(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 xi(e){let t;const n=e?.emphasis;t="primary"===n?100:"secondary"===n?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 ki=32,wi=6,Si=4,Ai=8,Mi=72;var Ci={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function Li(e){if(!Ti(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 Ti(e){return mi(e)}function Ei(e,t){if(!e)return[];const n=Math.max(1,Math.floor(t/7)),r=e.split(/\s+/).filter(Boolean),o=[];let i="";for(const e of r)i&&i.length+e.length+1>n?(o.push(i),i=e):i=i?`${i} ${e}`:e;return i&&o.push(i),o}function Di(e,t,n,r,o){const i=e+n,a=t+r;return Math.abs(n)>Math.abs(r)?{x:0>n?i-o.width-4:i+4,y:0>r?a-o.height:a,width:o.width,height:o.height}:{x:0>n?i-o.width:i,y:0>r?a-o.height-4:a+4,width:o.width,height:o.height}}function Ii(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function Ni(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 Pi(e,t,n,r,o,i,a,s){const c=Ii(e,a);let l=.4*Math.hypot(t.dx,t.dy)+80*function(e,t,n,r){const o=Math.max(0,r-e.x),i=Math.max(0,r-e.y);return(o+Math.max(0,e.x+e.width-(t-r)))*e.height+(i+Math.max(0,e.y+e.height-(n-r)))*e.width}(c,o,i,s);for(const e of n)l+=12*Ni(c,e);for(const e of r)l+=4*Ni(c,e);return l}function _i(e){const{annotations:t,context:n,defaultOffset:r=ki,notePadding:o=wi,markPadding:i=Si,edgePadding:a=Ai,preserveManualOffsets:s=!0,routeLongConnectors:c=!0,connectorThreshold:l=Mi,density:u,progressiveDisclosure:d=!1,redundantCues:h=!1,responsive:f,mobile:g,cohesion:p,audience:y}=e,m=n.width||0,v=n.height||0,b="object"==typeof g?g:{},x=b.breakpoint??480,k=!!g&&x>=m,w=k&&!1!==b.preferShortText?t.map(Li):t,S=k&&!u?{maxAnnotations:b.maxAnnotations??("callout-list"===b.strategy?1:2),minVisible:b.minVisible??1}:u,A=d||k&&(!1!==b.progressiveDisclosure||"callout-list"===b.strategy),M=k&&!f?b.responsive??{minWidth:x}:f,C=k&&!p?b.cohesion:p;if(0===w.length||0>=m||0>=v)return w.slice();const L=[],T=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}})}(n,i);let E=!1;const D=w.map((e,t)=>{if(!Ti(e))return e;const i=function(e,t,n){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&&n.pointNodes){const e=n.pointNodes.find(e=>e.pointId===r);if(e)return{x:e.x,y:e.y}}const o=e.coordinates,i=n.scales?.geoProjection;if(Array.isArray(o)&&o.length>=2&&i){const e=o[0],t=o[1];if("number"==typeof e&&"number"==typeof t){const n=i([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?qo(e,t,n):{x:e.x,y:e.y}}(e,t,n);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,n=[...Ei("string"==typeof e.title?e.title:void 0,t),...Ei("string"==typeof e.label?e.label:void 0,t)],r=n.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*n.length+6)}}(e);if(s&&("number"==typeof(d=e).dx||"number"==typeof d.dy)){const t=function(e){return"text"===e.type||"widget"===e.type?{dx:0,dy:0}:{dx:30,dy:-30}}(e);return L.push(Ii(Di(i.x,i.y,"number"==typeof e.dx?e.dx:t.dx,"number"==typeof e.dy?e.dy:t.dy,u),o)),e}var d;let h=null,f=1/0;for(const e of function(e){const t=1.6*e;return[{dx:e,dy:-e},{dx:-e,dy:-e},{dx:e,dy:e},{dx:-e,dy:e},{dx:e,dy:0},{dx:-e,dy:0},{dx:0,dy:-e},{dx:0,dy:e},{dx:t,dy:-t},{dx:-t,dy:-t},{dx:t,dy:t},{dx:-t,dy:t}]}(r)){const t=Pi(Di(i.x,i.y,e.dx,e.dy,u),e,L,T,m,v,o,a);f>t&&(h=e,f=t)}if(!h)return e;const g=Ii(Di(i.x,i.y,h.dx,h.dy,u),o);L.push(g);const p=Math.hypot(h.dx,h.dy),y=c&&p>=l&&"text"!==e.type&&"widget"!==e.type?{...e.connector||{end:"arrow"},type:"curve"}:e.connector;return E=!0,{...e,dx:h.dx,dy:h.dy,...y?{connector:y}:{}}}),I=E?D:w.slice();let N=I;if(h){let e=!1;const t=I.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:{...e,_redundantConnector:!0}}(t);return n!==t&&(e=!0),n});N=e?t:I}{let e=!1;const t=N.map(t=>{if(!0!==t?.defensive)return t;const n=function(e){const t=e?.provenance;if(!t||"object"!=typeof t)return e;const n="string"==typeof t.source?Ci[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(!n&&!r)return e;if(null!=e.label&&"string"!=typeof e.label)return e;const o=[n,r].filter(Boolean).join(" · "),i="string"==typeof e.label?e.label:"";return i.includes(`(${o})`)?e:{...e,label:i?`${i} (${o})`:`(${o})`}}(t);return n!==t&&(e=!0),n});N=e?t:N}const P=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 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),n=1===t?e:{...e,maxAnnotations:Math.max(0,Math.round((e.maxAnnotations??bi(m,v,e))*t))},{deferred:r}=function(e){const{annotations:t,width:n,height:r}=e,o=Math.max(0,e.minVisible??1),i=bi(n,r,e),a=t.map((e,t)=>{return{annotation:e,index:t,note:(n=e,mi(n))};var n}),s=a.filter(e=>e.note);if(0===s.length||i>=s.length)return{visible:t.slice(),deferred:[],budget:i};const c=s.filter(e=>vi(e.annotation)),l=s.filter(e=>!vi(e.annotation)).sort((e,t)=>xi(t.annotation)-xi(e.annotation)||e.index-t.index),u=Math.min(l.length,Math.max(Math.max(0,i-c.length),Math.max(0,o-c.length))),d=new Set([...c.map(e=>e.index),...l.slice(0,u).map(e=>e.index)]),h=[],f=[];for(const{annotation:e,index:t,note:n}of a)!n||d.has(t)?h.push(e):f.push(e);return{visible:h,deferred:f,budget:i}}({annotations:N,width:m,height:v,...n});for(const e of r)P.add(e)}if(M&&("object"==typeof M&&"number"==typeof M.minWidth?M.minWidth:480)>=m)for(const e of N)Ti(e)&&"secondary"===e.emphasis&&P.add(e);if(P.size>0)for(const e of N)!0===e?.defensive&&P.delete(e);let _;return _=0===P.size?N:A?N.map(e=>P.has(e)?{...e,_annotationDeferred:!0}:e):N.filter(e=>!P.has(e)),C?function(e,t){let n=!1;const r=e.map(e=>Ti(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(n=!0,{...e,cohesion:t}):e);return n?r:e}(_,C):_}import{symbol as Ri,symbolCircle as Wi,symbolCross as $i,symbolDiamond as Oi,symbolSquare as Bi,symbolStar as zi,symbolTriangle as ji,symbolWye as Hi}from"d3-shape";var Fi={circle:Wi,square:Bi,triangle:ji,diamond:Oi,star:zi,cross:$i,wye:Hi};function Yi(e,t,n){if(n)return n;const r=e??"circle";return"chevron"===r?function(e){const t=1.5*Xi(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):Ri(Fi[r]??Wi,Math.max(1,t))()??""}function Xi(e){return Math.sqrt(Math.max(1,e)/Math.PI)}import{Fragment as Gi,jsx as Vi,jsxs as qi}from"react/jsx-runtime";function Ui(e){const{width:t,height:n,totalWidth:r,totalHeight:o,margin:i,labels:a,title:s,legend:c,legendHoverBehavior:l,legendClickBehavior:u,legendHighlightedCategory:d,legendIsolatedCategories:h,legendPosition:f="right",legendLayout:g,foregroundGraphics:p,sceneNodes:y,annotations:m,onAnnotationActivate:v,onObservation:b,chartId:x,chartType:k,autoPlaceAnnotations:w,svgAnnotationRules:S}=e,A=function(e){const t=Zo(e=>e.pushObservation),n=Ko.useCallback(n=>{e.onObservation?.(n),t?.(n)},[e,t]);return Ko.useMemo(()=>({...e,onObservation:n}),[n,e])}({onAnnotationActivate:v,onObservation:b,chartId:x,chartType:k}),M=Jr.useMemo(()=>{const e=(y||[]).flatMap(e=>{const t=function(e){if("glyph"===e.type&&e.glyph&&"number"==typeof e.size){const t=e.cx??e.x,n=e.cy??e.y;if("number"!=typeof t||"number"!=typeof n)return null;const r=On(e.glyph,e.size);return{x:t+r.centerDx,y:n+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),n=e.cy??(null!=e.y&&null!=e.h?e.y+e.h/2:e.y);return"number"!=typeof t||"number"!=typeof n?null:{x:t,y:n,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,Xi(e.size)):Math.max(1,e.w??0,e.h??0)/2}}(e),n=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:n,...t}]:[]});return{scales:null,width:t,height:n,frameType:"network",pointNodes:e,sceneNodes:y}},[n,y,t]),C=Jr.useMemo(()=>m&&w?_i({annotations:m,context:M,..."object"==typeof w?w:{}}):m,[m,w,M]),L=Jr.useMemo(()=>function(e,t={}){return function(e,n,r){switch(e.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const t=qo(e,n,r);if(!t)return null;const{x:o,y:i}=t;if(!Uo(o,i,r))return null;const a="callout"===e.type?"callout-circle":e.type,s="callout-circle"===a?{radius:e.radius??12,radiusPadding:e.radiusPadding}:"callout-rect"===a?{width:e.width,height:e.height}:void 0;return fi(Do,{noteData:{x:o,y:i,dx:e.dx??30,dy:e.dy??-30,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:a,...s?{subject:s}:{},connector:e.connector||{end:"arrow"},color:e.color,disable:e.disable,opacity:e.opacity,strokeDasharray:e.strokeDasharray,className:e.className}},"ann-"+n)}case"x-threshold":{const t=Yo(null!=e.value?{...e,x:e.value}:e,r);if(null==t)return null;const o=e.color||"#f97316",i=e.labelPosition||"top";let a;a="bottom"===i?(r.height||0)-4:"center"===i?(r.height||0)/2:16;const s=t>.6*(r.width||0),c=s?t-4:t+4,l=s?"end":"start";return gi("g",{opacity:e.opacity,children:[fi("line",{x1:t,y1:0,x2:t,y2:r.height||0,stroke:o,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&fi(ri,{x:c,y:a,text:e.label,textAnchor:l,fill:o,fontSize:12,fontWeight:"bold",background:e.labelBackground??"halo"})]},"ann-"+n)}case"y-threshold":{const t=Xo(null!=e.value?{...e,y:e.value}:e,r);if(null==t)return null;const o=e.color||"#f97316",i=e.labelPosition||"right";let s,c;"left"===i?(s=4,c="start"):"center"===i?(s=(r.width||0)/2,c="middle"):(s=(r.width||0)-4,c="end");const l=20>(a=t)?Math.min((r.height||0)-4,a+16):a-4;return gi("g",{opacity:e.opacity,children:[fi("line",{x1:0,y1:t,x2:r.width||0,y2:t,stroke:o,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&fi(ri,{x:s,y:l,text:e.label,textAnchor:c,fill:o,fontSize:12,fontWeight:"bold",background:e.labelBackground??"halo"})]},"ann-"+n)}case"enclose":{const t=(e.coordinates||[]).map(e=>({x:Yo({...e,type:"point"},r),y:Xo({...e,type:"point"},r),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>t.length)return null;const o=Io(t),i=e.padding||10;return gi("g",{children:[fi("circle",{cx:o.x,cy:o.y,r:o.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&&fi(ri,{x:o.x,y:o.y-o.r-i-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:e.label,background:e.labelBackground??"none"})]},"ann-"+n)}case"rect-enclose":{const t=(e.coordinates||[]).map(e=>({x:Yo({...e,type:"point"},r),y:Xo({...e,type:"point"},r)})).filter(e=>null!=e.x&&null!=e.y);if(2>t.length)return null;const o=e.padding||10,i=t.map(e=>e.x),a=t.map(e=>e.y),[s,c]=Oe(i),[l,u]=Oe(a),d=s-o,h=c+o,f=l-o;return gi("g",{children:[fi("rect",{x:d,y:f,width:h-d,height:u+o-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&&fi(ri,{x:(d+h)/2,y:f-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:e.label,background:e.labelBackground??"none"})]},"ann-"+n)}case"highlight":{const t=r.data||[],o="function"==typeof e.filter?t.filter(e.filter):e.field&&null!=e.value?t.filter(t=>t[e.field]===e.value):[],i={stroke:e.color||"#f97316",strokeWidth:2,fill:"none"};return fi("g",{children:o.map((t,n)=>{const o=Yo(t,r),a=Xo(t,r);if(null==o||null==a)return null;const s="function"==typeof e.r?e.r(t):e.r||6,c="function"==typeof e.style?e.style(t):e.style||i;return fi("circle",{cx:o,cy:a,r:s,...c},"hl-"+n)})},"ann-"+n)}case"bracket":{const t=Yo(e,r),o=Xo(e,r);return fi(Do,{noteData:{x:t??0,y:o??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-"+n)}case"trend":{const t=r.data||[];if(2>t.length)return null;const o=r.xAccessor||"x",i=r.yAccessor||"y",a="ordinal"===r.frameType,s="horizontal"===r.projection,c=a?o:null,l=a?i:null;let u;const d=[],h=new Map;if(a&&c&&l){for(const e of t){const t=e[c];if(null==t)continue;const n=t+"";h.has(n)||(h.set(n,d.length),d.push(n))}u=t.map(e=>{const t=e[c],n=e[l];if(null==t||null==n)return null;const r=h.get(t+"");return null!=r?[r,+n]:null}).filter(e=>null!==e)}else u=t.map(e=>[e[o],e[i]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>u.length)return null;const f=r.scales?.x??r.scales?.time,g=r.scales?.y??r.scales?.value;if(!f||!g)return null;const p=e=>t=>{const n=Math.max(0,Math.floor(t)),r=Math.min(d.length-1,n+1),o=t-n,i=e(d[n]);return i+(e(d[r])-i)*o},y=f,m=g;let v;if(a)if(s){const e=p(m);v=(t,n)=>[y(n),e(t)]}else{const e=p(y);v=(t,n)=>[e(t),m(n)]}else v=(e,t)=>[y(e),m(t)];const b=e.method||"linear";let x;if("loess"===b)x=function(e,t=.3){const n=e.length;if(2>n)return e.slice();const r=e.slice().sort((e,t)=>e[0]-t[0]),o=r.map(e=>e[0]),i=r.map(e=>e[1]),a=Math.max(2,Math.ceil(t*n)),s=[];for(let e=0;n>e;e++){const t=o[e],r=o.map(e=>Math.abs(e-t)),c=r.slice().sort((e,t)=>e-t)[Math.min(a-1,n-1)]||1,l=[];for(let e=0;n>e;e++){const t=0===c?0:r[e]/c;l[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,f=0,g=0;for(let e=0;n>e;e++){const t=l[e];0!==t&&(u+=t,d+=t*o[e],h+=t*i[e],f+=t*o[e]*o[e],g+=t*o[e]*i[e])}if(0===u){s.push([t,i[e]]);continue}const p=u*f-d*d;if(1e-12>Math.abs(p))s.push([t,h/u]);else{const e=(u*g-d*h)/p;s.push([t,(h-e*d)/u+e*t])}}return s}(u,e.bandwidth??.3);else{const t="polynomial"===b?Fo(u,e.order||2):function(e){const t=[0,0,0,0];let n=0;for(const[r,o]of e)null!==o&&(n++,t[0]+=r,t[1]+=o,t[2]+=r*r,t[3]+=r*o);const r=n*t[2]-t[0]*t[0],o=0===r?0:Ho((n*t[3]-t[0]*t[1])/r),i=Ho(t[1]/n-o*t[0]/n);return{points:e.map(([e])=>[Ho(e),Ho(o*e+i)]),equation:[o,i]}}(u);x=t.points}const k=x.map(([e,t])=>{const[n,r]=v(e,t);return`${n},${r}`}).join(" "),w=e.color||"#6366f1",S=x[x.length-1],[A,M]=v(S[0],S[1]);return gi("g",{children:[fi("polyline",{points:k,fill:"none",stroke:w,strokeWidth:e.strokeWidth||2,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&fi("text",{x:A+4,y:M-4,fill:w,fontSize:11,children:e.label})]},"ann-"+n)}case"band":{const t=r.scales?.y??r.scales?.value,a=t?.(e.y0)??0,s=t?.(e.y1)??(r.height||0),c=hi(e.fill,"ann-"+n,"var(--semiotic-primary, #6366f1)");return gi("g",{opacity:e.opacity,children:[c.def&&fi("defs",{children:c.def}),fi("rect",{x:0,y:Math.min(a,s),width:r.width||0,height:Math.abs(s-a),fill:c.fill,fillOpacity:e.fillOpacity||.1}),e.label&&fi(ri,{x:(r.width||0)-4,y:(o=a,i=s,Math.max(Math.min(o,i),0)+16),textAnchor:"end",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:e.label,background:e.labelBackground??"halo"})]},"ann-"+n)}case"x-band":{const t=r.scales?.x??r.scales?.time,o=null!=e.x0&&t?t(e.x0):null,i=null!=e.x1&&t?t(e.x1):null;if(null==o||null==i)return null;const a=hi(e.fill||e.color,"ann-"+n,"var(--semiotic-primary, #6366f1)");return gi("g",{opacity:e.opacity,children:[a.def&&fi("defs",{children:a.def}),fi("rect",{x:Math.min(o,i),y:0,width:Math.abs(i-o),height:r.height||0,fill:a.fill,fillOpacity:e.fillOpacity??.1}),e.label&&fi(ri,{x:Math.min(o,i)+4,y:16,textAnchor:"start",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:e.label,background:e.labelBackground??"halo"})]},"ann-"+n)}case"envelope":{const t=r.data||[];if(2>t.length)return null;const o=r.xAccessor||"x",i=r.scales?.x??r.scales?.time,a=r.scales?.y??r.scales?.value;if(!i||!a)return null;const s=e.upperAccessor||"upperBounds",c=e.lowerAccessor||"lowerBounds",l=e.filter,u=t.filter(e=>null!=e[s]&&null!=e[c]&&!(l&&!l(e))).sort((e,t)=>e[o]-t[o]);if(2>u.length)return null;const d=pi[r.curve||"linear"]||Po,h=No().x(e=>i(e[o])).y0(e=>a(e[c])).y1(e=>a(e[s])).curve(d)(u);if(!h)return null;const f=e.fill||"#6366f1";return gi("g",{children:[fi("path",{d:h,fill:f,fillOpacity:e.fillOpacity??.15,stroke:"none"}),e.label&&u.length>0&&fi("text",{x:i(u[u.length-1][o])+4,y:a(u[u.length-1][s])-4,fill:f,fontSize:11,children:e.label})]},"ann-"+n)}case"anomaly-band":{const t=r.data||[];if(2>t.length)return null;const o=r.yAccessor||"y",i=r.scales?.x??r.scales?.time,a=r.scales?.y??r.scales?.value;if(!i||!a)return null;const s=t.map(e=>e[o]).filter(e=>null!=e&&isFinite(e));if(2>s.length)return null;const c=s.reduce((e,t)=>e+t,0)/s.length,l=s.reduce((e,t)=>e+(t-c)**2,0)/s.length,u=Math.sqrt(l),d=e.threshold??2,h=c-d*u,f=!1!==e.showBand,g=e.fill||"#6366f1",p=e.fillOpacity??.1,y=e.anomalyColor||"#ef4444",m=e.anomalyRadius??6,v=a(c+d*u),b=a(h),x=t.filter(e=>{const t=e[o];return null!=t&&Math.abs(t-c)>d*u});return gi("g",{children:[f&&fi("rect",{x:0,y:Math.min(v,b),width:r.width||0,height:Math.abs(b-v),fill:g,fillOpacity:p}),x.map((e,t)=>{const n=Yo(e,r),o=Xo(e,r);return null==n||null==o?null:fi("circle",{cx:n,cy:o,r:m,fill:y,fillOpacity:.7,stroke:y,strokeWidth:1.5},"anomaly-"+t)}),e.label&&fi("text",{x:(r.width||0)-4,y:Math.min(v,b)-4,textAnchor:"end",fill:g,fontSize:11,children:e.label})]},"ann-"+n)}case"forecast":{const t=r.data||[];if(3>t.length)return null;const o=r.xAccessor||"x",i=r.yAccessor||"y",a=r.scales?.x??r.scales?.time,s=r.scales?.y??r.scales?.value;if(!a||!s)return null;const c=t.map(e=>[e[o],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>c.length)return null;let l;if("polynomial"===(e.method||"linear")){const t=Fo(c,e.order||2).equation;l=e=>t.reduce((t,n,r)=>t+n*Math.pow(e,r),0)}else{const e=c.length;let t=0,n=0,r=0,o=0;for(const[e,i]of c)t+=e,n+=i,r+=e*e,o+=e*i;const i=e*r-t*t;if(1e-12>Math.abs(i))return null;const a=(e*o-t*n)/i,s=(n-a*t)/e;l=e=>s+a*e}const u=c.length,d=c.map(([e,t])=>t-l(e)),h=d.reduce((e,t)=>e+t*t,0),f=Math.sqrt(h/Math.max(u-2,1)),g=c.reduce((e,t)=>e+t[0],0)/u,p=c.reduce((e,t)=>e+(t[0]-g)**2,0),y=e.confidence??.95,m=.99>y?.95>y?.9>y?1:1.645:1.96:2.576,v=e.steps??5,b=c[u-1][0],x=(b-c[0][0])/Math.max(u-1,1),k=[];for(let e=1;v>=e;e++)k.push(b+e*x);const w=[];for(const e of k){const t=l(e),n=f*Math.sqrt(1+1/u+(p>0?(e-g)**2/p:0))*m;w.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const S=`M${w.map(e=>`${a(e.x)},${s(e.yUpper)}`).join(" L")} L${w.slice().reverse().map(e=>`${a(e.x)},${s(e.yLower)}`).join(" L")} Z`,A=w.map(e=>`${a(e.x)},${s(e.yCenter)}`).join(" "),M=`${a(b)},${s(l(b))}`,C=e.strokeColor||"#6366f1";return gi("g",{children:[fi("path",{d:S,fill:e.fill||"#6366f1",fillOpacity:e.fillOpacity??.15,stroke:"none"}),fi("polyline",{points:`${M} ${A}`,fill:"none",stroke:C,strokeWidth:e.strokeWidth??2,strokeDasharray:e.strokeDasharray??"6,3"}),e.label&&w.length>0&&fi("text",{x:a(w[w.length-1].x)+4,y:s(w[w.length-1].yCenter)-4,fill:C,fontSize:11,children:e.label})]},"ann-"+n)}case"widget":{let o,i;if(null!=e.px&&null!=e.py)o=e.px,i=e.py;else{const t=qo(e,n,r);if(!t)return null;o=t.x,i=t.y}if(!Uo(o,i,r))return null;const a=e.dx??0,s=e.dy??0,c=e.width??32,l=e.height??32,u=e.content??fi("span",{style:{fontSize:18,cursor:"default"},title:e.label||"Info",children:"ℹ️"});return fi("foreignObject",{x:o+a-c/2,y:i+s-l/2,width:c,height:l,style:{overflow:"visible",pointerEvents:"auto"},children:fi("div",{...Jo(e,t),style:{width:c,height:l,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+n)}case"text":{const t=qo(e,n,r);if(!t)return null;const{x:o,y:i}=t,a=o+(e.dx||0),s=i+(e.dy||0),c=e.color||"var(--semiotic-text, #333)",l=fi("text",{x:a,y:s,fill:c,fontSize:e.fontSize||11,opacity:e.opacity,strokeDasharray:e.strokeDasharray,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:e.label});return!0!==e._redundantConnector?ko.cloneElement(l,{key:"ann-text-"+n}):gi("g",{opacity:e.opacity,strokeDasharray:e.strokeDasharray,children:[fi("line",{x1:o,y1:i,x2:a,y2:s,stroke:c,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),ko.cloneElement(l,{opacity:void 0,strokeDasharray:void 0})]},"ann-text-"+n)}case"category-highlight":{const t=e.category;if(null==t)return null;const o=e=>"function"==typeof e&&"function"==typeof e.bandwidth,i=r.scales?.o,a=r.scales?.x,s=r.scales?.y,c=o(i)?i:o(a)?a:o(s)?s:null;if(!c)return null;const l=c(t+"");if(null==l)return null;const u=c.bandwidth(),d=e.color||"var(--semiotic-primary, #4589ff)",h=e.opacity??.15,f=e.label;return gi("g",(r.projection?"vertical"===r.projection:c===a)?{children:[fi("rect",{x:l,y:0,width:u,height:r.height||0,fill:d,fillOpacity:h}),f&&fi(ri,{x:l+u/2,y:16,textAnchor:"middle",fill:d,fontSize:12,fontWeight:"bold",text:f,background:e.labelBackground??"none"})]}:{children:[fi("rect",{x:0,y:l,width:r.width||0,height:u,fill:d,fillOpacity:h}),f&&fi(ri,{x:12,y:l+u/2,dominantBaseline:"middle",fill:d,fontSize:12,fontWeight:"bold",text:f,background:e.labelBackground??"none"})]},"ann-"+n)}default:return null}var o,i,a}}(),[]),T=C?function(e,t,n,r){const o=[];return e.forEach((e,i)=>{let a;if(n){const o=n(e,i,r);a=null!=o?o:t(e,i,r)}else a=t(e,i,r);a&&o.push({node:a,annotation:e})}),function(e){const t=e.map((e,t)=>{return{p:e,i:t,emphasis:(n=e.annotation,"primary"===n?.emphasis||"secondary"===n?.emphasis?n.emphasis:null),confidence:bo(e.annotation),readingOrder:null,rank:1};var n}),n=t.some(e=>null!=e.emphasis||null!=e.confidence),r=e.some(e=>mo(e.annotation)),o=e.some(e=>null!=vo(e.annotation)),i=e.some(e=>"layer"===vo(e.annotation));if(!n&&!r&&!o)return e.map(e=>e.node);const a=t.filter(e=>null==e.emphasis&&null!=e.confidence).slice().sort((e,t)=>(t.confidence??0)-(e.confidence??0)||e.i-t.i);a.forEach((e,t)=>{e.readingOrder=t,e.rank=2-t/Math.max(1,a.length)});for(const e of t)e.emphasis&&(e.rank=po[e.emphasis]);const s=t.sort((e,t)=>e.rank-t.rank||e.i-t.i).map(e=>{const{p:t,i:n,emphasis:r,readingOrder:o}=e,i=mo(t.annotation);let a=t.node;if("primary"===r||"secondary"===r||null!=o){const e=null==r&&null!=o;a=go("g",{className:e?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+r,..."secondary"===r?{opacity:.6,fontSize:"0.88em"}:{},...e?{opacity:xo(o),"data-annotation-reading-order":o}:{},children:t.node},"annotation-emphasis-"+n)}const s=vo(t.annotation);return s&&(a=go("g",{className:"annotation-cohesion--"+s,children:a},"annotation-cohesion-"+n)),i&&(a=go("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:a},"annotation-deferred-"+n)),a});return r&&s.unshift(go("style",{children:yo},"annotation-disclosure-style")),i&&s.unshift(go("style",{children:".annotation-cohesion--layer text,.annotation-cohesion--layer tspan{fill:var(--semiotic-annotation-color,var(--semiotic-text-secondary,#666));font-style:italic}"},"annotation-cohesion-style")),s}(o)}(C.filter(e=>"widget"!==e.type),L,S,M):null,E=!0===C?.some(e=>"widget"===e.type&&!0===e._annotationDeferred);return qi(Gi,{children:[E&&Vi("style",{children:yo},"annotation-widget-disclosure-style"),qi("svg",{role:"img",width:r,height:o,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[Vi("title",{children:"string"==typeof s?s:"Network Chart"}),Vi("desc",{children:"string"==typeof s?s+" — network data visualization":"Network data visualization"}),qi("g",{transform:`translate(${i.left},${i.top})`,children:[a.map((e,t)=>Vi("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)),T,p]}),s&&"string"==typeof s?Vi("text",{x:r/2,y:22,textAnchor:"middle",fontWeight:600,fill:"currentColor",className:"semiotic-chart-title",style:{fontSize:"var(--semiotic-title-font-size, 14px)"},children:s}):s?Vi("foreignObject",{x:0,y:0,width:r,height:i.top,children:s}):null,fo({legend:c,totalWidth:r,totalHeight:o,margin:i,legendPosition:f,title:s,legendLayout:g,legendHoverBehavior:l,legendClickBehavior:u,legendHighlightedCategory:d,legendIsolatedCategories:h})]}),C?.filter(e=>"widget"===e.type&&e.nodeId&&y).map((e,t)=>{const n=!0===e._annotationDeferred,r=y.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 o=i.left+(r.cx??(null!=r.x&&null!=r.w?r.x+r.w/2:r.x??0)),a=i.top+(r.cy??(null!=r.y&&null!=r.h?r.y+r.h/2:r.y??0)),s=e.dx??0,c=e.dy??-16,l=e.width??32,u=e.height??32,d=e.content??Vi("span",{style:{fontSize:18,cursor:"default"},children:"ℹ️"});return Vi("div",{...Jo(e,A),className:n?"annotation-deferred":void 0,"data-annotation-disclosure":n?"deferred":void 0,style:{position:"absolute",left:o+s-l/2,top:a+c-u/2,width:l,height:u,display:"flex",alignItems:"center",justifyContent:"center",zIndex:5},children:d},"widget-"+t)})]})}Ui.displayName="NetworkSVGOverlay";import*as Ki from"react";import{jsx as Qi}from"react/jsx-runtime";var Zi={position:"absolute",top:0,left:0,pointerEvents:"none"};function Ji({marks:e,margin:t,selection:n=null,overscan:r=400}){const o=Ki.useRef(null),i=function(e,t,n){const[r,o]=Ki.useState(null);return Ki.useLayoutEffect(()=>{const e=t.current,n=function(e){let t=e?.parentElement??null;for(;t;){const{overflow:e,overflowX:n,overflowY:r}=window.getComputedStyle(t);if(/(auto|scroll|overlay)/.test(`${e} ${r} ${n}`))return t;t=t.parentElement}return null}(e);if(!e||!n)return void o(null);let r=0;const i=()=>{r=0;const t=n.getBoundingClientRect(),i=e.getBoundingClientRect();o(0!==t.width&&0!==t.height?{scroll:{left:t.left,top:t.top,right:t.right,bottom:t.bottom},originX:i.left,originY:i.top}:null)},a=()=>{0===r&&(r=window.requestAnimationFrame(i))};i(),n.addEventListener("scroll",a,{passive:!0});const s=new ResizeObserver(a);return s.observe(n),()=>{0!==r&&window.cancelAnimationFrame(r),n.removeEventListener("scroll",a),s.disconnect()}},[t,e,n]),Ki.useMemo(()=>{if(!e||!r)return e;const{scroll:t,originX:o,originY:i}=r,a=t.left-n,s=t.right+n,c=t.top-n,l=t.bottom+n;return e.filter(e=>{const t=o+e.x,n=i+e.y;return!(a>t+e.width||t>s||c>n+e.height||n>l)})},[e,r,n])}(e,o,r);if(!e||0===e.length)return null;const a=Qi("div",{className:"semiotic-network-html-marks",ref:o,style:{...Zi,transform:`translate(${t.left}px, ${t.top}px)`},children:(i??e).map(e=>Qi("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!=n?Qi(Mn,{value:n,children:a}):a}import*as ea from"react";import{arc as ta}from"d3-shape";import{jsx as na,jsxs as ra}from"react/jsx-runtime";var oa={innerRadius:0,outerRadius:0,startAngle:0,endAngle:0};function ia(e,t="#4e79a7"){return si(e)?e.background&&"transparent"!==e.background?e.background:t:e&&"string"==typeof e?e:t}var aa="undefined"==typeof window||"undefined"==typeof document;import*as sa from"react";import*as ca from"react";import{jsx as la}from"react/jsx-runtime";var ua=ca.createContext(null);import{jsx as da}from"react/jsx-runtime";var ha={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function fa({hoverPoint:e}){let t="";if(e){const n=e.data||e;t="object"==typeof n?"Data point: "+Object.entries(n).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Data point: "+n}return da("div",{"aria-live":"polite","aria-atomic":"true",style:ha,children:t})}import{jsx as ga,jsxs as pa}from"react/jsx-runtime";function ya(e,t,n){const r=[];return e>0&&r.push(e+" nodes"),t>0&&r.push(t+" edges"),0===r.length?n+", empty":`${n}, ${r.join(", ")}`}var ma=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},va="semiotic-accessible-data-table",ba=va+" semiotic-accessible-data-table-hidden",xa=va+" semiotic-accessible-data-table-visible semiotic-accessible-data-table-network",ka={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"},wa={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},Sa={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)"},Aa={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},Ma={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))"},Ca={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},La={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},Ta={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 Ea({nodes:e,edges:t,chartType:n,tableId:r,chartTitle:o}){const[i,a]=sa.useState(!1),[s,c]=sa.useState(5),l=ca.useContext(ua),u=l?.visible??!1,d=i||u,h=o?"Data summary for "+o:r?`Data summary for ${n} ${r}`:"Data summary for "+n,f=sa.useRef(null);sa.useEffect(()=>{d||c(5)},[d]);const g=sa.useCallback(e=>{e.target===e.currentTarget&&(i||u||a(!0))},[i,u]),p=sa.useCallback(e=>{u||f.current?.contains(e.relatedTarget)||a(!1)},[u]);if(!e||0===e.length)return r?ga("span",{id:r,tabIndex:-1,style:ha}):null;if(!d)return ga("div",{id:r,className:ba,tabIndex:-1,onFocus:g,style:ha,role:"region","aria-label":h,children:pa("button",{type:"button",onClick:()=>a(!0),children:["View data summary (",e.length," nodes, ",t.length," edges)"]})});const y=Array.isArray(e)?e:[],m=Array.isArray(t)?t:[],v=new Map,b=new Map,x=new Map,k=new Map;for(const e of m){if(!e||"object"!=typeof e)continue;const t=e.datum??{source:e.source,target:e.target},n="object"==typeof t.source?t.source?.id:t.source,r="object"==typeof t.target?t.target?.id:t.target,o="number"==typeof t.value&&Number.isFinite(t.value)?t.value:0;if(null!=n&&""!==n){const e=n+"";b.set(e,(b.get(e)??0)+1),k.set(e,(k.get(e)??0)+o)}if(null!=r&&""!==r){const e=r+"";v.set(e,(v.get(e)??0)+1),x.set(e,(x.get(e)??0)+o)}}const w=[];for(let e=0;y.length>e;e++){const t=y[e];if(!t||"object"!=typeof t)continue;const n=t.datum?.id??t.id,r=null!=n?n+"":"node-"+e,o=v.get(r)??0,i=b.get(r)??0,a=x.get(r)??0,s=k.get(r)??0;w.push({id:r,degree:o+i,inDeg:o,outDeg:i,wDegree:a+s,wInDeg:a,wOutDeg:s})}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 M=m.some(e=>{const t=e?.datum??{source:e?.source,target:e?.target};return"number"==typeof t?.value&&Number.isFinite(t.value)}),C=[`${w.length} nodes, ${m.length} edges.`];w.length>0&&C.push(`Mean degree: ${ma(S)}, max degree: ${A}.`);const L=Math.min(s,w.length),T=w.slice(0,L),E=w.length-L;return pa("div",{ref:f,id:r,className:xa,tabIndex:-1,onBlur:p,style:ka,role:"region","aria-label":h,children:[ga("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{u&&l&&l.setVisible(!1),a(!1)},"aria-label":"Close data summary",style:Sa,children:"×"}),ga("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:wa,children:C.join(" ")}),pa("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Node degree summary for "+n,style:Aa,children:[ga("caption",{className:"semiotic-accessible-data-table-caption",style:La,children:E>0?`Top ${L} of ${w.length} nodes by degree`:`All ${w.length} nodes by degree`}),ga("thead",{children:pa("tr",{children:[ga("th",{style:Ma,children:"id"}),ga("th",{style:Ma,children:"degree"}),ga("th",{style:Ma,children:"in"}),ga("th",{style:Ma,children:"out"}),M&&ga("th",{style:Ma,children:"w. degree"}),M&&ga("th",{style:Ma,children:"w. in"}),M&&ga("th",{style:Ma,children:"w. out"})]})}),ga("tbody",{children:T.map((e,t)=>pa("tr",{children:[ga("td",{style:Ca,children:e.id}),ga("td",{style:Ca,children:e.degree}),ga("td",{style:Ca,children:e.inDeg}),ga("td",{style:Ca,children:e.outDeg}),M&&ga("td",{style:Ca,children:ma(e.wDegree)}),M&&ga("td",{style:Ca,children:ma(e.wInDeg)}),M&&ga("td",{style:Ca,children:ma(e.wOutDeg)})]},t))})]}),E>0&&pa("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>c(e=>e+25),style:Ta,children:["Show ",Math.min(25,E)," more"," ",1===E?"node":"nodes"," (",E," remaining)"]})]})}function Da({summary:e}){return e?ga("div",{role:"note",style:ha,children:e}):null}function Ia({tableId:e}){return ga("a",{href:"#"+e,style:ha,onClick:t=>{t.preventDefault();const n=document.getElementById(e);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,ha)},children:"Skip to data table"})}var Na=new Set;function Pa(e,t){const n="function"==typeof e?e(t.datum??null,t):e;return(r=n)&&"object"==typeof r&&"string"==typeof r.id&&"function"==typeof r.cacheKey&&"function"==typeof r.drawCanvas&&"function"==typeof r.renderStaticSVG?n:void 0;var r}function _a(e,t){if("undefined"!=typeof process&&"production"===process.env?.NODE_ENV)return;const n=`${e}:${t}`;Na.has(n)||(Na.add(n),console.warn(`[Semiotic] Render backend "${e}" does not support scene node "${t}"; using the built-in renderer.`))}function Ra(e){const{context:t,nodes:n,renderMode:r,pixelRatio:o,paintBuiltIn:i}=e;if(!r||"sketchy"===r)return void i(n);let a=[];const s=()=>{a.length&&(i(a),a=[])};for(const e of n){const n=Pa(r,e);if(!n){a.push(e);continue}let c;s(),t.save();try{c=n.drawCanvas({context:t,node:e,style:e.style??{},pixelRatio:o})}finally{t.restore()}c||(_a(n.id,e.type??"unknown"),i([e]))}s()}function Wa(e){const{node:t,index:n,renderMode:r,fallback:o}=e,i=Pa(r,t);if(!i)return o();const a=i.renderStaticSVG({node:t,style:t.style??{},key:`${i.id}-${n}`});return null!=a?a:(_a(i.id,t.type??"unknown"),o())}var $a=Object.freeze([]);function Oa(e){if(!e)return $a;let t=!1;for(let n=0;e.length>n;n++){const r=e[n];if(null==r||"object"!=typeof r){t=!0;break}}if(!t)return e;const n=[];for(const t of e)null!=t&&"object"==typeof t&&n.push(t);return n}import{jsx as Ba,jsxs as za}from"react/jsx-runtime";function ja({props:e,store:t,responsiveRef:n,size:r,margin:o,adjustedWidth:i,adjustedHeight:a,resolvedBackground:s,resolvedForeground:c}){const{chartType:l,nodes:u,edges:d,data:h,className:f,description:g,title:p,responsiveWidth:y,responsiveHeight:m,summary:v,background:b,renderMode:x,legend:k,legendPosition:w,legendLayout:S,legendHoverBehavior:A,legendClickBehavior:M,legendHighlightedCategory:C,legendIsolatedCategories:L,layoutSelection:T,annotations:E,onAnnotationActivate:D,annotationObservationCallback:I,onObservation:N,chartId:P,autoPlaceAnnotations:_,svgAnnotationRules:R}=e;if(t){const e=["tree","cluster","treemap","circlepack","partition","orbit"].includes(l),n=e?h||(Array.isArray(d)?void 0:d):void 0;if(e&&n)t.ingestHierarchy(n,[i,a]),t.buildScene([i,a]);else{const e=Oa(u),n=Array.isArray(d)?Oa(d):[];(e.length>0||n.length>0)&&(t.ingestBounded(e,n,[i,a]),t.buildScene([i,a]))}}const W=t?.sceneNodes??[],$=t?.sceneEdges??[],O=t?.labels??[];return za("div",{ref:n,className:"stream-network-frame"+(f?" "+f:""),role:"img","aria-label":g||("string"==typeof p?p:"Network chart"),style:{position:"relative",width:y?"100%":r[0],height:m?"100%":r[1]},children:[Ba(Da,{summary:v}),za("svg",{xmlns:"http://www.w3.org/2000/svg",width:r[0],height:r[1],style:{position:"absolute",left:0,top:0},children:[s&&Ba("g",{transform:`translate(${o.left},${o.top})`,children:s}),za("g",{transform:`translate(${o.left},${o.top})`,children:[b&&Ba("rect",{x:0,y:0,width:i,height:a,fill:b}),$.map((e,t)=>Wa({node:e,index:t,renderMode:x,fallback:()=>function(e,t){switch(e.type){case"line":return na("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 n=e;return na("path",{d:n.pathD,fill:ia(n.style.fill,"#999"),fillOpacity:n.style.fillOpacity,stroke:n.style.stroke||"none",strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-edge-"+t)}case"ribbon":{const n=e;return na("path",{d:n.pathD,fill:ia(n.style.fill,"#999"),fillOpacity:n.style.fillOpacity,stroke:n.style.stroke||"none",strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-edge-"+t)}case"curved":{const n=e;return na("path",{d:n.pathD,fill:ia(n.style.fill,"none"),stroke:n.style.stroke||"#999",strokeWidth:n.style.strokeWidth||1,opacity:n.style.opacity},"net-edge-"+t)}default:return null}}(e,t)})).filter(Boolean),W.map((e,t)=>Wa({node:e,index:t,renderMode:x,fallback:()=>function(e,t){switch(e.type){case"circle":{const n=e,r=si(n.style.fill)?di(n.style.fill,`net-circle-${t}-hatch`):void 0;return ra(ea.Fragment,{children:[r&&na("defs",{children:r}),na("circle",{cx:n.cx,cy:n.cy,r:n.r,fill:r?`url(#net-circle-${t}-hatch)`:ia(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity})]},"net-circle-"+t)}case"rect":{const n=e,r=si(n.style.fill)?di(n.style.fill,`net-rect-${t}-hatch`):void 0;return ra(ea.Fragment,{children:[r&&na("defs",{children:r}),na("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:r?`url(#net-rect-${t}-hatch)`:ia(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity})]},"net-rect-"+t)}case"arc":{const n=e,r=ta().innerRadius(n.innerR).outerRadius(n.outerR).startAngle(n.startAngle+Math.PI/2).endAngle(n.endAngle+Math.PI/2)(oa)||"",o=si(n.style.fill)?di(n.style.fill,`net-arc-${t}-hatch`):void 0;return ra(ea.Fragment,{children:[o&&na("defs",{children:o}),na("path",{d:r,transform:`translate(${n.cx},${n.cy})`,fill:o?`url(#net-arc-${t}-hatch)`:ia(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity})]},"net-arc-"+t)}case"symbol":{const n=e,r=Yi(n.symbolType,n.size,n.path);return na("path",{d:r,transform:n.rotation?`translate(${n.cx},${n.cy}) rotate(${180*n.rotation/Math.PI})`:`translate(${n.cx},${n.cy})`,fill:n.style.fill?ia(n.style.fill):"none",stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-symbol-"+t)}case"glyph":return function(e,t,n,r){const o=e.glyph;if(!o?.parts?.length||0>=e.size)return null;const i=Nn(o,e.size);if(0>=i.scale)return null;const a=`translate(${t},${n})${e.rotation?` rotate(${180*e.rotation/Math.PI})`:""} translate(${i.offsetX},${i.offsetY}) scale(${i.scale})`,s=e.color??("string"==typeof e.style.fill?e.style.fill:void 0),c=$n(o,e.fraction??1,e.fractionStart??0,e.fractionDirection??"horizontal"),l=c?function(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}(r+"-clip"):void 0,u=(e.style.opacity??1)*(e._decayOpacity??1)*(e.style.fillOpacity??1),d=t=>o.parts.map((n,r)=>{const o=t?"none"===n.fill?void 0:t:_n(n.fill,s,e.accent),i=t?n.stroke&&"none"!==n.stroke?t:void 0:_n(n.stroke??"none",s,e.accent);return o||i?na("path",{d:n.d,fill:o??"none",stroke:i,strokeWidth:i?n.strokeWidth??1:void 0,strokeLinecap:n.strokeLinecap,strokeLinejoin:n.strokeLinejoin,opacity:n.opacity},r):null});return ra("g",{transform:a,opacity:1===u?void 0:u,children:[c&&l&&na("clipPath",{id:l,children:na("rect",{x:c.x,y:c.y,width:c.width,height:c.height})}),c&&e.ghostColor?na("g",{children:d(e.ghostColor)}):null,c&&l?na("g",{clipPath:`url(#${l})`,children:d()}):d()]},r)}(e,e.cx,e.cy,"net-glyph-"+(e.id??t));default:return null}}(e,t)})).filter(Boolean),O.map((e,t)=>function(e,t){return na("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)]})]}),Ba(Ui,{width:i,height:a,totalWidth:r[0],totalHeight:r[1],margin:o,labels:O,sceneNodes:W,title:p,legend:k,legendPosition:w,legendLayout:S,legendHoverBehavior:A,legendClickBehavior:M,legendHighlightedCategory:C,legendIsolatedCategories:L,foregroundGraphics:xn(c,Ln(t?.customLayoutOverlays,T??null)),annotations:E,onAnnotationActivate:D,onObservation:I??N,chartId:P,chartType:"StreamNetworkFrame",autoPlaceAnnotations:_,svgAnnotationRules:R,annotationFrame:0}),Ba(Ji,{marks:t?.customLayoutHtmlMarks,margin:o,selection:T??null})]})}import{useEffect as Ha,useLayoutEffect as Fa,useRef as Ya,useState as Xa,useSyncExternalStore as Ga}from"react";var Va="undefined"!=typeof window?Fa:Ha,qa=()=>()=>{},Ua=()=>!1,Ka=()=>!0;function Qa(){const e=Ga(qa,Ua,Ka);return Ya(e).current}import{useEffect as Za,useRef as Ja}from"react";import{jsx as es}from"react/jsx-runtime";function ts({children:e,size:t,margin:n,overflowVisible:r=!1}){return e?es("svg",{style:{position:"absolute",left:0,top:0,width:t[0],height:t[1],pointerEvents:"none",overflow:r?"visible":void 0},children:es("g",{transform:`translate(${n.left},${n.top})`,children:e})}):null}import{useRef as ns}from"react";function rs(e){const t=ns(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return is(e,t);if(!as(e)||!as(t))return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const r of n){if(!Object.prototype.hasOwnProperty.call(t,r))return!1;const n=e[r],o=t[r];if(!Object.is(n,o))if(Array.isArray(n)&&Array.isArray(o)){if(!is(n,o))return!1}else{if(!as(n)||!as(o))return!1;if(!os(n,o))return!1}}return!0}(t.current,e)||(t.current=e),t.current}function os(e,t){const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const r of n){if(!Object.prototype.hasOwnProperty.call(t,r))return!1;if(!Object.is(e[r],t[r]))return!1}return!0}function is(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 as(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}import*as ss from"react";import{jsx as cs,jsxs as ls}from"react/jsx-runtime";function us({componentName:e,message:t,diagnosticHint:n,width:r,height:o}){return cs("div",{role:"alert",style:{width:r,height:Math.max(o,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:ls("div",{style:{textAlign:"center",maxWidth:400},children:[cs("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:e}),cs("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:t}),n&&cs("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:n})]})})}import{jsx as ds}from"react/jsx-runtime";var hs=class extends ss.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:ds(us,{componentName:"ChartErrorBoundary",message:t.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}};import{jsx as fs}from"react/jsx-runtime";function gs({componentName:e,width:t,height:n,children:r}){return fs(hs,{fallback:r=>fs(us,{componentName:e,message:r.message,width:t,height:n}),children:r})}"undefined"!=typeof process&&process;var ps={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"},ys={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function ms(e,t,n,r){return!1===r||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?fs("div",{style:{...ps,width:t,height:n},children:r||"No data available"}):null}function vs(e,t,n,r){if(!e)return null;if(!1===r)return null;if(null!=r)return fs("div",{style:{width:t,height:n,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:r});const o=Math.min(5,Math.floor(n/40)),i=Math.max(8,Math.floor(n/(3*o))),a=Math.max(6,Math.floor(n/(2.5*o))),s=Math.floor((n-(o*(i+a)-a))/2);return fs("div",{style:{width:t,height:n,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:o},(e,n)=>fs("div",{className:"semiotic-loading-bar",style:{...ys,position:"absolute",top:s+n*(i+a),left:Math.floor(.1*t),width:30+(37*n+13)%50+"%",height:i,opacity:.5+n%2*.2}},n))})}function bs(e,t,n,r,o=4e4){return"sync"!==e&&("worker"===e||r*(t+n)>=o)}function xs(){return"undefined"!=typeof window&&"undefined"!=typeof Worker}function ks(){if("undefined"!=typeof DOMException)return new DOMException("Force layout aborted","AbortError");const e=Error("Force layout aborted");return e.name="AbortError",e}var ws=class{constructor(e=function(){const e="string"==typeof import.meta.url&&import.meta.url?new URL("./forceLayoutWorker.js",import.meta.url):function(e){if("undefined"!=typeof __filename){const t=__filename.replace(/\\/g,"/"),n=t.startsWith("/")?t:"/"+t;return new URL("./"+e,"file:"+n)}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,n=t.requestId,r=null!=n?this.pending.get(n):this.pending.values().next().value;if(r){if(null!=n?this.pending.delete(n):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(ks());const n=this.nextRequestId;this.nextRequestId+=1;const r={requestId:n,request:e};return new Promise((e,o)=>{const i=()=>{this.pending.delete(n),t?.removeEventListener("abort",i),o(ks())},a=()=>t?.removeEventListener("abort",i);this.pending.set(n,{cleanup:a,reject:o,resolve:e}),t?.addEventListener("abort",i,{once:!0});try{this.worker.postMessage(r)}catch(e){this.pending.delete(n),a(),o(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()}},Ss=null;function As(e,t){return xs()?t?.aborted?Promise.reject(ks()):(Ss&&!Ss.isDead||(Ss=new ws),Ss).request(e,t):Promise.reject(Error("Web Workers are unavailable"))}import{jsx as Ms,jsxs as Cs}from"react/jsx-runtime";import{jsx as Ls,jsxs as Ts}from"react/jsx-runtime";var Es=/^(value|amount|total|count|weight|score)$/i;function Ds({data:e}){if("edge"===e.nodeOrEdge){const t=e.data;return t?Ts("div",{className:"semiotic-tooltip",style:er,children:[Ts("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&&Ts("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 n=t.__hierarchyNode;if(n){const e=[];let r=n;for(;r;){const n=r.data?.name??r.data?.id??t.id;null!=n&&e.unshift(n+""),r=r.parent}e.length>1&&e.shift();const o=e.length-1;return Ts("div",{className:"semiotic-tooltip",style:er,children:[Ls("div",{children:e.map((e,t)=>Ts("span",{children:[t>0&&Ls("span",{style:{margin:"0 3px",opacity:.5},children:" → "}),t===o?Ls("strong",{children:e}):Ls("span",{style:{opacity:.7},children:e})]},t))}),null!=t.value&&t.value>0&&Ls("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),o=(t.sourceLinks||[]).reduce((e,t)=>e+(t.value||0),0)+(t.targetLinks||[]).reduce((e,t)=>e+(t.value||0),0),i=function(e,t={}){if(!e||"object"!=typeof e)return{entries:[]};const n=t.maxEntries??6,r=!1!==t.skipPositional,o=[];for(const[t,n]of Object.entries(e)){if(t.startsWith("_"))continue;if("data"===t)continue;if(r&&Kn.has(t.toLowerCase()))continue;if(null==n)continue;const e=typeof n;("string"===e||"number"===e||"boolean"===e||n instanceof Date)&&o.push({key:t,lower:t.toLowerCase(),value:n})}if(0===o.length)return{entries:[]};let i=o.findIndex(e=>Vn.includes(e.lower));const a=i>=0;0>i&&(i=o.findIndex(e=>"id"===e.lower)),0>i&&(i=o.findIndex(e=>"string"==typeof e.value));const s=0>i?void 0:o[i];let c=o.filter((e,t)=>t!==i);a&&(c=c.filter(e=>"id"!==e.lower));const l=Qn(c,qn),u=Qn(c,Un),d=new Set(qn),h=new Set(Un),f=[];l&&f.push({key:l.key,value:l.value}),u&&f.push({key:u.key,value:u.value});for(const e of c){if(f.length>=n)break;e!==l&&e!==u&&(d.has(e.lower)||h.has(e.lower)||f.push({key:e.key,value:e.value}))}return{titleKey:s?.key,title:s?.value,entries:f}}(t.data??t),a=null!=i.title?i.title+"":t.id,s=i.entries.some(e=>Es.test(e.key));return Ts("div",{className:"semiotic-tooltip",style:er,children:[Ls("div",{style:{fontWeight:600},children:a}),i.entries.map(e=>{return Ts("div",{style:{marginTop:4,opacity:.8},children:[e.key,": ",(t=e.value,null==t?"–":"number"==typeof t?Math.abs(t)>9999?t.toLocaleString():t+"":t instanceof Date?t.toLocaleDateString():t+"")]},e.key);var t}),!s&&null!=t.value&&t.value>0&&Ts("div",{style:{marginTop:4,opacity:.8},children:["Total:"," ","number"==typeof t.value?t.value.toLocaleString():t.value+""]}),r>0&&Ts("div",{style:{marginTop:4,opacity:.8},children:["Connections: ",r,o!==r&&` (weighted: ${o.toLocaleString()})`]})]})}Ds.ownsChrome=!0;import{curveMonotoneX as Is,curveMonotoneY as Ns,curveCardinal as Ps,curveCatmullRom as _s,curveStep as Rs,curveStepBefore as Ws,curveStepAfter as $s,curveBasis as Os,curveNatural as Bs}from"d3-shape";function zs(e,t,n){if(null==t)return n;if(si(t)){const r=function(e,t){const n="undefined"!=typeof window&&window.devicePixelRatio||1,r=`${ci(e)}@${n}`,o=ui.get(r);if(void 0!==o)return o;const i=function(e={},t){const{background:n="transparent",stroke:r="#000",lineWidth:o=1.5,spacing:i=6,angle:a=45}=e,s=Math.max(8,Math.ceil(2*i));let c;try{c=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(oi||(oi=document.createElement("canvas")),oi.width=e,oi.height=e,oi)}(s)}catch{return null}const l=c.getContext("2d");if(!l)return null;n&&"transparent"!==n?(l.fillStyle=n,l.fillRect(0,0,s,s)):l.clearRect(0,0,s,s),l.strokeStyle=r,l.lineWidth=o,l.lineCap="square";const u=a*Math.PI/180;if(45===a||-45===a){const e=a>0?1:-1;for(let t=-s;2*s>=t;t+=i)l.beginPath(),l.moveTo(t,0),l.lineTo(t+e*s,s),l.stroke()}else{l.save(),l.translate(s/2,s/2),l.rotate(u);const e=2*s;for(let t=-e;e>=t;t+=i)l.beginPath(),l.moveTo(-e,t),l.lineTo(e,t),l.stroke();l.restore()}return(t||l).createPattern(c,"repeat")}({background:e.background,stroke:e.stroke,lineWidth:e.lineWidth,spacing:e.spacing,angle:e.angle},t);return ui.set(r,i),i}(t,e);return r||t.background&&Hr(e,t.background)||n}return"string"!=typeof t?t:Hr(e,t)||n}function js(e){return e._cachedPath2D&&e._cachedPath2DSource===e.pathD||(e._cachedPath2D=new Path2D(e.pathD),e._cachedPath2DSource=e.pathD),e._cachedPath2D}function Hs(e,t){if(!t.pathD)return;e.save();const n=js(t);if(t.style.fill&&"none"!==t.style.fill){const r=t._gradient;if(r){const n=e.createLinearGradient(r.x0,0,r.x1,0),o=t.style.fillOpacity??t.style.opacity??.5,i="string"==typeof t.style.fill?t.style.fill:"#999",a=Hr(e,i)||i;n.addColorStop(0,1===r.from?a:"transparent"),n.addColorStop(1,1===r.to?a:"transparent"),e.fillStyle=n,e.globalAlpha=o}else e.fillStyle=zs(e,t.style.fill,"#007bff"),e.globalAlpha=t.style.fillOpacity??t.style.opacity??.5;e.fill(n)}t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Hr(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??.5,e.globalAlpha=.5*(t.style.opacity??1),e.stroke(n)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.2*t._pulseIntensity,e.fill(n)),e.restore()}function Fs(e,t){e.save();const n=t.style.stroke||"#999";e.strokeStyle=Hr(e,n)||n,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 Ys(e,t){if(!t.pathD)return;e.save();const n=js(t);t.style.fill&&"none"!==t.style.fill&&(e.fillStyle=zs(e,t.style.fill,"#007bff"),e.globalAlpha=t.style.fillOpacity??t.style.opacity??.5,e.fill(n)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Hr(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??.5,e.globalAlpha=.3*(t.style.opacity??1),e.stroke(n)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.25*t._pulseIntensity,e.fill(n)),e.restore()}function Xs(e,t){if(!t.pathD)return;e.save();const n=js(t),r=t.style.stroke||"#999";e.strokeStyle=Hr(e,r)||r,e.lineWidth=t.style.strokeWidth??1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.stroke(n),t.style.fill&&"none"!==t.style.fill&&(e.fillStyle=zs(e,t.style.fill,"#007bff"),e.globalAlpha=t.style.fillOpacity??.1,e.fill(n)),e.restore()}function Gs(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Vs(e,t,n=.3){Gs(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 qs(e,t,n=.6){if(!Gs(t))return;const r=t.r+(t._pulseGlowRadius??4)*t._pulseIntensity,o=t.cx??t.x??0,i=t.cy??t.y??0;e.beginPath(),e.arc(o,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*n,e.stroke()}var Us=new Map;function Ks(e){try{if(e.path)return new Path2D(e.path);const t=`${e.symbolType??"circle"}:${Math.round(e.size)}`;let n=Us.get(t);return n||(n=new Path2D(Yi(e.symbolType,e.size)),Us.size>256&&Us.clear(),Us.set(t,n)),n}catch{return null}}function Qs(e,t,n,r,o){if(0>=t.size)return;const i=t.glyph;if(!i||!i.parts?.length)return;const a=Nn(i,t.size);if(0>=a.scale)return;const s=(t.style.opacity??1)*(t._decayOpacity??1);if(0>=s)return;const c=t=>{const n=zs(e,t,t);return"string"==typeof n?n:t},l=t.color??("string"==typeof t.style.fill?t.style.fill:void 0);e.save(),e.translate(n,r),t.rotation&&e.rotate(t.rotation),e.translate(a.offsetX,a.offsetY),e.scale(a.scale,a.scale),e.globalAlpha=o*s*(t.style.fillOpacity??1);const u=$n(i,t.fraction??1,t.fractionStart??0,t.fractionDirection??"horizontal");u&&t.ghostColor&&Bn(e,i,l,t.accent,t.ghostColor,c),u&&(e.beginPath(),e.rect(u.x,u.y,u.width,u.height),e.clip()),Bn(e,i,l,t.accent,void 0,c),e.restore()}function Zs(e){const{canvas:t,store:n,sceneRevisionDiagnostics:r,size:o,margin:i,adjustedWidth:a,adjustedHeight:s,background:c,renderMode:l,hasBackgroundGraphics:u=!1,dirtyRef:d,lastFrameTimeRef:h,now:f,random:g,reducedMotion:p,showParticles:y,isContinuous:m,animate:v,decay:b,pulse:x,thresholds:k,staleness:w,particleStyle:S,getParticleColor:A,pendingAnnotationFrameRef:M,lastAnnotationFrameTimeRef:C,setAnnotationFrame:L,scheduleNextFrame:T}=e,E=t.getContext("2d");if(!E)return;const D=h.current?Math.min((f-h.current)/1e3,.1):.016;h.current=f;const I=n.advanceTransition(p?f+1e6:f),N=!p&&I,P=!p&&n.tickAnimation([a,s],D),_=d.current,R=r?.beforeCompute(n.getLastUpdateResult(),N),W=I||_||P;W&&n.buildScene([a,s]),R&&r?.afterCompute(R,W,!1);const $=y&&!p&&!!n.particlePool,O=!!((B={dirtyOrRebuilt:_,transitioning:N,animationTicked:P,continuous:$||m,liveEncoding:!!b||!!x||!!k||!1!==v&&n.hasActiveTopologyDiff||n.hasActivePulses||n.hasActiveThresholds,forced:n.consumeStylePaintPending()}).dirtyOrRebuilt||B.transitioning||B.animationTicked||B.continuous||B.liveEncoding||B.forced);var B;const z=!!w&&n.lastIngestTime>0&&f-n.lastIngestTime>(w?.threshold??5e3);if(O){const e=function(){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))}();if(!function(e,t,n,r){const o=e.getContext("2d");if(!o)return null;const i=Math.round(t[0]*r),a=Math.round(t[1]*r),s=i/t[0],c=a/t[1],l=t[0]+"px",u=t[1]+"px";return e.style.width!==l&&(e.style.width=l),e.style.height!==u&&(e.style.height=u),e.width===i&&e.height===a||(e.width=i,e.height=a),o.setTransform(s,0,0,c,0,0),o.translate(n.left,n.top),o}(t,o,i,e))return;if(E.clearRect(-i.left,-i.top,o[0],o[1]),function(e,t){const{background:n,hasBackgroundGraphics:r=!1,themeBackground:o="",x:i=0,y:a=0,width:s,height:c}=t;if("transparent"===n)return!1;if(r)return!1;const l=n||(o&&"transparent"!==o?o:"")||null;if(!l)return!1;const u=Hr(e,l);u&&(e.fillStyle=u,e.fillRect(i,a,s,c))}(E,{background:c,hasBackgroundGraphics:u,width:a,height:s}),b&&n.applyDecay(),x&&n.applyPulse(f),k&&n.applyThresholds(f),!1!==v&&n.applyTopologyDiff(f),z&&(E.globalAlpha=w?.dimOpacity??.5),Ra({context:E,nodes:n.sceneEdges,renderMode:l,pixelRatio:e,paintBuiltIn:e=>function(e,t){for(const n of t)switch(n.type){case"bezier":Hs(e,n);break;case"line":Fs(e,n);break;case"ribbon":Ys(e,n);break;case"curved":Xs(e,n)}}(E,e)}),Ra({context:E,nodes:n.sceneNodes,renderMode:l,pixelRatio:e,paintBuiltIn:e=>{const t=e;!function(e,t){for(const n of t){if("rect"!==n.type)continue;const t=n;t.w>0&&t.h>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.fill&&(e.fillStyle=zs(e,t.style.fill,"#007bff"),void 0!==t.style.fillOpacity&&(e.globalAlpha=(t.style.opacity??1)*t.style.fillOpacity),e.fillRect(t.x,t.y,t.w,t.h)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Hr(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)),Vs(e,t),e.restore())}}(E,t),function(e,t){for(const n of t){if("circle"!==n.type)continue;const t=n;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=zs(e,t.style.fill,"#007bff"),void 0!==t.style.fillOpacity&&(e.globalAlpha=(t.style.opacity??1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Hr(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??1,e.globalAlpha=t.style.opacity??1,e.stroke()),qs(e,t),e.restore())}}(E,t),function(e,t){for(const n of t){if("arc"!==n.type)continue;const t=n;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=zs(e,t.style.fill,"#007bff"),void 0!==t.style.fillOpacity&&(e.globalAlpha=(t.style.opacity??1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Hr(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??1,e.globalAlpha=t.style.opacity??1,e.stroke()),e.restore()}}(E,t),function(e,t){const n=e.globalAlpha;for(const r of t){if("symbol"!==r.type)continue;const t=r;if(0>=t.size)continue;const o=Ks(t);if(!o)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=n*i*(t.style.fillOpacity??1),e.fillStyle=zs(e,t.style.fill,"#007bff"),e.fill(o)),t.style.stroke&&"none"!==t.style.stroke&&(e.globalAlpha=n*i,e.strokeStyle=Hr(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??1,e.stroke(o)),e.restore()}}(E,t),function(e,t){const n=e.globalAlpha;for(const r of t)"glyph"===r.type&&Qs(e,r,r.cx,r.cy,n);e.globalAlpha=n}(E,t)}}),$&&!z){const e=n.edgesArray;if(e.length>0){!function(e,t,n,r,o=Math.random){const i=r.spawnRate??.1,a=r.maxPerEdge??50;for(let r=0;t.length>r;r++){const s=t[r];if(!s.bezier)continue;if(e.countForEdge(r)>=a)continue;const c=s.value*i*n*(s.bezier.circular?.3:1),l=Math.floor(c),u=c-l;let d=l;o()<u&&d++;for(let t=0;d>t&&e.countForEdge(r)<a;t++)e.spawn(r,o)}}(n.particlePool,e,D,S,g);const t=.5*(S.speedMultiplier??1);let r;if(S.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)}n.particlePool.step(D,t,e,r),function(e,t,n,r,o){const i=r.radius??3;e.globalAlpha=r.opacity??.7;for(let a=0;t.particles.length>a;a++){const s=t.particles[a];if(!s.active)continue;const c=n[s.edgeIndex];if(!c)continue;let l;l="string"==typeof r.color&&"inherit"!==r.color?r.color:o(c),e.fillStyle=Hr(e,l)||l,e.beginPath(),e.arc(s.x,s.y,i,0,2*Math.PI),e.fill()}e.globalAlpha=1}(E,n.particlePool,e,S,A)}}z&&(E.globalAlpha=1)}d.current=!1,(_||N||P)&&t.setAttribute("aria-label",ya(n.sceneNodes?.length??0,n.sceneEdges?.length??0,"Network chart"));const j=_||N||P||M.current;j&&f-C.current>=33?(L(e=>e+1),C.current=f,M.current=!1):M.current=!!j,(m||N||null!=n.transition||P||n.hasActivePulses||n.hasActiveThresholds||!1!==v&&n.hasActiveTopologyDiff||M.current)&&T()}function Js(e){const{sceneNodes:t,nodes:n,nodeColorMap:r,colorScheme:o}=e;for(const e of t)e.id&&"string"==typeof e.style?.fill&&r.set(e.id,e.style.fill);const i=Array.isArray(o)?o:Qt,a=Array.from(n);for(let e=0;a.length>e;e++){const t=a[e];r.has(t.id)||r.set(t.id,i[e%i.length])}return a.length}function ec(e,t=30){return Math.max((e??4)+5,12,t)}function tc(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function nc(e,t,n,r=30){switch(e.type){case"circle":return function(e,t,n,r=30){const o=t-e.cx,i=n-e.cy,a=Math.sqrt(o*o+i*i);return a>ec(e.r,r)?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:a}}(e,t,n,r);case"rect":return function(e,t,n){const r=function(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}}(t,n,e);return r.hit?{type:"node",datum:e.datum,x:r.cx,y:r.cy,distance:0}:null}(e,t,n);case"arc":return function(e,t,n){const r=t-e.cx,o=n-e.cy,i=Math.sqrt(r*r+o*o);if(e.innerR-2>i||i>e.outerR+2)return null;const a=tc(Math.atan2(o,r)),s=tc(e.startAngle),c=tc(e.endAngle);if(s>c?a>=s||c>=a:a>=s&&c>=a){const t=(e.startAngle+e.endAngle)/2,n=(e.innerR+e.outerR)/2;return{type:"node",datum:e.datum,x:e.cx+n*Math.cos(t),y:e.cy+n*Math.sin(t),distance:0}}return null}(e,t,n);case"symbol":return function(e,t,n,r=30){const o=t-e.cx,i=n-e.cy,a=Math.sqrt(o*o+i*i);return a>ec(Xi(e.size),r)?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:a}}(e,t,n,r);case"glyph":return function(e,t,n,r=30){if(null==e.datum)return null;const o=On(e.glyph,e.size),i=e.cx+o.centerDx,a=e.cy+o.centerDy,s=t-i,c=n-a,l=Math.sqrt(s*s+c*c);return l>ec(o.radius,r)?null:{type:"node",datum:e.datum,x:i,y:a,distance:l}}(e,t,n,r);default:return null}}var rc=null,oc=null;function ic(){return oc||((rc=document.createElement("canvas")).width=1,rc.height=1,oc=rc.getContext("2d")),oc}function ac(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 sc(e,t,n){switch(e.type){case"bezier":return function(e,t,n){if(!e.pathD)return null;const r=ac(e),o=ic();if(!r||!o)return null;try{if(o.isPointInPath(r,t,n))return{type:"edge",datum:e.datum,x:t,y:n,distance:0};const i=o.lineWidth;o.lineWidth=10;const a=o.isPointInStroke(r,t,n);if(o.lineWidth=i,a)return{type:"edge",datum:e.datum,x:t,y:n,distance:4}}catch{}return null}(e,t,n);case"line":return function(e,t,n){const r=e.x2-e.x1,o=e.y2-e.y1,i=r*r+o*o;if(0===i)return null;let a=((t-e.x1)*r+(n-e.y1)*o)/i;a=Math.max(0,Math.min(1,a));const s=e.x1+a*r,c=e.y1+a*o,l=Math.sqrt((t-s)**2+(n-c)**2);return l>5?null:{type:"edge",datum:e.datum,x:s,y:c,distance:l}}(e,t,n);case"ribbon":case"curved":return function(e,t,n){if(!e.pathD)return null;const r=ac(e),o=ic();if(!r||!o)return null;try{if(o.isPointInPath(r,t,n))return{type:"edge",datum:e.datum,x:t,y:n,distance:0};const i=o.lineWidth;o.lineWidth=10;const a=o.isPointInStroke(r,t,n);if(o.lineWidth=i,a)return{type:"edge",datum:e.datum,x:t,y:n,distance:4}}catch{}return null}(e,t,n);default:return null}}function cc(e){const{clientX:t,clientY:n,canvasRect:r,margin:o,adjustedWidth:i,adjustedHeight:a,sceneNodes:s,sceneEdges:c,nodeQuadtree:u,maxNodeRadius:d,hitRadius:h=30}=e,f=t-r.left-o.left,g=n-r.top-o.top;if(0>f||f>i||0>g||g>a)return{kind:"miss-outside"};const p=function(e,t,n,r,o=30,i,a=0){let s=null,c=o,l=1/0;if(i){const e=function(e,t,n,r,o,i=e=>e.x,a=e=>e.y,s=e=>e.r){const c=Math.max(r,o+5,12),l=t-c,u=t+c,d=n-c,h=n+c;let f=null,g=1/0;return e.visit((e,o,c,p,y)=>{if(o>u||l>p||c>h||d>y)return!0;if(!e.length){let o=e;do{const e=o.data,c=i(e)-t,l=a(e)-n,u=Math.sqrt(c*c+l*l);ec(s(e),r)>=u&&g>u&&(f=e,g=u),o=o.next}while(o)}return!1}),f?{node:f,distance:g}:null}(i,n,r,o,a,e=>e.cx,e=>e.cy,e=>e.r);e&&(s={type:"node",datum:e.node.datum,x:e.node.cx,y:e.node.cy,distance:e.distance},c=e.distance)}for(const t of e){if(i&&"circle"===t.type)continue;const e=nc(t,n,r,o);if(e)if("rect"===t.type){const n=t.w*t.h;l>n&&(s=e,l=n)}else c>e.distance&&(s=e,c=e.distance)}if(s)return s;for(const e of t){if(!1===e.interactive)continue;const t=sc(e,n,r);t&&c>t.distance&&(s=t,c=t.distance)}return s}(s,c,f,g,h,u,d);return p?{kind:"hit",hover:l(p.datum||{},p.x,p.y,{nodeOrEdge:p.type})}:{kind:"miss"}}function lc(e){const{onObservation:t,datum:n,x:r=0,y:o=0,chartType:i,chartId:a,context:s,timestamp:c=Date.now()}=e;t&&(n?(t({type:"hover",datum:n,x:r,y:o,timestamp:c,chartType:i,chartId:a}),"focus"===s?.type&&t({type:"focus",datum:n,inputType:"touch"===s.inputType?"pointer":s.inputType,timestamp:c,chartType:i,chartId:a})):t({type:"hover-end",timestamp:c,chartType:i,chartId:a}))}function uc(e){const{onObservation:t,datum:n,x:r=0,y:o=0,chartType:i,chartId:a,context:s,timestamp:c=Date.now()}=e;t&&(n?(t({type:"click",datum:n,x:r,y:o,timestamp:c,chartType:i,chartId:a}),"activate"===s?.type&&t({type:"activate",datum:n,inputType:s.inputType,timestamp:c,chartType:i,chartId:a})):t({type:"click-end",timestamp:c,chartType:i,chartId:a}))}import{useCallback as dc}from"react";var hc="StreamNetworkFrame";import{jsx as fc,jsxs as gc}from"react/jsx-runtime";var pc={top:20,right:80,bottom:20,left:80},yc={top:40,right:40,bottom:40,left:40},mc=new Set(["chord","force","circlepack","orbit"]),vc=[800,600],bc=s(a(function(a,s){const{chartType:c,nodes:h,edges:f,data:g,initialEdges:p,nodeIDAccessor:y="id",sourceAccessor:m="source",targetAccessor:v="target",valueAccessor:b="value",edgeIdAccessor:x,childrenAccessor:k,hierarchySum:w,orientation:S="horizontal",nodeAlign:A="justify",nodePaddingRatio:M=.05,nodeWidth:C=15,iterations:L=300,forceStrength:T=.1,layoutExecution:E="auto",layoutLoadingContent:D,onLayoutStateChange:I,padAngle:N=.01,groupWidth:P=20,sortGroups:_,edgeSort:R,treeOrientation:W="vertical",edgeType:$="curve",padding:O,paddingTop:B,tensionConfig:z,showParticles:j=!1,particleStyle:H,renderMode:F,nodeStyle:Y,edgeStyle:X,colorBy:G,colorScheme:V="category10",edgeColorBy:q="source",edgeOpacity:U=.5,colorByDepth:K=!1,nodeSize:Q=8,nodeSizeRange:Z=[5,20],nodeLabel:J,showLabels:ee=!0,labelMode:te,size:ne=vc,responsiveWidth:re,responsiveHeight:oe,margin:ie,className:ae,background:se,enableHover:ce=!0,tooltipContent:le,customHoverBehavior:ue,customClickBehavior:de,onObservation:he,annotationObservationCallback:fe,chartId:ge,onTopologyChange:pe,annotations:ye,onAnnotationActivate:me,autoPlaceAnnotations:ve,svgAnnotationRules:be,legend:xe,legendPosition:ke,legendLayout:we,legendHoverBehavior:Se,legendClickBehavior:Ae,legendHighlightedCategory:Me,legendIsolatedCategories:Ce,title:Le,foregroundGraphics:Te,backgroundGraphics:Ee,decay:De,pulse:Ie,transition:Ne,animate:Pe,staleness:_e,frameScheduler:Re,clock:We,random:$e,seed:Oe,paused:Be=!1,suspendWhenHidden:ze=!0,thresholds:je,accessibleTable:He=!0,description:Fe,summary:Ye,orbitMode:Xe,orbitSize:Ve,orbitSpeed:qe,orbitRevolution:Ue,orbitRevolutionStyle:Ke,orbitEccentricity:Qe,orbitShowRings:Ze,orbitAnimated:Je,customNetworkLayout:et,onLayoutError:tt,layoutConfig:nt,layoutSelection:rt}=a,ot=mc.has(c)?yc:pc,it=e(!0),at=Gr({sizeProp:ne,responsiveWidth:re,responsiveHeight:oe,userMargin:ie,marginDefault:ot,title:Le,legend:xe,legendPosition:ke,foregroundGraphics:Te,backgroundGraphics:Ee,animate:Pe,transitionProp:Ne,frameScheduler:Re,clock:We,random:$e,seed:Oe,paused:Be,suspendWhenHidden:ze,themeDirtyRef:it}),{reducedMotionRef:st,responsiveRef:ct,size:lt,margin:ut,adjustedWidth:dt,adjustedHeight:ht,resolvedForeground:ft,resolvedBackground:gt,transition:pt,introEnabled:yt,tableId:mt,rafRef:vt,renderFnRef:bt,scheduleRender:xt,frameRuntime:kt,currentTheme:wt}=at,St=function(){const[e,t]=Xa(!1);return Va(()=>{t(!0)},[]),e}(),At=Qa(),Mt=r(()=>Oa(h),[h]),Ct=r(()=>Array.isArray(f)?Oa(f):f,[f]),Lt=r(()=>({...u,...z}),[z]),Tt=r(()=>({...d,...H}),[H]),Et=r(()=>{return{chartType:(e={chartType:c,clock:kt.now,random:$e,seed:Oe,nodeIDAccessor:y,sourceAccessor:m,targetAccessor:v,valueAccessor:b,edgeIdAccessor:x,childrenAccessor:k,hierarchySum:w,orientation:S,nodeAlign:A,nodePaddingRatio:M,nodeWidth:C,iterations:L,forceStrength:T,padAngle:N,groupWidth:P,sortGroups:_,edgeSort:R,treeOrientation:W,edgeType:$,padding:O,paddingTop:B,tensionConfig:Lt,showParticles:j,particleStyle:Tt,nodeStyle:Y,edgeStyle:X,nodeLabel:J,showLabels:ee,labelMode:te,colorBy:G,colorScheme:V,edgeColorBy:q,edgeOpacity:U,colorByDepth:K,nodeSize:Q,nodeSizeRange:Z,decay:De,pulse:Ie,transition:pt,introAnimation:yt,staleness:_e,thresholds:je,orbitMode:Xe,orbitSize:Ve,orbitSpeed:qe,orbitRevolution:Ue,orbitRevolutionStyle:Ke,orbitEccentricity:Qe,orbitShowRings:Ze,orbitAnimated:Je,customNetworkLayout:et,onLayoutError:tt,layoutConfig:nt,currentTheme:wt}).chartType,clock:e.clock,random:e.random,seed:e.seed,nodeIDAccessor:e.nodeIDAccessor,sourceAccessor:e.sourceAccessor,targetAccessor:e.targetAccessor,valueAccessor:e.valueAccessor,edgeIdAccessor:e.edgeIdAccessor,childrenAccessor:e.childrenAccessor,hierarchySum:e.hierarchySum,orientation:e.orientation,nodeAlign:e.nodeAlign,nodePaddingRatio:e.nodePaddingRatio,nodeWidth:e.nodeWidth,iterations:e.iterations,forceStrength:e.forceStrength,padAngle:e.padAngle,groupWidth:e.groupWidth,sortGroups:e.sortGroups,edgeSort:e.edgeSort,treeOrientation:e.treeOrientation,edgeType:e.edgeType,padding:e.padding,paddingTop:e.paddingTop,tensionConfig:e.tensionConfig,showParticles:e.showParticles,particleStyle:e.particleStyle,nodeStyle:e.nodeStyle,edgeStyle:e.edgeStyle,nodeLabel:e.nodeLabel,showLabels:e.showLabels,labelMode:e.labelMode,colorBy:e.colorBy,colorScheme:e.colorScheme,themeCategorical:e.currentTheme?.colors?.categorical,themeSemantic:wr(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},[c,kt.now,$e,Oe,y,m,v,b,x,k,w,S,A,M,C,L,T,N,P,_,R,W,$,O,B,Lt,j,Tt,Y,X,J,ee,te,G,V,q,U,K,Q,Z,De,Ie,pt,yt,_e,je,Xe,Ve,qe,Ue,Ke,Qe,Ze,Je,et,tt,nt,wt]),Dt=rs(Et),It=rs({chartType:(Nt={chartType:c,nodeIDAccessor:y,sourceAccessor:m,targetAccessor:v,valueAccessor:b,edgeIdAccessor:x,childrenAccessor:k,hierarchySum:w,orientation:S,nodeAlign:A,nodePaddingRatio:M,nodeWidth:C,iterations:L,forceStrength:T,padAngle:N,groupWidth:P,sortGroups:_,edgeSort:R,treeOrientation:W,edgeType:$,padding:O,paddingTop:B,random:$e,seed:Oe,tensionConfig:Lt,customNetworkLayout:et,orbitMode:Xe,orbitSize:Ve,orbitEccentricity:Qe}).chartType,nodeIDAccessor:Nt.nodeIDAccessor,sourceAccessor:Nt.sourceAccessor,targetAccessor:Nt.targetAccessor,valueAccessor:Nt.valueAccessor,edgeIdAccessor:Nt.edgeIdAccessor,childrenAccessor:Nt.childrenAccessor,hierarchySum:Nt.hierarchySum,orientation:Nt.orientation,nodeAlign:Nt.nodeAlign,nodePaddingRatio:Nt.nodePaddingRatio,nodeWidth:Nt.nodeWidth,iterations:Nt.iterations,forceStrength:Nt.forceStrength,padAngle:Nt.padAngle,groupWidth:Nt.groupWidth,sortGroups:Nt.sortGroups,edgeSort:Nt.edgeSort,treeOrientation:Nt.treeOrientation,edgeType:Nt.edgeType,padding:Nt.padding,paddingTop:Nt.paddingTop,random:Nt.random,seed:Nt.seed,tensionConfig:Nt.tensionConfig,customNetworkLayout:Nt.customNetworkLayout,orbitMode:Nt.orbitMode,orbitSize:Nt.orbitSize,orbitEccentricity:Nt.orbitEccentricity});var Nt;const Pt=e(0),_t=e(0),Rt=e(!1),Wt=e(null);Wt.current||(Wt.current=new cn(Dt));const $t=dn(new mn("StreamNetworkFrame")),Ot=o((e,t,n=!1)=>function(e,t,n,r=!1,o=!1){const i=e.beforeCompute(t.getLastUpdateResult(),r);n(),e.afterCompute(i,!0,o)}($t.current,e,()=>e.buildScene(t),n),[$t]),[Bt,zt]=t(null),[jt,Ht]=t(0),[Ft,Yt]=t(0),[Xt,Gt]=t(!1),[Vt,qt]=t(!1),Ut=e(0),Kt=e(null),Zt=e(!1),Jt=e(I);Jt.current=I;const en=e(Dt);en.current=Dt;const tn=e(null),nn=e(new Map),rn=e(0),on=o(e=>function(e){const{node:t,colorBy:n,colorScheme:r,nodeColorMap:o,colorIndexRef:i}=e;if("function"==typeof n)return n(t)+"";if("string"==typeof n&&t.data){const e=t.data[n];if(void 0!==e){if(!o.has(e+"")){const t=Array.isArray(r)?r:Qt;o.set(e+"",t[i.current++%t.length])}return o.get(e+"")}}if(o.has(t.id))return o.get(t.id);const a=Array.isArray(r)?r:Qt,s=n?a[i.current++%a.length]:a[0];return o.set(t.id,s),s}({node:e,colorBy:G,colorScheme:V,nodeColorMap:nn.current,colorIndexRef:rn}),[G,V]),an=(sn=wt,sn?.colors?.border||sn?.colors?.secondary||sn?.colors?.primary||"#999");var sn;const ln=o(e=>function(e,t){return e?"object"==typeof e?e:t?.get(e)??null:null}(e,Wt.current?.nodes),[]),un=o(e=>function(e){const{edge:t,edgeColorBy:n,getNodeColor:r,resolveEndpoint:o,fallback:i}=e;if("function"==typeof n)return n(t);const a=o(t.source),s=o(t.target);return"target"===n&&s?r(s):a?r(a):i}({edge:e,edgeColorBy:q,getNodeColor:on,resolveEndpoint:ln,fallback:an}),[q,on,an,ln]),hn=o(e=>function(e){const{edge:t,particleStyleColor:n,particleColorBy:r,hasExplicitParticleColorBy:o,getEdgeColor:i,getNodeColor:a,resolveEndpoint:s,fallback:c}=e;if("function"==typeof n){const e=s(t.source);return e?n(t,e):c}if(!o)return i(t);const l=r,u=s(t.source),d=s(t.target);return"target"===l&&d?a(d):u?a(u):c}({edge:e,particleStyleColor:Tt.color,particleColorBy:Tt.colorBy,hasExplicitParticleColorBy:!!H?.colorBy,getEdgeColor:un,getNodeColor:on,resolveEndpoint:ln,fallback:an}),[H?.colorBy,Tt.color,Tt.colorBy,on,un,an,ln]),fn=function(e,t,n,r,o){return("sankey"===e||t)&&n||r||o}(c,!!et,j,!!Ie,Wt.current?.isAnimating??!1);!function(e,t,n,r){Tn(()=>{e.current?.updateConfig(t),n.current=!0,r()},[t,r,e,n])}(Wt,Dt,it,xt),function(e,t,n,r){const o=En(null);Tn(()=>{const i=e.current;if(!i)return;const a=t??null;o.current!==a&&(o.current=a,i.setLayoutSelection(a),i.hasCustomRestyle?i.restyleScene(a):n.current=!0,r())},[t,r,e,n])}(Wt,rt,it,xt),n(()=>{const e=Wt.current;e&&(Ot(e,[dt,ht]),rn.current=Js({sceneNodes:e.sceneNodes,nodes:e.nodes.values(),nodeColorMap:nn.current,colorScheme:V}),it.current=!0,xt())},[wt,dt,ht,Ot,xt,V]);const gn=o(()=>{const e=Wt.current;if(e&&(e.runLayout([dt,ht]),Ot(e,[dt,ht]),it.current=!0,rn.current=Js({sceneNodes:e.sceneNodes,nodes:e.nodes.values(),nodeColorMap:nn.current,colorScheme:V}),Ht(e.layoutVersion),pe)){const{nodes:t,edges:n}=e.getLayoutData();pe(t,n)}},[dt,ht,Ot,pe,V]),pn=o(e=>{if(null==e||"object"!=typeof e)return;const t=Wt.current;t&&(t.ingestEdge(e)&&gn(),xt())},[gn,xt]),yn=o(e=>{const t=Wt.current;if(!t)return;let n=!1;for(const r of e)null!=r&&"object"==typeof r&&t.ingestEdge(r)&&(n=!0);n&&gn(),xt()},[gn,xt]),bn=o(()=>{Wt.current?.clear(),nn.current.clear(),rn.current=0,Ht(Wt.current?.layoutVersion??0),zt(null),tn.current=null,it.current=!0,xt()},[xt]),kn=o(()=>{const e=Wt.current;e&&(e.tension+=999,gn(),xt())},[gn,xt]);i(s,()=>({push:pn,pushMany:yn,removeNode:e=>{const t=Wt.current?.removeNode(e)??!1;if(t){const t=tn.current?.data?"function"==typeof y?y(tn.current.data):tn.current.data[y]:void 0;tn.current&&"node"===tn.current.nodeOrEdge&&t===e&&(tn.current=null,zt(null)),nn.current.delete(e),gn(),it.current=!0,xt()}return t},removeEdge:(e,t)=>{const n=Wt.current?.removeEdge(e,t)??!1;if(n){if(tn.current&&"edge"===tn.current.nodeOrEdge){const n=tn.current.data;let r;r=void 0!==t?("object"==typeof n?.source?n.source.id:n?.source)===e&&("object"==typeof n?.target?n.target.id:n?.target)===t:!x||!n||("function"==typeof x?x:e=>e?.[x])(n)===e,r&&(tn.current=null,zt(null))}gn(),it.current=!0,xt()}return n},updateNode:(e,t)=>{const n=Wt.current?.updateNode(e,t)??null;return n&&(it.current=!0,xt()),n},updateEdge:(e,t,n)=>{const r=Wt.current?.updateEdge(e,t,n)??[];return r.length>0&&(gn(),it.current=!0,xt()),r},clear:bn,getTopology:()=>Wt.current?.getLayoutData()??{nodes:[],edges:[]},getCustomLayout:()=>Wt.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>Wt.current?.lastCustomLayoutFailure??null,getTopologyDiff:()=>{const e=Wt.current;return e?{addedNodes:Array.from(e.addedNodes),removedNodes:Array.from(e.removedNodes),addedEdges:Array.from(e.addedEdges),removedEdges:Array.from(e.removedEdges)}:{addedNodes:[],removedNodes:[],addedEdges:[],removedEdges:[]}},relayout:kn,getTension:()=>Wt.current?.tension??0}),[pn,yn,bn,kn,y,gn,xt,x]);const wn=["tree","cluster","treemap","circlepack","partition","orbit"].includes(c),Sn=wn?g||(Array.isArray(f)?void 0:f):void 0;n(()=>{const e=Wt.current;if(!e)return;const t=++Ut.current;if(Kt.current?.abort(),Kt.current=null,wn&&Sn)e.ingestHierarchy(Sn,[dt,ht]),Ot(e,[dt,ht]),qt(!1),Jt.current?.("ready"),it.current=!0,xt();else{const n=Mt,r=Array.isArray(Ct)?Ct:[];if(0===n.length&&0===r.length)return null==h&&null==f||0>=e.nodes.size&&0>=e.edges.size||bn(),qt(!1),void Jt.current?.("ready");const o=[dt,ht],i="force"===c&&!et&&xs()&&!$e&&bs(E,n.length,r.length,L);if(i&&At&&!Zt.current&&e.sceneNodes.length>0)return Zt.current=!0,qt(!1),Jt.current?.("ready"),it.current=!0,void xt();if(i){const i=new AbortController;Kt.current=i;const a=e._lastPositionSnapshot;e.ingestBounded(n,r,o,{deferLayout:!0});const s=e.getLayoutData(),c=function(e,t,n,r,o){const i=Ge(n.nodeSize,n.nodeSizeRange,e);return{kind:"frame",nodes:e.map(e=>{const t=o?.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,n="string"==typeof e.target?e.target:e.target.id,r=e.data?.weight,o="number"==typeof r&&Number.isFinite(r)?r:e.value;return{source:t,target:n,value:e.value,y0:0,y1:0,sankeyWidth:0,weight:o}}),config:{chartType:"force",iterations:n.iterations,forceStrength:n.forceStrength,seed:n.seed},size:r}}(s.nodes,s.edges,en.current,o,a);return qt(!0),Jt.current?.("pending"),As(c,i.signal).then(({positions:n})=>{t===Ut.current&&(e.applyForceLayoutPositions(n,o),Ot(e,o),rn.current=Js({sceneNodes:e.sceneNodes,nodes:e.nodes.values(),nodeColorMap:nn.current,colorScheme:V}),qt(!1),Jt.current?.("ready"),Ht(e.layoutVersion),it.current=!0,xt())}).catch(n=>{"AbortError"!==n.name&&t===Ut.current&&(e.runLayout(o),Ot(e,o),rn.current=Js({sceneNodes:e.sceneNodes,nodes:e.nodes.values(),nodeColorMap:nn.current,colorScheme:V}),qt(!1),Jt.current?.("error"),Ht(e.layoutVersion),it.current=!0,xt())}),()=>i.abort()}e.ingestBounded(n,r,o),Ot(e,o),qt(!1),Jt.current?.("ready"),rn.current=Js({sceneNodes:e.sceneNodes,nodes:e.nodes.values(),nodeColorMap:nn.current,colorScheme:V}),it.current=!0,xt()}},[Mt,Ct,h,f,g,Sn,wn,dt,ht,It,E,L,At,c,et,$e,xt,bn,V,Ot]),n(()=>{p&&p.length>0&&yn(p)},[p,yn]);const{customHoverBehavior:An,customClickBehavior:Mn}=function({customHoverBehavior:e,customClickBehavior:t,onObservation:n,chartId:r}){return{customHoverBehavior:dc((t,o)=>{e?.(t,o),lc({onObservation:n,datum:t?t.data||t:null,x:t?.x,y:t?.y,chartType:hc,chartId:r,context:o})},[e,n,r]),customClickBehavior:dc((e,o)=>{t?.(e,o),uc({onObservation:n,datum:e?e.data||e:null,x:e?.x,y:e?.y,chartType:hc,chartId:r,context:o})},[t,n,r])}}({customHoverBehavior:ue,customClickBehavior:de,onObservation:he,chartId:ge}),{hoverHandlerRef:Cn,hoverLeaveRef:Dn,onPointerMove:In,onPointerLeave:Nn}=at,Pn=()=>!et||(Wt.current?.hasCustomRestyle??!1);Cn.current=e=>{if(!ce)return;const t=Pn(),n=Yn.current;if(!n)return;const r=Wt.current;if(!r)return;const o=cc({clientX:e.clientX,clientY:e.clientY,canvasRect:n.getBoundingClientRect(),margin:ut,adjustedWidth:dt,adjustedHeight:ht,sceneNodes:r.sceneNodes,sceneEdges:r.sceneEdges,nodeQuadtree:r.nodeQuadtree,maxNodeRadius:r.maxNodeRadius});"hit"===o.kind?(tn.current=o.hover,zt(o.hover),An&&(An(o.hover),t&&(it.current=!0)),t&&xt()):tn.current&&(tn.current=null,zt(null),An&&(An(null),t&&(it.current=!0)),t&&xt())},Dn.current=()=>{if(tn.current){const e=Pn();tn.current=null,zt(null),An&&(An(null),e&&(it.current=!0)),e&&xt()}};const _n=e(()=>{});_n.current=e=>{if((t=e.target)instanceof Element&&null!=t.closest("[data-semiotic-annotation-widget]"))return;var t;if(!de&&!he)return;const n=Yn.current;if(!n)return;const r=Wt.current;if(!r)return;const o=cc({clientX:e.clientX,clientY:e.clientY,canvasRect:n.getBoundingClientRect(),margin:ut,adjustedWidth:dt,adjustedHeight:ht,sceneNodes:r.sceneNodes,sceneEdges:r.sceneEdges,nodeQuadtree:r.nodeQuadtree,maxNodeRadius:r.maxNodeRadius});var i;"hit"===o.kind?Mn(o.hover,{type:"activate",inputType:(i=e.nativeEvent.pointerType,"touch"===i?"touch":"pointer")}):"miss"===o.kind&&Mn(null)};const Rn=o(e=>_n.current(e),[]),Wn=e(-1),$n=e(null),Bn=e(-1),jn=o(e=>{if(function(e){const t=e.target;return t instanceof Element&&t!==e.currentTarget&&null!=t.closest("button, a[href], input, select, textarea, summary, [contenteditable='true'], [role='button'], [role='link'], [role='checkbox'], [role='radio'], [role='switch']")}(e))return;const t=Wt.current;if(!t)return;const n=()=>{Wn.current=-1,$n.current=null,Bn.current=-1,tn.current=null,zt(null),An&&(An(null),it.current=!0),xt()},r=function(e){const t=[];for(const n of e)if("circle"===n.type&&null!=n.cx){if(0>=n.r)continue;t.push({x:n.cx,y:n.cy,datum:n.datum,shape:"circle",group:n.datum?.id??"_default"})}else if("rect"===n.type&&null!=n.x){if(0>=n.w||0>=n.h)continue;t.push({x:n.x+n.w/2,y:n.y+n.h/2,datum:n.datum,shape:"rect",w:n.w,h:n.h,group:n.datum?.id??"_default"})}else if("arc"===n.type&&null!=n.cx)t.push({x:n.cx,y:n.cy,datum:n.datum,shape:"circle",group:n.datum?.id??"_default"});else if("symbol"===n.type&&null!=n.cx){if(0>=n.size)continue;t.push({x:n.cx,y:n.cy,datum:n.datum,shape:"circle",group:n.datum?.id??"_default"})}else if("glyph"===n.type&&null!=n.cx){if(0>=n.size||null==n.datum)continue;const e=On(n.glyph,n.size);t.push({x:n.cx+e.centerDx,y:n.cy+e.centerDy,datum:n.datum,shape:"rect",w:2*e.halfWidth,h:2*e.halfHeight,group:n.datum?.id??"_default"})}return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}(t.sceneNodes);if(0===r.length)return void(0>Wn.current||n());const o=function(e){const t=new Map;for(const n of e){const e=n.group??"_default";let r=t.get(e);r||(r=[],t.set(e,r)),r.push(n)}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 n=Array.from(t.keys()).sort((e,n)=>{const r=t.get(e),o=t.get(n);return(r.length>0?r[0].y:0)-(o.length>0?o[0].y:0)}),r=Array.from(t.values()).flat();r.sort((e,t)=>e.x-t.x||e.y-t.y);const o=new Map;for(let e=0;r.length>e;e++){r[e]._flatIndex=e;const t=r[e].datum?.id;null!=t&&o.set(t+"",e)}return{flat:r,groups:n,byGroup:t,idToIdx:o}}(r);let i=Wn.current;if(o.flat.length>i||(n(),i=-1)," "===e.key&&i>=0){e.preventDefault();const t=o.flat[i];return void Mn(l(t.datum||{},t.x,t.y,{nodeOrEdge:"node"}),{type:"activate",inputType:"keyboard"})}if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown","Enter"].includes(e.key))return;e.preventDefault(),Wn.current=0,Bn.current=-1;const t=o.flat[0];$n.current={shape:t.shape,w:t.w,h:t.h};const n=l(t.datum||{},t.x,t.y,{nodeOrEdge:"node"});return tn.current=n,zt(n),An&&(An(n,{type:"focus",inputType:"keyboard"}),it.current=!0),void xt()}const a=function(e,t){if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const n=Math.max(0,Math.min(t,e.flat.length-1)),r=e.flat[n];return{flatIndex:n,group:r.group??"_default",indexInGroup:r._groupIndex??0}}(o,i),s=function(e,t,n,r,o){const i=n.flat[t.flatIndex];if(!i)return zn(e,t,n);const a=i.datum?.id;switch(e){case"ArrowRight":case"ArrowLeft":case"ArrowDown":case"ArrowUp":{const r=function(e,t,n){let r=null,o=1/0;for(let i=0;e.flat.length>i;i++){const a=e.flat[i];if(a===t)continue;const s=a.x-t.x,c=a.y-t.y;let l=!1;switch(n){case"right":l=s>0&&Math.abs(s)>=Math.abs(c);break;case"left":l=0>s&&Math.abs(s)>=Math.abs(c);break;case"down":l=c>0&&Math.abs(c)>=Math.abs(s);break;case"up":l=0>c&&Math.abs(c)>=Math.abs(s)}if(!l)continue;const u=s*s+c*c;o>u&&(o=u,r=i)}return r}(n,i,"ArrowRight"===e?"right":"ArrowLeft"===e?"left":"ArrowDown"===e?"down":"up")??t.flatIndex;return r!==t.flatIndex&&(o.current=-1),r}case"Enter":{if(null==a)return t.flatIndex;const e=function(e,t){const n=e+"",r=[];for(const e of t){const t=e.datum??e,o=Hn(t.source),i=Hn(t.target),a=null!=o,s=null!=i;a&&o+""===n&&s?r.push(i+""):s&&i+""===n&&a&&r.push(o+"")}return r}(a,r);if(0===e.length)return t.flatIndex;const i=n.idToIdx.get(e[(o.current+1)%e.length])??-1;return 0>i?t.flatIndex:(o.current=-1,i)}default:{const r=zn(e,t,n);return null!==r&&r!==t.flatIndex&&(o.current=-1),r}}}(e.key,a,o,t.sceneEdges??[],Bn);if(null===s)return;if(e.preventDefault(),0>s)return void n();Wn.current=s;const c=o.flat[s];$n.current={shape:c.shape,w:c.w,h:c.h};const u={data:c.datum||{},x:c.x,y:c.y,__semioticHoverData:!0,nodeOrEdge:"node"};tn.current=u,zt(u),An&&(An(u,{type:"focus",inputType:"keyboard"}),it.current=!0),xt()},[Mn,An,xt]),Fn=o(e=>{Wn.current=-1,$n.current=null,In(e)},[In]);bt.current=()=>{if(vt.current=null,!kt.isActive)return;const e=Yn.current;if(!e)return;const t=Wt.current;t&&Zs({canvas:e,store:t,sceneRevisionDiagnostics:$t.current,size:lt,margin:ut,adjustedWidth:dt,adjustedHeight:ht,background:se,renderMode:F,hasBackgroundGraphics:!!Ee,dirtyRef:it,lastFrameTimeRef:Pt,now:kt.now(),random:kt.random,reducedMotion:!!st.current,showParticles:j,isContinuous:fn,animate:Pe,decay:De,pulse:Ie,thresholds:je,staleness:_e,particleStyle:Tt,getParticleColor:hn,pendingAnnotationFrameRef:Rt,lastAnnotationFrameTimeRef:_t,setAnnotationFrame:Yt,scheduleNextFrame:()=>{xt()}})};const{canvasRef:Yn}=function(e,t){return function(e){const{cancelRender:t,dirtyRef:n,frameRuntime:r,manageFrameRuntime:o,scheduleRender:i}=e,a=Ja(null),s=Ja(null),c=Ja(!1);return function(e){const{hydrated:t,wasHydratingFromSSR:n,storeRef:r,dirtyRef:o,renderFnRef:i,cancelRender:a,cleanup:s}=e;Va(()=>{t&&n&&r.current?.cancelIntroAnimation?.(),o.current=!0,a?.(),i.current()},[t,n]);const c=Ya(s);c.current=s,Ha(()=>()=>c.current?.(),[])}({hydrated:e.hydrated,wasHydratingFromSSR:e.wasHydratingFromSSR,storeRef:e.storeRef,dirtyRef:e.dirtyRef,renderFnRef:e.renderFnRef,cancelRender:e.cancelRender,cleanup:e.cleanup}),Za(()=>{if(!1!==o)return r.subscribe(()=>{r.isActive?(n.current=!0,i()):t()})},[t,n,r,o,i]),Za(()=>{!c.current&&(c.current=!0,e.skipInitialCanvasPaintInvalidation)||(e.dirtyRef.current=!0,e.scheduleRender())},e.canvasPaintDependencies),{canvasRef:a,interactionCanvasRef:s}}({...t,renderFnRef:e.renderFnRef,scheduleRender:e.scheduleRender,cancelRender:e.cancelRender,frameRuntime:e.frameRuntime})}(at,{hydrated:St,wasHydratingFromSSR:At,storeRef:Wt,dirtyRef:it,canvasPaintDependencies:[c,dt,ht,se,Ee,F,xt]});!function(e,t,n,r,o,i){const a=qr("fresh");Vr(()=>{if(!e)return;const s=setInterval(()=>{const s=t.current;if(!s||0===s.lastIngestTime)return;const c="undefined"!=typeof performance?performance.now():Date.now(),l=function(e,t){if(!e||0>=t)return Kr;const n=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={}){return Number.isFinite(t)&&t>0?Number.isNaN(e)?"fresh":e===1/0?"expired":0>e||t*(n.fresh??1)>e?"fresh":t*(n.aging??1.5)>e?"aging":t*(n.stale??3)>e?"stale":"expired":"fresh"}(t,n,e.thresholds);return{alpha:{...Ur,...e.opacities??{}}[o],band:o,isStale:"fresh"!==o}}return t>n?{alpha:e.dimOpacity??.5,band:"stale",isStale:!0}:Kr}(e,c-s.lastIngestTime);l.band===a.current&&l.isStale===o||(a.current=l.band,l.isStale!==o&&i(l.isStale),n.current=!0,r())},1e3);return()=>clearInterval(s)},[e,o,r,t,i,n])}(_e,Wt,it,xt,Xt,Gt);const Gn=ce&&Bt?fc(ar,{x:Bt.x,y:Bt.y,containerWidth:dt,containerHeight:ht,margin:ut,className:"stream-network-tooltip",zIndex:2,children:le?le(Bt):fc(Ds,{data:Bt})}):null;if(aa||!St&&At)return fc(ja,{props:a,store:Wt.current,responsiveRef:ct,size:lt,margin:ut,adjustedWidth:dt,adjustedHeight:ht,resolvedBackground:gt,resolvedForeground:ft});const Vn=Wt.current;return gc("div",{ref:ct,className:"stream-network-frame"+(ae?" "+ae:""),role:"group","aria-label":Fe||("string"==typeof Le?Le:"Network chart"),tabIndex:0,"aria-busy":Vt||void 0,style:{position:"relative",width:re?"100%":lt[0],height:oe?"100%":lt[1],overflow:"visible"},onKeyDown:jn,children:["production"!==process.env.NODE_ENV&&Wt.current&&fc(vn,{store:Wt.current,diagnostics:$t.current}),He&&fc(Ia,{tableId:mt}),He&&fc(Ea,{nodes:Vn?.sceneNodes??[],edges:Vn?.sceneEdges??[],chartType:"Network chart",tableId:mt,chartTitle:"string"==typeof Le?Le:void 0}),fc(Da,{summary:Ye}),fc(fa,{hoverPoint:Bt}),gc("div",{role:"img","aria-label":Fe||("string"==typeof Le?Le:"Network chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:ce?Fn:void 0,onMouseLeave:ce?Nn:void 0,onClick:de||he?Rn:void 0,children:[Vt&&!1!==D&&fc("div",{style:{position:"absolute",inset:0,zIndex:3,background:"var(--semiotic-bg, #fff)"},children:vs(!0,lt[0],lt[1],D)}),fc(ts,{size:lt,margin:ut,overflowVisible:!0,children:gt}),fc("canvas",{ref:Yn,"aria-label":ya(Vn?.sceneNodes?.length??0,Vn?.sceneEdges?.length??0,"Network chart"),style:{position:"absolute",top:0,left:0}}),fc(Ui,{width:dt,height:ht,totalWidth:lt[0],totalHeight:lt[1],margin:ut,labels:Vn?.labels||[],sceneNodes:Vn?.sceneNodes,title:Le,legend:xe,legendPosition:ke,legendLayout:we,legendHoverBehavior:Se,legendClickBehavior:Ae,legendHighlightedCategory:Me,legendIsolatedCategories:Ce,foregroundGraphics:xn(ft,Ln(Wt.current?.customLayoutOverlays,rt??null)),annotations:ye,onAnnotationActivate:me,onObservation:fe??he,chartId:ge,chartType:"StreamNetworkFrame",autoPlaceAnnotations:ve,svgAnnotationRules:be,annotationFrame:Ft}),fc(Ji,{marks:Vn?.customLayoutHtmlMarks,margin:ut,selection:rt??null}),fc(Xn,{active:Wn.current>=0,hoverPoint:Bt,margin:ut,size:lt,shape:$n.current?.shape,width:$n.current?.w,height:$n.current?.h}),Gn,_e?.showBadge&&fc(Zr,{isStale:Xt,position:_e.badgePosition})]})]})}));bc.displayName="StreamNetworkFrame";var xc=bc;import{useImperativeHandle as kc}from"react";function wc(e,t){const{variant:n,frameRef:r,overrides:o}=t;kc(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,n)=>e.current?.update(t,n)??[],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 n=Array.isArray(t)?t:[t],r=e.current?.getTopology()?.nodes??[],o=[];for(const t of n){const n=r.find(e=>e.id===t);n&&o.push({...n.data??{},id:t}),e.current?.removeNode(t)}return o},update:(t,n)=>(Array.isArray(t)?t:[t]).flatMap(t=>{const r=e.current?.updateNode(t,n);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,n)=>{const r=e.current?.removePoint(t)??[];for(const t of r)e.current?.push(n(t));return r},clear:()=>e.current?.clear(),getData:()=>e.current?.getData()??[],getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}const n=t;return{push:e=>n.current?.pushLine(e),pushMany:e=>n.current?.pushManyLines(e),remove:e=>n.current?.removeLine(e)??[],update:(e,t)=>{const r=n.current?.removeLine(e)??[];for(const e of r)n.current?.pushLine(t(e));return r},clear:()=>n.current?.clear(),getData:()=>n.current?.getLines()??[],getCustomLayout:()=>n.current?.getCustomLayout?.()??null,getLayoutFailure:()=>n.current?.getLayoutFailure?.()??null}}(n,r);return{...e,...o}},[r,o,n])}import{useMemo as Sc,forwardRef as Ac,useRef as Mc}from"react";import{useMemo as Cc,useCallback as Lc,useState as Tc,useId as Ec,useEffect as Dc,useRef as Ic}from"react";import{createContext as Nc,useContext as Pc,useMemo as _c}from"react";import{jsx as Rc}from"react/jsx-runtime";var Wc=Nc(null);import{createContext as $c,useContext as Oc,useEffect as Bc,useId as zc,useLayoutEffect as jc,useMemo as Hc,useRef as Fc,useState as Yc,useCallback as Xc}from"react";function Gc(e){const t=[];for(const[n,r]of Object.entries(e.fields))if("point"===r.type)t.push(e=>r.values.has(e[n]));else{const[e,o]=r.range;t.push(t=>{const r=t[n];return r>=e&&o>=r})}return e=>t.every(t=>t(e))}function Vc(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}function qc(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}var[Uc,Kc]=xr(e=>({selections:new Map,setClause(t,n){e(e=>{const r=e.selections.get(t),o=r?.clauses.get(n.clientId);if(o&&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,r]of n){const n=t.fields[e];if(!n||!qc(r,n))return!1}return!0}(o,n))return{};const i=new Map(e.selections),a=Vc(i,t),s=new Map(a.clauses);return s.set(n.clientId,n),i.set(t,{...a,clauses:s}),{selections:i}})},clearClause(t,n){e(e=>{const r=e.selections.get(t);if(!r||!r.clauses.has(n))return{};const o=new Map(e.selections),i=new Map(r.clauses);return i.delete(n),o.set(t,{...r,clauses:i}),{selections:o}})},setResolution(t,n){e(e=>{const r=e.selections.get(t);if(r?.resolution===n)return{};const o=new Map(e.selections),i=Vc(o,t);return o.set(t,{...i,resolution:n}),{selections:o}})},clearSelection(t){e(e=>{const n=e.selections.get(t);if(!n||0===n.clauses.size)return{};const r=new Map(e.selections);return r.set(t,{...n,clauses:new Map}),{selections:r}})}}));import{useId as Qc,useMemo as Zc,useCallback as Jc}from"react";import{useSyncExternalStore as el}from"react";var tl={positions:new Map},nl=new Set;function rl(){for(const e of nl)e()}function ol(e,t){const n=tl.positions.get(e);if(n?.locked)return;if(!n||n.sourceId!==t)return;const r=new Map(tl.positions);r.delete(e),tl={positions:r},rl()}function il(e,t){const n=tl.positions.get(e);if(!n?.locked)return;if(t&&n.sourceId!==t)return;const r=new Map(tl.positions);r.delete(e),tl={positions:r},rl()}function al(e){const t=Qc(),n=e.clientId||t,{name:r}=e,o=Kc(e=>e.selections.get(r)),i=Kc(e=>e.setClause),a=Kc(e=>e.clearClause),s=Zc(()=>!!o&&o.clauses.size>0,[o]);return{predicate:Zc(()=>o&&0!==o.clauses.size?function(e,t){const n=[];for(const[r,o]of e.clauses)"crossfilter"===e.resolution&&r===t||n.push(Gc(o));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(o,n):()=>!0,[o,n]),isActive:s,selectPoints:Jc(e=>{const t={};let o=!1;for(const[n,r]of Object.entries(e))t[n]={type:"point",values:new Set(r)},o=!0;o&&i(r,{clientId:n,type:"point",fields:t})},[n,r,i]),selectInterval:Jc(e=>{const t={};let o=!1;for(const[n,r]of Object.entries(e))t[n]={type:"interval",range:r},o=!0;o&&i(r,{clientId:n,type:"interval",fields:t})},[n,r,i]),clear:Jc(()=>{a(r,n)},[a,r,n]),clientId:n}}import{jsx as sl,jsxs as cl}from"react/jsx-runtime";var ll=$c(!1);$c(!1);var ul=$c(null),dl="undefined"==typeof window?Bc:jc;import*as hl from"react";import{jsx as fl,jsxs as gl}from"react/jsx-runtime";function pl(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function yl(e,t){const{when:n}=e,r=t.width,o=t.height,i=function(e){if("number"==typeof e.height&&e.height>0)return e.width/e.height}(t),a=function(e){if("number"==typeof e.height&&e.height>0)return e.height>e.width?"portrait":"landscape"}(t);return!("number"==typeof n.minWidth&&n.minWidth>r||"number"==typeof n.maxWidth&&r>n.maxWidth||"number"==typeof n.minHeight&&("number"!=typeof o||n.minHeight>o)||"number"==typeof n.maxHeight&&("number"!=typeof o||o>n.maxHeight)||"number"==typeof n.minAspectRatio&&("number"!=typeof i||n.minAspectRatio>i)||"number"==typeof n.maxAspectRatio&&("number"!=typeof i||i>n.maxAspectRatio)||n.orientation&&a!==n.orientation)}function ml(e,t,n=e.responsiveRules){if(!Array.isArray(n)||0===n.length)return{props:e,matches:[]};const r=n.map((e,t)=>({rule:e,index:t})).filter(e=>yl(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 n={...e,...t};for(const r of["margin","frameProps","mobileSemantics","style"])pl(e[r])&&pl(t[r])&&(n[r]={...e[r],...t[r]});return"string"==typeof e.className&&"string"==typeof t.className&&(n.className=`${e.className} ${t.className}`),n}(e,t.rule.transform),e),matches:r}}function vl(e,t,n){const r=e.xValue??t?.[n];if(null==r)return null;const o=Number(r);return Number.isFinite(o)?o:null}function bl(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 xl(e){if(!e)return!1;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}hl.createContext(void 0);var kl=[],wl={enabled:!0,tapToSelect:!0,tapToLockTooltip:!0,clearSelection:"backgroundTap",targetSize:44,snap:"nearestDatum",brushHandleSize:44,standardControls:!1,enabled:!1,tapToSelect:!1,tapToLockTooltip:!1};function Sl(e,t={}){const n=t.mobileSemantics?.interaction,r="number"==typeof n?.targetSize?n.targetSize:"number"==typeof t.mobileSemantics?.minimumHitTarget?t.mobileSemantics.minimumHitTarget:void 0,o="mobile"===t.mode||"number"==typeof t.width&&480>=t.width,i=!!n||void 0!==r,a=e&&"object"==typeof e?e:void 0;if(!1===e||!1===a?.enabled||void 0===e&&!o&&!i)return wl;const s=a??{};return{enabled:!0,tapToSelect:s.tapToSelect??!0,tapToLockTooltip:s.tapToLockTooltip??!0,clearSelection:s.clearSelection??"backgroundTap",targetSize:s.targetSize??r??44,snap:s.snap??"nearestDatum",brushHandleSize:s.brushHandleSize??44,standardControls:s.standardControls??!1}}function Al(){const e=Dr(e=>e.theme),t=e?.colors?.categorical;return t&&t.length>0?t:void 0}function Ml(e,t,n,r,o){if(e)return e;if(n&&"object"==typeof n&&!Array.isArray(n)){const e=nn(n,r);if(e)return e}let i;if(Array.isArray(n))i=n;else if(t&&t.length>0)i=t;else if("string"==typeof n){const e=Kt[n];Array.isArray(e)&&(i=e)}return i&&0!==i.length?null!=r?(o.has(r)||o.set(r,o.size),i[o.get(r)%i.length]):i[0]:"#007bff"}function Cl({selection:e,linkedHover:t,fallbackFields:n=kl,unwrapData:r=!1,onObservation:o,chartType:i,chartId:a,onClick:s,hoverHighlight:c,colorByField:l,mobileInteraction:u}){const d=Ec(),h=Cc(()=>function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField,seriesField:e.seriesField}:null}(t,n),[t,n]),f=Cc(()=>"series"===h?.mode?[h.seriesField||l||n[0]].filter(e=>!!e):h?.fields||n,[h,l,n]),g=al({name:e?.name||"__unused__",fields:f}),p=function(e){const t=e.name||"hover",{fields:n}=e,{predicate:r,isActive:o,selectPoints:i,clear:a}=al({name:t,fields:n});return{onHover:Jc(e=>{if(!e)return void a();const t={};for(const r of n){const n=e[r];void 0!==n&&(t[r]=[n])}(function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1})(t)&&i(t)},[n,i,a]),predicate:r,isActive:o}}({name:h?.name||"hover",fields:f}),y=Zo(e=>e.pushObservation),m=Lc(e=>{o?.(e),y?.(e)},[o,y]),v=e?{isActive:g.isActive,predicate:g.predicate}:null,[b,x]=Tc(null),k=Ic(!1),w=l||n[0],S=Cc(()=>{if(!c||null==b||!w)return null;const e=b,t=w;return{isActive:!0,predicate:n=>("string"==typeof n[t]?n[t]:(n[t]??"")+"")===e}},[c,b,w]),A=Lc((e,n)=>{const r=!e&&k.current&&!!u?.enabled&&u.tapToLockTooltip;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===h?.mode&&h.xField){const n=vl(e,t,h.xField);null!=n&&function(e,t,n){const r=tl.positions.get(e);r?.locked||r&&r.xValue===t&&r.sourceId===n||(tl={positions:new Map(tl.positions).set(e,{xValue:t,sourceId:n})},rl())}(h.name||"hover",n,d)}"x-position"!==h?.mode&&p.onHover(t)}else"x-position"!==h?.mode||r||ol(h.name||"hover",d),"x-position"===h?.mode||r||p.onHover(null);if(c&&w)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=t?.[w];x(null!=n?n+"":null)}else r||x(null);(o||y)&&lc({onObservation:m,datum:e?bl(e):null,x:e?.x,y:e?.y,chartType:i||"unknown",chartId:a,context:n})},[t,p,h,d,o,i,a,y,m,c,w,u]),M=Lc((n=!0)=>{k.current=!1,t&&"x-position"!==h?.mode&&p.onHover(null),e&&u?.tapToSelect&&g.clear(),n&&c&&x(null),"x-position"===h?.mode&&(il(h.name||"hover",d),ol(h.name||"hover",d))},[t,h,p,e,u,g,c,d]),C=Lc((n,r)=>{const l=!!u?.enabled&&(u.tapToLockTooltip||u.tapToSelect),v=!!u?.enabled&&"backgroundTap"===u.clearSelection;if("x-position"===h?.mode&&h.xField&&n){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]);const t=vl(n,e,h.xField);null!=t&&function(e,t,n){const r=tl.positions.get(e);if(r?.locked){const t=new Map(tl.positions);return t.delete(e),tl={positions:t},rl(),!1}tl={positions:new Map(tl.positions).set(e,{xValue:t,sourceId:n,locked:!0})},rl()}(h.name||"hover",t,d)}if(l)if(n){k.current=!0;const r=bl(n);if(t&&"x-position"!==h?.mode&&p.onHover(r),e&&u?.tapToSelect&&f.length>0){const e={};for(const t of f){const n=r[t];void 0!==n&&(e[t]=[n])}xl(e)&&g.selectPoints(e)}if(c&&w){const e=r?.[w];x(null!=e?e+"":null)}}else v&&M();if(n||v){if(n&&s){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]),s(e,{x:n.x??0,y:n.y??0})}(o||y)&&uc({onObservation:m,datum:n?bl(n):null,x:n?.x,y:n?.y,chartType:i||"unknown",chartId:a,context:r})}},[s,o,y,m,i,a,h,d,u,t,p,e,g,f,c,w,M]);return Dc(()=>{if(!u?.enabled||"undefined"==typeof document)return;const e=e=>{"Escape"===e.key&&k.current&&M()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[u?.enabled,M]),Dc(()=>()=>{k.current&&M(!1)},[M]),Dc(()=>{if("x-position"!==h?.mode)return;const e=h.name||"hover";return()=>{il(e,d),ol(e,d)}},[h?.mode,h?.name,d]),{activeSelectionHook:v,hoverSelectionHook:S,customHoverBehavior:A,customClickBehavior:C,crosshairSourceId:d}}function Ll({data:e,colorBy:t,colorScale:n,showLegend:r,legendPosition:o="right",userMargin:i,defaults:a={top:50,bottom:60,left:70,right:40},categories:s}){const c=Oc(ll),l=null!==Oc(ul),u=void 0!==r?r:!c&&!!t,d=!!t&&(u||l),h=Cc(()=>{if(!d)return[];if(void 0!==s)return s;const n=new Set;for(const r of e){const e="function"==typeof t?t(r):r[t];null!=e&&n.add(e+"")}return Array.from(n)},[s,t,e,d]);!function(e){const t=Oc(ul),n=zc(),r=function(e){const t=new Set,n=[];for(const r of e)t.has(r)||(t.add(r),n.push(r));return n}(e),o=Fc([]);(function(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})(o.current,r)||(o.current=r);const i=o.current;dl(()=>{if(t)return()=>t.unregisterCategories(n)},[t,n]),dl(()=>{t&&t.registerCategories(n,i)},[t,n,i])}(l&&t?h:[]);const f=Cc(()=>{if(!u||!t)return;const r=function({data:e,colorBy:t,colorScale:n,getColor:r,strokeColor:o,strokeWidth:i,categories:a}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==o&&(n.stroke=o),void 0!==i&&(n.strokeWidth=i),n},type:"fill",items:(a&&a.length>0?a:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((o,i)=>{const a=e.find("function"==typeof t?e=>t(e)===o:e=>e[t]===o),s=a?r(a,t,n):n?n(o):Zt[i%Zt.length];return{label:o+"",color:s}}),label:""}]}}({data:e,colorBy:t,colorScale:n,getColor:tn,categories:h});return 0!==r.legendGroups.reduce((e,t)=>e+t.items.length,0)?r:void 0},[u,t,e,n,h]),g=Cc(()=>{const e="number"==typeof i?{top:i,bottom:i,left:i,right:i}:i??{},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")},r=t=>"number"==typeof e[t];return f&&("right"===o&&!r("right")&&110>n.right?n.right=110:"left"===o&&!r("left")&&110>n.left?n.left=110:"top"===o&&!r("top")&&50>n.top?n.top=50:"bottom"===o&&!r("bottom")&&80>n.bottom&&(n.bottom=80)),n},[a,i,f,o]);return{legend:f,margin:g,legendPosition:o}}var Tl={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 El(e,t,n){const r=Tl[e||"primary"],o=e&&"primary"!==e||!n?.width?r.width:n.width,i=e&&"primary"!==e||!n?.height?r.height:n.height,a=ml({...t,mode:e},{width:t.width??o,height:t.height??i}).props,s=a.mode||e,c=Tl[s||"primary"],l="context"===s||"sparkline"===s,u=s&&"primary"!==s||!n?.width?c.width:n.width;return{width:a.width??u,height:a.height??(s&&"primary"!==s||!n?.height?c.height:n.height),showAxes:a.showAxes??c.showAxes,showGrid:a.showGrid??c.showGrid,enableHover:a.enableHover??(!!a.linkedHover||c.enableHover),showLegend:a.showLegend??c.showLegend,showLabels:a.showLabels??c.showLabels,title:l?void 0:a.title,description:a.description,summary:a.summary,accessibleTable:a.accessibleTable,xLabel:l?void 0:a.xLabel,yLabel:l?void 0:a.yLabel,categoryLabel:l?void 0:a.categoryLabel,valueLabel:l?void 0:a.valueLabel,marginDefaults:Dl(c.marginDefaults,a.showCategoryTicks,a.orientation),compactMode:l,mobileInteraction:Sl(a.mobileInteraction,{mode:s,width:a.width??u,mobileSemantics:a.mobileSemantics}),mobileSemantics:a.mobileSemantics}}function Dl(e,t,n){if(!1!==t)return e;const r={...e};return"horizontal"===n?r.left=Math.min(r.left,15):r.bottom=Math.min(r.bottom,15),r}import{useMemo as Il}from"react";function Nl(e,t){if(!e)return[];const n=[],r=e=>{n.push(e);const o="function"==typeof t?t(e):e[t];o&&Array.isArray(o)&&o.forEach(r)};return r(e),n}function Pl(e,t,n,r){if(e&&e.length>0)return e;const o=new Set;return t.forEach(e=>{const t="function"==typeof n?n(e):e[n],i="function"==typeof r?r(e):e[r];o.add(t),o.add(i)}),Array.from(o).map(e=>({id:e}))}function _l(e){return"function"==typeof e?e:t=>t[e]||1}function Rl({edgeColorBy:e,colorBy:t,colorScale:n,nodeStyleFn:r,edgeOpacity:o,baseStyle:i={}}){return a=>{const s={fillOpacity:o,...i};if("function"==typeof e)s.fill=e(a);else if("source"===e){const e="object"==typeof a.source?a.source:null;t&&e?s.fill=tn(e.data||e,t,n):e&&(s.fill=r(e,e.index).fill)}else if("target"===e){const e="object"==typeof a.target?a.target:null;t&&e?s.fill=tn(e.data||e,t,n):e&&(s.fill=r(e,e.index).fill)}else"gradient"===e&&(s.fill="#999",s.fillOpacity=.7*o);return s}}function Wl(e){const{nodes:t,edges:n,inferNodes:r=!0,sourceAccessor:o="source",targetAccessor:i="target",colorBy:a,colorScheme:s,showLegend:c,legendPosition:l,legendInteraction:u,selection:d,linkedHover:h,onObservation:f,onClick:g,mobileInteraction:p,mobileSemantics:y,chartType:m,chartId:v,marginDefaults:b,userMargin:x,width:k,height:w,loading:S,loadingContent:A,emptyContent:M,emptyDataKey:C="edges"}=e,L=Il(()=>Oa(n),[n]),T=Il(()=>Oa(t),[t]),E=vs(S,k,w,A),D=E?null:ms("nodes"===C?void 0===t?void 0:T:void 0===n?void 0:L,k,w,M),I=Il(()=>r?Pl(T,L,o,i):T,[r,T,L,o,i]),N=function(e,t,n){const r=Pc(Wc),o=Al();return Cc(()=>{if(!t)return;const i=r??void 0,a=n??(o&&o.length>0?o:void 0)??"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>t(e)+"")));if(i&&xl(i)){const e=rn(n.map(e=>({_cat:e})),"_cat",a);return t=>i[t]||e(t)}return rn(n.map(e=>({_cat:e})),"_cat",a)}if(i&&xl(i)){const n=rn(e,t,a);return e=>i[e]||n(e)}return rn(e,t,a)}if(i&&xl(i)){const e=rn([{_:"a"}],"_",a);return t=>i[t]||e(t)}},[e,t,n,r,o])}(I,a,s),P=Al(),_=Il(()=>{if(Array.isArray(s))return s;if(P&&P.length>0)return P;if("string"==typeof s){const e=Kt[s];if(Array.isArray(e)&&e.length>0)return e}return Qt},[s,P]),R=Il(()=>{if(!a)return[];const e=new Set;for(const t of I){const n="function"==typeof a?a(t):t[a];null!=n&&e.add(n+"")}return Array.from(e)},[I,a]),W=function(e,t,n){const[r,o]=Tc(null),[i,a]=Tc(new Set),s=Cc(()=>new Set,[]),c=Lc(t=>{"highlight"===e&&o(t?t.label:null)},[e]),l=Lc(t=>{"isolate"===e&&a(e=>{const r=new Set(e);return r.has(t.label)?r.delete(t.label):r.add(t.label),r.size===n.length?new Set:r})},[e,n.length]),u=Cc(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=r?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===r}:"isolate"===e&&i.size>0?{isActive:!0,predicate:e=>{const r=n?e[n]:"function"==typeof t?t(e):null;return i.has(r)}}:null},[e,t,r,i]);return{highlightedCategory:"highlight"===e?r:null,isolatedCategories:"isolate"===e?i:s,onLegendHover:c,onLegendClick:l,legendSelectionHook:u}}(u,a,R),{legend:$,margin:O,legendPosition:B}=Ll({data:I,colorBy:a,colorScale:N,showLegend:c,legendPosition:l,userMargin:x,defaults:b,categories:R}),z=Il(()=>Sl(p,{width:k,mobileSemantics:y}),[p,k,y]),j=Cl({selection:d,linkedHover:h,fallbackFields:a?["string"==typeof a?a:""]:[],unwrapData:!0,onObservation:f,onClick:g,mobileInteraction:z,chartType:m,chartId:v}),{customHoverBehavior:H,customClickBehavior:F,activeSelectionHook:Y,hoverSelectionHook:X,crosshairSourceId:G}=j;return{safeNodes:I,safeEdges:L,colorScale:N,effectivePalette:_,themeCategorical:P,allCategories:R,legendState:W,legend:$,margin:O,legendPosition:B,mobileInteraction:z,customHoverBehavior:H,customClickBehavior:F,activeSelectionHook:Y,hoverSelectionHook:X,crosshairSourceId:G,loadingEl:E,emptyEl:D}}function $l(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return 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)=>({...e(...t)||{},...n}):(...e)=>({...n})}function Ol(e){if(null==e)return()=>{};const t="function"==typeof e?e:t=>t[e];return e=>zl(t(e))}function Bl(e,t){const n=Ol(t??"value"),r=null==e?void 0:"function"==typeof e?e:t=>t[e];return e=>{const t=r?r(e):void 0;return{value:n(e),category:null==t?void 0:t+""}}}function zl(e){if("number"==typeof e)return Number.isFinite(e)?e:void 0;if("string"==typeof e&&""!==e.trim()){const t=Number(e);return Number.isFinite(t)?t:void 0}}function jl(e,t,n){const r=null!=e.axis?n[e.axis]:null!=e.field?t[e.field]:n.value;if(void 0!==e.eq&&r!==e.eq)return!1;if(void 0!==e.ne&&r===e.ne)return!1;if(void 0!==e.in&&!e.in.includes(r))return!1;if(void 0===e.gt&&void 0===e.gte&&void 0===e.lt&&void 0===e.lte&&void 0===e.within&&void 0===e.outside)return!0;const o=zl(r);if(void 0===o)return!1;if(void 0!==e.gt&&e.gt>=o)return!1;if(void 0!==e.gte&&e.gte>o)return!1;if(void 0!==e.lt&&o>=e.lt)return!1;if(void 0!==e.lte&&o>e.lte)return!1;if(void 0!==e.within){const[t,n]=e.within;if(t>o||o>n)return!1}if(void 0!==e.outside){const[t,n]=e.outside;if(o>=t&&n>=o)return!1}return!0}function Hl(e,t,n){const r=e.when;return void 0===r||!0===r||!1!==r&&("function"==typeof r?r(t,n):jl(r,t,n))}function Fl(e,t,n){if(!t||0===t.length)return{};let r={};for(const o of t){if(!Hl(o,e,n))continue;const t="function"==typeof o.style?o.style(e,n):o.style;t&&(r={...r,...t})}return r}function Yl(e,t,n,r=e=>e){const o=e??(()=>({}));return t&&0!==t.length?(e,i)=>{const a=r(e),s={...o(e,i)};return Object.assign(s,Fl(a,t,n(a,i))),s}:o}function Xl(e,t){const n=e.length,r=t.length,o=Array(r+1);for(let e=0;r>=e;e++)o[e]=e;for(let i=1;n>=i;i++){let n=o[0];o[0]=i;for(let a=1;r>=a;a++){const r=o[a];o[a]=e[i-1]===t[a-1]?n:1+Math.min(n,o[a],o[a-1]),n=r}}return o[r]}function Gl(e,t){if(0===t.length)return null;const n=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(n)||n.includes(e.toLowerCase()))||(function(e,t,n=3){let r,o=n+1;for(const n of t){const t=Xl(e.toLowerCase(),n.toLowerCase());o>t&&(o=t,r=n)}return o>n?void 0:r}(e,t,3)??null)}function Vl({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 ql({componentName:e,nodes:t,edges:n,nodesRequired:r=!1,edgesRequired:o=!0,accessors:i}){if(null==t&&null==n)return null;if(o&&(!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(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 n=(a=t,a.length>3?[a[0],a[Math.floor(a.length/2)],a[a.length-1]]:[...a]).find(e=>e&&"object"==typeof e);if(n){const t=Object.keys(n);for(const[r,o]of Object.entries(i))if(o&&"string"==typeof o&&!(o in n)){const n=Gl(o,t),i=n?` Try ${r}="${n}".`:"";return`${e}: ${r} "${o}" not found in node data. Available fields: ${t.join(", ")}.${i}`}}}var a;return null}function Ul(e){const{title:t,description:n,summary:r,accessibleTable:o,className:i,animate:a,axisExtent:s,autoPlaceAnnotations:c}=e,l={};return t&&(l.title=t),n&&(l.description=n),r&&(l.summary=r),void 0!==o&&(l.accessibleTable=o),i&&(l.className=i),null!=a&&(l.animate=a),void 0!==s&&(l.axisExtent=s),void 0!==c&&(l.autoPlaceAnnotations=c),l}function Kl(e){const{linkedHover:t,selection:n,onObservation:r,onClick:o,hoverRadius:i,hoverHighlight:a,forceHoverBehavior:s,forceClickBehavior:c,mobileInteraction:l,customHoverBehavior:u,customClickBehavior:d,linkedHoverInClickPredicate:h=!0}=e,f={};r&&(f.annotationObservationCallback=r);const g=l?.enabled?Math.max(i??30,Math.ceil((l.targetSize||44)/2),24):i;return(s||t||r||o||a)&&(f.customHoverBehavior=u),d&&(c||(h?r||o||t:r||o)||l?.enabled&&(l.tapToSelect||l.tapToLockTooltip)&&(t||a||n))&&(f.customClickBehavior=d),null!=g&&(f.hoverRadius=g),f}import{jsx as Ql}from"react/jsx-runtime";var Zl=Ac(function(e,t){const n=Mc(null);wc(t,{variant:"network",frameRef:n});const r=El(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:o,edges:i,margin:a,className:s,nodeIdAccessor:c,nodeIDAccessor:l,sourceAccessor:u="source",targetAccessor:d="target",nodeLabel:h,colorBy:f,colorScheme:g,styleRules:p,nodeSize:y=8,nodeSizeRange:m=[5,20],edgeWidth:v=1,edgeColor:b="#999",edgeOpacity:x=.6,iterations:k=300,forceStrength:w=.1,layoutExecution:S="auto",layoutLoadingContent:A,onLayoutStateChange:M,tooltip:C,frameProps:L={},onObservation:T,onClick:E,chartId:D,selection:I,linkedHover:N,loading:P,loadingContent:_,emptyContent:R,legendInteraction:W,legendPosition:$,stroke:O,strokeWidth:B,opacity:z}=e,j=c??l??"id",{width:H,height:F,enableHover:Y,showLegend:X,showLabels:G=!1,title:V,description:q,summary:U,accessibleTable:K}=r,Q=Wl({nodes:o,edges:i,inferNodes:!1,nodeIdAccessor:j,sourceAccessor:u,targetAccessor:d,colorBy:f,colorScheme:g,showLegend:X,legendPosition:$,legendInteraction:W,selection:I,linkedHover:N,onObservation:T,onClick:E,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"ForceDirectedGraph",chartId:D,marginDefaults:r.marginDefaults,userMargin:a,width:H,height:F,loading:P,loadingContent:_,emptyContent:R,emptyDataKey:"nodes"}),Z=Sc(()=>new Map,[]),J=Sc(()=>e=>{const t={};return t.fill=f?tn(e.data||e,f,Q.colorScale):Ml(void 0,Q.themeCategorical,g,void 0,Z),"number"==typeof y&&(t.r=y),t},[f,Q.colorScale,y,Q.themeCategorical,g,Z]),ee=Sc(()=>Bl(f,"number"==typeof y?void 0:y),[f,y]),te=Sc(()=>$l(Yl(J,p,ee,e=>e.data||e),{stroke:O,strokeWidth:B,opacity:z}),[J,p,ee,O,B,z]),ne=Sc(()=>e=>{const t=e.data||e;let n;if("number"==typeof v)n=v;else if("function"==typeof v)n=v(t);else{const e=t[v],r="number"==typeof e?e:Number(e);n=Number.isFinite(r)&&r>0?r:1}return{stroke:b,strokeWidth:n,opacity:x}},[v,b,x]),re=Sc(()=>$l(ne,{stroke:O,strokeWidth:B,opacity:z}),[ne,O,B,z]),oe=Sc(()=>{if(G&&h)return"function"==typeof h?h:e=>e.data?.[h]??e[h]??e.id},[G,h]),ie=ql({componentName:"ForceDirectedGraph",nodes:o,edges:i,nodesRequired:!0,edgesRequired:!0,accessors:{nodeIDAccessor:j}});return ie?Ql(us,{componentName:"ForceDirectedGraph",message:ie,width:H,height:F}):Q.loadingEl?Q.loadingEl:Q.emptyEl?Q.emptyEl:Ql(gs,{componentName:"ForceDirectedGraph",width:H,height:F,children:Ql(xc,{ref:n,chartType:"force",...null!=o&&{nodes:Q.safeNodes},...null!=i&&{edges:Q.safeEdges},size:[H,F],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Q.margin,nodeIDAccessor:j,sourceAccessor:u,targetAccessor:d,iterations:k,forceStrength:w,layoutExecution:S,layoutLoadingContent:A,onLayoutStateChange:M,nodeStyle:te,edgeStyle:re,colorBy:f,colorScheme:Q.effectivePalette,nodeSize:y,nodeSizeRange:m,nodeLabel:oe,showLabels:G,enableHover:Y,tooltipContent:!1===C?()=>null:or(C)||void 0,...Kl({linkedHover:N,selection:I,onObservation:T,onClick:E,mobileInteraction:Q.mobileInteraction,customHoverBehavior:Q.customHoverBehavior,customClickBehavior:Q.customClickBehavior,linkedHoverInClickPredicate:!1}),legend:Q.legend,legendPosition:Q.legendPosition,...W&&"none"!==W&&{legendHoverBehavior:Q.legendState.onLegendHover,legendClickBehavior:Q.legendState.onLegendClick,legendHighlightedCategory:Q.legendState.highlightedCategory,legendIsolatedCategories:Q.legendState.isolatedCategories},className:s,title:V,description:q,summary:U,accessibleTable:K,...null!=e.animate&&{animate:e.animate},...L})})});Zl.displayName="ForceDirectedGraph";import{useEffect as Jl,useMemo as eu,useRef as tu,useState as nu}from"react";import{forceCenter as ru,forceCollide as ou,forceLink as iu,forceManyBody as au,forceSimulation as su,forceX as cu,forceY as lu}from"d3-force";function uu(e,t,n={}){const r=n.iterations??260,o=n.repulsion??5200,i=n.linkDistance??165,a=n.linkStrength??.045,s=n.centerStrength??.018,c=n.damping??.84,l=n.nodeRadius??12,u=n.nodePadding??3,d=n.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}}(n.seed??1),f=new Map;for(const t of e)f.set(t.id,0);for(const e of t)f.set(e.source,(f.get(e.source)??0)+1),f.set(e.target,(f.get(e.target)??0)+1);const g=500,p=e.map(e=>({id:e.id,data:e,x:200+600*h(),y:200+600*h()})),y=new Set(e.map(e=>e.id)),m=t.filter(e=>y.has(e.source)&&y.has(e.target)).map(e=>({source:e.source,target:e.target}));if(r>0){const e=su(p).randomSource(h).alphaDecay(1-Math.pow(.001,1/r)).velocityDecay(Math.max(0,Math.min(1,1-c))).force("charge",au().strength(e=>{const t=f.get(e.id)??0;return 2.5*-Math.sqrt(o)*Math.sqrt(t+1)})).force("collide",ou(e=>(e=>"function"==typeof l?l(e.data):l)(e)+u).strength(.9).iterations(2)).force("center",ru(g,g).strength(.8)).force("x",cu(g).strength(s)).force("y",lu(g).strength(s));m.length>0&&e.force("link",iu(m).id(e=>e.id).distance(i).strength(e=>{const t="string"==typeof e.target?e.target:e.target.id,n=Math.max(1,Math.min(f.get("string"==typeof e.source?e.source:e.source.id)??1,f.get(t)??1));return a/.045/n})),e.stop();for(let t=0;r>t;t+=1)e.tick()}let v=1/0,b=1/0,x=-1/0,k=-1/0;for(const e of p){const t=e.x??g,n=e.y??g;v>t&&(v=t),b>n&&(b=n),t>x&&(x=t),n>k&&(k=n)}const w=x-v,S=k-b,A={};for(const e of p)A[e.id]={x:0===w?.5:d+((e.x??g)-v)/w*(1-2*d),y:0===S?.5:d+((e.y??g)-b)/S*(1-2*d)};return A}var du=new WeakMap;function hu(e){const t=[];for(const n of Object.keys(e).sort()){const r=e[n];if(void 0!==r){if("function"==typeof r)return null;t.push(`${n}:${r+""}`)}}return t.join("|")}function fu(e,t,n){return null==n?null:du.get(e)?.get(t)?.get(n)??null}function gu(e,t,n,r){if(null==n)return;let o=du.get(e);o||(o=new WeakMap,du.set(e,o));let i=o.get(t);if(i||(i=new Map,o.set(t,i)),!i.has(n)&&i.size>=16){const e=i.keys().next().value;void 0!==e&&i.delete(e)}i.set(n,r)}function pu(e,t,n={}){const r=Qa(),{seed:o,iterations:i,repulsion:a,linkDistance:s,linkStrength:c,centerStrength:l,damping:u,nodeRadius:d,nodePadding:h,inset:f,execution:g,workerThreshold:p}=n,y=eu(()=>({seed:o,iterations:i,repulsion:a,linkDistance:s,linkStrength:c,centerStrength:l,damping:u,nodeRadius:d,nodePadding:h,inset:f,execution:g,workerThreshold:p}),[o,i,a,s,c,l,u,d,h,f,g,p]),m=tu(r),[v,b]=nu(()=>{if("undefined"==typeof window||r){const n=uu(e,t,y);return gu(e,t,hu(y),n),{positions:n,status:"ready",error:null}}const n=fu(e,t,hu(y));return n?{positions:n,status:"ready",error:null}:{positions:null,status:"pending",error:null}});return Jl(()=>{if(m.current)return void(m.current=!1);const n=hu(y),r=fu(e,t,n);if(r)return void b(e=>"ready"===e.status&&e.positions===r?e:{positions:r,status:"ready",error:null});const o=new AbortController;return b(e=>({positions:e.positions,status:"pending",error:null})),async function(e,t,n={}){const{execution:r="auto",signal:o,workerThreshold:i,nodeRadius:a,...s}=n,c=s.iterations??260;if(!xs()||!bs(r,e.length,t.length,c,i))return uu(e,t,{...s,nodeRadius:a});const l={kind:"normalized",nodes:e.map(e=>({...e})),edges:t.map(e=>({...e})),options:s,nodeRadii:"function"==typeof a?Object.fromEntries(e.map(e=>[e.id,a(e)])):null==a?void 0:Object.fromEntries(e.map(e=>[e.id,a]))};try{return(await As(l,o)).positions}catch(n){if("AbortError"===n?.name)throw n;return uu(e,t,{...s,nodeRadius:a})}}(e,t,{...y,signal:o.signal}).then(r=>{gu(e,t,n,r),b({positions:r,status:"ready",error:null})}).catch(e=>{"AbortError"!==e.name&&b(t=>({positions:t.positions,status:"error",error:e}))}),()=>o.abort()},[e,t,y]),v}import{useMemo as yu,forwardRef as mu,useRef as vu}from"react";import{jsx as bu}from"react/jsx-runtime";var xu=mu(function(e,t){const n=vu(null);wc(t,{variant:"network",frameRef:n,overrides:{getData:()=>n.current?.getTopology()?.edges?.map(e=>e.data)??[]}});const r=El(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:o,edges:i,margin:a,className:s,sourceAccessor:c="source",targetAccessor:l="target",valueAccessor:u="value",nodeIdAccessor:d="id",colorBy:h,colorScheme:f,styleRules:g,edgeColorBy:p="source",orientation:y="horizontal",nodeAlign:m="justify",nodePaddingRatio:v=.05,nodeWidth:b=15,nodeLabel:x,edgeOpacity:k=.5,edgeSort:w,tooltip:S,frameProps:A={},onObservation:M,onClick:C,chartId:L,selection:T,linkedHover:E,loading:D,loadingContent:I,emptyContent:N,showLegend:P,legendPosition:_,legendInteraction:R,stroke:W,strokeWidth:$,opacity:O}=e,{width:B,height:z,enableHover:j,showLabels:H=!0,title:F,description:Y,summary:X,accessibleTable:G}=r,V=Wl({nodes:o,edges:i,inferNodes:!0,nodeIdAccessor:d,sourceAccessor:c,targetAccessor:l,colorBy:h,colorScheme:f,showLegend:P,legendPosition:_,legendInteraction:R,selection:T,linkedHover:E,onObservation:M,onClick:C,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"SankeyDiagram",chartId:L,marginDefaults:r.marginDefaults,userMargin:a,width:B,height:z,loading:D,loadingContent:I,emptyContent:N}),q=yu(()=>new Map,[]),U=yu(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=h?tn(e.data||e,h,V.colorScale):Ml(void 0,V.themeCategorical,f,void 0,q),t},[h,V.colorScale,V.themeCategorical,f,q]),K=yu(()=>Bl(h,u),[h,u]),Q=yu(()=>$l(Yl(U,g,K,e=>e.data||e),{stroke:W,strokeWidth:$,opacity:O}),[U,g,K,W,$,O]),Z=yu(()=>Rl({edgeColorBy:p,colorBy:h,colorScale:V.colorScale,nodeStyleFn:Q,edgeOpacity:k,baseStyle:{stroke:"none",strokeWidth:0}}),[p,h,V.colorScale,Q,k]),J=yu(()=>$l(Z,{stroke:W,strokeWidth:$,opacity:O}),[Z,W,$,O]),ee=yu(()=>{if(!H)return;const e=x||d;return"function"==typeof e?e:t=>t.data?.[e]??t[e]??t.id},[H,x,d]),te=ql({componentName:"SankeyDiagram",edges:i,edgesRequired:!0});return te?bu(us,{componentName:"SankeyDiagram",message:te,width:B,height:z}):V.loadingEl?V.loadingEl:V.emptyEl?V.emptyEl:bu(gs,{componentName:"SankeyDiagram",width:B,height:z,children:bu(xc,{ref:n,chartType:"sankey",...V.safeNodes.length>0&&{nodes:V.safeNodes},...null!=i&&{edges:V.safeEdges},size:[B,z],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:V.margin,nodeIDAccessor:d,sourceAccessor:c,targetAccessor:l,valueAccessor:u,orientation:y,nodeAlign:m,nodePaddingRatio:v,nodeWidth:b,nodeStyle:Q,edgeStyle:J,colorBy:h,colorScheme:V.effectivePalette,edgeColorBy:p,edgeOpacity:k,edgeSort:w,nodeLabel:ee,showLabels:H,enableHover:j,tooltipContent:!1===S?()=>null:or(S)||void 0,...Kl({linkedHover:E,selection:T,onObservation:M,onClick:C,mobileInteraction:V.mobileInteraction,customHoverBehavior:V.customHoverBehavior,customClickBehavior:V.customClickBehavior,linkedHoverInClickPredicate:!1}),legend:V.legend,legendPosition:V.legendPosition,...R&&"none"!==R&&{legendHoverBehavior:V.legendState.onLegendHover,legendClickBehavior:V.legendState.onLegendClick,legendHighlightedCategory:V.legendState.highlightedCategory,legendIsolatedCategories:V.legendState.isolatedCategories},className:s,title:F,description:Y,summary:X,accessibleTable:G,...null!=e.animate&&{animate:e.animate},...A})})});xu.displayName="SankeyDiagram";import{useMemo as ku,forwardRef as wu,useRef as Su}from"react";import{jsx as Au}from"react/jsx-runtime";var Mu=wu(function(e,t){const n=Su(null);wc(t,{variant:"network",frameRef:n,overrides:{getData:()=>n.current?.getTopology()?.edges?.map(e=>e.data)??[]}});const r=El(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:o,edges:i,margin:a,className:s,sourceAccessor:c="source",targetAccessor:l="target",valueAccessor:u="value",nodeIdAccessor:d="id",colorBy:h,colorScheme:f,styleRules:g,edgeColorBy:p="source",padAngle:y=.01,groupWidth:m=20,sortGroups:v,nodeLabel:b,edgeOpacity:x=.5,tooltip:k,frameProps:w={},onObservation:S,onClick:A,chartId:M,selection:C,linkedHover:L,loading:T,loadingContent:E,emptyContent:D,legendInteraction:I,stroke:N,strokeWidth:P,opacity:_}=e,{width:R,height:W,enableHover:$,showLabels:O=!0,title:B,description:z,summary:j,accessibleTable:H}=r,F=Wl({nodes:o,edges:i,inferNodes:!0,nodeIdAccessor:d,sourceAccessor:c,targetAccessor:l,colorBy:h,colorScheme:f,showLegend:!1,legendInteraction:I,selection:C,linkedHover:L,onObservation:S,onClick:A,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"ChordDiagram",chartId:M,marginDefaults:r.marginDefaults,userMargin:a,width:R,height:W,loading:T,loadingContent:E,emptyContent:D}),Y=ku(()=>new Map,[]),X=F.safeNodes.length>0,G=ku(()=>{if(X)return(e,t)=>{const n={stroke:"black",strokeWidth:1};if(h)n.fill=tn(e.data||e,h,F.colorScale);else{const r=Array.isArray(f)?f:Kt[f]||Qt,o=Array.isArray(r)?r:Qt;n.fill=o[(e.index??t??0)%o.length]}return n}},[X,h,F.colorScale,f]),V=ku(()=>Bl(h),[h]),q=ku(()=>{if(G||g&&g.length>0)return $l(Yl(G,g,V,e=>e.data||e),{stroke:N,strokeWidth:P,opacity:_})},[G,g,V,N,P,_]),U=ku(()=>{if(X)return Rl({edgeColorBy:p,colorBy:h,colorScale:F.colorScale,nodeStyleFn:q||(e=>({fill:Ml(void 0,F.themeCategorical,f,void 0,Y)})),edgeOpacity:x,baseStyle:{stroke:"black",strokeWidth:.5,strokeOpacity:x}})},[X,p,h,F.colorScale,q,x,F.themeCategorical,f,Y]),K=ku(()=>U?$l(U,{stroke:N,strokeWidth:P,opacity:_}):void 0,[U,N,P,_]),Q=ku(()=>{if(!O)return;const e=b||d;return"function"==typeof e?e:t=>t.data?.[e]??t[e]??t.id},[O,b,d]),Z=ql({componentName:"ChordDiagram",edges:i,edgesRequired:!0});return Z?Au(us,{componentName:"ChordDiagram",message:Z,width:R,height:W}):F.loadingEl?F.loadingEl:F.emptyEl?F.emptyEl:Au(gs,{componentName:"ChordDiagram",width:R,height:W,children:Au(xc,{ref:n,chartType:"chord",...F.safeNodes.length>0&&{nodes:F.safeNodes},...null!=i&&{edges:F.safeEdges},size:[R,W],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:F.margin,nodeIDAccessor:d,sourceAccessor:c,targetAccessor:l,valueAccessor:u,padAngle:y,groupWidth:m,sortGroups:v,nodeStyle:q,edgeStyle:K,colorBy:h,colorScheme:F.effectivePalette,edgeColorBy:p,edgeOpacity:x,nodeLabel:Q,showLabels:O,enableHover:$,tooltipContent:!1===k?()=>null:or(k)||void 0,...Kl({linkedHover:L,selection:C,onObservation:S,onClick:A,mobileInteraction:F.mobileInteraction,customHoverBehavior:F.customHoverBehavior,customClickBehavior:F.customClickBehavior,linkedHoverInClickPredicate:!1}),...I&&"none"!==I&&{legendHoverBehavior:F.legendState.onLegendHover,legendClickBehavior:F.legendState.onLegendClick,legendHighlightedCategory:F.legendState.highlightedCategory,legendIsolatedCategories:F.legendState.isolatedCategories},className:s,title:B,description:z,summary:j,accessibleTable:H,...null!=e.animate&&{animate:e.animate},...w})})});Mu.displayName="ChordDiagram";import{useMemo as Cu}from"react";import{jsx as Lu}from"react/jsx-runtime";function Tu(e){const t=El(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:n,margin:r,className:o,layout:i="tree",orientation:a="vertical",childrenAccessor:s="children",valueAccessor:c="value",nodeIdAccessor:l="name",colorBy:u,colorScheme:d,colorByDepth:h=!1,edgeStyle:f="curve",nodeLabel:g,nodeSize:p=5,tooltip:y,frameProps:m={},onObservation:v,onClick:b,chartId:x,selection:k,linkedHover:w,loading:S,loadingContent:A,legendInteraction:M,stroke:C,strokeWidth:L,opacity:T}=e,{width:E,height:D,enableHover:I,showLabels:N=!0,title:P,description:_,summary:R,accessibleTable:W}=t,$=Wl({nodes:Cu(()=>Nl(n??null,s),[n,s]),edges:void 0,inferNodes:!1,colorBy:h?void 0:u,colorScheme:d,showLegend:!1,legendInteraction:M,selection:k,linkedHover:w,onObservation:v,onClick:b,mobileInteraction:t.mobileInteraction,mobileSemantics:t.mobileSemantics,chartType:"TreeDiagram",chartId:x,marginDefaults:t.marginDefaults,userMargin:r,width:E,height:D,loading:S,loadingContent:A}),O=Cu(()=>new Map,[]),B=Cu(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=h?Jt[(e.depth||0)%Jt.length]:u?tn(e.data||e,u,$.colorScale):Ml(void 0,$.themeCategorical,d,void 0,O),t},[u,h,$.colorScale,$.themeCategorical,d,O]),z=Cu(()=>$l(B,{stroke:C,strokeWidth:L,opacity:T}),[B,C,L,T]),j=Cu(()=>()=>({stroke:"#999",strokeWidth:1,fill:"none"}),[]),H=Cu(()=>$l(j,{stroke:C,strokeWidth:L,opacity:T}),[j,C,L,T]),F=Cu(()=>{if("treemap"===i||"circlepack"===i||"partition"===i)return _l(c)},[i,c]),Y=Vl({componentName:"TreeDiagram",data:n});return Y?Lu(us,{componentName:"TreeDiagram",message:Y,width:E,height:D}):$.loadingEl?$.loadingEl:Lu(gs,{componentName:"TreeDiagram",width:E,height:D,children:Lu(xc,{chartType:i,...null!=n&&{data:n},size:[E,D],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:$.margin,nodeIDAccessor:l,childrenAccessor:s,hierarchySum:F,treeOrientation:a,edgeType:f,nodeStyle:z,edgeStyle:H,colorBy:u,colorScheme:$.effectivePalette,colorByDepth:h,nodeSize:p,nodeLabel:N?g||l:void 0,showLabels:N,enableHover:I,tooltipContent:!1===y?()=>null:or(y)||void 0,...Kl({linkedHover:w,selection:k,onObservation:v,onClick:b,mobileInteraction:$.mobileInteraction,customHoverBehavior:$.customHoverBehavior,customClickBehavior:$.customClickBehavior,linkedHoverInClickPredicate:!1}),...M&&"none"!==M&&{legendHoverBehavior:$.legendState.onLegendHover,legendClickBehavior:$.legendState.onLegendClick,legendHighlightedCategory:$.legendState.highlightedCategory,legendIsolatedCategories:$.legendState.isolatedCategories},className:o,title:P,description:_,summary:R,accessibleTable:W,...null!=e.animate&&{animate:e.animate},...m})})}Tu.displayName="TreeDiagram";import{useMemo as Eu,useCallback as Du}from"react";import{useMemo as Iu}from"react";import{jsx as Nu}from"react/jsx-runtime";function Pu(e){const t=El(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:n,margin:r,className:o,childrenAccessor:i="children",valueAccessor:a="value",nodeIdAccessor:s="name",colorBy:c,colorScheme:l,colorByDepth:u=!1,labelMode:d="leaf",nodeLabel:h,padding:f=4,paddingTop:g,nodeStyle:p,tooltip:y,frameProps:m={},selection:v,linkedHover:b,onObservation:x,onClick:k,chartId:w,loading:S,loadingContent:A,legendInteraction:M,stroke:C,strokeWidth:L,opacity:T}=e,{nodeStyle:E,...D}=m,{width:I,height:N,enableHover:P,showLabels:_=!0,title:R,description:W,summary:$,accessibleTable:O}=t,B=Wl({nodes:Eu(()=>Nl(n??null,i),[n,i]),edges:void 0,inferNodes:!1,colorBy:u?void 0:c,colorScheme:l,showLegend:!1,legendInteraction:M,selection:v,linkedHover:b,onObservation:x,onClick:k,mobileInteraction:t.mobileInteraction,mobileSemantics:t.mobileSemantics,chartType:"Treemap",chartId:w,marginDefaults:t.marginDefaults,userMargin:r,width:I,height:N,loading:S,loadingContent:A}),z=function(e){const t=Dr(e=>e.theme.colors.selectionOpacity);return Iu(()=>{if(void 0!==e||void 0!==t)return{name:e?.name??"",...e,unselectedOpacity:e?.unselectedOpacity??t}},[e,t])}(v),j=B.customHoverBehavior,H=Du(e=>{if(!e)return j(null);const t=e.data||e;j({data:t?.data||t})},[j]),F=Eu(()=>new Map,[]),Y=Eu(()=>e=>{const t={stroke:"var(--semiotic-cell-border, var(--semiotic-border, #fff))",strokeWidth:1,strokeOpacity:.8};return t.fill=u?Jt[(e.depth||0)%Jt.length]:c?tn(e.data||e,c,B.colorScale):Ml(void 0,B.themeCategorical,l,void 0,F),t},[c,u,B.colorScale,B.themeCategorical,l,F]),X=Eu(()=>p||E?e=>({...Y(e),...E?E(e)??{}:{},...p?p(e)??{}:{}}):Y,[Y,p,E]),G=Eu(()=>$l(X,{stroke:C,strokeWidth:L,opacity:T}),[X,C,L,T]),V=Eu(()=>B.activeSelectionHook?e=>{const t={...G(e)};if(B.activeSelectionHook.isActive)if(B.activeSelectionHook.predicate(e.data||e))z?.selectedStyle&&Object.assign(t,z.selectedStyle);else{const e=z?.unselectedOpacity??.5;t.opacity=e,t.fillOpacity=e,t.strokeOpacity=e,z?.unselectedStyle&&Object.assign(t,z.unselectedStyle)}return t}:G,[G,B.activeSelectionHook,z]),q=Eu(()=>_l(a),[a]),U=void 0!==g?g:!_||"parent"!==d&&"all"!==d?void 0:18,K=Vl({componentName:"Treemap",data:n});return K?Nu(us,{componentName:"Treemap",message:K,width:I,height:N}):B.loadingEl?B.loadingEl:Nu(gs,{componentName:"Treemap",width:I,height:N,children:Nu(xc,{chartType:"treemap",...null!=n&&{data:n},size:[I,N],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:B.margin,nodeIDAccessor:s,childrenAccessor:i,hierarchySum:q,padding:f,paddingTop:U,nodeStyle:V,colorBy:c,colorScheme:B.effectivePalette,colorByDepth:u,nodeLabel:_?h||s:void 0,showLabels:_,labelMode:d,enableHover:P,tooltipContent:!1===y?()=>null:or(y)||void 0,...Kl({linkedHover:b,selection:v,onObservation:x,onClick:k,mobileInteraction:B.mobileInteraction,customHoverBehavior:H,customClickBehavior:B.customClickBehavior,linkedHoverInClickPredicate:!1}),...M&&"none"!==M&&{legendHoverBehavior:B.legendState.onLegendHover,legendClickBehavior:B.legendState.onLegendClick,legendHighlightedCategory:B.legendState.highlightedCategory,legendIsolatedCategories:B.legendState.isolatedCategories},className:o,title:R,description:W,summary:$,accessibleTable:O,...null!=e.animate&&{animate:e.animate},...D})})}Pu.displayName="Treemap";import{useMemo as _u}from"react";import{jsx as Ru}from"react/jsx-runtime";function Wu(e){const t=El(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:n,margin:r,className:o,childrenAccessor:i="children",valueAccessor:a="value",nodeIdAccessor:s="name",colorBy:c,colorScheme:l,colorByDepth:u=!1,nodeLabel:d,circleOpacity:h=.7,padding:f=4,tooltip:g,frameProps:p={},onObservation:y,onClick:m,chartId:v,selection:b,linkedHover:x,loading:k,loadingContent:w,legendInteraction:S,stroke:A,strokeWidth:M,opacity:C}=e,{width:L,height:T,enableHover:E,showLabels:D=!0,title:I,description:N,summary:P,accessibleTable:_}=t,R=Wl({nodes:_u(()=>Nl(n??null,i),[n,i]),edges:void 0,inferNodes:!1,colorBy:u?void 0:c,colorScheme:l,showLegend:!1,legendInteraction:S,selection:b,linkedHover:x,onObservation:y,onClick:m,mobileInteraction:t.mobileInteraction,mobileSemantics:t.mobileSemantics,chartType:"CirclePack",chartId:v,marginDefaults:t.marginDefaults,userMargin:r,width:L,height:T,loading:k,loadingContent:w}),W=_u(()=>new Map,[]),$=_u(()=>e=>{const t={stroke:"currentColor",strokeWidth:1,strokeOpacity:.3,fillOpacity:h};return t.fill=u?Jt[(e.depth||0)%Jt.length]:c?tn(e.data||e,c,R.colorScale):Ml(void 0,R.themeCategorical,l,void 0,W),t},[c,u,R.colorScale,h,R.themeCategorical,l,W]),O=_u(()=>$l($,{stroke:A,strokeWidth:M,opacity:C}),[$,A,M,C]),B=_u(()=>_l(a),[a]),z=Vl({componentName:"CirclePack",data:n});return z?Ru(us,{componentName:"CirclePack",message:z,width:L,height:T}):R.loadingEl?R.loadingEl:Ru(gs,{componentName:"CirclePack",width:L,height:T,children:Ru(xc,{chartType:"circlepack",...null!=n&&{data:n},size:[L,T],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:R.margin,nodeIDAccessor:s,childrenAccessor:i,hierarchySum:B,padding:f,nodeStyle:O,colorBy:c,colorScheme:R.effectivePalette,colorByDepth:u,nodeLabel:D?d||s:void 0,showLabels:D,enableHover:E,tooltipContent:!1===g?()=>null:or(g)||void 0,...Kl({linkedHover:x,selection:b,onObservation:y,onClick:m,mobileInteraction:R.mobileInteraction,customHoverBehavior:R.customHoverBehavior,customClickBehavior:R.customClickBehavior,linkedHoverInClickPredicate:!1}),...S&&"none"!==S&&{legendHoverBehavior:R.legendState.onLegendHover,legendClickBehavior:R.legendState.onLegendClick,legendHighlightedCategory:R.legendState.highlightedCategory,legendIsolatedCategories:R.legendState.isolatedCategories},className:o,title:I,description:N,summary:P,accessibleTable:_,...null!=e.animate&&{animate:e.animate},...p})})}Wu.displayName="CirclePack";import{useMemo as $u}from"react";import{jsx as Ou}from"react/jsx-runtime";var Bu=Jt;function zu(e){const t=El(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:n,margin:r,className:o,childrenAccessor:i="children",nodeIdAccessor:a="name",colorBy:s,colorScheme:c,colorByDepth:l=!1,orbitMode:u="flat",orbitSize:d=2.95,speed:h=.25,revolution:f,revolutionStyle:g,eccentricity:p=1,showRings:y=!0,nodeRadius:m=6,showLabels:v=!1,animated:b=!0,tooltip:x,foregroundGraphics:k,annotations:w,frameProps:S={},onObservation:A,onClick:M,chartId:C,selection:L,linkedHover:T,loading:E,loadingContent:D,stroke:I,strokeWidth:N,opacity:P}=e,{width:_,height:R,enableHover:W,title:$,description:O,summary:B,accessibleTable:z}=t,j=Wl({nodes:$u(()=>Nl(n,i),[n,i]),edges:void 0,inferNodes:!1,colorBy:l?void 0:s,colorScheme:c,showLegend:!1,legendInteraction:void 0,selection:L,linkedHover:T,onObservation:A,onClick:M,mobileInteraction:t.mobileInteraction,mobileSemantics:t.mobileSemantics,chartType:"OrbitDiagram",chartId:C,marginDefaults:{top:10,right:10,bottom:10,left:10},userMargin:r,width:_,height:R,loading:E,loadingContent:D}),H=$u(()=>new Map,[]),{colorScale:F,customClickBehavior:Y,customHoverBehavior:X,themeCategorical:G}=j,V=$u(()=>{if(Array.isArray(c))return c;const e=Kt[c];return Array.isArray(e)?e:Qt},[c]),q=$u(()=>e=>{const t={stroke:"#fff",strokeWidth:1},n=0===(e.depth??0);return t.fill=l?n?V[0]:Bu[(e.depth||0)%Bu.length]:s?tn(e.data||e,s,F):Ml(void 0,G,c,void 0,H),t.opacity=n?1:.85,t},[s,l,F,V,G,c,H]),U=$u(()=>$l(q,{stroke:I,strokeWidth:N,opacity:P}),[q,I,N,P]),K=$u(()=>()=>({stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1}),[]),Q=$u(()=>e=>{X(e&&e.data&&void 0!==e.data.data?{...e,data:e.data.data}:e)},[X]),Z=$u(()=>e=>{Y(e&&e.data&&void 0!==e.data.data?{...e,data:e.data.data}:e)},[Y]),J=Vl({componentName:"OrbitDiagram",data:n});return J?Ou(us,{componentName:"OrbitDiagram",message:J,width:_,height:R}):j.loadingEl?j.loadingEl:Ou(gs,{componentName:"OrbitDiagram",width:_,height:R,children:Ou(xc,{chartType:"orbit",...null!=n&&{data:n},size:[_,R],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:j.margin,nodeIDAccessor:a,childrenAccessor:i,nodeStyle:U,edgeStyle:K,colorBy:s,colorScheme:j.effectivePalette,colorByDepth:l,nodeSize:m,nodeLabel:v?a:void 0,showLabels:v,enableHover:!b&&W,tooltipContent:b?void 0:!1===x?()=>null:or(x)||void 0,...Kl({linkedHover:T,selection:L,onObservation:A,onClick:M,mobileInteraction:j.mobileInteraction,customHoverBehavior:Q,customClickBehavior:Z,linkedHoverInClickPredicate:!1}),foregroundGraphics:k,annotations:w,className:o,title:$,description:O,summary:B,orbitMode:u,orbitSize:d,orbitSpeed:h,orbitRevolution:f,orbitRevolutionStyle:g,orbitEccentricity:p,orbitShowRings:y,orbitAnimated:b,accessibleTable:z,...null!=e.animate&&{animate:e.animate},...S})})}zu.displayName="OrbitDiagram";import{useMemo as ju,useState as Hu,useRef as Fu,useCallback as Yu}from"react";import{scaleTime as Xu}from"d3-scale";import{forwardRef as Gu}from"react";function Vu(e,t,n){const r=[],o=new Set(e.map(e=>e.id)),i=Array.isArray(n)&&2===n.length,a=i&&Number.isFinite(n[0])&&Number.isFinite(n[1]);i&&a&&a&&n[1]>=n[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)o.has(e.source)||r.push({kind:"missing-node",id:e.id,endpoint:"source",nodeId:e.source}),o.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}function qu(e){return"invalid-node-time"===e.kind?`node ${e.id} has an invalid xExtent (must be [start, end] with start <= end)`:"invalid-edge-time"===e.kind?`edge ${e.id} has an invalid startTime or endTime`:"invalid-domain"===e.kind?"time domain must be a 2-tuple of finite times [start, end] with start <= end":"invalid-value"===e.kind?`edge ${e.id} must have a positive finite value`:"missing-node"===e.kind?`edge ${e.id} references missing ${e.endpoint} node "${e.nodeId}"`:"backward-edge"===e.kind?`edge ${e.id} (${e.source}->${e.target}) ends before it starts`:e.kind}function Uu(e,t,n){const r=t.incoming[e.id],o=t.outgoing[e.id],i=[];for(const e of r)i.push({time:e.endTime,delta:+e.value,edge:e,kind:"in",side:n.get(e.id).targetSide});for(const e of o)i.push({time:e.startTime,delta:-e.value,edge:e,kind:"out",side:n.get(e.id).sourceSide});const a={create:0,in:1,"transfer-out":2,"transfer-in":3,out:4},s=()=>{i.sort((e,t)=>e.time-t.time||(a[e.kind]??99)-(a[t.kind]??99))},c=i.length?function(e,t=1/0){let n=t;for(const t of e)n>t&&(n=t);return n}(i.map(e=>e.time)):null,l=Array.isArray(e.xExtent)&&Number.isFinite(e.xExtent[0])?e.xExtent[0]:null,u=null!=l?l-1:null!=c&&Number.isFinite(c)?c-1:null,d=[...new Set(i.map(e=>e.time))].sort((e,t)=>e-t),h=new Map;for(let e=1;d.length>e;e++)h.set(d[e],d[e-1]);const f=e=>{const t=h.get(e);return null!=t?(t+e)/2:null!=u?u:e};s();const g=[];let p=0,y=0;for(const e of i)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",r=Math.min(n,"top"===t?p:y);if(r>0){const o=f(e.time);g.push({time:o,delta:-r,kind:"transfer-out",side:t}),g.push({time:o,delta:+r,kind:"transfer-in",side:e.side}),"top"===t?p-=r:y-=r,"top"===e.side?p+=r:y+=r,n-=r}n>0&&null!==u&&(g.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}i.push(...g),s();let m=0,v=0,b=0,x=0,k=0;const w=[],S=new Map;for(const e of i){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;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?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 A=[];let M=0;for(;w.length>M;){let e=M;for(;w.length>e+1&&w[e+1].t===w[M].t;)e++;A.push(w[M]);for(let t=M+1;e>=t;t++){const e=A[A.length-1];w[t].topMass===e.topMass&&w[t].botMass===e.botMass||A.push(w[t])}M=e+1}const C=Array.isArray(e.xExtent)&&Number.isFinite(e.xExtent[1])?e.xExtent[1]:null;let L=null;for(const e of o)null!=e.systemInTime&&Number.isFinite(e.systemInTime)&&e.startTime>e.systemInTime&&(null===L||L>e.systemInTime)&&(L=e.systemInTime);let T=null;for(const e of r)null!=e.systemOutTime&&Number.isFinite(e.systemOutTime)&&e.systemOutTime>e.endTime&&(null===T||e.systemOutTime>T)&&(T=e.systemOutTime);if(A.length>0){const e=A[A.length-1],t=Math.max(null!=C?C:-1/0,null!=T?T:-1/0);Number.isFinite(t)&&t>e.t&&e.topMass+e.botMass>0&&A.push({t:t,topMass:e.topMass,botMass:e.botMass});const n=A[0],r=Math.min(null!=l?l:1/0,null!=L?L:1/0);Number.isFinite(r)&&n.t>r&&n.topMass+n.botMass>0&&A.unshift({t:r,topMass:n.topMass,botMass:n.botMass})}return{samples:A,peak:b,topPeak:x,botPeak:k,localAttachments:S}}function Ku(e,t){return t?Math.max(t[0],Math.min(t[1],e)):e}function Qu(e,t){return e.map(e=>({t:Ku(e.t,t),topMass:e.topMass,botMass:e.botMass}))}function Zu(e,t,n){const r=e.value*n;if("out"===e.kind){const o=e.sideMassBefore*n;if("top"===e.side){const e=t-o;return[e,e+r]}const i=t+o;return[i-r,i]}const o=e.sideMassAfter*n;if("top"===e.side){const e=t-o;return[e,e+r]}const i=t+o;return[i-r,i]}function Ju(e,t){let n=0;for(let r=0;t.length>r;r++)for(let o=r+1;t.length>o;o++){const i=t[r],a=t[o];i.source!==a.source&&i.target!==a.target&&i.source!==a.target&&i.target!==a.source&&(Math.min(i.endTime,a.endTime)>Math.max(i.startTime,a.startTime)&&e[a.source]>e[i.source]!=e[a.target]>e[i.target]&&n++)}return n}function ed(e,t){let n=0;for(const r of t)n+=Math.abs(e[r.source]-e[r.target])*(r.value||1);return n}function td(e,t){return 1e3*Ju(e,t)+ed(e,t)}function nd(e,t){return{slots:e.map(e=>({peak:{...e.peak},occupants:e.occupants.slice()})),map:{...t}}}function rd(e,t,n){e.length>8||n.length>40?(function(e,t,n,r=6){const o=e.length;if(1>=o)return;let i=nd(e,t),a=td(t,n);for(let s=0;r>s;s++){const r=Array(o).fill(0),s=Array(o).fill(0);for(const e of n){const n=t[e.source],o=t[e.target];r[n]+=o*(e.value||1),s[n]+=e.value||1,r[o]+=n*(e.value||1),s[o]+=e.value||1}const c=Array.from({length:o},(e,t)=>t).sort((e,t)=>(s[e]>0?r[e]/s[e]:e)-(s[t]>0?r[t]/s[t]:t)),l=c.map(t=>e[t]),u=new Map;c.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 l)e.push(t);const d=td(t,n);if(a>d)a=d,i=nd(e,t);else if(d===a)break}!function(e,t,n){e.length=0;for(const t of n.slots)e.push(t);for(const e of Object.keys(t))delete t[e];for(const e of Object.keys(n.map))t[e]=n.map[e]}(e,t,i)}(e,t,n,6),function(e,t,n,r=6){const o=e.length;if(1>=o)return;let i=td(t,n);for(let a=0;r>a;a++){let r=!1;for(let a=0;o-1>a;a++){const o=e[a];e[a]=e[a+1],e[a+1]=o;for(const e of Object.keys(t))t[e]===a?t[e]=a+1:t[e]===a+1&&(t[e]=a);const s=td(t,n);if(i>s)i=s,r=!0;else{const n=e[a];e[a]=e[a+1],e[a+1]=n;for(const e of Object.keys(t))t[e]===a?t[e]=a+1:t[e]===a+1&&(t[e]=a)}}if(!r)break}}(e,t,n,6)):function(e,t,n){const r=e.length;if(1>=r)return;const o={...t},i=Object.keys(o),a=Array.from({length:r},(e,t)=>t),s=a.slice(),c={...o};let l=a.slice(),u=1/0;const d=()=>{for(const e of i)c[e]=s[o[e]];const e=td(c,n);u>e&&(u=e,l=a.slice())},h=(e,t)=>{const n=a[e],r=a[t];a[e]=r,a[t]=n,s[n]=t,s[r]=e};d();const f=Array(r).fill(0);let g=0;for(;r>g;)g>f[g]?(h(g%2==0?0:f[g],g),d(),f[g]++,g=0):(f[g]=0,g++);const p=l.map(t=>e[t]),y=new Map;l.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 od(e,t,n,r,o){const{plotH:i,padding:a,valueScale:s,packing:c,laneOrder:l,lifetimeMode:u="full"}=o,d={},h={};for(const t of e)d[t.id]=n[t.id].topPeak||0,h[t.id]=n[t.id].botPeak||0;const f="half"===u,g={};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 o=null!=e&&Number.isFinite(e)?e:1/0,i=null!=n&&Number.isFinite(n)?n:-1/0;for(const e of r.outgoing[t.id]){o>e.startTime&&(o=e.startTime),null!=e.systemInTime&&Number.isFinite(e.systemInTime)&&o>e.systemInTime&&(o=e.systemInTime);const t=f?(e.startTime+e.endTime)/2:e.endTime;t>i&&(i=t)}for(const e of r.incoming[t.id]){const t=f?(e.startTime+e.endTime)/2:e.startTime;o>t&&(o=t),e.endTime>i&&(i=e.endTime),null!=e.systemOutTime&&Number.isFinite(e.systemOutTime)&&e.systemOutTime>i&&(i=e.systemOutTime)}g[t.id]={start:Number.isFinite(o)?o:null,end:Number.isFinite(i)?i:null}}const p={},y=[];if("reuse"===c){const n=new Map;for(const t of e)n.set(t.id,0);const o=new Map;for(const t of e)o.set(t.id,0);for(const e of t)o.set(e.target,(o.get(e.target)??0)+1);const i=[];for(const t of e)0===(o.get(t.id)??0)&&i.push(t.id);for(;i.length;){const e=i.shift();for(const t of r.outgoing[e]??[]){const r=(n.get(e)??0)+1;r>(n.get(t.target)??0)&&n.set(t.target,r),o.set(t.target,o.get(t.target)-1),0===o.get(t.target)&&i.push(t.target)}}const a=[...e].filter(e=>null!==g[e.id].start).sort((e,t)=>{const r=n.get(e.id)??0,o=n.get(t.id)??0;return r!==o?r-o:g[e.id].start-g[t.id].start}),s=e.filter(e=>null===g[e.id].start);for(const e of[...a,...s]){const t=g[e.id];let n=-1;for(let e=0;y.length>e;e++){const r=y[e].occupants[y[e].occupants.length-1];if(null===t.start||void 0===r||t.start>=r.end){n=e;break}}-1===n&&(y.push({occupants:[],peak:{topPeak:0,botPeak:0}}),n=y.length-1),y[n].occupants.push({id:e.id,end:t?.end??-1/0}),y[n].peak.topPeak=Math.max(y[n].peak.topPeak,d[e.id]),y[n].peak.botPeak=Math.max(y[n].peak.botPeak,h[e.id]),p[e.id]=n}}else e.forEach((e,t)=>{y.push({occupants:[{id:e.id,end:g[e.id]?.end??-1/0}],peak:{topPeak:d[e.id],botPeak:h[e.id]}}),p[e.id]=t});let m=null,v=null,b=null,x=null;const k=()=>{m=Ju(p,t),b=ed(p,t)},w=()=>{v=Ju(p,t),x=ed(p,t)};"crossing-min"===l?(k(),rd(y,p,t),w()):"inside-out"===l?(k(),function(e,t){const n=e.length;if(1>=n)return;const r=e=>e.peak.topPeak+e.peak.botPeak,o=e.map((e,t)=>({slot:e,idx:t})).sort((e,t)=>r(t.slot)-r(e.slot)),i=Array(n),a=Math.floor((n-1)/2);i[a]=o[0].idx;let s=a-1,c=a+1;for(let e=1;o.length>e;e++)e%2==1&&n>c||0>s?i[c++]=o[e].idx:i[s--]=o[e].idx;const l=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 l)e.push(t)}(y,p),w()):"crossing-min+inside-out"===l&&(k(),rd(y,p,t),function(e,t,n){const r=e.length;if(1>=r)return;const o=e.map(e=>{return{slot:e,size:(t=e,t.peak.topPeak+t.peak.botPeak)};var t}).sort((e,t)=>t.size-e.size),i=Math.floor((r-1)/2);let a=td(t,n);for(const{slot:s}of o){const o=e.indexOf(s);if(0>o)continue;const c=i;if(o===c)continue;const l=e[o];e.splice(o,1),e.splice(c,0,l);const u=new Map;for(let e=0;r>e;e++)u.set(e,e);if(c>o){for(let e=o+1;c>=e;e++)u.set(e,e-1);u.set(o,c)}else{for(let e=c;o>e;e++)u.set(e,e+1);u.set(o,c)}for(const e of Object.keys(t))t[e]=u.get(t[e]);const d=td(t,n);if(d>a){const n=e[c];e.splice(c,1),e.splice(o,0,n);const i=new Map;for(let e=0;r>e;e++)i.set(e,e);if(o>c){for(let e=c+1;o>=e;e++)i.set(e,e-1);i.set(c,o)}else{for(let e=o;c>e;e++)i.set(e,e+1);i.set(c,o)}for(const e of Object.keys(t))t[e]=i.get(t[e])}else a=d}}(y,p,t),w());const S=y.map(e=>{const t=new Map;for(const r of e.occupants){const e=n[r.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])}),A=(e,t)=>{let n={top:0,bot:0};for(const[r,o]of e){if(r>t)break;n=o}return n},M=[];for(let e=0;y.length-1>e;e++){const t=S[e],n=S[e+1],r=new Set([...t.map(e=>e[0]),...n.map(e=>e[0])]);let o=0;for(const e of r){const r=A(t,e),i=A(n,e);r.bot+i.top>o&&(o=r.bot+i.top)}M.push(o)}const C=[];let L=a+(y[0]?.peak.topPeak??0)*s;y.length>0&&C.push(L);for(let e=1;y.length>e;e++)L+=M[e-1]*s+a,C.push(L);if(y.length>0&&(L+=y[y.length-1].peak.botPeak*s+a),L>i){const e=i/L;for(let t=0;C.length>t;t++)C[t]*=e}const T=0===y.length?0:y[0].peak.topPeak+M.reduce((e,t)=>e+t,0)+y[y.length-1].peak.botPeak,E={};for(const t of e)E[t.id]=C[p[t.id]];return{effectiveSlotsHeight:T,centerlines:E,laneLifetime:g,slots:y,slotByNode:p,slotCenter:C,crossingsBefore:m,crossingsAfter:v,lengthBefore:b,lengthAfter:x}}var id=e=>{const{bands:t=[],ribbons:n=[],showLabels:r=!0}=e.config,o=[];for(const e of n)o.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 n=e.gradientStubs[t];o.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 t)o.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:o,labels:i}};function ad(e){return"object"==typeof e&&null!==e&&"__kind"in e&&("band"===e.__kind||"ribbon"===e.__kind)}import{Fragment as sd,jsx as cd,jsxs as ld}from"react/jsx-runtime";function ud(e){return null==e?NaN:e instanceof Date?e.getTime():"number"==typeof e?e:new Date(e).getTime()}function dd(e,t){return"function"==typeof e?e(t):t[e]}var hd=Gu(function(e,t){const{nodes:n,edges:r,domain:o,axisTicks:i=[],nodeIdAccessor:a="id",sourceAccessor:s="source",targetAccessor:c="target",valueAccessor:l="value",startTimeAccessor:u="startTime",endTimeAccessor:d="endTime",systemInTimeAccessor:h,systemOutTimeAccessor:f,xExtentAccessor:g="xExtent",edgeIdAccessor:p="id",colorBy:y,colorScheme:m,showLegend:v,legendPosition:b="right",pairing:x="temporal",packing:k="reuse",laneOrder:w="crossing-min",ribbonLane:S="both",lifetimeMode:A="half",showLaneRails:M=!1,showQualityReadout:C=!1,showLabels:L=!0,width:T=600,height:E=400,margin:D,title:I,description:N,summary:P,accessibleTable:_,responsiveWidth:R,responsiveHeight:W,loading:$,loadingContent:O,emptyContent:B,edgeOpacity:z=.35,timeFormat:j,valueFormat:H,tooltip:F,enableHover:Y=!0,onObservation:X,onClick:G,showParticles:V=!1,particleStyle:q,chartId:U,frameProps:K={}}=e,[Q,Z]=Hu([]),[J,ee]=Hu([]),te=Fu(Q),ne=Fu(J);te.current=Q,ne.current=J;const re=Yu(e=>{te.current=e,Z(e)},[]),oe=Yu(e=>{ne.current=e,ee(e)},[]),ie=void 0!==r,ae=Oa(ie?r:Q),se=ju(()=>{const e=Oa(n??[]),t=J;if(0===e.length&&0===t.length)return Pl([],ae,s,c);const r=new Set,o=[];for(const t of e){const e=dd(a,t)+"";r.has(e)||(r.add(e),o.push(t))}for(const e of t){const t=dd(a,e)+"";r.has(t)||(r.add(t),o.push(e))}const i=Pl([],ae,s,c);for(const e of i)r.has(e.id)||(r.add(e.id),o.push(e));return o},[n,J,ae,a,s,c]),ce=Fu(null),le=Yu((e,t)=>{const n=dd(p,e);return null!=n?n+"":`${dd(s,e)}-${dd(c,e)}-${t}`},[p,s,c]),ue=Yu(e=>{if(null==e)return!1;const t=e;return null!=dd(s,t)&&null!=dd(c,t)},[s,c]);wc(t,{variant:"network",frameRef:ce,overrides:{push(e){if(ue(e)){if(ie)return void console.warn("ProcessSankey.push: edge ignored — `edges` prop is controlled.");re([...te.current,e])}else oe([...ne.current,e])},pushMany(e){const t=[],n=[];for(const r of e)ue(r)?t.push(r):n.push(r);t.length>0&&(ie?console.warn("ProcessSankey.pushMany: edges ignored — `edges` prop is controlled."):re([...te.current,...t])),n.length>0&&oe([...ne.current,...n])},remove(e){const t=new Set(Array.isArray(e)?e:[e]),n=[];if(!ie){const e=te.current,r=[];for(let o=0;e.length>o;o++){const i=e[o];t.has(le(i,o))?n.push(i):r.push(i)}r.length!==e.length&&re(r)}const r=ne.current,o=[];for(const e of r){const r=dd(a,e)+"";t.has(r)?n.push(e):o.push(e)}return o.length!==r.length&&oe(o),n},update(e,t){const n=new Set(Array.isArray(e)?e:[e]),r=[];if(!ie){let e=!1;const o=te.current.map((o,i)=>n.has(le(o,i))?(r.push(o),e=!0,t(o)):o);e&&re(o)}let o=!1;const i=ne.current.map(e=>{const i=dd(a,e)+"";return n.has(i)?(r.push(e),o=!0,t(e)):e});return o&&oe(i),r},clear(){ie||re([]),oe([]),ce.current?.clear()},getData:()=>ae??[],getScales:()=>null}});const de=le,he=Yu(e=>dd(a,e)+"",[a]),{nodes:fe,edges:ge,domain:pe,rawNodeById:ye,rawEdgeById:me}=ju(()=>{const e=(se??[]).map(e=>{const t={id:he(e),__raw:e},n=g?dd(g,e):null;if(Array.isArray(n)&&2===n.length){const e=ud(n[0]),r=ud(n[1]);Number.isFinite(e)&&Number.isFinite(r)&&(t.xExtent=[e,r])}return t}),t=(ae??[]).map((e,t)=>{const n={id:de(e,t),source:dd(s,e)+"",target:dd(c,e)+"",value:Number(dd(l,e)),startTime:ud(dd(u,e)),endTime:ud(dd(d,e)),__raw:e};if(h){const t=ud(dd(h,e));Number.isFinite(t)&&(n.systemInTime=t)}if(f){const t=ud(dd(f,e));Number.isFinite(t)&&(n.systemOutTime=t)}return n}),n=[ud(o[0]),ud(o[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:n,rawNodeById:r,rawEdgeById:i}},[se,ae,o,he,de,g,s,c,l,u,d,h,f]),ve=Wl({nodes:se,edges:ae,inferNodes:!1,nodeIdAccessor:a,sourceAccessor:s,targetAccessor:c,colorBy:y,colorScheme:m,showLegend:!1,legendPosition:b,selection:void 0,linkedHover:void 0,onObservation:X,onClick:G,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,chartType:"ProcessSankey",chartId:U,marginDefaults:{top:30,right:80,bottom:40,left:80},userMargin:D,width:T,height:E,loading:$,loadingContent:O,emptyContent:B}),be=(v??!!y)&&!!y,xe=Yu(e=>null!=D&&("number"==typeof D||null!=D[e]),[D]),we=ju(()=>{const e={...ve.margin};return be&&("right"===b&&!xe("right")&&140>e.right?e.right=140:"bottom"===b&&!xe("bottom")&&80>e.bottom&&(e.bottom=80)),e},[ve.margin,be,b,xe]),Se=T-we.left-we.right,Ae=E-we.top-we.bottom,Me=ju(()=>Vu(fe,ge,pe),[fe,ge,pe]),Ce=ju(()=>Me.length>0?null:function(e,t,n){const{plotH:r,pairing:o="temporal",packing:i="reuse",laneOrder:a="crossing-min",lifetimeMode:s="half"}=n,c=function(e,t){const n={},r={};for(const t of e)n[t.id]=[],r[t.id]=[];for(const e of t)r[e.source]&&r[e.source].push(e),n[e.target]&&n[e.target].push(e);return{incoming:n,outgoing:r}}(e,t),l=function(e,t,n,r="value"){const o="temporal"===r?(e,t)=>e.endTime-t.endTime:(e,t)=>t.value-e.value,i="temporal"===r?(e,t)=>e.startTime-t.startTime:(e,t)=>t.value-e.value,a=new Map;for(const e of t)a.set(e.id,{});const s=(e,t)=>{const n=new Map;for(const r of e){const e=r[t];n.has(e)||n.set(e,{partner:e,edges:[],total:0,earliestStart:1/0,latestEnd:-1/0});const o=n.get(e);o.edges.push(r),o.total+=r.value,o.earliestStart=Math.min(o.earliestStart,r.startTime),o.latestEnd=Math.max(o.latestEnd,r.endTime)}const a=[...n.values()];a.sort("temporal"===r?(e,n)=>"target"===t?e.earliestStart-n.earliestStart:e.latestEnd-n.latestEnd:(e,t)=>t.total-e.total);for(const e of a)e.edges.sort("target"===t?i:o);return a};for(const t of e){const e=n.outgoing[t.id],r=n.incoming[t.id];if(0===r.length)s(e,"target").forEach((e,t)=>{const n=t%2==0?"top":"bot";for(const t of e.edges)a.get(t.id).sourceSide=n});else if(0===e.length)s(r,"source").forEach((e,t)=>{const n=t%2==0?"top":"bot";for(const t of e.edges)a.get(t.id).targetSide=n});else{const t=s(r,"source"),n=s(e,"target"),o=Math.max(t.length,n.length);for(let e=0;o>e;e++){const r=e%2==0?"top":"bot";if(t[e])for(const n of t[e].edges)a.get(n.id).targetSide=r;if(n[e])for(const t of n[e].edges)a.get(t.id).sourceSide=r}}}return a}(e,t,c,o);let u={};for(const t of e)u[t.id]=Uu(t,c,l);const d=od(e,t,u,c,{plotH:r,padding:12,valueScale:1,packing:i,laneOrder:a,lifetimeMode:s}),h=new Set;for(const e of t){const t=d.slotByNode[e.source],n=d.slotByNode[e.target];if(void 0===t||void 0===n)continue;const r=l.get(e.id);t!==n?t>n?(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=c.outgoing[t.id],n=c.incoming[t.id],r=new Set(e.map(e=>l.get(e.id).sourceSide)),o=new Set(n.map(e=>l.get(e.id).targetSide));if(1===r.size&&n.length>0){const e=[...r][0];for(const t of n)d.slotByNode[t.source]===d.slotByNode[t.target]&&(l.get(t.id).targetSide=e)}if(1===o.size&&e.length>0){const t=[...o][0];for(const n of e)d.slotByNode[n.source]===d.slotByNode[n.target]&&(l.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 r=()=>{const t={inTop:0,inBot:0,outTop:0,outBot:0};for(const n of e)"top"===l.get(n.id).targetSide?t.inTop+=n.value:t.inBot+=n.value;for(const e of n)"top"===l.get(e.id).sourceSide?t.outTop+=e.value:t.outBot+=e.value;return t},o=(e,t)=>{const o=r(),i="top"===e?o.outTop-o.inTop:o.outBot-o.inBot,a="top"===t?o.inTop-o.outTop:o.inBot-o.outBot;if(0>=i||0>=a)return!1;const s=Math.min(i,a),c=n.filter(t=>!h.has(t.id)&&l.get(t.id).sourceSide===e&&s>=t.value).sort((e,t)=>t.value-e.value);return 0!==c.length&&(l.get(c[0].id).sourceSide=t,!0)};let i=n.length+1;for(;i-- >0&&(o("top","bot")||o("bot","top")););}u={};for(const t of e)u[t.id]=Uu(t,c,l);const f=od(e,t,u,c,{plotH:r,padding:12,valueScale:1,packing:i,laneOrder:a,lifetimeMode:s}),g=f.effectiveSlotsHeight??f.slots.reduce((e,t)=>e+t.peak.topPeak+t.peak.botPeak,0),p=Math.min(12,.35*r/Math.max(f.slots.length+1,1)),y=g>0?Math.max(0,(r-p*(f.slots.length+1))/g):1,m=od(e,t,u,c,{plotH:r,padding:p,valueScale:y,packing:i,laneOrder:a,lifetimeMode:s});return{nodeData:u,sides:l,valueScale:y,padding:p,compressedPadding:12>p,centerlines:m.centerlines,laneLifetime:m.laneLifetime,slots:m.slots,slotByNode:m.slotByNode,crossingsBefore:m.crossingsBefore,crossingsAfter:m.crossingsAfter,lengthBefore:m.lengthBefore,lengthAfter:m.lengthAfter}}(fe,ge,{plotH:Ae,pairing:x,packing:k,laneOrder:w,lifetimeMode:A}),[Me,fe,ge,Ae,x,k,w,A]),Le=ju(()=>Xu().domain(pe).range([0,Se]),[pe,Se]),Te=Yu((e,t)=>{if(y&&se){const t=ye.get(e);if(t)return tn(t,y,ve.colorScale)}return ve.effectivePalette[t%ve.effectivePalette.length]||"#475569"},[y,se,ye,ve.colorScale,ve.effectivePalette]),Ee=ju(()=>{const e=new Map;return fe.forEach((t,n)=>e.set(t.id,n)),e},[fe]),De=ju(()=>{if(!Ce)return{bands:[],ribbons:[]};const{centerlines:e,nodeData:t,valueScale:n}=Ce,r=[],o=[];return fe.forEach((o,i)=>{const a=t[o.id];if(!a||0===a.samples.length)return;const s=function(e,t,n,r,o){if(0===e.length)return null;const i=Qu(e,o),a=e=>t-i[e].topMass*n,s=e=>t+i[e].botMass*n;let c=`M${r(i[0].t)},${a(0)}`;for(let e=1;i.length>e;e++)c+=` L${r(i[e].t)},${a(e)}`;c+=` L${r(i[i.length-1].t)},${s(i.length-1)}`;for(let e=i.length-2;e>=0;e--)c+=` L${r(i[e].t)},${s(e)}`;return c+" Z"}(a.samples,e[o.id],n,Le,pe);if(!s)return;const c=Qu(a.samples,pe),l=c.find(e=>e.topMass+e.botMass>0)||c[0],u=e[o.id]+(l.botMass-l.topMass)*n/2,d=Te(o.id,i),h=ye.get(o.id)??o,f=function(e,t,n,r,o){const i=n.nodeData[e];if(!i||0===i.samples.length)return[];const a=n.valueScale,s=n.centerlines[e],c=Qu(i.samples,o),l=c.find(e=>e.topMass+e.botMass>0)||c[0],u=[...c].reverse().find(e=>e.topMass+e.botMass>0)||c[c.length-1],d=r(l.t),h=r(u.t),f=e=>r(Ku(e,o)),g=[],p=(e,t,n,r)=>`M${e},${t} L${n},${t} L${n},${r} L${e},${r} Z`;for(const n of t){if(n.source===e&&null!=n.systemInTime&&Number.isFinite(n.systemInTime)){const e=i.localAttachments.get(n.id);if(e&&"out"===e.kind&&n.startTime>n.systemInTime){const t=f(n.systemInTime),r=f(n.startTime),o=t-20,i=Math.max(d,o);if(r>i){const[n,c]=Zu(e,s,a);g.push({pathD:p(i,n,r,c),x0:o,x1:t,from:0,to:1})}}}if(n.target===e&&null!=n.systemOutTime&&Number.isFinite(n.systemOutTime)){const e=i.localAttachments.get(n.id);if(e&&"in"===e.kind&&n.systemOutTime>n.endTime){const t=f(n.systemOutTime),r=f(n.endTime),o=t+20,i=Math.min(h,o);if(i>r){const[n,c]=Zu(e,s,a);g.push({pathD:p(r,n,i,c),x0:t,x1:o,from:1,to:0})}}}}return g}(o.id,ge,Ce,Le,pe);r.push({id:o.id,pathD:s,fill:d,stroke:d,strokeWidth:.5,...f.length>0&&{gradientStubs:f},rawDatum:h,labelX:Le(l.t)-4,labelY:u,labelText:o.id})}),ge.forEach(r=>{const i=t[r.source]?.localAttachments.get(r.id),a=t[r.target]?.localAttachments.get(r.id);if(!i||!a)return;const s=Ee.get(r.source)??0,c=Te(r.source,s),l=function(e,t,n,r,o,i,a,s){const c=o,l=e=>s?Math.max(s[0],Math.min(s[1],e)):e,u=i(l(e.time)),d=i(l(n.time)),h=e.value*c,f=n.value*c,g=e.sideMassBefore*c,p=n.sideMassAfter*c;let y,m,v,b;"top"===e.side?(y=t-g,m=y+h):(m=t+g,y=m-h),"top"===n.side?(v=r-p,b=v+f):(b=r+p,v=b-f);const x="source"===a?u+.85*(d-u):"target"===a?u+.15*(d-u):(u+d)/2;return{sx:u,sTop:y,sBot:m,tx:d,tTop:v,tBot:b,cp1X:x,cp2X:x}}(i,e[r.source],a,e[r.target],n,Le,S,pe),{pathD:u,bezier:d}=ke(l),h=me.get(r.id)??r;o.push({id:r.id,pathD:u,fill:c,opacity:z,rawDatum:h,bezier:d})}),{bands:r,ribbons:o}},[Ce,fe,ge,Le,pe,Te,ye,me,S,z,Ee]),Ie=ju(()=>({bands:De.bands,ribbons:De.ribbons,showLabels:L}),[De,L]),Ne=ju(()=>{if(!be||!y)return;const e=new Map;(se??[]).forEach((t,n)=>{const r=dd(y,t),o=null==r?"":r+"";o&&!e.has(o)&&e.set(o,{label:o,color:Te(he(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},[be,y,se,Te,he]),Pe=ju(()=>!1!==F&&Y?void 0===F||!0===F?null:or(F)||null:null,[F,Y]),_e=Yu(e=>j?j(new Date(e)):Number.isFinite(e)?1e10>Math.abs(e)?Number.isInteger(e)?e+"":e.toFixed(2):new Date(e).toISOString().slice(0,10):"",[j]),Re=Yu(e=>H?H(e):e+"",[H]),We=Yu(e=>{if(!e||!e.data)return null;const t=e.data;if(!ad(t))return null;const n=t.data;if(Pe)return Pe(n);if("band"===t.__kind){const e=t.id,n=Ce?function(e){if(!e)return[];const t=new Set,n=[];for(const r of e.samples){const e=r.topMass+r.botMass,o=`${r.t}:${e}`;t.has(o)||(t.add(o),n.push({t:r.t,total:e}))}return n}(Ce.nodeData[e]):[],r=5,o=n.length>r?n.length:null,i=function(e,t=5){if(t>=e.length)return e.slice();const n=[...e].sort((e,t)=>e.total-t.total),r=n.length-1,o=[{...n[0],mark:"min"},{...n[Math.floor(.25*r)],mark:"q25"},{...n[Math.floor(.5*r)],mark:"median"},{...n[Math.floor(.75*r)],mark:"q75"},{...n[r],mark:"max"}],i=new Set,a=[];for(const e of o)i.has(e.t)||(i.add(e.t),a.push(e));return a.sort((e,t)=>e.t-t.t)}(n,r);return ld("div",{style:{minWidth:160},children:[cd("div",{style:{fontWeight:600,marginBottom:4},children:e}),i.length>0&&ld("table",{style:{borderCollapse:"collapse",fontSize:11,width:"100%"},children:[cd("thead",{children:ld("tr",{style:{opacity:.6},children:[cd("th",{style:{textAlign:"left",fontWeight:500,paddingRight:8},children:"Time"}),cd("th",{style:{textAlign:"right",fontWeight:500},children:"Mass"}),null!=o&&cd("th",{})]})}),cd("tbody",{children:i.map((e,t)=>ld("tr",{children:[cd("td",{style:{paddingRight:8},children:_e(e.t)}),cd("td",{style:{textAlign:"right"},children:Re(e.total)}),null!=o&&cd("td",{style:{textAlign:"right",paddingLeft:8,opacity:.55},children:e.mark})]},t))})]}),null!=o&&ld("div",{style:{marginTop:4,fontSize:10,opacity:.55},children:["showing ",i.length," of ",o," samples"]})]})}const r=n,o=dd(s,r),i=dd(c,r),a=dd(l,r),h=dd(u,r),f=dd(d,r);return ld("div",{style:{minWidth:160},children:[ld("div",{style:{fontWeight:600,marginBottom:4},children:[o+""," → ",i+""]}),ld("div",{style:{display:"grid",gridTemplateColumns:"auto 1fr",columnGap:8,fontSize:11},children:[null!=a&&ld(sd,{children:[cd("span",{style:{opacity:.6},children:"value"}),cd("span",{style:{textAlign:"right"},children:Re(Number(a))})]}),null!=h&&ld(sd,{children:[cd("span",{style:{opacity:.6},children:"start"}),cd("span",{style:{textAlign:"right"},children:_e(ud(h))})]}),null!=f&&ld(sd,{children:[cd("span",{style:{opacity:.6},children:"end"}),cd("span",{style:{textAlign:"right"},children:_e(ud(f))})]})]})]})},[Ce,Pe,_e,Re,s,c,l,u,d]),$e=ju(()=>{if(!Ce)return null;const{centerlines:e,laneLifetime:t,nodeData:n,valueScale:r,compressedPadding:o,crossingsBefore:a,crossingsAfter:s,lengthBefore:c,lengthAfter:l}=Ce;let u=null,d=null;for(const e of fe){const n=t[e.id];if(!n||null===n.start||null===n.end)continue;const r=Le(n.start),o=Le(n.end);(null===u||u>r)&&(u=r),(null===d||o>d)&&(d=o)}const h=e=>Math.max(0,Math.min(Se,e)),f=h(u??0),g=Math.max(f,h(d??Se));return ld("g",{children:[C&&null!==(s??null)&&ld("text",{x:Se,y:-12,fontSize:10,fill:"#94a3b8",textAnchor:"end",children:["crossings: ",a," → ",s," ","edge length: ",Math.round(c)," → ",Math.round(l)]}),o&&cd("text",{x:Se,y:2,fontSize:10,fill:"#94a3b8",textAnchor:"end",children:"dense layout: lane gaps compressed"}),i.map((e,t)=>{const n=Le(ud(e.date));return f-.5>n||n>g+.5?null:cd("line",{x1:n,y1:0,x2:n,y2:Ae,stroke:"#94a3b8",strokeOpacity:.15,strokeDasharray:"2 4"},"grid-"+t)}),M&&fe.map((o,i)=>{const a=t[o.id];if(!a||null===a.start)return null;const s=n[o.id],c=s?{topPeak:s.topPeak,botPeak:s.botPeak}:{topPeak:0,botPeak:0},l=e[o.id]+(c.botPeak-c.topPeak)*r/2,u=Le(a.start),d=Le(a.end),h=Te(o.id,i);return ld("g",{children:[cd("line",{x1:u,y1:l,x2:d,y2:l,stroke:h,strokeOpacity:.35,strokeWidth:1,strokeDasharray:"3 3"}),cd("line",{x1:u,y1:l-4,x2:u,y2:l+4,stroke:h,strokeOpacity:.5}),cd("line",{x1:d,y1:l-4,x2:d,y2:l+4,stroke:h,strokeOpacity:.5})]},"lane-"+o.id)}),cd("line",{x1:f,y1:Ae+4,x2:g,y2:Ae+4,stroke:"#94a3b8"}),i.map((e,t)=>{const n=ud(e.date),r=Le(n);if(f-.5>r||r>g+.5)return null;const o=null!=e.label?e.label:j?j(new Date(n)):"";return ld("g",{transform:`translate(${r},${Ae+4})`,children:[cd("line",{y2:6,stroke:"#94a3b8"}),cd("text",{y:20,textAnchor:"middle",fontSize:11,fill:"#475569",children:o})]},t)})]})},[Ce,i,Le,Se,Ae,M,fe,Te,C,j]),Oe=ju(()=>(se??[]).map(e=>({id:he(e),data:e})),[se,he]),Be=ju(()=>{const e=new Map;for(const t of De.ribbons)t.bezier&&e.set(t.id,t.bezier);return e},[De]),ze=ju(()=>(ae??[]).map((e,t)=>{const n=de(e,t),r=Number(dd(l,e));return{id:n,source:dd(s,e)+"",target:dd(c,e)+"",value:Number.isFinite(r)?r:0,bezier:Be.get(n),data:e}}),[ae,de,s,c,l,Be]),je=ve.loadingEl,He=ve.emptyEl;return Me.length>0?ld("svg",{width:T,height:E,role:"img","aria-label":I??"Process Sankey validation failed",children:[cd("text",{x:20,y:30,fontSize:13,fontWeight:600,fill:"var(--semiotic-danger, #dc2626)",children:"ProcessSankey: data invalid"}),Me.map((e,t)=>cd("text",{x:20,y:56+18*t,fontSize:12,fill:"#64748b",children:"• "+qu(e)},t))]}):je||He||cd(xc,{ref:ce,chartType:"force",nodes:Oe,edges:ze,customNetworkLayout:id,layoutConfig:Ie,size:[T,E],responsiveWidth:R,responsiveHeight:W,margin:we,title:I,description:N??"Temporal process flow with lifetime-bounded node lanes, mass bands, and value-scaled ribbons.",summary:P,accessibleTable:_,enableHover:Y,tooltipContent:!1===F?()=>null:We,backgroundGraphics:$e,showParticles:V,particleStyle:q,legend:Ne,legendPosition:b,onObservation:X,...G&&{customClickBehavior:e=>{if(!e||!e.data||!G)return;const t=e.data;ad(t)&&G(t.data,{x:e.x,y:e.y})}},chartId:U,colorScheme:Array.isArray(m)?m:void 0,...K})});hd.displayName="ProcessSankey";import{forwardRef as fd,useMemo as gd}from"react";import{useMemo as pd,useRef as yd}from"react";import{jsx as md}from"react/jsx-runtime";var vd=fd(function(e,t){const{nodes:n,edges:r,layout:o,layoutConfig:i,onLayoutError:a,nodeIDAccessor:s="id",sourceAccessor:c="source",targetAccessor:l="target",margin:u,className:d,colorBy:h,colorScheme:f,selection:g,linkedHover:p,onObservation:y,onClick:m,chartId:v,annotations:b,autoPlaceAnnotations:x,frameProps:k={}}=e,{frameRef:w,resolved:S,normalizedMargin:A}=function(e){const t=yd(null);return wc(e.imperativeRef,{variant:e.imperativeVariant,frameRef:t}),{frameRef:t,resolved:El(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),normalizedMargin:pd(()=>function(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}(e.margin),[e.margin])}}({imperativeRef:t,imperativeVariant:"network",margin:u,width:e.width,height:e.height,enableHover:e.enableHover,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,mode:e.mode,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),M=gd(()=>Oa(n),[n]),C=gd(()=>Oa(r),[r]),L=gd(()=>void 0===n&&void 0===r?void 0:[...M,...C],[r,n,C,M]),T=Sl(e.mobileInteraction,{mode:e.mode,width:S.width,mobileSemantics:e.mobileSemantics}),{customHoverBehavior:E,customClickBehavior:D,activeSelectionHook:I}=Cl({selection:g,linkedHover:p,fallbackFields:"string"==typeof h?[h]:[],onObservation:y,onClick:m,chartType:"NetworkCustomChart",chartId:v,colorByField:"string"==typeof h?h:void 0,mobileInteraction:T}),N=gd(()=>I?.isActive?{isActive:!0,predicate:I.predicate}:null,[I?.isActive,I?.predicate]),{width:P,height:_,enableHover:R,title:W,description:$,summary:O,accessibleTable:B}=S,z=vs(e.loading,P,_,e.loadingContent),j=z?null:ms(L,P,_,e.emptyContent);if(z||j)return z||j;const H={chartType:"force",...null!=n&&{nodes:M},...null!=r&&{edges:C},customNetworkLayout:o,layoutConfig:i,onLayoutError:a,nodeIDAccessor:s,sourceAccessor:c,targetAccessor:l,colorBy:h,colorScheme:f,size:[P,_],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:A,enableHover:R,...Ul({title:W,description:$,summary:O,accessibleTable:B,className:d,animate:e.animate,autoPlaceAnnotations:x}),...Kl({linkedHover:p,selection:g,onObservation:y,onClick:m,mobileInteraction:T,customHoverBehavior:E,customClickBehavior:D,linkedHoverInClickPredicate:!1}),layoutSelection:N,...null!=b&&{annotations:b},...k};return md(gs,{componentName:"NetworkCustomChart",width:P,height:_,children:md(xc,{ref:w,...H})})});vd.displayName="NetworkCustomChart";var bd={fill:"rgba(0,0,0,0)",stroke:"rgba(0,0,0,0)",opacity:0},xd=8;function kd(e){const t=function(e){return null==e?void 0:e+""}(e.id);return"width"in e&&"height"in e?{type:"rect",x:e.x,y:e.y,w:e.width,h:e.height,style:{...bd},datum:e.datum,id:t,label:e.label}:{type:"circle",cx:e.x,cy:e.y,r:e.r??8,style:{...bd},datum:e.datum,id:t,label:e.label}}export{Mu as ChordDiagram,Wu as CirclePack,xd as DEFAULT_HIT_RADIUS,Zl as ForceDirectedGraph,vd as NetworkCustomChart,zu as OrbitDiagram,hd as ProcessSankey,xu as SankeyDiagram,xc as StreamNetworkFrame,Tu as TreeDiagram,Pu as Treemap,Yl as composeStyleRules,qu as formatProcessSankeyIssue,Pn as glyphExtent,Nn as glyphPlacement,li as hatchFillId,di as hatchPatternDef,si as isHatchFill,Bl as makeNodeRuleContext,Ol as makeRuleValueResolver,jl as matchesThreshold,kd as networkHitTarget,ml as resolveResponsiveRules,Fl as resolveStyleRules,hi as resolveSvgFill,yl as responsiveRuleMatches,Hl as ruleMatches,Cn as useCustomLayoutSelection,pu as useForceLayout,Vu as validateProcessSankey};
|