semiotic 3.8.0 → 3.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (331) hide show
  1. package/CLAUDE.md +14 -9
  2. package/README.md +56 -55
  3. package/ai/behaviorContracts.cjs +9 -0
  4. package/ai/dist/mcp-server.js +240 -30
  5. package/ai/schema.json +616 -42
  6. package/ai/surface-manifest.json +3 -2
  7. package/ai/system-prompt.md +7 -3
  8. package/dist/__tests__/scenarios/mcpProtocolTypes.d.ts +20 -0
  9. package/dist/chunk-OrdinalBrushOverlay-PXHQYDB2.module.min.js +2 -0
  10. package/dist/chunk-XYBrushOverlay-ECZJJLAJ.module.min.js +1 -0
  11. package/dist/chunk-XYBrushOverlay-EP2SV3UI.module.min.js +2 -0
  12. package/dist/chunk-chunk-255KDHW5.module.min.js +1 -0
  13. package/dist/chunk-chunk-27HVVXS6.module.min.js +1 -0
  14. package/dist/chunk-chunk-2CXCXRB4.module.min.js +1 -0
  15. package/dist/chunk-chunk-2JGJ5GUG.module.min.js +2 -0
  16. package/dist/chunk-chunk-2UN3ANRN.module.min.js +2 -0
  17. package/dist/chunk-chunk-2VUEY5TH.module.min.js +1 -0
  18. package/dist/chunk-chunk-2WVCH4PL.module.min.js +1 -0
  19. package/dist/chunk-chunk-5UKL5W76.module.min.js +2 -0
  20. package/dist/chunk-chunk-5WEFWNUW.module.min.js +2 -0
  21. package/dist/chunk-chunk-6F6GEAQU.module.min.js +1 -0
  22. package/dist/chunk-chunk-7LHMKRKE.module.min.js +2 -0
  23. package/dist/chunk-chunk-BHYTYMY2.module.min.js +2 -0
  24. package/dist/chunk-chunk-C6EJ4IOD.module.min.js +2 -0
  25. package/dist/chunk-chunk-CA3YDW6F.module.min.js +1 -0
  26. package/dist/chunk-chunk-CP3EN6KZ.module.min.js +1 -0
  27. package/dist/chunk-chunk-CYIML3AV.module.min.js +2 -0
  28. package/dist/chunk-chunk-DNY43POY.module.min.js +1 -0
  29. package/dist/chunk-chunk-DSNGDNJY.module.min.js +1 -0
  30. package/dist/chunk-chunk-E7MIQX7D.module.min.js +2 -0
  31. package/dist/chunk-chunk-EMO5NUGE.module.min.js +1 -0
  32. package/dist/chunk-chunk-ES4DCG3L.module.min.js +1 -0
  33. package/dist/chunk-chunk-FAKO3RGQ.module.min.js +2 -0
  34. package/dist/chunk-chunk-FYY2ACNJ.module.min.js +2 -0
  35. package/dist/chunk-chunk-G7WFWHAD.module.min.js +2 -0
  36. package/dist/chunk-chunk-GMQ5AYTD.module.min.js +1 -0
  37. package/dist/chunk-chunk-H4PPRW6N.module.min.js +1 -0
  38. package/dist/chunk-chunk-IFYPMWKY.module.min.js +1 -0
  39. package/dist/chunk-chunk-J3ELI22J.module.min.js +1 -0
  40. package/dist/chunk-chunk-J3QOW4OE.module.min.js +0 -0
  41. package/dist/chunk-chunk-J3XWETBJ.module.min.js +2 -0
  42. package/dist/chunk-chunk-JCG72SGW.module.min.js +2 -0
  43. package/dist/{semiotic-ai-chunk-OG7BQUUW.module.min.js → chunk-chunk-JJ2OOIET.module.min.js} +0 -1
  44. package/dist/chunk-chunk-KTWEBFMX.module.min.js +2 -0
  45. package/dist/chunk-chunk-L6D3I3V7.module.min.js +2 -0
  46. package/dist/chunk-chunk-M337NY6L.module.min.js +1 -0
  47. package/dist/chunk-chunk-NO4MCQVD.module.min.js +1 -0
  48. package/dist/chunk-chunk-ODUZEEBH.module.min.js +2 -0
  49. package/dist/chunk-chunk-P6UBCMSQ.module.min.js +2 -0
  50. package/dist/chunk-chunk-Q2YADC2V.module.min.js +2 -0
  51. package/dist/chunk-chunk-QRIBHZYW.module.min.js +1 -0
  52. package/dist/chunk-chunk-QSQVBIJA.module.min.js +1 -0
  53. package/dist/chunk-chunk-RCF52Z42.module.min.js +2 -0
  54. package/dist/chunk-chunk-RH5TSQPH.module.min.js +1 -0
  55. package/dist/chunk-chunk-ROP4HI7H.module.min.js +2 -0
  56. package/dist/chunk-chunk-RZH7VZYS.module.min.js +2 -0
  57. package/dist/chunk-chunk-SIRIJ3DY.module.min.js +1 -0
  58. package/dist/chunk-chunk-STZFFTAN.module.min.js +2 -0
  59. package/dist/chunk-chunk-SV4XAZ3Q.module.min.js +1 -0
  60. package/dist/chunk-chunk-T27ZEV6A.module.min.js +1 -0
  61. package/dist/chunk-chunk-U3AGQ5EF.module.min.js +2 -0
  62. package/dist/chunk-chunk-U66USBWU.module.min.js +1 -0
  63. package/dist/chunk-chunk-VVCA3DB7.module.min.js +1 -0
  64. package/dist/chunk-chunk-W3DB2MN4.module.min.js +2 -0
  65. package/dist/chunk-chunk-WCX6U47H.module.min.js +2 -0
  66. package/dist/chunk-chunk-WDIN4LRC.module.min.js +1 -0
  67. package/dist/chunk-chunk-XEVJDUTH.module.min.js +1 -0
  68. package/dist/chunk-chunk-XOYX77KF.module.min.js +2 -0
  69. package/dist/chunk-chunk-YCQYG6J5.module.min.js +2 -0
  70. package/dist/chunk-chunk-YHNZCPOZ.module.min.js +2 -0
  71. package/dist/chunk-chunk-YWZB3KPI.module.min.js +2 -0
  72. package/dist/chunk-chunk-Z5KXAVQD.module.min.js +2 -0
  73. package/dist/chunk-chunk-ZCNBUZPL.module.min.js +2 -0
  74. package/dist/chunk-chunk-ZLKRTF5N.module.min.js +2 -0
  75. package/dist/chunk-chunk-ZTNVDWAK.module.min.js +2 -0
  76. package/dist/chunk-statisticalOverlays-6MVAK5RW.module.min.js +2 -0
  77. package/dist/components/AccessibleNavTree.d.ts +7 -1
  78. package/dist/components/ai/chartClinicMetadata.generated.d.ts +15 -0
  79. package/dist/components/ai/useNavigationSync.d.ts +17 -2
  80. package/dist/components/chartContainerMobile.d.ts +9 -0
  81. package/dist/components/charts/geo/ChoroplethMap.d.ts +19 -2
  82. package/dist/components/charts/geo/DistanceCartogram.d.ts +14 -2
  83. package/dist/components/charts/geo/FlowMap.d.ts +10 -6
  84. package/dist/components/charts/geo/ProportionalSymbolMap.d.ts +14 -2
  85. package/dist/components/charts/index.d.ts +6 -0
  86. package/dist/components/charts/network/ChordDiagram.d.ts +9 -1
  87. package/dist/components/charts/network/ForceDirectedGraph.d.ts +11 -0
  88. package/dist/components/charts/network/SankeyDiagram.d.ts +9 -1
  89. package/dist/components/charts/ordinal/BarChart.d.ts +21 -0
  90. package/dist/components/charts/ordinal/GroupedBarChart.d.ts +11 -0
  91. package/dist/components/charts/ordinal/StackedBarChart.d.ts +11 -0
  92. package/dist/components/charts/physics/CollisionSwarmChart.d.ts +7 -0
  93. package/dist/components/charts/physics/EventDropChart.d.ts +7 -0
  94. package/dist/components/charts/physics/GaltonBoardChart.d.ts +8 -0
  95. package/dist/components/charts/physics/PhysicalFlowChart.d.ts +7 -0
  96. package/dist/components/charts/physics/PhysicsCustomChart.d.ts +4 -25
  97. package/dist/components/charts/physics/PhysicsPileChart.d.ts +7 -0
  98. package/dist/components/charts/physics/physicsChartShared.d.ts +17 -1
  99. package/dist/components/charts/physics/physicsCustomLayout.d.ts +32 -0
  100. package/dist/components/charts/shared/AnnotationLabel.d.ts +88 -0
  101. package/dist/components/charts/shared/annotationActivation.d.ts +35 -0
  102. package/dist/components/charts/shared/annotationLabelLayout.d.ts +5 -0
  103. package/dist/components/charts/shared/annotationRules.d.ts +2 -1
  104. package/dist/components/charts/shared/auditAccessibilityText.d.ts +13 -0
  105. package/dist/components/charts/shared/chartSelectionUtils.d.ts +4 -0
  106. package/dist/components/charts/shared/chartSpecCore.d.ts +3 -3
  107. package/dist/components/charts/shared/datumTypes.d.ts +2 -0
  108. package/dist/components/charts/shared/diagnoseAnnotationChecks.d.ts +2 -0
  109. package/dist/components/charts/shared/formatUtils.d.ts +3 -3
  110. package/dist/components/charts/shared/hatchFill.d.ts +87 -0
  111. package/dist/components/charts/shared/hooks.d.ts +7 -6
  112. package/dist/components/charts/shared/knownChartComponents.d.ts +9 -0
  113. package/dist/components/charts/shared/leastSquaresRegression.d.ts +16 -0
  114. package/dist/components/charts/shared/mergeShapeStyle.d.ts +3 -2
  115. package/dist/components/charts/shared/semanticInteractions.d.ts +42 -0
  116. package/dist/components/charts/shared/sparseArray.d.ts +1 -1
  117. package/dist/components/charts/shared/streamPropsHelpers.d.ts +6 -4
  118. package/dist/components/charts/shared/styleRules.d.ts +205 -0
  119. package/dist/components/charts/shared/tooltipUtils.d.ts +22 -9
  120. package/dist/components/charts/shared/types.d.ts +9 -6
  121. package/dist/components/charts/shared/useAreaSeriesSetup.d.ts +16 -2
  122. package/dist/components/charts/shared/useChartSetup.d.ts +2 -2
  123. package/dist/components/charts/shared/useCustomChartSetup.d.ts +3 -0
  124. package/dist/components/charts/shared/useFrameImperativeHandle.d.ts +1 -2
  125. package/dist/components/charts/shared/useLikertAggregation.d.ts +4 -4
  126. package/dist/components/charts/shared/useOrdinalBrush.d.ts +2 -1
  127. package/dist/components/charts/shared/useOrdinalPieceStyle.d.ts +24 -1
  128. package/dist/components/charts/shared/useStreamingLegend.d.ts +1 -1
  129. package/dist/components/charts/shared/useXYLineStyle.d.ts +10 -0
  130. package/dist/components/charts/shared/useXYPointStyle.d.ts +19 -1
  131. package/dist/components/charts/shared/validateChartData.d.ts +7 -5
  132. package/dist/components/charts/shared/validationMap.d.ts +11 -2
  133. package/dist/components/charts/shared/validationMap.generated.d.ts +6 -0
  134. package/dist/components/charts/shared/withChartWrapper.d.ts +4 -3
  135. package/dist/components/charts/value/targetPresentation.d.ts +22 -0
  136. package/dist/components/charts/value/types.d.ts +5 -6
  137. package/dist/components/charts/xy/AreaChart.d.ts +8 -0
  138. package/dist/components/charts/xy/BubbleChart.d.ts +9 -0
  139. package/dist/components/charts/xy/ConnectedScatterplot.d.ts +7 -0
  140. package/dist/components/charts/xy/DifferenceChart.d.ts +1 -52
  141. package/dist/components/charts/xy/Heatmap.d.ts +2 -2
  142. package/dist/components/charts/xy/LineChart.d.ts +11 -0
  143. package/dist/components/charts/xy/QuadrantChart.d.ts +7 -0
  144. package/dist/components/charts/xy/Scatterplot.d.ts +10 -0
  145. package/dist/components/charts/xy/StackedAreaChart.d.ts +7 -0
  146. package/dist/components/charts/xy/differenceSegments.d.ts +49 -0
  147. package/dist/components/charts/xy/scatterplotMatrixInteractionTypes.d.ts +12 -0
  148. package/dist/components/controls/SentenceFilter.d.ts +97 -0
  149. package/dist/components/data/fromVegaLite.d.ts +19 -9
  150. package/dist/components/rough/createRoughRenderMode.d.ts +46 -0
  151. package/dist/components/semiotic-ai.d.ts +3 -1
  152. package/dist/components/semiotic-controls.d.ts +2 -0
  153. package/dist/components/semiotic-geo.d.ts +4 -0
  154. package/dist/components/semiotic-network.d.ts +4 -0
  155. package/dist/components/semiotic-ordinal.d.ts +6 -0
  156. package/dist/components/semiotic-physics.d.ts +4 -0
  157. package/dist/components/semiotic-rough.d.ts +4 -0
  158. package/dist/components/semiotic-utils-core.d.ts +4 -0
  159. package/dist/components/semiotic-xy.d.ts +4 -0
  160. package/dist/components/semiotic.d.ts +9 -1
  161. package/dist/components/server/optionalImageTypes.d.ts +37 -0
  162. package/dist/components/server/serverChartConfigShared.d.ts +9 -5
  163. package/dist/components/server/serverChartConfigs.d.ts +4 -4
  164. package/dist/components/server/staticAnnotations.d.ts +6 -3
  165. package/dist/components/server/staticLegend.d.ts +1 -1
  166. package/dist/components/server/staticNetwork.d.ts +4 -4
  167. package/dist/components/server/staticSVGChrome.d.ts +5 -4
  168. package/dist/components/store/ObservationStore.d.ts +21 -1
  169. package/dist/components/stream/AccessibleDataTable.d.ts +4 -10
  170. package/dist/components/stream/AriaLiveTooltip.d.ts +9 -0
  171. package/dist/components/stream/CanvasHitTester.d.ts +4 -4
  172. package/dist/components/stream/DataSourceAdapter.d.ts +1 -1
  173. package/dist/components/stream/FrameRuntime.d.ts +57 -0
  174. package/dist/components/stream/GeoParticlePool.d.ts +1 -1
  175. package/dist/components/stream/GeoPipelineStore.d.ts +43 -12
  176. package/dist/components/stream/GeoSVGOverlay.d.ts +64 -0
  177. package/dist/components/stream/NetworkCanvasHitTester.d.ts +2 -1
  178. package/dist/components/stream/NetworkPipelineStore.d.ts +24 -21
  179. package/dist/components/stream/NetworkSSRFrame.d.ts +17 -0
  180. package/dist/components/stream/NetworkSVGOverlay.d.ts +6 -0
  181. package/dist/components/stream/OrdinalBrushOverlay.d.ts +1 -2
  182. package/dist/components/stream/OrdinalBrushOverlayLazy.d.ts +9 -0
  183. package/dist/components/stream/OrdinalCanvasHitTester.d.ts +2 -2
  184. package/dist/components/stream/OrdinalPipelineStore.d.ts +13 -13
  185. package/dist/components/stream/OrdinalSVGOverlay.d.ts +9 -1
  186. package/dist/components/stream/OrdinalStyleResolver.d.ts +12 -0
  187. package/dist/components/stream/ParticlePool.d.ts +1 -1
  188. package/dist/components/stream/PipelineStore.d.ts +12 -16
  189. package/dist/components/stream/SVGOverlay.d.ts +6 -0
  190. package/dist/components/stream/SceneGraph.d.ts +3 -3
  191. package/dist/components/stream/XYBrushOverlayLazy.d.ts +17 -0
  192. package/dist/components/stream/accessorUtils.d.ts +2 -2
  193. package/dist/components/stream/annotationAccessorResolver.d.ts +2 -2
  194. package/dist/components/stream/frameGraphics.d.ts +4 -0
  195. package/dist/components/stream/frameKeyboardNavigation.d.ts +45 -0
  196. package/dist/components/stream/geoPipelineHelpers.d.ts +3 -3
  197. package/dist/components/stream/geoPipelineUpdateResults.d.ts +34 -0
  198. package/dist/components/stream/geoSceneBuilder.d.ts +16 -0
  199. package/dist/components/stream/geoTypes.d.ts +48 -15
  200. package/dist/components/stream/hitTestUtils.d.ts +2 -2
  201. package/dist/components/stream/hoverUtils.d.ts +4 -2
  202. package/dist/components/stream/layouts/forceLayoutWorkerClient.d.ts +1 -0
  203. package/dist/components/stream/layouts/hierarchyUtils.d.ts +2 -2
  204. package/dist/components/stream/networkCustomLayoutRunner.d.ts +23 -0
  205. package/dist/components/stream/networkCustomRestyle.d.ts +15 -0
  206. package/dist/components/stream/networkFrameAnimation.d.ts +7 -0
  207. package/dist/components/stream/networkFrameHandleTypes.d.ts +39 -0
  208. package/dist/components/stream/networkFrameObservations.d.ts +15 -0
  209. package/dist/components/stream/networkFramePaint.d.ts +11 -2
  210. package/dist/components/stream/networkInteractionTypes.d.ts +26 -0
  211. package/dist/components/stream/networkPipelineConfig.d.ts +2 -2
  212. package/dist/components/stream/networkPipelineUpdateResults.d.ts +38 -0
  213. package/dist/components/stream/networkTypes.d.ts +37 -56
  214. package/dist/components/stream/ordinalCanvasRenderers.d.ts +2 -2
  215. package/dist/components/stream/ordinalPipelineUpdateResults.d.ts +20 -1
  216. package/dist/components/stream/ordinalSceneBuilders/types.d.ts +2 -2
  217. package/dist/components/stream/ordinalTypes.d.ts +30 -3
  218. package/dist/components/stream/physics/PhysicsPipelineStore.d.ts +2 -0
  219. package/dist/components/stream/physics/PhysicsSVGOverlay.d.ts +6 -0
  220. package/dist/components/stream/physics/StreamPhysicsTypes.d.ts +21 -6
  221. package/dist/components/stream/physics/physicsFrameObservations.d.ts +19 -0
  222. package/dist/components/stream/physics/physicsFrameSetup.d.ts +4 -0
  223. package/dist/components/stream/physics/physicsPipelineUpdateResults.d.ts +19 -1
  224. package/dist/components/stream/physics/usePhysicsFrameLifecyclePolicy.d.ts +3 -1
  225. package/dist/components/stream/pipelineConfig.d.ts +4 -2
  226. package/dist/components/stream/pipelineDecay.d.ts +2 -2
  227. package/dist/components/stream/pipelinePulse.d.ts +2 -2
  228. package/dist/components/stream/pipelineStoreUpdateResults.d.ts +23 -2
  229. package/dist/components/stream/pipelineTransitions.d.ts +1 -1
  230. package/dist/components/stream/pipelineUpdateContract.d.ts +7 -0
  231. package/dist/components/stream/pipelineUpdateStore.d.ts +21 -0
  232. package/dist/components/stream/renderBackend.d.ts +27 -0
  233. package/dist/components/stream/renderers/canvasRenderHelpers.d.ts +15 -1
  234. package/dist/components/stream/renderers/geoCanvasRenderer.d.ts +3 -2
  235. package/dist/components/stream/renderers/networkParticleRenderer.d.ts +1 -1
  236. package/dist/components/stream/sceneRenderBackendTypes.d.ts +28 -0
  237. package/dist/components/stream/sceneRevisionDiagnostics.d.ts +31 -4
  238. package/dist/components/stream/streamSemanticTypes.d.ts +16 -0
  239. package/dist/components/stream/streamThemeTypes.d.ts +14 -0
  240. package/dist/components/stream/svgOverlayUtils.d.ts +10 -0
  241. package/dist/components/stream/test-utils/frameScheduler.d.ts +12 -0
  242. package/dist/components/stream/test-utils/revisionConsumption.d.ts +13 -0
  243. package/dist/components/stream/titleLayout.d.ts +31 -0
  244. package/dist/components/stream/types.d.ts +30 -65
  245. package/dist/components/stream/useCanvasFrameHost.d.ts +71 -0
  246. package/dist/components/stream/useFrame.d.ts +23 -0
  247. package/dist/components/stream/useLegendCategoryEmission.d.ts +3 -3
  248. package/dist/components/stream/useSemanticFrameInteractions.d.ts +22 -0
  249. package/dist/components/stream/useUpdateResultSnapshot.d.ts +7 -0
  250. package/dist/components/stream/xyFrameAxisTypes.d.ts +50 -0
  251. package/dist/components/stream/xySceneBuilders/types.d.ts +6 -5
  252. package/dist/controls.min.js +1 -1
  253. package/dist/controls.module.min.js +1 -1
  254. package/dist/forceLayoutWorker.js +1 -1
  255. package/dist/geo.min.js +1 -1
  256. package/dist/geo.module.min.js +1 -1
  257. package/dist/network.min.js +1 -1
  258. package/dist/network.module.min.js +1 -1
  259. package/dist/ordinal.min.js +1 -1
  260. package/dist/ordinal.module.min.js +1 -1
  261. package/dist/physics-matter.min.js +1 -1
  262. package/dist/physics-matter.module.min.js +1 -1
  263. package/dist/physics-rapier.min.js +1 -1
  264. package/dist/physics-rapier.module.min.js +1 -1
  265. package/dist/physics.min.js +1 -1
  266. package/dist/physics.module.min.js +1 -1
  267. package/dist/physicsWorker.js +1 -1
  268. package/dist/realtime.min.js +1 -1
  269. package/dist/realtime.module.min.js +1 -1
  270. package/dist/rough.min.js +1 -0
  271. package/dist/rough.module.min.js +1 -0
  272. package/dist/semiotic-ai-core.min.js +1 -1
  273. package/dist/semiotic-ai-core.module.min.js +1 -1
  274. package/dist/semiotic-ai.d.ts +3 -1
  275. package/dist/semiotic-ai.min.js +1 -1
  276. package/dist/semiotic-ai.module.min.js +1 -1
  277. package/dist/semiotic-controls.d.ts +2 -0
  278. package/dist/semiotic-data.min.js +1 -1
  279. package/dist/semiotic-data.module.min.js +1 -1
  280. package/dist/semiotic-experimental.min.js +1 -1
  281. package/dist/semiotic-experimental.module.min.js +1 -1
  282. package/dist/semiotic-geo.d.ts +4 -0
  283. package/dist/semiotic-network.d.ts +4 -0
  284. package/dist/semiotic-ordinal.d.ts +6 -0
  285. package/dist/semiotic-physics.d.ts +4 -0
  286. package/dist/semiotic-realtime-core.min.js +1 -1
  287. package/dist/semiotic-realtime-core.module.min.js +1 -1
  288. package/dist/semiotic-realtime-react.min.js +1 -1
  289. package/dist/semiotic-realtime-react.module.min.js +1 -1
  290. package/dist/semiotic-recipes-core.min.js +1 -1
  291. package/dist/semiotic-recipes-core.module.min.js +1 -1
  292. package/dist/semiotic-recipes-react.min.js +1 -1
  293. package/dist/semiotic-recipes-react.module.min.js +1 -1
  294. package/dist/semiotic-recipes.min.js +1 -1
  295. package/dist/semiotic-recipes.module.min.js +1 -1
  296. package/dist/semiotic-rough.d.ts +4 -0
  297. package/dist/semiotic-server-edge.min.js +1 -1
  298. package/dist/semiotic-server-edge.module.min.js +1 -1
  299. package/dist/semiotic-server-node.min.js +1 -1
  300. package/dist/semiotic-server-node.module.min.js +1 -1
  301. package/dist/semiotic-themes-core.min.js +1 -1
  302. package/dist/semiotic-themes-core.module.min.js +1 -1
  303. package/dist/semiotic-themes-react.min.js +1 -1
  304. package/dist/semiotic-themes-react.module.min.js +1 -1
  305. package/dist/semiotic-themes.min.js +1 -1
  306. package/dist/semiotic-themes.module.min.js +1 -1
  307. package/dist/semiotic-utils-core.d.ts +4 -0
  308. package/dist/semiotic-utils-core.min.js +1 -1
  309. package/dist/semiotic-utils-core.module.min.js +1 -1
  310. package/dist/semiotic-utils-react.min.js +1 -1
  311. package/dist/semiotic-utils-react.module.min.js +1 -1
  312. package/dist/semiotic-utils.min.js +1 -1
  313. package/dist/semiotic-utils.module.min.js +1 -1
  314. package/dist/semiotic-value.min.js +1 -1
  315. package/dist/semiotic-value.module.min.js +1 -1
  316. package/dist/semiotic-xy.d.ts +4 -0
  317. package/dist/semiotic.d.ts +9 -1
  318. package/dist/semiotic.min.js +1 -1
  319. package/dist/semiotic.module.min.js +1 -1
  320. package/dist/server.min.js +1 -1
  321. package/dist/server.module.min.js +1 -1
  322. package/dist/test-utils/capturedFrameProps.d.ts +67 -0
  323. package/dist/test-utils/frameMock.d.ts +12 -9
  324. package/dist/xy.min.js +1 -1
  325. package/dist/xy.module.min.js +1 -1
  326. package/package.json +29 -10
  327. package/dist/semiotic-ai-statisticalOverlays-CY4WKR4A.module.min.js +0 -2
  328. package/dist/semiotic-chunk-3FSVZ46U.module.min.js +0 -2
  329. package/dist/semiotic-statisticalOverlays-UOMSFKVJ.module.min.js +0 -2
  330. package/dist/xy-chunk-IWD6IB6V.module.min.js +0 -2
  331. package/dist/xy-statisticalOverlays-7RWG6LJT.module.min.js +0 -2
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{useRef as e,useState as t,useEffect as n,useMemo as o,useCallback as r,useImperativeHandle as i,forwardRef as a,memo as s}from"react";import{geoPath as l,geoGraticule as c,geoDistance as u,geoInterpolate as h}from"d3-geo";import{quadtree as d}from"d3-quadtree";var f=class{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;return{next:()=>this._size>e?{done:!1,value:this.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray();let n=0,o=[];t.length>e&&(n=t.length-e,o=t.slice(0,n)),this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(let e=n;t.length>e;e++)this.push(t[e]);return o}update(e,t){const n=[],o=(this.head-this._size+this._capacity)%this._capacity;for(let r=0;this._size>r;r++){const i=(o+r)%this._capacity,a=this.buffer[i];if(e(a)){let e;e="object"!=typeof a||null===a?a:Array.isArray(a)?[...a]:{...a},n.push(e),this.buffer[i]=t(a)}}return n}remove(e){const t=[],n=[];if(this.forEach(o=>{e(o)?n.push(o):t.push(o)}),0===n.length)return n;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}};function p(e,t,n){return e+(t-e)*n}function m(){return"undefined"!=typeof performance?performance.now():Date.now()}function y(e,t,n){if(1>=n)return 1;const o=n-1;return function(e){const t=Math.max(0,Math.min(1,e.minOpacity??.1));if(Number.isNaN(e.age))return 1;if(e.age===1/0)return t;if(!Number.isFinite(e.extent)||0>=e.extent)return 1;const n=Math.max(0,e.age);if("step"===e.type)return(e.threshold??.5*e.extent)>n?1:t;if("exponential"===e.type){const o=e.halfLife??e.extent/2;return t+Math.pow(.5,n/(o>0?o:e.extent/2))*(1-t)}return t+Math.max(0,Math.min(1,1-n/e.extent))*(1-t)}({age:o-t,extent:o,type:e.type,halfLife:e.halfLife??n/2,threshold:e.stepThreshold??.5*n,minOpacity:e.minOpacity??.1})}function g(e,t,n){const o=e.duration??500,r=n-t;return o>r?1-r/o:0}import{scaleOrdinal as b}from"d3-scale";function v(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function x(e,t,n){const o=e=>e.toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function w(e){const t=e.map(v),n=t.length-1;return e=>{if(0>=e){const[e,n,o]=t[0];return x(e,n,o)}if(e>=1){const[e,o,r]=t[n];return x(e,o,r)}const o=e*n,r=Math.floor(o),i=o-r,[a,s,l]=t[r],[c,u,h]=t[r+1];return x(Math.round(a+(c-a)*i),Math.round(s+(u-s)*i),Math.round(l+(h-l)*i))}}var k=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],S=w(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),M=w(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),A=w(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),C=w(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),L=w(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),j=w(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),P=w(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),I=w(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),D=w(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),z=w(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),R=w(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),O=w(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]),T={blues:S,reds:M,greens:A,viridis:P,oranges:C,purples:L,greys:j,plasma:I,inferno:D,magma:z,cividis:R,turbo:O};function N(e){return e&&T[e]||S}w(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),w(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),w(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),w(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),w(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),w(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),w(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]);var $={category10:k,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],...T},W=k,_=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],E=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 B(e,t,n){if("function"==typeof t){const o=t(e);return n&&o&&"string"==typeof o&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||E.has(t)}(o)?n(o):o}const o=e?.[t]+"";return n?n(o):W[Math.abs(function(e){let t=0;for(let n=0;e.length>n;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return Math.abs(t)}(o))%W.length]}function H(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 F(e,t,n="category10"){if(n&&"object"==typeof n&&!Array.isArray(n)){const e=n;return t=>H(e,t)??"#999"}const o=Array.from(new Set(e.map(e=>e?.[t]).filter(e=>null!=e).map(e=>e+""))),r=o.every(e=>!isNaN(Number(e)));if(Array.isArray(n))return b().domain(o).range(n).unknown("#999");const i=$[n]||$.category10;if(r&&"function"==typeof i){let e=-1/0;for(const t of o){const n=Number(t);n>e&&(e=n)}return t=>i(Number(t)/e)}{const e=Array.isArray(i)?i:W;return b().domain(o).range(e).unknown("#999")}}function G(e,t,n=[3,20],o){let r;if(r="function"==typeof t?t(e):e?.[t],!o)return r;const[i,a]=o,[s,l]=n;if(a===i)return(s+l)/2;let c=(r-i)/(a-i);return 0>c?c=0:c>1&&(c=1),s+c*(l-s)}function q(e,t){const n=t&&"object"==typeof t&&!Array.isArray(t)?t:void 0;return 0===e.length?e=>n&&H(n,e)||"#4e79a7":t=>{if(n){const e=H(n,t);if(e)return e}let o=0;for(let e=0;t.length>e;e++)o=31*o+t.charCodeAt(e)|0;return e[Math.abs(o)%e.length]??"#4e79a7"}}function V(e){return null!=e&&!1!==e&&""!==e&&(!Array.isArray(e)||e.some(V))}function Z(e,t,n){e.has(t)||(e.add(t),console.warn(n))}import{geoMercator as U,geoEqualEarth as Y,geoAlbersUsa as X,geoOrthographic as Q,geoNaturalEarth1 as K,geoEquirectangular as J}from"d3-geo";var ee={mercator:U,equalEarth:Y,albersUsa:X,orthographic:Q,naturalEarth:K,equirectangular:J};function te(e,t){return e?"function"==typeof e?e:t=>t[e]:e=>e[t]}function ne(e){return e?"function"==typeof e?e:t=>t[e]:e=>e.coordinates||e.data||[]}function oe(e,t,n){return e?"function"==typeof e?{...n,...e(t)}:{...n,...e}:{...n}}function re(e,t){if(2>e.length)return[e];const n=.4*t,o=[];let r=[e[0]];for(let t=1;e.length>t;t++){const i=e[t];Math.abs(i[0]-e[t-1][0])>n?(2>r.length||o.push(r),r=[i]):r.push(i)}return 2>r.length||o.push(r),o}function ie(e,t,n=24){const o=t[0]-e[0],r=t[1]-e[1],i=Math.sqrt(o*o+r*r);if(0===i)return[e,t];const a=-r/i,s=o/i,l=Math.min(.3*i,80),c=(e[0]+t[0])/2+a*l,u=(e[1]+t[1])/2+s*l,h=[];for(let o=0;n>=o;o++){const r=o/n,i=1-r;h.push([i*i*e[0]+2*i*r*c+r*r*t[0],i*i*e[1]+2*i*r*u+r*r*t[1]])}return h}function ae(e,t){if(2>e.length)return e;const n=t/2+1,o=[];for(let t=0;e.length>t;t++){const r=e[t];let i,a;0===t?(i=e[1][0]-r[0],a=e[1][1]-r[1]):t===e.length-1?(i=r[0]-e[t-1][0],a=r[1]-e[t-1][1]):(i=e[t+1][0]-e[t-1][0],a=e[t+1][1]-e[t-1][1]);const s=Math.sqrt(i*i+a*a)||1;o.push([r[0]+a/s*n,r[1]+-i/s*n])}return o}function se(e,t,n,o,r){const i=t[0]-e[0],a=t[1]-e[1],s=Math.sqrt(i*i+a*a);if(0===s)return[e,t];const l=a/s,c=-i/s,u=r/2+1;return[[e[0]+l*u,e[1]+c*u],[t[0]+l*u,t[1]+c*u]]}import{scaleLinear as le}from"d3-scale";function ce(e){let t=1/0,n=-1/0;for(const o of e)t>o&&(t=o),o>n&&(n=o);return[t,n]}function ue(e,t=-1/0){let n=t;for(const t of e)t>n&&(n=t);return n}function he(e,t,n,o){const r=e.push(t);return n&&n.push(o),r}var de=class e{constructor(e){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._stylePaintPending=!1,this.config=e}updateConfig(e){this.config={...this.config,...e},"customLayout"in e&&!e.customLayout&&(this.lastCustomLayoutFailure=null)}setAreas(e){this.areas=e}setPoints(e){this.pointData=e,this.streaming=!1}setLines(e){this.lineData=e.slice()}initStreaming(e=500){this.pointBuffer=new f(e),this.timestampBuffer=new f(e),this.streaming=!0}pushPoint(e){this.pointBuffer||this.initStreaming();const t=m();he(this.pointBuffer,e,this.timestampBuffer,t),this.lastIngestTime=t}pushMany(e){this.pointBuffer||this.initStreaming();const t=m();for(const n of e)he(this.pointBuffer,n,this.timestampBuffer,t);this.lastIngestTime=t}pushLine(e){null!=e&&"object"==typeof e&&(this.lineData.push(e),this.version++)}pushManyLines(e){if(!Array.isArray(e)||0===e.length)return;const t=e.filter(e=>null!=e&&"object"==typeof e);if(0!==t.length){for(const e of t)this.lineData.push(e);this.version++}}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],o=new Set(Array.isArray(e)?e:[e]),r=[];return this.lineData=this.lineData.filter(e=>!o.has(n(e)+"")||(r.push(e),!1)),r.length>0&&this.version++,r}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],o=new Set(Array.isArray(e)?e:[e]);if(this.streaming&&this.pointBuffer){const e=e=>o.has(n(e)+"");!function(e,t,n){if(!t||0===t.size)return;const o=new Set;if(e.forEach((e,t)=>{n(e)&&o.add(t)}),0===o.size)return;const r=t.toArray();t.clear();for(let e=0;r.length>e;e++)o.has(e)||t.push(r[e])}(this.pointBuffer,this.timestampBuffer,e);const t=this.pointBuffer.remove(e);return t.length>0&&this.version++,t}{const e=[];return this.pointData=this.pointData.filter(t=>!o.has(n(t)+"")||(e.push(t),!1)),e.length>0&&this.version++,e}}clear(){this.areas=[],this.pointData=[],this.lineData=[],this.pointBuffer=null,this.timestampBuffer=null,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++}setLayoutSelection(e){this.config.layoutSelection=e}consumeStylePaintPending(){const e=this._stylePaintPending;return this._stylePaintPending=!1,e}restyleScene(e){const t=this._customRestyle;if(t){for(const n of this.scene){const o=this._baseStyles.get(n)??n.style,r=t(n,e);n.style=r?{...o,...r}:o}this._stylePaintPending=!0}}computeScene(e){const{config:t}=this,n=this.projection,o=this.geoPath,r=this.scales,i=this.baseScale,a=[...this.baseTranslate],s=[...this.baseRotation],c=this.scene;this.projection=function(e){if(!e)return Y();if("string"==typeof e){const t=ee[e];return t?t():("production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Unknown projection "${e}", falling back to equalEarth`),Y())}if("object"==typeof e&&"type"in e){const t=ee[e.type],n=t?t():Y();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=l(this.projection),this.fitProjection(e),this.geoPath=l(this.projection);const u=this.projection;this.scales={projection:u,geoPath:this.geoPath,projectedPoint:(e,t)=>u([e,t]),invertedPoint:(e,t)=>u.invert?u.invert([e,t]):null},this._customLayoutFailedThisBuild=!1;const h=this.buildSceneNodes(e);if(this._customLayoutFailedThisBuild)!0===this.lastCustomLayoutFailure?.preservedLastGoodScene?(this.projection=n,this.geoPath=o,this.scales=r,this.baseScale=i,this.baseTranslate=a,this.baseRotation=s):(this.scene=[],this.rebuildQuadtree());else{if(this.scene=h,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,o=this.scene.filter(e=>"point"===e.type).map(e=>({...e,x:t,y:n}));o.length>0&&this.startTransition(o)}this._hasRenderedOnce=!0,t.transition&&c.length>0&&this.startTransition(c),this.version++}}fitProjection(e){const t=this.projection,n=this.config,o=[...this.areas],r=te(n.xAccessor,"lon"),i=te(n.yAccessor,"lat"),a=this.getPoints();if(a.length>0){const e=a.map(e=>[r(e),i(e)]);o.push({type:"Feature",properties:{},geometry:{type:"MultiPoint",coordinates:e}})}const s=ne(n.lineDataAccessor);for(const e of this.lineData){const t=s(e);if(t&&t.length>0){const e=t.map(e=>[r(e),i(e)]);o.push({type:"Feature",properties:{},geometry:{type:"LineString",coordinates:e}})}}if(0!==o.length){if(n.projectionExtent){const[[o,r],[i,a]]=n.projectionExtent;t.fitExtent([[0,0],[e.width,e.height]],{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[[o,r],[i,r],[i,a],[o,a],[o,r]]]}})}else if(t.clipAngle&&(t.clipAngle()??0)>0){const o=n.fitPadding??0,r=Math.min(e.width,e.height);t.scale(r/2-r*o),t.translate([e.width/2,e.height/2])}else{const r={type:"FeatureCollection",features:o},i=n.fitPadding??0;1>i||"undefined"==typeof process||"production"===process.env.NODE_ENV||console.warn(`[semiotic] fitPadding=${i} looks like pixels, but it's a fraction of the plot (0–0.5). A value >= 1 collapses the projection off-canvas — use e.g. 0.06.`);const a=e.width*i,s=e.height*i;t.fitExtent([[a,s],[e.width-a,e.height-s]],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 o=this.geoPath,r=this.scales,i=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=l(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 c=this.buildSceneNodes(t);this._customLayoutFailedThisBuild?this.lastCustomLayoutFailure?.preservedLastGoodScene?(n.scale(i),n.translate(a),this.currentZoom=s,this.geoPath=o,this.scales=r):(this.scene=[],this.rebuildQuadtree()):(this.scene=c,this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}applyZoomScale(e,t){const n=this.projection;if(!n)return;const o=this.geoPath,r=this.scales,i=n.scale(),a=[...n.translate()],s=this.currentZoom;n.scale(this.baseScale*e),n.translate(this.baseTranslate),this.currentZoom=e,this.geoPath=l(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 c=this.buildSceneNodes(t);this._customLayoutFailedThisBuild?this.lastCustomLayoutFailure?.preservedLastGoodScene?(n.scale(i),n.translate(a),this.currentZoom=s,this.geoPath=o,this.scales=r):(this.scene=[],this.rebuildQuadtree()):(this.scene=c,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 o=this.geoPath,r=this.scales,i=[...n.rotate()];n.rotate(e),this.geoPath=l(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(i),this.geoPath=o,this.scales=r):(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)}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&&(n++,e.r>t&&(t=e.r));if(this._maxPointRadius=t,e.QUADTREE_THRESHOLD>=n)return void(this._quadtree=null);const o=Array(n);let r=0;for(const e of this.scene)"point"===e.type&&(o[r++]=e);this._quadtree=d().x(e=>e.x).y(e=>e.y).addAll(o)}get quadtree(){return this._quadtree}get maxPointRadius(){return this._maxPointRadius}buildSceneNodes(e){this._customLayoutFailedThisBuild=!1;const{config:t}=this,n=this.projection,o=this.geoPath,r=te(t.xAccessor,"lon"),i=te(t.yAccessor,"lat");if(t.customLayout&&this.scales){const n=t.layoutMargin??{top:0,right:0,bottom:0,left:0},o=function(e,t,n){if(e&&"object"==typeof e&&!Array.isArray(e)){const t=Object.values(e).filter(e=>"string"==typeof e&&e.length>0);if(t.length>0)return t}if(Array.isArray(e)&&e.length>0)return e;if("string"==typeof e){const t=$[e];if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:n}(t.colorScheme,t.themeCategorical,_),r={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:[...o]},resolveColor:q(o,t.colorScheme),config:t.layoutConfig??{},selection:t.layoutSelection??null};let i;try{i=t.customLayout(r)}catch(e){const n=null!==this.lastCustomLayoutResult,o=function(e,t,n,o){const r=function(e){if(e instanceof Error)return{name:e.name||"Error",message:e.message||"Custom layout threw."};if("string"==typeof e)return{name:"Error",message:e};if(null==e)return{name:"Error",message:"Custom layout threw a nullish value."};try{return{name:"Error",message:e+""}}catch{return{name:"Error",message:"Custom layout threw a non-stringifiable value."}}}(t),i="network"===e?"customNetworkLayout":"customLayout";return{code:"CUSTOM_LAYOUT_ERROR",severity:"error",phase:"layout",component:e,source:i,message:`Semiotic ${e} ${i} failed: ${r.message}`,error:r,recovery:n?"preserved-last-good-scene":"empty-scene",preservedLastGoodScene:n,affectedRevision:o}}("geo",e,n,this.version);this.lastCustomLayoutFailure=o,this._customLayoutFailedThisBuild=!0,"production"!==process.env.NODE_ENV&&console.error("[semiotic] geo customLayout threw:",e);try{t.onLayoutError?.(o)}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=i.nodes??[];if(this.customLayoutOverlays=i.overlays??null,this.lastCustomLayoutResult=i,this.lastCustomLayoutFailure=null,this._customRestyle=i.restyle,this.hasCustomRestyle=!!i.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:o,warned:r}=e;V(o)&&0===n.length&&Z(r,"overlay-only",`[semiotic] ${t} returned overlays but no data-bearing scene nodes. Overlays do not participate in hover, selection, transitions, SSR evidence, or accessibility tables. Emit at least one scene node with a datum, or mark the overlay-only chart as intentionally decorative.`),n.length>0&&n.every(e=>null==e.datum)&&Z(r,"null-datums",`[semiotic] ${t} returned scene nodes, but every scene-node datum is null. Hover, callbacks, selection, and tooltip helpers need data-bearing nodes. Attach a user-facing datum to each interactive node, or set interactive overlays outside the chart.`)}({label:"geo customLayout",nodes:a,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned}),a}this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap;const a=[],s=function(e){return{fill:e.themeSemantic?.surface||"#e0e0e0",stroke:e.themeSemantic?.border||"#999",strokeWidth:.5,fillOpacity:1}}(t),l=function(e){return{stroke:e.themeSemantic?.primary||"#4e79a7",strokeWidth:1.5,fill:"none"}}(t),d=function(e){return{fill:e.themeSemantic?.primary||"#4e79a7",r:4,fillOpacity:.8}}(t);if(t.graticule){const n=!0===t.graticule?{}:t.graticule,r=c();n.step&&r.step(n.step);const i=o(r())||"";i&&a.push({type:"geoarea",pathData:i,centroid:[e.width/2,e.height/2],bounds:[[0,0],[e.width,e.height]],screenArea:0,style:{fill:"none",stroke:n.stroke||"#e0e0e0",strokeWidth:n.strokeWidth||.5,strokeDasharray:n.strokeDasharray||"2,2"},datum:null,interactive:!1})}for(const e of this.areas){const n=o(e);if(!n)continue;const r=o.centroid(e),i=o.bounds(e),l=o.area(e),c=oe(t.areaStyle,e,s);a.push({type:"geoarea",pathData:n,centroid:r,bounds:i,screenArea:l,style:c,datum:e,interactive:!0})}const f=ne(t.lineDataAccessor);for(const o of this.lineData){const s=f(o);if(!s||2>s.length)continue;let c=[];if("geo"===t.lineType){const e=Array(s.length);for(let t=0;s.length>t;t++)e[t]=[r(s[t]),i(s[t])];for(let t=0;e.length-1>t;t++){const o=e[t],r=e[t+1],i=u(o,r)||0,a=Math.max(2,Math.ceil(i/(Math.PI/180))),s=h(o,r);for(let e=0;a>=e;e++){if(t>0&&0===e)continue;const o=n(s(e/a));null!=o&&c.push(o)}}}else for(let e=0;s.length>e;e++){const t=s[e],o=n([r(t),i(t)]);null!=o&&c.push(o)}if(2>c.length)continue;const d=oe(t.lineStyle,o,l),p="number"==typeof d.strokeWidth?d.strokeWidth:1;2!==s.length||2>c.length||"arc"!==t.flowStyle?2!==s.length||2>c.length||"offset"!==t.flowStyle||(c="geo"===t.lineType?ae(c,p):se(c[0],c[c.length-1],0,0,p)):c=ie(c[0],c[c.length-1]);const m=re(c,e.width);if(m.length>1)for(const e of m){if(2>e.length)continue;const t={type:"line",path:e,style:{...d,_edgeFade:!0},datum:o};a.push(t)}else a.push({type:"line",path:2>c.length&&m[0]||c,style:d,datum:o})}const p=this.getPoints(),m=t.pointIdAccessor?"function"==typeof t.pointIdAccessor?t.pointIdAccessor:e=>e[t.pointIdAccessor]:null,y=n.clipAngle?n.clipAngle()??0:0,g=y>0?y*Math.PI/180:null,b=n.rotate?n.rotate():[0,0,0],v="function"==typeof n.center?n.center():[0,0],x=[(v[0]??0)-b[0],(v[1]??0)-b[1]];for(let e=0;p.length>e;e++){const o=p[e],s=r(o),l=i(o);if(null!=g&&u([s,l],x)>g)continue;const c=n([s,l]);if(!c)continue;const h=t.pointStyle?t.pointStyle(o):{...d},f={type:"point",x:c[0],y:c[1],r:h.r||4,style:h,datum:o,pointId:m?m(o)+"":void 0};a.push(f)}return a}applyCartogramTransform(e,t){const n=function(e,t,n,o){const r=e.filter(e=>"point"===e.type);if(2>r.length)return null;const i=t.strength??1;if(0===i)return null;const a=t.centerAccessor?"function"==typeof t.centerAccessor?t.centerAccessor:e=>e[t.centerAccessor]:e=>e.id,s="function"==typeof t.costAccessor?t.costAccessor:e=>e[t.costAccessor],l=r.find(e=>e.datum&&a(e.datum)+""==t.center+"");if(!l)return"production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Distance cartogram center "${t.center}" not found in point data`),null;const c=l.x,u=l.y,h=ue(r.map(e=>e.datum?s(e.datum):NaN).filter(e=>isFinite(e)&&e>=0),1),d=Math.min(n.width,n.height)/2,f=le().domain([0,h]).range([0,d]);o>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)}for(const e of r){if(e===l)continue;if(!e.datum)continue;const t=Math.atan2(e.y-u,e.x-c),n=Math.sqrt((e.x-c)**2+(e.y-u)**2),o=s(e.datum),r=n+((isFinite(o)?f(o):n)-n)*i;e.x=c+Math.cos(t)*r,e.y=u+Math.sin(t)*r}const p=n.width/2,m=n.height/2,y=p-l.x,g=m-l.y;if(Math.abs(y)>.5||Math.abs(g)>.5)for(const e of r)e.x+=y,e.y+=g;const b={cx:p,cy:m,maxCost:h,availableRadius:d},v=e.filter(e=>"line"===e.type);if(v.length>0&&"fractional"!==t.lineMode){const e=new Map;for(const t of r)t.pointId&&e.set(t.pointId,[t.x,t.y]);for(const t of v){const n=t.datum?.source,o=t.datum?.target;if(n&&o){const r=e.get(n+""),i=e.get(o+"");r&&i&&(t.path=[r,i])}}}return b}(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 o=0;n.length>o;o++){const r=y(e,o,t);n[o]._decayOpacity=r,n[o].style={...n[o].style,opacity:r}}}applyPulse(){const e=this.config.pulse;if(!e||!this.timestampBuffer)return;const t=m(),n=this.scene.filter(e=>"point"===e.type),o=this.timestampBuffer.toArray();for(let r=0;n.length>r&&o.length>r;r++){const i=g(e,o[r],t);i>0&&(n[r]._pulseIntensity=i,n[r]._pulseColor=e.color||"rgba(255,255,255,0.6)",n[r]._pulseGlowRadius=e.glowRadius??4)}}get hasActivePulses(){return function(e,t,n=("undefined"!=typeof performance?performance.now():Date.now())){if(!t||0===t.size)return!1;const o=e.duration??500,r=t.peek();return null!=r&&o>n-r}(this.config.pulse??{},this.timestampBuffer)}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 o=this.scene.filter(e=>"point"===e.type);let r=!1;for(const e of o)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)&&(r=!0))}for(const e of o)e.pointId&&!n.has(e.pointId)&&(e._targetOpacity=e.style?.opacity??1,e.style={...e.style,opacity:0},r=!0);r&&(this.activeTransition={startTime:m(),duration:t})}cancelIntroAnimation(){this.activeTransition=null}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),o=this.scene.filter(e=>"point"===e.type);for(const e of o){if(null!=e._targetX&&null!=e._targetY){const t=e.y;e.x=p(e.x,e._targetX,n),e.y=p(t,e._targetY,n)}null!=e._targetOpacity&&(e.style={...e.style,opacity:e._targetOpacity*n})}if(t>=1){for(const e of o)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}};de.QUADTREE_THRESHOLD=500;var fe=de;function pe(e,t=30){return Math.max((e??4)+5,12,t)}function me(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function ye(e,t){const n=me(e);if(!n)return!1;const o=me(t);return!o||n.getFullYear()!==o.getFullYear()||n.getMonth()!==o.getMonth()}var ge=[40,40],be=[.5,.5];function ve(e,t){const[n,o]=e.viewBox??ge,[r,i]=e.anchor??be,a=o>0?o:1,s=Math.max(0,t)/a,l=(n>0?n:a)*s,c=a*s;return{width:l,height:c,scale:s,offsetX:-r*l,offsetY:-i*c}}function xe(e,t){const n=ve(e,t),o=[[n.offsetX,n.offsetY],[n.offsetX+n.width,n.offsetY],[n.offsetX,n.offsetY+n.height],[n.offsetX+n.width,n.offsetY+n.height]];let r=0;for(const[e,t]of o){const n=Math.sqrt(e*e+t*t);n>r&&(r=n)}return r}function we(e,t,n,o){if("none"!==e)return"color"===e||null==e?t??o:"accent"===e?n:e}var ke=null;function Se(e){if("undefined"==typeof Path2D)return null;ke||(ke=new Map);const t=ke.get(e);if(t)return t;const n=new Path2D(e);return ke.size>1024&&ke.clear(),ke.set(e,n),n}function Me(e,t,n=0,o="horizontal"){const[r,i]=e.viewBox??ge,a=Math.min(1,Math.max(0,n)),s=Math.min(1,Math.max(0,t));return s>a?a>0||1>s?"vertical"===o?{x:0,y:i*(1-s),width:r,height:i*(s-a)}:{x:r*a,y:0,width:r*(s-a),height:i}:null:{x:0,y:0,width:0,height:0}}function Ae(e,t){const n=ve(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 Ce(e,t,n,o,r,i=e=>e){for(const a of t.parts){const t=Se(a.d);if(!t)continue;const s=a.opacity??1,l=e.globalAlpha;1!==s&&(e.globalAlpha=l*s);const c=r?"none"===a.fill?void 0:r:we(a.fill,n,o);c&&(e.fillStyle=i(c),e.fill(t));const u=r?a.stroke&&"none"!==a.stroke?r:void 0:we(a.stroke??"none",n,o);u&&(e.strokeStyle=i(u),e.lineWidth=a.strokeWidth??1,e.lineCap=a.strokeLinecap??"butt",e.lineJoin=a.strokeLinejoin??"miter",e.stroke(t)),1!==s&&(e.globalAlpha=l)}}function Le(e,t,n,o,r,i,a=0,s=o){if(i){const e=function(e,t,n,o,r,i=e=>e.x,a=e=>e.y,s=e=>e.r){const l=Math.max(o,r+5,12),c=t-l,u=t+l,h=n-l,d=n+l;let f=null,p=1/0;return e.visit((e,r,l,m,y)=>{if(r>u||c>m||l>d||h>y)return!0;if(!e.length){let r=e;do{const e=r.data,l=i(e)-t,c=a(e)-n,u=Math.sqrt(l*l+c*c);pe(s(e),o)>=u&&p>u&&(f=e,p=u),r=r.next}while(r)}return!1}),f?{node:f,distance:p}:null}(i,t,n,o,a);if(e)return e}else{let r=null,i=o;for(const a of e){if("point"!==a.type)continue;const e=a.x-t,s=a.y-n,l=Math.sqrt(e*e+s*s);pe(a.r,o)>=l&&i>l&&(r=a,i=l)}if(r)return{node:r,distance:i}}let l=null,c=o;for(const r of e){if("glyph"!==r.type)continue;if(null==r.datum)continue;const e=Ae(r.glyph,r.size),i=r.x+e.centerDx-t,a=r.y+e.centerDy-n,s=Math.sqrt(i*i+a*a);pe(e.radius,o)>=s&&c>s&&(l=r,c=s)}if(l)return{node:l,distance:c};for(let o=e.length-1;o>=0;o--){const i=e[o];if("geoarea"!==i.type)continue;const a=i;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)),r.isPointInPath(a._cachedPath2D,t,n)))return{node:a,distance:0}}let u=null,h=s;for(const o of e){if("line"!==o.type)continue;const e=o,{path:r}=e,i=Math.max((e.style.strokeWidth||2)+4,5,s);for(let o=0;r.length-1>o;o++){const[a,s]=r[o],[l,c]=r[o+1],d=je(t,n,a,s,l,c);i>=d&&h>d&&(u=e,h=d)}}return u?{node:u,distance:h}:null}function je(e,t,n,o,r,i){const a=r-n,s=i-o,l=a*a+s*s;if(0===l)return Math.sqrt((e-n)**2+(t-o)**2);let c=((e-n)*a+(t-o)*s)/l;return c=Math.max(0,Math.min(1,c)),Math.sqrt((e-(n+c*a))**2+(t-(o+c*s))**2)}import*as Pe from"react";import{useCallback as Ie,useEffect as De,useLayoutEffect as ze,useMemo as Re,useRef as Oe}from"react";import{createContext as Te,useCallback as Ne,useContext as $e,useMemo as We,useRef as _e,useSyncExternalStore as Ee}from"react";import{jsx as Be}from"react/jsx-runtime";function He(e){let t=null;const n=()=>(t||(t=Te(null)),t),o=Fe(e);return[function({children:t,initialState:o}){const r=_e(o),i=We(()=>Fe(e,r.current),[]),a=n();return Be(a.Provider,{value:i,children:t})},(e,t)=>{const r=n(),i=$e(r)??o,a=_e(e);a.current=e;const s=_e({hasValue:!1,value:void 0}),l=Ne(()=>{const e=a.current(i.getState()),n=s.current;return n.hasValue&&t&&t(n.value,e)?n.value:(s.current={hasValue:!0,value:e},e)},[i,t]),c=Ne(()=>a.current(i.getState()),[i]);return Ee(i.subscribe,l,c)}]}function Fe(e,t){const n=new Set;let o={...e(function(e){const t=e(o);if(function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}(t)){o={...o,...t};for(const e of n)e()}}),...t??{}};return{getState:()=>o,subscribe:function(e){return n.add(e),()=>{n.delete(e)}}}}function Ge(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 qe(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t={...t,colors:{...t.colors,categorical:Ve}}),e.accessibility.highContrast){const e="dark"===t.mode;t={...t,colors:{...t.colors,text:e?"#ffffff":"#000000",textSecondary:e?"#cccccc":"#333333",grid:e?"#666666":"#999999",border:e?"#888888":"#000000"}}}return t}var Ve=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],Ze={mode:"light",colors:{primary:"#00a2ce",secondary:"#6c757d",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"transparent",surface:"#ffffff",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc",selection:"#00a2ce",selectionOpacity:.15,success:"#2ca02c",danger:"#d62728",warning:"#f0ad4e",error:"#b4181b",info:"#00a2ce"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:12}},Ue={mode:"dark",colors:{primary:"#4fc3f7",secondary:"#90a4ae",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",diverging:"RdBu",background:"#1a1a2e",surface:"#252540",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555",selection:"#4fc3f7",selectionOpacity:.15,success:"#81c784",danger:"#ef5350",warning:"#ffb74d",error:"#d84848",info:"#4fc3f7"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:12}},Ye={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:Ve,sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#000000",textSecondary:"#333333",grid:"#999999",border:"#000000",focus:"#0000cc",selection:"#0000cc",selectionOpacity:.1,success:"#006400",danger:"#cc0000",warning:"#b15a00",error:"#8b0000",info:"#0000cc"},typography:{fontFamily:"system-ui, sans-serif",titleSize:18,labelSize:14,tickSize:12},tooltip:{background:"#000000",text:"#ffffff",borderRadius:"4px",fontSize:"14px",shadow:"0 2px 8px rgba(0, 0, 0, 0.3)"},borderRadius:"4px"};function Xe(e,t){if("light"===t)return Ze;if("dark"===t)return Ue;if("high-contrast"===t)return Ye;if("string"==typeof t)return void 0!==console&&console.warn(`[ThemeStore] Unknown theme preset "${t}". Keeping current theme.`),e;if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?Ue:Ze;return qe({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}return qe({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}var[Qe,Ke]=He(e=>({theme:Ze,setTheme(t){e(e=>({theme:Xe(e.theme,t)}))}}));import{useState as Je,useEffect as et}from"react";import{useRef as tt,useState as nt,useEffect as ot}from"react";var rt=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,it=new WeakMap,at=0,st=!1,lt=null,ct=null;function ut(e,t){if(!t)return t;const n=rt.exec(t);if(!n)return t;const o=e.canvas;if(!o)return n[2]?.trim()||t;!function(){if(st)return;if("undefined"==typeof window||"undefined"==typeof document)return;st=!0;const e=()=>{at++};if("undefined"!=typeof MutationObserver&&document.documentElement&&new MutationObserver(e).observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]}),"function"==typeof window.matchMedia)try{lt=window.matchMedia("(prefers-color-scheme: dark)"),ct=e,"function"==typeof lt.addEventListener?lt.addEventListener("change",ct):"function"==typeof lt.addListener&&lt.addListener(ct)}catch{}}();let r=it.get(o);r&&r.version===at||(r={version:at,map:new Map},it.set(o,r));const i=r.map.get(t);if(void 0!==i)return i;const a=getComputedStyle(o).getPropertyValue(n[1]).trim()||n[2]?.trim()||t;return r.map.set(t,a),a}var ht="undefined"==typeof window?De:ze,dt={requestAnimationFrame:e=>("undefined"==typeof window?globalThis:window).requestAnimationFrame(e),cancelAnimationFrame:e=>("undefined"==typeof window?globalThis:window).cancelAnimationFrame(e)};function ft(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function pt(e){const t=function(){const[e,t]=Je(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return et(()=>{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=Oe(t);n.current=t;const[o,r]=function(e,t,n){const o=tt(null),[r,i]=nt(null);return ot(()=>{if(!t&&!n)return;const e=o.current;if(!e)return;const r=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;i(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return r.observe(e),()=>r.disconnect()},[t,n]),[o,[t&&r?r.w:e[0],n&&r?r.h:e[1]]]}(e.sizeProp,e.responsiveWidth,e.responsiveHeight),i=Re(()=>({...e.marginDefault,...e.userMargin}),[e.marginDefault,e.userMargin]),a=r[0]-i.left-i.right,s=r[1]-i.top-i.bottom,l=ft(e.foregroundGraphics,r,i),c=ft(e.backgroundGraphics,r,i),u=Ke(e=>e.theme),{transition:h,introEnabled:d}=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),f="semiotic-table-"+Pe.useId(),p=Oe(null),m=Oe(e.frameScheduler??dt);m.current=e.frameScheduler??dt;const y=Oe(null),g=Oe(!1),b=Oe(()=>{}),v=Ie(()=>{if(null!==p.current||g.current)return;const e=m.current;let t=!1,n=!1;const o=e.requestAnimationFrame(()=>{t=!0;const e=!n;e&&(g.current=!0),p.current=null,y.current=null;try{b.current()}finally{e&&(g.current=!1)}});n=!0,t||(p.current=o,y.current=e)},[]),x=Ie(()=>{null!==p.current&&((y.current??m.current).cancelAnimationFrame(p.current),p.current=null,y.current=null)},[]);De(()=>()=>{x()},[x]);const w=Oe(()=>{}),k=Oe(()=>{}),S=Oe(null),M=Oe(null),A=Oe(null),C=Ie(()=>{const e=S.current;S.current=null,e&&w.current(e)},[]),L=Ie(e=>{if(S.current={clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType},null===M.current){const e=m.current;let t=!1;const n=e.requestAnimationFrame(()=>{t=!0,M.current=null,A.current=null,C()});t||(M.current=n,A.current=e)}},[C]),j=Ie(()=>{S.current=null,null!==M.current&&((A.current??m.current).cancelAnimationFrame(M.current),M.current=null,A.current=null),k.current()},[]);De(()=>()=>{S.current=null,null!==M.current&&((A.current??m.current).cancelAnimationFrame(M.current),M.current=null,A.current=null)},[]);const P=e.themeDirtyRef;return ht(()=>{P&&(at++,P.current=!0,v())},[u,v,P]),{reducedMotion:t,reducedMotionRef:n,responsiveRef:o,size:r,margin:i,adjustedWidth:a,adjustedHeight:s,resolvedForeground:l,resolvedBackground:c,currentTheme:u,transition:h,introEnabled:d,tableId:f,rafRef:p,renderFnRef:b,scheduleRender:v,cancelRender:x,hoverHandlerRef:w,hoverLeaveRef:k,onPointerMove:L,onPointerLeave:j}}import{useEffect as mt,useRef as yt}from"react";import{useEffect as gt,useRef as bt}from"react";var vt={fresh:1,aging:.7,stale:.45,expired:.25},xt={alpha:1,band:"fresh",isStale:!1};import{jsx as wt}from"react/jsx-runtime";function kt({isStale:e,position:t}){return wt("div",{className:"stream-staleness-badge",style:{position:"absolute",..."top-left"===t?{top:4,left:4}:"bottom-left"===t?{bottom:4,left:4}:"bottom-right"===t?{bottom:4,right:4}:{top:4,right:4},padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",zIndex:3,background:e?"#dc3545":"#28a745",color:"white"},children:e?"STALE":"LIVE"})}import{useMemo as St,useRef as Mt,useEffect as At}from"react";import*as Ct from"react";import{jsx as Lt,jsxs as jt}from"react/jsx-runtime";var Pt={fill:(e,t)=>Lt("rect",{style:e,width:t,height:t}),line:(e,t)=>Lt("line",{style:e,x1:0,y1:0,x2:t,y2:t})};function It(e,t,n,o,r){let i;return i="function"==typeof n?n(e):(0,Pt[n])(o(e,t),r),i}function Dt({swatchSize:e}){return Lt("path",{d:`M${.25*e},${.55*e} L${.45*e},${.75*e} L${.8*e},${.3*e}`,fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function zt(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}var Rt=(e,t,n,o,r,i,a,s,l,c,u)=>{const{type:h="fill",styleFn:d,items:f}=e,p=[];let m=0;const y=!(!t&&!n),g="isolate"===c||void 0===c&&null!=r,{swatchSize:b,labelGap:v,rowHeight:x}=u;return f.forEach((e,c)=>{const u=It(e,c,h,d,b),w=zt(e,o,r),k=r&&r.size>0&&r.has(e.label);p.push(jt("g",{transform:`translate(0,${m})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:y?s===i&&c===a?0:-1:void 0,role:y?"option":void 0,"aria-selected":y&&g?k||!1:void 0,"aria-current":y&&!g&&null!=o&&e.label===o||void 0,"aria-label":e.label,onKeyDown:y?n=>{if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowDown"===n.key||"ArrowUp"===n.key){n.preventDefault();const e=(c+("ArrowDown"===n.key?1:-1)+f.length)%f.length;l(s,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:y?t=>{l(s,c),n&&n(e);const o=t.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:y?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:y?"pointer":"default",opacity:w,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[y&&Lt("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:b+v+2+7*e.label.length,height:b+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),u,k&&Lt(Dt,{swatchSize:b}),Lt("text",{y:b/2,x:b+v,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+c)),m+=x}),p};function Ot({config:e,orientation:t="vertical",width:n=100}){const{colorFn:o,domain:r,label:i,format:a}=e,s=a||(e=>Math.round(100*e)/100+""),l="grad-legend-"+Ct.useId();if("horizontal"===t){const e=12,t=Math.min(n,200),a=Math.max(0,(n-t)/2),c=[];for(let e=0;64>=e;e++){const t=e/64;c.push(Lt("stop",{offset:100*t+"%",stopColor:o(r[0]+t*(r[1]-r[0]))},e))}return jt("g",{"aria-label":i||"Gradient legend",children:[Lt("defs",{children:Lt("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),i&&Lt("text",{x:a+t/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),Lt("rect",{x:a,y:0,width:t,height:e,fill:`url(#${l})`,rx:2}),Lt("text",{x:a,y:e+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:s(r[0])}),Lt("text",{x:a+t,y:e+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:s(r[1])})]})}const c=[];for(let e=0;64>=e;e++){const t=e/64;c.push(Lt("stop",{offset:100*t+"%",stopColor:o(r[1]-t*(r[1]-r[0]))},e))}return jt("g",{"aria-label":i||"Gradient legend",children:[i&&Lt("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),Lt("defs",{children:Lt("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:c})}),Lt("rect",{x:0,y:0,width:14,height:100,fill:`url(#${l})`,rx:2}),Lt("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:s(r[1])}),Lt("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:s(r[0])})]})}function Tt(e){const{legendGroups:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,legendInteraction:a,title:s="Legend",width:l=100,height:c=20,orientation:u="vertical",legendLayout:h}=e,d=function(e){const t=Math.max(1,e?.swatchSize??16),n=Math.max(t,e?.rowHeight??22);return{swatchSize:t,labelGap:Math.max(0,e?.labelGap??6),itemGap:Math.max(0,e?.itemGap??10),rowHeight:n,align:"left"===e?.align?"start":"right"===e?.align?"end":e?.align??"start",maxWidth:e?.maxWidth}}(h),[f,p]=Ct.useState(0),[m,y]=Ct.useState(0),g=Ct.useCallback((e,t)=>{p(e),y(t)},[]),b="vertical"===u?(({legendGroups:e,width:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:a,focusedItemIndex:s,onFocusedIndexChange:l,legendInteraction:c,metrics:u})=>{let h=24;const d=[];return e.forEach((e,f)=>{h+=5,d.push(Lt("line",{stroke:"gray",x1:0,y1:h,x2:t,y2:h},"legend-top-line legend-symbol-"+f)),h+=8,e.label&&(h+=16,d.push(Lt("text",{y:h,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label},"legend-text-"+f)),h+=8),d.push(Lt("g",{className:"legend-item",transform:`translate(0,${h})`,children:Rt(e,n,o,r,i,a,s,f,l,c,u)},"legend-group-"+f)),h+=e.items.length*u.rowHeight+8}),d})({legendGroups:t||[],width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:m,onFocusedIndexChange:g,legendInteraction:a,metrics:d}):(({legendGroups:e,height:t,width:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:s,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u,metrics:h})=>{let d=0;const f=[];e.forEach((e,t)=>{let p=0;e.label&&(p+=16);const m=((e,t,n,o,r,i,a,s,l,c,u,h)=>{const{type:d="fill",styleFn:f,items:p}=e,m=[],{swatchSize:y,labelGap:g,itemGap:b,rowHeight:v,align:x}=u,w=!(!t&&!n),k="isolate"===c||void 0===c&&null!=r,S=p.map(e=>y+g+7*e.label.length),M=[];let A=0,C=0;S.forEach((e,t)=>{const n=0===C?e:C+b+e;h&&h>0&&C>0&&n>h?(M.push({start:A,end:t,width:C}),A=t,C=e):C=n}),p.length>0&&M.push({start:A,end:p.length,width:C}),M.forEach((e,c)=>{let u="center"===x?Math.max(0,((h??e.width)-e.width)/2):"end"===x?Math.max(0,(h??e.width)-e.width):0;for(let h=e.start;e.end>h;h++){const e=p[h],x=It(e,h,d,f,y),M=zt(e,o,r),A=r&&r.size>0&&r.has(e.label);m.push(jt("g",{transform:`translate(${u},${c*v})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:w?s===i&&h===a?0:-1:void 0,role:w?"option":void 0,"aria-selected":w&&k?A||!1:void 0,"aria-current":w&&!k&&null!=o&&e.label===o||void 0,"aria-label":e.label,onKeyDown:w?n=>{if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowRight"===n.key||"ArrowLeft"===n.key){n.preventDefault();const e=(h+("ArrowRight"===n.key?1:-1)+p.length)%p.length;l(s,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:w?t=>{l(s,h),n&&n(e);const o=t.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:w?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:w?"pointer":"default",opacity:M,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[w&&Lt("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:y+g+2+7*e.label.length,height:y+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),x,A&&Lt(Dt,{swatchSize:y}),Lt("text",{y:y/2,x:y+g,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+h)),u+=S[h]+b}});const L=Math.max(0,...M.map(e=>e.width)),j=M.length;return{items:m,offset:L,totalRows:j,totalHeight:j*v}})(e,o,r,i,a,s,l,t,c,u,h,h.maxWidth??n);p+=m.offset+5,f.push({label:e.label,...m,offset:p,totalRows:m.totalRows,totalHeight:m.totalHeight}),d+=p+12});const p=h.maxWidth??n;let m=d>p?0:"center"===h.align?Math.max(0,(p-d)/2):"end"===h.align?Math.max(0,p-d):0;const y=[];return f.forEach((n,o)=>{const r=e[o];r.label&&(y.push(Lt("text",{transform:`translate(${m},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:r.label},"legend-text-"+o)),m+=16),y.push(Lt("g",{className:"legend-item",transform:`translate(${m},0)`,children:n.items},"legend-group-"+o)),m+=n.offset+5,e[o+1]&&y.push(Lt("line",{stroke:"gray",x1:m,y1:-8,x2:m,y2:(n.totalHeight||t)+0+8},"legend-top-line legend-symbol-"+o)),m+=12}),Lt("g",{children:y})})({legendGroups:t||[],title:s,height:c,width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:m,onFocusedIndexChange:g,legendInteraction:a,metrics:d}),v=!(!n&&!o);return jt("g",{role:v?"listbox":void 0,"aria-multiselectable":!(!v||"isolate"!==a&&(void 0!==a||null==i))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==s&&""!==s&&"vertical"===u&&Lt("text",{className:"legend-title",y:16,x:l/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:s}),b]})}function Nt(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}import{jsx as $t}from"react/jsx-runtime";function Wt(e){const{legend:t,totalWidth:n,totalHeight:o,margin:r,legendPosition:i="right",legendLayout:a,title:s,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:h,legendInteraction:d}=e;if(!t)return null;const f="top"===i||"bottom"===i,p=!!s,m=Math.max(0,n-r.left-r.right),y=Math.max(1,f?a?.maxWidth??m:100);let g,b;return"left"===i?(g=Math.max(4,r.left-y-10),b=r.top):"top"===i?(g=r.left,b=p?32:8):"bottom"===i?(g=r.left,b=o-r.bottom+38):(g=n-r.right+10,b=r.top),$t("g",{transform:`translate(${g}, ${b})`,children:(v=t,"object"==typeof v&&null!==v&&"gradient"in v?$t(Ot,{config:t.gradient,orientation:f?"horizontal":"vertical",width:y}):Nt(t)?$t(Tt,{legendGroups:t.legendGroups,title:"",width:y,orientation:f?"horizontal":"vertical",legendLayout:a,customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:h,legendInteraction:d}):t)});var v}import{useMemo as _t}from"react";import{bin as Et}from"d3-array";import{jsx as Bt,jsxs as Ht}from"react/jsx-runtime";function Ft(e){return"string"==typeof e?{type:e}:e}function Gt({orient:e,config:t,values:n,scale:o,size:r,length:i}){const a=function(e){return{type:e.type,bins:e.bins??20,fill:e.fill??"#4e79a7",fillOpacity:e.fillOpacity??.5,stroke:e.stroke??"none",strokeWidth:e.strokeWidth??1}}(t),s="top"===e||"bottom"===e,l=_t(()=>{if(0===n.length)return null;const t=o.domain(),l=r-8;if("boxplot"===a.type){const t=function(e){const t=[...e].sort((e,t)=>e-t),n=t.length;if(0===n)return null;const o=t[Math.floor(.25*n)],r=t[Math.floor(.5*n)],i=t[Math.floor(.75*n)],a=i-o;return{q1:o,median:r,q3:i,whiskerLow:Math.max(t[0],o-1.5*a),whiskerHigh:Math.min(t[n-1],i+1.5*a)}}(n);if(!t)return null;const{q1:r,median:i,q3:c,whiskerLow:u,whiskerHigh:h}=t,d=Math.min(.5*l,20),f=(l-d)/2+4;if(s){const t=o(r),n=o(c),s=o(i),l=o(u),p=o(h),m="top"===e?-1:1,y=0;return Ht("g",{"data-testid":"marginal-boxplot-"+e,children:[Bt("line",{x1:l,y1:y+m*(f+d/2),x2:p,y2:y+m*(f+d/2),stroke:a.fill,strokeWidth:a.strokeWidth}),Bt("line",{x1:l,y1:y+m*f,x2:l,y2:y+m*(f+d),stroke:a.fill,strokeWidth:a.strokeWidth}),Bt("line",{x1:p,y1:y+m*f,x2:p,y2:y+m*(f+d),stroke:a.fill,strokeWidth:a.strokeWidth}),Bt("rect",{x:Math.min(t,n),y:"top"===e?y-f-d:y+f,width:Math.abs(n-t),height:d,fill:a.fill,fillOpacity:a.fillOpacity,stroke:"none"===a.stroke?a.fill:a.stroke,strokeWidth:a.strokeWidth}),Bt("line",{x1:s,y1:"top"===e?y-f-d:y+f,x2:s,y2:"top"===e?y-f:y+f+d,stroke:a.fill,strokeWidth:2})]})}{const t=o(r),n=o(c),s=o(i),l=o(u),p=o(h),m="left"===e?-1:1,y=0;return Ht("g",{"data-testid":"marginal-boxplot-"+e,children:[Bt("line",{x1:y+m*(f+d/2),y1:l,x2:y+m*(f+d/2),y2:p,stroke:a.fill,strokeWidth:a.strokeWidth}),Bt("line",{x1:y+m*f,y1:l,x2:y+m*(f+d),y2:l,stroke:a.fill,strokeWidth:a.strokeWidth}),Bt("line",{x1:y+m*f,y1:p,x2:y+m*(f+d),y2:p,stroke:a.fill,strokeWidth:a.strokeWidth}),Bt("rect",{x:"left"===e?y-f-d:y+f,y:Math.min(t,n),width:d,height:Math.abs(n-t),fill:a.fill,fillOpacity:a.fillOpacity,stroke:"none"===a.stroke?a.fill:a.stroke,strokeWidth:a.strokeWidth}),Bt("line",{x1:"left"===e?y-f-d:y+f,y1:s,x2:"left"===e?y-f:y+f+d,y2:s,stroke:a.fill,strokeWidth:2})]})}}const c=Et().domain(t).thresholds(a.bins)(n);if(0===c.length)return null;const u=ue(c.map(e=>e.length));if(0===u)return null;if("histogram"===a.type)return Bt("g",{"data-testid":"marginal-histogram-"+e,children:c.map((t,n)=>{if(null==t.x0||null==t.x1)return null;const r=t.length/u*l;if(s){const i=o(t.x0),s=o(t.x1)-o(t.x0);return Bt("rect",{x:i,y:"top"===e?-4-r:4,width:Math.max(s,.5),height:r,fill:a.fill,fillOpacity:a.fillOpacity,stroke:a.stroke,strokeWidth:a.strokeWidth},n)}{const i=o(t.x0),s=o(t.x1)-o(t.x0);return Bt("rect",{x:"left"===e?-4-r:4,y:Math.min(i,i+s),width:r,height:Math.abs(s),fill:a.fill,fillOpacity:a.fillOpacity,stroke:a.stroke,strokeWidth:a.strokeWidth},n)}})});if("violin"===a.type){const t=l/2+4,n=[];for(const r of c){if(null==r.x0||null==r.x1)continue;const i=r.length/u*(l/2),a=o((r.x0+r.x1)/2);n.push(s?`${a},${"top"===e?-(t-i):t-i}`:`${"left"===e?-(t-i):t-i},${a}`)}for(let r=c.length-1;r>=0;r--){const i=c[r];if(null==i.x0||null==i.x1)continue;const a=i.length/u*(l/2),h=o((i.x0+i.x1)/2);n.push(s?`${h},${"top"===e?-(t+a):t+a}`:`${"left"===e?-(t+a):t+a},${h}`)}return Bt("g",{"data-testid":"marginal-violin-"+e,children:Bt("polygon",{points:n.join(" "),fill:a.fill,fillOpacity:a.fillOpacity,stroke:"none"===a.stroke?a.fill:a.stroke,strokeWidth:a.strokeWidth})})}if("ridgeline"===a.type){const t=[];if(s){const n=0,r=null!=c[0].x0?o(c[0].x0):0;t.push(`M${r},${n}`);for(const n of c){if(null==n.x0||null==n.x1)continue;const r=n.length/u*l,i=o((n.x0+n.x1)/2);t.push(`L${i},${"top"===e?-r-4:r+4}`)}const a=null!=c[c.length-1].x1?o(c[c.length-1].x1):i;t.push(`L${a},${n}`),t.push("Z")}else{const n=0,r=null!=c[0].x0?o(c[0].x0):0;t.push(`M${n},${r}`);for(const n of c){if(null==n.x0||null==n.x1)continue;const r=n.length/u*l,i=o((n.x0+n.x1)/2);t.push(`L${"left"===e?-r-4:r+4},${i}`)}const a=null!=c[c.length-1].x1?o(c[c.length-1].x1):i;t.push(`L${n},${a}`),t.push("Z")}return Bt("g",{"data-testid":"marginal-ridgeline-"+e,children:Bt("path",{d:t.join(" "),fill:a.fill,fillOpacity:a.fillOpacity,stroke:"none"===a.stroke?a.fill:a.stroke,strokeWidth:a.strokeWidth})})}return null},[n,o,a,r,i,e,s,4]);return l?Bt("g",{className:"marginal-"+e,"data-testid":"marginal-"+e,children:l}):null}import*as qt from"react";import{jsx as Vt,jsxs as Zt}from"react/jsx-runtime";function Ut(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),r=e.split(/\s+/),i=[];let a="";for(const e of r)a&&a.length+1+e.length>o?(i.push(a),a=e):a=a?`${a} ${e}`:e;return a&&i.push(a),i}function Yt(e,t,n,o){return"curly"===e?o?`M0,0 C${.6*n},0 ${.4*n},${t/2} ${n},${t/2} C${.4*n},${t/2} ${.6*n},${t} 0,${t}`:`M0,0 C0,${.6*n} ${t/2},${.4*n} ${t/2},${n} C${t/2},${.4*n} ${t},${.6*n} ${t},0`:o?`M0,0 L${n},0 L${n},${t} L0,${t}`:`M0,0 L0,${n} L${t},${n} L${t},0`}function Xt(e,t,n,o){if(!e)return Vt("g",{className:"annotation-note"});const{label:r,title:i,orientation:a,align:s,wrap:l=120,noWrap:c}=e;if(!r&&!i)return Vt("g",{className:"annotation-note"});let u=a;u||(u=Math.abs(t)>Math.abs(n)?"leftRight":"topBottom");let h=s;h&&"dynamic"!==h||(h="topBottom"===u?0>t?"right":"left":0>n?"bottom":"top");let d="start";"topBottom"===u?"right"===h?d="end":"middle"===h&&(d="middle"):d=0>t?"end":"start";const f=16,p=i?c?[i]:Ut(i,l):[],m=r?c?[r]:Ut(r,l):[],y="leftRight"===u?"end"===d?-4:4:0;let g=0;const b=[],v=o||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";e.useHTML||e.html?b.push(Vt("foreignObject",{className:"annotation-note-html",x:"end"===d?y-l:"middle"===d?y-l/2:y,y:-16,width:l,height:Math.max(f,(p.length+m.length)*f+(i&&r?2:0))+f,style:{overflow:"visible"},children:Zt("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{color:v,fontSize:"12px",lineHeight:"16px",overflow:"visible",textAlign:"end"===d?"right":"middle"===d?"center":"left",whiteSpace:c?"nowrap":"normal",wordBreak:"break-word"},children:[i&&Vt("div",{className:"annotation-note-title",style:{fontWeight:"bold"},children:i}),r&&Vt("div",{className:"annotation-note-label",children:r})]})},"annotation-note-html")):(p.length>0&&(b.push(Vt("text",{className:"annotation-note-title",fill:v,textAnchor:d,fontWeight:"bold",children:p.map((e,t)=>Vt("tspan",{x:y,dy:0===t?0:f,children:e},t))},"annotation-note-title")),g=p.length*f),m.length>0&&b.push(Vt("text",{className:"annotation-note-label",fill:v,textAnchor:d,y:g,children:m.map((e,t)=>Vt("tspan",{x:y,dy:0===t?0:f,children:e},t))},"annotation-note-label")));let x=null;if((i||r)&&(0!==t||0!==n))if("topBottom"===u){const e=Math.min(l,120);let t=0,n=e;"end"===d?(t=-e,n=0):"middle"===d&&(t=-e/2,n=e/2),x=Vt("line",{className:"note-line",x1:t,x2:n,y1:0,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)"})}else{const e=(p.length+m.length)*f+(m.length>0?f:0);let t=0,n=e;"bottom"===h?(t=-e,n=0):"middle"===h&&(t=-e/2,n=e/2),x=Vt("line",{className:"note-line",x1:0,x2:0,y1:t,y2:n,stroke:o||"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"===h?-(w+f+(m.length>0&&p.length>0?2:0))/2+8:"bottom"===h||0>n?-(w+2):18),Zt("g",{className:"annotation-note",transform:`translate(${t},${n})`,children:[Vt("g",{className:"annotation-note-content",transform:0!==k?`translate(0,${k})`:void 0,children:b}),x]})}function Qt(e,t,n,o,r){const i=[];switch(e){case"callout-circle":{const e=(t?.radius||0)+(t?.radiusPadding||0);e>0&&i.push(Vt("circle",{r:e,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const e=t?.width||0,o=t?.height||0;(e>0||o>0)&&i.push(Vt("rect",{width:e,height:o,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":t?.custom&&i.push(...Array.isArray(t.custom)?t.custom:[t.custom]);break;case"xy-threshold":{const e=o||0,a=r||0;if(void 0!==t?.x){const o=(t.x||0)-e;i.push(Vt("line",{x1:o,y1:(t.y1||0)-a,x2:o,y2:(t.y2||0)-a,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==t?.y){const o=(t.y||0)-a;i.push(Vt("line",{x1:(t.x1||0)-e,y1:o,x2:(t.x2||0)-e,y2:o,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==t?.x1||void 0!==t?.x2?i.push(Vt("line",{x1:(t.x1||0)-e,y1:0,x2:(t.x2||0)-e,y2:0,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===t?.y1&&void 0===t?.y2||i.push(Vt("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",o=t?.width??t?.height;void 0!==o&&i.push(Vt("path",{d:Yt(e,o,t?.depth||30,void 0===t?.width),fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return Vt("g",{className:"annotation-subject",children:i})}function Kt(e,t,n,o,r,i){const a=[];let s=0,l=0;if("callout-circle"!==r&&"label"!==r||!i?.radius){if("callout-rect"===r&&i){const n=i.width||0,o=i.height||0;if(n>0||o>0){const r=n/2,i=o/2,a=e-r,c=t-i;if(0!==a||0!==c){const e=Math.abs(a),t=Math.abs(c),u=n/2,h=o/2,d=e*h>t*u?u/e:h/t;s=r+a*d,l=i+c*d}}}else if("bracket"===r&&i){const e=i.width,t=i.height,n=i.depth||30;void 0!==e?(s=e/2,l=n):void 0!==t&&(s=n,l=t/2)}}else{const n=(i.radius||0)+(i.radiusPadding||0);if(n>0&&(0!==e||0!==t)){const o=Math.atan2(t,e);s=Math.cos(o)*n,l=Math.sin(o)*n}}const c=Math.sqrt((e-s)**2+(t-l)**2);if(c>.5){const r=o||"var(--semiotic-text-secondary, currentColor)",i="curve"===n?.type;let u=Math.atan2(t-l,e-s);if(i){const o=(s+e)/2,i=(l+t)/2,h=-(t-l)/c,d=(e-s)/c,f=(n?.curve??.25)*c,p=o+h*f,m=i+d*f;a.push(Vt("path",{className:"connector-curve",d:`M${s},${l}Q${p},${m} ${e},${t}`,fill:"none",stroke:r},"connector-line")),u=Math.atan2(m-l,p-s)}else a.push(Vt("line",{x1:s,y1:l,x2:e,y2:t,stroke:r},"connector-line"));if("arrow"===n?.end){const e=10,t=16/180*Math.PI;a.push(Vt("path",{d:`M${s},${l}L${s+e*Math.cos(u+t)},${l+e*Math.sin(u+t)}L${s+e*Math.cos(u-t)},${l+e*Math.sin(u-t)}Z`,fill:r,stroke:"none"},"connector-arrow"))}}return Vt("g",{className:"annotation-connector",children:a})}function Jt(e){const{x:t=0,y:n=0,dx:o,dy:r,nx:i,ny:a,note:s,connector:l,subject:c,type:u,color:h,className:d,disable:f,opacity:p,strokeDasharray:m,events:y={},"data-testid":g}=e,b=Array.isArray(t)?t[0]??0:t,v=Array.isArray(n)?n[0]??0:n,x=new Set(Array.isArray(f)?f:[]);let w=o||0,k=r||0;null!=i&&(w=i-b),null!=a&&(k=a-v);const S="string"==typeof u?u:"label";if("bracket"===S&&c&&0===w&&0===k)if(void 0!==c.width){w=c.width/2;const e=c.depth||30;k=e+(0>e?-5:5)}else if(void 0!==c.height){const e=c.depth||30;w=e+(0>e?-5:5),k=c.height/2}return Zt("g",{className:("annotation "+(d||"")).trim(),transform:`translate(${b},${v})`,"data-testid":g,...null!=p&&{opacity:p},...m&&{strokeDasharray:m},...y,children:[!x.has("connector")&&Kt(w,k,l,h,S,c),!x.has("subject")&&Qt(S,c,h,b,v),!x.has("note")&&Xt(s,w,k,h)]})}function en(e){const{noteData:t}=e,{screenCoordinates:n}=t,o="string"==typeof t.type?t.type:"label",r=t.eventListeners||t.events||{};if(t.coordinates&&n){const e=t.nx||n[0][0]+(t.dx??0),r=t.ny||n[0][1]+(t.dy??0),i=n.map((n,i)=>{const a=Object.assign({},t,{note:0===i?t.note:{label:""},x:n[0],y:n[1],nx:e,ny:r});return Vt(Jt,{"data-testid":"semiotic-annotation",...a,type:o},"multi-annotation-"+i)});return Vt("g",{children:i})}const i=t.note||{title:"none",label:t.label},a=`${i.label}-${i.title}-${t.i}`;return Vt(Jt,{"data-testid":"semiotic-annotation",events:r,...t,type:o},a)}import{packEnclose as tn}from"d3-hierarchy";import{area as nn,curveLinear as on,curveMonotoneX as rn,curveMonotoneY as an,curveStep as sn,curveStepAfter as ln,curveStepBefore as cn,curveBasis as un,curveCardinal as hn,curveCatmullRom as dn}from"d3-shape";import fn from"regression";function pn(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 mn(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 yn(e){return null==e?null:e+""}function gn(e,t,n){return t.stickyPositionCache?.set(e,n),n}function bn(e,t,n){const o=e.anchor||e.lifecycle?.anchor||"fixed";if("latest"===o){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let o=n.pointNodes.length-1;o>=0;o--){const r=n.pointNodes[o];if(r.pointId===e.pointId)return gn(t,n,{x:r.x,y:r.y})}const o=function(e){const t=e.data;if(!t||0===t.length)return null;const n=t[t.length-1],o=e.scales?.x??e.scales?.time,r=e.scales?.y??e.scales?.value;if(!o||!r)return null;const i=n[e.xAccessor||"x"],a=n[e.yAccessor||"y"];return null==i||null==a?null:{x:o(i),y:r(a)}}(n);return o?gn(t,n,o):null}if("semantic"===o){const o=function(e,t,n){const o=function(e){return yn(e.provenance?.stableId??e.stableId)}(e);if(!o)return null;const r=n.pointNodes?.find(e=>yn(e.pointId)===o);if(r)return gn(t,n,{x:r.x,y:r.y});const i=n.data?.find(e=>function(e){return yn(e.stableId??e.id??e.provenance?.stableId)}(e)===o);if(!i)return null;const a=pn(i,n),s=mn(i,n);return null==a||null==s?null:gn(t,n,{x:a,y:s})}(e,t,n);if(o)return o}let r=null,i=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(r=t.x,i=t.y)}if(null!=r&&null!=i||(r=pn(e,n),i=mn(e,n)),null!=r&&null!=i)return gn(t,n,{x:r,y:i});if("sticky"===o){const e=n.stickyPositionCache?.get(t);if(e)return e}return null}function vn(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}import{jsx as xn}from"react/jsx-runtime";var wn={secondary:0,primary:3};function kn(e){return!0===e?._annotationDeferred}function Sn(e){return"blended"===e?.cohesion||"layer"===e?.cohesion?e.cohesion:null}function Mn(e){const t=e?.provenance?.confidence;return"number"==typeof t&&Number.isFinite(t)?Math.max(0,Math.min(1,t)):null}function An(e){return Math.max(.72,.95-.06*e)}import{jsx as Cn,jsxs as Ln}from"react/jsx-runtime";var jn={linear:on,monotoneX:rn,monotoneY:an,step:sn,stepAfter:ln,stepBefore:cn,basis:un,cardinal:hn,catmullRom:dn};var Pn=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function In(e){return!!e&&"object"==typeof e&&Pn.has(function(e){return"string"==typeof e?.type?e.type:""}(e))}function Dn(e){return"primary"===e?.emphasis||!0===e?.defensive}function zn(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 Rn(e){let t;const n=e?.emphasis;t="primary"===n?100:"secondary"===n?10:50;const o=e?.provenance?.confidence;switch("number"==typeof o&&Number.isFinite(o)&&(t+=15*Math.max(0,Math.min(1,o))),e?.lifecycle?.freshness){case"fresh":t+=8;break;case"aging":t+=4;break;case"stale":t+=1;break;case"expired":t-=200}return t}new Set(["label","callout","callout-circle","callout-rect"]);var On=32,Tn=6,Nn=4,$n=8,Wn=72;var _n={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function En(e){if(!Bn(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 Bn(e){return In(e)}function Hn(e,t){if(!e)return[];const n=Math.max(1,Math.floor(t/7)),o=e.split(/\s+/).filter(Boolean),r=[];let i="";for(const e of o)i&&i.length+e.length+1>n?(r.push(i),i=e):i=i?`${i} ${e}`:e;return i&&r.push(i),r}function Fn(e,t,n,o,r){const i=e+n,a=t+o;return Math.abs(n)>Math.abs(o)?{x:0>n?i-r.width-4:i+4,y:0>o?a-r.height:a,width:r.width,height:r.height}:{x:0>n?i-r.width:i,y:0>o?a-r.height-4:a+4,width:r.width,height:r.height}}function Gn(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function qn(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 Vn(e,t,n,o,r,i,a,s){const l=Gn(e,a);let c=.4*Math.hypot(t.dx,t.dy)+80*function(e,t,n,o){const r=Math.max(0,o-e.x),i=Math.max(0,o-e.y);return(r+Math.max(0,e.x+e.width-(t-o)))*e.height+(i+Math.max(0,e.y+e.height-(n-o)))*e.width}(l,r,i,s);for(const e of n)c+=12*qn(l,e);for(const e of o)c+=4*qn(l,e);return c}function Zn(e){const{annotations:t,context:n,defaultOffset:o=On,notePadding:r=Tn,markPadding:i=Nn,edgePadding:a=$n,preserveManualOffsets:s=!0,routeLongConnectors:l=!0,connectorThreshold:c=Wn,density:u,progressiveDisclosure:h=!1,redundantCues:d=!1,responsive:f,mobile:p,cohesion:m,audience:y}=e,g=n.width||0,b=n.height||0,v="object"==typeof p?p:{},x=v.breakpoint??480,w=!!p&&x>=g,k=w&&!1!==v.preferShortText?t.map(En):t,S=w&&!u?{maxAnnotations:v.maxAnnotations??("callout-list"===v.strategy?1:2),minVisible:v.minVisible??1}:u,M=h||w&&(!1!==v.progressiveDisclosure||"callout-list"===v.strategy),A=w&&!f?v.responsive??{minWidth:x}:f,C=w&&!m?v.cohesion:m;if(0===k.length||0>=g||0>=b)return k.slice();const L=[],j=function(e,t){return(e.pointNodes||[]).map(e=>{const n=Math.max(1,e.r||1)+t;return{x:e.x-n,y:e.y-n,width:2*n,height:2*n}})}(n,i);let P=!1;const I=k.map((e,t)=>{if(!Bn(e))return e;const i=function(e,t,n){if("widget"===e.type&&"number"==typeof e.px&&"number"==typeof e.py)return{x:e.px,y:e.py};const o=e.pointId??e.nodeId;if(null!=o&&n.pointNodes){const e=n.pointNodes.find(e=>e.pointId===o);if(e)return{x:e.x,y:e.y}}const r=e.coordinates,i=n.scales?.geoProjection;if(Array.isArray(r)&&r.length>=2&&i){const e=r[0],t=r[1];if("number"==typeof e&&"number"==typeof t){const n=i([e,t]);if(n&&"number"==typeof n[0]&&"number"==typeof n[1])return{x:n[0],y:n[1]}}}return n.scales||"number"!=typeof e.x||"number"!=typeof e.y?bn(e,t,n):{x:e.x,y:e.y}}(e,t,n);if(!i)return e;const u=function(e){if("widget"===e.type)return{width:"number"==typeof e.width?e.width:32,height:"number"==typeof e.height?e.height:32};const t="number"==typeof e.wrap?e.wrap:120,n=[...Hn("string"==typeof e.title?e.title:void 0,t),...Hn("string"==typeof e.label?e.label:void 0,t)],o=n.reduce((e,t)=>Math.max(e,t.length),0);return{width:Math.max(24,Math.min(t,7*o)+10),height:Math.max(18,16*n.length+6)}}(e);if(s&&("number"==typeof(h=e).dx||"number"==typeof h.dy)){const t=function(e){return"text"===e.type||"widget"===e.type?{dx:0,dy:0}:{dx:30,dy:-30}}(e);return L.push(Gn(Fn(i.x,i.y,"number"==typeof e.dx?e.dx:t.dx,"number"==typeof e.dy?e.dy:t.dy,u),r)),e}var h;let d=null,f=1/0;for(const e of function(e){const t=1.6*e;return[{dx:e,dy:-e},{dx:-e,dy:-e},{dx:e,dy:e},{dx:-e,dy:e},{dx:e,dy:0},{dx:-e,dy:0},{dx:0,dy:-e},{dx:0,dy:e},{dx:t,dy:-t},{dx:-t,dy:-t},{dx:t,dy:t},{dx:-t,dy:t}]}(o)){const t=Vn(Fn(i.x,i.y,e.dx,e.dy,u),e,L,j,g,b,r,a);f>t&&(d=e,f=t)}if(!d)return e;const p=Gn(Fn(i.x,i.y,d.dx,d.dy,u),r);L.push(p);const m=Math.hypot(d.dx,d.dy),y=l&&m>=c&&"text"!==e.type&&"widget"!==e.type?{...e.connector||{end:"arrow"},type:"curve"}:e.connector;return P=!0,{...e,dx:d.dx,dy:d.dy,...y?{connector:y}:{}}}),D=P?I:k.slice();let z=D;if(d){let e=!1;const t=D.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});z=e?t:D}{let e=!1;const t=z.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?_n[t.source]??t.source:null,o="number"==typeof t.confidence&&Number.isFinite(t.confidence)?Math.round(100*Math.max(0,Math.min(1,t.confidence)))+"%":null;if(!n&&!o)return e;if(null!=e.label&&"string"!=typeof e.label)return e;const r=[n,o].filter(Boolean).join(" · "),i="string"==typeof e.label?e.label:"";return i.includes(`(${r})`)?e:{...e,label:i?`${i} (${r})`:`(${r})`}}(t);return n!==t&&(e=!0),n});z=e?t:z}const R=new Set;if(S){const e="object"==typeof S?S:{},t=function(e){if(!e)return 1;const t=function(e){const t=e?.familiarity;if(!t)return 3;const n=Object.values(t).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0===n.length?3:n.reduce((e,t)=>e+t,0)/n.length}(e);return t>2?4>t?1:.6:1.5}(y),n=1===t?e:{...e,maxAnnotations:Math.max(0,Math.round((e.maxAnnotations??zn(g,b,e))*t))},{deferred:o}=function(e){const{annotations:t,width:n,height:o}=e,r=Math.max(0,e.minVisible??1),i=zn(n,o,e),a=t.map((e,t)=>{return{annotation:e,index:t,note:(n=e,In(n))};var n}),s=a.filter(e=>e.note);if(0===s.length||i>=s.length)return{visible:t.slice(),deferred:[],budget:i};const l=s.filter(e=>Dn(e.annotation)),c=s.filter(e=>!Dn(e.annotation)).sort((e,t)=>Rn(t.annotation)-Rn(e.annotation)||e.index-t.index),u=Math.min(c.length,Math.max(Math.max(0,i-l.length),Math.max(0,r-l.length))),h=new Set([...l.map(e=>e.index),...c.slice(0,u).map(e=>e.index)]),d=[],f=[];for(const{annotation:e,index:t,note:n}of a)!n||h.has(t)?d.push(e):f.push(e);return{visible:d,deferred:f,budget:i}}({annotations:z,width:g,height:b,...n});for(const e of o)R.add(e)}if(A&&("object"==typeof A&&"number"==typeof A.minWidth?A.minWidth:480)>=g)for(const e of z)Bn(e)&&"secondary"===e.emphasis&&R.add(e);if(R.size>0)for(const e of z)!0===e?.defensive&&R.delete(e);let O;return O=0===R.size?z:M?z.map(e=>R.has(e)?{...e,_annotationDeferred:!0}:e):z.filter(e=>!R.has(e)),C?function(e,t){let n=!1;const o=e.map(e=>Bn(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(n=!0,{...e,cohesion:t}):e);return n?o:e}(O,C):O}import{useSyncExternalStore as Un}from"react";var Yn={positions:new Map},Xn=new Set;function Qn(){for(const e of Xn)e()}function Kn(e,t){const n=Yn.positions.get(e);if(n?.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(Yn.positions);o.delete(e),Yn={positions:o},Qn()}function Jn(e,t){const n=Yn.positions.get(e);if(!n?.locked)return;if(t&&n.sourceId!==t)return;const o=new Map(Yn.positions);o.delete(e),Yn={positions:o},Qn()}function eo(){return Yn}function to(e){return Xn.add(e),()=>Xn.delete(e)}var no={positions:new Map};function oo(){return()=>{}}function ro(){return no}function io(e,t,n){return"exact"===n?function(e,t){const n=e.domain(),o=n[0],r=n[n.length-1],i=o instanceof Date,a=o instanceof Date?o.getTime():o,s=r instanceof Date?r.getTime():r;if(2>t||a===s)return i?[new Date(a),new Date(s)]:[a,s];const l=(s-a)/(t-1),c=Array(t);for(let e=0;t>e;e++){const n=e===t-1?s:a+e*l;c[e]=i?new Date(n):n}return c}(e,t):e.ticks(t)}import{Fragment as ao,jsx as so,jsxs as lo}from"react/jsx-runtime";function co(e,t,n){if("edges"===e){if(t)return"start";if(n)return"end"}return"middle"}function uo(e,t,n){if("edges"===e){if(t)return"hanging";if(n)return"auto"}return"middle"}function ho(e){if(0===e.length)return{min:null,max:null};let t=1/0,n=-1/0;for(const o of e)t>o.pixel&&(t=o.pixel),o.pixel>n&&(n=o.pixel);return{min:t,max:n}}function fo(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function po(e,t,n){if("left"===e||"right"===e){const o="left"===e?n:0,r="left"===e?-1:1,i=Math.ceil(t/8);let a="M0,"+o;for(let e=0;i>e;e++){const n=8*(e+1);a+=`L${Math.min(8*e+4,t)},${o+4*r}`,a+=`L${Math.min(n,t)},${o}`}return a}{const o="bottom"===e?0:t,r="bottom"===e?1:-1,i=Math.ceil(n/8);let a=`M${o},0`;for(let e=0;i>e;e++){const t=8*(e+1);a+=`L${o+4*r},${Math.min(8*e+4,n)}`,a+=`L${o},${Math.min(t,n)}`}return a}}function mo(e,t,n){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function yo(e,t){if(2>=e.length)return e;const n=[e[0]];for(let o=1;e.length-1>o;o++)t>Math.abs(e[o].pixel-n[n.length-1].pixel)||n.push(e[o]);const o=e[e.length-1];return t>Math.abs(o.pixel-n[n.length-1].pixel)?n[n.length-1]=o:n.push(o),n}function go(e){const{width:t,height:n,totalWidth:o,totalHeight:r,margin:i,scales:a,showAxes:s,axes:l,xLabel:c,yLabel:u,yLabelRight:h,xFormat:d,yFormat:f,axisExtent:p,showGrid:m,title:y,legend:g,legendHoverBehavior:b,legendClickBehavior:v,legendHighlightedCategory:x,legendIsolatedCategories:w,legendPosition:k="right",legendLayout:S,foregroundGraphics:M,marginalGraphics:A,xValues:C,yValues:L,annotations:j,autoPlaceAnnotations:P,svgAnnotationRules:I,xAccessor:D,yAccessor:z,annotationData:R,pointNodes:O,curve:T,underlayRendered:N,canvasObscuresUnderlay:$=!0,linkedCrosshairName:W,linkedCrosshairSourceId:_,children:E}=e,B=St(()=>{if(!s||!a)return[];const e=l?.find(e=>"bottom"===e.orient),n=e?.tickFormat||d||mo,o=Math.max(2,Math.floor(t/70)),r=e?.ticks??5,i="exact"===p?Math.max(2,r):Math.min(r,o),c=e?.tickValues??io(a.x,i,p),u=c.map(e=>e.valueOf()),h=c.map((e,t)=>({value:e,pixel:a.x(e),label:n(e,t,u)})),f=h.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0),m=e?.autoRotate?Math.max(20,Math.min(f+8,55)):Math.max(55,f+8);let y=yo(h,m);if(y.length>1&&(y=y.filter((e,t)=>0===t||e.label+""!=y[t-1].label+"")),e?.includeMax&&y.length>0&&"exact"!==p&&!e?.tickValues){const e=a.x.domain()[1],t=a.x(e),o=y[y.length-1].pixel;if(Math.abs(t-o)>1){const r=n(e,y.length,u);m>t-o&&y.length>1&&(y=y.slice(0,-1)),y.push({value:e,pixel:t,label:r})}}return y},[s,a,l,d,t,p]),H=St(()=>{if(!s||!a)return[];const e=l?.find(e=>"left"===e.orient),t=e?.tickFormat||f||mo,o=Math.max(2,Math.floor(n/30)),r=e?.ticks??5,i="exact"===p?Math.max(2,r):Math.min(r,o);let c=yo((e?.tickValues??io(a.y,i,p)).map(e=>({value:e,pixel:a.y(e),label:t(e)})),22);if(c.length>1&&(c=c.filter((e,t)=>0===t||e.label+""!=c[t-1].label+"")),e?.includeMax&&c.length>0&&"exact"!==p&&!e?.tickValues){const e=a.y.domain()[1],n=a.y(e),o=c[c.length-1].pixel;if(Math.abs(n-o)>1){const r=t(e);22>Math.abs(n-o)&&c.length>1&&(c=c.slice(0,-1)),c.push({value:e,pixel:n,label:r})}}return c},[s,a,l,f,n,p]),F=St(()=>{if(!s||!a)return[];const e=l?.find(e=>"right"===e.orient);if(!e)return[];const t=e.tickFormat||f||mo,o=Math.max(2,Math.floor(n/30)),r=e.ticks??5;return yo((e.tickValues??io(a.y,"exact"===p?Math.max(2,r):Math.min(r,o),p)).map(e=>({value:e,pixel:a.y(e),label:t(e)})),22)},[s,a,l,f,n,p]),G=Mt(new Map),q=Mt(j?.length??0),V=j?.length??0;q.current!==V&&(q.current=V,G.current=new Map);const Z=St(()=>{if(!j||0===j.length)return null;const e=function(e,t,n){switch(e.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const o=bn(e,t,n);if(!o)return null;const{x:r,y:i}=o;if(!vn(r,i,n))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 Cn(en,{noteData:{x:r,y:i,dx:e.dx??30,dy:e.dy??-30,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:a,...s?{subject:s}:{},connector:e.connector||{end:"arrow"},color:e.color,disable:e.disable,opacity:e.opacity,strokeDasharray:e.strokeDasharray,className:e.className}},"ann-"+t)}case"x-threshold":{const o=pn(null!=e.value?{...e,x:e.value}:e,n);if(null==o)return null;const r=e.color||"#f97316",i=e.labelPosition||"top";let a;a="bottom"===i?(n.height||0)-4:"center"===i?(n.height||0)/2:12;const s=o>.6*(n.width||0),l=s?o-4:o+4,c=s?"end":"start";return Ln("g",{opacity:e.opacity,children:[Cn("line",{x1:o,y1:0,x2:o,y2:n.height||0,stroke:r,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&Cn("text",{x:l,y:a,textAnchor:c,fill:r,fontSize:12,fontWeight:"bold",stroke:"var(--semiotic-bg, #ffffff)",strokeWidth:3,paintOrder:"stroke",children:e.label})]},"ann-"+t)}case"y-threshold":{const o=mn(null!=e.value?{...e,y:e.value}:e,n);if(null==o)return null;const r=e.color||"#f97316",i=e.labelPosition||"right";let a,s;return"left"===i?(a=4,s="start"):"center"===i?(a=(n.width||0)/2,s="middle"):(a=(n.width||0)-4,s="end"),Ln("g",{opacity:e.opacity,children:[Cn("line",{x1:0,y1:o,x2:n.width||0,y2:o,stroke:r,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&Cn("text",{x:a,y:o-4,textAnchor:s,fill:r,fontSize:12,fontWeight:"bold",stroke:"var(--semiotic-bg, #ffffff)",strokeWidth:3,paintOrder:"stroke",children:e.label})]},"ann-"+t)}case"enclose":{const o=(e.coordinates||[]).map(e=>({x:pn({...e,type:"point"},n),y:mn({...e,type:"point"},n),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>o.length)return null;const r=tn(o),i=e.padding||10;return Ln("g",{children:[Cn("circle",{cx:r.x,cy:r.y,r:r.r+i,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&Cn("text",{x:r.x,y:r.y-r.r-i-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:e.label})]},"ann-"+t)}case"rect-enclose":{const o=(e.coordinates||[]).map(e=>({x:pn({...e,type:"point"},n),y:mn({...e,type:"point"},n)})).filter(e=>null!=e.x&&null!=e.y);if(2>o.length)return null;const r=e.padding||10,i=o.map(e=>e.x),a=o.map(e=>e.y),[s,l]=ce(i),[c,u]=ce(a),h=s-r,d=l+r,f=c-r;return Ln("g",{children:[Cn("rect",{x:h,y:f,width:d-h,height:u+r-f,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&Cn("text",{x:(h+d)/2,y:f-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:e.label})]},"ann-"+t)}case"highlight":{const o=n.data||[],r="function"==typeof e.filter?o.filter(e.filter):e.field&&null!=e.value?o.filter(t=>t[e.field]===e.value):[],i={stroke:e.color||"#f97316",strokeWidth:2,fill:"none"};return Cn("g",{children:r.map((t,o)=>{const r=pn(t,n),a=mn(t,n);if(null==r||null==a)return null;const s="function"==typeof e.r?e.r(t):e.r||6,l="function"==typeof e.style?e.style(t):e.style||i;return Cn("circle",{cx:r,cy:a,r:s,...l},"hl-"+o)})},"ann-"+t)}case"bracket":{const o=pn(e,n),r=mn(e,n);return Cn(en,{noteData:{x:o??0,y:r??0,dx:e.dx||0,dy:e.dy||0,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"bracket",subject:{type:e.bracketType||"curly",width:e.width,height:e.height,depth:e.depth||30},color:e.color}},"ann-"+t)}case"trend":{const o=n.data||[];if(2>o.length)return null;const r=n.xAccessor||"x",i=n.yAccessor||"y",a="ordinal"===n.frameType,s="horizontal"===n.projection,l=a?r:null,c=a?i:null;let u;const h=[],d=new Map;if(a&&l&&c){for(const e of o){const t=e[l];if(null==t)continue;const n=t+"";d.has(n)||(d.set(n,h.length),h.push(n))}u=o.map(e=>{const t=e[l],n=e[c];if(null==t||null==n)return null;const o=d.get(t+"");return null!=o?[o,+n]:null}).filter(e=>null!==e)}else u=o.map(e=>[e[r],e[i]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>u.length)return null;const f=n.scales?.x??n.scales?.time,p=n.scales?.y??n.scales?.value;if(!f||!p)return null;const m=e=>t=>{const n=Math.max(0,Math.floor(t)),o=Math.min(h.length-1,n+1),r=t-n,i=e(h[n]);return i+(e(h[o])-i)*r},y=f,g=p;let b;if(a)if(s){const e=m(g);b=(t,n)=>[y(n),e(t)]}else{const e=m(y);b=(t,n)=>[e(t),g(n)]}else b=(e,t)=>[y(e),g(t)];const v=e.method||"linear";let x;x="loess"===v?function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),r=o.map(e=>e[0]),i=o.map(e=>e[1]),a=Math.max(2,Math.ceil(t*n)),s=[];for(let e=0;n>e;e++){const t=r[e],o=r.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(a-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:o[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,h=0,d=0,f=0,p=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,h+=t*r[e],d+=t*i[e],f+=t*r[e]*r[e],p+=t*r[e]*i[e])}if(0===u){s.push([t,i[e]]);continue}const m=u*f-h*h;if(1e-12>Math.abs(m))s.push([t,d/u]);else{const e=(u*p-h*d)/m;s.push([t,(d-e*h)/u+e*t])}}return s}(u,e.bandwidth??.3):("polynomial"===v?fn.polynomial(u,{order:e.order||2}):fn.linear(u)).points;const w=x.map(([e,t])=>{const[n,o]=b(e,t);return`${n},${o}`}).join(" "),k=e.color||"#6366f1",S=x[x.length-1],[M,A]=b(S[0],S[1]);return Ln("g",{children:[Cn("polyline",{points:w,fill:"none",stroke:k,strokeWidth:e.strokeWidth||2,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&Cn("text",{x:M+4,y:A-4,fill:k,fontSize:11,children:e.label})]},"ann-"+t)}case"band":{const o=n.scales?.y??n.scales?.value,r=o?.(e.y0)??0,i=o?.(e.y1)??(n.height||0);return Ln("g",{opacity:e.opacity,children:[Cn("rect",{x:0,y:Math.min(r,i),width:n.width||0,height:Math.abs(i-r),fill:e.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:e.fillOpacity||.1}),e.label&&Cn("text",{x:(n.width||0)-4,y:Math.max(Math.min(r,i),0)+13,textAnchor:"end",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",stroke:"var(--semiotic-bg, #ffffff)",strokeWidth:3,paintOrder:"stroke",children:e.label})]},"ann-"+t)}case"x-band":{const o=n.scales?.x??n.scales?.time,r=null!=e.x0&&o?o(e.x0):null,i=null!=e.x1&&o?o(e.x1):null;return null==r||null==i?null:Ln("g",{opacity:e.opacity,children:[Cn("rect",{x:Math.min(r,i),y:0,width:Math.abs(i-r),height:n.height||0,fill:e.fill||e.color||"var(--semiotic-primary, #6366f1)",fillOpacity:e.fillOpacity??.1}),e.label&&Cn("text",{x:Math.min(r,i)+4,y:13,textAnchor:"start",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",stroke:"var(--semiotic-bg, #ffffff)",strokeWidth:3,paintOrder:"stroke",children:e.label})]},"ann-"+t)}case"envelope":{const o=n.data||[];if(2>o.length)return null;const r=n.xAccessor||"x",i=n.scales?.x??n.scales?.time,a=n.scales?.y??n.scales?.value;if(!i||!a)return null;const s=e.upperAccessor||"upperBounds",l=e.lowerAccessor||"lowerBounds",c=e.filter,u=o.filter(e=>null!=e[s]&&null!=e[l]&&!(c&&!c(e))).sort((e,t)=>e[r]-t[r]);if(2>u.length)return null;const h=jn[n.curve||"linear"]||on,d=nn().x(e=>i(e[r])).y0(e=>a(e[l])).y1(e=>a(e[s])).curve(h)(u);if(!d)return null;const f=e.fill||"#6366f1";return Ln("g",{children:[Cn("path",{d:d,fill:f,fillOpacity:e.fillOpacity??.15,stroke:"none"}),e.label&&u.length>0&&Cn("text",{x:i(u[u.length-1][r])+4,y:a(u[u.length-1][s])-4,fill:f,fontSize:11,children:e.label})]},"ann-"+t)}case"anomaly-band":{const o=n.data||[];if(2>o.length)return null;const r=n.yAccessor||"y",i=n.scales?.x??n.scales?.time,a=n.scales?.y??n.scales?.value;if(!i||!a)return null;const s=o.map(e=>e[r]).filter(e=>null!=e&&isFinite(e));if(2>s.length)return null;const l=s.reduce((e,t)=>e+t,0)/s.length,c=s.reduce((e,t)=>e+(t-l)**2,0)/s.length,u=Math.sqrt(c),h=e.threshold??2,d=l-h*u,f=!1!==e.showBand,p=e.fill||"#6366f1",m=e.fillOpacity??.1,y=e.anomalyColor||"#ef4444",g=e.anomalyRadius??6,b=a(l+h*u),v=a(d),x=o.filter(e=>{const t=e[r];return null!=t&&Math.abs(t-l)>h*u});return Ln("g",{children:[f&&Cn("rect",{x:0,y:Math.min(b,v),width:n.width||0,height:Math.abs(v-b),fill:p,fillOpacity:m}),x.map((e,t)=>{const o=pn(e,n),r=mn(e,n);return null==o||null==r?null:Cn("circle",{cx:o,cy:r,r:g,fill:y,fillOpacity:.7,stroke:y,strokeWidth:1.5},"anomaly-"+t)}),e.label&&Cn("text",{x:(n.width||0)-4,y:Math.min(b,v)-4,textAnchor:"end",fill:p,fontSize:11,children:e.label})]},"ann-"+t)}case"forecast":{const o=n.data||[];if(3>o.length)return null;const r=n.xAccessor||"x",i=n.yAccessor||"y",a=n.scales?.x??n.scales?.time,s=n.scales?.y??n.scales?.value;if(!a||!s)return null;const l=o.map(e=>[e[r],e[i]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>l.length)return null;let c;if("polynomial"===(e.method||"linear")){const t=fn.polynomial(l,{order:e.order||2}).equation;c=e=>t.reduce((t,n,o)=>t+n*Math.pow(e,o),0)}else{const e=l.length;let t=0,n=0,o=0,r=0;for(const[e,i]of l)t+=e,n+=i,o+=e*e,r+=e*i;const i=e*o-t*t;if(1e-12>Math.abs(i))return null;const a=(e*r-t*n)/i,s=(n-a*t)/e;c=e=>s+a*e}const u=l.length,h=l.map(([e,t])=>t-c(e)).reduce((e,t)=>e+t*t,0),d=Math.sqrt(h/Math.max(u-2,1)),f=l.reduce((e,t)=>e+t[0],0)/u,p=l.reduce((e,t)=>e+(t[0]-f)**2,0),m=e.confidence??.95,y=.99>m?.95>m?.9>m?1:1.645:1.96:2.576,g=e.steps??5,b=l[u-1][0],v=(b-l[0][0])/Math.max(u-1,1),x=[];for(let e=1;g>=e;e++)x.push(b+e*v);const w=[];for(const e of x){const t=c(e),n=d*Math.sqrt(1+1/u+(p>0?(e-f)**2/p:0))*y;w.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const k=`M${w.map(e=>`${a(e.x)},${s(e.yUpper)}`).join(" L")} L${w.slice().reverse().map(e=>`${a(e.x)},${s(e.yLower)}`).join(" L")} Z`,S=w.map(e=>`${a(e.x)},${s(e.yCenter)}`).join(" "),M=`${a(b)},${s(c(b))}`,A=e.strokeColor||"#6366f1";return Ln("g",{children:[Cn("path",{d:k,fill:e.fill||"#6366f1",fillOpacity:e.fillOpacity??.15,stroke:"none"}),Cn("polyline",{points:`${M} ${S}`,fill:"none",stroke:A,strokeWidth:e.strokeWidth??2,strokeDasharray:e.strokeDasharray??"6,3"}),e.label&&w.length>0&&Cn("text",{x:a(w[w.length-1].x)+4,y:s(w[w.length-1].yCenter)-4,fill:A,fontSize:11,children:e.label})]},"ann-"+t)}case"widget":{let o,r;if(null!=e.px&&null!=e.py)o=e.px,r=e.py;else{const i=bn(e,t,n);if(!i)return null;o=i.x,r=i.y}if(!vn(o,r,n))return null;const i=e.width??32,a=e.height??32;return Cn("foreignObject",{x:o+(e.dx??0)-i/2,y:r+(e.dy??0)-a/2,width:i,height:a,style:{overflow:"visible",pointerEvents:"auto"},children:Cn("div",{style:{width:i,height:a,display:"flex",alignItems:"center",justifyContent:"center"},children:e.content??Cn("span",{style:{fontSize:18,cursor:"default"},title:e.label||"Info",children:"ℹ️"})})},"ann-"+t)}case"text":{const o=bn(e,t,n);if(!o)return null;const{x:r,y:i}=o,a=r+(e.dx||0),s=i+(e.dy||0),l=e.color||"var(--semiotic-text, #333)",c=Cn("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?qt.cloneElement(c,{key:"ann-text-"+t}):Ln("g",{opacity:e.opacity,strokeDasharray:e.strokeDasharray,children:[Cn("line",{x1:r,y1:i,x2:a,y2:s,stroke:l,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),qt.cloneElement(c,{opacity:void 0,strokeDasharray:void 0})]},"ann-text-"+t)}case"category-highlight":{const o=e.category;if(null==o)return null;const r=e=>"function"==typeof e&&"function"==typeof e.bandwidth,i=n.scales?.o,a=n.scales?.x,s=n.scales?.y,l=r(i)?i:r(a)?a:r(s)?s:null;if(!l)return null;const c=l(o+"");if(null==c)return null;const u=l.bandwidth(),h=e.color||"var(--semiotic-primary, #4589ff)",d=e.opacity??.15,f=e.label;return Ln("g",(n.projection?"vertical"===n.projection:l===a)?{children:[Cn("rect",{x:c,y:0,width:u,height:n.height||0,fill:h,fillOpacity:d}),f&&Cn("text",{x:c+u/2,y:12,textAnchor:"middle",fill:h,fontSize:12,fontWeight:"bold",children:f})]}:{children:[Cn("rect",{x:0,y:c,width:n.width||0,height:u,fill:h,fillOpacity:d}),f&&Cn("text",{x:12,y:c+u/2,dominantBaseline:"middle",fill:h,fontSize:12,fontWeight:"bold",children:f})]},"ann-"+t)}default:return null}},o={scales:a?{x:a.x,y:a.y,time:a.x,value:a.y}:null,timeAxis:"x",xAccessor:D,yAccessor:z,width:t,height:n,data:R,frameType:"xy",pointNodes:O,curve:T,stickyPositionCache:G.current};return function(e,t,n,o){const r=[];return e.forEach((e,i)=>{let a;if(n){const r=n(e,i,o);a=null!=r?r:t(e,i,o)}else a=t(e,i,o);a&&r.push({node:a,annotation:e})}),function(e){const t=e.map((e,t)=>{return{p:e,i:t,emphasis:(n=e.annotation,"primary"===n?.emphasis||"secondary"===n?.emphasis?n.emphasis:null),confidence:Mn(e.annotation),readingOrder:null,rank:1};var n}),n=t.some(e=>null!=e.emphasis||null!=e.confidence),o=e.some(e=>kn(e.annotation)),r=e.some(e=>null!=Sn(e.annotation)),i=e.some(e=>"layer"===Sn(e.annotation));if(!n&&!o&&!r)return e.map(e=>e.node);const a=t.filter(e=>null==e.emphasis&&null!=e.confidence).slice().sort((e,t)=>(t.confidence??0)-(e.confidence??0)||e.i-t.i);a.forEach((e,t)=>{e.readingOrder=t,e.rank=2-t/Math.max(1,a.length)});for(const e of t)e.emphasis&&(e.rank=wn[e.emphasis]);const s=t.sort((e,t)=>e.rank-t.rank||e.i-t.i).map(e=>{const{p:t,i:n,emphasis:o,readingOrder:r}=e,i=kn(t.annotation);let a=t.node;if("primary"===o||"secondary"===o||null!=r){const e=null==o&&null!=r;a=xn("g",{className:e?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+o,..."secondary"===o?{opacity:.6,fontSize:"0.88em"}:{},...e?{opacity:An(r),"data-annotation-reading-order":r}:{},children:t.node},"annotation-emphasis-"+n)}const s=Sn(t.annotation);return s&&(a=xn("g",{className:"annotation-cohesion--"+s,children:a},"annotation-cohesion-"+n)),i&&(a=xn("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:a},"annotation-deferred-"+n)),a});return o&&s.unshift(xn("style",{children:".annotation-deferred{opacity:0;pointer-events:none;transition:opacity .12s ease}.stream-xy-frame:hover .annotation-deferred,.stream-ordinal-frame:hover .annotation-deferred,.stream-network-frame:hover .annotation-deferred,.stream-geo-frame:hover .annotation-deferred,.stream-xy-frame:focus-within .annotation-deferred,.stream-ordinal-frame:focus-within .annotation-deferred,.stream-network-frame:focus-within .annotation-deferred,.stream-geo-frame:focus-within .annotation-deferred{opacity:1;pointer-events:auto}@media (prefers-reduced-motion:reduce){.annotation-deferred{transition:none}}"},"annotation-disclosure-style")),i&&s.unshift(xn("style",{children:".annotation-cohesion--layer text,.annotation-cohesion--layer tspan{fill:var(--semiotic-annotation-color,var(--semiotic-text-secondary,#666));font-style:italic}"},"annotation-cohesion-style")),s}(r)}(P?Zn({annotations:j,context:o,..."object"==typeof P?P:{}}):j,e,I,o)},[j,P,I,t,n,D,z,R,a,O,T]),U=function(e){const t=Un(e?to:oo,e?eo:ro,e?eo:ro);return e?t.positions.get(e)??null:null}(W);return At(()=>{if(!U?.locked||!W)return;const e=e=>{"Escape"===e.key&&Jn(W)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[U?.locked,W]),s||y||g||M||A||Z&&Z.length>0||m||E||U?lo("svg",{role:"img",width:o,height:r,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[so("title",{children:"string"==typeof y?y:"XY Chart"}),so("desc",{children:"string"==typeof y?y+" — XY data visualization":"XY data visualization"}),lo("g",{transform:`translate(${i.left},${i.top})`,children:[m&&a&&(!N||$)&&(()=>{const e=fo(l?.find(e=>"bottom"===e.orient)?.gridStyle),o=fo(l?.find(e=>"left"===e.orient)?.gridStyle);return lo("g",{className:"stream-grid",children:[B.map((t,o)=>so("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:n,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:e},"xgrid-"+o)),H.map((e,n)=>so("line",{x1:0,y1:e.pixel,x2:t,y2:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:o},"ygrid-"+n))]})})(),s&&a&&(()=>{const e=l?.find(e=>"left"===e.orient),o=l?.find(e=>"bottom"===e.orient),r=!e||!1!==e.baseline,a=!o||!1!==o.baseline,s=e?.jaggedBase||!1,d=o?.jaggedBase||!1,f=o?.landmarkTicks,p=e?.landmarkTicks,m="var(--semiotic-border, #ccc)",y="var(--semiotic-text-secondary, var(--semiotic-text, #666))",g="var(--semiotic-text, #333)",b=!!o?.autoRotate&&B.length>1&&(()=>{const e=t/Math.max(B.length-1,1);return B.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0)+8>e})(),v=b?12:18,x=n+(b?58:40),w={fontSize:"var(--semiotic-tick-font-size, 12px)"},k={fontSize:"calc(var(--semiotic-tick-font-size, 12px) + 1px)"},S={fontSize:"var(--semiotic-axis-label-font-size, 12px)"},M=o?.tickAnchor,A=e?.tickAnchor,C=ho(B),L=ho(H);return lo("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[lo("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[(!N||$)&&a&&!d&&so("line",{x1:0,y1:n,x2:t,y2:n,stroke:m,strokeWidth:1}),(!N||$)&&d&&so("path",{d:po("bottom",t,n),fill:"none",stroke:m,strokeWidth:1}),B.map((e,t)=>{const o=!!f&&("function"==typeof f?f(e.value,t):ye(e.value,t>0?B[t-1].value:void 0));return lo("g",{transform:`translate(${e.pixel},${n})`,children:[so("line",{y2:5,stroke:m,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?so("text",{y:v,textAnchor:b?"end":co(M,e.pixel===C.min,e.pixel===C.max),fontWeight:o?600:400,fill:y,className:"semiotic-axis-tick",style:{userSelect:"none",...o?k:w},transform:b?"rotate(-45)":void 0,children:e.label}):so("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:so("div",{style:{textAlign:"center",userSelect:"none",...w},children:e.label})})]},"xtick-"+t)}),c&&so("text",{x:t/2,y:x,textAnchor:"middle",fill:g,className:"semiotic-axis-label",style:{userSelect:"none",...S},children:c})]}),lo("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[(!N||$)&&r&&!s&&so("line",{x1:0,y1:0,x2:0,y2:n,stroke:m,strokeWidth:1}),(!N||$)&&s&&so("path",{d:po("left",t,n),fill:"none",stroke:m,strokeWidth:1}),H.map((e,t)=>{const n=!!p&&("function"==typeof p?p(e.value,t):ye(e.value,t>0?H[t-1].value:void 0));return lo("g",{transform:`translate(0,${e.pixel})`,children:[so("line",{x2:-5,stroke:m,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?so("text",{x:-8,textAnchor:"end",dominantBaseline:uo(A,e.pixel===L.min,e.pixel===L.max),fontWeight:n?600:400,fill:y,className:"semiotic-axis-tick",style:{userSelect:"none",...n?k:w},children:e.label}):so("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:so("div",{style:{textAlign:"right",userSelect:"none",...w},children:e.label})})]},"ytick-"+t)}),(()=>{const t=e?.label||u;return t?so("text",{x:15-i.left,y:n/2,textAnchor:"middle",fill:g,transform:`rotate(-90, ${15-i.left}, ${n/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...S},children:t}):null})()]}),(()=>{const e=l?.find(e=>"right"===e.orient);if(!e||0===F.length)return null;const o=!1!==e.baseline,r=e.landmarkTicks,a=e.label||h,s=e.tickAnchor,c=ho(F);return lo("g",{className:"semiotic-axis semiotic-axis-right","data-orient":"right",children:[o&&so("line",{x1:t,y1:0,x2:t,y2:n,stroke:m,strokeWidth:1}),F.map((e,n)=>{const o=!!r&&("function"==typeof r?r(e.value,n):ye(e.value,n>0?F[n-1].value:void 0));return lo("g",{transform:`translate(${t},${e.pixel})`,children:[so("line",{x2:5,stroke:m,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?so("text",{x:8,textAnchor:"start",dominantBaseline:uo(s,e.pixel===c.min,e.pixel===c.max),fontWeight:o?600:400,fill:y,className:"semiotic-axis-tick",style:{userSelect:"none",...o?k:w},children:e.label}):so("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:so("div",{style:{textAlign:"left",userSelect:"none",...w},children:e.label})})]},"ytick-r-"+n)}),a&&so("text",{x:t+i.right-15,y:n/2,textAnchor:"middle",fill:g,transform:`rotate(90, ${t+i.right-15}, ${n/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...S},children:a})]})})()]})})(),Z,A&&a&&C&&L&&lo(ao,{children:[A.top&&so("g",{transform:"translate(0, 0)",children:so(Gt,{orient:"top",config:Ft(A.top),values:C,scale:a.x,size:i.top,length:t})}),A.bottom&&so("g",{transform:`translate(0, ${n})`,children:so(Gt,{orient:"bottom",config:Ft(A.bottom),values:C,scale:a.x,size:i.bottom,length:t})}),A.left&&so("g",{transform:"translate(0, 0)",children:so(Gt,{orient:"left",config:Ft(A.left),values:L,scale:a.y,size:i.left,length:n})}),A.right&&so("g",{transform:`translate(${t}, 0)`,children:so(Gt,{orient:"right",config:Ft(A.right),values:L,scale:a.y,size:i.right,length:n})})]}),M,U&&U.sourceId!==_&&a?.x&&(()=>{const e=a.x(U.xValue);if(null==e||0>e||e>t)return null;const o=U.locked;return so("line",{x1:e,y1:0,x2:e,y2:n,stroke:o?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:o?1.5:1,strokeDasharray:o?"6,3":"4,4",pointerEvents:"none"})})(),E]}),y&&so("text",{x:o/2,y:20,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:"string"==typeof y?y:null}),Wt({legend:g,totalWidth:o,totalHeight:r,margin:i,legendPosition:k,title:y,legendLayout:S,legendHoverBehavior:b,legendClickBehavior:v,legendHighlightedCategory:x,legendIsolatedCategories:w})]}):null}import*as bo from"react";import{arc as vo}from"d3-shape";import{jsx as xo,jsxs as wo}from"react/jsx-runtime";function ko(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}var So="undefined"==typeof window||"undefined"==typeof document;import{useEffect as Mo,useLayoutEffect as Ao,useRef as Co,useState as Lo,useSyncExternalStore as jo}from"react";var Po="undefined"!=typeof window?Ao:Mo,Io=()=>()=>{},Do=()=>!1,zo=()=>!0;import{useRef as Ro}from"react";function Oo(e,t){const n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(const o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;if(!Object.is(e[o],t[o]))return!1}return!0}function To(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 No(e){if(null===e||"object"!=typeof e)return!1;if(Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}import*as $o from"react";import*as Wo from"react";import{jsx as _o}from"react/jsx-runtime";var Eo=Wo.createContext(null);function Bo(e){const t={};if(null==e||"object"!=typeof e)return t;for(const[n,o]of Object.entries(e))n.startsWith("_")||null!=o&&""!==o&&("number"==typeof o?Number.isFinite(o)&&(t[n]=o):"string"==typeof o?t[n]=o:"boolean"==typeof o?t[n]=o+"":o instanceof Date&&(t[n]=o.toISOString().slice(0,10)));return t}function Ho(e){return e&&"object"==typeof e?e:{}}function Fo(e){return Ho(e.accessibility).tableFields??e.accessibleDatum??e.datum}import{jsx as Go,jsxs as qo}from"react/jsx-runtime";var Vo={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function Zo(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e){if(null===t?.datum)continue;const e=t.type+"";n[e]=(n[e]||0)+1}if(0===Object.keys(n).length)return t+", empty";const o=[],r={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},i=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],a=Object.keys(n).sort((e,t)=>{const n=i.indexOf(e),o=i.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of a)o.push(`${n[e]} ${r[e]||e}`);return`${t}, ${o.join(", ")}`}var Uo=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},Yo="semiotic-accessible-data-table",Xo=Yo+" semiotic-accessible-data-table-hidden",Qo=Yo+" semiotic-accessible-data-table-visible",Ko={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"},Jo={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},er={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)"},tr={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},nr={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))"},or={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},rr={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},ir={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 ar({scene:e,chartType:t,tableId:n,chartTitle:o}){const[r,i]=$o.useState(!1),[a,s]=$o.useState(5),l=Wo.useContext(Eo),c=l?.visible??!1,u=r||c,h=$o.useRef(null),d=o?"Data summary for "+o:n?`Data summary for ${t} ${n}`:"Data summary for "+t;$o.useEffect(()=>{u||s(5)},[u]);const f=$o.useCallback(e=>{e.target===e.currentTarget&&(r||c||i(!0))},[r,c]),p=$o.useCallback(e=>{c||h.current?.contains(e.relatedTarget)||i(!1)},[c]);if(!e||0===e.length)return n?Go("span",{id:n,tabIndex:-1,style:Vo}):null;if(!u)return Go("div",{id:n,className:Xo,tabIndex:-1,onFocus:f,style:Vo,role:"region","aria-label":d,children:qo("button",{type:"button",onClick:()=>i(!0),children:["View data summary (",e.length," elements)"]})});const m=function(e){const t=[];if(!Array.isArray(e))return t;const n=e.some(e=>e&&("line"===e.type||"area"===e.type));for(const o of e)if(o&&"object"==typeof o&&null!==o.datum)try{switch(o.type){case"point":if(n)break;t.push({label:"Point",values:Bo(Fo(o))});break;case"line":case"area":{const e=Fo(o),n=Array.isArray(e)?e:[],r="line"===o.type?"Line point":"Area point";for(const e of n)t.push({label:r,values:Bo(e)});break}case"rect":{const e=Fo(o),n=null!=e&&"object"==typeof e?e:{},r=n.category??o.group??"",i=n.value??n.__aggregateValue??n.total,a=Bo(n);null==a.category&&""!==r&&(a.category=r+""),null==a.value&&null!=i&&(a.value="number"==typeof i||"string"==typeof i?i:i+""),t.push({label:"Bar",values:a});break}case"heatcell":{const e=Bo(Fo(o));null==e.value&&"number"==typeof o.value&&Number.isFinite(o.value)&&(e.value=o.value),t.push({label:"Cell",values:e});break}case"wedge":{const e=Fo(o),n=Bo(e);if(null==n.category){const t=Ho(e),o=t.category??t.label;null!=o&&(n.category=o+"")}t.push({label:"Wedge",values:n});break}case"circle":t.push({label:"Node",values:Bo(Fo(o))});break;case"arc":t.push({label:"Arc",values:Bo(Fo(o))});break;case"candlestick":t.push({label:"Candlestick",values:Bo(Fo(o))});break;case"geoarea":{const e=Ho(Fo(o)),n=Bo(e);if(null==n.name){const t=Ho(e.properties).name??e.name;null!=t&&(n.name=t+"")}t.push({label:"Region",values:n});break}}}catch{}return t}(e),y=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const o of t){const t=[],r=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[o];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&r.add(e+""))}if(t.length>0){let e=t[0],r=t[0],i=0;for(const n of t)e>n&&(e=n),n>r&&(r=n),i+=n;n.push({name:o,count:t.length,numeric:!0,min:e,max:r,mean:i/t.length})}else if(r.size>0){const e=Array.from(r);n.push({name:o,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(m),g=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${Uo(e.min)} to ${Uo(e.max)}, mean ${Uo(e.mean)}.`);else{const t=e.uniqueValues,o=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${o}.`)}return n.join(" ")}(m.length,y),b=Math.min(a,m.length),v=m.slice(0,b),x=m.length-b,w=new Set;for(const e of v)for(const t of Object.keys(e.values))w.add(t);const k=Array.from(w);return qo("div",{ref:h,id:n,className:Qo,tabIndex:-1,onBlur:p,style:Ko,role:"region","aria-label":d,children:[Go("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{c&&l&&l.setVisible(!1),i(!1)},"aria-label":"Close data summary",style:er,children:"×"}),Go("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:Jo,children:g}),qo("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+t,style:tr,children:[Go("caption",{className:"semiotic-accessible-data-table-caption",style:rr,children:x>0?`First ${b} of ${m.length} data points`:`All ${m.length} data points`}),Go("thead",{children:qo("tr",{children:[Go("th",{style:nr,children:"type"}),k.map(e=>Go("th",{style:nr,children:e},e))]})}),Go("tbody",{children:v.map((e,t)=>qo("tr",{children:[Go("td",{style:or,children:e.label}),k.map(t=>{return Go("td",{style:or,children:(n=e.values[t],null==n||""===n?"—":"number"==typeof n?Number.isNaN(n)?"—":Uo(n):"boolean"==typeof n?n?"true":"false":"object"==typeof n?"—":n+"")},t);var n})]},t))})]}),x>0&&qo("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>s(e=>e+25),style:ir,children:["Show ",Math.min(25,x)," more"," ",1===x?"row":"rows"," (",x," remaining)"]})]})}function sr({summary:e}){return e?Go("div",{role:"note",style:Vo,children:e}):null}function lr({tableId:e}){return Go("a",{href:"#"+e,style:Vo,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,Vo)},children:"Skip to data table"})}function cr({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 Go("div",{"aria-live":"polite","aria-atomic":"true",style:Vo,children:t})}var ur=Object.freeze([]);function hr(e){if(!e)return ur;let t=!1;for(let n=0;e.length>n;n++){const o=e[n];if(null==o||"object"!=typeof o){t=!0;break}}if(!t)return e;const n=[];for(const t of e)null!=t&&"object"==typeof t&&n.push(t);return n}import{jsx as dr}from"react/jsx-runtime";var fr="var(--semiotic-focus, #005fcc)";function pr({active:e,hoverPoint:t,margin:n,size:o,shape:r="circle",width:i,height:a,pathData:s}){if(!e||!t)return null;const l=t.x+n.left,c=t.y+n.top;let u;if("geoarea"!==r&&"path"!==r||!s)if("rect"===r&&null!=i&&null!=a){const e=Math.max(i,4),t=Math.max(a,4);u=dr("rect",{x:l-e/2-3,y:c-t/2-3,width:e+6,height:t+6,rx:3,fill:"none",stroke:fr,strokeWidth:2,strokeDasharray:"4,2"})}else u=dr("circle","wedge"===r?{cx:l,cy:c,r:12,fill:"none",stroke:fr,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:fr,strokeWidth:2,strokeDasharray:"4,2"});else u=dr("g",{transform:`translate(${n.left},${n.top})`,children:dr("path",{d:s,fill:"none",stroke:fr,strokeWidth:2.5,strokeDasharray:"6,3"})});return dr("svg",{style:{position:"absolute",left:0,top:0,width:o[0],height:o[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}import*as mr from"react";function yr(e,t){return"touch"===t?Math.max(e,24):e}var gr=["name","label","title"],br=["type","kind","category","group","class","status","role","shape"],vr=["value","amount","total","count","weight","score"],xr=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 wr(e,t){for(const n of t){const t=e.find(e=>e.lower===n);if(t)return t}}import{jsx as kr,jsxs as Sr}from"react/jsx-runtime";var Mr={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 Ar(e,t){return"function"==typeof t?t(e):e[t]}function Cr(e,t){if(t)return t(e);if(null==e)return"";if("number"==typeof e){if(!Number.isFinite(e))return e+"";const t=Number.isInteger(e)?e:parseFloat(e.toPrecision(6));return Math.abs(t)>9999?t.toLocaleString():t+""}return e instanceof Date?e.toLocaleDateString():"object"==typeof e&&null!==e?void 0!==e.id?e.id+"":void 0!==e.name?e.name+"":JSON.stringify(e):e+""}function Lr(e={}){const{fields:t,title:n,format:o,style:r={},className:i=""}=e;return e=>{if(!e||"object"!=typeof e)return null;let a;const s=[];if(n){const t=Ar(e,n);a=Cr(t,o)}if(t&&t.length>0)t.forEach(t=>{let n,r,i;"string"==typeof t?(n=t,r=t,i=o):(n=t.label,r=t.accessor||t.key||"",i=t.format||o);const a=Ar(e,r);s.push({label:n,value:Cr(a,i)})});else if(!n){const t=["value","y","name","id","label"];for(const n of t)if(void 0!==e[n]){a=Cr(e[n],o);break}if(!a){const t=Object.keys(e).filter(e=>!e.startsWith("_"));t.length>0&&(a=Cr(e[t[0]],o))}}const l={...Mr,...r};return Sr("div",{className:("semiotic-tooltip "+i).trim(),style:l,children:[a&&kr("div",{style:{fontWeight:s.length>0?"bold":"normal"},children:a}),s.map((e,t)=>Sr("div",{style:{marginTop:0===t&&a?"4px":0},children:[e.label&&Sr("span",{children:[e.label,": "]}),e.value]},t))]})}}function jr(e){if(!0!==e){if("function"==typeof e){const t=e;return e=>{let n=Array.isArray(o=!0===e?.__semioticHoverData||e&&void 0!==e.data&&"number"==typeof e.x&&"number"==typeof e.y&&e&&("node"===e.type||"edge"===e.type||void 0!==e.nodeOrEdge||void 0!==e.allSeries||void 0!==e.stats||void 0!==e.__chartType)?e.data??{}:e)?o[0]:o;var o;("node"===e?.nodeOrEdge&&"number"==typeof n?.x0&&"number"==typeof n?.x1||"edge"===e?.nodeOrEdge&&"number"==typeof n?.sankeyWidth)&&n.data&&"object"==typeof n.data&&(n=n.data);const r=t(n);return null==r?null:kr("div",{className:"semiotic-tooltip",style:Mr,children:r})}}return!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?Lr(e):Lr())}}import{jsx as Pr}from"react/jsx-runtime";function Ir({x:e,y:t,containerWidth:n,containerHeight:o,margin:r,children:i,className:a="stream-frame-tooltip",zIndex:s=1}){const l=Number.isFinite(e)&&Number.isFinite(t),c=mr.useRef(null),[u,h]=mr.useState(null);mr.useLayoutEffect(()=>{const e=c.current;if(!e)return;const t=e.getBoundingClientRect();h(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[i,a,n,o]);let d;d=u?`translate(${u.width+12>n-e?"calc(-100% - 12px)":"12px"}, ${u.height+12>o-t?"calc(-100% - 4px)":"4px"})`:`translate(${e>.7*n?"calc(-100% - 12px)":"12px"}, ${.3*o>t?"4px":"calc(-100% - 4px)"})`;const f=function(e){if(!mr.isValidElement(e))return!1;const t=e.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;const n=e.props;if(!0===n["data-semiotic-tooltip-chrome"])return!0;if("true"===n["data-semiotic-tooltip-chrome"])return!0;const o=n.style;if(o&&"object"==typeof o){if(null!=o.background&&""!==o.background&&"transparent"!==o.background)return!0;if(null!=o.backgroundColor&&""!==o.backgroundColor&&"transparent"!==o.backgroundColor)return!0}return!1}(i),p=f?null:Mr;return l?Pr("div",{ref:c,className:f?a:(a+" semiotic-tooltip").trim(),style:{...p||{},position:"absolute",left:r.left+e,top:r.top+t,transform:d,pointerEvents:"none",zIndex:s,width:"max-content"},children:i}):null}import{zoom as Dr,zoomIdentity as zr}from"d3-zoom";import{select as Rr}from"d3-selection";function Or(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Tr(e,t,n=.6){if(!Or(t))return;const o=t.r+(t._pulseGlowRadius??4)*t._pulseIntensity,r=t.cx??t.x??0,i=t.cy??t.y??0;e.beginPath(),e.arc(r,i,o,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*n,e.stroke()}function Nr(e,t,n,o=.35){Or(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",n?e.fill(n):e.fill())}import{line as $r}from"d3-shape";import{curveMonotoneX as Wr,curveMonotoneY as _r,curveCardinal as Er,curveCatmullRom as Br,curveStep as Hr,curveStepBefore as Fr,curveStepAfter as Gr,curveBasis as qr,curveNatural as Vr}from"d3-shape";function Zr(e){switch(e){case"monotoneX":return Wr;case"monotoneY":return _r;case"cardinal":return Er;case"catmullRom":return Br;case"step":return Hr;case"stepBefore":return Fr;case"stepAfter":return Gr;case"basis":return qr;case"natural":return Vr;default:return null}}function Ur(e,t,n){return null==t?n:"string"!=typeof t?t:ut(e,t)||n}function Yr(e,t,n,o,r,i){const a=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>a.length)return null;const s=e.createLinearGradient(n,o,r,i);for(const e of a)s.addColorStop(e.offset,e.color);return s}function Xr(e,t,n){let o=n;for(const n of t)"lesser"===n.thresholdType?n.value>e&&(o=n.color):e>n.value&&(o=n.color);return o}function Qr(e,t,n,o,r,i){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],o=t[e][1]-t[e-1][1];a.push(a[e-1]+Math.sqrt(n*n+o*o))}const s=a[a.length-1];if(0===s)return;const l=Math.min(.2*s,40);e.strokeStyle=n,e.lineWidth=o,e.lineCap=i;for(let n=0;t.length-1>n;n++){const o=(a[n]+a[n+1])/2;let i=r;l>o&&(i*=o/l),l>s-o&&(i*=(s-o)/l),e.globalAlpha=Math.max(0,i),e.beginPath(),e.moveTo(t[n][0],t[n][1]),e.lineTo(t[n+1][0],t[n+1][1]),e.stroke()}}function Kr(e,t,n,o,r){if(0>=t.size)return;const i=t.glyph;if(!i||!i.parts?.length)return;const a=ve(i,t.size);if(0>=a.scale)return;const s=(t.style.opacity??1)*(t._decayOpacity??1);if(0>=s)return;const l=t=>{const n=Ur(e,t,t);return"string"==typeof n?n:t},c=t.color??("string"==typeof t.style.fill?t.style.fill:void 0);e.save(),e.translate(n,o),t.rotation&&e.rotate(t.rotation),e.translate(a.offsetX,a.offsetY),e.scale(a.scale,a.scale),e.globalAlpha=r*s*(t.style.fillOpacity??1);const u=Me(i,t.fraction??1,t.fractionStart??0,t.fractionDirection??"horizontal");u&&t.ghostColor&&Ce(e,i,c,t.accent,t.ghostColor,l),u&&(e.beginPath(),e.rect(u.x,u.y,u.width,u.height),e.clip()),Ce(e,i,c,t.accent,void 0,l),e.restore()}function Jr(e,t,n,o){const r=e.getContext("2d");if(!r)return null;const i=Math.round(t[0]*o),a=Math.round(t[1]*o),s=i/t[0],l=a/t[1],c=t[0]+"px",u=t[1]+"px";return e.style.width!==c&&(e.style.width=c),e.style.height!==u&&(e.style.height=u),e.width===i&&e.height===a||(e.width=i,e.height=a),r.setTransform(s,0,0,l,0,0),r.translate(n.left,n.top),r}function ei(){if("undefined"==typeof window)return 1;const e=window.devicePixelRatio||1,t=function(){if("undefined"==typeof window)return!1;const e="function"==typeof window.matchMedia&&window.matchMedia("(pointer: coarse)").matches,t=768>Math.min(window.innerWidth||1/0,window.innerHeight||1/0);return e||t}()?2:3;return Math.max(1,Math.min(e,t))}function ti([e,t,n]){const o=1<<n;return[e-Math.floor(e/o)*o,t,n]}function ni(e,t,n,o,r){return"function"==typeof e?e(t,n,o,r):e.replace("{z}",t+"").replace("{x}",n+"").replace("{y}",o+"").replace("{r}",r>1?"@2x":"")}var oi=class{constructor(e=256){this.cache=new Map,this.limit=e}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,o]of this.cache)t>o.lastUsed&&(t=o.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 ri=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){for(let t=0;this.capacity>t;t++){const n=this.particles[t];if(!n.active)return n.active=!0,n.t=0,n.offset=.6*(Math.random()-.5),n.lineIndex=e,n.x=0,n.y=0,n}return null}step(e,t,n,o){for(let r=0;this.capacity>r;r++){const i=this.particles[r];if(!i.active)continue;const a=n[i.lineIndex];if(!a||2>a.length){i.active=!1;continue}if(i.t+=e*t,i.t>=1){i.active=!1;continue}const s=ii(a),l=ai(a,i.t*s),c=(o[i.lineIndex]||2)/2;i.x=l.x+l.nx*i.offset*c*2,i.y=l.y+l.ny*i.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 ii(e){let t=0;for(let n=1;e.length>n;n++){const o=e[n][0]-e[n-1][0],r=e[n][1]-e[n-1][1];t+=Math.sqrt(o*o+r*r)}return t}function ai(e,t){let n=0;for(let o=1;e.length>o;o++){const r=e[o][0]-e[o-1][0],i=e[o][1]-e[o-1][1],a=Math.sqrt(r*r+i*i);if(n+a>=t||o===e.length-1){const s=a>0?(t-n)/a:0,l=a>.001?a:1;return{x:e[o-1][0]+r*s,y:e[o-1][1]+i*s,nx:-i/l,ny:r/l}}n+=a}const o=e[e.length-1];return{x:o[0],y:o[1],nx:0,ny:0}}import*as si from"react";function li(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:si.createElement(si.Fragment,null,...t)}import*as ci from"react";import{jsx as ui}from"react/jsx-runtime";var hi=ci.createContext(null);function di({value:e,children:t}){return ui(hi.Provider,{value:e,children:t})}function fi(e,t){return null!=e?ui(di,{value:t,children:e}):e}function pi(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,o=Ae(e.glyph,e.size);t.push({pointId:e.pointId,x:e.x+o.centerDx,y:e.y+o.centerDy,r:o.radius})}return t}import{jsx as mi,jsxs as yi}from"react/jsx-runtime";import{jsx as gi,jsxs as bi}from"react/jsx-runtime";function vi({data:e}){if(!e)return null;if(e.properties)return gi("div",{className:"semiotic-tooltip",style:Mr,children:gi("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=function(e,t={}){if(!e||"object"!=typeof e)return{entries:[]};const n=t.maxEntries??6,o=!1!==t.skipPositional,r=[];for(const[t,n]of Object.entries(e)){if(t.startsWith("_"))continue;if("data"===t)continue;if(o&&xr.has(t.toLowerCase()))continue;if(null==n)continue;const e=typeof n;("string"===e||"number"===e||"boolean"===e||n instanceof Date)&&r.push({key:t,lower:t.toLowerCase(),value:n})}if(0===r.length)return{entries:[]};let i=r.findIndex(e=>gr.includes(e.lower));const a=i>=0;0>i&&(i=r.findIndex(e=>"id"===e.lower)),0>i&&(i=r.findIndex(e=>"string"==typeof e.value));const s=0>i?void 0:r[i];let l=r.filter((e,t)=>t!==i);a&&(l=l.filter(e=>"id"!==e.lower));const c=wr(l,br),u=wr(l,vr),h=new Set(br),d=new Set(vr),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&&(h.has(e.lower)||d.has(e.lower)||f.push({key:e.key,value:e.value}))}return{titleKey:s?.key,title:s?.value,entries:f}}(t),o=null!=n.title?n.title+"":null;return null==o&&0===n.entries.length?null:bi("div",{className:"semiotic-tooltip",style:Mr,children:[null!=o&&gi("div",{style:{fontWeight:600,marginBottom:n.entries.length?2:0},children:o}),n.entries.map(e=>{return bi("div",{children:[bi("span",{style:{opacity:.7},children:[e.key,": "]}),gi("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})]})}vi.ownsChrome=!0;var xi={top:10,right:10,bottom:10,left:10},wi=null;function ki(){if(null!==wi)return wi;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 wi=e||t||n}function Si(){return ki()?12:30}var Mi={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 Ai(e){return"string"==typeof e?e:"object"==typeof e&&e&&"type"in e?e.type:null}function Ci(e){return e?e.getContext("2d"):null}import{jsx as Li,jsxs as ji}from"react/jsx-runtime";var Pi=s(a(function(a,s){const{projection:l,projectionExtent:c,fitPadding:u,projectionTransform:h,areas:d,points:f,lines:p,customLayout:m,layoutConfig:y,layoutSelection:g,onLayoutError:b,xAccessor:v,yAccessor:x,lineDataAccessor:w,pointIdAccessor:k,lineIdAccessor:S,lineType:M="geo",flowStyle:A="basic",graticule:C,zoomable:L,zoomExtent:j,onZoom:P,dragRotate:I,showParticles:D,particleStyle:z,tileURL:R,tileAttribution:O,tileCacheSize:T,size:N,width:$,height:W,responsiveWidth:_,responsiveHeight:E,margin:B,className:H,background:F,areaStyle:G,pointStyle:q,lineStyle:V,colorScheme:Z,enableHover:U=!0,hoverAnnotation:Y,tooltipContent:X,allowTooltipOverflow:Q=!1,customClickBehavior:K,customHoverBehavior:J,annotations:ee,autoPlaceAnnotations:te,decay:ne,pulse:oe,transition:re,animate:ie,staleness:ae,backgroundGraphics:se,foregroundGraphics:le,title:ce,legend:ue,legendPosition:he,legendLayout:de,legendHoverBehavior:pe,legendClickBehavior:me,legendHighlightedCategory:ye,legendIsolatedCategories:ge,legendCategoryAccessor:be,onCategoriesChange:xe,showAxes:ke,accessibleTable:Se=!0,description:Ce,summary:je}=a,Pe=N||[$||600,W||400],Ie=e(!0),De=pt({sizeProp:Pe,responsiveWidth:_,responsiveHeight:E,userMargin:B,marginDefault:xi,foregroundGraphics:le,backgroundGraphics:se,animate:ie,transitionProp:re,themeDirtyRef:Ie}),{reducedMotionRef:ze,responsiveRef:Re,size:Oe,margin:Te,adjustedWidth:Ne,adjustedHeight:$e,resolvedForeground:We,resolvedBackground:_e,transition:Ee,introEnabled:Be,tableId:He,rafRef:Fe,renderFnRef:qe,scheduleRender:Ve,cancelRender:Ze,currentTheme:Ue}=De,Ye=function(){const[e,t]=Lo(!1);return Po(()=>{t(!0)},[]),e}(),Xe=function(){const e=jo(Io,Do,zo);return Co(e).current}(),Qe=o(()=>Array.isArray(d)?hr(d):d,[d]),Ke=o(()=>hr(f),[f]),Je=o(()=>hr(p),[p]),et=o(()=>null!=I?I:"orthographic"===Ai(l),[I,l]),tt=function(e){const t=Ro(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return To(e,t);if(!No(e)||!No(t))return!1;const n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(const o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;const n=e[o],r=t[o];if(!Object.is(n,r))if(Array.isArray(n)&&Array.isArray(r)){if(!To(n,r))return!1}else{if(!No(n)||!No(r))return!1;if(!Oo(n,r))return!1}}return!0}(t.current,e)||(t.current=e),t.current}(o(()=>({projection:l,projectionExtent:c,fitPadding:u,xAccessor:v,yAccessor:x,lineDataAccessor:w,lineType:M,flowStyle:A,areaStyle:G,pointStyle:q,lineStyle:V,colorScheme:Z,themeSemantic:Ge(Ue),themeSequential:Ue?.colors?.sequential,themeDiverging:Ue?.colors?.diverging,themeCategorical:Ue?.colors?.categorical,graticule:C,projectionTransform:h,decay:ne,pulse:oe,transition:Ee,introAnimation:Be,annotations:ee,pointIdAccessor:k,lineIdAccessor:S,customLayout:m,layoutConfig:y,onLayoutError:b,layoutMargin:Te}),[l,c,u,v,x,w,M,A,G,q,V,Z,C,h,ne,oe,Ee?.duration,Ee?.easing,Be,ee,k,S,Ue,m,y,b,Te])),nt=e(null);nt.current||(nt.current=new fe(tt));const ot=e(null),rt=e(null),it=e(null),at=e(null),st=e(null);R&&!st.current&&(st.current=new oi(T||256));const lt=e(ee),ct=e(null),ht=e(zr),dt=e(!1),ft=e(null),wt=r(e=>{ft.current=e,Re&&"object"==typeof Re&&(Re.current=e)},[Re]),St=e(null),Mt=e(null),At=e(null),Ct=e(0);if(D&&!At.current){const e=z?.maxPerLine??Si();At.current=new ri(50*e)}const Lt=e(null),jt=e(null),Pt=e(!1),It=e(void 0),[Dt,zt]=t(null),[Rt,Ot]=t(0),Tt=e(0),[Nt,$t]=t(!1),Wt=e([]),_t=e(be),Et=e(xe);_t.current=be,Et.current=xe;const Bt=r(()=>{const e=_t.current,t=Et.current;if(!t||!e)return;const n=function(e,t){if(!t)return[];const n=new Set,o=[];for(const r of e){if(!r||"object"!=typeof r)continue;const e="function"==typeof t?t(r):r[t];if(null==e)continue;const i=e+"";n.has(i)||(n.add(i),o.push(i))}return o}(nt.current?.getPoints()??[],e);(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})(n,Wt.current)||(Wt.current=n,t(n))},[]);!function(e,t,n,o){mt(()=>{e.current?.updateConfig(t),n.current=!0,o()},[t,o,e,n])}(nt,tt,Ie,Ve),function(e,t,n,o){const r=yt(null);mt(()=>{const i=e.current;if(!i)return;const a=t??null;r.current!==a&&(r.current=a,i.setLayoutSelection(a),i.hasCustomRestyle?i.restyleScene(a):n.current=!0,o())},[t,o,e,n])}(nt,g,Ie,Ve),n(()=>{const e=nt.current;e&&(Qe&&e.setAreas(Qe),f&&e.setPoints(Ke),p&&e.setLines(Je),Ie.current=!0,Ve())},[Qe,f,Ke,p,Je,Ve]);const Ht=r(e=>{null!=e&&"object"==typeof e&&(nt.current?.pushPoint(e),Ie.current=!0,Ve())},[Ve]),Ft=r(e=>{const t=hr(e);0!==t.length&&(nt.current?.pushMany(t),Ie.current=!0,Ve())},[Ve]),Gt=r(e=>{null!=e&&"object"==typeof e&&(nt.current?.pushLine(e),Ie.current=!0,Ve())},[Ve]),qt=r(e=>{const t=hr(e);0!==t.length&&(nt.current?.pushManyLines(t),Ie.current=!0,Ve())},[Ve]),Vt=r(()=>{nt.current?.clear(),Ie.current=!0,Ve()},[Ve]);i(s,()=>({push:Ht,pushMany:Ft,removePoint:e=>{const t=nt.current?.removePoint(e)??[];return t.length>0&&(Ie.current=!0,Ve()),t},pushLine:Gt,pushManyLines:qt,removeLine:e=>{const t=nt.current?.removeLine(e)??[];return t.length>0&&(Ie.current=!0,Ve()),t},getLines:()=>nt.current?.getLines()??[],clear:Vt,getProjection:()=>nt.current?.scales?.projection??null,getGeoPath:()=>nt.current?.scales?.geoPath??null,getCartogramLayout:()=>nt.current?.cartogramLayout??null,getCustomLayout:()=>nt.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>nt.current?.lastCustomLayoutFailure??null,getZoom:()=>ht.current.k,resetZoom:()=>{const e=ft.current;e&&ct.current&&Rr(e).call(ct.current.transform,zr)},getData:()=>nt.current?.getPoints()??[]}),[Ht,Ft,Gt,qt,Vt,Ve]);const{hoverHandlerRef:Zt,onPointerMove:Ut,onPointerLeave:Yt}=De;n(()=>{Zt.current=e=>{if(!U)return;const t=nt.current;if(!t||!t.scene.length)return;const n=rt.current;if(!n)return;const o=n.getBoundingClientRect(),r=e.clientX-o.left-Te.left,i=e.clientY-o.top-Te.top;if(0>r||r>Ne||0>i||i>$e)return Lt.current=null,jt.current=null,zt(null),J?.(null),void Ve();at.current||(at.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const a=Ci(at.current);if(!a)return;const s=yr(30,e.pointerType),l=yr(6,e.pointerType),c=Le(t.scene,r,i,s,a,t.quadtree,t.maxPointRadius,l);if(c){const e=c.node,t=e.datum,n=Array.isArray(t)?null:t?.properties?t:t?.data||t;let o,a;"point"===e.type?(o=e.x,a=e.y):"geoarea"===e.type?(o=e.centroid[0],a=e.centroid[1]):(o=r,a=i);const s={...n,...n?.properties||{},data:n,properties:n?.properties,__semioticHoverData:!0,x:o,y:a};Lt.current=s,jt.current=e,zt(s),J?.(s),Ve()}else Lt.current&&(Lt.current=null,jt.current=null,zt(null),J?.(null),Ve())}},[U,Ne,$e,Te,J,Ve]),De.hoverLeaveRef.current=()=>{Lt.current=null,jt.current=null,zt(null),J?.(null),Ve()};const Xt=r(e=>{if(!K)return;const t=nt.current;if(!t||!t.scene.length)return void K(null);const n=e.currentTarget.getBoundingClientRect(),o=e.clientX-n.left-Te.left,r=e.clientY-n.top-Te.top;if(0>o||o>Ne||0>r||r>$e)return void K(null);at.current||(at.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const i=Ci(at.current);if(!i)return void K(null);const a=yr(30,It.current),s=yr(6,It.current),l=Le(t.scene,o,r,a,i,t.quadtree,t.maxPointRadius,s);if(l){const e=l.node.datum,t=Array.isArray(e)?null:e?.properties?e:e?.data||e,n=t?.properties?{...t,...t.properties}:t;return void K({...n,data:t,properties:t?.properties,__semioticHoverData:!0,x:o,y:r,time:o,value:r})}K(null)},[$e,Ne,K,Te]),Qt=e(-1),Kt=e(null),Jt=r(e=>{const t=nt.current;if(!t||0===t.scene.length)return;const n=function(e){const t=[];for(const n of e)if("point"===n.type&&null!=n.x)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=Ae(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}(t.scene);if(0===n.length)return;const o=Qt.current,r=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}}(e.key,0>o?-1:o,n.length);if(null===r)return;if(e.preventDefault(),0>r)return Qt.current=-1,Kt.current=null,Lt.current=null,jt.current=null,zt(null),J?.(null),void Ve();const i=0>o?0:r;Qt.current=i;const a=n[i];Kt.current={shape:a.shape,w:a.w,h:a.h,pathData:a.pathData};const s=a.datum,l={...s||{},...s?.properties||{},data:s,properties:s?.properties,x:a.x,y:a.y,__semioticHoverData:!0};Lt.current=l,zt(l),J?.(l),Ve()},[J,Ve]),en=r(e=>{It.current=e.pointerType,Qt.current=-1,Kt.current=null,Ut(e)},[Ut]),tn=r(e=>{It.current=e.pointerType},[]);qe.current=()=>{Fe.current=null;const e=rt.current,t=nt.current;if(!e||!t)return;const n=performance.now();let o=!1;const r=Mt.current;let i=!1;r&&(Mt.current=null,t.applyRotation(r,{width:Ne,height:$e}),i=!0);const a=t.advanceTransition(ze.current?n+1e6:n),s=!ze.current&&a;let l=!1;if(Ie.current&&!a){const n={width:Ne,height:$e},o=et?t.getRotation():null;t.computeScene(n);const r=ht.current,i=1!==r.k||0!==r.x||0!==r.y;et&&o?i?(t.setRotation(o),t.applyZoomScale(r.k,n)):t.applyRotation(o,n):i&&t.applyZoomTransform(r,n),Ie.current=!1,l=!0,e.setAttribute("aria-label",Zo(t.scene,"Geographic chart")),Bt()}const c=ei(),u=D&&!ze.current&&!!At.current,h=t.consumeStylePaintPending(),d=!!((f={dirtyOrRebuilt:l,transitioning:s,continuous:u,liveEncoding:t.hasActivePulses,forced:i||h}).dirtyOrRebuilt||f.transitioning||f.animationTicked||f.continuous||f.liveEncoding||f.forced);var f;if(R&&st.current){const e=ot.current;if(e&&t.scales?.projection){const n=Jr(e,Oe,Te,c);if(n){n.clearRect(-Te.left,-Te.top,Oe[0],Oe[1]),n.save(),n.beginPath(),n.rect(0,0,Ne,$e),n.clip();const e=function(e,t){const{tileURL:n,projection:o,width:r,height:i,tileCache:a,onTileLoad:s}=t,l=o.scale(),c=o.translate(),u=function(e){const{size:t,scale:n,translate:o,clampX:r=!0,clampY:i=!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=o[0]-n/2,h=o[1]-n/2,d=Math.max(r?0:-1/0,Math.floor((0-u)/c)),f=Math.min(r?l:1/0,Math.ceil((t[0]-u)/c)),p=Math.max(i?0:-1/0,Math.floor((0-h)/c)),m=Math.min(i?l:1/0,Math.ceil((t[1]-h)/c)),y=[];for(let e=p;m>e;++e)for(let t=d;f>t;++t)y.push([t,e,s]);return{tiles:y,translate:[u/c,h/c],scale:c}}({size:[r,i],scale:2*l*Math.PI,translate:c}),h=ei();let d=!0;for(const t of u.tiles){const[o,r,i]=ti(t),l=`${i}/${o}/${r}`;let c=a.get(l);if(!c){const e=new Image;e.crossOrigin="anonymous";const t={img:e,loaded:!1,key:l,lastUsed:performance.now()};a.set(l,t),e.onload=()=>{t.loaded=!0,s?.()},e.onerror=()=>{t.loaded=!0},e.src=ni(n,i,o,r,h),c=t}if(!c.loaded){d=!1;continue}const f=u.scale;e.drawImage(c.img,(t[0]+u.translate[0])*f-.5,(t[1]+u.translate[1])*f-.5,f+1,f+1)}return d}(n,{tileURL:R,projection:t.scales.projection,width:Ne,height:$e,tileCache:st.current,onTileLoad:()=>Ve()});n.restore(),e||(o=!0)}}}if(d){const r=Jr(e,Oe,Te,c);if(!r)return;r.clearRect(-Te.left,-Te.top,Oe[0],Oe[1]),R||function(e,t){const{background:n,hasBackgroundGraphics:o=!1,themeBackground:r="",x:i=0,y:a=0,width:s,height:l}=t;if("transparent"===n)return!1;if(o)return!1;const c=n||(r&&"transparent"!==r?r:"")||null;if(!c)return!1;const u=ut(e,c);u&&(e.fillStyle=u,e.fillRect(i,a,s,l))}(r,{background:F,width:Ne,height:$e}),r.save(),r.beginPath(),r.rect(0,0,Ne,$e),r.clip();const i=t.scene,a={width:Ne,height:$e};if(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,o=t.style.fill||"#e0e0e0";if("none"!==o&&(e.fillStyle=o,e.globalAlpha=(t._decayOpacity??1)*(t.style.fillOpacity??1),e.fill(n)),t.style.stroke&&"none"!==t.style.stroke){if(e.strokeStyle=ut(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||.5,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)}Nr(e,t,n),e.globalAlpha=1,e.setLineDash([])}}(r,i),((e,t,n,o)=>{const r=t.filter(e=>"line"===e.type);for(const t of r){if(2>t.path.length)continue;const n=t._introClipFraction;void 0!==n&&1>n&&(e.save(),e.beginPath(),e.rect(0,0,o.width*n,o.height),e.clip());const r=t.style.stroke||"#007bff",i=ut(e,r)||r,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),e.lineWidth=a,e.lineCap=t.style.strokeLinecap||"butt",t.style._edgeFade){Qr(e,t.path,i,a,t.style.opacity??1,t.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const c=Zr(t.curve),u=s&&s.length>0&&l&&l.length===t.path.length,h=t._decayOpacities;if(h&&h.length===t.path.length&&!u){e.strokeStyle=i;const n=t.style.opacity??1;for(let o=0;t.path.length-1>o;o++)e.globalAlpha=.5*(h[o]+h[o+1])*n,e.beginPath(),e.moveTo(t.path[o][0],t.path[o][1]),e.lineTo(t.path[o+1][0],t.path[o+1][1]),e.stroke()}else if(u){let n=function(t,n,o){e.beginPath(),e.strokeStyle=t,e.moveTo(n,o),h=!0},o=function(){h&&(e.stroke(),h=!1)},r=null,a=null,c=null,u=null,h=!1;for(let h=0;t.path.length>h;h++){const[d,f]=t.path[h],p=l[h],m=Xr(p,s,i);if(null!==r&&null!==u&&null!==c){if(m===u)e.lineTo(d,f);else{const t=[];for(const e of s){const n=e.value;(c>n||n>p)&&(n>c||p>n)||c===n||p===n||t.push({t:(n-c)/(p-c)})}t.sort((e,t)=>e.t-t.t);for(const l of t){const t=r+(d-r)*l.t,u=a+(f-a)*l.t,h=Xr(c+(p-c)*Math.min(l.t+1e-4,1),s,i);e.lineTo(t,u),o(),n(h,t,u)}e.lineTo(d,f)}r=d,a=f,c=p,u=m}else n(m,d,f),r=d,a=f,c=p,u=m}o()}else{e.beginPath();const n=t.strokeGradient&&t.path.length>=2?Yr(e,t.strokeGradient,t.path[0][0],0,t.path[t.path.length-1][0],0):null;if(e.strokeStyle=n||i,c)$r().x(e=>e[0]).y(e=>e[1]).curve(c).context(e)(t.path);else{const[n,o]=t.path[0];e.moveTo(n,o);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=Ur(e,t.style.fill,t.style.fill),c&&!u)$r().x(e=>e[0]).y(e=>e[1]).curve(c).context(e)(t.path);else{const[n,o]=t.path[0];e.moveTo(n,o);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],o.height),e.lineTo(n,o.height),e.closePath(),e.fill()}void 0!==n&&1>n&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}})(r,i,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 o of n)e.beginPath(),e.arc(o.x,o.y,o.r,0,2*Math.PI),e.globalAlpha=t*(o.style.opacity??o.style.fillOpacity??1),e.fillStyle=Ur(e,o.style.fill,"#4e79a7"),e.fill(),o.style.stroke&&(e.strokeStyle=Ur(e,o.style.stroke,o.style.stroke),e.lineWidth=o.style.strokeWidth||1,e.stroke()),Tr(e,o)}finally{e.restore()}}})(r,i),((e,t)=>{const n=e.globalAlpha;for(const o of t)"glyph"===o.type&&Kr(e,o,o.x,o.y,n);e.globalAlpha=n})(r,i),u&&At.current){const e=At.current,t=i.filter(e=>"line"===e.type);if(t.length>0){const i=z||{},a=.3*(i.speedMultiplier??1),s=i.maxPerLine??Si(),l=i.spawnRate??(ki()?.06:.15),c=i.radius??2,u=i.opacity??.7,h=n/1e3,d=Ct.current>0?Math.min(h-Ct.current,.1):.016;Ct.current=h;const f=t.map(e=>e.path),p=t.map(e=>e.style.strokeWidth||2);for(let n=0;t.length>n;n++)Math.random()<l&&e.countForLine(n)<s&&e.spawn(n);e.step(d,a,f,p),r.globalAlpha=u;for(let n=0;e.particles.length>n;n++){const o=e.particles[n];if(!o.active)continue;const a=t[o.lineIndex],s="function"==typeof i.color?i.color(a?.datum??{}):"source"!==i.color&&i.color?i.color:a?.style.stroke||"#fff";r.beginPath(),r.arc(o.x,o.y,c,0,2*Math.PI),r.fillStyle=s,r.fill()}r.globalAlpha=1,o=!0}}r.restore()}const p=jt.current,m=!(!p||"geoarea"!==p.type&&"point"!==p.type),y=m||Pt.current;const g=it.current;if(g&&y){const e=Jr(g,Oe,Te,c);if(e){if(e.clearRect(-Te.left,-Te.top,Oe[0],Oe[1]),p&&"geoarea"===p.type){const t=new Path2D(p.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(p&&"point"===p.type){const t=p,n="object"==typeof Y?Y:void 0,o=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}(p);e.beginPath(),e.arc(t.x,t.y,t.r+3,0,2*Math.PI),o?(e.save(),e.globalAlpha=.4,e.fillStyle=o,e.fill(),e.restore()):(e.fillStyle="rgba(255, 255, 255, 0.4)",e.fill()),e.strokeStyle=o||"rgba(0, 0, 0, 0.5)",e.lineWidth=2,e.stroke()}}Pt.current=m}const b=ee!==lt.current;b&&(lt.current=ee),(l||b||s&&ee&&ee.length>0)&&(l||b||n-Tt.current>=33)&&(Ot(e=>e+1),Tt.current=n),(s||null!=t.activeTransition||t.hasActivePulses||o)&&Ve()},function(e){const{hydrated:t,wasHydratingFromSSR:n,storeRef:o,dirtyRef:r,renderFnRef:i,cancelRender:a,cleanup:s}=e;Po(()=>{t&&n&&o.current?.cancelIntroAnimation?.(),r.current=!0,a?.(),i.current()},[t,n]);const l=Co(s);l.current=s,Mo(()=>()=>l.current?.(),[])}({hydrated:Ye,wasHydratingFromSSR:Xe,storeRef:nt,dirtyRef:Ie,renderFnRef:qe,cancelRender:Ze,cleanup:()=>st.current?.clear()}),n(()=>{Ie.current=!0,Ve()},[Ne,$e,F,Ve]),function(e,t,n,o,r,i){const a=bt("fresh");gt(()=>{if(!e)return;const s=setInterval(()=>{const s=t.current;if(!s||0===s.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=function(e,t){if(!e||0>=t)return xt;const n=null!=e.threshold&&e.threshold>0?e.threshold:5e3,o=e.graded;if(o){const e="object"==typeof o?o:{},r=function(e,t,n={}){return Number.isFinite(t)&&t>0?Number.isNaN(e)?"fresh":e===1/0?"expired":0>e||t*(n.fresh??1)>e?"fresh":t*(n.aging??1.5)>e?"aging":t*(n.stale??3)>e?"stale":"expired":"fresh"}(t,n,e.thresholds);return{alpha:{...vt,...e.opacities??{}}[r],band:r,isStale:"fresh"!==r}}return t>n?{alpha:e.dimOpacity??.5,band:"stale",isStale:!0}:xt}(e,l-s.lastIngestTime);c.band===a.current&&c.isStale===r||(a.current=c.band,c.isStale!==r&&i(c.isStale),n.current=!0,o())},1e3);return()=>clearInterval(s)},[e,r,o])}(ae,nt,Ie,Ve,Nt,$t),n(()=>{if("production"!==process.env.NODE_ENV&&R){const e=Ai(l);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,l]),n(()=>{const e=ft.current;if(!L||!e)return ct.current&&e&&(Rr(e).on(".zoom",null),ct.current=null),void(e&&Rr(e).on("mousedown.rotate",null).on("touchstart.rotate",null));const[t,n]=j||[1,8],o={width:Ne,height:$e};if(et){let r=ht.current.k;const i=e=>{r=Math.max(t,Math.min(n,e)),ht.current=zr.scale(r);const i=nt.current;i&&(i.applyZoomScale(r,o),Ie.current=!1,Ve(),i.scales?.projection&&P?.({projection:i.scales.projection,zoom:i.currentZoom}))};ct.current={scaleBy:(e,t)=>i(r*t),transform:(e,t)=>i(t?.k??1)};const a=e=>{e.preventDefault(),i(r*(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(),i(1.5*r))};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 o=nt.current;if(!o)return;const r=o.getRotation();St.current={x:t.clientX,y:t.clientY,rotation:[...r]},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]],Ve())},h=t=>{if(!St.current)return;St.current=null,e.releasePointerCapture(t.pointerId);const n=Mt.current;if(n){Mt.current=null;const e=nt.current;e&&(e.applyRotation(n,o),Ve())}const r=nt.current;r?.scales?.projection&&P?.({projection:r.scales.projection,zoom:r.currentZoom})};return e.addEventListener("pointerdown",c),e.addEventListener("pointermove",u),e.addEventListener("pointerup",h),e.addEventListener("pointercancel",h),()=>{e.removeEventListener("wheel",a),e.removeEventListener("dblclick",s),e.removeEventListener("pointerdown",c),e.removeEventListener("pointermove",u),e.removeEventListener("pointerup",h),e.removeEventListener("pointercancel",h),ct.current=null}}const r=Dr().scaleExtent([t,n]).extent([[0,0],[Oe[0],Oe[1]]]).translateExtent([[-1/0,-1/0],[1/0,1/0]]).on("zoom",e=>{const t=e.transform;ht.current=t,dt.current=!0;const n=nt.current;n&&(n.applyZoomTransform(t,o),Ie.current=!1,Ve())}).on("end",e=>{ht.current=e.transform,dt.current=!1;const t=nt.current;t?.scales?.projection&&P?.({projection:t.scales.projection,zoom:t.currentZoom})});return ct.current=r,Rr(e).call(r),()=>{Rr(e).on(".zoom",null)}},[L,j,et,Oe,Ne,$e,Te,P,Ve]);const nn=U&&!1!==Y,on=nn&&Dt?X?X(Dt):Li(vi,{data:Dt}):null,rn=on?Li(Ir,{x:Dt.x,y:Dt.y,containerWidth:Ne,containerHeight:$e,margin:Te,className:"stream-frame-tooltip",zIndex:10,children:on}):null;if(So||!Ye&&Xe){const e=nt.current;e&&(Qe||f||p)&&(Qe&&e.setAreas(Qe),f&&e.setPoints(Ke),p&&e.setLines(Je),e.computeScene({width:Ne,height:$e}));const t=e?.scene??[];return ji("div",{ref:wt,className:"stream-geo-frame"+(H?" "+H:""),role:"img","aria-label":Ce||("string"==typeof ce?ce:"Geographic chart"),style:{position:"relative",width:_?"100%":Oe[0],height:E?"100%":Oe[1]},children:[Li(sr,{summary:je}),ji("svg",{xmlns:"http://www.w3.org/2000/svg",width:Oe[0],height:Oe[1],style:{position:"absolute",left:0,top:0},children:[Li("g",{transform:`translate(${Te.left},${Te.top})`,children:_e}),ji("g",{transform:`translate(${Te.left},${Te.top})`,children:[F&&Li("rect",{x:0,y:0,width:Ne,height:$e,fill:F}),t.map((e,t)=>function(e,t){switch(e.type){case"geoarea":{const n=e;return n.pathData?xo("path",{d:n.pathData,fill:ko(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):null}case"point":{const n=e;return xo("circle",{cx:n.x,cy:n.y,r:n.r,fill:ko(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 o="M"+n.path.map(e=>`${e[0]},${e[1]}`).join("L");return xo("path",{d:o,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,o){const r=e.glyph;if(!r?.parts?.length||0>=e.size)return null;const i=ve(r,e.size);if(0>=i.scale)return null;const a=`translate(${t},${n})${e.rotation?` rotate(${180*e.rotation/Math.PI})`:""} translate(${i.offsetX},${i.offsetY}) scale(${i.scale})`,s=e.color??("string"==typeof e.style.fill?e.style.fill:void 0),l=Me(r,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}(o+"-clip"):void 0,u=(e.style.opacity??1)*(e._decayOpacity??1)*(e.style.fillOpacity??1),h=t=>r.parts.map((n,o)=>{const r=t?"none"===n.fill?void 0:t:we(n.fill,s,e.accent),i=t?n.stroke&&"none"!==n.stroke?t:void 0:we(n.stroke??"none",s,e.accent);return r||i?xo("path",{d:n.d,fill:r??"none",stroke:i,strokeWidth:i?n.strokeWidth??1:void 0,strokeLinecap:n.strokeLinecap,strokeLinejoin:n.strokeLinejoin,opacity:n.opacity},o):null});return wo("g",{transform:a,opacity:1===u?void 0:u,children:[l&&c&&xo("clipPath",{id:c,children:xo("rect",{x:l.x,y:l.y,width:l.width,height:l.height})}),l&&e.ghostColor?xo("g",{children:h(e.ghostColor)}):null,l&&c?xo("g",{clipPath:`url(#${c})`,children:h()}):h()]},o)}(e,e.x,e.y,"geo-glyph-"+(e.pointId??t));default:return null}}(e,t))]})]}),Li(go,{width:Ne,height:$e,totalWidth:Oe[0],totalHeight:Oe[1],margin:Te,scales:null,showAxes:!1,title:ce,legend:ue,legendPosition:he,legendLayout:de,legendHoverBehavior:pe,legendClickBehavior:me,legendHighlightedCategory:ye,legendIsolatedCategories:ge,foregroundGraphics:li(We,fi(nt.current?.customLayoutOverlays,g??null)),annotations:ee,autoPlaceAnnotations:te,annotationFrame:0,xValues:[],yValues:[],pointNodes:pi(t)})]})}return ji("div",{ref:wt,className:"stream-geo-frame"+(H?" "+H:""),role:"group","aria-label":Ce||("string"==typeof ce?ce:"Geographic chart"),tabIndex:0,style:{position:"relative",width:_?"100%":Oe[0],height:E?"100%":Oe[1],overflow:Q?"visible":"hidden",...L?{touchAction:"none"}:{}},onKeyDown:Jt,children:[Se&&Li(lr,{tableId:He}),Se&&Li(ar,{scene:nt.current?.scene??[],chartType:"Geographic chart",tableId:He,chartTitle:"string"==typeof ce?ce:void 0}),Li(sr,{summary:je}),Li(cr,{hoverPoint:Dt}),ji("div",{role:"img","aria-label":Ce||("string"==typeof ce?ce:"Geographic chart"),style:{position:"relative",width:"100%",height:"100%"},onPointerMove:nn?en:void 0,onPointerLeave:nn?Yt:void 0,onPointerDown:nn||K?tn:void 0,onClick:K?Xt:void 0,children:[_e&&Li("svg",{style:{position:"absolute",left:0,top:0,width:Oe[0],height:Oe[1],pointerEvents:"none"},children:Li("g",{transform:`translate(${Te.left},${Te.top})`,children:_e})}),R&&Li("canvas",{ref:ot,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),Li("canvas",{ref:rt,"aria-label":Zo(nt.current?.scene??[],"Geographic chart"),style:{position:"absolute",left:0,top:0}}),Li("canvas",{ref:it,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),Li(go,{width:Ne,height:$e,totalWidth:Oe[0],totalHeight:Oe[1],margin:Te,scales:null,showAxes:ke??!1,title:ce,legend:ue,legendPosition:he,legendLayout:de,legendHoverBehavior:pe,legendClickBehavior:me,legendHighlightedCategory:ye,legendIsolatedCategories:ge,foregroundGraphics:li(We,fi(nt.current?.customLayoutOverlays,g??null)),annotations:ee,autoPlaceAnnotations:te,annotationFrame:Rt,xValues:[],yValues:[],pointNodes:pi(nt.current?.scene)}),ae?.showBadge&&Li(kt,{isStale:Nt,position:ae.badgePosition}),L&&ji("div",{className:"stream-geo-zoom-controls",style:{position:"absolute",bottom:Te.bottom+8,left:Te.left+8,display:"flex",flexDirection:"column",gap:2,zIndex:2},children:[Li("button",{type:"button","aria-label":"Zoom in",onClick:e=>{e.stopPropagation();const t=ft.current,n=ct.current;t&&n?.scaleBy&&n.scaleBy(Rr(t),1.5)},style:Mi,children:"+"}),Li("button",{type:"button","aria-label":"Zoom out",onClick:e=>{e.stopPropagation();const t=ft.current,n=ct.current;t&&n?.scaleBy&&n.scaleBy(Rr(t),1/1.5)},style:Mi,children:"−"})]}),O&&Li("div",{className:"stream-geo-tile-attribution",style:{position:"absolute",bottom:Te.bottom+2,right:Te.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:O}),Li(pr,{active:Qt.current>=0,hoverPoint:Dt,margin:Te,size:Oe,shape:Kt.current?.shape,width:Kt.current?.w,height:Kt.current?.h,pathData:Kt.current?.pathData}),rn]})]})}));Pi.displayName="StreamGeoFrame";var Ii=Pi;import{useMemo as Di}from"react";function zi(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}import{useMemo as Ri,useCallback as Oi,useState as Ti,useId as Ni,useEffect as $i,useRef as Wi}from"react";import{createContext as _i,useContext as Ei,useMemo as Bi}from"react";import{jsx as Hi}from"react/jsx-runtime";var Fi=_i(null);function Gi(){return Ei(Fi)}import{createContext as qi,useContext as Vi,useEffect as Zi,useId as Ui,useLayoutEffect as Yi,useMemo as Xi,useRef as Qi,useState as Ki,useCallback as Ji}from"react";function ea(e){const t=[];for(const[n,o]of Object.entries(e.fields))if("point"===o.type)t.push(e=>o.values.has(e[n]));else{const[e,r]=o.range;t.push(t=>{const o=t[n];return o>=e&&r>=o})}return e=>t.every(t=>t(e))}function ta(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}function na(e,t){if(e.type!==t.type)return!1;if("interval"===e.type&&"interval"===t.type)return e.range[0]===t.range[0]&&e.range[1]===t.range[1];if("point"===e.type&&"point"===t.type){if(e.values.size!==t.values.size)return!1;for(const n of e.values)if(!t.values.has(n))return!1;return!0}return!1}var[oa,ra]=He(e=>({selections:new Map,setClause(t,n){e(e=>{const o=e.selections.get(t),r=o?.clauses.get(n.clientId);if(r&&function(e,t){if(e.clientId!==t.clientId||e.type!==t.type)return!1;const n=Object.entries(e.fields);if(n.length!==function(e){let t=0;for(const n in e)t++;return t}(t.fields))return!1;for(const[e,o]of n){const n=t.fields[e];if(!n||!na(o,n))return!1}return!0}(r,n))return{};const i=new Map(e.selections),a=ta(i,t),s=new Map(a.clauses);return s.set(n.clientId,n),i.set(t,{...a,clauses:s}),{selections:i}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o||!o.clauses.has(n))return{};const r=new Map(e.selections),i=new Map(o.clauses);return i.delete(n),r.set(t,{...o,clauses:i}),{selections:r}})},setResolution(t,n){e(e=>{const o=e.selections.get(t);if(o?.resolution===n)return{};const r=new Map(e.selections),i=ta(r,t);return r.set(t,{...i,resolution:n}),{selections:r}})},clearSelection(t){e(e=>{const n=e.selections.get(t);if(!n||0===n.clauses.size)return{};const o=new Map(e.selections);return o.set(t,{...n,clauses:new Map}),{selections:o}})}})),[ia,aa]=He(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const n=e.observations;return n.push(t),n.length>e.maxObservations&&n.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));import{useId as sa,useMemo as la,useCallback as ca}from"react";function ua(e){const t=sa(),n=e.clientId||t,{name:o}=e,r=ra(e=>e.selections.get(o)),i=ra(e=>e.setClause),a=ra(e=>e.clearClause),s=la(()=>!!r&&r.clauses.size>0,[r]);return{predicate:la(()=>r&&0!==r.clauses.size?function(e,t){const n=[];for(const[o,r]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(ea(r));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(r,n):()=>!0,[r,n]),isActive:s,selectPoints:ca(e=>{const t={};let r=!1;for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)},r=!0;r&&i(o,{clientId:n,type:"point",fields:t})},[n,o,i]),selectInterval:ca(e=>{const t={};let r=!1;for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o},r=!0;r&&i(o,{clientId:n,type:"interval",fields:t})},[n,o,i]),clear:ca(()=>{a(o,n)},[a,o,n]),clientId:n}}function ha(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:r,selectPoints:i,clear:a}=ua({name:t,fields:n});return{onHover:ca(e=>{if(!e)return void a();const t={};for(const o of n){const n=e[o];void 0!==n&&(t[o]=[n])}(function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1})(t)&&i(t)},[n,i,a,t]),predicate:o,isActive:r}}import{jsx as da,jsxs as fa}from"react/jsx-runtime";var pa=qi(!1);qi(!1);var ma=qi(null),ya="undefined"==typeof window?Zi:Yi;function ga(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 ba(e,t,n){return t?(o,...r)=>{const i={...e(o,...r)};if(t.isActive)if(t.predicate(o))n?.selectedStyle&&Object.assign(i,n.selectedStyle);else{const e=n?.unselectedOpacity??.5;i.opacity=e,i.fillOpacity=e,i.strokeOpacity=e,n?.unselectedStyle&&Object.assign(i,n.unselectedStyle)}return i}:e}import*as va from"react";import{jsx as xa,jsxs as wa}from"react/jsx-runtime";function ka(){return Ke(e=>e.theme)}function Sa(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function Ma(e,t){const{when:n}=e,o=t.width,r=t.height,i=function(e){if("number"==typeof e.height&&e.height>0)return e.width/e.height}(t),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>o||"number"==typeof n.maxWidth&&o>n.maxWidth||"number"==typeof n.minHeight&&("number"!=typeof r||n.minHeight>r)||"number"==typeof n.maxHeight&&("number"!=typeof r||r>n.maxHeight)||"number"==typeof n.minAspectRatio&&("number"!=typeof i||n.minAspectRatio>i)||"number"==typeof n.maxAspectRatio&&("number"!=typeof i||i>n.maxAspectRatio)||n.orientation&&a!==n.orientation)}function Aa(e,t,n=e.responsiveRules){if(!Array.isArray(n)||0===n.length)return{props:e,matches:[]};const o=n.map((e,t)=>({rule:e,index:t})).filter(e=>Ma(e.rule,t)).sort((e,t)=>("number"==typeof e.rule.priority?e.rule.priority:e.index)-("number"==typeof t.rule.priority?t.rule.priority:t.index));return{props:o.reduce((e,t)=>function(e,t){const n={...e,...t};for(const o of["margin","frameProps","mobileSemantics","style"])Sa(e[o])&&Sa(t[o])&&(n[o]={...e[o],...t[o]});return"string"==typeof e.className&&"string"==typeof t.className&&(n.className=`${e.className} ${t.className}`),n}(e,t.rule.transform),e),matches:o}}va.createContext(void 0);var Ca="#007bff";function La(e,t,n){const o=e.xValue??t?.[n];if(null==o)return null;const r=Number(o);return Number.isFinite(r)?r:null}function ja(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 Pa(e){if(!e)return!1;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}var Ia={enabled:!0,tapToSelect:!0,tapToLockTooltip:!0,clearSelection:"backgroundTap",targetSize:44,snap:"nearestDatum",brushHandleSize:44,standardControls:!1,enabled:!1,tapToSelect:!1,tapToLockTooltip:!1};function Da(e,t={}){const n=t.mobileSemantics?.interaction,o="number"==typeof n?.targetSize?n.targetSize:"number"==typeof t.mobileSemantics?.minimumHitTarget?t.mobileSemantics.minimumHitTarget:void 0,r="mobile"===t.mode||"number"==typeof t.width&&480>=t.width,i=!!n||void 0!==o,a=e&&"object"==typeof e?e:void 0;if(!1===e||!1===a?.enabled||void 0===e&&!r&&!i)return Ia;const s=a??{};return{enabled:!0,tapToSelect:s.tapToSelect??!0,tapToLockTooltip:s.tapToLockTooltip??!0,clearSelection:s.clearSelection??"backgroundTap",targetSize:s.targetSize??o??44,snap:s.snap??"nearestDatum",brushHandleSize:s.brushHandleSize??44,standardControls:s.standardControls??!1}}function za(){const e=ka(),t=e?.colors?.categorical;return t&&t.length>0?t:void 0}function Ra({selection:e,linkedHover:t,fallbackFields:n=[],unwrapData:o=!1,onObservation:r,chartType:i,chartId:a,onClick:s,hoverHighlight:l,colorByField:c,mobileInteraction:u}){const h=Ni(),d=ga(t,n),f="series"===d?.mode?[d.seriesField||c||n[0]].filter(e=>!!e):d?.fields||n||[],p=ua({name:e?.name||"__unused__",fields:f}),m=ha({name:d?.name||"hover",fields:f}),y=aa(e=>e.pushObservation),g=e?{isActive:p.isActive,predicate:p.predicate}:null,[b,v]=Ti(null),x=Wi(!1),w=c||n[0],k=Ri(()=>{if(!l||null==b||!w)return null;const e=b,t=w;return{isActive:!0,predicate:n=>("string"==typeof n[t]?n[t]:(n[t]??"")+"")===e}},[l,b,w]),S=Oi(e=>{const n=!e&&x.current&&!!u?.enabled&&u.tapToLockTooltip;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===d?.mode&&d.xField){const n=La(e,t,d.xField);null!=n&&function(e,t,n){const o=Yn.positions.get(e);o?.locked||o&&o.xValue===t&&o.sourceId===n||(Yn={positions:new Map(Yn.positions).set(e,{xValue:t,sourceId:n})},Qn())}(d.name||"hover",n,h)}"x-position"!==d?.mode&&m.onHover(t)}else"x-position"!==d?.mode||n||Kn(d.name||"hover",h),"x-position"===d?.mode||n||m.onHover(null);if(l&&w)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=t?.[w];v(null!=n?n+"":null)}else n||v(null);if(r||y){const t={timestamp:Date.now(),chartType:i||"unknown",chartId:a};if(e){const n=ja(e),o={...t,type:"hover",datum:n||{},x:e.x??0,y:e.y??0};r&&r(o),y&&y(o)}else{const e={...t,type:"hover-end"};r&&r(e),y&&y(e)}}},[t,m,d,h,r,i,a,y,l,w,u]),M=Oi((n=!0)=>{x.current=!1,t&&"x-position"!==d?.mode&&m.onHover(null),e&&u?.tapToSelect&&p.clear(),n&&l&&v(null),"x-position"===d?.mode&&(Jn(d.name||"hover",h),Kn(d.name||"hover",h))},[t,d,m,e,u,p,l,h]),A=Oi(n=>{const o=!!u?.enabled&&(u.tapToLockTooltip||u.tapToSelect),c=!!u?.enabled&&"backgroundTap"===u.clearSelection;if("x-position"===d?.mode&&d.xField&&n){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]);const t=La(n,e,d.xField);null!=t&&function(e,t,n){const o=Yn.positions.get(e);if(o?.locked){const t=new Map(Yn.positions);return t.delete(e),Yn={positions:t},Qn(),!1}Yn={positions:new Map(Yn.positions).set(e,{xValue:t,sourceId:n,locked:!0})},Qn()}(d.name||"hover",t,h)}if(o)if(n){x.current=!0;const o=ja(n);if(t&&"x-position"!==d?.mode&&m.onHover(o),e&&u?.tapToSelect&&f.length>0){const e={};for(const t of f){const n=o[t];void 0!==n&&(e[t]=[n])}Pa(e)&&p.selectPoints(e)}if(l&&w){const e=o?.[w];v(null!=e?e+"":null)}}else c&&M();if(n||c){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})}if(r||y){const e={timestamp:Date.now(),chartType:i||"unknown",chartId:a};if(n){const t=ja(n),o={...e,type:"click",datum:t||{},x:n.x??0,y:n.y??0};r&&r(o),y&&y(o)}else{const t={...e,type:"click-end"};r&&r(t),y&&y(t)}}}},[s,r,y,i,a,d,h,u,t,m,e,p,f,l,w,M]);return $i(()=>{if(!u?.enabled||"undefined"==typeof document)return;const e=e=>{"Escape"===e.key&&x.current&&M()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[u?.enabled,M]),$i(()=>()=>{x.current&&M(!1)},[M]),$i(()=>{if("x-position"!==d?.mode)return;const e=d.name||"hover";return()=>{Jn(e,h),Kn(e,h)}},[d?.mode,d?.name,h]),{activeSelectionHook:g,hoverSelectionHook:k,customHoverBehavior:S,customClickBehavior:A,crosshairSourceId:h}}function Oa({data:e,colorBy:t,colorScale:n,showLegend:o,legendPosition:r="right",userMargin:i,defaults:a={top:50,bottom:60,left:70,right:40},categories:s}){const l=Vi(pa),c=null!==Vi(ma),u=void 0!==o?o:!l&&!!t,h=!!t&&(u||c),d=Ri(()=>{if(!h)return[];if(void 0!==s)return s;const n=new Set;for(const o of e){const e="function"==typeof t?t(o):o[t];null!=e&&n.add(e+"")}return Array.from(n)},[s,t,e,h]);!function(e){const t=Vi(ma),n=Ui(),o=function(e){const t=new Set,n=[];for(const o of e)t.has(o)||(t.add(o),n.push(o));return n}(e),r=Qi([]);(function(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0})(r.current,o)||(r.current=o);const i=r.current;ya(()=>{if(t)return()=>t.unregisterCategories(n)},[t,n]),ya(()=>{t&&t.registerCategories(n,i)},[t,n,i])}(c&&t?d:[]);const f=Ri(()=>{if(!u||!t)return;const o=function({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:r,strokeWidth:i,categories:a}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==r&&(n.stroke=r),void 0!==i&&(n.strokeWidth=i),n},type:"fill",items:(a&&a.length>0?a:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((r,i)=>{const a=e.find("function"==typeof t?e=>t(e)===r:e=>e[t]===r),s=a?o(a,t,n):n?n(r):_[i%_.length];return{label:r+"",color:s}}),label:""}]}}({data:e,colorBy:t,colorScale:n,getColor:B,categories:d});return 0!==o.legendGroups.reduce((e,t)=>e+t.items.length,0)?o:void 0},[u,t,e,n,d]),p=Ri(()=>{const e="number"==typeof i?{top:i,bottom:i,left:i,right:i}:i??{},t=t=>{const n=e[t];return"number"==typeof n?n:a[t]},n={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},o=t=>"number"==typeof e[t];return f&&("right"===r&&!o("right")&&110>n.right?n.right=110:"left"===r&&!o("left")&&110>n.left?n.left=110:"top"===r&&!o("top")&&50>n.top?n.top=50:"bottom"===r&&!o("bottom")&&80>n.bottom&&(n.bottom=80)),n},[a,i,f,r]);return{legend:f,margin:p,legendPosition:r}}var Ta={primary:{width:600,height:400,showAxes:!0,showGrid:!1,enableHover:!0,showLegend:void 0,showLabels:void 0,marginDefaults:{top:50,bottom:60,left:70,right:40}},context:{width:400,height:250,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:10,bottom:10,left:10,right:10}},sparkline:{width:120,height:24,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:2,bottom:2,left:0,right:0}},mobile:{width:390,height:300,showAxes:!0,showGrid:!1,enableHover:!0,showLegend:!1,showLabels:!0,marginDefaults:{top:28,bottom:42,left:44,right:16}}};function Na(e,t,n){const o=Ta[e||"primary"],r=e&&"primary"!==e||!n?.width?o.width:n.width,i=e&&"primary"!==e||!n?.height?o.height:n.height,a=Aa({...t,mode:e},{width:t.width??r,height:t.height??i}).props,s=a.mode||e,l=Ta[s||"primary"],c="context"===s||"sparkline"===s,u=s&&"primary"!==s||!n?.width?l.width:n.width;return{width:a.width??u,height:a.height??(s&&"primary"!==s||!n?.height?l.height:n.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:$a(l.marginDefaults,a.showCategoryTicks,a.orientation),compactMode:c,mobileInteraction:Da(a.mobileInteraction,{mode:s,width:a.width??u,mobileSemantics:a.mobileSemantics}),mobileSemantics:a.mobileSemantics}}function $a(e,t,n){if(!1!==t)return e;const o={...e};return"horizontal"===n?o.left=Math.min(o.left,15):o.bottom=Math.min(o.bottom,15),o}function Wa(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return 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})}import{jsx as _a,jsxs as Ea}from"react/jsx-runtime";function Ba({componentName:e,message:t,diagnosticHint:n,width:o,height:r}){return _a("div",{role:"alert",style:{width:o,height:Math.max(r,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:Ea("div",{style:{textAlign:"center",maxWidth:400},children:[_a("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:e}),_a("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:t}),n&&_a("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:n})]})})}import*as Ha from"react";import{jsx as Fa}from"react/jsx-runtime";var Ga=class extends Ha.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:Fa(Ba,{componentName:"ChartErrorBoundary",message:t.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}};import{jsx as qa}from"react/jsx-runtime";var Va="undefined"!=typeof process&&"production"!==process.env?.NODE_ENV;function Za({componentName:e,width:t,height:n,children:o}){return qa(Ga,{fallback:o=>qa(Ba,{componentName:e,message:o.message,width:t,height:n}),children:o})}var Ua={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"},Ya={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Xa(e,t,n,o){return!1===o||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?qa("div",{style:{...Ua,width:t,height:n},children:o||"No data available"}):null}function Qa(e,t,n,o){if(!e)return null;if(!1===o)return null;if(null!=o)return qa("div",{style:{width:t,height:n,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:o});const r=Math.min(5,Math.floor(n/40)),i=Math.max(8,Math.floor(n/(3*r))),a=Math.max(6,Math.floor(n/(2.5*r))),s=Math.floor((n-(r*(i+a)-a))/2);return qa("div",{style:{width:t,height:n,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:r},(e,n)=>qa("div",{className:"semiotic-loading-bar",style:{...Ya,position:"absolute",top:s+n*(i+a),left:Math.floor(.1*t),width:30+(37*n+13)%50+"%",height:i,opacity:.5+n%2*.2}},n))})}function Ka(e,t,n,o){if(!Va)return;if(!t||0===t.length)return;if("string"!=typeof o)return;const r=t[0];if(!r||"object"!=typeof r)return;if(o in r)return;const i=Object.keys(r).join(", ");console.warn(`[semiotic] ${e}: ${n} "${o}" not found in data. Available keys: ${i}`)}import{useMemo as Ja}from"react";function es(e){const t=Ke(e=>e.theme.colors.selectionOpacity);return Ja(()=>{if(void 0!==e||void 0!==t)return{name:e?.name??"",...e,unselectedOpacity:e?.unselectedOpacity??t}},[e,t])}import{scaleSequential as ts}from"d3-scale";import{useState as ns,useEffect as os,useMemo as rs}from"react";import{feature as is}from"topojson-client";var as=new Map;function ss(e){return e.default??e}async function ls(e){const t=as.get(e);if(t)return t;const{topology:n,objectName:o}=await async function(e){try{switch(e){case"world-110m":return{topology:ss(await import("world-atlas/countries-110m.json")),objectName:"countries"};case"world-50m":return{topology:ss(await import("world-atlas/countries-50m.json")),objectName:"countries"};case"land-110m":return{topology:ss(await import("world-atlas/land-110m.json")),objectName:"land"};case"land-50m":return{topology:ss(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}"): Install the optional peer dependency \`world-atlas\` (\`npm install world-atlas\`) to use built-in reference geographies, or pass GeoJSON Feature[] to \`areas\`.`,{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 r=is(n,n.objects[o]),i="features"in r?r.features:[r];return as.set(e,i),i}function cs(e){const t=rs(()=>Array.isArray(e)?e:void 0,[e]),[n,o]=ns(null);return os(()=>{if(e&&!Array.isArray(e)){if("string"==typeof(t=e)&&["world-110m","world-50m","land-110m","land-50m"].includes(t)){let t=!1;return o(null),ls(e).then(e=>{t||o(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".`),o(null)}else o(null)},[e]),void 0!==t?t:n}function us(e){const{title:t,description:n,summary:o,accessibleTable:r,className:i,animate:a,axisExtent:s,autoPlaceAnnotations:l}=e,c={};return t&&(c.title=t),n&&(c.description=n),o&&(c.summary=o),void 0!==r&&(c.accessibleTable=r),i&&(c.className=i),null!=a&&(c.animate=a),void 0!==s&&(c.axisExtent=s),void 0!==l&&(c.autoPlaceAnnotations=l),c}function hs(e){const{linkedHover:t,selection:n,onObservation:o,onClick:r,hoverRadius:i,hoverHighlight:a,forceHoverBehavior:s,forceClickBehavior:l,mobileInteraction:c,customHoverBehavior:u,customClickBehavior:h,linkedHoverInClickPredicate:d=!0}=e,f={},p=c?.enabled?Math.max(i??30,Math.ceil((c.targetSize||44)/2),24):i;return(s||t||o||r||a)&&(f.customHoverBehavior=u),h&&(l||(d?o||r||t:o||r)||c?.enabled&&(c.tapToSelect||c.tapToLockTooltip)&&(t||a||n))&&(f.customClickBehavior=h),null!=p&&(f.hoverRadius=p),f}import{jsx as ds,jsxs as fs}from"react/jsx-runtime";function ps(e){const t=Na(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,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=ka();return e?.colors?.sequential||void 0}(),{areas:o,valueAccessor:r,colorScheme:i,projection:a="equalEarth",graticule:s,fitPadding:l,zoomable:c,zoomExtent:u,onZoom:h,dragRotate:d,tileURL:f,tileAttribution:p,tileCacheSize:m,tooltip:y,areaOpacity:g=1,annotations:b,margin:v,className:x,selection:w,linkedHover:k,onObservation:S,onClick:M,chartId:A,loading:C,loadingContent:L,emptyContent:j,frameProps:P={},stroke:I,strokeWidth:D,opacity:z}=e,R=c??!!f,O=cs(o),T=Di(()=>O?hr(O):O,[O]),$=Di(()=>"function"==typeof r?r:e=>e?.properties?.[r]??e?.[r],[r]),W=i??n??"blues",_=Di(()=>{if(!T)return ts(N(void 0)).domain([0,1]);let e=1/0,t=-1/0;for(const n of T){const o=$(n);null!=o&&isFinite(o)&&(e>o&&(e=o),o>t&&(t=o))}const n=N(W);return ts(n).domain([Number.isFinite(e)?e:0,Number.isFinite(t)?t:1])},[T,$,W]),{activeSelectionHook:E,customHoverBehavior:B,customClickBehavior:H}=Ra({selection:w,linkedHover:k,onObservation:S,onClick:M,chartType:"ChoroplethMap",chartId:A,mobileInteraction:t.mobileInteraction}),F=es(w),G=Di(()=>{const e=Wa(e=>{const t=$(e);return{fill:null!=t&&isFinite(t)?_(t):"#ccc",stroke:"#999",strokeWidth:.5,fillOpacity:g}},{stroke:I,strokeWidth:D,opacity:z});return E?ba(e,E,F):e},[$,_,E,F,g,I,D,z]),q=Di(()=>e=>{const t=e?.properties?.name||e?.properties?.NAME||e?.name||e?.NAME||"Feature",n=$(e);return fs("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[ds("div",{style:{fontWeight:600},children:t}),null!=n&&ds("div",{style:{opacity:.7},children:(o=n,"number"==typeof o&&isFinite(o)?Number.isInteger(o)?o.toLocaleString():o.toLocaleString(void 0,{maximumFractionDigits:2}):(o??"")+"")})]});var o},[$]),V=Di(()=>({top:10,right:10,bottom:10,left:10,...zi(v)}),[v]),Z=Qa(C,t.width,t.height,L)||(T?null:Qa(!0,t.width,t.height,L)),U=Z?null:Xa(T,t.width,t.height,j);if(Array.isArray(T)&&T.length>0){const e=T[0];if(!e||"object"!=typeof e||!e.geometry)return ds(Ba,{componentName:"ChoroplethMap",message:"ChoroplethMap: areas must be an array of GeoJSON Features with a geometry property.",width:t.width,height:t.height})}const Y={projection:a,areas:T,areaStyle:G,size:[t.width,t.height],margin:V,enableHover:!0,tooltipContent:!1===y?()=>null:!0===y?q:jr(y)||q,...null!=s&&{graticule:s},...null!=l&&{fitPadding:l},...R&&{zoomable:!0},...u&&{zoomExtent:u},...h&&{onZoom:h},...null!=d&&{dragRotate:d},...f&&{tileURL:f},...p&&{tileAttribution:p},...m&&{tileCacheSize:m},...hs({linkedHover:k,selection:w,onObservation:S,onClick:M,mobileInteraction:t.mobileInteraction,customHoverBehavior:B,customClickBehavior:H,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},...x&&{className:x},...null!=e.animate&&{animate:e.animate},...P};return Z||U||ds(Za,{componentName:"ChoroplethMap",width:t.width,height:t.height,children:ds(Ii,{...Y})})}ps.displayName="ChoroplethMap";import{useMemo as ms,useRef as ys,forwardRef as gs}from"react";import{useCallback as bs,useMemo as vs,useState as xs}from"react";function ws(e){const{data:t,rawData:n,colorBy:o,colorScheme:r,legendInteraction:i,legendPosition:a,selection:s,linkedHover:l,fallbackFields:c,unwrapData:u=!1,onObservation:h,chartType:d,chartId:f,showLegend:p,userMargin:m,marginDefaults:y,onClick:g,hoverHighlight:b,mobileInteraction:v,mobileSemantics:x,loading:w,loadingContent:k,emptyContent:S,width:M,height:A}=e,C=void 0===n,L=vs(()=>hr(t),[t]),[j,P]=xs([]),I=bs(e=>{P(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[]),D="string"==typeof e.colorBy?e.colorBy:void 0,z=vs(()=>Da(v,{width:M,mobileSemantics:x}),[v,M,x]),{activeSelectionHook:R,hoverSelectionHook:O,customHoverBehavior:T,customClickBehavior:N,crosshairSourceId:$}=Ra({selection:s,linkedHover:l,fallbackFields:c,unwrapData:u,onObservation:h,chartType:d,chartId:f,onClick:g,hoverHighlight:b,colorByField:D,mobileInteraction:z}),W=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,$),E=function(e,t,n){const o=Gi(),r=za();return Ri(()=>{if(!t)return;const i=o??void 0,a=n??(r&&r.length>0?r:void 0)??"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>t(e)+"")));if(i&&Pa(i)){const e=F(n.map(e=>({_cat:e})),"_cat",a);return t=>i[t]||e(t)}return F(n.map(e=>({_cat:e})),"_cat",a)}if(i&&Pa(i)){const n=F(e,t,a);return e=>i[e]||n(e)}return F(e,t,a)}if(i&&Pa(i)){const e=F([{_:"a"}],"_",a);return t=>i[t]||e(t)}},[e,t,n,o,r])}(L,o,r),B=vs(()=>{if(!o)return[];const e=new Set;for(const t of L){const n="function"==typeof o?o(t):t[o];null!=n&&e.add(n+"")}return Array.from(e)},[L,o]),H=vs(()=>C&&j.length>0?j:B,[C,j,B]),G=function(e,t,n){const[o,r]=Ti(null),[i,a]=Ti(new Set),s=Ri(()=>new Set,[]),l=Oi(t=>{"highlight"===e&&r(t?t.label:null)},[e]),c=Oi(t=>{"isolate"===e&&a(e=>{const o=new Set(e);return o.has(t.label)?o.delete(t.label):o.add(t.label),o.size===n.length?new Set:o})},[e,n.length]),u=Ri(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=o?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===o}:"isolate"===e&&i.size>0?{isActive:!0,predicate:e=>{const o=n?e[n]:"function"==typeof t?t(e):null;return i.has(o)}}:null},[e,t,o,i]);return{highlightedCategory:"highlight"===e?o:null,isolatedCategories:"isolate"===e?i:s,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}(i,o,H),q=vs(()=>O||(G.legendSelectionHook?G.legendSelectionHook:R),[O,G.legendSelectionHook,R]),V=es(s),Z=za(),U=Gi(),Y=vs(()=>{if(E)return E;if(!o||0===H.length)return;const e=Array.isArray(r)&&r.length>0||"string"==typeof r&&r.length>0?r:Z&&Z.length>0?Z:_,t="__streamCat",n=F(H.map(e=>({[t]:e})),t,e);return e=>U?.[e]||n(e)||"#999"},[E,o,H,r,Z,U]),{legend:X,margin:Q,legendPosition:K}=Oa({data:L,colorBy:o,colorScale:Y,showLegend:p,legendPosition:a,userMargin:m,defaults:y,categories:H}),J=vs(()=>{const e={};return X&&(e.legend=X,e.legendPosition=K),i&&"none"!==i&&(e.legendHoverBehavior=G.onLegendHover,e.legendClickBehavior=G.onLegendClick,e.legendHighlightedCategory=G.highlightedCategory,e.legendIsolatedCategories=G.isolatedCategories),C&&o&&(e.legendCategoryAccessor=o,e.onCategoriesChange=I),e},[X,K,i,G.onLegendHover,G.onLegendClick,G.highlightedCategory,G.isolatedCategories,C,o,I]),ee=Array.isArray(n)?hr(n):n,te=Qa(w,M,A,k),ne=te?null:Xa(ee,M,A,S);return{data:L,colorScale:E,allCategories:H,legendState:G,effectiveSelectionHook:q,activeSelectionHook:R,customHoverBehavior:T,customClickBehavior:N,mobileInteraction:z,legend:X,margin:Q,legendPosition:K,earlyReturn:te||ne||null,legendBehaviorProps:J,crosshairProps:W,resolvedSelection:V}}import{useImperativeHandle as ks}from"react";function Ss(e,t){const{variant:n,frameRef:o,overrides:r,deps:i}=t;ks(e,()=>{const e=function(e,t){if("xy"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>e.current?.remove(t)??[],update:(t,n)=>e.current?.update(t,n)??[],clear:()=>e.current?.clear(),getData:()=>e.current?.getData()??[],getScales:()=>e.current?.getScales()??null,getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}if("network"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>{const n=Array.isArray(t)?t:[t],o=e.current?.getTopology()?.nodes??[],r=[];for(const t of n){const n=o.find(e=>e.id===t);n&&r.push({...n.data??{},id:t}),e.current?.removeNode(t)}return r},update:(t,n)=>(Array.isArray(t)?t:[t]).flatMap(t=>{const o=e.current?.updateNode(t,n);return o?[{...o,id:t}]:[]}),clear:()=>e.current?.clear(),getData:()=>e.current?.getTopology()?.nodes?.map(e=>e.data)??[],getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}if("geo-points"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>e.current?.removePoint(t)??[],update:(t,n)=>{const o=e.current?.removePoint(t)??[];for(const t of o)e.current?.push(n(t));return o},clear:()=>e.current?.clear(),getData:()=>e.current?.getData()??[],getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}const n=t;return{push:e=>n.current?.pushLine(e),pushMany:e=>n.current?.pushManyLines(e),remove:e=>n.current?.removeLine(e)??[],update:(e,t)=>{const o=n.current?.removeLine(e)??[];for(const e of o)n.current?.pushLine(t(e));return o},clear:()=>n.current?.clear(),getData:()=>n.current?.getLines()??[],getCustomLayout:()=>n.current?.getCustomLayout?.()??null,getLayoutFailure:()=>n.current?.getLayoutFailure?.()??null}}(n,o);return{...e,...r}},i??[])}import{jsx as Ms,jsxs as As}from"react/jsx-runtime";var Cs=gs(function(e,t){const n=ys(null);Ss(t,{variant:"geo-points",frameRef:n});const o=Na(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{points:r,xAccessor:i="lon",yAccessor:a="lat",sizeBy:s,sizeRange:l=[3,30],colorBy:c,colorScheme:u,projection:h="equalEarth",graticule:d,fitPadding:f,zoomable:p,zoomExtent:m,onZoom:y,dragRotate:g,tileURL:b,tileAttribution:v,tileCacheSize:x,areas:w,areaStyle:k={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},tooltip:S,annotations:M,margin:A,className:C,selection:L,linkedHover:j,onObservation:P,onClick:I,chartId:D,loading:z,loadingContent:R,emptyContent:O,legendInteraction:T,legendPosition:N,frameProps:$={},stroke:W,strokeWidth:_,opacity:E}=e,H=p??!!b,F=cs(w),q=ws({data:r??ur,rawData:r,colorBy:c,colorScheme:u,legendInteraction:T,legendPosition:N,selection:L,linkedHover:j,fallbackFields:c?["string"==typeof c?c:""]:[],unwrapData:!1,onObservation:P,onClick:I,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"ProportionalSymbolMap",chartId:D,showLegend:o.showLegend,userMargin:A,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:z,loadingContent:R,emptyContent:O,width:o.width,height:o.height}),V=q.data,Z=ms(()=>{if(!s)return;const e="function"==typeof s?s:e=>e?.[s],t=V.filter(Boolean).map(t=>e(t)).filter(e=>null!=e&&isFinite(e));return 0!==t.length?ce(t):void 0},[V,s]),U=ms(()=>{const e=Wa(e=>({fill:c?B(e,c,q.colorScale):Ca,fillOpacity:.7,stroke:"#fff",strokeWidth:.5,r:s?G(e,s,l,Z):6}),{stroke:W,strokeWidth:_,opacity:E});return q.effectiveSelectionHook?ba(e,q.effectiveSelectionHook,q.resolvedSelection):e},[c,q.colorScale,q.effectiveSelectionHook,q.resolvedSelection,s,l,Z,W,_,E]),Y=ms(()=>e=>{const t=e?.name||e?.label||e?.NAME||e?.id,n="string"==typeof s?s:null,o=("function"==typeof s?s:e=>e[s])(e),r=e=>"number"==typeof e&&isFinite(e)?Number.isInteger(e)?e.toLocaleString():e.toLocaleString(void 0,{maximumFractionDigits:2}):(e??"")+"",i="string"==typeof c?c:null,a=i?e?.[i]:null;return As("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[t&&Ms("div",{style:{fontWeight:600,marginBottom:2},children:t}),n&&null!=o&&As("div",{children:[As("span",{style:{opacity:.7},children:[n,": "]}),r(o)]}),i&&null!=a&&As("div",{children:[As("span",{style:{opacity:.7},children:[i,": "]}),a+""]}),!t&&!n&&Object.entries(e).filter(([e])=>"data"!==e&&"x"!==e&&"y"!==e&&"time"!==e).slice(0,4).map(([e,t])=>As("div",{children:[As("span",{style:{opacity:.7},children:[e,": "]}),r(t)]},e))]})},[s,c]);if(q.earlyReturn)return q.earlyReturn;Ka("ProportionalSymbolMap",V,"xAccessor",i),Ka("ProportionalSymbolMap",V,"yAccessor",a);const X={projection:h,...null!=r&&{points:V},xAccessor:i,yAccessor:a,pointStyle:U,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...F&&{areas:F,areaStyle:k},...null!=d&&{graticule:d},...null!=f&&{fitPadding:f},...H&&{zoomable:!0},...m&&{zoomExtent:m},...y&&{onZoom:y},...null!=g&&{dragRotate:g},...b&&{tileURL:b},...v&&{tileAttribution:v},...x&&{tileCacheSize:x},size:[o.width,o.height],margin:q.margin,enableHover:!0,tooltipContent:!1===S?()=>null:jr(S)||Y,...q.legendBehaviorProps,...hs({linkedHover:j,selection:L,onObservation:P,onClick:I,mobileInteraction:q.mobileInteraction,customHoverBehavior:q.customHoverBehavior,customClickBehavior:q.customClickBehavior,linkedHoverInClickPredicate:!1}),...M&&M.length>0&&{annotations:M},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...o.title&&{title:o.title},...o.description&&{description:o.description},...o.summary&&{summary:o.summary},...void 0!==o.accessibleTable&&{accessibleTable:o.accessibleTable},...C&&{className:C},...null!=e.animate&&{animate:e.animate},...$};return Ms(Za,{componentName:"ProportionalSymbolMap",width:o.width,height:o.height,children:Ms(Ii,{ref:n,...X})})});Cs.displayName="ProportionalSymbolMap";import{useMemo as Ls,useCallback as js,useRef as Ps,forwardRef as Is}from"react";import{scaleLinear as Ds}from"d3-scale";import{jsx as zs,jsxs as Rs}from"react/jsx-runtime";var Os="__semiotic_x",Ts="__semiotic_y",Ns=Is(function(e,t){const n=Na(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{flows:o,nodes:r,nodeIdAccessor:i="id",xAccessor:a="lon",yAccessor:s="lat",valueAccessor:l="value",projection:c="equalEarth",graticule:u,fitPadding:h,zoomable:d,zoomExtent:f,onZoom:p,dragRotate:m,tileURL:y,tileAttribution:g,tileCacheSize:b,lineType:v="geo",flowStyle:x="basic",areas:w,areaStyle:k={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},edgeColorBy:S,edgeOpacity:M=.6,edgeWidthRange:A=[1,8],edgeLinecap:C="round",colorScheme:L,showParticles:j,particleStyle:P,tooltip:I,annotations:D,margin:z,className:R,selection:O,linkedHover:T,onObservation:N,onClick:$,chartId:W,loading:_,loadingContent:E,emptyContent:H,frameProps:F={},legendInteraction:G,legendPosition:q,stroke:V,strokeWidth:Z,opacity:U,lineIdAccessor:Y}=e,X=d??!!y,Q=cs(w),K=Ls(()=>hr(r),[r]),J=ws({data:o??ur,rawData:o,colorBy:S,colorScheme:L,legendInteraction:G,legendPosition:q,selection:O,linkedHover:T,fallbackFields:S?["string"==typeof S?S:""]:[],unwrapData:!1,onObservation:N,onClick:$,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"FlowMap",chartId:W,showLegend:n.showLegend,userMargin:z,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:_,loadingContent:E,emptyContent:H,width:n.width,height:n.height}),ee=J.data,te=ga(T),ne=ha({name:te?.name||"hover",fields:te?.fields||[]}),oe=aa(e=>e.pushObservation),re=Ls(()=>{const e=new Map;for(const t of K)e.set(t[i]+"",t);return e},[K,i]),ie=Ps(null),ae=Ps(re);ae.current=re;const se=Ps(a);se.current=a;const le=Ps(s);le.current=s;const ue=js(e=>{if(!e||"object"!=typeof e||null==e.source||null==e.target)return null;const t=ae.current,n=t.get(e.source+""),o=t.get(e.target+"");if(!n||!o)return null;const r="function"==typeof se.current?se.current:e=>e[se.current],i="function"==typeof le.current?le.current:e=>e[le.current];return{...e,coordinates:[{[Os]:r(n),[Ts]:i(n)},{[Os]:r(o),[Ts]:i(o)}]}},[]);Ss(t,{variant:"geo-lines",frameRef:ie,overrides:{push:e=>{const t=ue(e);t&&ie.current?.pushLine(t)},pushMany:e=>{const t=[];for(const n of e){const e=ue(n);e&&t.push(e)}t.length>0&&ie.current?.pushManyLines(t)}}});const he=Ls(()=>{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=js(e=>{if(T)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"point"===e.type){const e=he.get(t[i]+"");e&&ne.onHover(e)}else ne.onHover(t)}else ne.onHover(null);if(N||oe){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 o={...t,type:"hover",datum:n||{},x:e.x??0,y:e.y??0};N&&N(o),oe&&oe(o)}else{const e={...t,type:"hover-end"};N&&N(e),oe&&oe(e)}}},[T,ne,i,he,N,W,oe]),fe=J.customClickBehavior,pe=Ls(()=>{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 o=re.get(n.source+""),r=re.get(n.target+"");return o&&r?{...n,coordinates:[{[Os]:e(o),[Ts]:t(o)},{[Os]:e(r),[Ts]:t(r)}]}:null}).filter(Boolean)},[ee,re,a,s]),me=Ls(()=>{const e="function"==typeof a?a:e=>e[a];return t=>null!=t&&"object"==typeof t&&Os in t?t[Os]:e(t)},[a]),ye=Ls(()=>{const e="function"==typeof s?s:e=>e[s];return t=>null!=t&&"object"==typeof t&&Ts in t?t[Ts]:e(t)},[s]),ge=Ls(()=>{const e=ee.filter(e=>e&&"object"==typeof e).map(e=>e[l]??0).filter(e=>isFinite(e));return 0===e.length?()=>A[0]:Ds().domain(ce(e)).range(A)},[ee,l,A]),be=Ls(()=>e=>({stroke:S?B(e,S,J.colorScale):Ca,strokeWidth:ge(e[l]??0),strokeLinecap:C,opacity:M}),[S,J.colorScale,ge,l,M,C]),ve=Ls(()=>{const e=Wa(be,{stroke:V,strokeWidth:Z,opacity:U});if(!J.effectiveSelectionHook)return e;const t={...J.resolvedSelection?.unselectedStyle||{},fillOpacity:0};return ba(e,J.effectiveSelectionHook,{...J.resolvedSelection||{},unselectedStyle:t})},[be,J.effectiveSelectionHook,J.resolvedSelection,V,Z,U]),xe=Ls(()=>Wa(()=>({fill:"#333",r:5,fillOpacity:.8}),{stroke:V,strokeWidth:Z,opacity:U}),[V,Z,U]),we=Ls(()=>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 zs("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:zs("div",{style:{fontWeight:600},children:t})})}if(null!=e?.source&&null!=e?.target){const t=e[l];return Rs("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[Rs("div",{style:{fontWeight:600},children:[e.source," → ",e.target]}),null!=t&&zs("div",{style:{opacity:.7},children:"number"==typeof t?t.toLocaleString():t})]})}const t=e?.name||e?.label||e?.[i];return null!=t?zs("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:zs("div",{style:{fontWeight:600},children:t})}):null},[l,i]);if(J.earlyReturn)return J.earlyReturn;const ke={projection:c,...null!=o&&{lines:pe},points:K,xAccessor:me,yAccessor:ye,lineDataAccessor:"coordinates",...null!=Y&&{lineIdAccessor:Y},lineType:v,flowStyle:x,lineStyle:ve,pointStyle:xe,...Q&&{areas:Q,areaStyle:k},...null!=u&&{graticule:u},...null!=h&&{fitPadding:h},...X&&{zoomable:!0},...f&&{zoomExtent:f},...p&&{onZoom:p},...null!=m&&{dragRotate:m},...j&&{showParticles:j},...P&&{particleStyle:P},...y&&{tileURL:y},...g&&{tileAttribution:g},...b&&{tileCacheSize:b},size:[n.width,n.height],margin:J.margin,enableHover:!0,tooltipContent:!1===I?()=>null:jr(I)||we,...J.legendBehaviorProps,...hs({linkedHover:T,selection:O,onObservation:N,onClick:$,mobileInteraction:J.mobileInteraction,customHoverBehavior:de,customClickBehavior:fe,linkedHoverInClickPredicate:!1}),...D&&D.length>0&&{annotations:D},...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},...R&&{className:R},...null!=e.animate&&{animate:e.animate},...F};return zs(Za,{componentName:"FlowMap",width:n.width,height:n.height,children:zs(Ii,{ref:ie,...ke})})});Ns.displayName="FlowMap";import{useMemo as $s,useRef as Ws,useState as _s,useEffect as Es,useCallback as Bs,forwardRef as Hs}from"react";import{jsx as Fs,jsxs as Gs}from"react/jsx-runtime";var qs=Hs(function(e,t){const n=Na(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{points:o,lines:r,xAccessor:i="lon",yAccessor:a="lat",nodeIdAccessor:s="id",center:l,costAccessor:c,strength:u=1,lineMode:h="straight",projection:d="mercator",graticule:f,fitPadding:p,zoomable:m,zoomExtent:y,onZoom:g,dragRotate:b,tileURL:v,tileAttribution:x,tileCacheSize:w,transition:k,colorBy:S,colorScheme:M,pointRadius:A=5,tooltip:C,showRings:L=!0,ringStyle:j,showNorth:P=!0,costLabel:I,annotations:D,margin:z,className:R,selection:O,linkedHover:T,onObservation:N,onClick:$,chartId:W,loading:_,loadingContent:E,emptyContent:H,legendPosition:F,frameProps:G={},stroke:q,strokeWidth:V,opacity:Z}=e,U=m??!!v,Y=$s(()=>hr(o),[o]),X=ws({data:Y,rawData:o,colorBy:S,colorScheme:M,legendInteraction:void 0,legendPosition:F,selection:O,linkedHover:T,fallbackFields:S?["string"==typeof S?S:""]:[],unwrapData:!1,onObservation:N,onClick:$,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"DistanceCartogram",chartId:W,showLegend:n.showLegend,userMargin:z,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:_,loadingContent:E,emptyContent:H,width:n.width,height:n.height}),Q=$s(()=>{const e=Wa(e=>({fill:S?B(e,S,X.colorScale):Ca,fillOpacity:.8,stroke:"#fff",strokeWidth:1,r:A}),{stroke:q,strokeWidth:V,opacity:Z});return X.effectiveSelectionHook?ba(e,X.effectiveSelectionHook,X.resolvedSelection):e},[S,X.colorScale,X.effectiveSelectionHook,X.resolvedSelection,A,q,V,Z]),K=$s(()=>({center:l,centerAccessor:s,costAccessor:c,strength:u,lineMode:h}),[l,s,c,u,h]),J=$s(()=>{if(!r)return;const e="function"==typeof i?i:e=>e[i],t="function"==typeof a?a:e=>e[a],n=new Map;for(const e of Y)n.set(e[s]+"",e);return r.map(o=>{if(o.coordinates)return o;const r=n.get(o.source+""),s=n.get(o.target+"");return r&&s?{...o,coordinates:[{[i]:e(r),[a]:t(r)},{[i]:e(s),[a]:t(s)}]}:null}).filter(Boolean)},[r,Y,i,a,s]),ee=$s(()=>e=>{const t=("function"==typeof c?c:e=>e[c])(e);return Gs("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[Fs("div",{style:{fontWeight:600},children:e[s]||e.name||e.id||"Point"}),null!=t&&Gs("div",{style:{opacity:.7},children:["Cost: ","number"==typeof t?t.toFixed(1):t]})]})},[c,s]),te=Ws(null);Ss(t,{variant:"geo-points",frameRef:te});const[ne,oe]=_s(null),re=Bs(()=>{const e=te.current?.getCartogramLayout?.();e&&oe(t=>t&&t.cx===e.cx&&t.cy===e.cy&&t.maxCost===e.maxCost&&t.availableRadius===e.availableRadius?t:e)},[]);Es(()=>{const e=requestAnimationFrame(re);return()=>cancelAnimationFrame(e)},[re,u,l,n.width,n.height,Y]);const ie=$s(()=>{if(!L||!ne)return[];const{maxCost:e}=ne;if(0>=e)return[];if(Array.isArray(L))return L.filter(t=>t>0&&e>=t);const t="number"==typeof L?L:Math.min(5,Math.max(2,Math.ceil(e/5))),n=e/t,o=[];for(let e=1;t>=e;e++)o.push(Math.round(n*e*10)/10);return o},[L,ne]),ae=$s(()=>{if(!ne)return G.foregroundGraphics||null;const{cx:e,cy:t,maxCost:n,availableRadius:o}=ne,r={stroke:"#999",strokeWidth:.8,strokeDasharray:"4,3",labelColor:"#777",labelSize:10,...j},i=X.margin.left??10,a=X.margin.top??10;return Gs("g",{children:[ie.map(s=>{const l=s/n*o;return Gs("g",{children:[Fs("circle",{cx:e+i,cy:t+a,r:l,fill:"none",stroke:r.stroke,strokeWidth:r.strokeWidth,strokeDasharray:r.strokeDasharray,opacity:.5}),Gs("text",{x:e+i+l+3,y:t+a-2,fontSize:r.labelSize,fill:r.labelColor,fontFamily:"system-ui, sans-serif",children:[s,I?" "+I:""]})]},s)}),P&&Gs("g",{transform:`translate(${i+24}, ${a+24})`,children:[Fs("circle",{r:16,fill:"white",fillOpacity:.85,stroke:"#bbb",strokeWidth:.8}),Fs("path",{d:"M0,-11 L3,-3 L1,-4 L1,7 L-1,7 L-1,-4 L-3,-3 Z",fill:"#555",stroke:"none"}),Fs("text",{y:-12,textAnchor:"middle",fontSize:7,fontWeight:700,fill:"#555",fontFamily:"system-ui, sans-serif",children:"N"}),Fs("line",{x1:11,y1:0,x2:13,y2:0,stroke:"#bbb",strokeWidth:.8}),Fs("line",{x1:-11,y1:0,x2:-13,y2:0,stroke:"#bbb",strokeWidth:.8}),Fs("line",{x1:0,y1:11,x2:0,y2:13,stroke:"#bbb",strokeWidth:.8})]}),G.foregroundGraphics]})},[ne,ie,P,I,j,X.margin,G.foregroundGraphics]);if(X.earlyReturn)return X.earlyReturn;Ka("DistanceCartogram",Y,"xAccessor",i),Ka("DistanceCartogram",Y,"yAccessor",a);const se={projection:d,...null!=o&&{points:Y},...J&&{lines:J,lineDataAccessor:"coordinates"},xAccessor:i,yAccessor:a,pointIdAccessor:s,pointStyle:Q,projectionTransform:K,...k&&{transition:{duration:k}},...null!=f&&{graticule:f},...null!=p&&{fitPadding:p},...U&&{zoomable:!0},...y&&{zoomExtent:y},...g&&{onZoom:g},...null!=b&&{dragRotate:b},...v&&{tileURL:v},...x&&{tileAttribution:x},...w&&{tileCacheSize:w},size:[n.width,n.height],margin:X.margin,enableHover:!0,tooltipContent:!1===C?()=>null:jr(C)||ee,...X.legendBehaviorProps,...hs({linkedHover:T,selection:O,onObservation:N,onClick:$,mobileInteraction:X.mobileInteraction,customHoverBehavior:X.customHoverBehavior,customClickBehavior:X.customClickBehavior,linkedHoverInClickPredicate:!1}),...D&&D.length>0&&{annotations:D},...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},...R&&{className:R},...null!=e.animate&&{animate:e.animate},...G,...ae&&{foregroundGraphics:ae}};return Fs(Za,{componentName:"DistanceCartogram",width:n.width,height:n.height,children:Fs(Ii,{ref:te,...se})})});qs.displayName="DistanceCartogram";import{forwardRef as Vs,useMemo as Zs}from"react";import{useMemo as Us,useRef as Ys}from"react";import{jsx as Xs}from"react/jsx-runtime";var Qs=Vs(function(e,t){const{points:n,areas:o,lines:r,layout:i,layoutConfig:a,onLayoutError:s,projection:l="equirectangular",xAccessor:c="lon",yAccessor:u="lat",lineDataAccessor:h,colorBy:d,colorScheme:f,tooltip:p,annotations:m,margin:y,selection:g,linkedHover:b,onObservation:v,onClick:x,chartId:w,loading:k,loadingContent:S,emptyContent:M,className:A,frameProps:C={}}=e,{frameRef:L,resolved:j,normalizedMargin:P}=function(e){const t=Ys(null);return Ss(e.imperativeRef,{variant:e.imperativeVariant,frameRef:t}),{frameRef:t,resolved:Na(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),normalizedMargin:Us(()=>zi(e.margin),[e.margin])}}({imperativeRef:t,imperativeVariant:"geo-points",margin:y,width:e.width,height:e.height,enableHover:e.enableHover,title:e.title,mode:e.mode,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),I=Zs(()=>hr(n),[n]),D=Zs(()=>hr(o),[o]),z=Zs(()=>hr(r),[r]),R=Zs(()=>[...I,...z,...D],[I,z,D]),O=ws({data:R,rawData:void 0!==n||void 0!==r||void 0!==o?R:void 0,colorBy:d,colorScheme:f,legendInteraction:void 0,selection:g,linkedHover:b,fallbackFields:"string"==typeof d?[d]:[],unwrapData:!1,onObservation:v,onClick:x,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,chartType:"GeoCustomChart",chartId:w,showLegend:!1,userMargin:P,marginDefaults:j.marginDefaults,loading:k,loadingContent:S,emptyContent:M,width:j.width,height:j.height}),T=O.effectiveSelectionHook,N=Zs(()=>T?.isActive?{isActive:!0,predicate:T.predicate}:null,[T?.isActive,T?.predicate]);if(O.earlyReturn)return O.earlyReturn;const{width:$,height:W,enableHover:_,title:E,description:B,summary:H,accessibleTable:F}=j,G=jr(p),q={projection:l,...null!=n&&{points:I},...null!=o&&{areas:D},...null!=r&&{lines:z},xAccessor:c,yAccessor:u,...null!=h&&{lineDataAccessor:h},customLayout:i,layoutConfig:a,onLayoutError:s,layoutSelection:N,colorBy:d,colorScheme:f,size:[$,W],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:O.margin,enableHover:_,...us({title:E,description:B,summary:H,accessibleTable:F,className:A,animate:e.animate,autoPlaceAnnotations:e.autoPlaceAnnotations}),...!1===p?{tooltipContent:()=>null}:G?{tooltipContent:G}:{},...hs({linkedHover:b,selection:g,onObservation:v,onClick:x,hoverHighlight:!1,mobileInteraction:O.mobileInteraction,customHoverBehavior:O.customHoverBehavior,customClickBehavior:O.customClickBehavior,linkedHoverInClickPredicate:!1}),...m&&m.length>0&&{annotations:m},...C};return Xs(Za,{componentName:"GeoCustomChart",width:$,height:W,children:Xs(Ii,{ref:L,...q})})});Qs.displayName="GeoCustomChart";var Ks={fill:"rgba(0,0,0,0)",stroke:"rgba(0,0,0,0)",opacity:0},Js=8;function el(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??8,style:{...Ks},datum:e.datum,pointId:t,_transitionKey:t}}function tl(e){return el(e)}function nl(e){const[[t,n],[o,r]]=e.bounds;return{type:"geoarea",pathData:e.pathData,centroid:e.centroid,bounds:e.bounds,screenArea:e.screenArea??Math.abs((o-t)*(r-n)),style:{...Ks},datum:e.datum,group:e.group,interactive:!0}}function ol(e,t,n){const{featureKey:o,dataKey:r}=n,i=new Map;for(const e of t)i.set(e[r]+"",e);return e.map(e=>{const t=(e=>{const t=o.split(".");let n=e;for(const e of t)n=n?.[e];return(n??"")+""})(e),n=i.get(t);return n?{...e,properties:{...e.properties,...n}}:e})}export{ps as ChoroplethMap,Js as DEFAULT_HIT_RADIUS,qs as DistanceCartogram,Ns as FlowMap,Qs as GeoCustomChart,Cs as ProportionalSymbolMap,Ii as StreamGeoFrame,nl as geoAreaHitTarget,tl as geoHitTarget,xe as glyphExtent,ve as glyphPlacement,el as hitTargetPoint,ol as mergeData,ls as resolveReferenceGeography,Aa as resolveResponsiveRules,Ma as responsiveRuleMatches};
2
+ import{DEFAULT_HIT_RADIUS as e,geoAreaHitTarget as t,geoHitTarget as o,hitTargetPoint as i}from"./chunk-chunk-J3XWETBJ.module.min.js";import{GeoCustomChart as n,StreamGeoFrame_default as r}from"./chunk-chunk-P6UBCMSQ.module.min.js";import{mergeShapeStyle as a,normalizePartialMargin as l,useChartSetup as s,useFrameImperativeHandle as c,useResolvedSelection as m}from"./chunk-chunk-BHYTYMY2.module.min.js";import"./chunk-chunk-CYIML3AV.module.min.js";import"./chunk-chunk-5WEFWNUW.module.min.js";import"./chunk-chunk-XOYX77KF.module.min.js";import{buildCustomBehaviorProps as d}from"./chunk-chunk-FAKO3RGQ.module.min.js";import"./chunk-chunk-5UKL5W76.module.min.js";import{composeStyleRules as u,makeNodeRuleContext as h,makeRuleValueResolver as p,matchesThreshold as f,resolveStyleRules as g,ruleMatches as y}from"./chunk-chunk-EMO5NUGE.module.min.js";import"./chunk-chunk-STZFFTAN.module.min.js";import{DEFAULT_COLOR as b,EMPTY_ARRAY as k,filterSparseArray as v,getColor as w,getSequentialInterpolator as S,getSize as C,hatchFillId as A,hatchPatternDef as x,isHatchFill as j,normalizeLinkedHover as R,normalizeTooltip as I,resolveResponsiveRules as P,resolveSvgFill as M,responsiveRuleMatches as H,useChartMode as N,useChartSelection as L,useLinkedHover as z,useObservationSelector as W,useThemeSequential as B,wrapStyleWithSelection as F}from"./chunk-chunk-ODUZEEBH.module.min.js";import{getMinMax as T}from"./chunk-chunk-JJ2OOIET.module.min.js";import"./chunk-chunk-WCX6U47H.module.min.js";import{glyphExtent as O,glyphPlacement as E}from"./chunk-chunk-KTWEBFMX.module.min.js";import{ChartError as D,SafeRender as U,renderEmptyState as Z,renderLoadingState as G,warnMissingField as $}from"./chunk-chunk-ZCNBUZPL.module.min.js";import"./chunk-chunk-YHNZCPOZ.module.min.js";import{useMemo as _}from"react";import{scaleSequential as J}from"d3-scale";import{useState as K,useEffect as Y,useMemo as X}from"react";import{feature as q}from"topojson-client";var Q=new Map;function V(e){return"default"in e?e.default:e}async function ee(e){const t=Q.get(e);if(t)return t;const{topology:o,objectName:i}=await async function(e){try{switch(e){case"world-110m":return{topology:V(await import("world-atlas/countries-110m.json")),objectName:"countries"};case"world-50m":return{topology:V(await import("world-atlas/countries-50m.json")),objectName:"countries"};case"land-110m":return{topology:V(await import("world-atlas/land-110m.json")),objectName:"land"};case"land-50m":return{topology:V(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}"): Install the optional peer dependency \`world-atlas\` (\`npm install world-atlas\`) to use built-in reference geographies, or pass GeoJSON Feature[] to \`areas\`.`,{cause:t});throw t}}(e);if(!o||!o.objects)throw Error(`resolveReferenceGeography("${e}"): Failed to load topology. Got ${typeof o} with keys: ${o?Object.keys(o).join(", "):"none"}`);const n=q(o,o.objects[i]),r="features"in n?n.features:[n];return Q.set(e,r),r}function te(e){const t=X(()=>Array.isArray(e)?e:void 0,[e]),[o,i]=K(null);return Y(()=>{if(e&&!Array.isArray(e)){if("string"==typeof(t=e)&&["world-110m","world-50m","land-110m","land-50m"].includes(t)){let t=!1;return i(null),ee(e).then(e=>{t||i(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".`),i(null)}else i(null)},[e]),void 0!==t?t:o}import{jsx as oe,jsxs as ie}from"react/jsx-runtime";function ne(e){const t=N(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),o=B(),{areas:i,valueAccessor:n,styleRules:s,colorScheme:c,projection:h="equalEarth",graticule:p,fitPadding:f,zoomable:g,zoomExtent:y,onZoom:b,dragRotate:k,tileURL:w,tileAttribution:C,tileCacheSize:A,tooltip:x,areaOpacity:j=1,annotations:R,margin:P,className:M,selection:H,linkedHover:z,onObservation:W,onClick:T,chartId:O,loading:E,loadingContent:$,emptyContent:K,frameProps:Y={},stroke:X,strokeWidth:q,opacity:Q}=e,V=g??!!w,ee=te(i),ne=_(()=>ee?v(ee):ee,[ee]),re=_(()=>"function"==typeof n?n:e=>e?.properties?.[n]??e?.[n],[n]),ae=c??o??"blues",le=_(()=>{if(!ne)return J(S(void 0)).domain([0,1]);let e=1/0,t=-1/0;for(const o of ne){const i=re(o);null!=i&&isFinite(i)&&(e>i&&(e=i),i>t&&(t=i))}const o=S(ae);return J(o).domain([Number.isFinite(e)?e:0,Number.isFinite(t)?t:1])},[ne,re,ae]),{activeSelectionHook:se,customHoverBehavior:ce,customClickBehavior:me}=L({selection:H,linkedHover:z,onObservation:W,onClick:T,chartType:"ChoroplethMap",chartId:O,mobileInteraction:t.mobileInteraction}),de=m(H),ue=_(()=>{const e=u(e=>{const t=re(e);return{fill:null!=t&&isFinite(t)?le(t):"#ccc",stroke:"#999",strokeWidth:.5,fillOpacity:j}},s,e=>({value:re(e)}),e=>e&&"object"==typeof e&&e.properties?{...e.properties,...e}:e),t=a(e,{stroke:X,strokeWidth:q,opacity:Q});return se?F(t,se,de):t},[re,le,se,de,j,X,q,Q,s]),he=_(()=>e=>{const t=e?.properties?.name||e?.properties?.NAME||e?.name||e?.NAME||"Feature",o=re(e);return ie("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[oe("div",{style:{fontWeight:600},children:t}),null!=o&&oe("div",{style:{opacity:.7},children:(i=o,"number"==typeof i&&isFinite(i)?Number.isInteger(i)?i.toLocaleString():i.toLocaleString(void 0,{maximumFractionDigits:2}):(i??"")+"")})]});var i},[re]),pe=_(()=>({top:10,right:10,bottom:10,left:10,...l(P)}),[P]),fe=G(E,t.width,t.height,$)||(ne?null:G(!0,t.width,t.height,$)),ge=fe?null:Z(ne,t.width,t.height,K);if(Array.isArray(ne)&&ne.length>0){const e=ne[0];if(!e||"object"!=typeof e||!e.geometry)return oe(D,{componentName:"ChoroplethMap",message:"ChoroplethMap: areas must be an array of GeoJSON Features with a geometry property.",width:t.width,height:t.height})}const ye={projection:h,areas:ne,areaStyle:ue,size:[t.width,t.height],margin:pe,enableHover:!0,tooltipContent:!1===x?()=>null:!0===x?he:I(x)||he,...null!=p&&{graticule:p},...null!=f&&{fitPadding:f},...V&&{zoomable:!0},...y&&{zoomExtent:y},...b&&{onZoom:b},...null!=k&&{dragRotate:k},...w&&{tileURL:w},...C&&{tileAttribution:C},...A&&{tileCacheSize:A},...d({linkedHover:z,selection:H,onObservation:W,onClick:T,mobileInteraction:t.mobileInteraction,customHoverBehavior:ce,customClickBehavior:me,linkedHoverInClickPredicate:!1}),...R&&R.length>0&&{annotations:R},...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},...M&&{className:M},...null!=e.animate&&{animate:e.animate},...Y};return fe||ge||oe(U,{componentName:"ChoroplethMap",width:t.width,height:t.height,children:oe(r,{...ye})})}ne.displayName="ChoroplethMap";import{useMemo as re,useRef as ae,forwardRef as le}from"react";import{jsx as se,jsxs as ce}from"react/jsx-runtime";var me=le(function(e,t){const o=ae(null);c(t,{variant:"geo-points",frameRef:o});const i=N(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{points:n,xAccessor:l="lon",yAccessor:m="lat",sizeBy:p,sizeRange:f=[3,30],colorBy:g,styleRules:y,colorScheme:v,projection:S="equalEarth",graticule:A,fitPadding:x,zoomable:j,zoomExtent:R,onZoom:P,dragRotate:M,tileURL:H,tileAttribution:L,tileCacheSize:z,areas:W,areaStyle:B={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},tooltip:O,annotations:E,margin:D,className:Z,selection:G,linkedHover:_,onObservation:J,onClick:K,chartId:Y,loading:X,loadingContent:q,emptyContent:Q,legendInteraction:V,legendPosition:ee,frameProps:oe={},stroke:ie,strokeWidth:ne,opacity:le}=e,me=j??!!H,de=te(W),ue=s({data:n??k,rawData:n,colorBy:g,colorScheme:v,legendInteraction:V,legendPosition:ee,selection:G,linkedHover:_,fallbackFields:g?["string"==typeof g?g:""]:[],unwrapData:!1,onObservation:J,onClick:K,mobileInteraction:i.mobileInteraction,mobileSemantics:i.mobileSemantics,chartType:"ProportionalSymbolMap",chartId:Y,showLegend:i.showLegend,userMargin:D,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:X,loadingContent:q,emptyContent:Q,width:i.width,height:i.height}),he=ue.data,pe=re(()=>{if(!p)return;const e="function"==typeof p?p:e=>e?.[p],t=he.filter(Boolean).map(t=>e(t)).filter(e=>null!=e&&isFinite(e));return 0!==t.length?T(t):void 0},[he,p]),fe=re(()=>{const e=u(e=>({fill:g?w(e,g,ue.colorScale):b,fillOpacity:.7,stroke:"#fff",strokeWidth:.5,r:p?C(e,p,f,pe):6}),y,h(g,p)),t=a(e,{stroke:ie,strokeWidth:ne,opacity:le});return ue.effectiveSelectionHook?F(t,ue.effectiveSelectionHook,ue.resolvedSelection):t},[g,ue.colorScale,ue.effectiveSelectionHook,ue.resolvedSelection,p,f,pe,ie,ne,le,y]),ge=re(()=>e=>{const t=e?.name||e?.label||e?.NAME||e?.id,o="string"==typeof p?p:null,i=("function"==typeof p?p:e=>e[p])(e),n=e=>"number"==typeof e&&isFinite(e)?Number.isInteger(e)?e.toLocaleString():e.toLocaleString(void 0,{maximumFractionDigits:2}):(e??"")+"",r="string"==typeof g?g:null,a=r?e?.[r]:null;return ce("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[t&&se("div",{style:{fontWeight:600,marginBottom:2},children:t}),o&&null!=i&&ce("div",{children:[ce("span",{style:{opacity:.7},children:[o,": "]}),n(i)]}),r&&null!=a&&ce("div",{children:[ce("span",{style:{opacity:.7},children:[r,": "]}),a+""]}),!t&&!o&&Object.entries(e).filter(([e])=>"data"!==e&&"x"!==e&&"y"!==e&&"time"!==e).slice(0,4).map(([e,t])=>ce("div",{children:[ce("span",{style:{opacity:.7},children:[e,": "]}),n(t)]},e))]})},[p,g]);if(ue.earlyReturn)return ue.earlyReturn;$("ProportionalSymbolMap",he,"xAccessor",l),$("ProportionalSymbolMap",he,"yAccessor",m);const ye={projection:S,...null!=n&&{points:he},xAccessor:l,yAccessor:m,pointStyle:fe,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...de&&{areas:de,areaStyle:B},...null!=A&&{graticule:A},...null!=x&&{fitPadding:x},...me&&{zoomable:!0},...R&&{zoomExtent:R},...P&&{onZoom:P},...null!=M&&{dragRotate:M},...H&&{tileURL:H},...L&&{tileAttribution:L},...z&&{tileCacheSize:z},size:[i.width,i.height],margin:ue.margin,enableHover:!0,tooltipContent:!1===O?()=>null:I(O)||ge,...ue.legendBehaviorProps,...d({linkedHover:_,selection:G,onObservation:J,onClick:K,mobileInteraction:ue.mobileInteraction,customHoverBehavior:ue.customHoverBehavior,customClickBehavior:ue.customClickBehavior,linkedHoverInClickPredicate:!1}),...E&&E.length>0&&{annotations:E},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...i.title&&{title:i.title},...i.description&&{description:i.description},...i.summary&&{summary:i.summary},...void 0!==i.accessibleTable&&{accessibleTable:i.accessibleTable},...Z&&{className:Z},...null!=e.animate&&{animate:e.animate},...oe};return se(U,{componentName:"ProportionalSymbolMap",width:i.width,height:i.height,children:se(r,{ref:o,...ye})})});me.displayName="ProportionalSymbolMap";import{useMemo as de,useCallback as ue,useRef as he,forwardRef as pe}from"react";import{scaleLinear as fe}from"d3-scale";import{jsx as ge,jsxs as ye}from"react/jsx-runtime";var be="__semiotic_x",ke="__semiotic_y",ve=pe(function(e,t){const o=N(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{flows:i,nodes:n,nodeIdAccessor:l="id",xAccessor:m="lon",yAccessor:u="lat",valueAccessor:h="value",projection:p="equalEarth",graticule:f,fitPadding:g,zoomable:y,zoomExtent:S,onZoom:C,dragRotate:A,tileURL:x,tileAttribution:j,tileCacheSize:P,lineType:M="geo",flowStyle:H="basic",areas:L,areaStyle:B={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},edgeColorBy:O,edgeOpacity:E=.6,edgeWidthRange:D=[1,8],edgeLinecap:Z="round",colorScheme:G,showParticles:$,particleStyle:_,tooltip:J,annotations:K,margin:Y,className:X,selection:q,linkedHover:Q,onObservation:V,onClick:ee,chartId:oe,loading:ie,loadingContent:ne,emptyContent:re,frameProps:ae={},legendInteraction:le,legendPosition:se,stroke:ce,strokeWidth:me,opacity:pe,lineIdAccessor:ve}=e,we=y??!!x,Se=te(L),Ce=de(()=>v(n),[n]),Ae=s({data:i??k,rawData:i,colorBy:O,colorScheme:G,legendInteraction:le,legendPosition:se,selection:q,linkedHover:Q,fallbackFields:O?["string"==typeof O?O:""]:[],unwrapData:!1,onObservation:V,onClick:ee,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"FlowMap",chartId:oe,showLegend:o.showLegend,userMargin:Y,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:ie,loadingContent:ne,emptyContent:re,width:o.width,height:o.height}),xe=Ae.data,je=R(Q),Re=z({name:je?.name||"hover",fields:je?.fields||[]}),Ie=W(e=>e.pushObservation),Pe=de(()=>{const e=new Map;for(const t of Ce)e.set(t[l]+"",t);return e},[Ce,l]),Me=he(null),He=he(Pe);He.current=Pe;const Ne=he(m);Ne.current=m;const Le=he(u);Le.current=u;const ze=ue(e=>{if(!e||"object"!=typeof e||null==e.source||null==e.target)return null;const t=He.current,o=t.get(e.source+""),i=t.get(e.target+"");if(!o||!i)return null;const n="function"==typeof Ne.current?Ne.current:e=>e[Ne.current],r="function"==typeof Le.current?Le.current:e=>e[Le.current];return{...e,coordinates:[{[be]:n(o),[ke]:r(o)},{[be]:n(i),[ke]:r(i)}]}},[]);c(t,{variant:"geo-lines",frameRef:Me,overrides:{push:e=>{const t=ze(e);t&&Me.current?.pushLine(t)},pushMany:e=>{const t=[];for(const o of e){const e=ze(o);e&&t.push(e)}t.length>0&&Me.current?.pushManyLines(t)}}});const We=de(()=>{const e=new Map;for(const t of xe)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},[xe]),Be=ue(e=>{if(Q)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"point"===e.type){const e=We.get(t[l]+"");e&&Re.onHover(e)}else Re.onHover(t)}else Re.onHover(null);if(V||Ie){const t={timestamp:Date.now(),chartType:"FlowMap",chartId:oe};if(e){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]);const i={...t,type:"hover",datum:o||{},x:e.x??0,y:e.y??0};V&&V(i),Ie&&Ie(i)}else{const e={...t,type:"hover-end"};V&&V(e),Ie&&Ie(e)}}},[Q,Re,l,We,V,oe,Ie]),Fe=Ae.customClickBehavior,Te=de(()=>{const e="function"==typeof m?m:e=>e[m],t="function"==typeof u?u:e=>e[u];return xe.map(o=>{if(!o||"object"!=typeof o||null==o.source||null==o.target)return null;const i=Pe.get(o.source+""),n=Pe.get(o.target+"");return i&&n?{...o,coordinates:[{[be]:e(i),[ke]:t(i)},{[be]:e(n),[ke]:t(n)}]}:null}).filter(Boolean)},[xe,Pe,m,u]),Oe=de(()=>{const e="function"==typeof m?m:e=>e[m];return t=>null!=t&&"object"==typeof t&&be in t?t[be]:e(t)},[m]),Ee=de(()=>{const e="function"==typeof u?u:e=>e[u];return t=>null!=t&&"object"==typeof t&&ke in t?t[ke]:e(t)},[u]),De=de(()=>{const e=xe.filter(e=>e&&"object"==typeof e).map(e=>e[h]??0).filter(e=>isFinite(e));return 0===e.length?()=>D[0]:fe().domain(T(e)).range(D)},[xe,h,D]),Ue=de(()=>e=>({stroke:O?w(e,O,Ae.colorScale):b,strokeWidth:De(e[h]??0),strokeLinecap:Z,opacity:E}),[O,Ae.colorScale,De,h,E,Z]),Ze=de(()=>{const e=a(Ue,{stroke:ce,strokeWidth:me,opacity:pe});if(!Ae.effectiveSelectionHook)return e;const t={...Ae.resolvedSelection?.unselectedStyle||{},fillOpacity:0};return F(e,Ae.effectiveSelectionHook,{...Ae.resolvedSelection||{},unselectedStyle:t})},[Ue,Ae.effectiveSelectionHook,Ae.resolvedSelection,ce,me,pe]),Ge=de(()=>a(()=>({fill:"#333",r:5,fillOpacity:.8}),{stroke:ce,strokeWidth:me,opacity:pe}),[ce,me,pe]),$e=de(()=>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 ge("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:ge("div",{style:{fontWeight:600},children:t})})}if(null!=e?.source&&null!=e?.target){const t=e[h];return ye("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[ye("div",{style:{fontWeight:600},children:[e.source," → ",e.target]}),null!=t&&ge("div",{style:{opacity:.7},children:"number"==typeof t?t.toLocaleString():t})]})}const t=e?.name||e?.label||e?.[l];return null!=t?ge("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:ge("div",{style:{fontWeight:600},children:t})}):null},[h,l]);if(Ae.earlyReturn)return Ae.earlyReturn;const _e={projection:p,...null!=i&&{lines:Te},points:Ce,xAccessor:Oe,yAccessor:Ee,lineDataAccessor:"coordinates",...null!=ve&&{lineIdAccessor:ve},lineType:M,flowStyle:H,lineStyle:Ze,pointStyle:Ge,...Se&&{areas:Se,areaStyle:B},...null!=f&&{graticule:f},...null!=g&&{fitPadding:g},...we&&{zoomable:!0},...S&&{zoomExtent:S},...C&&{onZoom:C},...null!=A&&{dragRotate:A},...$&&{showParticles:$},..._&&{particleStyle:_},...x&&{tileURL:x},...j&&{tileAttribution:j},...P&&{tileCacheSize:P},size:[o.width,o.height],margin:Ae.margin,enableHover:!0,tooltipContent:!1===J?()=>null:I(J)||$e,...Ae.legendBehaviorProps,...d({linkedHover:Q,selection:q,onObservation:V,onClick:ee,mobileInteraction:Ae.mobileInteraction,customHoverBehavior:Be,customClickBehavior:Fe,linkedHoverInClickPredicate:!1}),...K&&K.length>0&&{annotations:K},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...o.title&&{title:o.title},...o.description&&{description:o.description},...o.summary&&{summary:o.summary},...void 0!==o.accessibleTable&&{accessibleTable:o.accessibleTable},...X&&{className:X},...null!=e.animate&&{animate:e.animate},...ae};return ge(U,{componentName:"FlowMap",width:o.width,height:o.height,children:ge(r,{ref:Me,..._e})})});ve.displayName="FlowMap";import{useMemo as we,useRef as Se,useState as Ce,useEffect as Ae,useCallback as xe,forwardRef as je}from"react";import{jsx as Re,jsxs as Ie}from"react/jsx-runtime";var Pe=je(function(e,t){const o=N(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{points:i,lines:n,xAccessor:l="lon",yAccessor:m="lat",nodeIdAccessor:p="id",center:f,costAccessor:g,strength:y=1,lineMode:k="straight",projection:S="mercator",graticule:C,fitPadding:A,zoomable:x,zoomExtent:j,onZoom:R,dragRotate:P,tileURL:M,tileAttribution:H,tileCacheSize:L,transition:z,colorBy:W,styleRules:B,colorScheme:T,pointRadius:O=5,tooltip:E,showRings:D=!0,ringStyle:Z,showNorth:G=!0,costLabel:_,annotations:J,margin:K,className:Y,selection:X,linkedHover:q,onObservation:Q,onClick:V,chartId:ee,loading:te,loadingContent:oe,emptyContent:ie,legendPosition:ne,frameProps:re={},stroke:ae,strokeWidth:le,opacity:se}=e,ce=x??!!M,me=we(()=>v(i),[i]),de=s({data:me,rawData:i,colorBy:W,colorScheme:T,legendInteraction:void 0,legendPosition:ne,selection:X,linkedHover:q,fallbackFields:W?["string"==typeof W?W:""]:[],unwrapData:!1,onObservation:Q,onClick:V,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"DistanceCartogram",chartId:ee,showLegend:o.showLegend,userMargin:K,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:te,loadingContent:oe,emptyContent:ie,width:o.width,height:o.height}),ue=we(()=>{const e=u(e=>({fill:W?w(e,W,de.colorScale):b,fillOpacity:.8,stroke:"#fff",strokeWidth:1,r:O}),B,h(W)),t=a(e,{stroke:ae,strokeWidth:le,opacity:se});return de.effectiveSelectionHook?F(t,de.effectiveSelectionHook,de.resolvedSelection):t},[W,de.colorScale,de.effectiveSelectionHook,de.resolvedSelection,O,ae,le,se,B]),he=we(()=>({center:f,centerAccessor:p,costAccessor:g,strength:y,lineMode:k}),[f,p,g,y,k]),pe=we(()=>{if(!n)return;const e="function"==typeof l?l:e=>e[l],t="function"==typeof m?m:e=>e[m],o=new Map;for(const e of me)o.set(e[p]+"",e);return n.map(i=>{if(i.coordinates)return i;const n=o.get(i.source+""),r=o.get(i.target+"");return n&&r?{...i,coordinates:[{[l]:e(n),[m]:t(n)},{[l]:e(r),[m]:t(r)}]}:null}).filter(Boolean)},[n,me,l,m,p]),fe=we(()=>e=>{const t=("function"==typeof g?g:e=>e[g])(e);return Ie("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[Re("div",{style:{fontWeight:600},children:e[p]||e.name||e.id||"Point"}),null!=t&&Ie("div",{style:{opacity:.7},children:["Cost: ","number"==typeof t?t.toFixed(1):t]})]})},[g,p]),ge=Se(null);c(t,{variant:"geo-points",frameRef:ge});const[ye,be]=Ce(null),ke=xe(()=>{const e=ge.current?.getCartogramLayout?.();e&&be(t=>t&&t.cx===e.cx&&t.cy===e.cy&&t.maxCost===e.maxCost&&t.availableRadius===e.availableRadius?t:e)},[]);Ae(()=>{const e=requestAnimationFrame(ke);return()=>cancelAnimationFrame(e)},[ke,y,f,o.width,o.height,me]);const ve=we(()=>{if(!D||!ye)return[];const{maxCost:e}=ye;if(0>=e)return[];if(Array.isArray(D))return D.filter(t=>t>0&&e>=t);const t="number"==typeof D?D:Math.min(5,Math.max(2,Math.ceil(e/5))),o=e/t,i=[];for(let e=1;t>=e;e++)i.push(Math.round(o*e*10)/10);return i},[D,ye]),je=we(()=>{if(!ye)return re.foregroundGraphics||null;const{cx:e,cy:t,maxCost:o,availableRadius:i}=ye,n={stroke:"#999",strokeWidth:.8,strokeDasharray:"4,3",labelColor:"#777",labelSize:10,...Z},r=de.margin.left??10,a=de.margin.top??10;return Ie("g",{children:[ve.map(l=>{const s=l/o*i;return Ie("g",{children:[Re("circle",{cx:e+r,cy:t+a,r:s,fill:"none",stroke:n.stroke,strokeWidth:n.strokeWidth,strokeDasharray:n.strokeDasharray,opacity:.5}),Ie("text",{x:e+r+s+3,y:t+a-2,fontSize:n.labelSize,fill:n.labelColor,fontFamily:"system-ui, sans-serif",children:[l,_?" "+_:""]})]},l)}),G&&Ie("g",{transform:`translate(${r+24}, ${a+24})`,children:[Re("circle",{r:16,fill:"white",fillOpacity:.85,stroke:"#bbb",strokeWidth:.8}),Re("path",{d:"M0,-11 L3,-3 L1,-4 L1,7 L-1,7 L-1,-4 L-3,-3 Z",fill:"#555",stroke:"none"}),Re("text",{y:-12,textAnchor:"middle",fontSize:7,fontWeight:700,fill:"#555",fontFamily:"system-ui, sans-serif",children:"N"}),Re("line",{x1:11,y1:0,x2:13,y2:0,stroke:"#bbb",strokeWidth:.8}),Re("line",{x1:-11,y1:0,x2:-13,y2:0,stroke:"#bbb",strokeWidth:.8}),Re("line",{x1:0,y1:11,x2:0,y2:13,stroke:"#bbb",strokeWidth:.8})]}),re.foregroundGraphics]})},[ye,ve,G,_,Z,de.margin,re.foregroundGraphics]);if(de.earlyReturn)return de.earlyReturn;$("DistanceCartogram",me,"xAccessor",l),$("DistanceCartogram",me,"yAccessor",m);const Pe={projection:S,...null!=i&&{points:me},...pe&&{lines:pe,lineDataAccessor:"coordinates"},xAccessor:l,yAccessor:m,pointIdAccessor:p,pointStyle:ue,projectionTransform:he,...z&&{transition:{duration:z}},...null!=C&&{graticule:C},...null!=A&&{fitPadding:A},...ce&&{zoomable:!0},...j&&{zoomExtent:j},...R&&{onZoom:R},...null!=P&&{dragRotate:P},...M&&{tileURL:M},...H&&{tileAttribution:H},...L&&{tileCacheSize:L},size:[o.width,o.height],margin:de.margin,enableHover:!0,tooltipContent:!1===E?()=>null:I(E)||fe,...de.legendBehaviorProps,...d({linkedHover:q,selection:X,onObservation:Q,onClick:V,mobileInteraction:de.mobileInteraction,customHoverBehavior:de.customHoverBehavior,customClickBehavior:de.customClickBehavior,linkedHoverInClickPredicate:!1}),...J&&J.length>0&&{annotations:J},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...o.title&&{title:o.title},...o.description&&{description:o.description},...o.summary&&{summary:o.summary},...void 0!==o.accessibleTable&&{accessibleTable:o.accessibleTable},...Y&&{className:Y},...null!=e.animate&&{animate:e.animate},...re,foregroundGraphics:je};return Re(U,{componentName:"DistanceCartogram",width:o.width,height:o.height,children:Re(r,{ref:ge,...Pe})})});function Me(e,t,o){const{featureKey:i,dataKey:n}=o,r=new Map;for(const e of t)r.set(e[n]+"",e);return e.map(e=>{const t=(e=>{const t=i.split(".");let o=e;for(const e of t)o=null!==o&&"object"==typeof o?o[e]:void 0;return(o??"")+""})(e),o=r.get(t);return o?{...e,properties:{...e.properties,...o}}:e})}Pe.displayName="DistanceCartogram";export{ne as ChoroplethMap,e as DEFAULT_HIT_RADIUS,Pe as DistanceCartogram,ve as FlowMap,n as GeoCustomChart,me as ProportionalSymbolMap,r as StreamGeoFrame,u as composeStyleRules,t as geoAreaHitTarget,o as geoHitTarget,O as glyphExtent,E as glyphPlacement,A as hatchFillId,x as hatchPatternDef,i as hitTargetPoint,j as isHatchFill,h as makeNodeRuleContext,p as makeRuleValueResolver,f as matchesThreshold,Me as mergeData,ee as resolveReferenceGeography,P as resolveResponsiveRules,g as resolveStyleRules,M as resolveSvgFill,H as responsiveRuleMatches,y as ruleMatches};