semiotic 3.8.0 → 3.8.2
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 +14 -9
- package/README.md +56 -55
- package/ai/behaviorContracts.cjs +9 -0
- package/ai/dist/mcp-server.js +240 -30
- package/ai/schema.json +616 -42
- package/ai/surface-manifest.json +3 -2
- package/ai/system-prompt.md +7 -3
- package/dist/__tests__/scenarios/mcpProtocolTypes.d.ts +20 -0
- package/dist/chunk-OrdinalBrushOverlay-PXHQYDB2.module.min.js +2 -0
- package/dist/chunk-XYBrushOverlay-ECZJJLAJ.module.min.js +1 -0
- package/dist/chunk-XYBrushOverlay-EP2SV3UI.module.min.js +2 -0
- package/dist/chunk-chunk-255KDHW5.module.min.js +1 -0
- package/dist/chunk-chunk-27HVVXS6.module.min.js +1 -0
- package/dist/chunk-chunk-2CXCXRB4.module.min.js +1 -0
- package/dist/chunk-chunk-2JGJ5GUG.module.min.js +2 -0
- package/dist/chunk-chunk-2UN3ANRN.module.min.js +2 -0
- package/dist/chunk-chunk-2VUEY5TH.module.min.js +1 -0
- package/dist/chunk-chunk-2WVCH4PL.module.min.js +1 -0
- package/dist/chunk-chunk-5UKL5W76.module.min.js +2 -0
- package/dist/chunk-chunk-5WEFWNUW.module.min.js +2 -0
- package/dist/chunk-chunk-6F6GEAQU.module.min.js +1 -0
- package/dist/chunk-chunk-7LHMKRKE.module.min.js +2 -0
- package/dist/chunk-chunk-BHYTYMY2.module.min.js +2 -0
- package/dist/chunk-chunk-C6EJ4IOD.module.min.js +2 -0
- package/dist/chunk-chunk-CA3YDW6F.module.min.js +1 -0
- package/dist/chunk-chunk-CP3EN6KZ.module.min.js +1 -0
- package/dist/chunk-chunk-CYIML3AV.module.min.js +2 -0
- package/dist/chunk-chunk-DNY43POY.module.min.js +1 -0
- package/dist/chunk-chunk-DSNGDNJY.module.min.js +1 -0
- package/dist/chunk-chunk-E7MIQX7D.module.min.js +2 -0
- package/dist/chunk-chunk-EMO5NUGE.module.min.js +1 -0
- package/dist/chunk-chunk-ES4DCG3L.module.min.js +1 -0
- package/dist/chunk-chunk-FAKO3RGQ.module.min.js +2 -0
- package/dist/chunk-chunk-FYY2ACNJ.module.min.js +2 -0
- package/dist/chunk-chunk-G7WFWHAD.module.min.js +2 -0
- package/dist/chunk-chunk-GMQ5AYTD.module.min.js +1 -0
- package/dist/chunk-chunk-H4PPRW6N.module.min.js +1 -0
- package/dist/chunk-chunk-IFYPMWKY.module.min.js +1 -0
- package/dist/chunk-chunk-J3ELI22J.module.min.js +1 -0
- package/dist/chunk-chunk-J3QOW4OE.module.min.js +0 -0
- package/dist/chunk-chunk-J3XWETBJ.module.min.js +2 -0
- package/dist/chunk-chunk-JCG72SGW.module.min.js +2 -0
- package/dist/{semiotic-ai-chunk-OG7BQUUW.module.min.js → chunk-chunk-JJ2OOIET.module.min.js} +0 -1
- package/dist/chunk-chunk-KTWEBFMX.module.min.js +2 -0
- package/dist/chunk-chunk-L6D3I3V7.module.min.js +2 -0
- package/dist/chunk-chunk-M337NY6L.module.min.js +1 -0
- package/dist/chunk-chunk-NO4MCQVD.module.min.js +1 -0
- package/dist/chunk-chunk-ODUZEEBH.module.min.js +2 -0
- package/dist/chunk-chunk-P6UBCMSQ.module.min.js +2 -0
- package/dist/chunk-chunk-Q2YADC2V.module.min.js +2 -0
- package/dist/chunk-chunk-QRIBHZYW.module.min.js +1 -0
- package/dist/chunk-chunk-QSQVBIJA.module.min.js +1 -0
- package/dist/chunk-chunk-RCF52Z42.module.min.js +2 -0
- package/dist/chunk-chunk-RH5TSQPH.module.min.js +1 -0
- package/dist/chunk-chunk-ROP4HI7H.module.min.js +2 -0
- package/dist/chunk-chunk-RZH7VZYS.module.min.js +2 -0
- package/dist/chunk-chunk-SIRIJ3DY.module.min.js +1 -0
- package/dist/chunk-chunk-STZFFTAN.module.min.js +2 -0
- package/dist/chunk-chunk-SV4XAZ3Q.module.min.js +1 -0
- package/dist/chunk-chunk-T27ZEV6A.module.min.js +1 -0
- package/dist/chunk-chunk-U3AGQ5EF.module.min.js +2 -0
- package/dist/chunk-chunk-U66USBWU.module.min.js +1 -0
- package/dist/chunk-chunk-VVCA3DB7.module.min.js +1 -0
- package/dist/chunk-chunk-W3DB2MN4.module.min.js +2 -0
- package/dist/chunk-chunk-WCX6U47H.module.min.js +2 -0
- package/dist/chunk-chunk-WDIN4LRC.module.min.js +1 -0
- package/dist/chunk-chunk-XEVJDUTH.module.min.js +1 -0
- package/dist/chunk-chunk-XOYX77KF.module.min.js +2 -0
- package/dist/chunk-chunk-YCQYG6J5.module.min.js +2 -0
- package/dist/chunk-chunk-YHNZCPOZ.module.min.js +2 -0
- package/dist/chunk-chunk-YWZB3KPI.module.min.js +2 -0
- package/dist/chunk-chunk-Z5KXAVQD.module.min.js +2 -0
- package/dist/chunk-chunk-ZCNBUZPL.module.min.js +2 -0
- package/dist/chunk-chunk-ZLKRTF5N.module.min.js +2 -0
- package/dist/chunk-chunk-ZTNVDWAK.module.min.js +2 -0
- package/dist/chunk-statisticalOverlays-6MVAK5RW.module.min.js +2 -0
- package/dist/components/AccessibleNavTree.d.ts +7 -1
- package/dist/components/ai/chartClinicMetadata.generated.d.ts +15 -0
- package/dist/components/ai/useNavigationSync.d.ts +17 -2
- package/dist/components/chartContainerMobile.d.ts +9 -0
- package/dist/components/charts/geo/ChoroplethMap.d.ts +19 -2
- package/dist/components/charts/geo/DistanceCartogram.d.ts +14 -2
- package/dist/components/charts/geo/FlowMap.d.ts +10 -6
- package/dist/components/charts/geo/ProportionalSymbolMap.d.ts +14 -2
- package/dist/components/charts/index.d.ts +6 -0
- package/dist/components/charts/network/ChordDiagram.d.ts +9 -1
- package/dist/components/charts/network/ForceDirectedGraph.d.ts +11 -0
- package/dist/components/charts/network/SankeyDiagram.d.ts +9 -1
- package/dist/components/charts/ordinal/BarChart.d.ts +21 -0
- package/dist/components/charts/ordinal/GroupedBarChart.d.ts +11 -0
- package/dist/components/charts/ordinal/StackedBarChart.d.ts +11 -0
- package/dist/components/charts/physics/CollisionSwarmChart.d.ts +7 -0
- package/dist/components/charts/physics/EventDropChart.d.ts +7 -0
- package/dist/components/charts/physics/GaltonBoardChart.d.ts +8 -0
- package/dist/components/charts/physics/PhysicalFlowChart.d.ts +7 -0
- package/dist/components/charts/physics/PhysicsCustomChart.d.ts +4 -25
- package/dist/components/charts/physics/PhysicsPileChart.d.ts +7 -0
- package/dist/components/charts/physics/physicsChartShared.d.ts +17 -1
- package/dist/components/charts/physics/physicsCustomLayout.d.ts +32 -0
- package/dist/components/charts/shared/AnnotationLabel.d.ts +88 -0
- package/dist/components/charts/shared/annotationActivation.d.ts +35 -0
- package/dist/components/charts/shared/annotationLabelLayout.d.ts +5 -0
- package/dist/components/charts/shared/annotationRules.d.ts +2 -1
- package/dist/components/charts/shared/auditAccessibilityText.d.ts +13 -0
- package/dist/components/charts/shared/chartSelectionUtils.d.ts +4 -0
- package/dist/components/charts/shared/chartSpecCore.d.ts +3 -3
- package/dist/components/charts/shared/datumTypes.d.ts +2 -0
- package/dist/components/charts/shared/diagnoseAnnotationChecks.d.ts +2 -0
- package/dist/components/charts/shared/formatUtils.d.ts +3 -3
- package/dist/components/charts/shared/hatchFill.d.ts +87 -0
- package/dist/components/charts/shared/hooks.d.ts +7 -6
- package/dist/components/charts/shared/knownChartComponents.d.ts +9 -0
- package/dist/components/charts/shared/leastSquaresRegression.d.ts +16 -0
- package/dist/components/charts/shared/mergeShapeStyle.d.ts +3 -2
- package/dist/components/charts/shared/semanticInteractions.d.ts +42 -0
- package/dist/components/charts/shared/sparseArray.d.ts +1 -1
- package/dist/components/charts/shared/streamPropsHelpers.d.ts +6 -4
- package/dist/components/charts/shared/styleRules.d.ts +205 -0
- package/dist/components/charts/shared/tooltipUtils.d.ts +22 -9
- package/dist/components/charts/shared/types.d.ts +9 -6
- package/dist/components/charts/shared/useAreaSeriesSetup.d.ts +16 -2
- package/dist/components/charts/shared/useChartSetup.d.ts +2 -2
- package/dist/components/charts/shared/useCustomChartSetup.d.ts +3 -0
- package/dist/components/charts/shared/useFrameImperativeHandle.d.ts +1 -2
- package/dist/components/charts/shared/useLikertAggregation.d.ts +4 -4
- package/dist/components/charts/shared/useOrdinalBrush.d.ts +2 -1
- package/dist/components/charts/shared/useOrdinalPieceStyle.d.ts +24 -1
- package/dist/components/charts/shared/useStreamingLegend.d.ts +1 -1
- package/dist/components/charts/shared/useXYLineStyle.d.ts +10 -0
- package/dist/components/charts/shared/useXYPointStyle.d.ts +19 -1
- package/dist/components/charts/shared/validateChartData.d.ts +7 -5
- package/dist/components/charts/shared/validationMap.d.ts +11 -2
- package/dist/components/charts/shared/validationMap.generated.d.ts +6 -0
- package/dist/components/charts/shared/withChartWrapper.d.ts +4 -3
- package/dist/components/charts/value/targetPresentation.d.ts +22 -0
- package/dist/components/charts/value/types.d.ts +5 -6
- package/dist/components/charts/xy/AreaChart.d.ts +8 -0
- package/dist/components/charts/xy/BubbleChart.d.ts +9 -0
- package/dist/components/charts/xy/ConnectedScatterplot.d.ts +7 -0
- package/dist/components/charts/xy/DifferenceChart.d.ts +1 -52
- package/dist/components/charts/xy/Heatmap.d.ts +2 -2
- package/dist/components/charts/xy/LineChart.d.ts +11 -0
- package/dist/components/charts/xy/QuadrantChart.d.ts +7 -0
- package/dist/components/charts/xy/Scatterplot.d.ts +10 -0
- package/dist/components/charts/xy/StackedAreaChart.d.ts +7 -0
- package/dist/components/charts/xy/differenceSegments.d.ts +49 -0
- package/dist/components/charts/xy/scatterplotMatrixInteractionTypes.d.ts +12 -0
- package/dist/components/controls/SentenceFilter.d.ts +97 -0
- package/dist/components/data/fromVegaLite.d.ts +19 -9
- package/dist/components/rough/createRoughRenderMode.d.ts +46 -0
- package/dist/components/semiotic-ai.d.ts +3 -1
- package/dist/components/semiotic-controls.d.ts +2 -0
- package/dist/components/semiotic-geo.d.ts +4 -0
- package/dist/components/semiotic-network.d.ts +4 -0
- package/dist/components/semiotic-ordinal.d.ts +6 -0
- package/dist/components/semiotic-physics.d.ts +4 -0
- package/dist/components/semiotic-rough.d.ts +4 -0
- package/dist/components/semiotic-utils-core.d.ts +4 -0
- package/dist/components/semiotic-xy.d.ts +4 -0
- package/dist/components/semiotic.d.ts +9 -1
- package/dist/components/server/optionalImageTypes.d.ts +37 -0
- package/dist/components/server/serverChartConfigShared.d.ts +9 -5
- package/dist/components/server/serverChartConfigs.d.ts +4 -4
- package/dist/components/server/staticAnnotations.d.ts +6 -3
- package/dist/components/server/staticLegend.d.ts +1 -1
- package/dist/components/server/staticNetwork.d.ts +4 -4
- package/dist/components/server/staticSVGChrome.d.ts +5 -4
- package/dist/components/store/ObservationStore.d.ts +21 -1
- package/dist/components/stream/AccessibleDataTable.d.ts +4 -10
- package/dist/components/stream/AriaLiveTooltip.d.ts +9 -0
- package/dist/components/stream/CanvasHitTester.d.ts +4 -4
- package/dist/components/stream/DataSourceAdapter.d.ts +1 -1
- package/dist/components/stream/FrameRuntime.d.ts +57 -0
- package/dist/components/stream/GeoParticlePool.d.ts +1 -1
- package/dist/components/stream/GeoPipelineStore.d.ts +43 -12
- package/dist/components/stream/GeoSVGOverlay.d.ts +64 -0
- package/dist/components/stream/NetworkCanvasHitTester.d.ts +2 -1
- package/dist/components/stream/NetworkPipelineStore.d.ts +24 -21
- package/dist/components/stream/NetworkSSRFrame.d.ts +17 -0
- package/dist/components/stream/NetworkSVGOverlay.d.ts +6 -0
- package/dist/components/stream/OrdinalBrushOverlay.d.ts +1 -2
- package/dist/components/stream/OrdinalBrushOverlayLazy.d.ts +9 -0
- package/dist/components/stream/OrdinalCanvasHitTester.d.ts +2 -2
- package/dist/components/stream/OrdinalPipelineStore.d.ts +13 -13
- package/dist/components/stream/OrdinalSVGOverlay.d.ts +9 -1
- package/dist/components/stream/OrdinalStyleResolver.d.ts +12 -0
- package/dist/components/stream/ParticlePool.d.ts +1 -1
- package/dist/components/stream/PipelineStore.d.ts +12 -16
- package/dist/components/stream/SVGOverlay.d.ts +6 -0
- package/dist/components/stream/SceneGraph.d.ts +3 -3
- package/dist/components/stream/XYBrushOverlayLazy.d.ts +17 -0
- package/dist/components/stream/accessorUtils.d.ts +2 -2
- package/dist/components/stream/annotationAccessorResolver.d.ts +2 -2
- package/dist/components/stream/frameGraphics.d.ts +4 -0
- package/dist/components/stream/frameKeyboardNavigation.d.ts +45 -0
- package/dist/components/stream/geoPipelineHelpers.d.ts +3 -3
- package/dist/components/stream/geoPipelineUpdateResults.d.ts +34 -0
- package/dist/components/stream/geoSceneBuilder.d.ts +16 -0
- package/dist/components/stream/geoTypes.d.ts +48 -15
- package/dist/components/stream/hitTestUtils.d.ts +2 -2
- package/dist/components/stream/hoverUtils.d.ts +4 -2
- package/dist/components/stream/layouts/forceLayoutWorkerClient.d.ts +1 -0
- package/dist/components/stream/layouts/hierarchyUtils.d.ts +2 -2
- package/dist/components/stream/networkCustomLayoutRunner.d.ts +23 -0
- package/dist/components/stream/networkCustomRestyle.d.ts +15 -0
- package/dist/components/stream/networkFrameAnimation.d.ts +7 -0
- package/dist/components/stream/networkFrameHandleTypes.d.ts +39 -0
- package/dist/components/stream/networkFrameObservations.d.ts +15 -0
- package/dist/components/stream/networkFramePaint.d.ts +11 -2
- package/dist/components/stream/networkInteractionTypes.d.ts +26 -0
- package/dist/components/stream/networkPipelineConfig.d.ts +2 -2
- package/dist/components/stream/networkPipelineUpdateResults.d.ts +38 -0
- package/dist/components/stream/networkTypes.d.ts +37 -56
- package/dist/components/stream/ordinalCanvasRenderers.d.ts +2 -2
- package/dist/components/stream/ordinalPipelineUpdateResults.d.ts +20 -1
- package/dist/components/stream/ordinalSceneBuilders/types.d.ts +2 -2
- package/dist/components/stream/ordinalTypes.d.ts +30 -3
- package/dist/components/stream/physics/PhysicsPipelineStore.d.ts +2 -0
- package/dist/components/stream/physics/PhysicsSVGOverlay.d.ts +6 -0
- package/dist/components/stream/physics/StreamPhysicsTypes.d.ts +21 -6
- package/dist/components/stream/physics/physicsFrameObservations.d.ts +19 -0
- package/dist/components/stream/physics/physicsFrameSetup.d.ts +4 -0
- package/dist/components/stream/physics/physicsPipelineUpdateResults.d.ts +19 -1
- package/dist/components/stream/physics/usePhysicsFrameLifecyclePolicy.d.ts +3 -1
- package/dist/components/stream/pipelineConfig.d.ts +4 -2
- package/dist/components/stream/pipelineDecay.d.ts +2 -2
- package/dist/components/stream/pipelinePulse.d.ts +2 -2
- package/dist/components/stream/pipelineStoreUpdateResults.d.ts +23 -2
- package/dist/components/stream/pipelineTransitions.d.ts +1 -1
- package/dist/components/stream/pipelineUpdateContract.d.ts +7 -0
- package/dist/components/stream/pipelineUpdateStore.d.ts +21 -0
- package/dist/components/stream/renderBackend.d.ts +27 -0
- package/dist/components/stream/renderers/canvasRenderHelpers.d.ts +15 -1
- package/dist/components/stream/renderers/geoCanvasRenderer.d.ts +3 -2
- package/dist/components/stream/renderers/networkParticleRenderer.d.ts +1 -1
- package/dist/components/stream/sceneRenderBackendTypes.d.ts +28 -0
- package/dist/components/stream/sceneRevisionDiagnostics.d.ts +31 -4
- package/dist/components/stream/streamSemanticTypes.d.ts +16 -0
- package/dist/components/stream/streamThemeTypes.d.ts +14 -0
- package/dist/components/stream/svgOverlayUtils.d.ts +10 -0
- package/dist/components/stream/test-utils/frameScheduler.d.ts +12 -0
- package/dist/components/stream/test-utils/revisionConsumption.d.ts +13 -0
- package/dist/components/stream/titleLayout.d.ts +31 -0
- package/dist/components/stream/types.d.ts +30 -65
- package/dist/components/stream/useCanvasFrameHost.d.ts +71 -0
- package/dist/components/stream/useFrame.d.ts +23 -0
- package/dist/components/stream/useLegendCategoryEmission.d.ts +3 -3
- package/dist/components/stream/useSemanticFrameInteractions.d.ts +22 -0
- package/dist/components/stream/useUpdateResultSnapshot.d.ts +7 -0
- package/dist/components/stream/xyFrameAxisTypes.d.ts +50 -0
- package/dist/components/stream/xySceneBuilders/types.d.ts +6 -5
- package/dist/controls.min.js +1 -1
- package/dist/controls.module.min.js +1 -1
- package/dist/forceLayoutWorker.js +1 -1
- 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 -1
- package/dist/physics-matter.module.min.js +1 -1
- package/dist/physics-rapier.min.js +1 -1
- package/dist/physics-rapier.module.min.js +1 -1
- package/dist/physics.min.js +1 -1
- package/dist/physics.module.min.js +1 -1
- package/dist/physicsWorker.js +1 -1
- package/dist/realtime.min.js +1 -1
- package/dist/realtime.module.min.js +1 -1
- package/dist/rough.min.js +1 -0
- package/dist/rough.module.min.js +1 -0
- package/dist/semiotic-ai-core.min.js +1 -1
- package/dist/semiotic-ai-core.module.min.js +1 -1
- package/dist/semiotic-ai.d.ts +3 -1
- package/dist/semiotic-ai.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-controls.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.min.js +1 -1
- package/dist/semiotic-experimental.module.min.js +1 -1
- package/dist/semiotic-geo.d.ts +4 -0
- package/dist/semiotic-network.d.ts +4 -0
- package/dist/semiotic-ordinal.d.ts +6 -0
- package/dist/semiotic-physics.d.ts +4 -0
- package/dist/semiotic-realtime-core.min.js +1 -1
- package/dist/semiotic-realtime-core.module.min.js +1 -1
- package/dist/semiotic-realtime-react.min.js +1 -1
- package/dist/semiotic-realtime-react.module.min.js +1 -1
- package/dist/semiotic-recipes-core.min.js +1 -1
- package/dist/semiotic-recipes-core.module.min.js +1 -1
- package/dist/semiotic-recipes-react.min.js +1 -1
- package/dist/semiotic-recipes-react.module.min.js +1 -1
- package/dist/semiotic-recipes.min.js +1 -1
- package/dist/semiotic-recipes.module.min.js +1 -1
- package/dist/semiotic-rough.d.ts +4 -0
- package/dist/semiotic-server-edge.min.js +1 -1
- package/dist/semiotic-server-edge.module.min.js +1 -1
- package/dist/semiotic-server-node.min.js +1 -1
- package/dist/semiotic-server-node.module.min.js +1 -1
- package/dist/semiotic-themes-core.min.js +1 -1
- package/dist/semiotic-themes-core.module.min.js +1 -1
- package/dist/semiotic-themes-react.min.js +1 -1
- package/dist/semiotic-themes-react.module.min.js +1 -1
- package/dist/semiotic-themes.min.js +1 -1
- package/dist/semiotic-themes.module.min.js +1 -1
- package/dist/semiotic-utils-core.d.ts +4 -0
- package/dist/semiotic-utils-core.min.js +1 -1
- package/dist/semiotic-utils-core.module.min.js +1 -1
- package/dist/semiotic-utils-react.min.js +1 -1
- package/dist/semiotic-utils-react.module.min.js +1 -1
- package/dist/semiotic-utils.min.js +1 -1
- package/dist/semiotic-utils.module.min.js +1 -1
- package/dist/semiotic-value.min.js +1 -1
- package/dist/semiotic-value.module.min.js +1 -1
- package/dist/semiotic-xy.d.ts +4 -0
- package/dist/semiotic.d.ts +9 -1
- package/dist/semiotic.min.js +1 -1
- package/dist/semiotic.module.min.js +1 -1
- package/dist/server.min.js +1 -1
- package/dist/server.module.min.js +1 -1
- package/dist/test-utils/capturedFrameProps.d.ts +67 -0
- package/dist/test-utils/frameMock.d.ts +12 -9
- package/dist/xy.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +29 -10
- package/dist/semiotic-ai-statisticalOverlays-CY4WKR4A.module.min.js +0 -2
- package/dist/semiotic-chunk-3FSVZ46U.module.min.js +0 -2
- package/dist/semiotic-statisticalOverlays-UOMSFKVJ.module.min.js +0 -2
- package/dist/xy-chunk-IWD6IB6V.module.min.js +0 -2
- package/dist/xy-statisticalOverlays-7RWG6LJT.module.min.js +0 -2
package/dist/ordinal.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";var e,t=Object.create,o=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,a=(e,t,i,a)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let l of r(t))s.call(e,l)||l===i||o(e,l,{get:()=>t[l],enumerable:!(a=n(t,l))||a.enumerable});return e},l=(e,n,r)=>(r=null!=e?t(i(e)):{},a(!n&&e&&e.__esModule?r:o(r,"default",{value:e,enumerable:!0}),e)),c={};((e,t)=>{for(var n in t)o(e,n,{get:t[n],enumerable:!0})})(c,{BarChart:()=>As,BoxPlot:()=>Gs,DEFAULT_HIT_RADIUS:()=>Wa,DonutChart:()=>aa,DotPlot:()=>ta,FunnelChart:()=>ka,GaugeChart:()=>ya,GroupedBarChart:()=>Rs,Histogram:()=>Ks,LikertChart:()=>Oa,OrdinalCustomChart:()=>Na,PieChart:()=>ra,RidgelinePlot:()=>va,StackedBarChart:()=>js,StreamOrdinalFrame:()=>ni,SwarmPlot:()=>Fs,SwimlaneChart:()=>Bs,ViolinPlot:()=>Us,createHatchPattern:()=>Wr,glyphExtent:()=>qe,glyphPlacement:()=>We,hitTargetPoint:()=>Ga,hitTargetRect:()=>Va,resolveResponsiveRules:()=>Ei,responsiveRuleMatches:()=>Oi,useCustomLayoutSelection:()=>He}),module.exports=(e=c,a(o({},"__esModule",{value:!0}),e));var u=require("react"),d=Object.freeze([]);function h(e){if(!e)return d;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 f=class{constructor(e,t){this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=e,this.chunkThreshold=t?.chunkThreshold??5e3,this.chunkSize=t?.chunkSize??5e3}updateChunkOptions(e){null!=e.chunkThreshold&&(this.chunkThreshold=e.chunkThreshold),null!=e.chunkSize&&(this.chunkSize=e.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(e){if(e=h(e),this.lastBoundedData===e)return;if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,totalSize:e.length});let t=this.chunkSize;const o=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const n=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,n),bounded:!1}),t=n,this.chunkTimer=e.length>t?requestAnimationFrame(o):0};this.chunkTimer=requestAnimationFrame(o)}setReplacementData(e){if(e=h(e),this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.pushBuffer=[],this.flushScheduled=!1,this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0,preserveCategoryOrder:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,preserveCategoryOrder:!0,totalSize:e.length});let t=this.chunkSize;const o=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const n=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,n),bounded:!1}),t=n,this.chunkTimer=e.length>t?requestAnimationFrame(o):0};this.chunkTimer=requestAnimationFrame(o)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const e=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:e,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(e){null!=e&&"object"==typeof e&&(this.pushBuffer.push(e),this.scheduleFlush())}pushMany(e){if(0===e.length)return;let t=0;for(let o=0;e.length>o;o++){const n=e[o];null!=n&&"object"==typeof n&&(this.pushBuffer.push(n),t++)}0!==t&&this.scheduleFlush()}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}},g=require("d3-scale"),m=class{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const o of e){const e=this.push(o);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;return{next:()=>this._size>e?{done:!1,value:this.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let o=0;this._size>o;o++)e(this.buffer[(t+o)%this._capacity],o)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let o=0;this._size>o;o++)e[o]=this.buffer[(t+o)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray();let o=0,n=[];t.length>e&&(o=t.length-e,n=t.slice(0,o)),this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(let e=o;t.length>e;e++)this.push(t[e]);return n}update(e,t){const o=[],n=(this.head-this._size+this._capacity)%this._capacity;for(let r=0;this._size>r;r++){const i=(n+r)%this._capacity,s=this.buffer[i];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:{...s},o.push(e),this.buffer[i]=t(s)}}return o}remove(e){const t=[],o=[];if(this.forEach(n=>{e(n)?o.push(n):t.push(n)}),0===o.length)return o;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return o}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}},y=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 p(e,t,o){const n=e.duration??500,r=o-t;return n>r?1-r/n:0}function b(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 v(e,t,o){return e+(t-e)*o}function x(){return"undefined"!=typeof performance?performance.now():Date.now()}function w(e,t){return e===t}function k(e,t){if("function"==typeof e)return t=>+e(t);const o=e||t;return e=>+e[o]}function S(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}function A(e){return new Set(Array.isArray(e)?e:[e])}var M=require("d3-scale");function C(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function j(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(C),o=t.length-1;return e=>{if(0>=e){const[e,o,n]=t[0];return j(e,o,n)}if(e>=1){const[e,n,r]=t[o];return j(e,n,r)}const n=e*o,r=Math.floor(n),i=n-r,[s,a,l]=t[r],[c,u,d]=t[r+1];return j(Math.round(s+(c-s)*i),Math.round(a+(u-a)*i),Math.round(l+(d-l)*i))}}var P=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],R=_(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),L=_(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),I=_(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),T=_(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),$=_(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),B=_(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),H={blues:R,reds:L,greens:I,viridis:_(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),oranges:T,purples:$,greys:B,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"])},O=_(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),E=_(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),D=_(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),F=_(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),N=_(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),z=_(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),W=_(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]),q={category10:P,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],...H},G=P,V=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],X=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 Y(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")||X.has(t)}(n)?o(n):n}const n=e?.[t]+"";return o?o(n):G[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))%G.length]}function K(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 Z(e,t,o="category10"){if(o&&"object"==typeof o&&!Array.isArray(o)){const e=o;return t=>K(e,t)??"#999"}const n=Array.from(new Set(e.map(e=>e?.[t]).filter(e=>null!=e).map(e=>e+""))),r=n.every(e=>!isNaN(Number(e)));if(Array.isArray(o))return(0,M.scaleOrdinal)().domain(n).range(o).unknown("#999");const i=q[o]||q.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:G;return(0,M.scaleOrdinal)().domain(n).range(e).unknown("#999")}}function Q(e,t,o=[3,20],n){let r;if(r="function"==typeof t?t(e):e?.[t],!n)return r;const[i,s]=n,[a,l]=o;if(s===i)return(a+l)/2;let c=(r-i)/(s-i);return 0>c?c=0:c>1&&(c=1),a+c*(l-a)}function U(e,t,o,n,r,i,s){return{type:"rect",x:e,y:t,w:o,h:n,style:r,datum:i,group:s}}var J=require("d3-shape"),ee={circle:J.symbolCircle,square:J.symbolSquare,triangle:J.symbolTriangle,diamond:J.symbolDiamond,star:J.symbolStar,cross:J.symbolCross,wye:J.symbolWye},te=["circle","triangle","diamond","star","square","chevron","cross","wye"];function oe(e,t,o){if(o)return o;const n=e??"circle";return"chevron"===n?function(e){const t=1.5*ne(e),o=.92*t;return`M0,${-t}L${o},${(.78*t).toFixed(3)}L0,${(.28*t).toFixed(3)}L${-o},${(.78*t).toFixed(3)}Z`}(t):(0,J.symbol)(ee[n]??J.symbolCircle,Math.max(1,t))()??""}function ne(e){return Math.sqrt(Math.max(1,e)/Math.PI)}function re(e){const t=e.getSymbol;if(!t)return null;const o=e.config.symbolMap,n=new Map;let r=0;return e=>{const i=t(e)+"",s=o?.[i];if(s)return s;let a=n.get(i);return a||(a=te[r%te.length],r++,n.set(i,a)),a}}function ie(e,t,o,n,r,i,s){e.push(t?{type:"symbol",x:n,y:r,size:Math.PI*i*i,symbolType:t(o),style:s,datum:o}:{type:"point",x:n,y:r,r:i,style:s,datum:o})}function se(e,t){const{columns:o,config:n,resolvePieceStyle:r}=e,i=[],s=Math.min(t.width,t.height)/2-4,a="donut"===n.chartType?n.innerRadius||60:0,l=-Math.PI/2+(n.startAngle||0)*Math.PI/180,c=null!=n.sweepAngle?n.sweepAngle*Math.PI/180:2*Math.PI,u=null!=n.sweepAngle&&360>n.sweepAngle,d=Object.values(o),h=d.some(e=>{const t=e.pieceData[0];return t&&("number"==typeof t._pct||"number"==typeof t._pctStart||null!=t._roundedEnds)}),f=u&&!h&&d.length>1&&(n.cornerRadius??0)>0;for(let e=0;d.length>e;e++){const t=d[e],o=t.pieceData[0],u="number"==typeof o?._pctStart?o._pctStart:t.pctStart,h=l+u*c,g=l+(u+("number"==typeof o?._pct?o._pct:t.pct))*c,m=r(t.pieceData[0],t.name),y=0===e,p=e===d.length-1,b={type:"wedge",cx:0,cy:0,innerRadius:a,outerRadius:s,startAngle:h,endAngle:g,...n.cornerRadius&&{cornerRadius:n.cornerRadius},style:m,datum:o?._nonInteractive?null:t.pieceData,category:t.name};o?._roundedEnds?b.roundedEnds=o._roundedEnds:f&&(b.roundedEnds={start:y,end:p}),o?._gradientBand&&(b._gradientBand=o._gradientBand),i.push(b)}return i}var ae=require("d3-array");function le(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 ce(e,t=-1/0){let o=t;for(const t of e)t>o&&(o=t);return o}function ue(e){const t=e.length,o=e[0],n=e[t-1];return{n:t,min:o,q1:(0,ae.quantile)(e,.25)??o,median:(0,ae.quantile)(e,.5)??(o+n)/2,q3:(0,ae.quantile)(e,.75)??n,max:n,mean:e.reduce((e,t)=>e+t,0)/t}}var de=require("d3-scale"),he={bar:function(e,t){const{scales:o,columns:n,config:r,getR:i,getStack:s,resolvePieceStyle:a}=e,{r:l,projection:c}=o,u=[],d="vertical"===c,h="horizontal"===c,f=r.normalize,g=[];if(s){const e=new Set;for(const t of Object.values(n))for(const o of t.pieceData){const t=s(o);e.has(t)||(e.add(t),g.push(t))}}else g.push("_default");for(const e of Object.values(n)){const t=new Map;for(const o of e.pieceData){const e=s?s(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const n=t.get(e);n.total+=i(o),n.pieces.push(o)}let o=0;if(f)for(const e of t.values())o+=Math.abs(e.total);let n=0,r=0;for(const i of g){const c=t.get(i);if(!c)continue;let g=c.total;f&&o>0&&(g/=o);const m=a(c.pieces[0],s?i:e.name),y={...c.pieces[0],__aggregateValue:c.total,__pieceCount:c.pieces.length,category:e.name};if(d){const t=l(0>g?r:n+g),o=0>g?l(r+g)-l(r):l(n)-l(n+g);u.push(U(e.x,t,e.width,Math.abs(o),m,y,i)),0>g?r+=g:n+=g}else if(h){const t=l(0>g?r+g:n),o=0>g?l(r)-l(r+g):l(n+g)-l(n);u.push(U(t,e.x,Math.abs(o),e.width,m,y,i)),0>g?r+=g:n+=g}}}const m="vertical"===c,y=r.roundedTop&&r.roundedTop>0?Math.max(0,r.roundedTop):0;for(const e of u){if("rect"!==e.type)continue;const t=e.datum?.__aggregateValue??0;e.roundedEdge=m?0>t?"bottom":"top":0>t?"left":"right",r.gradientFill&&(e.fillGradient=r.gradientFill)}if(y>0){const e=new Map;for(const t of u){if("rect"!==t.type)continue;const o=t.datum?.category||"";e.has(o)||e.set(o,[]),e.get(o).push(t)}for(const t of e.values()){if(0===t.length)continue;const e=t.filter(e=>(e.datum?.__aggregateValue??0)>=0),o=t.filter(e=>0>(e.datum?.__aggregateValue??0));e.length>0&&(e.reduce(m?(e,t)=>t.y>e.y?e:t:(e,t)=>e.x+e.w>t.x+t.w?e:t).roundedTop=y),o.length>0&&(o.reduce(m?(e,t)=>e.y+e.h>t.y+t.h?e:t:(e,t)=>t.x>e.x?e:t).roundedTop=y)}}return u},clusterbar:function(e,t){const{scales:o,columns:n,config:r,getR:i,getGroup:s,resolvePieceStyle:a}=e,{r:l,projection:c}=o,u=[],d="vertical"===c,h=[],f=new Set;for(const e of Object.values(n))for(const t of e.pieceData){const e=s?s(t):"_default";f.has(e)||(f.add(e),h.push(e))}const g=h.length||1;for(const e of Object.values(n)){const t=e.width/g,o=.2*t,n=t-o,r=new Map;for(const t of e.pieceData){const e=s?s(t):"_default";r.has(e)||r.set(e,[]),r.get(e).push(t)}for(let s=0;h.length>s;s++){const c=r.get(h[s])||[];for(const r of c){const c=i(r),f=a(r,h[s]);if(d){const i=e.x+s*t+o/2,a=l(0),d=l(c);u.push(U(i,Math.min(a,d),n,Math.abs(a-d),f,r,h[s]))}else{const i=e.x+s*t+o/2,a=l(0),d=l(c);u.push(U(Math.min(a,d),i,Math.abs(d-a),n,f,r,h[s]))}}}}const m=r.roundedTop&&r.roundedTop>0?Math.max(0,r.roundedTop):0;for(const e of u){if("rect"!==e.type)continue;if(null==e.datum)continue;const t=i(e.datum);m>0&&(e.roundedTop=m),e.roundedEdge=d?0>t?"bottom":"top":0>t?"left":"right",r.gradientFill&&(e.fillGradient=r.gradientFill)}return u},point:function(e,t){const{scales:o,columns:n,getR:r,multiScales:i,resolvePieceStyle:s}=e,{r:a,projection:l}=o,c=[],u="vertical"===l,d="radial"===l,h=i.length>0,f=re(e),g=2*Math.PI,m=-Math.PI/2;for(const e of Object.values(n))for(const t of e.pieceData){const o=t.__rIndex??0,n=t.__rValue??r(t),l=h&&i[o]||a,y=s(t,e.name),p=y.r||5;let b,v;if(d){const t=m+(e.pctStart+e.pct/2)*g,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);ie(c,f,t,b,v,p,y)}return c},swarm:function(e,t){const{scales:o,columns:n,getR:r,resolvePieceStyle:i}=e,{r:s,projection:a}=o,l=[],c="vertical"===a,u=re(e);for(const e of Object.values(n)){const t=e.width/2;for(let o=0;e.pieceData.length>o;o++){const n=e.pieceData[o],a=r(n),d=i(n,e.name),h=d.r||4,f=(7919*o%100/100-.5)*t*.8;ie(l,u,n,c?e.middle+f:s(a),c?s(a):e.middle+f,h,d)}}return l},pie:se,donut:se,boxplot:function(e,t){const{scales:o,columns:n,config:r,getR:i,resolveSummaryStyle:s}=e,{r:a,projection:l}=o,c=[],u="vertical"===l,d=!1!==r.showOutliers;for(const t of Object.values(n)){const o=t.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===o.length)continue;const n=o[0],r=o[o.length-1],l=(0,ae.quantile)(o,.25)??n,h=(0,ae.quantile)(o,.5)??(n+r)/2,f=(0,ae.quantile)(o,.75)??r,g=f-l,m=l-1.5*g,y=f+1.5*g,p=o.find(e=>e>=m)??n,b=[...o].reverse().find(e=>y>=e)??r,v=s(t.pieceData[0],t.name),x=[];if(d)for(const e of t.pieceData){const o=i(e);if(m>o||o>y){const n=u?t.middle:a(o),r=u?a(o):t.middle;x.push({px:n,py:r,value:o,datum:e})}}if(c.push({type:"boxplot",x:u?t.middle:0,y:u?0:t.middle,projection:u?"vertical":"horizontal",columnWidth:.6*t.width,minPos:a(p),q1Pos:a(l),medianPos:a(h),q3Pos:a(f),maxPos:a(b),stats:{n:o.length,min:p,q1:l,median:h,q3:f,max:b,mean:o.reduce((e,t)=>e+t,0)/o.length},style:v,datum:t.pieceData,category:t.name,outliers:x}),d)for(const t of x)c.push({type:"point",x:t.px,y:t.py,r:3,style:{fill:v.fill||e.config.themeSemantic?.secondary||"#999",opacity:.6},datum:t.datum})}return c},violin:function(e,t){const{scales:o,columns:n,config:r,getR:i,resolveSummaryStyle:s}=e,{r:a,projection:l}=o,c=[],u="vertical"===l,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=ce(l,1),g=e.width/2*.9;let m;if(u){m=`M ${e.middle} ${a(o)}`;for(let t=0;d>t;t++){const n=a(o+(t+.5)*r);m+=` L ${e.middle+l[t]/f*g} ${n}`}m+=` L ${e.middle} ${a(n)}`;for(let t=d-1;t>=0;t--){const n=a(o+(t+.5)*r);m+=` L ${e.middle-l[t]/f*g} ${n}`}m+=" Z"}else{m=`M ${a(o)} ${e.middle}`;for(let t=0;d>t;t++)m+=` L ${a(o+(t+.5)*r)} ${e.middle-l[t]/f*g}`;m+=` L ${a(n)} ${e.middle}`;for(let t=d-1;t>=0;t--)m+=` L ${a(o+(t+.5)*r)} ${e.middle+l[t]/f*g}`;m+=" Z"}const y=s(e.pieceData[0],e.name);let p;if(h&&t.length>=4){const r=(0,ae.quantile)(t,.25)??o,i=(0,ae.quantile)(t,.5)??(o+n)/2,s=(0,ae.quantile)(t,.75)??n;p={q1Pos:a(r),medianPos:a(i),q3Pos:a(s),centerPos:e.middle,isVertical:u}}const b=u?{x:e.x,y:Math.min(a(n),a(o)),width:e.width,height:Math.abs(a(n)-a(o))}:{x:Math.min(a(o),a(n)),y:e.x,width:Math.abs(a(n)-a(o)),height:e.width};c.push({type:"violin",pathString:m,translateX:0,translateY:0,bounds:b,iqrLine:p,stats:ue(t),style:y,datum:e.pieceData,category:e.name})}return c},histogram:function(e,t){const{scales:o,columns:n,config:r,getR:i,resolveSummaryStyle:s}=e,{r:a}=o,l=[],c=r.bins||25,u=r.normalize,d=a.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]=le(t),r=null!=h&&isFinite(h)?h:o,d=null!=f&&isFinite(f)?f:n,g=(d-r)/c||1,m=Array(c).fill(0);for(const e of t)r>e||e>d||m[Math.min(Math.floor((e-r)/g),c-1)]++;const y=t.length,p=ce(m,1),b=s(e.pieceData[0],e.name);for(let t=0;c>t;t++){if(0===m[t])continue;const o=(u?m[t]/y:m[t]/p)*e.width*.9,n=a(r+t*g),i=a(r+(t+1)*g);l.push(U(Math.min(n,i),e.x+e.width-o,Math.abs(i-n),o,b,{bin:t,count:m[t],range:[r+t*g,r+(t+1)*g],category:e.name},e.name))}}return l},ridgeline:function(e,t){const{scales:o,columns:n,config:r,getR:i,resolveSummaryStyle:s}=e,{r:a,projection:l}=o,c=[],u=r.bins||20,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=ce(l,1),g=s(e.pieceData[0],e.name),m=e.width*h;let y;if(d){const t=e.x+e.width;y=`M ${a(o)} ${t}`;for(let e=0;u>e;e++)y+=` L ${a(o+(e+.5)*r)} ${t-l[e]/f*m}`;y+=` L ${a(n)} ${t} Z`}else{const t=e.x;y=`M ${t} ${a(o)}`;for(let e=0;u>e;e++){const n=a(o+(e+.5)*r);y+=` L ${t+l[e]/f*m} ${n}`}y+=` L ${t} ${a(n)} Z`}const p=d?{x:Math.min(a(o),a(n)),y:e.x,width:Math.abs(a(n)-a(o)),height:e.width}:{x:e.x,y:Math.min(a(n),a(o)),width:e.width,height:Math.abs(a(n)-a(o))};c.push({type:"violin",pathString:y,translateX:0,translateY:0,bounds:p,stats:ue(t),style:{...g,fillOpacity:g.fillOpacity??.5},datum:e.pieceData,category:e.name})}return c},timeline:function(e,t){const{scales:o,columns:n,getRawRange:r,resolvePieceStyle:i}=e,{r:s,projection:a}=o,l=[],c="horizontal"===a;for(const e of Object.values(n))for(const t of e.pieceData){const o=r(t);if(!o)continue;const[n,a]=o,u=i(t,e.name);if(c){const o=s(Math.min(n,a)),r=s(Math.max(n,a));l.push(U(o,e.x,r-o,e.width,u,t,e.name))}else{const o=s(Math.max(n,a)),r=s(Math.min(n,a));l.push(U(e.x,o,e.width,r-o,u,t,e.name))}}return l},funnel:function(e,t){const{columns:o,getR:n,getStack:r,resolvePieceStyle:i}=e,s=[],a=t.width/2,l=!1!==e.config.showLabels,c=e.scales.o.domain().map(e=>o[e]).filter(Boolean);if(0===c.length)return s;const u=[],d=new Set;for(const e of c)for(const t of e.pieceData){const e=r?r(t):"_default";d.has(e)||(d.add(e),u.push(e))}const h=u.length>1&&"_default"!==u[0],f=[];let g=0;for(const e of c){const t=new Map;let o=0;for(const i of e.pieceData){const e=r?r(i):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const s=t.get(e),a=n(i);s.total+=a,s.pieces.push(i),o+=a}f.push({col:e,groups:t,stepTotal:o}),h||o>g&&(g=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>g&&(g=n)}if(0===g)return s;const m=new Map;for(const e of u){const t=f[0].groups.get(e);m.set(e,t?.total??0)}const y=f[0].stepTotal,p=h?.95*a:.9*t.width,b=(0,de.scaleLinear)().domain([0,g]).range([0,p]),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,g=n.x+(c-d)/2,p=new Map;if(h){let e=0;for(const t of u){const n=o.groups.get(t);n&&(e+=b(n.total))}let t=a,c=a;for(let h=0;u.length>h;h++){const f=u[h],y=o.groups.get(f);if(!y)continue;const v=b(y.total),x=h%2==0,w=x?t:c-v;x?t+=v:c-=v;const k=i(y.pieces[0],f),S=m.get(f)??y.total,A={...y.pieces[0],__funnelValue:y.total,__funnelPercent:S>0?y.total/S*100:0,__funnelStep:n.name,__funnelIsFirstStep:r,__aggregateValue:y.total,__pieceCount:y.pieces.length,category:f};l&&(0===h&&(A.__funnelStepLabel=n.name,A.__funnelStepLabelX=a,A.__funnelStepLabelY=g,A.__funnelRowWidth=e),A.__funnelValueLabelX=w+v/2,A.__funnelValueLabelY=g,A.__funnelBarW=v),s.push(U(w,g,v,d,k,A,f)),p.set(f,{x:w,y:g,w:v,h:d})}}else{const e=o.stepTotal,t=b(e),c=a-t/2,h=u[0],f="_default"!==h,m=o.groups.get(h)?.pieces[0]??n.pieceData[0],v=f?h:n.name,x=i(m,v),w=y>0?e/y*100:0,k={...m,__funnelValue:e,__funnelPercent:w,__funnelStep:n.name,__funnelIsFirstStep:r,category:f?h:n.name};l&&(k.__funnelStepLabel=n.name,k.__funnelStepLabelX=a,k.__funnelStepLabelY=g,k.__funnelRowWidth=t,k.__funnelValueLabelX=a,k.__funnelValueLabelY=g,k.__funnelBarW=t),s.push(U(c,g,t,d,x,k,v)),p.set(h,{x:c,y:g,w:t,h:d})}if(t>0&&x.size>0){const t=h?u:[u[0]];for(const r of t){const t=x.get(r),a=p.get(r);if(!t||!a)continue;const l=(()=>{const e=o.groups.get(r);return i(e?e.pieces[0]:n.pieceData[0],"_default"===r?n.name:r)})(),c={type:"trapezoid",points:[[t.x,t.y+t.h],[t.x+t.w,t.y+t.h],[a.x+a.w,a.y],[a.x,a.y]],style:{fill:l.fill||e.config.themeSemantic?.secondary||"#999",opacity:v},datum:o.groups.get(r)?.pieces[0]??n.pieceData[0],category:"_default"===r?n.name:r};s.push(c)}}x=p}return s},"bar-funnel":function(e,t){const{columns:o,getR:n,getStack:r,resolvePieceStyle:i,scales:s}=e,a=[],l=s.o.domain().map(e=>o[e]).filter(Boolean);if(0===l.length)return a;const c=[],u=new Set;for(const e of l)for(const t of e.pieceData){const e=r?r(t):"_default";u.has(e)||(u.add(e),c.push(e))}const d=c.length>1&&"_default"!==c[0],h=[];for(const e of l){const t=new Map;let o=0;for(const i of e.pieceData){const e=r?r(i):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const s=t.get(e),a=n(i);s.total+=a,s.pieces.push(i),o+=a}h.push({col:e,groups:t,stepTotal:o})}const f=new Map;for(const e of c){const t=h[0]?.groups.get(e);f.set(e,t?.total??0)}const g=s.r,m=d?c.length:1,y=d?.15:0;for(let e=0;h.length>e;e++){const t=h[e],o=t.col,n=0===e,r=e>0?h[e-1]:null,s=o.width/m,l=s*y,u=s-l;for(let e=0;c.length>e;e++){const h=c[e],m=t.groups.get(h);if(!m)continue;const y=m.total,p=f.get(h)??y,b=p>0?y/p*100:0,v=r?.groups.get(h),x=n?0:Math.max(0,(v?.total??y)-y),w=o.x+e*s+l/2,k=g(y),S=g(0)-k,A=i(m.pieces[0],d?h:o.name),M={...m.pieces[0],__barFunnelValue:y,__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:g(y+x)};if(a.push(U(w,k,u,S,A,M,d?h:o.name)),x>0){const e=g(y+x),t=k-e,n={...A},r={...m.pieces[0],__barFunnelValue:x,__barFunnelPercent:p>0?x/p*100:0,__barFunnelIsFirstStep:!1,__barFunnelIsDropoff:!0,__barFunnelStep:o.name,__barFunnelCategory:"_default"===h?void 0:h,category:d?h:o.name};a.push(U(w,e,u,t,n,r,d?h:o.name))}}}return a},swimlane:function(e,t){const{scales:o,columns:n,getR:r,getStack:i,resolvePieceStyle:s}=e,{r:a,projection:l}=o,c=[],u="horizontal"===l,d=e.config.gradientFill,h=u?"left":"bottom",f=e.config.trackFill;if(f){const e="string"==typeof f?f:f.color,t="string"==typeof f?1:f.opacity??1,[o,r]=a.range(),i=Math.min(o,r),s=Math.abs(r-o);for(const o of Object.values(n)){const n={fill:e,opacity:t},r=u?U(i,o.x,s,o.width,n,null,"__track__"):U(o.x,i,o.width,s,n,null,"__track__");c.push(r)}}const g=e.config.roundedTop&&e.config.roundedTop>0?Math.max(0,e.config.roundedTop):0;for(const e of Object.values(n)){let t=0;const o=c.length;for(const o of e.pieceData){const n=Math.abs(r(o));if(0===n)continue;const l=i?i(o):e.name,f=s(o,l);let g;if(u){const r=a(t),i=a(t+n);g=U(r,e.x,i-r,e.width,f,o,l)}else{const r=a(t+n),i=a(t);g=U(e.x,r,e.width,i-r,f,o,l)}d&&(g.fillGradient=d,g.roundedEdge=h),c.push(g),t+=n}if(g>0&&c.length>o){const e=c.slice(o),t=e[0],n=e[e.length-1];1===e.length?t.cornerRadii={tl:g,tr:g,br:g,bl:g}:u?(t.cornerRadii={tl:g,bl:g},n.cornerRadii={tr:g,br:g}):(t.cornerRadii={bl:g,br:g},n.cornerRadii={tl:g,tr:g})}}return c}};function fe(e,t){const o=t&&"object"==typeof t&&!Array.isArray(t)?t:void 0;return 0===e.length?e=>o&&K(o,e)||"#4e79a7":t=>{if(o){const e=K(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 ge(e){return null!=e&&!1!==e&&""!==e&&(!Array.isArray(e)||e.some(ge))}function me(e,t,o){e.has(t)||(e.add(t),console.warn(o))}function ye(e,t,o,n){const r=e.push(t);return o&&o.push(n),r}var pe={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 be(e,t){const o={...e};for(const e of t)o[pe[e]]++;return o}function ve(e,t,o){const n=new Set(t);return{changeSet:{...e,...e.keys?{keys:[...e.keys]}:{}},changed:n,revisions:be(o,n)}}var xe=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=ve({kind:"initialize"},[],this.revisions)}get last(){return this.latest}record(e,t){const o=ve(e,t,this.revisions);return this.revisions=o.revisions,this.latest=o,o}},we=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],ke=["scene-style","data-paint","accessibility","evidence"],Se=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Ae=new Set(["accessorRevision","axisExtent","categoryAccessor","chartType","extentPadding","groupBy","multiAxis","normalize","oAccessor","oExtent","oSort","rAccessor","rExtent","runtimeMode","stackBy","timeAccessor","valueAccessor"]),Me=new Set(["barColors","colorScheme","connectorStyle","pieceStyle","summaryStyle","themeCategorical","themeDiverging","themeSemantic","themeSequential"]),Ce=class{constructor(){this.tracker=new xe}get last(){return this.tracker.last}recordData(e,t){return this.tracker.record({kind:e,...void 0===t?{}:{count:t}},we)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},ke):this.recordNoop("restyle")}recordConfig(e){if(0===e.length)return this.tracker.record({kind:"config",keys:e},[]);const t=new Set(Se);return e.some(e=>Ae.has(e))&&t.add("domain"),e.some(e=>Me.has(e))&&t.add("scene-style"),this.tracker.record({kind:"config",keys:e},t)}};var je=require("d3-quadtree"),_e=class{constructor(e){this.rExtent=new y,this.rExtents=[],this.windowSizeWarned=!1,this.updateResults=new Ce,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 m(e.windowSize),this.getO=S(e.categoryAccessor||e.oAccessor,"category");const t=e.valueAccessor||e.rAccessor;Array.isArray(t)?(this.rAccessors=t.map(e=>k(e,"value")),this.getR=this.rAccessors[0],this.rExtents=t.map(()=>new y)):(this.getR=k(t,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=S(e.stackBy),this.getGroup=S(e.groupBy),this.getColor=S(e.colorAccessor),this.getSymbol=S(e.symbolAccessor),this.getConnector=S(e.connectorAccessor),this.getDataId=S(e.dataIdAccessor),e.pulse&&(this.timestampBuffer=new m(e.windowSize))}syncPulseTimestampBuffer(){var e,t,o,n;this.timestampBuffer=(e=!!this.config.pulse,t=this.buffer,o=this.timestampBuffer,n=x(),e?null!=o&&o.capacity===t.capacity&&o.size===t.size?o:function(e,t){const o=new m(e.capacity);return e.forEach(()=>o.push(t)),o}(t,n):null)}ingest(e){const t=x();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)ye(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=ye(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 s=this.getBufferArray(),a=t.projection||"vertical",l=t.oExtent||this.resolveCategories(s),c=this.computeValueDomain(s,l),u="horizontal"===a,d="radial"===a,h=Math.min(.9,Math.max(0,null!=t.barPadding?t.barPadding/("vertical"===a?e.width:e.height):.1));let f,m;if(d){f=(0,g.scaleBand)().domain(l).range([0,1]).padding(0);const o=Math.min(e.width,e.height)/2,n=t.innerRadius||0;m=(0,g.scaleLinear)().domain(c).range([n,o])}else u?(f=(0,g.scaleBand)().domain(l).range([0,e.height]).padding(h),m=(0,g.scaleLinear)().domain(c).range([0,e.width])):(f=(0,g.scaleBand)().domain(l).range([0,e.width]).padding(h),m=(0,g.scaleLinear)().domain(c).range([e.height,0]));this.scales={o:f,r:m,projection:a},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((n,r)=>{const i=this.rExtents[r];i.dirty&&i.recalculate(o,n);let[s,a]=i.extent;s===1/0&&(s=0,a=1);const l=a-s,c=l>0?l*(t.extentPadding??.05):1;return s-=c,a+=c,s>0&&(s=0),u?(0,g.scaleLinear)().domain([s,a]).range([0,e.width]):(0,g.scaleLinear)().domain([s,a]).range([e.height,0])}):[];let y=s;this.rAccessors.length>1&&(y=s.flatMap(e=>this.rAccessors.map((t,o)=>({...e,__rIndex:o,__rValue:t(e),__rName:this.resolveRAccessorName(o)})))),this.columns=this.buildColumns(y,l,f,a,e),this._customLayoutFailedThisBuild=!1;const p=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=p,this.rebuildPointQuadtree(),this.config.decay&&this.applyDecay(this.scene,s),this.config.pulse&&this.applyPulse(this.scene,s),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&this.prevPositionMap.size>0&&this.startTransition(),this.version++)}resolveRAccessorName(e){const t=this.config.valueAccessor||this.config.rAccessor,o=Array.isArray(t)?t[e]:t;return"string"==typeof o?o:"value"+e}resolveCategories(e){const t=this.config.oSort,o="streaming"===this.config.runtimeMode||this._hasStreamingData,n="auto"===t?void 0:t;let r=null;if(o){r=new Set;for(const t of e)r.add(this.getO(t))}const i=r?Array.from(this.categories).filter(e=>r.has(e)):Array.from(this.categories);if(o&&void 0===n){const e=Math.max(50,3*r.size);if(this.categories.size>e){let t=this.categories.size-e;for(const e of this.categories){if(0>=t)break;r.has(e)||(this.categories.delete(e),t--)}}return i}if(!1===n)return i;if("function"==typeof n)return i.sort(n);const s=new Map;for(const t of e){const e=this.getO(t);s.set(e,(s.get(e)||0)+Math.abs(this.getR(t)))}return i.sort("asc"===n?(e,t)=>(s.get(e)||0)-(s.get(t)||0):(e,t)=>(s.get(t)||0)-(s.get(e)||0))}computeValueDomain(e,t){return function(e){const{data:t,chartType:o,projection:n,normalize:r,rExtent:i,extentPadding:s=.05,baselinePadding:a,axisExtent:l,getO:c,getR:u,getStack:d,rawRExtent:h}=e,f=s;if("radial"===n&&("pie"===o||"donut"===o))return[0,1];let g=0,m=0;if("bar"===o&&d&&r)g=0,m=1;else if("bar"===o&&d){const e=new Map,o=new Map;for(const n of t){const t=c(n),r=u(n);0>r?o.set(t,(o.get(t)||0)+r):e.set(t,(e.get(t)||0)+r)}for(const t of e.values())t>m&&(m=t);for(const e of o.values())g>e&&(g=e)}else if("bar"===o){const e=new Map;for(const o of t){const t=c(o),n=u(o);e.set(t,(e.get(t)||0)+n)}for(const t of e.values())t>m&&(m=t),g>t&&(g=t)}else if("swimlane"===o){const e=new Map;for(const o of t){const t=c(o),n=Math.abs(u(o));e.set(t,(e.get(t)||0)+n)}for(const t of e.values())t>m&&(m=t)}else if("clusterbar"===o||"bar-funnel"===o)for(const e of t){const t=u(e);t>m&&(m=t),g>t&&(g=t)}else{const e=h[0],t=h[1];e!==1/0&&(g=e),t!==-1/0&&(m=t)}i&&(null!=i[0]&&(g=i[0]),null!=i[1]&&(m=i[1]));const y="bar"===o||"clusterbar"===o||"bar-funnel"===o||"swimlane"===o;if(y&&null==i?.[0]&&null==i?.[1]&&(g>0&&(g=0),0>m&&(m=0)),"bar-funnel"!==o&&"exact"!==l){const e=m-g,t=e>0?e*f:1,n=y&&!a&&0===g,r=y&&!a&&0===m||"swimlane"===o;null!=i?.[0]||n||(g-=t),null!=i?.[1]||r||(m+=t)}return[g,m]}({data:e,chartType:this.config.chartType,projection:this.config.projection,normalize:this.config.normalize,rExtent:this.config.rExtent,extentPadding:this.config.extentPadding,baselinePadding:this.config.baselinePadding,axisExtent:this.config.axisExtent,getO:this.getO,getR:this.getR,getStack:this.getStack,rawRExtent:this.rExtent.extent})}buildColumns(e,t,o,n,r){return function(e){const{data:t,oExtent:o,oScale:n,projection:r,layout:i,dynamicColumnWidth:s,getO:a,getR:l}=e,c={},u=new Map;for(const e of t){const t=a(e);u.has(t)||u.set(t,[]),u.get(t).push(e)}let d=0;if("radial"===r)for(const e of t)d+=Math.abs(l(e));let h=null;if(s&&"radial"!==r){h=new Map;let e=0;for(const t of o){const o=u.get(t)||[];let n;n="string"==typeof s?o.reduce((e,t)=>e+(Number(t[s])||0),0):s(o),h.set(t,n),e+=n}const t=("horizontal"===r?i.height:i.width)-n.padding()*n.step()*o.length;if(e>0)for(const[o,n]of h)h.set(o,n/e*t)}let f=0,g=0;for(const e of o){const t=u.get(e)||[],o=t.reduce((e,t)=>e+Math.abs(l(t)),0),r=d>0?o/d:0;let i,s;h?(i=g,s=h.get(e)||n.bandwidth(),g+=s+n.padding()*n.step()):(i=n(e)??0,s=n.bandwidth()),c[e]={name:e,x:i,y:0,width:s,middle:i+s/2,padding:n.padding()*n.step(),pieceData:t,pct:r,pctStart:f},f+=r}return c}({data:e,oExtent:t,oScale:o,projection:n,layout:r,dynamicColumnWidth:this.config.dynamicColumnWidth,getO:this.getO,getR:this.getR})}getSceneContext(){return{scales:this.scales,columns:this.columns,config:this.config,getR:this.getR,getStack:this.getStack,getGroup:this.getGroup,getColor:this.getColor,getSymbol:this.getSymbol,getConnector:this.getConnector,getO:this.getO,multiScales:this.multiScales,rAccessors:this.rAccessors,resolvePieceStyle:(e,t)=>this.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;ge(n)&&0===o.length&&me(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)&&me(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=he[this.config.chartType];let r=n?n(o,t):[];if(this.getConnector&&this.scales){const e=function(e,t){const{scales:o,config:n,getConnector:r,getO:i}=e;if(!r||!o)return[];const s=[],{projection:a}=o,l=new Map;for(const e of t){if("point"!==e.type&&"rect"!==e.type)continue;const t=e.datum;if(!t)continue;const o=r(t);if(!o)continue;let n,s;"point"===e.type?(n=e.x,s=e.y):(n=e.x+e.w/2,s=e.y+("vertical"===a?0:e.h/2)),l.has(o)||l.set(o,[]),l.get(o).push({x:n,y:s,datum:t,category:i(t)})}const c=o.o.domain(),u=n.connectorStyle;for(const[t,o]of l)if(o.length>=2){o.sort((e,t)=>c.indexOf(e.category)-c.indexOf(t.category));for(let n=0;o.length-1>n;n++){const r=o[n],i=o[n+1],a="function"==typeof u?u(r.datum):u||{stroke:e.config.themeSemantic?.border||e.config.themeSemantic?.secondary||"#999",strokeWidth:1,opacity:.5};s.push({type:"connector",x1:r.x,y1:r.y,x2:i.x,y2:i.y,style:a,datum:r.datum,group:t})}}return s}(o,r);r=[...e,...r]}return r}buildLayoutContext(e,t){const o=this.config,n=o.layoutMargin??{top:0,right:0,bottom:0,left:0},r=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=q[e];if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:o}(o.colorScheme,o.themeCategorical,V),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:fe(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||V,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 s=e[i],a=o?t(s):s[n],l=r.get(a);l?l.push(i):r.set(a,[i])}return r}(e,this.config.categoryAccessor||this.config.oAccessor);return this._categoryIndexCache={version:this._dataVersion,map:t},t}rebuildPointQuadtree(){const e=function(e){let t=0,o=0;for(const n of e)"point"===n.type&&(t++,n.r>o&&(o=n.r));if(500>=t)return{quadtree:null,maxRadius:o};const n=Array(t);let r=0;for(const t of e)"point"===t.type&&(n[r++]=t);return{maxRadius:o,quadtree:(0,je.quadtree)().x(e=>e.x).y(e=>e.y).addAll(n)}}(this.scene);this._pointQuadtree=e.quadtree,this._maxPointRadius=e.maxRadius}get pointQuadtree(){return this._pointQuadtree}get maxPointRadius(){return this._maxPointRadius}applyDecay(e,t){if(!this.config.decay)return;const o=t.length;if(1>=o)return;const n=this.getDatumIndexMap(t);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;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=x()){return!(!this.config.pulse||!this.timestampBuffer)&&function(e,t,o,n,r,i){const s=e.color??"rgba(255,255,255,0.6)",a=e.glowRadius??4;let l=!1;for(const c of t){if("connector"===c.type||"violin"===c.type||"boxplot"===c.type)continue;if("wedge"===c.type){const t=c.category;if(!t)continue;let n=0;for(const s of r(t)??[]){const t=o.get(s);null!=t&&(n=Math.max(n,p(e,t,i)))}l=b(c,n,s)||l;continue}if(null==c.datum)continue;const t=n.get(c.datum);if(null==t)continue;const u=o.get(t);l=b(c,null==u?0:p(e,u,i),s,a)||l}return l}(this.config.pulse,e,this.timestampBuffer,this.getDatumIndexMap(t),e=>this.getCategoryIndexMap(t).get(e),o)}refreshPulse(e){return!0!==this.lastCustomLayoutFailure?.preservedLastGoodScene&&this.applyPulse(this.scene,this.getBufferArray(),e)}hasActivePulsesAt(e){return!!this.config.pulse&&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(x())}synthesizeIntroPositions(){this.prevPositionMap.clear();const e=new Map,t=this.scales?.r(0)??0,o="horizontal"!==this.scales?.projection;let n;for(let r=0;this.scene.length>r;r++){const i=this.scene[r],s=this.getNodeKey(i,e);s&&("rect"===i.type?this.prevPositionMap.set(s,o?{x:i.x,y:t,w:i.w,h:0,opacity:i.style.opacity??1}:{x:t,y:i.y,w:0,h:i.h,opacity:i.style.opacity??1}):"point"===i.type?this.prevPositionMap.set(s,{x:i.x,y:i.y,r:0,opacity:0}):"wedge"===i.type&&(void 0===n&&(n=i.startAngle),this.prevPositionMap.set(s,{x:i.cx,y:i.cy,startAngle:n,endAngle:n,innerRadius:i.innerRadius,outerRadius:i.outerRadius,opacity:0})))}}getNodeKey(e,t){if("point"===e.type){const o=`p:${e.datum?this.getO(e.datum):""}:${e.datum?this.getR(e.datum):0}`,n=t.get(o)||0;return t.set(o,n+1),`${o}:${n}`}return"rect"===e.type?`r:${e.group||""}:${e.datum?.category??""}`:"wedge"===e.type?"w:"+(e.category??""):null}snapshotPositions(){this.prevPositionMap.clear();const e=new Map;for(let t=0;this.scene.length>t;t++){const o=this.scene[t],n=this.getNodeKey(o,e);n&&("point"===o.type?this.prevPositionMap.set(n,{x:o.x,y:o.y,r:o.r,opacity:o.style.opacity}):"rect"===o.type?this.prevPositionMap.set(n,{x:o.x,y:o.y,w:o.w,h:o.h,opacity:o.style.opacity}):"wedge"===o.type&&this.prevPositionMap.set(n,{x:o.cx,y:o.cy,startAngle:o.startAngle,endAngle:o.endAngle,innerRadius:o.innerRadius,outerRadius:o.outerRadius,opacity:o.style.opacity??1}))}}startTransition(){if(!this.config.transition||0===this.prevPositionMap.size)return;const e=this.config.transition.duration??300;if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}let t=!1;const o=new Set,n=new Map;for(let e=0;this.scene.length>e;e++){const r=this.scene[e],i=this.getNodeKey(r,n);if(!i)continue;r._transitionKey=i;const s=this.prevPositionMap.get(i);if("point"===r.type)s?(o.add(i),r._targetOpacity=r.style.opacity??1,(s.x!==r.x||s.y!==r.y||void 0!==s.r&&s.r!==r.r)&&(r._targetX=r.x,r._targetY=r.y,r._targetR=r.r,r.x=s.x,r.y=s.y,void 0!==s.r&&(r.r=s.r),t=!0)):(r._targetOpacity=r.style.opacity??1,r._targetR=r.r,r.r=0,r.style={...r.style,opacity:0},t=!0);else if("rect"===r.type)s?(o.add(i),r._targetOpacity=r.style.opacity??1,s.x===r.x&&s.y===r.y&&s.w===r.w&&s.h===r.h||(r._targetX=r.x,r._targetY=r.y,r._targetW=r.w,r._targetH=r.h,r.x=s.x,r.y=s.y,r.w=s.w??r.w,r.h=s.h??r.h,t=!0)):(r._targetOpacity=r.style.opacity??1,r.style={...r.style,opacity:0},t=!0);else if("wedge"===r.type)if(s)o.add(i),r._targetOpacity=r.style.opacity??1,s.startAngle===r.startAngle&&s.endAngle===r.endAngle||(r._targetStartAngle=r.startAngle,r._targetEndAngle=r.endAngle,r.startAngle=s.startAngle,r.endAngle=s.endAngle,t=!0);else{r._targetOpacity=r.style.opacity??1,r._targetStartAngle=r.startAngle,r._targetEndAngle=r.endAngle;const e=r.startAngle;r.startAngle=e,r.endAngle=e,r.style={...r.style,opacity:0},this.prevPositionMap.set(i,{x:r.cx,y:r.cy,startAngle:e,endAngle:e,innerRadius:r.innerRadius,outerRadius:r.outerRadius,opacity:0}),t=!0}}this.exitNodes=[];for(const[e,n]of this.prevPositionMap)if(!o.has(e)){if(e.startsWith("p:"))this.exitNodes.push({type:"point",x:n.x,y:n.y,r:n.r??3,style:{opacity:n.opacity??1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("r:"))this.exitNodes.push({type:"rect",x:n.x,y:n.y,w:n.w??0,h:n.h??0,style:{opacity:n.opacity??1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("w:")){const t=((n.startAngle??0)+(n.endAngle??0))/2,o={type:"wedge",cx:n.x,cy:n.y,innerRadius:n.innerRadius??0,outerRadius:n.outerRadius??100,startAngle:n.startAngle??0,endAngle:n.endAngle??0,style:{opacity:n.opacity??1},datum:null,category:e.slice(2),_targetStartAngle:t,_targetEndAngle:t,_targetOpacity:0,_transitionKey:e};this.exitNodes.push(o)}t=!0}this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),t&&(this.activeTransition={startTime:x(),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=v(n?n.opacity??1:0,e._targetOpacity,o)}const n=this.prevPositionMap.get(t);void 0!==e._targetX&&n&&(e.x=v(n.x,e._targetX,o),e.y=v(n.y,e._targetY,o)),void 0!==e._targetR&&void 0!==n?.r&&(e.r=v(n.r,e._targetR,o))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t);e.style.opacity=v(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=v(n.x,e._targetX,o),e.y=v(n.y,e._targetY,o),void 0!==n.w&&(e.w=v(n.w,e._targetW,o),e.h=v(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:v(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=v(n.startAngle,e._targetStartAngle,o),e.endAngle=v(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=A(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=x(),this.updateResults.recordData("remove",r.length),r}update(e,t){if(!this.getDataId)throw Error("update() requires dataIdAccessor to be configured");const o=A(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=x(),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&&!w(e.colorAccessor,t.colorAccessor))&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),("categoryAccessor"in e&&!w(e.categoryAccessor,t.categoryAccessor)||"oAccessor"in e&&!w(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)&&(w(this.config.categoryAccessor||this.config.oAccessor,t.categoryAccessor||t.oAccessor)||(this.getO=S(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)=>!w(e,i[t])),r){const e=this.config.valueAccessor||this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>k(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new y)):(this.getR=k(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!w(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?S(this.config.stackBy):void 0),"groupBy"in e&&!w(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?S(this.config.groupBy):void 0),"colorAccessor"in e&&!w(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?S(this.config.colorAccessor):void 0),"symbolAccessor"in e&&!w(e.symbolAccessor,t.symbolAccessor)&&(this.getSymbol=null!=this.config.symbolAccessor?S(this.config.symbolAccessor):void 0),"connectorAccessor"in e&&!w(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?S(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}},Pe=l(require("react"));function Re(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:Pe.createElement(Pe.Fragment,null,...t)}var Le=l(require("react")),Ie=require("react/jsx-runtime"),Te={isActive:!1,predicate:()=>!0},$e=Le.createContext(null);function Be({value:e,children:t}){return(0,Ie.jsx)($e.Provider,{value:e,children:t})}function He(){return Le.useContext($e)??Te}function Oe(e,t){return null!=e?(0,Ie.jsx)(Be,{value:t,children:e}):e}var Ee=require("react");function De(e,t=30){return Math.max((e??4)+5,12,t)}function Fe(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}var Ne=[40,40],ze=[.5,.5];function We(e,t){const[o,n]=e.viewBox??Ne,[r,i]=e.anchor??ze,s=n>0?n:1,a=Math.max(0,t)/s,l=(o>0?o:s)*a,c=s*a;return{width:l,height:c,scale:a,offsetX:-r*l,offsetY:-i*c}}function qe(e,t){const o=We(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 Ge(e,t,o,n){if("none"!==e)return"color"===e||null==e?t??n:"accent"===e?o:e}var Ve=null;function Xe(e){if("undefined"==typeof Path2D)return null;Ve||(Ve=new Map);const t=Ve.get(e);if(t)return t;const o=new Path2D(e);return Ve.size>1024&&Ve.clear(),Ve.set(e,o),o}function Ye(e,t,o=0,n="horizontal"){const[r,i]=e.viewBox??Ne,s=Math.min(1,Math.max(0,o)),a=Math.min(1,Math.max(0,t));return a>s?s>0||1>a?"vertical"===n?{x:0,y:i*(1-a),width:r,height:i*(a-s)}:{x:r*s,y:0,width:r*(a-s),height:i}:null:{x:0,y:0,width:0,height:0}}function Ke(e,t){const o=We(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 Ze(e,t,o,n,r,i=e=>e){for(const s of t.parts){const t=Xe(s.d);if(!t)continue;const a=s.opacity??1,l=e.globalAlpha;1!==a&&(e.globalAlpha=l*a);const c=r?"none"===s.fill?void 0:r:Ge(s.fill,o,n);c&&(e.fillStyle=i(c),e.fill(t));const u=r?s.stroke&&"none"!==s.stroke?r:void 0:Ge(s.stroke??"none",o,n);u&&(e.strokeStyle=i(u),e.lineWidth=s.strokeWidth??1,e.lineCap=s.strokeLinecap??"butt",e.lineJoin=s.strokeLinejoin??"miter",e.stroke(t)),1!==a&&(e.globalAlpha=l)}}function Qe(e,t,o,n=30,r,i=0){let s=null;if(r){const e=function(e,t,o,n,r,i=e=>e.x,s=e=>e.y,a=e=>e.r){const l=Math.max(n,r+5,12),c=t-l,u=t+l,d=o-l,h=o+l;let f=null,g=1/0;return e.visit((e,r,l,m,y)=>{if(r>u||c>m||l>h||d>y)return!0;if(!e.length){let r=e;do{const e=r.data,l=i(e)-t,c=s(e)-o,u=Math.sqrt(l*l+c*c);De(a(e),n)>=u&&g>u&&(f=e,g=u),r=r.next}while(r)}return!1}),f?{node:f,distance:g}:null}(r,t,o,n,i);e&&(s={datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const i of e){let e=null;switch(i.type){case"rect":if(null==i.datum)break;e=Ue(i,t,o);break;case"point":if(r)break;e=Je(i,t,o,n);break;case"symbol":e=et(i,t,o,n);break;case"glyph":e=tt(i,t,o,n);break;case"wedge":if(null===i.datum)break;e=ot(i,t,o);break;case"boxplot":e=nt(i,t,o);break;case"violin":e=rt(i,t,o)}e&&n>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}function Ue(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 Je(e,t,o,n=30){const r=t-e.x,i=o-e.y,s=Math.sqrt(r*r+i*i);return s>De(e.r,n)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function et(e,t,o,n=30){const r=t-e.x,i=o-e.y,s=Math.sqrt(r*r+i*i);return s>De(ne(e.size),n)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function tt(e,t,o,n=30){if(null==e.datum)return null;const r=Ke(e.glyph,e.size),i=e.x+r.centerDx,s=e.y+r.centerDy,a=t-i,l=o-s,c=Math.sqrt(a*a+l*l);return c>De(r.radius,n)?null:{datum:e.datum,x:i,y:s,distance:c}}function ot(e,t,o){const n=t-e.cx,r=o-e.cy,i=Math.sqrt(n*n+r*r);if(e.innerRadius>i||i>e.outerRadius)return null;const s=Fe(Math.atan2(r,n)),a=Fe(e.startAngle),l=Fe(e.endAngle);if(!(a>l?s>=a||l>=s:s>=a&&l>=s))return null;const c=(e.startAngle+e.endAngle)/2,u=(e.innerRadius+e.outerRadius)/2;return{datum:e.datum,x:e.cx+Math.cos(c)*u,y:e.cy+Math.sin(c)*u,distance:0,category:e.category}}function nt(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 rt(e,t,o){if(!e.bounds)return null;const{x:n,y:r,width:i,height:s}=e.bounds;return n>t||t>n+i||r>o||o>r+s?null:{datum:e.datum,x:n+i/2,y:r+s/2,distance:0,category:e.category,stats:e.stats}}function it(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 st(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}var at=require("react"),lt={fresh:1,aging:.7,stale:.45,expired:.25},ct={alpha:1,band:"fresh",isStale:!1};var ut=require("react/jsx-runtime");function dt({isStale:e,position:t}){return(0,ut.jsx)("div",{className:"stream-staleness-badge",style:{position:"absolute",..."top-left"===t?{top:4,left:4}:"bottom-left"===t?{bottom:4,left:4}:"bottom-right"===t?{bottom:4,right:4}:{top:4,right:4},padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",zIndex:3,background:e?"#dc3545":"#28a745",color:"white"},children:e?"STALE":"LIVE"})}var ht=require("react"),ft=l(require("react")),gt=require("react/jsx-runtime"),mt={fill:(e,t)=>(0,gt.jsx)("rect",{style:e,width:t,height:t}),line:(e,t)=>(0,gt.jsx)("line",{style:e,x1:0,y1:0,x2:t,y2:t})};function yt(e,t,o,n,r){let i;return i="function"==typeof o?o(e):(0,mt[o])(n(e,t),r),i}function pt({swatchSize:e}){return(0,gt.jsx)("path",{d:`M${.25*e},${.55*e} L${.45*e},${.75*e} L${.8*e},${.3*e}`,fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function bt(e,t,o){return o&&o.size>0?o.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}var vt=(e,t,o,n,r,i,s,a,l,c,u)=>{const{type:d="fill",styleFn:h,items:f}=e,g=[];let m=0;const y=!(!t&&!o),p="isolate"===c||void 0===c&&null!=r,{swatchSize:b,labelGap:v,rowHeight:x}=u;return f.forEach((e,c)=>{const u=yt(e,c,d,h,b),w=bt(e,n,r),k=r&&r.size>0&&r.has(e.label);g.push((0,gt.jsxs)("g",{transform:`translate(0,${m})`,onClick:t?()=>t(e):void 0,onMouseEnter:o?()=>o(e):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:y?a===i&&c===s?0:-1:void 0,role:y?"option":void 0,"aria-selected":y&&p?k||!1:void 0,"aria-current":y&&!p&&null!=n&&e.label===n||void 0,"aria-label":e.label,onKeyDown:y?o=>{if("Enter"!==o.key&&" "!==o.key||(o.preventDefault(),t&&t(e)),"ArrowDown"===o.key||"ArrowUp"===o.key){o.preventDefault();const e=(c+("ArrowDown"===o.key?1:-1)+f.length)%f.length;l(a,e);const t=o.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:y?t=>{l(a,c),o&&o(e);const n=t.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:y?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:y?"pointer":"default",opacity:w,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[y&&(0,gt.jsx)("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:b+v+2+7*e.label.length,height:b+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),u,k&&(0,gt.jsx)(pt,{swatchSize:b}),(0,gt.jsx)("text",{y:b/2,x:b+v,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+c)),m+=x}),g};function xt({config:e,orientation:t="vertical",width:o=100}){const{colorFn:n,domain:r,label:i,format:s}=e,a=s||(e=>Math.round(100*e)/100+""),l="grad-legend-"+ft.useId();if("horizontal"===t){const e=12,t=Math.min(o,200),s=Math.max(0,(o-t)/2),c=[];for(let e=0;64>=e;e++){const t=e/64;c.push((0,gt.jsx)("stop",{offset:100*t+"%",stopColor:n(r[0]+t*(r[1]-r[0]))},e))}return(0,gt.jsxs)("g",{"aria-label":i||"Gradient legend",children:[(0,gt.jsx)("defs",{children:(0,gt.jsx)("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),i&&(0,gt.jsx)("text",{x:s+t/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),(0,gt.jsx)("rect",{x:s,y:0,width:t,height:e,fill:`url(#${l})`,rx:2}),(0,gt.jsx)("text",{x:s,y:e+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[0])}),(0,gt.jsx)("text",{x:s+t,y:e+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[1])})]})}const c=[];for(let e=0;64>=e;e++){const t=e/64;c.push((0,gt.jsx)("stop",{offset:100*t+"%",stopColor:n(r[1]-t*(r[1]-r[0]))},e))}return(0,gt.jsxs)("g",{"aria-label":i||"Gradient legend",children:[i&&(0,gt.jsx)("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),(0,gt.jsx)("defs",{children:(0,gt.jsx)("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:c})}),(0,gt.jsx)("rect",{x:0,y:0,width:14,height:100,fill:`url(#${l})`,rx:2}),(0,gt.jsx)("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[1])}),(0,gt.jsx)("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[0])})]})}function wt(e){const{legendGroups:t,customClickBehavior:o,customHoverBehavior:n,highlightedCategory:r,isolatedCategories:i,legendInteraction:s,title:a="Legend",width:l=100,height:c=20,orientation:u="vertical",legendLayout:d}=e,h=function(e){const t=Math.max(1,e?.swatchSize??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,g]=ft.useState(0),[m,y]=ft.useState(0),p=ft.useCallback((e,t)=>{g(e),y(t)},[]),b="vertical"===u?(({legendGroups:e,width:t,customClickBehavior:o,customHoverBehavior:n,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:s,focusedItemIndex:a,onFocusedIndexChange:l,legendInteraction:c,metrics:u})=>{let d=24;const h=[];return e.forEach((e,f)=>{d+=5,h.push((0,gt.jsx)("line",{stroke:"gray",x1:0,y1:d,x2:t,y2:d},"legend-top-line legend-symbol-"+f)),d+=8,e.label&&(d+=16,h.push((0,gt.jsx)("text",{y:d,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label},"legend-text-"+f)),d+=8),h.push((0,gt.jsx)("g",{className:"legend-item",transform:`translate(0,${d})`,children:vt(e,o,n,r,i,s,a,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:m,onFocusedIndexChange:p,legendInteraction:s,metrics:h}):(({legendGroups:e,height:t,width:o,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u,metrics:d})=>{let h=0;const f=[];e.forEach((e,t)=>{let g=0;e.label&&(g+=16);const m=((e,t,o,n,r,i,s,a,l,c,u,d)=>{const{type:h="fill",styleFn:f,items:g}=e,m=[],{swatchSize:y,labelGap:p,itemGap:b,rowHeight:v,align:x}=u,w=!(!t&&!o),k="isolate"===c||void 0===c&&null!=r,S=g.map(e=>y+p+7*e.label.length),A=[];let M=0,C=0;S.forEach((e,t)=>{const o=0===C?e:C+b+e;d&&d>0&&C>0&&o>d?(A.push({start:M,end:t,width:C}),M=t,C=e):C=o}),g.length>0&&A.push({start:M,end:g.length,width:C}),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=g[d],x=yt(e,d,h,f,y),A=bt(e,n,r),M=r&&r.size>0&&r.has(e.label);m.push((0,gt.jsxs)("g",{transform:`translate(${u},${c*v})`,onClick:t?()=>t(e):void 0,onMouseEnter:o?()=>o(e):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:w?a===i&&d===s?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)+g.length)%g.length;l(a,e);const t=o.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:w?t=>{l(a,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&&(0,gt.jsx)("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:y+p+2+7*e.label.length,height:y+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),x,M&&(0,gt.jsx)(pt,{swatchSize:y}),(0,gt.jsx)("text",{y:y/2,x:y+p,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+d)),u+=S[d]+b}});const j=Math.max(0,...A.map(e=>e.width)),_=A.length;return{items:m,offset:j,totalRows:_,totalHeight:_*v}})(e,n,r,i,s,a,l,t,c,u,d,d.maxWidth??o);g+=m.offset+5,f.push({label:e.label,...m,offset:g,totalRows:m.totalRows,totalHeight:m.totalHeight}),h+=g+12});const g=d.maxWidth??o;let m=h>g?0:"center"===d.align?Math.max(0,(g-h)/2):"end"===d.align?Math.max(0,g-h):0;const y=[];return f.forEach((o,n)=>{const r=e[n];r.label&&(y.push((0,gt.jsx)("text",{transform:`translate(${m},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:r.label},"legend-text-"+n)),m+=16),y.push((0,gt.jsx)("g",{className:"legend-item",transform:`translate(${m},0)`,children:o.items},"legend-group-"+n)),m+=o.offset+5,e[n+1]&&y.push((0,gt.jsx)("line",{stroke:"gray",x1:m,y1:-8,x2:m,y2:(o.totalHeight||t)+0+8},"legend-top-line legend-symbol-"+n)),m+=12}),(0,gt.jsx)("g",{children:y})})({legendGroups:t||[],title:a,height:c,width:l,customClickBehavior:o,customHoverBehavior:n,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:m,onFocusedIndexChange:p,legendInteraction:s,metrics:h}),v=!(!o&&!n);return(0,gt.jsxs)("g",{role:v?"listbox":void 0,"aria-multiselectable":!(!v||"isolate"!==s&&(void 0!==s||null==i))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==a&&""!==a&&"vertical"===u&&(0,gt.jsx)("text",{className:"legend-title",y:16,x:l/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:a}),b]})}function kt(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}var St=require("react/jsx-runtime");function At(e){const{legend:t,totalWidth:o,totalHeight:n,margin:r,legendPosition:i="right",legendLayout:s,title:a,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=e;if(!t)return null;const f="top"===i||"bottom"===i,g=!!a,m=Math.max(0,o-r.left-r.right),y=Math.max(1,f?s?.maxWidth??m:100);let p,b;return"left"===i?(p=Math.max(4,r.left-y-10),b=r.top):"top"===i?(p=r.left,b=g?32:8):"bottom"===i?(p=r.left,b=n-r.bottom+38):(p=o-r.right+10,b=r.top),(0,St.jsx)("g",{transform:`translate(${p}, ${b})`,children:(v=t,"object"==typeof v&&null!==v&&"gradient"in v?(0,St.jsx)(xt,{config:t.gradient,orientation:f?"horizontal":"vertical",width:y}):kt(t)?(0,St.jsx)(wt,{legendGroups:t.legendGroups,title:"",width:y,orientation:f?"horizontal":"vertical",legendLayout:s,customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):t)});var v}var Mt=l(require("react")),Ct=require("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 s="";for(const e of r)s&&s.length+1+e.length>n?(i.push(s),s=e):s=s?`${s} ${e}`:e;return s&&i.push(s),i}function _t(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 Pt(e,t,o,n){if(!e)return(0,Ct.jsx)("g",{className:"annotation-note"});const{label:r,title:i,orientation:s,align:a,wrap:l=120,noWrap:c}=e;if(!r&&!i)return(0,Ct.jsx)("g",{className:"annotation-note"});let u=s;u||(u=Math.abs(t)>Math.abs(o)?"leftRight":"topBottom");let d=a;d&&"dynamic"!==d||(d="topBottom"===u?0>t?"right":"left":0>o?"bottom":"top");let h="start";"topBottom"===u?"right"===d?h="end":"middle"===d&&(h="middle"):h=0>t?"end":"start";const f=16,g=i?c?[i]:jt(i,l):[],m=r?c?[r]:jt(r,l):[],y="leftRight"===u?"end"===h?-4:4:0;let p=0;const b=[],v=n||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";e.useHTML||e.html?b.push((0,Ct.jsx)("foreignObject",{className:"annotation-note-html",x:"end"===h?y-l:"middle"===h?y-l/2:y,y:-16,width:l,height:Math.max(f,(g.length+m.length)*f+(i&&r?2:0))+f,style:{overflow:"visible"},children:(0,Ct.jsxs)("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{color:v,fontSize:"12px",lineHeight:"16px",overflow:"visible",textAlign:"end"===h?"right":"middle"===h?"center":"left",whiteSpace:c?"nowrap":"normal",wordBreak:"break-word"},children:[i&&(0,Ct.jsx)("div",{className:"annotation-note-title",style:{fontWeight:"bold"},children:i}),r&&(0,Ct.jsx)("div",{className:"annotation-note-label",children:r})]})},"annotation-note-html")):(g.length>0&&(b.push((0,Ct.jsx)("text",{className:"annotation-note-title",fill:v,textAnchor:h,fontWeight:"bold",children:g.map((e,t)=>(0,Ct.jsx)("tspan",{x:y,dy:0===t?0:f,children:e},t))},"annotation-note-title")),p=g.length*f),m.length>0&&b.push((0,Ct.jsx)("text",{className:"annotation-note-label",fill:v,textAnchor:h,y:p,children:m.map((e,t)=>(0,Ct.jsx)("tspan",{x:y,dy:0===t?0:f,children:e},t))},"annotation-note-label")));let x=null;if((i||r)&&(0!==t||0!==o))if("topBottom"===u){const e=Math.min(l,120);let t=0,o=e;"end"===h?(t=-e,o=0):"middle"===h&&(t=-e/2,o=e/2),x=(0,Ct.jsx)("line",{className:"note-line",x1:t,x2:o,y1:0,y2:0,stroke:n||"var(--semiotic-text-secondary, currentColor)"})}else{const e=(g.length+m.length)*f+(m.length>0?f:0);let t=0,o=e;"bottom"===d?(t=-e,o=0):"middle"===d&&(t=-e/2,o=e/2),x=(0,Ct.jsx)("line",{className:"note-line",x1:0,x2:0,y1:t,y2:o,stroke:n||"var(--semiotic-text-secondary, currentColor)"})}const w=Math.max(0,g.length+m.length-1)*f;let k=0;return"topBottom"===u?k=0>o?-(w+2):18:"leftRight"===u&&(k="middle"===d?-(w+f+(m.length>0&&g.length>0?2:0))/2+8:"bottom"===d||0>o?-(w+2):18),(0,Ct.jsxs)("g",{className:"annotation-note",transform:`translate(${t},${o})`,children:[(0,Ct.jsx)("g",{className:"annotation-note-content",transform:0!==k?`translate(0,${k})`:void 0,children:b}),x]})}function Rt(e,t,o,n,r){const i=[];switch(e){case"callout-circle":{const e=(t?.radius||0)+(t?.radiusPadding||0);e>0&&i.push((0,Ct.jsx)("circle",{r:e,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const e=t?.width||0,n=t?.height||0;(e>0||n>0)&&i.push((0,Ct.jsx)("rect",{width:e,height:n,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":t?.custom&&i.push(...Array.isArray(t.custom)?t.custom:[t.custom]);break;case"xy-threshold":{const e=n||0,s=r||0;if(void 0!==t?.x){const n=(t.x||0)-e;i.push((0,Ct.jsx)("line",{x1:n,y1:(t.y1||0)-s,x2:n,y2:(t.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==t?.y){const n=(t.y||0)-s;i.push((0,Ct.jsx)("line",{x1:(t.x1||0)-e,y1:n,x2:(t.x2||0)-e,y2:n,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==t?.x1||void 0!==t?.x2?i.push((0,Ct.jsx)("line",{x1:(t.x1||0)-e,y1:0,x2:(t.x2||0)-e,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===t?.y1&&void 0===t?.y2||i.push((0,Ct.jsx)("line",{x1:0,y1:(t.y1||0)-s,x2:0,y2:(t.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const e=t?.type||"curly",n=t?.width??t?.height;void 0!==n&&i.push((0,Ct.jsx)("path",{d:_t(e,n,t?.depth||30,void 0===t?.width),fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return(0,Ct.jsx)("g",{className:"annotation-subject",children:i})}function Lt(e,t,o,n,r,i){const s=[];let a=0,l=0;if("callout-circle"!==r&&"label"!==r||!i?.radius){if("callout-rect"===r&&i){const o=i.width||0,n=i.height||0;if(o>0||n>0){const r=o/2,i=n/2,s=e-r,c=t-i;if(0!==s||0!==c){const e=Math.abs(s),t=Math.abs(c),u=o/2,d=n/2,h=e*d>t*u?u/e:d/t;a=r+s*h,l=i+c*h}}}else if("bracket"===r&&i){const e=i.width,t=i.height,o=i.depth||30;void 0!==e?(a=e/2,l=o):void 0!==t&&(a=o,l=t/2)}}else{const o=(i.radius||0)+(i.radiusPadding||0);if(o>0&&(0!==e||0!==t)){const n=Math.atan2(t,e);a=Math.cos(n)*o,l=Math.sin(n)*o}}const c=Math.sqrt((e-a)**2+(t-l)**2);if(c>.5){const r=n||"var(--semiotic-text-secondary, currentColor)",i="curve"===o?.type;let u=Math.atan2(t-l,e-a);if(i){const n=(a+e)/2,i=(l+t)/2,d=-(t-l)/c,h=(e-a)/c,f=(o?.curve??.25)*c,g=n+d*f,m=i+h*f;s.push((0,Ct.jsx)("path",{className:"connector-curve",d:`M${a},${l}Q${g},${m} ${e},${t}`,fill:"none",stroke:r},"connector-line")),u=Math.atan2(m-l,g-a)}else s.push((0,Ct.jsx)("line",{x1:a,y1:l,x2:e,y2:t,stroke:r},"connector-line"));if("arrow"===o?.end){const e=10,t=16/180*Math.PI;s.push((0,Ct.jsx)("path",{d:`M${a},${l}L${a+e*Math.cos(u+t)},${l+e*Math.sin(u+t)}L${a+e*Math.cos(u-t)},${l+e*Math.sin(u-t)}Z`,fill:r,stroke:"none"},"connector-arrow"))}}return(0,Ct.jsx)("g",{className:"annotation-connector",children:s})}function It(e){const{x:t=0,y:o=0,dx:n,dy:r,nx:i,ny:s,note:a,connector:l,subject:c,type:u,color:d,className:h,disable:f,opacity:g,strokeDasharray:m,events:y={},"data-testid":p}=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!=s&&(k=s-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(0,Ct.jsxs)("g",{className:("annotation "+(h||"")).trim(),transform:`translate(${b},${v})`,"data-testid":p,...null!=g&&{opacity:g},...m&&{strokeDasharray:m},...y,children:[!x.has("connector")&&Lt(w,k,l,d,S,c),!x.has("subject")&&Rt(S,c,d,b,v),!x.has("note")&&Pt(a,w,k,d)]})}function Tt(e){const{noteData:t}=e,{screenCoordinates:o}=t,n="string"==typeof t.type?t.type:"label",r=t.eventListeners||t.events||{};if(t.coordinates&&o){const e=t.nx||o[0][0]+(t.dx??0),r=t.ny||o[0][1]+(t.dy??0),i=o.map((o,i)=>{const s=Object.assign({},t,{note:0===i?t.note:{label:""},x:o[0],y:o[1],nx:e,ny:r});return(0,Ct.jsx)(It,{"data-testid":"semiotic-annotation",...s,type:n},"multi-annotation-"+i)});return(0,Ct.jsx)("g",{children:i})}const i=t.note||{title:"none",label:t.label},s=`${i.label}-${i.title}-${t.i}`;return(0,Ct.jsx)(It,{"data-testid":"semiotic-annotation",events:r,...t,type:n},s)}var $t=require("d3-hierarchy"),Bt=require("d3-shape"),Ht=l(require("regression"));function Ot(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 Et(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 Dt(e){return null==e?null:e+""}function Ft(e,t,o){return t.stickyPositionCache?.set(e,o),o}function Nt(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 Ft(t,o,{x:r.x,y:r.y})}const n=function(e){const t=e.data;if(!t||0===t.length)return null;const o=t[t.length-1],n=e.scales?.x??e.scales?.time,r=e.scales?.y??e.scales?.value;if(!n||!r)return null;const i=o[e.xAccessor||"x"],s=o[e.yAccessor||"y"];return null==i||null==s?null:{x:n(i),y:r(s)}}(o);return n?Ft(t,o,n):null}if("semantic"===n){const n=function(e,t,o){const n=function(e){return Dt(e.provenance?.stableId??e.stableId)}(e);if(!n)return null;const r=o.pointNodes?.find(e=>Dt(e.pointId)===n);if(r)return Ft(t,o,{x:r.x,y:r.y});const i=o.data?.find(e=>function(e){return Dt(e.stableId??e.id??e.provenance?.stableId)}(e)===n);if(!i)return null;const s=Ot(i,o),a=Et(i,o);return null==s||null==a?null:Ft(t,o,{x:s,y:a})}(e,t,o);if(n)return n}let r=null,i=null;if(null!=e.pointId&&o.pointNodes){const t=o.pointNodes.find(t=>t.pointId===e.pointId);t&&(r=t.x,i=t.y)}if(null!=r&&null!=i||(r=Ot(e,o),i=Et(e,o)),null!=r&&null!=i)return Ft(t,o,{x:r,y:i});if("sticky"===n){const e=o.stickyPositionCache?.get(t);if(e)return e}return null}function zt(e,t,o,n=50){return!(-n>e||e>(o.width||0)+n||-n>t||t>(o.height||0)+n)}var Wt=require("react/jsx-runtime"),qt={secondary:0,primary:3};function Gt(e){return!0===e?._annotationDeferred}function Vt(e){return"blended"===e?.cohesion||"layer"===e?.cohesion?e.cohesion:null}function Xt(e){const t=e?.provenance?.confidence;return"number"==typeof t&&Number.isFinite(t)?Math.max(0,Math.min(1,t)):null}function Yt(e){return Math.max(.72,.95-.06*e)}var Kt=require("react/jsx-runtime"),Zt={linear:Bt.curveLinear,monotoneX:Bt.curveMonotoneX,monotoneY:Bt.curveMonotoneY,step:Bt.curveStep,stepAfter:Bt.curveStepAfter,stepBefore:Bt.curveStepBefore,basis:Bt.curveBasis,cardinal:Bt.curveCardinal,catmullRom:Bt.curveCatmullRom};var Qt=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function Ut(e){return!!e&&"object"==typeof e&&Qt.has(function(e){return"string"==typeof e?.type?e.type:""}(e))}function Jt(e){return"primary"===e?.emphasis||!0===e?.defensive}function eo(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 to(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 oo=32,no=6,ro=4,io=8,so=72;var ao={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function lo(e){if(!co(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 co(e){return Ut(e)}function uo(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 ho(e,t,o,n,r){const i=e+o,s=t+n;return Math.abs(o)>Math.abs(n)?{x:0>o?i-r.width-4:i+4,y:0>n?s-r.height:s,width:r.width,height:r.height}:{x:0>o?i-r.width:i,y:0>n?s-r.height-4:s+4,width:r.width,height:r.height}}function fo(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function go(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 mo(e,t,o,n,r,i,s,a){const l=fo(e,s);let c=.4*Math.hypot(t.dx,t.dy)+80*function(e,t,o,n){const r=Math.max(0,n-e.x),i=Math.max(0,n-e.y);return(r+Math.max(0,e.x+e.width-(t-n)))*e.height+(i+Math.max(0,e.y+e.height-(o-n)))*e.width}(l,r,i,a);for(const e of o)c+=12*go(l,e);for(const e of n)c+=4*go(l,e);return c}function yo(e){const{annotations:t,context:o,defaultOffset:n=oo,notePadding:r=no,markPadding:i=ro,edgePadding:s=io,preserveManualOffsets:a=!0,routeLongConnectors:l=!0,connectorThreshold:c=so,density:u,progressiveDisclosure:d=!1,redundantCues:h=!1,responsive:f,mobile:g,cohesion:m,audience:y}=e,p=o.width||0,b=o.height||0,v="object"==typeof g?g:{},x=v.breakpoint??480,w=!!g&&x>=p,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,C=w&&!m?v.cohesion:m;if(0===k.length||0>=p||0>=b)return k.slice();const j=[],_=function(e,t){return(e.pointNodes||[]).map(e=>{const o=Math.max(1,e.r||1)+t;return{x:e.x-o,y:e.y-o,width:2*o,height:2*o}})}(o,i);let P=!1;const R=k.map((e,t)=>{if(!co(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?Nt(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=[...uo("string"==typeof e.title?e.title:void 0,t),...uo("string"==typeof e.label?e.label:void 0,t)],n=o.reduce((e,t)=>Math.max(e,t.length),0);return{width:Math.max(24,Math.min(t,7*n)+10),height:Math.max(18,16*o.length+6)}}(e);if(a&&("number"==typeof(d=e).dx||"number"==typeof d.dy)){const t=function(e){return"text"===e.type||"widget"===e.type?{dx:0,dy:0}:{dx:30,dy:-30}}(e);return j.push(fo(ho(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=mo(ho(i.x,i.y,e.dx,e.dy,u),e,j,_,p,b,r,s);f>t&&(h=e,f=t)}if(!h)return e;const g=fo(ho(i.x,i.y,h.dx,h.dy,u),r);j.push(g);const m=Math.hypot(h.dx,h.dy),y=l&&m>=c&&"text"!==e.type&&"widget"!==e.type?{...e.connector||{end:"arrow"},type:"curve"}:e.connector;return P=!0,{...e,dx:h.dx,dy:h.dy,...y?{connector:y}:{}}}),L=P?R:k.slice();let I=L;if(h){let e=!1;const t=L.map(t=>{const o=function(e){return"text"!==e.type||"string"!=typeof e.color||8>Math.hypot("number"==typeof e.dx?e.dx:0,"number"==typeof e.dy?e.dy:0)?e:{...e,_redundantConnector:!0}}(t);return o!==t&&(e=!0),o});I=e?t:L}{let e=!1;const t=I.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?ao[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});I=e?t:I}const T=new Set;if(S){const e="object"==typeof S?S:{},t=function(e){if(!e)return 1;const t=function(e){const t=e?.familiarity;if(!t)return 3;const o=Object.values(t).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0===o.length?3:o.reduce((e,t)=>e+t,0)/o.length}(e);return t>2?4>t?1:.6:1.5}(y),o=1===t?e:{...e,maxAnnotations:Math.max(0,Math.round((e.maxAnnotations??eo(p,b,e))*t))},{deferred:n}=function(e){const{annotations:t,width:o,height:n}=e,r=Math.max(0,e.minVisible??1),i=eo(o,n,e),s=t.map((e,t)=>{return{annotation:e,index:t,note:(o=e,Ut(o))};var o}),a=s.filter(e=>e.note);if(0===a.length||i>=a.length)return{visible:t.slice(),deferred:[],budget:i};const l=a.filter(e=>Jt(e.annotation)),c=a.filter(e=>!Jt(e.annotation)).sort((e,t)=>to(t.annotation)-to(e.annotation)||e.index-t.index),u=Math.min(c.length,Math.max(Math.max(0,i-l.length),Math.max(0,r-l.length))),d=new Set([...l.map(e=>e.index),...c.slice(0,u).map(e=>e.index)]),h=[],f=[];for(const{annotation:e,index:t,note:o}of s)!o||d.has(t)?h.push(e):f.push(e);return{visible:h,deferred:f,budget:i}}({annotations:I,width:p,height:b,...o});for(const e of n)T.add(e)}if(M&&("object"==typeof M&&"number"==typeof M.minWidth?M.minWidth:480)>=p)for(const e of I)co(e)&&"secondary"===e.emphasis&&T.add(e);if(T.size>0)for(const e of I)!0===e?.defensive&&T.delete(e);let $;return $=0===T.size?I:A?I.map(e=>T.has(e)?{...e,_annotationDeferred:!0}:e):I.filter(e=>!T.has(e)),C?function(e,t){let o=!1;const n=e.map(e=>co(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(o=!0,{...e,cohesion:t}):e);return o?n:e}($,C):$}function po(e,t,o){return"exact"===o?function(e,t){const o=e.domain(),n=o[0],r=o[o.length-1],i=n instanceof Date,s=n instanceof Date?n.getTime():n,a=r instanceof Date?r.getTime():r;if(2>t||s===a)return i?[new Date(s),new Date(a)]:[s,a];const l=(a-s)/(t-1),c=Array(t);for(let e=0;t>e;e++){const o=e===t-1?a:s+e*l;c[e]=i?new Date(o):o}return c}(e,t):e.ticks(t)}var bo=require("react/jsx-runtime");function vo(e){const{width:t,height:o,totalWidth:n,totalHeight:r,margin:i,scales:s,showAxes:a,showGrid:l,rFormat:c}=e,{rTickValues:u,axisExtent:d}=e,h="radial"===s?.projection,f="horizontal"===s?.projection,g=(0,ht.useMemo)(()=>!s||h?[]:(u||po(s.r,5,d)).map(e=>({value:e,pixel:s.r(e),label:(c||xo)(e)})),[s,c,h,u,d]),m=l&&s&&!h,y=a&&s&&!h;return m||y?(0,bo.jsx)("svg",{width:n,height:r,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:(0,bo.jsxs)("g",{transform:`translate(${i.left},${i.top})`,children:[m&&(0,bo.jsx)("g",{className:"ordinal-grid",children:g.map((e,n)=>(0,bo.jsx)("line",{x1:f?e.pixel:0,y1:f?0:e.pixel,x2:f?e.pixel:t,y2:f?o:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+n))}),y&&(0,bo.jsx)(bo.Fragment,{children:(0,bo.jsxs)(bo.Fragment,f?{children:[(0,bo.jsx)("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),(0,bo.jsx)("line",{x1:0,y1:o,x2:t,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]}:{children:[(0,bo.jsx)("line",{x1:0,y1:o,x2:t,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),(0,bo.jsx)("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]})})]})}):null}function xo(e){return Math.round(100*e)/100+""}function wo(e){const{width:t,height:o,totalWidth:n,totalHeight:r,margin:i,scales:s,showAxes:a,showCategoryTicks:l,oLabel:c,rLabel:u,oFormat:d,rFormat:h,showGrid:f,title:g,legend:m,legendHoverBehavior:y,legendClickBehavior:p,legendHighlightedCategory:b,legendIsolatedCategories:v,legendPosition:x="right",legendLayout:w,foregroundGraphics:k,annotations:S,autoPlaceAnnotations:A,svgAnnotationRules:M,xAccessor:C,yAccessor:j,annotationData:_,underlayRendered:P,children:R}=e,L="radial"===s?.projection,I="horizontal"===s?.projection,T=!1!==l,$=(0,ht.useMemo)(()=>{if(!a||!T||!s||L)return[];const e=s.o.bandwidth(),t=s.o.domain().map((t,o)=>({value:t,pixel:(s.o(t)??0)+e/2,label:d?d(t,o):t}));if(2>=t.length)return t;const o=Math.abs(t[1].pixel-t[0].pixel)||e;let 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=I?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)},[a,T,s,d,L,I]),B=e.rTickValues,H=e.tickLabelEdgeAlign,O=e.axisExtent,E=(0,ht.useMemo)(()=>a&&s&&!L?(B||po(s.r,5,O)).map(e=>({value:e,pixel:s.r(e),label:(h||xo)(e)})):[],[a,s,h,L,B,O]),D=(0,ht.useRef)(new Map),F=(0,ht.useRef)(S?.length??0),N=S?.length??0;F.current!==N&&(F.current=N,D.current=new Map);const z=(0,ht.useMemo)(()=>{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=Nt(e,t,o);if(!n)return null;const{x:r,y:i}=n;if(!zt(r,i,o))return null;const s="callout"===e.type?"callout-circle":e.type,a="callout-circle"===s?{radius:e.radius??12,radiusPadding:e.radiusPadding}:"callout-rect"===s?{width:e.width,height:e.height}:void 0;return(0,Kt.jsx)(Tt,{noteData:{x:r,y:i,dx:e.dx??30,dy:e.dy??-30,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:s,...a?{subject:a}:{},connector:e.connector||{end:"arrow"},color:e.color,disable:e.disable,opacity:e.opacity,strokeDasharray:e.strokeDasharray,className:e.className}},"ann-"+t)}case"x-threshold":{const n=Ot(null!=e.value?{...e,x:e.value}:e,o);if(null==n)return null;const r=e.color||"#f97316",i=e.labelPosition||"top";let s;s="bottom"===i?(o.height||0)-4:"center"===i?(o.height||0)/2:12;const a=n>.6*(o.width||0),l=a?n-4:n+4,c=a?"end":"start";return(0,Kt.jsxs)("g",{opacity:e.opacity,children:[(0,Kt.jsx)("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&&(0,Kt.jsx)("text",{x:l,y:s,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=Et(null!=e.value?{...e,y:e.value}:e,o);if(null==n)return null;const r=e.color||"#f97316",i=e.labelPosition||"right";let s,a;return"left"===i?(s=4,a="start"):"center"===i?(s=(o.width||0)/2,a="middle"):(s=(o.width||0)-4,a="end"),(0,Kt.jsxs)("g",{opacity:e.opacity,children:[(0,Kt.jsx)("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&&(0,Kt.jsx)("text",{x:s,y:n-4,textAnchor:a,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:Ot({...e,type:"point"},o),y:Et({...e,type:"point"},o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>n.length)return null;const r=(0,$t.packEnclose)(n),i=e.padding||10;return(0,Kt.jsxs)("g",{children:[(0,Kt.jsx)("circle",{cx:r.x,cy:r.y,r:r.r+i,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&(0,Kt.jsx)("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:Ot({...e,type:"point"},o),y:Et({...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),s=n.map(e=>e.y),[a,l]=le(i),[c,u]=le(s),d=a-r,h=l+r,f=c-r;return(0,Kt.jsxs)("g",{children:[(0,Kt.jsx)("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&&(0,Kt.jsx)("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(0,Kt.jsx)("g",{children:r.map((t,n)=>{const r=Ot(t,o),s=Et(t,o);if(null==r||null==s)return null;const a="function"==typeof e.r?e.r(t):e.r||6,l="function"==typeof e.style?e.style(t):e.style||i;return(0,Kt.jsx)("circle",{cx:r,cy:s,r:a,...l},"hl-"+n)})},"ann-"+t)}case"bracket":{const n=Ot(e,o),r=Et(e,o);return(0,Kt.jsx)(Tt,{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",s="ordinal"===o.frameType,a="horizontal"===o.projection,l=s?r:null,c=s?i:null;let u;const d=[],h=new Map;if(s&&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,g=o.scales?.y??o.scales?.value;if(!f||!g)return null;const m=e=>t=>{const o=Math.max(0,Math.floor(t)),n=Math.min(d.length-1,o+1),r=t-o,i=e(d[o]);return i+(e(d[n])-i)*r},y=f,p=g;let b;if(s)if(a){const e=m(p);b=(t,o)=>[y(o),e(t)]}else{const e=m(y);b=(t,o)=>[e(t),p(o)]}else b=(e,t)=>[y(e),p(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]),s=Math.max(2,Math.ceil(t*o)),a=[];for(let e=0;o>e;e++){const t=r[e],n=r.map(e=>Math.abs(e-t)),l=n.slice().sort((e,t)=>e-t)[Math.min(s-1,o-1)]||1,c=[];for(let e=0;o>e;e++){const t=0===l?0:n[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,f=0,g=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],g+=t*r[e]*i[e])}if(0===u){a.push([t,i[e]]);continue}const m=u*f-d*d;if(1e-12>Math.abs(m))a.push([t,h/u]);else{const e=(u*g-d*h)/m;a.push([t,(h-e*d)/u+e*t])}}return a}(u,e.bandwidth??.3):("polynomial"===v?Ht.default.polynomial(u,{order:e.order||2}):Ht.default.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(0,Kt.jsxs)("g",{children:[(0,Kt.jsx)("polyline",{points:w,fill:"none",stroke:k,strokeWidth:e.strokeWidth||2,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,Kt.jsx)("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(0,Kt.jsxs)("g",{opacity:e.opacity,children:[(0,Kt.jsx)("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&&(0,Kt.jsx)("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:(0,Kt.jsxs)("g",{opacity:e.opacity,children:[(0,Kt.jsx)("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&&(0,Kt.jsx)("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,s=o.scales?.y??o.scales?.value;if(!i||!s)return null;const a=e.upperAccessor||"upperBounds",l=e.lowerAccessor||"lowerBounds",c=e.filter,u=n.filter(e=>null!=e[a]&&null!=e[l]&&!(c&&!c(e))).sort((e,t)=>e[r]-t[r]);if(2>u.length)return null;const d=Zt[o.curve||"linear"]||Bt.curveLinear,h=(0,Bt.area)().x(e=>i(e[r])).y0(e=>s(e[l])).y1(e=>s(e[a])).curve(d)(u);if(!h)return null;const f=e.fill||"#6366f1";return(0,Kt.jsxs)("g",{children:[(0,Kt.jsx)("path",{d:h,fill:f,fillOpacity:e.fillOpacity??.15,stroke:"none"}),e.label&&u.length>0&&(0,Kt.jsx)("text",{x:i(u[u.length-1][r])+4,y:s(u[u.length-1][a])-4,fill:f,fontSize:11,children:e.label})]},"ann-"+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,s=o.scales?.y??o.scales?.value;if(!i||!s)return null;const a=n.map(e=>e[r]).filter(e=>null!=e&&isFinite(e));if(2>a.length)return null;const l=a.reduce((e,t)=>e+t,0)/a.length,c=a.reduce((e,t)=>e+(t-l)**2,0)/a.length,u=Math.sqrt(c),d=e.threshold??2,h=l-d*u,f=!1!==e.showBand,g=e.fill||"#6366f1",m=e.fillOpacity??.1,y=e.anomalyColor||"#ef4444",p=e.anomalyRadius??6,b=s(l+d*u),v=s(h),x=n.filter(e=>{const t=e[r];return null!=t&&Math.abs(t-l)>d*u});return(0,Kt.jsxs)("g",{children:[f&&(0,Kt.jsx)("rect",{x:0,y:Math.min(b,v),width:o.width||0,height:Math.abs(v-b),fill:g,fillOpacity:m}),x.map((e,t)=>{const n=Ot(e,o),r=Et(e,o);return null==n||null==r?null:(0,Kt.jsx)("circle",{cx:n,cy:r,r:p,fill:y,fillOpacity:.7,stroke:y,strokeWidth:1.5},"anomaly-"+t)}),e.label&&(0,Kt.jsx)("text",{x:(o.width||0)-4,y:Math.min(b,v)-4,textAnchor:"end",fill:g,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",s=o.scales?.x??o.scales?.time,a=o.scales?.y??o.scales?.value;if(!s||!a)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=Ht.default.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 s=(e*r-t*o)/i,a=(o-s*t)/e;c=e=>a+s*e}const u=l.length,d=l.map(([e,t])=>t-c(e)).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,g=l.reduce((e,t)=>e+(t[0]-f)**2,0),m=e.confidence??.95,y=.99>m?.95>m?.9>m?1:1.645:1.96:2.576,p=e.steps??5,b=l[u-1][0],v=(b-l[0][0])/Math.max(u-1,1),x=[];for(let e=1;p>=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+(g>0?(e-f)**2/g:0))*y;w.push({x:e,yCenter:t,yUpper:t+o,yLower:t-o})}const k=`M${w.map(e=>`${s(e.x)},${a(e.yUpper)}`).join(" L")} L${w.slice().reverse().map(e=>`${s(e.x)},${a(e.yLower)}`).join(" L")} Z`,S=w.map(e=>`${s(e.x)},${a(e.yCenter)}`).join(" "),A=`${s(b)},${a(c(b))}`,M=e.strokeColor||"#6366f1";return(0,Kt.jsxs)("g",{children:[(0,Kt.jsx)("path",{d:k,fill:e.fill||"#6366f1",fillOpacity:e.fillOpacity??.15,stroke:"none"}),(0,Kt.jsx)("polyline",{points:`${A} ${S}`,fill:"none",stroke:M,strokeWidth:e.strokeWidth??2,strokeDasharray:e.strokeDasharray??"6,3"}),e.label&&w.length>0&&(0,Kt.jsx)("text",{x:s(w[w.length-1].x)+4,y:a(w[w.length-1].yCenter)-4,fill:M,fontSize:11,children:e.label})]},"ann-"+t)}case"widget":{let n,r;if(null!=e.px&&null!=e.py)n=e.px,r=e.py;else{const i=Nt(e,t,o);if(!i)return null;n=i.x,r=i.y}if(!zt(n,r,o))return null;const i=e.width??32,s=e.height??32;return(0,Kt.jsx)("foreignObject",{x:n+(e.dx??0)-i/2,y:r+(e.dy??0)-s/2,width:i,height:s,style:{overflow:"visible",pointerEvents:"auto"},children:(0,Kt.jsx)("div",{style:{width:i,height:s,display:"flex",alignItems:"center",justifyContent:"center"},children:e.content??(0,Kt.jsx)("span",{style:{fontSize:18,cursor:"default"},title:e.label||"Info",children:"ℹ️"})})},"ann-"+t)}case"text":{const n=Nt(e,t,o);if(!n)return null;const{x:r,y:i}=n,s=r+(e.dx||0),a=i+(e.dy||0),l=e.color||"var(--semiotic-text, #333)",c=(0,Kt.jsx)("text",{x:s,y:a,fill:l,fontSize:e.fontSize||11,opacity:e.opacity,strokeDasharray:e.strokeDasharray,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:e.label});return!0!==e._redundantConnector?Mt.cloneElement(c,{key:"ann-text-"+t}):(0,Kt.jsxs)("g",{opacity:e.opacity,strokeDasharray:e.strokeDasharray,children:[(0,Kt.jsx)("line",{x1:r,y1:i,x2:s,y2:a,stroke:l,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),Mt.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,s=o.scales?.x,a=o.scales?.y,l=r(i)?i:r(s)?s:r(a)?a: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(0,Kt.jsxs)("g",(o.projection?"vertical"===o.projection:l===s)?{children:[(0,Kt.jsx)("rect",{x:c,y:0,width:u,height:o.height||0,fill:d,fillOpacity:h}),f&&(0,Kt.jsx)("text",{x:c+u/2,y:12,textAnchor:"middle",fill:d,fontSize:12,fontWeight:"bold",children:f})]}:{children:[(0,Kt.jsx)("rect",{x:0,y:c,width:o.width||0,height:u,fill:d,fillOpacity:h}),f&&(0,Kt.jsx)("text",{x:12,y:c+u/2,dominantBaseline:"middle",fill:d,fontSize:12,fontWeight:"bold",children:f})]},"ann-"+t)}default:return null}},n="horizontal"===s?.projection,r=s?.o?e=>(s.o(e)??0)+s.o.bandwidth()/2:null,i={scales:s?{x:n?s.r:r||s.r,y:n&&r||s.r,time:s.r,value:s.r,o:s.o}:null,timeAxis:"x",xAccessor:C,yAccessor:j,width:t,height:o,data:_,frameType:"ordinal",projection:n?"horizontal":"vertical",stickyPositionCache:D.current};return function(e,t,o,n){const r=[];return e.forEach((e,i)=>{let s;if(o){const r=o(e,i,n);s=null!=r?r:t(e,i,n)}else s=t(e,i,n);s&&r.push({node:s,annotation:e})}),function(e){const t=e.map((e,t)=>{return{p:e,i:t,emphasis:(o=e.annotation,"primary"===o?.emphasis||"secondary"===o?.emphasis?o.emphasis:null),confidence:Xt(e.annotation),readingOrder:null,rank:1};var o}),o=t.some(e=>null!=e.emphasis||null!=e.confidence),n=e.some(e=>Gt(e.annotation)),r=e.some(e=>null!=Vt(e.annotation)),i=e.some(e=>"layer"===Vt(e.annotation));if(!o&&!n&&!r)return e.map(e=>e.node);const s=t.filter(e=>null==e.emphasis&&null!=e.confidence).slice().sort((e,t)=>(t.confidence??0)-(e.confidence??0)||e.i-t.i);s.forEach((e,t)=>{e.readingOrder=t,e.rank=2-t/Math.max(1,s.length)});for(const e of t)e.emphasis&&(e.rank=qt[e.emphasis]);const a=t.sort((e,t)=>e.rank-t.rank||e.i-t.i).map(e=>{const{p:t,i:o,emphasis:n,readingOrder:r}=e,i=Gt(t.annotation);let s=t.node;if("primary"===n||"secondary"===n||null!=r){const e=null==n&&null!=r;s=(0,Wt.jsx)("g",{className:e?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+n,..."secondary"===n?{opacity:.6,fontSize:"0.88em"}:{},...e?{opacity:Yt(r),"data-annotation-reading-order":r}:{},children:t.node},"annotation-emphasis-"+o)}const a=Vt(t.annotation);return a&&(s=(0,Wt.jsx)("g",{className:"annotation-cohesion--"+a,children:s},"annotation-cohesion-"+o)),i&&(s=(0,Wt.jsx)("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:s},"annotation-deferred-"+o)),s});return n&&a.unshift((0,Wt.jsx)("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&&a.unshift((0,Wt.jsx)("style",{children:".annotation-cohesion--layer text,.annotation-cohesion--layer tspan{fill:var(--semiotic-annotation-color,var(--semiotic-text-secondary,#666));font-style:italic}"},"annotation-cohesion-style")),a}(r)}(A?yo({annotations:S,context:i,..."object"==typeof A?A:{}}):S,e,M,i)},[S,A,M,t,o,s,C,j,_]);return a||g||m||k||z&&z.length>0||f||R?(0,bo.jsxs)("svg",{role:"img",width:n,height:r,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[(0,bo.jsx)("title",{children:"string"==typeof g?g:"Ordinal Chart"}),(0,bo.jsx)("desc",{children:"string"==typeof g?g+" — ordinal data visualization":"Ordinal data visualization"}),(0,bo.jsxs)("g",{transform:`translate(${i.left},${i.top})`,children:[f&&s&&!L&&!P&&(0,bo.jsx)("g",{className:"ordinal-grid",children:E.map((e,n)=>(0,bo.jsx)("line",{x1:I?e.pixel:0,y1:I?0:e.pixel,x2:I?e.pixel:t,y2:I?o:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+n))}),a&&s&&!L&&(()=>{const e={fontSize:"var(--semiotic-tick-font-size, 12px)"},n={fontSize:"var(--semiotic-axis-label-font-size, 12px)"};return(0,bo.jsx)("g",{className:"ordinal-axes",children:(0,bo.jsxs)(bo.Fragment,I?{children:[(0,bo.jsxs)("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[!P&&(0,bo.jsx)("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),$.map((t,o)=>(0,bo.jsxs)("g",{transform:`translate(0,${t.pixel})`,children:[(0,bo.jsx)("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?(0,bo.jsx)("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label}):(0,bo.jsx)("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:(0,bo.jsx)("div",{style:{textAlign:"right",userSelect:"none",...e},children:t.label})})]},"cat-"+o)),c&&(0,bo.jsx)("text",{x:15-i.left,y:o/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-i.left}, ${o/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...n},children:c})]}),(0,bo.jsxs)("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[!P&&(0,bo.jsx)("line",{x1:0,y1:o,x2:t,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),!P&&s?.r&&(()=>{const e=s.r(0);return e>1&&t-1>e?(0,bo.jsx)("line",{x1:e,y1:0,x2:e,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1,strokeDasharray:"4,4"}):null})(),E.map((t,n)=>{const r=H?0===n?"start":n===E.length-1?"end":"middle":"middle";return(0,bo.jsxs)("g",{transform:`translate(${t.pixel},${o})`,children:[(0,bo.jsx)("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),(0,bo.jsx)("text",{y:18,textAnchor:r,fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label})]},"val-"+n)}),u&&(0,bo.jsx)("text",{x:t/2,y:o+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:{userSelect:"none",...n},children:u})]})]}:{children:[(0,bo.jsxs)("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[!P&&(()=>{const e=s?.r?s.r(0):o,n=0>e||e>o?o:e;return(0,bo.jsx)("line",{x1:0,y1:n,x2:t,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),$.map((t,n)=>(0,bo.jsxs)("g",{transform:`translate(${t.pixel},${o})`,children:[(0,bo.jsx)("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?(0,bo.jsx)("text",{y:18,textAnchor:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label}):(0,bo.jsx)("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:(0,bo.jsx)("div",{style:{textAlign:"center",userSelect:"none",...e},children:t.label})})]},"cat-"+n)),c&&(0,bo.jsx)("text",{x:t/2,y:o+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:{userSelect:"none",...n},children:c})]}),(0,bo.jsxs)("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[!P&&(0,bo.jsx)("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),E.map((t,o)=>(0,bo.jsxs)("g",{transform:`translate(0,${t.pixel})`,children:[(0,bo.jsx)("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),(0,bo.jsx)("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label})]},"val-"+o)),u&&(0,bo.jsx)("text",{x:15-i.left,y:o/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-i.left}, ${o/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...n},children:u})]})]})})})(),z,k,R]}),g&&(0,bo.jsx)("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 g?g:null}),At({legend:m,totalWidth:n,totalHeight:r,margin:i,legendPosition:x,title:g,legendLayout:w,legendHoverBehavior:y,legendClickBehavior:p,legendHighlightedCategory:b,legendIsolatedCategories:v})]}):null}function ko(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}}var So=require("react"),Ao=require("d3-selection"),Mo=require("d3-brush"),Co=l(require("react")),jo=require("react/jsx-runtime");function _o({width:e,height:t,totalWidth:o,totalHeight:n,margin:r,scales:i,onBrush:s}){const a=(0,So.useRef)(null),l=(0,So.useRef)(null),c=(0,So.useRef)(s);c.current=s;const u=(0,So.useRef)(i);u.current=i;const d=(0,So.useRef)(!1),h=(0,So.useRef)(null),f="horizontal"===i?.projection,g=(0,So.useRef)(f);g.current=f;const m=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=Co.useId().replace(/:/g,""),r=Co.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:Co.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||!a.current)return;const n=(0,Ao.select)(a.current).select(".brush-g");if("clear"===e.type)return d.current=!0,n.call(o.move,null),d.current=!1,h.current=null,void c.current(null);if(("left"===e.direction||"right"===e.direction)!=!!g.current)return;const r=t.r.domain(),[i,s]=[Math.min(...r),Math.max(...r)],f=(s-i)/20,m=h.current?.r??[i+.4*(s-i),i+.6*(s-i)],y="left"===e.direction||"down"===e.direction?-1:1;let[p,b]=m;if(e.resize)0>y?p=Math.max(i,p-f):b=Math.min(s,b+f);else{const e=b-p;p=Math.max(i,Math.min(s-e,p+y*f)),b=p+e}const v={r:[p,b]};d.current=!0,n.call(o.move,g.current?[t.r(p),t.r(b)]:[t.r(b),t.r(p)]),d.current=!1,h.current=v,c.current(v)}});return(0,So.useEffect)(()=>{if(!a.current)return;const o=(0,Ao.select)(a.current).select(".brush-g"),n=f?(0,Mo.brushX)():(0,Mo.brushY)();return n.extent([[0,0],[e,t]]),n.on("brush end",e=>{if(d.current)return;const t=u.current;if(!t)return;if(!e.selection)return h.current=null,void c.current(null);const[o,n]=e.selection;let r;r=g.current?[t.r.invert(o),t.r.invert(n)]:[t.r.invert(n),t.r.invert(o)];const i={r:r};h.current=i,c.current(i)}),o.call(n),l.current=n,o.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{n.on("brush end",null),l.current=null}},[e,t,f]),(0,So.useEffect)(()=>{if(!i||!l.current||!h.current)return;if(!a.current)return;const e=h.current,t=(0,Ao.select)(a.current).select(".brush-g"),o=i.r(e.r[0]),n=i.r(e.r[1]);f?(d.current=!0,t.call(l.current.move,[o,n]),d.current=!1):(d.current=!0,t.call(l.current.move,[n,o]),d.current=!1)},[i,f]),(0,jo.jsxs)("svg",{ref:a,width:o,height:n,...m.svgProps,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[(0,jo.jsx)("title",{children:m.svgProps["aria-label"]}),(0,jo.jsx)("desc",{id:m.descriptionId,children:m.description}),(0,jo.jsx)("g",{className:"brush-g",transform:`translate(${r.left},${r.top})`,style:{pointerEvents:"all"}})]})}var Po=l(require("react")),Ro=require("d3-shape");function Lo(e){return(e.tl??0)>0||(e.tr??0)>0||(e.br??0)>0||(e.bl??0)>0}function Io(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 To=(e,t)=>({x:e*Math.cos(t),y:e*Math.sin(t)});function $o(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=To(o,n),t=To(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=To(o,n),s=To(o,r),a=To(t,r),l=To(t,n),c=r-n>Math.PI?1:0;return`M${e.x},${e.y} A${o},${o} 0 ${c} 1 ${s.x},${s.y} L${a.x},${a.y} A${t},${t} 0 ${c} 0 ${l.x},${l.y} Z`}const s=Math.max(0,Math.min(e.cornerRadius??0,(o-t)/2));if(0===s)return $o({...e,cornerRadius:0,roundStart:!1,roundEnd:!1});const a=Math.asin(Math.min(1,s/Math.max(1e-9,o-s))),l=i?0:Math.asin(Math.min(1,s/Math.max(1e-9,t+s))),c=r-n,u=e.roundStart&&e.roundEnd?c/2:c,d=!!e.roundStart&&u>a,h=!!e.roundEnd&&u>a;if(!d&&!h)return $o({...e,cornerRadius:0,roundStart:!1,roundEnd:!1});const f=n+(d?a:0),g=r-(h?a:0),m=n+(d?l:0),y=r-(h?l:0),p=To(o,f),b=To(o,g),v=(o-s)*Math.cos(a),x=To(v,n),w=To(v,r),k=i?null:To(t,y),S=i?null:To(t,m),A=i?0:(t+s)*Math.cos(l),M=i?null:To(A,n),C=i?null:To(A,r),j=g-f>Math.PI?1:0,_=i?0:y-m>Math.PI?1:0;let P="";if(d)P+=`M${x.x},${x.y}`,P+=` A${s},${s} 0 0 1 ${p.x},${p.y}`;else{const e=To(o,n);P+=`M${e.x},${e.y}`}if(h)P+=` A${o},${o} 0 ${j} 1 ${b.x},${b.y}`,P+=` A${s},${s} 0 0 1 ${w.x},${w.y}`;else{const e=To(o,r);P+=` A${o},${o} 0 ${j} 1 ${e.x},${e.y}`}if(i)P+=" L0,0";else{if(h)P+=` L${C.x},${C.y}`,P+=` A${s},${s} 0 0 1 ${k.x},${k.y}`;else{const e=To(t,r);P+=` L${e.x},${e.y}`}if(d)P+=` A${t},${t} 0 ${_} 0 ${S.x},${S.y}`,P+=` A${s},${s} 0 0 1 ${M.x},${M.y}`;else{const e=To(t,n);P+=` A${t},${t} 0 ${_} 0 ${e.x},${e.y}`}}return P+=" Z",P}function Bo(e){const t=$o({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:$o({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle+r*t,endAngle:e.endAngle}),color:n[r]})}return{clipPath:t,slices:o}}var Ho=require("react/jsx-runtime"),Oo={innerRadius:0,outerRadius:0,startAngle:0,endAngle:0};function Eo(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}function Do(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}var Fo="undefined"==typeof window||"undefined"==typeof document,No=require("react"),zo="undefined"!=typeof window?No.useLayoutEffect:No.useEffect,Wo=()=>()=>{},qo=()=>!1,Go=()=>!0,Vo=require("react");function Xo(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 Yo(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 Ko(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 Zo=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,Qo=new WeakMap,Uo=0,Jo=!1,en=null,tn=null;function on(e,t){if(!t)return t;const o=Zo.exec(t);if(!o)return t;const n=e.canvas;if(!n)return o[2]?.trim()||t;!function(){if(Jo)return;if("undefined"==typeof window||"undefined"==typeof document)return;Jo=!0;const e=()=>{Uo++};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{en=window.matchMedia("(prefers-color-scheme: dark)"),tn=e,"function"==typeof en.addEventListener?en.addEventListener("change",tn):"function"==typeof en.addListener&&en.addListener(tn)}catch{}}();let r=Qo.get(n);r&&r.version===Uo||(r={version:Uo,map:new Map},Qo.set(n,r));const i=r.map.get(t);if(void 0!==i)return i;const s=getComputedStyle(n).getPropertyValue(o[1]).trim()||o[2]?.trim()||t;return r.map.set(t,s),s}var nn=l(require("react")),rn=l(require("react")),sn=(require("react/jsx-runtime"),rn.createContext(null));function an(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 ln(e){return e&&"object"==typeof e?e:{}}function cn(e){return ln(e.accessibility).tableFields??e.accessibleDatum??e.datum}var un=require("react/jsx-runtime"),dn={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function hn(e,t){if(!e||0===e.length)return t+", empty";const o={};for(const t of e){if(null===t?.datum)continue;const e=t.type+"";o[e]=(o[e]||0)+1}if(0===Object.keys(o).length)return t+", empty";const n=[],r={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},i=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],s=Object.keys(o).sort((e,t)=>{const o=i.indexOf(e),n=i.indexOf(t);return(-1===o?999:o)-(-1===n?999:n)});for(const e of s)n.push(`${o[e]} ${r[e]||e}`);return`${t}, ${n.join(", ")}`}var fn=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},gn="semiotic-accessible-data-table",mn=gn+" semiotic-accessible-data-table-hidden",yn=gn+" semiotic-accessible-data-table-visible",pn={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"},bn={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},vn={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)"},xn={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},wn={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))"},kn={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},Sn={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},An={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 Mn({scene:e,chartType:t,tableId:o,chartTitle:n}){const[r,i]=nn.useState(!1),[s,a]=nn.useState(5),l=rn.useContext(sn),c=l?.visible??!1,u=r||c,d=nn.useRef(null),h=n?"Data summary for "+n:o?`Data summary for ${t} ${o}`:"Data summary for "+t;nn.useEffect(()=>{u||a(5)},[u]);const f=nn.useCallback(e=>{e.target===e.currentTarget&&(r||c||i(!0))},[r,c]),g=nn.useCallback(e=>{c||d.current?.contains(e.relatedTarget)||i(!1)},[c]);if(!e||0===e.length)return o?(0,un.jsx)("span",{id:o,tabIndex:-1,style:dn}):null;if(!u)return(0,un.jsx)("div",{id:o,className:mn,tabIndex:-1,onFocus:f,style:dn,role:"region","aria-label":h,children:(0,un.jsxs)("button",{type:"button",onClick:()=>i(!0),children:["View data summary (",e.length," elements)"]})});const m=function(e){const t=[];if(!Array.isArray(e))return t;const o=e.some(e=>e&&("line"===e.type||"area"===e.type));for(const n of e)if(n&&"object"==typeof n&&null!==n.datum)try{switch(n.type){case"point":if(o)break;t.push({label:"Point",values:an(cn(n))});break;case"line":case"area":{const e=cn(n),o=Array.isArray(e)?e:[],r="line"===n.type?"Line point":"Area point";for(const e of o)t.push({label:r,values:an(e)});break}case"rect":{const e=cn(n),o=null!=e&&"object"==typeof e?e:{},r=o.category??n.group??"",i=o.value??o.__aggregateValue??o.total,s=an(o);null==s.category&&""!==r&&(s.category=r+""),null==s.value&&null!=i&&(s.value="number"==typeof i||"string"==typeof i?i:i+""),t.push({label:"Bar",values:s});break}case"heatcell":{const e=an(cn(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=cn(n),o=an(e);if(null==o.category){const t=ln(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:an(cn(n))});break;case"arc":t.push({label:"Arc",values:an(cn(n))});break;case"candlestick":t.push({label:"Candlestick",values:an(cn(n))});break;case"geoarea":{const e=ln(cn(n)),o=an(e);if(null==o.name){const t=ln(e.properties).name??e.name;null!=t&&(o.name=t+"")}t.push({label:"Region",values:o});break}}}catch{}return t}(e),y=function(e){if(!e||0===e.length)return[];const t=new Set;for(const o of e)if(o&&o.values)for(const e of Object.keys(o.values))t.add(e);const o=[];for(const n of t){const t=[],r=new Set;for(const o of e){if(!o||!o.values)continue;const e=o.values[n];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&r.add(e+""))}if(t.length>0){let e=t[0],r=t[0],i=0;for(const o of t)e>o&&(e=o),o>r&&(r=o),i+=o;o.push({name:n,count:t.length,numeric:!0,min:e,max:r,mean:i/t.length})}else if(r.size>0){const e=Array.from(r);o.push({name:n,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return o}(m),p=function(e,t){const o=[e+" data points."];for(const e of t)if(e.numeric)o.push(`${e.name}: ${fn(e.min)} to ${fn(e.max)}, mean ${fn(e.mean)}.`);else{const t=e.uniqueValues,n=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");o.push(`${e.name}: ${n}.`)}return o.join(" ")}(m.length,y),b=Math.min(s,m.length),v=m.slice(0,b),x=m.length-b,w=new Set;for(const e of v)for(const t of Object.keys(e.values))w.add(t);const k=Array.from(w);return(0,un.jsxs)("div",{ref:d,id:o,className:yn,tabIndex:-1,onBlur:g,style:pn,role:"region","aria-label":h,children:[(0,un.jsx)("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{c&&l&&l.setVisible(!1),i(!1)},"aria-label":"Close data summary",style:vn,children:"×"}),(0,un.jsx)("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:bn,children:p}),(0,un.jsxs)("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+t,style:xn,children:[(0,un.jsx)("caption",{className:"semiotic-accessible-data-table-caption",style:Sn,children:x>0?`First ${b} of ${m.length} data points`:`All ${m.length} data points`}),(0,un.jsx)("thead",{children:(0,un.jsxs)("tr",{children:[(0,un.jsx)("th",{style:wn,children:"type"}),k.map(e=>(0,un.jsx)("th",{style:wn,children:e},e))]})}),(0,un.jsx)("tbody",{children:v.map((e,t)=>(0,un.jsxs)("tr",{children:[(0,un.jsx)("td",{style:kn,children:e.label}),k.map(t=>{return(0,un.jsx)("td",{style:kn,children:(o=e.values[t],null==o||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":fn(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"")},t);var o})]},t))})]}),x>0&&(0,un.jsxs)("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>a(e=>e+25),style:An,children:["Show ",Math.min(25,x)," more"," ",1===x?"row":"rows"," (",x," remaining)"]})]})}function Cn({summary:e}){return e?(0,un.jsx)("div",{role:"note",style:dn,children:e}):null}function jn({tableId:e}){return(0,un.jsx)("a",{href:"#"+e,style:dn,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,dn)},children:"Skip to data table"})}function _n({hoverPoint:e}){let t="";if(e){const o=e.data||e;t="object"==typeof o?"Data point: "+Object.entries(o).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Data point: "+o}return(0,un.jsx)("div",{"aria-live":"polite","aria-atomic":"true",style:dn,children:t})}var Pn=require("react/jsx-runtime"),Rn="var(--semiotic-focus, #005fcc)";function Ln({active:e,hoverPoint:t,margin:o,size:n,shape:r="circle",width:i,height:s,pathData:a}){if(!e||!t)return null;const l=t.x+o.left,c=t.y+o.top;let u;if("geoarea"!==r&&"path"!==r||!a)if("rect"===r&&null!=i&&null!=s){const e=Math.max(i,4),t=Math.max(s,4);u=(0,Pn.jsx)("rect",{x:l-e/2-3,y:c-t/2-3,width:e+6,height:t+6,rx:3,fill:"none",stroke:Rn,strokeWidth:2,strokeDasharray:"4,2"})}else u=(0,Pn.jsx)("circle","wedge"===r?{cx:l,cy:c,r:12,fill:"none",stroke:Rn,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:Rn,strokeWidth:2,strokeDasharray:"4,2"});else u=(0,Pn.jsx)("g",{transform:`translate(${o.left},${o.top})`,children:(0,Pn.jsx)("path",{d:a,fill:"none",stroke:Rn,strokeWidth:2.5,strokeDasharray:"6,3"})});return(0,Pn.jsx)("svg",{style:{position:"absolute",left:0,top:0,width:n[0],height:n[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}var In=l(require("react"));function Tn(e){return Array.isArray(e)?e[0]:e}function $n(e,t,o,n){return{data:Tn(e),x:t,y:o,__semioticHoverData:!0,...n}}var Bn=["name","label","title"],Hn=["type","kind","category","group","class","status","role","shape"],On=["value","amount","total","count","weight","score"],En=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 Dn(e,t){for(const o of t){const t=e.find(e=>e.lower===o);if(t)return t}}var Fn=require("react/jsx-runtime"),Nn={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 zn(e,t){return"function"==typeof t?t(e):e[t]}function Wn(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 qn(e={}){const{fields:t,title:o,format:n,style:r={},className:i=""}=e;return e=>{if(!e||"object"!=typeof e)return null;let s;const a=[];if(o){const t=zn(e,o);s=Wn(t,n)}if(t&&t.length>0)t.forEach(t=>{let o,r,i;"string"==typeof t?(o=t,r=t,i=n):(o=t.label,r=t.accessor||t.key||"",i=t.format||n);const s=zn(e,r);a.push({label:o,value:Wn(s,i)})});else if(!o){const t=["value","y","name","id","label"];for(const o of t)if(void 0!==e[o]){s=Wn(e[o],n);break}if(!s){const t=Object.keys(e).filter(e=>!e.startsWith("_"));t.length>0&&(s=Wn(e[t[0]],n))}}const l={...Nn,...r};return(0,Fn.jsxs)("div",{className:("semiotic-tooltip "+i).trim(),style:l,children:[s&&(0,Fn.jsx)("div",{style:{fontWeight:a.length>0?"bold":"normal"},children:s}),a.map((e,t)=>(0,Fn.jsxs)("div",{style:{marginTop:0===t&&s?"4px":0},children:[e.label&&(0,Fn.jsxs)("span",{children:[e.label,": "]}),e.value]},t))]})}}function Gn(e){if(!0!==e){if("function"==typeof e){const t=e;return e=>{let o=Tn(!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:(0,Fn.jsx)("div",{className:"semiotic-tooltip",style:Nn,children:n})}}return!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?qn(e):qn())}}var Vn=require("react/jsx-runtime");function Xn({x:e,y:t,containerWidth:o,containerHeight:n,margin:r,children:i,className:s="stream-frame-tooltip",zIndex:a=1}){const l=Number.isFinite(e)&&Number.isFinite(t),c=In.useRef(null),[u,d]=In.useState(null);In.useLayoutEffect(()=>{const e=c.current;if(!e)return;const t=e.getBoundingClientRect();d(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[i,s,o,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(!In.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),g=f?null:Nn;return l?(0,Vn.jsx)("div",{ref:c,className:f?s:(s+" semiotic-tooltip").trim(),style:{...g||{},position:"absolute",left:r.left+e,top:r.top+t,transform:h,pointerEvents:"none",zIndex:a,width:"max-content"},children:i}):null}var Yn=l(require("react")),Kn=require("react"),Zn=require("react"),Qn=require("react/jsx-runtime");function Un(e){let t=null;const o=()=>(t||(t=(0,Zn.createContext)(null)),t),n=Jn(e);return[function({children:t,initialState:n}){const r=(0,Zn.useRef)(n),i=(0,Zn.useMemo)(()=>Jn(e,r.current),[]),s=o();return(0,Qn.jsx)(s.Provider,{value:i,children:t})},(e,t)=>{const r=o(),i=(0,Zn.useContext)(r)??n,s=(0,Zn.useRef)(e);s.current=e;const a=(0,Zn.useRef)({hasValue:!1,value:void 0}),l=(0,Zn.useCallback)(()=>{const e=s.current(i.getState()),o=a.current;return o.hasValue&&t&&t(o.value,e)?o.value:(a.current={hasValue:!0,value:e},e)},[i,t]),c=(0,Zn.useCallback)(()=>s.current(i.getState()),[i]);return(0,Zn.useSyncExternalStore)(i.subscribe,l,c)}]}function Jn(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 er(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 tr(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t={...t,colors:{...t.colors,categorical:or}}),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 or=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],nr={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}},rr={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}},ir={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:or,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 sr(e,t){if("light"===t)return nr;if("dark"===t)return rr;if("high-contrast"===t)return ir;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?rr:nr;return tr({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}return tr({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}var[ar,lr]=Un(e=>({theme:nr,setTheme(t){e(e=>({theme:sr(e.theme,t)}))}})),cr=require("react");var ur=require("react"),dr="undefined"==typeof window?Kn.useEffect:Kn.useLayoutEffect,hr={requestAnimationFrame:e=>("undefined"==typeof window?globalThis:window).requestAnimationFrame(e),cancelAnimationFrame:e=>("undefined"==typeof window?globalThis:window).cancelAnimationFrame(e)};function fr(e,t,o){return"function"==typeof e?e({size:t,margin:o}):e}function gr(e){const t=function(){const[e,t]=(0,cr.useState)(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return(0,cr.useEffect)(()=>{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=(0,Kn.useRef)(t);o.current=t;const[n,r]=function(e,t,o){const n=(0,ur.useRef)(null),[r,i]=(0,ur.useState)(null);return(0,ur.useEffect)(()=>{if(!t&&!o)return;const e=n.current;if(!e)return;const r=new ResizeObserver(e=>{for(const t of e){const{width:e,height:o}=t.contentRect;i(t=>t&&t.w===e&&t.h===o?t:{w:e,h:o})}});return r.observe(e),()=>r.disconnect()},[t,o]),[n,[t&&r?r.w:e[0],o&&r?r.h:e[1]]]}(e.sizeProp,e.responsiveWidth,e.responsiveHeight),i=(0,Kn.useMemo)(()=>({...e.marginDefault,...e.userMargin}),[e.marginDefault,e.userMargin]),s=r[0]-i.left-i.right,a=r[1]-i.top-i.bottom,l=fr(e.foregroundGraphics,r,i),c=fr(e.backgroundGraphics,r,i),u=lr(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-"+Yn.useId(),g=(0,Kn.useRef)(null),m=(0,Kn.useRef)(e.frameScheduler??hr);m.current=e.frameScheduler??hr;const y=(0,Kn.useRef)(null),p=(0,Kn.useRef)(!1),b=(0,Kn.useRef)(()=>{}),v=(0,Kn.useCallback)(()=>{if(null!==g.current||p.current)return;const e=m.current;let t=!1,o=!1;const n=e.requestAnimationFrame(()=>{t=!0;const e=!o;e&&(p.current=!0),g.current=null,y.current=null;try{b.current()}finally{e&&(p.current=!1)}});o=!0,t||(g.current=n,y.current=e)},[]),x=(0,Kn.useCallback)(()=>{null!==g.current&&((y.current??m.current).cancelAnimationFrame(g.current),g.current=null,y.current=null)},[]);(0,Kn.useEffect)(()=>()=>{x()},[x]);const w=(0,Kn.useRef)(()=>{}),k=(0,Kn.useRef)(()=>{}),S=(0,Kn.useRef)(null),A=(0,Kn.useRef)(null),M=(0,Kn.useRef)(null),C=(0,Kn.useCallback)(()=>{const e=S.current;S.current=null,e&&w.current(e)},[]),j=(0,Kn.useCallback)(e=>{if(S.current={clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType},null===A.current){const e=m.current;let t=!1;const o=e.requestAnimationFrame(()=>{t=!0,A.current=null,M.current=null,C()});t||(A.current=o,M.current=e)}},[C]),_=(0,Kn.useCallback)(()=>{S.current=null,null!==A.current&&((M.current??m.current).cancelAnimationFrame(A.current),A.current=null,M.current=null),k.current()},[]);(0,Kn.useEffect)(()=>()=>{S.current=null,null!==A.current&&((M.current??m.current).cancelAnimationFrame(A.current),A.current=null,M.current=null)},[]);const P=e.themeDirtyRef;return dr(()=>{P&&(Uo++,P.current=!0,v())},[u,v,P]),{reducedMotion:t,reducedMotionRef:o,responsiveRef:n,size:r,margin:i,adjustedWidth:s,adjustedHeight:a,resolvedForeground:l,resolvedBackground:c,currentTheme:u,transition:d,introEnabled:h,tableId:f,rafRef:g,renderFnRef:b,scheduleRender:v,cancelRender:x,hoverHandlerRef:w,hoverLeaveRef:k,onPointerMove:j,onPointerLeave:_}}function mr(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function yr(e,t,o=.3){mr(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 pr(e,t,o=.6){if(!mr(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 br(e,t,o,n=.35){mr(t)&&(e.globalAlpha=t._pulseIntensity*n,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",o?e.fill(o):e.fill())}function vr(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]}function xr(e,t,o){return null==t?o:"string"!=typeof t?t:on(e,t)||o}function wr(e,t,o,n,r,i,s){if("colorStops"in t){const o=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>o.length)return null;const a=e.createLinearGradient(n,r,i,s);for(const e of o)a.addColorStop(e.offset,e.color);return a}const{topOpacity:a,bottomOpacity:l}=t;if(!Number.isFinite(a)||!Number.isFinite(l))return null;const c=Math.max(0,Math.min(1,a)),u=Math.max(0,Math.min(1,l)),d=e.createLinearGradient(n,r,i,s),[h,f,g]=vr(e,o);return d.addColorStop(0,`rgba(${h},${f},${g},${c})`),d.addColorStop(1,`rgba(${h},${f},${g},${u})`),d}function kr(e,t){const{x:o,y:n,w:r,h:i}=t,{tl:s,tr:a,br:l,bl:c}=Io(t);e.beginPath(),e.moveTo(o+s,n),e.lineTo(o+r-a,n),a>0&&e.arcTo(o+r,n,o+r,n+a,a),e.lineTo(o+r,n+i-l),l>0&&e.arcTo(o+r,n+i,o+r-l,n+i,l),e.lineTo(o+c,n+i),c>0&&e.arcTo(o,n+i,o,n+i-c,c),e.lineTo(o,n+s),s>0&&e.arcTo(o,n,o+s,n,s),e.closePath()}function Sr(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}}}require("d3-shape");var Ar=(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)Mr(e,t);else if(t.cornerRadii&&Lo(t.cornerRadii)){const o=xr(e,t.style.fill,on(e,"var(--semiotic-primary, #007bff)")),n=Sr(t),r=t.fillGradient&&"string"==typeof o?wr(e,t.fillGradient,o,n.x0,n.y0,n.x1,n.y1):null;e.fillStyle=r||o,kr(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=on(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else if(t.roundedTop&&t.roundedTop>0){const o=xr(e,t.style.fill,on(e,"var(--semiotic-primary, #007bff)")),n=Sr(t),r=t.fillGradient&&"string"==typeof o?wr(e,t.fillGradient,o,n.x0,n.y0,n.x1,n.y1):null;e.fillStyle=r||o;const i=Math.min(t.roundedTop,t.w/2,t.h/2);e.beginPath();const{x:s,y:a,w:l,h:c}=t;switch(t.roundedEdge){case"right":e.moveTo(s,a),e.lineTo(s+l-i,a),e.arcTo(s+l,a,s+l,a+i,i),e.lineTo(s+l,a+c-i),e.arcTo(s+l,a+c,s+l-i,a+c,i),e.lineTo(s,a+c);break;case"left":e.moveTo(s+l,a),e.lineTo(s+i,a),e.arcTo(s,a,s,a+i,i),e.lineTo(s,a+c-i),e.arcTo(s,a+c,s+i,a+c,i),e.lineTo(s+l,a+c);break;case"bottom":e.moveTo(s,a),e.lineTo(s+l,a),e.lineTo(s+l,a+c-i),e.arcTo(s+l,a+c,s+l-i,a+c,i),e.lineTo(s+i,a+c),e.arcTo(s,a+c,s,a+c-i,i);break;default:e.moveTo(s,a+c),e.lineTo(s,a+i),e.arcTo(s,a,s+i,a,i),e.lineTo(s+l-i,a),e.arcTo(s+l,a,s+l,a+i,i),e.lineTo(s+l,a+c)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=on(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const o=xr(e,t.style.fill,on(e,"var(--semiotic-primary, #007bff)")),n=Sr(t),r=t.fillGradient&&"string"==typeof o?wr(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=on(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}yr(e,t),e.globalAlpha=1}};function Mr(e,t){const o=t.style.icon,n=t.style.iconPadding||2,r=Math.min(t.w,t.h)-n;if(0>=r)return;const i=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),i){const i=r+n,s=t.x+(t.w-r)/2;for(let n=t.y+t.h-r;n>=t.y-r;n-=i)e.drawImage(o,s,n,r,r)}else{const i=r+n,s=t.y+(t.h-r)/2;for(let n=t.x;t.x+t.w>n;n+=i)e.drawImage(o,n,s,r,r)}e.restore()}var Cr=(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=xr(e,o.style.fill,"#4e79a7"),e.fill(),o.style.stroke&&(e.strokeStyle=xr(e,o.style.stroke,o.style.stroke),e.lineWidth=o.style.strokeWidth||1,e.stroke()),pr(e,o)}finally{e.restore()}}},jr=new Map;function _r(e){try{if(e.path)return new Path2D(e.path);const t=`${e.symbolType??"circle"}:${Math.round(e.size)}`;let o=jr.get(t);return o||(o=new Path2D(oe(e.symbolType,e.size)),jr.size>256&&jr.clear(),jr.set(t,o)),o}catch{return null}}var Pr=(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=_r(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=xr(e,t.style.fill,"#4e79a7"),e.fill(r)),t.style.stroke&&"none"!==t.style.stroke&&(e.globalAlpha=o*i,e.strokeStyle=xr(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth??1,e.stroke(r)),e.restore()}e.globalAlpha=o};function Rr(e,t,o,n,r){if(0>=t.size)return;const i=t.glyph;if(!i||!i.parts?.length)return;const s=We(i,t.size);if(0>=s.scale)return;const a=(t.style.opacity??1)*(t._decayOpacity??1);if(0>=a)return;const l=t=>{const o=xr(e,t,t);return"string"==typeof o?o:t},c=t.color??("string"==typeof t.style.fill?t.style.fill:void 0);e.save(),e.translate(o,n),t.rotation&&e.rotate(t.rotation),e.translate(s.offsetX,s.offsetY),e.scale(s.scale,s.scale),e.globalAlpha=r*a*(t.style.fillOpacity??1);const u=Ye(i,t.fraction??1,t.fractionStart??0,t.fractionDirection??"horizontal");u&&t.ghostColor&&Ze(e,i,c,t.accent,t.ghostColor,l),u&&(e.beginPath(),e.rect(u.x,u.y,u.width,u.height),e.clip()),Ze(e,i,c,t.accent,void 0,l),e.restore()}var Lr=require("d3-shape");function Ir(e,t){const o=t._gradientBand.colors;if(0===o.length)return;const{clipPath:n,slices:r}=Bo({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=on(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=on(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(i),e.restore())}function Tr(e,t){e.beginPath(),t.innerRadius>0?(e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerRadius,t.endAngle,t.startAngle,!0)):(e.moveTo(t.cx,t.cy),e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle)),e.closePath()}function $r(e,t){const o={innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle+Math.PI/2,endAngle:t.endAngle+Math.PI/2},n=(0,Lr.arc)().cornerRadius(t.cornerRadius)(o);if(!n)return;e.save(),e.translate(t.cx,t.cy);const r=new Path2D(n);e.fill(r),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(r),e.restore()}var Br=(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)Ir(e,t),t._pulseIntensity&&t._pulseIntensity>0&&(Tr(e,t),br(e,t)),e.globalAlpha=1;else{if(e.fillStyle=("string"==typeof t.style.fill?on(e,t.style.fill):t.style.fill)||"#007bff",t.roundedEnds){t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=on(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1);const o=$o({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=on(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1),$r(e,t)):(Tr(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=on(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()));t._pulseIntensity&&t._pulseIntensity>0&&(Tr(e,t),br(e,t)),e.globalAlpha=1}},Hr=(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=on(e,"var(--semiotic-primary, #007bff)"),i=on(e,"var(--semiotic-text, #333)"),s=t.style.fill,a="string"==typeof s?on(e,s)||s:s??r,l=t.style.stroke,c="string"==typeof l?on(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=a,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()}},Or=(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?on(e,t.style.fill):t.style.fill)||"#007bff",e.fill(o),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=on(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()}},Er=(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=on(e,o.style.stroke)||("string"==typeof o.style.fill?on(e,o.style.fill):o.style.fill)||on(e,"var(--semiotic-border, #999)"),e.lineWidth=o.style.strokeWidth||1,e.globalAlpha=o.style.opacity??.5,e.stroke(),e.globalAlpha=1}},Dr=(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=on(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}};function Fr(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 Nr(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}var zr=null;function Wr(e={},t){const{background:o="transparent",stroke:n="#000",lineWidth:r=1.5,spacing:i=6,angle:s=45}=e,a=Math.max(8,Math.ceil(2*i));let l;try{l=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(zr||(zr=document.createElement("canvas")),zr.width=e,zr.height=e,zr)}(a)}catch{return null}const c=l.getContext("2d");if(!c)return null;o&&"transparent"!==o?(c.fillStyle=o,c.fillRect(0,0,a,a)):c.clearRect(0,0,a,a),c.strokeStyle=n,c.lineWidth=r,c.lineCap="square";const u=s*Math.PI/180;if(45===s||-45===s){const e=s>0?1:-1;for(let t=-a;2*a>=t;t+=i)c.beginPath(),c.moveTo(t,0),c.lineTo(t+e*a,a),c.stroke()}else{c.save(),c.translate(a/2,a/2),c.rotate(u);const e=2*a;for(let t=-e;e>=t;t+=i)c.beginPath(),c.moveTo(-e,t),c.lineTo(e,t),c.stroke();c.restore()}return(t||c).createPattern(l,"repeat")}var qr=new Map;function Gr(e,t){const o=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,n=qr.get(o);if(void 0!==n)return n;const r=Wr({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return qr.set(o,r),r}function Vr(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 Xr(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 Yr(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}var Kr=e=>[Er,...e],Zr={bar:Kr([Ar]),clusterbar:Kr([Ar]),point:Kr([Cr,Pr]),swarm:Kr([Cr,Pr]),pie:[Br],donut:[Br],boxplot:Kr([Hr,Cr]),violin:Kr([Or]),histogram:Kr([Ar]),ridgeline:Kr([Or]),timeline:Kr([Ar]),funnel:[Ar,Dr,(e,t,o,n)=>{const r=t.filter(e=>"rect"===e.type&&null!=e.datum);if(0!==r.length&&r.some(e=>null!=e.datum?.__funnelStepLabel||null!=e.datum?.__funnelValueLabelX)){e.textBaseline="top",e.lineJoin="round",e.textAlign="center",e.font="bold 14px sans-serif";for(const t of r){const o=t.datum;if(!o)continue;if(!o.__funnelStepLabel)continue;const n=o.__funnelStepLabel;if(e.measureText(n).width+16>(o.__funnelRowWidth??o.__funnelBarW??0))continue;const r=o.__funnelStepLabelX,i=o.__funnelStepLabelY+3;e.strokeStyle="rgba(0,0,0,0.6)",e.lineWidth=3,e.strokeText(n,r,i),e.fillStyle="#fff",e.fillText(n,r,i)}e.font="bold 13px sans-serif";for(const t of r){const o=t.datum;if(!o)continue;if(null==o.__funnelValueLabelX)continue;const n=o.__funnelBarW??0;if(60>n)continue;const r=o.__funnelValue;if(null==r||0===r)continue;const i=o.__funnelPercent,s=!0===o.__funnelIsFirstStep;let a;if(a=s?Fr(r):null!=i?`${Fr(r)} (${Nr(i)})`:Fr(r),e.measureText(a).width+16>n){if(s||null==i)continue;if(a=Fr(r),e.measureText(a).width+16>n)continue}const l=o.__funnelValueLabelX,c=(o.__funnelValueLabelY??t.y)+14+5;e.textAlign="center",e.strokeStyle="rgba(0,0,0,0.5)",e.lineWidth=3,e.strokeText(a,l,c),e.fillStyle="#fff",e.fillText(a,l,c)}e.lineWidth=1,e.lineJoin="miter"}}],"bar-funnel":[Ar,(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)||on(e,"var(--semiotic-border, #999)"),n=Gr(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]=vr(e,t);return(.2126*o+.7152*n+.0722*r)/255>.6}(e,on(e,"var(--semiotic-text, #333)")),s=i?"#1f2937":"#ffffff",a=i?"rgba(255,255,255,0.18)":"rgba(0,0,0,0.12)",l=i?"#f3f4f6":"#1a1a1a",c=l;for(const t of r){const o=t.datum;if(!o)continue;const n=o.__barFunnelValue;if(null==n)continue;if(25>t.w)continue;const r=o.__barFunnelPercent,i=!(!0===o.__barFunnelIsFirstStep)&&null!=r,u=i?Yr(r):"",d=Xr(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,g=Math.max(h,f)+12,m=i?32:17,y=o.__barFunnelLabelX,p=y-g/2,b=o.__barFunnelLabelY-m-4;e.save(),e.shadowColor="rgba(0,0,0,0.15)",e.shadowBlur=4,e.shadowOffsetY=1,e.fillStyle=s,e.beginPath(),Vr(e,p,b,g,m,4),e.fill(),e.restore(),e.strokeStyle=a,e.lineWidth=.5,e.beginPath(),Vr(e,p,b,g,m,4),e.stroke(),e.textAlign="center",e.textBaseline="top",i?(e.font="bold 13px sans-serif",e.fillStyle=l,e.fillText(u,y,b+3),e.font="11px sans-serif",e.fillStyle=c,e.fillText(d,y,b+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle=l,e.fillText(d,y,b+3))}e.lineWidth=1}],swimlane:Kr([Ar]),custom:Kr([Ar,Cr,Pr,(e,t)=>{const o=e.globalAlpha;for(const n of t)"glyph"===n.type&&Rr(e,n,n.x,n.y,o);e.globalAlpha=o},Br,Hr,Or,Dr])},Qr=require("react/jsx-runtime");function Ur(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&&En.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=>Bn.includes(e.lower));const s=i>=0;0>i&&(i=r.findIndex(e=>"id"===e.lower)),0>i&&(i=r.findIndex(e=>"string"==typeof e.value));const a=0>i?void 0:r[i];let l=r.filter((e,t)=>t!==i);s&&(l=l.filter(e=>"id"!==e.lower));const c=Dn(l,Hn),u=Dn(l,On),d=new Set(Hn),h=new Set(On),f=[];c&&f.push({key:c.key,value:c.value}),u&&f.push({key:u.key,value:u.value});for(const e of l){if(f.length>=o)break;e!==c&&e!==u&&(d.has(e.lower)||h.has(e.lower)||f.push({key:e.key,value:e.value}))}return{titleKey:a?.key,title:a?.value,entries:f}}(e,{skipPositional:!1});return null==t.title&&0===t.entries.length?null:(0,Qr.jsxs)("div",{className:"semiotic-tooltip",style:Nn,children:[null!=t.title&&(0,Qr.jsx)("div",{style:{fontWeight:"bold"},children:t.title+""}),t.entries.map(e=>(0,Qr.jsxs)("div",{children:[(0,Qr.jsxs)("span",{style:{opacity:.7},children:[e.key,":"]})," ","number"==typeof e.value?e.value.toLocaleString():e.value+""]},e.key))]})}function Jr({hover:e}){const t=e.data||{},o=e.stats,n=e.category;if(Array.isArray(t)){const e=n||t[0]?.category||"";if(o)return(0,Qr.jsxs)("div",{className:"semiotic-tooltip",style:Nn,children:[e&&(0,Qr.jsx)("div",{style:{fontWeight:"bold"},children:e+""}),(0,Qr.jsxs)("div",{children:["n = ",o.n]}),(0,Qr.jsxs)("div",{children:["Min: ",o.min.toLocaleString()]}),(0,Qr.jsxs)("div",{children:["Q1: ",o.q1.toLocaleString()]}),(0,Qr.jsxs)("div",{children:["Median: ",o.median.toLocaleString()]}),(0,Qr.jsxs)("div",{children:["Q3: ",o.q3.toLocaleString()]}),(0,Qr.jsxs)("div",{children:["Max: ",o.max.toLocaleString()]}),(0,Qr.jsxs)("div",{style:{opacity:.8},children:["Mean: ",o.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});const r=t.length;return(0,Qr.jsxs)("div",{className:"semiotic-tooltip",style:Nn,children:[e&&(0,Qr.jsx)("div",{style:{fontWeight:"bold"},children:e+""}),(0,Qr.jsxs)("div",{children:[r," items"]})]})}if(null!=t.bin&&null!=t.count){const e=t.range||[];return(0,Qr.jsxs)("div",{className:"semiotic-tooltip",style:Nn,children:[t.category&&(0,Qr.jsx)("div",{style:{fontWeight:"bold"},children:t.category+""}),(0,Qr.jsxs)("div",{children:["Count: ",t.count]}),2===e.length&&(0,Qr.jsxs)("div",{style:{opacity:.8},children:[Number(e[0]).toFixed(1)," – ",Number(e[1]).toFixed(1)]})]})}const r=e.__oAccessor,i=e.__rAccessor,s=e.__chartType;if("swarm"===s||"point"===s)return Ur(t);const a=(r&&null!=t[r]?t[r]:null)||t.category||t.name||t.group||t.__rName||"",l=t.__aggregateValue??(i&&null!=t[i]?t[i]:null)??t.value??t.__rValue??t.pct??"";return a||""!==l?(0,Qr.jsxs)("div",{className:"semiotic-tooltip",style:Nn,children:[a&&(0,Qr.jsx)("div",{style:{fontWeight:"bold"},children:a+""}),""!==l&&(0,Qr.jsx)("div",{children:"number"==typeof l?l.toLocaleString():l+""})]}):Ur(t)}Jr.ownsChrome=!0;var ei=require("react/jsx-runtime"),ti={top:50,right:40,bottom:60,left:70},oi=(0,u.memo)((0,u.forwardRef)(function(e,t){const{chartType:o,runtimeMode:n,data:r,oAccessor:i="category",rAccessor:s="value",colorAccessor:a,symbolAccessor:l,symbolMap:c,stackBy:d,groupBy:g,multiAxis:m,timeAccessor:y,valueAccessor:p,categoryAccessor:b,accessorRevision:v,projection:x="vertical",size:w=[600,400],responsiveWidth:k,responsiveHeight:S,margin:A,barPadding:M,roundedTop:C,gradientFill:j,trackFill:_,baselinePadding:P,innerRadius:R,cornerRadius:L,normalize:I,startAngle:T,sweepAngle:$,dynamicColumnWidth:B,bins:H,showOutliers:O,showIQR:E,amplitude:D,connectorOpacity:F,showLabels:N,connectorAccessor:z,connectorStyle:W,dataIdAccessor:q,rExtent:G,oExtent:V,extentPadding:X=.05,oSort:Y,windowMode:K="sliding",windowSize:Z=200,pieceStyle:Q,summaryStyle:U,colorScheme:J,barColors:ee,showAxes:te=!0,showCategoryTicks:ne,categoryLabel:re,valueLabel:ie,categoryFormat:se,valueFormat:ae,oLabel:le,rLabel:ce,oFormat:ue,rFormat:de,rTickValues:he,tickLabelEdgeAlign:fe,axisExtent:ge,enableHover:me=!0,hoverAnnotation:ye,tooltipContent:pe,customHoverBehavior:be,customClickBehavior:ve,annotations:xe,autoPlaceAnnotations:we,svgAnnotationRules:ke,showGrid:Se=!1,legend:Ae,legendHoverBehavior:Me,legendClickBehavior:Ce,legendHighlightedCategory:je,legendIsolatedCategories:Pe,legendPosition:Le,legendLayout:Ie,legendCategoryAccessor:Te,onCategoriesChange:$e,backgroundGraphics:Be,foregroundGraphics:He,title:De,className:Fe,background:Ne,centerContent:ze,decay:qe,pulse:Ve,transition:Xe,animate:Ze,staleness:Ue,brush:Je,onBrush:et,accessibleTable:tt=!0,description:ot,summary:nt,customLayout:rt,onLayoutError:ut,layoutConfig:ht,layoutSelection:ft}=e,gt=(0,u.useRef)(!0),mt=gr({sizeProp:w,responsiveWidth:k,responsiveHeight:S,userMargin:A,marginDefault:ti,animate:Ze,transitionProp:Xe,themeDirtyRef:gt}),{reducedMotionRef:yt,responsiveRef:pt,size:bt,margin:vt,adjustedWidth:xt,adjustedHeight:wt,currentTheme:kt,transition:St,introEnabled:At,tableId:Mt,rafRef:Ct,renderFnRef:jt,scheduleRender:_t,cancelRender:Pt}=mt,Rt=function(){const[e,t]=(0,No.useState)(!1);return zo(()=>{t(!0)},[]),e}(),Lt=function(){const e=(0,No.useSyncExternalStore)(Wo,qo,Go);return(0,No.useRef)(e).current}(),It=(0,u.useMemo)(()=>h(r),[r]),Tt=re??le,$t=ie??ce,Bt=se??ue,Ht=ae??de,Ot=(0,u.useRef)(null),Et=(0,u.useRef)(null),Dt=(0,u.useRef)([]),Ft=(0,u.useRef)(Te),Nt=(0,u.useRef)($e);Ft.current=Te,Nt.current=$e;const[zt,Wt]=(0,u.useState)(null),[qt,Gt]=(0,u.useState)(null),Vt=(e,t)=>"function"==typeof e?e({size:bt,margin:vt,scales:t}):e,Xt=Vt(He,qt),Yt=Vt(Be,qt),[Kt,Zt]=(0,u.useState)(0),Qt=(0,u.useRef)(0),[Ut,Jt]=(0,u.useState)(!1),eo=(0,u.useRef)({w:-1,h:-1}),to=(0,u.useRef)(!1),oo=me||ye,no="streaming"===n,ro=function(e){const t=(0,Vo.useRef)(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return Yo(e,t);if(!Ko(e)||!Ko(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(!Yo(o,r))return!1}else{if(!Ko(o)||!Ko(r))return!1;if(!Xo(o,r))return!1}}return!0}(t.current,e)||(t.current=e),t.current}((0,u.useMemo)(()=>({chartType:o,runtimeMode:no?"streaming":"bounded",windowSize:Z,windowMode:K,extentPadding:X,projection:x,oAccessor:no?void 0:i,rAccessor:no?void 0:s,accessorRevision:v,colorAccessor:a,symbolAccessor:l,symbolMap:c,stackBy:d,groupBy:g,multiAxis:m,timeAccessor:no?y:void 0,valueAccessor:no?p||("string"==typeof s||"function"==typeof s?s:void 0):void 0,categoryAccessor:no?b||i:void 0,rExtent:G,oExtent:V,axisExtent:ge,barPadding:M,roundedTop:C,gradientFill:j,trackFill:_,baselinePadding:P,innerRadius:R,cornerRadius:L,normalize:I,startAngle:T,sweepAngle:$,dynamicColumnWidth:B,bins:H,showOutliers:O,showIQR:E,amplitude:D,connectorOpacity:F,showLabels:N,connectorAccessor:z,connectorStyle:W,dataIdAccessor:q,oSort:Y,pieceStyle:Q,summaryStyle:U,colorScheme:J,themeCategorical:kt?.colors?.categorical,themeSemantic:er(kt),themeSequential:kt?.colors?.sequential,themeDiverging:kt?.colors?.diverging,barColors:ee,decay:qe,pulse:Ve,transition:St,introAnimation:At,staleness:Ue,customLayout:rt,onLayoutError:ut,layoutConfig:ht,layoutMargin:vt}),[o,Z,K,X,x,i,s,v,a,l,c,d,g,m,y,p,b,G,V,ge,M,C,j,_,P,R,L,I,T,$,B,H,O,E,D,F,N,z,W,q,Y,Q,U,J,ee,qe,Ve,St?.duration,St?.easing,At,Ue,no,kt,rt,ut,ht,vt])),io=(0,u.useRef)(null);io.current||(io.current=new _e(ro));const so=(0,u.useCallback)(()=>{const e=Ft.current,t=Nt.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}(io.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,Dt.current)||(Dt.current=o,t(o))},[]);!function(e,t,o,n){(0,Ee.useEffect)(()=>{e.current?.updateConfig(t),o.current=!0,n()},[t,n,e,o])}(io,ro,gt,_t),function(e,t,o,n){const r=(0,Ee.useRef)(null);(0,Ee.useEffect)(()=>{const i=e.current;if(!i)return;const s=t??null;r.current!==s&&(r.current=s,i.setLayoutSelection(s),i.hasCustomRestyle?i.restyleScene(s):o.current=!0,n())},[t,n,e,o])}(io,ft,gt,_t);const ao=(0,u.useRef)(null);ao.current||(ao.current=new f(e=>{const t=io.current;t&&t.ingest(e)&&(gt.current=!0,_t())}));const lo=(0,u.useCallback)(e=>{ao.current?.push(e)},[]),co=(0,u.useCallback)(e=>{ao.current?.pushMany(e)},[]),uo=(0,u.useCallback)(()=>{ao.current?.clear(),io.current?.clear(),gt.current=!0,_t()},[_t]),ho=(0,u.useCallback)(e=>{ao.current?.clearLastData(),ao.current?.setReplacementData(e)},[]);(0,u.useImperativeHandle)(t,()=>({push:lo,pushMany:co,replace:ho,remove:e=>{ao.current?.flush();const t=io.current?.remove(e)??[];if(t.length>0){const e=Et.current?.data;!!Et.current&&t.some(Array.isArray(e)?t=>e.includes(t):t=>t===e)&&(Et.current=null,Wt(null)),gt.current=!0,_t()}return t},update:(e,t)=>{ao.current?.flush();const o=io.current?.update(e,t)??[];return o.length>0&&(gt.current=!0,_t()),o},clear:uo,getData:()=>(ao.current?.flush(),io.current?.getData()??[]),getScales:()=>io.current?.scales??null,getCustomLayout:()=>io.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>io.current?.lastCustomLayoutFailure??null}),[lo,co,ho,uo,_t]),(0,u.useEffect)(()=>{r&&ao.current?.setBoundedData(It)},[r,It]);const{hoverHandlerRef:fo,hoverLeaveRef:go,onPointerMove:mo,onPointerLeave:yo}=mt;fo.current=e=>{if(!oo)return;const t=Ot.current;if(!t)return;const n=t.getBoundingClientRect(),r=e.clientX-n.left-vt.left,a=e.clientY-n.top-vt.top;if(0>r||r>xt||0>a||a>wt)return void(Et.current&&(Et.current=null,Wt(null),be&&be(null),_t()));const l=io.current;if(!l||0===l.scene.length)return;const c="radial"===x,u=Qe(l.scene,c?r-xt/2:r,c?a-wt/2:a,30,l.pointQuadtree,l.maxPointRadius);if(!u)return void(Et.current&&(Et.current=null,Wt(null),be&&be(null),_t()));const d=$n(u.datum||{},u.x,u.y,{...u.stats&&{stats:u.stats},...u.category&&{category:u.category},__oAccessor:"string"==typeof i?i:void 0,__rAccessor:"string"==typeof s?s:void 0,__chartType:o});Et.current=d,Wt(d),be&&(be(d),gt.current=!0),_t()},go.current=()=>{Et.current&&(Et.current=null,Wt(null),be&&(be(null),gt.current=!0),_t())};const po=(0,u.useCallback)(e=>{if(!ve)return;const t=Ot.current;if(!t)return ve(null),gt.current=!0,void _t();const n=t.getBoundingClientRect(),r=e.clientX-n.left-vt.left,a=e.clientY-n.top-vt.top;if(0>r||r>xt||0>a||a>wt)return ve(null),gt.current=!0,void _t();const l=io.current;if(!l||0===l.scene.length)return ve(null),gt.current=!0,void _t();const c="radial"===x,u=Qe(l.scene,c?r-xt/2:r,c?a-wt/2:a,30,l.pointQuadtree,l.maxPointRadius);if(!u)return ve(null),gt.current=!0,void _t();ve($n(u.datum||{},u.x,u.y,{...u.stats&&{stats:u.stats},...u.category&&{category:u.category},__oAccessor:"string"==typeof i?i:void 0,__rAccessor:"string"==typeof s?s:void 0,__chartType:o})),gt.current=!0,_t()},[wt,xt,o,ve,vt,i,x,s,_t]),bo=(0,u.useRef)(-1),xo=(0,u.useRef)(null),So=(0,u.useRef)(null),Ao=(0,u.useCallback)(e=>{const t=io.current;if(!t||0===t.scene.length)return;const n=t.version;let r;if(So.current&&So.current.version===n)r=So.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=Ke(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;r=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),So.current={version:n,graph:r}}const a=bo.current;if(0>a){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),bo.current=0;const t=r.flat[0];xo.current={shape:t.shape,w:t.w,h:t.h};const n={...st(t),__oAccessor:"string"==typeof i?i:void 0,__rAccessor:"string"==typeof s?s:void 0,__chartType:o};return Et.current=n,Wt(n),be&&be(n),void _t()}const l=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}}(r,a),c=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?it(o,o.groups[e+1],i[r]):t.flatIndex}case"ArrowUp":{const e=o.groups.indexOf(n);return e>0?it(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,l,r);if(null===c)return;if(e.preventDefault(),0>c)return bo.current=-1,xo.current=null,Et.current=null,Wt(null),be&&be(null),void _t();bo.current=c;const u=r.flat[c];xo.current={shape:u.shape,w:u.w,h:u.h};const d={...st(u),__oAccessor:"string"==typeof i?i:void 0,__rAccessor:"string"==typeof s?s:void 0,__chartType:o};Et.current=d,Wt(d),be&&be(d),_t()},[be,_t]),Mo=(0,u.useCallback)(e=>{bo.current=-1,xo.current=null,mo(e)},[mo]);jt.current=()=>{Ct.current=null;const e=Ot.current;if(!e)return;const t=e.getContext("2d");if(!t)return;const n=io.current;if(!n)return;const r="undefined"!=typeof performance?performance.now():Date.now(),i=n.advanceTransition(yt.current?r+1e6:r),s=!yt.current&&i,a=eo.current.w!==xt||eo.current.h!==wt,l=gt.current;let c=!1;!l&&!a||s&&!a||(n.computeScene({width:xt,height:wt}),eo.current={w:xt,h:wt},c=!0,so()),gt.current=l&&s&&!c;const u=function(e,t,o,n){const r=n.current,i=!0===e.lastCustomLayoutFailure?.preservedLastGoodScene,s=!i&&e.hasActivePulsesAt(t),a=!(o||i||!s&&!r)&&e.refreshPulse(t);return n.current=s,{changed:a,pending:s}}(n,r,c,to);(c||s)&&e.setAttribute("aria-label",hn(n.scene,o+" 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=bt[0]*d,f=bt[1]*d;e.width===h&&e.height===f||(e.width=h,e.height=f,e.style.width=bt[0]+"px",e.style.height=bt[1]+"px"),t.setTransform(d,0,0,d,0,0),t.clearRect(0,0,bt[0],bt[1]);const g=Ue&&n.lastIngestTime>0&&r-n.lastIngestTime>(Ue?.threshold??5e3);g&&(t.globalAlpha=Ue?.dimOpacity??.5),function(e,t){const{background:o,hasBackgroundGraphics:n=!1,themeBackground:r="",x:i=0,y:s=0,width:a,height:l}=t;if("transparent"===o)return!1;if(n)return!1;const c=o||(r&&"transparent"!==r?r:"")||null;if(!c)return!1;const u=on(e,c);u&&(e.fillStyle=u,e.fillRect(i,s,a,l))}(t,{background:Ne,hasBackgroundGraphics:!!Be,themeBackground:Be||"transparent"===Ne||Ne?"":getComputedStyle(e).getPropertyValue("--semiotic-bg").trim(),width:bt[0],height:bt[1]});const m="radial"===x;t.save(),t.beginPath(),t.rect(vt.left,vt.top,xt,wt),t.clip(),m?(t.save(),t.translate(vt.left+xt/2,vt.top+wt/2)):t.translate(vt.left,vt.top);const y=rt?Zr.custom:Zr[o]||[],p={width:xt,height:wt};for(const e of y)e(t,n.scene,n.scales,p);m&&t.restore(),t.restore(),g&&(t.globalAlpha=1),c&&n.scales?(Gt(n.scales),Zt(e=>e+1),Qt.current=r):s&&n.scales&&r-Qt.current>=33&&(Zt(e=>e+1),Qt.current=r),Ue?.showBadge&&Jt(!!g),(s||null!=n.activeTransition||u.pending)&&_t()},function(e){const{hydrated:t,wasHydratingFromSSR:o,storeRef:n,dirtyRef:r,renderFnRef:i,cancelRender:s,cleanup:a}=e;zo(()=>{t&&o&&n.current?.cancelIntroAnimation?.(),r.current=!0,s?.(),i.current()},[t,o]);const l=(0,No.useRef)(a);l.current=a,(0,No.useEffect)(()=>()=>l.current?.(),[])}({hydrated:Rt,wasHydratingFromSSR:Lt,storeRef:io,dirtyRef:gt,renderFnRef:jt,cancelRender:Pt,cleanup:()=>ao.current?.clear()}),(0,u.useEffect)(()=>{gt.current=!0,_t()},[o,xt,wt,te,Ne,_t]),function(e,t,o,n,r,i){const s=(0,at.useRef)("fresh");(0,at.useEffect)(()=>{if(!e)return;const a=setInterval(()=>{const a=t.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=function(e,t){if(!e||0>=t)return ct;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:{...lt,...e.opacities??{}}[r],band:r,isStale:"fresh"!==r}}return t>o?{alpha:e.dimOpacity??.5,band:"stale",isStale:!0}:ct}(e,l-a.lastIngestTime);c.band===s.current&&c.isStale===r||(s.current=c.band,c.isStale!==r&&i(c.isStale),o.current=!0,n())},1e3);return()=>clearInterval(a)},[e,r,n])}(Ue,io,gt,_t,Ut,Jt);const Co=oo&&zt?pe?pe(zt):(0,ei.jsx)(Jr,{hover:zt}):null,jo="radial"===x,To=Co?(0,ei.jsx)(Xn,{x:zt?jo?zt.x+xt/2:zt.x:0,y:zt?jo?zt.y+wt/2:zt.y:0,containerWidth:xt,containerHeight:wt,margin:vt,className:"stream-ordinal-tooltip",children:Co}):null,Zo=ko(i,void 0,"__semiotic_resolvedO",""),Qo=ko(s,void 0,"__semiotic_resolvedR",""),Uo=Zo.key,Jo=Qo.key,en=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 s={...o};return n&&(s[e.key]=e.fn(o)),i&&(s[t.key]=t.fn(o)),s});return r?i:n}}(Zo,Qo,xe&&xe.length>0||!1);if(Fo||!Rt&&Lt){const e=io.current;e&&r&&(e.ingest({inserts:It,bounded:!0}),e.computeScene({width:xt,height:wt}));const t=e?.scene??[],o=e?.scales??null,n=Vt(He,o),i=Vt(Be,o),s="radial"===x,a=s?vt.left+xt/2:vt.left,l=s?vt.top+wt/2:vt.top;return(0,ei.jsxs)("div",{ref:pt,className:"stream-ordinal-frame"+(Fe?" "+Fe:""),role:"img","aria-label":ot||("string"==typeof De?De:"Ordinal chart"),style:{position:"relative",width:k?"100%":bt[0],height:S?"100%":bt[1]},children:[(0,ei.jsx)(Cn,{summary:nt}),(0,ei.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:bt[0],height:bt[1],style:{position:"absolute",left:0,top:0},children:[i&&(0,ei.jsx)("g",{transform:`translate(${vt.left},${vt.top})`,children:i}),(0,ei.jsxs)("g",{transform:`translate(${a},${l})`,children:[Ne&&(0,ei.jsx)("rect",{x:0,y:0,width:xt,height:wt,fill:Ne}),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=Do(i)+"-grad",n=function(e,t){const o=e.fillGradient;if(!o)return null;let n=e.x,r=e.y,i=e.x,s=e.y+e.h;"bottom"===e.roundedEdge?(r=e.y+e.h,s=e.y):"right"===e.roundedEdge?(n=e.x+e.w,r=e.y,i=e.x,s=e.y):"left"===e.roundedEdge&&(n=e.x,r=e.y,i=e.x+e.w,s=e.y);const a=[];if("colorStops"in o){const e=o.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>e.length)return null;for(let t=0;e.length>t;t++)a.push((0,Ho.jsx)("stop",{offset:e[t].offset,stopColor:e[t].color},t))}else{const t=Eo(e.style.fill);a.push((0,Ho.jsx)("stop",{offset:0,stopColor:t,stopOpacity:o.topOpacity},"0")),a.push((0,Ho.jsx)("stop",{offset:1,stopColor:t,stopOpacity:o.bottomOpacity},"1"))}return(0,Ho.jsx)("linearGradient",{id:t,gradientUnits:"userSpaceOnUse",x1:n,y1:r,x2:i,y2:s,children:a})}(t,o),r=n?`url(#${o})`:Eo(t.style.fill);if(t.cornerRadii&&Lo(t.cornerRadii)){const e=function(e){const{x:t,y:o,w:n,h:r}=e,{tl:i,tr:s,br:a,bl:l}=Io(e);let c=`M${t+i},${o}`;return c+=` L${t+n-s},${o}`,s>0&&(c+=` A${s},${s} 0 0 1 ${t+n},${o+s}`),c+=` L${t+n},${o+r-a}`,a>0&&(c+=` A${a},${a} 0 0 1 ${t+n-a},${o+r}`),c+=` L${t+l},${o+r}`,l>0&&(c+=` A${l},${l} 0 0 1 ${t},${o+r-l}`),c+=` L${t},${o+i}`,i>0&&(c+=` A${i},${i} 0 0 1 ${t+i},${o}`),c+=" Z",c}(t);return(0,Ho.jsxs)(Po.Fragment,{children:[n&&(0,Ho.jsx)("defs",{children:n}),(0,Ho.jsx)("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:s,w:a,h:l}=t;let c;switch(t.roundedEdge){case"right":c=`M${o},${s} L${o+a-e},${s} A${e},${e} 0 0 1 ${o+a},${s+e} L${o+a},${s+l-e} A${e},${e} 0 0 1 ${o+a-e},${s+l} L${o},${s+l} Z`;break;case"left":c=`M${o+a},${s} L${o+e},${s} A${e},${e} 0 0 0 ${o},${s+e} L${o},${s+l-e} A${e},${e} 0 0 0 ${o+e},${s+l} L${o+a},${s+l} Z`;break;case"bottom":c=`M${o},${s} L${o+a},${s} L${o+a},${s+l-e} A${e},${e} 0 0 1 ${o+a-e},${s+l} L${o+e},${s+l} A${e},${e} 0 0 1 ${o},${s+l-e} Z`;break;default:c=`M${o},${s+l} L${o},${s+e} A${e},${e} 0 0 1 ${o+e},${s} L${o+a-e},${s} A${e},${e} 0 0 1 ${o+a},${s+e} L${o+a},${s+l} Z`}return(0,Ho.jsxs)(Po.Fragment,{children:[n&&(0,Ho.jsx)("defs",{children:n}),(0,Ho.jsx)("path",{d:c,fill:r,opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})]},i)}return(0,Ho.jsxs)(Po.Fragment,{children:[n&&(0,Ho.jsx)("defs",{children:n}),(0,Ho.jsx)("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(0,Ho.jsx)("circle",{cx:t.x,cy:t.y,r:t.r,fill:Eo(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=oe(e.symbolType,e.size,e.path);return(0,Ho.jsx)("path",{d:n,transform:e.rotation?`translate(${e.x},${e.y}) rotate(${180*e.rotation/Math.PI})`:`translate(${e.x},${e.y})`,fill:e.style.fill?Eo(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=We(r,e.size);if(0>=i.scale)return null;const s=`translate(${t},${o})${e.rotation?` rotate(${180*e.rotation/Math.PI})`:""} translate(${i.offsetX},${i.offsetY}) scale(${i.scale})`,a=e.color??("string"==typeof e.style.fill?e.style.fill:void 0),l=Ye(r,e.fraction??1,e.fractionStart??0,e.fractionDirection??"horizontal"),c=l?Do(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:Ge(o.fill,a,e.accent),i=t?o.stroke&&"none"!==o.stroke?t:void 0:Ge(o.stroke??"none",a,e.accent);return r||i?(0,Ho.jsx)("path",{d:o.d,fill:r??"none",stroke:i,strokeWidth:i?o.strokeWidth??1:void 0,strokeLinecap:o.strokeLinecap,strokeLinejoin:o.strokeLinejoin,opacity:o.opacity},n):null});return(0,Ho.jsxs)("g",{transform:s,opacity:1===u?void 0:u,children:[l&&c&&(0,Ho.jsx)("clipPath",{id:c,children:(0,Ho.jsx)("rect",{x:l.x,y:l.y,width:l.width,height:l.height})}),l&&e.ghostColor?(0,Ho.jsx)("g",{children:d(e.ghostColor)}):null,l&&c?(0,Ho.jsx)("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=Do(`${o?o+"-":""}gauge-grad-${n.category||i}-${t}`),{clipPath:r,slices:s}=Bo({innerRadius:n.innerRadius,outerRadius:n.outerRadius,startAngle:n.startAngle,endAngle:n.endAngle,cornerRadius:n.cornerRadius,roundStart:n.roundedEnds?.start??!0,roundEnd:n.roundedEnds?.end??!0,colors:n._gradientBand.colors});return(0,Ho.jsxs)("g",{transform:`translate(${n.cx},${n.cy})`,opacity:n.style.opacity,fillOpacity:n.style.fillOpacity,children:[(0,Ho.jsx)("defs",{children:(0,Ho.jsx)("clipPath",{id:e,children:(0,Ho.jsx)("path",{d:r})})}),(0,Ho.jsx)("g",{clipPath:`url(#${e})`,children:s.map((e,t)=>(0,Ho.jsx)("path",{d:e.d,fill:Eo(e.color)},t))}),n.style.stroke&&"none"!==n.style.stroke&&(0,Ho.jsx)("path",{d:r,fill:"none",stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})]},i)}let r;if(n.roundedEnds)r=$o({innerRadius:n.innerRadius,outerRadius:n.outerRadius,startAngle:n.startAngle,endAngle:n.endAngle,cornerRadius:n.cornerRadius,roundStart:n.roundedEnds.start,roundEnd:n.roundedEnds.end});else{const e=(0,Ro.arc)().innerRadius(n.innerRadius).outerRadius(n.outerRadius).startAngle(n.startAngle+Math.PI/2).endAngle(n.endAngle+Math.PI/2);n.cornerRadius&&e.cornerRadius(n.cornerRadius),r=e(Oo)||""}return(0,Ho.jsx)("path",{d:r,transform:`translate(${n.cx},${n.cy})`,fill:Eo(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},i)}case"boxplot":{const t=e,o=t.columnWidth/2;return(0,Ho.jsxs)("g","vertical"===t.projection?{children:[(0,Ho.jsx)("line",{x1:t.x,y1:t.minPos,x2:t.x,y2:t.maxPos,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,Ho.jsx)("rect",{x:t.x-o,y:Math.min(t.q1Pos,t.q3Pos),width:t.columnWidth,height:Math.abs(t.q3Pos-t.q1Pos),fill:Eo(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,Ho.jsx)("line",{x1:t.x-o,y1:t.medianPos,x2:t.x+o,y2:t.medianPos,stroke:t.style.stroke||"#333",strokeWidth:2}),(0,Ho.jsx)("line",{x1:t.x-.5*o,y1:t.minPos,x2:t.x+.5*o,y2:t.minPos,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,Ho.jsx)("line",{x1:t.x-.5*o,y1:t.maxPos,x2:t.x+.5*o,y2:t.maxPos,stroke:t.style.stroke||"#333",strokeWidth:1})]}:{children:[(0,Ho.jsx)("line",{x1:t.minPos,y1:t.y,x2:t.maxPos,y2:t.y,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,Ho.jsx)("rect",{x:Math.min(t.q1Pos,t.q3Pos),y:t.y-o,width:Math.abs(t.q3Pos-t.q1Pos),height:t.columnWidth,fill:Eo(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,Ho.jsx)("line",{x1:t.medianPos,y1:t.y-o,x2:t.medianPos,y2:t.y+o,stroke:t.style.stroke||"#333",strokeWidth:2}),(0,Ho.jsx)("line",{x1:t.minPos,y1:t.y-.5*o,x2:t.minPos,y2:t.y+.5*o,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,Ho.jsx)("line",{x1:t.maxPos,y1:t.y-.5*o,x2:t.maxPos,y2:t.y+.5*o,stroke:t.style.stroke||"#333",strokeWidth:1})]},i)}case"violin":{const t=e,o=[(0,Ho.jsx)("path",{d:t.pathString,transform:t.translateX||t.translateY?`translate(${t.translateX},${t.translateY})`:void 0,fill:Eo(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:t.style.strokeWidth||1},r("path"))];if(t.iqrLine&&t.bounds){const e=t.bounds,n=e.x+e.width/2,i=e.y+e.height/2;e.height>e.width?o.push((0,Ho.jsx)("line",{x1:n,y1:t.iqrLine.q1Pos,x2:n,y2:t.iqrLine.q3Pos,stroke:t.style.stroke||"#333",strokeWidth:2},r("iqr")),(0,Ho.jsx)("circle",{cx:n,cy:t.iqrLine.medianPos,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},r("med"))):o.push((0,Ho.jsx)("line",{x1:t.iqrLine.q1Pos,y1:i,x2:t.iqrLine.q3Pos,y2:i,stroke:t.style.stroke||"#333",strokeWidth:2},r("iqr")),(0,Ho.jsx)("circle",{cx:t.iqrLine.medianPos,cy:i,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},r("med")))}return(0,Ho.jsx)("g",{children:o},i)}case"connector":return(0,Ho.jsx)("line",{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stroke:e.style.stroke||"#999",strokeWidth:e.style.strokeWidth||1,opacity:e.style.opacity??.5},i);case"trapezoid":{const t=e,o=t.points.map(e=>`${e[0]},${e[1]}`).join(" ");return(0,Ho.jsx)("polygon",{points:o,fill:Eo(t.style.fill,"#999"),opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},i)}default:return null}}(e,t,Mt)).filter(Boolean)]})]}),(0,ei.jsx)(wo,{width:xt,height:wt,totalWidth:bt[0],totalHeight:bt[1],margin:vt,scales:o,showAxes:te,showCategoryTicks:ne,oLabel:Tt,rLabel:$t,oFormat:Bt,rFormat:Ht,rTickValues:he,tickLabelEdgeAlign:fe,axisExtent:ge,showGrid:Se,title:De,legend:Ae,legendHoverBehavior:Me,legendClickBehavior:Ce,legendHighlightedCategory:je,legendIsolatedCategories:Pe,legendPosition:Le,legendLayout:Ie,foregroundGraphics:Re(n,Oe(io.current?.customLayoutOverlays,ft??null)),annotations:xe,autoPlaceAnnotations:we,svgAnnotationRules:ke,annotationFrame:0,xAccessor:Uo,yAccessor:Jo,annotationData:en(e?.getData())}),ze&&"radial"===x&&(0,ei.jsx)("div",{style:{position:"absolute",left:vt.left+xt/2,top:vt.top+wt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:ze})]})}return(0,ei.jsxs)("div",{ref:pt,className:"stream-ordinal-frame"+(Fe?" "+Fe:""),role:"group","aria-label":ot||("string"==typeof De?De:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:k?"100%":bt[0],height:S?"100%":bt[1],overflow:"visible"},onKeyDown:Ao,children:[tt&&(0,ei.jsx)(jn,{tableId:Mt}),tt&&(0,ei.jsx)(Mn,{scene:io.current?.scene??[],chartType:o+" chart",tableId:Mt,chartTitle:"string"==typeof De?De:void 0}),(0,ei.jsx)(Cn,{summary:nt}),(0,ei.jsx)(_n,{hoverPoint:zt}),(0,ei.jsxs)("div",{role:"img","aria-label":ot||("string"==typeof De?De:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:oo?Mo:void 0,onMouseLeave:oo?yo:void 0,onClick:ve?po:void 0,children:[Yt&&(0,ei.jsx)("svg",{style:{position:"absolute",top:0,left:0,width:bt[0],height:bt[1],pointerEvents:"none"},children:(0,ei.jsx)("g",{transform:`translate(${vt.left},${vt.top})`,children:Yt})}),(0,ei.jsx)(vo,{width:xt,height:wt,totalWidth:bt[0],totalHeight:bt[1],margin:vt,scales:qt,showAxes:te,showGrid:Se,rFormat:Ht,rTickValues:he,axisExtent:ge}),(0,ei.jsx)("canvas",{ref:Ot,"aria-label":hn(io.current?.scene??[],o+" chart"),style:{position:"absolute",top:0,left:0,width:bt[0],height:bt[1]}}),(0,ei.jsx)(wo,{width:xt,height:wt,totalWidth:bt[0],totalHeight:bt[1],margin:vt,scales:qt,showAxes:te,showCategoryTicks:ne,oLabel:Tt,rLabel:$t,oFormat:Bt,rFormat:Ht,rTickValues:he,axisExtent:ge,showGrid:Se,title:De,legend:Ae,legendHoverBehavior:Me,legendClickBehavior:Ce,legendHighlightedCategory:je,legendIsolatedCategories:Pe,legendPosition:Le,legendLayout:Ie,foregroundGraphics:Re(Xt,Oe(io.current?.customLayoutOverlays,ft??null)),annotations:xe,autoPlaceAnnotations:we,svgAnnotationRules:ke,annotationFrame:Kt,xAccessor:Uo,yAccessor:Jo,annotationData:en(io.current?.getData()),underlayRendered:!0}),(Je||et)&&"radial"!==x&&(0,ei.jsx)(_o,{width:xt,height:wt,totalWidth:bt[0],totalHeight:bt[1],margin:vt,scales:qt,onBrush:et||(()=>{})}),ze&&"radial"===x&&(0,ei.jsx)("div",{style:{position:"absolute",left:vt.left+xt/2,top:vt.top+wt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:ze}),Ue?.showBadge&&(0,ei.jsx)(dt,{isStale:Ut,position:Ue.badgePosition}),(0,ei.jsx)(Ln,{active:bo.current>=0,hoverPoint:zt,margin:vt,size:bt,shape:xo.current?.shape,width:xo.current?.w,height:xo.current?.h}),To]})]})}));oi.displayName="StreamOrdinalFrame";var ni=oi;function ri(e){const{title:t,description:o,summary:n,accessibleTable:r,className:i,animate:s,axisExtent:a,autoPlaceAnnotations:l}=e,c={};return t&&(c.title=t),o&&(c.description=o),n&&(c.summary=n),void 0!==r&&(c.accessibleTable=r),i&&(c.className=i),null!=s&&(c.animate=s),void 0!==a&&(c.axisExtent=a),void 0!==l&&(c.autoPlaceAnnotations=l),c}function ii(e){const{linkedHover:t,selection:o,onObservation:n,onClick:r,hoverRadius:i,hoverHighlight:s,forceHoverBehavior:a,forceClickBehavior:l,mobileInteraction:c,customHoverBehavior:u,customClickBehavior:d,linkedHoverInClickPredicate:h=!0}=e,f={},g=c?.enabled?Math.max(i??30,Math.ceil((c.targetSize||44)/2),24):i;return(a||t||n||r||s)&&(f.customHoverBehavior=u),d&&(l||(h?n||r||t:n||r)||c?.enabled&&(c.tapToSelect||c.tapToLockTooltip)&&(t||s||o))&&(f.customClickBehavior=d),null!=g&&(f.hoverRadius=g),f}function si(e){const{tooltip:t,defaultTooltipContent:o}=e;return{tooltipContent:!1===t?()=>null:Gn(t)||o}}var ai=require("react"),li=require("react"),ci=require("react"),ui=(require("react/jsx-runtime"),(0,ci.createContext)(null));function di(){return(0,ci.useContext)(ui)}var hi=require("react");function fi(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 gi(e,t){let o=e.get(t);return o||(o={name:t,resolution:"union",clauses:new Map},e.set(t,o)),o}function mi(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[yi,pi]=Un(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||!mi(n,o))return!1}return!0}(r,o))return{};const i=new Map(e.selections),s=gi(i,t),a=new Map(s.clauses);return a.set(o.clientId,o),i.set(t,{...s,clauses:a}),{selections:i}})},clearClause(t,o){e(e=>{const n=e.selections.get(t);if(!n||!n.clauses.has(o))return{};const r=new Map(e.selections),i=new Map(n.clauses);return i.delete(o),r.set(t,{...n,clauses:i}),{selections:r}})},setResolution(t,o){e(e=>{const n=e.selections.get(t);if(n?.resolution===o)return{};const r=new Map(e.selections),i=gi(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}})}})),[bi,vi]=Un(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}))}})),xi=require("react"),wi=(require("react"),{positions:new Map}),ki=new Set;function Si(){for(const e of ki)e()}function Ai(e,t){const o=wi.positions.get(e);if(o?.locked)return;if(!o||o.sourceId!==t)return;const n=new Map(wi.positions);n.delete(e),wi={positions:n},Si()}function Mi(e,t){const o=wi.positions.get(e);if(!o?.locked)return;if(t&&o.sourceId!==t)return;const n=new Map(wi.positions);n.delete(e),wi={positions:n},Si()}function Ci(e){const t=(0,xi.useId)(),o=e.clientId||t,{name:n}=e,r=pi(e=>e.selections.get(n)),i=pi(e=>e.setClause),s=pi(e=>e.clearClause),a=(0,xi.useMemo)(()=>!!r&&r.clauses.size>0,[r]);return{predicate:(0,xi.useMemo)(()=>r&&0!==r.clauses.size?function(e,t){const o=[];for(const[n,r]of e.clauses)"crossfilter"===e.resolution&&n===t||o.push(fi(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:a,selectPoints:(0,xi.useCallback)(e=>{const t={};let r=!1;for(const[o,n]of Object.entries(e))t[o]={type:"point",values:new Set(n)},r=!0;r&&i(n,{clientId:o,type:"point",fields:t})},[o,n,i]),selectInterval:(0,xi.useCallback)(e=>{const t={};let r=!1;for(const[o,n]of Object.entries(e))t[o]={type:"interval",range:n},r=!0;r&&i(n,{clientId:o,type:"interval",fields:t})},[o,n,i]),clear:(0,xi.useCallback)(()=>{s(n,o)},[s,n,o]),clientId:o}}function ji(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function _i(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}require("react/jsx-runtime");var Pi=(0,hi.createContext)(!1);(0,hi.createContext)(!1);var Ri=(0,hi.createContext)(null),Li="undefined"==typeof window?hi.useEffect:hi.useLayoutEffect;function Ii(e){const t=(0,hi.useContext)(Ri),o=(0,hi.useId)(),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=(0,hi.useRef)([]);(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;Li(()=>{if(t)return()=>t.unregisterCategories(o)},[t,o]),Li(()=>{t&&t.registerCategories(o,i)},[t,o,i])}function Ti({data:e,colorBy:t,colorScale:o,getColor:n,strokeColor:r,strokeWidth:i,categories:s}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",o={fill:t,stroke:t};return void 0!==r&&(o.stroke=r),void 0!==i&&(o.strokeWidth=i),o},type:"fill",items:(s&&s.length>0?s:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((r,i)=>{const s=e.find("function"==typeof t?e=>t(e)===r:e=>e[t]===r),a=s?n(s,t,o):o?o(r):V[i%V.length];return{label:r+"",color:a}}),label:""}]}}var $i=l(require("react"));function Bi(){return lr(e=>e.theme)}function Hi(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function Oi(e,t){const{when:o}=e,n=t.width,r=t.height,i=function(e){if("number"==typeof e.height&&e.height>0)return e.width/e.height}(t),s=function(e){if("number"==typeof e.height&&e.height>0)return e.height>e.width?"portrait":"landscape"}(t);return!("number"==typeof o.minWidth&&o.minWidth>n||"number"==typeof o.maxWidth&&n>o.maxWidth||"number"==typeof o.minHeight&&("number"!=typeof r||o.minHeight>r)||"number"==typeof o.maxHeight&&("number"!=typeof r||r>o.maxHeight)||"number"==typeof o.minAspectRatio&&("number"!=typeof i||o.minAspectRatio>i)||"number"==typeof o.maxAspectRatio&&("number"!=typeof i||i>o.maxAspectRatio)||o.orientation&&s!==o.orientation)}function Ei(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=>Oi(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"])Hi(e[n])&&Hi(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 Di(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 Fi(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 Ni(e){if(!e)return!1;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}require("react/jsx-runtime"),$i.createContext(void 0);var zi={enabled:!0,tapToSelect:!0,tapToLockTooltip:!0,clearSelection:"backgroundTap",targetSize:44,snap:"nearestDatum",brushHandleSize:44,standardControls:!1,enabled:!1,tapToSelect:!1,tapToLockTooltip:!1};function Wi(e,t={}){const o=t.mobileSemantics?.interaction,n="number"==typeof o?.targetSize?o.targetSize:"number"==typeof t.mobileSemantics?.minimumHitTarget?t.mobileSemantics.minimumHitTarget:void 0,r="mobile"===t.mode||"number"==typeof t.width&&480>=t.width,i=!!o||void 0!==n,s=e&&"object"==typeof e?e:void 0;if(!1===e||!1===s?.enabled||void 0===e&&!r&&!i)return zi;const a=s??{};return{enabled:!0,tapToSelect:a.tapToSelect??!0,tapToLockTooltip:a.tapToLockTooltip??!0,clearSelection:a.clearSelection??"backgroundTap",targetSize:a.targetSize??n??44,snap:a.snap??"nearestDatum",brushHandleSize:a.brushHandleSize??44,standardControls:a.standardControls??!1}}function qi(){const e=Bi(),t=e?.colors?.categorical;return t&&t.length>0?t:void 0}function Gi(e,t,o){return(0,li.useMemo)(()=>{if(!t||"auto"===t||"function"==typeof t)return e;const n=[...e],r="function"==typeof(i=o)?i:e=>e[i];var i;return n.sort("asc"===t?(e,t)=>r(e)-r(t):(e,t)=>r(t)-r(e))},[e,t,o])}var Vi={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 Xi(e,t,o){const n=Vi[e||"primary"],r=e&&"primary"!==e||!o?.width?n.width:o.width,i=e&&"primary"!==e||!o?.height?n.height:o.height,s=Ei({...t,mode:e},{width:t.width??r,height:t.height??i}).props,a=s.mode||e,l=Vi[a||"primary"],c="context"===a||"sparkline"===a,u=a&&"primary"!==a||!o?.width?l.width:o.width;return{width:s.width??u,height:s.height??(a&&"primary"!==a||!o?.height?l.height:o.height),showAxes:s.showAxes??l.showAxes,showGrid:s.showGrid??l.showGrid,enableHover:s.enableHover??(!!s.linkedHover||l.enableHover),showLegend:s.showLegend??l.showLegend,showLabels:s.showLabels??l.showLabels,title:c?void 0:s.title,description:s.description,summary:s.summary,accessibleTable:s.accessibleTable,xLabel:c?void 0:s.xLabel,yLabel:c?void 0:s.yLabel,categoryLabel:c?void 0:s.categoryLabel,valueLabel:c?void 0:s.valueLabel,marginDefaults:Yi(l.marginDefaults,s.showCategoryTicks,s.orientation),compactMode:c,mobileInteraction:Wi(s.mobileInteraction,{mode:a,width:s.width??u,mobileSemantics:s.mobileSemantics}),mobileSemantics:s.mobileSemantics}}function Yi(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}var Ki=require("react/jsx-runtime");function Zi(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function Qi(e,t){if(!t)return Zi(e);try{const o=t(e);return null==o?Zi(e):o}catch{return Zi(e)}}function Ui(e,t){return"function"==typeof t?t(e):e[t]}function Ji({categoryAccessor:e,valueAccessor:t,groupAccessor:o,groupLabel:n,pieData:r=!1,valueFormat:i}){return s=>{const a=r?s.data?.[0]||s.data||s:s.data||s,l=Ui(a,e),c=Ui(a,t),u=o?Ui(a,o):void 0;return(0,Ki.jsxs)("div",{className:"semiotic-tooltip",style:Nn,children:[(0,Ki.jsx)("div",{style:{fontWeight:"bold"},children:Zi(l)}),(0,Ki.jsx)("div",{style:{marginTop:4},children:Qi(c,i)}),null!=u&&(0,Ki.jsxs)("div",{style:{marginTop:2,opacity:.8},children:[n||(d=o,"string"==typeof d?d:"value"),": ",Zi(u)]})]});var d}}var es=require("react/jsx-runtime");function ts({componentName:e,message:t,diagnosticHint:o,width:n,height:r}){return(0,es.jsx)("div",{role:"alert",style:{width:n,height:Math.max(r,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:(0,es.jsxs)("div",{style:{textAlign:"center",maxWidth:400},children:[(0,es.jsx)("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:e}),(0,es.jsx)("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:t}),o&&(0,es.jsx)("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:o})]})})}var os=l(require("react")),ns=require("react/jsx-runtime"),rs=class extends os.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){this.props.onError?.(e,t)}render(){if(this.state.error){const{fallback:e}=this.props,t=this.state.error;return"function"==typeof e?e(t):void 0!==e?e:(0,ns.jsx)(ts,{componentName:"ChartErrorBoundary",message:t.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}},is=require("react/jsx-runtime"),ss="undefined"!=typeof process&&"production"!==process.env?.NODE_ENV;function as({componentName:e,width:t,height:o,children:n}){return(0,is.jsx)(rs,{fallback:n=>(0,is.jsx)(ts,{componentName:e,message:n.message,width:t,height:o}),children:n})}var ls={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"},cs={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function us(e,t,o,n){if(!ss)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 ds(e,t){const o=e.length,n=t.length,r=Array(n+1);for(let e=0;n>=e;e++)r[e]=e;for(let i=1;o>=i;i++){let o=r[0];r[0]=i;for(let s=1;n>=s;s++){const n=r[s];r[s]=e[i-1]===t[s-1]?o:1+Math.min(o,r[s],r[s-1]),o=n}}return r[n]}function hs(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=ds(e.toLowerCase(),o.toLowerCase());r>t&&(r=t,n=o)}return r>o?void 0:n}(e,t,3)??null)}function fs({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=hs(i,t),n=o?` Try ${r}="${o}".`:"";return`${e}: ${r} "${i}" not found in data. Available fields: ${t.join(", ")}.${n}`}}}return null}var gs=require("react"),ms=require("react");function ys(e){const{data:t,rawData:o,colorBy:n,colorScheme:r,legendInteraction:i,legendPosition:s,selection:a,linkedHover:l,fallbackFields:c,unwrapData:u=!1,onObservation:d,chartType:f,chartId:g,showLegend:m,userMargin:y,marginDefaults:p,onClick:b,hoverHighlight:v,mobileInteraction:x,mobileSemantics:w,loading:k,loadingContent:S,emptyContent:A,width:M,height:C}=e,j=void 0===o,_=(0,gs.useMemo)(()=>h(t),[t]),[P,R]=(0,gs.useState)([]),L=(0,gs.useCallback)(e=>{R(t=>t.length===e.length&&t.every((t,o)=>t===e[o])?t:e)},[]),I="string"==typeof e.colorBy?e.colorBy:void 0,T=(0,gs.useMemo)(()=>Wi(x,{width:M,mobileSemantics:w}),[x,M,w]),{activeSelectionHook:$,hoverSelectionHook:B,customHoverBehavior:H,customClickBehavior:O,crosshairSourceId:E}=function({selection:e,linkedHover:t,fallbackFields:o=[],unwrapData:n=!1,onObservation:r,chartType:i,chartId:s,onClick:a,hoverHighlight:l,colorByField:c,mobileInteraction:u}){const d=(0,li.useId)(),h=function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField,seriesField:e.seriesField}:null}(t,o),f="series"===h?.mode?[h.seriesField||c||o[0]].filter(e=>!!e):h?.fields||o||[],g=Ci({name:e?.name||"__unused__",fields:f}),m=function(e){const t=e.name||"hover",{fields:o}=e,{predicate:n,isActive:r,selectPoints:i,clear:s}=Ci({name:t,fields:o});return{onHover:(0,xi.useCallback)(e=>{if(!e)return void s();const t={};for(const n of o){const o=e[n];void 0!==o&&(t[n]=[o])}_i(t)&&i(t)},[o,i,s,t]),predicate:n,isActive:r}}({name:h?.name||"hover",fields:f}),y=vi(e=>e.pushObservation),p=e?{isActive:g.isActive,predicate:g.predicate}:null,[b,v]=(0,li.useState)(null),x=(0,li.useRef)(!1),w=c||o[0],k=(0,li.useMemo)(()=>{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=(0,li.useCallback)(e=>{const o=!e&&x.current&&!!u?.enabled&&u.tapToLockTooltip;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===h?.mode&&h.xField){const o=Di(e,t,h.xField);null!=o&&function(e,t,o){const n=wi.positions.get(e);n?.locked||n&&n.xValue===t&&n.sourceId===o||(wi={positions:new Map(wi.positions).set(e,{xValue:t,sourceId:o})},Si())}(h.name||"hover",o,d)}"x-position"!==h?.mode&&m.onHover(t)}else"x-position"!==h?.mode||o||Ai(h.name||"hover",d),"x-position"===h?.mode||o||m.onHover(null);if(l&&w)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const o=t?.[w];v(null!=o?o+"":null)}else o||v(null);if(r||y){const t={timestamp:Date.now(),chartType:i||"unknown",chartId:s};if(e){const o=Fi(e),n={...t,type:"hover",datum:o||{},x:e.x??0,y:e.y??0};r&&r(n),y&&y(n)}else{const e={...t,type:"hover-end"};r&&r(e),y&&y(e)}}},[t,m,h,d,r,i,s,y,l,w,u]),A=(0,li.useCallback)((o=!0)=>{x.current=!1,t&&"x-position"!==h?.mode&&m.onHover(null),e&&u?.tapToSelect&&g.clear(),o&&l&&v(null),"x-position"===h?.mode&&(Mi(h.name||"hover",d),Ai(h.name||"hover",d))},[t,h,m,e,u,g,l,d]),M=(0,li.useCallback)(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=Di(o,e,h.xField);null!=t&&function(e,t,o){const n=wi.positions.get(e);if(n?.locked){const t=new Map(wi.positions);return t.delete(e),wi={positions:t},Si(),!1}wi={positions:new Map(wi.positions).set(e,{xValue:t,sourceId:o,locked:!0})},Si()}(h.name||"hover",t,d)}if(n)if(o){x.current=!0;const n=Fi(o);if(t&&"x-position"!==h?.mode&&m.onHover(n),e&&u?.tapToSelect&&f.length>0){const e={};for(const t of f){const o=n[t];void 0!==o&&(e[t]=[o])}Ni(e)&&g.selectPoints(e)}if(l&&w){const e=n?.[w];v(null!=e?e+"":null)}}else c&&A();if(o||c){if(o&&a){let e=o.data||o.datum||o;Array.isArray(e)&&(e=e[0]),a(e,{x:o.x??0,y:o.y??0})}if(r||y){const e={timestamp:Date.now(),chartType:i||"unknown",chartId:s};if(o){const t=Fi(o),n={...e,type:"click",datum:t||{},x:o.x??0,y:o.y??0};r&&r(n),y&&y(n)}else{const t={...e,type:"click-end"};r&&r(t),y&&y(t)}}}},[a,r,y,i,s,h,d,u,t,m,e,g,f,l,w,A]);return(0,li.useEffect)(()=>{if(!u?.enabled||"undefined"==typeof document)return;const e=e=>{"Escape"===e.key&&x.current&&A()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[u?.enabled,A]),(0,li.useEffect)(()=>()=>{x.current&&A(!1)},[A]),(0,li.useEffect)(()=>{if("x-position"!==h?.mode)return;const e=h.name||"hover";return()=>{Mi(e,d),Ai(e,d)}},[h?.mode,h?.name,d]),{activeSelectionHook:p,hoverSelectionHook:k,customHoverBehavior:S,customClickBehavior:M,crosshairSourceId:d}}({selection:a,linkedHover:l,fallbackFields:c,unwrapData:u,onObservation:d,chartType:f,chartId:g,onClick:b,hoverHighlight:v,colorByField:I,mobileInteraction:T}),D=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,E),F=function(e,t,o){const n=di(),r=qi();return(0,li.useMemo)(()=>{if(!t)return;const i=n??void 0,s=o??(r&&r.length>0?r:void 0)??"category10";if(0!==e.length){if("function"==typeof t){const o=Array.from(new Set(e.map(e=>t(e)+"")));if(i&&Ni(i)){const e=Z(o.map(e=>({_cat:e})),"_cat",s);return t=>i[t]||e(t)}return Z(o.map(e=>({_cat:e})),"_cat",s)}if(i&&Ni(i)){const o=Z(e,t,s);return e=>i[e]||o(e)}return Z(e,t,s)}if(i&&Ni(i)){const e=Z([{_:"a"}],"_",s);return t=>i[t]||e(t)}},[e,t,o,n,r])}(_,n,r),N=(0,gs.useMemo)(()=>{if(!n)return[];const e=new Set;for(const t of _){const o="function"==typeof n?n(t):t[n];null!=o&&e.add(o+"")}return Array.from(e)},[_,n]),z=(0,gs.useMemo)(()=>j&&P.length>0?P:N,[j,P,N]),W=function(e,t,o){const[n,r]=(0,li.useState)(null),[i,s]=(0,li.useState)(new Set),a=(0,li.useMemo)(()=>new Set,[]),l=(0,li.useCallback)(t=>{"highlight"===e&&r(t?t.label:null)},[e]),c=(0,li.useCallback)(t=>{"isolate"===e&&s(e=>{const n=new Set(e);return n.has(t.label)?n.delete(t.label):n.add(t.label),n.size===o.length?new Set:n})},[e,o.length]),u=(0,li.useMemo)(()=>{if(!e||"none"===e||!t)return null;const o="string"==typeof t?t:null;return"highlight"===e&&null!=n?{isActive:!0,predicate:e=>(o?e[o]:"function"==typeof t?t(e):null)===n}:"isolate"===e&&i.size>0?{isActive:!0,predicate:e=>{const n=o?e[o]:"function"==typeof t?t(e):null;return i.has(n)}}:null},[e,t,n,i]);return{highlightedCategory:"highlight"===e?n:null,isolatedCategories:"isolate"===e?i:a,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}(i,n,z),q=(0,gs.useMemo)(()=>B||(W.legendSelectionHook?W.legendSelectionHook:$),[B,W.legendSelectionHook,$]),G=function(e){const t=lr(e=>e.theme.colors.selectionOpacity);return(0,ms.useMemo)(()=>{if(void 0!==e||void 0!==t)return{name:e?.name??"",...e,unselectedOpacity:e?.unselectedOpacity??t}},[e,t])}(a),X=qi(),K=di(),Q=(0,gs.useMemo)(()=>{if(F)return F;if(!n||0===z.length)return;const e=Array.isArray(r)&&r.length>0||"string"==typeof r&&r.length>0?r:X&&X.length>0?X:V,t="__streamCat",o=Z(z.map(e=>({[t]:e})),t,e);return e=>K?.[e]||o(e)||"#999"},[F,n,z,r,X,K]),{legend:U,margin:J,legendPosition:ee}=function({data:e,colorBy:t,colorScale:o,showLegend:n,legendPosition:r="right",userMargin:i,defaults:s={top:50,bottom:60,left:70,right:40},categories:a}){const l=(0,hi.useContext)(Pi),c=null!==(0,hi.useContext)(Ri),u=void 0!==n?n:!l&&!!t,d=!!t&&(u||c),h=(0,li.useMemo)(()=>{if(!d)return[];if(void 0!==a)return a;const o=new Set;for(const n of e){const e="function"==typeof t?t(n):n[t];null!=e&&o.add(e+"")}return Array.from(o)},[a,t,e,d]);Ii(c&&t?h:[]);const f=(0,li.useMemo)(()=>{if(!u||!t)return;const n=Ti({data:e,colorBy:t,colorScale:o,getColor:Y,categories:h});return 0!==n.legendGroups.reduce((e,t)=>e+t.items.length,0)?n:void 0},[u,t,e,o,h]),g=(0,li.useMemo)(()=>{const e="number"==typeof i?{top:i,bottom:i,left:i,right:i}:i??{},t=t=>{const o=e[t];return"number"==typeof o?o:s[t]},o={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},n=t=>"number"==typeof e[t];return f&&("right"===r&&!n("right")&&110>o.right?o.right=110:"left"===r&&!n("left")&&110>o.left?o.left=110:"top"===r&&!n("top")&&50>o.top?o.top=50:"bottom"===r&&!n("bottom")&&80>o.bottom&&(o.bottom=80)),o},[s,i,f,r]);return{legend:f,margin:g,legendPosition:r}}({data:_,colorBy:n,colorScale:Q,showLegend:m,legendPosition:s,userMargin:y,defaults:p,categories:z}),te=(0,gs.useMemo)(()=>{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),j&&n&&(e.legendCategoryAccessor=n,e.onCategoriesChange=L),e},[U,ee,i,W.onLegendHover,W.onLegendClick,W.highlightedCategory,W.isolatedCategories,j,n,L]),oe=Array.isArray(o)?h(o):o,ne=function(e,t,o,n){if(!e)return null;if(!1===n)return null;if(null!=n)return(0,is.jsx)("div",{style:{width:t,height:o,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:n});const r=Math.min(5,Math.floor(o/40)),i=Math.max(8,Math.floor(o/(3*r))),s=Math.max(6,Math.floor(o/(2.5*r))),a=Math.floor((o-(r*(i+s)-s))/2);return(0,is.jsx)("div",{style:{width:t,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:r},(e,o)=>(0,is.jsx)("div",{className:"semiotic-loading-bar",style:{...cs,position:"absolute",top:a+o*(i+s),left:Math.floor(.1*t),width:30+(37*o+13)%50+"%",height:i,opacity:.5+o%2*.2}},o))})}(k,M,C,S),re=ne?null:function(e,t,o,n){return!1===n||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?(0,is.jsx)("div",{style:{...ls,width:t,height:o},children:n||"No data available"}):null}(oe,M,C,A);return{data:_,colorScale:F,allCategories:z,legendState:W,effectiveSelectionHook:q,activeSelectionHook:$,customHoverBehavior:H,customClickBehavior:O,mobileInteraction:T,legend:U,margin:J,legendPosition:ee,earlyReturn:ne||re||null,legendBehaviorProps:te,crosshairProps:D,resolvedSelection:G}}var ps=require("react");function bs({ref:e,frameRef:t,setup:o}){return(0,ps.useImperativeHandle)(e,()=>({push:e=>t.current?.push(e),pushMany:e=>t.current?.pushMany(e),remove:e=>t.current?.remove(e)??[],update:(e,o)=>t.current?.update(e,o)??[],clear:()=>t.current?.clear(),getData:()=>t.current?.getData()??[],getScales:()=>t.current?.getScales()??null}),[t]),{effectiveLegendProps:o.legendBehaviorProps,effectiveMargin:o.margin}}var vs=require("react");function xs(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 ws(e){const{colorBy:t,colorScale:o,color:n,themeCategorical:r,colorScheme:i,categoryIndexMap:s,userPieceStyle:a,stroke:l,strokeWidth:c,opacity:u,effectiveSelectionHook:d,resolvedSelection:h,cycleByCategory:f=!1,baseStyleExtras:g,linkStrokeToFill:m=!1}=e,y=(0,vs.useMemo)(()=>(e,a)=>{const l="function"==typeof g?g(e,a):g,c=l?{...l}:{};if(void 0===c.fill)if(t){if(!o)return c;c.fill=Y(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=K(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=q[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?a:void 0,s);return m&&void 0===c.stroke&&void 0!==c.fill&&(c.stroke=c.fill),c},[t,o,n,r,i,s,f,g,m]),p=(0,vs.useMemo)(()=>xs(a?"function"==typeof a?(e,t)=>({...y(e,t),...a(e,t)||{}}):(e,t)=>({...y(e,t),...a}):y,{stroke:l,strokeWidth:c,opacity:u}),[y,a,l,c,u]);return(0,vs.useMemo)(()=>{return e=p,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},[p,d,h])}function ks(e){if(!e)return;const t="boolean"==typeof e?{}:"string"==typeof e?{method:e}:e;return{type:"trend",method:t.method??"linear",...null!=t.bandwidth&&{bandwidth:t.bandwidth},...null!=t.order&&{order:t.order},...null!=t.color&&{color:t.color},...null!=t.strokeWidth&&{strokeWidth:t.strokeWidth},...null!=t.strokeDasharray&&{strokeDasharray:t.strokeDasharray},...null!=t.label&&{label:t.label}}}var Ss=require("react/jsx-runtime"),As=(0,ai.forwardRef)(function(e,t){const o=Xi(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=(0,ai.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="vertical",valueFormat:u,colorBy:d,colorScheme:f,sort:g=!1,barPadding:m=40,roundedTop:y,gradientFill:p=!1,baselinePadding:b=!1,tooltip:v,annotations:x,regression:w,valueExtent:k,frameProps:S={},selection:A,linkedHover:M,onObservation:C,onClick:j,hoverHighlight:_,chartId:P,loading:R,loadingContent:L,emptyContent:I,legendInteraction:T,legendPosition:$,color:B,stroke:H,strokeWidth:O,opacity:E,showCategoryTicks:D,categoryFormat:F,dataIdAccessor:N}=e,{width:z,height:W,enableHover:q,showGrid:G,showLegend:V,title:X,description:Y,summary:K,accessibleTable:Z,categoryLabel:Q,valueLabel:U}=o,J=(0,ai.useMemo)(()=>h(r),[r]),ee=ys({data:J,rawData:r,colorBy:d,colorScheme:f,legendInteraction:T,legendPosition:$,selection:A,linkedHover:M,fallbackFields:d?["string"==typeof d?d:""]:[],unwrapData:!0,onObservation:C,onClick:j,hoverHighlight:_,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"BarChart",chartId:P,showLegend:V,userMargin:i,marginDefaults:o.marginDefaults,loading:R,loadingContent:L,emptyContent:I,width:z,height:W}),{effectiveLegendProps:te,effectiveMargin:oe}=bs({ref:t,frameRef:n,setup:ee});us("BarChart",J,"categoryAccessor",a),us("BarChart",J,"valueAccessor",l);const ne=Gi(J,g,l),re=qi(),ie=(0,ai.useMemo)(()=>new Map,[J]),se=ws({colorBy:d,colorScale:ee.colorScale,color:B,themeCategorical:re,colorScheme:f,categoryIndexMap:ie,userPieceStyle:S?.pieceStyle,stroke:H,strokeWidth:O,opacity:E,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection}),ae=(0,ai.useMemo)(()=>Ji({categoryAccessor:a,valueAccessor:l,groupAccessor:d&&d!==a?d:void 0,groupLabel:"string"==typeof d?d:"group",valueFormat:u}),[a,l,d,u]);if(ee.earlyReturn)return ee.earlyReturn;const le=fs({componentName:"BarChart",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(le)return(0,Ss.jsx)(ts,{componentName:"BarChart",message:le,width:z,height:W});const ce=ks(w),ue=ce?[ce,...x||[]]:x,de={chartType:"bar",...null!=r&&{data:ne},oAccessor:a,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",pieceStyle:se,size:[z,W],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:oe,barPadding:m,...null!=y&&{roundedTop:y},...p&&{gradientFill:!0===p?{topOpacity:.8,bottomOpacity:.05}:p},...N&&{dataIdAccessor:N},baselinePadding:b,enableHover:q,showAxes:o.showAxes,oLabel:Q,rLabel:U,rFormat:u,...F&&{oFormat:F},showGrid:G,showCategoryTicks:D,oSort:g,...te,...ri({title:X,description:Y,summary:K,accessibleTable:Z,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...si({tooltip:v,defaultTooltipContent:ae}),...ii({linkedHover:M,selection:A,onObservation:C,onClick:j,hoverHighlight:_,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(0,Ss.jsx)(as,{componentName:"BarChart",width:z,height:W,children:(0,Ss.jsx)(ni,{ref:n,...de})})});As.displayName="BarChart";var Ms=require("react"),Cs=require("react/jsx-runtime"),js=(0,Ms.forwardRef)(function(e,t){const o=Xi(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=(0,Ms.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="category",stackBy:l,valueAccessor:c="value",orientation:u="vertical",valueFormat:d,colorBy:f,colorScheme:g,normalize:m=!1,sort:y=!1,barPadding:p=40,roundedTop:b,baselinePadding:v=!1,tooltip:x,annotations:w,valueExtent:k,frameProps:S={},selection:A,linkedHover:M,onObservation:C,onClick:j,hoverHighlight:_,chartId:P,loading:R,loadingContent:L,emptyContent:I,legendInteraction:T,legendPosition:$,color:B,stroke:H,strokeWidth:O,opacity:E,categoryFormat:D}=e,{width:F,height:N,enableHover:z,showGrid:W,showLegend:q,title:G,description:V,summary:X,accessibleTable:Y,categoryLabel:K,valueLabel:Z}=o,Q=(0,Ms.useMemo)(()=>h(r),[r]),U=f||l,J=ys({data:Q,rawData:r,colorBy:U,colorScheme:g,legendInteraction:T,legendPosition:$,selection:A,linkedHover:M,fallbackFields:U?["string"==typeof U?U:""]:[],unwrapData:!0,onObservation:C,onClick:j,hoverHighlight:_,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"StackedBarChart",chartId:P,showLegend:q,userMargin:i,marginDefaults:o.marginDefaults,loading:R,loadingContent:L,emptyContent:I,width:F,height:N}),ee=qi(),te=(0,Ms.useMemo)(()=>new Map,[Q]),oe=ws({colorBy:U,colorScale:J.colorScale,color:B,themeCategorical:ee,colorScheme:g,categoryIndexMap:te,userPieceStyle:S?.pieceStyle,stroke:H,strokeWidth:O,opacity:E,effectiveSelectionHook:J.effectiveSelectionHook,resolvedSelection:J.resolvedSelection}),ne=(0,Ms.useMemo)(()=>Ji({categoryAccessor:l,valueAccessor:c,groupAccessor:a,valueFormat:d}),[l,a,c,d]),re=fs({componentName:"StackedBarChart",data:r,accessors:{categoryAccessor:a,valueAccessor:c},requiredProps:{stackBy:l}}),{effectiveLegendProps:ie,effectiveMargin:se}=bs({ref:t,frameRef:n,setup:J});if(J.earlyReturn)return J.earlyReturn;const ae={chartType:"bar",...null!=r&&{data:Q},oAccessor:a,rAccessor:c,stackBy:l,normalize:m,oSort:y,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:oe,size:[F,N],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:se,barPadding:p,...null!=b&&{roundedTop:b},baselinePadding:v,enableHover:z,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:K,rLabel:Z,rFormat:d,...D&&{oFormat:D},showGrid:W,...ie,...ri({title:G,description:V,summary:X,accessibleTable:Y,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...si({tooltip:x,defaultTooltipContent:ne}),...ii({linkedHover:M,selection:A,onObservation:C,onClick:j,hoverHighlight:_,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?(0,Cs.jsx)(ts,{componentName:"StackedBarChart",message:re,width:F,height:N}):(0,Cs.jsx)(as,{componentName:"StackedBarChart",width:F,height:N,children:(0,Cs.jsx)(ni,{ref:n,...ae})})});js.displayName="StackedBarChart";var _s=require("react"),Ps=require("react/jsx-runtime"),Rs=(0,_s.forwardRef)(function(e,t){const o=Xi(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=(0,_s.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="category",groupBy:l,valueAccessor:c="value",orientation:u="vertical",valueFormat:d,colorBy:f,colorScheme:g,sort:m=!1,barPadding:y=60,roundedTop:p,baselinePadding:b=!1,tooltip:v,annotations:x,valueExtent:w,frameProps:k={},selection:S,linkedHover:A,onObservation:M,onClick:C,hoverHighlight:j,chartId:_,loading:P,loadingContent:R,emptyContent:L,legendInteraction:I,legendPosition:T,color:$,stroke:B,strokeWidth:H,opacity:O,categoryFormat:E}=e,{width:D,height:F,enableHover:N,showGrid:z,showLegend:W,title:q,description:G,summary:V,accessibleTable:X,categoryLabel:Y,valueLabel:K}=o,Z=(0,_s.useMemo)(()=>h(r),[r]),Q=f||l,U=ys({data:Z,rawData:r,colorBy:Q,colorScheme:g,legendInteraction:I,legendPosition:T,selection:S,linkedHover:A,fallbackFields:Q?["string"==typeof Q?Q:""]:[],unwrapData:!0,onObservation:M,onClick:C,hoverHighlight:j,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"GroupedBarChart",chartId:_,showLegend:W,userMargin:i,marginDefaults:o.marginDefaults,loading:P,loadingContent:R,emptyContent:L,width:D,height:F}),J=qi(),ee=(0,_s.useMemo)(()=>new Map,[Z]),te=ws({colorBy:Q,colorScale:U.colorScale,color:$,themeCategorical:J,colorScheme:g,categoryIndexMap:ee,userPieceStyle:k.pieceStyle,stroke:B,strokeWidth:H,opacity:O,effectiveSelectionHook:U.effectiveSelectionHook,resolvedSelection:U.resolvedSelection}),oe=(0,_s.useMemo)(()=>Ji({categoryAccessor:l,valueAccessor:c,groupAccessor:a,valueFormat:d}),[l,a,c,d]),ne=fs({componentName:"GroupedBarChart",data:r,accessors:{categoryAccessor:a,valueAccessor:c},requiredProps:{groupBy:l}}),{effectiveLegendProps:re,effectiveMargin:ie}=bs({ref:t,frameRef:n,setup:U});if(U.earlyReturn)return U.earlyReturn;const se={chartType:"clusterbar",...null!=r&&{data:Z},oAccessor:a,rAccessor:c,groupBy:l,oSort:m,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:te,size:[D,F],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ie,barPadding:y,...null!=p&&{roundedTop:p},baselinePadding:b,enableHover:N,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:Y,rLabel:K,rFormat:d,...E&&{oFormat:E},showGrid:z,...re,...ri({title:q,description:G,summary:V,accessibleTable:X,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...si({tooltip:v,defaultTooltipContent:oe}),...ii({linkedHover:A,selection:S,onObservation:M,onClick:C,hoverHighlight:j,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?(0,Ps.jsx)(ts,{componentName:"GroupedBarChart",message:ne,width:D,height:F}):(0,Ps.jsx)(as,{componentName:"GroupedBarChart",width:D,height:F,children:(0,Ps.jsx)(ni,{ref:n,...se})})});Rs.displayName="GroupedBarChart";var Ls=require("react"),Is=require("react");function Ts({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 s="string"==typeof n?n:"value",a=function(e){const{name:t,xField:o,yField:n}=e,{predicate:r,isActive:i,selectInterval:s,clear:a}=Ci({name:t,fields:[o,n].filter(Boolean)}),l=o&&n?"xyBrush":o?"xBrush":"yBrush",c=(0,xi.useCallback)(e=>{if(!e)return void a();const t={};"xyBrush"===l&&function(e){return 2===e.length&&Array.isArray(e[0])&&2===e[0].length&&Array.isArray(e[1])&&2===e[1].length}(e)?(o&&(t[o]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),n&&(t[n]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===l&&ji(e)?o&&(t[o]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]):"yBrush"===l&&ji(e)&&n&&(t[n]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]),_i(t)&&s(t)},[l,o,n,s,a]);return{brushInteraction:(0,xi.useMemo)(()=>({brush:l,during:c,end:c}),[l,c]),predicate:r,isActive:i,clear:a}}({name:r?.name||"__unused_ordinal_brush__",xField:r?.xField||s}),l=(0,Is.useRef)(a.brushInteraction);l.current=a.brushInteraction;const c=(0,Is.useCallback)(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}:{}}}var $s=require("react/jsx-runtime"),Bs=(0,Ls.forwardRef)(function(e,t){const o=Xi(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=(0,Ls.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="category",subcategoryAccessor:l,valueAccessor:c="value",orientation:u="horizontal",valueFormat:d,colorBy:f,colorScheme:g,barPadding:m,tooltip:y,annotations:p,brush:b,onBrush:v,linkedBrush:x,frameProps:w={},selection:k,linkedHover:S,onObservation:A,onClick:M,hoverHighlight:C,chartId:j,loading:_,loadingContent:P,emptyContent:R,legendInteraction:L,legendPosition:I,color:T,stroke:$,strokeWidth:B,opacity:H,categoryFormat:O,rTickValues:E,tickLabelEdgeAlign:D,showCategoryTicks:F,gradientFill:N,trackFill:z,roundedTop:W,valueExtent:q}=e,{width:G,height:V,enableHover:X,showGrid:Y,showLegend:K,title:Z,description:Q,summary:U,accessibleTable:J,categoryLabel:ee,valueLabel:te}=o,oe=(0,Ls.useMemo)(()=>h(r),[r]),ne=f||l,re=(0,Ls.useMemo)(()=>{if(null!=m)return m;if("sparkline"!==e.mode)return 40;const t=new Set(oe.map(e=>"function"==typeof a?a(e):e[a])),o=Math.max(1,t.size);return o>1?Math.max(0,Math.min(1,(("horizontal"===u?V:G)-2*o)/(o-1))):1},[m,e.mode,oe,a,u,G,V]),ie=ys({data:oe,rawData:r,colorBy:ne,colorScheme:g,legendInteraction:L,legendPosition:I,selection:k,linkedHover:S,fallbackFields:ne?["string"==typeof ne?ne:""]:[],unwrapData:!0,onObservation:A,onClick:M,hoverHighlight:C,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"SwimlaneChart",chartId:j,showLegend:K,userMargin:i,marginDefaults:o.marginDefaults,loading:_,loadingContent:P,emptyContent:R,width:G,height:V}),se=Ts({brushProp:b,onBrushProp:v,linkedBrush:x,valueAccessor:c}),ae=qi(),le=(0,Ls.useMemo)(()=>new Map,[oe]),ce=ws({colorBy:ne,colorScale:ie.colorScale,color:T,themeCategorical:ae,colorScheme:g,categoryIndexMap:le,userPieceStyle:w?.pieceStyle,stroke:$,strokeWidth:B,opacity:H,effectiveSelectionHook:ie.effectiveSelectionHook,resolvedSelection:ie.resolvedSelection,cycleByCategory:!0}),ue=(0,Ls.useMemo)(()=>Ji({categoryAccessor:l,valueAccessor:c,groupAccessor:a,valueFormat:d}),[l,a,c,d]),de=fs({componentName:"SwimlaneChart",data:r,accessors:{categoryAccessor:a,valueAccessor:c,subcategoryAccessor:l},requiredProps:{subcategoryAccessor:l}}),{effectiveLegendProps:he,effectiveMargin:fe}=bs({ref:t,frameRef:n,setup:ie});if(ie.earlyReturn)return ie.earlyReturn;const ge={chartType:"swimlane",...null!=r&&{data:oe},oAccessor:a,rAccessor:c,stackBy:l,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:ce,size:[G,V],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:fe,barPadding:re,enableHover:X,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:!1===F?void 0:ee,rLabel:te,rFormat:d,...E&&{rTickValues:E},...null!=D&&{tickLabelEdgeAlign:D},...O&&{oFormat:O},...void 0!==F&&{showCategoryTicks:F},showGrid:Y,...he,...ri({title:Z,description:Q,summary:U,accessibleTable:J,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...si({tooltip:y,defaultTooltipContent:ue}),...ii({linkedHover:S,selection:k,onObservation:A,onClick:M,hoverHighlight:C,mobileInteraction:ie.mobileInteraction,customHoverBehavior:ie.customHoverBehavior,customClickBehavior:ie.customClickBehavior}),...p&&p.length>0&&{annotations:p},...N&&{gradientFill:!0===N?{topOpacity:.8,bottomOpacity:.05}:N},...null!=z&&{trackFill:z},...null!=W&&{roundedTop:W},...q&&{rExtent:q},...se.brushStreamProps,...Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e))};return de?(0,$s.jsx)(ts,{componentName:"SwimlaneChart",message:de,width:G,height:V}):(0,$s.jsx)(as,{componentName:"SwimlaneChart",width:G,height:V,children:(0,$s.jsx)(ni,{ref:n,...ge})})});Bs.displayName="SwimlaneChart";var Hs=require("react"),Os=require("react");function Es(e,t){const{variant:o,frameRef:n,overrides:r,deps:i}=t;(0,Os.useImperativeHandle)(e,()=>{const e=function(e,t){if("xy"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>e.current?.remove(t)??[],update:(t,o)=>e.current?.update(t,o)??[],clear:()=>e.current?.clear(),getData:()=>e.current?.getData()??[],getScales:()=>e.current?.getScales()??null,getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}if("network"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>{const o=Array.isArray(t)?t:[t],n=e.current?.getTopology()?.nodes??[],r=[];for(const t of o){const o=n.find(e=>e.id===t);o&&r.push({...o.data??{},id:t}),e.current?.removeNode(t)}return r},update:(t,o)=>(Array.isArray(t)?t:[t]).flatMap(t=>{const n=e.current?.updateNode(t,o);return n?[{...n,id:t}]:[]}),clear:()=>e.current?.clear(),getData:()=>e.current?.getTopology()?.nodes?.map(e=>e.data)??[],getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}if("geo-points"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>e.current?.removePoint(t)??[],update:(t,o)=>{const n=e.current?.removePoint(t)??[];for(const t of n)e.current?.push(o(t));return n},clear:()=>e.current?.clear(),getData:()=>e.current?.getData()??[],getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}const o=t;return{push:e=>o.current?.pushLine(e),pushMany:e=>o.current?.pushManyLines(e),remove:e=>o.current?.removeLine(e)??[],update:(e,t)=>{const n=o.current?.removeLine(e)??[];for(const e of n)o.current?.pushLine(t(e));return n},clear:()=>o.current?.clear(),getData:()=>o.current?.getLines()??[],getCustomLayout:()=>o.current?.getCustomLayout?.()??null,getLayoutFailure:()=>o.current?.getLayoutFailure?.()??null}}(o,n);return{...e,...r}},i??[])}var Ds=require("react/jsx-runtime"),Fs=(0,Hs.forwardRef)(function(e,t){const o=Xi(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=(0,Hs.useRef)(null);Es(t,{variant:"xy",frameRef:n});const{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="vertical",valueFormat:u,colorBy:d,colorScheme:f,sizeBy:g,sizeRange:m=[3,8],symbolBy:y,symbolMap:p,pointRadius:b=4,pointOpacity:v=.7,categoryPadding:x=20,tooltip:w,annotations:k,valueExtent:S,brush:A,onBrush:M,linkedBrush:C,frameProps:j={},selection:_,linkedHover:P,onObservation:R,onClick:L,hoverHighlight:I,chartId:T,loading:$,loadingContent:B,emptyContent:H,legendInteraction:O,legendPosition:E,color:D,stroke:F,strokeWidth:N,opacity:z,showCategoryTicks:W,categoryFormat:q}=e,{width:G,height:V,enableHover:X,showGrid:Y,showLegend:K,title:Z,description:U,summary:J,accessibleTable:ee,categoryLabel:te,valueLabel:oe}=o,ne=(0,Hs.useMemo)(()=>h(r),[r]),re=ys({data:ne,rawData:r,colorBy:d,colorScheme:f,legendInteraction:O,legendPosition:E,selection:_,linkedHover:P,fallbackFields:d?["string"==typeof d?d:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:R,onClick:L,hoverHighlight:I,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"SwarmPlot",chartId:T,showLegend:K,userMargin:i,marginDefaults:o.marginDefaults,loading:$,loadingContent:B,emptyContent:H,width:G,height:V}),ie=Ts({brushProp:A,onBrushProp:M,linkedBrush:C,valueAccessor:l}),se=(0,Hs.useMemo)(()=>{if(g)return le(ne.map(e=>"function"==typeof g?g(e):e[g]))},[ne,g]),ae=qi(),ce=(0,Hs.useMemo)(()=>new Map,[ne]),ue=ws({colorBy:d,colorScale:re.colorScale,color:D,themeCategorical:ae,colorScheme:f,categoryIndexMap:ce,userPieceStyle:j?.pieceStyle,stroke:F,strokeWidth:N,opacity:z,effectiveSelectionHook:re.effectiveSelectionHook,resolvedSelection:re.resolvedSelection,baseStyleExtras:e=>({fillOpacity:v,r:g?Q(e,g,m,se):b})}),de=(0,Hs.useMemo)(()=>Ji({categoryAccessor:a,valueAccessor:l,groupAccessor:d||void 0,valueFormat:u}),[a,l,d,u]);if(re.earlyReturn)return re.earlyReturn;const he=fs({componentName:"SwarmPlot",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(he)return(0,Ds.jsx)(ts,{componentName:"SwarmPlot",message:he,width:G,height:V});const fe={chartType:"swarm",...null!=r&&{data:ne},oAccessor:a,rAccessor:l,...y&&{symbolAccessor:y},...p&&{symbolMap:p},projection:"horizontal"===c?"horizontal":"vertical",pieceStyle:ue,size:[G,V],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:re.margin,barPadding:x,enableHover:X,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:te,rLabel:oe,rFormat:u,...q&&{oFormat:q},showGrid:Y,showCategoryTicks:W,...re.legendBehaviorProps,...ri({title:Z,description:U,summary:J,accessibleTable:ee,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...si({tooltip:w,defaultTooltipContent:de}),...ii({linkedHover:P,selection:_,onObservation:R,onClick:L,hoverHighlight:I,mobileInteraction:re.mobileInteraction,customHoverBehavior:re.customHoverBehavior,customClickBehavior:re.customClickBehavior}),...k&&k.length>0&&{annotations:k},...S&&{rExtent:S},...ie.brushStreamProps,...Object.fromEntries(Object.entries(j).filter(([e])=>"pieceStyle"!==e))};return(0,Ds.jsx)(as,{componentName:"SwarmPlot",width:G,height:V,children:(0,Ds.jsx)(ni,{ref:n,...fe})})});Fs.displayName="SwarmPlot";var Ns=require("react"),zs=require("react/jsx-runtime");function Ws(e){return t=>{const o=t.category||t.data&&t.data[0]?.category||"",n=t.stats||(t.data||t).stats;if(n&&null!=n.median)return(0,zs.jsxs)("div",{className:"semiotic-tooltip",style:Nn,children:[o&&(0,zs.jsx)("div",{style:{fontWeight:"bold"},children:o+""}),null!=n.n&&(0,zs.jsxs)("div",{children:["n = ",n.n]}),null!=n.min&&(0,zs.jsxs)("div",{children:["Min: ",n.min.toLocaleString()]}),null!=n.q1&&(0,zs.jsxs)("div",{children:["Q1: ",n.q1.toLocaleString()]}),(0,zs.jsxs)("div",{children:["Median: ",n.median.toLocaleString()]}),null!=n.q3&&(0,zs.jsxs)("div",{children:["Q3: ",n.q3.toLocaleString()]}),null!=n.max&&(0,zs.jsxs)("div",{children:["Max: ",n.max.toLocaleString()]}),null!=n.mean&&(0,zs.jsxs)("div",{style:{opacity:.8},children:["Mean: ",n.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});if(e?.valueAccessor){const n=e.valueAccessor,r=(Array.isArray(t.data)?t.data:[]).map(e=>Number("function"==typeof n?n(e):e[n])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),i=r.length,s=i>0?i%2!=0?r[Math.floor(i/2)]:(r[i/2-1]+r[i/2])/2:null;return(0,zs.jsxs)("div",{className:"semiotic-tooltip",style:Nn,children:[o&&(0,zs.jsx)("div",{style:{fontWeight:"bold"},children:o+""}),i>0&&(0,zs.jsxs)("div",{children:["n = ",i]}),null!=s&&(0,zs.jsxs)("div",{children:["Median: ",s.toLocaleString()]})]})}return(0,zs.jsx)("div",{className:"semiotic-tooltip",style:Nn,children:(0,zs.jsx)("div",{style:{fontWeight:"bold"},children:o+""})})}}var qs=require("react/jsx-runtime"),Gs=(0,Ns.forwardRef)(function(e,t){const o=Xi(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=(0,Ns.useRef)(null);Es(t,{variant:"xy",frameRef:n});const{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="vertical",valueFormat:u,colorBy:d,colorScheme:f,showOutliers:g=!0,outlierRadius:m=3,categoryPadding:y=20,tooltip:p,annotations:b,valueExtent:v,frameProps:x={},selection:w,linkedHover:k,onObservation:S,onClick:A,hoverHighlight:M,chartId:C,loading:j,loadingContent:_,emptyContent:P,legendInteraction:R,legendPosition:L,color:I,stroke:T,strokeWidth:$,opacity:B,showCategoryTicks:H,categoryFormat:O}=e,{width:E,height:D,enableHover:F,showGrid:N,showLegend:z,title:W,description:q,summary:G,accessibleTable:V,categoryLabel:X,valueLabel:Y}=o,K=(0,Ns.useMemo)(()=>h(r),[r]),Z=ys({data:K,rawData:r,colorBy:d,colorScheme:f,legendInteraction:R,legendPosition:L,selection:w,linkedHover:k,fallbackFields:d?["string"==typeof d?d:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:S,onClick:A,hoverHighlight:M,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"BoxPlot",chartId:C,showLegend:z,userMargin:i,marginDefaults:o.marginDefaults,loading:j,loadingContent:_,emptyContent:P,width:E,height:D}),Q=qi(),U=(0,Ns.useMemo)(()=>new Map,[K]),J=ws({colorBy:d,colorScale:Z.colorScale,color:I,themeCategorical:Q,colorScheme:f,categoryIndexMap:U,userPieceStyle:void 0,stroke:T,strokeWidth:$,opacity:B,effectiveSelectionHook:Z.effectiveSelectionHook,resolvedSelection:Z.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),ee=(0,Ns.useMemo)(()=>Ws(),[]);if(Z.earlyReturn)return Z.earlyReturn;const te=fs({componentName:"BoxPlot",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(te)return(0,qs.jsx)(ts,{componentName:"BoxPlot",message:te,width:E,height:D});const oe={chartType:"boxplot",...null!=r&&{data:K},oAccessor:a,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",summaryStyle:J,showOutliers:g,size:[E,D],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Z.margin,barPadding:y,enableHover:F,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:X,rLabel:Y,rFormat:u,...O&&{oFormat:O},showGrid:N,showCategoryTicks:H,...Z.legendBehaviorProps,...ri({title:W,description:q,summary:G,accessibleTable:V,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...si({tooltip:p,defaultTooltipContent:ee}),...ii({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(0,qs.jsx)(as,{componentName:"BoxPlot",width:E,height:D,children:(0,qs.jsx)(ni,{ref:n,...oe})})});Gs.displayName="BoxPlot";var Vs=require("react"),Xs=require("react/jsx-runtime"),Ys=e=>{const t=e?.category;return null==t?"All":t+""},Ks=(0,Vs.forwardRef)(function(e,t){const o=Xi(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:"horizontal",mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=(0,Vs.useRef)(null);Es(t,{variant:"xy",frameRef:n});const{data:r,margin:i,className:s,categoryAccessor:a=Ys,valueAccessor:l="value",bins:c=25,relative:u=!1,valueFormat:d,colorBy:f,colorScheme:g,categoryPadding:m=20,tooltip:y,annotations:p,valueExtent:b,brush:v,onBrush:x,linkedBrush:w,frameProps:k={},selection:S,linkedHover:A,onObservation:M,onClick:C,hoverHighlight:j,chartId:_,loading:P,loadingContent:R,emptyContent:L,legendInteraction:I,legendPosition:T,color:$,stroke:B,strokeWidth:H,opacity:O,showCategoryTicks:E,categoryFormat:D}=e,{width:F,height:N,enableHover:z,showGrid:W,showLegend:q,title:G,description:V,summary:X,accessibleTable:Y,categoryLabel:K,valueLabel:Z}=o,Q=(0,Vs.useMemo)(()=>h(r),[r]),U=ys({data:Q,rawData:r,colorBy:f,colorScheme:g,legendInteraction:I,legendPosition:T,selection:S,linkedHover:A,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:M,onClick:C,hoverHighlight:j,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"Histogram",chartId:_,showLegend:q,userMargin:i,marginDefaults:o.marginDefaults,loading:P,loadingContent:R,emptyContent:L,width:F,height:N}),J=Ts({brushProp:v,onBrushProp:x,linkedBrush:w,valueAccessor:l}),ee=(0,Vs.useMemo)(()=>{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=qi(),oe=(0,Vs.useMemo)(()=>new Map,[Q]),ne=ws({colorBy:f,colorScale:U.colorScale,color:$,themeCategorical:te,colorScheme:g,categoryIndexMap:oe,userPieceStyle:void 0,stroke:B,strokeWidth:H,opacity:O,effectiveSelectionHook:U.effectiveSelectionHook,resolvedSelection:U.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),re=(0,Vs.useMemo)(()=>e=>{const t=e.data||e,o=t.category||e.category||"",n=t.count,r=t.range;return(0,Xs.jsxs)("div",{className:"semiotic-tooltip",style:Nn,children:[o&&(0,Xs.jsx)("div",{style:{fontWeight:"bold"},children:o+""}),null!=n&&(0,Xs.jsxs)("div",{children:["Count: ",n]}),r&&2===r.length&&(0,Xs.jsxs)("div",{style:{opacity:.8},children:[Number(r[0]).toFixed(1)," – ",Number(r[1]).toFixed(1)]})]})},[]);if(U.earlyReturn)return U.earlyReturn;const ie=fs({componentName:"Histogram",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(ie)return(0,Xs.jsx)(ts,{componentName:"Histogram",message:ie,width:F,height:N});const se={chartType:"histogram",...null!=r&&{data:Q},oAccessor:a,rAccessor:l,projection:"horizontal",summaryStyle:ne,bins:c,normalize:u,...b?{rExtent:b}:ee&&{rExtent:ee},size:[F,N],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:U.margin,barPadding:m,enableHover:z,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:K,rLabel:Z,rFormat:d,...D&&{oFormat:D},showGrid:W,showCategoryTicks:E,...U.legendBehaviorProps,...ri({title:G,description:V,summary:X,accessibleTable:Y,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...si({tooltip:y,defaultTooltipContent:re}),...ii({linkedHover:A,selection:S,onObservation:M,onClick:C,hoverHighlight:j,mobileInteraction:U.mobileInteraction,customHoverBehavior:U.customHoverBehavior,customClickBehavior:U.customClickBehavior}),...p&&p.length>0&&{annotations:p},...J.brushStreamProps,...Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e))};return(0,Xs.jsx)(as,{componentName:"Histogram",width:F,height:N,children:(0,Xs.jsx)(ni,{ref:n,...se})})});Ks.displayName="Histogram";var Zs=require("react"),Qs=require("react/jsx-runtime"),Us=(0,Zs.forwardRef)(function(e,t){const o=Xi(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=(0,Zs.useRef)(null);Es(t,{variant:"xy",frameRef:n});const{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="vertical",bins:u=25,curve:d="catmullRom",showIQR:f=!0,valueFormat:g,colorBy:m,colorScheme:y,categoryPadding:p=20,tooltip:b,annotations:v,valueExtent:x,brush:w,onBrush:k,linkedBrush:S,frameProps:A={},selection:M,linkedHover:C,onObservation:j,onClick:_,hoverHighlight:P,chartId:R,loading:L,loadingContent:I,emptyContent:T,legendInteraction:$,legendPosition:B,color:H,stroke:O,strokeWidth:E,opacity:D,showCategoryTicks:F,categoryFormat:N}=e,{width:z,height:W,enableHover:q,showGrid:G,showLegend:V,title:X,description:Y,summary:K,accessibleTable:Z,categoryLabel:Q,valueLabel:U}=o,J=(0,Zs.useMemo)(()=>h(r),[r]),ee=ys({data:J,rawData:r,colorBy:m,colorScheme:y,legendInteraction:$,legendPosition:B,selection:M,linkedHover:C,fallbackFields:m?["string"==typeof m?m:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:j,onClick:_,hoverHighlight:P,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"ViolinPlot",chartId:R,showLegend:V,userMargin:i,marginDefaults:o.marginDefaults,loading:L,loadingContent:I,emptyContent:T,width:z,height:W}),te=Ts({brushProp:w,onBrushProp:k,linkedBrush:S,valueAccessor:l}),oe=qi(),ne=(0,Zs.useMemo)(()=>new Map,[J]),re=ws({colorBy:m,colorScale:ee.colorScale,color:H,themeCategorical:oe,colorScheme:y,categoryIndexMap:ne,userPieceStyle:void 0,stroke:O,strokeWidth:E,opacity:D,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection,baseStyleExtras:{fillOpacity:.6},linkStrokeToFill:!0}),ie=(0,Zs.useMemo)(()=>Ws({valueAccessor:l}),[l]);if(ee.earlyReturn)return ee.earlyReturn;const se=fs({componentName:"ViolinPlot",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(se)return(0,Qs.jsx)(ts,{componentName:"ViolinPlot",message:se,width:z,height:W});const ae={chartType:"violin",...null!=r&&{data:J},oAccessor:a,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",summaryStyle:re,bins:u,showIQR:f,size:[z,W],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ee.margin,barPadding:p,enableHover:q,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:Q,rLabel:U,rFormat:g,...N&&{oFormat:N},showGrid:G,showCategoryTicks:F,...ee.legendBehaviorProps,...ri({title:X,description:Y,summary:K,accessibleTable:Z,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...si({tooltip:b,defaultTooltipContent:ie}),...ii({linkedHover:C,selection:M,onObservation:j,onClick:_,hoverHighlight:P,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(0,Qs.jsx)(as,{componentName:"ViolinPlot",width:z,height:W,children:(0,Qs.jsx)(ni,{ref:n,...ae})})});Us.displayName="ViolinPlot";var Js=require("react"),ea=require("react/jsx-runtime"),ta=(0,Js.forwardRef)(function(e,t){const o=Xi(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid??!0,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=(0,Js.useRef)(null);Es(t,{variant:"xy",frameRef:n});const{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="horizontal",valueFormat:u,colorBy:d,colorScheme:f,sort:g="auto",dotRadius:m=5,categoryPadding:y=10,tooltip:p,annotations:b,regression:v,valueExtent:x,frameProps:w={},selection:k,linkedHover:S,onObservation:A,onClick:M,hoverHighlight:C,chartId:j,loading:_,loadingContent:P,emptyContent:R,legendInteraction:L,legendPosition:I,color:T,stroke:$,strokeWidth:B,opacity:H,categoryFormat:O}=e,{width:E,height:D,enableHover:F,showGrid:N,showLegend:z,title:W,description:q,summary:G,accessibleTable:V,categoryLabel:X,valueLabel:Y}=o,K=(0,Js.useMemo)(()=>h(r),[r]),Z=ys({data:K,rawData:r,colorBy:d,colorScheme:f,legendInteraction:L,legendPosition:I,selection:k,linkedHover:S,fallbackFields:d?["string"==typeof d?d:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:A,onClick:M,hoverHighlight:C,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"DotPlot",chartId:j,showLegend:z,userMargin:i,marginDefaults:o.marginDefaults,loading:_,loadingContent:P,emptyContent:R,width:E,height:D}),Q=Gi(K,g,l),U=qi(),J=(0,Js.useMemo)(()=>new Map,[K]),ee=ws({colorBy:d,colorScale:Z.colorScale,color:T,themeCategorical:U,colorScheme:f,categoryIndexMap:J,userPieceStyle:w?.pieceStyle,stroke:$,strokeWidth:B,opacity:H,effectiveSelectionHook:Z.effectiveSelectionHook,resolvedSelection:Z.resolvedSelection,baseStyleExtras:{r:m,fillOpacity:.8}}),te=(0,Js.useMemo)(()=>Ji({categoryAccessor:a,valueAccessor:l,valueFormat:u}),[a,l,u]);if(Z.earlyReturn)return Z.earlyReturn;const oe=fs({componentName:"DotPlot",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(oe)return(0,ea.jsx)(ts,{componentName:"DotPlot",message:oe,width:E,height:D});const ne=ks(v),re=ne?[ne,...b||[]]:b,ie={chartType:"point",...null!=r&&{data:Q},oAccessor:a,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",pieceStyle:ee,size:[E,D],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Z.margin,barPadding:y,enableHover:F,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:X,rLabel:Y,rFormat:u,...O&&{oFormat:O},showGrid:N,oSort:g,...Z.legendBehaviorProps,...ri({title:W,description:q,summary:G,accessibleTable:V,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...si({tooltip:p,defaultTooltipContent:te}),...ii({linkedHover:S,selection:k,onObservation:A,onClick:M,hoverHighlight:C,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(0,ea.jsx)(as,{componentName:"DotPlot",width:E,height:D,children:(0,ea.jsx)(ni,{ref:n,...ie})})});ta.displayName="DotPlot";var oa=require("react"),na=require("react/jsx-runtime"),ra=(0,oa.forwardRef)(function(e,t){const o=Xi(e.mode,{width:e.width??400,height:e.height??400,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,showCategoryTicks:e.showCategoryTicks,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=(0,oa.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",colorBy:c,colorScheme:u,startAngle:d=0,cornerRadius:f,tooltip:g,annotations:m,frameProps:y={},selection:p,linkedHover:b,onObservation:v,onClick:x,hoverHighlight:w,chartId:k,loading:S,loadingContent:A,emptyContent:M,legendInteraction:C,legendPosition:j,color:_,stroke:P,strokeWidth:R,opacity:L}=e,{width:I,height:T,enableHover:$,showLegend:B,title:H,description:O,summary:E,accessibleTable:D}=o,F=(0,oa.useMemo)(()=>h(r),[r]),N=c||a,z=ys({data:F,rawData:r,colorBy:N,colorScheme:u,legendInteraction:C,legendPosition:j,selection:p,linkedHover:b,fallbackFields:N?["string"==typeof N?N:""]:[],unwrapData:!0,onObservation:v,onClick:x,hoverHighlight:w,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"PieChart",chartId:k,showLegend:B,userMargin:i,marginDefaults:o.marginDefaults,loading:S,loadingContent:A,emptyContent:M,width:I,height:T}),W=qi(),q=(0,oa.useMemo)(()=>new Map,[F]),G=ws({colorBy:N,colorScale:z.colorScale,color:_,themeCategorical:W,colorScheme:u,categoryIndexMap:q,userPieceStyle:y?.pieceStyle,stroke:P,strokeWidth:R,opacity:L,effectiveSelectionHook:z.effectiveSelectionHook,resolvedSelection:z.resolvedSelection,cycleByCategory:!0}),V=(0,oa.useMemo)(()=>Ji({categoryAccessor:a,valueAccessor:l,groupAccessor:c&&c!==a?c:void 0,groupLabel:"string"==typeof c?c:"group",pieData:!0}),[a,l,c]),X=fs({componentName:"PieChart",data:r,accessors:{categoryAccessor:a,valueAccessor:l}}),{effectiveLegendProps:Y,effectiveMargin:K}=bs({ref:t,frameRef:n,setup:z});if(z.earlyReturn)return z.earlyReturn;const Z={chartType:"pie",...null!=r&&{data:F},oAccessor:a,rAccessor:l,projection:"radial",pieceStyle:G,startAngle:d,...null!=f&&{cornerRadius:f},size:[I,T],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:K,enableHover:$,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:!1,...Y,...ri({title:H,description:O,summary:E,accessibleTable:D,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...si({tooltip:g,defaultTooltipContent:V}),...ii({linkedHover:b,selection:p,onObservation:v,onClick:x,hoverHighlight:w,mobileInteraction:z.mobileInteraction,customHoverBehavior:z.customHoverBehavior,customClickBehavior:z.customClickBehavior}),...m&&m.length>0&&{annotations:m},...Object.fromEntries(Object.entries(y).filter(([e])=>"pieceStyle"!==e))};return X?(0,na.jsx)(ts,{componentName:"PieChart",message:X,width:I,height:T}):(0,na.jsx)(as,{componentName:"PieChart",width:I,height:T,children:(0,na.jsx)(ni,{ref:n,...Z})})});ra.displayName="PieChart";var ia=require("react"),sa=require("react/jsx-runtime"),aa=(0,ia.forwardRef)(function(e,t){const o=Xi(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,linkedHover:e.linkedHover,showCategoryTicks:e.showCategoryTicks,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:400,height:400}),n=(0,ia.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",innerRadius:c,centerContent:u,colorBy:d,colorScheme:f,startAngle:g=0,cornerRadius:m,tooltip:y,annotations:p,frameProps:b={},selection:v,linkedHover:x,onObservation:w,onClick:k,hoverHighlight:S,chartId:A,loading:M,loadingContent:C,emptyContent:j,legendInteraction:_,legendPosition:P,color:R,stroke:L,strokeWidth:I,opacity:T}=e,{width:$,height:B,enableHover:H,showLegend:O,title:E,description:D,summary:F,accessibleTable:N}=o,z=(0,ia.useMemo)(()=>h(r),[r]),W=d||a,q=ys({data:z,rawData:r,colorBy:W,colorScheme:f,legendInteraction:_,legendPosition:P,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:O,userMargin:i,marginDefaults:o.marginDefaults,loading:M,loadingContent:C,emptyContent:j,width:$,height:B}),G=c??Math.max(2,.15*Math.min($,B)),V=qi(),X=(0,ia.useMemo)(()=>new Map,[z]),Y=ws({colorBy:W,colorScale:q.colorScale,color:R,themeCategorical:V,colorScheme:f,categoryIndexMap:X,userPieceStyle:b?.pieceStyle,stroke:L,strokeWidth:I,opacity:T,effectiveSelectionHook:q.effectiveSelectionHook,resolvedSelection:q.resolvedSelection,cycleByCategory:!0}),K=(0,ia.useMemo)(()=>Ji({categoryAccessor:a,valueAccessor:l,groupAccessor:d&&d!==a?d:void 0,groupLabel:"string"==typeof d?d:"group",pieData:!0}),[a,l,d]),Z=fs({componentName:"DonutChart",data:r,accessors:{categoryAccessor:a,valueAccessor:l}}),{effectiveLegendProps:Q,effectiveMargin:U}=bs({ref:t,frameRef:n,setup:q});if(q.earlyReturn)return q.earlyReturn;const J={chartType:"donut",...null!=r&&{data:z},oAccessor:a,rAccessor:l,projection:"radial",pieceStyle:Y,innerRadius:G,startAngle:g,...null!=m&&{cornerRadius:m},centerContent:u,size:[$,B],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:U,enableHover:H,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:!1,...Q,...ri({title:E,description:D,summary:F,accessibleTable:N,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...si({tooltip:y,defaultTooltipContent:K}),...ii({linkedHover:x,selection:v,onObservation:w,onClick:k,hoverHighlight:S,mobileInteraction:q.mobileInteraction,customHoverBehavior:q.customHoverBehavior,customClickBehavior:q.customClickBehavior}),...p&&p.length>0&&{annotations:p},...Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e))};return Z?(0,sa.jsx)(ts,{componentName:"DonutChart",message:Z,width:$,height:B}):(0,sa.jsx)(as,{componentName:"DonutChart",width:$,height:B,children:(0,sa.jsx)(ni,{ref:n,...J})})});aa.displayName="DonutChart";var la=require("react");function ca(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 ua(e){return Math.max(0,Math.min(1,e))}function da(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 ha(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 fa(e,t){const o=e.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:ua(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=ua(t);if(o[0].offset>=n)return o[0].color;if(n>=o[o.length-1].offset)return o[o.length-1].color;for(let e=0;o.length-1>e;e++){const t=o[e],r=o[e+1];if(t.offset>n||n>r.offset)continue;const i=r.offset-t.offset,s=i>0?(n-t.offset)/i:0,a=da(t.color),l=da(r.color);if(!a||!l)return.5>s?t.color:r.color;const[c,u,d]=a,[h,f,g]=l;return ha(c+(h-c)*s,u+(f-u)*s,d+(g-d)*s)}return o[o.length-1].color}function ga(e,t,o){return null==o?`${e}-${t}`:`${e}-${t}-${o}`}var ma=require("react/jsx-runtime"),ya=(0,la.forwardRef)(function(e,t){const o=Xi(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLegend:!1,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:300,height:250}),n=(0,la.useRef)(null),r="context"===e.mode,{compactMode:i}=o,{value:s,min:a=0,max:l=100,thresholds:c,gradientFill:u,color:d,backgroundColor:h="var(--semiotic-grid, #e0e0e0)",arcWidth:f=.3,cornerRadius:g,showNeedle:m=!0,needleColor:y="var(--semiotic-text, #333)",centerContent:p,valueFormat:b,showScaleLabels:v=!i,sweep:x=240,fillZones:w=!0,tooltip:k,annotations:S,frameProps:A={},className:M,stroke:C,strokeWidth:j,opacity:_}=e,{width:P,height:R,title:L,description:I,summary:T,accessibleTable:$}=o,B=u&&"object"==typeof u?u:void 0,H=Math.max(a,Math.min(l,s)),O=l-a||1,E=(H-a)/O,{gaugeData:D,pieceStyle:F,gaugeAnnotations:N}=(0,la.useMemo)(()=>function(e){const{min:t,max:o,value:n,thresholds:r,fillColor:i,backgroundColor:s,fillZones:a,showScaleLabels:l,gradientFill:c,gradientSteps:u=240}=e,d=o-t||1,h=(Math.max(t,Math.min(o,n))-t)/d;let f=r&&r.length>0?[...r].sort((e,t)=>e.value-t.value):[{value:o,color:i||"#007bff"}];f=f.map(e=>({...e,value:Math.max(t,Math.min(o,e.value))})),o>f[f.length-1].value&&f.push({value:o,color:f[f.length-1].color});const g=!!c&&c.colorStops.length>=2,m=[],y=new Map,p=[];if(g){const e=a?h:1,t=ga("bg",0);if(m.push({category:t,value:1,_zone:"Track",_isFill:!1,_pctStart:0,_pct:1,_roundedEnds:{start:!0,end:!0},_nonInteractive:!0}),y.set(t,{fill:s,opacity:.4}),e>0){const t=Math.max(1,Math.floor(u)),o=Math.max(1,Math.min(t,Math.round(e*t))),n=[];for(let t=0;o>t;t++)n.push(fa(c.colorStops,e*(t+.5)/o));const r=ga("fill",0);m.push({category:r,value:e,_zone:"Gradient",_isFill:!0,_pctStart:0,_pct:e,_roundedEnds:{start:!0,end:!0},_nonInteractive:!0,_gradientBand:{colors:n}}),y.set(r,{fill:n[0]||s})}}else{let e=t;for(let o=0;f.length>o;o++){const n=f[o],r=(n.value-e)/d,i=(e-t)/d,l=(n.value-t)/d,c=Math.max(0,(a?Math.min(h,l):l)-i),u=a?Math.max(0,r-c):0;if(c>0){const e=ga("fill",o);m.push({category:e,value:c,_zone:n.label||"Zone "+(o+1),_isFill:!0}),y.set(e,{fill:n.color})}if(u>0){const e=ga("bg",o);m.push({category:e,value:u,_zone:n.label||"Zone "+(o+1),_isFill:!1}),y.set(e,{fill:s,opacity:.4})}e=n.value}}if(l&&r&&r.length>0)for(const e of r)e.value>t&&o>e.value&&p.push({type:"gauge-label",value:e.value,label:e.label||e.value+""});return{gaugeData:m,pieceStyle:(e,t)=>y.get(t||e.category)||{fill:s},gaugeAnnotations:p}}({min:a,max:l,value:s,thresholds:c,fillColor:d,backgroundColor:h,fillZones:w,showScaleLabels:v,gradientFill:B}),[s,a,l,c,d,h,v,w,B]),z=(0,la.useMemo)(()=>xs(F,{stroke:C,strokeWidth:j,opacity:_}),[F,C,j,_]),{sweepRad:W,startAngleDeg:q}=ca(x),G=function(e=240){const{sweepRad:t,offsetRad:o}=ca(e),n=[[Math.cos(o),Math.sin(o)],[Math.cos(o+t),Math.sin(o+t)],[0,0]];for(let e=0;2*Math.PI>e;e+=Math.PI/2)((e-o)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)>t+.001||n.push([Math.cos(e),Math.sin(e)]);const r=n.map(e=>e[0]),i=n.map(e=>e[1]),[s,a]=le(r),[l,c]=le(i);return{minX:s,maxX:a,minY:l,maxY:c,width:a-s,height:c-l,cx:(s+a)/2,cy:(l+c)/2}}(x),V=Math.min(10,Math.max(1,Math.min(P,R)/12)),X=G.cx,Y=G.cy,K=Math.max(4,Math.min((P-2*V)/G.width,(R-2*V)/G.height)-2),Z=Math.max(0,Math.min(K-1.5,K*(1-f))),Q=P/2-X*K,U=R/2-Y*K,J=2*(K+4),ee=(0,la.useMemo)(()=>{if(i&&null==p)return null;if(null!=p)return"function"==typeof p?p(H,a,l):p;const e=b?b(H):Math.round(H)+"";return(0,ma.jsxs)("div",{style:{textAlign:"center",lineHeight:1.2},children:[(0,ma.jsx)("div",{style:{fontSize:Math.max(16,.3*K),fontWeight:700,color:"var(--semiotic-text, #333)"},children:e}),v&&(0,ma.jsxs)("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"},children:[a," – ",l]})]})},[p,H,a,l,b,v,K,i]),te=(0,la.useMemo)(()=>r&&null==p?{type:"gauge-value",text:b?b(H):Math.round(H)+""}:null,[r,p,H,b]),oe=(0,la.useMemo)(()=>{if(!m)return null;const e=-Math.PI/2+q*Math.PI/180+E*W,t=Z>20?Z-8:K-1;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:y}},[m,E,q,W,Z,y]),ne=(0,la.useMemo)(()=>(e,t,o)=>{if("gauge-needle"===e.type){const n=(o.width||P)/2,r=(o.height||R)/2,i=Math.max(1,K-Z),s=Math.max(1,Math.min(2.5,.4*i)),a=Math.max(1,Math.min(5,.6*i));return(0,ma.jsxs)("g",{transform:`translate(${n},${r})`,children:[(0,ma.jsx)("line",{x1:0,y1:0,x2:e.tipX,y2:e.tipY,stroke:e.color,strokeWidth:s,strokeLinecap:"round"}),(0,ma.jsx)("circle",{cx:0,cy:0,r:a,fill:e.color})]},"gauge-needle-"+t)}if("gauge-label"===e.type){const n=-Math.PI/2+q*Math.PI/180+(e.value-a)/O*W,r=(o.width||P)/2,i=(o.height||R)/2,s=Z-1,l=K+1,c=Math.cos(n)*s,u=Math.sin(n)*s,d=Math.cos(n)*l,h=Math.sin(n)*l,f=K+10,g=Math.cos(n)*f,m=Math.sin(n)*f,y=((n+Math.PI/2)/(2*Math.PI)*12+12)%12;let p,b;return y>=11||1>y?(p="middle",b="auto"):y>=1&&5>y?(p="start",b="middle"):y>=5&&7>y?(p="middle",b="hanging"):(p="end",b="middle"),(0,ma.jsxs)("g",{transform:`translate(${r},${i})`,children:[(0,ma.jsx)("line",{x1:c,y1:u,x2:d,y2:h,stroke:"var(--semiotic-border)",strokeWidth:2,strokeLinecap:"round"}),(0,ma.jsx)("text",{x:g,y:m,textAnchor:p,dominantBaseline:b,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none",fontSize:"var(--semiotic-gauge-label-font-size, 10px)"},children:e.label})]},"gauge-label-"+t)}return"gauge-value"===e.type?(0,ma.jsx)("text",{x:(o.width||P)/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},[P,R,a,O,q,W,Z,K]),re=(0,la.useMemo)(()=>{const e=[...N,...S||[]];return oe&&e.push(oe),te&&e.push(te),e},[N,S,oe,te]),ie=(0,la.useMemo)(()=>e=>{const t=e?.data?.[0]||e?.data||e,o=t?._zone||"",n=t?._isFill;return(0,ma.jsxs)("div",{className:"semiotic-tooltip",style:{padding:"6px 10px",background:"var(--semiotic-tooltip-bg, white)",borderRadius:"var(--semiotic-tooltip-radius, 6px)",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0,0,0,0.15))"},children:[(0,ma.jsx)("div",{style:{fontWeight:600},children:o}),(0,ma.jsx)("div",{style:{fontSize:"0.85em",color:"var(--semiotic-text-secondary, #666)"},children:n?"Current: "+Math.round(H):"Remaining"})]})},[H]);if(0===D.length)return(0,ma.jsx)(ts,{componentName:"GaugeChart",message:"No data to display",width:P,height:R});const se={chartType:"donut",data:D,oAccessor:"category",rAccessor:"value",oSort:!1,projection:"radial",pieceStyle:z,innerRadius:Z,startAngle:q,sweepAngle:x,...null!=g&&{cornerRadius:g},centerContent:ee,size:[P,R],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:{top:U-J/2,bottom:R-U-J/2,left:Q-J/2,right:P-Q-J/2},enableHover:o.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===k?()=>null:Gn(k)||ie,svgAnnotationRules:ne,...re.length>0&&{annotations:re},...L&&{title:L},...I&&{description:I},...T&&{summary:T},...void 0!==$&&{accessibleTable:$},...M&&{className:M},...null!=e.animate&&{animate:e.animate},...A};return(0,ma.jsx)(as,{componentName:"GaugeChart",width:P,height:R,children:(0,ma.jsx)(ni,{ref:n,...se})})});ya.displayName="GaugeChart";var pa=require("react"),ba=require("react/jsx-runtime"),va=(0,pa.forwardRef)(function(e,t){const o=Xi(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=(0,pa.useRef)(null);Es(t,{variant:"xy",frameRef:n});const{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="horizontal",bins:u=20,amplitude:d=1.5,valueFormat:f,colorBy:g,colorScheme:m,categoryPadding:y=5,tooltip:p,annotations:b,valueExtent:v,frameProps:x={},selection:w,linkedHover:k,onObservation:S,onClick:A,hoverHighlight:M,chartId:C,loading:j,loadingContent:_,emptyContent:P,legendInteraction:R,legendPosition:L,color:I,stroke:T,strokeWidth:$,opacity:B,showCategoryTicks:H,categoryFormat:O}=e,{width:E,height:D,enableHover:F,showGrid:N,showLegend:z,title:W,description:q,summary:G,accessibleTable:V,categoryLabel:X,valueLabel:Y}=o,K=(0,pa.useMemo)(()=>h(r),[r]),Z=ys({data:K,rawData:r,colorBy:g,colorScheme:m,legendInteraction:R,legendPosition:L,selection:w,linkedHover:k,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:S,onClick:A,hoverHighlight:M,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"RidgelinePlot",chartId:C,showLegend:z,userMargin:i,marginDefaults:o.marginDefaults,loading:j,loadingContent:_,emptyContent:P,width:E,height:D}),Q=qi(),U=(0,pa.useMemo)(()=>new Map,[K]),J=ws({colorBy:g,colorScale:Z.colorScale,color:I,themeCategorical:Q,colorScheme:m,categoryIndexMap:U,userPieceStyle:void 0,stroke:T,strokeWidth:$,opacity:B,effectiveSelectionHook:Z.effectiveSelectionHook,resolvedSelection:Z.resolvedSelection,baseStyleExtras:{fillOpacity:.5},linkStrokeToFill:!0}),ee=(0,pa.useMemo)(()=>Ws(),[]);if(Z.earlyReturn)return Z.earlyReturn;const te=fs({componentName:"RidgelinePlot",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(te)return(0,ba.jsx)(ts,{componentName:"RidgelinePlot",message:te,width:E,height:D});const oe={chartType:"ridgeline",...null!=r&&{data:K},oAccessor:a,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",summaryStyle:J,bins:u,size:[E,D],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Z.margin,barPadding:y,enableHover:F,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:X,rLabel:Y,rFormat:f,...O&&{oFormat:O},showGrid:N,showCategoryTicks:H,oSort:!1,amplitude:d,...Z.legendBehaviorProps,...ri({title:W,description:q,summary:G,accessibleTable:V,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...si({tooltip:p,defaultTooltipContent:ee}),...ii({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(0,ba.jsx)(as,{componentName:"RidgelinePlot",width:E,height:D,children:(0,ba.jsx)(ni,{ref:n,...oe})})});va.displayName="RidgelinePlot";var xa=require("react"),wa=require("react/jsx-runtime"),ka=(0,xa.forwardRef)(function(e,t){const o=Xi(e.mode,{width:e.width,height:e.height,showGrid:!1,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,showCategoryTicks:!1,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=(0,xa.useRef)(null);Es(t,{variant:"xy",frameRef:n});const{data:r,margin:i,className:s,stepAccessor:a="step",valueAccessor:l="value",categoryAccessor:c,colorBy:u,colorScheme:d,orientation:f="horizontal",connectorOpacity:g=.3,showLabels:m=!0,tooltip:y,annotations:p,frameProps:b={},selection:v,linkedHover:x,onObservation:w,onClick:k,hoverHighlight:S,chartId:A,loading:M,loadingContent:C,emptyContent:j,legendInteraction:_,legendPosition:P,color:R,stroke:L,strokeWidth:I,opacity:T,categoryFormat:$}=e,B="vertical"===f,{width:H,height:O,enableHover:E,showLegend:D,title:F,description:N,summary:z,accessibleTable:W}=o,q=B?{top:F?60:40,right:20,bottom:60,left:60}:{top:F?40:10,right:10,bottom:10,left:10},G=(0,xa.useMemo)(()=>h(r),[r]),V=u||c,X=!V,Y=ys({data:G,rawData:r,colorBy:V,colorScheme:d,legendInteraction:_,legendPosition:P,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:D,userMargin:i,marginDefaults:q,loading:M,loadingContent:C,emptyContent:j,width:H,height:O});us("FunnelChart",G,"stepAccessor",a),us("FunnelChart",G,"valueAccessor",l);const K=qi(),Z=(0,xa.useMemo)(()=>new Map,[G]),Q=(0,xa.useMemo)(()=>{if(X)return R||(K?.[0]?K[0]:Array.isArray(d)&&d[0]?d[0]:"#4e79a7")},[X,R,K,d]),U=ws({colorBy:Q?void 0:V,colorScale:Y.colorScale,color:Q??R,themeCategorical:K,colorScheme:d,categoryIndexMap:Z,userPieceStyle:b?.pieceStyle,stroke:L,strokeWidth:I,opacity:T,effectiveSelectionHook:Y.effectiveSelectionHook,resolvedSelection:Y.resolvedSelection}),J=(0,xa.useMemo)(()=>e=>{const t=e?.data||e,o=t?.__funnelStep||t?.__barFunnelStep||t?.step||"",n=t?.__funnelValue??t?.__barFunnelValue??t?.value??"",r=t?.__funnelPercent??t?.__barFunnelPercent,i=t?.__funnelIsFirstStep??t?.__barFunnelIsFirstStep,s=t?.__barFunnelIsDropoff,a=t?.__barFunnelCategory??t?.category,l=null==r||i?"":` (${.05>Math.abs(r-Math.round(r))?Math.round(r)+"%":r.toFixed(1)+"%"})`;return(0,wa.jsxs)("div",{className:"semiotic-tooltip",style:Nn,children:[o&&(0,wa.jsx)("div",{style:{fontWeight:"bold"},children:o+""}),a&&a!==o&&(0,wa.jsx)("div",{style:{marginTop:2,opacity:.8},children:a+""}),s&&(0,wa.jsx)("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7},children:"Dropoff"}),(0,wa.jsxs)("div",{style:{marginTop:4},children:[n+"",l]})]})},[]);if(Y.earlyReturn)return Y.earlyReturn;const ee=fs({componentName:"FunnelChart",data:r,accessors:{stepAccessor:a,valueAccessor:l}});if(ee)return(0,wa.jsx)(ts,{componentName:"FunnelChart",message:ee,width:H,height:O});const te={chartType:B?"bar-funnel":"funnel",...null!=r&&{data:G},oAccessor:a,rAccessor:l,...c&&{stackBy:c},projection:B?"vertical":"horizontal",barPadding:B?40:0,pieceStyle:U,size:[H,O],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Y.margin,enableHover:E,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:B,showCategoryTicks:B,...$&&{oFormat:$},showGrid:B,...!B&&{connectorOpacity:g},showLabels:m,...Y.legendBehaviorProps,...F&&{title:F},...N&&{description:N},...z&&{summary:z},...void 0!==W&&{accessibleTable:W},...s&&{className:s},...null!=e.animate&&{animate:e.animate},tooltipContent:!1===y?()=>null:!0===y||null==y?J:Gn(y)||J,...ii({linkedHover:x,selection:v,onObservation:w,onClick:k,hoverHighlight:S,mobileInteraction:Y.mobileInteraction,customHoverBehavior:Y.customHoverBehavior,customClickBehavior:Y.customClickBehavior}),...p&&p.length>0&&{annotations:p},...Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e))};return(0,wa.jsx)(as,{componentName:"FunnelChart",width:H,height:O,children:(0,wa.jsx)(ni,{ref:n,...te})})});ka.displayName="FunnelChart";var Sa=l(require("react")),Aa=require("react"),Ma=require("react"),Ca=require("react"),ja={RdBu:O,PiYG:E,PRGn:D,BrBG:F,RdYlBu:N,RdYlGn:z,Spectral:W},_a="__likert_neutral_neg",Pa="__likert_neutral_pos";function Ra(e,t){if("function"==typeof e)return e;const o=e||t;return e=>e[o]}function La(e,t,o,n,r,i){const s=new Map,a=new Set(t);for(const l of e){const e=o(l);s.has(e)||s.set(e,new Map);const c=s.get(e);if(n){const e=n(l);if(null==e||!Number.isFinite(e))continue;if(!Number.isInteger(e)){"production"!==process.env.NODE_ENV&&console.warn("[LikertChart] Ignoring non-integer Likert score:",e);continue}const o=e-1;if(0>o||o>=t.length)continue;const r=t[o];c.set(r,(c.get(r)||0)+1)}else if(r&&i){const e=r(l),t=i(l);if(!a.has(e))continue;c.set(e,(c.get(e)||0)+(Number.isFinite(t)?t:0))}}const l=[];for(const[e,o]of s){let n=0;for(const e of t)n+=o.get(e)||0;if(0!==n)for(let r=0;t.length>r;r++){const i=t[r],s=o.get(i)||0;l.push({__likertCategory:e,__likertLevel:i,__likertLevelLabel:i,__likertCount:s,__likertPct:s/n*100,__likertLevelIndex:r})}}return l}function Ia(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:_a,__likertPct:-e}),i.push({...t,__likertLevel:Pa,__likertPct:e})}else i.push(r>e?{...t,__likertPct:-t.__likertPct}:t)}return i}function Ta(e,t){const o=t.length,n=o%2!=0,r=Math.floor(o/2),i=new Map;for(const t of e){const e=i.get(t.__likertCategory)||[];e.push(t),i.set(t.__likertCategory,e)}const s=[];for(const[,e]of i){const t=new Map;let i,a;for(const o of e)o.__likertLevel===_a?i=o:o.__likertLevel===Pa?a=o:t.set(o.__likertLevelIndex,o);n&&i&&s.push(i);for(let e=r-1;e>=0;e--){const o=t.get(e);o&&s.push(o)}n&&a&&s.push(a);for(let e=n?r+1:r;o>e;e++){const o=t.get(e);o&&s.push(o)}}return s}var $a=["Very Low","Low","Neutral","High","Very High"],Ba=require("react/jsx-runtime"),Ha=new Map,Oa=(0,Aa.forwardRef)(function(e,t){const o=Xi(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=(0,Aa.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="question",valueAccessor:l,levelAccessor:c,countAccessor:u="count",levels:d=$a,orientation:h="horizontal",colorScheme:f,barPadding:g=20,tooltip:m,annotations:y,valueExtent:p,frameProps:b={},selection:v,linkedHover:x,onObservation:w,onClick:k,hoverHighlight:S,chartId:A,valueFormat:M,loading:C,loadingContent:j,emptyContent:_,legendInteraction:P,legendPosition:R,categoryFormat:L,stroke:I,strokeWidth:T,opacity:$}=e,{width:B,height:H,enableHover:O,showGrid:E,showLegend:D,title:F,description:N,summary:z,accessibleTable:W,categoryLabel:q,valueLabel:G}=o,X="horizontal"===h,K=void 0===r,Q=!c,U=function(){const e=Bi();return e?.colors?.diverging||void 0}(),J=(0,Aa.useMemo)(()=>f&&Array.isArray(f)&&f.length>=d.length?f:function(e,t){if(0>=e)return[];if(t){const o=ja[t];if(o){if(1===e)return[o(.5)];const t=[];for(let n=0;e>n;n++)t.push(o(n/(e-1)));return t}}const o=["#da1e28","#ff8389","#ffb3b8"],n=["#a6c8ff","#4589ff","#0043ce"],r="#a8a8a8";if(1===e)return[r];const i=e%2!=0,s=Math.floor(e/2),a=[];for(let e=0;s>e;e++)a.push(o[Math.min(Math.floor(e*o.length/s),o.length-1)]);i&&a.push(r);for(let e=0;s>e;e++)a.push(n[Math.min(Math.floor(e*n.length/s),n.length-1)]);return a}(d.length,U),[f,d.length,U]),ee=(0,Aa.useMemo)(()=>{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:s,frameRef:a}){const l=!r,c=(0,Ca.useMemo)(()=>Ra(o,"question"),[o]),u=(0,Ca.useMemo)(()=>l?Ra(n,"score"):null,[l,n]),d=(0,Ca.useMemo)(()=>l?null:Ra(r,"level"),[l,r]),h=(0,Ca.useMemo)(()=>l?null:Ra(i,"count"),[l,i]),f=e||[],g=(0,Ca.useRef)([]);return{processedData:(0,Ca.useMemo)(()=>{if(0===f.length)return[];let e=La(f,t,c,u,d,h);return s&&(e=Ia(e,t),e=Ta(e,t)),e},[f,t,c,u,d,h,s]),reAggregate:(0,Ca.useCallback)(e=>{let o=La(e,t,c,u,d,h);s&&(o=Ia(o,t),o=Ta(o,t)),a.current?.replace(o)},[t,c,u,d,h,s,a]),accumulatorRef:g}}({data:r,levels:d,categoryAccessor:a,valueAccessor:l,levelAccessor:c,countAccessor:u,isDiverging:X,frameRef:n}),re="__likertLevelLabel",ie=function({isPushMode:e,colorBy:t,colorScheme:o,showLegend:n,legendPosition:r="right"}){const i=(0,Ma.useRef)(new Set),s=(0,Ma.useRef)([]),[a,l]=(0,Ma.useState)(0),c=di(),u=qi(),d=(0,Ma.useCallback)(e=>{if(!t)return null;const o="function"==typeof t?t(e):e[t];return null!=o?o+"":null},[t]),h=(0,Ma.useCallback)(o=>{if(!e||!t)return;let n=!1;for(const e of o){if(!e||"object"!=typeof e)continue;const t=d(e);null==t||i.current.has(t)||(i.current.add(t),s.current.push(t),n=!0)}n&&l(e=>e+1)},[e,t,d]),f=(0,Ma.useCallback)(o=>{if(!e||!t)return;const n=Array.from(new Set(o.map(String))),r=s.current;r.length===n.length&&r.every((e,t)=>e===n[t])||(i.current=new Set(n),s.current=n,l(e=>e+1))},[e,t]),g=(0,Ma.useCallback)(e=>t=>{h([t]),e(t)},[h]),m=(0,Ma.useCallback)(e=>t=>{h(t),e(t)},[h]),y=(0,Ma.useCallback)(()=>{i.current=new Set,s.current=[],l(e=>e+1)},[]);Ii(e&&t?s.current:[]);const p=(0,Ma.useMemo)(()=>{if(!e||!t||!1===n)return;const r=s.current;if(0===r.length)return;const i=Array.isArray(o)&&o.length>0||"string"==typeof o&&o.length>0?o:u&&u.length>0?u:V,a="string"==typeof t?t:"__streamCat",l=r.map(e=>({[a]:e})),d=Z(l,a,i);return Ti({data:l,colorBy:a,colorScale:e=>c?.[e]||d(e)||"#999",getColor:Y})},[e,t,n,o,c,u,a]),b=(0,Ma.useMemo)(()=>{if(p)return"right"===r?{right:110}:"left"===r?{left:110}:"top"===r?{top:50}:"bottom"===r?{bottom:80}:{right:110}},[p,r]);return{wrapPush:g,wrapPushMany:m,resetCategories:y,categories:s.current,categoryDomainProps:e&&t?{legendCategoryAccessor:t,onCategoriesChange:f}:{},streamingLegend:p,streamingMarginAdjust:b}}({isPushMode:K,colorBy:re,colorScheme:J,showLegend:D,legendPosition:R}),se=(0,Aa.useCallback)(ie.wrapPush(e=>{ne.current.push(e),oe(ne.current)}),[ie.wrapPush,oe,ne]),ae=(0,Aa.useCallback)(ie.wrapPushMany(e=>{ne.current.push(...e),oe(ne.current)}),[ie.wrapPushMany,oe,ne]);(0,Aa.useImperativeHandle)(t,()=>({push:se,pushMany:ae,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}),[se,ae,ie.resetCategories,ne]);const le=ys({data:te,rawData:r,colorBy:re,colorScheme:J,legendInteraction:P,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:D,userMargin:i,marginDefaults:o.marginDefaults,loading:C,loadingContent:j,emptyContent:_,width:B,height:H}),ce=(0,Aa.useMemo)(()=>{const e=d.length;return e%2!=0&&ee.get(d[Math.floor(e/2)])||"#888"},[d,ee]),ue=ws({colorBy:void 0,colorScale:void 0,color:void 0,themeCategorical:void 0,colorScheme:void 0,categoryIndexMap:Ha,userPieceStyle:b?.pieceStyle,stroke:I,strokeWidth:T,opacity:$,effectiveSelectionHook:le.effectiveSelectionHook,resolvedSelection:le.resolvedSelection,baseStyleExtras:e=>{const t=e.__likertLevelLabel||e.data?.__likertLevelLabel,o=e.__likertLevel||e.data?.__likertLevel;if(o===_a||o===Pa)return{fill:ce};const n=t||o;return n&&ee.has(n)?{fill:ee.get(n)}:{fill:"#888"}}}),de=(0,Aa.useMemo)(()=>{const e=d.length;return e%2!=0?d[Math.floor(e/2)]:""},[d]),he=(0,Aa.useMemo)(()=>e=>{const t=e.data||e,o=t.__likertLevel||"Unknown",n=o===_a||o===Pa?de:o,r=t.__likertCategory||"",i=Math.abs(t.__likertPct||0),s=o===_a||o===Pa?2*i:i,a=t.__likertCount||0;return Sa.createElement("div",{className:"semiotic-tooltip",style:Nn},Sa.createElement("div",{style:{fontWeight:"bold"}},r),Sa.createElement("div",{style:{marginTop:4}},`${n}: ${s.toFixed(1)}% (n=${a})`))},[de]),fe=(0,Aa.useMemo)(()=>{if(!d||2>d.length)return"LikertChart requires `levels` with at least 2 entries.";if(l&&c)return"LikertChart: provide either `valueAccessor` (raw responses) or `levelAccessor` + `countAccessor` (pre-aggregated), not both.";if(c&&!u)return"LikertChart: pre-aggregated mode requires both `levelAccessor` and `countAccessor`.";if(void 0!==r&&0===r.length)return null;const e={categoryAccessor:a};return Q?l&&(e.valueAccessor=l):(c&&(e.levelAccessor=c),u&&(e.countAccessor=u)),fs({componentName:"LikertChart",data:r,accessors:e,requiredProps:{levels:d}})},[r,a,l,c,u,d,Q]),ge=(0,Aa.useMemo)(()=>[{styleFn:e=>({fill:ee.get(e.label)||"#888"}),items:d.map(e=>({label:e})),label:""}],[d,ee]),me=(0,Aa.useMemo)(()=>!1!==D?{...le.legendBehaviorProps,legend:{legendGroups:ge},legendPosition:R||le.legendPosition||"bottom"}:le.legendBehaviorProps,[le.legendBehaviorProps,le.legendPosition,R,D,ge]),ye=(0,Aa.useMemo)(()=>{const e={...le.margin};if(K&&!1!==D){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 X&&100>e.left&&(e.left=100),e},[le.margin,ie.streamingMarginAdjust,X,K,D,R]),pe=(0,Aa.useMemo)(()=>M||(X?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[X,M]);if(le.earlyReturn)return le.earlyReturn;const be={chartType:"bar",...null!=r&&{data:te},oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:X?"horizontal":"vertical",pieceStyle:ue,size:[B,H],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ye,barPadding:g,enableHover:O,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:q,rLabel:G||(X?void 0:"Percentage"),rFormat:pe,...L&&{oFormat:L},showGrid:E,...me,...F&&{title:F},...N&&{description:N},...z&&{summary:z},...void 0!==W&&{accessibleTable:W},...s&&{className:s},...null!=e.animate&&{animate:e.animate},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},tooltipContent:!1===m?()=>null:!0===m?he:Gn(m)||he,...ii({linkedHover:x,selection:v,onObservation:w,onClick:k,hoverHighlight:S,mobileInteraction:le.mobileInteraction,customHoverBehavior:le.customHoverBehavior,customClickBehavior:le.customClickBehavior}),...y&&y.length>0&&{annotations:y},...p&&{rExtent:p},...Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e))};return fe?(0,Ba.jsx)(ts,{componentName:"LikertChart",message:fe,width:B,height:H}):(0,Ba.jsx)(as,{componentName:"LikertChart",width:B,height:H,children:(0,Ba.jsx)(ni,{ref:n,...be})})});Oa.displayName="LikertChart";var Ea=require("react"),Da=require("react");var Fa=require("react/jsx-runtime"),Na=(0,Ea.forwardRef)(function(e,t){const{data:o,layout:n,layoutConfig:r,onLayoutError:i,categoryAccessor:s="category",valueAccessor:a="value",oExtent:l,rExtent:c,projection:u="vertical",margin:d,className:h,colorBy:f,colorScheme:g,showAxes:m=!1,annotations:y,onObservation:p,onClick:b,selection:v,linkedHover:x,chartId:w,loading:k,loadingContent:S,emptyContent:A,frameProps:M={}}=e,{frameRef:C,resolved:j,safeData:_,setup:P,earlyReturn:R}=function(e){const t=function(e){const t=(0,Da.useRef)(null);return Es(e.imperativeRef,{variant:e.imperativeVariant,frameRef:t}),{frameRef:t,resolved:Xi(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),normalizedMargin:(0,Da.useMemo)(()=>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=ys({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:g,selection:v,linkedHover:x,onObservation:p,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}),L=P.effectiveSelectionHook,I=(0,Ea.useMemo)(()=>L?.isActive?{isActive:!0,predicate:L.predicate}:null,[L?.isActive,L?.predicate]);if(R)return R;const{width:T,height:$,enableHover:B,showGrid:H,title:O,description:E,summary:D,accessibleTable:F}=j,N={chartType:"custom",...null!=o&&{data:_},customLayout:n,layoutConfig:r,onLayoutError:i,...I&&{layoutSelection:I},oAccessor:s,rAccessor:a,oExtent:l,rExtent:c,projection:u,colorAccessor:f,colorScheme:g,size:[T,$],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:P.margin,enableHover:B,showAxes:m,showGrid:H,annotations:y,...ri({title:O,description:E,summary:D,accessibleTable:F,className:h,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...ii({linkedHover:x,selection:v,onObservation:p,onClick:b,hoverHighlight:!1,mobileInteraction:P.mobileInteraction,customHoverBehavior:P.customHoverBehavior,customClickBehavior:P.customClickBehavior}),...M};return(0,Fa.jsx)(as,{componentName:"OrdinalCustomChart",width:T,height:$,children:(0,Fa.jsx)(ni,{ref:C,...N})})});Na.displayName="OrdinalCustomChart";var za={fill:"rgba(0,0,0,0)",stroke:"rgba(0,0,0,0)",opacity:0},Wa=8;function qa(e){return null==e?void 0:e+""}function Ga(e){const t=qa(e.id);return{type:"point",x:e.x,y:e.y,r:e.r??Wa,style:{...za},datum:e.datum,pointId:t,_transitionKey:t}}function Va(e){return{type:"rect",x:e.x,y:e.y,w:e.width,h:e.height,style:{...za},datum:e.datum,group:e.group,_transitionKey:qa(e.id)}}
|
|
2
|
+
var e,t,n,o,r,i,s=Object.create,a=Object.defineProperty,l=Object.getOwnPropertyDescriptor,c=Object.getOwnPropertyNames,u=Object.getPrototypeOf,d=Object.prototype.hasOwnProperty,h=(e,t,n)=>function(){if(n)throw n[0];try{return e&&(t=(0,e[c(e)[0]])(e=0)),t}catch(e){throw n=[e],e}},f=(e,t)=>{for(var n in t)a(e,n,{get:t[n],enumerable:!0})},m=(e,t,n,o)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let r of c(t))d.call(e,r)||r===n||a(e,r,{get:()=>t[r],enumerable:!(o=l(t,r))||o.enumerable});return e},g=(e,t,n)=>(n=null!=e?s(u(e)):{},m(!t&&e&&e.__esModule?n:a(n,"default",{value:e,enumerable:!0}),e)),y=h({"src/components/stream/brushAccessibility.ts"(){e=g(require("react")),t="Use arrow keys to move the selected range, Shift plus an arrow key to resize it, and Escape to clear it."}}),p={};function b({width:s,height:a,totalWidth:l,totalHeight:c,margin:u,scales:d,onBrush:h}){const f=(0,n.useRef)(null),m=(0,n.useRef)(null),g=(0,n.useRef)(h);g.current=h;const y=(0,n.useRef)(d);y.current=d;const p=(0,n.useRef)(!1),b=(0,n.useRef)(null),v="horizontal"===d?.projection,x=(0,n.useRef)(v);x.current=v;const w=function({label:n="Data range brush",description:o=t,onAction:r}={}){const i=e.useId().replace(/:/g,""),s=e.useRef(r);return s.current=r,{description:o,descriptionId:"semiotic-brush-description-"+i,svgProps:{role:"region",tabIndex:0,"aria-label":n,"aria-describedby":"semiotic-brush-description-"+i,onKeyDown:e.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(),s.current?.(t))},[])}}}({label:"Ordinal value range brush",onAction:e=>{const t=y.current,n=m.current;if(!t||!n||!f.current)return;const r=(0,o.select)(f.current).select(".brush-g");if("clear"===e.type)return p.current=!0,r.call(n.move,null),p.current=!1,b.current=null,void g.current(null);if(("left"===e.direction||"right"===e.direction)!=!!x.current)return;const i=t.r.domain(),[s,a]=[Math.min(...i),Math.max(...i)],l=(a-s)/20,c=b.current?.r??[s+.4*(a-s),s+.6*(a-s)],u="left"===e.direction||"down"===e.direction?-1:1;let[d,h]=c;if(e.resize)0>u?d=Math.max(s,d-l):h=Math.min(a,h+l);else{const e=h-d;d=Math.max(s,Math.min(a-e,d+u*l)),h=d+e}const v={r:[d,h]};p.current=!0,r.call(n.move,x.current?[t.r(d),t.r(h)]:[t.r(h),t.r(d)]),p.current=!1,b.current=v,g.current(v)}});return(0,n.useEffect)(()=>{if(!f.current)return;const e=(0,o.select)(f.current).select(".brush-g"),t=v?(0,r.brushX)():(0,r.brushY)();return t.extent([[0,0],[s,a]]),t.on("brush end",e=>{if(p.current)return;const t=y.current;if(!t)return;if(!e.selection)return b.current=null,void g.current(null);const[n,o]=e.selection;let r;r=x.current?[t.r.invert(n),t.r.invert(o)]:[t.r.invert(o),t.r.invert(n)];const i={r:r};b.current=i,g.current(i)}),e.call(t),m.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null),m.current=null}},[s,a,v]),(0,n.useEffect)(()=>{if(!d||!m.current||!b.current)return;if(!f.current)return;const e=b.current,t=(0,o.select)(f.current).select(".brush-g"),n=d.r(e.r[0]),r=d.r(e.r[1]);v?(p.current=!0,t.call(m.current.move,[n,r]),p.current=!1):(p.current=!0,t.call(m.current.move,[r,n]),p.current=!1)},[d,v]),(0,i.jsxs)("svg",{ref:f,width:l,height:c,...w.svgProps,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[(0,i.jsx)("title",{children:w.svgProps["aria-label"]}),(0,i.jsx)("desc",{id:w.descriptionId,children:w.description}),(0,i.jsx)("g",{className:"brush-g",transform:`translate(${u.left},${u.top})`,style:{pointerEvents:"all"}})]})}f(p,{OrdinalBrushOverlay:()=>b});var v,x=h({"src/components/stream/OrdinalBrushOverlay.tsx"(){n=require("react"),o=require("d3-selection"),r=require("d3-brush"),y(),i=require("react/jsx-runtime")}}),w={};f(w,{AnnotationLabel:()=>$n,BarChart:()=>Na,BoxPlot:()=>cl,DEFAULT_HIT_RADIUS:()=>ac,DonutChart:()=>Ml,DotPlot:()=>vl,FunnelChart:()=>Dl,GaugeChart:()=>$l,GroupedBarChart:()=>Ya,Histogram:()=>fl,LikertChart:()=>tc,OrdinalCustomChart:()=>ic,PieChart:()=>kl,RidgelinePlot:()=>Ol,StackedBarChart:()=>Ga,StreamOrdinalFrame:()=>fs,SwarmPlot:()=>rl,SwimlaneChart:()=>Ja,ViolinPlot:()=>yl,composeStyleRules:()=>Oa,createHatchPattern:()=>Hn,estimateLabelWidth:()=>Tn,glyphExtent:()=>pt,glyphPlacement:()=>yt,hatchFillId:()=>Dn,hatchPatternDef:()=>Nn,hitTargetPoint:()=>cc,hitTargetRect:()=>uc,isHatchFill:()=>Fn,makeNodeRuleContext:()=>Ia,makeRuleValueResolver:()=>Pa,makeStyleRuleStyleFn:()=>Fa,makeXYRuleContext:()=>La,matchesThreshold:()=>$a,resolveResponsiveRules:()=>Vs,resolveStyleRules:()=>Ha,resolveSvgFill:()=>zn,responsiveRuleMatches:()=>Gs,ruleMatches:()=>Ba,useCustomLayoutSelection:()=>ct}),module.exports=(v=w,m(a({},"__esModule",{value:!0}),v));var k=require("react"),S=Object.freeze([]);function A(e){if(!e)return S;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}var M=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=A(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=A(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}},C=require("d3-scale"),j=class{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;return{next:()=>this._size>e?{done:!1,value:this.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray();let n=0,o=[];t.length>e&&(n=t.length-e,o=t.slice(0,n)),this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(let e=n;t.length>e;e++)this.push(t[e]);return o}update(e,t){const n=[],o=(this.head-this._size+this._capacity)%this._capacity;for(let r=0;this._size>r;r++){const i=(o+r)%this._capacity,s=this.buffer[i];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:{...s},n.push(e),this.buffer[i]=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{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 R(e,t,n){const o=e.duration??500,r=n-t;return o>r?1-r/o:0}function P(e,t,n,o){let r=!1;return t>0?(e._pulseIntensity!==t&&(e._pulseIntensity=t,r=!0),e._pulseColor!==n&&(e._pulseColor=n,r=!0),e._pulseGlowRadius!==o&&(e._pulseGlowRadius=o,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 L(e,t,n){return e+(t-e)*n}function I(e,t){return e===t}function T(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function $(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}function B(e){return new Set(Array.isArray(e)?e:[e])}var H=require("d3-scale");function O(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function F(e,t,n){const o=e=>e.toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function E(e){const t=e.map(O),n=t.length-1;return e=>{if(0>=e){const[e,n,o]=t[0];return F(e,n,o)}if(e>=1){const[e,o,r]=t[n];return F(e,o,r)}const o=e*n,r=Math.floor(o),i=o-r,[s,a,l]=t[r],[c,u,d]=t[r+1];return F(Math.round(s+(c-s)*i),Math.round(a+(u-a)*i),Math.round(l+(d-l)*i))}}var D=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],W=E(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),N=E(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),z=E(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),q=E(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),G=E(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),V=E(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),X={blues:W,reds:N,greens:z,viridis:E(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),oranges:q,purples:G,greys:V,plasma:E(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),inferno:E(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),magma:E(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),cividis:E(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),turbo:E(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"])},Y=E(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),U=E(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),K=E(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),Q=E(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),Z=E(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),J=E(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),ee=E(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]),te={category10:D,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],...X},ne=D,oe=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],re=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 ie(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")||re.has(t)}(o)?n(o):o}const o=e?.[t]+"";return n?n(o):ne[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))%ne.length]}function se(e,t){if(null==t||!Object.prototype.hasOwnProperty.call(e,t))return;const n=e[t];return"string"==typeof n&&n.length>0?n:void 0}function ae(e,t,n="category10"){if(n&&"object"==typeof n&&!Array.isArray(n)){const e=n;return t=>se(e,t)??"#999"}const o=Array.from(new Set(e.map(e=>e?.[t]).filter(e=>null!=e).map(e=>e+""))),r=o.every(e=>!isNaN(Number(e)));if(Array.isArray(n))return(0,H.scaleOrdinal)().domain(o).range(n).unknown("#999");const i=te[n]||te.category10;if(r&&"function"==typeof i){let e=-1/0;for(const t of o){const n=Number(t);n>e&&(e=n)}return t=>i(Number(t)/e)}{const e=Array.isArray(i)?i:ne;return(0,H.scaleOrdinal)().domain(o).range(e).unknown("#999")}}function le(e,t,n=[3,20],o){let r;if(r="function"==typeof t?t(e):e?.[t],!o)return r;const[i,s]=o,[a,l]=n;if(s===i)return(a+l)/2;let c=(r-i)/(s-i);return 0>c?c=0:c>1&&(c=1),a+c*(l-a)}var ce=class{constructor(){this.colorSchemeMap=new Map,this.colorSchemeIndex=0}resetColors(){this.colorSchemeMap.clear(),this.colorSchemeIndex=0}resolvePieceStyle(e,t,n){if(t&&"function"==typeof e.pieceStyle){const o=e.pieceStyle(t,n);return o&&!o.fill&&n?{...o,fill:this.getColorFromScheme(e,n)}:o}return e.pieceStyle&&"object"==typeof e.pieceStyle?e.pieceStyle:e.barColors&&n?{fill:e.barColors[n]||"#007bff"}:{fill:n?this.getColorFromScheme(e,n):"#007bff"}}resolveSummaryStyle(e,t,n){return t&&"function"==typeof e.summaryStyle?e.summaryStyle(t,n):e.summaryStyle&&"object"==typeof e.summaryStyle?e.summaryStyle:{fill:"#007bff",fillOpacity:.6,stroke:"#007bff",strokeWidth:1}}getColorFromScheme(e,t){const n=this.colorSchemeMap.get(t);if(n)return n;const o=Array.isArray(e.colorScheme)?e.colorScheme:e.themeCategorical||oe,r=o[this.colorSchemeIndex%o.length];return this.colorSchemeIndex++,this.colorSchemeMap.set(t,r),r}};function ue(e,t,n,o,r,i,s){return{type:"rect",x:e,y:t,w:n,h:o,style:r,datum:i,group:s}}var de=require("d3-shape"),he={circle:de.symbolCircle,square:de.symbolSquare,triangle:de.symbolTriangle,diamond:de.symbolDiamond,star:de.symbolStar,cross:de.symbolCross,wye:de.symbolWye},fe=["circle","triangle","diamond","star","square","chevron","cross","wye"];function me(e,t,n){if(n)return n;const o=e??"circle";return"chevron"===o?function(e){const t=1.5*ge(e),n=.92*t;return`M0,${-t}L${n},${(.78*t).toFixed(3)}L0,${(.28*t).toFixed(3)}L${-n},${(.78*t).toFixed(3)}Z`}(t):(0,de.symbol)(he[o]??de.symbolCircle,Math.max(1,t))()??""}function ge(e){return Math.sqrt(Math.max(1,e)/Math.PI)}function ye(e){const t=e.getSymbol;if(!t)return null;const n=e.config.symbolMap,o=new Map;let r=0;return e=>{const i=t(e)+"",s=n?.[i];if(s)return s;let a=o.get(i);return a||(a=fe[r%fe.length],r++,o.set(i,a)),a}}function pe(e,t,n,o,r,i,s){e.push(t?{type:"symbol",x:o,y:r,size:Math.PI*i*i,symbolType:t(n),style:s,datum:n}:{type:"point",x:o,y:r,r:i,style:s,datum:n})}function be(e,t){const{columns:n,config:o,resolvePieceStyle:r}=e,i=[],s=Math.min(t.width,t.height)/2-4,a="donut"===o.chartType?o.innerRadius||60:0,l=-Math.PI/2+(o.startAngle||0)*Math.PI/180,c=null!=o.sweepAngle?o.sweepAngle*Math.PI/180:2*Math.PI,u=null!=o.sweepAngle&&360>o.sweepAngle,d=Object.values(n),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&&(o.cornerRadius??0)>0;for(let e=0;d.length>e;e++){const t=d[e],n=t.pieceData[0],u="number"==typeof n?._pctStart?n._pctStart:t.pctStart,h=l+u*c,m=l+(u+("number"==typeof n?._pct?n._pct:t.pct))*c,g=r(t.pieceData[0],t.name),y=0===e,p=e===d.length-1,b={type:"wedge",cx:0,cy:0,innerRadius:a,outerRadius:s,startAngle:h,endAngle:m,...o.cornerRadius&&{cornerRadius:o.cornerRadius},style:g,datum:n?._nonInteractive?null:t.pieceData,category:t.name};n?._roundedEnds?b.roundedEnds=n._roundedEnds:f&&(b.roundedEnds={start:y,end:p}),n?._gradientBand&&(b._gradientBand=n._gradientBand),i.push(b)}return i}var ve=require("d3-array");function xe(e){let t=1/0,n=-1/0;for(const o of e)t>o&&(t=o),o>n&&(n=o);return[t,n]}function we(e,t=-1/0){let n=t;for(const t of e)t>n&&(n=t);return n}function ke(e){const t=e.length,n=e[0],o=e[t-1];return{n:t,min:n,q1:(0,ve.quantile)(e,.25)??n,median:(0,ve.quantile)(e,.5)??(n+o)/2,q3:(0,ve.quantile)(e,.75)??o,max:o,mean:e.reduce((e,t)=>e+t,0)/t}}var Se=require("d3-scale"),Ae={bar:function(e,t){const{scales:n,columns:o,config:r,getR:i,getStack:s,resolvePieceStyle:a}=e,{r:l,projection:c}=n,u=[],d="vertical"===c,h="horizontal"===c,f=r.normalize,m=[];if(s){const e=new Set;for(const t of Object.values(o))for(const n of t.pieceData){const t=s(n);e.has(t)||(e.add(t),m.push(t))}}else m.push("_default");for(const e of Object.values(o)){const t=new Map;for(const n of e.pieceData){const e=s?s(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const o=t.get(e);o.total+=i(n),o.pieces.push(n)}let n=0;if(f)for(const e of t.values())n+=Math.abs(e.total);let o=0,r=0;for(const i of m){const c=t.get(i);if(!c)continue;let m=c.total;f&&n>0&&(m/=n);const g=a(c.pieces[0],s?i:e.name),y={...c.pieces[0],__aggregateValue:c.total,__pieceCount:c.pieces.length,category:e.name};if(d){const t=l(0>m?r:o+m),n=0>m?l(r+m)-l(r):l(o)-l(o+m);u.push(ue(e.x,t,e.width,Math.abs(n),g,y,i)),0>m?r+=m:o+=m}else if(h){const t=l(0>m?r+m:o),n=0>m?l(r)-l(r+m):l(o+m)-l(o);u.push(ue(t,e.x,Math.abs(n),e.width,g,y,i)),0>m?r+=m:o+=m}}}const g="vertical"===c,y=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(y>0){const e=new Map;for(const t of u){if("rect"!==t.type)continue;const n=t.datum?.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=>(e.datum?.__aggregateValue??0)>=0),n=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=y),n.length>0&&(n.reduce(g?(e,t)=>e.y+e.h>t.y+t.h?e:t:(e,t)=>t.x>e.x?e:t).roundedTop=y)}}return u},clusterbar:function(e,t){const{scales:n,columns:o,config:r,getR:i,getGroup:s,resolvePieceStyle:a}=e,{r:l,projection:c}=n,u=[],d="vertical"===c,h=[],f=new Set;for(const e of Object.values(o))for(const t of e.pieceData){const e=s?s(t):"_default";f.has(e)||(f.add(e),h.push(e))}const m=h.length||1;for(const e of Object.values(o)){const t=e.width/m,n=.2*t,o=t-n,r=new Map;for(const t of e.pieceData){const e=s?s(t):"_default";r.has(e)||r.set(e,[]),r.get(e).push(t)}for(let s=0;h.length>s;s++){const c=r.get(h[s])||[];for(const r of c){const c=i(r),f=a(r,h[s]);if(d){const i=e.x+s*t+n/2,a=l(0),d=l(c);u.push(ue(i,Math.min(a,d),o,Math.abs(a-d),f,r,h[s]))}else{const i=e.x+s*t+n/2,a=l(0),d=l(c);u.push(ue(Math.min(a,d),i,Math.abs(d-a),o,f,r,h[s]))}}}}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:n,columns:o,getR:r,multiScales:i,resolvePieceStyle:s}=e,{r:a,projection:l}=n,c=[],u="vertical"===l,d="radial"===l,h=i.length>0,f=ye(e),m=2*Math.PI,g=-Math.PI/2;for(const e of Object.values(o))for(const t of e.pieceData){const n=t.__rIndex??0,o=t.__rValue??r(t),l=h&&i[n]||a,y=s(t,e.name),p=y.r||5;let b,v;if(d){const t=g+(e.pctStart+e.pct/2)*m,n=l(o);b=Math.cos(t)*n,v=Math.sin(t)*n}else u?(b=e.middle,v=l(o)):(b=l(o),v=e.middle);pe(c,f,t,b,v,p,y)}return c},swarm:function(e,t){const{scales:n,columns:o,getR:r,resolvePieceStyle:i}=e,{r:s,projection:a}=n,l=[],c="vertical"===a,u=ye(e);for(const e of Object.values(o)){const t=e.width/2;for(let n=0;e.pieceData.length>n;n++){const o=e.pieceData[n],a=r(o),d=i(o,e.name),h=d.r||4,f=(7919*n%100/100-.5)*t*.8;pe(l,u,o,c?e.middle+f:s(a),c?s(a):e.middle+f,h,d)}}return l},pie:be,donut:be,boxplot:function(e,t){const{scales:n,columns:o,config:r,getR:i,resolveSummaryStyle:s}=e,{r:a,projection:l}=n,c=[],u="vertical"===l,d=!1!==r.showOutliers;for(const t of Object.values(o)){const n=t.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===n.length)continue;const o=n[0],r=n[n.length-1],l=(0,ve.quantile)(n,.25)??o,h=(0,ve.quantile)(n,.5)??(o+r)/2,f=(0,ve.quantile)(n,.75)??r,m=f-l,g=l-1.5*m,y=f+1.5*m,p=n.find(e=>e>=g)??o,b=[...n].reverse().find(e=>y>=e)??r,v=s(t.pieceData[0],t.name),x=[];if(d)for(const e of t.pieceData){const n=i(e);if(g>n||n>y){const o=u?t.middle:a(n),r=u?a(n):t.middle;x.push({px:o,py:r,value:n,datum:e})}}if(c.push({type:"boxplot",x:u?t.middle:0,y:u?0:t.middle,projection:u?"vertical":"horizontal",columnWidth:.6*t.width,minPos:a(p),q1Pos:a(l),medianPos:a(h),q3Pos:a(f),maxPos:a(b),stats:{n:n.length,min:p,q1:l,median:h,q3:f,max:b,mean:n.reduce((e,t)=>e+t,0)/n.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:n,columns:o,config:r,getR:i,resolveSummaryStyle:s}=e,{r:a,projection:l}=n,c=[],u="vertical"===l,d=r.bins||20,h=!1!==r.showIQR;for(const e of Object.values(o)){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 n=t[0],o=t[t.length-1],r=(o-n)/d||1,l=Array(d).fill(0);for(const e of t)l[Math.min(Math.floor((e-n)/r),d-1)]++;const f=we(l,1),m=e.width/2*.9;let g;if(u){g=`M ${e.middle} ${a(n)}`;for(let t=0;d>t;t++){const o=a(n+(t+.5)*r);g+=` L ${e.middle+l[t]/f*m} ${o}`}g+=` L ${e.middle} ${a(o)}`;for(let t=d-1;t>=0;t--){const o=a(n+(t+.5)*r);g+=` L ${e.middle-l[t]/f*m} ${o}`}g+=" Z"}else{g=`M ${a(n)} ${e.middle}`;for(let t=0;d>t;t++)g+=` L ${a(n+(t+.5)*r)} ${e.middle-l[t]/f*m}`;g+=` L ${a(o)} ${e.middle}`;for(let t=d-1;t>=0;t--)g+=` L ${a(n+(t+.5)*r)} ${e.middle+l[t]/f*m}`;g+=" Z"}const y=s(e.pieceData[0],e.name);let p;if(h&&t.length>=4){const r=(0,ve.quantile)(t,.25)??n,i=(0,ve.quantile)(t,.5)??(n+o)/2,s=(0,ve.quantile)(t,.75)??o;p={q1Pos:a(r),medianPos:a(i),q3Pos:a(s),centerPos:e.middle,isVertical:u}}const b=u?{x:e.x,y:Math.min(a(o),a(n)),width:e.width,height:Math.abs(a(o)-a(n))}:{x:Math.min(a(n),a(o)),y:e.x,width:Math.abs(a(o)-a(n)),height:e.width};c.push({type:"violin",pathString:g,translateX:0,translateY:0,bounds:b,iqrLine:p,stats:ke(t),style:y,datum:e.pieceData,category:e.name})}return c},histogram:function(e,t){const{scales:n,columns:o,config:r,getR:i,resolveSummaryStyle:s}=e,{r:a}=n,l=[],c=r.bins||25,u=r.normalize,d=a.domain?.(),h=d?+d[0]:void 0,f=d?+d[1]:void 0;for(const e of Object.values(o)){const t=e.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const[n,o]=xe(t),r=null!=h&&isFinite(h)?h:n,d=null!=f&&isFinite(f)?f:o,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 y=t.length,p=we(g,1),b=s(e.pieceData[0],e.name);for(let t=0;c>t;t++){if(0===g[t])continue;const n=(u?g[t]/y:g[t]/p)*e.width*.9,o=a(r+t*m),i=a(r+(t+1)*m);l.push(ue(Math.min(o,i),e.x+e.width-n,Math.abs(i-o),n,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:n,columns:o,config:r,getR:i,resolveSummaryStyle:s}=e,{r:a,projection:l}=n,c=[],u=r.bins||20,d="horizontal"===l,h=r.amplitude||1.5;for(const e of Object.values(o)){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 n=t[0],o=t[t.length-1],r=(o-n)/u||1,l=Array(u).fill(0);for(const e of t)n>e||e>o||l[Math.min(Math.floor((e-n)/r),u-1)]++;const f=we(l,1),m=s(e.pieceData[0],e.name),g=e.width*h;let y;if(d){const t=e.x+e.width;y=`M ${a(n)} ${t}`;for(let e=0;u>e;e++)y+=` L ${a(n+(e+.5)*r)} ${t-l[e]/f*g}`;y+=` L ${a(o)} ${t} Z`}else{const t=e.x;y=`M ${t} ${a(n)}`;for(let e=0;u>e;e++){const o=a(n+(e+.5)*r);y+=` L ${t+l[e]/f*g} ${o}`}y+=` L ${t} ${a(o)} Z`}const p=d?{x:Math.min(a(n),a(o)),y:e.x,width:Math.abs(a(o)-a(n)),height:e.width}:{x:e.x,y:Math.min(a(o),a(n)),width:e.width,height:Math.abs(a(o)-a(n))};c.push({type:"violin",pathString:y,translateX:0,translateY:0,bounds:p,stats:ke(t),style:{...m,fillOpacity:m.fillOpacity??.5},datum:e.pieceData,category:e.name})}return c},timeline:function(e,t){const{scales:n,columns:o,getRawRange:r,resolvePieceStyle:i}=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=r(t);if(!n)continue;const[o,a]=n,u=i(t,e.name);if(c){const n=s(Math.min(o,a)),r=s(Math.max(o,a));l.push(ue(n,e.x,r-n,e.width,u,t,e.name))}else{const n=s(Math.max(o,a)),r=s(Math.min(o,a));l.push(ue(e.x,n,e.width,r-n,u,t,e.name))}}return l},funnel:function(e,t){const{columns:n,getR:o,getStack:r,resolvePieceStyle:i}=e,s=[],a=t.width/2,l=!1!==e.config.showLabels,c=e.scales.o.domain().map(e=>n[e]).filter(Boolean);if(0===c.length)return s;const u=[],d=new Set;for(const e of c)for(const t of e.pieceData){const e=r?r(t):"_default";d.has(e)||(d.add(e),u.push(e))}const h=u.length>1&&"_default"!==u[0],f=[];let m=0;for(const e of c){const t=new Map;let n=0;for(const i of e.pieceData){const e=r?r(i):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const s=t.get(e),a=o(i);s.total+=a,s.pieces.push(i),n+=a}f.push({col:e,groups:t,stepTotal:n}),h||n>m&&(m=n)}if(h)for(const e of f){let t=0,n=0;for(let o=0;u.length>o;o++){const r=e.groups.get(u[o]);r&&(o%2==0?t+=r.total:n+=r.total)}const o=Math.max(t,n);o>m&&(m=o)}if(0===m)return s;const g=new Map;for(const e of u){const t=f[0].groups.get(e);g.set(e,t?.total??0)}const y=f[0].stepTotal,p=h?.95*a:.9*t.width,b=(0,Se.scaleLinear)().domain([0,m]).range([0,p]),v=e.config.connectorOpacity??.3;let x=new Map;for(let t=0;f.length>t;t++){const n=f[t],o=n.col,r=0===t,c=o.width,d=.55*c,m=o.x+(c-d)/2,p=new Map;if(h){let e=0;for(const t of u){const o=n.groups.get(t);o&&(e+=b(o.total))}let t=a,c=a;for(let h=0;u.length>h;h++){const f=u[h],y=n.groups.get(f);if(!y)continue;const v=b(y.total),x=h%2==0,w=x?t:c-v;x?t+=v:c-=v;const k=i(y.pieces[0],f),S=g.get(f)??y.total,A={...y.pieces[0],__funnelValue:y.total,__funnelPercent:S>0?y.total/S*100:0,__funnelStep:o.name,__funnelIsFirstStep:r,__aggregateValue:y.total,__pieceCount:y.pieces.length,category:f};l&&(0===h&&(A.__funnelStepLabel=o.name,A.__funnelStepLabelX=a,A.__funnelStepLabelY=m,A.__funnelRowWidth=e),A.__funnelValueLabelX=w+v/2,A.__funnelValueLabelY=m,A.__funnelBarW=v),s.push(ue(w,m,v,d,k,A,f)),p.set(f,{x:w,y:m,w:v,h:d})}}else{const e=n.stepTotal,t=b(e),c=a-t/2,h=u[0],f="_default"!==h,g=n.groups.get(h)?.pieces[0]??o.pieceData[0],v=f?h:o.name,x=i(g,v),w=y>0?e/y*100:0,k={...g,__funnelValue:e,__funnelPercent:w,__funnelStep:o.name,__funnelIsFirstStep:r,category:f?h:o.name};l&&(k.__funnelStepLabel=o.name,k.__funnelStepLabelX=a,k.__funnelStepLabelY=m,k.__funnelRowWidth=t,k.__funnelValueLabelX=a,k.__funnelValueLabelY=m,k.__funnelBarW=t),s.push(ue(c,m,t,d,x,k,v)),p.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),a=p.get(r);if(!t||!a)continue;const l=(()=>{const e=n.groups.get(r);return i(e?e.pieces[0]:o.pieceData[0],"_default"===r?o.name:r)})(),c={type:"trapezoid",points:[[t.x,t.y+t.h],[t.x+t.w,t.y+t.h],[a.x+a.w,a.y],[a.x,a.y]],style:{fill:l.fill||e.config.themeSemantic?.secondary||"#999",opacity:v},datum:n.groups.get(r)?.pieces[0]??o.pieceData[0],category:"_default"===r?o.name:r};s.push(c)}}x=p}return s},"bar-funnel":function(e,t){const{columns:n,getR:o,getStack:r,resolvePieceStyle:i,scales:s}=e,a=[],l=s.o.domain().map(e=>n[e]).filter(Boolean);if(0===l.length)return a;const c=[],u=new Set;for(const e of l)for(const t of e.pieceData){const e=r?r(t):"_default";u.has(e)||(u.add(e),c.push(e))}const d=c.length>1&&"_default"!==c[0],h=[];for(const e of l){const t=new Map;let n=0;for(const i of e.pieceData){const e=r?r(i):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const s=t.get(e),a=o(i);s.total+=a,s.pieces.push(i),n+=a}h.push({col:e,groups:t,stepTotal:n})}const f=new Map;for(const e of c){const t=h[0]?.groups.get(e);f.set(e,t?.total??0)}const m=s.r,g=d?c.length:1,y=d?.15:0;for(let e=0;h.length>e;e++){const t=h[e],n=t.col,o=0===e,r=e>0?h[e-1]:null,s=n.width/g,l=s*y,u=s-l;for(let e=0;c.length>e;e++){const h=c[e],g=t.groups.get(h);if(!g)continue;const y=g.total,p=f.get(h)??y,b=p>0?y/p*100:0,v=r?.groups.get(h),x=o?0:Math.max(0,(v?.total??y)-y),w=n.x+e*s+l/2,k=m(y),S=m(0)-k,A=i(g.pieces[0],d?h:n.name),M={...g.pieces[0],__barFunnelValue:y,__barFunnelPercent:b,__barFunnelIsFirstStep:o,__barFunnelIsDropoff:!1,__barFunnelStep:n.name,__barFunnelDropoffValue:x,__barFunnelCategory:"_default"===h?void 0:h,category:d?h:n.name,__barFunnelLabelX:w+u/2,__barFunnelLabelY:m(y+x)};if(a.push(ue(w,k,u,S,A,M,d?h:n.name)),x>0){const e=m(y+x),t=k-e,o={...A},r={...g.pieces[0],__barFunnelValue:x,__barFunnelPercent:p>0?x/p*100:0,__barFunnelIsFirstStep:!1,__barFunnelIsDropoff:!0,__barFunnelStep:n.name,__barFunnelCategory:"_default"===h?void 0:h,category:d?h:n.name};a.push(ue(w,e,u,t,o,r,d?h:n.name))}}}return a},swimlane:function(e,t){const{scales:n,columns:o,getR:r,getStack:i,resolvePieceStyle:s}=e,{r:a,projection:l}=n,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,[n,r]=a.range(),i=Math.min(n,r),s=Math.abs(r-n);for(const n of Object.values(o)){const o={fill:e,opacity:t},r=u?ue(i,n.x,s,n.width,o,null,"__track__"):ue(n.x,i,n.width,s,o,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(o)){let t=0;const n=c.length;for(const n of e.pieceData){const o=Math.abs(r(n));if(0===o)continue;const l=i?i(n):e.name,f=s(n,l);let m;if(u){const r=a(t),i=a(t+o);m=ue(r,e.x,i-r,e.width,f,n,l)}else{const r=a(t+o),i=a(t);m=ue(e.x,r,e.width,i-r,f,n,l)}d&&(m.fillGradient=d,m.roundedEdge=h),c.push(m),t+=o}if(m>0&&c.length>n){const e=c.slice(n),t=e[0],o=e[e.length-1];1===e.length?t.cornerRadii={tl:m,tr:m,br:m,bl:m}:u?(t.cornerRadii={tl:m,bl:m},o.cornerRadii={tr:m,br:m}):(t.cornerRadii={bl:m,br:m},o.cornerRadii={tl:m,tr:m})}}return c}};function Me(e,t){const n=t&&"object"==typeof t&&!Array.isArray(t)?t:void 0;return 0===e.length?e=>n&&se(n,e)||"#4e79a7":t=>{if(n){const e=se(n,t);if(e)return e}let o=0;for(let e=0;t.length>e;e++)o=31*o+t.charCodeAt(e)|0;return e[Math.abs(o)%e.length]??"#4e79a7"}}function Ce(e){return null!=e&&!1!==e&&""!==e&&(!Array.isArray(e)||e.some(Ce))}function je(e,t,n){e.has(t)||(e.add(t),console.warn(n))}function _e(e,t,n,o){const r=e.push(t);return n&&n.push(o),r}var Re=new WeakMap;var Pe={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 Le(e,t){const n={...e};for(const e of t)n[Pe[e]]++;return n}function Ie(e,t,n){const o=new Set(t);return{changeSet:{...e,...e.keys?{keys:[...e.keys]}:{}},changed:o,revisions:Le(n,o)}}var Te=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=Ie({kind:"initialize"},[],this.revisions),this.listeners=new Set}get last(){return this.latest}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}record(e,t){const n=Ie(e,t,this.revisions);this.revisions=n.revisions,this.latest=n;for(const e of[...this.listeners])e();return n}},$e=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Be=["scene-style","data-paint","accessibility","evidence"],He=(e,t)=>({retainedData:e,invalidations:t}),Oe=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Fe=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Ee=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],De=["scene-geometry","data-paint","accessibility","evidence"],We=["scene-style","data-paint","accessibility","evidence"],Ne=[],ze={chartType:He("rebuild",Oe),runtimeMode:He("rebuild",Oe),categoryAccessor:He("rebuild",Oe),valueAccessor:He("rebuild",Oe),oAccessor:He("rebuild",Oe),rAccessor:He("rebuild",Oe),stackBy:He("rebuild",Oe),groupBy:He("rebuild",Oe),timeAccessor:He("rebuild",Oe),accessorRevision:He("rebuild",Oe),colorAccessor:He("rebuild",We),symbolAccessor:He("rebuild",De),connectorAccessor:He("rebuild",De),dataIdAccessor:He("rebuild",De),projection:He("preserve",Fe),extentPadding:He("preserve",Fe),axisExtent:He("preserve",Fe),rExtent:He("preserve",Fe),oExtent:He("preserve",Fe),multiAxis:He("preserve",Fe),normalize:He("preserve",Fe),bins:He("preserve",Fe),oSort:He("preserve",Ee),barPadding:He("preserve",Ee),roundedTop:He("preserve",Ee),baselinePadding:He("preserve",Ee),innerRadius:He("preserve",Ee),cornerRadius:He("preserve",Ee),startAngle:He("preserve",Ee),sweepAngle:He("preserve",Ee),trackFill:He("preserve",Ee),showOutliers:He("preserve",Ee),showIQR:He("preserve",Ee),amplitude:He("preserve",Ee),connectorOpacity:He("preserve",Ee),showLabels:He("preserve",Ee),dynamicColumnWidth:He("rebuild",Ee),customLayout:He("preserve",Ee),layoutConfig:He("preserve",Ee),layoutMargin:He("preserve",Ee),symbolMap:He("preserve",De),pieceStyle:He("preserve",We),summaryStyle:He("preserve",We),connectorStyle:He("preserve",We),gradientFill:He("preserve",We),colorScheme:He("preserve",We),themeCategorical:He("preserve",We),themeSemantic:He("preserve",We),themeSequential:He("preserve",We),themeDiverging:He("preserve",We),barColors:He("preserve",We),decay:He("preserve",We),pulse:He("preserve",We),staleness:He("preserve",We),layoutSelection:He("preserve",We),windowSize:He("preserve",Ne),windowMode:He("preserve",Ne),clock:He("preserve",Ne),transition:He("preserve",Ne),introAnimation:He("preserve",Ne),onLayoutError:He("preserve",Ne)},qe=He("preserve",Ee),Ge=class{constructor(){this.tracker=new Te}get last(){return this.tracker.last}subscribe(e){return this.tracker.subscribe(e)}recordData(e,t){return this.tracker.record({kind:e,...void 0===t?{}:{count:t}},$e)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},Be):this.recordNoop("restyle")}recordConfig(e){const t=function(e){let t="preserve";const n=new Set;for(const o of e){const e=ze[o]??qe;"rebuild"===e.retainedData&&(t="rebuild");for(const t of e.invalidations)n.add(t)}return{retainedData:t,invalidations:n}}(e);return this.tracker.record({kind:"config",keys:e},t.invalidations)}};var Ve=require("d3-quadtree"),Xe=class{constructor(e){this.rExtent=new _,this.rExtents=[],this.windowSizeWarned=!1,this.updateResults=new Ge,this.rAccessors=[],this.categories=new Set,this._hasStreamingData=!1,this.styleResolver=new ce,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 j(e.windowSize),this.getO=$(e.categoryAccessor||e.oAccessor,"category");const t=e.valueAccessor||e.rAccessor;Array.isArray(t)?(this.rAccessors=t.map(e=>T(e,"value")),this.getR=this.rAccessors[0],this.rExtents=t.map(()=>new _)):(this.getR=T(t,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=$(e.stackBy),this.getGroup=$(e.groupBy),this.getColor=$(e.colorAccessor),this.getSymbol=$(e.symbolAccessor),this.getConnector=$(e.connectorAccessor),this.getDataId=$(e.dataIdAccessor),e.pulse&&(this.timestampBuffer=new j(e.windowSize))}syncPulseTimestampBuffer(){var e,t,n,o;this.timestampBuffer=(e=!!this.config.pulse,t=this.buffer,n=this.timestampBuffer,o=this.currentTime(),e?null!=n&&n.capacity===t.capacity&&n.size===t.size?n:function(e,t){const n=new j(e.capacity);return e.forEach(()=>n.push(t)),n}(t,o):null)}currentTime(){return this.config.clock?.()??("undefined"!=typeof performance?performance.now():Date.now())}ingest(e){const t=this.currentTime();if(this.lastIngestTime=t,this._dataVersion++,e.bounded){this.buffer.clear(),this.rExtent.clear();for(const e of this.rExtents)e.clear();e.preserveCategoryOrder?this._hasStreamingData=!0:this.categories.clear(),this.timestampBuffer&&this.timestampBuffer.clear(),r=this.timestampBuffer,(o=e.totalSize||e.inserts.length)>(n=this.buffer).capacity&&(n.resize(o),r&&o>r.capacity&&r.resize(o));for(const n of e.inserts)_e(this.buffer,n,this.timestampBuffer,t),this.categories.add(this.getO(n)),this.pushValueExtent(n)}else{this._hasStreamingData=!0;for(const n of e.inserts){const e=_e(this.buffer,n,this.timestampBuffer,t);this.categories.add(this.getO(n)),this.pushValueExtent(n),null!=e&&this.evictValueExtent(e)}}var n,o,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 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,o=this.scales,r=this.multiScales,i=this.columns;if(0===n.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(n,this.getR);const s=this.getBufferArray(),a=t.projection||"vertical",l=t.oExtent||this.resolveCategories(s),c=this.computeValueDomain(s,l),u="horizontal"===a,d="radial"===a,h=Math.min(.9,Math.max(0,null!=t.barPadding?t.barPadding/("vertical"===a?e.width:e.height):.1));let f,m;if(d){f=(0,C.scaleBand)().domain(l).range([0,1]).padding(0);const n=Math.min(e.width,e.height)/2,o=t.innerRadius||0;m=(0,C.scaleLinear)().domain(c).range([o,n])}else u?(f=(0,C.scaleBand)().domain(l).range([0,e.height]).padding(h),m=(0,C.scaleLinear)().domain(c).range([0,e.width])):(f=(0,C.scaleBand)().domain(l).range([0,e.width]).padding(h),m=(0,C.scaleLinear)().domain(c).range([e.height,0]));this.scales={o:f,r:m,projection:a},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((o,r)=>{const i=this.rExtents[r];i.dirty&&i.recalculate(n,o);let[s,a]=i.extent;s===1/0&&(s=0,a=1);const l=a-s,c=l>0?l*(t.extentPadding??.05):1;return s-=c,a+=c,s>0&&(s=0),u?(0,C.scaleLinear)().domain([s,a]).range([0,e.width]):(0,C.scaleLinear)().domain([s,a]).range([e.height,0])}):[];let g=s;this.rAccessors.length>1&&(g=s.flatMap(e=>this.rAccessors.map((t,n)=>({...e,__rIndex:n,__rValue:t(e),__rName:this.resolveRAccessorName(n)})))),this.columns=this.buildColumns(g,l,f,a,e),this._customLayoutFailedThisBuild=!1;const y=this.buildSceneNodes(g,e);this._customLayoutFailedThisBuild?!0===this.lastCustomLayoutFailure?.preservedLastGoodScene?(this.scales=o,this.multiScales=r,this.columns=i):(this.scene=[],this.rebuildPointQuadtree()):(this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=y,this.rebuildPointQuadtree(),this.config.decay&&this.applyDecay(this.scene,s),this.config.pulse&&this.applyPulse(this.scene,s),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&this.prevPositionMap.size>0&&this.startTransition(),this.version++)}resolveRAccessorName(e){const t=this.config.valueAccessor||this.config.rAccessor,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 r=null;if(n){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(n&&void 0===o){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===o)return i;if("function"==typeof o)return i.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 i.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){return function(e){const{data:t,chartType:n,projection:o,normalize:r,rExtent:i,extentPadding:s=.05,baselinePadding:a,axisExtent:l,getO:c,getR:u,getStack:d,rawRExtent:h}=e,f=s;if("radial"===o&&("pie"===n||"donut"===n))return[0,1];let m=0,g=0;if("bar"===n&&d&&r)m=0,g=1;else if("bar"===n&&d){const e=new Map,n=new Map;for(const o of t){const t=c(o),r=u(o);0>r?n.set(t,(n.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 n.values())m>e&&(m=e)}else if("bar"===n){const e=new Map;for(const n of t){const t=c(n),o=u(n);e.set(t,(e.get(t)||0)+o)}for(const t of e.values())t>g&&(g=t),m>t&&(m=t)}else if("swimlane"===n){const e=new Map;for(const n of t){const t=c(n),o=Math.abs(u(n));e.set(t,(e.get(t)||0)+o)}for(const t of e.values())t>g&&(g=t)}else if("clusterbar"===n||"bar-funnel"===n)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 y="bar"===n||"clusterbar"===n||"bar-funnel"===n||"swimlane"===n;if(y&&null==i?.[0]&&null==i?.[1]&&(m>0&&(m=0),0>g&&(g=0)),"bar-funnel"!==n&&"exact"!==l){const e=g-m,t=e>0?e*f:1,o=y&&!a&&0===m,r=y&&!a&&0===g||"swimlane"===n;null!=i?.[0]||o||(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,n,o,r){return function(e){const{data:t,oExtent:n,oScale:o,projection:r,layout:i,dynamicColumnWidth:s,getO:a,getR:l}=e,c={},u=new Map;for(const e of t){const t=a(e);u.has(t)||u.set(t,[]),u.get(t).push(e)}let d=0;if("radial"===r)for(const e of t)d+=Math.abs(l(e));let h=null;if(s&&"radial"!==r){h=new Map;let e=0;for(const t of n){const n=u.get(t)||[];let o;o="string"==typeof s?n.reduce((e,t)=>e+(Number(t[s])||0),0):s(n),h.set(t,o),e+=o}const t=("horizontal"===r?i.height:i.width)-o.padding()*o.step()*n.length;if(e>0)for(const[n,o]of h)h.set(n,o/e*t)}let f=0,m=0;for(const e of n){const t=u.get(e)||[],n=t.reduce((e,t)=>e+Math.abs(l(t)),0),r=d>0?n/d:0;let i,s;h?(i=m,s=h.get(e)||o.bandwidth(),m+=s+o.padding()*o.step()):(i=o(e)??0,s=o.bandwidth()),c[e]={name:e,x:i,y:0,width:s,middle:i+s/2,padding:o.padding()*o.step(),pieceData:t,pct:r,pctStart:f},f+=r}return c}({data:e,oExtent:t,oScale:n,projection:o,layout:r,dynamicColumnWidth:this.config.dynamicColumnWidth,getO:this.getO,getR:this.getR})}getSceneContext(){return{scales:this.scales,columns:this.columns,config:this.config,getR:this.getR,getStack:this.getStack,getGroup:this.getGroup,getColor:this.getColor,getSymbol:this.getSymbol,getConnector:this.getConnector,getO:this.getO,multiScales:this.multiScales,rAccessors:this.rAccessors,resolvePieceStyle:(e,t)=>this.styleResolver.resolvePieceStyle(this.config,e,t),resolveSummaryStyle:(e,t)=>this.styleResolver.resolveSummaryStyle(this.config,e,t),getRawRange:e=>this.getRawRange(e)}}buildSceneNodes(e,t){if(!this.scales)return[];if(this.config.customLayout){const n=this.buildLayoutContext(e,t);let o;try{o=this.config.customLayout(n)}catch(e){const t=null!==this.lastCustomLayoutResult,n=function(e,t,n,o){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:n?"preserved-last-good-scene":"empty-scene",preservedLastGoodScene:n,affectedRevision:o}}("ordinal",e,t,this.version);this.lastCustomLayoutFailure=n,this._customLayoutFailedThisBuild=!0,"production"!==process.env.NODE_ENV&&console.error("[semiotic] ordinal customLayout threw:",e);try{this.config.onLayoutError?.(n)}catch(e){"production"!==process.env.NODE_ENV&&console.error("[semiotic] onLayoutError threw:",e)}return t?this.scene:(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,[])}this.customLayoutOverlays=o.overlays??null,this.lastCustomLayoutResult=o,this.lastCustomLayoutFailure=null;const r=o.nodes??[];if(this._customRestyle=o.restyle,this.hasCustomRestyle=!!o.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:n,overlays:o,warned:r}=e;Ce(o)&&0===n.length&&je(r,"overlay-only",`[semiotic] ${t} returned overlays but no data-bearing scene nodes. Overlays do not participate in hover, selection, transitions, SSR evidence, or accessibility tables. Emit at least one scene node with a datum, or mark the overlay-only chart as intentionally decorative.`),n.length>0&&n.every(e=>null==e.datum)&&je(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 n=this.getSceneContext(),o=Ae[this.config.chartType];let r=o?o(n,t):[];if(this.getConnector&&this.scales){const e=function(e,t){const{scales:n,config:o,getConnector:r,getO:i}=e;if(!r||!n)return[];const s=[],{projection:a}=n,l=new Map;for(const e of t){if("point"!==e.type&&"rect"!==e.type)continue;const t=e.datum;if(!t)continue;const n=r(t);if(!n)continue;let o,s;"point"===e.type?(o=e.x,s=e.y):(o=e.x+e.w/2,s=e.y+("vertical"===a?0:e.h/2)),l.has(n)||l.set(n,[]),l.get(n).push({x:o,y:s,datum:t,category:i(t)})}const c=n.o.domain(),u=o.connectorStyle;for(const[t,n]of l)if(n.length>=2){n.sort((e,t)=>c.indexOf(e.category)-c.indexOf(t.category));for(let o=0;n.length-1>o;o++){const r=n[o],i=n[o+1],a="function"==typeof u?u(r.datum):u||{stroke:e.config.themeSemantic?.border||e.config.themeSemantic?.secondary||"#999",strokeWidth:1,opacity:.5};s.push({type:"connector",x1:r.x,y1:r.y,x2:i.x,y2:i.y,style:a,datum:r.datum,group:t})}}return s}(n,r);r=[...e,...r]}return r}buildLayoutContext(e,t){const n=this.config,o=n.layoutMargin??{top:0,right:0,bottom:0,left:0},r=function(e,t,n){if(e&&"object"==typeof e&&!Array.isArray(e)){const t=Object.values(e).filter(e=>"string"==typeof e&&e.length>0);if(t.length>0)return t}if(Array.isArray(e)&&e.length>0)return e;if("string"==typeof e){const t=te[e];if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:n}(n.colorScheme,n.themeCategorical,oe),i=this.scales;return{data:e,scales:{o:i.o,r:i.r,projection:i.projection},dimensions:{width:t.width,height:t.height,margin:o,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:n.themeSemantic??{},categorical:[...r]},resolveColor:Me(r,n.colorScheme),config:n.layoutConfig??{},selection:n.layoutSelection??null}}computeDecayOpacity(e,t){const n=this.config.decay;return n&&t>1?function(e,t,n){if(1>=n)return 1;const o=n-1;return function(e){const t=Math.max(0,Math.min(1,e.minOpacity??.1));if(Number.isNaN(e.age))return 1;if(e.age===1/0)return t;if(!Number.isFinite(e.extent)||0>=e.extent)return 1;const n=Math.max(0,e.age);if("step"===e.type)return(e.threshold??.5*e.extent)>n?1:t;if("exponential"===e.type){const o=e.halfLife??e.extent/2;return t+Math.pow(.5,n/(o>0?o:e.extent/2))*(1-t)}return t+Math.max(0,Math.min(1,1-n/e.extent))*(1-t)}({age:o-t,extent:o,type:e.type,halfLife:e.halfLife??n/2,threshold:e.stepThreshold??.5*n,minOpacity:e.minOpacity??.1})}(n,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 n=0;e.length>n;n++)t.set(e[n],n);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 n="function"==typeof t,o=n?null:t||"category",r=new Map;for(let i=0;e.length>i;i++){const s=e[i],a=n?t(s):s[o],l=r.get(a);l?l.push(i):r.set(a,[i])}return r}(e,this.config.categoryAccessor||this.config.oAccessor);return this._categoryIndexCache={version:this._dataVersion,map:t},t}rebuildPointQuadtree(){const e=function(e){let t=0,n=0;for(const o of e)"point"===o.type&&(t++,o.r>n&&(n=o.r));if(500>=t)return{quadtree:null,maxRadius:n};const o=Array(t);let r=0;for(const t of e)"point"===t.type&&(o[r++]=t);return{maxRadius:n,quadtree:(0,Ve.quadtree)().x(e=>e.x).y(e=>e.y).addAll(o)}}(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 n=t.length;if(1>=n)return;const o=this.getDatumIndexMap(t);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;if(!t.datum)continue;const e=o.get(t.datum);if(null==e)continue;const r=this.computeDecayOpacity(e,n);t.style={...t.style,opacity:(t.style?.opacity??1)*r}}}applyPulse(e,t,n=this.currentTime()){return!(!this.config.pulse||!this.timestampBuffer)&&function(e,t,n,o,r,i){const s=e.color??"rgba(255,255,255,0.6)",a=e.glowRadius??4;let l=!1;for(const c of t){if("connector"===c.type||"violin"===c.type||"boxplot"===c.type)continue;if("wedge"===c.type){const t=c.category;if(!t)continue;let o=0;for(const s of r(t)??[]){const t=n.get(s);null!=t&&(o=Math.max(o,R(e,t,i)))}l=P(c,o,s)||l;continue}if(null==c.datum)continue;const t=o.get(c.datum);if(null==t)continue;const u=n.get(t);l=P(c,null==u?0:R(e,u,i),s,a)||l}return l}(this.config.pulse,e,this.timestampBuffer,this.getDatumIndexMap(t),e=>this.getCategoryIndexMap(t).get(e),n)}refreshPulse(e){return!0!==this.lastCustomLayoutFailure?.preservedLastGoodScene&&this.applyPulse(this.scene,this.getBufferArray(),e)}hasActivePulsesAt(e){return!!this.config.pulse&&function(e,t,n=("undefined"!=typeof performance?performance.now():Date.now())){if(!t||0===t.size)return!1;const o=e.duration??500,r=t.peek();return null!=r&&o>n-r}(this.config.pulse,this.timestampBuffer,e)}get hasActivePulses(){return this.hasActivePulsesAt(this.currentTime())}synthesizeIntroPositions(){this.prevPositionMap.clear();const e=new Map,t=this.scales?.r(0)??0,n="horizontal"!==this.scales?.projection;let o;for(let r=0;this.scene.length>r;r++){const i=this.scene[r],s=this.getNodeKey(i,e);s&&("rect"===i.type?this.prevPositionMap.set(s,n?{x:i.x,y:t,w:i.w,h:0,opacity:i.style.opacity??1}:{x:t,y:i.y,w:0,h:i.h,opacity:i.style.opacity??1}):"point"===i.type?this.prevPositionMap.set(s,{x:i.x,y:i.y,r:0,opacity:0}):"wedge"===i.type&&(void 0===o&&(o=i.startAngle),this.prevPositionMap.set(s,{x:i.cx,y:i.cy,startAngle:o,endAngle:o,innerRadius:i.innerRadius,outerRadius:i.outerRadius,opacity:0})))}}getNodeKey(e,t){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||""}:${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 n=this.scene[t],o=this.getNodeKey(n,e);o&&("point"===n.type?this.prevPositionMap.set(o,{x:n.x,y:n.y,r:n.r,opacity:n.style.opacity}):"rect"===n.type?this.prevPositionMap.set(o,{x:n.x,y:n.y,w:n.w,h:n.h,opacity:n.style.opacity}):"wedge"===n.type&&this.prevPositionMap.set(o,{x:n.cx,y:n.cy,startAngle:n.startAngle,endAngle:n.endAngle,innerRadius:n.innerRadius,outerRadius:n.outerRadius,opacity:n.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 n=new Set,o=new Map;for(let e=0;this.scene.length>e;e++){const r=this.scene[e],i=this.getNodeKey(r,o);if(!i)continue;r._transitionKey=i;const s=this.prevPositionMap.get(i);if("point"===r.type)s?(n.add(i),r._targetOpacity=r.style.opacity??1,(s.x!==r.x||s.y!==r.y||void 0!==s.r&&s.r!==r.r)&&(r._targetX=r.x,r._targetY=r.y,r._targetR=r.r,r.x=s.x,r.y=s.y,void 0!==s.r&&(r.r=s.r),t=!0)):(r._targetOpacity=r.style.opacity??1,r._targetR=r.r,r.r=0,r.style={...r.style,opacity:0},t=!0);else if("rect"===r.type)s?(n.add(i),r._targetOpacity=r.style.opacity??1,s.x===r.x&&s.y===r.y&&s.w===r.w&&s.h===r.h||(r._targetX=r.x,r._targetY=r.y,r._targetW=r.w,r._targetH=r.h,r.x=s.x,r.y=s.y,r.w=s.w??r.w,r.h=s.h??r.h,t=!0)):(r._targetOpacity=r.style.opacity??1,r.style={...r.style,opacity:0},t=!0);else if("wedge"===r.type)if(s)n.add(i),r._targetOpacity=r.style.opacity??1,s.startAngle===r.startAngle&&s.endAngle===r.endAngle||(r._targetStartAngle=r.startAngle,r._targetEndAngle=r.endAngle,r.startAngle=s.startAngle,r.endAngle=s.endAngle,t=!0);else{r._targetOpacity=r.style.opacity??1,r._targetStartAngle=r.startAngle,r._targetEndAngle=r.endAngle;const e=r.startAngle;r.startAngle=e,r.endAngle=e,r.style={...r.style,opacity:0},this.prevPositionMap.set(i,{x:r.cx,y:r.cy,startAngle:e,endAngle:e,innerRadius:r.innerRadius,outerRadius:r.outerRadius,opacity:0}),t=!0}}this.exitNodes=[];for(const[e,o]of this.prevPositionMap)if(!n.has(e)){if(e.startsWith("p:"))this.exitNodes.push({type:"point",x:o.x,y:o.y,r:o.r??3,style:{opacity:o.opacity??1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("r:"))this.exitNodes.push({type:"rect",x:o.x,y:o.y,w:o.w??0,h:o.h??0,style:{opacity:o.opacity??1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("w:")){const t=((o.startAngle??0)+(o.endAngle??0))/2,n={type:"wedge",cx:o.x,cy:o.y,innerRadius:o.innerRadius??0,outerRadius:o.outerRadius??100,startAngle:o.startAngle??0,endAngle:o.endAngle??0,style:{opacity:o.opacity??1},datum:null,category:e.slice(2),_targetStartAngle:t,_targetEndAngle:t,_targetOpacity:0,_transitionKey:e};this.exitNodes.push(n)}t=!0}this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),t&&(this.activeTransition={startTime:this.currentTime(),duration:e})}advanceTransition(e){if(!this.activeTransition)return!1;const t=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,this.activeTransition),n=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 o=this.prevPositionMap.get(t);e.style.opacity=L(o?o.opacity??1:0,e._targetOpacity,n)}const o=this.prevPositionMap.get(t);void 0!==e._targetX&&o&&(e.x=L(o.x,e._targetX,n),e.y=L(o.y,e._targetY,n)),void 0!==e._targetR&&void 0!==o?.r&&(e.r=L(o.r,e._targetR,n))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const o=this.prevPositionMap.get(t);e.style.opacity=L(o?o.opacity??1:0,e._targetOpacity,n)}if(void 0===e._targetX)continue;const o=this.prevPositionMap.get(t);if(!o)continue;e.x=L(o.x,e._targetX,n),e.y=L(o.y,e._targetY,n),void 0!==o.w&&(e.w=L(o.w,e._targetW,n),e.h=L(o.h,e._targetH,n))}else if("wedge"===e.type){if(void 0!==e._targetOpacity){const o=this.prevPositionMap.get(t);e.style={...e.style,opacity:L(o?o.opacity??1:0,e._targetOpacity,n)}}if(void 0!==e._targetStartAngle&&void 0!==e._targetEndAngle){const o=this.prevPositionMap.get(t);o&&void 0!==o.startAngle&&(e.startAngle=L(o.startAngle,e._targetStartAngle,n),e.endAngle=L(o.endAngle,e._targetEndAngle,n))}}}if(t>=1){for(const e of this.scene)if(void 0!==e._targetOpacity&&(e.style={...e.style||{},opacity:0===e._targetOpacity?0:e._targetOpacity},e._targetOpacity=void 0),"point"===e.type){if(void 0===e._targetX&&void 0===e._targetR)continue;void 0!==e._targetX&&(e.x=e._targetX,e.y=e._targetY),void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else"wedge"===e.type&&void 0!==e._targetStartAngle&&(e.startAngle=e._targetStartAngle,e.endAngle=e._targetEndAngle,e._targetStartAngle=void 0,e._targetEndAngle=void 0);if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}return this.activeTransition=null,!1}return!0}cancelIntroAnimation(){this.prevPositionMap.clear(),this.activeTransition=null}getBufferArray(){return this._bufferArrayCache?.version!==this._dataVersion&&(this._bufferArrayCache={version:this._dataVersion,data:this.buffer.toArray()}),this._bufferArrayCache.data}getData(){return this.buffer.toArray()}remove(e){if(!this.getDataId)throw Error("remove() requires dataIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=B(e),n=this.getDataId,o=e=>t.has(n(e));!function(e,t,n){if(!t||0===t.size)return;const o=new Set;if(e.forEach((e,t)=>{n(e)&&o.add(t)}),0===o.size)return;const r=t.toArray();t.clear();for(let e=0;r.length>e;e++)o.has(e)||t.push(r[e])}(this.buffer,this.timestampBuffer,o);const r=this.buffer.remove(o);if(0===r.length)return this.updateResults.recordNoop("remove"),r;for(const e of r)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach(e=>this.categories.add(this.getO(e))),this._dataVersion++,this.version++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("remove",r.length),r}update(e,t){if(!this.getDataId)throw Error("update() requires dataIdAccessor to be configured");const n=B(e),o=this.getDataId,r=new Set;this.buffer.forEach((e,t)=>{n.has(o(e))&&r.add(t)});const i=this.buffer.update(e=>n.has(o(e)),t);if(0===i.length)return this.updateResults.recordNoop("update"),i;for(const e of i)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach((e,t)=>{this.categories.add(this.getO(e)),r.has(t)&&this.pushValueExtent(e)}),this._dataVersion++,this.version++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("update",i.length),i}clear(){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this._hasStreamingData=!1,this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this.scales=null,this.scene=[],this.columns={},this.multiScales=[],this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this._pointQuadtree=null,this._maxPointRadius=0,this.styleResolver.resetColors(),this._dataVersion++,this.version++,this.updateResults.recordData("clear")}get size(){return this.buffer.size}getOAccessor(){return this.getO}getRAccessor(){return this.getR}applyCustomRestyle(e,t){const n=this._customRestyle;if(n)for(const o of e){const e=this._baseStyles.get(o)??o.style??{},r=n(o,t);o.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},n=Object.keys(e).filter(n=>e[n]!==t[n]);"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&&!I(e.colorAccessor,t.colorAccessor))&&this.styleResolver.resetColors(),("categoryAccessor"in e&&!I(e.categoryAccessor,t.categoryAccessor)||"oAccessor"in e&&!I(e.oAccessor,t.oAccessor))&&(this._categoryIndexCache=null),Object.assign(this.config,e),"pulse"in e&&this.syncPulseTimestampBuffer();let o=!1;("categoryAccessor"in e||"oAccessor"in e)&&(I(this.config.categoryAccessor||this.config.oAccessor,t.categoryAccessor||t.oAccessor)||(this.getO=$(this.config.categoryAccessor||this.config.oAccessor,"category"),o=!0));let r=!1;if("valueAccessor"in e||"rAccessor"in e){const e=this.config.valueAccessor||this.config.rAccessor,n=t.valueAccessor||t.rAccessor,o=Array.isArray(e)?e:[e],i=Array.isArray(n)?n:[n];if(r=o.length!==i.length||o.some((e,t)=>!I(e,i[t])),r){const e=this.config.valueAccessor||this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>T(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new _)):(this.getR=T(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!I(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?$(this.config.stackBy):void 0),"groupBy"in e&&!I(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?$(this.config.groupBy):void 0),"colorAccessor"in e&&!I(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?$(this.config.colorAccessor):void 0),"symbolAccessor"in e&&!I(e.symbolAccessor,t.symbolAccessor)&&(this.getSymbol=null!=this.config.symbolAccessor?$(this.config.symbolAccessor):void 0),"connectorAccessor"in e&&!I(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?$(this.config.connectorAccessor):void 0),(o||r||"accessorRevision"in e&&e.accessorRevision!==t.accessorRevision)&&this.rebuildAccessorDerivedState(),this.updateResults.recordConfig(n)}updateConfigWithResult(e){return this.updateConfig(e),this.updateResults.last}};Object.assign(Xe.prototype,{getLastUpdateResult:function(){return this.updateResults.last},getUpdateSnapshot:function(){return this.updateResults.last},subscribeUpdateResult:function(e){return this.updateResults.subscribe(e)},setLayoutSelection:function(e){this.config.layoutSelection=e},markStylePaintPending:function(){Re.set(this,!0)},consumeStylePaintPending:function(){const e=!0===Re.get(this);return Re.delete(this),e}});var Ye=require("react"),Ue={sceneGeometry:0,layout:0,domain:0};function Ke(e){const{domain:t,layout:n,sceneGeometry:o}=e.revisions;return{domain:t,layout:n,sceneGeometry:o}}function Qe(e,t){return{sceneGeometry:Math.max(e.sceneGeometry,t.sceneGeometry),layout:Math.max(e.layout,t.layout),domain:Math.max(e.domain,t.domain)}}var Ze="production"!==process.env.NODE_ENV,Je={revisions:Ue,signature:"",sawSignals:!1,wasUnconsumed:!1,warnUnconsumed:!1},et=class{constructor(e="scene host"){this.hostName=e,this.lastConsumed=Ue,this.lastObserved=Ue,this.lastDuplicateWarning="",this.lastUnconsumedWarning=""}observeUpdateResult(e){Ze&&(this.lastObserved=Qe(this.lastObserved,Ke(e)))}beforeCompute(e,t){if(!Ze)return Je;const n=Qe(Ke(e),this.lastObserved),o=function(e){return`${e.sceneGeometry}|${e.layout}|${e.domain}`}(n),r=!((i=n).sceneGeometry===(s=this.lastConsumed).sceneGeometry&&i.layout===s.layout&&i.domain===s.domain);var i,s;return{revisions:n,signature:o,sawSignals:e.changed.has("scene-geometry")||e.changed.has("layout")||e.changed.has("domain"),wasUnconsumed:r,warnUnconsumed:!t&&r&&this.lastUnconsumedWarning!==o}}afterCompute(e,t,n){if(Ze){if(t&&e.wasUnconsumed&&(this.lastConsumed=e.revisions),e.warnUnconsumed&&!t)return console.warn(`[semiotic] ${this.hostName} observed scene-affecting revisions without a scene rebuild: ${e.signature}.`),void(this.lastUnconsumedWarning=e.signature);t&&e.sawSignals&&!e.wasUnconsumed&&!n&&this.lastDuplicateWarning!==e.signature?(console.warn(`[semiotic] ${this.hostName} performed scene rebuild with unchanged scene revisions: ${e.signature}.`),this.lastDuplicateWarning=e.signature):t&&!e.sawSignals&&(this.lastDuplicateWarning="")}}},tt=(0,Ye.memo)(function({store:e,diagnostics:t}){return(0,Ye.useEffect)(()=>{const n=()=>t.observeUpdateResult(e.getUpdateSnapshot());return n(),e.subscribeUpdateResult(n)},[t,e]),null}),nt=g(require("react"));function ot(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:nt.createElement(nt.Fragment,null,...t)}var rt=g(require("react")),it=require("react/jsx-runtime"),st={isActive:!1,predicate:()=>!0},at=rt.createContext(null);function lt({value:e,children:t}){return(0,it.jsx)(at.Provider,{value:e,children:t})}function ct(){return rt.useContext(at)??st}function ut(e,t){return null!=e?(0,it.jsx)(lt,{value:t,children:e}):e}var dt=require("react");function ht(e,t=30){return Math.max((e??4)+5,12,t)}function ft(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}var mt=[40,40],gt=[.5,.5];function yt(e,t){const[n,o]=e.viewBox??mt,[r,i]=e.anchor??gt,s=o>0?o:1,a=Math.max(0,t)/s,l=(n>0?n:s)*a,c=s*a;return{width:l,height:c,scale:a,offsetX:-r*l,offsetY:-i*c}}function pt(e,t){const n=yt(e,t),o=[[n.offsetX,n.offsetY],[n.offsetX+n.width,n.offsetY],[n.offsetX,n.offsetY+n.height],[n.offsetX+n.width,n.offsetY+n.height]];let r=0;for(const[e,t]of o){const n=Math.sqrt(e*e+t*t);n>r&&(r=n)}return r}function bt(e,t,n,o){if("none"!==e)return"color"===e||null==e?t??o:"accent"===e?n:e}var vt=null;function xt(e){if("undefined"==typeof Path2D)return null;vt||(vt=new Map);const t=vt.get(e);if(t)return t;const n=new Path2D(e);return vt.size>1024&&vt.clear(),vt.set(e,n),n}function wt(e,t,n=0,o="horizontal"){const[r,i]=e.viewBox??mt,s=Math.min(1,Math.max(0,n)),a=Math.min(1,Math.max(0,t));return a>s?s>0||1>a?"vertical"===o?{x:0,y:i*(1-a),width:r,height:i*(a-s)}:{x:r*s,y:0,width:r*(a-s),height:i}:null:{x:0,y:0,width:0,height:0}}function kt(e,t){const n=yt(e,t);return{centerDx:n.offsetX+n.width/2,centerDy:n.offsetY+n.height/2,halfWidth:n.width/2,halfHeight:n.height/2,radius:Math.hypot(n.width,n.height)/2}}function St(e,t,n,o,r,i=e=>e){for(const s of t.parts){const t=xt(s.d);if(!t)continue;const a=s.opacity??1,l=e.globalAlpha;1!==a&&(e.globalAlpha=l*a);const c=r?"none"===s.fill?void 0:r:bt(s.fill,n,o);c&&(e.fillStyle=i(c),e.fill(t));const u=r?s.stroke&&"none"!==s.stroke?r:void 0:bt(s.stroke??"none",n,o);u&&(e.strokeStyle=i(u),e.lineWidth=s.strokeWidth??1,e.lineCap=s.strokeLinecap??"butt",e.lineJoin=s.strokeLinejoin??"miter",e.stroke(t)),1!==a&&(e.globalAlpha=l)}}function At(e,t,n,o=30,r,i=0){let s=null;if(r){const e=function(e,t,n,o,r,i=e=>e.x,s=e=>e.y,a=e=>e.r){const l=Math.max(o,r+5,12),c=t-l,u=t+l,d=n-l,h=n+l;let f=null,m=1/0;return e.visit((e,r,l,g,y)=>{if(r>u||c>g||l>h||d>y)return!0;if(!e.length){let r=e;do{const e=r.data,l=i(e)-t,c=s(e)-n,u=Math.sqrt(l*l+c*c);ht(a(e),o)>=u&&m>u&&(f=e,m=u),r=r.next}while(r)}return!1}),f?{node:f,distance:m}:null}(r,t,n,o,i);e&&(s={datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const i of e){let e=null;switch(i.type){case"rect":if(null==i.datum)break;e=Mt(i,t,n);break;case"point":if(r)break;e=Ct(i,t,n,o);break;case"symbol":e=jt(i,t,n,o);break;case"glyph":e=_t(i,t,n,o);break;case"wedge":if(null===i.datum)break;e=Rt(i,t,n);break;case"boxplot":e=Pt(i,t,n);break;case"violin":e=Lt(i,t,n)}e&&o>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}function Mt(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 Ct(e,t,n,o=30){const r=t-e.x,i=n-e.y,s=Math.sqrt(r*r+i*i);return s>ht(e.r,o)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function jt(e,t,n,o=30){const r=t-e.x,i=n-e.y,s=Math.sqrt(r*r+i*i);return s>ht(ge(e.size),o)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function _t(e,t,n,o=30){if(null==e.datum)return null;const r=kt(e.glyph,e.size),i=e.x+r.centerDx,s=e.y+r.centerDy,a=t-i,l=n-s,c=Math.sqrt(a*a+l*l);return c>ht(r.radius,o)?null:{datum:e.datum,x:i,y:s,distance:c}}function Rt(e,t,n){const o=t-e.cx,r=n-e.cy,i=Math.sqrt(o*o+r*r);if(e.innerRadius>i||i>e.outerRadius)return null;const s=ft(Math.atan2(r,o)),a=ft(e.startAngle),l=ft(e.endAngle);if(!(a>l?s>=a||l>=s:s>=a&&l>=s))return null;const c=(e.startAngle+e.endAngle)/2,u=(e.innerRadius+e.outerRadius)/2;return{datum:e.datum,x:e.cx+Math.cos(c)*u,y:e.cy+Math.sin(c)*u,distance:0,category:e.category}}function Pt(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 r=e.y-o,i=e.y+o;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||r>n||n>i))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category,stats:e.stats}}return null}function Lt(e,t,n){if(!e.bounds)return null;const{x:o,y:r,width:i,height:s}=e.bounds;return o>t||t>o+i||r>n||n>r+s?null:{datum:e.datum,x:o+i/2,y:r+s/2,distance:0,category:e.category,stats:e.stats}}var It=require("react"),Tt={fresh:1,aging:.7,stale:.45,expired:.25},$t={alpha:1,band:"fresh",isStale:!1};var Bt=require("react/jsx-runtime");function Ht({isStale:e,position:t}){return(0,Bt.jsx)("div",{className:"stream-staleness-badge",style:{position:"absolute",..."top-left"===t?{top:4,left:4}:"bottom-left"===t?{bottom:4,left:4}:"bottom-right"===t?{bottom:4,right:4}:{top:4,right:4},padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",zIndex:3,background:e?"#dc3545":"#28a745",color:"white"},children:e?"STALE":"LIVE"})}var Ot=require("react"),Ft=g(require("react")),Et=require("react/jsx-runtime"),Dt={fill:(e,t)=>(0,Et.jsx)("rect",{style:e,width:t,height:t}),line:(e,t)=>(0,Et.jsx)("line",{style:e,x1:0,y1:0,x2:t,y2:t})};function Wt(e,t,n,o,r){let i;return i="function"==typeof n?n(e):(0,Dt[n])(o(e,t),r),i}function Nt({swatchSize:e}){return(0,Et.jsx)("path",{d:`M${.25*e},${.55*e} L${.45*e},${.75*e} L${.8*e},${.3*e}`,fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function zt(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}var qt=(e,t,n,o,r,i,s,a,l,c,u)=>{const{type:d="fill",styleFn:h,items:f}=e,m=[];let g=0;const y=!(!t&&!n),p="isolate"===c||void 0===c&&null!=r,{swatchSize:b,labelGap:v,rowHeight:x}=u;return f.forEach((e,c)=>{const u=Wt(e,c,d,h,b),w=zt(e,o,r),k=r&&r.size>0&&r.has(e.label);m.push((0,Et.jsxs)("g",{transform:`translate(0,${g})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:y?a===i&&c===s?0:-1:void 0,role:y?"option":void 0,"aria-selected":y&&p?k||!1:void 0,"aria-current":y&&!p&&null!=o&&e.label===o||void 0,"aria-label":e.label,onKeyDown:y?n=>{if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowDown"===n.key||"ArrowUp"===n.key){n.preventDefault();const e=(c+("ArrowDown"===n.key?1:-1)+f.length)%f.length;l(a,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:y?t=>{l(a,c),n&&n(e);const o=t.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:y?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:y?"pointer":"default",opacity:w,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[y&&(0,Et.jsx)("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:b+v+2+7*e.label.length,height:b+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),u,k&&(0,Et.jsx)(Nt,{swatchSize:b}),(0,Et.jsx)("text",{y:b/2,x:b+v,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+c)),g+=x}),m};function Gt({config:e,orientation:t="vertical",width:n=100}){const{colorFn:o,domain:r,label:i,format:s}=e,a=s||(e=>Math.round(100*e)/100+""),l="grad-legend-"+Ft.useId();if("horizontal"===t){const e=12,t=Math.min(n,200),s=Math.max(0,(n-t)/2),c=[];for(let e=0;64>=e;e++){const t=e/64;c.push((0,Et.jsx)("stop",{offset:100*t+"%",stopColor:o(r[0]+t*(r[1]-r[0]))},e))}return(0,Et.jsxs)("g",{"aria-label":i||"Gradient legend",children:[(0,Et.jsx)("defs",{children:(0,Et.jsx)("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),i&&(0,Et.jsx)("text",{x:s+t/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),(0,Et.jsx)("rect",{x:s,y:0,width:t,height:e,fill:`url(#${l})`,rx:2}),(0,Et.jsx)("text",{x:s,y:e+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[0])}),(0,Et.jsx)("text",{x:s+t,y:e+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[1])})]})}const c=[];for(let e=0;64>=e;e++){const t=e/64;c.push((0,Et.jsx)("stop",{offset:100*t+"%",stopColor:o(r[1]-t*(r[1]-r[0]))},e))}return(0,Et.jsxs)("g",{"aria-label":i||"Gradient legend",children:[i&&(0,Et.jsx)("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),(0,Et.jsx)("defs",{children:(0,Et.jsx)("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:c})}),(0,Et.jsx)("rect",{x:0,y:0,width:14,height:100,fill:`url(#${l})`,rx:2}),(0,Et.jsx)("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[1])}),(0,Et.jsx)("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[0])})]})}function Vt(e){const{legendGroups:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,legendInteraction:s,title:a="Legend",width:l=100,height:c=20,orientation:u="vertical",legendLayout:d}=e,h=function(e){const t=Math.max(1,e?.swatchSize??16),n=Math.max(t,e?.rowHeight??22);return{swatchSize:t,labelGap:Math.max(0,e?.labelGap??6),itemGap:Math.max(0,e?.itemGap??10),rowHeight:n,align:"left"===e?.align?"start":"right"===e?.align?"end":e?.align??"start",maxWidth:e?.maxWidth}}(d),[f,m]=Ft.useState(0),[g,y]=Ft.useState(0),p=Ft.useCallback((e,t)=>{m(e),y(t)},[]),b="vertical"===u?(({legendGroups:e,width:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:s,focusedItemIndex:a,onFocusedIndexChange:l,legendInteraction:c,metrics:u})=>{let d=24;const h=[];return e.forEach((e,f)=>{d+=5,h.push((0,Et.jsx)("line",{stroke:"gray",x1:0,y1:d,x2:t,y2:d},"legend-top-line legend-symbol-"+f)),d+=8,e.label&&(d+=16,h.push((0,Et.jsx)("text",{y:d,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label},"legend-text-"+f)),d+=8),h.push((0,Et.jsx)("g",{className:"legend-item",transform:`translate(0,${d})`,children:qt(e,n,o,r,i,s,a,f,l,c,u)},"legend-group-"+f)),d+=e.items.length*u.rowHeight+8}),h})({legendGroups:t||[],width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:g,onFocusedIndexChange:p,legendInteraction:s,metrics:h}):(({legendGroups:e,height:t,width:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u,metrics:d})=>{let h=0;const f=[];e.forEach((e,t)=>{let m=0;e.label&&(m+=16);const g=((e,t,n,o,r,i,s,a,l,c,u,d)=>{const{type:h="fill",styleFn:f,items:m}=e,g=[],{swatchSize:y,labelGap:p,itemGap:b,rowHeight:v,align:x}=u,w=!(!t&&!n),k="isolate"===c||void 0===c&&null!=r,S=m.map(e=>y+p+7*e.label.length),A=[];let M=0,C=0;S.forEach((e,t)=>{const n=0===C?e:C+b+e;d&&d>0&&C>0&&n>d?(A.push({start:M,end:t,width:C}),M=t,C=e):C=n}),m.length>0&&A.push({start:M,end:m.length,width:C}),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=Wt(e,d,h,f,y),A=zt(e,o,r),M=r&&r.size>0&&r.has(e.label);g.push((0,Et.jsxs)("g",{transform:`translate(${u},${c*v})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:w?a===i&&d===s?0:-1:void 0,role:w?"option":void 0,"aria-selected":w&&k?M||!1:void 0,"aria-current":w&&!k&&null!=o&&e.label===o||void 0,"aria-label":e.label,onKeyDown:w?n=>{if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowRight"===n.key||"ArrowLeft"===n.key){n.preventDefault();const e=(d+("ArrowRight"===n.key?1:-1)+m.length)%m.length;l(a,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:w?t=>{l(a,d),n&&n(e);const o=t.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:w?e=>{n&&n(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&&(0,Et.jsx)("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:y+p+2+7*e.label.length,height:y+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),x,M&&(0,Et.jsx)(Nt,{swatchSize:y}),(0,Et.jsx)("text",{y:y/2,x:y+p,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+d)),u+=S[d]+b}});const j=Math.max(0,...A.map(e=>e.width)),_=A.length;return{items:g,offset:j,totalRows:_,totalHeight:_*v}})(e,o,r,i,s,a,l,t,c,u,d,d.maxWidth??n);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??n;let g=h>m?0:"center"===d.align?Math.max(0,(m-h)/2):"end"===d.align?Math.max(0,m-h):0;const y=[];return f.forEach((n,o)=>{const r=e[o];r.label&&(y.push((0,Et.jsx)("text",{transform:`translate(${g},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:r.label},"legend-text-"+o)),g+=16),y.push((0,Et.jsx)("g",{className:"legend-item",transform:`translate(${g},0)`,children:n.items},"legend-group-"+o)),g+=n.offset+5,e[o+1]&&y.push((0,Et.jsx)("line",{stroke:"gray",x1:g,y1:-8,x2:g,y2:(n.totalHeight||t)+0+8},"legend-top-line legend-symbol-"+o)),g+=12}),(0,Et.jsx)("g",{children:y})})({legendGroups:t||[],title:a,height:c,width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:g,onFocusedIndexChange:p,legendInteraction:s,metrics:h}),v=!(!n&&!o);return(0,Et.jsxs)("g",{role:v?"listbox":void 0,"aria-multiselectable":!(!v||"isolate"!==s&&(void 0!==s||null==i))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==a&&""!==a&&"vertical"===u&&(0,Et.jsx)("text",{className:"legend-title",y:16,x:l/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:a}),b]})}function Xt(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}var Yt=require("react/jsx-runtime");function Ut(e){const{legend:t,totalWidth:n,totalHeight:o,margin:r,legendPosition:i="right",legendLayout:s,title:a,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=e;if(!t)return null;const f="top"===i||"bottom"===i,m=!!a,g=Math.max(0,n-r.left-r.right),y=Math.max(1,f?s?.maxWidth??g:100);let p,b;return"left"===i?(p=Math.max(4,r.left-y-10),b=r.top):"top"===i?(p=r.left,b=m?32:8):"bottom"===i?(p=r.left,b=o-r.bottom+38):(p=n-r.right+10,b=r.top),(0,Yt.jsx)("g",{transform:`translate(${p}, ${b})`,children:(v=t,"object"==typeof v&&null!==v&&"gradient"in v?(0,Yt.jsx)(Gt,{config:t.gradient,orientation:f?"horizontal":"vertical",width:y}):Xt(t)?(0,Yt.jsx)(Vt,{legendGroups:t.legendGroups,title:"",width:y,orientation:f?"horizontal":"vertical",legendLayout:s,customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):t)});var v}var Kt=g(require("react")),Qt=require("react/jsx-runtime");function Zt(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),r=e.split(/\s+/),i=[];let s="";for(const e of r)s&&s.length+1+e.length>o?(i.push(s),s=e):s=s?`${s} ${e}`:e;return s&&i.push(s),i}function Jt(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 en(e,t,n,o){if(!e)return(0,Qt.jsx)("g",{className:"annotation-note"});const{label:r,title:i,orientation:s,align:a,wrap:l=120,noWrap:c}=e;if(!r&&!i)return(0,Qt.jsx)("g",{className:"annotation-note"});let u=s;u||(u=Math.abs(t)>Math.abs(n)?"leftRight":"topBottom");let d=a;d&&"dynamic"!==d||(d="topBottom"===u?0>t?"right":"left":0>n?"bottom":"top");let h="start";"topBottom"===u?"right"===d?h="end":"middle"===d&&(h="middle"):h=0>t?"end":"start";const f=16,m=i?c?[i]:Zt(i,l):[],g=r?c?[r]:Zt(r,l):[],y="leftRight"===u?"end"===h?-4:4:0;let p=0;const b=[],v=o||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";e.useHTML||e.html?b.push((0,Qt.jsx)("foreignObject",{className:"annotation-note-html",x:"end"===h?y-l:"middle"===h?y-l/2:y,y:-16,width:l,height:Math.max(f,(m.length+g.length)*f+(i&&r?2:0))+f,style:{overflow:"visible"},children:(0,Qt.jsxs)("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{color:v,fontSize:"12px",lineHeight:"16px",overflow:"visible",textAlign:"end"===h?"right":"middle"===h?"center":"left",whiteSpace:c?"nowrap":"normal",wordBreak:"break-word"},children:[i&&(0,Qt.jsx)("div",{className:"annotation-note-title",style:{fontWeight:"bold"},children:i}),r&&(0,Qt.jsx)("div",{className:"annotation-note-label",children:r})]})},"annotation-note-html")):(m.length>0&&(b.push((0,Qt.jsx)("text",{className:"annotation-note-title",fill:v,textAnchor:h,fontWeight:"bold",children:m.map((e,t)=>(0,Qt.jsx)("tspan",{x:y,dy:0===t?0:f,children:e},t))},"annotation-note-title")),p=m.length*f),g.length>0&&b.push((0,Qt.jsx)("text",{className:"annotation-note-label",fill:v,textAnchor:h,y:p,children:g.map((e,t)=>(0,Qt.jsx)("tspan",{x:y,dy:0===t?0:f,children:e},t))},"annotation-note-label")));let x=null;if((i||r)&&(0!==t||0!==n))if("topBottom"===u){const e=Math.min(l,120);let t=0,n=e;"end"===h?(t=-e,n=0):"middle"===h&&(t=-e/2,n=e/2),x=(0,Qt.jsx)("line",{className:"note-line",x1:t,x2:n,y1:0,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)"})}else{const e=(m.length+g.length)*f+(g.length>0?f:0);let t=0,n=e;"bottom"===d?(t=-e,n=0):"middle"===d&&(t=-e/2,n=e/2),x=(0,Qt.jsx)("line",{className:"note-line",x1:0,x2:0,y1:t,y2:n,stroke:o||"var(--semiotic-text-secondary, currentColor)"})}const w=Math.max(0,m.length+g.length-1)*f;let k=0;return"topBottom"===u?k=0>n?-(w+2):18:"leftRight"===u&&(k="middle"===d?-(w+f+(g.length>0&&m.length>0?2:0))/2+8:"bottom"===d||0>n?-(w+2):18),(0,Qt.jsxs)("g",{className:"annotation-note",transform:`translate(${t},${n})`,children:[(0,Qt.jsx)("g",{className:"annotation-note-content",transform:0!==k?`translate(0,${k})`:void 0,children:b}),x]})}function tn(e,t,n,o,r){const i=[];switch(e){case"callout-circle":{const e=(t?.radius||0)+(t?.radiusPadding||0);e>0&&i.push((0,Qt.jsx)("circle",{r:e,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const e=t?.width||0,o=t?.height||0;(e>0||o>0)&&i.push((0,Qt.jsx)("rect",{width:e,height:o,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":t?.custom&&i.push(...Array.isArray(t.custom)?t.custom:[t.custom]);break;case"xy-threshold":{const e=o||0,s=r||0;if(void 0!==t?.x){const o=(t.x||0)-e;i.push((0,Qt.jsx)("line",{x1:o,y1:(t.y1||0)-s,x2:o,y2:(t.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==t?.y){const o=(t.y||0)-s;i.push((0,Qt.jsx)("line",{x1:(t.x1||0)-e,y1:o,x2:(t.x2||0)-e,y2:o,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==t?.x1||void 0!==t?.x2?i.push((0,Qt.jsx)("line",{x1:(t.x1||0)-e,y1:0,x2:(t.x2||0)-e,y2:0,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===t?.y1&&void 0===t?.y2||i.push((0,Qt.jsx)("line",{x1:0,y1:(t.y1||0)-s,x2:0,y2:(t.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const e=t?.type||"curly",o=t?.width??t?.height;void 0!==o&&i.push((0,Qt.jsx)("path",{d:Jt(e,o,t?.depth||30,void 0===t?.width),fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return(0,Qt.jsx)("g",{className:"annotation-subject",children:i})}function nn(e,t,n,o,r,i){const s=[];let a=0,l=0;if("callout-circle"!==r&&"label"!==r||!i?.radius){if("callout-rect"===r&&i){const n=i.width||0,o=i.height||0;if(n>0||o>0){const r=n/2,i=o/2,s=e-r,c=t-i;if(0!==s||0!==c){const e=Math.abs(s),t=Math.abs(c),u=n/2,d=o/2,h=e*d>t*u?u/e:d/t;a=r+s*h,l=i+c*h}}}else if("bracket"===r&&i){const e=i.width,t=i.height,n=i.depth||30;void 0!==e?(a=e/2,l=n):void 0!==t&&(a=n,l=t/2)}}else{const n=(i.radius||0)+(i.radiusPadding||0);if(n>0&&(0!==e||0!==t)){const o=Math.atan2(t,e);a=Math.cos(o)*n,l=Math.sin(o)*n}}const c=Math.sqrt((e-a)**2+(t-l)**2);if(c>.5){const r=o||"var(--semiotic-text-secondary, currentColor)",i="curve"===n?.type;let u=Math.atan2(t-l,e-a);if(i){const o=(a+e)/2,i=(l+t)/2,d=-(t-l)/c,h=(e-a)/c,f=(n?.curve??.25)*c,m=o+d*f,g=i+h*f;s.push((0,Qt.jsx)("path",{className:"connector-curve",d:`M${a},${l}Q${m},${g} ${e},${t}`,fill:"none",stroke:r},"connector-line")),u=Math.atan2(g-l,m-a)}else s.push((0,Qt.jsx)("line",{x1:a,y1:l,x2:e,y2:t,stroke:r},"connector-line"));if("arrow"===n?.end){const e=10,t=16/180*Math.PI;s.push((0,Qt.jsx)("path",{d:`M${a},${l}L${a+e*Math.cos(u+t)},${l+e*Math.sin(u+t)}L${a+e*Math.cos(u-t)},${l+e*Math.sin(u-t)}Z`,fill:r,stroke:"none"},"connector-arrow"))}}return(0,Qt.jsx)("g",{className:"annotation-connector",children:s})}function on(e){const{x:t=0,y:n=0,dx:o,dy:r,nx:i,ny:s,note:a,connector:l,subject:c,type:u,color:d,className:h,disable:f,opacity:m,strokeDasharray:g,events:y={},"data-testid":p}=e,b=Array.isArray(t)?t[0]??0:t,v=Array.isArray(n)?n[0]??0:n,x=new Set(Array.isArray(f)?f:[]);let w=o||0,k=r||0;null!=i&&(w=i-b),null!=s&&(k=s-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(0,Qt.jsxs)("g",{className:("annotation "+(h||"")).trim(),transform:`translate(${b},${v})`,"data-testid":p,...null!=m&&{opacity:m},...g&&{strokeDasharray:g},...y,children:[!x.has("connector")&&nn(w,k,l,d,S,c),!x.has("subject")&&tn(S,c,d,b,v),!x.has("note")&&en(a,w,k,d)]})}function rn(e){const{noteData:t}=e,{screenCoordinates:n}=t,o="string"==typeof t.type?t.type:"label",r=t.eventListeners||t.events||{};if(t.coordinates&&n){const e=t.nx||n[0][0]+(t.dx??0),r=t.ny||n[0][1]+(t.dy??0),i=n.map((n,i)=>{const s=Object.assign({},t,{note:0===i?t.note:{label:""},x:n[0],y:n[1],nx:e,ny:r});return(0,Qt.jsx)(on,{"data-testid":"semiotic-annotation",...s,type:o},"multi-annotation-"+i)});return(0,Qt.jsx)("g",{children:i})}const i=t.note||{title:"none",label:t.label},s=`${i.label}-${i.title}-${t.i}`;return(0,Qt.jsx)(on,{"data-testid":"semiotic-annotation",events:r,...t,type:o},s)}var sn=require("d3-hierarchy"),an=require("d3-shape");function ln(e){return Math.round(100*e)/100}function cn(e,t=2){const n=[],o=[],r=t+1;for(let t=0;r>t;t++){let i=0;for(const[n,o]of e)null!==o&&(i+=n**t*o);n.push(i);const s=[];for(let n=0;r>n;n++){let o=0;for(const[r,i]of e)null!==i&&(o+=r**(t+n));s.push(o)}o.push(s)}o.push(n);const i=function(e,t){const n=e,o=e.length-1,r=[t];for(let e=0;o>e;e++){let t=e;for(let r=e+1;o>r;r++)Math.abs(n[e][r])>Math.abs(n[e][t])&&(t=r);for(let r=e;o+1>r;r++){const o=n[r][e];n[r][e]=n[r][t],n[r][t]=o}for(let t=e+1;o>t;t++)for(let r=o;r>=e;r--)n[r][t]-=n[r][e]*n[e][t]/n[e][e]}for(let e=o-1;e>=0;e--){let t=0;for(let i=e+1;o>i;i++)t+=n[i][e]*r[i];r[e]=(n[o][e]-t)/n[e][e]}return r}(o,r).map(ln);return{points:e.map(([e])=>[ln(e),ln(i.reduce((t,n,o)=>t+n*e**o,0))]),equation:[...i].reverse()}}function un(e,t){const n=t.scales?.x??t.scales?.time;return n?null!=e.x?n(e.x):t.xAccessor&&null!=e[t.xAccessor]?n(e[t.xAccessor]):null:null}function dn(e,t){const n=t.scales?.y??t.scales?.value;return n?null!=e.y?n(e.y):t.yAccessor&&null!=e[t.yAccessor]?n(e[t.yAccessor]):null:null}function hn(e){return null==e?null:e+""}function fn(e,t,n){return t.stickyPositionCache?.set(e,n),n}function mn(e,t,n){const o=e.anchor||e.lifecycle?.anchor||"fixed";if("latest"===o){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let o=n.pointNodes.length-1;o>=0;o--){const r=n.pointNodes[o];if(r.pointId===e.pointId)return fn(t,n,{x:r.x,y:r.y})}const o=function(e){const t=e.data;if(!t||0===t.length)return null;const n=t[t.length-1],o=e.scales?.x??e.scales?.time,r=e.scales?.y??e.scales?.value;if(!o||!r)return null;const i=n[e.xAccessor||"x"],s=n[e.yAccessor||"y"];return null==i||null==s?null:{x:o(i),y:r(s)}}(n);return o?fn(t,n,o):null}if("semantic"===o){const o=function(e,t,n){const o=function(e){return hn(e.provenance?.stableId??e.stableId)}(e);if(!o)return null;const r=n.pointNodes?.find(e=>hn(e.pointId)===o);if(r)return fn(t,n,{x:r.x,y:r.y});const i=n.data?.find(e=>function(e){return hn(e.stableId??e.id??e.provenance?.stableId)}(e)===o);if(!i)return null;const s=un(i,n),a=dn(i,n);return null==s||null==a?null:fn(t,n,{x:s,y:a})}(e,t,n);if(o)return o}let r=null,i=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(r=t.x,i=t.y)}if(null!=r&&null!=i||(r=un(e,n),i=dn(e,n)),null!=r&&null!=i)return fn(t,n,{x:r,y:i});if("sticky"===o){const e=n.stickyPositionCache?.get(t);if(e)return e}return null}function gn(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}var yn=require("react/jsx-runtime"),pn={secondary:0,primary:3};function bn(e){return!0===e?._annotationDeferred}function vn(e){return"blended"===e?.cohesion||"layer"===e?.cohesion?e.cohesion:null}function xn(e){const t=e?.provenance?.confidence;return"number"==typeof t&&Number.isFinite(t)?Math.max(0,Math.min(1,t)):null}function wn(e){return Math.max(.72,.95-.06*e)}var kn=g(require("react")),Sn=require("react"),An=require("react/jsx-runtime");function Mn(e){let t=null;const n=()=>(t||(t=(0,Sn.createContext)(null)),t),o=Cn(e);return[function({children:t,initialState:o}){const r=(0,Sn.useRef)(o),i=(0,Sn.useMemo)(()=>Cn(e,r.current),[]),s=n();return(0,An.jsx)(s.Provider,{value:i,children:t})},(e,t)=>{const r=n(),i=(0,Sn.useContext)(r)??o,s=(0,Sn.useRef)(e);s.current=e;const a=(0,Sn.useRef)({hasValue:!1,value:void 0}),l=(0,Sn.useCallback)(()=>{const e=s.current(i.getState()),n=a.current;return n.hasValue&&t&&t(n.value,e)?n.value:(a.current={hasValue:!0,value:e},e)},[i,t]),c=(0,Sn.useCallback)(()=>s.current(i.getState()),[i]);return(0,Sn.useSyncExternalStore)(i.subscribe,l,c)}]}function Cn(e,t){const n=new Set;let o={...e(function(e){const t=e(o);if(function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}(t)){o={...o,...t};for(const e of n)e()}}),...t??{}};return{getState:()=>o,subscribe:function(e){return n.add(e),()=>{n.delete(e)}}}}var[jn,_n]=Mn(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const n=e.observations;return n.push(t),n.length>e.maxObservations&&n.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));function Rn(e,t={}){const n=function(e){const t=e.provenance,n=e.id??e.stableId??t?.stableId;return null==n||""===n?void 0:n+""}(e);return{"data-semiotic-annotation-widget":"",...n?{"data-semiotic-annotation-id":n}:{},onClickCapture(o){const r=function(e){const t=e.nativeEvent;return"touch"===t.pointerType?"touch":0===t.detail?"keyboard":"pointer"}(o);t.onAnnotationActivate?.({annotation:e,annotationId:n,chartId:t.chartId,inputType:r}),n&&t.onObservation&&t.onObservation({type:"annotation-activate",annotationId:n,inputType:r,timestamp:Date.now(),chartType:t.chartType??"unknown",chartId:t.chartId})}}}var Pn=require("react/jsx-runtime"),Ln="var(--semiotic-bg, #ffffff)",In=.85;function Tn(e,t){return(e+"").length*t*.6}function $n(e){const{x:t,y:n,text:o,fill:r,fontSize:i=12,fontWeight:s,fontFamily:a,textAnchor:l="start",dominantBaseline:c,background:u,className:d}=e,h=function(e){return void 0===e||!0===e||"halo"===e?{type:"halo"}:!1===e||"none"===e?null:"box"===e?{type:"box"}:{type:e.type??"halo",...e}}(u),f=e=>(0,Pn.jsx)("text",{x:t,y:n,textAnchor:l,dominantBaseline:c,fill:r,fontSize:i,fontWeight:s,fontFamily:a,className:d,...e?{stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:"stroke"}:{},children:o});if(!h)return f();if("halo"===h.type)return f({stroke:h.fill??Ln,strokeWidth:h.haloWidth??3});const m=h.padding??{x:6,y:3},g="number"==typeof m?m:m.x,y="number"==typeof m?m:m.y,p=Tn(o,i),b=i+2*y;let v,x;return v="middle"===l?t-p/2-g:"end"===l?t-p-g:t-g,x="middle"===c||"central"===c?n-b/2:"hanging"===c||"text-before-edge"===c?n-y:n-.8*i-y,(0,Pn.jsxs)("g",{className:d,children:[(0,Pn.jsx)("rect",{x:v,y:x,width:p+2*g,height:b,rx:h.radius??3,ry:h.radius??3,fill:h.fill??Ln,fillOpacity:h.opacity??In,stroke:h.stroke,strokeWidth:h.strokeWidth}),f()]})}var Bn=null;function Hn(e={},t){const{background:n="transparent",stroke:o="#000",lineWidth:r=1.5,spacing:i=6,angle:s=45}=e,a=Math.max(8,Math.ceil(2*i));let l;try{l=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(Bn||(Bn=document.createElement("canvas")),Bn.width=e,Bn.height=e,Bn)}(a)}catch{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=r,c.lineCap="square";const u=s*Math.PI/180;if(45===s||-45===s){const e=s>0?1:-1;for(let t=-a;2*a>=t;t+=i)c.beginPath(),c.moveTo(t,0),c.lineTo(t+e*a,a),c.stroke()}else{c.save(),c.translate(a/2,a/2),c.rotate(u);const e=2*a;for(let t=-e;e>=t;t+=i)c.beginPath(),c.moveTo(-e,t),c.lineTo(e,t),c.stroke();c.restore()}return(t||c).createPattern(l,"repeat")}var On=require("react/jsx-runtime");function Fn(e){return"object"==typeof e&&null!==e&&"hatch"===e.type}function En(e){return["hatch",e.background??"transparent",e.stroke??"#000",e.lineWidth??1.5,e.spacing??6,e.angle??45,e.lineOpacity??1].join("|")}function Dn(e,t){let n=2166136261;const o=En(t);for(let e=0;o.length>e;e++)n^=o.charCodeAt(e),n=Math.imul(n,16777619);return`${e}-hatch-${(n>>>0).toString(36)}`}var Wn=new Map;function Nn(e,t){const{background:n="transparent",stroke:o="#000",lineWidth:r=1.5,spacing:i=6,angle:s=45,lineOpacity:a=1}=e,l=Math.max(8,Math.ceil(2*i));return(0,On.jsxs)("pattern",{id:t,width:l,height:l,patternUnits:"userSpaceOnUse",patternTransform:0!==s?`rotate(${s})`:void 0,children:[n&&"transparent"!==n&&(0,On.jsx)("rect",{width:l,height:l,fill:n}),(0,On.jsx)("line",{x1:0,y1:0,x2:0,y2:l,stroke:o,strokeWidth:r,strokeOpacity:a}),(0,On.jsx)("line",{x1:i,y1:0,x2:i,y2:l,stroke:o,strokeWidth:r,strokeOpacity:a})]},t)}function zn(e,t,n="#4e79a7"){if(Fn(e)){const n=Dn(t,e);return{fill:`url(#${n})`,def:Nn(e,n)}}return e&&"string"==typeof e?{fill:e}:{fill:n}}var qn=require("react/jsx-runtime"),Gn={linear:an.curveLinear,monotoneX:an.curveMonotoneX,monotoneY:an.curveMonotoneY,step:an.curveStep,stepAfter:an.curveStepAfter,stepBefore:an.curveStepBefore,basis:an.curveBasis,cardinal:an.curveCardinal,catmullRom:an.curveCatmullRom};var Vn=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function Xn(e){return!!e&&"object"==typeof e&&Vn.has(function(e){return"string"==typeof e?.type?e.type:""}(e))}function Yn(e){return"primary"===e?.emphasis||!0===e?.defensive}function Un(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 Kn(e){let t;const n=e?.emphasis;t="primary"===n?100:"secondary"===n?10:50;const o=e?.provenance?.confidence;switch("number"==typeof o&&Number.isFinite(o)&&(t+=15*Math.max(0,Math.min(1,o))),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 Qn=32,Zn=6,Jn=4,eo=8,to=72;var no={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function oo(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 Xn(e)}function io(e,t){if(!e)return[];const n=Math.max(1,Math.floor(t/7)),o=e.split(/\s+/).filter(Boolean),r=[];let i="";for(const e of o)i&&i.length+e.length+1>n?(r.push(i),i=e):i=i?`${i} ${e}`:e;return i&&r.push(i),r}function so(e,t,n,o,r){const i=e+n,s=t+o;return Math.abs(n)>Math.abs(o)?{x:0>n?i-r.width-4:i+4,y:0>o?s-r.height:s,width:r.width,height:r.height}:{x:0>n?i-r.width:i,y:0>o?s-r.height-4:s+4,width:r.width,height:r.height}}function ao(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function lo(e,t){return Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x))*Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y))}function co(e,t,n,o,r,i,s,a){const l=ao(e,s);let c=.4*Math.hypot(t.dx,t.dy)+80*function(e,t,n,o){const r=Math.max(0,o-e.x),i=Math.max(0,o-e.y);return(r+Math.max(0,e.x+e.width-(t-o)))*e.height+(i+Math.max(0,e.y+e.height-(n-o)))*e.width}(l,r,i,a);for(const e of n)c+=12*lo(l,e);for(const e of o)c+=4*lo(l,e);return c}function uo(e){const{annotations:t,context:n,defaultOffset:o=Qn,notePadding:r=Zn,markPadding:i=Jn,edgePadding:s=eo,preserveManualOffsets:a=!0,routeLongConnectors:l=!0,connectorThreshold:c=to,density:u,progressiveDisclosure:d=!1,redundantCues:h=!1,responsive:f,mobile:m,cohesion:g,audience:y}=e,p=n.width||0,b=n.height||0,v="object"==typeof m?m:{},x=v.breakpoint??480,w=!!m&&x>=p,k=w&&!1!==v.preferShortText?t.map(oo):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,C=w&&!g?v.cohesion:g;if(0===k.length||0>=p||0>=b)return k.slice();const j=[],_=function(e,t){return(e.pointNodes||[]).map(e=>{const n=Math.max(1,e.r||1)+t;return{x:e.x-n,y:e.y-n,width:2*n,height:2*n}})}(n,i);let R=!1;const P=k.map((e,t)=>{if(!ro(e))return e;const i=function(e,t,n){if("widget"===e.type&&"number"==typeof e.px&&"number"==typeof e.py)return{x:e.px,y:e.py};const o=e.pointId??e.nodeId;if(null!=o&&n.pointNodes){const e=n.pointNodes.find(e=>e.pointId===o);if(e)return{x:e.x,y:e.y}}const r=e.coordinates,i=n.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 n=i([e,t]);if(n&&"number"==typeof n[0]&&"number"==typeof n[1])return{x:n[0],y:n[1]}}}return n.scales||"number"!=typeof e.x||"number"!=typeof e.y?mn(e,t,n):{x:e.x,y:e.y}}(e,t,n);if(!i)return e;const u=function(e){if("widget"===e.type)return{width:"number"==typeof e.width?e.width:32,height:"number"==typeof e.height?e.height:32};const t="number"==typeof e.wrap?e.wrap:120,n=[...io("string"==typeof e.title?e.title:void 0,t),...io("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(a&&("number"==typeof(d=e).dx||"number"==typeof d.dy)){const t=function(e){return"text"===e.type||"widget"===e.type?{dx:0,dy:0}:{dx:30,dy:-30}}(e);return j.push(ao(so(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}]}(o)){const t=co(so(i.x,i.y,e.dx,e.dy,u),e,j,_,p,b,r,s);f>t&&(h=e,f=t)}if(!h)return e;const m=ao(so(i.x,i.y,h.dx,h.dy,u),r);j.push(m);const g=Math.hypot(h.dx,h.dy),y=l&&g>=c&&"text"!==e.type&&"widget"!==e.type?{...e.connector||{end:"arrow"},type:"curve"}:e.connector;return R=!0,{...e,dx:h.dx,dy:h.dy,...y?{connector:y}:{}}}),L=R?P:k.slice();let I=L;if(h){let e=!1;const t=L.map(t=>{const n=function(e){return"text"!==e.type||"string"!=typeof e.color||8>Math.hypot("number"==typeof e.dx?e.dx:0,"number"==typeof e.dy?e.dy:0)?e:{...e,_redundantConnector:!0}}(t);return n!==t&&(e=!0),n});I=e?t:L}{let e=!1;const t=I.map(t=>{if(!0!==t?.defensive)return t;const n=function(e){const t=e?.provenance;if(!t||"object"!=typeof t)return e;const n="string"==typeof t.source?no[t.source]??t.source:null,o="number"==typeof t.confidence&&Number.isFinite(t.confidence)?Math.round(100*Math.max(0,Math.min(1,t.confidence)))+"%":null;if(!n&&!o)return e;if(null!=e.label&&"string"!=typeof e.label)return e;const r=[n,o].filter(Boolean).join(" · "),i="string"==typeof e.label?e.label:"";return i.includes(`(${r})`)?e:{...e,label:i?`${i} (${r})`:`(${r})`}}(t);return n!==t&&(e=!0),n});I=e?t:I}const T=new Set;if(S){const e="object"==typeof S?S:{},t=function(e){if(!e)return 1;const t=function(e){const t=e?.familiarity;if(!t)return 3;const n=Object.values(t).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0===n.length?3:n.reduce((e,t)=>e+t,0)/n.length}(e);return t>2?4>t?1:.6:1.5}(y),n=1===t?e:{...e,maxAnnotations:Math.max(0,Math.round((e.maxAnnotations??Un(p,b,e))*t))},{deferred:o}=function(e){const{annotations:t,width:n,height:o}=e,r=Math.max(0,e.minVisible??1),i=Un(n,o,e),s=t.map((e,t)=>{return{annotation:e,index:t,note:(n=e,Xn(n))};var n}),a=s.filter(e=>e.note);if(0===a.length||i>=a.length)return{visible:t.slice(),deferred:[],budget:i};const l=a.filter(e=>Yn(e.annotation)),c=a.filter(e=>!Yn(e.annotation)).sort((e,t)=>Kn(t.annotation)-Kn(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:n}of s)!n||d.has(t)?h.push(e):f.push(e);return{visible:h,deferred:f,budget:i}}({annotations:I,width:p,height:b,...n});for(const e of o)T.add(e)}if(M&&("object"==typeof M&&"number"==typeof M.minWidth?M.minWidth:480)>=p)for(const e of I)ro(e)&&"secondary"===e.emphasis&&T.add(e);if(T.size>0)for(const e of I)!0===e?.defensive&&T.delete(e);let $;return $=0===T.size?I:A?I.map(e=>T.has(e)?{...e,_annotationDeferred:!0}:e):I.filter(e=>!T.has(e)),C?function(e,t){let n=!1;const o=e.map(e=>ro(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(n=!0,{...e,cohesion:t}):e);return n?o:e}($,C):$}function ho(e,t,n){return"exact"===n?function(e,t){const n=e.domain(),o=n[0],r=n[n.length-1],i=o instanceof Date,s=o instanceof Date?o.getTime():o,a=r instanceof Date?r.getTime():r;if(2>t||s===a)return i?[new Date(s),new Date(a)]:[s,a];const l=(a-s)/(t-1),c=Array(t);for(let e=0;t>e;e++){const n=e===t-1?a:s+e*l;c[e]=i?new Date(n):n}return c}(e,t):e.ticks(t)}var fo=require("react/jsx-runtime");function mo(e){const{width:t,height:n,totalWidth:o,totalHeight:r,margin:i,scales:s,showAxes:a,showGrid:l,rFormat:c}=e,{rTickValues:u,axisExtent:d}=e,h="radial"===s?.projection,f="horizontal"===s?.projection,m=(0,Ot.useMemo)(()=>!s||h?[]:(u||ho(s.r,5,d)).map(e=>({value:e,pixel:s.r(e),label:(c||go)(e)})),[s,c,h,u,d]),g=l&&s&&!h,y=a&&s&&!h;return g||y?(0,fo.jsx)("svg",{width:o,height:r,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:(0,fo.jsxs)("g",{transform:`translate(${i.left},${i.top})`,children:[g&&(0,fo.jsx)("g",{className:"ordinal-grid",children:m.map((e,o)=>(0,fo.jsx)("line",{x1:f?e.pixel:0,y1:f?0:e.pixel,x2:f?e.pixel:t,y2:f?n:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+o))}),y&&(0,fo.jsx)(fo.Fragment,{children:(0,fo.jsxs)(fo.Fragment,f?{children:[(0,fo.jsx)("line",{x1:0,y1:0,x2:0,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),(0,fo.jsx)("line",{x1:0,y1:n,x2:t,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]}:{children:[(0,fo.jsx)("line",{x1:0,y1:n,x2:t,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),(0,fo.jsx)("line",{x1:0,y1:0,x2:0,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]})})]})}):null}function go(e){return Math.round(100*e)/100+""}function yo(e){const{width:t,height:n,totalWidth:o,totalHeight:r,margin:i,scales:s,showAxes:a,showCategoryTicks:l,oLabel:c,rLabel:u,oFormat:d,rFormat:h,showGrid:f,title:m,legend:g,legendHoverBehavior:y,legendClickBehavior:p,legendHighlightedCategory:b,legendIsolatedCategories:v,legendPosition:x="right",legendLayout:w,foregroundGraphics:k,annotations:S,onAnnotationActivate:A,onObservation:M,chartId:C,chartType:j,autoPlaceAnnotations:_,svgAnnotationRules:R,xAccessor:P,yAccessor:L,annotationData:I,underlayRendered:T,canvasObscuresUnderlay:$=!0,children:B}=e,H=function(e){const t=_n(e=>e.pushObservation),n=kn.useCallback(n=>{e.onObservation?.(n),t?.(n)},[e,t]);return kn.useMemo(()=>({...e,onObservation:n}),[n,e])}({onAnnotationActivate:A,onObservation:M,chartId:C,chartType:j}),O="radial"===s?.projection,F="horizontal"===s?.projection,E=!1!==l,D=!T||$,W=(0,Ot.useMemo)(()=>{if(!a||!E||!s||O)return[];const e=s.o.bandwidth(),t=s.o.domain().map((t,n)=>({value:t,pixel:(s.o(t)??0)+e/2,label:d?d(t,n):t}));if(2>=t.length)return t;const n=Math.abs(t[1].pixel-t[0].pixel)||e,o=t.map(e=>{return t=e.label,F?"string"==typeof t||"number"==typeof t?16:24:"string"==typeof t||"number"==typeof t?6.5*(t+"").length:60;var t}),r=F?0:6;if(o.every((e,t)=>0===t||n>=(o[t-1]+e)/2+r))return t;const i=Math.max(...o)+r,l=Math.max(1,Math.ceil(i/n));return 1===l?t:t.filter((e,t)=>t%l===0)},[a,E,s,d,O,F]),N=e.rTickValues,z=e.tickLabelEdgeAlign,q=e.axisExtent,G=(0,Ot.useMemo)(()=>a&&s&&!O?(N||ho(s.r,5,q)).map(e=>({value:e,pixel:s.r(e),label:(h||go)(e)})):[],[a,s,h,O,N,q]),V=(0,Ot.useRef)(new Map),X=(0,Ot.useRef)(S?.length??0),Y=S?.length??0;X.current!==Y&&(X.current=Y,V.current=new Map);const U=(0,Ot.useMemo)(()=>{if(!S||0===S.length)return null;const e=function(e,t={}){return function(e,n,o){switch(e.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const t=mn(e,n,o);if(!t)return null;const{x:r,y:i}=t;if(!gn(r,i,o))return null;const s="callout"===e.type?"callout-circle":e.type,a="callout-circle"===s?{radius:e.radius??12,radiusPadding:e.radiusPadding}:"callout-rect"===s?{width:e.width,height:e.height}:void 0;return(0,qn.jsx)(rn,{noteData:{x:r,y:i,dx:e.dx??30,dy:e.dy??-30,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:s,...a?{subject:a}:{},connector:e.connector||{end:"arrow"},color:e.color,disable:e.disable,opacity:e.opacity,strokeDasharray:e.strokeDasharray,className:e.className}},"ann-"+n)}case"x-threshold":{const t=un(null!=e.value?{...e,x:e.value}:e,o);if(null==t)return null;const r=e.color||"#f97316",i=e.labelPosition||"top";let s;s="bottom"===i?(o.height||0)-4:"center"===i?(o.height||0)/2:16;const a=t>.6*(o.width||0),l=a?t-4:t+4,c=a?"end":"start";return(0,qn.jsxs)("g",{opacity:e.opacity,children:[(0,qn.jsx)("line",{x1:t,y1:0,x2:t,y2:o.height||0,stroke:r,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,qn.jsx)($n,{x:l,y:s,text:e.label,textAnchor:c,fill:r,fontSize:12,fontWeight:"bold",background:e.labelBackground??"halo"})]},"ann-"+n)}case"y-threshold":{const t=dn(null!=e.value?{...e,y:e.value}:e,o);if(null==t)return null;const r=e.color||"#f97316",i=e.labelPosition||"right";let a,l;"left"===i?(a=4,l="start"):"center"===i?(a=(o.width||0)/2,l="middle"):(a=(o.width||0)-4,l="end");const c=20>(s=t)?Math.min((o.height||0)-4,s+16):s-4;return(0,qn.jsxs)("g",{opacity:e.opacity,children:[(0,qn.jsx)("line",{x1:0,y1:t,x2:o.width||0,y2:t,stroke:r,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,qn.jsx)($n,{x:a,y:c,text:e.label,textAnchor:l,fill:r,fontSize:12,fontWeight:"bold",background:e.labelBackground??"halo"})]},"ann-"+n)}case"enclose":{const t=(e.coordinates||[]).map(e=>({x:un({...e,type:"point"},o),y:dn({...e,type:"point"},o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>t.length)return null;const r=(0,sn.packEnclose)(t),i=e.padding||10;return(0,qn.jsxs)("g",{children:[(0,qn.jsx)("circle",{cx:r.x,cy:r.y,r:r.r+i,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&(0,qn.jsx)($n,{x:r.x,y:r.y-r.r-i-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:e.label,background:e.labelBackground??"none"})]},"ann-"+n)}case"rect-enclose":{const t=(e.coordinates||[]).map(e=>({x:un({...e,type:"point"},o),y:dn({...e,type:"point"},o)})).filter(e=>null!=e.x&&null!=e.y);if(2>t.length)return null;const r=e.padding||10,i=t.map(e=>e.x),s=t.map(e=>e.y),[a,l]=xe(i),[c,u]=xe(s),d=a-r,h=l+r,f=c-r;return(0,qn.jsxs)("g",{children:[(0,qn.jsx)("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&&(0,qn.jsx)($n,{x:(d+h)/2,y:f-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:e.label,background:e.labelBackground??"none"})]},"ann-"+n)}case"highlight":{const t=o.data||[],r="function"==typeof e.filter?t.filter(e.filter):e.field&&null!=e.value?t.filter(t=>t[e.field]===e.value):[],i={stroke:e.color||"#f97316",strokeWidth:2,fill:"none"};return(0,qn.jsx)("g",{children:r.map((t,n)=>{const r=un(t,o),s=dn(t,o);if(null==r||null==s)return null;const a="function"==typeof e.r?e.r(t):e.r||6,l="function"==typeof e.style?e.style(t):e.style||i;return(0,qn.jsx)("circle",{cx:r,cy:s,r:a,...l},"hl-"+n)})},"ann-"+n)}case"bracket":{const t=un(e,o),r=dn(e,o);return(0,qn.jsx)(rn,{noteData:{x:t??0,y:r??0,dx:e.dx||0,dy:e.dy||0,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"bracket",subject:{type:e.bracketType||"curly",width:e.width,height:e.height,depth:e.depth||30},color:e.color}},"ann-"+n)}case"trend":{const t=o.data||[];if(2>t.length)return null;const r=o.xAccessor||"x",i=o.yAccessor||"y",s="ordinal"===o.frameType,a="horizontal"===o.projection,l=s?r:null,c=s?i:null;let u;const d=[],h=new Map;if(s&&l&&c){for(const e of t){const t=e[l];if(null==t)continue;const n=t+"";h.has(n)||(h.set(n,d.length),d.push(n))}u=t.map(e=>{const t=e[l],n=e[c];if(null==t||null==n)return null;const o=h.get(t+"");return null!=o?[o,+n]:null}).filter(e=>null!==e)}else u=t.map(e=>[e[r],e[i]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>u.length)return null;const f=o.scales?.x??o.scales?.time,m=o.scales?.y??o.scales?.value;if(!f||!m)return null;const g=e=>t=>{const n=Math.max(0,Math.floor(t)),o=Math.min(d.length-1,n+1),r=t-n,i=e(d[n]);return i+(e(d[o])-i)*r},y=f,p=m;let b;if(s)if(a){const e=g(p);b=(t,n)=>[y(n),e(t)]}else{const e=g(y);b=(t,n)=>[e(t),p(n)]}else b=(e,t)=>[y(e),p(t)];const v=e.method||"linear";let x;if("loess"===v)x=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]),r=o.map(e=>e[0]),i=o.map(e=>e[1]),s=Math.max(2,Math.ceil(t*n)),a=[];for(let e=0;n>e;e++){const t=r[e],o=r.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(s-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:o[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,f=0,m=0;for(let e=0;n>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){a.push([t,i[e]]);continue}const g=u*f-d*d;if(1e-12>Math.abs(g))a.push([t,h/u]);else{const e=(u*m-d*h)/g;a.push([t,(h-e*d)/u+e*t])}}return a}(u,e.bandwidth??.3);else{const t="polynomial"===v?cn(u,e.order||2):function(e){const t=[0,0,0,0];let n=0;for(const[o,r]of e)null!==r&&(n++,t[0]+=o,t[1]+=r,t[2]+=o*o,t[3]+=o*r);const o=n*t[2]-t[0]*t[0],r=0===o?0:ln((n*t[3]-t[0]*t[1])/o),i=ln(t[1]/n-r*t[0]/n);return{points:e.map(([e])=>[ln(e),ln(r*e+i)]),equation:[r,i]}}(u);x=t.points}const w=x.map(([e,t])=>{const[n,o]=b(e,t);return`${n},${o}`}).join(" "),k=e.color||"#6366f1",S=x[x.length-1],[A,M]=b(S[0],S[1]);return(0,qn.jsxs)("g",{children:[(0,qn.jsx)("polyline",{points:w,fill:"none",stroke:k,strokeWidth:e.strokeWidth||2,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,qn.jsx)("text",{x:A+4,y:M-4,fill:k,fontSize:11,children:e.label})]},"ann-"+n)}case"band":{const t=o.scales?.y??o.scales?.value,s=t?.(e.y0)??0,a=t?.(e.y1)??(o.height||0),l=zn(e.fill,"ann-"+n,"var(--semiotic-primary, #6366f1)");return(0,qn.jsxs)("g",{opacity:e.opacity,children:[l.def&&(0,qn.jsx)("defs",{children:l.def}),(0,qn.jsx)("rect",{x:0,y:Math.min(s,a),width:o.width||0,height:Math.abs(a-s),fill:l.fill,fillOpacity:e.fillOpacity||.1}),e.label&&(0,qn.jsx)($n,{x:(o.width||0)-4,y:(r=s,i=a,Math.max(Math.min(r,i),0)+16),textAnchor:"end",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:e.label,background:e.labelBackground??"halo"})]},"ann-"+n)}case"x-band":{const t=o.scales?.x??o.scales?.time,r=null!=e.x0&&t?t(e.x0):null,i=null!=e.x1&&t?t(e.x1):null;if(null==r||null==i)return null;const s=zn(e.fill||e.color,"ann-"+n,"var(--semiotic-primary, #6366f1)");return(0,qn.jsxs)("g",{opacity:e.opacity,children:[s.def&&(0,qn.jsx)("defs",{children:s.def}),(0,qn.jsx)("rect",{x:Math.min(r,i),y:0,width:Math.abs(i-r),height:o.height||0,fill:s.fill,fillOpacity:e.fillOpacity??.1}),e.label&&(0,qn.jsx)($n,{x:Math.min(r,i)+4,y:16,textAnchor:"start",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:e.label,background:e.labelBackground??"halo"})]},"ann-"+n)}case"envelope":{const t=o.data||[];if(2>t.length)return null;const r=o.xAccessor||"x",i=o.scales?.x??o.scales?.time,s=o.scales?.y??o.scales?.value;if(!i||!s)return null;const a=e.upperAccessor||"upperBounds",l=e.lowerAccessor||"lowerBounds",c=e.filter,u=t.filter(e=>null!=e[a]&&null!=e[l]&&!(c&&!c(e))).sort((e,t)=>e[r]-t[r]);if(2>u.length)return null;const d=Gn[o.curve||"linear"]||an.curveLinear,h=(0,an.area)().x(e=>i(e[r])).y0(e=>s(e[l])).y1(e=>s(e[a])).curve(d)(u);if(!h)return null;const f=e.fill||"#6366f1";return(0,qn.jsxs)("g",{children:[(0,qn.jsx)("path",{d:h,fill:f,fillOpacity:e.fillOpacity??.15,stroke:"none"}),e.label&&u.length>0&&(0,qn.jsx)("text",{x:i(u[u.length-1][r])+4,y:s(u[u.length-1][a])-4,fill:f,fontSize:11,children:e.label})]},"ann-"+n)}case"anomaly-band":{const t=o.data||[];if(2>t.length)return null;const r=o.yAccessor||"y",i=o.scales?.x??o.scales?.time,s=o.scales?.y??o.scales?.value;if(!i||!s)return null;const a=t.map(e=>e[r]).filter(e=>null!=e&&isFinite(e));if(2>a.length)return null;const l=a.reduce((e,t)=>e+t,0)/a.length,c=a.reduce((e,t)=>e+(t-l)**2,0)/a.length,u=Math.sqrt(c),d=e.threshold??2,h=l-d*u,f=!1!==e.showBand,m=e.fill||"#6366f1",g=e.fillOpacity??.1,y=e.anomalyColor||"#ef4444",p=e.anomalyRadius??6,b=s(l+d*u),v=s(h),x=t.filter(e=>{const t=e[r];return null!=t&&Math.abs(t-l)>d*u});return(0,qn.jsxs)("g",{children:[f&&(0,qn.jsx)("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=un(e,o),r=dn(e,o);return null==n||null==r?null:(0,qn.jsx)("circle",{cx:n,cy:r,r:p,fill:y,fillOpacity:.7,stroke:y,strokeWidth:1.5},"anomaly-"+t)}),e.label&&(0,qn.jsx)("text",{x:(o.width||0)-4,y:Math.min(b,v)-4,textAnchor:"end",fill:m,fontSize:11,children:e.label})]},"ann-"+n)}case"forecast":{const t=o.data||[];if(3>t.length)return null;const r=o.xAccessor||"x",i=o.yAccessor||"y",s=o.scales?.x??o.scales?.time,a=o.scales?.y??o.scales?.value;if(!s||!a)return null;const l=t.map(e=>[e[r],e[i]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>l.length)return null;let c;if("polynomial"===(e.method||"linear")){const t=cn(l,e.order||2).equation;c=e=>t.reduce((t,n,o)=>t+n*Math.pow(e,o),0)}else{const e=l.length;let t=0,n=0,o=0,r=0;for(const[e,i]of l)t+=e,n+=i,o+=e*e,r+=e*i;const i=e*o-t*t;if(1e-12>Math.abs(i))return null;const s=(e*r-t*n)/i,a=(n-s*t)/e;c=e=>a+s*e}const u=l.length,d=l.map(([e,t])=>t-c(e)),h=d.reduce((e,t)=>e+t*t,0),f=Math.sqrt(h/Math.max(u-2,1)),m=l.reduce((e,t)=>e+t[0],0)/u,g=l.reduce((e,t)=>e+(t[0]-m)**2,0),y=e.confidence??.95,p=.99>y?.95>y?.9>y?1:1.645:1.96:2.576,b=e.steps??5,v=l[u-1][0],x=(v-l[0][0])/Math.max(u-1,1),w=[];for(let e=1;b>=e;e++)w.push(v+e*x);const k=[];for(const e of w){const t=c(e),n=f*Math.sqrt(1+1/u+(g>0?(e-m)**2/g:0))*p;k.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const S=`M${k.map(e=>`${s(e.x)},${a(e.yUpper)}`).join(" L")} L${k.slice().reverse().map(e=>`${s(e.x)},${a(e.yLower)}`).join(" L")} Z`,A=k.map(e=>`${s(e.x)},${a(e.yCenter)}`).join(" "),M=`${s(v)},${a(c(v))}`,C=e.strokeColor||"#6366f1";return(0,qn.jsxs)("g",{children:[(0,qn.jsx)("path",{d:S,fill:e.fill||"#6366f1",fillOpacity:e.fillOpacity??.15,stroke:"none"}),(0,qn.jsx)("polyline",{points:`${M} ${A}`,fill:"none",stroke:C,strokeWidth:e.strokeWidth??2,strokeDasharray:e.strokeDasharray??"6,3"}),e.label&&k.length>0&&(0,qn.jsx)("text",{x:s(k[k.length-1].x)+4,y:a(k[k.length-1].yCenter)-4,fill:C,fontSize:11,children:e.label})]},"ann-"+n)}case"widget":{let r,i;if(null!=e.px&&null!=e.py)r=e.px,i=e.py;else{const t=mn(e,n,o);if(!t)return null;r=t.x,i=t.y}if(!gn(r,i,o))return null;const s=e.dx??0,a=e.dy??0,l=e.width??32,c=e.height??32,u=e.content??(0,qn.jsx)("span",{style:{fontSize:18,cursor:"default"},title:e.label||"Info",children:"ℹ️"});return(0,qn.jsx)("foreignObject",{x:r+s-l/2,y:i+a-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:(0,qn.jsx)("div",{...Rn(e,t),style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+n)}case"text":{const t=mn(e,n,o);if(!t)return null;const{x:r,y:i}=t,s=r+(e.dx||0),a=i+(e.dy||0),l=e.color||"var(--semiotic-text, #333)",c=(0,qn.jsx)("text",{x:s,y:a,fill:l,fontSize:e.fontSize||11,opacity:e.opacity,strokeDasharray:e.strokeDasharray,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:e.label});return!0!==e._redundantConnector?Kt.cloneElement(c,{key:"ann-text-"+n}):(0,qn.jsxs)("g",{opacity:e.opacity,strokeDasharray:e.strokeDasharray,children:[(0,qn.jsx)("line",{x1:r,y1:i,x2:s,y2:a,stroke:l,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),Kt.cloneElement(c,{opacity:void 0,strokeDasharray:void 0})]},"ann-text-"+n)}case"category-highlight":{const t=e.category;if(null==t)return null;const r=e=>"function"==typeof e&&"function"==typeof e.bandwidth,i=o.scales?.o,s=o.scales?.x,a=o.scales?.y,l=r(i)?i:r(s)?s:r(a)?a:null;if(!l)return null;const c=l(t+"");if(null==c)return null;const u=l.bandwidth(),d=e.color||"var(--semiotic-primary, #4589ff)",h=e.opacity??.15,f=e.label;return(0,qn.jsxs)("g",(o.projection?"vertical"===o.projection:l===s)?{children:[(0,qn.jsx)("rect",{x:c,y:0,width:u,height:o.height||0,fill:d,fillOpacity:h}),f&&(0,qn.jsx)($n,{x:c+u/2,y:16,textAnchor:"middle",fill:d,fontSize:12,fontWeight:"bold",text:f,background:e.labelBackground??"none"})]}:{children:[(0,qn.jsx)("rect",{x:0,y:c,width:o.width||0,height:u,fill:d,fillOpacity:h}),f&&(0,qn.jsx)($n,{x:12,y:c+u/2,dominantBaseline:"middle",fill:d,fontSize:12,fontWeight:"bold",text:f,background:e.labelBackground??"none"})]},"ann-"+n)}default:return null}var r,i,s}}(0,H),o="horizontal"===s?.projection,r=s?.o?e=>(s.o(e)??0)+s.o.bandwidth()/2:null,i={scales:s?{x:o?s.r:r||s.r,y:o&&r||s.r,time:s.r,value:s.r,o:s.o}:null,timeAxis:"x",xAccessor:P,yAccessor:L,width:t,height:n,data:I,frameType:"ordinal",projection:o?"horizontal":"vertical",stickyPositionCache:V.current};return function(e,t,n,o){const r=[];return e.forEach((e,i)=>{let s;if(n){const r=n(e,i,o);s=null!=r?r:t(e,i,o)}else s=t(e,i,o);s&&r.push({node:s,annotation:e})}),function(e){const t=e.map((e,t)=>{return{p:e,i:t,emphasis:(n=e.annotation,"primary"===n?.emphasis||"secondary"===n?.emphasis?n.emphasis:null),confidence:xn(e.annotation),readingOrder:null,rank:1};var n}),n=t.some(e=>null!=e.emphasis||null!=e.confidence),o=e.some(e=>bn(e.annotation)),r=e.some(e=>null!=vn(e.annotation)),i=e.some(e=>"layer"===vn(e.annotation));if(!n&&!o&&!r)return e.map(e=>e.node);const s=t.filter(e=>null==e.emphasis&&null!=e.confidence).slice().sort((e,t)=>(t.confidence??0)-(e.confidence??0)||e.i-t.i);s.forEach((e,t)=>{e.readingOrder=t,e.rank=2-t/Math.max(1,s.length)});for(const e of t)e.emphasis&&(e.rank=pn[e.emphasis]);const a=t.sort((e,t)=>e.rank-t.rank||e.i-t.i).map(e=>{const{p:t,i:n,emphasis:o,readingOrder:r}=e,i=bn(t.annotation);let s=t.node;if("primary"===o||"secondary"===o||null!=r){const e=null==o&&null!=r;s=(0,yn.jsx)("g",{className:e?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+o,..."secondary"===o?{opacity:.6,fontSize:"0.88em"}:{},...e?{opacity:wn(r),"data-annotation-reading-order":r}:{},children:t.node},"annotation-emphasis-"+n)}const a=vn(t.annotation);return a&&(s=(0,yn.jsx)("g",{className:"annotation-cohesion--"+a,children:s},"annotation-cohesion-"+n)),i&&(s=(0,yn.jsx)("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:s},"annotation-deferred-"+n)),s});return o&&a.unshift((0,yn.jsx)("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&&a.unshift((0,yn.jsx)("style",{children:".annotation-cohesion--layer text,.annotation-cohesion--layer tspan{fill:var(--semiotic-annotation-color,var(--semiotic-text-secondary,#666));font-style:italic}"},"annotation-cohesion-style")),a}(r)}(_?uo({annotations:S,context:i,..."object"==typeof _?_:{}}):S,e,R,i)},[S,_,R,t,n,s,P,L,I,H]);return a||m||g||k||U&&U.length>0||f||B?(0,fo.jsxs)("svg",{role:"img",width:o,height:r,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[(0,fo.jsx)("title",{children:"string"==typeof m?m:"Ordinal Chart"}),(0,fo.jsx)("desc",{children:"string"==typeof m?m+" (ordinal data visualization)":"Ordinal data visualization"}),(0,fo.jsxs)("g",{transform:`translate(${i.left},${i.top})`,children:[f&&s&&!O&&D&&(0,fo.jsx)("g",{className:"ordinal-grid",children:G.map((e,o)=>(0,fo.jsx)("line",{x1:F?e.pixel:0,y1:F?0:e.pixel,x2:F?e.pixel:t,y2:F?n:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+o))}),a&&s&&!O&&(()=>{const e={fontSize:"var(--semiotic-tick-font-size, 12px)"},o={fontSize:"var(--semiotic-axis-label-font-size, 12px)"};return(0,fo.jsx)("g",{className:"ordinal-axes",children:(0,fo.jsxs)(fo.Fragment,F?{children:[(0,fo.jsxs)("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[D&&(0,fo.jsx)("line",{x1:0,y1:0,x2:0,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),W.map((t,n)=>(0,fo.jsxs)("g",{transform:`translate(0,${t.pixel})`,children:[(0,fo.jsx)("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?(0,fo.jsx)("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label}):(0,fo.jsx)("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:(0,fo.jsx)("div",{style:{textAlign:"right",userSelect:"none",...e},children:t.label})})]},"cat-"+n)),c&&(0,fo.jsx)("text",{x:15-i.left,y:n/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-i.left}, ${n/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...o},children:c})]}),(0,fo.jsxs)("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[D&&(0,fo.jsx)("line",{x1:0,y1:n,x2:t,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),D&&s?.r&&(()=>{const e=s.r(0);return e>1&&t-1>e?(0,fo.jsx)("line",{x1:e,y1:0,x2:e,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1,strokeDasharray:"4,4"}):null})(),G.map((t,o)=>{const r=z?0===o?"start":o===G.length-1?"end":"middle":"middle";return(0,fo.jsxs)("g",{transform:`translate(${t.pixel},${n})`,children:[(0,fo.jsx)("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),(0,fo.jsx)("text",{y:18,textAnchor:r,fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label})]},"val-"+o)}),u&&(0,fo.jsx)("text",{x:t/2,y:n+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:{userSelect:"none",...o},children:u})]})]}:{children:[(0,fo.jsxs)("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[D&&(()=>{const e=s?.r?s.r(0):n,o=0>e||e>n?n:e;return(0,fo.jsx)("line",{x1:0,y1:o,x2:t,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),W.map((t,o)=>(0,fo.jsxs)("g",{transform:`translate(${t.pixel},${n})`,children:[(0,fo.jsx)("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?(0,fo.jsx)("text",{y:18,textAnchor:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label}):(0,fo.jsx)("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:(0,fo.jsx)("div",{style:{textAlign:"center",userSelect:"none",...e},children:t.label})})]},"cat-"+o)),c&&(0,fo.jsx)("text",{x:t/2,y:n+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:{userSelect:"none",...o},children:c})]}),(0,fo.jsxs)("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[D&&(0,fo.jsx)("line",{x1:0,y1:0,x2:0,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),G.map((t,n)=>(0,fo.jsxs)("g",{transform:`translate(0,${t.pixel})`,children:[(0,fo.jsx)("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),(0,fo.jsx)("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label})]},"val-"+n)),u&&(0,fo.jsx)("text",{x:15-i.left,y:n/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-i.left}, ${n/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...o},children:u})]})]})})})(),U,k,B]}),m&&"string"==typeof m?(0,fo.jsx)("text",{x:o/2,y:22,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:m}):m?(0,fo.jsx)("foreignObject",{x:0,y:0,width:o,height:i.top,children:m}):null,Ut({legend:g,totalWidth:o,totalHeight:r,margin:i,legendPosition:x,title:m,legendLayout:w,legendHoverBehavior:y,legendClickBehavior:p,legendHighlightedCategory:b,legendIsolatedCategories:v})]}):null}function po(e,t,n,o){return"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:n,fn:e}:"string"==typeof t?{key:t,fn:null}:"function"==typeof t?{key:o,fn:t}:{key:void 0,fn:null}}var bo=g(require("react")),vo=require("react/jsx-runtime"),xo=null,wo=null;function ko(e){const[t,n]=bo.useState(()=>xo);return bo.useEffect(()=>{if(t)return;let e=!1;return(xo?Promise.resolve(xo):(wo||(wo=Promise.resolve().then(()=>(x(),p)).then(e=>xo=e.OrdinalBrushOverlay)),wo)).then(t=>{e||n(()=>t)}),()=>{e=!0}},[t]),t?(0,vo.jsx)(t,{...e}):null}var So=g(require("react")),Ao=require("d3-shape");function Mo(e){return(e.tl??0)>0||(e.tr??0)>0||(e.br??0)>0||(e.bl??0)>0}function Co(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(e??0,n));return{tl:o(t.tl),tr:o(t.tr),br:o(t.br),bl:o(t.bl)}}var jo=(e,t)=>({x:e*Math.cos(t),y:e*Math.sin(t)});function _o(e){const{innerRadius:t,outerRadius:n,startAngle:o,endAngle:r}=e,i=0>=t;if(0>=(e.cornerRadius??0)||!e.roundStart&&!e.roundEnd){if(i){const e=jo(n,o),t=jo(n,r);return`M0,0 L${e.x},${e.y} A${n},${n} 0 ${r-o>Math.PI?1:0} 1 ${t.x},${t.y} Z`}const e=jo(n,o),s=jo(n,r),a=jo(t,r),l=jo(t,o),c=r-o>Math.PI?1:0;return`M${e.x},${e.y} A${n},${n} 0 ${c} 1 ${s.x},${s.y} L${a.x},${a.y} A${t},${t} 0 ${c} 0 ${l.x},${l.y} Z`}const s=Math.max(0,Math.min(e.cornerRadius??0,(n-t)/2));if(0===s)return _o({...e,cornerRadius:0,roundStart:!1,roundEnd:!1});const a=Math.asin(Math.min(1,s/Math.max(1e-9,n-s))),l=i?0:Math.asin(Math.min(1,s/Math.max(1e-9,t+s))),c=r-o,u=e.roundStart&&e.roundEnd?c/2:c,d=!!e.roundStart&&u>a,h=!!e.roundEnd&&u>a;if(!d&&!h)return _o({...e,cornerRadius:0,roundStart:!1,roundEnd:!1});const f=o+(d?a:0),m=r-(h?a:0),g=o+(d?l:0),y=r-(h?l:0),p=jo(n,f),b=jo(n,m),v=(n-s)*Math.cos(a),x=jo(v,o),w=jo(v,r),k=i?null:jo(t,y),S=i?null:jo(t,g),A=i?0:(t+s)*Math.cos(l),M=i?null:jo(A,o),C=i?null:jo(A,r),j=m-f>Math.PI?1:0,_=i?0:y-g>Math.PI?1:0;let R="";if(d)R+=`M${x.x},${x.y}`,R+=` A${s},${s} 0 0 1 ${p.x},${p.y}`;else{const e=jo(n,o);R+=`M${e.x},${e.y}`}if(h)R+=` A${n},${n} 0 ${j} 1 ${b.x},${b.y}`,R+=` A${s},${s} 0 0 1 ${w.x},${w.y}`;else{const e=jo(n,r);R+=` A${n},${n} 0 ${j} 1 ${e.x},${e.y}`}if(i)R+=" L0,0";else{if(h)R+=` L${C.x},${C.y}`,R+=` A${s},${s} 0 0 1 ${k.x},${k.y}`;else{const e=jo(t,r);R+=` L${e.x},${e.y}`}if(d)R+=` A${t},${t} 0 ${_} 0 ${S.x},${S.y}`,R+=` A${s},${s} 0 0 1 ${M.x},${M.y}`;else{const e=jo(t,o);R+=` A${t},${t} 0 ${_} 0 ${e.x},${e.y}`}}return R+=" Z",R}function Ro(e){const t=_o({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 r=0;o.length>r;r++)n.push({d:_o({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle+r*t,endAngle:e.endAngle}),color:o[r]})}return{clipPath:t,slices:n}}var Po=require("react/jsx-runtime"),Lo={innerRadius:0,outerRadius:0,startAngle:0,endAngle:0};function Io(e,t="#4e79a7"){return Fn(e)?e.background&&"transparent"!==e.background?e.background:t:e&&"string"==typeof e?e:t}function To(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}var $o="undefined"==typeof window||"undefined"==typeof document,Bo=require("react"),Ho="undefined"!=typeof window?Bo.useLayoutEffect:Bo.useEffect,Oo=()=>()=>{},Fo=()=>!1,Eo=()=>!0,Do=require("react");function Wo(e,t){const n=Object.keys(e),o=Object.keys(t);if(n.length!==o.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 No(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 zo(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 qo=g(require("react")),Go=g(require("react")),Vo=(require("react/jsx-runtime"),Go.createContext(null)),Xo=require("react/jsx-runtime"),Yo={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function Uo({hoverPoint:e}){let t="";if(e){const n=e.data||e;t="object"==typeof n?"Data point: "+Object.entries(n).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Data point: "+n}return(0,Xo.jsx)("div",{"aria-live":"polite","aria-atomic":"true",style:Yo,children:t})}function Ko(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}function Qo(e){return e&&"object"==typeof e?e:{}}function Zo(e){return Qo(e.accessibility).tableFields??e.accessibleDatum??e.datum}var Jo=require("react/jsx-runtime");function er(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e){if(null===t?.datum)continue;const e=t.type+"";n[e]=(n[e]||0)+1}if(0===Object.keys(n).length)return t+", empty";const o=[],r={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},i=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],s=Object.keys(n).sort((e,t)=>{const n=i.indexOf(e),o=i.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of s)o.push(`${n[e]} ${r[e]||e}`);return`${t}, ${o.join(", ")}`}var tr=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},nr="semiotic-accessible-data-table",or=nr+" semiotic-accessible-data-table-hidden",rr=nr+" semiotic-accessible-data-table-visible",ir={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"},sr={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},ar={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)"},lr={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},cr={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))"},ur={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},dr={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},hr={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 fr({scene:e,chartType:t,tableId:n,chartTitle:o}){const[r,i]=qo.useState(!1),[s,a]=qo.useState(5),l=Go.useContext(Vo),c=l?.visible??!1,u=r||c,d=qo.useRef(null),h=o?"Data summary for "+o:n?`Data summary for ${t} ${n}`:"Data summary for "+t;qo.useEffect(()=>{u||a(5)},[u]);const f=qo.useCallback(e=>{e.target===e.currentTarget&&(r||c||i(!0))},[r,c]),m=qo.useCallback(e=>{c||d.current?.contains(e.relatedTarget)||i(!1)},[c]);if(!e||0===e.length)return n?(0,Jo.jsx)("span",{id:n,tabIndex:-1,style:Yo}):null;if(!u)return(0,Jo.jsx)("div",{id:n,className:or,tabIndex:-1,onFocus:f,style:Yo,role:"region","aria-label":h,children:(0,Jo.jsxs)("button",{type:"button",onClick:()=>i(!0),children:["View data summary (",e.length," elements)"]})});const g=function(e){const t=[];if(!Array.isArray(e))return t;const n=e.some(e=>e&&("line"===e.type||"area"===e.type));for(const o of e)if(o&&"object"==typeof o&&null!==o.datum)try{switch(o.type){case"point":if(n)break;t.push({label:"Point",values:Ko(Zo(o))});break;case"line":case"area":{const e=Zo(o),n=Array.isArray(e)?e:[],r="line"===o.type?"Line point":"Area point";for(const e of n)t.push({label:r,values:Ko(e)});break}case"rect":{const e=Zo(o),n=null!=e&&"object"==typeof e?e:{},r=n.category??o.group??"",i=n.value??n.__aggregateValue??n.total,s=Ko(n);null==s.category&&""!==r&&(s.category=r+""),null==s.value&&null!=i&&(s.value="number"==typeof i||"string"==typeof i?i:i+""),t.push({label:"Bar",values:s});break}case"heatcell":{const e=Ko(Zo(o));null==e.value&&"number"==typeof o.value&&Number.isFinite(o.value)&&(e.value=o.value),t.push({label:"Cell",values:e});break}case"wedge":{const e=Zo(o),n=Ko(e);if(null==n.category){const t=Qo(e),o=t.category??t.label;null!=o&&(n.category=o+"")}t.push({label:"Wedge",values:n});break}case"circle":t.push({label:"Node",values:Ko(Zo(o))});break;case"arc":t.push({label:"Arc",values:Ko(Zo(o))});break;case"candlestick":t.push({label:"Candlestick",values:Ko(Zo(o))});break;case"geoarea":{const e=Qo(Zo(o)),n=Ko(e);if(null==n.name){const t=Qo(e.properties).name??e.name;null!=t&&(n.name=t+"")}t.push({label:"Region",values:n});break}}}catch{}return t}(e),y=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=[],r=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&&r.add(e+""))}if(t.length>0){let e=t[0],r=t[0],i=0;for(const n of t)e>n&&(e=n),n>r&&(r=n),i+=n;n.push({name:o,count:t.length,numeric:!0,min:e,max:r,mean:i/t.length})}else if(r.size>0){const e=Array.from(r);n.push({name:o,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(g),p=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${tr(e.min)} to ${tr(e.max)}, mean ${tr(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(" ")}(g.length,y),b=Math.min(s,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(0,Jo.jsxs)("div",{ref:d,id:n,className:rr,tabIndex:-1,onBlur:m,style:ir,role:"region","aria-label":h,children:[(0,Jo.jsx)("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{c&&l&&l.setVisible(!1),i(!1)},"aria-label":"Close data summary",style:ar,children:"×"}),(0,Jo.jsx)("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:sr,children:p}),(0,Jo.jsxs)("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+t,style:lr,children:[(0,Jo.jsx)("caption",{className:"semiotic-accessible-data-table-caption",style:dr,children:x>0?`First ${b} of ${g.length} data points`:`All ${g.length} data points`}),(0,Jo.jsx)("thead",{children:(0,Jo.jsxs)("tr",{children:[(0,Jo.jsx)("th",{style:cr,children:"type"}),k.map(e=>(0,Jo.jsx)("th",{style:cr,children:e},e))]})}),(0,Jo.jsx)("tbody",{children:v.map((e,t)=>(0,Jo.jsxs)("tr",{children:[(0,Jo.jsx)("td",{style:ur,children:e.label}),k.map(t=>{return(0,Jo.jsx)("td",{style:ur,children:(n=e.values[t],null==n||""===n?"—":"number"==typeof n?Number.isNaN(n)?"—":tr(n):"boolean"==typeof n?n?"true":"false":"object"==typeof n?"—":n+"")},t);var n})]},t))})]}),x>0&&(0,Jo.jsxs)("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>a(e=>e+25),style:hr,children:["Show ",Math.min(25,x)," more"," ",1===x?"row":"rows"," (",x," remaining)"]})]})}function mr({summary:e}){return e?(0,Jo.jsx)("div",{role:"note",style:Yo,children:e}):null}function gr({tableId:e}){return(0,Jo.jsx)("a",{href:"#"+e,style:Yo,onClick:t=>{t.preventDefault();const n=document.getElementById(e);n&&requestAnimationFrame(()=>n.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,Yo)},children:"Skip to data table"})}var yr=require("react/jsx-runtime"),pr="var(--semiotic-focus, #005fcc)";function br({active:e,hoverPoint:t,margin:n,size:o,shape:r="circle",width:i,height:s,pathData:a}){if(!e||!t)return null;const l=t.x+n.left,c=t.y+n.top;let u;if("geoarea"!==r&&"path"!==r||!a)if("rect"===r&&null!=i&&null!=s){const e=Math.max(i,4),t=Math.max(s,4);u=(0,yr.jsx)("rect",{x:l-e/2-3,y:c-t/2-3,width:e+6,height:t+6,rx:3,fill:"none",stroke:pr,strokeWidth:2,strokeDasharray:"4,2"})}else u=(0,yr.jsx)("circle","wedge"===r?{cx:l,cy:c,r:12,fill:"none",stroke:pr,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:pr,strokeWidth:2,strokeDasharray:"4,2"});else u=(0,yr.jsx)("g",{transform:`translate(${n.left},${n.top})`,children:(0,yr.jsx)("path",{d:a,fill:"none",stroke:pr,strokeWidth:2.5,strokeDasharray:"6,3"})});return(0,yr.jsx)("svg",{style:{position:"absolute",left:0,top:0,width:o[0],height:o[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}var vr=g(require("react"));function xr(e){return Array.isArray(e)?e[0]:e}function wr(e,t,n,o){return{data:xr(e),x:t,y:n,__semioticHoverData:!0,...o}}var kr=["name","label","title"],Sr=["type","kind","category","group","class","status","role","shape"],Ar=["value","amount","total","count","weight","score"],Mr=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 Cr(e,t){for(const n of t){const t=e.find(e=>e.lower===n);if(t)return t}}var jr=require("react/jsx-runtime"),_r={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 Rr(e,t){return"function"==typeof t?t(e):e[t]}function Pr(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 Lr(e={}){const{fields:t,title:n,format:o,style:r={},className:i=""}=e;return e=>{if(!e||"object"!=typeof e)return null;let s;const a=[];if(n){const t=Rr(e,n);s=Pr(t,o)}if(t&&t.length>0)t.forEach(t=>{let n,r,i;"string"==typeof t?(n=t,r=t,i=o):(n=t.label,r=t.accessor||t.key||"",i=t.format||o);const s=Rr(e,r);a.push({label:n,value:Pr(s,i)})});else if(!n){const t=["value","y","name","id","label"];for(const n of t)if(void 0!==e[n]){s=Pr(e[n],o);break}if(!s){const t=Object.keys(e).filter(e=>!e.startsWith("_"));t.length>0&&(s=Pr(e[t[0]],o))}}const l={..._r,...r};return(0,jr.jsxs)("div",{className:("semiotic-tooltip "+i).trim(),style:l,children:[s&&(0,jr.jsx)("div",{style:{fontWeight:a.length>0?"bold":"normal"},children:s}),a.map((e,t)=>(0,jr.jsxs)("div",{style:{marginTop:0===t&&s?"4px":0},children:[e.label&&(0,jr.jsxs)("span",{children:[e.label,": "]}),e.value]},t))]})}}function Ir(e){if(!0!==e){if("function"==typeof e){const t=e;return e=>{let n=xr(!0===e?.__semioticHoverData||e&&void 0!==e.data&&"number"==typeof e.x&&"number"==typeof e.y&&e&&("node"===e.type||"edge"===e.type||void 0!==e.nodeOrEdge||void 0!==e.allSeries||void 0!==e.stats||void 0!==e.__chartType)?e.data??{}:e);if(!n)return null;if(("node"===e?.nodeOrEdge&&"number"==typeof n?.x0&&"number"==typeof n?.x1||"edge"===e?.nodeOrEdge&&"number"==typeof n?.sankeyWidth)&&n.data&&"object"==typeof n.data&&(n=n.data),!n)return null;const o=t(n);return null==o?null:(0,jr.jsx)("div",{className:"semiotic-tooltip",style:_r,children:o})}}return!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?Lr(e):Lr())}}var Tr=require("react/jsx-runtime");function $r({x:e,y:t,containerWidth:n,containerHeight:o,margin:r,children:i,className:s="stream-frame-tooltip",zIndex:a=1}){const l=Number.isFinite(e)&&Number.isFinite(t),c=vr.useRef(null),[u,d]=vr.useState(null);vr.useLayoutEffect(()=>{const e=c.current;if(!e)return;const t=()=>{const t=e.getBoundingClientRect();Number.isFinite(t.width)&&Number.isFinite(t.height)&&d(e=>e&&.5>Math.abs(e.width-t.width)&&.5>Math.abs(e.height-t.height)?e:{width:t.width,height:t.height})};if(t(),"undefined"==typeof ResizeObserver)return;const n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[s,n,o,l]);let h;h=u?`translate(${u.width+12>n-e?"calc(-100% - 12px)":"12px"}, ${u.height+12>o-t?"calc(-100% - 4px)":"4px"})`:`translate(${e>.7*n?"calc(-100% - 12px)":"12px"}, ${.3*o>t?"4px":"calc(-100% - 4px)"})`;const f=function(e){if(!vr.isValidElement(e))return!1;const t=e.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;const n=e.props;if(!0===n["data-semiotic-tooltip-chrome"])return!0;if("true"===n["data-semiotic-tooltip-chrome"])return!0;const o=n.style;if(o&&"object"==typeof o){if(null!=o.background&&""!==o.background&&"transparent"!==o.background)return!0;if(null!=o.backgroundColor&&""!==o.backgroundColor&&"transparent"!==o.backgroundColor)return!0}return!1}(i),m=f?null:_r;return l?(0,Tr.jsx)("div",{ref:c,className:f?s:(s+" semiotic-tooltip").trim(),style:{...m||{},position:"absolute",left:r.left+e,top:r.top+t,transform:h,pointerEvents:"none",zIndex:a,width:"max-content"},children:i}):null}var Br=g(require("react")),Hr=require("react");function Or(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 Fr(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t={...t,colors:{...t.colors,categorical:Er}}),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 Er=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],Dr={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}},Wr={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}},Nr={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:Er,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 zr(e,t){if("light"===t)return Dr;if("dark"===t)return Wr;if("high-contrast"===t)return Nr;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?Wr:Dr;return Fr({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}return Fr({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}var[qr,Gr]=Mn(e=>({theme:Dr,setTheme(t){e(e=>({theme:zr(e.theme,t)}))}})),Vr=require("react");var Xr=require("react"),Yr=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,Ur=new WeakMap,Kr=0,Qr=!1,Zr=null,Jr=null;function ei(e,t){if(!t)return t;const n=Yr.exec(t);if(!n)return t;const o=e.canvas;if(!o)return n[2]?.trim()||t;!function(){if(Qr)return;if("undefined"==typeof window||"undefined"==typeof document)return;Qr=!0;const e=()=>{Kr++};if("undefined"!=typeof MutationObserver&&document.documentElement&&new MutationObserver(e).observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]}),"function"==typeof window.matchMedia)try{Zr=window.matchMedia("(prefers-color-scheme: dark)"),Jr=e,"function"==typeof Zr.addEventListener?Zr.addEventListener("change",Jr):"function"==typeof Zr.addListener&&Zr.addListener(Jr)}catch{}}();let r=Ur.get(o);r&&r.version===Kr||(r={version:Kr,map:new Map},Ur.set(o,r));const i=r.map.get(t);if(void 0!==i)return i;const s=getComputedStyle(o).getPropertyValue(n[1]).trim()||n[2]?.trim()||t;return r.map.set(t,s),s}var ti=()=>"undefined"!=typeof performance?performance.now():Date.now();function ni(e,t){const n=e();return Number.isFinite(n)?n:t}var oi=class{constructor(e={}){this.randomSource=Math.random,this.subscribers=new Set,this.now=()=>this.advance(),this.random=()=>this.randomSource(),this.clock=e.clock??ti,this.lastWallTime=ni(this.clock,0),this.logicalTime=this.lastWallTime,this.pausedValue=!0===e.paused,this.visibleValue=!1!==e.visible,this.setRandomSource(e.random,e.seed)}get isActive(){return!this.pausedValue&&this.visibleValue}get paused(){return this.pausedValue}get seed(){return this.seedValue}get visible(){return this.visibleValue}configure(e){this.setClock(e.clock),this.setRandomSource(e.random,e.seed)}setPaused(e){this.pausedValue!==e&&(this.advance(),this.pausedValue=e,this.emit())}setVisible(e){this.visibleValue!==e&&(this.advance(),this.visibleValue=e,this.emit())}snapshot(){return{now:this.now(),paused:this.pausedValue,seed:this.seedValue,visible:this.visibleValue}}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}advance(){const e=ni(this.clock,this.lastWallTime),t=Math.max(0,e-this.lastWallTime);return this.lastWallTime=e,this.isActive&&(this.logicalTime+=t),this.logicalTime}emit(){for(const e of this.subscribers)e()}setClock(e){const t=e??ti;t!==this.clock&&(this.advance(),this.clock=t,this.lastWallTime=ni(t,this.lastWallTime))}setRandomSource(e,t){const n=function(e){return"number"==typeof e&&Number.isFinite(e)?Math.trunc(e):void 0}(t);e===this.randomInput&&n===this.seedValue||(this.randomInput=e,this.seedValue=n,this.randomSource=e??(void 0===n?Math.random:function(e){let t=e>>>0;return()=>{t+=1831565813;let e=t;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}}(n)))}},ri="undefined"==typeof window?Hr.useEffect:Hr.useLayoutEffect,ii={requestAnimationFrame:e=>("undefined"==typeof window?globalThis:window).requestAnimationFrame(e),cancelAnimationFrame:e=>("undefined"==typeof window?globalThis:window).cancelAnimationFrame(e)};function si(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function ai(e){const t=function(){const[e,t]=(0,Vr.useState)(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return(0,Vr.useEffect)(()=>{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=(0,Hr.useRef)(t);n.current=t;const[o,r]=function(e,t,n){const o=(0,Xr.useRef)(null),[r,i]=(0,Xr.useState)(null);return(0,Xr.useEffect)(()=>{if(!t&&!n)return;const e=o.current;if(!e)return;const r=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;i(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return r.observe(e),()=>r.disconnect()},[t,n]),[o,[t&&r?r.w:e[0],n&&r?r.h:e[1]]]}(e.sizeProp,e.responsiveWidth,e.responsiveHeight),i=!!e.title,s=!!e.legend&&"top"===e.legendPosition,a=(0,Hr.useMemo)(()=>function(e,t,n=!1){const o=n?t?58:34:t?36:0;return o>e.top?{...e,top:o}:e}({...e.marginDefault,...e.userMargin},i,s),[e.marginDefault,e.userMargin,i,s]),l=r[0]-a.left-a.right,c=r[1]-a.top-a.bottom,u=si(e.foregroundGraphics,r,a),d=si(e.backgroundGraphics,r,a),h=Gr(e=>e.theme),{transition:f,introEnabled:m}=function(e,t){if(!1===e)return{transition:void 0,introEnabled:!1};const n="undefined"!=typeof window&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;return{transition:e?!0===e?{duration:300}:{duration:e.duration??300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(n||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),g="semiotic-table-"+Br.useId(),y=(0,Hr.useRef)(null);if(!y.current){const t=!e.suspendWhenHidden||"undefined"==typeof document||!document.hidden;y.current=new oi({clock:e.clock,random:e.random,seed:e.seed,paused:e.paused,visible:t})}const p=y.current;p.configure({clock:e.clock,random:e.random,seed:e.seed});const b=(0,Hr.useRef)(null),v=(0,Hr.useRef)(e.frameScheduler??ii);v.current=e.frameScheduler??ii;const x=(0,Hr.useRef)(null),w=(0,Hr.useRef)(!1),k=(0,Hr.useRef)(()=>{}),S=(0,Hr.useCallback)(()=>{if(null!==b.current||w.current)return;const e=v.current;let t=!1,n=!1;const o=e.requestAnimationFrame(()=>{t=!0;const e=!n;e&&(w.current=!0),b.current=null,x.current=null;try{k.current()}finally{e&&(w.current=!1)}});n=!0,t||(b.current=o,x.current=e)},[]),A=(0,Hr.useCallback)(()=>{null!==b.current&&((x.current??v.current).cancelAnimationFrame(b.current),b.current=null,x.current=null)},[]);ri(()=>{p.setPaused(!0===e.paused)},[p,e.paused]),(0,Hr.useEffect)(()=>{if(!e.suspendWhenHidden||"undefined"==typeof document)return void p.setVisible(!0);const t=()=>p.setVisible(!document.hidden);return t(),document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},[p,e.suspendWhenHidden]),(0,Hr.useEffect)(()=>()=>{A()},[A]);const M=(0,Hr.useRef)(()=>{}),C=(0,Hr.useRef)(()=>{}),j=(0,Hr.useRef)(null),_=(0,Hr.useRef)(null),R=(0,Hr.useRef)(null),P=(0,Hr.useCallback)(()=>{const e=j.current;j.current=null,e&&M.current(e)},[]),L=(0,Hr.useCallback)(e=>{if(j.current={clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType},null===_.current){const e=v.current;let t=!1;const n=e.requestAnimationFrame(()=>{t=!0,_.current=null,R.current=null,P()});t||(_.current=n,R.current=e)}},[P]),I=(0,Hr.useCallback)(()=>{j.current=null,null!==_.current&&((R.current??v.current).cancelAnimationFrame(_.current),_.current=null,R.current=null),C.current()},[]);(0,Hr.useEffect)(()=>()=>{j.current=null,null!==_.current&&((R.current??v.current).cancelAnimationFrame(_.current),_.current=null,R.current=null)},[]);const T=e.themeDirtyRef;return ri(()=>{T&&(Kr++,T.current=!0,S())},[h,S,T]),{reducedMotion:t,reducedMotionRef:n,responsiveRef:o,size:r,margin:a,adjustedWidth:l,adjustedHeight:c,resolvedForeground:u,resolvedBackground:d,currentTheme:h,transition:f,introEnabled:m,tableId:g,frameRuntime:p,rafRef:b,renderFnRef:k,scheduleRender:S,cancelRender:A,hoverHandlerRef:M,hoverLeaveRef:C,onPointerMove:L,onPointerLeave:I}}var li=require("react"),ci=require("react/jsx-runtime");function ui({children:e,size:t,margin:n,overflowVisible:o=!1}){return e?(0,ci.jsx)("svg",{style:{position:"absolute",left:0,top:0,width:t[0],height:t[1],pointerEvents:"none",overflow:o?"visible":void 0},children:(0,ci.jsx)("g",{transform:`translate(${n.left},${n.top})`,children:e})}):null}var di=require("react");function hi(e,t,n,o){return"function"==typeof e?e({size:t,margin:n,scales:o}):e}function fi(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function mi(e,t,n=.3){fi(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 gi(e,t,n=.6){if(!fi(t))return;const o=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,o,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 yi(e,t,n,o=.35){fi(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",n?e.fill(n):e.fill())}function pi(e,t){const n=e.fillStyle,o="#010203";try{e.fillStyle=o,e.fillStyle=t}catch{return e.fillStyle=n,[78,121,167]}const r=e.fillStyle;if(e.fillStyle=n,"string"!=typeof r)return[78,121,167];if(r.toLowerCase()===o&&t.trim().toLowerCase()!==o)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]}function bi(e,t,n){if(null==t)return n;if(Fn(t)){const o=function(e,t){const n="undefined"!=typeof window&&window.devicePixelRatio||1,o=`${En(e)}@${n}`,r=Wn.get(o);if(void 0!==r)return r;const i=Hn({background:e.background,stroke:e.stroke,lineWidth:e.lineWidth,spacing:e.spacing,angle:e.angle},t);return Wn.set(o,i),i}(t,e);return o||t.background&&ei(e,t.background)||n}return"string"!=typeof t?t:ei(e,t)||n}function vi(e,t){if(null==t)return;const n=bi(e,t,"");return""===n?void 0:n}function xi(e,t,n,o,r,i,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,r,i,s);for(const e of n)a.addColorStop(e.offset,e.color);return a}const{topOpacity:a,bottomOpacity:l}=t;if(!Number.isFinite(a)||!Number.isFinite(l))return null;const c=Math.max(0,Math.min(1,a)),u=Math.max(0,Math.min(1,l)),d=e.createLinearGradient(o,r,i,s),[h,f,m]=pi(e,n);return d.addColorStop(0,`rgba(${h},${f},${m},${c})`),d.addColorStop(1,`rgba(${h},${f},${m},${u})`),d}function wi(e,t){const{x:n,y:o,w:r,h:i}=t,{tl:s,tr:a,br:l,bl:c}=Co(t);e.beginPath(),e.moveTo(n+s,o),e.lineTo(n+r-a,o),a>0&&e.arcTo(n+r,o,n+r,o+a,a),e.lineTo(n+r,o+i-l),l>0&&e.arcTo(n+r,o+i,n+r-l,o+i,l),e.lineTo(n+c,o+i),c>0&&e.arcTo(n,o+i,n,o+i-c,c),e.lineTo(n,o+s),s>0&&e.arcTo(n,o,n+s,o,s),e.closePath()}function ki(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}}}function Si(e,t){const n=t.style.icon,o=t.style.iconPadding||2,r=Math.min(t.w,t.h)-o;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+o,s=t.x+(t.w-r)/2;for(let o=t.y+t.h-r;o>=t.y-r;o-=i)e.drawImage(n,s,o,r,r)}else{const i=r+o,s=t.y+(t.h-r)/2;for(let o=t.x;t.x+t.w>o;o+=i)e.drawImage(n,o,s,r,r)}e.restore()}require("d3-shape");var Ai=new Map;function Mi(e){try{if(e.path)return new Path2D(e.path);const t=`${e.symbolType??"circle"}:${Math.round(e.size)}`;let n=Ai.get(t);return n||(n=new Path2D(me(e.symbolType,e.size)),Ai.size>256&&Ai.clear(),Ai.set(t,n)),n}catch{return null}}function Ci(e,t,n,o,r){if(0>=t.size)return;const i=t.glyph;if(!i||!i.parts?.length)return;const s=yt(i,t.size);if(0>=s.scale)return;const a=(t.style.opacity??1)*(t._decayOpacity??1);if(0>=a)return;const l=t=>{const n=bi(e,t,t);return"string"==typeof n?n:t},c=t.color??("string"==typeof t.style.fill?t.style.fill:void 0);e.save(),e.translate(n,o),t.rotation&&e.rotate(t.rotation),e.translate(s.offsetX,s.offsetY),e.scale(s.scale,s.scale),e.globalAlpha=r*a*(t.style.fillOpacity??1);const u=wt(i,t.fraction??1,t.fractionStart??0,t.fractionDirection??"horizontal");u&&t.ghostColor&&St(e,i,c,t.accent,t.ghostColor,l),u&&(e.beginPath(),e.rect(u.x,u.y,u.width,u.height),e.clip()),St(e,i,c,t.accent,void 0,l),e.restore()}var ji=require("d3-shape");function _i(e,t){const n=t._gradientBand.colors;if(0===n.length)return;const{clipPath:o,slices:r}=Ro({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:n}),i=new Path2D(o);e.save(),e.translate(t.cx,t.cy),e.clip(i);for(const t of r)e.fillStyle=ei(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=ei(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(i),e.restore())}function Ri(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 Pi(e,t){const n={innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle+Math.PI/2,endAngle:t.endAngle+Math.PI/2},o=(0,ji.arc)().cornerRadius(t.cornerRadius)(n);if(!o)return;e.save(),e.translate(t.cx,t.cy);const r=new Path2D(o);e.fill(r),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(r),e.restore()}var Li=(e,t,n,o)=>{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)_i(e,t),t._pulseIntensity&&t._pulseIntensity>0&&(Ri(e,t),yi(e,t)),e.globalAlpha=1;else{if(e.fillStyle=bi(e,t.style.fill,"#007bff"),t.roundedEnds){t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=ei(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1);const n=_o({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=ei(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1),Pi(e,t)):(Ri(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=ei(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()));t._pulseIntensity&&t._pulseIntensity>0&&(Ri(e,t),yi(e,t)),e.globalAlpha=1}},Ii=(e,t,n,o)=>{const r=t.filter(e=>"boxplot"===e.type);for(const t of r){const n=t.columnWidth/2,o="vertical"===t.projection,r=ei(e,"var(--semiotic-primary, #007bff)"),i=ei(e,"var(--semiotic-text, #333)"),s=bi(e,t.style.fill,r),a=t.style.stroke,l="string"==typeof a?ei(e,a)||a:i,c=t.style.strokeWidth||1,u=t.style.fillOpacity??t.style.opacity??.6;if(e.save(),e.strokeStyle=l,e.lineWidth=c,e.beginPath(),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=u,e.fillStyle=s,o){const o=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-n,o,t.columnWidth,r),e.globalAlpha=1,e.strokeRect(t.x-n,o,t.columnWidth,r)}else{const o=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(o,t.y-n,r,t.columnWidth),e.globalAlpha=1,e.strokeRect(o,t.y-n,r,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()}},Ti=(e,t,n,o)=>{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 n=new Path2D(t.pathString);if(e.globalAlpha=t.style.fillOpacity??t.style.opacity??.6,e.fillStyle=bi(e,t.style.fill,"#007bff"),e.fill(n),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=ei(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()}},$i=(e,t,n,o)=>{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 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=n.fillOpacity??n.opacity??.3,e.fillStyle=vi(e,n.fill)??"#999",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=ei(e,n.style.stroke)||bi(e,n.style.fill,"")||ei(e,"var(--semiotic-border, #999)"),e.lineWidth=n.style.strokeWidth||1,e.globalAlpha=n.style.opacity??.5,e.stroke(),e.globalAlpha=1}},Bi=(e,t,n,o)=>{const r=t.filter(e=>"trapezoid"===e.type);for(const t of r){const n=t.points;if(n.length>=4){e.globalAlpha=t.style?.opacity??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=vi(e,t.style?.fill)||"#999",e.fill(),t.style?.stroke&&(e.strokeStyle=ei(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}};function Hi(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 Oi(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}var Fi=new Map;function Ei(e,t){const n=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,o=Fi.get(n);if(void 0!==o)return o;const r=Hn({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return Fi.set(n,r),r}function Di(e,t,n,o,r,i){e.moveTo(t+i,n),e.lineTo(t+o-i,n),e.quadraticCurveTo(t+o,n,t+o,n+i),e.lineTo(t+o,n+r-i),e.quadraticCurveTo(t+o,n+r,t+o-i,n+r),e.lineTo(t+i,n+r),e.quadraticCurveTo(t,n+r,t,n+r-i),e.lineTo(t,n+i),e.quadraticCurveTo(t,n,t+i,n),e.closePath()}function Wi(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 Ni(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}function zi(e){return"rect"===e.type||"point"===e.type||"symbol"===e.type||"glyph"===e.type}function qi(e){return(t,n,o,r)=>{e(t,n.filter(zi),{x:o.r,y:o.r},r)}}var Gi=qi((e,t,n,o)=>{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)Si(e,t);else if(t.cornerRadii&&Mo(t.cornerRadii)){const n=bi(e,t.style.fill,ei(e,"var(--semiotic-primary, #007bff)")),o=ki(t),r=t.fillGradient&&"string"==typeof n?xi(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=r||n,wi(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=ei(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else if(t.roundedTop&&t.roundedTop>0){const n=bi(e,t.style.fill,ei(e,"var(--semiotic-primary, #007bff)")),o=ki(t),r=t.fillGradient&&"string"==typeof n?xi(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=r||n;const i=Math.min(t.roundedTop,t.w/2,t.h/2);e.beginPath();const{x:s,y:a,w:l,h:c}=t;switch(t.roundedEdge){case"right":e.moveTo(s,a),e.lineTo(s+l-i,a),e.arcTo(s+l,a,s+l,a+i,i),e.lineTo(s+l,a+c-i),e.arcTo(s+l,a+c,s+l-i,a+c,i),e.lineTo(s,a+c);break;case"left":e.moveTo(s+l,a),e.lineTo(s+i,a),e.arcTo(s,a,s,a+i,i),e.lineTo(s,a+c-i),e.arcTo(s,a+c,s+i,a+c,i),e.lineTo(s+l,a+c);break;case"bottom":e.moveTo(s,a),e.lineTo(s+l,a),e.lineTo(s+l,a+c-i),e.arcTo(s+l,a+c,s+l-i,a+c,i),e.lineTo(s+i,a+c),e.arcTo(s,a+c,s,a+c-i,i);break;default:e.moveTo(s,a+c),e.lineTo(s,a+i),e.arcTo(s,a,s+i,a,i),e.lineTo(s+l-i,a),e.arcTo(s+l,a,s+l,a+i,i),e.lineTo(s+l,a+c)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=ei(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const n=bi(e,t.style.fill,ei(e,"var(--semiotic-primary, #007bff)")),o=ki(t),r=t.fillGradient&&"string"==typeof n?xi(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=r||n,e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=ei(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}mi(e,t),e.globalAlpha=1}}),Vi=qi((e,t,n,o)=>{const r=t.filter(e=>"point"===e.type);if(0!==r.length){e.save();try{const t=e.globalAlpha;for(const n of r)e.beginPath(),e.arc(n.x,n.y,n.r,0,2*Math.PI),e.globalAlpha=t*(n.style.opacity??n.style.fillOpacity??1),e.fillStyle=bi(e,n.style.fill,"#4e79a7"),e.fill(),n.style.stroke&&(e.strokeStyle=bi(e,n.style.stroke,n.style.stroke),e.lineWidth=n.style.strokeWidth||1,e.stroke()),gi(e,n)}finally{e.restore()}}}),Xi=qi((e,t)=>{const n=e.globalAlpha;for(const o of t){if("symbol"!==o.type)continue;const t=o;if(0>=t.size)continue;const r=Mi(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=n*i*(t.style.fillOpacity??1),e.fillStyle=bi(e,t.style.fill,"#4e79a7"),e.fill(r)),t.style.stroke&&"none"!==t.style.stroke&&(e.globalAlpha=n*i,e.strokeStyle=bi(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth??1,e.stroke(r)),e.restore()}e.globalAlpha=n}),Yi=qi((e,t)=>{const n=e.globalAlpha;for(const o of t)"glyph"===o.type&&Ci(e,o,o.x,o.y,n);e.globalAlpha=n}),Ui=e=>[$i,...e],Ki={bar:Ui([Gi]),clusterbar:Ui([Gi]),point:Ui([Vi,Xi]),swarm:Ui([Vi,Xi]),pie:[Li],donut:[Li],boxplot:Ui([Ii,Vi]),violin:Ui([Ti]),histogram:Ui([Gi]),ridgeline:Ui([Ti]),timeline:Ui([Gi]),funnel:[Gi,Bi,(e,t,n,o)=>{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 n=t.datum;if(!n)continue;if(!n.__funnelStepLabel)continue;const o=n.__funnelStepLabel;if(e.measureText(o).width+16>(n.__funnelRowWidth??n.__funnelBarW??0))continue;const r=n.__funnelStepLabelX,i=n.__funnelStepLabelY+3;e.strokeStyle="rgba(0,0,0,0.6)",e.lineWidth=3,e.strokeText(o,r,i),e.fillStyle="#fff",e.fillText(o,r,i)}e.font="bold 13px sans-serif";for(const t of r){const n=t.datum;if(!n)continue;if(null==n.__funnelValueLabelX)continue;const o=n.__funnelBarW??0;if(60>o)continue;const r=n.__funnelValue;if(null==r||0===r)continue;const i=n.__funnelPercent,s=!0===n.__funnelIsFirstStep;let a;if(a=s?Hi(r):null!=i?`${Hi(r)} (${Oi(i)})`:Hi(r),e.measureText(a).width+16>o){if(s||null==i)continue;if(a=Hi(r),e.measureText(a).width+16>o)continue}const l=n.__funnelValueLabelX,c=(n.__funnelValueLabelY??t.y)+14+5;e.textAlign="center",e.strokeStyle="rgba(0,0,0,0.5)",e.lineWidth=3,e.strokeText(a,l,c),e.fillStyle="#fff",e.fillText(a,l,c)}e.lineWidth=1,e.lineJoin="miter"}}],"bar-funnel":[Gi,(e,t,n,o)=>{const r=t.filter(e=>"rect"===e.type&&!0===e.datum?.__barFunnelIsDropoff);for(const t of r){const n=("string"==typeof t.style.fill?t.style.fill:null)||ei(e,"var(--semiotic-border, #999)"),o=Ei(n,e);e.globalAlpha=t.style.opacity??1,e.beginPath(),e.rect(t.x,t.y,t.w,t.h),o?e.fillStyle=o:(e.fillStyle=n,e.globalAlpha=.4*(t.style.opacity??1)),e.fill(),e.globalAlpha=1}},(e,t,n,o)=>{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[n,o,r]=pi(e,t);return(.2126*n+.7152*o+.0722*r)/255>.6}(e,ei(e,"var(--semiotic-text, #333)")),s=i?"#1f2937":"#ffffff",a=i?"rgba(255,255,255,0.18)":"rgba(0,0,0,0.12)",l=i?"#f3f4f6":"#1a1a1a",c=l;for(const t of r){const n=t.datum;if(!n)continue;const o=n.__barFunnelValue;if(null==o)continue;if(25>t.w)continue;const r=n.__barFunnelPercent,i=!(!0===n.__barFunnelIsFirstStep)&&null!=r,u=i?Ni(r):"",d=Wi(o);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,y=n.__barFunnelLabelX,p=y-m/2,b=n.__barFunnelLabelY-g-4;e.save(),e.shadowColor="rgba(0,0,0,0.15)",e.shadowBlur=4,e.shadowOffsetY=1,e.fillStyle=s,e.beginPath(),Di(e,p,b,m,g,4),e.fill(),e.restore(),e.strokeStyle=a,e.lineWidth=.5,e.beginPath(),Di(e,p,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,y,b+3),e.font="11px sans-serif",e.fillStyle=c,e.fillText(d,y,b+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle=l,e.fillText(d,y,b+3))}e.lineWidth=1}],swimlane:Ui([Gi]),custom:Ui([Gi,Vi,Xi,Yi,Li,Ii,Ti,Bi])},Qi=new Set;function Zi(e,t){const n="function"==typeof e?e(t.datum??null,t):e;return(o=n)&&"object"==typeof o&&"string"==typeof o.id&&"function"==typeof o.cacheKey&&"function"==typeof o.drawCanvas&&"function"==typeof o.renderStaticSVG?n:void 0;var o}function Ji(e,t){if("undefined"!=typeof process&&"production"===process.env?.NODE_ENV)return;const n=`${e}:${t}`;Qi.has(n)||(Qi.add(n),console.warn(`[Semiotic] Render backend "${e}" does not support scene node "${t}"; using the built-in renderer.`))}var es=require("react/jsx-runtime");function ts(e){const t=function(e,t={}){if(!e||"object"!=typeof e)return{entries:[]};const n=t.maxEntries??6,o=!1!==t.skipPositional,r=[];for(const[t,n]of Object.entries(e)){if(t.startsWith("_"))continue;if("data"===t)continue;if(o&&Mr.has(t.toLowerCase()))continue;if(null==n)continue;const e=typeof n;("string"===e||"number"===e||"boolean"===e||n instanceof Date)&&r.push({key:t,lower:t.toLowerCase(),value:n})}if(0===r.length)return{entries:[]};let i=r.findIndex(e=>kr.includes(e.lower));const s=i>=0;0>i&&(i=r.findIndex(e=>"id"===e.lower)),0>i&&(i=r.findIndex(e=>"string"==typeof e.value));const a=0>i?void 0:r[i];let l=r.filter((e,t)=>t!==i);s&&(l=l.filter(e=>"id"!==e.lower));const c=Cr(l,Sr),u=Cr(l,Ar),d=new Set(Sr),h=new Set(Ar),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>=n)break;e!==c&&e!==u&&(d.has(e.lower)||h.has(e.lower)||f.push({key:e.key,value:e.value}))}return{titleKey:a?.key,title:a?.value,entries:f}}(e,{skipPositional:!1});return null==t.title&&0===t.entries.length?null:(0,es.jsxs)("div",{className:"semiotic-tooltip",style:_r,children:[null!=t.title&&(0,es.jsx)("div",{style:{fontWeight:"bold"},children:t.title+""}),t.entries.map(e=>(0,es.jsxs)("div",{children:[(0,es.jsxs)("span",{style:{opacity:.7},children:[e.key,":"]})," ","number"==typeof e.value?e.value.toLocaleString():e.value+""]},e.key))]})}function ns({hover:e}){const t=e.data||{},n=e.stats,o=e.category;if(Array.isArray(t)){const e=o||t[0]?.category||"";if(n)return(0,es.jsxs)("div",{className:"semiotic-tooltip",style:_r,children:[e&&(0,es.jsx)("div",{style:{fontWeight:"bold"},children:e+""}),(0,es.jsxs)("div",{children:["n = ",n.n]}),(0,es.jsxs)("div",{children:["Min: ",n.min.toLocaleString()]}),(0,es.jsxs)("div",{children:["Q1: ",n.q1.toLocaleString()]}),(0,es.jsxs)("div",{children:["Median: ",n.median.toLocaleString()]}),(0,es.jsxs)("div",{children:["Q3: ",n.q3.toLocaleString()]}),(0,es.jsxs)("div",{children:["Max: ",n.max.toLocaleString()]}),(0,es.jsxs)("div",{style:{opacity:.8},children:["Mean: ",n.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});const r=t.length;return(0,es.jsxs)("div",{className:"semiotic-tooltip",style:_r,children:[e&&(0,es.jsx)("div",{style:{fontWeight:"bold"},children:e+""}),(0,es.jsxs)("div",{children:[r," items"]})]})}if(null!=t.bin&&null!=t.count){const e=t.range||[];return(0,es.jsxs)("div",{className:"semiotic-tooltip",style:_r,children:[t.category&&(0,es.jsx)("div",{style:{fontWeight:"bold"},children:t.category+""}),(0,es.jsxs)("div",{children:["Count: ",t.count]}),2===e.length&&(0,es.jsxs)("div",{style:{opacity:.8},children:[Number(e[0]).toFixed(1)," – ",Number(e[1]).toFixed(1)]})]})}const r=e.__oAccessor,i=e.__rAccessor,s=e.__chartType;if("swarm"===s||"point"===s)return ts(t);const a=(r&&null!=t[r]?t[r]:null)||t.category||t.name||t.group||t.__rName||"",l=t.__aggregateValue??(i&&null!=t[i]?t[i]:null)??t.value??t.__rValue??t.pct??"";return a||""!==l?(0,es.jsxs)("div",{className:"semiotic-tooltip",style:_r,children:[a&&(0,es.jsx)("div",{style:{fontWeight:"bold"},children:a+""}),""!==l&&(0,es.jsx)("div",{children:"number"==typeof l?l.toLocaleString():l+""})]}):ts(t)}function os(e){const{onObservation:t,datum:n,x:o=0,y:r=0,chartType:i,chartId:s,context:a,timestamp:l=Date.now()}=e;t&&(n?(t({type:"hover",datum:n,x:o,y:r,timestamp:l,chartType:i,chartId:s}),"focus"===a?.type&&t({type:"focus",datum:n,inputType:"touch"===a.inputType?"pointer":a.inputType,timestamp:l,chartType:i,chartId:s})):t({type:"hover-end",timestamp:l,chartType:i,chartId:s}))}function rs(e){const{onObservation:t,datum:n,x:o=0,y:r=0,chartType:i,chartId:s,context:a,timestamp:l=Date.now()}=e;t&&(n?(t({type:"click",datum:n,x:o,y:r,timestamp:l,chartType:i,chartId:s}),"activate"===a?.type&&t({type:"activate",datum:n,inputType:a.inputType,timestamp:l,chartType:i,chartId:s})):t({type:"click-end",timestamp:l,chartType:i,chartId:s}))}ns.ownsChrome=!0;var is=require("react"),ss=require("react");function as(e,t,n){const o=e.byGroup.get(t);let r=0,i=Math.abs(o[0].x-n.x);for(let e=1;o.length>e;e++){const t=Math.abs(o[e].x-n.x);i>t&&(i=t,r=e)}return o[r]._flatIndex}function ls(e){const t=[];for(const n of e)if("rect"===n.type&&null!=n.x){if(null==n.datum)continue;t.push({x:n.x+n.w/2,y:n.y+n.h/2,datum:n.datum,shape:"rect",w:n.w,h:n.h,group:n.group??n.datum?.category??""})}else if("point"===n.type)t.push({x:n.x,y:n.y,datum:n.datum,shape:"circle",group:"_default"});else if("symbol"===n.type){if(0>=n.size)continue;t.push({x:n.x,y:n.y,datum:n.datum,shape:"circle",group:"_default"})}else if("glyph"===n.type){if(0>=n.size||null==n.datum)continue;const e=kt(n.glyph,n.size);t.push({x:n.x+e.centerDx,y:n.y+e.centerDy,datum:n.datum,shape:"rect",w:2*e.halfWidth,h:2*e.halfHeight,group:"_default"})}else if("wedge"===n.type&&null!=n.cx){if(null===n.datum)continue;const e=((n.startAngle||0)+(n.endAngle||0))/2,o=((n.innerRadius||0)+(n.outerRadius||50))/2;t.push({x:n.cx+Math.cos(e)*o,y:n.cy+Math.sin(e)*o,datum:n.datum,shape:"wedge",group:"_default"})}return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}function cs(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}var us=require("react/jsx-runtime"),ds={top:50,right:40,bottom:60,left:70},hs=(0,k.memo)((0,k.forwardRef)(function(e,t){const{chartType:n,runtimeMode:o,data:r,oAccessor:i="category",rAccessor:s="value",colorAccessor:a,symbolAccessor:l,symbolMap:c,stackBy:u,groupBy:d,multiAxis:h,timeAccessor:f,valueAccessor:m,categoryAccessor:g,accessorRevision:y,projection:p="vertical",size:b=[600,400],responsiveWidth:v,responsiveHeight:x,margin:w,barPadding:S,roundedTop:C,gradientFill:j,trackFill:_,baselinePadding:R,innerRadius:P,cornerRadius:L,normalize:I,startAngle:T,sweepAngle:$,dynamicColumnWidth:B,bins:H,showOutliers:O,showIQR:F,amplitude:E,connectorOpacity:D,showLabels:W,connectorAccessor:N,connectorStyle:z,dataIdAccessor:q,rExtent:G,oExtent:V,extentPadding:X=.05,oSort:Y,windowMode:U="sliding",windowSize:K=200,pieceStyle:Q,summaryStyle:Z,renderMode:J,colorScheme:ee,barColors:te,showAxes:ne=!0,showCategoryTicks:oe,categoryLabel:re,valueLabel:ie,categoryFormat:se,valueFormat:ae,oLabel:le,rLabel:ce,oFormat:ue,rFormat:de,rTickValues:he,tickLabelEdgeAlign:fe,axisExtent:ge,enableHover:ye=!0,hoverAnnotation:pe,tooltipContent:be,customHoverBehavior:ve,customClickBehavior:xe,onObservation:we,annotationObservationCallback:ke,chartId:Se,annotations:Ae,onAnnotationActivate:Me,autoPlaceAnnotations:Ce,svgAnnotationRules:je,showGrid:_e=!1,legend:Re,legendHoverBehavior:Pe,legendClickBehavior:Le,legendHighlightedCategory:Ie,legendIsolatedCategories:Te,legendPosition:$e,legendLayout:Be,legendCategoryAccessor:He,onCategoriesChange:Oe,backgroundGraphics:Fe,foregroundGraphics:Ee,title:De,className:We,background:Ne,centerContent:ze,decay:qe,pulse:Ge,transition:Ve,animate:Ue,staleness:Ke,frameScheduler:Qe,clock:Ze,random:Je,seed:nt,paused:rt=!1,suspendWhenHidden:it=!0,brush:st,onBrush:at,accessibleTable:lt=!0,description:ct,summary:ht,customLayout:ft,onLayoutError:mt,layoutConfig:gt,layoutSelection:pt}=e,{customHoverBehavior:vt,customClickBehavior:xt,hasClickBehavior:kt}=function({customHoverBehavior:e,customClickBehavior:t,onObservation:n,chartId:o,chartType:r}){return{customHoverBehavior:(0,is.useCallback)((t,i)=>{e?.(t,i),os({onObservation:n,datum:t?t.data||t:null,x:t?.x,y:t?.y,chartType:r,chartId:o,context:i})},[o,r,e,n]),customClickBehavior:(0,is.useCallback)((e,i)=>{t?.(e,i),rs({onObservation:n,datum:e?e.data||e:null,x:e?.x,y:e?.y,chartType:r,chartId:o,context:i})},[o,r,t,n]),hasClickBehavior:!(!t&&!n)}}({customHoverBehavior:ve,customClickBehavior:xe,onObservation:we,chartId:Se,chartType:"StreamOrdinalFrame"}),St=g??i,Mt=m??s,Ct=(0,k.useRef)(!0),jt=ai({sizeProp:b,responsiveWidth:v,responsiveHeight:x,userMargin:w,marginDefault:ds,title:De,legend:Re,legendPosition:$e,animate:Ue,transitionProp:Ve,frameScheduler:Qe,clock:Ze,random:Je,seed:nt,paused:rt,suspendWhenHidden:it,themeDirtyRef:Ct}),{reducedMotionRef:_t,responsiveRef:Rt,size:Pt,margin:Lt,adjustedWidth:Bt,adjustedHeight:Ot,currentTheme:Ft,transition:Et,introEnabled:Dt,tableId:Wt,rafRef:Nt,renderFnRef:zt,scheduleRender:qt,frameRuntime:Gt}=jt,Vt=function(){const[e,t]=(0,Bo.useState)(!1);return Ho(()=>{t(!0)},[]),e}(),Xt=function(){const e=(0,Bo.useSyncExternalStore)(Oo,Fo,Eo);return(0,Bo.useRef)(e).current}(),Yt=(0,k.useMemo)(()=>A(r),[r]),Ut=re??le,Kt=ie??ce,Qt=se??ue,Zt=ae??de,Jt=(0,k.useRef)(null),[en,tn]=(0,k.useState)(null),[nn,on]=(0,k.useState)(null),rn=hi(Ee,Pt,Lt,nn),sn=hi(Fe,Pt,Lt,nn),an=Fe||"transparent"===Ne?null:(0,us.jsx)("rect",{className:"semiotic-canvas-background","data-semiotic-layer":"canvas-background",x:-Lt.left,y:-Lt.top,width:Pt[0],height:Pt[1],fill:Ne||"var(--semiotic-bg, transparent)"}),[ln,cn]=(0,k.useState)(0),un=(0,k.useRef)(0),[dn,hn]=(0,k.useState)(!1),fn=(0,k.useRef)({w:-1,h:-1}),mn=(0,k.useRef)(!1),gn=(0,Ye.useRef)(new et("StreamOrdinalFrame")),yn=ye||pe,pn="streaming"===o,bn=function(e){const t=(0,Do.useRef)(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return No(e,t);if(!zo(e)||!zo(t))return!1;const n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(const o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;const n=e[o],r=t[o];if(!Object.is(n,r))if(Array.isArray(n)&&Array.isArray(r)){if(!No(n,r))return!1}else{if(!zo(n)||!zo(r))return!1;if(!Wo(n,r))return!1}}return!0}(t.current,e)||(t.current=e),t.current}((0,k.useMemo)(()=>({chartType:n,runtimeMode:pn?"streaming":"bounded",windowSize:K,windowMode:U,extentPadding:X,projection:p,oAccessor:pn?void 0:St,rAccessor:pn?void 0:Mt,accessorRevision:y,colorAccessor:a,symbolAccessor:l,symbolMap:c,stackBy:u,groupBy:d,multiAxis:h,timeAccessor:pn?f:void 0,valueAccessor:pn?m||("string"==typeof Mt||"function"==typeof Mt?Mt:void 0):void 0,categoryAccessor:pn?St:void 0,rExtent:G,oExtent:V,axisExtent:ge,barPadding:S,roundedTop:C,gradientFill:j,trackFill:_,baselinePadding:R,innerRadius:P,cornerRadius:L,normalize:I,startAngle:T,sweepAngle:$,dynamicColumnWidth:B,bins:H,showOutliers:O,showIQR:F,amplitude:E,connectorOpacity:D,showLabels:W,connectorAccessor:N,connectorStyle:z,dataIdAccessor:q,oSort:Y,pieceStyle:Q,summaryStyle:Z,colorScheme:ee,themeCategorical:Ft?.colors?.categorical,themeSemantic:Or(Ft),themeSequential:Ft?.colors?.sequential,themeDiverging:Ft?.colors?.diverging,barColors:te,decay:qe,pulse:Ge,transition:Et,introAnimation:Dt,staleness:Ke,clock:Gt.now,customLayout:ft,onLayoutError:mt,layoutConfig:gt,layoutMargin:Lt}),[n,pn,K,U,X,p,St,Mt,y,a,l,c,u,d,h,f,m,G,V,ge,S,C,j,_,R,P,L,I,T,$,B,H,O,F,E,D,W,N,z,q,Y,Q,Z,ee,Ft,te,qe,Ge,Et,Dt,Ke,Gt.now,ft,mt,gt,Lt])),vn=(0,k.useRef)(null);vn.current||(vn.current=new Xe(bn));const xn=function(e,t,n,o){const r=(0,di.useRef)({accessor:t,onChange:n,readData:o}),i=(0,di.useRef)([]);return r.current={accessor:t,onChange:n,readData:o},(0,di.useCallback)(()=>{const{accessor:t,onChange:n,readData:o}=r.current;if(!n||!t)return;const s=function(e,t){if(!t)return[];const n=new Set,o=[];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+"";n.has(i)||(n.add(i),o.push(i))}return o}(e.current?o(e.current):[],t);(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})(s,i.current)||(i.current=s,n(s))},[e])}(vn,He,Oe,e=>e.getData());!function(e,t,n,o){(0,dt.useEffect)(()=>{e.current?.updateConfig(t),n.current=!0,o()},[t,o,e,n])}(vn,bn,Ct,qt),function(e,t,n,o){const r=(0,dt.useRef)(null);(0,dt.useEffect)(()=>{const i=e.current;if(!i)return;const s=t??null;r.current!==s&&(r.current=s,i.setLayoutSelection(s),i.hasCustomRestyle?i.restyleScene(s):n.current=!0,o())},[t,o,e,n])}(vn,pt,Ct,qt);const wn=(0,k.useRef)(null);wn.current||(wn.current=new M(e=>{const t=vn.current;t&&t.ingest(e)&&(Ct.current=!0,qt())}));const kn=(0,k.useCallback)(e=>{wn.current?.push(e)},[]),Sn=(0,k.useCallback)(e=>{wn.current?.pushMany(e)},[]),An=(0,k.useCallback)(()=>{wn.current?.clear(),vn.current?.clear(),Ct.current=!0,qt()},[qt]),Mn=(0,k.useCallback)(e=>{wn.current?.clearLastData(),wn.current?.setReplacementData(e)},[]);(0,k.useImperativeHandle)(t,()=>({push:kn,pushMany:Sn,replace:Mn,remove:e=>{wn.current?.flush();const t=vn.current?.remove(e)??[];if(t.length>0){const e=Jt.current?.data;!!Jt.current&&t.some(Array.isArray(e)?t=>e.includes(t):t=>t===e)&&(Jt.current=null,tn(null)),Ct.current=!0,qt()}return t},update:(e,t)=>{wn.current?.flush();const n=vn.current?.update(e,t)??[];return n.length>0&&(Ct.current=!0,qt()),n},clear:An,getData:()=>(wn.current?.flush(),vn.current?.getData()??[]),getScales:()=>vn.current?.scales??null,getCustomLayout:()=>vn.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>vn.current?.lastCustomLayoutFailure??null}),[kn,Sn,Mn,An,qt]),(0,k.useEffect)(()=>{r&&wn.current?.setBoundedData(Yt)},[r,Yt]);const{canvasRef:Cn}=function(e,t){return function(e){const{cancelRender:t,dirtyRef:n,frameRuntime:o,manageFrameRuntime:r,scheduleRender:i}=e,s=(0,li.useRef)(null),a=(0,li.useRef)(null),l=(0,li.useRef)(!1);return function(e){const{hydrated:t,wasHydratingFromSSR:n,storeRef:o,dirtyRef:r,renderFnRef:i,cancelRender:s,cleanup:a}=e;Ho(()=>{t&&n&&o.current?.cancelIntroAnimation?.(),r.current=!0,s?.(),i.current()},[t,n]);const l=(0,Bo.useRef)(a);l.current=a,(0,Bo.useEffect)(()=>()=>l.current?.(),[])}({hydrated:e.hydrated,wasHydratingFromSSR:e.wasHydratingFromSSR,storeRef:e.storeRef,dirtyRef:e.dirtyRef,renderFnRef:e.renderFnRef,cancelRender:e.cancelRender,cleanup:e.cleanup}),(0,li.useEffect)(()=>{if(!1!==r)return o.subscribe(()=>{o.isActive?(n.current=!0,i()):t()})},[t,n,o,r,i]),(0,li.useEffect)(()=>{!l.current&&(l.current=!0,e.skipInitialCanvasPaintInvalidation)||(e.dirtyRef.current=!0,e.scheduleRender())},e.canvasPaintDependencies),{canvasRef:s,interactionCanvasRef:a}}({...t,renderFnRef:e.renderFnRef,scheduleRender:e.scheduleRender,cancelRender:e.cancelRender,frameRuntime:e.frameRuntime})}(jt,{storeRef:vn,dirtyRef:Ct,hydrated:Vt,wasHydratingFromSSR:Xt,cleanup:()=>wn.current?.clear(),canvasPaintDependencies:[n,Bt,Ot,ne,Ne,Fe,J,qt]}),{hoverHandlerRef:jn,hoverLeaveRef:_n,onPointerMove:Rn,onPointerLeave:Pn}=jt;jn.current=e=>{if(!yn)return;const t=Cn.current;if(!t)return;const o=t.getBoundingClientRect(),r=e.clientX-o.left-Lt.left,i=e.clientY-o.top-Lt.top;if(0>r||r>Bt||0>i||i>Ot)return void(Jt.current&&(Jt.current=null,tn(null),vt&&vt(null),qt()));const s=vn.current;if(!s||0===s.scene.length)return;const a="radial"===p,l=At(s.scene,a?r-Bt/2:r,a?i-Ot/2:i,30,s.pointQuadtree,s.maxPointRadius);if(!l)return void(Jt.current&&(Jt.current=null,tn(null),vt&&vt(null),qt()));const c=wr(l.datum||{},l.x,l.y,{...l.stats&&{stats:l.stats},...l.category&&{category:l.category},__oAccessor:"string"==typeof St?St:void 0,__rAccessor:"string"==typeof Mt?Mt:void 0,__chartType:n});Jt.current=c,tn(c),vt&&(vt(c),Ct.current=!0),qt()},_n.current=()=>{Jt.current&&(Jt.current=null,tn(null),vt&&(vt(null),Ct.current=!0),qt())};const Ln=(0,k.useCallback)(e=>{if((t=e.target)instanceof Element&&null!=t.closest("[data-semiotic-annotation-widget]"))return;var t;if(!xt)return;const o=Cn.current;if(!o)return xt(null),Ct.current=!0,void qt();const r=o.getBoundingClientRect(),i=e.clientX-r.left-Lt.left,s=e.clientY-r.top-Lt.top;if(0>i||i>Bt||0>s||s>Ot)return xt(null),Ct.current=!0,void qt();const a=vn.current;if(!a||0===a.scene.length)return xt(null),Ct.current=!0,void qt();const l="radial"===p,c=At(a.scene,l?i-Bt/2:i,l?s-Ot/2:s,30,a.pointQuadtree,a.maxPointRadius);if(!c)return xt(null),Ct.current=!0,void qt();var u;xt(wr(c.datum||{},c.x,c.y,{...c.stats&&{stats:c.stats},...c.category&&{category:c.category},__oAccessor:"string"==typeof St?St:void 0,__rAccessor:"string"==typeof Mt?Mt:void 0,__chartType:n}),{type:"activate",inputType:(u=e.nativeEvent.pointerType,"touch"===u?"touch":"pointer")}),Ct.current=!0,qt()},[xt,Cn,Lt.left,Lt.top,Bt,Ot,p,St,Mt,n,qt]),{kbFocusIndexRef:In,focusedNavPointRef:Tn,onKeyDown:$n}=function({chartType:e,oAccessor:t,rAccessor:n,...o}){return function({storeRef:e,hoverRef:t,hoveredNodeRef:n,setHoverPoint:o,customHoverBehavior:r,customClickBehavior:i,scheduleRender:s,extractPoints:a,toHover:l}){const c=(0,ss.useRef)(-1),u=(0,ss.useRef)(null),d=(0,ss.useRef)(null),h=(0,ss.useCallback)(h=>{if(function(e){const t=e.target;return t instanceof Element&&t!==e.currentTarget&&null!=t.closest("button, a[href], input, select, textarea, summary, [contenteditable='true'], [role='button'], [role='link'], [role='checkbox'], [role='radio'], [role='switch']")}(h))return;const f=e.current;if(!f)return;const m=()=>{c.current=-1,u.current=null,t.current=null,n&&(n.current=null),o(null),r(null),s()};if(0===f.scene.length)return void(0>c.current||m());let g;if(d.current?.version===f.version)g=d.current.graph;else{const e=a(f.scene);if(0===e.length)return void(0>c.current||m());g=function(e){const t=new Map;for(const n of e){const e=n.group??"_default";let o=t.get(e);o||(o=[],t.set(e,o)),o.push(n)}for(const e of t.values()){e.sort((e,t)=>e.x-t.x||e.y-t.y);for(let t=0;e.length>t;t++)e[t]._groupIndex=t}const n=Array.from(t.keys()).sort((e,n)=>{const o=t.get(e),r=t.get(n);return(o.length>0?o[0].y:0)-(r.length>0?r[0].y:0)}),o=Array.from(t.values()).flat();o.sort((e,t)=>e.x-t.x||e.y-t.y);const r=new Map;for(let e=0;o.length>e;e++){o[e]._flatIndex=e;const t=o[e].datum?.id;null!=t&&r.set(t+"",e)}return{flat:o,groups:n,byGroup:t,idToIdx:r}}(e),d.current={version:f.version,graph:g}}let y=c.current;if(g.flat.length>y||(m(),y=-1),("Enter"===h.key||" "===h.key)&&y>=0)return h.preventDefault(),void i(l(g.flat[y],f),{type:"activate",inputType:"keyboard"});if(0>y){if("Escape"===h.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(h.key))return;h.preventDefault(),c.current=0;const e=g.flat[0];u.current=e;const n=l(e,f);return t.current=n,o(n),r(n,{type:"focus",inputType:"keyboard"}),void s()}const p=function(e,t,n){const{group:o,indexInGroup:r}=t,i=n.byGroup.get(o);switch(e){case"ArrowRight":return i.length-1>r?i[r+1]._flatIndex:t.flatIndex;case"ArrowLeft":return r>0?i[r-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=n.groups.indexOf(o);return n.groups.length-1>e?as(n,n.groups[e+1],i[r]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?as(n,n.groups[e-1],i[r]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*n.flat.length)),n.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*n.flat.length)),0);case"Home":return 0;case"End":return n.flat.length-1;case"Escape":return-1;default:return null}}(h.key,function(e,t){if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const n=Math.max(0,Math.min(t,e.flat.length-1)),o=e.flat[n];return{flatIndex:n,group:o.group??"_default",indexInGroup:o._groupIndex??0}}(g,y),g);if(null===p)return;if(h.preventDefault(),0>p)return void m();c.current=p;const b=g.flat[p];u.current=b;const v=l(b,f);t.current=v,o(v),r(v,{type:"focus",inputType:"keyboard"}),s()},[i,r,a,t,n,s,o,e,l]);return{kbFocusIndexRef:c,focusedNavPointRef:u,onKeyDown:h}}({...o,extractPoints:ls,toHover:o=>({...cs(o),__oAccessor:"string"==typeof t?t:void 0,__rAccessor:"string"==typeof n?n:void 0,__chartType:e})})}({storeRef:vn,hoverRef:Jt,setHoverPoint:tn,customHoverBehavior:vt,customClickBehavior:xt,scheduleRender:qt,chartType:n,oAccessor:St,rAccessor:Mt}),Bn=(0,k.useCallback)(e=>{In.current=-1,Tn.current=null,Rn(e)},[Tn,In,Rn]);zt.current=()=>{if(Nt.current=null,!Gt.isActive)return;const e=Cn.current;if(!e)return;const t=e.getContext("2d");if(!t)return;const o=vn.current;if(!o)return;const r=Gt.now(),i=o.advanceTransition(_t.current?r+1e6:r),s=!_t.current&&i,a=fn.current.w!==Bt||fn.current.h!==Ot,l=Ct.current;let c=!1;const u=gn.current.beforeCompute(o.getLastUpdateResult(),s);!l&&!a||s&&!a||(o.computeScene({width:Bt,height:Ot}),fn.current={w:Bt,h:Ot},c=!0,xn()),gn.current.afterCompute(u,c,a),Ct.current=l&&s&&!c;const d=function(e,t,n,o){const r=o.current,i=!0===e.lastCustomLayoutFailure?.preservedLastGoodScene,s=!i&&e.hasActivePulsesAt(t),a=!(n||i||!s&&!r)&&e.refreshPulse(t);return o.current=s,{changed:a,pending:s}}(o,r,c,mn);(c||s)&&e.setAttribute("aria-label",er(o.scene,n+" chart"));const h=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))}(),f=Pt[0]*h,m=Pt[1]*h;e.width===f&&e.height===m||(e.width=f,e.height=m,e.style.width=Pt[0]+"px",e.style.height=Pt[1]+"px"),t.setTransform(h,0,0,h,0,0),t.clearRect(0,0,Pt[0],Pt[1]);const g=Ke&&o.lastIngestTime>0&&r-o.lastIngestTime>(Ke?.threshold??5e3);g&&(t.globalAlpha=Ke?.dimOpacity??.5);const y="radial"===p;t.save(),t.beginPath(),t.rect(Lt.left,Lt.top,Bt,Ot),t.clip(),y?(t.save(),t.translate(Lt.left+Bt/2,Lt.top+Ot/2)):t.translate(Lt.left,Lt.top);const b=ft?Ki.custom:Ki[n]||[],v={width:Bt,height:Ot},x=o.scales;x&&function(e){const{context:t,nodes:n,renderMode:o,pixelRatio:r,paintBuiltIn:i}=e;if(!o||"sketchy"===o)return void i(n);let s=[];const a=()=>{s.length&&(i(s),s=[])};for(const e of n){const n=Zi(o,e);if(!n){s.push(e);continue}let l;a(),t.save();try{l=n.drawCanvas({context:t,node:e,style:e.style??{},pixelRatio:r})}finally{t.restore()}l||(Ji(n.id,e.type??"unknown"),i([e]))}a()}({context:t,nodes:o.scene,renderMode:J,pixelRatio:h,paintBuiltIn:e=>{for(const n of b)n(t,e,x,v)}}),y&&t.restore(),t.restore(),g&&(t.globalAlpha=1),c&&o.scales?(on(o.scales),cn(e=>e+1),un.current=r):s&&o.scales&&r-un.current>=33&&(cn(e=>e+1),un.current=r),Ke?.showBadge&&hn(!!g),(s||null!=o.activeTransition||d.pending)&&qt()},function(e,t,n,o,r,i){const s=(0,It.useRef)("fresh");(0,It.useEffect)(()=>{if(!e)return;const a=setInterval(()=>{const a=t.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=function(e,t){if(!e||0>=t)return $t;const n=null!=e.threshold&&e.threshold>0?e.threshold:5e3,o=e.graded;if(o){const e="object"==typeof o?o:{},r=function(e,t,n={}){return Number.isFinite(t)&&t>0?Number.isNaN(e)?"fresh":e===1/0?"expired":0>e||t*(n.fresh??1)>e?"fresh":t*(n.aging??1.5)>e?"aging":t*(n.stale??3)>e?"stale":"expired":"fresh"}(t,n,e.thresholds);return{alpha:{...Tt,...e.opacities??{}}[r],band:r,isStale:"fresh"!==r}}return t>n?{alpha:e.dimOpacity??.5,band:"stale",isStale:!0}:$t}(e,l-a.lastIngestTime);c.band===s.current&&c.isStale===r||(s.current=c.band,c.isStale!==r&&i(c.isStale),n.current=!0,o())},1e3);return()=>clearInterval(a)},[e,r,o,t,i,n])}(Ke,vn,Ct,qt,dn,hn);const Hn=yn&&en?be?be(en):(0,us.jsx)(ns,{hover:en}):null,On="radial"===p,En=Hn?(0,us.jsx)($r,{x:en?On?en.x+Bt/2:en.x:0,y:en?On?en.y+Ot/2:en.y:0,containerWidth:Bt,containerHeight:Ot,margin:Lt,className:"stream-ordinal-tooltip",children:Hn}):null,Dn="horizontal"===p?St:Mt,Wn=po("horizontal"===p?Mt:St,void 0,"__semiotic_resolvedO",""),zn=po(Dn,void 0,"__semiotic_resolvedR",""),qn=Wn.key,Gn=zn.key,Vn=function(e,t,n){return o=>{if(!o||!n||!e.fn&&!t.fn)return o;let r=!1;const i=o.map(n=>{const o=e.fn&&e.key&&!(e.key in n),i=t.fn&&t.key&&!(t.key in n);if(!o&&!i)return n;r=!0;const s={...n};return o&&(s[e.key]=e.fn(n)),i&&(s[t.key]=t.fn(n)),s});return r?i:o}}(Wn,zn,Ae&&Ae.length>0||!1);if($o||!Vt&&Xt){const e=vn.current;e&&r&&(e.ingest({inserts:Yt,bounded:!0}),e.computeScene({width:Bt,height:Ot}));const t=e?.scene??[],n=e?.scales??null,o=hi(Ee,Pt,Lt,n),i=hi(Fe,Pt,Lt,n),s="radial"===p,a=s?Lt.left+Bt/2:Lt.left,l=s?Lt.top+Ot/2:Lt.top;return(0,us.jsxs)("div",{ref:Rt,className:"stream-ordinal-frame"+(We?" "+We:""),role:"img","aria-label":ct||("string"==typeof De?De:"Ordinal chart"),style:{position:"relative",width:v?"100%":Pt[0],height:x?"100%":Pt[1]},children:[(0,us.jsx)(mr,{summary:ht}),(0,us.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:Pt[0],height:Pt[1],style:{position:"absolute",left:0,top:0},children:[i&&(0,us.jsx)("g",{transform:`translate(${Lt.left},${Lt.top})`,children:i}),(0,us.jsxs)("g",{transform:`translate(${a},${l})`,children:[Ne&&(0,us.jsx)("rect",{x:0,y:0,width:Bt,height:Ot,fill:Ne}),t.map((e,t)=>function(e){const{node:t,index:n,renderMode:o,fallback:r}=e,i=Zi(o,t);if(!i)return r();const s=i.renderStaticSVG({node:t,style:t.style??{},key:`${i.id}-${n}`});return null!=s?s:(Ji(i.id,t.type??"unknown"),r())}({node:e,index:t,renderMode:J,fallback:()=>function(e,t,n){const o=("category"in e?e.category:void 0)||("group"in e?e.group:void 0)||"",r=n=>`ord-${e.type}-${o}-${t}-${n}`,i=`ord-${e.type}-${o}-${t}`;switch(e.type){case"rect":{const t=e,n=To(i)+"-grad",o=function(e,t){const n=e.fillGradient;if(!n||"object"!=typeof n)return null;let o=e.x,r=e.y,i=e.x,s=e.y+e.h;"bottom"===e.roundedEdge?(r=e.y+e.h,s=e.y):"right"===e.roundedEdge?(o=e.x+e.w,r=e.y,i=e.x,s=e.y):"left"===e.roundedEdge&&(o=e.x,r=e.y,i=e.x+e.w,s=e.y);const a=[];if("colorStops"in n){const e=n.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>e.length)return null;for(let t=0;e.length>t;t++)a.push((0,Po.jsx)("stop",{offset:e[t].offset,stopColor:e[t].color},t))}else{const t=Io(e.style.fill);a.push((0,Po.jsx)("stop",{offset:0,stopColor:t,stopOpacity:n.topOpacity},"0")),a.push((0,Po.jsx)("stop",{offset:1,stopColor:t,stopOpacity:n.bottomOpacity},"1"))}return(0,Po.jsx)("linearGradient",{id:t,gradientUnits:"userSpaceOnUse",x1:o,y1:r,x2:i,y2:s,children:a})}(t,n);let r,s;if(o)s=`url(#${n})`;else if(Fn(t.style.fill)){const e=To(i)+"-hatch";r=Nn(t.style.fill,e),s=`url(#${e})`}else s=Io(t.style.fill);const a=o||r?(0,Po.jsxs)("defs",{children:[o,r]}):null;if(t.cornerRadii&&Mo(t.cornerRadii)){const e=function(e){const{x:t,y:n,w:o,h:r}=e,{tl:i,tr:s,br:a,bl:l}=Co(e);let c=`M${t+i},${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+r-a}`,a>0&&(c+=` A${a},${a} 0 0 1 ${t+o-a},${n+r}`),c+=` L${t+l},${n+r}`,l>0&&(c+=` A${l},${l} 0 0 1 ${t},${n+r-l}`),c+=` L${t},${n+i}`,i>0&&(c+=` A${i},${i} 0 0 1 ${t+i},${n}`),c+=" Z",c}(t);return(0,Po.jsxs)(So.Fragment,{children:[a,(0,Po.jsx)("path",{d:e,fill:s,opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})]},i)}if(t.roundedTop&&t.roundedTop>0){const e=Math.min(t.roundedTop,t.w/2,t.h/2),{x:n,y:o,w:r,h:l}=t;let c;switch(t.roundedEdge){case"right":c=`M${n},${o} L${n+r-e},${o} A${e},${e} 0 0 1 ${n+r},${o+e} L${n+r},${o+l-e} A${e},${e} 0 0 1 ${n+r-e},${o+l} L${n},${o+l} Z`;break;case"left":c=`M${n+r},${o} L${n+e},${o} A${e},${e} 0 0 0 ${n},${o+e} L${n},${o+l-e} A${e},${e} 0 0 0 ${n+e},${o+l} L${n+r},${o+l} Z`;break;case"bottom":c=`M${n},${o} L${n+r},${o} L${n+r},${o+l-e} A${e},${e} 0 0 1 ${n+r-e},${o+l} L${n+e},${o+l} A${e},${e} 0 0 1 ${n},${o+l-e} Z`;break;default:c=`M${n},${o+l} L${n},${o+e} A${e},${e} 0 0 1 ${n+e},${o} L${n+r-e},${o} A${e},${e} 0 0 1 ${n+r},${o+e} L${n+r},${o+l} Z`}return(0,Po.jsxs)(So.Fragment,{children:[a,(0,Po.jsx)("path",{d:c,fill:s,opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})]},i)}return(0,Po.jsxs)(So.Fragment,{children:[a,(0,Po.jsx)("rect",{x:t.x,y:t.y,width:t.w,height:t.h,fill:s,opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})]},i)}case"point":{const t=e;return(0,Po.jsx)("circle",{cx:t.x,cy:t.y,r:t.r,fill:Io(t.style.fill),opacity:t.style.opacity??.8,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},i)}case"symbol":return function(e,t,n){const o=me(e.symbolType,e.size,e.path);return(0,Po.jsx)("path",{d:o,transform:e.rotation?`translate(${e.x},${e.y}) rotate(${180*e.rotation/Math.PI})`:`translate(${e.x},${e.y})`,fill:e.style.fill?Io(e.style.fill):"none",opacity:e.style.opacity,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth},`${n??""}symbol-${t}`)}(e,t,n);case"glyph":return function(e,t,n,o){const r=e.glyph;if(!r?.parts?.length||0>=e.size)return null;const i=yt(r,e.size);if(0>=i.scale)return null;const s=`translate(${t},${n})${e.rotation?` rotate(${180*e.rotation/Math.PI})`:""} translate(${i.offsetX},${i.offsetY}) scale(${i.scale})`,a=e.color??("string"==typeof e.style.fill?e.style.fill:void 0),l=wt(r,e.fraction??1,e.fractionStart??0,e.fractionDirection??"horizontal"),c=l?To(o+"-clip"):void 0,u=(e.style.opacity??1)*(e._decayOpacity??1)*(e.style.fillOpacity??1),d=t=>r.parts.map((n,o)=>{const r=t?"none"===n.fill?void 0:t:bt(n.fill,a,e.accent),i=t?n.stroke&&"none"!==n.stroke?t:void 0:bt(n.stroke??"none",a,e.accent);return r||i?(0,Po.jsx)("path",{d:n.d,fill:r??"none",stroke:i,strokeWidth:i?n.strokeWidth??1:void 0,strokeLinecap:n.strokeLinecap,strokeLinejoin:n.strokeLinejoin,opacity:n.opacity},o):null});return(0,Po.jsxs)("g",{transform:s,opacity:1===u?void 0:u,children:[l&&c&&(0,Po.jsx)("clipPath",{id:c,children:(0,Po.jsx)("rect",{x:l.x,y:l.y,width:l.width,height:l.height})}),l&&e.ghostColor?(0,Po.jsx)("g",{children:d(e.ghostColor)}):null,l&&c?(0,Po.jsx)("g",{clipPath:`url(#${c})`,children:d()}):d()]},o)}(e,e.x,e.y,`${n??""}ord-glyph-${e.pointId??t}`);case"wedge":{const o=e;if(o._gradientBand&&o._gradientBand.colors.length>0){const e=To(`${n?n+"-":""}gauge-grad-${o.category||i}-${t}`),{clipPath:r,slices:s}=Ro({innerRadius:o.innerRadius,outerRadius:o.outerRadius,startAngle:o.startAngle,endAngle:o.endAngle,cornerRadius:o.cornerRadius,roundStart:o.roundedEnds?.start??!0,roundEnd:o.roundedEnds?.end??!0,colors:o._gradientBand.colors});return(0,Po.jsxs)("g",{transform:`translate(${o.cx},${o.cy})`,opacity:o.style.opacity,fillOpacity:o.style.fillOpacity,children:[(0,Po.jsx)("defs",{children:(0,Po.jsx)("clipPath",{id:e,children:(0,Po.jsx)("path",{d:r})})}),(0,Po.jsx)("g",{clipPath:`url(#${e})`,children:s.map((e,t)=>(0,Po.jsx)("path",{d:e.d,fill:Io(e.color)},t))}),o.style.stroke&&"none"!==o.style.stroke&&(0,Po.jsx)("path",{d:r,fill:"none",stroke:o.style.stroke,strokeWidth:o.style.strokeWidth})]},i)}let r;if(o.roundedEnds)r=_o({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=(0,Ao.arc)().innerRadius(o.innerRadius).outerRadius(o.outerRadius).startAngle(o.startAngle+Math.PI/2).endAngle(o.endAngle+Math.PI/2);o.cornerRadius&&e.cornerRadius(o.cornerRadius),r=e(Lo)||""}return(0,Po.jsx)("path",{d:r,transform:`translate(${o.cx},${o.cy})`,fill:Io(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},i)}case"boxplot":{const t=e,n=t.columnWidth/2;return(0,Po.jsxs)("g","vertical"===t.projection?{children:[(0,Po.jsx)("line",{x1:t.x,y1:t.minPos,x2:t.x,y2:t.maxPos,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,Po.jsx)("rect",{x:t.x-n,y:Math.min(t.q1Pos,t.q3Pos),width:t.columnWidth,height:Math.abs(t.q3Pos-t.q1Pos),fill:Io(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,Po.jsx)("line",{x1:t.x-n,y1:t.medianPos,x2:t.x+n,y2:t.medianPos,stroke:t.style.stroke||"#333",strokeWidth:2}),(0,Po.jsx)("line",{x1:t.x-.5*n,y1:t.minPos,x2:t.x+.5*n,y2:t.minPos,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,Po.jsx)("line",{x1:t.x-.5*n,y1:t.maxPos,x2:t.x+.5*n,y2:t.maxPos,stroke:t.style.stroke||"#333",strokeWidth:1})]}:{children:[(0,Po.jsx)("line",{x1:t.minPos,y1:t.y,x2:t.maxPos,y2:t.y,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,Po.jsx)("rect",{x:Math.min(t.q1Pos,t.q3Pos),y:t.y-n,width:Math.abs(t.q3Pos-t.q1Pos),height:t.columnWidth,fill:Io(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,Po.jsx)("line",{x1:t.medianPos,y1:t.y-n,x2:t.medianPos,y2:t.y+n,stroke:t.style.stroke||"#333",strokeWidth:2}),(0,Po.jsx)("line",{x1:t.minPos,y1:t.y-.5*n,x2:t.minPos,y2:t.y+.5*n,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,Po.jsx)("line",{x1:t.maxPos,y1:t.y-.5*n,x2:t.maxPos,y2:t.y+.5*n,stroke:t.style.stroke||"#333",strokeWidth:1})]},i)}case"violin":{const t=e,n=[(0,Po.jsx)("path",{d:t.pathString,transform:t.translateX||t.translateY?`translate(${t.translateX},${t.translateY})`:void 0,fill:Io(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,o=e.x+e.width/2,i=e.y+e.height/2;e.height>e.width?n.push((0,Po.jsx)("line",{x1:o,y1:t.iqrLine.q1Pos,x2:o,y2:t.iqrLine.q3Pos,stroke:t.style.stroke||"#333",strokeWidth:2},r("iqr")),(0,Po.jsx)("circle",{cx:o,cy:t.iqrLine.medianPos,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},r("med"))):n.push((0,Po.jsx)("line",{x1:t.iqrLine.q1Pos,y1:i,x2:t.iqrLine.q3Pos,y2:i,stroke:t.style.stroke||"#333",strokeWidth:2},r("iqr")),(0,Po.jsx)("circle",{cx:t.iqrLine.medianPos,cy:i,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},r("med")))}return(0,Po.jsx)("g",{children:n},i)}case"connector":return(0,Po.jsx)("line",{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stroke:e.style.stroke||"#999",strokeWidth:e.style.strokeWidth||1,opacity:e.style.opacity??.5},i);case"trapezoid":{const t=e,n=t.points.map(e=>`${e[0]},${e[1]}`).join(" ");return(0,Po.jsx)("polygon",{points:n,fill:Io(t.style.fill,"#999"),opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},i)}default:return null}}(e,t,Wt)})).filter(Boolean)]})]}),(0,us.jsx)(yo,{width:Bt,height:Ot,totalWidth:Pt[0],totalHeight:Pt[1],margin:Lt,scales:n,showAxes:ne,showCategoryTicks:oe,oLabel:Ut,rLabel:Kt,oFormat:Qt,rFormat:Zt,rTickValues:he,tickLabelEdgeAlign:fe,axisExtent:ge,showGrid:_e,title:De,legend:Re,legendHoverBehavior:Pe,legendClickBehavior:Le,legendHighlightedCategory:Ie,legendIsolatedCategories:Te,legendPosition:$e,legendLayout:Be,foregroundGraphics:ot(o,ut(vn.current?.customLayoutOverlays,pt??null)),annotations:Ae,onAnnotationActivate:Me,onObservation:ke??we,chartId:Se,chartType:"StreamOrdinalFrame",autoPlaceAnnotations:Ce,svgAnnotationRules:je,annotationFrame:0,xAccessor:qn,yAccessor:Gn,annotationData:Vn(e?.getData())}),ze&&"radial"===p&&(0,us.jsx)("div",{style:{position:"absolute",left:Lt.left+Bt/2,top:Lt.top+Ot/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:ze})]})}return(0,us.jsxs)("div",{ref:Rt,className:"stream-ordinal-frame"+(We?" "+We:""),role:"group","aria-label":ct||("string"==typeof De?De:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:v?"100%":Pt[0],height:x?"100%":Pt[1],overflow:"visible"},onKeyDown:$n,children:["production"!==process.env.NODE_ENV&&vn.current&&(0,us.jsx)(tt,{store:vn.current,diagnostics:gn.current}),lt&&(0,us.jsx)(gr,{tableId:Wt}),lt&&(0,us.jsx)(fr,{scene:vn.current?.scene??[],chartType:n+" chart",tableId:Wt,chartTitle:"string"==typeof De?De:void 0}),(0,us.jsx)(mr,{summary:ht}),(0,us.jsx)(Uo,{hoverPoint:en}),(0,us.jsxs)("div",{role:"img","aria-label":ct||("string"==typeof De?De:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:yn?Bn:void 0,onMouseLeave:yn?Pn:void 0,onClick:kt?Ln:void 0,children:[(0,us.jsxs)(ui,{size:Pt,margin:Lt,children:[an,sn]}),(0,us.jsx)(mo,{width:Bt,height:Ot,totalWidth:Pt[0],totalHeight:Pt[1],margin:Lt,scales:nn,showAxes:ne,showGrid:_e,rFormat:Zt,rTickValues:he,axisExtent:ge}),(0,us.jsx)("canvas",{ref:Cn,"aria-label":er(vn.current?.scene??[],n+" chart"),style:{position:"absolute",top:0,left:0,width:Pt[0],height:Pt[1]}}),(0,us.jsx)(yo,{width:Bt,height:Ot,totalWidth:Pt[0],totalHeight:Pt[1],margin:Lt,scales:nn,showAxes:ne,showCategoryTicks:oe,oLabel:Ut,rLabel:Kt,oFormat:Qt,rFormat:Zt,rTickValues:he,axisExtent:ge,showGrid:_e,title:De,legend:Re,legendHoverBehavior:Pe,legendClickBehavior:Le,legendHighlightedCategory:Ie,legendIsolatedCategories:Te,legendPosition:$e,legendLayout:Be,foregroundGraphics:ot(rn,ut(vn.current?.customLayoutOverlays,pt??null)),annotations:Ae,onAnnotationActivate:Me,onObservation:ke??we,chartId:Se,chartType:"StreamOrdinalFrame",autoPlaceAnnotations:Ce,svgAnnotationRules:je,annotationFrame:ln,xAccessor:qn,yAccessor:Gn,annotationData:Vn(vn.current?.getData()),underlayRendered:!0,canvasObscuresUnderlay:!1}),(st||at)&&"radial"!==p&&(0,us.jsx)(ko,{width:Bt,height:Ot,totalWidth:Pt[0],totalHeight:Pt[1],margin:Lt,scales:nn,onBrush:at||(()=>{})}),ze&&"radial"===p&&(0,us.jsx)("div",{style:{position:"absolute",left:Lt.left+Bt/2,top:Lt.top+Ot/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:ze}),Ke?.showBadge&&(0,us.jsx)(Ht,{isStale:dn,position:Ke.badgePosition}),(0,us.jsx)(br,{active:In.current>=0,hoverPoint:en,margin:Lt,size:Pt,shape:Tn.current?.shape,width:Tn.current?.w,height:Tn.current?.h}),En]})]})}));hs.displayName="StreamOrdinalFrame";var fs=hs;function ms(e){const{title:t,description:n,summary:o,accessibleTable:r,className:i,animate:s,axisExtent:a,autoPlaceAnnotations:l}=e,c={};return t&&(c.title=t),n&&(c.description=n),o&&(c.summary=o),void 0!==r&&(c.accessibleTable=r),i&&(c.className=i),null!=s&&(c.animate=s),void 0!==a&&(c.axisExtent=a),void 0!==l&&(c.autoPlaceAnnotations=l),c}function gs(e){const{linkedHover:t,selection:n,onObservation:o,onClick:r,hoverRadius:i,hoverHighlight:s,forceHoverBehavior:a,forceClickBehavior:l,mobileInteraction:c,customHoverBehavior:u,customClickBehavior:d,linkedHoverInClickPredicate:h=!0}=e,f={};o&&(f.annotationObservationCallback=o);const m=c?.enabled?Math.max(i??30,Math.ceil((c.targetSize||44)/2),24):i;return(a||t||o||r||s)&&(f.customHoverBehavior=u),d&&(l||(h?o||r||t:o||r)||c?.enabled&&(c.tapToSelect||c.tapToLockTooltip)&&(t||s||n))&&(f.customClickBehavior=d),null!=m&&(f.hoverRadius=m),f}function ys(e){const{tooltip:t,defaultTooltipContent:n}=e;return{tooltipContent:!1===t?()=>null:Ir(t)||n}}var ps=require("react"),bs=require("react"),vs=require("react"),xs=(require("react/jsx-runtime"),(0,vs.createContext)(null));function ws(){return(0,vs.useContext)(xs)}var ks=require("react");function Ss(e){const t=[];for(const[n,o]of Object.entries(e.fields))if("point"===o.type)t.push(e=>o.values.has(e[n]));else{const[e,r]=o.range;t.push(t=>{const o=t[n];return o>=e&&r>=o})}return e=>t.every(t=>t(e))}function As(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}function Ms(e,t){if(e.type!==t.type)return!1;if("interval"===e.type&&"interval"===t.type)return e.range[0]===t.range[0]&&e.range[1]===t.range[1];if("point"===e.type&&"point"===t.type){if(e.values.size!==t.values.size)return!1;for(const n of e.values)if(!t.values.has(n))return!1;return!0}return!1}var[Cs,js]=Mn(e=>({selections:new Map,setClause(t,n){e(e=>{const o=e.selections.get(t),r=o?.clauses.get(n.clientId);if(r&&function(e,t){if(e.clientId!==t.clientId||e.type!==t.type)return!1;const n=Object.entries(e.fields);if(n.length!==function(e){let t=0;for(const n in e)t++;return t}(t.fields))return!1;for(const[e,o]of n){const n=t.fields[e];if(!n||!Ms(o,n))return!1}return!0}(r,n))return{};const i=new Map(e.selections),s=As(i,t),a=new Map(s.clauses);return a.set(n.clientId,n),i.set(t,{...s,clauses:a}),{selections:i}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o||!o.clauses.has(n))return{};const r=new Map(e.selections),i=new Map(o.clauses);return i.delete(n),r.set(t,{...o,clauses:i}),{selections:r}})},setResolution(t,n){e(e=>{const o=e.selections.get(t);if(o?.resolution===n)return{};const r=new Map(e.selections),i=As(r,t);return r.set(t,{...i,resolution:n}),{selections:r}})},clearSelection(t){e(e=>{const n=e.selections.get(t);if(!n||0===n.clauses.size)return{};const o=new Map(e.selections);return o.set(t,{...n,clauses:new Map}),{selections:o}})}})),_s=require("react"),Rs=(require("react"),{positions:new Map}),Ps=new Set;function Ls(){for(const e of Ps)e()}function Is(e,t){const n=Rs.positions.get(e);if(n?.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(Rs.positions);o.delete(e),Rs={positions:o},Ls()}function Ts(e,t){const n=Rs.positions.get(e);if(!n?.locked)return;if(t&&n.sourceId!==t)return;const o=new Map(Rs.positions);o.delete(e),Rs={positions:o},Ls()}function $s(e){const t=(0,_s.useId)(),n=e.clientId||t,{name:o}=e,r=js(e=>e.selections.get(o)),i=js(e=>e.setClause),s=js(e=>e.clearClause),a=(0,_s.useMemo)(()=>!!r&&r.clauses.size>0,[r]);return{predicate:(0,_s.useMemo)(()=>r&&0!==r.clauses.size?function(e,t){const n=[];for(const[o,r]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(Ss(r));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(r,n):()=>!0,[r,n]),isActive:a,selectPoints:(0,_s.useCallback)(e=>{const t={};let r=!1;for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)},r=!0;r&&i(o,{clientId:n,type:"point",fields:t})},[n,o,i]),selectInterval:(0,_s.useCallback)(e=>{const t={};let r=!1;for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o},r=!0;r&&i(o,{clientId:n,type:"interval",fields:t})},[n,o,i]),clear:(0,_s.useCallback)(()=>{s(o,n)},[s,o,n]),clientId:n}}function Bs(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function Hs(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}require("react/jsx-runtime");var Os=(0,ks.createContext)(!1);(0,ks.createContext)(!1);var Fs=(0,ks.createContext)(null),Es="undefined"==typeof window?ks.useEffect:ks.useLayoutEffect;function Ds(e){const t=(0,ks.useContext)(Fs),n=(0,ks.useId)(),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),r=(0,ks.useRef)([]);(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})(r.current,o)||(r.current=o);const i=r.current;Es(()=>{if(t)return()=>t.unregisterCategories(n)},[t,n]),Es(()=>{t&&t.registerCategories(n,i)},[t,n,i])}function Ws({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:r,strokeWidth:i,categories:s}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==r&&(n.stroke=r),void 0!==i&&(n.strokeWidth=i),n},type:"fill",items:(s&&s.length>0?s:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((r,i)=>{const s=e.find("function"==typeof t?e=>t(e)===r:e=>e[t]===r),a=s?o(s,t,n):n?n(r):oe[i%oe.length];return{label:r+"",color:a}}),label:""}]}}var Ns=g(require("react"));function zs(){return Gr(e=>e.theme)}function qs(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function Gs(e,t){const{when:n}=e,o=t.width,r=t.height,i=function(e){if("number"==typeof e.height&&e.height>0)return e.width/e.height}(t),s=function(e){if("number"==typeof e.height&&e.height>0)return e.height>e.width?"portrait":"landscape"}(t);return!("number"==typeof n.minWidth&&n.minWidth>o||"number"==typeof n.maxWidth&&o>n.maxWidth||"number"==typeof n.minHeight&&("number"!=typeof r||n.minHeight>r)||"number"==typeof n.maxHeight&&("number"!=typeof r||r>n.maxHeight)||"number"==typeof n.minAspectRatio&&("number"!=typeof i||n.minAspectRatio>i)||"number"==typeof n.maxAspectRatio&&("number"!=typeof i||i>n.maxAspectRatio)||n.orientation&&s!==n.orientation)}function Vs(e,t,n=e.responsiveRules){if(!Array.isArray(n)||0===n.length)return{props:e,matches:[]};const o=n.map((e,t)=>({rule:e,index:t})).filter(e=>Gs(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:o.reduce((e,t)=>function(e,t){const n={...e,...t};for(const o of["margin","frameProps","mobileSemantics","style"])qs(e[o])&&qs(t[o])&&(n[o]={...e[o],...t[o]});return"string"==typeof e.className&&"string"==typeof t.className&&(n.className=`${e.className} ${t.className}`),n}(e,t.rule.transform),e),matches:o}}function Xs(e,t,n){const o=e.xValue??t?.[n];if(null==o)return null;const r=Number(o);return Number.isFinite(r)?r:null}function Ys(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 Us(e){if(!e)return!1;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}require("react/jsx-runtime"),Ns.createContext(void 0);var Ks=[],Qs={enabled:!0,tapToSelect:!0,tapToLockTooltip:!0,clearSelection:"backgroundTap",targetSize:44,snap:"nearestDatum",brushHandleSize:44,standardControls:!1,enabled:!1,tapToSelect:!1,tapToLockTooltip:!1};function Zs(e,t={}){const n=t.mobileSemantics?.interaction,o="number"==typeof n?.targetSize?n.targetSize:"number"==typeof t.mobileSemantics?.minimumHitTarget?t.mobileSemantics.minimumHitTarget:void 0,r="mobile"===t.mode||"number"==typeof t.width&&480>=t.width,i=!!n||void 0!==o,s=e&&"object"==typeof e?e:void 0;if(!1===e||!1===s?.enabled||void 0===e&&!r&&!i)return Qs;const a=s??{};return{enabled:!0,tapToSelect:a.tapToSelect??!0,tapToLockTooltip:a.tapToLockTooltip??!0,clearSelection:a.clearSelection??"backgroundTap",targetSize:a.targetSize??o??44,snap:a.snap??"nearestDatum",brushHandleSize:a.brushHandleSize??44,standardControls:a.standardControls??!1}}function Js(){const e=zs(),t=e?.colors?.categorical;return t&&t.length>0?t:void 0}function ea(e,t,n){return(0,bs.useMemo)(()=>{if(!t||"auto"===t||"function"==typeof t)return e;const o=[...e],r="function"==typeof(i=n)?i:e=>e[i];var i;return o.sort("asc"===t?(e,t)=>r(e)-r(t):(e,t)=>r(t)-r(e))},[e,t,n])}var ta={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 na(e,t,n){const o=ta[e||"primary"],r=e&&"primary"!==e||!n?.width?o.width:n.width,i=e&&"primary"!==e||!n?.height?o.height:n.height,s=Vs({...t,mode:e},{width:t.width??r,height:t.height??i}).props,a=s.mode||e,l=ta[a||"primary"],c="context"===a||"sparkline"===a,u=a&&"primary"!==a||!n?.width?l.width:n.width;return{width:s.width??u,height:s.height??(a&&"primary"!==a||!n?.height?l.height:n.height),showAxes:s.showAxes??l.showAxes,showGrid:s.showGrid??l.showGrid,enableHover:s.enableHover??(!!s.linkedHover||l.enableHover),showLegend:s.showLegend??l.showLegend,showLabels:s.showLabels??l.showLabels,title:c?void 0:s.title,description:s.description,summary:s.summary,accessibleTable:s.accessibleTable,xLabel:c?void 0:s.xLabel,yLabel:c?void 0:s.yLabel,categoryLabel:c?void 0:s.categoryLabel,valueLabel:c?void 0:s.valueLabel,marginDefaults:oa(l.marginDefaults,s.showCategoryTicks,s.orientation),compactMode:c,mobileInteraction:Zs(s.mobileInteraction,{mode:a,width:s.width??u,mobileSemantics:s.mobileSemantics}),mobileSemantics:s.mobileSemantics}}function oa(e,t,n){if(!1!==t)return e;const o={...e};return"horizontal"===n?o.left=Math.min(o.left,15):o.bottom=Math.min(o.bottom,15),o}var ra=require("react/jsx-runtime");function ia(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function sa(e,t){if(!t)return ia(e);try{const n=t(e);return null==n?ia(e):n}catch{return ia(e)}}function aa(e,t){return"function"==typeof t?t(e):e[t]}function la({categoryAccessor:e,valueAccessor:t,groupAccessor:n,groupLabel:o,pieData:r=!1,valueFormat:i}){return s=>{const a=r?s.data?.[0]||s.data||s:s.data||s,l=aa(a,e),c=aa(a,t),u=n?aa(a,n):void 0;return(0,ra.jsxs)("div",{className:"semiotic-tooltip",style:_r,children:[(0,ra.jsx)("div",{style:{fontWeight:"bold"},children:ia(l)}),(0,ra.jsx)("div",{style:{marginTop:4},children:sa(c,i)}),null!=u&&(0,ra.jsxs)("div",{style:{marginTop:2,opacity:.8},children:[o||(d=n,"string"==typeof d?d:"value"),": ",ia(u)]})]});var d}}var ca=require("react/jsx-runtime");function ua({componentName:e,message:t,diagnosticHint:n,width:o,height:r}){return(0,ca.jsx)("div",{role:"alert",style:{width:o,height:Math.max(r,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:(0,ca.jsxs)("div",{style:{textAlign:"center",maxWidth:400},children:[(0,ca.jsx)("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:e}),(0,ca.jsx)("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:t}),n&&(0,ca.jsx)("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:n})]})})}var da=g(require("react")),ha=require("react/jsx-runtime"),fa=class extends da.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){this.props.onError?.(e,t)}render(){if(this.state.error){const{fallback:e}=this.props,t=this.state.error;return"function"==typeof e?e(t):void 0!==e?e:(0,ha.jsx)(ua,{componentName:"ChartErrorBoundary",message:t.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}},ma=require("react/jsx-runtime"),ga="undefined"!=typeof process&&"production"!==process.env?.NODE_ENV;function ya({componentName:e,width:t,height:n,children:o}){return(0,ma.jsx)(fa,{fallback:o=>(0,ma.jsx)(ua,{componentName:e,message:o.message,width:t,height:n}),children:o})}var pa={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"},ba={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function va(e,t,n,o){if(!ga)return;if(!t||0===t.length)return;if("string"!=typeof o)return;const r=t[0];if(!r||"object"!=typeof r)return;if(o in r)return;const i=Object.keys(r).join(", ");console.warn(`[semiotic] ${e}: ${n} "${o}" not found in data. Available keys: ${i}`)}function xa(e,t){const n=e.length,o=t.length,r=Array(o+1);for(let e=0;o>=e;e++)r[e]=e;for(let i=1;n>=i;i++){let n=r[0];r[0]=i;for(let s=1;o>=s;s++){const o=r[s];r[s]=e[i-1]===t[s-1]?n:1+Math.min(n,r[s],r[s-1]),n=o}}return r[o]}function wa(e,t){if(0===t.length)return null;const n=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(n)||n.includes(e.toLowerCase()))||(function(e,t,n=3){let o,r=n+1;for(const n of t){const t=xa(e.toLowerCase(),n.toLowerCase());r>t&&(r=t,o=n)}return r>n?void 0:o}(e,t,3)??null)}function ka({componentName:e,data:t,accessors:n,requiredProps:o}){if(o)for(const[t,n]of Object.entries(o))if(null==n)return`${e}: ${t} is required. Provide a field name or function.`;if(null==t)return null;if(!Array.isArray(t)&&"object"==typeof t)return e+": data should be an array, but received an object. If this is hierarchical data, use TreeDiagram, Treemap, or CirclePack instead.";if(!Array.isArray(t)||0===t.length)return e+": No data provided. Pass a non-empty array to the data prop.";if(n){const o=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[r,i]of Object.entries(n))if(i&&"string"==typeof i&&!(i in o)){const n=wa(i,t),o=n?` Try ${r}="${n}".`:"";return`${e}: ${r} "${i}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}var Sa=require("react"),Aa=require("react");function Ma(e){const{data:t,rawData:n,colorBy:o,colorScheme:r,legendInteraction:i,legendPosition:s,selection:a,linkedHover:l,fallbackFields:c,unwrapData:u=!1,onObservation:d,chartType:h,chartId:f,showLegend:m,userMargin:g,marginDefaults:y,onClick:p,hoverHighlight:b,mobileInteraction:v,mobileSemantics:x,loading:w,loadingContent:k,emptyContent:S,width:M,height:C}=e,j=void 0===n,_=(0,Sa.useMemo)(()=>A(t),[t]),[R,P]=(0,Sa.useState)([]),L=(0,Sa.useCallback)(e=>{P(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[]),I="string"==typeof e.colorBy?e.colorBy:void 0,T=(0,Sa.useMemo)(()=>Zs(v,{width:M,mobileSemantics:x}),[v,M,x]),{activeSelectionHook:$,hoverSelectionHook:B,customHoverBehavior:H,customClickBehavior:O,crosshairSourceId:F}=function({selection:e,linkedHover:t,fallbackFields:n=Ks,unwrapData:o=!1,onObservation:r,chartType:i,chartId:s,onClick:a,hoverHighlight:l,colorByField:c,mobileInteraction:u}){const d=(0,bs.useId)(),h=(0,bs.useMemo)(()=>function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField,seriesField:e.seriesField}:null}(t,n),[t,n]),f=(0,bs.useMemo)(()=>"series"===h?.mode?[h.seriesField||c||n[0]].filter(e=>!!e):h?.fields||n,[h,c,n]),m=$s({name:e?.name||"__unused__",fields:f}),g=function(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:r,selectPoints:i,clear:s}=$s({name:t,fields:n});return{onHover:(0,_s.useCallback)(e=>{if(!e)return void s();const t={};for(const o of n){const n=e[o];void 0!==n&&(t[o]=[n])}Hs(t)&&i(t)},[n,i,s]),predicate:o,isActive:r}}({name:h?.name||"hover",fields:f}),y=_n(e=>e.pushObservation),p=(0,bs.useCallback)(e=>{r?.(e),y?.(e)},[r,y]),b=e?{isActive:m.isActive,predicate:m.predicate}:null,[v,x]=(0,bs.useState)(null),w=(0,bs.useRef)(!1),k=c||n[0],S=(0,bs.useMemo)(()=>{if(!l||null==v||!k)return null;const e=v,t=k;return{isActive:!0,predicate:n=>("string"==typeof n[t]?n[t]:(n[t]??"")+"")===e}},[l,v,k]),A=(0,bs.useCallback)((e,n)=>{const o=!e&&w.current&&!!u?.enabled&&u.tapToLockTooltip;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===h?.mode&&h.xField){const n=Xs(e,t,h.xField);null!=n&&function(e,t,n){const o=Rs.positions.get(e);o?.locked||o&&o.xValue===t&&o.sourceId===n||(Rs={positions:new Map(Rs.positions).set(e,{xValue:t,sourceId:n})},Ls())}(h.name||"hover",n,d)}"x-position"!==h?.mode&&g.onHover(t)}else"x-position"!==h?.mode||o||Is(h.name||"hover",d),"x-position"===h?.mode||o||g.onHover(null);if(l&&k)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=t?.[k];x(null!=n?n+"":null)}else o||x(null);(r||y)&&os({onObservation:p,datum:e?Ys(e):null,x:e?.x,y:e?.y,chartType:i||"unknown",chartId:s,context:n})},[t,g,h,d,r,i,s,y,p,l,k,u]),M=(0,bs.useCallback)((n=!0)=>{w.current=!1,t&&"x-position"!==h?.mode&&g.onHover(null),e&&u?.tapToSelect&&m.clear(),n&&l&&x(null),"x-position"===h?.mode&&(Ts(h.name||"hover",d),Is(h.name||"hover",d))},[t,h,g,e,u,m,l,d]),C=(0,bs.useCallback)((n,o)=>{const c=!!u?.enabled&&(u.tapToLockTooltip||u.tapToSelect),b=!!u?.enabled&&"backgroundTap"===u.clearSelection;if("x-position"===h?.mode&&h.xField&&n){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]);const t=Xs(n,e,h.xField);null!=t&&function(e,t,n){const o=Rs.positions.get(e);if(o?.locked){const t=new Map(Rs.positions);return t.delete(e),Rs={positions:t},Ls(),!1}Rs={positions:new Map(Rs.positions).set(e,{xValue:t,sourceId:n,locked:!0})},Ls()}(h.name||"hover",t,d)}if(c)if(n){w.current=!0;const o=Ys(n);if(t&&"x-position"!==h?.mode&&g.onHover(o),e&&u?.tapToSelect&&f.length>0){const e={};for(const t of f){const n=o[t];void 0!==n&&(e[t]=[n])}Us(e)&&m.selectPoints(e)}if(l&&k){const e=o?.[k];x(null!=e?e+"":null)}}else b&&M();if(n||b){if(n&&a){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]),a(e,{x:n.x??0,y:n.y??0})}(r||y)&&rs({onObservation:p,datum:n?Ys(n):null,x:n?.x,y:n?.y,chartType:i||"unknown",chartId:s,context:o})}},[a,r,y,p,i,s,h,d,u,t,g,e,m,f,l,k,M]);return(0,bs.useEffect)(()=>{if(!u?.enabled||"undefined"==typeof document)return;const e=e=>{"Escape"===e.key&&w.current&&M()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[u?.enabled,M]),(0,bs.useEffect)(()=>()=>{w.current&&M(!1)},[M]),(0,bs.useEffect)(()=>{if("x-position"!==h?.mode)return;const e=h.name||"hover";return()=>{Ts(e,d),Is(e,d)}},[h?.mode,h?.name,d]),{activeSelectionHook:b,hoverSelectionHook:S,customHoverBehavior:A,customClickBehavior:C,crosshairSourceId:d}}({selection:a,linkedHover:l,fallbackFields:c,unwrapData:u,onObservation:d,chartType:h,chartId:f,onClick:p,hoverHighlight:b,colorByField:I,mobileInteraction:T}),E=function(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===n?.mode)return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}(l,F),D=function(e,t,n){const o=ws(),r=Js();return(0,bs.useMemo)(()=>{if(!t)return;const i=o??void 0,s=n??(r&&r.length>0?r:void 0)??"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>t(e)+"")));if(i&&Us(i)){const e=ae(n.map(e=>({_cat:e})),"_cat",s);return t=>i[t]||e(t)}return ae(n.map(e=>({_cat:e})),"_cat",s)}if(i&&Us(i)){const n=ae(e,t,s);return e=>i[e]||n(e)}return ae(e,t,s)}if(i&&Us(i)){const e=ae([{_:"a"}],"_",s);return t=>i[t]||e(t)}},[e,t,n,o,r])}(_,o,r),W=(0,Sa.useMemo)(()=>{if(!o)return[];const e=new Set;for(const t of _){const n="function"==typeof o?o(t):t[o];null!=n&&e.add(n+"")}return Array.from(e)},[_,o]),N=(0,Sa.useMemo)(()=>j&&R.length>0?R:W,[j,R,W]),z=function(e,t,n){const[o,r]=(0,bs.useState)(null),[i,s]=(0,bs.useState)(new Set),a=(0,bs.useMemo)(()=>new Set,[]),l=(0,bs.useCallback)(t=>{"highlight"===e&&r(t?t.label:null)},[e]),c=(0,bs.useCallback)(t=>{"isolate"===e&&s(e=>{const o=new Set(e);return o.has(t.label)?o.delete(t.label):o.add(t.label),o.size===n.length?new Set:o})},[e,n.length]),u=(0,bs.useMemo)(()=>{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&&i.size>0?{isActive:!0,predicate:e=>{const o=n?e[n]:"function"==typeof t?t(e):null;return i.has(o)}}:null},[e,t,o,i]);return{highlightedCategory:"highlight"===e?o:null,isolatedCategories:"isolate"===e?i:a,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}(i,o,N),q=(0,Sa.useMemo)(()=>B||(z.legendSelectionHook?z.legendSelectionHook:$),[B,z.legendSelectionHook,$]),G=function(e){const t=Gr(e=>e.theme.colors.selectionOpacity);return(0,Aa.useMemo)(()=>{if(void 0!==e||void 0!==t)return{name:e?.name??"",...e,unselectedOpacity:e?.unselectedOpacity??t}},[e,t])}(a),V=Js(),X=ws(),Y=(0,Sa.useMemo)(()=>{if(D)return D;if(!o||0===N.length)return;const e=Array.isArray(r)&&r.length>0||"string"==typeof r&&r.length>0?r:V&&V.length>0?V:oe,t="__streamCat",n=ae(N.map(e=>({[t]:e})),t,e);return e=>X?.[e]||n(e)||"#999"},[D,o,N,r,V,X]),{legend:U,margin:K,legendPosition:Q}=function({data:e,colorBy:t,colorScale:n,showLegend:o,legendPosition:r="right",userMargin:i,defaults:s={top:50,bottom:60,left:70,right:40},categories:a}){const l=(0,ks.useContext)(Os),c=null!==(0,ks.useContext)(Fs),u=void 0!==o?o:!l&&!!t,d=!!t&&(u||c),h=(0,bs.useMemo)(()=>{if(!d)return[];if(void 0!==a)return a;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)},[a,t,e,d]);Ds(c&&t?h:[]);const f=(0,bs.useMemo)(()=>{if(!u||!t)return;const o=Ws({data:e,colorBy:t,colorScale:n,getColor:ie,categories:h});return 0!==o.legendGroups.reduce((e,t)=>e+t.items.length,0)?o:void 0},[u,t,e,n,h]),m=(0,bs.useMemo)(()=>{const e="number"==typeof i?{top:i,bottom:i,left:i,right:i}:i??{},t=t=>{const n=e[t];return"number"==typeof n?n:s[t]},n={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},o=t=>"number"==typeof e[t];return f&&("right"===r&&!o("right")&&110>n.right?n.right=110:"left"===r&&!o("left")&&110>n.left?n.left=110:"top"===r&&!o("top")&&50>n.top?n.top=50:"bottom"===r&&!o("bottom")&&80>n.bottom&&(n.bottom=80)),n},[s,i,f,r]);return{legend:f,margin:m,legendPosition:r}}({data:_,colorBy:o,colorScale:Y,showLegend:m,legendPosition:s,userMargin:g,defaults:y,categories:N}),Z=(0,Sa.useMemo)(()=>{const e={};return U&&(e.legend=U,e.legendPosition=Q),i&&"none"!==i&&(e.legendHoverBehavior=z.onLegendHover,e.legendClickBehavior=z.onLegendClick,e.legendHighlightedCategory=z.highlightedCategory,e.legendIsolatedCategories=z.isolatedCategories),j&&o&&(e.legendCategoryAccessor=o,e.onCategoriesChange=L),e},[U,Q,i,z.onLegendHover,z.onLegendClick,z.highlightedCategory,z.isolatedCategories,j,o,L]),J=Array.isArray(n)?A(n):n,ee=function(e,t,n,o){if(!e)return null;if(!1===o)return null;if(null!=o)return(0,ma.jsx)("div",{style:{width:t,height:n,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:o});const r=Math.min(5,Math.floor(n/40)),i=Math.max(8,Math.floor(n/(3*r))),s=Math.max(6,Math.floor(n/(2.5*r))),a=Math.floor((n-(r*(i+s)-s))/2);return(0,ma.jsx)("div",{style:{width:t,height:n,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:r},(e,n)=>(0,ma.jsx)("div",{className:"semiotic-loading-bar",style:{...ba,position:"absolute",top:a+n*(i+s),left:Math.floor(.1*t),width:30+(37*n+13)%50+"%",height:i,opacity:.5+n%2*.2}},n))})}(w,M,C,k),te=ee?null:function(e,t,n,o){return!1===o||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?(0,ma.jsx)("div",{style:{...pa,width:t,height:n},children:o||"No data available"}):null}(J,M,C,S);return{data:_,colorScale:D,allCategories:N,legendState:z,effectiveSelectionHook:q,activeSelectionHook:$,customHoverBehavior:H,customClickBehavior:O,mobileInteraction:T,legend:U,margin:K,legendPosition:Q,earlyReturn:ee||te||null,legendBehaviorProps:Z,crosshairProps:E,resolvedSelection:G}}var Ca=require("react");function ja({ref:e,frameRef:t,setup:n}){return(0,Ca.useImperativeHandle)(e,()=>({push:e=>t.current?.push(e),pushMany:e=>t.current?.pushMany(e),remove:e=>t.current?.remove(e)??[],update:(e,n)=>t.current?.update(e,n)??[],clear:()=>t.current?.clear(),getData:()=>t.current?.getData()??[],getScales:()=>t.current?.getScales()??null}),[t]),{effectiveLegendProps:n.legendBehaviorProps,effectiveMargin:n.margin}}var _a=require("react");function Ra(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return e??((...e)=>({}));const n={};return void 0!==t.stroke&&(n.stroke=t.stroke),void 0!==t.strokeWidth&&(n.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(n.opacity=t.opacity),e?(...t)=>({...e(...t)||{},...n}):(...e)=>({...n})}function Pa(e){if(null==e)return()=>{};const t="function"==typeof e?e:t=>t[e];return e=>Ta(t(e))}function La(e,t){const n=Pa(e),o=Pa(t);return(e,t)=>{const r=o(e);return{value:r,x:n(e),y:r,category:t}}}function Ia(e,t){const n=Pa(t??"value"),o=null==e?void 0:"function"==typeof e?e:t=>t[e];return e=>{const t=o?o(e):void 0;return{value:n(e),category:null==t?void 0:t+""}}}function Ta(e){if("number"==typeof e)return Number.isFinite(e)?e:void 0;if("string"==typeof e&&""!==e.trim()){const t=Number(e);return Number.isFinite(t)?t:void 0}}function $a(e,t,n){const o=null!=e.axis?n[e.axis]:null!=e.field?t[e.field]:n.value;if(void 0!==e.eq&&o!==e.eq)return!1;if(void 0!==e.ne&&o===e.ne)return!1;if(void 0!==e.in&&!e.in.includes(o))return!1;if(void 0===e.gt&&void 0===e.gte&&void 0===e.lt&&void 0===e.lte&&void 0===e.within&&void 0===e.outside)return!0;const r=Ta(o);if(void 0===r)return!1;if(void 0!==e.gt&&e.gt>=r)return!1;if(void 0!==e.gte&&e.gte>r)return!1;if(void 0!==e.lt&&r>=e.lt)return!1;if(void 0!==e.lte&&r>e.lte)return!1;if(void 0!==e.within){const[t,n]=e.within;if(t>r||r>n)return!1}if(void 0!==e.outside){const[t,n]=e.outside;if(r>=t&&n>=r)return!1}return!0}function Ba(e,t,n){const o=e.when;return void 0===o||!0===o||!1!==o&&("function"==typeof o?o(t,n):$a(o,t,n))}function Ha(e,t,n){if(!t||0===t.length)return{};let o={};for(const r of t){if(!Ba(r,e,n))continue;const t="function"==typeof r.style?r.style(e,n):r.style;t&&(o={...o,...t})}return o}function Oa(e,t,n,o=e=>e){const r=e??(()=>({}));return t&&0!==t.length?(e,i)=>{const s=o(e),a={...r(e,i)};return Object.assign(a,Ha(s,t,n(s,i))),a}:r}function Fa(e,t,n){return e&&0!==e.length?(o,r)=>{const i=Ha(o,e,t(o,r)),s=n?n(o,r):void 0;return s?{...i,...s}:i}:n}function Ea(e){const{colorBy:t,colorScale:n,color:o,themeCategorical:r,colorScheme:i,categoryIndexMap:s,userPieceStyle:a,stroke:l,strokeWidth:c,opacity:u,effectiveSelectionHook:d,resolvedSelection:h,cycleByCategory:f=!1,baseStyleExtras:m,linkStrokeToFill:g=!1,styleRules:y,resolveRuleValue:p}=e,b=(0,_a.useMemo)(()=>(e,a)=>{const l="function"==typeof m?m(e,a):m,c=l?{...l}:{};if(void 0===c.fill)if(t){if(!n)return c;c.fill=ie(e,t,n)}else c.fill=function(e,t,n,o,r){if(e)return e;if(n&&"object"==typeof n&&!Array.isArray(n)){const e=se(n,o);if(e)return e}let i;if(Array.isArray(n))i=n;else if(t&&t.length>0)i=t;else if("string"==typeof n){const e=te[n];Array.isArray(e)&&(i=e)}return i&&0!==i.length?null!=o?(r.has(o)||r.set(o,r.size),i[r.get(o)%i.length]):i[0]:"#007bff"}(o,r,i,f?a:void 0,s);if(y&&y.length>0){const t=Ha(e,y,{value:p?p(e):void 0,category:a});Object.assign(c,t)}return g&&void 0===c.stroke&&void 0!==c.fill&&(c.stroke=c.fill),c},[t,n,o,r,i,s,f,m,g,y,p]),v=(0,_a.useMemo)(()=>Ra(a?"function"==typeof a?(e,t)=>({...b(e,t),...a(e,t)||{}}):(e,t)=>({...b(e,t),...a}):b,{stroke:l,strokeWidth:c,opacity:u}),[b,a,l,c,u]);return(0,_a.useMemo)(()=>{return e=v,n=h,(t=d??null)?(o,...r)=>{const i={...e(o,...r)};if(t.isActive)if(t.predicate(o))n?.selectedStyle&&Object.assign(i,n.selectedStyle);else{const e=n?.unselectedOpacity??.5;i.opacity=e,i.fillOpacity=e,i.strokeOpacity=e,n?.unselectedStyle&&Object.assign(i,n.unselectedStyle)}return i}:e;var e,t,n},[v,d,h])}function Da(e){if(!e)return;const t="boolean"==typeof e?{}:"string"==typeof e?{method:e}:e;return{type:"trend",method:t.method??"linear",...null!=t.bandwidth&&{bandwidth:t.bandwidth},...null!=t.order&&{order:t.order},...null!=t.color&&{color:t.color},...null!=t.strokeWidth&&{strokeWidth:t.strokeWidth},...null!=t.strokeDasharray&&{strokeDasharray:t.strokeDasharray},...null!=t.label&&{label:t.label}}}var Wa=require("react/jsx-runtime"),Na=(0,ps.forwardRef)(function(e,t){const n=na(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}),o=(0,ps.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="vertical",valueFormat:u,colorBy:d,colorScheme:h,sort:f=!1,barPadding:m=40,roundedTop:g,gradientFill:y=!1,styleRules:p,baselinePadding:b=!1,tooltip:v,annotations:x,regression:w,valueExtent:k,frameProps:S={},selection:M,linkedHover:C,onObservation:j,onClick:_,hoverHighlight:R,chartId:P,loading:L,loadingContent:I,emptyContent:T,legendInteraction:$,legendPosition:B,color:H,stroke:O,strokeWidth:F,opacity:E,showCategoryTicks:D,categoryFormat:W,dataIdAccessor:N}=e,{width:z,height:q,enableHover:G,showGrid:V,showLegend:X,title:Y,description:U,summary:K,accessibleTable:Q,categoryLabel:Z,valueLabel:J}=n,ee=(0,ps.useMemo)(()=>A(r),[r]),te=Ma({data:ee,rawData:r,colorBy:d,colorScheme:h,legendInteraction:$,legendPosition:B,selection:M,linkedHover:C,fallbackFields:d?["string"==typeof d?d:""]:[],unwrapData:!0,onObservation:j,onClick:_,hoverHighlight:R,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"BarChart",chartId:P,showLegend:X,userMargin:i,marginDefaults:n.marginDefaults,loading:L,loadingContent:I,emptyContent:T,width:z,height:q}),{effectiveLegendProps:ne,effectiveMargin:oe}=ja({ref:t,frameRef:o,setup:te});va("BarChart",ee,"categoryAccessor",a),va("BarChart",ee,"valueAccessor",l);const re=ea(ee,f,l),ie=Js(),se=(0,ps.useMemo)(()=>new Map,[]),ae=(0,ps.useMemo)(()=>Pa(l),[l]),le=Ea({colorBy:d,colorScale:te.colorScale,color:H,themeCategorical:ie,colorScheme:h,categoryIndexMap:se,userPieceStyle:S?.pieceStyle,stroke:O,strokeWidth:F,opacity:E,styleRules:p,resolveRuleValue:ae,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection}),ce=(0,ps.useMemo)(()=>la({categoryAccessor:a,valueAccessor:l,groupAccessor:d&&d!==a?d:void 0,groupLabel:"string"==typeof d?d:"group",valueFormat:u}),[a,l,d,u]);if(te.earlyReturn)return te.earlyReturn;const ue=ka({componentName:"BarChart",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(ue)return(0,Wa.jsx)(ua,{componentName:"BarChart",message:ue,width:z,height:q});const de=Da(w),he=de?[de,...x||[]]:x,fe={chartType:"bar",...null!=r&&{data:re},oAccessor:a,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",pieceStyle:le,size:[z,q],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:oe,barPadding:m,...null!=g&&{roundedTop:g},...y&&{gradientFill:!0===y?{topOpacity:.8,bottomOpacity:.05}:y},...N&&{dataIdAccessor:N},baselinePadding:b,enableHover:G,showAxes:n.showAxes,oLabel:Z,rLabel:J,rFormat:u,...W&&{oFormat:W},showGrid:V,showCategoryTicks:D,oSort:f,...ne,...ms({title:Y,description:U,summary:K,accessibleTable:Q,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...ys({tooltip:v,defaultTooltipContent:ce}),...gs({linkedHover:C,selection:M,onObservation:j,onClick:_,hoverHighlight:R,mobileInteraction:te.mobileInteraction,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior}),...he&&he.length>0&&{annotations:he},...k&&{rExtent:k},...Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e))};return(0,Wa.jsx)(ya,{componentName:"BarChart",width:z,height:q,children:(0,Wa.jsx)(fs,{ref:o,...fe})})});Na.displayName="BarChart";var za=require("react"),qa=require("react/jsx-runtime"),Ga=(0,za.forwardRef)(function(e,t){const n=na(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}),o=(0,za.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="category",stackBy:l,valueAccessor:c="value",orientation:u="vertical",valueFormat:d,colorBy:h,colorScheme:f,normalize:m=!1,sort:g=!1,barPadding:y=40,roundedTop:p,styleRules:b,baselinePadding:v=!1,tooltip:x,annotations:w,valueExtent:k,frameProps:S={},selection:M,linkedHover:C,onObservation:j,onClick:_,hoverHighlight:R,chartId:P,loading:L,loadingContent:I,emptyContent:T,legendInteraction:$,legendPosition:B,color:H,stroke:O,strokeWidth:F,opacity:E,categoryFormat:D}=e,{width:W,height:N,enableHover:z,showGrid:q,showLegend:G,title:V,description:X,summary:Y,accessibleTable:U,categoryLabel:K,valueLabel:Q}=n,Z=(0,za.useMemo)(()=>A(r),[r]),J=h||l,ee=Ma({data:Z,rawData:r,colorBy:J,colorScheme:f,legendInteraction:$,legendPosition:B,selection:M,linkedHover:C,fallbackFields:J?["string"==typeof J?J:""]:[],unwrapData:!0,onObservation:j,onClick:_,hoverHighlight:R,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"StackedBarChart",chartId:P,showLegend:G,userMargin:i,marginDefaults:n.marginDefaults,loading:L,loadingContent:I,emptyContent:T,width:W,height:N}),te=Js(),ne=(0,za.useMemo)(()=>new Map,[]),oe=(0,za.useMemo)(()=>Pa(c),[c]),re=Ea({colorBy:J,colorScale:ee.colorScale,color:H,themeCategorical:te,colorScheme:f,categoryIndexMap:ne,userPieceStyle:S?.pieceStyle,stroke:O,strokeWidth:F,opacity:E,styleRules:b,resolveRuleValue:oe,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection}),ie=(0,za.useMemo)(()=>la({categoryAccessor:l,valueAccessor:c,groupAccessor:a,valueFormat:d}),[l,a,c,d]),se=ka({componentName:"StackedBarChart",data:r,accessors:{categoryAccessor:a,valueAccessor:c},requiredProps:{stackBy:l}}),{effectiveLegendProps:ae,effectiveMargin:le}=ja({ref:t,frameRef:o,setup:ee});if(ee.earlyReturn)return ee.earlyReturn;const ce={chartType:"bar",...null!=r&&{data:Z},oAccessor:a,rAccessor:c,stackBy:l,normalize:m,oSort:g,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:re,size:[W,N],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:le,barPadding:y,...null!=p&&{roundedTop:p},baselinePadding:v,enableHover:z,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:n.showAxes,oLabel:K,rLabel:Q,rFormat:d,...D&&{oFormat:D},showGrid:q,...ae,...ms({title:V,description:X,summary:Y,accessibleTable:U,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...ys({tooltip:x,defaultTooltipContent:ie}),...gs({linkedHover:C,selection:M,onObservation:j,onClick:_,hoverHighlight:R,mobileInteraction:ee.mobileInteraction,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior}),...w&&w.length>0&&{annotations:w},...k&&{rExtent:k},...Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e))};return se?(0,qa.jsx)(ua,{componentName:"StackedBarChart",message:se,width:W,height:N}):(0,qa.jsx)(ya,{componentName:"StackedBarChart",width:W,height:N,children:(0,qa.jsx)(fs,{ref:o,...ce})})});Ga.displayName="StackedBarChart";var Va=require("react"),Xa=require("react/jsx-runtime"),Ya=(0,Va.forwardRef)(function(e,t){const n=na(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}),o=(0,Va.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="category",groupBy:l,valueAccessor:c="value",orientation:u="vertical",valueFormat:d,colorBy:h,colorScheme:f,sort:m=!1,barPadding:g=60,roundedTop:y,styleRules:p,baselinePadding:b=!1,tooltip:v,annotations:x,valueExtent:w,frameProps:k={},selection:S,linkedHover:M,onObservation:C,onClick:j,hoverHighlight:_,chartId:R,loading:P,loadingContent:L,emptyContent:I,legendInteraction:T,legendPosition:$,color:B,stroke:H,strokeWidth:O,opacity:F,categoryFormat:E}=e,{width:D,height:W,enableHover:N,showGrid:z,showLegend:q,title:G,description:V,summary:X,accessibleTable:Y,categoryLabel:U,valueLabel:K}=n,Q=(0,Va.useMemo)(()=>A(r),[r]),Z=h||l,J=Ma({data:Q,rawData:r,colorBy:Z,colorScheme:f,legendInteraction:T,legendPosition:$,selection:S,linkedHover:M,fallbackFields:Z?["string"==typeof Z?Z:""]:[],unwrapData:!0,onObservation:C,onClick:j,hoverHighlight:_,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"GroupedBarChart",chartId:R,showLegend:q,userMargin:i,marginDefaults:n.marginDefaults,loading:P,loadingContent:L,emptyContent:I,width:D,height:W}),ee=Js(),te=(0,Va.useMemo)(()=>new Map,[]),ne=(0,Va.useMemo)(()=>Pa(c),[c]),oe=Ea({colorBy:Z,colorScale:J.colorScale,color:B,themeCategorical:ee,colorScheme:f,categoryIndexMap:te,userPieceStyle:k.pieceStyle,stroke:H,strokeWidth:O,opacity:F,styleRules:p,resolveRuleValue:ne,effectiveSelectionHook:J.effectiveSelectionHook,resolvedSelection:J.resolvedSelection}),re=(0,Va.useMemo)(()=>la({categoryAccessor:l,valueAccessor:c,groupAccessor:a,valueFormat:d}),[l,a,c,d]),ie=ka({componentName:"GroupedBarChart",data:r,accessors:{categoryAccessor:a,valueAccessor:c},requiredProps:{groupBy:l}}),{effectiveLegendProps:se,effectiveMargin:ae}=ja({ref:t,frameRef:o,setup:J});if(J.earlyReturn)return J.earlyReturn;const le={chartType:"clusterbar",...null!=r&&{data:Q},oAccessor:a,rAccessor:c,groupBy:l,oSort:m,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:oe,size:[D,W],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ae,barPadding:g,...null!=y&&{roundedTop:y},baselinePadding:b,enableHover:N,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:n.showAxes,oLabel:U,rLabel:K,rFormat:d,...E&&{oFormat:E},showGrid:z,...se,...ms({title:G,description:V,summary:X,accessibleTable:Y,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...ys({tooltip:v,defaultTooltipContent:re}),...gs({linkedHover:M,selection:S,onObservation:C,onClick:j,hoverHighlight:_,mobileInteraction:J.mobileInteraction,customHoverBehavior:J.customHoverBehavior,customClickBehavior:J.customClickBehavior}),...x&&x.length>0&&{annotations:x},...w&&{rExtent:w},...Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e))};return ie?(0,Xa.jsx)(ua,{componentName:"GroupedBarChart",message:ie,width:D,height:W}):(0,Xa.jsx)(ya,{componentName:"GroupedBarChart",width:D,height:W,children:(0,Xa.jsx)(fs,{ref:o,...le})})});Ya.displayName="GroupedBarChart";var Ua=require("react"),Ka=require("react");function Qa({brushProp:e,onBrushProp:t,linkedBrush:n,valueAccessor:o}){const r=(i="string"==typeof n?n:n?{name:n.name,xField:n.rField}:void 0)?"string"==typeof i?{name:i}:i:null;var i;const s="string"==typeof o?o:"value",a=function(e){const{name:t,xField:n,yField:o}=e,{predicate:r,isActive:i,selectInterval:s,clear:a}=$s({name:t,fields:[n,o].filter(Boolean)}),l=n&&o?"xyBrush":n?"xBrush":"yBrush",c=(0,_s.useCallback)(e=>{if(!e)return void a();const t={};"xyBrush"===l&&function(e){return 2===e.length&&Array.isArray(e[0])&&2===e[0].length&&Array.isArray(e[1])&&2===e[1].length}(e)?(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"===l&&Bs(e)?n&&(t[n]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]):"yBrush"===l&&Bs(e)&&o&&(t[o]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]),Hs(t)&&s(t)},[l,n,o,s,a]);return{brushInteraction:(0,_s.useMemo)(()=>({brush:l,during:c,end:c}),[l,c]),predicate:r,isActive:i,clear:a}}({name:r?.name||"__unused_ordinal_brush__",xField:r?.xField||s}),l=(0,Ka.useRef)(a.brushInteraction);l.current=a.brushInteraction;const c=(0,Ka.useCallback)(e=>{if(r){l.current.end(e?e.r:null)}t?.(e)},[t,r]),u=!!(e||n||t);return{hasBrush:u,handleBrush:c,brushStreamProps:u?{brush:{dimension:"r"},onBrush:c}:{}}}var Za=require("react/jsx-runtime"),Ja=(0,Ua.forwardRef)(function(e,t){const n=na(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}),o=(0,Ua.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="category",subcategoryAccessor:l,valueAccessor:c="value",orientation:u="horizontal",valueFormat:d,colorBy:h,colorScheme:f,barPadding:m,tooltip:g,annotations:y,brush:p,onBrush:b,linkedBrush:v,frameProps:x={},selection:w,linkedHover:k,onObservation:S,onClick:M,hoverHighlight:C,chartId:j,loading:_,loadingContent:R,emptyContent:P,legendInteraction:L,legendPosition:I,color:T,stroke:$,strokeWidth:B,opacity:H,categoryFormat:O,rTickValues:F,tickLabelEdgeAlign:E,showCategoryTicks:D,gradientFill:W,trackFill:N,roundedTop:z,valueExtent:q}=e,{width:G,height:V,enableHover:X,showGrid:Y,showLegend:U,title:K,description:Q,summary:Z,accessibleTable:J,categoryLabel:ee,valueLabel:te}=n,ne=(0,Ua.useMemo)(()=>A(r),[r]),oe=h||l,re=(0,Ua.useMemo)(()=>{if(null!=m)return m;if("sparkline"!==e.mode)return 40;const t=new Set(ne.map(e=>"function"==typeof a?a(e):e[a])),n=Math.max(1,t.size);return n>1?Math.max(0,Math.min(1,(("horizontal"===u?V:G)-2*n)/(n-1))):1},[m,e.mode,ne,a,u,G,V]),ie=Ma({data:ne,rawData:r,colorBy:oe,colorScheme:f,legendInteraction:L,legendPosition:I,selection:w,linkedHover:k,fallbackFields:oe?["string"==typeof oe?oe:""]:[],unwrapData:!0,onObservation:S,onClick:M,hoverHighlight:C,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"SwimlaneChart",chartId:j,showLegend:U,userMargin:i,marginDefaults:n.marginDefaults,loading:_,loadingContent:R,emptyContent:P,width:G,height:V}),se=Qa({brushProp:p,onBrushProp:b,linkedBrush:v,valueAccessor:c}),ae=Js(),le=(0,Ua.useMemo)(()=>new Map,[]),ce=Ea({colorBy:oe,colorScale:ie.colorScale,color:T,themeCategorical:ae,colorScheme:f,categoryIndexMap:le,userPieceStyle:x?.pieceStyle,stroke:$,strokeWidth:B,opacity:H,effectiveSelectionHook:ie.effectiveSelectionHook,resolvedSelection:ie.resolvedSelection,cycleByCategory:!0}),ue=(0,Ua.useMemo)(()=>la({categoryAccessor:l,valueAccessor:c,groupAccessor:a,valueFormat:d}),[l,a,c,d]),de=ka({componentName:"SwimlaneChart",data:r,accessors:{categoryAccessor:a,valueAccessor:c,subcategoryAccessor:l},requiredProps:{subcategoryAccessor:l}}),{effectiveLegendProps:he,effectiveMargin:fe}=ja({ref:t,frameRef:o,setup:ie});if(ie.earlyReturn)return ie.earlyReturn;const me={chartType:"swimlane",...null!=r&&{data:ne},oAccessor:a,rAccessor:c,stackBy:l,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:ce,size:[G,V],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:fe,barPadding:re,enableHover:X,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:n.showAxes,oLabel:!1===D?void 0:ee,rLabel:te,rFormat:d,...F&&{rTickValues:F},...null!=E&&{tickLabelEdgeAlign:E},...O&&{oFormat:O},...void 0!==D&&{showCategoryTicks:D},showGrid:Y,...he,...ms({title:K,description:Q,summary:Z,accessibleTable:J,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...ys({tooltip:g,defaultTooltipContent:ue}),...gs({linkedHover:k,selection:w,onObservation:S,onClick:M,hoverHighlight:C,mobileInteraction:ie.mobileInteraction,customHoverBehavior:ie.customHoverBehavior,customClickBehavior:ie.customClickBehavior}),...y&&y.length>0&&{annotations:y},...W&&{gradientFill:!0===W?{topOpacity:.8,bottomOpacity:.05}:W},...null!=N&&{trackFill:N},...null!=z&&{roundedTop:z},...q&&{rExtent:q},...se.brushStreamProps,...Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e))};return de?(0,Za.jsx)(ua,{componentName:"SwimlaneChart",message:de,width:G,height:V}):(0,Za.jsx)(ya,{componentName:"SwimlaneChart",width:G,height:V,children:(0,Za.jsx)(fs,{ref:o,...me})})});Ja.displayName="SwimlaneChart";var el=require("react"),tl=require("react");function nl(e,t){const{variant:n,frameRef:o,overrides:r}=t;(0,tl.useImperativeHandle)(e,()=>{const e=function(e,t){if("xy"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>e.current?.remove(t)??[],update:(t,n)=>e.current?.update(t,n)??[],clear:()=>e.current?.clear(),getData:()=>e.current?.getData()??[],getScales:()=>e.current?.getScales()??null,getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}if("network"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>{const n=Array.isArray(t)?t:[t],o=e.current?.getTopology()?.nodes??[],r=[];for(const t of n){const n=o.find(e=>e.id===t);n&&r.push({...n.data??{},id:t}),e.current?.removeNode(t)}return r},update:(t,n)=>(Array.isArray(t)?t:[t]).flatMap(t=>{const o=e.current?.updateNode(t,n);return o?[{...o,id:t}]:[]}),clear:()=>e.current?.clear(),getData:()=>e.current?.getTopology()?.nodes?.map(e=>e.data)??[],getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}if("geo-points"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>e.current?.removePoint(t)??[],update:(t,n)=>{const o=e.current?.removePoint(t)??[];for(const t of o)e.current?.push(n(t));return o},clear:()=>e.current?.clear(),getData:()=>e.current?.getData()??[],getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}const n=t;return{push:e=>n.current?.pushLine(e),pushMany:e=>n.current?.pushManyLines(e),remove:e=>n.current?.removeLine(e)??[],update:(e,t)=>{const o=n.current?.removeLine(e)??[];for(const e of o)n.current?.pushLine(t(e));return o},clear:()=>n.current?.clear(),getData:()=>n.current?.getLines()??[],getCustomLayout:()=>n.current?.getCustomLayout?.()??null,getLayoutFailure:()=>n.current?.getLayoutFailure?.()??null}}(n,o);return{...e,...r}},[o,r,n])}var ol=require("react/jsx-runtime"),rl=(0,el.forwardRef)(function(e,t){const n=na(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}),o=(0,el.useRef)(null);nl(t,{variant:"xy",frameRef:o});const{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="vertical",valueFormat:u,colorBy:d,colorScheme:h,sizeBy:f,sizeRange:m=[3,8],symbolBy:g,symbolMap:y,pointRadius:p=4,pointOpacity:b=.7,categoryPadding:v=20,tooltip:x,annotations:w,valueExtent:k,brush:S,onBrush:M,linkedBrush:C,frameProps:j={},selection:_,linkedHover:R,onObservation:P,onClick:L,hoverHighlight:I,chartId:T,loading:$,loadingContent:B,emptyContent:H,legendInteraction:O,legendPosition:F,color:E,stroke:D,strokeWidth:W,opacity:N,showCategoryTicks:z,categoryFormat:q}=e,{width:G,height:V,enableHover:X,showGrid:Y,showLegend:U,title:K,description:Q,summary:Z,accessibleTable:J,categoryLabel:ee,valueLabel:te}=n,ne=(0,el.useMemo)(()=>A(r),[r]),oe=Ma({data:ne,rawData:r,colorBy:d,colorScheme:h,legendInteraction:O,legendPosition:F,selection:_,linkedHover:R,fallbackFields:d?["string"==typeof d?d:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:P,onClick:L,hoverHighlight:I,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"SwarmPlot",chartId:T,showLegend:U,userMargin:i,marginDefaults:n.marginDefaults,loading:$,loadingContent:B,emptyContent:H,width:G,height:V}),re=Qa({brushProp:S,onBrushProp:M,linkedBrush:C,valueAccessor:l}),ie=(0,el.useMemo)(()=>{if(f)return xe(ne.map(e=>"function"==typeof f?f(e):e[f]))},[ne,f]),se=Js(),ae=(0,el.useMemo)(()=>new Map,[]),ce=Ea({colorBy:d,colorScale:oe.colorScale,color:E,themeCategorical:se,colorScheme:h,categoryIndexMap:ae,userPieceStyle:j?.pieceStyle,stroke:D,strokeWidth:W,opacity:N,effectiveSelectionHook:oe.effectiveSelectionHook,resolvedSelection:oe.resolvedSelection,baseStyleExtras:e=>({fillOpacity:b,r:f?le(e,f,m,ie):p})}),ue=(0,el.useMemo)(()=>la({categoryAccessor:a,valueAccessor:l,groupAccessor:d||void 0,valueFormat:u}),[a,l,d,u]);if(oe.earlyReturn)return oe.earlyReturn;const de=ka({componentName:"SwarmPlot",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(de)return(0,ol.jsx)(ua,{componentName:"SwarmPlot",message:de,width:G,height:V});const he={chartType:"swarm",...null!=r&&{data:ne},oAccessor:a,rAccessor:l,...g&&{symbolAccessor:g},...y&&{symbolMap:y},projection:"horizontal"===c?"horizontal":"vertical",pieceStyle:ce,size:[G,V],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:oe.margin,barPadding:v,enableHover:X,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:n.showAxes,oLabel:ee,rLabel:te,rFormat:u,...q&&{oFormat:q},showGrid:Y,showCategoryTicks:z,...oe.legendBehaviorProps,...ms({title:K,description:Q,summary:Z,accessibleTable:J,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...ys({tooltip:x,defaultTooltipContent:ue}),...gs({linkedHover:R,selection:_,onObservation:P,onClick:L,hoverHighlight:I,mobileInteraction:oe.mobileInteraction,customHoverBehavior:oe.customHoverBehavior,customClickBehavior:oe.customClickBehavior}),...w&&w.length>0&&{annotations:w},...k&&{rExtent:k},...re.brushStreamProps,...Object.fromEntries(Object.entries(j).filter(([e])=>"pieceStyle"!==e))};return(0,ol.jsx)(ya,{componentName:"SwarmPlot",width:G,height:V,children:(0,ol.jsx)(fs,{ref:o,...he})})});rl.displayName="SwarmPlot";var il=require("react"),sl=require("react/jsx-runtime");function al(e){return t=>{const n=t.category||t.data&&t.data[0]?.category||"",o=t.stats||(t.data||t).stats;if(o&&null!=o.median)return(0,sl.jsxs)("div",{className:"semiotic-tooltip",style:_r,children:[n&&(0,sl.jsx)("div",{style:{fontWeight:"bold"},children:n+""}),null!=o.n&&(0,sl.jsxs)("div",{children:["n = ",o.n]}),null!=o.min&&(0,sl.jsxs)("div",{children:["Min: ",o.min.toLocaleString()]}),null!=o.q1&&(0,sl.jsxs)("div",{children:["Q1: ",o.q1.toLocaleString()]}),(0,sl.jsxs)("div",{children:["Median: ",o.median.toLocaleString()]}),null!=o.q3&&(0,sl.jsxs)("div",{children:["Q3: ",o.q3.toLocaleString()]}),null!=o.max&&(0,sl.jsxs)("div",{children:["Max: ",o.max.toLocaleString()]}),null!=o.mean&&(0,sl.jsxs)("div",{style:{opacity:.8},children:["Mean: ",o.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});if(e?.valueAccessor){const o=e.valueAccessor,r=(Array.isArray(t.data)?t.data:[]).map(e=>Number("function"==typeof o?o(e):e[o])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),i=r.length,s=i>0?i%2!=0?r[Math.floor(i/2)]:(r[i/2-1]+r[i/2])/2:null;return(0,sl.jsxs)("div",{className:"semiotic-tooltip",style:_r,children:[n&&(0,sl.jsx)("div",{style:{fontWeight:"bold"},children:n+""}),i>0&&(0,sl.jsxs)("div",{children:["n = ",i]}),null!=s&&(0,sl.jsxs)("div",{children:["Median: ",s.toLocaleString()]})]})}return(0,sl.jsx)("div",{className:"semiotic-tooltip",style:_r,children:(0,sl.jsx)("div",{style:{fontWeight:"bold"},children:n+""})})}}var ll=require("react/jsx-runtime"),cl=(0,il.forwardRef)(function(e,t){const n=na(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}),o=(0,il.useRef)(null);nl(t,{variant:"xy",frameRef:o});const{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="vertical",valueFormat:u,colorBy:d,colorScheme:h,showOutliers:f=!0,outlierRadius:m=3,categoryPadding:g=20,tooltip:y,annotations:p,valueExtent:b,frameProps:v={},selection:x,linkedHover:w,onObservation:k,onClick:S,hoverHighlight:M,chartId:C,loading:j,loadingContent:_,emptyContent:R,legendInteraction:P,legendPosition:L,color:I,stroke:T,strokeWidth:$,opacity:B,showCategoryTicks:H,categoryFormat:O}=e,{width:F,height:E,enableHover:D,showGrid:W,showLegend:N,title:z,description:q,summary:G,accessibleTable:V,categoryLabel:X,valueLabel:Y}=n,U=(0,il.useMemo)(()=>A(r),[r]),K=Ma({data:U,rawData:r,colorBy:d,colorScheme:h,legendInteraction:P,legendPosition:L,selection:x,linkedHover:w,fallbackFields:d?["string"==typeof d?d:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:k,onClick:S,hoverHighlight:M,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"BoxPlot",chartId:C,showLegend:N,userMargin:i,marginDefaults:n.marginDefaults,loading:j,loadingContent:_,emptyContent:R,width:F,height:E}),Q=Js(),Z=(0,il.useMemo)(()=>new Map,[]),J=Ea({colorBy:d,colorScale:K.colorScale,color:I,themeCategorical:Q,colorScheme:h,categoryIndexMap:Z,userPieceStyle:void 0,stroke:T,strokeWidth:$,opacity:B,effectiveSelectionHook:K.effectiveSelectionHook,resolvedSelection:K.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),ee=(0,il.useMemo)(()=>al(),[]);if(K.earlyReturn)return K.earlyReturn;const te=ka({componentName:"BoxPlot",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(te)return(0,ll.jsx)(ua,{componentName:"BoxPlot",message:te,width:F,height:E});const ne={chartType:"boxplot",...null!=r&&{data:U},oAccessor:a,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",summaryStyle:J,showOutliers:f,size:[F,E],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:K.margin,barPadding:g,enableHover:D,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:n.showAxes,oLabel:X,rLabel:Y,rFormat:u,...O&&{oFormat:O},showGrid:W,showCategoryTicks:H,...K.legendBehaviorProps,...ms({title:z,description:q,summary:G,accessibleTable:V,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...ys({tooltip:y,defaultTooltipContent:ee}),...gs({linkedHover:w,selection:x,onObservation:k,onClick:S,hoverHighlight:M,mobileInteraction:K.mobileInteraction,customHoverBehavior:K.customHoverBehavior,customClickBehavior:K.customClickBehavior}),...p&&p.length>0&&{annotations:p},...b&&{rExtent:b},...Object.fromEntries(Object.entries(v).filter(([e])=>"pieceStyle"!==e))};return(0,ll.jsx)(ya,{componentName:"BoxPlot",width:F,height:E,children:(0,ll.jsx)(fs,{ref:o,...ne})})});cl.displayName="BoxPlot";var ul=require("react"),dl=require("react/jsx-runtime"),hl=e=>{const t=e?.category;return null==t?"All":t+""},fl=(0,ul.forwardRef)(function(e,t){const n=na(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}),o=(0,ul.useRef)(null);nl(t,{variant:"xy",frameRef:o});const{data:r,margin:i,className:s,categoryAccessor:a=hl,valueAccessor:l="value",bins:c=25,relative:u=!1,valueFormat:d,colorBy:h,colorScheme:f,categoryPadding:m=20,tooltip:g,annotations:y,valueExtent:p,brush:b,onBrush:v,linkedBrush:x,frameProps:w={},selection:k,linkedHover:S,onObservation:M,onClick:C,hoverHighlight:j,chartId:_,loading:R,loadingContent:P,emptyContent:L,legendInteraction:I,legendPosition:T,color:$,stroke:B,strokeWidth:H,opacity:O,showCategoryTicks:F,categoryFormat:E}=e,{width:D,height:W,enableHover:N,showGrid:z,showLegend:q,title:G,description:V,summary:X,accessibleTable:Y,categoryLabel:U,valueLabel:K}=n,Q=(0,ul.useMemo)(()=>A(r),[r]),Z=Ma({data:Q,rawData:r,colorBy:h,colorScheme:f,legendInteraction:I,legendPosition:T,selection:k,linkedHover:S,fallbackFields:h?["string"==typeof h?h:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:M,onClick:C,hoverHighlight:j,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"Histogram",chartId:_,showLegend:q,userMargin:i,marginDefaults:n.marginDefaults,loading:R,loadingContent:P,emptyContent:L,width:D,height:W}),J=Qa({brushProp:b,onBrushProp:v,linkedBrush:x,valueAccessor:l}),ee=(0,ul.useMemo)(()=>{if(0===Q.length)return;const e="function"==typeof l?l:e=>e[l];let t=1/0,n=-1/0;for(const o of Q){const r=e(o);null!=r&&isFinite(r)&&(t>r&&(t=r),r>n&&(n=r))}return t>n?void 0:[t,n]},[Q,l]),te=Js(),ne=(0,ul.useMemo)(()=>new Map,[]),oe=Ea({colorBy:h,colorScale:Z.colorScale,color:$,themeCategorical:te,colorScheme:f,categoryIndexMap:ne,userPieceStyle:void 0,stroke:B,strokeWidth:H,opacity:O,effectiveSelectionHook:Z.effectiveSelectionHook,resolvedSelection:Z.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),re=(0,ul.useMemo)(()=>e=>{const t=e.data||e,n=t.category||e.category||"",o=t.count,r=t.range;return(0,dl.jsxs)("div",{className:"semiotic-tooltip",style:_r,children:[n&&(0,dl.jsx)("div",{style:{fontWeight:"bold"},children:n+""}),null!=o&&(0,dl.jsxs)("div",{children:["Count: ",o]}),r&&2===r.length&&(0,dl.jsxs)("div",{style:{opacity:.8},children:[Number(r[0]).toFixed(1)," – ",Number(r[1]).toFixed(1)]})]})},[]);if(Z.earlyReturn)return Z.earlyReturn;const ie=ka({componentName:"Histogram",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(ie)return(0,dl.jsx)(ua,{componentName:"Histogram",message:ie,width:D,height:W});const se={chartType:"histogram",...null!=r&&{data:Q},oAccessor:a,rAccessor:l,projection:"horizontal",summaryStyle:oe,bins:c,normalize:u,...p?{rExtent:p}:ee&&{rExtent:ee},size:[D,W],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Z.margin,barPadding:m,enableHover:N,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:n.showAxes,oLabel:U,rLabel:K,rFormat:d,...E&&{oFormat:E},showGrid:z,showCategoryTicks:F,...Z.legendBehaviorProps,...ms({title:G,description:V,summary:X,accessibleTable:Y,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...ys({tooltip:g,defaultTooltipContent:re}),...gs({linkedHover:S,selection:k,onObservation:M,onClick:C,hoverHighlight:j,mobileInteraction:Z.mobileInteraction,customHoverBehavior:Z.customHoverBehavior,customClickBehavior:Z.customClickBehavior}),...y&&y.length>0&&{annotations:y},...J.brushStreamProps,...Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e))};return(0,dl.jsx)(ya,{componentName:"Histogram",width:D,height:W,children:(0,dl.jsx)(fs,{ref:o,...se})})});fl.displayName="Histogram";var ml=require("react"),gl=require("react/jsx-runtime"),yl=(0,ml.forwardRef)(function(e,t){const n=na(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}),o=(0,ml.useRef)(null);nl(t,{variant:"xy",frameRef:o});const{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="vertical",bins:u=25,curve:d="catmullRom",showIQR:h=!0,valueFormat:f,colorBy:m,colorScheme:g,categoryPadding:y=20,tooltip:p,annotations:b,valueExtent:v,brush:x,onBrush:w,linkedBrush:k,frameProps:S={},selection:M,linkedHover:C,onObservation:j,onClick:_,hoverHighlight:R,chartId:P,loading:L,loadingContent:I,emptyContent:T,legendInteraction:$,legendPosition:B,color:H,stroke:O,strokeWidth:F,opacity:E,showCategoryTicks:D,categoryFormat:W}=e,{width:N,height:z,enableHover:q,showGrid:G,showLegend:V,title:X,description:Y,summary:U,accessibleTable:K,categoryLabel:Q,valueLabel:Z}=n,J=(0,ml.useMemo)(()=>A(r),[r]),ee=Ma({data:J,rawData:r,colorBy:m,colorScheme:g,legendInteraction:$,legendPosition:B,selection:M,linkedHover:C,fallbackFields:m?["string"==typeof m?m:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:j,onClick:_,hoverHighlight:R,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"ViolinPlot",chartId:P,showLegend:V,userMargin:i,marginDefaults:n.marginDefaults,loading:L,loadingContent:I,emptyContent:T,width:N,height:z}),te=Qa({brushProp:x,onBrushProp:w,linkedBrush:k,valueAccessor:l}),ne=Js(),oe=(0,ml.useMemo)(()=>new Map,[]),re=Ea({colorBy:m,colorScale:ee.colorScale,color:H,themeCategorical:ne,colorScheme:g,categoryIndexMap:oe,userPieceStyle:void 0,stroke:O,strokeWidth:F,opacity:E,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection,baseStyleExtras:{fillOpacity:.6},linkStrokeToFill:!0}),ie=(0,ml.useMemo)(()=>al({valueAccessor:l}),[l]);if(ee.earlyReturn)return ee.earlyReturn;const se=ka({componentName:"ViolinPlot",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(se)return(0,gl.jsx)(ua,{componentName:"ViolinPlot",message:se,width:N,height:z});const ae={chartType:"violin",...null!=r&&{data:J},oAccessor:a,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",summaryStyle:re,bins:u,showIQR:h,size:[N,z],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ee.margin,barPadding:y,enableHover:q,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:n.showAxes,oLabel:Q,rLabel:Z,rFormat:f,...W&&{oFormat:W},showGrid:G,showCategoryTicks:D,...ee.legendBehaviorProps,...ms({title:X,description:Y,summary:U,accessibleTable:K,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...ys({tooltip:p,defaultTooltipContent:ie}),...gs({linkedHover:C,selection:M,onObservation:j,onClick:_,hoverHighlight:R,mobileInteraction:ee.mobileInteraction,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior}),...b&&b.length>0&&{annotations:b},...v&&{rExtent:v},...te.brushStreamProps,...Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e))};return(0,gl.jsx)(ya,{componentName:"ViolinPlot",width:N,height:z,children:(0,gl.jsx)(fs,{ref:o,...ae})})});yl.displayName="ViolinPlot";var pl=require("react"),bl=require("react/jsx-runtime"),vl=(0,pl.forwardRef)(function(e,t){const n=na(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}),o=(0,pl.useRef)(null);nl(t,{variant:"xy",frameRef:o});const{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="horizontal",valueFormat:u,colorBy:d,colorScheme:h,sort:f="auto",dotRadius:m=5,categoryPadding:g=10,tooltip:y,annotations:p,regression:b,valueExtent:v,frameProps:x={},selection:w,linkedHover:k,onObservation:S,onClick:M,hoverHighlight:C,chartId:j,loading:_,loadingContent:R,emptyContent:P,legendInteraction:L,legendPosition:I,color:T,stroke:$,strokeWidth:B,opacity:H,categoryFormat:O}=e,{width:F,height:E,enableHover:D,showGrid:W,showLegend:N,title:z,description:q,summary:G,accessibleTable:V,categoryLabel:X,valueLabel:Y}=n,U=(0,pl.useMemo)(()=>A(r),[r]),K=Ma({data:U,rawData:r,colorBy:d,colorScheme:h,legendInteraction:L,legendPosition:I,selection:w,linkedHover:k,fallbackFields:d?["string"==typeof d?d:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:S,onClick:M,hoverHighlight:C,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"DotPlot",chartId:j,showLegend:N,userMargin:i,marginDefaults:n.marginDefaults,loading:_,loadingContent:R,emptyContent:P,width:F,height:E}),Q=ea(U,f,l),Z=Js(),J=(0,pl.useMemo)(()=>new Map,[]),ee=Ea({colorBy:d,colorScale:K.colorScale,color:T,themeCategorical:Z,colorScheme:h,categoryIndexMap:J,userPieceStyle:x?.pieceStyle,stroke:$,strokeWidth:B,opacity:H,effectiveSelectionHook:K.effectiveSelectionHook,resolvedSelection:K.resolvedSelection,baseStyleExtras:{r:m,fillOpacity:.8}}),te=(0,pl.useMemo)(()=>la({categoryAccessor:a,valueAccessor:l,valueFormat:u}),[a,l,u]);if(K.earlyReturn)return K.earlyReturn;const ne=ka({componentName:"DotPlot",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(ne)return(0,bl.jsx)(ua,{componentName:"DotPlot",message:ne,width:F,height:E});const oe=Da(b),re=oe?[oe,...p||[]]:p,ie={chartType:"point",...null!=r&&{data:Q},oAccessor:a,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",pieceStyle:ee,size:[F,E],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:K.margin,barPadding:g,enableHover:D,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:n.showAxes,oLabel:X,rLabel:Y,rFormat:u,...O&&{oFormat:O},showGrid:W,oSort:f,...K.legendBehaviorProps,...ms({title:z,description:q,summary:G,accessibleTable:V,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...ys({tooltip:y,defaultTooltipContent:te}),...gs({linkedHover:k,selection:w,onObservation:S,onClick:M,hoverHighlight:C,mobileInteraction:K.mobileInteraction,customHoverBehavior:K.customHoverBehavior,customClickBehavior:K.customClickBehavior}),...re&&re.length>0&&{annotations:re},...v&&{rExtent:v},...Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e))};return(0,bl.jsx)(ya,{componentName:"DotPlot",width:F,height:E,children:(0,bl.jsx)(fs,{ref:o,...ie})})});vl.displayName="DotPlot";var xl=require("react"),wl=require("react/jsx-runtime"),kl=(0,xl.forwardRef)(function(e,t){const n=na(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}),o=(0,xl.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",colorBy:c,colorScheme:u,startAngle:d=0,cornerRadius:h,tooltip:f,annotations:m,frameProps:g={},selection:y,linkedHover:p,onObservation:b,onClick:v,hoverHighlight:x,chartId:w,loading:k,loadingContent:S,emptyContent:M,legendInteraction:C,legendPosition:j,color:_,stroke:R,strokeWidth:P,opacity:L}=e,{width:I,height:T,enableHover:$,showLegend:B,title:H,description:O,summary:F,accessibleTable:E}=n,D=(0,xl.useMemo)(()=>A(r),[r]),W=c||a,N=Ma({data:D,rawData:r,colorBy:W,colorScheme:u,legendInteraction:C,legendPosition:j,selection:y,linkedHover:p,fallbackFields:W?["string"==typeof W?W:""]:[],unwrapData:!0,onObservation:b,onClick:v,hoverHighlight:x,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"PieChart",chartId:w,showLegend:B,userMargin:i,marginDefaults:n.marginDefaults,loading:k,loadingContent:S,emptyContent:M,width:I,height:T}),z=Js(),q=(0,xl.useMemo)(()=>new Map,[]),G=Ea({colorBy:W,colorScale:N.colorScale,color:_,themeCategorical:z,colorScheme:u,categoryIndexMap:q,userPieceStyle:g?.pieceStyle,stroke:R,strokeWidth:P,opacity:L,effectiveSelectionHook:N.effectiveSelectionHook,resolvedSelection:N.resolvedSelection,cycleByCategory:!0}),V=(0,xl.useMemo)(()=>la({categoryAccessor:a,valueAccessor:l,groupAccessor:c&&c!==a?c:void 0,groupLabel:"string"==typeof c?c:"group",pieData:!0}),[a,l,c]),X=ka({componentName:"PieChart",data:r,accessors:{categoryAccessor:a,valueAccessor:l}}),{effectiveLegendProps:Y,effectiveMargin:U}=ja({ref:t,frameRef:o,setup:N});if(N.earlyReturn)return N.earlyReturn;const K={chartType:"pie",...null!=r&&{data:D},oAccessor:a,rAccessor:l,projection:"radial",pieceStyle:G,startAngle:d,...null!=h&&{cornerRadius:h},size:[I,T],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:U,enableHover:$,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:!1,...Y,...ms({title:H,description:O,summary:F,accessibleTable:E,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...ys({tooltip:f,defaultTooltipContent:V}),...gs({linkedHover:p,selection:y,onObservation:b,onClick:v,hoverHighlight:x,mobileInteraction:N.mobileInteraction,customHoverBehavior:N.customHoverBehavior,customClickBehavior:N.customClickBehavior}),...m&&m.length>0&&{annotations:m},...Object.fromEntries(Object.entries(g).filter(([e])=>"pieceStyle"!==e))};return X?(0,wl.jsx)(ua,{componentName:"PieChart",message:X,width:I,height:T}):(0,wl.jsx)(ya,{componentName:"PieChart",width:I,height:T,children:(0,wl.jsx)(fs,{ref:o,...K})})});kl.displayName="PieChart";var Sl=require("react"),Al=require("react/jsx-runtime"),Ml=(0,Sl.forwardRef)(function(e,t){const n=na(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}),o=(0,Sl.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",innerRadius:c,centerContent:u,colorBy:d,colorScheme:h,startAngle:f=0,cornerRadius:m,tooltip:g,annotations:y,frameProps:p={},selection:b,linkedHover:v,onObservation:x,onClick:w,hoverHighlight:k,chartId:S,loading:M,loadingContent:C,emptyContent:j,legendInteraction:_,legendPosition:R,color:P,stroke:L,strokeWidth:I,opacity:T}=e,{width:$,height:B,enableHover:H,showLegend:O,title:F,description:E,summary:D,accessibleTable:W}=n,N=(0,Sl.useMemo)(()=>A(r),[r]),z=d||a,q=Ma({data:N,rawData:r,colorBy:z,colorScheme:h,legendInteraction:_,legendPosition:R,selection:b,linkedHover:v,fallbackFields:z?["string"==typeof z?z:""]:[],unwrapData:!0,onObservation:x,onClick:w,hoverHighlight:k,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"DonutChart",chartId:S,showLegend:O,userMargin:i,marginDefaults:n.marginDefaults,loading:M,loadingContent:C,emptyContent:j,width:$,height:B}),G=c??Math.max(2,.15*Math.min($,B)),V=Js(),X=(0,Sl.useMemo)(()=>new Map,[]),Y=Ea({colorBy:z,colorScale:q.colorScale,color:P,themeCategorical:V,colorScheme:h,categoryIndexMap:X,userPieceStyle:p?.pieceStyle,stroke:L,strokeWidth:I,opacity:T,effectiveSelectionHook:q.effectiveSelectionHook,resolvedSelection:q.resolvedSelection,cycleByCategory:!0}),U=(0,Sl.useMemo)(()=>la({categoryAccessor:a,valueAccessor:l,groupAccessor:d&&d!==a?d:void 0,groupLabel:"string"==typeof d?d:"group",pieData:!0}),[a,l,d]),K=ka({componentName:"DonutChart",data:r,accessors:{categoryAccessor:a,valueAccessor:l}}),{effectiveLegendProps:Q,effectiveMargin:Z}=ja({ref:t,frameRef:o,setup:q});if(q.earlyReturn)return q.earlyReturn;const J={chartType:"donut",...null!=r&&{data:N},oAccessor:a,rAccessor:l,projection:"radial",pieceStyle:Y,innerRadius:G,startAngle:f,...null!=m&&{cornerRadius:m},centerContent:u,size:[$,B],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Z,enableHover:H,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:!1,...Q,...ms({title:F,description:E,summary:D,accessibleTable:W,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...ys({tooltip:g,defaultTooltipContent:U}),...gs({linkedHover:v,selection:b,onObservation:x,onClick:w,hoverHighlight:k,mobileInteraction:q.mobileInteraction,customHoverBehavior:q.customHoverBehavior,customClickBehavior:q.customClickBehavior}),...y&&y.length>0&&{annotations:y},...Object.fromEntries(Object.entries(p).filter(([e])=>"pieceStyle"!==e))};return K?(0,Al.jsx)(ua,{componentName:"DonutChart",message:K,width:$,height:B}):(0,Al.jsx)(ya,{componentName:"DonutChart",width:$,height:B,children:(0,Al.jsx)(fs,{ref:o,...J})})});Ml.displayName="DonutChart";var Cl=require("react");function jl(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 _l(e){return Math.max(0,Math.min(1,e))}function Rl(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 Pl(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 Ll(e,t){const n=e.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:_l(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=_l(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],r=n[e+1];if(t.offset>o||o>r.offset)continue;const i=r.offset-t.offset,s=i>0?(o-t.offset)/i:0,a=Rl(t.color),l=Rl(r.color);if(!a||!l)return.5>s?t.color:r.color;const[c,u,d]=a,[h,f,m]=l;return Pl(c+(h-c)*s,u+(f-u)*s,d+(m-d)*s)}return n[n.length-1].color}function Il(e,t,n){return null==n?`${e}-${t}`:`${e}-${t}-${n}`}var Tl=require("react/jsx-runtime"),$l=(0,Cl.forwardRef)(function(e,t){const n=na(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}),o=(0,Cl.useRef)(null),r="context"===e.mode,{compactMode:i}=n,{value:s,min:a=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:y="var(--semiotic-text, #333)",centerContent:p,valueFormat:b,showScaleLabels:v=!i,sweep:x=240,fillZones:w=!0,tooltip:k,annotations:S,frameProps:A={},className:M,stroke:C,strokeWidth:j,opacity:_}=e,{width:R,height:P,title:L,description:I,summary:T,accessibleTable:$}=n,B=u&&"object"==typeof u?u:void 0,H=Math.max(a,Math.min(l,s)),O=l-a||1,F=(H-a)/O,{gaugeData:E,pieceStyle:D,gaugeAnnotations:W}=(0,Cl.useMemo)(()=>function(e){const{min:t,max:n,value:o,thresholds:r,fillColor:i,backgroundColor:s,fillZones:a,showScaleLabels:l,gradientFill:c,gradientSteps:u=240}=e,d=n-t||1,h=(Math.max(t,Math.min(n,o))-t)/d;let f=r&&r.length>0?[...r].sort((e,t)=>e.value-t.value):[{value:n,color:i||"#007bff"}];f=f.map(e=>({...e,value:Math.max(t,Math.min(n,e.value))})),n>f[f.length-1].value&&f.push({value:n,color:f[f.length-1].color});const m=!!c&&c.colorStops.length>=2,g=[],y=new Map,p=[];if(m){const e=a?h:1,t=Il("bg",0);if(g.push({category:t,value:1,_zone:"Track",_isFill:!1,_pctStart:0,_pct:1,_roundedEnds:{start:!0,end:!0},_nonInteractive:!0}),y.set(t,{fill:s,opacity:.4}),e>0){const t=Math.max(1,Math.floor(u)),n=Math.max(1,Math.min(t,Math.round(e*t))),o=[];for(let t=0;n>t;t++)o.push(Ll(c.colorStops,e*(t+.5)/n));const r=Il("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:o}}),y.set(r,{fill:o[0]||s})}}else{let e=t;for(let n=0;f.length>n;n++){const o=f[n],r=(o.value-e)/d,i=(e-t)/d,l=(o.value-t)/d,c=Math.max(0,(a?Math.min(h,l):l)-i),u=a?Math.max(0,r-c):0;if(c>0){const e=Il("fill",n);g.push({category:e,value:c,_zone:o.label||"Zone "+(n+1),_isFill:!0}),y.set(e,{fill:o.color})}if(u>0){const e=Il("bg",n);g.push({category:e,value:u,_zone:o.label||"Zone "+(n+1),_isFill:!1}),y.set(e,{fill:s,opacity:.4})}e=o.value}}if(l&&r&&r.length>0)for(const e of r)e.value>t&&n>e.value&&p.push({type:"gauge-label",value:e.value,label:e.label||e.value+""});return{gaugeData:g,pieceStyle:(e,t)=>y.get(t||e.category)||{fill:s},gaugeAnnotations:p}}({min:a,max:l,value:s,thresholds:c,fillColor:d,backgroundColor:h,fillZones:w,showScaleLabels:v,gradientFill:B}),[s,a,l,c,d,h,v,w,B]),N=(0,Cl.useMemo)(()=>Ra(D,{stroke:C,strokeWidth:j,opacity:_}),[D,C,j,_]),{sweepRad:z,startAngleDeg:q}=jl(x),G=function(e=240){const{sweepRad:t,offsetRad:n}=jl(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 r=o.map(e=>e[0]),i=o.map(e=>e[1]),[s,a]=xe(r),[l,c]=xe(i);return{minX:s,maxX:a,minY:l,maxY:c,width:a-s,height:c-l,cx:(s+a)/2,cy:(l+c)/2}}(x),V=Math.min(10,Math.max(1,Math.min(R,P)/12)),X=G.cx,Y=G.cy,U=Math.max(4,Math.min((R-2*V)/G.width,(P-2*V)/G.height)-2),K=Math.max(0,Math.min(U-1.5,U*(1-f))),Q=R/2-X*U,Z=P/2-Y*U,J=2*(U+4),ee=(0,Cl.useMemo)(()=>{if(i&&null==p)return null;if(null!=p)return"function"==typeof p?p(H,a,l):p;const e=b?b(H):Math.round(H)+"";return(0,Tl.jsxs)("div",{style:{textAlign:"center",lineHeight:1.2},children:[(0,Tl.jsx)("div",{style:{fontSize:Math.max(16,.3*U),fontWeight:700,color:"var(--semiotic-text, #333)"},children:e}),v&&(0,Tl.jsxs)("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"},children:[a," – ",l]})]})},[p,H,a,l,b,v,U,i]),te=(0,Cl.useMemo)(()=>r&&null==p?{type:"gauge-value",text:b?b(H):Math.round(H)+""}:null,[r,p,H,b]),ne=(0,Cl.useMemo)(()=>{if(!g)return null;const e=-Math.PI/2+q*Math.PI/180+F*z,t=K>20?K-8:U-1;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:y}},[g,q,F,z,K,U,y]),oe=(0,Cl.useMemo)(()=>(e,t,n)=>{if("gauge-needle"===e.type){const o=(n.width||R)/2,r=(n.height||P)/2,i=Math.max(1,U-K),s=Math.max(1,Math.min(2.5,.4*i)),a=Math.max(1,Math.min(5,.6*i));return(0,Tl.jsxs)("g",{transform:`translate(${o},${r})`,children:[(0,Tl.jsx)("line",{x1:0,y1:0,x2:e.tipX,y2:e.tipY,stroke:e.color,strokeWidth:s,strokeLinecap:"round"}),(0,Tl.jsx)("circle",{cx:0,cy:0,r:a,fill:e.color})]},"gauge-needle-"+t)}if("gauge-label"===e.type){const o=-Math.PI/2+q*Math.PI/180+(e.value-a)/O*z,r=(n.width||R)/2,i=(n.height||P)/2,s=K-1,l=U+1,c=Math.cos(o)*s,u=Math.sin(o)*s,d=Math.cos(o)*l,h=Math.sin(o)*l,f=U+10,m=Math.cos(o)*f,g=Math.sin(o)*f,y=((o+Math.PI/2)/(2*Math.PI)*12+12)%12;let p,b;return y>=11||1>y?(p="middle",b="auto"):y>=1&&5>y?(p="start",b="middle"):y>=5&&7>y?(p="middle",b="hanging"):(p="end",b="middle"),(0,Tl.jsxs)("g",{transform:`translate(${r},${i})`,children:[(0,Tl.jsx)("line",{x1:c,y1:u,x2:d,y2:h,stroke:"var(--semiotic-border)",strokeWidth:2,strokeLinecap:"round"}),(0,Tl.jsx)("text",{x:m,y:g,textAnchor:p,dominantBaseline:b,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none",fontSize:"var(--semiotic-gauge-label-font-size, 10px)"},children:e.label})]},"gauge-label-"+t)}return"gauge-value"===e.type?(0,Tl.jsx)("text",{x:(n.width||R)/2,y:(n.height||P)/2-.2*K,textAnchor:"middle",dominantBaseline:"middle",fontSize:Math.max(12,Math.min(22,.28*U)),fontWeight:700,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:e.text},"gauge-value-"+t):null},[R,P,a,O,q,z,K,U]),re=(0,Cl.useMemo)(()=>{const e=[...W,...S||[]];return ne&&e.push(ne),te&&e.push(te),e},[W,S,ne,te]),ie=(0,Cl.useMemo)(()=>e=>{const t=e?.data?.[0]||e?.data||e,n=t?._zone||"",o=t?._isFill;return(0,Tl.jsxs)("div",{className:"semiotic-tooltip",style:{padding:"6px 10px",background:"var(--semiotic-tooltip-bg, white)",borderRadius:"var(--semiotic-tooltip-radius, 6px)",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0,0,0,0.15))"},children:[(0,Tl.jsx)("div",{style:{fontWeight:600},children:n}),(0,Tl.jsx)("div",{style:{fontSize:"0.85em",color:"var(--semiotic-text-secondary, #666)"},children:o?"Current: "+Math.round(H):"Remaining"})]})},[H]);if(0===E.length)return(0,Tl.jsx)(ua,{componentName:"GaugeChart",message:"No data to display",width:R,height:P});const se={chartType:"donut",data:E,oAccessor:"category",rAccessor:"value",oSort:!1,projection:"radial",pieceStyle:N,innerRadius:K,startAngle:q,sweepAngle:x,...null!=m&&{cornerRadius:m},centerContent:ee,size:[R,P],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:{top:Z-J/2,bottom:P-Z-J/2,left:Q-J/2,right:R-Q-J/2},enableHover:n.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===k?()=>null:Ir(k)||ie,svgAnnotationRules:oe,...re.length>0&&{annotations:re},...L&&{title:L},...I&&{description:I},...T&&{summary:T},...void 0!==$&&{accessibleTable:$},...M&&{className:M},...null!=e.animate&&{animate:e.animate},...A};return(0,Tl.jsx)(ya,{componentName:"GaugeChart",width:R,height:P,children:(0,Tl.jsx)(fs,{ref:o,...se})})});$l.displayName="GaugeChart";var Bl=require("react"),Hl=require("react/jsx-runtime"),Ol=(0,Bl.forwardRef)(function(e,t){const n=na(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}),o=(0,Bl.useRef)(null);nl(t,{variant:"xy",frameRef:o});const{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="horizontal",bins:u=20,amplitude:d=1.5,valueFormat:h,colorBy:f,colorScheme:m,categoryPadding:g=5,tooltip:y,annotations:p,valueExtent:b,frameProps:v={},selection:x,linkedHover:w,onObservation:k,onClick:S,hoverHighlight:M,chartId:C,loading:j,loadingContent:_,emptyContent:R,legendInteraction:P,legendPosition:L,color:I,stroke:T,strokeWidth:$,opacity:B,showCategoryTicks:H,categoryFormat:O}=e,{width:F,height:E,enableHover:D,showGrid:W,showLegend:N,title:z,description:q,summary:G,accessibleTable:V,categoryLabel:X,valueLabel:Y}=n,U=(0,Bl.useMemo)(()=>A(r),[r]),K=Ma({data:U,rawData:r,colorBy:f,colorScheme:m,legendInteraction:P,legendPosition:L,selection:x,linkedHover:w,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:k,onClick:S,hoverHighlight:M,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"RidgelinePlot",chartId:C,showLegend:N,userMargin:i,marginDefaults:n.marginDefaults,loading:j,loadingContent:_,emptyContent:R,width:F,height:E}),Q=Js(),Z=(0,Bl.useMemo)(()=>new Map,[]),J=Ea({colorBy:f,colorScale:K.colorScale,color:I,themeCategorical:Q,colorScheme:m,categoryIndexMap:Z,userPieceStyle:void 0,stroke:T,strokeWidth:$,opacity:B,effectiveSelectionHook:K.effectiveSelectionHook,resolvedSelection:K.resolvedSelection,baseStyleExtras:{fillOpacity:.5},linkStrokeToFill:!0}),ee=(0,Bl.useMemo)(()=>al(),[]);if(K.earlyReturn)return K.earlyReturn;const te=ka({componentName:"RidgelinePlot",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(te)return(0,Hl.jsx)(ua,{componentName:"RidgelinePlot",message:te,width:F,height:E});const ne={chartType:"ridgeline",...null!=r&&{data:U},oAccessor:a,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",summaryStyle:J,bins:u,size:[F,E],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:K.margin,barPadding:g,enableHover:D,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:n.showAxes,oLabel:X,rLabel:Y,rFormat:h,...O&&{oFormat:O},showGrid:W,showCategoryTicks:H,oSort:!1,amplitude:d,...K.legendBehaviorProps,...ms({title:z,description:q,summary:G,accessibleTable:V,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...ys({tooltip:y,defaultTooltipContent:ee}),...gs({linkedHover:w,selection:x,onObservation:k,onClick:S,hoverHighlight:M,mobileInteraction:K.mobileInteraction,customHoverBehavior:K.customHoverBehavior,customClickBehavior:K.customClickBehavior}),...p&&p.length>0&&{annotations:p},...b&&{rExtent:b},...Object.fromEntries(Object.entries(v).filter(([e])=>"pieceStyle"!==e))};return(0,Hl.jsx)(ya,{componentName:"RidgelinePlot",width:F,height:E,children:(0,Hl.jsx)(fs,{ref:o,...ne})})});Ol.displayName="RidgelinePlot";var Fl=require("react"),El=require("react/jsx-runtime"),Dl=(0,Fl.forwardRef)(function(e,t){const n=na(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}),o=(0,Fl.useRef)(null);nl(t,{variant:"xy",frameRef:o});const{data:r,margin:i,className:s,stepAccessor:a="step",valueAccessor:l="value",categoryAccessor:c,colorBy:u,colorScheme:d,orientation:h="horizontal",connectorOpacity:f=.3,showLabels:m=!0,tooltip:g,annotations:y,frameProps:p={},selection:b,linkedHover:v,onObservation:x,onClick:w,hoverHighlight:k,chartId:S,loading:M,loadingContent:C,emptyContent:j,legendInteraction:_,legendPosition:R,color:P,stroke:L,strokeWidth:I,opacity:T,categoryFormat:$}=e,B="vertical"===h,{width:H,height:O,enableHover:F,showLegend:E,title:D,description:W,summary:N,accessibleTable:z}=n,q=B?{top:D?60:40,right:20,bottom:60,left:60}:{top:D?40:10,right:10,bottom:10,left:10},G=(0,Fl.useMemo)(()=>A(r),[r]),V=u||c,X=!V,Y=Ma({data:G,rawData:r,colorBy:V,colorScheme:d,legendInteraction:_,legendPosition:R,selection:b,linkedHover:v,fallbackFields:V?["string"==typeof V?V:""]:[],unwrapData:!0,onObservation:x,onClick:w,hoverHighlight:k,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"FunnelChart",chartId:S,showLegend:E,userMargin:i,marginDefaults:q,loading:M,loadingContent:C,emptyContent:j,width:H,height:O});va("FunnelChart",G,"stepAccessor",a),va("FunnelChart",G,"valueAccessor",l);const U=Js(),K=(0,Fl.useMemo)(()=>new Map,[]),Q=(0,Fl.useMemo)(()=>{if(X)return P||(U?.[0]?U[0]:Array.isArray(d)&&d[0]?d[0]:"#4e79a7")},[X,P,U,d]),Z=Ea({colorBy:Q?void 0:V,colorScale:Y.colorScale,color:Q??P,themeCategorical:U,colorScheme:d,categoryIndexMap:K,userPieceStyle:p?.pieceStyle,stroke:L,strokeWidth:I,opacity:T,effectiveSelectionHook:Y.effectiveSelectionHook,resolvedSelection:Y.resolvedSelection}),J=(0,Fl.useMemo)(()=>e=>{const t=e?.data||e,n=t?.__funnelStep||t?.__barFunnelStep||t?.step||"",o=t?.__funnelValue??t?.__barFunnelValue??t?.value??"",r=t?.__funnelPercent??t?.__barFunnelPercent,i=t?.__funnelIsFirstStep??t?.__barFunnelIsFirstStep,s=t?.__barFunnelIsDropoff,a=t?.__barFunnelCategory??t?.category,l=null==r||i?"":` (${.05>Math.abs(r-Math.round(r))?Math.round(r)+"%":r.toFixed(1)+"%"})`;return(0,El.jsxs)("div",{className:"semiotic-tooltip",style:_r,children:[n&&(0,El.jsx)("div",{style:{fontWeight:"bold"},children:n+""}),a&&a!==n&&(0,El.jsx)("div",{style:{marginTop:2,opacity:.8},children:a+""}),s&&(0,El.jsx)("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7},children:"Dropoff"}),(0,El.jsxs)("div",{style:{marginTop:4},children:[o+"",l]})]})},[]);if(Y.earlyReturn)return Y.earlyReturn;const ee=ka({componentName:"FunnelChart",data:r,accessors:{stepAccessor:a,valueAccessor:l}});if(ee)return(0,El.jsx)(ua,{componentName:"FunnelChart",message:ee,width:H,height:O});const te={chartType:B?"bar-funnel":"funnel",...null!=r&&{data:G},oAccessor:a,rAccessor:l,...c&&{stackBy:c},projection:B?"vertical":"horizontal",barPadding:B?40:0,pieceStyle:Z,size:[H,O],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Y.margin,enableHover:F,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:B,showCategoryTicks:B,...$&&{oFormat:$},showGrid:B,...!B&&{connectorOpacity:f},showLabels:m,...Y.legendBehaviorProps,...D&&{title:D},...W&&{description:W},...N&&{summary:N},...void 0!==z&&{accessibleTable:z},...s&&{className:s},...null!=e.animate&&{animate:e.animate},tooltipContent:!1===g?()=>null:!0===g||null==g?J:Ir(g)||J,...gs({linkedHover:v,selection:b,onObservation:x,onClick:w,hoverHighlight:k,mobileInteraction:Y.mobileInteraction,customHoverBehavior:Y.customHoverBehavior,customClickBehavior:Y.customClickBehavior}),...y&&y.length>0&&{annotations:y},...Object.fromEntries(Object.entries(p).filter(([e])=>"pieceStyle"!==e))};return(0,El.jsx)(ya,{componentName:"FunnelChart",width:H,height:O,children:(0,El.jsx)(fs,{ref:o,...te})})});Dl.displayName="FunnelChart";var Wl=g(require("react")),Nl=require("react"),zl=require("react"),ql=require("react"),Gl={RdBu:Y,PiYG:U,PRGn:K,BrBG:Q,RdYlBu:Z,RdYlGn:J,Spectral:ee},Vl="__likert_neutral_neg",Xl="__likert_neutral_pos";function Yl(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function Ul(e,t,n,o,r,i){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 r=t[n];c.set(r,(c.get(r)||0)+1)}else if(r&&i){const e=r(l),t=i(l);if(!a.has(e))continue;c.set(e,(c.get(e)||0)+(Number.isFinite(t)?t:0))}}const l=[];for(const[e,n]of s){let o=0;for(const e of t)o+=n.get(e)||0;if(0!==o)for(let r=0;t.length>r;r++){const i=t[r],s=n.get(i)||0;l.push({__likertCategory:e,__likertLevel:i,__likertLevelLabel:i,__likertCount:s,__likertPct:s/o*100,__likertLevelIndex:r})}}return l}function Kl(e,t){const n=t.length,o=n%2!=0,r=Math.floor(n/2),i=[];for(const t of e){const e=t.__likertLevelIndex;if(o&&e===r){const e=t.__likertPct/2;i.push({...t,__likertLevel:Vl,__likertPct:-e}),i.push({...t,__likertLevel:Xl,__likertPct:e})}else i.push(r>e?{...t,__likertPct:-t.__likertPct}:t)}return i}function Ql(e,t){const n=t.length,o=n%2!=0,r=Math.floor(n/2),i=new Map;for(const t of e){const e=i.get(t.__likertCategory)||[];e.push(t),i.set(t.__likertCategory,e)}const s=[];for(const[,e]of i){const t=new Map;let i,a;for(const n of e)n.__likertLevel===Vl?i=n:n.__likertLevel===Xl?a=n:t.set(n.__likertLevelIndex,n);o&&i&&s.push(i);for(let e=r-1;e>=0;e--){const n=t.get(e);n&&s.push(n)}o&&a&&s.push(a);for(let e=o?r+1:r;n>e;e++){const n=t.get(e);n&&s.push(n)}}return s}var Zl=["Very Low","Low","Neutral","High","Very High"],Jl=require("react/jsx-runtime"),ec=new Map,tc=(0,Nl.forwardRef)(function(e,t){const n=na(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}),o=(0,Nl.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="question",valueAccessor:l,levelAccessor:c,countAccessor:u="count",levels:d=Zl,orientation:h="horizontal",colorScheme:f,barPadding:m=20,tooltip:g,annotations:y,valueExtent:p,frameProps:b={},selection:v,linkedHover:x,onObservation:w,onClick:k,hoverHighlight:S,chartId:A,valueFormat:M,loading:C,loadingContent:j,emptyContent:_,legendInteraction:R,legendPosition:P,categoryFormat:L,stroke:I,strokeWidth:T,opacity:$}=e,{width:B,height:H,enableHover:O,showGrid:F,showLegend:E,title:D,description:W,summary:N,accessibleTable:z,categoryLabel:q,valueLabel:G}=n,V="horizontal"===h,X=void 0===r,Y=!c,U=function(){const e=zs();return e?.colors?.diverging||void 0}(),K=(0,Nl.useMemo)(()=>f&&Array.isArray(f)&&f.length>=d.length?f:function(e,t){if(0>=e)return[];if(t){const n=Gl[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"],r="#a8a8a8";if(1===e)return[r];const i=e%2!=0,s=Math.floor(e/2),a=[];for(let e=0;s>e;e++)a.push(n[Math.min(Math.floor(e*n.length/s),n.length-1)]);i&&a.push(r);for(let e=0;s>e;e++)a.push(o[Math.min(Math.floor(e*o.length/s),o.length-1)]);return a}(d.length,U),[f,d.length,U]),Q=(0,Nl.useMemo)(()=>{const e=new Map;for(let t=0;d.length>t;t++)e.set(d[t],K[t]||"#888");return e},[d,K]),{processedData:Z,reAggregate:J,accumulatorRef:ee}=function({data:e,levels:t,categoryAccessor:n,valueAccessor:o,levelAccessor:r,countAccessor:i,isDiverging:s,frameRef:a}){const l=!r,c=(0,ql.useMemo)(()=>Yl(n,"question"),[n]),u=(0,ql.useMemo)(()=>l?Yl(o,"score"):null,[l,o]),d=(0,ql.useMemo)(()=>l?null:Yl(r,"level"),[l,r]),h=(0,ql.useMemo)(()=>l?null:Yl(i,"count"),[l,i]),f=(0,ql.useRef)([]);return{processedData:(0,ql.useMemo)(()=>{const n=e||[];if(0===n.length)return[];let o=Ul(n,t,c,u,d,h);return s&&(o=Kl(o,t),o=Ql(o,t)),o},[e,t,c,u,d,h,s]),reAggregate:(0,ql.useCallback)(e=>{let n=Ul(e,t,c,u,d,h);s&&(n=Kl(n,t),n=Ql(n,t)),a.current?.replace(n)},[t,c,u,d,h,s,a]),accumulatorRef:f}}({data:r,levels:d,categoryAccessor:a,valueAccessor:l,levelAccessor:c,countAccessor:u,isDiverging:V,frameRef:o}),te="__likertLevelLabel",ne=function({isPushMode:e,colorBy:t,colorScheme:n,showLegend:o,legendPosition:r="right"}){const i=(0,zl.useRef)(new Set),s=(0,zl.useRef)([]),[a,l]=(0,zl.useState)(0),c=ws(),u=Js(),d=(0,zl.useCallback)(e=>{if(!t)return null;const n="function"==typeof t?t(e):e[t];return null!=n?n+"":null},[t]),h=(0,zl.useCallback)(n=>{if(!e||!t)return;let o=!1;for(const e of n){if(!e||"object"!=typeof e)continue;const t=d(e);null==t||i.current.has(t)||(i.current.add(t),s.current.push(t),o=!0)}o&&l(e=>e+1)},[e,t,d]),f=(0,zl.useCallback)(n=>{if(!e||!t)return;const o=Array.from(new Set(n.map(String))),r=s.current;r.length===o.length&&r.every((e,t)=>e===o[t])||(i.current=new Set(o),s.current=o,l(e=>e+1))},[e,t]),m=(0,zl.useCallback)(e=>t=>{h([t]),e(t)},[h]),g=(0,zl.useCallback)(e=>t=>{h(t),e(t)},[h]),y=(0,zl.useCallback)(()=>{i.current=new Set,s.current=[],l(e=>e+1)},[]);Ds(e&&t?s.current:[]);const p=(0,zl.useMemo)(()=>{if(!e||!t||!1===o)return;const r=s.current;if(0===r.length)return;const i=Array.isArray(n)&&n.length>0||"string"==typeof n&&n.length>0?n:u&&u.length>0?u:oe,a="string"==typeof t?t:"__streamCat",l=r.map(e=>({[a]:e})),d=ae(l,a,i);return Ws({data:l,colorBy:a,colorScale:e=>c?.[e]||d(e)||"#999",getColor:ie})},[e,t,o,n,c,u,a]),b=(0,zl.useMemo)(()=>{if(p)return"right"===r?{right:110}:"left"===r?{left:110}:"top"===r?{top:50}:"bottom"===r?{bottom:80}:{right:110}},[p,r]);return{wrapPush:m,wrapPushMany:g,resetCategories:y,categories:s.current,categoryDomainProps:e&&t?{legendCategoryAccessor:t,onCategoriesChange:f}:{},streamingLegend:p,streamingMarginAdjust:b}}({isPushMode:X,colorBy:te,colorScheme:K,showLegend:E,legendPosition:P}),{wrapPush:re,wrapPushMany:se}=ne,le=(0,Nl.useCallback)(e=>re(e=>{ee.current.push(e),J(ee.current)})(e),[re,J,ee]),ce=(0,Nl.useCallback)(e=>se(e=>{ee.current.push(...e),J(ee.current)})(e),[se,J,ee]);(0,Nl.useImperativeHandle)(t,()=>({push:le,pushMany:ce,remove:e=>o.current?.remove(e)??[],update:(e,t)=>o.current?.update(e,t)??[],clear:()=>{ee.current=[],ne.resetCategories(),o.current?.clear()},getData:()=>o.current?.getData()??[],getScales:()=>o.current?.getScales()??null}),[le,ce,ee,ne]);const ue=Ma({data:Z,rawData:r,colorBy:te,colorScheme:K,legendInteraction:R,legendPosition:P,selection:v,linkedHover:x,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:w,onClick:k,hoverHighlight:S,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"LikertChart",chartId:A,showLegend:E,userMargin:i,marginDefaults:n.marginDefaults,loading:C,loadingContent:j,emptyContent:_,width:B,height:H}),de=(0,Nl.useMemo)(()=>{const e=d.length;return e%2!=0&&Q.get(d[Math.floor(e/2)])||"#888"},[d,Q]),he=Ea({colorBy:void 0,colorScale:void 0,color:void 0,themeCategorical:void 0,colorScheme:void 0,categoryIndexMap:ec,userPieceStyle:b?.pieceStyle,stroke:I,strokeWidth:T,opacity:$,effectiveSelectionHook:ue.effectiveSelectionHook,resolvedSelection:ue.resolvedSelection,baseStyleExtras:e=>{const t=e.__likertLevelLabel||e.data?.__likertLevelLabel,n=e.__likertLevel||e.data?.__likertLevel;if(n===Vl||n===Xl)return{fill:de};const o=t||n;return o&&Q.has(o)?{fill:Q.get(o)}:{fill:"#888"}}}),fe=(0,Nl.useMemo)(()=>{const e=d.length;return e%2!=0?d[Math.floor(e/2)]:""},[d]),me=(0,Nl.useMemo)(()=>e=>{const t=e.data||e,n=t.__likertLevel||"Unknown",o=n===Vl||n===Xl?fe:n,r=t.__likertCategory||"",i=Math.abs(t.__likertPct||0),s=n===Vl||n===Xl?2*i:i,a=t.__likertCount||0;return Wl.createElement("div",{className:"semiotic-tooltip",style:_r},Wl.createElement("div",{style:{fontWeight:"bold"}},r),Wl.createElement("div",{style:{marginTop:4}},`${o}: ${s.toFixed(1)}% (n=${a})`))},[fe]),ge=(0,Nl.useMemo)(()=>{if(!d||2>d.length)return"LikertChart requires `levels` with at least 2 entries.";if(l&&c)return"LikertChart: provide either `valueAccessor` (raw responses) or `levelAccessor` + `countAccessor` (pre-aggregated), not both.";if(c&&!u)return"LikertChart: pre-aggregated mode requires both `levelAccessor` and `countAccessor`.";if(void 0!==r&&0===r.length)return null;const e={categoryAccessor:a};return Y?l&&(e.valueAccessor=l):(c&&(e.levelAccessor=c),u&&(e.countAccessor=u)),ka({componentName:"LikertChart",data:r,accessors:e,requiredProps:{levels:d}})},[r,a,l,c,u,d,Y]),ye=(0,Nl.useMemo)(()=>[{styleFn:e=>({fill:Q.get(e.label)||"#888"}),items:d.map(e=>({label:e})),label:""}],[d,Q]),pe=(0,Nl.useMemo)(()=>!1!==E?{...ue.legendBehaviorProps,legend:{legendGroups:ye},legendPosition:P||ue.legendPosition||"bottom"}:ue.legendBehaviorProps,[ue.legendBehaviorProps,ue.legendPosition,P,E,ye]),be=(0,Nl.useMemo)(()=>{const e={...ue.margin};if(X&&!1!==E){const t=P||"bottom";"bottom"===t&&80>e.bottom?e.bottom=80:"top"===t&&50>e.top?e.top=50:"right"===t&&110>e.right?e.right=110:"left"===t&&110>e.left&&(e.left=110)}else if(ne.streamingMarginAdjust)for(const[t,n]of Object.entries(ne.streamingMarginAdjust))n>e[t]&&(e[t]=n);return V&&100>e.left&&(e.left=100),e},[ue.margin,ne.streamingMarginAdjust,V,X,E,P]),ve=(0,Nl.useMemo)(()=>M||(V?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[V,M]);if(ue.earlyReturn)return ue.earlyReturn;const xe={chartType:"bar",...null!=r&&{data:Z},oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:V?"horizontal":"vertical",pieceStyle:he,size:[B,H],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:be,barPadding:m,enableHover:O,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:n.showAxes,oLabel:q,rLabel:G||(V?void 0:"Percentage"),rFormat:ve,...L&&{oFormat:L},showGrid:F,...pe,...D&&{title:D},...W&&{description:W},...N&&{summary:N},...void 0!==z&&{accessibleTable:z},...s&&{className:s},...null!=e.animate&&{animate:e.animate},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},tooltipContent:!1===g?()=>null:!0===g?me:Ir(g)||me,...gs({linkedHover:x,selection:v,onObservation:w,onClick:k,hoverHighlight:S,mobileInteraction:ue.mobileInteraction,customHoverBehavior:ue.customHoverBehavior,customClickBehavior:ue.customClickBehavior}),...y&&y.length>0&&{annotations:y},...p&&{rExtent:p},...Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e))};return ge?(0,Jl.jsx)(ua,{componentName:"LikertChart",message:ge,width:B,height:H}):(0,Jl.jsx)(ya,{componentName:"LikertChart",width:B,height:H,children:(0,Jl.jsx)(fs,{ref:o,...xe})})});tc.displayName="LikertChart";var nc=require("react"),oc=require("react");var rc=require("react/jsx-runtime"),ic=(0,nc.forwardRef)(function(e,t){const{data:n,layout:o,layoutConfig:r,onLayoutError:i,categoryAccessor:s="category",valueAccessor:a="value",oExtent:l,rExtent:c,projection:u="vertical",margin:d,className:h,colorBy:f,colorScheme:m,showAxes:g=!1,annotations:y,onObservation:p,onClick:b,selection:v,linkedHover:x,chartId:w,loading:k,loadingContent:S,emptyContent:A,frameProps:M={}}=e,{frameRef:C,resolved:j,safeData:_,setup:R,earlyReturn:P}=function(e){const t=function(e){const t=(0,oc.useRef)(null);return nl(e.imperativeRef,{variant:e.imperativeVariant,frameRef:t}),{frameRef:t,resolved:na(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),normalizedMargin:(0,oc.useMemo)(()=>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:n,normalizedMargin:o}=t,r=Ma({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:n.showLegend,userMargin:o,marginDefaults:n.marginDefaults,loading:e.loading,loadingContent:e.loadingContent,emptyContent:e.emptyContent,width:n.width,height:n.height});return{...t,safeData:r.data,setup:r,earlyReturn:r.earlyReturn}}({imperativeRef:t,imperativeVariant:"xy",chartTypeLabel:"OrdinalCustomChart",unwrapData:!0,data:n,colorBy:f,colorScheme:m,selection:v,linkedHover:x,onObservation:p,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,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,mode:e.mode,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),L=R.effectiveSelectionHook,I=(0,nc.useMemo)(()=>L?.isActive?{isActive:!0,predicate:L.predicate}:null,[L?.isActive,L?.predicate]);if(P)return P;const{width:T,height:$,enableHover:B,showGrid:H,title:O,description:F,summary:E,accessibleTable:D}=j,W={chartType:"custom",...null!=n&&{data:_},customLayout:o,layoutConfig:r,onLayoutError:i,...I&&{layoutSelection:I},oAccessor:s,rAccessor:a,oExtent:l,rExtent:c,projection:u,colorAccessor:f,colorScheme:m,size:[T,$],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:R.margin,enableHover:B,showAxes:g,showGrid:H,annotations:y,...ms({title:O,description:F,summary:E,accessibleTable:D,className:h,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...gs({linkedHover:x,selection:v,onObservation:p,onClick:b,hoverHighlight:!1,mobileInteraction:R.mobileInteraction,customHoverBehavior:R.customHoverBehavior,customClickBehavior:R.customClickBehavior}),...M};return(0,rc.jsx)(ya,{componentName:"OrdinalCustomChart",width:T,height:$,children:(0,rc.jsx)(fs,{ref:C,...W})})});ic.displayName="OrdinalCustomChart";var sc={fill:"rgba(0,0,0,0)",stroke:"rgba(0,0,0,0)",opacity:0},ac=8;function lc(e){return null==e?void 0:e+""}function cc(e){const t=lc(e.id);return{type:"point",x:e.x,y:e.y,r:e.r??ac,style:{...sc},datum:e.datum,pointId:t,_transitionKey:t}}function uc(e){return{type:"rect",x:e.x,y:e.y,w:e.width,h:e.height,style:{...sc},datum:e.datum,group:e.group,_transitionKey:lc(e.id)}}
|