semiotic 3.9.1 → 3.10.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 +137 -58
- package/agent-skill/semiotic-charts/SKILL.md +27 -17
- package/ai/artifact-contract-reference.md +408 -0
- package/ai/artifact-surface-inventory.json +5586 -0
- package/ai/behaviorContracts.cjs +24 -2
- package/ai/cli.js +480 -56
- package/ai/componentMetadata.cjs +13 -3
- package/ai/dist/mcp-server.js +140 -36407
- package/ai/examples.md +110 -7
- package/ai/reference.md +82 -28
- package/ai/schema.json +7675 -1471
- package/ai/surface-manifest.json +60 -9
- package/ai/system-prompt.md +18 -3
- package/ai/task-packets/compare-category-totals.json +301 -0
- package/ai/task-packets/compare-category-totals.md +188 -0
- package/ai/task-packets/correct-published-chart.json +271 -0
- package/ai/task-packets/correct-published-chart.md +597 -0
- package/ai/task-packets/index.json +40 -0
- package/ai/task-packets/update-live-chart.json +289 -0
- package/ai/task-packets/update-live-chart.md +424 -0
- package/dist/c-2N7IU2NY.min.js +1 -0
- package/dist/c-2WK7YJLL.min.js +1 -0
- package/dist/c-33QOXEUG.min.js +1 -0
- package/dist/c-42PLDTX7.min.js +1 -0
- package/dist/c-447VIMRO.min.js +1 -0
- package/dist/c-4FN7Q6VQ.min.js +1 -0
- package/dist/c-553QUDKA.min.js +1 -0
- package/dist/c-55BAJ333.min.js +1 -0
- package/dist/c-7242NXSG.min.js +1 -0
- package/dist/c-7EGHJU2F.min.js +1 -0
- package/dist/c-7HP7MB2I.min.js +1 -0
- package/dist/c-7NBU5ZKS.min.js +1 -0
- package/dist/c-AFBSWT77.min.js +1 -0
- package/dist/c-AJ7EC32V.min.js +1 -0
- package/dist/c-AQADQNY7.min.js +1 -0
- package/dist/c-ATM475SA.min.js +1 -0
- package/dist/c-AVO3Q7T7.min.js +1 -0
- package/dist/c-AZKPVBOC.min.js +1 -0
- package/dist/c-BNFJMDHN.min.js +1 -0
- package/dist/c-BNG5ECK5.min.js +1 -0
- package/dist/c-BOHCQILI.min.js +1 -0
- package/dist/c-CCTGN5CK.min.js +1 -0
- package/dist/c-CPSPZH6A.min.js +1 -0
- package/dist/c-CPV4N35K.min.js +1 -0
- package/dist/c-D6HAAPTX.min.js +1 -0
- package/dist/c-DE5Q3U2X.min.js +1 -0
- package/dist/c-DK662R77.min.js +1 -0
- package/dist/c-DY2676CR.min.js +1 -0
- package/dist/c-E32M6XW5.min.js +1 -0
- package/dist/c-E4JDJH4I.min.js +1 -0
- package/dist/c-E7I2L7CU.min.js +1 -0
- package/dist/c-EBOQ7ER7.min.js +1 -0
- package/dist/c-ELDWAO2V.min.js +1 -0
- package/dist/c-EUBTECGM.min.js +1 -0
- package/dist/c-GNTXRXRN.min.js +1 -0
- package/dist/c-GSZRZRD6.min.js +1 -0
- package/dist/c-GWX7JGMF.min.js +1 -0
- package/dist/c-GXV3C3MO.min.js +1 -0
- package/dist/c-HHTK2R75.min.js +1 -0
- package/dist/c-HLLFJYTY.min.js +1 -0
- package/dist/c-HPOYKCCG.min.js +1 -0
- package/dist/c-HXDKPIKR.min.js +1 -0
- package/dist/c-I4QJ6YLM.min.js +1 -0
- package/dist/c-IDJV3CZK.min.js +1 -0
- package/dist/c-ITKX3RC5.min.js +1 -0
- package/dist/c-JG2JCQLP.min.js +1 -0
- package/dist/c-JLGRHXGZ.min.js +1 -0
- package/dist/c-JO2UGTCP.min.js +1 -0
- package/dist/c-JUKIWTBJ.min.js +1 -0
- package/dist/c-KCRJGUHP.min.js +1 -0
- package/dist/c-LMGSSD2E.min.js +1 -0
- package/dist/c-LYQMZMZQ.min.js +1 -0
- package/dist/c-LYVKDBQJ.min.js +1 -0
- package/dist/c-MVR3RWF3.min.js +1 -0
- package/dist/c-MXCP7GNZ.min.js +1 -0
- package/dist/c-NG7BLZTR.min.js +1 -0
- package/dist/c-NYZ2QNAM.min.js +1 -0
- package/dist/c-OO5QLMJC.min.js +1 -0
- package/dist/c-OOVX2JPQ.min.js +1 -0
- package/dist/c-ORLEBW72.min.js +1 -0
- package/dist/c-P65V6HLO.min.js +1 -0
- package/dist/c-PP6VY3QU.min.js +1 -0
- package/dist/c-PRIKOLTE.min.js +1 -0
- package/dist/c-PSNI6KAZ.min.js +1 -0
- package/dist/c-PYNW54D2.min.js +1 -0
- package/dist/c-QA3HMQJP.min.js +1 -0
- package/dist/c-QAVFOEUY.min.js +1 -0
- package/dist/c-ROEHCIGV.min.js +1 -0
- package/dist/c-S3AZX5PP.min.js +1 -0
- package/dist/c-T2V7O2LO.min.js +1 -0
- package/dist/c-TIXX5CAU.min.js +1 -0
- package/dist/c-TKG2NP7G.min.js +1 -0
- package/dist/c-VJTDST2R.min.js +1 -0
- package/dist/c-VXLOLYTO.min.js +1 -0
- package/dist/c-W4ZUKSEQ.min.js +1 -0
- package/dist/c-WH2O53VI.min.js +1 -0
- package/dist/c-WNGH47HF.min.js +1 -0
- package/dist/c-WUWXGQYA.min.js +1 -0
- package/dist/c-XDQKXPX4.min.js +1 -0
- package/dist/c-XSB27XPS.min.js +1 -0
- package/dist/c-YDECTEUW.min.js +1 -0
- package/dist/c-YF3YKVQI.min.js +1 -0
- package/dist/c-YLZIV3VS.min.js +1 -0
- package/dist/c-ZYPXQF7B.min.js +1 -0
- package/dist/components/Annotation.d.ts +3 -2
- package/dist/components/access/chartAccessCapabilities.generated.d.ts +14 -0
- package/dist/components/access/chartAccessContract.d.ts +90 -0
- package/dist/components/access/chartAccessContractFixtures.d.ts +11 -0
- package/dist/components/ai/aestheticProfileTypes.d.ts +35 -0
- package/dist/components/ai/annotationProvenance.d.ts +2 -7
- package/dist/components/ai/auditVisualHierarchy.d.ts +49 -0
- package/dist/components/ai/builtInChartRecipeLayouts.d.ts +2 -0
- package/dist/components/ai/builtInChartRecipePublic.d.ts +4 -0
- package/dist/components/ai/builtInChartRecipes.d.ts +26 -0
- package/dist/components/ai/chartCapabilities.d.ts +3 -1
- package/dist/components/ai/chartRecipeRegistry.d.ts +7 -1
- package/dist/components/ai/chartRecipes.d.ts +10 -0
- package/dist/components/ai/colorEvidence.d.ts +12 -0
- package/dist/components/ai/describePhysicsProjection.d.ts +18 -0
- package/dist/components/ai/describePhysicsSource.d.ts +13 -0
- package/dist/components/ai/evaluateAesthetics.d.ts +47 -0
- package/dist/components/ai/geoNavigation.d.ts +4 -0
- package/dist/components/ai/hierarchyNavigation.d.ts +4 -0
- package/dist/components/ai/navigationTree.d.ts +7 -1
- package/dist/components/ai/qualityFixtures.d.ts +8 -0
- package/dist/components/ai/suggestionPropContracts.d.ts +1 -1
- package/dist/components/ai/useNavigationSync.d.ts +3 -3
- package/dist/components/artifact/ArtifactInspector.d.ts +26 -0
- package/dist/components/artifact/ArtifactInspectorContextSections.d.ts +18 -0
- package/dist/components/artifact/artifactContractDiff.d.ts +8 -0
- package/dist/components/artifact/artifactInspectorSummary.d.ts +53 -0
- package/dist/components/artifact/artifactRevision.d.ts +54 -0
- package/dist/components/artifact/artifactTestFixtures.d.ts +17 -0
- package/dist/components/artifact/attachmentAudit.d.ts +13 -0
- package/dist/components/artifact/claimCorrections.d.ts +3 -0
- package/dist/components/artifact/claimGraph.d.ts +5 -0
- package/dist/components/artifact/claimLifecycle.d.ts +32 -0
- package/dist/components/artifact/claims.d.ts +24 -0
- package/dist/components/artifact/collection.d.ts +10 -0
- package/dist/components/artifact/collectionCorrectionScope.d.ts +4 -0
- package/dist/components/artifact/collectionImpact.d.ts +11 -0
- package/dist/components/artifact/collectionLineage.d.ts +3 -0
- package/dist/components/artifact/collectionOperations.d.ts +8 -0
- package/dist/components/artifact/collectionPolicy.d.ts +22 -0
- package/dist/components/artifact/collectionTypes.d.ts +117 -0
- package/dist/components/artifact/configurationRepair.d.ts +8 -0
- package/dist/components/artifact/contract.d.ts +30 -0
- package/dist/components/artifact/evaluateArtifact.d.ts +12 -0
- package/dist/components/artifact/evaluateArtifactTypes.d.ts +78 -0
- package/dist/components/artifact/evaluationPresentation.d.ts +9 -0
- package/dist/components/artifact/evidenceSample.d.ts +8 -0
- package/dist/components/artifact/exportPaths.d.ts +8 -0
- package/dist/components/artifact/fieldPolicies.d.ts +12 -0
- package/dist/components/artifact/fingerprint.d.ts +36 -0
- package/dist/components/artifact/grounding.d.ts +51 -0
- package/dist/components/artifact/groundingBudget.d.ts +38 -0
- package/dist/components/artifact/hostTransfer.d.ts +13 -0
- package/dist/components/artifact/identity.d.ts +19 -0
- package/dist/components/artifact/inheritance.d.ts +48 -0
- package/dist/components/artifact/inheritanceIntegrity.d.ts +3 -0
- package/dist/components/artifact/jsonCompatibility.d.ts +2 -0
- package/dist/components/artifact/obligations.d.ts +3 -0
- package/dist/components/artifact/policies.d.ts +45 -0
- package/dist/components/artifact/policyRelations.d.ts +3 -0
- package/dist/components/artifact/recordProjection.d.ts +7 -0
- package/dist/components/artifact/representation.d.ts +50 -0
- package/dist/components/artifact/serialization.d.ts +40 -0
- package/dist/components/artifact/temporal.d.ts +32 -0
- package/dist/components/artifact/temporalAdapters.d.ts +75 -0
- package/dist/components/artifact/temporalAuditHelpers.d.ts +12 -0
- package/dist/components/artifact/temporalPresentation.d.ts +8 -0
- package/dist/components/artifact/types.d.ts +341 -0
- package/dist/components/artifact/validation.d.ts +13 -0
- package/dist/components/artifact/validationFieldStatus.d.ts +7 -0
- package/dist/components/artifact/validationPrimitives.d.ts +24 -0
- package/dist/components/artifact/validationSurfaces.d.ts +7 -0
- package/dist/components/artifact/validationTemporal.d.ts +3 -0
- package/dist/components/charts/geo/FlowMap.d.ts +7 -0
- package/dist/components/charts/geo/flowMapLineStyle.d.ts +18 -0
- package/dist/components/charts/index.d.ts +4 -0
- package/dist/components/charts/network/ChordDiagram.d.ts +5 -1
- package/dist/components/charts/network/CirclePack.d.ts +8 -1
- package/dist/components/charts/network/OrbitDiagram.d.ts +9 -0
- package/dist/components/charts/network/TreeDiagram.d.ts +8 -1
- package/dist/components/charts/network/Treemap.d.ts +8 -1
- package/dist/components/charts/ordinal/BarChart.d.ts +6 -0
- package/dist/components/charts/ordinal/BoxPlot.d.ts +3 -0
- package/dist/components/charts/ordinal/DonutChart.d.ts +5 -0
- package/dist/components/charts/ordinal/DotPlot.d.ts +3 -0
- package/dist/components/charts/ordinal/FunnelChart.d.ts +5 -0
- package/dist/components/charts/ordinal/GaugeChart.d.ts +3 -0
- package/dist/components/charts/ordinal/GroupedBarChart.d.ts +6 -0
- package/dist/components/charts/ordinal/Histogram.d.ts +3 -0
- package/dist/components/charts/ordinal/LikertChart.d.ts +3 -0
- package/dist/components/charts/ordinal/PieChart.d.ts +5 -0
- package/dist/components/charts/ordinal/RadarChart.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/RadarChart.d.ts +77 -0
- package/dist/components/charts/ordinal/RidgelinePlot.d.ts +3 -0
- package/dist/components/charts/ordinal/StackedBarChart.d.ts +6 -0
- package/dist/components/charts/ordinal/SwarmPlot.d.ts +3 -0
- package/dist/components/charts/ordinal/SwimlaneChart.d.ts +3 -0
- package/dist/components/charts/ordinal/ViolinPlot.d.ts +3 -0
- package/dist/components/charts/physics/CollisionSwarmChart.d.ts +1 -1
- package/dist/components/charts/physics/EventDropChart.d.ts +3 -1
- package/dist/components/charts/physics/GaltonBoardChart.d.ts +4 -2
- package/dist/components/charts/physics/GauntletChart.d.ts +1 -5
- package/dist/components/charts/physics/ProcessFlowChart.d.ts +6 -0
- package/dist/components/charts/physics/UnitPileChart.d.ts +2 -1
- package/dist/components/charts/physics/chainReactionTypes.d.ts +3 -0
- package/dist/components/charts/physics/collisionSwarmPacking.d.ts +14 -0
- package/dist/components/charts/physics/collisionSwarmPhysics.d.ts +1 -0
- package/dist/components/charts/physics/eventDropAdmission.d.ts +32 -0
- package/dist/components/charts/physics/eventDropPhysics.d.ts +22 -1
- package/dist/components/charts/physics/galtonBoardPhysics.d.ts +2 -9
- package/dist/components/charts/physics/gauntletPhysics.d.ts +1 -0
- package/dist/components/charts/physics/physicsChartReconcile.d.ts +4 -0
- package/dist/components/charts/physics/physicsChartUtils.d.ts +1 -1
- package/dist/components/charts/physics/physicsGaltonData.d.ts +10 -0
- package/dist/components/charts/physics/physicsHocHandle.d.ts +2 -0
- package/dist/components/charts/physics/physicsHocUtils.d.ts +7 -1
- package/dist/components/charts/physics/physicsPileData.d.ts +11 -0
- package/dist/components/charts/physics/physicsPilePhysics.d.ts +5 -12
- package/dist/components/charts/physics/physicsProjectionOverlays.d.ts +1 -1
- package/dist/components/charts/physics/physicsSourceRows.d.ts +8 -0
- package/dist/components/charts/physics/usePhysicsChartData.d.ts +19 -0
- package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +14 -1
- package/dist/components/charts/realtime/RealtimeHistogram.d.ts +25 -7
- package/dist/components/charts/realtime/RealtimeLineChart.d.ts +18 -5
- package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +11 -1
- package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +11 -1
- package/dist/components/charts/realtime/aggregate.d.ts +12 -1
- package/dist/components/charts/realtime/realtimeAccessors.d.ts +4 -0
- package/dist/components/charts/realtime/realtimeChartRuntime.d.ts +8 -5
- package/dist/components/charts/realtime/realtimeChartTypes.d.ts +7 -0
- package/dist/components/charts/realtime/realtimeStyleRules.d.ts +4 -0
- package/dist/components/charts/realtime/temporalHistogramConfig.d.ts +17 -11
- package/dist/components/charts/shared/GaugeReadout.d.ts +9 -0
- package/dist/components/charts/shared/ThresholdAnnotation.d.ts +18 -0
- package/dist/components/charts/shared/ThresholdEndCap.d.ts +7 -0
- package/dist/components/charts/shared/annotationStatusFilter.d.ts +18 -0
- package/dist/components/charts/shared/auditAccessibilityText.d.ts +4 -2
- package/dist/components/charts/shared/chartDefinitionPilot.d.ts +5 -4
- package/dist/components/charts/shared/chartSpecCore.d.ts +2 -2
- package/dist/components/charts/shared/heatmapStyleRules.d.ts +13 -0
- package/dist/components/charts/shared/knownChartComponents.d.ts +1 -1
- package/dist/components/charts/shared/networkUtils.d.ts +14 -0
- package/dist/components/charts/shared/numericTickFormatter.d.ts +2 -0
- package/dist/components/charts/shared/radialCenterContent.d.ts +10 -0
- package/dist/components/charts/shared/selectionUtils.d.ts +3 -1
- package/dist/components/charts/shared/tooltipUtils.d.ts +1 -1
- package/dist/components/charts/shared/types.d.ts +4 -2
- package/dist/components/charts/shared/useChartLegend.d.ts +6 -1
- package/dist/components/charts/shared/useLikertAggregation.d.ts +8 -2
- package/dist/components/charts/shared/useNetworkChartSetup.d.ts +9 -5
- package/dist/components/charts/shared/useOrdinalPieceStyle.d.ts +1 -1
- package/dist/components/charts/shared/useXYBrush.d.ts +24 -0
- package/dist/components/charts/shared/useXYPointStyle.d.ts +2 -0
- package/dist/components/charts/xy/BubbleChart.d.ts +7 -0
- package/dist/components/charts/xy/CandlestickChart.d.ts +7 -0
- package/dist/components/charts/xy/DifferenceChart.d.ts +7 -0
- package/dist/components/charts/xy/Heatmap.d.ts +16 -0
- package/dist/components/charts/xy/LineChart.d.ts +9 -0
- package/dist/components/charts/xy/MinimapChart.d.ts +7 -0
- package/dist/components/charts/xy/MultiAxisLineChart.d.ts +7 -0
- package/dist/components/charts/xy/Scatterplot.d.ts +7 -0
- package/dist/components/charts/xy/ScatterplotMatrix.d.ts +6 -0
- package/dist/components/charts/xy/WaterfallChart.capability.d.ts +2 -0
- package/dist/components/charts/xy/WaterfallChart.d.ts +76 -0
- package/dist/components/charts/xy/differenceMarkStyle.d.ts +28 -0
- package/dist/components/charts/xy/multiAxisFields.d.ts +23 -0
- package/dist/components/charts/xy/scatterplotMatrixCells.d.ts +50 -0
- package/dist/components/evidence/chartEvidenceEnvelope.d.ts +154 -0
- package/dist/components/evidence/evidenceEnvelopeInput.d.ts +8 -0
- package/dist/components/evidence/evidenceEnvelopeValidation.d.ts +11 -0
- package/dist/components/evidence/evidenceGate.d.ts +30 -0
- package/dist/components/evidence/renderedSceneHash.d.ts +23 -0
- package/dist/components/evidence/stableJsonHash.d.ts +4 -0
- package/dist/components/export/chartConfig.d.ts +40 -5
- package/dist/components/export/chartConfigArtifact.d.ts +6 -0
- package/dist/components/legendLayout.d.ts +18 -0
- package/dist/components/legendStyles.d.ts +4 -0
- package/dist/components/realtime/BinAccumulator.d.ts +5 -1
- package/dist/components/realtime/types.d.ts +16 -7
- package/dist/components/recipes/adjacencyFlow.d.ts +12 -0
- package/dist/components/recipes/adjacencyFlowAggregation.d.ts +72 -0
- package/dist/components/recipes/adjacencyFlowGeometry.d.ts +79 -0
- package/dist/components/recipes/firstAvailableTrack.d.ts +17 -0
- package/dist/components/recipes/intervals.d.ts +1 -1
- package/dist/components/recipes/lineageDag.d.ts +17 -0
- package/dist/components/recipes/lineageDagHulls.d.ts +22 -0
- package/dist/components/recipes/transitDiagram.d.ts +75 -0
- package/dist/components/recipes/transitDiagramGeometry.d.ts +47 -0
- package/dist/components/semiotic-access.d.ts +9 -0
- package/dist/components/semiotic-ai-audits.d.ts +17 -0
- package/dist/components/semiotic-ai-core.d.ts +38 -18
- package/dist/components/semiotic-ai.d.ts +20 -20
- package/dist/components/semiotic-artifact-react.d.ts +10 -0
- package/dist/components/semiotic-artifact.d.ts +23 -0
- package/dist/components/semiotic-evidence.d.ts +10 -0
- package/dist/components/semiotic-experimental.d.ts +1 -1
- package/dist/components/semiotic-line.d.ts +9 -0
- package/dist/components/semiotic-network.d.ts +3 -0
- package/dist/components/semiotic-ordinal.d.ts +2 -0
- package/dist/components/semiotic-physics.d.ts +4 -4
- package/dist/components/semiotic-realtime-core.d.ts +3 -2
- package/dist/components/semiotic-recipes-core.d.ts +6 -0
- package/dist/components/semiotic-text.d.ts +2 -0
- package/dist/components/semiotic-themes-core.d.ts +3 -0
- package/dist/components/semiotic-utils-core.d.ts +19 -14
- package/dist/components/semiotic-xy.d.ts +3 -0
- package/dist/components/semiotic.d.ts +11 -5
- package/dist/components/server/renderDashboard.d.ts +37 -0
- package/dist/components/server/renderEvidence.d.ts +39 -0
- package/dist/components/server/renderToStaticSVG.d.ts +5 -30
- package/dist/components/server/serverChartConfigShared.d.ts +13 -0
- package/dist/components/server/serverChartConfigs.d.ts +9 -0
- package/dist/components/server/serverChartConfigsComposite.d.ts +4 -0
- package/dist/components/server/serverChartConfigsCustom.d.ts +2 -0
- package/dist/components/server/serverChartConfigsGeo.d.ts +1 -0
- package/dist/components/server/serverChartConfigsOrdinal.d.ts +3 -2
- package/dist/components/server/serverChartConfigsXY.d.ts +1 -0
- package/dist/components/server/serverChartConfigsXYExtra.d.ts +3 -0
- package/dist/components/server/serverCompositeChainReaction.d.ts +3 -0
- package/dist/components/server/serverOrdinalGauge.d.ts +3 -0
- package/dist/components/server/serverOrdinalLikert.d.ts +2 -0
- package/dist/components/server/staticSVGChrome.d.ts +1 -4
- package/dist/components/server/staticXYAxisTicks.d.ts +2 -38
- package/dist/components/server/staticXYGrid.d.ts +1 -1
- package/dist/components/server/svgSizing.d.ts +6 -0
- package/dist/components/shared/svgRoot.d.ts +17 -0
- package/dist/components/store/selectionProvenance.d.ts +14 -0
- package/dist/components/store/themeCore.d.ts +5 -1
- package/dist/components/stream/GeoPipelineStore.d.ts +1 -1
- package/dist/components/stream/GeoSVGOverlay.d.ts +4 -0
- package/dist/components/stream/MarginalGraphics.d.ts +3 -3
- package/dist/components/stream/MarginalGraphicsLazy.d.ts +22 -0
- package/dist/components/stream/NetworkPipelineStore.d.ts +2 -0
- package/dist/components/stream/NetworkSVGOverlay.d.ts +4 -0
- package/dist/components/stream/OrdinalPipelineStore.d.ts +1 -1
- package/dist/components/stream/OrdinalSVGOverlay.d.ts +4 -0
- package/dist/components/stream/PipelineStore.d.ts +1 -1
- package/dist/components/stream/SVGOverlay.d.ts +4 -0
- package/dist/components/stream/SceneToSVG.d.ts +4 -19
- package/dist/components/stream/SceneToSVGXY.d.ts +13 -0
- package/dist/components/stream/StreamGeoFrame.d.ts +1 -2
- package/dist/components/stream/StreamOrdinalFrame.d.ts +1 -2
- package/dist/components/stream/XYGrid.d.ts +11 -0
- package/dist/components/stream/axisTickUtils.d.ts +0 -1
- package/dist/components/stream/canvasSetup.d.ts +8 -2
- package/dist/components/stream/customLayoutAttempt.d.ts +21 -0
- package/dist/components/stream/geoTypes.d.ts +1 -1
- package/dist/components/stream/hitTestUtils.d.ts +2 -0
- package/dist/components/stream/isServerEnvironment.d.ts +6 -0
- package/dist/components/stream/layouts/forceLayoutNodeSize.d.ts +12 -0
- package/dist/components/stream/layouts/forceLayoutPlugin.d.ts +2 -9
- package/dist/components/stream/layouts/forceLayoutWorkerClient.d.ts +2 -21
- package/dist/components/stream/layouts/forceLayoutWorkerPolicy.d.ts +21 -0
- package/dist/components/stream/layouts/index.d.ts +6 -12
- package/dist/components/stream/layouts/missingPlugin.d.ts +7 -0
- package/dist/components/stream/layouts/registerBuiltIn.d.ts +1 -0
- package/dist/components/stream/layouts/registry.d.ts +12 -0
- package/dist/components/stream/marginalConfig.d.ts +3 -0
- package/dist/components/stream/networkCustomLayout.d.ts +7 -0
- package/dist/components/stream/networkCustomLayoutOutput.d.ts +13 -0
- package/dist/components/stream/networkCustomLayoutRunner.d.ts +1 -1
- package/dist/components/stream/networkTypes.d.ts +5 -1
- package/dist/components/stream/ordinalTypes.d.ts +1 -1
- package/dist/components/stream/overlayAccessibleText.d.ts +18 -0
- package/dist/components/stream/physics/PhysicsControllers.d.ts +1 -1
- package/dist/components/stream/physics/PhysicsKernel.d.ts +9 -0
- package/dist/components/stream/physics/PhysicsPipelineStore.d.ts +5 -4
- package/dist/components/stream/physics/PhysicsPipelineTypes.d.ts +9 -0
- package/dist/components/stream/physics/StreamPhysicsTypes.d.ts +4 -1
- package/dist/components/stream/physics/physicsCanvasCoordinates.d.ts +5 -0
- package/dist/components/stream/physics/physicsFixedPosition.d.ts +16 -0
- package/dist/components/stream/physics/physicsKernelCloning.d.ts +6 -0
- package/dist/components/stream/physics/physicsPipelineObservations.d.ts +2 -0
- package/dist/components/stream/physics/physicsPipelineSettle.d.ts +15 -9
- package/dist/components/stream/physics/physicsRegionRuntime.d.ts +8 -17
- package/dist/components/stream/physics/physicsSemanticUI.d.ts +9 -0
- package/dist/components/stream/pipelineConfig.d.ts +4 -0
- package/dist/components/stream/pipelineDomainResolution.d.ts +6 -0
- package/dist/components/stream/pipelineStoreUpdateResults.d.ts +1 -1
- package/dist/components/stream/renderers/pointCanvasRenderer.d.ts +4 -0
- package/dist/components/stream/renderers/resolveCSSColor.d.ts +4 -4
- package/dist/components/stream/resolveXYAxes.d.ts +13 -0
- package/dist/components/stream/sceneToSVGShared.d.ts +2 -1
- package/dist/components/stream/seriesGeometry.d.ts +13 -0
- package/dist/components/stream/streamEncodingTypes.d.ts +53 -0
- package/dist/components/stream/types.d.ts +12 -54
- package/dist/components/stream/useEnsureCustomXYRenderers.d.ts +18 -0
- package/dist/components/stream/useGeoFrameHandle.d.ts +16 -0
- package/dist/components/stream/useMarginalValues.d.ts +13 -0
- package/dist/components/stream/useOrdinalFrameHandle.d.ts +15 -0
- package/dist/components/stream/useXYFrameHandle.d.ts +15 -0
- package/dist/components/stream/xyAxisTicks.d.ts +25 -0
- package/dist/components/stream/xyCanvasRenderers.d.ts +4 -4
- package/dist/components/stream/xyDateTicks.d.ts +3 -2
- package/dist/components/stream/xyFrameAxisTypes.d.ts +2 -0
- package/dist/components/stream/xyPlugins/areaPlugin.d.ts +2 -0
- package/dist/components/stream/xyPlugins/barPlugin.d.ts +2 -0
- package/dist/components/stream/xyPlugins/candlestickPlugin.d.ts +2 -0
- package/dist/components/stream/xyPlugins/customPlugin.d.ts +6 -0
- package/dist/components/stream/xyPlugins/heatmapPlugin.d.ts +2 -0
- package/dist/components/stream/xyPlugins/lineFamily.d.ts +5 -0
- package/dist/components/stream/xyPlugins/linePlugin.d.ts +2 -0
- package/dist/components/stream/xyPlugins/missingPlugin.d.ts +7 -0
- package/dist/components/stream/xyPlugins/mixedPlugin.d.ts +2 -0
- package/dist/components/stream/xyPlugins/pointPlugin.d.ts +3 -0
- package/dist/components/stream/xyPlugins/registerBuiltIn.d.ts +1 -0
- package/dist/components/stream/xyPlugins/registry.d.ts +31 -0
- package/dist/components/stream/xyPlugins/stackedAreaPlugin.d.ts +2 -0
- package/dist/components/stream/xyPlugins/swarmPlugin.d.ts +2 -0
- package/dist/components/stream/xyPlugins/waterfallPlugin.d.ts +2 -0
- package/dist/components/stream/xySceneBuilders/ribbonScene.d.ts +1 -1
- package/dist/components/stream/xySceneBuilders/types.d.ts +1 -0
- package/dist/components/text/annotationTextLayout.d.ts +28 -0
- package/dist/components/text/pretextAnnotationLayout.d.ts +29 -0
- package/dist/components/text/usePretextAnnotations.d.ts +12 -0
- 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.module.min.js +1 -1
- package/dist/ordinal.module.min.js +1 -1
- package/dist/physics-matter.min.js +1 -1
- package/dist/physics-matter.module.min.js +1 -1
- package/dist/physics-rapier.min.js +1 -1
- package/dist/physics-rapier.module.min.js +1 -1
- package/dist/physics.module.min.js +1 -1
- package/dist/physicsWorker.js +1 -1
- package/dist/processSankeyLayoutWorker.js +1 -1
- package/dist/rough.min.js +1 -1
- package/dist/rough.module.min.js +1 -1
- package/dist/semiotic-access.d.ts +9 -0
- package/dist/semiotic-access.min.js +2 -0
- package/dist/semiotic-access.module.min.js +2 -0
- package/dist/semiotic-ai-artifact-policy-constants.module.min.js +2 -0
- package/dist/semiotic-ai-core.d.ts +38 -18
- package/dist/semiotic-ai-core.min.js +1 -1
- package/dist/semiotic-ai-core.module.min.js +1 -1
- package/dist/semiotic-ai-hash-primitives.module.min.js +2 -0
- package/dist/semiotic-ai.d.ts +20 -20
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-artifact-react.d.ts +10 -0
- package/dist/semiotic-artifact-react.min.js +2 -0
- package/dist/semiotic-artifact-react.module.min.js +2 -0
- package/dist/semiotic-artifact.d.ts +23 -0
- package/dist/semiotic-artifact.min.js +1 -0
- package/dist/semiotic-artifact.module.min.js +1 -0
- package/dist/semiotic-client-cjs-shared.min.js +1 -1
- package/dist/semiotic-client-glyph.module.min.js +1 -1
- package/dist/semiotic-client-responsive.module.min.js +1 -1
- package/dist/semiotic-client-shared.module.min.js +1 -1
- package/dist/semiotic-custom-layout-selection-cjs-shared.min.js +1 -1
- package/dist/semiotic-data.min.js +1 -1
- package/dist/semiotic-data.module.min.js +1 -1
- package/dist/semiotic-evidence.d.ts +10 -0
- package/dist/semiotic-evidence.min.js +1 -0
- package/dist/semiotic-evidence.module.min.js +1 -0
- package/dist/semiotic-experimental-auxiliary.module.min.js +1 -1
- package/dist/semiotic-experimental-node-auxiliary.module.min.js +1 -1
- package/dist/semiotic-experimental-react-shared.module.min.js +1 -1
- 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-line.d.ts +9 -0
- package/dist/semiotic-line.min.js +2 -0
- package/dist/semiotic-line.module.min.js +2 -0
- package/dist/semiotic-network.d.ts +3 -0
- package/dist/semiotic-ordinal.d.ts +2 -0
- package/dist/semiotic-physics.d.ts +4 -4
- package/dist/semiotic-realtime-core.d.ts +3 -2
- package/dist/semiotic-realtime-core.module.min.js +1 -1
- package/dist/semiotic-realtime-react.module.min.js +1 -1
- package/dist/semiotic-recipes-core-cjs-base.min.js +1 -1
- package/dist/semiotic-recipes-core.d.ts +6 -0
- package/dist/semiotic-recipes-core.module.min.js +1 -1
- package/dist/semiotic-recipes-geo-cjs.min.js +1 -1
- package/dist/semiotic-recipes-react.min.js +1 -1
- package/dist/semiotic-server-edge-node.module.min.js +1 -1
- 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-text.d.ts +2 -0
- package/dist/semiotic-text.min.js +2 -0
- package/dist/semiotic-text.module.min.js +2 -0
- package/dist/semiotic-themes-core.d.ts +3 -0
- package/dist/semiotic-themes-core.min.js +1 -1
- package/dist/semiotic-themes-core.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 +19 -14
- package/dist/semiotic-utils-core.min.js +1 -1
- package/dist/semiotic-utils-core.module.min.js +1 -1
- package/dist/semiotic-value.module.min.js +1 -1
- package/dist/semiotic-xy.d.ts +3 -0
- package/dist/semiotic.d.ts +11 -5
- 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.module.min.js +1 -1
- package/package.json +91 -71
- package/spec/README.md +8 -3
- package/spec/v0.1/artifact-contract.schema.json +2299 -0
- package/spec/v0.1/examples/artifact-contract-full.json +369 -0
- package/spec/v0.1/examples/artifact-contract-unknown-state.json +46 -0
- package/dist/c-3BLJEQNG.min.js +0 -1
- package/dist/c-3KZD6AXJ.min.js +0 -1
- package/dist/c-4TWEX5HG.min.js +0 -1
- package/dist/c-52TEGIUJ.min.js +0 -1
- package/dist/c-5YCIX3VZ.min.js +0 -1
- package/dist/c-6FEKTA3U.min.js +0 -1
- package/dist/c-6O5EVOPH.min.js +0 -1
- package/dist/c-74HEEZGK.min.js +0 -1
- package/dist/c-AKAF6JAD.min.js +0 -1
- package/dist/c-BBKITSXB.min.js +0 -1
- package/dist/c-BWNB6USU.min.js +0 -1
- package/dist/c-C25ENHIK.min.js +0 -1
- package/dist/c-CDR5AO3R.min.js +0 -1
- package/dist/c-COHXCW3Q.min.js +0 -1
- package/dist/c-DADXPJXV.min.js +0 -1
- package/dist/c-E3JFRRMI.min.js +0 -1
- package/dist/c-EBFPQHHO.min.js +0 -1
- package/dist/c-G36WS6LN.min.js +0 -1
- package/dist/c-GGISSW5E.min.js +0 -1
- package/dist/c-GIKRQI4X.min.js +0 -1
- package/dist/c-GPYOFETM.min.js +0 -1
- package/dist/c-IDUHYYSI.min.js +0 -1
- package/dist/c-IUHFPMHD.min.js +0 -1
- package/dist/c-J5G56TUH.min.js +0 -1
- package/dist/c-JAZ73J32.min.js +0 -1
- package/dist/c-KG3NXHAL.min.js +0 -1
- package/dist/c-KII3PLZE.min.js +0 -1
- package/dist/c-LIXGXMNS.min.js +0 -1
- package/dist/c-LVEY6D6B.min.js +0 -1
- package/dist/c-M4Y3BHFR.min.js +0 -1
- package/dist/c-MAIICR2Z.min.js +0 -1
- package/dist/c-MG5DM6VE.min.js +0 -1
- package/dist/c-MNF2S4AA.min.js +0 -1
- package/dist/c-MT3WBK7M.min.js +0 -1
- package/dist/c-NY3JWV2K.min.js +0 -1
- package/dist/c-O6U6K4CW.min.js +0 -1
- package/dist/c-OQ7M4AGV.min.js +0 -1
- package/dist/c-OXYMVK7Q.min.js +0 -1
- package/dist/c-PPWDL5ZI.min.js +0 -1
- package/dist/c-QHF5YON3.min.js +0 -1
- package/dist/c-RR3GO5SW.min.js +0 -1
- package/dist/c-RSVIHIQ4.min.js +0 -1
- package/dist/c-S2BXNNJN.min.js +0 -1
- package/dist/c-S6U5CGT5.min.js +0 -1
- package/dist/c-SLGMUBUL.min.js +0 -1
- package/dist/c-SUILCHWU.min.js +0 -1
- package/dist/c-TZW3JGJ5.min.js +0 -1
- package/dist/c-US5ZFT6E.min.js +0 -1
- package/dist/c-USFMFKIH.min.js +0 -1
- package/dist/c-UUKVD4WB.min.js +0 -1
- package/dist/c-VGW3VG3I.min.js +0 -1
- package/dist/c-W3CE4A4S.min.js +0 -1
- package/dist/c-WJCD5EUY.min.js +0 -1
- package/dist/c-X5UBGU2V.min.js +0 -1
- package/dist/c-YDAY2WFR.min.js +0 -1
- package/dist/c-ZOWWU34K.min.js +0 -1
- /package/dist/{c-N4G2L7ID.min.js → c-HYW2XA4Q.min.js} +0 -0
- /package/dist/{c-OCI56QF2.min.js → c-V4XMSLC3.min.js} +0 -0
package/dist/geo.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
var e,t,n,r=Object.create,i=Object.defineProperty,o=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,s=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty,c=(e,t)=>{for(var n in t)i(e,n,{get:t[n],enumerable:!0})},u=(e,t,n,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let s of a(t))l.call(e,s)||s===n||i(e,s,{get:()=>t[s],enumerable:!(r=o(t,s))||r.enumerable});return e},d=(e,t,n)=>(n=null!=e?r(s(e)):{},u(!t&&e&&e.__esModule?n:i(n,"default",{value:e,enumerable:!0}),e)),h={};function f({target:r,children:i}){const[o,a]=e.useState({requestedTarget:r,resolved:!1,target:null});return e.useEffect(()=>{const e=function(e){return"string"==typeof e?document.getElementById(e):"function"==typeof e?e():e}(r);"production"!==process.env.NODE_ENV&&null==e&&"string"==typeof r&&console.warn(`[Semiotic] accessibleTable portal target "${r}" was not found. Rendering the data-summary controls inline instead.`),a({requestedTarget:r,resolved:!0,target:e})},[r]),o.requestedTarget===r&&o.resolved?o.target?(0,t.createPortal)(i,o.target):(0,n.jsx)(n.Fragment,{children:i}):null}c(h,{default:()=>f});var p,m,g,y,v=(p={"src/components/stream/AccessibleTablePortalImpl.tsx"(){e=d(require("react")),t=require("react-dom"),n=require("react/jsx-runtime")}},function(){if(g)throw g[0];try{return p&&(m=(0,p[a(p)[0]])(p=0)),m}catch(e){throw g=[e],e}}),b={};c(b,{ChoroplethMap:()=>Ld,DEFAULT_HIT_RADIUS:()=>oh,DistanceCartogram:()=>Jd,FlowMap:()=>Yd,GeoCustomChart:()=>rh,MultiLineTooltip:()=>Bc,ProportionalSymbolMap:()=>Wd,StreamGeoFrame:()=>uu,Tooltip:()=>Wc,TooltipRoot:()=>Zl,composeStyleRules:()=>td,geoAreaHitTarget:()=>lh,geoHitTarget:()=>sh,geographicDotGridLayout:()=>Gh,geographicGridLayout:()=>xh,glyphExtent:()=>Fi,glyphPlacement:()=>Oi,gridifyGeographicPoints:()=>yh,hatchFillId:()=>La,hatchPatternDef:()=>Na,hitTargetPoint:()=>ah,isHatchFill:()=>Ca,makeNodeRuleContext:()=>Zu,makeRuleValueResolver:()=>Xu,markTooltipChrome:()=>Kl,matchesThreshold:()=>Qu,mergeData:()=>Vh,resolveReferenceGeography:()=>Md,resolveResponsiveRules:()=>Su,resolveStyleRules:()=>ed,resolveSvgFill:()=>Ea,responsiveRuleMatches:()=>ku,ruleMatches:()=>Ju,sampleGeographicDotGrid:()=>Oh}),module.exports=(y=b,u(i({},"__esModule",{value:!0}),y));var x=require("react"),w=require("d3-array"),k=1e-6,S=Math.PI,M=S/2,j=S/4,A=2*S,C=180/S,R=S/180,L=Math.abs,P=Math.atan,N=Math.atan2,E=Math.cos,I=Math.ceil,T=Math.exp,z=Math.log,D=Math.sin,_=Math.sign||function(e){return e>0?1:0>e?-1:0},O=Math.sqrt,F=Math.tan;function W(e){return e>1?M:-1>e?-M:Math.asin(e)}function B(e){return(e=D(e/2))*e}function H(){}function $(e,t){e&&G.hasOwnProperty(e.type)&&G[e.type](e,t)}var q={Feature:function(e,t){$(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,i=n.length;++r<i;)$(n[r].geometry,t)}},G={Sphere:function(e,t){t.sphere()},Point:function(e,t){t.point((e=e.coordinates)[0],e[1],e[2])},MultiPoint:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)t.point((e=n[r])[0],e[1],e[2])},LineString:function(e,t){V(e.coordinates,t,0)},MultiLineString:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)V(n[r],t,0)},Polygon:function(e,t){U(e.coordinates,t)},MultiPolygon:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)U(n[r],t)},GeometryCollection:function(e,t){for(var n=e.geometries,r=-1,i=n.length;++r<i;)$(n[r],t)}};function V(e,t,n){var r,i=-1,o=e.length-n;for(t.lineStart();++i<o;)t.point((r=e[i])[0],r[1],r[2]);t.lineEnd()}function U(e,t){var n=-1,r=e.length;for(t.polygonStart();++n<r;)V(e[n],t,1);t.polygonEnd()}function Y(e,t){e&&q.hasOwnProperty(e.type)?q[e.type](e,t):$(e,t)}var X,Z,K,Q,J,ee=new w.Adder,te=new w.Adder,ne={point:H,lineStart:H,lineEnd:H,polygonStart:function(){ee=new w.Adder,ne.lineStart=re,ne.lineEnd=ie},polygonEnd:function(){var e=+ee;te.add(0>e?A+e:e),this.lineStart=this.lineEnd=this.point=H},sphere:function(){te.add(A)}};function re(){ne.point=oe}function ie(){ae(X,Z)}function oe(e,t){ne.point=ae,X=e,Z=t,K=e*=R,Q=E(t=(t*=R)/2+j),J=D(t)}function ae(e,t){var n=(e*=R)-K,r=0>n?-1:1,i=r*n,o=E(t=(t*=R)/2+j),a=D(t),s=J*a,l=Q*o+s*E(i),c=s*r*D(i);ee.add(N(c,l)),K=e,Q=o,J=a}var se,le,ce,ue,de,he,fe,pe,me,ge,ye,ve=require("d3-array");function be(e){return[N(e[1],e[0]),W(e[2])]}function xe(e){var t=e[0],n=e[1],r=E(n);return[r*E(t),r*D(t),D(n)]}function we(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function ke(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function Se(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function Me(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function je(e){var t=O(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}var Ae={point:Ce,lineStart:Le,lineEnd:Pe,polygonStart:function(){Ae.point=Ne,Ae.lineStart=Ee,Ae.lineEnd=Ie,me=new ve.Adder,ne.polygonStart()},polygonEnd:function(){ne.polygonEnd(),Ae.point=Ce,Ae.lineStart=Le,Ae.lineEnd=Pe,0>ee?(se=-(ce=180),le=-(ue=90)):me>k?ue=90:-k>me&&(le=-90),ye[0]=se,ye[1]=ce},sphere:function(){se=-(ce=180),le=-(ue=90)}};function Ce(e,t){ge.push(ye=[se=e,ce=e]),le>t&&(le=t),t>ue&&(ue=t)}function Re(e,t){var n=xe([e*R,t*R]);if(pe){var r=ke(pe,n),i=ke([r[1],-r[0],0],r);je(i),i=be(i);var o,a=e-de,s=a>0?1:-1,l=i[0]*C*s,c=L(a)>180;c^(l>s*de&&s*e>l)?(o=i[1]*C)>ue&&(ue=o):c^((l=(l+360)%360-180)>s*de&&s*e>l)?le>(o=-i[1]*C)&&(le=o):(le>t&&(le=t),t>ue&&(ue=t)),c?de>e?Te(se,e)>Te(se,ce)&&(ce=e):Te(e,ce)>Te(se,ce)&&(se=e):se>ce?e>de?Te(se,e)>Te(se,ce)&&(ce=e):Te(e,ce)>Te(se,ce)&&(se=e):(se>e&&(se=e),e>ce&&(ce=e))}else ge.push(ye=[se=e,ce=e]);le>t&&(le=t),t>ue&&(ue=t),pe=n,de=e}function Le(){Ae.point=Re}function Pe(){ye[0]=se,ye[1]=ce,Ae.point=Ce,pe=null}function Ne(e,t){if(pe){var n=e-de;me.add(L(n)>180?n+(n>0?360:-360):n)}else he=e,fe=t;ne.point(e,t),Re(e,t)}function Ee(){ne.lineStart()}function Ie(){Ne(he,fe),ne.lineEnd(),L(me)>k&&(se=-(ce=180)),ye[0]=se,ye[1]=ce,pe=null}function Te(e,t){return 0>(t-=e)?t+360:t}function ze(e,t){return e[0]-t[0]}function De(e,t){return e[0]>e[1]?e[0]>t||t>e[1]:t>=e[0]&&e[1]>=t}function _e(e,t){function n(n,r){return n=e(n,r),t(n[0],n[1])}return e.invert&&t.invert&&(n.invert=function(n,r){return(n=t.invert(n,r))&&e.invert(n[0],n[1])}),n}function Oe(e,t){return L(e)>S&&(e-=Math.round(e/A)*A),[e,t]}function Fe(e,t,n){return(e%=A)?t||n?_e(Be(e),He(t,n)):Be(e):t||n?He(t,n):Oe}function We(e){return function(t,n){return L(t+=e)>S&&(t-=Math.round(t/A)*A),[t,n]}}function Be(e){var t=We(e);return t.invert=We(-e),t}function He(e,t){var n=E(e),r=D(e),i=E(t),o=D(t);function a(e,t){var a=E(t),s=E(e)*a,l=D(e)*a,c=D(t),u=c*n+s*r;return[N(l*i-u*o,s*n-c*r),W(u*i+l*o)]}return a.invert=function(e,t){var a=E(t),s=E(e)*a,l=D(e)*a,c=D(t),u=c*i-l*o;return[N(l*i+c*o,s*n+u*r),W(u*n-s*r)]},a}function $e(e,t){(t=xe(t))[0]-=e,je(t);var n,r=(n=-t[1])>1?0:-1>n?S:Math.acos(n);return((0>-t[2]?-r:r)+A-k)%A}function qe(){var e,t=[];return{point:function(t,n,r){e.push([t,n,r])},lineStart:function(){t.push(e=[])},lineEnd:H,rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))},result:function(){var n=t;return t=[],e=null,n}}}function Ge(e,t){return L(e[0]-t[0])<k&&L(e[1]-t[1])<k}function Ve(e,t,n,r){this.x=e,this.z=t,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function Ue(e,t,n,r,i){var o,a,s=[],l=[];if(e.forEach(function(e){if((t=e.length-1)>0){var t,n,r=e[0],a=e[t];if(Ge(r,a)){if(!r[2]&&!a[2]){for(i.lineStart(),o=0;t>o;++o)i.point((r=e[o])[0],r[1]);return void i.lineEnd()}a[0]+=2e-6}s.push(n=new Ve(r,e,null,!0)),l.push(n.o=new Ve(r,null,n,!1)),s.push(n=new Ve(a,e,null,!1)),l.push(n.o=new Ve(a,null,n,!0))}}),s.length){for(l.sort(t),Ye(s),Ye(l),o=0,a=l.length;a>o;++o)l[o].e=n=!n;for(var c,u,d=s[0];;){for(var h=d,f=!0;h.v;)if((h=h.n)===d)return;c=h.z,i.lineStart();do{if(h.v=h.o.v=!0,h.e){if(f)for(o=0,a=c.length;a>o;++o)i.point((u=c[o])[0],u[1]);else r(h.x,h.n.x,1,i);h=h.n}else{if(f)for(o=(c=h.p.z).length-1;o>=0;--o)i.point((u=c[o])[0],u[1]);else r(h.x,h.p.x,-1,i);h=h.p}c=(h=h.o).z,f=!f}while(!h.v);i.lineEnd()}}}function Ye(e){if(t=e.length){for(var t,n,r=0,i=e[0];++r<t;)i.n=n=e[r],n.p=i,i=n;i.n=n=e[0],n.p=i}}Oe.invert=Oe;var Xe=require("d3-array");function Ze(e){return L(e[0])>S?_(e[0])*((L(e[0])+S)%A-S):e[0]}function Ke(e,t){var n=Ze(t),r=t[1],i=D(r),o=[D(n),-E(n),0],a=0,s=0,l=new Xe.Adder;1===i?r=M+k:-1===i&&(r=-M-k);for(var c=0,u=e.length;u>c;++c)if(h=(d=e[c]).length)for(var d,h,f=d[h-1],p=Ze(f),m=f[1]/2+j,g=D(m),y=E(m),v=0;h>v;++v,p=x,g=C,y=R,f=b){var b=d[v],x=Ze(b),w=b[1]/2+j,C=D(w),R=E(w),L=x-p,P=0>L?-1:1,I=P*L,T=I>S,z=g*C;if(l.add(N(z*P*D(I),y*R+z*E(I))),a+=T?L+P*A:L,T^p>=n^x>=n){var _=ke(xe(f),xe(b));je(_);var O=ke(o,_);je(O);var F=(T^L>=0?-1:1)*W(O[2]);(r>F||r===F&&(_[0]||_[1]))&&(s+=T^L>=0?1:-1)}}return(-k>a||k>a&&-1e-12>l)^1&s}var Qe=require("d3-array");function Je(e,t,n,r){return function(i){var o,a,s,l=t(i),c=qe(),u=t(c),d=!1,h={point:f,lineStart:m,lineEnd:g,polygonStart:function(){h.point=y,h.lineStart=v,h.lineEnd=b,a=[],o=[]},polygonEnd:function(){h.point=f,h.lineStart=m,h.lineEnd=g,a=(0,Qe.merge)(a);var e=Ke(o,r);a.length?(d||(i.polygonStart(),d=!0),Ue(a,tt,e,n,i)):e&&(d||(i.polygonStart(),d=!0),i.lineStart(),n(null,null,1,i),i.lineEnd()),d&&(i.polygonEnd(),d=!1),a=o=null},sphere:function(){i.polygonStart(),i.lineStart(),n(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function f(t,n){e(t,n)&&i.point(t,n)}function p(e,t){l.point(e,t)}function m(){h.point=p,l.lineStart()}function g(){h.point=f,l.lineEnd()}function y(e,t){s.push([e,t]),u.point(e,t)}function v(){u.lineStart(),s=[]}function b(){y(s[0][0],s[0][1]),u.lineEnd();var e,t,n,r,l=u.clean(),h=c.result(),f=h.length;if(s.pop(),o.push(s),s=null,f)if(1&l){if((t=(n=h[0]).length-1)>0){for(d||(i.polygonStart(),d=!0),i.lineStart(),e=0;t>e;++e)i.point((r=n[e])[0],r[1]);i.lineEnd()}}else f>1&&2&l&&h.push(h.pop().concat(h.shift())),a.push(h.filter(et))}return h}}function et(e){return e.length>1}function tt(e,t){return(0>(e=e.x)[0]?e[1]-M-k:M-e[1])-(0>(t=t.x)[0]?t[1]-M-k:M-t[1])}var nt=Je(function(){return!0},function(e){var t,n=NaN,r=NaN,i=NaN;return{lineStart:function(){e.lineStart(),t=1},point:function(o,a){var s=o>0?S:-S,l=L(o-n);L(l-S)<k?(e.point(n,r=(r+a)/2>0?M:-M),e.point(i,r),e.lineEnd(),e.lineStart(),e.point(s,r),e.point(o,r),t=0):i===s||S>l||(L(n-i)<k&&(n-=i*k),L(o-s)<k&&(o-=s*k),r=function(e,t,n,r){var i,o,a=D(e-n);return L(a)>k?P((D(t)*(o=E(r))*D(n)-D(r)*(i=E(t))*D(e))/(i*o*a)):(t+r)/2}(n,r,o,a),e.point(i,r),e.lineEnd(),e.lineStart(),e.point(s,r),t=0),e.point(n=o,r=a),i=s},lineEnd:function(){e.lineEnd(),n=r=NaN},clean:function(){return 2-t}}},function(e,t,n,r){var i;if(null==e)r.point(-S,i=n*M),r.point(0,i),r.point(S,i),r.point(S,0),r.point(S,-i),r.point(0,-i),r.point(-S,-i),r.point(-S,0),r.point(-S,i);else if(L(e[0]-t[0])>k){var o=t[0]>e[0]?S:-S;r.point(-o,i=n*o/2),r.point(0,i),r.point(o,i)}else r.point(t[0],t[1])},[-S,-M]);var rt=require("d3-array"),it=1e9,ot=-it;var at,st,lt,ct,ut=require("d3-array"),dt={sphere:H,point:H,lineStart:function(){dt.point=ft,dt.lineEnd=ht},lineEnd:H,polygonStart:H,polygonEnd:H};function ht(){dt.point=dt.lineEnd=H}function ft(e,t){st=e*=R,lt=D(t*=R),ct=E(t),dt.point=pt}function pt(e,t){e*=R;var n=D(t*=R),r=E(t),i=L(e-st),o=E(i),a=r*D(i),s=ct*n-lt*r*o,l=lt*n+ct*r*o;at.add(N(O(a*a+s*s),l)),st=e,lt=n,ct=r}var mt=[null,null],gt={type:"LineString",coordinates:mt};function yt(e,t){return mt[0]=e,mt[1]=t,n=gt,at=new ut.Adder,Y(n,dt),+at;var n}var vt={Feature:function(e,t){return xt(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,i=n.length;++r<i;)if(xt(n[r].geometry,t))return!0;return!1}},bt={Sphere:function(){return!0},Point:function(e,t){return wt(e.coordinates,t)},MultiPoint:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)if(wt(n[r],t))return!0;return!1},LineString:function(e,t){return kt(e.coordinates,t)},MultiLineString:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)if(kt(n[r],t))return!0;return!1},Polygon:function(e,t){return St(e.coordinates,t)},MultiPolygon:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)if(St(n[r],t))return!0;return!1},GeometryCollection:function(e,t){for(var n=e.geometries,r=-1,i=n.length;++r<i;)if(xt(n[r],t))return!0;return!1}};function xt(e,t){return!(!e||!bt.hasOwnProperty(e.type))&&bt[e.type](e,t)}function wt(e,t){return 0===yt(e,t)}function kt(e,t){for(var n,r,i,o=0,a=e.length;a>o;o++){if(0===(r=yt(e[o],t)))return!0;if(o>0&&(i=yt(e[o],e[o-1]))>0&&i>=n&&i>=r&&1e-12*i>(n+r-i)*(1-Math.pow((n-r)/i,2)))return!0;n=r}return!1}function St(e,t){return!!Ke(e.map(Mt),jt(t))}function Mt(e){return(e=e.map(jt)).pop(),e}function jt(e){return[e[0]*R,e[1]*R]}function At(e,t){return(e&&vt.hasOwnProperty(e.type)?vt[e.type]:xt)(e,t)}var Ct=require("d3-array");function Rt(e,t,n){var r=(0,Ct.range)(e,t-k,n).concat(t);return function(e){return r.map(function(t){return[e,t]})}}function Lt(e,t,n){var r=(0,Ct.range)(e,t-k,n).concat(t);return function(e){return r.map(function(t){return[t,e]})}}function Pt(e,t){var n=e[0]*R,r=e[1]*R,i=t[0]*R,o=t[1]*R,a=E(r),s=D(r),l=E(o),c=D(o),u=a*E(n),d=a*D(n),h=l*E(i),f=l*D(i),p=2*W(O(B(o-r)+a*l*B(i-n))),m=D(p),g=p?function(e){var t=D(e*=p)/m,n=D(p-e)/m,r=n*u+t*h,i=n*d+t*f,o=n*s+t*c;return[N(i,r)*C,N(o,O(r*r+i*i))*C]}:function(){return[n*C,r*C]};return g.distance=p,g}var Nt,Et,It,Tt,zt=e=>e,Dt=require("d3-array"),_t=new Dt.Adder,Ot=new Dt.Adder,Ft={point:H,lineStart:H,lineEnd:H,polygonStart:function(){Ft.lineStart=Wt,Ft.lineEnd=$t},polygonEnd:function(){Ft.lineStart=Ft.lineEnd=Ft.point=H,_t.add(L(Ot)),Ot=new Dt.Adder},result:function(){var e=_t/2;return _t=new Dt.Adder,e}};function Wt(){Ft.point=Bt}function Bt(e,t){Ft.point=Ht,Nt=It=e,Et=Tt=t}function Ht(e,t){Ot.add(Tt*e-It*t),It=e,Tt=t}function $t(){Ht(Nt,Et)}var qt,Gt,Vt,Ut,Yt=Ft,Xt=1/0,Zt=Xt,Kt=-Xt,Qt=Kt,Jt={point:function(e,t){Xt>e&&(Xt=e),e>Kt&&(Kt=e),Zt>t&&(Zt=t),t>Qt&&(Qt=t)},lineStart:H,lineEnd:H,polygonStart:H,polygonEnd:H,result:function(){var e=[[Xt,Zt],[Kt,Qt]];return Kt=Qt=-(Zt=Xt=1/0),e}},en=0,tn=0,nn=0,rn=0,on=0,an=0,sn=0,ln=0,cn=0,un={point:dn,lineStart:hn,lineEnd:mn,polygonStart:function(){un.lineStart=gn,un.lineEnd=yn},polygonEnd:function(){un.point=dn,un.lineStart=hn,un.lineEnd=mn},result:function(){var e=cn?[sn/cn,ln/cn]:an?[rn/an,on/an]:nn?[en/nn,tn/nn]:[NaN,NaN];return en=tn=nn=rn=on=an=sn=ln=cn=0,e}};function dn(e,t){en+=e,tn+=t,++nn}function hn(){un.point=fn}function fn(e,t){un.point=pn,dn(Vt=e,Ut=t)}function pn(e,t){var n=e-Vt,r=t-Ut,i=O(n*n+r*r);rn+=i*(Vt+e)/2,on+=i*(Ut+t)/2,an+=i,dn(Vt=e,Ut=t)}function mn(){un.point=dn}function gn(){un.point=vn}function yn(){bn(qt,Gt)}function vn(e,t){un.point=bn,dn(qt=Vt=e,Gt=Ut=t)}function bn(e,t){var n=e-Vt,r=t-Ut,i=O(n*n+r*r);rn+=i*(Vt+e)/2,on+=i*(Ut+t)/2,an+=i,sn+=(i=Ut*e-Vt*t)*(Vt+e),ln+=i*(Ut+t),cn+=3*i,dn(Vt=e,Ut=t)}var xn=un;function wn(e){this._context=e}wn.prototype={_radius:4.5,pointRadius:function(e){return this._radius=e,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(e,t){switch(this._point){case 0:this._context.moveTo(e,t),this._point=1;break;case 1:this._context.lineTo(e,t);break;default:this._context.moveTo(e+this._radius,t),this._context.arc(e,t,this._radius,0,A)}},result:H};var kn,Sn,Mn,jn,An,Cn=require("d3-array"),Rn=new Cn.Adder,Ln={point:H,lineStart:function(){Ln.point=Pn},lineEnd:function(){kn&&Nn(Sn,Mn),Ln.point=H},polygonStart:function(){kn=!0},polygonEnd:function(){kn=null},result:function(){var e=+Rn;return Rn=new Cn.Adder,e}};function Pn(e,t){Ln.point=Nn,Sn=jn=e,Mn=An=t}function Nn(e,t){Rn.add(O((jn-=e)*jn+(An-=t)*An)),jn=e,An=t}var En,In,Tn,zn,Dn=Ln,_n=class{constructor(e){this._append=null==e?On:function(e){const t=Math.floor(e);if(0>t)throw new RangeError("invalid digits: "+e);if(t>15)return On;if(t!==En){const e=10**t;En=t,In=function(t){let n=1;this._+=t[0];for(const r=t.length;r>n;++n)this._+=Math.round(arguments[n]*e)/e+t[n]}}return In}(e),this._radius=4.5,this._=""}pointRadius(e){return this._radius=+e,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){0===this._line&&(this._+="Z"),this._point=NaN}point(e,t){switch(this._point){case 0:this._append`M${e},${t}`,this._point=1;break;case 1:this._append`L${e},${t}`;break;default:if(this._append`M${e},${t}`,this._radius!==Tn||this._append!==In){const e=this._radius,t=this._;this._="",this._append`m0,${e}a${e},${e} 0 1,1 0,${-2*e}a${e},${e} 0 1,1 0,${2*e}z`,Tn=e,In=this._append,zn=this._,this._=t}this._+=zn}}result(){const e=this._;return this._="",e.length?e:null}};function On(e){let t=1;this._+=e[0];for(const n=e.length;n>t;++t)this._+=arguments[t]+e[t]}function Fn(e,t){let n,r,i=3,o=4.5;function a(e){return e&&("function"==typeof o&&r.pointRadius(+o.apply(this,arguments)),Y(e,n(r))),r.result()}return a.area=function(e){return Y(e,n(Yt)),Yt.result()},a.measure=function(e){return Y(e,n(Dn)),Dn.result()},a.bounds=function(e){return Y(e,n(Jt)),Jt.result()},a.centroid=function(e){return Y(e,n(xn)),xn.result()},a.projection=function(t){return arguments.length?(n=null==t?(e=null,zt):(e=t).stream,a):e},a.context=function(e){return arguments.length?(r=null==e?(t=null,new _n(i)):new wn(t=e),"function"!=typeof o&&r.pointRadius(o),a):t},a.pointRadius=function(e){return arguments.length?(o="function"==typeof e?e:(r.pointRadius(+e),+e),a):o},a.digits=function(e){if(!arguments.length)return i;if(null==e)i=null;else{const t=Math.floor(e);if(0>t)throw new RangeError("invalid digits: "+e);i=t}return null===t&&(r=new _n(i)),a},a.projection(e).digits(i).context(t)}function Wn(e){return function(t){var n=new Bn;for(var r in e)n[r]=e[r];return n.stream=t,n}}function Bn(){}function Hn(e,t,n){var r=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),null!=r&&e.clipExtent(null),Y(n,e.stream(Jt)),t(Jt.result()),null!=r&&e.clipExtent(r),e}function $n(e,t,n){return Hn(e,function(n){var r=t[1][0]-t[0][0],i=t[1][1]-t[0][1],o=Math.min(r/(n[1][0]-n[0][0]),i/(n[1][1]-n[0][1])),a=+t[0][0]+(r-o*(n[1][0]+n[0][0]))/2,s=+t[0][1]+(i-o*(n[1][1]+n[0][1]))/2;e.scale(150*o).translate([a,s])},n)}function qn(e,t,n){return $n(e,[[0,0],t],n)}function Gn(e,t,n){return Hn(e,function(n){var r=+t,i=r/(n[1][0]-n[0][0]),o=(r-i*(n[1][0]+n[0][0]))/2,a=-i*n[0][1];e.scale(150*i).translate([o,a])},n)}function Vn(e,t,n){return Hn(e,function(n){var r=+t,i=r/(n[1][1]-n[0][1]),o=-i*n[0][0],a=(r-i*(n[1][1]+n[0][1]))/2;e.scale(150*i).translate([o,a])},n)}Bn.prototype={constructor:Bn,point:function(e,t){this.stream.point(e,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var Un=E(30*R);function Yn(e,t){return+t?function(e,t){function n(r,i,o,a,s,l,c,u,d,h,f,p,m,g){var y=c-r,v=u-i,b=y*y+v*v;if(b>4*t&&m--){var x=a+h,w=s+f,S=l+p,M=O(x*x+w*w+S*S),j=W(S/=M),A=L(L(S)-1)<k||L(o-d)<k?(o+d)/2:N(w,x),C=e(A,j),R=C[0],P=C[1],E=R-r,I=P-i,T=v*E-y*I;(T*T/b>t||L((y*E+v*I)/b-.5)>.3||Un>a*h+s*f+l*p)&&(n(r,i,o,a,s,l,R,P,A,x/=M,w/=M,S,m,g),g.point(R,P),n(R,P,A,x,w,S,c,u,d,h,f,p,m,g))}}return function(t){var r,i,o,a,s,l,c,u,d,h,f,p,m={point:g,lineStart:y,lineEnd:b,polygonStart:function(){t.polygonStart(),m.lineStart=x},polygonEnd:function(){t.polygonEnd(),m.lineStart=y}};function g(n,r){n=e(n,r),t.point(n[0],n[1])}function y(){u=NaN,m.point=v,t.lineStart()}function v(r,i){var o=xe([r,i]),a=e(r,i);n(u,d,c,h,f,p,u=a[0],d=a[1],c=r,h=o[0],f=o[1],p=o[2],16,t),t.point(u,d)}function b(){m.point=g,t.lineEnd()}function x(){y(),m.point=w,m.lineEnd=k}function w(e,t){v(r=e,t),i=u,o=d,a=h,s=f,l=p,m.point=v}function k(){n(u,d,c,h,f,p,i,o,r,a,s,l,16,t),m.lineEnd=b,b()}return m}}(e,t):function(e){return Wn({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}(e)}var Xn=Wn({point:function(e,t){this.stream.point(e*R,t*R)}});function Zn(e,t,n,r,i,o){if(!o)return function(e,t,n,r,i){function o(o,a){return[t+e*(o*=r),n-e*(a*=i)]}return o.invert=function(o,a){return[(o-t)/e*r,(n-a)/e*i]},o}(e,t,n,r,i);var a=E(o),s=D(o),l=a*e,c=s*e,u=a/e,d=s/e,h=(s*n-a*t)/e,f=(s*t+a*n)/e;function p(e,o){return[l*(e*=r)-c*(o*=i)+t,n-c*e-l*o]}return p.invert=function(e,t){return[r*(u*e-d*t+h),i*(f-d*e-u*t)]},p}function Kn(e){return Qn(function(){return e})()}function Qn(e){var t,n,r,i,o,a,s,l,c,u,d=150,h=480,f=250,p=0,m=0,g=0,y=0,v=0,b=0,x=1,w=1,M=null,j=nt,P=null,N=zt,I=.5;function T(e){return l(e[0]*R,e[1]*R)}function z(e){return(e=l.invert(e[0],e[1]))&&[e[0]*C,e[1]*C]}function _(){var e=Zn(d,0,0,x,w,b).apply(null,t(p,m)),r=Zn(d,h-e[0],f-e[1],x,w,b);return n=Fe(g,y,v),s=_e(t,r),l=_e(n,s),a=Yn(s,I),F()}function F(){return c=u=null,T}return T.stream=function(e){return c&&u===e?c:c=Xn(function(e){return Wn({point:function(t,n){var r=e(t,n);return this.stream.point(r[0],r[1])}})}(n)(j(a(N(u=e)))))},T.preclip=function(e){return arguments.length?(j=e,M=void 0,F()):j},T.postclip=function(e){return arguments.length?(N=e,P=r=i=o=null,F()):N},T.clipAngle=function(e){return arguments.length?(j=+e?function(e){var t=E(e),n=2*R,r=t>0,i=L(t)>k;function o(e,n){return E(e)*E(n)>t}function a(e,n,r){var i=[1,0,0],o=ke(xe(e),xe(n)),a=we(o,o),s=o[0],l=a-s*s;if(!l)return!r&&e;var c=t*a/l,u=-t*s/l,d=ke(i,o),h=Me(i,c);Se(h,Me(o,u));var f=d,p=we(h,f),m=we(f,f),g=p*p-m*(we(h,h)-1);if(g>=0){var y=O(g),v=Me(f,(-p-y)/m);if(Se(v,h),v=be(v),!r)return v;var b,x=e[0],w=n[0],M=e[1],j=n[1];x>w&&(b=x,x=w,w=b);var A=w-x,C=L(A-S)<k;if(!C&&M>j&&(b=M,M=j,j=b),C||k>A?C?M+j>0^v[1]<(L(v[0]-x)<k?M:j):v[1]>=M&&j>=v[1]:A>S^(v[0]>=x&&w>=v[0])){var R=Me(f,(-p+y)/m);return Se(R,h),[v,be(R)]}}}function s(t,n){var i=r?e:S-e,o=0;return-i>t?o|=1:t>i&&(o|=2),-i>n?o|=4:n>i&&(o|=8),o}return Je(o,function(e){var t,n,l,c,u;return{lineStart:function(){c=l=!1,u=1},point:function(d,h){var f,p=[d,h],m=o(d,h),g=r?m?0:s(d,h):m?s(d+(0>d?S:-S),h):0;if(!t&&(c=l=m)&&e.lineStart(),m!==l&&(!(f=a(t,p))||Ge(t,f)||Ge(p,f))&&(p[2]=1),m!==l)u=0,m?(e.lineStart(),f=a(p,t),e.point(f[0],f[1])):(f=a(t,p),e.point(f[0],f[1],2),e.lineEnd()),t=f;else if(i&&t&&r^m){var y;g&n||!(y=a(p,t,!0))||(u=0,r?(e.lineStart(),e.point(y[0][0],y[0][1]),e.point(y[1][0],y[1][1]),e.lineEnd()):(e.point(y[1][0],y[1][1]),e.lineEnd(),e.lineStart(),e.point(y[0][0],y[0][1],3)))}!m||t&&Ge(t,p)||e.point(p[0],p[1]),t=p,l=m,n=g},lineEnd:function(){l&&e.lineEnd(),t=null},clean:function(){return u|(c&&l)<<1}}},function(t,r,i,o){!function(e,t,n,r,i,o){var a=E(t),s=D(t),l=r*n;null==i?(i=t+r*A,o=t-l/2):(i=$e(a,i),o=$e(a,o),(r>0?o>i:i>o)&&(i+=r*A));for(var c,u=i;r>0?u>o:o>u;u-=l)c=be([a,-s*E(u),-s*D(u)]),e.point(c[0],c[1])}(o,e,n,i,t,r)},r?[0,-e]:[-S,e-S])}(M=e*R):(M=null,nt),F()):M*C},T.clipExtent=function(e){return arguments.length?(N=null==e?(P=r=i=o=null,zt):function(e,t,n,r){function i(i,o){return!(e>i||i>n||t>o||o>r)}function o(i,o,s,c){var u=0,d=0;if(null==i||(u=a(i,s))!==(d=a(o,s))||0>l(i,o)^s>0)do{c.point(0===u||3===u?e:n,u>1?r:t)}while((u=(u+s+4)%4)!==d);else c.point(o[0],o[1])}function a(r,i){return L(r[0]-e)<k?i>0?0:3:L(r[0]-n)<k?i>0?2:1:L(r[1]-t)<k?i>0?1:0:i>0?3:2}function s(e,t){return l(e.x,t.x)}function l(e,t){var n=a(e,1),r=a(t,1);return n!==r?n-r:0===n?t[1]-e[1]:1===n?e[0]-t[0]:2===n?e[1]-t[1]:t[0]-e[0]}return function(a){var l,c,u,d,h,f,p,m,g,y,v,b=a,x=qe(),w={point:k,lineStart:function(){w.point=S,c&&c.push(u=[]),y=!0,g=!1,p=m=NaN},lineEnd:function(){l&&(S(d,h),f&&g&&x.rejoin(),l.push(x.result())),w.point=k,g&&b.lineEnd()},polygonStart:function(){b=x,l=[],c=[],v=!0},polygonEnd:function(){var t=function(){for(var t=0,n=0,i=c.length;i>n;++n)for(var o,a,s=c[n],l=1,u=s.length,d=s[0],h=d[0],f=d[1];u>l;++l)o=h,a=f,h=(d=s[l])[0],f=d[1],a>r?r>=f&&(f-a)*(e-o)>(h-o)*(r-a)&&--t:f>r&&(h-o)*(r-a)>(f-a)*(e-o)&&++t;return t}(),n=v&&t,i=(l=(0,rt.merge)(l)).length;(n||i)&&(a.polygonStart(),n&&(a.lineStart(),o(null,null,1,a),a.lineEnd()),i&&Ue(l,s,t,o,a),a.polygonEnd()),b=a,l=c=u=null}};function k(e,t){i(e,t)&&b.point(e,t)}function S(o,a){var s=i(o,a);if(c&&u.push([o,a]),y)d=o,h=a,f=s,y=!1,s&&(b.lineStart(),b.point(o,a));else if(s&&g)b.point(o,a);else{var l=[p=Math.max(ot,Math.min(it,p)),m=Math.max(ot,Math.min(it,m))],x=[o=Math.max(ot,Math.min(it,o)),a=Math.max(ot,Math.min(it,a))];!function(e,t,n,r,i,o){var a,s=e[0],l=e[1],c=0,u=1,d=t[0]-s,h=t[1]-l;if(a=n-s,d||0>=a){if(a/=d,0>d){if(c>a)return;u>a&&(u=a)}else if(d>0){if(a>u)return;a>c&&(c=a)}if(a=i-s,d||a>=0){if(a/=d,0>d){if(a>u)return;a>c&&(c=a)}else if(d>0){if(c>a)return;u>a&&(u=a)}if(a=r-l,h||0>=a){if(a/=h,0>h){if(c>a)return;u>a&&(u=a)}else if(h>0){if(a>u)return;a>c&&(c=a)}if(a=o-l,h||a>=0){if(a/=h,0>h){if(a>u)return;a>c&&(c=a)}else if(h>0){if(c>a)return;u>a&&(u=a)}return c>0&&(e[0]=s+c*d,e[1]=l+c*h),1>u&&(t[0]=s+u*d,t[1]=l+u*h),!0}}}}}(l,x,e,t,n,r)?s&&(b.lineStart(),b.point(o,a),v=!1):(g||(b.lineStart(),b.point(l[0],l[1])),b.point(x[0],x[1]),s||b.lineEnd(),v=!1)}p=o,m=a,g=s}return w}}(P=+e[0][0],r=+e[0][1],i=+e[1][0],o=+e[1][1]),F()):null==P?null:[[P,r],[i,o]]},T.scale=function(e){return arguments.length?(d=+e,_()):d},T.translate=function(e){return arguments.length?(h=+e[0],f=+e[1],_()):[h,f]},T.center=function(e){return arguments.length?(p=e[0]%360*R,m=e[1]%360*R,_()):[p*C,m*C]},T.rotate=function(e){return arguments.length?(g=e[0]%360*R,y=e[1]%360*R,v=e.length>2?e[2]%360*R:0,_()):[g*C,y*C,v*C]},T.angle=function(e){return arguments.length?(b=e%360*R,_()):b*C},T.reflectX=function(e){return arguments.length?(x=e?-1:1,_()):0>x},T.reflectY=function(e){return arguments.length?(w=e?-1:1,_()):0>w},T.precision=function(e){return arguments.length?(a=Yn(s,I=e*e),F()):O(I)},T.fitExtent=function(e,t){return $n(T,e,t)},T.fitSize=function(e,t){return qn(T,e,t)},T.fitWidth=function(e,t){return Gn(T,e,t)},T.fitHeight=function(e,t){return Vn(T,e,t)},function(){return t=e.apply(this,arguments),T.invert=t.invert&&z,_()}}function Jn(e,t){var n=D(e),r=(n+D(t))/2;if(L(r)<k)return function(e){var t=E(e);function n(e,n){return[e*t,D(n)/t]}return n.invert=function(e,n){return[e/t,W(n*t)]},n}(e);var i=1+n*(2*r-n),o=O(i)/r;function a(e,t){var n=O(i-2*r*D(t))/r;return[n*D(e*=r),o-n*E(e)]}return a.invert=function(e,t){var n=o-t,a=N(e,L(n))*_(n);return 0>n*r&&(a-=S*_(e)*_(n)),[a/r,W((i-(e*e+n*n)*r*r)/(2*r))]},a}function er(){return(e=Jn,t=0,n=S/3,r=Qn(e),i=r(t,n),i.parallels=function(e){return arguments.length?r(t=e[0]*R,n=e[1]*R):[t*C,n*C]},i).scale(155.424).center([0,33.6442]);var e,t,n,r,i}function tr(e,t){return[e,z(F((M+t)/2))]}function nr(e,t){return[e,t]}tr.invert=function(e,t){return[e,2*P(T(t))-M]},nr.invert=nr;var rr,ir=1.340264,or=-.081106,ar=893e-6,sr=.003796,lr=O(3)/2;function cr(e,t){var n=W(lr*D(t)),r=n*n,i=r*r*r;return[e*E(n)/(lr*(ir+3*or*r+i*(7*ar+9*sr*r))),n*(ir+or*r+i*(ar+sr*r))]}function ur(){return Kn(cr).scale(177.158)}function dr(e,t){var n=t*t,r=n*n;return[e*(.8707-.131979*n+r*(r*(.003971*n-.001529*r)-.013791)),t*(1.007226+n*(.015085+r*(.028874*n-.044475-.005916*r)))]}function hr(e,t){return[E(t)*D(e),D(t)]}cr.invert=function(e,t){for(var n,r=t,i=r*r,o=i*i*i,a=0;12>a&&(o=(i=(r-=n=(r*(ir+or*i+o*(ar+sr*i))-t)/(ir+3*or*i+o*(7*ar+9*sr*i)))*r)*i*i,L(n)>=1e-12);++a);return[lr*e*(ir+3*or*i+o*(7*ar+9*sr*i))/E(r),W(D(r)/lr)]},dr.invert=function(e,t){var n,r=t,i=25;do{var o=r*r,a=o*o;r-=n=(r*(1.007226+o*(.015085+a*(.028874*o-.044475-.005916*a)))-t)/(1.007226+o*(.045255+a*(.259866*o-.311325-.005916*11*a)))}while(L(n)>k&&--i>0);return[e/(.8707+(o=r*r)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979)),r]},hr.invert=(rr=W,function(e,t){var n=O(e*e+t*t),r=rr(n),i=D(r),o=E(r);return[N(e*i,n*o),W(n&&t*i/n)]});var fr=require("d3-quadtree"),pr=class{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;return{next:()=>this._size>e?{done:!1,value:this.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray();let n=0,r=[];t.length>e&&(n=t.length-e,r=t.slice(0,n)),this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(let e=n;t.length>e;e++)this.push(t[e]);return r}update(e,t){const n=[],r=(this.head-this._size+this._capacity)%this._capacity;for(let i=0;this._size>i;i++){const o=(r+i)%this._capacity,a=this.buffer[o];if(e(a)){let e;e="object"!=typeof a||null===a?a:Array.isArray(a)?[...a]:{...a},n.push(e),this.buffer[o]=t(a)}}return n}remove(e){const t=[],n=[];if(this.forEach(r=>{e(r)?n.push(r):t.push(r)}),0===n.length)return n;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}};function mr(e,t,n){return e+(t-e)*n}function gr(e,t,n){if(1>=n)return 1;const r=n-1;return function(e){const t=Math.max(0,Math.min(1,e.minOpacity??.1));if(Number.isNaN(e.age))return 1;if(e.age===1/0)return t;if(!Number.isFinite(e.extent)||0>=e.extent)return 1;const n=Math.max(0,e.age);if("step"===e.type)return(e.threshold??.5*e.extent)>n?1:t;if("exponential"===e.type){const r=e.halfLife??e.extent/2;return t+Math.pow(.5,n/(r>0?r:e.extent/2))*(1-t)}return t+Math.max(0,Math.min(1,1-n/e.extent))*(1-t)}({age:r-t,extent:r,type:e.type,halfLife:e.halfLife??n/2,threshold:e.stepThreshold??.5*n,minOpacity:e.minOpacity??.1})}function yr(e,t,n){const r=e.duration??500,i=n-t;return r>i?1-i/r:0}function vr(e,t,n,r){let i=!1;return t>0?(e._pulseIntensity!==t&&(e._pulseIntensity=t,i=!0),e._pulseColor!==n&&(e._pulseColor=n,i=!0),e._pulseGlowRadius!==r&&(e._pulseGlowRadius=r,i=!0),i):(0!==e._pulseIntensity&&(e._pulseIntensity=0,i=!0),void 0!==e._pulseColor&&(e._pulseColor=void 0,i=!0),void 0!==e._pulseGlowRadius&&(e._pulseGlowRadius=void 0,i=!0),i)}var br=require("d3-scale");function xr(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function wr(e,t,n){const r=e=>e.toString(16).padStart(2,"0");return`#${r(e)}${r(t)}${r(n)}`}function kr(e){const t=e.map(xr),n=t.length-1;return e=>{if(0>=e){const[e,n,r]=t[0];return wr(e,n,r)}if(e>=1){const[e,r,i]=t[n];return wr(e,r,i)}const r=e*n,i=Math.floor(r),o=r-i,[a,s,l]=t[i],[c,u,d]=t[i+1];return wr(Math.round(a+(c-a)*o),Math.round(s+(u-s)*o),Math.round(l+(d-l)*o))}}var Sr=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Mr=kr(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),jr=kr(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),Ar=kr(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),Cr=kr(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),Rr=kr(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),Lr=kr(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),Pr=kr(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),Nr=kr(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),Er=kr(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),Ir=kr(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),Tr=kr(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),zr=kr(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]),Dr={blues:Mr,reds:jr,greens:Ar,viridis:Pr,oranges:Cr,purples:Rr,greys:Lr,plasma:Nr,inferno:Er,magma:Ir,cividis:Tr,turbo:zr};function _r(e){return e&&Object.prototype.hasOwnProperty.call(Dr,e)?Dr[e]:Mr}kr(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),kr(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),kr(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),kr(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),kr(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),kr(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),kr(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]);var Or={category10:Sr,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],...Dr},Fr=Sr,Wr="#007bff",Br=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],Hr=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 $r(e,t,n){if("function"==typeof t){const r=t(e);return n&&r&&"string"==typeof r&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||Hr.has(t)}(r)?n(r):r}const r=e?.[t]+"";return n?n(r):Fr[Math.abs(function(e){let t=0;for(let n=0;e.length>n;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return Math.abs(t)}(r))%Fr.length]}function qr(e,t){if(null==t||!Object.prototype.hasOwnProperty.call(e,t))return;const n=e[t];return"string"==typeof n&&n.length>0?n:void 0}function Gr(e,t,n="category10"){if(n&&"object"==typeof n&&!Array.isArray(n)){const e=n;return t=>qr(e,t)??"#999"}const r=Array.from(new Set(e.map(e=>e?.[t]).filter(e=>null!=e).map(e=>e+""))),i=r.every(e=>!isNaN(Number(e)));if(Array.isArray(n))return(0,br.scaleOrdinal)().domain(r).range(n).unknown("#999");const o=Object.prototype.hasOwnProperty.call(Or,n)?Or[n]:Or.category10;if(i&&"function"==typeof o){let e=-1/0;for(const t of r){const n=Number(t);n>e&&(e=n)}return t=>o(Number(t)/e)}{const e=Array.isArray(o)?o:Fr;return(0,br.scaleOrdinal)().domain(r).range(e).unknown("#999")}}function Vr(e,t,n=[3,20],r){let i;if(i="function"==typeof t?t(e):e?.[t],!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 Ur(e,t){const n=t&&"object"==typeof t&&!Array.isArray(t)?t:void 0;return 0===e.length?e=>n&&qr(n,e)||"#4e79a7":t=>{if(n){const e=qr(n,t);if(e)return e}let r=0;for(let e=0;t.length>e;e++)r=31*r+t.charCodeAt(e)|0;return e[Math.abs(r)%e.length]??"#4e79a7"}}function Yr(e){return null!=e&&!1!==e&&""!==e&&(!Array.isArray(e)||e.some(Yr))}function Xr(e,t,n){e.has(t)||(e.add(t),console.warn(n))}var Zr={mercator:function(){return function(e){var t,n,r,i=Kn(e),o=i.center,a=i.scale,s=i.translate,l=i.clipExtent,c=null;function u(){var o=S*a(),s=i(function(e){function t(t){return(t=e(t[0]*R,t[1]*R))[0]*=C,t[1]*=C,t}return e=Fe(e[0]*R,e[1]*R,e.length>2?e[2]*R:0),t.invert=function(t){return(t=e.invert(t[0]*R,t[1]*R))[0]*=C,t[1]*=C,t},t}(i.rotate()).invert([0,0]));return l(null==c?[[s[0]-o,s[1]-o],[s[0]+o,s[1]+o]]:e===tr?[[Math.max(s[0]-o,c),t],[Math.min(s[0]+o,n),r]]:[[c,Math.max(s[1]-o,t)],[n,Math.min(s[1]+o,r)]])}return i.scale=function(e){return arguments.length?(a(e),u()):a()},i.translate=function(e){return arguments.length?(s(e),u()):s()},i.center=function(e){return arguments.length?(o(e),u()):o()},i.clipExtent=function(e){return arguments.length?(null==e?c=t=n=r=null:(c=+e[0][0],t=+e[0][1],n=+e[1][0],r=+e[1][1]),u()):null==c?null:[[c,t],[n,r]]},u()}(tr).scale(961/A)},equalEarth:ur,albersUsa:function(){var e,t,n,r,i,o,a=er().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7]),s=er().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=er().rotate([157,0]).center([-3,19.9]).parallels([8,18]),c={point:function(e,t){o=[e,t]}};function u(e){var t=e[0],a=e[1];return o=null,n.point(t,a),o||(r.point(t,a),o)||(i.point(t,a),o)}function d(){return e=t=null,u}return u.invert=function(e){var t=a.scale(),n=a.translate(),r=(e[0]-n[0])/t,i=(e[1]-n[1])/t;return(i>=.12&&.234>i&&r>=-.425&&-.214>r?s:i>=.166&&.234>i&&r>=-.214&&-.115>r?l:a).invert(e)},u.stream=function(n){return e&&t===n?e:(r=[a.stream(t=n),s.stream(n),l.stream(n)],i=r.length,e={point:function(e,t){for(var n=-1;++n<i;)r[n].point(e,t)},sphere:function(){for(var e=-1;++e<i;)r[e].sphere()},lineStart:function(){for(var e=-1;++e<i;)r[e].lineStart()},lineEnd:function(){for(var e=-1;++e<i;)r[e].lineEnd()},polygonStart:function(){for(var e=-1;++e<i;)r[e].polygonStart()},polygonEnd:function(){for(var e=-1;++e<i;)r[e].polygonEnd()}});var r,i},u.precision=function(e){return arguments.length?(a.precision(e),s.precision(e),l.precision(e),d()):a.precision()},u.scale=function(e){return arguments.length?(a.scale(e),s.scale(.35*e),l.scale(e),u.translate(a.translate())):a.scale()},u.translate=function(e){if(!arguments.length)return a.translate();var t=a.scale(),o=+e[0],u=+e[1];return n=a.translate(e).clipExtent([[o-.455*t,u-.238*t],[o+.455*t,u+.238*t]]).stream(c),r=s.translate([o-.307*t,u+.201*t]).clipExtent([[o-.425*t+k,u+.12*t+k],[o-.214*t-k,u+.234*t-k]]).stream(c),i=l.translate([o-.205*t,u+.212*t]).clipExtent([[o-.214*t+k,u+.166*t+k],[o-.115*t-k,u+.234*t-k]]).stream(c),d()},u.fitExtent=function(e,t){return $n(u,e,t)},u.fitSize=function(e,t){return qn(u,e,t)},u.fitWidth=function(e,t){return Gn(u,e,t)},u.fitHeight=function(e,t){return Vn(u,e,t)},u.scale(1070)},orthographic:function(){return Kn(hr).scale(249.5).clipAngle(90.000001)},naturalEarth:function(){return Kn(dr).scale(175.295)},equirectangular:function(){return Kn(nr).scale(152.63)}};function Kr(e,t){return e?"function"==typeof e?e:t=>t[e]:e=>e[t]}function Qr(e){return e?"function"==typeof e?e:t=>t[e]:e=>e.coordinates||e.data||[]}function Jr(e,t,n){return e?"function"==typeof e?{...n,...e(t)}:{...n,...e}:{...n}}function ei(e,t){if(2>e.length)return[e];const n=.4*t,r=[];let i=[e[0]];for(let t=1;e.length>t;t++){const o=e[t];Math.abs(o[0]-e[t-1][0])>n?(2>i.length||r.push(i),i=[o]):i.push(o)}return 2>i.length||r.push(i),r}function ti(e,t,n=24){const r=t[0]-e[0],i=t[1]-e[1],o=Math.sqrt(r*r+i*i);if(0===o)return[e,t];const a=-i/o,s=r/o,l=Math.min(.3*o,80),c=(e[0]+t[0])/2+a*l,u=(e[1]+t[1])/2+s*l,d=[];for(let r=0;n>=r;r++){const i=r/n,o=1-i;d.push([o*o*e[0]+2*o*i*c+i*i*t[0],o*o*e[1]+2*o*i*u+i*i*t[1]])}return d}function ni(e,t){if(2>e.length)return e;const n=t/2+1,r=[];for(let t=0;e.length>t;t++){const i=e[t];let o,a;0===t?(o=e[1][0]-i[0],a=e[1][1]-i[1]):t===e.length-1?(o=i[0]-e[t-1][0],a=i[1]-e[t-1][1]):(o=e[t+1][0]-e[t-1][0],a=e[t+1][1]-e[t-1][1]);const s=Math.sqrt(o*o+a*a)||1;r.push([i[0]+a/s*n,i[1]+-o/s*n])}return r}function ri(e,t,n,r,i){const o=t[0]-e[0],a=t[1]-e[1],s=Math.sqrt(o*o+a*a);if(0===s)return[e,t];const l=a/s,c=-o/s,u=i/2+1;return[[e[0]+l*u,e[1]+c*u],[t[0]+l*u,t[1]+c*u]]}var ii=require("d3-scale");function oi(e){let t=1/0,n=-1/0;for(const r of e)t>r&&(t=r),r>n&&(n=r);return[t,n]}function ai(e,t,n,r){const i=e.push(t);return n&&n.push(r),i}var si={data:"data",domain:"domain",layout:"layout","scene-geometry":"sceneGeometry","scene-style":"sceneStyle","data-paint":"dataPaint","interaction-paint":"interactionPaint",overlay:"overlay",accessibility:"accessibility",evidence:"evidence"};function li(e,t){const n={...e};for(const e of t)n[si[e]]++;return n}function ci(e,t,n){const r=new Set(t);return{changeSet:{...e,...e.keys?{keys:[...e.keys]}:{}},changed:r,revisions:li(n,r)}}var ui=class{constructor(){this.revisions={data:0,domain:0,layout:0,sceneGeometry:0,sceneStyle:0,dataPaint:0,interactionPaint:0,overlay:0,accessibility:0,evidence:0},this.latest=ci({kind:"initialize"},[],this.revisions),this.listeners=new Set}get last(){return this.latest}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}record(e,t){const n=ci(e,t,this.revisions);this.revisions=n.revisions,this.latest=n;for(const e of[...this.listeners])e();return n}},di=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],hi=["scene-style","data-paint","accessibility","evidence"],fi=(e,t)=>({retainedData:e,invalidations:t}),pi=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],mi=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],gi=["scene-geometry","data-paint","accessibility","evidence"],yi=["scene-style","data-paint","accessibility","evidence"],vi=["overlay","accessibility","evidence"],bi=[],xi={xAccessor:fi("rebuild",pi),yAccessor:fi("rebuild",pi),lineDataAccessor:fi("rebuild",pi),pointIdAccessor:fi("rebuild",gi),lineIdAccessor:fi("rebuild",gi),windowSize:fi("rebuild",pi),projection:fi("preserve",mi),projectionExtent:fi("preserve",mi),fitPadding:fi("preserve",mi),lineType:fi("preserve",mi),flowStyle:fi("preserve",mi),graticule:fi("preserve",mi),projectionTransform:fi("preserve",mi),customLayout:fi("preserve",mi),layoutConfig:fi("preserve",mi),layoutMargin:fi("preserve",mi),areaStyle:fi("preserve",yi),pointStyle:fi("preserve",["scene-geometry","scene-style","data-paint","accessibility","evidence"]),lineStyle:fi("preserve",yi),colorScheme:fi("preserve",yi),themeCategorical:fi("preserve",yi),themeDiverging:fi("preserve",yi),themeSemantic:fi("preserve",yi),themeSequential:fi("preserve",yi),decay:fi("preserve",yi),pulse:fi("preserve",yi),layoutSelection:fi("preserve",yi),annotations:fi("preserve",vi),autoPlaceAnnotations:fi("preserve",vi),clock:fi("preserve",bi),transition:fi("preserve",bi),introAnimation:fi("preserve",bi),onLayoutError:fi("preserve",bi)},wi=fi("preserve",mi),ki=class{constructor(){this.tracker=new ui}get last(){return this.tracker.last}subscribe(e){return this.tracker.subscribe(e)}recordData(e,t){return this.tracker.record({kind:e,...void 0===t?{}:{count:t}},di)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},hi):this.recordNoop("restyle")}recordConfig(e,t={}){const n=function(e){let t="preserve";const n=new Set;for(const r of e){const e=xi[r]??wi;"rebuild"===e.retainedData&&(t="rebuild");for(const t of e.invalidations)n.add(t)}return{retainedData:t,invalidations:n}}(e),r=new Set(n.invalidations);return t.retainedDataChanged&&r.add("data"),this.tracker.record({kind:"config",keys:e},r)}},Si=new WeakMap;function Mi(e){if(null==e)return 0;if("number"==typeof e&&Number.isFinite(e)&&e>=0&&.5>e)return e;throw new RangeError(`[semiotic] fitPadding must be a finite fraction in [0, 0.5); received ${e+""}.`)}var ji=class e{constructor(e){this.updateResults=new ki,this.scene=[],this.scales=null,this.version=0,this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customLayoutDiagnosticsWarned=new Set,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this._customLayoutFailedThisBuild=!1,this._quadtree=null,this._maxPointRadius=0,this.projection=null,this.geoPath=null,this.baseScale=0,this.baseTranslate=[0,0],this.baseRotation=[0,0,0],this.currentZoom=1,this.cartogramLayout=null,this.areas=[],this.pointData=[],this.lineData=[],this.pointBuffer=null,this.streaming=!1,this.lastIngestTime=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositions=null,this._hasRenderedOnce=!1,this.config=function(e){return{...e,fitPadding:Mi(e.fitPadding)}}(e)}currentTime(){return this.config.clock?.()??("undefined"!=typeof performance?performance.now():Date.now())}getConfiguredWindowSize(){const e=this.config.windowSize??500;if(!Number.isInteger(e)||1>e)throw Error("GeoPipelineStore windowSize must be a positive integer");return e}retainNewestLines(e=this.getConfiguredWindowSize()){this.lineData.length>e&&(this.lineData=this.lineData.slice(-e))}resizeStreamingWindow(e){if(this.pointBuffer){const t=this.pointBuffer.toArray(),n=this.timestampBuffer?.toArray()??[],r=t.slice(-e),i=n.slice(-r.length),o=this.currentTime();this.pointBuffer=new pr(e),this.timestampBuffer=new pr(e),r.forEach((e,t)=>{this.pointBuffer.push(e),this.timestampBuffer.push(i[t]??o)})}this.retainNewestLines(e)}updateConfig(e){const t=function(e){return"fitPadding"in e?{...e,fitPadding:Mi(e.fitPadding)}:e}(e),n=this.config,r=this.getConfiguredWindowSize(),i=Object.keys(t).filter(e=>t[e]!==n[e]);this.config={...this.config,...t};const o=this.getConfiguredWindowSize(),a=this.streaming&&o!==r;a&&(this.resizeStreamingWindow(o),this.version++),"customLayout"in t&&!t.customLayout&&(this.lastCustomLayoutFailure=null),this.updateResults.recordConfig(i,{retainedDataChanged:a})}updateConfigWithResult(e){return this.updateConfig(e),this.updateResults.last}setAreas(e){this.areas=e,this.updateResults.recordData("replace",e.length)}setAreasWithResult(e){return this.setAreas(e),this.updateResults.last}setPoints(e){this.pointData=e.slice(),this.pointBuffer=null,this.timestampBuffer=null,this.streaming=!1,this.updateResults.recordData("replace",e.length)}setPointsWithResult(e){return this.setPoints(e),this.updateResults.last}setLines(e){this.lineData=e.slice(),this.streaming&&this.retainNewestLines(),this.updateResults.recordData("replace",e.length)}setLinesWithResult(e){return this.setLines(e),this.updateResults.last}initStreaming(e){void 0!==e&&e!==this.config.windowSize&&(this.config={...this.config,windowSize:e});const t=this.getConfiguredWindowSize(),n=this.pointBuffer?this.pointBuffer.toArray():this.pointData,r=this.timestampBuffer?.toArray()??[],i=n.slice(-t),o=r.slice(-i.length),a=this.currentTime();this.pointBuffer=new pr(t),this.timestampBuffer=new pr(t),i.forEach((e,t)=>{this.pointBuffer.push(e),this.timestampBuffer.push(o[t]??a)}),this.pointData=[],this.retainNewestLines(t),this.streaming=!0}pushPoint(e){this.pointBuffer||this.initStreaming();const t=this.currentTime();ai(this.pointBuffer,e,this.timestampBuffer,t),this.lastIngestTime=t,this.updateResults.recordData("ingest",1)}pushPointWithResult(e){return this.pushPoint(e),this.updateResults.last}pushMany(e){this.pointBuffer||this.initStreaming();const t=this.currentTime();for(const n of e)ai(this.pointBuffer,n,this.timestampBuffer,t);this.lastIngestTime=t,this.updateResults.recordData("ingest",e.length)}pushManyWithResult(e){return this.pushMany(e),this.updateResults.last}pushLine(e){null!=e&&"object"==typeof e?(this.streaming||this.initStreaming(),this.lineData.push(e),this.retainNewestLines(),this.version++,this.updateResults.recordData("ingest",1)):this.updateResults.recordNoop("ingest")}pushManyLines(e){if(!Array.isArray(e)||0===e.length)return void this.updateResults.recordNoop("ingest");const t=e.filter(e=>null!=e&&"object"==typeof e);if(0!==t.length){this.streaming||this.initStreaming();for(const e of t)this.lineData.push(e);this.retainNewestLines(),this.version++,this.updateResults.recordData("ingest",t.length)}else this.updateResults.recordNoop("ingest")}removeLine(e){const{lineIdAccessor:t}=this.config;if(!t)throw Error("removeLine() requires lineIdAccessor to be configured");const n="function"==typeof t?t:e=>e[t],r=new Set(Array.isArray(e)?e:[e]),i=[];return this.lineData=this.lineData.filter(e=>!r.has(n(e)+"")||(i.push(e),!1)),i.length>0?(this.version++,this.updateResults.recordData("remove",i.length)):this.updateResults.recordNoop("remove"),i}getLines(){return this.lineData.slice()}removePoint(e){const{pointIdAccessor:t}=this.config;if(!t)throw Error("removePoint() requires pointIdAccessor to be configured");const n="function"==typeof t?t:e=>e[t],r=new Set(Array.isArray(e)?e:[e]);if(this.streaming&&this.pointBuffer){const e=e=>r.has(n(e)+"");!function(e,t,n){if(!t||0===t.size)return;const r=new Set;if(e.forEach((e,t)=>{n(e)&&r.add(t)}),0===r.size)return;const i=t.toArray();t.clear();for(let e=0;i.length>e;e++)r.has(e)||t.push(i[e])}(this.pointBuffer,this.timestampBuffer,e);const t=this.pointBuffer.remove(e);return t.length>0?(this.version++,this.updateResults.recordData("remove",t.length)):this.updateResults.recordNoop("remove"),t}{const e=[];return this.pointData=this.pointData.filter(t=>!r.has(n(t)+"")||(e.push(t),!1)),e.length>0?(this.version++,this.updateResults.recordData("remove",e.length)):this.updateResults.recordNoop("remove"),e}}clear(){this.areas=[],this.pointData=[],this.lineData=[],this.pointBuffer=null,this.timestampBuffer=null,this.streaming=!1,this.scene=[],this.scales=null,this._hasRenderedOnce=!1,this.activeTransition=null,this.prevPositions=null,this._quadtree=null,this._maxPointRadius=0,this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this._customLayoutFailedThisBuild=!1,this.version++,this.updateResults.recordData("clear")}restyleScene(e){const t=this._customRestyle;if(t){for(const n of this.scene){const r=this._baseStyles.get(n)??n.style,i=t(n,e);n.style=i?{...r,...i}:r}this.markStylePaintPending(),this.updateResults.recordRestyle(!0)}else this.updateResults.recordRestyle(!1)}computeScene(e){const{config:t}=this,n=this.projection,r=this.geoPath,i=this.scales,o=this.baseScale,a=[...this.baseTranslate],s=[...this.baseRotation],l=this.scene;this.projection=function(e){if(!e)return ur();if("string"==typeof e){const t=Zr[e];return t?t():("production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Unknown projection "${e}", falling back to equalEarth`),ur())}if("object"==typeof e&&"type"in e){const t=Zr[e.type],n=t?t():ur();return e.rotate&&"rotate"in n&&n.rotate(e.rotate),e.center&&"center"in n&&n.center(e.center),n}return e}(t.projection),this.geoPath=Fn(this.projection),this.fitProjection(e),this.geoPath=Fn(this.projection);const c=this.projection;this.scales={projection:c,geoPath:this.geoPath,projectedPoint:(e,t)=>c([e,t]),invertedPoint:(e,t)=>c.invert?c.invert([e,t]):null},this._customLayoutFailedThisBuild=!1;const u=this.buildSceneNodes(e);if(this._customLayoutFailedThisBuild)!0===this.lastCustomLayoutFailure?.preservedLastGoodScene?(this.projection=n,this.geoPath=r,this.scales=i,this.baseScale=o,this.baseTranslate=a,this.baseRotation=s):(this.scene=[],this.rebuildQuadtree());else{if(this.scene=u,this.rebuildQuadtree(),t.projectionTransform&&this.applyCartogramTransform(t.projectionTransform,e),t.decay&&this.streaming&&this.applyDecay(),t.pulse&&this.streaming&&this.applyPulse(),t.transition&&!this._hasRenderedOnce&&this.scene.length>0&&t.introAnimation){const t=e.width/2,n=e.height/2,r=this.scene.filter(e=>"point"===e.type).map(e=>({...e,x:t,y:n}));r.length>0&&this.startTransition(r)}this._hasRenderedOnce=!0,t.transition&&l.length>0&&this.startTransition(l),this.version++}}fitProjection(e){const t=this.projection,n=this.config,r=[...this.areas],i=Kr(n.xAccessor,"lon"),o=Kr(n.yAccessor,"lat"),a=this.getPoints();if(a.length>0){const e=a.map(e=>[i(e),o(e)]);r.push({type:"Feature",properties:{},geometry:{type:"MultiPoint",coordinates:e}})}const s=Qr(n.lineDataAccessor);for(const e of this.lineData){const t=s(e);if(t&&t.length>0){const e=t.map(e=>[i(e),o(e)]);r.push({type:"Feature",properties:{},geometry:{type:"LineString",coordinates:e}})}}if(0!==r.length){if(n.projectionExtent){const[[r,i],[o,a]]=n.projectionExtent;t.fitExtent([[0,0],[e.width,e.height]],{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[[r,i],[r,a],[o,a],[o,i],[r,i]]]}})}else if(t.clipAngle&&(t.clipAngle()??0)>0){const r=n.fitPadding??0,i=Math.min(e.width,e.height);t.scale(i/2-i*r),t.translate([e.width/2,e.height/2])}else{const i=n.fitPadding??0,o=e.width*i,a=e.height*i;t.fitExtent([[o,a],[e.width-o,e.height-a]],{type:"FeatureCollection",features:r})}this.baseScale=t.scale(),this.baseTranslate=t.translate(),this.baseRotation=t.rotate?.()??[0,0,0]}}applyZoomTransform(e,t){const n=this.projection;if(!n)return;const r=this.geoPath,i=this.scales,o=n.scale(),a=[...n.translate()],s=this.currentZoom;n.scale(this.baseScale*e.k),n.translate([this.baseTranslate[0]*e.k+e.x,this.baseTranslate[1]*e.k+e.y]),this.currentZoom=e.k,this.geoPath=Fn(n),this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null},this._customLayoutFailedThisBuild=!1;const l=this.buildSceneNodes(t);this._customLayoutFailedThisBuild?this.lastCustomLayoutFailure?.preservedLastGoodScene?(n.scale(o),n.translate(a),this.currentZoom=s,this.geoPath=r,this.scales=i):(this.scene=[],this.rebuildQuadtree()):(this.scene=l,this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}applyZoomScale(e,t){const n=this.projection;if(!n)return;const r=this.geoPath,i=this.scales,o=n.scale(),a=[...n.translate()],s=this.currentZoom;n.scale(this.baseScale*e),n.translate(this.baseTranslate),this.currentZoom=e,this.geoPath=Fn(n),this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null},this._customLayoutFailedThisBuild=!1;const l=this.buildSceneNodes(t);this._customLayoutFailedThisBuild?this.lastCustomLayoutFailure?.preservedLastGoodScene?(n.scale(o),n.translate(a),this.currentZoom=s,this.geoPath=r,this.scales=i):(this.scene=[],this.rebuildQuadtree()):(this.scene=l,this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}applyRotation(e,t){const n=this.projection;if(!n||!n.rotate)return;const r=this.geoPath,i=this.scales,o=[...n.rotate()];n.rotate(e),this.geoPath=Fn(n),this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null},this._customLayoutFailedThisBuild=!1;const a=this.buildSceneNodes(t);this._customLayoutFailedThisBuild?this.lastCustomLayoutFailure?.preservedLastGoodScene?(n.rotate(o),this.geoPath=r,this.scales=i):(this.scene=[],this.rebuildQuadtree()):(this.scene=a,this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}setRotation(e){const t=this.projection;t&&t.rotate&&t.rotate(e)}hasProjection(){return null!=this.projection}getRotation(){return this.projection?.rotate?.()??this.baseRotation}getBaseProjectionState(){return{scale:this.baseScale,translate:[...this.baseTranslate]}}getPoints(){return this.streaming&&this.pointBuffer?this.pointBuffer.toArray():this.pointData}rebuildQuadtree(){let t=0,n=0;for(const e of this.scene)"point"===e.type&&!1!==e.interactive&&(n++,e.r>t&&(t=e.r));if(this._maxPointRadius=t,e.QUADTREE_THRESHOLD>=n)return void(this._quadtree=null);const r=Array(n);let i=0;for(const e of this.scene)"point"===e.type&&!1!==e.interactive&&(r[i++]=e);this._quadtree=(0,fr.quadtree)().x(e=>e.x).y(e=>e.y).addAll(r)}get quadtree(){return this._quadtree}get maxPointRadius(){return this._maxPointRadius}buildSceneNodes(e){this._customLayoutFailedThisBuild=!1;const{config:t}=this,n=this.projection,r=this.geoPath;if(t.customLayout&&this.scales){const n=t.layoutMargin??{top:0,right:0,bottom:0,left:0},r=function(e,t,n=Fr){if(e&&"object"==typeof e&&!Array.isArray(e)){const t=Object.values(e).filter(e=>"string"==typeof e&&e.length>0);if(t.length>0)return t}if(Array.isArray(e)&&e.length>0)return e;if("string"==typeof e){const t=Object.prototype.hasOwnProperty.call(Or,e)?Or[e]:void 0;if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:n}(t.colorScheme,t.themeCategorical,Br),i={areas:this.areas.slice(),points:this.getPoints().slice(),lines:this.lineData.slice(),scales:this.scales,dimensions:{width:e.width,height:e.height,margin:n,plot:{x:0,y:0,width:e.width,height:e.height}},theme:{semantic:t.themeSemantic??{},categorical:[...r]},resolveColor:Ur(r,t.colorScheme),config:t.layoutConfig??{},selection:t.layoutSelection??null};let o;try{o=t.customLayout(i)}catch(e){const n=null!==this.lastCustomLayoutResult,r=function(e,t,n,r){const i=function(e){if(e instanceof Error)return{name:e.name||"Error",message:e.message||"Custom layout threw."};if("string"==typeof e)return{name:"Error",message:e};if(null==e)return{name:"Error",message:"Custom layout threw a nullish value."};try{return{name:"Error",message:e+""}}catch{return{name:"Error",message:"Custom layout threw a non-stringifiable value."}}}(t),o="network"===e?"customNetworkLayout":"customLayout";return{code:"CUSTOM_LAYOUT_ERROR",severity:"error",phase:"layout",component:e,source:o,message:`Semiotic ${e} ${o} failed: ${i.message}`,error:i,recovery:n?"preserved-last-good-scene":"empty-scene",preservedLastGoodScene:n,affectedRevision:r}}("geo",e,n,this.version);this.lastCustomLayoutFailure=r,this._customLayoutFailedThisBuild=!0,"production"!==process.env.NODE_ENV&&console.error("[semiotic] geo customLayout threw:",e);try{t.onLayoutError?.(r)}catch(e){"production"!==process.env.NODE_ENV&&console.error("[semiotic] onLayoutError threw:",e)}return n?this.scene:(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,[])}const a=o.nodes??[];if(this.customLayoutOverlays=o.overlays??null,this.lastCustomLayoutResult=o,this.lastCustomLayoutFailure=null,this._customRestyle=o.restyle,this.hasCustomRestyle=!!o.restyle,this._baseStyles=new WeakMap,this.hasCustomRestyle){for(const e of a)this._baseStyles.set(e,e.style);this.restyleScene(t.layoutSelection??null)}return function(e){if("production"===process.env.NODE_ENV)return;const{label:t,nodes:n,overlays:r,warned:i}=e;Yr(r)&&0===n.length&&Xr(i,"overlay-only",`[semiotic] ${t} returned overlays but no data-bearing scene nodes. Overlays do not participate in hover, selection, transitions, SSR evidence, or accessibility tables. Emit at least one scene node with a datum, or mark the overlay-only chart as intentionally decorative.`),n.length>0&&n.every(e=>null==e.datum)&&Xr(i,"null-datums",`[semiotic] ${t} returned scene nodes, but every scene-node datum is null. Hover, callbacks, selection, and tooltip helpers need data-bearing nodes. Attach a user-facing datum to each interactive node, or set interactive overlays outside the chart.`)}({label:"geo customLayout",nodes:a,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned}),a}return this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,function({config:e,projection:t,path:n,areas:r,points:i,lines:o,layout:a}){const s=Kr(e.xAccessor,"lon"),l=Kr(e.yAccessor,"lat"),c=[],u=function(e){return{fill:e.themeSemantic?.surface||"#e0e0e0",stroke:e.themeSemantic?.border||"#999",strokeWidth:.5,fillOpacity:1}}(e),d=function(e){return{stroke:e.themeSemantic?.primary||"#4e79a7",strokeWidth:1.5,fill:"none"}}(e),h=function(e){return{fill:e.themeSemantic?.primary||"#4e79a7",r:4,fillOpacity:.8}}(e);if(e.graticule){const t=!0===e.graticule?{}:e.graticule,r=function(){var e,t,n,r,i,o,a,s,l,c,u,d,h=10,f=h,p=90,m=360,g=2.5;function y(){return{type:"MultiLineString",coordinates:v()}}function v(){return(0,Ct.range)(I(r/p)*p,n,p).map(u).concat((0,Ct.range)(I(s/m)*m,a,m).map(d)).concat((0,Ct.range)(I(t/h)*h,e,h).filter(function(e){return L(e%p)>k}).map(l)).concat((0,Ct.range)(I(o/f)*f,i,f).filter(function(e){return L(e%m)>k}).map(c))}return y.lines=function(){return v().map(function(e){return{type:"LineString",coordinates:e}})},y.outline=function(){return{type:"Polygon",coordinates:[u(r).concat(d(a).slice(1),u(n).reverse().slice(1),d(s).reverse().slice(1))]}},y.extent=function(e){return arguments.length?y.extentMajor(e).extentMinor(e):y.extentMinor()},y.extentMajor=function(e){return arguments.length?(s=+e[0][1],a=+e[1][1],(r=+e[0][0])>(n=+e[1][0])&&(e=r,r=n,n=e),s>a&&(e=s,s=a,a=e),y.precision(g)):[[r,s],[n,a]]},y.extentMinor=function(n){return arguments.length?(o=+n[0][1],i=+n[1][1],(t=+n[0][0])>(e=+n[1][0])&&(n=t,t=e,e=n),o>i&&(n=o,o=i,i=n),y.precision(g)):[[t,o],[e,i]]},y.step=function(e){return arguments.length?y.stepMajor(e).stepMinor(e):y.stepMinor()},y.stepMajor=function(e){return arguments.length?(p=+e[0],m=+e[1],y):[p,m]},y.stepMinor=function(e){return arguments.length?(h=+e[0],f=+e[1],y):[h,f]},y.precision=function(h){return arguments.length?(g=+h,l=Rt(o,i,90),c=Lt(t,e,g),u=Rt(s,a,90),d=Lt(r,n,g),y):g},y.extentMajor([[-180,-89.999999],[180,89.999999]]).extentMinor([[-180,-80.000001],[180,80.000001]])}();t.step&&r.step(t.step);const i=n(r())||"";i&&c.push({type:"geoarea",pathData:i,centroid:[a.width/2,a.height/2],bounds:[[0,0],[a.width,a.height]],screenArea:0,style:{fill:"none",stroke:t.stroke||"#e0e0e0",strokeWidth:t.strokeWidth??.5,strokeDasharray:t.strokeDasharray||"2,2"},datum:null,interactive:!1})}for(const t of r){const r=n(t);if(!r)continue;const i=n.centroid(t),o=n.bounds(t),a=n.area(t);c.push({type:"geoarea",pathData:r,centroid:i,bounds:o,screenArea:a,style:Jr(e.areaStyle,t,u),datum:t,interactive:!0})}const f=Qr(e.lineDataAccessor);for(const n of o){const r=f(n);if(!r||2>r.length)continue;let i=[];if("geo"===e.lineType){const e=Array(r.length);for(let t=0;r.length>t;t++)e[t]=[s(r[t]),l(r[t])];for(let n=0;e.length-1>n;n++){const r=e[n],o=e[n+1],a=yt(r,o)||0,s=Math.max(2,Math.ceil(a/(Math.PI/180))),l=Pt(r,o);for(let e=0;s>=e;e++){if(n>0&&0===e)continue;const r=t(l(e/s));null!=r&&i.push(r)}}}else for(let e=0;r.length>e;e++){const n=r[e],o=t([s(n),l(n)]);null!=o&&i.push(o)}if(2>i.length)continue;const o=Jr(e.lineStyle,n,d),u="number"==typeof o.strokeWidth?o.strokeWidth:1;2!==r.length||2>i.length||"arc"!==e.flowStyle?2!==r.length||2>i.length||"offset"!==e.flowStyle||(i="geo"===e.lineType?ni(i,u):ri(i[0],i[i.length-1],0,0,u)):i=ti(i[0],i[i.length-1]);const h=ei(i,a.width);if(h.length>1)for(const e of h)2>e.length||c.push({type:"line",path:e,style:{...o,_edgeFade:!0},datum:n});else c.push({type:"line",path:2>i.length&&h[0]||i,style:o,datum:n})}const p=e.pointIdAccessor?"function"==typeof e.pointIdAccessor?e.pointIdAccessor:t=>t[e.pointIdAccessor]:null,m=t.clipAngle?t.clipAngle()??0:0,g=m>0?m*Math.PI/180:null,y=t.rotate?t.rotate():[0,0,0],v="function"==typeof t.center?t.center():[0,0],b=[(v[0]??0)-y[0],(v[1]??0)-y[1]];for(const n of i){const r=s(n),i=l(n);if(null!=g&&yt([r,i],b)>g)continue;const o=t([r,i]);if(!o)continue;const a=e.pointStyle?e.pointStyle(n):{...h},u={type:"point",x:o[0],y:o[1],r:a.r||4,style:a,datum:n,pointId:p?p(n)+"":void 0};c.push(u)}return c}({config:t,projection:n,path:r,areas:this.areas,points:this.getPoints(),lines:this.lineData,layout:e})}applyCartogramTransform(e,t){const n=function(e,t,n,r){const i=e.filter(e=>"point"===e.type);if(2>i.length)return null;const o=t.strength??1,a=Number.isFinite(o)?Math.max(0,Math.min(1,o)):1,s="strip"===t.layout?"strip":"radial";if("radial"===s&&0===a)return null;const l=t.centerAccessor?"function"==typeof t.centerAccessor?t.centerAccessor:e=>e[t.centerAccessor]:e=>e.id,c="function"==typeof t.costAccessor?t.costAccessor:e=>e[t.costAccessor],u=i.find(e=>e.datum&&l(e.datum)+""==t.center+"");if(!u)return"production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Distance cartogram center "${t.center}" not found in point data`),null;const d=function(e,t=-1/0){let n=t;for(const t of e)t>n&&(n=t);return n}(i.map(e=>e.datum?Number(c(e.datum)):NaN).filter(e=>isFinite(e)&&e>=0),1);r>0&&"production"!==process.env.NODE_ENV&&console.warn("GeoFrame: Distance cartogram does not support area rendering. Areas will be ignored. Remove areas or set projectionTransform to null to render them.");for(let t=e.length-1;t>=0;t--){const n=e[t];"geoarea"===n.type&&n.interactive&&e.splice(t,1)}const h="strip"===s?function(e,t,n,r,i){const o=Math.max(3,Math.min(8,.35*i.height)),a=Math.max(1,i.width-2*o),s=i.height/2,l=(0,ii.scaleLinear)().domain([0,r]).range([0,a]);t.x=o,t.y=s;const c=[];for(const i of e){if(i===t)continue;if(!i.datum){i.x=o,i.y=s;continue}const e=Number(n(i.datum)),a=o+(isFinite(e)&&e>=0&&r>0?l(e):0);i.x=a,i.y=s,c.push({node:i,x:a})}c.sort((e,t)=>e.x-t.x);const u=Math.max(0,Math.min(i.height/2-1,6));let d=0;for(;c.length>d;){let e=d+1;for(;c.length>e&&3>Math.abs(c[e].x-c[d].x);)e++;const t=e-d;if(t>1&&u>0)for(let e=0;t>e;e++)c[d+e].node.y=s+(e-(t-1)/2)*Math.min(2.5,2*u/Math.max(1,t-1));d=e}return{cx:o,cy:s,maxCost:r,availableRadius:a,layout:"strip"}}(i,u,c,d,n):function(e,t,n,r,i,o){const a=t.x,s=t.y,l=o.width/2,c=o.height/2,u=Math.min(o.width,o.height)/2,d=(0,ii.scaleLinear)().domain([0,r]).range([0,u]);for(const o of e){if(o===t)continue;if(!o.datum)continue;const e=o.x,u=o.y,h=Math.atan2(u-s,e-a),f=Math.hypot(e-a,u-s),p=Number(n(o.datum)),m=isFinite(p)&&p>=0?r>0?d(p):0:f,g=l+Math.cos(h)*m,y=c+Math.sin(h)*m;o.x=e+(g-e)*i,o.y=u+(y-u)*i}return t.x=a+(l-a)*i,t.y=s+(c-s)*i,{cx:t.x,cy:t.y,maxCost:r,availableRadius:u,layout:"radial"}}(i,u,c,d,a,n),f=e.filter(e=>"line"===e.type);if(f.length>0){const e=new Map;for(const t of i)null!=t.pointId&&e.set(t.pointId+"",[t.x,t.y]);for(const n of f){const r=n.datum?.source,i=n.datum?.target;if(null!=r&&null!=i){const o=e.get(r+""),a=e.get(i+"");if(o&&a)if("fractional"===t.lineMode&&n.path.length>2){const e=n.path[0],t=n.path[n.path.length-1],r=[o[0]-e[0],o[1]-e[1]],i=[a[0]-t[0],a[1]-t[1]],s=[0];for(let e=1;n.path.length>e;e++)s.push(s[e-1]+Math.hypot(n.path[e][0]-n.path[e-1][0],n.path[e][1]-n.path[e-1][1]));const l=s[s.length-1];n.path=n.path.map((e,t)=>{const o=l>0?s[t]/l:t/(n.path.length-1);return[e[0]+r[0]*(1-o)+i[0]*o,e[1]+r[1]*(1-o)+i[1]*o]})}else n.path=[o,a]}}}return h}(this.scene,e,t,this.areas.length);n&&(this.cartogramLayout=n)}applyDecay(){const e=this.config.decay;if(!e||!this.pointBuffer)return;const t=this.pointBuffer.size;if(0===t)return;const n=this.scene.filter(e=>"point"===e.type);for(let r=0;n.length>r;r++){const i=gr(e,r,t);n[r]._decayOpacity=i,n[r].style={...n[r].style,opacity:i}}}applyPulse(e=this.currentTime()){const t=this.config.pulse;if(!t||!this.timestampBuffer)return!1;const n=this.scene.filter(e=>"point"===e.type),r=this.timestampBuffer.toArray(),i=t.color||"rgba(255,255,255,0.6)",o=t.glowRadius??4;let a=!1;for(let s=0;n.length>s&&r.length>s;s++){const l=yr(t,r[s],e);a=vr(n[s],l,i,o)||a}return a}refreshPulse(e){return!0!==this.lastCustomLayoutFailure?.preservedLastGoodScene&&this.applyPulse(e)}hasActivePulsesAt(e){return!!this.config.pulse&&function(e,t,n=("undefined"!=typeof performance?performance.now():Date.now())){if(!t||0===t.size)return!1;const r=e.duration??500,i=t.peek();return null!=i&&r>n-i}(this.config.pulse,this.timestampBuffer,e)}get hasActivePulses(){return this.hasActivePulsesAt(this.currentTime())}startTransition(e){const t=this.config.transition?.duration??300;if(0>=t)return;const n=new Map;for(const t of e)"point"===t.type&&t.pointId&&n.set(t.pointId,[t.x,t.y]);const r=this.scene.filter(e=>"point"===e.type);let i=!1;for(const e of r)if(e.pointId){const t=n.get(e.pointId);t&&(e._targetX=e.x,e._targetY=e.y,e.x=t[0],e.y=t[1],(Math.abs(t[0]-e._targetX)>.5||Math.abs(t[1]-e._targetY)>.5)&&(i=!0))}for(const e of r)e.pointId&&!n.has(e.pointId)&&(e._targetOpacity=e.style?.opacity??e.style?.fillOpacity??1,e.style={...e.style,opacity:0},i=!0);i&&(this.activeTransition={startTime:this.currentTime(),duration:t})}cancelIntroAnimation(){this.activeTransition=null;for(const e of this.scene)"point"===e.type&&(null!=e._targetOpacity&&(e.style={...e.style,opacity:e._targetOpacity},e._targetOpacity=void 0),null!=e._targetX&&(e.x=e._targetX,e.y=e._targetY,e._targetX=void 0,e._targetY=void 0))}advanceTransition(e){if(!this.activeTransition)return!1;const t=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,this.activeTransition),n=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(t),r=this.scene.filter(e=>"point"===e.type);for(const e of r){if(null!=e._targetX&&null!=e._targetY){const t=e.y;e.x=mr(e.x,e._targetX,n),e.y=mr(t,e._targetY,n)}null!=e._targetOpacity&&(e.style={...e.style,opacity:e._targetOpacity*n})}if(t>=1){for(const e of r)null!=e._targetX&&(e.x=e._targetX,e.y=e._targetY,e._targetX=void 0,e._targetY=void 0),null!=e._targetOpacity&&(e.style={...e.style,opacity:e._targetOpacity},e._targetOpacity=void 0);return this.activeTransition=null,!1}return!0}};ji.QUADTREE_THRESHOLD=500;var Ai=ji;Object.assign(Ai.prototype,{getLastUpdateResult:function(){return this.updateResults.last},getUpdateSnapshot:function(){return this.updateResults.last},subscribeUpdateResult:function(e){return this.updateResults.subscribe(e)},setLayoutSelection:function(e){this.config.layoutSelection=e},markStylePaintPending:function(){Si.set(this,!0)},consumeStylePaintPending:function(){const e=!0===Si.get(this);return Si.delete(this),e}});var Ci=require("react"),Ri={sceneGeometry:0,layout:0,domain:0};function Li(e){const{domain:t,layout:n,sceneGeometry:r}=e.revisions;return{domain:t,layout:n,sceneGeometry:r}}function Pi(e,t){return{sceneGeometry:Math.max(e.sceneGeometry,t.sceneGeometry),layout:Math.max(e.layout,t.layout),domain:Math.max(e.domain,t.domain)}}var Ni="production"!==process.env.NODE_ENV,Ei={revisions:Ri,signature:"",sawSignals:!1,wasUnconsumed:!1,warnUnconsumed:!1},Ii=class{constructor(e="scene host"){this.hostName=e,this.lastConsumed=Ri,this.lastObserved=Ri,this.lastDuplicateWarning="",this.lastUnconsumedWarning=""}observeUpdateResult(e){Ni&&(this.lastObserved=Pi(this.lastObserved,Li(e)))}beforeCompute(e,t){if(!Ni)return Ei;const n=Pi(Li(e),this.lastObserved),r=function(e){return`${e.sceneGeometry}|${e.layout}|${e.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:e.changed.has("scene-geometry")||e.changed.has("layout")||e.changed.has("domain"),wasUnconsumed:i,warnUnconsumed:!t&&i&&this.lastUnconsumedWarning!==r}}afterCompute(e,t,n){if(Ni){if(t&&e.wasUnconsumed&&(this.lastConsumed=e.revisions),e.warnUnconsumed&&!t)return console.warn(`[semiotic] ${this.hostName} observed scene-affecting revisions without a scene rebuild: ${e.signature}.`),void(this.lastUnconsumedWarning=e.signature);t&&e.sawSignals&&!e.wasUnconsumed&&!n&&this.lastDuplicateWarning!==e.signature?(console.warn(`[semiotic] ${this.hostName} performed scene rebuild with unchanged scene revisions: ${e.signature}.`),this.lastDuplicateWarning=e.signature):t&&!e.sawSignals&&(this.lastDuplicateWarning="")}}},Ti=(0,Ci.memo)(function({store:e,diagnostics:t}){return(0,Ci.useEffect)(()=>{const n=()=>t.observeUpdateResult(e.getUpdateSnapshot());return n(),e.subscribeUpdateResult(n)},[t,e]),null});function zi(e,t=30){return Math.max((e??4)+5,12,t)}var Di=[40,40],_i=[.5,.5];function Oi(e,t){const[n,r]=e.viewBox??Di,[i,o]=e.anchor??_i,a=r>0?r:1,s=Math.max(0,t)/a,l=(n>0?n:a)*s,c=a*s;return{width:l,height:c,scale:s,offsetX:-i*l,offsetY:-o*c}}function Fi(e,t){const n=Oi(e,t),r=[[n.offsetX,n.offsetY],[n.offsetX+n.width,n.offsetY],[n.offsetX,n.offsetY+n.height],[n.offsetX+n.width,n.offsetY+n.height]];let i=0;for(const[e,t]of r){const n=Math.sqrt(e*e+t*t);n>i&&(i=n)}return i}function Wi(e,t,n,r){if("none"!==e)return"color"===e||null==e?t??r:"accent"===e?n:e}var Bi=null;function Hi(e){if("undefined"==typeof Path2D)return null;Bi||(Bi=new Map);const t=Bi.get(e);if(t)return t;const n=new Path2D(e);return Bi.size>1024&&Bi.clear(),Bi.set(e,n),n}function $i(e,t,n=0,r="horizontal"){const[i,o]=e.viewBox??Di,a=Math.min(1,Math.max(0,n)),s=Math.min(1,Math.max(0,t));return s>a?a>0||1>s?"vertical"===r?{x:0,y:o*(1-s),width:i,height:o*(s-a)}:{x:i*a,y:0,width:i*(s-a),height:o}:null:{x:0,y:0,width:0,height:0}}function qi(e,t){const n=Oi(e,t);return{centerDx:n.offsetX+n.width/2,centerDy:n.offsetY+n.height/2,halfWidth:n.width/2,halfHeight:n.height/2,radius:Math.hypot(n.width,n.height)/2}}function Gi(e,t,n,r,i,o=e=>e){for(const a of t.parts){const t=Hi(a.d);if(!t)continue;const s=a.opacity??1,l=e.globalAlpha;1!==s&&(e.globalAlpha=l*s);const c=i?"none"===a.fill?void 0:i:Wi(a.fill,n,r);c&&(e.fillStyle=o(c),e.fill(t));const u=i?a.stroke&&"none"!==a.stroke?i:void 0:Wi(a.stroke??"none",n,r);u&&(e.strokeStyle=o(u),e.lineWidth=a.strokeWidth??1,e.lineCap=a.strokeLinecap??"butt",e.lineJoin=a.strokeLinejoin??"miter",e.stroke(t)),1!==s&&(e.globalAlpha=l)}}function Vi(e,t,n,r,i,o,a=0,s=r){if(o){const e=function(e,t,n,r,i,o=e=>e.x,a=e=>e.y,s=e=>e.r){const l=Math.max(r,i+5,12),c=t-l,u=t+l,d=n-l,h=n+l;let f=null,p=1/0;return e.visit((e,i,l,m,g)=>{if(i>u||c>m||l>h||d>g)return!0;if(!e.length){let i=e;do{const e=i.data,l=o(e)-t,c=a(e)-n,u=Math.sqrt(l*l+c*c);zi(s(e),r)>=u&&p>u&&(f=e,p=u),i=i.next}while(i)}return!1}),f?{node:f,distance:p}:null}(o,t,n,r,a);if(e&&!1!==e.node.interactive)return e}else{let i=null,o=1/0;for(const a of e){if("point"!==a.type)continue;if(!1===a.interactive)continue;const e=a.x-t,s=a.y-n,l=Math.sqrt(e*e+s*s);zi(a.r,r)>=l&&o>l&&(i=a,o=l)}if(i)return{node:i,distance:o}}let l=null,c=1/0;for(const i of e){if("glyph"!==i.type)continue;if(null==i.datum)continue;const e=qi(i.glyph,i.size),o=i.x+e.centerDx-t,a=i.y+e.centerDy-n,s=Math.sqrt(o*o+a*a);zi(e.radius,r)>=s&&c>s&&(l=i,c=s)}if(l)return{node:l,distance:c};for(let r=e.length-1;r>=0;r--){const o=e[r];if("geoarea"!==o.type)continue;const a=o;if(!1===a.interactive)continue;const[[s,l],[c,u]]=a.bounds;if(!(s>t||t>c||l>n||n>u)&&(a._cachedPath2D||(a._cachedPath2D=new Path2D(a.pathData)),i.isPointInPath(a._cachedPath2D,t,n)))return{node:a,distance:0}}let u=null,d=1/0;for(const r of e){if("line"!==r.type)continue;const e=r,{path:i}=e,o=Math.max((e.style.strokeWidth??2)+4,5,s);for(let r=0;i.length-1>r;r++){const[a,s]=i[r],[l,c]=i[r+1],h=Ui(t,n,a,s,l,c);o>=h&&d>h&&(u=e,d=h)}}return u?{node:u,distance:d}:null}function Ui(e,t,n,r,i,o){const a=i-n,s=o-r,l=a*a+s*s;if(0===l)return Math.sqrt((e-n)**2+(t-r)**2);let c=((e-n)*a+(t-r)*s)/l;return c=Math.max(0,Math.min(1,c)),Math.sqrt((e-(n+c*a))**2+(t-(r+c*s))**2)}var Yi=d(require("react")),Xi=require("react"),Zi=require("./semiotic-client-cjs-shared.min.js"),Ki=require("react");var Qi=require("react");function Ji(e,t=0,n=1/0,r=0){const i=Number.isFinite(t)?t:0,o=Number.isFinite(n)?Math.max(i,n):1/0,a=Number.isFinite(e)?Math.floor(e):i,s=Math.max(i,Math.min(o,a));return r>0&&Number.isFinite(r)?Math.max(i,Math.min(o,Math.round(s/r)*r)):s}var eo=new WeakMap,to=0,no=!1,ro=null,io=null,oo=null,ao=new Set;function so(e,t){if(!t)return t;const n=function(e){const t=e.trim();if(!t.startsWith("var(")||!t.endsWith(")"))return null;const n=t.slice(4,-1),r=n.indexOf(",");if(-1===r){const e=n.trim();return e.startsWith("--")?{name:e}:null}const i=n.slice(0,r).trim(),o=n.slice(r+1).trim();return i.startsWith("--")?{name:i,fallback:o||void 0}:null}(t);if(!n)return t;const r=()=>n.fallback?so(e,n.fallback):t,i=e.canvas;if(!i)return r();let o=eo.get(i);o&&o.version===to||(o={version:to,map:new Map},eo.set(i,o));const a=o.map.get(t);if(void 0!==a)return a;const s=getComputedStyle(i).getPropertyValue(n.name).trim()||r()||t;return o.map.set(t,s),s}var lo=()=>"undefined"!=typeof performance?performance.now():Date.now();function co(e,t){const n=e();return Number.isFinite(n)?n:t}var uo=class{constructor(e={}){this.randomSource=Math.random,this.subscribers=new Set,this.now=()=>this.advance(),this.random=()=>this.randomSource(),this.clock=e.clock??lo,this.lastWallTime=co(this.clock,0),this.logicalTime=this.lastWallTime,this.pausedValue=!0===e.paused,this.visibleValue=!1!==e.visible,this.setRandomSource(e.random,e.seed)}get isActive(){return!this.pausedValue&&this.visibleValue}get paused(){return this.pausedValue}get seed(){return this.seedValue}get visible(){return this.visibleValue}configure(e){this.setClock(e.clock),this.setRandomSource(e.random,e.seed)}setPaused(e){this.pausedValue!==e&&(this.advance(),this.pausedValue=e,this.emit())}setVisible(e){this.visibleValue!==e&&(this.advance(),this.visibleValue=e,this.emit())}snapshot(){return{now:this.now(),paused:this.pausedValue,seed:this.seedValue,visible:this.visibleValue}}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}advance(){const e=co(this.clock,this.lastWallTime),t=Math.max(0,e-this.lastWallTime);return this.lastWallTime=e,this.isActive&&(this.logicalTime+=t),this.logicalTime}emit(){for(const e of this.subscribers)e()}setClock(e){const t=e??lo;t!==this.clock&&(this.advance(),this.clock=t,this.lastWallTime=co(t,this.lastWallTime))}setRandomSource(e,t){const n=function(e){return"number"==typeof e&&Number.isFinite(e)?Math.trunc(e):void 0}(t);e===this.randomInput&&n===this.seedValue||(this.randomInput=e,this.seedValue=n,this.randomSource=e??(void 0===n?Math.random:function(e){let t=e>>>0;return()=>{t+=1831565813;let e=t;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}}(n)))}},ho=34,fo=58;function po(e){return"object"==typeof e&&null!==e&&"legendGroups"in e&&Array.isArray(e.legendGroups)}function mo(e){return"object"==typeof e&&null!==e&&"gradient"in e}var go=16,yo=6,vo=10,bo=22,xo=100,wo=10,ko=3;function So(e,t,n,r,i=8){const o=r,a="left"===r?"right":"right"===r?"left":"top"===r?"bottom":"top",s=Math.max(t[o],Math.max(0,("left"===r||"right"===r?n[0]:n[1])-i)-e[a]);e[o]>s&&(e[o]=s)}var Mo=46,jo=26;function Ao(e){return Math.ceil(7*e.length)}function Co(e,t){if(po(e)){const n=Wo(t),r=e.legendGroups.flatMap(e=>[e.label?Ao(e.label):0,...e.items.map(e=>n.swatchSize+n.labelGap+Ao(e.label))]);return Math.max(xo,...r)}if(mo(e)){const{gradient:t}=e,n=t.format||(e=>Math.round(100*e)/100+""),r=Math.max(Ao(n(t.domain[0])),Ao(n(t.domain[1]))),i=t.label?Ao(t.label):0;return Math.max(xo,19+r,i)}return xo}function Ro(e){return(po(e)||mo(e))&&Number.isFinite(e.legendDistance)?Math.max(0,e.legendDistance):wo}function Lo(e,t){return null!=e?.sideGutter?Math.max(0,e.sideGutter):t?.hasAxis?t.hasAxisLabel?zo:To:0}function Po(e){return Math.max(0,e?.edgeGutter??ko)}var No=22,Eo=46,Io=64,To=34,zo=70;function Do(e,t){return null!=t?.axisGutter?Math.max(0,t.axisGutter):e?.hasAxis?e.hasAxisLabel?e.rotatedTicks?Io:Eo:No:0}function _o(e,t,n){if(mo(e))return e.gradient.label?Mo:jo;if(!po(e))return 20;const r=Wo(n),i=Math.max(1,n?.maxWidth??t);let o=r.rowHeight;for(const t of e.legendGroups){let e=0,n=0;for(const o of t.items){const t=r.swatchSize+r.labelGap+Ao(o.label),a=0===n?t:n+r.itemGap+t;n>0&&a>i?(e+=1,n=t):n=a}t.items.length>0&&(e+=1),o=Math.max(o,e*r.rowHeight,t.label?Ao(t.label):0)}return o+(e.legendGroups.length>1?16:0)}function Oo(e,t,n){return Co(e,t)+Ro(e)+Lo(t,n)+Po(t)}function Fo(e,t){const{legend:n}=t;if(!n)return;const r=t.position??"right",i=_o(n,Math.max(1,t.size[0]-e.left-e.right),t.legendLayout)+Ro(n)+Do("bottom"===r?t.axisChrome:"top"===r?t.axisChrome?.topAxis:void 0,t.legendLayout)+("top"===r&&t.hasTitle?24:0),o=Math.max(t.minimumMargin??0,"top"===r?t.hasTitle?fo:ho:0);"right"===r?e.right=Math.max(e.right,o,Oo(n,t.legendLayout,t.axisChrome?.rightAxis)):"left"===r?e.left=Math.max(e.left,o,Oo(n,t.legendLayout,t.axisChrome?.leftAxis)):"top"===r?e.top=Math.max(e.top,o,i):e.bottom=Math.max(e.bottom,o,i)}function Wo(e){const t=Math.max(1,e?.swatchSize??go),n=Math.max(t,e?.rowHeight??bo);return{swatchSize:t,labelGap:Math.max(0,e?.labelGap??yo),itemGap:Math.max(0,e?.itemGap??vo),rowHeight:n,align:"left"===e?.align?"start":"right"===e?.align?"end":e?.align??"start",maxWidth:e?.maxWidth}}var Bo="undefined"==typeof window?Xi.useEffect:Xi.useLayoutEffect,Ho={requestAnimationFrame:e=>("undefined"==typeof window?globalThis:window).requestAnimationFrame(e),cancelAnimationFrame:e=>("undefined"==typeof window?globalThis:window).cancelAnimationFrame(e)};function $o(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function qo(e){const t=function(){const[e,t]=(0,Ki.useState)(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return(0,Ki.useEffect)(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),function(e,t){if("function"==typeof e.addEventListener)return e.addEventListener("change",t),()=>e.removeEventListener("change",t);const n=e;return n.addListener(t),()=>n.removeListener(t)}(e,e=>t(e.matches))},[]),e}(),n=(0,Xi.useRef)(t);n.current=t;const[r,i]=function(e,t,n,r={}){const i=(0,Qi.useRef)(null),[o,a]=(0,Qi.useState)(null);return(0,Qi.useEffect)(()=>{if(!t&&!n)return;const e=i.current;if(!e||"undefined"==typeof ResizeObserver)return;const o=(e,t)=>({w:Ji(e,r.minWidth,r.maxWidth,r.widthStep),h:Ji(t,r.minHeight,r.maxHeight,r.heightStep)}),s=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect,r=o(e,n);a(e=>e&&e.w===r.w&&e.h===r.h?e:r)}});return s.observe(e),()=>s.disconnect()},[t,n,r.minWidth,r.maxWidth,r.widthStep,r.minHeight,r.maxHeight,r.heightStep]),[i,[t&&o?o.w:e[0],n&&o?o.h:e[1]]]}(e.sizeProp,e.responsiveWidth,e.responsiveHeight),o=i[0],a=i[1],s=(0,Xi.useMemo)(()=>[o,a],[o,a]),l=!!e.title,c=!!e.legend&&"top"===e.legendPosition,u=(0,Xi.useMemo)(()=>{const t=function(e,t,n=!1){const r=n?t?fo:ho:t?36:0;return r>e.top?{...e,top:r}:e}({...e.marginDefault,...e.userMargin},l,c);if(e.legend&&!e.legendMarginReserved){const n={...t},r=e.legendPosition??"right";Fo(t,{legend:e.legend,position:r,size:s,hasTitle:l,legendLayout:e.legendLayout,axisChrome:e.axisChrome}),So(t,n,s,r)}return t},[e.marginDefault,e.userMargin,e.legend,e.legendPosition,e.legendLayout,e.axisChrome,e.legendMarginReserved,l,c,s]),d=i[0]-u.left-u.right,h=i[1]-u.top-u.bottom,f=$o(e.foregroundGraphics,i,u),p=$o(e.backgroundGraphics,i,u),m=(0,Zi.useThemeSelector)(e=>e.theme),{transition:g,introEnabled:y}=function(e,t){if(!1===e)return{transition:void 0,introEnabled:!1};const n="undefined"!=typeof window&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;return{transition:e?!0===e?{duration:300}:{duration:e.duration??300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(n||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),v="semiotic-table-"+Yi.useId(),b=(0,Xi.useRef)(null);if(!b.current){const t=!e.suspendWhenHidden||"undefined"==typeof document||!document.hidden;b.current=new uo({clock:e.clock,random:e.random,seed:e.seed,paused:e.paused,visible:t})}const x=b.current;x.configure({clock:e.clock,random:e.random,seed:e.seed});const w=(0,Xi.useRef)(null),k=(0,Xi.useRef)(e.frameScheduler??Ho);k.current=e.frameScheduler??Ho;const S=(0,Xi.useRef)(null),M=(0,Xi.useRef)(!1),j=(0,Xi.useRef)(()=>{}),A=(0,Xi.useCallback)(()=>{if(null!==w.current||M.current)return;const e=k.current;let t=!1,n=!1;const r=e.requestAnimationFrame(()=>{t=!0;const e=!n;e&&(M.current=!0),w.current=null,S.current=null;try{j.current()}finally{e&&(M.current=!1)}});n=!0,t||(w.current=r,S.current=e)},[]),C=(0,Xi.useCallback)(()=>{null!==w.current&&((S.current??k.current).cancelAnimationFrame(w.current),w.current=null,S.current=null)},[]);Bo(()=>{x.setPaused(!0===e.paused)},[x,e.paused]),(0,Xi.useEffect)(()=>{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]),(0,Xi.useEffect)(()=>()=>{C()},[C]);const R=(0,Xi.useRef)(()=>{}),L=(0,Xi.useRef)(()=>{}),P=(0,Xi.useRef)({inside:!1,clientX:0,clientY:0,pointerType:void 0}),N=(0,Xi.useRef)(null),E=(0,Xi.useRef)(null),I=(0,Xi.useRef)(null),T=(0,Xi.useCallback)(()=>{const e=N.current;N.current=null,e&&R.current(e)},[]),z=(0,Xi.useCallback)(e=>{const t=P.current;if(t.inside=!0,t.clientX=e.clientX,t.clientY=e.clientY,t.pointerType=e.pointerType,N.current={clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType},null===E.current){const e=k.current;let t=!1;const n=e.requestAnimationFrame(()=>{t=!0,E.current=null,I.current=null,T()});t||(E.current=n,I.current=e)}},[T]),D=(0,Xi.useCallback)(()=>{P.current.inside=!1,N.current=null,null!==E.current&&((I.current??k.current).cancelAnimationFrame(E.current),E.current=null,I.current=null),L.current()},[]);(0,Xi.useEffect)(()=>()=>{N.current=null,null!==E.current&&((I.current??k.current).cancelAnimationFrame(E.current),E.current=null,I.current=null)},[]);const _=e.themeDirtyRef,O=(0,Xi.useRef)(!1);return Bo(()=>{if(!_)return;const t=!O.current;O.current=!0,t&&e.skipInitialThemeInvalidation||(to++,_.current=!0,A())},[m,e.skipInitialThemeInvalidation,A,_]),(0,Xi.useEffect)(()=>{if(_)return function(e,t){!function(){if(no)return;if("undefined"==typeof window||"undefined"==typeof document)return;no=!0;const e=e=>{if(!e?.includes("--"))return"";const t=document.createElement("span").style;return t.cssText=e,Array.from(t).filter(e=>e.startsWith("--")).sort().map(e=>`${e}:${t.getPropertyValue(e)}!${t.getPropertyPriority(e)}`).join(";")},t=(t,n)=>{const r=t.target;if(!(r instanceof Element))return!1;if(r===n||r.contains(n))return!0;if(!n.contains(r))return!1;const i="CANVAS"===r.tagName;return!(!i&&!r.querySelector("canvas")||i&&"style"===t.attributeName&&e(t.oldValue)===e(r.getAttribute("style")))},n=e=>{const n=[];for(const r of ao){const i=r.getElement();i&&(!e||e.some(e=>t(e,i)))&&n.push(r)}if(!e||0!==n.length){to++;for(const e of n)e.listener()}};if("undefined"!=typeof MutationObserver&&document.documentElement&&(ro=new MutationObserver(e=>{n(e)})).observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme","data-semiotic-theme-mode"],attributeOldValue:!0,subtree:!0}),"function"==typeof window.matchMedia)try{io=window.matchMedia("(prefers-color-scheme: dark)"),oo=()=>n(),"function"==typeof io.addEventListener?io.addEventListener("change",oo):"function"==typeof io.addListener&&io.addListener(oo)}catch{}}();const n={getElement:e,listener:t};return ao.add(n),()=>{ao.delete(n)&&0===ao.size&&(ro?.disconnect(),ro=null,io&&oo&&("function"==typeof io.removeEventListener?io.removeEventListener("change",oo):"function"==typeof io.removeListener&&io.removeListener(oo)),io=null,oo=null,no=!1)}}(()=>r.current,()=>{_.current=!0,A()})},[r,A,_]),{reducedMotion:t,reducedMotionRef:n,responsiveRef:r,size:i,margin:u,adjustedWidth:d,adjustedHeight:h,resolvedForeground:f,resolvedBackground:p,currentTheme:m,transition:g,introEnabled:y,tableId:v,frameRuntime:x,rafRef:w,renderFnRef:j,scheduleRender:A,cancelRender:C,hoverHandlerRef:R,hoverLeaveRef:L,onPointerMove:z,onPointerLeave:D,pointerStateRef:P}}var Go=require("react");function Vo(e){if(!e?.colors)return;const t=e.colors;return{primary:t.primary,secondary:t.secondary||t.primary,surface:t.surface||t.background,success:t.success,danger:t.danger,warning:t.warning,error:t.error,info:t.info,text:t.text,textSecondary:t.textSecondary,border:t.border,grid:t.grid}}var Uo=require("react"),Yo={fresh:1,aging:.7,stale:.45,expired:.25},Xo={alpha:1,band:"fresh",isStale:!1};var Zo=require("react/jsx-runtime");function Ko({isStale:e,position:t}){return(0,Zo.jsx)("div",{className:"stream-staleness-badge",style:{position:"absolute",..."top-left"===t?{top:4,left:4}:"bottom-left"===t?{bottom:4,left:4}:"bottom-right"===t?{bottom:4,right:4}:{top:4,right:4},padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",zIndex:3,background:e?"#dc3545":"#28a745",color:"white"},children:e?"STALE":"LIVE"})}var Qo=d(require("react")),Jo=require("./semiotic-client-cjs-shared.min.js");function ea(e,t={}){const n=function(e){const t=e.provenance,n=e.id??e.stableId??t?.stableId;return null==n||""===n?void 0:n+""}(e);return{"data-semiotic-annotation-widget":"",...n?{"data-semiotic-annotation-id":n}:{},onClickCapture(r){const i=function(e){const t=e.nativeEvent;return"touch"===t.pointerType?"touch":0===t.detail?"keyboard":"pointer"}(r);t.onAnnotationActivate?.({annotation:e,annotationId:n,chartId:t.chartId,inputType:i}),n&&t.onObservation&&t.onObservation({type:"annotation-activate",annotationId:n,inputType:i,timestamp:Date.now(),chartType:t.chartType??"unknown",chartId:t.chartId})}}}var ta=require("react"),na=d(require("react")),ra=require("react/jsx-runtime");function ia(e,t=120,n=8){if(!e)return[];const r=Math.max(1,Math.floor(t/n)),i=e.split(/\s+/),o=[];let a="";for(const e of i)a&&a.length+1+e.length>r?(o.push(a),a=e):a=a?`${a} ${e}`:e;return a&&o.push(a),o}function oa(e,t,n,r){return"curly"===e?r?`M0,0 C${.6*n},0 ${.4*n},${t/2} ${n},${t/2} C${.4*n},${t/2} ${.6*n},${t} 0,${t}`:`M0,0 C0,${.6*n} ${t/2},${.4*n} ${t/2},${n} C${t/2},${.4*n} ${t},${.6*n} ${t},0`:r?`M0,0 L${n},0 L${n},${t} L0,${t}`:`M0,0 L0,${n} L${t},${n} L${t},0`}function aa(e,t,n,r){if(!e)return(0,ra.jsx)("g",{className:"annotation-note"});const{label:i,title:o,orientation:a,align:s,wrap:l=120,noWrap:c}=e;if(!i&&!o)return(0,ra.jsx)("g",{className:"annotation-note"});let u=a;u||(u=Math.abs(t)>Math.abs(n)?"leftRight":"topBottom");let d=s;d&&"dynamic"!==d||(d="topBottom"===u?0>t?"right":"left":0>n?"bottom":"top");let h="start";"topBottom"===u?"right"===d?h="end":"middle"===d&&(h="middle"):h=0>t?"end":"start";const f=16,p=o?c?[o]:ia(o,l):[],m=i?c?[i]:ia(i,l):[],g="leftRight"===u?"end"===h?-4:4:0;let y=0;const v=[],b=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";e.useHTML||e.html?v.push((0,ra.jsx)("foreignObject",{className:"annotation-note-html",x:"end"===h?g-l:"middle"===h?g-l/2:g,y:-16,width:l,height:Math.max(f,(p.length+m.length)*f+(o&&i?2:0))+f,style:{overflow:"visible"},children:(0,ra.jsxs)("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{color:b,fontSize:"12px",lineHeight:"16px",overflow:"visible",textAlign:"end"===h?"right":"middle"===h?"center":"left",whiteSpace:c?"nowrap":"normal",wordBreak:"break-word"},children:[o&&(0,ra.jsx)("div",{className:"annotation-note-title",style:{fontWeight:"bold"},children:o}),i&&(0,ra.jsx)("div",{className:"annotation-note-label",children:i})]})},"annotation-note-html")):(p.length>0&&(v.push((0,ra.jsx)("text",{className:"annotation-note-title",fill:b,textAnchor:h,fontWeight:"bold",children:p.map((e,t)=>(0,ra.jsx)("tspan",{x:g,dy:0===t?0:f,children:e},t))},"annotation-note-title")),y=p.length*f),m.length>0&&v.push((0,ra.jsx)("text",{className:"annotation-note-label",fill:b,textAnchor:h,y:y,children:m.map((e,t)=>(0,ra.jsx)("tspan",{x:g,dy:0===t?0:f,children:e},t))},"annotation-note-label")));let x=null;if((o||i)&&(0!==t||0!==n))if("topBottom"===u){const e=Math.min(l,120);let t=0,n=e;"end"===h?(t=-e,n=0):"middle"===h&&(t=-e/2,n=e/2),x=(0,ra.jsx)("line",{className:"note-line",x1:t,x2:n,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const e=(p.length+m.length)*f+(m.length>0?f:0);let t=0,n=e;"bottom"===d?(t=-e,n=0):"middle"===d&&(t=-e/2,n=e/2),x=(0,ra.jsx)("line",{className:"note-line",x1:0,x2:0,y1:t,y2:n,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const w=Math.max(0,p.length+m.length-1)*f;let k=0;return"topBottom"===u?k=0>n?-(w+2):18:"leftRight"===u&&(k="middle"===d?-(w+f+(m.length>0&&p.length>0?2:0))/2+8:"bottom"===d||0>n?-(w+2):18),(0,ra.jsxs)("g",{className:"annotation-note",transform:`translate(${t},${n})`,children:[(0,ra.jsx)("g",{className:"annotation-note-content",transform:0!==k?`translate(0,${k})`:void 0,children:v}),x]})}function sa(e,t,n,r,i){const o=[];switch(e){case"callout-circle":{const e=(t?.radius||0)+(t?.radiusPadding||0);e>0&&o.push((0,ra.jsx)("circle",{r:e,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const e=t?.width||0,r=t?.height||0;(e>0||r>0)&&o.push((0,ra.jsx)("rect",{width:e,height:r,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":t?.custom&&o.push(...Array.isArray(t.custom)?t.custom:[t.custom]);break;case"xy-threshold":{const e=r||0,a=i||0;if(void 0!==t?.x){const r=(t.x||0)-e;o.push((0,ra.jsx)("line",{x1:r,y1:(t.y1||0)-a,x2:r,y2:(t.y2||0)-a,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==t?.y){const r=(t.y||0)-a;o.push((0,ra.jsx)("line",{x1:(t.x1||0)-e,y1:r,x2:(t.x2||0)-e,y2:r,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==t?.x1||void 0!==t?.x2?o.push((0,ra.jsx)("line",{x1:(t.x1||0)-e,y1:0,x2:(t.x2||0)-e,y2:0,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===t?.y1&&void 0===t?.y2||o.push((0,ra.jsx)("line",{x1:0,y1:(t.y1||0)-a,x2:0,y2:(t.y2||0)-a,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const e=t?.type||"curly",r=t?.width??t?.height;void 0!==r&&o.push((0,ra.jsx)("path",{d:oa(e,r,t?.depth||30,void 0===t?.width),fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return(0,ra.jsx)("g",{className:"annotation-subject",children:o})}function la(e,t,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=e-i,c=t-o;if(0!==a||0!==c){const e=Math.abs(a),t=Math.abs(c),u=n/2,d=r/2,h=e*d>t*u?u/e:d/t;s=i+a*h,l=o+c*h}}}else if("bracket"===i&&o){const e=o.width,t=o.height,n=o.depth||30;void 0!==e?(s=e/2,l=n):void 0!==t&&(s=n,l=t/2)}}else{const n=(o.radius||0)+(o.radiusPadding||0);if(n>0&&(0!==e||0!==t)){const r=Math.atan2(t,e);s=Math.cos(r)*n,l=Math.sin(r)*n}}const c=Math.sqrt((e-s)**2+(t-l)**2);if(c>.5){const i=r||"var(--semiotic-text-secondary, currentColor)",o="curve"===n?.type;let u=Math.atan2(t-l,e-s);if(o){const r=(s+e)/2,o=(l+t)/2,d=-(t-l)/c,h=(e-s)/c,f=(n?.curve??.25)*c,p=r+d*f,m=o+h*f;a.push((0,ra.jsx)("path",{className:"connector-curve",d:`M${s},${l}Q${p},${m} ${e},${t}`,fill:"none",stroke:i},"connector-line")),u=Math.atan2(m-l,p-s)}else a.push((0,ra.jsx)("line",{x1:s,y1:l,x2:e,y2:t,stroke:i},"connector-line"));if("arrow"===n?.end){const e=10,t=16/180*Math.PI;a.push((0,ra.jsx)("path",{d:`M${s},${l}L${s+e*Math.cos(u+t)},${l+e*Math.sin(u+t)}L${s+e*Math.cos(u-t)},${l+e*Math.sin(u-t)}Z`,fill:i,stroke:"none"},"connector-arrow"))}}return(0,ra.jsx)("g",{className:"annotation-connector",children:a})}function ca(e){const{x:t=0,y:n=0,dx:r,dy:i,nx:o,ny:a,note:s,connector:l,subject:c,type:u,color:d,className:h,disable:f,opacity:p,strokeDasharray:m,events:g={},"data-testid":y}=e,v=Array.isArray(t)?t[0]??0:t,b=Array.isArray(n)?n[0]??0:n,x=new Set(Array.isArray(f)?f:[]);let w=r||0,k=i||0;null!=o&&(w=o-v),null!=a&&(k=a-b);const S="string"==typeof u?u:"label";if("bracket"===S&&c&&0===w&&0===k)if(void 0!==c.width){w=c.width/2;const e=c.depth||30;k=e+(0>e?-5:5)}else if(void 0!==c.height){const e=c.depth||30;w=e+(0>e?-5:5),k=c.height/2}return(0,ra.jsxs)("g",{className:("annotation "+(h||"")).trim(),transform:`translate(${v},${b})`,"data-testid":y,...null!=p&&{opacity:p},...m&&{strokeDasharray:m},...g,children:[!x.has("connector")&&la(w,k,l,d,S,c),!x.has("subject")&&sa(S,c,d,v,b),!x.has("note")&&aa(s,w,k,d)]})}function ua(e){const{noteData:t}=e,{screenCoordinates:n}=t,r="string"==typeof t.type?t.type:"label",i=t.eventListeners||t.events||{};if(t.coordinates&&n){const e=t.nx||n[0][0]+(t.dx??0),i=t.ny||n[0][1]+(t.dy??0),o=n.map((n,o)=>{const a=Object.assign({},t,{note:0===o?t.note:{label:""},x:n[0],y:n[1],nx:e,ny:i});return(0,ra.jsx)(ca,{"data-testid":"semiotic-annotation",...a,type:r},"multi-annotation-"+o)});return(0,ra.jsx)("g",{children:o})}const o=t.note||{title:"none",label:t.label},a=`${o.label}-${o.title}-${t.i}`;return(0,ra.jsx)(ca,{"data-testid":"semiotic-annotation",events:i,...t,type:r},a)}var da=require("d3-hierarchy"),ha=require("d3-shape");function fa(e){return Math.round(100*e)/100}function pa(e,t=2){const n=[],r=[],i=t+1;for(let t=0;i>t;t++){let o=0;for(const[n,r]of e)null!==r&&(o+=n**t*r);n.push(o);const a=[];for(let n=0;i>n;n++){let r=0;for(const[i,o]of e)null!==o&&(r+=i**(t+n));a.push(r)}r.push(a)}r.push(n);const o=function(e,t){const n=e,r=e.length-1,i=[t];for(let e=0;r>e;e++){let t=e;for(let i=e+1;r>i;i++)Math.abs(n[e][i])>Math.abs(n[e][t])&&(t=i);for(let i=e;r+1>i;i++){const r=n[i][e];n[i][e]=n[i][t],n[i][t]=r}for(let t=e+1;r>t;t++)for(let i=r;i>=e;i--)n[i][t]-=n[i][e]*n[e][t]/n[e][e]}for(let e=r-1;e>=0;e--){let t=0;for(let o=e+1;r>o;o++)t+=n[o][e]*i[o];i[e]=(n[r][e]-t)/n[e][e]}return i}(r,i).map(fa);return{points:e.map(([e])=>[fa(e),fa(o.reduce((t,n,r)=>t+n*e**r,0))]),equation:[...o].reverse()}}function ma(e,t){const n=t.scales?.x??t.scales?.time;return n?null!=e.x?n(e.x):t.xAccessor&&null!=e[t.xAccessor]?n(e[t.xAccessor]):null:null}function ga(e,t){const n=t.scales?.y??t.scales?.value;return n?null!=e.y?n(e.y):t.yAccessor&&null!=e[t.yAccessor]?n(e[t.yAccessor]):null:null}function ya(e){return null==e?null:e+""}function va(e,t,n){return t.stickyPositionCache?.set(e,n),n}function ba(e,t,n){const r=e.anchor||e.lifecycle?.anchor||"fixed";if("latest"===r){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let r=n.pointNodes.length-1;r>=0;r--){const i=n.pointNodes[r];if(i.pointId===e.pointId)return va(t,n,{x:i.x,y:i.y})}const r=function(e){const t=e.data;if(!t||0===t.length)return null;const n=t[t.length-1],r=e.scales?.x??e.scales?.time,i=e.scales?.y??e.scales?.value;if(!r||!i)return null;const o=n[e.xAccessor||"x"],a=n[e.yAccessor||"y"];return null==o||null==a?null:{x:r(o),y:i(a)}}(n);return r?va(t,n,r):null}if("semantic"===r){const r=function(e,t,n){const r=function(e){return ya(e.provenance?.stableId??e.stableId)}(e);if(!r)return null;const i=n.pointNodes?.find(e=>ya(e.pointId)===r);if(i)return va(t,n,{x:i.x,y:i.y});const o=n.data?.find(e=>function(e){return ya(e.stableId??e.id??e.provenance?.stableId)}(e)===r);if(!o)return null;const a=ma(o,n),s=ga(o,n);return null==a||null==s?null:va(t,n,{x:a,y:s})}(e,t,n);if(r)return r}let i=null,o=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(i=t.x,o=t.y)}if(null!=i&&null!=o||(i=ma(e,n),o=ga(e,n)),null!=i&&null!=o)return va(t,n,{x:i,y:o});if("sticky"===r){const e=n.stickyPositionCache?.get(t);if(e)return e}return null}function xa(e,t,n,r=50){return!(-r>e||e>(n.width||0)+r||-r>t||t>(n.height||0)+r)}var wa=require("react/jsx-runtime"),ka="var(--semiotic-bg, #ffffff)";function Sa(e){const{x:t,y:n,text:r,fill:i,fontSize:o=12,fontWeight:a,fontFamily:s,textAnchor:l="start",dominantBaseline:c,background:u,className:d}=e,h=function(e){return void 0===e||!0===e||"halo"===e?{type:"halo"}:!1===e||"none"===e?null:"box"===e?{type:"box"}:{type:e.type??"halo",...e}}(u),f=e=>(0,wa.jsx)("text",{x:t,y:n,textAnchor:l,dominantBaseline:c,fill:i,fontSize:o,fontWeight:a,fontFamily:s,className:d,...e?{style:{stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:"stroke"}}:{},children:r});if(!h)return f();if("halo"===h.type)return f({stroke:h.fill??ka,strokeWidth:h.haloWidth??3});const p=h.padding??{x:6,y:3},m="number"==typeof p?p:p.x,g="number"==typeof p?p:p.y,y=function(e,t){return(e+"").length*t*.6}(r,o),v=o+2*g;let b,x;return b="middle"===l?t-y/2-m:"end"===l?t-y-m:t-m,x="middle"===c||"central"===c?n-v/2:"hanging"===c||"text-before-edge"===c?n-g:n-.8*o-g,(0,wa.jsxs)("g",{className:d,children:[(0,wa.jsx)("rect",{x:b,y:x,width:y+2*m,height:v,rx:h.radius??3,ry:h.radius??3,fill:h.fill??ka,fillOpacity:h.opacity??.85,stroke:h.stroke,strokeWidth:h.strokeWidth}),f()]})}function Ma(e){return{type:"hatch",background:e.background,stroke:e.stroke,lineWidth:e.lineWidth,spacing:e.spacing,angle:e.angle}}var ja=null;var Aa=require("react/jsx-runtime");function Ca(e){return"object"==typeof e&&null!==e&&"hatch"===e.type}function Ra(e){return["hatch",e.background??"transparent",e.stroke??"#000",e.lineWidth??1.5,e.spacing??6,e.angle??45,e.lineOpacity??1].join("|")}function La(e,t){let n=2166136261;const r=Ra(t);for(let e=0;r.length>e;e++)n^=r.charCodeAt(e),n=Math.imul(n,16777619);return`${e}-hatch-${(n>>>0).toString(36)}`}var Pa=new Map;function Na(e,t){const{background:n="transparent",stroke:r="#000",lineWidth:i=1.5,spacing:o=6,angle:a=45,lineOpacity:s=1}=e,l=Math.max(8,Math.ceil(2*o));return(0,Aa.jsxs)("pattern",{id:t,width:l,height:l,patternUnits:"userSpaceOnUse",patternTransform:0!==a?`rotate(${a})`:void 0,children:[n&&"transparent"!==n&&(0,Aa.jsx)("rect",{width:l,height:l,fill:n}),(0,Aa.jsx)("line",{x1:0,y1:0,x2:0,y2:l,stroke:r,strokeWidth:i,strokeOpacity:s}),(0,Aa.jsx)("line",{x1:o,y1:0,x2:o,y2:l,stroke:r,strokeWidth:i,strokeOpacity:s})]},t)}function Ea(e,t,n="#4e79a7"){if(Ca(e)){const n=La(t,e);return{fill:`url(#${n})`,def:Na(e,n)}}return e&&"string"==typeof e?{fill:e}:{fill:n}}function Ia(e,t,n,r){const i=Ea(e.fill??e.color,t,r);return function(e,t,n,r){if(!e||"object"!=typeof e)return;const i=e;if(!Array.isArray(i.stops))return;const o=i.stops.flatMap(e=>{if(!e||"object"!=typeof e)return[];const{offset:t,color:n,opacity:i}=e;return"number"==typeof t&&Number.isFinite(t)?[{offset:Math.max(0,Math.min(1,t)),color:"string"==typeof n&&n?n:r,opacity:"number"==typeof i&&Number.isFinite(i)?Math.max(0,Math.min(1,i)):void 0}]:[]}).sort((e,t)=>e.offset-t.offset);if(!o.length)return;const a="horizontal"===i.direction?"horizontal":"vertical"===i.direction?"vertical":n,s=t+"-gradient";return{fill:`url(#${s})`,def:(0,Aa.jsx)("linearGradient",{id:s,x1:0,y1:0,x2:"horizontal"===a?"100%":0,y2:"vertical"===a?"100%":0,children:o.map((e,t)=>(0,Aa.jsx)("stop",{offset:100*e.offset+"%",stopColor:e.color,stopOpacity:e.opacity},`${e.offset}-${t}`))},s)}}(e.gradient,t,n,"string"==typeof e.fill&&e.fill?e.fill:"string"==typeof e.color&&e.color?e.color:r)??i}var Ta=new Set(["top-left","top-center","top-right","middle-left","center","middle-right","bottom-left","bottom-center","bottom-right"]);function za(e,t,n,r){const i=function(e,t,n){const r=e.position,i="string"==typeof r&&Ta.has(r)?r:"bottom-left",o=i.endsWith("left")?"left":i.endsWith("right")?"right":"center",a=i.startsWith("top")?"top":i.startsWith("bottom")?"bottom":"middle",s="top"===a?0:"bottom"===a?n:n/2;return{x:("left"===o?0:"right"===o?t:t/2)+("number"==typeof e.dx&&Number.isFinite(e.dx)?e.dx:0),y:s+("number"==typeof e.dy&&Number.isFinite(e.dy)?e.dy:0),textAnchor:"start"===e.textAnchor||"middle"===e.textAnchor||"end"===e.textAnchor?e.textAnchor:"left"===o?"start":"right"===o?"end":"middle",dominantBaseline:"auto"===e.dominantBaseline||"middle"===e.dominantBaseline||"hanging"===e.dominantBaseline?e.dominantBaseline:"top"===a?"hanging":"bottom"===a?"auto":"middle"}}(e,t,n);return{...i,fill:e.fill??e.color??r.fill,fontSize:e.fontSize??r.fontSize,fontFamily:e.fontFamily??r.fontFamily,fontWeight:e.fontWeight,fontStyle:e.fontStyle,letterSpacing:e.letterSpacing,opacity:e.opacity,className:e.className,style:{pointerEvents:"none"}}}var Da=require("react/jsx-runtime"),_a={fill:"var(--semiotic-text, #333)",fontSize:11,fontFamily:"inherit"};function Oa({annotation:e,width:t,height:n,defaults:r=_a}){const i=e.label??e.text;return null==i?null:(0,Da.jsx)("text",{...za(e,t,n,r),children:i})}var Fa=require("react/jsx-runtime"),Wa={secondary:0,primary:3};function Ba(e){return!0===e?._annotationDeferred}function Ha(e){return"blended"===e?.cohesion||"layer"===e?.cohesion?e.cohesion:null}function $a(e){const t=e?.provenance?.confidence;return"number"==typeof t&&Number.isFinite(t)?Math.max(0,Math.min(1,t)):null}function qa(e){return Math.max(.72,.95-.06*e)}function Ga(e){const t=e.map((e,t)=>{return{p:e,i:t,emphasis:(n=e.annotation,"primary"===n?.emphasis||"secondary"===n?.emphasis?n.emphasis:null),confidence:$a(e.annotation),readingOrder:null,rank:1};var n}),n=t.some(e=>null!=e.emphasis||null!=e.confidence),r=e.some(e=>Ba(e.annotation)),i=e.some(e=>null!=Ha(e.annotation)),o=e.some(e=>"layer"===Ha(e.annotation));if(!n&&!r&&!i)return e.map(e=>e.node);const a=t.filter(e=>null==e.emphasis&&null!=e.confidence).slice().sort((e,t)=>(t.confidence??0)-(e.confidence??0)||e.i-t.i);a.forEach((e,t)=>{e.readingOrder=t,e.rank=2-t/Math.max(1,a.length)});for(const e of t)e.emphasis&&(e.rank=Wa[e.emphasis]);const s=t.sort((e,t)=>e.rank-t.rank||e.i-t.i).map(e=>{const{p:t,i:n,emphasis:r,readingOrder:i}=e,o=Ba(t.annotation);let a=t.node;if("primary"===r||"secondary"===r||null!=i){const e=null==r&&null!=i;a=(0,Fa.jsx)("g",{className:e?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+r,..."secondary"===r?{opacity:.6,fontSize:"0.88em"}:{},...e?{opacity:qa(i),"data-annotation-reading-order":i}:{},children:t.node},"annotation-emphasis-"+n)}const s=Ha(t.annotation);return s&&(a=(0,Fa.jsx)("g",{className:"annotation-cohesion--"+s,children:a},"annotation-cohesion-"+n)),o&&(a=(0,Fa.jsx)("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:a},"annotation-deferred-"+n)),a});return r&&s.unshift((0,Fa.jsx)("style",{children:".annotation-deferred{opacity:0;pointer-events:none;transition:opacity .12s ease}.stream-xy-frame:hover .annotation-deferred,.stream-ordinal-frame:hover .annotation-deferred,.stream-network-frame:hover .annotation-deferred,.stream-geo-frame:hover .annotation-deferred,.stream-xy-frame:focus-within .annotation-deferred,.stream-ordinal-frame:focus-within .annotation-deferred,.stream-network-frame:focus-within .annotation-deferred,.stream-geo-frame:focus-within .annotation-deferred{opacity:1;pointer-events:auto}@media (prefers-reduced-motion:reduce){.annotation-deferred{transition:none}}"},"annotation-disclosure-style")),o&&s.unshift((0,Fa.jsx)("style",{children:".annotation-cohesion--layer text,.annotation-cohesion--layer tspan{fill:var(--semiotic-annotation-color,var(--semiotic-text-secondary,#666));font-style:italic}"},"annotation-cohesion-style")),s}var Va=require("react/jsx-runtime"),Ua={linear:ha.curveLinear,monotoneX:ha.curveMonotoneX,monotoneY:ha.curveMonotoneY,step:ha.curveStep,stepAfter:ha.curveStepAfter,stepBefore:ha.curveStepBefore,basis:ha.curveBasis,cardinal:ha.curveCardinal,catmullRom:ha.curveCatmullRom};var Ya=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function Xa(e){return!!e&&"object"==typeof e&&Ya.has(function(e){return"string"==typeof e?.type?e.type:""}(e))}function Za(e){return"primary"===e?.emphasis||!0===e?.defensive}function Ka(e,t,n={}){return"number"==typeof n.maxAnnotations&&Number.isFinite(n.maxAnnotations)?Math.max(0,Math.floor(n.maxAnnotations)):e>0&&t>0?Math.max(1,Math.round(e*t/(n.areaPerAnnotation&&n.areaPerAnnotation>0?n.areaPerAnnotation:2e4))):1/0}function Qa(e){let t;const n=e?.emphasis;t="primary"===n?100:"secondary"===n?10:50;const r=e?.provenance?.confidence;switch("number"==typeof r&&Number.isFinite(r)&&(t+=15*Math.max(0,Math.min(1,r))),e?.lifecycle?.freshness){case"fresh":t+=8;break;case"aging":t+=4;break;case"stale":t+=1;break;case"expired":t-=200}return t}new Set(["label","callout","callout-circle","callout-rect"]);var Ja=32,es=6,ts=4,ns=8,rs=72;var is={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function os(e){if(!as(e))return e;const t=("string"==typeof e.mobileText?e.mobileText:void 0)??("string"==typeof e.shortText?e.shortText:void 0);return!t||"string"!=typeof e.label&&null!=e.label?e:{...e,label:t}}function as(e){return Xa(e)}function ss(e,t){if(!e)return[];const n=Math.max(1,Math.floor(t/7)),r=e.split(/\s+/).filter(Boolean),i=[];let o="";for(const e of r)o&&o.length+e.length+1>n?(i.push(o),o=e):o=o?`${o} ${e}`:e;return o&&i.push(o),i}function ls(e,t,n,r,i){const o=e+n,a=t+r;return Math.abs(n)>Math.abs(r)?{x:0>n?o-i.width-4:o+4,y:0>r?a-i.height:a,width:i.width,height:i.height}:{x:0>n?o-i.width:o,y:0>r?a-i.height-4:a+4,width:i.width,height:i.height}}function cs(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function us(e,t){return Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x))*Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y))}function ds(e,t,n,r,i,o,a,s){const l=cs(e,a);let c=.4*Math.hypot(t.dx,t.dy)+80*function(e,t,n,r){const i=Math.max(0,r-e.x),o=Math.max(0,r-e.y);return(i+Math.max(0,e.x+e.width-(t-r)))*e.height+(o+Math.max(0,e.y+e.height-(n-r)))*e.width}(l,i,o,s);for(const e of n)c+=12*us(l,e);for(const e of r)c+=4*us(l,e);return c}function hs(e){const{annotations:t,context:n,defaultOffset:r=Ja,notePadding:i=es,markPadding:o=ts,edgePadding:a=ns,preserveManualOffsets:s=!0,routeLongConnectors:l=!0,connectorThreshold:c=rs,density:u,progressiveDisclosure:d=!1,redundantCues:h=!1,responsive:f,mobile:p,cohesion:m,audience:g}=e,y=n.width||0,v=n.height||0,b="object"==typeof p?p:{},x=b.breakpoint??480,w=!!p&&x>=y,k=w&&!1!==b.preferShortText?t.map(os):t,S=w&&!u?{maxAnnotations:b.maxAnnotations??("callout-list"===b.strategy?1:2),minVisible:b.minVisible??1}:u,M=d||w&&(!1!==b.progressiveDisclosure||"callout-list"===b.strategy),j=w&&!f?b.responsive??{minWidth:x}:f,A=w&&!m?b.cohesion:m;if(0===k.length||0>=y||0>=v)return k.slice();const C=[],R=function(e,t){return(e.pointNodes||[]).map(e=>{const n=Math.max(1,e.r||1)+t;return{x:e.x-n,y:e.y-n,width:2*n,height:2*n}})}(n,o);let L=!1;const P=k.map((e,t)=>{if(!as(e))return e;const o=function(e,t,n){if("widget"===e.type&&"number"==typeof e.px&&"number"==typeof e.py)return{x:e.px,y:e.py};const r=e.pointId??e.nodeId;if(null!=r&&n.pointNodes){const e=n.pointNodes.find(e=>e.pointId===r);if(e)return{x:e.x,y:e.y}}const i=e.coordinates,o=n.scales?.geoProjection;if(Array.isArray(i)&&i.length>=2&&o){const e=i[0],t=i[1];if("number"==typeof e&&"number"==typeof t){const n=o([e,t]);if(n&&"number"==typeof n[0]&&"number"==typeof n[1])return{x:n[0],y:n[1]}}}return n.scales||"number"!=typeof e.x||"number"!=typeof e.y?ba(e,t,n):{x:e.x,y:e.y}}(e,t,n);if(!o)return e;const u=function(e){if("widget"===e.type)return{width:"number"==typeof e.width?e.width:32,height:"number"==typeof e.height?e.height:32};const t="number"==typeof e.wrap?e.wrap:120,n=[...ss("string"==typeof e.title?e.title:void 0,t),...ss("string"==typeof e.label?e.label:void 0,t)],r=n.reduce((e,t)=>Math.max(e,t.length),0);return{width:Math.max(24,Math.min(t,7*r)+10),height:Math.max(18,16*n.length+6)}}(e);if(s&&("number"==typeof(d=e).dx||"number"==typeof d.dy)){const t=function(e){return"text"===e.type||"widget"===e.type?{dx:0,dy:0}:{dx:30,dy:-30}}(e);return C.push(cs(ls(o.x,o.y,"number"==typeof e.dx?e.dx:t.dx,"number"==typeof e.dy?e.dy:t.dy,u),i)),e}var d;let h=null,f=1/0;for(const e of function(e){const t=1.6*e;return[{dx:e,dy:-e},{dx:-e,dy:-e},{dx:e,dy:e},{dx:-e,dy:e},{dx:e,dy:0},{dx:-e,dy:0},{dx:0,dy:-e},{dx:0,dy:e},{dx:t,dy:-t},{dx:-t,dy:-t},{dx:t,dy:t},{dx:-t,dy:t}]}(r)){const t=ds(ls(o.x,o.y,e.dx,e.dy,u),e,C,R,y,v,i,a);f>t&&(h=e,f=t)}if(!h)return e;const p=cs(ls(o.x,o.y,h.dx,h.dy,u),i);C.push(p);const m=Math.hypot(h.dx,h.dy),g=l&&m>=c&&"text"!==e.type&&"widget"!==e.type?{...e.connector||{end:"arrow"},type:"curve"}:e.connector;return L=!0,{...e,dx:h.dx,dy:h.dy,...g?{connector:g}:{}}}),N=L?P:k.slice();let E=N;if(h){let e=!1;const t=N.map(t=>{const n=function(e){return"text"!==e.type||"string"!=typeof e.color||8>Math.hypot("number"==typeof e.dx?e.dx:0,"number"==typeof e.dy?e.dy:0)?e:{...e,_redundantConnector:!0}}(t);return n!==t&&(e=!0),n});E=e?t:N}{let e=!1;const t=E.map(t=>{if(!0!==t?.defensive)return t;const n=function(e){const t=e?.provenance;if(!t||"object"!=typeof t)return e;const n="string"==typeof t.source?Object.prototype.hasOwnProperty.call(is,t.source)?is[t.source]:t.source:null,r="number"==typeof t.confidence&&Number.isFinite(t.confidence)?Math.round(100*Math.max(0,Math.min(1,t.confidence)))+"%":null;if(!n&&!r)return e;if(null!=e.label&&"string"!=typeof e.label)return e;const i=[n,r].filter(Boolean).join(" · "),o="string"==typeof e.label?e.label:"";return o.includes(`(${i})`)?e:{...e,label:o?`${o} (${i})`:`(${i})`}}(t);return n!==t&&(e=!0),n});E=e?t:E}const I=new Set;if(S){const e="object"==typeof S?S:{},t=function(e){if(!e)return 1;const t=function(e){const t=e?.familiarity;if(!t)return 3;const n=Object.values(t).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0===n.length?3:n.reduce((e,t)=>e+t,0)/n.length}(e);return t>2?4>t?1:.6:1.5}(g),n=1===t?e:{...e,maxAnnotations:Math.max(0,Math.round((e.maxAnnotations??Ka(y,v,e))*t))},{deferred:r}=function(e){const{annotations:t,width:n,height:r}=e,i=Math.max(0,e.minVisible??1),o=Ka(n,r,e),a=t.map((e,t)=>{return{annotation:e,index:t,note:(n=e,Xa(n))};var n}),s=a.filter(e=>e.note);if(0===s.length||o>=s.length)return{visible:t.slice(),deferred:[],budget:o};const l=s.filter(e=>Za(e.annotation)),c=s.filter(e=>!Za(e.annotation)).sort((e,t)=>Qa(t.annotation)-Qa(e.annotation)||e.index-t.index),u=Math.min(c.length,Math.max(Math.max(0,o-l.length),Math.max(0,i-l.length))),d=new Set([...l.map(e=>e.index),...c.slice(0,u).map(e=>e.index)]),h=[],f=[];for(const{annotation:e,index:t,note:n}of a)!n||d.has(t)?h.push(e):f.push(e);return{visible:h,deferred:f,budget:o}}({annotations:E,width:y,height:v,...n});for(const e of r)I.add(e)}if(j&&("object"==typeof j&&"number"==typeof j.minWidth?j.minWidth:480)>=y)for(const e of E)as(e)&&"secondary"===e.emphasis&&I.add(e);if(I.size>0)for(const e of E)!0===e?.defensive&&I.delete(e);let T;return T=0===I.size?E:M?E.map(e=>I.has(e)?{...e,_annotationDeferred:!0}:e):E.filter(e=>!I.has(e)),A?function(e,t){let n=!1;const r=e.map(e=>as(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(n=!0,{...e,cohesion:t}):e);return n?r:e}(T,A):T}var fs=d(require("react")),ps=d(require("react")),ms=require("react/jsx-runtime");function gs({config:e,orientation:t="vertical",width:n=100,customClickBehavior:r,customHoverBehavior:i,highlightedCategory:o,isolatedCategories:a,legendInteraction:s}){const{colorFn:l,domain:c,label:u,format:d}=e,h=d||(e=>Math.round(100*e)/100+""),f="grad-legend-"+ps.useId(),p=!(!r&&!i),m="isolate"===s||void 0===s&&null!=a,[g,y]=ps.useState(0),[v,b]=ps.useState(null),x=ps.useRef([]),w=(e,t=!1)=>{const n=t?5-e-1:e,r=c[0]+n/5*(c[1]-c[0]),i=c[0]+(n+1)/5*(c[1]-c[0]);return{label:`${h(r)} – ${h(i)}`,valueRange:[r,i],interactionKey:`${r}:${i}`}},k=(e,n,s)=>{const l="string"==typeof e.interactionKey?e.interactionKey:e.label,c=a?.has(l)??!1,u=o===l,d=v===s,h=e=>{const t=(e+5)%5;y(t),x.current[t]?.focus()};return(0,ms.jsx)("rect",{ref:e=>{x.current[s]=e},className:"semiotic-gradient-legend-bin",...n,fill:a?.size&&!c||null!=o&&!u?"rgba(255,255,255,0.65)":"transparent",stroke:d||c||u?"var(--semiotic-focus, #005fcc)":"transparent",strokeWidth:d?3:2,tabIndex:s===g?0:-1,role:"option","aria-label":e.label,"aria-selected":m?c:void 0,"aria-current":!(m||!u)||void 0,onClick:r?()=>r(e):void 0,onMouseEnter:i?()=>i(e):void 0,onMouseLeave:i?()=>i(null):void 0,onFocus:()=>{y(s),b(s),i?.(e)},onBlur:()=>{b(null),i?.(null)},onKeyDown:n=>{if(("Enter"===n.key||" "===n.key)&&r)return n.preventDefault(),void r(e);const i="horizontal"===t?"ArrowRight":"ArrowDown";n.key===("horizontal"===t?"ArrowLeft":"ArrowUp")||n.key===i?(n.preventDefault(),h(s+(n.key===i?1:-1))):"Home"!==n.key&&"End"!==n.key||(n.preventDefault(),h("Home"===n.key?0:4))},style:{cursor:"pointer",pointerEvents:"all"}},"gradient-interaction-"+s)},S="horizontal"===t,M=[];for(let e=0;64>=e;e++){const t=e/64;M.push((0,ms.jsx)("stop",{offset:100*t+"%",stopColor:l(S?c[0]+t*(c[1]-c[0]):c[1]-t*(c[1]-c[0]))},e))}if(S){const e=12,t=Math.min(n,200),r=Math.max(0,(n-t)/2),i=u?18:0;return(0,ms.jsxs)("g",{"aria-label":u||"Gradient legend",role:p?"listbox":void 0,"aria-orientation":p?"horizontal":void 0,"aria-multiselectable":!(!p||!m)||void 0,style:{fontFamily:"var(--semiotic-legend-font-family, var(--semiotic-font-family, sans-serif))",fontWeight:"var(--semiotic-legend-font-weight, normal)"},children:[(0,ms.jsx)("defs",{children:(0,ms.jsx)("linearGradient",{id:f,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:M})}),u&&(0,ms.jsx)("text",{x:r+t/2,y:12,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:u}),(0,ms.jsx)("rect",{x:r,y:i,width:t,height:e,fill:`url(#${f})`,rx:2}),p&&Array.from({length:5},(n,o)=>k(w(o),{x:r+o*t/5,y:i,width:t/5,height:e},o)),(0,ms.jsx)("text",{x:r,y:i+e+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:h(c[0])}),(0,ms.jsx)("text",{x:r+t,y:i+e+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:h(c[1])})]})}const j=u?18:0;return(0,ms.jsxs)("g",{"aria-label":u||"Gradient legend",role:p?"listbox":void 0,"aria-orientation":p?"vertical":void 0,"aria-multiselectable":!(!p||!m)||void 0,style:{fontFamily:"var(--semiotic-legend-font-family, var(--semiotic-font-family, sans-serif))",fontWeight:"var(--semiotic-legend-font-weight, normal)"},children:[u&&(0,ms.jsx)("text",{x:0,y:12,textAnchor:"start",fontSize:11,fill:"var(--semiotic-text, #333)",children:u}),(0,ms.jsx)("defs",{children:(0,ms.jsx)("linearGradient",{id:f,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:M})}),(0,ms.jsx)("rect",{x:0,y:j,width:14,height:100,fill:`url(#${f})`,rx:2}),p&&Array.from({length:5},(e,t)=>k(w(t,!0),{x:0,y:j+100*t/5,width:14,height:20},t)),(0,ms.jsx)("text",{x:19,y:j+10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:h(c[1])}),(0,ms.jsx)("text",{x:19,y:j+100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:h(c[0])})]})}var ys=require("react/jsx-runtime"),vs={fill:(e,t)=>(0,ys.jsx)("rect",{style:e,width:t,height:t}),line:(e,t)=>(0,ys.jsx)("line",{style:e,x1:0,y1:0,x2:t,y2:t})};function bs(e,t,n,r,i){let o;return o="function"==typeof n?n(e):(0,vs[n])(r(e,t),i),o}function xs({swatchSize:e}){return(0,ys.jsx)("path",{d:`M${.25*e},${.55*e} L${.45*e},${.75*e} L${.8*e},${.3*e}`,fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function ws(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}function ks(e,t,n,r,i,o){const{legendGroup:{type:a="fill",styleFn:s,items:l},customClickBehavior:c,customHoverBehavior:u,highlightedCategory:d,isolatedCategories:h,focusedGroupIndex:f,focusedItemIndex:p,groupIndex:m,onFocusedIndexChange:g,interactive:y,useIsolateAria:v,metrics:{swatchSize:b,labelGap:x}}=e,w=!!h?.size&&h.has(t.label);return(0,ys.jsxs)("g",{transform:r,onClick:c?()=>c(t):void 0,onMouseEnter:u?()=>u(t):void 0,onMouseLeave:u?()=>u(null):void 0,tabIndex:y?m===f&&n===p?0:-1:void 0,role:y?"option":void 0,"aria-selected":y&&v?w:void 0,"aria-current":!(!y||v||null==d||t.label!==d)||void 0,"aria-label":t.label,onKeyDown:y?e=>{if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),c?.(t)),e.key===i||e.key===o){e.preventDefault();const t=(n+(e.key===o?1:-1)+l.length)%l.length;g(m,t);const r=e.currentTarget.parentElement?.children[t];r instanceof SVGElement&&r.focus()}}:void 0,onFocus:y?e=>{g(m,n),u?.(t),e.currentTarget.querySelector(".semiotic-legend-focus-ring")?.setAttribute("visibility","visible")}:void 0,onBlur:y?e=>{u?.(null),e.currentTarget.querySelector(".semiotic-legend-focus-ring")?.setAttribute("visibility","hidden")}:void 0,style:{cursor:y?"pointer":"default",opacity:ws(t,d,h),transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[y&&(0,ys.jsx)("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:b+x+2+7*t.label.length,height:b+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),bs(t,n,a,s,b),w&&(0,ys.jsx)(xs,{swatchSize:b}),(0,ys.jsx)("text",{y:b/2,x:b+x,dominantBaseline:"central",fontSize:12,style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label})]},"legend-item-"+n)}var Ss=(e,t,n,r,i,o,a,s,l,c,u)=>{const{items:d}=e,h=[];let f=0;const p={legendGroup:e,customClickBehavior:t,customHoverBehavior:n,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:o,focusedItemIndex:a,groupIndex:s,onFocusedIndexChange:l,interactive:!(!t&&!n),useIsolateAria:"isolate"===c||void 0===c&&null!=i,metrics:u};return d.forEach((e,t)=>{h.push(ks(p,e,t,`translate(0,${f})`,"ArrowUp","ArrowDown")),f+=u.rowHeight}),h};function Ms(e){const{legendGroups:t,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:o,legendInteraction:a,title:s="Legend",width:l=100,height:c=20,orientation:u="vertical",legendLayout:d}=e,h=Wo(d),[f,p]=fs.useState(0),[m,g]=fs.useState(0),y=fs.useCallback((e,t)=>{p(e),g(t)},[]),v="vertical"===u?(({legendGroups:e,width:t,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:o,focusedGroupIndex:a,focusedItemIndex:s,onFocusedIndexChange:l,legendInteraction:c,metrics:u})=>{const d=[],h=function(e,t){let n=24;return e.map(({hasLabel:e,itemCount:r})=>{n+=5;const i=n;let o;n+=8,e&&(n+=16,o=n,n+=8);const a=n;return n+=r*t+8,{lineY:i,labelY:o,itemsY:a,endY:n}})}(e.map(e=>({hasLabel:!!e.label,itemCount:e.items.length})),u.rowHeight);return e.forEach((e,f)=>{const p=h[f];d.push((0,ys.jsx)("line",{stroke:"gray",x1:0,y1:p.lineY,x2:t,y2:p.lineY},"legend-top-line legend-symbol-"+f)),e.label&&null!=p.labelY&&d.push((0,ys.jsx)("text",{y:p.labelY,className:"legend-group-label",fontSize:12,style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label},"legend-text-"+f)),d.push((0,ys.jsx)("g",{className:"legend-item",transform:`translate(0,${p.itemsY})`,children:Ss(e,n,r,i,o,a,s,f,l,c,u)},"legend-group-"+f))}),d})({legendGroups:t||[],width:l,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:o,focusedGroupIndex:f,focusedItemIndex:m,onFocusedIndexChange:y,legendInteraction:a,metrics:h}):(({legendGroups:e,height:t,width:n,customClickBehavior:r,customHoverBehavior:i,highlightedCategory:o,isolatedCategories:a,focusedGroupIndex:s,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u,metrics:d})=>{let h=0;const f=[];e.forEach((e,t)=>{let p=0;e.label&&(p+=16);const m=((e,t,n,r,i,o,a,s,l,c,u,d)=>{const{items:h}=e,f=[],{swatchSize:p,labelGap:m,itemGap:g,rowHeight:y,align:v}=u,b={legendGroup:e,customClickBehavior:t,customHoverBehavior:n,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:o,focusedItemIndex:a,groupIndex:s,onFocusedIndexChange:l,interactive:!(!t&&!n),useIsolateAria:"isolate"===c||void 0===c&&null!=i,metrics:u},x=h.map(e=>p+m+7*e.label.length),w=[];let k=0,S=0;x.forEach((e,t)=>{const n=0===S?e:S+g+e;d&&d>0&&S>0&&n>d?(w.push({start:k,end:t,width:S}),k=t,S=e):S=n}),h.length>0&&w.push({start:k,end:h.length,width:S}),w.forEach((e,t)=>{let n="center"===v?Math.max(0,((d??e.width)-e.width)/2):"end"===v?Math.max(0,(d??e.width)-e.width):0;for(let r=e.start;e.end>r;r++)f.push(ks(b,h[r],r,`translate(${n},${t*y})`,"ArrowLeft","ArrowRight")),n+=x[r]+g});const M=Math.max(0,...w.map(e=>e.width)),j=w.length;return{items:f,offset:M,totalRows:j,totalHeight:j*y}})(e,r,i,o,a,s,l,t,c,u,d,d.maxWidth??n);p+=m.offset+5,f.push({label:e.label,...m,offset:p,totalRows:m.totalRows,totalHeight:m.totalHeight}),h+=p+12});const p=d.maxWidth??n;let m=h>p?0:"center"===d.align?Math.max(0,(p-h)/2):"end"===d.align?Math.max(0,p-h):0;const g=[];return f.forEach((n,r)=>{const i=e[r];i.label&&(g.push((0,ys.jsx)("text",{transform:`translate(${m},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)),m+=16),g.push((0,ys.jsx)("g",{className:"legend-item",transform:`translate(${m},0)`,children:n.items},"legend-group-"+r)),m+=n.offset+5,e[r+1]&&g.push((0,ys.jsx)("line",{stroke:"gray",x1:m,y1:-8,x2:m,y2:(n.totalHeight||t)+0+8},"legend-top-line legend-symbol-"+r)),m+=12}),(0,ys.jsx)("g",{children:g})})({legendGroups:t||[],title:s,height:c,width:l,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:o,focusedGroupIndex:f,focusedItemIndex:m,onFocusedIndexChange:y,legendInteraction:a,metrics:h}),b=!(!n&&!r);return(0,ys.jsxs)("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-legend-font-family, var(--semiotic-font-family, sans-serif))",fontWeight:"var(--semiotic-legend-font-weight, normal)"},children:[void 0!==s&&""!==s&&"vertical"===u&&(0,ys.jsx)("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}),v]})}var js=require("react/jsx-runtime");function As(e){const{legend:t,totalWidth:n,totalHeight:r,margin:i,legendPosition:o="right",legendLayout:a,legendHoverBehavior:s,legendClickBehavior:l,legendHighlightedCategory:c,legendIsolatedCategories:u,legendInteraction:d}=e;if(!t)return null;const{x:h,y:f,width:p}=function(e,t){const n=t.position??"right",r="top"===n||"bottom"===n,i=Math.max(0,t.totalWidth-t.margin.left-t.margin.right),o=Math.max(1,r?t.legendLayout?.maxWidth??i:t.reservedWidth??Co(e,t.legendLayout)),a=Ro(e),s=Lo(t.legendLayout,"left"===n?t.axisChrome?.leftAxis:t.axisChrome?.rightAxis),l=Po(t.legendLayout),c=_o(e,i,t.legendLayout),u=Do(t.axisChrome,t.legendLayout),d=Do(t.axisChrome?.topAxis,t.legendLayout);if("left"===n)return{x:Math.max(l,t.margin.left-s-o-a),y:t.margin.top,width:o,height:c};if("top"===n)return{x:t.margin.left,y:t.margin.top-d-a-c,width:o,height:c};if("bottom"===n){const e=t.totalHeight-t.margin.bottom;return{x:t.margin.left,y:Math.max(e+a,Math.min(e+u+a,t.totalHeight-c)),width:o,height:c}}return{x:Math.min(t.totalWidth-o-l,t.totalWidth-t.margin.right+s+a),y:t.margin.top,width:o,height:c}}(t,{totalWidth:n,totalHeight:r,margin:i,position:o,legendLayout:a,axisChrome:e.axisChrome}),m="top"===o||"bottom"===o;return(0,js.jsx)("g",{transform:`translate(${h}, ${f})`,children:mo(t)?(0,js.jsx)(gs,{config:t.gradient,orientation:m?"horizontal":"vertical",width:p,customHoverBehavior:s,customClickBehavior:l,highlightedCategory:c,isolatedCategories:u,legendInteraction:d}):po(t)?(0,js.jsx)(Ms,{legendGroups:t.legendGroups,title:"",width:p,orientation:m?"horizontal":"vertical",legendLayout:a,customHoverBehavior:s,customClickBehavior:l,highlightedCategory:c,isolatedCategories:u,legendInteraction:d}):t})}var Cs=require("react/jsx-runtime");function Rs({title:e,totalWidth:t,marginTop:n}){return e?"string"!=typeof e?(0,Cs.jsx)("foreignObject",{x:0,y:0,width:t,height:n,children:e}):(0,Cs.jsx)("text",{x:t/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)",fontFamily:"var(--semiotic-title-font-family, var(--semiotic-font-family, sans-serif))",fontWeight:"var(--semiotic-title-font-weight, bold)"},children:e}):null}var Ls=require("react/jsx-runtime");function Ps(e){const{width:t,height:n,totalWidth:r,totalHeight:i,margin:o,showAxes:a,title:s,legend:l,legendHoverBehavior:c,legendClickBehavior:u,legendHighlightedCategory:d,legendIsolatedCategories:h,legendPosition:f,legendLayout:p,foregroundGraphics:m,annotations:g,onAnnotationActivate:y,onObservation:v,chartId:b,chartType:x,autoPlaceAnnotations:w,svgAnnotationRules:k,pointNodes:S,geoProjection:M}=e,j=function(e){const t=(0,Jo.useObservationSelector)(e=>e.pushObservation),n=Qo.useCallback(n=>{e.onObservation?.(n),t?.(n)},[e,t]);return Qo.useMemo(()=>({...e,onObservation:n}),[n,e])}({onAnnotationActivate:y,onObservation:v,chartId:b,chartType:x}),A=(0,ta.useRef)([g?.length??0,new Map]),C=g?.length??0;A.current[0]!==C&&(A.current=[C,new Map]);const R=(0,ta.useMemo)(()=>{if(!g||0===g.length)return null;const e=function(e,t={}){const n=!0===t.showRetractedAnnotations,r=!0===t.showSupersededAnnotations,i=new Set;for(const t of e){const e=t?.lifecycle?.supersedes;e&&"retracted"!==t?.lifecycle?.status&&i.add(e)}return e.filter(e=>{if("retracted"===e?.lifecycle?.status&&!n)return!1;const t=e?.provenance?.stableId;return!(t&&i.has(t)&&!r)})}(g),r=M?e.map(e=>{if(!Array.isArray(e.coordinates)||2>e.coordinates.length)return e;const t=M(Number(e.coordinates[0]),Number(e.coordinates[1]));return t?{...e,x:t[0],y:t[1]}:e}):e,i={scales:{x:e=>Number(e),y:e=>Number(e)},timeAxis:"x",width:t,height:n,frameType:"xy",pointNodes:S,stickyPositionCache:A.current[1]};return function(e,t,n,r){return function(e,t,n,r){const i=[];return e.forEach((e,o)=>{let a;if(n){const i=n(e,o,r);a=null!=i?i:t(e,o,r)}else a=t(e,o,r);a&&i.push({node:a,annotation:e})}),{nodes:Ga(i),renderedAnnotations:i.map(e=>e.annotation)}}(e,t,n,r).nodes}(w?hs({annotations:r,context:i,..."object"==typeof w?w:{}}):r,function(e,t={}){return function(e,n,r){switch(e.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const t=ba(e,n,r);if(!t)return null;const{x:i,y:o}=t;if(!xa(i,o,r))return null;const a="callout"===e.type?"callout-circle":e.type,s="callout-circle"===a?{radius:e.radius??12,radiusPadding:e.radiusPadding}:"callout-rect"===a?{width:e.width,height:e.height}:void 0;return(0,Va.jsx)(ua,{noteData:{x:i,y:o,dx:e.dx??30,dy:e.dy??-30,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:a,...s?{subject:s}:{},connector:e.connector||{end:"arrow"},color:e.color,disable:e.disable,opacity:e.opacity,strokeDasharray:e.strokeDasharray,className:e.className}},"ann-"+n)}case"x-threshold":{const t=ma(null!=e.value?{...e,x:e.value}:e,r);if(null==t)return null;const i=e.color||"#f97316",o=e.labelPosition||"top";let a;a="bottom"===o?(r.height||0)-4:"center"===o?(r.height||0)/2:16;const s=t>.6*(r.width||0),l=s?t-4:t+4,c=s?"end":"start";return(0,Va.jsxs)("g",{opacity:e.opacity,children:[(0,Va.jsx)("line",{x1:t,y1:0,x2:t,y2:r.height||0,stroke:i,strokeWidth:e.strokeWidth??1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,Va.jsx)(Sa,{x:l,y:a,text:e.label,textAnchor:c,fill:i,fontSize:12,fontWeight:"bold",background:e.labelBackground??"halo"})]},"ann-"+n)}case"y-threshold":{const t=ga(null!=e.value?{...e,y:e.value}:e,r);if(null==t)return null;const i=e.color||"#f97316",o=e.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=t)?Math.min((r.height||0)-4,s+16):s-4;return(0,Va.jsxs)("g",{opacity:e.opacity,children:[(0,Va.jsx)("line",{x1:0,y1:t,x2:r.width||0,y2:t,stroke:i,strokeWidth:e.strokeWidth??1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,Va.jsx)(Sa,{x:a,y:c,text:e.label,textAnchor:l,fill:i,fontSize:12,fontWeight:"bold",background:e.labelBackground??"halo"})]},"ann-"+n)}case"enclose":{const t=(e.coordinates||[]).map(e=>({x:ma({...e,type:"point"},r),y:ga({...e,type:"point"},r),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>t.length)return null;const i=(0,da.packEnclose)(t),o=e.padding||10;return(0,Va.jsxs)("g",{children:[(0,Va.jsx)("circle",{cx:i.x,cy:i.y,r:i.r+o,fill:e.fill||"none",fillOpacity:e.fillOpacity??.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&(0,Va.jsx)(Sa,{x:i.x,y:i.y-i.r-o-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:e.label,background:e.labelBackground??"none"})]},"ann-"+n)}case"rect-enclose":{const t=(e.coordinates||[]).map(e=>({x:ma({...e,type:"point"},r),y:ga({...e,type:"point"},r)})).filter(e=>null!=e.x&&null!=e.y);if(2>t.length)return null;const i=e.padding||10,o=t.map(e=>e.x),a=t.map(e=>e.y),[s,l]=oi(o),[c,u]=oi(a),d=s-i,h=l+i,f=c-i;return(0,Va.jsxs)("g",{children:[(0,Va.jsx)("rect",{x:d,y:f,width:h-d,height:u+i-f,fill:e.fill||"none",fillOpacity:e.fillOpacity??.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&(0,Va.jsx)(Sa,{x:(d+h)/2,y:f-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:e.label,background:e.labelBackground??"none"})]},"ann-"+n)}case"highlight":{const t=r.data||[],i="function"==typeof e.filter?t.filter(e.filter):e.field&&null!=e.value?t.filter(t=>t[e.field]===e.value):[],o={stroke:e.color||"#f97316",strokeWidth:2,fill:"none"};return(0,Va.jsx)("g",{children:i.map((t,n)=>{const i=ma(t,r),a=ga(t,r);if(null==i||null==a)return null;const s="function"==typeof e.r?e.r(t):e.r||6,l="function"==typeof e.style?e.style(t):e.style||o;return(0,Va.jsx)("circle",{cx:i,cy:a,r:s,...l},"hl-"+n)})},"ann-"+n)}case"bracket":{const t=ma(e,r),i=ga(e,r);return(0,Va.jsx)(ua,{noteData:{x:t??0,y:i??0,dx:e.dx||0,dy:e.dy||0,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"bracket",subject:{type:e.bracketType||"curly",width:e.width,height:e.height,depth:e.depth||30},color:e.color}},"ann-"+n)}case"trend":{const t=r.data||[];if(2>t.length)return null;const 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 d=[],h=new Map;if(a&&l&&c){for(const e of t){const t=e[l];if(null==t)continue;const n=t+"";h.has(n)||(h.set(n,d.length),d.push(n))}u=t.map(e=>{const t=e[l],n=e[c];if(null==t||null==n)return null;const r=h.get(t+"");return null!=r?[r,+n]:null}).filter(e=>null!==e)}else u=t.map(e=>[e[i],e[o]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>u.length)return null;const f=r.scales?.x??r.scales?.time,p=r.scales?.y??r.scales?.value;if(!f||!p)return null;const m=e=>t=>{const n=Math.max(0,Math.floor(t)),r=Math.min(d.length-1,n+1),i=t-n,o=e(d[n]);return o+(e(d[r])-o)*i},g=f,y=p;let v;if(a)if(s){const e=m(y);v=(t,n)=>[g(n),e(t)]}else{const e=m(g);v=(t,n)=>[e(t),y(n)]}else v=(e,t)=>[g(e),y(t)];const b=e.method||"linear";let x;if("loess"===b)x=function(e,t=.3){const n=e.length;if(2>n)return e.slice();const r=e.slice().sort((e,t)=>e[0]-t[0]),i=r.map(e=>e[0]),o=r.map(e=>e[1]),a=Math.max(2,Math.ceil(t*n)),s=[];for(let e=0;n>e;e++){const t=i[e],r=i.map(e=>Math.abs(e-t)),l=r.slice().sort((e,t)=>e-t)[Math.min(a-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:r[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,f=0,p=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*i[e],h+=t*o[e],f+=t*i[e]*i[e],p+=t*i[e]*o[e])}if(0===u){s.push([t,o[e]]);continue}const m=u*f-d*d;if(1e-12>Math.abs(m))s.push([t,h/u]);else{const e=(u*p-d*h)/m;s.push([t,(h-e*d)/u+e*t])}}return s}(u,e.bandwidth??.3);else{const t="polynomial"===b?pa(u,e.order||2):function(e){const t=[0,0,0,0];let n=0;for(const[r,i]of e)null!==i&&(n++,t[0]+=r,t[1]+=i,t[2]+=r*r,t[3]+=r*i);const r=n*t[2]-t[0]*t[0],i=0===r?0:fa((n*t[3]-t[0]*t[1])/r),o=fa(t[1]/n-i*t[0]/n);return{points:e.map(([e])=>[fa(e),fa(i*e+o)]),equation:[i,o]}}(u);x=t.points}const w=x.map(([e,t])=>{const[n,r]=v(e,t);return`${n},${r}`}).join(" "),k=e.color||"#6366f1",S=x[x.length-1],[M,j]=v(S[0],S[1]);return(0,Va.jsxs)("g",{children:[(0,Va.jsx)("polyline",{points:w,fill:"none",stroke:k,strokeWidth:e.strokeWidth??2,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,Va.jsx)("text",{x:M+4,y:j-4,fill:k,fontSize:11,children:e.label})]},"ann-"+n)}case"band":{const t=r.scales?.y??r.scales?.value,i=t?.domain?.(),s=e.y0??i?.[0],l=e.y1??i?.[1],c=null!=s&&t?t(s):0,u=null!=l&&t?t(l):r.height||0,d=Ia(e,"ann-"+n,"vertical","var(--semiotic-primary, #6366f1)");return(0,Va.jsxs)("g",{opacity:e.opacity,children:[d.def&&(0,Va.jsx)("defs",{children:d.def}),(0,Va.jsx)("rect",{x:0,y:Math.min(c,u),width:r.width||0,height:Math.abs(u-c),fill:d.fill,fillOpacity:e.fillOpacity??.1}),e.label&&(0,Va.jsx)(Sa,{x:(r.width||0)-4,y:(o=c,a=u,Math.max(Math.min(o,a),0)+16),textAnchor:"end",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:e.label,background:e.labelBackground??"halo"})]},"ann-"+n)}case"x-band":{const t=r.scales?.x??r.scales?.time,i=t?.domain?.(),o=e.x0??i?.[0],a=e.x1??i?.[1],s=null!=o&&t?t(o):null,l=null!=a&&t?t(a):null;if(null==s||null==l)return null;const c=Ia(e,"ann-"+n,"horizontal","var(--semiotic-primary, #6366f1)");return(0,Va.jsxs)("g",{opacity:e.opacity,children:[c.def&&(0,Va.jsx)("defs",{children:c.def}),(0,Va.jsx)("rect",{x:Math.min(s,l),y:0,width:Math.abs(l-s),height:r.height||0,fill:c.fill,fillOpacity:e.fillOpacity??.1}),e.label&&(0,Va.jsx)(Sa,{x:Math.min(s,l)+4,y:16,textAnchor:"start",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:e.label,background:e.labelBackground??"halo"})]},"ann-"+n)}case"envelope":{const t=r.data||[];if(2>t.length)return null;const 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=e.upperAccessor||"upperBounds",l=e.lowerAccessor||"lowerBounds",c=e.filter,u=t.filter(e=>null!=e[s]&&null!=e[l]&&!(c&&!c(e))).sort((e,t)=>e[i]-t[i]);if(2>u.length)return null;const d=Ua[r.curve||"linear"]||ha.curveLinear,h=(0,ha.area)().x(e=>o(e[i])).y0(e=>a(e[l])).y1(e=>a(e[s])).curve(d)(u);if(!h)return null;const f=e.fill||"#6366f1";return(0,Va.jsxs)("g",{children:[(0,Va.jsx)("path",{d:h,fill:f,fillOpacity:e.fillOpacity??.15,stroke:"none"}),e.label&&u.length>0&&(0,Va.jsx)("text",{x:o(u[u.length-1][i])+4,y:a(u[u.length-1][s])-4,fill:f,fontSize:11,children:e.label})]},"ann-"+n)}case"anomaly-band":{const t=r.data||[];if(2>t.length)return null;const 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=t.map(e=>e[i]).filter(e=>null!=e&&isFinite(e));if(2>s.length)return null;const l=s.reduce((e,t)=>e+t,0)/s.length,c=s.reduce((e,t)=>e+(t-l)**2,0)/s.length,u=Math.sqrt(c),d=e.threshold??2,h=l-d*u,f=!1!==e.showBand,p=e.fill||"#6366f1",m=e.fillOpacity??.1,g=e.anomalyColor||"#ef4444",y=e.anomalyRadius??6,v=a(l+d*u),b=a(h),x=t.filter(e=>{const t=e[i];return null!=t&&Math.abs(t-l)>d*u});return(0,Va.jsxs)("g",{children:[f&&(0,Va.jsx)("rect",{x:0,y:Math.min(v,b),width:r.width||0,height:Math.abs(b-v),fill:p,fillOpacity:m}),x.map((e,t)=>{const n=ma(e,r),i=ga(e,r);return null==n||null==i?null:(0,Va.jsx)("circle",{cx:n,cy:i,r:y,fill:g,fillOpacity:.7,stroke:g,strokeWidth:1.5},"anomaly-"+t)}),e.label&&(0,Va.jsx)("text",{x:(r.width||0)-4,y:Math.min(v,b)-4,textAnchor:"end",fill:p,fontSize:11,children:e.label})]},"ann-"+n)}case"forecast":{const t=r.data||[];if(3>t.length)return null;const o=r.xAccessor||"x",a=r.yAccessor||"y",s=r.scales?.x??r.scales?.time,l=r.scales?.y??r.scales?.value;if(!s||!l)return null;const c=t.map(e=>[e[o],e[a]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>c.length)return null;let u;if("polynomial"===(e.method||"linear")){const t=pa(c,e.order||2).equation;u=e=>t.reduce((t,n,r)=>t+n*Math.pow(e,r),0)}else{const e=function(e){const t=e.length;let n=0,r=0,i=0,o=0;for(const[t,a]of e)n+=t,r+=a,i+=t*t,o+=t*a;const a=t*i-n*n;if(1e-12>Math.abs(a))return null;const s=(t*o-n*r)/a,l=(r-s*n)/t;return e=>l+s*e}(c);if(!e)return null;u=e}const d=c.length,{se:h,meanX:f,ssX:p}=function(e,t){const n=e.length,r=e.map(([e,n])=>n-t(e)).reduce((e,t)=>e+t*t,0),i=Math.sqrt(r/Math.max(n-2,1)),o=e.reduce((e,t)=>e+t[0],0)/n,a=e.reduce((e,t)=>e+(t[0]-o)**2,0);return{se:i,meanX:o,ssX:a}}(c,u),m=.99>(i=e.confidence??.95)?.95>i?.9>i?1:1.645:1.96:2.576,g=e.steps??5,y=c[d-1][0],v=(y-c[0][0])/Math.max(d-1,1),b=[];for(let e=1;g>=e;e++)b.push(y+e*v);const x=[];for(const e of b){const t=u(e),n=h*Math.sqrt(1+1/d+(p>0?(e-f)**2/p:0))*m;x.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const w=`M${x.map(e=>`${s(e.x)},${l(e.yUpper)}`).join(" L")} L${x.slice().reverse().map(e=>`${s(e.x)},${l(e.yLower)}`).join(" L")} Z`,k=x.map(e=>`${s(e.x)},${l(e.yCenter)}`).join(" "),S=`${s(y)},${l(u(y))}`,M=e.strokeColor||"#6366f1";return(0,Va.jsxs)("g",{children:[(0,Va.jsx)("path",{d:w,fill:e.fill||"#6366f1",fillOpacity:e.fillOpacity??.15,stroke:"none"}),(0,Va.jsx)("polyline",{points:`${S} ${k}`,fill:"none",stroke:M,strokeWidth:e.strokeWidth??2,strokeDasharray:e.strokeDasharray??"6,3"}),e.label&&x.length>0&&(0,Va.jsx)("text",{x:s(x[x.length-1].x)+4,y:l(x[x.length-1].yCenter)-4,fill:M,fontSize:11,children:e.label})]},"ann-"+n)}case"widget":{let i,o;if(null!=e.px&&null!=e.py)i=e.px,o=e.py;else{const t=ba(e,n,r);if(!t)return null;i=t.x,o=t.y}if(!xa(i,o,r))return null;const a=e.dx??0,s=e.dy??0,l=e.width??32,c=e.height??32,u=e.content??(0,Va.jsx)("span",{style:{fontSize:18,cursor:"default"},title:e.label||"Info",children:"ℹ️"});return(0,Va.jsx)("foreignObject",{x:i+a-l/2,y:o+s-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:(0,Va.jsx)("div",{...ea(e,t),style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+n)}case"text":{const t=ba(e,n,r);if(!t)return null;const{x:i,y:o}=t,a=i+(e.dx||0),s=o+(e.dy||0),l=e.color||"var(--semiotic-text, #333)",c=(0,Va.jsx)("text",{x:a,y:s,fill:l,fontSize:e.fontSize||11,opacity:e.opacity,strokeDasharray:e.strokeDasharray,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:e.label});return!0!==e._redundantConnector?na.cloneElement(c,{key:"ann-text-"+n}):(0,Va.jsxs)("g",{opacity:e.opacity,strokeDasharray:e.strokeDasharray,children:[(0,Va.jsx)("line",{x1:i,y1:o,x2:a,y2:s,stroke:l,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),na.cloneElement(c,{opacity:void 0,strokeDasharray:void 0})]},"ann-text-"+n)}case"frame-text":return(0,Va.jsx)(Oa,{annotation:e,width:r.width||0,height:r.height||0},"ann-frame-text-"+n);case"category-highlight":{const t=e.category;if(null==t)return null;const i=e=>"function"==typeof e&&"function"==typeof e.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(t+"");if(null==c)return null;const u=l.bandwidth(),d=e.color||"var(--semiotic-primary, #4589ff)",h=e.opacity??.15,f=e.label;return(0,Va.jsxs)("g",(r.projection?"vertical"===r.projection:l===a)?{children:[(0,Va.jsx)("rect",{x:c,y:0,width:u,height:r.height||0,fill:d,fillOpacity:h}),f&&(0,Va.jsx)(Sa,{x:c+u/2,y:16,textAnchor:"middle",fill:d,fontSize:12,fontWeight:"bold",text:f,background:e.labelBackground??"none"})]}:{children:[(0,Va.jsx)("rect",{x:0,y:c,width:r.width||0,height:u,fill:d,fillOpacity:h}),f&&(0,Va.jsx)(Sa,{x:12,y:c+u/2,dominantBaseline:"middle",fill:d,fontSize:12,fontWeight:"bold",text:f,background:e.labelBackground??"none"})]},"ann-"+n)}default:return null}var i,o,a,s}}(0,j),k,i)},[g,w,k,t,n,S,j,M]);return a||s||l||m||R&&R.length>0?(0,Ls.jsxs)("svg",{role:"img",width:r,height:i,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[(0,Ls.jsx)("title",{children:"string"==typeof s?s:"XY Chart"}),(0,Ls.jsx)("desc",{children:"string"==typeof s?s+" (XY data visualization)":"XY data visualization"}),(0,Ls.jsxs)("g",{transform:"translate("+o.left+","+o.top+")",children:[R,m]}),(0,Ls.jsx)(Rs,{title:s,totalWidth:r,marginTop:o.top}),As({legend:l,totalWidth:r,totalHeight:i,margin:o,legendPosition:f,title:s,legendLayout:p,legendHoverBehavior:c,legendClickBehavior:u,legendHighlightedCategory:d,legendIsolatedCategories:h})]}):null}d(require("react")),require("d3-shape");var Ns=require("d3-shape");function Es(e){switch(e){case"monotoneX":return Ns.curveMonotoneX;case"monotoneY":return Ns.curveMonotoneY;case"cardinal":return Ns.curveCardinal;case"catmullRom":return Ns.curveCatmullRom;case"step":return Ns.curveStep;case"stepBefore":return Ns.curveStepBefore;case"stepAfter":return Ns.curveStepAfter;case"basis":return Ns.curveBasis;case"natural":return Ns.curveNatural;default:return null}}function Is(e,t,n){if(null==t)return n;if(Ca(t)){const r=function(e,t){const n=e.background??"transparent",r=e.stroke??"#000",i="transparent"===n||"none"===n?n:so(t,n)||n,o=so(t,r)||r||"#000",a="undefined"!=typeof window&&window.devicePixelRatio||1,s=`${Ra(e)}|${i}|${o}@${a}`,l=Pa.get(s);if(void 0!==l)return l;const c=function(e={},t){const{background:n="transparent",stroke:r="#000",lineWidth:i=1.5,spacing:o=6,angle:a=45}=e,s={background:n,stroke:r,lineWidth:i,spacing:o,angle:a},l=Math.max(8,Math.ceil(2*o));let c;try{c=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(ja||(ja=document.createElement("canvas")),ja.width=e,ja.height=e,ja)}(l)}catch{return Ma(s)}const u=c.getContext("2d");if(!u)return Ma(s);n&&"transparent"!==n?(u.fillStyle=n,u.fillRect(0,0,l,l)):u.clearRect(0,0,l,l),u.strokeStyle=r,u.lineWidth=i,u.lineCap="square";const d=a*Math.PI/180;if(45===a||-45===a){const e=a>0?1:-1;for(let t=-l;2*l>=t;t+=o)u.beginPath(),u.moveTo(t,0),u.lineTo(t+e*l,l),u.stroke()}else{u.save(),u.translate(l/2,l/2),u.rotate(d);const e=2*l;for(let t=-e;e>=t;t+=o)u.beginPath(),u.moveTo(-e,t),u.lineTo(e,t),u.stroke();u.restore()}return(t||u).createPattern(c,"repeat")}({background:i,stroke:o,lineWidth:e.lineWidth,spacing:e.spacing,angle:e.angle},t),u=Ca(c)?null:c;return Pa.set(s,u),u}(t,e);return r||t.background&&so(e,t.background)||n}return"string"!=typeof t?t:so(e,t)||n}function Ts(e,t){if(null==t)return;const n=Is(e,t,"");return""===n?void 0:n}function zs(e,t,n,r,i,o,a){const s=t.stops.filter(e=>Number.isFinite(e.offset)&&(null==e.opacity||Number.isFinite(e.opacity)));if(2>s.length)return null;const l=e.createLinearGradient(r,i,o,a);for(const t of s)l.addColorStop(Math.max(0,Math.min(1,t.offset)),Ds(e,t,n));return l}function Ds(e,t,n){const r=t.color??n,i=so(e,r)||r;if(null==t.opacity)return i;const o=Math.max(0,Math.min(1,t.opacity)),[a,s,l]=function(e,t){const n=e.fillStyle,r="#010203";try{e.fillStyle=r,e.fillStyle=t}catch{return e.fillStyle=n,[78,121,167]}const i=e.fillStyle;if(e.fillStyle=n,"string"!=typeof i)return[78,121,167];if(i.toLowerCase()===r&&t.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]}(e,i);return`rgba(${a},${s},${l},${o})`}function _s(e,t,n){let r=n;for(const n of t)"lesser"===n.thresholdType?n.value>e&&(r=n.color):e>n.value&&(r=n.color);return r}function Os(e,t,n,r){if(2>e.length||t.length!==e.length||0===n.length)return[];const i=[],o=(e,t,n)=>{const r=i[i.length-1];r?.color===e?r.path.push(n):i.push({color:e,path:[t,n]})};for(let i=1;e.length>i;i++){const[a,s]=e[i-1],[l,c]=e[i],u=t[i-1],d=t[i]-u,h=[0,...0===d?[]:n.map(({value:e})=>(e-u)/d).filter(e=>e>0&&1>e&&Number.isFinite(e)).sort((e,t)=>e-t).filter((e,t,n)=>0===t||e!==n[t-1]),1];for(let e=1;h.length>e;e++){const t=h[e-1],i=h[e];o(_s(u+d*((t+i)/2),n,r),[a+(l-a)*t,s+(c-s)*t],[a+(l-a)*i,s+(c-s)*i])}}return i}var Fs=require("react/jsx-runtime");function Ws(e,t="#4e79a7"){return Ca(e)?e.background&&"transparent"!==e.background?e.background:t:e&&"string"==typeof e?e:t}var Bs=d(require("react")),Hs=require("react/jsx-runtime");function $s(e){if(!1!==e?.interactive)return e?.style?.cursor}function qs(e,t){if(!e)return;const n=t??"";e.style.cursor!==n&&(e.style.cursor=n)}function Gs(e,t,n){const r=$s(t);return r&&null!=e&&!1!==e?(0,Hs.jsx)("g",{style:{cursor:r},"data-semiotic-mark-cursor":r,children:e},n):e}var Vs=d(require("react")),Us=require("react/jsx-runtime");require("react/jsx-runtime");var Ys="undefined"==typeof window||"undefined"==typeof document,Xs=require("react"),Zs="undefined"!=typeof window?Xs.useLayoutEffect:Xs.useEffect,Ks=()=>()=>{},Qs=()=>!1,Js=()=>!0,el=require("react");function tl(e,t,n,r){const i=e.getContext("2d");if(!i)return null;const{effectiveDprX:o,effectiveDprY:a}=function(e,t,n){const r=Math.round(t[0]*n),i=Math.round(t[1]*n),o=0===t[0]?n:r/t[0],a=0===t[1]?n:i/t[1],s=t[0]+"px",l=t[1]+"px";return e.style.width!==s&&(e.style.width=s),e.style.height!==l&&(e.style.height=l),e.width!==r&&(e.width=r),e.height!==i&&(e.height=i),{effectiveDprX:o,effectiveDprY:a}}(e,t,r);return i.setTransform(o,0,0,a,0,0),i.translate(n.left,n.top),i}function nl(e){if("undefined"==typeof window)return 1;const t=window.devicePixelRatio||1,n=function(){if("undefined"==typeof window)return!1;const e="function"==typeof window.matchMedia&&window.matchMedia("(pointer: coarse)").matches,t=768>Math.min(window.innerWidth||1/0,window.innerHeight||1/0);return e||t}()?2:3;return Math.max(1,Math.min(t,"number"==typeof e&&e>0?e:n))}var rl=require("react/jsx-runtime");function il(e){const{cancelRender:t,dirtyRef:n,frameRuntime:r,manageFrameRuntime:i,maxDevicePixelRatio:o,scheduleRender:a}=e,s=(0,el.useRef)(null),l=(0,el.useRef)(null),c=(0,el.useRef)(!1),u=(0,el.useRef)(!1),d=(0,el.useRef)(!1);return function(e){const{hydrated:t,wasHydratingFromSSR:n,storeRef:r,dirtyRef:i,renderFnRef:o,cancelRender:a,cleanup:s}=e;Zs(()=>{const e=r.current;t&&n&&e?.cancelIntroAnimation?.(),!n&&e?.sceneNodes&&e.sceneNodes.length>0&&e?.markStylePaintPending?e.markStylePaintPending():i.current=!0,a?.(),o.current()},[t,n]);const l=(0,Xs.useRef)(s);l.current=s,(0,Xs.useEffect)(()=>()=>l.current?.(),[])}({hydrated:e.hydrated,wasHydratingFromSSR:e.wasHydratingFromSSR,storeRef:e.storeRef,dirtyRef:e.dirtyRef,renderFnRef:e.renderFnRef,cancelRender:e.cancelRender,cleanup:e.cleanup}),(0,el.useEffect)(()=>{if(!1!==i)return r.subscribe(()=>{r.isActive?(n.current=!0,a()):t()})},[t,n,r,i,a]),(0,el.useEffect)(()=>function(){if("undefined"==typeof window||"function"!=typeof window.matchMedia)return()=>{};let e=null,t=!1;const n=()=>{e&&("function"==typeof e.removeEventListener?e.removeEventListener("change",i):"function"==typeof e.removeListener&&e.removeListener(i))},r=()=>{const t=`(resolution: ${window.devicePixelRatio||1}dppx)`;e=window.matchMedia(t),e.media.includes("resolution")?"function"==typeof e.addEventListener?e.addEventListener("change",i):"function"==typeof e.addListener&&e.addListener(i):e=null};function i(){t||(n(),e=null,c.current=!0,a(),queueMicrotask(()=>{t||r()}))}return r(),()=>{t=!0,n(),e=null}}(),[a]),(0,el.useEffect)(()=>{d.current?(c.current=!0,a()):d.current=!0},[o,a]),(0,el.useEffect)(()=>{!u.current&&(u.current=!0,e.skipInitialCanvasPaintInvalidation)||(e.canvasPaintInvalidator?e.canvasPaintInvalidator():e.dirtyRef.current=!0,e.scheduleRender())},e.canvasPaintDependencies),{canvasRef:s,interactionCanvasRef:l,resolutionDirtyRef:c}}function ol({children:e,size:t,margin:n,backdropFill:r,overflowVisible:i=!1}){return e||r?(0,rl.jsxs)("svg",{style:{position:"absolute",left:0,top:0,width:t[0],height:t[1],pointerEvents:"none",overflow:i?"visible":void 0},children:[r&&"transparent"!==r?(0,rl.jsx)("rect",{className:"stream-frame-background__backdrop",x:0,y:0,width:t[0],height:t[1],fill:r}):null,(0,rl.jsx)("g",{transform:`translate(${n.left},${n.top})`,children:e})]}):null}var al=require("react");function sl(e,t){const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const r of n){if(!Object.prototype.hasOwnProperty.call(t,r))return!1;if(!Object.is(e[r],t[r]))return!1}return!0}function ll(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(!Object.is(e[n],t[n]))return!1;return!0}function cl(e){if(null===e||"object"!=typeof e)return!1;if(Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}function ul(e){const{background:t,hasBackgroundGraphics:n=!1,themeBackground:r=""}=e;return"transparent"===t?null:n?t||null:t||(r&&"transparent"!==r?r:"")||null}var dl=d(require("react")),hl=d(require("react")),fl=(require("react/jsx-runtime"),hl.createContext(null)),pl=require("react/jsx-runtime"),ml={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function gl({hoverPoint:e}){let t="";if(e){const n=e.data||e;t="object"==typeof n?"Data point: "+Object.entries(n).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Data point: "+n}return(0,pl.jsx)("div",{"aria-live":"polite","aria-atomic":"true",style:ml,children:t})}function yl(e){const t={};if(null==e||"object"!=typeof e)return t;for(const[n,r]of Object.entries(e))n.startsWith("_")||null!=r&&""!==r&&("number"==typeof r?Number.isFinite(r)&&(t[n]=r):"string"==typeof r?t[n]=r:"boolean"==typeof r?t[n]=r+"":r instanceof Date&&(t[n]=r.toISOString().slice(0,10)));return t}function vl(e){return e&&"object"==typeof e?e:{}}function bl(e){return vl(e.accessibility).tableFields??e.accessibleDatum??e.datum}var xl=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},wl=require("react/jsx-runtime"),kl=dl.lazy(()=>Promise.resolve().then(()=>(v(),h)));function Sl({accessibleTable:e,children:t}){return"object"!=typeof e?t:"undefined"==typeof document?null:(0,wl.jsx)(dl.Suspense,{fallback:null,children:(0,wl.jsx)(kl,{target:e.portalTarget,children:t})})}function Ml(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e){if(null===t?.datum)continue;const e=t.type+"";n[e]=(n[e]||0)+1}if(0===Object.keys(n).length)return t+", empty";const 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((e,t)=>{const n=o.indexOf(e),r=o.indexOf(t);return(-1===n?999:n)-(-1===r?999:r)});for(const e of a)r.push(`${n[e]} ${i[e]||e}`);return`${t}, ${r.join(", ")}`}var jl="semiotic-accessible-data-table",Al=jl+" semiotic-accessible-data-table-hidden",Cl=jl+" semiotic-accessible-data-table-visible",Rl={boxSizing:"border-box",maxWidth:"100%",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},Ll={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"},Pl={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},Nl={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)"},El={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},Il={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))"},Tl={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},zl={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},Dl={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 _l({scene:e,chartType:t,tableId:n,chartTitle:r}){const[i,o]=dl.useState(!1),[a,s]=dl.useState(5),l=hl.useContext(fl),c=l?.visible??!1,u=i||c,d=dl.useRef(null),h=r?"Data summary for "+r:n?`Data summary for ${t} ${n}`:"Data summary for "+t;dl.useEffect(()=>{u||s(5)},[u]);const f=dl.useCallback(e=>{e.target===e.currentTarget&&(i||c||o(!0))},[i,c]),p=dl.useCallback(e=>{c||d.current?.contains(e.relatedTarget)||o(!1)},[c]);if(!e||0===e.length)return n?(0,wl.jsx)("span",{id:n,tabIndex:-1,style:ml}):null;if(!u)return(0,wl.jsx)("div",{id:n,className:Al,tabIndex:-1,onFocus:f,style:ml,role:"region","aria-label":h,children:(0,wl.jsxs)("button",{type:"button",onClick:()=>o(!0),style:Rl,children:["View data summary (",e.length," elements)"]})});const m=function(e){const t=[];if(!Array.isArray(e))return t;const n=e.some(e=>e&&("line"===e.type||"area"===e.type));for(const r of e)if(r&&"object"==typeof r&&null!==r.datum)try{switch(r.type){case"point":if(n)break;t.push({label:"Point",values:yl(bl(r))});break;case"line":case"area":{const e=bl(r),n=Array.isArray(e)?e:[],i="line"===r.type?"Line point":"Area point";for(const e of n)t.push({label:i,values:yl(e)});break}case"rect":{const e=bl(r),n=null!=e&&"object"==typeof e?e:{},i=n.category??r.group??"",o=n.value??n.__aggregateValue??n.total,a=yl(n);null==a.category&&""!==i&&(a.category=i+""),null==a.value&&null!=o&&(a.value="number"==typeof o||"string"==typeof o?o:o+""),t.push({label:"Bar",values:a});break}case"heatcell":{const e=yl(bl(r));null==e.value&&"number"==typeof r.value&&Number.isFinite(r.value)&&(e.value=r.value),t.push({label:"Cell",values:e});break}case"wedge":{const e=bl(r),n=yl(e);if(null==n.category){const t=vl(e),r=t.category??t.label;null!=r&&(n.category=r+"")}t.push({label:"Wedge",values:n});break}case"circle":t.push({label:"Node",values:yl(bl(r))});break;case"arc":t.push({label:"Arc",values:yl(bl(r))});break;case"candlestick":t.push({label:"Candlestick",values:yl(bl(r))});break;case"geoarea":{const e=vl(bl(r)),n=yl(e);if(null==n.name){const t=vl(e.properties).name??e.name;null!=t&&(n.name=t+"")}t.push({label:"Region",values:n});break}}}catch{}return t}(e),g=function(e){const t=new Map;for(const n of e??[])for(const[e,r]of Object.entries(n?.values??{})){if(null==r||""===r)continue;let n=t.get(e);if(n||(n={count:0,min:1/0,max:-1/0,sum:0,strings:new Set},t.set(e,n)),"number"==typeof r){if(!Number.isFinite(r))continue;n.count++,n.sum+=r,n.min>r&&(n.min=r),r>n.max&&(n.max=r)}else"object"!=typeof r&&"function"!=typeof r&&n.strings.add(r+"")}return Array.from(t,([e,t])=>{if(t.count)return{name:e,count:t.count,numeric:!0,min:t.min,max:t.max,mean:t.sum/t.count};const n=Array.from(t.strings);return{name:e,count:n.length,numeric:!1,uniqueValues:n.slice(0,5)}}).filter(e=>e.count>0)}(m),y=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${xl(e.min)} to ${xl(e.max)}, mean ${xl(e.mean)}.`);else{const t=e.uniqueValues,r=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${r}.`)}return n.join(" ")}(m.length,g),v=Math.min(a,m.length),b=m.slice(0,v),x=m.length-v,w=new Set;for(const e of b)for(const t of Object.keys(e.values))w.add(t);const k=Array.from(w);return(0,wl.jsxs)("div",{ref:d,id:n,className:Cl,tabIndex:-1,onBlur:p,style:Ll,role:"region","aria-label":h,children:[(0,wl.jsx)("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{c&&l&&l.setVisible(!1),o(!1)},"aria-label":"Close data summary",style:Nl,children:"×"}),(0,wl.jsx)("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:Pl,children:y}),(0,wl.jsxs)("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+t,style:El,children:[(0,wl.jsx)("caption",{className:"semiotic-accessible-data-table-caption",style:zl,children:x>0?`First ${v} of ${m.length} data points`:`All ${m.length} data points`}),(0,wl.jsx)("thead",{children:(0,wl.jsxs)("tr",{children:[(0,wl.jsx)("th",{style:Il,children:"type"}),k.map(e=>(0,wl.jsx)("th",{style:Il,children:e},e))]})}),(0,wl.jsx)("tbody",{children:b.map((e,t)=>(0,wl.jsxs)("tr",{children:[(0,wl.jsx)("td",{style:Tl,children:e.label}),k.map(t=>{return(0,wl.jsx)("td",{style:Tl,children:(n=e.values[t],null==n||""===n?"—":"number"==typeof n?Number.isNaN(n)?"—":xl(n):"boolean"==typeof n?n?"true":"false":"object"==typeof n?"—":n+"")},t);var n})]},t))})]}),x>0&&(0,wl.jsxs)("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>s(e=>e+25),style:Dl,children:["Show ",Math.min(25,x)," more"," ",1===x?"row":"rows"," (",x," remaining)"]})]})}function Ol({summary:e}){return e?(0,wl.jsx)("div",{role:"note",style:ml,children:e}):null}function Fl({tableId:e}){return(0,wl.jsx)("a",{href:"#"+e,style:ml,onClick:t=>{t.preventDefault();const n=document.getElementById(e);n&&requestAnimationFrame(()=>n.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,ml)},children:"Skip to data table"})}var Wl=require("react");var Bl=Object.freeze([]);function Hl(e){if(!e)return Bl;let t=!1;for(let n=0;e.length>n;n++){const r=e[n];if(null==r||"object"!=typeof r){t=!0;break}}if(!t)return e;const n=[];for(const t of e)null!=t&&"object"==typeof t&&n.push(t);return n}var $l=require("react/jsx-runtime"),ql="var(--semiotic-focus, #005fcc)";function Gl({active:e,hoverPoint:t,margin:n,size:r,shape:i="circle",width:o,height:a,pathData:s}){if(!e||!t)return null;const l=t.x+n.left,c=t.y+n.top;let u;if("geoarea"!==i&&"path"!==i||!s)if("rect"===i&&null!=o&&null!=a){const e=Math.max(o,4),t=Math.max(a,4);u=(0,$l.jsx)("rect",{x:l-e/2-3,y:c-t/2-3,width:e+6,height:t+6,rx:3,fill:"none",stroke:ql,strokeWidth:2,strokeDasharray:"4,2"})}else u=(0,$l.jsx)("circle","wedge"===i?{cx:l,cy:c,r:12,fill:"none",stroke:ql,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:ql,strokeWidth:2,strokeDasharray:"4,2"});else u=(0,$l.jsx)("g",{transform:`translate(${n.left},${n.top})`,children:(0,$l.jsx)("path",{d:s,fill:"none",stroke:ql,strokeWidth:2.5,strokeDasharray:"6,3"})});return(0,$l.jsx)("svg",{style:{position:"absolute",left:0,top:0,width:r[0],height:r[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}var Vl=d(require("react")),Ul=d(require("react")),Yl=require("react/jsx-runtime"),Xl={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, white)",padding:"8px 12px",borderRadius:"var(--semiotic-tooltip-radius, 6px)",fontSize:"var(--semiotic-tooltip-font-size, 14px)",fontFamily:"var(--semiotic-font-family, inherit)",lineHeight:"1.5",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.15))",pointerEvents:"none",maxWidth:"300px",wordWrap:"break-word"};function Zl({chrome:e="default",className:t="",style:n,children:r,...i}){const o="default"===e?{...Xl,...n}:n;return(0,Yl.jsx)("div",{...i,"data-semiotic-tooltip-chrome":!0,className:("semiotic-tooltip "+t).trim(),style:o,children:r})}function Kl(e){return e.ownsChrome=!0,e}function Ql(e){if("string"!=typeof e)return null!=e;const t=e.trim().toLowerCase();return!(!t||"transparent"===t||/^rgba\([^)]*,\s*0(?:\.0+)?\s*\)$/.test(t)||/^hsla\([^)]*,\s*0(?:\.0+)?\s*\)$/.test(t))}function Jl(e){if(!Ul.isValidElement(e))return!1;const t=e.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;const n=e.props,r=n["data-semiotic-tooltip-chrome"];if(null!=r&&!1!==r&&"false"!==r)return!0;const i=n.style;if(i&&"object"==typeof i){if(Ql(i.background))return!0;if(Ql(i.backgroundColor))return!0}return!1}Kl(Zl);var ec=require("react/jsx-runtime");function tc({x:e,y:t,containerWidth:n,containerHeight:r,margin:i,children:o,className:a="stream-frame-tooltip",zIndex:s=1}){const l=Number.isFinite(e)&&Number.isFinite(t),c=Vl.useRef(null),[u,d]=Vl.useState(null);Vl.useLayoutEffect(()=>{const e=c.current;if(!e)return;const t=()=>{const t=e.getBoundingClientRect();Number.isFinite(t.width)&&Number.isFinite(t.height)&&d(e=>e&&.5>Math.abs(e.width-t.width)&&.5>Math.abs(e.height-t.height)?e:{width:t.width,height:t.height})};if(t(),"undefined"==typeof ResizeObserver)return;const n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[a,n,r,l]);let h;h=u?`translate(${u.width+12>n-e?"calc(-100% - 12px)":"12px"}, ${u.height+12>r-t?"calc(-100% - 4px)":"4px"})`:`translate(${e>.7*n?"calc(-100% - 12px)":"12px"}, ${.3*r>t?"4px":"calc(-100% - 4px)"})`;const f=Jl(o),p=f?null:Xl;return l?(0,ec.jsx)("div",{ref:c,className:f?a:(a+" semiotic-tooltip").trim(),style:{...p||{},position:"absolute",left:i.left+e,top:i.top+t,transform:h,pointerEvents:"none",zIndex:s,width:"max-content"},children:o}):null}var nc=require("d3-zoom"),rc=require("d3-selection");function ic(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function oc(e,t,n=.6){if(!ic(t))return;const r=t.r+(t._pulseGlowRadius??4)*t._pulseIntensity,i=t.cx??t.x??0,o=t.cy??t.y??0;e.beginPath(),e.arc(i,o,r,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*n,e.stroke()}function ac(e,t,n,r=.35){ic(t)&&(e.globalAlpha=t._pulseIntensity*r,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",n?e.fill(n):e.fill())}var sc=require("d3-shape");function lc(e,t,n,r,i,o){if(2>t.length)return;const a=[0];for(let e=1;t.length>e;e++){const n=t[e][0]-t[e-1][0],r=t[e][1]-t[e-1][1];a.push(a[e-1]+Math.sqrt(n*n+r*r))}const s=a[a.length-1];if(0===s)return;const l=Math.min(.2*s,40);e.strokeStyle=n,e.lineWidth=r,e.lineCap=o;for(let n=0;t.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),e.globalAlpha=Math.max(0,o),e.beginPath(),e.moveTo(t[n][0],t[n][1]),e.lineTo(t[n+1][0],t[n+1][1]),e.stroke()}}function cc(e,t,n,r,i){if(0>=t.size)return;const o=t.glyph;if(!o||!o.parts?.length)return;const a=Oi(o,t.size);if(0>=a.scale)return;const s=(t.style.opacity??1)*(t._decayOpacity??1);if(0>=s)return;const l=t=>{const n=Is(e,t,t);return"string"==typeof n?n:t},c=t.color??("string"==typeof t.style.fill?t.style.fill:void 0);e.save(),e.translate(n,r),t.rotation&&e.rotate(t.rotation),e.translate(a.offsetX,a.offsetY),e.scale(a.scale,a.scale),e.globalAlpha=i*s*(t.style.fillOpacity??1);const u=$i(o,t.fraction??1,t.fractionStart??0,t.fractionDirection??"horizontal");u&&t.ghostColor&&Gi(e,o,c,t.accent,t.ghostColor,l),u&&(e.beginPath(),e.rect(u.x,u.y,u.width,u.height),e.clip()),Gi(e,o,c,t.accent,void 0,l),e.restore()}function uc([e,t,n]){const r=1<<n;return[e-Math.floor(e/r)*r,t,n]}function dc(e,t,n,r,i){return"function"==typeof e?e(t,n,r,i):e.replace("{z}",t+"").replace("{x}",n+"").replace("{y}",r+"").replace("{r}",i>1?"@2x":"")}var hc=new WeakMap,fc=1;function pc(e){return Number.isFinite(e)?Math.max(1,Math.floor(e)):256}var mc=class{constructor(e=256){this.cache=new Map,this.limit=pc(e)}setLimit(e){this.limit=pc(e),this.cache.size>this.limit&&this.evict()}get(e){const t=this.cache.get(e);return t&&(t.lastUsed=performance.now()),t}set(e,t){this.cache.set(e,t),this.cache.size>this.limit&&this.evict()}evict(){for(;this.cache.size>this.limit;){let e,t=1/0;for(const[n,r]of this.cache)t>r.lastUsed&&(t=r.lastUsed,e=n);if(!e)break;{const t=this.cache.get(e);t&&(t.img.onload=null,t.img.onerror=null,t.img.src=""),this.cache.delete(e)}}}clear(){for(const e of this.cache.values())e.img.onload=null,e.img.onerror=null,e.img.src="";this.cache.clear()}};var gc=class{constructor(e){this.capacity=e,this.particles=Array(e);for(let t=0;e>t;t++)this.particles[t]={t:0,offset:0,lineIndex:0,active:!1,x:0,y:0}}spawn(e,t=Math.random){for(let n=0;this.capacity>n;n++){const r=this.particles[n];if(!r.active)return r.active=!0,r.t=0,r.offset=.6*(t()-.5),r.lineIndex=e,r.x=0,r.y=0,r}return null}step(e,t,n,r){for(let i=0;this.capacity>i;i++){const o=this.particles[i];if(!o.active)continue;const a=n[o.lineIndex];if(!a||2>a.length){o.active=!1;continue}if(o.t+=e*t,o.t>=1){o.active=!1;continue}const s=yc(a),l=vc(a,o.t*s),c=(r[o.lineIndex]||2)/2;o.x=l.x+l.nx*o.offset*c*2,o.y=l.y+l.ny*o.offset*c*2}}countForLine(e){let t=0;for(let n=0;this.capacity>n;n++)this.particles[n].active&&this.particles[n].lineIndex===e&&t++;return t}clear(){for(let e=0;this.capacity>e;e++)this.particles[e].active=!1}};function yc(e){let t=0;for(let n=1;e.length>n;n++){const r=e[n][0]-e[n-1][0],i=e[n][1]-e[n-1][1];t+=Math.sqrt(r*r+i*i)}return t}function vc(e,t){let n=0;for(let r=1;e.length>r;r++){const i=e[r][0]-e[r-1][0],o=e[r][1]-e[r-1][1],a=Math.sqrt(i*i+o*o);if(n+a>=t||r===e.length-1){const s=a>0?(t-n)/a:0,l=a>.001?a:1;return{x:e[r-1][0]+i*s,y:e[r-1][1]+o*s,nx:-o/l,ny:i/l}}n+=a}const r=e[e.length-1];return{x:r[0],y:r[1],nx:0,ny:0}}function bc(e,t){return"touch"===t?Math.max(e,24):e}var xc=d(require("react"));function wc(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:xc.createElement(xc.Fragment,null,...t)}var kc,Sc=d(require("react")),Mc=require("react/jsx-runtime");function jc({value:e,children:t}){const n=(kc??(kc=Sc.createContext(null)),kc);return(0,Mc.jsx)(n.Provider,{value:e,children:t})}function Ac(e,t){return null!=e?(0,Mc.jsx)(jc,{value:t,children:e}):e}var Cc=new Set;function Rc(e,t){const n="function"==typeof e?e(t.datum??null,t):e;return(r=n)&&"object"==typeof r&&"string"==typeof r.id&&"function"==typeof r.cacheKey&&"function"==typeof r.drawCanvas&&"function"==typeof r.renderStaticSVG?n:void 0;var r}function Lc(e,t){if("undefined"!=typeof process&&"production"===process.env?.NODE_ENV)return;const n=`${e}:${t}`;Cc.has(n)||(Cc.add(n),console.warn(`[Semiotic] Render backend "${e}" does not support scene node "${t}"; using the built-in renderer.`))}function Pc(e){if(!e)return;const t=[];for(const n of e)if("point"===n.type)t.push(n);else if("glyph"===n.type){const e=n,r=qi(e.glyph,e.size);t.push({pointId:e.pointId,x:e.x+r.centerDx,y:e.y+r.centerDy,r:r.radius})}return t}var Nc=["name","label","title"],Ec=["type","kind","category","group","class","status","role","shape"],Ic=["value","amount","total","count","weight","score"],Tc=new Set(["x","y","z","x0","x1","y0","y1","r","cx","cy","radius","layer","row","rowindex","col","column","depth","index","order","sankeywidth","coincidentpoints","sourcelinks","targetlinks","parent","children","fx","fy","vx","vy"]);function zc(e,t){for(const n of t){const t=e.find(e=>e.lower===n);if(t)return t}}function Dc(e,t={}){if(!e||"object"!=typeof e)return{entries:[]};const n=t.maxEntries??6,r=!1!==t.skipPositional,i=[];for(const[t,n]of Object.entries(e)){if(t.startsWith("_"))continue;if("data"===t)continue;if(r&&Tc.has(t.toLowerCase()))continue;if(null==n)continue;const e=typeof n;("string"===e||"number"===e||"boolean"===e||n instanceof Date)&&i.push({key:t,lower:t.toLowerCase(),value:n})}if(0===i.length)return{entries:[]};let o=i.findIndex(e=>Nc.includes(e.lower));const a=o>=0;0>o&&(o=i.findIndex(e=>"id"===e.lower)),0>o&&(o=i.findIndex(e=>"string"==typeof e.value));const s=0>o?void 0:i[o];let l=i.filter((e,t)=>t!==o);a&&(l=l.filter(e=>"id"!==e.lower));const c=zc(l,Ec),u=zc(l,Ic),d=new Set(Ec),h=new Set(Ic),f=[];c&&f.push({key:c.key,value:c.value}),u&&f.push({key:u.key,value:u.value});for(const e of l){if(f.length>=n)break;e!==c&&e!==u&&(d.has(e.lower)||h.has(e.lower)||f.push({key:e.key,value:e.value}))}return{titleKey:s?.key,title:s?.value,entries:f}}var _c=require("react/jsx-runtime");function Oc(e,t){return"function"==typeof t?t(e):e[t]}function Fc(e,t){if(t)return t(e);if(null==e)return"";if("number"==typeof e){if(!Number.isFinite(e))return e+"";const t=Number.isInteger(e)?e:parseFloat(e.toPrecision(6));return Math.abs(t)>9999?t.toLocaleString():t+""}if(e instanceof Date)return e.toLocaleDateString();if("object"==typeof e&&null!==e){if(void 0!==e.id)return e.id+"";if(void 0!==e.name)return e.name+"";try{return JSON.stringify(e)}catch{return Array.isArray(e)?`[Array(${e.length})]`:"[Object]"}}return e+""}function Wc(e={}){const{fields:t,title:n,format:r,style:i={},className:o=""}=e;return e=>{if(!e||"object"!=typeof e)return null;let a;const s=[];if(n){const t=Oc(e,n);a=Fc(t,r)}if(t&&t.length>0)t.forEach(t=>{let n,i,o;"string"==typeof t?(n=t,i=t,o=r):(n=t.label,i=t.accessor||t.key||"",o=t.format||r);const a=Oc(e,i);s.push({label:n,value:Fc(a,o)})});else if(!n){const t=["value","y","name","id","label"];for(const n of t)if(void 0!==e[n]){a=Fc(e[n],r);break}if(!a){const t=Object.keys(e).filter(e=>!e.startsWith("_"));t.length>0&&(a=Fc(e[t[0]],r))}}return(0,_c.jsxs)(Zl,{className:o,style:i,children:[a&&(0,_c.jsx)("div",{style:{fontWeight:s.length>0?"bold":"normal"},children:a}),s.map((e,t)=>(0,_c.jsxs)("div",{style:{marginTop:0===t&&a?"4px":0},children:[e.label&&(0,_c.jsxs)("span",{children:[e.label,": "]}),e.value]},t))]})}}function Bc(e={}){const{fields:t=[],title:n,format:r,style:i={},className:o="",showLabels:a=!0,separator:s=": "}=e;return e=>{if(!e||"object"!=typeof e)return null;const l=[];if(n){const t=Oc(e,n);l.push({value:Fc(t,r)})}if(t&&Array.isArray(t)&&t.length>0)t.forEach(t=>{let n,i,o;"string"==typeof t?(n=t,i=t,o=r):(n=t.label,i=t.accessor||t.key||"",o=t.format||r);const s=Fc(Oc(e,i),o);l.push({label:a?n:void 0,value:s})});else{const t=Dc(e,{skipPositional:!1});null!=t.title&&l.push({label:void 0,value:Fc(t.title,r),bold:!0}),t.entries.forEach(e=>{l.push({label:a?e.key:void 0,value:Fc(e.value,r)})})}return Array.isArray(l)&&0!==l.length?(0,_c.jsx)(Zl,{className:("semiotic-tooltip-multiline "+o).trim(),style:i,children:l.map((e,t)=>(0,_c.jsxs)("div",{style:{marginBottom:l.length-1>t?"4px":0,fontWeight:e.bold?"bold":void 0},children:[e.label&&(0,_c.jsxs)("strong",{children:[e.label,s]}),e.value]},t))}):null}}function Hc(e){if(!0!==e){if("function"==typeof e){const t=e;return e=>{const n=!0===e?.__semioticHoverData||e&&void 0!==e.data&&"number"==typeof e.x&&"number"==typeof e.y&&e&&("node"===e.type||"edge"===e.type||void 0!==e.nodeOrEdge||void 0!==e.allSeries||void 0!==e.stats||void 0!==e.__chartType);let r=Array.isArray(i=n?e.data??{}:e)?i[0]:i;var i;if(!r)return null;if(("node"===e?.nodeOrEdge&&"number"==typeof r?.x0&&"number"==typeof r?.x1||"edge"===e?.nodeOrEdge&&"number"==typeof r?.sankeyWidth)&&r.data&&"object"==typeof r.data&&(r=r.data),!r)return null;if(n&&(void 0!==e.allSeries||void 0!==e.xValue)){const t={...r};void 0!==e.allSeries&&void 0===t.allSeries&&(t.allSeries=e.allSeries),void 0!==e.xValue&&void 0===t.xValue&&(t.xValue=e.xValue),r=t}const o=t(r);return null==o?null:Jl(o)?o:(0,_c.jsx)(Zl,{children:o})}}if(!1===e||void 0===e)return!1;if(function(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)&&"mode"in e&&"multi"===e.mode}(e)){if("function"==typeof e.content)return Hc(e.content);"undefined"!=typeof process&&"production"!==process.env?.NODE_ENV&&console.warn('[semiotic] tooltip={{ mode: "multi" }} reached normalizeTooltip without a chart that wires tooltipMode. Use a line/area-family chart with multi support, or pass frameProps.tooltipMode: "multi" to StreamXYFrame.');const t=Bc();return Hc(e=>t(e))}if("object"==typeof e&&null!==e&&("fields"in e||"title"in e)){const t=Wc(e);return Hc(e=>t(e))}if("multi"===e){"undefined"!=typeof process&&"production"!==process.env?.NODE_ENV&&console.warn('[semiotic] tooltip="multi" reached normalizeTooltip on a single-tooltip chart. Rendering multi-field content as a backward-compatible fallback.');const e=Bc();return Hc(t=>e(t))}return Wc()}}require("react/jsx-runtime");var $c=require("react/jsx-runtime");function qc({data:e}){if(!e)return null;if(e.properties)return(0,$c.jsx)("div",{className:"semiotic-tooltip",style:Xl,children:(0,$c.jsx)("div",{style:{fontWeight:600},children:e.properties.name||e.properties.NAME||e.properties.id||"Feature"})});const t=null!=e.data?e.data:e;if(!t||"object"!=typeof t)return null;const n=Dc(t),r=null!=n.title?n.title+"":null;return null==r&&0===n.entries.length?null:(0,$c.jsxs)("div",{className:"semiotic-tooltip",style:Xl,children:[null!=r&&(0,$c.jsx)("div",{style:{fontWeight:600,marginBottom:n.entries.length?2:0},children:r}),n.entries.map(e=>{return(0,$c.jsxs)("div",{children:[(0,$c.jsxs)("span",{style:{opacity:.7},children:[e.key,": "]}),(0,$c.jsx)("span",{style:{fontWeight:600},children:(t=e.value,null==t?"–":"number"==typeof t?Math.abs(t)>9999?t.toLocaleString():t+"":t instanceof Date?t.toLocaleDateString():t+"")})]},e.key);var t})]})}qc.ownsChrome=!0;var Gc={top:10,right:10,bottom:10,left:10},Vc=null;function Uc(){if(null!==Vc)return Vc;if("undefined"==typeof window)return!1;const e="function"==typeof window.matchMedia&&window.matchMedia("(pointer: coarse)").matches,t="undefined"!=typeof navigator&&"number"==typeof navigator.hardwareConcurrency&&4>=navigator.hardwareConcurrency,n="undefined"!=typeof navigator&&"number"==typeof navigator.deviceMemory&&4>=navigator.deviceMemory;return Vc=e||t||n}function Yc(){return Uc()?12:30}var Xc={width:28,height:28,border:"1px solid rgba(0,0,0,0.2)",borderRadius:4,background:"rgba(255,255,255,0.9)",color:"#333",fontSize:16,fontWeight:600,lineHeight:1,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",padding:0,boxShadow:"0 1px 3px rgba(0,0,0,0.1)"};function Zc(e){return"string"==typeof e?e:"object"==typeof e&&e&&"type"in e?e.type:null}function Kc(e){return e?e.getContext("2d"):null}function Qc(e){const t=e.pointer.clientX-e.canvasRect.left-e.margin.left,n=e.pointer.clientY-e.canvasRect.top-e.margin.top;if(0>t||t>e.width||0>n||n>e.height)return{kind:"outside"};e.hitCanvasRef.current||(e.hitCanvasRef.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const r=Kc(e.hitCanvasRef.current);if(!r)return{kind:"unavailable"};const i=Vi(e.scene,t,n,bc(30,e.pointer.pointerType),r,e.pointQuadtree,e.maxPointRadius,bc(6,e.pointer.pointerType));if(!i)return{kind:"miss"};const{node:o}=i,a=o.datum,s=Array.isArray(a)?null:a?.properties?a:a?.data||a,l="point"===o.type?o.x:"geoarea"===o.type?o.centroid[0]:t,c="point"===o.type?o.y:"geoarea"===o.type?o.centroid[1]:n;return{kind:"hit",node:o,hover:{...s,...s?.properties||{},data:s,properties:s?.properties,__semioticHoverData:!0,x:l,y:c}}}function Jc(e){const{onObservation:t,datum:n,x:r=0,y:i=0,chartType:o,chartId:a,context:s,timestamp:l=Date.now()}=e;t&&(n?(t({type:"hover",datum:n,x:r,y:i,timestamp:l,chartType:o,chartId:a}),"focus"===s?.type&&t({type:"focus",datum:n,inputType:"touch"===s.inputType?"pointer":s.inputType,timestamp:l,chartType:o,chartId:a})):t({type:"hover-end",timestamp:l,chartType:o,chartId:a}))}function eu(e){const{onObservation:t,datum:n,x:r=0,y:i=0,chartType:o,chartId:a,context:s,timestamp:l=Date.now()}=e;t&&(n?(t({type:"click",datum:n,x:r,y:i,timestamp:l,chartType:o,chartId:a}),"activate"===s?.type&&t({type:"activate",datum:n,inputType:s.inputType,timestamp:l,chartType:o,chartId:a})):t({type:"click-end",timestamp:l,chartType:o,chartId:a}))}var tu=require("react"),nu=require("react");function ru(e){const t=e.datum;return{...t||{},...t?.properties||{},data:t,properties:t?.properties,x:e.x,y:e.y,__semioticHoverData:!0}}var iu=d(require("react")),ou=require("react");function au(e,t,n,r){return"function"==typeof e?e({size:t,margin:n,scales:r}):e}function su({graphics:e,size:t,margin:n,readScales:r,tracker:i}){return(0,ou.useSyncExternalStore)(i.subscribe,i.getSnapshot,i.getSnapshot),iu.createElement(iu.Fragment,null,au(e,t,n,r()))}var lu=require("react/jsx-runtime"),cu=(0,x.memo)((0,x.forwardRef)(function(e,t){const{projection:n,projectionExtent:r,fitPadding:i,projectionTransform:o,areas:a,points:s,lines:l,customLayout:c,layoutConfig:u,layoutSelection:d,onLayoutError:h,xAccessor:f,yAccessor:p,lineDataAccessor:m,pointIdAccessor:g,lineIdAccessor:y,lineType:v="geo",flowStyle:b="basic",graticule:w,zoomable:k,zoomExtent:S,onZoom:M,dragRotate:j,showParticles:A,particleStyle:C,tileURL:R,tileAttribution:L,tileCacheSize:P,size:N,width:E,height:I,responsiveWidth:T,responsiveHeight:z,margin:D,className:_,background:O,maxDevicePixelRatio:F,windowSize:W=500,renderMode:B,areaStyle:H,pointStyle:$,lineStyle:q,colorScheme:G,enableHover:V=!0,hoverAnnotation:U,tooltipContent:Y,allowTooltipOverflow:X=!1,customClickBehavior:Z,customHoverBehavior:K,onObservation:Q,annotationObservationCallback:J,chartId:ee,annotations:te,onAnnotationActivate:ne,autoPlaceAnnotations:re,svgAnnotationRules:ie,decay:oe,pulse:ae,transition:se,animate:le,staleness:ce,frameScheduler:ue,clock:de,random:he,seed:fe,paused:pe=!1,suspendWhenHidden:me=!0,backgroundGraphics:ge,foregroundGraphics:ye,title:ve,legend:be,legendPosition:xe,legendLayout:we,legendHoverBehavior:ke,legendClickBehavior:Se,legendHighlightedCategory:Me,legendIsolatedCategories:je,legendCategoryAccessor:Ae,onCategoriesChange:Ce,showAxes:Re,accessibleTable:Le=!0,description:Pe,summary:Ne}=e,{customHoverBehavior:Ee,customClickBehavior:Ie,hasClickBehavior:Te}=function({customHoverBehavior:e,customClickBehavior:t,onObservation:n,chartId:r,chartType:i}){const o=!(!e&&!n),a=!(!t&&!n),s=(0,tu.useCallback)((t,o)=>{e?.(t,o),Jc({onObservation:n,datum:t?t.data||t:null,x:t?.x,y:t?.y,chartType:i,chartId:r,context:o})},[r,i,e,n]),l=(0,tu.useCallback)((e,o)=>{t?.(e,o),eu({onObservation:n,datum:e?e.data||e:null,x:e?.x,y:e?.y,chartType:i,chartId:r,context:o})},[r,i,t,n]);return{customHoverBehavior:o?s:void 0,customClickBehavior:a?l:void 0,hasClickBehavior:a}}({customHoverBehavior:K,customClickBehavior:Z,onObservation:Q,chartId:ee,chartType:"StreamGeoFrame"}),ze=N||[E||600,I||400],De=(0,x.useRef)(!0),_e=qo({sizeProp:ze,responsiveWidth:T,responsiveHeight:z,userMargin:D,marginDefault:Gc,title:ve,legend:be,legendPosition:xe,legendLayout:we,legendMarginReserved:e.__legendMarginReservedFor===be,animate:le,transitionProp:se,frameScheduler:ue,clock:de,random:he,seed:fe,paused:pe,suspendWhenHidden:me,themeDirtyRef:De}),{reducedMotionRef:Oe,responsiveRef:Fe,size:We,margin:Be,adjustedWidth:He,adjustedHeight:$e,transition:qe,introEnabled:Ge,tableId:Ve,frameRuntime:Ue,rafRef:Ye,renderFnRef:Xe,scheduleRender:Ze,currentTheme:Ke}=_e,Qe=function(){const[e,t]=(0,Xs.useState)(!1);return Zs(()=>{t(!0)},[]),e}(),Je=function(){const e=(0,Xs.useSyncExternalStore)(Ks,Qs,Js);return(0,Xs.useRef)(e).current}(),et=(0,x.useMemo)(()=>Array.isArray(a)?Hl(a):a,[a]),tt=(0,x.useMemo)(()=>Hl(s),[s]),nt=(0,x.useMemo)(()=>Hl(l),[l]),rt=j??"orthographic"===Zc(n),it=function(e){const t=(0,al.useRef)(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return ll(e,t);if(!cl(e)||!cl(t))return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const r of n){if(!Object.prototype.hasOwnProperty.call(t,r))return!1;const n=e[r],i=t[r];if(!Object.is(n,i))if(Array.isArray(n)&&Array.isArray(i)){if(!ll(n,i))return!1}else{if(!cl(n)||!cl(i))return!1;if(!sl(n,i))return!1}}return!0}(t.current,e)||(t.current=e),t.current}((0,x.useMemo)(()=>({projection:n,projectionExtent:r,fitPadding:i,xAccessor:f,yAccessor:p,lineDataAccessor:m,lineType:v,flowStyle:b,areaStyle:H,pointStyle:$,lineStyle:q,colorScheme:G,themeSemantic:Vo(Ke),themeSequential:Ke?.colors?.sequential,themeDiverging:Ke?.colors?.diverging,themeCategorical:Ke?.colors?.categorical,graticule:w,projectionTransform:o,windowSize:W,clock:Ue.now,decay:oe,pulse:ae,transition:qe,introAnimation:Ge,annotations:te,pointIdAccessor:g,lineIdAccessor:y,customLayout:c,layoutConfig:u,onLayoutError:h,layoutMargin:Be}),[n,r,i,f,p,m,v,b,H,$,q,G,Ke,w,o,W,Ue.now,oe,ae,qe,Ge,te,g,y,c,u,h,Be])),ot=(0,x.useRef)(null);ot.current||(ot.current=new Ai(it));const at=ot.current,st=(0,x.useRef)(null),lt=st.current??(st.current=function(e){const t=new Set;let n=0,r=e;return{subscribe:e=>(t.add(e),()=>t.delete(e)),getSnapshot:()=>n,sync(e){if(e!==r){r=e,n+=1;for(const e of t)e()}}}}(at.scales)),ct=Ys||!Qe&&Je;ct&&(et||s||l)&&(et&&at.setAreas(et),s&&at.setPoints(tt),l&&at.setLines(nt),at.computeScene({width:He,height:$e}));const{resolvedForeground:ut,resolvedBackground:dt,themeBackground:ht,surfaceBackground:ft}=function({tracker:e,readScales:t,...n}){const r=r=>"function"==typeof r?iu.createElement(su,{graphics:r,size:n.size,margin:n.margin,readScales:t,tracker:e}):r;return{...function({foregroundGraphics:e,backgroundGraphics:t,size:n,margin:r,scales:i,background:o,themeBackgroundColor:a,resolveScaleAwareGraphics:s=!0}){const l=`var(--semiotic-bg, ${a})`;return{resolvedForeground:s||"function"!=typeof e?au(e,n,r,i):null,resolvedBackground:s||"function"!=typeof t?au(t,n,r,i):null,themeBackground:l,surfaceBackground:ul({background:o,hasBackgroundGraphics:!!t,themeBackground:l})}}({...n,resolveScaleAwareGraphics:!1}),resolvedForeground:r(n.foregroundGraphics),resolvedBackground:r(n.backgroundGraphics)}}({foregroundGraphics:ye,backgroundGraphics:ge,size:We,margin:Be,scales:at.scales,background:O,themeBackgroundColor:Ke.colors.background,tracker:lt,readScales:()=>at.scales}),pt=(0,x.useRef)(null),mt=(0,x.useRef)(null),gt=(0,x.useRef)(null);R&&!gt.current&&(gt.current=new mc(P??256)),gt.current?.setLimit(P??256);const yt=(0,x.useRef)(te),vt=(0,x.useRef)(null),bt=(0,x.useRef)(nc.zoomIdentity),xt=(0,x.useRef)(!1),wt=(0,x.useRef)(null),kt=(0,x.useCallback)(e=>{wt.current=e,Fe&&"object"==typeof Fe&&(Fe.current=e)},[Fe]),St=(0,x.useRef)(null),Mt=(0,x.useRef)(null),jt=(0,x.useRef)(null),At=(0,x.useRef)(0);if(A&&!jt.current){const e=C?.maxPerLine??Yc();jt.current=new gc(50*e)}const Ct=(0,x.useRef)(null),Rt=(0,x.useRef)(!1),Lt=(0,x.useRef)(null),Pt=(0,x.useRef)(!1),Nt=(0,x.useRef)(!1),Et=(0,Ci.useRef)(new Ii("StreamGeoFrame")),It=(0,x.useRef)(void 0),[Tt,zt]=(0,x.useState)(null),[,Dt]=(0,x.useState)(0),_t=(0,x.useRef)(0),[Ot,Ft]=(0,x.useState)(!1),Wt=function(e,t,n,r){const i=(0,Wl.useRef)({accessor:t,onChange:n,readData:r}),o=(0,Wl.useRef)([]);i.current={accessor:t,onChange:n,readData:r};const a=(0,Wl.useCallback)(()=>{const{accessor:t,onChange:n,readData:r}=i.current;if(!n||!t)return;const a=function(e,t){if(!t)return[];const n=new Set,r=[];for(const i of e){if(!i||"object"!=typeof i)continue;const e=("function"==typeof t?t(i):i[t])+"";n.has(e)||(n.add(e),r.push(e))}return r}(e.current?r(e.current):[],t);(function(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0})(a,o.current)||(o.current=a,n(a))},[e]);return(0,Wl.useEffect)(()=>{o.current=[],a()},[t,a,n]),a}(ot,Ae,Ce,e=>e.getPoints());!function(e,t,n,r){(0,Go.useEffect)(()=>{e.current?.updateConfig(t),n.current=!0,r()},[t,r,e,n])}(ot,it,De,Ze),function(e,t,n,r){const i=(0,Go.useRef)(null);(0,Go.useEffect)(()=>{const o=e.current;if(!o)return;const a=t??null;i.current!==a&&(i.current=a,o.setLayoutSelection(a),o.hasCustomRestyle?o.restyleScene(a):n.current=!0,r())},[t,r,e,n])}(ot,d,De,Ze),(0,x.useEffect)(()=>{const e=ot.current;e&&(et&&e.setAreas(et),s&&e.setPoints(tt),l&&e.setLines(nt),De.current=!0,Ze())},[et,s,tt,l,nt,Ze]);const Bt=(0,x.useCallback)(e=>{null!=e&&"object"==typeof e&&(ot.current?.pushPoint(e),De.current=!0,Ze())},[Ze]),Ht=(0,x.useCallback)(e=>{const t=Hl(e);0!==t.length&&(ot.current?.pushMany(t),De.current=!0,Ze())},[Ze]),$t=(0,x.useCallback)(e=>{null!=e&&"object"==typeof e&&(ot.current?.pushLine(e),De.current=!0,Ze())},[Ze]),qt=(0,x.useCallback)(e=>{const t=Hl(e);0!==t.length&&(ot.current?.pushManyLines(t),De.current=!0,Ze())},[Ze]),Gt=(0,x.useCallback)(()=>{ot.current?.clear(),De.current=!0,Ze()},[Ze]);(0,x.useImperativeHandle)(t,()=>({push:Bt,pushMany:Ht,removePoint:e=>{const t=ot.current?.removePoint(e)??[];return t.length>0&&(De.current=!0,Ze()),t},pushLine:$t,pushManyLines:qt,removeLine:e=>{const t=ot.current?.removeLine(e)??[];return t.length>0&&(De.current=!0,Ze()),t},getLines:()=>ot.current?.getLines()??[],clear:Gt,getProjection:()=>ot.current?.scales?.projection??null,getGeoPath:()=>ot.current?.scales?.geoPath??null,getCartogramLayout:()=>ot.current?.cartogramLayout??null,getCustomLayout:()=>ot.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>ot.current?.lastCustomLayoutFailure??null,getZoom:()=>bt.current.k,resetZoom:()=>{const e=wt.current;e&&vt.current&&(0,rc.select)(e).call(vt.current.transform,nc.zoomIdentity)},getData:()=>ot.current?.getPoints()??[]}),[Bt,Ht,$t,qt,Gt,Ze]);const{hoverHandlerRef:Vt,onPointerMove:Ut,onPointerLeave:Yt,pointerStateRef:Xt}=_e,{canvasRef:Zt,interactionCanvasRef:Kt,resolutionDirtyRef:Qt}=function(e,t){return il({...t,renderFnRef:e.renderFnRef,scheduleRender:e.scheduleRender,cancelRender:e.cancelRender,frameRuntime:e.frameRuntime})}(_e,{hydrated:Qe,wasHydratingFromSSR:Je,storeRef:ot,dirtyRef:De,cleanup:()=>gt.current?.clear(),maxDevicePixelRatio:F,canvasPaintDependencies:[He,$e,O,ge,B,R,P,Ze]});(0,x.useEffect)(()=>{Vt.current=e=>{const t=Zt.current;if(!t)return;const n=ot.current;if(!n||!n.scene.length)return void qs(t);const r=Qc({pointer:e,canvasRect:t.getBoundingClientRect(),margin:Be,width:He,height:$e,scene:n.scene,pointQuadtree:n.quadtree,maxPointRadius:n.maxPointRadius,hitCanvasRef:mt});qs(t,"hit"===r.kind?$s(r.node):void 0),V&&!1!==U&&("hit"===r.kind?(Ct.current=r.hover,Lt.current=r.node,zt(r.hover),Ee?.(r.hover),Ze()):("outside"===r.kind||"miss"===r.kind&&Ct.current)&&(Ct.current=null,Lt.current=null,zt(null),Ee?.(null),Ze()))}},[V,U,He,$e,Be,Ee,Ze,Vt,Zt]),_e.hoverLeaveRef.current=()=>{qs(Zt.current),V&&!1!==U&&(Ct.current=null,Lt.current=null,zt(null),Ee?.(null),Ze())},function(e){const t=Bs.useRef(null);Bs.useEffect(()=>{e.current&&(t.current=e.current)}),Bs.useEffect(()=>()=>qs(t.current),[])}(Zt);const Jt=(0,x.useCallback)(e=>{if((t=e.target)instanceof Element&&null!=t.closest("[data-semiotic-annotation-widget]"))return;var t;if(!Ie)return;const n=ot.current;if(!n||!n.scene.length)return void Ie(null);const r=e.currentTarget.getBoundingClientRect(),i=e.clientX-r.left-Be.left,o=e.clientY-r.top-Be.top;if(0>i||i>He||0>o||o>$e)return void Ie(null);mt.current||(mt.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const a=Kc(mt.current);if(!a)return void Ie(null);const s=bc(30,It.current),l=bc(6,It.current),c=Vi(n.scene,i,o,s,a,n.quadtree,n.maxPointRadius,l);if(c){const e=c.node.datum,t=Array.isArray(e)?null:e?.properties?e:e?.data||e,n=t?.properties?{...t,...t.properties}:t;return void Ie({...n,data:t,properties:t?.properties,__semioticHoverData:!0,x:i,y:o,time:i,value:o},{type:"activate",inputType:(u=It.current,"touch"===u?"touch":"pointer")})}var u;Ie(null)},[$e,He,Ie,Be]),{kbFocusIndexRef:en,focusedNavPointRef:tn,onKeyDown:nn}=function({storeRef:e,hoverRef:t,hoveredNodeRef:n,setHoverPoint:r,customHoverBehavior:i,customClickBehavior:o,scheduleRender:a}){const s=(0,nu.useRef)(-1),l=(0,nu.useRef)(null),c=(0,nu.useCallback)(c=>{if(function(e){const t=e.target;return t instanceof Element&&t!==e.currentTarget&&null!=t.closest("button, a[href], input, select, textarea, summary, [contenteditable='true'], [role='button'], [role='link'], [role='checkbox'], [role='radio'], [role='switch']")}(c))return;const u=e.current;if(!u)return;const d=()=>{s.current=-1,l.current=null,t.current=null,n&&(n.current=null),r(null),i?.(null),a()};if(0===u.scene.length)return void(0>s.current||d());const h=function(e){const t=[];for(const n of e)if("point"===n.type&&null!=n.x&&!1!==n.interactive)t.push({x:n.x,y:n.y,datum:n.datum,shape:"circle"});else if("glyph"===n.type){if(0>=n.size||null==n.datum)continue;const e=qi(n.glyph,n.size);t.push({x:n.x+e.centerDx,y:n.y+e.centerDy,datum:n.datum,shape:"rect",w:2*e.halfWidth,h:2*e.halfHeight})}else"geoarea"===n.type&&n.centroid&&!1!==n.interactive&&t.push({x:n.centroid[0],y:n.centroid[1],datum:n.datum,shape:"geoarea",pathData:n.pathData});return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}(u.scene);if(0===h.length)return void(0>s.current||d());let f=s.current;if(h.length>f||(d(),f=-1),("Enter"===c.key||" "===c.key)&&f>=0)return c.preventDefault(),void o?.(ru(h[f]),{type:"activate",inputType:"keyboard"});const p=function(e,t,n){switch(e){case"ArrowRight":case"ArrowDown":return n-1>t?t+1:t;case"ArrowLeft":case"ArrowUp":return t>0?t-1:t;case"PageDown":return Math.min(t+Math.max(1,Math.floor(.1*n)),n-1);case"PageUp":return Math.max(t-Math.max(1,Math.floor(.1*n)),0);case"Home":return 0;case"End":return n-1;case"Escape":return-1;default:return null}}(c.key,0>f?-1:f,h.length);if(null===p)return;if(c.preventDefault(),0>p)return void d();const m=0>f?0:p;s.current=m;const g=h[m];l.current=g;const y=ru(g);t.current=y,r(y),i?.(y,{type:"focus",inputType:"keyboard"}),a()},[o,i,t,n,a,r,e]);return{kbFocusIndexRef:s,focusedNavPointRef:l,onKeyDown:c}}({storeRef:ot,hoverRef:Ct,hoveredNodeRef:Lt,setHoverPoint:zt,customHoverBehavior:Ee,customClickBehavior:Ie,scheduleRender:Ze}),rn=(0,x.useCallback)(e=>{var t,n,r,i;n=V&&!1!==U,r=Rt.current,i=Zt.current,function(e,t,n){const r=e.current;r.inside=!0,r.clientX=t.clientX,r.clientY=t.clientY,r.pointerType=t.pointerType??n}(t=Xt,e,void 0),(n||r)&&(n||"touch"!==t.current.pointerType||(qs(i),0))&&(It.current=e.pointerType,en.current=-1,tn.current=null,Ut(e))},[Zt,V,U,tn,en,Ut,Xt]),on=(0,x.useCallback)(e=>{It.current=e.pointerType},[]);Xe.current=()=>{if(Ye.current=null,lt.sync(ot.current?.scales??null),!Ue.isActive)return;const e=Zt.current,t=ot.current;if(!e||!t)return;const n=Ue.now();let r=!1;const i=Mt.current;let o=!1;i&&(Mt.current=null,t.applyRotation(i,{width:He,height:$e}),o=!0);const a=null!=t.activeTransition,s=t.advanceTransition(Oe.current?n+1e6:n),l=!Oe.current&&s,c=Et.current.beforeCompute(t.getLastUpdateResult(),l);let u=!1;if(De.current&&!s){const e={width:He,height:$e},n=t.hasProjection(),r=rt&&n?t.getRotation():null;t.computeScene(e);const i=bt.current,o=1!==i.k||0!==i.x||0!==i.y;rt&&r?o?(t.setRotation(r),t.applyZoomScale(i.k,e)):t.applyRotation(r,e):o&&t.applyZoomTransform(i,e),De.current=!1,u=!0,Wt()}lt.sync(t.scales),Et.current.afterCompute(c,u,!1);const d=nl(F),h=A&&!Oe.current&&!!jt.current,f=t.consumeStylePaintPending();(u||o||f)&&(Rt.current=function(e){if(!e)return!1;for(const t of e)if($s(t))return!0;return!1}(t.scene),Rt.current||qs(e)),Rt.current&&(a||u||o||f)&&function(e){var t,n,r;n=e.pointer,r=t=>{const n=Qc({pointer:t,canvasRect:e.canvas.getBoundingClientRect(),margin:e.margin,width:e.width,height:e.height,scene:e.store.scene,pointQuadtree:e.geometryMoved?null:e.store.quadtree,maxPointRadius:e.store.maxPointRadius,hitCanvasRef:e.hitCanvasRef});return"hit"===n.kind?$s(n.node):void 0},(t=e.canvas)&&(n.inside&&"touch"!==n.pointerType?qs(t,r(n)):qs(t))}({canvas:e,pointer:Xt.current,store:t,margin:Be,width:He,height:$e,hitCanvasRef:mt,geometryMoved:a||u||o});const p=function(e,t,n,r){const i=r.current,o=!0===e.lastCustomLayoutFailure?.preservedLastGoodScene,a=!o&&e.hasActivePulsesAt(t),s=!(n||o||!a&&!i)&&e.refreshPulse(t);return r.current=a,{changed:s,pending:a}}(t,n,u,Nt),m=!!((g={dirtyOrRebuilt:u,transitioning:a,continuous:h,liveEncoding:p.changed,forced:o||f||Qt.current}).dirtyOrRebuilt||g.transitioning||g.animationTicked||g.continuous||g.liveEncoding||g.forced);var g;if(Qt.current=!1,R&>.current){const e=pt.current;if(e&&t.scales?.projection){const n=tl(e,We,Be,d);n&&(n.clearRect(-Be.left,-Be.top,We[0],We[1]),n.save(),n.beginPath(),n.rect(0,0,He,$e),n.clip(),function(e,t){const{tileURL:n,projection:r,width:i,height:o,tileCache:a,onTileLoad:s,maxDevicePixelRatio:l}=t,c=r.scale(),u=r.translate(),d=function(e){const{size:t,scale:n,translate:r,clampX:i=!0,clampY:o=!0}=e,a=Math.max(Math.log(n)/Math.LN2-8,0),s=Math.round(a),l=1<<s,c=Math.pow(2,a-s+8),u=r[0]-n/2,d=r[1]-n/2,h=Math.max(i?0:-1/0,Math.floor((0-u)/c)),f=Math.min(i?l:1/0,Math.ceil((t[0]-u)/c)),p=Math.max(o?0:-1/0,Math.floor((0-d)/c)),m=Math.min(o?l:1/0,Math.ceil((t[1]-d)/c)),g=[];for(let e=p;m>e;++e)for(let t=h;f>t;++t)g.push([t,e,s]);return{tiles:g,translate:[u/c,d/c],scale:c}}({size:[i,o],scale:2*c*Math.PI,translate:u}),h=nl(l),f=function(e){if("string"==typeof e)return"template:"+e;const t=e;let n=hc.get(t);return null==n&&(n=fc++,hc.set(t,n)),"provider:"+n}(n);let p=!0;for(const t of d.tiles){const[r,i,o]=uc(t),l=dc(n,o,r,i,h),c=`${f}|dpr:${h}|${o}/${r}/${i}|${l}`;let u=a.get(c);if(!u){const e=new Image;e.crossOrigin="anonymous";const t={img:e,loaded:!1,failed:!1,key:c,lastUsed:performance.now()};a.set(c,t),e.onload=()=>{t.loaded=!0,s?.()},e.onerror=()=>{t.loaded=!0,t.failed=!0,s?.()},e.src=l,u=t}if(!u.loaded){p=!1;continue}if(u.failed)continue;const m=d.scale;e.drawImage(u.img,(t[0]+d.translate[0])*m-.5,(t[1]+d.translate[1])*m-.5,m+1,m+1)}}(n,{tileURL:R,projection:t.scales.projection,width:He,height:$e,tileCache:gt.current,maxDevicePixelRatio:F,onTileLoad:()=>Ze()}),n.restore())}}if(m){const i=tl(e,We,Be,d);if(!i)return;i.clearRect(-Be.left,-Be.top,We[0],We[1]),R||function(e,t){const{background:n,hasBackgroundGraphics:r=!1,themeBackground:i="",x:o=0,y:a=0,width:s,height:l}=t,c=function(e){const{background:t,hasBackgroundGraphics:n=!1,themeBackground:r=""}=e;return"transparent"===t||n?null:t||(r&&"transparent"!==r?r:"")||null}({background:n,hasBackgroundGraphics:r,themeBackground:i});if(!c)return!1;const u=so(e,c);!u||"transparent"===u.trim().toLowerCase()||(e.fillStyle=u,e.fillRect(o,a,s,l))}(i,{background:O,themeBackground:ht,hasBackgroundGraphics:!!ge,x:-Be.left,y:-Be.top,width:We[0],height:We[1]}),i.save(),i.beginPath(),i.rect(0,0,He,$e),i.clip();const o=t.scene,a={width:He,height:$e};if(function(e){const{context:t,nodes:n,renderMode:r,pixelRatio:i,paintBuiltIn:o}=e;if(!r||"sketchy"===r)return void o(n);let a=[];const s=()=>{a.length&&(o(a),a=[])};for(const e of n){const n=Rc(r,e);if(!n){a.push(e);continue}let l;s(),t.save();try{l=n.drawCanvas({context:t,node:e,style:e.style??{},pixelRatio:i})}finally{t.restore()}l||(Lc(n.id,e.type??"unknown"),o([e]))}s()}({context:i,nodes:o,renderMode:B,pixelRatio:d,paintBuiltIn:e=>{!function(e,t){const n=t.filter(e=>"geoarea"===e.type);for(const t of n){if(!t.pathData)continue;t._cachedPath2D||(t._cachedPath2D=new Path2D(t.pathData));const n=t._cachedPath2D,r=Ts(e,t.style.fill)||"#e0e0e0";"none"!==r&&(e.fillStyle=r,e.globalAlpha=(t._decayOpacity??1)*(t.style.fillOpacity??1),e.fill(n));const i=t.style.strokeWidth??.5;if(t.style.stroke&&"none"!==t.style.stroke&&i>0){if(e.strokeStyle=so(e,t.style.stroke)||t.style.stroke,e.lineWidth=i,e.globalAlpha=t._decayOpacity??1,t.style.strokeDasharray){const n=t.style.strokeDasharray.split(",").map(Number);e.setLineDash(n)}else e.setLineDash([]);e.stroke(n)}ac(e,t,n),e.globalAlpha=1,e.setLineDash([])}}(i,e),((e,t,n,r)=>{const i=t.filter(e=>"line"===e.type);for(const t of i){if(2>t.path.length)continue;const n=t._introClipFraction;void 0!==n&&1>n&&(e.save(),e.beginPath(),e.rect(0,0,r.width*n,r.height),e.clip());const i=t.style.stroke||"#007bff",o=so(e,i)||i,a=t.style.strokeWidth??2,s=t.colorThresholds,l=t.rawValues;if(e.setLineDash(t.style.strokeDasharray?t.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),a>0&&(e.lineWidth=a),e.lineCap=t.style.strokeLinecap||"butt",t.style._edgeFade&&a>0){lc(e,t.path,o,a,t.style.opacity??1,t.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const c=Es(t.curve),u=s&&s.length>0&&l&&l.length===t.path.length,d=t._decayOpacities;if(a>0&&d&&d.length===t.path.length&&!u){e.strokeStyle=o;const n=t.style.opacity??1;for(let r=0;t.path.length-1>r;r++)e.globalAlpha=.5*(d[r]+d[r+1])*n,e.beginPath(),e.moveTo(t.path[r][0],t.path[r][1]),e.lineTo(t.path[r+1][0],t.path[r+1][1]),e.stroke()}else if(a>0&&!u){e.beginPath();const n=t.strokeGradient&&t.path.length>=2?zs(e,t.strokeGradient,o,t.path[0][0],0,t.path[t.path.length-1][0],0):null;if(e.strokeStyle=n||o,c)(0,sc.line)().x(e=>e[0]).y(e=>e[1]).curve(c).context(e)(t.path);else{const[n,r]=t.path[0];e.moveTo(n,r);for(let n=1;t.path.length>n;n++)e.lineTo(t.path[n][0],t.path[n][1])}e.stroke()}else if(a>0){const n=Os(t.path,l,s,o);for(const t of n){e.beginPath(),e.strokeStyle=so(e,t.color)||t.color,e.moveTo(t.path[0][0],t.path[0][1]);for(let n=1;t.path.length>n;n++)e.lineTo(t.path[n][0],t.path[n][1]);e.stroke()}}if(t.style.fill&&t.style.fillOpacity&&t.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=t.style.fillOpacity,e.fillStyle=Is(e,t.style.fill,t.style.fill),c&&!u)(0,sc.line)().x(e=>e[0]).y(e=>e[1]).curve(c).context(e)(t.path);else{const[n,r]=t.path[0];e.moveTo(n,r);for(let n=1;t.path.length>n;n++)e.lineTo(t.path[n][0],t.path[n][1])}const n=t.path[0][0];e.lineTo(t.path[t.path.length-1][0],r.height),e.lineTo(n,r.height),e.closePath(),e.fill()}void 0!==n&&1>n&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}})(i,e,0,a),((e,t)=>{const n=t.filter(e=>"point"===e.type);if(0!==n.length){e.save();try{const t=e.globalAlpha;for(const r of n){e.beginPath(),e.arc(r.x,r.y,r.r,0,2*Math.PI),e.globalAlpha=t*(r.style.opacity??r.style.fillOpacity??1),e.fillStyle=Is(e,r.style.fill,"#4e79a7"),e.fill();const n=r.style.strokeWidth??1;r.style.stroke&&"none"!==r.style.stroke&&n>0&&(e.strokeStyle=Is(e,r.style.stroke,r.style.stroke),e.lineWidth=n,e.stroke()),oc(e,r)}}finally{e.restore()}}})(i,e),((e,t)=>{const n=e.globalAlpha;for(const r of t)"glyph"===r.type&&cc(e,r,r.x,r.y,n);e.globalAlpha=n})(i,e)}}),h&&jt.current){const e=jt.current,t=o.filter(e=>"line"===e.type);if(t.length>0){const o=C||{},a=.3*(o.speedMultiplier??1),s=o.maxPerLine??Yc(),l=o.spawnRate??(Uc()?.06:.15),c=o.radius??2,u=o.opacity??.7,d=n/1e3,h=At.current>0?Math.min(d-At.current,.1):.016;At.current=d;const f=t.map(e=>e.path),p=t.map(e=>e.style.strokeWidth??2);for(let n=0;t.length>n;n++)Ue.random()<l&&e.countForLine(n)<s&&e.spawn(n,Ue.random);e.step(h,a,f,p),i.globalAlpha=u;for(let n=0;e.particles.length>n;n++){const r=e.particles[n];if(!r.active)continue;const a=t[r.lineIndex],s="function"==typeof o.color?o.color(a?.datum??{}):"source"!==o.color&&o.color?o.color:a?.style.stroke||"#fff";i.beginPath(),i.arc(r.x,r.y,c,0,2*Math.PI),i.fillStyle=s,i.fill()}i.globalAlpha=1,r=!0}}i.restore()}(u||a&&!s)&&e.setAttribute("aria-label",Ml(t.scene,"Geographic chart"));const y=Lt.current,v=!(!y||"geoarea"!==y.type&&"point"!==y.type),b=v||Pt.current;const x=Kt.current;if(x&&b){const e=tl(x,We,Be,d);if(e){if(e.clearRect(-Be.left,-Be.top,We[0],We[1]),y&&"geoarea"===y.type){const t=new Path2D(y.pathData);e.fillStyle="rgba(255, 255, 255, 0.3)",e.fill(t),e.strokeStyle="rgba(0, 0, 0, 0.5)",e.lineWidth=2,e.stroke(t)}if(y&&"point"===y.type){const t=y,n="object"==typeof U?U:void 0,r=n?.pointColor||function(e){if(!e)return null;if("heatcell"===e.type)return e.fill||null;if("candlestick"===e.type)return e.isUp?e.upColor:e.downColor;const{style:t}=e;if(!t)return null;const n="string"==typeof t.fill?t.fill:null;return"line"===e.type||"area"===e.type?t.stroke||n||null:n||t.stroke||null}(y);e.beginPath(),e.arc(t.x,t.y,t.r+3,0,2*Math.PI),r?(e.save(),e.globalAlpha=.4,e.fillStyle=r,e.fill(),e.restore()):(e.fillStyle="rgba(255, 255, 255, 0.4)",e.fill()),e.strokeStyle=r||"rgba(0, 0, 0, 0.5)",e.lineWidth=2,e.stroke()}}Pt.current=v}const w=te!==yt.current;w&&(yt.current=te),(u||w||a&&te&&te.length>0)&&(u||w||a&&!s||n-_t.current>=33)&&(Dt(e=>e+1),_t.current=n),(l||null!=t.activeTransition||p.pending||r)&&Ze()},function(e,t,n,r,i,o,a){const s=(0,Uo.useRef)("fresh");(0,Uo.useEffect)(()=>{if(!e)return void(s.current="fresh");const l=setInterval(()=>{const l=t.current;if(!l||0===l.lastIngestTime)return;const c=function(e,t){if(!e||0>=t)return Xo;const n=null!=e.threshold&&e.threshold>0?e.threshold:5e3,r=e.graded;if(r){const e="object"==typeof r?r:{},i=function(e,t,n={}){return Number.isFinite(t)&&t>0?Number.isNaN(e)?"fresh":e===1/0?"expired":0>e||t*(n.fresh??1)>e?"fresh":t*(n.aging??1.5)>e?"aging":t*(n.stale??3)>e?"stale":"expired":"fresh"}(t,n,e.thresholds);return{alpha:{...Yo,...e.opacities??{}}[i],band:i,isStale:"fresh"!==i}}return t>n?{alpha:e.dimOpacity??.5,band:"stale",isStale:!0}:Xo}(e,i()-l.lastIngestTime);c.band===s.current&&c.isStale===o||(s.current=c.band,c.isStale!==o&&a(c.isStale),n.current=!0,r())},1e3);return()=>clearInterval(l)},[e,o,r,i,t,a,n])}(ce,ot,De,Ze,Ue.now,Ot,Ft),(0,x.useEffect)(()=>{if("production"!==process.env.NODE_ENV&&R){const e=Zc(n);e&&"mercator"!==e&&console.warn(`[StreamGeoFrame] tileURL is set but projection is "${e}". Raster tiles use Web Mercator and will not align with other projections.`)}},[R,n]),(0,x.useEffect)(()=>{const e=wt.current;if(!k||!e)return vt.current&&e&&((0,rc.select)(e).on(".zoom",null),vt.current=null),void(e&&(0,rc.select)(e).on("mousedown.rotate",null).on("touchstart.rotate",null));const[t,n]=S||[1,8],r={width:He,height:$e};if(rt){let i=bt.current.k;const o=e=>{i=Math.max(t,Math.min(n,e)),bt.current=nc.zoomIdentity.scale(i);const o=ot.current;o&&(o.applyZoomScale(i,r),De.current=!1,Ze(),o.scales?.projection&&M?.({projection:o.scales.projection,zoom:o.currentZoom}))};vt.current={scaleBy:(e,t)=>o(i*t),transform:(e,t)=>o(t?.k??1)};const a=e=>{e.preventDefault(),o(i*(0>e.deltaY?1.1:1/1.1))},s=e=>{const t=e.target;t&&(t.closest("button")||t.closest(".stream-geo-zoom-controls"))||(e.preventDefault(),o(1.5*i))};e.addEventListener("wheel",a,{passive:!1}),e.addEventListener("dblclick",s);const l=.4,c=t=>{if(0!==t.button)return;const n=t.target;if(n.closest("button")||n.closest(".stream-geo-zoom-controls"))return;const r=ot.current;if(!r)return;const i=r.getRotation();St.current={x:t.clientX,y:t.clientY,rotation:[...i]},e.setPointerCapture(t.pointerId),t.preventDefault()},u=e=>{const t=St.current;t&&(Mt.current=[t.rotation[0]+(e.clientX-t.x)*l,Math.max(-90,Math.min(90,t.rotation[1]-(e.clientY-t.y)*l)),t.rotation[2]],Ze())},d=t=>{if(!St.current)return;St.current=null,e.releasePointerCapture(t.pointerId);const n=Mt.current;if(n){Mt.current=null;const e=ot.current;e&&(e.applyRotation(n,r),Ze())}const i=ot.current;i?.scales?.projection&&M?.({projection:i.scales.projection,zoom:i.currentZoom})};return e.addEventListener("pointerdown",c),e.addEventListener("pointermove",u),e.addEventListener("pointerup",d),e.addEventListener("pointercancel",d),()=>{e.removeEventListener("wheel",a),e.removeEventListener("dblclick",s),e.removeEventListener("pointerdown",c),e.removeEventListener("pointermove",u),e.removeEventListener("pointerup",d),e.removeEventListener("pointercancel",d),vt.current=null}}const i=(0,nc.zoom)().scaleExtent([t,n]).extent([[0,0],[We[0],We[1]]]).translateExtent([[-1/0,-1/0],[1/0,1/0]]).on("zoom",e=>{const t=e.transform;bt.current=t,xt.current=!0;const n=ot.current;n&&(n.applyZoomTransform(t,r),De.current=!1,Ze())}).on("end",e=>{bt.current=e.transform,xt.current=!1;const t=ot.current;t?.scales?.projection&&M?.({projection:t.scales.projection,zoom:t.currentZoom})});return vt.current=i,(0,rc.select)(e).call(i),()=>{(0,rc.select)(e).on(".zoom",null)}},[k,S,rt,We,He,$e,Be,M,Ze]);const an=V&&!1!==U,sn=an&&Tt?Y?Y(Tt):(0,lu.jsx)(qc,{data:Tt}):null,ln=sn?(0,lu.jsx)(tc,{x:Tt.x,y:Tt.y,containerWidth:He,containerHeight:$e,margin:Be,className:"stream-frame-tooltip",zIndex:10,children:sn}):null;if(ct){const e=at.scene;return(0,lu.jsxs)("div",{ref:kt,className:"stream-geo-frame"+(_?" "+_:""),role:"img","aria-label":Pe||("string"==typeof ve?ve:"Geographic chart"),style:{position:"relative",width:T?"100%":We[0],height:z?"100%":We[1]},children:[(0,lu.jsx)(Ol,{summary:Ne}),(0,lu.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:We[0],height:We[1],style:{position:"absolute",left:0,top:0},children:[ft?(0,lu.jsx)("rect",{className:"stream-frame-background__backdrop",x:0,y:0,width:We[0],height:We[1],fill:ft}):null,(0,lu.jsx)("g",{transform:`translate(${Be.left},${Be.top})`,children:dt}),(0,lu.jsx)("g",{transform:`translate(${Be.left},${Be.top})`,children:e.map((e,t)=>{return n={node:e,index:t,renderMode:B,fallback:()=>function(e,t){return Gs(function(e,t){switch(e.type){case"geoarea":{const n=e;if(!n.pathData)return null;const r=Ca(n.style.fill)?Na(n.style.fill,`geoarea-${t}-hatch`):void 0;return(0,Us.jsxs)(Vs.Fragment,{children:[r&&(0,Us.jsx)("defs",{children:r}),(0,Us.jsx)("path",{d:n.pathData,fill:r?`url(#geoarea-${t}-hatch)`:Ws(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-"+t)}case"point":{const n=e,r=Ca(n.style.fill)?Na(n.style.fill,`geopoint-${t}-hatch`):void 0;return(0,Us.jsxs)(Vs.Fragment,{children:[r&&(0,Us.jsx)("defs",{children:r}),(0,Us.jsx)("circle",{cx:n.x,cy:n.y,r:n.r,fill:r?`url(#geopoint-${t}-hatch)`:Ws(n.style.fill),fillOpacity:n.style.fillOpacity??.8,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n._decayOpacity??n.style.opacity??1})]},"point-"+t)}case"line":{const n=e;if(2>n.path.length)return null;const r="M"+n.path.map(e=>`${e[0]},${e[1]}`).join("L");return(0,Us.jsx)("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-"+t)}case"glyph":return function(e,t,n,r){const i=e.glyph;if(!i?.parts?.length||0>=e.size)return null;const o=Oi(i,e.size);if(0>=o.scale)return null;const a=`translate(${t},${n})${e.rotation?` rotate(${180*e.rotation/Math.PI})`:""} translate(${o.offsetX},${o.offsetY}) scale(${o.scale})`,s=e.color??("string"==typeof e.style.fill?e.style.fill:void 0),l=$i(i,e.fraction??1,e.fractionStart??0,e.fractionDirection??"horizontal"),c=l?function(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}(r+"-clip"):void 0,u=(e.style.opacity??1)*(e._decayOpacity??1)*(e.style.fillOpacity??1),d=t=>i.parts.map((n,r)=>{const i=t?"none"===n.fill?void 0:t:Wi(n.fill,s,e.accent),o=t?n.stroke&&"none"!==n.stroke?t:void 0:Wi(n.stroke??"none",s,e.accent);return i||o?(0,Fs.jsx)("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(0,Fs.jsxs)("g",{transform:a,opacity:1===u?void 0:u,children:[l&&c&&(0,Fs.jsx)("clipPath",{id:c,children:(0,Fs.jsx)("rect",{x:l.x,y:l.y,width:l.width,height:l.height})}),l&&e.ghostColor?(0,Fs.jsx)("g",{children:d(e.ghostColor)}):null,l&&c?(0,Fs.jsx)("g",{clipPath:`url(#${c})`,children:d()}):d()]},r)}(e,e.x,e.y,"geo-glyph-"+(e.pointId??t));default:return null}}(e,t),e,"geo-cursor-"+t)}(e,t)},function(e){const{node:t,index:n,renderMode:r,fallback:i}=e,o=Rc(r,t);if(!o)return{element:i(),renderedByBackend:!1};const a=o.renderStaticSVG({node:t,style:t.style??{},key:`${o.id}-${n}`});return null!=a?{element:Gs(a,t,`${o.id}-${n}-cursor`),renderedByBackend:!0}:(Lc(o.id,t.type??"unknown"),{element:i(),renderedByBackend:!1})}(n).element;var n})})]}),(0,lu.jsx)(Ps,{width:He,height:$e,totalWidth:We[0],totalHeight:We[1],margin:Be,showAxes:!1,title:ve,legend:be,legendPosition:xe,legendLayout:we,legendHoverBehavior:ke,legendClickBehavior:Se,legendHighlightedCategory:Me,legendIsolatedCategories:je,foregroundGraphics:wc(ut,Ac(ot.current?.customLayoutOverlays,d??null)),annotations:te,onAnnotationActivate:ne,onObservation:J??Q,chartId:ee,chartType:"StreamGeoFrame",autoPlaceAnnotations:re,svgAnnotationRules:ie,pointNodes:Pc(e),geoProjection:ot.current?.scales?.projectedPoint})]})}return(0,lu.jsxs)("div",{ref:kt,className:"stream-geo-frame"+(_?" "+_:""),role:"group","aria-label":Pe||("string"==typeof ve?ve:"Geographic chart"),tabIndex:0,style:{position:"relative",width:T?"100%":We[0],height:z?"100%":We[1],overflow:X?"visible":"hidden",...k?{touchAction:"none"}:{}},onKeyDown:nn,children:["production"!==process.env.NODE_ENV&&ot.current&&(0,lu.jsx)(Ti,{store:ot.current,diagnostics:Et.current}),Le&&(0,lu.jsxs)(Sl,{accessibleTable:Le,children:[(0,lu.jsx)(Fl,{tableId:Ve}),(0,lu.jsx)(_l,{scene:ot.current?.scene??[],chartType:"Geographic chart",tableId:Ve,chartTitle:"string"==typeof ve?ve:void 0})]}),(0,lu.jsx)(Ol,{summary:Ne}),(0,lu.jsx)(gl,{hoverPoint:Tt}),(0,lu.jsxs)("div",{role:"img","aria-label":Pe||("string"==typeof ve?ve:"Geographic chart"),style:{position:"relative",width:"100%",height:"100%"},onPointerMove:rn,onPointerLeave:Yt,onPointerDown:an||Te?on:void 0,onClick:Te?Jt:void 0,children:[(0,lu.jsx)(ol,{size:We,margin:Be,backdropFill:ft??void 0,children:dt}),R&&(0,lu.jsx)("canvas",{ref:pt,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),(0,lu.jsx)("canvas",{ref:Zt,"aria-label":Ml(ot.current?.scene??[],"Geographic chart"),style:{position:"absolute",left:0,top:0}}),(0,lu.jsx)("canvas",{ref:Kt,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),(0,lu.jsx)(Ps,{width:He,height:$e,totalWidth:We[0],totalHeight:We[1],margin:Be,showAxes:Re,title:ve,legend:be,legendPosition:xe,legendLayout:we,legendHoverBehavior:ke,legendClickBehavior:Se,legendHighlightedCategory:Me,legendIsolatedCategories:je,foregroundGraphics:wc(ut,Ac(ot.current?.customLayoutOverlays,d??null)),annotations:te,onAnnotationActivate:ne,onObservation:J??Q,chartId:ee,chartType:"StreamGeoFrame",autoPlaceAnnotations:re,svgAnnotationRules:ie,pointNodes:Pc(ot.current?.scene),geoProjection:ot.current?.scales?.projectedPoint}),ce?.showBadge&&(0,lu.jsx)(Ko,{isStale:Ot,position:ce.badgePosition}),k&&(0,lu.jsxs)("div",{className:"stream-geo-zoom-controls",style:{position:"absolute",bottom:Be.bottom+8,left:Be.left+8,display:"flex",flexDirection:"column",gap:2,zIndex:2},children:[(0,lu.jsx)("button",{type:"button","aria-label":"Zoom in",onClick:e=>{e.stopPropagation();const t=wt.current,n=vt.current;t&&n?.scaleBy&&n.scaleBy((0,rc.select)(t),1.5)},style:Xc,children:"+"}),(0,lu.jsx)("button",{type:"button","aria-label":"Zoom out",onClick:e=>{e.stopPropagation();const t=wt.current,n=vt.current;t&&n?.scaleBy&&n.scaleBy((0,rc.select)(t),1/1.5)},style:Xc,children:"−"})]}),L&&(0,lu.jsx)("div",{className:"stream-geo-tile-attribution",style:{position:"absolute",bottom:Be.bottom+2,right:Be.right+4,fontSize:10,color:"rgba(0,0,0,0.6)",background:"rgba(255,255,255,0.7)",padding:"1px 4px",borderRadius:2,pointerEvents:"none",zIndex:2},children:L}),(0,lu.jsx)(Gl,{active:en.current>=0,hoverPoint:Tt,margin:Be,size:We,shape:tn.current?.shape,width:tn.current?.w,height:tn.current?.h,pathData:tn.current?.pathData}),ln]})]})}));cu.displayName="StreamGeoFrame";var uu=cu,du=require("react"),hu=require("react"),fu=require("./semiotic-client-cjs-shared.min.js");function pu(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField,seriesField:e.seriesField}:null}var mu=.5;function gu(e,t,n){return t?(r,...i)=>{const o={...e(r,...i)};if(t.isActive)if(t.predicate(r))n?.selectedStyle&&Object.assign(o,n.selectedStyle);else{const e=n?.unselectedOpacity??mu;o.opacity=e,o.fillOpacity=e,o.strokeOpacity=e,n?.unselectedStyle&&Object.assign(o,n.unselectedStyle)}return o}:e}var yu=require("./semiotic-client-cjs-shared.min.js"),vu=require("./semiotic-client-cjs-shared.min.js"),bu=require("./semiotic-client-cjs-shared.min.js"),xu=require("./semiotic-client-cjs-shared.min.js");function wu(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function ku(e,t){const{when:n}=e,r=t.width,i=t.height,o=function(e){if("number"==typeof e.height&&e.height>0)return e.width/e.height}(t),a=function(e){if("number"==typeof e.height&&e.height>0)return e.height>e.width?"portrait":"landscape"}(t);return!("number"==typeof n.minWidth&&n.minWidth>r||"number"==typeof n.maxWidth&&r>n.maxWidth||"number"==typeof n.minHeight&&("number"!=typeof i||n.minHeight>i)||"number"==typeof n.maxHeight&&("number"!=typeof i||i>n.maxHeight)||"number"==typeof n.minAspectRatio&&("number"!=typeof o||n.minAspectRatio>o)||"number"==typeof n.maxAspectRatio&&("number"!=typeof o||o>n.maxAspectRatio)||n.orientation&&a!==n.orientation)}function Su(e,t,n=e.responsiveRules){if(!Array.isArray(n)||0===n.length)return{props:e,matches:[]};const r=n.map((e,t)=>({rule:e,index:t})).filter(e=>ku(e.rule,t)).sort((e,t)=>("number"==typeof e.rule.priority?e.rule.priority:e.index)-("number"==typeof t.rule.priority?t.rule.priority:t.index));return{props:r.reduce((e,t)=>function(e,t){const n={...e,...t};for(const r of["margin","frameProps","mobileSemantics","style"])wu(e[r])&&wu(t[r])&&(n[r]={...e[r],...t[r]});return"string"==typeof e.className&&"string"==typeof t.className&&(n.className=`${e.className} ${t.className}`),n}(e,t.rule.transform),e),matches:r}}var Mu=44,ju={enabled:!0,tapToSelect:!0,tapToLockTooltip:!0,clearSelection:"backgroundTap",targetSize:Mu,snap:"nearestDatum",brushHandleSize:Mu,standardControls:!1,enabled:!1,tapToSelect:!1,tapToLockTooltip:!1};function Au(e,t={}){const n=t.mobileSemantics?.interaction,r="number"==typeof n?.targetSize?n.targetSize:"number"==typeof t.mobileSemantics?.minimumHitTarget?t.mobileSemantics.minimumHitTarget:void 0,i="mobile"===t.mode||"number"==typeof t.width&&480>=t.width,o=!!n||void 0!==r,a=e&&"object"==typeof e?e:void 0;if(!1===e||!1===a?.enabled||void 0===e&&!i&&!o)return ju;const s=a??{};return{enabled:!0,tapToSelect:s.tapToSelect??!0,tapToLockTooltip:s.tapToLockTooltip??!0,clearSelection:s.clearSelection??"backgroundTap",targetSize:s.targetSize??r??Mu,snap:s.snap??"nearestDatum",brushHandleSize:s.brushHandleSize??Mu,standardControls:s.standardControls??!1}}var Cu={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}}},Ru={top:10,bottom:10,left:10,right:10};function Lu(e){return e.compactMode?e.marginDefaults:Ru}function Pu(e,t,n){if(!1!==t)return e;const r={...e};return"horizontal"===n?r.left=Math.min(r.left,15):r.bottom=Math.min(r.bottom,15),r}function Nu(e,t,n){const r=e.xValue??t?.[n];if(null==r)return null;const i=Number(r);return Number.isFinite(i)?i:null}function Eu(e){let t=e.data||e.datum||e;return Array.isArray(t)&&(t=t[0]),null!=e.xValue&&t&&"object"==typeof t&&!Array.isArray(t)&&null==t.xValue?{...t,xValue:e.xValue}:t||{}}function Iu(e){if(!e)return!1;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}var Tu=require("react"),zu=require("react"),Du=(require("./semiotic-client-cjs-shared.min.js"),require("./semiotic-client-cjs-shared.min.js"),require("./semiotic-client-cjs-shared.min.js"),require("./semiotic-client-cjs-shared.min.js"),require("./semiotic-client-cjs-shared.min.js"),require("./semiotic-client-cjs-shared.min.js"),require("react/jsx-runtime"),(0,zu.createContext)(!1));(0,zu.createContext)(!1);var _u=(0,zu.createContext)(null),Ou="undefined"==typeof window?zu.useEffect:zu.useLayoutEffect;function Fu(e,t){if(!t)return[];const n=new Set;for(const r of e){const e="function"==typeof t?t(r):r[t];n.add(e+"")}return Array.from(n)}function Wu(e,t){return null!=e&&Object.hasOwn(e,t)}function Bu({data:e,colorBy:t,colorScale:n,showLegend:r,legendPosition:i,userMargin:o,defaults:a={top:50,bottom:60,left:70,right:40},categories:s,additionalLegend:l,chartWidth:c,chartHeight:u,legendLayout:d,frameLegend:h,hasTitle:f=!1,axisChrome:p}){const{legendPosition:m,legendLayout:g}=function(e,t,n){const r=Wu(n,"legendPosition"),i=Wu(n,"legendLayout");return{legendPosition:r?n?.legendPosition??"right":e??"right",legendLayout:i?n?.legendLayout:t}}(i,d,h),y=Wu(h,"legend"),v=(0,zu.useContext)(Du),b=null!==(0,zu.useContext)(_u),x=void 0!==r?r:!v&&!!t,w=!!t&&(x||b),k=(0,Tu.useMemo)(()=>w?void 0!==s?s:Fu(e,t):[],[s,t,e,w]);!function(e){const t=(0,zu.useContext)(_u),n=(0,zu.useId)(),r=function(e){const t=new Set,n=[];for(const r of e)t.has(r)||(t.add(r),n.push(r));return n}(e),i=(0,zu.useRef)([]);(function(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0})(i.current,r)||(i.current=r);const o=i.current;Ou(()=>{if(t)return()=>t.unregisterCategories(n)},[t,n]),Ou(()=>{t&&t.registerCategories(n,o)},[t,n,o])}(b&&t?k:[]);const S=(0,Tu.useMemo)(()=>{if(!x||!t)return;const r=function({data:e,colorBy:t,colorScale:n,getColor:r,strokeColor:i,strokeWidth:o,categories:a}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};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(e.map(e=>"function"==typeof t?t(e):e[t])))).map((i,o)=>{const a=e.find("function"==typeof t?e=>t(e)===i:e=>e[t]===i),s=a?r(a,t,n):n?n(i):Br[o%Br.length];return{label:i+"",color:s,__semioticCategory:!0}}),label:""}]}}({data:e,colorBy:t,colorScale:n,getColor:$r,categories:k});return 0!==r.legendGroups.reduce((e,t)=>e+t.items.length,0)?r:void 0},[x,t,e,n,k]),M=(0,Tu.useMemo)(()=>y?h?.legend:function(...e){let t;for(const n of e)n&&(t=po(t)&&po(n)?{legendGroups:[...t.legendGroups,...n.legendGroups],legendDistance:n.legendDistance??t.legendDistance}:n);return t}(S,l),[S,l,h?.legend,y]),{hasAxis:j,hasAxisLabel:A,rotatedTicks:C,topAxis:R,leftAxis:L,rightAxis:P}=p??{},N=void 0!==R,E=void 0!==L,I=void 0!==P,{hasAxis:T,hasAxisLabel:z,rotatedTicks:D}=R??{},{hasAxis:_,hasAxisLabel:O}=L??{},{hasAxis:F,hasAxisLabel:W}=P??{},B=(0,Tu.useMemo)(()=>{const e="number"==typeof o?{top:o,bottom:o,left:o,right:o}:o??{},t=t=>{const n=e[t];return"number"==typeof n?n:a[t]},n={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},r={...n};return M&&(Fo(n,{legend:M,position:m,size:[c??600,u??400],hasTitle:f,legendLayout:g,minimumMargin:"bottom"===m?80:"top"===m?50:0,axisChrome:void 0===j?{hasAxis:!0,hasAxisLabel:!0}:{hasAxis:j,hasAxisLabel:A,rotatedTicks:C,topAxis:N?{hasAxis:T,hasAxisLabel:z,rotatedTicks:D}:void 0,leftAxis:E?{hasAxis:_,hasAxisLabel:O}:void 0,rightAxis:I?{hasAxis:F,hasAxisLabel:W}:void 0}}),null!=c&&null!=u&&So(n,r,[c,u],m)),n},[a,o,M,m,c,u,g,f,j,A,C,N,T,z,D,E,_,O,I,F,W]);return{legend:M,margin:B,legendPosition:m,legendLayout:g,legendMarginReserved:void 0!==M&&!Wu(h,"margin"),hasAutomaticLegend:void 0!==S}}function Hu(e){const t=e.valueRange;return Array.isArray(t)&&2===t.length&&"number"==typeof t[0]&&"number"==typeof t[1]?[t[0],t[1]]:null}function $u(e,t){return"string"==typeof e.interactionKey?e.interactionKey:`${t[0]}:${t[1]}`}var qu=[];function Gu(){const e=(0,xu.useTheme)(),t=e?.colors?.categorical;return t&&t.length>0?t:void 0}function Vu({selection:e,linkedHover:t,fallbackFields:n=qu,unwrapData:r=!1,onObservation:i,chartType:o,chartId:a,onClick:s,hoverHighlight:l,colorByField:c,mobileInteraction:u}){const d=(0,hu.useId)(),h=(0,hu.useMemo)(()=>pu(t,n),[t,n]),f=(0,hu.useMemo)(()=>"series"===h?.mode?[h.seriesField||c||n[0]].filter(e=>!!e):h?.fields||n,[h,c,n]),p=(0,yu.useSelection)({name:e?.name||"__unused__",fields:f}),m=(0,yu.useLinkedHover)({name:h?.name||"hover",fields:f}),g=(0,bu.useObservationSelector)(e=>e.pushObservation),y=(0,hu.useCallback)(e=>{i?.(e),g?.(e)},[i,g]),v=e?{isActive:p.isActive,predicate:p.predicate}:null,[b,x]=(0,hu.useState)(null),w=(0,hu.useRef)(!1),k=c||n[0],S=(0,hu.useMemo)(()=>{if(!l||null==b||!k)return null;const e=b,t=k;return{isActive:!0,predicate:n=>("string"==typeof n[t]?n[t]:(n[t]??"")+"")===e}},[l,b,k]),M=(0,hu.useCallback)((e,n)=>{const r=!e&&w.current&&!!u?.enabled&&u.tapToLockTooltip;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===h?.mode&&h.xField){const n=Nu(e,t,h.xField);null!=n&&(0,vu.setCrosshairPosition)(h.name||"hover",n,d)}"x-position"!==h?.mode&&m.onHover(t)}else"x-position"!==h?.mode||r||(0,vu.clearCrosshairPosition)(h.name||"hover",d),"x-position"===h?.mode||r||m.onHover(null);if(l&&k)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=t?.[k];x(null!=n?n+"":null)}else r||x(null);(i||g)&&Jc({onObservation:y,datum:e?Eu(e):null,x:e?.x,y:e?.y,chartType:o||"unknown",chartId:a,context:n})},[t,m,h,d,i,o,a,g,y,l,k,u]),j=(0,hu.useCallback)((n=!0)=>{w.current=!1,t&&"x-position"!==h?.mode&&m.onHover(null),e&&u?.tapToSelect&&p.clear(),n&&l&&x(null),"x-position"===h?.mode&&((0,vu.unlockCrosshair)(h.name||"hover",d),(0,vu.clearCrosshairPosition)(h.name||"hover",d))},[t,h,m,e,u,p,l,d]),A=(0,hu.useCallback)((n,r)=>{const c=!!u?.enabled&&(u.tapToLockTooltip||u.tapToSelect),v=!!u?.enabled&&"backgroundTap"===u.clearSelection;if("x-position"===h?.mode&&h.xField&&n){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]);const t=Nu(n,e,h.xField);null!=t&&(0,vu.toggleCrosshairLock)(h.name||"hover",t,d)}if(c)if(n){w.current=!0;const r=Eu(n);if(t&&"x-position"!==h?.mode&&m.onHover(r),e&&u?.tapToSelect&&f.length>0){const e={};for(const t of f){const n=r[t];void 0!==n&&(e[t]=[n])}Iu(e)&&p.selectPoints(e)}if(l&&k){const e=r?.[k];x(null!=e?e+"":null)}}else v&&j();if(n||v){if(n&&s){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]),s(e,{x:n.x??0,y:n.y??0})}(i||g)&&eu({onObservation:y,datum:n?Eu(n):null,x:n?.x,y:n?.y,chartType:o||"unknown",chartId:a,context:r})}},[s,i,g,y,o,a,h,d,u,t,m,e,p,f,l,k,j]);return(0,hu.useEffect)(()=>{if(!u?.enabled||"undefined"==typeof document)return;const e=e=>{"Escape"===e.key&&w.current&&j()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[u?.enabled,j]),(0,hu.useEffect)(()=>()=>{w.current&&j(!1)},[j]),(0,hu.useEffect)(()=>{if("x-position"!==h?.mode)return;const e=h.name||"hover";return()=>{(0,vu.unlockCrosshair)(e,d),(0,vu.clearCrosshairPosition)(e,d)}},[h?.mode,h?.name,d]),{activeSelectionHook:v,hoverSelectionHook:S,customHoverBehavior:M,customClickBehavior:A,crosshairSourceId:d}}function Uu(e,t,n){return function(e,t,n){const r=Cu[e||"primary"],i=e&&"primary"!==e||!n?.width?r.width:n.width,o=e&&"primary"!==e||!n?.height?r.height:n.height,a=Su({...t,mode:e},{width:t.width??i,height:t.height??o}).props,s=a.mode||e||"primary",l=Cu[s],c="context"===s||"sparkline"===s,u="primary"===s&&n?.width?n.width:l.width;return{mode:s,width:a.width??u,height:a.height??("primary"===s&&n?.height?n.height:l.height),showAxes:a.showAxes??l.showAxes,showGrid:a.showGrid??l.showGrid,enableHover:a.enableHover??(!!a.linkedHover||l.enableHover),showLegend:a.showLegend??l.showLegend,showLabels:a.showLabels??l.showLabels,title:c?void 0:a.title,description:a.description,summary:a.summary,accessibleTable:a.accessibleTable,xLabel:c?void 0:a.xLabel,yLabel:c?void 0:a.yLabel,categoryLabel:c?void 0:a.categoryLabel,valueLabel:c?void 0:a.valueLabel,marginDefaults:Pu(l.marginDefaults,a.showCategoryTicks,a.orientation),compactMode:c,mobileInteraction:Au(a.mobileInteraction,{mode:s,width:a.width??u,mobileSemantics:a.mobileSemantics}),mobileSemantics:a.mobileSemantics}}(e,t,n)}function Yu(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return e??((...e)=>({}));const n={};return void 0!==t.stroke&&(n.stroke=t.stroke),void 0!==t.strokeWidth&&(n.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(n.opacity=t.opacity),e?(...t)=>({...e(...t)||{},...n}):(...e)=>({...n})}function Xu(e){if(null==e)return()=>{};const t="function"==typeof e?e:t=>t[e];return e=>Ku(t(e))}function Zu(e,t){const n=Xu(t??"value"),r=null==e?void 0:"function"==typeof e?e:t=>t[e];return e=>{const t=r?r(e):void 0;return{value:n(e),category:null==t?void 0:t+""}}}function Ku(e){if("number"==typeof e)return Number.isFinite(e)?e:void 0;if("string"==typeof e&&""!==e.trim()){const t=Number(e);return Number.isFinite(t)?t:void 0}}function Qu(e,t,n){const r=null!=e.axis?n[e.axis]:null!=e.field?t[e.field]:n.value;if(void 0!==e.eq&&r!==e.eq)return!1;if(void 0!==e.ne&&r===e.ne)return!1;if(void 0!==e.in&&!e.in.includes(r))return!1;if(void 0===e.gt&&void 0===e.gte&&void 0===e.lt&&void 0===e.lte&&void 0===e.within&&void 0===e.outside)return!0;const i=Ku(r);if(void 0===i)return!1;if(void 0!==e.gt&&e.gt>=i)return!1;if(void 0!==e.gte&&e.gte>i)return!1;if(void 0!==e.lt&&i>=e.lt)return!1;if(void 0!==e.lte&&i>e.lte)return!1;if(void 0!==e.within){const[t,n]=e.within;if(t>i||i>n)return!1}if(void 0!==e.outside){const[t,n]=e.outside;if(i>=t&&n>=i)return!1}return!0}function Ju(e,t,n){const r=e.when;return void 0===r||!0===r||!1!==r&&("function"==typeof r?r(t,n):Qu(r,t,n))}function ed(e,t,n){if(!t||0===t.length)return{};let r={};for(const i of t){if(!Ju(i,e,n))continue;const t="function"==typeof i.style?i.style(e,n):i.style;t&&(r={...r,...t})}return r}function td(e,t,n,r=e=>e){const i=e??(()=>({}));return t&&0!==t.length?(e,o)=>{const a=r(e),s={...i(e,o)};return Object.assign(s,ed(a,t,n(a,o))),s}:i}var nd=require("react/jsx-runtime");function rd({componentName:e,message:t,diagnosticHint:n,width:r,height:i}){return(0,nd.jsx)("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:(0,nd.jsxs)("div",{style:{textAlign:"center",maxWidth:400},children:[(0,nd.jsx)("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:e}),(0,nd.jsx)("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:t}),n&&(0,nd.jsx)("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:n})]})})}var id=d(require("react")),od=require("react/jsx-runtime"),ad=class extends id.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){this.props.onError?.(e,t)}render(){if(this.state.error){const{fallback:e}=this.props,t=this.state.error;return"function"==typeof e?e(t):void 0!==e?e:(0,od.jsx)(rd,{componentName:"ChartErrorBoundary",message:t.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}},sd=require("react/jsx-runtime"),ld="undefined"!=typeof process&&"production"!==process.env?.NODE_ENV;function cd({componentName:e,width:t,height:n,children:r}){return(0,sd.jsx)(ad,{fallback:r=>(0,sd.jsx)(rd,{componentName:e,message:r.message,width:t,height:n}),children:r})}var ud={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"},dd={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function hd(e,t,n,r){return!1===r||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?(0,sd.jsx)("div",{style:{...ud,width:t,height:n},children:r||"No data available"}):null}function fd(e,t,n,r){if(!e)return null;if(!1===r)return null;if(null!=r)return(0,sd.jsx)("div",{style:{width:t,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(0,sd.jsx)("div",{style:{width:t,height:n,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:i},(e,n)=>(0,sd.jsx)("div",{className:"semiotic-loading-bar",style:{...dd,position:"absolute",top:s+n*(o+a),left:Math.floor(.1*t),width:30+(37*n+13)%50+"%",height:o,opacity:.5+n%2*.2}},n))})}function pd(e,t,n,r){if(!ld)return;if(!t||0===t.length)return;if("string"!=typeof r)return;const i=t[0];if(!i||"object"!=typeof i)return;if(r in i)return;const o=Object.keys(i).join(", ");console.warn(`[semiotic] ${e}: ${n} "${r}" not found in data. Available keys: ${o}`)}var md=require("react"),gd=require("./semiotic-client-cjs-shared.min.js");function yd(e){const t=(0,gd.useThemeSelector)(e=>e.theme.colors.selectionOpacity);return(0,md.useMemo)(()=>{if(void 0!==e||void 0!==t)return{name:e?.name??"",...e,unselectedOpacity:e?.unselectedOpacity??t}},[e,t])}var vd=require("d3-scale"),bd=require("react"),xd=require("topojson-client"),wd=new Map;function kd(e){return"default"in e?e.default:e}var Sd="Install the optional peer dependency `world-atlas` (`npm install world-atlas`) to use built-in reference geographies, or pass GeoJSON Feature[] to `areas`.";async function Md(e){const t=wd.get(e);if(t)return t;const{topology:n,objectName:r}=await async function(e){try{switch(e){case"world-110m":return{topology:kd(await import("world-atlas/countries-110m.json")),objectName:"countries"};case"world-50m":return{topology:kd(await import("world-atlas/countries-50m.json")),objectName:"countries"};case"land-110m":return{topology:kd(await import("world-atlas/land-110m.json")),objectName:"land"};case"land-50m":return{topology:kd(await import("world-atlas/land-50m.json")),objectName:"land"};default:throw Error(`Unknown reference geography: "${e}". Supported: "world-110m", "world-50m", "land-110m", "land-50m".`)}}catch(t){if(/Cannot find module|Failed to resolve|world-atlas/i.test(t instanceof Error?t.message:t+""))throw Error(`resolveReferenceGeography("${e}"): ${Sd}`,{cause:t});throw t}}(e);if(!n||!n.objects)throw Error(`resolveReferenceGeography("${e}"): Failed to load topology. Got ${typeof n} with keys: ${n?Object.keys(n).join(", "):"none"}`);const i=(0,xd.feature)(n,n.objects[r]),o="features"in i?i.features:[i];return wd.set(e,o),o}function jd(e){const t=(0,bd.useMemo)(()=>Array.isArray(e)?e:void 0,[e]),[n,r]=(0,bd.useState)(null);return(0,bd.useEffect)(()=>{if(e&&!Array.isArray(e)){if("string"==typeof(t=e)&&["world-110m","world-50m","land-110m","land-50m"].includes(t)){let t=!1;return r(null),Md(e).then(e=>{t||r(e)}),()=>{t=!0}}var t;"production"!==process.env.NODE_ENV&&console.warn(`[semiotic] Unknown areas reference: "${e}". Supported: "world-110m", "world-50m", "land-110m", "land-50m".`),r(null)}else r(null)},[e]),void 0!==t?t:n}function Ad(e){const{title:t,description:n,summary:r,accessibleTable:i,className:o,animate:a,maxDevicePixelRatio:s,axisExtent:l,autoPlaceAnnotations:c}=e,u={};return t&&(u.title=t),n&&(u.description=n),r&&(u.summary=r),void 0!==i&&(u.accessibleTable=i),o&&(u.className=o),null!=a&&(u.animate=a),void 0!==s&&(u.maxDevicePixelRatio=s),void 0!==l&&(u.axisExtent=l),void 0!==c&&(u.autoPlaceAnnotations=c),u}function Cd(e){const{linkedHover:t,selection:n,onObservation:r,onClick:i,hoverRadius:o,hoverHighlight:a,forceHoverBehavior:s,forceClickBehavior:l,mobileInteraction:c,customHoverBehavior:u,customClickBehavior:d,linkedHoverInClickPredicate:h=!0}=e,f={};r&&(f.annotationObservationCallback=r);const p=c?.enabled?Math.max(o??30,Math.ceil((c.targetSize||44)/2),24):o;return(s||t||r||i||a)&&(f.customHoverBehavior=u),d&&(l||(h?r||i||t:r||i)||c?.enabled&&(c.tapToSelect||c.tapToLockTooltip)&&(t||a||n))&&(f.customClickBehavior=d),null!=p&&(f.hoverRadius=p),f}var Rd=require("react/jsx-runtime");function Ld(e){const t=Uu(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,enableHover:e.enableHover,linkedHover:e.linkedHover,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=function(){const e=(0,xu.useTheme)();return e?.colors?.sequential||void 0}(),{areas:r,valueAccessor:i,styleRules:o,colorScheme:a,projection:s="equalEarth",graticule:l,fitPadding:c,zoomable:u,zoomExtent:d,onZoom:h,dragRotate:f,tileURL:p,tileAttribution:m,tileCacheSize:g,tooltip:y,areaOpacity:v=1,annotations:b,legendInteraction:x,legendPosition:w,margin:k,className:S,selection:M,linkedHover:j,onObservation:A,onClick:C,chartId:R,loading:L,loadingContent:P,emptyContent:N,frameProps:E={},stroke:I,strokeWidth:T,opacity:z}=e,D=u??!!p,_=jd(r),O=(0,du.useMemo)(()=>_?Hl(_):_,[_]),F=(0,du.useMemo)(()=>"function"==typeof i?i:e=>e?.properties?.[i]??e?.[i],[i]),W=a??n??"blues",B=(0,du.useMemo)(()=>{if(!O)return(0,vd.scaleSequential)(_r(void 0)).domain([0,1]);let e=1/0,t=-1/0;for(const n of O){const r=F(n);null!=r&&isFinite(r)&&(e>r&&(e=r),r>t&&(t=r))}const n=_r(W);return(0,vd.scaleSequential)(n).domain([Number.isFinite(e)?e:0,Number.isFinite(t)?t:1])},[O,F,W]),H=(0,du.useMemo)(()=>{const e=B.domain();return[e[0]??0,e[1]??1]},[B]),$=function(e,t,n,r=5){const[i,o]=n,[a,s]=(0,Tu.useState)(null),[l,c]=(0,Tu.useState)(new Map),u=(0,Tu.useMemo)(()=>new Set,[]);(0,Tu.useEffect)(()=>{s(null),c(new Map)},[i,o,r,e]);const d=(0,Tu.useCallback)(t=>{if("highlight"!==e||!t)return void("highlight"===e&&s(null));const n=Hu(t);n&&s({key:$u(t,n),range:n})},[e]),h=(0,Tu.useCallback)(t=>{if("isolate"!==e)return;const n=Hu(t);n&&c(e=>{const i=new Map(e),o=$u(t,n);return i.has(o)?i.delete(o):i.set(o,n),i.size===r?new Map:i})},[r,e]),f=(0,Tu.useMemo)(()=>{const n="highlight"===e&&a?[a.range]:"isolate"===e?[...l.values()]:[];return 0===n.length?null:{isActive:!0,predicate:e=>{const r=t(e);return Number.isFinite(r)&&n.some(([e,t])=>r>=Math.min(e,t)&&Math.max(e,t)>=r)}}},[a,l,e,t]);return{highlightedCategory:"highlight"===e?a?.key??null:null,isolatedCategories:"isolate"===e?new Set(l.keys()):u,onLegendHover:d,onLegendClick:h,legendSelectionHook:f}}(x,F,H),{activeSelectionHook:q,hoverSelectionHook:G,customHoverBehavior:V,customClickBehavior:U}=Vu({selection:M,linkedHover:j,onObservation:A,onClick:C,chartType:"ChoroplethMap",chartId:R,mobileInteraction:t.mobileInteraction}),Y=yd(M),X=G||$.legendSelectionHook||q,Z=(0,du.useMemo)(()=>{const e=Yu(td(e=>{const t=F(e);return{fill:null!=t&&isFinite(t)?B(t):"#ccc",stroke:"#999",strokeWidth:.5,fillOpacity:v}},o,e=>({value:F(e)}),e=>e&&"object"==typeof e&&e.properties?{...e.properties,...e}:e),{stroke:I,strokeWidth:T,opacity:z});return X?gu(e,X,Y):e},[F,B,X,Y,v,I,T,z,o]),K=(0,du.useMemo)(()=>e=>{const t=e?.properties?.name||e?.properties?.NAME||e?.name||e?.NAME||"Feature",n=F(e);return(0,Rd.jsxs)("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[(0,Rd.jsx)("div",{style:{fontWeight:600},children:t}),null!=n&&(0,Rd.jsx)("div",{style:{opacity:.7},children:(r=n,"number"==typeof r&&isFinite(r)?Number.isInteger(r)?r.toLocaleString():r.toLocaleString(void 0,{maximumFractionDigits:2}):(r??"")+"")})]});var r},[F]),Q=Lu(t),J=(0,du.useMemo)(()=>{if(!1!==t.showLegend)return{gradient:{colorFn:e=>B(e),domain:H,label:"string"==typeof i?i:"value"}}},[B,t.showLegend,i,H]),{legend:ee,margin:te,legendPosition:ne,legendMarginReserved:re}=Bu({data:[],colorBy:void 0,colorScale:void 0,showLegend:!1,legendPosition:w,userMargin:k,defaults:Q,additionalLegend:J,chartWidth:t.width,chartHeight:t.height,legendLayout:E.legendLayout,frameLegend:E,hasTitle:!!t.title,axisChrome:{hasAxis:!1}}),ie=fd(L,t.width,t.height,P)||(O?null:fd(!0,t.width,t.height,P)),oe=ie?null:hd(O,t.width,t.height,N);if(Array.isArray(O)&&O.length>0){const e=O[0];if(!e||"object"!=typeof e||!e.geometry)return(0,Rd.jsx)(rd,{componentName:"ChoroplethMap",message:"ChoroplethMap: areas must be an array of GeoJSON Features with a geometry property.",width:t.width,height:t.height})}const ae={projection:s,areas:O,areaStyle:Z,size:[t.width,t.height],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,maxDevicePixelRatio:e.maxDevicePixelRatio,margin:te,enableHover:t.enableHover,...ee&&{legend:ee,legendPosition:ne},...re&&{__legendMarginReservedFor:ee},legendHoverBehavior:$.onLegendHover,legendClickBehavior:$.onLegendClick,legendHighlightedCategory:$.highlightedCategory,legendIsolatedCategories:"isolate"===x?$.isolatedCategories:void 0,tooltipContent:!1===y?()=>null:!0===y?K:Hc(y)||K,...null!=l&&{graticule:l},...null!=c&&{fitPadding:c},...D&&{zoomable:!0},...d&&{zoomExtent:d},...h&&{onZoom:h},...null!=f&&{dragRotate:f},...p&&{tileURL:p},...m&&{tileAttribution:m},...g&&{tileCacheSize:g},...Cd({linkedHover:j,selection:M,onObservation:A,onClick:C,mobileInteraction:t.mobileInteraction,customHoverBehavior:V,customClickBehavior:U,linkedHoverInClickPredicate:!1}),...b&&b.length>0&&{annotations:b},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...t.title&&{title:t.title},...t.description&&{description:t.description},...t.summary&&{summary:t.summary},...void 0!==t.accessibleTable&&{accessibleTable:t.accessibleTable},...S&&{className:S},...null!=e.animate&&{animate:e.animate},...E};return ie||oe||(0,Rd.jsx)(cd,{componentName:"ChoroplethMap",width:t.width,height:t.height,children:(0,Rd.jsx)(uu,{...ae})})}Ld.displayName="ChoroplethMap";var Pd=require("react"),Nd=require("react"),Ed=require("./semiotic-client-cjs-shared.min.js");function Id(e){const{data:t,rawData:n,colorBy:r,colorScheme:i,legendInteraction:o,legendPosition:a,selection:s,linkedHover:l,fallbackFields:c,unwrapData:u=!1,onObservation:d,chartType:h,chartId:f,showLegend:p,legend:m,legendLayout:g,frameLegend:y,userMargin:v,marginDefaults:b,onClick:x,hoverHighlight:w,mobileInteraction:k,mobileSemantics:S,loading:M,loadingContent:j,emptyContent:A,width:C,height:R,hasTitle:L,axisChrome:P}=e,N=void 0===n,E=(0,Nd.useMemo)(()=>Hl(t),[t]),[I,T]=(0,Nd.useState)([]),z=(0,Nd.useCallback)(e=>{T(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[]),D="string"==typeof r?r:void 0,_=(0,Nd.useMemo)(()=>Au(k,{width:C,mobileSemantics:S}),[k,C,S]),{activeSelectionHook:O,hoverSelectionHook:F,customHoverBehavior:W,customClickBehavior:B,crosshairSourceId:H}=Vu({selection:s,linkedHover:l,fallbackFields:c,unwrapData:u,onObservation:d,chartType:h,chartId:f,onClick:x,hoverHighlight:w,colorByField:D,mobileInteraction:_}),$=function(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===n?.mode)return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}(l,H),q=function(e,t,n){const r=(0,fu.useCategoryColors)(),i=Gu();return(0,hu.useMemo)(()=>{if(!t)return;const o=r??void 0,a=n??(i&&i.length>0?i:void 0)??"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>t(e)+"")));if(o&&Iu(o)){const e=Gr(n.map(e=>({_cat:e})),"_cat",a);return t=>qr(o,t)??e(t)}return Gr(n.map(e=>({_cat:e})),"_cat",a)}if(o&&Iu(o)){const n=Gr(e,t,a);return e=>qr(o,e)??n(e)}return Gr(e,t,a)}if(o&&Iu(o)){const e=Gr([{_:"a"}],"_",a);return t=>qr(o,t)??e(t)}},[e,t,n,r,i])}(E,r,i),G=(0,Nd.useMemo)(()=>Fu(E,r),[E,r]),V=(0,Nd.useMemo)(()=>N&&I.length>0?I:G,[N,I,G]),U=function(e,t,n,r=!0,i=!1){const[o,a]=(0,Tu.useState)(null),[s,l]=(0,Tu.useState)(new Set),c=(0,Tu.useMemo)(()=>new Set,[]),u=(0,Tu.useMemo)(()=>new Set(n),[n]),d=null!=o&&u.has(o)?o:null,h=(0,Tu.useMemo)(()=>{if(0===s.size)return s;const e=new Set(Array.from(s).filter(e=>u.has(e)));return 0===e.size||e.size===u.size?c:e.size===s.size?s:e},[u,c,s]);(0,Tu.useEffect)(()=>{r&&t&&e&&"none"!==e||(a(null),l(e=>0===e.size?e:new Set))},[t,r,e]),(0,Tu.useEffect)(()=>{a(e=>null==e||u.has(e)?e:null),l(e=>{if(0===e.size)return e;const t=new Set(Array.from(e).filter(e=>u.has(e)));return 0===t.size||t.size===u.size?new Set:t.size===e.size?e:t})},[u]);const f=(0,Tu.useCallback)(t=>{r&&"highlight"===e&&a(!t||!u.has(t.label)||i&&!0!==t.__semioticCategory?null:t.label)},[u,r,e,i]),p=(0,Tu.useCallback)(t=>{!r||"isolate"!==e||!u.has(t.label)||i&&!0!==t.__semioticCategory||l(e=>{const n=new Set(Array.from(e).filter(e=>u.has(e)));return n.has(t.label)?n.delete(t.label):n.add(t.label),n.size===u.size?new Set:n})},[u,r,e,i]),m=(0,Tu.useMemo)(()=>{if(!r||!e||"none"===e||!t)return null;const n=e=>{const n="function"==typeof t?t(e):e[t];return"string"==typeof n?n:n+""};return"highlight"===e&&null!=d?{isActive:!0,predicate:e=>n(e)===d}:"isolate"===e&&h.size>0?{isActive:!0,predicate:e=>h.has(n(e))}:null},[t,r,e,d,h]);return{highlightedCategory:r&&"highlight"===e?d:null,isolatedCategories:r&&"isolate"===e?h:c,onLegendHover:f,onLegendClick:p,legendSelectionHook:m}}(o,r,V),Y=(0,Nd.useMemo)(()=>F||(U.legendSelectionHook?U.legendSelectionHook:O),[F,U.legendSelectionHook,O]),X=yd(s),Z=Gu(),K=(0,Ed.useCategoryColors)(),Q=(0,Nd.useMemo)(()=>{if(q)return q;if(!r||0===V.length)return;const e=Array.isArray(i)&&i.length>0||"string"==typeof i&&i.length>0?i:Z&&Z.length>0?Z:Br,t="__streamCat",n=Gr(V.map(e=>({[t]:e})),t,e);return e=>(K?qr(K,e):void 0)??n(e)??"#999"},[q,r,V,i,Z,K]),{legend:J,margin:ee,legendPosition:te,legendLayout:ne,legendMarginReserved:re}=Bu({data:E,colorBy:r,colorScale:Q,showLegend:p,legendPosition:a,userMargin:v,defaults:b,categories:V,additionalLegend:m,chartWidth:C,chartHeight:R,legendLayout:g,frameLegend:y,hasTitle:L,axisChrome:P}),ie=(0,Nd.useMemo)(()=>{const e={};return J&&(e.legend=J,e.legendPosition=te,re&&(e.__legendMarginReservedFor=J),ne&&(e.legendLayout=ne)),o&&"none"!==o&&(e.legendHoverBehavior=U.onLegendHover,e.legendClickBehavior=U.onLegendClick,e.legendHighlightedCategory=U.highlightedCategory,e.legendIsolatedCategories=U.isolatedCategories),N&&r&&(e.legendCategoryAccessor=r,e.onCategoriesChange=z),e},[J,te,ne,re,o,U.onLegendHover,U.onLegendClick,U.highlightedCategory,U.isolatedCategories,N,r,z]),oe=Array.isArray(n)?Hl(n):n,ae=fd(M,C,R,j),se=ae?null:hd(oe,C,R,A);return{data:E,colorScale:q,allCategories:V,legendState:U,effectiveSelectionHook:Y,activeSelectionHook:O,customHoverBehavior:W,customClickBehavior:B,mobileInteraction:_,legend:J,margin:ee,legendPosition:te,earlyReturn:ae||se||null,legendBehaviorProps:ie,crosshairProps:$,resolvedSelection:X}}var Td=require("react");function zd(e,t){const{variant:n,frameRef:r,overrides:i}=t,o=(0,Td.useRef)(i);o.current=i,(0,Td.useImperativeHandle)(e,()=>{const e=function(e,t){if("xy"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>e.current?.remove(t)??[],update:(t,n)=>e.current?.update(t,n)??[],replace:t=>e.current?.replace?.(t),clear:()=>e.current?.clear(),getData:()=>e.current?.getData()??[],getScales:()=>e.current?.getScales()??null,getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}if("network"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>{const n=Array.isArray(t)?t:[t],r=e.current?.getTopology()?.nodes??[],i=[];for(const t of n){const n=r.find(e=>e.id===t);n&&i.push({...n.data??{},id:t}),e.current?.removeNode(t)}return i},update:(t,n)=>(Array.isArray(t)?t:[t]).flatMap(t=>{const r=e.current?.updateNode(t,n);return r?[{...r,id:t}]:[]}),clear:()=>e.current?.clear(),getData:()=>e.current?.getTopology()?.nodes?.map(e=>e.data)??[],getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}if("geo-points"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>e.current?.removePoint(t)??[],update:(t,n)=>{const r=e.current?.removePoint(t)??[];for(const t of r)e.current?.push(n(t));return r},clear:()=>e.current?.clear(),getData:()=>e.current?.getData()??[],getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}const n=t;return{push:e=>n.current?.pushLine(e),pushMany:e=>n.current?.pushManyLines(e),remove:e=>n.current?.removeLine(e)??[],update:(e,t)=>{const r=n.current?.removeLine(e)??[];for(const e of r)n.current?.pushLine(t(e));return r},clear:()=>n.current?.clear(),getData:()=>n.current?.getLines()??[],getCustomLayout:()=>n.current?.getCustomLayout?.()??null,getLayoutFailure:()=>n.current?.getLayoutFailure?.()??null}}(n,r);return new Proxy(e,{get(e,t,n){if("string"==typeof t){const e=o.current?.[t];if("function"==typeof e)return e}return Reflect.get(e,t,n)},has:(e,t)=>!("string"!=typeof t||!o.current||!(t in o.current))||Reflect.has(e,t)})},[])}var Dd={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},_d=require("react/jsx-runtime"),Od=[3,30],Fd=[1,4],Wd=(0,Pd.forwardRef)(function(e,t){const n=(0,Pd.useRef)(null);zd(t,{variant:"geo-points",frameRef:n});const r=Uu(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,enableHover:e.enableHover,linkedHover:e.linkedHover,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{points:i,xAccessor:o="lon",yAccessor:a="lat",sizeBy:s,sizeRange:l,colorBy:c,styleRules:u,colorScheme:d,projection:h="equalEarth",graticule:f,fitPadding:p,zoomable:m,zoomExtent:g,onZoom:y,dragRotate:v,tileURL:b,tileAttribution:x,tileCacheSize:w,areas:k,areaStyle:S=Dd,tooltip:M,annotations:j,margin:A,className:C,selection:R,linkedHover:L,onObservation:P,onClick:N,chartId:E,loading:I,loadingContent:T,emptyContent:z,legendInteraction:D,legendPosition:_,frameProps:O={},stroke:F,strokeWidth:W,opacity:B}=e,H=l??("sparkline"===r.mode?Fd:Od),$="sparkline"===r.mode?1.5:6,q=m??!!b,G=jd(k),V=Id({data:i??Bl,rawData:i,colorBy:c,colorScheme:d,legendInteraction:D,legendPosition:_,frameLegend:O,selection:R,linkedHover:L,fallbackFields:c?["string"==typeof c?c:""]:[],unwrapData:!1,onObservation:P,onClick:N,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"ProportionalSymbolMap",chartId:E,showLegend:r.showLegend,userMargin:A,marginDefaults:Lu(r),loading:I,loadingContent:T,emptyContent:z,width:r.width,height:r.height,hasTitle:!!r.title}),U=V.data,Y=(0,Pd.useMemo)(()=>{if(!s)return;const e="function"==typeof s?s:e=>e?.[s],t=U.filter(Boolean).map(t=>e(t)).filter(e=>null!=e&&isFinite(e));return 0!==t.length?oi(t):void 0},[U,s]),X=(0,Pd.useMemo)(()=>{const e=Yu(td(e=>({fill:c?$r(e,c,V.colorScale):Wr,fillOpacity:.7,stroke:"#fff",strokeWidth:.5,r:s?Vr(e,s,H,Y):$}),u,Zu(c,s)),{stroke:F,strokeWidth:W,opacity:B});return V.effectiveSelectionHook?gu(e,V.effectiveSelectionHook,V.resolvedSelection):e},[c,V.colorScale,V.effectiveSelectionHook,V.resolvedSelection,s,H,Y,$,F,W,B,u]),Z=(0,Pd.useMemo)(()=>e=>{const t=e?.name||e?.label||e?.NAME||e?.id,n="string"==typeof s?s:null,r=("function"==typeof s?s:e=>e[s])(e),i=e=>"number"==typeof e&&isFinite(e)?Number.isInteger(e)?e.toLocaleString():e.toLocaleString(void 0,{maximumFractionDigits:2}):(e??"")+"",o="string"==typeof c?c:null,a=o?e?.[o]:null;return(0,_d.jsxs)("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[t&&(0,_d.jsx)("div",{style:{fontWeight:600,marginBottom:2},children:t}),n&&null!=r&&(0,_d.jsxs)("div",{children:[(0,_d.jsxs)("span",{style:{opacity:.7},children:[n,": "]}),i(r)]}),o&&null!=a&&(0,_d.jsxs)("div",{children:[(0,_d.jsxs)("span",{style:{opacity:.7},children:[o,": "]}),a+""]}),!t&&!n&&Object.entries(e).filter(([e])=>"data"!==e&&"x"!==e&&"y"!==e&&"time"!==e).slice(0,4).map(([e,t])=>(0,_d.jsxs)("div",{children:[(0,_d.jsxs)("span",{style:{opacity:.7},children:[e,": "]}),i(t)]},e))]})},[s,c]);if(V.earlyReturn)return V.earlyReturn;pd("ProportionalSymbolMap",U,"xAccessor",o),pd("ProportionalSymbolMap",U,"yAccessor",a);const K={projection:h,...null!=i&&{points:U},xAccessor:o,yAccessor:a,pointStyle:X,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...G&&{areas:G,areaStyle:S},...null!=f&&{graticule:f},...null!=p&&{fitPadding:p},...q&&{zoomable:!0},...g&&{zoomExtent:g},...y&&{onZoom:y},...null!=v&&{dragRotate:v},...b&&{tileURL:b},...x&&{tileAttribution:x},...w&&{tileCacheSize:w},size:[r.width,r.height],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,maxDevicePixelRatio:e.maxDevicePixelRatio,margin:V.margin,enableHover:r.enableHover,tooltipContent:!1===M?()=>null:Hc(M)||Z,...V.legendBehaviorProps,...Cd({linkedHover:L,selection:R,onObservation:P,onClick:N,mobileInteraction:V.mobileInteraction,customHoverBehavior:V.customHoverBehavior,customClickBehavior:V.customClickBehavior,linkedHoverInClickPredicate:!1}),...j&&j.length>0&&{annotations:j},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...r.title&&{title:r.title},...r.description&&{description:r.description},...r.summary&&{summary:r.summary},...void 0!==r.accessibleTable&&{accessibleTable:r.accessibleTable},...C&&{className:C},...null!=e.animate&&{animate:e.animate},...O};return(0,_d.jsx)(cd,{componentName:"ProportionalSymbolMap",width:r.width,height:r.height,children:(0,_d.jsx)(uu,{ref:n,...K})})});Wd.displayName="ProportionalSymbolMap";var Bd=require("react"),Hd=require("./semiotic-client-cjs-shared.min.js"),$d=require("./semiotic-client-cjs-shared.min.js"),qd=require("d3-scale"),Gd=require("react/jsx-runtime"),Vd="__semiotic_x",Ud="__semiotic_y",Yd=(0,Bd.forwardRef)(function(e,t){const n=Uu(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,enableHover:e.enableHover,linkedHover:e.linkedHover,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{flows:r,nodes:i,nodeIdAccessor:o="id",xAccessor:a="lon",yAccessor:s="lat",valueAccessor:l="value",projection:c="equalEarth",graticule:u,fitPadding:d,zoomable:h,zoomExtent:f,onZoom:p,dragRotate:m,tileURL:g,tileAttribution:y,tileCacheSize:v,lineType:b="geo",flowStyle:x="basic",areas:w,areaStyle:k=Dd,edgeColorBy:S,edgeOpacity:M=.6,edgeWidthRange:j=[1,8],pointRadius:A,edgeLinecap:C="round",colorScheme:R,showParticles:L,particleStyle:P,tooltip:N,annotations:E,margin:I,className:T,selection:z,linkedHover:D,onObservation:_,onClick:O,chartId:F,loading:W,loadingContent:B,emptyContent:H,frameProps:$={},legendInteraction:q,legendPosition:G,stroke:V,strokeWidth:U,opacity:Y,lineIdAccessor:X}=e,Z=h??!!g,K=jd(w),Q=(0,Bd.useMemo)(()=>Hl(i),[i]),J=Id({data:r??Bl,rawData:r,colorBy:S,colorScheme:R,legendInteraction:q,legendPosition:G,frameLegend:$,selection:z,linkedHover:D,fallbackFields:S?["string"==typeof S?S:""]:[],unwrapData:!1,onObservation:_,onClick:O,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"FlowMap",chartId:F,showLegend:n.showLegend,userMargin:I,marginDefaults:Lu(n),loading:W,loadingContent:B,emptyContent:H,width:n.width,height:n.height,hasTitle:!!n.title}),ee=J.data,te=pu(D),ne=(0,Hd.useLinkedHover)({name:te?.name||"hover",fields:te?.fields||[]}),re=(0,$d.useObservationSelector)(e=>e.pushObservation),ie=(0,Bd.useMemo)(()=>{const e=new Map;for(const t of Q)e.set(t[o]+"",t);return e},[Q,o]),oe=(0,Bd.useRef)(null),ae=(0,Bd.useRef)(ie);ae.current=ie;const se=(0,Bd.useRef)(a);se.current=a;const le=(0,Bd.useRef)(s);le.current=s;const ce=(0,Bd.useCallback)(e=>{if(!e||"object"!=typeof e||null==e.source||null==e.target)return null;const t=ae.current,n=t.get(e.source+""),r=t.get(e.target+"");if(!n||!r)return null;const i="function"==typeof se.current?se.current:e=>e[se.current],o="function"==typeof le.current?le.current:e=>e[le.current];return{...e,coordinates:[{[Vd]:i(n),[Ud]:o(n)},{[Vd]:i(r),[Ud]:o(r)}]}},[]);zd(t,{variant:"geo-lines",frameRef:oe,overrides:{push:e=>{const t=ce(e);t&&oe.current?.pushLine(t)},pushMany:e=>{const t=[];for(const n of e){const e=ce(n);e&&t.push(e)}t.length>0&&oe.current?.pushManyLines(t)}}});const ue=(0,Bd.useMemo)(()=>{const e=new Map;for(const t of ee)t&&"object"==typeof t&&(null==t.source||e.has(t.source)||e.set(t.source,t),null==t.target||e.has(t.target)||e.set(t.target,t));return e},[ee]),de=(0,Bd.useCallback)(e=>{if(D)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"point"===e.type){const e=ue.get(t[o]+"");e&&ne.onHover(e)}else ne.onHover(t)}else ne.onHover(null);if(_||re){const t={timestamp:Date.now(),chartType:"FlowMap",chartId:F};if(e){let n=e.data||e.datum||e;Array.isArray(n)&&(n=n[0]);const r={...t,type:"hover",datum:n||{},x:e.x??0,y:e.y??0};_&&_(r),re&&re(r)}else{const e={...t,type:"hover-end"};_&&_(e),re&&re(e)}}},[D,ne,o,ue,_,F,re]),he=J.customClickBehavior,fe=(0,Bd.useMemo)(()=>{const e="function"==typeof a?a:e=>e[a],t="function"==typeof s?s:e=>e[s];return ee.map(n=>{if(!n||"object"!=typeof n||null==n.source||null==n.target)return null;const r=ie.get(n.source+""),i=ie.get(n.target+"");return r&&i?{...n,coordinates:[{[Vd]:e(r),[Ud]:t(r)},{[Vd]:e(i),[Ud]:t(i)}]}:null}).filter(Boolean)},[ee,ie,a,s]),pe=(0,Bd.useMemo)(()=>{const e="function"==typeof a?a:e=>e[a];return t=>null!=t&&"object"==typeof t&&Vd in t?t[Vd]:e(t)},[a]),me=(0,Bd.useMemo)(()=>{const e="function"==typeof s?s:e=>e[s];return t=>null!=t&&"object"==typeof t&&Ud in t?t[Ud]:e(t)},[s]),ge=(0,Bd.useMemo)(()=>{const e=ee.filter(e=>e&&"object"==typeof e).map(e=>e[l]??0).filter(e=>isFinite(e));return 0===e.length?()=>j[0]:(0,qd.scaleLinear)().domain(oi(e)).range(j)},[ee,l,j]),ye=(0,Bd.useMemo)(()=>e=>({stroke:S?$r(e,S,J.colorScale):Wr,strokeWidth:ge(e[l]??0),strokeLinecap:C,opacity:M}),[S,J.colorScale,ge,l,M,C]),ve=(0,Bd.useMemo)(()=>{const e=Yu(ye,{stroke:V,strokeWidth:U,opacity:Y});if(!J.effectiveSelectionHook)return e;const t={...J.resolvedSelection?.unselectedStyle||{},fillOpacity:0};return gu(e,J.effectiveSelectionHook,{...J.resolvedSelection||{},unselectedStyle:t})},[ye,J.effectiveSelectionHook,J.resolvedSelection,V,U,Y]),be=A??("sparkline"===n.mode?1.5:5),xe=(0,Bd.useMemo)(()=>Yu(()=>({fill:"#333",r:be,fillOpacity:.8}),{stroke:V,strokeWidth:U,opacity:Y}),[be,V,U,Y]),we=(0,Bd.useMemo)(()=>e=>{if(e?.geometry||e?.properties||e?.data?.geometry){const t=e?.properties?.name||e?.properties?.NAME||e?.name||e?.NAME||e?.data?.properties?.name||e?.data?.properties?.NAME;if(t)return(0,Gd.jsx)("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:(0,Gd.jsx)("div",{style:{fontWeight:600},children:t})})}if(null!=e?.source&&null!=e?.target){const t=e[l];return(0,Gd.jsxs)("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[(0,Gd.jsxs)("div",{style:{fontWeight:600},children:[e.source," → ",e.target]}),null!=t&&(0,Gd.jsx)("div",{style:{opacity:.7},children:"number"==typeof t?t.toLocaleString():t})]})}const t=e?.name||e?.label||e?.[o];return null!=t?(0,Gd.jsx)("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:(0,Gd.jsx)("div",{style:{fontWeight:600},children:t})}):null},[l,o]);if(J.earlyReturn)return J.earlyReturn;const ke={projection:c,...null!=r&&{lines:fe},points:Q,xAccessor:pe,yAccessor:me,lineDataAccessor:"coordinates",...null!=X&&{lineIdAccessor:X},lineType:b,flowStyle:x,lineStyle:ve,pointStyle:xe,...K&&{areas:K,areaStyle:k},...null!=u&&{graticule:u},...null!=d&&{fitPadding:d},...Z&&{zoomable:!0},...f&&{zoomExtent:f},...p&&{onZoom:p},...null!=m&&{dragRotate:m},...L&&{showParticles:L},...P&&{particleStyle:P},...g&&{tileURL:g},...y&&{tileAttribution:y},...v&&{tileCacheSize:v},size:[n.width,n.height],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,maxDevicePixelRatio:e.maxDevicePixelRatio,margin:J.margin,enableHover:n.enableHover,tooltipContent:!1===N?()=>null:Hc(N)||we,...J.legendBehaviorProps,...Cd({linkedHover:D,selection:z,onObservation:_,onClick:O,mobileInteraction:J.mobileInteraction,customHoverBehavior:de,customClickBehavior:he,linkedHoverInClickPredicate:!1}),...E&&E.length>0&&{annotations:E},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...n.title&&{title:n.title},...n.description&&{description:n.description},...n.summary&&{summary:n.summary},...void 0!==n.accessibleTable&&{accessibleTable:n.accessibleTable},...T&&{className:T},...null!=e.animate&&{animate:e.animate},...$};return(0,Gd.jsx)(cd,{componentName:"FlowMap",width:n.width,height:n.height,children:(0,Gd.jsx)(uu,{ref:oe,...ke})})});Yd.displayName="FlowMap";var Xd=require("react"),Zd=require("react/jsx-runtime");function Kd({bottomMargin:e,costLabel:t,layout:{cx:n,cy:r,maxCost:i,availableRadius:o,layout:a},ringStyle:s,ringValues:l,showNorth:c,showRingLabels:u,showRings:d}){const h="strip"===a,f={stroke:h?"var(--semiotic-border, #999)":"#999",strokeWidth:h?1:.8,strokeDasharray:h?"none":"4,3",labelColor:"var(--semiotic-text-secondary, #777)",labelSize:h?8:10,...s};return(0,Zd.jsxs)("g",h?{children:[(0,Zd.jsx)("line",{x1:n,y1:r,x2:n+o,y2:r,stroke:f.stroke,strokeWidth:f.strokeWidth,strokeLinecap:"round",opacity:.85}),(0,Zd.jsx)("line",{x1:n,y1:r-3.5,x2:n,y2:r+3.5,stroke:f.stroke,strokeWidth:f.strokeWidth,opacity:.9}),d&&l.map(a=>{const s=n+(i>0?a/i*o:0);return(0,Zd.jsxs)("g",{children:[(0,Zd.jsx)("line",{x1:s,y1:r-2.5,x2:s,y2:r+2.5,stroke:f.stroke,strokeWidth:.9,opacity:.65}),u&&(0,Zd.jsxs)("text",{x:s,y:r+Math.min(10,(e??2)+8),textAnchor:"middle",fontSize:f.labelSize,fill:f.labelColor,fontFamily:"var(--semiotic-font-family, system-ui, sans-serif)",children:[a,t?" "+t:""]})]},a)})]}:{children:[l.map(e=>{const a=e/i*o;return(0,Zd.jsxs)("g",{children:[(0,Zd.jsx)("circle",{cx:n,cy:r,r:a,fill:"none",stroke:f.stroke,strokeWidth:f.strokeWidth,strokeDasharray:f.strokeDasharray,opacity:.5}),u&&(0,Zd.jsxs)("text",{x:n+a+3,y:r-2,fontSize:f.labelSize,fill:f.labelColor,fontFamily:"system-ui, sans-serif",children:[e,t?" "+t:""]})]},e)}),c&&(0,Zd.jsxs)("g",{transform:"translate(24, 24)",children:[(0,Zd.jsx)("circle",{r:16,fill:"white",fillOpacity:.85,stroke:"#bbb",strokeWidth:.8}),(0,Zd.jsx)("path",{d:"M0,-11 L3,-3 L1,-4 L1,7 L-1,7 L-1,-4 L-3,-3 Z",fill:"#555",stroke:"none"}),(0,Zd.jsx)("text",{y:-12,textAnchor:"middle",fontSize:7,fontWeight:700,fill:"#555",fontFamily:"system-ui, sans-serif",children:"N"}),(0,Zd.jsx)("line",{x1:11,y1:0,x2:13,y2:0,stroke:"#bbb",strokeWidth:.8}),(0,Zd.jsx)("line",{x1:-11,y1:0,x2:-13,y2:0,stroke:"#bbb",strokeWidth:.8}),(0,Zd.jsx)("line",{x1:0,y1:11,x2:0,y2:13,stroke:"#bbb",strokeWidth:.8})]})]})}var Qd=require("react/jsx-runtime"),Jd=(0,Xd.forwardRef)(function(e,t){const n=Uu(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,enableHover:e.enableHover,linkedHover:e.linkedHover,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{points:r,lines:i,xAccessor:o="lon",yAccessor:a="lat",nodeIdAccessor:s="id",center:l,costAccessor:c,strength:u=1,lineMode:d="straight",projection:h="mercator",graticule:f,fitPadding:p,zoomable:m,zoomExtent:g,onZoom:y,dragRotate:v,tileURL:b,tileAttribution:x,tileCacheSize:w,transition:k,colorBy:S,styleRules:M,colorScheme:j,pointRadius:A,tooltip:C,showRings:R,showRingLabels:L,ringStyle:P,showNorth:N,costLabel:E,cartogramLayout:I,annotations:T,margin:z,className:D,selection:_,linkedHover:O,onObservation:F,onClick:W,chartId:B,loading:H,loadingContent:$,emptyContent:q,legendPosition:G,frameProps:V={},stroke:U,strokeWidth:Y,opacity:X}=e,Z="sparkline"===n.mode,K=I??(Z?"strip":"radial"),Q=A??(Z?1.5:5),J=R??!0,ee=L??("strip"!==K&&!n.compactMode),te=N??("strip"!==K&&!Z),ne=m??!!b,re=(0,Xd.useMemo)(()=>Hl(r),[r]),ie=Id({data:re,rawData:r,colorBy:S,colorScheme:j,legendInteraction:void 0,legendPosition:G,frameLegend:V,selection:_,linkedHover:O,fallbackFields:S?["string"==typeof S?S:""]:[],unwrapData:!1,onObservation:F,onClick:W,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"DistanceCartogram",chartId:B,showLegend:n.showLegend,userMargin:z,marginDefaults:Lu(n),loading:H,loadingContent:$,emptyContent:q,width:n.width,height:n.height,hasTitle:!!n.title}),oe=(0,Xd.useMemo)(()=>{const e=Yu(td(e=>{const t=e?.[s],n=null!=t&&t+""==l+"";return{fill:S?$r(e,S,ie.colorScale):Wr,fillOpacity:n?1:.8,stroke:n?"var(--semiotic-text, #222)":"#fff",strokeWidth:n?1.25:1,r:n?1.35*Q:Q}},M,Zu(S)),{stroke:U,strokeWidth:Y,opacity:X});return ie.effectiveSelectionHook?gu(e,ie.effectiveSelectionHook,ie.resolvedSelection):e},[S,ie.colorScale,ie.effectiveSelectionHook,ie.resolvedSelection,Q,U,Y,X,M,l,s]),ae=(0,Xd.useMemo)(()=>({center:l,centerAccessor:s,costAccessor:c,strength:u,lineMode:d,layout:K}),[l,s,c,u,d,K]),se=(0,Xd.useMemo)(()=>{if(!i)return;const e="function"==typeof o?o:e=>e[o],t="function"==typeof a?a:e=>e[a],n=new Map;for(const e of re)n.set(e[s]+"",e);return i.map(r=>{if(r.coordinates)return r;const i=n.get(r.source+""),s=n.get(r.target+"");return i&&s?{...r,coordinates:[{[o]:e(i),[a]:t(i)},{[o]:e(s),[a]:t(s)}]}:null}).filter(Boolean)},[i,re,o,a,s]),le=(0,Xd.useMemo)(()=>e=>{const t=("function"==typeof c?c:e=>e[c])(e);return(0,Qd.jsxs)("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[(0,Qd.jsx)("div",{style:{fontWeight:600},children:e[s]||e.name||e.id||"Point"}),null!=t&&(0,Qd.jsxs)("div",{style:{opacity:.7},children:["Cost: ","number"==typeof t?t.toFixed(1):t]})]})},[c,s]),ce=(0,Xd.useRef)(null);zd(t,{variant:"geo-points",frameRef:ce});const[ue,de]=(0,Xd.useState)(null),he=(0,Xd.useCallback)(()=>{const e=ce.current?.getCartogramLayout?.();e&&de(t=>t&&t.cx===e.cx&&t.cy===e.cy&&t.maxCost===e.maxCost&&t.availableRadius===e.availableRadius&&t.layout===(e.layout??"radial")?t:{cx:e.cx,cy:e.cy,maxCost:e.maxCost,availableRadius:e.availableRadius,layout:e.layout??"radial"})},[]);(0,Xd.useEffect)(()=>{const e=requestAnimationFrame(he);return()=>cancelAnimationFrame(e)},[he,u,l,n.width,n.height,re,K]);const fe=(0,Xd.useMemo)(()=>{if(!J||!ue)return[];const{maxCost:e}=ue;if(0>=e)return[];if(Array.isArray(J))return J.filter(t=>t>0&&e>=t);const t="number"==typeof J?J:Math.min("strip"===ue.layout?3:5,Math.max(2,Math.ceil(e/5))),n=e/t,r=[];for(let e=1;t>=e;e++)r.push(Math.round(n*e*10)/10);return r},[J,ue]),pe=(0,Xd.useMemo)(()=>{if(!ue)return V.foregroundGraphics||null;const e=(0,Qd.jsx)(Kd,{bottomMargin:ie.margin.bottom,costLabel:E,layout:ue,ringStyle:P,ringValues:fe,showNorth:te,showRingLabels:ee,showRings:J}),t=V.foregroundGraphics;return"function"==typeof t?n=>(0,Qd.jsxs)(Qd.Fragment,{children:[e,t(n)]}):(0,Qd.jsxs)(Qd.Fragment,{children:[e,t]})},[ue,fe,J,ee,te,E,P,ie.margin.bottom,V.foregroundGraphics]);if(ie.earlyReturn)return ie.earlyReturn;pd("DistanceCartogram",re,"xAccessor",o),pd("DistanceCartogram",re,"yAccessor",a);const me={projection:h,...null!=r&&{points:re},...se&&{lines:se,lineDataAccessor:"coordinates"},xAccessor:o,yAccessor:a,pointIdAccessor:s,pointStyle:oe,projectionTransform:ae,...k&&{transition:{duration:k}},...null!=f&&{graticule:f},...null!=p&&{fitPadding:p},...ne&&{zoomable:!0},...g&&{zoomExtent:g},...y&&{onZoom:y},...null!=v&&{dragRotate:v},...b&&{tileURL:b},...x&&{tileAttribution:x},...w&&{tileCacheSize:w},size:[n.width,n.height],maxDevicePixelRatio:e.maxDevicePixelRatio,margin:ie.margin,enableHover:n.enableHover,tooltipContent:!1===C?()=>null:Hc(C)||le,...ie.legendBehaviorProps,...Cd({linkedHover:O,selection:_,onObservation:F,onClick:W,mobileInteraction:ie.mobileInteraction,customHoverBehavior:ie.customHoverBehavior,customClickBehavior:ie.customClickBehavior,linkedHoverInClickPredicate:!1}),...T&&T.length>0&&{annotations:T},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...n.title&&{title:n.title},...n.description&&{description:n.description},...n.summary&&{summary:n.summary},...void 0!==n.accessibleTable&&{accessibleTable:n.accessibleTable},...D&&{className:D},...null!=e.animate&&{animate:e.animate},...V,foregroundGraphics:pe};return(0,Qd.jsx)(cd,{componentName:"DistanceCartogram",width:n.width,height:n.height,children:(0,Qd.jsx)(uu,{ref:ce,...me})})});Jd.displayName="DistanceCartogram";var eh=require("react"),th=require("react"),nh=require("react/jsx-runtime"),rh=(0,eh.forwardRef)(function(e,t){const{points:n,areas:r,lines:i,layout:o,layoutConfig:a,onLayoutError:s,projection:l="equirectangular",xAccessor:c="lon",yAccessor:u="lat",lineDataAccessor:d,colorBy:h,colorScheme:f,tooltip:p,annotations:m,margin:g,selection:y,linkedHover:v,onObservation:b,onClick:x,chartId:w,loading:k,loadingContent:S,emptyContent:M,className:j,frameProps:A={}}=e,{frameRef:C,resolved:R,normalizedMargin:L}=function(e){const t=(0,th.useRef)(null);return zd(e.imperativeRef,{variant:e.imperativeVariant,frameRef:t}),{frameRef:t,resolved:Uu(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),normalizedMargin:(0,th.useMemo)(()=>function(e){if(null==e)return;if("number"==typeof e)return{top:e,right:e,bottom:e,left:e};const t={};return"number"==typeof e.top&&(t.top=e.top),"number"==typeof e.right&&(t.right=e.right),"number"==typeof e.bottom&&(t.bottom=e.bottom),"number"==typeof e.left&&(t.left=e.left),t}(e.margin),[e.margin])}}({imperativeRef:t,imperativeVariant:"geo-points",margin:g,width:e.width,height:e.height,enableHover:e.enableHover,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,mode:e.mode,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),P=(0,eh.useMemo)(()=>Hl(n),[n]),N=(0,eh.useMemo)(()=>Hl(r),[r]),E=(0,eh.useMemo)(()=>Hl(i),[i]),I=(0,eh.useMemo)(()=>[...P,...E,...N],[P,E,N]),T=Id({data:I,rawData:void 0!==n||void 0!==i||void 0!==r?I:void 0,colorBy:h,colorScheme:f,legendInteraction:void 0,selection:y,linkedHover:v,fallbackFields:"string"==typeof h?[h]:[],unwrapData:!1,onObservation:b,onClick:x,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,chartType:"GeoCustomChart",chartId:w,showLegend:!1,userMargin:L,marginDefaults:R.marginDefaults,loading:k,loadingContent:S,emptyContent:M,width:R.width,height:R.height,hasTitle:!!R.title}),z=T.effectiveSelectionHook,D=(0,eh.useMemo)(()=>z?.isActive?{isActive:!0,predicate:z.predicate}:null,[z?.isActive,z?.predicate]);if(T.earlyReturn)return T.earlyReturn;const{width:_,height:O,enableHover:F,title:W,description:B,summary:H,accessibleTable:$}=R,q=Hc(p),G={projection:l,...null!=n&&{points:P},...null!=r&&{areas:N},...null!=i&&{lines:E},xAccessor:c,yAccessor:u,...null!=d&&{lineDataAccessor:d},customLayout:o,layoutConfig:a,onLayoutError:s,layoutSelection:D,colorBy:h,colorScheme:f,size:[_,O],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:T.margin,enableHover:F,...Ad({title:W,description:B,summary:H,accessibleTable:$,className:j,animate:e.animate,maxDevicePixelRatio:e.maxDevicePixelRatio,autoPlaceAnnotations:e.autoPlaceAnnotations}),...!1===p?{tooltipContent:()=>null}:q?{tooltipContent:q}:{},...Cd({linkedHover:v,selection:y,onObservation:b,onClick:x,hoverHighlight:!1,mobileInteraction:T.mobileInteraction,customHoverBehavior:T.customHoverBehavior,customClickBehavior:T.customClickBehavior,linkedHoverInClickPredicate:!1}),...m&&m.length>0&&{annotations:m},...A};return(0,nh.jsx)(cd,{componentName:"GeoCustomChart",width:_,height:O,children:(0,nh.jsx)(uu,{ref:C,...G})})});rh.displayName="GeoCustomChart";var ih={fill:"rgba(0,0,0,0)",stroke:"rgba(0,0,0,0)",opacity:0},oh=8;function ah(e){const t=function(e){return null==e?void 0:e+""}(e.id);return{type:"point",x:e.x,y:e.y,r:e.r??oh,style:{...ih,cursor:e.cursor},datum:e.datum,pointId:t,_transitionKey:t}}function sh(e){return ah(e)}function lh(e){const[[t,n],[r,i]]=e.bounds;return{type:"geoarea",pathData:e.pathData,centroid:e.centroid,bounds:e.bounds,screenArea:e.screenArea??Math.abs((r-t)*(i-n)),style:{...ih,cursor:e.cursor},datum:e.datum,group:e.group,interactive:!0}}var ch=require("./semiotic-custom-layout-selection-cjs-shared.min.js"),uh=require("react/jsx-runtime"),dh=.72,hh=1.8;function fh(e){if(Number.isFinite(e))return Math.max(1,Math.round(e))}function ph(e,t,n){return Math.max(t,Math.min(n,e))}function mh(e){let t=1/0,n=-1/0;for(const r of e)Number.isFinite(r)&&(t>r&&(t=r),r>n&&(n=r));return t===1/0?[0,0]:[t,n]}function gh(e,t){const n=t[1]-t[0];return 0===n?.5:(e-t[0])/n}function yh(e,t={}){const n=e.map((e,t)=>({...e,index:t})).filter(e=>Number.isFinite(e.x)&&Number.isFinite(e.y));if(0===n.length)return[];const r=ph(Number.isFinite(t.occupancy)?Number(t.occupancy):dh,.2,1),i=Number.isFinite(t.aspectRatio)&&Number(t.aspectRatio)>0?Number(t.aspectRatio):hh;let o=fh(t.columns)??Math.max(1,Math.ceil(Math.sqrt(n.length*i/r))),a=fh(t.rows)??Math.max(1,Math.ceil(n.length/(o*r)));n.length>o*a&&(null!=t.columns&&null==t.rows?a=Math.ceil(n.length/o):null!=t.rows&&null==t.columns?o=Math.ceil(n.length/a):a=Math.ceil(n.length/o));const s=mh(n.map(e=>e.x)),l=mh(n.map(e=>e.y)),c=n.map(e=>({...e,desiredColumn:gh(e.x,s)*Math.max(0,o-1),desiredRow:gh(e.y,l)*Math.max(0,a-1)})),u=(o-1)/2,d=(a-1)/2;c.sort((e,t)=>(t.desiredColumn-u)**2+(t.desiredRow-d)**2-((e.desiredColumn-u)**2+(e.desiredRow-d)**2)||e.desiredRow-t.desiredRow||e.desiredColumn-t.desiredColumn||e.index-t.index);const h=new Set;for(let e=0;a>e;e+=1)for(let t=0;o>t;t+=1)h.add(e*o+t);const f=[];for(const e of c){let t=-1,n=1/0;for(const r of h){const i=(r%o-e.desiredColumn)**2+(Math.floor(r/o)-e.desiredRow)**2;(n>i||i===n&&t>r)&&(t=r,n=i)}0>t||(h.delete(t),f.push({datum:e.datum,x:e.x,y:e.y,row:Math.floor(t/o),column:t%o,index:e.index}))}return f.sort((e,t)=>e.index-t.index),f.map(({index:e,...t})=>t)}function vh(e,t,n=[]){if("function"==typeof t)return t(e);if("string"==typeof t)return e[t];for(const t of n)if(null!=e[t])return e[t]}function bh(e){return e.map(([e,t],n)=>`${0===n?"M":"L"}${e},${t}`).join("")+"Z"}var xh=e=>{const t=e.config,n=t.source??"auto",r="areas"===n||"auto"===n&&e.areas.length>0,i=r?function(e){return e.areas.map((t,n)=>{const r=function(e,t){const n=e.properties&&"object"==typeof e.properties?e.properties:{},r=e.id??n.id??n.name??"area-"+t;return{...n,id:r+""}}(t,n),i=e.scales.geoPath.centroid(t),o=Number.isFinite(i[0])&&Number.isFinite(i[1])?e.scales.invertedPoint(i[0],i[1]):null;return{datum:{...r,gridLongitude:o?.[0],gridLatitude:o?.[1]},x:i[0],y:i[1]}}).filter(e=>Number.isFinite(e.x)&&Number.isFinite(e.y))}(e):e.points.map((e,t)=>({datum:e,x:t,y:t})),o=i.filter((e,n)=>!t.filter||t.filter(e.datum,n)),a=function(e,t){if(!t.rowAccessor||!t.columnAccessor)return null;const n=e.map(e=>({datum:e,x:Number(vh(e,t.columnAccessor)),y:Number(vh(e,t.rowAccessor))})).filter(e=>Number.isFinite(e.x)&&Number.isFinite(e.y));return n.length!==e.length?null:n.map(e=>({...e,row:e.y,column:e.x}))}(o.map(e=>e.datum),t),s=r?o:function(e){return e.points.map(t=>{const n=Number(vh(t,e.config.longitudeAccessor,["lon","longitude"])),r=Number(vh(t,e.config.latitudeAccessor,["lat","latitude"])),i=Number.isFinite(n)&&Number.isFinite(r)?e.scales.projectedPoint(n,r):null;return{datum:t,x:i?.[0]??NaN,y:i?.[1]??NaN}}).filter(e=>Number.isFinite(e.x)&&Number.isFinite(e.y))}({...e,points:o.map(e=>e.datum)}),l=a??yh(s,{columns:t.columns,rows:t.rows,occupancy:t.occupancy,aspectRatio:e.dimensions.width/Math.max(1,e.dimensions.height)});if(0===l.length)return{nodes:[]};const c=mh(l.map(e=>e.row)),u=mh(l.map(e=>e.column)),d=Math.max(1,Math.round(c[1]-c[0])+1),h=Math.max(1,Math.round(u[1]-u[0])+1),f=Math.max(0,t.layoutPadding??8),p=Math.max(1,e.dimensions.width-2*f)/h,m=Math.max(1,e.dimensions.height-2*f)/d,g=(e.dimensions.width-p*h)/2,y=(e.dimensions.height-m*d)/2,v=ph(t.cellPadding??.12,0,.8),b=Math.max(1,.5*Math.min(p,m)*(1-v)),x=t.sizeAccessor?l.map(e=>Number(vh(e.datum,t.sizeAccessor))):[],w=t.sizeDomain??mh(x),k=t.sizeRange??[.36,1],S=ph(Math.min(k[0],k[1]),.05,1),M=ph(Math.max(k[0],k[1]),S,1),j=l.map((n,r)=>{const i={...n.datum,gridRow:n.row,gridColumn:n.column},o=(vh(i,t.idAccessor,["id","key","name"])??"grid-"+r)+"",a=(vh(i,t.labelAccessor,["abbr","code","label","name","id"])??o)+"",s=Math.max(1,t.maxLabelLength??4),l=a.length>s?a.slice(0,s):a,d=vh(i,t.categoryAccessor),h=null==d?void 0:d+"",f=vh(i,t.fillAccessor),v=null!=f?f+"":h?e.resolveColor(h):e.theme.categorical[0]??"#4f86c6",x=t.sizeAccessor?Number(vh(i,t.sizeAccessor)):NaN,k=t.sizeAccessor&&Number.isFinite(x)?Math.sqrt(ph(gh(x,w),0,1)):1,j=b*(S+k*(M-S)),A="function"==typeof t.markStyle?t.markStyle(i,r):t.markStyle;return{datum:i,id:o,label:l,category:h,row:n.row,column:n.column,x:g+(n.column-u[0]+.5)*p,y:y+(n.row-c[0]+.5)*m,radius:j,style:{fill:v,fillOpacity:.94,stroke:"rgba(255,255,255,0.9)",strokeWidth:1,...A}}}),A=t.shape??"circle",C=j.map(e=>{if("circle"===A)return{type:"point",x:e.x,y:e.y,r:e.radius,style:e.style,datum:e.datum,accessibleDatum:e.datum,accessibility:{label:e.label,tableFields:{name:e.datum.name??e.label,label:e.label,row:e.row,column:e.column,...e.category?{category:e.category}:{}}},pointId:e.id,_transitionKey:e.id};const t="hexagon"===A?function(e,t,n){const r=[];for(let i=0;6>i;i+=1){const o=-Math.PI/2+i*(Math.PI/3);r.push([e+Math.cos(o)*n,t+Math.sin(o)*n])}return bh(r)}(e.x,e.y,e.radius):bh([[(n=e.x)-(i=e.radius),(r=e.y)-i],[n+i,r-i],[n+i,r+i],[n-i,r+i]]);var n,r,i;return{type:"geoarea",pathData:t,centroid:[e.x,e.y],bounds:[[e.x-e.radius,e.y-e.radius],[e.x+e.radius,e.y+e.radius]],screenArea:"hexagon"===A?3*Math.sqrt(3)*e.radius*e.radius/2:(2*e.radius)**2,style:e.style,datum:e.datum,accessibleDatum:e.datum,accessibility:{label:e.label,tableFields:{name:e.datum.name??e.label,label:e.label,row:e.row,column:e.column,...e.category?{category:e.category}:{}}},group:e.category,interactive:!0}});return{nodes:C,overlays:!1===t.showLabels?null:(0,uh.jsx)(wh,{marks:j,color:t.labelColor??"#ffffff",fontSize:t.labelFontSize??ph(.23*Math.min(p,m),7,14),fontFamily:t.labelFontFamily,fontWeight:t.labelFontWeight??700}),restyle:(e,t)=>t?.isActive&&e.datum?{opacity:t.predicate(e.datum)?1:.18}:{opacity:1}}};function wh({marks:e,color:t,fontSize:n,fontFamily:r,fontWeight:i}){const o=(0,ch.useCustomLayoutSelection)();return(0,uh.jsx)("g",{"aria-hidden":"true",pointerEvents:"none",children:e.map(e=>{const a=!o.isActive||o.predicate(e.datum);return(0,uh.jsx)("text",{x:e.x,y:e.y,fill:t,fontFamily:r,fontSize:n,fontWeight:i,opacity:a?1:.18,textAnchor:"middle",dominantBaseline:"central",children:e.label},e.id)})})}var kh=require("react/jsx-runtime"),Sh=10,Mh=25e3,jh=new WeakMap,Ah=new WeakMap,Ch=new WeakMap,Rh=1;function Lh(e,t,n){return Math.max(t,Math.min(n,e))}function Ph(e){if(Number.isFinite(e)&&Number(e)>0)return Number(e)}function Nh(e,t){return"function"==typeof t?t(e,e.dotIndex):"string"==typeof t?e[t]:void 0}function Eh(e){return e.properties&&"object"==typeof e.properties?{...e.properties}:{}}function Ih(e,t){const n=Eh(e);return(e.id??n.id??n.name??"feature-"+t)+""}function Th(e,t,n,r){return[Math.ceil((e-n)/r-.5),Math.floor((t-n)/r-.5)]}function zh(e){if(!e)return 0;const t=Ch.get(e);if(t)return t;const n=Rh;return Rh+=1,Ch.set(e,n),n}function Dh(e,t){return!t||!(t[0][1]>e[1]||e[1]>t[1][1]||(n=e[0],r=t[0][0],i=t[1][0],r>i?r>n&&n>i:r>n||n>i));var n,r,i}function _h(e,t){for(const n of e){const{feature:e,index:r}=n;if(e.geometry&&Dh(t,n.bounds))try{if(At(e,t))return{feature:e,index:r}}catch{}}return null}function Oh(e,t,n,r={}){const i=e.filter((e,t)=>e.geometry&&(!r.featureFilter||r.featureFilter(e,t))),o=function(e,t){if(0===e.length)return null;const n=t.bounds({type:"FeatureCollection",features:e});return Number.isFinite(n[0][0])&&Number.isFinite(n[0][1])&&Number.isFinite(n[1][0])&&Number.isFinite(n[1][1])?n:null}(i,t.geoPath);if(!o)return{dots:[],cellSize:Sh,features:i};const a=Math.max(0,r.layoutPadding??0),s=[[Lh(o[0][0],a,Math.max(a,n.width-a)),Lh(o[0][1],a,Math.max(a,n.height-a))],[Lh(o[1][0],a,Math.max(a,n.width-a)),Lh(o[1][1],a,Math.max(a,n.height-a))]],l=Math.max(0,s[1][0]-s[0][0]),c=Math.max(0,s[1][1]-s[0][1]);if(0===l||0===c)return{dots:[],cellSize:Sh,features:i};const u=Ph(r.columns);let d=Math.max(2,u?l/u:Ph(r.cellSize)??Sh);const h=Math.max(100,Math.round(Ph(r.maxSamples)??Mh)),f=Math.ceil(l/d)*Math.ceil(c/d);f>h&&(d*=Math.sqrt(f/h));const p=r.gridOrigin?.[0]??0,m=r.gridOrigin?.[1]??0,[g,y]=Th(s[0][0],s[1][0],p,d),[v,b]=Th(s[0][1],s[1][1],m,d),x=[],w=function(e){return e.map((e,t)=>{if(Ah.has(e))return{feature:e,index:t,bounds:Ah.get(e)??null};try{const n=function(e){var t,n,r,i,o,a,s;if(ue=ce=-(se=le=1/0),ge=[],Y(e,Ae),n=ge.length){for(ge.sort(ze),t=1,o=[r=ge[0]];n>t;++t)De(r,(i=ge[t])[0])||De(r,i[1])?(Te(r[0],i[1])>Te(r[0],r[1])&&(r[1]=i[1]),Te(i[0],r[1])>Te(r[0],r[1])&&(r[0]=i[0])):o.push(r=i);for(a=-1/0,t=0,r=o[n=o.length-1];n>=t;r=i,++t)(s=Te(r[1],(i=o[t])[0]))>a&&(a=s,se=i[0],ce=r[1])}return ge=ye=null,se===1/0||le===1/0?[[NaN,NaN],[NaN,NaN]]:[[se,le],[ce,ue]]}(e);return Ah.set(e,n),{feature:e,index:t,bounds:n}}catch{return Ah.set(e,null),{feature:e,index:t,bounds:null}}})}(i);for(let e=v;b>=e;e+=1){const n=m+(e+.5)*d;for(let i=g;y>=i;i+=1){const o=t.invertedPoint(p+(i+.5)*d,n);if(!o||!Number.isFinite(o[0])||!Number.isFinite(o[1]))continue;const a=_h(w,o);if(!a)continue;const s={...Eh(a.feature),featureId:Ih(a.feature,a.index),featureIndex:a.index,gridRow:e,gridColumn:i,longitude:o[0],latitude:o[1],dotIndex:x.length};r.dotFilter&&!r.dotFilter(s,x.length)||x.push(s)}}return{dots:x,cellSize:d,features:i}}function Fh(e){return Math.round(1e4*e)/1e4}function Wh(e){return Array.isArray(e)&&e.length>=2&&Number.isFinite(e[0])&&Number.isFinite(e[1])?`${Fh(Number(e[0]))},${Fh(Number(e[1]))}`:"null"}function Bh(e,t){const n=e[t];return"function"==typeof n?n.call(e):void 0}function Hh(e){return"number"==typeof e&&Number.isFinite(e)?Fh(e)+"":null===e?"null":"unavailable"}function $h(e){const t=e.scales.projection;return[Hh(Bh(t,"scale")),Wh(Bh(t,"translate")),Wh(Bh(t,"center")),(n=Bh(t,"rotate"),Array.isArray(n)&&n.every(Number.isFinite)?n.map(e=>Fh(Number(e))).join(","):"unavailable"),Hh(Bh(t,"clipAngle")),Hh(Bh(t,"precision")),...[[0,0],[-120,35],[45,45],[120,-30]].map(([t,n])=>Wh(e.scales.projectedPoint(t,n)))].join("|");var n}function qh(e){return e.map(([e,t],n)=>`${0===n?"M":"L"}${e},${t}`).join("")+"Z"}var Gh=e=>{const t=function(e){let t=jh.get(e.areas);t||(t=new Map,jh.set(e.areas,t));const n=function(e){const t=e.config;return[e.areas.length,e.dimensions.width,e.dimensions.height,t.cellSize??"",t.columns??"",t.layoutPadding??"",t.gridOrigin?.join(",")??"",t.maxSamples??"",zh(t.featureFilter),zh(t.dotFilter),$h(e)].join("::")}(e),r=t.get(n);if(r)return r;const i=Oh(e.areas,e.scales,e.dimensions,e.config);if(t.size>=12){const e=t.keys().next().value;void 0!==e&&t.delete(e)}return t.set(n,i),i}(e),n=e.config,r=n.shape??"circle",i=Math.max(.5,Ph(n.dotRadius)??t.cellSize*Lh(n.radiusRatio??.24,.05,.5)),o=n.gridOrigin?.[0]??0,a=n.gridOrigin?.[1]??0,s=t.dots.map((s,l)=>{const c=o+(s.gridColumn+.5)*t.cellSize,u=a+(s.gridRow+.5)*t.cellSize,d=Nh(s,n.categoryAccessor),h=Nh(s,n.fillAccessor),f={fill:null!=h?h+"":null!=d?e.resolveColor(d+""):e.theme.categorical[0]??"#4f86c6",fillOpacity:.92,strokeWidth:0,..."function"==typeof n.markStyle?n.markStyle(s,l):n.markStyle},p=`dot-${s.gridRow}-${s.gridColumn}`;if("circle"===r)return{type:"point",x:c,y:u,r:i,style:f,datum:s,interactive:!1,pointId:p,_transitionKey:p};const m="hexagon"===r?function(e,t,n){return qh(Array.from({length:6},(r,i)=>{const o=-Math.PI/2+i*(Math.PI/3);return[e+Math.cos(o)*n,t+Math.sin(o)*n]}))}(c,u,i):function(e,t,n){return qh([[e-n,t-n],[e+n,t-n],[e+n,t+n],[e-n,t+n]])}(c,u,i);return{type:"geoarea",pathData:m,centroid:[c,u],bounds:[[c-i,u-i],[c+i,u+i]],screenArea:"hexagon"===r?3*Math.sqrt(3)*i*i/2:(2*i)**2,style:f,datum:s,group:s.featureId,interactive:!1}});return{nodes:s,overlays:n.showOutline?(0,kh.jsx)("g",{"aria-hidden":"true",pointerEvents:"none",children:t.features.map((t,r)=>{const i=e.scales.geoPath(t);return i?(0,kh.jsx)("path",{d:i,fill:"none",stroke:n.outlineStyle?.stroke??"currentColor",strokeOpacity:n.outlineStyle?.opacity??n.outlineStyle?.fillOpacity??.22,strokeWidth:n.outlineStyle?.strokeWidth??.7,strokeDasharray:n.outlineStyle?.strokeDasharray,strokeLinecap:n.outlineStyle?.strokeLinecap,vectorEffect:"non-scaling-stroke"},Ih(t,r)):null})}):null,restyle:(e,t)=>t?.isActive&&e.datum?{opacity:t.predicate(e.datum)?1:.14}:{opacity:1}}};function Vh(e,t,n){const{featureKey:r,dataKey:i}=n,o=new Map;for(const e of t){const t=(Object.prototype.hasOwnProperty.call(e,i)?e[i]:void 0)+"";o.set(t,e)}return e.map(e=>{const t=(e=>{const t=r.split(".");let n=e;for(const e of t)n=null!==n&&"object"==typeof n&&Object.prototype.hasOwnProperty.call(n,e)?n[e]:void 0;return(n??"")+""})(e),n=o.get(t);return n?{...e,properties:{...e.properties,...n}}:e})}
|
|
2
|
+
function e({target:e,children:t}){const[n,r]=To.useState({requestedTarget:e,resolved:!1,target:null});return To.useEffect(()=>{const t=function(e){return"string"==typeof e?document.getElementById(e):"function"==typeof e?e():e}(e);"production"!==process.env.NODE_ENV&&null==t&&"string"==typeof e&&console.warn(`[Semiotic] accessibleTable portal target "${e}" was not found. Rendering the data-summary controls inline instead.`),r({requestedTarget:e,resolved:!0,target:t})},[e]),n.requestedTarget===e&&n.resolved?n.target?(0,Do.createPortal)(t,n.target):(0,zo.jsx)(zo.Fragment,{children:t}):null}function t(e){return e>1?xa:-1>e?-xa:Math.asin(e)}function n(e){return(e=Ea(e/2))*e}function r(){}function i(e,t){e&&_a.hasOwnProperty(e.type)&&_a[e.type](e,t)}function o(e,t,n){var r,i=-1,o=e.length-n;for(t.lineStart();++i<o;)t.point((r=e[i])[0],r[1],r[2]);t.lineEnd()}function a(e,t){var n=-1,r=e.length;for(t.polygonStart();++n<r;)o(e[n],t,1);t.polygonEnd()}function s(e,t){e&&za.hasOwnProperty(e.type)?za[e.type](e,t):i(e,t)}function l(){Wa.point=u}function c(){d(Jo,ea)}function u(e,t){Wa.point=d,Jo=e,ea=t,ta=e*=Ma,na=Ra(t=(t*=Ma)/2+wa),ra=Ea(t)}function d(e,t){var n=(e*=Ma)-ta,r=0>n?-1:1,i=r*n,o=Ra(t=(t*=Ma)/2+wa),a=Ea(t),s=ra*a,l=na*o+s*Ra(i),c=s*r*Ea(i);Oa.add(Ca(c,l)),ta=e,na=o,ra=a}function h(e){return[Ca(e[1],e[0]),t(e[2])]}function f(e){var t=e[0],n=e[1],r=Ra(n);return[r*Ra(t),r*Ea(t),Ea(n)]}function p(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function m(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function g(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function y(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function v(e){var t=Ta(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}function b(e,t){fa.push(pa=[ia=e,aa=e]),oa>t&&(oa=t),t>sa&&(sa=t)}function x(e,t){var n=f([e*Ma,t*Ma]);if(da){var r=m(da,n),i=m([r[1],-r[0],0],r);v(i),i=h(i);var o,a=e-la,s=a>0?1:-1,l=i[0]*Sa*s,c=ja(a)>180;c^(l>s*la&&s*e>l)?(o=i[1]*Sa)>sa&&(sa=o):c^((l=(l+360)%360-180)>s*la&&s*e>l)?oa>(o=-i[1]*Sa)&&(oa=o):(oa>t&&(oa=t),t>sa&&(sa=t)),c?la>e?A(ia,e)>A(ia,aa)&&(aa=e):A(e,aa)>A(ia,aa)&&(ia=e):ia>aa?e>la?A(ia,e)>A(ia,aa)&&(aa=e):A(e,aa)>A(ia,aa)&&(ia=e):(ia>e&&(ia=e),e>aa&&(aa=e))}else fa.push(pa=[ia=e,aa=e]);oa>t&&(oa=t),t>sa&&(sa=t),da=n,la=e}function w(){Ha.point=x}function k(){pa[0]=ia,pa[1]=aa,Ha.point=b,da=null}function S(e,t){if(da){var n=e-la;ha.add(ja(n)>180?n+(n>0?360:-360):n)}else ca=e,ua=t;Wa.point(e,t),x(e,t)}function M(){Wa.lineStart()}function j(){S(ca,ua),Wa.lineEnd(),ja(ha)>ya&&(ia=-(aa=180)),pa[0]=ia,pa[1]=aa,da=null}function A(e,t){return 0>(t-=e)?t+360:t}function C(e,t){return e[0]-t[0]}function R(e,t){return e[0]>e[1]?e[0]>t||t>e[1]:t>=e[0]&&e[1]>=t}function L(e,t){function n(n,r){return n=e(n,r),t(n[0],n[1])}return e.invert&&t.invert&&(n.invert=function(n,r){return(n=t.invert(n,r))&&e.invert(n[0],n[1])}),n}function P(e,t){return ja(e)>ba&&(e-=Math.round(e/ka)*ka),[e,t]}function N(e,t,n){return(e%=ka)?t||n?L(I(e),T(t,n)):I(e):t||n?T(t,n):P}function E(e){return function(t,n){return ja(t+=e)>ba&&(t-=Math.round(t/ka)*ka),[t,n]}}function I(e){var t=E(e);return t.invert=E(-e),t}function T(e,n){function r(e,n){var r=Ra(n),l=Ra(e)*r,c=Ea(e)*r,u=Ea(n),d=u*i+l*o;return[Ca(c*a-d*s,l*i-u*o),t(d*a+c*s)]}var i=Ra(e),o=Ea(e),a=Ra(n),s=Ea(n);return r.invert=function(e,n){var r=Ra(n),l=Ra(e)*r,c=Ea(e)*r,u=Ea(n),d=u*a-c*s;return[Ca(c*a+u*s,l*i+d*o),t(d*i-l*o)]},r}function D(e,t){(t=f(t))[0]-=e,v(t);var n,r=(n=-t[1])>1?0:-1>n?ba:Math.acos(n);return((0>-t[2]?-r:r)+ka-ya)%ka}function z(){var e,t=[];return{point:function(t,n,r){e.push([t,n,r])},lineStart:function(){t.push(e=[])},lineEnd:r,rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))},result:function(){var n=t;return t=[],e=null,n}}}function _(e,t){return ja(e[0]-t[0])<ya&&ja(e[1]-t[1])<ya}function O(e,t,n,r){this.x=e,this.z=t,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function F(e,t,n,r,i){var o,a,s=[],l=[];if(e.forEach(function(e){if((t=e.length-1)>0){var t,n,r=e[0],a=e[t];if(_(r,a)){if(!r[2]&&!a[2]){for(i.lineStart(),o=0;t>o;++o)i.point((r=e[o])[0],r[1]);return void i.lineEnd()}a[0]+=2e-6}s.push(n=new O(r,e,null,!0)),l.push(n.o=new O(r,null,n,!1)),s.push(n=new O(a,e,null,!1)),l.push(n.o=new O(a,null,n,!0))}}),s.length){for(l.sort(t),W(s),W(l),o=0,a=l.length;a>o;++o)l[o].e=n=!n;for(var c,u,d=s[0];;){for(var h=d,f=!0;h.v;)if((h=h.n)===d)return;c=h.z,i.lineStart();do{if(h.v=h.o.v=!0,h.e){if(f)for(o=0,a=c.length;a>o;++o)i.point((u=c[o])[0],u[1]);else r(h.x,h.n.x,1,i);h=h.n}else{if(f)for(o=(c=h.p.z).length-1;o>=0;--o)i.point((u=c[o])[0],u[1]);else r(h.x,h.p.x,-1,i);h=h.p}c=(h=h.o).z,f=!f}while(!h.v);i.lineEnd()}}}function W(e){if(t=e.length){for(var t,n,r=0,i=e[0];++r<t;)i.n=n=e[r],n.p=i,i=n;i.n=n=e[0],n.p=i}}function B(e){return ja(e[0])>ba?Ia(e[0])*((ja(e[0])+ba)%ka-ba):e[0]}function H(e,n){var r=B(n),i=n[1],o=Ea(i),a=[Ea(r),-Ra(r),0],s=0,l=0,c=new ts.Adder;1===o?i=xa+ya:-1===o&&(i=-xa-ya);for(var u=0,d=e.length;d>u;++u)if(p=(h=e[u]).length)for(var h,p,g=h[p-1],y=B(g),b=g[1]/2+wa,x=Ea(b),w=Ra(b),k=0;p>k;++k,y=M,x=A,w=C,g=S){var S=h[k],M=B(S),j=S[1]/2+wa,A=Ea(j),C=Ra(j),R=M-y,L=0>R?-1:1,P=L*R,N=P>ba,E=x*A;if(c.add(Ca(E*L*Ea(P),w*C+E*Ra(P))),s+=N?R+L*ka:R,N^y>=r^M>=r){var I=m(f(g),f(S));v(I);var T=m(a,I);v(T);var D=(N^R>=0?-1:1)*t(T[2]);(i>D||i===D&&(I[0]||I[1]))&&(l+=N^R>=0?1:-1)}}return(-ya>s||ya>s&&-1e-12>c)^1&l}function $(e,t,n,r){return function(i){function o(t,n){e(t,n)&&i.point(t,n)}function a(e,t){m.point(e,t)}function s(){b.point=a,m.lineStart()}function l(){b.point=o,m.lineEnd()}function c(e,t){p.push([e,t]),y.point(e,t)}function u(){y.lineStart(),p=[]}function d(){c(p[0][0],p[0][1]),y.lineEnd();var e,t,n,r,o=y.clean(),a=g.result(),s=a.length;if(p.pop(),h.push(p),p=null,s)if(1&o){if((t=(n=a[0]).length-1)>0){for(v||(i.polygonStart(),v=!0),i.lineStart(),e=0;t>e;++e)i.point((r=n[e])[0],r[1]);i.lineEnd()}}else s>1&&2&o&&a.push(a.pop().concat(a.shift())),f.push(a.filter(q))}var h,f,p,m=t(i),g=z(),y=t(g),v=!1,b={point:o,lineStart:s,lineEnd:l,polygonStart:function(){b.point=c,b.lineStart=u,b.lineEnd=d,f=[],h=[]},polygonEnd:function(){b.point=o,b.lineStart=s,b.lineEnd=l,f=(0,ns.merge)(f);var e=H(h,r);f.length?(v||(i.polygonStart(),v=!0),F(f,G,e,n,i)):e&&(v||(i.polygonStart(),v=!0),i.lineStart(),n(null,null,1,i),i.lineEnd()),v&&(i.polygonEnd(),v=!1),f=h=null},sphere:function(){i.polygonStart(),i.lineStart(),n(null,null,1,i),i.lineEnd(),i.polygonEnd()}};return b}}function q(e){return e.length>1}function G(e,t){return(0>(e=e.x)[0]?e[1]-xa-ya:xa-e[1])-(0>(t=t.x)[0]?t[1]-xa-ya:xa-t[1])}function V(){ls.point=ls.lineEnd=r}function U(e,t){qa=e*=Ma,Ga=Ea(t*=Ma),Va=Ra(t),ls.point=Y}function Y(e,t){e*=Ma;var n=Ea(t*=Ma),r=Ra(t),i=ja(e-qa),o=Ra(i),a=r*Ea(i),s=Va*n-Ga*r*o,l=Ga*n+Va*r*o;$a.add(Ca(Ta(a*a+s*s),l)),qa=e,Ga=n,Va=r}function X(e,t){return cs[0]=e,cs[1]=t,n=us,$a=new ss.Adder,s(n,ls),+$a;var n}function Z(e,t){return!(!e||!hs.hasOwnProperty(e.type))&&hs[e.type](e,t)}function K(e,t){return 0===X(e,t)}function Q(e,t){for(var n,r,i,o=0,a=e.length;a>o;o++){if(0===(r=X(e[o],t)))return!0;if(o>0&&(i=X(e[o],e[o-1]))>0&&i>=n&&i>=r&&va*i>(n+r-i)*(1-Math.pow((n-r)/i,2)))return!0;n=r}return!1}function J(e,t){return!!H(e.map(ee),te(t))}function ee(e){return(e=e.map(te)).pop(),e}function te(e){return[e[0]*Ma,e[1]*Ma]}function ne(e,t){return(e&&ds.hasOwnProperty(e.type)?ds[e.type]:Z)(e,t)}function re(e,t,n){var r=(0,fs.range)(e,t-ya,n).concat(t);return function(e){return r.map(function(t){return[e,t]})}}function ie(e,t,n){var r=(0,fs.range)(e,t-ya,n).concat(t);return function(e){return r.map(function(t){return[t,e]})}}function oe(e,r){var i=e[0]*Ma,o=e[1]*Ma,a=r[0]*Ma,s=r[1]*Ma,l=Ra(o),c=Ea(o),u=Ra(s),d=Ea(s),h=l*Ra(i),f=l*Ea(i),p=u*Ra(a),m=u*Ea(a),g=2*t(Ta(n(s-o)+l*u*n(a-i))),y=Ea(g),v=g?function(e){var t=Ea(e*=g)/y,n=Ea(g-e)/y,r=n*h+t*p,i=n*f+t*m,o=n*c+t*d;return[Ca(i,r)*Sa,Ca(o,Ta(r*r+i*i))*Sa]}:function(){return[i*Sa,o*Sa]};return v.distance=g,v}function ae(){vs.point=se}function se(e,t){vs.point=le,Ua=Xa=e,Ya=Za=t}function le(e,t){ys.add(Za*e-Xa*t),Xa=e,Za=t}function ce(){le(Ua,Ya)}function ue(e,t){js+=e,As+=t,++Cs}function de(){Ts.point=he}function he(e,t){Ts.point=fe,ue(Ja=e,es=t)}function fe(e,t){var n=e-Ja,r=t-es,i=Ta(n*n+r*r);Rs+=i*(Ja+e)/2,Ls+=i*(es+t)/2,Ps+=i,ue(Ja=e,es=t)}function pe(){Ts.point=ue}function me(){Ts.point=ye}function ge(){ve(Ka,Qa)}function ye(e,t){Ts.point=ve,ue(Ka=Ja=e,Qa=es=t)}function ve(e,t){var n=e-Ja,r=t-es,i=Ta(n*n+r*r);Rs+=i*(Ja+e)/2,Ls+=i*(es+t)/2,Ps+=i,Ns+=(i=es*e-Ja*t)*(Ja+e),Es+=i*(es+t),Is+=3*i,ue(Ja=e,es=t)}function be(e){this._context=e}function xe(e,t){Us.point=we,_s=Fs=e,Os=Ws=t}function we(e,t){Vs.add(Ta((Fs-=e)*Fs+(Ws-=t)*Ws)),Fs=e,Ws=t}function ke(e){let t=1;this._+=e[0];for(const n=e.length;n>t;++t)this._+=arguments[t]+e[t]}function Se(e,t){function n(e){return e&&("function"==typeof a&&i.pointRadius(+a.apply(this,arguments)),s(e,r(i))),i.result()}let r,i,o=3,a=4.5;return n.area=function(e){return s(e,r(bs)),bs.result()},n.measure=function(e){return s(e,r(Ys)),Ys.result()},n.bounds=function(e){return s(e,r(Ms)),Ms.result()},n.centroid=function(e){return s(e,r(Ds)),Ds.result()},n.projection=function(t){return arguments.length?(r=null==t?(e=null,ps):(e=t).stream,n):e},n.context=function(e){return arguments.length?(i=null==e?(t=null,new Xs(o)):new be(t=e),"function"!=typeof a&&i.pointRadius(a),n):t},n.pointRadius=function(e){return arguments.length?(a="function"==typeof e?e:(i.pointRadius(+e),+e),n):a},n.digits=function(e){if(!arguments.length)return o;if(null==e)o=null;else{const t=Math.floor(e);if(0>t)throw new RangeError("invalid digits: "+e);o=t}return null===t&&(i=new Xs(o)),n},n.projection(e).digits(o).context(t)}function Me(e){return function(t){var n=new je;for(var r in e)n[r]=e[r];return n.stream=t,n}}function je(){}function Ae(e,t,n){var r=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),null!=r&&e.clipExtent(null),s(n,e.stream(Ms)),t(Ms.result()),null!=r&&e.clipExtent(r),e}function Ce(e,t,n){return Ae(e,function(n){var r=t[1][0]-t[0][0],i=t[1][1]-t[0][1],o=Math.min(r/(n[1][0]-n[0][0]),i/(n[1][1]-n[0][1])),a=+t[0][0]+(r-o*(n[1][0]+n[0][0]))/2,s=+t[0][1]+(i-o*(n[1][1]+n[0][1]))/2;e.scale(150*o).translate([a,s])},n)}function Re(e,t,n){return Ce(e,[[0,0],t],n)}function Le(e,t,n){return Ae(e,function(n){var r=+t,i=r/(n[1][0]-n[0][0]),o=(r-i*(n[1][0]+n[0][0]))/2,a=-i*n[0][1];e.scale(150*i).translate([o,a])},n)}function Pe(e,t,n){return Ae(e,function(n){var r=+t,i=r/(n[1][1]-n[0][1]),o=-i*n[0][0],a=(r-i*(n[1][1]+n[0][1]))/2;e.scale(150*i).translate([o,a])},n)}function Ne(e,n){return+n?function(e,n){function r(i,o,a,s,l,c,u,d,h,f,p,m,g,y){var v=u-i,b=d-o,x=v*v+b*b;if(x>4*n&&g--){var w=s+f,k=l+p,S=c+m,M=Ta(w*w+k*k+S*S),j=t(S/=M),A=ja(ja(S)-1)<ya||ja(a-h)<ya?(a+h)/2:Ca(k,w),C=e(A,j),R=C[0],L=C[1],P=R-i,N=L-o,E=b*P-v*N;(E*E/x>n||ja((v*P+b*N)/x-.5)>.3||Zs>s*f+l*p+c*m)&&(r(i,o,a,s,l,c,R,L,A,w/=M,k/=M,S,g,y),y.point(R,L),r(R,L,A,w,k,S,u,d,h,f,p,m,g,y))}}return function(t){function n(n,r){n=e(n,r),t.point(n[0],n[1])}function i(){v=NaN,S.point=o,t.lineStart()}function o(n,i){var o=f([n,i]),a=e(n,i);r(v,b,y,x,w,k,v=a[0],b=a[1],y=n,x=o[0],w=o[1],k=o[2],16,t),t.point(v,b)}function a(){S.point=n,t.lineEnd()}function s(){i(),S.point=l,S.lineEnd=c}function l(e,t){o(u=e,t),d=v,h=b,p=x,m=w,g=k,S.point=o}function c(){r(v,b,y,x,w,k,d,h,u,p,m,g,16,t),S.lineEnd=a,a()}var u,d,h,p,m,g,y,v,b,x,w,k,S={point:n,lineStart:i,lineEnd:a,polygonStart:function(){t.polygonStart(),S.lineStart=s},polygonEnd:function(){t.polygonEnd(),S.lineStart=i}};return S}}(e,n):function(e){return Me({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}(e)}function Ee(e,t,n,r,i,o){function a(e,o){return[c*(e*=r)-u*(o*=i)+t,n-u*e-c*o]}if(!o)return function(e,t,n,r,i){function o(o,a){return[t+e*(o*=r),n-e*(a*=i)]}return o.invert=function(o,a){return[(o-t)/e*r,(n-a)/e*i]},o}(e,t,n,r,i);var s=Ra(o),l=Ea(o),c=s*e,u=l*e,d=s/e,h=l/e,f=(l*n-s*t)/e,p=(l*t+s*n)/e;return a.invert=function(e,t){return[r*(d*e-h*t+f),i*(p-h*e-d*t)]},a}function Ie(e){return Te(function(){return e})()}function Te(e){function t(e){return v(e[0]*Ma,e[1]*Ma)}function n(e){return(e=v.invert(e[0],e[1]))&&[e[0]*Sa,e[1]*Sa]}function r(){var e=Ee(w,0,0,E,I,P).apply(null,o(M,j)),t=Ee(w,k-e[0],S-e[1],E,I,P);return a=N(A,C,R),d=L(o,t),v=L(a,d),u=Ne(d,H),i()}function i(){return b=x=null,t}var o,a,s,l,c,u,d,v,b,x,w=150,k=480,S=250,M=0,j=0,A=0,C=0,R=0,P=0,E=1,I=1,T=null,O=rs,W=null,B=ps,H=.5;return t.stream=function(e){return b&&x===e?b:b=Ks(function(e){return Me({point:function(t,n){var r=e(t,n);return this.stream.point(r[0],r[1])}})}(a)(O(u(B(x=e)))))},t.preclip=function(e){return arguments.length?(O=e,T=void 0,i()):O},t.postclip=function(e){return arguments.length?(B=e,W=s=l=c=null,i()):B},t.clipAngle=function(e){return arguments.length?(O=+e?function(e){function t(e,t){return Ra(e)*Ra(t)>i}function n(e,t,n){var r=[1,0,0],o=m(f(e),f(t)),a=p(o,o),s=o[0],l=a-s*s;if(!l)return!n&&e;var c=i*a/l,u=-i*s/l,d=m(r,o),v=y(r,c);g(v,y(o,u));var b=d,x=p(v,b),w=p(b,b),k=x*x-w*(p(v,v)-1);if(k>=0){var S=Ta(k),M=y(b,(-x-S)/w);if(g(M,v),M=h(M),!n)return M;var j,A=e[0],C=t[0],R=e[1],L=t[1];A>C&&(j=A,A=C,C=j);var P=C-A,N=ja(P-ba)<ya;if(!N&&R>L&&(j=R,R=L,L=j),N||ya>P?N?R+L>0^M[1]<(ja(M[0]-A)<ya?R:L):M[1]>=R&&L>=M[1]:P>ba^(M[0]>=A&&C>=M[0])){var E=y(b,(-x+S)/w);return g(E,v),[M,h(E)]}}}function r(t,n){var r=a?e:ba-e,i=0;return-r>t?i|=1:t>r&&(i|=2),-r>n?i|=4:n>r&&(i|=8),i}var i=Ra(e),o=2*Ma,a=i>0,s=ja(i)>ya;return $(t,function(e){var i,o,l,c,u;return{lineStart:function(){c=l=!1,u=1},point:function(d,h){var f,p=[d,h],m=t(d,h),g=a?m?0:r(d,h):m?r(d+(0>d?ba:-ba),h):0;if(!i&&(c=l=m)&&e.lineStart(),m!==l&&(!(f=n(i,p))||_(i,f)||_(p,f))&&(p[2]=1),m!==l)u=0,m?(e.lineStart(),f=n(p,i),e.point(f[0],f[1])):(f=n(i,p),e.point(f[0],f[1],2),e.lineEnd()),i=f;else if(s&&i&&a^m){var y;g&o||!(y=n(p,i,!0))||(u=0,a?(e.lineStart(),e.point(y[0][0],y[0][1]),e.point(y[1][0],y[1][1]),e.lineEnd()):(e.point(y[1][0],y[1][1]),e.lineEnd(),e.lineStart(),e.point(y[0][0],y[0][1],3)))}!m||i&&_(i,p)||e.point(p[0],p[1]),i=p,l=m,o=g},lineEnd:function(){l&&e.lineEnd(),i=null},clean:function(){return u|(c&&l)<<1}}},function(t,n,r,i){!function(e,t,n,r,i,o){if(n){var a=Ra(t),s=Ea(t),l=r*n;null==i?(i=t+r*ka,o=t-l/2):(i=D(a,i),o=D(a,o),(r>0?o>i:i>o)&&(i+=r*ka));for(var c,u=i;r>0?u>o:o>u;u-=l)c=h([a,-s*Ra(u),-s*Ea(u)]),e.point(c[0],c[1])}}(i,e,o,r,t,n)},a?[0,-e]:[-ba,e-ba])}(T=e*Ma):(T=null,rs),i()):T*Sa},t.clipExtent=function(e){return arguments.length?(B=null==e?(W=s=l=c=null,ps):function(e,t,n,r){function i(i,o){return!(e>i||i>n||t>o||o>r)}function o(i,o,s,c){var u=0,d=0;if(null==i||(u=a(i,s))!==(d=a(o,s))||0>l(i,o)^s>0)do{c.point(0===u||3===u?e:n,u>1?r:t)}while((u=(u+s+4)%4)!==d);else c.point(o[0],o[1])}function a(r,i){return ja(r[0]-e)<ya?i>0?0:3:ja(r[0]-n)<ya?i>0?2:1:ja(r[1]-t)<ya?i>0?1:0:i>0?3:2}function s(e,t){return l(e.x,t.x)}function l(e,t){var n=a(e,1),r=a(t,1);return n!==r?n-r:0===n?t[1]-e[1]:1===n?e[0]-t[0]:2===n?e[1]-t[1]:t[0]-e[0]}return function(a){function l(e,t){i(e,t)&&w.point(e,t)}function c(o,a){var s=i(o,a);if(d&&h.push([o,a]),b)f=o,p=a,m=s,b=!1,s&&(w.lineStart(),w.point(o,a));else if(s&&v)w.point(o,a);else{var l=[g=Math.max(as,Math.min(os,g)),y=Math.max(as,Math.min(os,y))],c=[o=Math.max(as,Math.min(os,o)),a=Math.max(as,Math.min(os,a))];!function(e,t,n,r,i,o){var a,s=e[0],l=e[1],c=0,u=1,d=t[0]-s,h=t[1]-l;if(a=n-s,d||0>=a){if(a/=d,0>d){if(c>a)return;u>a&&(u=a)}else if(d>0){if(a>u)return;a>c&&(c=a)}if(a=i-s,d||a>=0){if(a/=d,0>d){if(a>u)return;a>c&&(c=a)}else if(d>0){if(c>a)return;u>a&&(u=a)}if(a=r-l,h||0>=a){if(a/=h,0>h){if(c>a)return;u>a&&(u=a)}else if(h>0){if(a>u)return;a>c&&(c=a)}if(a=o-l,h||a>=0){if(a/=h,0>h){if(a>u)return;a>c&&(c=a)}else if(h>0){if(c>a)return;u>a&&(u=a)}return c>0&&(e[0]=s+c*d,e[1]=l+c*h),1>u&&(t[0]=s+u*d,t[1]=l+u*h),!0}}}}}(l,c,e,t,n,r)?s&&(w.lineStart(),w.point(o,a),x=!1):(v||(w.lineStart(),w.point(l[0],l[1])),w.point(c[0],c[1]),s||w.lineEnd(),x=!1)}g=o,y=a,v=s}var u,d,h,f,p,m,g,y,v,b,x,w=a,k=z(),S={point:l,lineStart:function(){S.point=c,d&&d.push(h=[]),b=!0,v=!1,g=y=NaN},lineEnd:function(){u&&(c(f,p),m&&v&&k.rejoin(),u.push(k.result())),S.point=l,v&&w.lineEnd()},polygonStart:function(){w=k,u=[],d=[],x=!0},polygonEnd:function(){var t=function(){for(var t=0,n=0,i=d.length;i>n;++n)for(var o,a,s=d[n],l=1,c=s.length,u=s[0],h=u[0],f=u[1];c>l;++l)o=h,a=f,h=(u=s[l])[0],f=u[1],a>r?r>=f&&(f-a)*(e-o)>(h-o)*(r-a)&&--t:f>r&&(h-o)*(r-a)>(f-a)*(e-o)&&++t;return t}(),n=x&&t,i=(u=(0,is.merge)(u)).length;(n||i)&&(a.polygonStart(),n&&(a.lineStart(),o(null,null,1,a),a.lineEnd()),i&&F(u,s,t,o,a),a.polygonEnd()),w=a,u=d=h=null}};return S}}(W=+e[0][0],s=+e[0][1],l=+e[1][0],c=+e[1][1]),i()):null==W?null:[[W,s],[l,c]]},t.scale=function(e){return arguments.length?(w=+e,r()):w},t.translate=function(e){return arguments.length?(k=+e[0],S=+e[1],r()):[k,S]},t.center=function(e){return arguments.length?(M=e[0]%360*Ma,j=e[1]%360*Ma,r()):[M*Sa,j*Sa]},t.rotate=function(e){return arguments.length?(A=e[0]%360*Ma,C=e[1]%360*Ma,R=e.length>2?e[2]%360*Ma:0,r()):[A*Sa,C*Sa,R*Sa]},t.angle=function(e){return arguments.length?(P=e%360*Ma,r()):P*Sa},t.reflectX=function(e){return arguments.length?(E=e?-1:1,r()):0>E},t.reflectY=function(e){return arguments.length?(I=e?-1:1,r()):0>I},t.precision=function(e){return arguments.length?(u=Ne(d,H=e*e),i()):Ta(H)},t.fitExtent=function(e,n){return Ce(t,e,n)},t.fitSize=function(e,n){return Re(t,e,n)},t.fitWidth=function(e,n){return Le(t,e,n)},t.fitHeight=function(e,n){return Pe(t,e,n)},function(){return o=e.apply(this,arguments),t.invert=o.invert&&n,r()}}function De(e,n){function r(e,t){var n=Ta(a-2*o*Ea(t))/o;return[n*Ea(e*=o),s-n*Ra(e)]}var i=Ea(e),o=(i+Ea(n))/2;if(ja(o)<ya)return function(e){function n(e,t){return[e*r,Ea(t)/r]}var r=Ra(e);return n.invert=function(e,n){return[e/r,t(n*r)]},n}(e);var a=1+i*(2*o-i),s=Ta(a)/o;return r.invert=function(e,n){var r=s-n,i=Ca(e,ja(r))*Ia(r);return 0>r*o&&(i-=ba*Ia(e)*Ia(r)),[i/o,t((a-(e*e+r*r)*o*o)/(2*o))]},r}function ze(){return(e=De,t=0,n=ba/3,r=Te(e),i=r(t,n),i.parallels=function(e){return arguments.length?r(t=e[0]*Ma,n=e[1]*Ma):[t*Sa,n*Sa]},i).scale(155.424).center([0,33.6442]);var e,t,n,r,i}function _e(e,t){return[e,Na(Da((xa+t)/2))]}function Oe(e,t){return[e,t]}function Fe(e,n){var r=t(rl*Ea(n)),i=r*r,o=i*i*i;return[e*Ra(r)/(rl*(Js+3*el*i+o*(7*tl+9*nl*i))),r*(Js+el*i+o*(tl+nl*i))]}function We(){return Ie(Fe).scale(177.158)}function Be(e,t){var n=t*t,r=n*n;return[e*(.8707-.131979*n+r*(r*(.003971*n-.001529*r)-.013791)),t*(1.007226+n*(.015085+r*(.028874*n-.044475-.005916*r)))]}function He(e,t){return[Ra(t)*Ea(e),Ea(t)]}function $e(e,t,n){return e+(t-e)*n}function qe(e,t,n){if(1>=n)return 1;const r=n-1;return function(e){const t=Math.max(0,Math.min(1,e.minOpacity??.1));if(Number.isNaN(e.age))return 1;if(e.age===1/0)return t;if(!Number.isFinite(e.extent)||0>=e.extent)return 1;const n=Math.max(0,e.age);if("step"===e.type)return(e.threshold??.5*e.extent)>n?1:t;if("exponential"===e.type){const r=e.halfLife??e.extent/2;return t+Math.pow(.5,n/(r>0?r:e.extent/2))*(1-t)}return t+Math.max(0,Math.min(1,1-n/e.extent))*(1-t)}({age:r-t,extent:r,type:e.type,halfLife:e.halfLife??n/2,threshold:e.stepThreshold??.5*n,minOpacity:e.minOpacity??.1})}function Ge(e,t,n){const r=e.duration??500,i=n-t;return r>i?1-i/r:0}function Ve(e,t,n,r){let i=!1;return t>0?(e._pulseIntensity!==t&&(e._pulseIntensity=t,i=!0),e._pulseColor!==n&&(e._pulseColor=n,i=!0),e._pulseGlowRadius!==r&&(e._pulseGlowRadius=r,i=!0),i):(0!==e._pulseIntensity&&(e._pulseIntensity=0,i=!0),void 0!==e._pulseColor&&(e._pulseColor=void 0,i=!0),void 0!==e._pulseGlowRadius&&(e._pulseGlowRadius=void 0,i=!0),i)}function Ue(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function Ye(e,t,n){const r=e=>e.toString(16).padStart(2,"0");return`#${r(e)}${r(t)}${r(n)}`}function Xe(e){const t=e.map(Ue),n=t.length-1;return e=>{if(Number.isNaN(e)&&(e=0),0>=e){const[e,n,r]=t[0];return Ye(e,n,r)}if(e>=1){const[e,r,i]=t[n];return Ye(e,r,i)}const r=e*n,i=Math.floor(r),o=r-i,[a,s,l]=t[i],[c,u,d]=t[i+1];return Ye(Math.round(a+(c-a)*o),Math.round(s+(u-s)*o),Math.round(l+(d-l)*o))}}function Ze(e){return e&&Object.prototype.hasOwnProperty.call(Sl,e)?Sl[e]:dl}function Ke(e,t,n){if("function"==typeof t){const r=t(e);return n&&r&&"string"==typeof r&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||Rl.has(t)}(r)?n(r):r}const r=e?.[t]+"";return n?n(r):jl[Math.abs(function(e){let t=0;for(let n=0;e.length>n;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return Math.abs(t)}(r))%jl.length]}function Qe(e,t){if(null==t||!Object.prototype.hasOwnProperty.call(e,t))return;const n=e[t];return"string"==typeof n&&n.length>0?n:void 0}function Je(e,t,n="category10"){if(n&&"object"==typeof n&&!Array.isArray(n)){const e=n;return t=>Qe(e,t)??"#999"}const r=Array.from(new Set(e.map(e=>e?.[t]).filter(e=>null!=e).map(e=>e+""))),i=r.every(e=>!isNaN(Number(e)));if(Array.isArray(n))return(0,cl.scaleOrdinal)().domain(r).range(n).unknown("#999");const o=Object.prototype.hasOwnProperty.call(Ml,n)?Ml[n]:Ml.category10;if(i&&"function"==typeof o){let e=-1/0;for(const t of r){const n=Number(t);n>e&&(e=n)}return t=>o(0===e?0:Number(t)/e)}{const e=Array.isArray(o)?o:jl;return(0,cl.scaleOrdinal)().domain(r).range(e).unknown("#999")}}function et(e,t,n=[3,20],r){let i;if(i="function"==typeof t?t(e):e?.[t],!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 tt(e,t){const n=t&&"object"==typeof t&&!Array.isArray(t)?t:void 0;return 0===e.length?e=>n&&Qe(n,e)||"#4e79a7":t=>{if(n){const e=Qe(n,t);if(e)return e}let r=0;for(let e=0;t.length>e;e++)r=31*r+t.charCodeAt(e)|0;return e[Math.abs(r)%e.length]??"#4e79a7"}}function nt(e){return null!=e&&!1!==e&&""!==e&&(!Array.isArray(e)||e.some(nt))}function rt(e,t,n){e.has(t)||(e.add(t),console.warn(n))}function it(e,t){return e?"function"==typeof e?e:t=>t[e]:e=>e[t]}function ot(e){return e?"function"==typeof e?e:t=>t[e]:e=>e.coordinates||e.data||[]}function at(e,t,n){return e?"function"==typeof e?{...n,...e(t)}:{...n,...e}:{...n}}function st(e,t){if(2>e.length)return[e];const n=.4*t,r=[];let i=[e[0]];for(let t=1;e.length>t;t++){const o=e[t];Math.abs(o[0]-e[t-1][0])>n?(2>i.length||r.push(i),i=[o]):i.push(o)}return 2>i.length||r.push(i),r}function lt(e,t,n=24){const r=t[0]-e[0],i=t[1]-e[1],o=Math.sqrt(r*r+i*i);if(0===o)return[e,t];const a=-i/o,s=r/o,l=Math.min(.3*o,80),c=(e[0]+t[0])/2+a*l,u=(e[1]+t[1])/2+s*l,d=[];for(let r=0;n>=r;r++){const i=r/n,o=1-i;d.push([o*o*e[0]+2*o*i*c+i*i*t[0],o*o*e[1]+2*o*i*u+i*i*t[1]])}return d}function ct(e,t){if(2>e.length)return e;const n=t/2+1,r=[];for(let t=0;e.length>t;t++){const i=e[t];let o,a;0===t?(o=e[1][0]-i[0],a=e[1][1]-i[1]):t===e.length-1?(o=i[0]-e[t-1][0],a=i[1]-e[t-1][1]):(o=e[t+1][0]-e[t-1][0],a=e[t+1][1]-e[t-1][1]);const s=Math.sqrt(o*o+a*a)||1;r.push([i[0]+a/s*n,i[1]+-o/s*n])}return r}function ut(e,t,n,r,i){const o=t[0]-e[0],a=t[1]-e[1],s=Math.sqrt(o*o+a*a);if(0===s)return[e,t];const l=a/s,c=-o/s,u=i/2+1;return[[e[0]+l*u,e[1]+c*u],[t[0]+l*u,t[1]+c*u]]}function dt(e){let t=1/0,n=-1/0;for(const r of e)t>r&&(t=r),r>n&&(n=r);return[t,n]}function ht(e,t,n,r){const i=e.push(t);return n&&n.push(r),i}function ft(e,t){const n={...e};for(const e of t)n[Nl[e]]++;return n}function pt(e,t,n){const r=new Set(t);return{changeSet:{...e,...e.keys?{keys:[...e.keys]}:{}},changed:r,revisions:ft(n,r)}}function mt(e){if(null==e)return 0;if("number"==typeof e&&Number.isFinite(e)&&e>=0&&.5>e)return e;throw new RangeError(`[semiotic] fitPadding must be a finite fraction in [0, 0.5); received ${e+""}.`)}function gt(e){if(!e)return Kl;let t=!1;for(let n=0;e.length>n;n++){const r=e[n];if(null==r||"object"!=typeof r){t=!0;break}}if(!t)return e;const n=[];for(const t of e)null!=t&&"object"==typeof t&&n.push(t);return n}function yt(e){const{domain:t,layout:n,sceneGeometry:r}=e.revisions;return{domain:t,layout:n,sceneGeometry:r}}function vt(e,t){return{sceneGeometry:Math.max(e.sceneGeometry,t.sceneGeometry),layout:Math.max(e.layout,t.layout),domain:Math.max(e.domain,t.domain)}}function bt(e,t,n,r,i,o){const a=i-n,s=o-r,l=a*a+s*s;if(0===l)return Math.sqrt((e-n)**2+(t-r)**2);let c=((e-n)*a+(t-r)*s)/l;return c=Math.max(0,Math.min(1,c)),Math.sqrt((e-(n+c*a))**2+(t-(r+c*s))**2)}function xt(e,t=30){return Math.max((e??4)+5,12,t)}function wt(e,t){const[n,r]=e.viewBox??ic,[i,o]=e.anchor??oc,a=r>0?r:1,s=Math.max(0,t)/a,l=(n>0?n:a)*s,c=a*s;return{width:l,height:c,scale:s,offsetX:-i*l,offsetY:-o*c}}function kt(e,t){const n=wt(e,t),r=[[n.offsetX,n.offsetY],[n.offsetX+n.width,n.offsetY],[n.offsetX,n.offsetY+n.height],[n.offsetX+n.width,n.offsetY+n.height]];let i=0;for(const[e,t]of r){const n=Math.sqrt(e*e+t*t);n>i&&(i=n)}return i}function St(e,t,n,r){if("none"!==e)return"color"===e||null==e?t??r:"accent"===e?n:e}function Mt(e){if("undefined"==typeof Path2D)return null;ac||(ac=new Map);const t=ac.get(e);if(t)return t;const n=new Path2D(e);return ac.size>1024&&ac.clear(),ac.set(e,n),n}function jt(e,t,n=0,r="horizontal"){const[i,o]=e.viewBox??ic,a=Math.min(1,Math.max(0,n)),s=Math.min(1,Math.max(0,t));return s>a?a>0||1>s?"vertical"===r?{x:0,y:o*(1-s),width:i,height:o*(s-a)}:{x:i*a,y:0,width:i*(s-a),height:o}:null:{x:0,y:0,width:0,height:0}}function At(e,t){const n=wt(e,t);return{centerDx:n.offsetX+n.width/2,centerDy:n.offsetY+n.height/2,halfWidth:n.width/2,halfHeight:n.height/2,radius:Math.hypot(n.width,n.height)/2}}function Ct(e,t,n,r,i,o=e=>e){for(const a of t.parts){const t=Mt(a.d);if(!t)continue;const s=a.opacity??1,l=e.globalAlpha;1!==s&&(e.globalAlpha=l*s);const c=i?"none"===a.fill?void 0:i:St(a.fill,n,r);c&&(e.fillStyle=o(c),e.fill(t));const u=i?a.stroke&&"none"!==a.stroke?i:void 0:St(a.stroke??"none",n,r);u&&(e.strokeStyle=o(u),e.lineWidth=a.strokeWidth??1,e.lineCap=a.strokeLinecap??"butt",e.lineJoin=a.strokeLinejoin??"miter",e.stroke(t)),1!==s&&(e.globalAlpha=l)}}function Rt(e,t,n,r,i,o,a=0,s=r){if(o){const e=function(e,t,n,r,i,o=e=>e.x,a=e=>e.y,s=e=>e.r){const l=Math.max(r,i+5,12),c=t-l,u=t+l,d=n-l,h=n+l;let f=null,p=1/0;return e.visit((e,i,l,m,g)=>{if(i>u||c>m||l>h||d>g)return!0;if(!e.length){let i=e;do{const e=i.data,l=o(e)-t,c=a(e)-n,u=Math.sqrt(l*l+c*c);xt(s(e),r)>=u&&p>u&&(f=e,p=u),i=i.next}while(i)}return!1}),f?{node:f,distance:p}:null}(o,t,n,r,a);if(e&&!1!==e.node.interactive)return e}else{let i=null,o=1/0;for(const a of e){if("point"!==a.type)continue;if(!1===a.interactive)continue;const e=a.x-t,s=a.y-n,l=Math.sqrt(e*e+s*s);xt(a.r,r)>=l&&o>l&&(i=a,o=l)}if(i)return{node:i,distance:o}}let l=null,c=1/0;for(const i of e){if("glyph"!==i.type)continue;if(null==i.datum)continue;const e=At(i.glyph,i.size),o=i.x+e.centerDx-t,a=i.y+e.centerDy-n,s=Math.sqrt(o*o+a*a);xt(e.radius,r)>=s&&c>s&&(l=i,c=s)}if(l)return{node:l,distance:c};for(let r=e.length-1;r>=0;r--){const o=e[r];if("geoarea"!==o.type)continue;const a=o;if(!1===a.interactive)continue;const[[s,l],[c,u]]=a.bounds;if(!(s>t||t>c||l>n||n>u)&&(a._cachedPath2D||(a._cachedPath2D=new Path2D(a.pathData)),i.isPointInPath(a._cachedPath2D,t,n)))return{node:a,distance:0}}let u=null,d=1/0;for(const r of e){if("line"!==r.type)continue;const e=r,{path:i}=e,o=Math.max((e.style.strokeWidth??2)+4,5,s),a=t-o,l=t+o,c=n-o,h=n+o;for(let r=0;i.length-1>r;r++){const s=i[r],f=i[r+1],p=s[0],m=s[1],g=f[0],y=f[1];if(a>p&&a>g||p>l&&g>l||c>m&&c>y||m>h&&y>h)continue;const v=bt(t,n,p,m,g,y);o>=v&&d>v&&(u=e,d=v)}}return u?{node:u,distance:d}:null}function Lt(e,t=0,n=1/0,r=0){const i=Number.isFinite(t)?t:0,o=Number.isFinite(n)?Math.max(i,n):1/0,a=Number.isFinite(e)?Math.floor(e):i,s=Math.max(i,Math.min(o,a));return r>0&&Number.isFinite(r)?Math.max(i,Math.min(o,Math.round(s/r)*r)):s}function Pt(e,t){if(!t)return t;const n=function(e){const t=e.trim();if(!t.startsWith("var(")||!t.endsWith(")"))return null;const n=t.slice(4,-1),r=n.indexOf(",");if(-1===r){const e=n.trim();return e.startsWith("--")?{name:e}:null}const i=n.slice(0,r).trim(),o=n.slice(r+1).trim();return i.startsWith("--")?{name:i,fallback:o||void 0}:null}(t);if(!n)return t;const r=()=>n.fallback?Pt(e,n.fallback):t,i=e.canvas;if(!i)return r();let o=fc.get(i);o&&o.version===pc||(o={version:pc,map:new Map},fc.set(i,o));const a=o.map.get(t);if(void 0!==a)return a;const s=getComputedStyle(i).getPropertyValue(n.name).trim()||r()||t;return o.map.set(t,s),s}function Nt(e,t){const n=e();return Number.isFinite(n)?n:t}function Et(e){let t=6;for(let n=1;e.length>n;n++){const r=Math.abs(e[n]-e[n-1]);r>0&&Number.isFinite(r)&&(t=Math.max(t,Math.ceil(Math.log10(Math.max(Math.abs(e[n]),Math.abs(e[n-1]))/r))+1))}const n=Math.min(17,t);return e=>Number.isInteger(e)?e+"":Number(e.toPrecision(n))+""}function It(e){return"object"==typeof e&&null!==e&&"legendGroups"in e&&Array.isArray(e.legendGroups)}function Tt(e){return"object"==typeof e&&null!==e&&"gradient"in e}function Dt(e,t,n,r,i=8){const o=r,a="left"===r?"right":"right"===r?"left":"top"===r?"bottom":"top",s=Math.max(t[o],Math.max(0,("left"===r||"right"===r?n[0]:n[1])-i)-e[a]);e[o]>s&&(e[o]=s)}function zt(e){return Math.ceil(7*e.length)}function _t(e,t){if(It(e)){const n=Gt(t);let r=Pc;for(const t of e.legendGroups){t.label&&(r=Math.max(r,zt(t.label)));for(const e of t.items)r=Math.max(r,n.swatchSize+n.labelGap+zt(e.label))}return r}if(Tt(e)){const{gradient:t}=e,n=t.format||Et(t.domain),r=Math.max(zt(n(t.domain[0])),zt(n(t.domain[1]))),i=t.label?zt(t.label):0;return Math.max(Pc,19+r,i)}return Pc}function Ot(e){return(It(e)||Tt(e))&&Number.isFinite(e.legendDistance)?Math.max(0,e.legendDistance):Nc}function Ft(e,t){return null!=e?.sideGutter?Math.max(0,e.sideGutter):t?.hasAxis?t.hasAxisLabel?Fc:Oc:0}function Wt(e){return Math.max(0,e?.edgeGutter??Ec)}function Bt(e,t){return null!=t?.axisGutter?Math.max(0,t.axisGutter):e?.hasAxis?e.hasAxisLabel?e.rotatedTicks?_c:zc:Dc:0}function Ht(e,t,n){if(Tt(e))return e.gradient.label?Ic:Tc;if(!It(e))return 20;const r=Gt(n),i=Math.max(1,n?.maxWidth??t);let o=r.rowHeight;for(const t of e.legendGroups){let e=0,n=0;for(const o of t.items){const t=r.swatchSize+r.labelGap+zt(o.label),a=0===n?t:n+r.itemGap+t;n>0&&a>i?(e+=1,n=t):n=a}t.items.length>0&&(e+=1),o=Math.max(o,e*r.rowHeight,t.label?zt(t.label):0)}return o+(e.legendGroups.length>1?16:0)}function $t(e,t,n){return _t(e,t)+Ot(e)+Ft(t,n)+Wt(t)}function qt(e,t){const{legend:n}=t;if(!n)return;const r=t.position??"right",i=Ht(n,Math.max(1,t.size[0]-e.left-e.right),t.legendLayout)+Ot(n)+Bt("bottom"===r?t.axisChrome:"top"===r?t.axisChrome?.topAxis:void 0,t.legendLayout)+("top"===r&&t.hasTitle?24:0),o=Math.max(t.minimumMargin??0,"top"===r?t.hasTitle?jc:Mc:0);"right"===r?e.right=Math.max(e.right,o,$t(n,t.legendLayout,t.axisChrome?.rightAxis)):"left"===r?e.left=Math.max(e.left,o,$t(n,t.legendLayout,t.axisChrome?.leftAxis)):"top"===r?e.top=Math.max(e.top,o,i):e.bottom=Math.max(e.bottom,o,i)}function Gt(e){const t=Math.max(1,e?.swatchSize??Ac),n=Math.max(t,e?.rowHeight??Lc);return{swatchSize:t,labelGap:Math.max(0,e?.labelGap??Cc),itemGap:Math.max(0,e?.itemGap??Rc),rowHeight:n,align:"left"===e?.align?"start":"right"===e?.align?"end":e?.align??"start",maxWidth:e?.maxWidth}}function Vt(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function Ut(e){const t=function(){const[e,t]=(0,uc.useState)(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return(0,uc.useEffect)(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),function(e,t){if("function"==typeof e.addEventListener)return e.addEventListener("change",t),()=>e.removeEventListener("change",t);const n=e;return n.addListener(t),()=>n.removeListener(t)}(e,e=>t(e.matches))},[]),e}(),n=(0,lc.useRef)(t);n.current=t;const[r,i]=function(e,t,n,r={}){const i=(0,dc.useRef)(null),[o,a]=(0,dc.useState)(null);return hc(()=>{if(!t&&!n)return;const e=i.current;if(!e||"undefined"==typeof ResizeObserver)return;const o=(e,t)=>({w:Lt(e,r.minWidth,r.maxWidth,r.widthStep),h:Lt(t,r.minHeight,r.maxHeight,r.heightStep)}),s=e.getBoundingClientRect();(s.width>0||s.height>0)&&a(o(s.width,s.height));const l=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect,r=o(e,n);a(e=>e&&e.w===r.w&&e.h===r.h?e:r)}});return l.observe(e),()=>l.disconnect()},[t,n,r.minWidth,r.maxWidth,r.widthStep,r.minHeight,r.maxHeight,r.heightStep]),[i,[t&&o?o.w:e[0],n&&o?o.h:e[1]]]}(e.sizeProp,e.responsiveWidth,e.responsiveHeight),o=i[0],a=i[1],s=(0,lc.useMemo)(()=>[o,a],[o,a]),l=!!e.title,c=!!e.legend&&"top"===e.legendPosition,u=(0,lc.useMemo)(()=>{const t=function(e,t,n=!1){const r=n?t?jc:Mc:t?36:0;return r>e.top?{...e,top:r}:e}({...e.marginDefault,...e.userMargin},l,c);if(e.legend&&!e.legendMarginReserved){const n={...t},r=e.legendPosition??"right";qt(t,{legend:e.legend,position:r,size:s,hasTitle:l,legendLayout:e.legendLayout,axisChrome:e.axisChrome}),Dt(t,n,s,r)}return t},[e.marginDefault,e.userMargin,e.legend,e.legendPosition,e.legendLayout,e.axisChrome,e.legendMarginReserved,l,c,s]),d=i[0]-u.left-u.right,h=i[1]-u.top-u.bottom,f=Vt(e.foregroundGraphics,i,u),p=Vt(e.backgroundGraphics,i,u),m=(0,cc.useThemeSelector)(e=>e.theme),{transition:g,introEnabled:y}=function(e,t){if(!1===e)return{transition:void 0,introEnabled:!1};const n="undefined"!=typeof window&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;return{transition:e?!0===e?{duration:300}:{duration:e.duration??300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(n||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),v="semiotic-table-"+sc.useId(),b=(0,lc.useRef)(null);if(!b.current){const t=!e.suspendWhenHidden||"undefined"==typeof document||!document.hidden;b.current=new Sc({clock:e.clock,random:e.random,seed:e.seed,paused:e.paused,visible:t})}const x=b.current;x.configure({clock:e.clock,random:e.random,seed:e.seed});const w=(0,lc.useRef)(null),k=(0,lc.useRef)(e.frameScheduler??Bc);k.current=e.frameScheduler??Bc;const S=(0,lc.useRef)(null),M=(0,lc.useRef)(!1),j=(0,lc.useRef)(()=>{}),A=(0,lc.useCallback)(()=>{if(null!==w.current||M.current)return;const e=k.current;let t=!1,n=!1;const r=e.requestAnimationFrame(()=>{t=!0;const e=!n;e&&(M.current=!0),w.current=null,S.current=null;try{j.current()}finally{e&&(M.current=!1)}});n=!0,t||(w.current=r,S.current=e)},[]),C=(0,lc.useCallback)(()=>{null!==w.current&&((S.current??k.current).cancelAnimationFrame(w.current),w.current=null,S.current=null)},[]);Wc(()=>{x.setPaused(!0===e.paused)},[x,e.paused]),(0,lc.useEffect)(()=>{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]),(0,lc.useEffect)(()=>()=>{C()},[C]);const R=(0,lc.useRef)(()=>{}),L=(0,lc.useRef)(()=>{}),P=(0,lc.useRef)({inside:!1,clientX:0,clientY:0,pointerType:void 0}),N=(0,lc.useRef)(null),E=(0,lc.useRef)(null),I=(0,lc.useRef)(null),T=(0,lc.useCallback)(()=>{const e=N.current;N.current=null,e&&R.current(e)},[]),D=(0,lc.useCallback)(e=>{const t=P.current;if(t.inside=!0,t.clientX=e.clientX,t.clientY=e.clientY,t.pointerType=e.pointerType,N.current={clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType},null===E.current){const e=k.current;let t=!1;const n=e.requestAnimationFrame(()=>{t=!0,E.current=null,I.current=null,T()});t||(E.current=n,I.current=e)}},[T]),z=(0,lc.useCallback)(()=>{P.current.inside=!1,N.current=null,null!==E.current&&((I.current??k.current).cancelAnimationFrame(E.current),E.current=null,I.current=null),L.current()},[]);(0,lc.useEffect)(()=>()=>{N.current=null,null!==E.current&&((I.current??k.current).cancelAnimationFrame(E.current),E.current=null,I.current=null)},[]);const _=e.themeDirtyRef,O=(0,lc.useRef)(!1);return Wc(()=>{if(!_)return;const t=!O.current;O.current=!0,t&&e.skipInitialThemeInvalidation||(pc++,_.current=!0,A())},[m,e.skipInitialThemeInvalidation,A,_]),(0,lc.useEffect)(()=>{if(_)return function(e,t){!function(){if(mc)return;if("undefined"==typeof window||"undefined"==typeof document)return;mc=!0;const e=e=>{if(!e?.includes("--"))return"";const t=document.createElement("span").style;return t.cssText=e,Array.from(t).filter(e=>e.startsWith("--")).sort().map(e=>`${e}:${t.getPropertyValue(e)}!${t.getPropertyPriority(e)}`).join(";")},t=(t,n)=>{const r=t.target;if(!(r instanceof Element))return!1;if(r===n||r.contains(n))return!0;if(!n.contains(r))return!1;const i="CANVAS"===r.tagName;return!(!i&&!r.querySelector("canvas")||i&&"style"===t.attributeName&&e(t.oldValue)===e(r.getAttribute("style")))},n=e=>{const n=[];for(const r of wc){const i=r.getElement();i&&(!e||e.some(e=>t(e,i)))&&n.push(r)}if(!e||0!==n.length){pc++;for(const e of n)e.listener()}};if("undefined"!=typeof MutationObserver&&document.documentElement&&(gc=new MutationObserver(e=>{n(e)})).observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme","data-semiotic-theme-mode"],attributeOldValue:!0,subtree:!0}),"function"==typeof window.matchMedia)try{yc=window.matchMedia("(prefers-color-scheme: dark)"),vc=()=>n(),"function"==typeof yc.addEventListener?yc.addEventListener("change",vc):"function"==typeof yc.addListener&&yc.addListener(vc)}catch{}document.fonts&&"function"==typeof document.fonts.addEventListener&&(bc=document.fonts).addEventListener("loadingdone",xc=()=>n())}();const n={getElement:e,listener:t};return wc.add(n),()=>{wc.delete(n)&&0===wc.size&&(gc?.disconnect(),gc=null,yc&&vc&&("function"==typeof yc.removeEventListener?yc.removeEventListener("change",vc):"function"==typeof yc.removeListener&&yc.removeListener(vc)),yc=null,vc=null,bc&&xc&&bc.removeEventListener("loadingdone",xc),bc=null,xc=null,mc=!1)}}(()=>r.current,()=>{_.current=!0,A()})},[r,A,_]),{reducedMotion:t,reducedMotionRef:n,responsiveRef:r,size:i,margin:u,adjustedWidth:d,adjustedHeight:h,resolvedForeground:f,resolvedBackground:p,currentTheme:m,transition:g,introEnabled:y,tableId:v,frameRuntime:x,rafRef:w,renderFnRef:j,scheduleRender:A,cancelRender:C,hoverHandlerRef:R,hoverLeaveRef:L,onPointerMove:D,onPointerLeave:z,pointerStateRef:P}}function Yt(e){if(!e?.colors)return;const t=e.colors;return{primary:t.primary,secondary:t.secondary||t.primary,surface:t.surface||t.background,success:t.success,danger:t.danger,warning:t.warning,error:t.error,info:t.info,text:t.text,textSecondary:t.textSecondary,border:t.border,grid:t.grid}}function Xt({isStale:e,position:t}){return(0,Vc.jsx)("div",{className:"stream-staleness-badge",style:{position:"absolute",..."top-left"===t?{top:4,left:4}:"bottom-left"===t?{bottom:4,left:4}:"bottom-right"===t?{bottom:4,right:4}:{top:4,right:4},padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",zIndex:3,background:e?"#dc3545":"#28a745",color:"white"},children:e?"STALE":"LIVE"})}function Zt(e,t={}){const n=function(e){const t=e.provenance,n=e.id??e.stableId??t?.stableId;return null==n||""===n?void 0:n+""}(e);return{"data-semiotic-annotation-widget":"",...n?{"data-semiotic-annotation-id":n}:{},onClickCapture(r){const i=function(e){const t=e.nativeEvent;return"touch"===t.pointerType?"touch":0===t.detail?"keyboard":"pointer"}(r);t.onAnnotationActivate?.({annotation:e,annotationId:n,chartId:t.chartId,inputType:i}),n&&t.onObservation&&t.onObservation({type:"annotation-activate",annotationId:n,inputType:i,timestamp:Date.now(),chartType:t.chartType??"unknown",chartId:t.chartId})}}}function Kt(e){const{x:t,y:n,text:r,fill:i,fontSize:o=12,fontWeight:a,fontFamily:s,textAnchor:l="start",dominantBaseline:c,background:u,className:d}=e,h=function(e){return void 0===e||!0===e||"halo"===e?{type:"halo"}:!1===e||"none"===e?null:"box"===e?{type:"box"}:{...e,type:e.type??"halo"}}(u),f=e=>(0,Zc.jsx)("text",{x:t,y:n,textAnchor:l,dominantBaseline:c,fill:i,fontSize:o,fontWeight:a,fontFamily:s,className:d,...e?{style:{stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:"stroke"}}:{},children:r});if(!h)return f();if("halo"===h.type)return f({stroke:h.fill??Kc,strokeWidth:h.haloWidth??3});const p=h.padding??{x:6,y:3},m="number"==typeof p?p:p.x,g="number"==typeof p?p:p.y,y=function(e,t){return(e+"").length*t*.6}(r,o),v=o+2*g;let b,x;return b="middle"===l?t-y/2-m:"end"===l?t-y-m:t-m,x="middle"===c||"central"===c?n-v/2:"hanging"===c||"text-before-edge"===c?n-g:n-.8*o-g,(0,Zc.jsxs)("g",{className:d,children:[(0,Zc.jsx)("rect",{x:b,y:x,width:y+2*m,height:v,rx:h.radius??3,ry:h.radius??3,fill:h.fill??Kc,fillOpacity:h.opacity??.85,stroke:h.stroke,strokeWidth:h.strokeWidth}),f()]})}function Qt(e,t,n){if(!e)return null;const r="object"==typeof e?e:{};return(0,Qc.jsx)("circle",{className:"semiotic-threshold-end-cap",cx:t[0],cy:t[1],r:Math.max(0,r.radius??4),fill:r.fill??n})}function Jt({ann:e,position:t,vertical:n,width:r,height:i,color:o,fontSize:a=12,fontFamily:s,bold:l,background:c,dash:u="6,3",labelGap:d=4}){const h=e.labelPosition,f=t>.6*r,p=n?t+(f?-4:4):"left"===h?4:"center"===h?r/2:r-4,m=n?"bottom"===h?i-4:"center"===h?i/2:16:20>t?Math.min(i-4,t+16):t-d,g=n?f?"end":"start":"left"===h?"start":"center"===h?"middle":"end",y=n?[t,0]:[0,t],v=n?[t,i]:[r,t];return(0,Jc.jsxs)("g",{opacity:e.opacity,children:[(0,Jc.jsx)("line",{x1:y[0],y1:y[1],x2:v[0],y2:v[1],stroke:o,strokeWidth:e.strokeWidth??1.5,strokeDasharray:e.strokeDasharray||u}),Qt(e.endCap,y,o),e.label&&(0,Jc.jsx)(Kt,{x:p,y:m,text:e.label,textAnchor:g,fill:o,fontSize:a,fontFamily:s,fontWeight:l?"bold":void 0,background:c??e.labelBackground??"halo"})]})}function en(e){return{label:e.label,title:e.title,wrap:e.wrap||120,noWrap:"function"==typeof e._noteLayout?e.noWrap:void 0,_noteLayout:e._noteLayout}}function tn(e){return"function"==typeof e._noteLayout?e._noteLayout(e):void 0}function nn(e,t,n){if(!e)return[];const r=Math.max(1,Math.floor(t/n)),i=[];let o="";for(const t of e.split(/\s+/))t&&(o&&o.length+1+t.length>r?(i.push(o),o=t):o=o?`${o} ${t}`:t);return o&&i.push(o),i}function rn(e,t,n,r){return"curly"===e?r?`M0,0 C${.6*n},0 ${.4*n},${t/2} ${n},${t/2} C${.4*n},${t/2} ${.6*n},${t} 0,${t}`:`M0,0 C0,${.6*n} ${t/2},${.4*n} ${t/2},${n} C${t/2},${.4*n} ${t},${.6*n} ${t},0`:r?`M0,0 L${n},0 L${n},${t} L0,${t}`:`M0,0 L0,${n} L${t},${n} L${t},0`}function on(e,t,n,r){if(!e)return(0,tu.jsx)("g",{className:"annotation-note"});const{label:i,title:o,orientation:a,align:s,wrap:l=120,noWrap:c}=e;if(!i&&!o)return(0,tu.jsx)("g",{className:"annotation-note"});let u=a;u||(u=Math.abs(t)>Math.abs(n)?"leftRight":"topBottom");const d="topBottom"===u,h="leftRight"===u;let f=s;f&&"dynamic"!==f||(f=d?0>t?"right":"left":0>n?"bottom":"top");let p="start";d?"right"===f?p="end":"middle"===f&&(p="middle"):p=0>t?"end":"start";const m=e.useHTML||e.html,g=m?void 0:tn(e),y=g?.lineHeight??16,v=g?.titleLines??(o?c?[o]:nn(o,l,8):[]),b=g?.labelLines??(i?c?[i]:nn(i,l,8):[]),x=v.length+b.length,w=h?"end"===p?-4:4:0,k=[],S=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";if(m)k.push((0,tu.jsx)("foreignObject",{className:"annotation-note-html",x:"end"===p?w-l:"middle"===p?w-l/2:w,y:-y,width:l,height:Math.max(y,x*y+(o&&i?2:0))+y,style:{overflow:"visible"},children:(0,tu.jsxs)("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{color:S,fontSize:"12px",lineHeight:y+"px",overflow:"visible",textAlign:"end"===p?"right":"middle"===p?"center":"left",whiteSpace:c?"nowrap":"normal",wordBreak:"break-word"},children:[o&&(0,tu.jsx)("div",{className:"annotation-note-title",style:{fontWeight:"bold"},children:o}),i&&(0,tu.jsx)("div",{className:"annotation-note-label",children:i})]})},"annotation-note-html"));else for(const e of[!0,!1]){const t=e?v:b;if(0===t.length)continue;const n="annotation-note-"+(e?"title":"label");k.push((0,tu.jsx)("text",{className:n,fill:S,textAnchor:p,fontWeight:e?g?.titleFontWeight??"bold":void 0,y:e?void 0:v.length*y,children:t.map((e,t)=>(0,tu.jsx)("tspan",{x:w,dy:0===t?0:y,children:e},t))},n))}let M=null;if((o||i)&&(0!==t||0!==n)){const e=d?g?g.width:Math.min(l,120):(v.length+b.length+(b.length>0?1:0))*y,t=d?p:f,n="end"===t||"bottom"===t?-e:"middle"===t?-e/2:0;M=(0,tu.jsx)("line",{className:"note-line",x1:d?n:0,x2:d?n+e:0,y1:d?0:n,y2:d?0:n+e,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const j=Math.max(0,x-1)*y;let A=0;(d||h)&&(A=h&&"middle"===f?-(j+y+(b.length>0&&v.length>0?2:0))/2+y/2:0>n||h&&"bottom"===f?-(j+2):2+y);const C=0!==A?`translate(0,${A})`:void 0;return(0,tu.jsxs)("g",{className:"annotation-note",transform:`translate(${t},${n})`,...g?.textProps,children:[(0,tu.jsx)("g",{className:"annotation-note-content",transform:C,children:k}),M]})}function an(e,t,n,r,i){let o=null;const a=n||"var(--semiotic-text-secondary, currentColor)";switch(e){case"callout-circle":{const e=(t?.radius||0)+(t?.radiusPadding||0);e>0&&(o=(0,tu.jsx)("circle",{r:e,fill:"none",stroke:a},"subject-circle"));break}case"callout-rect":{const e=t?.width||0,n=t?.height||0;(e>0||n>0)&&(o=(0,tu.jsx)("rect",{width:e,height:n,fill:"none",stroke:a},"subject-rect"));break}case"callout-custom":o=t?.custom;break;case"xy-threshold":{const e=r||0,n=i||0;let s=0,l=0,c=0,u=0;if(void 0!==t?.x)s=l=(t.x||0)-e,c=(t.y1||0)-n,u=(t.y2||0)-n;else if(void 0!==t?.y)c=u=(t.y||0)-n,s=(t.x1||0)-e,l=(t.x2||0)-e;else if(void 0!==t?.x1||void 0!==t?.x2)s=(t.x1||0)-e,l=(t.x2||0)-e;else{if(void 0===t?.y1&&void 0===t?.y2)break;c=(t.y1||0)-n,u=(t.y2||0)-n}o=(0,tu.jsx)("line",{x1:s,y1:c,x2:l,y2:u,stroke:a,strokeDasharray:"5,5"},"threshold-line");break}case"bracket":{const e=t?.type||"curly",n=t?.width??t?.height;void 0!==n&&(o=(0,tu.jsx)("path",{d:rn(e,n,t?.depth||30,void 0===t?.width),fill:"none",stroke:a},"bracket-path"));break}}return(0,tu.jsx)("g",{className:"annotation-subject",children:o})}function sn(e,t,n,r,i,o){let a,s,l=0,c=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=e-i,s=t-o;if(0!==a||0!==s){const e=Math.abs(a),t=Math.abs(s),u=n/2,d=r/2,h=e*d>t*u?u/e:d/t;l=i+a*h,c=o+s*h}}}else if("bracket"===i&&o){const e=o.width,t=o.height,n=o.depth||30;void 0!==e?(l=e/2,c=n):void 0!==t&&(l=n,c=t/2)}}else{const n=(o.radius||0)+(o.radiusPadding||0);if(n>0&&(0!==e||0!==t)){const r=Math.atan2(t,e);l=Math.cos(r)*n,c=Math.sin(r)*n}}const u=e-l,d=t-c,h=Math.hypot(u,d);if(h>.5){const i=r||"var(--semiotic-text-secondary, currentColor)",o="curve"===n?.type;let f=Math.atan2(d,u);if(o){const r=(l+e)/2,o=(c+t)/2,s=-d/h,p=u/h,m=(n?.curve??.25)*h,g=r+s*m,y=o+p*m;a=(0,tu.jsx)("path",{className:"connector-curve",d:`M${l},${c}Q${g},${y} ${e},${t}`,fill:"none",stroke:i},"connector-line"),f=Math.atan2(y-c,g-l)}else a=(0,tu.jsx)("line",{x1:l,y1:c,x2:e,y2:t,stroke:i},"connector-line");if("arrow"===n?.end){const e=10,t=16/180*Math.PI;s=(0,tu.jsx)("path",{d:`M${l},${c}L${l+e*Math.cos(f+t)},${c+e*Math.sin(f+t)}L${l+e*Math.cos(f-t)},${c+e*Math.sin(f-t)}Z`,fill:i,stroke:"none"},"connector-arrow")}}return(0,tu.jsxs)("g",{className:"annotation-connector",children:[a,s]})}function ln(e){const{x:t=0,y:n=0,dx:r,dy:i,nx:o,ny:a,note:s,connector:l,subject:c,type:u,color:d,className:h,disable:f,opacity:p,strokeDasharray:m,events:g={},"data-testid":y}=e,v=Array.isArray(t)?t[0]??0:t,b=Array.isArray(n)?n[0]??0:n,x=Array.isArray(f)?f:[];let w=r||0,k=i||0;null!=o&&(w=o-v),null!=a&&(k=a-b);const S="string"==typeof u?u:"label";if("bracket"===S&&c&&0===w&&0===k)if(void 0!==c.width){w=c.width/2;const e=c.depth||30;k=e+(0>e?-5:5)}else if(void 0!==c.height){const e=c.depth||30;w=e+(0>e?-5:5),k=c.height/2}return(0,tu.jsxs)("g",{className:("annotation "+(h||"")).trim(),transform:`translate(${v},${b})`,"data-testid":y,...null!=p&&{opacity:p},...m&&{strokeDasharray:m},...g,children:[!x.includes("connector")&&sn(w,k,l,d,S,c),!x.includes("subject")&&an(S,c,d,v,b),!x.includes("note")&&on(s,w,k,d)]})}function cn(e){const{noteData:t}=e,{screenCoordinates:n}=t,r="string"==typeof t.type?t.type:"label",i=t.eventListeners||t.events||{};if(t.coordinates&&n){const e=t.nx||n[0][0]+(t.dx??0),i=t.ny||n[0][1]+(t.dy??0),o=n.map((n,o)=>{const a=Object.assign({},t,{note:0===o?t.note:{label:""},x:n[0],y:n[1],nx:e,ny:i});return(0,tu.jsx)(ln,{"data-testid":"semiotic-annotation",...a,type:r},"multi-annotation-"+o)});return(0,tu.jsx)("g",{children:o})}const o=t.note||{title:"none",label:t.label},a=`${o.label}-${o.title}-${t.i}`;return(0,tu.jsx)(ln,{"data-testid":"semiotic-annotation",events:i,...t,type:r},a)}function un(e){return Math.round(100*e)/100}function dn(e,t=2){const n=[],r=[],i=t+1;for(let t=0;i>t;t++){let o=0;for(const[n,r]of e)null!==r&&(o+=n**t*r);n.push(o);const a=[];for(let n=0;i>n;n++){let r=0;for(const[i,o]of e)null!==o&&(r+=i**(t+n));a.push(r)}r.push(a)}r.push(n);const o=function(e,t){const n=e,r=e.length-1,i=[t];for(let e=0;r>e;e++){let t=e;for(let i=e+1;r>i;i++)Math.abs(n[e][i])>Math.abs(n[e][t])&&(t=i);for(let i=e;r+1>i;i++){const r=n[i][e];n[i][e]=n[i][t],n[i][t]=r}for(let t=e+1;r>t;t++)for(let i=r;i>=e;i--)n[i][t]-=n[i][e]*n[e][t]/n[e][e]}for(let e=r-1;e>=0;e--){let t=0;for(let o=e+1;r>o;o++)t+=n[o][e]*i[o];i[e]=(n[r][e]-t)/n[e][e]}return i}(r,i).map(un);return{points:e.map(([e])=>[un(e),un(o.reduce((t,n,r)=>t+n*e**r,0))]),equation:[...o].reverse()}}function hn(e,t){const n=t.scales?.x??t.scales?.time;return n?null!=e.x?n(e.x):t.xAccessor&&null!=e[t.xAccessor]?n(e[t.xAccessor]):null:null}function fn(e,t){const n=t.scales?.y??t.scales?.value;return n?null!=e.y?n(e.y):t.yAccessor&&null!=e[t.yAccessor]?n(e[t.yAccessor]):null:null}function pn(e){return null==e?null:e+""}function mn(e,t,n){return t.stickyPositionCache?.set(e,n),n}function gn(e,t,n){const r=e.anchor||e.lifecycle?.anchor||"fixed";if("latest"===r){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let r=n.pointNodes.length-1;r>=0;r--){const i=n.pointNodes[r];if(i.pointId===e.pointId)return mn(t,n,{x:i.x,y:i.y})}const r=function(e){const t=e.data;if(!t||0===t.length)return null;const n=t[t.length-1],r=e.scales?.x??e.scales?.time,i=e.scales?.y??e.scales?.value;if(!r||!i)return null;const o=n[e.xAccessor||"x"],a=n[e.yAccessor||"y"];return null==o||null==a?null:{x:r(o),y:i(a)}}(n);return r?mn(t,n,r):null}if("semantic"===r){const r=function(e,t,n){const r=function(e){return pn(e.provenance?.stableId??e.stableId)}(e);if(!r)return null;const i=n.pointNodes?.find(e=>pn(e.pointId)===r);if(i)return mn(t,n,{x:i.x,y:i.y});const o=n.data?.find(e=>function(e){return pn(e.stableId??e.id??e.provenance?.stableId)}(e)===r);if(!o)return null;const a=hn(o,n),s=fn(o,n);return null==a||null==s?null:mn(t,n,{x:a,y:s})}(e,t,n);if(r)return r}let i=null,o=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(i=t.x,o=t.y)}if(null!=i&&null!=o||(i=hn(e,n),o=fn(e,n)),null!=i&&null!=o)return mn(t,n,{x:i,y:o});if("sticky"===r){const e=n.stickyPositionCache?.get(t);if(e)return e}return null}function yn(e,t,n,r=50){return!(-r>e||e>(n.width||0)+r||-r>t||t>(n.height||0)+r)}function vn(e){return{type:"hatch",background:e.background,stroke:e.stroke,lineWidth:e.lineWidth,spacing:e.spacing,angle:e.angle}}function bn(e){return"object"==typeof e&&null!==e&&"hatch"===e.type}function xn(e){return["hatch",e.background??"transparent",e.stroke??"#000",e.lineWidth??1.5,e.spacing??6,e.angle??45,e.lineOpacity??1].join("|")}function wn(e,t){let n=2166136261;const r=xn(t);for(let e=0;r.length>e;e++)n^=r.charCodeAt(e),n=Math.imul(n,16777619);return`${e}-hatch-${(n>>>0).toString(36)}`}function kn(e,t){const{background:n="transparent",stroke:r="#000",lineWidth:i=1.5,spacing:o=6,angle:a=45,lineOpacity:s=1}=e,l=Math.max(8,Math.ceil(2*o));return(0,ou.jsxs)("pattern",{id:t,width:l,height:l,patternUnits:"userSpaceOnUse",patternTransform:0!==a?`rotate(${a})`:void 0,children:[n&&"transparent"!==n&&(0,ou.jsx)("rect",{width:l,height:l,fill:n}),(0,ou.jsx)("line",{x1:0,y1:0,x2:0,y2:l,stroke:r,strokeWidth:i,strokeOpacity:s}),(0,ou.jsx)("line",{x1:o,y1:0,x2:o,y2:l,stroke:r,strokeWidth:i,strokeOpacity:s})]},t)}function Sn(e,t,n="#4e79a7"){if(bn(e)){const n=wn(t,e);return{fill:`url(#${n})`,def:kn(e,n)}}return e&&"string"==typeof e?{fill:e}:{fill:n}}function Mn(e,t,n,r){const i=Sn(e.fill??e.color,t,r);return function(e,t,n,r){if(!e||"object"!=typeof e)return;const i=e;if(!Array.isArray(i.stops))return;const o=i.stops.flatMap(e=>{if(!e||"object"!=typeof e)return[];const{offset:t,color:n,opacity:i}=e;return"number"==typeof t&&Number.isFinite(t)?[{offset:Math.max(0,Math.min(1,t)),color:"string"==typeof n&&n?n:r,opacity:"number"==typeof i&&Number.isFinite(i)?Math.max(0,Math.min(1,i)):void 0}]:[]}).sort((e,t)=>e.offset-t.offset);if(!o.length)return;const a="horizontal"===i.direction?"horizontal":"vertical"===i.direction?"vertical":n,s=t+"-gradient";return{fill:`url(#${s})`,def:(0,ou.jsx)("linearGradient",{id:s,x1:0,y1:0,x2:"horizontal"===a?"100%":0,y2:"vertical"===a?"100%":0,children:o.map((e,t)=>(0,ou.jsx)("stop",{offset:100*e.offset+"%",stopColor:e.color,stopOpacity:e.opacity},`${e.offset}-${t}`))},s)}}(e.gradient,t,n,"string"==typeof e.fill&&e.fill?e.fill:"string"==typeof e.color&&e.color?e.color:r)??i}function jn(e,t,n,r){const i=function(e,t,n){const r=e.position,i="string"==typeof r&&su.has(r)?r:"bottom-left",o=i.endsWith("left")?"left":i.endsWith("right")?"right":"center",a=i.startsWith("top")?"top":i.startsWith("bottom")?"bottom":"middle",s="top"===a?0:"bottom"===a?n:n/2;return{x:("left"===o?0:"right"===o?t:t/2)+("number"==typeof e.dx&&Number.isFinite(e.dx)?e.dx:0),y:s+("number"==typeof e.dy&&Number.isFinite(e.dy)?e.dy:0),textAnchor:"start"===e.textAnchor||"middle"===e.textAnchor||"end"===e.textAnchor?e.textAnchor:"left"===o?"start":"right"===o?"end":"middle",dominantBaseline:"auto"===e.dominantBaseline||"middle"===e.dominantBaseline||"hanging"===e.dominantBaseline?e.dominantBaseline:"top"===a?"hanging":"bottom"===a?"auto":"middle"}}(e,t,n);return{...i,fill:e.fill??e.color??r.fill,fontSize:e.fontSize??r.fontSize,fontFamily:e.fontFamily??r.fontFamily,fontWeight:e.fontWeight,fontStyle:e.fontStyle,letterSpacing:e.letterSpacing,opacity:e.opacity,className:e.className,style:{pointerEvents:"none"}}}function An({annotation:e,width:t,height:n,defaults:r=cu}){const i=e.label??e.text;return null==i?null:(0,lu.jsx)("text",{...jn(e,t,n,r),children:i})}function Cn(e){return!0===e?._annotationDeferred}function Rn(e){return"blended"===e?.cohesion||"layer"===e?.cohesion?e.cohesion:null}function Ln(e){const t=e?.provenance?.confidence;return"number"==typeof t&&Number.isFinite(t)?Math.max(0,Math.min(1,t)):null}function Pn(e){return Math.max(.72,.95-.06*e)}function Nn(e){const t=e.map((e,t)=>{return{p:e,i:t,emphasis:(n=e.annotation,"primary"===n?.emphasis||"secondary"===n?.emphasis?n.emphasis:null),confidence:Ln(e.annotation),readingOrder:null,rank:1};var n}),n=t.some(e=>null!=e.emphasis||null!=e.confidence),r=e.some(e=>Cn(e.annotation)),i=e.some(e=>null!=Rn(e.annotation)),o=e.some(e=>"layer"===Rn(e.annotation));if(!n&&!r&&!i)return e.map(e=>e.node);const a=t.filter(e=>null==e.emphasis&&null!=e.confidence).slice().sort((e,t)=>(t.confidence??0)-(e.confidence??0)||e.i-t.i);a.forEach((e,t)=>{e.readingOrder=t,e.rank=2-t/Math.max(1,a.length)});for(const e of t)e.emphasis&&(e.rank=du[e.emphasis]);const s=t.sort((e,t)=>e.rank-t.rank||e.i-t.i).map(e=>{const{p:t,i:n,emphasis:r,readingOrder:i}=e,o=Cn(t.annotation);let a=t.node;if("primary"===r||"secondary"===r||null!=i){const e=null==r&&null!=i;a=(0,uu.jsx)("g",{className:e?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+r,..."secondary"===r?{opacity:.6,fontSize:"0.88em"}:{},...e?{opacity:Pn(i),"data-annotation-reading-order":i}:{},children:t.node},"annotation-emphasis-"+n)}const s=Rn(t.annotation);return s&&(a=(0,uu.jsx)("g",{className:"annotation-cohesion--"+s,children:a},"annotation-cohesion-"+n)),o&&(a=(0,uu.jsx)("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:a},"annotation-deferred-"+n)),a});return r&&s.unshift((0,uu.jsx)("style",{children:".annotation-deferred{opacity:0;pointer-events:none;transition:opacity .12s ease}.stream-xy-frame:hover .annotation-deferred,.stream-ordinal-frame:hover .annotation-deferred,.stream-network-frame:hover .annotation-deferred,.stream-geo-frame:hover .annotation-deferred,.stream-xy-frame:focus-within .annotation-deferred,.stream-ordinal-frame:focus-within .annotation-deferred,.stream-network-frame:focus-within .annotation-deferred,.stream-geo-frame:focus-within .annotation-deferred{opacity:1;pointer-events:auto}@media (prefers-reduced-motion:reduce){.annotation-deferred{transition:none}}"},"annotation-disclosure-style")),o&&s.unshift((0,uu.jsx)("style",{children:".annotation-cohesion--layer text,.annotation-cohesion--layer tspan{fill:var(--semiotic-annotation-color,var(--semiotic-text-secondary,#666));font-style:italic}"},"annotation-cohesion-style")),s}function En(e){return!!e&&"object"==typeof e&&pu.has(function(e){return"string"==typeof e?.type?e.type:""}(e))}function In(e){return"primary"===e?.emphasis||!0===e?.defensive}function Tn(e,t,n={}){return"number"==typeof n.maxAnnotations&&Number.isFinite(n.maxAnnotations)?Math.max(0,Math.floor(n.maxAnnotations)):e>0&&t>0?Math.max(1,Math.round(e*t/(n.areaPerAnnotation&&n.areaPerAnnotation>0?n.areaPerAnnotation:2e4))):1/0}function Dn(e){let t;const n=e?.emphasis;t="primary"===n?100:"secondary"===n?10:50;const r=e?.provenance?.confidence;switch("number"==typeof r&&Number.isFinite(r)&&(t+=15*Math.max(0,Math.min(1,r))),e?.lifecycle?.freshness){case"fresh":t+=8;break;case"aging":t+=4;break;case"stale":t+=1;break;case"expired":t-=200}return t}function zn(e){const t=e?.provenance;if(!t||"object"!=typeof t)return e;const n="string"==typeof t.source?Object.prototype.hasOwnProperty.call(xu,t.source)?xu[t.source]:t.source:null,r="number"==typeof t.confidence&&Number.isFinite(t.confidence)?Math.round(100*Math.max(0,Math.min(1,t.confidence)))+"%":null;if(!n&&!r)return e;if(null!=e.label&&"string"!=typeof e.label)return e;const i=[n,r].filter(Boolean).join(" · "),o="string"==typeof e.label?e.label:"";return o.includes(`(${i})`)?e:{...e,label:o?`${o} (${i})`:`(${i})`}}function _n(e){if(!On(e))return e;const t=("string"==typeof e.mobileText?e.mobileText:void 0)??("string"==typeof e.shortText?e.shortText:void 0);return!t||"string"!=typeof e.label&&null!=e.label?e:{...e,label:t}}function On(e){return En(e)}function Fn(e,t,n,r,i){const o=e+n,a=t+r;return Math.abs(n)>Math.abs(r)?{x:0>n?o-i.width-4:o+4,y:0>r?a-i.height:a,width:i.width,height:i.height}:{x:0>n?o-i.width:o,y:0>r?a-i.height-4:a+4,width:i.width,height:i.height}}function Wn(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function Bn(e,t){return Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x))*Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y))}function Hn(e,t,n,r,i,o,a,s){const l=Wn(e,a);let c=.4*Math.hypot(t.dx,t.dy)+80*function(e,t,n,r){const i=Math.max(0,r-e.x),o=Math.max(0,r-e.y);return(i+Math.max(0,e.x+e.width-(t-r)))*e.height+(o+Math.max(0,e.y+e.height-(n-r)))*e.width}(l,i,o,s);for(const e of n)c+=12*Bn(l,e);for(const e of r)c+=4*Bn(l,e);return c}function $n(e){const{annotations:t,context:n,defaultOffset:r=mu,notePadding:i=gu,markPadding:o=yu,edgePadding:a=vu,preserveManualOffsets:s=!0,routeLongConnectors:l=!0,connectorThreshold:c=bu,density:u,progressiveDisclosure:d=!1,redundantCues:h=!1,responsive:f,mobile:p,cohesion:m,audience:g}=e,y=n.width||0,v=n.height||0,b="object"==typeof p?p:{},x=b.breakpoint??480,w=!!p&&x>=y,k=w&&!1!==b.preferShortText?t.map(_n):t,S=w&&!u?{maxAnnotations:b.maxAnnotations??("callout-list"===b.strategy?1:2),minVisible:b.minVisible??1}:u,M=d||w&&(!1!==b.progressiveDisclosure||"callout-list"===b.strategy),j=w&&!f?b.responsive??{minWidth:x}:f,A=w&&!m?b.cohesion:m;if(0===k.length||0>=y||0>=v)return k.slice();const C=[],R=function(e,t){return(e.pointNodes||[]).map(e=>{const n=Math.max(1,e.r||1)+t;return{x:e.x-n,y:e.y-n,width:2*n,height:2*n}})}(n,o);let L=!1;const P=k.map((e,t)=>{if(!On(e))return e;const o=function(e,t,n){if("widget"===e.type&&"number"==typeof e.px&&"number"==typeof e.py)return{x:e.px,y:e.py};const r=e.pointId??e.nodeId;if(null!=r&&n.pointNodes){const e=n.pointNodes.find(e=>e.pointId===r);if(e)return{x:e.x,y:e.y}}const i=e.coordinates,o=n.scales?.geoProjection;if(Array.isArray(i)&&i.length>=2&&o){const e=i[0],t=i[1];if("number"==typeof e&&"number"==typeof t){const n=o([e,t]);if(n&&"number"==typeof n[0]&&"number"==typeof n[1])return{x:n[0],y:n[1]}}}return n.scales||"number"!=typeof e.x||"number"!=typeof e.y?gn(e,t,n):{x:e.x,y:e.y}}(e,t,n);if(!o)return e;const u=function(e){if("widget"===e.type)return{width:"number"==typeof e.width?e.width:32,height:"number"==typeof e.height?e.height:32};const t=tn(e);if(t)return{width:Math.max(24,t.width+10),height:Math.max(18,t.height+6)};const n="number"==typeof e.wrap?e.wrap:120,r=[...nn("string"==typeof e.title?e.title:void 0,n,7),...nn("string"==typeof e.label?e.label:void 0,n,7)],i=r.reduce((e,t)=>Math.max(e,t.length),0);return{width:Math.max(24,Math.min(n,7*i)+10),height:Math.max(18,16*r.length+6)}}(!0===e.defensive?zn(e):e);if(s&&("number"==typeof(d=e).dx||"number"==typeof d.dy)){const t=function(e){return"text"===e.type||"widget"===e.type?{dx:0,dy:0}:{dx:30,dy:-30}}(e);return C.push(Wn(Fn(o.x,o.y,"number"==typeof e.dx?e.dx:t.dx,"number"==typeof e.dy?e.dy:t.dy,u),i)),e}var d;let h=null,f=1/0;for(const e of function(e){const t=1.6*e;return[{dx:e,dy:-e},{dx:-e,dy:-e},{dx:e,dy:e},{dx:-e,dy:e},{dx:e,dy:0},{dx:-e,dy:0},{dx:0,dy:-e},{dx:0,dy:e},{dx:t,dy:-t},{dx:-t,dy:-t},{dx:t,dy:t},{dx:-t,dy:t}]}(r)){const t=Hn(Fn(o.x,o.y,e.dx,e.dy,u),e,C,R,y,v,i,a);f>t&&(h=e,f=t)}if(!h)return e;const p=Wn(Fn(o.x,o.y,h.dx,h.dy,u),i);C.push(p);const m=Math.hypot(h.dx,h.dy),g=l&&m>=c&&"text"!==e.type&&"widget"!==e.type?{...e.connector||{end:"arrow"},type:"curve"}:e.connector;return L=!0,{...e,dx:h.dx,dy:h.dy,...g?{connector:g}:{}}}),N=L?P:k.slice();let E=N;if(h){let e=!1;const t=N.map(t=>{const n=function(e){return"text"!==e.type||"string"!=typeof e.color||8>Math.hypot("number"==typeof e.dx?e.dx:0,"number"==typeof e.dy?e.dy:0)?e:{...e,_redundantConnector:!0}}(t);return n!==t&&(e=!0),n});E=e?t:N}{let e=!1;const t=E.map(t=>{if(!0!==t?.defensive)return t;const n=zn(t);return n!==t&&(e=!0),n});E=e?t:E}const I=new Set;if(S){const e="object"==typeof S?S:{},t=function(e){if(!e)return 1;const t=function(e){const t=e?.familiarity;if(!t)return 3;const n=Object.values(t).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0===n.length?3:n.reduce((e,t)=>e+t,0)/n.length}(e);return t>2?4>t?1:.6:1.5}(g),n=1===t?e:{...e,maxAnnotations:Math.max(0,Math.round((e.maxAnnotations??Tn(y,v,e))*t))},{deferred:r}=function(e){const{annotations:t,width:n,height:r}=e,i=Math.max(0,e.minVisible??1),o=Tn(n,r,e),a=t.map((e,t)=>{return{annotation:e,index:t,note:(n=e,En(n))};var n}),s=a.filter(e=>e.note);if(0===s.length||o>=s.length)return{visible:t.slice(),deferred:[],budget:o};const l=s.filter(e=>In(e.annotation)),c=s.filter(e=>!In(e.annotation)).sort((e,t)=>Dn(t.annotation)-Dn(e.annotation)||e.index-t.index),u=Math.min(c.length,Math.max(Math.max(0,o-l.length),Math.max(0,i-l.length))),d=new Set([...l.map(e=>e.index),...c.slice(0,u).map(e=>e.index)]),h=[],f=[];for(const{annotation:e,index:t,note:n}of a)!n||d.has(t)?h.push(e):f.push(e);return{visible:h,deferred:f,budget:o}}({annotations:E,width:y,height:v,...n});for(const e of r)I.add(e)}if(j&&("object"==typeof j&&"number"==typeof j.minWidth?j.minWidth:480)>=y)for(const e of E)On(e)&&"secondary"===e.emphasis&&I.add(e);if(I.size>0)for(const e of E)!0===e?.defensive&&I.delete(e);let T;return T=0===I.size?E:M?E.map(e=>I.has(e)?{...e,_annotationDeferred:!0}:e):E.filter(e=>!I.has(e)),A?function(e,t){let n=!1;const r=e.map(e=>On(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(n=!0,{...e,cohesion:t}):e);return n?r:e}(T,A):T}function qn({config:e,orientation:t="vertical",width:n=100,customClickBehavior:r,customHoverBehavior:i,highlightedCategory:o,isolatedCategories:a,legendInteraction:s}){const{colorFn:l,domain:c,label:u,format:d}=e,h="horizontal"===t,f=d||Et(c),p="grad-legend-"+Mu.useId(),m=!(!r&&!i),g="isolate"===s||void 0===s&&null!=a,[y,v]=Mu.useState(0),[b,x]=Mu.useState(null),w=Mu.useRef([]),[k,S]=c,M=Mu.useMemo(()=>Array.from({length:65},(e,t)=>{const n=t/64;return(0,ju.jsx)("stop",{offset:n,stopColor:l(h?k+n*(S-k):S-n*(S-k))},t)}),[l,k,S,h]),j=h?Math.min(n,200):14,A=h?12:100,C=h?Math.max(0,(n-j)/2):0,R=u?18:0;return(0,ju.jsxs)("g",{"aria-label":u||"Gradient legend",role:m?"listbox":void 0,"aria-orientation":m?t:void 0,"aria-multiselectable":!(!m||!g)||void 0,style:ku,children:[(0,ju.jsx)("defs",{children:(0,ju.jsx)("linearGradient",{id:p,x1:"0%",y1:"0%",x2:h?"100%":"0%",y2:h?"0%":"100%",children:M})}),u&&(0,ju.jsx)("text",{x:h?C+j/2:0,y:12,textAnchor:h?"middle":"start",fontSize:11,fill:"var(--semiotic-text, #333)",children:u}),(0,ju.jsx)("rect",{x:C,y:R,width:j,height:A,fill:`url(#${p})`,rx:2}),m&&Array.from({length:5},(e,n)=>((e,n,s)=>{const l="string"==typeof e.interactionKey?e.interactionKey:e.label,c=a?.has(l)??!1,u=o===l,d=b===s,h=e=>{const t=(e+5)%5;v(t),w.current[t]?.focus()};return(0,ju.jsx)("rect",{ref:e=>{w.current[s]=e},className:"semiotic-gradient-legend-bin",...n,fill:a?.size&&!c||null!=o&&!u?"rgba(255,255,255,0.65)":"transparent",stroke:d||c||u?"var(--semiotic-focus, #005fcc)":"transparent",strokeWidth:d?3:2,tabIndex:s===y?0:-1,role:"option","aria-label":e.label,"aria-selected":g?c:void 0,"aria-current":!(g||!u)||void 0,onClick:r?()=>r(e):void 0,onMouseEnter:i?()=>i(e):void 0,onMouseLeave:i?()=>i(null):void 0,onFocus:()=>{v(s),x(s),i?.(e)},onBlur:()=>{x(null),i?.(null)},onKeyDown:n=>{if(("Enter"===n.key||" "===n.key)&&r)return n.preventDefault(),void r(e);const i="horizontal"===t?"ArrowRight":"ArrowDown";n.key===("horizontal"===t?"ArrowLeft":"ArrowUp")||n.key===i?(n.preventDefault(),h(s+(n.key===i?1:-1))):"Home"!==n.key&&"End"!==n.key||(n.preventDefault(),h("Home"===n.key?0:4))},style:{cursor:"pointer",pointerEvents:"all"}},"gradient-interaction-"+s)})((e=>{const t=h?e:5-e-1,n=c[0]+t/5*(c[1]-c[0]),r=c[0]+(t+1)/5*(c[1]-c[0]);return{label:`${f(n)} – ${f(r)}`,valueRange:[n,r],interactionKey:`${n}:${r}`}})(n),{x:h?C+n*j/5:0,y:h?R:R+n*A/5,width:h?j/5:j,height:h?A:A/5},n)),[0,1].map(e=>(0,ju.jsx)("text",{x:h?C+e*j:j+5,y:R+(h?A+12:e?A:10),textAnchor:h?e?"end":"start":void 0,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:f(c[h?e:1-e])},e))]})}function Gn(e,t,n,r,i){if("function"==typeof n)return n(e);const o=r(e,t);return"fill"===n?(0,Au.jsx)("rect",{style:o,width:i,height:i}):(0,Au.jsx)("line",{style:o,x1:0,y1:0,x2:i,y2:i})}function Vn({swatchSize:e}){return(0,Au.jsx)("path",{d:`M${.25*e},${.55*e} L${.45*e},${.75*e} L${.8*e},${.3*e}`,fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function Un(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}function Yn(e,t,n,r,i,o){const{legendGroup:{type:a="fill",styleFn:s,items:l},customClickBehavior:c,customHoverBehavior:u,highlightedCategory:d,isolatedCategories:h,focusedGroupIndex:f,focusedItemIndex:p,groupIndex:m,onFocusedIndexChange:g,interactive:y,useIsolateAria:v,metrics:{swatchSize:b,labelGap:x}}=e,w=!!h?.size&&h.has(t.label);return(0,Au.jsxs)("g",{transform:r,onClick:c?()=>c(t):void 0,onMouseEnter:u?()=>u(t):void 0,onMouseLeave:u?()=>u(null):void 0,tabIndex:y?m===f&&n===p?0:-1:void 0,role:y?"option":void 0,"aria-selected":y&&v?w:void 0,"aria-current":!(!y||v||null==d||t.label!==d)||void 0,"aria-label":t.label,onKeyDown:y?e=>{if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),c?.(t)),e.key===i||e.key===o){e.preventDefault();const t=(n+(e.key===o?1:-1)+l.length)%l.length;g(m,t);const r=e.currentTarget.parentElement?.children[t];r instanceof SVGElement&&r.focus()}}:void 0,onFocus:y?e=>{g(m,n),u?.(t),e.currentTarget.querySelector(".semiotic-legend-focus-ring")?.setAttribute("visibility","visible")}:void 0,onBlur:y?e=>{u?.(null),e.currentTarget.querySelector(".semiotic-legend-focus-ring")?.setAttribute("visibility","hidden")}:void 0,style:{cursor:y?"pointer":"default",opacity:Un(t,d,h),transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[y&&(0,Au.jsx)("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:b+x+2+7*t.label.length,height:b+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),Gn(t,n,a,s,b),w&&(0,Au.jsx)(Vn,{swatchSize:b}),(0,Au.jsx)("text",{y:b/2,x:b+x,dominantBaseline:"central",fontSize:12,style:Su,fill:"var(--semiotic-text, #333)",children:t.label})]},"legend-item-"+n)}function Xn(e){const{legendGroups:t,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:o,legendInteraction:a,title:s="Legend",width:l=100,height:c=20,orientation:u="vertical",legendLayout:d}=e,h=Gt(d),[f,p]=wu.useState(0),[m,g]=wu.useState(0),y=wu.useCallback((e,t)=>{p(e),g(t)},[]),v="vertical"===u?(({legendGroups:e,width:t,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:o,focusedGroupIndex:a,focusedItemIndex:s,onFocusedIndexChange:l,legendInteraction:c,metrics:u})=>{const d=[],h=function(e,t){let n=24;return e.map(({hasLabel:e,itemCount:r})=>{n+=5;const i=n;let o;n+=8,e&&(n+=16,o=n,n+=8);const a=n;return n+=r*t+8,{lineY:i,labelY:o,itemsY:a,endY:n}})}(e.map(e=>({hasLabel:!!e.label,itemCount:e.items.length})),u.rowHeight);return e.forEach((e,f)=>{const p=h[f];d.push((0,Au.jsx)("line",{stroke:"gray",x1:0,y1:p.lineY,x2:t,y2:p.lineY},"legend-top-line legend-symbol-"+f)),e.label&&null!=p.labelY&&d.push((0,Au.jsx)("text",{y:p.labelY,className:"legend-group-label",fontSize:12,style:Su,fill:"var(--semiotic-text, #333)",children:e.label},"legend-text-"+f)),d.push((0,Au.jsx)("g",{className:"legend-item",transform:`translate(0,${p.itemsY})`,children:Cu(e,n,r,i,o,a,s,f,l,c,u)},"legend-group-"+f))}),d})({legendGroups:t||[],width:l,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:o,focusedGroupIndex:f,focusedItemIndex:m,onFocusedIndexChange:y,legendInteraction:a,metrics:h}):(({legendGroups:e,height:t,width:n,customClickBehavior:r,customHoverBehavior:i,highlightedCategory:o,isolatedCategories:a,focusedGroupIndex:s,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u,metrics:d})=>{let h=0;const f=[];e.forEach((e,t)=>{let p=0;e.label&&(p+=16);const m=((e,t,n,r,i,o,a,s,l,c,u,d)=>{const{items:h}=e,f=[],{swatchSize:p,labelGap:m,itemGap:g,rowHeight:y,align:v}=u,b={legendGroup:e,customClickBehavior:t,customHoverBehavior:n,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:o,focusedItemIndex:a,groupIndex:s,onFocusedIndexChange:l,interactive:!(!t&&!n),useIsolateAria:"isolate"===c||void 0===c&&null!=i,metrics:u},x=h.map(e=>p+m+7*e.label.length),w=[];let k=0,S=0;x.forEach((e,t)=>{const n=0===S?e:S+g+e;d&&d>0&&S>0&&n>d?(w.push({start:k,end:t,width:S}),k=t,S=e):S=n}),h.length>0&&w.push({start:k,end:h.length,width:S}),w.forEach((e,t)=>{let n="center"===v?Math.max(0,((d??e.width)-e.width)/2):"end"===v?Math.max(0,(d??e.width)-e.width):0;for(let r=e.start;e.end>r;r++)f.push(Yn(b,h[r],r,`translate(${n},${t*y})`,"ArrowLeft","ArrowRight")),n+=x[r]+g});const M=w.reduce((e,t)=>Math.max(e,t.width),0),j=w.length;return{items:f,offset:M,totalRows:j,totalHeight:j*y}})(e,r,i,o,a,s,l,t,c,u,d,d.maxWidth??n);p+=m.offset+5,f.push({label:e.label,...m,offset:p,totalRows:m.totalRows,totalHeight:m.totalHeight}),h+=p+12});const p=d.maxWidth??n;let m=h>p?0:"center"===d.align?Math.max(0,(p-h)/2):"end"===d.align?Math.max(0,p-h):0;const g=[];return f.forEach((n,r)=>{const i=e[r];i.label&&(g.push((0,Au.jsx)("text",{transform:`translate(${m},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",fontSize:12,style:Su,fill:"var(--semiotic-text, #333)",children:i.label},"legend-text-"+r)),m+=16),g.push((0,Au.jsx)("g",{className:"legend-item",transform:`translate(${m},0)`,children:n.items},"legend-group-"+r)),m+=n.offset+5,e[r+1]&&g.push((0,Au.jsx)("line",{stroke:"gray",x1:m,y1:-8,x2:m,y2:(n.totalHeight||t)+0+8},"legend-top-line legend-symbol-"+r)),m+=12}),(0,Au.jsx)("g",{children:g})})({legendGroups:t||[],title:s,height:c,width:l,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:o,focusedGroupIndex:f,focusedItemIndex:m,onFocusedIndexChange:y,legendInteraction:a,metrics:h}),b=!(!n&&!r);return(0,Au.jsxs)("g",{role:b?"listbox":void 0,"aria-multiselectable":!(!b||"isolate"!==a&&(void 0!==a||null==o))||void 0,"aria-label":"Chart legend",style:ku,children:[void 0!==s&&""!==s&&"vertical"===u&&(0,Au.jsx)("text",{className:"legend-title",y:16,x:l/2,textAnchor:"middle",fontSize:12,style:Su,fill:"var(--semiotic-text, #333)",children:s}),v]})}function Zn(e){const{legend:t,totalWidth:n,totalHeight:r,margin:i,legendPosition:o="right",legendLayout:a,legendHoverBehavior:s,legendClickBehavior:l,legendHighlightedCategory:c,legendIsolatedCategories:u,legendInteraction:d}=e;if(!t)return null;const{x:h,y:f,width:p}=function(e,t){const n=t.position??"right",r="top"===n||"bottom"===n,i=Math.max(0,t.totalWidth-t.margin.left-t.margin.right),o=Math.max(1,r?t.legendLayout?.maxWidth??i:t.reservedWidth??_t(e,t.legendLayout)),a=Ot(e),s=Ft(t.legendLayout,"left"===n?t.axisChrome?.leftAxis:t.axisChrome?.rightAxis),l=Wt(t.legendLayout),c=Ht(e,i,t.legendLayout),u=Bt(t.axisChrome,t.legendLayout),d=Bt(t.axisChrome?.topAxis,t.legendLayout);if("left"===n)return{x:Math.max(l,t.margin.left-s-o-a),y:t.margin.top,width:o,height:c};if("top"===n)return{x:t.margin.left,y:t.margin.top-d-a-c,width:o,height:c};if("bottom"===n){const e=t.totalHeight-t.margin.bottom;return{x:t.margin.left,y:Math.max(e+a,Math.min(e+u+a,t.totalHeight-c)),width:o,height:c}}return{x:Math.min(t.totalWidth-o-l,t.totalWidth-t.margin.right+s+a),y:t.margin.top,width:o,height:c}}(t,{totalWidth:n,totalHeight:r,margin:i,position:o,legendLayout:a,axisChrome:e.axisChrome}),m="top"===o||"bottom"===o;return(0,Ru.jsx)("g",{transform:`translate(${h}, ${f})`,children:Tt(t)?(0,Ru.jsx)(qn,{config:t.gradient,orientation:m?"horizontal":"vertical",width:p,customHoverBehavior:s,customClickBehavior:l,highlightedCategory:c,isolatedCategories:u,legendInteraction:d}):It(t)?(0,Ru.jsx)(Xn,{legendGroups:t.legendGroups,title:"",width:p,orientation:m?"horizontal":"vertical",legendLayout:a,customHoverBehavior:s,customClickBehavior:l,highlightedCategory:c,isolatedCategories:u,legendInteraction:d}):t})}function Kn({title:e,totalWidth:t,marginTop:n}){return e?"string"!=typeof e?(0,Lu.jsx)("foreignObject",{x:0,y:0,width:t,height:n,children:e}):(0,Lu.jsx)("text",{x:t/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)",fontFamily:"var(--semiotic-title-font-family, var(--semiotic-font-family, sans-serif))",fontWeight:"var(--semiotic-title-font-weight, bold)"},children:e}):null}function Qn(e,t){return"string"==typeof e&&e.length>0?e:t}function Jn(e,t,n){return"string"==typeof t&&t.length>0?t:"string"==typeof e&&e.length>0?`${e} (${n.familyPhrase})`:n.fallback}function er(e){const{width:t,height:n,totalWidth:r,totalHeight:i,margin:o,showAxes:a,title:s,description:l,idPrefix:c,legend:u,legendHoverBehavior:d,legendClickBehavior:h,legendHighlightedCategory:f,legendIsolatedCategories:p,legendPosition:m,legendLayout:g,foregroundGraphics:y,annotations:v,onAnnotationActivate:b,onObservation:x,chartId:w,chartType:k,autoPlaceAnnotations:S,svgAnnotationRules:M,pointNodes:j,geoProjection:A}=e,C=function(e){const t=(0,Yc.useObservationSelector)(e=>e.pushObservation),n=Uc.useCallback(n=>{e.onObservation?.(n),t?.(n)},[e,t]);return Uc.useMemo(()=>({...e,onObservation:n}),[n,e])}({onAnnotationActivate:b,onObservation:x,chartId:w,chartType:k}),R=(0,Xc.useRef)([v?.length??0,new Map]),L=v?.length??0;R.current[0]!==L&&(R.current=[L,new Map]);const P=(0,Xc.useMemo)(()=>{if(!v||0===v.length)return null;const e=function(e,t={}){const n=!0===t.showRetractedAnnotations,r=!0===t.showSupersededAnnotations,i=new Set;for(const t of e){const e=t?.lifecycle?.supersedes;e&&"retracted"!==t?.lifecycle?.status&&i.add(e)}return e.filter(e=>{if("retracted"===e?.lifecycle?.status&&!n)return!1;const t=e?.provenance?.stableId;return!(t&&i.has(t)&&!r)})}(v),r=A?e.map(e=>{if(!Array.isArray(e.coordinates)||2>e.coordinates.length)return e;const t=A(Number(e.coordinates[0]),Number(e.coordinates[1]));return t?{...e,x:t[0],y:t[1]}:e}):e,i={scales:{x:e=>Number(e),y:e=>Number(e)},timeAxis:"x",width:t,height:n,frameType:"xy",pointNodes:j,stickyPositionCache:R.current[1]};return function(e,t,n,r){return function(e,t,n,r){const i=[];return e.forEach((e,o)=>{let a;if(n){const i=n(e,o,r);a=null!=i?i:t(e,o,r)}else a=t(e,o,r);a&&i.push({node:a,annotation:e})}),{nodes:Nn(i),renderedAnnotations:i.map(e=>e.annotation)}}(e,t,n,r).nodes}(S?$n({annotations:r,context:i,..."object"==typeof S?S:{}}):r,function(e,t={}){return function(e,n,r){switch(e.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const t=gn(e,n,r);if(!t)return null;const{x:i,y:o}=t;if(!yn(i,o,r))return null;const a="callout"===e.type?"callout-circle":e.type,s="callout-circle"===a?{radius:e.radius??12,radiusPadding:e.radiusPadding}:"callout-rect"===a?{width:e.width,height:e.height}:void 0;return(0,hu.jsx)(cn,{noteData:{x:i,y:o,dx:e.dx??30,dy:e.dy??-30,note:en(e),type:a,...s?{subject:s}:{},connector:e.connector||{end:"arrow"},color:e.color,disable:e.disable,opacity:e.opacity,strokeDasharray:e.strokeDasharray,className:e.className}},"ann-"+n)}case"x-threshold":case"y-threshold":{const t="x-threshold"===e.type,i=null!=e.value?{...e,[t?"x":"y"]:e.value}:e,o=t?hn(i,r):fn(i,r);return null==o?null:(0,hu.jsx)(Jt,{ann:e,position:o,vertical:t,width:r.width||0,height:r.height||0,color:e.color||"#f97316",bold:!0},"ann-"+n)}case"enclose":{const t=(e.coordinates||[]).map(e=>({x:hn({...e,type:"point"},r),y:fn({...e,type:"point"},r),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>t.length)return null;const i=(0,nu.packEnclose)(t),o=e.padding||10;return(0,hu.jsxs)("g",{children:[(0,hu.jsx)("circle",{cx:i.x,cy:i.y,r:i.r+o,fill:e.fill||"none",fillOpacity:e.fillOpacity??.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&(0,hu.jsx)(Kt,{x:i.x,y:i.y-i.r-o-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:e.label,background:e.labelBackground??"none"})]},"ann-"+n)}case"rect-enclose":{const t=(e.coordinates||[]).map(e=>({x:hn({...e,type:"point"},r),y:fn({...e,type:"point"},r)})).filter(e=>null!=e.x&&null!=e.y);if(2>t.length)return null;const i=e.padding||10,o=t.map(e=>e.x),a=t.map(e=>e.y),[s,l]=dt(o),[c,u]=dt(a),d=s-i,h=l+i,f=c-i;return(0,hu.jsxs)("g",{children:[(0,hu.jsx)("rect",{x:d,y:f,width:h-d,height:u+i-f,fill:e.fill||"none",fillOpacity:e.fillOpacity??.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&(0,hu.jsx)(Kt,{x:(d+h)/2,y:f-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:e.label,background:e.labelBackground??"none"})]},"ann-"+n)}case"highlight":{const t=r.data||[],i="function"==typeof e.filter?t.filter(e.filter):e.field&&null!=e.value?t.filter(t=>t[e.field]===e.value):[],o={stroke:e.color||"#f97316",strokeWidth:2,fill:"none"};return(0,hu.jsx)("g",{children:i.map((t,n)=>{const i=hn(t,r),a=fn(t,r);if(null==i||null==a)return null;const s="function"==typeof e.r?e.r(t):e.r||6,l="function"==typeof e.style?e.style(t):e.style||o;return(0,hu.jsx)("circle",{cx:i,cy:a,r:s,...l},"hl-"+n)})},"ann-"+n)}case"bracket":{const t=hn(e,r),i=fn(e,r);return(0,hu.jsx)(cn,{noteData:{x:t??0,y:i??0,dx:e.dx||0,dy:e.dy||0,note:en(e),type:"bracket",subject:{type:e.bracketType||"curly",width:e.width,height:e.height,depth:e.depth||30},color:e.color}},"ann-"+n)}case"trend":{const t=r.data||[];if(2>t.length)return null;const 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 d=[],h=new Map;if(a&&l&&c){for(const e of t){const t=e[l];if(null==t)continue;const n=t+"";h.has(n)||(h.set(n,d.length),d.push(n))}u=t.map(e=>{const t=e[l],n=e[c];if(null==t||null==n)return null;const r=h.get(t+"");return null!=r?[r,+n]:null}).filter(e=>null!==e)}else u=t.map(e=>[e[i],e[o]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>u.length)return null;const f=r.scales?.x??r.scales?.time,p=r.scales?.y??r.scales?.value;if(!f||!p)return null;const m=e=>t=>{const n=Math.max(0,Math.floor(t)),r=Math.min(d.length-1,n+1),i=t-n,o=e(d[n]);return o+(e(d[r])-o)*i},g=f,y=p;let v;if(a)if(s){const e=m(y);v=(t,n)=>[g(n),e(t)]}else{const e=m(g);v=(t,n)=>[e(t),y(n)]}else v=(e,t)=>[g(e),y(t)];const b=e.method||"linear";let x;if("loess"===b)x=function(e,t=.3){const n=e.length;if(2>n)return e.slice();const r=e.slice().sort((e,t)=>e[0]-t[0]),i=r.map(e=>e[0]),o=r.map(e=>e[1]),a=Math.min(n,Math.max(2,Math.ceil(t*n))),s=Number.isFinite(a)&&i.every(Number.isFinite);let l=0,c=a-1;const u=[];for(let e=0;n>e;e++){const t=i[e];let r,d=0,h=n-1;if(s){for(;n-1>c&&Math.abs(i[l]-t)>=Math.abs(i[c+1]-t);)l++,c++;const e=Math.max(Math.abs(i[l]-t),Math.abs(i[c]-t));r=e||1,e>0&&(d=l,h=c)}else r=i.map(e=>Math.abs(e-t)).sort((e,t)=>e-t)[a-1]||1;let f=0,p=0,m=0,g=0,y=0;for(let e=d;h>=e;e++){const n=Math.abs(i[e]-t)/r,a=1>n?Math.pow(1-Math.pow(n,3),3):0;0!==a&&(f+=a,p+=a*i[e],m+=a*o[e],g+=a*i[e]*i[e],y+=a*i[e]*o[e])}if(0===f){u.push([t,o[e]]);continue}const v=f*g-p*p;if(1e-12>Math.abs(v))u.push([t,m/f]);else{const e=(f*y-p*m)/v;u.push([t,(m-e*p)/f+e*t])}}return u}(u,e.bandwidth??.3);else{const t="polynomial"===b?dn(u,e.order||2):function(e){const t=[0,0,0,0];let n=0;for(const[r,i]of e)null!==i&&(n++,t[0]+=r,t[1]+=i,t[2]+=r*r,t[3]+=r*i);const r=n*t[2]-t[0]*t[0],i=0===r?0:un((n*t[3]-t[0]*t[1])/r),o=un(t[1]/n-i*t[0]/n);return{points:e.map(([e])=>[un(e),un(i*e+o)]),equation:[i,o]}}(u);x=t.points}const w=x.map(([e,t])=>{const[n,r]=v(e,t);return`${n},${r}`}).join(" "),k=e.color||"#6366f1",S=x[x.length-1],[M,j]=v(S[0],S[1]);return(0,hu.jsxs)("g",{children:[(0,hu.jsx)("polyline",{points:w,fill:"none",stroke:k,strokeWidth:e.strokeWidth??2,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,hu.jsx)("text",{x:M+4,y:j-4,fill:k,fontSize:11,children:e.label})]},"ann-"+n)}case"band":{const t=r.scales?.y??r.scales?.value,i=t?.domain?.(),s=e.y0??i?.[0],l=e.y1??i?.[1],c=null!=s&&t?t(s):0,u=null!=l&&t?t(l):r.height||0,d=Mn(e,"ann-"+n,"vertical","var(--semiotic-primary, #6366f1)");return(0,hu.jsxs)("g",{opacity:e.opacity,children:[d.def&&(0,hu.jsx)("defs",{children:d.def}),(0,hu.jsx)("rect",{x:0,y:Math.min(c,u),width:r.width||0,height:Math.abs(u-c),fill:d.fill,fillOpacity:e.fillOpacity??.1}),e.label&&(0,hu.jsx)(Kt,{x:(r.width||0)-4,y:(o=c,a=u,Math.max(Math.min(o,a),0)+16),textAnchor:"end",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:e.label,background:e.labelBackground??"halo"})]},"ann-"+n)}case"x-band":{const t=r.scales?.x??r.scales?.time,i=t?.domain?.(),o=e.x0??i?.[0],a=e.x1??i?.[1],s=null!=o&&t?t(o):null,l=null!=a&&t?t(a):null;if(null==s||null==l)return null;const c=Mn(e,"ann-"+n,"horizontal","var(--semiotic-primary, #6366f1)");return(0,hu.jsxs)("g",{opacity:e.opacity,children:[c.def&&(0,hu.jsx)("defs",{children:c.def}),(0,hu.jsx)("rect",{x:Math.min(s,l),y:0,width:Math.abs(l-s),height:r.height||0,fill:c.fill,fillOpacity:e.fillOpacity??.1}),e.label&&(0,hu.jsx)(Kt,{x:Math.min(s,l)+4,y:16,textAnchor:"start",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:e.label,background:e.labelBackground??"halo"})]},"ann-"+n)}case"envelope":{const t=r.data||[];if(2>t.length)return null;const 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=e.upperAccessor||"upperBounds",l=e.lowerAccessor||"lowerBounds",c=e.filter,u=t.filter(e=>null!=e[s]&&null!=e[l]&&!(c&&!c(e))).sort((e,t)=>e[i]-t[i]);if(2>u.length)return null;const d=fu[r.curve||"linear"]||ru.curveLinear,h=(0,ru.area)().x(e=>o(e[i])).y0(e=>a(e[l])).y1(e=>a(e[s])).curve(d)(u);if(!h)return null;const f=e.fill||"#6366f1";return(0,hu.jsxs)("g",{children:[(0,hu.jsx)("path",{d:h,fill:f,fillOpacity:e.fillOpacity??.15,stroke:"none"}),e.label&&u.length>0&&(0,hu.jsx)("text",{x:o(u[u.length-1][i])+4,y:a(u[u.length-1][s])-4,fill:f,fontSize:11,children:e.label})]},"ann-"+n)}case"anomaly-band":{const t=r.data||[];if(2>t.length)return null;const 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=t.map(e=>e[i]).filter(e=>null!=e&&isFinite(e));if(2>s.length)return null;const l=s.reduce((e,t)=>e+t,0)/s.length,c=s.reduce((e,t)=>e+(t-l)**2,0)/s.length,u=Math.sqrt(c),d=e.threshold??2,h=l-d*u,f=!1!==e.showBand,p=e.fill||"#6366f1",m=e.fillOpacity??.1,g=e.anomalyColor||"#ef4444",y=e.anomalyRadius??6,v=a(l+d*u),b=a(h),x=t.filter(e=>{const t=e[i];return null!=t&&Math.abs(t-l)>d*u});return(0,hu.jsxs)("g",{children:[f&&(0,hu.jsx)("rect",{x:0,y:Math.min(v,b),width:r.width||0,height:Math.abs(b-v),fill:p,fillOpacity:m}),x.map((e,t)=>{const n=hn(e,r),i=fn(e,r);return null==n||null==i?null:(0,hu.jsx)("circle",{cx:n,cy:i,r:y,fill:g,fillOpacity:.7,stroke:g,strokeWidth:1.5},"anomaly-"+t)}),e.label&&(0,hu.jsx)("text",{x:(r.width||0)-4,y:Math.min(v,b)-4,textAnchor:"end",fill:p,fontSize:11,children:e.label})]},"ann-"+n)}case"forecast":{const t=r.data||[];if(3>t.length)return null;const o=r.xAccessor||"x",a=r.yAccessor||"y",s=r.scales?.x??r.scales?.time,l=r.scales?.y??r.scales?.value;if(!s||!l)return null;const c=t.map(e=>[e[o],e[a]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>c.length)return null;let u;if("polynomial"===(e.method||"linear")){const t=dn(c,e.order||2).equation;u=e=>t.reduce((t,n,r)=>t+n*Math.pow(e,r),0)}else{const e=function(e){const t=e.length;let n=0,r=0,i=0,o=0;for(const[t,a]of e)n+=t,r+=a,i+=t*t,o+=t*a;const a=t*i-n*n;if(1e-12>Math.abs(a))return null;const s=(t*o-n*r)/a,l=(r-s*n)/t;return e=>l+s*e}(c);if(!e)return null;u=e}const d=c.length,{se:h,meanX:f,ssX:p}=function(e,t){const n=e.length,r=e.map(([e,n])=>n-t(e)).reduce((e,t)=>e+t*t,0),i=Math.sqrt(r/Math.max(n-2,1)),o=e.reduce((e,t)=>e+t[0],0)/n,a=e.reduce((e,t)=>e+(t[0]-o)**2,0);return{se:i,meanX:o,ssX:a}}(c,u),m=.99>(i=e.confidence??.95)?.95>i?.9>i?1:1.645:1.96:2.576,g=e.steps??5,y=c[d-1][0],v=(y-c[0][0])/Math.max(d-1,1),b=[];for(let e=1;g>=e;e++)b.push(y+e*v);const x=[];for(const e of b){const t=u(e),n=h*Math.sqrt(1+1/d+(p>0?(e-f)**2/p:0))*m;x.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const w=`M${x.map(e=>`${s(e.x)},${l(e.yUpper)}`).join(" L")} L${x.slice().reverse().map(e=>`${s(e.x)},${l(e.yLower)}`).join(" L")} Z`,k=x.map(e=>`${s(e.x)},${l(e.yCenter)}`).join(" "),S=`${s(y)},${l(u(y))}`,M=e.strokeColor||"#6366f1";return(0,hu.jsxs)("g",{children:[(0,hu.jsx)("path",{d:w,fill:e.fill||"#6366f1",fillOpacity:e.fillOpacity??.15,stroke:"none"}),(0,hu.jsx)("polyline",{points:`${S} ${k}`,fill:"none",stroke:M,strokeWidth:e.strokeWidth??2,strokeDasharray:e.strokeDasharray??"6,3"}),e.label&&x.length>0&&(0,hu.jsx)("text",{x:s(x[x.length-1].x)+4,y:l(x[x.length-1].yCenter)-4,fill:M,fontSize:11,children:e.label})]},"ann-"+n)}case"widget":{let i,o;if(null!=e.px&&null!=e.py)i=e.px,o=e.py;else{const t=gn(e,n,r);if(!t)return null;i=t.x,o=t.y}if(!yn(i,o,r))return null;const a=e.dx??0,s=e.dy??0,l=e.width??32,c=e.height??32,u=e.content??(0,hu.jsx)("span",{style:{fontSize:18,cursor:"default"},title:e.label||"Info",children:"ℹ️"});return(0,hu.jsx)("foreignObject",{x:i+a-l/2,y:o+s-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:(0,hu.jsx)("div",{...Zt(e,t),style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+n)}case"text":{const t=gn(e,n,r);if(!t)return null;const{x:i,y:o}=t,a=i+(e.dx||0),s=o+(e.dy||0),l=e.color||"var(--semiotic-text, #333)",c=(0,hu.jsx)("text",{x:a,y:s,fill:l,fontSize:e.fontSize||11,opacity:e.opacity,strokeDasharray:e.strokeDasharray,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:e.label});return!0!==e._redundantConnector?eu.cloneElement(c,{key:"ann-text-"+n}):(0,hu.jsxs)("g",{opacity:e.opacity,strokeDasharray:e.strokeDasharray,children:[(0,hu.jsx)("line",{x1:i,y1:o,x2:a,y2:s,stroke:l,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),eu.cloneElement(c,{opacity:void 0,strokeDasharray:void 0})]},"ann-text-"+n)}case"frame-text":return(0,hu.jsx)(An,{annotation:e,width:r.width||0,height:r.height||0},"ann-frame-text-"+n);case"category-highlight":{const t=e.category;if(null==t)return null;const i=e=>"function"==typeof e&&"function"==typeof e.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(t+"");if(null==c)return null;const u=l.bandwidth(),d=e.color||"var(--semiotic-primary, #4589ff)",h=e.opacity??.15,f=e.label;return(0,hu.jsxs)("g",(r.projection?"vertical"===r.projection:l===a)?{children:[(0,hu.jsx)("rect",{x:c,y:0,width:u,height:r.height||0,fill:d,fillOpacity:h}),f&&(0,hu.jsx)(Kt,{x:c+u/2,y:16,textAnchor:"middle",fill:d,fontSize:12,fontWeight:"bold",text:f,background:e.labelBackground??"none"})]}:{children:[(0,hu.jsx)("rect",{x:0,y:c,width:r.width||0,height:u,fill:d,fillOpacity:h}),f&&(0,hu.jsx)(Kt,{x:12,y:c+u/2,dominantBaseline:"middle",fill:d,fontSize:12,fontWeight:"bold",text:f,background:e.labelBackground??"none"})]},"ann-"+n)}default:return null}var i,o,a}}(0,C),M,i)},[v,S,M,t,n,j,C,A]),N=a||s||l||u||y||P&&P.length>0,E=(0,Xc.useId)(),{titleId:I,descId:T,labelledBy:D}=function(e){const t=(e+"").replace(/[^a-zA-Z0-9_-]/g,"_"),n=/^[A-Za-z_]/.test(t)?t:"c"+t,r=n+"-semiotic-title",i=n+"-semiotic-desc";return{titleId:r,descId:i,labelledBy:`${r} ${i}`}}(c||w||E);return N?(0,Pu.jsxs)("svg",{role:"img","aria-labelledby":D,width:r,height:i,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[(0,Pu.jsx)("title",{id:I,children:Qn(s,"Geographic chart")}),(0,Pu.jsx)("desc",{id:T,children:Jn(s,l,{familyPhrase:"geographic data visualization",fallback:"geographic data visualization"})}),(0,Pu.jsxs)("g",{transform:"translate("+o.left+","+o.top+")",children:[P,y]}),(0,Pu.jsx)(Kn,{title:s,totalWidth:r,marginTop:o.top}),Zn({legend:u,totalWidth:r,totalHeight:i,margin:o,legendPosition:m,title:s,legendLayout:g,legendHoverBehavior:d,legendClickBehavior:h,legendHighlightedCategory:f,legendIsolatedCategories:p})]}):null}function tr(e,t="#4e79a7"){return bn(e)?e.background&&"transparent"!==e.background?e.background:t:e&&"string"==typeof e?e:t}function nr(e){if(!1!==e?.interactive)return e?.style?.cursor}function rr(e,t){if(!e)return;const n=t??"";e.style.cursor!==n&&(e.style.cursor=n)}function ir(e,t,n){const r=nr(t);return r&&null!=e&&!1!==e?(0,Tu.jsx)("g",{style:{cursor:r},"data-semiotic-mark-cursor":r,children:e},n):e}function or(e,t,n,r){const i=e.getContext("2d");if(!i)return null;const{effectiveDprX:o,effectiveDprY:a}=function(e,t,n){const r=Math.round(t[0]*n),i=Math.round(t[1]*n),o=0===t[0]?n:r/t[0],a=0===t[1]?n:i/t[1],s=t[0]+"px",l=t[1]+"px";return e.style.width!==s&&(e.style.width=s),e.style.height!==l&&(e.style.height=l),e.width!==r&&(e.width=r),e.height!==i&&(e.height=i),{effectiveDprX:o,effectiveDprY:a}}(e,t,r);return i.setTransform(o,0,0,a,0,0),i.translate(n.left,n.top),i}function ar(e,t){if("undefined"==typeof window)return 1;const n=window.devicePixelRatio||1,r="undefined"!=typeof window&&("function"==typeof window.matchMedia&&window.matchMedia("(pointer: coarse)").matches||768>Math.min(window.innerWidth||1/0,window.innerHeight||1/0))?2:3,i="number"==typeof e&&e>0?e:r;if(!t)return Math.max(1,Math.min(n,i));const[o,a]=t,s=Math.min(Math.sqrt(8388608/(o*a)),16384/Math.max(o,a));return Math.max(1>s?0:1,Math.min(n,i,s))}function sr(e){const{cancelRender:t,dirtyRef:n,frameRuntime:r,manageFrameRuntime:i,maxDevicePixelRatio:o,scheduleRender:a}=e,s=(0,Hu.useRef)(null),l=(0,Hu.useRef)(null),c=(0,Hu.useRef)(!1),u=(0,Hu.useRef)(!1),d=(0,Hu.useRef)(!1);return function(e){const{hydrated:t,wasHydratingFromSSR:n,storeRef:r,dirtyRef:i,renderFnRef:o,cancelRender:a,cleanup:s}=e;Ou(()=>{const e=r.current;t&&n&&e?.cancelIntroAnimation?.(),!n&&e?.sceneNodes&&e.sceneNodes.length>0&&e?.markStylePaintPending?e.markStylePaintPending():i.current=!0,a?.(),o.current()},[t,n]);const l=(0,_u.useRef)(s);l.current=s,(0,_u.useEffect)(()=>()=>l.current?.(),[])}({hydrated:e.hydrated,wasHydratingFromSSR:e.wasHydratingFromSSR,storeRef:e.storeRef,dirtyRef:e.dirtyRef,renderFnRef:e.renderFnRef,cancelRender:e.cancelRender,cleanup:e.cleanup}),(0,Hu.useEffect)(()=>{if(!1!==i)return r.subscribe(()=>{r.isActive?(n.current=!0,a()):t()})},[t,n,r,i,a]),(0,Hu.useEffect)(()=>function(){function e(){n||(r(),t=null,c.current=!0,a(),queueMicrotask(()=>{n||i()}))}if("undefined"==typeof window||"function"!=typeof window.matchMedia)return()=>{};let t=null,n=!1;const r=()=>{t&&("function"==typeof t.removeEventListener?t.removeEventListener("change",e):"function"==typeof t.removeListener&&t.removeListener(e))},i=()=>{const n=`(resolution: ${window.devicePixelRatio||1}dppx)`;t=window.matchMedia(n),t.media.includes("resolution")?"function"==typeof t.addEventListener?t.addEventListener("change",e):"function"==typeof t.addListener&&t.addListener(e):t=null};return i(),()=>{n=!0,r(),t=null}}(),[a]),(0,Hu.useEffect)(()=>{d.current?(c.current=!0,a()):d.current=!0},[o,a]),(0,Hu.useEffect)(()=>{!u.current&&(u.current=!0,e.skipInitialCanvasPaintInvalidation)||(e.canvasPaintInvalidator?e.canvasPaintInvalidator():e.dirtyRef.current=!0,e.scheduleRender())},e.canvasPaintDependencies),{canvasRef:s,interactionCanvasRef:l,resolutionDirtyRef:c}}function lr({children:e,size:t,margin:n,backdropFill:r,overflowVisible:i=!1}){return e||r?(0,$u.jsxs)("svg",{style:{position:"absolute",left:0,top:0,width:t[0],height:t[1],pointerEvents:"none",overflow:i?"visible":void 0},children:[r&&"transparent"!==r?(0,$u.jsx)("rect",{className:"stream-frame-background__backdrop",x:0,y:0,width:t[0],height:t[1],fill:r}):null,(0,$u.jsx)("g",{transform:`translate(${n.left},${n.top})`,children:e})]}):null}function cr(e,t){const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const r of n){if(!Object.prototype.hasOwnProperty.call(t,r))return!1;if(!Object.is(e[r],t[r]))return!1}return!0}function ur(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(!Object.is(e[n],t[n]))return!1;return!0}function dr(e){if(null===e||"object"!=typeof e)return!1;if(Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}function hr(e){const{background:t,hasBackgroundGraphics:n=!1,themeBackground:r=""}=e;return"transparent"===t?null:n?t||null:t||(r&&"transparent"!==r?r:"")||null}function fr({hoverPoint:e}){let t="";if(e){const n=e.data||e;t="object"==typeof n?"Data point: "+Object.entries(n).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Data point: "+n}return(0,Yu.jsx)("div",{"aria-live":"polite","aria-atomic":"true",style:Xu,children:t})}function pr(e){const t={};if(null==e||"object"!=typeof e)return t;for(const[n,r]of Object.entries(e))n.startsWith("_")||null!=r&&""!==r&&("number"==typeof r?Number.isFinite(r)&&(t[n]=r):"string"==typeof r?t[n]=r:"boolean"==typeof r?t[n]=r+"":r instanceof Date&&(t[n]=r.toISOString().slice(0,10)));return t}function mr(e){return e&&"object"==typeof e?e:{}}function gr(e){return mr(e.accessibility).tableFields??e.accessibleDatum??e.datum}function yr({accessibleTable:e,children:t}){return"object"!=typeof e?t:"undefined"==typeof document?null:(0,Ku.jsx)(Gu.Suspense,{fallback:null,children:(0,Ku.jsx)(Qu,{target:e.portalTarget,children:t})})}function vr(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e){if(null===t?.datum)continue;const e=t.type+"";n[e]=(n[e]||0)+1}if(0===Object.keys(n).length)return t+", empty";const 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((e,t)=>{const n=o.indexOf(e),r=o.indexOf(t);return(-1===n?999:n)-(-1===r?999:r)});for(const e of a)r.push(`${n[e]} ${i[e]||e}`);return`${t}, ${r.join(", ")}`}function br({scene:e,chartType:t,tableId:n,chartTitle:r}){const[i,o]=Gu.useState(!1),[a,s]=Gu.useState(5),l=Vu.useContext(Uu),c=l?.visible??!1,u=i||c,d=Gu.useRef(null),h=r?"Data summary for "+r:n?`Data summary for ${t} ${n}`:"Data summary for "+t;Gu.useEffect(()=>{u||s(5)},[u]);const f=Gu.useCallback(e=>{e.target===e.currentTarget&&(i||c||o(!0))},[i,c]),p=Gu.useCallback(e=>{c||d.current?.contains(e.relatedTarget)||o(!1)},[c]);if(!e||0===e.length)return n?(0,Ku.jsx)("span",{id:n,tabIndex:-1,style:Xu}):null;if(!u)return(0,Ku.jsx)("div",{id:n,className:ed,tabIndex:-1,onFocus:f,style:Xu,role:"region","aria-label":h,children:(0,Ku.jsxs)("button",{type:"button",onClick:()=>o(!0),style:nd,children:["View data summary (",e.length," elements)"]})});const m=function(e){const t=[];if(!Array.isArray(e))return t;const n=e.some(e=>e&&("line"===e.type||"area"===e.type));for(const r of e)if(r&&"object"==typeof r&&null!==r.datum)try{switch(r.type){case"point":if(n)break;t.push({label:"Point",values:pr(gr(r))});break;case"line":case"area":{const e=gr(r),n=Array.isArray(e)?e:[],i="line"===r.type?"Line point":"Area point";for(const e of n)t.push({label:i,values:pr(e)});break}case"rect":{const e=gr(r),n=null!=e&&"object"==typeof e?e:{},i=n.category??r.group??"",o=n.value??n.__aggregateValue??n.total,a=pr(n);null==a.category&&""!==i&&(a.category=i+""),null==a.value&&null!=o&&(a.value="number"==typeof o||"string"==typeof o?o:o+""),t.push({label:"Bar",values:a});break}case"heatcell":{const e=pr(gr(r));null==e.value&&"number"==typeof r.value&&Number.isFinite(r.value)&&(e.value=r.value),t.push({label:"Cell",values:e});break}case"wedge":{const e=gr(r),n=pr(e);if(null==n.category){const t=mr(e),r=t.category??t.label;null!=r&&(n.category=r+"")}t.push({label:"Wedge",values:n});break}case"circle":t.push({label:"Node",values:pr(gr(r))});break;case"arc":t.push({label:"Arc",values:pr(gr(r))});break;case"candlestick":t.push({label:"Candlestick",values:pr(gr(r))});break;case"geoarea":{const e=mr(gr(r)),n=pr(e);if(null==n.name){const t=mr(e.properties).name??e.name;null!=t&&(n.name=t+"")}t.push({label:"Region",values:n});break}}}catch{}return t}(e),g=function(e){const t=new Map;for(const n of e??[])for(const[e,r]of Object.entries(n?.values??{})){if(null==r||""===r)continue;let n=t.get(e);if(n||(n={count:0,min:1/0,max:-1/0,sum:0,strings:new Set},t.set(e,n)),"number"==typeof r){if(!Number.isFinite(r))continue;n.count++,n.sum+=r,n.min>r&&(n.min=r),r>n.max&&(n.max=r)}else"object"!=typeof r&&"function"!=typeof r&&n.strings.add(r+"")}return Array.from(t,([e,t])=>{if(t.count)return{name:e,count:t.count,numeric:!0,min:t.min,max:t.max,mean:t.sum/t.count};const n=Array.from(t.strings);return{name:e,count:n.length,numeric:!1,uniqueValues:n.slice(0,5)}}).filter(e=>e.count>0)}(m),y=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${Zu(e.min)} to ${Zu(e.max)}, mean ${Zu(e.mean)}.`);else{const t=e.uniqueValues,r=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${r}.`)}return n.join(" ")}(m.length,g),v=Math.min(a,m.length),b=m.slice(0,v),x=m.length-v,w=new Set;for(const e of b)for(const t of Object.keys(e.values))w.add(t);const k=Array.from(w);return(0,Ku.jsxs)("div",{ref:d,id:n,className:td,tabIndex:-1,onBlur:p,style:rd,role:"region","aria-label":h,children:[(0,Ku.jsx)("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{c&&l&&l.setVisible(!1),o(!1)},"aria-label":"Close data summary",style:od,children:"×"}),(0,Ku.jsx)("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:id,children:y}),(0,Ku.jsxs)("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+t,style:ad,children:[(0,Ku.jsx)("caption",{className:"semiotic-accessible-data-table-caption",style:cd,children:x>0?`First ${v} of ${m.length} data points`:`All ${m.length} data points`}),(0,Ku.jsx)("thead",{children:(0,Ku.jsxs)("tr",{children:[(0,Ku.jsx)("th",{style:sd,children:"type"}),k.map(e=>(0,Ku.jsx)("th",{style:sd,children:e},e))]})}),(0,Ku.jsx)("tbody",{children:b.map((e,t)=>(0,Ku.jsxs)("tr",{children:[(0,Ku.jsx)("td",{style:ld,children:e.label}),k.map(t=>{return(0,Ku.jsx)("td",{style:ld,children:(n=e.values[t],null==n||""===n?"—":"number"==typeof n?Number.isNaN(n)?"—":Zu(n):"boolean"==typeof n?n?"true":"false":"object"==typeof n?"—":n+"")},t);var n})]},t))})]}),x>0&&(0,Ku.jsxs)("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>s(e=>e+25),style:ud,children:["Show ",Math.min(25,x)," more"," ",1===x?"row":"rows"," (",x," remaining)"]})]})}function xr({summary:e}){return e?(0,Ku.jsx)("div",{role:"note",style:Xu,children:e}):null}function wr({tableId:e}){return(0,Ku.jsx)("a",{href:"#"+e,style:Xu,onClick:t=>{t.preventDefault();const n=document.getElementById(e);n&&requestAnimationFrame(()=>n.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,Xu)},children:"Skip to data table"})}function kr({active:e,hoverPoint:t,margin:n,size:r,shape:i="circle",width:o,height:a,pathData:s}){if(!e||!t)return null;const l=t.x+n.left,c=t.y+n.top;let u;if("geoarea"!==i&&"path"!==i||!s)if("rect"===i&&null!=o&&null!=a){const e=Math.max(o,4),t=Math.max(a,4);u=(0,hd.jsx)("rect",{x:l-e/2-3,y:c-t/2-3,width:e+6,height:t+6,rx:3,fill:"none",stroke:fd,strokeWidth:2,strokeDasharray:"4,2"})}else u=(0,hd.jsx)("circle","wedge"===i?{cx:l,cy:c,r:12,fill:"none",stroke:fd,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:fd,strokeWidth:2,strokeDasharray:"4,2"});else u=(0,hd.jsx)("g",{transform:`translate(${n.left},${n.top})`,children:(0,hd.jsx)("path",{d:s,fill:"none",stroke:fd,strokeWidth:2.5,strokeDasharray:"6,3"})});return(0,hd.jsx)("svg",{style:{position:"absolute",left:0,top:0,width:r[0],height:r[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}function Sr({chrome:e="default",className:t="",style:n,children:r,...i}){const o="default"===e?{...yd,...n}:n;return(0,gd.jsx)("div",{...i,"data-semiotic-tooltip-chrome":!0,className:("semiotic-tooltip "+t).trim(),style:o,children:r})}function Mr(e){return e.ownsChrome=!0,e}function jr(e){if("string"!=typeof e)return null!=e;const t=e.trim().toLowerCase();return!(!t||"transparent"===t||/^rgba\([^)]*,\s*0(?:\.0+)?\s*\)$/.test(t)||/^hsla\([^)]*,\s*0(?:\.0+)?\s*\)$/.test(t))}function Ar(e){if(!md.isValidElement(e))return!1;const t=e.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;const n=e.props,r=n["data-semiotic-tooltip-chrome"];if(null!=r&&!1!==r&&"false"!==r)return!0;const i=n.style;if(i&&"object"==typeof i){if(jr(i.background))return!0;if(jr(i.backgroundColor))return!0}return!1}function Cr({x:e,y:t,containerWidth:n,containerHeight:r,margin:i,children:o,className:a="stream-frame-tooltip",zIndex:s=1}){const l=Number.isFinite(e)&&Number.isFinite(t),c=pd.useRef(null),[u,d]=pd.useState(null);pd.useLayoutEffect(()=>{const e=c.current;if(!e)return;const t=()=>{const t=e.getBoundingClientRect();Number.isFinite(t.width)&&Number.isFinite(t.height)&&d(e=>e&&.5>Math.abs(e.width-t.width)&&.5>Math.abs(e.height-t.height)?e:{width:t.width,height:t.height})};if(t(),"undefined"==typeof ResizeObserver)return;const n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[a,n,r,l]);let h;h=u?`translate(${u.width+12>n-e?"calc(-100% - 12px)":"12px"}, ${u.height+12>r-t?"calc(-100% - 4px)":"4px"})`:`translate(${e>.7*n?"calc(-100% - 12px)":"12px"}, ${.3*r>t?"4px":"calc(-100% - 4px)"})`;const f=Ar(o),p=f?null:yd;return l?(0,bd.jsx)("div",{ref:c,className:f?a:(a+" semiotic-tooltip").trim(),style:{...p||{},position:"absolute",left:i.left+e,top:i.top+t,transform:h,pointerEvents:"none",zIndex:s,width:"max-content"},children:o}):null}function Rr(e){switch(e){case"monotoneX":return kd.curveMonotoneX;case"monotoneY":return kd.curveMonotoneY;case"cardinal":return kd.curveCardinal;case"catmullRom":return kd.curveCatmullRom;case"step":return kd.curveStep;case"stepBefore":return kd.curveStepBefore;case"stepAfter":return kd.curveStepAfter;case"basis":return kd.curveBasis;case"natural":return kd.curveNatural;default:return null}}function Lr(e,t,n){if(null==t)return n;if(bn(t)){const r=function(e,t){const n=e.background??"transparent",r=e.stroke??"#000",i="transparent"===n||"none"===n?n:Pt(t,n)||n,o=Pt(t,r)||r||"#000",a="undefined"!=typeof window&&window.devicePixelRatio||1,s=`${xn(e)}|${i}|${o}@${a}`,l=au.get(s);if(void 0!==l)return l;const c=function(e={},t){const{background:n="transparent",stroke:r="#000",lineWidth:i=1.5,spacing:o=6,angle:a=45}=e,s={background:n,stroke:r,lineWidth:i,spacing:o,angle:a},l=Math.max(8,Math.ceil(2*o));let c;try{c=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(iu||(iu=document.createElement("canvas")),iu.width=e,iu.height=e,iu)}(l)}catch{return vn(s)}const u=c.getContext("2d");if(!u)return vn(s);n&&"transparent"!==n?(u.fillStyle=n,u.fillRect(0,0,l,l)):u.clearRect(0,0,l,l),u.strokeStyle=r,u.lineWidth=i,u.lineCap="square";const d=a*Math.PI/180;if(45===a||-45===a){const e=a>0?1:-1;for(let t=-l;2*l>=t;t+=o)u.beginPath(),u.moveTo(t,0),u.lineTo(t+e*l,l),u.stroke()}else{u.save(),u.translate(l/2,l/2),u.rotate(d);const e=2*l;for(let t=-e;e>=t;t+=o)u.beginPath(),u.moveTo(-e,t),u.lineTo(e,t),u.stroke();u.restore()}return(t||u).createPattern(c,"repeat")}({background:i,stroke:o,lineWidth:e.lineWidth,spacing:e.spacing,angle:e.angle},t),u=bn(c)?null:c;return au.set(s,u),u}(t,e);return r||t.background&&Pt(e,t.background)||n}return"string"!=typeof t?t:Pt(e,t)||n}function Pr(e,t){if(null==t)return;const n=Lr(e,t,"");return""===n?void 0:n}function Nr(e,t,n,r,i,o,a){const s=t.stops.filter(e=>Number.isFinite(e.offset)&&(null==e.opacity||Number.isFinite(e.opacity)));if(2>s.length)return null;const l=e.createLinearGradient(r,i,o,a);for(const t of s)l.addColorStop(Math.max(0,Math.min(1,t.offset)),Er(e,t,n));return l}function Er(e,t,n){const r=t.color??n,i=Pt(e,r)||r;if(null==t.opacity)return i;const o=Math.max(0,Math.min(1,t.opacity)),[a,s,l]=function(e,t){const n=e.fillStyle,r="#010203";try{e.fillStyle=r,e.fillStyle=t}catch{return e.fillStyle=n,[78,121,167]}const i=e.fillStyle;if(e.fillStyle=n,"string"!=typeof i)return[78,121,167];if(i.toLowerCase()===r&&t.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]}(e,i);return`rgba(${a},${s},${l},${o})`}function Ir(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Tr(e,t,n,r=.35){Ir(t)&&(e.globalAlpha=t._pulseIntensity*r,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",n?e.fill(n):e.fill())}function Dr(e,t,n){let r=n;for(const n of t)"lesser"===n.thresholdType?n.value>e&&(r=n.color):e>n.value&&(r=n.color);return r}function zr(e,t,n,r){if(2>e.length||t.length!==e.length||0===n.length)return[];const i=[],o=(e,t,n)=>{const r=i[i.length-1];r?.color===e?r.path.push(n):i.push({color:e,path:[t,n]})};for(let i=1;e.length>i;i++){const[a,s]=e[i-1],[l,c]=e[i],u=t[i-1],d=t[i]-u,h=[0,...0===d?[]:n.map(({value:e})=>(e-u)/d).filter(e=>e>0&&1>e&&Number.isFinite(e)).sort((e,t)=>e-t).filter((e,t,n)=>0===t||e!==n[t-1]),1];for(let e=1;h.length>e;e++){const t=h[e-1],i=h[e];o(Dr(u+d*((t+i)/2),n,r),[a+(l-a)*t,s+(c-s)*t],[a+(l-a)*i,s+(c-s)*i])}}return i}function _r(e,t,n,r,i,o){if(2>t.length)return;const a=[0];for(let e=1;t.length>e;e++){const n=t[e][0]-t[e-1][0],r=t[e][1]-t[e-1][1];a.push(a[e-1]+Math.sqrt(n*n+r*r))}const s=a[a.length-1];if(0===s)return;const l=Math.min(.2*s,40);e.strokeStyle=n,e.lineWidth=r,e.lineCap=o;for(let n=0;t.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),e.globalAlpha=Math.max(0,o),e.beginPath(),e.moveTo(t[n][0],t[n][1]),e.lineTo(t[n+1][0],t[n+1][1]),e.stroke()}}function Or(e,t,n,r,i){if(0>=t.size)return;const o=t.glyph;if(!o||!o.parts?.length)return;const a=wt(o,t.size);if(0>=a.scale)return;const s=(t.style.opacity??1)*(t._decayOpacity??1);if(0>=s)return;const l=t=>{const n=Lr(e,t,t);return"string"==typeof n?n:t},c=t.color??("string"==typeof t.style.fill?t.style.fill:void 0);e.save(),e.translate(n,r),t.rotation&&e.rotate(t.rotation),e.translate(a.offsetX,a.offsetY),e.scale(a.scale,a.scale),e.globalAlpha=i*s*(t.style.fillOpacity??1);const u=jt(o,t.fraction??1,t.fractionStart??0,t.fractionDirection??"horizontal");u&&t.ghostColor&&Ct(e,o,c,t.accent,t.ghostColor,l),u&&(e.beginPath(),e.rect(u.x,u.y,u.width,u.height),e.clip()),Ct(e,o,c,t.accent,void 0,l),e.restore()}function Fr([e,t,n]){const r=1<<n;return[e-Math.floor(e/r)*r,t,n]}function Wr(e,t,n,r,i){return"function"==typeof e?e(t,n,r,i):e.replace("{z}",t+"").replace("{x}",n+"").replace("{y}",r+"").replace("{r}",i>1?"@2x":"")}function Br(e){return Number.isFinite(e)?Math.max(1,Math.floor(e)):256}function Hr(e){let t=0;for(let n=1;e.length>n;n++){const r=e[n][0]-e[n-1][0],i=e[n][1]-e[n-1][1];t+=Math.sqrt(r*r+i*i)}return t}function $r(e,t){let n=0;for(let r=1;e.length>r;r++){const i=e[r][0]-e[r-1][0],o=e[r][1]-e[r-1][1],a=Math.sqrt(i*i+o*o);if(n+a>=t||r===e.length-1){const s=a>0?(t-n)/a:0,l=a>.001?a:1;return{x:e[r-1][0]+i*s,y:e[r-1][1]+o*s,nx:-o/l,ny:i/l}}n+=a}const r=e[e.length-1];return{x:r[0],y:r[1],nx:0,ny:0}}function qr(e,t){return"touch"===t?Math.max(e,24):e}function Gr(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:Rd.createElement(Rd.Fragment,null,...t)}function Vr({value:e,children:t}){const n=(vd??(vd=Ld.createContext(null)),vd);return(0,Pd.jsx)(n.Provider,{value:e,children:t})}function Ur(e,t){return null!=e?(0,Pd.jsx)(Vr,{value:t,children:e}):e}function Yr(e,t){const n="function"==typeof e?e(t.datum??null,t):e;return(r=n)&&"object"==typeof r&&"string"==typeof r.id&&"function"==typeof r.cacheKey&&"function"==typeof r.drawCanvas&&"function"==typeof r.renderStaticSVG?n:void 0;var r}function Xr(e,t){if("undefined"!=typeof process&&"production"===process.env?.NODE_ENV)return;const n=`${e}:${t}`;Nd.has(n)||(Nd.add(n),console.warn(`[Semiotic] Render backend "${e}" does not support scene node "${t}"; using the built-in renderer.`))}function Zr(e){if(!e)return;const t=[];for(const n of e)if("point"===n.type)t.push(n);else if("glyph"===n.type){const e=n,r=At(e.glyph,e.size);t.push({pointId:e.pointId,x:e.x+r.centerDx,y:e.y+r.centerDy,r:r.radius})}return t}function Kr(e,t){for(const n of t){const t=e.find(e=>e.lower===n);if(t)return t}}function Qr(e,t={}){if(!e||"object"!=typeof e)return{entries:[]};const n=t.maxEntries??6,r=!1!==t.skipPositional,i=[];for(const[t,n]of Object.entries(e)){if(t.startsWith("_"))continue;if("data"===t)continue;const e=t.toLowerCase();if(r&&Dd.has(e))continue;if(null==n)continue;const o=typeof n;("string"===o||"number"===o||"boolean"===o||n instanceof Date)&&i.push({key:t,lower:e,value:n})}if(0===i.length)return{entries:[]};let o=i.findIndex(e=>Ed.includes(e.lower));const a=o>=0;0>o&&(o=i.findIndex(e=>"id"===e.lower)),0>o&&(o=i.findIndex(e=>"string"==typeof e.value));const s=0>o?void 0:i[o],l=i.filter((e,t)=>t!==o&&(!a||"id"!==e.lower)),c=Kr(l,Id),u=Kr(l,Td),d=[];c&&d.push({key:c.key,value:c.value}),u&&d.push({key:u.key,value:u.value});for(const e of l){if(d.length>=n)break;Id.includes(e.lower)||Td.includes(e.lower)||d.push({key:e.key,value:e.value})}return{titleKey:s?.key,title:s?.value,entries:d}}function Jr(e,t){return"function"==typeof t?t(e):e[t]}function ei(e,t){if(t)return t(e);if(null==e)return"";if("number"==typeof e){if(!Number.isFinite(e))return e+"";const t=Number.isInteger(e)?e:parseFloat(e.toPrecision(6));return Math.abs(t)>9999?t.toLocaleString():t+""}if(e instanceof Date)return e.toLocaleDateString();if("object"==typeof e&&null!==e){if(void 0!==e.id)return e.id+"";if(void 0!==e.name)return e.name+"";try{return JSON.stringify(e)}catch{return Array.isArray(e)?`[Array(${e.length})]`:"[Object]"}}return e+""}function ti(e={}){const{fields:t,title:n,format:r,style:i={},className:o=""}=e;return e=>{if(!e||"object"!=typeof e)return null;let a;const s=[];if(n){const t=Jr(e,n);a=ei(t,r)}if(t&&t.length>0)t.forEach(t=>{let n,i,o;"string"==typeof t?(n=t,i=t,o=r):(n=t.label,i=t.accessor||t.key||"",o=t.format||r);const a=Jr(e,i);s.push({label:n,value:ei(a,o)})});else if(!n){const t=["value","y","name","id","label"];for(const n of t)if(void 0!==e[n]){a=ei(e[n],r);break}if(!a){const t=Object.keys(e).filter(e=>!e.startsWith("_"));t.length>0&&(a=ei(e[t[0]],r))}}return(0,zd.jsxs)(Sr,{className:o,style:i,children:[a&&(0,zd.jsx)("div",{style:{fontWeight:s.length>0?"bold":"normal"},children:a}),s.map((e,t)=>(0,zd.jsxs)("div",{style:{marginTop:0===t&&a?"4px":0},children:[e.label&&(0,zd.jsxs)("span",{children:[e.label,": "]}),e.value]},t))]})}}function ni(e={}){const{fields:t=[],title:n,format:r,style:i={},className:o="",showLabels:a=!0,separator:s=": "}=e;return e=>{if(!e||"object"!=typeof e)return null;const l=[];if(n){const t=Jr(e,n);l.push({value:ei(t,r)})}if(t&&Array.isArray(t)&&t.length>0)t.forEach(t=>{let n,i,o;"string"==typeof t?(n=t,i=t,o=r):(n=t.label,i=t.accessor||t.key||"",o=t.format||r);const s=ei(Jr(e,i),o);l.push({label:a?n:void 0,value:s})});else{const t=Qr(e,{skipPositional:!1});null!=t.title&&l.push({label:void 0,value:ei(t.title,r),bold:!0}),t.entries.forEach(e=>{l.push({label:a?e.key:void 0,value:ei(e.value,r)})})}return Array.isArray(l)&&0!==l.length?(0,zd.jsx)(Sr,{className:("semiotic-tooltip-multiline "+o).trim(),style:i,children:l.map((e,t)=>(0,zd.jsxs)("div",{style:{marginBottom:l.length-1>t?"4px":0,fontWeight:e.bold?"bold":void 0},children:[e.label&&(0,zd.jsxs)("strong",{children:[e.label,s]}),e.value]},t))}):null}}function ri(e){if(!0!==e){if("function"==typeof e){const t=e;return e=>{const n=!0===e?.__semioticHoverData||e&&void 0!==e.data&&"number"==typeof e.x&&"number"==typeof e.y&&e&&("node"===e.type||"edge"===e.type||void 0!==e.nodeOrEdge||void 0!==e.allSeries||void 0!==e.stats||void 0!==e.__chartType);let r=Array.isArray(i=n?e.data??{}:e)?i[0]:i;var i;if(!r)return null;if(("node"===e?.nodeOrEdge&&"number"==typeof r?.x0&&"number"==typeof r?.x1||"edge"===e?.nodeOrEdge&&"number"==typeof r?.sankeyWidth)&&r.data&&"object"==typeof r.data&&(r=r.data),!r)return null;if(n&&(void 0!==e.allSeries||void 0!==e.xValue)){const t={...r};void 0!==e.allSeries&&void 0===t.allSeries&&(t.allSeries=e.allSeries),void 0!==e.xValue&&void 0===t.xValue&&(t.xValue=e.xValue),r=t}const o=t(r);return null==o?null:Ar(o)?o:(0,zd.jsx)(Sr,{children:o})}}if(!1===e||void 0===e)return!1;if(function(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)&&"mode"in e&&"multi"===e.mode}(e)){if("function"==typeof e.content)return ri(e.content);"undefined"!=typeof process&&"production"!==process.env?.NODE_ENV&&console.warn('[semiotic] tooltip={{ mode: "multi" }} reached normalizeTooltip without a chart that wires tooltipMode. Use a line/area-family chart with multi support, or pass frameProps.tooltipMode: "multi" to StreamXYFrame.');const t=ni();return ri(e=>t(e))}if("object"==typeof e&&null!==e&&("fields"in e||"title"in e)){const t=ti(e);return ri(e=>t(e))}if("multi"===e){"undefined"!=typeof process&&"production"!==process.env?.NODE_ENV&&console.warn('[semiotic] tooltip="multi" reached normalizeTooltip on a single-tooltip chart. Rendering multi-field content as a backward-compatible fallback.');const e=ni();return ri(t=>e(t))}return ti()}}function ii({data:e}){if(!e)return null;if(e.properties)return(0,_d.jsx)("div",{className:"semiotic-tooltip",style:yd,children:(0,_d.jsx)("div",{style:{fontWeight:600},children:e.properties.name||e.properties.NAME||e.properties.id||"Feature"})});const t=null!=e.data?e.data:e;if(!t||"object"!=typeof t)return null;const n=Qr(t),r=null!=n.title?n.title+"":null;return null==r&&0===n.entries.length?null:(0,_d.jsxs)("div",{className:"semiotic-tooltip",style:yd,children:[null!=r&&(0,_d.jsx)("div",{style:{fontWeight:600,marginBottom:n.entries.length?2:0},children:r}),n.entries.map(e=>{return(0,_d.jsxs)("div",{children:[(0,_d.jsxs)("span",{style:{opacity:.7},children:[e.key,": "]}),(0,_d.jsx)("span",{style:{fontWeight:600},children:(t=e.value,null==t?"–":"number"==typeof t?Math.abs(t)>9999?t.toLocaleString():t+"":t instanceof Date?t.toLocaleDateString():t+"")})]},e.key);var t})]})}function oi(){if(null!==Fd)return Fd;if("undefined"==typeof window)return!1;const e="function"==typeof window.matchMedia&&window.matchMedia("(pointer: coarse)").matches,t="undefined"!=typeof navigator&&"number"==typeof navigator.hardwareConcurrency&&4>=navigator.hardwareConcurrency,n="undefined"!=typeof navigator&&"number"==typeof navigator.deviceMemory&&4>=navigator.deviceMemory;return Fd=e||t||n}function ai(){return oi()?12:30}function si(e){return"string"==typeof e?e:"object"==typeof e&&e&&"type"in e?e.type:null}function li(e){return e?e.getContext("2d"):null}function ci(e){const t=e.pointer.clientX-e.canvasRect.left-e.margin.left,n=e.pointer.clientY-e.canvasRect.top-e.margin.top;if(0>t||t>e.width||0>n||n>e.height)return{kind:"outside"};e.hitCanvasRef.current||(e.hitCanvasRef.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const r=li(e.hitCanvasRef.current);if(!r)return{kind:"unavailable"};const i=Rt(e.scene,t,n,qr(30,e.pointer.pointerType),r,e.pointQuadtree,e.maxPointRadius,qr(6,e.pointer.pointerType));if(!i)return{kind:"miss"};const{node:o}=i,a=o.datum,s=Array.isArray(a)?null:a?.properties?a:a?.data||a,l="point"===o.type?o.x:"geoarea"===o.type?o.centroid[0]:t,c="point"===o.type?o.y:"geoarea"===o.type?o.centroid[1]:n;return{kind:"hit",node:o,hover:{...s,...s?.properties||{},data:s,properties:s?.properties,__semioticHoverData:!0,x:l,y:c}}}function ui(e){const{onObservation:t,datum:n,x:r=0,y:i=0,chartType:o,chartId:a,context:s,timestamp:l=Date.now()}=e;t&&(n?(t({type:"hover",datum:n,x:r,y:i,timestamp:l,chartType:o,chartId:a}),"focus"===s?.type&&t({type:"focus",datum:n,inputType:"touch"===s.inputType?"pointer":s.inputType,timestamp:l,chartType:o,chartId:a})):t({type:"hover-end",timestamp:l,chartType:o,chartId:a}))}function di(e){const{onObservation:t,datum:n,x:r=0,y:i=0,chartType:o,chartId:a,context:s,timestamp:l=Date.now()}=e;t&&(n?(t({type:"click",datum:n,x:r,y:i,timestamp:l,chartType:o,chartId:a}),"activate"===s?.type&&t({type:"activate",datum:n,inputType:s.inputType,timestamp:l,chartType:o,chartId:a})):t({type:"click-end",timestamp:l,chartType:o,chartId:a}))}function hi(e){const t=e.datum;return{...t||{},...t?.properties||{},data:t,properties:t?.properties,x:e.x,y:e.y,__semioticHoverData:!0}}function fi(e,t,n,r){return"function"==typeof e?e({size:t,margin:n,scales:r}):e}function pi({graphics:e,size:t,margin:n,readScales:r,tracker:i}){return(0,Gd.useSyncExternalStore)(i.subscribe,i.getSnapshot,i.getSnapshot),qd.createElement(qd.Fragment,null,fi(e,t,n,r()))}function mi(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField,seriesField:e.seriesField}:null}function gi(e,t,n,r){if(!t)return e;const i=(i,...o)=>{const a={...e(i,...o)};if(t.isActive)if(t.predicate(r?r(i):i))n?.selectedStyle&&Object.assign(a,n.selectedStyle);else{const e=n?.unselectedOpacity??Qd;a.opacity=e,a.fillOpacity=e,a.strokeOpacity=e,n?.unselectedStyle&&Object.assign(a,n.unselectedStyle)}return a};return o=i,a=[i],a?.length?(Object.defineProperty(o,$d,{configurable:!0,enumerable:!1,value:a}),o):o;var o,a}function yi(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function vi(e,t){const{when:n}=e,r=t.width,i=t.height,o=function(e){if("number"==typeof e.height&&e.height>0)return e.width/e.height}(t),a=function(e){if("number"==typeof e.height&&e.height>0)return e.height>e.width?"portrait":"landscape"}(t);return!("number"==typeof n.minWidth&&n.minWidth>r||"number"==typeof n.maxWidth&&r>n.maxWidth||"number"==typeof n.minHeight&&("number"!=typeof i||n.minHeight>i)||"number"==typeof n.maxHeight&&("number"!=typeof i||i>n.maxHeight)||"number"==typeof n.minAspectRatio&&("number"!=typeof o||n.minAspectRatio>o)||"number"==typeof n.maxAspectRatio&&("number"!=typeof o||o>n.maxAspectRatio)||n.orientation&&a!==n.orientation)}function bi(e,t,n=e.responsiveRules){if(!Array.isArray(n)||0===n.length)return{props:e,matches:[]};const r=n.map((e,t)=>({rule:e,index:t})).filter(e=>vi(e.rule,t)).sort((e,t)=>("number"==typeof e.rule.priority?e.rule.priority:e.index)-("number"==typeof t.rule.priority?t.rule.priority:t.index));return{props:r.reduce((e,t)=>function(e,t){const n={...e,...t};for(const r of["margin","frameProps","mobileSemantics","style"])yi(e[r])&&yi(t[r])&&(n[r]={...e[r],...t[r]});return"string"==typeof e.className&&"string"==typeof t.className&&(n.className=`${e.className} ${t.className}`),n}(e,t.rule.transform),e),matches:r}}function xi(e,t={}){const n=t.mobileSemantics?.interaction,r="number"==typeof n?.targetSize?n.targetSize:"number"==typeof t.mobileSemantics?.minimumHitTarget?t.mobileSemantics.minimumHitTarget:void 0,i="mobile"===t.mode||"number"==typeof t.width&&480>=t.width,o=!!n||void 0!==r,a=e&&"object"==typeof e?e:void 0;if(!1===e||!1===a?.enabled||void 0===e&&!i&&!o)return ih;const s=a??{};return{enabled:!0,tapToSelect:s.tapToSelect??!0,tapToLockTooltip:s.tapToLockTooltip??!0,clearSelection:s.clearSelection??"backgroundTap",targetSize:s.targetSize??r??rh,snap:s.snap??"nearestDatum",brushHandleSize:s.brushHandleSize??rh,standardControls:s.standardControls??!1}}function wi(e){return e.compactMode?e.marginDefaults:ah}function ki(e,t,n){if(!1!==t)return e;const r={...e};return"horizontal"===n?r.left=Math.min(r.left,15):r.bottom=Math.min(r.bottom,15),r}function Si(e,t,n){const r=e.xValue??t?.[n];if(null==r)return null;const i=Number(r);return Number.isFinite(i)?i:null}function Mi(e){let t=e.data||e.datum||e;return Array.isArray(t)&&(t=t[0]),null!=e.xValue&&t&&"object"==typeof t&&!Array.isArray(t)&&null==t.xValue?{...t,xValue:e.xValue}:t||{}}function ji(e){if(!e)return!1;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function Ai(e,t){if(!t)return[];const n=new Set;for(const r of e){const e="function"==typeof t?t(r):r[t];null!=e&&n.add(e+"")}return Array.from(n)}function Ci(e,t){return null!=e&&Object.hasOwn(e,t)}function Ri({data:e,colorBy:t,colorScale:n,showLegend:r,legendPosition:i,userMargin:o,defaults:a={top:50,bottom:60,left:70,right:40},categories:s,additionalLegend:l,chartWidth:c,chartHeight:u,legendLayout:d,frameLegend:h,hasTitle:f=!1,axisChrome:p}){const{legendPosition:m,legendLayout:g}=function(e,t,n){const r=Ci(n,"legendPosition"),i=Ci(n,"legendLayout");return{legendPosition:r?n?.legendPosition??"right":e??"right",legendLayout:i?n?.legendLayout:t}}(i,d,h),y=Ci(h,"legend"),v=(0,lh.useContext)(ch),b=null!==(0,lh.useContext)(uh),x=void 0!==r?r:!v&&!!t,w=!!t&&(x||b),k=(0,sh.useMemo)(()=>w?void 0!==s?s:Ai(e,t):[],[s,t,e,w]);!function(e){const t=(0,lh.useContext)(uh),n=(0,lh.useId)(),r=function(e){const t=new Set,n=[];for(const r of e)t.has(r)||(t.add(r),n.push(r));return n}(e),i=(0,lh.useRef)([]);(function(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0})(i.current,r)||(i.current=r);const o=i.current;dh(()=>{if(t)return()=>t.unregisterCategories(n)},[t,n]),dh(()=>{t&&t.registerCategories(n,o)},[t,n,o])}(b&&t?k:[]);const S=(0,sh.useMemo)(()=>{if(!x||!t)return;const r=function({data:e,colorBy:t,colorScale:n,getColor:r,strokeColor:i,strokeWidth:o,categories:a}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==i&&(n.stroke=i),void 0!==o&&(n.strokeWidth=o),n},type:"fill",items:(void 0!==a?a:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((i,o)=>{const a=e.find("function"==typeof t?e=>t(e)===i:e=>e[t]===i),s=a?r(a,t,n):n?n(i):Cl[o%Cl.length];return{label:i+"",color:s,__semioticCategory:!0}}),label:""}]}}({data:e,colorBy:t,colorScale:n,getColor:Ke,categories:k});return 0!==r.legendGroups.reduce((e,t)=>e+t.items.length,0)?r:void 0},[x,t,e,n,k]),M=(0,sh.useMemo)(()=>y?h?.legend:function(...e){let t;for(const n of e)n&&(t=It(t)&&It(n)?{legendGroups:[...t.legendGroups,...n.legendGroups],legendDistance:n.legendDistance??t.legendDistance}:n);return t}(S,l),[S,l,h?.legend,y]),{hasAxis:j,hasAxisLabel:A,rotatedTicks:C,topAxis:R,leftAxis:L,rightAxis:P}=p??{},N=void 0!==R,E=void 0!==L,I=void 0!==P,{hasAxis:T,hasAxisLabel:D,rotatedTicks:z}=R??{},{hasAxis:_,hasAxisLabel:O}=L??{},{hasAxis:F,hasAxisLabel:W}=P??{},B=(0,sh.useMemo)(()=>{const e="number"==typeof o?{top:o,bottom:o,left:o,right:o}:o??{},t=function(e,t,n=!1){const r={...e};for(const e of t??[])!1!==e.visible||"top"===e.orient&&n||(r[e.orient]=0);return r}(a,h?.axes,f),n=n=>{const r=e[n];return"number"==typeof r?r:t[n]},r={top:n("top"),right:n("right"),bottom:n("bottom"),left:n("left")},i={...r};return M&&(qt(r,{legend:M,position:m,size:[c??600,u??400],hasTitle:f,legendLayout:g,minimumMargin:"bottom"===m?80:"top"===m?50:0,axisChrome:void 0===j?{hasAxis:!0,hasAxisLabel:!0}:{hasAxis:j,hasAxisLabel:A,rotatedTicks:C,topAxis:N?{hasAxis:T,hasAxisLabel:D,rotatedTicks:z}:void 0,leftAxis:E?{hasAxis:_,hasAxisLabel:O}:void 0,rightAxis:I?{hasAxis:F,hasAxisLabel:W}:void 0}}),null!=c&&null!=u&&Dt(r,i,[c,u],m)),r},[a,h?.axes,o,M,m,c,u,g,f,j,A,C,N,T,D,z,E,_,O,I,F,W]);return{legend:M,margin:B,legendPosition:m,legendLayout:g,legendMarginReserved:void 0!==M&&!Ci(h,"margin"),hasAutomaticLegend:void 0!==S}}function Li(e){const t=e.valueRange;return Array.isArray(t)&&2===t.length&&"number"==typeof t[0]&&"number"==typeof t[1]?[t[0],t[1]]:null}function Pi(e,t){return"string"==typeof e.interactionKey?e.interactionKey:`${t[0]}:${t[1]}`}function Ni(){const e=(0,nh.useTheme)(),t=e?.colors?.categorical;return t&&t.length>0?t:void 0}function Ei({selection:e,linkedHover:t,fallbackFields:n=hh,unwrapData:r=!1,onObservation:i,chartType:o,chartId:a,onClick:s,hoverHighlight:l,colorByField:c,mobileInteraction:u}){const d=(0,Zd.useId)(),h=(0,Zd.useMemo)(()=>mi(t,n),[t,n]),f=(0,Zd.useMemo)(()=>"series"===h?.mode?[h.seriesField||c||n[0]].filter(e=>!!e):h?.fields||n,[h,c,n]),p=(0,Jd.useSelection)({name:e?.name||"__unused__",fields:f}),m=(0,Jd.useLinkedHover)({name:h?.name||"hover",fields:f}),g=(0,th.useObservationSelector)(e=>e.pushObservation),y=(0,Zd.useCallback)(e=>{i?.(e),g?.(e)},[i,g]),v=e?{isActive:p.isActive,predicate:p.predicate}:null,[b,x]=(0,Zd.useState)(null),w=(0,Zd.useRef)(!1),k=c||n[0],S=(0,Zd.useMemo)(()=>{if(!l||null==b||!k)return null;const e=b,t=k;return{isActive:!0,predicate:n=>("string"==typeof n[t]?n[t]:(n[t]??"")+"")===e}},[l,b,k]),M=(0,Zd.useCallback)((e,n)=>{const r=!e&&w.current&&!!u?.enabled&&u.tapToLockTooltip;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===h?.mode&&h.xField){const n=Si(e,t,h.xField);null!=n&&(0,eh.setCrosshairPosition)(h.name||"hover",n,d)}"x-position"!==h?.mode&&m.onHover(t)}else"x-position"!==h?.mode||r||(0,eh.clearCrosshairPosition)(h.name||"hover",d),"x-position"===h?.mode||r||m.onHover(null);if(l&&k)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=t?.[k];x(null!=n?n+"":null)}else r||x(null);(i||g)&&ui({onObservation:y,datum:e?Mi(e):null,x:e?.x,y:e?.y,chartType:o||"unknown",chartId:a,context:n})},[t,m,h,d,i,o,a,g,y,l,k,u]),j=(0,Zd.useCallback)((n=!0)=>{w.current=!1,t&&"x-position"!==h?.mode&&m.onHover(null),e&&u?.tapToSelect&&p.clear(),n&&l&&x(null),"x-position"===h?.mode&&((0,eh.unlockCrosshair)(h.name||"hover",d),(0,eh.clearCrosshairPosition)(h.name||"hover",d))},[t,h,m,e,u,p,l,d]),A=(0,Zd.useCallback)((n,r)=>{const c=!!u?.enabled&&(u.tapToLockTooltip||u.tapToSelect),v=!!u?.enabled&&"backgroundTap"===u.clearSelection;if("x-position"===h?.mode&&h.xField&&n){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]);const t=Si(n,e,h.xField);null!=t&&(0,eh.toggleCrosshairLock)(h.name||"hover",t,d)}if(c)if(n){w.current=!0;const r=Mi(n);if(t&&"x-position"!==h?.mode&&m.onHover(r),e&&u?.tapToSelect&&f.length>0){const e={};for(const t of f){const n=r[t];void 0!==n&&(e[t]=[n])}ji(e)&&p.selectPoints(e)}if(l&&k){const e=r?.[k];x(null!=e?e+"":null)}}else v&&j();if(n||v){if(n&&s){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]),s(e,{x:n.x??0,y:n.y??0})}(i||g)&&di({onObservation:y,datum:n?Mi(n):null,x:n?.x,y:n?.y,chartType:o||"unknown",chartId:a,context:r})}},[s,i,g,y,o,a,h,d,u,t,m,e,p,f,l,k,j]);return(0,Zd.useEffect)(()=>{if(!u?.enabled||"undefined"==typeof document)return;const e=e=>{"Escape"===e.key&&w.current&&j()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[u?.enabled,j]),(0,Zd.useEffect)(()=>()=>{w.current&&j(!1)},[j]),(0,Zd.useEffect)(()=>{if("x-position"!==h?.mode)return;const e=h.name||"hover";return()=>{(0,eh.unlockCrosshair)(e,d),(0,eh.clearCrosshairPosition)(e,d)}},[h?.mode,h?.name,d]),{activeSelectionHook:v,hoverSelectionHook:S,customHoverBehavior:M,customClickBehavior:A,crosshairSourceId:d}}function Ii(e,t,n){return function(e,t,n){const r=oh[e||"primary"],i=e&&"primary"!==e||!n?.width?r.width:n.width,o=e&&"primary"!==e||!n?.height?r.height:n.height,a=bi({...t,mode:e},{width:t.width??i,height:t.height??o}).props,s=a.mode||e||"primary",l=oh[s],c="context"===s||"sparkline"===s,u="primary"===s&&n?.width?n.width:l.width;return{mode:s,width:a.width??u,height:a.height??("primary"===s&&n?.height?n.height:l.height),showAxes:a.showAxes??l.showAxes,showGrid:a.showGrid??l.showGrid,enableHover:a.enableHover??(!!a.linkedHover||l.enableHover),showLegend:a.showLegend??l.showLegend,showLabels:a.showLabels??l.showLabels,title:c?void 0:a.title,description:a.description,summary:a.summary,accessibleTable:a.accessibleTable,xLabel:c?void 0:a.xLabel,yLabel:c?void 0:a.yLabel,categoryLabel:c?void 0:a.categoryLabel,valueLabel:c?void 0:a.valueLabel,marginDefaults:ki(l.marginDefaults,a.showCategoryTicks,a.orientation),compactMode:c,mobileInteraction:xi(a.mobileInteraction,{mode:s,width:a.width??u,mobileSemantics:a.mobileSemantics}),mobileSemantics:a.mobileSemantics}}(e,t,n)}function Ti(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return e??((...e)=>({}));const n={};return void 0!==t.stroke&&(n.stroke=t.stroke),void 0!==t.strokeWidth&&(n.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(n.opacity=t.opacity),e?(...t)=>({...e(...t)||{},...n}):(...e)=>({...n})}function Di(e){if(null==e)return()=>{};const t="function"==typeof e?e:t=>t[e];return e=>_i(t(e))}function zi(e,t){const n=Di(t??"value"),r=null==e?void 0:"function"==typeof e?e:t=>t[e];return e=>{const t=r?r(e):void 0;return{value:n(e),category:null==t?void 0:t+""}}}function _i(e){if("number"==typeof e)return Number.isFinite(e)?e:void 0;if("string"==typeof e&&""!==e.trim()){const t=Number(e);return Number.isFinite(t)?t:void 0}}function Oi(e,t,n){const r=null!=e.axis?n[e.axis]:null!=e.field?t[e.field]:n.value;if(void 0!==e.eq&&r!==e.eq)return!1;if(void 0!==e.ne&&r===e.ne)return!1;if(void 0!==e.in&&!e.in.includes(r))return!1;if(void 0===e.gt&&void 0===e.gte&&void 0===e.lt&&void 0===e.lte&&void 0===e.within&&void 0===e.outside)return!0;const i=_i(r);if(void 0===i)return!1;if(void 0!==e.gt&&e.gt>=i)return!1;if(void 0!==e.gte&&e.gte>i)return!1;if(void 0!==e.lt&&i>=e.lt)return!1;if(void 0!==e.lte&&i>e.lte)return!1;if(void 0!==e.within){const[t,n]=e.within;if(t>i||i>n)return!1}if(void 0!==e.outside){const[t,n]=e.outside;if(i>=t&&n>=i)return!1}return!0}function Fi(e,t,n){const r=e.when;return void 0===r||!0===r||!1!==r&&("function"==typeof r?r(t,n):Oi(r,t,n))}function Wi(e,t,n){if(!t||0===t.length)return{};let r={};for(const i of t){if(!Fi(i,e,n))continue;const t="function"==typeof i.style?i.style(e,n):i.style;t&&(r={...r,...t})}return r}function Bi(e,t,n,r=e=>e){const i=e??(()=>({}));return t&&0!==t.length?(e,o)=>{const a=r(e),s={...i(e,o)};return Object.assign(s,Wi(a,t,n(a,o))),s}:i}function Hi({componentName:e,message:t,diagnosticHint:n,width:r,height:i}){return(0,fh.jsx)("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:(0,fh.jsxs)("div",{style:{textAlign:"center",maxWidth:400},children:[(0,fh.jsx)("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:e}),(0,fh.jsx)("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:t}),n&&(0,fh.jsx)("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:n})]})})}function $i({componentName:e,width:t,height:n,children:r}){return(0,yh.jsx)(gh,{fallback:r=>(0,yh.jsx)(Hi,{componentName:e,message:r.message,width:t,height:n}),children:r})}function qi(e,t,n,r){return!1===r||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?(0,yh.jsx)("div",{style:{...bh,width:t,height:n},children:r||"No data available"}):null}function Gi(e,t,n,r){if(!e)return null;if(!1===r)return null;if(null!=r)return(0,yh.jsx)("div",{style:{width:t,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(0,yh.jsx)("div",{style:{width:t,height:n,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:i},(e,n)=>(0,yh.jsx)("div",{className:"semiotic-loading-bar",style:{...xh,position:"absolute",top:s+n*(o+a),left:Math.floor(.1*t),width:30+(37*n+13)%50+"%",height:o,opacity:.5+n%2*.2}},n))})}function Vi(e,t,n,r){if(!vh)return;if(!t||0===t.length)return;if("string"!=typeof r)return;const i=t[0];if(!i||"object"!=typeof i)return;if(r in i)return;const o=Object.keys(i).join(", ");console.warn(`[semiotic] ${e}: ${n} "${r}" not found in data. Available keys: ${o}`)}function Ui(e){const t=(0,kh.useThemeSelector)(e=>e.theme.colors.selectionOpacity);return(0,wh.useMemo)(()=>{if(void 0!==e||void 0!==t)return{name:e?.name??"",...e,unselectedOpacity:e?.unselectedOpacity??t}},[e,t])}function Yi(e){return"default"in e?e.default:e}async function Xi(e){const t=Ah.get(e);if(t)return t;const{topology:n,objectName:r}=await async function(e){try{switch(e){case"world-110m":return{topology:Yi(await(import("world-atlas/countries-110m.json"))),objectName:"countries"};case"world-50m":return{topology:Yi(await(import("world-atlas/countries-50m.json"))),objectName:"countries"};case"land-110m":return{topology:Yi(await(import("world-atlas/land-110m.json"))),objectName:"land"};case"land-50m":return{topology:Yi(await(import("world-atlas/land-50m.json"))),objectName:"land"};default:throw Error(`Unknown reference geography: "${e}". Supported: "world-110m", "world-50m", "land-110m", "land-50m".`)}}catch(t){if(/Cannot find module|Failed to resolve|world-atlas/i.test(t instanceof Error?t.message:t+""))throw Error(`resolveReferenceGeography("${e}"): ${Ch}`,{cause:t});throw t}}(e);if(!n||!n.objects)throw Error(`resolveReferenceGeography("${e}"): Failed to load topology. Got ${typeof n} with keys: ${n?Object.keys(n).join(", "):"none"}`);const i=(0,jh.feature)(n,n.objects[r]),o="features"in i?i.features:[i];return Ah.set(e,o),o}function Zi(e){const t=(0,Mh.useMemo)(()=>Array.isArray(e)?e:void 0,[e]),[n,r]=(0,Mh.useState)(null);return(0,Mh.useEffect)(()=>{if(e&&!Array.isArray(e)){if("string"==typeof(t=e)&&["world-110m","world-50m","land-110m","land-50m"].includes(t)){let t=!1;return r(null),Xi(e).then(e=>{t||r(e)}),()=>{t=!0}}var t;"production"!==process.env.NODE_ENV&&console.warn(`[semiotic] Unknown areas reference: "${e}". Supported: "world-110m", "world-50m", "land-110m", "land-50m".`),r(null)}else r(null)},[e]),void 0!==t?t:n}function Ki(e){const{title:t,description:n,summary:r,accessibleTable:i,className:o,animate:a,maxDevicePixelRatio:s,axisExtent:l,autoPlaceAnnotations:c}=e,u={};return t&&(u.title=t),n&&(u.description=n),r&&(u.summary=r),void 0!==i&&(u.accessibleTable=i),o&&(u.className=o),null!=a&&(u.animate=a),void 0!==s&&(u.maxDevicePixelRatio=s),void 0!==l&&(u.axisExtent=l),void 0!==c&&(u.autoPlaceAnnotations=c),u}function Qi(e){const{linkedHover:t,selection:n,onObservation:r,onClick:i,hoverRadius:o,hoverHighlight:a,forceHoverBehavior:s,forceClickBehavior:l,mobileInteraction:c,customHoverBehavior:u,customClickBehavior:d,linkedHoverInClickPredicate:h=!0}=e,f={};r&&(f.annotationObservationCallback=r);const p=c?.enabled?Math.max(o??30,Math.ceil((c.targetSize||44)/2),24):o;return(s||t||r||i||a)&&(f.customHoverBehavior=u),d&&(l||(h?r||i||t:r||i)||c?.enabled&&(c.tapToSelect||c.tapToLockTooltip)&&(t||a||n))&&(f.customClickBehavior=d),null!=p&&(f.hoverRadius=p),f}function Ji(e){return e.properties&&"object"==typeof e.properties?{...e.properties,...e}:e}function eo(e){const t=Ii(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,enableHover:e.enableHover,linkedHover:e.linkedHover,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=function(){const e=(0,nh.useTheme)();return e?.colors?.sequential||void 0}(),{areas:r,valueAccessor:i,styleRules:o,colorScheme:a,projection:s="equalEarth",graticule:l,fitPadding:c,zoomable:u,zoomExtent:d,onZoom:h,dragRotate:f,tileURL:p,tileAttribution:m,tileCacheSize:g,tooltip:y,areaOpacity:v=1,annotations:b,legendInteraction:x,legendPosition:w,margin:k,className:S,selection:M,linkedHover:j,onObservation:A,onClick:C,chartId:R,loading:L,loadingContent:P,emptyContent:N,frameProps:E={},stroke:I,strokeWidth:T,opacity:D}=e,z=u??!!p,_=Zi(r),O=(0,Xd.useMemo)(()=>_?gt(_):_,[_]),F=(0,Xd.useMemo)(()=>"function"==typeof i?i:e=>e?.properties?.[i]??e?.[i],[i]),W=a??n??"blues",B=(0,Xd.useMemo)(()=>{if(!O)return(0,Sh.scaleSequential)(Ze(void 0)).domain([0,1]);let e=1/0,t=-1/0;for(const n of O){const r=F(n);null!=r&&isFinite(r)&&(e>r&&(e=r),r>t&&(t=r))}const n=Ze(W);return(0,Sh.scaleSequential)(n).domain([Number.isFinite(e)?e:0,Number.isFinite(t)?t:1])},[O,F,W]),H=(0,Xd.useMemo)(()=>{const e=B.domain();return[e[0]??0,e[1]??1]},[B]),$=function(e,t,n,r=5){const[i,o]=n,[a,s]=(0,sh.useState)(null),[l,c]=(0,sh.useState)(new Map),u=(0,sh.useMemo)(()=>new Set,[]);(0,sh.useEffect)(()=>{s(null),c(new Map)},[i,o,r,e]);const d=(0,sh.useCallback)(t=>{if("highlight"!==e||!t)return void("highlight"===e&&s(null));const n=Li(t);n&&s({key:Pi(t,n),range:n})},[e]),h=(0,sh.useCallback)(t=>{if("isolate"!==e)return;const n=Li(t);n&&c(e=>{const i=new Map(e),o=Pi(t,n);return i.has(o)?i.delete(o):i.set(o,n),i.size===r?new Map:i})},[r,e]),f=(0,sh.useMemo)(()=>{const n="highlight"===e&&a?[a.range]:"isolate"===e?[...l.values()]:[];return 0===n.length?null:{isActive:!0,predicate:e=>{const r=t(e);return Number.isFinite(r)&&n.some(([e,t])=>r>=Math.min(e,t)&&Math.max(e,t)>=r)}}},[a,l,e,t]);return{highlightedCategory:"highlight"===e?a?.key??null:null,isolatedCategories:"isolate"===e?new Set(l.keys()):u,onLegendHover:d,onLegendClick:h,legendSelectionHook:f}}(x,F,H),{activeSelectionHook:q,hoverSelectionHook:G,customHoverBehavior:V,customClickBehavior:U}=Ei({selection:M,linkedHover:j,onObservation:A,onClick:C,chartType:"ChoroplethMap",chartId:R,mobileInteraction:t.mobileInteraction}),Y=Ui(M),X=G||$.legendSelectionHook||q,Z=(0,Xd.useMemo)(()=>{const e=Ti(Bi(e=>{const t=F(e);return{fill:null!=t&&isFinite(t)?B(t):"#ccc",stroke:"#999",strokeWidth:.5,fillOpacity:v}},o,e=>({value:F(e)}),e=>e&&"object"==typeof e&&e.properties?{...e.properties,...e}:e),{stroke:I,strokeWidth:T,opacity:D});return X?gi(e,X,Y,Ji):e},[F,B,X,Y,v,I,T,D,o]),K=(0,Xd.useMemo)(()=>e=>{const t=e?.properties?.name||e?.properties?.NAME||e?.name||e?.NAME||"Feature",n=F(e);return(0,Rh.jsxs)("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[(0,Rh.jsx)("div",{style:{fontWeight:600},children:t}),null!=n&&(0,Rh.jsx)("div",{style:{opacity:.7},children:(r=n,"number"==typeof r&&isFinite(r)?Number.isInteger(r)?r.toLocaleString():r.toLocaleString(void 0,{maximumFractionDigits:2}):(r??"")+"")})]});var r},[F]),Q=wi(t),J=(0,Xd.useMemo)(()=>{if(!1!==t.showLegend)return{gradient:{colorFn:e=>B(e),domain:H,label:"string"==typeof i?i:"value"}}},[B,t.showLegend,i,H]),{legend:ee,margin:te,legendPosition:ne,legendMarginReserved:re}=Ri({data:[],colorBy:void 0,colorScale:void 0,showLegend:!1,legendPosition:w,userMargin:k,defaults:Q,additionalLegend:J,chartWidth:t.width,chartHeight:t.height,legendLayout:E.legendLayout,frameLegend:E,hasTitle:!!t.title,axisChrome:{hasAxis:!1}}),ie=Gi(L,t.width,t.height,P)||(O?null:Gi(!0,t.width,t.height,P)),oe=ie?null:qi(O,t.width,t.height,N);if(Array.isArray(O)&&O.length>0){const e=O[0];if(!e||"object"!=typeof e||!e.geometry)return(0,Rh.jsx)(Hi,{componentName:"ChoroplethMap",message:"ChoroplethMap: areas must be an array of GeoJSON Features with a geometry property.",width:t.width,height:t.height})}const ae={projection:s,areas:O,areaStyle:Z,size:[t.width,t.height],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,maxDevicePixelRatio:e.maxDevicePixelRatio,margin:te,enableHover:t.enableHover,...ee&&{legend:ee,legendPosition:ne},...re&&{__legendMarginReservedFor:ee},legendHoverBehavior:$.onLegendHover,legendClickBehavior:$.onLegendClick,legendHighlightedCategory:$.highlightedCategory,legendIsolatedCategories:"isolate"===x?$.isolatedCategories:void 0,tooltipContent:!1===y?()=>null:!0===y?K:ri(y)||K,...null!=l&&{graticule:l},...null!=c&&{fitPadding:c},...z&&{zoomable:!0},...d&&{zoomExtent:d},...h&&{onZoom:h},...null!=f&&{dragRotate:f},...p&&{tileURL:p},...m&&{tileAttribution:m},...g&&{tileCacheSize:g},...Qi({linkedHover:j,selection:M,onObservation:A,onClick:C,mobileInteraction:t.mobileInteraction,customHoverBehavior:V,customClickBehavior:U,linkedHoverInClickPredicate:!1}),...b&&b.length>0&&{annotations:b},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...t.title&&{title:t.title},...t.description&&{description:t.description},...t.summary&&{summary:t.summary},...void 0!==t.accessibleTable&&{accessibleTable:t.accessibleTable},...S&&{className:S},...null!=e.animate&&{animate:e.animate},...E};return ie||oe||(0,Rh.jsx)($i,{componentName:"ChoroplethMap",width:t.width,height:t.height,children:(0,Rh.jsx)(Yd,{...ae})})}function to(e){const{data:t,rawData:n,colorBy:r,colorScheme:i,legendInteraction:o,legendPosition:a,selection:s,linkedHover:l,fallbackFields:c,unwrapData:u=!1,onObservation:d,chartType:h,chartId:f,showLegend:p,legend:m,legendLayout:g,frameLegend:y,userMargin:v,marginDefaults:b,onClick:x,hoverHighlight:w,mobileInteraction:k,mobileSemantics:S,loading:M,loadingContent:j,emptyContent:A,width:C,height:R,hasTitle:L,axisChrome:P}=e,N=void 0===n,E=(0,Ph.useMemo)(()=>gt(t),[t]),[I,T]=(0,Ph.useState)([]),D=(0,Ph.useCallback)(e=>{T(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[]),z="string"==typeof r?r:void 0,_=(0,Ph.useMemo)(()=>xi(k,{width:C,mobileSemantics:S}),[k,C,S]),{activeSelectionHook:O,hoverSelectionHook:F,customHoverBehavior:W,customClickBehavior:B,crosshairSourceId:H}=Ei({selection:s,linkedHover:l,fallbackFields:c,unwrapData:u,onObservation:d,chartType:h,chartId:f,onClick:x,hoverHighlight:w,colorByField:z,mobileInteraction:_}),$=function(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===n?.mode)return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}(l,H),q=function(e,t,n){const r=(0,Kd.useCategoryColors)(),i=Ni();return(0,Zd.useMemo)(()=>{if(!t)return;const o=r??void 0,a=n??(i&&i.length>0?i:void 0)??"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>t(e)+"")));if(o&&ji(o)){const e=Je(n.map(e=>({_cat:e})),"_cat",a);return t=>Qe(o,t)??e(t)}return Je(n.map(e=>({_cat:e})),"_cat",a)}if(o&&ji(o)){const n=Je(e,t,a);return e=>Qe(o,e)??n(e)}return Je(e,t,a)}if(o&&ji(o)){const e=Je([{_:"a"}],"_",a);return t=>Qe(o,t)??e(t)}},[e,t,n,r,i])}(E,r,i),G=(0,Ph.useMemo)(()=>Ai(E,r),[E,r]),V=(0,Ph.useMemo)(()=>N&&I.length>0?I:G,[N,I,G]),U=function(e,t,n,r=!0,i=!1){const[o,a]=(0,sh.useState)(null),[s,l]=(0,sh.useState)(new Set),c=(0,sh.useMemo)(()=>new Set,[]),u=(0,sh.useMemo)(()=>new Set(n),[n]),d=null!=o&&u.has(o)?o:null,h=(0,sh.useMemo)(()=>{if(0===s.size)return s;const e=new Set(Array.from(s).filter(e=>u.has(e)));return 0===e.size||e.size===u.size?c:e.size===s.size?s:e},[u,c,s]);(0,sh.useEffect)(()=>{r&&t&&e&&"none"!==e||(a(null),l(e=>0===e.size?e:new Set))},[t,r,e]),(0,sh.useEffect)(()=>{a(e=>null==e||u.has(e)?e:null),l(e=>{if(0===e.size)return e;const t=new Set(Array.from(e).filter(e=>u.has(e)));return 0===t.size||t.size===u.size?new Set:t.size===e.size?e:t})},[u]);const f=(0,sh.useCallback)(t=>{r&&"highlight"===e&&a(!t||!u.has(t.label)||i&&!0!==t.__semioticCategory?null:t.label)},[u,r,e,i]),p=(0,sh.useCallback)(t=>{!r||"isolate"!==e||!u.has(t.label)||i&&!0!==t.__semioticCategory||l(e=>{const n=new Set(Array.from(e).filter(e=>u.has(e)));return n.has(t.label)?n.delete(t.label):n.add(t.label),n.size===u.size?new Set:n})},[u,r,e,i]),m=(0,sh.useMemo)(()=>{if(!r||!e||"none"===e||!t)return null;const n=e=>{const n="function"==typeof t?t(e):e[t];return"string"==typeof n?n:n+""};return"highlight"===e&&null!=d?{isActive:!0,predicate:e=>n(e)===d}:"isolate"===e&&h.size>0?{isActive:!0,predicate:e=>h.has(n(e))}:null},[t,r,e,d,h]);return{highlightedCategory:r&&"highlight"===e?d:null,isolatedCategories:r&&"isolate"===e?h:c,onLegendHover:f,onLegendClick:p,legendSelectionHook:m}}(o,r,V),Y=(0,Ph.useMemo)(()=>F||(U.legendSelectionHook?U.legendSelectionHook:O),[F,U.legendSelectionHook,O]),X=Ui(s),Z=Ni(),K=(0,Nh.useCategoryColors)(),Q=(0,Ph.useMemo)(()=>{if(q)return q;if(!r||0===V.length)return;const e=Array.isArray(i)&&i.length>0||"string"==typeof i&&i.length>0?i:Z&&Z.length>0?Z:Cl,t="__streamCat",n=Je(V.map(e=>({[t]:e})),t,e);return e=>(K?Qe(K,e):void 0)??n(e)??"#999"},[q,r,V,i,Z,K]),{legend:J,margin:ee,legendPosition:te,legendLayout:ne,legendMarginReserved:re}=Ri({data:E,colorBy:r,colorScale:Q,showLegend:p,legendPosition:a,userMargin:v,defaults:b,categories:V,additionalLegend:m,chartWidth:C,chartHeight:R,legendLayout:g,frameLegend:y,hasTitle:L,axisChrome:P}),ie=(0,Ph.useMemo)(()=>{const e={};return J&&(e.legend=J,e.legendPosition=te,re&&(e.__legendMarginReservedFor=J),ne&&(e.legendLayout=ne)),o&&"none"!==o&&(e.legendHoverBehavior=U.onLegendHover,e.legendClickBehavior=U.onLegendClick,e.legendHighlightedCategory=U.highlightedCategory,e.legendIsolatedCategories=U.isolatedCategories),N&&r&&(e.legendCategoryAccessor=r,e.onCategoriesChange=D),e},[J,te,ne,re,o,U.onLegendHover,U.onLegendClick,U.highlightedCategory,U.isolatedCategories,N,r,D]),oe=Array.isArray(n)?gt(n):n,ae=Gi(M,C,R,j),se=ae?null:qi(oe,C,R,A);return{data:E,colorScale:q,allCategories:V,legendState:U,effectiveSelectionHook:Y,activeSelectionHook:O,customHoverBehavior:W,customClickBehavior:B,mobileInteraction:_,legend:J,margin:ee,legendPosition:te,earlyReturn:ae||se||null,legendBehaviorProps:ie,crosshairProps:$,resolvedSelection:X}}function no(e,t){const{variant:n,frameRef:r,overrides:i}=t,o=(0,Eh.useRef)(i);o.current=i,(0,Eh.useImperativeHandle)(e,()=>{const e=function(e,t){if("xy"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>e.current?.remove(t)??[],update:(t,n)=>e.current?.update(t,n)??[],replace:t=>e.current?.replace?.(t),clear:()=>e.current?.clear(),getData:()=>e.current?.getData()??[],getScales:()=>e.current?.getScales()??null,getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}if("network"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>{const n=Array.isArray(t)?t:[t],r=e.current?.getTopology()?.nodes??[],i=[];for(const t of n){const n=r.find(e=>e.id===t);n&&i.push({...n.data??{},id:t}),e.current?.removeNode(t)}return i},update:(t,n)=>(Array.isArray(t)?t:[t]).flatMap(t=>{const r=e.current?.updateNode(t,n);return r?[{...r,id:t}]:[]}),clear:()=>e.current?.clear(),getData:()=>e.current?.getTopology()?.nodes?.map(e=>e.data)??[],getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}if("geo-points"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>e.current?.removePoint(t)??[],update:(t,n)=>{const r=e.current?.removePoint(t)??[];for(const t of r)e.current?.push(n(t));return r},clear:()=>e.current?.clear(),getData:()=>e.current?.getData()??[],getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}const n=t;return{push:e=>n.current?.pushLine(e),pushMany:e=>n.current?.pushManyLines(e),remove:e=>n.current?.removeLine(e)??[],update:(e,t)=>{const r=n.current?.removeLine(e)??[];for(const e of r)n.current?.pushLine(t(e));return r},clear:()=>n.current?.clear(),getData:()=>n.current?.getLines()??[],getCustomLayout:()=>n.current?.getCustomLayout?.()??null,getLayoutFailure:()=>n.current?.getLayoutFailure?.()??null}}(n,r);return new Proxy(e,{get(e,t,n){if("string"==typeof t){const e=o.current?.[t];if("function"==typeof e)return e}return Reflect.get(e,t,n)},has:(e,t)=>!("string"!=typeof t||!o.current||!(t in o.current))||Reflect.has(e,t)})},[])}function ro(e,t,n){const[r,i]=n;if(!t)return r;const[o,a]=t,s=a>o?a-o:0,l=Number(e),c=Number.isFinite(l)?l:o;return r+Math.max(0,Math.min(1,s>0?(c-o)/s:0))*(i-r)}function io({bottomMargin:e,costLabel:t,layout:{cx:n,cy:r,maxCost:i,availableRadius:o,layout:a},ringStyle:s,ringValues:l,showNorth:c,showRingLabels:u,showRings:d}){const h="strip"===a,f={stroke:h?"var(--semiotic-border, #999)":"#999",strokeWidth:h?1:.8,strokeDasharray:h?"none":"4,3",labelColor:"var(--semiotic-text-secondary, #777)",labelSize:h?8:10,...s};return(0,Vh.jsxs)("g",h?{children:[(0,Vh.jsx)("line",{x1:n,y1:r,x2:n+o,y2:r,stroke:f.stroke,strokeWidth:f.strokeWidth,strokeLinecap:"round",opacity:.85}),(0,Vh.jsx)("line",{x1:n,y1:r-3.5,x2:n,y2:r+3.5,stroke:f.stroke,strokeWidth:f.strokeWidth,opacity:.9}),d&&l.map(a=>{const s=n+(i>0?a/i*o:0);return(0,Vh.jsxs)("g",{children:[(0,Vh.jsx)("line",{x1:s,y1:r-2.5,x2:s,y2:r+2.5,stroke:f.stroke,strokeWidth:.9,opacity:.65}),u&&(0,Vh.jsxs)("text",{x:s,y:r+Math.min(10,(e??2)+8),textAnchor:"middle",fontSize:f.labelSize,fill:f.labelColor,fontFamily:"var(--semiotic-font-family, system-ui, sans-serif)",children:[a,t?" "+t:""]})]},a)})]}:{children:[l.map(e=>{const a=e/i*o;return(0,Vh.jsxs)("g",{children:[(0,Vh.jsx)("circle",{cx:n,cy:r,r:a,fill:"none",stroke:f.stroke,strokeWidth:f.strokeWidth,strokeDasharray:f.strokeDasharray,opacity:.5}),u&&(0,Vh.jsxs)("text",{x:n+a+3,y:r-2,fontSize:f.labelSize,fill:f.labelColor,fontFamily:"var(--semiotic-font-family, system-ui, sans-serif)",children:[e,t?" "+t:""]})]},e)}),c&&(0,Vh.jsxs)("g",{transform:"translate(24, 24)",children:[(0,Vh.jsx)("circle",{r:16,fill:"white",fillOpacity:.85,stroke:"#bbb",strokeWidth:.8}),(0,Vh.jsx)("path",{d:"M0,-11 L3,-3 L1,-4 L1,7 L-1,7 L-1,-4 L-3,-3 Z",fill:"#555",stroke:"none"}),(0,Vh.jsx)("text",{y:-12,textAnchor:"middle",fontSize:7,fontWeight:700,fill:"#555",fontFamily:"var(--semiotic-font-family, system-ui, sans-serif)",children:"N"}),(0,Vh.jsx)("line",{x1:11,y1:0,x2:13,y2:0,stroke:"#bbb",strokeWidth:.8}),(0,Vh.jsx)("line",{x1:-11,y1:0,x2:-13,y2:0,stroke:"#bbb",strokeWidth:.8}),(0,Vh.jsx)("line",{x1:0,y1:11,x2:0,y2:13,stroke:"#bbb",strokeWidth:.8})]})]})}function oo(e){const t=function(e){return null==e?void 0:e+""}(e.id);return{type:"point",x:e.x,y:e.y,r:e.r??ef,style:{...Jh,cursor:e.cursor},datum:e.datum,pointId:t,_transitionKey:t}}function ao(e){return oo(e)}function so(e){const[[t,n],[r,i]]=e.bounds;return{type:"geoarea",pathData:e.pathData,centroid:e.centroid,bounds:e.bounds,screenArea:e.screenArea??Math.abs((r-t)*(i-n)),style:{...Jh,cursor:e.cursor},datum:e.datum,group:e.group,interactive:!0}}function lo(e){if(Number.isFinite(e))return Math.max(1,Math.round(e))}function co(e,t,n){return Math.max(t,Math.min(n,e))}function uo(e){let t=1/0,n=-1/0;for(const r of e)Number.isFinite(r)&&(t>r&&(t=r),r>n&&(n=r));return t===1/0?[0,0]:[t,n]}function ho(e,t){const n=t[1]-t[0];return 0===n?.5:(e-t[0])/n}function fo(e,t={}){const n=e.map((e,t)=>({...e,index:t})).filter(e=>Number.isFinite(e.x)&&Number.isFinite(e.y));if(0===n.length)return[];const r=co(Number.isFinite(t.occupancy)?Number(t.occupancy):rf,.2,1),i=Number.isFinite(t.aspectRatio)&&Number(t.aspectRatio)>0?Number(t.aspectRatio):of;let o=lo(t.columns)??Math.max(1,Math.ceil(Math.sqrt(n.length*i/r))),a=lo(t.rows)??Math.max(1,Math.ceil(n.length/(o*r)));n.length>o*a&&(null!=t.columns&&null==t.rows?a=Math.ceil(n.length/o):null!=t.rows&&null==t.columns?o=Math.ceil(n.length/a):a=Math.ceil(n.length/o));const s=uo(n.map(e=>e.x)),l=uo(n.map(e=>e.y)),c=n.map(e=>({...e,desiredColumn:ho(e.x,s)*Math.max(0,o-1),desiredRow:ho(e.y,l)*Math.max(0,a-1)})),u=(o-1)/2,d=(a-1)/2;c.sort((e,t)=>(t.desiredColumn-u)**2+(t.desiredRow-d)**2-((e.desiredColumn-u)**2+(e.desiredRow-d)**2)||e.desiredRow-t.desiredRow||e.desiredColumn-t.desiredColumn||e.index-t.index);const h=new Set;for(let e=0;a>e;e+=1)for(let t=0;o>t;t+=1)h.add(e*o+t);const f=[];for(const e of c){let t=-1,n=1/0;for(const r of h){const i=(r%o-e.desiredColumn)**2+(Math.floor(r/o)-e.desiredRow)**2;(n>i||i===n&&t>r)&&(t=r,n=i)}0>t||(h.delete(t),f.push({datum:e.datum,x:e.x,y:e.y,row:Math.floor(t/o),column:t%o,index:e.index}))}return f.sort((e,t)=>e.index-t.index),f.map(({index:e,...t})=>t)}function po(e,t,n=[]){if("function"==typeof t)return t(e);if("string"==typeof t)return e[t];for(const t of n)if(null!=e[t])return e[t]}function mo(e){return e.map(([e,t],n)=>`${0===n?"M":"L"}${e},${t}`).join("")+"Z"}function go({marks:e,color:t,fontSize:n,fontFamily:r,fontWeight:i}){const o=(0,tf.useCustomLayoutSelection)();return(0,nf.jsx)("g",{"aria-hidden":"true",pointerEvents:"none",children:e.map(e=>{const a=!o.isActive||o.predicate(e.datum);return(0,nf.jsx)("text",{x:e.x,y:e.y,fill:t,fontFamily:r,fontSize:n,fontWeight:i,opacity:a?1:.18,textAnchor:"middle",dominantBaseline:"central",children:e.label},e.id)})})}function yo(e,t,n){return Math.max(t,Math.min(n,e))}function vo(e){if(Number.isFinite(e)&&Number(e)>0)return Number(e)}function bo(e,t){return"function"==typeof t?t(e,e.dotIndex):"string"==typeof t?e[t]:void 0}function xo(e){return e.properties&&"object"==typeof e.properties?{...e.properties}:{}}function wo(e,t){const n=xo(e);return(e.id??n.id??n.name??"feature-"+t)+""}function ko(e,t,n,r){return[Math.ceil((e-n)/r-.5),Math.floor((t-n)/r-.5)]}function So(e){if(!e)return 0;const t=hf.get(e);if(t)return t;const n=ff;return ff+=1,hf.set(e,n),n}function Mo(e,t){return!t||!(t[0][1]>e[1]||e[1]>t[1][1]||(n=e[0],r=t[0][0],i=t[1][0],r>i?r>n&&n>i:r>n||n>i));var n,r,i}function jo(e,t){for(const n of e){const{feature:e,index:r}=n;if(e.geometry&&Mo(t,n.bounds))try{if(ne(e,t))return{feature:e,index:r}}catch{}}return null}function Ao(e,t,n,r={}){const i=e.filter((e,t)=>e.geometry&&(!r.featureFilter||r.featureFilter(e,t))),o=function(e,t){if(0===e.length)return null;const n=t.bounds({type:"FeatureCollection",features:e});return Number.isFinite(n[0][0])&&Number.isFinite(n[0][1])&&Number.isFinite(n[1][0])&&Number.isFinite(n[1][1])?n:null}(i,t.geoPath);if(!o)return{dots:[],cellSize:lf,features:i};const a=Math.max(0,r.layoutPadding??0),l=[[yo(o[0][0],a,Math.max(a,n.width-a)),yo(o[0][1],a,Math.max(a,n.height-a))],[yo(o[1][0],a,Math.max(a,n.width-a)),yo(o[1][1],a,Math.max(a,n.height-a))]],c=Math.max(0,l[1][0]-l[0][0]),u=Math.max(0,l[1][1]-l[0][1]);if(0===c||0===u)return{dots:[],cellSize:lf,features:i};const d=vo(r.columns);let h=Math.max(2,d?c/d:vo(r.cellSize)??lf);const f=Math.max(100,Math.round(vo(r.maxSamples)??cf)),p=Math.ceil(c/h)*Math.ceil(u/h);p>f&&(h*=Math.sqrt(p/f));const m=r.gridOrigin?.[0]??0,g=r.gridOrigin?.[1]??0,[y,v]=ko(l[0][0],l[1][0],m,h),[b,x]=ko(l[0][1],l[1][1],g,h),w=[],k=function(e){return e.map((e,t)=>{if(df.has(e))return{feature:e,index:t,bounds:df.get(e)??null};try{const n=function(e){var t,n,r,i,o,a,l;if(sa=aa=-(ia=oa=1/0),fa=[],s(e,Ha),n=fa.length){for(fa.sort(C),t=1,o=[r=fa[0]];n>t;++t)R(r,(i=fa[t])[0])||R(r,i[1])?(A(r[0],i[1])>A(r[0],r[1])&&(r[1]=i[1]),A(i[0],r[1])>A(r[0],r[1])&&(r[0]=i[0])):o.push(r=i);for(a=-1/0,t=0,r=o[n=o.length-1];n>=t;r=i,++t)(l=A(r[1],(i=o[t])[0]))>a&&(a=l,ia=i[0],aa=r[1])}return fa=pa=null,ia===1/0||oa===1/0?[[NaN,NaN],[NaN,NaN]]:[[ia,oa],[aa,sa]]}(e);return df.set(e,n),{feature:e,index:t,bounds:n}}catch{return df.set(e,null),{feature:e,index:t,bounds:null}}})}(i);for(let e=b;x>=e;e+=1){const n=g+(e+.5)*h;for(let i=y;v>=i;i+=1){const o=t.invertedPoint(m+(i+.5)*h,n);if(!o||!Number.isFinite(o[0])||!Number.isFinite(o[1]))continue;const a=jo(k,o);if(!a)continue;const s={...xo(a.feature),featureId:wo(a.feature,a.index),featureIndex:a.index,gridRow:e,gridColumn:i,longitude:o[0],latitude:o[1],dotIndex:w.length};r.dotFilter&&!r.dotFilter(s,w.length)||w.push(s)}}return{dots:w,cellSize:h,features:i}}function Co(e){return Math.round(1e4*e)/1e4}function Ro(e){return Array.isArray(e)&&e.length>=2&&Number.isFinite(e[0])&&Number.isFinite(e[1])?`${Co(Number(e[0]))},${Co(Number(e[1]))}`:"null"}function Lo(e,t){const n=e[t];return"function"==typeof n?n.call(e):void 0}function Po(e){return"number"==typeof e&&Number.isFinite(e)?Co(e)+"":null===e?"null":"unavailable"}function No(e){const t=e.scales.projection;return[Po(Lo(t,"scale")),Ro(Lo(t,"translate")),Ro(Lo(t,"center")),(n=Lo(t,"rotate"),Array.isArray(n)&&n.every(Number.isFinite)?n.map(e=>Co(Number(e))).join(","):"unavailable"),Po(Lo(t,"clipAngle")),Po(Lo(t,"precision")),...[[0,0],[-120,35],[45,45],[120,-30]].map(([t,n])=>Ro(e.scales.projectedPoint(t,n)))].join("|");var n}function Eo(e){return e.map(([e,t],n)=>`${0===n?"M":"L"}${e},${t}`).join("")+"Z"}function Io(e,t,n){const{featureKey:r,dataKey:i}=n,o=new Map;for(const e of t){const t=(Object.prototype.hasOwnProperty.call(e,i)?e[i]:void 0)+"";o.set(t,e)}return e.map(e=>{const t=(e=>{const t=r.split(".");let n=e;for(const e of t)n=null!==n&&"object"==typeof n&&Object.prototype.hasOwnProperty.call(n,e)?n[e]:void 0;return(n??"")+""})(e),n=o.get(t);return n?{...e,properties:{...e.properties,...n}}:e})}var To,Do,zo,_o=Object.create,Oo=Object.defineProperty,Fo=Object.getOwnPropertyDescriptor,Wo=Object.getOwnPropertyNames,Bo=Object.getPrototypeOf,Ho=Object.prototype.hasOwnProperty,$o=(e,t)=>{for(var n in t)Oo(e,n,{get:t[n],enumerable:!0})},qo=(e,t,n,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let i of Wo(t))Ho.call(e,i)||i===n||Oo(e,i,{get:()=>t[i],enumerable:!(r=Fo(t,i))||r.enumerable});return e},Go=(e,t,n)=>(n=null!=e?_o(Bo(e)):{},qo(!t&&e&&e.__esModule?n:Oo(n,"default",{value:e,enumerable:!0}),e)),Vo={};$o(Vo,{default:()=>e});var Uo,Yo,Xo,Zo,Ko=(Uo={"src/components/stream/AccessibleTablePortalImpl.tsx"(){To=Go(require("react")),Do=require("react-dom"),zo=require("react/jsx-runtime")}},function(){if(Xo)throw Xo[0];try{return Uo&&(Yo=(0,Uo[Wo(Uo)[0]])(Uo=0)),Yo}catch(e){throw Xo=[e],e}}),Qo={};$o(Qo,{ChoroplethMap:()=>eo,DEFAULT_HIT_RADIUS:()=>ef,DistanceCartogram:()=>Yh,FlowMap:()=>qh,GeoCustomChart:()=>Qh,MultiLineTooltip:()=>ni,ProportionalSymbolMap:()=>_h,StreamGeoFrame:()=>Yd,Tooltip:()=>ti,TooltipRoot:()=>Sr,composeStyleRules:()=>Bi,geoAreaHitTarget:()=>so,geoHitTarget:()=>ao,geographicDotGridLayout:()=>pf,geographicGridLayout:()=>af,glyphExtent:()=>kt,glyphPlacement:()=>wt,gridifyGeographicPoints:()=>fo,hatchFillId:()=>wn,hatchPatternDef:()=>kn,hitTargetPoint:()=>oo,isHatchFill:()=>bn,makeNodeRuleContext:()=>zi,makeRuleValueResolver:()=>Di,markTooltipChrome:()=>Mr,matchesThreshold:()=>Oi,mergeData:()=>Io,resolveReferenceGeography:()=>Xi,resolveResponsiveRules:()=>bi,resolveStyleRules:()=>Wi,resolveSvgFill:()=>Sn,responsiveRuleMatches:()=>vi,ruleMatches:()=>Fi,sampleGeographicDotGrid:()=>Ao}),module.exports=(Zo=Qo,qo(Oo({},"__esModule",{value:!0}),Zo));var Jo,ea,ta,na,ra,ia,oa,aa,sa,la,ca,ua,da,ha,fa,pa,ma=require("react"),ga=require("d3-array"),ya=1e-6,va=1e-12,ba=Math.PI,xa=ba/2,wa=ba/4,ka=2*ba,Sa=180/ba,Ma=ba/180,ja=Math.abs,Aa=Math.atan,Ca=Math.atan2,Ra=Math.cos,La=Math.ceil,Pa=Math.exp,Na=Math.log,Ea=Math.sin,Ia=Math.sign||function(e){return e>0?1:0>e?-1:0},Ta=Math.sqrt,Da=Math.tan,za={Feature:function(e,t){i(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,o=n.length;++r<o;)i(n[r].geometry,t)}},_a={Sphere:function(e,t){t.sphere()},Point:function(e,t){t.point((e=e.coordinates)[0],e[1],e[2])},MultiPoint:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)t.point((e=n[r])[0],e[1],e[2])},LineString:function(e,t){o(e.coordinates,t,0)},MultiLineString:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)o(n[r],t,0)},Polygon:function(e,t){a(e.coordinates,t)},MultiPolygon:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)a(n[r],t)},GeometryCollection:function(e,t){for(var n=e.geometries,r=-1,o=n.length;++r<o;)i(n[r],t)}},Oa=new ga.Adder,Fa=new ga.Adder,Wa={point:r,lineStart:r,lineEnd:r,polygonStart:function(){Oa=new ga.Adder,Wa.lineStart=l,Wa.lineEnd=c},polygonEnd:function(){var e=+Oa;Fa.add(0>e?ka+e:e),this.lineStart=this.lineEnd=this.point=r},sphere:function(){Fa.add(ka)}},Ba=require("d3-array"),Ha={point:b,lineStart:w,lineEnd:k,polygonStart:function(){Ha.point=S,Ha.lineStart=M,Ha.lineEnd=j,ha=new Ba.Adder,Wa.polygonStart()},polygonEnd:function(){Wa.polygonEnd(),Ha.point=b,Ha.lineStart=w,Ha.lineEnd=k,0>Oa?(ia=-(aa=180),oa=-(sa=90)):ha>ya?sa=90:-ya>ha&&(oa=-90),pa[0]=ia,pa[1]=aa},sphere:function(){ia=-(aa=180),oa=-(sa=90)}};P.invert=P;var $a,qa,Ga,Va,Ua,Ya,Xa,Za,Ka,Qa,Ja,es,ts=require("d3-array"),ns=require("d3-array"),rs=$(function(){return!0},function(e){var t,n=NaN,r=NaN,i=NaN;return{lineStart:function(){e.lineStart(),t=1},point:function(o,a){var s=o>0?ba:-ba,l=ja(o-n);ja(l-ba)<ya?(e.point(n,r=(r+a)/2>0?xa:-xa),e.point(i,r),e.lineEnd(),e.lineStart(),e.point(s,r),e.point(o,r),t=0):i===s||ba>l||(ja(n-i)<ya&&(n-=i*ya),ja(o-s)<ya&&(o-=s*ya),r=function(e,t,n,r){var i,o,a=Ea(e-n);return ja(a)>ya?Aa((Ea(t)*(o=Ra(r))*Ea(n)-Ea(r)*(i=Ra(t))*Ea(e))/(i*o*a)):(t+r)/2}(n,r,o,a),e.point(i,r),e.lineEnd(),e.lineStart(),e.point(s,r),t=0),e.point(n=o,r=a),i=s},lineEnd:function(){e.lineEnd(),n=r=NaN},clean:function(){return 2-t}}},function(e,t,n,r){var i;if(null==e)r.point(-ba,i=n*xa),r.point(0,i),r.point(ba,i),r.point(ba,0),r.point(ba,-i),r.point(0,-i),r.point(-ba,-i),r.point(-ba,0),r.point(-ba,i);else if(ja(e[0]-t[0])>ya){var o=t[0]>e[0]?ba:-ba;r.point(-o,i=n*o/2),r.point(0,i),r.point(o,i)}else r.point(t[0],t[1])},[-ba,-xa]),is=require("d3-array"),os=1e9,as=-os,ss=require("d3-array"),ls={sphere:r,point:r,lineStart:function(){ls.point=U,ls.lineEnd=V},lineEnd:r,polygonStart:r,polygonEnd:r},cs=[null,null],us={type:"LineString",coordinates:cs},ds={Feature:function(e,t){return Z(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,i=n.length;++r<i;)if(Z(n[r].geometry,t))return!0;return!1}},hs={Sphere:function(){return!0},Point:function(e,t){return K(e.coordinates,t)},MultiPoint:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)if(K(n[r],t))return!0;return!1},LineString:function(e,t){return Q(e.coordinates,t)},MultiLineString:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)if(Q(n[r],t))return!0;return!1},Polygon:function(e,t){return J(e.coordinates,t)},MultiPolygon:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)if(J(n[r],t))return!0;return!1},GeometryCollection:function(e,t){for(var n=e.geometries,r=-1,i=n.length;++r<i;)if(Z(n[r],t))return!0;return!1}},fs=require("d3-array"),ps=e=>e,ms=require("d3-array"),gs=new ms.Adder,ys=new ms.Adder,vs={point:r,lineStart:r,lineEnd:r,polygonStart:function(){vs.lineStart=ae,vs.lineEnd=ce},polygonEnd:function(){vs.lineStart=vs.lineEnd=vs.point=r,gs.add(ja(ys)),ys=new ms.Adder},result:function(){var e=gs/2;return gs=new ms.Adder,e}},bs=vs,xs=1/0,ws=xs,ks=-xs,Ss=ks,Ms={point:function(e,t){xs>e&&(xs=e),e>ks&&(ks=e),ws>t&&(ws=t),t>Ss&&(Ss=t)},lineStart:r,lineEnd:r,polygonStart:r,polygonEnd:r,result:function(){var e=[[xs,ws],[ks,Ss]];return ks=Ss=-(ws=xs=1/0),e}},js=0,As=0,Cs=0,Rs=0,Ls=0,Ps=0,Ns=0,Es=0,Is=0,Ts={point:ue,lineStart:de,lineEnd:pe,polygonStart:function(){Ts.lineStart=me,Ts.lineEnd=ge},polygonEnd:function(){Ts.point=ue,Ts.lineStart=de,Ts.lineEnd=pe},result:function(){var e=Is?[Ns/Is,Es/Is]:Ps?[Rs/Ps,Ls/Ps]:Cs?[js/Cs,As/Cs]:[NaN,NaN];return js=As=Cs=Rs=Ls=Ps=Ns=Es=Is=0,e}},Ds=Ts;be.prototype={_radius:4.5,pointRadius:function(e){return this._radius=e,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(e,t){switch(this._point){case 0:this._context.moveTo(e,t),this._point=1;break;case 1:this._context.lineTo(e,t);break;default:this._context.moveTo(e+this._radius,t),this._context.arc(e,t,this._radius,0,ka)}},result:r};var zs,_s,Os,Fs,Ws,Bs,Hs,$s,qs,Gs=require("d3-array"),Vs=new Gs.Adder,Us={point:r,lineStart:function(){Us.point=xe},lineEnd:function(){zs&&we(_s,Os),Us.point=r},polygonStart:function(){zs=!0},polygonEnd:function(){zs=null},result:function(){var e=+Vs;return Vs=new Gs.Adder,e}},Ys=Us,Xs=class{constructor(e){this._append=null==e?ke:function(e){const t=Math.floor(e);if(0>t)throw new RangeError("invalid digits: "+e);if(t>15)return ke;if(t!==Bs){const e=10**t;Bs=t,Hs=function(t){let n=1;this._+=t[0];for(const r=t.length;r>n;++n)this._+=Math.round(arguments[n]*e)/e+t[n]}}return Hs}(e),this._radius=4.5,this._=""}pointRadius(e){return this._radius=+e,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){0===this._line&&(this._+="Z"),this._point=NaN}point(e,t){switch(this._point){case 0:this._append`M${e},${t}`,this._point=1;break;case 1:this._append`L${e},${t}`;break;default:if(this._append`M${e},${t}`,this._radius!==$s||this._append!==Hs){const e=this._radius,t=this._;this._="",this._append`m0,${e}a${e},${e} 0 1,1 0,${-2*e}a${e},${e} 0 1,1 0,${2*e}z`,$s=e,Hs=this._append,qs=this._,this._=t}this._+=qs}}result(){const e=this._;return this._="",e.length?e:null}};je.prototype={constructor:je,point:function(e,t){this.stream.point(e,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var Zs=Ra(30*Ma),Ks=Me({point:function(e,t){this.stream.point(e*Ma,t*Ma)}});_e.invert=function(e,t){return[e,2*Aa(Pa(t))-xa]},Oe.invert=Oe;var Qs,Js=1.340264,el=-.081106,tl=893e-6,nl=.003796,rl=Ta(3)/2;Fe.invert=function(e,n){for(var r,i=n,o=i*i,a=o*o*o,s=0;12>s&&(a=(o=(i-=r=(i*(Js+el*o+a*(tl+nl*o))-n)/(Js+3*el*o+a*(7*tl+9*nl*o)))*i)*o*o,ja(r)>=va);++s);return[rl*e*(Js+3*el*o+a*(7*tl+9*nl*o))/Ra(i),t(Ea(i)/rl)]},Be.invert=function(e,t){var n,r=t,i=25;do{var o=r*r,a=o*o;r-=n=(r*(1.007226+o*(.015085+a*(.028874*o-.044475-.005916*a)))-t)/(1.007226+o*(.045255+a*(.259866*o-.311325-.005916*11*a)))}while(ja(n)>ya&&--i>0);return[e/(.8707+(o=r*r)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979)),r]},He.invert=(Qs=t,function(e,n){var r=Ta(e*e+n*n),i=Qs(r),o=Ea(i),a=Ra(i);return[Ca(e*o,r*a),t(r&&n*o/r)]});var il=require("d3-quadtree"),ol=class{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;return{next:()=>this._size>e?{done:!1,value:this.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray();let n=0,r=[];t.length>e&&(n=t.length-e,r=t.slice(0,n)),this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(let e=n;t.length>e;e++)this.push(t[e]);return r}update(e,t){const n=[],r=(this.head-this._size+this._capacity)%this._capacity;for(let i=0;this._size>i;i++){const o=(r+i)%this._capacity,a=this.buffer[o];if(e(a)){let e;e="object"!=typeof a||null===a?a:Array.isArray(a)?[...a]:{...a},n.push(e),this.buffer[o]=t(a)}}return n}remove(e){const t=[],n=[];if(this.forEach(r=>{e(r)?n.push(r):t.push(r)}),0===n.length)return n;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}},al=1,sl=1.5,ll=3,cl=require("d3-scale"),ul=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],dl=Xe(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),hl=Xe(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),fl=Xe(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),pl=Xe(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),ml=Xe(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),gl=Xe(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),yl=Xe(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),vl=Xe(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),bl=Xe(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),xl=Xe(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),wl=Xe(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),kl=Xe(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]),Sl={blues:dl,reds:hl,greens:fl,viridis:yl,oranges:pl,purples:ml,greys:gl,plasma:vl,inferno:bl,magma:xl,cividis:wl,turbo:kl},Ml=(Xe(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),Xe(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),Xe(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),Xe(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),Xe(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),Xe(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),Xe(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]),{category10:ul,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],...Sl}),jl=ul,Al="#007bff",Cl=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],Rl=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"]),Ll={mercator:function(){return function(e){function t(){var t=ba*s(),a=o(function(e){function t(t){return(t=e(t[0]*Ma,t[1]*Ma))[0]*=Sa,t[1]*=Sa,t}return e=N(e[0]*Ma,e[1]*Ma,e.length>2?e[2]*Ma:0),t.invert=function(t){return(t=e.invert(t[0]*Ma,t[1]*Ma))[0]*=Sa,t[1]*=Sa,t},t}(o.rotate()).invert([0,0]));return c(null==u?[[a[0]-t,a[1]-t],[a[0]+t,a[1]+t]]:e===_e?[[Math.max(a[0]-t,u),n],[Math.min(a[0]+t,r),i]]:[[u,Math.max(a[1]-t,n)],[r,Math.min(a[1]+t,i)]])}var n,r,i,o=Ie(e),a=o.center,s=o.scale,l=o.translate,c=o.clipExtent,u=null;return o.scale=function(e){return arguments.length?(s(e),t()):s()},o.translate=function(e){return arguments.length?(l(e),t()):l()},o.center=function(e){return arguments.length?(a(e),t()):a()},o.clipExtent=function(e){return arguments.length?(null==e?u=n=r=i=null:(u=+e[0][0],n=+e[0][1],r=+e[1][0],i=+e[1][1]),t()):null==u?null:[[u,n],[r,i]]},t()}(_e).scale(961/ka)},equalEarth:We,albersUsa:function(){function e(e){var t=e[0],n=e[1];return s=null,i.point(t,n),s||(o.point(t,n),s)||(a.point(t,n),s)}function t(){return n=r=null,e}var n,r,i,o,a,s,l=ze().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7]),c=ze().rotate([154,0]).center([-2,58.5]).parallels([55,65]),u=ze().rotate([157,0]).center([-3,19.9]).parallels([8,18]),d={point:function(e,t){s=[e,t]}};return e.invert=function(e){var t=l.scale(),n=l.translate(),r=(e[0]-n[0])/t,i=(e[1]-n[1])/t;return(i>=.12&&.234>i&&r>=-.425&&-.214>r?c:i>=.166&&.234>i&&r>=-.214&&-.115>r?u:l).invert(e)},e.stream=function(e){return n&&r===e?n:(t=[l.stream(r=e),c.stream(e),u.stream(e)],i=t.length,n={point:function(e,n){for(var r=-1;++r<i;)t[r].point(e,n)},sphere:function(){for(var e=-1;++e<i;)t[e].sphere()},lineStart:function(){for(var e=-1;++e<i;)t[e].lineStart()},lineEnd:function(){for(var e=-1;++e<i;)t[e].lineEnd()},polygonStart:function(){for(var e=-1;++e<i;)t[e].polygonStart()},polygonEnd:function(){for(var e=-1;++e<i;)t[e].polygonEnd()}});var t,i},e.precision=function(e){return arguments.length?(l.precision(e),c.precision(e),u.precision(e),t()):l.precision()},e.scale=function(t){return arguments.length?(l.scale(t),c.scale(.35*t),u.scale(t),e.translate(l.translate())):l.scale()},e.translate=function(e){if(!arguments.length)return l.translate();var n=l.scale(),r=+e[0],s=+e[1];return i=l.translate(e).clipExtent([[r-.455*n,s-.238*n],[r+.455*n,s+.238*n]]).stream(d),o=c.translate([r-.307*n,s+.201*n]).clipExtent([[r-.425*n+ya,s+.12*n+ya],[r-.214*n-ya,s+.234*n-ya]]).stream(d),a=u.translate([r-.205*n,s+.212*n]).clipExtent([[r-.214*n+ya,s+.166*n+ya],[r-.115*n-ya,s+.234*n-ya]]).stream(d),t()},e.fitExtent=function(t,n){return Ce(e,t,n)},e.fitSize=function(t,n){return Re(e,t,n)},e.fitWidth=function(t,n){return Le(e,t,n)},e.fitHeight=function(t,n){return Pe(e,t,n)},e.scale(1070)},orthographic:function(){return Ie(He).scale(249.5).clipAngle(90.000001)},naturalEarth:function(){return Ie(Be).scale(175.295)},equirectangular:function(){return Ie(Oe).scale(152.63)}},Pl=require("d3-scale"),Nl={data:"data",domain:"domain",layout:"layout","scene-geometry":"sceneGeometry","scene-style":"sceneStyle","data-paint":"dataPaint","interaction-paint":"interactionPaint",overlay:"overlay",accessibility:"accessibility",evidence:"evidence"},El=class{constructor(){this.revisions={data:0,domain:0,layout:0,sceneGeometry:0,sceneStyle:0,dataPaint:0,interactionPaint:0,overlay:0,accessibility:0,evidence:0},this.latest=pt({kind:"initialize"},[],this.revisions),this.listeners=new Set}get last(){return this.latest}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}record(e,t){const n=pt(e,t,this.revisions);this.revisions=n.revisions,this.latest=n;for(const e of[...this.listeners])e();return n}},Il=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Tl=["scene-style","data-paint","accessibility","evidence"],Dl=(e,t)=>({retainedData:e,invalidations:t}),zl=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],_l=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Ol=["scene-geometry","data-paint","accessibility","evidence"],Fl=["scene-style","data-paint","accessibility","evidence"],Wl=["overlay","accessibility","evidence"],Bl=[],Hl={xAccessor:Dl("rebuild",zl),yAccessor:Dl("rebuild",zl),lineDataAccessor:Dl("rebuild",zl),pointIdAccessor:Dl("rebuild",Ol),lineIdAccessor:Dl("rebuild",Ol),windowSize:Dl("rebuild",zl),projection:Dl("preserve",_l),projectionExtent:Dl("preserve",_l),fitPadding:Dl("preserve",_l),lineType:Dl("preserve",_l),flowStyle:Dl("preserve",_l),graticule:Dl("preserve",_l),projectionTransform:Dl("preserve",_l),customLayout:Dl("preserve",_l),layoutConfig:Dl("preserve",_l),layoutMargin:Dl("preserve",_l),areaStyle:Dl("preserve",Fl),pointStyle:Dl("preserve",["scene-geometry","scene-style","data-paint","accessibility","evidence"]),lineStyle:Dl("preserve",Fl),colorScheme:Dl("preserve",Fl),themeCategorical:Dl("preserve",Fl),themeDiverging:Dl("preserve",Fl),themeSemantic:Dl("preserve",Fl),themeSequential:Dl("preserve",Fl),decay:Dl("preserve",Fl),pulse:Dl("preserve",Fl),layoutSelection:Dl("preserve",Fl),annotations:Dl("preserve",Wl),autoPlaceAnnotations:Dl("preserve",Wl),clock:Dl("preserve",Bl),transition:Dl("preserve",Bl),introAnimation:Dl("preserve",Bl),onLayoutError:Dl("preserve",Bl)},$l=Dl("preserve",_l),ql=class{constructor(){this.tracker=new El}get last(){return this.tracker.last}subscribe(e){return this.tracker.subscribe(e)}recordData(e,t){return this.tracker.record({kind:e,...void 0===t?{}:{count:t}},Il)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},Tl):this.recordNoop("restyle")}recordConfig(e,t={}){const n=function(e){let t="preserve";const n=new Set;for(const r of e){const e=Hl[r]??$l;"rebuild"===e.retainedData&&(t="rebuild");for(const t of e.invalidations)n.add(t)}return{retainedData:t,invalidations:n}}(e),r=new Set(n.invalidations);return t.retainedDataChanged&&r.add("data"),this.tracker.record({kind:"config",keys:e},r)}},Gl=new WeakMap,Vl=class e{constructor(e){this.updateResults=new ql,this.scene=[],this.scales=null,this.version=0,this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customLayoutDiagnosticsWarned=new Set,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this._customLayoutFailedThisBuild=!1,this._quadtree=null,this._maxPointRadius=0,this.projection=null,this.geoPath=null,this.baseScale=0,this.baseTranslate=[0,0],this.baseRotation=[0,0,0],this.currentZoom=1,this.cartogramLayout=null,this.areas=[],this.pointData=[],this.lineData=[],this.pointBuffer=null,this.streaming=!1,this.lastIngestTime=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositions=null,this._hasRenderedOnce=!1,this.config=function(e){return{...e,fitPadding:mt(e.fitPadding)}}(e)}currentTime(){return this.config.clock?.()??("undefined"!=typeof performance?performance.now():Date.now())}getConfiguredWindowSize(){const e=this.config.windowSize??500;if(!Number.isInteger(e)||1>e)throw Error("GeoPipelineStore windowSize must be a positive integer");return e}retainNewestLines(e=this.getConfiguredWindowSize()){this.lineData.length>e&&(this.lineData=this.lineData.slice(-e))}resizeStreamingWindow(e){if(this.pointBuffer){const t=this.pointBuffer.toArray(),n=this.timestampBuffer?.toArray()??[],r=t.slice(-e),i=n.slice(-r.length),o=this.currentTime();this.pointBuffer=new ol(e),this.timestampBuffer=new ol(e),r.forEach((e,t)=>{this.pointBuffer.push(e),this.timestampBuffer.push(i[t]??o)})}this.retainNewestLines(e)}updateConfig(e){const t=function(e){return"fitPadding"in e?{...e,fitPadding:mt(e.fitPadding)}:e}(e),n=this.config,r=this.getConfiguredWindowSize(),i=Object.keys(t).filter(e=>t[e]!==n[e]);this.config={...this.config,...t};const o=this.getConfiguredWindowSize(),a=this.streaming&&o!==r;a&&(this.resizeStreamingWindow(o),this.version++),"customLayout"in t&&!t.customLayout&&(this.lastCustomLayoutFailure=null),this.updateResults.recordConfig(i,{retainedDataChanged:a})}updateConfigWithResult(e){return this.updateConfig(e),this.updateResults.last}setAreas(e){this.areas=e,this.updateResults.recordData("replace",e.length)}setAreasWithResult(e){return this.setAreas(e),this.updateResults.last}setPoints(e){this.pointData=e.slice(),this.pointBuffer=null,this.timestampBuffer=null,this.streaming=!1,this.updateResults.recordData("replace",e.length)}setPointsWithResult(e){return this.setPoints(e),this.updateResults.last}setLines(e){this.lineData=e.slice(),this.streaming&&this.retainNewestLines(),this.updateResults.recordData("replace",e.length)}setLinesWithResult(e){return this.setLines(e),this.updateResults.last}initStreaming(e){void 0!==e&&e!==this.config.windowSize&&(this.config={...this.config,windowSize:e});const t=this.getConfiguredWindowSize(),n=this.pointBuffer?this.pointBuffer.toArray():this.pointData,r=this.timestampBuffer?.toArray()??[],i=n.slice(-t),o=r.slice(-i.length),a=this.currentTime();this.pointBuffer=new ol(t),this.timestampBuffer=new ol(t),i.forEach((e,t)=>{this.pointBuffer.push(e),this.timestampBuffer.push(o[t]??a)}),this.pointData=[],this.retainNewestLines(t),this.streaming=!0}pushPoint(e){this.pointBuffer||this.initStreaming();const t=this.currentTime();ht(this.pointBuffer,e,this.timestampBuffer,t),this.lastIngestTime=t,this.updateResults.recordData("ingest",1)}pushPointWithResult(e){return this.pushPoint(e),this.updateResults.last}pushMany(e){this.pointBuffer||this.initStreaming();const t=this.currentTime();for(const n of e)ht(this.pointBuffer,n,this.timestampBuffer,t);this.lastIngestTime=t,this.updateResults.recordData("ingest",e.length)}pushManyWithResult(e){return this.pushMany(e),this.updateResults.last}pushLine(e){null!=e&&"object"==typeof e?(this.streaming||this.initStreaming(),this.lineData.push(e),this.retainNewestLines(),this.version++,this.updateResults.recordData("ingest",1)):this.updateResults.recordNoop("ingest")}pushManyLines(e){if(!Array.isArray(e)||0===e.length)return void this.updateResults.recordNoop("ingest");const t=e.filter(e=>null!=e&&"object"==typeof e);if(0!==t.length){this.streaming||this.initStreaming();for(const e of t)this.lineData.push(e);this.retainNewestLines(),this.version++,this.updateResults.recordData("ingest",t.length)}else this.updateResults.recordNoop("ingest")}removeLine(e){const{lineIdAccessor:t}=this.config;if(!t)throw Error("removeLine() requires lineIdAccessor to be configured");const n="function"==typeof t?t:e=>e[t],r=new Set(Array.isArray(e)?e:[e]),i=[];return this.lineData=this.lineData.filter(e=>!r.has(n(e)+"")||(i.push(e),!1)),i.length>0?(this.version++,this.updateResults.recordData("remove",i.length)):this.updateResults.recordNoop("remove"),i}getLines(){return this.lineData.slice()}removePoint(e){const{pointIdAccessor:t}=this.config;if(!t)throw Error("removePoint() requires pointIdAccessor to be configured");const n="function"==typeof t?t:e=>e[t],r=new Set(Array.isArray(e)?e:[e]);if(this.streaming&&this.pointBuffer){const e=e=>r.has(n(e)+"");!function(e,t,n){if(!t||0===t.size)return;const r=new Set;if(e.forEach((e,t)=>{n(e)&&r.add(t)}),0===r.size)return;const i=t.toArray();t.clear();for(let e=0;i.length>e;e++)r.has(e)||t.push(i[e])}(this.pointBuffer,this.timestampBuffer,e);const t=this.pointBuffer.remove(e);return t.length>0?(this.version++,this.updateResults.recordData("remove",t.length)):this.updateResults.recordNoop("remove"),t}{const e=[];return this.pointData=this.pointData.filter(t=>!r.has(n(t)+"")||(e.push(t),!1)),e.length>0?(this.version++,this.updateResults.recordData("remove",e.length)):this.updateResults.recordNoop("remove"),e}}clear(){this.areas=[],this.pointData=[],this.lineData=[],this.pointBuffer=null,this.timestampBuffer=null,this.streaming=!1,this.scene=[],this.scales=null,this._hasRenderedOnce=!1,this.activeTransition=null,this.prevPositions=null,this._quadtree=null,this._maxPointRadius=0,this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this._customLayoutFailedThisBuild=!1,this.version++,this.updateResults.recordData("clear")}restyleScene(e){const t=this._customRestyle;if(t){for(const n of this.scene){const r=this._baseStyles.get(n)??n.style,i=t(n,e);n.style=i?{...r,...i}:r}this.markStylePaintPending(),this.updateResults.recordRestyle(!0)}else this.updateResults.recordRestyle(!1)}computeScene(e){const{config:t}=this,n=this.projection,r=this.geoPath,i=this.scales,o=this.baseScale,a=[...this.baseTranslate],s=[...this.baseRotation],l=this.scene;this.projection=function(e){if(!e)return We();if("string"==typeof e){const t=Ll[e];return t?t():("production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Unknown projection "${e}", falling back to equalEarth`),We())}if("object"==typeof e&&"type"in e){const t=Ll[e.type],n=t?t():We();return e.rotate&&"rotate"in n&&n.rotate(e.rotate),e.center&&"center"in n&&n.center(e.center),n}return e}(t.projection),this.geoPath=Se(this.projection),this.fitProjection(e),this.geoPath=Se(this.projection);const c=this.projection;this.scales={projection:c,geoPath:this.geoPath,projectedPoint:(e,t)=>c([e,t]),invertedPoint:(e,t)=>c.invert?c.invert([e,t]):null},this._customLayoutFailedThisBuild=!1;const u=this.buildSceneNodes(e);if(this._customLayoutFailedThisBuild)!0===this.lastCustomLayoutFailure?.preservedLastGoodScene?(this.projection=n,this.geoPath=r,this.scales=i,this.baseScale=o,this.baseTranslate=a,this.baseRotation=s):(this.scene=[],this.rebuildQuadtree());else{if(this.scene=u,this.rebuildQuadtree(),t.projectionTransform&&this.applyCartogramTransform(t.projectionTransform,e),t.decay&&this.streaming&&this.applyDecay(),t.pulse&&this.streaming&&this.applyPulse(),t.transition&&!this._hasRenderedOnce&&this.scene.length>0&&t.introAnimation){const t=e.width/2,n=e.height/2,r=this.scene.filter(e=>"point"===e.type).map(e=>({...e,x:t,y:n}));r.length>0&&this.startTransition(r)}this._hasRenderedOnce=!0,t.transition&&l.length>0&&this.startTransition(l),this.version++}}fitProjection(e){const t=this.projection,n=this.config,r=[...this.areas],i=it(n.xAccessor,"lon"),o=it(n.yAccessor,"lat"),a=this.getPoints();if(a.length>0){const e=a.map(e=>[i(e),o(e)]);r.push({type:"Feature",properties:{},geometry:{type:"MultiPoint",coordinates:e}})}const s=ot(n.lineDataAccessor);for(const e of this.lineData){const t=s(e);if(t&&t.length>0){const e=t.map(e=>[i(e),o(e)]);r.push({type:"Feature",properties:{},geometry:{type:"LineString",coordinates:e}})}}if(0!==r.length){if(n.projectionExtent){const[[r,i],[o,a]]=n.projectionExtent;t.fitExtent([[0,0],[e.width,e.height]],{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[[r,i],[r,a],[o,a],[o,i],[r,i]]]}})}else if(t.clipAngle&&(t.clipAngle()??0)>0){const r=n.fitPadding??0,i=Math.min(e.width,e.height);t.scale(i/2-i*r),t.translate([e.width/2,e.height/2])}else{const i=n.fitPadding??0,o=e.width*i,a=e.height*i;t.fitExtent([[o,a],[e.width-o,e.height-a]],{type:"FeatureCollection",features:r})}this.baseScale=t.scale(),this.baseTranslate=t.translate(),this.baseRotation=t.rotate?.()??[0,0,0]}}applyZoomTransform(e,t){const n=this.projection;if(!n)return;const r=this.geoPath,i=this.scales,o=n.scale(),a=[...n.translate()],s=this.currentZoom;n.scale(this.baseScale*e.k),n.translate([this.baseTranslate[0]*e.k+e.x,this.baseTranslate[1]*e.k+e.y]),this.currentZoom=e.k,this.geoPath=Se(n),this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null},this._customLayoutFailedThisBuild=!1;const l=this.buildSceneNodes(t);this._customLayoutFailedThisBuild?this.lastCustomLayoutFailure?.preservedLastGoodScene?(n.scale(o),n.translate(a),this.currentZoom=s,this.geoPath=r,this.scales=i):(this.scene=[],this.rebuildQuadtree()):(this.scene=l,this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}applyZoomScale(e,t){const n=this.projection;if(!n)return;const r=this.geoPath,i=this.scales,o=n.scale(),a=[...n.translate()],s=this.currentZoom;n.scale(this.baseScale*e),n.translate(this.baseTranslate),this.currentZoom=e,this.geoPath=Se(n),this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null},this._customLayoutFailedThisBuild=!1;const l=this.buildSceneNodes(t);this._customLayoutFailedThisBuild?this.lastCustomLayoutFailure?.preservedLastGoodScene?(n.scale(o),n.translate(a),this.currentZoom=s,this.geoPath=r,this.scales=i):(this.scene=[],this.rebuildQuadtree()):(this.scene=l,this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}applyRotation(e,t){const n=this.projection;if(!n||!n.rotate)return;const r=this.geoPath,i=this.scales,o=[...n.rotate()];n.rotate(e),this.geoPath=Se(n),this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null},this._customLayoutFailedThisBuild=!1;const a=this.buildSceneNodes(t);this._customLayoutFailedThisBuild?this.lastCustomLayoutFailure?.preservedLastGoodScene?(n.rotate(o),this.geoPath=r,this.scales=i):(this.scene=[],this.rebuildQuadtree()):(this.scene=a,this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}setRotation(e){const t=this.projection;t&&t.rotate&&t.rotate(e)}hasProjection(){return null!=this.projection}getRotation(){return this.projection?.rotate?.()??this.baseRotation}getBaseProjectionState(){return{scale:this.baseScale,translate:[...this.baseTranslate]}}getPoints(){return this.streaming&&this.pointBuffer?this.pointBuffer.toArray():this.pointData}rebuildQuadtree(){let t=0,n=0;for(const e of this.scene)"point"===e.type&&!1!==e.interactive&&(n++,e.r>t&&(t=e.r));if(this._maxPointRadius=t,e.QUADTREE_THRESHOLD>=n)return void(this._quadtree=null);const r=Array(n);let i=0;for(const e of this.scene)"point"===e.type&&!1!==e.interactive&&(r[i++]=e);this._quadtree=(0,il.quadtree)().x(e=>e.x).y(e=>e.y).addAll(r)}get quadtree(){return this._quadtree}get maxPointRadius(){return this._maxPointRadius}buildSceneNodes(e){this._customLayoutFailedThisBuild=!1;const{config:t}=this,n=this.projection,r=this.geoPath;if(t.customLayout&&this.scales){const n=t.layoutMargin??{top:0,right:0,bottom:0,left:0},r=function(e,t,n=jl){if(e&&"object"==typeof e&&!Array.isArray(e)){const t=Object.values(e).filter(e=>"string"==typeof e&&e.length>0);if(t.length>0)return t}if(Array.isArray(e)&&e.length>0)return e;if("string"==typeof e){const t=Object.prototype.hasOwnProperty.call(Ml,e)?Ml[e]:void 0;if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:n}(t.colorScheme,t.themeCategorical,Cl),i={areas:this.areas.slice(),points:this.getPoints().slice(),lines:this.lineData.slice(),scales:this.scales,dimensions:{width:e.width,height:e.height,margin:n,plot:{x:0,y:0,width:e.width,height:e.height}},theme:{semantic:t.themeSemantic??{},categorical:[...r]},resolveColor:tt(r,t.colorScheme),config:t.layoutConfig??{},selection:t.layoutSelection??null},o=function(e){try{return{kind:"success",result:e.run()}}catch(t){const n=e.hasPreviousResult,r=function(e,t,n,r){const i=function(e){if(e instanceof Error)return{name:e.name||"Error",message:e.message||"Custom layout threw."};if("string"==typeof e)return{name:"Error",message:e};if(null==e)return{name:"Error",message:"Custom layout threw a nullish value."};try{return{name:"Error",message:e+""}}catch{return{name:"Error",message:"Custom layout threw a non-stringifiable value."}}}(t),o="network"===e?"customNetworkLayout":"customLayout";return{code:"CUSTOM_LAYOUT_ERROR",severity:"error",phase:"layout",component:e,source:o,message:`Semiotic ${e} ${o} failed: ${i.message}`,error:i,recovery:n?"preserved-last-good-scene":"empty-scene",preservedLastGoodScene:n,affectedRevision:r}}(e.family,t,n,e.revision);"production"!==process.env.NODE_ENV&&console.error(`[semiotic] ${e.logLabel} threw:`,t);try{e.onLayoutError?.(r)}catch(e){"production"!==process.env.NODE_ENV&&console.error("[semiotic] onLayoutError threw:",e)}return{kind:"failure",diagnostic:r,preservedLastGoodScene:n}}}({family:"geo",logLabel:"geo customLayout",revision:this.version,hasPreviousResult:null!==this.lastCustomLayoutResult,onLayoutError:t.onLayoutError,run:()=>t.customLayout(i)});if("failure"===o.kind)return this.lastCustomLayoutFailure=o.diagnostic,this._customLayoutFailedThisBuild=!0,o.preservedLastGoodScene?this.scene:(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,[]);const a=o.result,s=a.nodes??[];if(this.customLayoutOverlays=a.overlays??null,this.lastCustomLayoutResult=a,this.lastCustomLayoutFailure=null,this._customRestyle=a.restyle,this.hasCustomRestyle=!!a.restyle,this._baseStyles=new WeakMap,this.hasCustomRestyle){for(const e of s)this._baseStyles.set(e,e.style);this.restyleScene(t.layoutSelection??null)}return function(e){if("production"===process.env.NODE_ENV)return;const{label:t,nodes:n,overlays:r,warned:i}=e;nt(r)&&0===n.length&&rt(i,"overlay-only",`[semiotic] ${t} returned overlays but no data-bearing scene nodes. Overlays do not participate in hover, selection, transitions, SSR evidence, or accessibility tables. Emit at least one scene node with a datum, or mark the overlay-only chart as intentionally decorative.`),n.length>0&&n.every(e=>null==e.datum)&&rt(i,"null-datums",`[semiotic] ${t} returned scene nodes, but every scene-node datum is null. Hover, callbacks, selection, and tooltip helpers need data-bearing nodes. Attach a user-facing datum to each interactive node, or set interactive overlays outside the chart.`)}({label:"geo customLayout",nodes:s,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned}),s}return this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,function({config:e,projection:t,path:n,areas:r,points:i,lines:o,layout:a}){const s=it(e.xAccessor,"lon"),l=it(e.yAccessor,"lat"),c=[],u=function(e){return{fill:e.themeSemantic?.surface||"#e0e0e0",stroke:e.themeSemantic?.border||"#999",strokeWidth:.5,fillOpacity:1}}(e),d=function(e){return{stroke:e.themeSemantic?.primary||"#4e79a7",strokeWidth:1.5,fill:"none"}}(e),h=function(e){return{fill:e.themeSemantic?.primary||"#4e79a7",r:4,fillOpacity:.8}}(e);if(e.graticule){const t=!0===e.graticule?{}:e.graticule,r=function(){function e(){return{type:"MultiLineString",coordinates:t()}}function t(){return(0,fs.range)(La(o/g)*g,i,g).map(h).concat((0,fs.range)(La(c/y)*y,l,y).map(f)).concat((0,fs.range)(La(r/p)*p,n,p).filter(function(e){return ja(e%g)>ya}).map(u)).concat((0,fs.range)(La(s/m)*m,a,m).filter(function(e){return ja(e%y)>ya}).map(d))}var n,r,i,o,a,s,l,c,u,d,h,f,p=10,m=p,g=90,y=360,v=2.5;return e.lines=function(){return t().map(function(e){return{type:"LineString",coordinates:e}})},e.outline=function(){return{type:"Polygon",coordinates:[h(o).concat(f(l).slice(1),h(i).reverse().slice(1),f(c).reverse().slice(1))]}},e.extent=function(t){return arguments.length?e.extentMajor(t).extentMinor(t):e.extentMinor()},e.extentMajor=function(t){return arguments.length?(c=+t[0][1],l=+t[1][1],(o=+t[0][0])>(i=+t[1][0])&&(t=o,o=i,i=t),c>l&&(t=c,c=l,l=t),e.precision(v)):[[o,c],[i,l]]},e.extentMinor=function(t){return arguments.length?(s=+t[0][1],a=+t[1][1],(r=+t[0][0])>(n=+t[1][0])&&(t=r,r=n,n=t),s>a&&(t=s,s=a,a=t),e.precision(v)):[[r,s],[n,a]]},e.step=function(t){return arguments.length?e.stepMajor(t).stepMinor(t):e.stepMinor()},e.stepMajor=function(t){return arguments.length?(g=+t[0],y=+t[1],e):[g,y]},e.stepMinor=function(t){return arguments.length?(p=+t[0],m=+t[1],e):[p,m]},e.precision=function(t){return arguments.length?(v=+t,u=re(s,a,90),d=ie(r,n,v),h=re(c,l,90),f=ie(o,i,v),e):v},e.extentMajor([[-180,-89.999999],[180,89.999999]]).extentMinor([[-180,-80.000001],[180,80.000001]])}();t.step&&r.step(t.step);const i=n(r())||"";i&&c.push({type:"geoarea",pathData:i,centroid:[a.width/2,a.height/2],bounds:[[0,0],[a.width,a.height]],screenArea:0,style:{fill:"none",stroke:t.stroke||"#e0e0e0",strokeWidth:t.strokeWidth??.5,strokeDasharray:t.strokeDasharray||"2,2"},datum:null,interactive:!1})}for(const t of r){const r=n(t);if(!r)continue;const i=n.centroid(t),o=n.bounds(t),a=n.area(t);c.push({type:"geoarea",pathData:r,centroid:i,bounds:o,screenArea:a,style:at(e.areaStyle,t,u),datum:t,interactive:!0})}const f=ot(e.lineDataAccessor);for(const n of o){const r=f(n);if(!r||2>r.length)continue;let i=[];if("geo"===e.lineType){const e=Array(r.length);for(let t=0;r.length>t;t++)e[t]=[s(r[t]),l(r[t])];for(let n=0;e.length-1>n;n++){const r=e[n],o=e[n+1],a=X(r,o)||0,s=Math.max(2,Math.ceil(a/(Math.PI/180))),l=oe(r,o);for(let e=0;s>=e;e++){if(n>0&&0===e)continue;const r=t(l(e/s));null!=r&&i.push(r)}}}else for(let e=0;r.length>e;e++){const n=r[e],o=t([s(n),l(n)]);null!=o&&i.push(o)}if(2>i.length)continue;const o=at(e.lineStyle,n,d),u="number"==typeof o.strokeWidth?o.strokeWidth:1;2!==r.length||2>i.length||"arc"!==e.flowStyle?2!==r.length||2>i.length||"offset"!==e.flowStyle||(i="geo"===e.lineType?ct(i,u):ut(i[0],i[i.length-1],0,0,u)):i=lt(i[0],i[i.length-1]);const h=st(i,a.width);if(h.length>1)for(const e of h)2>e.length||c.push({type:"line",path:e,style:{...o,_edgeFade:!0},datum:n});else c.push({type:"line",path:2>i.length&&h[0]||i,style:o,datum:n})}const p=e.pointIdAccessor?"function"==typeof e.pointIdAccessor?e.pointIdAccessor:t=>t[e.pointIdAccessor]:null,m=t.clipAngle?t.clipAngle()??0:0,g=m>0?m*Math.PI/180:null,y=t.rotate?t.rotate():[0,0,0],v="function"==typeof t.center?t.center():[0,0],b=[(v[0]??0)-y[0],(v[1]??0)-y[1]];for(const n of i){const r=s(n),i=l(n);if(null!=g&&X([r,i],b)>g)continue;const o=t([r,i]);if(!o)continue;const a=e.pointStyle?e.pointStyle(n):{...h},u={type:"point",x:o[0],y:o[1],r:a.r||4,style:a,datum:n,pointId:p?p(n)+"":void 0};c.push(u)}return c}({config:t,projection:n,path:r,areas:this.areas,points:this.getPoints(),lines:this.lineData,layout:e})}applyCartogramTransform(e,t){const n=function(e,t,n,r){const i=e.filter(e=>"point"===e.type);if(2>i.length)return null;const o=t.strength??1,a=Number.isFinite(o)?Math.max(0,Math.min(1,o)):1,s="strip"===t.layout?"strip":"radial";if("radial"===s&&0===a)return null;const l=t.centerAccessor?"function"==typeof t.centerAccessor?t.centerAccessor:e=>e[t.centerAccessor]:e=>e.id,c="function"==typeof t.costAccessor?t.costAccessor:e=>e[t.costAccessor],u=i.find(e=>e.datum&&l(e.datum)+""==t.center+"");if(!u)return"production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Distance cartogram center "${t.center}" not found in point data`),null;const d=function(e,t=-1/0){let n=t;for(const t of e)t>n&&(n=t);return n}(i.map(e=>e.datum?Number(c(e.datum)):NaN).filter(e=>isFinite(e)&&e>=0),1);r>0&&"production"!==process.env.NODE_ENV&&console.warn("GeoFrame: Distance cartogram does not support area rendering. Areas will be ignored. Remove areas or set projectionTransform to null to render them.");for(let t=e.length-1;t>=0;t--){const n=e[t];"geoarea"===n.type&&n.interactive&&e.splice(t,1)}const h="strip"===s?function(e,t,n,r,i){const o=Math.max(3,Math.min(8,.35*i.height)),a=Math.max(1,i.width-2*o),s=i.height/2,l=(0,Pl.scaleLinear)().domain([0,r]).range([0,a]);t.x=o,t.y=s;const c=[];for(const i of e){if(i===t)continue;if(!i.datum){i.x=o,i.y=s;continue}const e=Number(n(i.datum)),a=o+(isFinite(e)&&e>=0&&r>0?l(e):0);i.x=a,i.y=s,c.push({node:i,x:a})}c.sort((e,t)=>e.x-t.x);const u=Math.max(0,Math.min(i.height/2-1,6));let d=0;for(;c.length>d;){let e=d+1;for(;c.length>e&&3>Math.abs(c[e].x-c[d].x);)e++;const t=e-d;if(t>1&&u>0)for(let e=0;t>e;e++)c[d+e].node.y=s+(e-(t-1)/2)*Math.min(2.5,2*u/Math.max(1,t-1));d=e}return{cx:o,cy:s,maxCost:r,availableRadius:a,layout:"strip"}}(i,u,c,d,n):function(e,t,n,r,i,o){const a=t.x,s=t.y,l=o.width/2,c=o.height/2,u=Math.min(o.width,o.height)/2,d=(0,Pl.scaleLinear)().domain([0,r]).range([0,u]);for(const o of e){if(o===t)continue;if(!o.datum)continue;const e=o.x,u=o.y,h=Math.atan2(u-s,e-a),f=Math.hypot(e-a,u-s),p=Number(n(o.datum)),m=isFinite(p)&&p>=0?r>0?d(p):0:f,g=l+Math.cos(h)*m,y=c+Math.sin(h)*m;o.x=e+(g-e)*i,o.y=u+(y-u)*i}return t.x=a+(l-a)*i,t.y=s+(c-s)*i,{cx:t.x,cy:t.y,maxCost:r,availableRadius:u,layout:"radial"}}(i,u,c,d,a,n),f=e.filter(e=>"line"===e.type);if(f.length>0){const e=new Map;for(const t of i)null!=t.pointId&&e.set(t.pointId+"",[t.x,t.y]);for(const n of f){const r=n.datum?.source,i=n.datum?.target;if(null!=r&&null!=i){const o=e.get(r+""),a=e.get(i+"");if(o&&a)if("fractional"===t.lineMode&&n.path.length>2){const e=n.path[0],t=n.path[n.path.length-1],r=[o[0]-e[0],o[1]-e[1]],i=[a[0]-t[0],a[1]-t[1]],s=[0];for(let e=1;n.path.length>e;e++)s.push(s[e-1]+Math.hypot(n.path[e][0]-n.path[e-1][0],n.path[e][1]-n.path[e-1][1]));const l=s[s.length-1];n.path=n.path.map((e,t)=>{const o=l>0?s[t]/l:t/(n.path.length-1);return[e[0]+r[0]*(1-o)+i[0]*o,e[1]+r[1]*(1-o)+i[1]*o]})}else n.path=[o,a]}}}return h}(this.scene,e,t,this.areas.length);n&&(this.cartogramLayout=n)}applyDecay(){const e=this.config.decay;if(!e||!this.pointBuffer)return;const t=this.pointBuffer.size;if(0===t)return;const n=this.scene.filter(e=>"point"===e.type);for(let r=0;n.length>r;r++){const i=qe(e,r,t);n[r]._decayOpacity=i,n[r].style={...n[r].style,opacity:i}}}applyPulse(e=this.currentTime()){const t=this.config.pulse;if(!t||!this.timestampBuffer)return!1;const n=this.scene.filter(e=>"point"===e.type),r=this.timestampBuffer.toArray(),i=t.color||"rgba(255,255,255,0.6)",o=t.glowRadius??4;let a=!1;for(let s=0;n.length>s&&r.length>s;s++){const l=Ge(t,r[s],e);a=Ve(n[s],l,i,o)||a}return a}refreshPulse(e){return!0!==this.lastCustomLayoutFailure?.preservedLastGoodScene&&this.applyPulse(e)}hasActivePulsesAt(e){return!!this.config.pulse&&function(e,t,n=("undefined"!=typeof performance?performance.now():Date.now())){if(!t||0===t.size)return!1;const r=e.duration??500,i=t.peek();return null!=i&&r>n-i}(this.config.pulse,this.timestampBuffer,e)}get hasActivePulses(){return this.hasActivePulsesAt(this.currentTime())}startTransition(e){const t=this.config.transition?.duration??300;if(0>=t)return;const n=new Map;for(const t of e)"point"===t.type&&t.pointId&&n.set(t.pointId,[t.x,t.y]);const r=this.scene.filter(e=>"point"===e.type);let i=!1;for(const e of r)if(e.pointId){const t=n.get(e.pointId);t&&(e._targetX=e.x,e._targetY=e.y,e.x=t[0],e.y=t[1],(Math.abs(t[0]-e._targetX)>.5||Math.abs(t[1]-e._targetY)>.5)&&(i=!0))}for(const e of r)e.pointId&&!n.has(e.pointId)&&(e._targetOpacity=e.style?.opacity??e.style?.fillOpacity??1,e.style={...e.style,opacity:0},i=!0);i&&(this.activeTransition={startTime:this.currentTime(),duration:t})}cancelIntroAnimation(){this.activeTransition=null;for(const e of this.scene)"point"===e.type&&(null!=e._targetOpacity&&(e.style={...e.style,opacity:e._targetOpacity},e._targetOpacity=void 0),null!=e._targetX&&(e.x=e._targetX,e.y=e._targetY,e._targetX=void 0,e._targetY=void 0))}advanceTransition(e){if(!this.activeTransition)return!1;const t=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,this.activeTransition),n=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(t),r=this.scene.filter(e=>"point"===e.type);for(const e of r){if(null!=e._targetX&&null!=e._targetY){const t=e.y;e.x=$e(e.x,e._targetX,n),e.y=$e(t,e._targetY,n)}null!=e._targetOpacity&&(e.style={...e.style,opacity:e._targetOpacity*n})}if(t>=1){for(const e of r)null!=e._targetX&&(e.x=e._targetX,e.y=e._targetY,e._targetX=void 0,e._targetY=void 0),null!=e._targetOpacity&&(e.style={...e.style,opacity:e._targetOpacity},e._targetOpacity=void 0);return this.activeTransition=null,!1}return!0}};Vl.QUADTREE_THRESHOLD=500;var Ul=Vl;Object.assign(Ul.prototype,{getLastUpdateResult:function(){return this.updateResults.last},getUpdateSnapshot:function(){return this.updateResults.last},subscribeUpdateResult:function(e){return this.updateResults.subscribe(e)},setLayoutSelection:function(e){this.config.layoutSelection=e},markStylePaintPending:function(){Gl.set(this,!0)},consumeStylePaintPending:function(){const e=!0===Gl.get(this);return Gl.delete(this),e}});var Yl=require("react"),Xl=require("d3-selection"),Zl=require("d3-zoom"),Kl=Object.freeze([]),Ql=require("react"),Jl={sceneGeometry:0,layout:0,domain:0},ec="production"!==process.env.NODE_ENV,tc={revisions:Jl,signature:"",sawSignals:!1,wasUnconsumed:!1,warnUnconsumed:!1},nc=class{constructor(e="scene host"){this.hostName=e,this.lastConsumed=Jl,this.lastObserved=Jl,this.lastDuplicateWarning="",this.lastUnconsumedWarning=""}observeUpdateResult(e){ec&&(this.lastObserved=vt(this.lastObserved,yt(e)))}beforeCompute(e,t){if(!ec)return tc;const n=vt(yt(e),this.lastObserved),r=function(e){return`${e.sceneGeometry}|${e.layout}|${e.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:e.changed.has("scene-geometry")||e.changed.has("layout")||e.changed.has("domain"),wasUnconsumed:i,warnUnconsumed:!t&&i&&this.lastUnconsumedWarning!==r}}afterCompute(e,t,n){if(ec){if(t&&e.wasUnconsumed&&(this.lastConsumed=e.revisions),e.warnUnconsumed&&!t)return console.warn(`[semiotic] ${this.hostName} observed scene-affecting revisions without a scene rebuild: ${e.signature}.`),void(this.lastUnconsumedWarning=e.signature);t&&e.sawSignals&&!e.wasUnconsumed&&!n&&this.lastDuplicateWarning!==e.signature?(console.warn(`[semiotic] ${this.hostName} performed scene rebuild with unchanged scene revisions: ${e.signature}.`),this.lastDuplicateWarning=e.signature):t&&!e.sawSignals&&(this.lastDuplicateWarning="")}}},rc=(0,Ql.memo)(function({store:e,diagnostics:t}){return(0,Ql.useEffect)(()=>{const n=()=>t.observeUpdateResult(e.getUpdateSnapshot());return n(),e.subscribeUpdateResult(n)},[t,e]),null}),ic=[40,40],oc=[.5,.5],ac=null,sc=Go(require("react")),lc=require("react"),cc=require("./semiotic-client-cjs-shared.min.js"),uc=require("react"),dc=require("react"),hc="undefined"==typeof window?dc.useEffect:dc.useLayoutEffect,fc=new WeakMap,pc=0,mc=!1,gc=null,yc=null,vc=null,bc=null,xc=null,wc=new Set,kc=()=>"undefined"!=typeof performance?performance.now():Date.now(),Sc=class{constructor(e={}){this.randomSource=Math.random,this.subscribers=new Set,this.now=()=>this.advance(),this.random=()=>this.randomSource(),this.clock=e.clock??kc,this.lastWallTime=Nt(this.clock,0),this.logicalTime=this.lastWallTime,this.pausedValue=!0===e.paused,this.visibleValue=!1!==e.visible,this.setRandomSource(e.random,e.seed)}get isActive(){return!this.pausedValue&&this.visibleValue}get paused(){return this.pausedValue}get seed(){return this.seedValue}get visible(){return this.visibleValue}configure(e){this.setClock(e.clock),this.setRandomSource(e.random,e.seed)}setPaused(e){this.pausedValue!==e&&(this.advance(),this.pausedValue=e,this.emit())}setVisible(e){this.visibleValue!==e&&(this.advance(),this.visibleValue=e,this.emit())}snapshot(){return{now:this.now(),paused:this.pausedValue,seed:this.seedValue,visible:this.visibleValue}}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}advance(){const e=Nt(this.clock,this.lastWallTime),t=Math.max(0,e-this.lastWallTime);return this.lastWallTime=e,this.isActive&&(this.logicalTime+=t),this.logicalTime}emit(){for(const e of this.subscribers)e()}setClock(e){const t=e??kc;t!==this.clock&&(this.advance(),this.clock=t,this.lastWallTime=Nt(t,this.lastWallTime))}setRandomSource(e,t){const n=function(e){return"number"==typeof e&&Number.isFinite(e)?Math.trunc(e):void 0}(t);e===this.randomInput&&n===this.seedValue||(this.randomInput=e,this.seedValue=n,this.randomSource=e??(void 0===n?Math.random:function(e){let t=e>>>0;return()=>{t+=1831565813;let e=t;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}}(n)))}},Mc=34,jc=58,Ac=16,Cc=6,Rc=10,Lc=22,Pc=100,Nc=10,Ec=3,Ic=46,Tc=26,Dc=22,zc=46,_c=64,Oc=34,Fc=70,Wc="undefined"==typeof window?lc.useEffect:lc.useLayoutEffect,Bc={requestAnimationFrame:e=>("undefined"==typeof window?globalThis:window).requestAnimationFrame(e),cancelAnimationFrame:e=>("undefined"==typeof window?globalThis:window).cancelAnimationFrame(e)},Hc=require("react"),$c=require("react"),qc={fresh:1,aging:.7,stale:.45,expired:.25},Gc={alpha:1,band:"fresh",isStale:!1},Vc=require("react/jsx-runtime"),Uc=Go(require("react")),Yc=require("./semiotic-client-cjs-shared.min.js"),Xc=require("react"),Zc=require("react/jsx-runtime"),Kc="var(--semiotic-bg, #ffffff)",Qc=require("react/jsx-runtime"),Jc=require("react/jsx-runtime"),eu=Go(require("react")),tu=require("react/jsx-runtime"),nu=require("d3-hierarchy"),ru=require("d3-shape"),iu=null,ou=require("react/jsx-runtime"),au=new Map,su=new Set(["top-left","top-center","top-right","middle-left","center","middle-right","bottom-left","bottom-center","bottom-right"]),lu=require("react/jsx-runtime"),cu={fill:"var(--semiotic-text, #333)",fontSize:11,fontFamily:"inherit"},uu=require("react/jsx-runtime"),du={secondary:0,primary:3},hu=require("react/jsx-runtime"),fu={linear:ru.curveLinear,monotoneX:ru.curveMonotoneX,monotoneY:ru.curveMonotoneY,step:ru.curveStep,stepAfter:ru.curveStepAfter,stepBefore:ru.curveStepBefore,basis:ru.curveBasis,cardinal:ru.curveCardinal,catmullRom:ru.curveCatmullRom},pu=new Set(["label","callout","callout-circle","callout-rect","text","widget"]),mu=(new Set(["label","callout","callout-circle","callout-rect"]),32),gu=6,yu=4,vu=8,bu=72,xu={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"},wu=Go(require("react")),ku={fontFamily:"var(--semiotic-legend-font-family, var(--semiotic-font-family, sans-serif))",fontWeight:"var(--semiotic-legend-font-weight, normal)"},Su={fontSize:"var(--semiotic-legend-font-size, 12px)"},Mu=Go(require("react")),ju=require("react/jsx-runtime"),Au=require("react/jsx-runtime"),Cu=(e,t,n,r,i,o,a,s,l,c,u)=>{const{items:d}=e,h=[];let f=0;const p={legendGroup:e,customClickBehavior:t,customHoverBehavior:n,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:o,focusedItemIndex:a,groupIndex:s,onFocusedIndexChange:l,interactive:!(!t&&!n),useIsolateAria:"isolate"===c||void 0===c&&null!=i,metrics:u};return d.forEach((e,t)=>{h.push(Yn(p,e,t,`translate(0,${f})`,"ArrowUp","ArrowDown")),f+=u.rowHeight}),h},Ru=require("react/jsx-runtime"),Lu=require("react/jsx-runtime"),Pu=require("react/jsx-runtime"),Nu=Go(require("react")),Eu=(Go(require("react")),require("react/jsx-runtime")),Iu=Go(require("react")),Tu=require("react/jsx-runtime"),Du=require("react/jsx-runtime"),zu="undefined"==typeof window||"undefined"==typeof document,_u=require("react"),Ou="undefined"!=typeof window?_u.useLayoutEffect:_u.useEffect,Fu=()=>()=>{},Wu=()=>!1,Bu=()=>!0,Hu=require("react"),$u=require("react/jsx-runtime"),qu=require("react"),Gu=Go(require("react")),Vu=Go(require("react")),Uu=(require("react/jsx-runtime"),Vu.createContext(null)),Yu=require("react/jsx-runtime"),Xu={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0},Zu=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},Ku=require("react/jsx-runtime"),Qu=Gu.lazy(()=>Promise.resolve().then(()=>(Ko(),Vo))),Ju="semiotic-accessible-data-table",ed=Ju+" semiotic-accessible-data-table-hidden",td=Ju+" semiotic-accessible-data-table-visible",nd={boxSizing:"border-box",maxWidth:"100%",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},rd={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"},id={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},od={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)"},ad={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},sd={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))"},ld={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},cd={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},ud={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"},dd=require("react"),hd=require("react/jsx-runtime"),fd="var(--semiotic-focus, #005fcc)",pd=Go(require("react")),md=Go(require("react")),gd=require("react/jsx-runtime"),yd={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, white)",padding:"8px 12px",borderRadius:"var(--semiotic-tooltip-radius, 6px)",fontSize:"var(--semiotic-tooltip-font-size, 14px)",fontFamily:"var(--semiotic-font-family, inherit)",lineHeight:"1.5",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.15))",pointerEvents:"none",maxWidth:"300px",wordWrap:"break-word"};Mr(Sr);var vd,bd=require("react/jsx-runtime"),xd=require("d3-zoom"),wd=require("d3-selection"),kd=require("d3-shape"),Sd=require("d3-shape"),Md=new WeakMap,jd=1,Ad=class{constructor(e=256){this.cache=new Map,this.limit=Br(e)}setLimit(e){this.limit=Br(e),this.cache.size>this.limit&&this.evict()}get(e){const t=this.cache.get(e);return t&&(t.lastUsed=performance.now()),t}set(e,t){this.cache.set(e,t),this.cache.size>this.limit&&this.evict()}evict(){for(;this.cache.size>this.limit;){let e,t=1/0;for(const[n,r]of this.cache)t>r.lastUsed&&(t=r.lastUsed,e=n);if(!e)break;{const t=this.cache.get(e);t&&(t.img.onload=null,t.img.onerror=null,t.img.src=""),this.cache.delete(e)}}}clear(){for(const e of this.cache.values())e.img.onload=null,e.img.onerror=null,e.img.src="";this.cache.clear()}},Cd=class{constructor(e){this.capacity=e,this.particles=Array(e);for(let t=0;e>t;t++)this.particles[t]={t:0,offset:0,lineIndex:0,active:!1,x:0,y:0}}spawn(e,t=Math.random){for(let n=0;this.capacity>n;n++){const r=this.particles[n];if(!r.active)return r.active=!0,r.t=0,r.offset=.6*(t()-.5),r.lineIndex=e,r.x=0,r.y=0,r}return null}step(e,t,n,r){for(let i=0;this.capacity>i;i++){const o=this.particles[i];if(!o.active)continue;const a=n[o.lineIndex];if(!a||2>a.length){o.active=!1;continue}if(o.t+=e*t,o.t>=1){o.active=!1;continue}const s=Hr(a),l=$r(a,o.t*s),c=(r[o.lineIndex]||2)/2;o.x=l.x+l.nx*o.offset*c*2,o.y=l.y+l.ny*o.offset*c*2}}countForLine(e){let t=0;for(let n=0;this.capacity>n;n++)this.particles[n].active&&this.particles[n].lineIndex===e&&t++;return t}clear(){for(let e=0;this.capacity>e;e++)this.particles[e].active=!1}},Rd=Go(require("react")),Ld=Go(require("react")),Pd=require("react/jsx-runtime"),Nd=new Set,Ed=["name","label","title"],Id=["type","kind","category","group","class","status","role","shape"],Td=["value","amount","total","count","weight","score"],Dd=new Set(["x","y","z","x0","x1","y0","y1","r","cx","cy","radius","layer","row","rowindex","col","column","depth","index","order","sankeywidth","coincidentpoints","sourcelinks","targetlinks","parent","children","fx","fy","vx","vy"]),zd=require("react/jsx-runtime"),_d=(require("react/jsx-runtime"),require("react/jsx-runtime"));ii.ownsChrome=!0;var Od={top:10,right:10,bottom:10,left:10},Fd=null,Wd={width:28,height:28,border:"1px solid rgba(0,0,0,0.2)",borderRadius:4,background:"rgba(255,255,255,0.9)",color:"#333",fontSize:16,fontWeight:600,lineHeight:1,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",padding:0,boxShadow:"0 1px 3px rgba(0,0,0,0.1)"},Bd=require("react"),Hd=require("react"),$d="__semioticSelectionData",qd=Go(require("react")),Gd=require("react"),Vd=require("react/jsx-runtime"),Ud=(0,ma.memo)((0,ma.forwardRef)(function(e,t){const{projection:n,projectionExtent:r,fitPadding:i,projectionTransform:o,areas:a,points:s,lines:l,customLayout:c,layoutConfig:u,layoutSelection:d,onLayoutError:h,xAccessor:f,yAccessor:p,lineDataAccessor:m,pointIdAccessor:g,lineIdAccessor:y,lineType:v="geo",flowStyle:b="basic",graticule:x,zoomable:w,zoomExtent:k,onZoom:S,dragRotate:M,showParticles:j,particleStyle:A,tileURL:C,tileAttribution:R,tileCacheSize:L,size:P,width:N,height:E,responsiveWidth:I,responsiveHeight:T,margin:D,className:z,background:_,maxDevicePixelRatio:O,windowSize:F=500,renderMode:W,areaStyle:B,pointStyle:H,lineStyle:$,colorScheme:q,enableHover:G=!0,hoverAnnotation:V,tooltipContent:U,allowTooltipOverflow:Y=!1,customClickBehavior:X,customHoverBehavior:Z,onObservation:K,annotationObservationCallback:Q,chartId:J,annotations:ee,onAnnotationActivate:te,autoPlaceAnnotations:ne,svgAnnotationRules:re,decay:ie,pulse:oe,transition:ae,animate:se,staleness:le,frameScheduler:ce,clock:ue,random:de,seed:he,paused:fe=!1,suspendWhenHidden:pe=!0,backgroundGraphics:me,foregroundGraphics:ge,title:ye,legend:ve,legendPosition:be,legendLayout:xe,legendHoverBehavior:we,legendClickBehavior:ke,legendHighlightedCategory:Se,legendIsolatedCategories:Me,legendCategoryAccessor:je,onCategoriesChange:Ae,showAxes:Ce,accessibleTable:Re=!0,description:Le,summary:Pe}=e,{customHoverBehavior:Ne,customClickBehavior:Ee,hasClickBehavior:Ie}=function({customHoverBehavior:e,customClickBehavior:t,onObservation:n,chartId:r,chartType:i}){const o=!(!e&&!n),a=!(!t&&!n),s=(0,Bd.useCallback)((t,o)=>{e?.(t,o),ui({onObservation:n,datum:t?t.data||t:null,x:t?.x,y:t?.y,chartType:i,chartId:r,context:o})},[r,i,e,n]),l=(0,Bd.useCallback)((e,o)=>{t?.(e,o),di({onObservation:n,datum:e?e.data||e:null,x:e?.x,y:e?.y,chartType:i,chartId:r,context:o})},[r,i,t,n]);return{customHoverBehavior:o?s:void 0,customClickBehavior:a?l:void 0,hasClickBehavior:a}}({customHoverBehavior:Z,customClickBehavior:X,onObservation:K,chartId:J,chartType:"StreamGeoFrame"}),Te=P||[N||600,E||400],De=(0,ma.useRef)(!0),ze=Ut({sizeProp:Te,responsiveWidth:I,responsiveHeight:T,userMargin:D,marginDefault:Od,title:ye,legend:ve,legendPosition:be,legendLayout:xe,legendMarginReserved:e.__legendMarginReservedFor===ve,animate:se,transitionProp:ae,frameScheduler:ce,clock:ue,random:de,seed:he,paused:fe,suspendWhenHidden:pe,themeDirtyRef:De}),{reducedMotionRef:_e,responsiveRef:Oe,size:Fe,margin:We,adjustedWidth:Be,adjustedHeight:He,transition:$e,introEnabled:qe,tableId:Ge,frameRuntime:Ve,rafRef:Ue,renderFnRef:Ye,scheduleRender:Xe,currentTheme:Ze}=ze,Ke=function(){const[e,t]=(0,_u.useState)(!1);return Ou(()=>{t(!0)},[]),e}(),Qe=function(){const e=(0,_u.useSyncExternalStore)(Fu,Wu,Bu);return(0,_u.useRef)(e).current}(),Je=(0,ma.useMemo)(()=>Array.isArray(a)?gt(a):a,[a]),et=(0,ma.useMemo)(()=>gt(s),[s]),tt=(0,ma.useMemo)(()=>gt(l),[l]),nt=M??"orthographic"===si(n),rt=function(e){const t=(0,qu.useRef)(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return ur(e,t);if(!dr(e)||!dr(t))return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const r of n){if(!Object.prototype.hasOwnProperty.call(t,r))return!1;const n=e[r],i=t[r];if(!Object.is(n,i))if(Array.isArray(n)&&Array.isArray(i)){if(!ur(n,i))return!1}else{if(!dr(n)||!dr(i))return!1;if(!cr(n,i))return!1}}return!0}(t.current,e)||(t.current=e),t.current}((0,ma.useMemo)(()=>({projection:n,projectionExtent:r,fitPadding:i,xAccessor:f,yAccessor:p,lineDataAccessor:m,lineType:v,flowStyle:b,areaStyle:B,pointStyle:H,lineStyle:$,colorScheme:q,themeSemantic:Yt(Ze),themeSequential:Ze?.colors?.sequential,themeDiverging:Ze?.colors?.diverging,themeCategorical:Ze?.colors?.categorical,graticule:x,projectionTransform:o,windowSize:F,clock:Ve.now,decay:ie,pulse:oe,transition:$e,introAnimation:qe,annotations:ee,pointIdAccessor:g,lineIdAccessor:y,customLayout:c,layoutConfig:u,onLayoutError:h,layoutMargin:We}),[n,r,i,f,p,m,v,b,B,H,$,q,Ze,x,o,F,Ve.now,ie,oe,$e,qe,ee,g,y,c,u,h,We])),it=(0,ma.useRef)(null);it.current||(it.current=new Ul(rt));const ot=it.current,at=(0,ma.useRef)(null),st=at.current??(at.current=function(e){const t=new Set;let n=0,r=e;return{subscribe:e=>(t.add(e),()=>t.delete(e)),getSnapshot:()=>n,sync(e){if(e!==r){r=e,n+=1;for(const e of t)e()}}}}(ot.scales)),lt=zu||!Ke&&Qe;lt&&(Je||s||l)&&(Je&&ot.setAreas(Je),s&&ot.setPoints(et),l&&ot.setLines(tt),ot.computeScene({width:Be,height:He}));const{resolvedForeground:ct,resolvedBackground:ut,themeBackground:dt,surfaceBackground:ht}=function({tracker:e,readScales:t,...n}){const r=r=>"function"==typeof r?qd.createElement(pi,{graphics:r,size:n.size,margin:n.margin,readScales:t,tracker:e}):r;return{...function({foregroundGraphics:e,backgroundGraphics:t,size:n,margin:r,scales:i,background:o,themeBackgroundColor:a,resolveScaleAwareGraphics:s=!0}){const l=`var(--semiotic-bg, ${a})`;return{resolvedForeground:s||"function"!=typeof e?fi(e,n,r,i):null,resolvedBackground:s||"function"!=typeof t?fi(t,n,r,i):null,themeBackground:l,surfaceBackground:hr({background:o,hasBackgroundGraphics:!!t,themeBackground:l})}}({...n,resolveScaleAwareGraphics:!1}),resolvedForeground:r(n.foregroundGraphics),resolvedBackground:r(n.backgroundGraphics)}}({foregroundGraphics:ge,backgroundGraphics:me,size:Fe,margin:We,scales:ot.scales,background:_,themeBackgroundColor:Ze.colors.background,tracker:st,readScales:()=>ot.scales}),ft=(0,ma.useRef)(null),pt=(0,ma.useRef)(null),mt=(0,ma.useRef)(null);C&&!mt.current&&(mt.current=new Ad(L??256)),mt.current?.setLimit(L??256);const yt=(0,ma.useRef)(ee),vt=(0,ma.useRef)(null),bt=(0,ma.useRef)(xd.zoomIdentity),xt=(0,ma.useRef)(!1),kt=(0,ma.useRef)(null),Mt=(0,ma.useCallback)(e=>{kt.current=e,Oe&&"object"==typeof Oe&&(Oe.current=e)},[Oe]),Ct=(0,ma.useRef)(null),Lt=(0,ma.useRef)(null),Nt=(0,ma.useRef)(null),Et=(0,ma.useRef)(0);if(j&&!Nt.current){const e=A?.maxPerLine??ai();Nt.current=new Cd(50*e)}const It=(0,ma.useRef)(null),Tt=(0,ma.useRef)(!1),Dt=(0,ma.useRef)(null),zt=(0,ma.useRef)(!1),_t=(0,ma.useRef)(!1),Ot=(0,Ql.useRef)(new nc("StreamGeoFrame")),Ft=(0,ma.useRef)(void 0),[Wt,Bt]=(0,ma.useState)(null),[,Ht]=(0,ma.useState)(0),$t=(0,ma.useRef)(0),[qt,Gt]=(0,ma.useState)(!1),Vt=function(e,t,n,r){const i=(0,dd.useRef)({accessor:t,onChange:n,readData:r}),o=(0,dd.useRef)([]);i.current={accessor:t,onChange:n,readData:r};const a=(0,dd.useCallback)(()=>{const{accessor:t,onChange:n,readData:r}=i.current;if(!n||!t)return;const a=function(e,t){if(!t)return[];const n=new Set,r=[];for(const i of e){if(!i||"object"!=typeof i)continue;const e=("function"==typeof t?t(i):i[t])+"";n.has(e)||(n.add(e),r.push(e))}return r}(e.current?r(e.current):[],t);(function(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0})(a,o.current)||(o.current=a,n(a))},[e]);return(0,dd.useEffect)(()=>{o.current=[],a()},[t,a,n]),a}(it,je,Ae,e=>e.getPoints());!function(e,t,n,r){(0,Hc.useEffect)(()=>{e.current?.updateConfig(t),n.current=!0,r()},[t,r,e,n])}(it,rt,De,Xe),function(e,t,n,r){const i=(0,Hc.useRef)(null);(0,Hc.useEffect)(()=>{const o=e.current;if(!o)return;const a=t??null;i.current!==a&&(i.current=a,o.setLayoutSelection(a),o.hasCustomRestyle?o.restyleScene(a):n.current=!0,r())},[t,r,e,n])}(it,d,De,Xe),(0,ma.useEffect)(()=>{const e=it.current;e&&(Je&&e.setAreas(Je),s&&e.setPoints(et),l&&e.setLines(tt),De.current=!0,Xe())},[Je,s,et,l,tt,Xe]),function(e,{storeRef:t,dirtyRef:n,scheduleRender:r,zoomTransformRef:i,containerRef:o,zoomBehaviorRef:a}){const s=(0,Yl.useCallback)(e=>{null!=e&&"object"==typeof e&&(t.current?.pushPoint(e),n.current=!0,r())},[t,n,r]),l=(0,Yl.useCallback)(e=>{const i=gt(e);0!==i.length&&(t.current?.pushMany(i),n.current=!0,r())},[t,n,r]),c=(0,Yl.useCallback)(e=>{null!=e&&"object"==typeof e&&(t.current?.pushLine(e),n.current=!0,r())},[t,n,r]),u=(0,Yl.useCallback)(e=>{const i=gt(e);0!==i.length&&(t.current?.pushManyLines(i),n.current=!0,r())},[t,n,r]),d=(0,Yl.useCallback)(()=>{t.current?.clear(),n.current=!0,r()},[t,n,r]);(0,Yl.useImperativeHandle)(e,()=>({push:s,pushMany:l,removePoint:e=>{const i=t.current?.removePoint(e)??[];return i.length>0&&(n.current=!0,r()),i},pushLine:c,pushManyLines:u,removeLine:e=>{const i=t.current?.removeLine(e)??[];return i.length>0&&(n.current=!0,r()),i},getLines:()=>t.current?.getLines()??[],clear:d,getProjection:()=>t.current?.scales?.projection??null,getGeoPath:()=>t.current?.scales?.geoPath??null,getCartogramLayout:()=>t.current?.cartogramLayout??null,getCustomLayout:()=>t.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>t.current?.lastCustomLayoutFailure??null,getZoom:()=>i.current.k,resetZoom:()=>{const e=o.current;e&&a.current&&(0,Xl.select)(e).call(a.current.transform,Zl.zoomIdentity)},getData:()=>t.current?.getPoints()??[]}),[s,l,c,u,d,r,t,n,i,o,a])}(t,{storeRef:it,dirtyRef:De,scheduleRender:Xe,zoomTransformRef:bt,containerRef:kt,zoomBehaviorRef:vt});const{hoverHandlerRef:Zt,onPointerMove:Kt,onPointerLeave:Qt,pointerStateRef:Jt}=ze,{canvasRef:en,interactionCanvasRef:tn,resolutionDirtyRef:nn}=function(e,t){return sr({...t,renderFnRef:e.renderFnRef,scheduleRender:e.scheduleRender,cancelRender:e.cancelRender,frameRuntime:e.frameRuntime})}(ze,{hydrated:Ke,wasHydratingFromSSR:Qe,storeRef:it,dirtyRef:De,cleanup:()=>mt.current?.clear(),maxDevicePixelRatio:O,canvasPaintDependencies:[Be,He,_,me,W,C,L,Xe]});(0,ma.useEffect)(()=>{Zt.current=e=>{const t=en.current;if(!t)return;const n=it.current;if(!n||!n.scene.length)return void rr(t);const r=ci({pointer:e,canvasRect:t.getBoundingClientRect(),margin:We,width:Be,height:He,scene:n.scene,pointQuadtree:n.quadtree,maxPointRadius:n.maxPointRadius,hitCanvasRef:pt});rr(t,"hit"===r.kind?nr(r.node):void 0),G&&!1!==V&&("hit"===r.kind?(It.current=r.hover,Dt.current=r.node,Bt(r.hover),Ne?.(r.hover),Xe()):("outside"===r.kind||"miss"===r.kind&&It.current)&&(It.current=null,Dt.current=null,Bt(null),Ne?.(null),Xe()))}},[G,V,Be,He,We,Ne,Xe,Zt,en]),ze.hoverLeaveRef.current=()=>{rr(en.current),G&&!1!==V&&(It.current=null,Dt.current=null,Bt(null),Ne?.(null),Xe())},function(e){const t=Iu.useRef(null);Iu.useEffect(()=>{e.current&&(t.current=e.current)}),Iu.useEffect(()=>()=>rr(t.current),[])}(en);const rn=(0,ma.useCallback)(e=>{if((t=e.target)instanceof Element&&null!=t.closest("[data-semiotic-annotation-widget]"))return;var t;if(!Ee)return;const n=it.current;if(!n||!n.scene.length)return void Ee(null);const r=e.currentTarget.getBoundingClientRect(),i=e.clientX-r.left-We.left,o=e.clientY-r.top-We.top;if(0>i||i>Be||0>o||o>He)return void Ee(null);pt.current||(pt.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const a=li(pt.current);if(!a)return void Ee(null);const s=qr(30,Ft.current),l=qr(6,Ft.current),c=Rt(n.scene,i,o,s,a,n.quadtree,n.maxPointRadius,l);if(c){const e=c.node.datum,t=Array.isArray(e)?null:e?.properties?e:e?.data||e,n=t?.properties?{...t,...t.properties}:t;return void Ee({...n,data:t,properties:t?.properties,__semioticHoverData:!0,x:i,y:o,time:i,value:o},{type:"activate",inputType:(u=Ft.current,"touch"===u?"touch":"pointer")})}var u;Ee(null)},[He,Be,Ee,We]),{kbFocusIndexRef:on,focusedNavPointRef:an,onKeyDown:sn}=function({storeRef:e,hoverRef:t,hoveredNodeRef:n,setHoverPoint:r,customHoverBehavior:i,customClickBehavior:o,scheduleRender:a}){const s=(0,Hd.useRef)(-1),l=(0,Hd.useRef)(null),c=(0,Hd.useCallback)(c=>{if(function(e){const t=e.target;return t instanceof Element&&t!==e.currentTarget&&null!=t.closest("button, a[href], input, select, textarea, summary, [contenteditable='true'], [role='button'], [role='link'], [role='checkbox'], [role='radio'], [role='switch']")}(c))return;const u=e.current;if(!u)return;const d=()=>{s.current=-1,l.current=null,t.current=null,n&&(n.current=null),r(null),i?.(null),a()};if(0===u.scene.length)return void(0>s.current||d());const h=function(e){const t=[];for(const n of e)if("point"===n.type&&null!=n.x&&!1!==n.interactive)t.push({x:n.x,y:n.y,datum:n.datum,shape:"circle"});else if("glyph"===n.type){if(0>=n.size||null==n.datum)continue;const e=At(n.glyph,n.size);t.push({x:n.x+e.centerDx,y:n.y+e.centerDy,datum:n.datum,shape:"rect",w:2*e.halfWidth,h:2*e.halfHeight})}else"geoarea"===n.type&&n.centroid&&!1!==n.interactive&&t.push({x:n.centroid[0],y:n.centroid[1],datum:n.datum,shape:"geoarea",pathData:n.pathData});return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}(u.scene);if(0===h.length)return void(0>s.current||d());let f=s.current;if(h.length>f||(d(),f=-1),("Enter"===c.key||" "===c.key)&&f>=0)return c.preventDefault(),void o?.(hi(h[f]),{type:"activate",inputType:"keyboard"});const p=function(e,t,n){switch(e){case"ArrowRight":case"ArrowDown":return n-1>t?t+1:t;case"ArrowLeft":case"ArrowUp":return t>0?t-1:t;case"PageDown":return Math.min(t+Math.max(1,Math.floor(.1*n)),n-1);case"PageUp":return Math.max(t-Math.max(1,Math.floor(.1*n)),0);case"Home":return 0;case"End":return n-1;case"Escape":return-1;default:return null}}(c.key,0>f?-1:f,h.length);if(null===p)return;if(c.preventDefault(),0>p)return void d();const m=0>f?0:p;s.current=m;const g=h[m];l.current=g;const y=hi(g);t.current=y,r(y),i?.(y,{type:"focus",inputType:"keyboard"}),a()},[o,i,t,n,a,r,e]);return{kbFocusIndexRef:s,focusedNavPointRef:l,onKeyDown:c}}({storeRef:it,hoverRef:It,hoveredNodeRef:Dt,setHoverPoint:Bt,customHoverBehavior:Ne,customClickBehavior:Ee,scheduleRender:Xe}),ln=(0,ma.useCallback)(e=>{var t,n,r,i;n=G&&!1!==V,r=Tt.current,i=en.current,function(e,t,n){const r=e.current;r.inside=!0,r.clientX=t.clientX,r.clientY=t.clientY,r.pointerType=t.pointerType??n}(t=Jt,e,void 0),(n||r)&&(n||"touch"!==t.current.pointerType||(rr(i),0))&&(Ft.current=e.pointerType,on.current=-1,an.current=null,Kt(e))},[en,G,V,an,on,Kt,Jt]),cn=(0,ma.useCallback)(e=>{Ft.current=e.pointerType},[]);Ye.current=()=>{if(Ue.current=null,st.sync(it.current?.scales??null),!Ve.isActive)return;const e=en.current,t=it.current;if(!e||!t)return;const n=Ve.now();let r=!1;const i=Lt.current;let o=!1;i&&(Lt.current=null,t.applyRotation(i,{width:Be,height:He}),o=!0);const a=null!=t.activeTransition,s=t.advanceTransition(_e.current?n+1e6:n),l=!_e.current&&s,c=Ot.current.beforeCompute(t.getLastUpdateResult(),l);let u=!1;if(De.current&&!s){const e={width:Be,height:He},n=t.hasProjection(),r=nt&&n?t.getRotation():null;t.computeScene(e);const i=bt.current,o=1!==i.k||0!==i.x||0!==i.y;nt&&r?o?(t.setRotation(r),t.applyZoomScale(i.k,e)):t.applyRotation(r,e):o&&t.applyZoomTransform(i,e),De.current=!1,u=!0,Vt()}st.sync(t.scales),Ot.current.afterCompute(c,u,!1);const d=ar(O,Fe),h=j&&!_e.current&&!!Nt.current,f=t.consumeStylePaintPending();(u||o||f)&&(Tt.current=function(e){if(!e)return!1;for(const t of e)if(nr(t))return!0;return!1}(t.scene),Tt.current||rr(e)),Tt.current&&(a||u||o||f)&&function(e){var t,n,r;n=e.pointer,r=t=>{const n=ci({pointer:t,canvasRect:e.canvas.getBoundingClientRect(),margin:e.margin,width:e.width,height:e.height,scene:e.store.scene,pointQuadtree:e.geometryMoved?null:e.store.quadtree,maxPointRadius:e.store.maxPointRadius,hitCanvasRef:e.hitCanvasRef});return"hit"===n.kind?nr(n.node):void 0},(t=e.canvas)&&(n.inside&&"touch"!==n.pointerType?rr(t,r(n)):rr(t))}({canvas:e,pointer:Jt.current,store:t,margin:We,width:Be,height:He,hitCanvasRef:pt,geometryMoved:a||u||o});const p=function(e,t,n,r){const i=r.current,o=!0===e.lastCustomLayoutFailure?.preservedLastGoodScene,a=!o&&e.hasActivePulsesAt(t),s=!(n||o||!a&&!i)&&e.refreshPulse(t);return r.current=a,{changed:s,pending:a}}(t,n,u,_t),m=!!((g={dirtyOrRebuilt:u,transitioning:a,continuous:h,liveEncoding:p.changed,forced:o||f||nn.current}).dirtyOrRebuilt||g.transitioning||g.animationTicked||g.continuous||g.liveEncoding||g.forced);var g;if(nn.current=!1,C&&mt.current){const e=ft.current;if(e&&t.scales?.projection){const n=or(e,Fe,We,d);n&&(n.clearRect(-We.left,-We.top,Fe[0],Fe[1]),n.save(),n.beginPath(),n.rect(0,0,Be,He),n.clip(),function(e,t){const{tileURL:n,projection:r,width:i,height:o,tileCache:a,onTileLoad:s,maxDevicePixelRatio:l}=t,c=r.scale(),u=r.translate(),d=function(e){const{size:t,scale:n,translate:r,clampX:i=!0,clampY:o=!0}=e,a=Math.max(Math.log(n)/Math.LN2-8,0),s=Math.round(a),l=1<<s,c=Math.pow(2,a-s+8),u=r[0]-n/2,d=r[1]-n/2,h=Math.max(i?0:-1/0,Math.floor((0-u)/c)),f=Math.min(i?l:1/0,Math.ceil((t[0]-u)/c)),p=Math.max(o?0:-1/0,Math.floor((0-d)/c)),m=Math.min(o?l:1/0,Math.ceil((t[1]-d)/c)),g=[];for(let e=p;m>e;++e)for(let t=h;f>t;++t)g.push([t,e,s]);return{tiles:g,translate:[u/c,d/c],scale:c}}({size:[i,o],scale:2*c*Math.PI,translate:u}),h=ar(l,[i,o]),f=function(e){if("string"==typeof e)return"template:"+e;const t=e;let n=Md.get(t);return null==n&&(n=jd++,Md.set(t,n)),"provider:"+n}(n);let p=!0;for(const t of d.tiles){const[r,i,o]=Fr(t),l=Wr(n,o,r,i,h),c=`${f}|dpr:${h}|${o}/${r}/${i}|${l}`;let u=a.get(c);if(!u){const e=new Image;e.crossOrigin="anonymous";const t={img:e,loaded:!1,failed:!1,key:c,lastUsed:performance.now()};a.set(c,t),e.onload=()=>{t.loaded=!0,s?.()},e.onerror=()=>{t.loaded=!0,t.failed=!0,s?.()},e.src=l,u=t}if(!u.loaded){p=!1;continue}if(u.failed)continue;const m=d.scale;e.drawImage(u.img,(t[0]+d.translate[0])*m-.5,(t[1]+d.translate[1])*m-.5,m+1,m+1)}}(n,{tileURL:C,projection:t.scales.projection,width:Be,height:He,tileCache:mt.current,maxDevicePixelRatio:O,onTileLoad:()=>Xe()}),n.restore())}}if(m){const i=or(e,Fe,We,d);if(!i)return;i.clearRect(-We.left,-We.top,Fe[0],Fe[1]),C||function(e,t){const{background:n,hasBackgroundGraphics:r=!1,themeBackground:i="",x:o=0,y:a=0,width:s,height:l}=t,c=function(e){const{background:t,hasBackgroundGraphics:n=!1,themeBackground:r=""}=e;return"transparent"===t||n?null:t||(r&&"transparent"!==r?r:"")||null}({background:n,hasBackgroundGraphics:r,themeBackground:i});if(!c)return!1;const u=Pt(e,c);!u||"transparent"===u.trim().toLowerCase()||(e.fillStyle=u,e.fillRect(o,a,s,l))}(i,{background:_,themeBackground:dt,hasBackgroundGraphics:!!me,x:-We.left,y:-We.top,width:Fe[0],height:Fe[1]}),i.save(),i.beginPath(),i.rect(0,0,Be,He),i.clip();const o=t.scene,a={width:Be,height:He};if(function(e){const{context:t,nodes:n,renderMode:r,pixelRatio:i,paintBuiltIn:o}=e;if(!r||"sketchy"===r)return void o(n);let a=[];const s=()=>{a.length&&(o(a),a=[])};for(const e of n){const n=Yr(r,e);if(!n){a.push(e);continue}let l;s(),t.save();try{l=n.drawCanvas({context:t,node:e,style:e.style??{},pixelRatio:i})}finally{t.restore()}l||(Xr(n.id,e.type??"unknown"),o([e]))}s()}({context:i,nodes:o,renderMode:W,pixelRatio:d,paintBuiltIn:e=>{!function(e,t){const n=t.filter(e=>"geoarea"===e.type);for(const t of n){if(!t.pathData)continue;t._cachedPath2D||(t._cachedPath2D=new Path2D(t.pathData));const n=t._cachedPath2D,r=Pr(e,t.style.fill)||"#e0e0e0";"none"!==r&&(e.fillStyle=r,e.globalAlpha=(t._decayOpacity??1)*(t.style.fillOpacity??1),e.fill(n));const i=t.style.strokeWidth??.5;if(t.style.stroke&&"none"!==t.style.stroke&&i>0){if(e.strokeStyle=Pt(e,t.style.stroke)||t.style.stroke,e.lineWidth=i,e.globalAlpha=t._decayOpacity??1,t.style.strokeDasharray){const n=t.style.strokeDasharray.split(",").map(Number);e.setLineDash(n)}else e.setLineDash([]);e.stroke(n)}Tr(e,t,n),e.globalAlpha=1,e.setLineDash([])}}(i,e),((e,t,n,r)=>{const i=t.filter(e=>"line"===e.type);for(const t of i){if(2>t.path.length)continue;const n=t._introClipFraction;void 0!==n&&1>n&&(e.save(),e.beginPath(),e.rect(0,0,r.width*n,r.height),e.clip());const i=t.style.stroke||"#007bff",o=Pt(e,i)||i,a=t.style.strokeWidth??2,s=t.colorThresholds,l=t.rawValues;if(e.setLineDash(t.style.strokeDasharray?t.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),a>0&&(e.lineWidth=a),e.lineCap=t.style.strokeLinecap||"butt",t.style._edgeFade&&a>0){_r(e,t.path,o,a,t.style.opacity??1,t.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const c=Rr(t.curve),u=s&&s.length>0&&l&&l.length===t.path.length,d=t._decayOpacities;if(a>0&&d&&d.length===t.path.length&&!u){e.strokeStyle=o;const n=t.style.opacity??1;for(let r=0;t.path.length-1>r;r++)e.globalAlpha=.5*(d[r]+d[r+1])*n,e.beginPath(),e.moveTo(t.path[r][0],t.path[r][1]),e.lineTo(t.path[r+1][0],t.path[r+1][1]),e.stroke()}else if(a>0&&!u){e.beginPath();const n=t.strokeGradient&&t.path.length>=2?Nr(e,t.strokeGradient,o,t.path[0][0],0,t.path[t.path.length-1][0],0):null;if(e.strokeStyle=n||o,c)(0,Sd.line)().x(e=>e[0]).y(e=>e[1]).curve(c).context(e)(t.path);else{const[n,r]=t.path[0];e.moveTo(n,r);for(let n=1;t.path.length>n;n++)e.lineTo(t.path[n][0],t.path[n][1])}e.stroke()}else if(a>0){const n=zr(t.path,l,s,o);for(const t of n){e.beginPath(),e.strokeStyle=Pt(e,t.color)||t.color,e.moveTo(t.path[0][0],t.path[0][1]);for(let n=1;t.path.length>n;n++)e.lineTo(t.path[n][0],t.path[n][1]);e.stroke()}}if(t.style.fill&&t.style.fillOpacity&&t.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=t.style.fillOpacity,e.fillStyle=Lr(e,t.style.fill,t.style.fill),c&&!u)(0,Sd.line)().x(e=>e[0]).y(e=>e[1]).curve(c).context(e)(t.path);else{const[n,r]=t.path[0];e.moveTo(n,r);for(let n=1;t.path.length>n;n++)e.lineTo(t.path[n][0],t.path[n][1])}const n=t.path[0][0];e.lineTo(t.path[t.path.length-1][0],r.height),e.lineTo(n,r.height),e.closePath(),e.fill()}void 0!==n&&1>n&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}})(i,e,0,a),((e,t)=>{const n=t.filter(e=>"point"===e.type);if(0!==n.length){e.save();try{const t=e.globalAlpha;let r=[],i="";const o=n=>{e.beginPath(),e.arc(n.x,n.y,n.r,0,2*Math.PI),e.globalAlpha=t*(n.style.opacity??n.style.fillOpacity??1),e.fillStyle=Lr(e,n.style.fill,"#4e79a7"),e.fill();const r=n.style.strokeWidth??1;n.style.stroke&&"none"!==n.style.stroke&&r>0&&(e.strokeStyle=Lr(e,n.style.stroke,n.style.stroke),e.lineWidth=r,e.stroke()),function(e,t,n=.6){if(!Ir(t))return;const r=t.r+(t._pulseGlowRadius??4)*t._pulseIntensity,i=t.cx??t.x??0,o=t.cy??t.y??0;e.beginPath(),e.arc(i,o,r,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*n,e.stroke()}(e,n)},a=()=>{if(0===r.length)return;if(1===r.length)return o(r[0]),r=[],void(i="");const n=r[0];e.globalAlpha=t*(n.style.opacity??n.style.fillOpacity??1),e.beginPath();for(const t of r)e.moveTo(t.x+t.r,t.y),e.arc(t.x,t.y,t.r,0,2*Math.PI);e.fillStyle=Lr(e,n.style.fill,"#4e79a7"),e.fill();const a=n.style.strokeWidth??1;n.style.stroke&&"none"!==n.style.stroke&&a>0&&(e.strokeStyle=Lr(e,n.style.stroke,n.style.stroke),e.lineWidth=a,e.stroke()),r=[],i=""};for(const e of n){const t=e.style.opacity??e.style.fillOpacity??1,n=e.style.fill;if(Ir(e)||null!=n&&"string"!=typeof n||1>t){a(),o(e);continue}const s=e.style.strokeWidth??1,l=`${n??"#4e79a7"}\0${e.style.stroke&&"none"!==e.style.stroke&&s>0?e.style.stroke+"":""}\0${s}\0${e.r}\0${t}`;r.length>0&&l!==i&&a(),i=l,r.push(e),2048>r.length||a()}a()}finally{e.restore()}}})(i,e),((e,t)=>{const n=e.globalAlpha;for(const r of t)"glyph"===r.type&&Or(e,r,r.x,r.y,n);e.globalAlpha=n})(i,e)}}),h&&Nt.current){const e=Nt.current,t=o.filter(e=>"line"===e.type);if(t.length>0){const o=A||{},a=.3*(o.speedMultiplier??1),s=o.maxPerLine??ai(),l=o.spawnRate??(oi()?.06:.15),c=o.radius??2,u=o.opacity??.7,d=n/1e3,h=Et.current>0?Math.min(d-Et.current,.1):.016;Et.current=d;const f=t.map(e=>e.path),p=t.map(e=>e.style.strokeWidth??2);for(let n=0;t.length>n;n++)Ve.random()<l&&e.countForLine(n)<s&&e.spawn(n,Ve.random);e.step(h,a,f,p),i.globalAlpha=u;for(let n=0;e.particles.length>n;n++){const r=e.particles[n];if(!r.active)continue;const a=t[r.lineIndex],s="function"==typeof o.color?o.color(a?.datum??{}):"source"!==o.color&&o.color?o.color:a?.style.stroke||"#fff";i.beginPath(),i.arc(r.x,r.y,c,0,2*Math.PI),i.fillStyle=s,i.fill()}i.globalAlpha=1,r=!0}}i.restore()}(u||a&&!s)&&e.setAttribute("aria-label",vr(t.scene,"Geographic chart"));const y=Dt.current,v=!(!y||"geoarea"!==y.type&&"point"!==y.type),b=v||zt.current;const x=tn.current;if(x&&b){const e=or(x,Fe,We,d);if(e){if(e.clearRect(-We.left,-We.top,Fe[0],Fe[1]),y&&"geoarea"===y.type){const t=new Path2D(y.pathData);e.fillStyle="rgba(255, 255, 255, 0.3)",e.fill(t),e.strokeStyle="rgba(0, 0, 0, 0.5)",e.lineWidth=2,e.stroke(t)}if(y&&"point"===y.type){const t=y,n="object"==typeof V?V:void 0,r=n?.pointColor||function(e){if(!e)return null;if("heatcell"===e.type)return e.fill||null;if("candlestick"===e.type)return e.isUp?e.upColor:e.downColor;const{style:t}=e;if(!t)return null;const n="string"==typeof t.fill?t.fill:null;return"line"===e.type||"area"===e.type?t.stroke||n||null:n||t.stroke||null}(y);e.beginPath(),e.arc(t.x,t.y,t.r+3,0,2*Math.PI),r?(e.save(),e.globalAlpha=.4,e.fillStyle=r,e.fill(),e.restore()):(e.fillStyle="rgba(255, 255, 255, 0.4)",e.fill()),e.strokeStyle=r||"rgba(0, 0, 0, 0.5)",e.lineWidth=2,e.stroke()}}zt.current=v}const w=ee!==yt.current;w&&(yt.current=ee),(u||w||a&&ee&&ee.length>0)&&(u||w||a&&!s||n-$t.current>=33)&&(Ht(e=>e+1),$t.current=n),(l||null!=t.activeTransition||p.pending||r)&&Xe()},function(e,t,n,r,i,o,a){const s=(0,$c.useRef)("fresh");(0,$c.useEffect)(()=>{if(!e)return void(s.current="fresh");const l=setInterval(()=>{const l=t.current;if(!l||0===l.lastIngestTime)return;const c=function(e,t){if(!e||0>=t)return Gc;const n=null!=e.threshold&&e.threshold>0?e.threshold:5e3,r=e.graded;if(r){const e="object"==typeof r?r:{},i=function(e,t,n={}){return Number.isFinite(t)&&t>0?Number.isNaN(e)?"fresh":e===1/0?"expired":0>e||t*(n.fresh??al)>e?"fresh":t*(n.aging??sl)>e?"aging":t*(n.stale??ll)>e?"stale":"expired":"fresh"}(t,n,e.thresholds);return{alpha:{...qc,...e.opacities??{}}[i],band:i,isStale:"fresh"!==i}}return t>n?{alpha:e.dimOpacity??.5,band:"stale",isStale:!0}:Gc}(e,i()-l.lastIngestTime);c.band===s.current&&c.isStale===o||(s.current=c.band,c.isStale!==o&&a(c.isStale),n.current=!0,r())},1e3);return()=>clearInterval(l)},[e,o,r,i,t,a,n])}(le,it,De,Xe,Ve.now,qt,Gt),(0,ma.useEffect)(()=>{if("production"!==process.env.NODE_ENV&&C){const e=si(n);e&&"mercator"!==e&&console.warn(`[StreamGeoFrame] tileURL is set but projection is "${e}". Raster tiles use Web Mercator and will not align with other projections.`)}},[C,n]),(0,ma.useEffect)(()=>{const e=kt.current;if(!w||!e)return vt.current&&e&&((0,wd.select)(e).on(".zoom",null),vt.current=null),void(e&&(0,wd.select)(e).on("mousedown.rotate",null).on("touchstart.rotate",null));const[t,n]=k||[1,8],r={width:Be,height:He};if(nt){let i=bt.current.k;const o=e=>{i=Math.max(t,Math.min(n,e)),bt.current=xd.zoomIdentity.scale(i);const o=it.current;o&&(o.applyZoomScale(i,r),De.current=!1,Xe(),o.scales?.projection&&S?.({projection:o.scales.projection,zoom:o.currentZoom}))};vt.current={scaleBy:(e,t)=>o(i*t),transform:(e,t)=>o(t?.k??1)};const a=e=>{e.preventDefault(),o(i*(0>e.deltaY?1.1:1/1.1))},s=e=>{const t=e.target;t&&(t.closest("button")||t.closest(".stream-geo-zoom-controls"))||(e.preventDefault(),o(1.5*i))};e.addEventListener("wheel",a,{passive:!1}),e.addEventListener("dblclick",s);const l=.4,c=t=>{if(0!==t.button)return;const n=t.target;if(n.closest("button")||n.closest(".stream-geo-zoom-controls"))return;const r=it.current;if(!r)return;const i=r.getRotation();Ct.current={x:t.clientX,y:t.clientY,rotation:[...i]},e.setPointerCapture(t.pointerId),t.preventDefault()},u=e=>{const t=Ct.current;t&&(Lt.current=[t.rotation[0]+(e.clientX-t.x)*l,Math.max(-90,Math.min(90,t.rotation[1]-(e.clientY-t.y)*l)),t.rotation[2]],Xe())},d=t=>{if(!Ct.current)return;Ct.current=null,e.releasePointerCapture(t.pointerId);const n=Lt.current;if(n){Lt.current=null;const e=it.current;e&&(e.applyRotation(n,r),Xe())}const i=it.current;i?.scales?.projection&&S?.({projection:i.scales.projection,zoom:i.currentZoom})};return e.addEventListener("pointerdown",c),e.addEventListener("pointermove",u),e.addEventListener("pointerup",d),e.addEventListener("pointercancel",d),()=>{e.removeEventListener("wheel",a),e.removeEventListener("dblclick",s),e.removeEventListener("pointerdown",c),e.removeEventListener("pointermove",u),e.removeEventListener("pointerup",d),e.removeEventListener("pointercancel",d),vt.current=null}}const i=(0,xd.zoom)().scaleExtent([t,n]).extent([[0,0],[Fe[0],Fe[1]]]).translateExtent([[-1/0,-1/0],[1/0,1/0]]).on("zoom",e=>{const t=e.transform;bt.current=t,xt.current=!0;const n=it.current;n&&(n.applyZoomTransform(t,r),De.current=!1,Xe())}).on("end",e=>{bt.current=e.transform,xt.current=!1;const t=it.current;t?.scales?.projection&&S?.({projection:t.scales.projection,zoom:t.currentZoom})});return vt.current=i,(0,wd.select)(e).call(i),()=>{(0,wd.select)(e).on(".zoom",null)}},[w,k,nt,Fe,Be,He,We,S,Xe]);const un=G&&!1!==V,dn=un&&Wt?U?U(Wt):(0,Vd.jsx)(ii,{data:Wt}):null,hn=dn?(0,Vd.jsx)(Cr,{x:Wt.x,y:Wt.y,containerWidth:Be,containerHeight:He,margin:We,className:"stream-frame-tooltip",zIndex:10,children:dn}):null;if(lt){const e=ot.scene;return(0,Vd.jsxs)("div",{ref:Mt,className:"stream-geo-frame"+(z?" "+z:""),role:"img","aria-label":Le||("string"==typeof ye?ye:"Geographic chart"),style:{position:"relative",fontFamily:"var(--semiotic-font-family, sans-serif)",width:I?"100%":Fe[0],height:T?"100%":Fe[1]},children:[(0,Vd.jsx)(xr,{summary:Pe}),(0,Vd.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:Fe[0],height:Fe[1],style:{position:"absolute",left:0,top:0},children:[ht?(0,Vd.jsx)("rect",{className:"stream-frame-background__backdrop",x:0,y:0,width:Fe[0],height:Fe[1],fill:ht}):null,(0,Vd.jsx)("g",{transform:`translate(${We.left},${We.top})`,children:ut}),(0,Vd.jsx)("g",{transform:`translate(${We.left},${We.top})`,children:e.map((e,t)=>{return n={node:e,index:t,renderMode:W,fallback:()=>function(e,t){return ir(function(e,t){switch(e.type){case"geoarea":{const n=e;if(!n.pathData)return null;const r=bn(n.style.fill)?kn(n.style.fill,`geoarea-${t}-hatch`):void 0;return(0,Du.jsxs)(Nu.Fragment,{children:[r&&(0,Du.jsx)("defs",{children:r}),(0,Du.jsx)("path",{d:n.pathData,fill:r?`url(#geoarea-${t}-hatch)`:tr(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-"+t)}case"point":{const n=e,r=bn(n.style.fill)?kn(n.style.fill,`geopoint-${t}-hatch`):void 0;return(0,Du.jsxs)(Nu.Fragment,{children:[r&&(0,Du.jsx)("defs",{children:r}),(0,Du.jsx)("circle",{cx:n.x,cy:n.y,r:n.r,fill:r?`url(#geopoint-${t}-hatch)`:tr(n.style.fill),fillOpacity:n.style.fillOpacity??.8,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n._decayOpacity??n.style.opacity??1})]},"point-"+t)}case"line":{const n=e;if(2>n.path.length)return null;const r="M"+n.path.map(e=>`${e[0]},${e[1]}`).join("L");return(0,Du.jsx)("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-"+t)}case"glyph":return function(e,t,n,r){const i=e.glyph;if(!i?.parts?.length||0>=e.size)return null;const o=wt(i,e.size);if(0>=o.scale)return null;const a=`translate(${t},${n})${e.rotation?` rotate(${180*e.rotation/Math.PI})`:""} translate(${o.offsetX},${o.offsetY}) scale(${o.scale})`,s=e.color??("string"==typeof e.style.fill?e.style.fill:void 0),l=jt(i,e.fraction??1,e.fractionStart??0,e.fractionDirection??"horizontal"),c=l?function(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}(r+"-clip"):void 0,u=(e.style.opacity??1)*(e._decayOpacity??1)*(e.style.fillOpacity??1),d=t=>i.parts.map((n,r)=>{const i=t?"none"===n.fill?void 0:t:St(n.fill,s,e.accent),o=t?n.stroke&&"none"!==n.stroke?t:void 0:St(n.stroke??"none",s,e.accent);return i||o?(0,Eu.jsx)("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(0,Eu.jsxs)("g",{transform:a,opacity:1===u?void 0:u,children:[l&&c&&(0,Eu.jsx)("clipPath",{id:c,children:(0,Eu.jsx)("rect",{x:l.x,y:l.y,width:l.width,height:l.height})}),l&&e.ghostColor?(0,Eu.jsx)("g",{children:d(e.ghostColor)}):null,l&&c?(0,Eu.jsx)("g",{clipPath:`url(#${c})`,children:d()}):d()]},r)}(e,e.x,e.y,"geo-glyph-"+(e.pointId??t));default:return null}}(e,t),e,"geo-cursor-"+t)}(e,t)},function(e){const{node:t,index:n,renderMode:r,fallback:i}=e,o=Yr(r,t);if(!o)return{element:i(),renderedByBackend:!1};const a=o.renderStaticSVG({node:t,style:t.style??{},key:`${o.id}-${n}`});return null!=a?{element:ir(a,t,`${o.id}-${n}-cursor`),renderedByBackend:!0}:(Xr(o.id,t.type??"unknown"),{element:i(),renderedByBackend:!1})}(n).element;var n})})]}),(0,Vd.jsx)(er,{width:Be,height:He,totalWidth:Fe[0],totalHeight:Fe[1],margin:We,showAxes:!1,title:ye,description:Le,legend:ve,legendPosition:be,legendLayout:xe,legendHoverBehavior:we,legendClickBehavior:ke,legendHighlightedCategory:Se,legendIsolatedCategories:Me,foregroundGraphics:Gr(ct,Ur(it.current?.customLayoutOverlays,d??null)),annotations:ee,onAnnotationActivate:te,onObservation:Q??K,chartId:J,chartType:"StreamGeoFrame",autoPlaceAnnotations:ne,svgAnnotationRules:re,pointNodes:Zr(e),geoProjection:it.current?.scales?.projectedPoint})]})}return(0,Vd.jsxs)("div",{ref:Mt,className:"stream-geo-frame"+(z?" "+z:""),role:"group","aria-label":Le||("string"==typeof ye?ye:"Geographic chart"),tabIndex:0,style:{position:"relative",fontFamily:"var(--semiotic-font-family, sans-serif)",width:I?"100%":Fe[0],height:T?"100%":Fe[1],overflow:Y?"visible":"hidden",...w?{touchAction:"none"}:{}},onKeyDown:sn,children:["production"!==process.env.NODE_ENV&&it.current&&(0,Vd.jsx)(rc,{store:it.current,diagnostics:Ot.current}),Re&&(0,Vd.jsxs)(yr,{accessibleTable:Re,children:[(0,Vd.jsx)(wr,{tableId:Ge}),(0,Vd.jsx)(br,{scene:it.current?.scene??[],chartType:"Geographic chart",tableId:Ge,chartTitle:"string"==typeof ye?ye:void 0})]}),(0,Vd.jsx)(xr,{summary:Pe}),(0,Vd.jsx)(fr,{hoverPoint:Wt}),(0,Vd.jsxs)("div",{role:"img","aria-label":Le||("string"==typeof ye?ye:"Geographic chart"),style:{position:"relative",width:"100%",height:"100%"},onPointerMove:ln,onPointerLeave:Qt,onPointerDown:un||Ie?cn:void 0,onClick:Ie?rn:void 0,children:[(0,Vd.jsx)(lr,{size:Fe,margin:We,backdropFill:ht??void 0,children:ut}),C&&(0,Vd.jsx)("canvas",{ref:ft,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),(0,Vd.jsx)("canvas",{ref:en,"aria-label":vr(it.current?.scene??[],"Geographic chart"),style:{position:"absolute",left:0,top:0}}),(0,Vd.jsx)("canvas",{ref:tn,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),(0,Vd.jsx)(er,{width:Be,height:He,totalWidth:Fe[0],totalHeight:Fe[1],margin:We,showAxes:Ce,title:ye,description:Le,legend:ve,legendPosition:be,legendLayout:xe,legendHoverBehavior:we,legendClickBehavior:ke,legendHighlightedCategory:Se,legendIsolatedCategories:Me,foregroundGraphics:Gr(ct,Ur(it.current?.customLayoutOverlays,d??null)),annotations:ee,onAnnotationActivate:te,onObservation:Q??K,chartId:J,chartType:"StreamGeoFrame",autoPlaceAnnotations:ne,svgAnnotationRules:re,pointNodes:Zr(it.current?.scene),geoProjection:it.current?.scales?.projectedPoint}),le?.showBadge&&(0,Vd.jsx)(Xt,{isStale:qt,position:le.badgePosition}),w&&(0,Vd.jsxs)("div",{className:"stream-geo-zoom-controls",style:{position:"absolute",bottom:We.bottom+8,left:We.left+8,display:"flex",flexDirection:"column",gap:2,zIndex:2},children:[(0,Vd.jsx)("button",{type:"button","aria-label":"Zoom in",onClick:e=>{e.stopPropagation();const t=kt.current,n=vt.current;t&&n?.scaleBy&&n.scaleBy((0,wd.select)(t),1.5)},style:Wd,children:"+"}),(0,Vd.jsx)("button",{type:"button","aria-label":"Zoom out",onClick:e=>{e.stopPropagation();const t=kt.current,n=vt.current;t&&n?.scaleBy&&n.scaleBy((0,wd.select)(t),1/1.5)},style:Wd,children:"−"})]}),R&&(0,Vd.jsx)("div",{className:"stream-geo-tile-attribution",style:{position:"absolute",bottom:We.bottom+2,right:We.right+4,fontSize:10,color:"rgba(0,0,0,0.6)",background:"rgba(255,255,255,0.7)",padding:"1px 4px",borderRadius:2,pointerEvents:"none",zIndex:2},children:R}),(0,Vd.jsx)(kr,{active:on.current>=0,hoverPoint:Wt,margin:We,size:Fe,shape:an.current?.shape,width:an.current?.w,height:an.current?.h,pathData:an.current?.pathData}),hn]})]})}));Ud.displayName="StreamGeoFrame";var Yd=Ud,Xd=require("react"),Zd=require("react"),Kd=require("./semiotic-client-cjs-shared.min.js"),Qd=.5,Jd=require("./semiotic-client-cjs-shared.min.js"),eh=require("./semiotic-client-cjs-shared.min.js"),th=require("./semiotic-client-cjs-shared.min.js"),nh=require("./semiotic-client-cjs-shared.min.js"),rh=44,ih={enabled:!0,tapToSelect:!0,tapToLockTooltip:!0,clearSelection:"backgroundTap",targetSize:rh,snap:"nearestDatum",brushHandleSize:rh,standardControls:!1,enabled:!1,tapToSelect:!1,tapToLockTooltip:!1},oh={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}}},ah={top:10,bottom:10,left:10,right:10},sh=require("react"),lh=require("react"),ch=(require("./semiotic-client-cjs-shared.min.js"),require("./semiotic-client-cjs-shared.min.js"),require("./semiotic-client-cjs-shared.min.js"),require("./semiotic-client-cjs-shared.min.js"),require("./semiotic-client-cjs-shared.min.js"),require("./semiotic-client-cjs-shared.min.js"),require("react/jsx-runtime"),(0,lh.createContext)(!1)),uh=((0,lh.createContext)(!1),(0,lh.createContext)(null)),dh="undefined"==typeof window?lh.useEffect:lh.useLayoutEffect,hh=[],fh=require("react/jsx-runtime"),ph=Go(require("react")),mh=require("react/jsx-runtime"),gh=class extends ph.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){this.props.onError?.(e,t)}render(){if(this.state.error){const{fallback:e}=this.props,t=this.state.error;return"function"==typeof e?e(t):void 0!==e?e:(0,mh.jsx)(Hi,{componentName:"ChartErrorBoundary",message:t.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}},yh=require("react/jsx-runtime"),vh="undefined"!=typeof process&&"production"!==process.env?.NODE_ENV,bh={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"},xh={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2},wh=require("react"),kh=require("./semiotic-client-cjs-shared.min.js"),Sh=require("d3-scale"),Mh=require("react"),jh=require("topojson-client"),Ah=new Map,Ch="Install the optional peer dependency `world-atlas` (`npm install world-atlas`) to use built-in reference geographies, or pass GeoJSON Feature[] to `areas`.",Rh=require("react/jsx-runtime");eo.displayName="ChoroplethMap";var Lh=require("react"),Ph=require("react"),Nh=require("./semiotic-client-cjs-shared.min.js"),Eh=require("react"),Ih={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},Th=require("react/jsx-runtime"),Dh=[3,30],zh=[1,4],_h=(0,Lh.forwardRef)(function(e,t){const n=(0,Lh.useRef)(null);no(t,{variant:"geo-points",frameRef:n});const r=Ii(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,enableHover:e.enableHover,linkedHover:e.linkedHover,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{points:i,xAccessor:o="lon",yAccessor:a="lat",sizeBy:s,sizeRange:l,colorBy:c,styleRules:u,colorScheme:d,projection:h="equalEarth",graticule:f,fitPadding:p,zoomable:m,zoomExtent:g,onZoom:y,dragRotate:v,tileURL:b,tileAttribution:x,tileCacheSize:w,areas:k,areaStyle:S=Ih,tooltip:M,annotations:j,margin:A,className:C,selection:R,linkedHover:L,onObservation:P,onClick:N,chartId:E,loading:I,loadingContent:T,emptyContent:D,legendInteraction:z,legendPosition:_,frameProps:O={},stroke:F,strokeWidth:W,opacity:B}=e,H=l??("sparkline"===r.mode?zh:Dh),$="sparkline"===r.mode?1.5:6,q=m??!!b,G=Zi(k),V=to({data:i??Kl,rawData:i,colorBy:c,colorScheme:d,legendInteraction:z,legendPosition:_,frameLegend:O,selection:R,linkedHover:L,fallbackFields:c?["string"==typeof c?c:""]:[],unwrapData:!1,onObservation:P,onClick:N,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"ProportionalSymbolMap",chartId:E,showLegend:r.showLegend,userMargin:A,marginDefaults:wi(r),loading:I,loadingContent:T,emptyContent:D,width:r.width,height:r.height,hasTitle:!!r.title}),U=V.data,Y=(0,Lh.useMemo)(()=>{if(!s)return;const e="function"==typeof s?s:e=>e?.[s],t=U.filter(Boolean).map(t=>e(t)).filter(e=>null!=e&&isFinite(e));return 0!==t.length?dt(t):void 0},[U,s]),X=(0,Lh.useMemo)(()=>{const e=Ti(Bi(e=>({fill:c?Ke(e,c,V.colorScale):Al,fillOpacity:.7,stroke:"#fff",strokeWidth:.5,r:s?et(e,s,H,Y):$}),u,zi(c,s)),{stroke:F,strokeWidth:W,opacity:B});return V.effectiveSelectionHook?gi(e,V.effectiveSelectionHook,V.resolvedSelection):e},[c,V.colorScale,V.effectiveSelectionHook,V.resolvedSelection,s,H,Y,$,F,W,B,u]),Z=(0,Lh.useMemo)(()=>e=>{const t=e?.name||e?.label||e?.NAME||e?.id,n="string"==typeof s?s:null,r=("function"==typeof s?s:e=>e[s])(e),i=e=>"number"==typeof e&&isFinite(e)?Number.isInteger(e)?e.toLocaleString():e.toLocaleString(void 0,{maximumFractionDigits:2}):(e??"")+"",o="string"==typeof c?c:null,a=o?e?.[o]:null;return(0,Th.jsxs)("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[t&&(0,Th.jsx)("div",{style:{fontWeight:600,marginBottom:2},children:t}),n&&null!=r&&(0,Th.jsxs)("div",{children:[(0,Th.jsxs)("span",{style:{opacity:.7},children:[n,": "]}),i(r)]}),o&&null!=a&&(0,Th.jsxs)("div",{children:[(0,Th.jsxs)("span",{style:{opacity:.7},children:[o,": "]}),a+""]}),!t&&!n&&Object.entries(e).filter(([e])=>"data"!==e&&"x"!==e&&"y"!==e&&"time"!==e).slice(0,4).map(([e,t])=>(0,Th.jsxs)("div",{children:[(0,Th.jsxs)("span",{style:{opacity:.7},children:[e,": "]}),i(t)]},e))]})},[s,c]);if(V.earlyReturn)return V.earlyReturn;Vi("ProportionalSymbolMap",U,"xAccessor",o),Vi("ProportionalSymbolMap",U,"yAccessor",a);const K={projection:h,...null!=i&&{points:U},xAccessor:o,yAccessor:a,pointStyle:X,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...G&&{areas:G,areaStyle:S},...null!=f&&{graticule:f},...null!=p&&{fitPadding:p},...q&&{zoomable:!0},...g&&{zoomExtent:g},...y&&{onZoom:y},...null!=v&&{dragRotate:v},...b&&{tileURL:b},...x&&{tileAttribution:x},...w&&{tileCacheSize:w},size:[r.width,r.height],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,maxDevicePixelRatio:e.maxDevicePixelRatio,margin:V.margin,enableHover:r.enableHover,tooltipContent:!1===M?()=>null:ri(M)||Z,...V.legendBehaviorProps,...Qi({linkedHover:L,selection:R,onObservation:P,onClick:N,mobileInteraction:V.mobileInteraction,customHoverBehavior:V.customHoverBehavior,customClickBehavior:V.customClickBehavior,linkedHoverInClickPredicate:!1}),...j&&j.length>0&&{annotations:j},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...r.title&&{title:r.title},...r.description&&{description:r.description},...r.summary&&{summary:r.summary},...void 0!==r.accessibleTable&&{accessibleTable:r.accessibleTable},...C&&{className:C},...null!=e.animate&&{animate:e.animate},...O};return(0,Th.jsx)($i,{componentName:"ProportionalSymbolMap",width:r.width,height:r.height,children:(0,Th.jsx)(Yd,{ref:n,...K})})});_h.displayName="ProportionalSymbolMap";var Oh=require("react"),Fh=require("./semiotic-client-cjs-shared.min.js"),Wh=require("./semiotic-client-cjs-shared.min.js"),Bh=require("react/jsx-runtime"),Hh="__semiotic_x",$h="__semiotic_y",qh=(0,Oh.forwardRef)(function(e,t){const n=Ii(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,enableHover:e.enableHover,linkedHover:e.linkedHover,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{flows:r,nodes:i,nodeIdAccessor:o="id",xAccessor:a="lon",yAccessor:s="lat",valueAccessor:l="value",projection:c="equalEarth",graticule:u,fitPadding:d,zoomable:h,zoomExtent:f,onZoom:p,dragRotate:m,tileURL:g,tileAttribution:y,tileCacheSize:v,lineType:b="geo",flowStyle:x="basic",areas:w,areaStyle:k=Ih,edgeColorBy:S,edgeOpacity:M=.6,edgeWidthRange:j=[1,8],pointRadius:A,edgeLinecap:C="round",colorScheme:R,styleRules:L,showParticles:P,particleStyle:N,tooltip:E,annotations:I,margin:T,className:D,selection:z,linkedHover:_,onObservation:O,onClick:F,chartId:W,loading:B,loadingContent:H,emptyContent:$,frameProps:q={},legendInteraction:G,legendPosition:V,stroke:U,strokeWidth:Y,opacity:X,lineIdAccessor:Z}=e,K=h??!!g,Q=Zi(w),J=(0,Oh.useMemo)(()=>gt(i),[i]),ee=to({data:r??Kl,rawData:r,colorBy:S,colorScheme:R,legendInteraction:G,legendPosition:V,frameLegend:q,selection:z,linkedHover:_,fallbackFields:S?["string"==typeof S?S:""]:[],unwrapData:!1,onObservation:O,onClick:F,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"FlowMap",chartId:W,showLegend:n.showLegend,userMargin:T,marginDefaults:wi(n),loading:B,loadingContent:H,emptyContent:$,width:n.width,height:n.height,hasTitle:!!n.title}),te=ee.data,ne=mi(_),re=(0,Fh.useLinkedHover)({name:ne?.name||"hover",fields:ne?.fields||[]}),ie=(0,Wh.useObservationSelector)(e=>e.pushObservation),oe=(0,Oh.useMemo)(()=>{const e=new Map;for(const t of J)e.set(t[o]+"",t);return e},[J,o]),ae=(0,Oh.useRef)(null),se=(0,Oh.useRef)(oe);se.current=oe;const le=(0,Oh.useRef)(a);le.current=a;const ce=(0,Oh.useRef)(s);ce.current=s;const ue=(0,Oh.useCallback)(e=>{if(!e||"object"!=typeof e||null==e.source||null==e.target)return null;const t=se.current,n=t.get(e.source+""),r=t.get(e.target+"");if(!n||!r)return null;const i="function"==typeof le.current?le.current:e=>e[le.current],o="function"==typeof ce.current?ce.current:e=>e[ce.current];return{...e,coordinates:[{[Hh]:i(n),[$h]:o(n)},{[Hh]:i(r),[$h]:o(r)}]}},[]);no(t,{variant:"geo-lines",frameRef:ae,overrides:{push:e=>{const t=ue(e);t&&ae.current?.pushLine(t)},pushMany:e=>{const t=[];for(const n of e){const e=ue(n);e&&t.push(e)}t.length>0&&ae.current?.pushManyLines(t)}}});const de=(0,Oh.useMemo)(()=>{const e=new Map;for(const t of te)t&&"object"==typeof t&&(null==t.source||e.has(t.source)||e.set(t.source,t),null==t.target||e.has(t.target)||e.set(t.target,t));return e},[te]),he=(0,Oh.useCallback)(e=>{if(_)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"point"===e.type){const e=de.get(t[o]+"");e&&re.onHover(e)}else re.onHover(t)}else re.onHover(null);if(O||ie){const t={timestamp:Date.now(),chartType:"FlowMap",chartId:W};if(e){let n=e.data||e.datum||e;Array.isArray(n)&&(n=n[0]);const r={...t,type:"hover",datum:n||{},x:e.x??0,y:e.y??0};O&&O(r),ie&&ie(r)}else{const e={...t,type:"hover-end"};O&&O(e),ie&&ie(e)}}},[_,re,o,de,O,W,ie]),fe=ee.customClickBehavior,pe=(0,Oh.useMemo)(()=>{const e="function"==typeof a?a:e=>e[a],t="function"==typeof s?s:e=>e[s];return te.map(n=>{if(!n||"object"!=typeof n||null==n.source||null==n.target)return null;const r=oe.get(n.source+""),i=oe.get(n.target+"");return r&&i?{...n,coordinates:[{[Hh]:e(r),[$h]:t(r)},{[Hh]:e(i),[$h]:t(i)}]}:null}).filter(Boolean)},[te,oe,a,s]),me=(0,Oh.useMemo)(()=>{const e="function"==typeof a?a:e=>e[a];return t=>null!=t&&"object"==typeof t&&Hh in t?t[Hh]:e(t)},[a]),ge=(0,Oh.useMemo)(()=>{const e="function"==typeof s?s:e=>e[s];return t=>null!=t&&"object"==typeof t&&$h in t?t[$h]:e(t)},[s]),ye=(0,Oh.useMemo)(()=>{const e=te.filter(e=>e&&"object"==typeof e).map(e=>Number(e[l]??0)).filter(e=>Number.isFinite(e));if(0!==e.length)return dt(e)},[te,l]),ve=(0,Oh.useMemo)(()=>function(e){const{valueAccessor:t,valueDomain:n,edgeWidthRange:r,resolveStroke:i,edgeOpacity:o,edgeLinecap:a,styleRules:s}=e,l=Di(t);return Bi(e=>({stroke:i(e),strokeWidth:ro(e[t],n,r),strokeLinecap:a,opacity:o,fillOpacity:0}),s,e=>({value:l(e)}))}({valueAccessor:l,valueDomain:ye,edgeWidthRange:j,resolveStroke:e=>S?Ke(e,S,ee.colorScale):Al,edgeOpacity:M,edgeLinecap:C,styleRules:L}),[l,ye,j,S,ee.colorScale,M,C,L]),be=(0,Oh.useMemo)(()=>{const e=Ti(ve,{stroke:U,strokeWidth:Y,opacity:X});if(!ee.effectiveSelectionHook)return e;const t={...ee.resolvedSelection?.unselectedStyle||{},fillOpacity:0};return gi(e,ee.effectiveSelectionHook,{...ee.resolvedSelection||{},unselectedStyle:t})},[ve,ee.effectiveSelectionHook,ee.resolvedSelection,U,Y,X]),xe=A??("sparkline"===n.mode?1.5:5),we=(0,Oh.useMemo)(()=>Ti(()=>({fill:"#333",r:xe,fillOpacity:.8}),{stroke:U,strokeWidth:Y,opacity:X}),[xe,U,Y,X]),ke=(0,Oh.useMemo)(()=>e=>{if(e?.geometry||e?.properties||e?.data?.geometry){const t=e?.properties?.name||e?.properties?.NAME||e?.name||e?.NAME||e?.data?.properties?.name||e?.data?.properties?.NAME;if(t)return(0,Bh.jsx)("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:(0,Bh.jsx)("div",{style:{fontWeight:600},children:t})})}if(null!=e?.source&&null!=e?.target){const t=e[l];return(0,Bh.jsxs)("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[(0,Bh.jsxs)("div",{style:{fontWeight:600},children:[e.source," → ",e.target]}),null!=t&&(0,Bh.jsx)("div",{style:{opacity:.7},children:"number"==typeof t?t.toLocaleString():t})]})}const t=e?.name||e?.label||e?.[o];return null!=t?(0,Bh.jsx)("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:(0,Bh.jsx)("div",{style:{fontWeight:600},children:t})}):null},[l,o]);if(ee.earlyReturn)return ee.earlyReturn;const Se={projection:c,...null!=r&&{lines:pe},points:J,xAccessor:me,yAccessor:ge,lineDataAccessor:"coordinates",...null!=Z&&{lineIdAccessor:Z},lineType:b,flowStyle:x,lineStyle:be,pointStyle:we,...Q&&{areas:Q,areaStyle:k},...null!=u&&{graticule:u},...null!=d&&{fitPadding:d},...K&&{zoomable:!0},...f&&{zoomExtent:f},...p&&{onZoom:p},...null!=m&&{dragRotate:m},...P&&{showParticles:P},...N&&{particleStyle:N},...g&&{tileURL:g},...y&&{tileAttribution:y},...v&&{tileCacheSize:v},size:[n.width,n.height],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,maxDevicePixelRatio:e.maxDevicePixelRatio,margin:ee.margin,enableHover:n.enableHover,tooltipContent:!1===E?()=>null:ri(E)||ke,...ee.legendBehaviorProps,...Qi({linkedHover:_,selection:z,onObservation:O,onClick:F,mobileInteraction:ee.mobileInteraction,customHoverBehavior:he,customClickBehavior:fe,linkedHoverInClickPredicate:!1}),...I&&I.length>0&&{annotations:I},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...n.title&&{title:n.title},...n.description&&{description:n.description},...n.summary&&{summary:n.summary},...void 0!==n.accessibleTable&&{accessibleTable:n.accessibleTable},...D&&{className:D},...null!=e.animate&&{animate:e.animate},...q};return(0,Bh.jsx)($i,{componentName:"FlowMap",width:n.width,height:n.height,children:(0,Bh.jsx)(Yd,{ref:ae,...Se})})});qh.displayName="FlowMap";var Gh=require("react"),Vh=require("react/jsx-runtime"),Uh=require("react/jsx-runtime"),Yh=(0,Gh.forwardRef)(function(e,t){const n=Ii(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,enableHover:e.enableHover,linkedHover:e.linkedHover,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{points:r,lines:i,xAccessor:o="lon",yAccessor:a="lat",nodeIdAccessor:s="id",center:l,costAccessor:c,strength:u=1,lineMode:d="straight",projection:h="mercator",graticule:f,fitPadding:p,zoomable:m,zoomExtent:g,onZoom:y,dragRotate:v,tileURL:b,tileAttribution:x,tileCacheSize:w,transition:k,colorBy:S,styleRules:M,colorScheme:j,pointRadius:A,tooltip:C,showRings:R,showRingLabels:L,ringStyle:P,showNorth:N,costLabel:E,cartogramLayout:I,annotations:T,margin:D,className:z,selection:_,linkedHover:O,onObservation:F,onClick:W,chartId:B,loading:H,loadingContent:$,emptyContent:q,legendPosition:G,frameProps:V={},stroke:U,strokeWidth:Y,opacity:X}=e,Z="sparkline"===n.mode,K=I??(Z?"strip":"radial"),Q=A??(Z?1.5:5),J=R??!0,ee=L??("strip"!==K&&!n.compactMode),te=N??("strip"!==K&&!Z),ne=m??!!b,re=(0,Gh.useMemo)(()=>gt(r),[r]),ie=to({data:re,rawData:r,colorBy:S,colorScheme:j,legendInteraction:void 0,legendPosition:G,frameLegend:V,selection:_,linkedHover:O,fallbackFields:S?["string"==typeof S?S:""]:[],unwrapData:!1,onObservation:F,onClick:W,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"DistanceCartogram",chartId:B,showLegend:n.showLegend,userMargin:D,marginDefaults:wi(n),loading:H,loadingContent:$,emptyContent:q,width:n.width,height:n.height,hasTitle:!!n.title}),oe=(0,Gh.useMemo)(()=>{const e=Ti(Bi(e=>{const t=e?.[s],n=null!=t&&t+""==l+"";return{fill:S?Ke(e,S,ie.colorScale):Al,fillOpacity:n?1:.8,stroke:n?"var(--semiotic-text, #222)":"#fff",strokeWidth:n?1.25:1,r:n?1.35*Q:Q}},M,zi(S)),{stroke:U,strokeWidth:Y,opacity:X});return ie.effectiveSelectionHook?gi(e,ie.effectiveSelectionHook,ie.resolvedSelection):e},[S,ie.colorScale,ie.effectiveSelectionHook,ie.resolvedSelection,Q,U,Y,X,M,l,s]),ae=(0,Gh.useMemo)(()=>({center:l,centerAccessor:s,costAccessor:c,strength:u,lineMode:d,layout:K}),[l,s,c,u,d,K]),se=(0,Gh.useMemo)(()=>{if(!i)return;const e="function"==typeof o?o:e=>e[o],t="function"==typeof a?a:e=>e[a],n=new Map;for(const e of re)n.set(e[s]+"",e);return i.map(r=>{if(r.coordinates)return r;const i=n.get(r.source+""),s=n.get(r.target+"");return i&&s?{...r,coordinates:[{[o]:e(i),[a]:t(i)},{[o]:e(s),[a]:t(s)}]}:null}).filter(Boolean)},[i,re,o,a,s]),le=(0,Gh.useMemo)(()=>e=>{const t=("function"==typeof c?c:e=>e[c])(e);return(0,Uh.jsxs)("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[(0,Uh.jsx)("div",{style:{fontWeight:600},children:e[s]||e.name||e.id||"Point"}),null!=t&&(0,Uh.jsxs)("div",{style:{opacity:.7},children:["Cost: ","number"==typeof t?t.toFixed(1):t]})]})},[c,s]),ce=(0,Gh.useRef)(null);no(t,{variant:"geo-points",frameRef:ce});const[ue,de]=(0,Gh.useState)(null),he=(0,Gh.useCallback)(()=>{const e=ce.current?.getCartogramLayout?.();e&&de(t=>t&&t.cx===e.cx&&t.cy===e.cy&&t.maxCost===e.maxCost&&t.availableRadius===e.availableRadius&&t.layout===(e.layout??"radial")?t:{cx:e.cx,cy:e.cy,maxCost:e.maxCost,availableRadius:e.availableRadius,layout:e.layout??"radial"})},[]);(0,Gh.useEffect)(()=>{const e=requestAnimationFrame(he);return()=>cancelAnimationFrame(e)},[he,u,l,n.width,n.height,re,K]);const fe=(0,Gh.useMemo)(()=>{if(!J||!ue)return[];const{maxCost:e}=ue;if(0>=e)return[];if(Array.isArray(J))return J.filter(t=>t>0&&e>=t);const t="number"==typeof J?J:Math.min("strip"===ue.layout?3:5,Math.max(2,Math.ceil(e/5))),n=e/t,r=[];for(let e=1;t>=e;e++)r.push(Math.round(n*e*10)/10);return r},[J,ue]),pe=(0,Gh.useMemo)(()=>{if(!ue)return V.foregroundGraphics||null;const e=(0,Uh.jsx)(io,{bottomMargin:ie.margin.bottom,costLabel:E,layout:ue,ringStyle:P,ringValues:fe,showNorth:te,showRingLabels:ee,showRings:J}),t=V.foregroundGraphics;return"function"==typeof t?n=>(0,Uh.jsxs)(Uh.Fragment,{children:[e,t(n)]}):(0,Uh.jsxs)(Uh.Fragment,{children:[e,t]})},[ue,fe,J,ee,te,E,P,ie.margin.bottom,V.foregroundGraphics]);if(ie.earlyReturn)return ie.earlyReturn;Vi("DistanceCartogram",re,"xAccessor",o),Vi("DistanceCartogram",re,"yAccessor",a);const me={projection:h,...null!=r&&{points:re},...se&&{lines:se,lineDataAccessor:"coordinates"},xAccessor:o,yAccessor:a,pointIdAccessor:s,pointStyle:oe,projectionTransform:ae,...k&&{transition:{duration:k}},...null!=f&&{graticule:f},...null!=p&&{fitPadding:p},...ne&&{zoomable:!0},...g&&{zoomExtent:g},...y&&{onZoom:y},...null!=v&&{dragRotate:v},...b&&{tileURL:b},...x&&{tileAttribution:x},...w&&{tileCacheSize:w},size:[n.width,n.height],maxDevicePixelRatio:e.maxDevicePixelRatio,margin:ie.margin,enableHover:n.enableHover,tooltipContent:!1===C?()=>null:ri(C)||le,...ie.legendBehaviorProps,...Qi({linkedHover:O,selection:_,onObservation:F,onClick:W,mobileInteraction:ie.mobileInteraction,customHoverBehavior:ie.customHoverBehavior,customClickBehavior:ie.customClickBehavior,linkedHoverInClickPredicate:!1}),...T&&T.length>0&&{annotations:T},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...n.title&&{title:n.title},...n.description&&{description:n.description},...n.summary&&{summary:n.summary},...void 0!==n.accessibleTable&&{accessibleTable:n.accessibleTable},...z&&{className:z},...null!=e.animate&&{animate:e.animate},...V,foregroundGraphics:pe};return(0,Uh.jsx)($i,{componentName:"DistanceCartogram",width:n.width,height:n.height,children:(0,Uh.jsx)(Yd,{ref:ce,...me})})});Yh.displayName="DistanceCartogram";var Xh=require("react"),Zh=require("react"),Kh=require("react/jsx-runtime"),Qh=(0,Xh.forwardRef)(function(e,t){const{points:n,areas:r,lines:i,layout:o,layoutConfig:a,onLayoutError:s,projection:l="equirectangular",xAccessor:c="lon",yAccessor:u="lat",lineDataAccessor:d,colorBy:h,colorScheme:f,tooltip:p,annotations:m,margin:g,selection:y,linkedHover:v,onObservation:b,onClick:x,chartId:w,loading:k,loadingContent:S,emptyContent:M,className:j,frameProps:A={}}=e,{frameRef:C,resolved:R,normalizedMargin:L}=function(e){const t=(0,Zh.useRef)(null);return no(e.imperativeRef,{variant:e.imperativeVariant,frameRef:t}),{frameRef:t,resolved:Ii(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),normalizedMargin:(0,Zh.useMemo)(()=>function(e){if(null==e)return;if("number"==typeof e)return{top:e,right:e,bottom:e,left:e};const t={};return"number"==typeof e.top&&(t.top=e.top),"number"==typeof e.right&&(t.right=e.right),"number"==typeof e.bottom&&(t.bottom=e.bottom),"number"==typeof e.left&&(t.left=e.left),t}(e.margin),[e.margin])}}({imperativeRef:t,imperativeVariant:"geo-points",margin:g,width:e.width,height:e.height,enableHover:e.enableHover,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,mode:e.mode,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),P=(0,Xh.useMemo)(()=>gt(n),[n]),N=(0,Xh.useMemo)(()=>gt(r),[r]),E=(0,Xh.useMemo)(()=>gt(i),[i]),I=(0,Xh.useMemo)(()=>[...P,...E,...N],[P,E,N]),T=to({data:I,rawData:void 0!==n||void 0!==i||void 0!==r?I:void 0,colorBy:h,colorScheme:f,legendInteraction:void 0,selection:y,linkedHover:v,fallbackFields:"string"==typeof h?[h]:[],unwrapData:!1,onObservation:b,onClick:x,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,chartType:"GeoCustomChart",chartId:w,showLegend:!1,userMargin:L,marginDefaults:R.marginDefaults,loading:k,loadingContent:S,emptyContent:M,width:R.width,height:R.height,hasTitle:!!R.title}),D=T.effectiveSelectionHook,z=(0,Xh.useMemo)(()=>D?.isActive?{isActive:!0,predicate:D.predicate}:null,[D?.isActive,D?.predicate]);if(T.earlyReturn)return T.earlyReturn;const{width:_,height:O,enableHover:F,title:W,description:B,summary:H,accessibleTable:$}=R,q=ri(p),G={projection:l,...null!=n&&{points:P},...null!=r&&{areas:N},...null!=i&&{lines:E},xAccessor:c,yAccessor:u,...null!=d&&{lineDataAccessor:d},customLayout:o,layoutConfig:a,onLayoutError:s,layoutSelection:z,colorBy:h,colorScheme:f,size:[_,O],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:T.margin,enableHover:F,...Ki({title:W,description:B,summary:H,accessibleTable:$,className:j,animate:e.animate,maxDevicePixelRatio:e.maxDevicePixelRatio,autoPlaceAnnotations:e.autoPlaceAnnotations}),...!1===p?{tooltipContent:()=>null}:q?{tooltipContent:q}:{},...Qi({linkedHover:v,selection:y,onObservation:b,onClick:x,hoverHighlight:!1,mobileInteraction:T.mobileInteraction,customHoverBehavior:T.customHoverBehavior,customClickBehavior:T.customClickBehavior,linkedHoverInClickPredicate:!1}),...m&&m.length>0&&{annotations:m},...A};return(0,Kh.jsx)($i,{componentName:"GeoCustomChart",width:_,height:O,children:(0,Kh.jsx)(Yd,{ref:C,...G})})});Qh.displayName="GeoCustomChart";var Jh={fill:"rgba(0,0,0,0)",stroke:"rgba(0,0,0,0)",opacity:0},ef=8,tf=require("./semiotic-custom-layout-selection-cjs-shared.min.js"),nf=require("react/jsx-runtime"),rf=.72,of=1.8,af=e=>{const t=e.config,n=t.source??"auto",r="areas"===n||"auto"===n&&e.areas.length>0,i=r?function(e){return e.areas.map((t,n)=>{const r=function(e,t){const n=e.properties&&"object"==typeof e.properties?e.properties:{},r=e.id??n.id??n.name??"area-"+t;return{...n,id:r+""}}(t,n),i=e.scales.geoPath.centroid(t),o=Number.isFinite(i[0])&&Number.isFinite(i[1])?e.scales.invertedPoint(i[0],i[1]):null;return{datum:{...r,gridLongitude:o?.[0],gridLatitude:o?.[1]},x:i[0],y:i[1]}}).filter(e=>Number.isFinite(e.x)&&Number.isFinite(e.y))}(e):e.points.map((e,t)=>({datum:e,x:t,y:t})),o=i.filter((e,n)=>!t.filter||t.filter(e.datum,n)),a=function(e,t){if(!t.rowAccessor||!t.columnAccessor)return null;const n=e.map(e=>({datum:e,x:Number(po(e,t.columnAccessor)),y:Number(po(e,t.rowAccessor))})).filter(e=>Number.isFinite(e.x)&&Number.isFinite(e.y));return n.length!==e.length?null:n.map(e=>({...e,row:e.y,column:e.x}))}(o.map(e=>e.datum),t),s=r?o:function(e){return e.points.map(t=>{const n=Number(po(t,e.config.longitudeAccessor,["lon","longitude"])),r=Number(po(t,e.config.latitudeAccessor,["lat","latitude"])),i=Number.isFinite(n)&&Number.isFinite(r)?e.scales.projectedPoint(n,r):null;return{datum:t,x:i?.[0]??NaN,y:i?.[1]??NaN}}).filter(e=>Number.isFinite(e.x)&&Number.isFinite(e.y))}({...e,points:o.map(e=>e.datum)}),l=a??fo(s,{columns:t.columns,rows:t.rows,occupancy:t.occupancy,aspectRatio:e.dimensions.width/Math.max(1,e.dimensions.height)});if(0===l.length)return{nodes:[]};const c=uo(l.map(e=>e.row)),u=uo(l.map(e=>e.column)),d=Math.max(1,Math.round(c[1]-c[0])+1),h=Math.max(1,Math.round(u[1]-u[0])+1),f=Math.max(0,t.layoutPadding??8),p=Math.max(1,e.dimensions.width-2*f)/h,m=Math.max(1,e.dimensions.height-2*f)/d,g=(e.dimensions.width-p*h)/2,y=(e.dimensions.height-m*d)/2,v=co(t.cellPadding??.12,0,.8),b=Math.max(1,.5*Math.min(p,m)*(1-v)),x=t.sizeAccessor?l.map(e=>Number(po(e.datum,t.sizeAccessor))):[],w=t.sizeDomain??uo(x),k=t.sizeRange??[.36,1],S=co(Math.min(k[0],k[1]),.05,1),M=co(Math.max(k[0],k[1]),S,1),j=l.map((n,r)=>{const i={...n.datum,gridRow:n.row,gridColumn:n.column},o=(po(i,t.idAccessor,["id","key","name"])??"grid-"+r)+"",a=(po(i,t.labelAccessor,["abbr","code","label","name","id"])??o)+"",s=Math.max(1,t.maxLabelLength??4),l=a.length>s?a.slice(0,s):a,d=po(i,t.categoryAccessor),h=null==d?void 0:d+"",f=po(i,t.fillAccessor),v=null!=f?f+"":h?e.resolveColor(h):e.theme.categorical[0]??"#4f86c6",x=t.sizeAccessor?Number(po(i,t.sizeAccessor)):NaN,k=t.sizeAccessor&&Number.isFinite(x)?Math.sqrt(co(ho(x,w),0,1)):1,j=b*(S+k*(M-S)),A="function"==typeof t.markStyle?t.markStyle(i,r):t.markStyle;return{datum:i,id:o,label:l,category:h,row:n.row,column:n.column,x:g+(n.column-u[0]+.5)*p,y:y+(n.row-c[0]+.5)*m,radius:j,style:{fill:v,fillOpacity:.94,stroke:"rgba(255,255,255,0.9)",strokeWidth:1,...A}}}),A=t.shape??"circle",C=j.map(e=>{if("circle"===A)return{type:"point",x:e.x,y:e.y,r:e.radius,style:e.style,datum:e.datum,accessibleDatum:e.datum,accessibility:{label:e.label,tableFields:{name:e.datum.name??e.label,label:e.label,row:e.row,column:e.column,...e.category?{category:e.category}:{}}},pointId:e.id,_transitionKey:e.id};const t="hexagon"===A?function(e,t,n){const r=[];for(let i=0;6>i;i+=1){const o=-Math.PI/2+i*(Math.PI/3);r.push([e+Math.cos(o)*n,t+Math.sin(o)*n])}return mo(r)}(e.x,e.y,e.radius):mo([[(n=e.x)-(i=e.radius),(r=e.y)-i],[n+i,r-i],[n+i,r+i],[n-i,r+i]]);var n,r,i;return{type:"geoarea",pathData:t,centroid:[e.x,e.y],bounds:[[e.x-e.radius,e.y-e.radius],[e.x+e.radius,e.y+e.radius]],screenArea:"hexagon"===A?3*Math.sqrt(3)*e.radius*e.radius/2:(2*e.radius)**2,style:e.style,datum:e.datum,accessibleDatum:e.datum,accessibility:{label:e.label,tableFields:{name:e.datum.name??e.label,label:e.label,row:e.row,column:e.column,...e.category?{category:e.category}:{}}},group:e.category,interactive:!0}});return{nodes:C,overlays:!1===t.showLabels?null:(0,nf.jsx)(go,{marks:j,color:t.labelColor??"#ffffff",fontSize:t.labelFontSize??co(.23*Math.min(p,m),7,14),fontFamily:t.labelFontFamily,fontWeight:t.labelFontWeight??700}),restyle:(e,t)=>t?.isActive&&e.datum?{opacity:t.predicate(e.datum)?1:.18}:{opacity:1}}},sf=require("react/jsx-runtime"),lf=10,cf=25e3,uf=new WeakMap,df=new WeakMap,hf=new WeakMap,ff=1,pf=e=>{const t=function(e){let t=uf.get(e.areas);t||(t=new Map,uf.set(e.areas,t));const n=function(e){const t=e.config;return[e.areas.length,e.dimensions.width,e.dimensions.height,t.cellSize??"",t.columns??"",t.layoutPadding??"",t.gridOrigin?.join(",")??"",t.maxSamples??"",So(t.featureFilter),So(t.dotFilter),No(e)].join("::")}(e),r=t.get(n);if(r)return r;const i=Ao(e.areas,e.scales,e.dimensions,e.config);if(t.size>=12){const e=t.keys().next().value;void 0!==e&&t.delete(e)}return t.set(n,i),i}(e),n=e.config,r=n.shape??"circle",i=Math.max(.5,vo(n.dotRadius)??t.cellSize*yo(n.radiusRatio??.24,.05,.5)),o=n.gridOrigin?.[0]??0,a=n.gridOrigin?.[1]??0,s=t.dots.map((s,l)=>{const c=o+(s.gridColumn+.5)*t.cellSize,u=a+(s.gridRow+.5)*t.cellSize,d=bo(s,n.categoryAccessor),h=bo(s,n.fillAccessor),f={fill:null!=h?h+"":null!=d?e.resolveColor(d+""):e.theme.categorical[0]??"#4f86c6",fillOpacity:.92,strokeWidth:0,..."function"==typeof n.markStyle?n.markStyle(s,l):n.markStyle},p=`dot-${s.gridRow}-${s.gridColumn}`;if("circle"===r)return{type:"point",x:c,y:u,r:i,style:f,datum:s,interactive:!1,pointId:p,_transitionKey:p};const m="hexagon"===r?function(e,t,n){return Eo(Array.from({length:6},(r,i)=>{const o=-Math.PI/2+i*(Math.PI/3);return[e+Math.cos(o)*n,t+Math.sin(o)*n]}))}(c,u,i):function(e,t,n){return Eo([[e-n,t-n],[e+n,t-n],[e+n,t+n],[e-n,t+n]])}(c,u,i);return{type:"geoarea",pathData:m,centroid:[c,u],bounds:[[c-i,u-i],[c+i,u+i]],screenArea:"hexagon"===r?3*Math.sqrt(3)*i*i/2:(2*i)**2,style:f,datum:s,group:s.featureId,interactive:!1}});return{nodes:s,overlays:n.showOutline?(0,sf.jsx)("g",{"aria-hidden":"true",pointerEvents:"none",children:t.features.map((t,r)=>{const i=e.scales.geoPath(t);return i?(0,sf.jsx)("path",{d:i,fill:"none",stroke:n.outlineStyle?.stroke??"currentColor",strokeOpacity:n.outlineStyle?.opacity??n.outlineStyle?.fillOpacity??.22,strokeWidth:n.outlineStyle?.strokeWidth??.7,strokeDasharray:n.outlineStyle?.strokeDasharray,strokeLinecap:n.outlineStyle?.strokeLinecap,vectorEffect:"non-scaling-stroke"},wo(t,r)):null})}):null,restyle:(e,t)=>t?.isActive&&e.datum?{opacity:t.predicate(e.datum)?1:.14}:{opacity:1}}};
|