semiotic 3.8.8 → 3.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +82 -66
- package/agent-skill/semiotic-charts/SKILL.md +11 -2
- package/ai/behaviorContracts.cjs +33 -3
- package/ai/cli.js +53 -2
- package/ai/componentMetadata.cjs +15 -0
- package/ai/dist/mcp-server.js +1530 -611
- package/ai/examples.md +48 -42
- package/{CLAUDE.md → ai/reference.md} +46 -24
- package/ai/schema.json +10704 -825
- package/ai/surface-manifest.json +643 -2
- package/ai/system-prompt.md +83 -130
- package/dist/c-3BLJEQNG.min.js +1 -0
- package/dist/c-3KZD6AXJ.min.js +1 -0
- package/dist/c-4TWEX5HG.min.js +1 -0
- package/dist/c-52TEGIUJ.min.js +1 -0
- package/dist/c-5YCIX3VZ.min.js +1 -0
- package/dist/c-6FEKTA3U.min.js +1 -0
- package/dist/c-6O5EVOPH.min.js +1 -0
- package/dist/c-74HEEZGK.min.js +1 -0
- package/dist/c-AKAF6JAD.min.js +1 -0
- package/dist/c-BBKITSXB.min.js +1 -0
- package/dist/c-BWNB6USU.min.js +1 -0
- package/dist/c-C25ENHIK.min.js +1 -0
- package/dist/c-CDR5AO3R.min.js +1 -0
- package/dist/c-COHXCW3Q.min.js +1 -0
- package/dist/{chunk-scatterplotMatrixBrushOverlay-SDIZSN66.module.min.js → c-DADXPJXV.min.js} +0 -1
- package/dist/c-E3JFRRMI.min.js +1 -0
- package/dist/c-EBFPQHHO.min.js +1 -0
- package/dist/c-G36WS6LN.min.js +1 -0
- package/dist/c-GIKRQI4X.min.js +1 -0
- package/dist/c-GPYOFETM.min.js +1 -0
- package/dist/c-IDUHYYSI.min.js +1 -0
- package/dist/{chunk-chunk-FQPKOAIH.module.min.js → c-IUHFPMHD.min.js} +0 -1
- package/dist/c-J5G56TUH.min.js +1 -0
- package/dist/c-JAZ73J32.min.js +1 -0
- package/dist/c-KG3NXHAL.min.js +1 -0
- package/dist/c-KII3PLZE.min.js +1 -0
- package/dist/c-LIXGXMNS.min.js +1 -0
- package/dist/c-LVEY6D6B.min.js +1 -0
- package/dist/c-M4Y3BHFR.min.js +1 -0
- package/dist/c-MAIICR2Z.min.js +1 -0
- package/dist/c-MG5DM6VE.min.js +1 -0
- package/dist/{chunk-minimapBrushOverlay-JU57U7NM.module.min.js → c-MNF2S4AA.min.js} +0 -1
- package/dist/c-MT3WBK7M.min.js +1 -0
- package/dist/c-NY3JWV2K.min.js +1 -0
- package/dist/c-O6U6K4CW.min.js +1 -0
- package/dist/c-OCI56QF2.min.js +1 -0
- package/dist/c-OQ7M4AGV.min.js +1 -0
- package/dist/c-OXYMVK7Q.min.js +1 -0
- package/dist/c-PPWDL5ZI.min.js +1 -0
- package/dist/c-QHF5YON3.min.js +1 -0
- package/dist/c-RR3GO5SW.min.js +1 -0
- package/dist/{chunk-chunk-J5QD4RAM.module.min.js → c-RSVIHIQ4.min.js} +0 -1
- package/dist/{chunk-chunk-EMO5NUGE.module.min.js → c-S2BXNNJN.min.js} +0 -1
- package/dist/{chunk-chunk-YCQYG6J5.module.min.js → c-SLGMUBUL.min.js} +0 -1
- package/dist/c-SUILCHWU.min.js +1 -0
- package/dist/c-TZW3JGJ5.min.js +1 -0
- package/dist/c-US5ZFT6E.min.js +1 -0
- package/dist/{chunk-chunk-RZH7VZYS.module.min.js → c-USFMFKIH.min.js} +0 -1
- package/dist/c-UUKVD4WB.min.js +1 -0
- package/dist/{chunk-chunk-SV4XAZ3Q.module.min.js → c-VGW3VG3I.min.js} +0 -1
- package/dist/c-W3CE4A4S.min.js +1 -0
- package/dist/{chunk-chunk-2NVFEB7P.module.min.js → c-WJCD5EUY.min.js} +0 -1
- package/dist/{chunk-chunk-2JGJ5GUG.module.min.js → c-X5UBGU2V.min.js} +0 -1
- package/dist/c-YDAY2WFR.min.js +1 -0
- package/dist/c-ZOWWU34K.min.js +1 -0
- package/dist/components/AccessibleNavTree.d.ts +1 -1
- package/dist/components/CategoryColors.d.ts +1 -1
- package/dist/components/GradientLegend.d.ts +14 -0
- package/dist/components/Legend.d.ts +2 -7
- package/dist/components/LinkedCharts.d.ts +1 -1
- package/dist/components/MobileAnnotationCalloutList.d.ts +1 -1
- package/dist/components/ObservationReadout.d.ts +45 -0
- package/dist/components/ThemeProvider.d.ts +4 -4
- package/dist/components/Tooltip/FlippingTooltip.d.ts +5 -7
- package/dist/components/Tooltip/Tooltip.d.ts +83 -5
- package/dist/components/Tooltip/tooltipChrome.d.ts +43 -0
- package/dist/components/ai/chartCapabilityTypes.d.ts +86 -2
- package/dist/components/ai/chartClinic.d.ts +2 -0
- package/dist/components/ai/deriveProfileFields.d.ts +40 -0
- package/dist/components/ai/evaluateChart.d.ts +85 -0
- package/dist/components/ai/fieldPolicy.d.ts +7 -0
- package/dist/components/ai/fieldRoles.d.ts +24 -0
- package/dist/components/ai/generativeChart.d.ts +18 -2
- package/dist/components/ai/inferIntent.d.ts +26 -2
- package/dist/components/ai/intents.d.ts +35 -0
- package/dist/components/ai/navigationTree.d.ts +2 -2
- package/dist/components/ai/observedSceneAudit.d.ts +2 -1
- package/dist/components/ai/profileData.d.ts +11 -0
- package/dist/components/ai/repairChartConfig.d.ts +2 -3
- package/dist/components/ai/semanticEvidence.d.ts +4 -0
- package/dist/components/ai/semanticViability.d.ts +11 -0
- package/dist/components/ai/semanticViabilityRegistry.d.ts +5 -0
- package/dist/components/ai/streamingTypes.d.ts +4 -0
- package/dist/components/ai/suggestCharts.d.ts +5 -6
- package/dist/components/ai/suggestDashboard.d.ts +2 -3
- package/dist/components/ai/suggestStreamCharts.d.ts +1 -1
- package/dist/components/ai/suggestStretchCharts.d.ts +2 -3
- package/dist/components/ai/suggestionPropContracts.d.ts +20 -0
- package/dist/components/ai/variantDiscovery.d.ts +3 -1
- package/dist/components/charts/custom/NetworkCustomChart.d.ts +3 -0
- package/dist/components/charts/custom/OrdinalCustomChart.d.ts +3 -0
- package/dist/components/charts/custom/XYCustomChart.d.ts +1 -1
- package/dist/components/charts/geo/ChoroplethMap.d.ts +3 -1
- package/dist/components/charts/geo/DistanceCartogram.d.ts +2 -7
- package/dist/components/charts/geo/cartogramOverlay.d.ts +28 -0
- package/dist/components/charts/index.d.ts +4 -3
- package/dist/components/charts/network/ProcessSankey.d.ts +2 -136
- package/dist/components/charts/network/ProcessSankeyProps.d.ts +139 -0
- package/dist/components/charts/network/Treemap.d.ts +2 -1
- package/dist/components/charts/network/processSankey/boundaryHubOrdering.d.ts +23 -0
- package/dist/components/charts/network/processSankey/layoutGeometry.d.ts +2 -0
- package/dist/components/charts/network/processSankey/ordering.d.ts +3 -41
- package/dist/components/charts/network/processSankey/orderingTypes.d.ts +32 -0
- package/dist/components/charts/network/processSankey/packing.d.ts +1 -1
- package/dist/components/charts/network/processSankey/packingCache.d.ts +1 -1
- package/dist/components/charts/network/processSankey/packingOptimization.d.ts +72 -0
- package/dist/components/charts/ordinal/BarChart.d.ts +4 -3
- package/dist/components/charts/ordinal/FunnelChart.d.ts +2 -0
- package/dist/components/charts/ordinal/GroupedBarChart.d.ts +3 -2
- package/dist/components/charts/ordinal/StackedBarChart.d.ts +4 -3
- package/dist/components/charts/ordinal/SwimlaneChart.d.ts +2 -2
- package/dist/components/charts/physics/GaltonBoardChart.d.ts +2 -9
- package/dist/components/charts/physics/GauntletChart.d.ts +10 -41
- package/dist/components/charts/physics/ProcessFlowChart.d.ts +1 -1
- package/dist/components/charts/physics/chainReactionAccessibleTable.d.ts +9 -0
- package/dist/components/charts/physics/chainReactionRuntime.d.ts +2 -1
- package/dist/components/charts/physics/chainReactionTypes.d.ts +6 -1
- package/dist/components/charts/physics/crucibleBodyRenderers.d.ts +2 -2
- package/dist/components/charts/physics/crucibleClone.d.ts +6 -0
- package/dist/components/charts/physics/crucibleEffects.d.ts +1 -2
- package/dist/components/charts/physics/crucibleRecord.d.ts +7 -0
- package/dist/components/charts/physics/gauntletChrome.d.ts +4 -4
- package/dist/components/charts/physics/gauntletPhysics.d.ts +1 -0
- package/dist/components/charts/physics/gauntletPublic.d.ts +4 -0
- package/dist/components/charts/physics/packetFlowOverlay.d.ts +7 -0
- package/dist/components/charts/physics/physicsChartLayout.d.ts +8 -0
- package/dist/components/charts/physics/physicsChartShared.d.ts +3 -1
- package/dist/components/charts/physics/physicsChartUtils.d.ts +1 -1
- package/dist/components/charts/physics/physicsHocUtils.d.ts +26 -13
- package/dist/components/charts/physics/physicsProjectionOverlays.d.ts +24 -0
- package/dist/components/charts/physics/processFlowOverlays.d.ts +9 -0
- package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +17 -12
- package/dist/components/charts/realtime/RealtimeHistogram.d.ts +12 -7
- package/dist/components/charts/realtime/RealtimeLineChart.d.ts +37 -14
- package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +23 -14
- package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +22 -13
- package/dist/components/charts/realtime/aggregate.d.ts +4 -1
- package/dist/components/charts/realtime/eventTime.d.ts +4 -0
- package/dist/components/charts/realtime/realtimeChartRuntime.d.ts +27 -0
- package/dist/components/charts/realtime/realtimeChartTypes.d.ts +30 -0
- package/dist/components/charts/realtime/useRealtimeCategoryColors.d.ts +30 -0
- package/dist/components/charts/shared/FrameTextAnnotationSVG.d.ts +10 -0
- package/dist/components/charts/shared/annotationActivation.d.ts +3 -7
- package/dist/components/charts/shared/annotationBandFill.d.ts +6 -0
- package/dist/components/charts/shared/annotationDispatch.d.ts +31 -0
- package/dist/components/charts/shared/annotationIdentity.d.ts +8 -0
- package/dist/components/charts/shared/annotationRules.d.ts +1 -15
- package/dist/components/charts/shared/boundedCategoryRegistry.d.ts +8 -0
- package/dist/components/charts/shared/chainReactionChartSpec.d.ts +3 -0
- package/dist/components/charts/shared/chartMode.d.ts +3 -2
- package/dist/components/charts/shared/chartSpecCore.d.ts +1 -0
- package/dist/components/charts/shared/formatUtils.d.ts +40 -9
- package/dist/components/charts/shared/frameTextAnnotation.d.ts +63 -0
- package/dist/components/charts/shared/gradient.d.ts +16 -0
- package/dist/components/charts/shared/hatchFill.d.ts +15 -0
- package/dist/components/charts/shared/hooks.d.ts +4 -4
- package/dist/components/charts/shared/legendUtils.d.ts +1 -0
- package/dist/components/charts/shared/streamPropsHelpers.d.ts +3 -1
- package/dist/components/charts/shared/styleRules.d.ts +9 -2
- package/dist/components/charts/shared/styleRulesWireSchema.d.ts +353 -0
- package/dist/components/charts/shared/types.d.ts +26 -10
- package/dist/components/charts/shared/useChartLegend.d.ts +43 -9
- package/dist/components/charts/shared/useChartSetup.d.ts +3 -1
- package/dist/components/charts/shared/useCustomChartSetup.d.ts +5 -2
- package/dist/components/charts/shared/useNetworkChartSetup.d.ts +5 -1
- package/dist/components/charts/shared/useOrdinalBrush.d.ts +3 -3
- package/dist/components/charts/shared/useStreamingLegend.d.ts +6 -1
- package/dist/components/charts/value/types.d.ts +1 -1
- package/dist/components/charts/xy/BubbleChart.d.ts +1 -1
- package/dist/components/charts/xy/BumpChart.capability.d.ts +14 -1
- package/dist/components/charts/xy/BumpChart.d.ts +13 -73
- package/dist/components/charts/xy/BumpChart.semanticViability.d.ts +5 -0
- package/dist/components/charts/xy/CandlestickChart.d.ts +2 -2
- package/dist/components/charts/xy/LineChart.d.ts +2 -2
- package/dist/components/charts/xy/Scatterplot.d.ts +1 -1
- package/dist/components/charts/xy/bumpData.d.ts +44 -0
- package/dist/components/charts/xy/bumpIdentity.d.ts +2 -0
- package/dist/components/charts/xy/bumpLayout.d.ts +45 -0
- package/dist/components/charts/xy/bumpTooltip.d.ts +20 -0
- package/dist/components/legendLayout.d.ts +131 -4
- package/dist/components/realtime/ReorderBuffer.d.ts +2 -0
- package/dist/components/realtime/types.d.ts +10 -1
- package/dist/components/recipes/balanceSnapshotsToFlows.d.ts +42 -0
- package/dist/components/recipes/directedReachability.d.ts +14 -0
- package/dist/components/recipes/gofishDisplayListFixtures.generated.d.ts +6 -6
- package/dist/components/recipes/gridObservatory.d.ts +1 -1
- package/dist/components/recipes/networkAnalysis.d.ts +1 -18
- package/dist/components/recipes/physics.d.ts +7 -4
- package/dist/components/recipes/processPhysics.d.ts +0 -1
- package/dist/components/recipes/waffle.d.ts +7 -4
- package/dist/components/semiotic-ai-core.d.ts +13 -4
- package/dist/components/semiotic-ai-observations.d.ts +3 -0
- package/dist/components/semiotic-ai.d.ts +16 -9
- package/dist/components/semiotic-client-shared.d.ts +10 -0
- package/dist/components/semiotic-experimental.d.ts +1 -1
- package/dist/components/semiotic-geo.d.ts +4 -1
- package/dist/components/semiotic-network.d.ts +7 -4
- package/dist/components/semiotic-ordinal.d.ts +4 -1
- package/dist/components/semiotic-physics.d.ts +11 -4
- package/dist/components/semiotic-realtime-core.d.ts +11 -4
- package/dist/components/semiotic-realtime-react.d.ts +4 -3
- package/dist/components/semiotic-realtime.d.ts +3 -1
- package/dist/components/semiotic-recipes-core.d.ts +7 -5
- package/dist/components/semiotic-server-edge.d.ts +3 -2
- package/dist/components/semiotic-server.d.ts +3 -2
- package/dist/components/semiotic-themes-core.d.ts +5 -48
- package/dist/components/semiotic-utils-core.d.ts +11 -5
- package/dist/components/semiotic-utils-react.d.ts +2 -0
- package/dist/components/semiotic-xy.d.ts +4 -1
- package/dist/components/semiotic.d.ts +68 -25
- package/dist/components/server/animatedGif.d.ts +1 -1
- package/dist/components/server/renderEvidence.d.ts +25 -2
- package/dist/components/server/renderToStaticSVG.d.ts +15 -7
- package/dist/components/server/serverChartConfigShared.d.ts +8 -1
- package/dist/components/server/serverChartConfigs.d.ts +1 -0
- package/dist/components/server/serverChartConfigsNetwork.d.ts +3 -3
- package/dist/components/server/serverChartConfigsNetworkChord.d.ts +2 -0
- package/dist/components/server/serverChartConfigsNetworkForce.d.ts +2 -0
- package/dist/components/server/serverChartConfigsNetworkHierarchy.d.ts +3 -0
- package/dist/components/server/serverChartConfigsXY.d.ts +3 -3
- package/dist/components/server/serverChartConfigsXYBubble.d.ts +5 -0
- package/dist/components/server/serverChartConfigsXYBump.d.ts +7 -0
- package/dist/components/server/serverChartConfigsXYScatter.d.ts +5 -0
- package/dist/components/server/staticAnnotationFallbacks.d.ts +10 -0
- package/dist/components/server/staticAnnotations.d.ts +28 -1
- package/dist/components/server/staticAxisTickLabel.d.ts +13 -0
- package/dist/components/server/staticLegend.d.ts +1 -1
- package/dist/components/server/staticLegendMargin.d.ts +41 -0
- package/dist/components/server/staticOrdinal.d.ts +8 -2
- package/dist/components/server/staticPhysics.d.ts +13 -1
- package/dist/components/server/staticPhysicsChrome.d.ts +20 -0
- package/dist/components/server/staticRawLegend.d.ts +15 -0
- package/dist/components/server/staticSVGChrome.d.ts +16 -55
- package/dist/components/server/staticXYAxes.d.ts +27 -0
- package/dist/components/server/staticXYAxisTicks.d.ts +39 -0
- package/dist/components/server/staticXYGrid.d.ts +11 -0
- package/dist/components/server/themeResolver.d.ts +5 -1
- package/dist/components/store/ThemeStore.d.ts +2 -98
- package/dist/components/store/designTokens.d.ts +1 -1
- package/dist/components/store/themeCSSVariables.d.ts +10 -0
- package/dist/components/store/themeCore.d.ts +91 -0
- package/dist/components/store/themePresets.d.ts +81 -0
- package/dist/components/store/themeSerialization.d.ts +2 -1
- package/dist/components/stream/AccessibleDataTable.d.ts +12 -14
- package/dist/components/stream/AccessibleTablePortalImpl.d.ts +6 -0
- package/dist/components/stream/GeoTileRenderer.d.ts +3 -0
- package/dist/components/stream/NetworkCanvasHitTester.d.ts +3 -1
- package/dist/components/stream/NetworkSSRFrame.d.ts +2 -1
- package/dist/components/stream/NetworkSVGOverlay.d.ts +3 -31
- package/dist/components/stream/OrdinalCanvasHitTester.d.ts +2 -0
- package/dist/components/stream/SVGChartTitle.d.ts +9 -0
- package/dist/components/stream/SVGOverlay.d.ts +1 -21
- package/dist/components/stream/SVGUnderlay.d.ts +24 -0
- package/dist/components/stream/SceneToSVG.d.ts +1 -1
- package/dist/components/stream/StreamGeoFrame.d.ts +1 -1
- package/dist/components/stream/StreamOrdinalFrame.d.ts +1 -1
- package/dist/components/stream/StreamXYFrame.d.ts +1 -1
- package/dist/components/stream/accessibleDataRows.d.ts +11 -0
- package/dist/components/stream/accessibleDataTableModel.d.ts +40 -0
- package/dist/components/stream/accessibleTableTypes.d.ts +11 -0
- package/dist/components/stream/axisTickUtils.d.ts +19 -0
- package/dist/components/stream/canvasBackground.d.ts +10 -0
- package/dist/components/stream/canvasSetup.d.ts +24 -4
- package/dist/components/stream/frameCursorInteraction.d.ts +25 -0
- package/dist/components/stream/frameDefaultMargins.d.ts +37 -0
- package/dist/components/stream/frameGraphics.d.ts +18 -0
- package/dist/components/stream/frameGraphicsSubscription.d.ts +26 -0
- package/dist/components/stream/frameLegendOptions.d.ts +18 -0
- package/dist/components/stream/geoFrameCursorInteraction.d.ts +9 -0
- package/dist/components/stream/geoFrameHelpers.d.ts +29 -1
- package/dist/components/stream/geoTypes.d.ts +12 -11
- package/dist/components/stream/hitTarget.d.ts +61 -2
- package/dist/components/stream/moduleWorkerSession.d.ts +6 -0
- package/dist/components/stream/networkAnnotationAnchors.d.ts +37 -0
- package/dist/components/stream/networkCustomLayout.d.ts +2 -2
- package/dist/components/stream/networkFrameCursorInteraction.d.ts +12 -0
- package/dist/components/stream/networkFrameInteraction.d.ts +2 -0
- package/dist/components/stream/networkFramePaint.d.ts +15 -0
- package/dist/components/stream/networkPipelineConfig.d.ts +1 -1
- package/dist/components/stream/networkTypes.d.ts +32 -32
- package/dist/components/stream/normalizeXYData.d.ts +7 -0
- package/dist/components/stream/ordinalFrameCursorInteraction.d.ts +7 -0
- package/dist/components/stream/ordinalFrameInteraction.d.ts +29 -0
- package/dist/components/stream/ordinalSceneSVG.d.ts +10 -0
- package/dist/components/stream/ordinalTypes.d.ts +12 -4
- package/dist/components/stream/physics/PhysicsBodySpatialIndex.d.ts +9 -1
- package/dist/components/stream/physics/PhysicsCanvasTheme.d.ts +25 -0
- package/dist/components/stream/physics/PhysicsControllers.d.ts +0 -3
- package/dist/components/stream/physics/PhysicsPipelineStore.d.ts +4 -1
- package/dist/components/stream/physics/PhysicsSVGOverlay.d.ts +3 -24
- package/dist/components/stream/physics/PhysicsSettledSVG.d.ts +9 -21
- package/dist/components/stream/physics/PhysicsSettledSVGElement.d.ts +37 -0
- package/dist/components/stream/physics/PhysicsSettledScene.d.ts +7 -3
- package/dist/components/stream/physics/StreamPhysicsFrame.d.ts +1 -1
- package/dist/components/stream/physics/StreamPhysicsTypes.d.ts +25 -4
- package/dist/components/stream/physics/physicsAnnotationContext.d.ts +19 -0
- package/dist/components/stream/physics/physicsBodyCanvas.d.ts +4 -0
- package/dist/components/stream/physics/physicsSettledChrome.d.ts +7 -0
- package/dist/components/stream/physics/usePhysicsCanvasPointer.d.ts +32 -0
- package/dist/components/stream/physics/usePhysicsSemanticNavigation.d.ts +36 -0
- package/dist/components/stream/pipelineConfig.d.ts +8 -17
- package/dist/components/stream/pipelineDomainResolution.d.ts +2 -2
- package/dist/components/stream/renderBackend.d.ts +2 -0
- package/dist/components/stream/renderers/canvasRenderHelpers.d.ts +13 -2
- package/dist/components/stream/renderers/resolveCSSColor.d.ts +7 -0
- package/dist/components/stream/responsiveSize.d.ts +17 -0
- package/dist/components/stream/sceneCursor.d.ts +41 -0
- package/dist/components/stream/sceneRevisionDiagnostics.d.ts +1 -1
- package/dist/components/stream/svgOverlayUtils.d.ts +22 -1
- package/dist/components/stream/types.d.ts +33 -13
- package/dist/components/stream/useCanvasFrameHost.d.ts +12 -1
- package/dist/components/stream/useFrame.d.ts +24 -1
- package/dist/components/stream/useResponsiveSize.d.ts +6 -1
- package/dist/components/stream/useStalenessCheck.d.ts +1 -1
- package/dist/components/stream/xyFrameAxisTypes.d.ts +20 -4
- package/dist/components/stream/xyFrameCursorInteraction.d.ts +6 -0
- package/dist/components/stream/xySceneBuilders/swarmScene.d.ts +1 -1
- package/dist/components/stream/xySceneBuilders/types.d.ts +6 -26
- package/dist/components/types/legendTypes.d.ts +6 -0
- package/dist/components/types/marginType.d.ts +7 -8
- 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.module.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/processSankeyLayoutWorker.js +1 -1
- package/dist/realtime.min.js +1 -1
- package/dist/realtime.module.min.js +1 -1
- package/dist/rough.min.js +1 -1
- package/dist/rough.module.min.js +1 -1
- package/dist/semiotic-ai-core.d.ts +13 -4
- 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 +16 -9
- package/dist/semiotic-ai.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-client-cjs-shared.min.js +1 -0
- package/dist/semiotic-client-glyph.module.min.js +2 -0
- package/dist/semiotic-client-responsive.module.min.js +2 -0
- package/dist/semiotic-client-shared.module.min.js +2 -0
- package/dist/semiotic-custom-layout-selection-cjs-shared.min.js +2 -0
- package/dist/semiotic-data.min.js +1 -1
- package/dist/semiotic-data.module.min.js +1 -1
- package/dist/semiotic-experimental-auxiliary.module.min.js +2 -0
- package/dist/semiotic-experimental-node-auxiliary.module.min.js +2 -0
- package/dist/semiotic-experimental-node.module.min.js +2 -0
- package/dist/semiotic-experimental-react-shared.module.min.js +2 -0
- package/dist/semiotic-experimental-vacp.min.js +1 -1
- package/dist/semiotic-experimental-vacp.module.min.js +1 -1
- package/dist/semiotic-experimental.d.ts +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 -1
- package/dist/semiotic-network.d.ts +7 -4
- package/dist/semiotic-ordinal.d.ts +4 -1
- package/dist/semiotic-physics.d.ts +11 -4
- package/dist/semiotic-realtime-core.d.ts +11 -4
- package/dist/semiotic-realtime-core.min.js +2 -1
- package/dist/semiotic-realtime-core.module.min.js +2 -1
- package/dist/semiotic-realtime-react.d.ts +4 -3
- package/dist/semiotic-realtime-react.min.js +1 -1
- package/dist/semiotic-realtime-react.module.min.js +1 -1
- package/dist/semiotic-realtime.d.ts +3 -1
- package/dist/semiotic-recipes-core-cjs-base.min.js +1 -0
- package/dist/semiotic-recipes-core.d.ts +7 -5
- package/dist/semiotic-recipes-core.min.js +9 -1
- package/dist/semiotic-recipes-core.module.min.js +1 -1
- package/dist/semiotic-recipes-geo-cjs.min.js +1 -0
- 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 +7 -1
- package/dist/semiotic-recipes.module.min.js +2 -1
- package/dist/semiotic-server-edge-node.module.min.js +1 -0
- package/dist/semiotic-server-edge.d.ts +3 -2
- 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-server.d.ts +3 -2
- package/dist/semiotic-themes-core.d.ts +5 -48
- 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 +11 -5
- package/dist/semiotic-utils-core.min.js +1 -1
- package/dist/semiotic-utils-core.module.min.js +1 -1
- package/dist/semiotic-utils-react.d.ts +2 -0
- 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 +2 -1
- package/dist/semiotic-utils.module.min.js +2 -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 -1
- package/dist/semiotic.d.ts +68 -25
- package/dist/semiotic.min.js +1 -1
- package/dist/semiotic.module.min.js +1 -1
- package/dist/server.min.js +1 -1
- package/dist/server.module.min.js +1 -1
- package/dist/xy.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +53 -19
- package/dist/__tests__/scenarios/mcpProtocolTypes.d.ts +0 -20
- package/dist/chunk-OrdinalBrushOverlay-PXHQYDB2.module.min.js +0 -2
- package/dist/chunk-XYBrushOverlay-ECZJJLAJ.module.min.js +0 -1
- package/dist/chunk-XYBrushOverlay-EP2SV3UI.module.min.js +0 -2
- package/dist/chunk-chartContainerDataAudit-IQ3NBN3Q.module.min.js +0 -2
- package/dist/chunk-chunk-2B3AIKUZ.module.min.js +0 -2
- package/dist/chunk-chunk-2CXCXRB4.module.min.js +0 -1
- package/dist/chunk-chunk-3GCILWPB.module.min.js +0 -2
- package/dist/chunk-chunk-46KRGJQP.module.min.js +0 -1
- package/dist/chunk-chunk-4ITOQRXM.module.min.js +0 -2
- package/dist/chunk-chunk-4MLLQUGW.module.min.js +0 -2
- package/dist/chunk-chunk-57RBPDBQ.module.min.js +0 -2
- package/dist/chunk-chunk-5UKL5W76.module.min.js +0 -2
- package/dist/chunk-chunk-5VVNW5AZ.module.min.js +0 -1
- package/dist/chunk-chunk-66PCWJUG.module.min.js +0 -1
- package/dist/chunk-chunk-6V5VQVCT.module.min.js +0 -2
- package/dist/chunk-chunk-7LE56WAE.module.min.js +0 -2
- package/dist/chunk-chunk-7T25U75Z.module.min.js +0 -2
- package/dist/chunk-chunk-ACLDBMRH.module.min.js +0 -2
- package/dist/chunk-chunk-AF53TBSN.module.min.js +0 -2
- package/dist/chunk-chunk-BTZYH2IE.module.min.js +0 -1
- package/dist/chunk-chunk-BWV55BZK.module.min.js +0 -2
- package/dist/chunk-chunk-BZNOAHJV.module.min.js +0 -2
- package/dist/chunk-chunk-CD6PVVS3.module.min.js +0 -2
- package/dist/chunk-chunk-DTSNLGRK.module.min.js +0 -2
- package/dist/chunk-chunk-FC3NZWYR.module.min.js +0 -2
- package/dist/chunk-chunk-FEPXDKJP.module.min.js +0 -1
- package/dist/chunk-chunk-FJ76HWQZ.module.min.js +0 -1
- package/dist/chunk-chunk-FRGBMTZR.module.min.js +0 -1
- package/dist/chunk-chunk-G75OPF5N.module.min.js +0 -2
- package/dist/chunk-chunk-H5IFO6CU.module.min.js +0 -2
- package/dist/chunk-chunk-HADHLMY5.module.min.js +0 -1
- package/dist/chunk-chunk-HBFA4NN6.module.min.js +0 -1
- package/dist/chunk-chunk-HCNDE26Q.module.min.js +0 -2
- package/dist/chunk-chunk-IY7RYD4S.module.min.js +0 -1
- package/dist/chunk-chunk-J3QOW4OE.module.min.js +0 -0
- package/dist/chunk-chunk-J3XWETBJ.module.min.js +0 -2
- package/dist/chunk-chunk-JJ4BSUYL.module.min.js +0 -2
- package/dist/chunk-chunk-JRHXQGEV.module.min.js +0 -2
- package/dist/chunk-chunk-KTWEBFMX.module.min.js +0 -2
- package/dist/chunk-chunk-L6FFYGYS.module.min.js +0 -1
- package/dist/chunk-chunk-LJDH3WV3.module.min.js +0 -2
- package/dist/chunk-chunk-LSJUXBMF.module.min.js +0 -1
- package/dist/chunk-chunk-N3Q33XCB.module.min.js +0 -2
- package/dist/chunk-chunk-NWIGA3UK.module.min.js +0 -1
- package/dist/chunk-chunk-OG3TTJGJ.module.min.js +0 -2
- package/dist/chunk-chunk-OZK46A5U.module.min.js +0 -1
- package/dist/chunk-chunk-PMR47KRY.module.min.js +0 -2
- package/dist/chunk-chunk-Q2YADC2V.module.min.js +0 -2
- package/dist/chunk-chunk-QQJNG23C.module.min.js +0 -2
- package/dist/chunk-chunk-RGJ6TKAH.module.min.js +0 -2
- package/dist/chunk-chunk-ROP4HI7H.module.min.js +0 -2
- package/dist/chunk-chunk-SFLUSZ73.module.min.js +0 -2
- package/dist/chunk-chunk-TCMHJWFJ.module.min.js +0 -1
- package/dist/chunk-chunk-TSCFL235.module.min.js +0 -1
- package/dist/chunk-chunk-U66USBWU.module.min.js +0 -1
- package/dist/chunk-chunk-UEZ6SHW5.module.min.js +0 -2
- package/dist/chunk-chunk-UOQRPGPK.module.min.js +0 -2
- package/dist/chunk-chunk-VUWYT7DY.module.min.js +0 -2
- package/dist/chunk-chunk-W5HWGQMD.module.min.js +0 -2
- package/dist/chunk-chunk-WFHZHWT7.module.min.js +0 -1
- package/dist/chunk-chunk-WGROBM3I.module.min.js +0 -2
- package/dist/chunk-chunk-WSDJFBKX.module.min.js +0 -2
- package/dist/chunk-chunk-YHNZCPOZ.module.min.js +0 -2
- package/dist/chunk-chunk-YWZB3KPI.module.min.js +0 -2
- package/dist/chunk-statisticalOverlays-HMYYSGPE.module.min.js +0 -2
- package/dist/components/stream/test-utils/frameScheduler.d.ts +0 -12
- package/dist/components/stream/test-utils/revisionConsumption.d.ts +0 -13
- package/dist/test-utils/canvasMock.d.ts +0 -86
- package/dist/test-utils/capturedFrameProps.d.ts +0 -67
- package/dist/test-utils/frameMock.d.ts +0 -81
- package/dist/test-utils/ordinalFixtures.d.ts +0 -48
- /package/dist/{chunk-chunk-JJ2OOIET.module.min.js → c-GGISSW5E.min.js} +0 -0
- /package/dist/{chunk-chunk-SIRIJ3DY.module.min.js → c-N4G2L7ID.min.js} +0 -0
- /package/dist/{chunk-chunk-CA3YDW6F.module.min.js → c-S6U5CGT5.min.js} +0 -0
- /package/dist/components/recipes/{mobileAnnotationStrategy.d.ts → mobileAnnotationBehavior.d.ts} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{useReducedMotion as t,useTheme as e}from"./chunk-chunk-OZK46A5U.module.min.js";import{IncrementalExtent as n,RingBuffer as r,annotationActivationProps as i,buildHoverData as o,coerceDateLikeValue as a,defaultTooltipStyle as s,extractAllRows as l,getHitRadius as c,getPointerHitRadius as u,hatchPatternDef as h,hitTestRect as d,isAnnotationActivationTarget as f,isHatchFill as y,isTimeLandmark as p,parseDateLikeString as g,resolveHatchCanvasPattern as m,resolveResponsiveRules as x,resolveSvgFill as b,smartTooltipEntries as v,useAnnotationActivationOptions as k,useObservationSelector as w}from"./chunk-chunk-L6FFYGYS.module.min.js";import{FrameRuntime as A,SEQUENTIAL_INTERPOLATORS as M,UpdateResultTracker as S,annotationLayout as $,drawGlyphParts as P,forceLayoutPlugin as _,getSequentialInterpolator as C,glyphFractionClipRect as L,glyphHitGeometry as T,glyphPlacement as D,isInBounds as R,makeSymbolResolver as W,resolveAnchoredPosition as E,resolveGlyphPaint as N,resolveX as O,resolveY as I,schemeCategory10 as z,schemeSet3 as F,schemeTableau10 as Y,symbolPathString as B,symbolRadius as j,wrapWithCustomLayoutSelection as X,wrapWithDataHint as G}from"./chunk-chunk-LSJUXBMF.module.min.js";import{bandFromAge as H,filterAnnotationsByStatus as V}from"./chunk-chunk-5VVNW5AZ.module.min.js";import{accessorsEquivalent as q,resolveAccessor as U,resolveLabelFn as Z,resolveNodeRefId as K,resolveRawAccessor as J,resolveStringAccessor as Q}from"./chunk-chunk-NWIGA3UK.module.min.js";import{getMax as tt,getMinMax as et}from"./chunk-chunk-JJ2OOIET.module.min.js";import{clearCSSColorCache as nt,getCSSColorCacheVersion as rt,resolveCSSColor as it}from"./chunk-chunk-IY7RYD4S.module.min.js";import{createStore as ot,hasOwnEnumerableKey as at,resolveThemeSemanticColors as st,useThemeSelector as lt}from"./chunk-chunk-HADHLMY5.module.min.js";function ct(t,e,n){if(null!=t)return"function"==typeof t?t(e,n):"object"==typeof t&&null!==t&&"constant"in t?t.constant:e[t]}function ut(t){const{data:e,encoding:n}=t,r=[],i=new Map;return e.forEach((t,e)=>{const o=ct(n.id,t,e);if(null==o||""===o)throw Error(`[semiotic] Motion encoding row ${e} resolved an empty id.`);const a=o+"";if(i.has(a))throw Error(`[semiotic] Duplicate motion encoding id "${a}".`);const s=ct(n.process?.group,t,e),l=ct(n.process?.stage,t,e),c=ct(n.accessible?.group,t,e)??(null!=s?s+"":null!=l?l+"":void 0),u={};for(const r of Object.keys(n.evidence??{}))u[r]=ct(n.evidence?.[r],t,e);const h={id:a,datum:t,time:{arrival:ct(n.time?.arrival,t,e),basis:n.time?.basis,unit:n.time?.unit},placement:{x:ct(n.placement?.x,t,e),y:ct(n.placement?.y,t,e),lane:ct(n.placement?.lane,t,e),space:n.placement?.space},kinematics:{velocityX:ct(n.kinematics?.velocityX,t,e),velocityY:ct(n.kinematics?.velocityY,t,e),space:n.kinematics?.space},process:{group:s,stage:l,target:ct(n.process?.target,t,e),work:ct(n.process?.work,t,e)},evidence:u,accessible:{description:ct(n.accessible?.description,t,e),group:c,label:ct(n.accessible?.label,t,e)??a}};r.push(h),i.set(a,h)}),{rows:r,byId:i}}function ht(t){const e=Math.max(0,Math.min(1,t.minOpacity??.1));if(Number.isNaN(t.age))return 1;if(t.age===1/0)return e;if(!Number.isFinite(t.extent)||0>=t.extent)return 1;const n=Math.max(0,t.age);if("step"===t.type)return(t.threshold??.5*t.extent)>n?1:e;if("exponential"===t.type){const r=t.halfLife??t.extent/2;return e+Math.pow(.5,n/(r>0?r:t.extent/2))*(1-e)}return e+Math.max(0,Math.min(1,1-n/t.extent))*(1-e)}function dt(t,e){const n=Number.isFinite(t)?t:0,r=Number.isFinite(e)?e:0;return{velocityX:n,velocityY:r,speed:Math.hypot(n,r),direction:Math.atan2(r,n)}}function ft(t,e,n){return Number.isFinite(n)&&n>0?dt((e.x-t.x)/n,(e.y-t.y)/n):dt(0,0)}import*as yt from"react";import{useRef as pt,useState as gt,useEffect as mt,useMemo as xt,useCallback as bt,useImperativeHandle as vt,useId as kt,forwardRef as wt,memo as At}from"react";import*as Mt from"react";import{jsx as St}from"react/jsx-runtime";var $t=null,Pt=null;function _t(t){const[e,n]=Mt.useState(()=>$t);return Mt.useEffect(()=>{if(e)return;let t=!1;return($t?Promise.resolve($t):(Pt||(Pt=import("./chunk-XYBrushOverlay-ECZJJLAJ.module.min.js").then(t=>$t=t.XYBrushOverlay).catch(t=>{throw Pt=null,t})),Pt)).then(e=>{t||n(()=>e)}),()=>{t=!0}},[e]),e?St(e,{...t}):null}var Ct=Object.freeze([]);function Lt(t){if(!t)return Ct;let e=!1;for(let n=0;t.length>n;n++){const r=t[n];if(null==r||"object"!=typeof r){e=!0;break}}if(!e)return t;const n=[];for(const e of t)null!=e&&"object"==typeof e&&n.push(e);return n}var Tt=class{constructor(t,e){this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=t,this.chunkThreshold=e?.chunkThreshold??5e3,this.chunkSize=e?.chunkSize??5e3}updateChunkOptions(t){null!=t.chunkThreshold&&(this.chunkThreshold=t.chunkThreshold),null!=t.chunkSize&&(this.chunkSize=t.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(t){if(t=Lt(t),this.lastBoundedData===t)return;if(this.lastBoundedData=t,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=t.length)return void this.callback({inserts:t,bounded:!0});this.callback({inserts:t.slice(0,this.chunkSize),bounded:!0,totalSize:t.length});let e=this.chunkSize;const n=()=>{if(e>=t.length)return void(this.chunkTimer=0);if(t!==this.lastBoundedData)return void(this.chunkTimer=0);const r=Math.min(e+this.chunkSize,t.length);this.callback({inserts:t.slice(e,r),bounded:!1}),e=r,this.chunkTimer=t.length>e?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}setReplacementData(t){if(t=Lt(t),this.lastBoundedData=t,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.pushBuffer=[],this.flushScheduled=!1,this.chunkThreshold>=t.length)return void this.callback({inserts:t,bounded:!0,preserveCategoryOrder:!0});this.callback({inserts:t.slice(0,this.chunkSize),bounded:!0,preserveCategoryOrder:!0,totalSize:t.length});let e=this.chunkSize;const n=()=>{if(e>=t.length)return void(this.chunkTimer=0);if(t!==this.lastBoundedData)return void(this.chunkTimer=0);const r=Math.min(e+this.chunkSize,t.length);this.callback({inserts:t.slice(e,r),bounded:!1}),e=r,this.chunkTimer=t.length>e?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const t=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:t,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(t){null!=t&&"object"==typeof t&&(this.pushBuffer.push(t),this.scheduleFlush())}pushMany(t){if(0===t.length)return;let e=0;for(let n=0;t.length>n;n++){const r=t[n];null!=r&&"object"==typeof r&&(this.pushBuffer.push(r),e++)}0!==e&&this.scheduleFlush()}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}};function Dt(t){return new Set(Array.isArray(t)?t:[t])}import{scaleOrdinal as Rt}from"d3-scale";var Wt={category10:z,tableau10:Y,set3:F,...M},Et=z,Nt="#007bff";function Ot(t,e,n=Et){if(t&&"object"==typeof t&&!Array.isArray(t)){const e=Object.values(t).filter(t=>"string"==typeof t&&t.length>0);if(e.length>0)return e}if(Array.isArray(t)&&t.length>0)return t;if("string"==typeof t){const e=Wt[t];if(Array.isArray(e)&&e.length>0)return e}return e&&e.length>0?e:n}var It=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],zt=["#f0f0f0","#b5d4ea","#f4c2a1","#b8dab2","#d4b5e0","#f9e0a2","#a8d8d8"],Ft=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 Yt(t,e,n){if("function"==typeof e){const r=e(t);return n&&r&&"string"==typeof r&&!function(t){const e=t.toLowerCase();return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")||Ft.has(e)}(r)?n(r):r}const r=t?.[e]+"";return n?n(r):Et[Math.abs(function(t){let e=0;for(let n=0;t.length>n;n++)e=(e<<5)-e+t.charCodeAt(n),e&=e;return Math.abs(e)}(r))%Et.length]}function Bt(t,e){if(null==e||!Object.prototype.hasOwnProperty.call(t,e))return;const n=t[e];return"string"==typeof n&&n.length>0?n:void 0}function jt(t,e,n="category10"){if(n&&"object"==typeof n&&!Array.isArray(n)){const t=n;return e=>Bt(t,e)??"#999"}const r=Array.from(new Set(t.map(t=>t?.[e]).filter(t=>null!=t).map(t=>t+""))),i=r.every(t=>!isNaN(Number(t)));if(Array.isArray(n))return Rt().domain(r).range(n).unknown("#999");const o=Wt[n]||Wt.category10;if(i&&"function"==typeof o){let t=-1/0;for(const e of r){const n=Number(e);n>t&&(t=n)}return e=>o(Number(e)/t)}{const t=Array.isArray(o)?o:Et;return Rt().domain(r).range(t).unknown("#999")}}function Xt(t,e,n=[3,20],r){let i;if(i="function"==typeof e?e(t):t?.[e],!r)return i;const[o,a]=r,[s,l]=n;if(a===o)return(s+l)/2;let c=(i-o)/(a-o);return 0>c?c=0:c>1&&(c=1),s+c*(l-s)}function Gt(t,e="ease-out-cubic"){return"linear"===e?t:1-Math.pow(1-t,3)}function Ht(t,e){return Math.min((t-e.startTime)/e.duration,1)}function Vt(t,e,n){return t+(e-t)*n}function qt(){return"undefined"!=typeof performance?performance.now():Date.now()}function Ut(t,e,n){if(1>=n)return 1;const r=n-1;return ht({age:r-e,extent:r,type:t.type,halfLife:t.halfLife??n/2,threshold:t.stepThreshold??.5*n,minOpacity:t.minOpacity??.1})}function Zt(t){const e=new Map;for(let n=0;t.length>n;n++)e.set(t[n],n);return e}function Kt(t,e,n){const r=t.duration??500,i=n-e;return r>i?1-i/r:0}function Jt(t,e,n,r){let i=!1;return e>0?(t._pulseIntensity!==e&&(t._pulseIntensity=e,i=!0),t._pulseColor!==n&&(t._pulseColor=n,i=!0),t._pulseGlowRadius!==r&&(t._pulseGlowRadius=r,i=!0),i):(0!==t._pulseIntensity&&(t._pulseIntensity=0,i=!0),void 0!==t._pulseColor&&(t._pulseColor=void 0,i=!0),void 0!==t._pulseGlowRadius&&(t._pulseGlowRadius=void 0,i=!0),i)}function Qt(t,e,n=("undefined"!=typeof performance?performance.now():Date.now())){if(!e||0===e.size)return!1;const r=t.duration??500,i=e.peek();return null!=i&&r>n-i}function te(t,e,n){if(e._transitionKey)return e._transitionKey;switch(e.type){case"point":if(e.pointId)return"p:"+e.pointId;if("streaming"===t.runtimeMode&&e.datum){const n=t.getX(e.datum),r=t.getY(e.datum);if(t.getCategory)return`p:${t.getCategory(e.datum)}:${n}:${r}`;if(null!=n&&null!=r)return`p:${n}:${r}`}return"p:"+n;case"glyph":return e.pointId?"g:"+e.pointId:"g:"+n;case"rect":return`r:${e.group||""}:${e.datum?.binStart??e.datum?.category??n}`;case"heatcell":return`h:${e.x}_${e.y}`;case"candlestick":return null==e.datum?"c:"+n:"c:"+t.getX(e.datum);case"line":return"l:"+(e.group||"_default");case"area":return"a:"+(e.group||"_default");default:return null}}function ee(t){return t?null!=t.opacity?t.opacity:null!=t.fillOpacity?t.fillOpacity:1:1}function ne(t,e,n,r,i,o){const a=[];for(const i of t){const t=n(i),o=r(i);Number.isFinite(t)&&Number.isFinite(o)&&a.push({px:e.x(t),py:e.y(o),rawY:o,d:i})}a.sort((t,e)=>t.px-e.px);const s=Array(a.length),l=Array(a.length),c=Array(a.length);for(let t=0;a.length>t;t++){const e=a[t];s[t]=[e.px,e.py],l[t]=e.rawY,c[t]=e.d}return{type:"line",path:s,rawValues:l,style:i,datum:c,group:o}}function re(t,e,n,r,i,o,a,s){const l=[];for(const o of t){const t=n(o),a=r(o);if(!Number.isFinite(t)||!Number.isFinite(a))continue;const c=e.x(t),u=s?s(o):i;l.push({px:c,topY:e.y(a),botY:e.y(u),rawY:a})}l.sort((t,e)=>t.px-e.px);const c=Array(l.length),u=Array(l.length),h=Array(l.length);for(let t=0;l.length>t;t++){const e=l[t];c[t]=[e.px,e.topY],u[t]=[e.px,e.botY],h[t]=e.rawY}return{type:"area",topPath:c,bottomPath:u,rawValues:h,style:o,datum:t,group:a}}function ie(t,e,n,r){const i=new Map;if("silhouette"===r)for(const r of t){let t=0;for(const i of e)t+=n(i,r)||0;i.set(r,-t/2)}else if("wiggle"===r){t.length>0&&i.set(t[0],0);for(let r=1;t.length>r;r++){const o=t[r-1],a=t[r];let s=0,l=0,c=0;for(const t of e){const e=n(t,a)||0;s+=(2*c+e)*(e-(n(t,o)||0)),l+=e,c+=e}const u=i.get(o)??0;i.set(a,u-(l>0?s/(2*l):0))}if(t.length>0){let r=0;for(const o of t){let t=0;for(const r of e)t+=n(r,o)||0;r+=(i.get(o)??0)+t/2}const o=r/t.length;for(const e of t)i.set(e,(i.get(e)??0)-o)}}else for(const e of t)i.set(e,0);return i}function oe(t,e,n,r,i,o,a){const s=n(t),l=r(t);if(!Number.isFinite(s)||!Number.isFinite(l))return null;const c={type:"point",x:e.x(s),y:e.y(l),r:i,style:o,datum:t};return void 0!==a&&(c.pointId=a),c}function ae(t,e,n,r,i,o,a,s){const l=n(t),c=r(t);if(!Number.isFinite(l)||!Number.isFinite(c))return null;const u={type:"symbol",x:e.x(l),y:e.y(c),size:i,symbolType:o,style:a,datum:t};return void 0!==s&&(u.pointId=s),u}function se(t,e,n,r,i,o,a){return{type:"rect",x:t,y:e,w:n,h:r,style:i,datum:o,group:a}}function le(t,e,n,r,i,o,a){const s={type:"heatcell",x:t,y:e,w:n,h:r,fill:i,datum:o};return a?.showValues&&(s.showValues=!0,s.value=a.value,a.valueFormat&&(s.valueFormat=a.valueFormat)),s}function ce(t,e,n,r){return"function"==typeof e.style?e.style(r||{},n):e.style&&"object"==typeof e.style?e.style:t.resolveBoundsStyle(n,r)}function ue(t,e,n,r){if(!t.scales)return null;const i=[],o=[];for(const n of e){const e=t.getX(n);if(!Number.isFinite(e))continue;const a=r.getTop(n),s=r.getBottom(n);if(!Number.isFinite(a)||!Number.isFinite(s))continue;const l=t.scales.x(e),c=t.scales.y(a),u=t.scales.y(s);Number.isFinite(l)&&Number.isFinite(c)&&Number.isFinite(u)&&(i.push([l,c]),o.push([l,u]))}return 2>i.length?null:{type:"area",topPath:i,bottomPath:o,...t.config.curve&&"linear"!==t.config.curve&&{curve:t.config.curve},style:ce(t,r,n,e[0]),datum:e,group:n,interactive:r.interactive}}function he(t){const e=[],n=[];if(!t)return{perSeries:e,aggregate:n};for(const r of t)r.perSeries?e.push(r):n.push(r);return{perSeries:e,aggregate:n}}function de(t,e,n){const r=[];for(const i of n){const n=ue(t,e,"__ribbon_aggregate",i);n&&r.push(n)}return r}function fe(t,e,n,r){const i=[];for(const o of r){const r=ue(t,e,n,o);r&&i.push(r)}return i}function ye(t,e){if(!t)return{};if(!e||0===e.length)return t;const n=[];for(const r of e){if("band"!==r.kind)continue;const e=r.getTop(t),i=r.getBottom(t);Number.isFinite(i)&&Number.isFinite(e)&&n.push({y0:i,y1:e})}return 0===n.length?t:{...t,band:n[0],bands:n}}function pe(t,e,n,r){if(!t.config.pointStyle)return;const i=r??t.getY;for(const r of e){const e=t.resolveGroupColor(r.key);for(const o of r.data){let r=t.config.pointStyle(o);!r.fill&&e&&(r={...r,fill:e});const a=r.r??3,s=t.getPointId?t.getPointId(o)+"":void 0,l=oe(o,t.scales,t.getX,i,a,r,s);l&&n.push(l)}}}function ge(t){return"threshold"===t.type&&"string"==typeof t.color&&"number"==typeof t.value}var me={stops:[{offset:0,opacity:.8},{offset:1,opacity:.05}]};function xe(t,e=me){if(t)return!0===t?e:"stops"in t?Array.isArray(t.stops)?t:void 0:"colorStops"in t?Array.isArray(t.colorStops)?{stops:t.colorStops.map(({offset:t,color:e})=>({offset:t,color:e}))}:void 0:{stops:[{offset:0,opacity:t.topOpacity??e.stops[0]?.opacity??.8},{offset:1,opacity:t.bottomOpacity??e.stops.at(-1)?.opacity??.05}]}}function be(t){return t?xe(t):void 0}function ve(t){if(t)return Array.isArray(t)?{stops:t.map(({at:t,color:e,opacity:n})=>({offset:t/100,color:e,...null!=n&&{opacity:n}}))}:Array.isArray(t.stops)?t:void 0}function ke(t){return{stops:t.stops.map(t=>({...t,offset:1-t.offset})).sort((t,e)=>t.offset-e.offset)}}function we(t){return xe(t)}var Ae=new Map;function Me(t,e,n){const r=n.config.areaStyle?.(e);return r&&(t.style=r),t}function Se(t,e,n,r,i){const o=new Map;for(const a of t){const t=e(a),s=n(a);if(null==t||null==s||Number.isNaN(t)||Number.isNaN(s))continue;const l=Math.floor(t/r)*r;let c=o.get(l);if(c||(c={start:l,end:l+r,total:0,categories:new Map},o.set(l,c)),c.total+=s,i){const t=i(a);c.categories.set(t,(c.categories.get(t)||0)+s)}}return o}function $e(t){if("production"===process.env.NODE_ENV)return;const{label:e,nodes:n,overlays:r,warned:i}=t;Pe(r)&&0===n.length&&_e(i,"overlay-only",`[semiotic] ${e} 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(t=>null==t.datum)&&_e(i,"null-datums",`[semiotic] ${e} returned scene nodes, but every scene-node datum is null. Hover, callbacks, selection, and tooltip helpers need data-bearing nodes. Attach a user-facing datum to each interactive node, or set interactive overlays outside the chart.`)}function Pe(t){return null!=t&&!1!==t&&""!==t&&(!Array.isArray(t)||t.some(Pe))}function _e(t,e,n){t.has(e)||(t.add(e),console.warn(n))}function Ce(t,e,n,r){const i=function(t){if(t instanceof Error)return{name:t.name||"Error",message:t.message||"Custom layout threw."};if("string"==typeof t)return{name:"Error",message:t};if(null==t)return{name:"Error",message:"Custom layout threw a nullish value."};try{return{name:"Error",message:t+""}}catch{return{name:"Error",message:"Custom layout threw a non-stringifiable value."}}}(e),o="network"===t?"customNetworkLayout":"customLayout";return{code:"CUSTOM_LAYOUT_ERROR",severity:"error",phase:"layout",component:t,source:o,message:`Semiotic ${t} ${o} failed: ${i.message}`,error:i,recovery:n?"preserved-last-good-scene":"empty-scene",preservedLastGoodScene:n,affectedRevision:r}}function Le(t,e){const n="function"==typeof t?t:n=>n[t||e];return t=>{const e=n(t);return null==e?NaN:+e}}function Te(t){const e=[],n=["bar","swarm","waterfall"].includes(t.chartType)||"streaming"===t.runtimeMode,r=Le(n&&t.valueAccessor||t.yAccessor,n?"value":"y");if(t.boundsAccessor){const n=U(t.boundsAccessor,"bounds");e.push({kind:"bounds",getTop:t=>{const e=r(t);if(!Number.isFinite(e))return NaN;const i=n(t);return Number.isFinite(i)&&0!==i?e+i:e},getBottom:t=>{const e=r(t);if(!Number.isFinite(e))return NaN;const i=n(t);return Number.isFinite(i)&&0!==i?e-i:e},style:t.boundsStyle,perSeries:!0,interactive:!1})}if(t.band){const n=Array.isArray(t.band)?t.band:[t.band];for(const t of n)e.push({kind:"band",getTop:Le(t.y1Accessor,"y1"),getBottom:Le(t.y0Accessor,"y0"),style:t.style,perSeries:!1!==t.perSeries,interactive:!0===t.interactive})}return e}import{scaleLinear as De,scaleLog as Re,scaleSymlog as We,scaleTime as Ee}from"d3-scale";function Ne(t,e){return e?[e[0]??t[0],e[1]??t[1]]:t}function Oe(t,e,n){if("log"===t){const t=[Math.max(e[0],1e-6),Math.max(e[1],1e-6)];return Re().domain(t).range(n).clamp(!0)}return"symlog"===t?We().domain(e).range(n):"time"===t?Ee().domain([new Date(e[0]),new Date(e[1])]).range(n):De().domain(e).range(n)}function Ie(t,e,n){e>t.capacity&&(t.resize(e),n&&e>n.capacity&&n.resize(e))}function ze(t,e){const n=new r(t.capacity);return t.forEach(()=>n.push(e)),n}function Fe(t,e,n,r){const i=t.push(e);return n&&n.push(r),i}function Ye(t,e,n){if(!e||0===e.size)return;const r=new Set;if(t.forEach((t,e)=>{n(t)&&r.add(e)}),0===r.size)return;const i=e.toArray();e.clear();for(let t=0;i.length>t;t++)r.has(t)||e.push(i[t])}var Be=new WeakMap;function je(){return this.updateResults.last}function Xe(){return this.updateResults.last}function Ge(t){return this.updateResults.subscribe(t)}function He(t){this.config.layoutSelection=t}function Ve(){Be.set(this,!0)}function qe(){const t=!0===Be.get(this);return Be.delete(this),t}function Ue(t){Object.assign(t.prototype,{getLastUpdateResult:je,getUpdateSnapshot:Xe,subscribeUpdateResult:Ge,setLayoutSelection:He,markStylePaintPending:Ve,consumeStylePaintPending:qe})}var Ze=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Ke=["scene-style","data-paint","accessibility","evidence"],Je=(t,e)=>({retainedData:t,invalidations:e}),Qe=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],tn=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],en=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],nn=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],rn=["scene-geometry","data-paint","accessibility","evidence"],on=["scene-style","data-paint","accessibility","evidence"],an=[],sn={chartType:Je("rebuild",Qe),runtimeMode:Je("rebuild",Qe),xAccessor:Je("rebuild",Qe),yAccessor:Je("rebuild",Qe),timeAccessor:Je("rebuild",Qe),valueAccessor:Je("rebuild",Qe),y0Accessor:Je("rebuild",Qe),boundsAccessor:Je("rebuild",Qe),band:Je("rebuild",Qe),openAccessor:Je("rebuild",Qe),highAccessor:Je("rebuild",Qe),lowAccessor:Je("rebuild",Qe),closeAccessor:Je("rebuild",Qe),candlestickRangeMode:Je("rebuild",Qe),accessorRevision:Je("rebuild",Qe),groupAccessor:Je("rebuild",tn),categoryAccessor:Je("rebuild",tn),lineDataAccessor:Je("rebuild",tn),colorAccessor:Je("rebuild",on),sizeAccessor:Je("rebuild",rn),symbolAccessor:Je("rebuild",rn),pointIdAccessor:Je("rebuild",rn),xScaleType:Je("preserve",en),yScaleType:Je("preserve",en),xExtent:Je("preserve",en),yExtent:Je("preserve",en),extentPadding:Je("preserve",en),scalePadding:Je("preserve",en),axisExtent:Je("preserve",en),binSize:Je("preserve",en),normalize:Je("preserve",en),heatmapAggregation:Je("preserve",en),heatmapXBins:Je("preserve",en),heatmapYBins:Je("preserve",en),arrowOfTime:Je("preserve",nn),baseline:Je("preserve",nn),stackOrder:Je("preserve",nn),sizeRange:Je("preserve",nn),curve:Je("preserve",nn),areaGroups:Je("preserve",nn),customLayout:Je("preserve",nn),layoutConfig:Je("preserve",nn),layoutMargin:Je("preserve",nn),symbolMap:Je("preserve",rn),showValues:Je("preserve",rn),heatmapValueFormat:Je("preserve",rn),lineStyle:Je("preserve",on),pointStyle:Je("preserve",on),areaStyle:Je("preserve",on),barStyle:Je("preserve",on),swarmStyle:Je("preserve",on),waterfallStyle:Je("preserve",on),candlestickStyle:Je("preserve",on),boundsStyle:Je("preserve",on),gradientFill:Je("preserve",on),lineGradient:Je("preserve",on),semanticLineStops:Je("preserve",on),colorScheme:Je("preserve",on),themeCategorical:Je("preserve",on),themeSemantic:Je("preserve",on),themeSequential:Je("preserve",on),themeDiverging:Je("preserve",on),barColors:Je("preserve",on),decay:Je("preserve",on),pulse:Je("preserve",on),staleness:Je("preserve",on),layoutSelection:Je("preserve",on),annotations:Je("preserve",["overlay","accessibility","evidence"]),windowSize:Je("preserve",an),windowMode:Je("preserve",an),maxCapacity:Je("preserve",an),clock:Je("preserve",an),transition:Je("preserve",an),introAnimation:Je("preserve",an),onLayoutError:Je("preserve",an)},ln=Je("preserve",nn),cn=class{constructor(){this.tracker=new S}get last(){return this.tracker.last}subscribe(t){return this.tracker.subscribe(t)}recordData(t,e){return this.tracker.record({kind:t,...void 0===e?{}:{count:e}},Ze)}recordNoop(t){return this.tracker.record({kind:t,..."restyle"===t?{}:{count:0}},[])}recordRestyle(t){return t?this.tracker.record({kind:"restyle"},Ke):this.recordNoop("restyle")}recordConfig(t){const e=function(t){let e="preserve";const n=new Set;for(const r of t){const t=sn[r]??ln;"rebuild"===t.retainedData&&(e="rebuild");for(const e of t.invalidations)n.add(e)}return{retainedData:e,invalidations:n}}(t);return this.tracker.record({kind:"config",keys:t},e.invalidations)}};import{quadtree as un}from"d3-quadtree";var hn=class{constructor(){this.maxRadius=0,this.tree=null}get quadtree(){return this.tree}get maxPointRadius(){return this.maxRadius}clear(){this.tree=null,this.maxRadius=0}rebuild(t,e){if("scatter"!==t&&"bubble"!==t&&"custom"!==t)return void this.clear();let n=0,r=0;for(const t of e)"point"===t.type&&(n++,t.r>r&&(r=t.r));if(this.maxRadius=r,500>=n)return void(this.tree=null);const i=Array(n);let o=0;for(const t of e)"point"===t.type&&(i[o++]=t);this.tree=un().x(t=>t.x).y(t=>t.y).addAll(i)}};function dn(t){for(const e of t){if(void 0!==e._targetOpacity){const t=e._targetOpacity;e.style={...e.style||{},opacity:0===t?0:t},e._targetOpacity=void 0}"point"===e.type?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):void 0!==e._targetR&&(e.r=e._targetR,e._targetR=void 0):"rect"===e.type?void 0!==e._targetX&&(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):"wedge"===e.type&&void 0!==e._targetStartAngle&&(e.startAngle=e._targetStartAngle,e.endAngle=e._targetEndAngle,e._targetStartAngle=void 0,e._targetEndAngle=void 0)}}var fn=class t{constructor(t){if(this.xExtent=new n,this.yExtent=new n,this.growingCapacityWarned=!1,this.windowSizeWarned=!1,this.resolvedRibbons=[],this.timestampBuffer=null,this.activeTransition=null,this._hasRenderedOnce=!1,this.prevPositionMap=new Map,this.prevPathMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this._colorMapCache=null,this._groupDataCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this._ingestVersion=0,this._datumIndexCache=null,this._bufferArrayCache=null,this._bufferDirty=!0,this.needsFullRebuild=!0,this.lastLayout=null,this.updateResults=new cn,this.scales=null,this.scene=[],this.version=0,this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customLayoutFailedThisBuild=!1,this._customLayoutDiagnosticsWarned=new Set,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.xIsDate=!1,this.spatialIndex=new hn,this._lastBoundedInsertsRef=null,this.applyPulse=(t,e,n)=>!(!this.config.pulse||!this.timestampBuffer)&&function(t,e,n,r,i,o=("undefined"!=typeof performance?performance.now():Date.now())){const a=t.color??"rgba(255,255,255,0.6)",s=t.glowRadius??4;let l=!1;const c=i??(()=>{const t=new Map;for(let e=0;n.length>e;e++)t.set(n[e],e);return t})();for(const n of e){if("line"===n.type)continue;if("area"===n.type){const e=Array.isArray(n.datum)?n.datum:[n.datum];let i=0,s=!1;for(const n of e){const e=c.get(n);if(null==e)continue;s=!0;const a=r.get(e);if(null==a)continue;const l=Kt(t,a,o);l>i&&(i=l)}s&&(l=Jt(n,i,a)||l);continue}const e=c.get(n.datum);if(null==e)continue;const i=r.get(e);l=Jt(n,null==i?0:Kt(t,i,o),a,s)||l}return l}(this.config.pulse,t,e,this.timestampBuffer,this.getDatumIndexMap(e),n),this.config=t,this.buffer=new r(t.windowSize),this.growingCap=t.windowSize,["bar","swarm","waterfall"].includes(t.chartType)||"streaming"===t.runtimeMode?(this.getX=U(t.timeAccessor||t.xAccessor,"time"),this.getY=U(t.valueAccessor||t.yAccessor,"value")):(this.getX=U(t.xAccessor,"x"),this.getY=U(t.yAccessor,"y")),this.getGroup=Q(t.groupAccessor),this.getCategory=Q(t.categoryAccessor),this.getSize=t.sizeAccessor?U(t.sizeAccessor,"size"):void 0,this.getColor=Q(t.colorAccessor),this.getSymbol=Q(t.symbolAccessor),this.getY0=t.y0Accessor?U(t.y0Accessor,"y0"):void 0,this.resolvedRibbons=Te(t),this.getPointId=Q(t.pointIdAccessor),"candlestick"===t.chartType){const e=null!=t.openAccessor,n=null!=t.closeAccessor;this.getOpen=e?U(t.openAccessor,"open"):void 0,this.getHigh=U(t.highAccessor,"high"),this.getLow=U(t.lowAccessor,"low"),this.getClose=n?U(t.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!e&&!n}t.pulse&&(this.timestampBuffer=new r(t.windowSize))}currentTime(){return this.config.clock?.()??qt()}syncPulseTimestampBuffer(){this.config.pulse?null!=this.timestampBuffer&&this.timestampBuffer.capacity===this.buffer.capacity&&this.timestampBuffer.size===this.buffer.size||(this.timestampBuffer=ze(this.buffer,this.currentTime())):this.timestampBuffer=null}pushDatumYExtent(t){if("candlestick"===this.config.chartType&&this.getHigh&&this.getLow)return this.yExtent.push(this.getHigh(t)),void this.yExtent.push(this.getLow(t));this.yExtent.push(this.getY(t)),this.getY0&&this.yExtent.push(this.getY0(t));for(const e of this.resolvedRibbons){const n=e.getTop(t),r=e.getBottom(t);Number.isFinite(n)&&this.yExtent.push(n),Number.isFinite(r)&&this.yExtent.push(r)}}evictDatumYExtent(t){if("candlestick"===this.config.chartType&&this.getHigh&&this.getLow)return this.yExtent.evict(this.getHigh(t)),void this.yExtent.evict(this.getLow(t));this.yExtent.evict(this.getY(t)),this.getY0&&this.yExtent.evict(this.getY0(t));for(const e of this.resolvedRibbons){const n=e.getTop(t),r=e.getBottom(t);Number.isFinite(n)&&this.yExtent.evict(n),Number.isFinite(r)&&this.yExtent.evict(r)}}rebuildYExtent(){this.yExtent.clear();for(const t of this.buffer)this.pushDatumYExtent(t)}rebuildExtents(){this.xExtent.clear(),this.yExtent.clear();for(const t of this.buffer)this.xExtent.push(this.getX(t)),this.pushDatumYExtent(t)}ingest(t){if(t.bounded&&this._lastBoundedInsertsRef===t.inserts)return this.updateResults.recordNoop("replace"),!1;const e=this.currentTime();if(this.lastIngestTime=e,this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,t.bounded){this._lastBoundedInsertsRef=t.inserts,this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this.timestampBuffer&&this.timestampBuffer.clear();const n=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode;if(this.getX=n?U(this.config.timeAccessor||this.config.xAccessor,"time"):U(this.config.xAccessor,"x"),this.xIsDate=!1,t.inserts.length>0){const e=t.inserts[0],n=this.config.xAccessor,r="function"==typeof n?n(e):e[n||"x"],i=r instanceof Date,o="string"==typeof r&&Number.isFinite(g(r));if(this.xIsDate=i||o,o){const t="string"==typeof n?n:void 0;this.getX=t?e=>a(e[t]):t=>a(n(t))}}Ie(this.buffer,t.totalSize||t.inserts.length,this.timestampBuffer);for(const n of t.inserts)Fe(this.buffer,n,this.timestampBuffer,e),this.xExtent.push(this.getX(n)),this.pushDatumYExtent(n)}else for(const n of t.inserts){if("growing"===this.config.windowMode&&this.buffer.full){const t=this.config.maxCapacity??1e5;t>this.growingCap&&(this.growingCap=Math.min(2*this.growingCap,t),this.buffer.resize(this.growingCap),this.timestampBuffer&&this.timestampBuffer.resize(this.growingCap),"production"===process.env.NODE_ENV||this.growingCapacityWarned||5e4>this.growingCap||(this.growingCapacityWarned=!0,console.warn(`[Semiotic] Growing window buffer reached ${this.growingCap} points (cap ${t}). Large canvas scenes are expensive — prefer a sliding window, aggregation, or an explicit maxCapacity if this is intentional.`)))}const t=Fe(this.buffer,n,this.timestampBuffer,e);this.xExtent.push(this.getX(n)),this.pushDatumYExtent(n),null!=t&&(this.xExtent.evict(this.getX(t)),this.evictDatumYExtent(t))}return this.updateResults.recordData(t.bounded?"replace":"ingest",t.inserts.length),!0}ingestWithResult(t){return this.ingest(t),this.updateResults.last}computeScene(t){const{config:e,buffer:n}=this,r=this.scales,i=this.lastLayout;if(!this.needsFullRebuild&&!e.customLayout&&this.lastLayout&&this.scene.length>0&&this.scales&&0>=(this.config.scalePadding??0)&&(this.lastLayout.width!==t.width||this.lastLayout.height!==t.height))return void this.remapScene(t);this.xExtent.dirty&&this.xExtent.recalculate(n,this.getX),this.yExtent.dirty&&this.rebuildYExtent();const o=this.getBufferArray(),a=this.yExtent.extent;let s=Ne(this.xExtent.extent,e.xExtent),l=Ne(a,e.yExtent);const c=!(!(u=e.yExtent)||null==u[0]||null==u[1]);var u;const h="exact"===e.axisExtent;if("stackedarea"===e.chartType&&!c&&n.size>0){const t=function(t){const{config:e,groups:n,getX:r,getY:i}=t,o="exact"===e.axisExtent;if(e.normalize){const n=[0,o?1:1+e.extentPadding];return{yDomain:n,stackExtentCache:{key:`${t.bufferSize}:${t.ingestVersion}:norm`,yDomain:n}}}const a=`${t.bufferSize}:${t.ingestVersion}:${e.baseline??"zero"}:${e.stackOrder??"key"}`;if(t.stackExtentCache&&t.stackExtentCache.key===a)return{yDomain:t.stackExtentCache.yDomain,stackExtentCache:t.stackExtentCache};const s=new Map,l=new Set;let c=0;const u=new Map,h=new Map;for(const t of n){const e=new Map;let n=0;for(const o of t.data){const t=r(o),a=i(o);if(!Number.isFinite(t)||!Number.isFinite(a))continue;e.set(t,(e.get(t)||0)+a),l.add(t),n+=a;const s=(u.get(t)||0)+a;u.set(t,s),s>c&&(c=s)}s.set(t.key,e),h.set(t.key,n)}const d=e.stackOrder??"key",f=(t,e)=>e>t?-1:t>e?1:0;let y,p;if("input"===d)y=n.map(t=>t.key);else if("insideOut"===d){const t=[...n].map(t=>t.key).sort((t,e)=>{const n=(h.get(e)??0)-(h.get(t)??0);return 0!==n?n:f(t,e)}),e=[],r=[];let i=0,o=0;for(const n of t)o>i?(e.push(n),i+=h.get(n)??0):(r.push(n),o+=h.get(n)??0);y=[...r.reverse(),...e]}else y="asc"===d?n.map(t=>t.key).sort((t,e)=>{const n=(h.get(t)??0)-(h.get(e)??0);return 0!==n?n:f(t,e)}):"desc"===d?n.map(t=>t.key).sort((t,e)=>{const n=(h.get(e)??0)-(h.get(t)??0);return 0!==n?n:f(t,e)}):n.map(t=>t.key).sort(f);if("wiggle"===e.baseline||"silhouette"===e.baseline){const t=Array.from(l).sort((t,e)=>t-e),n=ie(t,y,(t,e)=>s.get(t)?.get(e)||0,e.baseline);let r=1/0,i=-1/0;for(const e of t){const t=n.get(e)??0,o=u.get(e)??0;r>t&&(r=t),t+o>i&&(i=t+o)}Number.isFinite(r)&&Number.isFinite(i)||(r=0,i=0);const a=i-r,c=o?0:a>0?a*e.extentPadding:1;p=[r-c,i+c]}else if("diverging"===e.baseline){const t=Array.from(l).sort((t,e)=>t-e),[n,r]=function(t,e,n){let r=0,i=0;for(const o of t){let t=0,a=0;for(const r of e){const e=n(r,o)||0;0>e?a+=e:t+=e}r>a&&(r=a),t>i&&(i=t)}return[r,i]}(t,y,(t,e)=>s.get(t)?.get(e)||0),i=r-n,a=o?0:i>0?i*e.extentPadding:1;p=[n-a,r+a]}else p=[0,c+(o?0:c>0?c*e.extentPadding:1)];return{yDomain:p,stackExtentCache:{key:a,yDomain:p}}}({config:e,groups:this.groupData(o),getX:this.getX,getY:this.getY,bufferSize:n.size,ingestVersion:this._ingestVersion,stackExtentCache:this._stackExtentCache});l=t.yDomain,this._stackExtentCache=t.stackExtentCache}else"bar"===e.chartType&&e.binSize&&!c&&n.size>0?l=function(t,e,n,r,i,o,a){const[,s]=function(t,e,n,r,i){const o=Se(t,e,n,r,i);if(0===o.size)return[0,0];let a=0;for(const t of o.values())t.total>a&&(a=t.total);return[0,a]}(t,e,n,r,i);return[0,a?s:s+s*o]}(n,this.getX,this.getY,e.binSize,this.getCategory,e.extentPadding,h):"waterfall"===e.chartType&&!c&&n.size>0?l=function(t,e,n,r){const[i,o]=function(t,e){let n=0,r=0,i=0;for(const o of t){const t=e(o);null==t||Number.isNaN(t)||(i+=t,n>i&&(n=i),i>r&&(r=i))}return[n,r]}(t,e),a=o-i,s=r?0:a>0?a*n:1;return[Math.min(0,i-Math.abs(s)),Math.max(0,o+Math.abs(s))]}(n,this.getY,e.extentPadding,h):c||l[0]===1/0||(l=function(t,e,n){if(!n.length)return t;let[r,i]=t;for(const t of e)for(const e of n){const n=e.getTop(t),o=e.getBottom(t);Number.isFinite(n)&&(r>n&&(r=n),n>i&&(i=n)),Number.isFinite(o)&&(r>o&&(r=o),o>i&&(i=o))}return[r,i]}(l,o,this.resolvedRibbons),l=function(t,e){const n=t[1]-t[0],r=e.exactMode?0:n>0?n*e.extentPadding:1,i=[null!=e.userMin?t[0]:t[0]-r,null!=e.userMax?t[1]:t[1]+r];return"log"!==e.yScaleType||i[0]>0||0>=e.dataYDomain[0]||e.exactMode||null==e.userMin&&(i[0]=e.dataYDomain[0]/(1+e.extentPadding)),i}(l,{exactMode:h,extentPadding:e.extentPadding,userMin:e.yExtent?.[0],userMax:e.yExtent?.[1],yScaleType:e.yScaleType,dataYDomain:a}));l=function(t,e,n){if(!e||n)return t;const r=e[0],i=e[1];return null==r&&null==i?t:[null!=r?r:t[0],null!=i?i:t[1]]}(l,e.yExtent,!!c),({xDomain:s,yDomain:l}=function(t,e,n){let r=t,i=e;if(r[0]===1/0||r[1]===-1/0)if("time"===n){const t=Date.now();r=[t-864e5,t]}else r=[0,1];return i[0]!==1/0&&i[1]!==-1/0||(i=[0,1]),{xDomain:r,yDomain:i}}(s,l,e.xScaleType)),this.scales=function(t){const{config:e,layout:n,xDomain:r,yDomain:i}=t,o="streaming"===e.runtimeMode,a=Math.max(0,Math.min(e.scalePadding||0,Math.min(n.width,n.height)/2-1));if(o){if("x"==("up"===(s=e.arrowOfTime)||"down"===s?"y":"x")){const t="right"===e.arrowOfTime?[a,n.width-a]:[n.width-a,a];return{x:De().domain(r).range(t),y:Oe(e.yScaleType,i,[n.height-a,a])}}const t="down"===e.arrowOfTime?[a,n.height-a]:[n.height-a,a];return{x:Oe(e.yScaleType,i,[a,n.width-a]),y:De().domain(r).range(t)}}var s;return{x:Oe(e.xScaleType,r,[a,n.width-a]),y:Oe(e.yScaleType,i,[n.height-a,a])}}({config:e,layout:t,xDomain:s,yDomain:l}),this._customLayoutFailedThisBuild=!1;const d=this.buildSceneNodes(t,o);if(this._customLayoutFailedThisBuild)return!0===this.lastCustomLayoutFailure?.preservedLastGoodScene?(this.scales=r,this.lastLayout=i):(this.scene=[],this.spatialIndex.rebuild(this.config.chartType,this.scene)),void(this.needsFullRebuild=!0);this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=d,this.config.decay&&this.applyDecay(this.scene,o),this.config.pulse&&this.applyPulse(this.scene,o,this.currentTime()),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&(this.prevPositionMap.size>0||this.prevPathMap.size>0)&&this.startTransition(),this.spatialIndex.rebuild(this.config.chartType,this.scene),this.needsFullRebuild=!1,this.lastLayout={width:t.width,height:t.height},this.version++}get quadtree(){return this.spatialIndex.quadtree}get maxPointRadius(){return this.spatialIndex.maxPointRadius}remapScene(t){const e=t.width/this.lastLayout.width,n=t.height/this.lastLayout.height;for(const t of this.scene)switch(t.type){case"line":for(const r of t.path)r[0]*=e,r[1]*=n;break;case"area":for(const r of t.topPath)r[0]*=e,r[1]*=n;for(const r of t.bottomPath)r[0]*=e,r[1]*=n;t.clipRect&&(t.clipRect={x:t.clipRect.x*e,y:t.clipRect.y*n,width:t.clipRect.width*e,height:t.clipRect.height*n}),t.strokeColorBands&&(t.strokeColorBands=t.strokeColorBands.map(t=>({...t,y:t.y*n,height:t.height*n})));break;case"point":case"glyph":t.x*=e,t.y*=n;break;case"rect":case"heatcell":t.x*=e,t.y*=n,t.w*=e,t.h*=n;break;case"candlestick":t.x*=e,t.openY*=n,t.closeY*=n,t.highY*=n,t.lowY*=n}const r=this.scales.x.domain(),i=this.scales.y.domain(),o=this.scales.x.range(),a=this.scales.y.range(),s=Oe,l=Math.max(0,Math.min(this.config.scalePadding||0,Math.min(t.width,t.height)/2-1)),c=a[1]>a[0];this.scales={x:s(this.config.xScaleType,r,o[0]>o[1]?[t.width-l,l]:[l,t.width-l]),y:s(this.config.yScaleType,i,c?[l,t.height-l]:[t.height-l,l])},this.lastLayout={width:t.width,height:t.height},this.spatialIndex.rebuild(this.config.chartType,this.scene),this.version++}buildSceneNodes(t,e){const{config:n,scales:r}=this;if(!r)return[];if(n.customLayout){const i={data:e,scales:r,dimensions:{width:t.width,height:t.height,margin:n.layoutMargin??{top:0,right:0,bottom:0,left:0},plot:{x:0,y:0,width:t.width,height:t.height}},theme:{semantic:n.themeSemantic??{},categorical:n.themeCategorical??It},resolveColor:(t,e)=>{const r=this.resolveGroupColor(t);if(r)return r;const i=this.resolveLineStyle(t,e);return i.stroke?i.stroke:"string"==typeof i.fill?i.fill:n.themeSemantic?.primary??"#4e79a7"},config:n.layoutConfig??{},selection:n.layoutSelection??null};let o;try{o=n.customLayout(i)}catch(t){const e=null!==this.lastCustomLayoutResult,r=Ce("xy",t,e,this.version);this.lastCustomLayoutFailure=r,this._customLayoutFailedThisBuild=!0,"production"!==process.env.NODE_ENV&&console.error("[semiotic] customLayout threw:",t);try{n.onLayoutError?.(r)}catch(t){"production"!==process.env.NODE_ENV&&console.error("[semiotic] onLayoutError threw:",t)}return e?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 a=o.nodes??[];if(this._customRestyle=o.restyle,this.hasCustomRestyle=!!o.restyle,this.hasCustomRestyle){this._baseStyles=new WeakMap;for(const t of a)t.style&&this._baseStyles.set(t,t.style);this.applyCustomRestyle(a,n.layoutSelection??null)}return $e({label:"customLayout",nodes:a,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned}),a}if(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,0===e.length)return[];const i={scales:r,config:n,getX:this.getX,getY:this.getY,getY0:this.getY0,getSize:this.getSize,getColor:this.getColor,getSymbol:this.getSymbol,getGroup:this.getGroup,getCategory:this.getCategory,getPointId:this.getPointId,ribbons:this.resolvedRibbons,getOpen:this.getOpen,getHigh:this.getHigh,getLow:this.getLow,getClose:this.getClose,resolveLineStyle:(t,e)=>this.resolveLineStyle(t,e),resolveAreaStyle:(t,e)=>this.resolveAreaStyle(t,e),resolveBoundsStyle:(t,e)=>this.resolveBoundsStyle(t,e),resolveColorMap:t=>this.resolveColorMap(t),resolveGroupColor:t=>this.resolveGroupColor(t),groupData:t=>this.groupData(t),barCategoryCache:this._barCategoryCache};switch(n.chartType){case"line":return function(t,e){const n=t.groupData(e),r=[],i=t.config.annotations?.filter(ge).map(t=>({value:t.value,color:t.color,thresholdType:t.thresholdType||"greater"}));if(t.ribbons&&t.ribbons.length>0){const{perSeries:i,aggregate:o}=he(t.ribbons);if(o.length>0&&r.push(...de(t,e,o)),i.length>0)for(const e of n)r.push(...fe(t,e.data,e.key,i))}for(const e of n){const n=t.resolveLineStyle(e.key,e.data[0]),o=ne(e.data,t.scales,t.getX,t.getY,n,e.key);i&&i.length>0&&(o.colorThresholds=i),t.config.curve&&"linear"!==t.config.curve&&(o.curve=t.config.curve),t.config.lineGradient&&(o.strokeGradient=t.config.lineGradient),r.push(o)}return pe(t,n,r),r}(i,e);case"area":return function(t,e){const n=t.groupData(e),r=[];if(t.ribbons&&t.ribbons.length>0){const{perSeries:i,aggregate:o}=he(t.ribbons);if(o.length>0&&r.push(...de(t,e,o)),i.length>0)for(const e of n)r.push(...fe(t,e.data,e.key,i))}const i=t.scales.y.domain(),o=i[0],a=t.config.semanticLineStops?.filter(t=>Number.isFinite(t.offset)).map(t=>({value:i[0]+Math.max(0,Math.min(1,t.offset))*(i[1]-i[0]),color:t.color,thresholdType:"greater"})).sort((t,e)=>t.value-e.value),s=a&&a.length>0?(()=>{const e=a.reduce((t,e)=>(t.at(-1)?.value===e.value?t[t.length-1]=e:t.push(e),t),[]),n=[{from:i[0],to:e[0].value}];for(let t=0;e.length>t;t++)n.push({from:e[t].value,to:e[t+1]?.value??i[1],color:e[t].color});return n.map(({from:e,to:n,color:r})=>{const i=t.scales.y(e),o=t.scales.y(n);return{y:Math.min(i,o),height:Math.abs(o-i),color:r}}).filter(t=>t.height>0)})():void 0,l=t.getY0?e=>{const n=t.getY0(e);return null==n?o:n}:void 0;for(const e of n){const n=t.resolveAreaStyle(e.key,e.data[0]),i=re(e.data,t.scales,t.getX,t.getY,o,n,e.key,l),c=we(t.config.gradientFill);c&&(i.fillGradient=c),t.config.curve&&"linear"!==t.config.curve&&(i.curve=t.config.curve),t.config.lineGradient&&(i.strokeGradient=t.config.lineGradient),a&&a.length>0&&(i.colorThresholds=a,i.strokeColorBands=s),r.push(i)}return pe(t,n,r),r}(i,e);case"mixed":return function(t,e){const n=t.groupData(e),r=[],i=t.config.areaGroups||new Set;if(t.ribbons&&t.ribbons.length>0){const{perSeries:i,aggregate:o}=he(t.ribbons);if(o.length>0&&r.push(...de(t,e,o)),i.length>0)for(const e of n)r.push(...fe(t,e.data,e.key,i))}const o=t.scales.y.domain()[0],a=t.getY0?e=>{const n=t.getY0(e);return null==n?o:n}:void 0;for(const e of n)if(i.has(e.key)){const n=t.resolveAreaStyle(e.key,e.data[0]),i=re(e.data,t.scales,t.getX,t.getY,o,n,e.key,a),s=we(t.config.gradientFill);s&&(i.fillGradient=s),t.config.curve&&"linear"!==t.config.curve&&(i.curve=t.config.curve),t.config.lineGradient&&(i.strokeGradient=t.config.lineGradient),r.push(i)}else{const n=t.resolveLineStyle(e.key,e.data[0]),i=ne(e.data,t.scales,t.getX,t.getY,n,e.key);t.config.curve&&"linear"!==t.config.curve&&(i.curve=t.config.curve),t.config.lineGradient&&(i.strokeGradient=t.config.lineGradient),r.push(i)}return pe(t,n,r),r}(i,e);case"stackedarea":return function(t,e){const n=t.groupData(e),r=t.config.stackOrder??"key",i=()=>n.sort((t,e)=>e.key>t.key?-1:t.key>e.key?1:0);if("input"===r);else if("key"===r)i();else if("asc"===r||"desc"===r||"insideOut"===r){const e=new Map;for(const r of n){let n=0;for(const e of r.data){const r=t.getX(e),i=t.getY(e);Number.isFinite(r)&&Number.isFinite(i)&&(n+=i)}e.set(r.key,n)}const i=(t,e)=>e>t?-1:t>e?1:0;if("asc"===r)n.sort((t,n)=>{const r=(e.get(t.key)??0)-(e.get(n.key)??0);return 0!==r?r:i(t.key,n.key)});else if("desc"===r)n.sort((t,n)=>{const r=(e.get(n.key)??0)-(e.get(t.key)??0);return 0!==r?r:i(t.key,n.key)});else{const t=[...n].sort((t,n)=>{const r=(e.get(n.key)??0)-(e.get(t.key)??0);return 0!==r?r:i(t.key,n.key)}),r=[],o=[];let a=0,s=0;for(const n of t)s>a?(r.push(n),a+=e.get(n.key)??0):(o.push(n),s+=e.get(n.key)??0);n.length=0,n.push(...o.reverse(),...r)}}else i();const o=t.config.curve&&"linear"!==t.config.curve?t.config.curve:void 0,a=t.config.normalize?"zero":t.config.baseline??"zero",{nodes:s,stackedTops:l}=function(t,e,n,r,i,o,a,s="zero"){const l=new Set;for(const e of t)for(const t of e.data){const e=n(t);Number.isFinite(e)&&l.add(e)}const c=Array.from(l).sort((t,e)=>t-e),u=new Map;for(const e of t){const t=new Map;for(const i of e.data){const e=n(i),o=r(i);Number.isFinite(e)&&Number.isFinite(o)&&t.set(e,(t.get(e)||0)+o)}u.set(e.key,t)}let h;if(o){h=new Map;for(const e of c){let n=0;for(const r of t)n+=u.get(r.key)?.get(e)||0;h.set(e,n||1)}}const d=ie(c,t.map(t=>t.key),(t,e)=>u.get(t)?.get(e)||0,s),f="diverging"===s&&!o,y=[],p=new Map,g=new Map,m=new Map,x=new Map;for(const t of c)g.set(t,d.get(t)??0),m.set(t,0),x.set(t,0);for(const n of t){const t=u.get(n.key),r=new Map;let s=[],l=[];const d=()=>{if(s.length>=2){const t={type:"area",topPath:s,bottomPath:l,style:i(n.key,n.data[0]),datum:n.data,group:n.key};a&&(t.curve=a),y.push(t)}s=[],l=[]};for(const n of c){const i=t.has(n);let a,c,u=i?t.get(n):0;if(o&&i&&(u/=h.get(n)),!i||!Number.isFinite(u)||0===u){d();continue}f?u>0?(a=m.get(n),c=a+u,m.set(n,c)):(a=x.get(n),c=a+u,x.set(n,c)):(a=g.get(n),c=a+u,g.set(n,c));const y=e.x(n);l.push([y,e.y(a)]),s.push([y,e.y(c)]),r.set(n,c)}d(),p.set(n.key,r)}return{nodes:y,stackedTops:p}}(n,t.scales,t.getX,t.getY,(e,n)=>t.resolveAreaStyle(e,n),t.config.normalize,o,a),c=s;if(t.config.pointStyle){const e=new WeakMap;for(const r of n){const n=l.get(r.key);if(n)for(const i of r.data){const r=t.getX(i),o=t.getY(i);null==r||Number.isNaN(r)||null==o||Number.isNaN(o)||!n.has(r)||e.set(i,n.get(r))}}const r=n=>e.get(n)??t.getY(n);pe(t,n,c,r)}return c}(i,e);case"scatter":case"bubble":return function(t,e){const n=[],r="bubble"===t.config.chartType?10:5,i=t.config.sizeRange||[3,15];let o=null;if(t.getSize&&!t.config.pointStyle){const n=e.map(e=>t.getSize(e)).filter(t=>null!=t&&!Number.isNaN(t));if(n.length>0){let t=1/0,e=-1/0;for(const r of n)t>r&&(t=r),r>e&&(e=r);o=n=>t===e?(i[0]+i[1])/2:i[0]+(n-t)/(e-t)*(i[1]-i[0])}}const a=t.getColor?t.resolveColorMap(e):null,s=t.config.themeSemantic?.primary||"#4e79a7",l=t.getSymbol,c=l?W(l,t.config.symbolMap):null;for(const i of e){let e=t.config.pointStyle?t.config.pointStyle(i):{fill:s,opacity:.8},l=e.r||r;if(o&&t.getSize){const e=t.getSize(i);null==e||Number.isNaN(e)||(l=o(e))}if(a&&t.getColor&&!e.fill){const n=t.getColor(i);n&&a.has(n)&&(e={...e,fill:a.get(n)})}const u=t.getPointId?t.getPointId(i)+"":void 0;if(c){const r=c(i),o=ae(i,t.scales,t.getX,t.getY,Math.PI*l*l,r,e,u);o&&n.push(o)}else{const r=oe(i,t.scales,t.getX,t.getY,l,e,u);r&&n.push(r)}}return n}(i,e);case"heatmap":return function(t,e,n){if(t.config.heatmapAggregation)return function(t,e,n){const r=Math.max(1,Math.floor(t.config.heatmapXBins??20)),i=Math.max(1,Math.floor(t.config.heatmapYBins??20)),o=t.config.heatmapAggregation??"count",a=U(t.config.valueAccessor,"value");if(!t.scales||0===e.length)return[];const[s,l]=t.scales.x.domain(),[c,u]=t.scales.y.domain(),h=(l-s||1)/r,d=(u-c||1)/i,f=r*i;if(f>1e6)return[];const y=new Int32Array(f),p=new Float64Array(f);for(let n=0;e.length>n;n++){const o=e[n],l=t.getX(o),u=t.getY(o);if(!isFinite(l)||!isFinite(u))continue;const f=Math.min(Math.floor((l-s)/h),r-1),g=Math.min(Math.floor((u-c)/d),i-1);if(0>f||0>g)continue;const m=g*r+f;y[m]++;const x=a(o);p[m]+=isFinite(x)?x:0}let g=1/0,m=-1/0;for(let t=0;f>t;t++){if(0===y[t])continue;let e;switch(o){case"sum":e=p[t];break;case"mean":e=p[t]/y[t];break;default:e=y[t]}g>e&&(g=e),e>m&&(m=e)}if(!isFinite(g))return[];const x=m-g||1,b=n.width/r,v=n.height/i,k=t.config.showValues,w=t.config.heatmapValueFormat,A=[];for(let e=0;i>e;e++){const n=e*r;for(let a=0;r>a;a++){const r=n+a;if(0===y[r])continue;let l;switch(o){case"sum":l=p[r];break;case"mean":l=p[r]/y[r];break;default:l=y[r]}const u=(l-g)/x,f={xi:a,yi:e,value:l,count:y[r],sum:p[r],xCenter:s+(a+.5)*h,yCenter:c+(e+.5)*d,agg:o};A.push(Me(le(a*b,(i-1-e)*v,b,v,`rgb(${220-(180*u+.5)|0},${220-(100*u+.5)|0},${255-(50*u+.5)|0})`,f,k?{value:l,showValues:!0,valueFormat:w}:void 0),f,t))}}return A}(t,e,n);if(0===e.length)return[];const r=U(t.config.valueAccessor,"value"),i=J(t.config.xAccessor,"x"),o=J(t.config.yAccessor,"y"),a=new Map,s=new Map,l=Array(e.length),c=Array(e.length);for(let t=0;e.length>t;t++){const n=e[t],r=i(n),u=o(n);l[t]=r,c[t]=u,a.has(r)||a.set(r,a.size),s.has(u)||s.set(u,s.size)}const u=a.size,h=s.size;if(0===u||0===h)return[];const d=Array.from(a.keys()),f=Array.from(s.keys()),y=d.every(t=>"number"==typeof t&&!isNaN(t)),p=f.every(t=>"number"==typeof t&&!isNaN(t));if(y){d.sort((t,e)=>Number(t)-Number(e)),a.clear();for(let t=0;d.length>t;t++)a.set(d[t],t)}if(p){f.sort((t,e)=>Number(t)-Number(e)),s.clear();for(let t=0;f.length>t;t++)s.set(f[t],t)}const g=new Float64Array(e.length),m=new Float64Array(e.length),x=Array(e.length),b=new Map;let v=0;for(let t=0;e.length>t;t++){const n=e[t],i=a.get(l[t]),o=s.get(c[t]);if(void 0===i||void 0===o)continue;const h=r(n),d=o*u+i,f=b.get(d);let y;void 0!==f?y=f:(y=v++,b.set(d,y)),g[y]=d,m[y]=h,x[y]=n}let k=1/0,w=-1/0;for(let t=0;v>t;t++){const e=m[t];isFinite(e)&&(k>e&&(k=e),e>w&&(w=e))}if(!isFinite(k)||!isFinite(w))return[];const A=function(t){const e=t in M?t:"blues";let n=Ae.get(e);if(n)return n;n=Array(256);const r=C(e);for(let t=0;256>t;t++)n[t]=r(t/255);return Ae.set(e,n),n}("string"==typeof t.config.colorScheme?t.config.colorScheme:t.config.themeSequential||"blues"),S=255/(w-k||1),$=n.width/u,P=n.height/h,_=t.config.showValues,L=t.config.heatmapValueFormat,T=[];for(let e=0;v>e;e++){const n=m[e];if(!isFinite(n))continue;const r=g[e],i=r%u,o=x[e];T.push(Me(le(i*$,(h-1-(r-i)/u)*P,$,P,A[Math.min((n-k)*S+.5|0,255)],o,_?{value:n,showValues:!0,valueFormat:L}:void 0),o,t))}return T}(i,e,t);case"bar":{const t=function(t,e){if(!t.config.binSize)return{nodes:[],binBoundaries:[]};const n=Se(e,t.getX,t.getY,t.config.binSize,t.getCategory);if(0===n.size)return{nodes:[],binBoundaries:[]};let r=null;if(t.getCategory){const e=new Set;for(const t of n.values())for(const n of t.categories.keys())e.add(n);const i=t.config.barColors?Object.keys(t.config.barColors):[],o=new Set(i),a=Array.from(e).filter(t=>!o.has(t)).sort(),s=i.filter(t=>e.has(t)),l=s.join("\0")+""+a.join("\0");t.barCategoryCache&&t.barCategoryCache.key===l?r=t.barCategoryCache.order:(r=[...s,...a],t.barCategoryCache={key:l,order:r})}const i=[],o=t.scales,[a,s]=o.x.domain(),l=t.config.barStyle,c=t.config.themeSemantic?.primary,u=l?.gap,h="number"!=typeof u||0>u?1:u,d={};l?.stroke&&(d.stroke=l.stroke),"number"==typeof l?.strokeWidth&&(d.strokeWidth=l.strokeWidth),"number"==typeof l?.opacity&&(d.opacity=l.opacity);for(const e of n.values()){const n=Math.max(e.start,a),u=Math.min(e.end,s);if(n>=u)continue;const f=o.x(n),y=o.x(u),p=Math.abs(y-f),g=p>h+1?h:0,m=Math.min(f,y)+g/2,x=Math.max(p-g,1);if(x>0)if(r&&e.categories.size>0){let n=0;for(const a of r){const r=e.categories.get(a)||0;if(0===r)continue;const s=o.y(n),u=o.y(n+r);i.push(se(m,Math.min(s,u),x,Math.abs(s-u),{fill:t.config.barColors?.[a]||l?.fill||c||"#4e79a7",...d},{binStart:e.start,binEnd:e.end,total:e.total,category:a,categoryValue:r},a)),n+=r}}else{const t=o.y(0),n=o.y(e.total);i.push(se(m,Math.min(t,n),x,Math.abs(t-n),{fill:l?.fill||c||"#007bff",...d},{binStart:e.start,binEnd:e.end,total:e.total}))}}const f=new Set;for(const t of n.values())f.add(t.start),f.add(t.end);return{nodes:i,binBoundaries:Array.from(f).sort((t,e)=>t-e)}}(i,e);return this._barCategoryCache=i.barCategoryCache??null,this._binBoundaries=t.binBoundaries,t.nodes}case"swarm":return function(t,e){const n=[],r=t.config.swarmStyle||{},i=r.radius??3,o=r.fill??t.config.themeSemantic?.primary??"#007bff",a=r.opacity??.7,s=r.stroke,l=r.strokeWidth;for(const r of e){const e=t.getX(r),c=t.getY(r);if(null==c||Number.isNaN(c))continue;const u=t.scales.x(e),h=t.scales.y(c);let d=o;if(t.getCategory){const e=t.getCategory(r);d=t.config.barColors?.[e]||d}const{r:f,...y}=t.config.pointStyle?.(r)??{},p={type:"point",x:u,y:h,r:f??i,style:{fill:d,opacity:a,stroke:s,strokeWidth:l,...y},datum:r};t.getPointId&&(p.pointId=t.getPointId(r)+""),n.push(p)}return n}(i,e);case"waterfall":return function(t,e,n){const r=[],i=t.scales,o=t.config.waterfallStyle,a=e.filter(e=>{const n=t.getY(e),r=t.getX(e);return null!=n&&!Number.isNaN(n)&&null!=r&&isFinite(r)});if(0===a.length)return r;const s=o?.positiveColor??t.config.themeSemantic?.success??"#28a745",l=o?.negativeColor??t.config.themeSemantic?.danger??"#dc3545",c=o?.gap??1,u=o?.stroke,h=o?.strokeWidth,d=o?.opacity;let f=0;for(let e=0;a.length>e;e++){const y=a[e],p=t.getX(y),g=t.getY(y),m=f+g;let x;x=a.length-1>e?t.getX(a[e+1])-p:e>0?p-t.getX(a[e-1]):0;const b=i.x(p),v=0!==x?i.x(p+x):b+n.width/10,k=Math.min(b,v)+c/2,w=Math.max(b,v)-c/2-k;if(0>=w){f=m;continue}const A=i.y(f),M=i.y(m),S=Math.min(A,M),$=Math.abs(A-M),P={fill:0>g?l:s,stroke:u,strokeWidth:h};null!=d&&(P.opacity=d),r.push(se(k,S,w,$,P,{...y,baseline:f,cumEnd:m,delta:g,_connectorStroke:o?.connectorStroke,_connectorWidth:o?.connectorWidth})),f=m}return r}(i,e,t);case"candlestick":return function(t,e,n){if(!t.getHigh||!t.getLow||!t.scales)return[];const r=t.config.candlestickRangeMode??!1;if(!(r||t.getOpen&&t.getClose))return[];const i=[],o=t.config.candlestickStyle||{},a=o.rangeColor||"#6366f1",s=r?a:o.upColor||"#28a745",l=r?a:o.downColor||"#dc3545",c=r?a:o.wickColor||"#333",u=o.wickWidth||(r?2:1),h=e.map(e=>t.getX(e)).filter(t=>null!=t&&!Number.isNaN(t)).sort((t,e)=>t-e);let d=o.bodyWidth??0;if(null==o.bodyWidth)if(h.length>1){let e=1/0;for(let n=1;h.length>n;n++){const r=Math.abs(t.scales.x(h[n])-t.scales.x(h[n-1]));r>0&&e>r&&(e=r)}d=e!==1/0?Math.max(2,Math.min(.6*e,20)):6}else d=6;for(const o of e){const e=t.getX(o);if(null==e||Number.isNaN(e))continue;const a=t.getHigh(o),h=t.getLow(o);if(null==a||Number.isNaN(a)||null==h||Number.isNaN(h))continue;const f=r?a:t.getOpen(o),y=r?h:t.getClose(o);if(!r&&[f,y].some(t=>null==t||Number.isNaN(t)))continue;const p=y>=f,g={type:"candlestick",x:t.scales.x(e),openY:t.scales.y(f),closeY:t.scales.y(y),highY:t.scales.y(a),lowY:t.scales.y(h),bodyWidth:d,upColor:s,downColor:l,wickColor:c,wickWidth:u,isUp:p,datum:o};r&&(g.isRange=!0,g.dotRadius=Math.max(2,Math.min(d/2,.12*n.height))),i.push(g)}return i}(i,e,t);default:return[]}}resolveBoundsStyle(t,e){return function(t,e,n,r){const i=t.boundsStyle;return"function"==typeof i?i(n||{},e):i&&"object"==typeof i?i:{fill:r(e,n).stroke||t.themeSemantic?.primary||"#4e79a7",fillOpacity:.2,stroke:"none"}}(this.config,t,e,(t,e)=>this.resolveLineStyle(t,e))}computeDecayOpacity(t,e){const n=this.config.decay;return n&&e>1?Ut(n,t,e):1}getDatumIndexMap(t){if(this._datumIndexCache&&this._datumIndexCache.version===this._ingestVersion)return this._datumIndexCache.map;const e=Zt(t);return this._datumIndexCache={version:this._ingestVersion,map:e},e}applyDecay(t,e){this.config.decay&&function(t,e,n,r=Zt(n)){const i=n.length;if(i>1)for(const n of e){if("line"===n.type){const e=Array.isArray(n.datum)?n.datum:[];if(2>e.length)continue;const o=Array(e.length);let a=!1;for(let n=0;e.length>n;n++){const s=r.get(e[n]);null!=s?(o[n]=Ut(t,s,i),1>o[n]&&(a=!0)):o[n]=1}a&&(n._decayOpacities=o);continue}if("area"===n.type){const e=Array.isArray(n.datum)?n.datum:[],o=n.topPath?n.topPath.length:e.length;if(2>o)continue;if(e.length===o){const a=Array(o);let s=!1;for(let n=0;e.length>n;n++){const o=r.get(e[n]);null!=o?(a[n]=Ut(t,o,i),1>a[n]&&(s=!0)):a[n]=1}s&&(n._decayOpacities=a)}else{let a=1;for(const n of e){const e=r.get(n);if(null!=e){const n=Ut(t,e,i);a>n&&(a=n)}}if(1>a){const t=Array(o);t.fill(a),n._decayOpacities=t}}continue}const e=r.get(n.datum);if(null==e)continue;const o=Ut(t,e,i);"heatcell"===n.type?n.style={opacity:o}:"candlestick"===n.type?n._decayOpacity=o:n.style={...n.style,opacity:(n.style?.opacity??1)*o}}}(this.config.decay,t,e,this.getDatumIndexMap(e))}refreshPulse(t){return!0!==this.lastCustomLayoutFailure?.preservedLastGoodScene&&this.applyPulse(this.scene,this.getBufferArray(),t)}hasActivePulsesAt(t){return!!this.config.pulse&&Qt(this.config.pulse,this.timestampBuffer,t)}get hasActivePulses(){return this.hasActivePulsesAt(this.currentTime())}get transitionContext(){return{runtimeMode:this.config.runtimeMode,getX:this.getX,getY:this.getY,getCategory:this.getCategory}}snapshotPositions(){!function(t,e,n,r){n.clear(),r.clear();for(let i=0;e.length>i;i++){const o=e[i],a=te(t,o,i);a&&("point"===o.type?n.set(a,{x:o.x,y:o.y,r:o.r,opacity:ee(o.style)}):"glyph"===o.type?n.set(a,{x:o.x,y:o.y,r:o.size,opacity:ee(o.style),glyph:o.glyph}):"rect"===o.type||"heatcell"===o.type?n.set(a,{x:o.x,y:o.y,w:o.w,h:o.h,opacity:ee(o.style)}):"candlestick"===o.type?n.set(a,{x:o.x,y:o.openY,w:o.bodyWidth,openY:o.openY,closeY:o.closeY,highY:o.highY,lowY:o.lowY,opacity:ee(o.style)}):"line"===o.type?r.set(a,{path:o.path.map(t=>[t[0],t[1]]),opacity:o.style?.opacity}):"area"===o.type&&r.set(a,{topPath:o.topPath.map(t=>[t[0],t[1]]),bottomPath:o.bottomPath.map(t=>[t[0],t[1]]),opacity:o.style?.opacity}))}}(this.transitionContext,this.scene,this.prevPositionMap,this.prevPathMap)}synthesizeIntroPositions(){this.prevPositionMap.clear(),this.prevPathMap.clear();const t=this.scales?.y(0)??0;for(let e=0;this.scene.length>e;e++){const n=this.scene[e],r=te(this.transitionContext,n,e);r&&("point"===n.type?this.prevPositionMap.set(r,{x:n.x,y:n.y,r:0,opacity:0}):"rect"===n.type?this.prevPositionMap.set(r,{x:n.x,y:t,w:n.w,h:0,opacity:n.style.opacity??1}):"heatcell"===n.type?this.prevPositionMap.set(r,{x:n.x,y:n.y,w:n.w,h:n.h,opacity:0}):"line"===n.type?(n._introClipFraction=0,this.prevPathMap.set(r,{path:n.path.map(t=>[t[0],t[1]]),opacity:n.style.opacity})):"area"===n.type&&(n._introClipFraction=0,this.prevPathMap.set(r,{topPath:n.topPath.map(t=>[t[0],t[1]]),bottomPath:n.bottomPath.map(t=>[t[0],t[1]]),opacity:n.style.opacity})))}}startTransition(){if(!this.config.transition)return;const t=function(t,e,n,r,i,o=qt()){if(0===r.size&&0===i.size)return n;const a=e.duration??300;if(n.exitNodes.length>0){const t=new Set(n.exitNodes);n.scene=n.scene.filter(e=>!t.has(e)),n.exitNodes=[]}let s=!1;const l=new Set,c=new Set;for(let e=0;n.scene.length>e;e++){const o=n.scene[e],a=te(t,o,e);if(!a)continue;if(o._transitionKey=a,"line"===o.type||"area"===o.type){const t=i.get(a);if(t){if(c.add(a),"line"===o.type&&t.path&&t.path.length===o.path.length){o._targetPath=o.path.map(t=>[t[0],t[1]]),o._prevPath=t.path;for(let e=0;o.path.length>e;e++)o.path[e]=[t.path[e][0],t.path[e][1]];s=!0}else if("area"===o.type&&t.topPath&&t.bottomPath&&t.topPath.length===o.topPath.length&&t.bottomPath.length===o.bottomPath.length){o._targetTopPath=o.topPath.map(t=>[t[0],t[1]]),o._targetBottomPath=o.bottomPath.map(t=>[t[0],t[1]]),o._prevTopPath=t.topPath,o._prevBottomPath=t.bottomPath;for(let e=0;o.topPath.length>e;e++)o.topPath[e]=[t.topPath[e][0],t.topPath[e][1]];for(let e=0;o.bottomPath.length>e;e++)o.bottomPath[e]=[t.bottomPath[e][0],t.bottomPath[e][1]];s=!0}o._targetOpacity=o.style.opacity??1,o._startOpacity=t.opacity??o.style.opacity??1}else o._targetOpacity=o.style.opacity??1,o._startOpacity=0,o.style={...o.style,opacity:0},s=!0;continue}const u=r.get(a);if("point"===o.type)if(u){l.add(a);const t={x:o.x,y:o.y,r:o.r};o._targetOpacity=ee(o.style),u.x===t.x&&u.y===t.y&&u.r===t.r||(o._targetX=t.x,o._targetY=t.y,o._targetR=t.r,o.x=u.x,o.y=u.y,o.r=u.r??o.r,s=!0)}else o._targetOpacity=ee(o.style),o.style={...o.style,opacity:0},s=!0;else if("glyph"===o.type)if(u){l.add(a);const t={x:o.x,y:o.y,size:o.size};o._targetOpacity=ee(o.style),u.x===t.x&&u.y===t.y&&u.r===t.size||(o._targetX=t.x,o._targetY=t.y,o._targetR=t.size,o.x=u.x,o.y=u.y,o.size=u.r??o.size,s=!0)}else o._targetOpacity=ee(o.style),o.style={...o.style,opacity:0},s=!0;else if("rect"===o.type)if(u){l.add(a);const t={x:o.x,y:o.y,w:o.w,h:o.h};o._targetOpacity=ee(o.style),u.x===t.x&&u.y===t.y&&u.w===t.w&&u.h===t.h||(o._targetX=t.x,o._targetY=t.y,o._targetW=t.w,o._targetH=t.h,o.x=u.x,o.y=u.y,o.w=u.w??o.w,o.h=u.h??o.h,s=!0)}else o._targetOpacity=ee(o.style),o.style={...o.style,opacity:0},s=!0;else if("heatcell"===o.type)if(u){l.add(a);const t={x:o.x,y:o.y,w:o.w,h:o.h};o._targetOpacity=ee(o.style),u.x===t.x&&u.y===t.y&&u.w===t.w&&u.h===t.h||(o._targetX=t.x,o._targetY=t.y,o._targetW=t.w,o._targetH=t.h,o.x=u.x,o.y=u.y,o.w=u.w??o.w,o.h=u.h??o.h,s=!0)}else o._targetOpacity=ee(o.style),o.style={...o.style||{},opacity:0},s=!0;else if("candlestick"===o.type)if(u&&null!=u.openY){l.add(a);const t={x:o.x,openY:o.openY,closeY:o.closeY,highY:o.highY,lowY:o.lowY};o._targetOpacity=ee(o.style),(u.x!==t.x||u.openY!==t.openY||u.closeY!==t.closeY||u.highY!==t.highY||u.lowY!==t.lowY)&&(o._targetX=t.x,o._targetOpenY=t.openY,o._targetCloseY=t.closeY,o._targetHighY=t.highY,o._targetLowY=t.lowY,o.x=u.x,o.openY=u.openY,o.closeY=u.closeY??o.closeY,o.highY=u.highY??o.highY,o.lowY=u.lowY??o.lowY,s=!0)}else o._targetOpacity=ee(o.style),o.style={...o.style||{},opacity:0},s=!0}for(const[t,e]of i)if(!c.has(t))if(t.startsWith("l:")&&e.path){const r={type:"line",path:e.path.map(t=>[t[0],t[1]]),group:t.slice(2),style:{stroke:"#999",strokeWidth:1,opacity:e.opacity??1},_targetOpacity:0,_transitionKey:t,datum:null};n.exitNodes.push(r),s=!0}else if(t.startsWith("a:")&&e.topPath&&e.bottomPath){const r={type:"area",topPath:e.topPath.map(t=>[t[0],t[1]]),bottomPath:e.bottomPath.map(t=>[t[0],t[1]]),group:t.slice(2),style:{fill:"#999",opacity:e.opacity??1},_targetOpacity:0,_transitionKey:t,datum:null};n.exitNodes.push(r),s=!0}for(const[t,e]of r)if(!l.has(t)){if(t.startsWith("p:"))n.exitNodes.push({type:"point",x:e.x,y:e.y,r:e.r??3,style:{opacity:e.opacity??1},datum:null,_targetOpacity:0,_transitionKey:t});else if(t.startsWith("g:")&&e.glyph)n.exitNodes.push({type:"glyph",x:e.x,y:e.y,size:e.r??12,glyph:e.glyph,color:"#999",accent:"#999",style:{opacity:e.opacity??1},datum:null,_targetOpacity:0,_transitionKey:t});else if(t.startsWith("r:"))n.exitNodes.push({type:"rect",x:e.x,y:e.y,w:e.w??0,h:e.h??0,style:{opacity:e.opacity??1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:t});else if(t.startsWith("h:"))n.exitNodes.push({type:"heatcell",x:e.x,y:e.y,w:e.w??0,h:e.h??0,fill:"#999",datum:null,style:{opacity:e.opacity??1},_targetOpacity:0,_transitionKey:t});else if(t.startsWith("c:")){const r=e.openY??e.y;n.exitNodes.push({type:"candlestick",x:e.x,openY:r,closeY:e.closeY??r,highY:e.highY??r,lowY:e.lowY??r,bodyWidth:e.w??6,upColor:"#999",downColor:"#999",wickColor:"#999",wickWidth:1,isUp:!0,datum:null,style:{opacity:e.opacity??1},_targetOpacity:0,_transitionKey:t})}s=!0}return n.exitNodes.length>0&&(n.scene=[...n.scene,...n.exitNodes]),s&&(n.activeTransition={startTime:o,duration:a}),n}(this.transitionContext,this.config.transition,{scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},this.prevPositionMap,this.prevPathMap,this.currentTime());this.scene=t.scene,this.exitNodes=t.exitNodes,this.activeTransition=t.activeTransition}advanceTransition(t){if(!this.activeTransition||!this.config.transition)return!1;const e={scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},n=function(t,e,n,r){if(!n.activeTransition)return!1;const i=Ht(t,n.activeTransition),o=Gt(i,"linear"===e.easing?"linear":"ease-out-cubic");for(const t of n.scene){const e=t._transitionKey;if("point"===t.type){if(void 0!==t._targetOpacity){const n=e?r.get(e):void 0;t.style.opacity=Vt(n?n.opacity??1:0,t._targetOpacity,o)}if(void 0===t._targetX)continue;if(!e)continue;const n=r.get(e);if(!n)continue;t.x=Vt(n.x,t._targetX,o),t.y=Vt(n.y,t._targetY,o),void 0!==t._targetR&&void 0!==n.r&&(t.r=Vt(n.r,t._targetR,o))}else if("glyph"===t.type){if(void 0!==t._targetOpacity){const n=e?r.get(e):void 0;t.style.opacity=Vt(n?n.opacity??1:0,t._targetOpacity,o)}if(void 0===t._targetX)continue;if(!e)continue;const n=r.get(e);if(!n)continue;t.x=Vt(n.x,t._targetX,o),t.y=Vt(n.y,t._targetY,o),void 0!==t._targetR&&void 0!==n.r&&(t.size=Vt(n.r,t._targetR,o))}else if("rect"===t.type){if(void 0!==t._targetOpacity){const n=e?r.get(e):void 0;t.style.opacity=Vt(n?n.opacity??1:0,t._targetOpacity,o)}if(void 0===t._targetX)continue;if(!e)continue;const n=r.get(e);if(!n)continue;t.x=Vt(n.x,t._targetX,o),t.y=Vt(n.y,t._targetY,o),void 0!==n.w&&(t.w=Vt(n.w,t._targetW,o)),void 0!==n.h&&(t.h=Vt(n.h,t._targetH,o))}else if("heatcell"===t.type){if(void 0!==t._targetOpacity){const n=e?r.get(e):void 0;t.style={...t.style||{},opacity:Vt(n?n.opacity??1:0,t._targetOpacity,o)}}if(void 0===t._targetX)continue;if(!e)continue;const n=r.get(e);if(!n)continue;t.x=Vt(n.x,t._targetX,o),t.y=Vt(n.y,t._targetY,o),void 0!==n.w&&(t.w=Vt(n.w,t._targetW,o)),void 0!==n.h&&(t.h=Vt(n.h,t._targetH,o))}else if("candlestick"===t.type){if(void 0!==t._targetOpacity){const n=e?r.get(e):void 0;t.style={...t.style||{},opacity:Vt(n?n.opacity??1:0,t._targetOpacity,o)}}if(void 0===t._targetX)continue;if(!e)continue;const n=r.get(e);if(!n)continue;t.x=Vt(n.x,t._targetX,o),void 0!==n.openY&&(t.openY=Vt(n.openY,t._targetOpenY,o)),void 0!==n.closeY&&(t.closeY=Vt(n.closeY,t._targetCloseY,o)),void 0!==n.highY&&(t.highY=Vt(n.highY,t._targetHighY,o)),void 0!==n.lowY&&(t.lowY=Vt(n.lowY,t._targetLowY,o))}else if("line"===t.type){void 0!==t._targetOpacity&&(t.style={...t.style,opacity:Vt(t._startOpacity??0,t._targetOpacity,o)}),void 0!==t._introClipFraction&&(t._introClipFraction=o);const e=t._prevPath,n=t._targetPath;if(e&&n&&e.length===t.path.length)for(let r=0;t.path.length>r;r++)t.path[r][0]=Vt(e[r][0],n[r][0],o),t.path[r][1]=Vt(e[r][1],n[r][1],o)}else if("area"===t.type){void 0!==t._targetOpacity&&(t.style={...t.style,opacity:Vt(t._startOpacity??0,t._targetOpacity,o)}),void 0!==t._introClipFraction&&(t._introClipFraction=o);const e=t._prevTopPath,n=t._prevBottomPath,r=t._targetTopPath,i=t._targetBottomPath;if(e&&r&&e.length===t.topPath.length)for(let n=0;t.topPath.length>n;n++)t.topPath[n][0]=Vt(e[n][0],r[n][0],o),t.topPath[n][1]=Vt(e[n][1],r[n][1],o);if(n&&i&&n.length===t.bottomPath.length)for(let e=0;t.bottomPath.length>e;e++)t.bottomPath[e][0]=Vt(n[e][0],i[e][0],o),t.bottomPath[e][1]=Vt(n[e][1],i[e][1],o)}}if(i>=1){for(const t of n.scene){if(void 0!==t._targetOpacity){const e=t._targetOpacity;t.style="line"===t.type||"area"===t.type?{...t.style,opacity:0===e?0:e}:{...t.style||{},opacity:0===e?0:e},t._targetOpacity=void 0}if("point"===t.type){if(void 0===t._targetX)continue;t.x=t._targetX,t.y=t._targetY,void 0!==t._targetR&&(t.r=t._targetR),t._targetX=void 0,t._targetY=void 0,t._targetR=void 0}else if("glyph"===t.type){if(void 0===t._targetX)continue;t.x=t._targetX,t.y=t._targetY,void 0!==t._targetR&&(t.size=t._targetR),t._targetX=void 0,t._targetY=void 0,t._targetR=void 0}else if("rect"===t.type){if(void 0===t._targetX)continue;t.x=t._targetX,t.y=t._targetY,t.w=t._targetW,t.h=t._targetH,t._targetX=void 0,t._targetY=void 0,t._targetW=void 0,t._targetH=void 0}else if("heatcell"===t.type){if(void 0===t._targetX)continue;t.x=t._targetX,t.y=t._targetY,t.w=t._targetW,t.h=t._targetH,t._targetX=void 0,t._targetY=void 0,t._targetW=void 0,t._targetH=void 0}else if("candlestick"===t.type){if(void 0===t._targetX)continue;t.x=t._targetX,void 0!==t._targetOpenY&&(t.openY=t._targetOpenY),void 0!==t._targetCloseY&&(t.closeY=t._targetCloseY),void 0!==t._targetHighY&&(t.highY=t._targetHighY),void 0!==t._targetLowY&&(t.lowY=t._targetLowY),t._targetX=void 0,t._targetOpenY=void 0,t._targetCloseY=void 0,t._targetHighY=void 0,t._targetLowY=void 0}else if("line"===t.type){const e=t._targetPath;if(e)for(let n=0;t.path.length>n;n++)t.path[n]=e[n];t._prevPath=void 0,t._targetPath=void 0,t._introClipFraction=void 0}else if("area"===t.type){const e=t._targetTopPath,n=t._targetBottomPath;if(e)for(let n=0;t.topPath.length>n;n++)t.topPath[n]=e[n];if(n)for(let e=0;t.bottomPath.length>e;e++)t.bottomPath[e]=n[e];t._prevTopPath=void 0,t._prevBottomPath=void 0,t._targetTopPath=void 0,t._targetBottomPath=void 0,t._introClipFraction=void 0}}if(n.exitNodes.length>0){const t=new Set(n.exitNodes);n.scene=n.scene.filter(e=>!t.has(e)),n.exitNodes=[]}return n.activeTransition=null,!1}return!0}(t,this.config.transition,e,this.prevPositionMap);return this.scene=e.scene,this.exitNodes=e.exitNodes,this.activeTransition=e.activeTransition,n}cancelIntroAnimation(){this.prevPositionMap.clear(),this.prevPathMap.clear(),this.activeTransition=null,function(t){for(const e of t){if(void 0!==e._targetOpacity){const t=e._targetOpacity;e.style={...e.style||{},opacity:0===t?0:t},e._targetOpacity=void 0}if("point"===e.type)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("glyph"===e.type)void 0!==e._targetX&&(e.x=e._targetX,e.y=e._targetY,void 0!==e._targetR&&(e.size=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0);else if("rect"===e.type||"heatcell"===e.type)void 0!==e._targetX&&(e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0);else if("candlestick"===e.type)void 0!==e._targetX&&(e.x=e._targetX,void 0!==e._targetOpenY&&(e.openY=e._targetOpenY),void 0!==e._targetCloseY&&(e.closeY=e._targetCloseY),void 0!==e._targetHighY&&(e.highY=e._targetHighY),void 0!==e._targetLowY&&(e.lowY=e._targetLowY),e._targetX=void 0,e._targetOpenY=void 0,e._targetCloseY=void 0,e._targetHighY=void 0,e._targetLowY=void 0);else if("line"===e.type||"area"===e.type){if(e._introClipFraction=void 0,"line"===e.type&&e._targetPath){for(let t=0;e.path.length>t;t++)e.path[t]=e._targetPath[t];e._prevPath=void 0,e._targetPath=void 0}if("area"===e.type){if(e._targetTopPath)for(let t=0;e.topPath.length>t;t++)e.topPath[t]=e._targetTopPath[t];if(e._targetBottomPath)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t]=e._targetBottomPath[t];e._prevTopPath=void 0,e._prevBottomPath=void 0,e._targetTopPath=void 0,e._targetBottomPath=void 0}}}}(this.scene),this.exitNodes=[]}groupData(t){const{result:e,cache:n}=function(t,e,n,r){if(r&&r.version===n&&r.group===e&&r.data===t)return{result:r.result,cache:r};let i;if(e){const n=new Map;for(const r of t){const t=e(r);n.has(t)||n.set(t,[]),n.get(t).push(r)}i=Array.from(n.entries()).map(([t,e])=>({key:t,data:e}))}else i=[{key:"_default",data:t}];return{result:i,cache:{version:n,group:e,data:t,result:i}}}(t,this.getGroup,this._ingestVersion,this._groupDataCache);return this._groupDataCache=n,e}resolveColorMap(t){const{map:e,cache:n}=function(t,e,n,r,i){if(i&&i.version===r)return{map:i.map,cache:i};const o=new Set;if(e)for(const n of t){const t=e(n);t&&o.add(t)}const a=Array.from(o).sort(),s=a.join("\0");if(i&&i.key===s){const t={...i,version:r};return{map:t.map,cache:t}}const l=Array.isArray(n.colorScheme)?n.colorScheme:n.themeCategorical||It,c=new Map;for(let t=0;a.length>t;t++)c.set(a[t],l[t%l.length]);return{map:c,cache:{key:s,map:c,version:r}}}(t,this.getColor,this.config,this._ingestVersion,this._colorMapCache);return this._colorMapCache=n,e}resolveLineStyle(t,e){return function(t,e,n,r){const i=t.lineStyle;if("function"==typeof i){const t=i(n||{},e);if(t&&!t.stroke&&e){const n=r(e);if(n)return{...t,stroke:n}}return t}const o=t.themeSemantic?.primary;return i&&"object"==typeof i?{stroke:i.stroke||o||"#007bff",strokeWidth:i.strokeWidth||2,strokeDasharray:i.strokeDasharray,fill:i.fill,fillOpacity:i.fillOpacity,opacity:i.opacity}:{stroke:r(e)||o||"#007bff",strokeWidth:2}}(this.config,t,e,t=>this.resolveGroupColor(t))}resolveAreaStyle(t,e){return function(t,e,n,r){if(t.areaStyle){const i=t.areaStyle(n||{});if(i&&!i.fill&&e){const t=r(e);if(t)return{...i,fill:t,stroke:i.stroke||t}}return i}const i=t.lineStyle;if("function"==typeof i){const t=i(n||{},e);if(t&&!t.fill&&e){const n=r(e);if(n)return{...t,fill:n,stroke:t.stroke||n}}return t}const o=t.themeSemantic?.primary;if(i&&"object"==typeof i)return{fill:i.fill||i.stroke||o||"#4e79a7",fillOpacity:i.fillOpacity??.7,stroke:i.stroke||o||"#4e79a7",strokeWidth:i.strokeWidth||2};const a=r(e)||o||"#4e79a7";return{fill:a,fillOpacity:.7,stroke:a,strokeWidth:2}}(this.config,t,e,t=>this.resolveGroupColor(t))}resolveGroupColor(e){const{color:n,groupColorCounter:r}=function(t){const{group:e,colorMapCache:n,groupColorMap:r,groupColorMapCap:i,config:o}=t;let{groupColorCounter:a}=t;if(n){const t=n.map.get(e);if(t)return{color:t,groupColorCounter:a}}const s=r.get(e);if(s)return{color:s,groupColorCounter:a};const l=(Array.isArray(o.colorScheme)&&o.colorScheme.length>0?o.colorScheme:null)||(Array.isArray(o.themeCategorical)&&o.themeCategorical.length>0?o.themeCategorical:null)||It;if(0===l.length)return{color:null,groupColorCounter:a};const c=l[a%l.length];if(a++,r.set(e,c),r.size>i){const t=r.keys().next().value;void 0!==t&&r.delete(t)}return{color:c,groupColorCounter:a}}({group:e,colorMapCache:this._colorMapCache,groupColorMap:this._groupColorMap,groupColorCounter:this._groupColorCounter,groupColorMapCap:t.GROUP_COLOR_MAP_CAP,config:this.config});return this._groupColorCounter=r,n}getBufferArray(){return!this._bufferDirty&&this._bufferArrayCache||(this._bufferArrayCache=this.buffer.toArray(),this._bufferDirty=!1),this._bufferArrayCache}getData(){return this.getBufferArray()}remove(t){if(!this.getPointId)throw Error("remove() requires pointIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const e=Dt(t),n=this.getPointId,r=t=>e.has(n(t));Ye(this.buffer,this.timestampBuffer,r);const i=this.buffer.remove(r);if(0===i.length)return this.updateResults.recordNoop("remove"),i;for(const t of i)this.xExtent.evict(this.getX(t)),this.evictDatumYExtent(t);return this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("remove",i.length),i}update(t,e){if(!this.getPointId)throw Error("update() requires pointIdAccessor to be configured");const n=Dt(t),r=this.getPointId,i=new Set;this.buffer.forEach((t,e)=>{n.has(r(t))&&i.add(e)});const o=this.buffer.update(t=>n.has(r(t)),e);if(0===o.length)return this.updateResults.recordNoop("update"),o;for(const t of o)this.xExtent.evict(this.getX(t)),this.evictDatumYExtent(t);return this.buffer.forEach((t,e)=>{i.has(e)&&(this.xExtent.push(this.getX(t)),this.pushDatumYExtent(t))}),this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("update",o.length),o}getBinBoundaries(){return this._binBoundaries}getExtents(){return this.xExtent.min===1/0?null:{x:this.xExtent.extent,y:this.yExtent.extent}}clear(){this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.prevPathMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this._lastBoundedInsertsRef=null,this.needsFullRebuild=!0,this._bufferDirty=!0,this._bufferArrayCache=null,this._datumIndexCache=null,this.lastLayout=null,this.scales=null,this.scene=[],this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.spatialIndex.clear(),this._colorMapCache=null,this._groupDataCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this.version++,this.updateResults.recordData("clear")}get size(){return this.buffer.size}getBuffer(){return this.buffer}getXAccessor(){return this.getX}getYAccessor(){return this.getY}getCategoryAccessor(){return this.getCategory}applyCustomRestyle(t,e){const n=this._customRestyle;if(n)for(const r of t){const t=this._baseStyles.get(r)??r.style??{},i=n(r,e);r.style=i?{...t,...i}:t}}restyleScene(t){this._customRestyle?(this.applyCustomRestyle(this.scene,t),this.markStylePaintPending(),this.updateResults.recordRestyle(!0)):this.updateResults.recordRestyle(!1)}updateConfig(t){const e={...this.config},n=Object.keys(t).filter(n=>t[n]!==e[n]);"production"!==process.env.NODE_ENV&&!this.windowSizeWarned&&"windowSize"in t&&t.windowSize!==e.windowSize&&(this.windowSizeWarned=!0,console.warn(`[Semiotic] windowSize changed after mount (${e.windowSize} → ${t.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 t||"themeCategorical"in t||"colorAccessor"in t)&&(this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0),("barColors"in t||"colorScheme"in t)&&(this._barCategoryCache=null),("normalize"in t||"extentPadding"in t||"xAccessor"in t||"yAccessor"in t||"timeAccessor"in t||"valueAccessor"in t||"boundsAccessor"in t||"band"in t||"y0Accessor"in t||"openAccessor"in t||"highAccessor"in t||"lowAccessor"in t||"closeAccessor"in t||"groupAccessor"in t||"categoryAccessor"in t||"chartType"in t||"runtimeMode"in t)&&(this._stackExtentCache=null);let r=!1,i=!1;Object.assign(this.config,t),"pulse"in t&&this.syncPulseTimestampBuffer();const o="chartType"in t&&t.chartType!==e.chartType||"runtimeMode"in t&&t.runtimeMode!==e.runtimeMode;if(o||"xAccessor"in t||"yAccessor"in t||"timeAccessor"in t||"valueAccessor"in t){const t=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode,n=t&&this.config.valueAccessor||this.config.yAccessor,a=t&&e.valueAccessor||e.yAccessor,s=o||!q(t&&this.config.timeAccessor||this.config.xAccessor,t&&e.timeAccessor||e.xAccessor),l=o||!q(n,a);(s||l)&&(t?(this.getX=U(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=U(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=U(this.config.xAccessor,"x"),this.getY=U(this.config.yAccessor,"y")),l&&this.resolvedRibbons.some(t=>"bounds"===t.kind)&&(this.resolvedRibbons=Te(this.config)),r=!0,i=!0)}if("groupAccessor"in t&&!q(t.groupAccessor,e.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?Q(this.config.groupAccessor):void 0,r=!0),"categoryAccessor"in t&&!q(t.categoryAccessor,e.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?Q(this.config.categoryAccessor):void 0,r=!0),"sizeAccessor"in t&&!q(t.sizeAccessor,e.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?U(this.config.sizeAccessor,"size"):void 0,r=!0),"symbolAccessor"in t&&!q(t.symbolAccessor,e.symbolAccessor)&&(this.getSymbol=null!=this.config.symbolAccessor?Q(this.config.symbolAccessor):void 0,r=!0),"colorAccessor"in t&&!q(t.colorAccessor,e.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?Q(this.config.colorAccessor):void 0,r=!0),"y0Accessor"in t&&!q(t.y0Accessor,e.y0Accessor)&&(this.getY0=this.config.y0Accessor?U(this.config.y0Accessor,"y0"):void 0,r=!0,i=!0),("boundsAccessor"in t&&!q(t.boundsAccessor,e.boundsAccessor)||"band"in t&&t.band!==e.band||"boundsStyle"in t&&t.boundsStyle!==e.boundsStyle)&&(this.resolvedRibbons=Te(this.config),r=!0,i=!0),"pointIdAccessor"in t&&!q(t.pointIdAccessor,e.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?Q(this.config.pointIdAccessor):void 0,r=!0),"candlestick"===this.config.chartType&&(o||"openAccessor"in t&&!q(t.openAccessor,e.openAccessor)||"closeAccessor"in t&&!q(t.closeAccessor,e.closeAccessor)||"highAccessor"in t&&!q(t.highAccessor,e.highAccessor)||"lowAccessor"in t&&!q(t.lowAccessor,e.lowAccessor))){const t=null!=this.config.openAccessor,e=null!=this.config.closeAccessor;this.getOpen=t?U(this.config.openAccessor,"open"):void 0,this.getHigh=U(this.config.highAccessor,"high"),this.getLow=U(this.config.lowAccessor,"low"),this.getClose=e?U(this.config.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!t&&!e,r=!0,i=!0}if("accessorRevision"in t&&t.accessorRevision!==e.accessorRevision&&(r=!0,i=!0),!r){const n=Object.keys(t).filter(t=>!t.endsWith("Accessor")&&"timeAccessor"!==t&&"valueAccessor"!==t);for(const i of n)if(t[i]!==e[i]){r=!0;break}}r&&(i&&this.rebuildExtents(),this.needsFullRebuild=!0),this.updateResults.recordConfig(n)}updateConfigWithResult(t){return this.updateConfig(t),this.updateResults.last}};fn.GROUP_COLOR_MAP_CAP=1e3;var yn=fn;Ue(yn);import{memo as pn,useEffect as gn,useRef as mn}from"react";var xn={sceneGeometry:0,layout:0,domain:0};function bn(t){const{domain:e,layout:n,sceneGeometry:r}=t.revisions;return{domain:e,layout:n,sceneGeometry:r}}function vn(t,e){return{sceneGeometry:Math.max(t.sceneGeometry,e.sceneGeometry),layout:Math.max(t.layout,e.layout),domain:Math.max(t.domain,e.domain)}}var kn="production"!==process.env.NODE_ENV,wn={revisions:xn,signature:"",sawSignals:!1,wasUnconsumed:!1,warnUnconsumed:!1},An=class{constructor(t="scene host"){this.hostName=t,this.lastConsumed=xn,this.lastObserved=xn,this.lastDuplicateWarning="",this.lastUnconsumedWarning=""}observeUpdateResult(t){kn&&(this.lastObserved=vn(this.lastObserved,bn(t)))}beforeCompute(t,e){if(!kn)return wn;const n=vn(bn(t),this.lastObserved),r=function(t){return`${t.sceneGeometry}|${t.layout}|${t.domain}`}(n),i=!((o=n).sceneGeometry===(a=this.lastConsumed).sceneGeometry&&o.layout===a.layout&&o.domain===a.domain);var o,a;return{revisions:n,signature:r,sawSignals:t.changed.has("scene-geometry")||t.changed.has("layout")||t.changed.has("domain"),wasUnconsumed:i,warnUnconsumed:!e&&i&&this.lastUnconsumedWarning!==r}}afterCompute(t,e,n){if(kn){if(e&&t.wasUnconsumed&&(this.lastConsumed=t.revisions),t.warnUnconsumed&&!e)return console.warn(`[semiotic] ${this.hostName} observed scene-affecting revisions without a scene rebuild: ${t.signature}.`),void(this.lastUnconsumedWarning=t.signature);e&&t.sawSignals&&!t.wasUnconsumed&&!n&&this.lastDuplicateWarning!==t.signature?(console.warn(`[semiotic] ${this.hostName} performed scene rebuild with unchanged scene revisions: ${t.signature}.`),this.lastDuplicateWarning=t.signature):e&&!t.sawSignals&&(this.lastDuplicateWarning="")}}};function Mn(t){return mn(new An(t))}function Sn(t,e,n,r=!1,i=!1){const o=t.beforeCompute(e.getLastUpdateResult(),r);n(),t.afterCompute(o,!0,i)}var $n=pn(function({store:t,diagnostics:e}){return gn(()=>{const n=()=>e.observeUpdateResult(t.getUpdateSnapshot());return n(),t.subscribeUpdateResult(n)},[e,t]),null});import*as Pn from"react";function _n(...t){const e=t.filter(t=>null!=t);return 0===e.length?null:1===e.length?e[0]:Pn.createElement(Pn.Fragment,null,...e)}import{useEffect as Cn,useRef as Ln}from"react";function Tn(t,e,n,r){Cn(()=>{t.current?.updateConfig(e),n.current=!0,r()},[e,r,t,n])}function Dn(t,e,n,r){const i=Ln(null);Cn(()=>{const o=t.current;if(!o)return;const a=e??null;i.current!==a&&(i.current=a,o.setLayoutSelection(a),o.hasCustomRestyle?o.restyleScene(a):n.current=!0,r())},[e,r,t,n])}function Rn(t,e,n,r,i,o=t=>t.x,a=t=>t.y,s=t=>t.r){const l=Math.max(r,i+5,12),u=e-l,h=e+l,d=n-l,f=n+l;let y=null,p=1/0;return t.visit((t,i,l,g,m)=>{if(i>h||u>g||l>f||d>m)return!0;if(!t.length){let i=t;do{const t=i.data,l=o(t)-e,u=a(t)-n,h=Math.sqrt(l*l+u*u);c(s(t),r)>=h&&p>h&&(y=t,p=h),i=i.next}while(i)}return!1}),y?{node:y,distance:p}:null}import{curveMonotoneX as Wn,curveMonotoneY as En,curveCardinal as Nn,curveCatmullRom as On,curveStep as In,curveStepBefore as zn,curveStepAfter as Fn,curveBasis as Yn,curveNatural as Bn}from"d3-shape";function jn(t){switch(t){case"monotoneX":return Wn;case"monotoneY":return En;case"cardinal":return Nn;case"catmullRom":return On;case"step":return In;case"stepBefore":return zn;case"stepAfter":return Fn;case"basis":return Yn;case"natural":return Bn;default:return null}}function Xn(t,e,n){if(null==e)return n;if(y(e)){return m(e,t)||e.background&&it(t,e.background)||n}return"string"!=typeof e?e:it(t,e)||n}function Gn(t,e,n,r,i,o,a){const s=e.stops.filter(t=>Number.isFinite(t.offset)&&(null==t.opacity||Number.isFinite(t.opacity)));if(2>s.length)return null;const l=t.createLinearGradient(r,i,o,a);for(const e of s)l.addColorStop(Math.max(0,Math.min(1,e.offset)),Hn(t,e,n));return l}function Hn(t,e,n){const r=e.color??n,i=it(t,r)||r;if(null==e.opacity)return i;const o=Math.max(0,Math.min(1,e.opacity)),[a,s,l]=function(t,e){const n=t.fillStyle,r="#010203";try{t.fillStyle=r,t.fillStyle=e}catch{return t.fillStyle=n,[78,121,167]}const i=t.fillStyle;if(t.fillStyle=n,"string"!=typeof i)return[78,121,167];if(i.toLowerCase()===r&&e.trim().toLowerCase()!==r)return[78,121,167];if(i.startsWith("#"))return[parseInt(i.slice(1,3),16),parseInt(i.slice(3,5),16),parseInt(i.slice(5,7),16)];const o=i.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return o?[+o[1],+o[2],+o[3]]:[78,121,167]}(t,i);return`rgba(${a},${s},${l},${o})`}function Vn(t,e,n,r){e.fill&&(t.fillStyle=Xn(t,e.fill,n),void 0!==e.fillOpacity&&(t.globalAlpha=(e.opacity??1)*e.fillOpacity),r())}function qn(t,e,n){e.stroke&&"none"!==e.stroke&&(t.strokeStyle=it(t,e.stroke)||e.stroke,t.lineWidth=e.strokeWidth??1,t.globalAlpha=(e.opacity??1)*(e.strokeOpacity??1),n())}import{line as Un}from"d3-shape";var Zn=new WeakMap;function Kn(t,e){const n=jn(e);if(!n)return t;const r=Zn.get(t);if(r)return r;const i=function(t,e,n=8){if(!e||2>t.length)return t.map(([t,e])=>[t,e]);const r=[];let i=null;const o={moveTo(t,e){i=[t,e],r.push([t,e])},lineTo(t,e){i=[t,e],r.push([t,e])},bezierCurveTo(t,e,o,a,s,l){if(!i)return i=[s,l],void r.push([s,l]);const[c,u]=i;for(let i=1;n>=i;i++){const h=i/n,d=1-h;r.push([d*d*d*c+3*d*d*h*t+3*d*h*h*o+h*h*h*s,d*d*d*u+3*d*d*h*e+3*d*h*h*a+h*h*h*l])}i=[s,l]},closePath(){},arc(){},rect(){},arcTo(){},quadraticCurveTo(t,e,n,o){i=[n,o],r.push([n,o])}};return Un().x(t=>t[0]).y(t=>t[1]).curve(e).context(o)(t),r}(t,n);return Zn.set(t,i),i}function Jn(t,e,n,r=30,i,o=0){let a=null;if(i){const t=Rn(i,e,n,r,o);t&&(a={node:t.node,datum:t.node.datum,x:t.node.x,y:t.node.y,distance:t.distance})}for(const o of t){let t=null;switch(o.type){case"point":if(i)break;t=tr(o,e,n,r);break;case"symbol":t=er(o,e,n,r);break;case"glyph":t=nr(o,e,n,r);break;case"line":t=rr(o,e,n,r);break;case"rect":if(null==o.datum)break;t=or(o,e,n);break;case"heatcell":t=ar(o,e,n);break;case"area":if(!1===o.interactive)break;t=lr(o,e,n);break;case"candlestick":t=sr(o,e,n)}t&&r>t.distance&&(a&&t.distance>=a.distance||(a=t))}return a}function Qn(t,e,n){if(0===t.length)return null;if(t[0][0]>e||e>t[t.length-1][0])return null;const r=cr(t,e);if(0>r)return null;if(Math.abs(t[r][0]-e)>n)return null;let i=r,o=r;r>0&&t[r][0]>=e?(i=r-1,o=r):t.length-1>r&&(i=r,o=r+1);const[a,s]=t[i],[l,c]=t[o];return l===a?s:s+Math.max(0,Math.min(1,(e-a)/(l-a)))*(c-s)}function tr(t,e,n,r=30){const i=e-t.x,o=n-t.y,a=Math.sqrt(i*i+o*o);return a>c(t.r,r)?null:{node:t,datum:t.datum,x:t.x,y:t.y,distance:a}}function er(t,e,n,r=30){const i=e-t.x,o=n-t.y,a=Math.sqrt(i*i+o*o);return a>c(j(t.size),r)?null:{node:t,datum:t.datum,x:t.x,y:t.y,distance:a}}function nr(t,e,n,r=30){if(null==t.datum)return null;const i=T(t.glyph,t.size),o=t.x+i.centerDx,a=t.y+i.centerDy,s=e-o,l=n-a,u=Math.sqrt(s*s+l*l);return u>c(i.radius,r)?null:{node:t,datum:t.datum,x:o,y:a,distance:u}}function rr(t,e,n,r=30){if(0===t.path.length)return null;const i=cr(t.path,e);if(0>i)return null;const[o,a]=t.path[i];let s;if(t.path.length>1){let r=1/0;const o=Math.max(0,i-1),a=Math.min(t.path.length-2,i);for(let i=o;a>=i;i++){const[o,a]=t.path[i],[s,l]=t.path[i+1],c=ir(e,n,o,a,s,l);r>c&&(r=c)}s=r}else{const t=e-o,r=n-a;s=Math.sqrt(t*t+r*r)}const l=t.style;return s>Math.max(5,(l.strokeWidth??l.lineWidth??1)/2+2,r)?null:{node:t,datum:Array.isArray(t.datum)&&t.datum[i]?t.datum[i]:t.datum,x:o,y:a,distance:s}}function ir(t,e,n,r,i,o){const a=i-n,s=o-r,l=a*a+s*s;if(0===l)return Math.sqrt((t-n)**2+(e-r)**2);let c=((t-n)*a+(e-r)*s)/l;return c=Math.max(0,Math.min(1,c)),Math.sqrt((t-(n+c*a))**2+(e-(r+c*s))**2)}function or(t,e,n){const r=d(e,n,t);return r.hit?{node:t,datum:t.datum,x:r.cx,y:r.cy,distance:0}:null}function ar(t,e,n){const r=d(e,n,t);return r.hit?{node:t,datum:t.datum,x:r.cx,y:r.cy,distance:0}:null}function sr(t,e,n){const r=t.bodyWidth/2,i=Math.min(t.openY,t.closeY);if(!(t.x-r-3>e||e>t.x+r+3||t.highY-3>n||n>t.lowY+3)){const r=i+Math.max(Math.max(t.openY,t.closeY)-i,1)/2,o=e-t.x,a=n-r;return{node:t,datum:t.datum,x:t.x,y:r,distance:Math.sqrt(o*o+a*a)}}return null}function lr(t,e,n){if(0===t.topPath.length)return null;const r=cr(t.topPath,e);if(0>r)return null;const[i,o]=t.topPath[r],a=e-i,s=n-o,l=Math.sqrt(a*a+s*s);return{node:t,datum:Array.isArray(t.datum)&&t.datum[r]?t.datum[r]:t.datum,x:i,y:o,distance:l}}function cr(t,e){if(0===t.length)return-1;let n=0,r=t.length-1;for(;r>n;){const i=n+r>>1;e>t[i][0]?n=i+1:r=i}return n>0&&Math.abs(t[n][0]-e)>=Math.abs(t[n-1][0]-e)?n-1:n}import{useEffect as ur,useRef as hr}from"react";var dr={fresh:1,aging:.7,stale:.45,expired:.25},fr={alpha:1,band:"fresh",isStale:!1};function yr(t,e){if(!t||0>=e)return fr;const n=null!=t.threshold&&t.threshold>0?t.threshold:5e3,r=t.graded;if(r){const t="object"==typeof r?r:{},i=H(e,n,t.thresholds);return{alpha:{...dr,...t.opacities??{}}[i],band:i,isStale:"fresh"!==i}}return e>n?{alpha:t.dimOpacity??.5,band:"stale",isStale:!0}:fr}function pr(t,e,n,r,i,o){const a=hr("fresh");ur(()=>{if(!t)return;const s=setInterval(()=>{const s=e.current;if(!s||0===s.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=yr(t,l-s.lastIngestTime);c.band===a.current&&c.isStale===i||(a.current=c.band,c.isStale!==i&&o(c.isStale),n.current=!0,r())},1e3);return()=>clearInterval(s)},[t,i,r,e,o,n])}import{jsx as gr}from"react/jsx-runtime";function mr({isStale:t,position:e}){return gr("div",{className:"stream-staleness-badge",style:{position:"absolute",..."top-left"===e?{top:4,left:4}:"bottom-left"===e?{bottom:4,left:4}:"bottom-right"===e?{bottom:4,right:4}:{top:4,right:4},padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",zIndex:3,background:t?"#dc3545":"#28a745",color:"white"},children:t?"STALE":"LIVE"})}import{useMemo as xr,useRef as br,useEffect as vr}from"react";import*as kr from"react";function wr(...t){let e;for(const n of t)n&&(e=Ar(e)&&Ar(n)?{legendGroups:[...e.legendGroups,...n.legendGroups],legendDistance:n.legendDistance??e.legendDistance}:n);return e}function Ar(t){return"object"==typeof t&&null!==t&&"legendGroups"in t&&Array.isArray(t.legendGroups)}function Mr(t){return"object"==typeof t&&null!==t&&"gradient"in t}var Sr=22;function $r(t){return Math.ceil(7*t.length)}function Pr(t,e){if(Ar(t)){const n=Rr(e),r=t.legendGroups.flatMap(t=>[t.label?$r(t.label):0,...t.items.map(t=>n.swatchSize+n.labelGap+$r(t.label))]);return Math.max(100,...r)}if(Mr(t)){const{gradient:e}=t,n=e.format||(t=>Math.round(100*t)/100+""),r=Math.max($r(n(e.domain[0])),$r(n(e.domain[1]))),i=e.label?$r(e.label):0;return Math.max(100,19+r,i)}return 100}function _r(t){return(Ar(t)||Mr(t))&&Number.isFinite(t.legendDistance)?Math.max(0,t.legendDistance):10}function Cr(t){return Math.max(0,t?.sideGutter??0)}function Lr(t,e){return null!=e?.axisGutter?Math.max(0,e.axisGutter):t?.hasAxis?t.hasAxisLabel?t.rotatedTicks?64:46:22:0}function Tr(t,e,n){if(Mr(t))return t.gradient.label?34:26;if(!Ar(t))return 20;const r=Rr(n),i=Math.max(1,n?.maxWidth??e);let o=r.rowHeight;for(const e of t.legendGroups){let t=0,n=0;for(const o of e.items){const e=r.swatchSize+r.labelGap+$r(o.label),a=0===n?e:n+r.itemGap+e;n>0&&a>i?(t+=1,n=e):n=a}e.items.length>0&&(t+=1),o=Math.max(o,t*r.rowHeight,e.label?$r(e.label):0)}return o+(t.legendGroups.length>1?16:0)}function Dr(t,e){return Pr(t,e)+_r(t)+Cr(e)}function Rr(t){const e=Math.max(1,t?.swatchSize??16),n=Math.max(e,t?.rowHeight??22);return{swatchSize:e,labelGap:Math.max(0,t?.labelGap??6),itemGap:Math.max(0,t?.itemGap??10),rowHeight:n,align:"left"===t?.align?"start":"right"===t?.align?"end":t?.align??"start",maxWidth:t?.maxWidth}}function Wr(t,e){let n=24;return t.map(({hasLabel:t,itemCount:r})=>{n+=5;const i=n;let o;n+=8,t&&(n+=16,o=n,n+=8);const a=n;return n+=r*e+8,{lineY:i,labelY:o,itemsY:a,endY:n}})}import{jsx as Er,jsxs as Nr}from"react/jsx-runtime";var Or={fill:(t,e)=>Er("rect",{style:t,width:e,height:e}),line:(t,e)=>Er("line",{style:t,x1:0,y1:0,x2:e,y2:e})};function Ir(t,e,n,r,i){let o;return o="function"==typeof n?n(t):(0,Or[n])(r(t,e),i),o}function zr({swatchSize:t}){return Er("path",{d:`M${.25*t},${.55*t} L${.45*t},${.75*t} L${.8*t},${.3*t}`,fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function Fr(t,e,n){return n&&n.size>0?n.has(t.label)?1:.3:null!=e?t.label===e?1:.3:1}var Yr=(t,e,n,r,i,o,a,s,l,c,u)=>{const{type:h="fill",styleFn:d,items:f}=t,y=[];let p=0;const g=!(!e&&!n),m="isolate"===c||void 0===c&&null!=i,{swatchSize:x,labelGap:b,rowHeight:v}=u;return f.forEach((t,c)=>{const u=Ir(t,c,h,d,x),k=Fr(t,r,i),w=i&&i.size>0&&i.has(t.label);y.push(Nr("g",{transform:`translate(0,${p})`,onClick:e?()=>e(t):void 0,onMouseEnter:n?()=>n(t):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:g?s===o&&c===a?0:-1:void 0,role:g?"option":void 0,"aria-selected":g&&m?w||!1:void 0,"aria-current":g&&!m&&null!=r&&t.label===r||void 0,"aria-label":t.label,onKeyDown:g?n=>{if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),e&&e(t)),"ArrowDown"===n.key||"ArrowUp"===n.key){n.preventDefault();const t=(c+("ArrowDown"===n.key?1:-1)+f.length)%f.length;l(s,t);const e=n.currentTarget.parentElement?.children[t];e instanceof SVGElement&&e.focus()}}:void 0,onFocus:g?e=>{l(s,c),n&&n(t);const r=e.currentTarget.querySelector(".semiotic-legend-focus-ring");r&&r.setAttribute("visibility","visible")}:void 0,onBlur:g?t=>{n&&n(null);const e=t.currentTarget.querySelector(".semiotic-legend-focus-ring");e&&e.setAttribute("visibility","hidden")}:void 0,style:{cursor:g?"pointer":"default",opacity:k,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[g&&Er("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:x+b+2+7*t.label.length,height:x+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),u,w&&Er(zr,{swatchSize:x}),Er("text",{y:x/2,x:x+b,dominantBaseline:"central",fontSize:12,style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label})]},"legend-item-"+c)),p+=v}),y};function Br({config:t,orientation:e="vertical",width:n=100}){const{colorFn:r,domain:i,label:o,format:a}=t,s=a||(t=>Math.round(100*t)/100+""),l="grad-legend-"+kr.useId();if("horizontal"===e){const t=12,e=Math.min(n,200),a=Math.max(0,(n-e)/2),c=[];for(let t=0;64>=t;t++){const e=t/64;c.push(Er("stop",{offset:100*e+"%",stopColor:r(i[0]+e*(i[1]-i[0]))},t))}return Nr("g",{"aria-label":o||"Gradient legend",children:[Er("defs",{children:Er("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),o&&Er("text",{x:a+e/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:o}),Er("rect",{x:a,y:0,width:e,height:t,fill:`url(#${l})`,rx:2}),Er("text",{x:a,y:t+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:s(i[0])}),Er("text",{x:a+e,y:t+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:s(i[1])})]})}const c=[];for(let t=0;64>=t;t++){const e=t/64;c.push(Er("stop",{offset:100*e+"%",stopColor:r(i[1]-e*(i[1]-i[0]))},t))}return Nr("g",{"aria-label":o||"Gradient legend",children:[o&&Er("text",{x:0,y:-6,textAnchor:"start",fontSize:11,fill:"var(--semiotic-text, #333)",children:o}),Er("defs",{children:Er("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:c})}),Er("rect",{x:0,y:0,width:14,height:100,fill:`url(#${l})`,rx:2}),Er("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:s(i[1])}),Er("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:s(i[0])})]})}function jr(t){const{legendGroups:e,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:o,legendInteraction:a,title:s="Legend",width:l=100,height:c=20,orientation:u="vertical",legendLayout:h}=t,d=Rr(h),[f,y]=kr.useState(0),[p,g]=kr.useState(0),m=kr.useCallback((t,e)=>{y(t),g(e)},[]),x="vertical"===u?(({legendGroups:t,width:e,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:o,focusedGroupIndex:a,focusedItemIndex:s,onFocusedIndexChange:l,legendInteraction:c,metrics:u})=>{const h=[],d=Wr(t.map(t=>({hasLabel:!!t.label,itemCount:t.items.length})),u.rowHeight);return t.forEach((t,f)=>{const y=d[f];h.push(Er("line",{stroke:"gray",x1:0,y1:y.lineY,x2:e,y2:y.lineY},"legend-top-line legend-symbol-"+f)),t.label&&null!=y.labelY&&h.push(Er("text",{y:y.labelY,className:"legend-group-label",fontSize:12,style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label},"legend-text-"+f)),h.push(Er("g",{className:"legend-item",transform:`translate(0,${y.itemsY})`,children:Yr(t,n,r,i,o,a,s,f,l,c,u)},"legend-group-"+f))}),h})({legendGroups:e||[],width:l,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:o,focusedGroupIndex:f,focusedItemIndex:p,onFocusedIndexChange:m,legendInteraction:a,metrics:d}):(({legendGroups:t,height:e,width:n,customClickBehavior:r,customHoverBehavior:i,highlightedCategory:o,isolatedCategories:a,focusedGroupIndex:s,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u,metrics:h})=>{let d=0;const f=[];t.forEach((t,e)=>{let y=0;t.label&&(y+=16);const p=((t,e,n,r,i,o,a,s,l,c,u,h)=>{const{type:d="fill",styleFn:f,items:y}=t,p=[],{swatchSize:g,labelGap:m,itemGap:x,rowHeight:b,align:v}=u,k=!(!e&&!n),w="isolate"===c||void 0===c&&null!=i,A=y.map(t=>g+m+7*t.label.length),M=[];let S=0,$=0;A.forEach((t,e)=>{const n=0===$?t:$+x+t;h&&h>0&&$>0&&n>h?(M.push({start:S,end:e,width:$}),S=e,$=t):$=n}),y.length>0&&M.push({start:S,end:y.length,width:$}),M.forEach((t,c)=>{let u="center"===v?Math.max(0,((h??t.width)-t.width)/2):"end"===v?Math.max(0,(h??t.width)-t.width):0;for(let h=t.start;t.end>h;h++){const t=y[h],v=Ir(t,h,d,f,g),M=Fr(t,r,i),S=i&&i.size>0&&i.has(t.label);p.push(Nr("g",{transform:`translate(${u},${c*b})`,onClick:e?()=>e(t):void 0,onMouseEnter:n?()=>n(t):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:k?s===o&&h===a?0:-1:void 0,role:k?"option":void 0,"aria-selected":k&&w?S||!1:void 0,"aria-current":k&&!w&&null!=r&&t.label===r||void 0,"aria-label":t.label,onKeyDown:k?n=>{if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),e&&e(t)),"ArrowRight"===n.key||"ArrowLeft"===n.key){n.preventDefault();const t=(h+("ArrowRight"===n.key?1:-1)+y.length)%y.length;l(s,t);const e=n.currentTarget.parentElement?.children[t];e instanceof SVGElement&&e.focus()}}:void 0,onFocus:k?e=>{l(s,h),n&&n(t);const r=e.currentTarget.querySelector(".semiotic-legend-focus-ring");r&&r.setAttribute("visibility","visible")}:void 0,onBlur:k?t=>{n&&n(null);const e=t.currentTarget.querySelector(".semiotic-legend-focus-ring");e&&e.setAttribute("visibility","hidden")}:void 0,style:{cursor:k?"pointer":"default",opacity:M,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[k&&Er("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:g+m+2+7*t.label.length,height:g+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),v,S&&Er(zr,{swatchSize:g}),Er("text",{y:g/2,x:g+m,dominantBaseline:"central",fontSize:12,style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label})]},"legend-item-"+h)),u+=A[h]+x}});const P=Math.max(0,...M.map(t=>t.width)),_=M.length;return{items:p,offset:P,totalRows:_,totalHeight:_*b}})(t,r,i,o,a,s,l,e,c,u,h,h.maxWidth??n);y+=p.offset+5,f.push({label:t.label,...p,offset:y,totalRows:p.totalRows,totalHeight:p.totalHeight}),d+=y+12});const y=h.maxWidth??n;let p=d>y?0:"center"===h.align?Math.max(0,(y-d)/2):"end"===h.align?Math.max(0,y-d):0;const g=[];return f.forEach((n,r)=>{const i=t[r];i.label&&(g.push(Er("text",{transform:`translate(${p},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",fontSize:12,style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:i.label},"legend-text-"+r)),p+=16),g.push(Er("g",{className:"legend-item",transform:`translate(${p},0)`,children:n.items},"legend-group-"+r)),p+=n.offset+5,t[r+1]&&g.push(Er("line",{stroke:"gray",x1:p,y1:-8,x2:p,y2:(n.totalHeight||e)+0+8},"legend-top-line legend-symbol-"+r)),p+=12}),Er("g",{children:g})})({legendGroups:e||[],title:s,height:c,width:l,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:o,focusedGroupIndex:f,focusedItemIndex:p,onFocusedIndexChange:m,legendInteraction:a,metrics:d}),b=!(!n&&!r);return Nr("g",{role:b?"listbox":void 0,"aria-multiselectable":!(!b||"isolate"!==a&&(void 0!==a||null==o))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==s&&""!==s&&"vertical"===u&&Er("text",{className:"legend-title",y:16,x:l/2,textAnchor:"middle",fontSize:12,style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:s}),x]})}import{jsx as Xr}from"react/jsx-runtime";function Gr(t){const{legend:e,totalWidth:n,totalHeight:r,margin:i,legendPosition:o="right",legendLayout:a,legendHoverBehavior:s,legendClickBehavior:l,legendHighlightedCategory:c,legendIsolatedCategories:u,legendInteraction:h}=t;if(!e)return null;const d="top"===o||"bottom"===o,f=Math.max(0,n-i.left-i.right),y=Math.max(1,d?a?.maxWidth??f:Pr(e,a)),p=_r(e),g=Cr(a),m=Lr(t.axisChrome,a),x=Lr(void 0,a),b=Tr(e,f,a);let v,k;if("left"===o)v=i.left-g-y-p,k=i.top;else if("top"===o)v=i.left,k=i.top-x-p-b;else if("bottom"===o){v=i.left;const t=r-i.bottom;k=Math.max(t+p,Math.min(t+m+p,r-b))}else v=n-i.right+g+p,k=i.top;return Xr("g",{transform:`translate(${v}, ${k})`,children:Mr(e)?Xr(Br,{config:e.gradient,orientation:d?"horizontal":"vertical",width:y}):Ar(e)?Xr(jr,{legendGroups:e.legendGroups,title:"",width:y,orientation:d?"horizontal":"vertical",legendLayout:a,customHoverBehavior:s,customClickBehavior:l,highlightedCategory:c,isolatedCategories:u,legendInteraction:h}):e})}import{useMemo as Hr}from"react";import{bin as Vr}from"d3-array";import{jsx as qr,jsxs as Ur}from"react/jsx-runtime";function Zr(t){return"string"==typeof t?{type:t}:t}function Kr({orient:t,config:e,values:n,scale:r,size:i,length:o}){const a=function(t){return{type:t.type,bins:t.bins??20,fill:t.fill??"#4e79a7",fillOpacity:t.fillOpacity??.5,stroke:t.stroke??"none",strokeWidth:t.strokeWidth??1}}(e),s="top"===t||"bottom"===t,l=Hr(()=>{if(0===n.length)return null;const e=r.domain(),l=i-8;if("boxplot"===a.type){const e=function(t){const e=[...t].sort((t,e)=>t-e),n=e.length;if(0===n)return null;const r=e[Math.floor(.25*n)],i=e[Math.floor(.5*n)],o=e[Math.floor(.75*n)],a=o-r;return{q1:r,median:i,q3:o,whiskerLow:Math.max(e[0],r-1.5*a),whiskerHigh:Math.min(e[n-1],o+1.5*a)}}(n);if(!e)return null;const{q1:i,median:o,q3:c,whiskerLow:u,whiskerHigh:h}=e,d=Math.min(.5*l,20),f=(l-d)/2+4;if(s){const e=r(i),n=r(c),s=r(o),l=r(u),y=r(h),p="top"===t?-1:1,g=0;return Ur("g",{"data-testid":"marginal-boxplot-"+t,children:[qr("line",{x1:l,y1:g+p*(f+d/2),x2:y,y2:g+p*(f+d/2),stroke:a.fill,strokeWidth:a.strokeWidth}),qr("line",{x1:l,y1:g+p*f,x2:l,y2:g+p*(f+d),stroke:a.fill,strokeWidth:a.strokeWidth}),qr("line",{x1:y,y1:g+p*f,x2:y,y2:g+p*(f+d),stroke:a.fill,strokeWidth:a.strokeWidth}),qr("rect",{x:Math.min(e,n),y:"top"===t?g-f-d:g+f,width:Math.abs(n-e),height:d,fill:a.fill,fillOpacity:a.fillOpacity,stroke:"none"===a.stroke?a.fill:a.stroke,strokeWidth:a.strokeWidth}),qr("line",{x1:s,y1:"top"===t?g-f-d:g+f,x2:s,y2:"top"===t?g-f:g+f+d,stroke:a.fill,strokeWidth:2})]})}{const e=r(i),n=r(c),s=r(o),l=r(u),y=r(h),p="left"===t?-1:1,g=0;return Ur("g",{"data-testid":"marginal-boxplot-"+t,children:[qr("line",{x1:g+p*(f+d/2),y1:l,x2:g+p*(f+d/2),y2:y,stroke:a.fill,strokeWidth:a.strokeWidth}),qr("line",{x1:g+p*f,y1:l,x2:g+p*(f+d),y2:l,stroke:a.fill,strokeWidth:a.strokeWidth}),qr("line",{x1:g+p*f,y1:y,x2:g+p*(f+d),y2:y,stroke:a.fill,strokeWidth:a.strokeWidth}),qr("rect",{x:"left"===t?g-f-d:g+f,y:Math.min(e,n),width:d,height:Math.abs(n-e),fill:a.fill,fillOpacity:a.fillOpacity,stroke:"none"===a.stroke?a.fill:a.stroke,strokeWidth:a.strokeWidth}),qr("line",{x1:"left"===t?g-f-d:g+f,y1:s,x2:"left"===t?g-f:g+f+d,y2:s,stroke:a.fill,strokeWidth:2})]})}}const c=Vr().domain(e).thresholds(a.bins)(n);if(0===c.length)return null;const u=tt(c.map(t=>t.length));if(0===u)return null;if("histogram"===a.type)return qr("g",{"data-testid":"marginal-histogram-"+t,children:c.map((e,n)=>{if(null==e.x0||null==e.x1)return null;const i=e.length/u*l;if(s){const o=r(e.x0),s=r(e.x1)-r(e.x0);return qr("rect",{x:o,y:"top"===t?-4-i:4,width:Math.max(s,.5),height:i,fill:a.fill,fillOpacity:a.fillOpacity,stroke:a.stroke,strokeWidth:a.strokeWidth},n)}{const o=r(e.x0),s=r(e.x1)-r(e.x0);return qr("rect",{x:"left"===t?-4-i:4,y:Math.min(o,o+s),width:i,height:Math.abs(s),fill:a.fill,fillOpacity:a.fillOpacity,stroke:a.stroke,strokeWidth:a.strokeWidth},n)}})});if("violin"===a.type){const e=l/2+4,n=[];for(const i of c){if(null==i.x0||null==i.x1)continue;const o=i.length/u*(l/2),a=r((i.x0+i.x1)/2);n.push(s?`${a},${"top"===t?-(e-o):e-o}`:`${"left"===t?-(e-o):e-o},${a}`)}for(let i=c.length-1;i>=0;i--){const o=c[i];if(null==o.x0||null==o.x1)continue;const a=o.length/u*(l/2),h=r((o.x0+o.x1)/2);n.push(s?`${h},${"top"===t?-(e+a):e+a}`:`${"left"===t?-(e+a):e+a},${h}`)}return qr("g",{"data-testid":"marginal-violin-"+t,children:qr("polygon",{points:n.join(" "),fill:a.fill,fillOpacity:a.fillOpacity,stroke:"none"===a.stroke?a.fill:a.stroke,strokeWidth:a.strokeWidth})})}if("ridgeline"===a.type){const e=[];if(s){const n=0,i=null!=c[0].x0?r(c[0].x0):0;e.push(`M${i},${n}`);for(const n of c){if(null==n.x0||null==n.x1)continue;const i=n.length/u*l,o=r((n.x0+n.x1)/2);e.push(`L${o},${"top"===t?-i-4:i+4}`)}const a=null!=c[c.length-1].x1?r(c[c.length-1].x1):o;e.push(`L${a},${n}`),e.push("Z")}else{const n=0,i=null!=c[0].x0?r(c[0].x0):0;e.push(`M${n},${i}`);for(const n of c){if(null==n.x0||null==n.x1)continue;const i=n.length/u*l,o=r((n.x0+n.x1)/2);e.push(`L${"left"===t?-i-4:i+4},${o}`)}const a=null!=c[c.length-1].x1?r(c[c.length-1].x1):o;e.push(`L${n},${a}`),e.push("Z")}return qr("g",{"data-testid":"marginal-ridgeline-"+t,children:qr("path",{d:e.join(" "),fill:a.fill,fillOpacity:a.fillOpacity,stroke:"none"===a.stroke?a.fill:a.stroke,strokeWidth:a.strokeWidth})})}return null},[n,r,a,i,o,t,s,4]);return l?qr("g",{className:"marginal-"+t,"data-testid":"marginal-"+t,children:l}):null}import*as Jr from"react";import{jsx as Qr,jsxs as ti}from"react/jsx-runtime";function ei(t,e=120,n=8){if(!t)return[];const r=Math.max(1,Math.floor(e/n)),i=t.split(/\s+/),o=[];let a="";for(const t of i)a&&a.length+1+t.length>r?(o.push(a),a=t):a=a?`${a} ${t}`:t;return a&&o.push(a),o}function ni(t,e,n,r){return"curly"===t?r?`M0,0 C${.6*n},0 ${.4*n},${e/2} ${n},${e/2} C${.4*n},${e/2} ${.6*n},${e} 0,${e}`:`M0,0 C0,${.6*n} ${e/2},${.4*n} ${e/2},${n} C${e/2},${.4*n} ${e},${.6*n} ${e},0`:r?`M0,0 L${n},0 L${n},${e} L0,${e}`:`M0,0 L0,${n} L${e},${n} L${e},0`}function ri(t,e,n,r){if(!t)return Qr("g",{className:"annotation-note"});const{label:i,title:o,orientation:a,align:s,wrap:l=120,noWrap:c}=t;if(!i&&!o)return Qr("g",{className:"annotation-note"});let u=a;u||(u=Math.abs(e)>Math.abs(n)?"leftRight":"topBottom");let h=s;h&&"dynamic"!==h||(h="topBottom"===u?0>e?"right":"left":0>n?"bottom":"top");let d="start";"topBottom"===u?"right"===h?d="end":"middle"===h&&(d="middle"):d=0>e?"end":"start";const f=16,y=o?c?[o]:ei(o,l):[],p=i?c?[i]:ei(i,l):[],g="leftRight"===u?"end"===d?-4:4:0;let m=0;const x=[],b=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";t.useHTML||t.html?x.push(Qr("foreignObject",{className:"annotation-note-html",x:"end"===d?g-l:"middle"===d?g-l/2:g,y:-16,width:l,height:Math.max(f,(y.length+p.length)*f+(o&&i?2:0))+f,style:{overflow:"visible"},children:ti("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{color:b,fontSize:"12px",lineHeight:"16px",overflow:"visible",textAlign:"end"===d?"right":"middle"===d?"center":"left",whiteSpace:c?"nowrap":"normal",wordBreak:"break-word"},children:[o&&Qr("div",{className:"annotation-note-title",style:{fontWeight:"bold"},children:o}),i&&Qr("div",{className:"annotation-note-label",children:i})]})},"annotation-note-html")):(y.length>0&&(x.push(Qr("text",{className:"annotation-note-title",fill:b,textAnchor:d,fontWeight:"bold",children:y.map((t,e)=>Qr("tspan",{x:g,dy:0===e?0:f,children:t},e))},"annotation-note-title")),m=y.length*f),p.length>0&&x.push(Qr("text",{className:"annotation-note-label",fill:b,textAnchor:d,y:m,children:p.map((t,e)=>Qr("tspan",{x:g,dy:0===e?0:f,children:t},e))},"annotation-note-label")));let v=null;if((o||i)&&(0!==e||0!==n))if("topBottom"===u){const t=Math.min(l,120);let e=0,n=t;"end"===d?(e=-t,n=0):"middle"===d&&(e=-t/2,n=t/2),v=Qr("line",{className:"note-line",x1:e,x2:n,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(y.length+p.length)*f+(p.length>0?f:0);let e=0,n=t;"bottom"===h?(e=-t,n=0):"middle"===h&&(e=-t/2,n=t/2),v=Qr("line",{className:"note-line",x1:0,x2:0,y1:e,y2:n,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const k=Math.max(0,y.length+p.length-1)*f;let w=0;return"topBottom"===u?w=0>n?-(k+2):18:"leftRight"===u&&(w="middle"===h?-(k+f+(p.length>0&&y.length>0?2:0))/2+8:"bottom"===h||0>n?-(k+2):18),ti("g",{className:"annotation-note",transform:`translate(${e},${n})`,children:[Qr("g",{className:"annotation-note-content",transform:0!==w?`translate(0,${w})`:void 0,children:x}),v]})}function ii(t,e,n,r,i){const o=[];switch(t){case"callout-circle":{const t=(e?.radius||0)+(e?.radiusPadding||0);t>0&&o.push(Qr("circle",{r:t,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const t=e?.width||0,r=e?.height||0;(t>0||r>0)&&o.push(Qr("rect",{width:t,height:r,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":e?.custom&&o.push(...Array.isArray(e.custom)?e.custom:[e.custom]);break;case"xy-threshold":{const t=r||0,a=i||0;if(void 0!==e?.x){const r=(e.x||0)-t;o.push(Qr("line",{x1:r,y1:(e.y1||0)-a,x2:r,y2:(e.y2||0)-a,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==e?.y){const r=(e.y||0)-a;o.push(Qr("line",{x1:(e.x1||0)-t,y1:r,x2:(e.x2||0)-t,y2:r,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==e?.x1||void 0!==e?.x2?o.push(Qr("line",{x1:(e.x1||0)-t,y1:0,x2:(e.x2||0)-t,y2:0,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===e?.y1&&void 0===e?.y2||o.push(Qr("line",{x1:0,y1:(e.y1||0)-a,x2:0,y2:(e.y2||0)-a,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const t=e?.type||"curly",r=e?.width??e?.height;void 0!==r&&o.push(Qr("path",{d:ni(t,r,e?.depth||30,void 0===e?.width),fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return Qr("g",{className:"annotation-subject",children:o})}function oi(t,e,n,r,i,o){const a=[];let s=0,l=0;if("callout-circle"!==i&&"label"!==i||!o?.radius){if("callout-rect"===i&&o){const n=o.width||0,r=o.height||0;if(n>0||r>0){const i=n/2,o=r/2,a=t-i,c=e-o;if(0!==a||0!==c){const t=Math.abs(a),e=Math.abs(c),u=n/2,h=r/2,d=t*h>e*u?u/t:h/e;s=i+a*d,l=o+c*d}}}else if("bracket"===i&&o){const t=o.width,e=o.height,n=o.depth||30;void 0!==t?(s=t/2,l=n):void 0!==e&&(s=n,l=e/2)}}else{const n=(o.radius||0)+(o.radiusPadding||0);if(n>0&&(0!==t||0!==e)){const r=Math.atan2(e,t);s=Math.cos(r)*n,l=Math.sin(r)*n}}const c=Math.sqrt((t-s)**2+(e-l)**2);if(c>.5){const i=r||"var(--semiotic-text-secondary, currentColor)",o="curve"===n?.type;let u=Math.atan2(e-l,t-s);if(o){const r=(s+t)/2,o=(l+e)/2,h=-(e-l)/c,d=(t-s)/c,f=(n?.curve??.25)*c,y=r+h*f,p=o+d*f;a.push(Qr("path",{className:"connector-curve",d:`M${s},${l}Q${y},${p} ${t},${e}`,fill:"none",stroke:i},"connector-line")),u=Math.atan2(p-l,y-s)}else a.push(Qr("line",{x1:s,y1:l,x2:t,y2:e,stroke:i},"connector-line"));if("arrow"===n?.end){const t=10,e=16/180*Math.PI;a.push(Qr("path",{d:`M${s},${l}L${s+t*Math.cos(u+e)},${l+t*Math.sin(u+e)}L${s+t*Math.cos(u-e)},${l+t*Math.sin(u-e)}Z`,fill:i,stroke:"none"},"connector-arrow"))}}return Qr("g",{className:"annotation-connector",children:a})}function ai(t){const{x:e=0,y:n=0,dx:r,dy:i,nx:o,ny:a,note:s,connector:l,subject:c,type:u,color:h,className:d,disable:f,opacity:y,strokeDasharray:p,events:g={},"data-testid":m}=t,x=Array.isArray(e)?e[0]??0:e,b=Array.isArray(n)?n[0]??0:n,v=new Set(Array.isArray(f)?f:[]);let k=r||0,w=i||0;null!=o&&(k=o-x),null!=a&&(w=a-b);const A="string"==typeof u?u:"label";if("bracket"===A&&c&&0===k&&0===w)if(void 0!==c.width){k=c.width/2;const t=c.depth||30;w=t+(0>t?-5:5)}else if(void 0!==c.height){const t=c.depth||30;k=t+(0>t?-5:5),w=c.height/2}return ti("g",{className:("annotation "+(d||"")).trim(),transform:`translate(${x},${b})`,"data-testid":m,...null!=y&&{opacity:y},...p&&{strokeDasharray:p},...g,children:[!v.has("connector")&&oi(k,w,l,h,A,c),!v.has("subject")&&ii(A,c,h,x,b),!v.has("note")&&ri(s,k,w,h)]})}function si(t){const{noteData:e}=t,{screenCoordinates:n}=e,r="string"==typeof e.type?e.type:"label",i=e.eventListeners||e.events||{};if(e.coordinates&&n){const t=e.nx||n[0][0]+(e.dx??0),i=e.ny||n[0][1]+(e.dy??0),o=n.map((n,o)=>{const a=Object.assign({},e,{note:0===o?e.note:{label:""},x:n[0],y:n[1],nx:t,ny:i});return Qr(ai,{"data-testid":"semiotic-annotation",...a,type:r},"multi-annotation-"+o)});return Qr("g",{children:o})}const o=e.note||{title:"none",label:e.label},a=`${o.label}-${o.title}-${e.i}`;return Qr(ai,{"data-testid":"semiotic-annotation",events:i,...e,type:r},a)}import{packEnclose as li}from"d3-hierarchy";import{area as ci,curveLinear as ui,curveMonotoneX as hi,curveMonotoneY as di,curveStep as fi,curveStepAfter as yi,curveStepBefore as pi,curveBasis as gi,curveCardinal as mi,curveCatmullRom as xi}from"d3-shape";function bi(t){return Math.round(100*t)/100}function vi(t,e=2){const n=[],r=[],i=e+1;for(let e=0;i>e;e++){let o=0;for(const[n,r]of t)null!==r&&(o+=n**e*r);n.push(o);const a=[];for(let n=0;i>n;n++){let r=0;for(const[i,o]of t)null!==o&&(r+=i**(e+n));a.push(r)}r.push(a)}r.push(n);const o=function(t,e){const n=t,r=t.length-1,i=[e];for(let t=0;r>t;t++){let e=t;for(let i=t+1;r>i;i++)Math.abs(n[t][i])>Math.abs(n[t][e])&&(e=i);for(let i=t;r+1>i;i++){const r=n[i][t];n[i][t]=n[i][e],n[i][e]=r}for(let e=t+1;r>e;e++)for(let i=r;i>=t;i--)n[i][e]-=n[i][t]*n[t][e]/n[t][t]}for(let t=r-1;t>=0;t--){let e=0;for(let o=t+1;r>o;o++)e+=n[o][t]*i[o];i[t]=(n[r][t]-e)/n[t][t]}return i}(r,i).map(bi);return{points:t.map(([t])=>[bi(t),bi(o.reduce((e,n,r)=>e+n*t**r,0))]),equation:[...o].reverse()}}function ki(t){const e=t.length;let n=0,r=0,i=0,o=0;for(const[e,a]of t)n+=e,r+=a,i+=e*e,o+=e*a;const a=e*i-n*n;if(1e-12>Math.abs(a))return null;const s=(e*o-n*r)/a,l=(r-s*n)/e;return t=>l+s*t}function wi(t,e){const n=t.length,r=t.map(([t,n])=>n-e(t)).reduce((t,e)=>t+e*e,0),i=Math.sqrt(r/Math.max(n-2,1)),o=t.reduce((t,e)=>t+e[0],0)/n,a=t.reduce((t,e)=>t+(e[0]-o)**2,0);return{se:i,meanX:o,ssX:a}}function Ai(t){return.99>t?.95>t?.9>t?1:1.645:1.96:2.576}import{jsx as Mi}from"react/jsx-runtime";var Si={secondary:0,primary:3},$i=".annotation-deferred{opacity:0;pointer-events:none;transition:opacity .12s ease}.stream-xy-frame:hover .annotation-deferred,.stream-ordinal-frame:hover .annotation-deferred,.stream-network-frame:hover .annotation-deferred,.stream-geo-frame:hover .annotation-deferred,.stream-xy-frame:focus-within .annotation-deferred,.stream-ordinal-frame:focus-within .annotation-deferred,.stream-network-frame:focus-within .annotation-deferred,.stream-geo-frame:focus-within .annotation-deferred{opacity:1;pointer-events:auto}@media (prefers-reduced-motion:reduce){.annotation-deferred{transition:none}}";function Pi(t){return!0===t?._annotationDeferred}function _i(t){return"blended"===t?.cohesion||"layer"===t?.cohesion?t.cohesion:null}function Ci(t){const e=t?.provenance?.confidence;return"number"==typeof e&&Number.isFinite(e)?Math.max(0,Math.min(1,e)):null}function Li(t){return Math.max(.72,.95-.06*t)}import{jsx as Ti,jsxs as Di}from"react/jsx-runtime";var Ri="var(--semiotic-bg, #ffffff)";function Wi(t){const{x:e,y:n,text:r,fill:i,fontSize:o=12,fontWeight:a,fontFamily:s,textAnchor:l="start",dominantBaseline:c,background:u,className:h}=t,d=function(t){return void 0===t||!0===t||"halo"===t?{type:"halo"}:!1===t||"none"===t?null:"box"===t?{type:"box"}:{type:t.type??"halo",...t}}(u),f=t=>Ti("text",{x:e,y:n,textAnchor:l,dominantBaseline:c,fill:i,fontSize:o,fontWeight:a,fontFamily:s,className:h,...t?{stroke:t.stroke,strokeWidth:t.strokeWidth,paintOrder:"stroke"}:{},children:r});if(!d)return f();if("halo"===d.type)return f({stroke:d.fill??Ri,strokeWidth:d.haloWidth??3});const y=d.padding??{x:6,y:3},p="number"==typeof y?y:y.x,g="number"==typeof y?y:y.y,m=function(t,e){return(t+"").length*e*.6}(r,o),x=o+2*g;let b,v;return b="middle"===l?e-m/2-p:"end"===l?e-m-p:e-p,v="middle"===c||"central"===c?n-x/2:"hanging"===c||"text-before-edge"===c?n-g:n-.8*o-g,Di("g",{className:h,children:[Ti("rect",{x:b,y:v,width:m+2*p,height:x,rx:d.radius??3,ry:d.radius??3,fill:d.fill??Ri,fillOpacity:d.opacity??.85,stroke:d.stroke,strokeWidth:d.strokeWidth}),f()]})}import{jsx as Ei,jsxs as Ni}from"react/jsx-runtime";var Oi={linear:ui,monotoneX:hi,monotoneY:di,step:fi,stepAfter:yi,stepBefore:pi,basis:gi,cardinal:mi,catmullRom:xi};function Ii(t,e,n,r){const i=[];return t.forEach((t,o)=>{let a;if(n){const i=n(t,o,r);a=null!=i?i:e(t,o,r)}else a=e(t,o,r);a&&i.push({node:a,annotation:t})}),function(t){const e=t.map((t,e)=>{return{p:t,i:e,emphasis:(n=t.annotation,"primary"===n?.emphasis||"secondary"===n?.emphasis?n.emphasis:null),confidence:Ci(t.annotation),readingOrder:null,rank:1};var n}),n=e.some(t=>null!=t.emphasis||null!=t.confidence),r=t.some(t=>Pi(t.annotation)),i=t.some(t=>null!=_i(t.annotation)),o=t.some(t=>"layer"===_i(t.annotation));if(!n&&!r&&!i)return t.map(t=>t.node);const a=e.filter(t=>null==t.emphasis&&null!=t.confidence).slice().sort((t,e)=>(e.confidence??0)-(t.confidence??0)||t.i-e.i);a.forEach((t,e)=>{t.readingOrder=e,t.rank=2-e/Math.max(1,a.length)});for(const t of e)t.emphasis&&(t.rank=Si[t.emphasis]);const s=e.sort((t,e)=>t.rank-e.rank||t.i-e.i).map(t=>{const{p:e,i:n,emphasis:r,readingOrder:i}=t,o=Pi(e.annotation);let a=e.node;if("primary"===r||"secondary"===r||null!=i){const t=null==r&&null!=i;a=Mi("g",{className:t?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+r,..."secondary"===r?{opacity:.6,fontSize:"0.88em"}:{},...t?{opacity:Li(i),"data-annotation-reading-order":i}:{},children:e.node},"annotation-emphasis-"+n)}const s=_i(e.annotation);return s&&(a=Mi("g",{className:"annotation-cohesion--"+s,children:a},"annotation-cohesion-"+n)),o&&(a=Mi("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:a},"annotation-deferred-"+n)),a});return r&&s.unshift(Mi("style",{children:$i},"annotation-disclosure-style")),o&&s.unshift(Mi("style",{children:".annotation-cohesion--layer text,.annotation-cohesion--layer tspan{fill:var(--semiotic-annotation-color,var(--semiotic-text-secondary,#666));font-style:italic}"},"annotation-cohesion-style")),s}(i)}function zi(t,e={}){return function(t,n,r){switch(t.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const e=E(t,n,r);if(!e)return null;const{x:i,y:o}=e;if(!R(i,o,r))return null;const a="callout"===t.type?"callout-circle":t.type,s="callout-circle"===a?{radius:t.radius??12,radiusPadding:t.radiusPadding}:"callout-rect"===a?{width:t.width,height:t.height}:void 0;return Ei(si,{noteData:{x:i,y:o,dx:t.dx??30,dy:t.dy??-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:a,...s?{subject:s}:{},connector:t.connector||{end:"arrow"},color:t.color,disable:t.disable,opacity:t.opacity,strokeDasharray:t.strokeDasharray,className:t.className}},"ann-"+n)}case"x-threshold":{const e=O(null!=t.value?{...t,x:t.value}:t,r);if(null==e)return null;const i=t.color||"#f97316",o=t.labelPosition||"top";let a;a="bottom"===o?(r.height||0)-4:"center"===o?(r.height||0)/2:16;const s=e>.6*(r.width||0),l=s?e-4:e+4,c=s?"end":"start";return Ni("g",{opacity:t.opacity,children:[Ei("line",{x1:e,y1:0,x2:e,y2:r.height||0,stroke:i,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&Ei(Wi,{x:l,y:a,text:t.label,textAnchor:c,fill:i,fontSize:12,fontWeight:"bold",background:t.labelBackground??"halo"})]},"ann-"+n)}case"y-threshold":{const e=I(null!=t.value?{...t,y:t.value}:t,r);if(null==e)return null;const i=t.color||"#f97316",o=t.labelPosition||"right";let a,l;"left"===o?(a=4,l="start"):"center"===o?(a=(r.width||0)/2,l="middle"):(a=(r.width||0)-4,l="end");const c=20>(s=e)?Math.min((r.height||0)-4,s+16):s-4;return Ni("g",{opacity:t.opacity,children:[Ei("line",{x1:0,y1:e,x2:r.width||0,y2:e,stroke:i,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&Ei(Wi,{x:a,y:c,text:t.label,textAnchor:l,fill:i,fontSize:12,fontWeight:"bold",background:t.labelBackground??"halo"})]},"ann-"+n)}case"enclose":{const e=(t.coordinates||[]).map(t=>({x:O({...t,type:"point"},r),y:I({...t,type:"point"},r),r:1})).filter(t=>null!=t.x&&null!=t.y);if(2>e.length)return null;const i=li(e),o=t.padding||10;return Ni("g",{children:[Ei("circle",{cx:i.x,cy:i.y,r:i.r+o,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&Ei(Wi,{x:i.x,y:i.y-i.r-o-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:t.label,background:t.labelBackground??"none"})]},"ann-"+n)}case"rect-enclose":{const e=(t.coordinates||[]).map(t=>({x:O({...t,type:"point"},r),y:I({...t,type:"point"},r)})).filter(t=>null!=t.x&&null!=t.y);if(2>e.length)return null;const i=t.padding||10,o=e.map(t=>t.x),a=e.map(t=>t.y),[s,l]=et(o),[c,u]=et(a),h=s-i,d=l+i,f=c-i;return Ni("g",{children:[Ei("rect",{x:h,y:f,width:d-h,height:u+i-f,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&Ei(Wi,{x:(h+d)/2,y:f-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:t.label,background:t.labelBackground??"none"})]},"ann-"+n)}case"highlight":{const e=r.data||[],i="function"==typeof t.filter?e.filter(t.filter):t.field&&null!=t.value?e.filter(e=>e[t.field]===t.value):[],o={stroke:t.color||"#f97316",strokeWidth:2,fill:"none"};return Ei("g",{children:i.map((e,n)=>{const i=O(e,r),a=I(e,r);if(null==i||null==a)return null;const s="function"==typeof t.r?t.r(e):t.r||6,l="function"==typeof t.style?t.style(e):t.style||o;return Ei("circle",{cx:i,cy:a,r:s,...l},"hl-"+n)})},"ann-"+n)}case"bracket":{const e=O(t,r),i=I(t,r);return Ei(si,{noteData:{x:e??0,y:i??0,dx:t.dx||0,dy:t.dy||0,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"bracket",subject:{type:t.bracketType||"curly",width:t.width,height:t.height,depth:t.depth||30},color:t.color}},"ann-"+n)}case"trend":{const e=r.data||[];if(2>e.length)return null;const i=r.xAccessor||"x",o=r.yAccessor||"y",a="ordinal"===r.frameType,s="horizontal"===r.projection,l=a?i:null,c=a?o:null;let u;const h=[],d=new Map;if(a&&l&&c){for(const t of e){const e=t[l];if(null==e)continue;const n=e+"";d.has(n)||(d.set(n,h.length),h.push(n))}u=e.map(t=>{const e=t[l],n=t[c];if(null==e||null==n)return null;const r=d.get(e+"");return null!=r?[r,+n]:null}).filter(t=>null!==t)}else u=e.map(t=>[t[i],t[o]]).filter(t=>null!=t[0]&&null!=t[1]);if(2>u.length)return null;const f=r.scales?.x??r.scales?.time,y=r.scales?.y??r.scales?.value;if(!f||!y)return null;const p=t=>e=>{const n=Math.max(0,Math.floor(e)),r=Math.min(h.length-1,n+1),i=e-n,o=t(h[n]);return o+(t(h[r])-o)*i},g=f,m=y;let x;if(a)if(s){const t=p(m);x=(e,n)=>[g(n),t(e)]}else{const t=p(g);x=(e,n)=>[t(e),m(n)]}else x=(t,e)=>[g(t),m(e)];const b=t.method||"linear";let v;if("loess"===b)v=function(t,e=.3){const n=t.length;if(2>n)return t.slice();const r=t.slice().sort((t,e)=>t[0]-e[0]),i=r.map(t=>t[0]),o=r.map(t=>t[1]),a=Math.max(2,Math.ceil(e*n)),s=[];for(let t=0;n>t;t++){const e=i[t],r=i.map(t=>Math.abs(t-e)),l=r.slice().sort((t,e)=>t-e)[Math.min(a-1,n-1)]||1,c=[];for(let t=0;n>t;t++){const e=0===l?0:r[t]/l;c[t]=1>e?Math.pow(1-Math.pow(e,3),3):0}let u=0,h=0,d=0,f=0,y=0;for(let t=0;n>t;t++){const e=c[t];0!==e&&(u+=e,h+=e*i[t],d+=e*o[t],f+=e*i[t]*i[t],y+=e*i[t]*o[t])}if(0===u){s.push([e,o[t]]);continue}const p=u*f-h*h;if(1e-12>Math.abs(p))s.push([e,d/u]);else{const t=(u*y-h*d)/p;s.push([e,(d-t*h)/u+t*e])}}return s}(u,t.bandwidth??.3);else{const e="polynomial"===b?vi(u,t.order||2):function(t){const e=[0,0,0,0];let n=0;for(const[r,i]of t)null!==i&&(n++,e[0]+=r,e[1]+=i,e[2]+=r*r,e[3]+=r*i);const r=n*e[2]-e[0]*e[0],i=0===r?0:bi((n*e[3]-e[0]*e[1])/r),o=bi(e[1]/n-i*e[0]/n);return{points:t.map(([t])=>[bi(t),bi(i*t+o)]),equation:[i,o]}}(u);v=e.points}const k=v.map(([t,e])=>{const[n,r]=x(t,e);return`${n},${r}`}).join(" "),w=t.color||"#6366f1",A=v[v.length-1],[M,S]=x(A[0],A[1]);return Ni("g",{children:[Ei("polyline",{points:k,fill:"none",stroke:w,strokeWidth:t.strokeWidth||2,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&Ei("text",{x:M+4,y:S-4,fill:w,fontSize:11,children:t.label})]},"ann-"+n)}case"band":{const e=r.scales?.y??r.scales?.value,i=e?.domain?.(),s=t.y0??i?.[0],l=t.y1??i?.[1],c=null!=s&&e?e(s):0,u=null!=l&&e?e(l):r.height||0,h=b(t.fill,"ann-"+n,"var(--semiotic-primary, #6366f1)");return Ni("g",{opacity:t.opacity,children:[h.def&&Ei("defs",{children:h.def}),Ei("rect",{x:0,y:Math.min(c,u),width:r.width||0,height:Math.abs(u-c),fill:h.fill,fillOpacity:t.fillOpacity||.1}),t.label&&Ei(Wi,{x:(r.width||0)-4,y:(o=c,a=u,Math.max(Math.min(o,a),0)+16),textAnchor:"end",fill:t.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:t.label,background:t.labelBackground??"halo"})]},"ann-"+n)}case"x-band":{const e=r.scales?.x??r.scales?.time,i=e?.domain?.(),o=t.x0??i?.[0],a=t.x1??i?.[1],s=null!=o&&e?e(o):null,l=null!=a&&e?e(a):null;if(null==s||null==l)return null;const c=b(t.fill||t.color,"ann-"+n,"var(--semiotic-primary, #6366f1)");return Ni("g",{opacity:t.opacity,children:[c.def&&Ei("defs",{children:c.def}),Ei("rect",{x:Math.min(s,l),y:0,width:Math.abs(l-s),height:r.height||0,fill:c.fill,fillOpacity:t.fillOpacity??.1}),t.label&&Ei(Wi,{x:Math.min(s,l)+4,y:16,textAnchor:"start",fill:t.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:t.label,background:t.labelBackground??"halo"})]},"ann-"+n)}case"envelope":{const e=r.data||[];if(2>e.length)return null;const i=r.xAccessor||"x",o=r.scales?.x??r.scales?.time,a=r.scales?.y??r.scales?.value;if(!o||!a)return null;const s=t.upperAccessor||"upperBounds",l=t.lowerAccessor||"lowerBounds",c=t.filter,u=e.filter(t=>null!=t[s]&&null!=t[l]&&!(c&&!c(t))).sort((t,e)=>t[i]-e[i]);if(2>u.length)return null;const h=Oi[r.curve||"linear"]||ui,d=ci().x(t=>o(t[i])).y0(t=>a(t[l])).y1(t=>a(t[s])).curve(h)(u);if(!d)return null;const f=t.fill||"#6366f1";return Ni("g",{children:[Ei("path",{d:d,fill:f,fillOpacity:t.fillOpacity??.15,stroke:"none"}),t.label&&u.length>0&&Ei("text",{x:o(u[u.length-1][i])+4,y:a(u[u.length-1][s])-4,fill:f,fontSize:11,children:t.label})]},"ann-"+n)}case"anomaly-band":{const e=r.data||[];if(2>e.length)return null;const i=r.yAccessor||"y",o=r.scales?.x??r.scales?.time,a=r.scales?.y??r.scales?.value;if(!o||!a)return null;const s=e.map(t=>t[i]).filter(t=>null!=t&&isFinite(t));if(2>s.length)return null;const l=s.reduce((t,e)=>t+e,0)/s.length,c=s.reduce((t,e)=>t+(e-l)**2,0)/s.length,u=Math.sqrt(c),h=t.threshold??2,d=l-h*u,f=!1!==t.showBand,y=t.fill||"#6366f1",p=t.fillOpacity??.1,g=t.anomalyColor||"#ef4444",m=t.anomalyRadius??6,x=a(l+h*u),b=a(d),v=e.filter(t=>{const e=t[i];return null!=e&&Math.abs(e-l)>h*u});return Ni("g",{children:[f&&Ei("rect",{x:0,y:Math.min(x,b),width:r.width||0,height:Math.abs(b-x),fill:y,fillOpacity:p}),v.map((t,e)=>{const n=O(t,r),i=I(t,r);return null==n||null==i?null:Ei("circle",{cx:n,cy:i,r:m,fill:g,fillOpacity:.7,stroke:g,strokeWidth:1.5},"anomaly-"+e)}),t.label&&Ei("text",{x:(r.width||0)-4,y:Math.min(x,b)-4,textAnchor:"end",fill:y,fontSize:11,children:t.label})]},"ann-"+n)}case"forecast":{const e=r.data||[];if(3>e.length)return null;const i=r.xAccessor||"x",o=r.yAccessor||"y",a=r.scales?.x??r.scales?.time,s=r.scales?.y??r.scales?.value;if(!a||!s)return null;const l=e.map(t=>[t[i],t[o]]).filter(t=>null!=t[0]&&null!=t[1]&&isFinite(t[0])&&isFinite(t[1])).sort((t,e)=>t[0]-e[0]);if(3>l.length)return null;let c;if("polynomial"===(t.method||"linear")){const e=vi(l,t.order||2).equation;c=t=>e.reduce((e,n,r)=>e+n*Math.pow(t,r),0)}else{const t=ki(l);if(!t)return null;c=t}const u=l.length,{se:h,meanX:d,ssX:f}=wi(l,c),y=Ai(t.confidence??.95),p=t.steps??5,g=l[u-1][0],m=(g-l[0][0])/Math.max(u-1,1),x=[];for(let t=1;p>=t;t++)x.push(g+t*m);const b=[];for(const t of x){const e=c(t),n=h*Math.sqrt(1+1/u+(f>0?(t-d)**2/f:0))*y;b.push({x:t,yCenter:e,yUpper:e+n,yLower:e-n})}const v=`M${b.map(t=>`${a(t.x)},${s(t.yUpper)}`).join(" L")} L${b.slice().reverse().map(t=>`${a(t.x)},${s(t.yLower)}`).join(" L")} Z`,k=b.map(t=>`${a(t.x)},${s(t.yCenter)}`).join(" "),w=`${a(g)},${s(c(g))}`,A=t.strokeColor||"#6366f1";return Ni("g",{children:[Ei("path",{d:v,fill:t.fill||"#6366f1",fillOpacity:t.fillOpacity??.15,stroke:"none"}),Ei("polyline",{points:`${w} ${k}`,fill:"none",stroke:A,strokeWidth:t.strokeWidth??2,strokeDasharray:t.strokeDasharray??"6,3"}),t.label&&b.length>0&&Ei("text",{x:a(b[b.length-1].x)+4,y:s(b[b.length-1].yCenter)-4,fill:A,fontSize:11,children:t.label})]},"ann-"+n)}case"widget":{let o,a;if(null!=t.px&&null!=t.py)o=t.px,a=t.py;else{const e=E(t,n,r);if(!e)return null;o=e.x,a=e.y}if(!R(o,a,r))return null;const s=t.dx??0,l=t.dy??0,c=t.width??32,u=t.height??32,h=t.content??Ei("span",{style:{fontSize:18,cursor:"default"},title:t.label||"Info",children:"ℹ️"});return Ei("foreignObject",{x:o+s-c/2,y:a+l-u/2,width:c,height:u,style:{overflow:"visible",pointerEvents:"auto"},children:Ei("div",{...i(t,e),style:{width:c,height:u,display:"flex",alignItems:"center",justifyContent:"center"},children:h})},"ann-"+n)}case"text":{const e=E(t,n,r);if(!e)return null;const{x:i,y:o}=e,a=i+(t.dx||0),s=o+(t.dy||0),l=t.color||"var(--semiotic-text, #333)",c=Ei("text",{x:a,y:s,fill:l,fontSize:t.fontSize||11,opacity:t.opacity,strokeDasharray:t.strokeDasharray,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:t.label});return!0!==t._redundantConnector?Jr.cloneElement(c,{key:"ann-text-"+n}):Ni("g",{opacity:t.opacity,strokeDasharray:t.strokeDasharray,children:[Ei("line",{x1:i,y1:o,x2:a,y2:s,stroke:l,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),Jr.cloneElement(c,{opacity:void 0,strokeDasharray:void 0})]},"ann-text-"+n)}case"category-highlight":{const e=t.category;if(null==e)return null;const i=t=>"function"==typeof t&&"function"==typeof t.bandwidth,o=r.scales?.o,a=r.scales?.x,s=r.scales?.y,l=i(o)?o:i(a)?a:i(s)?s:null;if(!l)return null;const c=l(e+"");if(null==c)return null;const u=l.bandwidth(),h=t.color||"var(--semiotic-primary, #4589ff)",d=t.opacity??.15,f=t.label;return Ni("g",(r.projection?"vertical"===r.projection:l===a)?{children:[Ei("rect",{x:c,y:0,width:u,height:r.height||0,fill:h,fillOpacity:d}),f&&Ei(Wi,{x:c+u/2,y:16,textAnchor:"middle",fill:h,fontSize:12,fontWeight:"bold",text:f,background:t.labelBackground??"none"})]}:{children:[Ei("rect",{x:0,y:c,width:r.width||0,height:u,fill:h,fillOpacity:d}),f&&Ei(Wi,{x:12,y:c+u/2,dominantBaseline:"middle",fill:h,fontSize:12,fontWeight:"bold",text:f,background:t.labelBackground??"none"})]},"ann-"+n)}default:return null}var o,a,s}}import{useSyncExternalStore as Fi}from"react";var Yi={positions:new Map},Bi=new Set;function ji(){for(const t of Bi)t()}function Xi(t,e){const n=Yi.positions.get(t);if(n?.locked)return;if(!n||n.sourceId!==e)return;const r=new Map(Yi.positions);r.delete(t),Yi={positions:r},ji()}function Gi(t,e){const n=Yi.positions.get(t);if(!n?.locked)return;if(e&&n.sourceId!==e)return;const r=new Map(Yi.positions);r.delete(t),Yi={positions:r},ji()}function Hi(){return Yi}function Vi(t){return Bi.add(t),()=>Bi.delete(t)}var qi={positions:new Map};function Ui(){return()=>{}}function Zi(){return qi}function Ki(t,e,n){return"exact"===n?function(t,e){const n=t.domain(),r=n[0],i=n[n.length-1],o=r instanceof Date,a=r instanceof Date?r.getTime():r,s=i instanceof Date?i.getTime():i;if(2>e||a===s)return o?[new Date(a),new Date(s)]:[a,s];const l=(s-a)/(e-1),c=Array(e);for(let t=0;e>t;t++){const n=t===e-1?s:a+t*l;c[t]=o?new Date(n):n}return c}(t,e):t.ticks(e)}function Ji(t,e,n){if("edges"===t){if(e)return"start";if(n)return"end"}return"middle"}function Qi(t,e,n){if("edges"===t){if(e)return"hanging";if(n)return"auto"}return"middle"}function to(t){if(0===t.length)return{min:null,max:null};let e=1/0,n=-1/0;for(const r of t)e>r.pixel&&(e=r.pixel),r.pixel>n&&(n=r.pixel);return{min:e,max:n}}function eo(t){if(t)return"dashed"===t?"6,4":"dotted"===t?"2,4":t}function no(t,e,n){if("left"===t||"right"===t){const r="left"===t?n:0,i="left"===t?-1:1,o=Math.ceil(e/8);let a="M0,"+r;for(let t=0;o>t;t++){const n=8*(t+1);a+=`L${Math.min(8*t+4,e)},${r+4*i}`,a+=`L${Math.min(n,e)},${r}`}return a}const r="bottom"===t?0:e,i="bottom"===t?1:-1,o=Math.ceil(n/8);let a=`M${r},0`;for(let t=0;o>t;t++){const e=8*(t+1);a+=`L${r+4*i},${Math.min(8*t+4,n)}`,a+=`L${r},${Math.min(e,n)}`}return a}var ro=22;function io(t){return"string"==typeof t&&t.length>0}function oo(t,e,n=!1){const r=n?e?58:34:e?36:0;return r>t.top?{...t,top:r}:t}function ao(t,e){return oo(t,io(e))}import{Fragment as so,jsx as lo,jsxs as co}from"react/jsx-runtime";function uo(t){const{width:e,height:n,totalWidth:r,totalHeight:i,margin:o,scales:a,showAxes:s,axes:l,showGrid:c,xFormat:u,yFormat:h,axisExtent:d}=t,f=xr(()=>{if(!a)return[];const t=l?.find(t=>"bottom"===t.orient),n=t?.tickFormat||u||ho,r=Math.max(2,Math.floor(e/70)),i=t?.ticks??5,o="exact"===d?Math.max(2,i):Math.min(i,r),s=t?.tickValues??Ki(a.x,o,d),c=s.map(t=>t.valueOf()),h=s.map((t,e)=>({value:t,pixel:a.x(t),label:n(t,e,c)})),f=h.reduce((t,e)=>Math.max(t,"string"==typeof e.label?6.5*e.label.length:"number"==typeof e.label?6.5*(e.label+"").length:60),0);return fo(h,Math.max(55,f+8))},[a,l,u,e,d]),y=xr(()=>{if(!a)return[];const t=l?.find(t=>"left"===t.orient),e=t?.tickFormat||h||ho,r=Math.max(2,Math.floor(n/30)),i=t?.ticks??5,o="exact"===d?Math.max(2,i):Math.min(i,r);return fo((t?.tickValues??Ki(a.y,o,d)).map(t=>({value:t,pixel:a.y(t),label:e(t)})),22)},[a,l,h,n,d]),p=c&&a,g=s&&a;if(!p&&!g)return null;const m=l?.find(t=>"bottom"===t.orient),x=l?.find(t=>"left"===t.orient),b=g&&(!m||!1!==m.baseline),v=g&&(!x||!1!==x.baseline),k=m?.jaggedBase||!1,w=x?.jaggedBase||!1,A="var(--semiotic-border, #ccc)";return lo("svg",{width:r,height:i,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:co("g",{transform:`translate(${o.left},${o.top})`,children:[p&&(()=>{const t=eo(l?.find(t=>"bottom"===t.orient)?.gridStyle),r=eo(l?.find(t=>"left"===t.orient)?.gridStyle),i=!1!==l?.find(t=>"bottom"===t.orient)?.grid,o=!1!==l?.find(t=>"left"===t.orient)?.grid;return co("g",{className:"stream-grid",children:[i&&f.map((e,r)=>lo("line",{x1:e.pixel,y1:0,x2:e.pixel,y2:n,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:t},"xgrid-"+r)),o&&y.map((t,n)=>lo("line",{x1:0,y1:t.pixel,x2:e,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:r},"ygrid-"+n))]})})(),b&&!k&&lo("line",{x1:0,y1:n,x2:e,y2:n,stroke:A,strokeWidth:1}),k&&lo("path",{d:no("bottom",e,n),fill:"none",stroke:A,strokeWidth:1}),v&&!w&&lo("line",{x1:0,y1:0,x2:0,y2:n,stroke:A,strokeWidth:1}),w&&lo("path",{d:no("left",e,n),fill:"none",stroke:A,strokeWidth:1})]})})}function ho(t,e,n){return t instanceof Date?`${t.toLocaleString("en",{month:"short"})} ${t.getDate()}`:"number"==typeof t?Math.round(100*t)/100+"":t+""}function fo(t,e){if(2>=t.length)return t;const n=[t[0]];for(let r=1;t.length-1>r;r++)e>Math.abs(t[r].pixel-n[n.length-1].pixel)||n.push(t[r]);const r=t[t.length-1];return e>Math.abs(r.pixel-n[n.length-1].pixel)?n[n.length-1]=r:n.push(r),n}function yo(t){const{width:e,height:n,totalWidth:r,totalHeight:i,margin:o,scales:a,showAxes:s,axes:l,xLabel:c,yLabel:u,yLabelRight:h,xFormat:d,yFormat:f,axisExtent:y,showGrid:g,title:m,legend:x,legendHoverBehavior:b,legendClickBehavior:v,legendHighlightedCategory:w,legendIsolatedCategories:A,legendPosition:M="right",legendLayout:S,foregroundGraphics:P,marginalGraphics:_,xValues:C,yValues:L,annotations:T,onAnnotationActivate:D,onObservation:R,chartId:W,chartType:E,autoPlaceAnnotations:N,svgAnnotationRules:O,xAccessor:I,yAccessor:z,annotationData:F,pointNodes:Y,curve:B,underlayRendered:j,canvasObscuresUnderlay:X=!0,linkedCrosshairName:G,linkedCrosshairSourceId:H,children:q}=t,U=k({onAnnotationActivate:D,onObservation:R,chartId:W,chartType:E}),Z=Cr(S),K=x&&"left"===M&&Z>0?Z:o.left,J=x&&"right"===M&&Z>0?Z:o.right,Q=xr(()=>{if(!s||!a)return[];const t=l?.find(t=>"bottom"===t.orient),n=t?.tickFormat||d||ho,r=Math.max(2,Math.floor(e/70)),i=t?.ticks??5,o="exact"===y?Math.max(2,i):Math.min(i,r),c=t?.tickValues??Ki(a.x,o,y),u=c.map(t=>t.valueOf()),h=c.map((t,e)=>({value:t,pixel:a.x(t),label:n(t,e,u)})),f=h.reduce((t,e)=>Math.max(t,"string"==typeof e.label?6.5*e.label.length:"number"==typeof e.label?6.5*(e.label+"").length:60),0),p=t?.autoRotate?Math.max(20,Math.min(f+8,55)):Math.max(55,f+8);let g=fo(h,p);if(g.length>1&&(g=g.filter((t,e)=>0===e||t.label+""!=g[e-1].label+"")),t?.includeMax&&g.length>0&&"exact"!==y&&!t?.tickValues){const t=a.x.domain()[1],e=a.x(t),r=g[g.length-1].pixel;if(Math.abs(e-r)>1){const i=n(t,g.length,u);p>e-r&&g.length>1&&(g=g.slice(0,-1)),g.push({value:t,pixel:e,label:i})}}return g},[s,a,l,d,e,y]),tt=xr(()=>{const t=l?.find(t=>"bottom"===t.orient);if(!t?.autoRotate||1>=Q.length)return!1;const n=e/Math.max(Q.length-1,1);return Q.reduce((t,e)=>Math.max(t,"string"==typeof e.label?6.5*e.label.length:60),0)+8>n},[l,Q,e]),et=xr(()=>{if(!s||!a)return[];const t=l?.find(t=>"left"===t.orient),e=t?.tickFormat||f||ho,r=Math.max(2,Math.floor(n/30)),i=t?.ticks??5,o="exact"===y?Math.max(2,i):Math.min(i,r);let c=fo((t?.tickValues??Ki(a.y,o,y)).map(t=>({value:t,pixel:a.y(t),label:e(t)})),22);if(c.length>1&&(c=c.filter((t,e)=>0===e||t.label+""!=c[e-1].label+"")),t?.includeMax&&c.length>0&&"exact"!==y&&!t?.tickValues){const t=a.y.domain()[1],n=a.y(t),r=c[c.length-1].pixel;if(Math.abs(n-r)>1){const i=e(t);22>Math.abs(n-r)&&c.length>1&&(c=c.slice(0,-1)),c.push({value:t,pixel:n,label:i})}}return c},[s,a,l,f,n,y]),nt=xr(()=>{if(!s||!a)return[];const t=l?.find(t=>"right"===t.orient);if(!t)return[];const e=t.tickFormat||f||ho,r=Math.max(2,Math.floor(n/30)),i=t.ticks??5;return fo((t.tickValues??Ki(a.y,"exact"===y?Math.max(2,i):Math.min(i,r),y)).map(t=>({value:t,pixel:a.y(t),label:e(t)})),22)},[s,a,l,f,n,y]),rt=br(new Map),it=br(T?.length??0),ot=T?.length??0;it.current!==ot&&(it.current=ot,rt.current=new Map);const at=xr(()=>{if(!T||0===T.length)return null;const t=V(T),r=zi(0,U),i={scales:a?{x:a.x,y:a.y,time:a.x,value:a.y}:null,timeAxis:"x",xAccessor:I,yAccessor:z,width:e,height:n,data:F,frameType:"xy",pointNodes:Y,curve:B,stickyPositionCache:rt.current};return Ii(N?$({annotations:t,context:i,..."object"==typeof N?N:{}}):t,r,O,i)},[T,N,O,e,n,I,z,F,a,Y,B,U]),st=function(t){const e=Fi(t?Vi:Ui,t?Hi:Zi,t?Hi:Zi);return t?e.positions.get(t)??null:null}(G);return vr(()=>{if(!st?.locked||!G)return;const t=t=>{"Escape"===t.key&&Gi(G)};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[st?.locked,G]),s||m||x||P||_||at&&at.length>0||g||q||st?co("svg",{role:"img",width:r,height:i,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[lo("title",{children:"string"==typeof m?m:"XY Chart"}),lo("desc",{children:"string"==typeof m?m+" (XY data visualization)":"XY data visualization"}),co("g",{transform:`translate(${o.left},${o.top})`,children:[g&&a&&(!j||X)&&(()=>{const t=eo(l?.find(t=>"bottom"===t.orient)?.gridStyle),r=eo(l?.find(t=>"left"===t.orient)?.gridStyle),i=!1!==l?.find(t=>"bottom"===t.orient)?.grid,o=!1!==l?.find(t=>"left"===t.orient)?.grid;return co("g",{className:"stream-grid",children:[i&&Q.map((e,r)=>lo("line",{x1:e.pixel,y1:0,x2:e.pixel,y2:n,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:t},"xgrid-"+r)),o&&et.map((t,n)=>lo("line",{x1:0,y1:t.pixel,x2:e,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:r},"ygrid-"+n))]})})(),s&&a&&(()=>{const t=l?.find(t=>"left"===t.orient),r=l?.find(t=>"bottom"===t.orient),i=!t||!1!==t.baseline,o=!r||!1!==r.baseline,a=t?.jaggedBase||!1,s=r?.jaggedBase||!1,d=r?.landmarkTicks,f=t?.landmarkTicks,y="var(--semiotic-border, #ccc)",g="var(--semiotic-text-secondary, var(--semiotic-text, #666))",m="var(--semiotic-text, #333)",x=tt,b=x?12:18,v=n+(x?58:40),k={fontSize:"var(--semiotic-tick-font-size, 12px)"},w={fontSize:"calc(var(--semiotic-tick-font-size, 12px) + 1px)"},A={fontSize:"var(--semiotic-axis-label-font-size, 12px)"},M=r?.tickAnchor,S=t?.tickAnchor,$=to(Q),P=to(et);return co("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[co("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[(!j||X)&&o&&!s&&lo("line",{x1:0,y1:n,x2:e,y2:n,stroke:y,strokeWidth:1}),(!j||X)&&s&&lo("path",{d:no("bottom",e,n),fill:"none",stroke:y,strokeWidth:1}),Q.map((t,e)=>{const r=!!d&&("function"==typeof d?d(t.value,e):p(t.value,e>0?Q[e-1].value:void 0));return co("g",{transform:`translate(${t.pixel},${n})`,children:[lo("line",{y2:5,stroke:y,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?lo("text",{y:b,textAnchor:x?"end":Ji(M,t.pixel===$.min,t.pixel===$.max),fontWeight:r?600:400,fill:g,fontSize:r?13:12,className:"semiotic-axis-tick",style:{userSelect:"none",...r?w:k},transform:x?"rotate(-45)":void 0,children:t.label}):lo("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:lo("div",{style:{textAlign:"center",userSelect:"none",...k},children:t.label})})]},"xtick-"+e)}),c&&lo("text",{x:e/2,y:v,textAnchor:"middle",fill:m,fontSize:12,className:"semiotic-axis-label",style:{userSelect:"none",...A},children:c})]}),co("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[(!j||X)&&i&&!a&&lo("line",{x1:0,y1:0,x2:0,y2:n,stroke:y,strokeWidth:1}),(!j||X)&&a&&lo("path",{d:no("left",e,n),fill:"none",stroke:y,strokeWidth:1}),et.map((t,e)=>{const n=!!f&&("function"==typeof f?f(t.value,e):p(t.value,e>0?et[e-1].value:void 0));return co("g",{transform:`translate(0,${t.pixel})`,children:[lo("line",{x2:-5,stroke:y,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?lo("text",{x:-8,textAnchor:"end",dominantBaseline:Qi(S,t.pixel===P.min,t.pixel===P.max),fontWeight:n?600:400,fill:g,fontSize:n?13:12,className:"semiotic-axis-tick",style:{userSelect:"none",...n?w:k},children:t.label}):lo("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:lo("div",{style:{textAlign:"right",userSelect:"none",...k},children:t.label})})]},"ytick-"+e)}),(()=>{const e=t?.label||u;return e?lo("text",{x:15-K,y:n/2,textAnchor:"middle",fill:m,transform:`rotate(-90, ${15-K}, ${n/2})`,fontSize:12,className:"semiotic-axis-label",style:{userSelect:"none",...A},children:e}):null})()]}),(()=>{const t=l?.find(t=>"right"===t.orient);if(!t||0===nt.length)return null;const r=!1!==t.baseline,i=t.landmarkTicks,o=t.label||h,a=t.tickAnchor,s=to(nt);return co("g",{className:"semiotic-axis semiotic-axis-right","data-orient":"right",children:[r&&lo("line",{x1:e,y1:0,x2:e,y2:n,stroke:y,strokeWidth:1}),nt.map((t,n)=>{const r=!!i&&("function"==typeof i?i(t.value,n):p(t.value,n>0?nt[n-1].value:void 0));return co("g",{transform:`translate(${e},${t.pixel})`,children:[lo("line",{x2:5,stroke:y,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?lo("text",{x:8,textAnchor:"start",dominantBaseline:Qi(a,t.pixel===s.min,t.pixel===s.max),fontWeight:r?600:400,fill:g,fontSize:r?13:12,className:"semiotic-axis-tick",style:{userSelect:"none",...r?w:k},children:t.label}):lo("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:lo("div",{style:{textAlign:"left",userSelect:"none",...k},children:t.label})})]},"ytick-r-"+n)}),o&&lo("text",{x:e+J-15,y:n/2,textAnchor:"middle",fill:m,transform:`rotate(90, ${e+J-15}, ${n/2})`,fontSize:12,className:"semiotic-axis-label",style:{userSelect:"none",...A},children:o})]})})()]})})(),at,_&&a&&C&&L&&co(so,{children:[_.top&&lo("g",{transform:"translate(0, 0)",children:lo(Kr,{orient:"top",config:Zr(_.top),values:C,scale:a.x,size:o.top,length:e})}),_.bottom&&lo("g",{transform:`translate(0, ${n})`,children:lo(Kr,{orient:"bottom",config:Zr(_.bottom),values:C,scale:a.x,size:o.bottom,length:e})}),_.left&&lo("g",{transform:"translate(0, 0)",children:lo(Kr,{orient:"left",config:Zr(_.left),values:L,scale:a.y,size:o.left,length:n})}),_.right&&lo("g",{transform:`translate(${e}, 0)`,children:lo(Kr,{orient:"right",config:Zr(_.right),values:L,scale:a.y,size:o.right,length:n})})]}),P,st&&st.sourceId!==H&&a?.x&&(()=>{const t=a.x(st.xValue);if(null==t||0>t||t>e)return null;const r=st.locked;return lo("line",{x1:t,y1:0,x2:t,y2:n,stroke:r?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:r?1.5:1,strokeDasharray:r?"6,3":"4,4",pointerEvents:"none"})})(),q]}),m&&"string"==typeof m?lo("text",{x:r/2,y:22,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",fontSize:14,className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:m}):m?lo("foreignObject",{x:0,y:0,width:r,height:o.top,children:m}):null,Gr({legend:x,totalWidth:r,totalHeight:i,margin:o,legendPosition:M,title:m,legendLayout:S,axisChrome:{hasAxis:!!s,hasAxisLabel:!!c,rotatedTicks:tt},legendHoverBehavior:b,legendClickBehavior:v,legendHighlightedCategory:w,legendIsolatedCategories:A})]}):null}import*as po from"react";import{area as go,line as mo}from"d3-shape";function xo(t,e,n){let r=n;for(const n of e)"lesser"===n.thresholdType?n.value>t&&(r=n.color):t>n.value&&(r=n.color);return r}function bo(t,e,n,r){if(2>t.length||e.length!==t.length||0===n.length)return[];const i=[],o=(t,e,n)=>{const r=i[i.length-1];r?.color===t?r.path.push(n):i.push({color:t,path:[e,n]})};for(let i=1;t.length>i;i++){const[a,s]=t[i-1],[l,c]=t[i],u=e[i-1],h=e[i]-u,d=[0,...0===h?[]:n.map(({value:t})=>(t-u)/h).filter(t=>t>0&&1>t&&Number.isFinite(t)).sort((t,e)=>t-e).filter((t,e,n)=>0===e||t!==n[e-1]),1];for(let t=1;d.length>t;t++){const e=d[t-1],i=d[t];o(xo(u+h*((e+i)/2),n,r),[a+(l-a)*e,s+(c-s)*e],[a+(l-a)*i,s+(c-s)*i])}}return i}function vo(t){return(t.tl??0)>0||(t.tr??0)>0||(t.br??0)>0||(t.bl??0)>0}function ko(t){const e=t.cornerRadii;if(!e)return{tl:0,tr:0,br:0,bl:0};const n=Math.min(t.w,t.h)/2,r=t=>Math.max(0,Math.min(t??0,n));return{tl:r(e.tl),tr:r(e.tr),br:r(e.br),bl:r(e.bl)}}import{jsx as wo,jsxs as Ao}from"react/jsx-runtime";var Mo={innerRadius:0,outerRadius:0,startAngle:0,endAngle:0};function So(t,e="#4e79a7"){return y(t)?t.background&&"transparent"!==t.background?t.background:e:t&&"string"==typeof t?t:e}function $o(t){const e=t.replace(/[^A-Za-z0-9_-]/g,"_");return!e||/^\d/.test(e)?"s_"+e:e}function Po(t,e,n,r){const i=t.glyph;if(!i?.parts?.length||0>=t.size)return null;const o=D(i,t.size);if(0>=o.scale)return null;const a=`translate(${e},${n})${t.rotation?` rotate(${180*t.rotation/Math.PI})`:""} translate(${o.offsetX},${o.offsetY}) scale(${o.scale})`,s=t.color??("string"==typeof t.style.fill?t.style.fill:void 0),l=L(i,t.fraction??1,t.fractionStart??0,t.fractionDirection??"horizontal"),c=l?$o(r+"-clip"):void 0,u=(t.style.opacity??1)*(t._decayOpacity??1)*(t.style.fillOpacity??1),h=e=>i.parts.map((n,r)=>{const i=e?"none"===n.fill?void 0:e:N(n.fill,s,t.accent),o=e?n.stroke&&"none"!==n.stroke?e:void 0:N(n.stroke??"none",s,t.accent);return i||o?wo("path",{d:n.d,fill:i??"none",stroke:o,strokeWidth:o?n.strokeWidth??1:void 0,strokeLinecap:n.strokeLinecap,strokeLinejoin:n.strokeLinejoin,opacity:n.opacity},r):null});return Ao("g",{transform:a,opacity:1===u?void 0:u,children:[l&&c&&wo("clipPath",{id:c,children:wo("rect",{x:l.x,y:l.y,width:l.width,height:l.height})}),l&&t.ghostColor?wo("g",{children:h(t.ghostColor)}):null,l&&c?wo("g",{clipPath:`url(#${c})`,children:h()}):h()]},r)}function _o(t,e){const n=t.filter(t=>Number.isFinite(t.offset)&&(null==t.opacity||Number.isFinite(t.opacity))).map(t=>({offset:Math.max(0,Math.min(1,t.offset)),color:t.color??e,opacity:null==t.opacity?void 0:Math.max(0,Math.min(1,t.opacity))}));return 2>n.length?null:n.map((t,e)=>wo("stop",{offset:t.offset,stopColor:t.color,stopOpacity:t.opacity},e))}function Co(t,e,n){const r=B(t.symbolType,t.size,t.path);return wo("path",{d:r,transform:t.rotation?`translate(${t.x},${t.y}) rotate(${180*t.rotation/Math.PI})`:`translate(${t.x},${t.y})`,fill:t.style.fill?So(t.style.fill):"none",fillOpacity:t.style.fillOpacity,opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},`${n??""}symbol-${e}`)}import*as Lo from"react";import{arc as To}from"d3-shape";import{jsx as Do,jsxs as Ro}from"react/jsx-runtime";function Wo(t,e){switch(t.type){case"circle":{const n=t,r=y(n.style.fill)?h(n.style.fill,`net-circle-${e}-hatch`):void 0;return Ro(Lo.Fragment,{children:[r&&Do("defs",{children:r}),Do("circle",{cx:n.cx,cy:n.cy,r:n.r,fill:r?`url(#net-circle-${e}-hatch)`:So(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,fillOpacity:n.style.fillOpacity,strokeOpacity:n.style.strokeOpacity,opacity:n.style.opacity})]},"net-circle-"+e)}case"rect":{const n=t,r=y(n.style.fill)?h(n.style.fill,`net-rect-${e}-hatch`):void 0;return Ro(Lo.Fragment,{children:[r&&Do("defs",{children:r}),Do("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:r?`url(#net-rect-${e}-hatch)`:So(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,fillOpacity:n.style.fillOpacity,strokeOpacity:n.style.strokeOpacity,opacity:n.style.opacity})]},"net-rect-"+e)}case"arc":{const n=t,r=To().innerRadius(n.innerR).outerRadius(n.outerR).startAngle(n.startAngle+Math.PI/2).endAngle(n.endAngle+Math.PI/2)(Mo)||"",i=y(n.style.fill)?h(n.style.fill,`net-arc-${e}-hatch`):void 0;return Ro(Lo.Fragment,{children:[i&&Do("defs",{children:i}),Do("path",{d:r,transform:`translate(${n.cx},${n.cy})`,fill:i?`url(#net-arc-${e}-hatch)`:So(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,fillOpacity:n.style.fillOpacity,strokeOpacity:n.style.strokeOpacity,opacity:n.style.opacity})]},"net-arc-"+e)}case"symbol":{const n=t,r=B(n.symbolType,n.size,n.path);return Do("path",{d:r,transform:n.rotation?`translate(${n.cx},${n.cy}) rotate(${180*n.rotation/Math.PI})`:`translate(${n.cx},${n.cy})`,fill:n.style.fill?So(n.style.fill):"none",stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,fillOpacity:n.style.fillOpacity,strokeOpacity:n.style.strokeOpacity,opacity:n.style.opacity},"net-symbol-"+e)}case"glyph":return Po(t,t.cx,t.cy,"net-glyph-"+(t.id??e));default:return null}}function Eo(t,e){switch(t.type){case"line":return Do("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.stroke||"#999",strokeWidth:t.style.strokeWidth||1,opacity:t.style.opacity},"net-edge-"+e);case"bezier":{const n=t,r=`net-bezier-${e}-hatch`,i=y(n.style.fill)?h(n.style.fill,r):void 0;return Ro(Lo.Fragment,{children:[i&&Do("defs",{children:i}),Do("path",{d:n.pathD,fill:i?`url(#${r})`:So(n.style.fill,"#999"),fillOpacity:n.style.fillOpacity,stroke:n.style.stroke||"none",strokeWidth:n.style.strokeWidth,opacity:n.style.opacity})]},"net-edge-"+e)}case"ribbon":{const n=t,r=`net-ribbon-${e}-hatch`,i=y(n.style.fill)?h(n.style.fill,r):void 0;return Ro(Lo.Fragment,{children:[i&&Do("defs",{children:i}),Do("path",{d:n.pathD,fill:i?`url(#${r})`:So(n.style.fill,"#999"),fillOpacity:n.style.fillOpacity,stroke:n.style.stroke||"none",strokeWidth:n.style.strokeWidth,opacity:n.style.opacity})]},"net-edge-"+e)}case"curved":{const n=t;return Do("path",{d:n.pathD,fill:So(n.style.fill,"none"),stroke:n.style.stroke||"#999",strokeWidth:n.style.strokeWidth||1,opacity:n.style.opacity},"net-edge-"+e)}default:return null}}function No(t,e){return Do("text",{x:t.x,y:t.y,textAnchor:t.anchor||"middle",dominantBaseline:t.baseline||"auto",fontSize:t.fontSize||11,fontWeight:t.fontWeight,fill:t.fill||"var(--semiotic-text, #333)",stroke:t.stroke,strokeWidth:t.strokeWidth,paintOrder:t.paintOrder,children:t.text},"net-label-"+e)}import*as Oo from"react";import{jsx as Io,jsxs as zo}from"react/jsx-runtime";function Fo(t,e){switch(t.type){case"geoarea":{const n=t;if(!n.pathData)return null;const r=y(n.style.fill)?h(n.style.fill,`geoarea-${e}-hatch`):void 0;return zo(Oo.Fragment,{children:[r&&Io("defs",{children:r}),Io("path",{d:n.pathData,fill:r?`url(#geoarea-${e}-hatch)`:So(n.style.fill,"#e0e0e0"),fillOpacity:n.style.fillOpacity??1,stroke:n.style.stroke||"none",strokeWidth:n.style.strokeWidth||.5,strokeDasharray:n.style.strokeDasharray,opacity:n._decayOpacity??1})]},"geoarea-"+e)}case"point":{const n=t,r=y(n.style.fill)?h(n.style.fill,`geopoint-${e}-hatch`):void 0;return zo(Oo.Fragment,{children:[r&&Io("defs",{children:r}),Io("circle",{cx:n.x,cy:n.y,r:n.r,fill:r?`url(#geopoint-${e}-hatch)`:So(n.style.fill),fillOpacity:n.style.fillOpacity??.8,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n._decayOpacity??n.style.opacity??1})]},"point-"+e)}case"line":{const n=t;if(2>n.path.length)return null;const r="M"+n.path.map(t=>`${t[0]},${t[1]}`).join("L");return Io("path",{d:r,fill:"none",stroke:n.style.stroke||"#4e79a7",strokeWidth:n.style.strokeWidth||1.5,strokeDasharray:n.style.strokeDasharray,opacity:n.style.opacity??1},"line-"+e)}case"glyph":return Po(t,t.x,t.y,"geo-glyph-"+(t.pointId??e));default:return null}}import*as Yo from"react";import{arc as Bo}from"d3-shape";var jo=(t,e)=>({x:t*Math.cos(e),y:t*Math.sin(e)});function Xo(t){const{innerRadius:e,outerRadius:n,startAngle:r,endAngle:i}=t,o=0>=e;if(0>=(t.cornerRadius??0)||!t.roundStart&&!t.roundEnd){if(o){const t=jo(n,r),e=jo(n,i);return`M0,0 L${t.x},${t.y} A${n},${n} 0 ${i-r>Math.PI?1:0} 1 ${e.x},${e.y} Z`}const t=jo(n,r),a=jo(n,i),s=jo(e,i),l=jo(e,r),c=i-r>Math.PI?1:0;return`M${t.x},${t.y} A${n},${n} 0 ${c} 1 ${a.x},${a.y} L${s.x},${s.y} A${e},${e} 0 ${c} 0 ${l.x},${l.y} Z`}const a=Math.max(0,Math.min(t.cornerRadius??0,(n-e)/2));if(0===a)return Xo({...t,cornerRadius:0,roundStart:!1,roundEnd:!1});const s=Math.asin(Math.min(1,a/Math.max(1e-9,n-a))),l=o?0:Math.asin(Math.min(1,a/Math.max(1e-9,e+a))),c=i-r,u=t.roundStart&&t.roundEnd?c/2:c,h=!!t.roundStart&&u>s,d=!!t.roundEnd&&u>s;if(!h&&!d)return Xo({...t,cornerRadius:0,roundStart:!1,roundEnd:!1});const f=r+(h?s:0),y=i-(d?s:0),p=r+(h?l:0),g=i-(d?l:0),m=jo(n,f),x=jo(n,y),b=(n-a)*Math.cos(s),v=jo(b,r),k=jo(b,i),w=o?null:jo(e,g),A=o?null:jo(e,p),M=o?0:(e+a)*Math.cos(l),S=o?null:jo(M,r),$=o?null:jo(M,i),P=y-f>Math.PI?1:0,_=o?0:g-p>Math.PI?1:0;let C="";if(h)C+=`M${v.x},${v.y}`,C+=` A${a},${a} 0 0 1 ${m.x},${m.y}`;else{const t=jo(n,r);C+=`M${t.x},${t.y}`}if(d)C+=` A${n},${n} 0 ${P} 1 ${x.x},${x.y}`,C+=` A${a},${a} 0 0 1 ${k.x},${k.y}`;else{const t=jo(n,i);C+=` A${n},${n} 0 ${P} 1 ${t.x},${t.y}`}if(o)C+=" L0,0";else{if(d)C+=` L${$.x},${$.y}`,C+=` A${a},${a} 0 0 1 ${w.x},${w.y}`;else{const t=jo(e,i);C+=` L${t.x},${t.y}`}if(h)C+=` A${e},${e} 0 ${_} 0 ${A.x},${A.y}`,C+=` A${a},${a} 0 0 1 ${S.x},${S.y}`;else{const t=jo(e,r);C+=` A${e},${e} 0 ${_} 0 ${t.x},${t.y}`}}return C+=" Z",C}import{jsx as Go,jsxs as Ho}from"react/jsx-runtime";function Vo(t){return 1e6>t?1e4>t?1e3>t?t+"":(t/1e3).toFixed(1)+"K":(t/1e3).toFixed(0)+"K":(t/1e6).toFixed(1)+"M"}function qo(t,e){const n=t.datum;if(!n)return null;const r=[],i=n.__funnelStepLabel,o=Number(n.__funnelStepLabelX),a=Number(n.__funnelStepLabelY),s=Number(n.__funnelRowWidth);"string"!=typeof i||!Number.isFinite(o)||!Number.isFinite(a)||Number.isFinite(s)&&8.4*i.length+16>s||r.push(Go("text",{x:o,y:a+3,textAnchor:"middle",dominantBaseline:"hanging",fontSize:14,fontWeight:"bold",fill:"#fff",stroke:"rgba(0,0,0,0.6)",strokeWidth:3,paintOrder:"stroke",children:i},e+"-funnel-step"));const l=Number(n.__funnelValue),c=Number(n.__funnelValueLabelX),u=Number(n.__funnelValueLabelY),h=Number(n.__funnelBarW);if(Number.isFinite(l)&&0!==l&&Number.isFinite(c)&&Number.isFinite(u)&&h>=60){const t=Number(n.__funnelPercent);let i=!0!==n.__funnelIsFirstStep&&Number.isFinite(t)?`${Vo(l)} (${.05>Math.abs(t-Math.round(t))?Math.round(t):t.toFixed(1)}%)`:Vo(l);7.8*i.length+16>h&&(i=Vo(l)),7.8*i.length+16>h||r.push(Go("text",{x:c,y:u+22,textAnchor:"middle",dominantBaseline:"hanging",fontSize:13,fontWeight:"bold",fill:"#fff",stroke:"rgba(0,0,0,0.5)",strokeWidth:3,paintOrder:"stroke",children:i},e+"-funnel-value"))}return r.length?Go("g",{children:r},e+"-funnel-labels"):null}function Uo(t,e,n){const r=("category"in t?t.category:void 0)||("group"in t?t.group:void 0)||"",i=n=>`ord-${t.type}-${r}-${e}-${n}`,o=`ord-${t.type}-${r}-${e}`;switch(t.type){case"rect":{const e=t,n=$o(o)+"-grad",r=function(t,e){const n=t.fillGradient;if(!n||"object"!=typeof n)return null;let r=t.x,i=t.y,o=t.x,a=t.y+t.h;"bottom"===t.roundedEdge?(i=t.y+t.h,a=t.y):"right"===t.roundedEdge?(r=t.x+t.w,i=t.y,o=t.x,a=t.y):"left"===t.roundedEdge&&(r=t.x,i=t.y,o=t.x+t.w,a=t.y);const s=_o(n.stops,So(t.style.fill));return s?wo("linearGradient",{id:e,gradientUnits:"userSpaceOnUse",x1:r,y1:i,x2:o,y2:a,children:s}):null}(e,n);let i,a;if(r)a=`url(#${n})`;else if(y(e.style.fill)){const t=$o(o)+"-hatch";i=h(e.style.fill,t),a=`url(#${t})`}else a=So(e.style.fill);const s=r||i?Ho("defs",{children:[r,i]}):null;if(e.cornerRadii&&vo(e.cornerRadii)){const t=function(t){const{x:e,y:n,w:r,h:i}=t,{tl:o,tr:a,br:s,bl:l}=ko(t);let c=`M${e+o},${n}`;return c+=` L${e+r-a},${n}`,a>0&&(c+=` A${a},${a} 0 0 1 ${e+r},${n+a}`),c+=` L${e+r},${n+i-s}`,s>0&&(c+=` A${s},${s} 0 0 1 ${e+r-s},${n+i}`),c+=` L${e+l},${n+i}`,l>0&&(c+=` A${l},${l} 0 0 1 ${e},${n+i-l}`),c+=` L${e},${n+o}`,o>0&&(c+=` A${o},${o} 0 0 1 ${e+o},${n}`),c+=" Z",c}(e);return Ho(Yo.Fragment,{children:[s,Go("path",{d:t,fill:a,opacity:e.style.opacity,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth})]},o)}if(e.roundedTop&&e.roundedTop>0){const t=Math.min(e.roundedTop,e.w/2,e.h/2),{x:n,y:r,w:i,h:l}=e;let c;switch(e.roundedEdge){case"right":c=`M${n},${r} L${n+i-t},${r} A${t},${t} 0 0 1 ${n+i},${r+t} L${n+i},${r+l-t} A${t},${t} 0 0 1 ${n+i-t},${r+l} L${n},${r+l} Z`;break;case"left":c=`M${n+i},${r} L${n+t},${r} A${t},${t} 0 0 0 ${n},${r+t} L${n},${r+l-t} A${t},${t} 0 0 0 ${n+t},${r+l} L${n+i},${r+l} Z`;break;case"bottom":c=`M${n},${r} L${n+i},${r} L${n+i},${r+l-t} A${t},${t} 0 0 1 ${n+i-t},${r+l} L${n+t},${r+l} A${t},${t} 0 0 1 ${n},${r+l-t} Z`;break;default:c=`M${n},${r+l} L${n},${r+t} A${t},${t} 0 0 1 ${n+t},${r} L${n+i-t},${r} A${t},${t} 0 0 1 ${n+i},${r+t} L${n+i},${r+l} Z`}return Ho(Yo.Fragment,{children:[s,Go("path",{d:c,fill:a,opacity:e.style.opacity,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth})]},o)}return Ho(Yo.Fragment,{children:[s,Go("rect",{x:e.x,y:e.y,width:e.w,height:e.h,fill:a,opacity:e.style.opacity,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth}),qo(e,o)]},o)}case"point":{const e=t;return Go("circle",{cx:e.x,cy:e.y,r:e.r,fill:So(e.style.fill),opacity:e.style.opacity??e.style.fillOpacity??.8,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth},o)}case"symbol":return Co(t,e,n);case"glyph":return Po(t,t.x,t.y,`${n??""}ord-glyph-${t.pointId??e}`);case"wedge":{const r=t;if(r._gradientBand&&r._gradientBand.colors.length>0){const t=$o(`${n?n+"-":""}gauge-grad-${r.category||o}-${e}`),{clipPath:i,slices:a}=function(t){const e=Xo({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,cornerRadius:t.cornerRadius,roundStart:t.roundStart,roundEnd:t.roundEnd}),n=[],r=t.colors;if(r.length>0){const e=(t.endAngle-t.startAngle)/r.length;for(let i=0;r.length>i;i++)n.push({d:Xo({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle+i*e,endAngle:t.endAngle}),color:r[i]})}return{clipPath:e,slices:n}}({innerRadius:r.innerRadius,outerRadius:r.outerRadius,startAngle:r.startAngle,endAngle:r.endAngle,cornerRadius:r.cornerRadius,roundStart:r.roundedEnds?.start??!0,roundEnd:r.roundedEnds?.end??!0,colors:r._gradientBand.colors});return Ho("g",{transform:`translate(${r.cx},${r.cy})`,opacity:r.style.opacity,fillOpacity:r.style.fillOpacity,children:[Go("defs",{children:Go("clipPath",{id:t,children:Go("path",{d:i})})}),Go("g",{clipPath:`url(#${t})`,children:a.map((t,e)=>Go("path",{d:t.d,fill:So(t.color)},e))}),r.style.stroke&&"none"!==r.style.stroke&&Go("path",{d:i,fill:"none",stroke:r.style.stroke,strokeWidth:r.style.strokeWidth})]},o)}let i;if(r.roundedEnds)i=Xo({innerRadius:r.innerRadius,outerRadius:r.outerRadius,startAngle:r.startAngle,endAngle:r.endAngle,cornerRadius:r.cornerRadius,roundStart:r.roundedEnds.start,roundEnd:r.roundedEnds.end});else{const t=Bo().innerRadius(r.innerRadius).outerRadius(r.outerRadius).startAngle(r.startAngle+Math.PI/2).endAngle(r.endAngle+Math.PI/2);r.cornerRadius&&t.cornerRadius(r.cornerRadius),i=t(Mo)||""}return Go("path",{d:i,transform:`translate(${r.cx},${r.cy})`,fill:So(r.style.fill),stroke:r.style.stroke,strokeWidth:r.style.strokeWidth,opacity:r.style.opacity},o)}case"boxplot":{const e=t,n=e.columnWidth/2;return Ho("g","vertical"===e.projection?{children:[Go("line",{x1:e.x,y1:e.minPos,x2:e.x,y2:e.maxPos,stroke:e.style.stroke||"#333",strokeWidth:1}),Go("rect",{x:e.x-n,y:Math.min(e.q1Pos,e.q3Pos),width:e.columnWidth,height:Math.abs(e.q3Pos-e.q1Pos),fill:So(e.style.fill),fillOpacity:e.style.fillOpacity??.6,stroke:e.style.stroke||"#333",strokeWidth:1}),Go("line",{x1:e.x-n,y1:e.medianPos,x2:e.x+n,y2:e.medianPos,stroke:e.style.stroke||"#333",strokeWidth:2}),Go("line",{x1:e.x-.5*n,y1:e.minPos,x2:e.x+.5*n,y2:e.minPos,stroke:e.style.stroke||"#333",strokeWidth:1}),Go("line",{x1:e.x-.5*n,y1:e.maxPos,x2:e.x+.5*n,y2:e.maxPos,stroke:e.style.stroke||"#333",strokeWidth:1})]}:{children:[Go("line",{x1:e.minPos,y1:e.y,x2:e.maxPos,y2:e.y,stroke:e.style.stroke||"#333",strokeWidth:1}),Go("rect",{x:Math.min(e.q1Pos,e.q3Pos),y:e.y-n,width:Math.abs(e.q3Pos-e.q1Pos),height:e.columnWidth,fill:So(e.style.fill),fillOpacity:e.style.fillOpacity??.6,stroke:e.style.stroke||"#333",strokeWidth:1}),Go("line",{x1:e.medianPos,y1:e.y-n,x2:e.medianPos,y2:e.y+n,stroke:e.style.stroke||"#333",strokeWidth:2}),Go("line",{x1:e.minPos,y1:e.y-.5*n,x2:e.minPos,y2:e.y+.5*n,stroke:e.style.stroke||"#333",strokeWidth:1}),Go("line",{x1:e.maxPos,y1:e.y-.5*n,x2:e.maxPos,y2:e.y+.5*n,stroke:e.style.stroke||"#333",strokeWidth:1})]},o)}case"violin":{const e=t,n=[Go("path",{d:e.pathString,transform:e.translateX||e.translateY?`translate(${e.translateX},${e.translateY})`:void 0,fill:So(e.style.fill),fillOpacity:e.style.fillOpacity??.6,stroke:e.style.stroke||"#333",strokeWidth:e.style.strokeWidth||1},i("path"))];if(e.iqrLine&&e.bounds){const t=e.bounds,r=t.x+t.width/2,o=t.y+t.height/2;e.iqrLine.isVertical?n.push(Go("line",{x1:r,y1:e.iqrLine.q1Pos,x2:r,y2:e.iqrLine.q3Pos,stroke:e.style.stroke||"#333",strokeWidth:2},i("iqr")),Go("circle",{cx:r,cy:e.iqrLine.medianPos,r:3,fill:"white",stroke:e.style.stroke||"#333",strokeWidth:1},i("med"))):n.push(Go("line",{x1:e.iqrLine.q1Pos,y1:o,x2:e.iqrLine.q3Pos,y2:o,stroke:e.style.stroke||"#333",strokeWidth:2},i("iqr")),Go("circle",{cx:e.iqrLine.medianPos,cy:o,r:3,fill:"white",stroke:e.style.stroke||"#333",strokeWidth:1},i("med")))}return Go("g",{children:n},o)}case"connector":return Go("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.stroke||"#999",strokeWidth:t.style.strokeWidth||1,opacity:t.style.opacity??.5},o);case"trapezoid":{const e=t,n=e.points.map(t=>`${t[0]},${t[1]}`).join(" ");return Go("polygon",{points:n,fill:So(e.style.fill,"#999"),opacity:e.style.opacity,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth},o)}default:return null}}import{jsx as Zo,jsxs as Ko}from"react/jsx-runtime";function Jo(t,e,n,r){if(!t||2>e.length)return null;const i=_o(t.stops,r);return i?Zo("linearGradient",{id:n,gradientUnits:"userSpaceOnUse",x1:e[0][0],y1:0,x2:e[e.length-1][0],y2:0,children:i}):null}function Qo(t,e,n){switch(t.type){case"line":{const r=t;if(0===r.path.length)return null;const i=jn(r.curve),o=i?mo().x(([t])=>t).y(([,t])=>t).curve(i)(r.path)??"":"M"+r.path.map(([t,e])=>`${t},${e}`).join("L"),a=$o(`${n?n+"-":""}line-${e}-stroke-gradient`),s=Jo(r.strokeGradient,r.path,a,r.style.stroke||"#4e79a7");return Ko(po.Fragment,{children:[s&&Zo("defs",{children:s}),Zo("path",{d:o,fill:"none",stroke:s?`url(#${a})`:r.style.stroke||"#4e79a7",strokeWidth:r.style.strokeWidth||2,strokeDasharray:r.style.strokeDasharray,opacity:r.style.opacity})]},"line-"+e)}case"area":{const r=t;if(0===r.topPath.length)return null;const i=jn(r.curve),o=!i||2>r.topPath.length||2>r.bottomPath.length?`M${r.topPath.map(([t,e])=>`${t},${e}`).join("L")}L${[...r.bottomPath].reverse().map(([t,e])=>`${t},${e}`).join("L")}Z`:go().x(([t])=>t).y0((t,e)=>r.bottomPath[e][1]).y1(([,t])=>t).curve(i)(r.topPath)??"",a=`${n?n+"-":""}area-${e}-hatch`,s=y(r.style.fill)?h(r.style.fill,a):void 0,l=$o(`${n?n+"-":""}area-${e}-gradient`),c=function(t,e){const n=t.fillGradient;if(!n||"object"!=typeof n)return null;let r=1/0;for(const[,e]of t.topPath)r=Math.min(r,e);let i=-1/0;for(const[,e]of t.bottomPath)i=Math.max(i,e);if(!Number.isFinite(r)||!Number.isFinite(i))return null;const o=_o(n.stops,So(t.style.fill));return o?Zo("linearGradient",{id:e,gradientUnits:"userSpaceOnUse",x1:0,y1:r,x2:0,y2:i,children:o}):null}(r,l),u=c?`url(#${l})`:s?`url(#${a})`:So(r.style.fill),d=c?void 0:r.style.fillOpacity??r.style.opacity??.7,f=i?mo().x(([t])=>t).y(([,t])=>t).curve(i)(r.topPath)??"":"M"+r.topPath.map(([t,e])=>`${t},${e}`).join("L"),p=$o(`${n?n+"-":""}area-${e}-stroke-gradient`),g=!(!r.colorThresholds?.length||!r.rawValues||r.rawValues.length!==r.topPath.length),m=!!r.strokeColorBands?.length,x=g||m?null:Jo(r.strokeGradient,r.topPath,p,r.style.stroke||"#4e79a7"),b=r.style.strokeWidth||2;let v=1/0,k=-1/0;for(const[t]of r.topPath)v>t&&(v=t),t>k&&(k=t);const w=m?r.strokeColorBands.map((t,r)=>$o(`${n?n+"-":""}area-${e}-stroke-band-${r}`)):[],A=m?r.strokeColorBands.map((t,e)=>Zo("clipPath",{id:w[e],children:Zo("rect",{x:v-b,y:t.y,width:k-v+2*b,height:t.height})},w[e])):null,M=r.style.stroke&&"none"!==r.style.stroke?m?r.strokeColorBands.map((t,n)=>Zo("path",{d:f,fill:"none",stroke:t.color??So(r.style.stroke),strokeWidth:b,opacity:r.style.opacity,clipPath:`url(#${w[n]})`},`area-${e}-stroke-band-${n}`)):g?bo(r.topPath,r.rawValues,r.colorThresholds,So(r.style.stroke)).map((t,n)=>Zo("path",{d:"M"+t.path.map(([t,e])=>`${t},${e}`).join("L"),fill:"none",stroke:t.color,strokeWidth:b,opacity:r.style.opacity},`area-${e}-threshold-${n}`)):Zo("path",{d:f,fill:"none",stroke:x?`url(#${p})`:So(r.style.stroke),strokeWidth:b,opacity:r.style.opacity}):null;if(r.clipRect){const t=`${n?n+"-":""}area-clip-${e}`;return Ko("g",{children:[Ko("defs",{children:[c,!c&&s,x,A,Zo("clipPath",{id:t,children:Zo("rect",{x:r.clipRect.x,y:r.clipRect.y,width:r.clipRect.width,height:r.clipRect.height})})]}),Ko("g",{clipPath:`url(#${t})`,children:[Zo("path",{d:o,fill:u,fillOpacity:d,opacity:c?r.style.opacity:void 0,stroke:"none"}),M]})]},"area-"+e)}return Ko(po.Fragment,{children:[(c||s||x||A)&&Ko("defs",{children:[c,!c&&s,x,A]}),Zo("path",{d:o,fill:u,fillOpacity:d,opacity:c?r.style.opacity:void 0,stroke:"none"}),M]},"area-"+e)}case"point":{const r=t,i=`${n?n+"-":""}point-${e}-hatch`,o=y(r.style.fill)?h(r.style.fill,i):void 0;return Ko(po.Fragment,{children:[o&&Zo("defs",{children:o}),Zo("circle",{cx:r.x,cy:r.y,r:r.r,fill:o?`url(#${i})`:So(r.style.fill),opacity:r.style.opacity??r.style.fillOpacity??.8,stroke:r.style.stroke,strokeWidth:r.style.strokeWidth})]},"point-"+e)}case"symbol":return Co(t,e);case"glyph":return Po(t,t.x,t.y,`${n??""}glyph-${t.pointId??e}`);case"rect":{const r=t,i=`${n?n+"-":""}xyrect-${e}-hatch`,o=y(r.style.fill)?h(r.style.fill,i):void 0;return Ko(po.Fragment,{children:[o&&Zo("defs",{children:o}),Zo("rect",{x:r.x,y:r.y,width:r.w,height:r.h,fill:o?`url(#${i})`:So(r.style.fill),opacity:r.style.opacity,stroke:r.style.stroke,strokeWidth:r.style.strokeWidth})]},"rect-"+e)}case"heatcell":{const n=t,r={x:n.x,y:n.y,width:n.w,height:n.h,fill:n.fill,stroke:n.style?.stroke,strokeWidth:n.style?.strokeWidth,...null!=n.style?.opacity&&{opacity:n.style.opacity}};if(n.showValues&&null!=n.value&&n.w>=20&&n.h>=20){const t=n.valueFormat?n.valueFormat(n.value):Number.isInteger(n.value)?n.value+"":100>Math.abs(n.value)?1>Math.abs(n.value)?n.value.toPrecision(3):n.value.toFixed(1):n.value.toFixed(0),[i,o,a]=function(t){if(t.startsWith("#")){let e=t.slice(1);if(3===e.length&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),6===e.length)return[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16)]}const e=t.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return e?[+e[1],+e[2],+e[3]]:[128,128,128]}(n.fill),s=.299*i+.587*o+.114*a>128?"#000":"#fff",l=Math.max(10,Math.min(16,.3*Math.min(n.w,n.h)));return Ko("g",{children:[Zo("rect",{...r}),Zo("text",{x:n.x+n.w/2,y:n.y+n.h/2,textAnchor:"middle",dominantBaseline:"middle",fill:s,fontSize:l+"px",children:t})]},"heatcell-"+e)}return Zo("rect",{...r},"heatcell-"+e)}case"candlestick":{const n=t;if(n.isRange){const t=n.dotRadius??Math.max(2,n.bodyWidth/2);return Ko("g",{children:[Zo("line",{x1:n.x,y1:n.highY,x2:n.x,y2:n.lowY,stroke:n.wickColor,strokeWidth:n.wickWidth}),Zo("circle",{cx:n.x,cy:n.highY,r:t,fill:n.wickColor}),Zo("circle",{cx:n.x,cy:n.lowY,r:t,fill:n.wickColor})]},"candle-"+e)}const r=Math.min(n.openY,n.closeY),i=Math.max(Math.abs(n.openY-n.closeY),1),o=n.isUp?n.upColor:n.downColor;return Ko("g",{children:[Zo("line",{x1:n.x,y1:n.highY,x2:n.x,y2:n.lowY,stroke:n.wickColor,strokeWidth:n.wickWidth}),Zo("rect",{x:n.x-n.bodyWidth/2,y:r,width:n.bodyWidth,height:i,fill:o,stroke:o,strokeWidth:1})]},"candle-"+e)}default:return null}}var ta="undefined"==typeof window||"undefined"==typeof document;import{useEffect as ea,useLayoutEffect as na,useRef as ra,useState as ia,useSyncExternalStore as oa}from"react";var aa="undefined"!=typeof window?na:ea;function sa(){const[t,e]=ia(!1);return aa(()=>{e(!0)},[]),t}var la=()=>()=>{},ca=()=>!1,ua=()=>!0;function ha(){const t=oa(la,ca,ua);return ra(t).current}import{useRef as da}from"react";function fa(t){const e=da(t);return function(t,e){if(Object.is(t,e))return!0;if(Array.isArray(t)&&Array.isArray(e))return pa(t,e);if(!ga(t)||!ga(e))return!1;const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(const r of n){if(!Object.prototype.hasOwnProperty.call(e,r))return!1;const n=t[r],i=e[r];if(!Object.is(n,i))if(Array.isArray(n)&&Array.isArray(i)){if(!pa(n,i))return!1}else{if(!ga(n)||!ga(i))return!1;if(!ya(n,i))return!1}}return!0}(e.current,t)||(e.current=t),e.current}function ya(t,e){const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(const r of n){if(!Object.prototype.hasOwnProperty.call(e,r))return!1;if(!Object.is(t[r],e[r]))return!1}return!0}function pa(t,e){if(t.length!==e.length)return!1;for(let n=0;t.length>n;n++)if(!Object.is(t[n],e[n]))return!1;return!0}function ga(t){if(null===t||"object"!=typeof t)return!1;if(Array.isArray(t))return!1;const e=Object.getPrototypeOf(t);return e===Object.prototype||null===e}function ma(t){const{background:e,hasBackgroundGraphics:n=!1,themeBackground:r=""}=t;return"transparent"===e||n?null:e||(r&&"transparent"!==r?r:"")||null}function xa(t,e){const{background:n,hasBackgroundGraphics:r=!1,themeBackground:i="",x:o=0,y:a=0,width:s,height:l}=e,c=ma({background:n,hasBackgroundGraphics:r,themeBackground:i});if(!c)return!1;const u=it(t,c);return!!u&&(t.fillStyle=u,t.fillRect(o,a,s,l),!0)}function ba(t){return!!(t.dirtyOrRebuilt||t.transitioning||t.animationTicked||t.continuous||t.liveEncoding||t.forced)}var va={axisStroke:"#ccc",tickText:"#666",crosshair:"rgba(0, 0, 0, 0.25)",hoverFill:"rgba(255, 255, 255, 0.3)",hoverStroke:"rgba(0, 0, 0, 0.4)",pointRing:"white",primary:"#007bff",background:""};function ka(t,e){const n=t.trim();if(/^#[0-9a-f]{3}$/i.test(n)){const t=n[1],r=n[2],i=n[3];return`#${t}${t}${r}${r}${i}${i}${e}`}if(/^#[0-9a-f]{6}$/i.test(n))return`${n}${e}`;const r=n.match(/^rgb\s*\(\s*([^)]+?)\s*\)$/i);return r?`rgba(${r[1]}, ${(parseInt(e,16)/255).toFixed(3)})`:n}import*as wa from"react";import*as Aa from"react";import{jsx as Ma}from"react/jsx-runtime";var Sa=Aa.createContext(null);function $a(){return Aa.useContext(Sa)}import{jsx as Pa}from"react/jsx-runtime";var _a={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function Ca({hoverPoint:t}){let e="";if(t){const n=t.data||t;e="object"==typeof n?"Data point: "+Object.entries(n).filter(([,t])=>"object"!=typeof t&&"function"!=typeof t).map(([t,e])=>`${t}: ${e}`).join(", "):"Data point: "+n}return Pa("div",{"aria-live":"polite","aria-atomic":"true",style:_a,children:e})}import{jsx as La,jsxs as Ta}from"react/jsx-runtime";function Da(t,e){if(!t||0===t.length)return e+", empty";const n={};for(const e of t){if(null===e?.datum)continue;const t=e.type+"";n[t]=(n[t]||0)+1}if(0===Object.keys(n).length)return e+", empty";const r=[],i={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},o=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],a=Object.keys(n).sort((t,e)=>{const n=o.indexOf(t),r=o.indexOf(e);return(-1===n?999:n)-(-1===r?999:r)});for(const t of a)r.push(`${n[t]} ${i[t]||t}`);return`${e}, ${r.join(", ")}`}function Ra(t,e,n){const r=[];return t>0&&r.push(t+" nodes"),e>0&&r.push(e+" edges"),0===r.length?n+", empty":`${n}, ${r.join(", ")}`}var Wa=t=>{if(null==t)return"";const e=Math.round(100*t)/100;return Number.isNaN(e)?"":e+""},Ea="semiotic-accessible-data-table",Na=Ea+" semiotic-accessible-data-table-hidden",Oa=Ea+" semiotic-accessible-data-table-visible",Ia=Oa+" semiotic-accessible-data-table-network",za={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"},Fa={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},Ya={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)"},Ba={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},ja={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))"},Xa={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},Ga={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},Ha={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 Va({scene:t,chartType:e,tableId:n,chartTitle:r}){const[i,o]=wa.useState(!1),[a,s]=wa.useState(5),c=$a(),u=c?.visible??!1,h=i||u,d=wa.useRef(null),f=r?"Data summary for "+r:n?`Data summary for ${e} ${n}`:"Data summary for "+e;wa.useEffect(()=>{h||s(5)},[h]);const y=wa.useCallback(t=>{t.target===t.currentTarget&&(i||u||o(!0))},[i,u]),p=wa.useCallback(t=>{u||d.current?.contains(t.relatedTarget)||o(!1)},[u]);if(!t||0===t.length)return n?La("span",{id:n,tabIndex:-1,style:_a}):null;if(!h)return La("div",{id:n,className:Na,tabIndex:-1,onFocus:y,style:_a,role:"region","aria-label":f,children:Ta("button",{type:"button",onClick:()=>o(!0),children:["View data summary (",t.length," elements)"]})});const g=l(t),m=function(t){if(!t||0===t.length)return[];const e=new Set;for(const n of t)if(n&&n.values)for(const t of Object.keys(n.values))e.add(t);const n=[];for(const r of e){const e=[],i=new Set;for(const n of t){if(!n||!n.values)continue;const t=n.values[r];null!=t&&""!==t&&("number"==typeof t&&!Number.isNaN(t)&&Number.isFinite(t)?e.push(t):"number"==typeof t||"object"!=typeof t&&"function"!=typeof t&&i.add(t+""))}if(e.length>0){let t=e[0],i=e[0],o=0;for(const n of e)t>n&&(t=n),n>i&&(i=n),o+=n;n.push({name:r,count:e.length,numeric:!0,min:t,max:i,mean:o/e.length})}else if(i.size>0){const t=Array.from(i);n.push({name:r,count:t.length,numeric:!1,uniqueValues:t.slice(0,5)})}}return n}(g),x=function(t,e){const n=[t+" data points."];for(const t of e)if(t.numeric)n.push(`${t.name}: ${Wa(t.min)} to ${Wa(t.max)}, mean ${Wa(t.mean)}.`);else{const e=t.uniqueValues,r=e.length>3?`${e.slice(0,3).join(", ")}… (${t.count} unique)`:e.join(", ");n.push(`${t.name}: ${r}.`)}return n.join(" ")}(g.length,m),b=Math.min(a,g.length),v=g.slice(0,b),k=g.length-b,w=new Set;for(const t of v)for(const e of Object.keys(t.values))w.add(e);const A=Array.from(w);return Ta("div",{ref:d,id:n,className:Oa,tabIndex:-1,onBlur:p,style:za,role:"region","aria-label":f,children:[La("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{u&&c&&c.setVisible(!1),o(!1)},"aria-label":"Close data summary",style:Ya,children:"×"}),La("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:Fa,children:x}),Ta("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+e,style:Ba,children:[La("caption",{className:"semiotic-accessible-data-table-caption",style:Ga,children:k>0?`First ${b} of ${g.length} data points`:`All ${g.length} data points`}),La("thead",{children:Ta("tr",{children:[La("th",{style:ja,children:"type"}),A.map(t=>La("th",{style:ja,children:t},t))]})}),La("tbody",{children:v.map((t,e)=>Ta("tr",{children:[La("td",{style:Xa,children:t.label}),A.map(e=>{return La("td",{style:Xa,children:(n=t.values[e],null==n||""===n?"—":"number"==typeof n?Number.isNaN(n)?"—":Wa(n):"boolean"==typeof n?n?"true":"false":"object"==typeof n?"—":n+"")},e);var n})]},e))})]}),k>0&&Ta("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>s(t=>t+25),style:Ha,children:["Show ",Math.min(25,k)," more"," ",1===k?"row":"rows"," (",k," remaining)"]})]})}function qa({nodes:t,edges:e,chartType:n,tableId:r,chartTitle:i}){const[o,a]=wa.useState(!1),[s,l]=wa.useState(5),c=$a(),u=c?.visible??!1,h=o||u,d=i?"Data summary for "+i:r?`Data summary for ${n} ${r}`:"Data summary for "+n,f=wa.useRef(null);wa.useEffect(()=>{h||l(5)},[h]);const y=wa.useCallback(t=>{t.target===t.currentTarget&&(o||u||a(!0))},[o,u]),p=wa.useCallback(t=>{u||f.current?.contains(t.relatedTarget)||a(!1)},[u]);if(!t||0===t.length)return r?La("span",{id:r,tabIndex:-1,style:_a}):null;if(!h)return La("div",{id:r,className:Na,tabIndex:-1,onFocus:y,style:_a,role:"region","aria-label":d,children:Ta("button",{type:"button",onClick:()=>a(!0),children:["View data summary (",t.length," nodes, ",e.length," edges)"]})});const g=Array.isArray(t)?t:[],m=Array.isArray(e)?e:[],x=new Map,b=new Map,v=new Map,k=new Map;for(const t of m){if(!t||"object"!=typeof t)continue;const e=t.datum??{source:t.source,target:t.target},n="object"==typeof e.source?e.source?.id:e.source,r="object"==typeof e.target?e.target?.id:e.target,i="number"==typeof e.value&&Number.isFinite(e.value)?e.value:0;if(null!=n&&""!==n){const t=n+"";b.set(t,(b.get(t)??0)+1),k.set(t,(k.get(t)??0)+i)}if(null!=r&&""!==r){const t=r+"";x.set(t,(x.get(t)??0)+1),v.set(t,(v.get(t)??0)+i)}}const w=[];for(let t=0;g.length>t;t++){const e=g[t];if(!e||"object"!=typeof e)continue;const n=e.datum?.id??e.id,r=null!=n?n+"":"node-"+t,i=x.get(r)??0,o=b.get(r)??0,a=v.get(r)??0,s=k.get(r)??0;w.push({id:r,degree:i+o,inDeg:i,outDeg:o,wDegree:a+s,wInDeg:a,wOutDeg:s})}w.sort((t,e)=>e.degree-t.degree);let A=0,M=0;if(w.length>0){let t=0;for(const e of w)t+=e.degree,e.degree>M&&(M=e.degree);A=t/w.length}const S=m.some(t=>{const e=t?.datum??{source:t?.source,target:t?.target};return"number"==typeof e?.value&&Number.isFinite(e.value)}),$=[`${w.length} nodes, ${m.length} edges.`];w.length>0&&$.push(`Mean degree: ${Wa(A)}, max degree: ${M}.`);const P=Math.min(s,w.length),_=w.slice(0,P),C=w.length-P;return Ta("div",{ref:f,id:r,className:Ia,tabIndex:-1,onBlur:p,style:za,role:"region","aria-label":d,children:[La("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{u&&c&&c.setVisible(!1),a(!1)},"aria-label":"Close data summary",style:Ya,children:"×"}),La("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:Fa,children:$.join(" ")}),Ta("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Node degree summary for "+n,style:Ba,children:[La("caption",{className:"semiotic-accessible-data-table-caption",style:Ga,children:C>0?`Top ${P} of ${w.length} nodes by degree`:`All ${w.length} nodes by degree`}),La("thead",{children:Ta("tr",{children:[La("th",{style:ja,children:"id"}),La("th",{style:ja,children:"degree"}),La("th",{style:ja,children:"in"}),La("th",{style:ja,children:"out"}),S&&La("th",{style:ja,children:"w. degree"}),S&&La("th",{style:ja,children:"w. in"}),S&&La("th",{style:ja,children:"w. out"})]})}),La("tbody",{children:_.map((t,e)=>Ta("tr",{children:[La("td",{style:Xa,children:t.id}),La("td",{style:Xa,children:t.degree}),La("td",{style:Xa,children:t.inDeg}),La("td",{style:Xa,children:t.outDeg}),S&&La("td",{style:Xa,children:Wa(t.wDegree)}),S&&La("td",{style:Xa,children:Wa(t.wInDeg)}),S&&La("td",{style:Xa,children:Wa(t.wOutDeg)})]},e))})]}),C>0&&Ta("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>l(t=>t+25),style:Ha,children:["Show ",Math.min(25,C)," more"," ",1===C?"node":"nodes"," (",C," remaining)"]})]})}function Ua({summary:t}){return t?La("div",{role:"note",style:_a,children:t}):null}function Za({tableId:t}){return La("a",{href:"#"+t,style:_a,onClick:e=>{e.preventDefault();const n=document.getElementById(t);n&&requestAnimationFrame(()=>n.focus())},onFocus:t=>{Object.assign(t.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:t=>{const e=t.currentTarget;e.removeAttribute("style"),Object.assign(e.style,_a)},children:"Skip to data table"})}import{jsx as Ka}from"react/jsx-runtime";var Ja="var(--semiotic-focus, #005fcc)";function Qa({active:t,hoverPoint:e,margin:n,size:r,shape:i="circle",width:o,height:a,pathData:s}){if(!t||!e)return null;const l=e.x+n.left,c=e.y+n.top;let u;if("geoarea"!==i&&"path"!==i||!s)if("rect"===i&&null!=o&&null!=a){const t=Math.max(o,4),e=Math.max(a,4);u=Ka("rect",{x:l-t/2-3,y:c-e/2-3,width:t+6,height:e+6,rx:3,fill:"none",stroke:Ja,strokeWidth:2,strokeDasharray:"4,2"})}else u=Ka("circle","wedge"===i?{cx:l,cy:c,r:12,fill:"none",stroke:Ja,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:Ja,strokeWidth:2,strokeDasharray:"4,2"});else u=Ka("g",{transform:`translate(${n.left},${n.top})`,children:Ka("path",{d:s,fill:"none",stroke:Ja,strokeWidth:2.5,strokeDasharray:"6,3"})});return Ka("svg",{style:{position:"absolute",left:0,top:0,width:r[0],height:r[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}import*as ts from"react";import{jsx as es}from"react/jsx-runtime";function ns({x:t,y:e,containerWidth:n,containerHeight:r,margin:i,children:o,className:a="stream-frame-tooltip",zIndex:l=1}){const c=Number.isFinite(t)&&Number.isFinite(e),u=ts.useRef(null),[h,d]=ts.useState(null);ts.useLayoutEffect(()=>{const t=u.current;if(!t)return;const e=()=>{const e=t.getBoundingClientRect();Number.isFinite(e.width)&&Number.isFinite(e.height)&&d(t=>t&&.5>Math.abs(t.width-e.width)&&.5>Math.abs(t.height-e.height)?t:{width:e.width,height:e.height})};if(e(),"undefined"==typeof ResizeObserver)return;const n=new ResizeObserver(e);return n.observe(t),()=>n.disconnect()},[a,n,r,c]);let f;f=h?`translate(${h.width+12>n-t?"calc(-100% - 12px)":"12px"}, ${h.height+12>r-e?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*n?"calc(-100% - 12px)":"12px"}, ${.3*r>e?"4px":"calc(-100% - 4px)"})`;const y=function(t){if(!ts.isValidElement(t))return!1;const e=t.type;if("string"!=typeof e&&e&&!0===e.ownsChrome)return!0;const n=t.props;if(!0===n["data-semiotic-tooltip-chrome"])return!0;if("true"===n["data-semiotic-tooltip-chrome"])return!0;const r=n.style;if(r&&"object"==typeof r){if(null!=r.background&&""!==r.background&&"transparent"!==r.background)return!0;if(null!=r.backgroundColor&&""!==r.backgroundColor&&"transparent"!==r.backgroundColor)return!0}return!1}(o),p=y?null:s;return c?es("div",{ref:u,className:y?a:(a+" semiotic-tooltip").trim(),style:{...p||{},position:"absolute",left:i.left+t,top:i.top+e,transform:f,pointerEvents:"none",zIndex:l,width:"max-content"},children:o}):null}import*as rs from"react";import{useCallback as is,useEffect as os,useLayoutEffect as as,useMemo as ss,useRef as ls}from"react";import{useRef as cs,useState as us,useEffect as hs}from"react";var ds="undefined"==typeof window?os:as,fs={requestAnimationFrame:t=>("undefined"==typeof window?globalThis:window).requestAnimationFrame(t),cancelAnimationFrame:t=>("undefined"==typeof window?globalThis:window).cancelAnimationFrame(t)};function ys(t,e,n){return"function"==typeof t?t({size:e,margin:n}):t}function ps(e){const n=t(),r=ls(n);r.current=n;const[i,o]=function(t,e,n){const r=cs(null),[i,o]=us(null);return hs(()=>{if(!e&&!n)return;const t=r.current;if(!t)return;const i=new ResizeObserver(t=>{for(const e of t){const{width:t,height:n}=e.contentRect;o(e=>e&&e.w===t&&e.h===n?e:{w:t,h:n})}});return i.observe(t),()=>i.disconnect()},[e,n]),[r,[e&&i?i.w:t[0],n&&i?i.h:t[1]]]}(e.sizeProp,e.responsiveWidth,e.responsiveHeight),a=!!e.title,s=!!e.legend&&"top"===e.legendPosition,l=ss(()=>oo({...e.marginDefault,...e.userMargin},a,s),[e.marginDefault,e.userMargin,a,s]),c=o[0]-l.left-l.right,u=o[1]-l.top-l.bottom,h=ys(e.foregroundGraphics,o,l),d=ys(e.backgroundGraphics,o,l),f=lt(t=>t.theme),{transition:y,introEnabled:p}=function(t,e){if(!1===t)return{transition:void 0,introEnabled:!1};const n="undefined"!=typeof window&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;return{transition:t?!0===t?{duration:300}:{duration:t.duration??300,easing:"linear"===t.easing?"linear":"ease-out"}:e,introEnabled:!(n||!t||!0!==t&&!1===t.intro)}}(e.animate,e.transitionProp),g="semiotic-table-"+rs.useId(),m=ls(null);if(!m.current){const t=!e.suspendWhenHidden||"undefined"==typeof document||!document.hidden;m.current=new A({clock:e.clock,random:e.random,seed:e.seed,paused:e.paused,visible:t})}const x=m.current;x.configure({clock:e.clock,random:e.random,seed:e.seed});const b=ls(null),v=ls(e.frameScheduler??fs);v.current=e.frameScheduler??fs;const k=ls(null),w=ls(!1),M=ls(()=>{}),S=is(()=>{if(null!==b.current||w.current)return;const t=v.current;let e=!1,n=!1;const r=t.requestAnimationFrame(()=>{e=!0;const t=!n;t&&(w.current=!0),b.current=null,k.current=null;try{M.current()}finally{t&&(w.current=!1)}});n=!0,e||(b.current=r,k.current=t)},[]),$=is(()=>{null!==b.current&&((k.current??v.current).cancelAnimationFrame(b.current),b.current=null,k.current=null)},[]);ds(()=>{x.setPaused(!0===e.paused)},[x,e.paused]),os(()=>{if(!e.suspendWhenHidden||"undefined"==typeof document)return void x.setVisible(!0);const t=()=>x.setVisible(!document.hidden);return t(),document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},[x,e.suspendWhenHidden]),os(()=>()=>{$()},[$]);const P=ls(()=>{}),_=ls(()=>{}),C=ls(null),L=ls(null),T=ls(null),D=is(()=>{const t=C.current;C.current=null,t&&P.current(t)},[]),R=is(t=>{if(C.current={clientX:t.clientX,clientY:t.clientY,pointerType:t.pointerType},null===L.current){const t=v.current;let e=!1;const n=t.requestAnimationFrame(()=>{e=!0,L.current=null,T.current=null,D()});e||(L.current=n,T.current=t)}},[D]),W=is(()=>{C.current=null,null!==L.current&&((T.current??v.current).cancelAnimationFrame(L.current),L.current=null,T.current=null),_.current()},[]);os(()=>()=>{C.current=null,null!==L.current&&((T.current??v.current).cancelAnimationFrame(L.current),L.current=null,T.current=null)},[]);const E=e.themeDirtyRef;return ds(()=>{E&&(nt(),E.current=!0,S())},[f,S,E]),{reducedMotion:n,reducedMotionRef:r,responsiveRef:i,size:o,margin:l,adjustedWidth:c,adjustedHeight:u,resolvedForeground:h,resolvedBackground:d,currentTheme:f,transition:y,introEnabled:p,tableId:g,frameRuntime:x,rafRef:b,renderFnRef:M,scheduleRender:S,cancelRender:$,hoverHandlerRef:P,hoverLeaveRef:_,onPointerMove:R,onPointerLeave:W}}import{useEffect as gs,useRef as ms}from"react";import{jsx as xs}from"react/jsx-runtime";function bs(t,e){return function(t){const{cancelRender:e,dirtyRef:n,frameRuntime:r,manageFrameRuntime:i,scheduleRender:o}=t,a=ms(null),s=ms(null),l=ms(!1);return function(t){const{hydrated:e,wasHydratingFromSSR:n,storeRef:r,dirtyRef:i,renderFnRef:o,cancelRender:a,cleanup:s}=t;aa(()=>{const t=r.current;e&&n&&t?.cancelIntroAnimation?.(),!n&&t?.sceneNodes&&t.sceneNodes.length>0&&t?.markStylePaintPending?t.markStylePaintPending():i.current=!0,a?.(),o.current()},[e,n]);const l=ra(s);l.current=s,ea(()=>()=>l.current?.(),[])}({hydrated:t.hydrated,wasHydratingFromSSR:t.wasHydratingFromSSR,storeRef:t.storeRef,dirtyRef:t.dirtyRef,renderFnRef:t.renderFnRef,cancelRender:t.cancelRender,cleanup:t.cleanup}),gs(()=>{if(!1!==i)return r.subscribe(()=>{r.isActive?(n.current=!0,o()):e()})},[e,n,r,i,o]),gs(()=>{!l.current&&(l.current=!0,t.skipInitialCanvasPaintInvalidation)||(t.canvasPaintInvalidator?t.canvasPaintInvalidator():t.dirtyRef.current=!0,t.scheduleRender())},t.canvasPaintDependencies),{canvasRef:a,interactionCanvasRef:s}}({...e,renderFnRef:t.renderFnRef,scheduleRender:t.scheduleRender,cancelRender:t.cancelRender,frameRuntime:t.frameRuntime})}function vs({children:t,size:e,margin:n,overflowVisible:r=!1}){return t?xs("svg",{style:{position:"absolute",left:0,top:0,width:e[0],height:e[1],pointerEvents:"none",overflow:r?"visible":void 0},children:xs("g",{transform:`translate(${n.left},${n.top})`,children:t})}):null}function ks(t,e,n,r){return"function"==typeof t?t({size:e,margin:n,scales:r}):t}function ws(t,e,n,r){const i=t.getContext("2d");if(!i)return null;const o=Math.round(e[0]*r),a=Math.round(e[1]*r),s=o/e[0],l=a/e[1],c=e[0]+"px",u=e[1]+"px";return t.style.width!==c&&(t.style.width=c),t.style.height!==u&&(t.style.height=u),t.width===o&&t.height===a||(t.width=o,t.height=a),i.setTransform(s,0,0,l,0,0),i.translate(n.left,n.top),i}function As(){if("undefined"==typeof window)return 1;const t=window.devicePixelRatio||1,e=function(){if("undefined"==typeof window)return!1;const t="function"==typeof window.matchMedia&&window.matchMedia("(pointer: coarse)").matches,e=768>Math.min(window.innerWidth||1/0,window.innerHeight||1/0);return t||e}()?2:3;return Math.max(1,Math.min(t,e))}import{useCallback as Ms,useRef as Ss}from"react";function $s(t,e,n,r){return"string"==typeof t?{key:t,fn:null}:"function"==typeof t?{key:n,fn:t}:"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:r,fn:e}:{key:void 0,fn:null}}var Ps=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],_s=3156e7;function Cs(t){const e=t[1]-t[0];return 864e5>e?t=>{const e=new Date(t);return`${(e.getUTCHours()+"").padStart(2,"0")}:${(e.getUTCMinutes()+"").padStart(2,"0")}`}:_s>e?t=>{const e=new Date(t);return`${Ps[e.getUTCMonth()]} ${e.getUTCDate()}`}:5*_s>e?t=>{const e=new Date(t);return`${Ps[e.getUTCMonth()]} ${e.getUTCFullYear()}`}:t=>new Date(t).getUTCFullYear()+""}function Ls(t){if(!t)return;const e=[];for(const n of t)if("point"===n.type)e.push(n);else if("symbol"===n.type)e.push({pointId:n.pointId,x:n.x,y:n.y,r:j(n.size)});else if("glyph"===n.type){const t=T(n.glyph,n.size);e.push({pointId:n.pointId,x:n.x+t.centerDx,y:n.y+t.centerDy,r:t.radius})}return e}import{line as Ts}from"d3-shape";function Ds(t,e,n,r,i,o){if(2>e.length)return;const a=[0];for(let t=1;e.length>t;t++){const n=e[t][0]-e[t-1][0],r=e[t][1]-e[t-1][1];a.push(a[t-1]+Math.sqrt(n*n+r*r))}const s=a[a.length-1];if(0===s)return;const l=Math.min(.2*s,40);t.strokeStyle=n,t.lineWidth=r,t.lineCap=o;for(let n=0;e.length-1>n;n++){const r=(a[n]+a[n+1])/2;let o=i;l>r&&(o*=r/l),l>s-r&&(o*=(s-r)/l),t.globalAlpha=Math.max(0,o),t.beginPath(),t.moveTo(e[n][0],e[n][1]),t.lineTo(e[n+1][0],e[n+1][1]),t.stroke()}}var Rs=(t,e,n,r)=>{const i=e.filter(t=>"line"===t.type);for(const e of i){if(2>e.path.length)continue;const n=e._introClipFraction;void 0!==n&&1>n&&(t.save(),t.beginPath(),t.rect(0,0,r.width*n,r.height),t.clip());const i=e.style.stroke||"#007bff",o=it(t,i)||i,a=e.style.strokeWidth||2,s=e.colorThresholds,l=e.rawValues;if(t.setLineDash(e.style.strokeDasharray?e.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=e.style.opacity&&(t.globalAlpha=e.style.opacity),t.lineWidth=a,t.lineCap=e.style.strokeLinecap||"butt",e.style._edgeFade){Ds(t,e.path,o,a,e.style.opacity??1,e.style.strokeLinecap||"butt"),t.globalAlpha=1,t.setLineDash([]),t.lineCap="butt";continue}const c=jn(e.curve),u=s&&s.length>0&&l&&l.length===e.path.length,h=e._decayOpacities;if(h&&h.length===e.path.length&&!u){t.strokeStyle=o;const n=e.style.opacity??1;for(let r=0;e.path.length-1>r;r++)t.globalAlpha=.5*(h[r]+h[r+1])*n,t.beginPath(),t.moveTo(e.path[r][0],e.path[r][1]),t.lineTo(e.path[r+1][0],e.path[r+1][1]),t.stroke()}else if(u){const n=bo(e.path,l,s,o);for(const e of n){t.beginPath(),t.strokeStyle=it(t,e.color)||e.color,t.moveTo(e.path[0][0],e.path[0][1]);for(let n=1;e.path.length>n;n++)t.lineTo(e.path[n][0],e.path[n][1]);t.stroke()}}else{t.beginPath();const n=e.strokeGradient&&e.path.length>=2?Gn(t,e.strokeGradient,o,e.path[0][0],0,e.path[e.path.length-1][0],0):null;if(t.strokeStyle=n||o,c)Ts().x(t=>t[0]).y(t=>t[1]).curve(c).context(t)(e.path);else{const[n,r]=e.path[0];t.moveTo(n,r);for(let n=1;e.path.length>n;n++)t.lineTo(e.path[n][0],e.path[n][1])}t.stroke()}if(e.style.fill&&e.style.fillOpacity&&e.style.fillOpacity>0){if(t.beginPath(),t.globalAlpha=e.style.fillOpacity,t.fillStyle=Xn(t,e.style.fill,e.style.fill),c&&!u)Ts().x(t=>t[0]).y(t=>t[1]).curve(c).context(t)(e.path);else{const[n,r]=e.path[0];t.moveTo(n,r);for(let n=1;e.path.length>n;n++)t.lineTo(e.path[n][0],e.path[n][1])}const n=e.path[0][0];t.lineTo(e.path[e.path.length-1][0],r.height),t.lineTo(n,r.height),t.closePath(),t.fill()}void 0!==n&&1>n&&t.restore(),t.globalAlpha=1,t.setLineDash([]),t.lineCap="butt"}};function Ws(t){return!(!t._pulseIntensity||0>=t._pulseIntensity)}function Es(t,e,n=.3){Ws(e)&&(t.globalAlpha=e._pulseIntensity*n,t.fillStyle=e._pulseColor||"rgba(255,255,255,0.6)",t.fillRect(e.x,e.y,e.w,e.h))}function Ns(t,e,n=.6){if(!Ws(e))return;const r=e.r+(e._pulseGlowRadius??4)*e._pulseIntensity,i=e.cx??e.x??0,o=e.cy??e.y??0;t.beginPath(),t.arc(i,o,r,0,2*Math.PI),t.strokeStyle=e._pulseColor||"rgba(255,255,255,0.6)",t.lineWidth=2*e._pulseIntensity,t.globalAlpha=e._pulseIntensity*n,t.stroke()}function Os(t,e,n,r=.35){Ws(e)&&(t.globalAlpha=e._pulseIntensity*r,t.fillStyle=e._pulseColor||"rgba(255,255,255,0.6)",n?t.fill(n):t.fill())}import{area as Is,line as zs}from"d3-shape";function Fs(t,e){const n=jn(e.curve);if(!n||2>e.topPath.length||2>e.bottomPath.length){t.beginPath(),t.moveTo(e.topPath[0][0],e.topPath[0][1]);for(let n=1;e.topPath.length>n;n++)t.lineTo(e.topPath[n][0],e.topPath[n][1]);for(let n=e.bottomPath.length-1;n>=0;n--)t.lineTo(e.bottomPath[n][0],e.bottomPath[n][1]);t.closePath()}else{const r=Is().x(t=>t[0]).y0((t,n)=>e.bottomPath[n][1]).y1(t=>t[1]).curve(n).context(t);t.beginPath(),r(e.topPath)}}function Ys(t,e){const n=jn(e.curve);if(t.beginPath(),n)zs().x(t=>t[0]).y(t=>t[1]).curve(n).context(t)(e.topPath);else{t.moveTo(e.topPath[0][0],e.topPath[0][1]);for(let n=1;e.topPath.length>n;n++)t.lineTo(e.topPath[n][0],e.topPath[n][1])}}var Bs=(t,e,n,r)=>{const i=e.filter(t=>"area"===t.type);for(const e of i){if(2>e.topPath.length)continue;let n=!1;e.clipRect&&(t.save(),t.beginPath(),t.rect(e.clipRect.x,e.clipRect.y,e.clipRect.width,e.clipRect.height),t.clip(),n=!0);const i=e._introClipFraction;void 0!==i&&1>i&&(t.save(),t.beginPath(),t.rect(0,0,r.width*i,r.height),t.clip());const o=Xn(t,e.style.fill,"#4e79a7"),a=e._decayOpacities,s=!(!e.colorThresholds?.length||!e.rawValues||e.rawValues.length!==e.topPath.length),l=!!e.strokeColorBands?.length;if(a&&a.length===e.topPath.length&&!s&&!l){const n=e.style.fillOpacity??.7;t.fillStyle=o;for(let r=0;e.topPath.length-1>r;r++)t.globalAlpha=.5*(a[r]+a[r+1])*n,t.beginPath(),t.moveTo(e.topPath[r][0],e.topPath[r][1]),t.lineTo(e.topPath[r+1][0],e.topPath[r+1][1]),t.lineTo(e.bottomPath[r+1][0],e.bottomPath[r+1][1]),t.lineTo(e.bottomPath[r][0],e.bottomPath[r][1]),t.closePath(),t.fill();if(e.style.stroke&&"none"!==e.style.stroke){t.strokeStyle=it(t,e.style.stroke)||e.style.stroke,t.lineWidth=e.style.strokeWidth||2,t.setLineDash([]);for(let n=0;e.topPath.length-1>n;n++)t.globalAlpha=.5*(a[n]+a[n+1]),t.beginPath(),t.moveTo(e.topPath[n][0],e.topPath[n][1]),t.lineTo(e.topPath[n+1][0],e.topPath[n+1][1]),t.stroke()}t.globalAlpha=1;continue}const c=e.style.opacity??1;if(Fs(t,e),e.fillGradient&&e.fillGradient.stops.length>=2&&e.fillGradient){let n=1/0;for(const t of e.topPath)n>t[1]&&(n=t[1]);let r=-1/0;for(const t of e.bottomPath)t[1]>r&&(r=t[1]);const i=Gn(t,e.fillGradient,"string"==typeof o?o:"#4e79a7",0,n,0,r);t.fillStyle=i||o,t.globalAlpha=c}else t.globalAlpha=(e.style.fillOpacity??.7)*c,t.fillStyle=o;if(t.fill(),e._pulseIntensity&&e._pulseIntensity>0&&(Fs(t,e),Os(t,e)),e.style.stroke&&"none"!==e.style.stroke){t.globalAlpha=c;const n=it(t,e.style.stroke)||e.style.stroke,r=s||l||!e.strokeGradient||2>e.topPath.length?null:Gn(t,e.strokeGradient,n,e.topPath[0][0],0,e.topPath[e.topPath.length-1][0],0);if(t.lineWidth=e.style.strokeWidth||2,t.setLineDash([]),l){let r=1/0,i=-1/0;for(const[t]of e.topPath)r=Math.min(r,t),i=Math.max(i,t);const o=t.lineWidth;for(const a of e.strokeColorBands){t.save(),t.beginPath(),t.rect(r-o,a.y,i-r+2*o,a.height),t.clip();const s=a.color??n;t.strokeStyle=it(t,s)||s,Ys(t,e),t.stroke(),t.restore()}}else if(s){const r=bo(e.topPath,e.rawValues,e.colorThresholds,n);for(const e of r){t.beginPath(),t.strokeStyle=it(t,e.color)||e.color,t.moveTo(e.path[0][0],e.path[0][1]);for(let n=1;e.path.length>n;n++)t.lineTo(e.path[n][0],e.path[n][1]);t.stroke()}}else t.strokeStyle=r||n,Ys(t,e),t.stroke()}void 0!==i&&1>i&&t.restore(),n&&t.restore(),t.globalAlpha=1}},js=(t,e,n,r)=>{const i=e.filter(t=>"point"===t.type);if(0!==i.length){t.save();try{const e=t.globalAlpha;for(const n of i)t.beginPath(),t.arc(n.x,n.y,n.r,0,2*Math.PI),t.globalAlpha=e*(n.style.opacity??n.style.fillOpacity??1),t.fillStyle=Xn(t,n.style.fill,"#4e79a7"),t.fill(),n.style.stroke&&"none"!==n.style.stroke&&(t.strokeStyle=Xn(t,n.style.stroke,n.style.stroke),t.lineWidth=n.style.strokeWidth||1,t.stroke()),Ns(t,n)}finally{t.restore()}}},Xs=new Map;function Gs(t,e,n,r,i,o){if(0>=e.size)return;const a=function(t,e,n){try{if(n)return new Path2D(n);const r=`${t??"circle"}:${Math.round(e)}`;let i=Xs.get(r);return i||(i=new Path2D(B(t,e)),Xs.size>256&&Xs.clear(),Xs.set(r,i)),i}catch{return null}}(e.symbolType,e.size,e.path);if(!a)return;t.save(),t.translate(n,r),e.rotation&&t.rotate(e.rotation);const s=(e.style.opacity??1)*(e._decayOpacity??1);e.style.fill&&(t.globalAlpha=i*s*(e.style.fillOpacity??1),t.fillStyle=Xn(t,e.style.fill,o),t.fill(a)),e.style.stroke&&"none"!==e.style.stroke&&(t.globalAlpha=i*s,t.strokeStyle=it(t,e.style.stroke)||e.style.stroke,t.lineWidth=e.style.strokeWidth??1,t.stroke(a)),t.restore()}var Hs=(t,e)=>{const n=t.globalAlpha;for(const r of e)"symbol"===r.type&&Gs(t,r,r.x,r.y,n,"#4e79a7");t.globalAlpha=n};function Vs(t,e){const n=t.globalAlpha;for(const r of e)"symbol"===r.type&&Gs(t,r,r.cx,r.cy,n,"#007bff");t.globalAlpha=n}function qs(t,e,n,r,i){if(0>=e.size)return;const o=e.glyph;if(!o||!o.parts?.length)return;const a=D(o,e.size);if(0>=a.scale)return;const s=(e.style.opacity??1)*(e._decayOpacity??1);if(0>=s)return;const l=e=>{const n=Xn(t,e,e);return"string"==typeof n?n:e},c=e.color??("string"==typeof e.style.fill?e.style.fill:void 0);t.save(),t.translate(n,r),e.rotation&&t.rotate(e.rotation),t.translate(a.offsetX,a.offsetY),t.scale(a.scale,a.scale),t.globalAlpha=i*s*(e.style.fillOpacity??1);const u=L(o,e.fraction??1,e.fractionStart??0,e.fractionDirection??"horizontal");u&&e.ghostColor&&P(t,o,c,e.accent,e.ghostColor,l),u&&(t.beginPath(),t.rect(u.x,u.y,u.width,u.height),t.clip()),P(t,o,c,e.accent,void 0,l),t.restore()}function Us(t,e){const n=t.globalAlpha;for(const r of e)"glyph"===r.type&&qs(t,r,r.cx,r.cy,n);t.globalAlpha=n}function Zs(t,e){const{x:n,y:r,w:i,h:o}=e,{tl:a,tr:s,br:l,bl:c}=ko(e);t.beginPath(),t.moveTo(n+a,r),t.lineTo(n+i-s,r),s>0&&t.arcTo(n+i,r,n+i,r+s,s),t.lineTo(n+i,r+o-l),l>0&&t.arcTo(n+i,r+o,n+i-l,r+o,l),t.lineTo(n+c,r+o),c>0&&t.arcTo(n,r+o,n,r+o-c,c),t.lineTo(n,r+a),a>0&&t.arcTo(n,r,n+a,r,a),t.closePath()}function Ks(t,e){const n=Xn(t,e.style.fill,it(t,"var(--semiotic-primary, #007bff)")),r=function(t){switch(t.roundedEdge){case"bottom":return{x0:t.x,y0:t.y+t.h,x1:t.x,y1:t.y};case"right":return{x0:t.x+t.w,y0:t.y,x1:t.x,y1:t.y};case"left":return{x0:t.x,y0:t.y,x1:t.x+t.w,y1:t.y};default:return{x0:t.x,y0:t.y,x1:t.x,y1:t.y+t.h}}}(e);return(e.fillGradient&&"string"==typeof n?Gn(t,e.fillGradient,n,r.x0,r.y0,r.x1,r.y1):null)||n}function Js(t,e){return!(!e.style.stroke||"none"===e.style.stroke||(t.strokeStyle=it(t,e.style.stroke)||e.style.stroke,t.lineWidth=e.style.strokeWidth||1,0))}var Qs=(t,e,n,r)=>{const i=e.filter(t=>"rect"===t.type);for(const e of i){if(null!=e.style.opacity&&(t.globalAlpha=e.style.opacity),e.style.icon)tl(t,e);else if(e.cornerRadii&&vo(e.cornerRadii))t.fillStyle=Ks(t,e),Zs(t,e),t.fill(),Js(t,e)&&t.stroke();else if(e.roundedTop&&e.roundedTop>0){t.fillStyle=Ks(t,e);const n=Math.min(e.roundedTop,e.w/2,e.h/2);t.beginPath();const{x:r,y:i,w:o,h:a}=e;switch(e.roundedEdge){case"right":t.moveTo(r,i),t.lineTo(r+o-n,i),t.arcTo(r+o,i,r+o,i+n,n),t.lineTo(r+o,i+a-n),t.arcTo(r+o,i+a,r+o-n,i+a,n),t.lineTo(r,i+a);break;case"left":t.moveTo(r+o,i),t.lineTo(r+n,i),t.arcTo(r,i,r,i+n,n),t.lineTo(r,i+a-n),t.arcTo(r,i+a,r+n,i+a,n),t.lineTo(r+o,i+a);break;case"bottom":t.moveTo(r,i),t.lineTo(r+o,i),t.lineTo(r+o,i+a-n),t.arcTo(r+o,i+a,r+o-n,i+a,n),t.lineTo(r+n,i+a),t.arcTo(r,i+a,r,i+a-n,n);break;default:t.moveTo(r,i+a),t.lineTo(r,i+n),t.arcTo(r,i,r+n,i,n),t.lineTo(r+o-n,i),t.arcTo(r+o,i,r+o,i+n,n),t.lineTo(r+o,i+a)}t.closePath(),t.fill(),Js(t,e)&&t.stroke()}else t.fillStyle=Ks(t,e),t.fillRect(e.x,e.y,e.w,e.h),Js(t,e)&&t.strokeRect(e.x,e.y,e.w,e.h);Es(t,e),t.globalAlpha=1}};function tl(t,e){const n=e.style.icon,r=e.style.iconPadding||2,i=Math.min(e.w,e.h)-r;if(0>=i)return;const o=e.h>e.w;if(t.save(),t.beginPath(),t.rect(e.x,e.y,e.w,e.h),t.clip(),o){const o=i+r,a=e.x+(e.w-i)/2;for(let r=e.y+e.h-i;r>=e.y-i;r-=o)t.drawImage(n,a,r,i,i)}else{const o=i+r,a=e.y+(e.h-i)/2;for(let r=e.x;e.x+e.w>r;r+=o)t.drawImage(n,r,a,i,i)}t.restore()}function el(t){const[e,n,r]=function(t){if(t.startsWith("#")){let e=t.slice(1);if(3===e.length&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),6===e.length)return[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16)]}const e=t.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return e?[+e[1],+e[2],+e[3]]:[128,128,128]}(t);return.299*e+.587*n+.114*r>128?"#000":"#fff"}function nl(t){return Number.isInteger(t)?t+"":100>Math.abs(t)?1>Math.abs(t)?t.toPrecision(3):t.toFixed(1):t.toFixed(0)}var rl=(t,e,n,r)=>{const i=e.filter(t=>"heatcell"===t.type);t.save();try{for(const e of i){const n=e.style;null!=n?.opacity&&(t.globalAlpha=n.opacity),t.fillStyle=e.fill,t.fillRect(e.x,e.y,e.w,e.h);const r=Math.max(0,n?.strokeWidth??1);if(r>0&&(t.strokeStyle=it(t,n?.stroke??"var(--semiotic-surface, #fff)"),t.lineWidth=r,t.strokeRect(e.x,e.y,e.w,e.h)),Es(t,e),t.globalAlpha=1,e.showValues&&null!=e.value){if(20>e.w||20>e.h)continue;const n=e.valueFormat?e.valueFormat(e.value):nl(e.value),r=Math.max(10,Math.min(16,.3*Math.min(e.w,e.h))),i=e.x+e.w/2,o=e.y+e.h/2;t.fillStyle=el(e.fill),t.font=r+"px sans-serif",t.textAlign="center",t.textBaseline="middle",t.fillText(n,i,o)}}}finally{t.restore()}},il=(t,e,n,r)=>{for(const n of e){if("candlestick"!==n.type)continue;const e=n;t.save();const i=(e._decayOpacity??1)*(e.style?.opacity??1);1!==i&&(t.globalAlpha=i);const o=it(t,e.wickColor)||e.wickColor,a=60>r.height,s=a?Math.max(e.wickWidth,2):e.wickWidth,l=()=>{t.beginPath(),t.moveTo(e.x,e.highY),t.lineTo(e.x,e.lowY),t.strokeStyle=o,t.lineWidth=s,t.stroke()};if(a||l(),e.isRange){const n=e.dotRadius??Math.max(2,Math.min(e.bodyWidth/2,.12*r.height));t.fillStyle=o,t.beginPath(),t.arc(e.x,e.highY,n,0,2*Math.PI),t.fill(),t.beginPath(),t.arc(e.x,e.lowY,n,0,2*Math.PI),t.fill()}else if(e.bodyWidth>0){const n=Math.min(e.openY,e.closeY),r=Math.abs(e.openY-e.closeY),i=e.isUp?e.upColor:e.downColor,o=it(t,i)||i;t.fillStyle=o,t.fillRect(e.x-e.bodyWidth/2,n,e.bodyWidth,Math.max(r,1)),t.strokeStyle=o,t.lineWidth=1,t.strokeRect(e.x-e.bodyWidth/2,n,e.bodyWidth,Math.max(r,1))}a&&l(),t.restore()}},ol={line:[Bs,Rs,js],area:[Bs,js],stackedarea:[Bs,js],scatter:[js,Hs],bubble:[js,Hs],heatmap:[rl],bar:[Qs],swarm:[js],waterfall:[(t,e,n,r)=>{Qs(t,e);const i=e.filter(t=>"rect"===t.type);if(2>i.length)return;const o=i[0].datum,a=o?._connectorStroke;if(a){t.save(),t.strokeStyle=it(t,a)||a,t.lineWidth=o?._connectorWidth??1,t.setLineDash([]);for(let e=0;i.length-1>e;e++){const r=i[e],o=i[e+1],a=r.datum,s=o.datum;if(null==a?.cumEnd||null==s?.baseline)continue;const l=n.y(a.cumEnd),c=r.x+r.w,u=o.x;t.beginPath(),t.moveTo(c,l),t.lineTo(u,l),t.stroke()}t.restore()}}],candlestick:[il],mixed:[Bs,Rs,js],custom:[Bs,Qs,rl,Rs,js,Hs,(t,e)=>{const n=t.globalAlpha;for(const r of e)"glyph"===r.type&&qs(t,r,r.x,r.y,n);t.globalAlpha=n},il]},al=new Set;function sl(t,e){const n="function"==typeof t?t(e.datum??null,e):t;return(r=n)&&"object"==typeof r&&"string"==typeof r.id&&"function"==typeof r.cacheKey&&"function"==typeof r.drawCanvas&&"function"==typeof r.renderStaticSVG?n:void 0;var r}function ll(t,e){if("undefined"!=typeof process&&"production"===process.env?.NODE_ENV)return;const n=`${t}:${e}`;al.has(n)||(al.add(n),console.warn(`[Semiotic] Render backend "${t}" does not support scene node "${e}"; using the built-in renderer.`))}function cl(t){const{context:e,nodes:n,renderMode:r,pixelRatio:i,paintBuiltIn:o}=t;if(!r||"sketchy"===r)return void o(n);let a=[];const s=()=>{a.length&&(o(a),a=[])};for(const t of n){const n=sl(r,t);if(!n){a.push(t);continue}let l;s(),e.save();try{l=n.drawCanvas({context:e,node:t,style:t.style??{},pixelRatio:i})}finally{e.restore()}l||(ll(n.id,t.type??"unknown"),o([t]))}s()}function ul(t){const{node:e,index:n,renderMode:r,fallback:i}=t,o=sl(r,e);if(!o)return i();const a=o.renderStaticSVG({node:e,style:e.style??{},key:`${o.id}-${n}`});return null!=a?a:(ll(o.id,e.type??"unknown"),i())}function hl(t){const e=[];return t.nodes.forEach((n,r)=>{const i=ul({node:n,index:r,renderMode:t.renderMode,fallback:()=>t.fallback(n,r)});null!=i&&!1!==i&&e.push({node:n,element:i})}),e}import{jsx as dl,jsxs as fl}from"react/jsx-runtime";function yl(t){return null==t?"–":"number"==typeof t?Math.abs(t)>9999?t.toLocaleString():t+"":t instanceof Date?t.toLocaleDateString():t+""}import{jsx as pl,jsxs as gl}from"react/jsx-runtime";function ml(t){return null==t?"":"number"==typeof t?Number.isInteger(t)?t+"":t.toFixed(2):t instanceof Date?t.toLocaleString():t+""}function xl({hover:t}){const e=t.data??{},n=e.y??e.value,r=e.x??e.time;if(void 0===n&&void 0===r){const t=v(e);if(null!=t.title||t.entries.length>0)return gl("div",{className:"semiotic-tooltip",style:s,children:[null!=t.title&&pl("div",{style:{fontWeight:600,marginBottom:t.entries.length?2:0},children:t.title+""}),t.entries.map(t=>gl("div",{style:{opacity:.7,fontSize:11},children:[t.key,":"," ",pl("span",{style:{fontWeight:600},children:ml(t.value)})]},t.key))]})}return gl("div",{className:"semiotic-tooltip",style:s,children:[pl("div",{style:{fontWeight:600,marginBottom:2},children:ml(n)}),pl("div",{style:{opacity:.7,fontSize:11},children:ml(r)})]})}function bl(t){return"touch"===t?"touch":"pointer"}function vl(t){const e=t.target;return e instanceof Element&&e!==t.currentTarget&&null!=e.closest("button, a[href], input, select, textarea, summary, [contenteditable='true'], [role='button'], [role='link'], [role='checkbox'], [role='radio'], [role='switch']")}function kl(t){const{onObservation:e,datum:n,x:r=0,y:i=0,chartType:o,chartId:a,context:s,timestamp:l=Date.now()}=t;e&&(n?(e({type:"hover",datum:n,x:r,y:i,timestamp:l,chartType:o,chartId:a}),"focus"===s?.type&&e({type:"focus",datum:n,inputType:"touch"===s.inputType?"pointer":s.inputType,timestamp:l,chartType:o,chartId:a})):e({type:"hover-end",timestamp:l,chartType:o,chartId:a}))}function wl(t){const{onObservation:e,datum:n,x:r=0,y:i=0,chartType:o,chartId:a,context:s,timestamp:l=Date.now()}=t;e&&(n?(e({type:"click",datum:n,x:r,y:i,timestamp:l,chartType:o,chartId:a}),"activate"===s?.type&&e({type:"activate",datum:n,inputType:s.inputType,timestamp:l,chartType:o,chartId:a})):e({type:"click-end",timestamp:l,chartType:o,chartId:a}))}xl.ownsChrome=!0;import{useCallback as Al}from"react";import{useCallback as Ml,useRef as Sl}from"react";function $l(t){const e=new Map;for(const n of t){const t=n.group??"_default";let r=e.get(t);r||(r=[],e.set(t,r)),r.push(n)}for(const t of e.values()){t.sort((t,e)=>t.x-e.x||t.y-e.y);for(let e=0;t.length>e;e++)t[e]._groupIndex=e}const n=Array.from(e.keys()).sort((t,n)=>{const r=e.get(t),i=e.get(n);return(r.length>0?r[0].y:0)-(i.length>0?i[0].y:0)}),r=Array.from(e.values()).flat();r.sort((t,e)=>t.x-e.x||t.y-e.y);const i=new Map;for(let t=0;r.length>t;t++){r[t]._flatIndex=t;const e=r[t].datum?.id;null!=e&&i.set(e+"",t)}return{flat:r,groups:n,byGroup:e,idToIdx:i}}function Pl(t,e){if(0===t.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const n=Math.max(0,Math.min(e,t.flat.length-1)),r=t.flat[n];return{flatIndex:n,group:r.group??"_default",indexInGroup:r._groupIndex??0}}function _l(t,e,n){const{group:r,indexInGroup:i}=e,o=n.byGroup.get(r);switch(t){case"ArrowRight":return o.length-1>i?o[i+1]._flatIndex:e.flatIndex;case"ArrowLeft":return i>0?o[i-1]._flatIndex:e.flatIndex;case"ArrowDown":{const t=n.groups.indexOf(r);return n.groups.length-1>t?Cl(n,n.groups[t+1],o[i]):e.flatIndex}case"ArrowUp":{const t=n.groups.indexOf(r);return t>0?Cl(n,n.groups[t-1],o[i]):e.flatIndex}case"PageDown":return Math.min(e.flatIndex+Math.max(1,Math.floor(.1*n.flat.length)),n.flat.length-1);case"PageUp":return Math.max(e.flatIndex-Math.max(1,Math.floor(.1*n.flat.length)),0);case"Home":return 0;case"End":return n.flat.length-1;case"Escape":return-1;default:return null}}function Cl(t,e,n){const r=t.byGroup.get(e);let i=0,o=Math.abs(r[0].x-n.x);for(let t=1;r.length>t;t++){const e=Math.abs(r[t].x-n.x);o>e&&(o=e,i=t)}return r[i]._flatIndex}function Ll(t){const e=[];for(const n of t)switch(n.type){case"point":e.push({x:n.x,y:n.y,datum:n.datum,shape:"circle",group:"_default"});break;case"symbol":if(0>=n.size)break;e.push({x:n.x,y:n.y,datum:n.datum,shape:"circle",group:"_default"});break;case"glyph":{if(0>=n.size||null==n.datum)break;const t=T(n.glyph,n.size);e.push({x:n.x+t.centerDx,y:n.y+t.centerDy,datum:n.datum,shape:"rect",w:2*t.halfWidth,h:2*t.halfHeight,group:"_default"});break}case"line":{const t=n,r=Array.isArray(t.datum)?t.datum:[],i=t.group??"_default";for(let n=0;t.path.length>n&&r.length>n;n++)e.push({x:t.path[n][0],y:t.path[n][1],datum:r[n],shape:"circle",group:i});break}case"area":{const t=n,r=Array.isArray(t.datum)?t.datum:[],i=t.group??"_default";for(let n=0;t.topPath.length>n&&r.length>n;n++)e.push({x:t.topPath[n][0],y:t.topPath[n][1],datum:r[n],shape:"circle",group:i});break}case"rect":e.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??"_default"});break;case"heatcell":e.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:"_default"})}return e.sort((t,e)=>t.x-e.x||t.y-e.y),e}function Tl(t){const e=[];for(const n of t)if("circle"===n.type&&null!=n.cx){if(0>=n.r)continue;e.push({x:n.cx,y:n.cy,datum:n.datum,shape:"circle",group:n.datum?.id??"_default"})}else if("rect"===n.type&&null!=n.x){if(0>=n.w||0>=n.h)continue;e.push({x:n.x+n.w/2,y:n.y+n.h/2,datum:n.datum,shape:"rect",w:n.w,h:n.h,group:n.datum?.id??"_default"})}else if("arc"===n.type&&null!=n.cx)e.push({x:n.cx,y:n.cy,datum:n.datum,shape:"circle",group:n.datum?.id??"_default"});else if("symbol"===n.type&&null!=n.cx){if(0>=n.size)continue;e.push({x:n.cx,y:n.cy,datum:n.datum,shape:"circle",group:n.datum?.id??"_default"})}else if("glyph"===n.type&&null!=n.cx){if(0>=n.size||null==n.datum)continue;const t=T(n.glyph,n.size);e.push({x:n.cx+t.centerDx,y:n.cy+t.centerDy,datum:n.datum,shape:"rect",w:2*t.halfWidth,h:2*t.halfHeight,group:n.datum?.id??"_default"})}return e.sort((t,e)=>t.x-e.x||t.y-e.y),e}function Dl(t,e,n,r,i){const o=n.flat[e.flatIndex];if(!o)return _l(t,e,n);const a=o.datum?.id;switch(t){case"ArrowRight":case"ArrowLeft":case"ArrowDown":case"ArrowUp":{const r=function(t,e,n){let r=null,i=1/0;for(let o=0;t.flat.length>o;o++){const a=t.flat[o];if(a===e)continue;const s=a.x-e.x,l=a.y-e.y;let c=!1;switch(n){case"right":c=s>0&&Math.abs(s)>=Math.abs(l);break;case"left":c=0>s&&Math.abs(s)>=Math.abs(l);break;case"down":c=l>0&&Math.abs(l)>=Math.abs(s);break;case"up":c=0>l&&Math.abs(l)>=Math.abs(s)}if(!c)continue;const u=s*s+l*l;i>u&&(i=u,r=o)}return r}(n,o,"ArrowRight"===t?"right":"ArrowLeft"===t?"left":"ArrowDown"===t?"down":"up")??e.flatIndex;return r!==e.flatIndex&&(i.current=-1),r}case"Enter":{if(null==a)return e.flatIndex;const t=function(t,e){const n=t+"",r=[];for(const t of e){const e=t.datum??t,i=Rl(e.source),o=Rl(e.target),a=null!=i,s=null!=o;a&&i+""===n&&s?r.push(o+""):s&&o+""===n&&a&&r.push(i+"")}return r}(a,r);if(0===t.length)return e.flatIndex;const o=n.idToIdx.get(t[(i.current+1)%t.length])??-1;return 0>o?e.flatIndex:(i.current=-1,o)}default:{const r=_l(t,e,n);return null!==r&&r!==e.flatIndex&&(i.current=-1),r}}}function Rl(t){return"object"==typeof t&&null!==t&&"id"in t?t.id:t}import{jsx as Wl,jsxs as El}from"react/jsx-runtime";var Nl={top:20,right:20,bottom:30,left:40},Ol=va;function Il(t){if(t)return"x"===t.dimension?"pan-y":"y"===t.dimension?"pan-x":"none"}var zl=At(wt(function(t,e){const{chartType:n,runtimeMode:r,data:i,chunkThreshold:a,chunkSize:s,xAccessor:l,yAccessor:c,accessorRevision:h,colorAccessor:d,sizeAccessor:y,symbolAccessor:p,symbolMap:g,groupAccessor:m,lineDataAccessor:x,curve:b,normalize:v,baseline:k,stackOrder:w,binSize:A,valueAccessor:M,arrowOfTime:S="right",windowMode:$="sliding",windowSize:P=200,timeAccessor:_,xExtent:C,yExtent:L,extentPadding:T=.1,scalePadding:D,sizeRange:R,size:W=[500,300],responsiveWidth:E,responsiveHeight:N,margin:O,className:I,background:z,renderMode:F,lineStyle:Y,pointStyle:B,areaStyle:j,barStyle:G,waterfallStyle:H,swarmStyle:V,barColors:q,colorScheme:U,boundsAccessor:Z,boundsStyle:K,y0Accessor:J,band:Q,gradientFill:tt,lineGradient:et,semanticLineStops:nt,areaGroups:it,openAccessor:ot,highAccessor:at,lowAccessor:lt,closeAccessor:ct,candlestickStyle:ut,showAxes:ht=!0,axes:dt,xLabel:ft,yLabel:wt,yLabelRight:At,xFormat:Mt,yFormat:St,axisExtent:$t,tickFormatTime:Pt,tickFormatValue:Ct,hoverAnnotation:Dt,tooltipContent:Rt,customHoverBehavior:Wt,customClickBehavior:Et,onObservation:Nt,annotationObservationCallback:Ot,chartId:It,enableHover:zt,hoverRadius:Ft=30,tooltipMode:Yt,annotations:Bt,onAnnotationActivate:jt,autoPlaceAnnotations:Xt,svgAnnotationRules:Gt,showGrid:Ht,legend:Vt,legendHoverBehavior:qt,legendClickBehavior:Ut,legendHighlightedCategory:Zt,legendIsolatedCategories:Kt,legendPosition:Jt,legendLayout:Qt,legendCategoryAccessor:te,onCategoriesChange:ee,backgroundGraphics:ne,foregroundGraphics:re,canvasPreRenderers:ie,svgPreRenderers:oe,title:ae,categoryAccessor:se,brush:le,onBrush:ce,decay:ue,pulse:he,transition:de,animate:fe,staleness:pe,frameScheduler:ge,clock:me,random:ve,seed:ke,paused:we=!1,suspendWhenHidden:Ae=!0,heatmapAggregation:Me,heatmapXBins:Se,heatmapYBins:$e,showValues:Pe,heatmapValueFormat:_e,marginalGraphics:Ce,pointIdAccessor:Le,xScaleType:Te,yScaleType:De,accessibleTable:Re=!0,description:We,summary:Ee,linkedCrosshairName:Ne,linkedCrosshairSourceId:Oe,customLayout:Ie,onLayoutError:ze,layoutConfig:Fe,layoutSelection:Ye}=t,{customHoverBehavior:Be,customClickBehavior:je,hasClickBehavior:Xe}=function({customHoverBehavior:t,customClickBehavior:e,onObservation:n,chartId:r,chartType:i}){const o=!(!t&&!n),a=!(!e&&!n),s=Al((e,o)=>{t?.(e,o),kl({onObservation:n,datum:e?e.data||e:null,x:e?.x,y:e?.y,chartType:i,chartId:r,context:o})},[r,i,t,n]),l=Al((t,o)=>{e?.(t,o),wl({onObservation:n,datum:t?t.data||t:null,x:t?.x,y:t?.y,chartType:i,chartId:r,context:o})},[r,i,e,n]);return{customHoverBehavior:o?s:void 0,customClickBehavior:a?l:void 0,hasClickBehavior:a}}({customHoverBehavior:Wt,customClickBehavior:Et,onObservation:Nt,chartId:It,chartType:"StreamXYFrame"}),Ge=kt().replace(/:/g,""),He=pt(!1),Ve=pt({w:-1,h:-1}),qe=pt(!1),Ue=ps({sizeProp:W,responsiveWidth:E,responsiveHeight:N,userMargin:O,marginDefault:Nl,title:ae,legend:Vt,legendPosition:Jt,animate:fe,transitionProp:de,frameScheduler:ge,clock:me,random:ve,seed:ke,paused:we,suspendWhenHidden:Ae,themeDirtyRef:He}),Ze=sa(),Ke=ha(),{reducedMotionRef:Je,responsiveRef:Qe,size:tn,currentTheme:en,transition:nn,introEnabled:rn,tableId:on,rafRef:an,renderFnRef:sn,scheduleRender:ln,frameRuntime:cn}=Ue;let un=Ue.margin;if(Ce){const t=60,e={...Ue.margin};Ce.top&&t>e.top&&(e.top=t),Ce.bottom&&t>e.bottom&&(e.bottom=t),Ce.left&&t>e.left&&(e.left=t),Ce.right&&t>e.right&&(e.right=t),un=e}const hn=tn[0]-un.left-un.right,dn=tn[1]-un.top-un.bottom,fn=xt(()=>Lt(i),[i]),pn=Dt??zt,[gn,mn]=gt(0),xn=pt(0),[bn,vn]=gt(null),kn=ks(re,tn,un,bn),wn=ks(ne,tn,un,bn),An=pt(null),Sn=pt(null),Pn=pt(void 0),[Cn,Ln]=gt(null),Rn=pt(Ol.primary),Wn=pt(function(){let t=-1,e=va;return{resolve(n){if(!n)return va;const r=rt();return r===t||(e=function(t){if(!t)return va;const e=getComputedStyle(t),n=e.getPropertyValue("--semiotic-border").trim(),r=e.getPropertyValue("--semiotic-text-secondary").trim(),i=e.getPropertyValue("--semiotic-bg").trim(),o=e.getPropertyValue("--semiotic-primary").trim(),a=r||e.getPropertyValue("--text-secondary").trim(),s=e.getPropertyValue("--text-primary").trim(),l=n||e.getPropertyValue("--surface-3").trim(),c=i||e.getPropertyValue("--surface-0").trim();return a||s||n||o?{axisStroke:l||va.axisStroke,tickText:a||va.tickText,crosshair:a?ka(a,"66"):va.crosshair,hoverFill:c?ka(c,"4D"):va.hoverFill,hoverStroke:a?ka(a,"99"):va.hoverStroke,pointRing:c||va.pointRing,primary:o||va.primary,background:c||va.background}:va}(n),t=r),e},invalidate(){t=-1}}}()),En=pt(!1),Nn=Mn("StreamXYFrame"),[On,In]=gt(!1),[zn,Fn]=gt([]),[Yn,Bn]=gt([]),jn="streaming"===r||["bar","swarm","waterfall"].includes(n),Xn=fa(xt(()=>({chartType:n,runtimeMode:jn?"streaming":"bounded",windowSize:P,windowMode:$,arrowOfTime:jn?S:"right",extentPadding:T,scalePadding:D,axisExtent:$t,xAccessor:l,yAccessor:c,accessorRevision:h,timeAccessor:jn?_:void 0,valueAccessor:M,colorAccessor:d,sizeAccessor:y,symbolAccessor:p,symbolMap:g,groupAccessor:m||(x?"_lineGroup":void 0),categoryAccessor:se,lineDataAccessor:x,xScaleType:Te,yScaleType:De,xExtent:C,yExtent:L,sizeRange:R,binSize:A,normalize:v,baseline:k,stackOrder:w,boundsAccessor:Z,boundsStyle:K,y0Accessor:J,band:Q,gradientFill:xe(tt),areaGroups:it?new Set(it):void 0,lineGradient:be(et),semanticLineStops:nt,openAccessor:ot,highAccessor:at,lowAccessor:lt,closeAccessor:ct,candlestickStyle:ut,lineStyle:Y,pointStyle:B,areaStyle:j,swarmStyle:V,waterfallStyle:H,colorScheme:U,barColors:q,barStyle:G,annotations:Bt,decay:ue,pulse:he,transition:nn,introAnimation:rn,staleness:pe,clock:cn.now,heatmapAggregation:Me,heatmapXBins:Se,heatmapYBins:$e,showValues:Pe,heatmapValueFormat:_e,pointIdAccessor:Le,curve:b,themeCategorical:en?.colors?.categorical,themeSemantic:st(en),themeSequential:en?.colors?.sequential,themeDiverging:en?.colors?.diverging,customLayout:Ie,onLayoutError:ze,layoutConfig:Fe,layoutMargin:un}),[n,jn,P,$,S,T,D,$t,l,c,h,_,M,d,y,p,g,m,x,se,Te,De,C,L,R,A,v,k,w,Z,K,J,Q,tt,it,et,nt,ot,at,lt,ct,ut,Y,B,j,V,H,U,q,G,Bt,ue,he,nn,rn,pe,cn.now,Me,Se,$e,Pe,_e,Le,b,en,Ie,ze,Fe,un])),Gn=pt(null);Gn.current||(Gn.current=new yn(Xn));const Hn=function(t,e,n,r){const i=Ss({accessor:e,onChange:n,readData:r}),o=Ss([]);return i.current={accessor:e,onChange:n,readData:r},Ms(()=>{const{accessor:e,onChange:n,readData:r}=i.current;if(!n||!e)return;const a=function(t,e){if(!e)return[];const n=new Set,r=[];for(const i of t){if(!i||"object"!=typeof i)continue;const t="function"==typeof e?e(i):i[e];if(null==t)continue;const o=t+"";n.has(o)||(n.add(o),r.push(o))}return r}(t.current?r(t.current):[],e);(function(t,e){if(t.length!==e.length)return!1;for(let n=0;t.length>n;n++)if(t[n]!==e[n])return!1;return!0})(a,o.current)||(o.current=a,n(a))},[t])}(Gn,te,ee,t=>t.getData());Tn(Gn,Xn,He,ln),Dn(Gn,Ye,He,ln);const Vn=pt(null);Vn.current||(Vn.current=new Tt(t=>{const e=Gn.current;e&&e.ingest(t)&&(He.current=!0,ln())},{chunkThreshold:a,chunkSize:s})),mt(()=>{Vn.current?.updateChunkOptions({chunkThreshold:a,chunkSize:s})},[a,s]);const qn=bt(t=>{Vn.current?.push(t)},[]),Un=bt(t=>{Vn.current?.pushMany(t)},[]),Zn=bt(()=>{Vn.current?.clear(),Gn.current?.clear(),He.current=!0,ln()},[ln]);vt(e,()=>({push:qn,pushMany:Un,remove:t=>{Vn.current?.flush();const e=Gn.current?.remove(t)??[];return e.length>0&&(An.current&&e.some(t=>t===An.current?.data)&&(An.current=null,Ln(null)),He.current=!0,ln()),e},update:(t,e)=>{Vn.current?.flush();const n=Gn.current?.update(t,e)??[];return n.length>0&&(He.current=!0,ln()),n},clear:Zn,getData:()=>(Vn.current?.flush(),Gn.current?.getData()??[]),getScales:()=>Gn.current?.scales??null,getExtents:()=>Gn.current?.getExtents()??null,getCustomLayout:()=>Gn.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>Gn.current?.lastCustomLayoutFailure??null}),[qn,Un,Zn,ln]),mt(()=>{if(i){if(x&&fn.length>0&&"object"==typeof fn[0]&&null!==fn[0]){const t="string"==typeof x?x:"coordinates";if(Array.isArray(fn[0][t])){const e=[];for(const n of fn){const r=n[t];if(Array.isArray(r)){const t=n.label||n.id||n.key;if(null!=t)for(const n of r)e.push({...n,_lineGroup:t});else for(const t of r)e.push(t)}}return void Vn.current?.setBoundedData(e)}}Vn.current?.setBoundedData(fn)}},[i,fn,x]);const{canvasRef:tr,interactionCanvasRef:er}=bs(Ue,{storeRef:Gn,dirtyRef:He,hydrated:Ze,wasHydratingFromSSR:Ke,cleanup:()=>Vn.current?.clear(),canvasPaintDependencies:[n,hn,dn,ht,z,ne,Y,F,ie,ln]}),{hoverHandlerRef:nr,hoverLeaveRef:rr,onPointerMove:ir,onPointerLeave:or}=Ue;nr.current=t=>{if(!pn)return;const e=tr.current;if(!e)return;const r=e.getBoundingClientRect(),i=t.clientX-r.left-un.left,a=t.clientY-r.top-un.top;if(0>i||i>hn||0>a||a>dn)return void(An.current&&(An.current=null,Sn.current=null,Ln(null),Be?.(null),ln()));const s=Gn.current;if(!s||0===s.scene.length)return;const c=u(Ft,t.pointerType),h=Jn(s.scene,i,a,c,s.quadtree,s.maxPointRadius),d="multi"===Yt,f=()=>{An.current&&(An.current=null,Sn.current=null,Ln(null),Be&&Be(null),ln())};if(!h&&!d)return void f();const y=d||!h?i:h.x,p=d||!h?a:h.y,g=h?.datum?ye(h.datum,s.resolvedRibbons):{},m=s.scales?.x?.invert,x="function"==typeof m?m(y):void 0;let b=o(g,y,p,null!=x?{xValue:x,xPx:y}:void 0);if(d&&s.scene.length>0&&s.scales){const t=function(t,e,n=30){const r=[];for(const i of t)if("line"===i.type){const t=i;if(2>t.path.length)continue;const o=Qn(Kn(t.path,t.curve),e,n);if(null===o)continue;const a=cr(t.path,e);r.push({node:i,datum:Array.isArray(t.datum)&&t.datum[a]?t.datum[a]:t.datum,x:t.path[a][0],y:o,group:t.group,color:t.style.stroke})}else if("area"===i.type){const t=i;if(!1===t.interactive)continue;if(2>t.topPath.length)continue;const o=Kn(t.topPath,t.curve),a=Kn(t.bottomPath,t.curve),s=Qn(o,e,n);if(null===s)continue;const l=Qn(a,e,n),c=cr(t.topPath,e);r.push({node:i,datum:Array.isArray(t.datum)&&t.datum[c]?t.datum[c]:t.datum,x:t.topPath[c][0],y:s,y0:l??void 0,group:t.group,color:"string"==typeof t.style.stroke?t.style.stroke:"string"==typeof t.style.fill?t.style.fill:void 0})}return r}(s.scene,y,Math.max(c,hn));if(t.length>0){const e=s.scales.y.invert,r=Rn.current,i=m?m(y):y;if(h)b.xValue=i,b.xPx=y;else{const t={xValue:i};"string"==typeof l&&(t[l]=i),b=o(t,y,p,{xValue:i,xPx:y})}b.allSeries=t.map(t=>{const i=e?e(t.y):t.y,o=null!=t.y0?e?e(t.y0):t.y0:void 0;return{group:t.group||"",value:"stackedarea"===n&&null!=o?i-o:i,valuePx:t.y,color:t.color||r,datum:ye(t.datum,s.resolvedRibbons)}})}}h||b.allSeries?.length?(An.current=b,Sn.current=h?.node??null,Ln(b),Be?.(b),ln()):f()},rr.current=()=>{An.current&&(An.current=null,Sn.current=null,Ln(null),Be?.(null),ln())};const ar=pt(()=>{});ar.current=t=>{if(f(t.target))return;if(!je)return;const e=tr.current;if(!e)return;const n=e.getBoundingClientRect(),r=t.clientX-n.left-un.left,i=t.clientY-n.top-un.top;if(0>r||r>hn||0>i||i>dn)return void je(null);const a=Gn.current;if(!a||0===a.scene.length)return void je(null);const s=u(Ft,Pn.current),l=Jn(a.scene,r,i,s,a.quadtree,a.maxPointRadius);if(!l)return void je(null);const c=l.datum||{},h=a.scales?.x?.invert,d="function"==typeof h?h(l.x):void 0;je(o(c,l.x,l.y,null!=d?{xValue:d,xPx:l.x}:void 0),{type:"activate",inputType:bl(Pn.current)})};const sr=bt(t=>ar.current(t),[]),{kbFocusIndexRef:lr,focusedNavPointRef:ur,onKeyDown:hr}=(xr={storeRef:Gn,hoverRef:An,hoveredNodeRef:Sn,setHoverPoint:Ln,customHoverBehavior:Be,customClickBehavior:je,scheduleRender:ln},function({storeRef:t,hoverRef:e,hoveredNodeRef:n,setHoverPoint:r,customHoverBehavior:i,customClickBehavior:o,scheduleRender:a,extractPoints:s,toHover:l}){const c=Sl(-1),u=Sl(null),h=Sl(null),d=Ml(d=>{if(vl(d))return;const f=t.current;if(!f)return;const y=()=>{c.current=-1,u.current=null,e.current=null,n&&(n.current=null),r(null),i?.(null),a()};if(0===f.scene.length)return void(0>c.current||y());let p;if(h.current?.version===f.version)p=h.current.graph;else{const t=s(f.scene);if(0===t.length)return void(0>c.current||y());p=$l(t),h.current={version:f.version,graph:p}}let g=c.current;if(p.flat.length>g||(y(),g=-1),("Enter"===d.key||" "===d.key)&&g>=0)return d.preventDefault(),void o?.(l(p.flat[g],f),{type:"activate",inputType:"keyboard"});if(0>g){if("Escape"===d.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(d.key))return;d.preventDefault(),c.current=0;const t=p.flat[0];u.current=t;const n=l(t,f);return e.current=n,r(n),i?.(n,{type:"focus",inputType:"keyboard"}),void a()}const m=_l(d.key,Pl(p,g),p);if(null===m)return;if(d.preventDefault(),0>m)return void y();c.current=m;const x=p.flat[m];u.current=x;const b=l(x,f);e.current=b,r(b),i?.(b,{type:"focus",inputType:"keyboard"}),a()},[o,i,s,e,n,a,r,t,l]);return{kbFocusIndexRef:c,focusedNavPointRef:u,onKeyDown:d}}({...xr,extractPoints:Ll,toHover:(t,e)=>function(t){return{data:t.datum||{},x:t.x,y:t.y,__semioticHoverData:!0}}({...t,datum:ye(t.datum,e.resolvedRibbons)})})),dr=bt(t=>{Pn.current=t.pointerType,lr.current=-1,ur.current=null,ir(t)},[ur,lr,ir]),fr=bt(t=>{Pn.current="mouse",lr.current=-1,ur.current=null,ir({clientX:t.clientX,clientY:t.clientY,pointerType:"mouse"})},[ur,lr,ir]),gr=bt(t=>{Pn.current=t.pointerType},[]);var xr;sn.current=()=>{if(an.current=null,!cn.isActive)return;const t=tr.current,e=er.current;if(!t||!e)return;const r=Gn.current;if(!r)return;const i=cn.now(),o=r.advanceTransition(Je.current?i+1e6:i),a=!Je.current&&o,s=Ve.current.w!==hn||Ve.current.h!==dn,u=He.current||o||s,h=r.consumeStylePaintPending();let d=!1;const f=r.getLastUpdateResult(),y=Nn.current.beforeCompute(f,a);!u||a&&!s||(r.computeScene({width:hn,height:dn}),Ve.current={w:hn,h:dn},d=!0,Hn()),Nn.current.afterCompute(y,d,s);const p=function(t,e,n,r){const i=r.current,o=!0===t.lastCustomLayoutFailure?.preservedLastGoodScene,a=!o&&t.hasActivePulsesAt(e),s=!(n||o||!a&&!i)&&t.refreshPulse(e);return r.current=a,{changed:s,pending:a}}(r,i,d,qe),g=As(),m=Wn.current.resolve(t);Rn.current=m.primary;const x=yr(pe,r.lastIngestTime>0?i-r.lastIngestTime:0),b=pe&&x.isStale;if(u||h||p.changed){const e=ws(t,tn,un,g);if(e){if(e.clearRect(-un.left,-un.top,tn[0],tn[1]),pe&&1>x.alpha&&(e.globalAlpha=x.alpha),xa(e,{background:z,hasBackgroundGraphics:!!ne,themeBackground:m.background,x:-un.left,y:-un.top,width:tn[0],height:tn[1]}),e.save(),"function"==typeof e.rect&&(e.beginPath(),e.rect(0,0,hn,dn),e.clip()),ie&&r.scales)for(const t of ie)e.save(),t(e,r.scene,r.scales,{width:hn,height:dn}),e.restore();const t=Ie?ol.custom:ol[n];cl({context:e,nodes:r.scene,renderMode:F,pixelRatio:g,paintBuiltIn:n=>{if(t&&r.scales)for(const i of t)i(e,n,r.scales,{width:hn,height:dn})}}),e.restore(),pe&&1>x.alpha&&(e.globalAlpha=1)}}const v=!!(pn&&An.current&&r.scales),k=!!(Sn.current&&Array.isArray(Dt)&&Dt.some(t=>t&&"object"==typeof t&&"highlight"===t.type)),w=v||k;if(w||En.current){const t=ws(e,tn,un,g);if(t&&(t.clearRect(-un.left,-un.top,tn[0],tn[1]),v&&An.current&&function(t,e,n,r,i,o,a){if(!1===i.crosshair)return;const s=e.allSeries,l=s&&s.length>0,c=e.xPx??e.x;t.save();const u="object"==typeof i.crosshair?i.crosshair:{};if(t.strokeStyle=u.stroke||a.crosshair,t.lineWidth=u.strokeWidth||1,t.setLineDash(u.strokeDasharray?u.strokeDasharray.split(/[\s,]+/).map(Number):[4,4]),t.beginPath(),t.moveTo(l?c:e.x,0),t.lineTo(l?c:e.x,r),t.stroke(),l||(t.beginPath(),t.moveTo(0,e.y),t.lineTo(n,e.y),t.stroke()),t.restore(),l){t.lineWidth=2,t.strokeStyle=a.pointRing;for(const e of s)null!=e.valuePx&&(t.beginPath(),t.arc(c,e.valuePx,4,0,2*Math.PI),t.fillStyle=e.color||a.primary,t.fill(),t.stroke())}else{const n=i.pointColor||function(t){if(!t)return null;if("heatcell"===t.type)return t.fill||null;if("candlestick"===t.type)return t.isUp?t.upColor:t.downColor;const{style:e}=t;if(!e)return null;const n="string"==typeof e.fill?e.fill:null;return"line"===t.type||"area"===t.type?e.stroke||n||null:n||e.stroke||null}(o)||a.primary;t.beginPath(),t.arc(e.x,e.y,4,0,2*Math.PI),t.fillStyle=n,t.fill(),t.strokeStyle=a.pointRing,t.lineWidth=2,t.stroke()}}(t,An.current,hn,dn,"object"==typeof pn?pn:{},Sn.current,m),k&&Sn.current&&Array.isArray(Dt))){const e=Dt.find(t=>t&&"object"==typeof t&&"highlight"===t.type);e&&function(t,e,n,r,i){if(!n)return;const o="group"in n?n.group:void 0;if(void 0!==o)for(const n of e){if("line"!==n.type)continue;if(n.group!==o)continue;if(2>n.path.length)continue;const e="function"==typeof r.style?n.datum?r.style(n.datum):{}:r.style||{};t.save(),t.beginPath(),t.moveTo(n.path[0][0],n.path[0][1]);for(let e=1;n.path.length>e;e++)t.lineTo(n.path[e][0],n.path[e][1]);t.strokeStyle=e.stroke||n.style.stroke||i.primary,t.lineWidth=e.strokeWidth||(n.style.strokeWidth||2)+2,t.globalAlpha=e.opacity??1,t.stroke(),t.restore()}}(t,r.scene,Sn.current,e,m)}En.current=w}u&&t&&t.setAttribute("aria-label",Da(r.scene,n+" chart"));const A=He.current;if(He.current=A&&a&&!d,A&&r.scales){const t=t=>"object"==typeof t&&null!==t&&"function"==typeof t.valueOf?t.valueOf():t;if((!bn||t(bn.x.domain()[0])!==t(r.scales.x.domain()[0])||t(bn.x.domain()[1])!==t(r.scales.x.domain()[1])||t(bn.y.domain()[0])!==t(r.scales.y.domain()[0])||t(bn.y.domain()[1])!==t(r.scales.y.domain()[1])||bn.x.range()[0]!==r.scales.x.range()[0]||bn.x.range()[1]!==r.scales.x.range()[1]||bn.y.range()[0]!==r.scales.y.range()[0]||bn.y.range()[1]!==r.scales.y.range()[1])&&vn(r.scales),Ce){const t=r.getData(),e="function"==typeof l?l:t=>t[l||"x"],n="function"==typeof c?c:t=>t[c||"y"];Fn(t.map(t=>e(t)).filter(t=>"number"==typeof t&&isFinite(t))),Bn(t.map(t=>n(t)).filter(t=>"number"==typeof t&&isFinite(t)))}}!((Bt&&Bt.length>0||Ie)&&(d||a))||!d&&33>i-xn.current||(mn(t=>t+1),xn.current=i),pe?.showBadge&&In(!!b),(a||null!=r.activeTransition||p.pending)&&ln()},pr(pe,Gn,He,ln,On,In);const br=xt(()=>{if(Mt||Pt)return;const t=Gn.current;return t?.xIsDate&&bn?Cs(bn.x.domain()):void 0},[Mt,Pt,bn]),vr=Mt||Pt||br,kr=pn&&Cn?Rt?Rt(Cn):Wl(xl,{hover:Cn}):null,wr=kr?Wl(ns,{x:Cn.x,y:Cn.y,containerWidth:hn,containerHeight:dn,margin:un,className:"stream-frame-tooltip",children:kr}):null,Ar=ur.current,Mr=Wl(Qa,{active:lr.current>=0,hoverPoint:Cn,margin:un,size:tn,shape:Ar?.shape,width:Ar?.w,height:Ar?.h}),Sr=$s(l,_,"__semiotic_resolvedX","__semiotic_resolvedTime"),$r=$s(c,M,"__semiotic_resolvedY","__semiotic_resolvedValue"),Pr=Sr.key,_r=$r.key,Cr=function(t,e,n){return r=>{if(!r||!n||!t.fn&&!e.fn)return r;let i=!1;const o=r.map(n=>{const r=t.fn&&t.key&&!(t.key in n),o=e.fn&&e.key&&!(e.key in n);if(!r&&!o)return n;i=!0;const a={...n};return r&&(a[t.key]=t.fn(n)),o&&(a[e.key]=e.fn(n)),a});return i?o:r}}(Sr,$r,Bt&&Bt.length>0||!1);if(ta||!Ze&&Ke){const t=Gn.current;t&&i&&(t.ingest({inserts:fn,bounded:!0}),t.computeScene({width:hn,height:dn}));const e=t?.scene??[],n=t?.scales??null,r=ks(re,tn,un,n),o=ks(ne,tn,un,n),a=vr||(()=>{if(t?.xIsDate&&n)return Cs(n.x.domain())})();return El("div",{ref:Qe,className:"stream-xy-frame"+(I?" "+I:""),role:"img","aria-label":We||("string"==typeof ae?ae:"XY chart"),style:{position:"relative",width:E?"100%":tn[0],height:N?"100%":tn[1]},children:[Wl(Ua,{summary:Ee}),El("svg",{xmlns:"http://www.w3.org/2000/svg",width:tn[0],height:tn[1],style:{position:"absolute",left:0,top:0},children:[Wl("g",{transform:`translate(${un.left},${un.top})`,children:o}),El("g",{transform:`translate(${un.left},${un.top})`,children:[z&&Wl("rect",{x:0,y:0,width:hn,height:dn,fill:z}),oe&&n&&oe.map((t,r)=>Wl(yt.Fragment,{children:t(e,n,{width:hn,height:dn})},"svgpre-"+r)),e.map((t,e)=>ul({node:t,index:e,renderMode:F,fallback:()=>Qo(t,e,Ge)})).filter(Boolean)]})]}),Wl(yo,{width:hn,height:dn,totalWidth:tn[0],totalHeight:tn[1],margin:un,scales:n,showAxes:ht,axes:dt,xLabel:ft,yLabel:wt,yLabelRight:At,xFormat:a,yFormat:St||Ct,axisExtent:$t,showGrid:Ht,title:ae,legend:Vt,legendHoverBehavior:qt,legendClickBehavior:Ut,legendHighlightedCategory:Zt,legendIsolatedCategories:Kt,legendPosition:Jt,legendLayout:Qt,foregroundGraphics:_n(r,X(Gn.current?.customLayoutOverlays,Ye??null)),marginalGraphics:Ce,xValues:[],yValues:[],annotations:Bt,onAnnotationActivate:jt,onObservation:Ot??Nt,chartId:It,chartType:"StreamXYFrame",autoPlaceAnnotations:Xt,svgAnnotationRules:Gt,annotationFrame:0,xAccessor:Pr,yAccessor:_r,annotationData:Cr(Gn.current?.getData()),pointNodes:Ls(Gn.current?.scene),curve:"string"==typeof b?b:void 0,linkedCrosshairName:Ne,linkedCrosshairSourceId:Oe})]})}return El("div",{ref:Qe,className:"stream-xy-frame"+(I?" "+I:""),role:"group","aria-label":We||("string"==typeof ae?ae:"XY chart"),tabIndex:0,style:{position:"relative",width:E?"100%":tn[0],height:N?"100%":tn[1],overflow:"visible",touchAction:Il(le)},onKeyDown:hr,children:["production"!==process.env.NODE_ENV&&Gn.current&&Wl($n,{store:Gn.current,diagnostics:Nn.current}),Re&&Wl(Za,{tableId:on}),Re&&Wl(Va,{scene:Gn.current?.scene??[],chartType:n+" chart",tableId:on,chartTitle:"string"==typeof ae?ae:void 0}),Wl(Ua,{summary:Ee}),Wl(Ca,{hoverPoint:Cn}),El("div",{role:"img","aria-label":We||("string"==typeof ae?ae:"XY chart"),style:{position:"relative",width:"100%",height:"100%"},onPointerMove:pn?dr:void 0,onMouseMove:pn?fr:void 0,onPointerLeave:pn?or:void 0,onMouseLeave:pn?or:void 0,onPointerDown:pn||Xe?gr:void 0,onClick:Xe?sr:void 0,children:[Wl(vs,{size:tn,margin:un,children:wn}),Wl(uo,{width:hn,height:dn,totalWidth:tn[0],totalHeight:tn[1],margin:un,scales:bn,showAxes:ht,axes:dt,showGrid:Ht,xFormat:vr,yFormat:St||Ct,axisExtent:$t}),Wl("canvas",{ref:tr,"aria-label":Da(Gn.current?.scene??[],n+" chart"),style:{position:"absolute",left:0,top:0}}),Wl("canvas",{ref:er,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),Wl(yo,{width:hn,height:dn,totalWidth:tn[0],totalHeight:tn[1],margin:un,scales:bn,showAxes:ht,axes:dt,xLabel:ft,yLabel:wt,yLabelRight:At,xFormat:vr,yFormat:St||Ct,axisExtent:$t,showGrid:Ht,title:ae,legend:Vt,legendHoverBehavior:qt,legendClickBehavior:Ut,legendHighlightedCategory:Zt,legendIsolatedCategories:Kt,legendPosition:Jt,legendLayout:Qt,foregroundGraphics:_n(kn,X(Gn.current?.customLayoutOverlays,Ye??null)),marginalGraphics:Ce,xValues:zn,yValues:Yn,annotations:Bt,onAnnotationActivate:jt,onObservation:Ot??Nt,chartId:It,chartType:"StreamXYFrame",autoPlaceAnnotations:Xt,svgAnnotationRules:Gt,annotationFrame:gn,xAccessor:Pr,yAccessor:_r,annotationData:Cr(Gn.current?.getData()),pointNodes:Ls(Gn.current?.scene),curve:"string"==typeof b?b:void 0,underlayRendered:!0,canvasObscuresUnderlay:!!ma({background:z,hasBackgroundGraphics:!!ne,themeBackground:en?.colors.background}),linkedCrosshairName:Ne,linkedCrosshairSourceId:Oe}),(le||ce)&&Wl(_t,{width:hn,height:dn,totalWidth:tn[0],totalHeight:tn[1],margin:un,dimension:le?.dimension??"xy",scales:bn,onBrush:ce??(()=>{}),binSize:A,snap:le?.snap,binBoundaries:le?.binBoundaries??("bar"===n?Gn.current?.getBinBoundaries():void 0),snapDuring:le?.snapDuring,streaming:"streaming"===r}),pe?.showBadge&&Wl(mr,{isStale:On,position:pe.badgePosition}),Mr,wr]})]})}));zl.displayName="StreamXYFrame";var Fl=zl;import*as Yl from"react";import{jsx as Bl,jsxs as jl}from"react/jsx-runtime";function Xl({componentName:t,message:e,diagnosticHint:n,width:r,height:i}){return Bl("div",{role:"alert",style:{width:r,height:Math.max(i,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:jl("div",{style:{textAlign:"center",maxWidth:400},children:[Bl("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:t}),Bl("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:e}),n&&Bl("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:n})]})})}import{jsx as Gl}from"react/jsx-runtime";var Hl=class extends Yl.Component{constructor(t){super(t),this.state={error:null}}static getDerivedStateFromError(t){return{error:t}}componentDidCatch(t,e){this.props.onError?.(t,e)}render(){if(this.state.error){const{fallback:t}=this.props,e=this.state.error;return"function"==typeof t?t(e):void 0!==t?t:Gl(Xl,{componentName:"ChartErrorBoundary",message:e.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}};import{jsx as Vl}from"react/jsx-runtime";function ql({componentName:t,width:e,height:n,children:r}){return Vl(Hl,{fallback:r=>Vl(Xl,{componentName:t,message:r.message,width:e,height:n}),children:r})}"undefined"!=typeof process&&process;var Ul={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"},Zl={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Kl(t,e,n,r){return!1===r||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?Vl("div",{style:{...Ul,width:e,height:n},children:r||"No data available"}):null}function Jl(t,e,n,r){if(!t)return null;if(!1===r)return null;if(null!=r)return Vl("div",{style:{width:e,height:n,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:r});const i=Math.min(5,Math.floor(n/40)),o=Math.max(8,Math.floor(n/(3*i))),a=Math.max(6,Math.floor(n/(2.5*i))),s=Math.floor((n-(i*(o+a)-a))/2);return Vl("div",{style:{width:e,height:n,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:i},(t,n)=>Vl("div",{className:"semiotic-loading-bar",style:{...Zl,position:"absolute",top:s+n*(o+a),left:Math.floor(.1*e),width:30+(37*n+13)%50+"%",height:o,opacity:.5+n%2*.2}},n))})}function Ql(t){return t?"string"==typeof t?{name:t}:t:null}import{useId as tc,useMemo as ec,useCallback as nc}from"react";function rc(t){const e=[];for(const[n,r]of Object.entries(t.fields))if("point"===r.type)e.push(t=>r.values.has(t[n]));else{const[t,i]=r.range;e.push(e=>{const r=e[n];return r>=t&&i>=r})}return t=>e.every(e=>e(t))}function ic(t,e){let n=t.get(e);return n||(n={name:e,resolution:"union",clauses:new Map},t.set(e,n)),n}function oc(t,e){if(t.type!==e.type)return!1;if("interval"===t.type&&"interval"===e.type)return t.range[0]===e.range[0]&&t.range[1]===e.range[1];if("point"===t.type&&"point"===e.type){if(t.values.size!==e.values.size)return!1;for(const n of t.values)if(!e.values.has(n))return!1;return!0}return!1}var[ac,sc]=ot(t=>({selections:new Map,setClause(e,n){t(t=>{const r=t.selections.get(e),i=r?.clauses.get(n.clientId);if(i&&function(t,e){if(t.clientId!==e.clientId||t.type!==e.type)return!1;const n=Object.entries(t.fields);if(n.length!==function(t){let e=0;for(const n in t)e++;return e}(e.fields))return!1;for(const[t,r]of n){const n=e.fields[t];if(!n||!oc(r,n))return!1}return!0}(i,n))return{};const o=new Map(t.selections),a=ic(o,e),s=new Map(a.clauses);return s.set(n.clientId,n),o.set(e,{...a,clauses:s}),{selections:o}})},clearClause(e,n){t(t=>{const r=t.selections.get(e);if(!r||!r.clauses.has(n))return{};const i=new Map(t.selections),o=new Map(r.clauses);return o.delete(n),i.set(e,{...r,clauses:o}),{selections:i}})},setResolution(e,n){t(t=>{const r=t.selections.get(e);if(r?.resolution===n)return{};const i=new Map(t.selections),o=ic(i,e);return i.set(e,{...o,resolution:n}),{selections:i}})},clearSelection(e){t(t=>{const n=t.selections.get(e);if(!n||0===n.clauses.size)return{};const r=new Map(t.selections);return r.set(e,{...n,clauses:new Map}),{selections:r}})}}));function lc(t){const e=tc(),n=t.clientId||e,{name:r}=t,i=sc(t=>t.selections.get(r)),o=sc(t=>t.setClause),a=sc(t=>t.clearClause),s=ec(()=>!!i&&i.clauses.size>0,[i]);return{predicate:ec(()=>i&&0!==i.clauses.size?function(t,e){const n=[];for(const[r,i]of t.clauses)"crossfilter"===t.resolution&&r===e||n.push(rc(i));return 0===n.length?()=>!0:"intersect"===t.resolution?t=>n.every(e=>e(t)):t=>n.some(e=>e(t))}(i,n):()=>!0,[i,n]),isActive:s,selectPoints:nc(t=>{const e={};let i=!1;for(const[n,r]of Object.entries(t))e[n]={type:"point",values:new Set(r)},i=!0;i&&o(r,{clientId:n,type:"point",fields:e})},[n,r,o]),selectInterval:nc(t=>{const e={};let i=!1;for(const[n,r]of Object.entries(t))e[n]={type:"interval",range:r},i=!0;i&&o(r,{clientId:n,type:"interval",fields:e})},[n,r,o]),clear:nc(()=>{a(r,n)},[a,r,n]),clientId:n}}function cc(t){return 2===t.length&&"number"==typeof t[0]&&"number"==typeof t[1]}function uc(t){const{name:e,xField:n,yField:r}=t,{predicate:i,isActive:o,selectInterval:a,clear:s}=lc({name:e,fields:[n,r].filter(Boolean)}),l=n&&r?"xyBrush":n?"xBrush":"yBrush",c=nc(t=>{if(!t)return void s();const e={};"xyBrush"===l&&function(t){return 2===t.length&&Array.isArray(t[0])&&2===t[0].length&&Array.isArray(t[1])&&2===t[1].length}(t)?(n&&(e[n]=[Math.min(t[0][0],t[1][0]),Math.max(t[0][0],t[1][0])]),r&&(e[r]=[Math.min(t[0][1],t[1][1]),Math.max(t[0][1],t[1][1])])):"xBrush"===l&&cc(t)?n&&(e[n]=[Math.min(t[0],t[1]),Math.max(t[0],t[1])]):"yBrush"===l&&cc(t)&&r&&(e[r]=[Math.min(t[0],t[1]),Math.max(t[0],t[1])]),at(e)&&a(e)},[l,n,r,a,s]);return{brushInteraction:ec(()=>({brush:l,during:c,end:c}),[l,c]),predicate:i,isActive:o,clear:s}}var hc={enabled:!0,tapToSelect:!0,tapToLockTooltip:!0,clearSelection:"backgroundTap",targetSize:44,snap:"nearestDatum",brushHandleSize:44,standardControls:!1,enabled:!1,tapToSelect:!1,tapToLockTooltip:!1};function dc(t,e={}){const n=e.mobileSemantics?.interaction,r="number"==typeof n?.targetSize?n.targetSize:"number"==typeof e.mobileSemantics?.minimumHitTarget?e.mobileSemantics.minimumHitTarget:void 0,i="mobile"===e.mode||"number"==typeof e.width&&480>=e.width,o=!!n||void 0!==r,a=t&&"object"==typeof t?t:void 0;if(!1===t||!1===a?.enabled||void 0===t&&!i&&!o)return hc;const s=a??{};return{enabled:!0,tapToSelect:s.tapToSelect??!0,tapToLockTooltip:s.tapToLockTooltip??!0,clearSelection:s.clearSelection??"backgroundTap",targetSize:s.targetSize??r??44,snap:s.snap??"nearestDatum",brushHandleSize:s.brushHandleSize??44,standardControls:s.standardControls??!1}}var fc={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 yc(t){return"string"==typeof t&&Object.prototype.hasOwnProperty.call(fc,t)}function pc(t,e,n){const r=fc[t||"primary"],i=t&&"primary"!==t||!n?.width?r.width:n.width,o=t&&"primary"!==t||!n?.height?r.height:n.height,a={...e,mode:t},s=x(a,{width:e.width??i,height:e.height??o}).props,l=s.mode||t||"primary",c=fc[l],u="context"===l||"sparkline"===l,h="primary"===l&&n?.width?n.width:c.width;return{mode:l,width:s.width??h,height:s.height??("primary"===l&&n?.height?n.height:c.height),showAxes:s.showAxes??c.showAxes,showGrid:s.showGrid??c.showGrid,enableHover:s.enableHover??(!!s.linkedHover||c.enableHover),showLegend:s.showLegend??c.showLegend,showLabels:s.showLabels??c.showLabels,title:u?void 0:s.title,description:s.description,summary:s.summary,accessibleTable:s.accessibleTable,xLabel:u?void 0:s.xLabel,yLabel:u?void 0:s.yLabel,categoryLabel:u?void 0:s.categoryLabel,valueLabel:u?void 0:s.valueLabel,marginDefaults:gc(c.marginDefaults,s.showCategoryTicks,s.orientation),compactMode:u,mobileInteraction:dc(s.mobileInteraction,{mode:l,width:s.width??h,mobileSemantics:s.mobileSemantics}),mobileSemantics:s.mobileSemantics}}function gc(t,e,n){if(!1!==e)return t;const r={...t};return"horizontal"===n?r.left=Math.min(r.left,15):r.bottom=Math.min(r.bottom,15),r}import{useMemo as mc,useCallback as xc,useState as bc}from"react";import{createContext as vc,useContext as kc,useEffect as wc,useId as Ac,useLayoutEffect as Mc,useMemo as Sc,useRef as $c,useState as Pc,useCallback as _c}from"react";import{createContext as Cc,useContext as Lc,useMemo as Tc}from"react";import{jsx as Dc}from"react/jsx-runtime";var Rc=Cc(null);function Wc(){return Lc(Rc)}import{jsx as Ec,jsxs as Nc}from"react/jsx-runtime";var Oc=vc(!1);vc(!1);var Ic=vc(null),zc="undefined"==typeof window?wc:Mc;function Fc(t,e){if(!e)return[];const n=new Set;for(const r of t){const t="function"==typeof e?e(r):r[e];null!=t&&n.add(t+"")}return Array.from(n)}function Yc({data:t,colorBy:e,colorScale:n,showLegend:r,legendPosition:i="right",userMargin:o,defaults:a={top:50,bottom:60,left:70,right:40},categories:s,additionalLegend:l,chartWidth:c,legendLayout:u,hasTitle:h=!1,axisChrome:d}){const f=kc(Oc),y=null!==kc(Ic),p=void 0!==r?r:!f&&!!e,g=!!e&&(p||y),m=mc(()=>g?void 0!==s?s:Fc(t,e):[],[s,e,t,g]);!function(t){const e=kc(Ic),n=Ac(),r=function(t){const e=new Set,n=[];for(const r of t)e.has(r)||(e.add(r),n.push(r));return n}(t),i=$c([]);(function(t,e){if(t.length!==e.length)return!1;for(let n=0;t.length>n;n++)if(t[n]!==e[n])return!1;return!0})(i.current,r)||(i.current=r);const o=i.current;zc(()=>{if(e)return()=>e.unregisterCategories(n)},[e,n]),zc(()=>{e&&e.registerCategories(n,o)},[e,n,o])}(y&&e?m:[]);const x=mc(()=>{if(!p||!e)return;const r=function({data:t,colorBy:e,colorScale:n,getColor:r,strokeColor:i,strokeWidth:o,categories:a}){return{legendGroups:[{styleFn:t=>{const e=t.color||"#333",n={fill:e,stroke:e};return void 0!==i&&(n.stroke=i),void 0!==o&&(n.strokeWidth=o),n},type:"fill",items:(a&&a.length>0?a:Array.from(new Set(t.map(t=>"function"==typeof e?e(t):t[e])))).map((i,o)=>{const a=t.find("function"==typeof e?t=>e(t)===i:t=>t[e]===i),s=a?r(a,e,n):n?n(i):It[o%It.length];return{label:i+"",color:s}}),label:""}]}}({data:t,colorBy:e,colorScale:n,getColor:Yt,categories:m});return 0!==r.legendGroups.reduce((t,e)=>t+e.items.length,0)?r:void 0},[p,e,t,n,m]),b=mc(()=>wr(x,l),[x,l]),{hasAxis:v,hasAxisLabel:k,rotatedTicks:w}=d??{},A=mc(()=>{const t="number"==typeof o?{top:o,bottom:o,left:o,right:o}:o??{},e=e=>{const n=t[e];return"number"==typeof n?n:a[e]},n={top:e("top"),right:e("right"),bottom:e("bottom"),left:e("left")},r=e=>"number"==typeof t[e];if(b){const t=Dr(b,u),e=void 0===v?{hasAxis:!0,hasAxisLabel:!0}:{hasAxis:v,hasAxisLabel:k,rotatedTicks:w},o=Tr(b,Math.max(1,(c??600)-n.left-n.right),u)+_r(b)+Lr("bottom"===i?e:void 0,u)+("top"===i&&h?24:0);"right"===i&&!r("right")&&t>n.right?n.right=t:"left"===i&&!r("left")&&t>n.left?n.left=t:"top"!==i||r("top")?"bottom"!==i||r("bottom")||(n.bottom=Math.max(n.bottom,80,o)):n.top=Math.max(n.top,50,o)}return n},[a,o,b,i,c,u,h,v,k,w]);return{legend:b,margin:A,legendPosition:i}}function Bc(t,e,n){const[r,i]=bc(null),[o,a]=bc(new Set),s=mc(()=>new Set,[]),l=xc(e=>{"highlight"===t&&i(e?e.label:null)},[t]),c=xc(e=>{"isolate"===t&&a(t=>{const r=new Set(t);return r.has(e.label)?r.delete(e.label):r.add(e.label),r.size===n.length?new Set:r})},[t,n.length]),u=mc(()=>{if(!t||"none"===t||!e)return null;const n="string"==typeof e?e:null;return"highlight"===t&&null!=r?{isActive:!0,predicate:t=>{const i=n?t[n]:"function"==typeof e?e(t):null;return("string"==typeof i?i:(i??"")+"")===r}}:"isolate"===t&&o.size>0?{isActive:!0,predicate:t=>{const r=n?t[n]:"function"==typeof e?e(t):null;return o.has("string"==typeof r?r:(r??"")+"")}}:null},[t,e,r,o]);return{highlightedCategory:"highlight"===t?r:null,isolatedCategories:"isolate"===t?o:s,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}import{useMemo as jc,useCallback as Xc,useState as Gc,useId as Hc,useEffect as Vc,useRef as qc}from"react";function Uc(t,e,n){const r=t.xValue??e?.[n];if(null==r)return null;const i=Number(r);return Number.isFinite(i)?i:null}function Zc(t){let e=t.data||t.datum||t;return Array.isArray(e)&&(e=e[0]),null!=t.xValue&&e&&"object"==typeof e&&!Array.isArray(e)&&null==e.xValue?{...e,xValue:t.xValue}:e||{}}function Kc(t){if(!t)return!1;for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!0;return!1}var Jc=[];function Qc(){const t=e(),n=t?.colors?.categorical;return n&&n.length>0?n:void 0}function tu(t,e,n,r,i){if(t)return t;if(n&&"object"==typeof n&&!Array.isArray(n)){const t=Bt(n,r);if(t)return t}let o;if(Array.isArray(n))o=n;else if(e&&e.length>0)o=e;else if("string"==typeof n){const t=Wt[n];Array.isArray(t)&&(o=t)}return o&&0!==o.length?null!=r?(i.has(r)||i.set(r,i.size),o[i.get(r)%o.length]):o[0]:Nt}function eu(t,e,n){const r=Wc(),i=Qc();return jc(()=>{if(!e)return;const o=r??void 0,a=n??(i&&i.length>0?i:void 0)??"category10";if(0!==t.length){if("function"==typeof e){const n=Array.from(new Set(t.map(t=>e(t)+"")));if(o&&Kc(o)){const t=jt(n.map(t=>({_cat:t})),"_cat",a);return e=>o[e]||t(e)}return jt(n.map(t=>({_cat:t})),"_cat",a)}if(o&&Kc(o)){const n=jt(t,e,a);return t=>o[t]||n(t)}return jt(t,e,a)}if(o&&Kc(o)){const t=jt([{_:"a"}],"_",a);return e=>o[e]||t(e)}},[t,e,n,r,i])}function nu({selection:t,linkedHover:e,fallbackFields:n=Jc,unwrapData:r=!1,onObservation:i,chartType:o,chartId:a,onClick:s,hoverHighlight:l,colorByField:c,mobileInteraction:u}){const h=Hc(),d=jc(()=>function(t,e){return t?!0===t?{name:"hover",fields:e||[]}:"string"==typeof t?{name:t,fields:e||[]}:{name:t.name||"hover",fields:t.fields||e||[],mode:t.mode,xField:t.xField,seriesField:t.seriesField}:null}(e,n),[e,n]),f=jc(()=>"series"===d?.mode?[d.seriesField||c||n[0]].filter(t=>!!t):d?.fields||n,[d,c,n]),y=lc({name:t?.name||"__unused__",fields:f}),p=function(t){const e=t.name||"hover",{fields:n}=t,{predicate:r,isActive:i,selectPoints:o,clear:a}=lc({name:e,fields:n});return{onHover:nc(t=>{if(!t)return void a();const e={};for(const r of n){const n=t[r];void 0!==n&&(e[r]=[n])}at(e)&&o(e)},[n,o,a]),predicate:r,isActive:i}}({name:d?.name||"hover",fields:f}),g=w(t=>t.pushObservation),m=Xc(t=>{i?.(t),g?.(t)},[i,g]),x=t?{isActive:y.isActive,predicate:y.predicate}:null,[b,v]=Gc(null),k=qc(!1),A=c||n[0],M=jc(()=>{if(!l||null==b||!A)return null;const t=b,e=A;return{isActive:!0,predicate:n=>("string"==typeof n[e]?n[e]:(n[e]??"")+"")===t}},[l,b,A]),S=Xc((t,n)=>{const r=!t&&k.current&&!!u?.enabled&&u.tapToLockTooltip;if(e)if(t){let e=t.data||t.datum||t;if(Array.isArray(e)&&(e=e[0]),"x-position"===d?.mode&&d.xField){const n=Uc(t,e,d.xField);null!=n&&function(t,e,n){const r=Yi.positions.get(t);r?.locked||r&&r.xValue===e&&r.sourceId===n||(Yi={positions:new Map(Yi.positions).set(t,{xValue:e,sourceId:n})},ji())}(d.name||"hover",n,h)}"x-position"!==d?.mode&&p.onHover(e)}else"x-position"!==d?.mode||r||Xi(d.name||"hover",h),"x-position"===d?.mode||r||p.onHover(null);if(l&&A)if(t){let e=t.data||t.datum||t;Array.isArray(e)&&(e=e[0]);const n=e?.[A];v(null!=n?n+"":null)}else r||v(null);(i||g)&&kl({onObservation:m,datum:t?Zc(t):null,x:t?.x,y:t?.y,chartType:o||"unknown",chartId:a,context:n})},[e,p,d,h,i,o,a,g,m,l,A,u]),$=Xc((n=!0)=>{k.current=!1,e&&"x-position"!==d?.mode&&p.onHover(null),t&&u?.tapToSelect&&y.clear(),n&&l&&v(null),"x-position"===d?.mode&&(Gi(d.name||"hover",h),Xi(d.name||"hover",h))},[e,d,p,t,u,y,l,h]),P=Xc((n,r)=>{const c=!!u?.enabled&&(u.tapToLockTooltip||u.tapToSelect),x=!!u?.enabled&&"backgroundTap"===u.clearSelection;if("x-position"===d?.mode&&d.xField&&n){let t=n.data||n.datum||n;Array.isArray(t)&&(t=t[0]);const e=Uc(n,t,d.xField);null!=e&&function(t,e,n){const r=Yi.positions.get(t);if(r?.locked){const e=new Map(Yi.positions);return e.delete(t),Yi={positions:e},ji(),!1}Yi={positions:new Map(Yi.positions).set(t,{xValue:e,sourceId:n,locked:!0})},ji()}(d.name||"hover",e,h)}if(c)if(n){k.current=!0;const r=Zc(n);if(e&&"x-position"!==d?.mode&&p.onHover(r),t&&u?.tapToSelect&&f.length>0){const t={};for(const e of f){const n=r[e];void 0!==n&&(t[e]=[n])}Kc(t)&&y.selectPoints(t)}if(l&&A){const t=r?.[A];v(null!=t?t+"":null)}}else x&&$();if(n||x){if(n&&s){let t=n.data||n.datum||n;Array.isArray(t)&&(t=t[0]),s(t,{x:n.x??0,y:n.y??0})}(i||g)&&wl({onObservation:m,datum:n?Zc(n):null,x:n?.x,y:n?.y,chartType:o||"unknown",chartId:a,context:r})}},[s,i,g,m,o,a,d,h,u,e,p,t,y,f,l,A,$]);return Vc(()=>{if(!u?.enabled||"undefined"==typeof document)return;const t=t=>{"Escape"===t.key&&k.current&&$()};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[u?.enabled,$]),Vc(()=>()=>{k.current&&$(!1)},[$]),Vc(()=>{if("x-position"!==d?.mode)return;const t=d.name||"hover";return()=>{Gi(t,h),Xi(t,h)}},[d?.mode,d?.name,h]),{activeSelectionHook:x,hoverSelectionHook:M,customHoverBehavior:S,customClickBehavior:P,crosshairSourceId:h}}function ru(t,e){const n="object"==typeof t&&null!==t?t:void 0;if("x-position"===n?.mode)return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:e}}function iu(t,e,n){return pc(t,e,n)}function ou(t){const{title:e,description:n,summary:r,accessibleTable:i,className:o,animate:a,axisExtent:s,autoPlaceAnnotations:l}=t,c={};return e&&(c.title=e),n&&(c.description=n),r&&(c.summary=r),void 0!==i&&(c.accessibleTable=i),o&&(c.className=o),null!=a&&(c.animate=a),void 0!==s&&(c.axisExtent=s),void 0!==l&&(c.autoPlaceAnnotations=l),c}function au(t){const{linkedHover:e,selection:n,onObservation:r,onClick:i,hoverRadius:o,hoverHighlight:a,forceHoverBehavior:s,forceClickBehavior:l,mobileInteraction:c,customHoverBehavior:u,customClickBehavior:h,linkedHoverInClickPredicate:d=!0}=t,f={};r&&(f.annotationObservationCallback=r);const y=c?.enabled?Math.max(o??30,Math.ceil((c.targetSize||44)/2),24):o;return(s||e||r||i||a)&&(f.customHoverBehavior=u),h&&(l||(d?r||i||e:r||i)||c?.enabled&&(c.tapToSelect||c.tapToLockTooltip)&&(e||a||n))&&(f.customClickBehavior=h),null!=y&&(f.hoverRadius=y),f}function su(t,e,n){const r="function"==typeof e?e(t):t[e??n];if(null==r)return null;if(r instanceof Date)return r.getTime();if("string"==typeof r&&""===r.trim())return null;const i=Number(r);return Number.isFinite(i)?i:null}function lu({data:t,valueAccessor:e,timeAccessor:n,binSize:r,valueExtent:i,extentPadding:o}){if(i)return[i[1],i[0]];if(!t||0===t.length)return;const a=new Map;for(const i of t){const t=su(i,n,"time"),o=su(i,e,"value");if(null==t||null==o)continue;const s=Math.floor(t/r)*r;a.set(s,(a.get(s)??0)+o)}let s=0;for(const t of a.values())s=Math.max(s,t);return[s>0?s+s*(o??.1):1,0]}function cu(t,e){var n=t.get(e);if(!n)throw Error("missing: "+e);return n}function uu(t,e){var n,r=[],i=[],o=[],a={},s=[];function l(t){o[t]=!1,a.hasOwnProperty(t)&&Object.keys(a[t]).forEach(function(e){delete a[t][e],o[e]&&l(e)})}function c(t){var e,r,h=!1;for(i.push(t),o[t]=!0,e=0;s[t].length>e;e++)(r=s[t][e])===n?(u(n,i),h=!0):o[r]||(h=c(r));if(h)l(t);else for(e=0;s[t].length>e;e++){var d=a[r=s[t][e]];d||(a[r]=d={}),d[r]=!0}return i.pop(),h}function u(t,n){var i=[].concat(n).concat(t);e?e(i):r.push(i)}function h(e){!function(e){for(var n=0;t.length>n;n++)n>=e&&t[n]||(t[n]=[]),t[n]=t[n].filter(function(t){return t>=e})}(e);for(var n,r=function(t){for(var e=t.length,n=Array(e),r=Array(e),i=Array(e),o=Array(e),a=Array(e),s=Array(e),l=0;e>l;++l)n[l]=-1,r[l]=0,i[l]=!1,o[l]=0,a[l]=-1,s[l]=[];var c,u=0,h=[],d=[];function f(e){var l=[e],c=[e];for(n[e]=r[e]=u,i[e]=!0,u+=1;c.length>0;){var f=t[e=c[c.length-1]];if(f.length>o[e]){for(var y=o[e];f.length>y;++y){var p=f[y];if(0>n[p]){n[p]=r[p]=u,i[p]=!0,u+=1,l.push(p),c.push(p);break}i[p]&&(r[e]=0|Math.min(r[e],r[p])),0>a[p]||s[e].push(a[p])}o[e]=y}else{if(r[e]===n[e]){var g=[],m=[],x=0;for(y=l.length-1;y>=0;--y){var b=l[y];if(i[b]=!1,g.push(b),m.push(s[b]),x+=s[b].length,a[b]=h.length,b===e){l.length=y;break}}h.push(g);var v=Array(x);for(y=0;m.length>y;y++)for(var k=0;m[y].length>k;k++)v[--x]=m[y][k];d.push(v)}c.pop()}}}for(l=0;e>l;++l)0>n[l]&&f(l);for(l=0;d.length>l;l++){var y=d[l];if(0!==y.length){y.sort(function(t,e){return t-e}),c=[y[0]];for(var p=1;y.length>p;p++)y[p]!==y[p-1]&&c.push(y[p]);d[l]=c}}return{components:h,adjacencyList:d}}(t),i=r.components.filter(function(t){return t.length>1}),o=1/0,a=0;i.length>a;a++)for(var s=0;i[a].length>s;s++)o>i[a][s]&&(o=i[a][s],n=a);var l=i[n];return!!l&&{leastVertex:o,adjList:t.map(function(t,e){return-1===l.indexOf(e)?[]:t.filter(function(t){return-1!==l.indexOf(t)})})}}n=0;for(var d=t.length;d>n;){var f=h(n);if(n=f.leastVertex,s=f.adjList){for(var y=0;s.length>y;y++)for(var p=0;s[y].length>p;p++){var g=s[y][p];o[+g]=!1,a[g]={}}c(n),n+=1}else n=d}return e?void 0:r}function hu(t){return t.y0-t.y1>0?"up":"down"}function du(t,e){return e(t.source)==e(t.target)}function fu(t){var e=0;t.source.sourceLinks.forEach(function(t){e=t.circular?e+1:e});var n=0;return t.target.targetLinks.forEach(function(t){n=t.circular?n+1:n}),1>=e&&1>=n}function yu(t){return t.target.x0-t.source.x1}function pu(t,e){var n=mu(t),r=yu(e)/Math.tan(n);return"up"==hu(t)?t.y1-r:t.y1+r}function gu(t,e){var n=mu(t),r=yu(e)/Math.tan(n);return"up"==hu(t)?t.y1+r:t.y1-r}function mu(t){var e=Math.abs(t.y1-t.y0);return Math.atan(Math.abs(t.target.x0-t.source.x1)/e)}function xu(t,e){return e(t)}function bu(t){return ku(t.source)}function vu(t){return ku(t.target)}function ku(t){return(t.y0+t.y1)/2}function wu(t){return t.virtual?0:t.value}function Au(t,e){var n=0;t.sourceLinks.forEach(function(t){n=t.circular&&!du(t,e)?n+1:n});var r=0;return t.targetLinks.forEach(function(t){r=t.circular&&!du(t,e)?r+1:r}),n+r}function Mu(t){return t.target.depth}function Su(t,e){return t.sourceLinks.length?t.depth:e-1}function $u(t,e){return t.y0-e.y0}function Pu(t,e){return e.y0-t.y0}function _u(t,e){return t.y1-e.y1}function Cu(t,e){return e.y1-t.y1}function Lu(t,e){return Du(t.source,e.source)||t.index-e.index}function Tu(t,e){return Du(t.target,e.target)||t.index-e.index}function Du(t,e){return t.partOfCycle===e.partOfCycle?t.y0-e.y0:"top"===t.circularLinkType||"bottom"===e.circularLinkType?-1:1}function Ru(t,e){return Wu(t)==Wu(e)?"bottom"==t.circularLinkType?Pu(t,e):$u(t,e):Wu(e)-Wu(t)}function Wu(t){return t.target.column-t.source.column}function Eu(t,e){return Nu(t)==Nu(e)}function Nu(t){return t.y0-t.y1>0?"up":"down"}import{min as Ou}from"d3-array";function Iu(t,e,n,r,i){let o=t;var a=Math.max(8,.15*(o.y1-o.y0));o.links.forEach(function(t){t.circular&&(t._circularWidth=Math.min(t.width,a))});var s=Ou(o.links,function(t){return t.source.y0});o.links.forEach(function(t){t.circular&&(t.circularPathData={})});var l=o.links.filter(function(t){return t.circular});return l.sort(function(t,e){return e.value-t.value}),l.forEach(function(t,e){t._circularStub=e>=4}),zu(o.links.filter(function(t){return"top"==t.circularLinkType}),e,n),zu(o.links.filter(function(t){return"bottom"==t.circularLinkType}),e,n),o.links.forEach(function(t){if(t.circular){if(t.circularPathData.arcRadius=t._circularWidth+r,t.circularPathData.rightNodeBuffer=5,t.circularPathData.leftNodeBuffer=5,t.circularPathData.sourceWidth=t.source.x1-t.source.x0,t.circularPathData.sourceX=t.source.x0+t.circularPathData.sourceWidth,t.circularPathData.targetX=t.target.x0,t.circularPathData.sourceY=t.y0,t.circularPathData.targetY=t.y1,du(t,e)&&fu(t))t.circularPathData.rightSmallArcRadius=r+t._circularWidth/2,t.circularPathData.rightLargeArcRadius=r+t._circularWidth/2,t.circularPathData.leftSmallArcRadius=r+t._circularWidth/2,t.circularPathData.leftLargeArcRadius=r+t._circularWidth/2,"bottom"==t.circularLinkType?(t.circularPathData.verticalFullExtent=t.source.y1+i+t.circularPathData.verticalBuffer,t.circularPathData.verticalRightInnerExtent=t.circularPathData.verticalFullExtent-t.circularPathData.rightLargeArcRadius,t.circularPathData.verticalLeftInnerExtent=t.circularPathData.verticalFullExtent-t.circularPathData.leftLargeArcRadius):(t.circularPathData.verticalFullExtent=t.source.y0-i-t.circularPathData.verticalBuffer,t.circularPathData.verticalRightInnerExtent=t.circularPathData.verticalFullExtent+t.circularPathData.rightLargeArcRadius,t.circularPathData.verticalLeftInnerExtent=t.circularPathData.verticalFullExtent+t.circularPathData.leftLargeArcRadius);else{var a=t.source.column,l=t.circularLinkType,c=o.links.filter(function(t){return t.source.column==a&&t.circularLinkType==l});c.sort("bottom"==t.circularLinkType?Pu:$u);var u=0;c.forEach(function(e,i){e.circularLinkID==t.circularLinkID&&(t.circularPathData.rightSmallArcRadius=r+t._circularWidth/2+u,t.circularPathData.rightLargeArcRadius=r+t._circularWidth/2+i*n+u),u+=e._circularWidth||e.width}),a=t.target.column,(c=o.links.filter(function(t){return t.target.column==a&&t.circularLinkType==l})).sort("bottom"==t.circularLinkType?Cu:_u),u=0,c.forEach(function(e,i){e.circularLinkID==t.circularLinkID&&(t.circularPathData.leftSmallArcRadius=r+t._circularWidth/2+u,t.circularPathData.leftLargeArcRadius=r+t._circularWidth/2+i*n+u),u+=e._circularWidth||e.width}),"bottom"==t.circularLinkType?(t.circularPathData.verticalFullExtent=Math.max(o.y1,t.source.y1,t.target.y1)+i+t.circularPathData.verticalBuffer,t.circularPathData.verticalRightInnerExtent=t.circularPathData.verticalFullExtent-t.circularPathData.rightLargeArcRadius,t.circularPathData.verticalLeftInnerExtent=t.circularPathData.verticalFullExtent-t.circularPathData.leftLargeArcRadius):(t.circularPathData.verticalFullExtent=s-i-t.circularPathData.verticalBuffer,t.circularPathData.verticalRightInnerExtent=t.circularPathData.verticalFullExtent+t.circularPathData.rightLargeArcRadius,t.circularPathData.verticalLeftInnerExtent=t.circularPathData.verticalFullExtent+t.circularPathData.leftLargeArcRadius)}t.circularPathData.rightInnerExtent=t.circularPathData.sourceX+t.circularPathData.rightNodeBuffer,t.circularPathData.leftInnerExtent=t.circularPathData.targetX-t.circularPathData.leftNodeBuffer,t.circularPathData.rightFullExtent=t.circularPathData.sourceX+t.circularPathData.rightLargeArcRadius+t.circularPathData.rightNodeBuffer,t.circularPathData.leftFullExtent=t.circularPathData.targetX-t.circularPathData.leftLargeArcRadius-t.circularPathData.leftNodeBuffer}t.path=t.circular?function(t){return"top"==t.circularLinkType?"M"+t.circularPathData.sourceX+" "+t.circularPathData.sourceY+" L"+t.circularPathData.rightInnerExtent+" "+t.circularPathData.sourceY+" A"+t.circularPathData.rightLargeArcRadius+" "+t.circularPathData.rightSmallArcRadius+" 0 0 0 "+t.circularPathData.rightFullExtent+" "+(t.circularPathData.sourceY-t.circularPathData.rightSmallArcRadius)+" L"+t.circularPathData.rightFullExtent+" "+t.circularPathData.verticalRightInnerExtent+" A"+t.circularPathData.rightLargeArcRadius+" "+t.circularPathData.rightLargeArcRadius+" 0 0 0 "+t.circularPathData.rightInnerExtent+" "+t.circularPathData.verticalFullExtent+" L"+t.circularPathData.leftInnerExtent+" "+t.circularPathData.verticalFullExtent+" A"+t.circularPathData.leftLargeArcRadius+" "+t.circularPathData.leftLargeArcRadius+" 0 0 0 "+t.circularPathData.leftFullExtent+" "+t.circularPathData.verticalLeftInnerExtent+" L"+t.circularPathData.leftFullExtent+" "+(t.circularPathData.targetY-t.circularPathData.leftSmallArcRadius)+" A"+t.circularPathData.leftLargeArcRadius+" "+t.circularPathData.leftSmallArcRadius+" 0 0 0 "+t.circularPathData.leftInnerExtent+" "+t.circularPathData.targetY+" L"+t.circularPathData.targetX+" "+t.circularPathData.targetY:"M"+t.circularPathData.sourceX+" "+t.circularPathData.sourceY+" L"+t.circularPathData.rightInnerExtent+" "+t.circularPathData.sourceY+" A"+t.circularPathData.rightLargeArcRadius+" "+t.circularPathData.rightSmallArcRadius+" 0 0 1 "+t.circularPathData.rightFullExtent+" "+(t.circularPathData.sourceY+t.circularPathData.rightSmallArcRadius)+" L"+t.circularPathData.rightFullExtent+" "+t.circularPathData.verticalRightInnerExtent+" A"+t.circularPathData.rightLargeArcRadius+" "+t.circularPathData.rightLargeArcRadius+" 0 0 1 "+t.circularPathData.rightInnerExtent+" "+t.circularPathData.verticalFullExtent+" L"+t.circularPathData.leftInnerExtent+" "+t.circularPathData.verticalFullExtent+" A"+t.circularPathData.leftLargeArcRadius+" "+t.circularPathData.leftLargeArcRadius+" 0 0 1 "+t.circularPathData.leftFullExtent+" "+t.circularPathData.verticalLeftInnerExtent+" L"+t.circularPathData.leftFullExtent+" "+(t.circularPathData.targetY+t.circularPathData.leftSmallArcRadius)+" A"+t.circularPathData.leftLargeArcRadius+" "+t.circularPathData.leftSmallArcRadius+" 0 0 1 "+t.circularPathData.leftInnerExtent+" "+t.circularPathData.targetY+" L"+t.circularPathData.targetX+" "+t.circularPathData.targetY}(t):function(t){var e=t.source.x1,n=t.y0,r=t.target.x0,i=t.y1,o=(e+r)/2;return"M"+e+","+n+"C"+o+","+n+" "+o+","+i+" "+r+","+i}(t)}),o}function zu(t,e,n){t.sort(Ru);var r=t.filter(function(t){return!t._circularStub});return t.forEach(function(t,i){var o=0;if(t._circularStub)t.circularPathData.verticalBuffer=0;else if(du(t,e)&&fu(t))t.circularPathData.verticalBuffer=o+t._circularWidth/2;else{for(var a=0;r.length>a;a++){var s=r[a];if(s!==t&&s.circularPathData&&void 0!==s.circularPathData.verticalBuffer&&Fu(t,s)){var l=s.circularPathData.verticalBuffer+(s._circularWidth||s.width)/2+n;o=l>o?l:o}}t.circularPathData.verticalBuffer=o+t._circularWidth/2}}),t}function Fu(t,e){return t.source.column>=e.target.column&&e.source.column>=t.target.column}import{min as Yu,max as Bu,sum as ju,mean as Xu,group as Gu,groups as Hu}from"d3-array";function Vu(t){return function(){return t}}function qu(t){return t.index}function Uu(t){return t.nodes}function Zu(t){return t.links}function Ku(t,e,n){var r=Hu(t.nodes,function(t){return t.column}).sort(function(t,e){return t[0]-e[0]}).map(function(t){return t[1]});r.forEach(function(i,o){var a=i.length;if(e)i.sort(e);else if(o>0){var s=new Map;i.forEach(function(t,e){var n,r,i,o=(r=0,i=0,(n=t).targetLinks.forEach(function(t){if(!t.circular){var e=t.value||1;i+=ku(t.source)*e,r+=e}}),n.sourceLinks.forEach(function(t){if(!t.circular){var e=t.value||1;i+=ku(t.target)*e,r+=e}}),r>0?i/r:NaN);s.set(t,{bc:o,idx:e})}),i.sort(function(t,e){var n=s.get(t),r=s.get(e),i=n.bc,o=r.bc;if(t.circularLinkType!==e.circularLinkType){if("top"==t.circularLinkType&&"bottom"==e.circularLinkType)return-1;if("bottom"==t.circularLinkType&&"top"==e.circularLinkType)return 1;if("top"==t.circularLinkType)return-1;if("top"==e.circularLinkType)return 1;if("bottom"==t.circularLinkType)return 1;if("bottom"==e.circularLinkType)return-1}return isNaN(i)||isNaN(o)?isNaN(i)?isNaN(o)?n.idx-r.idx:1:-1:i-o})}else i.sort(function(t,e){return t.circularLinkType==e.circularLinkType?Au(e,n)-Au(t,n):"top"==t.circularLinkType&&"bottom"==e.circularLinkType||"top"==t.circularLinkType&&0==e.partOfCycle||0==t.partOfCycle&&"bottom"==e.circularLinkType?-1:0});i.forEach(function(e,i){e.depth==r.length-1&&1==a||0==e.depth&&1==a?(e.y0=t.y1/2-e.value*t.ky,e.y1=e.y0+e.value*t.ky):e.partOfCycle?0==Au(e,n)?(e.y0=t.y1/2+i,e.y1=e.y0+e.value*t.ky):"top"==e.circularLinkType?(e.y0=t.y0+i,e.y1=e.y0+e.value*t.ky):(e.y0=t.y1-e.value*t.ky-i,e.y1=e.y0+e.value*t.ky):0==t.y0||0==t.y1?(e.y0=(t.y1-t.y0)/a*i,e.y1=e.y0+e.value*t.ky):(e.y0=(t.y1-t.y0)/2-a/2+i,e.y1=e.y0+e.value*t.ky)})})}function Ju(t,e,n,r,i,o){var a=Hu(t.nodes,function(t){return t.column}).sort(function(t,e){return t[0]-e[0]}).map(function(t){return t[1]});u();for(var s=1,l=o;l>0;--l)c(s*=.99,n),u();function c(e,n){var r=a.length;a.forEach(function(i){var o=i.length,a=i[0].depth;i.forEach(function(i){var s;if(i.sourceLinks.length||i.targetLinks.length)if(i.partOfCycle&&Au(i,n)>0){var l=Xu(i.sourceLinks,vu),c=Xu(i.targetLinks,bu),u=l&&c?(l+c)/2:l||c;if(u){var h=(u-ku(i))*e*.3;i.y0+=h,i.y1+=h}}else if(0==a&&1==o)i.y0=t.y1/2-(s=i.y1-i.y0)/2,i.y1=t.y1/2+s/2;else if(a==r-1&&1==o)i.y0=t.y1/2-(s=i.y1-i.y0)/2,i.y1=t.y1/2+s/2;else if(1==i.targetLinks.length&&1==i.targetLinks[0].source.sourceLinks.length)s=i.y1-i.y0,i.y0=i.targetLinks[0].source.y0,i.y1=i.y0+s;else{var d=Xu(i.sourceLinks,vu),f=Xu(i.targetLinks,bu),y=((d&&f?(d+f)/2:d||f)-ku(i))*e;i.y0+=y,i.y1+=y}})})}function u(){a.forEach(function(n){var o,a,s,l=t.y0,c=n.length;for(n.sort(e||Du),s=0;c>s;++s)(a=l-(o=n[s]).y0)>0&&(o.y0+=a,o.y1+=a),l=o.y1+r;if((a=l-r-t.y1)>0)for(l=o.y0-=a,o.y1-=a,s=c-2;s>=0;--s)(a=(o=n[s]).y1+i-l)>0&&(o.y0-=a,o.y1-=a),l=o.y0})}}function Qu(t){t.nodes.forEach(function(t){t.sourceLinks.sort(Tu),t.targetLinks.sort(Lu)}),t.nodes.forEach(function(t){var e=t.y0,n=e,r=t.y1,i=r;t.sourceLinks.forEach(function(t){t.circular?(t.y0=r-t.width/2,r-=t.width):(t.y0=e+t.width/2,e+=t.width)}),t.targetLinks.forEach(function(t){t.circular?(t.y1=i-t.width/2,i-=t.width):(t.y1=n+t.width/2,n+=t.width)})})}function th(){var t=0,e=0,n=1,r=1,i=24,o=8,a=null,s=qu,l=Su,c=void 0,u=32,h=2,d=Uu,f=Zu;function y(){var y={nodes:d.apply(null,arguments),links:f.apply(null,arguments)};return function(d){d.x0=t,d.y0=e,d.x1=n,d.y1=r,d.py=0,function(t,e){t.nodes.forEach(function(t,e){t.index=e,t.sourceLinks=[],t.targetLinks=[]});var n=function(t,e){var n=new Map;return Gu(t,e).forEach(function(t,e){n.set(e,t[0])}),n}(t.nodes,e);t.links.forEach(function(t,e){t.index=e;var r=t.source,i=t.target;"object"!=typeof r&&(r=t.source=cu(n,r)),"object"!=typeof i&&(i=t.target=cu(n,i)),r.sourceLinks.push(t),i.targetLinks.push(t)})}(d,s),function(t,e){var n=0;if(null==e){for(var r=[],i=0;t.links.length>i;i++){var o=t.links[i],a=o.source.index,s=o.target.index;r[a]||(r[a]=[]),r[s]||(r[s]=[]),-1===r[a].indexOf(s)&&r[a].push(s)}var l=uu(r);l.sort(function(t,e){return t.length-e.length});var c={};for(i=0;l.length>i;i++){var u=l[i].slice(-2);c[u[0]]||(c[u[0]]={}),c[u[0]][u[1]]=!0}t.links.forEach(function(t){var e=t.target.index,r=t.source.index;e===r||c[r]&&c[r][e]?(t.circular=!0,t.circularLinkID=n++):t.circular=!1})}else t.links.forEach(function(t){e(t.source)<e(t.target)?t.circular=!1:(t.circular=!0,t.circularLinkID=n++)})}(d,c),function(t,e){var n=0,r=0;t.links.forEach(function(i){i.circular&&(i.circularLinkType=i.source.circularLinkType||i.target.circularLinkType?i.source.circularLinkType?i.source.circularLinkType:i.target.circularLinkType:r>n?"top":"bottom","top"==i.circularLinkType?n++:r++,t.nodes.forEach(function(t){xu(t,e)!=xu(i.source,e)&&xu(t,e)!=xu(i.target,e)||(t.circularLinkType=i.circularLinkType)}))}),t.links.forEach(function(t){t.circular&&(t.source.circularLinkType==t.target.circularLinkType&&(t.circularLinkType=t.source.circularLinkType),du(t,e)&&(t.circularLinkType=t.source.circularLinkType))})}(d,s),function(t){t.nodes.forEach(function(t){t.partOfCycle=!1,t.value=Math.max(ju(t.sourceLinks,wu),ju(t.targetLinks,wu)),t.sourceLinks.forEach(function(e){e.circular&&(t.partOfCycle=!0,t.circularLinkType=e.circularLinkType)}),t.targetLinks.forEach(function(e){e.circular&&(t.partOfCycle=!0,t.circularLinkType=e.circularLinkType)})})}(d),function(t,e,n){var r,i,o;if(null!=e){t.nodes.sort(function(t,n){return e(t)<e(n)?-1:1});var a=0,s=e(t.nodes[0]);t.nodes.forEach(function(t){a=e(t)==s?a:a+1,s=e(t)==s?s:e(t),t.column=a})}for(r=t.nodes,i=[],o=0;r.length;++o,r=i,i=[])r.forEach(function(t){t.depth=o,t.sourceLinks.forEach(function(t){0>i.indexOf(t.target)&&!t.circular&&i.push(t.target)})});for(r=t.nodes,i=[],o=0;r.length;++o,r=i,i=[])r.forEach(function(t){t.height=o,t.targetLinks.forEach(function(t){0>i.indexOf(t.source)&&!t.circular&&i.push(t.source)})});t.nodes.forEach(function(t){t.column=null==e?n(t,o):t.column})}(d,c,l);var f=o;if(null!==a){var y=Hu(d.nodes,function(t){return t.column}).sort(function(t,e){return t[0]-e[0]}).map(function(t){return t[1]}),p=Bu(y,function(t){return t.length});p>1&&(f=Math.max(1,(r-e)*a/(p-1)))}(function(t,e,n){var r=Hu(t.nodes,function(t){return t.column}).sort(function(t,e){return t[0]-e[0]}).map(function(t){return t[1]});t.py=e;var i=Yu(r,function(e){return(t.y1-t.y0-(e.length-1)*t.py)/ju(e,function(t){return t.value})});t.ky=i,t.links.forEach(function(e){e.width=e.value*t.ky});var o=Bu(t.nodes,function(t){return t.column});t.nodes.forEach(o>0?function(e){e.x0=t.x0+e.column*((t.x1-t.x0-n)/o),e.x1=e.x0+n}:function(e){e.x0=t.x0,e.x1=e.x0+n})})(d,f,i),Ku(d,c,s),Ju(d,c,s,f,f,u),Qu(d),Iu(d,s,h,10,8),Ku(d,c,s),Ju(d,c,s,f,f,u),Qu(d),Iu(d,s,h,10,8),function(t,e){let n=t;n.nodes.forEach(function(t){t.y+(t.y1-t.y0)>n.y1&&(t.y=t.y-(t.y+(t.y1-t.y0)-n.y1));var r=n.links.filter(function(n){return xu(n.source,e)==xu(t,e)}),i=r.length;i>1&&r.sort(function(t,e){if(!t.circular&&!e.circular){if(t.target.column==e.target.column)return t.y1-e.y1;if(!Eu(t,e))return t.y1-e.y1;if(t.target.column>e.target.column){var n=pu(e,t);return t.y1-n}if(e.target.column>t.target.column)return pu(t,e)-e.y1}return t.circular&&!e.circular?"top"==t.circularLinkType?-1:1:e.circular&&!t.circular?"top"==e.circularLinkType?1:-1:t.circular&&e.circular?t.circularLinkType===e.circularLinkType&&"top"==t.circularLinkType?t.target.column===e.target.column?t.target.y1-e.target.y1:e.target.column-t.target.column:t.circularLinkType===e.circularLinkType&&"bottom"==t.circularLinkType?t.target.column===e.target.column?e.target.y1-t.target.y1:t.target.column-e.target.column:"top"==t.circularLinkType?-1:1:void 0});var o=t.y0;r.forEach(function(t){t.y0=o+t.width/2,o+=t.width}),r.forEach(function(e,n){if("bottom"==e.circularLinkType){for(var o=n+1,a=0;i>o;o++)a+=r[o].width;e.y0=t.y1-a-e.width/2}})})}(d,s),function(t,e){let n=t;n.nodes.forEach(function(t){var r=n.links.filter(function(n){return xu(n.target,e)==xu(t,e)}),i=r.length;i>1&&r.sort(function(t,e){if(!t.circular&&!e.circular){if(t.source.column==e.source.column)return t.y0-e.y0;if(!Eu(t,e))return t.y0-e.y0;if(t.source.column>e.source.column){var n=gu(e,t);return t.y0-n}if(e.source.column>t.source.column)return gu(t,e)-e.y0}return t.circular&&!e.circular?"top"==t.circularLinkType?-1:1:e.circular&&!t.circular?"top"==e.circularLinkType?1:-1:t.circular&&e.circular?t.circularLinkType===e.circularLinkType&&"top"==t.circularLinkType?t.source.column===e.source.column?t.source.y1-e.source.y1:t.source.column-e.source.column:t.circularLinkType===e.circularLinkType&&"bottom"==t.circularLinkType?t.source.column===e.source.column?t.source.y1-e.source.y1:e.source.column-t.source.column:"top"==t.circularLinkType?-1:1:void 0});var o=t.y0;r.forEach(function(t){t.y1=o+t.width/2,o+=t.width}),r.forEach(function(e,n){if("bottom"==e.circularLinkType){for(var o=n+1,a=0;i>o;o++)a+=r[o].width;e.y1=t.y1-a-e.width/2}})})}(d,s),function(t){var e=t.nodes,n=t.links,r=!1,i=!1;if(n.forEach(function(t){"top"==t.circularLinkType?r=!0:"bottom"==t.circularLinkType&&(i=!0)}),0==r||0==i){let r=function(e){return(e-o)/(a-o)*(t.y1-t.y0)+t.y0};var o=Yu(e,function(t){return t.y0}),a=Bu(e,function(t){return t.y1}),s=(t.y1-t.y0)/(a-o);1>s?(e.forEach(function(t){t.y0=r(t.y0),t.y1=r(t.y1)}),n.forEach(function(t){t.y0=r(t.y0),t.y1=r(t.y1),t.width=t.width*s})):e.forEach(function(t){var e=t.y1-t.y0,n=r(t.y0)-t.y0;t.y0=r(t.y0),t.y1=t.y0+e,t.sourceLinks.forEach(function(t){t.y0=t.y0+n}),t.targetLinks.forEach(function(t){t.y1=t.y1+n})})}}(d),Iu(d,s,h,10,8)}(y),y}return y.update=function(t){return Qu(t),Iu(t,s,h,10,8),t},y.nodeWidth=function(t){return arguments.length?(i=+t,y):i},y.nodePadding=function(t){return arguments.length?(o=+t,y):o},y.nodePaddingRatio=function(t){return arguments.length?(a=+t,y):a},y.nodes=function(t){return arguments.length?(d="function"==typeof t?t:Vu(t),y):d},y.links=function(t){return arguments.length?(f="function"==typeof t?t:Vu(t),y):f},y.nodeId=function(t){return arguments.length?(s="function"==typeof t?t:Vu(t),y):s},y.nodeAlign=function(t){return arguments.length?(l="function"==typeof t?t:Vu(t),y):l},y.nodeSort=function(t){return arguments.length?(c=t,y):c},y.iterations=function(t){return arguments.length?(u=+t,y):u},y.circularLinkGap=function(t){return arguments.length?(h=+t,y):h},y.extent=function(i){return arguments.length?(t=+i[0][0],e=+i[0][1],n=+i[1][0],r=+i[1][1],y):[[t,e],[n,r]]},y.size=function(i){return arguments.length?(t=e=0,n=+i[0],r=+i[1],y):[n-t,r-e]},y}import{interpolateNumber as eh}from"d3-interpolate";import{line as nh,curveLinearClosed as rh}from"d3-shape";function ih(t){const{sx:e,sTop:n,sBot:r,tx:i,tTop:o,tBot:a,cp1X:s,cp2X:l}=t,c=(n+r)/2,u=(o+a)/2;return{pathD:[`M${e},${n}`,`C${s},${n} ${l},${o} ${i},${o}`,`L${i},${a}`,`C${l},${a} ${s},${r} ${e},${r}`,"Z"].join(" "),bezier:{circular:!1,points:[{x:e,y:c},{x:s,y:c},{x:l,y:u},{x:i,y:u}],halfWidth:(r-n)/2}}}var oh=t=>{let e,n,r,i,o,a,s,l,c;if("down"===t.direction)return e=t.y0-t.sankeyWidth/2,n=t.y1-t.sankeyWidth/2,r=t.y1+t.sankeyWidth/2,i=t.y0+t.sankeyWidth/2,o=t.source.x1,a=t.target.x0,s=eh(o,a),l=s(.5),c=s(.5),`M${e},${o}C${e},${l} ${n},${c} ${n},${a}L${r},${a}C${r},${c} ${i},${l} ${i},${o}Z`;const u=t.sankeyWidth/2,h=eh(t.source.x1,t.target.x0),{pathD:d}=ih({sx:t.source.x1,sTop:t.y0-u,sBot:t.y0+u,tx:t.target.x0,tTop:t.y1-u,tBot:t.y1+u,cp1X:h(.5),cp2X:h(.5)});return d};function ah(t){const e=t.sankeyWidth/2,n=(t._circularWidth??t.sankeyWidth)/2,r=t.circularPathData;if(!r)return null;if("down"===t.direction)return null;if(t._circularStub){const n=r.sourceX,i=r.sourceY,o=r.targetX,a=r.targetY;if("object"!=typeof t.source||!t.source||"object"!=typeof t.target||!t.target)return null;const s=Math.max(15,Math.min(40,.33*(r.rightFullExtent-n))),l=Math.max(15,Math.min(40,.33*(o-r.leftFullExtent)));return`M${n},${i-e}L${n+s},${i-e}L${n+s},${i+e}L${n},${i+e}ZM${o},${a-e}L${o-l},${a-e}L${o-l},${a+e}L${o},${a+e}Z`}const i=r.sourceX,o=r.sourceY,a=r.targetX,s=r.targetY,l=r.rightFullExtent,c=r.leftFullExtent,u=r.verticalFullExtent,h="bottom"===t.circularLinkType?1:-1,d=Math.max(4,Math.min(n,15));return`M${i},${o-h*e}L${l},${o-h*e}L${l+n},${o-h*e+h*d}L${l+n},${u+h*n-h*d}L${l+n-d},${u+h*n}L${c-n+d},${u+h*n}L${c-n},${u+h*n-h*d}L${c-n},${s-h*e+h*d}L${c-n+d},${s-h*e}L${a},${s-h*e}L${a},${s+h*e}L${c+n},${s+h*e}L${c+n},${u-h*n}L${l-n},${u-h*n}L${l-n},${o+h*e}L${i},${o+h*e}Z`}var sh={left:function(t){return t.depth},right:function(t,e){return e-1-t.height},center:function(t){return t.targetLinks.length?t.depth:t.sourceLinks.length?Math.min.apply(Math,t.sourceLinks.map(Mu))-1:0},justify:Su},lh={supportsStreaming:!0,hierarchical:!1,computeLayout(t,e,n,r){if(0===t.length)return;const i="vertical"===n.orientation?"down":"right",o=n.nodeAlign||"justify",a=n.nodeWidth??15,s=n.nodePaddingRatio??.05,l=n.iterations??100,c=t.map(t=>({...t})),u=e.map(t=>({...t,source:K(t.source),target:K(t.target),value:Math.sqrt(Math.max(1,t.value||1))}));let h;h="down"===i?[[0,0],[r[1],r[0]]]:[[0,0],[r[0],r[1]]];const d=th().extent(h).links(u).nodes(c).nodeAlign(sh[o]||Su).nodeId(t=>t.id).nodeWidth(a).iterations(l);d.nodePaddingRatio&&d.nodePaddingRatio(s),d();{let t=1/0,e=-1/0,n=1/0,i=-1/0;for(const r of c)t>r.x0&&(t=r.x0),r.x1>e&&(e=r.x1),n>r.y0&&(n=r.y0),r.y1>i&&(i=r.y1);for(const r of u){if(!r.circular||!r.circularPathData)continue;const o=r.circularPathData,a=(r._circularWidth??r.width??0)/2;t>o.leftFullExtent-a&&(t=o.leftFullExtent-a),o.rightFullExtent+a>e&&(e=o.rightFullExtent+a),n>o.verticalFullExtent-a&&(n=o.verticalFullExtent-a),o.verticalFullExtent+a>i&&(i=o.verticalFullExtent+a)}const o=e-t,a=i-n,s=r[0],l=r[1];if(o>0&&a>0&&(0>t||0>n||e>s||i>l)){const e=Math.min(s/o,l/a),r=-t*e+(s-o*e)/2,i=-n*e+(l-a*e)/2;for(const t of c)t.x0=t.x0*e+r,t.x1=t.x1*e+r,t.y0=t.y0*e+i,t.y1=t.y1*e+i;for(const t of u)if(t.y0=t.y0*e+i,t.y1=t.y1*e+i,t.width=(t.width??0)*e,t._circularWidth&&(t._circularWidth*=e),t.circular&&t.circularPathData){const n=t.circularPathData;n.sourceX=n.sourceX*e+r,n.targetX=n.targetX*e+r,n.sourceY=n.sourceY*e+i,n.targetY=n.targetY*e+i,n.rightFullExtent=n.rightFullExtent*e+r,n.leftFullExtent=n.leftFullExtent*e+r,n.verticalFullExtent=n.verticalFullExtent*e+i,n.rightInnerExtent=n.rightInnerExtent*e+r,n.leftInnerExtent=n.leftInnerExtent*e+r,n.verticalRightInnerExtent=n.verticalRightInnerExtent*e+i,n.verticalLeftInnerExtent=n.verticalLeftInnerExtent*e+i,n.rightSmallArcRadius*=e,n.rightLargeArcRadius*=e,n.leftSmallArcRadius*=e,n.leftLargeArcRadius*=e,n.sourceWidth*=e,n.rightNodeBuffer*=e,n.leftNodeBuffer*=e,n.arcRadius*=e}}}const f=new Map;for(const e of t)f.set(e.id,e);for(const t of c){const e=f.get(t.id);e&&(e.x0=t.x0,e.x1=t.x1,e.y0=t.y0,e.y1=t.y1,e.value=t.value,e.depth=t.depth,e.sourceLinks=t.sourceLinks,e.targetLinks=t.targetLinks,e.width=t.x1-t.x0,e.height=t.y1-t.y0,e.x=t.x0+(t.x1-t.x0)/2,e.y=t.y0+(t.y1-t.y0)/2)}const y=new Map;for(const t of e)if(t._edgeKey)y.set(t._edgeKey,t);else{const e=K(t.source),n=K(t.target);y.set(`${e}\0${n}`,t)}for(const t of u){const e=K(t.source),n=K(t.target),r=y.get(t._edgeKey?t._edgeKey:`${e}\0${n}`);if(r){r.y0=t.y0,r.y1=t.y1,r.sankeyWidth=t.width??0,r.circular=!!t.circular,r.circularPathData=t.circularPathData,r._circularWidth=t._circularWidth,r._circularStub=t._circularStub,r.path=t.path,r.circularLinkType=t.circularLinkType,r.direction=i;const o=f.get(e),a=f.get(n);o&&(r.source=o),a&&(r.target=a)}}},buildScene(t,e,n,r){const i="vertical"===n.orientation?"down":"right",o=n.nodeStyle,a=n.edgeStyle,s=n.edgeOpacity??.5,l=n.edgeColorBy||"source",c=Array.isArray(n.colorScheme)?n.colorScheme:n.themeCategorical&&n.themeCategorical.length>0?n.themeCategorical:z,u=new Map;t.forEach((t,e)=>{u.set(t.id,c[e%c.length])});const h=[],d=[],f=[],y=new Map;for(const e of t){const t=e.x1-e.x0,n=e.y1-e.y0;if(0>=t||0>=n)continue;const r=o?o(G(e,"nodeStyle")):{},a={fill:r.fill||u.get(e.id)||"#4d430c",stroke:r.stroke,strokeWidth:r.strokeWidth,opacity:r.opacity};y.set(e.id,("string"==typeof a.fill?a.fill:null)||u.get(e.id)||"#4d430c"),h.push("down"===i?{type:"rect",x:e.y0,y:e.x0,w:n,h:t,style:a,datum:e,id:e.id,label:e.id}:{type:"rect",x:e.x0,y:e.y0,w:t,h:n,style:a,datum:e,id:e.id,label:e.id})}const p=[...e].sort((t,e)=>(e.sankeyWidth||0)-(t.sankeyWidth||0));for(const t of p){if(!t.sankeyWidth||0>=t.sankeyWidth)continue;const e="object"==typeof t.source?t.source:null,r="object"==typeof t.target?t.target:null;if(!e||!r)continue;let i=n.themeSemantic?.border||n.themeSemantic?.secondary||"#999";i="function"==typeof l?l(t)||i:"target"===l?y.get(r.id)||u.get(r.id)||i:y.get(e.id)||u.get(e.id)||i;const o=a?a(G(t,"edgeStyle")):{};if(t._circularStub&&t.circular&&t.circularPathData){const e=t.circularPathData,n=t.sankeyWidth/2,r=Math.max(15,Math.min(40,.33*(e.rightFullExtent-e.sourceX))),a=Math.max(15,Math.min(40,.33*(e.targetX-e.leftFullExtent))),l=o.fill||i;d.push({type:"bezier",pathD:`M${e.sourceX},${e.sourceY-n}L${e.sourceX+r},${e.sourceY-n}L${e.sourceX+r},${e.sourceY+n}L${e.sourceX},${e.sourceY+n}Z`,style:{fill:l,fillOpacity:o.fillOpacity??s,stroke:"none",opacity:o.opacity},datum:t,_gradient:{direction:"right",from:1,to:0,x0:e.sourceX,x1:e.sourceX+r}}),d.push({type:"bezier",pathD:`M${e.targetX},${e.targetY-n}L${e.targetX-a},${e.targetY-n}L${e.targetX-a},${e.targetY+n}L${e.targetX},${e.targetY+n}Z`,style:{fill:l,fillOpacity:o.fillOpacity??s,stroke:"none",opacity:o.opacity},datum:t,_gradient:{direction:"left",from:0,to:1,x0:e.targetX-a,x1:e.targetX}});continue}let c;(c=t.circular&&t.circularPathData?ah(t):oh(t),c)&&d.push({type:"bezier",pathD:c,bezierCache:t.bezier,style:{fill:o.fill||i,fillOpacity:o.fillOpacity??s,stroke:o.stroke||"none",strokeWidth:o.strokeWidth,opacity:o.opacity},datum:t})}if(!1!==n.showLabels){const e=Z(n.nodeLabel);for(const n of t){const t=n.x1-n.x0,o=n.y1-n.y0;if(0>=t||0>=o)continue;const a=e?e(n):n.id;if(!a)continue;let s,l,c;"down"===i?(s=n.y0+(n.y1-n.y0)/2,l=n.x1+14,c="start"):(r[0]/2>n.x0+t/2?(s=n.x0-6,c="end"):(s=n.x1+6,c="start"),l=n.y0+o/2),f.push({x:s,y:l,text:a+"",anchor:"down"===i?"middle":c,baseline:"middle",fontSize:11})}}return{sceneNodes:h,sceneEdges:d,labels:f}}};import{chord as ch,ribbon as uh}from"d3-chord";import{arc as hh}from"d3-shape";var dh=z,fh={supportsStreaming:!1,hierarchical:!1,computeLayout(t,e,n,r){if(0===t.length)return;const{padAngle:i=.01,groupWidth:o=20,sortGroups:a}=n,s=Math.min(r[0],r[1])/2,l=s-o,c=r[0]/2,u=r[1]/2,h=(d=n.valueAccessor)?"function"==typeof d?d:t=>t[d]??1:t=>t.value??1;var d;const f=new Map;for(let e=0;t.length>e;e++)f.set(t[e].id,e);const y=t.length,p=Array.from({length:y},()=>Array.from({length:y},()=>0));for(const t of e){const e=K(t.source),n=K(t.target),r=f.get(e),i=f.get(n);if(void 0===r||void 0===i)continue;const o=h(t);p[r][i]=o}const g=ch().padAngle(i);a&&g.sortGroups(a);const m=g(p),x=m.groups,b=hh().innerRadius(l).outerRadius(s);for(const e of x){const n=t[e.index],r=b.centroid({innerRadius:l,outerRadius:s,startAngle:e.startAngle,endAngle:e.endAngle});n.x=r[0]+c,n.y=r[1]+u,n.__arcData={startAngle:e.startAngle,endAngle:e.endAngle}}const v=new Map;for(const e of t)v.set(e.id,e);for(const t of e){const e=K(t.source),n=K(t.target),r=v.get(e),i=v.get(n);r&&(t.source=r),i&&(t.target=i)}const k=new Map;for(const t of e){const e=K(t.source),n=K(t.target);k.set(`${e}\0${n}`,t)}for(const e of m){const n=t[e.source.index].id,r=t[e.target.index].id,i=k.get(`${n}\0${r}`)||k.get(`${r}\0${n}`);i&&(i.__chordData=e)}},buildScene(t,e,n,r){const{groupWidth:i=20,edgeOpacity:o=.5}=n,a=Math.min(r[0],r[1])/2,s=a-i,l=r[0]/2,c=r[1]/2,u=n.nodeStyle,h=n.edgeStyle,d=n.edgeColorBy||"source",f=Array.isArray(n.colorScheme)?n.colorScheme:n.themeCategorical&&n.themeCategorical.length>0?n.themeCategorical:dh,y=new Map;t.forEach((t,e)=>{y.set(t.id,f[e%f.length])});const p=uh().radius(s),g=[],m=[],x=[];for(let e=0;t.length>e;e++){const n=t[e],r=n.__arcData;if(!r)continue;let i;i=u?u(G(n,"nodeStyle")).fill||y.get(n.id)||f[e%f.length]:y.get(n.id)||f[e%f.length];const o=u?u(G(n,"nodeStyle")):{};g.push({type:"arc",cx:l,cy:c,innerR:s,outerR:a,startAngle:r.startAngle-Math.PI/2,endAngle:r.endAngle-Math.PI/2,style:{fill:i,stroke:o.stroke||"black",strokeWidth:o.strokeWidth??1,opacity:o.opacity},datum:n,id:n.id,label:n.id})}for(const t of e){const e=t.__chordData;if(!e)continue;const r=p(e);if(!r)continue;const i=yh(r,l,c);let a=n.themeSemantic?.border||n.themeSemantic?.secondary||"#999";if(h)a=h(G(t,"edgeStyle")).fill||a;else{const e="object"==typeof t.source?t.source:null,n="object"==typeof t.target?t.target:null;"target"===d&&n?a=y.get(n.id)||a:e&&(a=y.get(e.id)||a)}const s=h?h(G(t,"edgeStyle")):{};m.push({type:"ribbon",pathD:i,style:{fill:a,fillOpacity:s.fillOpacity??o,stroke:s.stroke||"none",strokeWidth:s.strokeWidth,opacity:s.opacity},datum:t})}if(!1!==n.showLabels){const e=Z(n.nodeLabel),r=a+12;for(const n of t){const t=n.__arcData;if(!t)continue;const i=e?e(n):n.id;if(!i)continue;const o=(t.startAngle+t.endAngle)/2,a=o-Math.PI/2;x.push({x:l+Math.cos(a)*r,y:c+Math.sin(a)*r,text:i+"",anchor:o>Math.PI?"end":"start",baseline:"middle",fontSize:11})}}return{sceneNodes:g,sceneEdges:m,labels:x}}};function yh(t,e,n){const r=t.match(/[a-zA-Z]|[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?/g);if(!r)return t;const i=[];let o=0;for(;r.length>o;){const t=r[o];if("M"===t||"L"===t)for(i.push(t),o++;r.length>o&&!isNaN(Number(r[o]));)i.push(Number(r[o])+e+""),o++,r.length>o&&!isNaN(Number(r[o]))&&(i.push(Number(r[o])+n+""),o++);else if("C"===t)for(i.push(t),o++;r.length>o&&!isNaN(Number(r[o]));)for(let t=0;3>t&&r.length>o&&!isNaN(Number(r[o]));t++)i.push(Number(r[o])+e+""),o++,r.length>o&&!isNaN(Number(r[o]))&&(i.push(Number(r[o])+n+""),o++);else if("Q"===t)for(i.push(t),o++;r.length>o&&!isNaN(Number(r[o]));)for(let t=0;2>t&&r.length>o&&!isNaN(Number(r[o]));t++)i.push(Number(r[o])+e+""),o++,r.length>o&&!isNaN(Number(r[o]))&&(i.push(Number(r[o])+n+""),o++);else if("A"===t)for(i.push(t),o++;r.length>o&&!isNaN(Number(r[o]));)i.push(r[o++]),r.length>o&&i.push(r[o++]),r.length>o&&i.push(r[o++]),r.length>o&&i.push(r[o++]),r.length>o&&i.push(r[o++]),r.length>o&&(i.push(Number(r[o])+e+""),o++),r.length>o&&(i.push(Number(r[o])+n+""),o++);else"Z"===t||"z"===t?(i.push(t),o++):(i.push(r[o]),o++)}return i.join(" ")}import{hierarchy as ph,tree as gh,cluster as mh,treemap as xh,pack as bh,partition as vh,treemapBinary as kh}from"d3-hierarchy";var wh=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];function Ah(t){const[e,n,r]=function(t){if(t.startsWith("#")){let e=t.slice(1);if(3===e.length&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),6===e.length)return[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16)]}const e=t.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return e?[+e[1],+e[2],+e[3]]:[128,128,128]}(t);return.299*e+.587*n+.114*r>150?"#222":"#fff"}function Mh(t,e,n){const r=e.nodeIDAccessor;return"function"==typeof r?r(t.data)+"":"string"==typeof r&&void 0!==t.data[r]?t.data[r]+"":void 0!==t.data.name?t.data.name+"":void 0!==t.data.id?t.data.id+"":"node-"+n}function Sh(t){if(!t)return null;if("function"==typeof t){const e=t;return t=>e(t.data??t)}return e=>e.data?.[t]||e[t]||e.id}function $h(t){return Array.isArray(t.colorScheme)?t.colorScheme:t.themeCategorical&&t.themeCategorical.length>0?t.themeCategorical:wh}function Ph(t){return Array.isArray(t.colorScheme)&&t.colorScheme.length>0?t.colorScheme[0]:t.themeSemantic?.primary?t.themeSemantic.primary:t.themeCategorical&&t.themeCategorical.length>0?t.themeCategorical[0]:"#4d430c"}function _h(t,e,n,r,i){if("horizontal"===i){const i=(t+n)/2;return`M ${t},${e} C ${i},${e} ${i},${r} ${n},${r}`}if("radial"===i){const i=(t+n)/2;return`M ${t},${e} Q ${i},${e} ${i},${(e+r)/2} T ${n},${r}`}{const i=(e+r)/2;return`M ${t},${e} C ${t},${i} ${n},${i} ${n},${r}`}}var Ch={supportsStreaming:!1,hierarchical:!0,computeLayout(t,e,n,r){const i=n.__hierarchyRoot;if(!i)return;const o=n.chartType,a=function(t){if(t)return"function"==typeof t?t:e=>e[t]}(n.childrenAccessor),s=n.hierarchySum,l="function"==typeof s?s:"string"==typeof s?t=>Number(t[s])||0:t=>Number(t.value)||0,c=ph(i,a);c.sum(l),c.sort((t,e)=>(e.value??0)-(t.value??0));const[u,h]=r;switch(o){case"tree":!function(t,e,n,r){const i=e.treeOrientation||"vertical",o=gh();o.size("horizontal"===i?[r,n]:"radial"===i?[2*Math.PI,Math.min(n,r)/2*.8]:[n,r]),o(t)}(c,n,u,h);break;case"cluster":!function(t,e,n,r){const i=e.treeOrientation||"vertical",o=mh();o.size("horizontal"===i?[r,n]:"radial"===i?[2*Math.PI,Math.min(n,r)/2*.8]:[n,r]),o(t)}(c,n,u,h);break;case"treemap":!function(t,e,n,r){const i=e.padding??4,o=e.paddingTop??0,a=xh().size([n,r]).tile(kh).padding(i);o>0&&a.paddingTop(o),a(t)}(c,n,u,h);break;case"circlepack":!function(t,e,n,r){const i=e.padding??4;bh().size([n,r]).padding(i)(t)}(c,n,u,h);break;case"partition":!function(t,e,n,r){vh().size([n,r]).padding(e.padding??1)(t)}(c,n,u,h)}const d=c.descendants();t.length=0,e.length=0;const f=new Map;for(let e=0;d.length>e;e++){const r=d[e],i={id:Mh(r,n,e),x:0,y:0,x0:0,x1:0,y0:0,y1:0,width:0,height:0,value:r.value??0,depth:r.depth,data:r.data,createdByFrame:!0};"tree"===o||"cluster"===o?Lh(i,r,n):"treemap"===o||"partition"===o?Th(i,r):"circlepack"===o&&Dh(i,r),i.__hierarchyNode=r,t.push(i),f.set(r,i)}if("tree"===o||"cluster"===o)for(const t of d)if(t.parent){const n=f.get(t.parent),r=f.get(t);n&&r&&e.push({source:n,target:r,value:1,y0:0,y1:0,sankeyWidth:0,data:{depth:t.depth}})}},buildScene(t,e,n,r){const i=n.nodeStyle||(()=>({})),o=n.edgeStyle||(()=>({}));switch(n.chartType){case"tree":case"cluster":return function(t,e,n,r,i,o){const a=[],s=[],l=[],c=n.treeOrientation||"vertical",u="radial"===c,h=r[0]/2,d=r[1]/2,f="number"==typeof(y=n.nodeSize)?y:5;var y;for(const e of t){let t=e.x,r=e.y;u&&(t+=h,r+=d);const o=i(G(e,"nodeStyle"));let s=o.fill||Ph(n);if(n.colorByDepth&&void 0!==e.depth){const t=$h(n);s=t[e.depth%t.length]}a.push({type:"circle",cx:t,cy:r,r:f,style:{fill:s,stroke:o.stroke||n.themeSemantic?.surface||"#fff",strokeWidth:o.strokeWidth??1,opacity:o.opacity},datum:e,id:e.id,label:e.id,depth:e.depth})}const p=n.edgeOpacity??.5;for(const t of e){const e="object"==typeof t.source?t.source:null,r="object"==typeof t.target?t.target:null;if(!e||!r)continue;let i=e.x,a=e.y,l=r.x,f=r.y;u&&(i+=h,a+=d,l+=h,f+=d);const y=_h(i,a,l,f,c),g=o(G(t,"edgeStyle"));s.push({type:"curved",pathD:y,style:{fill:"none",stroke:g.stroke||n.themeSemantic?.border||n.themeSemantic?.secondary||"#999",strokeWidth:g.strokeWidth??1.5,opacity:g.opacity??p},datum:t})}if(!1!==n.showLabels){const e=Sh(n.nodeLabel);for(const n of t){const t=e?e(n):n.id;if(!t)continue;let r,i,o,a=n.x,s=n.y;if(u&&(a+=h,s+=d),u){const t=a-h,e=s-d,n=Math.sqrt(t*t+e*e);n>0?(r=a+t/n*10,i=s+e/n*10,o=0>t?"end":"start"):(r=a,i=s-12,o="middle")}else"horizontal"===c?(n.data?.children&&0!==n.data.children.length?(r=a-f-6,o="end"):(r=a+f+6,o="start"),i=s):(r=a,i=s+f+14,o="middle");l.push({x:r,y:i,text:t+"",anchor:o,baseline:"middle",fontSize:11})}}return{sceneNodes:a,sceneEdges:s,labels:l}}(t,e,n,r,i,o);case"treemap":case"partition":return function(t,e,n,r){const i=[],o=[];for(const n of t){const t=n.x1-n.x0,o=n.y1-n.y0;if(0>=t||0>=o)continue;const a=r(G(n,"nodeStyle"));let s=a.fill||Ph(e);if(e.colorByDepth&&void 0!==n.depth){const t=$h(e);s=t[n.depth%t.length]}i.push({type:"rect",x:n.x0,y:n.y0,w:t,h:o,style:{fill:s,stroke:a.stroke||e.themeSemantic?.surface||"#fff",strokeWidth:a.strokeWidth??1,opacity:a.opacity,fillOpacity:a.fillOpacity,strokeOpacity:a.strokeOpacity},datum:n,id:n.id,label:n.id,depth:n.depth})}if(!1!==e.showLabels){const n=Sh(e.nodeLabel),i=e.labelMode||"leaf",a="partition"===e.chartType;for(const s of t){const t=s.x1-s.x0,l=s.y1-s.y0;if(0>=t||0>=l)continue;const c=!(s.data?.children&&s.data.children.length>0);if(!a){if("leaf"===i&&!c)continue;if("parent"===i&&c)continue}const u=n?n(s):s.id;if(!u)continue;if((c?30:40)>t||(c?16:14)>l)continue;let h=r(G(s,"nodeStyle")).fill||Ph(e);if(e.colorByDepth&&void 0!==s.depth){const t=$h(e);h=t[s.depth%t.length]}const d="string"==typeof h?Ah(h):e.themeSemantic?.text??"#000";o.push(c?{x:s.x0+t/2,y:s.y0+l/2,text:u+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,Math.min(t,l)/6)),fill:d}:{x:s.x0+4,y:s.y0+12,text:u+"",anchor:"start",baseline:"auto",fontSize:11,fontWeight:600,fill:d})}}return{sceneNodes:i,sceneEdges:[],labels:o}}(t,n,0,i);case"circlepack":return function(t,e,n,r){const i=[],o=[];for(const n of t){const t=n.__radius??5;if(0>=t)continue;const o=r(G(n,"nodeStyle"));let a=o.fill||Ph(e);if(e.colorByDepth&&void 0!==n.depth){const t=$h(e);a=t[n.depth%t.length]}i.push({type:"circle",cx:n.x,cy:n.y,r:t,style:{fill:a,stroke:o.stroke||e.themeSemantic?.surface||"#fff",strokeWidth:o.strokeWidth??1,opacity:o.opacity??.7},datum:n,id:n.id,label:n.id,depth:n.depth})}if(!1!==e.showLabels){const n=Sh(e.nodeLabel);for(const i of t){const t=i.__radius??5,a=n?n(i):i.id;if(!a)continue;if(15>t)continue;const s=!(i.data?.children&&i.data.children.length>0);let l=r(G(i,"nodeStyle")).fill||Ph(e);if(e.colorByDepth&&void 0!==i.depth){const t=$h(e);l=t[i.depth%t.length]}if(s){const n="string"==typeof l?Ah(l):e.themeSemantic?.text??"#000";o.push({x:i.x,y:i.y,text:a+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,t/3)),fill:n})}else o.push({x:i.x,y:i.y-t+14,text:a+"",anchor:"middle",baseline:"hanging",fontSize:Math.min(11,Math.max(8,t/3)),fill:e.themeSemantic?.text||"#000",stroke:e.themeSemantic?.surface||"#fff",strokeWidth:3,paintOrder:"stroke"})}}return{sceneNodes:i,sceneEdges:[],labels:o}}(t,n,0,i);default:return{sceneNodes:[],sceneEdges:[],labels:[]}}}};function Lh(t,e,n){const r=n.treeOrientation||"vertical";if("radial"===r){const n=e.x,r=e.y;t.x=r*Math.cos(n-Math.PI/2),t.y=r*Math.sin(n-Math.PI/2)}else"horizontal"===r?(t.x=e.y,t.y=e.x):(t.x=e.x,t.y=e.y);t.x0=t.x-5,t.x1=t.x+5,t.y0=t.y-5,t.y1=t.y+5,t.width=10,t.height=10}function Th(t,e){t.x0=e.x0,t.x1=e.x1,t.y0=e.y0,t.y1=e.y1,t.x=(e.x0+e.x1)/2,t.y=(e.y0+e.y1)/2,t.width=e.x1-e.x0,t.height=e.y1-e.y0}function Dh(t,e){const n=e.r??0;t.x=e.x,t.y=e.y,t.x0=e.x-n,t.x1=e.x+n,t.y0=e.y-n,t.y1=e.y+n,t.width=2*n,t.height=2*n,t.__radius=n}import{pie as Rh}from"d3-shape";function Wh(t){let e=t.__orbitState;return e||(e={metaMap:new Map,startTime:"undefined"!=typeof performance?performance.now():Date.now()},t.__orbitState=e),e}var Eh={sankey:lh,force:_,chord:fh,tree:Ch,cluster:Ch,treemap:Ch,circlepack:Ch,partition:Ch,orbit:{supportsStreaming:!1,hierarchical:!0,supportsAnimation:!0,computeLayout(t,e,n,r){const i=n.__hierarchyRoot;i&&function(t,e,n,r,i){const o=function(t){if("function"==typeof t)return t;const e=t||"children";return t=>t[e]||null}(n.childrenAccessor),a=function(t){if("function"==typeof t)return t;const e=t||"name";return t=>(t[e]??"")+""}(n.nodeIDAccessor),s=function(t){if(Array.isArray(t))return t;switch(t){case"solar":return[1];case"atomic":return[2,8];default:return[9999]}}(n.orbitMode),l=n.orbitSize??2.95,c=n.orbitEccentricity??1,u="number"==typeof l?()=>l:l,h="number"==typeof c?()=>c:c,d=Wh(n);d.metaMap.clear(),r.length=0,i.length=0;const f=new Map;function y(t){const e=f.get(t)??0;return f.set(t,e+1),0===e?t:`${t}__${e}`}const p=e[0]/2,g=e[1]/2,m=Math.min(e[0],e[1])/2*.85,x=y(a(t));r.push({id:x,x:p,y:g,x0:p,x1:p,y0:g,y1:g,width:0,height:0,value:0,depth:0,data:t}),d.metaMap.set(x,{ring:m,angle:0,depth:0,parentId:null,eccentricity:1}),function t(e,n,l,c,f,p,g){const m=o(e);if(!m?.length)return;const x=m.length;let b=0,v=0,k=0;for(;x>v;)v+=s[Math.min(k,s.length-1)],k++,b++;let w=0;for(let x=0;b>x;x++){const v=s[Math.min(x,s.length-1)],k=m.slice(w,w+v);if(!k.length)break;const A=(x+1)/b,M={id:n,depth:p,data:e,parentId:n},S=g?f/u(M)*A:f*A,$=Rh().value(t=>{const e=o(t)?.length;return e?4:1}).sort(null)(k),P=h(M);for(let e=0;k.length>e;e++){const o=($[e].startAngle+$[e].endAngle)/2,s=k[e],u=y(a(s)),h=l+S*Math.sin(o),f=c+S*Math.cos(o)*P;r.push({id:u,x:h,y:f,x0:h,x1:h,y0:f,y1:f,width:0,height:0,value:0,depth:p,data:s}),d.metaMap.set(u,{ring:S,angle:o,depth:p,parentId:n,eccentricity:P}),i.push({source:n,target:u,value:1,y0:0,y1:0,sankeyWidth:0,data:{source:n,target:u}}),t(s,u,h,f,S,p+1,!0)}w+=v}}(t,x,p,g,m,1,!1)}(i,r,n,t,e)},buildScene(t,e,n,r){const i=n.nodeStyle,o=n.nodeSize,a="number"==typeof o?()=>o:"function"==typeof o?o:()=>6,s=[],l=[],c=[];if(!1!==n.orbitShowRings){const e=Wh(n),r=new Map;for(const e of t)r.set(e.id,e);const i=new Map;for(const[,t]of e.metaMap){if(!t.parentId)continue;const e=r.get(t.parentId);if(!e)continue;const n=`${t.parentId}:${t.ring}`;i.has(n)||i.set(n,{parentX:e.x,parentY:e.y,ring:t.ring,ecc:t.eccentricity})}const o=48,a={stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1};for(const[,{parentX:t,parentY:e,ring:n,ecc:r}]of i)for(let i=0;o>i;i++){const s=i/o*Math.PI*2,c=(i+1)/o*Math.PI*2;l.push({type:"line",x1:t+n*Math.sin(s),y1:e+n*Math.cos(s)*r,x2:t+n*Math.sin(c),y2:e+n*Math.cos(c)*r,style:a,datum:null})}}for(const e of t){if(null==e.x||null==e.y)continue;const t=a(G(e,"nodeSize")),r=i?i(G(e,"nodeStyle")):{};s.push({type:"circle",cx:e.x,cy:e.y,r:t,style:{fill:r.fill||n.themeSemantic?.primary||"#6366f1",stroke:r.stroke||n.themeSemantic?.surface||"#fff",strokeWidth:r.strokeWidth??1,opacity:r.opacity??(0===(e.depth??0)?1:.85)},datum:e,id:e.id,label:e.id,depth:e.depth})}const u=new Map;for(const e of t)u.set(e.id,e);for(const t of e){const e="object"==typeof t.source?t.source:u.get(t.source),n="object"==typeof t.target?t.target:u.get(t.target);e&&n&&(null!=e.x&&null!=n.x&&l.push({type:"line",x1:e.x,y1:e.y,x2:n.x,y2:n.y,style:{stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1},datum:t}))}if(n.showLabels){const e=n.nodeLabel;for(const n of t){const t=a(G(n,"nodeSize"));if(4>=t)continue;const r="function"==typeof e?e(n):e?n.data?.[e]??n.id:n.id;c.push({x:n.x,y:n.y+t+12,text:r+"",anchor:"middle",fontSize:10,fill:"currentColor"})}}return{sceneNodes:s,sceneEdges:l,labels:c}},tick:(t,e,n,r,i)=>!1!==n.orbitAnimated&&(function(t,e){const n=Wh(e),r=e.orbitSpeed??.25,i=e.orbitRevolution??function(t){switch(t){case"decay":return t=>Math.pow(.6,t.depth??0);case"alternate":return t=>{const e=t.depth??0;return(e%2==0?1:-1)/(e+1)};default:return t=>1/((t.depth??0)+1)}}(e.orbitRevolutionStyle),o=(("undefined"!=typeof performance?performance.now():Date.now())-n.startTime)/1e3,a=r*(Math.PI/6),s=new Map;for(const e of t)s.set(e.id,e);for(const e of t){const t=n.metaMap.get(e.id);if(!t||!t.parentId)continue;const r=s.get(t.parentId);if(!r)continue;const l=t.angle+o*a*i({id:e.id,depth:t.depth,data:e.data,parentId:t.parentId});e.x=r.x+t.ring*Math.sin(l),e.y=r.y+t.ring*Math.cos(l)*t.eccentricity,e.x0=e.x,e.x1=e.x,e.y0=e.y,e.y1=e.y}}(t,n),!0)}};function Nh(t){return Eh[t]}function Oh(t,e,n){return Ot(t,e,n)}function Ih(t,e){const n=e&&"object"==typeof e&&!Array.isArray(e)?e:void 0;return 0===t.length?t=>n&&Bt(n,t)||"#4e79a7":e=>{if(n){const t=Bt(n,e);if(t)return t}let r=0;for(let t=0;e.length>t;t++)r=31*r+e.charCodeAt(t)|0;return t[Math.abs(r)%t.length]??"#4e79a7"}}export{Lt as filterSparseArray,Dt as toIdSet,Et as DEFAULT_COLORS,Nt as DEFAULT_COLOR,Ot as resolveCategoricalPalette,It as STREAMING_PALETTE,zt as DEPTH_PALETTE_COLORS,Yt as getColor,Bt as resolveExplicitColor,jt as createColorScale,Xt as getSize,Gt as computeEasing,Ht as computeRawProgress,Vt as lerp,qt as now,ct as resolveMotionAccessor,ut as compileMotionEncoding,ht as opacityFromAge,dt as resolveMotionVector,ft as deriveMotionVector,Ut as computeDecayOpacity,Zt as buildDatumIndexMap,Kt as computePulseIntensity,Jt as setPulseState,Qt as hasActivePulses,se as buildRectNode,xe as normalizeGradient,be as normalizeColorGradient,ve as normalizeSemanticGradient,ke as reverseGradient,$e as warnCustomLayoutDiagnostics,Ce as createCustomLayoutFailureDiagnostic,Ie as ensureRingBufferCapacity,ze as createTimestampBufferForData,Fe as pushWithTimestamp,Ye as compactTimestampBufferForRemoval,Ue as attachUpdateResultStore,dn as snapOrdinalIntroTargets,yn as PipelineStore,Mn as useSceneRevisionDiagnostics,Sn as runSceneBuild,$n as SceneRevisionDiagnosticsObserver,_n as composeOverlays,Tn as useConfigSync,Dn as useLayoutSelectionSync,Rn as findHitPointInQuadtree,Xn as resolveCanvasFill,Vn as paintNetworkFill,qn as paintNetworkStroke,pr as useStalenessCheck,mr as StalenessBadge,wr as composeLegendConfigs,Ar as isLegendConfig,Mr as isGradientLegendConfig,Sr as DEFAULT_LEGEND_ROW_HEIGHT,Pr as resolveSideLegendWidth,_r as resolveLegendDistance,Cr as resolveLegendSideGutter,Lr as resolveAxisChromeGutter,Dr as resolveSideLegendMargin,Rr as resolveLegendMetrics,Wr as layoutVerticalLegendGroups,Gr as renderLegendFromConfig,si as SemioticAnnotation,ki as fitLinearForForecast,wi as forecastIntervalStats,Ai as confidenceZScore,$i as ANNOTATION_DISCLOSURE_REVEAL_CSS,Wi as AnnotationLabel,Ii as renderAnnotationPass,zi as createDefaultAnnotationRules,Ki as ticksForMode,eo as resolveGridDash,ro as TITLE_BASELINE,io as hasTextTitle,ao as reserveTitleMargin,Wo as networkSceneNodeToSVG,Eo as networkSceneEdgeToSVG,No as networkLabelToSVG,Fo as geoSceneNodeToSVG,Uo as ordinalSceneNodeToSVG,Qo as xySceneNodeToSVG,ta as isServerEnvironment,sa as useHydration,ha as useWasHydratingFromSSR,fa as useStableShallow,xa as paintCanvasBackground,ba as needsDataCanvasPaint,Ca as AriaLiveTooltip,Ra as computeNetworkAriaLabel,qa as NetworkAccessibleDataTable,Ua as ScreenReaderSummary,Za as SkipToTableLink,Qa as FocusRing,ns as FlippingTooltip,ps as useFrame,bs as useFrameCanvasHost,vs as CanvasFrameBackground,ws as prepareCanvas,As as getDevicePixelRatio,Es as renderRectPulse,Ns as renderCirclePulse,Vs as networkSymbolRenderer,Us as networkGlyphRenderer,cl as paintSceneWithBackend,ul as renderSceneWithBackend,hl as renderSceneListWithBackend,yl as formatVal,bl as observationInputType,vl as isInteractiveKeyboardTarget,kl as emitHoverObservations,wl as emitClickObservations,$l as buildNavGraph,Pl as resolvePosition,Tl as extractNetworkNavPoints,Dl as nextNetworkIndex,Fl as StreamXYFrame_default,ih as buildRibbonGeometry,Nh as getLayoutPlugin,Oh as resolveCustomLayoutPalette,Ih as buildResolveColor,ql as SafeRender,Kl as renderEmptyState,Jl as renderLoadingState,Wc as useCategoryColors,Ql as normalizeLinkedBrush,uc as useBrushSelection,dc as resolveMobileInteraction,yc as isChartMode,pc as resolveChartMode,Fc as distinctCategories,Yc as useChartLegendAndMargin,Bc as useLegendInteraction,Qc as useThemeCategorical,tu as resolveDefaultFill,eu as useColorScale,nu as useChartSelection,ru as getCrosshairProps,iu as useChartMode,ou as buildBaseMetadataProps,au as buildCustomBehaviorProps,lu as resolveDownwardHistogramExtent};
|