semiotic 3.7.4 → 3.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +60 -15
- package/README.md +135 -24
- package/agent-skill/semiotic-charts/SKILL.md +146 -0
- package/ai/cli.js +133 -45
- package/ai/componentMetadata.cjs +6 -1
- package/ai/dist/mcp-server.js +1651 -154
- package/ai/examples.md +174 -0
- package/ai/schema.json +2934 -517
- package/ai/surface-manifest.json +200 -0
- package/ai/system-prompt.md +19 -3
- package/dist/components/Annotation.d.ts +4 -0
- package/dist/components/CategoryColors.d.ts +1 -1
- package/dist/components/ChartContainer.d.ts +91 -0
- package/dist/components/ChartGrid.d.ts +11 -1
- package/dist/components/CircularBrush.d.ts +61 -0
- package/dist/components/ContextLayout.d.ts +5 -1
- package/dist/components/DataSummaryContext.d.ts +1 -0
- package/dist/components/DirectManipulationControl.d.ts +63 -0
- package/dist/components/LinkedCharts.d.ts +3 -1
- package/dist/components/MobileAnnotationCalloutList.d.ts +13 -0
- package/dist/components/MobileChartContainer.d.ts +51 -0
- package/dist/components/MobileStandardControls.d.ts +68 -0
- package/dist/components/SmallMultipleChart.d.ts +84 -0
- package/dist/components/Tooltip/FlippingTooltip.d.ts +21 -0
- package/dist/components/ai/ChartRecipe.d.ts +16 -0
- package/dist/components/ai/IntentMark.d.ts +15 -0
- package/dist/components/ai/chartCapabilities.d.ts +8 -1
- package/dist/components/ai/chartCapabilityTypes.d.ts +42 -1
- package/dist/components/ai/chartClinic.d.ts +91 -0
- package/dist/components/ai/chartRecipeRegistry.d.ts +14 -0
- package/dist/components/ai/chartRecipes.d.ts +278 -0
- package/dist/components/ai/dataPitfallsBridge.d.ts +203 -0
- package/dist/components/ai/dataQualityBridge.d.ts +201 -0
- package/dist/components/ai/describeChart.d.ts +9 -0
- package/dist/components/ai/describeRecipeChart.d.ts +16 -0
- package/dist/components/ai/generativeChart.d.ts +170 -0
- package/dist/components/ai/intentManifest.d.ts +62 -0
- package/dist/components/ai/navigationTree.d.ts +3 -0
- package/dist/components/ai/observedSceneAudit.d.ts +72 -0
- package/dist/components/ai/readerGrounding.d.ts +83 -0
- package/dist/components/ai/recipeCapability.d.ts +8 -0
- package/dist/components/ai/recipeNavigation.d.ts +13 -0
- package/dist/components/ai/recipeSemantics.d.ts +11 -0
- package/dist/components/ai/repairChartConfig.d.ts +9 -0
- package/dist/components/ai/suggestCharts.d.ts +11 -1
- package/dist/components/charts/custom/GeoCustomChart.d.ts +48 -0
- package/dist/components/charts/custom/NetworkCustomChart.d.ts +22 -3
- package/dist/components/charts/custom/OrdinalCustomChart.d.ts +8 -2
- package/dist/components/charts/custom/XYCustomChart.d.ts +11 -2
- package/dist/components/charts/geo/DistanceCartogram.d.ts +1 -1
- package/dist/components/charts/geo/FlowMap.d.ts +1 -1
- package/dist/components/charts/geo/ProportionalSymbolMap.d.ts +1 -1
- package/dist/components/charts/geo/index.d.ts +2 -0
- package/dist/components/charts/index.d.ts +29 -1
- package/dist/components/charts/network/ChordDiagram.d.ts +1 -1
- package/dist/components/charts/network/CirclePack.d.ts +1 -1
- package/dist/components/charts/network/ForceDirectedGraph.d.ts +15 -5
- package/dist/components/charts/network/OrbitDiagram.d.ts +1 -1
- package/dist/components/charts/network/ProcessSankey.d.ts +1 -1
- package/dist/components/charts/network/SankeyDiagram.d.ts +1 -1
- package/dist/components/charts/network/TreeDiagram.d.ts +1 -1
- package/dist/components/charts/network/Treemap.d.ts +1 -1
- package/dist/components/charts/network/useForceLayout.d.ts +17 -0
- package/dist/components/charts/ordinal/BarChart.d.ts +1 -1
- package/dist/components/charts/ordinal/BoxPlot.d.ts +1 -1
- package/dist/components/charts/ordinal/DonutChart.d.ts +1 -1
- package/dist/components/charts/ordinal/DotPlot.d.ts +1 -1
- package/dist/components/charts/ordinal/FunnelChart.d.ts +1 -1
- package/dist/components/charts/ordinal/GroupedBarChart.d.ts +1 -1
- package/dist/components/charts/ordinal/Histogram.d.ts +1 -1
- package/dist/components/charts/ordinal/PieChart.d.ts +1 -1
- package/dist/components/charts/ordinal/RidgelinePlot.d.ts +1 -1
- package/dist/components/charts/ordinal/StackedBarChart.d.ts +1 -1
- package/dist/components/charts/ordinal/SwarmPlot.d.ts +8 -1
- package/dist/components/charts/ordinal/SwimlaneChart.d.ts +1 -1
- package/dist/components/charts/ordinal/ViolinPlot.d.ts +1 -1
- package/dist/components/charts/physics/ChainReactionChart.d.ts +9 -0
- package/dist/components/charts/physics/CollisionSwarmChart.capability.d.ts +2 -0
- package/dist/components/charts/physics/CollisionSwarmChart.d.ts +47 -0
- package/dist/components/charts/physics/EventDropChart.capability.d.ts +2 -0
- package/dist/components/charts/physics/EventDropChart.d.ts +53 -0
- package/dist/components/charts/physics/GaltonBoardChart.capability.d.ts +2 -0
- package/dist/components/charts/physics/GaltonBoardChart.d.ts +66 -0
- package/dist/components/charts/physics/GauntletChart.capability.d.ts +2 -0
- package/dist/components/charts/physics/GauntletChart.d.ts +73 -0
- package/dist/components/charts/physics/PhysicalFlowChart.capability.d.ts +2 -0
- package/dist/components/charts/physics/PhysicalFlowChart.d.ts +63 -0
- package/dist/components/charts/physics/PhysicsCustomChart.d.ts +120 -0
- package/dist/components/charts/physics/PhysicsPileChart.capability.d.ts +2 -0
- package/dist/components/charts/physics/PhysicsPileChart.d.ts +53 -0
- package/dist/components/charts/physics/ProcessFlowChart.capability.d.ts +2 -0
- package/dist/components/charts/physics/ProcessFlowChart.d.ts +96 -0
- package/dist/components/charts/physics/chainReactionOverlay.d.ts +22 -0
- package/dist/components/charts/physics/chainReactionRuntime.d.ts +37 -0
- package/dist/components/charts/physics/chainReactionTypes.d.ts +97 -0
- package/dist/components/charts/physics/collisionSwarmPhysics.d.ts +27 -0
- package/dist/components/charts/physics/dependencyMachine.d.ts +188 -0
- package/dist/components/charts/physics/eventDropPhysics.d.ts +64 -0
- package/dist/components/charts/physics/galtonBoardPhysics.d.ts +28 -0
- package/dist/components/charts/physics/gauntletChartProps.d.ts +67 -0
- package/dist/components/charts/physics/gauntletChrome.d.ts +33 -0
- package/dist/components/charts/physics/gauntletController.d.ts +73 -0
- package/dist/components/charts/physics/gauntletEffects.d.ts +36 -0
- package/dist/components/charts/physics/gauntletPhysics.d.ts +71 -0
- package/dist/components/charts/physics/gauntletRuntime.d.ts +42 -0
- package/dist/components/charts/physics/gauntletTypes.d.ts +213 -0
- package/dist/components/charts/physics/physicalFlowPhysics.d.ts +57 -0
- package/dist/components/charts/physics/physicsChartShared.d.ts +41 -0
- package/dist/components/charts/physics/physicsChartUtils.d.ts +18 -0
- package/dist/components/charts/physics/physicsEncoding.d.ts +142 -0
- package/dist/components/charts/physics/physicsHocHandle.d.ts +53 -0
- package/dist/components/charts/physics/physicsHocUtils.d.ts +128 -0
- package/dist/components/charts/physics/physicsPilePhysics.d.ts +41 -0
- package/dist/components/charts/physics/physicsProcessPrimitives.d.ts +38 -0
- package/dist/components/charts/physics/processFlowPhysics.d.ts +97 -0
- package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +9 -1
- package/dist/components/charts/realtime/RealtimeHistogram.d.ts +9 -1
- package/dist/components/charts/realtime/RealtimeLineChart.d.ts +30 -1
- package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +16 -2
- package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +9 -1
- package/dist/components/charts/realtime/aggregate.d.ts +51 -0
- package/dist/components/charts/realtime/eventTime.d.ts +26 -0
- package/dist/components/charts/shared/auditMobileVisualization.d.ts +91 -0
- package/dist/components/charts/shared/chartDefinitionPilot.d.ts +145 -0
- package/dist/components/charts/shared/chartFamilySets.d.ts +20 -0
- package/dist/components/charts/shared/chartSpecCore.d.ts +165 -0
- package/dist/components/charts/shared/chartSpecs.d.ts +8 -127
- package/dist/components/charts/shared/chartSpecsGeo.d.ts +2 -0
- package/dist/components/charts/shared/chartSpecsNetwork.d.ts +2 -0
- package/dist/components/charts/shared/chartSpecsOrdinal.d.ts +2 -0
- package/dist/components/charts/shared/chartSpecsPhysics.d.ts +2 -0
- package/dist/components/charts/shared/chartSpecsRealtime.d.ts +2 -0
- package/dist/components/charts/shared/chartSpecsValue.d.ts +2 -0
- package/dist/components/charts/shared/chartSpecsXY.d.ts +2 -0
- package/dist/components/charts/shared/colorContrast.d.ts +3 -0
- package/dist/components/charts/shared/colorPalettes.d.ts +2 -0
- package/dist/components/charts/shared/colorUtils.d.ts +17 -13
- package/dist/components/charts/shared/diagnoseAnnotationChecks.d.ts +4 -0
- package/dist/components/charts/shared/diagnoseConfig.d.ts +9 -14
- package/dist/components/charts/shared/diagnoseMisleadingChecks.d.ts +9 -0
- package/dist/components/charts/shared/diagnosePhysicsChecks.d.ts +3 -0
- package/dist/components/charts/shared/diagnoseTypes.d.ts +10 -0
- package/dist/components/charts/shared/hooks.d.ts +28 -5
- package/dist/components/charts/shared/minMax.d.ts +3 -0
- package/dist/components/charts/shared/motionEncoding.d.ts +145 -0
- package/dist/components/charts/shared/radialGeometry.d.ts +0 -18
- package/dist/components/charts/shared/responsiveRules.d.ts +56 -0
- package/dist/components/charts/shared/smartTooltip.d.ts +27 -0
- package/dist/components/charts/shared/statisticalOverlays.d.ts +35 -0
- package/dist/components/charts/shared/streamPropsHelpers.d.ts +12 -2
- package/dist/components/charts/shared/temporalStrings.d.ts +7 -0
- package/dist/components/charts/shared/tooltipUtils.d.ts +2 -0
- package/dist/components/charts/shared/types.d.ts +49 -1
- package/dist/components/charts/shared/useChartSetup.d.ts +10 -3
- package/dist/components/charts/shared/useCustomChartSetup.d.ts +15 -6
- package/dist/components/charts/shared/useNetworkChartSetup.d.ts +6 -2
- package/dist/components/charts/shared/useOrdinalPieceStyle.d.ts +1 -1
- package/dist/components/charts/shared/useStreamingLegend.d.ts +1 -1
- package/dist/components/charts/shared/useSyncedPushData.d.ts +49 -0
- package/dist/components/charts/shared/validateChartData.d.ts +1 -1
- package/dist/components/charts/shared/validationMap.d.ts +0 -11
- package/dist/components/charts/xy/AreaChart.d.ts +1 -1
- package/dist/components/charts/xy/BubbleChart.d.ts +1 -1
- package/dist/components/charts/xy/LineChart.d.ts +1 -1
- package/dist/components/charts/xy/MinimapChart.d.ts +1 -1
- package/dist/components/charts/xy/MultiAxisLineChart.d.ts +2 -2
- package/dist/components/charts/xy/QuadrantChart.d.ts +1 -1
- package/dist/components/charts/xy/Scatterplot.d.ts +10 -1
- package/dist/components/charts/xy/ScatterplotMatrix.d.ts +11 -1
- package/dist/components/charts/xy/StackedAreaChart.d.ts +9 -4
- package/dist/components/controls/controlAudit.d.ts +24 -0
- package/dist/components/controls/controlContract.d.ts +57 -0
- package/dist/components/data/fromArrow.d.ts +54 -0
- package/dist/components/data/fromFlintChart.d.ts +74 -0
- package/dist/components/data/fromMermaid.d.ts +47 -0
- package/dist/components/data/fromObservablePlot.d.ts +69 -0
- package/dist/components/data/fromVegaLite.d.ts +27 -0
- package/dist/components/data/portability/index.d.ts +17 -0
- package/dist/components/data/portability/result.d.ts +52 -0
- package/dist/components/data/portability/spec.d.ts +160 -0
- package/dist/components/data/portability/vegaLite.d.ts +80 -0
- package/dist/components/export/chartConfig.d.ts +11 -0
- package/dist/components/realtime/ReorderBuffer.d.ts +54 -0
- package/dist/components/realtime/RunningStats.d.ts +66 -0
- package/dist/components/realtime/WindowAccumulator.d.ts +105 -0
- package/dist/components/realtime/parseWindowDuration.d.ts +12 -0
- package/dist/components/realtime/types.d.ts +11 -0
- package/dist/components/recipes/annotationLayout.d.ts +29 -0
- package/dist/components/recipes/axisFixedForce.d.ts +119 -0
- package/dist/components/recipes/boba.d.ts +23 -0
- package/dist/components/recipes/customTooltip.d.ts +31 -0
- package/dist/components/recipes/cyclical.d.ts +39 -0
- package/dist/components/recipes/edgeRouter.d.ts +103 -0
- package/dist/components/recipes/forceLayout.d.ts +48 -0
- package/dist/components/recipes/forceLayoutAsync.d.ts +17 -0
- package/dist/components/recipes/gofishBobaHandwritten.d.ts +3 -0
- package/dist/components/recipes/gofishDisplayListFixtures.generated.d.ts +37 -0
- package/dist/components/recipes/gofishIR.d.ts +215 -0
- package/dist/components/recipes/gofishIRExamples.d.ts +38 -0
- package/dist/components/recipes/intervalLanes.d.ts +87 -0
- package/dist/components/recipes/intervals.d.ts +80 -0
- package/dist/components/recipes/isometricLandmarks.d.ts +88 -0
- package/dist/components/recipes/isotypeGlyphs.d.ts +17 -0
- package/dist/components/recipes/mermaidDag.d.ts +44 -0
- package/dist/components/recipes/mobileAnnotationStrategy.d.ts +48 -0
- package/dist/components/recipes/mobileChartFamilyRecipes.d.ts +59 -0
- package/dist/components/recipes/networkAnalysis.d.ts +102 -0
- package/dist/components/recipes/networkLayouts.d.ts +83 -0
- package/dist/components/recipes/packedClusterMatrix.d.ts +166 -0
- package/dist/components/recipes/physics.d.ts +122 -0
- package/dist/components/recipes/physicsReference.d.ts +102 -0
- package/dist/components/recipes/processAggregates.d.ts +32 -0
- package/dist/components/recipes/processChrome.d.ts +67 -0
- package/dist/components/recipes/processJourney.d.ts +54 -0
- package/dist/components/recipes/processPhysics.d.ts +300 -0
- package/dist/components/recipes/processVolumeGeometry.d.ts +28 -0
- package/dist/components/recipes/radialCoords.d.ts +69 -0
- package/dist/components/recipes/random.d.ts +2 -0
- package/dist/components/recipes/recipeChrome.d.ts +191 -0
- package/dist/components/recipes/recipeGlyph.d.ts +42 -0
- package/dist/components/recipes/recipeLegend.d.ts +109 -0
- package/dist/components/recipes/recipeUtils.d.ts +157 -0
- package/dist/components/recipes/runs.d.ts +59 -0
- package/dist/components/recipes/tokenEncoding.d.ts +157 -0
- package/dist/components/recipes/tokenLayer.d.ts +79 -0
- package/dist/components/recipes/unitize.d.ts +108 -0
- package/dist/components/recipes/vector.d.ts +28 -0
- package/dist/components/recipes/waffle.d.ts +43 -0
- package/dist/components/semiotic-ai-core.d.ts +47 -0
- package/dist/components/semiotic-ai.d.ts +52 -4
- package/dist/components/semiotic-controls.d.ts +18 -0
- package/dist/components/semiotic-data.d.ts +2 -0
- package/dist/components/semiotic-experimental.d.ts +49 -0
- package/dist/components/semiotic-geo.d.ts +11 -0
- package/dist/components/semiotic-network.d.ts +14 -1
- package/dist/components/semiotic-ordinal.d.ts +10 -0
- package/dist/components/semiotic-physics-matter.d.ts +10 -0
- package/dist/components/semiotic-physics-rapier.d.ts +9 -0
- package/dist/components/semiotic-physics.d.ts +56 -0
- package/dist/components/semiotic-realtime-core.d.ts +34 -0
- package/dist/components/semiotic-realtime-react.d.ts +10 -0
- package/dist/components/semiotic-realtime.d.ts +4 -22
- package/dist/components/semiotic-recipes-core.d.ts +92 -0
- package/dist/components/semiotic-recipes-react.d.ts +7 -0
- package/dist/components/semiotic-recipes.d.ts +4 -26
- package/dist/components/semiotic-server-edge.d.ts +8 -0
- package/dist/components/semiotic-server-node.d.ts +5 -0
- package/dist/components/semiotic-server.d.ts +2 -2
- package/dist/components/semiotic-themes-core.d.ts +53 -0
- package/dist/components/semiotic-themes-react.d.ts +4 -0
- package/dist/components/semiotic-themes.d.ts +6 -74
- package/dist/components/semiotic-utils-core.d.ts +46 -0
- package/dist/components/semiotic-utils-react.d.ts +5 -0
- package/dist/components/semiotic-utils.d.ts +3 -39
- package/dist/components/semiotic-xy.d.ts +10 -0
- package/dist/components/semiotic.d.ts +39 -7
- package/dist/components/server/animatedGif.d.ts +36 -0
- package/dist/components/server/renderEvidence.d.ts +1 -1
- package/dist/components/server/renderToStaticSVG.d.ts +3 -35
- package/dist/components/server/serverChartConfigShared.d.ts +17 -0
- package/dist/components/server/serverChartConfigs.d.ts +19 -9
- package/dist/components/server/serverChartConfigsCustom.d.ts +5 -0
- package/dist/components/server/serverChartConfigsGeo.d.ts +9 -0
- package/dist/components/server/serverChartConfigsNetwork.d.ts +8 -0
- package/dist/components/server/serverChartConfigsOrdinal.d.ts +16 -0
- package/dist/components/server/serverChartConfigsPhysics.d.ts +9 -0
- package/dist/components/server/serverChartConfigsXY.d.ts +11 -0
- package/dist/components/server/staticGeo.d.ts +4 -0
- package/dist/components/server/staticLegend.d.ts +1 -1
- package/dist/components/server/staticNetwork.d.ts +8 -0
- package/dist/components/server/staticOrdinal.d.ts +11 -0
- package/dist/components/server/staticPhysics.d.ts +3 -0
- package/dist/components/server/staticSVGChrome.d.ts +110 -0
- package/dist/components/server/staticXY.d.ts +4 -0
- package/dist/components/store/ObservationStore.d.ts +23 -3
- package/dist/components/store/SelectionStore.d.ts +1 -1
- package/dist/components/store/ThemeStore.d.ts +1 -1
- package/dist/components/store/TooltipStore.d.ts +1 -1
- package/dist/components/store/createStore.d.ts +1 -1
- package/dist/components/store/designTokens.d.ts +15 -0
- package/dist/components/store/themeSerialization.d.ts +32 -0
- package/dist/components/store/useChartInterrogation.d.ts +9 -0
- package/dist/components/stream/AccessibleDataTable.d.ts +3 -13
- package/dist/components/stream/FocusRing.d.ts +4 -2
- package/dist/components/stream/GeoCanvasHitTester.d.ts +1 -1
- package/dist/components/stream/GeoPipelineStore.d.ts +28 -0
- package/dist/components/stream/NetworkHtmlMarksLayer.d.ts +44 -0
- package/dist/components/stream/NetworkPipelineStore.d.ts +62 -25
- package/dist/components/stream/NetworkSVGOverlay.d.ts +15 -0
- package/dist/components/stream/OrdinalPipelineStore.d.ts +64 -2
- package/dist/components/stream/PipelineStore.d.ts +100 -162
- package/dist/components/stream/SceneGraph.d.ts +14 -2
- package/dist/components/stream/StreamGeoFrame.d.ts +1 -1
- package/dist/components/stream/StreamNetworkFrame.d.ts +1 -1
- package/dist/components/stream/StreamOrdinalFrame.d.ts +1 -1
- package/dist/components/stream/StreamXYFrame.d.ts +2 -18
- package/dist/components/stream/accessibleDataRows.d.ts +33 -0
- package/dist/components/stream/accessorUtils.d.ts +23 -10
- package/dist/components/stream/brushAccessibility.d.ts +25 -0
- package/dist/components/stream/canvasBackground.d.ts +24 -0
- package/dist/components/stream/canvasSetup.d.ts +4 -1
- package/dist/components/stream/customLayout.d.ts +20 -0
- package/dist/components/stream/customLayoutDiagnostics.d.ts +11 -0
- package/dist/components/stream/customLayoutFailure.d.ts +33 -0
- package/dist/components/stream/customLayoutPalette.d.ts +19 -9
- package/dist/components/stream/customLayoutSelection.d.ts +52 -0
- package/dist/components/stream/frameThemeColors.d.ts +24 -0
- package/dist/components/stream/geoAnnotationAnchors.d.ts +14 -0
- package/dist/components/stream/geoCartogram.d.ts +17 -0
- package/dist/components/stream/geoCustomLayout.d.ts +59 -0
- package/dist/components/stream/geoDefaultTooltip.d.ts +11 -0
- package/dist/components/stream/geoFrameHelpers.d.ts +34 -0
- package/dist/components/stream/geoPipelineHelpers.d.ts +46 -0
- package/dist/components/stream/geoTypes.d.ts +56 -7
- package/dist/components/stream/glyphDef.d.ts +98 -0
- package/dist/components/stream/hitTarget.d.ts +170 -0
- package/dist/components/stream/hoverUtils.d.ts +3 -0
- package/dist/components/stream/keyboardNav.d.ts +4 -1
- package/dist/components/stream/layouts/forceLayoutPlugin.d.ts +9 -1
- package/dist/components/stream/layouts/forceLayoutWorkerClient.d.ts +57 -0
- package/dist/components/stream/networkBezier.d.ts +10 -0
- package/dist/components/stream/networkColorAccessors.d.ts +49 -0
- package/dist/components/stream/networkCustomLayout.d.ts +66 -1
- package/dist/components/stream/networkDefaultTooltip.d.ts +10 -0
- package/dist/components/stream/networkFrameInteraction.d.ts +37 -0
- package/dist/components/stream/networkFramePaint.d.ts +43 -0
- package/dist/components/stream/networkPipelineConfig.d.ts +22 -0
- package/dist/components/stream/networkPipelineHelpers.d.ts +12 -0
- package/dist/components/stream/networkRealtimeEncoding.d.ts +41 -0
- package/dist/components/stream/networkTypes.d.ts +104 -5
- package/dist/components/stream/ordinalCanvasRenderers.d.ts +7 -0
- package/dist/components/stream/ordinalCustomLayout.d.ts +17 -1
- package/dist/components/stream/ordinalDataIndex.d.ts +5 -0
- package/dist/components/stream/ordinalDefaultTooltip.d.ts +10 -0
- package/dist/components/stream/ordinalDomain.d.ts +38 -0
- package/dist/components/stream/ordinalPipelineUpdateResults.d.ts +12 -0
- package/dist/components/stream/ordinalPulse.d.ts +10 -0
- package/dist/components/stream/ordinalPulseResources.d.ts +3 -0
- package/dist/components/stream/ordinalSceneBuilders/sceneBuilderMap.d.ts +5 -0
- package/dist/components/stream/ordinalSceneBuilders/types.d.ts +2 -0
- package/dist/components/stream/ordinalSpatialIndex.d.ts +9 -0
- package/dist/components/stream/ordinalTypes.d.ts +56 -8
- package/dist/components/stream/paintNeeds.d.ts +31 -0
- package/dist/components/stream/physics/CapacityQueueController.d.ts +5 -0
- package/dist/components/stream/physics/CapacityQueueTypes.d.ts +134 -0
- package/dist/components/stream/physics/MatterPhysicsEngineAdapter.d.ts +42 -0
- package/dist/components/stream/physics/PhysicsAccessibility.d.ts +48 -0
- package/dist/components/stream/physics/PhysicsAnnotations.d.ts +58 -0
- package/dist/components/stream/physics/PhysicsBodyBudget.d.ts +26 -0
- package/dist/components/stream/physics/PhysicsBodySpatialIndex.d.ts +10 -0
- package/dist/components/stream/physics/PhysicsCanvasTheme.d.ts +26 -0
- package/dist/components/stream/physics/PhysicsControllers.d.ts +75 -0
- package/dist/components/stream/physics/PhysicsEngineAdapter.d.ts +59 -0
- package/dist/components/stream/physics/PhysicsEngineConformance.d.ts +23 -0
- package/dist/components/stream/physics/PhysicsEvidence.d.ts +25 -0
- package/dist/components/stream/physics/PhysicsKernel.d.ts +207 -0
- package/dist/components/stream/physics/PhysicsOptionalEngineAdapters.d.ts +12 -0
- package/dist/components/stream/physics/PhysicsPipelineStore.d.ts +84 -0
- package/dist/components/stream/physics/PhysicsPipelineTypes.d.ts +181 -0
- package/dist/components/stream/physics/PhysicsSVGOverlay.d.ts +72 -0
- package/dist/components/stream/physics/PhysicsSediment.d.ts +69 -0
- package/dist/components/stream/physics/PhysicsSettledSVG.d.ts +18 -0
- package/dist/components/stream/physics/PhysicsSettledScene.d.ts +21 -0
- package/dist/components/stream/physics/PhysicsWorkerClient.d.ts +24 -0
- package/dist/components/stream/physics/PhysicsWorkerProtocol.d.ts +101 -0
- package/dist/components/stream/physics/PhysicsWorkerRuntime.d.ts +5 -0
- package/dist/components/stream/physics/RapierPhysicsEngineAdapter.d.ts +18 -0
- package/dist/components/stream/physics/ServiceOperationsControllers.d.ts +27 -0
- package/dist/components/stream/physics/ServiceOperationsTypes.d.ts +89 -0
- package/dist/components/stream/physics/StreamPhysicsFrame.d.ts +6 -0
- package/dist/components/stream/physics/StreamPhysicsTypes.d.ts +302 -0
- package/dist/components/stream/physics/physicsBodyCanvas.d.ts +27 -0
- package/dist/components/stream/physics/physicsPipelineControls.d.ts +4 -0
- package/dist/components/stream/physics/physicsPipelineHelpers.d.ts +41 -0
- package/dist/components/stream/physics/physicsPipelineObservations.d.ts +14 -0
- package/dist/components/stream/physics/physicsPipelineUpdateResults.d.ts +9 -0
- package/dist/components/stream/physics/physicsRegionRuntime.d.ts +54 -0
- package/dist/components/stream/physics/physicsSemanticUI.d.ts +20 -0
- package/dist/components/stream/physics/usePhysicsFrameLifecyclePolicy.d.ts +16 -0
- package/dist/components/stream/pipelineBufferUtils.d.ts +26 -0
- package/dist/components/stream/pipelineConfig.d.ts +177 -0
- package/dist/components/stream/pipelineDecay.d.ts +20 -2
- package/dist/components/stream/pipelineDomainResolution.d.ts +62 -0
- package/dist/components/stream/pipelineIdentityOps.d.ts +26 -0
- package/dist/components/stream/pipelinePulse.d.ts +16 -2
- package/dist/components/stream/pipelineRibbons.d.ts +41 -0
- package/dist/components/stream/pipelineSpatialIndex.d.ts +12 -0
- package/dist/components/stream/pipelineStoreUpdateResults.d.ts +12 -0
- package/dist/components/stream/pipelineStyleResolvers.d.ts +46 -0
- package/dist/components/stream/pipelineTransitions.d.ts +2 -0
- package/dist/components/stream/pipelineUpdateContract.d.ts +62 -0
- package/dist/components/stream/pulseFrameRefresh.d.ts +22 -0
- package/dist/components/stream/renderers/glyphCanvasRenderer.d.ts +6 -0
- package/dist/components/stream/renderers/networkSymbolRenderer.d.ts +2 -0
- package/dist/components/stream/renderers/resolveCSSColor.d.ts +6 -0
- package/dist/components/stream/renderers/symbolCanvasRenderer.d.ts +2 -0
- package/dist/components/stream/sceneRevisionDiagnostics.d.ts +18 -0
- package/dist/components/stream/stalenessBands.d.ts +28 -0
- package/dist/components/stream/streamStoreSync.d.ts +37 -0
- package/dist/components/stream/symbolPath.d.ts +24 -0
- package/dist/components/stream/types.d.ts +206 -9
- package/dist/components/stream/useFrame.d.ts +21 -2
- package/dist/components/stream/useHydration.d.ts +6 -0
- package/dist/components/stream/useLegendCategoryEmission.d.ts +5 -0
- package/dist/components/stream/useStalenessCheck.d.ts +6 -1
- package/dist/components/stream/workerModuleUrl.d.ts +10 -0
- package/dist/components/stream/xyAnnotationAnchors.d.ts +13 -0
- package/dist/components/stream/xyCanvasRenderers.d.ts +7 -0
- package/dist/components/stream/xyCrosshair.d.ts +11 -0
- package/dist/components/stream/xyDateTicks.d.ts +9 -0
- package/dist/components/stream/xyDefaultTooltip.d.ts +10 -0
- package/dist/components/stream/xySceneBuilders/pointScene.d.ts +2 -2
- package/dist/components/stream/xySceneBuilders/types.d.ts +9 -4
- package/dist/controls.min.js +2 -0
- package/dist/controls.module.min.js +2 -0
- package/dist/forceLayoutWorker.js +1 -0
- package/dist/geo.min.js +1 -1
- package/dist/geo.module.min.js +1 -1
- package/dist/network.min.js +1 -1
- package/dist/network.module.min.js +1 -1
- package/dist/ordinal.min.js +1 -1
- package/dist/ordinal.module.min.js +1 -1
- package/dist/physics-matter.min.js +1 -0
- package/dist/physics-matter.module.min.js +1 -0
- package/dist/physics-rapier.min.js +1 -0
- package/dist/physics-rapier.module.min.js +1 -0
- package/dist/physics.min.js +2 -0
- package/dist/physics.module.min.js +2 -0
- package/dist/physicsWorker.js +1 -0
- package/dist/realtime.min.js +1 -1
- package/dist/realtime.module.min.js +1 -1
- package/dist/semiotic-ai-chunk-OG7BQUUW.module.min.js +2 -0
- package/dist/semiotic-ai-core.d.ts +47 -0
- package/dist/semiotic-ai-core.min.js +1 -0
- package/dist/semiotic-ai-core.module.min.js +1 -0
- package/dist/semiotic-ai-statisticalOverlays-CY4WKR4A.module.min.js +2 -0
- package/dist/semiotic-ai.d.ts +52 -4
- package/dist/semiotic-ai.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-chunk-3FSVZ46U.module.min.js +2 -0
- package/dist/semiotic-controls.d.ts +18 -0
- package/dist/semiotic-data.d.ts +2 -0
- package/dist/semiotic-data.min.js +1 -1
- package/dist/semiotic-data.module.min.js +1 -1
- package/dist/semiotic-experimental.d.ts +49 -0
- package/dist/semiotic-experimental.min.js +1 -0
- package/dist/semiotic-experimental.module.min.js +1 -0
- package/dist/semiotic-geo.d.ts +11 -0
- package/dist/semiotic-network.d.ts +14 -1
- package/dist/semiotic-ordinal.d.ts +10 -0
- package/dist/semiotic-physics-matter.d.ts +10 -0
- package/dist/semiotic-physics-rapier.d.ts +9 -0
- package/dist/semiotic-physics.d.ts +56 -0
- package/dist/semiotic-realtime-core.d.ts +34 -0
- package/dist/semiotic-realtime-core.min.js +1 -0
- package/dist/semiotic-realtime-core.module.min.js +1 -0
- package/dist/semiotic-realtime-react.d.ts +10 -0
- package/dist/semiotic-realtime-react.min.js +2 -0
- package/dist/semiotic-realtime-react.module.min.js +2 -0
- package/dist/semiotic-realtime.d.ts +4 -22
- package/dist/semiotic-recipes-core.d.ts +92 -0
- package/dist/semiotic-recipes-core.min.js +1 -0
- package/dist/semiotic-recipes-core.module.min.js +1 -0
- package/dist/semiotic-recipes-react.d.ts +7 -0
- package/dist/semiotic-recipes-react.min.js +2 -0
- package/dist/semiotic-recipes-react.module.min.js +2 -0
- package/dist/semiotic-recipes.d.ts +4 -26
- package/dist/semiotic-recipes.min.js +1 -1
- package/dist/semiotic-recipes.module.min.js +1 -1
- package/dist/semiotic-server-edge.d.ts +8 -0
- package/dist/semiotic-server-edge.min.js +1 -0
- package/dist/semiotic-server-edge.module.min.js +1 -0
- package/dist/semiotic-server-node.d.ts +5 -0
- package/dist/semiotic-server-node.min.js +1 -0
- package/dist/semiotic-server-node.module.min.js +1 -0
- package/dist/semiotic-server.d.ts +2 -2
- package/dist/semiotic-statisticalOverlays-UOMSFKVJ.module.min.js +2 -0
- package/dist/semiotic-themes-core.d.ts +53 -0
- package/dist/semiotic-themes-core.min.js +1 -0
- package/dist/semiotic-themes-core.module.min.js +1 -0
- package/dist/semiotic-themes-react.d.ts +4 -0
- package/dist/semiotic-themes-react.min.js +2 -0
- package/dist/semiotic-themes-react.module.min.js +2 -0
- package/dist/semiotic-themes.d.ts +6 -74
- package/dist/semiotic-themes.min.js +1 -2
- package/dist/semiotic-themes.module.min.js +1 -2
- package/dist/semiotic-utils-core.d.ts +46 -0
- package/dist/semiotic-utils-core.min.js +1 -0
- package/dist/semiotic-utils-core.module.min.js +1 -0
- package/dist/semiotic-utils-react.d.ts +5 -0
- package/dist/semiotic-utils-react.min.js +2 -0
- package/dist/semiotic-utils-react.module.min.js +2 -0
- package/dist/semiotic-utils.d.ts +3 -39
- package/dist/semiotic-utils.min.js +1 -2
- package/dist/semiotic-utils.module.min.js +1 -2
- package/dist/semiotic-value.min.js +1 -1
- package/dist/semiotic-value.module.min.js +1 -1
- package/dist/semiotic-xy.d.ts +10 -0
- package/dist/semiotic.d.ts +39 -7
- package/dist/semiotic.min.js +1 -1
- package/dist/semiotic.module.min.js +1 -1
- package/dist/server.min.js +1 -1
- package/dist/server.module.min.js +1 -1
- package/dist/xy-chunk-IWD6IB6V.module.min.js +2 -0
- package/dist/xy-statisticalOverlays-7RWG6LJT.module.min.js +2 -0
- package/dist/xy.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +246 -86
- package/spec/README.md +152 -0
- package/spec/bindings/README.md +35 -0
- package/spec/bindings/vega-lite.mjs +112 -0
- package/spec/v0.1/annotation-provenance.schema.json +127 -0
- package/spec/v0.1/audience-profile.schema.json +67 -0
- package/spec/v0.1/chart-capability.schema.json +186 -0
- package/dist/semiotic-ai-statisticalOverlays-C2PPlmXv.js +0 -1
- package/dist/semiotic-statisticalOverlays-C3DsOgr_.js +0 -1
- package/dist/xy-statisticalOverlays-C2PPlmXv.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as o from"react";import{useEffect as i,useMemo as r,useRef as s,useState as a,useSyncExternalStore as l,useLayoutEffect as c,useContext as d,useCallback as u,createContext as h,forwardRef as g,useImperativeHandle as f,useId as p}from"react";import{scaleOrdinal as y,scaleLinear as m,scaleBand as v}from"d3-scale";import{quadtree as b}from"d3-quadtree";import{quantile as x}from"d3-array";import{packEnclose as w}from"d3-hierarchy";import{area as k,curveCatmullRom as A,curveCardinal as O,curveBasis as S,curveStepBefore as j,curveStepAfter as M,curveStep as _,curveMonotoneY as C,curveMonotoneX as P,curveLinear as L,arc as T}from"d3-shape";import $ from"regression";import{select as I}from"d3-selection";import{brushX as B,brushY as H}from"d3-brush";const R=Object.freeze([]);function D(e){if(!e)return R;let t=!1;for(let n=0;e.length>n;n++){const o=e[n];if(null==o||"object"!=typeof o){t=!0;break}}if(!t)return e;const n=[];for(const t of e)null!=t&&"object"==typeof t&&n.push(t);return n}class F{constructor(e,t){var n,o;this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=e,this.chunkThreshold=null!==(n=null==t?void 0:t.chunkThreshold)&&void 0!==n?n:5e3,this.chunkSize=null!==(o=null==t?void 0:t.chunkSize)&&void 0!==o?o:5e3}updateChunkOptions(e){null!=e.chunkThreshold&&(this.chunkThreshold=e.chunkThreshold),null!=e.chunkSize&&(this.chunkSize=e.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(e){if(e=D(e),this.lastBoundedData===e)return;if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}setReplacementData(e){if(e=D(e),this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.pushBuffer=[],this.flushScheduled=!1,this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0,preserveCategoryOrder:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,preserveCategoryOrder:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const e=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:e,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(e){null!=e&&"object"==typeof e&&(this.pushBuffer.push(e),this.scheduleFlush())}pushMany(e){if(0===e.length)return;let t=0;for(let n=0;e.length>n;n++){const o=e[n];null!=o&&"object"==typeof o&&(this.pushBuffer.push(o),t++)}0!==t&&this.scheduleFlush()}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}}class N{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;return{next:()=>this._size>e?{done:!1,value:this.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray(),n=[];for(;t.length>e;)n.push(t.shift());this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(const e of t)this.push(e);return n}update(e,t){const n=[],o=(this.head-this._size+this._capacity)%this._capacity;for(let i=0;this._size>i;i++){const r=(o+i)%this._capacity,s=this.buffer[r];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:Object.assign({},s),n.push(e),this.buffer[r]=t(s)}}return n}remove(e){const t=[],n=[];if(this.forEach(o=>{e(o)?n.push(o):t.push(o)}),0===n.length)return n;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}}class E{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(e){Number.isFinite(e)&&(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}evict(e){e!==this._min&&e!==this._max||(this._dirty=!0)}recalculate(e,t){this._min=1/0,this._max=-1/0;for(const n of e){const e=t?t(n):n;Number.isFinite(e)&&(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}this._dirty=!1}clear(){this._min=1/0,this._max=-1/0,this._dirty=!1}get extent(){return[this._min,this._max]}get min(){return this._min}get max(){return this._max}get dirty(){return this._dirty}}function W(e,t,n){return e+(t-e)*n}function z(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function G(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function q(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}function V(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function X(e,t,n){const o=e=>e.toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function Y(e){const t=e.map(V),n=t.length-1;return e=>{if(0>=e){const[e,n,o]=t[0];return X(e,n,o)}if(e>=1){const[e,o,i]=t[n];return X(e,o,i)}const o=e*n,i=Math.floor(o),r=o-i,[s,a,l]=t[i],[c,d,u]=t[i+1];return X(Math.round(s+(c-s)*r),Math.round(a+(d-a)*r),Math.round(l+(u-l)*r))}}const Q=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Z=Y(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),K=Y(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),U=Y(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),J=Y(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),ee=Y(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]);Y(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]);const te=Y(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),ne=Y(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]);Y(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),Y(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),Y(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),Y(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]);const oe=Y(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),ie=Y(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),re=Y(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),se=Y(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),ae=Y(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),le=Y(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),ce=Y(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]),de={category10:Q,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],blues:Z,reds:K,greens:U,oranges:J,purples:ee,viridis:te,plasma:ne},ue=Q,he=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],ge=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 fe(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")||ge.has(t)}(o)?n(o):o}const o=(null==e?void 0:e[t])+"";return n?n(o):ue[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))%ue.length]}function pe(e,t,n="category10"){const o=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e).map(e=>e+""))),i=o.every(e=>!isNaN(Number(e)));if(Array.isArray(n))return y().domain(o).range(n).unknown("#999");const r=de[n]||de.category10;if(i&&"function"==typeof r){let e=-1/0;for(const t of o){const n=Number(t);n>e&&(e=n)}return t=>r(Number(t)/e)}{const e=Array.isArray(r)?r:ue;return y().domain(o).range(e).unknown("#999")}}function ye(e,t,n=[3,20],o){let i;if(i="function"==typeof t?t(e):null==e?void 0:e[t],!o)return i;const[r,s]=o,[a,l]=n;if(s===r)return(a+l)/2;let c=(i-r)/(s-r);return 0>c?c=0:c>1&&(c=1),a+c*(l-a)}function me(e,t,n,o,i,r,s){return{type:"rect",x:e,y:t,w:n,h:o,style:i,datum:r,group:s}}function ve(e,t){var n;const{columns:o,config:i,resolvePieceStyle:r}=e,s=[],a=Math.min(t.width,t.height)/2-4,l="donut"===i.chartType?i.innerRadius||60:0,c=-Math.PI/2+(i.startAngle||0)*Math.PI/180,d=null!=i.sweepAngle?i.sweepAngle*Math.PI/180:2*Math.PI,u=null!=i.sweepAngle&&360>i.sweepAngle,h=Object.values(o),g=h.some(e=>{const t=e.pieceData[0];return t&&("number"==typeof t._pct||"number"==typeof t._pctStart||null!=t._roundedEnds)}),f=u&&!g&&h.length>1&&(null!==(n=i.cornerRadius)&&void 0!==n?n:0)>0;for(let e=0;h.length>e;e++){const t=h[e],n=t.pieceData[0],o="number"==typeof(null==n?void 0:n._pctStart)?n._pctStart:t.pctStart,u=c+o*d,g=c+(o+("number"==typeof(null==n?void 0:n._pct)?n._pct:t.pct))*d,p=r(t.pieceData[0],t.name),y=0===e,m=e===h.length-1,v=Object.assign(Object.assign({type:"wedge",cx:0,cy:0,innerRadius:l,outerRadius:a,startAngle:u,endAngle:g},i.cornerRadius&&{cornerRadius:i.cornerRadius}),{style:p,datum:(null==n?void 0:n._nonInteractive)?null:t.pieceData,category:t.name});(null==n?void 0:n._roundedEnds)?v.roundedEnds=n._roundedEnds:f&&(v.roundedEnds={start:y,end:m}),(null==n?void 0:n._gradientBand)&&(v._gradientBand=n._gradientBand),s.push(v)}return s}function be(e){var t,n,o;const i=e.length,r=e[0],s=e[i-1];return{n:i,min:r,q1:null!==(t=x(e,.25))&&void 0!==t?t:r,median:null!==(n=x(e,.5))&&void 0!==n?n:(r+s)/2,q3:null!==(o=x(e,.75))&&void 0!==o?o:s,max:s,mean:e.reduce((e,t)=>e+t,0)/i}}function xe(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"}}const we={bar:function(e,t){var n,o,i;const{scales:r,columns:s,config:a,getR:l,getStack:c,resolvePieceStyle:d}=e,{r:u,projection:h}=r,g=[],f="vertical"===h,p="horizontal"===h,y=a.normalize,m=[];if(c){const e=new Set;for(const t of Object.values(s))for(const n of t.pieceData){const t=c(n);e.has(t)||(e.add(t),m.push(t))}}else m.push("_default");for(const e of Object.values(s)){const t=new Map;for(const n of e.pieceData){const e=c?c(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const o=t.get(e);o.total+=l(n),o.pieces.push(n)}let n=0;if(y)for(const e of t.values())n+=Math.abs(e.total);let o=0,i=0;for(const r of m){const s=t.get(r);if(!s)continue;let a=s.total;y&&n>0&&(a/=n);const l=d(s.pieces[0],c?r:e.name),h=Object.assign(Object.assign({},s.pieces[0]),{__aggregateValue:s.total,__pieceCount:s.pieces.length,category:e.name});if(f){const t=u(0>a?i:o+a),n=0>a?u(i+a)-u(i):u(o)-u(o+a);g.push(me(e.x,t,e.width,Math.abs(n),l,h,r)),0>a?i+=a:o+=a}else if(p){const t=u(0>a?i+a:o),n=0>a?u(i)-u(i+a):u(o+a)-u(o);g.push(me(t,e.x,Math.abs(n),e.width,l,h,r)),0>a?i+=a:o+=a}}}const v="vertical"===h,b=a.roundedTop&&a.roundedTop>0?Math.max(0,a.roundedTop):0;for(const e of g){if("rect"!==e.type)continue;const t=null!==(o=null===(n=e.datum)||void 0===n?void 0:n.__aggregateValue)&&void 0!==o?o:0;e.roundedEdge=v?0>t?"bottom":"top":0>t?"left":"right",a.gradientFill&&(e.fillGradient=a.gradientFill)}if(b>0){const e=new Map;for(const t of g){if("rect"!==t.type)continue;const n=(null===(i=t.datum)||void 0===i?void 0:i.category)||"";e.has(n)||e.set(n,[]),e.get(n).push(t)}for(const t of e.values()){if(0===t.length)continue;const e=t.filter(e=>{var t,n;return(null!==(n=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==n?n:0)>=0}),n=t.filter(e=>{var t,n;return 0>(null!==(n=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==n?n:0)});e.length>0&&(e.reduce(v?(e,t)=>t.y>e.y?e:t:(e,t)=>e.x+e.w>t.x+t.w?e:t).roundedTop=b),n.length>0&&(n.reduce(v?(e,t)=>e.y+e.h>t.y+t.h?e:t:(e,t)=>t.x>e.x?e:t).roundedTop=b)}}return g},clusterbar:function(e,t){const{scales:n,columns:o,config:i,getR:r,getGroup:s,resolvePieceStyle:a}=e,{r:l,projection:c}=n,d=[],u="vertical"===c,h=[],g=new Set;for(const e of Object.values(o))for(const t of e.pieceData){const e=s?s(t):"_default";g.has(e)||(g.add(e),h.push(e))}const f=h.length||1;for(const e of Object.values(o)){const t=e.width/f,n=.2*t,o=t-n,i=new Map;for(const t of e.pieceData){const e=s?s(t):"_default";i.has(e)||i.set(e,[]),i.get(e).push(t)}for(let s=0;h.length>s;s++){const c=i.get(h[s])||[];for(const i of c){const c=r(i),g=a(i,h[s]);if(u){const r=e.x+s*t+n/2,a=l(0),u=l(c);d.push(me(r,Math.min(a,u),o,Math.abs(a-u),g,i,h[s]))}else{const r=e.x+s*t+n/2,a=l(0),u=l(c);d.push(me(Math.min(a,u),r,Math.abs(u-a),o,g,i,h[s]))}}}}const p=i.roundedTop&&i.roundedTop>0?Math.max(0,i.roundedTop):0;for(const e of d){if("rect"!==e.type)continue;if(null==e.datum)continue;const t=r(e.datum);p>0&&(e.roundedTop=p),e.roundedEdge=u?0>t?"bottom":"top":0>t?"left":"right",i.gradientFill&&(e.fillGradient=i.gradientFill)}return d},point:function(e,t){var n,o;const{scales:i,columns:r,getR:s,multiScales:a,resolvePieceStyle:l}=e,{r:c,projection:d}=i,u=[],h="vertical"===d,g="radial"===d,f=a.length>0,p=2*Math.PI,y=-Math.PI/2;for(const e of Object.values(r))for(const t of e.pieceData){const i=null!==(n=t.__rIndex)&&void 0!==n?n:0,r=null!==(o=t.__rValue)&&void 0!==o?o:s(t),d=f&&a[i]||c,m=l(t,e.name),v=m.r||5;let b,x;if(g){const t=y+(e.pctStart+e.pct/2)*p,n=d(r);b=Math.cos(t)*n,x=Math.sin(t)*n}else h?(b=e.middle,x=d(r)):(b=d(r),x=e.middle);u.push({type:"point",x:b,y:x,r:v,style:m,datum:t})}return u},swarm:function(e,t){const{scales:n,columns:o,getR:i,resolvePieceStyle:r}=e,{r:s,projection:a}=n,l=[],c="vertical"===a;for(const e of Object.values(o)){const t=e.width/2;for(let n=0;e.pieceData.length>n;n++){const o=e.pieceData[n],a=i(o),d=r(o,e.name),u=d.r||4,h=(7919*n%100/100-.5)*t*.8,g=c?e.middle+h:s(a),f=c?s(a):e.middle+h;l.push({type:"point",x:g,y:f,r:u,style:d,datum:o})}}return l},pie:ve,donut:ve,boxplot:function(e,t){var n,o,i,r,s,a;const{scales:l,columns:c,config:d,getR:u,resolveSummaryStyle:h}=e,{r:g,projection:f}=l,p=[],y="vertical"===f,m=!1!==d.showOutliers;for(const t of Object.values(c)){const l=t.pieceData.map(e=>u(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===l.length)continue;const c=l[0],d=l[l.length-1],f=null!==(n=x(l,.25))&&void 0!==n?n:c,v=null!==(o=x(l,.5))&&void 0!==o?o:(c+d)/2,b=null!==(i=x(l,.75))&&void 0!==i?i:d,w=b-f,k=f-1.5*w,A=b+1.5*w,O=null!==(r=l.find(e=>e>=k))&&void 0!==r?r:c,S=null!==(s=[...l].reverse().find(e=>A>=e))&&void 0!==s?s:d,j=h(t.pieceData[0],t.name),M=[];if(m)for(const e of t.pieceData){const n=u(e);if(k>n||n>A){const o=y?t.middle:g(n),i=y?g(n):t.middle;M.push({px:o,py:i,value:n,datum:e})}}if(p.push({type:"boxplot",x:y?t.middle:0,y:y?0:t.middle,projection:y?"vertical":"horizontal",columnWidth:.6*t.width,minPos:g(O),q1Pos:g(f),medianPos:g(v),q3Pos:g(b),maxPos:g(S),stats:{n:l.length,min:O,q1:f,median:v,q3:b,max:S,mean:l.reduce((e,t)=>e+t,0)/l.length},style:j,datum:t.pieceData,category:t.name,outliers:M}),m)for(const t of M)p.push({type:"point",x:t.px,y:t.py,r:3,style:{fill:j.fill||(null===(a=e.config.themeSemantic)||void 0===a?void 0:a.secondary)||"#999",opacity:.6},datum:t.datum})}return p},violin:function(e,t){var n,o,i;const{scales:r,columns:s,config:a,getR:l,resolveSummaryStyle:c}=e,{r:d,projection:u}=r,h=[],g="vertical"===u,f=a.bins||20,p=!1!==a.showIQR;for(const e of Object.values(s)){const t=e.pieceData.map(e=>l(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const r=t[0],s=t[t.length-1],a=(s-r)/f||1,u=Array(f).fill(0);for(const e of t)u[Math.min(Math.floor((e-r)/a),f-1)]++;const y=Math.max(...u,1),m=e.width/2*.9;let v="";if(g){v=`M ${e.middle} ${d(r)}`;for(let t=0;f>t;t++){const n=d(r+(t+.5)*a);v+=` L ${e.middle+u[t]/y*m} ${n}`}v+=` L ${e.middle} ${d(s)}`;for(let t=f-1;t>=0;t--){const n=d(r+(t+.5)*a);v+=` L ${e.middle-u[t]/y*m} ${n}`}v+=" Z"}else{v=`M ${d(r)} ${e.middle}`;for(let t=0;f>t;t++)v+=` L ${d(r+(t+.5)*a)} ${e.middle-u[t]/y*m}`;v+=` L ${d(s)} ${e.middle}`;for(let t=f-1;t>=0;t--)v+=` L ${d(r+(t+.5)*a)} ${e.middle+u[t]/y*m}`;v+=" Z"}const b=c(e.pieceData[0],e.name);let w;if(p&&t.length>=4){const a=null!==(n=x(t,.25))&&void 0!==n?n:r,l=null!==(o=x(t,.5))&&void 0!==o?o:(r+s)/2,c=null!==(i=x(t,.75))&&void 0!==i?i:s;w={q1Pos:d(a),medianPos:d(l),q3Pos:d(c),centerPos:e.middle,isVertical:g}}const k=g?{x:e.x,y:Math.min(d(s),d(r)),width:e.width,height:Math.abs(d(s)-d(r))}:{x:Math.min(d(r),d(s)),y:e.x,width:Math.abs(d(s)-d(r)),height:e.width};h.push({type:"violin",pathString:v,translateX:0,translateY:0,bounds:k,iqrLine:w,stats:be(t),style:b,datum:e.pieceData,category:e.name})}return h},histogram:function(e,t){var n;const{scales:o,columns:i,config:r,getR:s,resolveSummaryStyle:a}=e,{r:l}=o,c=[],d=r.bins||25,u=r.normalize,h=null===(n=l.domain)||void 0===n?void 0:n.call(l),g=h?+h[0]:void 0,f=h?+h[1]:void 0;for(const e of Object.values(i)){const t=e.pieceData.map(e=>s(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const n=null!=g&&isFinite(g)?g:Math.min(...t),o=null!=f&&isFinite(f)?f:Math.max(...t),i=(o-n)/d||1,r=Array(d).fill(0);for(const e of t)n>e||e>o||r[Math.min(Math.floor((e-n)/i),d-1)]++;const h=t.length,p=Math.max(...r,1),y=a(e.pieceData[0],e.name);for(let t=0;d>t;t++){if(0===r[t])continue;const o=(u?r[t]/h:r[t]/p)*e.width*.9,s=l(n+t*i),a=l(n+(t+1)*i);c.push(me(Math.min(s,a),e.x+e.width-o,Math.abs(a-s),o,y,{bin:t,count:r[t],range:[n+t*i,n+(t+1)*i],category:e.name},e.name))}}return c},ridgeline:function(e,t){var n;const{scales:o,columns:i,config:r,getR:s,resolveSummaryStyle:a}=e,{r:l,projection:c}=o,d=[],u=r.bins||20,h="horizontal"===c,g=r.amplitude||1.5;for(const e of Object.values(i)){const t=e.pieceData.map(e=>s(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const o=t[0],i=t[t.length-1],r=(i-o)/u||1,c=Array(u).fill(0);for(const e of t)o>e||e>i||c[Math.min(Math.floor((e-o)/r),u-1)]++;const f=Math.max(...c,1),p=a(e.pieceData[0],e.name),y=e.width*g;let m="";if(h){const t=e.x+e.width;m=`M ${l(o)} ${t}`;for(let e=0;u>e;e++)m+=` L ${l(o+(e+.5)*r)} ${t-c[e]/f*y}`;m+=` L ${l(i)} ${t} Z`}else{const t=e.x;m=`M ${t} ${l(o)}`;for(let e=0;u>e;e++){const n=l(o+(e+.5)*r);m+=` L ${t+c[e]/f*y} ${n}`}m+=` L ${t} ${l(i)} Z`}const v=h?{x:Math.min(l(o),l(i)),y:e.x,width:Math.abs(l(i)-l(o)),height:e.width}:{x:e.x,y:Math.min(l(i),l(o)),width:e.width,height:Math.abs(l(i)-l(o))};d.push({type:"violin",pathString:m,translateX:0,translateY:0,bounds:v,stats:be(t),style:Object.assign(Object.assign({},p),{fillOpacity:null!==(n=p.fillOpacity)&&void 0!==n?n:.5}),datum:e.pieceData,category:e.name})}return d},timeline:function(e,t){const{scales:n,columns:o,getRawRange:i,resolvePieceStyle:r}=e,{r:s,projection:a}=n,l=[],c="horizontal"===a;for(const e of Object.values(o))for(const t of e.pieceData){const n=i(t);if(!n)continue;const[o,a]=n,d=r(t,e.name);if(c){const n=s(Math.min(o,a)),i=s(Math.max(o,a));l.push(me(n,e.x,i-n,e.width,d,t,e.name))}else{const n=s(Math.max(o,a)),i=s(Math.min(o,a));l.push(me(e.x,n,e.width,i-n,d,t,e.name))}}return l},funnel:function(e,t){var n,o,i,r,s,a,l,c;const{columns:d,getR:u,getStack:h,resolvePieceStyle:g}=e,f=[],p=t.width/2,y=!1!==e.config.showLabels,v=e.scales.o.domain().map(e=>d[e]).filter(Boolean);if(0===v.length)return f;const b=[],x=new Set;for(const e of v)for(const t of e.pieceData){const e=h?h(t):"_default";x.has(e)||(x.add(e),b.push(e))}const w=b.length>1&&"_default"!==b[0],k=[];let A=0;for(const e of v){const t=new Map;let n=0;for(const o of e.pieceData){const e=h?h(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const i=t.get(e),r=u(o);i.total+=r,i.pieces.push(o),n+=r}k.push({col:e,groups:t,stepTotal:n}),w||n>A&&(A=n)}if(w)for(const e of k){let t=0,n=0;for(let o=0;b.length>o;o++){const i=e.groups.get(b[o]);i&&(o%2==0?t+=i.total:n+=i.total)}const o=Math.max(t,n);o>A&&(A=o)}if(0===A)return f;const O=new Map;for(const e of b){const t=k[0].groups.get(e);O.set(e,null!==(n=null==t?void 0:t.total)&&void 0!==n?n:0)}const S=k[0].stepTotal,j=w?.95*p:.9*t.width,M=m().domain([0,A]).range([0,j]),_=null!==(o=e.config.connectorOpacity)&&void 0!==o?o:.3;let C=new Map;for(let t=0;k.length>t;t++){const n=k[t],o=n.col,d=0===t,u=o.width,h=.55*u,m=o.x+(u-h)/2,v=new Map;if(w){let e=0;for(const t of b){const o=n.groups.get(t);o&&(e+=M(o.total))}let t=p,i=p;for(let r=0;b.length>r;r++){const a=b[r],l=n.groups.get(a);if(!l)continue;const c=M(l.total),u=r%2==0,x=u?t:i-c;u?t+=c:i-=c;const w=g(l.pieces[0],a),k=null!==(s=O.get(a))&&void 0!==s?s:l.total,A=k>0?l.total/k*100:0,S=Object.assign(Object.assign({},l.pieces[0]),{__funnelValue:l.total,__funnelPercent:A,__funnelStep:o.name,__funnelIsFirstStep:d,__aggregateValue:l.total,__pieceCount:l.pieces.length,category:a});y&&(0===r&&(S.__funnelStepLabel=o.name,S.__funnelStepLabelX=p,S.__funnelStepLabelY=m,S.__funnelRowWidth=e),S.__funnelValueLabelX=x+c/2,S.__funnelValueLabelY=m,S.__funnelBarW=c),f.push(me(x,m,c,h,w,S,a)),v.set(a,{x:x,y:m,w:c,h:h})}}else{const e=n.stepTotal,t=M(e),s=p-t/2,a=b[0],l="_default"!==a,c=null!==(r=null===(i=n.groups.get(a))||void 0===i?void 0:i.pieces[0])&&void 0!==r?r:o.pieceData[0],u=l?a:o.name,x=g(c,u),w=S>0?e/S*100:0,k=Object.assign(Object.assign({},c),{__funnelValue:e,__funnelPercent:w,__funnelStep:o.name,__funnelIsFirstStep:d,category:l?a:o.name});y&&(k.__funnelStepLabel=o.name,k.__funnelStepLabelX=p,k.__funnelStepLabelY=m,k.__funnelRowWidth=t,k.__funnelValueLabelX=p,k.__funnelValueLabelY=m,k.__funnelBarW=t),f.push(me(s,m,t,h,x,k,u)),v.set(a,{x:s,y:m,w:t,h:h})}if(t>0&&C.size>0){const t=w?b:[b[0]];for(const i of t){const t=C.get(i),r=v.get(i);if(!t||!r)continue;const s=(()=>{const e=n.groups.get(i);return g(e?e.pieces[0]:o.pieceData[0],"_default"===i?o.name:i)})(),d={type:"trapezoid",points:[[t.x,t.y+t.h],[t.x+t.w,t.y+t.h],[r.x+r.w,r.y],[r.x,r.y]],style:{fill:s.fill||(null===(a=e.config.themeSemantic)||void 0===a?void 0:a.secondary)||"#999",opacity:_},datum:null!==(c=null===(l=n.groups.get(i))||void 0===l?void 0:l.pieces[0])&&void 0!==c?c:o.pieceData[0],category:"_default"===i?o.name:i};f.push(d)}}C=v}return f},"bar-funnel":function(e,t){var n,o,i,r;const{columns:s,getR:a,getStack:l,resolvePieceStyle:c,scales:d}=e,u=[],h=d.o.domain().map(e=>s[e]).filter(Boolean);if(0===h.length)return u;const g=[],f=new Set;for(const e of h)for(const t of e.pieceData){const e=l?l(t):"_default";f.has(e)||(f.add(e),g.push(e))}const p=g.length>1&&"_default"!==g[0],y=[];for(const e of h){const t=new Map;let n=0;for(const o of e.pieceData){const e=l?l(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const i=t.get(e),r=a(o);i.total+=r,i.pieces.push(o),n+=r}y.push({col:e,groups:t,stepTotal:n})}const m=new Map;for(const e of g){const t=null===(n=y[0])||void 0===n?void 0:n.groups.get(e);m.set(e,null!==(o=null==t?void 0:t.total)&&void 0!==o?o:0)}const v=d.r,b=p?g.length:1,x=p?.15:0;for(let e=0;y.length>e;e++){const t=y[e],n=t.col,o=0===e,s=e>0?y[e-1]:null,a=n.width/b,l=a*x,d=a-l;for(let e=0;g.length>e;e++){const h=g[e],f=t.groups.get(h);if(!f)continue;const y=f.total,b=null!==(i=m.get(h))&&void 0!==i?i:y,x=b>0?y/b*100:0,w=null==s?void 0:s.groups.get(h),k=null!==(r=null==w?void 0:w.total)&&void 0!==r?r:y,A=o?0:Math.max(0,k-y),O=n.x+e*a+l/2,S=v(y),j=v(0)-S,M=c(f.pieces[0],p?h:n.name),_=Object.assign(Object.assign({},f.pieces[0]),{__barFunnelValue:y,__barFunnelPercent:x,__barFunnelIsFirstStep:o,__barFunnelIsDropoff:!1,__barFunnelStep:n.name,__barFunnelDropoffValue:A,__barFunnelCategory:"_default"===h?void 0:h,category:p?h:n.name,__barFunnelLabelX:O+d/2,__barFunnelLabelY:v(y+A)});if(u.push(me(O,S,d,j,M,_,p?h:n.name)),A>0){const e=v(y+A),t=S-e,o=Object.assign({},M),i=Object.assign(Object.assign({},f.pieces[0]),{__barFunnelValue:A,__barFunnelPercent:b>0?A/b*100:0,__barFunnelIsFirstStep:!1,__barFunnelIsDropoff:!0,__barFunnelStep:n.name,__barFunnelCategory:"_default"===h?void 0:h,category:p?h:n.name});u.push(me(O,e,d,t,o,i,p?h:n.name))}}}return u},swimlane:function(e,t){var n;const{scales:o,columns:i,getR:r,getStack:s,resolvePieceStyle:a}=e,{r:l,projection:c}=o,d=[],u="horizontal"===c,h=e.config.gradientFill,g=u?"left":"bottom",f=e.config.trackFill;if(f){const e="string"==typeof f?f:f.color,t="string"==typeof f?1:null!==(n=f.opacity)&&void 0!==n?n:1,[o,r]=l.range(),s=Math.min(o,r),a=Math.abs(r-o);for(const n of Object.values(i)){const o={fill:e,opacity:t},i=u?me(s,n.x,a,n.width,o,null,"__track__"):me(n.x,s,n.width,a,o,null,"__track__");d.push(i)}}const p=e.config.roundedTop&&e.config.roundedTop>0?Math.max(0,e.config.roundedTop):0;for(const e of Object.values(i)){let t=0;const n=d.length;for(const n of e.pieceData){const o=Math.abs(r(n));if(0===o)continue;const i=s?s(n):e.name,c=a(n,i);let f;if(u){const r=l(t),s=l(t+o);f=me(r,e.x,s-r,e.width,c,n,i)}else{const r=l(t+o),s=l(t);f=me(e.x,r,e.width,s-r,c,n,i)}h&&(f.fillGradient=h,f.roundedEdge=g),d.push(f),t+=o}if(p>0&&d.length>n){const e=d.slice(n),t=e[0],o=e[e.length-1];1===e.length?t.cornerRadii={tl:p,tr:p,br:p,bl:p}:u?(t.cornerRadii={tl:p,bl:p},o.cornerRadii={tr:p,br:p}):(t.cornerRadii={bl:p,br:p},o.cornerRadii={tl:p,tr:p})}}return d}};class ke{constructor(e){this.rExtent=new E,this.rExtents=[],this.rAccessors=[],this.categories=new Set,this._hasStreamingData=!1,this._colorSchemeMap=null,this._colorSchemeIndex=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositionMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this.scales=null,this.multiScales=[],this.scene=[],this.columns={},this.customLayoutOverlays=null,this.version=0,this._dataVersion=0,this._pointQuadtree=null,this._maxPointRadius=0,this._datumIndexCache=null,this._categoryIndexCache=null,this._hasRenderedOnce=!1,this.config=e,this.buffer=new N(e.windowSize),this.getO=q(e.categoryAccessor||e.oAccessor,"category");const t=e.valueAccessor||e.rAccessor;Array.isArray(t)?(this.rAccessors=t.map(e=>G(e,"value")),this.getR=this.rAccessors[0],this.rExtents=t.map(()=>new E)):(this.getR=G(t,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=q(e.stackBy),this.getGroup=q(e.groupBy),this.getColor=q(e.colorAccessor),this.getConnector=q(e.connectorAccessor),this.getDataId=q(e.dataIdAccessor),e.pulse&&(this.timestampBuffer=new N(e.windowSize))}ingest(e){const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,this._dataVersion++,e.bounded){this.buffer.clear(),this.rExtent.clear();for(const e of this.rExtents)e.clear();e.preserveCategoryOrder?this._hasStreamingData=!0:this.categories.clear(),this.timestampBuffer&&this.timestampBuffer.clear();const n=e.totalSize||e.inserts.length;n>this.buffer.capacity&&(this.buffer.resize(n),this.timestampBuffer&&n>this.timestampBuffer.capacity&&this.timestampBuffer.resize(n));for(const n of e.inserts)this.buffer.push(n),this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(n)),this.pushValueExtent(n)}else{this._hasStreamingData=!0;for(const n of e.inserts){const e=this.buffer.push(n);this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(n)),this.pushValueExtent(n),null!=e&&this.evictValueExtent(e)}}return!0}pushValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.push(t[0]),this.rExtent.push(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].push(this.rAccessors[t](e));this.rExtent.push(this.getR(e))}else this.rExtent.push(this.getR(e))}evictValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.evict(t[0]),this.rExtent.evict(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].evict(this.rAccessors[t](e));this.rExtent.evict(this.getR(e))}else this.rExtent.evict(this.getR(e))}getRawRange(e){const t=this.config.valueAccessor||this.config.rAccessor;if(!t)return null;const n="function"==typeof t?t(e):e[t];return Array.isArray(n)&&n.length>=2?[+n[0],+n[1]]:null}computeScene(e){const{config:t,buffer:n}=this;if(0===n.size)return this.scales=null,this.scene=[],this.columns={},void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(n,this.getR);const o=n.toArray(),i=t.projection||"vertical",r=t.oExtent||this.resolveCategories(o),s=this.computeValueDomain(o,r),a="horizontal"===i,l="radial"===i,c=Math.min(.9,Math.max(0,null!=t.barPadding?t.barPadding/("vertical"===i?e.width:e.height):.1));let d,u;if(l){d=v().domain(r).range([0,1]).padding(0);const n=Math.min(e.width,e.height)/2,o=t.innerRadius||0;u=m().domain(s).range([o,n])}else a?(d=v().domain(r).range([0,e.height]).padding(c),u=m().domain(s).range([0,e.width])):(d=v().domain(r).range([0,e.width]).padding(c),u=m().domain(s).range([e.height,0]));this.scales={o:d,r:u,projection:i},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((o,i)=>{var r;const s=this.rExtents[i];s.dirty&&s.recalculate(n,o);let[l,c]=s.extent;l===1/0&&(l=0,c=1);const d=null!==(r=t.extentPadding)&&void 0!==r?r:.05,u=c-l,h=u>0?u*d:1;return l-=h,c+=h,l>0&&(l=0),a?m().domain([l,c]).range([0,e.width]):m().domain([l,c]).range([e.height,0])}):[];let h=o;this.rAccessors.length>1&&(h=o.flatMap(e=>this.rAccessors.map((t,n)=>Object.assign(Object.assign({},e),{__rIndex:n,__rValue:t(e),__rName:this.resolveRAccessorName(n)})))),this.columns=this.buildColumns(h,r,d,i,e),this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(h,e),this.rebuildPointQuadtree(),this.config.decay&&this.applyDecay(this.scene,o),this.config.pulse&&this.applyPulse(this.scene,o),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&this.prevPositionMap.size>0&&this.startTransition(),this.version++}resolveRAccessorName(e){const t=this.config.valueAccessor||this.config.rAccessor,n=Array.isArray(t)?t[e]:t;return"string"==typeof n?n:"value"+e}resolveCategories(e){const t=this.config.oSort,n="streaming"===this.config.runtimeMode||this._hasStreamingData,o="auto"===t?void 0:t;let i=null;if(n){i=new Set;for(const t of e)i.add(this.getO(t))}const r=i?Array.from(this.categories).filter(e=>i.has(e)):Array.from(this.categories);if(n&&void 0===o){const e=Math.max(50,3*i.size);if(this.categories.size>e){let t=this.categories.size-e;for(const e of this.categories){if(0>=t)break;i.has(e)||(this.categories.delete(e),t--)}}return r}if(!1===o)return r;if("function"==typeof o)return r.sort(o);const s=new Map;for(const t of e){const e=this.getO(t);s.set(e,(s.get(e)||0)+Math.abs(this.getR(t)))}return r.sort("asc"===o?(e,t)=>(s.get(e)||0)-(s.get(t)||0):(e,t)=>(s.get(t)||0)-(s.get(e)||0))}computeValueDomain(e,t){var n,o,i,r,s;const a=this.config.chartType,l=null!==(n=this.config.extentPadding)&&void 0!==n?n:.05;if("radial"===this.config.projection&&("pie"===a||"donut"===a))return[0,1];let c=0,d=0;if("bar"===a&&this.getStack&&this.config.normalize)c=0,d=1;else if("bar"===a&&this.getStack){const t=new Map,n=new Map;for(const o of e){const e=this.getO(o),i=this.getR(o);0>i?n.set(e,(n.get(e)||0)+i):t.set(e,(t.get(e)||0)+i)}for(const e of t.values())e>d&&(d=e);for(const e of n.values())c>e&&(c=e)}else if("bar"===a){const t=new Map;for(const n of e){const e=this.getO(n),o=this.getR(n);t.set(e,(t.get(e)||0)+o)}for(const e of t.values())e>d&&(d=e),c>e&&(c=e)}else if("swimlane"===a){const t=new Map;for(const n of e){const e=this.getO(n),o=Math.abs(this.getR(n));t.set(e,(t.get(e)||0)+o)}for(const e of t.values())e>d&&(d=e)}else if("clusterbar"===a||"bar-funnel"===a)for(const t of e){const e=this.getR(t);e>d&&(d=e),c>e&&(c=e)}else{const e=this.rExtent.extent[0],t=this.rExtent.extent[1];e!==1/0&&(c=e),t!==-1/0&&(d=t)}this.config.rExtent&&(null!=this.config.rExtent[0]&&(c=this.config.rExtent[0]),null!=this.config.rExtent[1]&&(d=this.config.rExtent[1]));const u="bar"===a||"clusterbar"===a||"bar-funnel"===a||"swimlane"===a;if(u&&null==(null===(o=this.config.rExtent)||void 0===o?void 0:o[0])&&null==(null===(i=this.config.rExtent)||void 0===i?void 0:i[1])&&(c>0&&(c=0),0>d&&(d=0)),"bar-funnel"!==a&&"exact"!==this.config.axisExtent){const e=d-c,t=e>0?e*l:1;null!=(null===(r=this.config.rExtent)||void 0===r?void 0:r[0])||u&&!this.config.baselinePadding&&0===c||(c-=t),null!=(null===(s=this.config.rExtent)||void 0===s?void 0:s[1])||u&&!this.config.baselinePadding&&0===d||"swimlane"===a||(d+=t)}return[c,d]}buildColumns(e,t,n,o,i){var r;const s={},a=new Map;for(const t of e){const e=this.getO(t);a.has(e)||a.set(e,[]),a.get(e).push(t)}let l=0;if("radial"===o)for(const t of e)l+=Math.abs(this.getR(t));const c=this.config.dynamicColumnWidth;let d=null;if(c&&"radial"!==o){d=new Map;let e=0;for(const n of t){const t=a.get(n)||[];let o;o="string"==typeof c?t.reduce((e,t)=>e+(Number(t[c])||0),0):c(t),d.set(n,o),e+=o}const r=("horizontal"===o?i.height:i.width)-n.padding()*n.step()*t.length;if(e>0)for(const[t,n]of d)d.set(t,n/e*r)}let u=0,h=0;for(const e of t){const t=a.get(e)||[],o=t.reduce((e,t)=>e+Math.abs(this.getR(t)),0),i=l>0?o/l:0;let c,g;d?(c=h,g=d.get(e)||n.bandwidth(),h+=g+n.padding()*n.step()):(c=null!==(r=n(e))&&void 0!==r?r:0,g=n.bandwidth()),s[e]={name:e,x:c,y:0,width:g,middle:c+g/2,padding:n.padding()*n.step(),pieceData:t,pct:i,pctStart:u},u+=i}return s}getSceneContext(){return{scales:this.scales,columns:this.columns,config:this.config,getR:this.getR,getStack:this.getStack,getGroup:this.getGroup,getColor:this.getColor,getConnector:this.getConnector,getO:this.getO,multiScales:this.multiScales,rAccessors:this.rAccessors,resolvePieceStyle:(e,t)=>this.resolvePieceStyle(e,t),resolveSummaryStyle:(e,t)=>this.resolveSummaryStyle(e,t),getRawRange:e=>this.getRawRange(e)}}buildSceneNodes(e,t){var n,o;if(!this.scales)return[];if(this.config.customLayout){const i=this.buildLayoutContext(e,t);let r;try{r=this.config.customLayout(i)}catch(e){return"production"!==process.env.NODE_ENV&&console.error("[semiotic] ordinal customLayout threw:",e),this.customLayoutOverlays=null,[]}return this.customLayoutOverlays=null!==(n=r.overlays)&&void 0!==n?n:null,null!==(o=r.nodes)&&void 0!==o?o:[]}this.customLayoutOverlays=null;const i=this.getSceneContext(),r=we[this.config.chartType];let s=r?r(i,t):[];if(this.getConnector&&this.scales){const e=function(e,t){var n,o;const{scales:i,config:r,getConnector:s,getO:a}=e;if(!s||!i)return[];const l=[],{projection:c}=i,d=new Map;for(const e of t){if("point"!==e.type&&"rect"!==e.type)continue;const t=e.datum;if(!t)continue;const n=s(t);if(!n)continue;let o,i;"point"===e.type?(o=e.x,i=e.y):(o=e.x+e.w/2,i=e.y+("vertical"===c?0:e.h/2)),d.has(n)||d.set(n,[]),d.get(n).push({x:o,y:i,datum:t,category:a(t)})}const u=i.o.domain(),h=r.connectorStyle;for(const[t,i]of d)if(i.length>=2){i.sort((e,t)=>u.indexOf(e.category)-u.indexOf(t.category));for(let r=0;i.length-1>r;r++){const s=i[r],a=i[r+1],c="function"==typeof h?h(s.datum):h||{stroke:(null===(n=e.config.themeSemantic)||void 0===n?void 0:n.border)||(null===(o=e.config.themeSemantic)||void 0===o?void 0:o.secondary)||"#999",strokeWidth:1,opacity:.5};l.push({type:"connector",x1:s.x,y1:s.y,x2:a.x,y2:a.y,style:c,datum:s.datum,group:t})}}return l}(i,s);s=[...e,...s]}return s}buildLayoutContext(e,t){var n,o,i;const r=this.config,s=null!==(n=r.layoutMargin)&&void 0!==n?n:{top:0,right:0,bottom:0,left:0},a=function(e,t,n){if(Array.isArray(e)&&e.length>0)return e;if("string"==typeof e){const t=de[e];if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:n}(r.colorScheme,r.themeCategorical,he),l=this.scales;return{data:e,scales:{o:l.o,r:l.r,projection:l.projection},dimensions:{width:t.width,height:t.height,margin:s,plot:"radial"===l.projection?{x:-t.width/2,y:-t.height/2,width:t.width,height:t.height}:{x:0,y:0,width:t.width,height:t.height}},theme:{semantic:null!==(o=r.themeSemantic)&&void 0!==o?o:{},categorical:[...a]},resolveColor:xe(a),config:null!==(i=r.layoutConfig)&&void 0!==i?i:{}}}resolvePieceStyle(e,t){if("function"==typeof this.config.pieceStyle){const n=this.config.pieceStyle(e,t);return n&&!n.fill&&t?Object.assign(Object.assign({},n),{fill:this.getColorFromScheme(t)}):n}return this.config.pieceStyle&&"object"==typeof this.config.pieceStyle?this.config.pieceStyle:this.config.barColors&&t?{fill:this.config.barColors[t]||"#007bff"}:t?{fill:this.getColorFromScheme(t)}:{fill:"#007bff"}}getColorFromScheme(e){this._colorSchemeMap||(this._colorSchemeMap=new Map);const t=this._colorSchemeMap.get(e);if(t)return t;const n=Array.isArray(this.config.colorScheme)?this.config.colorScheme:this.config.themeCategorical||he,o=n[this._colorSchemeIndex%n.length];return this._colorSchemeIndex++,this._colorSchemeMap.set(e,o),o}resolveSummaryStyle(e,t){return"function"==typeof this.config.summaryStyle?this.config.summaryStyle(e,t):this.config.summaryStyle&&"object"==typeof this.config.summaryStyle?this.config.summaryStyle:{fill:"#007bff",fillOpacity:.6,stroke:"#007bff",strokeWidth:1}}computeDecayOpacity(e,t){const n=this.config.decay;return n&&t>1?function(e,t,n){var o,i,r;if(1>=n)return 1;const s=null!==(o=e.minOpacity)&&void 0!==o?o:.1,a=n-1-t;switch(e.type){case"linear":return s+(1-a/(n-1))*(1-s);case"exponential":{const t=null!==(i=e.halfLife)&&void 0!==i?i:n/2;return s+Math.pow(.5,a/t)*(1-s)}case"step":return(null!==(r=e.stepThreshold)&&void 0!==r?r:.5*n)>a?1:s;default:return 1}}(n,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._dataVersion)return this._datumIndexCache.map;const t=new Map;for(let n=0;e.length>n;n++)t.set(e[n],n);return this._datumIndexCache={version:this._dataVersion,map:t},t}getCategoryIndexMap(e){if(this._categoryIndexCache&&this._categoryIndexCache.version===this._dataVersion)return this._categoryIndexCache.map;const t=this.config.categoryAccessor||this.config.oAccessor,n="function"==typeof t,o=n?null:t||"category",i=new Map;for(let r=0;e.length>r;r++){const s=e[r],a=n?t(s):s[o];let l=i.get(a);l||(l=[],i.set(a,l)),l.push(r)}return this._categoryIndexCache={version:this._dataVersion,map:i},i}rebuildPointQuadtree(){let e=0,t=0;for(const n of this.scene)"point"===n.type&&(e++,n.r>t&&(t=n.r));if(this._maxPointRadius=t,ke.QUADTREE_THRESHOLD>=e)return void(this._pointQuadtree=null);const n=Array(e);let o=0;for(const e of this.scene)"point"===e.type&&(n[o++]=e);this._pointQuadtree=b().x(e=>e.x).y(e=>e.y).addAll(n)}get pointQuadtree(){return this._pointQuadtree}get maxPointRadius(){return this._maxPointRadius}applyDecay(e,t){var n,o;if(!this.config.decay)return;const i=t.length;if(1>=i)return;const r=this.getDatumIndexMap(t);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;const e=r.get(t.datum);if(null==e)continue;const s=this.computeDecayOpacity(e,i),a=null!==(o=null===(n=t.style)||void 0===n?void 0:n.opacity)&&void 0!==o?o:1;t.style=Object.assign(Object.assign({},t.style),{opacity:a*s})}}applyPulse(e,t){var n,o,i;if(!this.config.pulse||!this.timestampBuffer)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=null!==(n=this.config.pulse.duration)&&void 0!==n?n:500,a=null!==(o=this.config.pulse.color)&&void 0!==o?o:"rgba(255,255,255,0.6)",l=null!==(i=this.config.pulse.glowRadius)&&void 0!==i?i:4,c=this.getDatumIndexMap(t);let d=null;for(const n of e){if("connector"===n.type||"violin"===n.type||"boxplot"===n.type)continue;if("wedge"===n.type){const e=n.category;if(!e)continue;d||(d=this.getCategoryIndexMap(t));const o=d.get(e);if(!o)continue;let i=0;for(let e=0;o.length>e;e++){const t=this.timestampBuffer.get(o[e]);if(null==t)continue;const n=r-t;if(s>n){const e=1-n/s;e>i&&(i=e)}}i>0&&(n._pulseIntensity=i,n._pulseColor=a);continue}const e=c.get(n.datum);if(null==e)continue;const o=this.timestampBuffer.get(e);if(null==o)continue;const i=r-o;s>i&&(n._pulseIntensity=1-i/s,n._pulseColor=a,n._pulseGlowRadius=l)}}get hasActivePulses(){var e;if(!this.config.pulse||!this.timestampBuffer||0===this.timestampBuffer.size)return!1;const t="undefined"!=typeof performance?performance.now():Date.now(),n=null!==(e=this.config.pulse.duration)&&void 0!==e?e:500,o=this.timestampBuffer.peek();return null!=o&&n>t-o}synthesizeIntroPositions(){var e,t,n,o,i;this.prevPositionMap.clear();const r=new Map,s=null!==(t=null===(e=this.scales)||void 0===e?void 0:e.r(0))&&void 0!==t?t:0,a="horizontal"!==(null===(n=this.scales)||void 0===n?void 0:n.projection);let l;for(let e=0;this.scene.length>e;e++){const t=this.scene[e],n=this.getNodeKey(t,r);n&&("rect"===t.type?this.prevPositionMap.set(n,a?{x:t.x,y:s,w:t.w,h:0,opacity:null!==(o=t.style.opacity)&&void 0!==o?o:1}:{x:s,y:t.y,w:0,h:t.h,opacity:null!==(i=t.style.opacity)&&void 0!==i?i:1}):"point"===t.type?this.prevPositionMap.set(n,{x:t.x,y:t.y,r:0,opacity:0}):"wedge"===t.type&&(void 0===l&&(l=t.startAngle),this.prevPositionMap.set(n,{x:t.cx,y:t.cy,startAngle:l,endAngle:l,innerRadius:t.innerRadius,outerRadius:t.outerRadius,opacity:0})))}}getNodeKey(e,t){var n,o,i;if("point"===e.type){const n=`p:${e.datum?this.getO(e.datum):""}:${e.datum?this.getR(e.datum):0}`,o=t.get(n)||0;return t.set(n,o+1),`${n}:${o}`}return"rect"===e.type?`r:${e.group||""}:${null!==(o=null===(n=e.datum)||void 0===n?void 0:n.category)&&void 0!==o?o:""}`:"wedge"===e.type?"w:"+(null!==(i=e.category)&&void 0!==i?i:""):null}snapshotPositions(){var e;this.prevPositionMap.clear();const t=new Map;for(let n=0;this.scene.length>n;n++){const o=this.scene[n],i=this.getNodeKey(o,t);i&&("point"===o.type?this.prevPositionMap.set(i,{x:o.x,y:o.y,r:o.r,opacity:o.style.opacity}):"rect"===o.type?this.prevPositionMap.set(i,{x:o.x,y:o.y,w:o.w,h:o.h,opacity:o.style.opacity}):"wedge"===o.type&&this.prevPositionMap.set(i,{x:o.cx,y:o.cy,startAngle:o.startAngle,endAngle:o.endAngle,innerRadius:o.innerRadius,outerRadius:o.outerRadius,opacity:null!==(e=o.style.opacity)&&void 0!==e?e:1}))}}startTransition(){var e,t,n,o,i,r,s,a,l,c,d,u,h,g,f,p,y,m,v,b,x;if(!this.config.transition||0===this.prevPositionMap.size)return;const w=null!==(e=this.config.transition.duration)&&void 0!==e?e:300;if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}let k=!1;const A=new Set,O=new Map;for(let e=0;this.scene.length>e;e++){const c=this.scene[e],d=this.getNodeKey(c,O);if(!d)continue;c._transitionKey=d;const u=this.prevPositionMap.get(d);if("point"===c.type)u?(A.add(d),c._targetOpacity=null!==(t=c.style.opacity)&&void 0!==t?t:1,(u.x!==c.x||u.y!==c.y||void 0!==u.r&&u.r!==c.r)&&(c._targetX=c.x,c._targetY=c.y,c._targetR=c.r,c.x=u.x,c.y=u.y,void 0!==u.r&&(c.r=u.r),k=!0)):(c._targetOpacity=null!==(n=c.style.opacity)&&void 0!==n?n:1,c._targetR=c.r,c.r=0,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),k=!0);else if("rect"===c.type)u?(A.add(d),c._targetOpacity=null!==(o=c.style.opacity)&&void 0!==o?o:1,u.x===c.x&&u.y===c.y&&u.w===c.w&&u.h===c.h||(c._targetX=c.x,c._targetY=c.y,c._targetW=c.w,c._targetH=c.h,c.x=u.x,c.y=u.y,c.w=null!==(i=u.w)&&void 0!==i?i:c.w,c.h=null!==(r=u.h)&&void 0!==r?r:c.h,k=!0)):(c._targetOpacity=null!==(s=c.style.opacity)&&void 0!==s?s:1,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),k=!0);else if("wedge"===c.type)if(u)A.add(d),c._targetOpacity=null!==(a=c.style.opacity)&&void 0!==a?a:1,u.startAngle===c.startAngle&&u.endAngle===c.endAngle||(c._targetStartAngle=c.startAngle,c._targetEndAngle=c.endAngle,c.startAngle=u.startAngle,c.endAngle=u.endAngle,k=!0);else{c._targetOpacity=null!==(l=c.style.opacity)&&void 0!==l?l:1,c._targetStartAngle=c.startAngle,c._targetEndAngle=c.endAngle;const e=c.startAngle;c.startAngle=e,c.endAngle=e,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),this.prevPositionMap.set(d,{x:c.cx,y:c.cy,startAngle:e,endAngle:e,innerRadius:c.innerRadius,outerRadius:c.outerRadius,opacity:0}),k=!0}}this.exitNodes=[];for(const[e,t]of this.prevPositionMap)if(!A.has(e)){if(e.startsWith("p:"))this.exitNodes.push({type:"point",x:t.x,y:t.y,r:null!==(c=t.r)&&void 0!==c?c:3,style:{opacity:null!==(d=t.opacity)&&void 0!==d?d:1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("r:"))this.exitNodes.push({type:"rect",x:t.x,y:t.y,w:null!==(u=t.w)&&void 0!==u?u:0,h:null!==(h=t.h)&&void 0!==h?h:0,style:{opacity:null!==(g=t.opacity)&&void 0!==g?g:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("w:")){const n=((null!==(f=t.startAngle)&&void 0!==f?f:0)+(null!==(p=t.endAngle)&&void 0!==p?p:0))/2,o={type:"wedge",cx:t.x,cy:t.y,innerRadius:null!==(y=t.innerRadius)&&void 0!==y?y:0,outerRadius:null!==(m=t.outerRadius)&&void 0!==m?m:100,startAngle:null!==(v=t.startAngle)&&void 0!==v?v:0,endAngle:null!==(b=t.endAngle)&&void 0!==b?b:0,style:{opacity:null!==(x=t.opacity)&&void 0!==x?x:1},datum:null,category:e.slice(2),_targetStartAngle:n,_targetEndAngle:n,_targetOpacity:0,_transitionKey:e};this.exitNodes.push(o)}k=!0}this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),k&&(this.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:w})}advanceTransition(e){var t,n,o,i;if(!this.activeTransition)return!1;const r=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,this.activeTransition),s=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(r,"linear"===(null===(t=this.config.transition)||void 0===t?void 0:t.easing)?"linear":"ease-out-cubic");for(const e of this.scene){const t=e._transitionKey;if(t)if("point"===e.type){if(void 0!==e._targetOpacity){const o=this.prevPositionMap.get(t),i=o?null!==(n=o.opacity)&&void 0!==n?n:1:0;e.style.opacity=W(i,e._targetOpacity,s)}const o=this.prevPositionMap.get(t);void 0!==e._targetX&&o&&(e.x=W(o.x,e._targetX,s),e.y=W(o.y,e._targetY,s)),void 0!==e._targetR&&void 0!==(null==o?void 0:o.r)&&(e.r=W(o.r,e._targetR,s))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t),i=n?null!==(o=n.opacity)&&void 0!==o?o:1:0;e.style.opacity=W(i,e._targetOpacity,s)}if(void 0===e._targetX)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=W(n.x,e._targetX,s),e.y=W(n.y,e._targetY,s),void 0!==n.w&&(e.w=W(n.w,e._targetW,s),e.h=W(n.h,e._targetH,s))}else if("wedge"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t),o=n?null!==(i=n.opacity)&&void 0!==i?i:1:0;e.style=Object.assign(Object.assign({},e.style),{opacity:W(o,e._targetOpacity,s)})}if(void 0!==e._targetStartAngle&&void 0!==e._targetEndAngle){const n=this.prevPositionMap.get(t);n&&void 0!==n.startAngle&&(e.startAngle=W(n.startAngle,e._targetStartAngle,s),e.endAngle=W(n.endAngle,e._targetEndAngle,s))}}}if(r>=1){for(const e of this.scene)if(void 0!==e._targetOpacity&&(e.style=Object.assign(Object.assign({},e.style||{}),{opacity:0===e._targetOpacity?0:e._targetOpacity}),e._targetOpacity=void 0),"point"===e.type){if(void 0===e._targetX&&void 0===e._targetR)continue;void 0!==e._targetX&&(e.x=e._targetX,e.y=e._targetY),void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else"wedge"===e.type&&void 0!==e._targetStartAngle&&(e.startAngle=e._targetStartAngle,e.endAngle=e._targetEndAngle,e._targetStartAngle=void 0,e._targetEndAngle=void 0);if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}return this.activeTransition=null,!1}return!0}cancelIntroAnimation(){this.prevPositionMap.clear(),this.activeTransition=null}getData(){return this.buffer.toArray()}remove(e){if(!this.getDataId)throw Error("remove() requires dataIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=new Set(Array.isArray(e)?e:[e]),n=this.getDataId,o=e=>t.has(n(e));if(this.timestampBuffer&&this.timestampBuffer.size>0){const e=this.timestampBuffer.toArray(),t=new Set;this.buffer.forEach((e,n)=>{o(e)&&t.add(n)}),this.timestampBuffer.clear();for(let n=0;e.length>n;n++)t.has(n)||this.timestampBuffer.push(e[n])}const i=this.buffer.remove(o);if(0===i.length)return i;for(const e of i)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach(e=>this.categories.add(this.getO(e))),this._dataVersion++,this.version++,i}update(e,t){if(!this.getDataId)throw Error("update() requires dataIdAccessor to be configured");const n=new Set(Array.isArray(e)?e:[e]),o=this.getDataId,i=new Set;this.buffer.forEach((e,t)=>{n.has(o(e))&&i.add(t)});const r=this.buffer.update(e=>n.has(o(e)),t);if(0===r.length)return r;for(const e of r)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach((e,t)=>{this.categories.add(this.getO(e)),i.has(t)&&this.pushValueExtent(e)}),this._dataVersion++,this.version++,r}clear(){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this._hasStreamingData=!1,this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this.scales=null,this.scene=[],this.columns={},this._pointQuadtree=null,this._maxPointRadius=0,this._colorSchemeMap=null,this._colorSchemeIndex=0,this._dataVersion++,this.version++}get size(){return this.buffer.size}getOAccessor(){return this.getO}getRAccessor(){return this.getR}updateConfig(e){const t=Object.assign({},this.config);if(("colorScheme"in e&&e.colorScheme!==t.colorScheme||"themeCategorical"in e&&e.themeCategorical!==t.themeCategorical||"colorAccessor"in e&&!z(e.colorAccessor,t.colorAccessor))&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),("categoryAccessor"in e&&!z(e.categoryAccessor,t.categoryAccessor)||"oAccessor"in e&&!z(e.oAccessor,t.oAccessor))&&(this._categoryIndexCache=null),Object.assign(this.config,e),("categoryAccessor"in e||"oAccessor"in e)&&(z(e.categoryAccessor||e.oAccessor,t.categoryAccessor||t.oAccessor)||(this.getO=q(this.config.categoryAccessor||this.config.oAccessor,"category"),this.categories.clear())),"valueAccessor"in e||"rAccessor"in e){const n=e.valueAccessor||e.rAccessor,o=t.valueAccessor||t.rAccessor,i=Array.isArray(n)?n:[n],r=Array.isArray(o)?o:[o];if(i.length!==r.length||i.some((e,t)=>!z(e,r[t]))){const e=this.config.valueAccessor||this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>G(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new E)):(this.getR=G(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!z(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?q(this.config.stackBy):void 0),"groupBy"in e&&!z(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?q(this.config.groupBy):void 0),"colorAccessor"in e&&!z(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?q(this.config.colorAccessor):void 0),"connectorAccessor"in e&&!z(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?q(this.config.connectorAccessor):void 0)}}function Ae(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:o.createElement(o.Fragment,null,...t)}function Oe(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function Se(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function je(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?{datum:e.datum,x:o.cx,y:e.y,distance:0,category:e.group}:null}function Me(e,t,n,o=30){const i=t-e.x,r=n-e.y,s=Math.sqrt(i*i+r*r);return s>Oe(e.r,o)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function _e(e,t,n){const o=t-e.cx,i=n-e.cy,r=Math.sqrt(o*o+i*i);if(e.innerRadius>r||r>e.outerRadius)return null;const s=Se(Math.atan2(i,o)),a=Se(e.startAngle),l=Se(e.endAngle);if(!(a>l?s>=a||l>=s:s>=a&&l>=s))return null;const c=(e.startAngle+e.endAngle)/2,d=(e.innerRadius+e.outerRadius)/2;return{datum:e.datum,x:e.cx+Math.cos(c)*d,y:e.cy+Math.sin(c)*d,distance:0,category:e.category}}function Ce(e,t,n){const o=e.columnWidth/2;if("vertical"===e.projection){if(!(e.x-o>t||t>e.x+o||Math.min(e.minPos,e.maxPos)>n||n>Math.max(e.minPos,e.maxPos)))return{datum:e.datum,x:e.x,y:e.medianPos,distance:0,category:e.category,stats:e.stats}}else{const i=e.y-o,r=e.y+o;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||i>n||n>r))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category,stats:e.stats}}return null}function Pe(e,t,n){if(!e.bounds)return null;const{x:o,y:i,width:r,height:s}=e.bounds;return o>t||t>o+r||i>n||n>i+s?null:{datum:e.datum,x:o+r/2,y:i+s/2,distance:0,category:e.category,stats:e.stats}}function Le(e,t,n){const o=e.byGroup.get(t);let i=0,r=Math.abs(o[0].x-n.x);for(let e=1;o.length>e;e++){const t=Math.abs(o[e].x-n.x);r>t&&(r=t,i=e)}return o[i]._flatIndex}function Te(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}function $e({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"})}ke.QUADTREE_THRESHOLD=500;const Ie={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 Be(e,t,n,o,i){let r;return r="function"==typeof n?n(e):(0,Ie[n])(o(e,t),i),r}function He({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 Re(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const De=(n,o,i,r,s,a,l,c,d,u,h)=>{const{type:g="fill",styleFn:f,items:p}=n,y=[];let m=0;const v=!(!o&&!i),b="isolate"===u||void 0===u&&null!=s,{swatchSize:x,labelGap:w,rowHeight:k}=h;return p.forEach((n,u)=>{const h=Be(n,u,g,f,x),A=Re(n,r,s),O=s&&s.size>0&&s.has(n.label);y.push(t("g",{transform:`translate(0,${m})`,onClick:o?()=>o(n):void 0,onMouseEnter:i?()=>i(n):void 0,onMouseLeave:i?()=>i(null):void 0,tabIndex:v?c===a&&u===l?0:-1:void 0,role:v?"option":void 0,"aria-selected":v&&b?O||!1:void 0,"aria-current":v&&!b&&null!=r&&n.label===r||void 0,"aria-label":n.label,onKeyDown:v?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(n)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const n=(u+("ArrowDown"===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:v?e=>{d(c,u),i&&i(n);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:v?e=>{i&&i(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:v?"pointer":"default",opacity:A,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[v&&e("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:x+w+2+7*n.label.length,height:x+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),h,O&&e(He,{swatchSize:x}),e("text",{y:x/2,x:x+w,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:n.label})]},"legend-item-"+u)),m+=k}),y};function Fe({config:n,orientation:i="vertical",width:r=100}){const{colorFn:s,domain:a,label:l,format:c}=n,d=c||(e=>Math.round(100*e)/100+""),u="grad-legend-"+o.useId();if("horizontal"===i){const n=12,o=Math.min(r,200),i=Math.max(0,(r-o)/2),c=[];for(let t=0;64>=t;t++){const n=t/64;c.push(e("stop",{offset:100*n+"%",stopColor:s(a[0]+n*(a[1]-a[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:i+o/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:l}),e("rect",{x:i,y:0,width:o,height:n,fill:`url(#${u})`,rx:2}),e("text",{x:i,y:n+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:d(a[0])}),e("text",{x:i+o,y:n+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:d(a[1])})]})}const h=[];for(let t=0;64>=t;t++){const n=t/64;h.push(e("stop",{offset:100*n+"%",stopColor:s(a[1]-n*(a[1]-a[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(a[1])}),e("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:d(a[0])})]})}function Ne(n){const{legendGroups:i,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,legendInteraction:c,title:d="Legend",width:u=100,height:h=20,orientation:g="vertical",legendLayout:f}=n,p=function(e){var t,n,o,i,r;const s=Math.max(1,null!==(t=null==e?void 0:e.swatchSize)&&void 0!==t?t:16),a=Math.max(s,null!==(n=null==e?void 0:e.rowHeight)&&void 0!==n?n:22);return{swatchSize:s,labelGap:Math.max(0,null!==(o=null==e?void 0:e.labelGap)&&void 0!==o?o:6),itemGap:Math.max(0,null!==(i=null==e?void 0:e.itemGap)&&void 0!==i?i:10),rowHeight:a,align:"left"===(null==e?void 0:e.align)?"start":"right"===(null==e?void 0:e.align)?"end":null!==(r=null==e?void 0:e.align)&&void 0!==r?r:"start",maxWidth:null==e?void 0:e.maxWidth}}(f),[y,m]=o.useState(0),[v,b]=o.useState(0),x=o.useCallback((e,t)=>{m(e),b(t)},[]),w="vertical"===g?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:d,metrics:u})=>{let h=24;const g=[];return t.forEach((t,f)=>{h+=5,g.push(e("line",{stroke:"gray",x1:0,y1:h,x2:n,y2:h},"legend-top-line legend-symbol-"+f)),h+=8,t.label&&(h+=16,g.push(e("text",{y:h,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label},"legend-text-"+f)),h+=8),g.push(e("g",{className:"legend-item",transform:`translate(0,${h})`,children:De(t,o,i,r,s,a,l,f,c,d,u)},"legend-group-"+f)),h+=t.items.length*u.rowHeight+8}),g})({legendGroups:i||[],width:u,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,focusedGroupIndex:y,focusedItemIndex:v,onFocusedIndexChange:x,legendInteraction:c,metrics:p}):(({legendGroups:n,height:o,width:i,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,focusedGroupIndex:c,focusedItemIndex:d,onFocusedIndexChange:u,legendInteraction:h,metrics:g})=>{var f;let p=0;const y=[];n.forEach((n,o)=>{var f;let m=0;n.label&&(m+=16);const v=((n,o,i,r,s,a,l,c,d,u,h,g)=>{const{type:f="fill",styleFn:p,items:y}=n,m=[],{swatchSize:v,labelGap:b,itemGap:x,rowHeight:w,align:k}=h,A=!(!o&&!i),O="isolate"===u||void 0===u&&null!=s,S=y.map(e=>v+b+7*e.label.length),j=[];let M=0,_=0;S.forEach((e,t)=>{const n=0===_?e:_+x+e;g&&g>0&&_>0&&n>g?(j.push({start:M,end:t,width:_}),M=t,_=e):_=n}),y.length>0&&j.push({start:M,end:y.length,width:_}),j.forEach((n,u)=>{let h="center"===k?Math.max(0,((null!=g?g:n.width)-n.width)/2):"end"===k?Math.max(0,(null!=g?g:n.width)-n.width):0;for(let g=n.start;n.end>g;g++){const n=y[g],k=Be(n,g,f,p,v),j=Re(n,r,s),M=s&&s.size>0&&s.has(n.label);m.push(t("g",{transform:`translate(${h},${u*w})`,onClick:o?()=>o(n):void 0,onMouseEnter:i?()=>i(n):void 0,onMouseLeave:i?()=>i(null):void 0,tabIndex:A?c===a&&g===l?0:-1:void 0,role:A?"option":void 0,"aria-selected":A&&O?M||!1:void 0,"aria-current":A&&!O&&null!=r&&n.label===r||void 0,"aria-label":n.label,onKeyDown:A?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(n)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const n=(g+("ArrowRight"===e.key?1:-1)+y.length)%y.length;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:A?e=>{d(c,g),i&&i(n);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:A?e=>{i&&i(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:A?"pointer":"default",opacity:j,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[A&&e("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:v+b+2+7*n.label.length,height:v+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),k,M&&e(He,{swatchSize:v}),e("text",{y:v/2,x:v+b,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:n.label})]},"legend-item-"+g)),h+=S[g]+x}});const C=Math.max(0,...j.map(e=>e.width)),P=j.length;return{items:m,offset:C,totalRows:P,totalHeight:P*w}})(n,r,s,a,l,c,d,o,u,h,g,null!==(f=g.maxWidth)&&void 0!==f?f:i);m+=v.offset+5,y.push(Object.assign(Object.assign({label:n.label},v),{offset:m,totalRows:v.totalRows,totalHeight:v.totalHeight})),p+=m+12});const m=null!==(f=g.maxWidth)&&void 0!==f?f:i;let v=p>m?0:"center"===g.align?Math.max(0,(m-p)/2):"end"===g.align?Math.max(0,m-p):0;const b=[];return y.forEach((t,i)=>{const r=n[i];r.label&&(b.push(e("text",{transform:`translate(${v},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:r.label},"legend-text-"+i)),v+=16),b.push(e("g",{className:"legend-item",transform:`translate(${v},0)`,children:t.items},"legend-group-"+i)),v+=t.offset+5,n[i+1]&&b.push(e("line",{stroke:"gray",x1:v,y1:-8,x2:v,y2:(t.totalHeight||o)+0+8},"legend-top-line legend-symbol-"+i)),v+=12}),e("g",{children:b})})({legendGroups:i||[],title:d,height:h,width:u,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,focusedGroupIndex:y,focusedItemIndex:v,onFocusedIndexChange:x,legendInteraction:c,metrics:p}),k=!(!r&&!s);return t("g",{role:k?"listbox":void 0,"aria-multiselectable":!(!k||"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"===g&&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}),w]})}function Ee(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function We(t){var n;const{legend:o,totalWidth:i,totalHeight:r,margin:s,legendPosition:a="right",legendLayout:l,title:c,legendHoverBehavior:d,legendClickBehavior:u,legendHighlightedCategory:h,legendIsolatedCategories:g,legendInteraction:f}=t;if(!o)return null;const p="top"===a||"bottom"===a,y=!!c,m=Math.max(1,p?null!==(n=null==l?void 0:l.maxWidth)&&void 0!==n?n:Math.max(0,i-s.left-s.right):100);let v,b;return"left"===a?(v=Math.max(4,s.left-m-10),b=s.top):"top"===a?(v=s.left,b=y?32:8):"bottom"===a?(v=s.left,b=r-s.bottom+38):(v=i-s.right+10,b=s.top),e("g",{transform:`translate(${v}, ${b})`,children:(x=o,"object"==typeof x&&null!==x&&"gradient"in x?e(Fe,{config:o.gradient,orientation:p?"horizontal":"vertical",width:m}):Ee(o)?e(Ne,{legendGroups:o.legendGroups,title:"",width:m,orientation:p?"horizontal":"vertical",legendLayout:l,customHoverBehavior:d,customClickBehavior:u,highlightedCategory:h,isolatedCategories:g,legendInteraction:f}):o)});var x}function ze(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),i=e.split(/\s+/),r=[];let s="";for(const e of i)s&&s.length+1+e.length>o?(r.push(s),s=e):s=s?`${s} ${e}`:e;return s&&r.push(s),r}function Ge(e,t,n,o){return"curly"===e?o?`M0,0 C${.6*n},0 ${.4*n},${t/2} ${n},${t/2} C${.4*n},${t/2} ${.6*n},${t} 0,${t}`:`M0,0 C0,${.6*n} ${t/2},${.4*n} ${t/2},${n} C${t/2},${.4*n} ${t},${.6*n} ${t},0`:o?`M0,0 L${n},0 L${n},${t} L0,${t}`:`M0,0 L0,${n} L${t},${n} L${t},0`}function qe(n,o,i,r){if(!n)return e("g",{className:"annotation-note"});const{label:s,title:a,orientation:l,align:c,wrap:d=120,noWrap:u}=n;if(!s&&!a)return e("g",{className:"annotation-note"});let h=l;h||(h=Math.abs(o)>Math.abs(i)?"leftRight":"topBottom");let g=c;g&&"dynamic"!==g||(g="topBottom"===h?0>o?"right":"left":0>i?"bottom":"top");let f="start";"topBottom"===h?"right"===g?f="end":"middle"===g&&(f="middle"):f=0>o?"end":"start";const p=16,y=a?u?[a]:ze(a,d):[],m=s?u?[s]:ze(s,d):[],v="leftRight"===h?"end"===f?-4:4:0;let b=0;const x=[],w=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";y.length>0&&(x.push(e("text",{className:"annotation-note-title",fill:w,textAnchor:f,fontWeight:"bold",children:y.map((t,n)=>e("tspan",{x:v,dy:0===n?0:p,children:t},n))},"annotation-note-title")),b=y.length*p),m.length>0&&x.push(e("text",{className:"annotation-note-label",fill:w,textAnchor:f,y:b,children:m.map((t,n)=>e("tspan",{x:v,dy:0===n?0:p,children:t},n))},"annotation-note-label"));let k=null;if((a||s)&&(0!==o||0!==i))if("topBottom"===h){const t=Math.min(d,120);let n=0,o=t;"end"===f?(n=-t,o=0):"middle"===f&&(n=-t/2,o=t/2),k=e("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(y.length+m.length)*p+(m.length>0?p:0);let n=0,o=t;"bottom"===g?(n=-t,o=0):"middle"===g&&(n=-t/2,o=t/2),k=e("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const A=Math.max(0,y.length+m.length-1)*p;let O=0;return"topBottom"===h?O=0>i?-(A+2):18:"leftRight"===h&&(O="middle"===g?-(A+p+(m.length>0&&y.length>0?2:0))/2+8:"bottom"===g||0>i?-(A+2):18),t("g",{className:"annotation-note",transform:`translate(${o},${i})`,children:[e("g",{className:"annotation-note-content",transform:0!==O?`translate(0,${O})`:void 0,children:x}),k]})}function Ve(t,n,o,i,r){var s;const a=[];switch(t){case"callout-circle":{const t=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);t>0&&a.push(e("circle",{r:t,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const t=(null==n?void 0:n.width)||0,i=(null==n?void 0:n.height)||0;(t>0||i>0)&&a.push(e("rect",{width:t,height:i,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":(null==n?void 0:n.custom)&&a.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const t=i||0,s=r||0;if(void 0!==(null==n?void 0:n.x)){const i=(n.x||0)-t;a.push(e("line",{x1:i,y1:(n.y1||0)-s,x2:i,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==(null==n?void 0:n.y)){const i=(n.y||0)-s;a.push(e("line",{x1:(n.x1||0)-t,y1:i,x2:(n.x2||0)-t,y2:i,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==(null==n?void 0:n.x1)||void 0!==(null==n?void 0:n.x2)?a.push(e("line",{x1:(n.x1||0)-t,y1:0,x2:(n.x2||0)-t,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===(null==n?void 0:n.y1)&&void 0===(null==n?void 0:n.y2)||a.push(e("line",{x1:0,y1:(n.y1||0)-s,x2:0,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const t=null!==(s=null==n?void 0:n.width)&&void 0!==s?s:null==n?void 0:n.height;void 0!==t&&a.push(e("path",{d:Ge((null==n?void 0:n.type)||"curly",t,(null==n?void 0:n.depth)||30,void 0===(null==n?void 0:n.width)),fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return e("g",{className:"annotation-subject",children:a})}function Xe(t,n,o,i,r,s){var a;const l=[];let c=0,d=0;if("callout-circle"!==r&&"label"!==r||!(null==s?void 0:s.radius)){if("callout-rect"===r&&s){const e=s.width||0,o=s.height||0;if(e>0||o>0){const i=e/2,r=o/2,s=t-i,a=n-r;if(0!==s||0!==a){const t=Math.abs(s),n=Math.abs(a),l=e/2,u=o/2,h=t*u>n*l?l/t:u/n;c=i+s*h,d=r+a*h}}}else if("bracket"===r&&s){const e=s.width,t=s.height,n=s.depth||30;void 0!==e?(c=e/2,d=n):void 0!==t&&(c=n,d=t/2)}}else{const e=(s.radius||0)+(s.radiusPadding||0);if(e>0&&(0!==t||0!==n)){const o=Math.atan2(n,t);c=Math.cos(o)*e,d=Math.sin(o)*e}}const u=Math.sqrt(Math.pow(t-c,2)+Math.pow(n-d,2));if(u>.5){const r=i||"var(--semiotic-text-secondary, currentColor)",s="curve"===(null==o?void 0:o.type);let h=Math.atan2(n-d,t-c);if(s){const i=(null!==(a=null==o?void 0:o.curve)&&void 0!==a?a:.25)*u,s=(c+t)/2+-(n-d)/u*i,g=(d+n)/2+(t-c)/u*i;l.push(e("path",{className:"connector-curve",d:`M${c},${d}Q${s},${g} ${t},${n}`,fill:"none",stroke:r},"connector-line")),h=Math.atan2(g-d,s-c)}else l.push(e("line",{x1:c,y1:d,x2:t,y2:n,stroke:r},"connector-line"));if("arrow"===(null==o?void 0:o.end)){const t=10,n=16/180*Math.PI;l.push(e("path",{d:`M${c},${d}L${c+t*Math.cos(h+n)},${d+t*Math.sin(h+n)}L${c+t*Math.cos(h-n)},${d+t*Math.sin(h-n)}Z`,fill:r,stroke:"none"},"connector-arrow"))}}return e("g",{className:"annotation-connector",children:l})}function Ye(e){var n,o;const{x:i=0,y:r=0,dx:s,dy:a,nx:l,ny:c,note:d,connector:u,subject:h,type:g,color:f,className:p,disable:y,opacity:m,strokeDasharray:v,events:b={},"data-testid":x}=e,w=Array.isArray(i)?null!==(n=i[0])&&void 0!==n?n:0:i,k=Array.isArray(r)?null!==(o=r[0])&&void 0!==o?o:0:r,A=new Set(Array.isArray(y)?y:[]);let O=s||0,S=a||0;null!=l&&(O=l-w),null!=c&&(S=c-k);const j="string"==typeof g?g:"label";if("bracket"===j&&h&&0===O&&0===S)if(void 0!==h.width){O=h.width/2;const e=h.depth||30;S=e+(0>e?-5:5)}else if(void 0!==h.height){const e=h.depth||30;O=e+(0>e?-5:5),S=h.height/2}return t("g",Object.assign({className:("annotation "+(p||"")).trim(),transform:`translate(${w},${k})`,"data-testid":x},null!=m&&{opacity:m},v&&{strokeDasharray:v},b,{children:[!A.has("connector")&&Xe(O,S,u,f,j,h),!A.has("subject")&&Ve(j,h,f,w,k),!A.has("note")&&qe(d,O,S,f)]}))}function Qe(t){var n,o;const{noteData:i}=t,{screenCoordinates:r}=i,s="string"==typeof i.type?i.type:"label",a=i.eventListeners||i.events||{};if(i.coordinates&&r){const t=i.nx||r[0][0]+(null!==(n=i.dx)&&void 0!==n?n:0),a=i.ny||r[0][1]+(null!==(o=i.dy)&&void 0!==o?o:0),l=r.map((n,o)=>{const r=Object.assign({},i,{note:0===o?i.note:{label:""},x:n[0],y:n[1],nx:t,ny:a});return e(Ye,Object.assign({"data-testid":"semiotic-annotation"},r,{type:s}),"multi-annotation-"+o)});return e("g",{children:l})}const l=i.note||{title:"none",label:i.label},c=`${l.label}-${l.title}-${i.i}`;return e(Ye,Object.assign({"data-testid":"semiotic-annotation",events:a},i,{type:s}),c)}function Ze(e,t){var n,o,i;const r=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.x)&&void 0!==o?o:null===(i=t.scales)||void 0===i?void 0:i.time;return r?null!=e.x?r(e.x):t.xAccessor&&null!=e[t.xAccessor]?r(e[t.xAccessor]):null:null}function Ke(e,t){var n,o,i;const r=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.y)&&void 0!==o?o:null===(i=t.scales)||void 0===i?void 0:i.value;return r?null!=e.y?r(e.y):t.yAccessor&&null!=e[t.yAccessor]?r(e[t.yAccessor]):null:null}function Ue(e){return null==e?null:e+""}function Je(e,t,n){var o;return null===(o=t.stickyPositionCache)||void 0===o||o.set(e,n),n}function et(e,t,n){var o,i;const r=e.anchor||(null===(o=e.lifecycle)||void 0===o?void 0:o.anchor)||"fixed";if("latest"===r){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let o=n.pointNodes.length-1;o>=0;o--){const i=n.pointNodes[o];if(i.pointId===e.pointId)return Je(t,n,{x:i.x,y:i.y})}const o=function(e){var t,n,o,i,r,s;const a=e.data;if(!a||0===a.length)return null;const l=a[a.length-1],c=null!==(n=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==n?n:null===(o=e.scales)||void 0===o?void 0:o.time,d=null!==(r=null===(i=e.scales)||void 0===i?void 0:i.y)&&void 0!==r?r:null===(s=e.scales)||void 0===s?void 0:s.value;if(!c||!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?Je(t,n,o):null}if("semantic"===r){const o=function(e,t,n){var o,i;const r=function(e){var t,n;return Ue(null!==(n=null===(t=e.provenance)||void 0===t?void 0:t.stableId)&&void 0!==n?n:e.stableId)}(e);if(!r)return null;const s=null===(o=n.pointNodes)||void 0===o?void 0:o.find(e=>Ue(e.pointId)===r);if(s)return Je(t,n,{x:s.x,y:s.y});const a=null===(i=n.data)||void 0===i?void 0:i.find(e=>function(e){var t,n,o;return Ue(null!==(n=null!==(t=e.stableId)&&void 0!==t?t:e.id)&&void 0!==n?n:null===(o=e.provenance)||void 0===o?void 0:o.stableId)}(e)===r);if(!a)return null;const l=Ze(a,n),c=Ke(a,n);return null==l||null==c?null:Je(t,n,{x:l,y:c})}(e,t,n);if(o)return o}let s=null,a=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(s=t.x,a=t.y)}if(null!=s&&null!=a||(s=Ze(e,n),a=Ke(e,n)),null!=s&&null!=a)return Je(t,n,{x:s,y:a});if("sticky"===r){const e=null===(i=n.stickyPositionCache)||void 0===i?void 0:i.get(t);if(e)return e}return null}function tt(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const nt={secondary:0,primary:3};function ot(e){return!0===(null==e?void 0:e._annotationDeferred)}function it(e){return"blended"===(null==e?void 0:e.cohesion)||"layer"===(null==e?void 0:e.cohesion)?e.cohesion:null}function rt(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 st(e){return Math.max(.72,.95-.06*e)}const at={linear:L,monotoneX:P,monotoneY:C,step:_,stepAfter:M,stepBefore:j,basis:S,cardinal:O,catmullRom:A};const lt=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function ct(e){return!!e&&"object"==typeof e&<.has(function(e){return"string"==typeof(null==e?void 0:e.type)?e.type:""}(e))}function dt(e){return"primary"===(null==e?void 0:e.emphasis)||!0===(null==e?void 0:e.defensive)}function ut(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 ht(e){var t,n;let o;const i=null==e?void 0:e.emphasis;o="primary"===i?100:"secondary"===i?10:50;const r=null===(t=null==e?void 0:e.provenance)||void 0===t?void 0:t.confidence;switch("number"==typeof r&&Number.isFinite(r)&&(o+=15*Math.max(0,Math.min(1,r))),null===(n=null==e?void 0:e.lifecycle)||void 0===n?void 0:n.freshness){case"fresh":o+=8;break;case"aging":o+=4;break;case"stale":o+=1;break;case"expired":o-=200}return o}new Set(["label","callout","callout-circle","callout-rect"]);const gt=32,ft=6,pt=4,yt=8,mt=72;const vt={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function bt(e){return ct(e)}function xt(e,t){if(!e)return[];const n=Math.max(1,Math.floor(t/7)),o=e.split(/\s+/).filter(Boolean),i=[];let r="";for(const e of o)r&&r.length+e.length+1>n?(i.push(r),r=e):r=r?`${r} ${e}`:e;return r&&i.push(r),i}function wt(e,t,n,o,i){const r=e+n,s=t+o;return Math.abs(n)>Math.abs(o)?{x:0>n?r-i.width-4:r+4,y:0>o?s-i.height:s,width:i.width,height:i.height}:{x:0>n?r-i.width:r,y:0>o?s-i.height-4:s+4,width:i.width,height:i.height}}function kt(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function At(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 Ot(e,t,n,o,i,r,s,a){const l=kt(e,s);let c=.4*Math.hypot(t.dx,t.dy)+80*function(e,t,n,o){const i=Math.max(0,o-e.x),r=Math.max(0,o-e.y);return(i+Math.max(0,e.x+e.width-(t-o)))*e.height+(r+Math.max(0,e.y+e.height-(n-o)))*e.width}(l,i,r,a);for(const e of n)c+=12*At(l,e);for(const e of o)c+=4*At(l,e);return c}function St(e){var t;const{annotations:n,context:o,defaultOffset:i=gt,notePadding:r=ft,markPadding:s=pt,edgePadding:a=yt,preserveManualOffsets:l=!0,routeLongConnectors:c=!0,connectorThreshold:d=mt,density:u,progressiveDisclosure:h=!1,redundantCues:g=!1,responsive:f,cohesion:p,audience:y}=e,m=o.width||0,v=o.height||0;if(0===n.length||0>=m||0>=v)return n.slice();const b=[],x=function(e,t){return(e.pointNodes||[]).map(e=>{const n=Math.max(1,e.r||1)+t;return{x:e.x-n,y:e.y-n,width:2*n,height:2*n}})}(o,s);let w=!1;const k=n.map((e,t)=>{if(!bt(e))return e;const n=function(e,t,n){var o,i;if("widget"===e.type&&"number"==typeof e.px&&"number"==typeof e.py)return{x:e.px,y:e.py};const r=null!==(o=e.pointId)&&void 0!==o?o:e.nodeId;if(null!=r&&n.pointNodes){const e=n.pointNodes.find(e=>e.pointId===r);if(e)return{x:e.x,y:e.y}}const s=e.coordinates,a=null===(i=n.scales)||void 0===i?void 0:i.geoProjection;if(Array.isArray(s)&&s.length>=2&&a){const e=s[0],t=s[1];if("number"==typeof e&&"number"==typeof t){const n=a([e,t]);if(n&&"number"==typeof n[0]&&"number"==typeof n[1])return{x:n[0],y:n[1]}}}return n.scales||"number"!=typeof e.x||"number"!=typeof e.y?et(e,t,n):{x:e.x,y:e.y}}(e,t,o);if(!n)return e;const s=function(e){if("widget"===e.type)return{width:"number"==typeof e.width?e.width:32,height:"number"==typeof e.height?e.height:32};const t="number"==typeof e.wrap?e.wrap:120,n=[...xt("string"==typeof e.title?e.title:void 0,t),...xt("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(kt(wt(n.x,n.y,"number"==typeof e.dx?e.dx:t.dx,"number"==typeof e.dy?e.dy:t.dy,s),r)),e}var u;let h=null,g=1/0;for(const e of function(e){const t=1.6*e;return[{dx:e,dy:-e},{dx:-e,dy:-e},{dx:e,dy:e},{dx:-e,dy:e},{dx:e,dy:0},{dx:-e,dy:0},{dx:0,dy:-e},{dx:0,dy:e},{dx:t,dy:-t},{dx:-t,dy:-t},{dx:t,dy:t},{dx:-t,dy:t}]}(i)){const t=Ot(wt(n.x,n.y,e.dx,e.dy,s),e,b,x,m,v,r,a);g>t&&(h=e,g=t)}if(!h)return e;const f=kt(wt(n.x,n.y,h.dx,h.dy,s),r);b.push(f);const p=Math.hypot(h.dx,h.dy),y=c&&p>=d&&"text"!==e.type&&"widget"!==e.type?Object.assign(Object.assign({},e.connector||{end:"arrow"}),{type:"curve"}):e.connector;return w=!0,Object.assign(Object.assign(Object.assign({},e),{dx:h.dx,dy:h.dy}),y?{connector:y}:{})}),A=w?k:n.slice();let O=A;if(g){let e=!1;const t=A.map(t=>{const n=function(e){return"text"!==e.type||"string"!=typeof e.color||8>Math.hypot("number"==typeof e.dx?e.dx:0,"number"==typeof e.dy?e.dy:0)?e:Object.assign(Object.assign({},e),{_redundantConnector:!0})}(t);return n!==t&&(e=!0),n});O=e?t:A}{let e=!1;const t=O.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=vt[n.source])&&void 0!==t?t:n.source:null,i="number"==typeof n.confidence&&Number.isFinite(n.confidence)?Math.round(100*Math.max(0,Math.min(1,n.confidence)))+"%":null;if(!o&&!i)return e;if(null!=e.label&&"string"!=typeof e.label)return e;const r=[o,i].filter(Boolean).join(" · "),s="string"==typeof e.label?e.label:"";return s.includes(`(${r})`)?e:Object.assign(Object.assign({},e),{label:s?`${s} (${r})`:`(${r})`})}(t);return n!==t&&(e=!0),n});O=e?t:O}const S=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}(y),o=1===n?e:Object.assign(Object.assign({},e),{maxAnnotations:Math.max(0,Math.round((null!==(t=e.maxAnnotations)&&void 0!==t?t:ut(m,v,e))*n))}),{deferred:i}=function(e){var t;const{annotations:n,width:o,height:i}=e,r=Math.max(0,null!==(t=e.minVisible)&&void 0!==t?t:1),s=ut(o,i,e),a=n.map((e,t)=>{return{annotation:e,index:t,note:(n=e,ct(n))};var n}),l=a.filter(e=>e.note);if(0===l.length||s>=l.length)return{visible:n.slice(),deferred:[],budget:s};const c=l.filter(e=>dt(e.annotation)),d=l.filter(e=>!dt(e.annotation)).sort((e,t)=>ht(t.annotation)-ht(e.annotation)||e.index-t.index),u=Math.min(d.length,Math.max(Math.max(0,s-c.length),Math.max(0,r-c.length))),h=new Set([...c.map(e=>e.index),...d.slice(0,u).map(e=>e.index)]),g=[],f=[];for(const{annotation:e,index:t,note:n}of a)!n||h.has(t)?g.push(e):f.push(e);return{visible:g,deferred:f,budget:s}}(Object.assign({annotations:O,width:m,height:v},o));for(const e of i)S.add(e)}if(f&&("object"==typeof f&&"number"==typeof f.minWidth?f.minWidth:480)>=m)for(const e of O)bt(e)&&"secondary"===e.emphasis&&S.add(e);if(S.size>0)for(const e of O)!0===(null==e?void 0:e.defensive)&&S.delete(e);let j;return j=0===S.size?O:h?O.map(e=>S.has(e)?Object.assign(Object.assign({},e),{_annotationDeferred:!0}):e):O.filter(e=>!S.has(e)),p?function(e,t){let n=!1;const o=e.map(e=>bt(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(n=!0,Object.assign(Object.assign({},e),{cohesion:t})):e);return n?o:e}(j,p):j}function jt(e,t,n){return"exact"===n?function(e,t){const n=e.domain(),o=n[0],i=n[n.length-1],r=o instanceof Date,s=o instanceof Date?o.getTime():o,a=i instanceof Date?i.getTime():i;if(s===a)return r?[new Date(s),new Date(a)]:[s,a];const l=(a-s)/(t-1),c=Array(t);for(let e=0;t>e;e++){const n=e===t-1?a:s+e*l;c[e]=r?new Date(n):n}return c}(e,t):e.ticks(t)}function Mt(o){const{width:i,height:s,totalWidth:a,totalHeight:l,margin:c,scales:d,showAxes:u,showGrid:h,rFormat:g}=o,{rTickValues:f,axisExtent:p}=o,y="radial"===(null==d?void 0:d.projection),m="horizontal"===(null==d?void 0:d.projection),v=r(()=>!d||y?[]:(f||jt(d.r,5,p)).map(e=>({value:e,pixel:d.r(e),label:(g||_t)(e)})),[d,g,y,f,p]),b=h&&d&&!y,x=u&&d&&!y;return b||x?e("svg",{width:a,height:l,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:t("g",{transform:`translate(${c.left},${c.top})`,children:[b&&e("g",{className:"ordinal-grid",children:v.map((t,n)=>e("line",{x1:m?t.pixel:0,y1:m?0:t.pixel,x2:m?t.pixel:i,y2:m?s:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+n))}),x&&e(n,{children:t(n,m?{children:[e("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e("line",{x1:0,y1:s,x2:i,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]}:{children:[e("line",{x1:0,y1:s,x2:i,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]})})]})}):null}function _t(e){return Math.round(100*e)/100+""}function Ct(i){var a,l;const{width:c,height:d,totalWidth:u,totalHeight:h,margin:g,scales:f,showAxes:p,showCategoryTicks:y,oLabel:m,rLabel:v,oFormat:b,rFormat:x,showGrid:A,title:O,legend:S,legendHoverBehavior:j,legendClickBehavior:M,legendHighlightedCategory:_,legendIsolatedCategories:C,legendPosition:P="right",legendLayout:T,foregroundGraphics:I,annotations:B,autoPlaceAnnotations:H,svgAnnotationRules:R,xAccessor:D,yAccessor:F,annotationData:N,underlayRendered:E,children:W}=i,z="radial"===(null==f?void 0:f.projection),G="horizontal"===(null==f?void 0:f.projection),q=!1!==y,V=r(()=>p&&q&&f&&!z?f.o.domain().map((e,t)=>{var n;return{value:e,pixel:(null!==(n=f.o(e))&&void 0!==n?n:0)+f.o.bandwidth()/2,label:b?b(e,t):e}}):[],[p,q,f,b,z]),X=i.rTickValues,Y=i.tickLabelEdgeAlign,Q=i.axisExtent,Z=r(()=>p&&f&&!z?(X||jt(f.r,5,Q)).map(e=>({value:e,pixel:f.r(e),label:(x||_t)(e)})):[],[p,f,x,z,X,Q]),K=s(new Map),U=s(null!==(a=null==B?void 0:B.length)&&void 0!==a?a:0),J=null!==(l=null==B?void 0:B.length)&&void 0!==l?l:0;U.current!==J&&(U.current=J,K.current=new Map);const ee=r(()=>{if(!B||0===B.length)return null;const n=function(n,i,r){var s,a,l,c,d,u,h,g,f,p,y,m,v,b,x,A,O,S,j,M,_,C,P,T,I,B,H,R,D,F,N,E,W,z,G,q,V,X,Y,Q,Z,K,U,J,ee,te,ne,oe,ie,re,se;switch(n.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const t=et(n,i,r);if(!t)return null;const{x:o,y:c}=t;if(!tt(o,c,r))return null;const d="callout"===n.type?"callout-circle":n.type,u="callout-circle"===d?{radius:null!==(s=n.radius)&&void 0!==s?s:12,radiusPadding:n.radiusPadding}:"callout-rect"===d?{width:n.width,height:n.height}:void 0;return e(Qe,{noteData:Object.assign(Object.assign({x:o,y:c,dx:null!==(a=n.dx)&&void 0!==a?a:30,dy:null!==(l=n.dy)&&void 0!==l?l:-30,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:d},u?{subject:u}:{}),{connector:n.connector||{end:"arrow"},color:n.color,disable:n.disable,opacity:n.opacity,strokeDasharray:n.strokeDasharray,className:n.className})},"ann-"+i)}case"x-threshold":{const o=Ze(null!=n.value?Object.assign(Object.assign({},n),{x:n.value}):n,r);if(null==o)return null;const s=n.color||"#f97316",a=n.labelPosition||"top";let l;return l="bottom"===a?(r.height||0)-4:"center"===a?(r.height||0)/2:12,t("g",{children:[e("line",{x1:o,y1:0,x2:o,y2:r.height||0,stroke:s,strokeWidth:n.strokeWidth||1.5,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&e("text",{x:o+4,y:l,fill:s,fontSize:12,fontWeight:"bold",children:n.label})]},"ann-"+i)}case"y-threshold":{const o=Ke(null!=n.value?Object.assign(Object.assign({},n),{y:n.value}):n,r);if(null==o)return null;const s=n.color||"#f97316",a=n.labelPosition||"right";let l,c;return"left"===a?(l=4,c="start"):"center"===a?(l=(r.width||0)/2,c="middle"):(l=(r.width||0)-4,c="end"),t("g",{children:[e("line",{x1:0,y1:o,x2:r.width||0,y2:o,stroke:s,strokeWidth:n.strokeWidth||1.5,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&e("text",{x:l,y:o-4,textAnchor:c,fill:s,fontSize:12,fontWeight:"bold",children:n.label})]},"ann-"+i)}case"enclose":{const o=(n.coordinates||[]).map(e=>({x:Ze(Object.assign(Object.assign({},e),{type:"point"}),r),y:Ke(Object.assign(Object.assign({},e),{type:"point"}),r),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>o.length)return null;const s=w(o),a=n.padding||10;return t("g",{children:[e("circle",{cx:s.x,cy:s.y,r:s.r+a,fill:n.fill||"none",fillOpacity:n.fillOpacity||.1,stroke:n.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),n.label&&e("text",{x:s.x,y:s.y-s.r-a-4,textAnchor:"middle",fill:n.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:n.label})]},"ann-"+i)}case"rect-enclose":{const o=(n.coordinates||[]).map(e=>({x:Ze(Object.assign(Object.assign({},e),{type:"point"}),r),y:Ke(Object.assign(Object.assign({},e),{type:"point"}),r)})).filter(e=>null!=e.x&&null!=e.y);if(2>o.length)return null;const s=n.padding||10,a=o.map(e=>e.x),l=o.map(e=>e.y),c=Math.min(...a)-s,d=Math.max(...a)+s,u=Math.min(...l)-s,h=Math.max(...l)+s;return t("g",{children:[e("rect",{x:c,y:u,width:d-c,height:h-u,fill:n.fill||"none",fillOpacity:n.fillOpacity||.1,stroke:n.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),n.label&&e("text",{x:(c+d)/2,y:u-4,textAnchor:"middle",fill:n.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:n.label})]},"ann-"+i)}case"highlight":{const t=r.data||[],o="function"==typeof n.filter?t.filter(n.filter):n.field&&null!=n.value?t.filter(e=>e[n.field]===n.value):[],s={stroke:n.color||"#f97316",strokeWidth:2,fill:"none"};return e("g",{children:o.map((t,o)=>{const i=Ze(t,r),a=Ke(t,r);if(null==i||null==a)return null;const l="function"==typeof n.r?n.r(t):n.r||6,c="function"==typeof n.style?n.style(t):n.style||s;return e("circle",Object.assign({cx:i,cy:a,r:l},c),"hl-"+o)})},"ann-"+i)}case"bracket":{const t=Ze(n,r),o=Ke(n,r);return e(Qe,{noteData:{x:null!=t?t:0,y:null!=o?o:0,dx:n.dx||0,dy:n.dy||0,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"bracket",subject:{type:n.bracketType||"curly",width:n.width,height:n.height,depth:n.depth||30},color:n.color}},"ann-"+i)}case"trend":{const o=r.data||[];if(2>o.length)return null;const s=r.xAccessor||"x",a=r.yAccessor||"y",l="ordinal"===r.frameType,y="horizontal"===r.projection,m=l?s:null,v=l?a:null;let b;const x=[],w=new Map;if(l&&m&&v){for(const e of o){const t=e[m];if(null==t)continue;const n=t+"";w.has(n)||(w.set(n,x.length),x.push(n))}b=o.map(e=>{const t=e[m],n=e[v];if(null==t||null==n)return null;const o=w.get(t+"");return null!=o?[o,+n]:null}).filter(e=>null!==e)}else b=o.map(e=>[e[s],e[a]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>b.length)return null;const k=null!==(d=null===(c=r.scales)||void 0===c?void 0:c.x)&&void 0!==d?d:null===(u=r.scales)||void 0===u?void 0:u.time,A=null!==(g=null===(h=r.scales)||void 0===h?void 0:h.y)&&void 0!==g?g:null===(f=r.scales)||void 0===f?void 0:f.value;if(!k||!A)return null;const O=e=>t=>{const n=Math.max(0,Math.floor(t)),o=Math.min(x.length-1,n+1),i=t-n,r=e(x[n]);return r+(e(x[o])-r)*i},S=k,j=A;let M;if(l)if(y){const e=O(j);M=(t,n)=>[S(n),e(t)]}else{const e=O(S);M=(t,n)=>[e(t),j(n)]}else M=(e,t)=>[S(e),j(t)];const _=n.method||"linear";let C;C="loess"===_?function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),i=o.map(e=>e[0]),r=o.map(e=>e[1]),s=Math.max(2,Math.ceil(t*n)),a=[];for(let e=0;n>e;e++){const t=i[e],o=i.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(s-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:o[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let d=0,u=0,h=0,g=0,f=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(d+=t,u+=t*i[e],h+=t*r[e],g+=t*i[e]*i[e],f+=t*i[e]*r[e])}if(0===d){a.push([t,r[e]]);continue}const p=d*g-u*u;if(1e-12>Math.abs(p))a.push([t,h/d]);else{const e=(d*f-u*h)/p;a.push([t,(h-e*u)/d+e*t])}}return a}(b,null!==(p=n.bandwidth)&&void 0!==p?p:.3):("polynomial"===_?$.polynomial(b,{order:n.order||2}):$.linear(b)).points;const P=C.map(([e,t])=>{const[n,o]=M(e,t);return`${n},${o}`}).join(" "),L=n.color||"#6366f1",T=C[C.length-1],[I,B]=M(T[0],T[1]);return t("g",{children:[e("polyline",{points:P,fill:"none",stroke:L,strokeWidth:n.strokeWidth||2,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&e("text",{x:I+4,y:B-4,fill:L,fontSize:11,children:n.label})]},"ann-"+i)}case"band":{const o=null!==(m=null===(y=r.scales)||void 0===y?void 0:y.y)&&void 0!==m?m:null===(v=r.scales)||void 0===v?void 0:v.value,s=null!==(b=null==o?void 0:o(n.y0))&&void 0!==b?b:0,a=null!==(x=null==o?void 0:o(n.y1))&&void 0!==x?x:r.height||0;return t("g",{children:[e("rect",{x:0,y:Math.min(s,a),width:r.width||0,height:Math.abs(a-s),fill:n.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:n.fillOpacity||.1}),n.label&&e("text",{x:(r.width||0)-4,y:Math.min(s,a)-4,textAnchor:"end",fill:n.color||"var(--semiotic-primary, #6366f1)",fontSize:11,children:n.label})]},"ann-"+i)}case"envelope":{const o=r.data||[];if(2>o.length)return null;const s=r.xAccessor||"x",a=null!==(O=null===(A=r.scales)||void 0===A?void 0:A.x)&&void 0!==O?O:null===(S=r.scales)||void 0===S?void 0:S.time,l=null!==(M=null===(j=r.scales)||void 0===j?void 0:j.y)&&void 0!==M?M:null===(_=r.scales)||void 0===_?void 0:_.value;if(!a||!l)return null;const c=n.upperAccessor||"upperBounds",d=n.lowerAccessor||"lowerBounds",u=n.filter,h=o.filter(e=>null!=e[c]&&null!=e[d]&&!(u&&!u(e))).sort((e,t)=>e[s]-t[s]);if(2>h.length)return null;const g=at[r.curve||"linear"]||L,f=k().x(e=>a(e[s])).y0(e=>l(e[d])).y1(e=>l(e[c])).curve(g)(h);if(!f)return null;const p=n.fill||"#6366f1";return t("g",{children:[e("path",{d:f,fill:p,fillOpacity:null!==(C=n.fillOpacity)&&void 0!==C?C:.15,stroke:"none"}),n.label&&h.length>0&&e("text",{x:a(h[h.length-1][s])+4,y:l(h[h.length-1][c])-4,fill:p,fontSize:11,children:n.label})]},"ann-"+i)}case"anomaly-band":{const o=r.data||[];if(2>o.length)return null;const s=r.yAccessor||"y",a=null!==(T=null===(P=r.scales)||void 0===P?void 0:P.x)&&void 0!==T?T:null===(I=r.scales)||void 0===I?void 0:I.time,l=null!==(H=null===(B=r.scales)||void 0===B?void 0:B.y)&&void 0!==H?H:null===(R=r.scales)||void 0===R?void 0:R.value;if(!a||!l)return null;const c=o.map(e=>e[s]).filter(e=>null!=e&&isFinite(e));if(2>c.length)return null;const d=c.reduce((e,t)=>e+t,0)/c.length,u=c.reduce((e,t)=>e+Math.pow(t-d,2),0)/c.length,h=Math.sqrt(u),g=null!==(D=n.threshold)&&void 0!==D?D:2,f=d-g*h,p=!1!==n.showBand,y=n.fill||"#6366f1",m=null!==(F=n.fillOpacity)&&void 0!==F?F:.1,v=n.anomalyColor||"#ef4444",b=null!==(N=n.anomalyRadius)&&void 0!==N?N:6,x=l(d+g*h),w=l(f),k=o.filter(e=>{const t=e[s];return null!=t&&Math.abs(t-d)>g*h});return t("g",{children:[p&&e("rect",{x:0,y:Math.min(x,w),width:r.width||0,height:Math.abs(w-x),fill:y,fillOpacity:m}),k.map((t,n)=>{const o=Ze(t,r),i=Ke(t,r);return null==o||null==i?null:e("circle",{cx:o,cy:i,r:b,fill:v,fillOpacity:.7,stroke:v,strokeWidth:1.5},"anomaly-"+n)}),n.label&&e("text",{x:(r.width||0)-4,y:Math.min(x,w)-4,textAnchor:"end",fill:y,fontSize:11,children:n.label})]},"ann-"+i)}case"forecast":{const o=r.data||[];if(3>o.length)return null;const s=r.xAccessor||"x",a=r.yAccessor||"y",l=null!==(W=null===(E=r.scales)||void 0===E?void 0:E.x)&&void 0!==W?W:null===(z=r.scales)||void 0===z?void 0:z.time,c=null!==(q=null===(G=r.scales)||void 0===G?void 0:G.y)&&void 0!==q?q:null===(V=r.scales)||void 0===V?void 0:V.value;if(!l||!c)return null;const d=o.map(e=>[e[s],e[a]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>d.length)return null;let u;if("polynomial"===(n.method||"linear")){const e=$.polynomial(d,{order:n.order||2}).equation;u=t=>e.reduce((e,n,o)=>e+n*Math.pow(t,o),0)}else{const e=d.length;let t=0,n=0,o=0,i=0;for(const[e,r]of d)t+=e,n+=r,o+=e*e,i+=e*r;const r=e*o-t*t;if(1e-12>Math.abs(r))return null;const s=(e*i-t*n)/r,a=(n-s*t)/e;u=e=>a+s*e}const h=d.length,g=d.map(([e,t])=>t-u(e)).reduce((e,t)=>e+t*t,0),f=Math.sqrt(g/Math.max(h-2,1)),p=d.reduce((e,t)=>e+t[0],0)/h,y=d.reduce((e,t)=>e+Math.pow(t[0]-p,2),0),m=null!==(X=n.confidence)&&void 0!==X?X:.95,v=.99>m?.95>m?.9>m?1:1.645:1.96:2.576,b=null!==(Y=n.steps)&&void 0!==Y?Y:5,x=d[h-1][0],w=(x-d[0][0])/Math.max(h-1,1),k=[];for(let e=1;b>=e;e++)k.push(x+e*w);const A=[];for(const e of k){const t=u(e),n=f*Math.sqrt(1+1/h+(y>0?Math.pow(e-p,2)/y:0))*v;A.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const O=`M${A.map(e=>`${l(e.x)},${c(e.yUpper)}`).join(" L")} L${A.slice().reverse().map(e=>`${l(e.x)},${c(e.yLower)}`).join(" L")} Z`,S=A.map(e=>`${l(e.x)},${c(e.yCenter)}`).join(" "),j=`${l(x)},${c(u(x))}`,M=n.strokeColor||"#6366f1";return t("g",{children:[e("path",{d:O,fill:n.fill||"#6366f1",fillOpacity:null!==(Q=n.fillOpacity)&&void 0!==Q?Q:.15,stroke:"none"}),e("polyline",{points:`${j} ${S}`,fill:"none",stroke:M,strokeWidth:null!==(Z=n.strokeWidth)&&void 0!==Z?Z:2,strokeDasharray:null!==(K=n.strokeDasharray)&&void 0!==K?K:"6,3"}),n.label&&A.length>0&&e("text",{x:l(A[A.length-1].x)+4,y:c(A[A.length-1].yCenter)-4,fill:M,fontSize:11,children:n.label})]},"ann-"+i)}case"widget":{let t=null,o=null;if(null!=n.px&&null!=n.py)t=n.px,o=n.py;else{const e=et(n,i,r);if(!e)return null;t=e.x,o=e.y}if(null==t||null==o)return null;if(!tt(t,o,r))return null;const s=null!==(U=n.dx)&&void 0!==U?U:0,a=null!==(J=n.dy)&&void 0!==J?J:0,l=null!==(ee=n.width)&&void 0!==ee?ee:32,c=null!==(te=n.height)&&void 0!==te?te:32,d=null!==(ne=n.content)&&void 0!==ne?ne:e("span",{style:{fontSize:18,cursor:"default"},title:n.label||"Info",children:"ℹ️"});return e("foreignObject",{x:t+s-l/2,y:o+a-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:e("div",{style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:d})},"ann-"+i)}case"text":{const s=et(n,i,r);if(!s)return null;const{x:a,y:l}=s,c=a+(n.dx||0),d=l+(n.dy||0),u=n.color||"var(--semiotic-text, #333)",h=e("text",{x:c,y:d,fill:u,fontSize:n.fontSize||11,opacity:n.opacity,strokeDasharray:n.strokeDasharray,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:n.label});return!0!==n._redundantConnector?o.cloneElement(h,{key:"ann-text-"+i}):t("g",{opacity:n.opacity,strokeDasharray:n.strokeDasharray,children:[e("line",{x1:a,y1:l,x2:c,y2:d,stroke:u,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),o.cloneElement(h,{opacity:void 0,strokeDasharray:void 0})]},"ann-text-"+i)}case"category-highlight":{const o=n.category;if(null==o)return null;const s=e=>"function"==typeof e&&"function"==typeof e.bandwidth,a=null===(oe=r.scales)||void 0===oe?void 0:oe.o,l=null===(ie=r.scales)||void 0===ie?void 0:ie.x,c=null===(re=r.scales)||void 0===re?void 0:re.y,d=s(a)?a:s(l)?l:s(c)?c:null;if(!d)return null;const u=d(o+"");if(null==u)return null;const h=d.bandwidth(),g=n.color||"var(--semiotic-primary, #4589ff)",f=null!==(se=n.opacity)&&void 0!==se?se:.15,p=n.label;return t("g",(r.projection?"vertical"===r.projection:d===l)?{children:[e("rect",{x:u,y:0,width:h,height:r.height||0,fill:g,fillOpacity:f}),p&&e("text",{x:u+h/2,y:12,textAnchor:"middle",fill:g,fontSize:12,fontWeight:"bold",children:p})]}:{children:[e("rect",{x:0,y:u,width:r.width||0,height:h,fill:g,fillOpacity:f}),p&&e("text",{x:12,y:u+h/2,dominantBaseline:"middle",fill:g,fontSize:12,fontWeight:"bold",children:p})]},"ann-"+i)}default:return null}},i="horizontal"===(null==f?void 0:f.projection),r=(null==f?void 0:f.o)?e=>{var t;return(null!==(t=f.o(e))&&void 0!==t?t:0)+f.o.bandwidth()/2}:null,s={scales:f?{x:i?f.r:r||f.r,y:i&&r||f.r,time:f.r,value:f.r,o:f.o}:null,timeAxis:"x",xAccessor:D,yAccessor:F,width:c,height:d,data:N,frameType:"ordinal",projection:i?"horizontal":"vertical",stickyPositionCache:K.current};return function(t,n,o,i){const r=[];return t.forEach((e,t)=>{let s;if(o){const r=o(e,t,i);s=null!=r?r:n(e,t,i)}else s=n(e,t,i);s&&r.push({node:s,annotation:e})}),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:rt(e.annotation),readingOrder:null,rank:1};var n}),o=n.some(e=>null!=e.emphasis||null!=e.confidence),i=t.some(e=>ot(e.annotation)),r=t.some(e=>null!=it(e.annotation)),s=t.some(e=>"layer"===it(e.annotation));if(!o&&!i&&!r)return t.map(e=>e.node);const a=n.filter(e=>null==e.emphasis&&null!=e.confidence).slice().sort((e,t)=>{var n,o;return(null!==(n=t.confidence)&&void 0!==n?n:0)-(null!==(o=e.confidence)&&void 0!==o?o:0)||e.i-t.i});a.forEach((e,t)=>{e.readingOrder=t,e.rank=2-t/Math.max(1,a.length)});for(const e of n)e.emphasis&&(e.rank=nt[e.emphasis]);const l=n.sort((e,t)=>e.rank-t.rank||e.i-t.i).map(t=>{const{p:n,i:o,emphasis:i,readingOrder:r}=t,s=ot(n.annotation);let a=n.node;if("primary"===i||"secondary"===i||null!=r){const t=null==i&&null!=r;a=e("g",Object.assign({className:t?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+i},"secondary"===i?{opacity:.6,fontSize:"0.88em"}:{},t?{opacity:st(r),"data-annotation-reading-order":r}:{},{children:n.node}),"annotation-emphasis-"+o)}const l=it(n.annotation);return l&&(a=e("g",{className:"annotation-cohesion--"+l,children:a},"annotation-cohesion-"+o)),s&&(a=e("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:a},"annotation-deferred-"+o)),a});return i&&l.unshift(e("style",{children:".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}}"},"annotation-disclosure-style")),s&&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}(r)}(H?St(Object.assign({annotations:B,context:s},"object"==typeof H?H:{})):B,n,R,s)},[B,H,R,c,d,f,D,F,N]);return p||O||S||I||ee&&ee.length>0||A||W?t("svg",{role:"img",width:u,height:h,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[e("title",{children:"string"==typeof O?O:"Ordinal Chart"}),e("desc",{children:"string"==typeof O?O+" — ordinal data visualization":"Ordinal data visualization"}),t("g",{transform:`translate(${g.left},${g.top})`,children:[A&&f&&!z&&!E&&e("g",{className:"ordinal-grid",children:Z.map((t,n)=>e("line",{x1:G?t.pixel:0,y1:G?0:t.pixel,x2:G?t.pixel:c,y2:G?d:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+n))}),p&&f&&!z&&(()=>{const o={fontSize:"var(--semiotic-tick-font-size, 12px)"},i={fontSize:"var(--semiotic-axis-label-font-size, 12px)"};return e("g",{className:"ordinal-axes",children:t(n,G?{children:[t("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[!E&&e("line",{x1:0,y1:0,x2:0,y2:d,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),V.map((n,i)=>t("g",{transform:`translate(0,${n.pixel})`,children:[e("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},o),children:n.label}):e("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:Object.assign({textAlign:"right",userSelect:"none"},o),children:n.label})})]},"cat-"+i)),m&&e("text",{x:15-g.left,y:d/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-g.left}, ${d/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},i),children:m})]}),t("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[!E&&e("line",{x1:0,y1:d,x2:c,y2:d,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),!E&&(null==f?void 0:f.r)&&(()=>{const t=f.r(0);return t>1&&c-1>t?e("line",{x1:t,y1:0,x2:t,y2:d,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1,strokeDasharray:"4,4"}):null})(),Z.map((n,i)=>{const r=Y?0===i?"start":i===Z.length-1?"end":"middle":"middle";return t("g",{transform:`translate(${n.pixel},${d})`,children:[e("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e("text",{y:18,textAnchor:r,fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},o),children:n.label})]},"val-"+i)}),v&&e("text",{x:c/2,y:d+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},i),children:v})]})]}:{children:[t("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[!E&&(()=>{const t=(null==f?void 0:f.r)?f.r(0):d,n=0>t||t>d?d:t;return e("line",{x1:0,y1:n,x2:c,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),V.map((n,i)=>t("g",{transform:`translate(${n.pixel},${d})`,children:[e("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{y:18,textAnchor:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},o),children:n.label}):e("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:Object.assign({textAlign:"center",userSelect:"none"},o),children:n.label})})]},"cat-"+i)),m&&e("text",{x:c/2,y:d+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},i),children:m})]}),t("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[!E&&e("line",{x1:0,y1:0,x2:0,y2:d,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),Z.map((n,i)=>t("g",{transform:`translate(0,${n.pixel})`,children:[e("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},o),children:n.label})]},"val-"+i)),v&&e("text",{x:15-g.left,y:d/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-g.left}, ${d/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},i),children:v})]})]})})})(),ee,I,W]}),O&&e("text",{x:u/2,y:20,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:"string"==typeof O?O:null}),We({legend:S,totalWidth:u,totalHeight:h,margin:g,legendPosition:P,title:O,legendLayout:T,legendHoverBehavior:j,legendClickBehavior:M,legendHighlightedCategory:_,legendIsolatedCategories:C})]}):null}function Pt(e,t,n,o){return"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:n,fn:e}:{key:void 0,fn:null}}function Lt({width:t,height:n,totalWidth:o,totalHeight:r,margin:a,scales:l,onBrush:c}){const d=s(null),u=s(null),h=s(c);h.current=c;const g=s(l);g.current=l;const f=s(!1),p=s(null),y="horizontal"===(null==l?void 0:l.projection),m=s(y);return m.current=y,i(()=>{if(!d.current)return;const e=I(d.current).select(".brush-g"),o=y?B():H();return o.extent([[0,0],[t,n]]),o.on("brush end",e=>{if(f.current)return;const t=g.current;if(!t)return;if(!e.selection)return p.current=null,void h.current(null);const[n,o]=e.selection;let i;i=m.current?[t.r.invert(n),t.r.invert(o)]:[t.r.invert(o),t.r.invert(n)];const r={r:i};p.current=r,h.current(r)}),e.call(o),u.current=o,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{o.on("brush end",null),u.current=null}},[t,n,y]),i(()=>{if(!l||!u.current||!p.current)return;if(!d.current)return;const e=p.current,t=I(d.current).select(".brush-g"),n=l.r(e.r[0]),o=l.r(e.r[1]);y?(f.current=!0,t.call(u.current.move,[n,o]),f.current=!1):(f.current=!0,t.call(u.current.move,[o,n]),f.current=!1)},[l,y]),e("svg",{ref:d,width:o,height:r,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:e("g",{className:"brush-g",transform:`translate(${a.left},${a.top})`,style:{pointerEvents:"all"}})})}function Tt(e){var t,n,o,i;return(null!==(t=e.tl)&&void 0!==t?t:0)>0||(null!==(n=e.tr)&&void 0!==n?n:0)>0||(null!==(o=e.br)&&void 0!==o?o:0)>0||(null!==(i=e.bl)&&void 0!==i?i:0)>0}function $t(e){const t=e.cornerRadii;if(!t)return{tl:0,tr:0,br:0,bl:0};const n=Math.min(e.w,e.h)/2,o=e=>Math.max(0,Math.min(null!=e?e:0,n));return{tl:o(t.tl),tr:o(t.tr),br:o(t.br),bl:o(t.bl)}}const It=(e,t)=>({x:e*Math.cos(t),y:e*Math.sin(t)});function Bt(e){var t,n;const{innerRadius:o,outerRadius:i,startAngle:r,endAngle:s}=e,a=0>=o;if(0>=(null!==(t=e.cornerRadius)&&void 0!==t?t:0)||!e.roundStart&&!e.roundEnd){if(a){const e=It(i,r),t=It(i,s);return`M0,0 L${e.x},${e.y} A${i},${i} 0 ${s-r>Math.PI?1:0} 1 ${t.x},${t.y} Z`}const e=It(i,r),t=It(i,s),n=It(o,s),l=It(o,r),c=s-r>Math.PI?1:0;return`M${e.x},${e.y} A${i},${i} 0 ${c} 1 ${t.x},${t.y} L${n.x},${n.y} A${o},${o} 0 ${c} 0 ${l.x},${l.y} Z`}const l=Math.max(0,Math.min(null!==(n=e.cornerRadius)&&void 0!==n?n:0,(i-o)/2));if(0===l)return Bt(Object.assign(Object.assign({},e),{cornerRadius:0,roundStart:!1,roundEnd:!1}));const c=Math.asin(Math.min(1,l/Math.max(1e-9,i-l))),d=a?0:Math.asin(Math.min(1,l/Math.max(1e-9,o+l))),u=s-r,h=e.roundStart&&e.roundEnd?u/2:u,g=!!e.roundStart&&h>c,f=!!e.roundEnd&&h>c;if(!g&&!f)return Bt(Object.assign(Object.assign({},e),{cornerRadius:0,roundStart:!1,roundEnd:!1}));const p=r+(g?c:0),y=s-(f?c:0),m=r+(g?d:0),v=s-(f?d:0),b=It(i,p),x=It(i,y),w=(i-l)*Math.cos(c),k=It(w,r),A=It(w,s),O=a?null:It(o,v),S=a?null:It(o,m),j=a?0:(o+l)*Math.cos(d),M=a?null:It(j,r),_=a?null:It(j,s),C=y-p>Math.PI?1:0,P=a?0:v-m>Math.PI?1:0;let L="";if(g)L+=`M${k.x},${k.y}`,L+=` A${l},${l} 0 0 1 ${b.x},${b.y}`;else{const e=It(i,r);L+=`M${e.x},${e.y}`}if(f)L+=` A${i},${i} 0 ${C} 1 ${x.x},${x.y}`,L+=` A${l},${l} 0 0 1 ${A.x},${A.y}`;else{const e=It(i,s);L+=` A${i},${i} 0 ${C} 1 ${e.x},${e.y}`}if(a)L+=" L0,0";else{if(f)L+=` L${_.x},${_.y}`,L+=` A${l},${l} 0 0 1 ${O.x},${O.y}`;else{const e=It(o,s);L+=` L${e.x},${e.y}`}if(g)L+=` A${o},${o} 0 ${P} 0 ${S.x},${S.y}`,L+=` A${l},${l} 0 0 1 ${M.x},${M.y}`;else{const e=It(o,r);L+=` A${o},${o} 0 ${P} 0 ${e.x},${e.y}`}}return L+=" Z",L}function Ht(e){const t=Bt({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle,endAngle:e.endAngle,cornerRadius:e.cornerRadius,roundStart:e.roundStart,roundEnd:e.roundEnd}),n=[],o=e.colors;if(o.length>0){const t=(e.endAngle-e.startAngle)/o.length;for(let i=0;o.length>i;i++)n.push({d:Bt({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle+i*t,endAngle:e.endAngle}),color:o[i]})}return{clipPath:t,slices:n}}const Rt={innerRadius:0,outerRadius:0,startAngle:0,endAngle:0};function Dt(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}function Ft(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}const Nt="undefined"==typeof window||"undefined"==typeof document,Et="undefined"!=typeof window?c:i,Wt=()=>()=>{},zt=()=>!1,Gt=()=>!0;function qt(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 Vt(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 Xt(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 Yt=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,Qt=new WeakMap;let Zt=0,Kt=!1,Ut=null,Jt=null,en=null;function tn(e,t){var n,o;if(!t)return t;const i=Yt.exec(t);if(!i)return t;const r=e.canvas;if(!r)return(null===(n=i[2])||void 0===n?void 0:n.trim())||t;!function(){if(Kt)return;if("undefined"==typeof window||"undefined"==typeof document)return;Kt=!0;const e=()=>{Zt++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(Ut=new MutationObserver(e),Ut.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{Jt=window.matchMedia("(prefers-color-scheme: dark)"),en=e,"function"==typeof Jt.addEventListener?Jt.addEventListener("change",en):"function"==typeof Jt.addListener&&Jt.addListener(en)}catch(e){}}();let s=Qt.get(r);s&&s.version===Zt||(s={version:Zt,map:new Map},Qt.set(r,s));const a=s.map.get(t);if(void 0!==a)return a;const l=getComputedStyle(r).getPropertyValue(i[1]).trim()||(null===(o=i[2])||void 0===o?void 0:o.trim())||t;return s.map.set(t,l),l}const nn=o.createContext(null),on={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function rn(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e){if(null===(null==t?void 0:t.datum))continue;const e=t.type+"";n[e]=(n[e]||0)+1}if(0===Object.keys(n).length)return t+", empty";const o=[],i={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},r=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],s=Object.keys(n).sort((e,t)=>{const n=r.indexOf(e),o=r.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of s)o.push(`${n[e]} ${i[e]||e}`);return`${t}, ${o.join(", ")}`}const sn=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""};function an(e){const t={};if(null==e||"object"!=typeof e)return t;for(const[n,o]of Object.entries(e))n.startsWith("_")||null!=o&&""!==o&&("number"==typeof o?Number.isFinite(o)&&(t[n]=o):"string"==typeof o?t[n]=o:"boolean"==typeof o?t[n]=o+"":o instanceof Date&&(t[n]=o.toISOString().slice(0,10)));return t}const ln="semiotic-accessible-data-table",cn=ln+" semiotic-accessible-data-table-hidden",dn=ln+" semiotic-accessible-data-table-visible",un={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"},hn={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},gn={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)"},fn={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},pn={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))"},yn={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},mn={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},vn={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 bn({scene:n,chartType:i,tableId:r,chartTitle:s}){var a;const[l,c]=o.useState(!1),[d,u]=o.useState(5),h=o.useContext(nn),g=null!==(a=null==h?void 0:h.visible)&&void 0!==a&&a,f=l||g,p=o.useRef(null),y=s?"Data summary for "+s:r?`Data summary for ${i} ${r}`:"Data summary for "+i;o.useEffect(()=>{f||u(5)},[f]);const m=o.useCallback(e=>{e.target===e.currentTarget&&(l||g||c(!0))},[l,g]),v=o.useCallback(e=>{var t;g||(null===(t=p.current)||void 0===t?void 0:t.contains(e.relatedTarget))||c(!1)},[g]);if(!n||0===n.length)return r?e("span",{id:r,tabIndex:-1,style:on}):null;if(!f)return e("div",{id:r,className:cn,tabIndex:-1,onFocus:m,style:on,role:"region","aria-label":y,children:t("button",{type:"button",onClick:()=>c(!0),children:["View data summary (",n.length," elements)"]})});const b=function(e){var t,n,o,i,r,s,a,l,c,d,u,h,g,f,p,y,m;const v=[];if(!Array.isArray(e))return v;const b=e.some(e=>e&&("line"===e.type||"area"===e.type));for(const x of e)if(x&&"object"==typeof x&&null!==x.datum)try{switch(x.type){case"point":if(b)break;v.push({label:"Point",values:an(x.datum)});break;case"line":case"area":{const e=Array.isArray(x.datum)?x.datum:[],t="line"===x.type?"Line point":"Area point";for(const n of e)v.push({label:t,values:an(n)});break}case"rect":{const e=null!=x.datum&&"object"==typeof x.datum?x.datum:{},r=null!==(n=null!==(t=e.category)&&void 0!==t?t:x.group)&&void 0!==n?n:"",s=null!==(i=null!==(o=e.value)&&void 0!==o?o:e.__aggregateValue)&&void 0!==i?i:e.total;v.push({label:"Bar",values:{category:r,value:null!=s?s:""}});break}case"heatcell":{const e=an(x.datum);null==e.value&&"number"==typeof x.value&&Number.isFinite(x.value)&&(e.value=x.value),v.push({label:"Cell",values:e});break}case"wedge":v.push({label:"Wedge",values:{category:null!==(l=null!==(s=null===(r=x.datum)||void 0===r?void 0:r.category)&&void 0!==s?s:null===(a=x.datum)||void 0===a?void 0:a.label)&&void 0!==l?l:"",value:null!==(d=null===(c=x.datum)||void 0===c?void 0:c.value)&&void 0!==d?d:""}});break;case"circle":v.push({label:"Node",values:an(x.datum)});break;case"arc":v.push({label:"Arc",values:an(x.datum)});break;case"candlestick":v.push({label:"Candlestick",values:an(x.datum)});break;case"geoarea":v.push({label:"Region",values:{name:null!==(p=null!==(g=null===(h=null===(u=x.datum)||void 0===u?void 0:u.properties)||void 0===h?void 0:h.name)&&void 0!==g?g:null===(f=x.datum)||void 0===f?void 0:f.name)&&void 0!==p?p:"",value:null!==(m=null===(y=x.datum)||void 0===y?void 0:y.value)&&void 0!==m?m:""}})}}catch(e){}return v}(n),x=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const o of t){const t=[],i=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[o];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&i.add(e+""))}if(t.length>0){let e=t[0],i=t[0],r=0;for(const n of t)e>n&&(e=n),n>i&&(i=n),r+=n;n.push({name:o,count:t.length,numeric:!0,min:e,max:i,mean:r/t.length})}else if(i.size>0){const e=Array.from(i);n.push({name:o,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(b),w=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${sn(e.min)} to ${sn(e.max)}, mean ${sn(e.mean)}.`);else{const t=e.uniqueValues,o=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${o}.`)}return n.join(" ")}(b.length,x),k=Math.min(d,b.length),A=b.slice(0,k),O=b.length-k,S=new Set;for(const e of A)for(const t of Object.keys(e.values))S.add(t);const j=Array.from(S);return t("div",{ref:p,id:r,className:dn,tabIndex:-1,onBlur:v,style:un,role:"region","aria-label":y,children:[e("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{g&&h&&h.setVisible(!1),c(!1)},"aria-label":"Close data summary",style:gn,children:"×"}),e("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:hn,children:w}),t("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+i,style:fn,children:[e("caption",{className:"semiotic-accessible-data-table-caption",style:mn,children:O>0?`First ${k} of ${b.length} data points`:`All ${b.length} data points`}),e("thead",{children:t("tr",{children:[e("th",{style:pn,children:"type"}),j.map(t=>e("th",{style:pn,children:t},t))]})}),e("tbody",{children:A.map((n,o)=>t("tr",{children:[e("td",{style:yn,children:n.label}),j.map(t=>{return e("td",{style:yn,children:(o=n.values[t],null==o||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":sn(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"")},t);var o})]},o))})]}),O>0&&t("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>u(e=>e+25),style:vn,children:["Show ",Math.min(25,O)," more"," ",1===O?"row":"rows"," (",O," remaining)"]})]})}function xn({summary:t}){return t?e("div",{role:"note",style:on,children:t}):null}function wn({tableId:t}){return e("a",{href:"#"+t,style:on,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,on)},children:"Skip to data table"})}function kn({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:on,children:n})}const An="var(--semiotic-focus, #005fcc)";function On({active:t,hoverPoint:n,margin:o,size:i,shape:r="circle",width:s,height:a}){if(!t||!n)return null;const l=n.x+o.left,c=n.y+o.top;let d;if("rect"===r&&null!=s&&null!=a){const t=Math.max(s,4),n=Math.max(a,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:An,strokeWidth:2,strokeDasharray:"4,2"})}else d=e("circle","wedge"===r?{cx:l,cy:c,r:12,fill:"none",stroke:An,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:An,strokeWidth:2,strokeDasharray:"4,2"});return e("svg",{style:{position:"absolute",left:0,top:0,width:i[0],height:i[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:d})}function Sn(e){return Array.isArray(e)?e[0]:e}const jn={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 Mn(e,t){return"function"==typeof t?t(e):e[t]}function _n(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 Cn(n={}){const{fields:o,title:i,format:r,style:s={},className:a=""}=n;return n=>{if(!n||"object"!=typeof n)return null;let l;const c=[];if(i){const e=Mn(n,i);l=_n(e,r)}if(o&&o.length>0)o.forEach(e=>{let t,o,i;"string"==typeof e?(t=e,o=e,i=r):(t=e.label,o=e.accessor||e.key||"",i=e.format||r);const s=Mn(n,o);c.push({label:t,value:_n(s,i)})});else if(!i){const e=["value","y","name","id","label"];for(const t of e)if(void 0!==n[t]){l=_n(n[t],r);break}if(!l){const e=Object.keys(n).filter(e=>!e.startsWith("_"));e.length>0&&(l=_n(n[e[0]],r))}}const d=Object.assign(Object.assign({},jn),s);return t("div",{className:("semiotic-tooltip "+a).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 Pn(t){if(!0!==t){if("function"==typeof t){const n=t;return t=>{var o;const i=Sn(!0===(null==t?void 0:t.__semioticHoverData)||t&&void 0!==t.data&&"number"==typeof t.x&&"number"==typeof t.y&&t&&("node"===t.type||"edge"===t.type||void 0!==t.nodeOrEdge||void 0!==t.allSeries||void 0!==t.stats||void 0!==t.__chartType)?null!==(o=t.data)&&void 0!==o?o:{}:t),r=n(i);return null==r?null:e("div",{className:"semiotic-tooltip",style:jn,children:r})}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?Cn(t):Cn())}}function Ln({x:t,y:n,containerWidth:i,containerHeight:r,margin:s,children:a,className:l="stream-frame-tooltip",zIndex:c=1}){const d=Number.isFinite(t)&&Number.isFinite(n),u=o.useRef(null),[h,g]=o.useState(null);o.useLayoutEffect(()=>{const e=u.current;if(!e)return;const t=e.getBoundingClientRect();g(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[a,l,i,r]);let f;f=h?`translate(${h.width+12>i-t?"calc(-100% - 12px)":"12px"}, ${h.height+12>r-n?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*i?"calc(-100% - 12px)":"12px"}, ${.3*r>n?"4px":"calc(-100% - 4px)"})`;const p=function(e){if(!o.isValidElement(e))return!1;const t=e.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;const n=e.props;if("string"==typeof n.className&&n.className.trim().length>0)return!0;const i=n.style;if(i&&"object"==typeof i){if(null!=i.background&&""!==i.background)return!0;if(null!=i.backgroundColor&&""!==i.backgroundColor)return!0}return!1}(a),y=p?null:jn;return d?e("div",{ref:u,className:p?l:(l+" semiotic-tooltip").trim(),style:Object.assign(Object.assign({},y||{}),{position:"absolute",left:s.left+t,top:s.top+n,transform:f,pointerEvents:"none",zIndex:c,width:"max-content"}),children:a}):null}function Tn(t){let n=null;const o=()=>(n||(n=h(null)),n),i=$n(t);return[function({children:n,initialState:i}){const a=s(i),l=r(()=>$n(t,a.current),[]),c=o();return e(c.Provider,{value:l,children:n})},e=>{var t;const n=o(),r=null!==(t=d(n))&&void 0!==t?t:i,a=s(e);a.current=e;const c=u(()=>a.current(r.getState()),[r]),h=u(()=>a.current(r.getState()),[r]);return l(r.subscribe,c,h)}]}function $n(e,t){const n=new EventTarget;let o=Object.assign(Object.assign({},e(function(e){o=Object.assign(Object.assign({},o),e(o)),n.dispatchEvent(new Event("update"))})),null!=t?t:{});return{getState:()=>o,subscribe:function(e){return n.addEventListener("update",e),()=>n.removeEventListener("update",e)}}}function In(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 Bn(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:Hn})})),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 Hn=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],Rn={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}},Dn={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}},Fn={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:Hn,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 Nn(e,t){if("light"===t)return Rn;if("dark"===t)return Dn;if("high-contrast"===t)return Fn;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?Dn:Rn;return Bn(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 Bn(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[En,Wn]=Tn(e=>({theme:Rn,setTheme(t){e(e=>({theme:Nn(e.theme,t)}))}}));const zn="undefined"==typeof window?i:c;function Gn(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function qn(e){const t=function(){const[e,t]=a(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return i(()=>{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=s(t);n.current=t;const[l,c]=function(e,t,n){const o=s(null),[r,l]=a(null);return i(()=>{if(!t&&!n)return;const e=o.current;if(!e)return;const i=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;l(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return i.observe(e),()=>i.disconnect()},[t,n]),[o,[t&&r?r.w:e[0],n&&r?r.h:e[1]]]}(e.sizeProp,e.responsiveWidth,e.responsiveHeight),d=r(()=>Object.assign(Object.assign({},e.marginDefault),e.userMargin),[e.marginDefault,e.userMargin]),h=c[0]-d.left-d.right,g=c[1]-d.top-d.bottom,f=Gn(e.foregroundGraphics,c,d),p=Gn(e.backgroundGraphics,c,d),y=Wn(e=>e.theme),{transition:m,introEnabled:v}=function(e,t){var n,o;if(!1===e)return{transition:void 0,introEnabled:!1};const i="undefined"!=typeof window&&(null===(n=window.matchMedia)||void 0===n?void 0:n.call(window,"(prefers-reduced-motion: reduce)").matches);return{transition:e?!0===e?{duration:300}:{duration:null!==(o=e.duration)&&void 0!==o?o:300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(i||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),b="semiotic-table-"+o.useId(),x=s(0),w=s(()=>{}),k=u(()=>{x.current||(x.current=requestAnimationFrame(()=>w.current()))},[]);i(()=>()=>{x.current&&(cancelAnimationFrame(x.current),x.current=0)},[]);const A=s(()=>{}),O=s(()=>{}),S=s(null),j=s(0),M=u(()=>{j.current=0;const e=S.current;S.current=null,e&&A.current(e)},[]),_=u(e=>{S.current={clientX:e.clientX,clientY:e.clientY},0===j.current&&(j.current=requestAnimationFrame(M))},[M]),C=u(()=>{S.current=null,0!==j.current&&(cancelAnimationFrame(j.current),j.current=0),O.current()},[]);i(()=>()=>{S.current=null,0!==j.current&&(cancelAnimationFrame(j.current),j.current=0)},[]);const P=e.themeDirtyRef;return zn(()=>{P&&(Zt++,P.current=!0,k())},[y,k,P]),{reducedMotion:t,reducedMotionRef:n,responsiveRef:l,size:c,margin:d,adjustedWidth:h,adjustedHeight:g,resolvedForeground:f,resolvedBackground:p,currentTheme:y,transition:m,introEnabled:v,tableId:b,rafRef:x,renderFnRef:w,scheduleRender:k,hoverHandlerRef:A,hoverLeaveRef:O,onPointerMove:_,onPointerLeave:C}}function Vn(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Xn(e,t,n=.3){Vn(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 Yn(e,t,n=.6){var o,i,r,s,a;if(!Vn(t))return;const l=null!==(o=t._pulseGlowRadius)&&void 0!==o?o:4,c=t.r+l*t._pulseIntensity,d=null!==(r=null!==(i=t.cx)&&void 0!==i?i:t.x)&&void 0!==r?r:0,u=null!==(a=null!==(s=t.cy)&&void 0!==s?s:t.y)&&void 0!==a?a: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()}function Qn(e,t,n,o=.35){Vn(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}function Zn(e,t){const n=e.fillStyle,o="#010203";try{e.fillStyle=o,e.fillStyle=t}catch(t){return e.fillStyle=n,[78,121,167]}const i=e.fillStyle;if(e.fillStyle=n,"string"!=typeof i)return[78,121,167];if(i.toLowerCase()===o&&t.trim().toLowerCase()!==o)return[78,121,167];if(i.startsWith("#"))return[parseInt(i.slice(1,3),16),parseInt(i.slice(3,5),16),parseInt(i.slice(5,7),16)];const r=i.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return r?[+r[1],+r[2],+r[3]]:[78,121,167]}function Kn(e,t,n){return null==t?n:"string"!=typeof t?t:tn(e,t)||n}function Un(e,t,n,o,i,r,s){if("colorStops"in t){const n=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>n.length)return null;const a=e.createLinearGradient(o,i,r,s);for(const e of n)a.addColorStop(e.offset,e.color);return a}const{topOpacity:a,bottomOpacity:l}=t;if(!Number.isFinite(a)||!Number.isFinite(l))return null;const c=Math.max(0,Math.min(1,a)),d=Math.max(0,Math.min(1,l)),u=e.createLinearGradient(o,i,r,s),[h,g,f]=Zn(e,n);return u.addColorStop(0,`rgba(${h},${g},${f},${c})`),u.addColorStop(1,`rgba(${h},${g},${f},${d})`),u}function Jn(e,t){const{x:n,y:o,w:i,h:r}=t,{tl:s,tr:a,br:l,bl:c}=$t(t);e.beginPath(),e.moveTo(n+s,o),e.lineTo(n+i-a,o),a>0&&e.arcTo(n+i,o,n+i,o+a,a),e.lineTo(n+i,o+r-l),l>0&&e.arcTo(n+i,o+r,n+i-l,o+r,l),e.lineTo(n+c,o+r),c>0&&e.arcTo(n,o+r,n,o+r-c,c),e.lineTo(n,o+s),s>0&&e.arcTo(n,o,n+s,o,s),e.closePath()}function eo(e){switch(e.roundedEdge){case"bottom":return{x0:e.x,y0:e.y+e.h,x1:e.x,y1:e.y};case"right":return{x0:e.x+e.w,y0:e.y,x1:e.x,y1:e.y};case"left":return{x0:e.x,y0:e.y,x1:e.x+e.w,y1:e.y};default:return{x0:e.x,y0:e.y,x1:e.x,y1:e.y+e.h}}}const to=(e,t,n,o)=>{const i=t.filter(e=>"rect"===e.type);for(const t of i){if(null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon)no(e,t);else if(t.cornerRadii&&Tt(t.cornerRadii)){const n=Kn(e,t.style.fill,tn(e,"var(--semiotic-primary, #007bff)")),o=eo(t),i=t.fillGradient&&"string"==typeof n?Un(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=i||n,Jn(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=tn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else if(t.roundedTop&&t.roundedTop>0){const n=Kn(e,t.style.fill,tn(e,"var(--semiotic-primary, #007bff)")),o=eo(t),i=t.fillGradient&&"string"==typeof n?Un(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=i||n;const r=Math.min(t.roundedTop,t.w/2,t.h/2);e.beginPath();const{x:s,y:a,w:l,h:c}=t;switch(t.roundedEdge){case"right":e.moveTo(s,a),e.lineTo(s+l-r,a),e.arcTo(s+l,a,s+l,a+r,r),e.lineTo(s+l,a+c-r),e.arcTo(s+l,a+c,s+l-r,a+c,r),e.lineTo(s,a+c);break;case"left":e.moveTo(s+l,a),e.lineTo(s+r,a),e.arcTo(s,a,s,a+r,r),e.lineTo(s,a+c-r),e.arcTo(s,a+c,s+r,a+c,r),e.lineTo(s+l,a+c);break;case"bottom":e.moveTo(s,a),e.lineTo(s+l,a),e.lineTo(s+l,a+c-r),e.arcTo(s+l,a+c,s+l-r,a+c,r),e.lineTo(s+r,a+c),e.arcTo(s,a+c,s,a+c-r,r);break;default:e.moveTo(s,a+c),e.lineTo(s,a+r),e.arcTo(s,a,s+r,a,r),e.lineTo(s+l-r,a),e.arcTo(s+l,a,s+l,a+r,r),e.lineTo(s+l,a+c)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=tn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const n=Kn(e,t.style.fill,tn(e,"var(--semiotic-primary, #007bff)")),o=eo(t),i=t.fillGradient&&"string"==typeof n?Un(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=i||n,e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=tn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}Xn(e,t),e.globalAlpha=1}};function no(e,t){const n=t.style.icon,o=t.style.iconPadding||2,i=Math.min(t.w,t.h)-o;if(0>=i)return;const r=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),r){const r=i+o,s=t.x+(t.w-i)/2;for(let o=t.y+t.h-i;o>=t.y-i;o-=r)e.drawImage(n,s,o,i,i)}else{const r=i+o,s=t.y+(t.h-i)/2;for(let o=t.x;t.x+t.w>o;o+=r)e.drawImage(n,o,s,i,i)}e.restore()}const oo=(e,t,n,o)=>{var i;const r=t.filter(e=>"point"===e.type);if(0!==r.length){e.save();try{for(const t of r){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const n=null!==(i=t.style.opacity)&&void 0!==i?i:t.style.fillOpacity;null!=n&&(e.globalAlpha=n),e.fillStyle=Kn(e,t.style.fill,"#4e79a7"),e.fill(),t.style.stroke&&(e.strokeStyle=Kn(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth||1,e.stroke()),Yn(e,t),e.globalAlpha=1}}finally{e.restore()}}};function io(e,t){var n,o,i,r;const s=t._gradientBand.colors;if(0===s.length)return;const{clipPath:a,slices:l}=Ht({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,cornerRadius:t.cornerRadius,roundStart:null===(o=null===(n=t.roundedEnds)||void 0===n?void 0:n.start)||void 0===o||o,roundEnd:null===(r=null===(i=t.roundedEnds)||void 0===i?void 0:i.end)||void 0===r||r,colors:s}),c=new Path2D(a);e.save(),e.translate(t.cx,t.cy),e.clip(c);for(const t of l)e.fillStyle=tn(e,t.color)||t.color||"#007bff",e.fill(new Path2D(t.d));e.restore(),t.style.stroke&&"none"!==t.style.stroke&&(e.save(),e.translate(t.cx,t.cy),e.strokeStyle=tn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(c),e.restore())}function ro(e,t){e.beginPath(),t.innerRadius>0?(e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerRadius,t.endAngle,t.startAngle,!0)):(e.moveTo(t.cx,t.cy),e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle)),e.closePath()}function so(e,t){const n={innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle+Math.PI/2,endAngle:t.endAngle+Math.PI/2},o=T().cornerRadius(t.cornerRadius)(n);if(!o)return;e.save(),e.translate(t.cx,t.cy);const i=new Path2D(o);e.fill(i),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(i),e.restore()}const ao=(e,t,n,o)=>{var i,r;const s=t.filter(e=>"wedge"===e.type);for(const t of s){const n=null!==(i=t.style.fillOpacity)&&void 0!==i?i:1,o=null!==(r=t.style.opacity)&&void 0!==r?r:1;if(e.globalAlpha=n*o,t._gradientBand&&t._gradientBand.colors.length>0)io(e,t),t._pulseIntensity&&t._pulseIntensity>0&&(ro(e,t),Qn(e,t)),e.globalAlpha=1;else{if(e.fillStyle=("string"==typeof t.style.fill?tn(e,t.style.fill):t.style.fill)||"#007bff",t.roundedEnds){t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=tn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1);const n=Bt({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,cornerRadius:t.cornerRadius,roundStart:t.roundedEnds.start,roundEnd:t.roundedEnds.end});e.save(),e.translate(t.cx,t.cy);const o=new Path2D(n);e.fill(o),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(o),e.restore()}else t.cornerRadius?(t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=tn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1),so(e,t)):(ro(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=tn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()));t._pulseIntensity&&t._pulseIntensity>0&&(ro(e,t),Qn(e,t)),e.globalAlpha=1}}},lo=(e,t,n,o)=>{var i,r;const s=t.filter(e=>"boxplot"===e.type);for(const t of s){const n=t.columnWidth/2,o="vertical"===t.projection,s=tn(e,"var(--semiotic-primary, #007bff)"),a=tn(e,"var(--semiotic-text, #333)"),l=t.style.fill,c="string"==typeof l?tn(e,l)||l:null!=l?l:s,d=t.style.stroke,u="string"==typeof d?tn(e,d)||d:a,h=t.style.strokeWidth||1,g=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.6;if(e.save(),e.strokeStyle=u,e.lineWidth=h,e.beginPath(),o?(e.moveTo(t.x,t.minPos),e.lineTo(t.x,t.maxPos)):(e.moveTo(t.minPos,t.y),e.lineTo(t.maxPos,t.y)),e.stroke(),e.beginPath(),o?(e.moveTo(t.x-.4*n,t.minPos),e.lineTo(t.x+.4*n,t.minPos),e.moveTo(t.x-.4*n,t.maxPos),e.lineTo(t.x+.4*n,t.maxPos)):(e.moveTo(t.minPos,t.y-.4*n),e.lineTo(t.minPos,t.y+.4*n),e.moveTo(t.maxPos,t.y-.4*n),e.lineTo(t.maxPos,t.y+.4*n)),e.stroke(),e.globalAlpha=g,e.fillStyle=c,o){const o=Math.min(t.q1Pos,t.q3Pos),i=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-n,o,t.columnWidth,i),e.globalAlpha=1,e.strokeRect(t.x-n,o,t.columnWidth,i)}else{const o=Math.min(t.q1Pos,t.q3Pos),i=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(o,t.y-n,i,t.columnWidth),e.globalAlpha=1,e.strokeRect(o,t.y-n,i,t.columnWidth)}e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),o?(e.moveTo(t.x-n,t.medianPos),e.lineTo(t.x+n,t.medianPos)):(e.moveTo(t.medianPos,t.y-n),e.lineTo(t.medianPos,t.y+n)),e.stroke(),e.restore()}},co=(e,t,n,o)=>{var i,r;const s=t.filter(e=>"violin"===e.type);for(const t of s){e.save(),(t.translateX||t.translateY)&&e.translate(t.translateX,t.translateY);const n=new Path2D(t.pathString);if(e.globalAlpha=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.6,e.fillStyle=("string"==typeof t.style.fill?tn(e,t.style.fill):t.style.fill)||"#007bff",e.fill(n),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=tn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(n)),t.iqrLine){e.strokeStyle="#333",e.lineWidth=2,e.globalAlpha=.8;const n=t.iqrLine.centerPos,o=!1!==t.iqrLine.isVertical;e.beginPath(),o?(e.moveTo(n,t.iqrLine.q1Pos),e.lineTo(n,t.iqrLine.q3Pos)):(e.moveTo(t.iqrLine.q1Pos,n),e.lineTo(t.iqrLine.q3Pos,n)),e.stroke(),e.beginPath(),o?e.arc(n,t.iqrLine.medianPos,3,0,2*Math.PI):e.arc(t.iqrLine.medianPos,n,3,0,2*Math.PI),e.fillStyle="#fff",e.fill(),e.strokeStyle="#333",e.lineWidth=1,e.stroke(),e.globalAlpha=1}e.restore()}},uo=(e,t,n,o)=>{var i,r,s;const a=t.filter(e=>"connector"===e.type);if(0===a.length)return;const l=new Map;for(const e of a){const t=e.group||"_default";l.has(t)||l.set(t,[]),l.get(t).push(e)}for(const[,t]of l){if(0===t.length)continue;const n=t[0].style;if(n.fill&&"none"!==n.fill){e.beginPath(),e.moveTo(t[0].x1,t[0].y1);for(const n of t)e.lineTo(n.x2,n.y2);e.closePath(),e.globalAlpha=null!==(r=null!==(i=n.fillOpacity)&&void 0!==i?i:n.opacity)&&void 0!==r?r:.3,e.fillStyle=n.fill,e.fill(),e.globalAlpha=1}for(const n of t)e.beginPath(),e.moveTo(n.x1,n.y1),e.lineTo(n.x2,n.y2),e.strokeStyle=tn(e,n.style.stroke)||("string"==typeof n.style.fill?tn(e,n.style.fill):n.style.fill)||tn(e,"var(--semiotic-border, #999)"),e.lineWidth=n.style.strokeWidth||1,e.globalAlpha=null!==(s=n.style.opacity)&&void 0!==s?s:.5,e.stroke(),e.globalAlpha=1}},ho=(e,t,n,o)=>{var i,r,s,a;const l=t.filter(e=>"trapezoid"===e.type);for(const t of l){const n=t.points;if(n.length>=4){e.globalAlpha=null!==(r=null===(i=t.style)||void 0===i?void 0:i.opacity)&&void 0!==r?r:1,e.beginPath(),e.moveTo(n[0][0],n[0][1]);for(let t=1;n.length>t;t++)e.lineTo(n[t][0],n[t][1]);e.closePath(),e.fillStyle=(null===(s=t.style)||void 0===s?void 0:s.fill)||"#999",e.fill(),(null===(a=t.style)||void 0===a?void 0:a.stroke)&&(e.strokeStyle=tn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}};function go(e){return 1e6>e?1e4>e?1e3>e?e+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function fo(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}let po=null;function yo(e={},t){const{background:n="transparent",stroke:o="#000",lineWidth:i=1.5,spacing:r=6,angle:s=45}=e,a=Math.max(8,Math.ceil(2*r));let l;try{l=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(po||(po=document.createElement("canvas")),po.width=e,po.height=e,po)}(a)}catch(e){return null}const c=l.getContext("2d");if(!c)return null;n&&"transparent"!==n?(c.fillStyle=n,c.fillRect(0,0,a,a)):c.clearRect(0,0,a,a),c.strokeStyle=o,c.lineWidth=i,c.lineCap="square";const d=s*Math.PI/180;if(45===s||-45===s){const e=s>0?1:-1;for(let t=-a;2*a>=t;t+=r)c.beginPath(),c.moveTo(t,0),c.lineTo(t+e*a,a),c.stroke()}else{c.save(),c.translate(a/2,a/2),c.rotate(d);const e=2*a;for(let t=-e;e>=t;t+=r)c.beginPath(),c.moveTo(-e,t),c.lineTo(e,t),c.stroke();c.restore()}return(t||c).createPattern(l,"repeat")}const mo=new Map;function vo(e,t){const n=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,o=mo.get(n);if(void 0!==o)return o;const i=yo({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return mo.set(n,i),i}function bo(e,t,n,o,i,r){e.moveTo(t+r,n),e.lineTo(t+o-r,n),e.quadraticCurveTo(t+o,n,t+o,n+r),e.lineTo(t+o,n+i-r),e.quadraticCurveTo(t+o,n+i,t+o-r,n+i),e.lineTo(t+r,n+i),e.quadraticCurveTo(t,n+i,t,n+i-r),e.lineTo(t,n+r),e.quadraticCurveTo(t,n,t+r,n),e.closePath()}function xo(e){return 1e6>e?1e4>e?1e3>e?Math.round(e)+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function wo(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}const ko=e=>[uo,...e],Ao={bar:ko([to]),clusterbar:ko([to]),point:ko([oo]),swarm:ko([oo]),pie:[ao],donut:[ao],boxplot:ko([lo,oo]),violin:ko([co]),histogram:ko([to]),ridgeline:ko([co]),timeline:ko([to]),funnel:[to,ho,(e,t,n,o)=>{var i,r,s,a;const l=t.filter(e=>"rect"===e.type&&null!=e.datum);if(0!==l.length&&l.some(e=>{var t,n;return null!=(null===(t=e.datum)||void 0===t?void 0:t.__funnelStepLabel)||null!=(null===(n=e.datum)||void 0===n?void 0:n.__funnelValueLabelX)})){e.textBaseline="top",e.lineJoin="round",e.textAlign="center",e.font="bold 14px sans-serif";for(const t of l){const n=t.datum;if(!n)continue;if(!n.__funnelStepLabel)continue;const o=n.__funnelStepLabel;if(e.measureText(o).width+16>(null!==(r=null!==(i=n.__funnelRowWidth)&&void 0!==i?i:n.__funnelBarW)&&void 0!==r?r:0))continue;const s=n.__funnelStepLabelX,a=n.__funnelStepLabelY+3;e.strokeStyle="rgba(0,0,0,0.6)",e.lineWidth=3,e.strokeText(o,s,a),e.fillStyle="#fff",e.fillText(o,s,a)}e.font="bold 13px sans-serif";for(const t of l){const n=t.datum;if(!n)continue;if(null==n.__funnelValueLabelX)continue;const o=null!==(s=n.__funnelBarW)&&void 0!==s?s:0;if(60>o)continue;const i=n.__funnelValue;if(null==i||0===i)continue;const r=n.__funnelPercent,l=!0===n.__funnelIsFirstStep;let c;if(c=l?go(i):null!=r?`${go(i)} (${fo(r)})`:go(i),e.measureText(c).width+16>o){if(l||null==r)continue;if(c=go(i),e.measureText(c).width+16>o)continue}const d=n.__funnelValueLabelX,u=(null!==(a=n.__funnelValueLabelY)&&void 0!==a?a:t.y)+14+5;e.textAlign="center",e.strokeStyle="rgba(0,0,0,0.5)",e.lineWidth=3,e.strokeText(c,d,u),e.fillStyle="#fff",e.fillText(c,d,u)}e.lineWidth=1,e.lineJoin="miter"}}],"bar-funnel":[to,(e,t,n,o)=>{var i,r;const s=t.filter(e=>{var t;return"rect"===e.type&&!0===(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)});for(const t of s){const n=("string"==typeof t.style.fill?t.style.fill:null)||tn(e,"var(--semiotic-border, #999)"),o=vo(n,e);e.globalAlpha=null!==(i=t.style.opacity)&&void 0!==i?i:1,e.beginPath(),e.rect(t.x,t.y,t.w,t.h),o?e.fillStyle=o:(e.fillStyle=n,e.globalAlpha=.4*(null!==(r=t.style.opacity)&&void 0!==r?r:1)),e.fill(),e.globalAlpha=1}},(e,t,n,o)=>{const i=t.filter(e=>{var t,n;return"rect"===e.type&&!0!==(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)&&null!=(null===(n=e.datum)||void 0===n?void 0:n.__barFunnelLabelX)});if(0===i.length)return;const r=function(e,t){const[n,o,i]=Zn(e,t);return(.2126*n+.7152*o+.0722*i)/255>.6}(e,tn(e,"var(--semiotic-text, #333)")),s=r?"#1f2937":"#ffffff",a=r?"rgba(255,255,255,0.18)":"rgba(0,0,0,0.12)",l=r?"#f3f4f6":"#1a1a1a",c=l;for(const t of i){const n=t.datum;if(!n)continue;const o=n.__barFunnelValue;if(null==o)continue;if(25>t.w)continue;const i=n.__barFunnelPercent,r=!(!0===n.__barFunnelIsFirstStep)&&null!=i,d=r?wo(i):"",u=xo(o);e.font="bold 13px sans-serif";const h=r?e.measureText(d).width:0;e.font="11px sans-serif";const g=e.measureText(u).width,f=Math.max(h,g)+12,p=r?32:17,y=n.__barFunnelLabelX,m=y-f/2,v=n.__barFunnelLabelY-p-4;e.save(),e.shadowColor="rgba(0,0,0,0.15)",e.shadowBlur=4,e.shadowOffsetY=1,e.fillStyle=s,e.beginPath(),bo(e,m,v,f,p,4),e.fill(),e.restore(),e.strokeStyle=a,e.lineWidth=.5,e.beginPath(),bo(e,m,v,f,p,4),e.stroke(),e.textAlign="center",e.textBaseline="top",r?(e.font="bold 13px sans-serif",e.fillStyle=l,e.fillText(d,y,v+3),e.font="11px sans-serif",e.fillStyle=c,e.fillText(u,y,v+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle=l,e.fillText(u,y,v+3))}e.lineWidth=1}],swimlane:ko([to]),custom:ko([to,oo,ao,lo,co,ho])},Oo={top:50,right:40,bottom:60,left:70},So={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"6px 10px",borderRadius:"4px",fontSize:"13px",lineHeight:"1.4",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",whiteSpace:"nowrap"};function jo({hover:n}){var o,i,r,s,a,l;const c=n.data||{},d=n.stats,u=n.category;if(Array.isArray(c)){const n=u||(null===(o=c[0])||void 0===o?void 0:o.category)||"";if(d)return t("div",{className:"semiotic-tooltip",style:So,children:[n&&e("div",{style:{fontWeight:"bold"},children:n+""}),t("div",{children:["n = ",d.n]}),t("div",{children:["Min: ",d.min.toLocaleString()]}),t("div",{children:["Q1: ",d.q1.toLocaleString()]}),t("div",{children:["Median: ",d.median.toLocaleString()]}),t("div",{children:["Q3: ",d.q3.toLocaleString()]}),t("div",{children:["Max: ",d.max.toLocaleString()]}),t("div",{style:{opacity:.8},children:["Mean: ",d.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});const i=c.length;return t("div",{className:"semiotic-tooltip",style:So,children:[n&&e("div",{style:{fontWeight:"bold"},children:n+""}),t("div",{children:[i," items"]})]})}if(null!=c.bin&&null!=c.count){const n=c.range||[];return t("div",{className:"semiotic-tooltip",style:So,children:[c.category&&e("div",{style:{fontWeight:"bold"},children:c.category+""}),t("div",{children:["Count: ",c.count]}),2===n.length&&t("div",{style:{opacity:.8},children:[Number(n[0]).toFixed(1)," – ",Number(n[1]).toFixed(1)]})]})}const h=n.__oAccessor,g=n.__rAccessor,f=n.__chartType;if("swarm"===f||"point"===f){const n=Object.entries(c).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e("div",{className:"semiotic-tooltip",style:So,children:n.map(([e,n])=>t("div",{children:[t("span",{style:{opacity:.7},children:[e,":"]})," ","number"==typeof n?n.toLocaleString():n+""]},e))})}const p=(h&&null!=c[h]?c[h]:null)||c.category||c.name||c.group||c.__rName||"",y=null!==(l=null!==(a=null!==(s=null!==(r=null!==(i=c.__aggregateValue)&&void 0!==i?i:g&&null!=c[g]?c[g]:null)&&void 0!==r?r:c.value)&&void 0!==s?s:c.__rValue)&&void 0!==a?a:c.pct)&&void 0!==l?l:"";if(!p&&""===y){const n=Object.entries(c).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e("div",{className:"semiotic-tooltip",style:So,children:n.map(([e,n])=>t("div",{children:[t("span",{style:{opacity:.7},children:[e,":"]})," ","number"==typeof n?n.toLocaleString():n+""]},e))})}return t("div",{className:"semiotic-tooltip",style:So,children:[p&&e("div",{style:{fontWeight:"bold"},children:p+""}),""!==y&&e("div",{children:"number"==typeof y?y.toLocaleString():y+""})]})}jo.ownsChrome=!0;const Mo=g(function(n,c){var d,h,g,p,y,m,v,b,x,w,k,A;const{chartType:O,runtimeMode:S,data:j,oAccessor:M="category",rAccessor:_="value",colorAccessor:C,stackBy:P,groupBy:L,multiAxis:$,timeAccessor:I,valueAccessor:B,categoryAccessor:H,projection:R="vertical",size:N=[600,400],responsiveWidth:E,responsiveHeight:W,margin:z,barPadding:G,roundedTop:q,gradientFill:V,trackFill:X,baselinePadding:Y,innerRadius:Q,cornerRadius:Z,normalize:K,startAngle:U,sweepAngle:J,dynamicColumnWidth:ee,bins:te,showOutliers:ne,showIQR:oe,amplitude:ie,connectorOpacity:re,showLabels:se,connectorAccessor:ae,connectorStyle:le,dataIdAccessor:ce,rExtent:de,oExtent:ue,extentPadding:he=.05,oSort:ge,windowMode:fe="sliding",windowSize:pe=200,pieceStyle:ye,summaryStyle:me,colorScheme:ve,barColors:be,showAxes:xe=!0,showCategoryTicks:we,categoryLabel:Se,valueLabel:Ie,categoryFormat:Be,valueFormat:He,oLabel:Re,rLabel:De,oFormat:Fe,rFormat:Ne,rTickValues:Ee,tickLabelEdgeAlign:We,axisExtent:ze,enableHover:Ge=!0,hoverAnnotation:qe,tooltipContent:Ve,customHoverBehavior:Xe,annotations:Ye,autoPlaceAnnotations:Qe,svgAnnotationRules:Ze,showGrid:Ke=!1,legend:Ue,legendHoverBehavior:Je,legendClickBehavior:et,legendHighlightedCategory:tt,legendIsolatedCategories:nt,legendPosition:ot,legendLayout:it,legendCategoryAccessor:rt,onCategoriesChange:st,backgroundGraphics:at,foregroundGraphics:lt,title:ct,className:dt,background:ut,centerContent:ht,decay:gt,pulse:ft,transition:pt,animate:yt,staleness:mt,brush:vt,onBrush:bt,accessibleTable:xt=!0,description:wt,summary:kt,customLayout:At,layoutConfig:Ot}=n,St=s(!0),jt=qn({sizeProp:N,responsiveWidth:E,responsiveHeight:W,userMargin:z,marginDefault:Oo,foregroundGraphics:lt,backgroundGraphics:at,animate:yt,transitionProp:pt,themeDirtyRef:St}),{reducedMotionRef:_t,responsiveRef:It,size:Yt,margin:Qt,adjustedWidth:Zt,adjustedHeight:Kt,resolvedForeground:Ut,resolvedBackground:Jt,currentTheme:en,transition:nn,introEnabled:on,tableId:sn,rafRef:an,renderFnRef:ln,scheduleRender:cn}=jt,dn=function(){const[e,t]=a(!1);return Et(()=>{t(!0)},[]),e}(),un=function(){const e=l(Wt,zt,Gt);return s(e).current}(),hn=r(()=>D(j),[j]),gn=null!=Se?Se:Re,fn=null!=Ie?Ie:De,pn=null!=Be?Be:Fe,yn=null!=He?He:Ne,mn=s(null),vn=s(null),An=s([]),jn=s(rt),Mn=s(st);jn.current=rt,Mn.current=st;const[_n,Cn]=a(null),[Pn,Tn]=a(null),[$n,Bn]=a(0),[Hn,Rn]=a(!1),Dn=Ge||qe,Fn="streaming"===S,Nn=r(()=>{var e,t,n;return{chartType:O,runtimeMode:Fn?"streaming":"bounded",windowSize:pe,windowMode:fe,extentPadding:he,projection:R,oAccessor:Fn?void 0:M,rAccessor:Fn?void 0:_,colorAccessor:C,stackBy:P,groupBy:L,multiAxis:$,timeAccessor:Fn?I:void 0,valueAccessor:Fn?B||("string"==typeof _||"function"==typeof _?_:void 0):void 0,categoryAccessor:Fn?H||M:void 0,rExtent:de,oExtent:ue,axisExtent:ze,barPadding:G,roundedTop:q,gradientFill:V,trackFill:X,baselinePadding:Y,innerRadius:Q,cornerRadius:Z,normalize:K,startAngle:U,sweepAngle:J,dynamicColumnWidth:ee,bins:te,showOutliers:ne,showIQR:oe,amplitude:ie,connectorOpacity:re,showLabels:se,connectorAccessor:ae,connectorStyle:le,dataIdAccessor:ce,oSort:ge,pieceStyle:ye,summaryStyle:me,colorScheme:ve,themeCategorical:null===(e=null==en?void 0:en.colors)||void 0===e?void 0:e.categorical,themeSemantic:In(en),themeSequential:null===(t=null==en?void 0:en.colors)||void 0===t?void 0:t.sequential,themeDiverging:null===(n=null==en?void 0:en.colors)||void 0===n?void 0:n.diverging,barColors:be,decay:gt,pulse:ft,transition:nn,introAnimation:on,staleness:mt,customLayout:At,layoutConfig:Ot,layoutMargin:Qt}},[O,pe,fe,he,R,M,_,C,P,L,$,I,B,H,de,ue,ze,G,q,V,X,Y,Q,Z,K,U,J,ee,te,ne,oe,ie,re,se,ae,le,ce,ge,ye,me,ve,be,gt,ft,null==nn?void 0:nn.duration,null==nn?void 0:nn.easing,on,mt,Fn,en,At,Ot,Qt]),En=function(e){const t=s(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return Vt(e,t);if(!Xt(e)||!Xt(t))return!1;const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;const n=e[o],i=t[o];if(!Object.is(n,i))if(Array.isArray(n)&&Array.isArray(i)){if(!Vt(n,i))return!1}else{if(!Xt(n)||!Xt(i))return!1;if(!qt(n,i))return!1}}return!0}(t.current,e)||(t.current=e),t.current}(Nn),Wn=s(null);Wn.current||(Wn.current=new ke(En));const zn=u(()=>{var e,t;const n=jn.current,o=Mn.current;if(!o||!n)return;const i=function(e,t){if(!t)return[];const n=new Set,o=[];for(const i of e){if(!i||"object"!=typeof i)continue;const e="function"==typeof t?t(i):i[t];if(null==e)continue;const r=e+"";n.has(r)||(n.add(r),o.push(r))}return o}(null!==(t=null===(e=Wn.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[],n);(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,An.current)||(An.current=i,o(i))},[]);i(()=>{var e;null===(e=Wn.current)||void 0===e||e.updateConfig(En),St.current=!0,cn()},[En,cn]);const Gn=s(null);Gn.current||(Gn.current=new F(e=>{const t=Wn.current;t&&t.ingest(e)&&(St.current=!0,cn())}));const Vn=u(e=>{var t;null===(t=Gn.current)||void 0===t||t.push(e)},[]),Xn=u(e=>{var t;null===(t=Gn.current)||void 0===t||t.pushMany(e)},[]),Yn=u(()=>{var e,t;null===(e=Gn.current)||void 0===e||e.clear(),null===(t=Wn.current)||void 0===t||t.clear(),St.current=!0,cn()},[cn]),Qn=u(e=>{var t,n;null===(t=Gn.current)||void 0===t||t.clearLastData(),null===(n=Gn.current)||void 0===n||n.setReplacementData(e)},[]);f(c,()=>({push:Vn,pushMany:Xn,replace:Qn,remove:e=>{var t,n,o,i;null===(t=Gn.current)||void 0===t||t.flush();const r=null!==(o=null===(n=Wn.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[];if(r.length>0){const e=null===(i=vn.current)||void 0===i?void 0:i.data;!!vn.current&&r.some(Array.isArray(e)?t=>e.includes(t):t=>t===e)&&(vn.current=null,Cn(null)),St.current=!0,cn()}return r},update:(e,t)=>{var n,o,i;null===(n=Gn.current)||void 0===n||n.flush();const r=null!==(i=null===(o=Wn.current)||void 0===o?void 0:o.update(e,t))&&void 0!==i?i:[];return r.length>0&&(St.current=!0,cn()),r},clear:Yn,getData:()=>{var e,t,n;return null===(e=Gn.current)||void 0===e||e.flush(),null!==(n=null===(t=Wn.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Wn.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[Vn,Xn,Qn,Yn,cn]),i(()=>{var e;j&&(null===(e=Gn.current)||void 0===e||e.setBoundedData(hn))},[j,hn]);const{hoverHandlerRef:Zn,hoverLeaveRef:Kn,onPointerMove:Un,onPointerLeave:Jn}=jt;Zn.current=e=>{if(!Dn)return;const t=mn.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-Qt.left,i=e.clientY-n.top-Qt.top;if(0>o||o>Zt||0>i||i>Kt)return void(vn.current&&(vn.current=null,Cn(null),Xe&&Xe(null),cn()));const r=Wn.current;if(!r||0===r.scene.length)return;const s="radial"===R,a=function(e,t,n,o=30,i,r=0){let s=null;if(i){const e=function(e,t,n,o,i,r=e=>e.x,s=e=>e.y,a=e=>e.r){const l=Math.max(o,i+5,12),c=t-l,d=t+l,u=n-l,h=n+l;let g=null,f=1/0;return e.visit((e,i,l,p,y)=>{if(i>d||c>p||l>h||u>y)return!0;if(!e.length){let i=e;do{const e=i.data,l=r(e)-t,c=s(e)-n,d=Math.sqrt(l*l+c*c);Oe(a(e),o)>=d&&f>d&&(g=e,f=d),i=i.next}while(i)}return!1}),g?{node:g,distance:f}:null}(i,t,n,o,r);e&&(s={datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const r of e){let e=null;switch(r.type){case"rect":if(null==r.datum)break;e=je(r,t,n);break;case"point":if(i)break;e=Me(r,t,n,o);break;case"wedge":if(null===r.datum)break;e=_e(r,t,n);break;case"boxplot":e=Ce(r,t,n);break;case"violin":e=Pe(r,t,n)}e&&o>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}(r.scene,s?o-Zt/2:o,s?i-Kt/2:i,30,r.pointQuadtree,r.maxPointRadius);if(!a)return void(vn.current&&(vn.current=null,Cn(null),Xe&&Xe(null),cn()));const l=(c=a.datum||{},d=a.x,u=a.y,h=Object.assign(Object.assign(Object.assign({},a.stats&&{stats:a.stats}),a.category&&{category:a.category}),{__oAccessor:"string"==typeof M?M:void 0,__rAccessor:"string"==typeof _?_:void 0,__chartType:O}),Object.assign({data:Sn(c),x:d,y:u,__semioticHoverData:!0},h));var c,d,u,h;vn.current=l,Cn(l),Xe&&(Xe(l),St.current=!0),cn()},Kn.current=()=>{vn.current&&(vn.current=null,Cn(null),Xe&&(Xe(null),St.current=!0),cn())};const eo=s(-1),to=s(null),no=s(null),oo=u(e=>{const t=Wn.current;if(!t||0===t.scene.length)return;const n=t.version;let o;if(no.current&&no.current.version===n)o=no.current.graph;else{const e=function(e){var t,n,o;const i=[];for(const r of e)if("rect"===r.type&&null!=r.x){if(null==r.datum)continue;const e=null!==(n=null===(t=r.datum)||void 0===t?void 0:t.category)&&void 0!==n?n:"";i.push({x:r.x+r.w/2,y:r.y+r.h/2,datum:r.datum,shape:"rect",w:r.w,h:r.h,group:null!==(o=r.group)&&void 0!==o?o:e})}else if("point"===r.type)i.push({x:r.x,y:r.y,datum:r.datum,shape:"circle",group:"_default"});else if("wedge"===r.type&&null!=r.cx){if(null===r.datum)continue;const e=((r.startAngle||0)+(r.endAngle||0))/2,t=((r.innerRadius||0)+(r.outerRadius||50))/2;i.push({x:r.cx+Math.cos(e)*t,y:r.cy+Math.sin(e)*t,datum:r.datum,shape:"wedge",group:"_default"})}return i.sort((e,t)=>e.x-t.x||e.y-t.y),i}(t.scene);if(0===e.length)return;o=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 i=o.get(e);i||(i=[],o.set(e,i)),i.push(n)}for(const e of o.values()){e.sort((e,t)=>e.x-t.x||e.y-t.y);for(let t=0;e.length>t;t++)e[t]._groupIndex=t}const i=Array.from(o.keys()).sort((e,t)=>{const n=o.get(e),i=o.get(t);return(n.length>0?n[0].y:0)-(i.length>0?i[0].y:0)}),r=Array.from(o.values()).flat();r.sort((e,t)=>e.x-t.x||e.y-t.y);const s=new Map;for(let e=0;r.length>e;e++){r[e]._flatIndex=e;const t=null===(n=r[e].datum)||void 0===n?void 0:n.id;null!=t&&s.set(t+"",e)}return{flat:r,groups:i,byGroup:o,idToIdx:s}}(e),no.current={version:n,graph:o}}const i=eo.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),eo.current=0;const t=o.flat[0];to.current={shape:t.shape,w:t.w,h:t.h};const n=Object.assign(Object.assign({},Te(t)),{__oAccessor:"string"==typeof M?M:void 0,__rAccessor:"string"==typeof _?_:void 0,__chartType:O});return vn.current=n,Cn(n),Xe&&Xe(n),void cn()}const r=function(e,t){var n,o;if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const i=Math.max(0,Math.min(t,e.flat.length-1)),r=e.flat[i];return{flatIndex:i,group:null!==(n=r.group)&&void 0!==n?n:"_default",indexInGroup:null!==(o=r._groupIndex)&&void 0!==o?o:0}}(o,i),s=function(e,t,n){const{group:o,indexInGroup:i}=t,r=n.byGroup.get(o);switch(e){case"ArrowRight":return r.length-1>i?r[i+1]._flatIndex:t.flatIndex;case"ArrowLeft":return i>0?r[i-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=n.groups.indexOf(o);return n.groups.length-1>e?Le(n,n.groups[e+1],r[i]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?Le(n,n.groups[e-1],r[i]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*n.flat.length)),n.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*n.flat.length)),0);case"Home":return 0;case"End":return n.flat.length-1;case"Escape":return-1;default:return null}}(e.key,r,o);if(null===s)return;if(e.preventDefault(),0>s)return eo.current=-1,to.current=null,vn.current=null,Cn(null),Xe&&Xe(null),void cn();eo.current=s;const a=o.flat[s];to.current={shape:a.shape,w:a.w,h:a.h};const l=Object.assign(Object.assign({},Te(a)),{__oAccessor:"string"==typeof M?M:void 0,__rAccessor:"string"==typeof _?_:void 0,__chartType:O});vn.current=l,Cn(l),Xe&&Xe(l),cn()},[Xe,cn]),io=u(e=>{eo.current=-1,to.current=null,Un(e)},[Un]);ln.current=()=>{var e,t;an.current=0;const n=mn.current;if(!n)return;const o=n.getContext("2d");if(!o)return;const i=Wn.current;if(!i)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=i.advanceTransition(_t.current?r+1e6:r),a=!_t.current&&s,l=St.current;l&&!s&&(i.computeScene({width:Zt,height:Kt}),zn(),St.current=!1),(l||a)&&n.setAttribute("aria-label",rn(i.scene,O+" chart"));const c="undefined"!=typeof window&&window.devicePixelRatio||1,d=Yt[0]*c,u=Yt[1]*c;n.width===d&&n.height===u||(n.width=d,n.height=u,n.style.width=Yt[0]+"px",n.style.height=Yt[1]+"px"),o.setTransform(c,0,0,c,0,0),o.clearRect(0,0,Yt[0],Yt[1]);const h=null!==(e=null==mt?void 0:mt.threshold)&&void 0!==e?e:5e3,g=mt&&i.lastIngestTime>0&&r-i.lastIngestTime>h;if(g&&(o.globalAlpha=null!==(t=null==mt?void 0:mt.dimOpacity)&&void 0!==t?t:.5),"transparent"!==ut&&!at){const e=n?getComputedStyle(n).getPropertyValue("--semiotic-bg").trim():"",t=ut||(e&&"transparent"!==e?e:null),i=t?tn(o,t):null;i&&(o.fillStyle=i,o.fillRect(0,0,Yt[0],Yt[1]))}const f="radial"===R;o.save(),o.beginPath(),o.rect(Qt.left,Qt.top,Zt,Kt),o.clip(),f?(o.save(),o.translate(Qt.left+Zt/2,Qt.top+Kt/2)):o.translate(Qt.left,Qt.top);const p=At?Ao.custom:Ao[O]||[],y={width:Zt,height:Kt};for(const e of p)e(o,i.scene,i.scales,y);f&&o.restore(),o.restore(),g&&(o.globalAlpha=1),l&&i.scales&&(Tn(i.scales),Bn(e=>e+1)),(null==mt?void 0:mt.showBadge)&&Rn(!!g),(a||null!=i.activeTransition||i.hasActivePulses)&&(an.current=requestAnimationFrame(()=>ln.current()))},function(e){const{hydrated:t,wasHydratingFromSSR:n,storeRef:o,dirtyRef:r,renderFnRef:a,cleanup:l}=e;Et(()=>{var e,i;t&&n&&(null===(i=null===(e=o.current)||void 0===e?void 0:e.cancelIntroAnimation)||void 0===i||i.call(e)),r.current=!0,a.current()},[t,n]);const c=s(l);c.current=l,i(()=>()=>{var e;return null===(e=c.current)||void 0===e?void 0:e.call(c)},[])}({hydrated:dn,wasHydratingFromSSR:un,storeRef:Wn,dirtyRef:St,renderFnRef:ln,cleanup:()=>{var e;return null===(e=Gn.current)||void 0===e?void 0:e.clear()}}),i(()=>{St.current=!0,cn()},[O,Zt,Kt,xe,ut,cn]),function(e,t,n,o,r,s){i(()=>{if(!e)return;const i=setInterval(()=>{var i;const a=t.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(i=e.threshold)&&void 0!==i?i:5e3,d=l-a.lastIngestTime>c;d!==r&&(s(d),n.current=!0,o())},1e3);return()=>clearInterval(i)},[e,r,o])}(mt,Wn,St,cn,Hn,Rn);const ro=Dn&&_n?Ve?Ve(_n):e(jo,{hover:_n}):null,so="radial"===R,ao=ro?e(Ln,{x:_n?so?_n.x+Zt/2:_n.x:0,y:_n?so?_n.y+Kt/2:_n.y:0,containerWidth:Zt,containerHeight:Kt,margin:Qt,className:"stream-ordinal-tooltip",children:ro}):null,lo=Pt(M,0,"__semiotic_resolvedO"),co=Pt(_,0,"__semiotic_resolvedR"),uo=lo.key,ho=co.key,go=function(e,t,n){return o=>{if(!o||!n||!e.fn&&!t.fn)return o;let i=!1;const r=o.map(n=>{const o=e.fn&&e.key&&!(e.key in n),r=t.fn&&t.key&&!(t.key in n);if(!o&&!r)return n;i=!0;const s=Object.assign({},n);return o&&(s[e.key]=e.fn(n)),r&&(s[t.key]=t.fn(n)),s});return i?r:o}}(lo,co,Ye&&Ye.length>0||!1);if(Nt||!dn&&un){const n=Wn.current;n&&j&&(n.ingest({inserts:hn,bounded:!0}),n.computeScene({width:Zt,height:Kt}));const i=null!==(d=null==n?void 0:n.scene)&&void 0!==d?d:[],r=null!==(h=null==n?void 0:n.scales)&&void 0!==h?h:null,s="radial"===R,a=s?Qt.left+Zt/2:Qt.left,l=s?Qt.top+Kt/2:Qt.top;return t("div",{ref:It,className:"stream-ordinal-frame"+(dt?" "+dt:""),role:"img","aria-label":wt||("string"==typeof ct?ct:"Ordinal chart"),style:{position:"relative",width:E?"100%":Yt[0],height:W?"100%":Yt[1]},children:[e(xn,{summary:kt}),t("svg",{xmlns:"http://www.w3.org/2000/svg",width:Yt[0],height:Yt[1],style:{position:"absolute",left:0,top:0},children:[Jt&&e("g",{transform:`translate(${Qt.left},${Qt.top})`,children:Jt}),t("g",{transform:`translate(${a},${l})`,children:[ut&&e("rect",{x:0,y:0,width:Zt,height:Kt,fill:ut}),i.map((n,i)=>function(n,i,r){var s,a,l,c,d,u,h,g,f;const p=("category"in n?n.category:void 0)||("group"in n?n.group:void 0)||"",y=e=>`ord-${n.type}-${p}-${i}-${e}`,m=`ord-${n.type}-${p}-${i}`;switch(n.type){case"rect":{const i=n,r=Ft(m)+"-grad",s=function(t,n){const o=t.fillGradient;if(!o)return null;let i=t.x,r=t.y,s=t.x,a=t.y+t.h;"bottom"===t.roundedEdge?(r=t.y+t.h,a=t.y):"right"===t.roundedEdge?(i=t.x+t.w,r=t.y,s=t.x,a=t.y):"left"===t.roundedEdge&&(i=t.x,r=t.y,s=t.x+t.w,a=t.y);const l=[];if("colorStops"in o){const t=o.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>t.length)return null;for(let n=0;t.length>n;n++)l.push(e("stop",{offset:t[n].offset,stopColor:t[n].color},n))}else{const n=Dt(t.style.fill);l.push(e("stop",{offset:0,stopColor:n,stopOpacity:o.topOpacity},"0")),l.push(e("stop",{offset:1,stopColor:n,stopOpacity:o.bottomOpacity},"1"))}return e("linearGradient",{id:n,gradientUnits:"userSpaceOnUse",x1:i,y1:r,x2:s,y2:a,children:l})}(i,r),a=s?`url(#${r})`:Dt(i.style.fill);if(i.cornerRadii&&Tt(i.cornerRadii)){const n=function(e){const{x:t,y:n,w:o,h:i}=e,{tl:r,tr:s,br:a,bl:l}=$t(e);let c=`M${t+r},${n}`;return c+=` L${t+o-s},${n}`,s>0&&(c+=` A${s},${s} 0 0 1 ${t+o},${n+s}`),c+=` L${t+o},${n+i-a}`,a>0&&(c+=` A${a},${a} 0 0 1 ${t+o-a},${n+i}`),c+=` L${t+l},${n+i}`,l>0&&(c+=` A${l},${l} 0 0 1 ${t},${n+i-l}`),c+=` L${t},${n+r}`,r>0&&(c+=` A${r},${r} 0 0 1 ${t+r},${n}`),c+=" Z",c}(i);return t(o.Fragment,{children:[s&&e("defs",{children:s}),e("path",{d:n,fill:a,opacity:i.style.opacity,stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})]},m)}if(i.roundedTop&&i.roundedTop>0){const n=Math.min(i.roundedTop,i.w/2,i.h/2),{x:r,y:l,w:c,h:d}=i;let u;switch(i.roundedEdge){case"right":u=`M${r},${l} L${r+c-n},${l} A${n},${n} 0 0 1 ${r+c},${l+n} L${r+c},${l+d-n} A${n},${n} 0 0 1 ${r+c-n},${l+d} L${r},${l+d} Z`;break;case"left":u=`M${r+c},${l} L${r+n},${l} A${n},${n} 0 0 0 ${r},${l+n} L${r},${l+d-n} A${n},${n} 0 0 0 ${r+n},${l+d} L${r+c},${l+d} Z`;break;case"bottom":u=`M${r},${l} L${r+c},${l} L${r+c},${l+d-n} A${n},${n} 0 0 1 ${r+c-n},${l+d} L${r+n},${l+d} A${n},${n} 0 0 1 ${r},${l+d-n} Z`;break;default:u=`M${r},${l+d} L${r},${l+n} A${n},${n} 0 0 1 ${r+n},${l} L${r+c-n},${l} A${n},${n} 0 0 1 ${r+c},${l+n} L${r+c},${l+d} Z`}return t(o.Fragment,{children:[s&&e("defs",{children:s}),e("path",{d:u,fill:a,opacity:i.style.opacity,stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})]},m)}return t(o.Fragment,{children:[s&&e("defs",{children:s}),e("rect",{x:i.x,y:i.y,width:i.w,height:i.h,fill:a,opacity:i.style.opacity,stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})]},m)}case"point":{const t=n;return e("circle",{cx:t.x,cy:t.y,r:t.r,fill:Dt(t.style.fill),opacity:null!==(s=t.style.opacity)&&void 0!==s?s:.8,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},m)}case"wedge":{const o=n;if(o._gradientBand&&o._gradientBand.colors.length>0){const n=Ft(`${r?r+"-":""}gauge-grad-${o.category||m}-${i}`),{clipPath:s,slices:u}=Ht({innerRadius:o.innerRadius,outerRadius:o.outerRadius,startAngle:o.startAngle,endAngle:o.endAngle,cornerRadius:o.cornerRadius,roundStart:null===(l=null===(a=o.roundedEnds)||void 0===a?void 0:a.start)||void 0===l||l,roundEnd:null===(d=null===(c=o.roundedEnds)||void 0===c?void 0:c.end)||void 0===d||d,colors:o._gradientBand.colors});return t("g",{transform:`translate(${o.cx},${o.cy})`,opacity:o.style.opacity,fillOpacity:o.style.fillOpacity,children:[e("defs",{children:e("clipPath",{id:n,children:e("path",{d:s})})}),e("g",{clipPath:`url(#${n})`,children:u.map((t,n)=>e("path",{d:t.d,fill:Dt(t.color)},n))}),o.style.stroke&&"none"!==o.style.stroke&&e("path",{d:s,fill:"none",stroke:o.style.stroke,strokeWidth:o.style.strokeWidth})]},m)}let s;if(o.roundedEnds)s=Bt({innerRadius:o.innerRadius,outerRadius:o.outerRadius,startAngle:o.startAngle,endAngle:o.endAngle,cornerRadius:o.cornerRadius,roundStart:o.roundedEnds.start,roundEnd:o.roundedEnds.end});else{const e=T().innerRadius(o.innerRadius).outerRadius(o.outerRadius).startAngle(o.startAngle+Math.PI/2).endAngle(o.endAngle+Math.PI/2);o.cornerRadius&&e.cornerRadius(o.cornerRadius),s=e(Rt)||""}return e("path",{d:s,transform:`translate(${o.cx},${o.cy})`,fill:Dt(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},m)}case"boxplot":{const o=n,i=o.columnWidth/2;return t("g","vertical"===o.projection?{children:[e("line",{x1:o.x,y1:o.minPos,x2:o.x,y2:o.maxPos,stroke:o.style.stroke||"#333",strokeWidth:1}),e("rect",{x:o.x-i,y:Math.min(o.q1Pos,o.q3Pos),width:o.columnWidth,height:Math.abs(o.q3Pos-o.q1Pos),fill:Dt(o.style.fill),fillOpacity:null!==(u=o.style.fillOpacity)&&void 0!==u?u:.6,stroke:o.style.stroke||"#333",strokeWidth:1}),e("line",{x1:o.x-i,y1:o.medianPos,x2:o.x+i,y2:o.medianPos,stroke:o.style.stroke||"#333",strokeWidth:2}),e("line",{x1:o.x-.5*i,y1:o.minPos,x2:o.x+.5*i,y2:o.minPos,stroke:o.style.stroke||"#333",strokeWidth:1}),e("line",{x1:o.x-.5*i,y1:o.maxPos,x2:o.x+.5*i,y2:o.maxPos,stroke:o.style.stroke||"#333",strokeWidth:1})]}:{children:[e("line",{x1:o.minPos,y1:o.y,x2:o.maxPos,y2:o.y,stroke:o.style.stroke||"#333",strokeWidth:1}),e("rect",{x:Math.min(o.q1Pos,o.q3Pos),y:o.y-i,width:Math.abs(o.q3Pos-o.q1Pos),height:o.columnWidth,fill:Dt(o.style.fill),fillOpacity:null!==(h=o.style.fillOpacity)&&void 0!==h?h:.6,stroke:o.style.stroke||"#333",strokeWidth:1}),e("line",{x1:o.medianPos,y1:o.y-i,x2:o.medianPos,y2:o.y+i,stroke:o.style.stroke||"#333",strokeWidth:2}),e("line",{x1:o.minPos,y1:o.y-.5*i,x2:o.minPos,y2:o.y+.5*i,stroke:o.style.stroke||"#333",strokeWidth:1}),e("line",{x1:o.maxPos,y1:o.y-.5*i,x2:o.maxPos,y2:o.y+.5*i,stroke:o.style.stroke||"#333",strokeWidth:1})]},m)}case"violin":{const t=n,o=[e("path",{d:t.pathString,transform:t.translateX||t.translateY?`translate(${t.translateX},${t.translateY})`:void 0,fill:Dt(t.style.fill),fillOpacity:null!==(g=t.style.fillOpacity)&&void 0!==g?g:.6,stroke:t.style.stroke||"#333",strokeWidth:t.style.strokeWidth||1},y("path"))];if(t.iqrLine&&t.bounds){const n=t.bounds,i=n.x+n.width/2,r=n.y+n.height/2;n.height>n.width?o.push(e("line",{x1:i,y1:t.iqrLine.q1Pos,x2:i,y2:t.iqrLine.q3Pos,stroke:t.style.stroke||"#333",strokeWidth:2},y("iqr")),e("circle",{cx:i,cy:t.iqrLine.medianPos,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},y("med"))):o.push(e("line",{x1:t.iqrLine.q1Pos,y1:r,x2:t.iqrLine.q3Pos,y2:r,stroke:t.style.stroke||"#333",strokeWidth:2},y("iqr")),e("circle",{cx:t.iqrLine.medianPos,cy:r,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},y("med")))}return e("g",{children:o},m)}case"connector":return e("line",{x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,stroke:n.style.stroke||"#999",strokeWidth:n.style.strokeWidth||1,opacity:null!==(f=n.style.opacity)&&void 0!==f?f:.5},m);case"trapezoid":{const t=n,o=t.points.map(e=>`${e[0]},${e[1]}`).join(" ");return e("polygon",{points:o,fill:Dt(t.style.fill,"#999"),opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},m)}default:return null}}(n,i,sn)).filter(Boolean)]})]}),e(Ct,{width:Zt,height:Kt,totalWidth:Yt[0],totalHeight:Yt[1],margin:Qt,scales:r,showAxes:xe,showCategoryTicks:we,oLabel:gn,rLabel:fn,oFormat:pn,rFormat:yn,rTickValues:Ee,tickLabelEdgeAlign:We,axisExtent:ze,showGrid:Ke,title:ct,legend:Ue,legendHoverBehavior:Je,legendClickBehavior:et,legendHighlightedCategory:tt,legendIsolatedCategories:nt,legendPosition:ot,legendLayout:it,foregroundGraphics:Ae(Ut,null===(g=Wn.current)||void 0===g?void 0:g.customLayoutOverlays),annotations:Ye,autoPlaceAnnotations:Qe,svgAnnotationRules:Ze,annotationFrame:0,xAccessor:uo,yAccessor:ho,annotationData:go(null==n?void 0:n.getData())}),ht&&"radial"===R&&e("div",{style:{position:"absolute",left:Qt.left+Zt/2,top:Qt.top+Kt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:ht})]})}return t("div",{ref:It,className:"stream-ordinal-frame"+(dt?" "+dt:""),role:"group","aria-label":wt||("string"==typeof ct?ct:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:E?"100%":Yt[0],height:W?"100%":Yt[1],overflow:"visible"},onKeyDown:oo,children:[xt&&e(wn,{tableId:sn}),xt&&e(bn,{scene:null!==(y=null===(p=Wn.current)||void 0===p?void 0:p.scene)&&void 0!==y?y:[],chartType:O+" chart",tableId:sn,chartTitle:"string"==typeof ct?ct:void 0}),e(xn,{summary:kt}),e(kn,{hoverPoint:_n}),t("div",{role:"img","aria-label":wt||("string"==typeof ct?ct:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Dn?io:void 0,onMouseLeave:Dn?Jn:void 0,children:[Jt&&e("svg",{style:{position:"absolute",top:0,left:0,width:Yt[0],height:Yt[1],pointerEvents:"none"},children:e("g",{transform:`translate(${Qt.left},${Qt.top})`,children:Jt})}),e(Mt,{width:Zt,height:Kt,totalWidth:Yt[0],totalHeight:Yt[1],margin:Qt,scales:Pn,showAxes:xe,showGrid:Ke,rFormat:yn,rTickValues:Ee,axisExtent:ze}),e("canvas",{ref:mn,"aria-label":rn(null!==(v=null===(m=Wn.current)||void 0===m?void 0:m.scene)&&void 0!==v?v:[],O+" chart"),style:{position:"absolute",top:0,left:0,width:Yt[0],height:Yt[1]}}),e(Ct,{width:Zt,height:Kt,totalWidth:Yt[0],totalHeight:Yt[1],margin:Qt,scales:Pn,showAxes:xe,showCategoryTicks:we,oLabel:gn,rLabel:fn,oFormat:pn,rFormat:yn,rTickValues:Ee,axisExtent:ze,showGrid:Ke,title:ct,legend:Ue,legendHoverBehavior:Je,legendClickBehavior:et,legendHighlightedCategory:tt,legendIsolatedCategories:nt,legendPosition:ot,legendLayout:it,foregroundGraphics:Ae(Ut,null===(b=Wn.current)||void 0===b?void 0:b.customLayoutOverlays),annotations:Ye,autoPlaceAnnotations:Qe,svgAnnotationRules:Ze,annotationFrame:$n,xAccessor:uo,yAccessor:ho,annotationData:go(null===(x=Wn.current)||void 0===x?void 0:x.getData()),underlayRendered:!0}),(vt||bt)&&"radial"!==R&&e(Lt,{width:Zt,height:Kt,totalWidth:Yt[0],totalHeight:Yt[1],margin:Qt,scales:Pn,onBrush:bt||(()=>{})}),ht&&"radial"===R&&e("div",{style:{position:"absolute",left:Qt.left+Zt/2,top:Qt.top+Kt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:ht}),(null==mt?void 0:mt.showBadge)&&e($e,{isStale:Hn,position:mt.badgePosition}),e(On,{active:eo.current>=0,hoverPoint:_n,margin:Qt,size:Yt,shape:null===(w=to.current)||void 0===w?void 0:w.shape,width:null===(k=to.current)||void 0===k?void 0:k.w,height:null===(A=to.current)||void 0===A?void 0:A.h}),ao]})]})});function _o(e){const{title:t,description:n,summary:o,accessibleTable:i,className:r,animate:s,axisExtent:a,autoPlaceAnnotations:l}=e,c={};return t&&(c.title=t),n&&(c.description=n),o&&(c.summary=o),void 0!==i&&(c.accessibleTable=i),r&&(c.className=r),null!=s&&(c.animate=s),void 0!==a&&(c.axisExtent=a),void 0!==l&&(c.autoPlaceAnnotations=l),c}function Co(e){const{linkedHover:t,onObservation:n,onClick:o,hoverHighlight:i,customHoverBehavior:r,customClickBehavior:s,linkedHoverInClickPredicate:a=!0}=e,l={};return(t||n||o||i)&&(l.customHoverBehavior=r),(a?n||o||t:n||o)&&(l.customClickBehavior=s),l}function Po(e){const{tooltip:t,defaultTooltipContent:n}=e;return{tooltipContent:!1===t?()=>null:Pn(t)||n}}Mo.displayName="StreamOrdinalFrame";const Lo=h(null);function To(){return d(Lo)}function $o(e){const t=[];for(const[n,o]of Object.entries(e.fields))if("point"===o.type)t.push(e=>o.values.has(e[n]));else{const[e,i]=o.range;t.push(t=>{const o=t[n];return o>=e&&i>=o})}return e=>t.every(t=>t(e))}function Io(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[Bo,Ho]=Tn(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),i=Io(o,t),r=new Map(i.clauses);return r.set(n.clientId,n),o.set(t,Object.assign(Object.assign({},i),{clauses:r})),{selections:o}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o)return{};const i=new Map(e.selections),r=new Map(o.clauses);return r.delete(n),i.set(t,Object.assign(Object.assign({},o),{clauses:r})),{selections:i}})},setResolution(t,n){e(e=>{const o=new Map(e.selections),i=Io(o,t);return o.set(t,Object.assign(Object.assign({},i),{resolution:n})),{selections:o}})},clearSelection(t){e(e=>{const n=new Map(e.selections),o=n.get(t);return o&&n.set(t,Object.assign(Object.assign({},o),{clauses:new Map})),{selections:n}})}})),[Ro,Do]=Tn(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 Fo={positions:new Map};const No=new Set;function Eo(){for(const e of No)e()}function Wo(e,t){const n=Fo.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(Fo.positions);o.delete(e),Fo={positions:o},Eo()}function zo(e){const t=p(),n=e.clientId||t,{name:o}=e,i=Ho(e=>e.selections.get(o)),s=Ho(e=>e.setClause),a=Ho(e=>e.clearClause),l=r(()=>!!i&&i.clauses.size>0,[i]);return{predicate:r(()=>i&&0!==i.clauses.size?function(e,t){const n=[];for(const[o,i]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push($o(i));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(i,n):()=>!0,[i,n]),isActive:l,selectPoints:u(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};s(o,{clientId:n,type:"point",fields:t})},[n,o,s]),selectInterval:u(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};s(o,{clientId:n,type:"interval",fields:t})},[n,o,s]),clear:u(()=>{a(o,n)},[a,o,n]),clientId:n}}function Go(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}const qo=h(!1),Vo=h(null),Xo="undefined"==typeof window?i:c;function Yo(e){const t=d(Vo),n=p(),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=s([]);(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 r=i.current;Xo(()=>{if(t)return()=>t.unregisterCategories(n)},[t,n]),Xo(()=>{t&&t.registerCategories(n,r)},[t,n,r])}function Qo({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:i,strokeWidth:r,categories:s}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==i&&(n.stroke=i),void 0!==r&&(n.strokeWidth=r),n},type:"fill",items:(s&&s.length>0?s:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((i,r)=>{const s=e.find("function"==typeof t?e=>t(e)===i:e=>e[t]===i),a=s?o(s,t,n):n?n(i):he[r%he.length];return{label:i+"",color:a}}),label:""}]}}function Zo(){return Wn(e=>e.theme)}function Ko(e,t,n){var o;const i=null!==(o=e.xValue)&&void 0!==o?o:null==t?void 0:t[n];if(null==i)return null;const r=Number(i);return Number.isFinite(r)?r:null}function Uo(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 Jo(){var e;const t=Zo(),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 ei(e,t,n){return r(()=>{if(!t||"auto"===t||"function"==typeof t)return e;const o=[...e],i="function"==typeof(r=n)?r:e=>e[r];var r;return o.sort("asc"===t?(e,t)=>i(e)-i(t):(e,t)=>i(t)-i(e))},[e,t,n])}o.createContext(void 0);const ti={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 ni(e,t,n){var o,i,r,s,a,l,c;const d=ti[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!==(i=t.height)&&void 0!==i?i:e&&"primary"!==e||!(null==n?void 0:n.height)?d.height:n.height,showAxes:null!==(r=t.showAxes)&&void 0!==r?r:d.showAxes,showGrid:null!==(s=t.showGrid)&&void 0!==s?s:d.showGrid,enableHover:null!==(a=t.enableHover)&&void 0!==a?a:!!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:oi(d.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:u}}function oi(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 ii(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function ri(e,t){if(!t)return ii(e);try{const n=t(e);return null==n?ii(e):n}catch(t){return ii(e)}}function si(e,t){return"function"==typeof t?t(e):e[t]}function ai({categoryAccessor:n,valueAccessor:o,groupAccessor:i,groupLabel:r,pieData:s=!1,valueFormat:a}){return l=>{var c;const d=s?(null===(c=l.data)||void 0===c?void 0:c[0])||l.data||l:l.data||l,u=si(d,n),h=si(d,o),g=i?si(d,i):void 0;return t("div",{className:"semiotic-tooltip",style:jn,children:[e("div",{style:{fontWeight:"bold"},children:ii(u)}),e("div",{style:{marginTop:4},children:ri(h,a)}),null!=g&&t("div",{style:{marginTop:2,opacity:.8},children:[r||(f=i,"string"==typeof f?f:"value"),": ",ii(g)]})]});var f}}function li({componentName:n,message:o,diagnosticHint:i,width:r,height:s}){return e("div",{role:"alert",style:{width:r,height:Math.max(s,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:t("div",{style:{textAlign:"center",maxWidth:400},children:[e("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:n}),e("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:o}),i&&e("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:i})]})})}class ci 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(li,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}var di;const ui="undefined"!=typeof process&&"production"!==(null===(di=process.env)||void 0===di?void 0:di.NODE_ENV);function hi({componentName:t,width:n,height:o,children:i}){return e(ci,{fallback:i=>e(li,{componentName:t,message:i.message,width:n,height:o}),children:i})}const gi={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"},fi={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function pi(e,t,n,o){if(!ui)return;if(!t||0===t.length)return;if("string"!=typeof o)return;const i=t[0];if(!i||"object"!=typeof i)return;if(o in i)return;const r=Object.keys(i).join(", ");console.warn(`[semiotic] ${e}: ${n} "${o}" not found in data. Available keys: ${r}`)}function yi(e,t){const n=e.length,o=t.length,i=Array(o+1);for(let e=0;o>=e;e++)i[e]=e;for(let r=1;n>=r;r++){let n=i[0];i[0]=r;for(let s=1;o>=s;s++){const o=i[s];i[s]=e[r-1]===t[s-1]?n:1+Math.min(n,i[s],i[s-1]),n=o}}return i[o]}function mi(e,t){var n;if(0===t.length)return null;const o=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(o)||o.includes(e.toLowerCase()))||(null!==(n=function(e,t,n=3){let o,i=n+1;for(const n of t){const t=yi(e.toLowerCase(),n.toLowerCase());i>t&&(i=t,o=n)}return i>n?void 0:o}(e,t,3))&&void 0!==n?n:null)}function vi({componentName:e,data:t,accessors:n,requiredProps:o}){if(o)for(const[t,n]of Object.entries(o))if(null==n)return`${e}: ${t} is required. Provide a field name or function.`;if(null==t)return null;if(!Array.isArray(t)||0===t.length)return e+": No data provided. Pass a non-empty array to the data prop.";if(!Array.isArray(t)&&"object"==typeof t)return e+": data should be an array, but received an object. If this is hierarchical data, use TreeDiagram, Treemap, or CirclePack instead.";if(n){const o=function(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}(t).find(e=>e&&"object"==typeof e);if(o){const t=Object.keys(o);for(const[i,r]of Object.entries(n))if(r&&"string"==typeof r&&!(r in o)){const n=mi(r,t),o=n?` Try ${i}="${n}".`:"";return`${e}: ${i} "${r}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}function bi(t){const{data:n,rawData:o,colorBy:s,colorScheme:l,legendInteraction:c,legendPosition:h,selection:g,linkedHover:f,fallbackFields:y,unwrapData:m=!1,onObservation:v,chartType:b,chartId:x,showLegend:w,userMargin:k,marginDefaults:A,onClick:O,hoverHighlight:S,loading:j,loadingContent:M,emptyContent:_,width:C,height:P}=t,L=void 0===o,T=r(()=>D(n),[n]),[$,I]=a([]),B=u(e=>{I(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[]),H="string"==typeof t.colorBy?t.colorBy:void 0,{activeSelectionHook:R,hoverSelectionHook:F,customHoverBehavior:N,customClickBehavior:E,crosshairSourceId:W}=function({selection:e,linkedHover:t,fallbackFields:n=[],unwrapData:o=!1,onObservation:s,chartType:l,chartId:c,onClick:d,hoverHighlight:h,colorByField:g}){const f=p(),y=function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField,seriesField:e.seriesField}:null}(t,n),m="series"===(null==y?void 0:y.mode)?[y.seriesField||g||n[0]].filter(e=>!!e):(null==y?void 0:y.fields)||n||[],v=zo({name:(null==e?void 0:e.name)||"__unused__"}),b=function(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:i,selectPoints:r,clear:s}=zo({name:t});return{onHover:u(e=>{if(!e)return void s();const t={};for(const o of n){const n=e[o];void 0!==n&&(t[o]=[n])}Object.keys(t).length>0&&r(t)},[n,r,s,t]),predicate:o,isActive:i}}({name:(null==y?void 0:y.name)||"hover",fields:m}),x=Do(e=>e.pushObservation),w=e?{isActive:v.isActive,predicate:v.predicate}:null,[k,A]=a(null),O=g||n[0],S=r(()=>{if(!h||null==k||!O)return null;const e=k,t=O;return{isActive:!0,predicate:n=>{var o;return("string"==typeof n[t]?n[t]:(null!==(o=n[t])&&void 0!==o?o:"")+"")===e}}},[h,k,O]),j=u(e=>{var n,o;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==y?void 0:y.mode)&&y.xField){const n=Ko(e,t,y.xField);null!=n&&function(e,t,n){const o=Fo.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(Fo={positions:new Map(Fo.positions).set(e,{xValue:t,sourceId:n})},Eo())}(y.name||"hover",n,f)}"x-position"!==(null==y?void 0:y.mode)&&b.onHover(t)}else"x-position"===(null==y?void 0:y.mode)&&Wo(y.name||"hover",f),"x-position"!==(null==y?void 0:y.mode)&&b.onHover(null);if(h&&O)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[O];A(null!=n?n+"":null)}else A(null);if(s||x){const t={timestamp:Date.now(),chartType:l||"unknown",chartId:c};if(e){const i=Uo(e),r=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});s&&s(r),x&&x(r)}else{const e=Object.assign(Object.assign({},t),{type:"hover-end"});s&&s(e),x&&x(e)}}},[t,b,y,f,s,l,c,x,h,O]),M=u(e=>{var t,n,o,i;if("x-position"===(null==y?void 0:y.mode)&&y.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=Ko(e,t,y.xField);null!=n&&function(e,t,n){const o=Fo.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(Fo.positions);return t.delete(e),Fo={positions:t},Eo(),!1}Fo={positions:new Map(Fo.positions).set(e,{xValue:t,sourceId:n,locked:!0})},Eo()}(y.name||"hover",n,f)}if(e&&d){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),d(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(s||x){const t={timestamp:Date.now(),chartType:l||"unknown",chartId:c};if(e){const n=Uo(e),r=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});s&&s(r),x&&x(r)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});s&&s(e),x&&x(e)}}},[d,s,x,l,c,y,f]);return i(()=>{if("x-position"!==(null==y?void 0:y.mode))return;const e=y.name||"hover";return()=>{!function(e,t){const n=Fo.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(Fo.positions);o.delete(e),Fo={positions:o},Eo()}(e,f),Wo(e,f)}},[null==y?void 0:y.mode,null==y?void 0:y.name,f]),{activeSelectionHook:w,hoverSelectionHook:S,customHoverBehavior:j,customClickBehavior:M,crosshairSourceId:f}}({selection:g,linkedHover:f,fallbackFields:y,unwrapData:m,onObservation:v,chartType:b,chartId:x,onClick:O,hoverHighlight:S,colorByField:H}),z=function(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===(null==n?void 0:n.mode))return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}(f,W),G=function(e,t,n){const o=To(),i=Jo();return r(()=>{var r;if(!t)return;const s=null!==(r=null!=n?n:i&&i.length>0?i:void 0)&&void 0!==r?r:"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>t(e)+"")));if(o&&Object.keys(o).length>0){const e=pe(n.map(e=>({_cat:e})),"_cat",s);return t=>o[t]||e(t)}return pe(n.map(e=>({_cat:e})),"_cat",s)}if(o&&Object.keys(o).length>0){const n=pe(e,t,s);return e=>o[e]||n(e)}return pe(e,t,s)}if(o&&Object.keys(o).length>0){const e=pe([{_:"a"}],"_",s);return t=>o[t]||e(t)}},[e,t,n,o,i])}(T,s,l),q=r(()=>{if(!s)return[];const e=new Set;for(const t of T){const n="function"==typeof s?s(t):t[s];null!=n&&e.add(n+"")}return Array.from(e)},[T,s]),V=r(()=>L&&$.length>0?$:q,[L,$,q]),X=function(e,t,n){const[o,i]=a(null),[s,l]=a(new Set),c=u(t=>{"highlight"===e&&i(t?t.label:null)},[e]),d=u(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]),h=r(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=o?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===o}:"isolate"===e&&s.size>0?{isActive:!0,predicate:e=>{const o=n?e[n]:"function"==typeof t?t(e):null;return s.has(o)}}:null},[e,t,o,s]);return{highlightedCategory:"highlight"===e?o:null,isolatedCategories:"isolate"===e?s:new Set,onLegendHover:c,onLegendClick:d,legendSelectionHook:h}}(c,s,V),Y=r(()=>F||(X.legendSelectionHook?X.legendSelectionHook:R),[F,X.legendSelectionHook,R]),Q=function(e){const t=Wn(e=>e.theme.colors.selectionOpacity);return r(()=>{var n,o;if(void 0!==e||void 0!==t)return Object.assign(Object.assign({name:null!==(n=null==e?void 0:e.name)&&void 0!==n?n:""},e),{unselectedOpacity:null!==(o=null==e?void 0:e.unselectedOpacity)&&void 0!==o?o:t})},[e,t])}(g),Z=Jo(),K=To(),U=r(()=>{if(G)return G;if(!s||0===V.length)return;const e=Array.isArray(l)&&l.length>0||"string"==typeof l&&l.length>0?l:Z&&Z.length>0?Z:he,t="__streamCat",n=pe(V.map(e=>({[t]:e})),t,e);return e=>(null==K?void 0:K[e])||n(e)||"#999"},[G,s,V,l,Z,K]),{legend:J,margin:ee,legendPosition:te}=function({data:e,colorBy:t,colorScale:n,showLegend:o,legendPosition:i="right",userMargin:s,defaults:a={top:50,bottom:60,left:70,right:40},categories:l}){const c=d(qo),u=null!==d(Vo),h=void 0!==o?o:!c&&!!t,g=!!t&&(h||u),f=r(()=>{if(!g)return[];if(void 0!==l)return l;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)},[l,t,e,g]);Yo(u&&t?f:[]);const p=r(()=>{if(!h||!t)return;const o=Qo({data:e,colorBy:t,colorScale:n,getColor:fe,categories:f});return 0!==o.legendGroups.reduce((e,t)=>e+t.items.length,0)?o:void 0},[h,t,e,n,f]),y=r(()=>{const e="number"==typeof s?{top:s,bottom:s,left:s,right:s}:null!=s?s:{},t=t=>{const n=e[t];return"number"==typeof n?n:a[t]},n={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},o=t=>"number"==typeof e[t];return p&&("right"===i&&!o("right")&&110>n.right?n.right=110:"left"===i&&!o("left")&&110>n.left?n.left=110:"top"===i&&!o("top")&&50>n.top?n.top=50:"bottom"===i&&!o("bottom")&&80>n.bottom&&(n.bottom=80)),n},[a,s,p,i]);return{legend:p,margin:y,legendPosition:i}}({data:T,colorBy:s,colorScale:U,showLegend:w,legendPosition:h,userMargin:k,defaults:A,categories:V}),ne=r(()=>{const e={};return J&&(e.legend=J,e.legendPosition=te),c&&"none"!==c&&(e.legendHoverBehavior=X.onLegendHover,e.legendClickBehavior=X.onLegendClick,e.legendHighlightedCategory=X.highlightedCategory,e.legendIsolatedCategories=X.isolatedCategories),L&&s&&(e.legendCategoryAccessor=s,e.onCategoriesChange=B),e},[J,te,c,X.onLegendHover,X.onLegendClick,X.highlightedCategory,X.isolatedCategories,L,s,B]),oe=Array.isArray(o)?D(o):o,ie=function(t,n,o,i){if(!t)return null;if(!1===i)return null;if(null!=i)return e("div",{style:{width:n,height:o,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:i});const r=Math.min(5,Math.floor(o/40)),s=Math.max(8,Math.floor(o/(3*r))),a=Math.max(6,Math.floor(o/(2.5*r))),l=Math.floor((o-(r*(s+a)-a))/2);return e("div",{style:{width:n,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:r},(t,o)=>e("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},fi),{position:"absolute",top:l+o*(s+a),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:s,opacity:.5+o%2*.2})},o))})}(j,C,P,M),re=ie?null:function(t,n,o,i){return!1===i||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e("div",{style:Object.assign(Object.assign({},gi),{width:n,height:o}),children:i||"No data available"}):null}(oe,C,P,_);return{data:T,colorScale:G,allCategories:V,legendState:X,effectiveSelectionHook:Y,activeSelectionHook:R,customHoverBehavior:N,customClickBehavior:E,legend:J,margin:ee,legendPosition:te,earlyReturn:ie||re||null,legendBehaviorProps:ne,crosshairProps:z,resolvedSelection:Q}}function xi({ref:e,frameRef:t,setup:n}){return f(e,()=>({push:e=>{var n;return null===(n=t.current)||void 0===n?void 0:n.push(e)},pushMany:e=>{var n;return null===(n=t.current)||void 0===n?void 0:n.pushMany(e)},remove:e=>{var n,o;return null!==(o=null===(n=t.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[]},update:(e,n)=>{var o,i;return null!==(i=null===(o=t.current)||void 0===o?void 0:o.update(e,n))&&void 0!==i?i:[]},clear:()=>{var e;return null===(e=t.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,n;return null!==(n=null===(e=t.current)||void 0===e?void 0:e.getData())&&void 0!==n?n:[]},getScales:()=>{var e,n;return null!==(n=null===(e=t.current)||void 0===e?void 0:e.getScales())&&void 0!==n?n:null}}),[t]),{effectiveLegendProps:n.legendBehaviorProps,effectiveMargin:n.margin}}function 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 ki(e){const{colorBy:t,colorScale:n,color:o,themeCategorical:i,colorScheme:s,categoryIndexMap:a,userPieceStyle:l,stroke:c,strokeWidth:d,opacity:u,effectiveSelectionHook:h,resolvedSelection:g,cycleByCategory:f=!1,baseStyleExtras:p,linkStrokeToFill:y=!1}=e,m=r(()=>(e,r)=>{const l="function"==typeof p?p(e,r):p,c=l?Object.assign({},l):{};if(void 0===c.fill)if(t){if(!n)return c;c.fill=fe(e,t,n)}else c.fill=function(e,t,n,o,i){if(e)return e;let r;if(Array.isArray(n))r=n;else if(t&&t.length>0)r=t;else if("string"==typeof n){const e=de[n];Array.isArray(e)&&(r=e)}return r&&0!==r.length?null!=o?(i.has(o)||i.set(o,i.size),r[i.get(o)%r.length]):r[0]:"#007bff"}(o,i,s,f?r:void 0,a);return y&&void 0===c.stroke&&void 0!==c.fill&&(c.stroke=c.fill),c},[t,n,o,i,s,a,f,p,y]),v=r(()=>wi(l?"function"==typeof l?(e,t)=>Object.assign(Object.assign({},m(e,t)),l(e,t)||{}):(e,t)=>Object.assign(Object.assign({},m(e,t)),l):m,{stroke:c,strokeWidth:d,opacity:u}),[m,l,c,d,u]);return r(()=>{return e=v,n=g,(t=null!=h?h:null)?(o,...i)=>{var r;const s=Object.assign({},e(o,...i));if(t.isActive)if(t.predicate(o))(null==n?void 0:n.selectedStyle)&&Object.assign(s,n.selectedStyle);else{const e=null!==(r=null==n?void 0:n.unselectedOpacity)&&void 0!==r?r:.5;s.opacity=e,s.fillOpacity=e,s.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(s,n.unselectedStyle)}return s}:e;var e,t,n},[v,h,g])}function Ai(e){var t;if(!e)return;const n="boolean"==typeof e?{}:"string"==typeof e?{method:e}:e;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({type:"trend",method:null!==(t=n.method)&&void 0!==t?t:"linear"},null!=n.bandwidth&&{bandwidth:n.bandwidth}),null!=n.order&&{order:n.order}),null!=n.color&&{color:n.color}),null!=n.strokeWidth&&{strokeWidth:n.strokeWidth}),null!=n.strokeDasharray&&{strokeDasharray:n.strokeDasharray}),null!=n.label&&{label:n.label})}const Oi=g(function(t,n){const o=ni(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),i=s(null),{data:a,margin:l,className:c,categoryAccessor:d="category",valueAccessor:u="value",orientation:h="vertical",valueFormat:g,colorBy:f,colorScheme:p,sort:y=!1,barPadding:m=40,roundedTop:v,gradientFill:b=!1,baselinePadding:x=!1,tooltip:w,annotations:k,regression:A,valueExtent:O,frameProps:S={},selection:j,linkedHover:M,onObservation:_,onClick:C,hoverHighlight:P,chartId:L,loading:T,loadingContent:$,emptyContent:I,legendInteraction:B,legendPosition:H,color:R,stroke:F,strokeWidth:N,opacity:E,showCategoryTicks:W,categoryFormat:z,dataIdAccessor:G}=t,{width:q,height:V,enableHover:X,showGrid:Y,showLegend:Q,title:Z,description:K,summary:U,accessibleTable:J,categoryLabel:ee,valueLabel:te}=o,ne=r(()=>D(a),[a]),oe=bi({data:ne,rawData:a,colorBy:f,colorScheme:p,legendInteraction:B,legendPosition:H,selection:j,linkedHover:M,fallbackFields:f?["string"==typeof f?f:""]:[],unwrapData:!0,onObservation:_,onClick:C,hoverHighlight:P,chartType:"BarChart",chartId:L,showLegend:Q,userMargin:l,marginDefaults:o.marginDefaults,loading:T,loadingContent:$,emptyContent:I,width:q,height:V}),{effectiveLegendProps:ie,effectiveMargin:re}=xi({ref:n,frameRef:i,setup:oe});pi("BarChart",ne,"categoryAccessor",d),pi("BarChart",ne,"valueAccessor",u);const se=ei(ne,y,u),ae=Jo(),le=r(()=>new Map,[ne]),ce=ki({colorBy:f,colorScale:oe.colorScale,color:R,themeCategorical:ae,colorScheme:p,categoryIndexMap:le,userPieceStyle:null==S?void 0:S.pieceStyle,stroke:F,strokeWidth:N,opacity:E,effectiveSelectionHook:oe.effectiveSelectionHook,resolvedSelection:oe.resolvedSelection}),de=r(()=>ai({categoryAccessor:d,valueAccessor:u,groupAccessor:f&&f!==d?f:void 0,groupLabel:"string"==typeof f?f:"group",valueFormat:g}),[d,u,f,g]);if(oe.earlyReturn)return oe.earlyReturn;const ue=vi({componentName:"BarChart",data:a,accessors:{categoryAccessor:d,valueAccessor:u}});if(ue)return e(li,{componentName:"BarChart",message:ue,width:q,height:V});const he=Ai(A),ge=he?[he,...k||[]]:k,fe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=a&&{data:se}),{oAccessor:d,rAccessor:u,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:ce,size:[q,V],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:re,barPadding:m}),null!=v&&{roundedTop:v}),b&&{gradientFill:!0===b?{topOpacity:.8,bottomOpacity:.05}:b}),G&&{dataIdAccessor:G}),{baselinePadding:x,enableHover:X,showAxes:o.showAxes,oLabel:ee,rLabel:te,rFormat:g}),z&&{oFormat:z}),{showGrid:Y,showCategoryTicks:W,oSort:y}),ie),_o({title:Z,description:K,summary:U,accessibleTable:J,className:c,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),Po({tooltip:w,defaultTooltipContent:de})),Co({linkedHover:M,onObservation:_,onClick:C,hoverHighlight:P,customHoverBehavior:oe.customHoverBehavior,customClickBehavior:oe.customClickBehavior})),ge&&ge.length>0&&{annotations:ge}),O&&{rExtent:O}),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return e(hi,{componentName:"BarChart",width:q,height:V,children:e(Mo,Object.assign({ref:i},fe))})});Oi.displayName="BarChart";const Si=g(function(t,n){const o=ni(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),i=s(null),{data:a,margin:l,className:c,categoryAccessor:d="category",stackBy:u,valueAccessor:h="value",orientation:g="vertical",valueFormat:f,colorBy:p,colorScheme:y,normalize:m=!1,sort:v=!1,barPadding:b=40,roundedTop:x,baselinePadding:w=!1,tooltip:k,annotations:A,valueExtent:O,frameProps:S={},selection:j,linkedHover:M,onObservation:_,onClick:C,hoverHighlight:P,chartId:L,loading:T,loadingContent:$,emptyContent:I,legendInteraction:B,legendPosition:H,color:R,stroke:F,strokeWidth:N,opacity:E,categoryFormat:W}=t,{width:z,height:G,enableHover:q,showGrid:V,showLegend:X,title:Y,description:Q,summary:Z,accessibleTable:K,categoryLabel:U,valueLabel:J}=o,ee=r(()=>D(a),[a]),te=p||u,ne=bi({data:ee,rawData:a,colorBy:te,colorScheme:y,legendInteraction:B,legendPosition:H,selection:j,linkedHover:M,fallbackFields:te?["string"==typeof te?te:""]:[],unwrapData:!0,onObservation:_,onClick:C,hoverHighlight:P,chartType:"StackedBarChart",chartId:L,showLegend:X,userMargin:l,marginDefaults:o.marginDefaults,loading:T,loadingContent:$,emptyContent:I,width:z,height:G}),oe=Jo(),ie=r(()=>new Map,[ee]),re=ki({colorBy:te,colorScale:ne.colorScale,color:R,themeCategorical:oe,colorScheme:y,categoryIndexMap:ie,userPieceStyle:null==S?void 0:S.pieceStyle,stroke:F,strokeWidth:N,opacity:E,effectiveSelectionHook:ne.effectiveSelectionHook,resolvedSelection:ne.resolvedSelection}),se=r(()=>ai({categoryAccessor:u,valueAccessor:h,groupAccessor:d,valueFormat:f}),[u,d,h,f]),ae=vi({componentName:"StackedBarChart",data:a,accessors:{categoryAccessor:d,valueAccessor:h},requiredProps:{stackBy:u}}),{effectiveLegendProps:le,effectiveMargin:ce}=xi({ref:n,frameRef:i,setup:ne});if(ne.earlyReturn)return ne.earlyReturn;const de=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=a&&{data:ee}),{oAccessor:d,rAccessor:h,stackBy:u,normalize:m,oSort:v,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:re,size:[z,G],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ce,barPadding:b}),null!=x&&{roundedTop:x}),{baselinePadding:w,enableHover:q}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:o.showAxes,oLabel:U,rLabel:J,rFormat:f}),W&&{oFormat:W}),{showGrid:V}),le),_o({title:Y,description:Q,summary:Z,accessibleTable:K,className:c,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),Po({tooltip:k,defaultTooltipContent:se})),Co({linkedHover:M,onObservation:_,onClick:C,hoverHighlight:P,customHoverBehavior:ne.customHoverBehavior,customClickBehavior:ne.customClickBehavior})),A&&A.length>0&&{annotations:A}),O&&{rExtent:O}),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return ae?e(li,{componentName:"StackedBarChart",message:ae,width:z,height:G}):e(hi,{componentName:"StackedBarChart",width:z,height:G,children:e(Mo,Object.assign({ref:i},de))})});Si.displayName="StackedBarChart";const ji=g(function(t,n){const o=ni(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),i=s(null),{data:a,margin:l,className:c,categoryAccessor:d="category",groupBy:u,valueAccessor:h="value",orientation:g="vertical",valueFormat:f,colorBy:p,colorScheme:y,sort:m=!1,barPadding:v=60,roundedTop:b,baselinePadding:x=!1,tooltip:w,annotations:k,valueExtent:A,frameProps:O={},selection:S,linkedHover:j,onObservation:M,onClick:_,hoverHighlight:C,chartId:P,loading:L,loadingContent:T,emptyContent:$,legendInteraction:I,legendPosition:B,color:H,stroke:R,strokeWidth:F,opacity:N,categoryFormat:E}=t,{width:W,height:z,enableHover:G,showGrid:q,showLegend:V,title:X,description:Y,summary:Q,accessibleTable:Z,categoryLabel:K,valueLabel:U}=o,J=r(()=>D(a),[a]),ee=p||u,te=bi({data:J,rawData:a,colorBy:ee,colorScheme:y,legendInteraction:I,legendPosition:B,selection:S,linkedHover:j,fallbackFields:ee?["string"==typeof ee?ee:""]:[],unwrapData:!0,onObservation:M,onClick:_,hoverHighlight:C,chartType:"GroupedBarChart",chartId:P,showLegend:V,userMargin:l,marginDefaults:o.marginDefaults,loading:L,loadingContent:T,emptyContent:$,width:W,height:z}),ne=Jo(),oe=r(()=>new Map,[J]),ie=ki({colorBy:ee,colorScale:te.colorScale,color:H,themeCategorical:ne,colorScheme:y,categoryIndexMap:oe,userPieceStyle:O.pieceStyle,stroke:R,strokeWidth:F,opacity:N,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection}),re=r(()=>ai({categoryAccessor:u,valueAccessor:h,groupAccessor:d,valueFormat:f}),[u,d,h,f]),se=vi({componentName:"GroupedBarChart",data:a,accessors:{categoryAccessor:d,valueAccessor:h},requiredProps:{groupBy:u}}),{effectiveLegendProps:ae,effectiveMargin:le}=xi({ref:n,frameRef:i,setup:te});if(te.earlyReturn)return te.earlyReturn;const ce=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"clusterbar"},null!=a&&{data:J}),{oAccessor:d,rAccessor:h,groupBy:u,oSort:m,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:ie,size:[W,z],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:le,barPadding:v}),null!=b&&{roundedTop:b}),{baselinePadding:x,enableHover:G}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:o.showAxes,oLabel:K,rLabel:U,rFormat:f}),E&&{oFormat:E}),{showGrid:q}),ae),_o({title:X,description:Y,summary:Q,accessibleTable:Z,className:c,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),Po({tooltip:w,defaultTooltipContent:re})),Co({linkedHover:j,onObservation:M,onClick:_,hoverHighlight:C,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior})),k&&k.length>0&&{annotations:k}),A&&{rExtent:A}),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return se?e(li,{componentName:"GroupedBarChart",message:se,width:W,height:z}):e(hi,{componentName:"GroupedBarChart",width:W,height:z,children:e(Mo,Object.assign({ref:i},ce))})});function Mi({brushProp:e,onBrushProp:t,linkedBrush:n,valueAccessor:o}){const i=(a="string"==typeof n?n:n?{name:n.name,xField:n.rField}:void 0)?"string"==typeof a?{name:a}:a:null;var a;const l=function(e){const{name:t,xField:n,yField:o}=e,{predicate:i,isActive:s,selectInterval:a,clear:l}=zo({name:t}),c=n&&o?"xyBrush":n?"xBrush":"yBrush",d=u(e=>{if(!e)return void l();const t={};"xyBrush"===c&&function(e){return 2===e.length&&Array.isArray(e[0])&&2===e[0].length&&Array.isArray(e[1])&&2===e[1].length}(e)?(n&&(t[n]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),o&&(t[o]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===c&&Go(e)?n&&(t[n]=[Math.min(...e),Math.max(...e)]):"yBrush"===c&&Go(e)&&o&&(t[o]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&a(t)},[c,n,o,a,l]);return{brushInteraction:r(()=>({brush:c,during:d,end:d}),[c,d]),predicate:i,isActive:s,clear:l}}({name:(null==i?void 0:i.name)||"__unused_ordinal_brush__",xField:(null==i?void 0:i.xField)||("string"==typeof o?o:"value")}),c=s(l.brushInteraction);c.current=l.brushInteraction;const d=u(e=>{if(i){c.current.end(e?e.r:null)}null==t||t(e)},[t,i]),h=!!(e||n||t);return{hasBrush:h,handleBrush:d,brushStreamProps:h?{brush:{dimension:"r"},onBrush:d}:{}}}ji.displayName="GroupedBarChart";const _i=g(function(t,n){const o=ni(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),i=s(null),{data:a,margin:l,className:c,categoryAccessor:d="category",subcategoryAccessor:u,valueAccessor:h="value",orientation:g="horizontal",valueFormat:f,colorBy:p,colorScheme:y,barPadding:m,tooltip:v,annotations:b,brush:x,onBrush:w,linkedBrush:k,frameProps:A={},selection:O,linkedHover:S,onObservation:j,onClick:M,hoverHighlight:_,chartId:C,loading:P,loadingContent:L,emptyContent:T,legendInteraction:$,legendPosition:I,color:B,stroke:H,strokeWidth:R,opacity:F,categoryFormat:N,rTickValues:E,tickLabelEdgeAlign:W,showCategoryTicks:z,gradientFill:G,trackFill:q,roundedTop:V,valueExtent:X}=t,{width:Y,height:Q,enableHover:Z,showGrid:K,showLegend:U,title:J,description:ee,summary:te,accessibleTable:ne,categoryLabel:oe,valueLabel:ie}=o,re=r(()=>D(a),[a]),se=p||u,ae=r(()=>{if(null!=m)return m;if("sparkline"!==t.mode)return 40;const e=new Set(re.map(e=>"function"==typeof d?d(e):e[d])),n=Math.max(1,e.size);return n>1?Math.max(0,Math.min(1,(("horizontal"===g?Q:Y)-2*n)/(n-1))):1},[m,t.mode,re,d,g,Y,Q]),le=bi({data:re,rawData:a,colorBy:se,colorScheme:y,legendInteraction:$,legendPosition:I,selection:O,linkedHover:S,fallbackFields:se?["string"==typeof se?se:""]:[],unwrapData:!0,onObservation:j,onClick:M,hoverHighlight:_,chartType:"SwimlaneChart",chartId:C,showLegend:U,userMargin:l,marginDefaults:o.marginDefaults,loading:P,loadingContent:L,emptyContent:T,width:Y,height:Q}),ce=Mi({brushProp:x,onBrushProp:w,linkedBrush:k,valueAccessor:h}),de=Jo(),ue=r(()=>new Map,[re]),he=ki({colorBy:se,colorScale:le.colorScale,color:B,themeCategorical:de,colorScheme:y,categoryIndexMap:ue,userPieceStyle:null==A?void 0:A.pieceStyle,stroke:H,strokeWidth:R,opacity:F,effectiveSelectionHook:le.effectiveSelectionHook,resolvedSelection:le.resolvedSelection,cycleByCategory:!0}),ge=r(()=>ai({categoryAccessor:u,valueAccessor:h,groupAccessor:d,valueFormat:f}),[u,d,h,f]),fe=vi({componentName:"SwimlaneChart",data:a,accessors:{categoryAccessor:d,valueAccessor:h,subcategoryAccessor:u},requiredProps:{subcategoryAccessor:u}}),{effectiveLegendProps:pe,effectiveMargin:ye}=xi({ref:n,frameRef:i,setup:le});if(le.earlyReturn)return le.earlyReturn;const me=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swimlane"},null!=a&&{data:re}),{oAccessor:d,rAccessor:h,stackBy:u,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:he,size:[Y,Q],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ye,barPadding:ae,enableHover:Z}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:o.showAxes,oLabel:!1===z?void 0:oe,rLabel:ie,rFormat:f}),E&&{rTickValues:E}),null!=W&&{tickLabelEdgeAlign:W}),N&&{oFormat:N}),void 0!==z&&{showCategoryTicks:z}),{showGrid:K}),pe),_o({title:J,description:ee,summary:te,accessibleTable:ne,className:c,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),Po({tooltip:v,defaultTooltipContent:ge})),Co({linkedHover:S,onObservation:j,onClick:M,hoverHighlight:_,customHoverBehavior:le.customHoverBehavior,customClickBehavior:le.customClickBehavior})),b&&b.length>0&&{annotations:b}),G&&{gradientFill:!0===G?{topOpacity:.8,bottomOpacity:.05}:G}),null!=q&&{trackFill:q}),null!=V&&{roundedTop:V}),X&&{rExtent:X}),ce.brushStreamProps),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return fe?e(li,{componentName:"SwimlaneChart",message:fe,width:Y,height:Q}):e(hi,{componentName:"SwimlaneChart",width:Y,height:Q,children:e(Mo,Object.assign({ref:i},me))})});function Ci(e,t){const{variant:n,frameRef:o,overrides:i,deps:r}=t;f(e,()=>{const e=function(e,t){if("xy"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o;return null!==(o=null===(n=e.current)||void 0===n?void 0:n.remove(t))&&void 0!==o?o:[]},update:(t,n)=>{var o,i;return null!==(i=null===(o=e.current)||void 0===o?void 0:o.update(t,n))&&void 0!==i?i:[]},clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getScales())&&void 0!==n?n:null}}}if("network"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o,i,r,s;const a=Array.isArray(t)?t:[t],l=null!==(i=null===(o=null===(n=e.current)||void 0===n?void 0:n.getTopology())||void 0===o?void 0:o.nodes)&&void 0!==i?i:[],c=[];for(const t of a){const n=l.find(e=>e.id===t);n&&c.push(Object.assign(Object.assign({},null!==(r=n.data)&&void 0!==r?r:{}),{id:t})),null===(s=e.current)||void 0===s||s.removeNode(t)}return c},update:(t,n)=>(Array.isArray(t)?t:[t]).flatMap(t=>{var o;const i=null===(o=e.current)||void 0===o?void 0:o.updateNode(t,n);return i?[Object.assign(Object.assign({},i),{id:t})]:[]}),clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n,o,i;return null!==(i=null===(o=null===(n=null===(t=e.current)||void 0===t?void 0:t.getTopology())||void 0===n?void 0:n.nodes)||void 0===o?void 0:o.map(e=>e.data))&&void 0!==i?i:[]}}}if("geo-points"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o;return null!==(o=null===(n=e.current)||void 0===n?void 0:n.removePoint(t))&&void 0!==o?o:[]},update:(t,n)=>{var o,i,r;const s=null!==(i=null===(o=e.current)||void 0===o?void 0:o.removePoint(t))&&void 0!==i?i:[];for(const t of s)null===(r=e.current)||void 0===r||r.push(n(t));return s},clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]}}}const n=t;return{push:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.pushLine(e)},pushMany:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.pushManyLines(e)},remove:e=>{var t,o;return null!==(o=null===(t=n.current)||void 0===t?void 0:t.removeLine(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,i,r;const s=null!==(i=null===(o=n.current)||void 0===o?void 0:o.removeLine(e))&&void 0!==i?i:[];for(const e of s)null===(r=n.current)||void 0===r||r.pushLine(t(e));return s},clear:()=>{var e;return null===(e=n.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=n.current)||void 0===e?void 0:e.getLines())&&void 0!==t?t:[]}}}(n,o);return Object.assign(Object.assign({},e),i)},null!=r?r:[])}_i.displayName="SwimlaneChart";const Pi=g(function(t,n){const o=ni(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),i=s(null);Ci(n,{variant:"xy",frameRef:i});const{data:a,margin:l,className:c,categoryAccessor:d="category",valueAccessor:u="value",orientation:h="vertical",valueFormat:g,colorBy:f,colorScheme:p,sizeBy:y,sizeRange:m=[3,8],pointRadius:v=4,pointOpacity:b=.7,categoryPadding:x=20,tooltip:w,annotations:k,valueExtent:A,brush:O,onBrush:S,linkedBrush:j,frameProps:M={},selection:_,linkedHover:C,onObservation:P,onClick:L,hoverHighlight:T,chartId:$,loading:I,loadingContent:B,emptyContent:H,legendInteraction:R,legendPosition:F,color:N,stroke:E,strokeWidth:W,opacity:z,showCategoryTicks:G,categoryFormat:q}=t,{width:V,height:X,enableHover:Y,showGrid:Q,showLegend:Z,title:K,description:U,summary:J,accessibleTable:ee,categoryLabel:te,valueLabel:ne}=o,oe=r(()=>D(a),[a]),ie=bi({data:oe,rawData:a,colorBy:f,colorScheme:p,legendInteraction:R,legendPosition:F,selection:_,linkedHover:C,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:P,onClick:L,hoverHighlight:T,chartType:"SwarmPlot",chartId:$,showLegend:Z,userMargin:l,marginDefaults:o.marginDefaults,loading:I,loadingContent:B,emptyContent:H,width:V,height:X}),re=Mi({brushProp:O,onBrushProp:S,linkedBrush:j,valueAccessor:u}),se=r(()=>{if(!y)return;const e=oe.map(e=>"function"==typeof y?y(e):e[y]);return[Math.min(...e),Math.max(...e)]},[oe,y]),ae=Jo(),le=r(()=>new Map,[oe]),ce=ki({colorBy:f,colorScale:ie.colorScale,color:N,themeCategorical:ae,colorScheme:p,categoryIndexMap:le,userPieceStyle:null==M?void 0:M.pieceStyle,stroke:E,strokeWidth:W,opacity:z,effectiveSelectionHook:ie.effectiveSelectionHook,resolvedSelection:ie.resolvedSelection,baseStyleExtras:e=>({fillOpacity:b,r:y?ye(e,y,m,se):v})}),de=r(()=>ai({categoryAccessor:d,valueAccessor:u,groupAccessor:f||void 0,valueFormat:g}),[d,u,f,g]);if(ie.earlyReturn)return ie.earlyReturn;const ue=vi({componentName:"SwarmPlot",data:a,accessors:{categoryAccessor:d,valueAccessor:u}});if(ue)return e(li,{componentName:"SwarmPlot",message:ue,width:V,height:X});const he=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swarm"},null!=a&&{data:oe}),{oAccessor:d,rAccessor:u,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:ce,size:[V,X],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ie.margin,barPadding:x,enableHover:Y}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:o.showAxes,oLabel:te,rLabel:ne,rFormat:g}),q&&{oFormat:q}),{showGrid:Q,showCategoryTicks:G}),ie.legendBehaviorProps),_o({title:K,description:U,summary:J,accessibleTable:ee,className:c,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),Po({tooltip:w,defaultTooltipContent:de})),Co({linkedHover:C,onObservation:P,onClick:L,hoverHighlight:T,customHoverBehavior:ie.customHoverBehavior,customClickBehavior:ie.customClickBehavior})),k&&k.length>0&&{annotations:k}),A&&{rExtent:A}),re.brushStreamProps),Object.fromEntries(Object.entries(M).filter(([e])=>"pieceStyle"!==e)));return e(hi,{componentName:"SwarmPlot",width:V,height:X,children:e(Mo,Object.assign({ref:i},he))})});function Li(n){return o=>{var i;const r=o.category||o.data&&(null===(i=o.data[0])||void 0===i?void 0:i.category)||"",s=o.stats||(o.data||o).stats;if(s&&null!=s.median)return t("div",{className:"semiotic-tooltip",style:jn,children:[r&&e("div",{style:{fontWeight:"bold"},children:r+""}),null!=s.n&&t("div",{children:["n = ",s.n]}),null!=s.min&&t("div",{children:["Min: ",s.min.toLocaleString()]}),null!=s.q1&&t("div",{children:["Q1: ",s.q1.toLocaleString()]}),t("div",{children:["Median: ",s.median.toLocaleString()]}),null!=s.q3&&t("div",{children:["Q3: ",s.q3.toLocaleString()]}),null!=s.max&&t("div",{children:["Max: ",s.max.toLocaleString()]}),null!=s.mean&&t("div",{style:{opacity:.8},children:["Mean: ",s.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});if(null==n?void 0:n.valueAccessor){const i=n.valueAccessor,s=(Array.isArray(o.data)?o.data:[]).map(e=>Number("function"==typeof i?i(e):e[i])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),a=s.length,l=a>0?a%2!=0?s[Math.floor(a/2)]:(s[a/2-1]+s[a/2])/2:null;return t("div",{className:"semiotic-tooltip",style:jn,children:[r&&e("div",{style:{fontWeight:"bold"},children:r+""}),a>0&&t("div",{children:["n = ",a]}),null!=l&&t("div",{children:["Median: ",l.toLocaleString()]})]})}return e("div",{className:"semiotic-tooltip",style:jn,children:e("div",{style:{fontWeight:"bold"},children:r+""})})}}Pi.displayName="SwarmPlot";const Ti=g(function(t,n){const o=ni(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),i=s(null);Ci(n,{variant:"xy",frameRef:i});const{data:a,margin:l,className:c,categoryAccessor:d="category",valueAccessor:u="value",orientation:h="vertical",valueFormat:g,colorBy:f,colorScheme:p,showOutliers:y=!0,categoryPadding:m=20,tooltip:v,annotations:b,valueExtent:x,frameProps:w={},selection:k,linkedHover:A,onObservation:O,onClick:S,hoverHighlight:j,chartId:M,loading:_,loadingContent:C,emptyContent:P,legendInteraction:L,legendPosition:T,color:$,stroke:I,strokeWidth:B,opacity:H,showCategoryTicks:R,categoryFormat:F}=t,{width:N,height:E,enableHover:W,showGrid:z,showLegend:G,title:q,description:V,summary:X,accessibleTable:Y,categoryLabel:Q,valueLabel:Z}=o,K=r(()=>D(a),[a]),U=bi({data:K,rawData:a,colorBy:f,colorScheme:p,legendInteraction:L,legendPosition:T,selection:k,linkedHover:A,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:O,onClick:S,hoverHighlight:j,chartType:"BoxPlot",chartId:M,showLegend:G,userMargin:l,marginDefaults:o.marginDefaults,loading:_,loadingContent:C,emptyContent:P,width:N,height:E}),J=Jo(),ee=r(()=>new Map,[K]),te=ki({colorBy:f,colorScale:U.colorScale,color:$,themeCategorical:J,colorScheme:p,categoryIndexMap:ee,userPieceStyle:void 0,stroke:I,strokeWidth:B,opacity:H,effectiveSelectionHook:U.effectiveSelectionHook,resolvedSelection:U.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),ne=r(()=>Li(),[]);if(U.earlyReturn)return U.earlyReturn;const oe=vi({componentName:"BoxPlot",data:a,accessors:{categoryAccessor:d,valueAccessor:u}});if(oe)return e(li,{componentName:"BoxPlot",message:oe,width:N,height:E});const ie=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"boxplot"},null!=a&&{data:K}),{oAccessor:d,rAccessor:u,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:te,showOutliers:y,size:[N,E],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:U.margin,barPadding:m,enableHover:W}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:o.showAxes,oLabel:Q,rLabel:Z,rFormat:g}),F&&{oFormat:F}),{showGrid:z,showCategoryTicks:R}),U.legendBehaviorProps),_o({title:q,description:V,summary:X,accessibleTable:Y,className:c,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),Po({tooltip:v,defaultTooltipContent:ne})),Co({linkedHover:A,onObservation:O,onClick:S,hoverHighlight:j,customHoverBehavior:U.customHoverBehavior,customClickBehavior:U.customClickBehavior})),b&&b.length>0&&{annotations:b}),x&&{rExtent:x}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return e(hi,{componentName:"BoxPlot",width:N,height:E,children:e(Mo,Object.assign({ref:i},ie))})});Ti.displayName="BoxPlot";const $i=e=>{const t=null==e?void 0:e.category;return null==t?"All":t+""},Ii=g(function(n,o){const i=ni(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:"horizontal"}),a=s(null);Ci(o,{variant:"xy",frameRef:a});const{data:l,margin:c,className:d,categoryAccessor:u=$i,valueAccessor:h="value",bins:g=25,relative:f=!1,valueFormat:p,colorBy:y,colorScheme:m,categoryPadding:v=20,tooltip:b,annotations:x,valueExtent:w,brush:k,onBrush:A,linkedBrush:O,frameProps:S={},selection:j,linkedHover:M,onObservation:_,onClick:C,hoverHighlight:P,chartId:L,loading:T,loadingContent:$,emptyContent:I,legendInteraction:B,legendPosition:H,color:R,stroke:F,strokeWidth:N,opacity:E,showCategoryTicks:W,categoryFormat:z}=n,{width:G,height:q,enableHover:V,showGrid:X,showLegend:Y,title:Q,description:Z,summary:K,accessibleTable:U,categoryLabel:J,valueLabel:ee}=i,te=r(()=>D(l),[l]),ne=bi({data:te,rawData:l,colorBy:y,colorScheme:m,legendInteraction:B,legendPosition:H,selection:j,linkedHover:M,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:_,onClick:C,hoverHighlight:P,chartType:"Histogram",chartId:L,showLegend:Y,userMargin:c,marginDefaults:i.marginDefaults,loading:T,loadingContent:$,emptyContent:I,width:G,height:q}),oe=Mi({brushProp:k,onBrushProp:A,linkedBrush:O,valueAccessor:h}),ie=r(()=>{if(0===te.length)return;const e="function"==typeof h?h:e=>e[h];let t=1/0,n=-1/0;for(const o of te){const i=e(o);null!=i&&isFinite(i)&&(t>i&&(t=i),i>n&&(n=i))}return t>n?void 0:[t,n]},[te,h]),re=Jo(),se=r(()=>new Map,[te]),ae=ki({colorBy:y,colorScale:ne.colorScale,color:R,themeCategorical:re,colorScheme:m,categoryIndexMap:se,userPieceStyle:void 0,stroke:F,strokeWidth:N,opacity:E,effectiveSelectionHook:ne.effectiveSelectionHook,resolvedSelection:ne.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),le=r(()=>n=>{const o=n.data||n,i=o.category||n.category||"",r=o.count,s=o.range;return t("div",{className:"semiotic-tooltip",style:jn,children:[i&&e("div",{style:{fontWeight:"bold"},children:i+""}),null!=r&&t("div",{children:["Count: ",r]}),s&&2===s.length&&t("div",{style:{opacity:.8},children:[Number(s[0]).toFixed(1)," – ",Number(s[1]).toFixed(1)]})]})},[]);if(ne.earlyReturn)return ne.earlyReturn;const ce=vi({componentName:"Histogram",data:l,accessors:{categoryAccessor:u,valueAccessor:h}});if(ce)return e(li,{componentName:"Histogram",message:ce,width:G,height:q});const de=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"histogram"},null!=l&&{data:te}),{oAccessor:u,rAccessor:h,projection:"horizontal",summaryStyle:ae,bins:g,normalize:f}),w?{rExtent:w}:ie&&{rExtent:ie}),{size:[G,q],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ne.margin,barPadding:v,enableHover:V}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:J,rLabel:ee,rFormat:p}),z&&{oFormat:z}),{showGrid:X,showCategoryTicks:W}),ne.legendBehaviorProps),_o({title:Q,description:Z,summary:K,accessibleTable:U,className:d,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),Po({tooltip:b,defaultTooltipContent:le})),Co({linkedHover:M,onObservation:_,onClick:C,hoverHighlight:P,customHoverBehavior:ne.customHoverBehavior,customClickBehavior:ne.customClickBehavior})),x&&x.length>0&&{annotations:x}),oe.brushStreamProps),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return e(hi,{componentName:"Histogram",width:G,height:q,children:e(Mo,Object.assign({ref:a},de))})});Ii.displayName="Histogram";const Bi=g(function(t,n){const o=ni(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),i=s(null);Ci(n,{variant:"xy",frameRef:i});const{data:a,margin:l,className:c,categoryAccessor:d="category",valueAccessor:u="value",orientation:h="vertical",bins:g=25,showIQR:f=!0,valueFormat:p,colorBy:y,colorScheme:m,categoryPadding:v=20,tooltip:b,annotations:x,valueExtent:w,brush:k,onBrush:A,linkedBrush:O,frameProps:S={},selection:j,linkedHover:M,onObservation:_,onClick:C,hoverHighlight:P,chartId:L,loading:T,loadingContent:$,emptyContent:I,legendInteraction:B,legendPosition:H,color:R,stroke:F,strokeWidth:N,opacity:E,showCategoryTicks:W,categoryFormat:z}=t,{width:G,height:q,enableHover:V,showGrid:X,showLegend:Y,title:Q,description:Z,summary:K,accessibleTable:U,categoryLabel:J,valueLabel:ee}=o,te=r(()=>D(a),[a]),ne=bi({data:te,rawData:a,colorBy:y,colorScheme:m,legendInteraction:B,legendPosition:H,selection:j,linkedHover:M,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:_,onClick:C,hoverHighlight:P,chartType:"ViolinPlot",chartId:L,showLegend:Y,userMargin:l,marginDefaults:o.marginDefaults,loading:T,loadingContent:$,emptyContent:I,width:G,height:q}),oe=Mi({brushProp:k,onBrushProp:A,linkedBrush:O,valueAccessor:u}),ie=Jo(),re=r(()=>new Map,[te]),se=ki({colorBy:y,colorScale:ne.colorScale,color:R,themeCategorical:ie,colorScheme:m,categoryIndexMap:re,userPieceStyle:void 0,stroke:F,strokeWidth:N,opacity:E,effectiveSelectionHook:ne.effectiveSelectionHook,resolvedSelection:ne.resolvedSelection,baseStyleExtras:{fillOpacity:.6},linkStrokeToFill:!0}),ae=r(()=>Li({valueAccessor:u}),[u]);if(ne.earlyReturn)return ne.earlyReturn;const le=vi({componentName:"ViolinPlot",data:a,accessors:{categoryAccessor:d,valueAccessor:u}});if(le)return e(li,{componentName:"ViolinPlot",message:le,width:G,height:q});const ce=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"violin"},null!=a&&{data:te}),{oAccessor:d,rAccessor:u,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:se,bins:g,showIQR:f,size:[G,q],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ne.margin,barPadding:v,enableHover:V}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:o.showAxes,oLabel:J,rLabel:ee,rFormat:p}),z&&{oFormat:z}),{showGrid:X,showCategoryTicks:W}),ne.legendBehaviorProps),_o({title:Q,description:Z,summary:K,accessibleTable:U,className:c,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),Po({tooltip:b,defaultTooltipContent:ae})),Co({linkedHover:M,onObservation:_,onClick:C,hoverHighlight:P,customHoverBehavior:ne.customHoverBehavior,customClickBehavior:ne.customClickBehavior})),x&&x.length>0&&{annotations:x}),w&&{rExtent:w}),oe.brushStreamProps),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return e(hi,{componentName:"ViolinPlot",width:G,height:q,children:e(Mo,Object.assign({ref:i},ce))})});Bi.displayName="ViolinPlot";const Hi=g(function(t,n){var o;const i=ni(t.mode,{width:t.width,height:t.height,showGrid:null===(o=t.showGrid)||void 0===o||o,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),a=s(null);Ci(n,{variant:"xy",frameRef:a});const{data:l,margin:c,className:d,categoryAccessor:u="category",valueAccessor:h="value",orientation:g="horizontal",valueFormat:f,colorBy:p,colorScheme:y,sort:m="auto",dotRadius:v=5,categoryPadding:b=10,tooltip:x,annotations:w,regression:k,valueExtent:A,frameProps:O={},selection:S,linkedHover:j,onObservation:M,onClick:_,hoverHighlight:C,chartId:P,loading:L,loadingContent:T,emptyContent:$,legendInteraction:I,legendPosition:B,color:H,stroke:R,strokeWidth:F,opacity:N,categoryFormat:E}=t,{width:W,height:z,enableHover:G,showGrid:q,showLegend:V,title:X,description:Y,summary:Q,accessibleTable:Z,categoryLabel:K,valueLabel:U}=i,J=r(()=>D(l),[l]),ee=bi({data:J,rawData:l,colorBy:p,colorScheme:y,legendInteraction:I,legendPosition:B,selection:S,linkedHover:j,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:M,onClick:_,hoverHighlight:C,chartType:"DotPlot",chartId:P,showLegend:V,userMargin:c,marginDefaults:i.marginDefaults,loading:L,loadingContent:T,emptyContent:$,width:W,height:z}),te=ei(J,m,h),ne=Jo(),oe=r(()=>new Map,[J]),ie=ki({colorBy:p,colorScale:ee.colorScale,color:H,themeCategorical:ne,colorScheme:y,categoryIndexMap:oe,userPieceStyle:null==O?void 0:O.pieceStyle,stroke:R,strokeWidth:F,opacity:N,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection,baseStyleExtras:{r:v,fillOpacity:.8}}),re=r(()=>ai({categoryAccessor:u,valueAccessor:h,valueFormat:f}),[u,h,f]);if(ee.earlyReturn)return ee.earlyReturn;const se=vi({componentName:"DotPlot",data:l,accessors:{categoryAccessor:u,valueAccessor:h}});if(se)return e(li,{componentName:"DotPlot",message:se,width:W,height:z});const ae=Ai(k),le=ae?[ae,...w||[]]:w,ce=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"point"},null!=l&&{data:te}),{oAccessor:u,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:ie,size:[W,z],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ee.margin,barPadding:b,enableHover:G}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:i.showAxes,oLabel:K,rLabel:U,rFormat:f}),E&&{oFormat:E}),{showGrid:q,oSort:m}),ee.legendBehaviorProps),_o({title:X,description:Y,summary:Q,accessibleTable:Z,className:d,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),Po({tooltip:x,defaultTooltipContent:re})),Co({linkedHover:j,onObservation:M,onClick:_,hoverHighlight:C,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior})),le&&le.length>0&&{annotations:le}),A&&{rExtent:A}),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return e(hi,{componentName:"DotPlot",width:W,height:z,children:e(Mo,Object.assign({ref:a},ce))})});Hi.displayName="DotPlot";const Ri=g(function(t,n){var o,i;const a=ni(t.mode,{width:null!==(o=t.width)&&void 0!==o?o:400,height:null!==(i=t.height)&&void 0!==i?i:400,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,showCategoryTicks:t.showCategoryTicks}),l=s(null),{data:c,margin:d,className:u,categoryAccessor:h="category",valueAccessor:g="value",colorBy:f,colorScheme:p,startAngle:y=0,cornerRadius:m,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:k,onObservation:A,onClick:O,hoverHighlight:S,chartId:j,loading:M,loadingContent:_,emptyContent:C,legendInteraction:P,legendPosition:L,color:T,stroke:$,strokeWidth:I,opacity:B}=t,{width:H,height:R,enableHover:F,showLegend:N,title:E,description:W,summary:z,accessibleTable:G}=a,q=r(()=>D(c),[c]),V=f||h,X=bi({data:q,rawData:c,colorBy:V,colorScheme:p,legendInteraction:P,legendPosition:L,selection:w,linkedHover:k,fallbackFields:V?["string"==typeof V?V:""]:[],unwrapData:!0,onObservation:A,onClick:O,hoverHighlight:S,chartType:"PieChart",chartId:j,showLegend:N,userMargin:d,marginDefaults:a.marginDefaults,loading:M,loadingContent:_,emptyContent:C,width:H,height:R}),Y=Jo(),Q=r(()=>new Map,[q]),Z=ki({colorBy:V,colorScale:X.colorScale,color:T,themeCategorical:Y,colorScheme:p,categoryIndexMap:Q,userPieceStyle:null==x?void 0:x.pieceStyle,stroke:$,strokeWidth:I,opacity:B,effectiveSelectionHook:X.effectiveSelectionHook,resolvedSelection:X.resolvedSelection,cycleByCategory:!0}),K=r(()=>ai({categoryAccessor:h,valueAccessor:g,groupAccessor:f&&f!==h?f:void 0,groupLabel:"string"==typeof f?f:"group",pieData:!0}),[h,g,f]),U=vi({componentName:"PieChart",data:c,accessors:{categoryAccessor:h,valueAccessor:g}}),{effectiveLegendProps:J,effectiveMargin:ee}=xi({ref:n,frameRef:l,setup:X});if(X.earlyReturn)return X.earlyReturn;const te=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"pie"},null!=c&&{data:q}),{oAccessor:h,rAccessor:g,projection:"radial",pieceStyle:Z,startAngle:y}),null!=m&&{cornerRadius:m}),{size:[H,R],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ee,enableHover:F}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:!1}),J),_o({title:E,description:W,summary:z,accessibleTable:G,className:u,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),Po({tooltip:v,defaultTooltipContent:K})),Co({linkedHover:k,onObservation:A,onClick:O,hoverHighlight:S,customHoverBehavior:X.customHoverBehavior,customClickBehavior:X.customClickBehavior})),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return U?e(li,{componentName:"PieChart",message:U,width:H,height:R}):e(hi,{componentName:"PieChart",width:H,height:R,children:e(Mo,Object.assign({ref:l},te))})});Ri.displayName="PieChart";const Di=g(function(t,n){const o=ni(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,linkedHover:t.linkedHover,showCategoryTicks:t.showCategoryTicks},{width:400,height:400}),i=s(null),{data:a,margin:l,className:c,categoryAccessor:d="category",valueAccessor:u="value",innerRadius:h,centerContent:g,colorBy:f,colorScheme:p,startAngle:y=0,cornerRadius:m,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:k,onObservation:A,onClick:O,hoverHighlight:S,chartId:j,loading:M,loadingContent:_,emptyContent:C,legendInteraction:P,legendPosition:L,color:T,stroke:$,strokeWidth:I,opacity:B}=t,{width:H,height:R,enableHover:F,showLegend:N,title:E,description:W,summary:z,accessibleTable:G}=o,q=r(()=>D(a),[a]),V=f||d,X=bi({data:q,rawData:a,colorBy:V,colorScheme:p,legendInteraction:P,legendPosition:L,selection:w,linkedHover:k,fallbackFields:V?["string"==typeof V?V:""]:[],unwrapData:!0,onObservation:A,onClick:O,hoverHighlight:S,chartType:"DonutChart",chartId:j,showLegend:N,userMargin:l,marginDefaults:o.marginDefaults,loading:M,loadingContent:_,emptyContent:C,width:H,height:R}),Y=null!=h?h:Math.max(2,.15*Math.min(H,R)),Q=Jo(),Z=r(()=>new Map,[q]),K=ki({colorBy:V,colorScale:X.colorScale,color:T,themeCategorical:Q,colorScheme:p,categoryIndexMap:Z,userPieceStyle:null==x?void 0:x.pieceStyle,stroke:$,strokeWidth:I,opacity:B,effectiveSelectionHook:X.effectiveSelectionHook,resolvedSelection:X.resolvedSelection,cycleByCategory:!0}),U=r(()=>ai({categoryAccessor:d,valueAccessor:u,groupAccessor:f&&f!==d?f:void 0,groupLabel:"string"==typeof f?f:"group",pieData:!0}),[d,u,f]),J=vi({componentName:"DonutChart",data:a,accessors:{categoryAccessor:d,valueAccessor:u}}),{effectiveLegendProps:ee,effectiveMargin:te}=xi({ref:n,frameRef:i,setup:X});if(X.earlyReturn)return X.earlyReturn;const ne=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut"},null!=a&&{data:q}),{oAccessor:d,rAccessor:u,projection:"radial",pieceStyle:K,innerRadius:Y,startAngle:y}),null!=m&&{cornerRadius:m}),{centerContent:g,size:[H,R],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:te,enableHover:F}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:!1}),ee),_o({title:E,description:W,summary:z,accessibleTable:G,className:c,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),Po({tooltip:v,defaultTooltipContent:U})),Co({linkedHover:k,onObservation:A,onClick:O,hoverHighlight:S,customHoverBehavior:X.customHoverBehavior,customClickBehavior:X.customClickBehavior})),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return J?e(li,{componentName:"DonutChart",message:J,width:H,height:R}):e(hi,{componentName:"DonutChart",width:H,height:R,children:e(Mo,Object.assign({ref:i},ne))})});function Fi(e=240){const t=360-e,n=180+t/2,o=n*Math.PI/180;return{sweepRad:e*Math.PI/180,gapDeg:t,startAngleDeg:n,startAngleRad:o,offsetRad:-Math.PI/2+o}}function Ni(e){return Math.max(0,Math.min(1,e))}function Ei(e){const t=e.trim();if(t.startsWith("#")){let e=t.slice(1);if(3===e.length&&(e=e.split("").map(e=>e+e).join("")),6===e.length&&/^[0-9a-f]{6}$/i.test(e))return[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16)]}const n=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);if(n){const e=[Number(n[1]),Number(n[2]),Number(n[3])];if(e.every(Number.isFinite))return e}return null}function Wi(e,t,n){const o=e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function zi(e,t){const n=e.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Ni(e.offset),color:e.color})).sort((e,t)=>e.offset-t.offset);if(0===n.length)return"#999999";if(1===n.length)return n[0].color;const o=Ni(t);if(n[0].offset>=o)return n[0].color;if(o>=n[n.length-1].offset)return n[n.length-1].color;for(let e=0;n.length-1>e;e++){const t=n[e],i=n[e+1];if(t.offset>o||o>i.offset)continue;const r=i.offset-t.offset,s=r>0?(o-t.offset)/r:0,a=Ei(t.color),l=Ei(i.color);if(!a||!l)return.5>s?t.color:i.color;const[c,d,u]=a,[h,g,f]=l;return Wi(c+(h-c)*s,d+(g-d)*s,u+(f-u)*s)}return n[n.length-1].color}function Gi(e,t,n){return`${e}-${t}`}Di.displayName="DonutChart";const qi=g(function(n,o){const i=ni(n.mode,{width:n.width,height:n.height,enableHover:n.enableHover,showLegend:!1,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary},{width:300,height:250}),a=s(null),l="context"===n.mode,{compactMode:c}=i,{value:d,min:u=0,max:h=100,thresholds:g,gradientFill:f,color:p,backgroundColor:y="var(--semiotic-grid, #e0e0e0)",arcWidth:m=.3,cornerRadius:v,showNeedle:b=!0,needleColor:x="var(--semiotic-text, #333)",centerContent:w,valueFormat:k,showScaleLabels:A=!c,sweep:O=240,fillZones:S=!0,tooltip:j,annotations:M,frameProps:_={},className:C,stroke:P,strokeWidth:L,opacity:T}=n,{width:$,height:I,title:B,description:H,summary:R,accessibleTable:D}=i,F=f&&"object"==typeof f?f:void 0,N=Math.max(u,Math.min(h,d)),E=h-u||1,W=(N-u)/E,{gaugeData:z,pieceStyle:G,gaugeAnnotations:q}=r(()=>function(e){const{min:t,max:n,value:o,thresholds:i,fillColor:r,backgroundColor:s,fillZones:a,showScaleLabels:l,gradientFill:c,gradientSteps:d=240}=e,u=n-t||1,h=(Math.max(t,Math.min(n,o))-t)/u;let g=i&&i.length>0?[...i].sort((e,t)=>e.value-t.value):[{value:n,color:r||"#007bff"}];g=g.map(e=>Object.assign(Object.assign({},e),{value:Math.max(t,Math.min(n,e.value))})),n>g[g.length-1].value&&g.push({value:n,color:g[g.length-1].color});const f=!!c&&c.colorStops.length>=2,p=[],y=new Map,m=[];if(f){const e=a?h:1,t=Gi("bg",0);if(p.push({category:t,value:1,_zone:"Track",_isFill:!1,_pctStart:0,_pct:1,_roundedEnds:{start:!0,end:!0},_nonInteractive:!0}),y.set(t,{fill:s,opacity:.4}),e>0){const t=Math.max(1,Math.floor(d)),n=Math.max(1,Math.min(t,Math.round(e*t))),o=[];for(let t=0;n>t;t++)o.push(zi(c.colorStops,e*(t+.5)/n));const i=Gi("fill",0);p.push({category:i,value:e,_zone:"Gradient",_isFill:!0,_pctStart:0,_pct:e,_roundedEnds:{start:!0,end:!0},_nonInteractive:!0,_gradientBand:{colors:o}}),y.set(i,{fill:o[0]||s})}}else{let e=t;for(let n=0;g.length>n;n++){const o=g[n],i=(o.value-e)/u,r=(e-t)/u,l=(o.value-t)/u,c=Math.max(0,(a?Math.min(h,l):l)-r),d=a?Math.max(0,i-c):0;if(c>0){const e=Gi("fill",n);p.push({category:e,value:c,_zone:o.label||"Zone "+(n+1),_isFill:!0}),y.set(e,{fill:o.color})}if(d>0){const e=Gi("bg",n);p.push({category:e,value:d,_zone:o.label||"Zone "+(n+1),_isFill:!1}),y.set(e,{fill:s,opacity:.4})}e=o.value}}if(l&&i&&i.length>0)for(const e of i)e.value>t&&n>e.value&&m.push({type:"gauge-label",value:e.value,label:e.label||e.value+""});return{gaugeData:p,pieceStyle:(e,t)=>y.get(t||e.category)||{fill:s},gaugeAnnotations:m}}({min:u,max:h,value:d,thresholds:g,fillColor:p,backgroundColor:y,fillZones:S,showScaleLabels:A,gradientFill:F}),[d,u,h,g,p,y,A,S,F]),V=r(()=>wi(G,{stroke:P,strokeWidth:L,opacity:T}),[G,P,L,T]),{sweepRad:X,startAngleDeg:Y}=Fi(O),Q=function(e=240){const{sweepRad:t,offsetRad:n}=Fi(e),o=[[Math.cos(n),Math.sin(n)],[Math.cos(n+t),Math.sin(n+t)],[0,0]];for(let e=0;2*Math.PI>e;e+=Math.PI/2)((e-n)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)>t+.001||o.push([Math.cos(e),Math.sin(e)]);const i=o.map(e=>e[0]),r=o.map(e=>e[1]),s=Math.min(...i),a=Math.max(...i),l=Math.min(...r),c=Math.max(...r);return{minX:s,maxX:a,minY:l,maxY:c,width:a-s,height:c-l,cx:(s+a)/2,cy:(l+c)/2}}(O),Z=Math.min(10,Math.max(1,Math.min($,I)/12)),K=Q.cx,U=Q.cy,J=Math.max(4,Math.min(($-2*Z)/Q.width,(I-2*Z)/Q.height)-2),ee=Math.max(0,Math.min(J-1.5,J*(1-m))),te=$/2-K*J,ne=I/2-U*J,oe=2*(J+4),ie=r(()=>{if(c&&null==w)return null;if(null!=w)return"function"==typeof w?w(N,u,h):w;const n=k?k(N):Math.round(N)+"";return t("div",{style:{textAlign:"center",lineHeight:1.2},children:[e("div",{style:{fontSize:Math.max(16,.3*J),fontWeight:700,color:"var(--semiotic-text, #333)"},children:n}),A&&t("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"},children:[u," – ",h]})]})},[w,N,u,h,k,A,J,c]),re=r(()=>l&&null==w?{type:"gauge-value",text:k?k(N):Math.round(N)+""}:null,[l,w,N,k]),se=r(()=>{if(!b)return null;const e=-Math.PI/2+Y*Math.PI/180+W*X,t=ee>20?ee-8:J-1;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:x}},[b,W,Y,X,ee,x]),ae=r(()=>(n,o,i)=>{if("gauge-needle"===n.type){const r=(i.width||$)/2,s=(i.height||I)/2,a=Math.max(1,J-ee),l=Math.max(1,Math.min(2.5,.4*a)),c=Math.max(1,Math.min(5,.6*a));return t("g",{transform:`translate(${r},${s})`,children:[e("line",{x1:0,y1:0,x2:n.tipX,y2:n.tipY,stroke:n.color,strokeWidth:l,strokeLinecap:"round"}),e("circle",{cx:0,cy:0,r:c,fill:n.color})]},"gauge-needle-"+o)}if("gauge-label"===n.type){const r=-Math.PI/2+Y*Math.PI/180+(n.value-u)/E*X,s=(i.width||$)/2,a=(i.height||I)/2,l=ee-1,c=J+1,d=Math.cos(r)*l,h=Math.sin(r)*l,g=Math.cos(r)*c,f=Math.sin(r)*c,p=J+10,y=Math.cos(r)*p,m=Math.sin(r)*p,v=((r+Math.PI/2)/(2*Math.PI)*12+12)%12;let b="middle",x="middle";return v>=11||1>v?(b="middle",x="auto"):v>=1&&5>v?(b="start",x="middle"):v>=5&&7>v?(b="middle",x="hanging"):(b="end",x="middle"),t("g",{transform:`translate(${s},${a})`,children:[e("line",{x1:d,y1:h,x2:g,y2:f,stroke:"var(--semiotic-border)",strokeWidth:2,strokeLinecap:"round"}),e("text",{x:y,y:m,textAnchor:b,dominantBaseline:x,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none",fontSize:"var(--semiotic-gauge-label-font-size, 10px)"},children:n.label})]},"gauge-label-"+o)}return"gauge-value"===n.type?e("text",{x:(i.width||$)/2,y:(i.height||I)/2-.2*ee,textAnchor:"middle",dominantBaseline:"middle",fontSize:Math.max(12,Math.min(22,.28*J)),fontWeight:700,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:n.text},"gauge-value-"+o):null},[$,I,u,E,Y,X,ee,J]),le=r(()=>{const e=[...q,...M||[]];return se&&e.push(se),re&&e.push(re),e},[q,M,se,re]),ce=r(()=>n=>{var o;const i=(null===(o=null==n?void 0:n.data)||void 0===o?void 0:o[0])||(null==n?void 0:n.data)||n,r=null==i?void 0:i._isFill;return t("div",{className:"semiotic-tooltip",style:{padding:"6px 10px",background:"var(--semiotic-tooltip-bg, white)",borderRadius:"var(--semiotic-tooltip-radius, 6px)",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0,0,0,0.15))"},children:[e("div",{style:{fontWeight:600},children:(null==i?void 0:i._zone)||""}),e("div",{style:{fontSize:"0.85em",color:"var(--semiotic-text-secondary, #666)"},children:r?"Current: "+Math.round(N):"Remaining"})]})},[N]);if(0===z.length)return e(li,{componentName:"GaugeChart",message:"No data to display",width:$,height:I});const de=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut",data:z,oAccessor:"category",rAccessor:"value",oSort:!1,projection:"radial",pieceStyle:V,innerRadius:ee,startAngle:Y,sweepAngle:O},null!=v&&{cornerRadius:v}),{centerContent:ie,size:[$,I],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:{top:ne-oe/2,bottom:I-ne-oe/2,left:te-oe/2,right:$-te-oe/2},enableHover:i.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===j?()=>null:Pn(j)||ce,svgAnnotationRules:ae}),le.length>0&&{annotations:le}),B&&{title:B}),H&&{description:H}),R&&{summary:R}),void 0!==D&&{accessibleTable:D}),C&&{className:C}),null!=n.animate&&{animate:n.animate}),_);return e(hi,{componentName:"GaugeChart",width:$,height:I,children:e(Mo,Object.assign({ref:a},de))})});qi.displayName="GaugeChart";const Vi=g(function(t,n){const o=ni(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),i=s(null);Ci(n,{variant:"xy",frameRef:i});const{data:a,margin:l,className:c,categoryAccessor:d="category",valueAccessor:u="value",orientation:h="horizontal",bins:g=20,amplitude:f=1.5,valueFormat:p,colorBy:y,colorScheme:m,categoryPadding:v=5,tooltip:b,annotations:x,valueExtent:w,frameProps:k={},selection:A,linkedHover:O,onObservation:S,onClick:j,hoverHighlight:M,chartId:_,loading:C,loadingContent:P,emptyContent:L,legendInteraction:T,legendPosition:$,color:I,stroke:B,strokeWidth:H,opacity:R,showCategoryTicks:F,categoryFormat:N}=t,{width:E,height:W,enableHover:z,showGrid:G,showLegend:q,title:V,description:X,summary:Y,accessibleTable:Q,categoryLabel:Z,valueLabel:K}=o,U=r(()=>D(a),[a]),J=bi({data:U,rawData:a,colorBy:y,colorScheme:m,legendInteraction:T,legendPosition:$,selection:A,linkedHover:O,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:S,onClick:j,hoverHighlight:M,chartType:"RidgelinePlot",chartId:_,showLegend:q,userMargin:l,marginDefaults:o.marginDefaults,loading:C,loadingContent:P,emptyContent:L,width:E,height:W}),ee=Jo(),te=r(()=>new Map,[U]),ne=ki({colorBy:y,colorScale:J.colorScale,color:I,themeCategorical:ee,colorScheme:m,categoryIndexMap:te,userPieceStyle:void 0,stroke:B,strokeWidth:H,opacity:R,effectiveSelectionHook:J.effectiveSelectionHook,resolvedSelection:J.resolvedSelection,baseStyleExtras:{fillOpacity:.5},linkStrokeToFill:!0}),oe=r(()=>Li(),[]);if(J.earlyReturn)return J.earlyReturn;const ie=vi({componentName:"RidgelinePlot",data:a,accessors:{categoryAccessor:d,valueAccessor:u}});if(ie)return e(li,{componentName:"RidgelinePlot",message:ie,width:E,height:W});const re=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"ridgeline"},null!=a&&{data:U}),{oAccessor:d,rAccessor:u,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:ne,bins:g,size:[E,W],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:J.margin,barPadding:v,enableHover:z}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:o.showAxes,oLabel:Z,rLabel:K,rFormat:p}),N&&{oFormat:N}),{showGrid:G,showCategoryTicks:F,oSort:!1,amplitude:f}),J.legendBehaviorProps),_o({title:V,description:X,summary:Y,accessibleTable:Q,className:c,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),Po({tooltip:b,defaultTooltipContent:oe})),Co({linkedHover:O,onObservation:S,onClick:j,hoverHighlight:M,customHoverBehavior:J.customHoverBehavior,customClickBehavior:J.customClickBehavior})),x&&x.length>0&&{annotations:x}),w&&{rExtent:w}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return e(hi,{componentName:"RidgelinePlot",width:E,height:W,children:e(Mo,Object.assign({ref:i},re))})});Vi.displayName="RidgelinePlot";const Xi=g(function(n,o){const i=ni(n.mode,{width:n.width,height:n.height,showGrid:!1,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,showCategoryTicks:!1}),a=s(null);Ci(o,{variant:"xy",frameRef:a});const{data:l,margin:c,className:d,stepAccessor:u="step",valueAccessor:h="value",categoryAccessor:g,colorBy:f,colorScheme:p,orientation:y="horizontal",connectorOpacity:m=.3,showLabels:v=!0,tooltip:b,annotations:x,frameProps:w={},selection:k,linkedHover:A,onObservation:O,onClick:S,hoverHighlight:j,chartId:M,loading:_,loadingContent:C,emptyContent:P,legendInteraction:L,legendPosition:T,color:$,stroke:I,strokeWidth:B,opacity:H,categoryFormat:R}=n,F="vertical"===y,{width:N,height:E,enableHover:W,showLegend:z,title:G,description:q,summary:V,accessibleTable:X}=i,Y=F?{top:G?60:40,right:20,bottom:60,left:60}:{top:G?40:10,right:10,bottom:10,left:10},Q=r(()=>D(l),[l]),Z=f||g,K=!Z,U=bi({data:Q,rawData:l,colorBy:Z,colorScheme:p,legendInteraction:L,legendPosition:T,selection:k,linkedHover:A,fallbackFields:Z?["string"==typeof Z?Z:""]:[],unwrapData:!0,onObservation:O,onClick:S,hoverHighlight:j,chartType:"FunnelChart",chartId:M,showLegend:z,userMargin:c,marginDefaults:Y,loading:_,loadingContent:C,emptyContent:P,width:N,height:E});pi("FunnelChart",Q,"stepAccessor",u),pi("FunnelChart",Q,"valueAccessor",h);const J=Jo(),ee=r(()=>new Map,[Q]),te=r(()=>{if(K)return $||((null==J?void 0:J[0])?J[0]:Array.isArray(p)&&p[0]?p[0]:"#4e79a7")},[K,$,J,p]),ne=ki({colorBy:te?void 0:Z,colorScale:U.colorScale,color:null!=te?te:$,themeCategorical:J,colorScheme:p,categoryIndexMap:ee,userPieceStyle:null==w?void 0:w.pieceStyle,stroke:I,strokeWidth:B,opacity:H,effectiveSelectionHook:U.effectiveSelectionHook,resolvedSelection:U.resolvedSelection}),oe=r(()=>n=>{var o,i,r,s,a,l;const c=(null==n?void 0:n.data)||n,d=(null==c?void 0:c.__funnelStep)||(null==c?void 0:c.__barFunnelStep)||(null==c?void 0:c.step)||"",u=null!==(r=null!==(i=null!==(o=null==c?void 0:c.__funnelValue)&&void 0!==o?o:null==c?void 0:c.__barFunnelValue)&&void 0!==i?i:null==c?void 0:c.value)&&void 0!==r?r:"",h=null!==(s=null==c?void 0:c.__funnelPercent)&&void 0!==s?s:null==c?void 0:c.__barFunnelPercent,g=null!==(a=null==c?void 0:c.__funnelIsFirstStep)&&void 0!==a?a:null==c?void 0:c.__barFunnelIsFirstStep,f=null==c?void 0:c.__barFunnelIsDropoff,p=null!==(l=null==c?void 0:c.__barFunnelCategory)&&void 0!==l?l:null==c?void 0:c.category,y=null==h||g?"":` (${.05>Math.abs(h-Math.round(h))?Math.round(h)+"%":h.toFixed(1)+"%"})`;return t("div",{className:"semiotic-tooltip",style:jn,children:[d&&e("div",{style:{fontWeight:"bold"},children:d+""}),p&&p!==d&&e("div",{style:{marginTop:2,opacity:.8},children:p+""}),f&&e("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7},children:"Dropoff"}),t("div",{style:{marginTop:4},children:[u+"",y]})]})},[]);if(U.earlyReturn)return U.earlyReturn;const ie=vi({componentName:"FunnelChart",data:l,accessors:{stepAccessor:u,valueAccessor:h}});if(ie)return e(li,{componentName:"FunnelChart",message:ie,width:N,height:E});const re=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:F?"bar-funnel":"funnel"},null!=l&&{data:Q}),{oAccessor:u,rAccessor:h}),g&&{stackBy:g}),{projection:F?"vertical":"horizontal",barPadding:F?40:0,pieceStyle:ne,size:[N,E],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:U.margin,enableHover:W}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:F,showCategoryTicks:F}),R&&{oFormat:R}),{showGrid:F}),!F&&{connectorOpacity:m}),{showLabels:v}),U.legendBehaviorProps),G&&{title:G}),q&&{description:q}),V&&{summary:V}),void 0!==X&&{accessibleTable:X}),d&&{className:d}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===b?()=>null:!0===b||null==b?oe:Pn(b)||oe}),(A||O||S||j)&&{customHoverBehavior:U.customHoverBehavior}),(O||S||A)&&{customClickBehavior:U.customClickBehavior}),x&&x.length>0&&{annotations:x}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return e(hi,{componentName:"FunnelChart",width:N,height:E,children:e(Mo,Object.assign({ref:a},re))})});Xi.displayName="FunnelChart";const Yi={RdBu:oe,PiYG:ie,PRGn:re,BrBG:se,RdYlBu:ae,RdYlGn:le,Spectral:ce},Qi="__likert_neutral_neg",Zi="__likert_neutral_pos";function Ki(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function Ui(e,t,n,o,i,r){const s=new Map,a=new Set(t);for(const l of e){const e=n(l);s.has(e)||s.set(e,new Map);const c=s.get(e);if(o){const e=o(l);if(null==e||!Number.isFinite(e))continue;if(!Number.isInteger(e)){"production"!==process.env.NODE_ENV&&console.warn("[LikertChart] Ignoring non-integer Likert score:",e);continue}const n=e-1;if(0>n||n>=t.length)continue;const i=t[n];c.set(i,(c.get(i)||0)+1)}else if(i&&r){const e=i(l),t=r(l);if(!a.has(e))continue;c.set(e,(c.get(e)||0)+(Number.isFinite(t)?t:0))}}const l=[];for(const[e,n]of s){let o=0;for(const e of t)o+=n.get(e)||0;if(0!==o)for(let i=0;t.length>i;i++){const r=t[i],s=n.get(r)||0;l.push({__likertCategory:e,__likertLevel:r,__likertLevelLabel:r,__likertCount:s,__likertPct:s/o*100,__likertLevelIndex:i})}}return l}function Ji(e,t){const n=t.length,o=n%2!=0,i=Math.floor(n/2),r=[];for(const t of e){const e=t.__likertLevelIndex;if(o&&e===i){const e=t.__likertPct/2;r.push(Object.assign(Object.assign({},t),{__likertLevel:Qi,__likertPct:-e})),r.push(Object.assign(Object.assign({},t),{__likertLevel:Zi,__likertPct:e}))}else r.push(i>e?Object.assign(Object.assign({},t),{__likertPct:-t.__likertPct}):t)}return r}function er(e,t){const n=t.length,o=n%2!=0,i=Math.floor(n/2),r=new Map;for(const t of e){const e=r.get(t.__likertCategory)||[];e.push(t),r.set(t.__likertCategory,e)}const s=[];for(const[,e]of r){const t=new Map;let r,a;for(const n of e)n.__likertLevel===Qi?r=n:n.__likertLevel===Zi?a=n:t.set(n.__likertLevelIndex,n);o&&r&&s.push(r);for(let e=i-1;e>=0;e--){const n=t.get(e);n&&s.push(n)}o&&a&&s.push(a);for(let e=o?i+1:i;n>e;e++){const n=t.get(e);n&&s.push(n)}}return s}const tr=["Very Low","Low","Neutral","High","Very High"],nr=new Map,or=g(function(t,n){const i=ni(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel,showCategoryTicks:t.showCategoryTicks,orientation:t.orientation}),l=s(null),{data:c,margin:d,className:h,categoryAccessor:g="question",valueAccessor:p,levelAccessor:y,countAccessor:m="count",levels:v=tr,orientation:b="horizontal",colorScheme:x,barPadding:w=20,tooltip:k,annotations:A,valueExtent:O,frameProps:S={},selection:j,linkedHover:M,onObservation:_,onClick:C,hoverHighlight:P,chartId:L,valueFormat:T,loading:$,loadingContent:I,emptyContent:B,legendInteraction:H,legendPosition:R,categoryFormat:D,stroke:F,strokeWidth:N,opacity:E}=t,{width:W,height:z,enableHover:G,showGrid:q,showLegend:V,title:X,description:Y,summary:Q,accessibleTable:Z,categoryLabel:K,valueLabel:U}=i,J="horizontal"===b,ee=void 0===c,te=!y,ne=function(){var e;const t=Zo();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.diverging)||void 0}(),oe=r(()=>x&&Array.isArray(x)&&x.length>=v.length?x:function(e,t){if(0>=e)return[];if(t){const n=Yi[t];if(n){if(1===e)return[n(.5)];const t=[];for(let o=0;e>o;o++)t.push(n(o/(e-1)));return t}}const n=["#da1e28","#ff8389","#ffb3b8"],o=["#a6c8ff","#4589ff","#0043ce"],i="#a8a8a8";if(1===e)return[i];const r=e%2!=0,s=Math.floor(e/2),a=[];for(let e=0;s>e;e++)a.push(n[Math.min(Math.floor(e*n.length/s),n.length-1)]);r&&a.push(i);for(let e=0;s>e;e++)a.push(o[Math.min(Math.floor(e*o.length/s),o.length-1)]);return a}(v.length,ne),[x,v.length,ne]),ie=r(()=>{const e=new Map;for(let t=0;v.length>t;t++)e.set(v[t],oe[t]||"#888");return e},[v,oe]),{processedData:re,reAggregate:se,accumulatorRef:ae}=function({data:e,levels:t,categoryAccessor:n,valueAccessor:o,levelAccessor:i,countAccessor:a,isDiverging:l,frameRef:c}){const d=!i,h=r(()=>Ki(n,"question"),[n]),g=r(()=>d?Ki(o,"score"):null,[d,o]),f=r(()=>d?null:Ki(i,"level"),[d,i]),p=r(()=>d?null:Ki(a,"count"),[d,a]),y=e||[],m=s([]),v=r(()=>{if(0===y.length)return[];let e=Ui(y,t,h,g,f,p);return l&&(e=Ji(e,t),e=er(e,t)),e},[y,t,h,g,f,p,l]),b=u(e=>{var n;let o=Ui(e,t,h,g,f,p);l&&(o=Ji(o,t),o=er(o,t)),null===(n=c.current)||void 0===n||n.replace(o)},[t,h,g,f,p,l,c]);return{processedData:v,reAggregate:b,accumulatorRef:m}}({data:c,levels:v,categoryAccessor:g,valueAccessor:p,levelAccessor:y,countAccessor:m,isDiverging:J,frameRef:l}),le="__likertLevelLabel",ce=function({isPushMode:e,colorBy:t,colorScheme:n,showLegend:o,legendPosition:i="right"}){const l=s(new Set),c=s([]),[d,h]=a(0),g=To(),f=Jo(),p=u(e=>{const n=e[t];return null!=n?n+"":null},[t]),y=u(n=>{if(!e||!t)return;let o=!1;for(const e of n){if(!e||"object"!=typeof e)continue;const t=p(e);null==t||l.current.has(t)||(l.current.add(t),c.current.push(t),o=!0)}o&&h(e=>e+1)},[e,t,p]),m=u(n=>{if(!e||!t)return;const o=Array.from(new Set(n.map(String))),i=c.current;i.length===o.length&&i.every((e,t)=>e===o[t])||(l.current=new Set(o),c.current=o,h(e=>e+1))},[e,t]),v=u(e=>t=>{y([t]),e(t)},[y]),b=u(e=>t=>{y(t),e(t)},[y]),x=u(()=>{l.current=new Set,c.current=[],h(e=>e+1)},[]);Yo(e&&t?c.current:[]);const w=r(()=>{if(!e||!t||!1===o)return;const i=c.current;if(0===i.length)return;const r=Array.isArray(n)&&n.length>0||"string"==typeof n&&n.length>0?n:f&&f.length>0?f:he,s=t,a=i.map(e=>({[s]:e})),l=pe(a,s,r);return Qo({data:a,colorBy:s,colorScale:e=>(null==g?void 0:g[e])||l(e)||"#999",getColor:fe})},[e,t,o,n,g,f,d]),k=r(()=>{if(w)return"right"===i?{right:110}:"left"===i?{left:110}:"top"===i?{top:50}:"bottom"===i?{bottom:80}:{right:110}},[w,i]);return{wrapPush:v,wrapPushMany:b,resetCategories:x,categories:c.current,categoryDomainProps:e&&t?{legendCategoryAccessor:t,onCategoriesChange:m}:{},streamingLegend:w,streamingMarginAdjust:k}}({isPushMode:ee,colorBy:le,colorScheme:oe,showLegend:V,legendPosition:R}),de=u(ce.wrapPush(e=>{ae.current.push(e),se(ae.current)}),[ce.wrapPush,se,ae]),ue=u(ce.wrapPushMany(e=>{ae.current.push(...e),se(ae.current)}),[ce.wrapPushMany,se,ae]);f(n,()=>({push:de,pushMany:ue,remove:e=>{var t,n;return null!==(n=null===(t=l.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=l.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;ae.current=[],ce.resetCategories(),null===(e=l.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=l.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=l.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[de,ue,ce.resetCategories,ae]);const ge=bi({data:re,rawData:c,colorBy:le,colorScheme:oe,legendInteraction:H,legendPosition:R,selection:j,linkedHover:M,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:_,onClick:C,hoverHighlight:P,chartType:"LikertChart",chartId:L,showLegend:V,userMargin:d,marginDefaults:i.marginDefaults,loading:$,loadingContent:I,emptyContent:B,width:W,height:z}),ye=r(()=>{const e=v.length;return e%2!=0&&ie.get(v[Math.floor(e/2)])||"#888"},[v,ie]),me=ki({colorBy:void 0,colorScale:void 0,color:void 0,themeCategorical:void 0,colorScheme:void 0,categoryIndexMap:nr,userPieceStyle:null==S?void 0:S.pieceStyle,stroke:F,strokeWidth:N,opacity:E,effectiveSelectionHook:ge.effectiveSelectionHook,resolvedSelection:ge.resolvedSelection,baseStyleExtras:e=>{var t,n;const o=e.__likertLevelLabel||(null===(t=e.data)||void 0===t?void 0:t.__likertLevelLabel),i=e.__likertLevel||(null===(n=e.data)||void 0===n?void 0:n.__likertLevel);if(i===Qi||i===Zi)return{fill:ye};const r=o||i;return r&&ie.has(r)?{fill:ie.get(r)}:{fill:"#888"}}}),ve=r(()=>{const e=v.length;return e%2!=0?v[Math.floor(e/2)]:""},[v]),be=r(()=>e=>{const t=e.data||e,n=t.__likertLevel||"Unknown",i=n===Qi||n===Zi?ve:n,r=t.__likertCategory||"",s=Math.abs(t.__likertPct||0),a=n===Qi||n===Zi?2*s:s,l=t.__likertCount||0;return o.createElement("div",{className:"semiotic-tooltip",style:jn},o.createElement("div",{style:{fontWeight:"bold"}},r),o.createElement("div",{style:{marginTop:4}},`${i}: ${a.toFixed(1)}% (n=${l})`))},[ve]),xe=r(()=>{if(!v||2>v.length)return"LikertChart requires `levels` with at least 2 entries.";if(p&&y)return"LikertChart: provide either `valueAccessor` (raw responses) or `levelAccessor` + `countAccessor` (pre-aggregated), not both.";if(y&&!m)return"LikertChart: pre-aggregated mode requires both `levelAccessor` and `countAccessor`.";if(void 0!==c&&0===c.length)return null;const e={categoryAccessor:g};return te?p&&(e.valueAccessor=p):(y&&(e.levelAccessor=y),m&&(e.countAccessor=m)),vi({componentName:"LikertChart",data:c,accessors:e,requiredProps:{levels:v}})},[c,g,p,y,m,v,te]),we=r(()=>[{styleFn:e=>({fill:ie.get(e.label)||"#888"}),items:v.map(e=>({label:e})),label:""}],[v,ie]),ke=r(()=>!1!==V?Object.assign(Object.assign({},ge.legendBehaviorProps),{legend:{legendGroups:we},legendPosition:R||ge.legendPosition||"bottom"}):ge.legendBehaviorProps,[ge.legendBehaviorProps,ge.legendPosition,R,V,we]),Ae=r(()=>{const e=Object.assign({},ge.margin);if(ee&&!1!==V){const t=R||"bottom";"bottom"===t&&80>e.bottom?e.bottom=80:"top"===t&&50>e.top?e.top=50:"right"===t&&110>e.right?e.right=110:"left"===t&&110>e.left&&(e.left=110)}else if(ce.streamingMarginAdjust)for(const[t,n]of Object.entries(ce.streamingMarginAdjust))n>e[t]&&(e[t]=n);return J&&100>e.left&&(e.left=100),e},[ge.margin,ce.streamingMarginAdjust,J,ee,V,R]),Oe=r(()=>T||(J?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[J,T]);if(ge.earlyReturn)return ge.earlyReturn;const Se=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=c&&{data:re}),{oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:J?"horizontal":"vertical",pieceStyle:me,size:[W,z],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:Ae,barPadding:w,enableHover:G}),t.dataIdAccessor&&{dataIdAccessor:t.dataIdAccessor}),{showAxes:i.showAxes,oLabel:K,rLabel:U||(J?void 0:"Percentage"),rFormat:Oe}),D&&{oFormat:D}),{showGrid:q}),ke),X&&{title:X}),Y&&{description:Y}),Q&&{summary:Q}),void 0!==Z&&{accessibleTable:Z}),h&&{className:h}),null!=t.animate&&{animate:t.animate}),void 0!==t.axisExtent&&{axisExtent:t.axisExtent}),void 0!==t.autoPlaceAnnotations&&{autoPlaceAnnotations:t.autoPlaceAnnotations}),{tooltipContent:!1===k?()=>null:!0===k?be:Pn(k)||be}),(M||_||C||P)&&{customHoverBehavior:ge.customHoverBehavior}),(_||C||M)&&{customClickBehavior:ge.customClickBehavior}),A&&A.length>0&&{annotations:A}),O&&{rExtent:O}),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return xe?e(li,{componentName:"LikertChart",message:xe,width:W,height:z}):e(hi,{componentName:"LikertChart",width:W,height:z,children:e(Mo,Object.assign({ref:l},Se))})});or.displayName="LikertChart";const ir=g(function(t,n){const{data:o,layout:i,layoutConfig:a,categoryAccessor:l="category",valueAccessor:c="value",oExtent:d,rExtent:u,projection:h="vertical",margin:g,className:f,colorScheme:p,showAxes:y=!1,annotations:m,onObservation:v,onClick:b,selection:x,linkedHover:w,chartId:k,loading:A,loadingContent:O,emptyContent:S,frameProps:j={}}=t,{frameRef:M,resolved:_,safeData:C,setup:P,earlyReturn:L}=function(e){var t;const n=function(e){const t=s(null);return Ci(e.imperativeRef,{variant:e.imperativeVariant,frameRef:t}),{frameRef:t,resolved:ni(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel}),normalizedMargin:r(()=>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])}}(e),{resolved:o,normalizedMargin:i}=n,a=bi({data:null!==(t=e.data)&&void 0!==t?t:[],rawData:e.data,colorBy:void 0,colorScheme:e.colorScheme,legendInteraction:void 0,selection:e.selection,linkedHover:e.linkedHover,fallbackFields:[],unwrapData:e.unwrapData,onObservation:e.onObservation,onClick:e.onClick,chartType:e.chartTypeLabel,chartId:e.chartId,showLegend:o.showLegend,userMargin:i,marginDefaults:o.marginDefaults,loading:e.loading,loadingContent:e.loadingContent,emptyContent:e.emptyContent,width:o.width,height:o.height});return Object.assign(Object.assign({},n),{safeData:a.data,setup:a,earlyReturn:a.earlyReturn})}({imperativeRef:n,imperativeVariant:"xy",chartTypeLabel:"OrdinalCustomChart",unwrapData:!0,data:o,colorScheme:p,selection:x,linkedHover:w,onObservation:v,onClick:b,chartId:k,loading:A,loadingContent:O,emptyContent:S,margin:g,width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,title:t.title,mode:t.mode});if(L)return L;const{width:T,height:$,enableHover:I,showGrid:B,title:H,description:R,summary:D,accessibleTable:F}=_,N=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"custom"},null!=o&&{data:C}),{customLayout:i,layoutConfig:a,oAccessor:l,rAccessor:c,oExtent:d,rExtent:u,projection:h,colorScheme:p,size:[T,$],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:P.margin,enableHover:I,showAxes:y,showGrid:B,annotations:m}),_o({title:H,description:R,summary:D,accessibleTable:F,className:f,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),Co({linkedHover:w,onObservation:v,onClick:b,hoverHighlight:!1,customHoverBehavior:P.customHoverBehavior,customClickBehavior:P.customClickBehavior})),j);return e(hi,{componentName:"OrdinalCustomChart",width:T,height:$,children:e(Mo,Object.assign({ref:M},N))})});ir.displayName="OrdinalCustomChart";export{Oi as BarChart,Ti as BoxPlot,Di as DonutChart,Hi as DotPlot,Xi as FunnelChart,qi as GaugeChart,ji as GroupedBarChart,Ii as Histogram,or as LikertChart,ir as OrdinalCustomChart,Ri as PieChart,Vi as RidgelinePlot,Si as StackedBarChart,Mo as StreamOrdinalFrame,Pi as SwarmPlot,_i as SwimlaneChart,Bi as ViolinPlot,yo as createHatchPattern};
|
|
2
|
+
import{useRef as e,useState as t,useEffect as o,useMemo as n,useCallback as r,useImperativeHandle as i,forwardRef as a,memo as s}from"react";var l=Object.freeze([]);function c(e){if(!e)return l;let t=!1;for(let o=0;e.length>o;o++){const n=e[o];if(null==n||"object"!=typeof n){t=!0;break}}if(!t)return e;const o=[];for(const t of e)null!=t&&"object"==typeof t&&o.push(t);return o}var u=class{constructor(e,t){this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=e,this.chunkThreshold=t?.chunkThreshold??5e3,this.chunkSize=t?.chunkSize??5e3}updateChunkOptions(e){null!=e.chunkThreshold&&(this.chunkThreshold=e.chunkThreshold),null!=e.chunkSize&&(this.chunkSize=e.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(e){if(e=c(e),this.lastBoundedData===e)return;if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,totalSize:e.length});let t=this.chunkSize;const o=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const n=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,n),bounded:!1}),t=n,this.chunkTimer=e.length>t?requestAnimationFrame(o):0};this.chunkTimer=requestAnimationFrame(o)}setReplacementData(e){if(e=c(e),this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.pushBuffer=[],this.flushScheduled=!1,this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0,preserveCategoryOrder:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,preserveCategoryOrder:!0,totalSize:e.length});let t=this.chunkSize;const o=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const n=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,n),bounded:!1}),t=n,this.chunkTimer=e.length>t?requestAnimationFrame(o):0};this.chunkTimer=requestAnimationFrame(o)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const e=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:e,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(e){null!=e&&"object"==typeof e&&(this.pushBuffer.push(e),this.scheduleFlush())}pushMany(e){if(0===e.length)return;let t=0;for(let o=0;e.length>o;o++){const n=e[o];null!=n&&"object"==typeof n&&(this.pushBuffer.push(n),t++)}0!==t&&this.scheduleFlush()}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}};import{scaleBand as d,scaleLinear as h}from"d3-scale";var f=class{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const o of e){const e=this.push(o);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;return{next:()=>this._size>e?{done:!1,value:this.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let o=0;this._size>o;o++)e(this.buffer[(t+o)%this._capacity],o)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let o=0;this._size>o;o++)e[o]=this.buffer[(t+o)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray();let o=0,n=[];t.length>e&&(o=t.length-e,n=t.slice(0,o)),this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(let e=o;t.length>e;e++)this.push(t[e]);return n}update(e,t){const o=[],n=(this.head-this._size+this._capacity)%this._capacity;for(let r=0;this._size>r;r++){const i=(n+r)%this._capacity,a=this.buffer[i];if(e(a)){let e;e="object"!=typeof a||null===a?a:Array.isArray(a)?[...a]:{...a},o.push(e),this.buffer[i]=t(a)}}return o}remove(e){const t=[],o=[];if(this.forEach(n=>{e(n)?o.push(n):t.push(n)}),0===o.length)return o;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return o}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}},m=class{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(e){Number.isFinite(e)&&(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}evict(e){e!==this._min&&e!==this._max||(this._dirty=!0)}recalculate(e,t){this._min=1/0,this._max=-1/0;for(const o of e){const e=t?t(o):o;Number.isFinite(e)&&(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}this._dirty=!1}clear(){this._min=1/0,this._max=-1/0,this._dirty=!1}get extent(){return[this._min,this._max]}get min(){return this._min}get max(){return this._max}get dirty(){return this._dirty}};function g(e,t,o){const n=e.duration??500,r=o-t;return n>r?1-r/n:0}function p(e,t,o,n){let r=!1;return t>0?(e._pulseIntensity!==t&&(e._pulseIntensity=t,r=!0),e._pulseColor!==o&&(e._pulseColor=o,r=!0),e._pulseGlowRadius!==n&&(e._pulseGlowRadius=n,r=!0),r):(0!==e._pulseIntensity&&(e._pulseIntensity=0,r=!0),void 0!==e._pulseColor&&(e._pulseColor=void 0,r=!0),void 0!==e._pulseGlowRadius&&(e._pulseGlowRadius=void 0,r=!0),r)}function y(e,t,o){return e+(t-e)*o}function b(){return"undefined"!=typeof performance?performance.now():Date.now()}function v(e,t){return e===t}function x(e,t){if("function"==typeof e)return t=>+e(t);const o=e||t;return e=>+e[o]}function w(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}function k(e){return new Set(Array.isArray(e)?e:[e])}import{scaleOrdinal as S}from"d3-scale";function A(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function M(e,t,o){const n=e=>e.toString(16).padStart(2,"0");return`#${n(e)}${n(t)}${n(o)}`}function _(e){const t=e.map(A),o=t.length-1;return e=>{if(0>=e){const[e,o,n]=t[0];return M(e,o,n)}if(e>=1){const[e,n,r]=t[o];return M(e,n,r)}const n=e*o,r=Math.floor(n),i=n-r,[a,s,l]=t[r],[c,u,d]=t[r+1];return M(Math.round(a+(c-a)*i),Math.round(s+(u-s)*i),Math.round(l+(d-l)*i))}}var C=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],P=_(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),L=_(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),R=_(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),I=_(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),T=_(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),$=_(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),B={blues:P,reds:L,greens:R,viridis:_(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),oranges:I,purples:T,greys:$,plasma:_(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),inferno:_(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),magma:_(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),cividis:_(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),turbo:_(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"])},H=_(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),O=_(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),j=_(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),D=_(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),F=_(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),E=_(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),z=_(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]),N={category10:C,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],...B},W=C,G=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],q=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 V(e,t,o){if("function"==typeof t){const n=t(e);return o&&n&&"string"==typeof n&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||q.has(t)}(n)?o(n):n}const n=e?.[t]+"";return o?o(n):W[Math.abs(function(e){let t=0;for(let o=0;e.length>o;o++)t=(t<<5)-t+e.charCodeAt(o),t&=t;return Math.abs(t)}(n))%W.length]}function X(e,t){if(null==t||!Object.prototype.hasOwnProperty.call(e,t))return;const o=e[t];return"string"==typeof o&&o.length>0?o:void 0}function Y(e,t,o="category10"){if(o&&"object"==typeof o&&!Array.isArray(o)){const e=o;return t=>X(e,t)??"#999"}const n=Array.from(new Set(e.map(e=>e?.[t]).filter(e=>null!=e).map(e=>e+""))),r=n.every(e=>!isNaN(Number(e)));if(Array.isArray(o))return S().domain(n).range(o).unknown("#999");const i=N[o]||N.category10;if(r&&"function"==typeof i){let e=-1/0;for(const t of n){const o=Number(t);o>e&&(e=o)}return t=>i(Number(t)/e)}{const e=Array.isArray(i)?i:W;return S().domain(n).range(e).unknown("#999")}}function K(e,t,o=[3,20],n){let r;if(r="function"==typeof t?t(e):e?.[t],!n)return r;const[i,a]=n,[s,l]=o;if(a===i)return(s+l)/2;let c=(r-i)/(a-i);return 0>c?c=0:c>1&&(c=1),s+c*(l-s)}function Z(e,t,o,n,r,i,a){return{type:"rect",x:e,y:t,w:o,h:n,style:r,datum:i,group:a}}import{symbol as Q,symbolCircle as U,symbolCross as J,symbolDiamond as ee,symbolSquare as te,symbolStar as oe,symbolTriangle as ne,symbolWye as re}from"d3-shape";var ie={circle:U,square:te,triangle:ne,diamond:ee,star:oe,cross:J,wye:re},ae=["circle","triangle","diamond","star","square","chevron","cross","wye"];function se(e,t,o){if(o)return o;const n=e??"circle";return"chevron"===n?function(e){const t=1.5*le(e),o=.92*t;return`M0,${-t}L${o},${(.78*t).toFixed(3)}L0,${(.28*t).toFixed(3)}L${-o},${(.78*t).toFixed(3)}Z`}(t):Q(ie[n]??U,Math.max(1,t))()??""}function le(e){return Math.sqrt(Math.max(1,e)/Math.PI)}function ce(e){const t=e.getSymbol;if(!t)return null;const o=e.config.symbolMap,n=new Map;let r=0;return e=>{const i=t(e)+"",a=o?.[i];if(a)return a;let s=n.get(i);return s||(s=ae[r%ae.length],r++,n.set(i,s)),s}}function ue(e,t,o,n,r,i,a){e.push(t?{type:"symbol",x:n,y:r,size:Math.PI*i*i,symbolType:t(o),style:a,datum:o}:{type:"point",x:n,y:r,r:i,style:a,datum:o})}function de(e,t){const{columns:o,config:n,resolvePieceStyle:r}=e,i=[],a=Math.min(t.width,t.height)/2-4,s="donut"===n.chartType?n.innerRadius||60:0,l=-Math.PI/2+(n.startAngle||0)*Math.PI/180,c=null!=n.sweepAngle?n.sweepAngle*Math.PI/180:2*Math.PI,u=null!=n.sweepAngle&&360>n.sweepAngle,d=Object.values(o),h=d.some(e=>{const t=e.pieceData[0];return t&&("number"==typeof t._pct||"number"==typeof t._pctStart||null!=t._roundedEnds)}),f=u&&!h&&d.length>1&&(n.cornerRadius??0)>0;for(let e=0;d.length>e;e++){const t=d[e],o=t.pieceData[0],u="number"==typeof o?._pctStart?o._pctStart:t.pctStart,h=l+u*c,m=l+(u+("number"==typeof o?._pct?o._pct:t.pct))*c,g=r(t.pieceData[0],t.name),p=0===e,y=e===d.length-1,b={type:"wedge",cx:0,cy:0,innerRadius:s,outerRadius:a,startAngle:h,endAngle:m,...n.cornerRadius&&{cornerRadius:n.cornerRadius},style:g,datum:o?._nonInteractive?null:t.pieceData,category:t.name};o?._roundedEnds?b.roundedEnds=o._roundedEnds:f&&(b.roundedEnds={start:p,end:y}),o?._gradientBand&&(b._gradientBand=o._gradientBand),i.push(b)}return i}import{quantile as he}from"d3-array";function fe(e){let t=1/0,o=-1/0;for(const n of e)t>n&&(t=n),n>o&&(o=n);return[t,o]}function me(e,t=-1/0){let o=t;for(const t of e)t>o&&(o=t);return o}function ge(e){const t=e.length,o=e[0],n=e[t-1];return{n:t,min:o,q1:he(e,.25)??o,median:he(e,.5)??(o+n)/2,q3:he(e,.75)??n,max:n,mean:e.reduce((e,t)=>e+t,0)/t}}import{scaleLinear as pe}from"d3-scale";var ye={bar:function(e,t){const{scales:o,columns:n,config:r,getR:i,getStack:a,resolvePieceStyle:s}=e,{r:l,projection:c}=o,u=[],d="vertical"===c,h="horizontal"===c,f=r.normalize,m=[];if(a){const e=new Set;for(const t of Object.values(n))for(const o of t.pieceData){const t=a(o);e.has(t)||(e.add(t),m.push(t))}}else m.push("_default");for(const e of Object.values(n)){const t=new Map;for(const o of e.pieceData){const e=a?a(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const n=t.get(e);n.total+=i(o),n.pieces.push(o)}let o=0;if(f)for(const e of t.values())o+=Math.abs(e.total);let n=0,r=0;for(const i of m){const c=t.get(i);if(!c)continue;let m=c.total;f&&o>0&&(m/=o);const g=s(c.pieces[0],a?i:e.name),p={...c.pieces[0],__aggregateValue:c.total,__pieceCount:c.pieces.length,category:e.name};if(d){const t=l(0>m?r:n+m),o=0>m?l(r+m)-l(r):l(n)-l(n+m);u.push(Z(e.x,t,e.width,Math.abs(o),g,p,i)),0>m?r+=m:n+=m}else if(h){const t=l(0>m?r+m:n),o=0>m?l(r)-l(r+m):l(n+m)-l(n);u.push(Z(t,e.x,Math.abs(o),e.width,g,p,i)),0>m?r+=m:n+=m}}}const g="vertical"===c,p=r.roundedTop&&r.roundedTop>0?Math.max(0,r.roundedTop):0;for(const e of u){if("rect"!==e.type)continue;const t=e.datum?.__aggregateValue??0;e.roundedEdge=g?0>t?"bottom":"top":0>t?"left":"right",r.gradientFill&&(e.fillGradient=r.gradientFill)}if(p>0){const e=new Map;for(const t of u){if("rect"!==t.type)continue;const o=t.datum?.category||"";e.has(o)||e.set(o,[]),e.get(o).push(t)}for(const t of e.values()){if(0===t.length)continue;const e=t.filter(e=>(e.datum?.__aggregateValue??0)>=0),o=t.filter(e=>0>(e.datum?.__aggregateValue??0));e.length>0&&(e.reduce(g?(e,t)=>t.y>e.y?e:t:(e,t)=>e.x+e.w>t.x+t.w?e:t).roundedTop=p),o.length>0&&(o.reduce(g?(e,t)=>e.y+e.h>t.y+t.h?e:t:(e,t)=>t.x>e.x?e:t).roundedTop=p)}}return u},clusterbar:function(e,t){const{scales:o,columns:n,config:r,getR:i,getGroup:a,resolvePieceStyle:s}=e,{r:l,projection:c}=o,u=[],d="vertical"===c,h=[],f=new Set;for(const e of Object.values(n))for(const t of e.pieceData){const e=a?a(t):"_default";f.has(e)||(f.add(e),h.push(e))}const m=h.length||1;for(const e of Object.values(n)){const t=e.width/m,o=.2*t,n=t-o,r=new Map;for(const t of e.pieceData){const e=a?a(t):"_default";r.has(e)||r.set(e,[]),r.get(e).push(t)}for(let a=0;h.length>a;a++){const c=r.get(h[a])||[];for(const r of c){const c=i(r),f=s(r,h[a]);if(d){const i=e.x+a*t+o/2,s=l(0),d=l(c);u.push(Z(i,Math.min(s,d),n,Math.abs(s-d),f,r,h[a]))}else{const i=e.x+a*t+o/2,s=l(0),d=l(c);u.push(Z(Math.min(s,d),i,Math.abs(d-s),n,f,r,h[a]))}}}}const g=r.roundedTop&&r.roundedTop>0?Math.max(0,r.roundedTop):0;for(const e of u){if("rect"!==e.type)continue;if(null==e.datum)continue;const t=i(e.datum);g>0&&(e.roundedTop=g),e.roundedEdge=d?0>t?"bottom":"top":0>t?"left":"right",r.gradientFill&&(e.fillGradient=r.gradientFill)}return u},point:function(e,t){const{scales:o,columns:n,getR:r,multiScales:i,resolvePieceStyle:a}=e,{r:s,projection:l}=o,c=[],u="vertical"===l,d="radial"===l,h=i.length>0,f=ce(e),m=2*Math.PI,g=-Math.PI/2;for(const e of Object.values(n))for(const t of e.pieceData){const o=t.__rIndex??0,n=t.__rValue??r(t),l=h&&i[o]||s,p=a(t,e.name),y=p.r||5;let b,v;if(d){const t=g+(e.pctStart+e.pct/2)*m,o=l(n);b=Math.cos(t)*o,v=Math.sin(t)*o}else u?(b=e.middle,v=l(n)):(b=l(n),v=e.middle);ue(c,f,t,b,v,y,p)}return c},swarm:function(e,t){const{scales:o,columns:n,getR:r,resolvePieceStyle:i}=e,{r:a,projection:s}=o,l=[],c="vertical"===s,u=ce(e);for(const e of Object.values(n)){const t=e.width/2;for(let o=0;e.pieceData.length>o;o++){const n=e.pieceData[o],s=r(n),d=i(n,e.name),h=d.r||4,f=(7919*o%100/100-.5)*t*.8;ue(l,u,n,c?e.middle+f:a(s),c?a(s):e.middle+f,h,d)}}return l},pie:de,donut:de,boxplot:function(e,t){const{scales:o,columns:n,config:r,getR:i,resolveSummaryStyle:a}=e,{r:s,projection:l}=o,c=[],u="vertical"===l,d=!1!==r.showOutliers;for(const t of Object.values(n)){const o=t.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===o.length)continue;const n=o[0],r=o[o.length-1],l=he(o,.25)??n,h=he(o,.5)??(n+r)/2,f=he(o,.75)??r,m=f-l,g=l-1.5*m,p=f+1.5*m,y=o.find(e=>e>=g)??n,b=[...o].reverse().find(e=>p>=e)??r,v=a(t.pieceData[0],t.name),x=[];if(d)for(const e of t.pieceData){const o=i(e);if(g>o||o>p){const n=u?t.middle:s(o),r=u?s(o):t.middle;x.push({px:n,py:r,value:o,datum:e})}}if(c.push({type:"boxplot",x:u?t.middle:0,y:u?0:t.middle,projection:u?"vertical":"horizontal",columnWidth:.6*t.width,minPos:s(y),q1Pos:s(l),medianPos:s(h),q3Pos:s(f),maxPos:s(b),stats:{n:o.length,min:y,q1:l,median:h,q3:f,max:b,mean:o.reduce((e,t)=>e+t,0)/o.length},style:v,datum:t.pieceData,category:t.name,outliers:x}),d)for(const t of x)c.push({type:"point",x:t.px,y:t.py,r:3,style:{fill:v.fill||e.config.themeSemantic?.secondary||"#999",opacity:.6},datum:t.datum})}return c},violin:function(e,t){const{scales:o,columns:n,config:r,getR:i,resolveSummaryStyle:a}=e,{r:s,projection:l}=o,c=[],u="vertical"===l,d=r.bins||20,h=!1!==r.showIQR;for(const e of Object.values(n)){const t=e.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const o=t[0],n=t[t.length-1],r=(n-o)/d||1,l=Array(d).fill(0);for(const e of t)l[Math.min(Math.floor((e-o)/r),d-1)]++;const f=me(l,1),m=e.width/2*.9;let g;if(u){g=`M ${e.middle} ${s(o)}`;for(let t=0;d>t;t++){const n=s(o+(t+.5)*r);g+=` L ${e.middle+l[t]/f*m} ${n}`}g+=` L ${e.middle} ${s(n)}`;for(let t=d-1;t>=0;t--){const n=s(o+(t+.5)*r);g+=` L ${e.middle-l[t]/f*m} ${n}`}g+=" Z"}else{g=`M ${s(o)} ${e.middle}`;for(let t=0;d>t;t++)g+=` L ${s(o+(t+.5)*r)} ${e.middle-l[t]/f*m}`;g+=` L ${s(n)} ${e.middle}`;for(let t=d-1;t>=0;t--)g+=` L ${s(o+(t+.5)*r)} ${e.middle+l[t]/f*m}`;g+=" Z"}const p=a(e.pieceData[0],e.name);let y;if(h&&t.length>=4){const r=he(t,.25)??o,i=he(t,.5)??(o+n)/2,a=he(t,.75)??n;y={q1Pos:s(r),medianPos:s(i),q3Pos:s(a),centerPos:e.middle,isVertical:u}}const b=u?{x:e.x,y:Math.min(s(n),s(o)),width:e.width,height:Math.abs(s(n)-s(o))}:{x:Math.min(s(o),s(n)),y:e.x,width:Math.abs(s(n)-s(o)),height:e.width};c.push({type:"violin",pathString:g,translateX:0,translateY:0,bounds:b,iqrLine:y,stats:ge(t),style:p,datum:e.pieceData,category:e.name})}return c},histogram:function(e,t){const{scales:o,columns:n,config:r,getR:i,resolveSummaryStyle:a}=e,{r:s}=o,l=[],c=r.bins||25,u=r.normalize,d=s.domain?.(),h=d?+d[0]:void 0,f=d?+d[1]:void 0;for(const e of Object.values(n)){const t=e.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const[o,n]=fe(t),r=null!=h&&isFinite(h)?h:o,d=null!=f&&isFinite(f)?f:n,m=(d-r)/c||1,g=Array(c).fill(0);for(const e of t)r>e||e>d||g[Math.min(Math.floor((e-r)/m),c-1)]++;const p=t.length,y=me(g,1),b=a(e.pieceData[0],e.name);for(let t=0;c>t;t++){if(0===g[t])continue;const o=(u?g[t]/p:g[t]/y)*e.width*.9,n=s(r+t*m),i=s(r+(t+1)*m);l.push(Z(Math.min(n,i),e.x+e.width-o,Math.abs(i-n),o,b,{bin:t,count:g[t],range:[r+t*m,r+(t+1)*m],category:e.name},e.name))}}return l},ridgeline:function(e,t){const{scales:o,columns:n,config:r,getR:i,resolveSummaryStyle:a}=e,{r:s,projection:l}=o,c=[],u=r.bins||20,d="horizontal"===l,h=r.amplitude||1.5;for(const e of Object.values(n)){const t=e.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const o=t[0],n=t[t.length-1],r=(n-o)/u||1,l=Array(u).fill(0);for(const e of t)o>e||e>n||l[Math.min(Math.floor((e-o)/r),u-1)]++;const f=me(l,1),m=a(e.pieceData[0],e.name),g=e.width*h;let p;if(d){const t=e.x+e.width;p=`M ${s(o)} ${t}`;for(let e=0;u>e;e++)p+=` L ${s(o+(e+.5)*r)} ${t-l[e]/f*g}`;p+=` L ${s(n)} ${t} Z`}else{const t=e.x;p=`M ${t} ${s(o)}`;for(let e=0;u>e;e++){const n=s(o+(e+.5)*r);p+=` L ${t+l[e]/f*g} ${n}`}p+=` L ${t} ${s(n)} Z`}const y=d?{x:Math.min(s(o),s(n)),y:e.x,width:Math.abs(s(n)-s(o)),height:e.width}:{x:e.x,y:Math.min(s(n),s(o)),width:e.width,height:Math.abs(s(n)-s(o))};c.push({type:"violin",pathString:p,translateX:0,translateY:0,bounds:y,stats:ge(t),style:{...m,fillOpacity:m.fillOpacity??.5},datum:e.pieceData,category:e.name})}return c},timeline:function(e,t){const{scales:o,columns:n,getRawRange:r,resolvePieceStyle:i}=e,{r:a,projection:s}=o,l=[],c="horizontal"===s;for(const e of Object.values(n))for(const t of e.pieceData){const o=r(t);if(!o)continue;const[n,s]=o,u=i(t,e.name);if(c){const o=a(Math.min(n,s)),r=a(Math.max(n,s));l.push(Z(o,e.x,r-o,e.width,u,t,e.name))}else{const o=a(Math.max(n,s)),r=a(Math.min(n,s));l.push(Z(e.x,o,e.width,r-o,u,t,e.name))}}return l},funnel:function(e,t){const{columns:o,getR:n,getStack:r,resolvePieceStyle:i}=e,a=[],s=t.width/2,l=!1!==e.config.showLabels,c=e.scales.o.domain().map(e=>o[e]).filter(Boolean);if(0===c.length)return a;const u=[],d=new Set;for(const e of c)for(const t of e.pieceData){const e=r?r(t):"_default";d.has(e)||(d.add(e),u.push(e))}const h=u.length>1&&"_default"!==u[0],f=[];let m=0;for(const e of c){const t=new Map;let o=0;for(const i of e.pieceData){const e=r?r(i):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const a=t.get(e),s=n(i);a.total+=s,a.pieces.push(i),o+=s}f.push({col:e,groups:t,stepTotal:o}),h||o>m&&(m=o)}if(h)for(const e of f){let t=0,o=0;for(let n=0;u.length>n;n++){const r=e.groups.get(u[n]);r&&(n%2==0?t+=r.total:o+=r.total)}const n=Math.max(t,o);n>m&&(m=n)}if(0===m)return a;const g=new Map;for(const e of u){const t=f[0].groups.get(e);g.set(e,t?.total??0)}const p=f[0].stepTotal,y=h?.95*s:.9*t.width,b=pe().domain([0,m]).range([0,y]),v=e.config.connectorOpacity??.3;let x=new Map;for(let t=0;f.length>t;t++){const o=f[t],n=o.col,r=0===t,c=n.width,d=.55*c,m=n.x+(c-d)/2,y=new Map;if(h){let e=0;for(const t of u){const n=o.groups.get(t);n&&(e+=b(n.total))}let t=s,c=s;for(let h=0;u.length>h;h++){const f=u[h],p=o.groups.get(f);if(!p)continue;const v=b(p.total),x=h%2==0,w=x?t:c-v;x?t+=v:c-=v;const k=i(p.pieces[0],f),S=g.get(f)??p.total,A={...p.pieces[0],__funnelValue:p.total,__funnelPercent:S>0?p.total/S*100:0,__funnelStep:n.name,__funnelIsFirstStep:r,__aggregateValue:p.total,__pieceCount:p.pieces.length,category:f};l&&(0===h&&(A.__funnelStepLabel=n.name,A.__funnelStepLabelX=s,A.__funnelStepLabelY=m,A.__funnelRowWidth=e),A.__funnelValueLabelX=w+v/2,A.__funnelValueLabelY=m,A.__funnelBarW=v),a.push(Z(w,m,v,d,k,A,f)),y.set(f,{x:w,y:m,w:v,h:d})}}else{const e=o.stepTotal,t=b(e),c=s-t/2,h=u[0],f="_default"!==h,g=o.groups.get(h)?.pieces[0]??n.pieceData[0],v=f?h:n.name,x=i(g,v),w=p>0?e/p*100:0,k={...g,__funnelValue:e,__funnelPercent:w,__funnelStep:n.name,__funnelIsFirstStep:r,category:f?h:n.name};l&&(k.__funnelStepLabel=n.name,k.__funnelStepLabelX=s,k.__funnelStepLabelY=m,k.__funnelRowWidth=t,k.__funnelValueLabelX=s,k.__funnelValueLabelY=m,k.__funnelBarW=t),a.push(Z(c,m,t,d,x,k,v)),y.set(h,{x:c,y:m,w:t,h:d})}if(t>0&&x.size>0){const t=h?u:[u[0]];for(const r of t){const t=x.get(r),s=y.get(r);if(!t||!s)continue;const l=(()=>{const e=o.groups.get(r);return i(e?e.pieces[0]:n.pieceData[0],"_default"===r?n.name:r)})(),c={type:"trapezoid",points:[[t.x,t.y+t.h],[t.x+t.w,t.y+t.h],[s.x+s.w,s.y],[s.x,s.y]],style:{fill:l.fill||e.config.themeSemantic?.secondary||"#999",opacity:v},datum:o.groups.get(r)?.pieces[0]??n.pieceData[0],category:"_default"===r?n.name:r};a.push(c)}}x=y}return a},"bar-funnel":function(e,t){const{columns:o,getR:n,getStack:r,resolvePieceStyle:i,scales:a}=e,s=[],l=a.o.domain().map(e=>o[e]).filter(Boolean);if(0===l.length)return s;const c=[],u=new Set;for(const e of l)for(const t of e.pieceData){const e=r?r(t):"_default";u.has(e)||(u.add(e),c.push(e))}const d=c.length>1&&"_default"!==c[0],h=[];for(const e of l){const t=new Map;let o=0;for(const i of e.pieceData){const e=r?r(i):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const a=t.get(e),s=n(i);a.total+=s,a.pieces.push(i),o+=s}h.push({col:e,groups:t,stepTotal:o})}const f=new Map;for(const e of c){const t=h[0]?.groups.get(e);f.set(e,t?.total??0)}const m=a.r,g=d?c.length:1,p=d?.15:0;for(let e=0;h.length>e;e++){const t=h[e],o=t.col,n=0===e,r=e>0?h[e-1]:null,a=o.width/g,l=a*p,u=a-l;for(let e=0;c.length>e;e++){const h=c[e],g=t.groups.get(h);if(!g)continue;const p=g.total,y=f.get(h)??p,b=y>0?p/y*100:0,v=r?.groups.get(h),x=n?0:Math.max(0,(v?.total??p)-p),w=o.x+e*a+l/2,k=m(p),S=m(0)-k,A=i(g.pieces[0],d?h:o.name),M={...g.pieces[0],__barFunnelValue:p,__barFunnelPercent:b,__barFunnelIsFirstStep:n,__barFunnelIsDropoff:!1,__barFunnelStep:o.name,__barFunnelDropoffValue:x,__barFunnelCategory:"_default"===h?void 0:h,category:d?h:o.name,__barFunnelLabelX:w+u/2,__barFunnelLabelY:m(p+x)};if(s.push(Z(w,k,u,S,A,M,d?h:o.name)),x>0){const e=m(p+x),t=k-e,n={...A},r={...g.pieces[0],__barFunnelValue:x,__barFunnelPercent:y>0?x/y*100:0,__barFunnelIsFirstStep:!1,__barFunnelIsDropoff:!0,__barFunnelStep:o.name,__barFunnelCategory:"_default"===h?void 0:h,category:d?h:o.name};s.push(Z(w,e,u,t,n,r,d?h:o.name))}}}return s},swimlane:function(e,t){const{scales:o,columns:n,getR:r,getStack:i,resolvePieceStyle:a}=e,{r:s,projection:l}=o,c=[],u="horizontal"===l,d=e.config.gradientFill,h=u?"left":"bottom",f=e.config.trackFill;if(f){const e="string"==typeof f?f:f.color,t="string"==typeof f?1:f.opacity??1,[o,r]=s.range(),i=Math.min(o,r),a=Math.abs(r-o);for(const o of Object.values(n)){const n={fill:e,opacity:t},r=u?Z(i,o.x,a,o.width,n,null,"__track__"):Z(o.x,i,o.width,a,n,null,"__track__");c.push(r)}}const m=e.config.roundedTop&&e.config.roundedTop>0?Math.max(0,e.config.roundedTop):0;for(const e of Object.values(n)){let t=0;const o=c.length;for(const o of e.pieceData){const n=Math.abs(r(o));if(0===n)continue;const l=i?i(o):e.name,f=a(o,l);let m;if(u){const r=s(t),i=s(t+n);m=Z(r,e.x,i-r,e.width,f,o,l)}else{const r=s(t+n),i=s(t);m=Z(e.x,r,e.width,i-r,f,o,l)}d&&(m.fillGradient=d,m.roundedEdge=h),c.push(m),t+=n}if(m>0&&c.length>o){const e=c.slice(o),t=e[0],n=e[e.length-1];1===e.length?t.cornerRadii={tl:m,tr:m,br:m,bl:m}:u?(t.cornerRadii={tl:m,bl:m},n.cornerRadii={tr:m,br:m}):(t.cornerRadii={bl:m,br:m},n.cornerRadii={tl:m,tr:m})}}return c}};function be(e,t){const o=t&&"object"==typeof t&&!Array.isArray(t)?t:void 0;return 0===e.length?e=>o&&X(o,e)||"#4e79a7":t=>{if(o){const e=X(o,t);if(e)return e}let n=0;for(let e=0;t.length>e;e++)n=31*n+t.charCodeAt(e)|0;return e[Math.abs(n)%e.length]??"#4e79a7"}}function ve(e){return null!=e&&!1!==e&&""!==e&&(!Array.isArray(e)||e.some(ve))}function xe(e,t,o){e.has(t)||(e.add(t),console.warn(o))}function we(e,t,o,n){const r=e.push(t);return o&&o.push(n),r}var ke={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 Se(e,t){const o={...e};for(const e of t)o[ke[e]]++;return o}function Ae(e,t,o){const n=new Set(t);return{changeSet:{...e,...e.keys?{keys:[...e.keys]}:{}},changed:n,revisions:Se(o,n)}}var Me=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=Ae({kind:"initialize"},[],this.revisions)}get last(){return this.latest}record(e,t){const o=Ae(e,t,this.revisions);return this.revisions=o.revisions,this.latest=o,o}},_e=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Ce=["scene-style","data-paint","accessibility","evidence"],Pe=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Le=new Set(["accessorRevision","axisExtent","categoryAccessor","chartType","extentPadding","groupBy","multiAxis","normalize","oAccessor","oExtent","oSort","rAccessor","rExtent","runtimeMode","stackBy","timeAccessor","valueAccessor"]),Re=new Set(["barColors","colorScheme","connectorStyle","pieceStyle","summaryStyle","themeCategorical","themeDiverging","themeSemantic","themeSequential"]),Ie=class{constructor(){this.tracker=new Me}get last(){return this.tracker.last}recordData(e,t){return this.tracker.record({kind:e,...void 0===t?{}:{count:t}},_e)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},Ce):this.recordNoop("restyle")}recordConfig(e){if(0===e.length)return this.tracker.record({kind:"config",keys:e},[]);const t=new Set(Pe);return e.some(e=>Le.has(e))&&t.add("domain"),e.some(e=>Re.has(e))&&t.add("scene-style"),this.tracker.record({kind:"config",keys:e},t)}};import{quadtree as Te}from"d3-quadtree";var $e=class{constructor(e){this.rExtent=new m,this.rExtents=[],this.windowSizeWarned=!1,this.updateResults=new Ie,this.rAccessors=[],this.categories=new Set,this._hasStreamingData=!1,this._colorSchemeMap=null,this._colorSchemeIndex=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositionMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this.scales=null,this.multiScales=[],this.scene=[],this.columns={},this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customLayoutFailedThisBuild=!1,this._customLayoutDiagnosticsWarned=new Set,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.version=0,this._dataVersion=0,this._bufferArrayCache=null,this._pointQuadtree=null,this._maxPointRadius=0,this._datumIndexCache=null,this._categoryIndexCache=null,this._hasRenderedOnce=!1,this.config=e,this.buffer=new f(e.windowSize),this.getO=w(e.categoryAccessor||e.oAccessor,"category");const t=e.valueAccessor||e.rAccessor;Array.isArray(t)?(this.rAccessors=t.map(e=>x(e,"value")),this.getR=this.rAccessors[0],this.rExtents=t.map(()=>new m)):(this.getR=x(t,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=w(e.stackBy),this.getGroup=w(e.groupBy),this.getColor=w(e.colorAccessor),this.getSymbol=w(e.symbolAccessor),this.getConnector=w(e.connectorAccessor),this.getDataId=w(e.dataIdAccessor),e.pulse&&(this.timestampBuffer=new f(e.windowSize))}syncPulseTimestampBuffer(){var e,t,o,n;this.timestampBuffer=(e=!!this.config.pulse,t=this.buffer,o=this.timestampBuffer,n=b(),e?null!=o&&o.capacity===t.capacity&&o.size===t.size?o:function(e,t){const o=new f(e.capacity);return e.forEach(()=>o.push(t)),o}(t,n):null)}ingest(e){const t=b();if(this.lastIngestTime=t,this._dataVersion++,e.bounded){this.buffer.clear(),this.rExtent.clear();for(const e of this.rExtents)e.clear();e.preserveCategoryOrder?this._hasStreamingData=!0:this.categories.clear(),this.timestampBuffer&&this.timestampBuffer.clear(),r=this.timestampBuffer,(n=e.totalSize||e.inserts.length)>(o=this.buffer).capacity&&(o.resize(n),r&&n>r.capacity&&r.resize(n));for(const o of e.inserts)we(this.buffer,o,this.timestampBuffer,t),this.categories.add(this.getO(o)),this.pushValueExtent(o)}else{this._hasStreamingData=!0;for(const o of e.inserts){const e=we(this.buffer,o,this.timestampBuffer,t);this.categories.add(this.getO(o)),this.pushValueExtent(o),null!=e&&this.evictValueExtent(e)}}var o,n,r;return this.updateResults.recordData(e.bounded?"replace":"ingest",e.inserts.length),!0}ingestWithResult(e){return this.ingest(e),this.updateResults.last}pushValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.push(t[0]),this.rExtent.push(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].push(this.rAccessors[t](e));this.rExtent.push(this.getR(e))}else this.rExtent.push(this.getR(e))}evictValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.evict(t[0]),this.rExtent.evict(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].evict(this.rAccessors[t](e));this.rExtent.evict(this.getR(e))}else this.rExtent.evict(this.getR(e))}getRawRange(e){const t=this.config.valueAccessor||this.config.rAccessor;if(!t)return null;const o="function"==typeof t?t(e):e[t];return Array.isArray(o)&&o.length>=2?[+o[0],+o[1]]:null}computeScene(e){const{config:t,buffer:o}=this,n=this.scales,r=this.multiScales,i=this.columns;if(0===o.size)return this.scales=null,this.multiScales=[],this.scene=[],this.columns={},this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(o,this.getR);const a=this.getBufferArray(),s=t.projection||"vertical",l=t.oExtent||this.resolveCategories(a),c=this.computeValueDomain(a,l),u="horizontal"===s,f="radial"===s,m=Math.min(.9,Math.max(0,null!=t.barPadding?t.barPadding/("vertical"===s?e.width:e.height):.1));let g,p;if(f){g=d().domain(l).range([0,1]).padding(0);const o=Math.min(e.width,e.height)/2,n=t.innerRadius||0;p=h().domain(c).range([n,o])}else u?(g=d().domain(l).range([0,e.height]).padding(m),p=h().domain(c).range([0,e.width])):(g=d().domain(l).range([0,e.width]).padding(m),p=h().domain(c).range([e.height,0]));this.scales={o:g,r:p,projection:s},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((n,r)=>{const i=this.rExtents[r];i.dirty&&i.recalculate(o,n);let[a,s]=i.extent;a===1/0&&(a=0,s=1);const l=s-a,c=l>0?l*(t.extentPadding??.05):1;return a-=c,s+=c,a>0&&(a=0),u?h().domain([a,s]).range([0,e.width]):h().domain([a,s]).range([e.height,0])}):[];let y=a;this.rAccessors.length>1&&(y=a.flatMap(e=>this.rAccessors.map((t,o)=>({...e,__rIndex:o,__rValue:t(e),__rName:this.resolveRAccessorName(o)})))),this.columns=this.buildColumns(y,l,g,s,e),this._customLayoutFailedThisBuild=!1;const b=this.buildSceneNodes(y,e);this._customLayoutFailedThisBuild?!0===this.lastCustomLayoutFailure?.preservedLastGoodScene?(this.scales=n,this.multiScales=r,this.columns=i):(this.scene=[],this.rebuildPointQuadtree()):(this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=b,this.rebuildPointQuadtree(),this.config.decay&&this.applyDecay(this.scene,a),this.config.pulse&&this.applyPulse(this.scene,a),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&this.prevPositionMap.size>0&&this.startTransition(),this.version++)}resolveRAccessorName(e){const t=this.config.valueAccessor||this.config.rAccessor,o=Array.isArray(t)?t[e]:t;return"string"==typeof o?o:"value"+e}resolveCategories(e){const t=this.config.oSort,o="streaming"===this.config.runtimeMode||this._hasStreamingData,n="auto"===t?void 0:t;let r=null;if(o){r=new Set;for(const t of e)r.add(this.getO(t))}const i=r?Array.from(this.categories).filter(e=>r.has(e)):Array.from(this.categories);if(o&&void 0===n){const e=Math.max(50,3*r.size);if(this.categories.size>e){let t=this.categories.size-e;for(const e of this.categories){if(0>=t)break;r.has(e)||(this.categories.delete(e),t--)}}return i}if(!1===n)return i;if("function"==typeof n)return i.sort(n);const a=new Map;for(const t of e){const e=this.getO(t);a.set(e,(a.get(e)||0)+Math.abs(this.getR(t)))}return i.sort("asc"===n?(e,t)=>(a.get(e)||0)-(a.get(t)||0):(e,t)=>(a.get(t)||0)-(a.get(e)||0))}computeValueDomain(e,t){return function(e){const{data:t,chartType:o,projection:n,normalize:r,rExtent:i,extentPadding:a=.05,baselinePadding:s,axisExtent:l,getO:c,getR:u,getStack:d,rawRExtent:h}=e,f=a;if("radial"===n&&("pie"===o||"donut"===o))return[0,1];let m=0,g=0;if("bar"===o&&d&&r)m=0,g=1;else if("bar"===o&&d){const e=new Map,o=new Map;for(const n of t){const t=c(n),r=u(n);0>r?o.set(t,(o.get(t)||0)+r):e.set(t,(e.get(t)||0)+r)}for(const t of e.values())t>g&&(g=t);for(const e of o.values())m>e&&(m=e)}else if("bar"===o){const e=new Map;for(const o of t){const t=c(o),n=u(o);e.set(t,(e.get(t)||0)+n)}for(const t of e.values())t>g&&(g=t),m>t&&(m=t)}else if("swimlane"===o){const e=new Map;for(const o of t){const t=c(o),n=Math.abs(u(o));e.set(t,(e.get(t)||0)+n)}for(const t of e.values())t>g&&(g=t)}else if("clusterbar"===o||"bar-funnel"===o)for(const e of t){const t=u(e);t>g&&(g=t),m>t&&(m=t)}else{const e=h[0],t=h[1];e!==1/0&&(m=e),t!==-1/0&&(g=t)}i&&(null!=i[0]&&(m=i[0]),null!=i[1]&&(g=i[1]));const p="bar"===o||"clusterbar"===o||"bar-funnel"===o||"swimlane"===o;if(p&&null==i?.[0]&&null==i?.[1]&&(m>0&&(m=0),0>g&&(g=0)),"bar-funnel"!==o&&"exact"!==l){const e=g-m,t=e>0?e*f:1,n=p&&!s&&0===m,r=p&&!s&&0===g||"swimlane"===o;null!=i?.[0]||n||(m-=t),null!=i?.[1]||r||(g+=t)}return[m,g]}({data:e,chartType:this.config.chartType,projection:this.config.projection,normalize:this.config.normalize,rExtent:this.config.rExtent,extentPadding:this.config.extentPadding,baselinePadding:this.config.baselinePadding,axisExtent:this.config.axisExtent,getO:this.getO,getR:this.getR,getStack:this.getStack,rawRExtent:this.rExtent.extent})}buildColumns(e,t,o,n,r){return function(e){const{data:t,oExtent:o,oScale:n,projection:r,layout:i,dynamicColumnWidth:a,getO:s,getR:l}=e,c={},u=new Map;for(const e of t){const t=s(e);u.has(t)||u.set(t,[]),u.get(t).push(e)}let d=0;if("radial"===r)for(const e of t)d+=Math.abs(l(e));let h=null;if(a&&"radial"!==r){h=new Map;let e=0;for(const t of o){const o=u.get(t)||[];let n;n="string"==typeof a?o.reduce((e,t)=>e+(Number(t[a])||0),0):a(o),h.set(t,n),e+=n}const t=("horizontal"===r?i.height:i.width)-n.padding()*n.step()*o.length;if(e>0)for(const[o,n]of h)h.set(o,n/e*t)}let f=0,m=0;for(const e of o){const t=u.get(e)||[],o=t.reduce((e,t)=>e+Math.abs(l(t)),0),r=d>0?o/d:0;let i,a;h?(i=m,a=h.get(e)||n.bandwidth(),m+=a+n.padding()*n.step()):(i=n(e)??0,a=n.bandwidth()),c[e]={name:e,x:i,y:0,width:a,middle:i+a/2,padding:n.padding()*n.step(),pieceData:t,pct:r,pctStart:f},f+=r}return c}({data:e,oExtent:t,oScale:o,projection:n,layout:r,dynamicColumnWidth:this.config.dynamicColumnWidth,getO:this.getO,getR:this.getR})}getSceneContext(){return{scales:this.scales,columns:this.columns,config:this.config,getR:this.getR,getStack:this.getStack,getGroup:this.getGroup,getColor:this.getColor,getSymbol:this.getSymbol,getConnector:this.getConnector,getO:this.getO,multiScales:this.multiScales,rAccessors:this.rAccessors,resolvePieceStyle:(e,t)=>this.resolvePieceStyle(e,t),resolveSummaryStyle:(e,t)=>this.resolveSummaryStyle(e,t),getRawRange:e=>this.getRawRange(e)}}buildSceneNodes(e,t){if(!this.scales)return[];if(this.config.customLayout){const o=this.buildLayoutContext(e,t);let n;try{n=this.config.customLayout(o)}catch(e){const t=null!==this.lastCustomLayoutResult,o=function(e,t,o,n){const r=function(e){if(e instanceof Error)return{name:e.name||"Error",message:e.message||"Custom layout threw."};if("string"==typeof e)return{name:"Error",message:e};if(null==e)return{name:"Error",message:"Custom layout threw a nullish value."};try{return{name:"Error",message:e+""}}catch{return{name:"Error",message:"Custom layout threw a non-stringifiable value."}}}(t),i="network"===e?"customNetworkLayout":"customLayout";return{code:"CUSTOM_LAYOUT_ERROR",severity:"error",phase:"layout",component:e,source:i,message:`Semiotic ${e} ${i} failed: ${r.message}`,error:r,recovery:o?"preserved-last-good-scene":"empty-scene",preservedLastGoodScene:o,affectedRevision:n}}("ordinal",e,t,this.version);this.lastCustomLayoutFailure=o,this._customLayoutFailedThisBuild=!0,"production"!==process.env.NODE_ENV&&console.error("[semiotic] ordinal customLayout threw:",e);try{this.config.onLayoutError?.(o)}catch(e){"production"!==process.env.NODE_ENV&&console.error("[semiotic] onLayoutError threw:",e)}return t?this.scene:(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,[])}this.customLayoutOverlays=n.overlays??null,this.lastCustomLayoutResult=n,this.lastCustomLayoutFailure=null;const r=n.nodes??[];if(this._customRestyle=n.restyle,this.hasCustomRestyle=!!n.restyle,this.hasCustomRestyle){this._baseStyles=new WeakMap;for(const e of r)e.style&&this._baseStyles.set(e,e.style);this.applyCustomRestyle(r,this.config.layoutSelection??null)}return function(e){if("production"===process.env.NODE_ENV)return;const{label:t,nodes:o,overlays:n,warned:r}=e;ve(n)&&0===o.length&&xe(r,"overlay-only",`[semiotic] ${t} returned overlays but no data-bearing scene nodes. Overlays do not participate in hover, selection, transitions, SSR evidence, or accessibility tables. Emit at least one scene node with a datum, or mark the overlay-only chart as intentionally decorative.`),o.length>0&&o.every(e=>null==e.datum)&&xe(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:"ordinal customLayout",nodes:r,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned}),r}this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1;const o=this.getSceneContext(),n=ye[this.config.chartType];let r=n?n(o,t):[];if(this.getConnector&&this.scales){const e=function(e,t){const{scales:o,config:n,getConnector:r,getO:i}=e;if(!r||!o)return[];const a=[],{projection:s}=o,l=new Map;for(const e of t){if("point"!==e.type&&"rect"!==e.type)continue;const t=e.datum;if(!t)continue;const o=r(t);if(!o)continue;let n,a;"point"===e.type?(n=e.x,a=e.y):(n=e.x+e.w/2,a=e.y+("vertical"===s?0:e.h/2)),l.has(o)||l.set(o,[]),l.get(o).push({x:n,y:a,datum:t,category:i(t)})}const c=o.o.domain(),u=n.connectorStyle;for(const[t,o]of l)if(o.length>=2){o.sort((e,t)=>c.indexOf(e.category)-c.indexOf(t.category));for(let n=0;o.length-1>n;n++){const r=o[n],i=o[n+1],s="function"==typeof u?u(r.datum):u||{stroke:e.config.themeSemantic?.border||e.config.themeSemantic?.secondary||"#999",strokeWidth:1,opacity:.5};a.push({type:"connector",x1:r.x,y1:r.y,x2:i.x,y2:i.y,style:s,datum:r.datum,group:t})}}return a}(o,r);r=[...e,...r]}return r}buildLayoutContext(e,t){const o=this.config,n=o.layoutMargin??{top:0,right:0,bottom:0,left:0},r=function(e,t,o){if(e&&"object"==typeof e&&!Array.isArray(e)){const t=Object.values(e).filter(e=>"string"==typeof e&&e.length>0);if(t.length>0)return t}if(Array.isArray(e)&&e.length>0)return e;if("string"==typeof e){const t=N[e];if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:o}(o.colorScheme,o.themeCategorical,G),i=this.scales;return{data:e,scales:{o:i.o,r:i.r,projection:i.projection},dimensions:{width:t.width,height:t.height,margin:n,plot:"radial"===i.projection?{x:-t.width/2,y:-t.height/2,width:t.width,height:t.height}:{x:0,y:0,width:t.width,height:t.height}},theme:{semantic:o.themeSemantic??{},categorical:[...r]},resolveColor:be(r,o.colorScheme),config:o.layoutConfig??{},selection:o.layoutSelection??null}}resolvePieceStyle(e,t){if("function"==typeof this.config.pieceStyle){const o=this.config.pieceStyle(e,t);return o&&!o.fill&&t?{...o,fill:this.getColorFromScheme(t)}:o}return this.config.pieceStyle&&"object"==typeof this.config.pieceStyle?this.config.pieceStyle:this.config.barColors&&t?{fill:this.config.barColors[t]||"#007bff"}:t?{fill:this.getColorFromScheme(t)}:{fill:"#007bff"}}getColorFromScheme(e){this._colorSchemeMap||(this._colorSchemeMap=new Map);const t=this._colorSchemeMap.get(e);if(t)return t;const o=Array.isArray(this.config.colorScheme)?this.config.colorScheme:this.config.themeCategorical||G,n=o[this._colorSchemeIndex%o.length];return this._colorSchemeIndex++,this._colorSchemeMap.set(e,n),n}resolveSummaryStyle(e,t){return"function"==typeof this.config.summaryStyle?this.config.summaryStyle(e,t):this.config.summaryStyle&&"object"==typeof this.config.summaryStyle?this.config.summaryStyle:{fill:"#007bff",fillOpacity:.6,stroke:"#007bff",strokeWidth:1}}computeDecayOpacity(e,t){const o=this.config.decay;return o&&t>1?function(e,t,o){if(1>=o)return 1;const n=o-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 o=Math.max(0,e.age);if("step"===e.type)return(e.threshold??.5*e.extent)>o?1:t;if("exponential"===e.type){const n=e.halfLife??e.extent/2;return t+Math.pow(.5,o/(n>0?n:e.extent/2))*(1-t)}return t+Math.max(0,Math.min(1,1-o/e.extent))*(1-t)}({age:n-t,extent:n,type:e.type,halfLife:e.halfLife??o/2,threshold:e.stepThreshold??.5*o,minOpacity:e.minOpacity??.1})}(o,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._dataVersion)return this._datumIndexCache.map;const t=function(e){const t=new Map;for(let o=0;e.length>o;o++)t.set(e[o],o);return t}(e);return this._datumIndexCache={version:this._dataVersion,map:t},t}getCategoryIndexMap(e){if(this._categoryIndexCache&&this._categoryIndexCache.version===this._dataVersion)return this._categoryIndexCache.map;const t=function(e,t){const o="function"==typeof t,n=o?null:t||"category",r=new Map;for(let i=0;e.length>i;i++){const a=e[i],s=o?t(a):a[n],l=r.get(s);l?l.push(i):r.set(s,[i])}return r}(e,this.config.categoryAccessor||this.config.oAccessor);return this._categoryIndexCache={version:this._dataVersion,map:t},t}rebuildPointQuadtree(){const e=function(e){let t=0,o=0;for(const n of e)"point"===n.type&&(t++,n.r>o&&(o=n.r));if(500>=t)return{quadtree:null,maxRadius:o};const n=Array(t);let r=0;for(const t of e)"point"===t.type&&(n[r++]=t);return{maxRadius:o,quadtree:Te().x(e=>e.x).y(e=>e.y).addAll(n)}}(this.scene);this._pointQuadtree=e.quadtree,this._maxPointRadius=e.maxRadius}get pointQuadtree(){return this._pointQuadtree}get maxPointRadius(){return this._maxPointRadius}applyDecay(e,t){if(!this.config.decay)return;const o=t.length;if(1>=o)return;const n=this.getDatumIndexMap(t);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;const e=n.get(t.datum);if(null==e)continue;const r=this.computeDecayOpacity(e,o);t.style={...t.style,opacity:(t.style?.opacity??1)*r}}}applyPulse(e,t,o=b()){return!(!this.config.pulse||!this.timestampBuffer)&&function(e,t,o,n,r,i){const a=e.color??"rgba(255,255,255,0.6)",s=e.glowRadius??4;let l=!1;for(const c of t){if("connector"===c.type||"violin"===c.type||"boxplot"===c.type)continue;if("wedge"===c.type){const t=c.category;if(!t)continue;let n=0;for(const a of r(t)??[]){const t=o.get(a);null!=t&&(n=Math.max(n,g(e,t,i)))}l=p(c,n,a)||l;continue}if(null==c.datum)continue;const t=n.get(c.datum);if(null==t)continue;const u=o.get(t);l=p(c,null==u?0:g(e,u,i),a,s)||l}return l}(this.config.pulse,e,this.timestampBuffer,this.getDatumIndexMap(t),e=>this.getCategoryIndexMap(t).get(e),o)}refreshPulse(e){return!0!==this.lastCustomLayoutFailure?.preservedLastGoodScene&&this.applyPulse(this.scene,this.getBufferArray(),e)}hasActivePulsesAt(e){return!!this.config.pulse&&function(e,t,o=("undefined"!=typeof performance?performance.now():Date.now())){if(!t||0===t.size)return!1;const n=e.duration??500,r=t.peek();return null!=r&&n>o-r}(this.config.pulse,this.timestampBuffer,e)}get hasActivePulses(){return this.hasActivePulsesAt(b())}synthesizeIntroPositions(){this.prevPositionMap.clear();const e=new Map,t=this.scales?.r(0)??0,o="horizontal"!==this.scales?.projection;let n;for(let r=0;this.scene.length>r;r++){const i=this.scene[r],a=this.getNodeKey(i,e);a&&("rect"===i.type?this.prevPositionMap.set(a,o?{x:i.x,y:t,w:i.w,h:0,opacity:i.style.opacity??1}:{x:t,y:i.y,w:0,h:i.h,opacity:i.style.opacity??1}):"point"===i.type?this.prevPositionMap.set(a,{x:i.x,y:i.y,r:0,opacity:0}):"wedge"===i.type&&(void 0===n&&(n=i.startAngle),this.prevPositionMap.set(a,{x:i.cx,y:i.cy,startAngle:n,endAngle:n,innerRadius:i.innerRadius,outerRadius:i.outerRadius,opacity:0})))}}getNodeKey(e,t){if("point"===e.type){const o=`p:${e.datum?this.getO(e.datum):""}:${e.datum?this.getR(e.datum):0}`,n=t.get(o)||0;return t.set(o,n+1),`${o}:${n}`}return"rect"===e.type?`r:${e.group||""}:${e.datum?.category??""}`:"wedge"===e.type?"w:"+(e.category??""):null}snapshotPositions(){this.prevPositionMap.clear();const e=new Map;for(let t=0;this.scene.length>t;t++){const o=this.scene[t],n=this.getNodeKey(o,e);n&&("point"===o.type?this.prevPositionMap.set(n,{x:o.x,y:o.y,r:o.r,opacity:o.style.opacity}):"rect"===o.type?this.prevPositionMap.set(n,{x:o.x,y:o.y,w:o.w,h:o.h,opacity:o.style.opacity}):"wedge"===o.type&&this.prevPositionMap.set(n,{x:o.cx,y:o.cy,startAngle:o.startAngle,endAngle:o.endAngle,innerRadius:o.innerRadius,outerRadius:o.outerRadius,opacity:o.style.opacity??1}))}}startTransition(){if(!this.config.transition||0===this.prevPositionMap.size)return;const e=this.config.transition.duration??300;if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}let t=!1;const o=new Set,n=new Map;for(let e=0;this.scene.length>e;e++){const r=this.scene[e],i=this.getNodeKey(r,n);if(!i)continue;r._transitionKey=i;const a=this.prevPositionMap.get(i);if("point"===r.type)a?(o.add(i),r._targetOpacity=r.style.opacity??1,(a.x!==r.x||a.y!==r.y||void 0!==a.r&&a.r!==r.r)&&(r._targetX=r.x,r._targetY=r.y,r._targetR=r.r,r.x=a.x,r.y=a.y,void 0!==a.r&&(r.r=a.r),t=!0)):(r._targetOpacity=r.style.opacity??1,r._targetR=r.r,r.r=0,r.style={...r.style,opacity:0},t=!0);else if("rect"===r.type)a?(o.add(i),r._targetOpacity=r.style.opacity??1,a.x===r.x&&a.y===r.y&&a.w===r.w&&a.h===r.h||(r._targetX=r.x,r._targetY=r.y,r._targetW=r.w,r._targetH=r.h,r.x=a.x,r.y=a.y,r.w=a.w??r.w,r.h=a.h??r.h,t=!0)):(r._targetOpacity=r.style.opacity??1,r.style={...r.style,opacity:0},t=!0);else if("wedge"===r.type)if(a)o.add(i),r._targetOpacity=r.style.opacity??1,a.startAngle===r.startAngle&&a.endAngle===r.endAngle||(r._targetStartAngle=r.startAngle,r._targetEndAngle=r.endAngle,r.startAngle=a.startAngle,r.endAngle=a.endAngle,t=!0);else{r._targetOpacity=r.style.opacity??1,r._targetStartAngle=r.startAngle,r._targetEndAngle=r.endAngle;const e=r.startAngle;r.startAngle=e,r.endAngle=e,r.style={...r.style,opacity:0},this.prevPositionMap.set(i,{x:r.cx,y:r.cy,startAngle:e,endAngle:e,innerRadius:r.innerRadius,outerRadius:r.outerRadius,opacity:0}),t=!0}}this.exitNodes=[];for(const[e,n]of this.prevPositionMap)if(!o.has(e)){if(e.startsWith("p:"))this.exitNodes.push({type:"point",x:n.x,y:n.y,r:n.r??3,style:{opacity:n.opacity??1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("r:"))this.exitNodes.push({type:"rect",x:n.x,y:n.y,w:n.w??0,h:n.h??0,style:{opacity:n.opacity??1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("w:")){const t=((n.startAngle??0)+(n.endAngle??0))/2,o={type:"wedge",cx:n.x,cy:n.y,innerRadius:n.innerRadius??0,outerRadius:n.outerRadius??100,startAngle:n.startAngle??0,endAngle:n.endAngle??0,style:{opacity:n.opacity??1},datum:null,category:e.slice(2),_targetStartAngle:t,_targetEndAngle:t,_targetOpacity:0,_transitionKey:e};this.exitNodes.push(o)}t=!0}this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),t&&(this.activeTransition={startTime:b(),duration:e})}advanceTransition(e){if(!this.activeTransition)return!1;const t=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,this.activeTransition),o=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(t,"linear"===this.config.transition?.easing?"linear":"ease-out-cubic");for(const e of this.scene){const t=e._transitionKey;if(t)if("point"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t);e.style.opacity=y(n?n.opacity??1:0,e._targetOpacity,o)}const n=this.prevPositionMap.get(t);void 0!==e._targetX&&n&&(e.x=y(n.x,e._targetX,o),e.y=y(n.y,e._targetY,o)),void 0!==e._targetR&&void 0!==n?.r&&(e.r=y(n.r,e._targetR,o))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t);e.style.opacity=y(n?n.opacity??1:0,e._targetOpacity,o)}if(void 0===e._targetX)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=y(n.x,e._targetX,o),e.y=y(n.y,e._targetY,o),void 0!==n.w&&(e.w=y(n.w,e._targetW,o),e.h=y(n.h,e._targetH,o))}else if("wedge"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t);e.style={...e.style,opacity:y(n?n.opacity??1:0,e._targetOpacity,o)}}if(void 0!==e._targetStartAngle&&void 0!==e._targetEndAngle){const n=this.prevPositionMap.get(t);n&&void 0!==n.startAngle&&(e.startAngle=y(n.startAngle,e._targetStartAngle,o),e.endAngle=y(n.endAngle,e._targetEndAngle,o))}}}if(t>=1){for(const e of this.scene)if(void 0!==e._targetOpacity&&(e.style={...e.style||{},opacity:0===e._targetOpacity?0:e._targetOpacity},e._targetOpacity=void 0),"point"===e.type){if(void 0===e._targetX&&void 0===e._targetR)continue;void 0!==e._targetX&&(e.x=e._targetX,e.y=e._targetY),void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else"wedge"===e.type&&void 0!==e._targetStartAngle&&(e.startAngle=e._targetStartAngle,e.endAngle=e._targetEndAngle,e._targetStartAngle=void 0,e._targetEndAngle=void 0);if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}return this.activeTransition=null,!1}return!0}cancelIntroAnimation(){this.prevPositionMap.clear(),this.activeTransition=null}getBufferArray(){return this._bufferArrayCache?.version!==this._dataVersion&&(this._bufferArrayCache={version:this._dataVersion,data:this.buffer.toArray()}),this._bufferArrayCache.data}getData(){return this.buffer.toArray()}getLastUpdateResult(){return this.updateResults.last}remove(e){if(!this.getDataId)throw Error("remove() requires dataIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=k(e),o=this.getDataId,n=e=>t.has(o(e));!function(e,t,o){if(!t||0===t.size)return;const n=new Set;if(e.forEach((e,t)=>{o(e)&&n.add(t)}),0===n.size)return;const r=t.toArray();t.clear();for(let e=0;r.length>e;e++)n.has(e)||t.push(r[e])}(this.buffer,this.timestampBuffer,n);const r=this.buffer.remove(n);if(0===r.length)return this.updateResults.recordNoop("remove"),r;for(const e of r)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach(e=>this.categories.add(this.getO(e))),this._dataVersion++,this.version++,this.lastIngestTime=b(),this.updateResults.recordData("remove",r.length),r}update(e,t){if(!this.getDataId)throw Error("update() requires dataIdAccessor to be configured");const o=k(e),n=this.getDataId,r=new Set;this.buffer.forEach((e,t)=>{o.has(n(e))&&r.add(t)});const i=this.buffer.update(e=>o.has(n(e)),t);if(0===i.length)return this.updateResults.recordNoop("update"),i;for(const e of i)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach((e,t)=>{this.categories.add(this.getO(e)),r.has(t)&&this.pushValueExtent(e)}),this._dataVersion++,this.version++,this.lastIngestTime=b(),this.updateResults.recordData("update",i.length),i}clear(){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this._hasStreamingData=!1,this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this.scales=null,this.scene=[],this.columns={},this.multiScales=[],this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this._pointQuadtree=null,this._maxPointRadius=0,this._colorSchemeMap=null,this._colorSchemeIndex=0,this._dataVersion++,this.version++,this.updateResults.recordData("clear")}get size(){return this.buffer.size}getOAccessor(){return this.getO}getRAccessor(){return this.getR}setLayoutSelection(e){this.config.layoutSelection=e}applyCustomRestyle(e,t){const o=this._customRestyle;if(o)for(const n of e){const e=this._baseStyles.get(n)??n.style??{},r=o(n,t);n.style=r?{...e,...r}:e}}restyleScene(e){this._customRestyle?(this.applyCustomRestyle(this.scene,e),this.updateResults.recordRestyle(!0)):this.updateResults.recordRestyle(!1)}rebuildAccessorDerivedState(){this.categories.clear(),this.rExtent.clear();for(const e of this.rExtents)e.clear();this._categoryIndexCache=null,this.buffer.forEach(e=>{this.categories.add(this.getO(e)),this.pushValueExtent(e)})}updateConfig(e){const t={...this.config},o=Object.keys(e).filter(o=>e[o]!==t[o]);"production"!==process.env.NODE_ENV&&!this.windowSizeWarned&&"windowSize"in e&&e.windowSize!==t.windowSize&&(this.windowSizeWarned=!0,console.warn(`[Semiotic] windowSize changed after mount (${t.windowSize} → ${e.windowSize}) but it is a mount-only setting — the ring buffer keeps its original capacity. Remount the chart (e.g. via a React key) to apply a new windowSize.`)),("colorScheme"in e&&e.colorScheme!==t.colorScheme||"themeCategorical"in e&&e.themeCategorical!==t.themeCategorical||"colorAccessor"in e&&!v(e.colorAccessor,t.colorAccessor))&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),("categoryAccessor"in e&&!v(e.categoryAccessor,t.categoryAccessor)||"oAccessor"in e&&!v(e.oAccessor,t.oAccessor))&&(this._categoryIndexCache=null),Object.assign(this.config,e),"pulse"in e&&this.syncPulseTimestampBuffer();let n=!1;("categoryAccessor"in e||"oAccessor"in e)&&(v(this.config.categoryAccessor||this.config.oAccessor,t.categoryAccessor||t.oAccessor)||(this.getO=w(this.config.categoryAccessor||this.config.oAccessor,"category"),n=!0));let r=!1;if("valueAccessor"in e||"rAccessor"in e){const e=this.config.valueAccessor||this.config.rAccessor,o=t.valueAccessor||t.rAccessor,n=Array.isArray(e)?e:[e],i=Array.isArray(o)?o:[o];if(r=n.length!==i.length||n.some((e,t)=>!v(e,i[t])),r){const e=this.config.valueAccessor||this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>x(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new m)):(this.getR=x(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!v(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?w(this.config.stackBy):void 0),"groupBy"in e&&!v(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?w(this.config.groupBy):void 0),"colorAccessor"in e&&!v(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?w(this.config.colorAccessor):void 0),"symbolAccessor"in e&&!v(e.symbolAccessor,t.symbolAccessor)&&(this.getSymbol=null!=this.config.symbolAccessor?w(this.config.symbolAccessor):void 0),"connectorAccessor"in e&&!v(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?w(this.config.connectorAccessor):void 0),(n||r||"accessorRevision"in e&&e.accessorRevision!==t.accessorRevision)&&this.rebuildAccessorDerivedState(),this.updateResults.recordConfig(o)}updateConfigWithResult(e){return this.updateConfig(e),this.updateResults.last}};import*as Be from"react";function He(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:Be.createElement(Be.Fragment,null,...t)}import*as Oe from"react";import{jsx as je}from"react/jsx-runtime";var De={isActive:!1,predicate:()=>!0},Fe=Oe.createContext(null);function Ee({value:e,children:t}){return je(Fe.Provider,{value:e,children:t})}function ze(){return Oe.useContext(Fe)??De}function Ne(e,t){return null!=e?je(Ee,{value:t,children:e}):e}import{useEffect as We,useRef as Ge}from"react";function qe(e,t=30){return Math.max((e??4)+5,12,t)}function Ve(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}var Xe=[40,40],Ye=[.5,.5];function Ke(e,t){const[o,n]=e.viewBox??Xe,[r,i]=e.anchor??Ye,a=n>0?n:1,s=Math.max(0,t)/a,l=(o>0?o:a)*s,c=a*s;return{width:l,height:c,scale:s,offsetX:-r*l,offsetY:-i*c}}function Ze(e,t){const o=Ke(e,t),n=[[o.offsetX,o.offsetY],[o.offsetX+o.width,o.offsetY],[o.offsetX,o.offsetY+o.height],[o.offsetX+o.width,o.offsetY+o.height]];let r=0;for(const[e,t]of n){const o=Math.sqrt(e*e+t*t);o>r&&(r=o)}return r}function Qe(e,t,o,n){if("none"!==e)return"color"===e||null==e?t??n:"accent"===e?o:e}var Ue=null;function Je(e){if("undefined"==typeof Path2D)return null;Ue||(Ue=new Map);const t=Ue.get(e);if(t)return t;const o=new Path2D(e);return Ue.size>1024&&Ue.clear(),Ue.set(e,o),o}function et(e,t,o=0,n="horizontal"){const[r,i]=e.viewBox??Xe,a=Math.min(1,Math.max(0,o)),s=Math.min(1,Math.max(0,t));return s>a?a>0||1>s?"vertical"===n?{x:0,y:i*(1-s),width:r,height:i*(s-a)}:{x:r*a,y:0,width:r*(s-a),height:i}:null:{x:0,y:0,width:0,height:0}}function tt(e,t){const o=Ke(e,t);return{centerDx:o.offsetX+o.width/2,centerDy:o.offsetY+o.height/2,halfWidth:o.width/2,halfHeight:o.height/2,radius:Math.hypot(o.width,o.height)/2}}function ot(e,t,o,n,r,i=e=>e){for(const a of t.parts){const t=Je(a.d);if(!t)continue;const s=a.opacity??1,l=e.globalAlpha;1!==s&&(e.globalAlpha=l*s);const c=r?"none"===a.fill?void 0:r:Qe(a.fill,o,n);c&&(e.fillStyle=i(c),e.fill(t));const u=r?a.stroke&&"none"!==a.stroke?r:void 0:Qe(a.stroke??"none",o,n);u&&(e.strokeStyle=i(u),e.lineWidth=a.strokeWidth??1,e.lineCap=a.strokeLinecap??"butt",e.lineJoin=a.strokeLinejoin??"miter",e.stroke(t)),1!==s&&(e.globalAlpha=l)}}function nt(e,t,o,n=30,r,i=0){let a=null;if(r){const e=function(e,t,o,n,r,i=e=>e.x,a=e=>e.y,s=e=>e.r){const l=Math.max(n,r+5,12),c=t-l,u=t+l,d=o-l,h=o+l;let f=null,m=1/0;return e.visit((e,r,l,g,p)=>{if(r>u||c>g||l>h||d>p)return!0;if(!e.length){let r=e;do{const e=r.data,l=i(e)-t,c=a(e)-o,u=Math.sqrt(l*l+c*c);qe(s(e),n)>=u&&m>u&&(f=e,m=u),r=r.next}while(r)}return!1}),f?{node:f,distance:m}:null}(r,t,o,n,i);e&&(a={datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const i of e){let e=null;switch(i.type){case"rect":if(null==i.datum)break;e=rt(i,t,o);break;case"point":if(r)break;e=it(i,t,o,n);break;case"symbol":e=at(i,t,o,n);break;case"glyph":e=st(i,t,o,n);break;case"wedge":if(null===i.datum)break;e=lt(i,t,o);break;case"boxplot":e=ct(i,t,o);break;case"violin":e=ut(i,t,o)}e&&n>e.distance&&(a&&e.distance>=a.distance||(a=e))}return a}function rt(e,t,o){const n=function(e,t,o){return o.x>e||e>o.x+o.w||o.y>t||t>o.y+o.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:o.x+o.w/2,cy:o.y+o.h/2}}(t,o,e);return n.hit?{datum:e.datum,x:n.cx,y:e.y,distance:0,category:e.group}:null}function it(e,t,o,n=30){const r=t-e.x,i=o-e.y,a=Math.sqrt(r*r+i*i);return a>qe(e.r,n)?null:{datum:e.datum,x:e.x,y:e.y,distance:a}}function at(e,t,o,n=30){const r=t-e.x,i=o-e.y,a=Math.sqrt(r*r+i*i);return a>qe(le(e.size),n)?null:{datum:e.datum,x:e.x,y:e.y,distance:a}}function st(e,t,o,n=30){if(null==e.datum)return null;const r=tt(e.glyph,e.size),i=e.x+r.centerDx,a=e.y+r.centerDy,s=t-i,l=o-a,c=Math.sqrt(s*s+l*l);return c>qe(r.radius,n)?null:{datum:e.datum,x:i,y:a,distance:c}}function lt(e,t,o){const n=t-e.cx,r=o-e.cy,i=Math.sqrt(n*n+r*r);if(e.innerRadius>i||i>e.outerRadius)return null;const a=Ve(Math.atan2(r,n)),s=Ve(e.startAngle),l=Ve(e.endAngle);if(!(s>l?a>=s||l>=a:a>=s&&l>=a))return null;const c=(e.startAngle+e.endAngle)/2,u=(e.innerRadius+e.outerRadius)/2;return{datum:e.datum,x:e.cx+Math.cos(c)*u,y:e.cy+Math.sin(c)*u,distance:0,category:e.category}}function ct(e,t,o){const n=e.columnWidth/2;if("vertical"===e.projection){if(!(e.x-n>t||t>e.x+n||Math.min(e.minPos,e.maxPos)>o||o>Math.max(e.minPos,e.maxPos)))return{datum:e.datum,x:e.x,y:e.medianPos,distance:0,category:e.category,stats:e.stats}}else{const r=e.y-n,i=e.y+n;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||r>o||o>i))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category,stats:e.stats}}return null}function ut(e,t,o){if(!e.bounds)return null;const{x:n,y:r,width:i,height:a}=e.bounds;return n>t||t>n+i||r>o||o>r+a?null:{datum:e.datum,x:n+i/2,y:r+a/2,distance:0,category:e.category,stats:e.stats}}function dt(e,t,o){const n=e.byGroup.get(t);let r=0,i=Math.abs(n[0].x-o.x);for(let e=1;n.length>e;e++){const t=Math.abs(n[e].x-o.x);i>t&&(i=t,r=e)}return n[r]._flatIndex}function ht(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}import{useEffect as ft,useRef as mt}from"react";var gt={fresh:1,aging:.7,stale:.45,expired:.25},pt={alpha:1,band:"fresh",isStale:!1};import{jsx as yt}from"react/jsx-runtime";function bt({isStale:e,position:t}){return yt("div",{className:"stream-staleness-badge",style:{position:"absolute",..."top-left"===t?{top:4,left:4}:"bottom-left"===t?{bottom:4,left:4}:"bottom-right"===t?{bottom:4,right:4}:{top:4,right:4},padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",zIndex:3,background:e?"#dc3545":"#28a745",color:"white"},children:e?"STALE":"LIVE"})}import{useMemo as vt,useRef as xt}from"react";import*as wt from"react";import{jsx as kt,jsxs as St}from"react/jsx-runtime";var At={fill:(e,t)=>kt("rect",{style:e,width:t,height:t}),line:(e,t)=>kt("line",{style:e,x1:0,y1:0,x2:t,y2:t})};function Mt(e,t,o,n,r){let i;return i="function"==typeof o?o(e):(0,At[o])(n(e,t),r),i}function _t({swatchSize:e}){return kt("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 Ct(e,t,o){return o&&o.size>0?o.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}var Pt=(e,t,o,n,r,i,a,s,l,c,u)=>{const{type:d="fill",styleFn:h,items:f}=e,m=[];let g=0;const p=!(!t&&!o),y="isolate"===c||void 0===c&&null!=r,{swatchSize:b,labelGap:v,rowHeight:x}=u;return f.forEach((e,c)=>{const u=Mt(e,c,d,h,b),w=Ct(e,n,r),k=r&&r.size>0&&r.has(e.label);m.push(St("g",{transform:`translate(0,${g})`,onClick:t?()=>t(e):void 0,onMouseEnter:o?()=>o(e):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:p?s===i&&c===a?0:-1:void 0,role:p?"option":void 0,"aria-selected":p&&y?k||!1:void 0,"aria-current":p&&!y&&null!=n&&e.label===n||void 0,"aria-label":e.label,onKeyDown:p?o=>{if("Enter"!==o.key&&" "!==o.key||(o.preventDefault(),t&&t(e)),"ArrowDown"===o.key||"ArrowUp"===o.key){o.preventDefault();const e=(c+("ArrowDown"===o.key?1:-1)+f.length)%f.length;l(s,e);const t=o.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:p?t=>{l(s,c),o&&o(e);const n=t.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:p?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:p?"pointer":"default",opacity:w,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[p&&kt("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:b+v+2+7*e.label.length,height:b+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),u,k&&kt(_t,{swatchSize:b}),kt("text",{y:b/2,x:b+v,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+c)),g+=x}),m};function Lt({config:e,orientation:t="vertical",width:o=100}){const{colorFn:n,domain:r,label:i,format:a}=e,s=a||(e=>Math.round(100*e)/100+""),l="grad-legend-"+wt.useId();if("horizontal"===t){const e=12,t=Math.min(o,200),a=Math.max(0,(o-t)/2),c=[];for(let e=0;64>=e;e++){const t=e/64;c.push(kt("stop",{offset:100*t+"%",stopColor:n(r[0]+t*(r[1]-r[0]))},e))}return St("g",{"aria-label":i||"Gradient legend",children:[kt("defs",{children:kt("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),i&&kt("text",{x:a+t/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),kt("rect",{x:a,y:0,width:t,height:e,fill:`url(#${l})`,rx:2}),kt("text",{x:a,y:e+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:s(r[0])}),kt("text",{x:a+t,y:e+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:s(r[1])})]})}const c=[];for(let e=0;64>=e;e++){const t=e/64;c.push(kt("stop",{offset:100*t+"%",stopColor:n(r[1]-t*(r[1]-r[0]))},e))}return St("g",{"aria-label":i||"Gradient legend",children:[i&&kt("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),kt("defs",{children:kt("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:c})}),kt("rect",{x:0,y:0,width:14,height:100,fill:`url(#${l})`,rx:2}),kt("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:s(r[1])}),kt("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:s(r[0])})]})}function Rt(e){const{legendGroups:t,customClickBehavior:o,customHoverBehavior:n,highlightedCategory:r,isolatedCategories:i,legendInteraction:a,title:s="Legend",width:l=100,height:c=20,orientation:u="vertical",legendLayout:d}=e,h=function(e){const t=Math.max(1,e?.swatchSize??16),o=Math.max(t,e?.rowHeight??22);return{swatchSize:t,labelGap:Math.max(0,e?.labelGap??6),itemGap:Math.max(0,e?.itemGap??10),rowHeight:o,align:"left"===e?.align?"start":"right"===e?.align?"end":e?.align??"start",maxWidth:e?.maxWidth}}(d),[f,m]=wt.useState(0),[g,p]=wt.useState(0),y=wt.useCallback((e,t)=>{m(e),p(t)},[]),b="vertical"===u?(({legendGroups:e,width:t,customClickBehavior:o,customHoverBehavior:n,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:a,focusedItemIndex:s,onFocusedIndexChange:l,legendInteraction:c,metrics:u})=>{let d=24;const h=[];return e.forEach((e,f)=>{d+=5,h.push(kt("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(kt("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(kt("g",{className:"legend-item",transform:`translate(0,${d})`,children:Pt(e,o,n,r,i,a,s,f,l,c,u)},"legend-group-"+f)),d+=e.items.length*u.rowHeight+8}),h})({legendGroups:t||[],width:l,customClickBehavior:o,customHoverBehavior:n,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:g,onFocusedIndexChange:y,legendInteraction:a,metrics:h}):(({legendGroups:e,height:t,width:o,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:s,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u,metrics:d})=>{let h=0;const f=[];e.forEach((e,t)=>{let m=0;e.label&&(m+=16);const g=((e,t,o,n,r,i,a,s,l,c,u,d)=>{const{type:h="fill",styleFn:f,items:m}=e,g=[],{swatchSize:p,labelGap:y,itemGap:b,rowHeight:v,align:x}=u,w=!(!t&&!o),k="isolate"===c||void 0===c&&null!=r,S=m.map(e=>p+y+7*e.label.length),A=[];let M=0,_=0;S.forEach((e,t)=>{const o=0===_?e:_+b+e;d&&d>0&&_>0&&o>d?(A.push({start:M,end:t,width:_}),M=t,_=e):_=o}),m.length>0&&A.push({start:M,end:m.length,width:_}),A.forEach((e,c)=>{let u="center"===x?Math.max(0,((d??e.width)-e.width)/2):"end"===x?Math.max(0,(d??e.width)-e.width):0;for(let d=e.start;e.end>d;d++){const e=m[d],x=Mt(e,d,h,f,p),A=Ct(e,n,r),M=r&&r.size>0&&r.has(e.label);g.push(St("g",{transform:`translate(${u},${c*v})`,onClick:t?()=>t(e):void 0,onMouseEnter:o?()=>o(e):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:w?s===i&&d===a?0:-1:void 0,role:w?"option":void 0,"aria-selected":w&&k?M||!1:void 0,"aria-current":w&&!k&&null!=n&&e.label===n||void 0,"aria-label":e.label,onKeyDown:w?o=>{if("Enter"!==o.key&&" "!==o.key||(o.preventDefault(),t&&t(e)),"ArrowRight"===o.key||"ArrowLeft"===o.key){o.preventDefault();const e=(d+("ArrowRight"===o.key?1:-1)+m.length)%m.length;l(s,e);const t=o.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:w?t=>{l(s,d),o&&o(e);const n=t.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:w?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:w?"pointer":"default",opacity:A,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[w&&kt("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:p+y+2+7*e.label.length,height:p+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),x,M&&kt(_t,{swatchSize:p}),kt("text",{y:p/2,x:p+y,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+d)),u+=S[d]+b}});const C=Math.max(0,...A.map(e=>e.width)),P=A.length;return{items:g,offset:C,totalRows:P,totalHeight:P*v}})(e,n,r,i,a,s,l,t,c,u,d,d.maxWidth??o);m+=g.offset+5,f.push({label:e.label,...g,offset:m,totalRows:g.totalRows,totalHeight:g.totalHeight}),h+=m+12});const m=d.maxWidth??o;let g=h>m?0:"center"===d.align?Math.max(0,(m-h)/2):"end"===d.align?Math.max(0,m-h):0;const p=[];return f.forEach((o,n)=>{const r=e[n];r.label&&(p.push(kt("text",{transform:`translate(${g},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:r.label},"legend-text-"+n)),g+=16),p.push(kt("g",{className:"legend-item",transform:`translate(${g},0)`,children:o.items},"legend-group-"+n)),g+=o.offset+5,e[n+1]&&p.push(kt("line",{stroke:"gray",x1:g,y1:-8,x2:g,y2:(o.totalHeight||t)+0+8},"legend-top-line legend-symbol-"+n)),g+=12}),kt("g",{children:p})})({legendGroups:t||[],title:s,height:c,width:l,customClickBehavior:o,customHoverBehavior:n,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:g,onFocusedIndexChange:y,legendInteraction:a,metrics:h}),v=!(!o&&!n);return St("g",{role:v?"listbox":void 0,"aria-multiselectable":!(!v||"isolate"!==a&&(void 0!==a||null==i))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==s&&""!==s&&"vertical"===u&&kt("text",{className:"legend-title",y:16,x:l/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:s}),b]})}function It(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}import{jsx as Tt}from"react/jsx-runtime";function $t(e){const{legend:t,totalWidth:o,totalHeight:n,margin:r,legendPosition:i="right",legendLayout:a,title:s,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=e;if(!t)return null;const f="top"===i||"bottom"===i,m=!!s,g=Math.max(0,o-r.left-r.right),p=Math.max(1,f?a?.maxWidth??g:100);let y,b;return"left"===i?(y=Math.max(4,r.left-p-10),b=r.top):"top"===i?(y=r.left,b=m?32:8):"bottom"===i?(y=r.left,b=n-r.bottom+38):(y=o-r.right+10,b=r.top),Tt("g",{transform:`translate(${y}, ${b})`,children:(v=t,"object"==typeof v&&null!==v&&"gradient"in v?Tt(Lt,{config:t.gradient,orientation:f?"horizontal":"vertical",width:p}):It(t)?Tt(Rt,{legendGroups:t.legendGroups,title:"",width:p,orientation:f?"horizontal":"vertical",legendLayout:a,customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):t)});var v}import*as Bt from"react";import{jsx as Ht,jsxs as Ot}from"react/jsx-runtime";function jt(e,t=120,o=8){if(!e)return[];const n=Math.max(1,Math.floor(t/o)),r=e.split(/\s+/),i=[];let a="";for(const e of r)a&&a.length+1+e.length>n?(i.push(a),a=e):a=a?`${a} ${e}`:e;return a&&i.push(a),i}function Dt(e,t,o,n){return"curly"===e?n?`M0,0 C${.6*o},0 ${.4*o},${t/2} ${o},${t/2} C${.4*o},${t/2} ${.6*o},${t} 0,${t}`:`M0,0 C0,${.6*o} ${t/2},${.4*o} ${t/2},${o} C${t/2},${.4*o} ${t},${.6*o} ${t},0`:n?`M0,0 L${o},0 L${o},${t} L0,${t}`:`M0,0 L0,${o} L${t},${o} L${t},0`}function Ft(e,t,o,n){if(!e)return Ht("g",{className:"annotation-note"});const{label:r,title:i,orientation:a,align:s,wrap:l=120,noWrap:c}=e;if(!r&&!i)return Ht("g",{className:"annotation-note"});let u=a;u||(u=Math.abs(t)>Math.abs(o)?"leftRight":"topBottom");let d=s;d&&"dynamic"!==d||(d="topBottom"===u?0>t?"right":"left":0>o?"bottom":"top");let h="start";"topBottom"===u?"right"===d?h="end":"middle"===d&&(h="middle"):h=0>t?"end":"start";const f=16,m=i?c?[i]:jt(i,l):[],g=r?c?[r]:jt(r,l):[],p="leftRight"===u?"end"===h?-4:4:0;let y=0;const b=[],v=n||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";e.useHTML||e.html?b.push(Ht("foreignObject",{className:"annotation-note-html",x:"end"===h?p-l:"middle"===h?p-l/2:p,y:-16,width:l,height:Math.max(f,(m.length+g.length)*f+(i&&r?2:0))+f,style:{overflow:"visible"},children:Ot("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{color:v,fontSize:"12px",lineHeight:"16px",overflow:"visible",textAlign:"end"===h?"right":"middle"===h?"center":"left",whiteSpace:c?"nowrap":"normal",wordBreak:"break-word"},children:[i&&Ht("div",{className:"annotation-note-title",style:{fontWeight:"bold"},children:i}),r&&Ht("div",{className:"annotation-note-label",children:r})]})},"annotation-note-html")):(m.length>0&&(b.push(Ht("text",{className:"annotation-note-title",fill:v,textAnchor:h,fontWeight:"bold",children:m.map((e,t)=>Ht("tspan",{x:p,dy:0===t?0:f,children:e},t))},"annotation-note-title")),y=m.length*f),g.length>0&&b.push(Ht("text",{className:"annotation-note-label",fill:v,textAnchor:h,y:y,children:g.map((e,t)=>Ht("tspan",{x:p,dy:0===t?0:f,children:e},t))},"annotation-note-label")));let x=null;if((i||r)&&(0!==t||0!==o))if("topBottom"===u){const e=Math.min(l,120);let t=0,o=e;"end"===h?(t=-e,o=0):"middle"===h&&(t=-e/2,o=e/2),x=Ht("line",{className:"note-line",x1:t,x2:o,y1:0,y2:0,stroke:n||"var(--semiotic-text-secondary, currentColor)"})}else{const e=(m.length+g.length)*f+(g.length>0?f:0);let t=0,o=e;"bottom"===d?(t=-e,o=0):"middle"===d&&(t=-e/2,o=e/2),x=Ht("line",{className:"note-line",x1:0,x2:0,y1:t,y2:o,stroke:n||"var(--semiotic-text-secondary, currentColor)"})}const w=Math.max(0,m.length+g.length-1)*f;let k=0;return"topBottom"===u?k=0>o?-(w+2):18:"leftRight"===u&&(k="middle"===d?-(w+f+(g.length>0&&m.length>0?2:0))/2+8:"bottom"===d||0>o?-(w+2):18),Ot("g",{className:"annotation-note",transform:`translate(${t},${o})`,children:[Ht("g",{className:"annotation-note-content",transform:0!==k?`translate(0,${k})`:void 0,children:b}),x]})}function Et(e,t,o,n,r){const i=[];switch(e){case"callout-circle":{const e=(t?.radius||0)+(t?.radiusPadding||0);e>0&&i.push(Ht("circle",{r:e,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const e=t?.width||0,n=t?.height||0;(e>0||n>0)&&i.push(Ht("rect",{width:e,height:n,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":t?.custom&&i.push(...Array.isArray(t.custom)?t.custom:[t.custom]);break;case"xy-threshold":{const e=n||0,a=r||0;if(void 0!==t?.x){const n=(t.x||0)-e;i.push(Ht("line",{x1:n,y1:(t.y1||0)-a,x2:n,y2:(t.y2||0)-a,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==t?.y){const n=(t.y||0)-a;i.push(Ht("line",{x1:(t.x1||0)-e,y1:n,x2:(t.x2||0)-e,y2:n,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==t?.x1||void 0!==t?.x2?i.push(Ht("line",{x1:(t.x1||0)-e,y1:0,x2:(t.x2||0)-e,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===t?.y1&&void 0===t?.y2||i.push(Ht("line",{x1:0,y1:(t.y1||0)-a,x2:0,y2:(t.y2||0)-a,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const e=t?.type||"curly",n=t?.width??t?.height;void 0!==n&&i.push(Ht("path",{d:Dt(e,n,t?.depth||30,void 0===t?.width),fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return Ht("g",{className:"annotation-subject",children:i})}function zt(e,t,o,n,r,i){const a=[];let s=0,l=0;if("callout-circle"!==r&&"label"!==r||!i?.radius){if("callout-rect"===r&&i){const o=i.width||0,n=i.height||0;if(o>0||n>0){const r=o/2,i=n/2,a=e-r,c=t-i;if(0!==a||0!==c){const e=Math.abs(a),t=Math.abs(c),u=o/2,d=n/2,h=e*d>t*u?u/e:d/t;s=r+a*h,l=i+c*h}}}else if("bracket"===r&&i){const e=i.width,t=i.height,o=i.depth||30;void 0!==e?(s=e/2,l=o):void 0!==t&&(s=o,l=t/2)}}else{const o=(i.radius||0)+(i.radiusPadding||0);if(o>0&&(0!==e||0!==t)){const n=Math.atan2(t,e);s=Math.cos(n)*o,l=Math.sin(n)*o}}const c=Math.sqrt((e-s)**2+(t-l)**2);if(c>.5){const r=n||"var(--semiotic-text-secondary, currentColor)",i="curve"===o?.type;let u=Math.atan2(t-l,e-s);if(i){const n=(s+e)/2,i=(l+t)/2,d=-(t-l)/c,h=(e-s)/c,f=(o?.curve??.25)*c,m=n+d*f,g=i+h*f;a.push(Ht("path",{className:"connector-curve",d:`M${s},${l}Q${m},${g} ${e},${t}`,fill:"none",stroke:r},"connector-line")),u=Math.atan2(g-l,m-s)}else a.push(Ht("line",{x1:s,y1:l,x2:e,y2:t,stroke:r},"connector-line"));if("arrow"===o?.end){const e=10,t=16/180*Math.PI;a.push(Ht("path",{d:`M${s},${l}L${s+e*Math.cos(u+t)},${l+e*Math.sin(u+t)}L${s+e*Math.cos(u-t)},${l+e*Math.sin(u-t)}Z`,fill:r,stroke:"none"},"connector-arrow"))}}return Ht("g",{className:"annotation-connector",children:a})}function Nt(e){const{x:t=0,y:o=0,dx:n,dy:r,nx:i,ny:a,note:s,connector:l,subject:c,type:u,color:d,className:h,disable:f,opacity:m,strokeDasharray:g,events:p={},"data-testid":y}=e,b=Array.isArray(t)?t[0]??0:t,v=Array.isArray(o)?o[0]??0:o,x=new Set(Array.isArray(f)?f:[]);let w=n||0,k=r||0;null!=i&&(w=i-b),null!=a&&(k=a-v);const S="string"==typeof u?u:"label";if("bracket"===S&&c&&0===w&&0===k)if(void 0!==c.width){w=c.width/2;const e=c.depth||30;k=e+(0>e?-5:5)}else if(void 0!==c.height){const e=c.depth||30;w=e+(0>e?-5:5),k=c.height/2}return Ot("g",{className:("annotation "+(h||"")).trim(),transform:`translate(${b},${v})`,"data-testid":y,...null!=m&&{opacity:m},...g&&{strokeDasharray:g},...p,children:[!x.has("connector")&&zt(w,k,l,d,S,c),!x.has("subject")&&Et(S,c,d,b,v),!x.has("note")&&Ft(s,w,k,d)]})}function Wt(e){const{noteData:t}=e,{screenCoordinates:o}=t,n="string"==typeof t.type?t.type:"label",r=t.eventListeners||t.events||{};if(t.coordinates&&o){const e=t.nx||o[0][0]+(t.dx??0),r=t.ny||o[0][1]+(t.dy??0),i=o.map((o,i)=>{const a=Object.assign({},t,{note:0===i?t.note:{label:""},x:o[0],y:o[1],nx:e,ny:r});return Ht(Nt,{"data-testid":"semiotic-annotation",...a,type:n},"multi-annotation-"+i)});return Ht("g",{children:i})}const i=t.note||{title:"none",label:t.label},a=`${i.label}-${i.title}-${t.i}`;return Ht(Nt,{"data-testid":"semiotic-annotation",events:r,...t,type:n},a)}import{packEnclose as Gt}from"d3-hierarchy";import{area as qt,curveLinear as Vt,curveMonotoneX as Xt,curveMonotoneY as Yt,curveStep as Kt,curveStepAfter as Zt,curveStepBefore as Qt,curveBasis as Ut,curveCardinal as Jt,curveCatmullRom as eo}from"d3-shape";import to from"regression";function oo(e,t){const o=t.scales?.x??t.scales?.time;return o?null!=e.x?o(e.x):t.xAccessor&&null!=e[t.xAccessor]?o(e[t.xAccessor]):null:null}function no(e,t){const o=t.scales?.y??t.scales?.value;return o?null!=e.y?o(e.y):t.yAccessor&&null!=e[t.yAccessor]?o(e[t.yAccessor]):null:null}function ro(e){return null==e?null:e+""}function io(e,t,o){return t.stickyPositionCache?.set(e,o),o}function ao(e,t,o){const n=e.anchor||e.lifecycle?.anchor||"fixed";if("latest"===n){if(null!=e.pointId&&o.pointNodes&&o.pointNodes.length>0)for(let n=o.pointNodes.length-1;n>=0;n--){const r=o.pointNodes[n];if(r.pointId===e.pointId)return io(t,o,{x:r.x,y:r.y})}const n=function(e){const t=e.data;if(!t||0===t.length)return null;const o=t[t.length-1],n=e.scales?.x??e.scales?.time,r=e.scales?.y??e.scales?.value;if(!n||!r)return null;const i=o[e.xAccessor||"x"],a=o[e.yAccessor||"y"];return null==i||null==a?null:{x:n(i),y:r(a)}}(o);return n?io(t,o,n):null}if("semantic"===n){const n=function(e,t,o){const n=function(e){return ro(e.provenance?.stableId??e.stableId)}(e);if(!n)return null;const r=o.pointNodes?.find(e=>ro(e.pointId)===n);if(r)return io(t,o,{x:r.x,y:r.y});const i=o.data?.find(e=>function(e){return ro(e.stableId??e.id??e.provenance?.stableId)}(e)===n);if(!i)return null;const a=oo(i,o),s=no(i,o);return null==a||null==s?null:io(t,o,{x:a,y:s})}(e,t,o);if(n)return n}let r=null,i=null;if(null!=e.pointId&&o.pointNodes){const t=o.pointNodes.find(t=>t.pointId===e.pointId);t&&(r=t.x,i=t.y)}if(null!=r&&null!=i||(r=oo(e,o),i=no(e,o)),null!=r&&null!=i)return io(t,o,{x:r,y:i});if("sticky"===n){const e=o.stickyPositionCache?.get(t);if(e)return e}return null}function so(e,t,o,n=50){return!(-n>e||e>(o.width||0)+n||-n>t||t>(o.height||0)+n)}import{jsx as lo}from"react/jsx-runtime";var co={secondary:0,primary:3};function uo(e){return!0===e?._annotationDeferred}function ho(e){return"blended"===e?.cohesion||"layer"===e?.cohesion?e.cohesion:null}function fo(e){const t=e?.provenance?.confidence;return"number"==typeof t&&Number.isFinite(t)?Math.max(0,Math.min(1,t)):null}function mo(e){return Math.max(.72,.95-.06*e)}import{jsx as go,jsxs as po}from"react/jsx-runtime";var yo={linear:Vt,monotoneX:Xt,monotoneY:Yt,step:Kt,stepAfter:Zt,stepBefore:Qt,basis:Ut,cardinal:Jt,catmullRom:eo};var bo=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function vo(e){return!!e&&"object"==typeof e&&bo.has(function(e){return"string"==typeof e?.type?e.type:""}(e))}function xo(e){return"primary"===e?.emphasis||!0===e?.defensive}function wo(e,t,o={}){return"number"==typeof o.maxAnnotations&&Number.isFinite(o.maxAnnotations)?Math.max(0,Math.floor(o.maxAnnotations)):e>0&&t>0?Math.max(1,Math.round(e*t/(o.areaPerAnnotation&&o.areaPerAnnotation>0?o.areaPerAnnotation:2e4))):1/0}function ko(e){let t;const o=e?.emphasis;t="primary"===o?100:"secondary"===o?10:50;const n=e?.provenance?.confidence;switch("number"==typeof n&&Number.isFinite(n)&&(t+=15*Math.max(0,Math.min(1,n))),e?.lifecycle?.freshness){case"fresh":t+=8;break;case"aging":t+=4;break;case"stale":t+=1;break;case"expired":t-=200}return t}new Set(["label","callout","callout-circle","callout-rect"]);var So=32,Ao=6,Mo=4,_o=8,Co=72;var Po={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function Lo(e){if(!Ro(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 Ro(e){return vo(e)}function Io(e,t){if(!e)return[];const o=Math.max(1,Math.floor(t/7)),n=e.split(/\s+/).filter(Boolean),r=[];let i="";for(const e of n)i&&i.length+e.length+1>o?(r.push(i),i=e):i=i?`${i} ${e}`:e;return i&&r.push(i),r}function To(e,t,o,n,r){const i=e+o,a=t+n;return Math.abs(o)>Math.abs(n)?{x:0>o?i-r.width-4:i+4,y:0>n?a-r.height:a,width:r.width,height:r.height}:{x:0>o?i-r.width:i,y:0>n?a-r.height-4:a+4,width:r.width,height:r.height}}function $o(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function Bo(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 Ho(e,t,o,n,r,i,a,s){const l=$o(e,a);let c=.4*Math.hypot(t.dx,t.dy)+80*function(e,t,o,n){const r=Math.max(0,n-e.x),i=Math.max(0,n-e.y);return(r+Math.max(0,e.x+e.width-(t-n)))*e.height+(i+Math.max(0,e.y+e.height-(o-n)))*e.width}(l,r,i,s);for(const e of o)c+=12*Bo(l,e);for(const e of n)c+=4*Bo(l,e);return c}function Oo(e){const{annotations:t,context:o,defaultOffset:n=So,notePadding:r=Ao,markPadding:i=Mo,edgePadding:a=_o,preserveManualOffsets:s=!0,routeLongConnectors:l=!0,connectorThreshold:c=Co,density:u,progressiveDisclosure:d=!1,redundantCues:h=!1,responsive:f,mobile:m,cohesion:g,audience:p}=e,y=o.width||0,b=o.height||0,v="object"==typeof m?m:{},x=v.breakpoint??480,w=!!m&&x>=y,k=w&&!1!==v.preferShortText?t.map(Lo):t,S=w&&!u?{maxAnnotations:v.maxAnnotations??("callout-list"===v.strategy?1:2),minVisible:v.minVisible??1}:u,A=d||w&&(!1!==v.progressiveDisclosure||"callout-list"===v.strategy),M=w&&!f?v.responsive??{minWidth:x}:f,_=w&&!g?v.cohesion:g;if(0===k.length||0>=y||0>=b)return k.slice();const C=[],P=function(e,t){return(e.pointNodes||[]).map(e=>{const o=Math.max(1,e.r||1)+t;return{x:e.x-o,y:e.y-o,width:2*o,height:2*o}})}(o,i);let L=!1;const R=k.map((e,t)=>{if(!Ro(e))return e;const i=function(e,t,o){if("widget"===e.type&&"number"==typeof e.px&&"number"==typeof e.py)return{x:e.px,y:e.py};const n=e.pointId??e.nodeId;if(null!=n&&o.pointNodes){const e=o.pointNodes.find(e=>e.pointId===n);if(e)return{x:e.x,y:e.y}}const r=e.coordinates,i=o.scales?.geoProjection;if(Array.isArray(r)&&r.length>=2&&i){const e=r[0],t=r[1];if("number"==typeof e&&"number"==typeof t){const o=i([e,t]);if(o&&"number"==typeof o[0]&&"number"==typeof o[1])return{x:o[0],y:o[1]}}}return o.scales||"number"!=typeof e.x||"number"!=typeof e.y?ao(e,t,o):{x:e.x,y:e.y}}(e,t,o);if(!i)return e;const u=function(e){if("widget"===e.type)return{width:"number"==typeof e.width?e.width:32,height:"number"==typeof e.height?e.height:32};const t="number"==typeof e.wrap?e.wrap:120,o=[...Io("string"==typeof e.title?e.title:void 0,t),...Io("string"==typeof e.label?e.label:void 0,t)],n=o.reduce((e,t)=>Math.max(e,t.length),0);return{width:Math.max(24,Math.min(t,7*n)+10),height:Math.max(18,16*o.length+6)}}(e);if(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 C.push($o(To(i.x,i.y,"number"==typeof e.dx?e.dx:t.dx,"number"==typeof e.dy?e.dy:t.dy,u),r)),e}var d;let h=null,f=1/0;for(const e of function(e){const t=1.6*e;return[{dx:e,dy:-e},{dx:-e,dy:-e},{dx:e,dy:e},{dx:-e,dy:e},{dx:e,dy:0},{dx:-e,dy:0},{dx:0,dy:-e},{dx:0,dy:e},{dx:t,dy:-t},{dx:-t,dy:-t},{dx:t,dy:t},{dx:-t,dy:t}]}(n)){const t=Ho(To(i.x,i.y,e.dx,e.dy,u),e,C,P,y,b,r,a);f>t&&(h=e,f=t)}if(!h)return e;const m=$o(To(i.x,i.y,h.dx,h.dy,u),r);C.push(m);const g=Math.hypot(h.dx,h.dy),p=l&&g>=c&&"text"!==e.type&&"widget"!==e.type?{...e.connector||{end:"arrow"},type:"curve"}:e.connector;return L=!0,{...e,dx:h.dx,dy:h.dy,...p?{connector:p}:{}}}),I=L?R:k.slice();let T=I;if(h){let e=!1;const t=I.map(t=>{const o=function(e){return"text"!==e.type||"string"!=typeof e.color||8>Math.hypot("number"==typeof e.dx?e.dx:0,"number"==typeof e.dy?e.dy:0)?e:{...e,_redundantConnector:!0}}(t);return o!==t&&(e=!0),o});T=e?t:I}{let e=!1;const t=T.map(t=>{if(!0!==t?.defensive)return t;const o=function(e){const t=e?.provenance;if(!t||"object"!=typeof t)return e;const o="string"==typeof t.source?Po[t.source]??t.source:null,n="number"==typeof t.confidence&&Number.isFinite(t.confidence)?Math.round(100*Math.max(0,Math.min(1,t.confidence)))+"%":null;if(!o&&!n)return e;if(null!=e.label&&"string"!=typeof e.label)return e;const r=[o,n].filter(Boolean).join(" · "),i="string"==typeof e.label?e.label:"";return i.includes(`(${r})`)?e:{...e,label:i?`${i} (${r})`:`(${r})`}}(t);return o!==t&&(e=!0),o});T=e?t:T}const $=new Set;if(S){const e="object"==typeof S?S:{},t=function(e){if(!e)return 1;const t=function(e){const t=e?.familiarity;if(!t)return 3;const o=Object.values(t).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0===o.length?3:o.reduce((e,t)=>e+t,0)/o.length}(e);return t>2?4>t?1:.6:1.5}(p),o=1===t?e:{...e,maxAnnotations:Math.max(0,Math.round((e.maxAnnotations??wo(y,b,e))*t))},{deferred:n}=function(e){const{annotations:t,width:o,height:n}=e,r=Math.max(0,e.minVisible??1),i=wo(o,n,e),a=t.map((e,t)=>{return{annotation:e,index:t,note:(o=e,vo(o))};var o}),s=a.filter(e=>e.note);if(0===s.length||i>=s.length)return{visible:t.slice(),deferred:[],budget:i};const l=s.filter(e=>xo(e.annotation)),c=s.filter(e=>!xo(e.annotation)).sort((e,t)=>ko(t.annotation)-ko(e.annotation)||e.index-t.index),u=Math.min(c.length,Math.max(Math.max(0,i-l.length),Math.max(0,r-l.length))),d=new Set([...l.map(e=>e.index),...c.slice(0,u).map(e=>e.index)]),h=[],f=[];for(const{annotation:e,index:t,note:o}of a)!o||d.has(t)?h.push(e):f.push(e);return{visible:h,deferred:f,budget:i}}({annotations:T,width:y,height:b,...o});for(const e of n)$.add(e)}if(M&&("object"==typeof M&&"number"==typeof M.minWidth?M.minWidth:480)>=y)for(const e of T)Ro(e)&&"secondary"===e.emphasis&&$.add(e);if($.size>0)for(const e of T)!0===e?.defensive&&$.delete(e);let B;return B=0===$.size?T:A?T.map(e=>$.has(e)?{...e,_annotationDeferred:!0}:e):T.filter(e=>!$.has(e)),_?function(e,t){let o=!1;const n=e.map(e=>Ro(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(o=!0,{...e,cohesion:t}):e);return o?n:e}(B,_):B}function jo(e,t,o){return"exact"===o?function(e,t){const o=e.domain(),n=o[0],r=o[o.length-1],i=n instanceof Date,a=n instanceof Date?n.getTime():n,s=r instanceof Date?r.getTime():r;if(2>t||a===s)return i?[new Date(a),new Date(s)]:[a,s];const l=(s-a)/(t-1),c=Array(t);for(let e=0;t>e;e++){const o=e===t-1?s:a+e*l;c[e]=i?new Date(o):o}return c}(e,t):e.ticks(t)}import{Fragment as Do,jsx as Fo,jsxs as Eo}from"react/jsx-runtime";function zo(e){const{width:t,height:o,totalWidth:n,totalHeight:r,margin:i,scales:a,showAxes:s,showGrid:l,rFormat:c}=e,{rTickValues:u,axisExtent:d}=e,h="radial"===a?.projection,f="horizontal"===a?.projection,m=vt(()=>!a||h?[]:(u||jo(a.r,5,d)).map(e=>({value:e,pixel:a.r(e),label:(c||No)(e)})),[a,c,h,u,d]),g=l&&a&&!h,p=s&&a&&!h;return g||p?Fo("svg",{width:n,height:r,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:Eo("g",{transform:`translate(${i.left},${i.top})`,children:[g&&Fo("g",{className:"ordinal-grid",children:m.map((e,n)=>Fo("line",{x1:f?e.pixel:0,y1:f?0:e.pixel,x2:f?e.pixel:t,y2:f?o:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+n))}),p&&Fo(Do,{children:Eo(Do,f?{children:[Fo("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),Fo("line",{x1:0,y1:o,x2:t,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]}:{children:[Fo("line",{x1:0,y1:o,x2:t,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),Fo("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]})})]})}):null}function No(e){return Math.round(100*e)/100+""}function Wo(e){const{width:t,height:o,totalWidth:n,totalHeight:r,margin:i,scales:a,showAxes:s,showCategoryTicks:l,oLabel:c,rLabel:u,oFormat:d,rFormat:h,showGrid:f,title:m,legend:g,legendHoverBehavior:p,legendClickBehavior:y,legendHighlightedCategory:b,legendIsolatedCategories:v,legendPosition:x="right",legendLayout:w,foregroundGraphics:k,annotations:S,autoPlaceAnnotations:A,svgAnnotationRules:M,xAccessor:_,yAccessor:C,annotationData:P,underlayRendered:L,children:R}=e,I="radial"===a?.projection,T="horizontal"===a?.projection,$=!1!==l,B=vt(()=>{if(!s||!$||!a||I)return[];const e=a.o.bandwidth(),t=a.o.domain().map((t,o)=>({value:t,pixel:(a.o(t)??0)+e/2,label:d?d(t,o):t}));if(2>=t.length)return t;const o=Math.abs(t[1].pixel-t[0].pixel)||e;let n,r=0,i=!1;for(const e of t)"string"==typeof e.label?r=Math.max(r,e.label.length):"number"==typeof e.label?r=Math.max(r,(e.label+"").length):i=!0;n=T?i?24:16:Math.max(6.5*r,i?60:0)+6;const l=Math.max(1,Math.ceil(n/o));return 1===l?t:t.filter((e,t)=>t%l===0)},[s,$,a,d,I,T]),H=e.rTickValues,O=e.tickLabelEdgeAlign,j=e.axisExtent,D=vt(()=>s&&a&&!I?(H||jo(a.r,5,j)).map(e=>({value:e,pixel:a.r(e),label:(h||No)(e)})):[],[s,a,h,I,H,j]),F=xt(new Map),E=xt(S?.length??0),z=S?.length??0;E.current!==z&&(E.current=z,F.current=new Map);const N=vt(()=>{if(!S||0===S.length)return null;const e=function(e,t,o){switch(e.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const n=ao(e,t,o);if(!n)return null;const{x:r,y:i}=n;if(!so(r,i,o))return null;const a="callout"===e.type?"callout-circle":e.type,s="callout-circle"===a?{radius:e.radius??12,radiusPadding:e.radiusPadding}:"callout-rect"===a?{width:e.width,height:e.height}:void 0;return go(Wt,{noteData:{x:r,y:i,dx:e.dx??30,dy:e.dy??-30,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:a,...s?{subject:s}:{},connector:e.connector||{end:"arrow"},color:e.color,disable:e.disable,opacity:e.opacity,strokeDasharray:e.strokeDasharray,className:e.className}},"ann-"+t)}case"x-threshold":{const n=oo(null!=e.value?{...e,x:e.value}:e,o);if(null==n)return null;const r=e.color||"#f97316",i=e.labelPosition||"top";let a;a="bottom"===i?(o.height||0)-4:"center"===i?(o.height||0)/2:12;const s=n>.6*(o.width||0),l=s?n-4:n+4,c=s?"end":"start";return po("g",{opacity:e.opacity,children:[go("line",{x1:n,y1:0,x2:n,y2:o.height||0,stroke:r,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&go("text",{x:l,y:a,textAnchor:c,fill:r,fontSize:12,fontWeight:"bold",stroke:"var(--semiotic-bg, #ffffff)",strokeWidth:3,paintOrder:"stroke",children:e.label})]},"ann-"+t)}case"y-threshold":{const n=no(null!=e.value?{...e,y:e.value}:e,o);if(null==n)return null;const r=e.color||"#f97316",i=e.labelPosition||"right";let a,s;return"left"===i?(a=4,s="start"):"center"===i?(a=(o.width||0)/2,s="middle"):(a=(o.width||0)-4,s="end"),po("g",{opacity:e.opacity,children:[go("line",{x1:0,y1:n,x2:o.width||0,y2:n,stroke:r,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&go("text",{x:a,y:n-4,textAnchor:s,fill:r,fontSize:12,fontWeight:"bold",stroke:"var(--semiotic-bg, #ffffff)",strokeWidth:3,paintOrder:"stroke",children:e.label})]},"ann-"+t)}case"enclose":{const n=(e.coordinates||[]).map(e=>({x:oo({...e,type:"point"},o),y:no({...e,type:"point"},o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>n.length)return null;const r=Gt(n),i=e.padding||10;return po("g",{children:[go("circle",{cx:r.x,cy:r.y,r:r.r+i,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&go("text",{x:r.x,y:r.y-r.r-i-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:e.label})]},"ann-"+t)}case"rect-enclose":{const n=(e.coordinates||[]).map(e=>({x:oo({...e,type:"point"},o),y:no({...e,type:"point"},o)})).filter(e=>null!=e.x&&null!=e.y);if(2>n.length)return null;const r=e.padding||10,i=n.map(e=>e.x),a=n.map(e=>e.y),[s,l]=fe(i),[c,u]=fe(a),d=s-r,h=l+r,f=c-r;return po("g",{children:[go("rect",{x:d,y:f,width:h-d,height:u+r-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&&go("text",{x:(d+h)/2,y:f-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:e.label})]},"ann-"+t)}case"highlight":{const n=o.data||[],r="function"==typeof e.filter?n.filter(e.filter):e.field&&null!=e.value?n.filter(t=>t[e.field]===e.value):[],i={stroke:e.color||"#f97316",strokeWidth:2,fill:"none"};return go("g",{children:r.map((t,n)=>{const r=oo(t,o),a=no(t,o);if(null==r||null==a)return null;const s="function"==typeof e.r?e.r(t):e.r||6,l="function"==typeof e.style?e.style(t):e.style||i;return go("circle",{cx:r,cy:a,r:s,...l},"hl-"+n)})},"ann-"+t)}case"bracket":{const n=oo(e,o),r=no(e,o);return go(Wt,{noteData:{x:n??0,y:r??0,dx:e.dx||0,dy:e.dy||0,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"bracket",subject:{type:e.bracketType||"curly",width:e.width,height:e.height,depth:e.depth||30},color:e.color}},"ann-"+t)}case"trend":{const n=o.data||[];if(2>n.length)return null;const r=o.xAccessor||"x",i=o.yAccessor||"y",a="ordinal"===o.frameType,s="horizontal"===o.projection,l=a?r:null,c=a?i:null;let u;const d=[],h=new Map;if(a&&l&&c){for(const e of n){const t=e[l];if(null==t)continue;const o=t+"";h.has(o)||(h.set(o,d.length),d.push(o))}u=n.map(e=>{const t=e[l],o=e[c];if(null==t||null==o)return null;const n=h.get(t+"");return null!=n?[n,+o]:null}).filter(e=>null!==e)}else u=n.map(e=>[e[r],e[i]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>u.length)return null;const f=o.scales?.x??o.scales?.time,m=o.scales?.y??o.scales?.value;if(!f||!m)return null;const g=e=>t=>{const o=Math.max(0,Math.floor(t)),n=Math.min(d.length-1,o+1),r=t-o,i=e(d[o]);return i+(e(d[n])-i)*r},p=f,y=m;let b;if(a)if(s){const e=g(y);b=(t,o)=>[p(o),e(t)]}else{const e=g(p);b=(t,o)=>[e(t),y(o)]}else b=(e,t)=>[p(e),y(t)];const v=e.method||"linear";let x;x="loess"===v?function(e,t=.3){const o=e.length;if(2>o)return e.slice();const n=e.slice().sort((e,t)=>e[0]-t[0]),r=n.map(e=>e[0]),i=n.map(e=>e[1]),a=Math.max(2,Math.ceil(t*o)),s=[];for(let e=0;o>e;e++){const t=r[e],n=r.map(e=>Math.abs(e-t)),l=n.slice().sort((e,t)=>e-t)[Math.min(a-1,o-1)]||1,c=[];for(let e=0;o>e;e++){const t=0===l?0:n[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,f=0,m=0;for(let e=0;o>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*r[e],h+=t*i[e],f+=t*r[e]*r[e],m+=t*r[e]*i[e])}if(0===u){s.push([t,i[e]]);continue}const g=u*f-d*d;if(1e-12>Math.abs(g))s.push([t,h/u]);else{const e=(u*m-d*h)/g;s.push([t,(h-e*d)/u+e*t])}}return s}(u,e.bandwidth??.3):("polynomial"===v?to.polynomial(u,{order:e.order||2}):to.linear(u)).points;const w=x.map(([e,t])=>{const[o,n]=b(e,t);return`${o},${n}`}).join(" "),k=e.color||"#6366f1",S=x[x.length-1],[A,M]=b(S[0],S[1]);return po("g",{children:[go("polyline",{points:w,fill:"none",stroke:k,strokeWidth:e.strokeWidth||2,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&go("text",{x:A+4,y:M-4,fill:k,fontSize:11,children:e.label})]},"ann-"+t)}case"band":{const n=o.scales?.y??o.scales?.value,r=n?.(e.y0)??0,i=n?.(e.y1)??(o.height||0);return po("g",{opacity:e.opacity,children:[go("rect",{x:0,y:Math.min(r,i),width:o.width||0,height:Math.abs(i-r),fill:e.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:e.fillOpacity||.1}),e.label&&go("text",{x:(o.width||0)-4,y:Math.max(Math.min(r,i),0)+13,textAnchor:"end",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",stroke:"var(--semiotic-bg, #ffffff)",strokeWidth:3,paintOrder:"stroke",children:e.label})]},"ann-"+t)}case"x-band":{const n=o.scales?.x??o.scales?.time,r=null!=e.x0&&n?n(e.x0):null,i=null!=e.x1&&n?n(e.x1):null;return null==r||null==i?null:po("g",{opacity:e.opacity,children:[go("rect",{x:Math.min(r,i),y:0,width:Math.abs(i-r),height:o.height||0,fill:e.fill||e.color||"var(--semiotic-primary, #6366f1)",fillOpacity:e.fillOpacity??.1}),e.label&&go("text",{x:Math.min(r,i)+4,y:13,textAnchor:"start",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",stroke:"var(--semiotic-bg, #ffffff)",strokeWidth:3,paintOrder:"stroke",children:e.label})]},"ann-"+t)}case"envelope":{const n=o.data||[];if(2>n.length)return null;const r=o.xAccessor||"x",i=o.scales?.x??o.scales?.time,a=o.scales?.y??o.scales?.value;if(!i||!a)return null;const s=e.upperAccessor||"upperBounds",l=e.lowerAccessor||"lowerBounds",c=e.filter,u=n.filter(e=>null!=e[s]&&null!=e[l]&&!(c&&!c(e))).sort((e,t)=>e[r]-t[r]);if(2>u.length)return null;const d=yo[o.curve||"linear"]||Vt,h=qt().x(e=>i(e[r])).y0(e=>a(e[l])).y1(e=>a(e[s])).curve(d)(u);if(!h)return null;const f=e.fill||"#6366f1";return po("g",{children:[go("path",{d:h,fill:f,fillOpacity:e.fillOpacity??.15,stroke:"none"}),e.label&&u.length>0&&go("text",{x:i(u[u.length-1][r])+4,y:a(u[u.length-1][s])-4,fill:f,fontSize:11,children:e.label})]},"ann-"+t)}case"anomaly-band":{const n=o.data||[];if(2>n.length)return null;const r=o.yAccessor||"y",i=o.scales?.x??o.scales?.time,a=o.scales?.y??o.scales?.value;if(!i||!a)return null;const s=n.map(e=>e[r]).filter(e=>null!=e&&isFinite(e));if(2>s.length)return null;const l=s.reduce((e,t)=>e+t,0)/s.length,c=s.reduce((e,t)=>e+(t-l)**2,0)/s.length,u=Math.sqrt(c),d=e.threshold??2,h=l-d*u,f=!1!==e.showBand,m=e.fill||"#6366f1",g=e.fillOpacity??.1,p=e.anomalyColor||"#ef4444",y=e.anomalyRadius??6,b=a(l+d*u),v=a(h),x=n.filter(e=>{const t=e[r];return null!=t&&Math.abs(t-l)>d*u});return po("g",{children:[f&&go("rect",{x:0,y:Math.min(b,v),width:o.width||0,height:Math.abs(v-b),fill:m,fillOpacity:g}),x.map((e,t)=>{const n=oo(e,o),r=no(e,o);return null==n||null==r?null:go("circle",{cx:n,cy:r,r:y,fill:p,fillOpacity:.7,stroke:p,strokeWidth:1.5},"anomaly-"+t)}),e.label&&go("text",{x:(o.width||0)-4,y:Math.min(b,v)-4,textAnchor:"end",fill:m,fontSize:11,children:e.label})]},"ann-"+t)}case"forecast":{const n=o.data||[];if(3>n.length)return null;const r=o.xAccessor||"x",i=o.yAccessor||"y",a=o.scales?.x??o.scales?.time,s=o.scales?.y??o.scales?.value;if(!a||!s)return null;const l=n.map(e=>[e[r],e[i]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>l.length)return null;let c;if("polynomial"===(e.method||"linear")){const t=to.polynomial(l,{order:e.order||2}).equation;c=e=>t.reduce((t,o,n)=>t+o*Math.pow(e,n),0)}else{const e=l.length;let t=0,o=0,n=0,r=0;for(const[e,i]of l)t+=e,o+=i,n+=e*e,r+=e*i;const i=e*n-t*t;if(1e-12>Math.abs(i))return null;const a=(e*r-t*o)/i,s=(o-a*t)/e;c=e=>s+a*e}const u=l.length,d=l.map(([e,t])=>t-c(e)).reduce((e,t)=>e+t*t,0),h=Math.sqrt(d/Math.max(u-2,1)),f=l.reduce((e,t)=>e+t[0],0)/u,m=l.reduce((e,t)=>e+(t[0]-f)**2,0),g=e.confidence??.95,p=.99>g?.95>g?.9>g?1:1.645:1.96:2.576,y=e.steps??5,b=l[u-1][0],v=(b-l[0][0])/Math.max(u-1,1),x=[];for(let e=1;y>=e;e++)x.push(b+e*v);const w=[];for(const e of x){const t=c(e),o=h*Math.sqrt(1+1/u+(m>0?(e-f)**2/m:0))*p;w.push({x:e,yCenter:t,yUpper:t+o,yLower:t-o})}const k=`M${w.map(e=>`${a(e.x)},${s(e.yUpper)}`).join(" L")} L${w.slice().reverse().map(e=>`${a(e.x)},${s(e.yLower)}`).join(" L")} Z`,S=w.map(e=>`${a(e.x)},${s(e.yCenter)}`).join(" "),A=`${a(b)},${s(c(b))}`,M=e.strokeColor||"#6366f1";return po("g",{children:[go("path",{d:k,fill:e.fill||"#6366f1",fillOpacity:e.fillOpacity??.15,stroke:"none"}),go("polyline",{points:`${A} ${S}`,fill:"none",stroke:M,strokeWidth:e.strokeWidth??2,strokeDasharray:e.strokeDasharray??"6,3"}),e.label&&w.length>0&&go("text",{x:a(w[w.length-1].x)+4,y:s(w[w.length-1].yCenter)-4,fill:M,fontSize:11,children:e.label})]},"ann-"+t)}case"widget":{let n,r;if(null!=e.px&&null!=e.py)n=e.px,r=e.py;else{const i=ao(e,t,o);if(!i)return null;n=i.x,r=i.y}if(!so(n,r,o))return null;const i=e.width??32,a=e.height??32;return go("foreignObject",{x:n+(e.dx??0)-i/2,y:r+(e.dy??0)-a/2,width:i,height:a,style:{overflow:"visible",pointerEvents:"auto"},children:go("div",{style:{width:i,height:a,display:"flex",alignItems:"center",justifyContent:"center"},children:e.content??go("span",{style:{fontSize:18,cursor:"default"},title:e.label||"Info",children:"ℹ️"})})},"ann-"+t)}case"text":{const n=ao(e,t,o);if(!n)return null;const{x:r,y:i}=n,a=r+(e.dx||0),s=i+(e.dy||0),l=e.color||"var(--semiotic-text, #333)",c=go("text",{x:a,y:s,fill:l,fontSize:e.fontSize||11,opacity:e.opacity,strokeDasharray:e.strokeDasharray,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:e.label});return!0!==e._redundantConnector?Bt.cloneElement(c,{key:"ann-text-"+t}):po("g",{opacity:e.opacity,strokeDasharray:e.strokeDasharray,children:[go("line",{x1:r,y1:i,x2:a,y2:s,stroke:l,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),Bt.cloneElement(c,{opacity:void 0,strokeDasharray:void 0})]},"ann-text-"+t)}case"category-highlight":{const n=e.category;if(null==n)return null;const r=e=>"function"==typeof e&&"function"==typeof e.bandwidth,i=o.scales?.o,a=o.scales?.x,s=o.scales?.y,l=r(i)?i:r(a)?a:r(s)?s:null;if(!l)return null;const c=l(n+"");if(null==c)return null;const u=l.bandwidth(),d=e.color||"var(--semiotic-primary, #4589ff)",h=e.opacity??.15,f=e.label;return po("g",(o.projection?"vertical"===o.projection:l===a)?{children:[go("rect",{x:c,y:0,width:u,height:o.height||0,fill:d,fillOpacity:h}),f&&go("text",{x:c+u/2,y:12,textAnchor:"middle",fill:d,fontSize:12,fontWeight:"bold",children:f})]}:{children:[go("rect",{x:0,y:c,width:o.width||0,height:u,fill:d,fillOpacity:h}),f&&go("text",{x:12,y:c+u/2,dominantBaseline:"middle",fill:d,fontSize:12,fontWeight:"bold",children:f})]},"ann-"+t)}default:return null}},n="horizontal"===a?.projection,r=a?.o?e=>(a.o(e)??0)+a.o.bandwidth()/2:null,i={scales:a?{x:n?a.r:r||a.r,y:n&&r||a.r,time:a.r,value:a.r,o:a.o}:null,timeAxis:"x",xAccessor:_,yAccessor:C,width:t,height:o,data:P,frameType:"ordinal",projection:n?"horizontal":"vertical",stickyPositionCache:F.current};return function(e,t,o,n){const r=[];return e.forEach((e,i)=>{let a;if(o){const r=o(e,i,n);a=null!=r?r:t(e,i,n)}else a=t(e,i,n);a&&r.push({node:a,annotation:e})}),function(e){const t=e.map((e,t)=>{return{p:e,i:t,emphasis:(o=e.annotation,"primary"===o?.emphasis||"secondary"===o?.emphasis?o.emphasis:null),confidence:fo(e.annotation),readingOrder:null,rank:1};var o}),o=t.some(e=>null!=e.emphasis||null!=e.confidence),n=e.some(e=>uo(e.annotation)),r=e.some(e=>null!=ho(e.annotation)),i=e.some(e=>"layer"===ho(e.annotation));if(!o&&!n&&!r)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=co[e.emphasis]);const s=t.sort((e,t)=>e.rank-t.rank||e.i-t.i).map(e=>{const{p:t,i:o,emphasis:n,readingOrder:r}=e,i=uo(t.annotation);let a=t.node;if("primary"===n||"secondary"===n||null!=r){const e=null==n&&null!=r;a=lo("g",{className:e?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+n,..."secondary"===n?{opacity:.6,fontSize:"0.88em"}:{},...e?{opacity:mo(r),"data-annotation-reading-order":r}:{},children:t.node},"annotation-emphasis-"+o)}const s=ho(t.annotation);return s&&(a=lo("g",{className:"annotation-cohesion--"+s,children:a},"annotation-cohesion-"+o)),i&&(a=lo("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:a},"annotation-deferred-"+o)),a});return n&&s.unshift(lo("style",{children:".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}}"},"annotation-disclosure-style")),i&&s.unshift(lo("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}(r)}(A?Oo({annotations:S,context:i,..."object"==typeof A?A:{}}):S,e,M,i)},[S,A,M,t,o,a,_,C,P]);return s||m||g||k||N&&N.length>0||f||R?Eo("svg",{role:"img",width:n,height:r,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[Fo("title",{children:"string"==typeof m?m:"Ordinal Chart"}),Fo("desc",{children:"string"==typeof m?m+" — ordinal data visualization":"Ordinal data visualization"}),Eo("g",{transform:`translate(${i.left},${i.top})`,children:[f&&a&&!I&&!L&&Fo("g",{className:"ordinal-grid",children:D.map((e,n)=>Fo("line",{x1:T?e.pixel:0,y1:T?0:e.pixel,x2:T?e.pixel:t,y2:T?o:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+n))}),s&&a&&!I&&(()=>{const e={fontSize:"var(--semiotic-tick-font-size, 12px)"},n={fontSize:"var(--semiotic-axis-label-font-size, 12px)"};return Fo("g",{className:"ordinal-axes",children:Eo(Do,T?{children:[Eo("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[!L&&Fo("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),B.map((t,o)=>Eo("g",{transform:`translate(0,${t.pixel})`,children:[Fo("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?Fo("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label}):Fo("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:Fo("div",{style:{textAlign:"right",userSelect:"none",...e},children:t.label})})]},"cat-"+o)),c&&Fo("text",{x:15-i.left,y:o/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-i.left}, ${o/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...n},children:c})]}),Eo("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[!L&&Fo("line",{x1:0,y1:o,x2:t,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),!L&&a?.r&&(()=>{const e=a.r(0);return e>1&&t-1>e?Fo("line",{x1:e,y1:0,x2:e,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1,strokeDasharray:"4,4"}):null})(),D.map((t,n)=>{const r=O?0===n?"start":n===D.length-1?"end":"middle":"middle";return Eo("g",{transform:`translate(${t.pixel},${o})`,children:[Fo("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),Fo("text",{y:18,textAnchor:r,fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label})]},"val-"+n)}),u&&Fo("text",{x:t/2,y:o+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:{userSelect:"none",...n},children:u})]})]}:{children:[Eo("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[!L&&(()=>{const e=a?.r?a.r(0):o,n=0>e||e>o?o:e;return Fo("line",{x1:0,y1:n,x2:t,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),B.map((t,n)=>Eo("g",{transform:`translate(${t.pixel},${o})`,children:[Fo("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?Fo("text",{y:18,textAnchor:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label}):Fo("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:Fo("div",{style:{textAlign:"center",userSelect:"none",...e},children:t.label})})]},"cat-"+n)),c&&Fo("text",{x:t/2,y:o+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:{userSelect:"none",...n},children:c})]}),Eo("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[!L&&Fo("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),D.map((t,o)=>Eo("g",{transform:`translate(0,${t.pixel})`,children:[Fo("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),Fo("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label})]},"val-"+o)),u&&Fo("text",{x:15-i.left,y:o/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-i.left}, ${o/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...n},children:u})]})]})})})(),N,k,R]}),m&&Fo("text",{x:n/2,y:20,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:"string"==typeof m?m:null}),$t({legend:g,totalWidth:n,totalHeight:r,margin:i,legendPosition:x,title:m,legendLayout:w,legendHoverBehavior:p,legendClickBehavior:y,legendHighlightedCategory:b,legendIsolatedCategories:v})]}):null}function Go(e,t,o,n){return"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:o,fn:e}:"string"==typeof t?{key:t,fn:null}:"function"==typeof t?{key:n,fn:t}:{key:void 0,fn:null}}import{useRef as qo,useEffect as Vo}from"react";import{select as Xo}from"d3-selection";import{brushX as Yo,brushY as Ko}from"d3-brush";import*as Zo from"react";import{jsx as Qo,jsxs as Uo}from"react/jsx-runtime";function Jo({width:e,height:t,totalWidth:o,totalHeight:n,margin:r,scales:i,onBrush:a}){const s=qo(null),l=qo(null),c=qo(a);c.current=a;const u=qo(i);u.current=i;const d=qo(!1),h=qo(null),f="horizontal"===i?.projection,m=qo(f);m.current=f;const g=function({label:e="Data range brush",description:t="Use arrow keys to move the selected range, Shift plus an arrow key to resize it, and Escape to clear it.",onAction:o}={}){const n=Zo.useId().replace(/:/g,""),r=Zo.useRef(o);return r.current=o,{description:t,descriptionId:"semiotic-brush-description-"+n,svgProps:{role:"region",tabIndex:0,"aria-label":e,"aria-describedby":"semiotic-brush-description-"+n,onKeyDown:Zo.useCallback(e=>{const t=function(e){return"Escape"===e.key?{type:"clear"}:"ArrowLeft"===e.key?{type:"nudge",direction:"left",resize:e.shiftKey}:"ArrowRight"===e.key?{type:"nudge",direction:"right",resize:e.shiftKey}:"ArrowUp"===e.key?{type:"nudge",direction:"up",resize:e.shiftKey}:"ArrowDown"===e.key?{type:"nudge",direction:"down",resize:e.shiftKey}:null}(e);t&&(e.preventDefault(),r.current?.(t))},[])}}}({label:"Ordinal value range brush",onAction:e=>{const t=u.current,o=l.current;if(!t||!o||!s.current)return;const n=Xo(s.current).select(".brush-g");if("clear"===e.type)return d.current=!0,n.call(o.move,null),d.current=!1,h.current=null,void c.current(null);if(("left"===e.direction||"right"===e.direction)!=!!m.current)return;const r=t.r.domain(),[i,a]=[Math.min(...r),Math.max(...r)],f=(a-i)/20,g=h.current?.r??[i+.4*(a-i),i+.6*(a-i)],p="left"===e.direction||"down"===e.direction?-1:1;let[y,b]=g;if(e.resize)0>p?y=Math.max(i,y-f):b=Math.min(a,b+f);else{const e=b-y;y=Math.max(i,Math.min(a-e,y+p*f)),b=y+e}const v={r:[y,b]};d.current=!0,n.call(o.move,m.current?[t.r(y),t.r(b)]:[t.r(b),t.r(y)]),d.current=!1,h.current=v,c.current(v)}});return Vo(()=>{if(!s.current)return;const o=Xo(s.current).select(".brush-g"),n=f?Yo():Ko();return n.extent([[0,0],[e,t]]),n.on("brush end",e=>{if(d.current)return;const t=u.current;if(!t)return;if(!e.selection)return h.current=null,void c.current(null);const[o,n]=e.selection;let r;r=m.current?[t.r.invert(o),t.r.invert(n)]:[t.r.invert(n),t.r.invert(o)];const i={r:r};h.current=i,c.current(i)}),o.call(n),l.current=n,o.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{n.on("brush end",null),l.current=null}},[e,t,f]),Vo(()=>{if(!i||!l.current||!h.current)return;if(!s.current)return;const e=h.current,t=Xo(s.current).select(".brush-g"),o=i.r(e.r[0]),n=i.r(e.r[1]);f?(d.current=!0,t.call(l.current.move,[o,n]),d.current=!1):(d.current=!0,t.call(l.current.move,[n,o]),d.current=!1)},[i,f]),Uo("svg",{ref:s,width:o,height:n,...g.svgProps,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[Qo("title",{children:g.svgProps["aria-label"]}),Qo("desc",{id:g.descriptionId,children:g.description}),Qo("g",{className:"brush-g",transform:`translate(${r.left},${r.top})`,style:{pointerEvents:"all"}})]})}import*as en from"react";import{arc as tn}from"d3-shape";function on(e){return(e.tl??0)>0||(e.tr??0)>0||(e.br??0)>0||(e.bl??0)>0}function nn(e){const t=e.cornerRadii;if(!t)return{tl:0,tr:0,br:0,bl:0};const o=Math.min(e.w,e.h)/2,n=e=>Math.max(0,Math.min(e??0,o));return{tl:n(t.tl),tr:n(t.tr),br:n(t.br),bl:n(t.bl)}}var rn=(e,t)=>({x:e*Math.cos(t),y:e*Math.sin(t)});function an(e){const{innerRadius:t,outerRadius:o,startAngle:n,endAngle:r}=e,i=0>=t;if(0>=(e.cornerRadius??0)||!e.roundStart&&!e.roundEnd){if(i){const e=rn(o,n),t=rn(o,r);return`M0,0 L${e.x},${e.y} A${o},${o} 0 ${r-n>Math.PI?1:0} 1 ${t.x},${t.y} Z`}const e=rn(o,n),a=rn(o,r),s=rn(t,r),l=rn(t,n),c=r-n>Math.PI?1:0;return`M${e.x},${e.y} A${o},${o} 0 ${c} 1 ${a.x},${a.y} L${s.x},${s.y} A${t},${t} 0 ${c} 0 ${l.x},${l.y} Z`}const a=Math.max(0,Math.min(e.cornerRadius??0,(o-t)/2));if(0===a)return an({...e,cornerRadius:0,roundStart:!1,roundEnd:!1});const s=Math.asin(Math.min(1,a/Math.max(1e-9,o-a))),l=i?0:Math.asin(Math.min(1,a/Math.max(1e-9,t+a))),c=r-n,u=e.roundStart&&e.roundEnd?c/2:c,d=!!e.roundStart&&u>s,h=!!e.roundEnd&&u>s;if(!d&&!h)return an({...e,cornerRadius:0,roundStart:!1,roundEnd:!1});const f=n+(d?s:0),m=r-(h?s:0),g=n+(d?l:0),p=r-(h?l:0),y=rn(o,f),b=rn(o,m),v=(o-a)*Math.cos(s),x=rn(v,n),w=rn(v,r),k=i?null:rn(t,p),S=i?null:rn(t,g),A=i?0:(t+a)*Math.cos(l),M=i?null:rn(A,n),_=i?null:rn(A,r),C=m-f>Math.PI?1:0,P=i?0:p-g>Math.PI?1:0;let L="";if(d)L+=`M${x.x},${x.y}`,L+=` A${a},${a} 0 0 1 ${y.x},${y.y}`;else{const e=rn(o,n);L+=`M${e.x},${e.y}`}if(h)L+=` A${o},${o} 0 ${C} 1 ${b.x},${b.y}`,L+=` A${a},${a} 0 0 1 ${w.x},${w.y}`;else{const e=rn(o,r);L+=` A${o},${o} 0 ${C} 1 ${e.x},${e.y}`}if(i)L+=" L0,0";else{if(h)L+=` L${_.x},${_.y}`,L+=` A${a},${a} 0 0 1 ${k.x},${k.y}`;else{const e=rn(t,r);L+=` L${e.x},${e.y}`}if(d)L+=` A${t},${t} 0 ${P} 0 ${S.x},${S.y}`,L+=` A${a},${a} 0 0 1 ${M.x},${M.y}`;else{const e=rn(t,n);L+=` A${t},${t} 0 ${P} 0 ${e.x},${e.y}`}}return L+=" Z",L}function sn(e){const t=an({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle,endAngle:e.endAngle,cornerRadius:e.cornerRadius,roundStart:e.roundStart,roundEnd:e.roundEnd}),o=[],n=e.colors;if(n.length>0){const t=(e.endAngle-e.startAngle)/n.length;for(let r=0;n.length>r;r++)o.push({d:an({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle+r*t,endAngle:e.endAngle}),color:n[r]})}return{clipPath:t,slices:o}}import{jsx as ln,jsxs as cn}from"react/jsx-runtime";var un={innerRadius:0,outerRadius:0,startAngle:0,endAngle:0};function dn(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}function hn(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}var fn="undefined"==typeof window||"undefined"==typeof document;import{useEffect as mn,useLayoutEffect as gn,useRef as pn,useState as yn,useSyncExternalStore as bn}from"react";var vn="undefined"!=typeof window?gn:mn,xn=()=>()=>{},wn=()=>!1,kn=()=>!0;import{useRef as Sn}from"react";function An(e,t){const o=Object.keys(e),n=Object.keys(t);if(o.length!==n.length)return!1;for(const n of o){if(!Object.prototype.hasOwnProperty.call(t,n))return!1;if(!Object.is(e[n],t[n]))return!1}return!0}function Mn(e,t){if(e.length!==t.length)return!1;for(let o=0;e.length>o;o++)if(!Object.is(e[o],t[o]))return!1;return!0}function _n(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}var Cn=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,Pn=new WeakMap,Ln=0,Rn=!1,In=null,Tn=null;function $n(e,t){if(!t)return t;const o=Cn.exec(t);if(!o)return t;const n=e.canvas;if(!n)return o[2]?.trim()||t;!function(){if(Rn)return;if("undefined"==typeof window||"undefined"==typeof document)return;Rn=!0;const e=()=>{Ln++};if("undefined"!=typeof MutationObserver&&document.documentElement&&new MutationObserver(e).observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]}),"function"==typeof window.matchMedia)try{In=window.matchMedia("(prefers-color-scheme: dark)"),Tn=e,"function"==typeof In.addEventListener?In.addEventListener("change",Tn):"function"==typeof In.addListener&&In.addListener(Tn)}catch{}}();let r=Pn.get(n);r&&r.version===Ln||(r={version:Ln,map:new Map},Pn.set(n,r));const i=r.map.get(t);if(void 0!==i)return i;const a=getComputedStyle(n).getPropertyValue(o[1]).trim()||o[2]?.trim()||t;return r.map.set(t,a),a}import*as Bn from"react";import*as Hn from"react";import{jsx as On}from"react/jsx-runtime";var jn=Hn.createContext(null);function Dn(e){const t={};if(null==e||"object"!=typeof e)return t;for(const[o,n]of Object.entries(e))o.startsWith("_")||null!=n&&""!==n&&("number"==typeof n?Number.isFinite(n)&&(t[o]=n):"string"==typeof n?t[o]=n:"boolean"==typeof n?t[o]=n+"":n instanceof Date&&(t[o]=n.toISOString().slice(0,10)));return t}function Fn(e){return e&&"object"==typeof e?e:{}}function En(e){return Fn(e.accessibility).tableFields??e.accessibleDatum??e.datum}import{jsx as zn,jsxs as Nn}from"react/jsx-runtime";var Wn={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function Gn(e,t){if(!e||0===e.length)return t+", empty";const o={};for(const t of e){if(null===t?.datum)continue;const e=t.type+"";o[e]=(o[e]||0)+1}if(0===Object.keys(o).length)return t+", empty";const n=[],r={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},i=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],a=Object.keys(o).sort((e,t)=>{const o=i.indexOf(e),n=i.indexOf(t);return(-1===o?999:o)-(-1===n?999:n)});for(const e of a)n.push(`${o[e]} ${r[e]||e}`);return`${t}, ${n.join(", ")}`}var qn=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},Vn="semiotic-accessible-data-table",Xn=Vn+" semiotic-accessible-data-table-hidden",Yn=Vn+" semiotic-accessible-data-table-visible",Kn={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"},Zn={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},Qn={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)"},Un={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},Jn={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))"},er={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},tr={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},or={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 nr({scene:e,chartType:t,tableId:o,chartTitle:n}){const[r,i]=Bn.useState(!1),[a,s]=Bn.useState(5),l=Hn.useContext(jn),c=l?.visible??!1,u=r||c,d=Bn.useRef(null),h=n?"Data summary for "+n:o?`Data summary for ${t} ${o}`:"Data summary for "+t;Bn.useEffect(()=>{u||s(5)},[u]);const f=Bn.useCallback(e=>{e.target===e.currentTarget&&(r||c||i(!0))},[r,c]),m=Bn.useCallback(e=>{c||d.current?.contains(e.relatedTarget)||i(!1)},[c]);if(!e||0===e.length)return o?zn("span",{id:o,tabIndex:-1,style:Wn}):null;if(!u)return zn("div",{id:o,className:Xn,tabIndex:-1,onFocus:f,style:Wn,role:"region","aria-label":h,children:Nn("button",{type:"button",onClick:()=>i(!0),children:["View data summary (",e.length," elements)"]})});const g=function(e){const t=[];if(!Array.isArray(e))return t;const o=e.some(e=>e&&("line"===e.type||"area"===e.type));for(const n of e)if(n&&"object"==typeof n&&null!==n.datum)try{switch(n.type){case"point":if(o)break;t.push({label:"Point",values:Dn(En(n))});break;case"line":case"area":{const e=En(n),o=Array.isArray(e)?e:[],r="line"===n.type?"Line point":"Area point";for(const e of o)t.push({label:r,values:Dn(e)});break}case"rect":{const e=En(n),o=null!=e&&"object"==typeof e?e:{},r=o.category??n.group??"",i=o.value??o.__aggregateValue??o.total,a=Dn(o);null==a.category&&""!==r&&(a.category=r+""),null==a.value&&null!=i&&(a.value="number"==typeof i||"string"==typeof i?i:i+""),t.push({label:"Bar",values:a});break}case"heatcell":{const e=Dn(En(n));null==e.value&&"number"==typeof n.value&&Number.isFinite(n.value)&&(e.value=n.value),t.push({label:"Cell",values:e});break}case"wedge":{const e=En(n),o=Dn(e);if(null==o.category){const t=Fn(e),n=t.category??t.label;null!=n&&(o.category=n+"")}t.push({label:"Wedge",values:o});break}case"circle":t.push({label:"Node",values:Dn(En(n))});break;case"arc":t.push({label:"Arc",values:Dn(En(n))});break;case"candlestick":t.push({label:"Candlestick",values:Dn(En(n))});break;case"geoarea":{const e=Fn(En(n)),o=Dn(e);if(null==o.name){const t=Fn(e.properties).name??e.name;null!=t&&(o.name=t+"")}t.push({label:"Region",values:o});break}}}catch{}return t}(e),p=function(e){if(!e||0===e.length)return[];const t=new Set;for(const o of e)if(o&&o.values)for(const e of Object.keys(o.values))t.add(e);const o=[];for(const n of t){const t=[],r=new Set;for(const o of e){if(!o||!o.values)continue;const e=o.values[n];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&r.add(e+""))}if(t.length>0){let e=t[0],r=t[0],i=0;for(const o of t)e>o&&(e=o),o>r&&(r=o),i+=o;o.push({name:n,count:t.length,numeric:!0,min:e,max:r,mean:i/t.length})}else if(r.size>0){const e=Array.from(r);o.push({name:n,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return o}(g),y=function(e,t){const o=[e+" data points."];for(const e of t)if(e.numeric)o.push(`${e.name}: ${qn(e.min)} to ${qn(e.max)}, mean ${qn(e.mean)}.`);else{const t=e.uniqueValues,n=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");o.push(`${e.name}: ${n}.`)}return o.join(" ")}(g.length,p),b=Math.min(a,g.length),v=g.slice(0,b),x=g.length-b,w=new Set;for(const e of v)for(const t of Object.keys(e.values))w.add(t);const k=Array.from(w);return Nn("div",{ref:d,id:o,className:Yn,tabIndex:-1,onBlur:m,style:Kn,role:"region","aria-label":h,children:[zn("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{c&&l&&l.setVisible(!1),i(!1)},"aria-label":"Close data summary",style:Qn,children:"×"}),zn("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:Zn,children:y}),Nn("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+t,style:Un,children:[zn("caption",{className:"semiotic-accessible-data-table-caption",style:tr,children:x>0?`First ${b} of ${g.length} data points`:`All ${g.length} data points`}),zn("thead",{children:Nn("tr",{children:[zn("th",{style:Jn,children:"type"}),k.map(e=>zn("th",{style:Jn,children:e},e))]})}),zn("tbody",{children:v.map((e,t)=>Nn("tr",{children:[zn("td",{style:er,children:e.label}),k.map(t=>{return zn("td",{style:er,children:(o=e.values[t],null==o||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":qn(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"")},t);var o})]},t))})]}),x>0&&Nn("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>s(e=>e+25),style:or,children:["Show ",Math.min(25,x)," more"," ",1===x?"row":"rows"," (",x," remaining)"]})]})}function rr({summary:e}){return e?zn("div",{role:"note",style:Wn,children:e}):null}function ir({tableId:e}){return zn("a",{href:"#"+e,style:Wn,onClick:t=>{t.preventDefault();const o=document.getElementById(e);o&&requestAnimationFrame(()=>o.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,Wn)},children:"Skip to data table"})}function ar({hoverPoint:e}){let t="";if(e){const o=e.data||e;t="object"==typeof o?"Data point: "+Object.entries(o).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Data point: "+o}return zn("div",{"aria-live":"polite","aria-atomic":"true",style:Wn,children:t})}import{jsx as sr}from"react/jsx-runtime";var lr="var(--semiotic-focus, #005fcc)";function cr({active:e,hoverPoint:t,margin:o,size:n,shape:r="circle",width:i,height:a,pathData:s}){if(!e||!t)return null;const l=t.x+o.left,c=t.y+o.top;let u;if("geoarea"!==r&&"path"!==r||!s)if("rect"===r&&null!=i&&null!=a){const e=Math.max(i,4),t=Math.max(a,4);u=sr("rect",{x:l-e/2-3,y:c-t/2-3,width:e+6,height:t+6,rx:3,fill:"none",stroke:lr,strokeWidth:2,strokeDasharray:"4,2"})}else u=sr("circle","wedge"===r?{cx:l,cy:c,r:12,fill:"none",stroke:lr,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:lr,strokeWidth:2,strokeDasharray:"4,2"});else u=sr("g",{transform:`translate(${o.left},${o.top})`,children:sr("path",{d:s,fill:"none",stroke:lr,strokeWidth:2.5,strokeDasharray:"6,3"})});return sr("svg",{style:{position:"absolute",left:0,top:0,width:n[0],height:n[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}import*as ur from"react";function dr(e){return Array.isArray(e)?e[0]:e}function hr(e,t,o,n){return{data:dr(e),x:t,y:o,__semioticHoverData:!0,...n}}var fr=["name","label","title"],mr=["type","kind","category","group","class","status","role","shape"],gr=["value","amount","total","count","weight","score"],pr=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 yr(e,t){for(const o of t){const t=e.find(e=>e.lower===o);if(t)return t}}import{jsx as br,jsxs as vr}from"react/jsx-runtime";var xr={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 wr(e,t){return"function"==typeof t?t(e):e[t]}function kr(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 Sr(e={}){const{fields:t,title:o,format:n,style:r={},className:i=""}=e;return e=>{if(!e||"object"!=typeof e)return null;let a;const s=[];if(o){const t=wr(e,o);a=kr(t,n)}if(t&&t.length>0)t.forEach(t=>{let o,r,i;"string"==typeof t?(o=t,r=t,i=n):(o=t.label,r=t.accessor||t.key||"",i=t.format||n);const a=wr(e,r);s.push({label:o,value:kr(a,i)})});else if(!o){const t=["value","y","name","id","label"];for(const o of t)if(void 0!==e[o]){a=kr(e[o],n);break}if(!a){const t=Object.keys(e).filter(e=>!e.startsWith("_"));t.length>0&&(a=kr(e[t[0]],n))}}const l={...xr,...r};return vr("div",{className:("semiotic-tooltip "+i).trim(),style:l,children:[a&&br("div",{style:{fontWeight:s.length>0?"bold":"normal"},children:a}),s.map((e,t)=>vr("div",{style:{marginTop:0===t&&a?"4px":0},children:[e.label&&vr("span",{children:[e.label,": "]}),e.value]},t))]})}}function Ar(e){if(!0!==e){if("function"==typeof e){const t=e;return e=>{let o=dr(!0===e?.__semioticHoverData||e&&void 0!==e.data&&"number"==typeof e.x&&"number"==typeof e.y&&e&&("node"===e.type||"edge"===e.type||void 0!==e.nodeOrEdge||void 0!==e.allSeries||void 0!==e.stats||void 0!==e.__chartType)?e.data??{}:e);("node"===e?.nodeOrEdge&&"number"==typeof o?.x0&&"number"==typeof o?.x1||"edge"===e?.nodeOrEdge&&"number"==typeof o?.sankeyWidth)&&o.data&&"object"==typeof o.data&&(o=o.data);const n=t(o);return null==n?null:br("div",{className:"semiotic-tooltip",style:xr,children:n})}}return!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?Sr(e):Sr())}}import{jsx as Mr}from"react/jsx-runtime";function _r({x:e,y:t,containerWidth:o,containerHeight:n,margin:r,children:i,className:a="stream-frame-tooltip",zIndex:s=1}){const l=Number.isFinite(e)&&Number.isFinite(t),c=ur.useRef(null),[u,d]=ur.useState(null);ur.useLayoutEffect(()=>{const e=c.current;if(!e)return;const t=e.getBoundingClientRect();d(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[i,a,o,n]);let h;h=u?`translate(${u.width+12>o-e?"calc(-100% - 12px)":"12px"}, ${u.height+12>n-t?"calc(-100% - 4px)":"4px"})`:`translate(${e>.7*o?"calc(-100% - 12px)":"12px"}, ${.3*n>t?"4px":"calc(-100% - 4px)"})`;const f=function(e){if(!ur.isValidElement(e))return!1;const t=e.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;const o=e.props;if(!0===o["data-semiotic-tooltip-chrome"])return!0;if("true"===o["data-semiotic-tooltip-chrome"])return!0;const n=o.style;if(n&&"object"==typeof n){if(null!=n.background&&""!==n.background&&"transparent"!==n.background)return!0;if(null!=n.backgroundColor&&""!==n.backgroundColor&&"transparent"!==n.backgroundColor)return!0}return!1}(i),m=f?null:xr;return l?Mr("div",{ref:c,className:f?a:(a+" semiotic-tooltip").trim(),style:{...m||{},position:"absolute",left:r.left+e,top:r.top+t,transform:h,pointerEvents:"none",zIndex:s,width:"max-content"},children:i}):null}import*as Cr from"react";import{useCallback as Pr,useEffect as Lr,useLayoutEffect as Rr,useMemo as Ir,useRef as Tr}from"react";import{createContext as $r,useCallback as Br,useContext as Hr,useMemo as Or,useRef as jr,useSyncExternalStore as Dr}from"react";import{jsx as Fr}from"react/jsx-runtime";function Er(e){let t=null;const o=()=>(t||(t=$r(null)),t),n=zr(e);return[function({children:t,initialState:n}){const r=jr(n),i=Or(()=>zr(e,r.current),[]),a=o();return Fr(a.Provider,{value:i,children:t})},(e,t)=>{const r=o(),i=Hr(r)??n,a=jr(e);a.current=e;const s=jr({hasValue:!1,value:void 0}),l=Br(()=>{const e=a.current(i.getState()),o=s.current;return o.hasValue&&t&&t(o.value,e)?o.value:(s.current={hasValue:!0,value:e},e)},[i,t]),c=Br(()=>a.current(i.getState()),[i]);return Dr(i.subscribe,l,c)}]}function zr(e,t){const o=new Set;let n={...e(function(e){const t=e(n);if(function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}(t)){n={...n,...t};for(const e of o)e()}}),...t??{}};return{getState:()=>n,subscribe:function(e){return o.add(e),()=>{o.delete(e)}}}}function Nr(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 Wr(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t={...t,colors:{...t.colors,categorical:Gr}}),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 Gr=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],qr={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}},Vr={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}},Xr={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:Gr,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 Yr(e,t){if("light"===t)return qr;if("dark"===t)return Vr;if("high-contrast"===t)return Xr;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?Vr:qr;return Wr({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}return Wr({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}var[Kr,Zr]=Er(e=>({theme:qr,setTheme(t){e(e=>({theme:Yr(e.theme,t)}))}}));import{useState as Qr,useEffect as Ur}from"react";import{useRef as Jr,useState as ei,useEffect as ti}from"react";var oi="undefined"==typeof window?Lr:Rr,ni={requestAnimationFrame:e=>("undefined"==typeof window?globalThis:window).requestAnimationFrame(e),cancelAnimationFrame:e=>("undefined"==typeof window?globalThis:window).cancelAnimationFrame(e)};function ri(e,t,o){return"function"==typeof e?e({size:t,margin:o}):e}function ii(e){const t=function(){const[e,t]=Qr(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return Ur(()=>{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 o=e;return o.addListener(t),()=>o.removeListener(t)}(e,e=>t(e.matches))},[]),e}(),o=Tr(t);o.current=t;const[n,r]=function(e,t,o){const n=Jr(null),[r,i]=ei(null);return ti(()=>{if(!t&&!o)return;const e=n.current;if(!e)return;const r=new ResizeObserver(e=>{for(const t of e){const{width:e,height:o}=t.contentRect;i(t=>t&&t.w===e&&t.h===o?t:{w:e,h:o})}});return r.observe(e),()=>r.disconnect()},[t,o]),[n,[t&&r?r.w:e[0],o&&r?r.h:e[1]]]}(e.sizeProp,e.responsiveWidth,e.responsiveHeight),i=Ir(()=>({...e.marginDefault,...e.userMargin}),[e.marginDefault,e.userMargin]),a=r[0]-i.left-i.right,s=r[1]-i.top-i.bottom,l=ri(e.foregroundGraphics,r,i),c=ri(e.backgroundGraphics,r,i),u=Zr(e=>e.theme),{transition:d,introEnabled:h}=function(e,t){if(!1===e)return{transition:void 0,introEnabled:!1};const o="undefined"!=typeof window&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;return{transition:e?!0===e?{duration:300}:{duration:e.duration??300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(o||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),f="semiotic-table-"+Cr.useId(),m=Tr(null),g=Tr(e.frameScheduler??ni);g.current=e.frameScheduler??ni;const p=Tr(null),y=Tr(!1),b=Tr(()=>{}),v=Pr(()=>{if(null!==m.current||y.current)return;const e=g.current;let t=!1,o=!1;const n=e.requestAnimationFrame(()=>{t=!0;const e=!o;e&&(y.current=!0),m.current=null,p.current=null;try{b.current()}finally{e&&(y.current=!1)}});o=!0,t||(m.current=n,p.current=e)},[]),x=Pr(()=>{null!==m.current&&((p.current??g.current).cancelAnimationFrame(m.current),m.current=null,p.current=null)},[]);Lr(()=>()=>{x()},[x]);const w=Tr(()=>{}),k=Tr(()=>{}),S=Tr(null),A=Tr(null),M=Tr(null),_=Pr(()=>{const e=S.current;S.current=null,e&&w.current(e)},[]),C=Pr(e=>{if(S.current={clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType},null===A.current){const e=g.current;let t=!1;const o=e.requestAnimationFrame(()=>{t=!0,A.current=null,M.current=null,_()});t||(A.current=o,M.current=e)}},[_]),P=Pr(()=>{S.current=null,null!==A.current&&((M.current??g.current).cancelAnimationFrame(A.current),A.current=null,M.current=null),k.current()},[]);Lr(()=>()=>{S.current=null,null!==A.current&&((M.current??g.current).cancelAnimationFrame(A.current),A.current=null,M.current=null)},[]);const L=e.themeDirtyRef;return oi(()=>{L&&(Ln++,L.current=!0,v())},[u,v,L]),{reducedMotion:t,reducedMotionRef:o,responsiveRef:n,size:r,margin:i,adjustedWidth:a,adjustedHeight:s,resolvedForeground:l,resolvedBackground:c,currentTheme:u,transition:d,introEnabled:h,tableId:f,rafRef:m,renderFnRef:b,scheduleRender:v,cancelRender:x,hoverHandlerRef:w,hoverLeaveRef:k,onPointerMove:C,onPointerLeave:P}}function ai(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function si(e,t,o=.3){ai(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h))}function li(e,t,o=.6){if(!ai(t))return;const n=t.r+(t._pulseGlowRadius??4)*t._pulseIntensity,r=t.cx??t.x??0,i=t.cy??t.y??0;e.beginPath(),e.arc(r,i,n,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*o,e.stroke()}function ci(e,t,o,n=.35){ai(t)&&(e.globalAlpha=t._pulseIntensity*n,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",o?e.fill(o):e.fill())}function ui(e,t){const o=e.fillStyle,n="#010203";try{e.fillStyle=n,e.fillStyle=t}catch{return e.fillStyle=o,[78,121,167]}const r=e.fillStyle;if(e.fillStyle=o,"string"!=typeof r)return[78,121,167];if(r.toLowerCase()===n&&t.trim().toLowerCase()!==n)return[78,121,167];if(r.startsWith("#"))return[parseInt(r.slice(1,3),16),parseInt(r.slice(3,5),16),parseInt(r.slice(5,7),16)];const i=r.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return i?[+i[1],+i[2],+i[3]]:[78,121,167]}import{curveMonotoneX as di,curveMonotoneY as hi,curveCardinal as fi,curveCatmullRom as mi,curveStep as gi,curveStepBefore as pi,curveStepAfter as yi,curveBasis as bi,curveNatural as vi}from"d3-shape";function xi(e,t,o){return null==t?o:"string"!=typeof t?t:$n(e,t)||o}function wi(e,t,o,n,r,i,a){if("colorStops"in t){const o=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>o.length)return null;const s=e.createLinearGradient(n,r,i,a);for(const e of o)s.addColorStop(e.offset,e.color);return s}const{topOpacity:s,bottomOpacity:l}=t;if(!Number.isFinite(s)||!Number.isFinite(l))return null;const c=Math.max(0,Math.min(1,s)),u=Math.max(0,Math.min(1,l)),d=e.createLinearGradient(n,r,i,a),[h,f,m]=ui(e,o);return d.addColorStop(0,`rgba(${h},${f},${m},${c})`),d.addColorStop(1,`rgba(${h},${f},${m},${u})`),d}function ki(e,t){const{x:o,y:n,w:r,h:i}=t,{tl:a,tr:s,br:l,bl:c}=nn(t);e.beginPath(),e.moveTo(o+a,n),e.lineTo(o+r-s,n),s>0&&e.arcTo(o+r,n,o+r,n+s,s),e.lineTo(o+r,n+i-l),l>0&&e.arcTo(o+r,n+i,o+r-l,n+i,l),e.lineTo(o+c,n+i),c>0&&e.arcTo(o,n+i,o,n+i-c,c),e.lineTo(o,n+a),a>0&&e.arcTo(o,n,o+a,n,a),e.closePath()}function Si(e){switch(e.roundedEdge){case"bottom":return{x0:e.x,y0:e.y+e.h,x1:e.x,y1:e.y};case"right":return{x0:e.x+e.w,y0:e.y,x1:e.x,y1:e.y};case"left":return{x0:e.x,y0:e.y,x1:e.x+e.w,y1:e.y};default:return{x0:e.x,y0:e.y,x1:e.x,y1:e.y+e.h}}}var Ai=(e,t,o,n)=>{const r=t.filter(e=>"rect"===e.type);for(const t of r){if(null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon)Mi(e,t);else if(t.cornerRadii&&on(t.cornerRadii)){const o=xi(e,t.style.fill,$n(e,"var(--semiotic-primary, #007bff)")),n=Si(t),r=t.fillGradient&&"string"==typeof o?wi(e,t.fillGradient,o,n.x0,n.y0,n.x1,n.y1):null;e.fillStyle=r||o,ki(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=$n(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else if(t.roundedTop&&t.roundedTop>0){const o=xi(e,t.style.fill,$n(e,"var(--semiotic-primary, #007bff)")),n=Si(t),r=t.fillGradient&&"string"==typeof o?wi(e,t.fillGradient,o,n.x0,n.y0,n.x1,n.y1):null;e.fillStyle=r||o;const i=Math.min(t.roundedTop,t.w/2,t.h/2);e.beginPath();const{x:a,y:s,w:l,h:c}=t;switch(t.roundedEdge){case"right":e.moveTo(a,s),e.lineTo(a+l-i,s),e.arcTo(a+l,s,a+l,s+i,i),e.lineTo(a+l,s+c-i),e.arcTo(a+l,s+c,a+l-i,s+c,i),e.lineTo(a,s+c);break;case"left":e.moveTo(a+l,s),e.lineTo(a+i,s),e.arcTo(a,s,a,s+i,i),e.lineTo(a,s+c-i),e.arcTo(a,s+c,a+i,s+c,i),e.lineTo(a+l,s+c);break;case"bottom":e.moveTo(a,s),e.lineTo(a+l,s),e.lineTo(a+l,s+c-i),e.arcTo(a+l,s+c,a+l-i,s+c,i),e.lineTo(a+i,s+c),e.arcTo(a,s+c,a,s+c-i,i);break;default:e.moveTo(a,s+c),e.lineTo(a,s+i),e.arcTo(a,s,a+i,s,i),e.lineTo(a+l-i,s),e.arcTo(a+l,s,a+l,s+i,i),e.lineTo(a+l,s+c)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=$n(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const o=xi(e,t.style.fill,$n(e,"var(--semiotic-primary, #007bff)")),n=Si(t),r=t.fillGradient&&"string"==typeof o?wi(e,t.fillGradient,o,n.x0,n.y0,n.x1,n.y1):null;e.fillStyle=r||o,e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=$n(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}si(e,t),e.globalAlpha=1}};function Mi(e,t){const o=t.style.icon,n=t.style.iconPadding||2,r=Math.min(t.w,t.h)-n;if(0>=r)return;const i=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),i){const i=r+n,a=t.x+(t.w-r)/2;for(let n=t.y+t.h-r;n>=t.y-r;n-=i)e.drawImage(o,a,n,r,r)}else{const i=r+n,a=t.y+(t.h-r)/2;for(let n=t.x;t.x+t.w>n;n+=i)e.drawImage(o,n,a,r,r)}e.restore()}var _i=(e,t,o,n)=>{const r=t.filter(e=>"point"===e.type);if(0!==r.length){e.save();try{const t=e.globalAlpha;for(const o of r)e.beginPath(),e.arc(o.x,o.y,o.r,0,2*Math.PI),e.globalAlpha=t*(o.style.opacity??o.style.fillOpacity??1),e.fillStyle=xi(e,o.style.fill,"#4e79a7"),e.fill(),o.style.stroke&&(e.strokeStyle=xi(e,o.style.stroke,o.style.stroke),e.lineWidth=o.style.strokeWidth||1,e.stroke()),li(e,o)}finally{e.restore()}}},Ci=new Map;function Pi(e){try{if(e.path)return new Path2D(e.path);const t=`${e.symbolType??"circle"}:${Math.round(e.size)}`;let o=Ci.get(t);return o||(o=new Path2D(se(e.symbolType,e.size)),Ci.size>256&&Ci.clear(),Ci.set(t,o)),o}catch{return null}}var Li=(e,t)=>{const o=e.globalAlpha;for(const n of t){if("symbol"!==n.type)continue;const t=n;if(0>=t.size)continue;const r=Pi(t);if(!r)continue;e.save(),e.translate(t.x,t.y),t.rotation&&e.rotate(t.rotation);const i=(t.style.opacity??1)*(t._decayOpacity??1);t.style.fill&&(e.globalAlpha=o*i*(t.style.fillOpacity??1),e.fillStyle=xi(e,t.style.fill,"#4e79a7"),e.fill(r)),t.style.stroke&&"none"!==t.style.stroke&&(e.globalAlpha=o*i,e.strokeStyle=xi(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth??1,e.stroke(r)),e.restore()}e.globalAlpha=o};function Ri(e,t,o,n,r){if(0>=t.size)return;const i=t.glyph;if(!i||!i.parts?.length)return;const a=Ke(i,t.size);if(0>=a.scale)return;const s=(t.style.opacity??1)*(t._decayOpacity??1);if(0>=s)return;const l=t=>{const o=xi(e,t,t);return"string"==typeof o?o:t},c=t.color??("string"==typeof t.style.fill?t.style.fill:void 0);e.save(),e.translate(o,n),t.rotation&&e.rotate(t.rotation),e.translate(a.offsetX,a.offsetY),e.scale(a.scale,a.scale),e.globalAlpha=r*s*(t.style.fillOpacity??1);const u=et(i,t.fraction??1,t.fractionStart??0,t.fractionDirection??"horizontal");u&&t.ghostColor&&ot(e,i,c,t.accent,t.ghostColor,l),u&&(e.beginPath(),e.rect(u.x,u.y,u.width,u.height),e.clip()),ot(e,i,c,t.accent,void 0,l),e.restore()}import{arc as Ii}from"d3-shape";function Ti(e,t){const o=t._gradientBand.colors;if(0===o.length)return;const{clipPath:n,slices:r}=sn({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,cornerRadius:t.cornerRadius,roundStart:t.roundedEnds?.start??!0,roundEnd:t.roundedEnds?.end??!0,colors:o}),i=new Path2D(n);e.save(),e.translate(t.cx,t.cy),e.clip(i);for(const t of r)e.fillStyle=$n(e,t.color)||t.color||"#007bff",e.fill(new Path2D(t.d));e.restore(),t.style.stroke&&"none"!==t.style.stroke&&(e.save(),e.translate(t.cx,t.cy),e.strokeStyle=$n(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(i),e.restore())}function $i(e,t){e.beginPath(),t.innerRadius>0?(e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerRadius,t.endAngle,t.startAngle,!0)):(e.moveTo(t.cx,t.cy),e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle)),e.closePath()}function Bi(e,t){const o={innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle+Math.PI/2,endAngle:t.endAngle+Math.PI/2},n=Ii().cornerRadius(t.cornerRadius)(o);if(!n)return;e.save(),e.translate(t.cx,t.cy);const r=new Path2D(n);e.fill(r),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(r),e.restore()}var Hi=(e,t,o,n)=>{const r=t.filter(e=>"wedge"===e.type);for(const t of r)if(e.globalAlpha=(t.style.fillOpacity??1)*(t.style.opacity??1),t._gradientBand&&t._gradientBand.colors.length>0)Ti(e,t),t._pulseIntensity&&t._pulseIntensity>0&&($i(e,t),ci(e,t)),e.globalAlpha=1;else{if(e.fillStyle=("string"==typeof t.style.fill?$n(e,t.style.fill):t.style.fill)||"#007bff",t.roundedEnds){t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=$n(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1);const o=an({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,cornerRadius:t.cornerRadius,roundStart:t.roundedEnds.start,roundEnd:t.roundedEnds.end});e.save(),e.translate(t.cx,t.cy);const n=new Path2D(o);e.fill(n),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(n),e.restore()}else t.cornerRadius?(t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=$n(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1),Bi(e,t)):($i(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=$n(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()));t._pulseIntensity&&t._pulseIntensity>0&&($i(e,t),ci(e,t)),e.globalAlpha=1}},Oi=(e,t,o,n)=>{const r=t.filter(e=>"boxplot"===e.type);for(const t of r){const o=t.columnWidth/2,n="vertical"===t.projection,r=$n(e,"var(--semiotic-primary, #007bff)"),i=$n(e,"var(--semiotic-text, #333)"),a=t.style.fill,s="string"==typeof a?$n(e,a)||a:a??r,l=t.style.stroke,c="string"==typeof l?$n(e,l)||l:i,u=t.style.strokeWidth||1,d=t.style.fillOpacity??t.style.opacity??.6;if(e.save(),e.strokeStyle=c,e.lineWidth=u,e.beginPath(),n?(e.moveTo(t.x,t.minPos),e.lineTo(t.x,t.maxPos)):(e.moveTo(t.minPos,t.y),e.lineTo(t.maxPos,t.y)),e.stroke(),e.beginPath(),n?(e.moveTo(t.x-.4*o,t.minPos),e.lineTo(t.x+.4*o,t.minPos),e.moveTo(t.x-.4*o,t.maxPos),e.lineTo(t.x+.4*o,t.maxPos)):(e.moveTo(t.minPos,t.y-.4*o),e.lineTo(t.minPos,t.y+.4*o),e.moveTo(t.maxPos,t.y-.4*o),e.lineTo(t.maxPos,t.y+.4*o)),e.stroke(),e.globalAlpha=d,e.fillStyle=s,n){const n=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-o,n,t.columnWidth,r),e.globalAlpha=1,e.strokeRect(t.x-o,n,t.columnWidth,r)}else{const n=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(n,t.y-o,r,t.columnWidth),e.globalAlpha=1,e.strokeRect(n,t.y-o,r,t.columnWidth)}e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),n?(e.moveTo(t.x-o,t.medianPos),e.lineTo(t.x+o,t.medianPos)):(e.moveTo(t.medianPos,t.y-o),e.lineTo(t.medianPos,t.y+o)),e.stroke(),e.restore()}},ji=(e,t,o,n)=>{const r=t.filter(e=>"violin"===e.type);for(const t of r){e.save(),(t.translateX||t.translateY)&&e.translate(t.translateX,t.translateY);const o=new Path2D(t.pathString);if(e.globalAlpha=t.style.fillOpacity??t.style.opacity??.6,e.fillStyle=("string"==typeof t.style.fill?$n(e,t.style.fill):t.style.fill)||"#007bff",e.fill(o),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=$n(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(o)),t.iqrLine){e.strokeStyle="#333",e.lineWidth=2,e.globalAlpha=.8;const o=t.iqrLine.centerPos,n=!1!==t.iqrLine.isVertical;e.beginPath(),n?(e.moveTo(o,t.iqrLine.q1Pos),e.lineTo(o,t.iqrLine.q3Pos)):(e.moveTo(t.iqrLine.q1Pos,o),e.lineTo(t.iqrLine.q3Pos,o)),e.stroke(),e.beginPath(),n?e.arc(o,t.iqrLine.medianPos,3,0,2*Math.PI):e.arc(t.iqrLine.medianPos,o,3,0,2*Math.PI),e.fillStyle="#fff",e.fill(),e.strokeStyle="#333",e.lineWidth=1,e.stroke(),e.globalAlpha=1}e.restore()}},Di=(e,t,o,n)=>{const r=t.filter(e=>"connector"===e.type);if(0===r.length)return;const i=new Map;for(const e of r){const t=e.group||"_default";i.has(t)||i.set(t,[]),i.get(t).push(e)}for(const[,t]of i){if(0===t.length)continue;const o=t[0].style;if(o.fill&&"none"!==o.fill){e.beginPath(),e.moveTo(t[0].x1,t[0].y1);for(const o of t)e.lineTo(o.x2,o.y2);e.closePath(),e.globalAlpha=o.fillOpacity??o.opacity??.3,e.fillStyle=o.fill,e.fill(),e.globalAlpha=1}for(const o of t)e.beginPath(),e.moveTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.strokeStyle=$n(e,o.style.stroke)||("string"==typeof o.style.fill?$n(e,o.style.fill):o.style.fill)||$n(e,"var(--semiotic-border, #999)"),e.lineWidth=o.style.strokeWidth||1,e.globalAlpha=o.style.opacity??.5,e.stroke(),e.globalAlpha=1}},Fi=(e,t,o,n)=>{const r=t.filter(e=>"trapezoid"===e.type);for(const t of r){const o=t.points;if(o.length>=4){e.globalAlpha=t.style?.opacity??1,e.beginPath(),e.moveTo(o[0][0],o[0][1]);for(let t=1;o.length>t;t++)e.lineTo(o[t][0],o[t][1]);e.closePath(),e.fillStyle=t.style?.fill||"#999",e.fill(),t.style?.stroke&&(e.strokeStyle=$n(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}};function Ei(e){return 1e6>e?1e4>e?1e3>e?e+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function zi(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}var Ni=null;function Wi(e={},t){const{background:o="transparent",stroke:n="#000",lineWidth:r=1.5,spacing:i=6,angle:a=45}=e,s=Math.max(8,Math.ceil(2*i));let l;try{l=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(Ni||(Ni=document.createElement("canvas")),Ni.width=e,Ni.height=e,Ni)}(s)}catch{return null}const c=l.getContext("2d");if(!c)return null;o&&"transparent"!==o?(c.fillStyle=o,c.fillRect(0,0,s,s)):c.clearRect(0,0,s,s),c.strokeStyle=n,c.lineWidth=r,c.lineCap="square";const u=a*Math.PI/180;if(45===a||-45===a){const e=a>0?1:-1;for(let t=-s;2*s>=t;t+=i)c.beginPath(),c.moveTo(t,0),c.lineTo(t+e*s,s),c.stroke()}else{c.save(),c.translate(s/2,s/2),c.rotate(u);const e=2*s;for(let t=-e;e>=t;t+=i)c.beginPath(),c.moveTo(-e,t),c.lineTo(e,t),c.stroke();c.restore()}return(t||c).createPattern(l,"repeat")}var Gi=new Map;function qi(e,t){const o=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,n=Gi.get(o);if(void 0!==n)return n;const r=Wi({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return Gi.set(o,r),r}function Vi(e,t,o,n,r,i){e.moveTo(t+i,o),e.lineTo(t+n-i,o),e.quadraticCurveTo(t+n,o,t+n,o+i),e.lineTo(t+n,o+r-i),e.quadraticCurveTo(t+n,o+r,t+n-i,o+r),e.lineTo(t+i,o+r),e.quadraticCurveTo(t,o+r,t,o+r-i),e.lineTo(t,o+i),e.quadraticCurveTo(t,o,t+i,o),e.closePath()}function Xi(e){return 1e6>e?1e4>e?1e3>e?Math.round(e)+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function Yi(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}var Ki=e=>[Di,...e],Zi={bar:Ki([Ai]),clusterbar:Ki([Ai]),point:Ki([_i,Li]),swarm:Ki([_i,Li]),pie:[Hi],donut:[Hi],boxplot:Ki([Oi,_i]),violin:Ki([ji]),histogram:Ki([Ai]),ridgeline:Ki([ji]),timeline:Ki([Ai]),funnel:[Ai,Fi,(e,t,o,n)=>{const r=t.filter(e=>"rect"===e.type&&null!=e.datum);if(0!==r.length&&r.some(e=>null!=e.datum?.__funnelStepLabel||null!=e.datum?.__funnelValueLabelX)){e.textBaseline="top",e.lineJoin="round",e.textAlign="center",e.font="bold 14px sans-serif";for(const t of r){const o=t.datum;if(!o)continue;if(!o.__funnelStepLabel)continue;const n=o.__funnelStepLabel;if(e.measureText(n).width+16>(o.__funnelRowWidth??o.__funnelBarW??0))continue;const r=o.__funnelStepLabelX,i=o.__funnelStepLabelY+3;e.strokeStyle="rgba(0,0,0,0.6)",e.lineWidth=3,e.strokeText(n,r,i),e.fillStyle="#fff",e.fillText(n,r,i)}e.font="bold 13px sans-serif";for(const t of r){const o=t.datum;if(!o)continue;if(null==o.__funnelValueLabelX)continue;const n=o.__funnelBarW??0;if(60>n)continue;const r=o.__funnelValue;if(null==r||0===r)continue;const i=o.__funnelPercent,a=!0===o.__funnelIsFirstStep;let s;if(s=a?Ei(r):null!=i?`${Ei(r)} (${zi(i)})`:Ei(r),e.measureText(s).width+16>n){if(a||null==i)continue;if(s=Ei(r),e.measureText(s).width+16>n)continue}const l=o.__funnelValueLabelX,c=(o.__funnelValueLabelY??t.y)+14+5;e.textAlign="center",e.strokeStyle="rgba(0,0,0,0.5)",e.lineWidth=3,e.strokeText(s,l,c),e.fillStyle="#fff",e.fillText(s,l,c)}e.lineWidth=1,e.lineJoin="miter"}}],"bar-funnel":[Ai,(e,t,o,n)=>{const r=t.filter(e=>"rect"===e.type&&!0===e.datum?.__barFunnelIsDropoff);for(const t of r){const o=("string"==typeof t.style.fill?t.style.fill:null)||$n(e,"var(--semiotic-border, #999)"),n=qi(o,e);e.globalAlpha=t.style.opacity??1,e.beginPath(),e.rect(t.x,t.y,t.w,t.h),n?e.fillStyle=n:(e.fillStyle=o,e.globalAlpha=.4*(t.style.opacity??1)),e.fill(),e.globalAlpha=1}},(e,t,o,n)=>{const r=t.filter(e=>"rect"===e.type&&!0!==e.datum?.__barFunnelIsDropoff&&null!=e.datum?.__barFunnelLabelX);if(0===r.length)return;const i=function(e,t){const[o,n,r]=ui(e,t);return(.2126*o+.7152*n+.0722*r)/255>.6}(e,$n(e,"var(--semiotic-text, #333)")),a=i?"#1f2937":"#ffffff",s=i?"rgba(255,255,255,0.18)":"rgba(0,0,0,0.12)",l=i?"#f3f4f6":"#1a1a1a",c=l;for(const t of r){const o=t.datum;if(!o)continue;const n=o.__barFunnelValue;if(null==n)continue;if(25>t.w)continue;const r=o.__barFunnelPercent,i=!(!0===o.__barFunnelIsFirstStep)&&null!=r,u=i?Yi(r):"",d=Xi(n);e.font="bold 13px sans-serif";const h=i?e.measureText(u).width:0;e.font="11px sans-serif";const f=e.measureText(d).width,m=Math.max(h,f)+12,g=i?32:17,p=o.__barFunnelLabelX,y=p-m/2,b=o.__barFunnelLabelY-g-4;e.save(),e.shadowColor="rgba(0,0,0,0.15)",e.shadowBlur=4,e.shadowOffsetY=1,e.fillStyle=a,e.beginPath(),Vi(e,y,b,m,g,4),e.fill(),e.restore(),e.strokeStyle=s,e.lineWidth=.5,e.beginPath(),Vi(e,y,b,m,g,4),e.stroke(),e.textAlign="center",e.textBaseline="top",i?(e.font="bold 13px sans-serif",e.fillStyle=l,e.fillText(u,p,b+3),e.font="11px sans-serif",e.fillStyle=c,e.fillText(d,p,b+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle=l,e.fillText(d,p,b+3))}e.lineWidth=1}],swimlane:Ki([Ai]),custom:Ki([Ai,_i,Li,(e,t)=>{const o=e.globalAlpha;for(const n of t)"glyph"===n.type&&Ri(e,n,n.x,n.y,o);e.globalAlpha=o},Hi,Oi,ji,Fi])};import{jsx as Qi,jsxs as Ui}from"react/jsx-runtime";function Ji(e){const t=function(e,t={}){if(!e||"object"!=typeof e)return{entries:[]};const o=t.maxEntries??6,n=!1!==t.skipPositional,r=[];for(const[t,o]of Object.entries(e)){if(t.startsWith("_"))continue;if("data"===t)continue;if(n&&pr.has(t.toLowerCase()))continue;if(null==o)continue;const e=typeof o;("string"===e||"number"===e||"boolean"===e||o instanceof Date)&&r.push({key:t,lower:t.toLowerCase(),value:o})}if(0===r.length)return{entries:[]};let i=r.findIndex(e=>fr.includes(e.lower));const a=i>=0;0>i&&(i=r.findIndex(e=>"id"===e.lower)),0>i&&(i=r.findIndex(e=>"string"==typeof e.value));const s=0>i?void 0:r[i];let l=r.filter((e,t)=>t!==i);a&&(l=l.filter(e=>"id"!==e.lower));const c=yr(l,mr),u=yr(l,gr),d=new Set(mr),h=new Set(gr),f=[];c&&f.push({key:c.key,value:c.value}),u&&f.push({key:u.key,value:u.value});for(const e of l){if(f.length>=o)break;e!==c&&e!==u&&(d.has(e.lower)||h.has(e.lower)||f.push({key:e.key,value:e.value}))}return{titleKey:s?.key,title:s?.value,entries:f}}(e,{skipPositional:!1});return null==t.title&&0===t.entries.length?null:Ui("div",{className:"semiotic-tooltip",style:xr,children:[null!=t.title&&Qi("div",{style:{fontWeight:"bold"},children:t.title+""}),t.entries.map(e=>Ui("div",{children:[Ui("span",{style:{opacity:.7},children:[e.key,":"]})," ","number"==typeof e.value?e.value.toLocaleString():e.value+""]},e.key))]})}function ea({hover:e}){const t=e.data||{},o=e.stats,n=e.category;if(Array.isArray(t)){const e=n||t[0]?.category||"";if(o)return Ui("div",{className:"semiotic-tooltip",style:xr,children:[e&&Qi("div",{style:{fontWeight:"bold"},children:e+""}),Ui("div",{children:["n = ",o.n]}),Ui("div",{children:["Min: ",o.min.toLocaleString()]}),Ui("div",{children:["Q1: ",o.q1.toLocaleString()]}),Ui("div",{children:["Median: ",o.median.toLocaleString()]}),Ui("div",{children:["Q3: ",o.q3.toLocaleString()]}),Ui("div",{children:["Max: ",o.max.toLocaleString()]}),Ui("div",{style:{opacity:.8},children:["Mean: ",o.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});const r=t.length;return Ui("div",{className:"semiotic-tooltip",style:xr,children:[e&&Qi("div",{style:{fontWeight:"bold"},children:e+""}),Ui("div",{children:[r," items"]})]})}if(null!=t.bin&&null!=t.count){const e=t.range||[];return Ui("div",{className:"semiotic-tooltip",style:xr,children:[t.category&&Qi("div",{style:{fontWeight:"bold"},children:t.category+""}),Ui("div",{children:["Count: ",t.count]}),2===e.length&&Ui("div",{style:{opacity:.8},children:[Number(e[0]).toFixed(1)," – ",Number(e[1]).toFixed(1)]})]})}const r=e.__oAccessor,i=e.__rAccessor,a=e.__chartType;if("swarm"===a||"point"===a)return Ji(t);const s=(r&&null!=t[r]?t[r]:null)||t.category||t.name||t.group||t.__rName||"",l=t.__aggregateValue??(i&&null!=t[i]?t[i]:null)??t.value??t.__rValue??t.pct??"";return s||""!==l?Ui("div",{className:"semiotic-tooltip",style:xr,children:[s&&Qi("div",{style:{fontWeight:"bold"},children:s+""}),""!==l&&Qi("div",{children:"number"==typeof l?l.toLocaleString():l+""})]}):Ji(t)}ea.ownsChrome=!0;import{jsx as ta,jsxs as oa}from"react/jsx-runtime";var na={top:50,right:40,bottom:60,left:70},ra=s(a(function(a,s){const{chartType:l,runtimeMode:d,data:h,oAccessor:f="category",rAccessor:m="value",colorAccessor:g,symbolAccessor:p,symbolMap:y,stackBy:b,groupBy:v,multiAxis:x,timeAccessor:w,valueAccessor:k,categoryAccessor:S,accessorRevision:A,projection:M="vertical",size:_=[600,400],responsiveWidth:C,responsiveHeight:P,margin:L,barPadding:R,roundedTop:I,gradientFill:T,trackFill:$,baselinePadding:B,innerRadius:H,cornerRadius:O,normalize:j,startAngle:D,sweepAngle:F,dynamicColumnWidth:E,bins:z,showOutliers:N,showIQR:W,amplitude:G,connectorOpacity:q,showLabels:V,connectorAccessor:X,connectorStyle:Y,dataIdAccessor:K,rExtent:Z,oExtent:Q,extentPadding:U=.05,oSort:J,windowMode:ee="sliding",windowSize:te=200,pieceStyle:oe,summaryStyle:ne,colorScheme:re,barColors:ie,showAxes:ae=!0,showCategoryTicks:le,categoryLabel:ce,valueLabel:ue,categoryFormat:de,valueFormat:he,oLabel:fe,rLabel:me,oFormat:ge,rFormat:pe,rTickValues:ye,tickLabelEdgeAlign:be,axisExtent:ve,enableHover:xe=!0,hoverAnnotation:we,tooltipContent:ke,customHoverBehavior:Se,customClickBehavior:Ae,annotations:Me,autoPlaceAnnotations:_e,svgAnnotationRules:Ce,showGrid:Pe=!1,legend:Le,legendHoverBehavior:Re,legendClickBehavior:Ie,legendHighlightedCategory:Te,legendIsolatedCategories:Be,legendPosition:Oe,legendLayout:je,legendCategoryAccessor:De,onCategoriesChange:Fe,backgroundGraphics:Ee,foregroundGraphics:ze,title:qe,className:Ve,background:Xe,centerContent:Ye,decay:Ze,pulse:Ue,transition:Je,animate:ot,staleness:rt,brush:it,onBrush:at,accessibleTable:st=!0,description:lt,summary:ct,customLayout:ut,onLayoutError:yt,layoutConfig:vt,layoutSelection:xt}=a,wt=e(!0),kt=ii({sizeProp:_,responsiveWidth:C,responsiveHeight:P,userMargin:L,marginDefault:na,animate:ot,transitionProp:Je,themeDirtyRef:wt}),{reducedMotionRef:St,responsiveRef:At,size:Mt,margin:_t,adjustedWidth:Ct,adjustedHeight:Pt,currentTheme:Lt,transition:Rt,introEnabled:It,tableId:Tt,rafRef:$t,renderFnRef:Bt,scheduleRender:Ht,cancelRender:Ot}=kt,jt=function(){const[e,t]=yn(!1);return vn(()=>{t(!0)},[]),e}(),Dt=function(){const e=bn(xn,wn,kn);return pn(e).current}(),Ft=n(()=>c(h),[h]),Et=ce??fe,zt=ue??me,Nt=de??ge,Wt=he??pe,Gt=e(null),qt=e(null),Vt=e([]),Xt=e(De),Yt=e(Fe);Xt.current=De,Yt.current=Fe;const[Kt,Zt]=t(null),[Qt,Ut]=t(null),Jt=(e,t)=>"function"==typeof e?e({size:Mt,margin:_t,scales:t}):e,eo=Jt(ze,Qt),to=Jt(Ee,Qt),[oo,no]=t(0),ro=e(0),[io,ao]=t(!1),so=e({w:-1,h:-1}),lo=e(!1),co=xe||we,uo="streaming"===d,ho=function(e){const t=Sn(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return Mn(e,t);if(!_n(e)||!_n(t))return!1;const o=Object.keys(e),n=Object.keys(t);if(o.length!==n.length)return!1;for(const n of o){if(!Object.prototype.hasOwnProperty.call(t,n))return!1;const o=e[n],r=t[n];if(!Object.is(o,r))if(Array.isArray(o)&&Array.isArray(r)){if(!Mn(o,r))return!1}else{if(!_n(o)||!_n(r))return!1;if(!An(o,r))return!1}}return!0}(t.current,e)||(t.current=e),t.current}(n(()=>({chartType:l,runtimeMode:uo?"streaming":"bounded",windowSize:te,windowMode:ee,extentPadding:U,projection:M,oAccessor:uo?void 0:f,rAccessor:uo?void 0:m,accessorRevision:A,colorAccessor:g,symbolAccessor:p,symbolMap:y,stackBy:b,groupBy:v,multiAxis:x,timeAccessor:uo?w:void 0,valueAccessor:uo?k||("string"==typeof m||"function"==typeof m?m:void 0):void 0,categoryAccessor:uo?S||f:void 0,rExtent:Z,oExtent:Q,axisExtent:ve,barPadding:R,roundedTop:I,gradientFill:T,trackFill:$,baselinePadding:B,innerRadius:H,cornerRadius:O,normalize:j,startAngle:D,sweepAngle:F,dynamicColumnWidth:E,bins:z,showOutliers:N,showIQR:W,amplitude:G,connectorOpacity:q,showLabels:V,connectorAccessor:X,connectorStyle:Y,dataIdAccessor:K,oSort:J,pieceStyle:oe,summaryStyle:ne,colorScheme:re,themeCategorical:Lt?.colors?.categorical,themeSemantic:Nr(Lt),themeSequential:Lt?.colors?.sequential,themeDiverging:Lt?.colors?.diverging,barColors:ie,decay:Ze,pulse:Ue,transition:Rt,introAnimation:It,staleness:rt,customLayout:ut,onLayoutError:yt,layoutConfig:vt,layoutMargin:_t}),[l,te,ee,U,M,f,m,A,g,p,y,b,v,x,w,k,S,Z,Q,ve,R,I,T,$,B,H,O,j,D,F,E,z,N,W,G,q,V,X,Y,K,J,oe,ne,re,ie,Ze,Ue,Rt?.duration,Rt?.easing,It,rt,uo,Lt,ut,yt,vt,_t])),fo=e(null);fo.current||(fo.current=new $e(ho));const mo=r(()=>{const e=Xt.current,t=Yt.current;if(!t||!e)return;const o=function(e,t){if(!t)return[];const o=new Set,n=[];for(const r of e){if(!r||"object"!=typeof r)continue;const e="function"==typeof t?t(r):r[t];if(null==e)continue;const i=e+"";o.has(i)||(o.add(i),n.push(i))}return n}(fo.current?.getData()??[],e);(function(e,t){if(e.length!==t.length)return!1;for(let o=0;e.length>o;o++)if(e[o]!==t[o])return!1;return!0})(o,Vt.current)||(Vt.current=o,t(o))},[]);!function(e,t,o,n){We(()=>{e.current?.updateConfig(t),o.current=!0,n()},[t,n,e,o])}(fo,ho,wt,Ht),function(e,t,o,n){const r=Ge(null);We(()=>{const i=e.current;if(!i)return;const a=t??null;r.current!==a&&(r.current=a,i.setLayoutSelection(a),i.hasCustomRestyle?i.restyleScene(a):o.current=!0,n())},[t,n,e,o])}(fo,xt,wt,Ht);const go=e(null);go.current||(go.current=new u(e=>{const t=fo.current;t&&t.ingest(e)&&(wt.current=!0,Ht())}));const po=r(e=>{go.current?.push(e)},[]),yo=r(e=>{go.current?.pushMany(e)},[]),bo=r(()=>{go.current?.clear(),fo.current?.clear(),wt.current=!0,Ht()},[Ht]),vo=r(e=>{go.current?.clearLastData(),go.current?.setReplacementData(e)},[]);i(s,()=>({push:po,pushMany:yo,replace:vo,remove:e=>{go.current?.flush();const t=fo.current?.remove(e)??[];if(t.length>0){const e=qt.current?.data;!!qt.current&&t.some(Array.isArray(e)?t=>e.includes(t):t=>t===e)&&(qt.current=null,Zt(null)),wt.current=!0,Ht()}return t},update:(e,t)=>{go.current?.flush();const o=fo.current?.update(e,t)??[];return o.length>0&&(wt.current=!0,Ht()),o},clear:bo,getData:()=>(go.current?.flush(),fo.current?.getData()??[]),getScales:()=>fo.current?.scales??null,getCustomLayout:()=>fo.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>fo.current?.lastCustomLayoutFailure??null}),[po,yo,vo,bo,Ht]),o(()=>{h&&go.current?.setBoundedData(Ft)},[h,Ft]);const{hoverHandlerRef:xo,hoverLeaveRef:wo,onPointerMove:ko,onPointerLeave:So}=kt;xo.current=e=>{if(!co)return;const t=Gt.current;if(!t)return;const o=t.getBoundingClientRect(),n=e.clientX-o.left-_t.left,r=e.clientY-o.top-_t.top;if(0>n||n>Ct||0>r||r>Pt)return void(qt.current&&(qt.current=null,Zt(null),Se&&Se(null),Ht()));const i=fo.current;if(!i||0===i.scene.length)return;const a="radial"===M,s=nt(i.scene,a?n-Ct/2:n,a?r-Pt/2:r,30,i.pointQuadtree,i.maxPointRadius);if(!s)return void(qt.current&&(qt.current=null,Zt(null),Se&&Se(null),Ht()));const c=hr(s.datum||{},s.x,s.y,{...s.stats&&{stats:s.stats},...s.category&&{category:s.category},__oAccessor:"string"==typeof f?f:void 0,__rAccessor:"string"==typeof m?m:void 0,__chartType:l});qt.current=c,Zt(c),Se&&(Se(c),wt.current=!0),Ht()},wo.current=()=>{qt.current&&(qt.current=null,Zt(null),Se&&(Se(null),wt.current=!0),Ht())};const Ao=r(e=>{if(!Ae)return;const t=Gt.current;if(!t)return Ae(null),wt.current=!0,void Ht();const o=t.getBoundingClientRect(),n=e.clientX-o.left-_t.left,r=e.clientY-o.top-_t.top;if(0>n||n>Ct||0>r||r>Pt)return Ae(null),wt.current=!0,void Ht();const i=fo.current;if(!i||0===i.scene.length)return Ae(null),wt.current=!0,void Ht();const a="radial"===M,s=nt(i.scene,a?n-Ct/2:n,a?r-Pt/2:r,30,i.pointQuadtree,i.maxPointRadius);if(!s)return Ae(null),wt.current=!0,void Ht();Ae(hr(s.datum||{},s.x,s.y,{...s.stats&&{stats:s.stats},...s.category&&{category:s.category},__oAccessor:"string"==typeof f?f:void 0,__rAccessor:"string"==typeof m?m:void 0,__chartType:l})),wt.current=!0,Ht()},[Pt,Ct,l,Ae,_t,f,M,m,Ht]),Mo=e(-1),_o=e(null),Co=e(null),Po=r(e=>{const t=fo.current;if(!t||0===t.scene.length)return;const o=t.version;let n;if(Co.current&&Co.current.version===o)n=Co.current.graph;else{const e=function(e){const t=[];for(const o of e)if("rect"===o.type&&null!=o.x){if(null==o.datum)continue;t.push({x:o.x+o.w/2,y:o.y+o.h/2,datum:o.datum,shape:"rect",w:o.w,h:o.h,group:o.group??o.datum?.category??""})}else if("point"===o.type)t.push({x:o.x,y:o.y,datum:o.datum,shape:"circle",group:"_default"});else if("symbol"===o.type){if(0>=o.size)continue;t.push({x:o.x,y:o.y,datum:o.datum,shape:"circle",group:"_default"})}else if("glyph"===o.type){if(0>=o.size||null==o.datum)continue;const e=tt(o.glyph,o.size);t.push({x:o.x+e.centerDx,y:o.y+e.centerDy,datum:o.datum,shape:"rect",w:2*e.halfWidth,h:2*e.halfHeight,group:"_default"})}else if("wedge"===o.type&&null!=o.cx){if(null===o.datum)continue;const e=((o.startAngle||0)+(o.endAngle||0))/2,n=((o.innerRadius||0)+(o.outerRadius||50))/2;t.push({x:o.cx+Math.cos(e)*n,y:o.cy+Math.sin(e)*n,datum:o.datum,shape:"wedge",group:"_default"})}return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}(t.scene);if(0===e.length)return;n=function(e){const t=new Map;for(const o of e){const e=o.group??"_default";let n=t.get(e);n||(n=[],t.set(e,n)),n.push(o)}for(const e of t.values()){e.sort((e,t)=>e.x-t.x||e.y-t.y);for(let t=0;e.length>t;t++)e[t]._groupIndex=t}const o=Array.from(t.keys()).sort((e,o)=>{const n=t.get(e),r=t.get(o);return(n.length>0?n[0].y:0)-(r.length>0?r[0].y:0)}),n=Array.from(t.values()).flat();n.sort((e,t)=>e.x-t.x||e.y-t.y);const r=new Map;for(let e=0;n.length>e;e++){n[e]._flatIndex=e;const t=n[e].datum?.id;null!=t&&r.set(t+"",e)}return{flat:n,groups:o,byGroup:t,idToIdx:r}}(e),Co.current={version:o,graph:n}}const r=Mo.current;if(0>r){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),Mo.current=0;const t=n.flat[0];_o.current={shape:t.shape,w:t.w,h:t.h};const o={...ht(t),__oAccessor:"string"==typeof f?f:void 0,__rAccessor:"string"==typeof m?m:void 0,__chartType:l};return qt.current=o,Zt(o),Se&&Se(o),void Ht()}const i=function(e,t){if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const o=Math.max(0,Math.min(t,e.flat.length-1)),n=e.flat[o];return{flatIndex:o,group:n.group??"_default",indexInGroup:n._groupIndex??0}}(n,r),a=function(e,t,o){const{group:n,indexInGroup:r}=t,i=o.byGroup.get(n);switch(e){case"ArrowRight":return i.length-1>r?i[r+1]._flatIndex:t.flatIndex;case"ArrowLeft":return r>0?i[r-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=o.groups.indexOf(n);return o.groups.length-1>e?dt(o,o.groups[e+1],i[r]):t.flatIndex}case"ArrowUp":{const e=o.groups.indexOf(n);return e>0?dt(o,o.groups[e-1],i[r]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*o.flat.length)),o.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*o.flat.length)),0);case"Home":return 0;case"End":return o.flat.length-1;case"Escape":return-1;default:return null}}(e.key,i,n);if(null===a)return;if(e.preventDefault(),0>a)return Mo.current=-1,_o.current=null,qt.current=null,Zt(null),Se&&Se(null),void Ht();Mo.current=a;const s=n.flat[a];_o.current={shape:s.shape,w:s.w,h:s.h};const c={...ht(s),__oAccessor:"string"==typeof f?f:void 0,__rAccessor:"string"==typeof m?m:void 0,__chartType:l};qt.current=c,Zt(c),Se&&Se(c),Ht()},[Se,Ht]),Lo=r(e=>{Mo.current=-1,_o.current=null,ko(e)},[ko]);Bt.current=()=>{$t.current=null;const e=Gt.current;if(!e)return;const t=e.getContext("2d");if(!t)return;const o=fo.current;if(!o)return;const n="undefined"!=typeof performance?performance.now():Date.now(),r=o.advanceTransition(St.current?n+1e6:n),i=!St.current&&r,a=so.current.w!==Ct||so.current.h!==Pt,s=wt.current;let c=!1;!s&&!a||i&&!a||(o.computeScene({width:Ct,height:Pt}),so.current={w:Ct,h:Pt},c=!0,mo()),wt.current=s&&i&&!c;const u=function(e,t,o,n){const r=n.current,i=!0===e.lastCustomLayoutFailure?.preservedLastGoodScene,a=!i&&e.hasActivePulsesAt(t),s=!(o||i||!a&&!r)&&e.refreshPulse(t);return n.current=a,{changed:s,pending:a}}(o,n,c,lo);(c||i)&&e.setAttribute("aria-label",Gn(o.scene,l+" chart"));const d=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))}(),h=Mt[0]*d,f=Mt[1]*d;e.width===h&&e.height===f||(e.width=h,e.height=f,e.style.width=Mt[0]+"px",e.style.height=Mt[1]+"px"),t.setTransform(d,0,0,d,0,0),t.clearRect(0,0,Mt[0],Mt[1]);const m=rt&&o.lastIngestTime>0&&n-o.lastIngestTime>(rt?.threshold??5e3);m&&(t.globalAlpha=rt?.dimOpacity??.5),function(e,t){const{background:o,hasBackgroundGraphics:n=!1,themeBackground:r="",x:i=0,y:a=0,width:s,height:l}=t;if("transparent"===o)return!1;if(n)return!1;const c=o||(r&&"transparent"!==r?r:"")||null;if(!c)return!1;const u=$n(e,c);u&&(e.fillStyle=u,e.fillRect(i,a,s,l))}(t,{background:Xe,hasBackgroundGraphics:!!Ee,themeBackground:Ee||"transparent"===Xe||Xe?"":getComputedStyle(e).getPropertyValue("--semiotic-bg").trim(),width:Mt[0],height:Mt[1]});const g="radial"===M;t.save(),t.beginPath(),t.rect(_t.left,_t.top,Ct,Pt),t.clip(),g?(t.save(),t.translate(_t.left+Ct/2,_t.top+Pt/2)):t.translate(_t.left,_t.top);const p=ut?Zi.custom:Zi[l]||[],y={width:Ct,height:Pt};for(const e of p)e(t,o.scene,o.scales,y);g&&t.restore(),t.restore(),m&&(t.globalAlpha=1),c&&o.scales?(Ut(o.scales),no(e=>e+1),ro.current=n):i&&o.scales&&n-ro.current>=33&&(no(e=>e+1),ro.current=n),rt?.showBadge&&ao(!!m),(i||null!=o.activeTransition||u.pending)&&Ht()},function(e){const{hydrated:t,wasHydratingFromSSR:o,storeRef:n,dirtyRef:r,renderFnRef:i,cancelRender:a,cleanup:s}=e;vn(()=>{t&&o&&n.current?.cancelIntroAnimation?.(),r.current=!0,a?.(),i.current()},[t,o]);const l=pn(s);l.current=s,mn(()=>()=>l.current?.(),[])}({hydrated:jt,wasHydratingFromSSR:Dt,storeRef:fo,dirtyRef:wt,renderFnRef:Bt,cancelRender:Ot,cleanup:()=>go.current?.clear()}),o(()=>{wt.current=!0,Ht()},[l,Ct,Pt,ae,Xe,Ht]),function(e,t,o,n,r,i){const a=mt("fresh");ft(()=>{if(!e)return;const s=setInterval(()=>{const s=t.current;if(!s||0===s.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=function(e,t){if(!e||0>=t)return pt;const o=null!=e.threshold&&e.threshold>0?e.threshold:5e3,n=e.graded;if(n){const e="object"==typeof n?n:{},r=function(e,t,o={}){return Number.isFinite(t)&&t>0?Number.isNaN(e)?"fresh":e===1/0?"expired":0>e||t*(o.fresh??1)>e?"fresh":t*(o.aging??1.5)>e?"aging":t*(o.stale??3)>e?"stale":"expired":"fresh"}(t,o,e.thresholds);return{alpha:{...gt,...e.opacities??{}}[r],band:r,isStale:"fresh"!==r}}return t>o?{alpha:e.dimOpacity??.5,band:"stale",isStale:!0}:pt}(e,l-s.lastIngestTime);c.band===a.current&&c.isStale===r||(a.current=c.band,c.isStale!==r&&i(c.isStale),o.current=!0,n())},1e3);return()=>clearInterval(s)},[e,r,n])}(rt,fo,wt,Ht,io,ao);const Ro=co&&Kt?ke?ke(Kt):ta(ea,{hover:Kt}):null,Io="radial"===M,To=Ro?ta(_r,{x:Kt?Io?Kt.x+Ct/2:Kt.x:0,y:Kt?Io?Kt.y+Pt/2:Kt.y:0,containerWidth:Ct,containerHeight:Pt,margin:_t,className:"stream-ordinal-tooltip",children:Ro}):null,$o=Go(f,void 0,"__semiotic_resolvedO",""),Bo=Go(m,void 0,"__semiotic_resolvedR",""),Ho=$o.key,Oo=Bo.key,jo=function(e,t,o){return n=>{if(!n||!o||!e.fn&&!t.fn)return n;let r=!1;const i=n.map(o=>{const n=e.fn&&e.key&&!(e.key in o),i=t.fn&&t.key&&!(t.key in o);if(!n&&!i)return o;r=!0;const a={...o};return n&&(a[e.key]=e.fn(o)),i&&(a[t.key]=t.fn(o)),a});return r?i:n}}($o,Bo,Me&&Me.length>0||!1);if(fn||!jt&&Dt){const e=fo.current;e&&h&&(e.ingest({inserts:Ft,bounded:!0}),e.computeScene({width:Ct,height:Pt}));const t=e?.scene??[],o=e?.scales??null,n=Jt(ze,o),r=Jt(Ee,o),i="radial"===M,a=i?_t.left+Ct/2:_t.left,s=i?_t.top+Pt/2:_t.top;return oa("div",{ref:At,className:"stream-ordinal-frame"+(Ve?" "+Ve:""),role:"img","aria-label":lt||("string"==typeof qe?qe:"Ordinal chart"),style:{position:"relative",width:C?"100%":Mt[0],height:P?"100%":Mt[1]},children:[ta(rr,{summary:ct}),oa("svg",{xmlns:"http://www.w3.org/2000/svg",width:Mt[0],height:Mt[1],style:{position:"absolute",left:0,top:0},children:[r&&ta("g",{transform:`translate(${_t.left},${_t.top})`,children:r}),oa("g",{transform:`translate(${a},${s})`,children:[Xe&&ta("rect",{x:0,y:0,width:Ct,height:Pt,fill:Xe}),t.map((e,t)=>function(e,t,o){const n=("category"in e?e.category:void 0)||("group"in e?e.group:void 0)||"",r=o=>`ord-${e.type}-${n}-${t}-${o}`,i=`ord-${e.type}-${n}-${t}`;switch(e.type){case"rect":{const t=e,o=hn(i)+"-grad",n=function(e,t){const o=e.fillGradient;if(!o)return null;let n=e.x,r=e.y,i=e.x,a=e.y+e.h;"bottom"===e.roundedEdge?(r=e.y+e.h,a=e.y):"right"===e.roundedEdge?(n=e.x+e.w,r=e.y,i=e.x,a=e.y):"left"===e.roundedEdge&&(n=e.x,r=e.y,i=e.x+e.w,a=e.y);const s=[];if("colorStops"in o){const e=o.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>e.length)return null;for(let t=0;e.length>t;t++)s.push(ln("stop",{offset:e[t].offset,stopColor:e[t].color},t))}else{const t=dn(e.style.fill);s.push(ln("stop",{offset:0,stopColor:t,stopOpacity:o.topOpacity},"0")),s.push(ln("stop",{offset:1,stopColor:t,stopOpacity:o.bottomOpacity},"1"))}return ln("linearGradient",{id:t,gradientUnits:"userSpaceOnUse",x1:n,y1:r,x2:i,y2:a,children:s})}(t,o),r=n?`url(#${o})`:dn(t.style.fill);if(t.cornerRadii&&on(t.cornerRadii)){const e=function(e){const{x:t,y:o,w:n,h:r}=e,{tl:i,tr:a,br:s,bl:l}=nn(e);let c=`M${t+i},${o}`;return c+=` L${t+n-a},${o}`,a>0&&(c+=` A${a},${a} 0 0 1 ${t+n},${o+a}`),c+=` L${t+n},${o+r-s}`,s>0&&(c+=` A${s},${s} 0 0 1 ${t+n-s},${o+r}`),c+=` L${t+l},${o+r}`,l>0&&(c+=` A${l},${l} 0 0 1 ${t},${o+r-l}`),c+=` L${t},${o+i}`,i>0&&(c+=` A${i},${i} 0 0 1 ${t+i},${o}`),c+=" Z",c}(t);return cn(en.Fragment,{children:[n&&ln("defs",{children:n}),ln("path",{d:e,fill:r,opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})]},i)}if(t.roundedTop&&t.roundedTop>0){const e=Math.min(t.roundedTop,t.w/2,t.h/2),{x:o,y:a,w:s,h:l}=t;let c;switch(t.roundedEdge){case"right":c=`M${o},${a} L${o+s-e},${a} A${e},${e} 0 0 1 ${o+s},${a+e} L${o+s},${a+l-e} A${e},${e} 0 0 1 ${o+s-e},${a+l} L${o},${a+l} Z`;break;case"left":c=`M${o+s},${a} L${o+e},${a} A${e},${e} 0 0 0 ${o},${a+e} L${o},${a+l-e} A${e},${e} 0 0 0 ${o+e},${a+l} L${o+s},${a+l} Z`;break;case"bottom":c=`M${o},${a} L${o+s},${a} L${o+s},${a+l-e} A${e},${e} 0 0 1 ${o+s-e},${a+l} L${o+e},${a+l} A${e},${e} 0 0 1 ${o},${a+l-e} Z`;break;default:c=`M${o},${a+l} L${o},${a+e} A${e},${e} 0 0 1 ${o+e},${a} L${o+s-e},${a} A${e},${e} 0 0 1 ${o+s},${a+e} L${o+s},${a+l} Z`}return cn(en.Fragment,{children:[n&&ln("defs",{children:n}),ln("path",{d:c,fill:r,opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})]},i)}return cn(en.Fragment,{children:[n&&ln("defs",{children:n}),ln("rect",{x:t.x,y:t.y,width:t.w,height:t.h,fill:r,opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})]},i)}case"point":{const t=e;return ln("circle",{cx:t.x,cy:t.y,r:t.r,fill:dn(t.style.fill),opacity:t.style.opacity??.8,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},i)}case"symbol":return function(e,t,o){const n=se(e.symbolType,e.size,e.path);return ln("path",{d:n,transform:e.rotation?`translate(${e.x},${e.y}) rotate(${180*e.rotation/Math.PI})`:`translate(${e.x},${e.y})`,fill:e.style.fill?dn(e.style.fill):"none",opacity:e.style.opacity,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth},`${o??""}symbol-${t}`)}(e,t,o);case"glyph":return function(e,t,o,n){const r=e.glyph;if(!r?.parts?.length||0>=e.size)return null;const i=Ke(r,e.size);if(0>=i.scale)return null;const a=`translate(${t},${o})${e.rotation?` rotate(${180*e.rotation/Math.PI})`:""} translate(${i.offsetX},${i.offsetY}) scale(${i.scale})`,s=e.color??("string"==typeof e.style.fill?e.style.fill:void 0),l=et(r,e.fraction??1,e.fractionStart??0,e.fractionDirection??"horizontal"),c=l?hn(n+"-clip"):void 0,u=(e.style.opacity??1)*(e._decayOpacity??1)*(e.style.fillOpacity??1),d=t=>r.parts.map((o,n)=>{const r=t?"none"===o.fill?void 0:t:Qe(o.fill,s,e.accent),i=t?o.stroke&&"none"!==o.stroke?t:void 0:Qe(o.stroke??"none",s,e.accent);return r||i?ln("path",{d:o.d,fill:r??"none",stroke:i,strokeWidth:i?o.strokeWidth??1:void 0,strokeLinecap:o.strokeLinecap,strokeLinejoin:o.strokeLinejoin,opacity:o.opacity},n):null});return cn("g",{transform:a,opacity:1===u?void 0:u,children:[l&&c&&ln("clipPath",{id:c,children:ln("rect",{x:l.x,y:l.y,width:l.width,height:l.height})}),l&&e.ghostColor?ln("g",{children:d(e.ghostColor)}):null,l&&c?ln("g",{clipPath:`url(#${c})`,children:d()}):d()]},n)}(e,e.x,e.y,`${o??""}ord-glyph-${e.pointId??t}`);case"wedge":{const n=e;if(n._gradientBand&&n._gradientBand.colors.length>0){const e=hn(`${o?o+"-":""}gauge-grad-${n.category||i}-${t}`),{clipPath:r,slices:a}=sn({innerRadius:n.innerRadius,outerRadius:n.outerRadius,startAngle:n.startAngle,endAngle:n.endAngle,cornerRadius:n.cornerRadius,roundStart:n.roundedEnds?.start??!0,roundEnd:n.roundedEnds?.end??!0,colors:n._gradientBand.colors});return cn("g",{transform:`translate(${n.cx},${n.cy})`,opacity:n.style.opacity,fillOpacity:n.style.fillOpacity,children:[ln("defs",{children:ln("clipPath",{id:e,children:ln("path",{d:r})})}),ln("g",{clipPath:`url(#${e})`,children:a.map((e,t)=>ln("path",{d:e.d,fill:dn(e.color)},t))}),n.style.stroke&&"none"!==n.style.stroke&&ln("path",{d:r,fill:"none",stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})]},i)}let r;if(n.roundedEnds)r=an({innerRadius:n.innerRadius,outerRadius:n.outerRadius,startAngle:n.startAngle,endAngle:n.endAngle,cornerRadius:n.cornerRadius,roundStart:n.roundedEnds.start,roundEnd:n.roundedEnds.end});else{const e=tn().innerRadius(n.innerRadius).outerRadius(n.outerRadius).startAngle(n.startAngle+Math.PI/2).endAngle(n.endAngle+Math.PI/2);n.cornerRadius&&e.cornerRadius(n.cornerRadius),r=e(un)||""}return ln("path",{d:r,transform:`translate(${n.cx},${n.cy})`,fill:dn(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},i)}case"boxplot":{const t=e,o=t.columnWidth/2;return cn("g","vertical"===t.projection?{children:[ln("line",{x1:t.x,y1:t.minPos,x2:t.x,y2:t.maxPos,stroke:t.style.stroke||"#333",strokeWidth:1}),ln("rect",{x:t.x-o,y:Math.min(t.q1Pos,t.q3Pos),width:t.columnWidth,height:Math.abs(t.q3Pos-t.q1Pos),fill:dn(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:1}),ln("line",{x1:t.x-o,y1:t.medianPos,x2:t.x+o,y2:t.medianPos,stroke:t.style.stroke||"#333",strokeWidth:2}),ln("line",{x1:t.x-.5*o,y1:t.minPos,x2:t.x+.5*o,y2:t.minPos,stroke:t.style.stroke||"#333",strokeWidth:1}),ln("line",{x1:t.x-.5*o,y1:t.maxPos,x2:t.x+.5*o,y2:t.maxPos,stroke:t.style.stroke||"#333",strokeWidth:1})]}:{children:[ln("line",{x1:t.minPos,y1:t.y,x2:t.maxPos,y2:t.y,stroke:t.style.stroke||"#333",strokeWidth:1}),ln("rect",{x:Math.min(t.q1Pos,t.q3Pos),y:t.y-o,width:Math.abs(t.q3Pos-t.q1Pos),height:t.columnWidth,fill:dn(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:1}),ln("line",{x1:t.medianPos,y1:t.y-o,x2:t.medianPos,y2:t.y+o,stroke:t.style.stroke||"#333",strokeWidth:2}),ln("line",{x1:t.minPos,y1:t.y-.5*o,x2:t.minPos,y2:t.y+.5*o,stroke:t.style.stroke||"#333",strokeWidth:1}),ln("line",{x1:t.maxPos,y1:t.y-.5*o,x2:t.maxPos,y2:t.y+.5*o,stroke:t.style.stroke||"#333",strokeWidth:1})]},i)}case"violin":{const t=e,o=[ln("path",{d:t.pathString,transform:t.translateX||t.translateY?`translate(${t.translateX},${t.translateY})`:void 0,fill:dn(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:t.style.strokeWidth||1},r("path"))];if(t.iqrLine&&t.bounds){const e=t.bounds,n=e.x+e.width/2,i=e.y+e.height/2;e.height>e.width?o.push(ln("line",{x1:n,y1:t.iqrLine.q1Pos,x2:n,y2:t.iqrLine.q3Pos,stroke:t.style.stroke||"#333",strokeWidth:2},r("iqr")),ln("circle",{cx:n,cy:t.iqrLine.medianPos,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},r("med"))):o.push(ln("line",{x1:t.iqrLine.q1Pos,y1:i,x2:t.iqrLine.q3Pos,y2:i,stroke:t.style.stroke||"#333",strokeWidth:2},r("iqr")),ln("circle",{cx:t.iqrLine.medianPos,cy:i,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},r("med")))}return ln("g",{children:o},i)}case"connector":return ln("line",{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stroke:e.style.stroke||"#999",strokeWidth:e.style.strokeWidth||1,opacity:e.style.opacity??.5},i);case"trapezoid":{const t=e,o=t.points.map(e=>`${e[0]},${e[1]}`).join(" ");return ln("polygon",{points:o,fill:dn(t.style.fill,"#999"),opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},i)}default:return null}}(e,t,Tt)).filter(Boolean)]})]}),ta(Wo,{width:Ct,height:Pt,totalWidth:Mt[0],totalHeight:Mt[1],margin:_t,scales:o,showAxes:ae,showCategoryTicks:le,oLabel:Et,rLabel:zt,oFormat:Nt,rFormat:Wt,rTickValues:ye,tickLabelEdgeAlign:be,axisExtent:ve,showGrid:Pe,title:qe,legend:Le,legendHoverBehavior:Re,legendClickBehavior:Ie,legendHighlightedCategory:Te,legendIsolatedCategories:Be,legendPosition:Oe,legendLayout:je,foregroundGraphics:He(n,Ne(fo.current?.customLayoutOverlays,xt??null)),annotations:Me,autoPlaceAnnotations:_e,svgAnnotationRules:Ce,annotationFrame:0,xAccessor:Ho,yAccessor:Oo,annotationData:jo(e?.getData())}),Ye&&"radial"===M&&ta("div",{style:{position:"absolute",left:_t.left+Ct/2,top:_t.top+Pt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:Ye})]})}return oa("div",{ref:At,className:"stream-ordinal-frame"+(Ve?" "+Ve:""),role:"group","aria-label":lt||("string"==typeof qe?qe:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:C?"100%":Mt[0],height:P?"100%":Mt[1],overflow:"visible"},onKeyDown:Po,children:[st&&ta(ir,{tableId:Tt}),st&&ta(nr,{scene:fo.current?.scene??[],chartType:l+" chart",tableId:Tt,chartTitle:"string"==typeof qe?qe:void 0}),ta(rr,{summary:ct}),ta(ar,{hoverPoint:Kt}),oa("div",{role:"img","aria-label":lt||("string"==typeof qe?qe:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:co?Lo:void 0,onMouseLeave:co?So:void 0,onClick:Ae?Ao:void 0,children:[to&&ta("svg",{style:{position:"absolute",top:0,left:0,width:Mt[0],height:Mt[1],pointerEvents:"none"},children:ta("g",{transform:`translate(${_t.left},${_t.top})`,children:to})}),ta(zo,{width:Ct,height:Pt,totalWidth:Mt[0],totalHeight:Mt[1],margin:_t,scales:Qt,showAxes:ae,showGrid:Pe,rFormat:Wt,rTickValues:ye,axisExtent:ve}),ta("canvas",{ref:Gt,"aria-label":Gn(fo.current?.scene??[],l+" chart"),style:{position:"absolute",top:0,left:0,width:Mt[0],height:Mt[1]}}),ta(Wo,{width:Ct,height:Pt,totalWidth:Mt[0],totalHeight:Mt[1],margin:_t,scales:Qt,showAxes:ae,showCategoryTicks:le,oLabel:Et,rLabel:zt,oFormat:Nt,rFormat:Wt,rTickValues:ye,axisExtent:ve,showGrid:Pe,title:qe,legend:Le,legendHoverBehavior:Re,legendClickBehavior:Ie,legendHighlightedCategory:Te,legendIsolatedCategories:Be,legendPosition:Oe,legendLayout:je,foregroundGraphics:He(eo,Ne(fo.current?.customLayoutOverlays,xt??null)),annotations:Me,autoPlaceAnnotations:_e,svgAnnotationRules:Ce,annotationFrame:oo,xAccessor:Ho,yAccessor:Oo,annotationData:jo(fo.current?.getData()),underlayRendered:!0}),(it||at)&&"radial"!==M&&ta(Jo,{width:Ct,height:Pt,totalWidth:Mt[0],totalHeight:Mt[1],margin:_t,scales:Qt,onBrush:at||(()=>{})}),Ye&&"radial"===M&&ta("div",{style:{position:"absolute",left:_t.left+Ct/2,top:_t.top+Pt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:Ye}),rt?.showBadge&&ta(bt,{isStale:io,position:rt.badgePosition}),ta(cr,{active:Mo.current>=0,hoverPoint:Kt,margin:_t,size:Mt,shape:_o.current?.shape,width:_o.current?.w,height:_o.current?.h}),To]})]})}));ra.displayName="StreamOrdinalFrame";var ia=ra;function aa(e){const{title:t,description:o,summary:n,accessibleTable:r,className:i,animate:a,axisExtent:s,autoPlaceAnnotations:l}=e,c={};return t&&(c.title=t),o&&(c.description=o),n&&(c.summary=n),void 0!==r&&(c.accessibleTable=r),i&&(c.className=i),null!=a&&(c.animate=a),void 0!==s&&(c.axisExtent=s),void 0!==l&&(c.autoPlaceAnnotations=l),c}function sa(e){const{linkedHover:t,selection:o,onObservation:n,onClick:r,hoverRadius:i,hoverHighlight:a,forceHoverBehavior:s,forceClickBehavior:l,mobileInteraction:c,customHoverBehavior:u,customClickBehavior:d,linkedHoverInClickPredicate:h=!0}=e,f={},m=c?.enabled?Math.max(i??30,Math.ceil((c.targetSize||44)/2),24):i;return(s||t||n||r||a)&&(f.customHoverBehavior=u),d&&(l||(h?n||r||t:n||r)||c?.enabled&&(c.tapToSelect||c.tapToLockTooltip)&&(t||a||o))&&(f.customClickBehavior=d),null!=m&&(f.hoverRadius=m),f}function la(e){const{tooltip:t,defaultTooltipContent:o}=e;return{tooltipContent:!1===t?()=>null:Ar(t)||o}}import{useMemo as ca,forwardRef as ua,useRef as da}from"react";import{useMemo as ha,useCallback as fa,useState as ma,useId as ga,useEffect as pa,useRef as ya}from"react";import{createContext as ba,useContext as va,useMemo as xa}from"react";import{jsx as wa}from"react/jsx-runtime";var ka=ba(null);function Sa(){return va(ka)}import{createContext as Aa,useContext as Ma,useEffect as _a,useId as Ca,useLayoutEffect as Pa,useMemo as La,useRef as Ra,useState as Ia,useCallback as Ta}from"react";function $a(e){const t=[];for(const[o,n]of Object.entries(e.fields))if("point"===n.type)t.push(e=>n.values.has(e[o]));else{const[e,r]=n.range;t.push(t=>{const n=t[o];return n>=e&&r>=n})}return e=>t.every(t=>t(e))}function Ba(e,t){let o=e.get(t);return o||(o={name:t,resolution:"union",clauses:new Map},e.set(t,o)),o}function Ha(e,t){if(e.type!==t.type)return!1;if("interval"===e.type&&"interval"===t.type)return e.range[0]===t.range[0]&&e.range[1]===t.range[1];if("point"===e.type&&"point"===t.type){if(e.values.size!==t.values.size)return!1;for(const o of e.values)if(!t.values.has(o))return!1;return!0}return!1}var[Oa,ja]=Er(e=>({selections:new Map,setClause(t,o){e(e=>{const n=e.selections.get(t),r=n?.clauses.get(o.clientId);if(r&&function(e,t){if(e.clientId!==t.clientId||e.type!==t.type)return!1;const o=Object.entries(e.fields);if(o.length!==function(e){let t=0;for(const o in e)t++;return t}(t.fields))return!1;for(const[e,n]of o){const o=t.fields[e];if(!o||!Ha(n,o))return!1}return!0}(r,o))return{};const i=new Map(e.selections),a=Ba(i,t),s=new Map(a.clauses);return s.set(o.clientId,o),i.set(t,{...a,clauses:s}),{selections:i}})},clearClause(t,o){e(e=>{const n=e.selections.get(t);if(!n||!n.clauses.has(o))return{};const r=new Map(e.selections),i=new Map(n.clauses);return i.delete(o),r.set(t,{...n,clauses:i}),{selections:r}})},setResolution(t,o){e(e=>{const n=e.selections.get(t);if(n?.resolution===o)return{};const r=new Map(e.selections),i=Ba(r,t);return r.set(t,{...i,resolution:o}),{selections:r}})},clearSelection(t){e(e=>{const o=e.selections.get(t);if(!o||0===o.clauses.size)return{};const n=new Map(e.selections);return n.set(t,{...o,clauses:new Map}),{selections:n}})}})),[Da,Fa]=Er(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const o=e.observations;return o.push(t),o.length>e.maxObservations&&o.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));import{useId as Ea,useMemo as za,useCallback as Na}from"react";import{useSyncExternalStore as Wa}from"react";var Ga={positions:new Map},qa=new Set;function Va(){for(const e of qa)e()}function Xa(e,t){const o=Ga.positions.get(e);if(o?.locked)return;if(!o||o.sourceId!==t)return;const n=new Map(Ga.positions);n.delete(e),Ga={positions:n},Va()}function Ya(e,t){const o=Ga.positions.get(e);if(!o?.locked)return;if(t&&o.sourceId!==t)return;const n=new Map(Ga.positions);n.delete(e),Ga={positions:n},Va()}function Ka(e){const t=Ea(),o=e.clientId||t,{name:n}=e,r=ja(e=>e.selections.get(n)),i=ja(e=>e.setClause),a=ja(e=>e.clearClause),s=za(()=>!!r&&r.clauses.size>0,[r]);return{predicate:za(()=>r&&0!==r.clauses.size?function(e,t){const o=[];for(const[n,r]of e.clauses)"crossfilter"===e.resolution&&n===t||o.push($a(r));return 0===o.length?()=>!0:"intersect"===e.resolution?e=>o.every(t=>t(e)):e=>o.some(t=>t(e))}(r,o):()=>!0,[r,o]),isActive:s,selectPoints:Na(e=>{const t={};let r=!1;for(const[o,n]of Object.entries(e))t[o]={type:"point",values:new Set(n)},r=!0;r&&i(n,{clientId:o,type:"point",fields:t})},[o,n,i]),selectInterval:Na(e=>{const t={};let r=!1;for(const[o,n]of Object.entries(e))t[o]={type:"interval",range:n},r=!0;r&&i(n,{clientId:o,type:"interval",fields:t})},[o,n,i]),clear:Na(()=>{a(n,o)},[a,n,o]),clientId:o}}function Za(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function Qa(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}import{jsx as Ua,jsxs as Ja}from"react/jsx-runtime";var es=Aa(!1);Aa(!1);var ts=Aa(null),os="undefined"==typeof window?_a:Pa;function ns(e){const t=Ma(ts),o=Ca(),n=function(e){const t=new Set,o=[];for(const n of e)t.has(n)||(t.add(n),o.push(n));return o}(e),r=Ra([]);(function(e,t){if(e.length!==t.length)return!1;for(let o=0;e.length>o;o++)if(e[o]!==t[o])return!1;return!0})(r.current,n)||(r.current=n);const i=r.current;os(()=>{if(t)return()=>t.unregisterCategories(o)},[t,o]),os(()=>{t&&t.registerCategories(o,i)},[t,o,i])}function rs({data:e,colorBy:t,colorScale:o,getColor:n,strokeColor:r,strokeWidth:i,categories:a}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",o={fill:t,stroke:t};return void 0!==r&&(o.stroke=r),void 0!==i&&(o.strokeWidth=i),o},type:"fill",items:(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?n(a,t,o):o?o(r):G[i%G.length];return{label:r+"",color:s}}),label:""}]}}import*as is from"react";import{jsx as as,jsxs as ss}from"react/jsx-runtime";function ls(){return Zr(e=>e.theme)}function cs(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function us(e,t){const{when:o}=e,n=t.width,r=t.height,i=function(e){if("number"==typeof e.height&&e.height>0)return e.width/e.height}(t),a=function(e){if("number"==typeof e.height&&e.height>0)return e.height>e.width?"portrait":"landscape"}(t);return!("number"==typeof o.minWidth&&o.minWidth>n||"number"==typeof o.maxWidth&&n>o.maxWidth||"number"==typeof o.minHeight&&("number"!=typeof r||o.minHeight>r)||"number"==typeof o.maxHeight&&("number"!=typeof r||r>o.maxHeight)||"number"==typeof o.minAspectRatio&&("number"!=typeof i||o.minAspectRatio>i)||"number"==typeof o.maxAspectRatio&&("number"!=typeof i||i>o.maxAspectRatio)||o.orientation&&a!==o.orientation)}function ds(e,t,o=e.responsiveRules){if(!Array.isArray(o)||0===o.length)return{props:e,matches:[]};const n=o.map((e,t)=>({rule:e,index:t})).filter(e=>us(e.rule,t)).sort((e,t)=>("number"==typeof e.rule.priority?e.rule.priority:e.index)-("number"==typeof t.rule.priority?t.rule.priority:t.index));return{props:n.reduce((e,t)=>function(e,t){const o={...e,...t};for(const n of["margin","frameProps","mobileSemantics","style"])cs(e[n])&&cs(t[n])&&(o[n]={...e[n],...t[n]});return"string"==typeof e.className&&"string"==typeof t.className&&(o.className=`${e.className} ${t.className}`),o}(e,t.rule.transform),e),matches:n}}function hs(e,t,o){const n=e.xValue??t?.[o];if(null==n)return null;const r=Number(n);return Number.isFinite(r)?r:null}function fs(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 ms(e){if(!e)return!1;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}is.createContext(void 0);var gs={enabled:!0,tapToSelect:!0,tapToLockTooltip:!0,clearSelection:"backgroundTap",targetSize:44,snap:"nearestDatum",brushHandleSize:44,standardControls:!1,enabled:!1,tapToSelect:!1,tapToLockTooltip:!1};function ps(e,t={}){const o=t.mobileSemantics?.interaction,n="number"==typeof o?.targetSize?o.targetSize:"number"==typeof t.mobileSemantics?.minimumHitTarget?t.mobileSemantics.minimumHitTarget:void 0,r="mobile"===t.mode||"number"==typeof t.width&&480>=t.width,i=!!o||void 0!==n,a=e&&"object"==typeof e?e:void 0;if(!1===e||!1===a?.enabled||void 0===e&&!r&&!i)return gs;const s=a??{};return{enabled:!0,tapToSelect:s.tapToSelect??!0,tapToLockTooltip:s.tapToLockTooltip??!0,clearSelection:s.clearSelection??"backgroundTap",targetSize:s.targetSize??n??44,snap:s.snap??"nearestDatum",brushHandleSize:s.brushHandleSize??44,standardControls:s.standardControls??!1}}function ys(){const e=ls(),t=e?.colors?.categorical;return t&&t.length>0?t:void 0}function bs(e,t,o){return ha(()=>{if(!t||"auto"===t||"function"==typeof t)return e;const n=[...e],r="function"==typeof(i=o)?i:e=>e[i];var i;return n.sort("asc"===t?(e,t)=>r(e)-r(t):(e,t)=>r(t)-r(e))},[e,t,o])}var vs={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 xs(e,t,o){const n=vs[e||"primary"],r=e&&"primary"!==e||!o?.width?n.width:o.width,i=e&&"primary"!==e||!o?.height?n.height:o.height,a=ds({...t,mode:e},{width:t.width??r,height:t.height??i}).props,s=a.mode||e,l=vs[s||"primary"],c="context"===s||"sparkline"===s,u=s&&"primary"!==s||!o?.width?l.width:o.width;return{width:a.width??u,height:a.height??(s&&"primary"!==s||!o?.height?l.height:o.height),showAxes:a.showAxes??l.showAxes,showGrid:a.showGrid??l.showGrid,enableHover:a.enableHover??(!!a.linkedHover||l.enableHover),showLegend:a.showLegend??l.showLegend,showLabels:a.showLabels??l.showLabels,title:c?void 0:a.title,description:a.description,summary:a.summary,accessibleTable:a.accessibleTable,xLabel:c?void 0:a.xLabel,yLabel:c?void 0:a.yLabel,categoryLabel:c?void 0:a.categoryLabel,valueLabel:c?void 0:a.valueLabel,marginDefaults:ws(l.marginDefaults,a.showCategoryTicks,a.orientation),compactMode:c,mobileInteraction:ps(a.mobileInteraction,{mode:s,width:a.width??u,mobileSemantics:a.mobileSemantics}),mobileSemantics:a.mobileSemantics}}function ws(e,t,o){if(!1!==t)return e;const n={...e};return"horizontal"===o?n.left=Math.min(n.left,15):n.bottom=Math.min(n.bottom,15),n}import{jsx as ks,jsxs as Ss}from"react/jsx-runtime";function As(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function Ms(e,t){if(!t)return As(e);try{const o=t(e);return null==o?As(e):o}catch{return As(e)}}function _s(e,t){return"function"==typeof t?t(e):e[t]}function Cs({categoryAccessor:e,valueAccessor:t,groupAccessor:o,groupLabel:n,pieData:r=!1,valueFormat:i}){return a=>{const s=r?a.data?.[0]||a.data||a:a.data||a,l=_s(s,e),c=_s(s,t),u=o?_s(s,o):void 0;return Ss("div",{className:"semiotic-tooltip",style:xr,children:[ks("div",{style:{fontWeight:"bold"},children:As(l)}),ks("div",{style:{marginTop:4},children:Ms(c,i)}),null!=u&&Ss("div",{style:{marginTop:2,opacity:.8},children:[n||(d=o,"string"==typeof d?d:"value"),": ",As(u)]})]});var d}}import{jsx as Ps,jsxs as Ls}from"react/jsx-runtime";function Rs({componentName:e,message:t,diagnosticHint:o,width:n,height:r}){return Ps("div",{role:"alert",style:{width:n,height:Math.max(r,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:Ls("div",{style:{textAlign:"center",maxWidth:400},children:[Ps("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:e}),Ps("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:t}),o&&Ps("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:o})]})})}import*as Is from"react";import{jsx as Ts}from"react/jsx-runtime";var $s=class extends Is.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:Ts(Rs,{componentName:"ChartErrorBoundary",message:t.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}};import{jsx as Bs}from"react/jsx-runtime";var Hs="undefined"!=typeof process&&"production"!==process.env?.NODE_ENV;function Os({componentName:e,width:t,height:o,children:n}){return Bs($s,{fallback:n=>Bs(Rs,{componentName:e,message:n.message,width:t,height:o}),children:n})}var js={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"},Ds={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Fs(e,t,o,n){if(!Hs)return;if(!t||0===t.length)return;if("string"!=typeof n)return;const r=t[0];if(!r||"object"!=typeof r)return;if(n in r)return;const i=Object.keys(r).join(", ");console.warn(`[semiotic] ${e}: ${o} "${n}" not found in data. Available keys: ${i}`)}function Es(e,t){const o=e.length,n=t.length,r=Array(n+1);for(let e=0;n>=e;e++)r[e]=e;for(let i=1;o>=i;i++){let o=r[0];r[0]=i;for(let a=1;n>=a;a++){const n=r[a];r[a]=e[i-1]===t[a-1]?o:1+Math.min(o,r[a],r[a-1]),o=n}}return r[n]}function zs(e,t){if(0===t.length)return null;const o=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(o)||o.includes(e.toLowerCase()))||(function(e,t,o=3){let n,r=o+1;for(const o of t){const t=Es(e.toLowerCase(),o.toLowerCase());r>t&&(r=t,n=o)}return r>o?void 0:n}(e,t,3)??null)}function Ns({componentName:e,data:t,accessors:o,requiredProps:n}){if(n)for(const[t,o]of Object.entries(n))if(null==o)return`${e}: ${t} is required. Provide a field name or function.`;if(null==t)return null;if(!Array.isArray(t)&&"object"==typeof t)return e+": data should be an array, but received an object. If this is hierarchical data, use TreeDiagram, Treemap, or CirclePack instead.";if(!Array.isArray(t)||0===t.length)return e+": No data provided. Pass a non-empty array to the data prop.";if(o){const n=function(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}(t).find(e=>e&&"object"==typeof e);if(n){const t=Object.keys(n);for(const[r,i]of Object.entries(o))if(i&&"string"==typeof i&&!(i in n)){const o=zs(i,t),n=o?` Try ${r}="${o}".`:"";return`${e}: ${r} "${i}" not found in data. Available fields: ${t.join(", ")}.${n}`}}}return null}import{useCallback as Ws,useMemo as Gs,useState as qs}from"react";import{useMemo as Vs}from"react";function Xs(e){const{data:t,rawData:o,colorBy:n,colorScheme:r,legendInteraction:i,legendPosition:a,selection:s,linkedHover:l,fallbackFields:u,unwrapData:d=!1,onObservation:h,chartType:f,chartId:m,showLegend:g,userMargin:p,marginDefaults:y,onClick:b,hoverHighlight:v,mobileInteraction:x,mobileSemantics:w,loading:k,loadingContent:S,emptyContent:A,width:M,height:_}=e,C=void 0===o,P=Gs(()=>c(t),[t]),[L,R]=qs([]),I=Ws(e=>{R(t=>t.length===e.length&&t.every((t,o)=>t===e[o])?t:e)},[]),T="string"==typeof e.colorBy?e.colorBy:void 0,$=Gs(()=>ps(x,{width:M,mobileSemantics:w}),[x,M,w]),{activeSelectionHook:B,hoverSelectionHook:H,customHoverBehavior:O,customClickBehavior:j,crosshairSourceId:D}=function({selection:e,linkedHover:t,fallbackFields:o=[],unwrapData:n=!1,onObservation:r,chartType:i,chartId:a,onClick:s,hoverHighlight:l,colorByField:c,mobileInteraction:u}){const d=ga(),h=function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField,seriesField:e.seriesField}:null}(t,o),f="series"===h?.mode?[h.seriesField||c||o[0]].filter(e=>!!e):h?.fields||o||[],m=Ka({name:e?.name||"__unused__",fields:f}),g=function(e){const t=e.name||"hover",{fields:o}=e,{predicate:n,isActive:r,selectPoints:i,clear:a}=Ka({name:t,fields:o});return{onHover:Na(e=>{if(!e)return void a();const t={};for(const n of o){const o=e[n];void 0!==o&&(t[n]=[o])}Qa(t)&&i(t)},[o,i,a,t]),predicate:n,isActive:r}}({name:h?.name||"hover",fields:f}),p=Fa(e=>e.pushObservation),y=e?{isActive:m.isActive,predicate:m.predicate}:null,[b,v]=ma(null),x=ya(!1),w=c||o[0],k=ha(()=>{if(!l||null==b||!w)return null;const e=b,t=w;return{isActive:!0,predicate:o=>("string"==typeof o[t]?o[t]:(o[t]??"")+"")===e}},[l,b,w]),S=fa(e=>{const o=!e&&x.current&&!!u?.enabled&&u.tapToLockTooltip;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===h?.mode&&h.xField){const o=hs(e,t,h.xField);null!=o&&function(e,t,o){const n=Ga.positions.get(e);n?.locked||n&&n.xValue===t&&n.sourceId===o||(Ga={positions:new Map(Ga.positions).set(e,{xValue:t,sourceId:o})},Va())}(h.name||"hover",o,d)}"x-position"!==h?.mode&&g.onHover(t)}else"x-position"!==h?.mode||o||Xa(h.name||"hover",d),"x-position"===h?.mode||o||g.onHover(null);if(l&&w)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const o=t?.[w];v(null!=o?o+"":null)}else o||v(null);if(r||p){const t={timestamp:Date.now(),chartType:i||"unknown",chartId:a};if(e){const o=fs(e),n={...t,type:"hover",datum:o||{},x:e.x??0,y:e.y??0};r&&r(n),p&&p(n)}else{const e={...t,type:"hover-end"};r&&r(e),p&&p(e)}}},[t,g,h,d,r,i,a,p,l,w,u]),A=fa((o=!0)=>{x.current=!1,t&&"x-position"!==h?.mode&&g.onHover(null),e&&u?.tapToSelect&&m.clear(),o&&l&&v(null),"x-position"===h?.mode&&(Ya(h.name||"hover",d),Xa(h.name||"hover",d))},[t,h,g,e,u,m,l,d]),M=fa(o=>{const n=!!u?.enabled&&(u.tapToLockTooltip||u.tapToSelect),c=!!u?.enabled&&"backgroundTap"===u.clearSelection;if("x-position"===h?.mode&&h.xField&&o){let e=o.data||o.datum||o;Array.isArray(e)&&(e=e[0]);const t=hs(o,e,h.xField);null!=t&&function(e,t,o){const n=Ga.positions.get(e);if(n?.locked){const t=new Map(Ga.positions);return t.delete(e),Ga={positions:t},Va(),!1}Ga={positions:new Map(Ga.positions).set(e,{xValue:t,sourceId:o,locked:!0})},Va()}(h.name||"hover",t,d)}if(n)if(o){x.current=!0;const n=fs(o);if(t&&"x-position"!==h?.mode&&g.onHover(n),e&&u?.tapToSelect&&f.length>0){const e={};for(const t of f){const o=n[t];void 0!==o&&(e[t]=[o])}ms(e)&&m.selectPoints(e)}if(l&&w){const e=n?.[w];v(null!=e?e+"":null)}}else c&&A();if(o||c){if(o&&s){let e=o.data||o.datum||o;Array.isArray(e)&&(e=e[0]),s(e,{x:o.x??0,y:o.y??0})}if(r||p){const e={timestamp:Date.now(),chartType:i||"unknown",chartId:a};if(o){const t=fs(o),n={...e,type:"click",datum:t||{},x:o.x??0,y:o.y??0};r&&r(n),p&&p(n)}else{const t={...e,type:"click-end"};r&&r(t),p&&p(t)}}}},[s,r,p,i,a,h,d,u,t,g,e,m,f,l,w,A]);return pa(()=>{if(!u?.enabled||"undefined"==typeof document)return;const e=e=>{"Escape"===e.key&&x.current&&A()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[u?.enabled,A]),pa(()=>()=>{x.current&&A(!1)},[A]),pa(()=>{if("x-position"!==h?.mode)return;const e=h.name||"hover";return()=>{Ya(e,d),Xa(e,d)}},[h?.mode,h?.name,d]),{activeSelectionHook:y,hoverSelectionHook:k,customHoverBehavior:S,customClickBehavior:M,crosshairSourceId:d}}({selection:s,linkedHover:l,fallbackFields:u,unwrapData:d,onObservation:h,chartType:f,chartId:m,onClick:b,hoverHighlight:v,colorByField:T,mobileInteraction:$}),F=function(e,t){const o="object"==typeof e&&null!==e?e:void 0;if("x-position"===o?.mode)return{linkedCrosshairName:o.name||"hover",linkedCrosshairSourceId:t}}(l,D),E=function(e,t,o){const n=Sa(),r=ys();return ha(()=>{if(!t)return;const i=n??void 0,a=o??(r&&r.length>0?r:void 0)??"category10";if(0!==e.length){if("function"==typeof t){const o=Array.from(new Set(e.map(e=>t(e)+"")));if(i&&ms(i)){const e=Y(o.map(e=>({_cat:e})),"_cat",a);return t=>i[t]||e(t)}return Y(o.map(e=>({_cat:e})),"_cat",a)}if(i&&ms(i)){const o=Y(e,t,a);return e=>i[e]||o(e)}return Y(e,t,a)}if(i&&ms(i)){const e=Y([{_:"a"}],"_",a);return t=>i[t]||e(t)}},[e,t,o,n,r])}(P,n,r),z=Gs(()=>{if(!n)return[];const e=new Set;for(const t of P){const o="function"==typeof n?n(t):t[n];null!=o&&e.add(o+"")}return Array.from(e)},[P,n]),N=Gs(()=>C&&L.length>0?L:z,[C,L,z]),W=function(e,t,o){const[n,r]=ma(null),[i,a]=ma(new Set),s=ha(()=>new Set,[]),l=fa(t=>{"highlight"===e&&r(t?t.label:null)},[e]),c=fa(t=>{"isolate"===e&&a(e=>{const n=new Set(e);return n.has(t.label)?n.delete(t.label):n.add(t.label),n.size===o.length?new Set:n})},[e,o.length]),u=ha(()=>{if(!e||"none"===e||!t)return null;const o="string"==typeof t?t:null;return"highlight"===e&&null!=n?{isActive:!0,predicate:e=>(o?e[o]:"function"==typeof t?t(e):null)===n}:"isolate"===e&&i.size>0?{isActive:!0,predicate:e=>{const n=o?e[o]:"function"==typeof t?t(e):null;return i.has(n)}}:null},[e,t,n,i]);return{highlightedCategory:"highlight"===e?n:null,isolatedCategories:"isolate"===e?i:s,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}(i,n,N),q=Gs(()=>H||(W.legendSelectionHook?W.legendSelectionHook:B),[H,W.legendSelectionHook,B]),X=function(e){const t=Zr(e=>e.theme.colors.selectionOpacity);return Vs(()=>{if(void 0!==e||void 0!==t)return{name:e?.name??"",...e,unselectedOpacity:e?.unselectedOpacity??t}},[e,t])}(s),K=ys(),Z=Sa(),Q=Gs(()=>{if(E)return E;if(!n||0===N.length)return;const e=Array.isArray(r)&&r.length>0||"string"==typeof r&&r.length>0?r:K&&K.length>0?K:G,t="__streamCat",o=Y(N.map(e=>({[t]:e})),t,e);return e=>Z?.[e]||o(e)||"#999"},[E,n,N,r,K,Z]),{legend:U,margin:J,legendPosition:ee}=function({data:e,colorBy:t,colorScale:o,showLegend:n,legendPosition:r="right",userMargin:i,defaults:a={top:50,bottom:60,left:70,right:40},categories:s}){const l=Ma(es),c=null!==Ma(ts),u=void 0!==n?n:!l&&!!t,d=!!t&&(u||c),h=ha(()=>{if(!d)return[];if(void 0!==s)return s;const o=new Set;for(const n of e){const e="function"==typeof t?t(n):n[t];null!=e&&o.add(e+"")}return Array.from(o)},[s,t,e,d]);ns(c&&t?h:[]);const f=ha(()=>{if(!u||!t)return;const n=rs({data:e,colorBy:t,colorScale:o,getColor:V,categories:h});return 0!==n.legendGroups.reduce((e,t)=>e+t.items.length,0)?n:void 0},[u,t,e,o,h]),m=ha(()=>{const e="number"==typeof i?{top:i,bottom:i,left:i,right:i}:i??{},t=t=>{const o=e[t];return"number"==typeof o?o:a[t]},o={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},n=t=>"number"==typeof e[t];return f&&("right"===r&&!n("right")&&110>o.right?o.right=110:"left"===r&&!n("left")&&110>o.left?o.left=110:"top"===r&&!n("top")&&50>o.top?o.top=50:"bottom"===r&&!n("bottom")&&80>o.bottom&&(o.bottom=80)),o},[a,i,f,r]);return{legend:f,margin:m,legendPosition:r}}({data:P,colorBy:n,colorScale:Q,showLegend:g,legendPosition:a,userMargin:p,defaults:y,categories:N}),te=Gs(()=>{const e={};return U&&(e.legend=U,e.legendPosition=ee),i&&"none"!==i&&(e.legendHoverBehavior=W.onLegendHover,e.legendClickBehavior=W.onLegendClick,e.legendHighlightedCategory=W.highlightedCategory,e.legendIsolatedCategories=W.isolatedCategories),C&&n&&(e.legendCategoryAccessor=n,e.onCategoriesChange=I),e},[U,ee,i,W.onLegendHover,W.onLegendClick,W.highlightedCategory,W.isolatedCategories,C,n,I]),oe=Array.isArray(o)?c(o):o,ne=function(e,t,o,n){if(!e)return null;if(!1===n)return null;if(null!=n)return Bs("div",{style:{width:t,height:o,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:n});const r=Math.min(5,Math.floor(o/40)),i=Math.max(8,Math.floor(o/(3*r))),a=Math.max(6,Math.floor(o/(2.5*r))),s=Math.floor((o-(r*(i+a)-a))/2);return Bs("div",{style:{width:t,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:r},(e,o)=>Bs("div",{className:"semiotic-loading-bar",style:{...Ds,position:"absolute",top:s+o*(i+a),left:Math.floor(.1*t),width:30+(37*o+13)%50+"%",height:i,opacity:.5+o%2*.2}},o))})}(k,M,_,S),re=ne?null:function(e,t,o,n){return!1===n||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?Bs("div",{style:{...js,width:t,height:o},children:n||"No data available"}):null}(oe,M,_,A);return{data:P,colorScale:E,allCategories:N,legendState:W,effectiveSelectionHook:q,activeSelectionHook:B,customHoverBehavior:O,customClickBehavior:j,mobileInteraction:$,legend:U,margin:J,legendPosition:ee,earlyReturn:ne||re||null,legendBehaviorProps:te,crosshairProps:F,resolvedSelection:X}}import{useImperativeHandle as Ys}from"react";function Ks({ref:e,frameRef:t,setup:o}){return Ys(e,()=>({push:e=>t.current?.push(e),pushMany:e=>t.current?.pushMany(e),remove:e=>t.current?.remove(e)??[],update:(e,o)=>t.current?.update(e,o)??[],clear:()=>t.current?.clear(),getData:()=>t.current?.getData()??[],getScales:()=>t.current?.getScales()??null}),[t]),{effectiveLegendProps:o.legendBehaviorProps,effectiveMargin:o.margin}}import{useMemo as Zs}from"react";function Qs(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return e??(()=>({}));const o={};return void 0!==t.stroke&&(o.stroke=t.stroke),void 0!==t.strokeWidth&&(o.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(o.opacity=t.opacity),e?(...t)=>({...e(...t)||{},...o}):(...e)=>({...o})}function Us(e){const{colorBy:t,colorScale:o,color:n,themeCategorical:r,colorScheme:i,categoryIndexMap:a,userPieceStyle:s,stroke:l,strokeWidth:c,opacity:u,effectiveSelectionHook:d,resolvedSelection:h,cycleByCategory:f=!1,baseStyleExtras:m,linkStrokeToFill:g=!1}=e,p=Zs(()=>(e,s)=>{const l="function"==typeof m?m(e,s):m,c=l?{...l}:{};if(void 0===c.fill)if(t){if(!o)return c;c.fill=V(e,t,o)}else c.fill=function(e,t,o,n,r){if(e)return e;if(o&&"object"==typeof o&&!Array.isArray(o)){const e=X(o,n);if(e)return e}let i;if(Array.isArray(o))i=o;else if(t&&t.length>0)i=t;else if("string"==typeof o){const e=N[o];Array.isArray(e)&&(i=e)}return i&&0!==i.length?null!=n?(r.has(n)||r.set(n,r.size),i[r.get(n)%i.length]):i[0]:"#007bff"}(n,r,i,f?s:void 0,a);return g&&void 0===c.stroke&&void 0!==c.fill&&(c.stroke=c.fill),c},[t,o,n,r,i,a,f,m,g]),y=Zs(()=>Qs(s?"function"==typeof s?(e,t)=>({...p(e,t),...s(e,t)||{}}):(e,t)=>({...p(e,t),...s}):p,{stroke:l,strokeWidth:c,opacity:u}),[p,s,l,c,u]);return Zs(()=>{return e=y,o=h,(t=d??null)?(n,...r)=>{const i={...e(n,...r)};if(t.isActive)if(t.predicate(n))o?.selectedStyle&&Object.assign(i,o.selectedStyle);else{const e=o?.unselectedOpacity??.5;i.opacity=e,i.fillOpacity=e,i.strokeOpacity=e,o?.unselectedStyle&&Object.assign(i,o.unselectedStyle)}return i}:e;var e,t,o},[y,d,h])}function Js(e){if(!e)return;const t="boolean"==typeof e?{}:"string"==typeof e?{method:e}:e;return{type:"trend",method:t.method??"linear",...null!=t.bandwidth&&{bandwidth:t.bandwidth},...null!=t.order&&{order:t.order},...null!=t.color&&{color:t.color},...null!=t.strokeWidth&&{strokeWidth:t.strokeWidth},...null!=t.strokeDasharray&&{strokeDasharray:t.strokeDasharray},...null!=t.label&&{label:t.label}}}import{jsx as el}from"react/jsx-runtime";var tl=ua(function(e,t){const o=xs(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=da(null),{data:r,margin:i,className:a,categoryAccessor:s="category",valueAccessor:l="value",orientation:u="vertical",valueFormat:d,colorBy:h,colorScheme:f,sort:m=!1,barPadding:g=40,roundedTop:p,gradientFill:y=!1,baselinePadding:b=!1,tooltip:v,annotations:x,regression:w,valueExtent:k,frameProps:S={},selection:A,linkedHover:M,onObservation:_,onClick:C,hoverHighlight:P,chartId:L,loading:R,loadingContent:I,emptyContent:T,legendInteraction:$,legendPosition:B,color:H,stroke:O,strokeWidth:j,opacity:D,showCategoryTicks:F,categoryFormat:E,dataIdAccessor:z}=e,{width:N,height:W,enableHover:G,showGrid:q,showLegend:V,title:X,description:Y,summary:K,accessibleTable:Z,categoryLabel:Q,valueLabel:U}=o,J=ca(()=>c(r),[r]),ee=Xs({data:J,rawData:r,colorBy:h,colorScheme:f,legendInteraction:$,legendPosition:B,selection:A,linkedHover:M,fallbackFields:h?["string"==typeof h?h:""]:[],unwrapData:!0,onObservation:_,onClick:C,hoverHighlight:P,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"BarChart",chartId:L,showLegend:V,userMargin:i,marginDefaults:o.marginDefaults,loading:R,loadingContent:I,emptyContent:T,width:N,height:W}),{effectiveLegendProps:te,effectiveMargin:oe}=Ks({ref:t,frameRef:n,setup:ee});Fs("BarChart",J,"categoryAccessor",s),Fs("BarChart",J,"valueAccessor",l);const ne=bs(J,m,l),re=ys(),ie=ca(()=>new Map,[J]),ae=Us({colorBy:h,colorScale:ee.colorScale,color:H,themeCategorical:re,colorScheme:f,categoryIndexMap:ie,userPieceStyle:S?.pieceStyle,stroke:O,strokeWidth:j,opacity:D,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection}),se=ca(()=>Cs({categoryAccessor:s,valueAccessor:l,groupAccessor:h&&h!==s?h:void 0,groupLabel:"string"==typeof h?h:"group",valueFormat:d}),[s,l,h,d]);if(ee.earlyReturn)return ee.earlyReturn;const le=Ns({componentName:"BarChart",data:r,accessors:{categoryAccessor:s,valueAccessor:l}});if(le)return el(Rs,{componentName:"BarChart",message:le,width:N,height:W});const ce=Js(w),ue=ce?[ce,...x||[]]:x,de={chartType:"bar",...null!=r&&{data:ne},oAccessor:s,rAccessor:l,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:ae,size:[N,W],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:oe,barPadding:g,...null!=p&&{roundedTop:p},...y&&{gradientFill:!0===y?{topOpacity:.8,bottomOpacity:.05}:y},...z&&{dataIdAccessor:z},baselinePadding:b,enableHover:G,showAxes:o.showAxes,oLabel:Q,rLabel:U,rFormat:d,...E&&{oFormat:E},showGrid:q,showCategoryTicks:F,oSort:m,...te,...aa({title:X,description:Y,summary:K,accessibleTable:Z,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...la({tooltip:v,defaultTooltipContent:se}),...sa({linkedHover:M,selection:A,onObservation:_,onClick:C,hoverHighlight:P,mobileInteraction:ee.mobileInteraction,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior}),...ue&&ue.length>0&&{annotations:ue},...k&&{rExtent:k},...Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e))};return el(Os,{componentName:"BarChart",width:N,height:W,children:el(ia,{ref:n,...de})})});tl.displayName="BarChart";import{useMemo as ol,forwardRef as nl,useRef as rl}from"react";import{jsx as il}from"react/jsx-runtime";var al=nl(function(e,t){const o=xs(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=rl(null),{data:r,margin:i,className:a,categoryAccessor:s="category",stackBy:l,valueAccessor:u="value",orientation:d="vertical",valueFormat:h,colorBy:f,colorScheme:m,normalize:g=!1,sort:p=!1,barPadding:y=40,roundedTop:b,baselinePadding:v=!1,tooltip:x,annotations:w,valueExtent:k,frameProps:S={},selection:A,linkedHover:M,onObservation:_,onClick:C,hoverHighlight:P,chartId:L,loading:R,loadingContent:I,emptyContent:T,legendInteraction:$,legendPosition:B,color:H,stroke:O,strokeWidth:j,opacity:D,categoryFormat:F}=e,{width:E,height:z,enableHover:N,showGrid:W,showLegend:G,title:q,description:V,summary:X,accessibleTable:Y,categoryLabel:K,valueLabel:Z}=o,Q=ol(()=>c(r),[r]),U=f||l,J=Xs({data:Q,rawData:r,colorBy:U,colorScheme:m,legendInteraction:$,legendPosition:B,selection:A,linkedHover:M,fallbackFields:U?["string"==typeof U?U:""]:[],unwrapData:!0,onObservation:_,onClick:C,hoverHighlight:P,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"StackedBarChart",chartId:L,showLegend:G,userMargin:i,marginDefaults:o.marginDefaults,loading:R,loadingContent:I,emptyContent:T,width:E,height:z}),ee=ys(),te=ol(()=>new Map,[Q]),oe=Us({colorBy:U,colorScale:J.colorScale,color:H,themeCategorical:ee,colorScheme:m,categoryIndexMap:te,userPieceStyle:S?.pieceStyle,stroke:O,strokeWidth:j,opacity:D,effectiveSelectionHook:J.effectiveSelectionHook,resolvedSelection:J.resolvedSelection}),ne=ol(()=>Cs({categoryAccessor:l,valueAccessor:u,groupAccessor:s,valueFormat:h}),[l,s,u,h]),re=Ns({componentName:"StackedBarChart",data:r,accessors:{categoryAccessor:s,valueAccessor:u},requiredProps:{stackBy:l}}),{effectiveLegendProps:ie,effectiveMargin:ae}=Ks({ref:t,frameRef:n,setup:J});if(J.earlyReturn)return J.earlyReturn;const se={chartType:"bar",...null!=r&&{data:Q},oAccessor:s,rAccessor:u,stackBy:l,normalize:g,oSort:p,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:oe,size:[E,z],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ae,barPadding:y,...null!=b&&{roundedTop:b},baselinePadding:v,enableHover:N,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:K,rLabel:Z,rFormat:h,...F&&{oFormat:F},showGrid:W,...ie,...aa({title:q,description:V,summary:X,accessibleTable:Y,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...la({tooltip:x,defaultTooltipContent:ne}),...sa({linkedHover:M,selection:A,onObservation:_,onClick:C,hoverHighlight:P,mobileInteraction:J.mobileInteraction,customHoverBehavior:J.customHoverBehavior,customClickBehavior:J.customClickBehavior}),...w&&w.length>0&&{annotations:w},...k&&{rExtent:k},...Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e))};return re?il(Rs,{componentName:"StackedBarChart",message:re,width:E,height:z}):il(Os,{componentName:"StackedBarChart",width:E,height:z,children:il(ia,{ref:n,...se})})});al.displayName="StackedBarChart";import{useMemo as sl,forwardRef as ll,useRef as cl}from"react";import{jsx as ul}from"react/jsx-runtime";var dl=ll(function(e,t){const o=xs(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=cl(null),{data:r,margin:i,className:a,categoryAccessor:s="category",groupBy:l,valueAccessor:u="value",orientation:d="vertical",valueFormat:h,colorBy:f,colorScheme:m,sort:g=!1,barPadding:p=60,roundedTop:y,baselinePadding:b=!1,tooltip:v,annotations:x,valueExtent:w,frameProps:k={},selection:S,linkedHover:A,onObservation:M,onClick:_,hoverHighlight:C,chartId:P,loading:L,loadingContent:R,emptyContent:I,legendInteraction:T,legendPosition:$,color:B,stroke:H,strokeWidth:O,opacity:j,categoryFormat:D}=e,{width:F,height:E,enableHover:z,showGrid:N,showLegend:W,title:G,description:q,summary:V,accessibleTable:X,categoryLabel:Y,valueLabel:K}=o,Z=sl(()=>c(r),[r]),Q=f||l,U=Xs({data:Z,rawData:r,colorBy:Q,colorScheme:m,legendInteraction:T,legendPosition:$,selection:S,linkedHover:A,fallbackFields:Q?["string"==typeof Q?Q:""]:[],unwrapData:!0,onObservation:M,onClick:_,hoverHighlight:C,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"GroupedBarChart",chartId:P,showLegend:W,userMargin:i,marginDefaults:o.marginDefaults,loading:L,loadingContent:R,emptyContent:I,width:F,height:E}),J=ys(),ee=sl(()=>new Map,[Z]),te=Us({colorBy:Q,colorScale:U.colorScale,color:B,themeCategorical:J,colorScheme:m,categoryIndexMap:ee,userPieceStyle:k.pieceStyle,stroke:H,strokeWidth:O,opacity:j,effectiveSelectionHook:U.effectiveSelectionHook,resolvedSelection:U.resolvedSelection}),oe=sl(()=>Cs({categoryAccessor:l,valueAccessor:u,groupAccessor:s,valueFormat:h}),[l,s,u,h]),ne=Ns({componentName:"GroupedBarChart",data:r,accessors:{categoryAccessor:s,valueAccessor:u},requiredProps:{groupBy:l}}),{effectiveLegendProps:re,effectiveMargin:ie}=Ks({ref:t,frameRef:n,setup:U});if(U.earlyReturn)return U.earlyReturn;const ae={chartType:"clusterbar",...null!=r&&{data:Z},oAccessor:s,rAccessor:u,groupBy:l,oSort:g,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:te,size:[F,E],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ie,barPadding:p,...null!=y&&{roundedTop:y},baselinePadding:b,enableHover:z,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:Y,rLabel:K,rFormat:h,...D&&{oFormat:D},showGrid:N,...re,...aa({title:G,description:q,summary:V,accessibleTable:X,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...la({tooltip:v,defaultTooltipContent:oe}),...sa({linkedHover:A,selection:S,onObservation:M,onClick:_,hoverHighlight:C,mobileInteraction:U.mobileInteraction,customHoverBehavior:U.customHoverBehavior,customClickBehavior:U.customClickBehavior}),...x&&x.length>0&&{annotations:x},...w&&{rExtent:w},...Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e))};return ne?ul(Rs,{componentName:"GroupedBarChart",message:ne,width:F,height:E}):ul(Os,{componentName:"GroupedBarChart",width:F,height:E,children:ul(ia,{ref:n,...ae})})});dl.displayName="GroupedBarChart";import{useMemo as hl,forwardRef as fl,useRef as ml}from"react";import{useCallback as gl,useRef as pl}from"react";function yl({brushProp:e,onBrushProp:t,linkedBrush:o,valueAccessor:n}){const r=(i="string"==typeof o?o:o?{name:o.name,xField:o.rField}:void 0)?"string"==typeof i?{name:i}:i:null;var i;const a="string"==typeof n?n:"value",s=function(e){const{name:t,xField:o,yField:n}=e,{predicate:r,isActive:i,selectInterval:a,clear:s}=Ka({name:t,fields:[o,n].filter(Boolean)}),l=o&&n?"xyBrush":o?"xBrush":"yBrush",c=Na(e=>{if(!e)return void s();const t={};"xyBrush"===l&&function(e){return 2===e.length&&Array.isArray(e[0])&&2===e[0].length&&Array.isArray(e[1])&&2===e[1].length}(e)?(o&&(t[o]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),n&&(t[n]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===l&&Za(e)?o&&(t[o]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]):"yBrush"===l&&Za(e)&&n&&(t[n]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]),Qa(t)&&a(t)},[l,o,n,a,s]);return{brushInteraction:za(()=>({brush:l,during:c,end:c}),[l,c]),predicate:r,isActive:i,clear:s}}({name:r?.name||"__unused_ordinal_brush__",xField:r?.xField||a}),l=pl(s.brushInteraction);l.current=s.brushInteraction;const c=gl(e=>{if(r){l.current.end(e?e.r:null)}t?.(e)},[t,r]),u=!!(e||o||t);return{hasBrush:u,handleBrush:c,brushStreamProps:u?{brush:{dimension:"r"},onBrush:c}:{}}}import{jsx as bl}from"react/jsx-runtime";var vl=fl(function(e,t){const o=xs(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=ml(null),{data:r,margin:i,className:a,categoryAccessor:s="category",subcategoryAccessor:l,valueAccessor:u="value",orientation:d="horizontal",valueFormat:h,colorBy:f,colorScheme:m,barPadding:g,tooltip:p,annotations:y,brush:b,onBrush:v,linkedBrush:x,frameProps:w={},selection:k,linkedHover:S,onObservation:A,onClick:M,hoverHighlight:_,chartId:C,loading:P,loadingContent:L,emptyContent:R,legendInteraction:I,legendPosition:T,color:$,stroke:B,strokeWidth:H,opacity:O,categoryFormat:j,rTickValues:D,tickLabelEdgeAlign:F,showCategoryTicks:E,gradientFill:z,trackFill:N,roundedTop:W,valueExtent:G}=e,{width:q,height:V,enableHover:X,showGrid:Y,showLegend:K,title:Z,description:Q,summary:U,accessibleTable:J,categoryLabel:ee,valueLabel:te}=o,oe=hl(()=>c(r),[r]),ne=f||l,re=hl(()=>{if(null!=g)return g;if("sparkline"!==e.mode)return 40;const t=new Set(oe.map(e=>"function"==typeof s?s(e):e[s])),o=Math.max(1,t.size);return o>1?Math.max(0,Math.min(1,(("horizontal"===d?V:q)-2*o)/(o-1))):1},[g,e.mode,oe,s,d,q,V]),ie=Xs({data:oe,rawData:r,colorBy:ne,colorScheme:m,legendInteraction:I,legendPosition:T,selection:k,linkedHover:S,fallbackFields:ne?["string"==typeof ne?ne:""]:[],unwrapData:!0,onObservation:A,onClick:M,hoverHighlight:_,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"SwimlaneChart",chartId:C,showLegend:K,userMargin:i,marginDefaults:o.marginDefaults,loading:P,loadingContent:L,emptyContent:R,width:q,height:V}),ae=yl({brushProp:b,onBrushProp:v,linkedBrush:x,valueAccessor:u}),se=ys(),le=hl(()=>new Map,[oe]),ce=Us({colorBy:ne,colorScale:ie.colorScale,color:$,themeCategorical:se,colorScheme:m,categoryIndexMap:le,userPieceStyle:w?.pieceStyle,stroke:B,strokeWidth:H,opacity:O,effectiveSelectionHook:ie.effectiveSelectionHook,resolvedSelection:ie.resolvedSelection,cycleByCategory:!0}),ue=hl(()=>Cs({categoryAccessor:l,valueAccessor:u,groupAccessor:s,valueFormat:h}),[l,s,u,h]),de=Ns({componentName:"SwimlaneChart",data:r,accessors:{categoryAccessor:s,valueAccessor:u,subcategoryAccessor:l},requiredProps:{subcategoryAccessor:l}}),{effectiveLegendProps:he,effectiveMargin:fe}=Ks({ref:t,frameRef:n,setup:ie});if(ie.earlyReturn)return ie.earlyReturn;const me={chartType:"swimlane",...null!=r&&{data:oe},oAccessor:s,rAccessor:u,stackBy:l,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:ce,size:[q,V],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:fe,barPadding:re,enableHover:X,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:!1===E?void 0:ee,rLabel:te,rFormat:h,...D&&{rTickValues:D},...null!=F&&{tickLabelEdgeAlign:F},...j&&{oFormat:j},...void 0!==E&&{showCategoryTicks:E},showGrid:Y,...he,...aa({title:Z,description:Q,summary:U,accessibleTable:J,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...la({tooltip:p,defaultTooltipContent:ue}),...sa({linkedHover:S,selection:k,onObservation:A,onClick:M,hoverHighlight:_,mobileInteraction:ie.mobileInteraction,customHoverBehavior:ie.customHoverBehavior,customClickBehavior:ie.customClickBehavior}),...y&&y.length>0&&{annotations:y},...z&&{gradientFill:!0===z?{topOpacity:.8,bottomOpacity:.05}:z},...null!=N&&{trackFill:N},...null!=W&&{roundedTop:W},...G&&{rExtent:G},...ae.brushStreamProps,...Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e))};return de?bl(Rs,{componentName:"SwimlaneChart",message:de,width:q,height:V}):bl(Os,{componentName:"SwimlaneChart",width:q,height:V,children:bl(ia,{ref:n,...me})})});vl.displayName="SwimlaneChart";import{useMemo as xl,forwardRef as wl,useRef as kl}from"react";import{useImperativeHandle as Sl}from"react";function Al(e,t){const{variant:o,frameRef:n,overrides:r,deps:i}=t;Sl(e,()=>{const e=function(e,t){if("xy"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>e.current?.remove(t)??[],update:(t,o)=>e.current?.update(t,o)??[],clear:()=>e.current?.clear(),getData:()=>e.current?.getData()??[],getScales:()=>e.current?.getScales()??null,getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}if("network"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>{const o=Array.isArray(t)?t:[t],n=e.current?.getTopology()?.nodes??[],r=[];for(const t of o){const o=n.find(e=>e.id===t);o&&r.push({...o.data??{},id:t}),e.current?.removeNode(t)}return r},update:(t,o)=>(Array.isArray(t)?t:[t]).flatMap(t=>{const n=e.current?.updateNode(t,o);return n?[{...n,id:t}]:[]}),clear:()=>e.current?.clear(),getData:()=>e.current?.getTopology()?.nodes?.map(e=>e.data)??[],getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}if("geo-points"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>e.current?.removePoint(t)??[],update:(t,o)=>{const n=e.current?.removePoint(t)??[];for(const t of n)e.current?.push(o(t));return n},clear:()=>e.current?.clear(),getData:()=>e.current?.getData()??[],getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}const o=t;return{push:e=>o.current?.pushLine(e),pushMany:e=>o.current?.pushManyLines(e),remove:e=>o.current?.removeLine(e)??[],update:(e,t)=>{const n=o.current?.removeLine(e)??[];for(const e of n)o.current?.pushLine(t(e));return n},clear:()=>o.current?.clear(),getData:()=>o.current?.getLines()??[],getCustomLayout:()=>o.current?.getCustomLayout?.()??null,getLayoutFailure:()=>o.current?.getLayoutFailure?.()??null}}(o,n);return{...e,...r}},i??[])}import{jsx as Ml}from"react/jsx-runtime";var _l=wl(function(e,t){const o=xs(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=kl(null);Al(t,{variant:"xy",frameRef:n});const{data:r,margin:i,className:a,categoryAccessor:s="category",valueAccessor:l="value",orientation:u="vertical",valueFormat:d,colorBy:h,colorScheme:f,sizeBy:m,sizeRange:g=[3,8],symbolBy:p,symbolMap:y,pointRadius:b=4,pointOpacity:v=.7,categoryPadding:x=20,tooltip:w,annotations:k,valueExtent:S,brush:A,onBrush:M,linkedBrush:_,frameProps:C={},selection:P,linkedHover:L,onObservation:R,onClick:I,hoverHighlight:T,chartId:$,loading:B,loadingContent:H,emptyContent:O,legendInteraction:j,legendPosition:D,color:F,stroke:E,strokeWidth:z,opacity:N,showCategoryTicks:W,categoryFormat:G}=e,{width:q,height:V,enableHover:X,showGrid:Y,showLegend:Z,title:Q,description:U,summary:J,accessibleTable:ee,categoryLabel:te,valueLabel:oe}=o,ne=xl(()=>c(r),[r]),re=Xs({data:ne,rawData:r,colorBy:h,colorScheme:f,legendInteraction:j,legendPosition:D,selection:P,linkedHover:L,fallbackFields:h?["string"==typeof h?h:""]:["string"==typeof s?s:""],unwrapData:!0,onObservation:R,onClick:I,hoverHighlight:T,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"SwarmPlot",chartId:$,showLegend:Z,userMargin:i,marginDefaults:o.marginDefaults,loading:B,loadingContent:H,emptyContent:O,width:q,height:V}),ie=yl({brushProp:A,onBrushProp:M,linkedBrush:_,valueAccessor:l}),ae=xl(()=>{if(m)return fe(ne.map(e=>"function"==typeof m?m(e):e[m]))},[ne,m]),se=ys(),le=xl(()=>new Map,[ne]),ce=Us({colorBy:h,colorScale:re.colorScale,color:F,themeCategorical:se,colorScheme:f,categoryIndexMap:le,userPieceStyle:C?.pieceStyle,stroke:E,strokeWidth:z,opacity:N,effectiveSelectionHook:re.effectiveSelectionHook,resolvedSelection:re.resolvedSelection,baseStyleExtras:e=>({fillOpacity:v,r:m?K(e,m,g,ae):b})}),ue=xl(()=>Cs({categoryAccessor:s,valueAccessor:l,groupAccessor:h||void 0,valueFormat:d}),[s,l,h,d]);if(re.earlyReturn)return re.earlyReturn;const de=Ns({componentName:"SwarmPlot",data:r,accessors:{categoryAccessor:s,valueAccessor:l}});if(de)return Ml(Rs,{componentName:"SwarmPlot",message:de,width:q,height:V});const he={chartType:"swarm",...null!=r&&{data:ne},oAccessor:s,rAccessor:l,...p&&{symbolAccessor:p},...y&&{symbolMap:y},projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:ce,size:[q,V],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:re.margin,barPadding:x,enableHover:X,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:te,rLabel:oe,rFormat:d,...G&&{oFormat:G},showGrid:Y,showCategoryTicks:W,...re.legendBehaviorProps,...aa({title:Q,description:U,summary:J,accessibleTable:ee,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...la({tooltip:w,defaultTooltipContent:ue}),...sa({linkedHover:L,selection:P,onObservation:R,onClick:I,hoverHighlight:T,mobileInteraction:re.mobileInteraction,customHoverBehavior:re.customHoverBehavior,customClickBehavior:re.customClickBehavior}),...k&&k.length>0&&{annotations:k},...S&&{rExtent:S},...ie.brushStreamProps,...Object.fromEntries(Object.entries(C).filter(([e])=>"pieceStyle"!==e))};return Ml(Os,{componentName:"SwarmPlot",width:q,height:V,children:Ml(ia,{ref:n,...he})})});_l.displayName="SwarmPlot";import{useMemo as Cl,forwardRef as Pl,useRef as Ll}from"react";import{jsx as Rl,jsxs as Il}from"react/jsx-runtime";function Tl(e){return t=>{const o=t.category||t.data&&t.data[0]?.category||"",n=t.stats||(t.data||t).stats;if(n&&null!=n.median)return Il("div",{className:"semiotic-tooltip",style:xr,children:[o&&Rl("div",{style:{fontWeight:"bold"},children:o+""}),null!=n.n&&Il("div",{children:["n = ",n.n]}),null!=n.min&&Il("div",{children:["Min: ",n.min.toLocaleString()]}),null!=n.q1&&Il("div",{children:["Q1: ",n.q1.toLocaleString()]}),Il("div",{children:["Median: ",n.median.toLocaleString()]}),null!=n.q3&&Il("div",{children:["Q3: ",n.q3.toLocaleString()]}),null!=n.max&&Il("div",{children:["Max: ",n.max.toLocaleString()]}),null!=n.mean&&Il("div",{style:{opacity:.8},children:["Mean: ",n.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});if(e?.valueAccessor){const n=e.valueAccessor,r=(Array.isArray(t.data)?t.data:[]).map(e=>Number("function"==typeof n?n(e):e[n])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),i=r.length,a=i>0?i%2!=0?r[Math.floor(i/2)]:(r[i/2-1]+r[i/2])/2:null;return Il("div",{className:"semiotic-tooltip",style:xr,children:[o&&Rl("div",{style:{fontWeight:"bold"},children:o+""}),i>0&&Il("div",{children:["n = ",i]}),null!=a&&Il("div",{children:["Median: ",a.toLocaleString()]})]})}return Rl("div",{className:"semiotic-tooltip",style:xr,children:Rl("div",{style:{fontWeight:"bold"},children:o+""})})}}import{jsx as $l}from"react/jsx-runtime";var Bl=Pl(function(e,t){const o=xs(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=Ll(null);Al(t,{variant:"xy",frameRef:n});const{data:r,margin:i,className:a,categoryAccessor:s="category",valueAccessor:l="value",orientation:u="vertical",valueFormat:d,colorBy:h,colorScheme:f,showOutliers:m=!0,outlierRadius:g=3,categoryPadding:p=20,tooltip:y,annotations:b,valueExtent:v,frameProps:x={},selection:w,linkedHover:k,onObservation:S,onClick:A,hoverHighlight:M,chartId:_,loading:C,loadingContent:P,emptyContent:L,legendInteraction:R,legendPosition:I,color:T,stroke:$,strokeWidth:B,opacity:H,showCategoryTicks:O,categoryFormat:j}=e,{width:D,height:F,enableHover:E,showGrid:z,showLegend:N,title:W,description:G,summary:q,accessibleTable:V,categoryLabel:X,valueLabel:Y}=o,K=Cl(()=>c(r),[r]),Z=Xs({data:K,rawData:r,colorBy:h,colorScheme:f,legendInteraction:R,legendPosition:I,selection:w,linkedHover:k,fallbackFields:h?["string"==typeof h?h:""]:["string"==typeof s?s:""],unwrapData:!0,onObservation:S,onClick:A,hoverHighlight:M,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"BoxPlot",chartId:_,showLegend:N,userMargin:i,marginDefaults:o.marginDefaults,loading:C,loadingContent:P,emptyContent:L,width:D,height:F}),Q=ys(),U=Cl(()=>new Map,[K]),J=Us({colorBy:h,colorScale:Z.colorScale,color:T,themeCategorical:Q,colorScheme:f,categoryIndexMap:U,userPieceStyle:void 0,stroke:$,strokeWidth:B,opacity:H,effectiveSelectionHook:Z.effectiveSelectionHook,resolvedSelection:Z.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),ee=Cl(()=>Tl(),[]);if(Z.earlyReturn)return Z.earlyReturn;const te=Ns({componentName:"BoxPlot",data:r,accessors:{categoryAccessor:s,valueAccessor:l}});if(te)return $l(Rs,{componentName:"BoxPlot",message:te,width:D,height:F});const oe={chartType:"boxplot",...null!=r&&{data:K},oAccessor:s,rAccessor:l,projection:"horizontal"===u?"horizontal":"vertical",summaryStyle:J,showOutliers:m,size:[D,F],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Z.margin,barPadding:p,enableHover:E,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:X,rLabel:Y,rFormat:d,...j&&{oFormat:j},showGrid:z,showCategoryTicks:O,...Z.legendBehaviorProps,...aa({title:W,description:G,summary:q,accessibleTable:V,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...la({tooltip:y,defaultTooltipContent:ee}),...sa({linkedHover:k,selection:w,onObservation:S,onClick:A,hoverHighlight:M,mobileInteraction:Z.mobileInteraction,customHoverBehavior:Z.customHoverBehavior,customClickBehavior:Z.customClickBehavior}),...b&&b.length>0&&{annotations:b},...v&&{rExtent:v},...Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e))};return $l(Os,{componentName:"BoxPlot",width:D,height:F,children:$l(ia,{ref:n,...oe})})});Bl.displayName="BoxPlot";import{useMemo as Hl,forwardRef as Ol,useRef as jl}from"react";import{jsx as Dl,jsxs as Fl}from"react/jsx-runtime";var El=e=>{const t=e?.category;return null==t?"All":t+""},zl=Ol(function(e,t){const o=xs(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:"horizontal",mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=jl(null);Al(t,{variant:"xy",frameRef:n});const{data:r,margin:i,className:a,categoryAccessor:s=El,valueAccessor:l="value",bins:u=25,relative:d=!1,valueFormat:h,colorBy:f,colorScheme:m,categoryPadding:g=20,tooltip:p,annotations:y,valueExtent:b,brush:v,onBrush:x,linkedBrush:w,frameProps:k={},selection:S,linkedHover:A,onObservation:M,onClick:_,hoverHighlight:C,chartId:P,loading:L,loadingContent:R,emptyContent:I,legendInteraction:T,legendPosition:$,color:B,stroke:H,strokeWidth:O,opacity:j,showCategoryTicks:D,categoryFormat:F}=e,{width:E,height:z,enableHover:N,showGrid:W,showLegend:G,title:q,description:V,summary:X,accessibleTable:Y,categoryLabel:K,valueLabel:Z}=o,Q=Hl(()=>c(r),[r]),U=Xs({data:Q,rawData:r,colorBy:f,colorScheme:m,legendInteraction:T,legendPosition:$,selection:S,linkedHover:A,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof s?s:""],unwrapData:!0,onObservation:M,onClick:_,hoverHighlight:C,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"Histogram",chartId:P,showLegend:G,userMargin:i,marginDefaults:o.marginDefaults,loading:L,loadingContent:R,emptyContent:I,width:E,height:z}),J=yl({brushProp:v,onBrushProp:x,linkedBrush:w,valueAccessor:l}),ee=Hl(()=>{if(0===Q.length)return;const e="function"==typeof l?l:e=>e[l];let t=1/0,o=-1/0;for(const n of Q){const r=e(n);null!=r&&isFinite(r)&&(t>r&&(t=r),r>o&&(o=r))}return t>o?void 0:[t,o]},[Q,l]),te=ys(),oe=Hl(()=>new Map,[Q]),ne=Us({colorBy:f,colorScale:U.colorScale,color:B,themeCategorical:te,colorScheme:m,categoryIndexMap:oe,userPieceStyle:void 0,stroke:H,strokeWidth:O,opacity:j,effectiveSelectionHook:U.effectiveSelectionHook,resolvedSelection:U.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),re=Hl(()=>e=>{const t=e.data||e,o=t.category||e.category||"",n=t.count,r=t.range;return Fl("div",{className:"semiotic-tooltip",style:xr,children:[o&&Dl("div",{style:{fontWeight:"bold"},children:o+""}),null!=n&&Fl("div",{children:["Count: ",n]}),r&&2===r.length&&Fl("div",{style:{opacity:.8},children:[Number(r[0]).toFixed(1)," – ",Number(r[1]).toFixed(1)]})]})},[]);if(U.earlyReturn)return U.earlyReturn;const ie=Ns({componentName:"Histogram",data:r,accessors:{categoryAccessor:s,valueAccessor:l}});if(ie)return Dl(Rs,{componentName:"Histogram",message:ie,width:E,height:z});const ae={chartType:"histogram",...null!=r&&{data:Q},oAccessor:s,rAccessor:l,projection:"horizontal",summaryStyle:ne,bins:u,normalize:d,...b?{rExtent:b}:ee&&{rExtent:ee},size:[E,z],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:U.margin,barPadding:g,enableHover:N,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:K,rLabel:Z,rFormat:h,...F&&{oFormat:F},showGrid:W,showCategoryTicks:D,...U.legendBehaviorProps,...aa({title:q,description:V,summary:X,accessibleTable:Y,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...la({tooltip:p,defaultTooltipContent:re}),...sa({linkedHover:A,selection:S,onObservation:M,onClick:_,hoverHighlight:C,mobileInteraction:U.mobileInteraction,customHoverBehavior:U.customHoverBehavior,customClickBehavior:U.customClickBehavior}),...y&&y.length>0&&{annotations:y},...J.brushStreamProps,...Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e))};return Dl(Os,{componentName:"Histogram",width:E,height:z,children:Dl(ia,{ref:n,...ae})})});zl.displayName="Histogram";import{useMemo as Nl,forwardRef as Wl,useRef as Gl}from"react";import{jsx as ql}from"react/jsx-runtime";var Vl=Wl(function(e,t){const o=xs(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=Gl(null);Al(t,{variant:"xy",frameRef:n});const{data:r,margin:i,className:a,categoryAccessor:s="category",valueAccessor:l="value",orientation:u="vertical",bins:d=25,curve:h="catmullRom",showIQR:f=!0,valueFormat:m,colorBy:g,colorScheme:p,categoryPadding:y=20,tooltip:b,annotations:v,valueExtent:x,brush:w,onBrush:k,linkedBrush:S,frameProps:A={},selection:M,linkedHover:_,onObservation:C,onClick:P,hoverHighlight:L,chartId:R,loading:I,loadingContent:T,emptyContent:$,legendInteraction:B,legendPosition:H,color:O,stroke:j,strokeWidth:D,opacity:F,showCategoryTicks:E,categoryFormat:z}=e,{width:N,height:W,enableHover:G,showGrid:q,showLegend:V,title:X,description:Y,summary:K,accessibleTable:Z,categoryLabel:Q,valueLabel:U}=o,J=Nl(()=>c(r),[r]),ee=Xs({data:J,rawData:r,colorBy:g,colorScheme:p,legendInteraction:B,legendPosition:H,selection:M,linkedHover:_,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof s?s:""],unwrapData:!0,onObservation:C,onClick:P,hoverHighlight:L,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"ViolinPlot",chartId:R,showLegend:V,userMargin:i,marginDefaults:o.marginDefaults,loading:I,loadingContent:T,emptyContent:$,width:N,height:W}),te=yl({brushProp:w,onBrushProp:k,linkedBrush:S,valueAccessor:l}),oe=ys(),ne=Nl(()=>new Map,[J]),re=Us({colorBy:g,colorScale:ee.colorScale,color:O,themeCategorical:oe,colorScheme:p,categoryIndexMap:ne,userPieceStyle:void 0,stroke:j,strokeWidth:D,opacity:F,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection,baseStyleExtras:{fillOpacity:.6},linkStrokeToFill:!0}),ie=Nl(()=>Tl({valueAccessor:l}),[l]);if(ee.earlyReturn)return ee.earlyReturn;const ae=Ns({componentName:"ViolinPlot",data:r,accessors:{categoryAccessor:s,valueAccessor:l}});if(ae)return ql(Rs,{componentName:"ViolinPlot",message:ae,width:N,height:W});const se={chartType:"violin",...null!=r&&{data:J},oAccessor:s,rAccessor:l,projection:"horizontal"===u?"horizontal":"vertical",summaryStyle:re,bins:d,showIQR:f,size:[N,W],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ee.margin,barPadding:y,enableHover:G,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:Q,rLabel:U,rFormat:m,...z&&{oFormat:z},showGrid:q,showCategoryTicks:E,...ee.legendBehaviorProps,...aa({title:X,description:Y,summary:K,accessibleTable:Z,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...la({tooltip:b,defaultTooltipContent:ie}),...sa({linkedHover:_,selection:M,onObservation:C,onClick:P,hoverHighlight:L,mobileInteraction:ee.mobileInteraction,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior}),...v&&v.length>0&&{annotations:v},...x&&{rExtent:x},...te.brushStreamProps,...Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e))};return ql(Os,{componentName:"ViolinPlot",width:N,height:W,children:ql(ia,{ref:n,...se})})});Vl.displayName="ViolinPlot";import{useMemo as Xl,forwardRef as Yl,useRef as Kl}from"react";import{jsx as Zl}from"react/jsx-runtime";var Ql=Yl(function(e,t){const o=xs(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid??!0,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=Kl(null);Al(t,{variant:"xy",frameRef:n});const{data:r,margin:i,className:a,categoryAccessor:s="category",valueAccessor:l="value",orientation:u="horizontal",valueFormat:d,colorBy:h,colorScheme:f,sort:m="auto",dotRadius:g=5,categoryPadding:p=10,tooltip:y,annotations:b,regression:v,valueExtent:x,frameProps:w={},selection:k,linkedHover:S,onObservation:A,onClick:M,hoverHighlight:_,chartId:C,loading:P,loadingContent:L,emptyContent:R,legendInteraction:I,legendPosition:T,color:$,stroke:B,strokeWidth:H,opacity:O,categoryFormat:j}=e,{width:D,height:F,enableHover:E,showGrid:z,showLegend:N,title:W,description:G,summary:q,accessibleTable:V,categoryLabel:X,valueLabel:Y}=o,K=Xl(()=>c(r),[r]),Z=Xs({data:K,rawData:r,colorBy:h,colorScheme:f,legendInteraction:I,legendPosition:T,selection:k,linkedHover:S,fallbackFields:h?["string"==typeof h?h:""]:["string"==typeof s?s:""],unwrapData:!0,onObservation:A,onClick:M,hoverHighlight:_,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"DotPlot",chartId:C,showLegend:N,userMargin:i,marginDefaults:o.marginDefaults,loading:P,loadingContent:L,emptyContent:R,width:D,height:F}),Q=bs(K,m,l),U=ys(),J=Xl(()=>new Map,[K]),ee=Us({colorBy:h,colorScale:Z.colorScale,color:$,themeCategorical:U,colorScheme:f,categoryIndexMap:J,userPieceStyle:w?.pieceStyle,stroke:B,strokeWidth:H,opacity:O,effectiveSelectionHook:Z.effectiveSelectionHook,resolvedSelection:Z.resolvedSelection,baseStyleExtras:{r:g,fillOpacity:.8}}),te=Xl(()=>Cs({categoryAccessor:s,valueAccessor:l,valueFormat:d}),[s,l,d]);if(Z.earlyReturn)return Z.earlyReturn;const oe=Ns({componentName:"DotPlot",data:r,accessors:{categoryAccessor:s,valueAccessor:l}});if(oe)return Zl(Rs,{componentName:"DotPlot",message:oe,width:D,height:F});const ne=Js(v),re=ne?[ne,...b||[]]:b,ie={chartType:"point",...null!=r&&{data:Q},oAccessor:s,rAccessor:l,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:ee,size:[D,F],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Z.margin,barPadding:p,enableHover:E,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:X,rLabel:Y,rFormat:d,...j&&{oFormat:j},showGrid:z,oSort:m,...Z.legendBehaviorProps,...aa({title:W,description:G,summary:q,accessibleTable:V,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...la({tooltip:y,defaultTooltipContent:te}),...sa({linkedHover:S,selection:k,onObservation:A,onClick:M,hoverHighlight:_,mobileInteraction:Z.mobileInteraction,customHoverBehavior:Z.customHoverBehavior,customClickBehavior:Z.customClickBehavior}),...re&&re.length>0&&{annotations:re},...x&&{rExtent:x},...Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e))};return Zl(Os,{componentName:"DotPlot",width:D,height:F,children:Zl(ia,{ref:n,...ie})})});Ql.displayName="DotPlot";import{useMemo as Ul,forwardRef as Jl,useRef as ec}from"react";import{jsx as tc}from"react/jsx-runtime";var oc=Jl(function(e,t){const o=xs(e.mode,{width:e.width??400,height:e.height??400,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,showCategoryTicks:e.showCategoryTicks,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=ec(null),{data:r,margin:i,className:a,categoryAccessor:s="category",valueAccessor:l="value",colorBy:u,colorScheme:d,startAngle:h=0,cornerRadius:f,tooltip:m,annotations:g,frameProps:p={},selection:y,linkedHover:b,onObservation:v,onClick:x,hoverHighlight:w,chartId:k,loading:S,loadingContent:A,emptyContent:M,legendInteraction:_,legendPosition:C,color:P,stroke:L,strokeWidth:R,opacity:I}=e,{width:T,height:$,enableHover:B,showLegend:H,title:O,description:j,summary:D,accessibleTable:F}=o,E=Ul(()=>c(r),[r]),z=u||s,N=Xs({data:E,rawData:r,colorBy:z,colorScheme:d,legendInteraction:_,legendPosition:C,selection:y,linkedHover:b,fallbackFields:z?["string"==typeof z?z:""]:[],unwrapData:!0,onObservation:v,onClick:x,hoverHighlight:w,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"PieChart",chartId:k,showLegend:H,userMargin:i,marginDefaults:o.marginDefaults,loading:S,loadingContent:A,emptyContent:M,width:T,height:$}),W=ys(),G=Ul(()=>new Map,[E]),q=Us({colorBy:z,colorScale:N.colorScale,color:P,themeCategorical:W,colorScheme:d,categoryIndexMap:G,userPieceStyle:p?.pieceStyle,stroke:L,strokeWidth:R,opacity:I,effectiveSelectionHook:N.effectiveSelectionHook,resolvedSelection:N.resolvedSelection,cycleByCategory:!0}),V=Ul(()=>Cs({categoryAccessor:s,valueAccessor:l,groupAccessor:u&&u!==s?u:void 0,groupLabel:"string"==typeof u?u:"group",pieData:!0}),[s,l,u]),X=Ns({componentName:"PieChart",data:r,accessors:{categoryAccessor:s,valueAccessor:l}}),{effectiveLegendProps:Y,effectiveMargin:K}=Ks({ref:t,frameRef:n,setup:N});if(N.earlyReturn)return N.earlyReturn;const Z={chartType:"pie",...null!=r&&{data:E},oAccessor:s,rAccessor:l,projection:"radial",pieceStyle:q,startAngle:h,...null!=f&&{cornerRadius:f},size:[T,$],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:K,enableHover:B,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:!1,...Y,...aa({title:O,description:j,summary:D,accessibleTable:F,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...la({tooltip:m,defaultTooltipContent:V}),...sa({linkedHover:b,selection:y,onObservation:v,onClick:x,hoverHighlight:w,mobileInteraction:N.mobileInteraction,customHoverBehavior:N.customHoverBehavior,customClickBehavior:N.customClickBehavior}),...g&&g.length>0&&{annotations:g},...Object.fromEntries(Object.entries(p).filter(([e])=>"pieceStyle"!==e))};return X?tc(Rs,{componentName:"PieChart",message:X,width:T,height:$}):tc(Os,{componentName:"PieChart",width:T,height:$,children:tc(ia,{ref:n,...Z})})});oc.displayName="PieChart";import{useMemo as nc,forwardRef as rc,useRef as ic}from"react";import{jsx as ac}from"react/jsx-runtime";var sc=rc(function(e,t){const o=xs(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,linkedHover:e.linkedHover,showCategoryTicks:e.showCategoryTicks,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:400,height:400}),n=ic(null),{data:r,margin:i,className:a,categoryAccessor:s="category",valueAccessor:l="value",innerRadius:u,centerContent:d,colorBy:h,colorScheme:f,startAngle:m=0,cornerRadius:g,tooltip:p,annotations:y,frameProps:b={},selection:v,linkedHover:x,onObservation:w,onClick:k,hoverHighlight:S,chartId:A,loading:M,loadingContent:_,emptyContent:C,legendInteraction:P,legendPosition:L,color:R,stroke:I,strokeWidth:T,opacity:$}=e,{width:B,height:H,enableHover:O,showLegend:j,title:D,description:F,summary:E,accessibleTable:z}=o,N=nc(()=>c(r),[r]),W=h||s,G=Xs({data:N,rawData:r,colorBy:W,colorScheme:f,legendInteraction:P,legendPosition:L,selection:v,linkedHover:x,fallbackFields:W?["string"==typeof W?W:""]:[],unwrapData:!0,onObservation:w,onClick:k,hoverHighlight:S,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"DonutChart",chartId:A,showLegend:j,userMargin:i,marginDefaults:o.marginDefaults,loading:M,loadingContent:_,emptyContent:C,width:B,height:H}),q=u??Math.max(2,.15*Math.min(B,H)),V=ys(),X=nc(()=>new Map,[N]),Y=Us({colorBy:W,colorScale:G.colorScale,color:R,themeCategorical:V,colorScheme:f,categoryIndexMap:X,userPieceStyle:b?.pieceStyle,stroke:I,strokeWidth:T,opacity:$,effectiveSelectionHook:G.effectiveSelectionHook,resolvedSelection:G.resolvedSelection,cycleByCategory:!0}),K=nc(()=>Cs({categoryAccessor:s,valueAccessor:l,groupAccessor:h&&h!==s?h:void 0,groupLabel:"string"==typeof h?h:"group",pieData:!0}),[s,l,h]),Z=Ns({componentName:"DonutChart",data:r,accessors:{categoryAccessor:s,valueAccessor:l}}),{effectiveLegendProps:Q,effectiveMargin:U}=Ks({ref:t,frameRef:n,setup:G});if(G.earlyReturn)return G.earlyReturn;const J={chartType:"donut",...null!=r&&{data:N},oAccessor:s,rAccessor:l,projection:"radial",pieceStyle:Y,innerRadius:q,startAngle:m,...null!=g&&{cornerRadius:g},centerContent:d,size:[B,H],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:U,enableHover:O,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:!1,...Q,...aa({title:D,description:F,summary:E,accessibleTable:z,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...la({tooltip:p,defaultTooltipContent:K}),...sa({linkedHover:x,selection:v,onObservation:w,onClick:k,hoverHighlight:S,mobileInteraction:G.mobileInteraction,customHoverBehavior:G.customHoverBehavior,customClickBehavior:G.customClickBehavior}),...y&&y.length>0&&{annotations:y},...Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e))};return Z?ac(Rs,{componentName:"DonutChart",message:Z,width:B,height:H}):ac(Os,{componentName:"DonutChart",width:B,height:H,children:ac(ia,{ref:n,...J})})});sc.displayName="DonutChart";import{useMemo as lc,forwardRef as cc,useRef as uc}from"react";function dc(e=240){const t=360-e,o=180+t/2,n=o*Math.PI/180;return{sweepRad:e*Math.PI/180,gapDeg:t,startAngleDeg:o,startAngleRad:n,offsetRad:-Math.PI/2+n}}function hc(e){return Math.max(0,Math.min(1,e))}function fc(e){const t=e.trim();if(t.startsWith("#")){let e=t.slice(1);if(3===e.length&&(e=e.split("").map(e=>e+e).join("")),6===e.length&&/^[0-9a-f]{6}$/i.test(e))return[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16)]}const o=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);if(o){const e=[Number(o[1]),Number(o[2]),Number(o[3])];if(e.every(Number.isFinite))return e}return null}function mc(e,t,o){const n=e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0");return`#${n(e)}${n(t)}${n(o)}`}function gc(e,t){const o=e.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:hc(e.offset),color:e.color})).sort((e,t)=>e.offset-t.offset);if(0===o.length)return"#999999";if(1===o.length)return o[0].color;const n=hc(t);if(o[0].offset>=n)return o[0].color;if(n>=o[o.length-1].offset)return o[o.length-1].color;for(let e=0;o.length-1>e;e++){const t=o[e],r=o[e+1];if(t.offset>n||n>r.offset)continue;const i=r.offset-t.offset,a=i>0?(n-t.offset)/i:0,s=fc(t.color),l=fc(r.color);if(!s||!l)return.5>a?t.color:r.color;const[c,u,d]=s,[h,f,m]=l;return mc(c+(h-c)*a,u+(f-u)*a,d+(m-d)*a)}return o[o.length-1].color}function pc(e,t,o){return null==o?`${e}-${t}`:`${e}-${t}-${o}`}import{jsx as yc,jsxs as bc}from"react/jsx-runtime";var vc=cc(function(e,t){const o=xs(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLegend:!1,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:300,height:250}),n=uc(null),r="context"===e.mode,{compactMode:i}=o,{value:a,min:s=0,max:l=100,thresholds:c,gradientFill:u,color:d,backgroundColor:h="var(--semiotic-grid, #e0e0e0)",arcWidth:f=.3,cornerRadius:m,showNeedle:g=!0,needleColor:p="var(--semiotic-text, #333)",centerContent:y,valueFormat:b,showScaleLabels:v=!i,sweep:x=240,fillZones:w=!0,tooltip:k,annotations:S,frameProps:A={},className:M,stroke:_,strokeWidth:C,opacity:P}=e,{width:L,height:R,title:I,description:T,summary:$,accessibleTable:B}=o,H=u&&"object"==typeof u?u:void 0,O=Math.max(s,Math.min(l,a)),j=l-s||1,D=(O-s)/j,{gaugeData:F,pieceStyle:E,gaugeAnnotations:z}=lc(()=>function(e){const{min:t,max:o,value:n,thresholds:r,fillColor:i,backgroundColor:a,fillZones:s,showScaleLabels:l,gradientFill:c,gradientSteps:u=240}=e,d=o-t||1,h=(Math.max(t,Math.min(o,n))-t)/d;let f=r&&r.length>0?[...r].sort((e,t)=>e.value-t.value):[{value:o,color:i||"#007bff"}];f=f.map(e=>({...e,value:Math.max(t,Math.min(o,e.value))})),o>f[f.length-1].value&&f.push({value:o,color:f[f.length-1].color});const m=!!c&&c.colorStops.length>=2,g=[],p=new Map,y=[];if(m){const e=s?h:1,t=pc("bg",0);if(g.push({category:t,value:1,_zone:"Track",_isFill:!1,_pctStart:0,_pct:1,_roundedEnds:{start:!0,end:!0},_nonInteractive:!0}),p.set(t,{fill:a,opacity:.4}),e>0){const t=Math.max(1,Math.floor(u)),o=Math.max(1,Math.min(t,Math.round(e*t))),n=[];for(let t=0;o>t;t++)n.push(gc(c.colorStops,e*(t+.5)/o));const r=pc("fill",0);g.push({category:r,value:e,_zone:"Gradient",_isFill:!0,_pctStart:0,_pct:e,_roundedEnds:{start:!0,end:!0},_nonInteractive:!0,_gradientBand:{colors:n}}),p.set(r,{fill:n[0]||a})}}else{let e=t;for(let o=0;f.length>o;o++){const n=f[o],r=(n.value-e)/d,i=(e-t)/d,l=(n.value-t)/d,c=Math.max(0,(s?Math.min(h,l):l)-i),u=s?Math.max(0,r-c):0;if(c>0){const e=pc("fill",o);g.push({category:e,value:c,_zone:n.label||"Zone "+(o+1),_isFill:!0}),p.set(e,{fill:n.color})}if(u>0){const e=pc("bg",o);g.push({category:e,value:u,_zone:n.label||"Zone "+(o+1),_isFill:!1}),p.set(e,{fill:a,opacity:.4})}e=n.value}}if(l&&r&&r.length>0)for(const e of r)e.value>t&&o>e.value&&y.push({type:"gauge-label",value:e.value,label:e.label||e.value+""});return{gaugeData:g,pieceStyle:(e,t)=>p.get(t||e.category)||{fill:a},gaugeAnnotations:y}}({min:s,max:l,value:a,thresholds:c,fillColor:d,backgroundColor:h,fillZones:w,showScaleLabels:v,gradientFill:H}),[a,s,l,c,d,h,v,w,H]),N=lc(()=>Qs(E,{stroke:_,strokeWidth:C,opacity:P}),[E,_,C,P]),{sweepRad:W,startAngleDeg:G}=dc(x),q=function(e=240){const{sweepRad:t,offsetRad:o}=dc(e),n=[[Math.cos(o),Math.sin(o)],[Math.cos(o+t),Math.sin(o+t)],[0,0]];for(let e=0;2*Math.PI>e;e+=Math.PI/2)((e-o)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)>t+.001||n.push([Math.cos(e),Math.sin(e)]);const r=n.map(e=>e[0]),i=n.map(e=>e[1]),[a,s]=fe(r),[l,c]=fe(i);return{minX:a,maxX:s,minY:l,maxY:c,width:s-a,height:c-l,cx:(a+s)/2,cy:(l+c)/2}}(x),V=Math.min(10,Math.max(1,Math.min(L,R)/12)),X=q.cx,Y=q.cy,K=Math.max(4,Math.min((L-2*V)/q.width,(R-2*V)/q.height)-2),Z=Math.max(0,Math.min(K-1.5,K*(1-f))),Q=L/2-X*K,U=R/2-Y*K,J=2*(K+4),ee=lc(()=>{if(i&&null==y)return null;if(null!=y)return"function"==typeof y?y(O,s,l):y;const e=b?b(O):Math.round(O)+"";return bc("div",{style:{textAlign:"center",lineHeight:1.2},children:[yc("div",{style:{fontSize:Math.max(16,.3*K),fontWeight:700,color:"var(--semiotic-text, #333)"},children:e}),v&&bc("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"},children:[s," – ",l]})]})},[y,O,s,l,b,v,K,i]),te=lc(()=>r&&null==y?{type:"gauge-value",text:b?b(O):Math.round(O)+""}:null,[r,y,O,b]),oe=lc(()=>{if(!g)return null;const e=-Math.PI/2+G*Math.PI/180+D*W,t=Z>20?Z-8:K-1;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:p}},[g,D,G,W,Z,p]),ne=lc(()=>(e,t,o)=>{if("gauge-needle"===e.type){const n=(o.width||L)/2,r=(o.height||R)/2,i=Math.max(1,K-Z),a=Math.max(1,Math.min(2.5,.4*i)),s=Math.max(1,Math.min(5,.6*i));return bc("g",{transform:`translate(${n},${r})`,children:[yc("line",{x1:0,y1:0,x2:e.tipX,y2:e.tipY,stroke:e.color,strokeWidth:a,strokeLinecap:"round"}),yc("circle",{cx:0,cy:0,r:s,fill:e.color})]},"gauge-needle-"+t)}if("gauge-label"===e.type){const n=-Math.PI/2+G*Math.PI/180+(e.value-s)/j*W,r=(o.width||L)/2,i=(o.height||R)/2,a=Z-1,l=K+1,c=Math.cos(n)*a,u=Math.sin(n)*a,d=Math.cos(n)*l,h=Math.sin(n)*l,f=K+10,m=Math.cos(n)*f,g=Math.sin(n)*f,p=((n+Math.PI/2)/(2*Math.PI)*12+12)%12;let y,b;return p>=11||1>p?(y="middle",b="auto"):p>=1&&5>p?(y="start",b="middle"):p>=5&&7>p?(y="middle",b="hanging"):(y="end",b="middle"),bc("g",{transform:`translate(${r},${i})`,children:[yc("line",{x1:c,y1:u,x2:d,y2:h,stroke:"var(--semiotic-border)",strokeWidth:2,strokeLinecap:"round"}),yc("text",{x:m,y:g,textAnchor:y,dominantBaseline:b,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none",fontSize:"var(--semiotic-gauge-label-font-size, 10px)"},children:e.label})]},"gauge-label-"+t)}return"gauge-value"===e.type?yc("text",{x:(o.width||L)/2,y:(o.height||R)/2-.2*Z,textAnchor:"middle",dominantBaseline:"middle",fontSize:Math.max(12,Math.min(22,.28*K)),fontWeight:700,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:e.text},"gauge-value-"+t):null},[L,R,s,j,G,W,Z,K]),re=lc(()=>{const e=[...z,...S||[]];return oe&&e.push(oe),te&&e.push(te),e},[z,S,oe,te]),ie=lc(()=>e=>{const t=e?.data?.[0]||e?.data||e,o=t?._zone||"",n=t?._isFill;return bc("div",{className:"semiotic-tooltip",style:{padding:"6px 10px",background:"var(--semiotic-tooltip-bg, white)",borderRadius:"var(--semiotic-tooltip-radius, 6px)",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0,0,0,0.15))"},children:[yc("div",{style:{fontWeight:600},children:o}),yc("div",{style:{fontSize:"0.85em",color:"var(--semiotic-text-secondary, #666)"},children:n?"Current: "+Math.round(O):"Remaining"})]})},[O]);if(0===F.length)return yc(Rs,{componentName:"GaugeChart",message:"No data to display",width:L,height:R});const ae={chartType:"donut",data:F,oAccessor:"category",rAccessor:"value",oSort:!1,projection:"radial",pieceStyle:N,innerRadius:Z,startAngle:G,sweepAngle:x,...null!=m&&{cornerRadius:m},centerContent:ee,size:[L,R],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:{top:U-J/2,bottom:R-U-J/2,left:Q-J/2,right:L-Q-J/2},enableHover:o.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===k?()=>null:Ar(k)||ie,svgAnnotationRules:ne,...re.length>0&&{annotations:re},...I&&{title:I},...T&&{description:T},...$&&{summary:$},...void 0!==B&&{accessibleTable:B},...M&&{className:M},...null!=e.animate&&{animate:e.animate},...A};return yc(Os,{componentName:"GaugeChart",width:L,height:R,children:yc(ia,{ref:n,...ae})})});vc.displayName="GaugeChart";import{useMemo as xc,forwardRef as wc,useRef as kc}from"react";import{jsx as Sc}from"react/jsx-runtime";var Ac=wc(function(e,t){const o=xs(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=kc(null);Al(t,{variant:"xy",frameRef:n});const{data:r,margin:i,className:a,categoryAccessor:s="category",valueAccessor:l="value",orientation:u="horizontal",bins:d=20,amplitude:h=1.5,valueFormat:f,colorBy:m,colorScheme:g,categoryPadding:p=5,tooltip:y,annotations:b,valueExtent:v,frameProps:x={},selection:w,linkedHover:k,onObservation:S,onClick:A,hoverHighlight:M,chartId:_,loading:C,loadingContent:P,emptyContent:L,legendInteraction:R,legendPosition:I,color:T,stroke:$,strokeWidth:B,opacity:H,showCategoryTicks:O,categoryFormat:j}=e,{width:D,height:F,enableHover:E,showGrid:z,showLegend:N,title:W,description:G,summary:q,accessibleTable:V,categoryLabel:X,valueLabel:Y}=o,K=xc(()=>c(r),[r]),Z=Xs({data:K,rawData:r,colorBy:m,colorScheme:g,legendInteraction:R,legendPosition:I,selection:w,linkedHover:k,fallbackFields:m?["string"==typeof m?m:""]:["string"==typeof s?s:""],unwrapData:!0,onObservation:S,onClick:A,hoverHighlight:M,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"RidgelinePlot",chartId:_,showLegend:N,userMargin:i,marginDefaults:o.marginDefaults,loading:C,loadingContent:P,emptyContent:L,width:D,height:F}),Q=ys(),U=xc(()=>new Map,[K]),J=Us({colorBy:m,colorScale:Z.colorScale,color:T,themeCategorical:Q,colorScheme:g,categoryIndexMap:U,userPieceStyle:void 0,stroke:$,strokeWidth:B,opacity:H,effectiveSelectionHook:Z.effectiveSelectionHook,resolvedSelection:Z.resolvedSelection,baseStyleExtras:{fillOpacity:.5},linkStrokeToFill:!0}),ee=xc(()=>Tl(),[]);if(Z.earlyReturn)return Z.earlyReturn;const te=Ns({componentName:"RidgelinePlot",data:r,accessors:{categoryAccessor:s,valueAccessor:l}});if(te)return Sc(Rs,{componentName:"RidgelinePlot",message:te,width:D,height:F});const oe={chartType:"ridgeline",...null!=r&&{data:K},oAccessor:s,rAccessor:l,projection:"horizontal"===u?"horizontal":"vertical",summaryStyle:J,bins:d,size:[D,F],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Z.margin,barPadding:p,enableHover:E,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:X,rLabel:Y,rFormat:f,...j&&{oFormat:j},showGrid:z,showCategoryTicks:O,oSort:!1,amplitude:h,...Z.legendBehaviorProps,...aa({title:W,description:G,summary:q,accessibleTable:V,className:a,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...la({tooltip:y,defaultTooltipContent:ee}),...sa({linkedHover:k,selection:w,onObservation:S,onClick:A,hoverHighlight:M,mobileInteraction:Z.mobileInteraction,customHoverBehavior:Z.customHoverBehavior,customClickBehavior:Z.customClickBehavior}),...b&&b.length>0&&{annotations:b},...v&&{rExtent:v},...Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e))};return Sc(Os,{componentName:"RidgelinePlot",width:D,height:F,children:Sc(ia,{ref:n,...oe})})});Ac.displayName="RidgelinePlot";import{useMemo as Mc,forwardRef as _c,useRef as Cc}from"react";import{jsx as Pc,jsxs as Lc}from"react/jsx-runtime";var Rc=_c(function(e,t){const o=xs(e.mode,{width:e.width,height:e.height,showGrid:!1,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,showCategoryTicks:!1,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=Cc(null);Al(t,{variant:"xy",frameRef:n});const{data:r,margin:i,className:a,stepAccessor:s="step",valueAccessor:l="value",categoryAccessor:u,colorBy:d,colorScheme:h,orientation:f="horizontal",connectorOpacity:m=.3,showLabels:g=!0,tooltip:p,annotations:y,frameProps:b={},selection:v,linkedHover:x,onObservation:w,onClick:k,hoverHighlight:S,chartId:A,loading:M,loadingContent:_,emptyContent:C,legendInteraction:P,legendPosition:L,color:R,stroke:I,strokeWidth:T,opacity:$,categoryFormat:B}=e,H="vertical"===f,{width:O,height:j,enableHover:D,showLegend:F,title:E,description:z,summary:N,accessibleTable:W}=o,G=H?{top:E?60:40,right:20,bottom:60,left:60}:{top:E?40:10,right:10,bottom:10,left:10},q=Mc(()=>c(r),[r]),V=d||u,X=!V,Y=Xs({data:q,rawData:r,colorBy:V,colorScheme:h,legendInteraction:P,legendPosition:L,selection:v,linkedHover:x,fallbackFields:V?["string"==typeof V?V:""]:[],unwrapData:!0,onObservation:w,onClick:k,hoverHighlight:S,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"FunnelChart",chartId:A,showLegend:F,userMargin:i,marginDefaults:G,loading:M,loadingContent:_,emptyContent:C,width:O,height:j});Fs("FunnelChart",q,"stepAccessor",s),Fs("FunnelChart",q,"valueAccessor",l);const K=ys(),Z=Mc(()=>new Map,[q]),Q=Mc(()=>{if(X)return R||(K?.[0]?K[0]:Array.isArray(h)&&h[0]?h[0]:"#4e79a7")},[X,R,K,h]),U=Us({colorBy:Q?void 0:V,colorScale:Y.colorScale,color:Q??R,themeCategorical:K,colorScheme:h,categoryIndexMap:Z,userPieceStyle:b?.pieceStyle,stroke:I,strokeWidth:T,opacity:$,effectiveSelectionHook:Y.effectiveSelectionHook,resolvedSelection:Y.resolvedSelection}),J=Mc(()=>e=>{const t=e?.data||e,o=t?.__funnelStep||t?.__barFunnelStep||t?.step||"",n=t?.__funnelValue??t?.__barFunnelValue??t?.value??"",r=t?.__funnelPercent??t?.__barFunnelPercent,i=t?.__funnelIsFirstStep??t?.__barFunnelIsFirstStep,a=t?.__barFunnelIsDropoff,s=t?.__barFunnelCategory??t?.category,l=null==r||i?"":` (${.05>Math.abs(r-Math.round(r))?Math.round(r)+"%":r.toFixed(1)+"%"})`;return Lc("div",{className:"semiotic-tooltip",style:xr,children:[o&&Pc("div",{style:{fontWeight:"bold"},children:o+""}),s&&s!==o&&Pc("div",{style:{marginTop:2,opacity:.8},children:s+""}),a&&Pc("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7},children:"Dropoff"}),Lc("div",{style:{marginTop:4},children:[n+"",l]})]})},[]);if(Y.earlyReturn)return Y.earlyReturn;const ee=Ns({componentName:"FunnelChart",data:r,accessors:{stepAccessor:s,valueAccessor:l}});if(ee)return Pc(Rs,{componentName:"FunnelChart",message:ee,width:O,height:j});const te={chartType:H?"bar-funnel":"funnel",...null!=r&&{data:q},oAccessor:s,rAccessor:l,...u&&{stackBy:u},projection:H?"vertical":"horizontal",barPadding:H?40:0,pieceStyle:U,size:[O,j],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Y.margin,enableHover:D,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:H,showCategoryTicks:H,...B&&{oFormat:B},showGrid:H,...!H&&{connectorOpacity:m},showLabels:g,...Y.legendBehaviorProps,...E&&{title:E},...z&&{description:z},...N&&{summary:N},...void 0!==W&&{accessibleTable:W},...a&&{className:a},...null!=e.animate&&{animate:e.animate},tooltipContent:!1===p?()=>null:!0===p||null==p?J:Ar(p)||J,...sa({linkedHover:x,selection:v,onObservation:w,onClick:k,hoverHighlight:S,mobileInteraction:Y.mobileInteraction,customHoverBehavior:Y.customHoverBehavior,customClickBehavior:Y.customClickBehavior}),...y&&y.length>0&&{annotations:y},...Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e))};return Pc(Os,{componentName:"FunnelChart",width:O,height:j,children:Pc(ia,{ref:n,...te})})});Rc.displayName="FunnelChart";import*as Ic from"react";import{useMemo as Tc,useCallback as $c,forwardRef as Bc,useRef as Hc,useImperativeHandle as Oc}from"react";import{useRef as jc,useState as Dc,useCallback as Fc,useMemo as Ec}from"react";import{useMemo as zc,useCallback as Nc,useRef as Wc}from"react";var Gc={RdBu:H,PiYG:O,PRGn:j,BrBG:D,RdYlBu:F,RdYlGn:E,Spectral:z},qc="__likert_neutral_neg",Vc="__likert_neutral_pos";function Xc(e,t){if("function"==typeof e)return e;const o=e||t;return e=>e[o]}function Yc(e,t,o,n,r,i){const a=new Map,s=new Set(t);for(const l of e){const e=o(l);a.has(e)||a.set(e,new Map);const c=a.get(e);if(n){const e=n(l);if(null==e||!Number.isFinite(e))continue;if(!Number.isInteger(e)){"production"!==process.env.NODE_ENV&&console.warn("[LikertChart] Ignoring non-integer Likert score:",e);continue}const o=e-1;if(0>o||o>=t.length)continue;const r=t[o];c.set(r,(c.get(r)||0)+1)}else if(r&&i){const e=r(l),t=i(l);if(!s.has(e))continue;c.set(e,(c.get(e)||0)+(Number.isFinite(t)?t:0))}}const l=[];for(const[e,o]of a){let n=0;for(const e of t)n+=o.get(e)||0;if(0!==n)for(let r=0;t.length>r;r++){const i=t[r],a=o.get(i)||0;l.push({__likertCategory:e,__likertLevel:i,__likertLevelLabel:i,__likertCount:a,__likertPct:a/n*100,__likertLevelIndex:r})}}return l}function Kc(e,t){const o=t.length,n=o%2!=0,r=Math.floor(o/2),i=[];for(const t of e){const e=t.__likertLevelIndex;if(n&&e===r){const e=t.__likertPct/2;i.push({...t,__likertLevel:qc,__likertPct:-e}),i.push({...t,__likertLevel:Vc,__likertPct:e})}else i.push(r>e?{...t,__likertPct:-t.__likertPct}:t)}return i}function Zc(e,t){const o=t.length,n=o%2!=0,r=Math.floor(o/2),i=new Map;for(const t of e){const e=i.get(t.__likertCategory)||[];e.push(t),i.set(t.__likertCategory,e)}const a=[];for(const[,e]of i){const t=new Map;let i,s;for(const o of e)o.__likertLevel===qc?i=o:o.__likertLevel===Vc?s=o:t.set(o.__likertLevelIndex,o);n&&i&&a.push(i);for(let e=r-1;e>=0;e--){const o=t.get(e);o&&a.push(o)}n&&s&&a.push(s);for(let e=n?r+1:r;o>e;e++){const o=t.get(e);o&&a.push(o)}}return a}var Qc=["Very Low","Low","Neutral","High","Very High"];import{jsx as Uc}from"react/jsx-runtime";var Jc=new Map,eu=Bc(function(e,t){const o=xs(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=Hc(null),{data:r,margin:i,className:a,categoryAccessor:s="question",valueAccessor:l,levelAccessor:c,countAccessor:u="count",levels:d=Qc,orientation:h="horizontal",colorScheme:f,barPadding:m=20,tooltip:g,annotations:p,valueExtent:y,frameProps:b={},selection:v,linkedHover:x,onObservation:w,onClick:k,hoverHighlight:S,chartId:A,valueFormat:M,loading:_,loadingContent:C,emptyContent:P,legendInteraction:L,legendPosition:R,categoryFormat:I,stroke:T,strokeWidth:$,opacity:B}=e,{width:H,height:O,enableHover:j,showGrid:D,showLegend:F,title:E,description:z,summary:N,accessibleTable:W,categoryLabel:q,valueLabel:X}=o,K="horizontal"===h,Z=void 0===r,Q=!c,U=function(){const e=ls();return e?.colors?.diverging||void 0}(),J=Tc(()=>f&&Array.isArray(f)&&f.length>=d.length?f:function(e,t){if(0>=e)return[];if(t){const o=Gc[t];if(o){if(1===e)return[o(.5)];const t=[];for(let n=0;e>n;n++)t.push(o(n/(e-1)));return t}}const o=["#da1e28","#ff8389","#ffb3b8"],n=["#a6c8ff","#4589ff","#0043ce"],r="#a8a8a8";if(1===e)return[r];const i=e%2!=0,a=Math.floor(e/2),s=[];for(let e=0;a>e;e++)s.push(o[Math.min(Math.floor(e*o.length/a),o.length-1)]);i&&s.push(r);for(let e=0;a>e;e++)s.push(n[Math.min(Math.floor(e*n.length/a),n.length-1)]);return s}(d.length,U),[f,d.length,U]),ee=Tc(()=>{const e=new Map;for(let t=0;d.length>t;t++)e.set(d[t],J[t]||"#888");return e},[d,J]),{processedData:te,reAggregate:oe,accumulatorRef:ne}=function({data:e,levels:t,categoryAccessor:o,valueAccessor:n,levelAccessor:r,countAccessor:i,isDiverging:a,frameRef:s}){const l=!r,c=zc(()=>Xc(o,"question"),[o]),u=zc(()=>l?Xc(n,"score"):null,[l,n]),d=zc(()=>l?null:Xc(r,"level"),[l,r]),h=zc(()=>l?null:Xc(i,"count"),[l,i]),f=e||[],m=Wc([]);return{processedData:zc(()=>{if(0===f.length)return[];let e=Yc(f,t,c,u,d,h);return a&&(e=Kc(e,t),e=Zc(e,t)),e},[f,t,c,u,d,h,a]),reAggregate:Nc(e=>{let o=Yc(e,t,c,u,d,h);a&&(o=Kc(o,t),o=Zc(o,t)),s.current?.replace(o)},[t,c,u,d,h,a,s]),accumulatorRef:m}}({data:r,levels:d,categoryAccessor:s,valueAccessor:l,levelAccessor:c,countAccessor:u,isDiverging:K,frameRef:n}),re="__likertLevelLabel",ie=function({isPushMode:e,colorBy:t,colorScheme:o,showLegend:n,legendPosition:r="right"}){const i=jc(new Set),a=jc([]),[s,l]=Dc(0),c=Sa(),u=ys(),d=Fc(e=>{if(!t)return null;const o="function"==typeof t?t(e):e[t];return null!=o?o+"":null},[t]),h=Fc(o=>{if(!e||!t)return;let n=!1;for(const e of o){if(!e||"object"!=typeof e)continue;const t=d(e);null==t||i.current.has(t)||(i.current.add(t),a.current.push(t),n=!0)}n&&l(e=>e+1)},[e,t,d]),f=Fc(o=>{if(!e||!t)return;const n=Array.from(new Set(o.map(String))),r=a.current;r.length===n.length&&r.every((e,t)=>e===n[t])||(i.current=new Set(n),a.current=n,l(e=>e+1))},[e,t]),m=Fc(e=>t=>{h([t]),e(t)},[h]),g=Fc(e=>t=>{h(t),e(t)},[h]),p=Fc(()=>{i.current=new Set,a.current=[],l(e=>e+1)},[]);ns(e&&t?a.current:[]);const y=Ec(()=>{if(!e||!t||!1===n)return;const r=a.current;if(0===r.length)return;const i=Array.isArray(o)&&o.length>0||"string"==typeof o&&o.length>0?o:u&&u.length>0?u:G,s="string"==typeof t?t:"__streamCat",l=r.map(e=>({[s]:e})),d=Y(l,s,i);return rs({data:l,colorBy:s,colorScale:e=>c?.[e]||d(e)||"#999",getColor:V})},[e,t,n,o,c,u,s]),b=Ec(()=>{if(y)return"right"===r?{right:110}:"left"===r?{left:110}:"top"===r?{top:50}:"bottom"===r?{bottom:80}:{right:110}},[y,r]);return{wrapPush:m,wrapPushMany:g,resetCategories:p,categories:a.current,categoryDomainProps:e&&t?{legendCategoryAccessor:t,onCategoriesChange:f}:{},streamingLegend:y,streamingMarginAdjust:b}}({isPushMode:Z,colorBy:re,colorScheme:J,showLegend:F,legendPosition:R}),ae=$c(ie.wrapPush(e=>{ne.current.push(e),oe(ne.current)}),[ie.wrapPush,oe,ne]),se=$c(ie.wrapPushMany(e=>{ne.current.push(...e),oe(ne.current)}),[ie.wrapPushMany,oe,ne]);Oc(t,()=>({push:ae,pushMany:se,remove:e=>n.current?.remove(e)??[],update:(e,t)=>n.current?.update(e,t)??[],clear:()=>{ne.current=[],ie.resetCategories(),n.current?.clear()},getData:()=>n.current?.getData()??[],getScales:()=>n.current?.getScales()??null}),[ae,se,ie.resetCategories,ne]);const le=Xs({data:te,rawData:r,colorBy:re,colorScheme:J,legendInteraction:L,legendPosition:R,selection:v,linkedHover:x,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:w,onClick:k,hoverHighlight:S,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"LikertChart",chartId:A,showLegend:F,userMargin:i,marginDefaults:o.marginDefaults,loading:_,loadingContent:C,emptyContent:P,width:H,height:O}),ce=Tc(()=>{const e=d.length;return e%2!=0&&ee.get(d[Math.floor(e/2)])||"#888"},[d,ee]),ue=Us({colorBy:void 0,colorScale:void 0,color:void 0,themeCategorical:void 0,colorScheme:void 0,categoryIndexMap:Jc,userPieceStyle:b?.pieceStyle,stroke:T,strokeWidth:$,opacity:B,effectiveSelectionHook:le.effectiveSelectionHook,resolvedSelection:le.resolvedSelection,baseStyleExtras:e=>{const t=e.__likertLevelLabel||e.data?.__likertLevelLabel,o=e.__likertLevel||e.data?.__likertLevel;if(o===qc||o===Vc)return{fill:ce};const n=t||o;return n&&ee.has(n)?{fill:ee.get(n)}:{fill:"#888"}}}),de=Tc(()=>{const e=d.length;return e%2!=0?d[Math.floor(e/2)]:""},[d]),he=Tc(()=>e=>{const t=e.data||e,o=t.__likertLevel||"Unknown",n=o===qc||o===Vc?de:o,r=t.__likertCategory||"",i=Math.abs(t.__likertPct||0),a=o===qc||o===Vc?2*i:i,s=t.__likertCount||0;return Ic.createElement("div",{className:"semiotic-tooltip",style:xr},Ic.createElement("div",{style:{fontWeight:"bold"}},r),Ic.createElement("div",{style:{marginTop:4}},`${n}: ${a.toFixed(1)}% (n=${s})`))},[de]),fe=Tc(()=>{if(!d||2>d.length)return"LikertChart requires `levels` with at least 2 entries.";if(l&&c)return"LikertChart: provide either `valueAccessor` (raw responses) or `levelAccessor` + `countAccessor` (pre-aggregated), not both.";if(c&&!u)return"LikertChart: pre-aggregated mode requires both `levelAccessor` and `countAccessor`.";if(void 0!==r&&0===r.length)return null;const e={categoryAccessor:s};return Q?l&&(e.valueAccessor=l):(c&&(e.levelAccessor=c),u&&(e.countAccessor=u)),Ns({componentName:"LikertChart",data:r,accessors:e,requiredProps:{levels:d}})},[r,s,l,c,u,d,Q]),me=Tc(()=>[{styleFn:e=>({fill:ee.get(e.label)||"#888"}),items:d.map(e=>({label:e})),label:""}],[d,ee]),ge=Tc(()=>!1!==F?{...le.legendBehaviorProps,legend:{legendGroups:me},legendPosition:R||le.legendPosition||"bottom"}:le.legendBehaviorProps,[le.legendBehaviorProps,le.legendPosition,R,F,me]),pe=Tc(()=>{const e={...le.margin};if(Z&&!1!==F){const t=R||"bottom";"bottom"===t&&80>e.bottom?e.bottom=80:"top"===t&&50>e.top?e.top=50:"right"===t&&110>e.right?e.right=110:"left"===t&&110>e.left&&(e.left=110)}else if(ie.streamingMarginAdjust)for(const[t,o]of Object.entries(ie.streamingMarginAdjust))o>e[t]&&(e[t]=o);return K&&100>e.left&&(e.left=100),e},[le.margin,ie.streamingMarginAdjust,K,Z,F,R]),ye=Tc(()=>M||(K?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[K,M]);if(le.earlyReturn)return le.earlyReturn;const be={chartType:"bar",...null!=r&&{data:te},oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:K?"horizontal":"vertical",pieceStyle:ue,size:[H,O],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:pe,barPadding:m,enableHover:j,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:q,rLabel:X||(K?void 0:"Percentage"),rFormat:ye,...I&&{oFormat:I},showGrid:D,...ge,...E&&{title:E},...z&&{description:z},...N&&{summary:N},...void 0!==W&&{accessibleTable:W},...a&&{className:a},...null!=e.animate&&{animate:e.animate},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},tooltipContent:!1===g?()=>null:!0===g?he:Ar(g)||he,...sa({linkedHover:x,selection:v,onObservation:w,onClick:k,hoverHighlight:S,mobileInteraction:le.mobileInteraction,customHoverBehavior:le.customHoverBehavior,customClickBehavior:le.customClickBehavior}),...p&&p.length>0&&{annotations:p},...y&&{rExtent:y},...Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e))};return fe?Uc(Rs,{componentName:"LikertChart",message:fe,width:H,height:O}):Uc(Os,{componentName:"LikertChart",width:H,height:O,children:Uc(ia,{ref:n,...be})})});eu.displayName="LikertChart";import{forwardRef as tu,useMemo as ou}from"react";import{useMemo as nu,useRef as ru}from"react";import{jsx as iu}from"react/jsx-runtime";var au=tu(function(e,t){const{data:o,layout:n,layoutConfig:r,onLayoutError:i,categoryAccessor:a="category",valueAccessor:s="value",oExtent:l,rExtent:c,projection:u="vertical",margin:d,className:h,colorBy:f,colorScheme:m,showAxes:g=!1,annotations:p,onObservation:y,onClick:b,selection:v,linkedHover:x,chartId:w,loading:k,loadingContent:S,emptyContent:A,frameProps:M={}}=e,{frameRef:_,resolved:C,safeData:P,setup:L,earlyReturn:R}=function(e){const t=function(e){const t=ru(null);return Al(e.imperativeRef,{variant:e.imperativeVariant,frameRef:t}),{frameRef:t,resolved:xs(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),normalizedMargin:nu(()=>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])}}(e),{resolved:o,normalizedMargin:n}=t,r=Xs({data:e.data??[],rawData:e.data,colorBy:e.colorBy,colorScheme:e.colorScheme,legendInteraction:void 0,selection:e.selection,linkedHover:e.linkedHover,fallbackFields:"string"==typeof e.colorBy?[e.colorBy]:[],unwrapData:e.unwrapData,onObservation:e.onObservation,onClick:e.onClick,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,chartType:e.chartTypeLabel,chartId:e.chartId,showLegend:o.showLegend,userMargin:n,marginDefaults:o.marginDefaults,loading:e.loading,loadingContent:e.loadingContent,emptyContent:e.emptyContent,width:o.width,height:o.height});return{...t,safeData:r.data,setup:r,earlyReturn:r.earlyReturn}}({imperativeRef:t,imperativeVariant:"xy",chartTypeLabel:"OrdinalCustomChart",unwrapData:!0,data:o,colorBy:f,colorScheme:m,selection:v,linkedHover:x,onObservation:y,onClick:b,chartId:w,loading:k,loadingContent:S,emptyContent:A,margin:d,width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,title:e.title,mode:e.mode,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),I=L.effectiveSelectionHook,T=ou(()=>I?.isActive?{isActive:!0,predicate:I.predicate}:null,[I?.isActive,I?.predicate]);if(R)return R;const{width:$,height:B,enableHover:H,showGrid:O,title:j,description:D,summary:F,accessibleTable:E}=C,z={chartType:"custom",...null!=o&&{data:P},customLayout:n,layoutConfig:r,onLayoutError:i,...T&&{layoutSelection:T},oAccessor:a,rAccessor:s,oExtent:l,rExtent:c,projection:u,colorAccessor:f,colorScheme:m,size:[$,B],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:L.margin,enableHover:H,showAxes:g,showGrid:O,annotations:p,...aa({title:j,description:D,summary:F,accessibleTable:E,className:h,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...sa({linkedHover:x,selection:v,onObservation:y,onClick:b,hoverHighlight:!1,mobileInteraction:L.mobileInteraction,customHoverBehavior:L.customHoverBehavior,customClickBehavior:L.customClickBehavior}),...M};return iu(Os,{componentName:"OrdinalCustomChart",width:$,height:B,children:iu(ia,{ref:_,...z})})});au.displayName="OrdinalCustomChart";var su={fill:"rgba(0,0,0,0)",stroke:"rgba(0,0,0,0)",opacity:0},lu=8;function cu(e){return null==e?void 0:e+""}function uu(e){const t=cu(e.id);return{type:"point",x:e.x,y:e.y,r:e.r??8,style:{...su},datum:e.datum,pointId:t,_transitionKey:t}}function du(e){return{type:"rect",x:e.x,y:e.y,w:e.width,h:e.height,style:{...su},datum:e.datum,group:e.group,_transitionKey:cu(e.id)}}export{tl as BarChart,Bl as BoxPlot,lu as DEFAULT_HIT_RADIUS,sc as DonutChart,Ql as DotPlot,Rc as FunnelChart,vc as GaugeChart,dl as GroupedBarChart,zl as Histogram,eu as LikertChart,au as OrdinalCustomChart,oc as PieChart,Ac as RidgelinePlot,al as StackedBarChart,ia as StreamOrdinalFrame,_l as SwarmPlot,vl as SwimlaneChart,Vl as ViolinPlot,Wi as createHatchPattern,Ze as glyphExtent,Ke as glyphPlacement,uu as hitTargetPoint,du as hitTargetRect,ds as resolveResponsiveRules,us as responsiveRuleMatches,ze as useCustomLayoutSelection};
|