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
package/dist/xy.min.js CHANGED
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- "use strict";var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,r=Object.getPrototypeOf,i=Object.prototype.hasOwnProperty,s=(e,t,n)=>function(){if(n)throw n[0];try{return e&&(t=(0,e[o(e)[0]])(e=0)),t}catch(e){throw n=[e],e}},a=(e,n)=>{for(var o in n)t(e,o,{get:n[o],enumerable:!0})},l=(e,r,s,a)=>{if(r&&"object"==typeof r||"function"==typeof r)for(let l of o(r))i.call(e,l)||l===s||t(e,l,{get:()=>r[l],enumerable:!(a=n(r,l))||a.enumerable});return e},c=(n,o,i)=>(i=null!=n?e(r(n)):{},l(!o&&n&&n.__esModule?i:t(i,"default",{value:n,enumerable:!0}),n));function u(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 h(e,t=-1/0){let n=t;for(const t of e)t>n&&(n=t);return n}var d=s({"src/components/charts/shared/minMax.ts"(){}});function f(e,t=.5){const n=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!n)return e;const o=Math.round(parseInt(n[1],16)*(1-t)),r=Math.round(parseInt(n[2],16)*(1-t)),i=Math.round(parseInt(n[3],16)*(1-t));return`#${o.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}`}function p(e,t=.5){const n=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!n)return e;const o=Math.round(parseInt(n[1],16)+(255-parseInt(n[1],16))*t),r=Math.round(parseInt(n[2],16)+(255-parseInt(n[2],16))*t),i=Math.round(parseInt(n[3],16)+(255-parseInt(n[3],16))*t);return`#${o.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}`}var y,g,m=s({"src/components/charts/shared/colorManipulation.ts"(){}}),x={};function b(e,t,n,o){const r=t.uncertaintyOpacity,i=t.confidenceAccessor;if(!r&&!i)return;const s="object"==typeof r?r:{},a=s.min??.15,l=s.max??1;if(i){const t="function"==typeof i?i:e=>e[i];for(const n of e){const e=t(n);null!=e&&Number.isFinite(e)&&(n[g]=a+Math.max(0,Math.min(1,e))*(l-a))}return}const c=e.map(e=>{const t=n(e),r=o(e);return null!=t&&null!=r&&Number.isFinite(t)&&Number.isFinite(r)?Math.abs(t-r):NaN}),h=c.filter(e=>Number.isFinite(e));if(0===h.length)return;const[d,f]=u(h),p=f-d;e.forEach((e,t)=>{const n=c[t];Number.isFinite(n)&&(e[g]=l-(p>0?(n-d)/p:0)*(l-a))})}function v(e,t){return"function"==typeof t?t(e):!!e[t]}function k(e){return[{type:"anomaly-band",threshold:e.threshold??2,showBand:!1!==e.showBand,fill:e.bandColor||"#6366f1",fillOpacity:e.bandOpacity??.1,anomalyColor:e.anomalyColor||"#ef4444",anomalyRadius:e.anomalyRadius??6,label:e.label}]}function w(e,t,n,o,r){return(i=o).isTraining||i.isForecast||i.isAnomaly||i.upperBounds||i.lowerBounds?function(e,t,n,o,r){const{isTraining:i,isForecast:s,isAnomaly:a,upperBounds:l,lowerBounds:c,color:u="#6366f1",bandOpacity:h=.15,anomalyColor:d="#ef4444",anomalyRadius:f=6,label:p}=o,g=e.map(e=>{let t="observed";return s&&v(e,s)?t="forecast":i&&v(e,i)&&(t="training"),{...e,[y]:t}}),m=o._groupBy,x=[];if(m){const e=new Map;for(const t of g){const n=t[m]??"__default";e.has(n)||e.set(n,[]),e.get(n).push(t)}const t=[];for(const[,n]of e)for(let e=0;n.length-1>e;e++)n[e][y]!==n[e+1][y]&&(t.push({...n[e+1],[y]:n[e][y]}),t.push({...n[e],[y]:n[e+1][y]}));x.push(...g,...t)}else for(let e=0;g.length>e;e++)x.push(g[e]),g.length-1>e&&g[e][y]!==g[e+1][y]&&(x.push({...g[e+1],[y]:g[e][y]}),x.push({...g[e],[y]:g[e+1][y]}));if(o.trainUnderline){const e=[];for(const t of x)"training"===t[y]&&e.push({...t,[y]:"training-base"});x.unshift(...e)}const k=[];if(l&&c){const e="string"==typeof l?l:"__envUpper",t="string"==typeof c?c:"__envLower";if("function"==typeof l||"function"==typeof c)for(const n of x)"function"==typeof l&&(n[e]=l(n)),"function"==typeof c&&(n[t]=c(n));k.push({type:"envelope",upperAccessor:e,lowerAccessor:t,fill:u,fillOpacity:h,label:p})}if(o.uncertaintyOpacity||o.confidenceAccessor){const e=l?"function"==typeof l?l:e=>e[l]:()=>{},t=c?"function"==typeof c?c:e=>e[c]:()=>{};b(x.filter(e=>"forecast"===e[y]),o,e,t)}if(a){const e=o.anomalyStyle,t={type:"highlight",filter:e=>v(e,a)};e?(t.style=e,t.r=f):"function"==typeof d?(t.style=e=>{const t=d(e);return{stroke:t,strokeWidth:1.5,fill:t,fillOpacity:.7}},t.r=f):(t.color=d,t.r=f,t.style={stroke:d,strokeWidth:1.5,fill:d,fillOpacity:.7}),k.push(t)}return r&&k.push({type:"anomaly-band",threshold:r.threshold??2,showBand:!1!==r.showBand,fill:r.bandColor||"#6366f1",fillOpacity:r.bandOpacity??.1,anomalyColor:r.anomalyColor||"#ef4444",anomalyRadius:r.anomalyRadius??6,label:r.label}),{processedData:x,annotations:k}}(e,0,0,o,r):function(e,t,n,o,r){const{trainEnd:i,steps:s=10,confidence:a=.95,color:l="#6366f1",bandOpacity:c=.15,label:u}=o;if(null==i)return{processedData:e,annotations:[]};const d=[],f=[];for(const n of e)n[t]>i?f.push({...n,[y]:"observed"}):d.push({...n,[y]:"training"});const p=d.map(e=>[e[t],e[n]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]),g=[],m=[];if(p.length>=3){const r=p.length;let i=0,d=0,f=0,x=0;for(const[e,t]of p)i+=e,d+=t,f+=e*e,x+=e*t;const v=r*f-i*i;if(Math.abs(v)>1e-12){const f=(r*x-i*d)/v,k=(d-f*i)/r,w=e=>k+f*e,A=p.map(([e,t])=>t-w(e)).reduce((e,t)=>e+t*t,0),S=Math.sqrt(A/Math.max(r-2,1)),C=p.reduce((e,t)=>e+t[0],0)/r,M=p.reduce((e,t)=>e+(t[0]-C)**2,0),_=.99>a?.95>a?.9>a?1:1.645:1.96:2.576,j=h(e.map(e=>e[t]).filter(e=>null!=e&&isFinite(e))),P=p.length>1?(p[r-1][0]-p[0][0])/(r-1):1;for(let e=1;s>=e;e++){const o=j+e*P,i=w(o),s=S*Math.sqrt(1+1/r+(M>0?(o-C)**2/M:0))*_;m.push({[t]:o,[n]:i,[y]:"forecast",__forecastUpper:i+s,__forecastLower:i-s})}b(m,o,e=>e.__forecastUpper,e=>e.__forecastLower),g.push({type:"envelope",upperAccessor:"__forecastUpper",lowerAccessor:"__forecastLower",fill:l,fillOpacity:c,label:u})}}g.push({type:"x-threshold",x:i,color:"#94a3b8",strokeWidth:1,strokeDasharray:"4,2",label:"Train / Forecast"}),r&&g.push({type:"anomaly-band",threshold:r.threshold??2,showBand:!1!==r.showBand,fill:r.bandColor||"#6366f1",fillOpacity:r.bandOpacity??.1,anomalyColor:r.anomalyColor||"#ef4444",anomalyRadius:r.anomalyRadius??6,label:r.label});const x=[];if(x.push(...d),d.length>0&&f.length>0&&x.push({...d[d.length-1],[y]:"observed"}),x.push(...f),m.length>0){const e=f.length>0?f[f.length-1]:d[d.length-1];e&&x.push({...e,[y]:"forecast"}),x.push(...m)}return{processedData:x,annotations:g}}(e,t,n,o,r);var i}function A(e,t){const n=t.trainDasharray??"8,4",o=t.forecastDasharray??"4,4",r=t.color||"#6366f1",i=t.trainOpacity,s=t.forecastOpacity,a=t.trainStroke,l=t.trainLinecap,c=t.trainUnderline;return t=>{const u=e(t),h=t[y];if("training"===h){let e=u.stroke;return"darken"===a?e=f(u.stroke||"#666",.5):a&&(e=a),{...u,stroke:e,strokeDasharray:n,...l&&{strokeLinecap:l},...null!=i&&{strokeOpacity:i}}}if("training-base"===h){let e=u.stroke||"#666";return"lighten"===c&&(e=p(e,.4)),{...u,stroke:e,strokeDasharray:void 0}}if("forecast"===h){const e=t[g],n=null!=e?e:s;return{...u,stroke:r,strokeDasharray:o,...null!=n&&{strokeOpacity:n}}}return u}}a(x,{FORECAST_OPACITY_FIELD:()=>g,SEGMENT_FIELD:()=>y,buildAnomalyAnnotations:()=>k,buildForecast:()=>w,createSegmentLineStyle:()=>A,darkenColor:()=>f,lightenColor:()=>p,stampForecastOpacity:()=>b});var S,C=s({"src/components/charts/shared/statisticalOverlays.ts"(){d(),m(),m(),y="__forecastSegment",g="__forecastOpacity"}}),M={};a(M,{AreaChart:()=>_l,BubbleChart:()=>Kl,CandlestickChart:()=>zc,ConnectedScatterplot:()=>Xl,DEFAULT_HIT_RADIUS:()=>qc,DifferenceChart:()=>Rl,Heatmap:()=>ec,LineChart:()=>kl,MinimapChart:()=>vc,MultiAxisLineChart:()=>Bc,QuadrantChart:()=>jc,Scatterplot:()=>$l,ScatterplotMatrix:()=>pc,StackedAreaChart:()=>Fl,StreamXYFrame:()=>Bs,XYCustomChart:()=>Yc,glyphExtent:()=>en,glyphPlacement:()=>Jt,hitTargetPoint:()=>Vc,hitTargetRect:()=>Uc,resolveResponsiveRules:()=>ka,responsiveRuleMatches:()=>va,useCustomLayoutSelection:()=>Yt}),module.exports=(S=M,l(t({},"__esModule",{value:!0}),S));var _=c(require("react")),j=require("react"),P=require("react"),L=require("d3-selection"),R=require("d3-brush"),I=c(require("react")),N=require("react/jsx-runtime");function F(e,t,n,o){const[r,i]=[Math.min(...t),Math.max(...t)],s=(i-r)/20;let[a,l]=e;if(o)0>n?a=Math.max(r,a-s):l=Math.min(i,l+s);else{const e=l-a;a=Math.max(r,Math.min(i-e,a+n*s)),l=a+e}return[a,l]}function T(e,t){let n=0,o=t.length-1;for(;o>n;){const r=n+o+1>>1;t[r]>e?o=r-1:n=r}return t[n]}function B(e,t){let n=0,o=t.length-1;for(;o>n;){const r=n+o>>1;e>t[r]?n=r+1:o=r}return t[n]}function O({width:e,height:t,totalWidth:n,totalHeight:o,margin:r,dimension:i,scales:s,onBrush:a,binSize:l,snap:c,binBoundaries:u,snapDuring:h,streaming:d}){const f=(0,P.useRef)(null),p=(0,P.useRef)(null),y=(0,P.useRef)(a);y.current=a;const g=(0,P.useRef)(s);g.current=s;const m=(0,P.useMemo)(()=>u?[...u].sort((e,t)=>e-t):void 0,[u]),x=(0,P.useRef)(m);x.current=m;const b=(0,P.useRef)(!1),v=(0,P.useRef)(null),k=function({label:e="Data range brush",description:t="Use arrow keys to move the selected range, Shift plus an arrow key to resize it, and Escape to clear it.",onAction:n}={}){const o=I.useId().replace(/:/g,""),r=I.useRef(n);return r.current=n,{description:t,descriptionId:"semiotic-brush-description-"+o,svgProps:{role:"region",tabIndex:0,"aria-label":e,"aria-describedby":"semiotic-brush-description-"+o,onKeyDown:I.useCallback(e=>{const t=function(e){return"Escape"===e.key?{type:"clear"}:"ArrowLeft"===e.key?{type:"nudge",direction:"left",resize:e.shiftKey}:"ArrowRight"===e.key?{type:"nudge",direction:"right",resize:e.shiftKey}:"ArrowUp"===e.key?{type:"nudge",direction:"up",resize:e.shiftKey}:"ArrowDown"===e.key?{type:"nudge",direction:"down",resize:e.shiftKey}:null}(e);t&&(e.preventDefault(),r.current?.(t))},[])}}}({label:"xy"===i?"Two-dimensional data range brush":i.toUpperCase()+" data range brush",onAction:e=>{const t=g.current,n=p.current;if(!t||!n||!f.current)return;const o=(0,L.select)(f.current).select(".brush-g");if("clear"===e.type)return b.current=!0,o.call(n.move,null),b.current=!1,v.current=null,void y.current(null);const r=t.x.domain(),s=t.y.domain(),a=v.current;let l=a?.x??[r[0]+.4*(r[1]-r[0]),r[0]+.6*(r[1]-r[0])],c=a?.y??[s[0]+.4*(s[1]-s[0]),s[0]+.6*(s[1]-s[0])];const u="left"===e.direction||"right"===e.direction,h="left"===e.direction||"down"===e.direction?-1:1;if(u&&"y"!==i&&(l=F(l,r,h,e.resize)),u||"x"===i||(c=F(c,s,h,e.resize)),u&&"y"===i||!u&&"x"===i)return;const d={x:l,y:c};b.current=!0,o.call(n.move,"x"===i?[t.x(l[0]),t.x(l[1])]:"y"===i?[t.y(c[1]),t.y(c[0])]:[[t.x(l[0]),t.y(c[1])],[t.x(l[1]),t.y(c[0])]]),b.current=!1,v.current=d,y.current(d)}});return(0,P.useEffect)(()=>{if(!f.current)return;const n=(0,L.select)(f.current).select(".brush-g"),o="x"===i?(0,R.brushX)():"y"===i?(0,R.brushY)():(0,R.brush)();return o.extent([[0,0],[e,t]]),o.on("brush end",r=>{if(b.current)return;const s=g.current;if(!s)return;if(!r.selection)return v.current=null,void y.current(null);let a,u;if("x"===i){const[e,n]=r.selection;a=[s.x.invert(e),s.x.invert(n)],u=[s.y.invert(t),s.y.invert(0)]}else if("y"===i){const[t,n]=r.selection;a=[s.x.invert(0),s.x.invert(e)],u=[s.y.invert(n),s.y.invert(t)]}else{const[[e,t],[n,o]]=r.selection;a=[s.x.invert(e),s.x.invert(n)],u=[s.y.invert(o),s.y.invert(t)]}if("bin"===c&&"y"!==i&&("end"===r.type||"brush"===r.type&&h)){const e=x.current;e&&e.length>0?a=function(e,t){return 0===t.length?e:[T(e[0],t),B(e[1],t)]}(a,e):l&&l>0&&(a=[Math.floor(a[0]/l)*l,Math.ceil(a[1]/l)*l]);const t=s.x(a[0]),c=s.x(a[1]);if(b.current=!0,"x"===i)n.call(o.move,[t,c]);else if("xy"===i){const e=r.selection;n.call(o.move,[[t,e[0][1]],[c,e[1][1]]])}b.current=!1}const d={x:a,y:u};v.current=d,y.current(d)}),n.call(o),p.current=o,n.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{o.on("brush end",null),p.current=null}},[e,t,i,c,l,h]),(0,P.useEffect)(()=>{if(!(d&&s&&p.current&&v.current))return;if(!f.current)return;if("y"===i)return;const e=v.current,t=s.x.domain()[0],n=(0,L.select)(f.current).select(".brush-g");if(t>=e.x[1])return b.current=!0,n.call(p.current.move,null),b.current=!1,v.current=null,void y.current(null);let o=e.x[0],r=!1;if(t>e.x[0]){if(o=t,"bin"===c){const e=x.current;e&&e.length>0?o=B(t,e):l&&l>0&&(o=Math.ceil(t/l)*l)}if(o>=e.x[1])return b.current=!0,n.call(p.current.move,null),b.current=!1,v.current=null,void y.current(null);r=!0}const a=s.x(o),u=s.x(e.x[1]);if(b.current=!0,"x"===i)n.call(p.current.move,[a,u]);else{const t=s.y(e.y[1]),o=s.y(e.y[0]);n.call(p.current.move,[[a,t],[u,o]])}if(b.current=!1,r){const t={x:[o,e.x[1]],y:e.y};v.current=t,y.current(t)}},[s,d,i,c,l]),(0,N.jsxs)("svg",{ref:f,width:n,height:o,...k.svgProps,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:[(0,N.jsx)("title",{children:k.svgProps["aria-label"]}),(0,N.jsx)("desc",{id:k.descriptionId,children:k.description}),(0,N.jsx)("g",{className:"brush-g",transform:`translate(${r.left},${r.top})`})]})}var D=Object.freeze([]);function W(e){if(!e)return D;let t=!1;for(let n=0;e.length>n;n++){const o=e[n];if(null==o||"object"!=typeof o){t=!0;break}}if(!t)return e;const n=[];for(const t of e)null!=t&&"object"==typeof t&&n.push(t);return n}var z=class{constructor(e,t){this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=e,this.chunkThreshold=t?.chunkThreshold??5e3,this.chunkSize=t?.chunkSize??5e3}updateChunkOptions(e){null!=e.chunkThreshold&&(this.chunkThreshold=e.chunkThreshold),null!=e.chunkSize&&(this.chunkSize=e.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(e){if(e=W(e),this.lastBoundedData===e)return;if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}setReplacementData(e){if(e=W(e),this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.pushBuffer=[],this.flushScheduled=!1,this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0,preserveCategoryOrder:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,preserveCategoryOrder:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const e=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:e,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(e){null!=e&&"object"==typeof e&&(this.pushBuffer.push(e),this.scheduleFlush())}pushMany(e){if(0===e.length)return;let t=0;for(let n=0;e.length>n;n++){const o=e[n];null!=o&&"object"==typeof o&&(this.pushBuffer.push(o),t++)}0!==t&&this.scheduleFlush()}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}},H=require("react"),E=require("react/jsx-runtime");function $(e){let t=null;const n=()=>(t||(t=(0,H.createContext)(null)),t),o=Y(e);return[function({children:t,initialState:o}){const r=(0,H.useRef)(o),i=(0,H.useMemo)(()=>Y(e,r.current),[]),s=n();return(0,E.jsx)(s.Provider,{value:i,children:t})},(e,t)=>{const r=n(),i=(0,H.useContext)(r)??o,s=(0,H.useRef)(e);s.current=e;const a=(0,H.useRef)({hasValue:!1,value:void 0}),l=(0,H.useCallback)(()=>{const e=s.current(i.getState()),n=a.current;return n.hasValue&&t&&t(n.value,e)?n.value:(a.current={hasValue:!0,value:e},e)},[i,t]),c=(0,H.useCallback)(()=>s.current(i.getState()),[i]);return(0,H.useSyncExternalStore)(i.subscribe,l,c)}]}function Y(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 G(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 q(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t={...t,colors:{...t.colors,categorical:X}}),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 X=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],V={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}},U={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}},K={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:X,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 Q(e,t){if("light"===t)return V;if("dark"===t)return U;if("high-contrast"===t)return K;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?U:V;return q({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}return q({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}var[Z,J]=$(e=>({theme:V,setTheme(t){e(e=>({theme:Q(e.theme,t)}))}})),ee=class{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;return{next:()=>this._size>e?{done:!1,value:this.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray();let n=0,o=[];t.length>e&&(n=t.length-e,o=t.slice(0,n)),this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(let e=n;t.length>e;e++)this.push(t[e]);return o}update(e,t){const n=[],o=(this.head-this._size+this._capacity)%this._capacity;for(let r=0;this._size>r;r++){const i=(o+r)%this._capacity,s=this.buffer[i];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:{...s},n.push(e),this.buffer[i]=t(s)}}return n}remove(e){const t=[],n=[];if(this.forEach(o=>{e(o)?n.push(o):t.push(o)}),0===n.length)return n;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}},te=class{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(e){Number.isFinite(e)&&(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}evict(e){e!==this._min&&e!==this._max||(this._dirty=!0)}recalculate(e,t){this._min=1/0,this._max=-1/0;for(const n of e){const e=t?t(n):n;Number.isFinite(e)&&(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}this._dirty=!1}clear(){this._min=1/0,this._max=-1/0,this._dirty=!1}get extent(){return[this._min,this._max]}get min(){return this._min}get max(){return this._max}get dirty(){return this._dirty}};function ne(e,t){return e===t}function oe(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function re(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function ie(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}var se=/^\d{4}-\d{1,2}$/;function ae(e){const t=e.trim();if(!t||!Number.isNaN(Number(t)))return NaN;const n=se.test(t)?t+"-01":t;if(n===t&&10>t.length)return NaN;const o=Date.parse(n);return Number.isFinite(o)?o:NaN}function le(e){return e instanceof Date?e.getTime():"string"==typeof e?ae(e):+e}function ce(e){return new Set(Array.isArray(e)?e:[e])}var ue=require("d3-scale");function he(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function de(e,t,n){const o=e=>e.toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function fe(e){const t=e.map(he),n=t.length-1;return e=>{if(0>=e){const[e,n,o]=t[0];return de(e,n,o)}if(e>=1){const[e,o,r]=t[n];return de(e,o,r)}const o=e*n,r=Math.floor(o),i=o-r,[s,a,l]=t[r],[c,u,h]=t[r+1];return de(Math.round(s+(c-s)*i),Math.round(a+(u-a)*i),Math.round(l+(h-l)*i))}}var pe=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ye=fe(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),ge=fe(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),me=fe(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),xe=fe(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),be=fe(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),ve=fe(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),ke=fe(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),we=fe(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),Ae=fe(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),Se=fe(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),Ce=fe(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),Me=fe(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]),_e={blues:ye,reds:ge,greens:me,viridis:ke,oranges:xe,purples:be,greys:ve,plasma:we,inferno:Ae,magma:Se,cividis:Ce,turbo:Me};function je(e){return e&&_e[e]||ye}fe(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),fe(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),fe(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),fe(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),fe(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),fe(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),fe(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]);var Pe={category10:pe,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],..._e},Le=pe,Re=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],Ie=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 Ne(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")||Ie.has(t)}(o)?n(o):o}const o=e?.[t]+"";return n?n(o):Le[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))%Le.length]}function Fe(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 Te(e,t,n="category10"){if(n&&"object"==typeof n&&!Array.isArray(n)){const e=n;return t=>Fe(e,t)??"#999"}const o=Array.from(new Set(e.map(e=>e?.[t]).filter(e=>null!=e).map(e=>e+""))),r=o.every(e=>!isNaN(Number(e)));if(Array.isArray(n))return(0,ue.scaleOrdinal)().domain(o).range(n).unknown("#999");const i=Pe[n]||Pe.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:Le;return(0,ue.scaleOrdinal)().domain(o).range(e).unknown("#999")}}function Be(e,t,n=[3,20],o){let r;if(r="function"==typeof t?t(e):e?.[t],!o)return r;const[i,s]=o,[a,l]=n;if(s===i)return(a+l)/2;let c=(r-i)/(s-i);return 0>c?c=0:c>1&&(c=1),a+c*(l-a)}function Oe(e,t,n){return e+(t-e)*n}function De(){return"undefined"!=typeof performance?performance.now():Date.now()}function We(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 ze(e){const t=new Map;for(let n=0;e.length>n;n++)t.set(e[n],n);return t}function He(e,t,n){const o=e.duration??500,r=n-t;return o>r?1-r/o:0}function Ee(e,t,n,o){let r=!1;return t>0?(e._pulseIntensity!==t&&(e._pulseIntensity=t,r=!0),e._pulseColor!==n&&(e._pulseColor=n,r=!0),e._pulseGlowRadius!==o&&(e._pulseGlowRadius=o,r=!0),r):(0!==e._pulseIntensity&&(e._pulseIntensity=0,r=!0),void 0!==e._pulseColor&&(e._pulseColor=void 0,r=!0),void 0!==e._pulseGlowRadius&&(e._pulseGlowRadius=void 0,r=!0),r)}function $e(e,t,n){if(t._transitionKey)return t._transitionKey;switch(t.type){case"point":if(t.pointId)return"p:"+t.pointId;if("streaming"===e.runtimeMode&&t.datum){const n=e.getX(t.datum),o=e.getY(t.datum);if(e.getCategory)return`p:${e.getCategory(t.datum)}:${n}:${o}`;if(null!=n&&null!=o)return`p:${n}:${o}`}return"p:"+n;case"glyph":return t.pointId?"g:"+t.pointId:"g:"+n;case"rect":return`r:${t.group||""}:${t.datum?.binStart??t.datum?.category??n}`;case"heatcell":return`h:${t.x}_${t.y}`;case"candlestick":return null==t.datum?"c:"+n:"c:"+e.getX(t.datum);case"line":return"l:"+(t.group||"_default");case"area":return"a:"+(t.group||"_default");default:return null}}function Ye(e,t,n,o,r,i){const s=[];for(const r of e){const e=n(r),i=o(r);Number.isFinite(e)&&Number.isFinite(i)&&s.push({px:t.x(e),py:t.y(i),rawY:i,d:r})}s.sort((e,t)=>e.px-t.px);const a=Array(s.length),l=Array(s.length),c=Array(s.length);for(let e=0;s.length>e;e++){const t=s[e];a[e]=[t.px,t.py],l[e]=t.rawY,c[e]=t.d}return{type:"line",path:a,rawValues:l,style:r,datum:c,group:i}}function Ge(e,t,n,o,r,i,s,a){const l=[];for(const i of e){const e=n(i),s=o(i);if(!Number.isFinite(e)||!Number.isFinite(s))continue;const c=t.x(e),u=a?a(i):r;l.push({px:c,topY:t.y(s),botY:t.y(u)})}l.sort((e,t)=>e.px-t.px);const c=Array(l.length),u=Array(l.length);for(let e=0;l.length>e;e++){const t=l[e];c[e]=[t.px,t.topY],u[e]=[t.px,t.botY]}return{type:"area",topPath:c,bottomPath:u,style:i,datum:e,group:s}}function qe(e,t,n,o){const r=new Map;if("silhouette"===o)for(const o of e){let e=0;for(const r of t)e+=n(r,o)||0;r.set(o,-e/2)}else if("wiggle"===o){e.length>0&&r.set(e[0],0);for(let o=1;e.length>o;o++){const i=e[o-1],s=e[o];let a=0,l=0,c=0;for(const e of t){const t=n(e,s)||0;a+=(2*c+t)*(t-(n(e,i)||0)),l+=t,c+=t}const u=r.get(i)??0;r.set(s,u-(l>0?a/(2*l):0))}if(e.length>0){let o=0;for(const i of e){let e=0;for(const o of t)e+=n(o,i)||0;o+=(r.get(i)??0)+e/2}const i=o/e.length;for(const t of e)r.set(t,(r.get(t)??0)-i)}}else for(const t of e)r.set(t,0);return r}function Xe(e,t,n,o,r,i,s){const a=n(e),l=o(e);if(!Number.isFinite(a)||!Number.isFinite(l))return null;const c={type:"point",x:t.x(a),y:t.y(l),r:r,style:i,datum:e};return void 0!==s&&(c.pointId=s),c}function Ve(e,t,n,o,r,i,s,a){const l=n(e),c=o(e);if(!Number.isFinite(l)||!Number.isFinite(c))return null;const u={type:"symbol",x:t.x(l),y:t.y(c),size:r,symbolType:i,style:s,datum:e};return void 0!==a&&(u.pointId=a),u}function Ue(e,t,n,o,r,i,s){return{type:"rect",x:e,y:t,w:n,h:o,style:r,datum:i,group:s}}function Ke(e,t,n,o,r,i,s){const a={type:"heatcell",x:e,y:t,w:n,h:o,fill:r,datum:i};return s?.showValues&&(a.showValues=!0,a.value=s.value,s.valueFormat&&(a.valueFormat=s.valueFormat)),a}function Qe(e,t,n,o){return"function"==typeof t.style?t.style(o||{},n):t.style&&"object"==typeof t.style?t.style:e.resolveBoundsStyle(n,o)}function Ze(e,t,n,o){if(!e.scales)return null;const r=[],i=[];for(const n of t){const t=e.getX(n);if(!Number.isFinite(t))continue;const s=o.getTop(n),a=o.getBottom(n);if(!Number.isFinite(s)||!Number.isFinite(a))continue;const l=e.scales.x(t),c=e.scales.y(s),u=e.scales.y(a);Number.isFinite(l)&&Number.isFinite(c)&&Number.isFinite(u)&&(r.push([l,c]),i.push([l,u]))}return 2>r.length?null:{type:"area",topPath:r,bottomPath:i,style:Qe(e,o,n,t[0]),datum:t,group:n,interactive:o.interactive}}function Je(e){const t=[],n=[];if(!e)return{perSeries:t,aggregate:n};for(const o of e)o.perSeries?t.push(o):n.push(o);return{perSeries:t,aggregate:n}}function et(e,t,n){const o=[];for(const r of n){const n=Ze(e,t,"__ribbon_aggregate",r);n&&o.push(n)}return o}function tt(e,t,n,o){const r=[];for(const i of o){const o=Ze(e,t,n,i);o&&r.push(o)}return r}function nt(e,t){if(!e)return{};if(!t||0===t.length)return e;const n=[];for(const o of t){if("band"!==o.kind)continue;const t=o.getTop(e),r=o.getBottom(e);Number.isFinite(r)&&Number.isFinite(t)&&n.push({y0:r,y1:t})}return 0===n.length?e:{...e,band:n[0],bands:n}}function ot(e,t,n,o){if(!e.config.pointStyle)return;const r=o??e.getY;for(const o of t){const t=e.resolveGroupColor(o.key);for(const i of o.data){let o=e.config.pointStyle(i);!o.fill&&t&&(o={...o,fill:t});const s=o.r??3,a=e.getPointId?e.getPointId(i)+"":void 0,l=Xe(i,e.scales,e.getX,r,s,o,a);l&&n.push(l)}}}var rt={topOpacity:.8,bottomOpacity:.05};function it(e){if(e)return!0===e?rt:"colorStops"in e?e:{topOpacity:e.topOpacity??rt.topOpacity,bottomOpacity:e.bottomOpacity??rt.bottomOpacity}}var st=require("d3-shape"),at={circle:st.symbolCircle,square:st.symbolSquare,triangle:st.symbolTriangle,diamond:st.symbolDiamond,star:st.symbolStar,cross:st.symbolCross,wye:st.symbolWye},lt=["circle","triangle","diamond","star","square","chevron","cross","wye"];function ct(e,t,n){if(n)return n;const o=e??"circle";return"chevron"===o?function(e){const t=1.5*ut(e),n=.92*t;return`M0,${-t}L${n},${(.78*t).toFixed(3)}L0,${(.28*t).toFixed(3)}L${-n},${(.78*t).toFixed(3)}Z`}(t):(0,st.symbol)(at[o]??st.symbolCircle,Math.max(1,t))()??""}function ut(e){return Math.sqrt(Math.max(1,e)/Math.PI)}var ht=new Map;function dt(e,t,n,o,r){const i=new Map;for(const s of e){const e=t(s),a=n(s);if(null==e||null==a||Number.isNaN(e)||Number.isNaN(a))continue;const l=Math.floor(e/o)*o;let c=i.get(l);if(c||(c={start:l,end:l+o,total:0,categories:new Map},i.set(l,c)),c.total+=a,r){const e=r(s);c.categories.set(e,(c.categories.get(e)||0)+a)}}return i}function ft(e){return null!=e&&!1!==e&&""!==e&&(!Array.isArray(e)||e.some(ft))}function pt(e,t,n){e.has(t)||(e.add(t),console.warn(n))}function yt(e,t){const n="function"==typeof e?e:n=>n[e||t];return e=>{const t=n(e);return null==t?NaN:+t}}function gt(e){const t=[],n=["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode,o=yt(n&&e.valueAccessor||e.yAccessor,n?"value":"y");if(e.boundsAccessor){const n=oe(e.boundsAccessor,"bounds");t.push({kind:"bounds",getTop:e=>{const t=o(e);if(!Number.isFinite(t))return NaN;const r=n(e);return Number.isFinite(r)&&0!==r?t+r:t},getBottom:e=>{const t=o(e);if(!Number.isFinite(t))return NaN;const r=n(e);return Number.isFinite(r)&&0!==r?t-r:t},style:e.boundsStyle,perSeries:!0,interactive:!1})}if(e.band){const n=Array.isArray(e.band)?e.band:[e.band];for(const e of n)t.push({kind:"band",getTop:yt(e.y1Accessor,"y1"),getBottom:yt(e.y0Accessor,"y0"),style:e.style,perSeries:!1!==e.perSeries,interactive:!0===e.interactive})}return t}var mt=require("d3-scale");function xt(e,t){return t?[t[0]??e[0],t[1]??e[1]]:e}function bt(e,t,n){if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return(0,mt.scaleLog)().domain(e).range(n).clamp(!0)}return"symlog"===e?(0,mt.scaleSymlog)().domain(t).range(n):"time"===e?(0,mt.scaleTime)().domain([new Date(t[0]),new Date(t[1])]).range(n):(0,mt.scaleLinear)().domain(t).range(n)}function vt(e,t,n,o){const r=e.push(t);return n&&n.push(o),r}var kt={data:"data",domain:"domain",layout:"layout","scene-geometry":"sceneGeometry","scene-style":"sceneStyle","data-paint":"dataPaint","interaction-paint":"interactionPaint",overlay:"overlay",accessibility:"accessibility",evidence:"evidence"};function wt(e,t){const n={...e};for(const e of t)n[kt[e]]++;return n}function At(e,t,n){const o=new Set(t);return{changeSet:{...e,...e.keys?{keys:[...e.keys]}:{}},changed:o,revisions:wt(n,o)}}var St=class{constructor(){this.revisions={data:0,domain:0,layout:0,sceneGeometry:0,sceneStyle:0,dataPaint:0,interactionPaint:0,overlay:0,accessibility:0,evidence:0},this.latest=At({kind:"initialize"},[],this.revisions)}get last(){return this.latest}record(e,t){const n=At(e,t,this.revisions);return this.revisions=n.revisions,this.latest=n,n}},Ct=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Mt=["scene-style","data-paint","accessibility","evidence"],_t=new Set(["lineStyle","pointStyle","areaStyle","barStyle","swarmStyle","waterfallStyle","candlestickStyle","boundsStyle","colorScheme","themeCategorical","themeSemantic","barColors"]),jt=class{constructor(){this.tracker=new St}get last(){return this.tracker.last}recordData(e,t){return this.tracker.record({kind:e,...void 0===t?{}:{count:t}},Ct)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},Mt):this.recordNoop("restyle")}recordConfig(e,t,n){return this.tracker.record({kind:"config",keys:e},t?function(e,t){const n=new Set(["layout","scene-geometry","data-paint","overlay","accessibility","evidence"]);return t&&n.add("domain"),e.some(e=>_t.has(e))&&n.add("scene-style"),n}(e,n):[])}},Pt=require("d3-quadtree"),Lt=class{constructor(){this.maxRadius=0,this.tree=null}get quadtree(){return this.tree}get maxPointRadius(){return this.maxRadius}clear(){this.tree=null,this.maxRadius=0}rebuild(e,t){if("scatter"!==e&&"bubble"!==e&&"custom"!==e)return void this.clear();let n=0,o=0;for(const e of t)"point"===e.type&&(n++,e.r>o&&(o=e.r));if(this.maxRadius=o,500>=n)return void(this.tree=null);const r=Array(n);let i=0;for(const e of t)"point"===e.type&&(r[i++]=e);this.tree=(0,Pt.quadtree)().x(e=>e.x).y(e=>e.y).addAll(r)}},Rt=class e{constructor(e){if(this.xExtent=new te,this.yExtent=new te,this.growingCapacityWarned=!1,this.windowSizeWarned=!1,this.resolvedRibbons=[],this.timestampBuffer=null,this.activeTransition=null,this._hasRenderedOnce=!1,this.prevPositionMap=new Map,this.prevPathMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this._colorMapCache=null,this._groupDataCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this._ingestVersion=0,this._datumIndexCache=null,this._bufferArrayCache=null,this._bufferDirty=!0,this.needsFullRebuild=!0,this.lastLayout=null,this.updateResults=new jt,this.scales=null,this.scene=[],this.version=0,this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customLayoutFailedThisBuild=!1,this._customLayoutDiagnosticsWarned=new Set,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.xIsDate=!1,this.spatialIndex=new Lt,this._lastBoundedInsertsRef=null,this.applyPulse=(e,t,n)=>!(!this.config.pulse||!this.timestampBuffer)&&function(e,t,n,o,r,i=("undefined"!=typeof performance?performance.now():Date.now())){const s=e.color??"rgba(255,255,255,0.6)",a=e.glowRadius??4;let l=!1;const c=r??(()=>{const e=new Map;for(let t=0;n.length>t;t++)e.set(n[t],t);return e})();for(const n of t){if("line"===n.type)continue;if("area"===n.type){const t=Array.isArray(n.datum)?n.datum:[n.datum];let r=0,a=!1;for(const n of t){const t=c.get(n);if(null==t)continue;a=!0;const s=o.get(t);if(null==s)continue;const l=He(e,s,i);l>r&&(r=l)}a&&(l=Ee(n,r,s)||l);continue}const t=c.get(n.datum);if(null==t)continue;const r=o.get(t);l=Ee(n,null==r?0:He(e,r,i),s,a)||l}return l}(this.config.pulse,e,t,this.timestampBuffer,this.getDatumIndexMap(t),n),this._stylePaintPending=!1,this.config=e,this.buffer=new ee(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=oe(e.timeAccessor||e.xAccessor,"time"),this.getY=oe(e.valueAccessor||e.yAccessor,"value")):(this.getX=oe(e.xAccessor,"x"),this.getY=oe(e.yAccessor,"y")),this.getGroup=ie(e.groupAccessor),this.getCategory=ie(e.categoryAccessor),this.getSize=e.sizeAccessor?oe(e.sizeAccessor,"size"):void 0,this.getColor=ie(e.colorAccessor),this.getSymbol=ie(e.symbolAccessor),this.getY0=e.y0Accessor?oe(e.y0Accessor,"y0"):void 0,this.resolvedRibbons=gt(e),this.getPointId=ie(e.pointIdAccessor),"candlestick"===e.chartType){const t=null!=e.openAccessor,n=null!=e.closeAccessor;this.getOpen=t?oe(e.openAccessor,"open"):void 0,this.getHigh=oe(e.highAccessor,"high"),this.getLow=oe(e.lowAccessor,"low"),this.getClose=n?oe(e.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!t&&!n}e.pulse&&(this.timestampBuffer=new ee(e.windowSize))}syncPulseTimestampBuffer(){this.config.pulse?null!=this.timestampBuffer&&this.timestampBuffer.capacity===this.buffer.capacity&&this.timestampBuffer.size===this.buffer.size||(this.timestampBuffer=function(e,t){const n=new ee(e.capacity);return e.forEach(()=>n.push(t)),n}(this.buffer,De())):this.timestampBuffer=null}pushDatumYExtent(e){if("candlestick"===this.config.chartType&&this.getHigh&&this.getLow)return this.yExtent.push(this.getHigh(e)),void this.yExtent.push(this.getLow(e));this.yExtent.push(this.getY(e)),this.getY0&&this.yExtent.push(this.getY0(e));for(const t of this.resolvedRibbons){const n=t.getTop(e),o=t.getBottom(e);Number.isFinite(n)&&this.yExtent.push(n),Number.isFinite(o)&&this.yExtent.push(o)}}evictDatumYExtent(e){if("candlestick"===this.config.chartType&&this.getHigh&&this.getLow)return this.yExtent.evict(this.getHigh(e)),void this.yExtent.evict(this.getLow(e));this.yExtent.evict(this.getY(e)),this.getY0&&this.yExtent.evict(this.getY0(e));for(const t of this.resolvedRibbons){const n=t.getTop(e),o=t.getBottom(e);Number.isFinite(n)&&this.yExtent.evict(n),Number.isFinite(o)&&this.yExtent.evict(o)}}rebuildYExtent(){this.yExtent.clear();for(const e of this.buffer)this.pushDatumYExtent(e)}rebuildExtents(){this.xExtent.clear(),this.yExtent.clear();for(const e of this.buffer)this.xExtent.push(this.getX(e)),this.pushDatumYExtent(e)}ingest(e){if(e.bounded&&this._lastBoundedInsertsRef===e.inserts)return this.updateResults.recordNoop("replace"),!1;const t=De();if(this.lastIngestTime=t,this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,e.bounded){this._lastBoundedInsertsRef=e.inserts,this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this.timestampBuffer&&this.timestampBuffer.clear();const i=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode;if(this.getX=i?oe(this.config.timeAccessor||this.config.xAccessor,"time"):oe(this.config.xAccessor,"x"),this.xIsDate=!1,e.inserts.length>0){const t=e.inserts[0],n=this.config.xAccessor,o="function"==typeof n?n(t):t[n||"x"],r=o instanceof Date,i="string"==typeof o&&Number.isFinite(ae(o));if(this.xIsDate=r||i,i){const e="string"==typeof n?n:void 0;this.getX=e?t=>le(t[e]):e=>le(n(e))}}r=this.timestampBuffer,(o=e.totalSize||e.inserts.length)>(n=this.buffer).capacity&&(n.resize(o),r&&o>r.capacity&&r.resize(o));for(const n of e.inserts)vt(this.buffer,n,this.timestampBuffer,t),this.xExtent.push(this.getX(n)),this.pushDatumYExtent(n)}else for(const n of e.inserts){if("growing"===this.config.windowMode&&this.buffer.full){const e=this.config.maxCapacity??1e5;e>this.growingCap&&(this.growingCap=Math.min(2*this.growingCap,e),this.buffer.resize(this.growingCap),this.timestampBuffer&&this.timestampBuffer.resize(this.growingCap),"production"===process.env.NODE_ENV||this.growingCapacityWarned||5e4>this.growingCap||(this.growingCapacityWarned=!0,console.warn(`[Semiotic] Growing window buffer reached ${this.growingCap} points (cap ${e}). Large canvas scenes are expensive — prefer a sliding window, aggregation, or an explicit maxCapacity if this is intentional.`)))}const e=vt(this.buffer,n,this.timestampBuffer,t);this.xExtent.push(this.getX(n)),this.pushDatumYExtent(n),null!=e&&(this.xExtent.evict(this.getX(e)),this.evictDatumYExtent(e))}var n,o,r;return this.updateResults.recordData(e.bounded?"replace":"ingest",e.inserts.length),!0}ingestWithResult(e){return this.ingest(e),this.updateResults.last}computeScene(e){const{config:t,buffer:n}=this,o=this.scales,r=this.lastLayout;if(!this.needsFullRebuild&&!t.customLayout&&this.lastLayout&&this.scene.length>0&&this.scales&&0>=(this.config.scalePadding??0)&&(this.lastLayout.width!==e.width||this.lastLayout.height!==e.height))return void this.remapScene(e);this.xExtent.dirty&&this.xExtent.recalculate(n,this.getX),this.yExtent.dirty&&this.rebuildYExtent();const i=this.getBufferArray(),s=this.yExtent.extent;let a=xt(this.xExtent.extent,t.xExtent),l=xt(s,t.yExtent);const c=!(!(u=t.yExtent)||null==u[0]||null==u[1]);var u;const h="exact"===t.axisExtent;if("stackedarea"===t.chartType&&!c&&n.size>0){const e=function(e){const{config:t,groups:n,getX:o,getY:r}=e,i="exact"===t.axisExtent;if(t.normalize){const n=[0,i?1:1+t.extentPadding];return{yDomain:n,stackExtentCache:{key:`${e.bufferSize}:${e.ingestVersion}:norm`,yDomain:n}}}const s=`${e.bufferSize}:${e.ingestVersion}:${t.baseline??"zero"}:${t.stackOrder??"key"}`;if(e.stackExtentCache&&e.stackExtentCache.key===s)return{yDomain:e.stackExtentCache.yDomain,stackExtentCache:e.stackExtentCache};const a=new Map,l=new Set;let c=0;const u=new Map,h=new Map;for(const e of n){const t=new Map;let n=0;for(const i of e.data){const e=o(i),s=r(i);if(!Number.isFinite(e)||!Number.isFinite(s))continue;t.set(e,(t.get(e)||0)+s),l.add(e),n+=s;const a=(u.get(e)||0)+s;u.set(e,a),a>c&&(c=a)}a.set(e.key,t),h.set(e.key,n)}const d=t.stackOrder??"key",f=(e,t)=>t>e?-1:e>t?1:0;let p,y;if("input"===d)p=n.map(e=>e.key);else if("insideOut"===d){const e=[...n].map(e=>e.key).sort((e,t)=>{const n=(h.get(t)??0)-(h.get(e)??0);return 0!==n?n:f(e,t)}),t=[],o=[];let r=0,i=0;for(const n of e)i>r?(t.push(n),r+=h.get(n)??0):(o.push(n),i+=h.get(n)??0);p=[...o.reverse(),...t]}else p="asc"===d?n.map(e=>e.key).sort((e,t)=>{const n=(h.get(e)??0)-(h.get(t)??0);return 0!==n?n:f(e,t)}):"desc"===d?n.map(e=>e.key).sort((e,t)=>{const n=(h.get(t)??0)-(h.get(e)??0);return 0!==n?n:f(e,t)}):n.map(e=>e.key).sort(f);if("wiggle"===t.baseline||"silhouette"===t.baseline){const e=Array.from(l).sort((e,t)=>e-t),n=qe(e,p,(e,t)=>a.get(e)?.get(t)||0,t.baseline);let o=1/0,r=-1/0;for(const t of e){const e=n.get(t)??0,i=u.get(t)??0;o>e&&(o=e),e+i>r&&(r=e+i)}Number.isFinite(o)&&Number.isFinite(r)||(o=0,r=0);const s=r-o,c=i?0:s>0?s*t.extentPadding:1;y=[o-c,r+c]}else if("diverging"===t.baseline){const e=Array.from(l).sort((e,t)=>e-t),[n,o]=function(e,t,n){let o=0,r=0;for(const i of e){let e=0,s=0;for(const o of t){const t=n(o,i)||0;0>t?s+=t:e+=t}o>s&&(o=s),e>r&&(r=e)}return[o,r]}(e,p,(e,t)=>a.get(e)?.get(t)||0),r=o-n,s=i?0:r>0?r*t.extentPadding:1;y=[n-s,o+s]}else y=[0,c+(i?0:c>0?c*t.extentPadding:1)];return{yDomain:y,stackExtentCache:{key:s,yDomain:y}}}({config:t,groups:this.groupData(i),getX:this.getX,getY:this.getY,bufferSize:n.size,ingestVersion:this._ingestVersion,stackExtentCache:this._stackExtentCache});l=e.yDomain,this._stackExtentCache=e.stackExtentCache}else"bar"===t.chartType&&t.binSize&&!c&&n.size>0?l=function(e,t,n,o,r,i,s){const[,a]=function(e,t,n,o,r){const i=dt(e,t,n,o,r);if(0===i.size)return[0,0];let s=0;for(const e of i.values())e.total>s&&(s=e.total);return[0,s]}(e,t,n,o,r);return[0,s?a:a+a*i]}(n,this.getX,this.getY,t.binSize,this.getCategory,t.extentPadding,h):"waterfall"===t.chartType&&!c&&n.size>0?l=function(e,t,n,o){const[r,i]=function(e,t){let n=0,o=0,r=0;for(const i of e){const e=t(i);null==e||Number.isNaN(e)||(r+=e,n>r&&(n=r),r>o&&(o=r))}return[n,o]}(e,t),s=i-r,a=o?0:s>0?s*n:1;return[Math.min(0,r-Math.abs(a)),Math.max(0,i+Math.abs(a))]}(n,this.getY,t.extentPadding,h):c||l[0]===1/0||(l=function(e,t,n){if(!n.length)return e;let[o,r]=e;for(const e of t)for(const t of n){const n=t.getTop(e),i=t.getBottom(e);Number.isFinite(n)&&(o>n&&(o=n),n>r&&(r=n)),Number.isFinite(i)&&(o>i&&(o=i),i>r&&(r=i))}return[o,r]}(l,i,this.resolvedRibbons),l=function(e,t){const n=e[1]-e[0],o=t.exactMode?0:n>0?n*t.extentPadding:1,r=[null!=t.userMin?e[0]:e[0]-o,null!=t.userMax?e[1]:e[1]+o];return"log"!==t.yScaleType||r[0]>0||0>=t.dataYDomain[0]||t.exactMode||null==t.userMin&&(r[0]=t.dataYDomain[0]/(1+t.extentPadding)),r}(l,{exactMode:h,extentPadding:t.extentPadding,userMin:t.yExtent?.[0],userMax:t.yExtent?.[1],yScaleType:t.yScaleType,dataYDomain:s}));l=function(e,t,n){if(!t||n)return e;const o=t[0],r=t[1];return null==o&&null==r?e:[null!=o?o:e[0],null!=r?r:e[1]]}(l,t.yExtent,!!c),({xDomain:a,yDomain:l}=function(e,t,n){let o=e,r=t;if(o[0]===1/0||o[1]===-1/0)if("time"===n){const e=Date.now();o=[e-864e5,e]}else o=[0,1];return r[0]!==1/0&&r[1]!==-1/0||(r=[0,1]),{xDomain:o,yDomain:r}}(a,l,t.xScaleType)),this.scales=function(e){const{config:t,layout:n,xDomain:o,yDomain:r}=e,i="streaming"===t.runtimeMode,s=Math.max(0,Math.min(t.scalePadding||0,Math.min(n.width,n.height)/2-1));if(i){if("x"==("up"===(a=t.arrowOfTime)||"down"===a?"y":"x")){const e="right"===t.arrowOfTime?[s,n.width-s]:[n.width-s,s];return{x:(0,mt.scaleLinear)().domain(o).range(e),y:bt(t.yScaleType,r,[n.height-s,s])}}const e="down"===t.arrowOfTime?[s,n.height-s]:[n.height-s,s];return{x:bt(t.yScaleType,r,[s,n.width-s]),y:(0,mt.scaleLinear)().domain(o).range(e)}}var a;return{x:bt(t.xScaleType,o,[s,n.width-s]),y:bt(t.yScaleType,r,[n.height-s,s])}}({config:t,layout:e,xDomain:a,yDomain:l}),this._customLayoutFailedThisBuild=!1;const d=this.buildSceneNodes(e,i);if(this._customLayoutFailedThisBuild)return!0===this.lastCustomLayoutFailure?.preservedLastGoodScene?(this.scales=o,this.lastLayout=r):(this.scene=[],this.spatialIndex.rebuild(this.config.chartType,this.scene)),void(this.needsFullRebuild=!0);this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=d,this.config.decay&&this.applyDecay(this.scene,i),this.config.pulse&&this.applyPulse(this.scene,i),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&(this.prevPositionMap.size>0||this.prevPathMap.size>0)&&this.startTransition(),this.spatialIndex.rebuild(this.config.chartType,this.scene),this.needsFullRebuild=!1,this.lastLayout={width:e.width,height:e.height},this.version++}get quadtree(){return this.spatialIndex.quadtree}get maxPointRadius(){return this.spatialIndex.maxPointRadius}remapScene(e){const t=e.width/this.lastLayout.width,n=e.height/this.lastLayout.height;for(const e of this.scene)switch(e.type){case"line":for(const o of e.path)o[0]*=t,o[1]*=n;break;case"area":for(const o of e.topPath)o[0]*=t,o[1]*=n;for(const o of e.bottomPath)o[0]*=t,o[1]*=n;e.clipRect&&(e.clipRect={x:e.clipRect.x*t,y:e.clipRect.y*n,width:e.clipRect.width*t,height:e.clipRect.height*n});break;case"point":case"glyph":e.x*=t,e.y*=n;break;case"rect":case"heatcell":e.x*=t,e.y*=n,e.w*=t,e.h*=n;break;case"candlestick":e.x*=t,e.openY*=n,e.closeY*=n,e.highY*=n,e.lowY*=n}const o=this.scales.x.domain(),r=this.scales.y.domain(),i=this.scales.x.range(),s=this.scales.y.range(),a=bt,l=Math.max(0,Math.min(this.config.scalePadding||0,Math.min(e.width,e.height)/2-1)),c=s[1]>s[0];this.scales={x:a(this.config.xScaleType,o,i[0]>i[1]?[e.width-l,l]:[l,e.width-l]),y:a(this.config.yScaleType,r,c?[l,e.height-l]:[e.height-l,l])},this.lastLayout={width:e.width,height:e.height},this.spatialIndex.rebuild(this.config.chartType,this.scene),this.version++}buildSceneNodes(e,t){const{config:n,scales:o}=this;if(!o)return[];if(n.customLayout){const r={data:t,scales:o,dimensions:{width:e.width,height:e.height,margin:n.layoutMargin??{top:0,right:0,bottom:0,left:0},plot:{x:0,y:0,width:e.width,height:e.height}},theme:{semantic:n.themeSemantic??{},categorical:n.themeCategorical??Re},resolveColor:(e,t)=>{const o=this.resolveGroupColor(e);if(o)return o;const r=this.resolveLineStyle(e,t);return r.stroke?r.stroke:"string"==typeof r.fill?r.fill:n.themeSemantic?.primary??"#4e79a7"},config:n.layoutConfig??{},selection:n.layoutSelection??null};let i;try{i=n.customLayout(r)}catch(e){const t=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}}("xy",e,t,this.version);this.lastCustomLayoutFailure=o,this._customLayoutFailedThisBuild=!0,"production"!==process.env.NODE_ENV&&console.error("[semiotic] customLayout threw:",e);try{n.onLayoutError?.(o)}catch(e){"production"!==process.env.NODE_ENV&&console.error("[semiotic] onLayoutError threw:",e)}return t?this.scene:(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,[])}this.customLayoutOverlays=i.overlays??null,this.lastCustomLayoutResult=i,this.lastCustomLayoutFailure=null;const s=i.nodes??[];if(this._customRestyle=i.restyle,this.hasCustomRestyle=!!i.restyle,this.hasCustomRestyle){this._baseStyles=new WeakMap;for(const e of s)e.style&&this._baseStyles.set(e,e.style);this.applyCustomRestyle(s,n.layoutSelection??null)}return function(e){if("production"===process.env.NODE_ENV)return;const{label:t,nodes:n,overlays:o,warned:r}=e;ft(o)&&0===n.length&&pt(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)&&pt(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:"customLayout",nodes:s,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned}),s}if(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,0===t.length)return[];const r={scales:o,config:n,getX:this.getX,getY:this.getY,getY0:this.getY0,getSize:this.getSize,getColor:this.getColor,getSymbol:this.getSymbol,getGroup:this.getGroup,getCategory:this.getCategory,getPointId:this.getPointId,ribbons:this.resolvedRibbons,getOpen:this.getOpen,getHigh:this.getHigh,getLow:this.getLow,getClose:this.getClose,resolveLineStyle:(e,t)=>this.resolveLineStyle(e,t),resolveAreaStyle:(e,t)=>this.resolveAreaStyle(e,t),resolveBoundsStyle:(e,t)=>this.resolveBoundsStyle(e,t),resolveColorMap:e=>this.resolveColorMap(e),resolveGroupColor:e=>this.resolveGroupColor(e),groupData:e=>this.groupData(e),barCategoryCache:this._barCategoryCache};switch(n.chartType){case"line":return function(e,t){const n=e.groupData(t),o=[],r=e.config.annotations?.filter(e=>"threshold"===e.type&&e.color).map(e=>({value:e.value,color:e.color,thresholdType:e.thresholdType||"greater"}));if(e.ribbons&&e.ribbons.length>0){const{perSeries:r,aggregate:i}=Je(e.ribbons);if(i.length>0&&o.push(...et(e,t,i)),r.length>0)for(const t of n)o.push(...tt(e,t.data,t.key,r))}for(const t of n){const n=e.resolveLineStyle(t.key,t.data[0]),i=Ye(t.data,e.scales,e.getX,e.getY,n,t.key);r&&r.length>0&&(i.colorThresholds=r),e.config.curve&&"linear"!==e.config.curve&&(i.curve=e.config.curve),e.config.lineGradient&&(i.strokeGradient=e.config.lineGradient),o.push(i)}return ot(e,n,o),o}(r,t);case"area":return function(e,t){const n=e.groupData(t),o=[];if(e.ribbons&&e.ribbons.length>0){const{perSeries:r,aggregate:i}=Je(e.ribbons);if(i.length>0&&o.push(...et(e,t,i)),r.length>0)for(const t of n)o.push(...tt(e,t.data,t.key,r))}const r=e.scales.y.domain()[0],i=e.getY0?t=>{const n=e.getY0(t);return null==n?r:n}:void 0;for(const t of n){const n=e.resolveAreaStyle(t.key,t.data[0]),s=Ge(t.data,e.scales,e.getX,e.getY,r,n,t.key,i),a=it(e.config.gradientFill);a&&(s.fillGradient=a),e.config.curve&&"linear"!==e.config.curve&&(s.curve=e.config.curve),e.config.lineGradient&&(s.strokeGradient=e.config.lineGradient),o.push(s)}return ot(e,n,o),o}(r,t);case"mixed":return function(e,t){const n=e.groupData(t),o=[],r=e.config.areaGroups||new Set;if(e.ribbons&&e.ribbons.length>0){const{perSeries:r,aggregate:i}=Je(e.ribbons);if(i.length>0&&o.push(...et(e,t,i)),r.length>0)for(const t of n)o.push(...tt(e,t.data,t.key,r))}const i=e.scales.y.domain()[0],s=e.getY0?t=>{const n=e.getY0(t);return null==n?i:n}:void 0;for(const t of n)if(r.has(t.key)){const n=e.resolveAreaStyle(t.key,t.data[0]),r=Ge(t.data,e.scales,e.getX,e.getY,i,n,t.key,s),a=it(e.config.gradientFill);a&&(r.fillGradient=a),e.config.curve&&"linear"!==e.config.curve&&(r.curve=e.config.curve),e.config.lineGradient&&(r.strokeGradient=e.config.lineGradient),o.push(r)}else{const n=e.resolveLineStyle(t.key,t.data[0]),r=Ye(t.data,e.scales,e.getX,e.getY,n,t.key);e.config.curve&&"linear"!==e.config.curve&&(r.curve=e.config.curve),e.config.lineGradient&&(r.strokeGradient=e.config.lineGradient),o.push(r)}return ot(e,n,o),o}(r,t);case"stackedarea":return function(e,t){const n=e.groupData(t),o=e.config.stackOrder??"key",r=()=>n.sort((e,t)=>t.key>e.key?-1:e.key>t.key?1:0);if("input"===o);else if("key"===o)r();else if("asc"===o||"desc"===o||"insideOut"===o){const t=new Map;for(const o of n){let n=0;for(const t of o.data){const o=e.getX(t),r=e.getY(t);Number.isFinite(o)&&Number.isFinite(r)&&(n+=r)}t.set(o.key,n)}const r=(e,t)=>t>e?-1:e>t?1:0;if("asc"===o)n.sort((e,n)=>{const o=(t.get(e.key)??0)-(t.get(n.key)??0);return 0!==o?o:r(e.key,n.key)});else if("desc"===o)n.sort((e,n)=>{const o=(t.get(n.key)??0)-(t.get(e.key)??0);return 0!==o?o:r(e.key,n.key)});else{const e=[...n].sort((e,n)=>{const o=(t.get(n.key)??0)-(t.get(e.key)??0);return 0!==o?o:r(e.key,n.key)}),o=[],i=[];let s=0,a=0;for(const n of e)a>s?(o.push(n),s+=t.get(n.key)??0):(i.push(n),a+=t.get(n.key)??0);n.length=0,n.push(...i.reverse(),...o)}}else r();const i=e.config.curve&&"linear"!==e.config.curve?e.config.curve:void 0,s=e.config.normalize?"zero":e.config.baseline??"zero",{nodes:a,stackedTops:l}=function(e,t,n,o,r,i,s,a="zero"){const l=new Set;for(const t of e)for(const e of t.data){const t=n(e);Number.isFinite(t)&&l.add(t)}const c=Array.from(l).sort((e,t)=>e-t),u=new Map;for(const t of e){const e=new Map;for(const r of t.data){const t=n(r),i=o(r);Number.isFinite(t)&&Number.isFinite(i)&&e.set(t,(e.get(t)||0)+i)}u.set(t.key,e)}let h;if(i){h=new Map;for(const t of c){let n=0;for(const o of e)n+=u.get(o.key)?.get(t)||0;h.set(t,n||1)}}const d=qe(c,e.map(e=>e.key),(e,t)=>u.get(e)?.get(t)||0,a),f="diverging"===a&&!i,p=[],y=new Map,g=new Map,m=new Map,x=new Map;for(const e of c)g.set(e,d.get(e)??0),m.set(e,0),x.set(e,0);for(const n of e){const e=u.get(n.key),o=new Map;let a=[],l=[];const d=()=>{if(a.length>=2){const e={type:"area",topPath:a,bottomPath:l,style:r(n.key,n.data[0]),datum:n.data,group:n.key};s&&(e.curve=s),p.push(e)}a=[],l=[]};for(const n of c){const r=e.has(n);let s,c,u=r?e.get(n):0;if(i&&r&&(u/=h.get(n)),!r||!Number.isFinite(u)||0===u){d();continue}f?u>0?(s=m.get(n),c=s+u,m.set(n,c)):(s=x.get(n),c=s+u,x.set(n,c)):(s=g.get(n),c=s+u,g.set(n,c));const p=t.x(n);l.push([p,t.y(s)]),a.push([p,t.y(c)]),o.set(n,c)}d(),y.set(n.key,o)}return{nodes:p,stackedTops:y}}(n,e.scales,e.getX,e.getY,(t,n)=>e.resolveAreaStyle(t,n),e.config.normalize,i,s),c=a;if(e.config.pointStyle){const t=new WeakMap;for(const o of n){const n=l.get(o.key);if(n)for(const r of o.data){const o=e.getX(r),i=e.getY(r);null==o||Number.isNaN(o)||null==i||Number.isNaN(i)||!n.has(o)||t.set(r,n.get(o))}}const o=n=>t.get(n)??e.getY(n);ot(e,n,c,o)}return c}(r,t);case"scatter":case"bubble":return function(e,t){const n=[],o="bubble"===e.config.chartType?10:5,r=e.config.sizeRange||[3,15];let i=null;if(e.getSize&&!e.config.pointStyle){const n=t.map(t=>e.getSize(t)).filter(e=>null!=e&&!Number.isNaN(e));if(n.length>0){let e=1/0,t=-1/0;for(const o of n)e>o&&(e=o),o>t&&(t=o);i=n=>e===t?(r[0]+r[1])/2:r[0]+(n-e)/(t-e)*(r[1]-r[0])}}const s=e.getColor?e.resolveColorMap(t):null,a=e.config.themeSemantic?.primary||"#4e79a7",l=e.getSymbol,c=e.config.symbolMap,u=new Map;let h=0;const d=e=>{const t=c?.[e];if(t)return t;let n=u.get(e);return n||(n=lt[h%lt.length],h++,u.set(e,n)),n};for(const r of t){let t=e.config.pointStyle?e.config.pointStyle(r):{fill:a,opacity:.8},c=t.r||o;if(i&&e.getSize){const t=e.getSize(r);null==t||Number.isNaN(t)||(c=i(t))}if(s&&e.getColor&&!t.fill){const n=e.getColor(r);n&&s.has(n)&&(t={...t,fill:s.get(n)})}const u=e.getPointId?e.getPointId(r)+"":void 0;if(l){const o=d(l(r)+""),i=Ve(r,e.scales,e.getX,e.getY,Math.PI*c*c,o,t,u);i&&n.push(i)}else{const o=Xe(r,e.scales,e.getX,e.getY,c,t,u);o&&n.push(o)}}return n}(r,t);case"heatmap":return function(e,t,n){if(e.config.heatmapAggregation)return function(e,t,n){const o=Math.max(1,Math.floor(e.config.heatmapXBins??20)),r=Math.max(1,Math.floor(e.config.heatmapYBins??20)),i=e.config.heatmapAggregation??"count",s=oe(e.config.valueAccessor,"value");if(!e.scales||0===t.length)return[];const[a,l]=e.scales.x.domain(),[c,u]=e.scales.y.domain(),h=(l-a||1)/o,d=(u-c||1)/r,f=o*r;if(f>1e6)return[];const p=new Int32Array(f),y=new Float64Array(f);for(let n=0;t.length>n;n++){const i=t[n],l=e.getX(i),u=e.getY(i);if(!isFinite(l)||!isFinite(u))continue;const f=Math.min(Math.floor((l-a)/h),o-1),g=Math.min(Math.floor((u-c)/d),r-1);if(0>f||0>g)continue;const m=g*o+f;p[m]++;const x=s(i);y[m]+=isFinite(x)?x:0}let g=1/0,m=-1/0;for(let e=0;f>e;e++){if(0===p[e])continue;let t;switch(i){case"sum":t=y[e];break;case"mean":t=y[e]/p[e];break;default:t=p[e]}g>t&&(g=t),t>m&&(m=t)}if(!isFinite(g))return[];const x=m-g||1,b=n.width/o,v=n.height/r,k=e.config.showValues,w=e.config.heatmapValueFormat,A=[];for(let e=0;r>e;e++){const t=e*o;for(let n=0;o>n;n++){const o=t+n;if(0===p[o])continue;let s;switch(i){case"sum":s=y[o];break;case"mean":s=y[o]/p[o];break;default:s=p[o]}const l=(s-g)/x;A.push(Ke(n*b,(r-1-e)*v,b,v,`rgb(${220-(180*l+.5)|0},${220-(100*l+.5)|0},${255-(50*l+.5)|0})`,{xi:n,yi:e,value:s,count:p[o],sum:y[o],xCenter:a+(n+.5)*h,yCenter:c+(e+.5)*d,agg:i},k?{value:s,showValues:!0,valueFormat:w}:void 0))}}return A}(e,t,n);if(0===t.length)return[];const o=oe(e.config.valueAccessor,"value"),r=re(e.config.xAccessor,"x"),i=re(e.config.yAccessor,"y"),s=new Map,a=new Map,l=Array(t.length),c=Array(t.length);for(let e=0;t.length>e;e++){const n=t[e],o=r(n),u=i(n);l[e]=o,c[e]=u,s.has(o)||s.set(o,s.size),a.has(u)||a.set(u,a.size)}const u=s.size,h=a.size;if(0===u||0===h)return[];const d=Array.from(s.keys()),f=Array.from(a.keys()),p=d.every(e=>"number"==typeof e&&!isNaN(e)),y=f.every(e=>"number"==typeof e&&!isNaN(e));if(p){d.sort((e,t)=>e-t),s.clear();for(let e=0;d.length>e;e++)s.set(d[e],e)}if(y){f.sort((e,t)=>e-t),a.clear();for(let e=0;f.length>e;e++)a.set(f[e],e)}const g=new Float64Array(t.length),m=new Float64Array(t.length),x=Array(t.length),b=new Map;let v=0;for(let e=0;t.length>e;e++){const n=t[e],r=s.get(l[e]),i=a.get(c[e]);if(void 0===r||void 0===i)continue;const h=o(n),d=i*u+r,f=b.get(d);let p;void 0!==f?p=f:(p=v++,b.set(d,p)),g[p]=d,m[p]=h,x[p]=n}let k=1/0,w=-1/0;for(let e=0;v>e;e++){const t=m[e];isFinite(t)&&(k>t&&(k=t),t>w&&(w=t))}if(!isFinite(k)||!isFinite(w))return[];const A=function(e){const t=e in _e?e:"blues";let n=ht.get(t);if(n)return n;n=Array(256);const o=je(t);for(let e=0;256>e;e++)n[e]=o(e/255);return ht.set(t,n),n}("string"==typeof e.config.colorScheme?e.config.colorScheme:e.config.themeSequential||"blues"),S=255/(w-k||1),C=n.width/u,M=n.height/h,_=e.config.showValues,j=e.config.heatmapValueFormat,P=[];for(let e=0;v>e;e++){const t=m[e];if(!isFinite(t))continue;const n=g[e],o=n%u;P.push(Ke(o*C,(h-1-(n-o)/u)*M,C,M,A[Math.min((t-k)*S+.5|0,255)],x[e],_?{value:t,showValues:!0,valueFormat:j}:void 0))}return P}(r,t,e);case"bar":{const e=function(e,t){if(!e.config.binSize)return{nodes:[],binBoundaries:[]};const n=dt(t,e.getX,e.getY,e.config.binSize,e.getCategory);if(0===n.size)return{nodes:[],binBoundaries:[]};let o=null;if(e.getCategory){const t=new Set;for(const e of n.values())for(const n of e.categories.keys())t.add(n);const r=e.config.barColors?Object.keys(e.config.barColors):[],i=new Set(r),s=Array.from(t).filter(e=>!i.has(e)).sort(),a=r.filter(e=>t.has(e)),l=a.join("\0")+""+s.join("\0");e.barCategoryCache&&e.barCategoryCache.key===l?o=e.barCategoryCache.order:(o=[...a,...s],e.barCategoryCache={key:l,order:o})}const r=[],i=e.scales,[s,a]=i.x.domain(),l=e.config.barStyle,c=e.config.themeSemantic?.primary,u=l?.gap,h="number"!=typeof u||0>u?1:u,d={};l?.stroke&&(d.stroke=l.stroke),"number"==typeof l?.strokeWidth&&(d.strokeWidth=l.strokeWidth),"number"==typeof l?.opacity&&(d.opacity=l.opacity);for(const t of n.values()){const n=Math.max(t.start,s),u=Math.min(t.end,a);if(n>=u)continue;const f=i.x(n),p=i.x(u),y=Math.abs(p-f),g=y>h+1?h:0,m=Math.min(f,p)+g/2,x=Math.max(y-g,1);if(x>0)if(o&&t.categories.size>0){let n=0;for(const s of o){const o=t.categories.get(s)||0;if(0===o)continue;const a=i.y(n),u=i.y(n+o);r.push(Ue(m,Math.min(a,u),x,Math.abs(a-u),{fill:e.config.barColors?.[s]||l?.fill||c||"#4e79a7",...d},{binStart:t.start,binEnd:t.end,total:t.total,category:s,categoryValue:o},s)),n+=o}}else{const e=i.y(0),n=i.y(t.total);r.push(Ue(m,Math.min(e,n),x,Math.abs(e-n),{fill:l?.fill||c||"#007bff",...d},{binStart:t.start,binEnd:t.end,total:t.total}))}}const f=new Set;for(const e of n.values())f.add(e.start),f.add(e.end);return{nodes:r,binBoundaries:Array.from(f).sort((e,t)=>e-t)}}(r,t);return this._barCategoryCache=r.barCategoryCache??null,this._binBoundaries=e.binBoundaries,e.nodes}case"swarm":return function(e,t){const n=[],o=e.config.swarmStyle||{},r=o.radius??3,i=o.fill??e.config.themeSemantic?.primary??"#007bff",s=o.opacity??.7,a=o.stroke,l=o.strokeWidth;for(const o of t){const t=e.getX(o),c=e.getY(o);if(null==c||Number.isNaN(c))continue;const u=e.scales.x(t),h=e.scales.y(c);let d=i;if(e.getCategory){const t=e.getCategory(o);d=e.config.barColors?.[t]||d}const{r:f,...p}=e.config.pointStyle?.(o)??{},y={type:"point",x:u,y:h,r:f??r,style:{fill:d,opacity:s,stroke:a,strokeWidth:l,...p},datum:o};e.getPointId&&(y.pointId=e.getPointId(o)+""),n.push(y)}return n}(r,t);case"waterfall":return function(e,t,n){const o=[],r=e.scales,i=e.config.waterfallStyle,s=t.filter(t=>{const n=e.getY(t),o=e.getX(t);return null!=n&&!Number.isNaN(n)&&null!=o&&isFinite(o)});if(0===s.length)return o;const a=i?.positiveColor??e.config.themeSemantic?.success??"#28a745",l=i?.negativeColor??e.config.themeSemantic?.danger??"#dc3545",c=i?.gap??1,u=i?.stroke,h=i?.strokeWidth,d=i?.opacity;let f=0;for(let t=0;s.length>t;t++){const p=s[t],y=e.getX(p),g=e.getY(p),m=f+g;let x;x=s.length-1>t?e.getX(s[t+1])-y:t>0?y-e.getX(s[t-1]):0;const b=r.x(y),v=0!==x?r.x(y+x):b+n.width/10,k=Math.min(b,v)+c/2,w=Math.max(b,v)-c/2-k;if(0>=w){f=m;continue}const A=r.y(f),S=r.y(m),C=Math.min(A,S),M=Math.abs(A-S),_={fill:0>g?l:a,stroke:u,strokeWidth:h};null!=d&&(_.opacity=d),o.push(Ue(k,C,w,M,_,{...p,baseline:f,cumEnd:m,delta:g,_connectorStroke:i?.connectorStroke,_connectorWidth:i?.connectorWidth})),f=m}return o}(r,t,e);case"candlestick":return function(e,t){if(!e.getHigh||!e.getLow||!e.scales)return[];const n=e.config.candlestickRangeMode??!1;if(!(n||e.getOpen&&e.getClose))return[];const o=[],r=e.config.candlestickStyle||{},i=r.rangeColor||"#6366f1",s=n?i:r.upColor||"#28a745",a=n?i:r.downColor||"#dc3545",l=n?i:r.wickColor||"#333",c=r.wickWidth||(n?2:1),u=t.map(t=>e.getX(t)).filter(e=>null!=e&&!Number.isNaN(e)).sort((e,t)=>e-t);let h=r.bodyWidth??0;if(null==r.bodyWidth)if(u.length>1){let t=1/0;for(let n=1;u.length>n;n++){const o=Math.abs(e.scales.x(u[n])-e.scales.x(u[n-1]));o>0&&t>o&&(t=o)}h=t!==1/0?Math.max(2,Math.min(.6*t,20)):6}else h=6;for(const r of t){const t=e.getX(r);if(null==t||Number.isNaN(t))continue;const i=e.getHigh(r),u=e.getLow(r);if(null==i||Number.isNaN(i)||null==u||Number.isNaN(u))continue;const d=n?i:e.getOpen(r),f=n?u:e.getClose(r);if(!n&&[d,f].some(e=>null==e||Number.isNaN(e)))continue;const p=f>=d,y={type:"candlestick",x:e.scales.x(t),openY:e.scales.y(d),closeY:e.scales.y(f),highY:e.scales.y(i),lowY:e.scales.y(u),bodyWidth:h,upColor:s,downColor:a,wickColor:l,wickWidth:c,isUp:p,datum:r};n&&(y.isRange=!0),o.push(y)}return o}(r,t);default:return[]}}resolveBoundsStyle(e,t){return function(e,t,n,o){const r=e.boundsStyle;return"function"==typeof r?r(n||{},t):r&&"object"==typeof r?r:{fill:o(t,n).stroke||e.themeSemantic?.primary||"#4e79a7",fillOpacity:.2,stroke:"none"}}(this.config,e,t,(e,t)=>this.resolveLineStyle(e,t))}computeDecayOpacity(e,t){const n=this.config.decay;return n&&t>1?We(n,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._ingestVersion)return this._datumIndexCache.map;const t=ze(e);return this._datumIndexCache={version:this._ingestVersion,map:t},t}applyDecay(e,t){this.config.decay&&function(e,t,n,o=ze(n)){const r=n.length;if(r>1)for(const n of t){if("line"===n.type){const t=Array.isArray(n.datum)?n.datum:[];if(2>t.length)continue;const i=Array(t.length);let s=!1;for(let n=0;t.length>n;n++){const a=o.get(t[n]);null!=a?(i[n]=We(e,a,r),1>i[n]&&(s=!0)):i[n]=1}s&&(n._decayOpacities=i);continue}if("area"===n.type){const t=Array.isArray(n.datum)?n.datum:[],i=n.topPath?n.topPath.length:t.length;if(2>i)continue;if(t.length===i){const s=Array(i);let a=!1;for(let n=0;t.length>n;n++){const i=o.get(t[n]);null!=i?(s[n]=We(e,i,r),1>s[n]&&(a=!0)):s[n]=1}a&&(n._decayOpacities=s)}else{let s=1;for(const n of t){const t=o.get(n);if(null!=t){const n=We(e,t,r);s>n&&(s=n)}}if(1>s){const e=Array(i);e.fill(s),n._decayOpacities=e}}continue}const t=o.get(n.datum);if(null==t)continue;const i=We(e,t,r);"heatcell"===n.type?n.style={opacity:i}:"candlestick"===n.type?n._decayOpacity=i:n.style={...n.style,opacity:(n.style?.opacity??1)*i}}}(this.config.decay,e,t,this.getDatumIndexMap(t))}refreshPulse(e){return!0!==this.lastCustomLayoutFailure?.preservedLastGoodScene&&this.applyPulse(this.scene,this.getBufferArray(),e)}hasActivePulsesAt(e){return!!this.config.pulse&&function(e,t,n=("undefined"!=typeof performance?performance.now():Date.now())){if(!t||0===t.size)return!1;const o=e.duration??500,r=t.peek();return null!=r&&o>n-r}(this.config.pulse,this.timestampBuffer,e)}get hasActivePulses(){return this.hasActivePulsesAt(De())}get transitionContext(){return{runtimeMode:this.config.runtimeMode,getX:this.getX,getY:this.getY,getCategory:this.getCategory}}snapshotPositions(){!function(e,t,n,o){n.clear(),o.clear();for(let r=0;t.length>r;r++){const i=t[r],s=$e(e,i,r);s&&("point"===i.type?n.set(s,{x:i.x,y:i.y,r:i.r,opacity:i.style.opacity}):"glyph"===i.type?n.set(s,{x:i.x,y:i.y,r:i.size,opacity:i.style.opacity,glyph:i.glyph}):"rect"===i.type?n.set(s,{x:i.x,y:i.y,w:i.w,h:i.h,opacity:i.style.opacity}):"heatcell"===i.type?n.set(s,{x:i.x,y:i.y,w:i.w,h:i.h,opacity:i.style?.opacity}):"candlestick"===i.type?n.set(s,{x:i.x,y:i.openY,w:i.bodyWidth,openY:i.openY,closeY:i.closeY,highY:i.highY,lowY:i.lowY,opacity:i.style?.opacity}):"line"===i.type?o.set(s,{path:i.path.map(e=>[e[0],e[1]]),opacity:i.style?.opacity}):"area"===i.type&&o.set(s,{topPath:i.topPath.map(e=>[e[0],e[1]]),bottomPath:i.bottomPath.map(e=>[e[0],e[1]]),opacity:i.style?.opacity}))}}(this.transitionContext,this.scene,this.prevPositionMap,this.prevPathMap)}synthesizeIntroPositions(){this.prevPositionMap.clear(),this.prevPathMap.clear();const e=this.scales?.y(0)??0;for(let t=0;this.scene.length>t;t++){const n=this.scene[t],o=$e(this.transitionContext,n,t);o&&("point"===n.type?this.prevPositionMap.set(o,{x:n.x,y:n.y,r:0,opacity:0}):"rect"===n.type?this.prevPositionMap.set(o,{x:n.x,y:e,w:n.w,h:0,opacity:n.style.opacity??1}):"heatcell"===n.type?this.prevPositionMap.set(o,{x:n.x,y:n.y,w:n.w,h:n.h,opacity:0}):"line"===n.type?(n._introClipFraction=0,this.prevPathMap.set(o,{path:n.path.map(e=>[e[0],e[1]]),opacity:n.style.opacity})):"area"===n.type&&(n._introClipFraction=0,this.prevPathMap.set(o,{topPath:n.topPath.map(e=>[e[0],e[1]]),bottomPath:n.bottomPath.map(e=>[e[0],e[1]]),opacity:n.style.opacity})))}}startTransition(){if(!this.config.transition)return;const e=function(e,t,n,o,r){if(0===o.size&&0===r.size)return n;const i=t.duration??300;if(n.exitNodes.length>0){const e=new Set(n.exitNodes);n.scene=n.scene.filter(t=>!e.has(t)),n.exitNodes=[]}let s=!1;const a=new Set,l=new Set;for(let t=0;n.scene.length>t;t++){const i=n.scene[t],c=$e(e,i,t);if(!c)continue;if(i._transitionKey=c,"line"===i.type||"area"===i.type){const e=r.get(c);if(e){if(l.add(c),"line"===i.type&&e.path&&e.path.length===i.path.length){i._targetPath=i.path.map(e=>[e[0],e[1]]),i._prevPath=e.path;for(let t=0;i.path.length>t;t++)i.path[t]=[e.path[t][0],e.path[t][1]];s=!0}else if("area"===i.type&&e.topPath&&e.bottomPath&&e.topPath.length===i.topPath.length&&e.bottomPath.length===i.bottomPath.length){i._targetTopPath=i.topPath.map(e=>[e[0],e[1]]),i._targetBottomPath=i.bottomPath.map(e=>[e[0],e[1]]),i._prevTopPath=e.topPath,i._prevBottomPath=e.bottomPath;for(let t=0;i.topPath.length>t;t++)i.topPath[t]=[e.topPath[t][0],e.topPath[t][1]];for(let t=0;i.bottomPath.length>t;t++)i.bottomPath[t]=[e.bottomPath[t][0],e.bottomPath[t][1]];s=!0}i._targetOpacity=i.style.opacity??1,i._startOpacity=e.opacity??i.style.opacity??1}else i._targetOpacity=i.style.opacity??1,i._startOpacity=0,i.style={...i.style,opacity:0},s=!0;continue}const u=o.get(c);if("point"===i.type)if(u){a.add(c);const e={x:i.x,y:i.y,r:i.r};i._targetOpacity=i.style.opacity??1,u.x===e.x&&u.y===e.y&&u.r===e.r||(i._targetX=e.x,i._targetY=e.y,i._targetR=e.r,i.x=u.x,i.y=u.y,i.r=u.r??i.r,s=!0)}else i._targetOpacity=i.style.opacity??1,i.style={...i.style,opacity:0},s=!0;else if("glyph"===i.type)if(u){a.add(c);const e={x:i.x,y:i.y,size:i.size};i._targetOpacity=i.style.opacity??1,u.x===e.x&&u.y===e.y&&u.r===e.size||(i._targetX=e.x,i._targetY=e.y,i._targetR=e.size,i.x=u.x,i.y=u.y,i.size=u.r??i.size,s=!0)}else i._targetOpacity=i.style.opacity??1,i.style={...i.style,opacity:0},s=!0;else if("rect"===i.type)if(u){a.add(c);const e={x:i.x,y:i.y,w:i.w,h:i.h};i._targetOpacity=i.style.opacity??1,u.x===e.x&&u.y===e.y&&u.w===e.w&&u.h===e.h||(i._targetX=e.x,i._targetY=e.y,i._targetW=e.w,i._targetH=e.h,i.x=u.x,i.y=u.y,i.w=u.w??i.w,i.h=u.h??i.h,s=!0)}else i._targetOpacity=i.style.opacity??1,i.style={...i.style,opacity:0},s=!0;else if("heatcell"===i.type)if(u){a.add(c);const e={x:i.x,y:i.y,w:i.w,h:i.h};i._targetOpacity=i.style?.opacity??1,u.x===e.x&&u.y===e.y&&u.w===e.w&&u.h===e.h||(i._targetX=e.x,i._targetY=e.y,i._targetW=e.w,i._targetH=e.h,i.x=u.x,i.y=u.y,i.w=u.w??i.w,i.h=u.h??i.h,s=!0)}else i._targetOpacity=i.style?.opacity??1,i.style={...i.style||{},opacity:0},s=!0;else if("candlestick"===i.type)if(u&&null!=u.openY){a.add(c);const e={x:i.x,openY:i.openY,closeY:i.closeY,highY:i.highY,lowY:i.lowY};i._targetOpacity=i.style?.opacity??1,(u.x!==e.x||u.openY!==e.openY||u.closeY!==e.closeY||u.highY!==e.highY||u.lowY!==e.lowY)&&(i._targetX=e.x,i._targetOpenY=e.openY,i._targetCloseY=e.closeY,i._targetHighY=e.highY,i._targetLowY=e.lowY,i.x=u.x,i.openY=u.openY,i.closeY=u.closeY??i.closeY,i.highY=u.highY??i.highY,i.lowY=u.lowY??i.lowY,s=!0)}else i._targetOpacity=i.style?.opacity??1,i.style={...i.style||{},opacity:0},s=!0}for(const[e,t]of r)if(!l.has(e))if(e.startsWith("l:")&&t.path){const o={type:"line",path:t.path.map(e=>[e[0],e[1]]),group:e.slice(2),style:{stroke:"#999",strokeWidth:1,opacity:t.opacity??1},_targetOpacity:0,_transitionKey:e,datum:null};n.exitNodes.push(o),s=!0}else if(e.startsWith("a:")&&t.topPath&&t.bottomPath){const o={type:"area",topPath:t.topPath.map(e=>[e[0],e[1]]),bottomPath:t.bottomPath.map(e=>[e[0],e[1]]),group:e.slice(2),style:{fill:"#999",opacity:t.opacity??1},_targetOpacity:0,_transitionKey:e,datum:null};n.exitNodes.push(o),s=!0}for(const[e,t]of o)if(!a.has(e)){if(e.startsWith("p:"))n.exitNodes.push({type:"point",x:t.x,y:t.y,r:t.r??3,style:{opacity:t.opacity??1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("g:")&&t.glyph)n.exitNodes.push({type:"glyph",x:t.x,y:t.y,size:t.r??12,glyph:t.glyph,color:"#999",accent:"#999",style:{opacity:t.opacity??1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("r:"))n.exitNodes.push({type:"rect",x:t.x,y:t.y,w:t.w??0,h:t.h??0,style:{opacity:t.opacity??1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("h:"))n.exitNodes.push({type:"heatcell",x:t.x,y:t.y,w:t.w??0,h:t.h??0,fill:"#999",datum:null,style:{opacity:t.opacity??1},_targetOpacity:0,_transitionKey:e});else if(e.startsWith("c:")){const o=t.openY??t.y;n.exitNodes.push({type:"candlestick",x:t.x,openY:o,closeY:t.closeY??o,highY:t.highY??o,lowY:t.lowY??o,bodyWidth:t.w??6,upColor:"#999",downColor:"#999",wickColor:"#999",wickWidth:1,isUp:!0,datum:null,style:{opacity:t.opacity??1},_targetOpacity:0,_transitionKey:e})}s=!0}return n.exitNodes.length>0&&(n.scene=[...n.scene,...n.exitNodes]),s&&(n.activeTransition={startTime:De(),duration:i}),n}(this.transitionContext,this.config.transition,{scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},this.prevPositionMap,this.prevPathMap);this.scene=e.scene,this.exitNodes=e.exitNodes,this.activeTransition=e.activeTransition}advanceTransition(e){if(!this.activeTransition||!this.config.transition)return!1;const t={scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},n=function(e,t,n,o){if(!n.activeTransition)return!1;const r=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,n.activeTransition),i=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(r,"linear"===t.easing?"linear":"ease-out-cubic");for(const e of n.scene){const t=e._transitionKey;if("point"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0;e.style.opacity=Oe(n?n.opacity??1:0,e._targetOpacity,i)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=Oe(n.x,e._targetX,i),e.y=Oe(n.y,e._targetY,i),void 0!==e._targetR&&void 0!==n.r&&(e.r=Oe(n.r,e._targetR,i))}else if("glyph"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0;e.style.opacity=Oe(n?n.opacity??1:0,e._targetOpacity,i)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=Oe(n.x,e._targetX,i),e.y=Oe(n.y,e._targetY,i),void 0!==e._targetR&&void 0!==n.r&&(e.size=Oe(n.r,e._targetR,i))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0;e.style.opacity=Oe(n?n.opacity??1:0,e._targetOpacity,i)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=Oe(n.x,e._targetX,i),e.y=Oe(n.y,e._targetY,i),void 0!==n.w&&(e.w=Oe(n.w,e._targetW,i)),void 0!==n.h&&(e.h=Oe(n.h,e._targetH,i))}else if("heatcell"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0;e.style={...e.style||{},opacity:Oe(n?n.opacity??1:0,e._targetOpacity,i)}}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=Oe(n.x,e._targetX,i),e.y=Oe(n.y,e._targetY,i),void 0!==n.w&&(e.w=Oe(n.w,e._targetW,i)),void 0!==n.h&&(e.h=Oe(n.h,e._targetH,i))}else if("candlestick"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0;e.style={...e.style||{},opacity:Oe(n?n.opacity??1:0,e._targetOpacity,i)}}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=Oe(n.x,e._targetX,i),void 0!==n.openY&&(e.openY=Oe(n.openY,e._targetOpenY,i)),void 0!==n.closeY&&(e.closeY=Oe(n.closeY,e._targetCloseY,i)),void 0!==n.highY&&(e.highY=Oe(n.highY,e._targetHighY,i)),void 0!==n.lowY&&(e.lowY=Oe(n.lowY,e._targetLowY,i))}else if("line"===e.type){void 0!==e._targetOpacity&&(e.style={...e.style,opacity:Oe(e._startOpacity??0,e._targetOpacity,i)}),void 0!==e._introClipFraction&&(e._introClipFraction=i);const t=e._prevPath,n=e._targetPath;if(t&&n&&t.length===e.path.length)for(let o=0;e.path.length>o;o++)e.path[o][0]=Oe(t[o][0],n[o][0],i),e.path[o][1]=Oe(t[o][1],n[o][1],i)}else if("area"===e.type){void 0!==e._targetOpacity&&(e.style={...e.style,opacity:Oe(e._startOpacity??0,e._targetOpacity,i)}),void 0!==e._introClipFraction&&(e._introClipFraction=i);const t=e._prevTopPath,n=e._prevBottomPath,o=e._targetTopPath,r=e._targetBottomPath;if(t&&o&&t.length===e.topPath.length)for(let n=0;e.topPath.length>n;n++)e.topPath[n][0]=Oe(t[n][0],o[n][0],i),e.topPath[n][1]=Oe(t[n][1],o[n][1],i);if(n&&r&&n.length===e.bottomPath.length)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t][0]=Oe(n[t][0],r[t][0],i),e.bottomPath[t][1]=Oe(n[t][1],r[t][1],i)}}if(r>=1){for(const e of n.scene){if(void 0!==e._targetOpacity){const t=e._targetOpacity;e.style="line"===e.type||"area"===e.type?{...e.style,opacity:0===t?0:t}:{...e.style||{},opacity:0===t?0:t},e._targetOpacity=void 0}if("point"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("glyph"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,void 0!==e._targetR&&(e.size=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else if("heatcell"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else if("candlestick"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,void 0!==e._targetOpenY&&(e.openY=e._targetOpenY),void 0!==e._targetCloseY&&(e.closeY=e._targetCloseY),void 0!==e._targetHighY&&(e.highY=e._targetHighY),void 0!==e._targetLowY&&(e.lowY=e._targetLowY),e._targetX=void 0,e._targetOpenY=void 0,e._targetCloseY=void 0,e._targetHighY=void 0,e._targetLowY=void 0}else if("line"===e.type){const t=e._targetPath;if(t)for(let n=0;e.path.length>n;n++)e.path[n]=t[n];e._prevPath=void 0,e._targetPath=void 0,e._introClipFraction=void 0}else if("area"===e.type){const t=e._targetTopPath,n=e._targetBottomPath;if(t)for(let n=0;e.topPath.length>n;n++)e.topPath[n]=t[n];if(n)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t]=n[t];e._prevTopPath=void 0,e._prevBottomPath=void 0,e._targetTopPath=void 0,e._targetBottomPath=void 0,e._introClipFraction=void 0}}if(n.exitNodes.length>0){const e=new Set(n.exitNodes);n.scene=n.scene.filter(t=>!e.has(t)),n.exitNodes=[]}return n.activeTransition=null,!1}return!0}(e,this.config.transition,t,this.prevPositionMap);return this.scene=t.scene,this.exitNodes=t.exitNodes,this.activeTransition=t.activeTransition,n}cancelIntroAnimation(){this.prevPositionMap.clear(),this.prevPathMap.clear(),this.activeTransition=null;for(const e of this.scene)"line"!==e.type&&"area"!==e.type||(e._introClipFraction=void 0)}groupData(e){const{result:t,cache:n}=function(e,t,n,o){if(o&&o.version===n&&o.group===t&&o.data===e)return{result:o.result,cache:o};let r;if(t){const n=new Map;for(const o of e){const e=t(o);n.has(e)||n.set(e,[]),n.get(e).push(o)}r=Array.from(n.entries()).map(([e,t])=>({key:e,data:t}))}else r=[{key:"_default",data:e}];return{result:r,cache:{version:n,group:t,data:e,result:r}}}(e,this.getGroup,this._ingestVersion,this._groupDataCache);return this._groupDataCache=n,t}resolveColorMap(e){const{map:t,cache:n}=function(e,t,n,o,r){if(r&&r.version===o)return{map:r.map,cache:r};const i=new Set;if(t)for(const n of e){const e=t(n);e&&i.add(e)}const s=Array.from(i).sort(),a=s.join("\0");if(r&&r.key===a){const e={...r,version:o};return{map:e.map,cache:e}}const l=Array.isArray(n.colorScheme)?n.colorScheme:n.themeCategorical||Re,c=new Map;for(let e=0;s.length>e;e++)c.set(s[e],l[e%l.length]);return{map:c,cache:{key:a,map:c,version:o}}}(e,this.getColor,this.config,this._ingestVersion,this._colorMapCache);return this._colorMapCache=n,t}resolveLineStyle(e,t){return function(e,t,n,o){const r=e.lineStyle;if("function"==typeof r){const e=r(n||{},t);if(e&&!e.stroke&&t){const n=o(t);if(n)return{...e,stroke:n}}return e}const i=e.themeSemantic?.primary;return r&&"object"==typeof r?{stroke:r.stroke||i||"#007bff",strokeWidth:r.strokeWidth||2,strokeDasharray:r.strokeDasharray,fill:r.fill,fillOpacity:r.fillOpacity,opacity:r.opacity}:{stroke:o(t)||i||"#007bff",strokeWidth:2}}(this.config,e,t,e=>this.resolveGroupColor(e))}resolveAreaStyle(e,t){return function(e,t,n,o){if(e.areaStyle){const r=e.areaStyle(n||{});if(r&&!r.fill&&t){const e=o(t);if(e)return{...r,fill:e,stroke:r.stroke||e}}return r}const r=e.lineStyle;if("function"==typeof r){const e=r(n||{},t);if(e&&!e.fill&&t){const n=o(t);if(n)return{...e,fill:n,stroke:e.stroke||n}}return e}const i=e.themeSemantic?.primary;if(r&&"object"==typeof r)return{fill:r.fill||r.stroke||i||"#4e79a7",fillOpacity:r.fillOpacity??.7,stroke:r.stroke||i||"#4e79a7",strokeWidth:r.strokeWidth||2};const s=o(t)||i||"#4e79a7";return{fill:s,fillOpacity:.7,stroke:s,strokeWidth:2}}(this.config,e,t,e=>this.resolveGroupColor(e))}resolveGroupColor(t){const{color:n,groupColorCounter:o}=function(e){const{group:t,colorMapCache:n,groupColorMap:o,groupColorMapCap:r,config:i}=e;let{groupColorCounter:s}=e;if(n){const e=n.map.get(t);if(e)return{color:e,groupColorCounter:s}}const a=o.get(t);if(a)return{color:a,groupColorCounter:s};const l=(Array.isArray(i.colorScheme)&&i.colorScheme.length>0?i.colorScheme:null)||(Array.isArray(i.themeCategorical)&&i.themeCategorical.length>0?i.themeCategorical:null)||Re;if(0===l.length)return{color:null,groupColorCounter:s};const c=l[s%l.length];if(s++,o.set(t,c),o.size>r){const e=o.keys().next().value;void 0!==e&&o.delete(e)}return{color:c,groupColorCounter:s}}({group:t,colorMapCache:this._colorMapCache,groupColorMap:this._groupColorMap,groupColorCounter:this._groupColorCounter,groupColorMapCap:e.GROUP_COLOR_MAP_CAP,config:this.config});return this._groupColorCounter=o,n}getBufferArray(){return!this._bufferDirty&&this._bufferArrayCache||(this._bufferArrayCache=this.buffer.toArray(),this._bufferDirty=!1),this._bufferArrayCache}getData(){return this.getBufferArray()}getLastUpdateResult(){return this.updateResults.last}remove(e){if(!this.getPointId)throw Error("remove() requires pointIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=ce(e),n=this.getPointId,o=e=>t.has(n(e));!function(e,t,n){if(!t||0===t.size)return;const o=new Set;if(e.forEach((e,t)=>{n(e)&&o.add(t)}),0===o.size)return;const r=t.toArray();t.clear();for(let e=0;r.length>e;e++)o.has(e)||t.push(r[e])}(this.buffer,this.timestampBuffer,o);const r=this.buffer.remove(o);if(0===r.length)return this.updateResults.recordNoop("remove"),r;for(const e of r)this.xExtent.evict(this.getX(e)),this.evictDatumYExtent(e);return this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,this.lastIngestTime=De(),this.updateResults.recordData("remove",r.length),r}update(e,t){if(!this.getPointId)throw Error("update() requires pointIdAccessor to be configured");const n=ce(e),o=this.getPointId,r=new Set;this.buffer.forEach((e,t)=>{n.has(o(e))&&r.add(t)});const i=this.buffer.update(e=>n.has(o(e)),t);if(0===i.length)return this.updateResults.recordNoop("update"),i;for(const e of i)this.xExtent.evict(this.getX(e)),this.evictDatumYExtent(e);return this.buffer.forEach((e,t)=>{r.has(t)&&(this.xExtent.push(this.getX(e)),this.pushDatumYExtent(e))}),this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,this.lastIngestTime=De(),this.updateResults.recordData("update",i.length),i}getBinBoundaries(){return this._binBoundaries}getExtents(){return this.xExtent.min===1/0?null:{x:this.xExtent.extent,y:this.yExtent.extent}}clear(){this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.prevPathMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this._lastBoundedInsertsRef=null,this.needsFullRebuild=!0,this._bufferDirty=!0,this._bufferArrayCache=null,this._datumIndexCache=null,this.lastLayout=null,this.scales=null,this.scene=[],this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.spatialIndex.clear(),this._colorMapCache=null,this._groupDataCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this.version++,this.updateResults.recordData("clear")}get size(){return this.buffer.size}getBuffer(){return this.buffer}getXAccessor(){return this.getX}getYAccessor(){return this.getY}getCategoryAccessor(){return this.getCategory}setLayoutSelection(e){this.config.layoutSelection=e}applyCustomRestyle(e,t){const n=this._customRestyle;if(n)for(const o of e){const e=this._baseStyles.get(o)??o.style??{},r=n(o,t);o.style=r?{...e,...r}:e}}consumeStylePaintPending(){const e=this._stylePaintPending;return this._stylePaintPending=!1,e}restyleScene(e){this._customRestyle?(this.applyCustomRestyle(this.scene,e),this._stylePaintPending=!0,this.updateResults.recordRestyle(!0)):this.updateResults.recordRestyle(!1)}updateConfig(e){const t={...this.config},n=Object.keys(e).filter(n=>e[n]!==t[n]);"production"!==process.env.NODE_ENV&&!this.windowSizeWarned&&"windowSize"in e&&e.windowSize!==t.windowSize&&(this.windowSizeWarned=!0,console.warn(`[Semiotic] windowSize changed after mount (${t.windowSize} → ${e.windowSize}) but it is a mount-only setting — the ring buffer keeps its original capacity. Remount the chart (e.g. via a React key) to apply a new windowSize.`)),("colorScheme"in e||"themeCategorical"in e||"colorAccessor"in e)&&(this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0),("barColors"in e||"colorScheme"in e)&&(this._barCategoryCache=null),("normalize"in e||"extentPadding"in e||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e||"boundsAccessor"in e||"band"in e||"y0Accessor"in e||"openAccessor"in e||"highAccessor"in e||"lowAccessor"in e||"closeAccessor"in e||"groupAccessor"in e||"categoryAccessor"in e||"chartType"in e||"runtimeMode"in e)&&(this._stackExtentCache=null);let o=!1,r=!1;Object.assign(this.config,e),"pulse"in e&&this.syncPulseTimestampBuffer();const i="chartType"in e&&e.chartType!==t.chartType||"runtimeMode"in e&&e.runtimeMode!==t.runtimeMode;if(i||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e){const e=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode,n=e&&this.config.valueAccessor||this.config.yAccessor,s=e&&t.valueAccessor||t.yAccessor,a=i||!ne(e&&this.config.timeAccessor||this.config.xAccessor,e&&t.timeAccessor||t.xAccessor),l=i||!ne(n,s);(a||l)&&(e?(this.getX=oe(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=oe(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=oe(this.config.xAccessor,"x"),this.getY=oe(this.config.yAccessor,"y")),l&&this.resolvedRibbons.some(e=>"bounds"===e.kind)&&(this.resolvedRibbons=gt(this.config)),o=!0,r=!0)}if("groupAccessor"in e&&!ne(e.groupAccessor,t.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?ie(this.config.groupAccessor):void 0,o=!0),"categoryAccessor"in e&&!ne(e.categoryAccessor,t.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?ie(this.config.categoryAccessor):void 0,o=!0),"sizeAccessor"in e&&!ne(e.sizeAccessor,t.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?oe(this.config.sizeAccessor,"size"):void 0,o=!0),"symbolAccessor"in e&&!ne(e.symbolAccessor,t.symbolAccessor)&&(this.getSymbol=null!=this.config.symbolAccessor?ie(this.config.symbolAccessor):void 0,o=!0),"colorAccessor"in e&&!ne(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?ie(this.config.colorAccessor):void 0,o=!0),"y0Accessor"in e&&!ne(e.y0Accessor,t.y0Accessor)&&(this.getY0=this.config.y0Accessor?oe(this.config.y0Accessor,"y0"):void 0,o=!0,r=!0),("boundsAccessor"in e&&!ne(e.boundsAccessor,t.boundsAccessor)||"band"in e&&e.band!==t.band||"boundsStyle"in e&&e.boundsStyle!==t.boundsStyle)&&(this.resolvedRibbons=gt(this.config),o=!0,r=!0),"pointIdAccessor"in e&&!ne(e.pointIdAccessor,t.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?ie(this.config.pointIdAccessor):void 0,o=!0),"candlestick"===this.config.chartType&&(i||"openAccessor"in e&&!ne(e.openAccessor,t.openAccessor)||"closeAccessor"in e&&!ne(e.closeAccessor,t.closeAccessor)||"highAccessor"in e&&!ne(e.highAccessor,t.highAccessor)||"lowAccessor"in e&&!ne(e.lowAccessor,t.lowAccessor))){const e=null!=this.config.openAccessor,t=null!=this.config.closeAccessor;this.getOpen=e?oe(this.config.openAccessor,"open"):void 0,this.getHigh=oe(this.config.highAccessor,"high"),this.getLow=oe(this.config.lowAccessor,"low"),this.getClose=t?oe(this.config.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!e&&!t,o=!0,r=!0}if("accessorRevision"in e&&e.accessorRevision!==t.accessorRevision&&(o=!0,r=!0),!o){const n=Object.keys(e).filter(e=>!e.endsWith("Accessor")&&"timeAccessor"!==e&&"valueAccessor"!==e);for(const r of n)if(e[r]!==t[r]){o=!0;break}}o&&(r&&this.rebuildExtents(),this.needsFullRebuild=!0),this.updateResults.recordConfig(n,o,r)}updateConfigWithResult(e){return this.updateConfig(e),this.updateResults.last}};Rt.GROUP_COLOR_MAP_CAP=1e3;var It=Rt,Nt={sceneGeometry:0,layout:0,domain:0},Ft="production"!==process.env.NODE_ENV,Tt={revisions:Nt,signature:"",sawSignals:!1,wasUnconsumed:!1,warnUnconsumed:!1},Bt=class{constructor(){this.lastConsumed=Nt,this.lastDuplicateWarning="",this.lastUnconsumedWarning=""}beforeCompute(e,t){if(!Ft)return Tt;const n=function(e){const{domain:t,layout:n,sceneGeometry:o}=e.revisions;return{domain:t,layout:n,sceneGeometry:o}}(e),o=function(e){return`${e.sceneGeometry}|${e.layout}|${e.domain}`}(n),r=!((i=n).sceneGeometry===(s=this.lastConsumed).sceneGeometry&&i.layout===s.layout&&i.domain===s.domain);var i,s;return{revisions:n,signature:o,sawSignals:e.changed.has("scene-geometry")||e.changed.has("layout")||e.changed.has("domain"),wasUnconsumed:r,warnUnconsumed:!t&&r&&this.lastUnconsumedWarning!==o}}afterCompute(e,t,n){if(Ft){if(t&&e.wasUnconsumed&&(this.lastConsumed=e.revisions),e.warnUnconsumed&&!t)return console.warn(`[semiotic] StreamXYFrame observed scene-affecting revisions without a scene rebuild: ${e.signature}.`),void(this.lastUnconsumedWarning=e.signature);t&&e.sawSignals&&!e.wasUnconsumed&&!n&&this.lastDuplicateWarning!==e.signature?(console.warn(`[semiotic] StreamXYFrame performed scene rebuild with unchanged scene revisions: ${e.signature}.`),this.lastDuplicateWarning=e.signature):t&&!e.sawSignals&&(this.lastDuplicateWarning="")}}},Ot=c(require("react"));function Dt(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:Ot.createElement(Ot.Fragment,null,...t)}var Wt=c(require("react")),zt=require("react/jsx-runtime"),Ht={isActive:!1,predicate:()=>!0},Et=Wt.createContext(null);function $t({value:e,children:t}){return(0,zt.jsx)(Et.Provider,{value:e,children:t})}function Yt(){return Wt.useContext(Et)??Ht}function Gt(e,t){return null!=e?(0,zt.jsx)($t,{value:t,children:e}):e}var qt=require("react");function Xt(e,t,n){return n.x>e||e>n.x+n.w||n.y>t||t>n.y+n.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:n.x+n.w/2,cy:n.y+n.h/2}}function Vt(e,t=30){return Math.max((e??4)+5,12,t)}function Ut(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function Kt(e,t){const n=Ut(e);if(!n)return!1;const o=Ut(t);return!o||n.getFullYear()!==o.getFullYear()||n.getMonth()!==o.getMonth()}var Qt=[40,40],Zt=[.5,.5];function Jt(e,t){const[n,o]=e.viewBox??Qt,[r,i]=e.anchor??Zt,s=o>0?o:1,a=Math.max(0,t)/s,l=(n>0?n:s)*a,c=s*a;return{width:l,height:c,scale:a,offsetX:-r*l,offsetY:-i*c}}function en(e,t){const n=Jt(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 tn(e,t,n,o){if("none"!==e)return"color"===e||null==e?t??o:"accent"===e?n:e}var nn=null;function on(e){if("undefined"==typeof Path2D)return null;nn||(nn=new Map);const t=nn.get(e);if(t)return t;const n=new Path2D(e);return nn.size>1024&&nn.clear(),nn.set(e,n),n}function rn(e,t,n=0,o="horizontal"){const[r,i]=e.viewBox??Qt,s=Math.min(1,Math.max(0,n)),a=Math.min(1,Math.max(0,t));return a>s?s>0||1>a?"vertical"===o?{x:0,y:i*(1-a),width:r,height:i*(a-s)}:{x:r*s,y:0,width:r*(a-s),height:i}:null:{x:0,y:0,width:0,height:0}}function sn(e,t){const n=Jt(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 an(e,t,n,o,r,i=e=>e){for(const s of t.parts){const t=on(s.d);if(!t)continue;const a=s.opacity??1,l=e.globalAlpha;1!==a&&(e.globalAlpha=l*a);const c=r?"none"===s.fill?void 0:r:tn(s.fill,n,o);c&&(e.fillStyle=i(c),e.fill(t));const u=r?s.stroke&&"none"!==s.stroke?r:void 0:tn(s.stroke??"none",n,o);u&&(e.strokeStyle=i(u),e.lineWidth=s.strokeWidth??1,e.lineCap=s.strokeLinecap??"butt",e.lineJoin=s.strokeLinejoin??"miter",e.stroke(t)),1!==a&&(e.globalAlpha=l)}}var ln=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,cn=new WeakMap,un=0,hn=!1,dn=null,fn=null;function pn(e,t){if(!t)return t;const n=ln.exec(t);if(!n)return t;const o=e.canvas;if(!o)return n[2]?.trim()||t;!function(){if(hn)return;if("undefined"==typeof window||"undefined"==typeof document)return;hn=!0;const e=()=>{un++};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{dn=window.matchMedia("(prefers-color-scheme: dark)"),fn=e,"function"==typeof dn.addEventListener?dn.addEventListener("change",fn):"function"==typeof dn.addListener&&dn.addListener(fn)}catch{}}();let r=cn.get(o);r&&r.version===un||(r={version:un,map:new Map},cn.set(o,r));const i=r.map.get(t);if(void 0!==i)return i;const s=getComputedStyle(o).getPropertyValue(n[1]).trim()||n[2]?.trim()||t;return r.map.set(t,s),s}var yn=require("d3-shape");function gn(e){switch(e){case"monotoneX":return yn.curveMonotoneX;case"monotoneY":return yn.curveMonotoneY;case"cardinal":return yn.curveCardinal;case"catmullRom":return yn.curveCatmullRom;case"step":return yn.curveStep;case"stepBefore":return yn.curveStepBefore;case"stepAfter":return yn.curveStepAfter;case"basis":return yn.curveBasis;case"natural":return yn.curveNatural;default:return null}}function mn(e,t,n){return null==t?n:"string"!=typeof t?t:pn(e,t)||n}function xn(e,t,n,o,r,i,s){if("colorStops"in t){const n=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>n.length)return null;const a=e.createLinearGradient(o,r,i,s);for(const e of n)a.addColorStop(e.offset,e.color);return a}const{topOpacity:a,bottomOpacity:l}=t;if(!Number.isFinite(a)||!Number.isFinite(l))return null;const c=Math.max(0,Math.min(1,a)),u=Math.max(0,Math.min(1,l)),h=e.createLinearGradient(o,r,i,s),[d,f,p]=function(e,t){const n=e.fillStyle,o="#010203";try{e.fillStyle=o,e.fillStyle=t}catch{return e.fillStyle=n,[78,121,167]}const r=e.fillStyle;if(e.fillStyle=n,"string"!=typeof r)return[78,121,167];if(r.toLowerCase()===o&&t.trim().toLowerCase()!==o)return[78,121,167];if(r.startsWith("#"))return[parseInt(r.slice(1,3),16),parseInt(r.slice(3,5),16),parseInt(r.slice(5,7),16)];const i=r.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return i?[+i[1],+i[2],+i[3]]:[78,121,167]}(e,n);return h.addColorStop(0,`rgba(${d},${f},${p},${c})`),h.addColorStop(1,`rgba(${d},${f},${p},${u})`),h}function bn(e,t,n,o,r,i){const s=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>s.length)return null;const a=e.createLinearGradient(n,o,r,i);for(const e of s)a.addColorStop(e.offset,e.color);return a}var vn=require("d3-shape"),kn=new WeakMap;function wn(e,t){const n=gn(t);if(!n)return e;const o=kn.get(e);if(o)return o;const r=function(e,t,n=8){if(!t||2>e.length)return e.map(([e,t])=>[e,t]);const o=[];let r=null;const i={moveTo(e,t){r=[e,t],o.push([e,t])},lineTo(e,t){r=[e,t],o.push([e,t])},bezierCurveTo(e,t,i,s,a,l){if(!r)return r=[a,l],void o.push([a,l]);const[c,u]=r;for(let r=1;n>=r;r++){const h=r/n,d=1-h;o.push([d*d*d*c+3*d*d*h*e+3*d*h*h*i+h*h*h*a,d*d*d*u+3*d*d*h*t+3*d*h*h*s+h*h*h*l])}r=[a,l]},closePath(){},arc(){},rect(){},arcTo(){},quadraticCurveTo(e,t,n,i){r=[n,i],o.push([n,i])}};return(0,vn.line)().x(e=>e[0]).y(e=>e[1]).curve(t).context(i)(e),o}(e,n);return kn.set(e,r),r}function An(e,t,n,o=30,r,i=0){let s=null;if(r){const e=function(e,t,n,o,r,i=e=>e.x,s=e=>e.y,a=e=>e.r){const l=Math.max(o,r+5,12),c=t-l,u=t+l,h=n-l,d=n+l;let f=null,p=1/0;return e.visit((e,r,l,y,g)=>{if(r>u||c>y||l>d||h>g)return!0;if(!e.length){let r=e;do{const e=r.data,l=i(e)-t,c=s(e)-n,u=Math.sqrt(l*l+c*c);Vt(a(e),o)>=u&&p>u&&(f=e,p=u),r=r.next}while(r)}return!1}),f?{node:f,distance:p}:null}(r,t,n,o,i);e&&(s={node:e.node,datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const i of e){let e=null;switch(i.type){case"point":if(r)break;e=Cn(i,t,n,o);break;case"symbol":e=Mn(i,t,n,o);break;case"glyph":e=_n(i,t,n,o);break;case"line":e=jn(i,t,n,o);break;case"rect":if(null==i.datum)break;e=Ln(i,t,n);break;case"heatcell":e=Rn(i,t,n);break;case"area":if(!1===i.interactive)break;e=Nn(i,t,n);break;case"candlestick":e=In(i,t,n)}e&&o>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}function Sn(e,t,n){if(0===e.length)return null;if(e[0][0]>t||t>e[e.length-1][0])return null;const o=Fn(e,t);if(0>o)return null;if(Math.abs(e[o][0]-t)>n)return null;let r=o,i=o;o>0&&e[o][0]>=t?(r=o-1,i=o):e.length-1>o&&(r=o,i=o+1);const[s,a]=e[r],[l,c]=e[i];return l===s?a:a+Math.max(0,Math.min(1,(t-s)/(l-s)))*(c-a)}function Cn(e,t,n,o=30){const r=t-e.x,i=n-e.y,s=Math.sqrt(r*r+i*i);return s>Vt(e.r,o)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:s}}function Mn(e,t,n,o=30){const r=t-e.x,i=n-e.y,s=Math.sqrt(r*r+i*i);return s>Vt(ut(e.size),o)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:s}}function _n(e,t,n,o=30){if(null==e.datum)return null;const r=sn(e.glyph,e.size),i=e.x+r.centerDx,s=e.y+r.centerDy,a=t-i,l=n-s,c=Math.sqrt(a*a+l*l);return c>Vt(r.radius,o)?null:{node:e,datum:e.datum,x:i,y:s,distance:c}}function jn(e,t,n,o=30){if(0===e.path.length)return null;const r=Fn(e.path,t);if(0>r)return null;const[i,s]=e.path[r];let a;if(e.path.length>1){let o=1/0;const i=Math.max(0,r-1),s=Math.min(e.path.length-2,r);for(let r=i;s>=r;r++){const[i,s]=e.path[r],[a,l]=e.path[r+1],c=Pn(t,n,i,s,a,l);o>c&&(o=c)}a=o}else{const e=t-i,o=n-s;a=Math.sqrt(e*e+o*o)}const l=e.style;return a>Math.max(5,(l.strokeWidth??l.lineWidth??1)/2+2,o)?null:{node:e,datum:Array.isArray(e.datum)&&e.datum[r]?e.datum[r]:e.datum,x:i,y:s,distance:a}}function Pn(e,t,n,o,r,i){const s=r-n,a=i-o,l=s*s+a*a;if(0===l)return Math.sqrt((e-n)**2+(t-o)**2);let c=((e-n)*s+(t-o)*a)/l;return c=Math.max(0,Math.min(1,c)),Math.sqrt((e-(n+c*s))**2+(t-(o+c*a))**2)}function Ln(e,t,n){const o=Xt(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function Rn(e,t,n){const o=Xt(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function In(e,t,n){const o=e.bodyWidth/2,r=Math.min(e.openY,e.closeY);if(!(e.x-o-3>t||t>e.x+o+3||e.highY-3>n||n>e.lowY+3)){const o=r+Math.max(Math.max(e.openY,e.closeY)-r,1)/2,i=t-e.x,s=n-o;return{node:e,datum:e.datum,x:e.x,y:o,distance:Math.sqrt(i*i+s*s)}}return null}function Nn(e,t,n){if(0===e.topPath.length)return null;const o=Fn(e.topPath,t);if(0>o)return null;const[r,i]=e.topPath[o],s=t-r,a=n-i,l=Math.sqrt(s*s+a*a);return{node:e,datum:Array.isArray(e.datum)&&e.datum[o]?e.datum[o]:e.datum,x:r,y:i,distance:l}}function Fn(e,t){if(0===e.length)return-1;let n=0,o=e.length-1;for(;o>n;){const r=n+o>>1;t>e[r][0]?n=r+1:o=r}return n>0&&Math.abs(e[n][0]-t)>=Math.abs(e[n-1][0]-t)?n-1:n}function Tn(e,t,n){const o=e.byGroup.get(t);let r=0,i=Math.abs(o[0].x-n.x);for(let e=1;o.length>e;e++){const t=Math.abs(o[e].x-n.x);i>t&&(i=t,r=e)}return o[r]._flatIndex}function Bn(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}var On=require("react"),Dn={fresh:1,aging:.7,stale:.45,expired:.25},Wn={alpha:1,band:"fresh",isStale:!1};function zn(e,t){if(!e||0>=t)return Wn;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:{...Dn,...e.opacities??{}}[r],band:r,isStale:"fresh"!==r}}return t>n?{alpha:e.dimOpacity??.5,band:"stale",isStale:!0}:Wn}var Hn=require("react/jsx-runtime");function En({isStale:e,position:t}){return(0,Hn.jsx)("div",{className:"stream-staleness-badge",style:{position:"absolute",..."top-left"===t?{top:4,left:4}:"bottom-left"===t?{bottom:4,left:4}:"bottom-right"===t?{bottom:4,right:4}:{top:4,right:4},padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",zIndex:3,background:e?"#dc3545":"#28a745",color:"white"},children:e?"STALE":"LIVE"})}var $n=require("react"),Yn=c(require("react")),Gn=require("react/jsx-runtime"),qn=16,Xn=6,Vn=10,Un=22,Kn={fill:(e,t)=>(0,Gn.jsx)("rect",{style:e,width:t,height:t}),line:(e,t)=>(0,Gn.jsx)("line",{style:e,x1:0,y1:0,x2:t,y2:t})};function Qn(e,t,n,o,r){let i;return i="function"==typeof n?n(e):(0,Kn[n])(o(e,t),r),i}function Zn({swatchSize:e}){return(0,Gn.jsx)("path",{d:`M${.25*e},${.55*e} L${.45*e},${.75*e} L${.8*e},${.3*e}`,fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function Jn(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}var eo=(e,t,n,o,r,i,s,a,l,c,u)=>{const{type:h="fill",styleFn:d,items:f}=e,p=[];let y=0;const g=!(!t&&!n),m="isolate"===c||void 0===c&&null!=r,{swatchSize:x,labelGap:b,rowHeight:v}=u;return f.forEach((e,c)=>{const u=Qn(e,c,h,d,x),k=Jn(e,o,r),w=r&&r.size>0&&r.has(e.label);p.push((0,Gn.jsxs)("g",{transform:`translate(0,${y})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:g?a===i&&c===s?0:-1:void 0,role:g?"option":void 0,"aria-selected":g&&m?w||!1:void 0,"aria-current":g&&!m&&null!=o&&e.label===o||void 0,"aria-label":e.label,onKeyDown:g?n=>{if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowDown"===n.key||"ArrowUp"===n.key){n.preventDefault();const e=(c+("ArrowDown"===n.key?1:-1)+f.length)%f.length;l(a,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:g?t=>{l(a,c),n&&n(e);const o=t.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:g?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:g?"pointer":"default",opacity:k,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[g&&(0,Gn.jsx)("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:x+b+2+7*e.label.length,height:x+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),u,w&&(0,Gn.jsx)(Zn,{swatchSize:x}),(0,Gn.jsx)("text",{y:x/2,x:x+b,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+c)),y+=v}),p},to=({legendGroups:e,width:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:s,focusedItemIndex:a,onFocusedIndexChange:l,legendInteraction:c,metrics:u})=>{let h=24;const d=[];return e.forEach((e,f)=>{h+=5,d.push((0,Gn.jsx)("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((0,Gn.jsx)("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((0,Gn.jsx)("g",{className:"legend-item",transform:`translate(0,${h})`,children:eo(e,n,o,r,i,s,a,f,l,c,u)},"legend-group-"+f)),h+=e.items.length*u.rowHeight+8}),d},no=({legendGroups:e,height:t,width:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:a,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 y=((e,t,n,o,r,i,s,a,l,c,u,h)=>{const{type:d="fill",styleFn:f,items:p}=e,y=[],{swatchSize:g,labelGap:m,itemGap:x,rowHeight:b,align:v}=u,k=!(!t&&!n),w="isolate"===c||void 0===c&&null!=r,A=p.map(e=>g+m+7*e.label.length),S=[];let C=0,M=0;A.forEach((e,t)=>{const n=0===M?e:M+x+e;h&&h>0&&M>0&&n>h?(S.push({start:C,end:t,width:M}),C=t,M=e):M=n}),p.length>0&&S.push({start:C,end:p.length,width:M}),S.forEach((e,c)=>{let u="center"===v?Math.max(0,((h??e.width)-e.width)/2):"end"===v?Math.max(0,(h??e.width)-e.width):0;for(let h=e.start;e.end>h;h++){const e=p[h],v=Qn(e,h,d,f,g),S=Jn(e,o,r),C=r&&r.size>0&&r.has(e.label);y.push((0,Gn.jsxs)("g",{transform:`translate(${u},${c*b})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:k?a===i&&h===s?0:-1:void 0,role:k?"option":void 0,"aria-selected":k&&w?C||!1:void 0,"aria-current":k&&!w&&null!=o&&e.label===o||void 0,"aria-label":e.label,onKeyDown:k?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(a,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:k?t=>{l(a,h),n&&n(e);const o=t.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:k?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:k?"pointer":"default",opacity:S,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[k&&(0,Gn.jsx)("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:g+m+2+7*e.label.length,height:g+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),v,C&&(0,Gn.jsx)(Zn,{swatchSize:g}),(0,Gn.jsx)("text",{y:g/2,x:g+m,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+h)),u+=A[h]+x}});const _=Math.max(0,...S.map(e=>e.width)),j=S.length;return{items:y,offset:_,totalRows:j,totalHeight:j*b}})(e,o,r,i,s,a,l,t,c,u,h,h.maxWidth??n);p+=y.offset+5,f.push({label:e.label,...y,offset:p,totalRows:y.totalRows,totalHeight:y.totalHeight}),d+=p+12});const p=h.maxWidth??n;let y=d>p?0:"center"===h.align?Math.max(0,(p-d)/2):"end"===h.align?Math.max(0,p-d):0;const g=[];return f.forEach((n,o)=>{const r=e[o];r.label&&(g.push((0,Gn.jsx)("text",{transform:`translate(${y},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)),y+=16),g.push((0,Gn.jsx)("g",{className:"legend-item",transform:`translate(${y},0)`,children:n.items},"legend-group-"+o)),y+=n.offset+5,e[o+1]&&g.push((0,Gn.jsx)("line",{stroke:"gray",x1:y,y1:-8,x2:y,y2:(n.totalHeight||t)+0+8},"legend-top-line legend-symbol-"+o)),y+=12}),(0,Gn.jsx)("g",{children:g})};function oo({config:e,orientation:t="vertical",width:n=100}){const{colorFn:o,domain:r,label:i,format:s}=e,a=s||(e=>Math.round(100*e)/100+""),l="grad-legend-"+Yn.useId();if("horizontal"===t){const e=12,t=Math.min(n,200),s=Math.max(0,(n-t)/2),c=[];for(let e=0;64>=e;e++){const t=e/64;c.push((0,Gn.jsx)("stop",{offset:100*t+"%",stopColor:o(r[0]+t*(r[1]-r[0]))},e))}return(0,Gn.jsxs)("g",{"aria-label":i||"Gradient legend",children:[(0,Gn.jsx)("defs",{children:(0,Gn.jsx)("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),i&&(0,Gn.jsx)("text",{x:s+t/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),(0,Gn.jsx)("rect",{x:s,y:0,width:t,height:e,fill:`url(#${l})`,rx:2}),(0,Gn.jsx)("text",{x:s,y:e+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[0])}),(0,Gn.jsx)("text",{x:s+t,y:e+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[1])})]})}const c=[];for(let e=0;64>=e;e++){const t=e/64;c.push((0,Gn.jsx)("stop",{offset:100*t+"%",stopColor:o(r[1]-t*(r[1]-r[0]))},e))}return(0,Gn.jsxs)("g",{"aria-label":i||"Gradient legend",children:[i&&(0,Gn.jsx)("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),(0,Gn.jsx)("defs",{children:(0,Gn.jsx)("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:c})}),(0,Gn.jsx)("rect",{x:0,y:0,width:14,height:100,fill:`url(#${l})`,rx:2}),(0,Gn.jsx)("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[1])}),(0,Gn.jsx)("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[0])})]})}function ro(e){const{legendGroups:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,legendInteraction:s,title:a="Legend",width:l=100,height:c=20,orientation:u="vertical",legendLayout:h}=e,d=function(e){const t=Math.max(1,e?.swatchSize??qn),n=Math.max(t,e?.rowHeight??Un);return{swatchSize:t,labelGap:Math.max(0,e?.labelGap??Xn),itemGap:Math.max(0,e?.itemGap??Vn),rowHeight:n,align:"left"===e?.align?"start":"right"===e?.align?"end":e?.align??"start",maxWidth:e?.maxWidth}}(h),[f,p]=Yn.useState(0),[y,g]=Yn.useState(0),m=Yn.useCallback((e,t)=>{p(e),g(t)},[]),x="vertical"===u?to({legendGroups:t||[],width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:y,onFocusedIndexChange:m,legendInteraction:s,metrics:d}):no({legendGroups:t||[],title:a,height:c,width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:y,onFocusedIndexChange:m,legendInteraction:s,metrics:d}),b=!(!n&&!o);return(0,Gn.jsxs)("g",{role:b?"listbox":void 0,"aria-multiselectable":!(!b||"isolate"!==s&&(void 0!==s||null==i))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==a&&""!==a&&"vertical"===u&&(0,Gn.jsx)("text",{className:"legend-title",y:16,x:l/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:a}),x]})}function io(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}var so=require("react/jsx-runtime");function ao(e){const{legend:t,totalWidth:n,totalHeight:o,margin:r,legendPosition:i="right",legendLayout:s,title:a,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:h,legendInteraction:d}=e;if(!t)return null;const f="top"===i||"bottom"===i,p=!!a,y=Math.max(0,n-r.left-r.right),g=Math.max(1,f?s?.maxWidth??y:100);let m,x;return"left"===i?(m=Math.max(4,r.left-g-10),x=r.top):"top"===i?(m=r.left,x=p?32:8):"bottom"===i?(m=r.left,x=o-r.bottom+38):(m=n-r.right+10,x=r.top),(0,so.jsx)("g",{transform:`translate(${m}, ${x})`,children:(b=t,"object"==typeof b&&null!==b&&"gradient"in b?(0,so.jsx)(oo,{config:t.gradient,orientation:f?"horizontal":"vertical",width:g}):io(t)?(0,so.jsx)(ro,{legendGroups:t.legendGroups,title:"",width:g,orientation:f?"horizontal":"vertical",legendLayout:s,customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:h,legendInteraction:d}):t)});var b}var lo=require("react"),co=require("d3-array");d();var uo=require("react/jsx-runtime");function ho(e){return"string"==typeof e?{type:e}:e}function fo({orient:e,config:t,values:n,scale:o,size:r,length:i}){const s=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),a="top"===e||"bottom"===e,l=(0,lo.useMemo)(()=>{if(0===n.length)return null;const t=o.domain(),l=r-8;if("boxplot"===s.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)],s=i-o;return{q1:o,median:r,q3:i,whiskerLow:Math.max(t[0],o-1.5*s),whiskerHigh:Math.min(t[n-1],i+1.5*s)}}(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(a){const t=o(r),n=o(c),a=o(i),l=o(u),p=o(h),y="top"===e?-1:1,g=0;return(0,uo.jsxs)("g",{"data-testid":"marginal-boxplot-"+e,children:[(0,uo.jsx)("line",{x1:l,y1:g+y*(f+d/2),x2:p,y2:g+y*(f+d/2),stroke:s.fill,strokeWidth:s.strokeWidth}),(0,uo.jsx)("line",{x1:l,y1:g+y*f,x2:l,y2:g+y*(f+d),stroke:s.fill,strokeWidth:s.strokeWidth}),(0,uo.jsx)("line",{x1:p,y1:g+y*f,x2:p,y2:g+y*(f+d),stroke:s.fill,strokeWidth:s.strokeWidth}),(0,uo.jsx)("rect",{x:Math.min(t,n),y:"top"===e?g-f-d:g+f,width:Math.abs(n-t),height:d,fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth}),(0,uo.jsx)("line",{x1:a,y1:"top"===e?g-f-d:g+f,x2:a,y2:"top"===e?g-f:g+f+d,stroke:s.fill,strokeWidth:2})]})}{const t=o(r),n=o(c),a=o(i),l=o(u),p=o(h),y="left"===e?-1:1,g=0;return(0,uo.jsxs)("g",{"data-testid":"marginal-boxplot-"+e,children:[(0,uo.jsx)("line",{x1:g+y*(f+d/2),y1:l,x2:g+y*(f+d/2),y2:p,stroke:s.fill,strokeWidth:s.strokeWidth}),(0,uo.jsx)("line",{x1:g+y*f,y1:l,x2:g+y*(f+d),y2:l,stroke:s.fill,strokeWidth:s.strokeWidth}),(0,uo.jsx)("line",{x1:g+y*f,y1:p,x2:g+y*(f+d),y2:p,stroke:s.fill,strokeWidth:s.strokeWidth}),(0,uo.jsx)("rect",{x:"left"===e?g-f-d:g+f,y:Math.min(t,n),width:d,height:Math.abs(n-t),fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth}),(0,uo.jsx)("line",{x1:"left"===e?g-f-d:g+f,y1:a,x2:"left"===e?g-f:g+f+d,y2:a,stroke:s.fill,strokeWidth:2})]})}}const c=(0,co.bin)().domain(t).thresholds(s.bins)(n);if(0===c.length)return null;const u=h(c.map(e=>e.length));if(0===u)return null;if("histogram"===s.type)return(0,uo.jsx)("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(a){const i=o(t.x0),a=o(t.x1)-o(t.x0);return(0,uo.jsx)("rect",{x:i,y:"top"===e?-4-r:4,width:Math.max(a,.5),height:r,fill:s.fill,fillOpacity:s.fillOpacity,stroke:s.stroke,strokeWidth:s.strokeWidth},n)}{const i=o(t.x0),a=o(t.x1)-o(t.x0);return(0,uo.jsx)("rect",{x:"left"===e?-4-r:4,y:Math.min(i,i+a),width:r,height:Math.abs(a),fill:s.fill,fillOpacity:s.fillOpacity,stroke:s.stroke,strokeWidth:s.strokeWidth},n)}})});if("violin"===s.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),s=o((r.x0+r.x1)/2);n.push(a?`${s},${"top"===e?-(t-i):t-i}`:`${"left"===e?-(t-i):t-i},${s}`)}for(let r=c.length-1;r>=0;r--){const i=c[r];if(null==i.x0||null==i.x1)continue;const s=i.length/u*(l/2),h=o((i.x0+i.x1)/2);n.push(a?`${h},${"top"===e?-(t+s):t+s}`:`${"left"===e?-(t+s):t+s},${h}`)}return(0,uo.jsx)("g",{"data-testid":"marginal-violin-"+e,children:(0,uo.jsx)("polygon",{points:n.join(" "),fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth})})}if("ridgeline"===s.type){const t=[];if(a){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 s=null!=c[c.length-1].x1?o(c[c.length-1].x1):i;t.push(`L${s},${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 s=null!=c[c.length-1].x1?o(c[c.length-1].x1):i;t.push(`L${n},${s}`),t.push("Z")}return(0,uo.jsx)("g",{"data-testid":"marginal-ridgeline-"+e,children:(0,uo.jsx)("path",{d:t.join(" "),fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth})})}return null},[n,o,s,r,i,e,a,4]);return l?(0,uo.jsx)("g",{className:"marginal-"+e,"data-testid":"marginal-"+e,children:l}):null}var po=c(require("react")),yo=require("react/jsx-runtime");function go(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),r=e.split(/\s+/),i=[];let s="";for(const e of r)s&&s.length+1+e.length>o?(i.push(s),s=e):s=s?`${s} ${e}`:e;return s&&i.push(s),i}function mo(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 xo(e,t,n,o){if(!e)return(0,yo.jsx)("g",{className:"annotation-note"});const{label:r,title:i,orientation:s,align:a,wrap:l=120,noWrap:c}=e;if(!r&&!i)return(0,yo.jsx)("g",{className:"annotation-note"});let u=s;u||(u=Math.abs(t)>Math.abs(n)?"leftRight":"topBottom");let h=a;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]:go(i,l):[],y=r?c?[r]:go(r,l):[],g="leftRight"===u?"end"===d?-4:4:0;let m=0;const x=[],b=o||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";e.useHTML||e.html?x.push((0,yo.jsx)("foreignObject",{className:"annotation-note-html",x:"end"===d?g-l:"middle"===d?g-l/2:g,y:-16,width:l,height:Math.max(f,(p.length+y.length)*f+(i&&r?2:0))+f,style:{overflow:"visible"},children:(0,yo.jsxs)("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{color:b,fontSize:"12px",lineHeight:"16px",overflow:"visible",textAlign:"end"===d?"right":"middle"===d?"center":"left",whiteSpace:c?"nowrap":"normal",wordBreak:"break-word"},children:[i&&(0,yo.jsx)("div",{className:"annotation-note-title",style:{fontWeight:"bold"},children:i}),r&&(0,yo.jsx)("div",{className:"annotation-note-label",children:r})]})},"annotation-note-html")):(p.length>0&&(x.push((0,yo.jsx)("text",{className:"annotation-note-title",fill:b,textAnchor:d,fontWeight:"bold",children:p.map((e,t)=>(0,yo.jsx)("tspan",{x:g,dy:0===t?0:f,children:e},t))},"annotation-note-title")),m=p.length*f),y.length>0&&x.push((0,yo.jsx)("text",{className:"annotation-note-label",fill:b,textAnchor:d,y:m,children:y.map((e,t)=>(0,yo.jsx)("tspan",{x:g,dy:0===t?0:f,children:e},t))},"annotation-note-label")));let v=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),v=(0,yo.jsx)("line",{className:"note-line",x1:t,x2:n,y1:0,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)"})}else{const e=(p.length+y.length)*f+(y.length>0?f:0);let t=0,n=e;"bottom"===h?(t=-e,n=0):"middle"===h&&(t=-e/2,n=e/2),v=(0,yo.jsx)("line",{className:"note-line",x1:0,x2:0,y1:t,y2:n,stroke:o||"var(--semiotic-text-secondary, currentColor)"})}const k=Math.max(0,p.length+y.length-1)*f;let w=0;return"topBottom"===u?w=0>n?-(k+2):18:"leftRight"===u&&(w="middle"===h?-(k+f+(y.length>0&&p.length>0?2:0))/2+8:"bottom"===h||0>n?-(k+2):18),(0,yo.jsxs)("g",{className:"annotation-note",transform:`translate(${t},${n})`,children:[(0,yo.jsx)("g",{className:"annotation-note-content",transform:0!==w?`translate(0,${w})`:void 0,children:x}),v]})}function bo(e,t,n,o,r){const i=[];switch(e){case"callout-circle":{const e=(t?.radius||0)+(t?.radiusPadding||0);e>0&&i.push((0,yo.jsx)("circle",{r:e,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const e=t?.width||0,o=t?.height||0;(e>0||o>0)&&i.push((0,yo.jsx)("rect",{width:e,height:o,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":t?.custom&&i.push(...Array.isArray(t.custom)?t.custom:[t.custom]);break;case"xy-threshold":{const e=o||0,s=r||0;if(void 0!==t?.x){const o=(t.x||0)-e;i.push((0,yo.jsx)("line",{x1:o,y1:(t.y1||0)-s,x2:o,y2:(t.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==t?.y){const o=(t.y||0)-s;i.push((0,yo.jsx)("line",{x1:(t.x1||0)-e,y1:o,x2:(t.x2||0)-e,y2:o,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==t?.x1||void 0!==t?.x2?i.push((0,yo.jsx)("line",{x1:(t.x1||0)-e,y1:0,x2:(t.x2||0)-e,y2:0,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===t?.y1&&void 0===t?.y2||i.push((0,yo.jsx)("line",{x1:0,y1:(t.y1||0)-s,x2:0,y2:(t.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const e=t?.type||"curly",o=t?.width??t?.height;void 0!==o&&i.push((0,yo.jsx)("path",{d:mo(e,o,t?.depth||30,void 0===t?.width),fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return(0,yo.jsx)("g",{className:"annotation-subject",children:i})}function vo(e,t,n,o,r,i){const s=[];let a=0,l=0;if("callout-circle"!==r&&"label"!==r||!i?.radius){if("callout-rect"===r&&i){const n=i.width||0,o=i.height||0;if(n>0||o>0){const r=n/2,i=o/2,s=e-r,c=t-i;if(0!==s||0!==c){const e=Math.abs(s),t=Math.abs(c),u=n/2,h=o/2,d=e*h>t*u?u/e:h/t;a=r+s*d,l=i+c*d}}}else if("bracket"===r&&i){const e=i.width,t=i.height,n=i.depth||30;void 0!==e?(a=e/2,l=n):void 0!==t&&(a=n,l=t/2)}}else{const n=(i.radius||0)+(i.radiusPadding||0);if(n>0&&(0!==e||0!==t)){const o=Math.atan2(t,e);a=Math.cos(o)*n,l=Math.sin(o)*n}}const c=Math.sqrt((e-a)**2+(t-l)**2);if(c>.5){const r=o||"var(--semiotic-text-secondary, currentColor)",i="curve"===n?.type;let u=Math.atan2(t-l,e-a);if(i){const o=(a+e)/2,i=(l+t)/2,h=-(t-l)/c,d=(e-a)/c,f=(n?.curve??.25)*c,p=o+h*f,y=i+d*f;s.push((0,yo.jsx)("path",{className:"connector-curve",d:`M${a},${l}Q${p},${y} ${e},${t}`,fill:"none",stroke:r},"connector-line")),u=Math.atan2(y-l,p-a)}else s.push((0,yo.jsx)("line",{x1:a,y1:l,x2:e,y2:t,stroke:r},"connector-line"));if("arrow"===n?.end){const e=10,t=16/180*Math.PI;s.push((0,yo.jsx)("path",{d:`M${a},${l}L${a+e*Math.cos(u+t)},${l+e*Math.sin(u+t)}L${a+e*Math.cos(u-t)},${l+e*Math.sin(u-t)}Z`,fill:r,stroke:"none"},"connector-arrow"))}}return(0,yo.jsx)("g",{className:"annotation-connector",children:s})}function ko(e){const{x:t=0,y:n=0,dx:o,dy:r,nx:i,ny:s,note:a,connector:l,subject:c,type:u,color:h,className:d,disable:f,opacity:p,strokeDasharray:y,events:g={},"data-testid":m}=e,x=Array.isArray(t)?t[0]??0:t,b=Array.isArray(n)?n[0]??0:n,v=new Set(Array.isArray(f)?f:[]);let k=o||0,w=r||0;null!=i&&(k=i-x),null!=s&&(w=s-b);const A="string"==typeof u?u:"label";if("bracket"===A&&c&&0===k&&0===w)if(void 0!==c.width){k=c.width/2;const e=c.depth||30;w=e+(0>e?-5:5)}else if(void 0!==c.height){const e=c.depth||30;k=e+(0>e?-5:5),w=c.height/2}return(0,yo.jsxs)("g",{className:("annotation "+(d||"")).trim(),transform:`translate(${x},${b})`,"data-testid":m,...null!=p&&{opacity:p},...y&&{strokeDasharray:y},...g,children:[!v.has("connector")&&vo(k,w,l,h,A,c),!v.has("subject")&&bo(A,c,h,x,b),!v.has("note")&&xo(a,k,w,h)]})}function wo(e){const{noteData:t}=e,{screenCoordinates:n}=t,o="string"==typeof t.type?t.type:"label",r=t.eventListeners||t.events||{};if(t.coordinates&&n){const e=t.nx||n[0][0]+(t.dx??0),r=t.ny||n[0][1]+(t.dy??0),i=n.map((n,i)=>{const s=Object.assign({},t,{note:0===i?t.note:{label:""},x:n[0],y:n[1],nx:e,ny:r});return(0,yo.jsx)(ko,{"data-testid":"semiotic-annotation",...s,type:o},"multi-annotation-"+i)});return(0,yo.jsx)("g",{children:i})}const i=t.note||{title:"none",label:t.label},s=`${i.label}-${i.title}-${t.i}`;return(0,yo.jsx)(ko,{"data-testid":"semiotic-annotation",events:r,...t,type:o},s)}var Ao=require("d3-hierarchy"),So=require("d3-shape"),Co=c(require("regression"));function Mo(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 _o(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 jo(e){return null==e?null:e+""}function Po(e,t,n){return t.stickyPositionCache?.set(e,n),n}function Lo(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 Po(t,n,{x:r.x,y:r.y})}const o=function(e){const t=e.data;if(!t||0===t.length)return null;const n=t[t.length-1],o=e.scales?.x??e.scales?.time,r=e.scales?.y??e.scales?.value;if(!o||!r)return null;const i=n[e.xAccessor||"x"],s=n[e.yAccessor||"y"];return null==i||null==s?null:{x:o(i),y:r(s)}}(n);return o?Po(t,n,o):null}if("semantic"===o){const o=function(e,t,n){const o=function(e){return jo(e.provenance?.stableId??e.stableId)}(e);if(!o)return null;const r=n.pointNodes?.find(e=>jo(e.pointId)===o);if(r)return Po(t,n,{x:r.x,y:r.y});const i=n.data?.find(e=>function(e){return jo(e.stableId??e.id??e.provenance?.stableId)}(e)===o);if(!i)return null;const s=Mo(i,n),a=_o(i,n);return null==s||null==a?null:Po(t,n,{x:s,y:a})}(e,t,n);if(o)return o}let r=null,i=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(r=t.x,i=t.y)}if(null!=r&&null!=i||(r=Mo(e,n),i=_o(e,n)),null!=r&&null!=i)return Po(t,n,{x:r,y:i});if("sticky"===o){const e=n.stickyPositionCache?.get(t);if(e)return e}return null}function Ro(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}var Io=require("react/jsx-runtime"),No={secondary:0,primary:3};function Fo(e){return!0===e?._annotationDeferred}function To(e){return"blended"===e?.cohesion||"layer"===e?.cohesion?e.cohesion:null}function Bo(e){const t=e?.provenance?.confidence;return"number"==typeof t&&Number.isFinite(t)?Math.max(0,Math.min(1,t)):null}function Oo(e){return Math.max(.72,.95-.06*e)}d();var Do=require("react/jsx-runtime"),Wo={linear:So.curveLinear,monotoneX:So.curveMonotoneX,monotoneY:So.curveMonotoneY,step:So.curveStep,stepAfter:So.curveStepAfter,stepBefore:So.curveStepBefore,basis:So.curveBasis,cardinal:So.curveCardinal,catmullRom:So.curveCatmullRom};var zo=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function Ho(e){return!!e&&"object"==typeof e&&zo.has(function(e){return"string"==typeof e?.type?e.type:""}(e))}function Eo(e){return"primary"===e?.emphasis||!0===e?.defensive}function $o(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 Yo(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 Go=32,qo=6,Xo=4,Vo=8,Uo=72;var Ko={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function Qo(e){if(!Zo(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 Zo(e){return Ho(e)}function Jo(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 er(e,t,n,o,r){const i=e+n,s=t+o;return Math.abs(n)>Math.abs(o)?{x:0>n?i-r.width-4:i+4,y:0>o?s-r.height:s,width:r.width,height:r.height}:{x:0>n?i-r.width:i,y:0>o?s-r.height-4:s+4,width:r.width,height:r.height}}function tr(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function nr(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 or(e,t,n,o,r,i,s,a){const l=tr(e,s);let c=.4*Math.hypot(t.dx,t.dy)+80*function(e,t,n,o){const r=Math.max(0,o-e.x),i=Math.max(0,o-e.y);return(r+Math.max(0,e.x+e.width-(t-o)))*e.height+(i+Math.max(0,e.y+e.height-(n-o)))*e.width}(l,r,i,a);for(const e of n)c+=12*nr(l,e);for(const e of o)c+=4*nr(l,e);return c}function rr(e){const{annotations:t,context:n,defaultOffset:o=Go,notePadding:r=qo,markPadding:i=Xo,edgePadding:s=Vo,preserveManualOffsets:a=!0,routeLongConnectors:l=!0,connectorThreshold:c=Uo,density:u,progressiveDisclosure:h=!1,redundantCues:d=!1,responsive:f,mobile:p,cohesion:y,audience:g}=e,m=n.width||0,x=n.height||0,b="object"==typeof p?p:{},v=b.breakpoint??480,k=!!p&&v>=m,w=k&&!1!==b.preferShortText?t.map(Qo):t,A=k&&!u?{maxAnnotations:b.maxAnnotations??("callout-list"===b.strategy?1:2),minVisible:b.minVisible??1}:u,S=h||k&&(!1!==b.progressiveDisclosure||"callout-list"===b.strategy),C=k&&!f?b.responsive??{minWidth:v}:f,M=k&&!y?b.cohesion:y;if(0===w.length||0>=m||0>=x)return w.slice();const _=[],j=function(e,t){return(e.pointNodes||[]).map(e=>{const n=Math.max(1,e.r||1)+t;return{x:e.x-n,y:e.y-n,width:2*n,height:2*n}})}(n,i);let P=!1;const L=w.map((e,t)=>{if(!Zo(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?Lo(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=[...Jo("string"==typeof e.title?e.title:void 0,t),...Jo("string"==typeof e.label?e.label:void 0,t)],o=n.reduce((e,t)=>Math.max(e,t.length),0);return{width:Math.max(24,Math.min(t,7*o)+10),height:Math.max(18,16*n.length+6)}}(e);if(a&&("number"==typeof(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 _.push(tr(er(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=or(er(i.x,i.y,e.dx,e.dy,u),e,_,j,m,x,r,s);f>t&&(d=e,f=t)}if(!d)return e;const p=tr(er(i.x,i.y,d.dx,d.dy,u),r);_.push(p);const y=Math.hypot(d.dx,d.dy),g=l&&y>=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,...g?{connector:g}:{}}}),R=P?L:w.slice();let I=R;if(d){let e=!1;const t=R.map(t=>{const n=function(e){return"text"!==e.type||"string"!=typeof e.color||8>Math.hypot("number"==typeof e.dx?e.dx:0,"number"==typeof e.dy?e.dy:0)?e:{...e,_redundantConnector:!0}}(t);return n!==t&&(e=!0),n});I=e?t:R}{let e=!1;const t=I.map(t=>{if(!0!==t?.defensive)return t;const n=function(e){const t=e?.provenance;if(!t||"object"!=typeof t)return e;const n="string"==typeof t.source?Ko[t.source]??t.source:null,o="number"==typeof t.confidence&&Number.isFinite(t.confidence)?Math.round(100*Math.max(0,Math.min(1,t.confidence)))+"%":null;if(!n&&!o)return e;if(null!=e.label&&"string"!=typeof e.label)return e;const r=[n,o].filter(Boolean).join(" · "),i="string"==typeof e.label?e.label:"";return i.includes(`(${r})`)?e:{...e,label:i?`${i} (${r})`:`(${r})`}}(t);return n!==t&&(e=!0),n});I=e?t:I}const N=new Set;if(A){const e="object"==typeof A?A:{},t=function(e){if(!e)return 1;const t=function(e){const t=e?.familiarity;if(!t)return 3;const n=Object.values(t).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0===n.length?3:n.reduce((e,t)=>e+t,0)/n.length}(e);return t>2?4>t?1:.6:1.5}(g),n=1===t?e:{...e,maxAnnotations:Math.max(0,Math.round((e.maxAnnotations??$o(m,x,e))*t))},{deferred:o}=function(e){const{annotations:t,width:n,height:o}=e,r=Math.max(0,e.minVisible??1),i=$o(n,o,e),s=t.map((e,t)=>{return{annotation:e,index:t,note:(n=e,Ho(n))};var n}),a=s.filter(e=>e.note);if(0===a.length||i>=a.length)return{visible:t.slice(),deferred:[],budget:i};const l=a.filter(e=>Eo(e.annotation)),c=a.filter(e=>!Eo(e.annotation)).sort((e,t)=>Yo(t.annotation)-Yo(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 s)!n||h.has(t)?d.push(e):f.push(e);return{visible:d,deferred:f,budget:i}}({annotations:I,width:m,height:x,...n});for(const e of o)N.add(e)}if(C&&("object"==typeof C&&"number"==typeof C.minWidth?C.minWidth:480)>=m)for(const e of I)Zo(e)&&"secondary"===e.emphasis&&N.add(e);if(N.size>0)for(const e of I)!0===e?.defensive&&N.delete(e);let F;return F=0===N.size?I:S?I.map(e=>N.has(e)?{...e,_annotationDeferred:!0}:e):I.filter(e=>!N.has(e)),M?function(e,t){let n=!1;const o=e.map(e=>Zo(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(n=!0,{...e,cohesion:t}):e);return n?o:e}(F,M):F}var ir=require("react"),sr={positions:new Map},ar=new Set;function lr(){for(const e of ar)e()}function cr(e,t){const n=sr.positions.get(e);if(n?.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(sr.positions);o.delete(e),sr={positions:o},lr()}function ur(e,t){const n=sr.positions.get(e);if(!n?.locked)return;if(t&&n.sourceId!==t)return;const o=new Map(sr.positions);o.delete(e),sr={positions:o},lr()}function hr(){return sr}function dr(e){return ar.add(e),()=>ar.delete(e)}var fr={positions:new Map};function pr(){return()=>{}}function yr(){return fr}function gr(e,t,n){return"exact"===n?function(e,t){const n=e.domain(),o=n[0],r=n[n.length-1],i=o instanceof Date,s=o instanceof Date?o.getTime():o,a=r instanceof Date?r.getTime():r;if(2>t||s===a)return i?[new Date(s),new Date(a)]:[s,a];const l=(a-s)/(t-1),c=Array(t);for(let e=0;t>e;e++){const n=e===t-1?a:s+e*l;c[e]=i?new Date(n):n}return c}(e,t):e.ticks(t)}var mr=require("react/jsx-runtime");function xr(e,t,n){if("edges"===e){if(t)return"start";if(n)return"end"}return"middle"}function br(e,t,n){if("edges"===e){if(t)return"hanging";if(n)return"auto"}return"middle"}function vr(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 kr(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function wr(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 s="M0,"+o;for(let e=0;i>e;e++){const n=8*(e+1);s+=`L${Math.min(8*e+4,t)},${o+4*r}`,s+=`L${Math.min(n,t)},${o}`}return s}{const o="bottom"===e?0:t,r="bottom"===e?1:-1,i=Math.ceil(n/8);let s=`M${o},0`;for(let e=0;i>e;e++){const t=8*(e+1);s+=`L${o+4*r},${Math.min(8*e+4,n)}`,s+=`L${o},${Math.min(t,n)}`}return s}}function Ar(e){const{width:t,height:n,totalWidth:o,totalHeight:r,margin:i,scales:s,showAxes:a,axes:l,showGrid:c,xFormat:u,yFormat:h,axisExtent:d}=e,f=(0,$n.useMemo)(()=>{if(!s)return[];const e=l?.find(e=>"bottom"===e.orient),n=e?.tickFormat||u||Sr,o=Math.max(2,Math.floor(t/70)),r=e?.ticks??5,i="exact"===d?Math.max(2,r):Math.min(r,o),a=e?.tickValues??gr(s.x,i,d),c=a.map(e=>e.valueOf()),h=a.map((e,t)=>({value:e,pixel:s.x(e),label:n(e,t,c)})),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);return Cr(h,Math.max(55,f+8))},[s,l,u,t,d]),p=(0,$n.useMemo)(()=>{if(!s)return[];const e=l?.find(e=>"left"===e.orient),t=e?.tickFormat||h||Sr,o=Math.max(2,Math.floor(n/30)),r=e?.ticks??5,i="exact"===d?Math.max(2,r):Math.min(r,o);return Cr((e?.tickValues??gr(s.y,i,d)).map(e=>({value:e,pixel:s.y(e),label:t(e)})),22)},[s,l,h,n,d]),y=c&&s,g=a&&s;if(!y&&!g)return null;const m=l?.find(e=>"bottom"===e.orient),x=l?.find(e=>"left"===e.orient),b=g&&(!m||!1!==m.baseline),v=g&&(!x||!1!==x.baseline),k=m?.jaggedBase||!1,w=x?.jaggedBase||!1,A="var(--semiotic-border, #ccc)";return(0,mr.jsx)("svg",{width:o,height:r,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:(0,mr.jsxs)("g",{transform:`translate(${i.left},${i.top})`,children:[y&&(()=>{const e=kr(l?.find(e=>"bottom"===e.orient)?.gridStyle),o=kr(l?.find(e=>"left"===e.orient)?.gridStyle);return(0,mr.jsxs)("g",{className:"stream-grid",children:[f.map((t,o)=>(0,mr.jsx)("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:n,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:e},"xgrid-"+o)),p.map((e,n)=>(0,mr.jsx)("line",{x1:0,y1:e.pixel,x2:t,y2:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:o},"ygrid-"+n))]})})(),b&&!k&&(0,mr.jsx)("line",{x1:0,y1:n,x2:t,y2:n,stroke:A,strokeWidth:1}),k&&(0,mr.jsx)("path",{d:wr("bottom",t,n),fill:"none",stroke:A,strokeWidth:1}),v&&!w&&(0,mr.jsx)("line",{x1:0,y1:0,x2:0,y2:n,stroke:A,strokeWidth:1}),w&&(0,mr.jsx)("path",{d:wr("left",t,n),fill:"none",stroke:A,strokeWidth:1})]})})}function Sr(e,t,n){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function Cr(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 Mr(e){const{width:t,height:n,totalWidth:o,totalHeight:r,margin:i,scales:s,showAxes:a,axes:l,xLabel:c,yLabel:h,yLabelRight:d,xFormat:f,yFormat:p,axisExtent:y,showGrid:g,title:m,legend:x,legendHoverBehavior:b,legendClickBehavior:v,legendHighlightedCategory:k,legendIsolatedCategories:w,legendPosition:A="right",legendLayout:S,foregroundGraphics:C,marginalGraphics:M,xValues:_,yValues:j,annotations:P,autoPlaceAnnotations:L,svgAnnotationRules:R,xAccessor:I,yAccessor:N,annotationData:F,pointNodes:T,curve:B,underlayRendered:O,canvasObscuresUnderlay:D=!0,linkedCrosshairName:W,linkedCrosshairSourceId:z,children:H}=e,E=(0,$n.useMemo)(()=>{if(!a||!s)return[];const e=l?.find(e=>"bottom"===e.orient),n=e?.tickFormat||f||Sr,o=Math.max(2,Math.floor(t/70)),r=e?.ticks??5,i="exact"===y?Math.max(2,r):Math.min(r,o),c=e?.tickValues??gr(s.x,i,y),u=c.map(e=>e.valueOf()),h=c.map((e,t)=>({value:e,pixel:s.x(e),label:n(e,t,u)})),d=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),p=e?.autoRotate?Math.max(20,Math.min(d+8,55)):Math.max(55,d+8);let g=Cr(h,p);if(g.length>1&&(g=g.filter((e,t)=>0===t||e.label+""!=g[t-1].label+"")),e?.includeMax&&g.length>0&&"exact"!==y&&!e?.tickValues){const e=s.x.domain()[1],t=s.x(e),o=g[g.length-1].pixel;if(Math.abs(t-o)>1){const r=n(e,g.length,u);p>t-o&&g.length>1&&(g=g.slice(0,-1)),g.push({value:e,pixel:t,label:r})}}return g},[a,s,l,f,t,y]),$=(0,$n.useMemo)(()=>{if(!a||!s)return[];const e=l?.find(e=>"left"===e.orient),t=e?.tickFormat||p||Sr,o=Math.max(2,Math.floor(n/30)),r=e?.ticks??5,i="exact"===y?Math.max(2,r):Math.min(r,o);let c=Cr((e?.tickValues??gr(s.y,i,y)).map(e=>({value:e,pixel:s.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"!==y&&!e?.tickValues){const e=s.y.domain()[1],n=s.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},[a,s,l,p,n,y]),Y=(0,$n.useMemo)(()=>{if(!a||!s)return[];const e=l?.find(e=>"right"===e.orient);if(!e)return[];const t=e.tickFormat||p||Sr,o=Math.max(2,Math.floor(n/30)),r=e.ticks??5;return Cr((e.tickValues??gr(s.y,"exact"===y?Math.max(2,r):Math.min(r,o),y)).map(e=>({value:e,pixel:s.y(e),label:t(e)})),22)},[a,s,l,p,n,y]),G=(0,$n.useRef)(new Map),q=(0,$n.useRef)(P?.length??0),X=P?.length??0;q.current!==X&&(q.current=X,G.current=new Map);const V=(0,$n.useMemo)(()=>{if(!P||0===P.length)return null;const e=function(e,t,n){switch(e.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const o=Lo(e,t,n);if(!o)return null;const{x:r,y:i}=o;if(!Ro(r,i,n))return null;const s="callout"===e.type?"callout-circle":e.type,a="callout-circle"===s?{radius:e.radius??12,radiusPadding:e.radiusPadding}:"callout-rect"===s?{width:e.width,height:e.height}:void 0;return(0,Do.jsx)(wo,{noteData:{x:r,y:i,dx:e.dx??30,dy:e.dy??-30,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:s,...a?{subject:a}:{},connector:e.connector||{end:"arrow"},color:e.color,disable:e.disable,opacity:e.opacity,strokeDasharray:e.strokeDasharray,className:e.className}},"ann-"+t)}case"x-threshold":{const o=Mo(null!=e.value?{...e,x:e.value}:e,n);if(null==o)return null;const r=e.color||"#f97316",i=e.labelPosition||"top";let s;s="bottom"===i?(n.height||0)-4:"center"===i?(n.height||0)/2:12;const a=o>.6*(n.width||0),l=a?o-4:o+4,c=a?"end":"start";return(0,Do.jsxs)("g",{opacity:e.opacity,children:[(0,Do.jsx)("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&&(0,Do.jsx)("text",{x:l,y:s,textAnchor:c,fill:r,fontSize:12,fontWeight:"bold",stroke:"var(--semiotic-bg, #ffffff)",strokeWidth:3,paintOrder:"stroke",children:e.label})]},"ann-"+t)}case"y-threshold":{const o=_o(null!=e.value?{...e,y:e.value}:e,n);if(null==o)return null;const r=e.color||"#f97316",i=e.labelPosition||"right";let s,a;return"left"===i?(s=4,a="start"):"center"===i?(s=(n.width||0)/2,a="middle"):(s=(n.width||0)-4,a="end"),(0,Do.jsxs)("g",{opacity:e.opacity,children:[(0,Do.jsx)("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&&(0,Do.jsx)("text",{x:s,y:o-4,textAnchor:a,fill:r,fontSize:12,fontWeight:"bold",stroke:"var(--semiotic-bg, #ffffff)",strokeWidth:3,paintOrder:"stroke",children:e.label})]},"ann-"+t)}case"enclose":{const o=(e.coordinates||[]).map(e=>({x:Mo({...e,type:"point"},n),y:_o({...e,type:"point"},n),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>o.length)return null;const r=(0,Ao.packEnclose)(o),i=e.padding||10;return(0,Do.jsxs)("g",{children:[(0,Do.jsx)("circle",{cx:r.x,cy:r.y,r:r.r+i,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&(0,Do.jsx)("text",{x:r.x,y:r.y-r.r-i-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:e.label})]},"ann-"+t)}case"rect-enclose":{const o=(e.coordinates||[]).map(e=>({x:Mo({...e,type:"point"},n),y:_o({...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),s=o.map(e=>e.y),[a,l]=u(i),[c,h]=u(s),d=a-r,f=l+r,p=c-r;return(0,Do.jsxs)("g",{children:[(0,Do.jsx)("rect",{x:d,y:p,width:f-d,height:h+r-p,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&(0,Do.jsx)("text",{x:(d+f)/2,y:p-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(0,Do.jsx)("g",{children:r.map((t,o)=>{const r=Mo(t,n),s=_o(t,n);if(null==r||null==s)return null;const a="function"==typeof e.r?e.r(t):e.r||6,l="function"==typeof e.style?e.style(t):e.style||i;return(0,Do.jsx)("circle",{cx:r,cy:s,r:a,...l},"hl-"+o)})},"ann-"+t)}case"bracket":{const o=Mo(e,n),r=_o(e,n);return(0,Do.jsx)(wo,{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",s="ordinal"===n.frameType,a="horizontal"===n.projection,l=s?r:null,c=s?i:null;let u;const h=[],d=new Map;if(s&&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 y=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},g=f,m=p;let x;if(s)if(a){const e=y(m);x=(t,n)=>[g(n),e(t)]}else{const e=y(g);x=(t,n)=>[e(t),m(n)]}else x=(e,t)=>[g(e),m(t)];const b=e.method||"linear";let v;v="loess"===b?function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),r=o.map(e=>e[0]),i=o.map(e=>e[1]),s=Math.max(2,Math.ceil(t*n)),a=[];for(let e=0;n>e;e++){const t=r[e],o=r.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(s-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:o[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,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){a.push([t,i[e]]);continue}const y=u*f-h*h;if(1e-12>Math.abs(y))a.push([t,d/u]);else{const e=(u*p-h*d)/y;a.push([t,(d-e*h)/u+e*t])}}return a}(u,e.bandwidth??.3):("polynomial"===b?Co.default.polynomial(u,{order:e.order||2}):Co.default.linear(u)).points;const k=v.map(([e,t])=>{const[n,o]=x(e,t);return`${n},${o}`}).join(" "),w=e.color||"#6366f1",A=v[v.length-1],[S,C]=x(A[0],A[1]);return(0,Do.jsxs)("g",{children:[(0,Do.jsx)("polyline",{points:k,fill:"none",stroke:w,strokeWidth:e.strokeWidth||2,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,Do.jsx)("text",{x:S+4,y:C-4,fill:w,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(0,Do.jsxs)("g",{opacity:e.opacity,children:[(0,Do.jsx)("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&&(0,Do.jsx)("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:(0,Do.jsxs)("g",{opacity:e.opacity,children:[(0,Do.jsx)("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&&(0,Do.jsx)("text",{x:Math.min(r,i)+4,y:13,textAnchor:"start",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",stroke:"var(--semiotic-bg, #ffffff)",strokeWidth:3,paintOrder:"stroke",children:e.label})]},"ann-"+t)}case"envelope":{const o=n.data||[];if(2>o.length)return null;const r=n.xAccessor||"x",i=n.scales?.x??n.scales?.time,s=n.scales?.y??n.scales?.value;if(!i||!s)return null;const a=e.upperAccessor||"upperBounds",l=e.lowerAccessor||"lowerBounds",c=e.filter,u=o.filter(e=>null!=e[a]&&null!=e[l]&&!(c&&!c(e))).sort((e,t)=>e[r]-t[r]);if(2>u.length)return null;const h=Wo[n.curve||"linear"]||So.curveLinear,d=(0,So.area)().x(e=>i(e[r])).y0(e=>s(e[l])).y1(e=>s(e[a])).curve(h)(u);if(!d)return null;const f=e.fill||"#6366f1";return(0,Do.jsxs)("g",{children:[(0,Do.jsx)("path",{d:d,fill:f,fillOpacity:e.fillOpacity??.15,stroke:"none"}),e.label&&u.length>0&&(0,Do.jsx)("text",{x:i(u[u.length-1][r])+4,y:s(u[u.length-1][a])-4,fill:f,fontSize:11,children:e.label})]},"ann-"+t)}case"anomaly-band":{const o=n.data||[];if(2>o.length)return null;const r=n.yAccessor||"y",i=n.scales?.x??n.scales?.time,s=n.scales?.y??n.scales?.value;if(!i||!s)return null;const a=o.map(e=>e[r]).filter(e=>null!=e&&isFinite(e));if(2>a.length)return null;const l=a.reduce((e,t)=>e+t,0)/a.length,c=a.reduce((e,t)=>e+(t-l)**2,0)/a.length,u=Math.sqrt(c),h=e.threshold??2,d=l-h*u,f=!1!==e.showBand,p=e.fill||"#6366f1",y=e.fillOpacity??.1,g=e.anomalyColor||"#ef4444",m=e.anomalyRadius??6,x=s(l+h*u),b=s(d),v=o.filter(e=>{const t=e[r];return null!=t&&Math.abs(t-l)>h*u});return(0,Do.jsxs)("g",{children:[f&&(0,Do.jsx)("rect",{x:0,y:Math.min(x,b),width:n.width||0,height:Math.abs(b-x),fill:p,fillOpacity:y}),v.map((e,t)=>{const o=Mo(e,n),r=_o(e,n);return null==o||null==r?null:(0,Do.jsx)("circle",{cx:o,cy:r,r:m,fill:g,fillOpacity:.7,stroke:g,strokeWidth:1.5},"anomaly-"+t)}),e.label&&(0,Do.jsx)("text",{x:(n.width||0)-4,y:Math.min(x,b)-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",s=n.scales?.x??n.scales?.time,a=n.scales?.y??n.scales?.value;if(!s||!a)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=Co.default.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 s=(e*r-t*n)/i,a=(n-s*t)/e;c=e=>a+s*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),y=e.confidence??.95,g=.99>y?.95>y?.9>y?1:1.645:1.96:2.576,m=e.steps??5,x=l[u-1][0],b=(x-l[0][0])/Math.max(u-1,1),v=[];for(let e=1;m>=e;e++)v.push(x+e*b);const k=[];for(const e of v){const t=c(e),n=d*Math.sqrt(1+1/u+(p>0?(e-f)**2/p:0))*g;k.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const w=`M${k.map(e=>`${s(e.x)},${a(e.yUpper)}`).join(" L")} L${k.slice().reverse().map(e=>`${s(e.x)},${a(e.yLower)}`).join(" L")} Z`,A=k.map(e=>`${s(e.x)},${a(e.yCenter)}`).join(" "),S=`${s(x)},${a(c(x))}`,C=e.strokeColor||"#6366f1";return(0,Do.jsxs)("g",{children:[(0,Do.jsx)("path",{d:w,fill:e.fill||"#6366f1",fillOpacity:e.fillOpacity??.15,stroke:"none"}),(0,Do.jsx)("polyline",{points:`${S} ${A}`,fill:"none",stroke:C,strokeWidth:e.strokeWidth??2,strokeDasharray:e.strokeDasharray??"6,3"}),e.label&&k.length>0&&(0,Do.jsx)("text",{x:s(k[k.length-1].x)+4,y:a(k[k.length-1].yCenter)-4,fill:C,fontSize:11,children:e.label})]},"ann-"+t)}case"widget":{let o,r;if(null!=e.px&&null!=e.py)o=e.px,r=e.py;else{const i=Lo(e,t,n);if(!i)return null;o=i.x,r=i.y}if(!Ro(o,r,n))return null;const i=e.width??32,s=e.height??32;return(0,Do.jsx)("foreignObject",{x:o+(e.dx??0)-i/2,y:r+(e.dy??0)-s/2,width:i,height:s,style:{overflow:"visible",pointerEvents:"auto"},children:(0,Do.jsx)("div",{style:{width:i,height:s,display:"flex",alignItems:"center",justifyContent:"center"},children:e.content??(0,Do.jsx)("span",{style:{fontSize:18,cursor:"default"},title:e.label||"Info",children:"ℹ️"})})},"ann-"+t)}case"text":{const o=Lo(e,t,n);if(!o)return null;const{x:r,y:i}=o,s=r+(e.dx||0),a=i+(e.dy||0),l=e.color||"var(--semiotic-text, #333)",c=(0,Do.jsx)("text",{x:s,y:a,fill:l,fontSize:e.fontSize||11,opacity:e.opacity,strokeDasharray:e.strokeDasharray,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:e.label});return!0!==e._redundantConnector?po.cloneElement(c,{key:"ann-text-"+t}):(0,Do.jsxs)("g",{opacity:e.opacity,strokeDasharray:e.strokeDasharray,children:[(0,Do.jsx)("line",{x1:r,y1:i,x2:s,y2:a,stroke:l,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),po.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,s=n.scales?.x,a=n.scales?.y,l=r(i)?i:r(s)?s:r(a)?a: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(0,Do.jsxs)("g",(n.projection?"vertical"===n.projection:l===s)?{children:[(0,Do.jsx)("rect",{x:c,y:0,width:u,height:n.height||0,fill:h,fillOpacity:d}),f&&(0,Do.jsx)("text",{x:c+u/2,y:12,textAnchor:"middle",fill:h,fontSize:12,fontWeight:"bold",children:f})]}:{children:[(0,Do.jsx)("rect",{x:0,y:c,width:n.width||0,height:u,fill:h,fillOpacity:d}),f&&(0,Do.jsx)("text",{x:12,y:c+u/2,dominantBaseline:"middle",fill:h,fontSize:12,fontWeight:"bold",children:f})]},"ann-"+t)}default:return null}},o={scales:s?{x:s.x,y:s.y,time:s.x,value:s.y}:null,timeAxis:"x",xAccessor:I,yAccessor:N,width:t,height:n,data:F,frameType:"xy",pointNodes:T,curve:B,stickyPositionCache:G.current};return function(e,t,n,o){const r=[];return e.forEach((e,i)=>{let s;if(n){const r=n(e,i,o);s=null!=r?r:t(e,i,o)}else s=t(e,i,o);s&&r.push({node:s,annotation:e})}),function(e){const t=e.map((e,t)=>{return{p:e,i:t,emphasis:(n=e.annotation,"primary"===n?.emphasis||"secondary"===n?.emphasis?n.emphasis:null),confidence:Bo(e.annotation),readingOrder:null,rank:1};var n}),n=t.some(e=>null!=e.emphasis||null!=e.confidence),o=e.some(e=>Fo(e.annotation)),r=e.some(e=>null!=To(e.annotation)),i=e.some(e=>"layer"===To(e.annotation));if(!n&&!o&&!r)return e.map(e=>e.node);const s=t.filter(e=>null==e.emphasis&&null!=e.confidence).slice().sort((e,t)=>(t.confidence??0)-(e.confidence??0)||e.i-t.i);s.forEach((e,t)=>{e.readingOrder=t,e.rank=2-t/Math.max(1,s.length)});for(const e of t)e.emphasis&&(e.rank=No[e.emphasis]);const a=t.sort((e,t)=>e.rank-t.rank||e.i-t.i).map(e=>{const{p:t,i:n,emphasis:o,readingOrder:r}=e,i=Fo(t.annotation);let s=t.node;if("primary"===o||"secondary"===o||null!=r){const e=null==o&&null!=r;s=(0,Io.jsx)("g",{className:e?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+o,..."secondary"===o?{opacity:.6,fontSize:"0.88em"}:{},...e?{opacity:Oo(r),"data-annotation-reading-order":r}:{},children:t.node},"annotation-emphasis-"+n)}const a=To(t.annotation);return a&&(s=(0,Io.jsx)("g",{className:"annotation-cohesion--"+a,children:s},"annotation-cohesion-"+n)),i&&(s=(0,Io.jsx)("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:s},"annotation-deferred-"+n)),s});return o&&a.unshift((0,Io.jsx)("style",{children:".annotation-deferred{opacity:0;pointer-events:none;transition:opacity .12s ease}.stream-xy-frame:hover .annotation-deferred,.stream-ordinal-frame:hover .annotation-deferred,.stream-network-frame:hover .annotation-deferred,.stream-geo-frame:hover .annotation-deferred,.stream-xy-frame:focus-within .annotation-deferred,.stream-ordinal-frame:focus-within .annotation-deferred,.stream-network-frame:focus-within .annotation-deferred,.stream-geo-frame:focus-within .annotation-deferred{opacity:1;pointer-events:auto}@media (prefers-reduced-motion:reduce){.annotation-deferred{transition:none}}"},"annotation-disclosure-style")),i&&a.unshift((0,Io.jsx)("style",{children:".annotation-cohesion--layer text,.annotation-cohesion--layer tspan{fill:var(--semiotic-annotation-color,var(--semiotic-text-secondary,#666));font-style:italic}"},"annotation-cohesion-style")),a}(r)}(L?rr({annotations:P,context:o,..."object"==typeof L?L:{}}):P,e,R,o)},[P,L,R,t,n,I,N,F,s,T,B]),U=function(e){const t=(0,ir.useSyncExternalStore)(e?dr:pr,e?hr:yr,e?hr:yr);return e?t.positions.get(e)??null:null}(W);return(0,$n.useEffect)(()=>{if(!U?.locked||!W)return;const e=e=>{"Escape"===e.key&&ur(W)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[U?.locked,W]),a||m||x||C||M||V&&V.length>0||g||H||U?(0,mr.jsxs)("svg",{role:"img",width:o,height:r,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[(0,mr.jsx)("title",{children:"string"==typeof m?m:"XY Chart"}),(0,mr.jsx)("desc",{children:"string"==typeof m?m+" — XY data visualization":"XY data visualization"}),(0,mr.jsxs)("g",{transform:`translate(${i.left},${i.top})`,children:[g&&s&&(!O||D)&&(()=>{const e=kr(l?.find(e=>"bottom"===e.orient)?.gridStyle),o=kr(l?.find(e=>"left"===e.orient)?.gridStyle);return(0,mr.jsxs)("g",{className:"stream-grid",children:[E.map((t,o)=>(0,mr.jsx)("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:n,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:e},"xgrid-"+o)),$.map((e,n)=>(0,mr.jsx)("line",{x1:0,y1:e.pixel,x2:t,y2:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:o},"ygrid-"+n))]})})(),a&&s&&(()=>{const e=l?.find(e=>"left"===e.orient),o=l?.find(e=>"bottom"===e.orient),r=!e||!1!==e.baseline,s=!o||!1!==o.baseline,a=e?.jaggedBase||!1,u=o?.jaggedBase||!1,f=o?.landmarkTicks,p=e?.landmarkTicks,y="var(--semiotic-border, #ccc)",g="var(--semiotic-text-secondary, var(--semiotic-text, #666))",m="var(--semiotic-text, #333)",x=!!o?.autoRotate&&E.length>1&&(()=>{const e=t/Math.max(E.length-1,1);return E.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0)+8>e})(),b=x?12:18,v=n+(x?58:40),k={fontSize:"var(--semiotic-tick-font-size, 12px)"},w={fontSize:"calc(var(--semiotic-tick-font-size, 12px) + 1px)"},A={fontSize:"var(--semiotic-axis-label-font-size, 12px)"},S=o?.tickAnchor,C=e?.tickAnchor,M=vr(E),_=vr($);return(0,mr.jsxs)("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[(0,mr.jsxs)("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[(!O||D)&&s&&!u&&(0,mr.jsx)("line",{x1:0,y1:n,x2:t,y2:n,stroke:y,strokeWidth:1}),(!O||D)&&u&&(0,mr.jsx)("path",{d:wr("bottom",t,n),fill:"none",stroke:y,strokeWidth:1}),E.map((e,t)=>{const o=!!f&&("function"==typeof f?f(e.value,t):Kt(e.value,t>0?E[t-1].value:void 0));return(0,mr.jsxs)("g",{transform:`translate(${e.pixel},${n})`,children:[(0,mr.jsx)("line",{y2:5,stroke:y,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?(0,mr.jsx)("text",{y:b,textAnchor:x?"end":xr(S,e.pixel===M.min,e.pixel===M.max),fontWeight:o?600:400,fill:g,className:"semiotic-axis-tick",style:{userSelect:"none",...o?w:k},transform:x?"rotate(-45)":void 0,children:e.label}):(0,mr.jsx)("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:(0,mr.jsx)("div",{style:{textAlign:"center",userSelect:"none",...k},children:e.label})})]},"xtick-"+t)}),c&&(0,mr.jsx)("text",{x:t/2,y:v,textAnchor:"middle",fill:m,className:"semiotic-axis-label",style:{userSelect:"none",...A},children:c})]}),(0,mr.jsxs)("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[(!O||D)&&r&&!a&&(0,mr.jsx)("line",{x1:0,y1:0,x2:0,y2:n,stroke:y,strokeWidth:1}),(!O||D)&&a&&(0,mr.jsx)("path",{d:wr("left",t,n),fill:"none",stroke:y,strokeWidth:1}),$.map((e,t)=>{const n=!!p&&("function"==typeof p?p(e.value,t):Kt(e.value,t>0?$[t-1].value:void 0));return(0,mr.jsxs)("g",{transform:`translate(0,${e.pixel})`,children:[(0,mr.jsx)("line",{x2:-5,stroke:y,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?(0,mr.jsx)("text",{x:-8,textAnchor:"end",dominantBaseline:br(C,e.pixel===_.min,e.pixel===_.max),fontWeight:n?600:400,fill:g,className:"semiotic-axis-tick",style:{userSelect:"none",...n?w:k},children:e.label}):(0,mr.jsx)("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:(0,mr.jsx)("div",{style:{textAlign:"right",userSelect:"none",...k},children:e.label})})]},"ytick-"+t)}),(()=>{const t=e?.label||h;return t?(0,mr.jsx)("text",{x:15-i.left,y:n/2,textAnchor:"middle",fill:m,transform:`rotate(-90, ${15-i.left}, ${n/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...A},children:t}):null})()]}),(()=>{const e=l?.find(e=>"right"===e.orient);if(!e||0===Y.length)return null;const o=!1!==e.baseline,r=e.landmarkTicks,s=e.label||d,a=e.tickAnchor,c=vr(Y);return(0,mr.jsxs)("g",{className:"semiotic-axis semiotic-axis-right","data-orient":"right",children:[o&&(0,mr.jsx)("line",{x1:t,y1:0,x2:t,y2:n,stroke:y,strokeWidth:1}),Y.map((e,n)=>{const o=!!r&&("function"==typeof r?r(e.value,n):Kt(e.value,n>0?Y[n-1].value:void 0));return(0,mr.jsxs)("g",{transform:`translate(${t},${e.pixel})`,children:[(0,mr.jsx)("line",{x2:5,stroke:y,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?(0,mr.jsx)("text",{x:8,textAnchor:"start",dominantBaseline:br(a,e.pixel===c.min,e.pixel===c.max),fontWeight:o?600:400,fill:g,className:"semiotic-axis-tick",style:{userSelect:"none",...o?w:k},children:e.label}):(0,mr.jsx)("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:(0,mr.jsx)("div",{style:{textAlign:"left",userSelect:"none",...k},children:e.label})})]},"ytick-r-"+n)}),s&&(0,mr.jsx)("text",{x:t+i.right-15,y:n/2,textAnchor:"middle",fill:m,transform:`rotate(90, ${t+i.right-15}, ${n/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...A},children:s})]})})()]})})(),V,M&&s&&_&&j&&(0,mr.jsxs)(mr.Fragment,{children:[M.top&&(0,mr.jsx)("g",{transform:"translate(0, 0)",children:(0,mr.jsx)(fo,{orient:"top",config:ho(M.top),values:_,scale:s.x,size:i.top,length:t})}),M.bottom&&(0,mr.jsx)("g",{transform:`translate(0, ${n})`,children:(0,mr.jsx)(fo,{orient:"bottom",config:ho(M.bottom),values:_,scale:s.x,size:i.bottom,length:t})}),M.left&&(0,mr.jsx)("g",{transform:"translate(0, 0)",children:(0,mr.jsx)(fo,{orient:"left",config:ho(M.left),values:j,scale:s.y,size:i.left,length:n})}),M.right&&(0,mr.jsx)("g",{transform:`translate(${t}, 0)`,children:(0,mr.jsx)(fo,{orient:"right",config:ho(M.right),values:j,scale:s.y,size:i.right,length:n})})]}),C,U&&U.sourceId!==z&&s?.x&&(()=>{const e=s.x(U.xValue);if(null==e||0>e||e>t)return null;const o=U.locked;return(0,mr.jsx)("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"})})(),H]}),m&&(0,mr.jsx)("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 m?m:null}),ao({legend:x,totalWidth:o,totalHeight:r,margin:i,legendPosition:A,title:m,legendLayout:S,legendHoverBehavior:b,legendClickBehavior:v,legendHighlightedCategory:k,legendIsolatedCategories:w})]}):null}function _r(e){return(e.tl??0)>0||(e.tr??0)>0||(e.br??0)>0||(e.bl??0)>0}c(require("react")),require("d3-shape");var jr=require("react/jsx-runtime");function Pr(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}var Lr="undefined"==typeof window||"undefined"==typeof document,Rr=require("react"),Ir="undefined"!=typeof window?Rr.useLayoutEffect:Rr.useEffect,Nr=()=>()=>{},Fr=()=>!1,Tr=()=>!0,Br=require("react");function Or(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 Dr(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 Wr(e){if(null===e||"object"!=typeof e)return!1;if(Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}var zr={axisStroke:"#ccc",tickText:"#666",crosshair:"rgba(0, 0, 0, 0.25)",hoverFill:"rgba(255, 255, 255, 0.3)",hoverStroke:"rgba(0, 0, 0, 0.4)",pointRing:"white",primary:"#007bff",background:""};function Hr(e,t){const n=e.trim();if(/^#[0-9a-f]{3}$/i.test(n)){const e=n[1],o=n[2],r=n[3];return`#${e}${e}${o}${o}${r}${r}${t}`}if(/^#[0-9a-f]{6}$/i.test(n))return`${n}${t}`;const o=n.match(/^rgb\s*\(\s*([^)]+?)\s*\)$/i);return o?`rgba(${o[1]}, ${(parseInt(t,16)/255).toFixed(3)})`:n}var Er=c(require("react")),$r=c(require("react")),Yr=(require("react/jsx-runtime"),$r.createContext(null));function Gr(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 qr(e){return e&&"object"==typeof e?e:{}}function Xr(e){return qr(e.accessibility).tableFields??e.accessibleDatum??e.datum}var Vr=require("react/jsx-runtime"),Ur={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function Kr(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e){if(null===t?.datum)continue;const e=t.type+"";n[e]=(n[e]||0)+1}if(0===Object.keys(n).length)return t+", empty";const o=[],r={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},i=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],s=Object.keys(n).sort((e,t)=>{const n=i.indexOf(e),o=i.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of s)o.push(`${n[e]} ${r[e]||e}`);return`${t}, ${o.join(", ")}`}var Qr=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},Zr="semiotic-accessible-data-table",Jr=Zr+" semiotic-accessible-data-table-hidden",ei=Zr+" semiotic-accessible-data-table-visible",ti={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"},ni={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},oi={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)"},ri={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},ii={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))"},si={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},ai={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},li={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 ci({scene:e,chartType:t,tableId:n,chartTitle:o}){const[r,i]=Er.useState(!1),[s,a]=Er.useState(5),l=$r.useContext(Yr),c=l?.visible??!1,u=r||c,h=Er.useRef(null),d=o?"Data summary for "+o:n?`Data summary for ${t} ${n}`:"Data summary for "+t;Er.useEffect(()=>{u||a(5)},[u]);const f=Er.useCallback(e=>{e.target===e.currentTarget&&(r||c||i(!0))},[r,c]),p=Er.useCallback(e=>{c||h.current?.contains(e.relatedTarget)||i(!1)},[c]);if(!e||0===e.length)return n?(0,Vr.jsx)("span",{id:n,tabIndex:-1,style:Ur}):null;if(!u)return(0,Vr.jsx)("div",{id:n,className:Jr,tabIndex:-1,onFocus:f,style:Ur,role:"region","aria-label":d,children:(0,Vr.jsxs)("button",{type:"button",onClick:()=>i(!0),children:["View data summary (",e.length," elements)"]})});const y=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:Gr(Xr(o))});break;case"line":case"area":{const e=Xr(o),n=Array.isArray(e)?e:[],r="line"===o.type?"Line point":"Area point";for(const e of n)t.push({label:r,values:Gr(e)});break}case"rect":{const e=Xr(o),n=null!=e&&"object"==typeof e?e:{},r=n.category??o.group??"",i=n.value??n.__aggregateValue??n.total,s=Gr(n);null==s.category&&""!==r&&(s.category=r+""),null==s.value&&null!=i&&(s.value="number"==typeof i||"string"==typeof i?i:i+""),t.push({label:"Bar",values:s});break}case"heatcell":{const e=Gr(Xr(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=Xr(o),n=Gr(e);if(null==n.category){const t=qr(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:Gr(Xr(o))});break;case"arc":t.push({label:"Arc",values:Gr(Xr(o))});break;case"candlestick":t.push({label:"Candlestick",values:Gr(Xr(o))});break;case"geoarea":{const e=qr(Xr(o)),n=Gr(e);if(null==n.name){const t=qr(e.properties).name??e.name;null!=t&&(n.name=t+"")}t.push({label:"Region",values:n});break}}}catch{}return t}(e),g=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}(y),m=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${Qr(e.min)} to ${Qr(e.max)}, mean ${Qr(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(" ")}(y.length,g),x=Math.min(s,y.length),b=y.slice(0,x),v=y.length-x,k=new Set;for(const e of b)for(const t of Object.keys(e.values))k.add(t);const w=Array.from(k);return(0,Vr.jsxs)("div",{ref:h,id:n,className:ei,tabIndex:-1,onBlur:p,style:ti,role:"region","aria-label":d,children:[(0,Vr.jsx)("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{c&&l&&l.setVisible(!1),i(!1)},"aria-label":"Close data summary",style:oi,children:"×"}),(0,Vr.jsx)("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:ni,children:m}),(0,Vr.jsxs)("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+t,style:ri,children:[(0,Vr.jsx)("caption",{className:"semiotic-accessible-data-table-caption",style:ai,children:v>0?`First ${x} of ${y.length} data points`:`All ${y.length} data points`}),(0,Vr.jsx)("thead",{children:(0,Vr.jsxs)("tr",{children:[(0,Vr.jsx)("th",{style:ii,children:"type"}),w.map(e=>(0,Vr.jsx)("th",{style:ii,children:e},e))]})}),(0,Vr.jsx)("tbody",{children:b.map((e,t)=>(0,Vr.jsxs)("tr",{children:[(0,Vr.jsx)("td",{style:si,children:e.label}),w.map(t=>{return(0,Vr.jsx)("td",{style:si,children:(n=e.values[t],null==n||""===n?"—":"number"==typeof n?Number.isNaN(n)?"—":Qr(n):"boolean"==typeof n?n?"true":"false":"object"==typeof n?"—":n+"")},t);var n})]},t))})]}),v>0&&(0,Vr.jsxs)("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>a(e=>e+25),style:li,children:["Show ",Math.min(25,v)," more"," ",1===v?"row":"rows"," (",v," remaining)"]})]})}function ui({summary:e}){return e?(0,Vr.jsx)("div",{role:"note",style:Ur,children:e}):null}function hi({tableId:e}){return(0,Vr.jsx)("a",{href:"#"+e,style:Ur,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,Ur)},children:"Skip to data table"})}function di({hoverPoint:e}){let t="";if(e){const n=e.data||e;t="object"==typeof n?"Data point: "+Object.entries(n).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Data point: "+n}return(0,Vr.jsx)("div",{"aria-live":"polite","aria-atomic":"true",style:Ur,children:t})}var fi=require("react/jsx-runtime"),pi="var(--semiotic-focus, #005fcc)";function yi({active:e,hoverPoint:t,margin:n,size:o,shape:r="circle",width:i,height:s,pathData:a}){if(!e||!t)return null;const l=t.x+n.left,c=t.y+n.top;let u;if("geoarea"!==r&&"path"!==r||!a)if("rect"===r&&null!=i&&null!=s){const e=Math.max(i,4),t=Math.max(s,4);u=(0,fi.jsx)("rect",{x:l-e/2-3,y:c-t/2-3,width:e+6,height:t+6,rx:3,fill:"none",stroke:pi,strokeWidth:2,strokeDasharray:"4,2"})}else u=(0,fi.jsx)("circle","wedge"===r?{cx:l,cy:c,r:12,fill:"none",stroke:pi,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:pi,strokeWidth:2,strokeDasharray:"4,2"});else u=(0,fi.jsx)("g",{transform:`translate(${n.left},${n.top})`,children:(0,fi.jsx)("path",{d:a,fill:"none",stroke:pi,strokeWidth:2.5,strokeDasharray:"6,3"})});return(0,fi.jsx)("svg",{style:{position:"absolute",left:0,top:0,width:o[0],height:o[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}var gi=c(require("react"));function mi(e,t){return"touch"===t?Math.max(e,24):e}function xi(e){return Array.isArray(e)?e[0]:e}function bi(e,t,n,o){return{data:xi(e),x:t,y:n,__semioticHoverData:!0,...o}}var vi=["name","label","title"],ki=["type","kind","category","group","class","status","role","shape"],wi=["value","amount","total","count","weight","score"],Ai=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 Si(e,t){for(const n of t){const t=e.find(e=>e.lower===n);if(t)return t}}var Ci=require("react/jsx-runtime"),Mi={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 _i(e,t){return"function"==typeof t?t(e):e[t]}function ji(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 Pi(e={}){const{fields:t,title:n,format:o,style:r={},className:i=""}=e;return e=>{if(!e||"object"!=typeof e)return null;let s;const a=[];if(n){const t=_i(e,n);s=ji(t,o)}if(t&&t.length>0)t.forEach(t=>{let n,r,i;"string"==typeof t?(n=t,r=t,i=o):(n=t.label,r=t.accessor||t.key||"",i=t.format||o);const s=_i(e,r);a.push({label:n,value:ji(s,i)})});else if(!n){const t=["value","y","name","id","label"];for(const n of t)if(void 0!==e[n]){s=ji(e[n],o);break}if(!s){const t=Object.keys(e).filter(e=>!e.startsWith("_"));t.length>0&&(s=ji(e[t[0]],o))}}const l={...Mi,...r};return(0,Ci.jsxs)("div",{className:("semiotic-tooltip "+i).trim(),style:l,children:[s&&(0,Ci.jsx)("div",{style:{fontWeight:a.length>0?"bold":"normal"},children:s}),a.map((e,t)=>(0,Ci.jsxs)("div",{style:{marginTop:0===t&&s?"4px":0},children:[e.label&&(0,Ci.jsxs)("span",{children:[e.label,": "]}),e.value]},t))]})}}function Li(){return e=>{const t=e.allSeries;if(!t||0===t.length)return(0,Ci.jsx)("div",{className:"semiotic-tooltip",style:Mi,children:(0,Ci.jsx)("div",{children:ji(e.data?.value??e.data?.y)})});const n=e.xValue??e.data?.time??e.data?.x;return(0,Ci.jsxs)("div",{className:"semiotic-tooltip",style:Mi,children:[null!=n&&(0,Ci.jsx)("div",{style:{fontWeight:600,marginBottom:4,fontSize:"0.9em",borderBottom:"1px solid var(--semiotic-border, #eee)",paddingBottom:4},children:ji(n)}),t.map((e,t)=>(0,Ci.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"1px 0"},children:[(0,Ci.jsx)("span",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:e.color,flexShrink:0}}),(0,Ci.jsx)("span",{style:{flex:1,fontSize:"0.85em"},children:e.group}),(0,Ci.jsx)("span",{style:{fontWeight:500,fontSize:"0.85em"},children:ji(e.value)})]},t))]})}}function Ri(e){if(!0!==e){if("function"==typeof e){const t=e;return e=>{let n=xi(!0===e?.__semioticHoverData||e&&void 0!==e.data&&"number"==typeof e.x&&"number"==typeof e.y&&e&&("node"===e.type||"edge"===e.type||void 0!==e.nodeOrEdge||void 0!==e.allSeries||void 0!==e.stats||void 0!==e.__chartType)?e.data??{}:e);("node"===e?.nodeOrEdge&&"number"==typeof n?.x0&&"number"==typeof n?.x1||"edge"===e?.nodeOrEdge&&"number"==typeof n?.sankeyWidth)&&n.data&&"object"==typeof n.data&&(n=n.data);const o=t(n);return null==o?null:(0,Ci.jsx)("div",{className:"semiotic-tooltip",style:Mi,children:o})}}return!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?Pi(e):Pi())}}var Ii=require("react/jsx-runtime");function Ni({x:e,y:t,containerWidth:n,containerHeight:o,margin:r,children:i,className:s="stream-frame-tooltip",zIndex:a=1}){const l=Number.isFinite(e)&&Number.isFinite(t),c=gi.useRef(null),[u,h]=gi.useState(null);gi.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,s,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(!gi.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:Mi;return l?(0,Ii.jsx)("div",{ref:c,className:f?s:(s+" semiotic-tooltip").trim(),style:{...p||{},position:"absolute",left:r.left+e,top:r.top+t,transform:d,pointerEvents:"none",zIndex:a,width:"max-content"},children:i}):null}var Fi=c(require("react")),Ti=require("react"),Bi=require("react");var Oi=require("react");function Di(e,t,n){const o=(0,Oi.useRef)(null),[r,i]=(0,Oi.useState)(null);return(0,Oi.useEffect)(()=>{if(!t&&!n)return;const e=o.current;if(!e)return;const r=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;i(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return r.observe(e),()=>r.disconnect()},[t,n]),[o,[t&&r?r.w:e[0],n&&r?r.h:e[1]]]}var Wi="undefined"==typeof window?Ti.useEffect:Ti.useLayoutEffect,zi={requestAnimationFrame:e=>("undefined"==typeof window?globalThis:window).requestAnimationFrame(e),cancelAnimationFrame:e=>("undefined"==typeof window?globalThis:window).cancelAnimationFrame(e)};function Hi(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function Ei(e){const t=function(){const[e,t]=(0,Bi.useState)(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return(0,Bi.useEffect)(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),function(e,t){if("function"==typeof e.addEventListener)return e.addEventListener("change",t),()=>e.removeEventListener("change",t);const n=e;return n.addListener(t),()=>n.removeListener(t)}(e,e=>t(e.matches))},[]),e}(),n=(0,Ti.useRef)(t);n.current=t;const[o,r]=Di(e.sizeProp,e.responsiveWidth,e.responsiveHeight),i=(0,Ti.useMemo)(()=>({...e.marginDefault,...e.userMargin}),[e.marginDefault,e.userMargin]),s=r[0]-i.left-i.right,a=r[1]-i.top-i.bottom,l=Hi(e.foregroundGraphics,r,i),c=Hi(e.backgroundGraphics,r,i),u=J(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-"+Fi.useId(),p=(0,Ti.useRef)(null),y=(0,Ti.useRef)(e.frameScheduler??zi);y.current=e.frameScheduler??zi;const g=(0,Ti.useRef)(null),m=(0,Ti.useRef)(!1),x=(0,Ti.useRef)(()=>{}),b=(0,Ti.useCallback)(()=>{if(null!==p.current||m.current)return;const e=y.current;let t=!1,n=!1;const o=e.requestAnimationFrame(()=>{t=!0;const e=!n;e&&(m.current=!0),p.current=null,g.current=null;try{x.current()}finally{e&&(m.current=!1)}});n=!0,t||(p.current=o,g.current=e)},[]),v=(0,Ti.useCallback)(()=>{null!==p.current&&((g.current??y.current).cancelAnimationFrame(p.current),p.current=null,g.current=null)},[]);(0,Ti.useEffect)(()=>()=>{v()},[v]);const k=(0,Ti.useRef)(()=>{}),w=(0,Ti.useRef)(()=>{}),A=(0,Ti.useRef)(null),S=(0,Ti.useRef)(null),C=(0,Ti.useRef)(null),M=(0,Ti.useCallback)(()=>{const e=A.current;A.current=null,e&&k.current(e)},[]),_=(0,Ti.useCallback)(e=>{if(A.current={clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType},null===S.current){const e=y.current;let t=!1;const n=e.requestAnimationFrame(()=>{t=!0,S.current=null,C.current=null,M()});t||(S.current=n,C.current=e)}},[M]),j=(0,Ti.useCallback)(()=>{A.current=null,null!==S.current&&((C.current??y.current).cancelAnimationFrame(S.current),S.current=null,C.current=null),w.current()},[]);(0,Ti.useEffect)(()=>()=>{A.current=null,null!==S.current&&((C.current??y.current).cancelAnimationFrame(S.current),S.current=null,C.current=null)},[]);const P=e.themeDirtyRef;return Wi(()=>{P&&(un++,P.current=!0,b())},[u,b,P]),{reducedMotion:t,reducedMotionRef:n,responsiveRef:o,size:r,margin:i,adjustedWidth:s,adjustedHeight:a,resolvedForeground:l,resolvedBackground:c,currentTheme:u,transition:h,introEnabled:d,tableId:f,rafRef:p,renderFnRef:x,scheduleRender:b,cancelRender:v,hoverHandlerRef:k,hoverLeaveRef:w,onPointerMove:_,onPointerLeave:j}}function $i(e,t,n,o){const r=e.getContext("2d");if(!r)return null;const i=Math.round(t[0]*o),s=Math.round(t[1]*o),a=i/t[0],l=s/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===s||(e.width=i,e.height=s),r.setTransform(a,0,0,l,0,0),r.translate(n.left,n.top),r}var Yi=require("react");function Gi(e,t,n,o){return"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:n,fn:e}:"string"==typeof t?{key:t,fn:null}:"function"==typeof t?{key:o,fn:t}:{key:void 0,fn:null}}var qi=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Xi=3156e7;function Vi(e){const t=e[1]-e[0];return 864e5>t?e=>{const t=new Date(e);return`${(t.getUTCHours()+"").padStart(2,"0")}:${(t.getUTCMinutes()+"").padStart(2,"0")}`}:Xi>t?e=>{const t=new Date(e);return`${qi[t.getUTCMonth()]} ${t.getUTCDate()}`}:5*Xi>t?e=>{const t=new Date(e);return`${qi[t.getUTCMonth()]} ${t.getUTCFullYear()}`}:e=>new Date(e).getUTCFullYear()+""}function Ui(e){if(!e)return;const t=[];for(const n of e)if("point"===n.type)t.push(n);else if("symbol"===n.type)t.push({pointId:n.pointId,x:n.x,y:n.y,r:ut(n.size)});else if("glyph"===n.type){const e=sn(n.glyph,n.size);t.push({pointId:n.pointId,x:n.x+e.centerDx,y:n.y+e.centerDy,r:e.radius})}return t}var Ki=require("d3-shape");function Qi(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 Zi(e,t,n,o,r,i){if(2>t.length)return;const s=[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];s.push(s[e-1]+Math.sqrt(n*n+o*o))}const a=s[s.length-1];if(0===a)return;const l=Math.min(.2*a,40);e.strokeStyle=n,e.lineWidth=o,e.lineCap=i;for(let n=0;t.length-1>n;n++){const o=(s[n]+s[n+1])/2;let i=r;l>o&&(i*=o/l),l>a-o&&(i*=(a-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()}}var Ji=(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=pn(e,r)||r,s=t.style.strokeWidth||2,a=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=s,e.lineCap=t.style.strokeLinecap||"butt",t.style._edgeFade){Zi(e,t.path,i,s,t.style.opacity??1,t.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const c=gn(t.curve),u=a&&a.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,s=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],y=Qi(p,a,i);if(null!==r&&null!==u&&null!==c){if(y===u)e.lineTo(d,f);else{const t=[];for(const e of a){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=s+(f-s)*l.t,h=Qi(c+(p-c)*Math.min(l.t+1e-4,1),a,i);e.lineTo(t,u),o(),n(h,t,u)}e.lineTo(d,f)}r=d,s=f,c=p,u=y}else n(y,d,f),r=d,s=f,c=p,u=y}o()}else{e.beginPath();const n=t.strokeGradient&&t.path.length>=2?bn(e,t.strokeGradient,t.path[0][0],0,t.path[t.path.length-1][0],0):null;if(e.strokeStyle=n||i,c)(0,Ki.line)().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=mn(e,t.style.fill,t.style.fill),c&&!u)(0,Ki.line)().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"}};function es(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function ts(e,t,n=.3){es(t)&&(e.globalAlpha=t._pulseIntensity*n,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h))}function ns(e,t,n=.6){if(!es(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 os(e,t,n,o=.35){es(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",n?e.fill(n):e.fill())}var rs=require("d3-shape");function is(e,t){const n=gn(t.curve);if(!n||2>t.topPath.length||2>t.bottomPath.length){e.beginPath(),e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1]);for(let n=t.bottomPath.length-1;n>=0;n--)e.lineTo(t.bottomPath[n][0],t.bottomPath[n][1]);e.closePath()}else{const o=(0,rs.area)().x(e=>e[0]).y0((e,n)=>t.bottomPath[n][1]).y1(e=>e[1]).curve(n).context(e);e.beginPath(),o(t.topPath)}}var ss=(e,t,n,o)=>{const r=t.filter(e=>"area"===e.type);for(const t of r){if(2>t.topPath.length)continue;let n=!1;t.clipRect&&(e.save(),e.beginPath(),e.rect(t.clipRect.x,t.clipRect.y,t.clipRect.width,t.clipRect.height),e.clip(),n=!0);const r=t._introClipFraction;void 0!==r&&1>r&&(e.save(),e.beginPath(),e.rect(0,0,o.width*r,o.height),e.clip());const i=mn(e,t.style.fill,"#4e79a7"),s=t._decayOpacities;if(s&&s.length===t.topPath.length){const n=t.style.fillOpacity??.7;e.fillStyle=i;for(let o=0;t.topPath.length-1>o;o++)e.globalAlpha=.5*(s[o]+s[o+1])*n,e.beginPath(),e.moveTo(t.topPath[o][0],t.topPath[o][1]),e.lineTo(t.topPath[o+1][0],t.topPath[o+1][1]),e.lineTo(t.bottomPath[o+1][0],t.bottomPath[o+1][1]),e.lineTo(t.bottomPath[o][0],t.bottomPath[o][1]),e.closePath(),e.fill();if(t.style.stroke&&"none"!==t.style.stroke){e.strokeStyle=pn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);for(let n=0;t.topPath.length-1>n;n++)e.globalAlpha=.5*(s[n]+s[n+1]),e.beginPath(),e.moveTo(t.topPath[n][0],t.topPath[n][1]),e.lineTo(t.topPath[n+1][0],t.topPath[n+1][1]),e.stroke()}e.globalAlpha=1;continue}const a=t.style.opacity??1;if(is(e,t),t.fillGradient&&("colorStops"in t.fillGradient&&t.fillGradient.colorStops.length>=2||"topOpacity"in t.fillGradient)&&t.fillGradient){let n=1/0;for(const e of t.topPath)n>e[1]&&(n=e[1]);let o=-1/0;for(const e of t.bottomPath)e[1]>o&&(o=e[1]);const r=xn(e,t.fillGradient,"string"==typeof i?i:"#4e79a7",0,n,0,o);e.fillStyle=r||i,e.globalAlpha=a}else e.globalAlpha=(t.style.fillOpacity??.7)*a,e.fillStyle=i;if(e.fill(),t._pulseIntensity&&t._pulseIntensity>0&&(is(e,t),os(e,t)),t.style.stroke&&"none"!==t.style.stroke){e.globalAlpha=a;const n=t.strokeGradient&&t.topPath.length>=2?bn(e,t.strokeGradient,t.topPath[0][0],0,t.topPath[t.topPath.length-1][0],0):null;e.strokeStyle=n||pn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);const o=gn(t.curve);if(e.beginPath(),o)(0,rs.line)().x(e=>e[0]).y(e=>e[1]).curve(o).context(e)(t.topPath);else{e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1])}e.stroke()}void 0!==r&&1>r&&e.restore(),n&&e.restore(),e.globalAlpha=1}},as=(e,t,n,o)=>{const r=t.filter(e=>"point"===e.type);if(0!==r.length){e.save();try{const t=e.globalAlpha;for(const n of r)e.beginPath(),e.arc(n.x,n.y,n.r,0,2*Math.PI),e.globalAlpha=t*(n.style.opacity??n.style.fillOpacity??1),e.fillStyle=mn(e,n.style.fill,"#4e79a7"),e.fill(),n.style.stroke&&(e.strokeStyle=mn(e,n.style.stroke,n.style.stroke),e.lineWidth=n.style.strokeWidth||1,e.stroke()),ns(e,n)}finally{e.restore()}}},ls=new Map;function cs(e){try{if(e.path)return new Path2D(e.path);const t=`${e.symbolType??"circle"}:${Math.round(e.size)}`;let n=ls.get(t);return n||(n=new Path2D(ct(e.symbolType,e.size)),ls.size>256&&ls.clear(),ls.set(t,n)),n}catch{return null}}var us=(e,t)=>{const n=e.globalAlpha;for(const o of t){if("symbol"!==o.type)continue;const t=o;if(0>=t.size)continue;const r=cs(t);if(!r)continue;e.save(),e.translate(t.x,t.y),t.rotation&&e.rotate(t.rotation);const i=(t.style.opacity??1)*(t._decayOpacity??1);t.style.fill&&(e.globalAlpha=n*i*(t.style.fillOpacity??1),e.fillStyle=mn(e,t.style.fill,"#4e79a7"),e.fill(r)),t.style.stroke&&"none"!==t.style.stroke&&(e.globalAlpha=n*i,e.strokeStyle=mn(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth??1,e.stroke(r)),e.restore()}e.globalAlpha=n};function hs(e,t,n,o,r){if(0>=t.size)return;const i=t.glyph;if(!i||!i.parts?.length)return;const s=Jt(i,t.size);if(0>=s.scale)return;const a=(t.style.opacity??1)*(t._decayOpacity??1);if(0>=a)return;const l=t=>{const n=mn(e,t,t);return"string"==typeof n?n:t},c=t.color??("string"==typeof t.style.fill?t.style.fill:void 0);e.save(),e.translate(n,o),t.rotation&&e.rotate(t.rotation),e.translate(s.offsetX,s.offsetY),e.scale(s.scale,s.scale),e.globalAlpha=r*a*(t.style.fillOpacity??1);const u=rn(i,t.fraction??1,t.fractionStart??0,t.fractionDirection??"horizontal");u&&t.ghostColor&&an(e,i,c,t.accent,t.ghostColor,l),u&&(e.beginPath(),e.rect(u.x,u.y,u.width,u.height),e.clip()),an(e,i,c,t.accent,void 0,l),e.restore()}function ds(e,t){const{x:n,y:o,w:r,h:i}=t,{tl:s,tr:a,br:l,bl:c}=function(e){const t=e.cornerRadii;if(!t)return{tl:0,tr:0,br:0,bl:0};const n=Math.min(e.w,e.h)/2,o=e=>Math.max(0,Math.min(e??0,n));return{tl:o(t.tl),tr:o(t.tr),br:o(t.br),bl:o(t.bl)}}(t);e.beginPath(),e.moveTo(n+s,o),e.lineTo(n+r-a,o),a>0&&e.arcTo(n+r,o,n+r,o+a,a),e.lineTo(n+r,o+i-l),l>0&&e.arcTo(n+r,o+i,n+r-l,o+i,l),e.lineTo(n+c,o+i),c>0&&e.arcTo(n,o+i,n,o+i-c,c),e.lineTo(n,o+s),s>0&&e.arcTo(n,o,n+s,o,s),e.closePath()}function fs(e){switch(e.roundedEdge){case"bottom":return{x0:e.x,y0:e.y+e.h,x1:e.x,y1:e.y};case"right":return{x0:e.x+e.w,y0:e.y,x1:e.x,y1:e.y};case"left":return{x0:e.x,y0:e.y,x1:e.x+e.w,y1:e.y};default:return{x0:e.x,y0:e.y,x1:e.x,y1:e.y+e.h}}}var ps=(e,t,n,o)=>{const r=t.filter(e=>"rect"===e.type);for(const t of r){if(null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon)ys(e,t);else if(t.cornerRadii&&_r(t.cornerRadii)){const n=mn(e,t.style.fill,pn(e,"var(--semiotic-primary, #007bff)")),o=fs(t),r=t.fillGradient&&"string"==typeof n?xn(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=r||n,ds(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=pn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else if(t.roundedTop&&t.roundedTop>0){const n=mn(e,t.style.fill,pn(e,"var(--semiotic-primary, #007bff)")),o=fs(t),r=t.fillGradient&&"string"==typeof n?xn(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=r||n;const i=Math.min(t.roundedTop,t.w/2,t.h/2);e.beginPath();const{x:s,y:a,w:l,h:c}=t;switch(t.roundedEdge){case"right":e.moveTo(s,a),e.lineTo(s+l-i,a),e.arcTo(s+l,a,s+l,a+i,i),e.lineTo(s+l,a+c-i),e.arcTo(s+l,a+c,s+l-i,a+c,i),e.lineTo(s,a+c);break;case"left":e.moveTo(s+l,a),e.lineTo(s+i,a),e.arcTo(s,a,s,a+i,i),e.lineTo(s,a+c-i),e.arcTo(s,a+c,s+i,a+c,i),e.lineTo(s+l,a+c);break;case"bottom":e.moveTo(s,a),e.lineTo(s+l,a),e.lineTo(s+l,a+c-i),e.arcTo(s+l,a+c,s+l-i,a+c,i),e.lineTo(s+i,a+c),e.arcTo(s,a+c,s,a+c-i,i);break;default:e.moveTo(s,a+c),e.lineTo(s,a+i),e.arcTo(s,a,s+i,a,i),e.lineTo(s+l-i,a),e.arcTo(s+l,a,s+l,a+i,i),e.lineTo(s+l,a+c)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=pn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const n=mn(e,t.style.fill,pn(e,"var(--semiotic-primary, #007bff)")),o=fs(t),r=t.fillGradient&&"string"==typeof n?xn(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=r||n,e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=pn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}ts(e,t),e.globalAlpha=1}};function ys(e,t){const n=t.style.icon,o=t.style.iconPadding||2,r=Math.min(t.w,t.h)-o;if(0>=r)return;const i=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),i){const i=r+o,s=t.x+(t.w-r)/2;for(let o=t.y+t.h-r;o>=t.y-r;o-=i)e.drawImage(n,s,o,r,r)}else{const i=r+o,s=t.y+(t.h-r)/2;for(let o=t.x;t.x+t.w>o;o+=i)e.drawImage(n,o,s,r,r)}e.restore()}function gs(e){const[t,n,o]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(e);return.299*t+.587*n+.114*o>128?"#000":"#fff"}function ms(e){return Number.isInteger(e)?e+"":100>Math.abs(e)?1>Math.abs(e)?e.toPrecision(3):e.toFixed(1):e.toFixed(0)}var xs=(e,t,n,o)=>{const r=t.filter(e=>"heatcell"===e.type);e.save();try{for(const t of r){const n=t.style;if(null!=n?.opacity&&(e.globalAlpha=n.opacity),e.fillStyle=t.fill,e.fillRect(t.x,t.y,t.w,t.h),e.strokeStyle=pn(e,"var(--semiotic-surface, #fff)"),e.lineWidth=1,e.strokeRect(t.x,t.y,t.w,t.h),ts(e,t),e.globalAlpha=1,t.showValues&&null!=t.value){if(20>t.w||20>t.h)continue;const n=t.valueFormat?t.valueFormat(t.value):ms(t.value),o=Math.max(10,Math.min(16,.3*Math.min(t.w,t.h))),r=t.x+t.w/2,i=t.y+t.h/2;e.fillStyle=gs(t.fill),e.font=o+"px sans-serif",e.textAlign="center",e.textBaseline="middle",e.fillText(n,r,i)}}}finally{e.restore()}},bs=(e,t,n,o)=>{for(const n of t){if("candlestick"!==n.type)continue;const t=n;e.save();const r=(t._decayOpacity??1)*(t.style?.opacity??1);1!==r&&(e.globalAlpha=r);const i=pn(e,t.wickColor)||t.wickColor,s=60>o.height,a=s?Math.max(t.wickWidth,2):t.wickWidth,l=()=>{e.beginPath(),e.moveTo(t.x,t.highY),e.lineTo(t.x,t.lowY),e.strokeStyle=i,e.lineWidth=a,e.stroke()};if(s||l(),t.isRange){const n=Math.max(2,Math.min(t.bodyWidth/2,.12*o.height));e.fillStyle=i,e.beginPath(),e.arc(t.x,t.highY,n,0,2*Math.PI),e.fill(),e.beginPath(),e.arc(t.x,t.lowY,n,0,2*Math.PI),e.fill()}else if(t.bodyWidth>0){const n=Math.min(t.openY,t.closeY),o=Math.abs(t.openY-t.closeY),r=t.isUp?t.upColor:t.downColor,i=pn(e,r)||r;e.fillStyle=i,e.fillRect(t.x-t.bodyWidth/2,n,t.bodyWidth,Math.max(o,1)),e.strokeStyle=i,e.lineWidth=1,e.strokeRect(t.x-t.bodyWidth/2,n,t.bodyWidth,Math.max(o,1))}s&&l(),e.restore()}},vs={line:[ss,Ji,as],area:[ss,as],stackedarea:[ss,as],scatter:[as,us],bubble:[as,us],heatmap:[xs],bar:[ps],swarm:[as],waterfall:[(e,t,n,o)=>{ps(e,t);const r=t.filter(e=>"rect"===e.type);if(2>r.length)return;const i=r[0].datum,s=i?._connectorStroke;if(s){e.save(),e.strokeStyle=pn(e,s)||s,e.lineWidth=i?._connectorWidth??1,e.setLineDash([]);for(let t=0;r.length-1>t;t++){const o=r[t],i=r[t+1],s=o.datum,a=i.datum;if(null==s?.cumEnd||null==a?.baseline)continue;const l=n.y(s.cumEnd),c=o.x+o.w,u=i.x;e.beginPath(),e.moveTo(c,l),e.lineTo(u,l),e.stroke()}e.restore()}}],candlestick:[bs],mixed:[ss,Ji,as],custom:[ss,ps,xs,Ji,as,us,(e,t)=>{const n=e.globalAlpha;for(const o of t)"glyph"===o.type&&hs(e,o,o.x,o.y,n);e.globalAlpha=n},bs]},ks=require("react/jsx-runtime");function ws(e){return"string"==typeof e?e:"value"}function As(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function Ss(e,t){if(!t)return As(e);try{const n=t(e);return null==n?As(e):n}catch{return As(e)}}function Cs(e,t){return"function"==typeof t?t(e):e[t]}function Ms(e,t){if(!e)return[];const n=[];return(Array.isArray(e)?e:[e]).forEach((e,o)=>{const r="string"==typeof e?.y0Accessor?e.y0Accessor:"low",i="string"==typeof e?.y1Accessor?e.y1Accessor:"high";n.push({label:r,accessor:e=>e?.bands?.[o]?.y0??(0===o?e?.band?.y0:void 0),format:t}),n.push({label:i,accessor:e=>e?.bands?.[o]?.y1??(0===o?e?.band?.y1:void 0),format:t})}),n}function _s(e){const t=e.find(e=>"title"===e.role),n=e.filter(e=>"title"!==e.role);return e=>{const o=e.data;if(!o)return null;const r=t?Ss(Cs(o,t.accessor),t.format):null;return(0,ks.jsxs)("div",{className:"semiotic-tooltip",style:Mi,children:[null!=r&&(0,ks.jsx)("div",{style:{fontWeight:"bold",marginBottom:n.length>0?4:0},children:r}),n.map((e,t)=>{const n=Ss(Cs(o,e.accessor),e.format);return(0,ks.jsxs)("div",{style:t>0?{marginTop:2}:void 0,children:[(0,ks.jsxs)("span",{style:{opacity:.7},children:[e.label,": "]}),(0,ks.jsx)("span",{children:n})]},t)})]})}}var js=require("react/jsx-runtime");function Ps(e){return null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+""}function Ls({hover:e}){const t=e.data??{},n=t.y??t.value,o=t.x??t.time;if(void 0===n&&void 0===o){const e=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&&Ai.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=>vi.includes(e.lower));const s=i>=0;0>i&&(i=r.findIndex(e=>"id"===e.lower)),0>i&&(i=r.findIndex(e=>"string"==typeof e.value));const a=0>i?void 0:r[i];let l=r.filter((e,t)=>t!==i);s&&(l=l.filter(e=>"id"!==e.lower));const c=Si(l,ki),u=Si(l,wi),h=new Set(ki),d=new Set(wi),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:a?.key,title:a?.value,entries:f}}(t);if(null!=e.title||e.entries.length>0)return(0,js.jsxs)("div",{className:"semiotic-tooltip",style:Mi,children:[null!=e.title&&(0,js.jsx)("div",{style:{fontWeight:600,marginBottom:e.entries.length?2:0},children:e.title+""}),e.entries.map(e=>(0,js.jsxs)("div",{style:{opacity:.7,fontSize:11},children:[e.key,":"," ",(0,js.jsx)("span",{style:{fontWeight:600},children:Ps(e.value)})]},e.key))]})}return(0,js.jsxs)("div",{className:"semiotic-tooltip",style:Mi,children:[(0,js.jsx)("div",{style:{fontWeight:600,marginBottom:2},children:Ps(n)}),(0,js.jsx)("div",{style:{opacity:.7,fontSize:11},children:Ps(o)})]})}Ls.ownsChrome=!0;var Rs=require("react/jsx-runtime"),Is={top:20,right:20,bottom:30,left:40},Ns=zr;function Fs(e){if(e)return"x"===e.dimension?"pan-y":"y"===e.dimension?"pan-x":"none"}var Ts=(0,j.memo)((0,j.forwardRef)(function(e,t){const{chartType:n,runtimeMode:o,data:r,chunkThreshold:i,chunkSize:s,xAccessor:a,yAccessor:l,accessorRevision:c,colorAccessor:u,sizeAccessor:h,symbolAccessor:d,symbolMap:f,groupAccessor:p,lineDataAccessor:y,curve:g,normalize:m,baseline:x,stackOrder:b,binSize:v,valueAccessor:k,arrowOfTime:w="right",windowMode:A="sliding",windowSize:S=200,timeAccessor:C,xExtent:M,yExtent:P,extentPadding:L=.1,scalePadding:R,sizeRange:I,size:N=[500,300],responsiveWidth:F,responsiveHeight:T,margin:B,className:D,background:H,lineStyle:E,pointStyle:$,areaStyle:Y,barStyle:q,waterfallStyle:X,swarmStyle:V,barColors:U,colorScheme:K,boundsAccessor:Q,boundsStyle:Z,y0Accessor:J,band:ee,gradientFill:te,lineGradient:ne,areaGroups:oe,openAccessor:re,highAccessor:ie,lowAccessor:se,closeAccessor:ae,candlestickStyle:le,showAxes:ce=!0,axes:ue,xLabel:he,yLabel:de,yLabelRight:fe,xFormat:pe,yFormat:ye,axisExtent:ge,tickFormatTime:me,tickFormatValue:xe,hoverAnnotation:be,tooltipContent:ve,customHoverBehavior:ke,customClickBehavior:we,enableHover:Ae,hoverRadius:Se=30,tooltipMode:Ce,annotations:Me,autoPlaceAnnotations:_e,svgAnnotationRules:je,showGrid:Pe,legend:Le,legendHoverBehavior:Re,legendClickBehavior:Ie,legendHighlightedCategory:Ne,legendIsolatedCategories:Fe,legendPosition:Te,legendLayout:Be,legendCategoryAccessor:Oe,onCategoriesChange:De,backgroundGraphics:We,foregroundGraphics:ze,canvasPreRenderers:He,svgPreRenderers:Ee,title:$e,categoryAccessor:Ye,brush:Ge,onBrush:qe,decay:Xe,pulse:Ve,transition:Ue,animate:Ke,staleness:Qe,heatmapAggregation:Ze,heatmapXBins:Je,heatmapYBins:et,showValues:tt,heatmapValueFormat:ot,marginalGraphics:rt,pointIdAccessor:it,xScaleType:st,yScaleType:at,accessibleTable:lt=!0,description:ut,summary:ht,linkedCrosshairName:dt,linkedCrosshairSourceId:ft,customLayout:pt,onLayoutError:yt,layoutConfig:gt,layoutSelection:mt}=e,xt=(0,j.useId)().replace(/:/g,""),bt=(0,j.useRef)(!1),vt=(0,j.useRef)({w:-1,h:-1}),kt=(0,j.useRef)(!1),wt=Ei({sizeProp:N,responsiveWidth:F,responsiveHeight:T,userMargin:B,marginDefault:Is,animate:Ke,transitionProp:Ue,themeDirtyRef:bt}),At=function(){const[e,t]=(0,Rr.useState)(!1);return Ir(()=>{t(!0)},[]),e}(),St=function(){const e=(0,Rr.useSyncExternalStore)(Nr,Fr,Tr);return(0,Rr.useRef)(e).current}(),{reducedMotionRef:Ct,responsiveRef:Mt,size:_t,currentTheme:jt,transition:Pt,introEnabled:Lt,tableId:Rt,rafRef:Nt,renderFnRef:Ft,scheduleRender:Tt,cancelRender:Ot}=wt;let Wt=wt.margin;if(rt){const e=60,t={...wt.margin};rt.top&&e>t.top&&(t.top=e),rt.bottom&&e>t.bottom&&(t.bottom=e),rt.left&&e>t.left&&(t.left=e),rt.right&&e>t.right&&(t.right=e),Wt=t}const zt=_t[0]-Wt.left-Wt.right,Ht=_t[1]-Wt.top-Wt.bottom,Et=(0,j.useMemo)(()=>W(r),[r]),$t=be??Ae,Yt=(0,j.useRef)(null),Xt=(0,j.useRef)(null),[Vt,Ut]=(0,j.useState)(0),Kt=(0,j.useRef)(0),[Qt,Zt]=(0,j.useState)(null),en=(e,t)=>"function"==typeof e?e({size:_t,margin:Wt,scales:t}):e,nn=en(ze,Qt),on=en(We,Qt),an=(0,j.useRef)(null),ln=(0,j.useRef)(null),cn=(0,j.useRef)(void 0),[hn,dn]=(0,j.useState)(null),fn=(0,j.useRef)(Ns.primary),yn=(0,j.useRef)(function(){let e=-1,t=zr;return{resolve(n){if(!n)return zr;const o=un;return o===e||(t=function(e){if(!e)return zr;const t=getComputedStyle(e),n=t.getPropertyValue("--semiotic-border").trim(),o=t.getPropertyValue("--semiotic-text-secondary").trim(),r=t.getPropertyValue("--semiotic-bg").trim(),i=t.getPropertyValue("--semiotic-primary").trim(),s=o||t.getPropertyValue("--text-secondary").trim(),a=t.getPropertyValue("--text-primary").trim(),l=n||t.getPropertyValue("--surface-3").trim(),c=r||t.getPropertyValue("--surface-0").trim();return s||a||n||i?{axisStroke:l||zr.axisStroke,tickText:s||zr.tickText,crosshair:s?Hr(s,"66"):zr.crosshair,hoverFill:c?Hr(c,"4D"):zr.hoverFill,hoverStroke:s?Hr(s,"99"):zr.hoverStroke,pointRing:c||zr.pointRing,primary:i||zr.primary,background:c||zr.background}:zr}(n),e=o),t},invalidate(){e=-1}}}()),gn=(0,j.useRef)(!1),mn=(0,j.useRef)(new Bt),xn=(0,j.useRef)([]),bn=(0,j.useRef)(Oe),vn=(0,j.useRef)(De);bn.current=Oe,vn.current=De;const[kn,Cn]=(0,j.useState)(!1),[Mn,_n]=(0,j.useState)([]),[jn,Pn]=(0,j.useState)([]),Ln="streaming"===o||["bar","swarm","waterfall"].includes(n),Rn=function(e){const t=(0,Br.useRef)(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return Dr(e,t);if(!Wr(e)||!Wr(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(!Dr(n,r))return!1}else{if(!Wr(n)||!Wr(r))return!1;if(!Or(n,r))return!1}}return!0}(t.current,e)||(t.current=e),t.current}((0,j.useMemo)(()=>({chartType:n,runtimeMode:Ln?"streaming":"bounded",windowSize:S,windowMode:A,arrowOfTime:Ln?w:"right",extentPadding:L,scalePadding:R,axisExtent:ge,xAccessor:a,yAccessor:l,accessorRevision:c,timeAccessor:Ln?C:void 0,valueAccessor:k,colorAccessor:u,sizeAccessor:h,symbolAccessor:d,symbolMap:f,groupAccessor:p||(y?"_lineGroup":void 0),categoryAccessor:Ye,lineDataAccessor:y,xScaleType:st,yScaleType:at,xExtent:M,yExtent:P,sizeRange:I,binSize:v,normalize:m,baseline:x,stackOrder:b,boundsAccessor:Q,boundsStyle:Z,y0Accessor:J,band:ee,gradientFill:!0===te?{topOpacity:.8,bottomOpacity:.05}:!1===te?void 0:te,areaGroups:oe?new Set(oe):void 0,lineGradient:ne,openAccessor:re,highAccessor:ie,lowAccessor:se,closeAccessor:ae,candlestickStyle:le,lineStyle:E,pointStyle:$,areaStyle:Y,swarmStyle:V,waterfallStyle:X,colorScheme:K,barColors:U,barStyle:q,annotations:Me,decay:Xe,pulse:Ve,transition:Pt,introAnimation:Lt,staleness:Qe,heatmapAggregation:Ze,heatmapXBins:Je,heatmapYBins:et,showValues:tt,heatmapValueFormat:ot,pointIdAccessor:it,curve:g,themeCategorical:jt?.colors?.categorical,themeSemantic:G(jt),themeSequential:jt?.colors?.sequential,themeDiverging:jt?.colors?.diverging,customLayout:pt,onLayoutError:yt,layoutConfig:gt,layoutMargin:Wt}),[n,S,A,w,L,R,ge,a,l,c,C,k,st,at,u,h,d,f,p,Ye,y,M,P,I,v,m,x,b,Q,Z,J,ee,te,ne,oe,re,ie,se,ae,le,E,$,Y,V,X,q,K,U,Me,Xe,Ve,Pt?.duration,Pt?.easing,Lt,Qe,Ze,Je,et,tt,ot,Ln,it,g,jt,pt,yt,gt,Wt])),In=(0,j.useRef)(null);In.current||(In.current=new It(Rn));const Nn=function(e,t,n,o){return(0,Yi.useCallback)(()=>{const r=t.current,i=n.current;if(!i||!r)return;const s=function(e,t){if(!t)return[];const n=new Set,o=[];for(const r of e){if(!r||"object"!=typeof r)continue;const e="function"==typeof t?t(r):r[t];if(null==e)continue;const i=e+"";n.has(i)||(n.add(i),o.push(i))}return o}(e.current?.getData()??[],r);(function(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0})(s,o.current)||(o.current=s,i(s))},[t,n,o,e])}(In,bn,vn,xn);!function(e,t,n,o){(0,qt.useEffect)(()=>{e.current?.updateConfig(t),n.current=!0,o()},[t,o,e,n])}(In,Rn,bt,Tt),function(e,t,n,o){const r=(0,qt.useRef)(null);(0,qt.useEffect)(()=>{const i=e.current;if(!i)return;const s=t??null;r.current!==s&&(r.current=s,i.setLayoutSelection(s),i.hasCustomRestyle?i.restyleScene(s):n.current=!0,o())},[t,o,e,n])}(In,mt,bt,Tt);const Dn=(0,j.useRef)(null);Dn.current||(Dn.current=new z(e=>{const t=In.current;t&&t.ingest(e)&&(bt.current=!0,Tt())},{chunkThreshold:i,chunkSize:s})),(0,j.useEffect)(()=>{Dn.current?.updateChunkOptions({chunkThreshold:i,chunkSize:s})},[i,s]);const Wn=(0,j.useCallback)(e=>{Dn.current?.push(e)},[]),Hn=(0,j.useCallback)(e=>{Dn.current?.pushMany(e)},[]),$n=(0,j.useCallback)(()=>{Dn.current?.clear(),In.current?.clear(),bt.current=!0,Tt()},[Tt]);(0,j.useImperativeHandle)(t,()=>({push:Wn,pushMany:Hn,remove:e=>{Dn.current?.flush();const t=In.current?.remove(e)??[];return t.length>0&&(an.current&&t.some(e=>e===an.current?.data)&&(an.current=null,dn(null)),bt.current=!0,Tt()),t},update:(e,t)=>{Dn.current?.flush();const n=In.current?.update(e,t)??[];return n.length>0&&(bt.current=!0,Tt()),n},clear:$n,getData:()=>(Dn.current?.flush(),In.current?.getData()??[]),getScales:()=>In.current?.scales??null,getExtents:()=>In.current?.getExtents()??null,getCustomLayout:()=>In.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>In.current?.lastCustomLayoutFailure??null}),[Wn,Hn,$n,Tt]),(0,j.useEffect)(()=>{if(r){if(y&&Et.length>0&&"object"==typeof Et[0]&&null!==Et[0]){const e="string"==typeof y?y:"coordinates";if(Array.isArray(Et[0][e])){const t=[];for(const n of Et){const o=n[e];if(Array.isArray(o)){const e=n.label||n.id||n.key;if(null!=e)for(const n of o)t.push({...n,_lineGroup:e});else for(const e of o)t.push(e)}}return void Dn.current?.setBoundedData(t)}}Dn.current?.setBoundedData(Et)}},[r,Et,y]);const{hoverHandlerRef:Yn,hoverLeaveRef:Gn,onPointerMove:qn,onPointerLeave:Xn}=wt;Yn.current=e=>{if(!$t)return;const t=Yt.current;if(!t)return;const o=t.getBoundingClientRect(),r=e.clientX-o.left-Wt.left,i=e.clientY-o.top-Wt.top;if(0>r||r>zt||0>i||i>Ht)return void(an.current&&(an.current=null,ln.current=null,dn(null),ke&&(ke(null),bt.current=!0),Tt()));const s=In.current;if(!s||0===s.scene.length)return;const l=mi(Se,e.pointerType),c=An(s.scene,r,i,l,s.quadtree,s.maxPointRadius),u="multi"===Ce,h=()=>{an.current&&(an.current=null,ln.current=null,dn(null),ke&&ke(null),Tt())};if(!c&&!u)return void h();const d=u||!c?r:c.x,f=u||!c?i:c.y,p=c?.datum?nt(c.datum,s.resolvedRibbons):{},y=s.scales?.x?.invert,g="function"==typeof y?y(d):void 0;let m=bi(p,d,f,null!=g?{xValue:g,xPx:d}:void 0);if(u&&s.scene.length>0&&s.scales){const e=function(e,t,n=30){const o=[];for(const r of e)if("line"===r.type){const e=r;if(2>e.path.length)continue;const i=Sn(wn(e.path,e.curve),t,n);if(null===i)continue;const s=Fn(e.path,t);o.push({node:r,datum:Array.isArray(e.datum)&&e.datum[s]?e.datum[s]:e.datum,x:e.path[s][0],y:i,group:e.group,color:e.style.stroke})}else if("area"===r.type){const e=r;if(!1===e.interactive)continue;if(2>e.topPath.length)continue;const i=wn(e.topPath,e.curve),s=wn(e.bottomPath,e.curve),a=Sn(i,t,n);if(null===a)continue;const l=Sn(s,t,n),c=Fn(e.topPath,t);o.push({node:r,datum:Array.isArray(e.datum)&&e.datum[c]?e.datum[c]:e.datum,x:e.topPath[c][0],y:a,y0:l??void 0,group:e.group,color:"string"==typeof e.style.stroke?e.style.stroke:"string"==typeof e.style.fill?e.style.fill:void 0})}return o}(s.scene,d,Math.max(l,zt));if(e.length>0){const t=s.scales.y.invert,o=fn.current,r=y?y(d):d;if(c)m.xValue=r,m.xPx=d;else{const e={xValue:r};"string"==typeof a&&(e[a]=r),m=bi(e,d,f,{xValue:r,xPx:d})}m.allSeries=e.map(e=>{const r=t?t(e.y):e.y,i=null!=e.y0?t?t(e.y0):e.y0:void 0;return{group:e.group||"",value:"stackedarea"===n&&null!=i?r-i:r,valuePx:e.y,color:e.color||o,datum:nt(e.datum,s.resolvedRibbons)}})}}c||m.allSeries?.length?(an.current=m,ln.current=c?.node??null,dn(m),ke&&(ke(m),bt.current=!0),Tt()):h()},Gn.current=()=>{an.current&&(an.current=null,ln.current=null,dn(null),ke&&(ke(null),bt.current=!0),Tt())};const Vn=(0,j.useRef)(()=>{});Vn.current=e=>{if(!we)return;const t=Yt.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-Wt.left,r=e.clientY-n.top-Wt.top;if(0>o||o>zt||0>r||r>Ht)return void we(null);const i=In.current;if(!i||0===i.scene.length)return void we(null);const s=mi(Se,cn.current),a=An(i.scene,o,r,s,i.quadtree,i.maxPointRadius);if(!a)return void we(null);const l=a.datum||{},c=i.scales?.x?.invert,u="function"==typeof c?c(a.x):void 0;we(bi(l,a.x,a.y,null!=u?{xValue:u,xPx:a.x}:void 0))};const Un=(0,j.useCallback)(e=>Vn.current(e),[]),Kn=(0,j.useRef)(-1),Qn=(0,j.useRef)(null),Zn=(0,j.useRef)(null),Jn=(0,j.useCallback)(e=>{const t=In.current;if(!t||0===t.scene.length)return;const n=t.version;let o;if(Zn.current&&Zn.current.version===n)o=Zn.current.graph;else{const e=function(e){const t=[];for(const n of e)switch(n.type){case"point":t.push({x:n.x,y:n.y,datum:n.datum,shape:"circle",group:"_default"});break;case"symbol":if(0>=n.size)break;t.push({x:n.x,y:n.y,datum:n.datum,shape:"circle",group:"_default"});break;case"glyph":{if(0>=n.size||null==n.datum)break;const e=sn(n.glyph,n.size);t.push({x:n.x+e.centerDx,y:n.y+e.centerDy,datum:n.datum,shape:"rect",w:2*e.halfWidth,h:2*e.halfHeight,group:"_default"});break}case"line":{const e=n,o=Array.isArray(e.datum)?e.datum:[],r=e.group??"_default";for(let n=0;e.path.length>n&&o.length>n;n++)t.push({x:e.path[n][0],y:e.path[n][1],datum:o[n],shape:"circle",group:r});break}case"area":{const e=n,o=Array.isArray(e.datum)?e.datum:[],r=e.group??"_default";for(let n=0;e.topPath.length>n&&o.length>n;n++)t.push({x:e.topPath[n][0],y:e.topPath[n][1],datum:o[n],shape:"circle",group:r});break}case"rect":t.push({x:n.x+n.w/2,y:n.y+n.h/2,datum:n.datum,shape:"rect",w:n.w,h:n.h,group:n.group??"_default"});break;case"heatcell":t.push({x:n.x+n.w/2,y:n.y+n.h/2,datum:n.datum,shape:"rect",w:n.w,h:n.h,group:"_default"})}return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}(t.scene);if(0===e.length)return;o=function(e){const t=new Map;for(const n of e){const e=n.group??"_default";let o=t.get(e);o||(o=[],t.set(e,o)),o.push(n)}for(const e of t.values()){e.sort((e,t)=>e.x-t.x||e.y-t.y);for(let t=0;e.length>t;t++)e[t]._groupIndex=t}const n=Array.from(t.keys()).sort((e,n)=>{const o=t.get(e),r=t.get(n);return(o.length>0?o[0].y:0)-(r.length>0?r[0].y:0)}),o=Array.from(t.values()).flat();o.sort((e,t)=>e.x-t.x||e.y-t.y);const r=new Map;for(let e=0;o.length>e;e++){o[e]._flatIndex=e;const t=o[e].datum?.id;null!=t&&r.set(t+"",e)}return{flat:o,groups:n,byGroup:t,idToIdx:r}}(e),Zn.current={version:n,graph:o}}const r=Kn.current;if(0>r){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),Kn.current=0;const n=o.flat[0];Qn.current={shape:n.shape,w:n.w,h:n.h};const r=Bn({...n,datum:nt(n.datum,t.resolvedRibbons)});return an.current=r,dn(r),ke&&ke(r),void Tt()}const i=function(e,t){if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const n=Math.max(0,Math.min(t,e.flat.length-1)),o=e.flat[n];return{flatIndex:n,group:o.group??"_default",indexInGroup:o._groupIndex??0}}(o,r),s=function(e,t,n){const{group:o,indexInGroup:r}=t,i=n.byGroup.get(o);switch(e){case"ArrowRight":return i.length-1>r?i[r+1]._flatIndex:t.flatIndex;case"ArrowLeft":return r>0?i[r-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=n.groups.indexOf(o);return n.groups.length-1>e?Tn(n,n.groups[e+1],i[r]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?Tn(n,n.groups[e-1],i[r]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*n.flat.length)),n.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*n.flat.length)),0);case"Home":return 0;case"End":return n.flat.length-1;case"Escape":return-1;default:return null}}(e.key,i,o);if(null===s)return;if(e.preventDefault(),0>s)return Kn.current=-1,Qn.current=null,an.current=null,ln.current=null,dn(null),ke&&ke(null),void Tt();Kn.current=s;const a=o.flat[s];Qn.current={shape:a.shape,w:a.w,h:a.h};const l=Bn({...a,datum:nt(a.datum,t.resolvedRibbons)});an.current=l,dn(l),ke&&ke(l),Tt()},[ke,Tt]),eo=(0,j.useCallback)(e=>{cn.current=e.pointerType,Kn.current=-1,Qn.current=null,qn(e)},[qn]),to=(0,j.useCallback)(e=>{cn.current="mouse",Kn.current=-1,Qn.current=null,qn({clientX:e.clientX,clientY:e.clientY,pointerType:"mouse"})},[qn]),no=(0,j.useCallback)(e=>{cn.current=e.pointerType},[]);Ft.current=()=>{Nt.current=null;const e=Yt.current,t=Xt.current;if(!e||!t)return;const o=In.current;if(!o)return;const r="undefined"!=typeof performance?performance.now():Date.now(),i=o.advanceTransition(Ct.current?r+1e6:r),s=!Ct.current&&i,c=vt.current.w!==zt||vt.current.h!==Ht,u=bt.current||i||c,h=o.consumeStylePaintPending();let d=!1;const f=o.getLastUpdateResult(),p=mn.current.beforeCompute(f,s);!u||s&&!c||(o.computeScene({width:zt,height:Ht}),vt.current={w:zt,h:Ht},d=!0,Nn()),mn.current.afterCompute(p,d,c);const y=function(e,t,n,o){const r=o.current,i=!0===e.lastCustomLayoutFailure?.preservedLastGoodScene,s=!i&&e.hasActivePulsesAt(t),a=!(n||i||!s&&!r)&&e.refreshPulse(t);return o.current=s,{changed:a,pending:s}}(o,r,d,kt),g=function(){if("undefined"==typeof window)return 1;const e=window.devicePixelRatio||1,t=function(){if("undefined"==typeof window)return!1;const e="function"==typeof window.matchMedia&&window.matchMedia("(pointer: coarse)").matches,t=768>Math.min(window.innerWidth||1/0,window.innerHeight||1/0);return e||t}()?2:3;return Math.max(1,Math.min(e,t))}(),m=yn.current.resolve(e);fn.current=m.primary;const x=zn(Qe,o.lastIngestTime>0?r-o.lastIngestTime:0),b=Qe&&x.isStale;if(u||h||y.changed){const t=$i(e,_t,Wt,g);if(t){if(t.clearRect(-Wt.left,-Wt.top,_t[0],_t[1]),Qe&&1>x.alpha&&(t.globalAlpha=x.alpha),function(e,t){const{background:n,hasBackgroundGraphics:o=!1,themeBackground:r="",x:i=0,y:s=0,width:a,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=pn(e,c);u&&(e.fillStyle=u,e.fillRect(i,s,a,l))}(t,{background:H,hasBackgroundGraphics:!!We,themeBackground:m.background,x:-Wt.left,y:-Wt.top,width:_t[0],height:_t[1]}),t.save(),"function"==typeof t.rect&&(t.beginPath(),t.rect(0,0,zt,Ht),t.clip()),He&&o.scales)for(const e of He)t.save(),e(t,o.scene,o.scales,{width:zt,height:Ht}),t.restore();const e=pt?vs.custom:vs[n];if(e&&o.scales)for(const n of e)n(t,o.scene,o.scales,{width:zt,height:Ht});t.restore(),Qe&&1>x.alpha&&(t.globalAlpha=1)}}const v=!!($t&&an.current&&o.scales),k=!!(ln.current&&Array.isArray(be)&&be.some(e=>e&&"object"==typeof e&&"highlight"===e.type)),w=v||k;if(w||gn.current){const e=$i(t,_t,Wt,g);if(e&&(e.clearRect(-Wt.left,-Wt.top,_t[0],_t[1]),v&&an.current&&function(e,t,n,o,r,i,s){if(!1===r.crosshair)return;const a=t.allSeries,l=a&&a.length>0,c=t.xPx??t.x;e.save();const u="object"==typeof r.crosshair?r.crosshair:{};if(e.strokeStyle=u.stroke||s.crosshair,e.lineWidth=u.strokeWidth||1,e.setLineDash(u.strokeDasharray?u.strokeDasharray.split(/[\s,]+/).map(Number):[4,4]),e.beginPath(),e.moveTo(l?c:t.x,0),e.lineTo(l?c:t.x,o),e.stroke(),l||(e.beginPath(),e.moveTo(0,t.y),e.lineTo(n,t.y),e.stroke()),e.restore(),l){e.lineWidth=2,e.strokeStyle=s.pointRing;for(const t of a)null!=t.valuePx&&(e.beginPath(),e.arc(c,t.valuePx,4,0,2*Math.PI),e.fillStyle=t.color||s.primary,e.fill(),e.stroke())}else{const n=r.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}(i)||s.primary;e.beginPath(),e.arc(t.x,t.y,4,0,2*Math.PI),e.fillStyle=n,e.fill(),e.strokeStyle=s.pointRing,e.lineWidth=2,e.stroke()}}(e,an.current,zt,Ht,"object"==typeof $t?$t:{},ln.current,m),k&&ln.current&&Array.isArray(be))){const t=be.find(e=>e&&"object"==typeof e&&"highlight"===e.type);t&&function(e,t,n,o,r){if(!n)return;const i="group"in n?n.group:void 0;if(void 0!==i)for(const n of t){if("line"!==n.type)continue;if(n.group!==i)continue;if(2>n.path.length)continue;const t="function"==typeof o.style?n.datum?o.style(n.datum):{}:o.style||{};e.save(),e.beginPath(),e.moveTo(n.path[0][0],n.path[0][1]);for(let t=1;n.path.length>t;t++)e.lineTo(n.path[t][0],n.path[t][1]);e.strokeStyle=t.stroke||n.style.stroke||r.primary,e.lineWidth=t.strokeWidth||(n.style.strokeWidth||2)+2,e.globalAlpha=t.opacity??1,e.stroke(),e.restore()}}(e,o.scene,ln.current,t,m)}gn.current=w}u&&e&&e.setAttribute("aria-label",Kr(o.scene,n+" chart"));const A=bt.current;if(bt.current=A&&s&&!d,A&&o.scales){const e=e=>"object"==typeof e&&null!==e&&"function"==typeof e.valueOf?e.valueOf():e;if((!Qt||e(Qt.x.domain()[0])!==e(o.scales.x.domain()[0])||e(Qt.x.domain()[1])!==e(o.scales.x.domain()[1])||e(Qt.y.domain()[0])!==e(o.scales.y.domain()[0])||e(Qt.y.domain()[1])!==e(o.scales.y.domain()[1])||Qt.x.range()[0]!==o.scales.x.range()[0]||Qt.x.range()[1]!==o.scales.x.range()[1]||Qt.y.range()[0]!==o.scales.y.range()[0]||Qt.y.range()[1]!==o.scales.y.range()[1])&&Zt(o.scales),rt){const e=o.getData(),t="function"==typeof a?a:e=>e[a||"x"],n="function"==typeof l?l:e=>e[l||"y"];_n(e.map(e=>t(e)).filter(e=>"number"==typeof e&&isFinite(e))),Pn(e.map(e=>n(e)).filter(e=>"number"==typeof e&&isFinite(e)))}}!((Me&&Me.length>0||pt)&&(d||s))||!d&&33>r-Kt.current||(Ut(e=>e+1),Kt.current=r),Qe?.showBadge&&Cn(!!b),(s||null!=o.activeTransition||y.pending)&&Tt()},function(e){const{hydrated:t,wasHydratingFromSSR:n,storeRef:o,dirtyRef:r,renderFnRef:i,cancelRender:s,cleanup:a}=e;Ir(()=>{t&&n&&o.current?.cancelIntroAnimation?.(),r.current=!0,s?.(),i.current()},[t,n]);const l=(0,Rr.useRef)(a);l.current=a,(0,Rr.useEffect)(()=>()=>l.current?.(),[])}({hydrated:At,wasHydratingFromSSR:St,storeRef:In,dirtyRef:bt,renderFnRef:Ft,cancelRender:Ot,cleanup:()=>Dn.current?.clear()}),(0,j.useEffect)(()=>{bt.current=!0,Tt()},[n,zt,Ht,ce,H,We,E,He,Tt]),function(e,t,n,o,r,i){const s=(0,On.useRef)("fresh");(0,On.useEffect)(()=>{if(!e)return;const a=setInterval(()=>{const a=t.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=zn(e,l-a.lastIngestTime);c.band===s.current&&c.isStale===r||(s.current=c.band,c.isStale!==r&&i(c.isStale),n.current=!0,o())},1e3);return()=>clearInterval(a)},[e,r,o])}(Qe,In,bt,Tt,kn,Cn);const oo=(0,j.useMemo)(()=>{if(pe||me)return;const e=In.current;return e?.xIsDate&&Qt?Vi(Qt.x.domain()):void 0},[pe,me,Qt]),ro=pe||me||oo,io=$t&&hn?ve?ve(hn):(0,Rs.jsx)(Ls,{hover:hn}):null,so=io?(0,Rs.jsx)(Ni,{x:hn.x,y:hn.y,containerWidth:zt,containerHeight:Ht,margin:Wt,className:"stream-frame-tooltip",children:io}):null,ao=Qn.current,lo=(0,Rs.jsx)(yi,{active:Kn.current>=0,hoverPoint:hn,margin:Wt,size:_t,shape:ao?.shape,width:ao?.w,height:ao?.h}),co=Gi(a,C,"__semiotic_resolvedX","__semiotic_resolvedTime"),uo=Gi(l,k,"__semiotic_resolvedY","__semiotic_resolvedValue"),ho=co.key,fo=uo.key,po=function(e,t,n){return o=>{if(!o||!n||!e.fn&&!t.fn)return o;let r=!1;const i=o.map(n=>{const o=e.fn&&e.key&&!(e.key in n),i=t.fn&&t.key&&!(t.key in n);if(!o&&!i)return n;r=!0;const s={...n};return o&&(s[e.key]=e.fn(n)),i&&(s[t.key]=t.fn(n)),s});return r?i:o}}(co,uo,Me&&Me.length>0||!1);if(Lr||!At&&St){const e=In.current;e&&r&&(e.ingest({inserts:Et,bounded:!0}),e.computeScene({width:zt,height:Ht}));const t=e?.scene??[],n=e?.scales??null,o=en(ze,n),i=en(We,n),s=ro||(()=>{if(e?.xIsDate&&n)return Vi(n.x.domain())})();return(0,Rs.jsxs)("div",{ref:Mt,className:"stream-xy-frame"+(D?" "+D:""),role:"img","aria-label":ut||("string"==typeof $e?$e:"XY chart"),style:{position:"relative",width:F?"100%":_t[0],height:T?"100%":_t[1]},children:[(0,Rs.jsx)(ui,{summary:ht}),(0,Rs.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:_t[0],height:_t[1],style:{position:"absolute",left:0,top:0},children:[(0,Rs.jsx)("g",{transform:`translate(${Wt.left},${Wt.top})`,children:i}),(0,Rs.jsxs)("g",{transform:`translate(${Wt.left},${Wt.top})`,children:[H&&(0,Rs.jsx)("rect",{x:0,y:0,width:zt,height:Ht,fill:H}),Ee&&n&&Ee.map((e,o)=>(0,Rs.jsx)(_.Fragment,{children:e(t,n,{width:zt,height:Ht})},"svgpre-"+o)),t.map((e,t)=>function(e,t,n){switch(e.type){case"line":{const n=e;if(0===n.path.length)return null;const o="M"+n.path.map(([e,t])=>`${e},${t}`).join("L");return(0,jr.jsx)("path",{d:o,fill:"none",stroke:n.style.stroke||"#4e79a7",strokeWidth:n.style.strokeWidth||2,strokeDasharray:n.style.strokeDasharray,opacity:n.style.opacity},"line-"+t)}case"area":{const o=e;if(0===o.topPath.length)return null;const r=`M${o.topPath.map(([e,t])=>`${e},${t}`).join("L")}L${[...o.bottomPath].reverse().map(([e,t])=>`${e},${t}`).join("L")}Z`;if(o.clipRect){const e=`${n?n+"-":""}area-clip-${t}`;return(0,jr.jsxs)("g",{children:[(0,jr.jsx)("defs",{children:(0,jr.jsx)("clipPath",{id:e,children:(0,jr.jsx)("rect",{x:o.clipRect.x,y:o.clipRect.y,width:o.clipRect.width,height:o.clipRect.height})})}),(0,jr.jsx)("path",{d:r,fill:Pr(o.style.fill),fillOpacity:o.style.fillOpacity??o.style.opacity??.7,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,clipPath:`url(#${e})`})]},"area-"+t)}return(0,jr.jsx)("path",{d:r,fill:Pr(o.style.fill),fillOpacity:o.style.fillOpacity??o.style.opacity??.7,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth},"area-"+t)}case"point":{const n=e;return(0,jr.jsx)("circle",{cx:n.x,cy:n.y,r:n.r,fill:Pr(n.style.fill),opacity:n.style.opacity??.8,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth},"point-"+t)}case"symbol":return function(e,t){const n=ct(e.symbolType,e.size,e.path);return(0,jr.jsx)("path",{d:n,transform:e.rotation?`translate(${e.x},${e.y}) rotate(${180*e.rotation/Math.PI})`:`translate(${e.x},${e.y})`,fill:e.style.fill?Pr(e.style.fill):"none",opacity:e.style.opacity,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth},"symbol-"+t)}(e,t);case"glyph":return function(e,t,n,o){const r=e.glyph;if(!r?.parts?.length||0>=e.size)return null;const i=Jt(r,e.size);if(0>=i.scale)return null;const s=`translate(${t},${n})${e.rotation?` rotate(${180*e.rotation/Math.PI})`:""} translate(${i.offsetX},${i.offsetY}) scale(${i.scale})`,a=e.color??("string"==typeof e.style.fill?e.style.fill:void 0),l=rn(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:tn(n.fill,a,e.accent),i=t?n.stroke&&"none"!==n.stroke?t:void 0:tn(n.stroke??"none",a,e.accent);return r||i?(0,jr.jsx)("path",{d:n.d,fill:r??"none",stroke:i,strokeWidth:i?n.strokeWidth??1:void 0,strokeLinecap:n.strokeLinecap,strokeLinejoin:n.strokeLinejoin,opacity:n.opacity},o):null});return(0,jr.jsxs)("g",{transform:s,opacity:1===u?void 0:u,children:[l&&c&&(0,jr.jsx)("clipPath",{id:c,children:(0,jr.jsx)("rect",{x:l.x,y:l.y,width:l.width,height:l.height})}),l&&e.ghostColor?(0,jr.jsx)("g",{children:h(e.ghostColor)}):null,l&&c?(0,jr.jsx)("g",{clipPath:`url(#${c})`,children:h()}):h()]},o)}(e,e.x,e.y,`${n??""}glyph-${e.pointId??t}`);case"rect":{const n=e;return(0,jr.jsx)("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:Pr(n.style.fill),opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth},"rect-"+t)}case"heatcell":{const n=e;if(n.showValues&&null!=n.value&&n.w>=20&&n.h>=20){const e=n.valueFormat?n.valueFormat(n.value):Number.isInteger(n.value)?n.value+"":100>Math.abs(n.value)?1>Math.abs(n.value)?n.value.toPrecision(3):n.value.toFixed(1):n.value.toFixed(0),[o,r,i]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(n.fill),s=.299*o+.587*r+.114*i>128?"#000":"#fff",a=Math.max(10,Math.min(16,.3*Math.min(n.w,n.h)));return(0,jr.jsxs)("g",{children:[(0,jr.jsx)("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:n.fill}),(0,jr.jsx)("text",{x:n.x+n.w/2,y:n.y+n.h/2,textAnchor:"middle",dominantBaseline:"middle",fill:s,fontSize:a+"px",children:e})]},"heatcell-"+t)}return(0,jr.jsx)("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:n.fill},"heatcell-"+t)}case"candlestick":{const n=e,o=Math.min(n.openY,n.closeY),r=Math.max(Math.abs(n.openY-n.closeY),1),i=n.isUp?n.upColor:n.downColor;return(0,jr.jsxs)("g",{children:[(0,jr.jsx)("line",{x1:n.x,y1:n.highY,x2:n.x,y2:n.lowY,stroke:n.wickColor,strokeWidth:n.wickWidth}),(0,jr.jsx)("rect",{x:n.x-n.bodyWidth/2,y:o,width:n.bodyWidth,height:r,fill:i,stroke:i,strokeWidth:1})]},"candle-"+t)}default:return null}}(e,t,xt)).filter(Boolean)]})]}),(0,Rs.jsx)(Mr,{width:zt,height:Ht,totalWidth:_t[0],totalHeight:_t[1],margin:Wt,scales:n,showAxes:ce,axes:ue,xLabel:he,yLabel:de,yLabelRight:fe,xFormat:s,yFormat:ye||xe,axisExtent:ge,showGrid:Pe,title:$e,legend:Le,legendHoverBehavior:Re,legendClickBehavior:Ie,legendHighlightedCategory:Ne,legendIsolatedCategories:Fe,legendPosition:Te,legendLayout:Be,foregroundGraphics:Dt(o,Gt(In.current?.customLayoutOverlays,mt??null)),marginalGraphics:rt,xValues:[],yValues:[],annotations:Me,autoPlaceAnnotations:_e,svgAnnotationRules:je,annotationFrame:0,xAccessor:ho,yAccessor:fo,annotationData:po(e?.getData()),pointNodes:Ui(e?.scene),curve:"string"==typeof g?g:void 0,linkedCrosshairName:dt,linkedCrosshairSourceId:ft})]})}return(0,Rs.jsxs)("div",{ref:Mt,className:"stream-xy-frame"+(D?" "+D:""),role:"group","aria-label":ut||("string"==typeof $e?$e:"XY chart"),tabIndex:0,style:{position:"relative",width:F?"100%":_t[0],height:T?"100%":_t[1],overflow:"visible",touchAction:Fs(Ge)},onKeyDown:Jn,children:[lt&&(0,Rs.jsx)(hi,{tableId:Rt}),lt&&(0,Rs.jsx)(ci,{scene:In.current?.scene??[],chartType:n+" chart",tableId:Rt,chartTitle:"string"==typeof $e?$e:void 0}),(0,Rs.jsx)(ui,{summary:ht}),(0,Rs.jsx)(di,{hoverPoint:hn}),(0,Rs.jsxs)("div",{role:"img","aria-label":ut||("string"==typeof $e?$e:"XY chart"),style:{position:"relative",width:"100%",height:"100%"},onPointerMove:$t?eo:void 0,onMouseMove:$t?to:void 0,onPointerLeave:$t?Xn:void 0,onMouseLeave:$t?Xn:void 0,onPointerDown:$t||we?no:void 0,onClick:we?Un:void 0,children:[on&&(0,Rs.jsx)("svg",{style:{position:"absolute",left:0,top:0,width:_t[0],height:_t[1],pointerEvents:"none"},children:(0,Rs.jsx)("g",{transform:`translate(${Wt.left},${Wt.top})`,children:on})}),(0,Rs.jsx)(Ar,{width:zt,height:Ht,totalWidth:_t[0],totalHeight:_t[1],margin:Wt,scales:Qt,showAxes:ce,axes:ue,showGrid:Pe,xFormat:ro,yFormat:ye||xe,axisExtent:ge}),(0,Rs.jsx)("canvas",{ref:Yt,"aria-label":Kr(In.current?.scene??[],n+" chart"),style:{position:"absolute",left:0,top:0}}),(0,Rs.jsx)("canvas",{ref:Xt,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),(0,Rs.jsx)(Mr,{width:zt,height:Ht,totalWidth:_t[0],totalHeight:_t[1],margin:Wt,scales:Qt,showAxes:ce,axes:ue,xLabel:he,yLabel:de,yLabelRight:fe,xFormat:ro,yFormat:ye||xe,axisExtent:ge,showGrid:Pe,title:$e,legend:Le,legendHoverBehavior:Re,legendClickBehavior:Ie,legendHighlightedCategory:Ne,legendIsolatedCategories:Fe,legendPosition:Te,legendLayout:Be,foregroundGraphics:Dt(nn,Gt(In.current?.customLayoutOverlays,mt??null)),marginalGraphics:rt,xValues:Mn,yValues:jn,annotations:Me,autoPlaceAnnotations:_e,svgAnnotationRules:je,annotationFrame:Vt,xAccessor:ho,yAccessor:fo,annotationData:po(In.current?.getData()),pointNodes:Ui(In.current?.scene),curve:"string"==typeof g?g:void 0,underlayRendered:!0,canvasObscuresUnderlay:"transparent"!==H&&!We,linkedCrosshairName:dt,linkedCrosshairSourceId:ft}),(Ge||qe)&&(0,Rs.jsx)(O,{width:zt,height:Ht,totalWidth:_t[0],totalHeight:_t[1],margin:Wt,dimension:Ge?.dimension??"xy",scales:Qt,onBrush:qe??(()=>{}),binSize:v,snap:Ge?.snap,binBoundaries:Ge?.binBoundaries??("bar"===n?In.current?.getBinBoundaries():void 0),snapDuring:Ge?.snapDuring,streaming:"streaming"===o}),Qe?.showBadge&&(0,Rs.jsx)(En,{isStale:kn,position:Qe.badgePosition}),lo,so]})]})}));Ts.displayName="StreamXYFrame";var Bs=Ts,Os=require("react"),Ds=require("react"),Ws=require("react"),zs=require("react/jsx-runtime"),Hs=(0,Ws.createContext)(null);function Es({colors:e,categories:t,colorScheme:n="category10",children:o}){const r=(0,Ws.useMemo)(()=>{if(e)return e;if(t){if(n&&"object"==typeof n&&!Array.isArray(n)){const e=n,o={};let r=0;for(const n of t)o[n]=Fe(e,n)??Le[r++%Le.length];return o}const e=Array.isArray(n)?n:Pe[n]||Le,o={};for(let n=0;t.length>n;n++)o[t[n]]=e[n%e.length];return o}return{}},[e,t,n]);return(0,zs.jsx)(Hs.Provider,{value:r,children:o})}function $s(){return(0,Ws.useContext)(Hs)}Es.displayName="CategoryColorProvider";var Ys=require("react");function Gs(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 qs(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}function Xs(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[Vs,Us]=$(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||!Xs(o,n))return!1}return!0}(r,n))return{};const i=new Map(e.selections),s=qs(i,t),a=new Map(s.clauses);return a.set(n.clientId,n),i.set(t,{...s,clauses:a}),{selections:i}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o||!o.clauses.has(n))return{};const r=new Map(e.selections),i=new Map(o.clauses);return i.delete(n),r.set(t,{...o,clauses:i}),{selections:r}})},setResolution(t,n){e(e=>{const o=e.selections.get(t);if(o?.resolution===n)return{};const r=new Map(e.selections),i=qs(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}})}})),[Ks,Qs]=$(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}))}})),Zs=require("react");function Js(e){const t=(0,Zs.useId)(),n=e.clientId||t,{name:o}=e,r=Us(e=>e.selections.get(o)),i=Us(e=>e.setClause),s=Us(e=>e.clearClause),a=(0,Zs.useMemo)(()=>!!r&&r.clauses.size>0,[r]);return{predicate:(0,Zs.useMemo)(()=>r&&0!==r.clauses.size?function(e,t){const n=[];for(const[o,r]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(Gs(r));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(r,n):()=>!0,[r,n]),isActive:a,selectPoints:(0,Zs.useCallback)(e=>{const t={};let r=!1;for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)},r=!0;r&&i(o,{clientId:n,type:"point",fields:t})},[n,o,i]),selectInterval:(0,Zs.useCallback)(e=>{const t={};let r=!1;for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o},r=!0;r&&i(o,{clientId:n,type:"interval",fields:t})},[n,o,i]),clear:(0,Zs.useCallback)(()=>{s(o,n)},[s,o,n]),clientId:n}}function ea(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function ta(e){const{name:t,xField:n,yField:o}=e,{predicate:r,isActive:i,selectInterval:s,clear:a}=Js({name:t,fields:[n,o].filter(Boolean)}),l=n&&o?"xyBrush":n?"xBrush":"yBrush",c=(0,Zs.useCallback)(e=>{if(!e)return void a();const t={};"xyBrush"===l&&function(e){return 2===e.length&&Array.isArray(e[0])&&2===e[0].length&&Array.isArray(e[1])&&2===e[1].length}(e)?(n&&(t[n]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),o&&(t[o]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===l&&ea(e)?n&&(t[n]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]):"yBrush"===l&&ea(e)&&o&&(t[o]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]),na(t)&&s(t)},[l,n,o,s,a]);return{brushInteraction:(0,Zs.useMemo)(()=>({brush:l,during:c,end:c}),[l,c]),predicate:r,isActive:i,clear:a}}function na(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}var oa=require("react/jsx-runtime"),ra=(0,Ys.createContext)(!1),ia=(0,Ys.createContext)(!1),sa=(0,Ys.createContext)(null),aa="undefined"==typeof window?Ys.useEffect:Ys.useLayoutEffect;function la(e){const t=new Set,n=[];for(const o of e)t.has(o)||(t.add(o),n.push(o));return n}function ca(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}var ua="__linked-legend-isolate__",ha="__linked-legend-highlight__";function da({categoryColors:e,interaction:t,selectionName:n,field:o}){const r=Object.entries(e),i=r.map(([e])=>e),s=[{styleFn:e=>({fill:e.color||"#333",stroke:e.color||"#333"}),type:"fill",items:r.map(([e,t])=>({label:e,color:t})),label:""}],{selectPoints:a,clear:l}=Js({name:n,fields:[o],clientId:ua}),{selectPoints:c,clear:u}=Js({name:n,fields:[o],clientId:ha}),h=Us(e=>e.selections.get(n)),{isolatedCategories:d,highlightedCategory:f}=(0,Ys.useMemo)(()=>{const e=new Set;let t=null;const n=h?.clauses.get(ua)?.fields[o];if("point"===n?.type)for(const t of n.values)e.add(t+"");const r=h?.clauses.get(ha)?.fields[o];if("point"===r?.type){const e=r.values.values().next().value;null!=e&&(t=e+"")}return{isolatedCategories:e,highlightedCategory:t}},[h,o]),p=(0,Ys.useCallback)(e=>{"highlight"===t&&(e?c({[o]:[e.label]}):u())},[t,o,c,u]),y=(0,Ys.useCallback)(e=>{if("isolate"!==t)return;const n=new Set(d);n.has(e.label)?n.delete(e.label):n.add(e.label),0===n.size||n.size===i.length?l():a({[o]:Array.from(n)})},[t,o,d,i.length,a,l]),[g,[m]]=Di([0,0],!0,!1),x=(0,Ys.useMemo)(()=>function(e,t){if(!t||0===e.length)return 1;let n=0,o=1;for(const r of e){const e=26+7*r.length;n>0&&n+e>t&&(o++,n=0),n+=e}return o}(r.map(([e])=>e),m),[r,m]);return 0===r.length?null:(0,oa.jsx)("div",{ref:g,style:{width:"100%",display:"block"},children:(0,oa.jsx)("svg",{width:"100%",height:Math.max(30,22*x+8),style:{display:"block",overflow:"visible"},children:(0,oa.jsx)(ro,{legendGroups:s,title:!1,orientation:"horizontal",width:m,height:20,customHoverBehavior:"highlight"===t?p:void 0,customClickBehavior:"isolate"===t?y:void 0,highlightedCategory:f,isolatedCategories:d})})})}function fa({children:e,selections:t,showLegend:n,legendPosition:o="top",legendInteraction:r="none",legendSelectionName:i="legend",legendField:s="category"}){const a=(0,Ys.useMemo)(()=>{if(!t)return;const e=new Map;for(const[n,o]of Object.entries(t))o.resolution&&e.set(n,{name:n,resolution:o.resolution,clauses:new Map});return e.size>0?{selections:e}:void 0},[t]),l=$s(),[c,u]=(0,Ys.useState)({}),h=(0,Ys.useRef)({}),d=(0,Ys.useMemo)(()=>({registerCategories:(e,t)=>{const n=la(t);u(t=>ca(t[e]??[],n)?t:{...t,[e]:n})},unregisterCategories:e=>{u(t=>{if(!(e in t))return t;const n={...t};return delete n[e],n})}}),[]),f=(0,Ys.useMemo)(()=>{const e=[];for(const t of Object.values(c))for(const n of t)e.push(n);return la(e)},[c]),p=(0,Ys.useMemo)(()=>{const e=l??{},t=h.current;let n=Object.keys(e).length+Object.keys(t).length;for(const o of f)e[o]||t[o]||(t[o]=Le[n%Le.length],n++);const o={...e};for(const n of f)o[n]=e[n]??t[n];return o},[l,f]),y=void 0===n||n,g=Object.keys(p).length>0;return(0,oa.jsx)(Vs,{initialState:a,children:(0,oa.jsx)(Ks,{children:(0,oa.jsx)(ia.Provider,{value:!0,children:(0,oa.jsx)(sa.Provider,{value:d,children:(0,oa.jsx)(Es,{colors:p,children:(0,oa.jsxs)(ra.Provider,{value:y&&g,children:[y&&"top"===o&&(0,oa.jsx)(da,{categoryColors:p,interaction:r,selectionName:i,field:s}),e,y&&"bottom"===o&&(0,oa.jsx)(da,{categoryColors:p,interaction:r,selectionName:i,field:s})]})})})})})})}function pa(e){return e?"string"==typeof e?{name:e}:e:null}var ya=.5;function ga(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??ya;i.opacity=e,i.fillOpacity=e,i.strokeOpacity=e,n?.unselectedStyle&&Object.assign(i,n.unselectedStyle)}return i}:e}var ma=c(require("react"));function xa(){return J(e=>e.theme)}function ba(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function va(e,t){const{when:n}=e,o=t.width,r=t.height,i=function(e){if("number"==typeof e.height&&e.height>0)return e.width/e.height}(t),s=function(e){if("number"==typeof e.height&&e.height>0)return e.height>e.width?"portrait":"landscape"}(t);return!("number"==typeof n.minWidth&&n.minWidth>o||"number"==typeof n.maxWidth&&o>n.maxWidth||"number"==typeof n.minHeight&&("number"!=typeof r||n.minHeight>r)||"number"==typeof n.maxHeight&&("number"!=typeof r||r>n.maxHeight)||"number"==typeof n.minAspectRatio&&("number"!=typeof i||n.minAspectRatio>i)||"number"==typeof n.maxAspectRatio&&("number"!=typeof i||i>n.maxAspectRatio)||n.orientation&&s!==n.orientation)}function ka(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=>va(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"])ba(e[o])&&ba(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}}require("react/jsx-runtime"),ma.createContext(void 0);var wa="#007bff";function Aa(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 Sa(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 Ca(e){if(!e)return!1;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}var Ma=44,_a={enabled:!0,tapToSelect:!0,tapToLockTooltip:!0,clearSelection:"backgroundTap",targetSize:Ma,snap:"nearestDatum",brushHandleSize:Ma,standardControls:!1,enabled:!1,tapToSelect:!1,tapToLockTooltip:!1};function ja(e,t={}){const n=t.mobileSemantics?.interaction,o="number"==typeof n?.targetSize?n.targetSize:"number"==typeof t.mobileSemantics?.minimumHitTarget?t.mobileSemantics.minimumHitTarget:void 0,r="mobile"===t.mode||"number"==typeof t.width&&480>=t.width,i=!!n||void 0!==o,s=e&&"object"==typeof e?e:void 0;if(!1===e||!1===s?.enabled||void 0===e&&!r&&!i)return _a;const a=s??{};return{enabled:!0,tapToSelect:a.tapToSelect??!0,tapToLockTooltip:a.tapToLockTooltip??!0,clearSelection:a.clearSelection??"backgroundTap",targetSize:a.targetSize??o??Ma,snap:a.snap??"nearestDatum",brushHandleSize:a.brushHandleSize??Ma,standardControls:a.standardControls??!1}}function Pa(){const e=xa(),t=e?.colors?.categorical;return t&&t.length>0?t:void 0}function La(e,t,n){const o=$s(),r=Pa();return(0,Ds.useMemo)(()=>{if(!t)return;const i=o??void 0,s=n??(r&&r.length>0?r:void 0)??"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>t(e)+"")));if(i&&Ca(i)){const e=Te(n.map(e=>({_cat:e})),"_cat",s);return t=>i[t]||e(t)}return Te(n.map(e=>({_cat:e})),"_cat",s)}if(i&&Ca(i)){const n=Te(e,t,s);return e=>i[e]||n(e)}return Te(e,t,s)}if(i&&Ca(i)){const e=Te([{_:"a"}],"_",s);return t=>i[t]||e(t)}},[e,t,n,o,r])}function Ra({selection:e,linkedHover:t,fallbackFields:n=[],unwrapData:o=!1,onObservation:r,chartType:i,chartId:s,onClick:a,hoverHighlight:l,colorByField:c,mobileInteraction:u}){const h=(0,Ds.useId)(),d=function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField,seriesField:e.seriesField}:null}(t,n),f="series"===d?.mode?[d.seriesField||c||n[0]].filter(e=>!!e):d?.fields||n||[],p=Js({name:e?.name||"__unused__",fields:f}),y=function(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:r,selectPoints:i,clear:s}=Js({name:t,fields:n});return{onHover:(0,Zs.useCallback)(e=>{if(!e)return void s();const t={};for(const o of n){const n=e[o];void 0!==n&&(t[o]=[n])}na(t)&&i(t)},[n,i,s,t]),predicate:o,isActive:r}}({name:d?.name||"hover",fields:f}),g=Qs(e=>e.pushObservation),m=e?{isActive:p.isActive,predicate:p.predicate}:null,[x,b]=(0,Ds.useState)(null),v=(0,Ds.useRef)(!1),k=c||n[0],w=(0,Ds.useMemo)(()=>{if(!l||null==x||!k)return null;const e=x,t=k;return{isActive:!0,predicate:n=>("string"==typeof n[t]?n[t]:(n[t]??"")+"")===e}},[l,x,k]),A=(0,Ds.useCallback)(e=>{const n=!e&&v.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=Aa(e,t,d.xField);null!=n&&function(e,t,n){const o=sr.positions.get(e);o?.locked||o&&o.xValue===t&&o.sourceId===n||(sr={positions:new Map(sr.positions).set(e,{xValue:t,sourceId:n})},lr())}(d.name||"hover",n,h)}"x-position"!==d?.mode&&y.onHover(t)}else"x-position"!==d?.mode||n||cr(d.name||"hover",h),"x-position"===d?.mode||n||y.onHover(null);if(l&&k)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=t?.[k];b(null!=n?n+"":null)}else n||b(null);if(r||g){const t={timestamp:Date.now(),chartType:i||"unknown",chartId:s};if(e){const n=Sa(e),o={...t,type:"hover",datum:n||{},x:e.x??0,y:e.y??0};r&&r(o),g&&g(o)}else{const e={...t,type:"hover-end"};r&&r(e),g&&g(e)}}},[t,y,d,h,r,i,s,g,l,k,u]),S=(0,Ds.useCallback)((n=!0)=>{v.current=!1,t&&"x-position"!==d?.mode&&y.onHover(null),e&&u?.tapToSelect&&p.clear(),n&&l&&b(null),"x-position"===d?.mode&&(ur(d.name||"hover",h),cr(d.name||"hover",h))},[t,d,y,e,u,p,l,h]),C=(0,Ds.useCallback)(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=Aa(n,e,d.xField);null!=t&&function(e,t,n){const o=sr.positions.get(e);if(o?.locked){const t=new Map(sr.positions);return t.delete(e),sr={positions:t},lr(),!1}sr={positions:new Map(sr.positions).set(e,{xValue:t,sourceId:n,locked:!0})},lr()}(d.name||"hover",t,h)}if(o)if(n){v.current=!0;const o=Sa(n);if(t&&"x-position"!==d?.mode&&y.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])}Ca(e)&&p.selectPoints(e)}if(l&&k){const e=o?.[k];b(null!=e?e+"":null)}}else c&&S();if(n||c){if(n&&a){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]),a(e,{x:n.x??0,y:n.y??0})}if(r||g){const e={timestamp:Date.now(),chartType:i||"unknown",chartId:s};if(n){const t=Sa(n),o={...e,type:"click",datum:t||{},x:n.x??0,y:n.y??0};r&&r(o),g&&g(o)}else{const t={...e,type:"click-end"};r&&r(t),g&&g(t)}}}},[a,r,g,i,s,d,h,u,t,y,e,p,f,l,k,S]);return(0,Ds.useEffect)(()=>{if(!u?.enabled||"undefined"==typeof document)return;const e=e=>{"Escape"===e.key&&v.current&&S()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[u?.enabled,S]),(0,Ds.useEffect)(()=>()=>{v.current&&S(!1)},[S]),(0,Ds.useEffect)(()=>{if("x-position"!==d?.mode)return;const e=d.name||"hover";return()=>{ur(e,h),cr(e,h)}},[d?.mode,d?.name,h]),{activeSelectionHook:m,hoverSelectionHook:w,customHoverBehavior:A,customClickBehavior:C,crosshairSourceId:h}}function Ia(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===n?.mode)return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}function Na({data:e,colorBy:t,colorScale:n,showLegend:o,legendPosition:r="right",userMargin:i,defaults:s={top:50,bottom:60,left:70,right:40},categories:a}){const l=(0,Ys.useContext)(ra),c=null!==(0,Ys.useContext)(sa),u=void 0!==o?o:!l&&!!t,h=!!t&&(u||c),d=(0,Ds.useMemo)(()=>{if(!h)return[];if(void 0!==a)return a;const n=new Set;for(const o of e){const e="function"==typeof t?t(o):o[t];null!=e&&n.add(e+"")}return Array.from(n)},[a,t,e,h]);!function(e){const t=(0,Ys.useContext)(sa),n=(0,Ys.useId)(),o=la(e),r=(0,Ys.useRef)([]);ca(r.current,o)||(r.current=o);const i=r.current;aa(()=>{if(t)return()=>t.unregisterCategories(n)},[t,n]),aa(()=>{t&&t.registerCategories(n,i)},[t,n,i])}(c&&t?d:[]);const f=(0,Ds.useMemo)(()=>{if(!u||!t)return;const o=function({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:r,strokeWidth:i,categories:s}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==r&&(n.stroke=r),void 0!==i&&(n.strokeWidth=i),n},type:"fill",items:(s&&s.length>0?s:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((r,i)=>{const s=e.find("function"==typeof t?e=>t(e)===r:e=>e[t]===r),a=s?o(s,t,n):n?n(r):Re[i%Re.length];return{label:r+"",color:a}}),label:""}]}}({data:e,colorBy:t,colorScale:n,getColor:Ne,categories:d});return 0!==o.legendGroups.reduce((e,t)=>e+t.items.length,0)?o:void 0},[u,t,e,n,d]),p=(0,Ds.useMemo)(()=>{const e="number"==typeof i?{top:i,bottom:i,left:i,right:i}:i??{},t=t=>{const n=e[t];return"number"==typeof n?n:s[t]},n={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},o=t=>"number"==typeof e[t];return f&&("right"===r&&!o("right")&&110>n.right?n.right=110:"left"===r&&!o("left")&&110>n.left?n.left=110:"top"===r&&!o("top")&&50>n.top?n.top=50:"bottom"===r&&!o("bottom")&&80>n.bottom&&(n.bottom=80)),n},[s,i,f,r]);return{legend:f,margin:p,legendPosition:r}}function Fa(e,t,n){const[o,r]=(0,Ds.useState)(null),[i,s]=(0,Ds.useState)(new Set),a=(0,Ds.useMemo)(()=>new Set,[]),l=(0,Ds.useCallback)(t=>{"highlight"===e&&r(t?t.label:null)},[e]),c=(0,Ds.useCallback)(t=>{"isolate"===e&&s(e=>{const o=new Set(e);return o.has(t.label)?o.delete(t.label):o.add(t.label),o.size===n.length?new Set:o})},[e,n.length]),u=(0,Ds.useMemo)(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=o?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===o}:"isolate"===e&&i.size>0?{isActive:!0,predicate:e=>{const o=n?e[n]:"function"==typeof t?t(e):null;return i.has(o)}}:null},[e,t,o,i]);return{highlightedCategory:"highlight"===e?o:null,isolatedCategories:"isolate"===e?i:a,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}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 Ba(e,t,n){const o=Ta[e||"primary"],r=e&&"primary"!==e||!n?.width?o.width:n.width,i=e&&"primary"!==e||!n?.height?o.height:n.height,s=ka({...t,mode:e},{width:t.width??r,height:t.height??i}).props,a=s.mode||e,l=Ta[a||"primary"],c="context"===a||"sparkline"===a,u=a&&"primary"!==a||!n?.width?l.width:n.width;return{width:s.width??u,height:s.height??(a&&"primary"!==a||!n?.height?l.height:n.height),showAxes:s.showAxes??l.showAxes,showGrid:s.showGrid??l.showGrid,enableHover:s.enableHover??(!!s.linkedHover||l.enableHover),showLegend:s.showLegend??l.showLegend,showLabels:s.showLabels??l.showLabels,title:c?void 0:s.title,description:s.description,summary:s.summary,accessibleTable:s.accessibleTable,xLabel:c?void 0:s.xLabel,yLabel:c?void 0:s.yLabel,categoryLabel:c?void 0:s.categoryLabel,valueLabel:c?void 0:s.valueLabel,marginDefaults:Oa(l.marginDefaults,s.showCategoryTicks,s.orientation),compactMode:c,mobileInteraction:ja(s.mobileInteraction,{mode:a,width:s.width??u,mobileSemantics:s.mobileSemantics}),mobileSemantics:s.mobileSemantics}}function Oa(e,t,n){if(!1!==t)return e;const o={...e};return"horizontal"===n?o.left=Math.min(o.left,15):o.bottom=Math.min(o.bottom,15),o}var Da=require("react/jsx-runtime");function Wa({componentName:e,message:t,diagnosticHint:n,width:o,height:r}){return(0,Da.jsx)("div",{role:"alert",style:{width:o,height:Math.max(r,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:(0,Da.jsxs)("div",{style:{textAlign:"center",maxWidth:400},children:[(0,Da.jsx)("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:e}),(0,Da.jsx)("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:t}),n&&(0,Da.jsx)("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:n})]})})}var za=c(require("react")),Ha=require("react/jsx-runtime"),Ea=class extends za.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){this.props.onError?.(e,t)}render(){if(this.state.error){const{fallback:e}=this.props,t=this.state.error;return"function"==typeof e?e(t):void 0!==e?e:(0,Ha.jsx)(Wa,{componentName:"ChartErrorBoundary",message:t.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}},$a=require("react/jsx-runtime"),Ya="undefined"!=typeof process&&"production"!==process.env?.NODE_ENV;function Ga({componentName:e,width:t,height:n,children:o}){return(0,$a.jsx)(Ea,{fallback:o=>(0,$a.jsx)(Wa,{componentName:e,message:o.message,width:t,height:n}),children:o})}var qa={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"},Xa={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Va(e,t,n,o){return!1===o||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?(0,$a.jsx)("div",{style:{...qa,width:t,height:n},children:o||"No data available"}):null}function Ua(e,t,n,o){if(!e)return null;if(!1===o)return null;if(null!=o)return(0,$a.jsx)("div",{style:{width:t,height:n,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:o});const r=Math.min(5,Math.floor(n/40)),i=Math.max(8,Math.floor(n/(3*r))),s=Math.max(6,Math.floor(n/(2.5*r))),a=Math.floor((n-(r*(i+s)-s))/2);return(0,$a.jsx)("div",{style:{width:t,height:n,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:r},(e,n)=>(0,$a.jsx)("div",{className:"semiotic-loading-bar",style:{...Xa,position:"absolute",top:a+n*(i+s),left:Math.floor(.1*t),width:30+(37*n+13)%50+"%",height:i,opacity:.5+n%2*.2}},n))})}function Ka(e,t,n,o){if(!Ya)return;if(!t||0===t.length)return;if("string"!=typeof o)return;const r=t[0];if(!r||"object"!=typeof r)return;if(o in r)return;const i=Object.keys(r).join(", ");console.warn(`[semiotic] ${e}: ${n} "${o}" not found in data. Available keys: ${i}`)}function Qa(e,t){const n=e.length,o=t.length,r=Array(o+1);for(let e=0;o>=e;e++)r[e]=e;for(let i=1;n>=i;i++){let n=r[0];r[0]=i;for(let s=1;o>=s;s++){const o=r[s];r[s]=e[i-1]===t[s-1]?n:1+Math.min(n,r[s],r[s-1]),n=o}}return r[o]}function Za(e,t){if(0===t.length)return null;const n=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(n)||n.includes(e.toLowerCase()))||(function(e,t,n=3){let o,r=n+1;for(const n of t){const t=Qa(e.toLowerCase(),n.toLowerCase());r>t&&(r=t,o=n)}return r>n?void 0:o}(e,t,3)??null)}function Ja({componentName:e,data:t,accessors:n,requiredProps:o}){if(o)for(const[t,n]of Object.entries(o))if(null==n)return`${e}: ${t} is required. Provide a field name or function.`;if(null==t)return null;if(!Array.isArray(t)&&"object"==typeof t)return e+": data should be an array, but received an object. If this is hierarchical data, use TreeDiagram, Treemap, or CirclePack instead.";if(!Array.isArray(t)||0===t.length)return e+": No data provided. Pass a non-empty array to the data prop.";if(n){const o=function(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}(t).find(e=>e&&"object"==typeof e);if(o){const t=Object.keys(o);for(const[r,i]of Object.entries(n))if(i&&"string"==typeof i&&!(i in o)){const n=Za(i,t),o=n?` Try ${r}="${n}".`:"";return`${e}: ${r} "${i}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}var el=require("react"),tl=require("react");function nl(e){const t=J(e=>e.theme.colors.selectionOpacity);return(0,tl.useMemo)(()=>{if(void 0!==e||void 0!==t)return{name:e?.name??"",...e,unselectedOpacity:e?.unselectedOpacity??t}},[e,t])}function ol(e){const{data:t,rawData:n,colorBy:o,colorScheme:r,legendInteraction:i,legendPosition:s,selection:a,linkedHover:l,fallbackFields:c,unwrapData:u=!1,onObservation:h,chartType:d,chartId:f,showLegend:p,userMargin:y,marginDefaults:g,onClick:m,hoverHighlight:x,mobileInteraction:b,mobileSemantics:v,loading:k,loadingContent:w,emptyContent:A,width:S,height:C}=e,M=void 0===n,_=(0,el.useMemo)(()=>W(t),[t]),[j,P]=(0,el.useState)([]),L=(0,el.useCallback)(e=>{P(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[]),R="string"==typeof e.colorBy?e.colorBy:void 0,I=(0,el.useMemo)(()=>ja(b,{width:S,mobileSemantics:v}),[b,S,v]),{activeSelectionHook:N,hoverSelectionHook:F,customHoverBehavior:T,customClickBehavior:B,crosshairSourceId:O}=Ra({selection:a,linkedHover:l,fallbackFields:c,unwrapData:u,onObservation:h,chartType:d,chartId:f,onClick:m,hoverHighlight:x,colorByField:R,mobileInteraction:I}),D=Ia(l,O),z=La(_,o,r),H=(0,el.useMemo)(()=>{if(!o)return[];const e=new Set;for(const t of _){const n="function"==typeof o?o(t):t[o];null!=n&&e.add(n+"")}return Array.from(e)},[_,o]),E=(0,el.useMemo)(()=>M&&j.length>0?j:H,[M,j,H]),$=Fa(i,o,E),Y=(0,el.useMemo)(()=>F||($.legendSelectionHook?$.legendSelectionHook:N),[F,$.legendSelectionHook,N]),G=nl(a),q=Pa(),X=$s(),V=(0,el.useMemo)(()=>{if(z)return z;if(!o||0===E.length)return;const e=Array.isArray(r)&&r.length>0||"string"==typeof r&&r.length>0?r:q&&q.length>0?q:Re,t="__streamCat",n=Te(E.map(e=>({[t]:e})),t,e);return e=>X?.[e]||n(e)||"#999"},[z,o,E,r,q,X]),{legend:U,margin:K,legendPosition:Q}=Na({data:_,colorBy:o,colorScale:V,showLegend:p,legendPosition:s,userMargin:y,defaults:g,categories:E}),Z=(0,el.useMemo)(()=>{const e={};return U&&(e.legend=U,e.legendPosition=Q),i&&"none"!==i&&(e.legendHoverBehavior=$.onLegendHover,e.legendClickBehavior=$.onLegendClick,e.legendHighlightedCategory=$.highlightedCategory,e.legendIsolatedCategories=$.isolatedCategories),M&&o&&(e.legendCategoryAccessor=o,e.onCategoriesChange=L),e},[U,Q,i,$.onLegendHover,$.onLegendClick,$.highlightedCategory,$.isolatedCategories,M,o,L]),J=Array.isArray(n)?W(n):n,ee=Ua(k,S,C,w),te=ee?null:Va(J,S,C,A);return{data:_,colorScale:z,allCategories:E,legendState:$,effectiveSelectionHook:Y,activeSelectionHook:N,customHoverBehavior:T,customClickBehavior:B,mobileInteraction:I,legend:U,margin:K,legendPosition:Q,earlyReturn:ee||te||null,legendBehaviorProps:Z,crosshairProps:D,resolvedSelection:G}}var rl=require("react");function il(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})}function sl(e){const{lineWidth:t=2,colorBy:n,colorScale:o,color:r,resolveStroke:i,fillArea:s,areaOpacity:a=.3,stroke:l,strokeWidth:c,opacity:u,effectiveSelectionHook:h,resolvedSelection:d}=e,f=(0,rl.useMemo)(()=>(e,l)=>{const c={strokeWidth:t},u=!0===s||Array.isArray(s)&&null!=l&&s.includes(l);let h;return i?h=i(e,l):n?o&&(h=Ne(e,n,o)):h=r||wa,void 0!==h&&(c.stroke=h,u&&(c.fill=h,c.fillOpacity=a)),c},[t,n,o,r,i,s,a]),p=(0,rl.useMemo)(()=>il(f,{stroke:l,strokeWidth:c,opacity:u}),[f,l,c,u]);return(0,rl.useMemo)(()=>ga(p,h??null,d),[p,h,d])}var al=require("react");function ll(e,t){const{variant:n,frameRef:o,overrides:r,deps:i}=t;(0,al.useImperativeHandle)(e,()=>{const e=function(e,t){if("xy"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>e.current?.remove(t)??[],update:(t,n)=>e.current?.update(t,n)??[],clear:()=>e.current?.clear(),getData:()=>e.current?.getData()??[],getScales:()=>e.current?.getScales()??null,getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}if("network"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>{const n=Array.isArray(t)?t:[t],o=e.current?.getTopology()?.nodes??[],r=[];for(const t of n){const n=o.find(e=>e.id===t);n&&r.push({...n.data??{},id:t}),e.current?.removeNode(t)}return r},update:(t,n)=>(Array.isArray(t)?t:[t]).flatMap(t=>{const o=e.current?.updateNode(t,n);return o?[{...o,id:t}]:[]}),clear:()=>e.current?.clear(),getData:()=>e.current?.getTopology()?.nodes?.map(e=>e.data)??[],getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}if("geo-points"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>e.current?.removePoint(t)??[],update:(t,n)=>{const o=e.current?.removePoint(t)??[];for(const t of o)e.current?.push(n(t));return o},clear:()=>e.current?.clear(),getData:()=>e.current?.getData()??[],getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}const n=t;return{push:e=>n.current?.pushLine(e),pushMany:e=>n.current?.pushManyLines(e),remove:e=>n.current?.removeLine(e)??[],update:(e,t)=>{const o=n.current?.removeLine(e)??[];for(const e of o)n.current?.pushLine(t(e));return o},clear:()=>n.current?.clear(),getData:()=>n.current?.getLines()??[],getCustomLayout:()=>n.current?.getCustomLayout?.()??null,getLayoutFailure:()=>n.current?.getLayoutFailure?.()??null}}(n,o);return{...e,...r}},i??[])}function cl(e){const{title:t,description:n,summary:o,accessibleTable:r,className:i,animate:s,axisExtent:a,autoPlaceAnnotations:l}=e,c={};return t&&(c.title=t),n&&(c.description=n),o&&(c.summary=o),void 0!==r&&(c.accessibleTable=r),i&&(c.className=i),null!=s&&(c.animate=s),void 0!==a&&(c.axisExtent=a),void 0!==l&&(c.autoPlaceAnnotations=l),c}function ul(e){const{linkedHover:t,selection:n,onObservation:o,onClick:r,hoverRadius:i,hoverHighlight:s,forceHoverBehavior:a,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(a||t||o||r||s)&&(f.customHoverBehavior=u),h&&(l||(d?o||r||t:o||r)||c?.enabled&&(c.tapToSelect||c.tapToLockTooltip)&&(t||s||n))&&(f.customClickBehavior=h),null!=p&&(f.hoverRadius=p),f}function hl(e){const{tooltip:t,defaultTooltipContent:n}=e;return{tooltipContent:!1===t?()=>null:Ri(t)||n}}var dl="__forecastSegment",fl=null;async function pl(){return fl||(fl=await Promise.resolve().then(()=>(C(),x))),fl}var yl=require("react"),gl="__semiotic_resolvedX",ml="__semiotic_resolvedY";function xl(e){const{data:t,xAccessor:n,yAccessor:o,forecast:r,anomaly:i,groupBy:s}=e,a="string"==typeof n?n:gl,l="string"==typeof o?o:ml,c=(0,yl.useMemo)(()=>{if(!r&&!i)return t;const e="function"==typeof n,s="function"==typeof o;return e||s?t.map(t=>{const r={...t};return e&&(r[gl]=n(t)),s&&(r[ml]=o(t)),r}):t},[t,r,i,n,o]),[u,h]=(0,yl.useState)(null),[d,f]=(0,yl.useState)([]),p=(0,yl.useRef)(r),y=(0,yl.useRef)(i);return(0,yl.useEffect)(()=>{if(!r&&!i)return void((p.current||y.current)&&(h(null),f([]),p.current=r,y.current=i));let e=!1;const t=r!==p.current||i!==y.current;if(p.current=r,y.current=i,t&&(h(null),f([])),r){const t=s&&"string"==typeof s&&"object"==typeof r?{...r,_groupBy:s}:r;(async function(...e){return(await pl()).buildForecast(...e)})(c,a,l,t,i).then(t=>{e||(h(t),f(t.annotations))}).catch(()=>{e||(h(null),f([]))})}else i&&async function(...e){return(await pl()).buildAnomalyAnnotations(...e)}(i).then(t=>{e||(h(null),f(t))}).catch(()=>{e||f([])});return()=>{e=!0}},[c,r,i,a,l,s]),{effectiveData:u?u.processedData:t,statisticalAnnotations:d,hasForecast:!!u,xAccessorKey:a,yAccessorKey:l}}var bl=require("react/jsx-runtime"),vl="__lineObjectSeries",kl=(0,Os.forwardRef)(function(e,t){const n=(0,Os.useRef)(null);ll(t,{variant:"xy",frameRef:n});const o=Ba(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,axisExtent:c,xAccessor:u="x",yAccessor:h="y",lineBy:d,lineDataAccessor:f="coordinates",colorBy:p,colorScheme:y,curve:g="linear",showPoints:m=!1,pointRadius:x=3,fillArea:b=!1,areaOpacity:v=.3,lineWidth:k=2,lineGradient:w,tooltip:A,pointIdAccessor:S,annotations:C,directLabel:M,gapStrategy:_="break",anomaly:j,forecast:P,band:L,xExtent:R,yExtent:I,frameProps:N={},selection:F,linkedHover:T,onObservation:B,onClick:O,hoverHighlight:D,hoverRadius:z,chartId:H,loading:E,loadingContent:$,emptyContent:Y,legendInteraction:G,legendPosition:q,xScaleType:X,yScaleType:V,color:U,stroke:K,strokeWidth:Q,opacity:Z}=e,{width:J,height:ee,enableHover:te,showGrid:ne,showLegend:oe,title:re,description:ie,summary:se,accessibleTable:ae,xLabel:le,yLabel:ce}=o,ue=(0,Os.useMemo)(()=>W(r),[r]),he=Array.isArray(ue[0]?.[f])?ue[0][f]:ue;Ka("LineChart",he,"xAccessor",u),Ka("LineChart",he,"yAccessor",h);const{effectiveData:de,statisticalAnnotations:fe}=xl({data:ue,xAccessor:u,yAccessor:h,forecast:P,anomaly:j,groupBy:d}),pe="__compoundGroup",ye=!(!P||!d),ge=ye?pe:P?dl:d,me=(0,Os.useMemo)(()=>{if(!ye)return de;const e="function"==typeof d?d:e=>e[d];return de.map(t=>{const n={...t};return n[pe]=`${e(t)}__${t[dl]||"observed"}`,n})},[de,ye,d]),xe=ye?me:de,be=p||d,ve=(0,Os.useMemo)(()=>{if(!P)return;const e=P.upperBounds,t=P.lowerBounds;if(!e&&!t)return;const n="function"==typeof e?e:"string"==typeof e?t=>t[e]:null,o="function"==typeof t?t:"string"==typeof t?e=>e[t]:null;let r=1/0,i=-1/0;const s=de;for(const e of s){const t="function"==typeof h?h(e):+e[h];if(isFinite(t)&&(r>t&&(r=t),t>i&&(i=t)),n){const t=n(e);null!=t&&isFinite(t)&&(t>i&&(i=t),r>t&&(r=t))}if(o){const t=o(e);null!=t&&isFinite(t)&&(r>t&&(r=t),t>i&&(i=t))}}return isFinite(r)&&isFinite(i)?[r,i]:void 0},[P,de,h]),ke=(0,Os.useCallback)(e=>{const t="function"==typeof u?u(e):e[u],n="function"==typeof h?h(e):e[h];return null==t||null==n||Number.isNaN(t)||Number.isNaN(n)},[u,h]),we=void 0!==xe[0]?.[f],Ae=we?vl:ge,Se=(0,Os.useMemo)(()=>{if(we)return xe.map((e,t)=>{const n="function"==typeof d?d(e):"string"==typeof d?e[d]:void 0,o=null==n?"line-"+t:n+"",r=Array.isArray(e[f])?e[f]:[];return{...e,[vl]:o,[f]:r.map(t=>({...t,[vl]:o,parentLine:e,..."string"==typeof d&&void 0!==e[d]?{[d]:e[d]}:{}}))}});if(ge){const e=xe.reduce((e,t)=>{const n="function"==typeof ge?ge(t):t[ge];if(!e[n]){const o={[f]:[]};"string"==typeof ge&&(o[ge]=n),ye&&(o[dl]=t[dl],"string"==typeof d&&(o[d]=t[d])),e[n]=o}return e[n][f].push(t),e},{});return Object.values(e)}return[{[f]:xe}]},[xe,ge,f,we,d]),{gapProcessedLineData:Ce,hasGaps:Me}=(0,Os.useMemo)(()=>{if("interpolate"===_){let e=!1;const t=[];for(const n of Se){const o=(n[f]||[]).filter(t=>!ke(t)||(e=!0,!1));o.length>0&&t.push({...n,[f]:o})}return{gapProcessedLineData:t,hasGaps:e}}if("break"===_){let e=!1;const t=[];for(const n of Se){const o=n[f]||[];let r=[],i=0;const s=Ae&&"string"==typeof Ae?n[Ae]:void 0;for(const a of o)if(ke(a))e=!0,r.length>0&&(t.push({...n,[f]:r}),r=[],i++);else{const e=null!=s?`${s}__seg${i}`:"__seg"+i;r.push({...a,_gapSegment:e})}r.length>0&&t.push({...n,[f]:r})}return{gapProcessedLineData:t,hasGaps:e}}if("zero"===_){let e=!1;const t="string"==typeof h?h:"y",n=[];for(const o of Se){const r=o[f]||[],i=[];for(const n of r)ke(n)?(e=!0,i.push({...n,[t]:0})):i.push(n);n.push({...o,[f]:i})}return{gapProcessedLineData:n,hasGaps:e}}return{gapProcessedLineData:Se,hasGaps:!1}},[Se,_,f,ke,Ae,h]),_e="object"==typeof M?M:{},je=_e.position||"end",Pe=_e.fontSize||11,Le=(0,Os.useMemo)(()=>{if(!M||!be)return[];const e="function"==typeof be?be:e=>e[be],t=new Set;for(const n of Ce){const o=n[f]||[];if(0===o.length)continue;const r=e("end"===je?o[o.length-1]:o[0])??e(n);if(null==r)continue;const i=r+"";""!==i&&t.add(i)}return Array.from(t)},[M,be,Ce,f,je]),Re=(0,Os.useMemo)(()=>{if(!M)return o.marginDefaults;const e=Le.reduce((e,t)=>Math.max(e,t.length*(.6*Pe)),0)+10,t="end"===je?"right":"left";return{...o.marginDefaults,[t]:Math.max(o.marginDefaults[t]||0,e)}},[M,Le,Pe,je,o.marginDefaults]),Ie=ol({data:de,rawData:r,colorBy:be,colorScheme:y,legendInteraction:G,legendPosition:q,selection:F,linkedHover:T,fallbackFields:be?["string"==typeof be?be:""]:[],unwrapData:!1,onObservation:B,onClick:O,hoverHighlight:D,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"LineChart",chartId:H,showLegend:(!M||void 0!==oe)&&oe,userMargin:i,marginDefaults:Re,loading:E,loadingContent:$,emptyContent:Y,width:J,height:ee}),Fe=Ie.colorScale,Te=Ie.effectiveSelectionHook,Be=Ie.resolvedSelection,Oe=Ie.customHoverBehavior,De=Ie.customClickBehavior,We=Ie.crosshairProps,ze=sl({lineWidth:k,colorBy:(0,Os.useMemo)(()=>{if(be)return we?e=>{const t=e.parentLine||e;return"function"==typeof be?be(t):t[be]}:be},[be,we]),colorScale:Fe,color:U,fillArea:b,areaOpacity:v,stroke:K,strokeWidth:Q,opacity:Z,effectiveSelectionHook:Te,resolvedSelection:Be}),[He,Ee]=(0,Os.useState)(null);(0,Os.useEffect)(()=>{if(!P)return void Ee(null);let e=!1;return async function(...e){return(await pl()).createSegmentLineStyle(...e)}(ze,P).then(t=>{e||Ee(()=>t)}).catch(()=>{e||Ee(null)}),()=>{e=!0}},[ze,P]);const $e=He||ze,Ye=(0,Os.useMemo)(()=>{if(m)return e=>{const t={r:x,fillOpacity:1};return be?Fe&&(t.fill=Ne(e.parentLine||e,be,Fe)):t.fill=U||wa,t}},[m,x,be,Fe,U]),Ge=Array.isArray(b)?"mixed":b?"area":"line",qe=(0,Os.useMemo)(()=>{if(!M||!be)return[];const e="function"==typeof u?u:e=>e[u],t="function"==typeof h?h:e=>e[h],n="function"==typeof be?be:e=>e[be],o=new Map;for(const e of Ce){const t=e[f]||[];if(0===t.length)continue;const r="end"===je?t[t.length-1]:t[0],i=n(r)??n(e);if(null==i)continue;const s=i+"";""===s||o.has(s)||o.set(s,r)}const r=Array.from(o.entries()).map(([n,o])=>({type:"text",label:n,["string"==typeof u?u:"x"]:e(o),["string"==typeof h?h:"y"]:t(o),dx:"end"===je?6:-6,dy:0,color:Fe?Fe(n):wa,fontSize:Pe}));r.sort((e,t)=>{const n="string"==typeof h?h:"y";return e[n]-t[n]});for(let e=1;r.length>e;e++){const t="string"==typeof h?h:"y",n=r[e-1],o=r[e];Pe+2>Math.abs(o[t]+o.dy-(n[t]+n.dy))&&(o.dy+=Pe+2)}return r},[M,be,Fe,Ce,f,u,h,je,Pe]),Xe=Ie.margin,Ve=d||p,Ue=(0,Os.useMemo)(()=>_s([{label:le||ws(u),accessor:u,role:"x",format:a},{label:ce||ws(h),accessor:h,role:"y",format:l},...Ve?[{label:ws(Ve),accessor:Ve,role:"group"}]:[],...Ms(L,l)]),[u,h,le,ce,Ve,a,l,L]),Ke=Ja({componentName:"LineChart",data:we?de[0]?.[f]||[]:r,accessors:{xAccessor:u,yAccessor:h}}),Qe=(0,Os.useMemo)(()=>we||Ae||Me?Ce.flatMap(e=>{const t=e[f]||[];return Ae&&"string"==typeof Ae?t.map(t=>({...t,[Ae]:t[Ae]??e[Ae]})):t}):xe,[Ce,f,we,Ae,xe,Me]),Ze={chartType:Ge,...Array.isArray(b)&&{areaGroups:b},...w&&{lineGradient:w},...null!=r&&{data:Qe},xAccessor:u,yAccessor:h,xScaleType:X,yScaleType:V,...R&&{xExtent:R},...!I||null==I[0]&&null==I[1]?ve?{yExtent:ve}:{}:{yExtent:I},groupAccessor:"break"===_&&Me?"_gapSegment":Ae||void 0,...L&&{band:L},curve:g,lineStyle:$e,...m&&{pointStyle:Ye},size:[J,ee],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Xe,showAxes:o.showAxes,xLabel:le,yLabel:ce,xFormat:a,yFormat:l,...void 0!==c&&{axisExtent:c},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},enableHover:te,showGrid:ne,...Ie.legendBehaviorProps,...re&&{title:re},...ie&&{description:ie},...se&&{summary:se},...void 0!==ae&&{accessibleTable:ae},...s&&{className:s},...null!=e.animate&&{animate:e.animate},tooltipContent:!1===A?()=>null:"multi"===A?Li():Ri(A)||Ue,..."multi"===A&&{tooltipMode:"multi"},...ul({linkedHover:T,selection:F,onObservation:B,onClick:O,hoverRadius:z,hoverHighlight:D,mobileInteraction:Ie.mobileInteraction,customHoverBehavior:Oe,customClickBehavior:De}),...S&&{pointIdAccessor:S},...(C?.length||fe.length||qe.length)&&{annotations:[...C||[],...fe,...qe]},...We,...N};return Ie.earlyReturn?Ie.earlyReturn:Ke?(0,bl.jsx)(Wa,{componentName:"LineChart",message:Ke,width:J,height:ee}):(0,bl.jsx)(Ga,{componentName:"LineChart",width:J,height:ee,children:(0,bl.jsx)(Bs,{ref:n,...Ze})})});kl.displayName="LineChart";var wl=require("react"),Al=require("react");function Sl(e){const{safeData:t,data:n,areaBy:o,lineDataAccessor:r,colorBy:i,colorScale:s,color:a,stroke:l,strokeWidth:c,opacity:u,effectiveSelectionHook:h,resolvedSelection:d,areaOpacity:f,showLine:p,lineWidth:y,showPoints:g,pointRadius:m,xAccessor:x,yAccessor:b,xLabel:v,yLabel:k,xFormat:w,yFormat:A,groupField:S}=e,C=void 0!==t[0]?.[r],M=(0,Al.useMemo)(()=>{if(null==n)return[];if(!C&&!o)return t;let e;if(C)e=t;else{const n=o,i=t.reduce((e,t)=>{const o="function"==typeof n?n(t):t[n];if(!e[o]){const t={[r]:[]};"string"==typeof n&&(t[n]=o),e[o]=t}return e[o][r].push(t),e},{});e=Object.values(i)}return e.flatMap(e=>{const t=e[r]||[];return o&&"string"==typeof o?t.map(t=>({...t,[o]:e[o]})):t})},[n,t,o,r,C]),_=(0,Al.useMemo)(()=>e=>{const t={};if(i){if(s){const n=Ne(e,i,s);t.fill=n,p?(t.stroke=n,t.strokeWidth=y):t.stroke="none"}}else{const e=a||wa;t.fill=e,p?(t.stroke=e,t.strokeWidth=y):t.stroke="none"}return t.fillOpacity=f,t},[i,s,a,f,p,y]),j=(0,Al.useMemo)(()=>il(_,{stroke:l,strokeWidth:c,opacity:u}),[_,l,c,u]);return{flattenedData:M,lineStyle:(0,Al.useMemo)(()=>ga(j,h??null,d),[j,h,d]),pointStyle:(0,Al.useMemo)(()=>{if(g)return e=>{const t={r:m,fillOpacity:1};return i?s&&(t.fill=Ne(e.parentLine||e,i,s)):t.fill=a||wa,t}},[g,m,i,s,a]),defaultTooltipContent:(0,Al.useMemo)(()=>_s([{label:v||ws(x),accessor:x,role:"x",format:w},{label:k||ws(b),accessor:b,role:"y",format:A},...S?[{label:ws(S),accessor:S,role:"group"}]:[],...Ms(e.band,A)]),[x,b,v,k,S,w,A,e.band])}}var Cl=require("react/jsx-runtime");function Ml(e,t){if(null==t)return e;const n=e.trim(),o=n.match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i);if(o){const e=o[1],n=3===e.length?e.split("").map(e=>e+e).join(""):e;return`rgba(${parseInt(n.slice(0,2),16)}, ${parseInt(n.slice(2,4),16)}, ${parseInt(n.slice(4,6),16)}, ${t})`}if(n.startsWith("rgba(")){const e=n.lastIndexOf(","),o=n.lastIndexOf(")");if(-1!==e&&o>e)return`${n.slice(0,e+1)} ${t})`}return n.startsWith("rgb(")?n.replace(/^rgb\(/,"rgba(").replace(/\)$/,`, ${t})`):e}var _l=(0,wl.forwardRef)(function(e,t){const n=(0,wl.useRef)(null);ll(t,{variant:"xy",frameRef:n});const o=Ba(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}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:u="y",areaBy:h,y0Accessor:d,gradientFill:f=!1,semanticGradient:p,lineDataAccessor:y="coordinates",colorBy:g,colorScheme:m,curve:x="monotoneX",areaOpacity:b=.7,lineGradient:v,showLine:k=!0,lineWidth:w=2,showPoints:A=!1,pointRadius:S=3,tooltip:C,annotations:M,forecast:_,anomaly:j,band:P,xExtent:L,yExtent:R,frameProps:I={},selection:N,linkedHover:F,onObservation:T,onClick:B,hoverHighlight:O,chartId:D,loading:z,loadingContent:H,emptyContent:E,legendInteraction:$,legendPosition:Y,color:G,stroke:q,strokeWidth:X,opacity:V}=e,{width:U,height:K,enableHover:Q,showGrid:Z,showLegend:J,title:ee,description:te,summary:ne,accessibleTable:oe,xLabel:re,yLabel:ie}=o,se=(0,wl.useMemo)(()=>W(r),[r]),ae=g||h,le=(0,wl.useMemo)(()=>{return p&&p.length>0?{colorStops:(e=p,e.filter(e=>Number.isFinite(e.at)).map(e=>({offset:1-Math.max(0,Math.min(100,e.at))/100,color:Ml(e.color,e.opacity)})).sort((e,t)=>e.offset-t.offset))}:f;var e},[p,f]);Ka("AreaChart",se,"xAccessor",c),Ka("AreaChart",se,"yAccessor",u);const ce=ol({data:se,rawData:r,colorBy:ae,colorScheme:m,legendInteraction:$,legendPosition:Y,selection:N,linkedHover:F,fallbackFields:ae?["string"==typeof ae?ae:""]:[],unwrapData:!1,onObservation:T,onClick:B,hoverHighlight:O,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"AreaChart",chartId:D,showLegend:J,userMargin:i,marginDefaults:o.marginDefaults,loading:z,loadingContent:H,emptyContent:E,width:U,height:K}),{effectiveData:ue,statisticalAnnotations:he}=xl({data:se,xAccessor:c,yAccessor:u,forecast:_,anomaly:j,groupBy:h}),{flattenedData:de,lineStyle:fe,pointStyle:pe,defaultTooltipContent:ye}=Sl({safeData:ue,data:r,areaBy:h,lineDataAccessor:y,colorBy:ae,colorScale:ce.colorScale,color:G,stroke:q,strokeWidth:X,opacity:V,effectiveSelectionHook:ce.effectiveSelectionHook,resolvedSelection:ce.resolvedSelection,areaOpacity:b,showLine:k,lineWidth:w,showPoints:A,pointRadius:S,xAccessor:c,yAccessor:u,xLabel:re,yLabel:ie,xFormat:a,yFormat:l,groupField:h||g,band:P}),ge=Ja({componentName:"AreaChart",data:r,accessors:{xAccessor:c,yAccessor:u}}),me={chartType:"area",...null!=r&&{data:de},xAccessor:c,yAccessor:u,groupAccessor:h||void 0,...d&&{y0Accessor:d},...P&&{band:P},...le&&{gradientFill:le},...v&&{lineGradient:v},curve:x,lineStyle:fe,...A&&pe&&{pointStyle:pe},size:[U,K],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ce.margin,showAxes:o.showAxes,xLabel:re,yLabel:ie,xFormat:a,yFormat:l,enableHover:Q,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:Z,...ce.legendBehaviorProps,...cl({title:ee,description:te,summary:ne,accessibleTable:oe,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),..."multi"===C?{tooltipContent:Li(),tooltipMode:"multi"}:hl({tooltip:C,defaultTooltipContent:ye}),...ul({linkedHover:F,selection:N,onObservation:T,onClick:B,hoverHighlight:O,mobileInteraction:ce.mobileInteraction,customHoverBehavior:ce.customHoverBehavior,customClickBehavior:ce.customClickBehavior}),...(M&&M.length>0||he.length>0)&&{annotations:[...M||[],...he]},...L&&{xExtent:L},...R&&{yExtent:R},...ce.crosshairProps,...I};return ce.earlyReturn?ce.earlyReturn:ge?(0,Cl.jsx)(Wa,{componentName:"AreaChart",message:ge,width:U,height:K}):(0,Cl.jsx)(Ga,{componentName:"AreaChart",width:U,height:K,children:(0,Cl.jsx)(Bs,{ref:n,...me})})});_l.displayName="AreaChart";var jl=require("react"),Pl=require("react/jsx-runtime");function Ll(e){if(null==e)return NaN;if("number"==typeof e)return e;if(e instanceof Date)return e.getTime();if("string"==typeof e){if(""===e.trim())return NaN;const t=+e;return Number.isFinite(t)?t:NaN}return NaN}var Rl=(0,jl.forwardRef)(function(e,t){const n=(0,jl.useRef)(null),o=Ba(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}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",seriesAAccessor:u="a",seriesBAccessor:h="b",seriesALabel:d="A",seriesBLabel:f="B",seriesAColor:p="var(--semiotic-danger, #dc2626)",seriesBColor:y="var(--semiotic-info, #2563eb)",showLines:g=!0,lineWidth:m=1.5,showPoints:x=!1,pointRadius:b=3,curve:v="linear",areaOpacity:k=.6,gradientFill:w,tooltip:A,annotations:S,xExtent:C,yExtent:M,frameProps:_={},selection:j,linkedHover:P,onObservation:L,onClick:R,hoverHighlight:I,chartId:N,loading:F,loadingContent:T,emptyContent:B,legendInteraction:O,legendPosition:D,pointIdAccessor:z,windowSize:H}=e,{width:E,height:$,enableHover:Y,showGrid:G,showLegend:q,title:X,description:V,summary:U,accessibleTable:K,xLabel:Q,yLabel:Z}=o,J=(0,jl.useMemo)(()=>"function"==typeof c?e=>Ll(c(e)):e=>Ll(e[c]),[c]),ee=(0,jl.useMemo)(()=>"function"==typeof u?e=>Ll(u(e)):e=>Ll(e[u]),[u]),te=(0,jl.useMemo)(()=>"function"==typeof h?e=>Ll(h(e)):e=>Ll(e[h]),[h]),[ne,oe]=(0,jl.useState)([]),re=(0,jl.useRef)([]),ie=null==r,se=(0,jl.useMemo)(()=>W(ie?ne:r),[ie,ne,r]),ae=(0,jl.useMemo)(()=>function(e,t,n,o){if(!e.length)return[];const r=e.filter(e=>Number.isFinite(t(e))).sort((e,n)=>t(e)-t(n)),i=[];let s=0,a=null,l=null,c=[];const u=(e,t)=>e>t?"A":t>e?"B":null,h=e=>`seg-${s}-${e}`,d=e=>i.push(e),f=(e,t)=>{d({__x:e.x,__y:e.y,__y0:e.y,__diffSegment:h(t),__diffWinner:t,__valA:e.y,__valB:e.y,__sourceDatum:e.datum})};for(let e=0;r.length>e;e++){const i=r[e],p=t(i),y=n(i),g=o(i);if(!Number.isFinite(p)||!Number.isFinite(y)||!Number.isFinite(g))continue;const m=u(y,g);if(null!==m)if(null!=a){if(l&&l.w!==m){let e,t;if(c.length>0)e=c[0].x,t=c[0].y;else{const n=y-l.a-(g-l.b);if(0!==n){const o=Math.max(0,Math.min(1,(l.b-l.a)/n));e=l.x+o*(p-l.x),t=l.a+o*(y-l.a)}else e=l.x,t=l.a}d({__x:e,__y:t,__y0:t,__diffSegment:h(a),__diffWinner:a,__valA:t,__valB:t}),s++,a=m,d({__x:e,__y:t,__y0:t,__diffSegment:h(a),__diffWinner:a,__valA:t,__valB:t});for(let e=1;c.length>e;e++)f(c[e],a)}else for(const e of c)f(e,a);c=[],d({__x:p,__y:g>y?g:y,__y0:g>y?y:g,__diffSegment:h(a),__diffWinner:a,__valA:y,__valB:g,__sourceDatum:i}),l={x:p,a:y,b:g,w:m}}else{a=m;for(const e of c)f(e,a);c=[],d({__x:p,__y:g>y?g:y,__y0:g>y?y:g,__diffSegment:h(a),__diffWinner:a,__valA:y,__valB:g,__sourceDatum:i}),l={x:p,a:y,b:g,w:m}}else c.push({x:p,y:y,datum:i})}for(const e of c)f(e,a??"A");return i}(se,J,ee,te),[se,J,ee,te]),le=(0,jl.useMemo)(()=>g?function(e,t,n,o){if(!e.length)return[];const r=e.filter(e=>Number.isFinite(t(e))).sort((e,n)=>t(e)-t(n)),i=[];for(const e of r){const r=t(e),s=n(e),a=o(e);Number.isFinite(s)&&i.push({__x:r,__y:s,__diffSegment:"line-A"}),Number.isFinite(a)&&i.push({__x:r,__y:a,__diffSegment:"line-B"})}return i}(se,J,ee,te):[],[g,se,J,ee,te]),ce=(0,jl.useMemo)(()=>[...ae,...le],[ae,le]),ue=(0,jl.useMemo)(()=>{const e=new Set;for(const t of ae)e.add(t.__diffSegment);return Array.from(e)},[ae]);(0,jl.useImperativeHandle)(t,()=>{const e=e=>{const t=H&&e.length>H?e.slice(e.length-H):e;re.current=t,oe(t)},t=z?"function"==typeof z?z:e=>e[z]:null;return{push:t=>e([...re.current,t]),pushMany:t=>e([...re.current,...t]),remove:n=>{if(!t)return[];const o=Array.isArray(n)?n:[n],r=[],i=[];for(const e of re.current)o.includes(t(e))?r.push(e):i.push(e);return e(i),r},update:(n,o)=>{if(!t)return[];const r=Array.isArray(n)?n:[n],i=[],s=re.current.map(e=>{if(r.includes(t(e))){const t=o(e);return i.push(t),t}return e});return e(s),i},clear:()=>e([]),getData:()=>ie?re.current:se,getScales:()=>n.current?.getScales()??null}},[ie,se,z,H]);const he=ol({data:se,rawData:r,colorBy:"__diffWinner",colorScheme:[p,y],legendInteraction:O,legendPosition:D,selection:j,linkedHover:P,fallbackFields:["__diffWinner"],unwrapData:!1,onObservation:L,onClick:R,hoverHighlight:I,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"DifferenceChart",chartId:N,showLegend:q,userMargin:i,marginDefaults:o.marginDefaults,loading:F,loadingContent:T,emptyContent:B,width:E,height:$}),de=(0,jl.useMemo)(()=>{if(!1!==q)return{legendGroups:[{label:"",type:"fill",styleFn:e=>({fill:e.color||"currentColor"}),items:[{label:d,color:p},{label:f,color:y}]}]}},[q,d,f,p,y]),fe=(0,jl.useCallback)(e=>{const t=e.__diffSegment;return{fill:"A"==(t?.endsWith("-A")?"A":"B")?p:y,stroke:"none",fillOpacity:k}},[p,y,k]),pe=(0,jl.useCallback)(e=>({stroke:"A"==("line-A"===e.__diffSegment?"A":"B")?p:y,strokeWidth:m,fill:"none"}),[p,y,m]),ye=(0,jl.useCallback)(e=>({fill:"A"==("line-A"===e.__diffSegment?"A":"B")?p:y,r:b}),[p,y,b]),ge=(0,jl.useCallback)(e=>{const t=e.data,n=e.allSeries,o=e.xValue??t?.__x;let r=t?.__valA,i=t?.__valB;if(n&&n.length>0){const e=n.find(e=>"line-A"===e.group),t=n.find(e=>"line-B"===e.group);null!=e?.value&&Number.isFinite(e.value)&&(r=e.value),null!=t?.value&&Number.isFinite(t.value)&&(i=t.value)}if(null!=o&&(null==r||null==i)){const e=se.find(e=>J(e)===o);e&&(null==r&&(r=ee(e)),null==i&&(i=te(e)))}const s=e=>null!=e&&Number.isFinite(e)?""+Math.round(100*e)/100:"—",l=a&&null!=o?a(o):null!=o?o+"":"";return(0,Pl.jsxs)("div",{className:"semiotic-tooltip",style:Mi,children:[l&&(0,Pl.jsx)("div",{style:{fontWeight:600,marginBottom:4},children:l}),(0,Pl.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6},children:[(0,Pl.jsx)("span",{style:{width:10,height:10,background:p,display:"inline-block",borderRadius:2}}),(0,Pl.jsxs)("span",{children:[d,": ",s(r)]})]}),(0,Pl.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6},children:[(0,Pl.jsx)("span",{style:{width:10,height:10,background:y,display:"inline-block",borderRadius:2}}),(0,Pl.jsxs)("span",{children:[f,": ",s(i)]})]}),null!=r&&null!=i&&Number.isFinite(r)&&Number.isFinite(i)&&(0,Pl.jsxs)("div",{style:{marginTop:4,opacity:.7},children:["Δ = ",s(r-i)]})]})},[se,J,ee,te,a,p,y,d,f]),me="multi"===A,xe=(0,jl.useMemo)(()=>!1===A?()=>null:me?ge:Ri(A)||ge,[A,me,ge]);if(he.earlyReturn)return he.earlyReturn;const be={chartType:"mixed",data:ce,xAccessor:"__x",yAccessor:"__y",y0Accessor:"__y0",groupAccessor:"__diffSegment",areaGroups:ue,curve:v,areaStyle:fe,lineStyle:pe,...x&&{pointStyle:ye},size:[E,$],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:he.margin,showAxes:o.showAxes,xLabel:Q,yLabel:Z,xFormat:a,yFormat:l,enableHover:Y,showGrid:G,...w&&{gradientFill:!0===w?{topOpacity:.85,bottomOpacity:.15}:w},...de&&{legend:de,legendPosition:he.legendPosition},...cl({title:X,description:V,summary:U,accessibleTable:K,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),tooltipContent:xe,...me&&{tooltipMode:"multi"},...ul({linkedHover:P,selection:j,onObservation:L,onClick:R,hoverHighlight:I,mobileInteraction:he.mobileInteraction,customHoverBehavior:he.customHoverBehavior,customClickBehavior:he.customClickBehavior}),...S&&S.length>0&&{annotations:S},...C&&{xExtent:C},...M&&{yExtent:M},...he.crosshairProps,..._};return(0,Pl.jsx)(Ga,{componentName:"DifferenceChart",width:E,height:$,children:(0,Pl.jsx)(Bs,{ref:n,...be})})});"function"==typeof Rl&&(Rl.displayName="DifferenceChart");var Il=require("react"),Nl=require("react/jsx-runtime"),Fl=(0,Il.forwardRef)(function(e,t){const n=(0,Il.useRef)(null),o=Ba(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}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:u="y",areaBy:h,lineDataAccessor:d="coordinates",colorBy:f,colorScheme:p,curve:y="monotoneX",areaOpacity:g=.7,showLine:m=!0,lineWidth:x=2,showPoints:b=!1,pointRadius:v=3,normalize:k=!1,baseline:w="zero",stackOrder:A,tooltip:S,annotations:C,xExtent:M,yExtent:_,frameProps:j={},selection:P,linkedHover:L,onObservation:R,onClick:I,hoverHighlight:N,chartId:F,loading:T,loadingContent:B,emptyContent:O,legendInteraction:D,legendPosition:z,color:H,stroke:E,strokeWidth:$,opacity:Y}=e,{width:G,height:q,enableHover:X,showGrid:V,showLegend:U,title:K,description:Q,summary:Z,accessibleTable:J,xLabel:ee,yLabel:te}=o,ne=(0,Il.useMemo)(()=>W(r),[r]),oe=f||h;ll(t,{variant:"xy",frameRef:n});const re=ol({data:ne,rawData:r,colorBy:oe,colorScheme:p,legendInteraction:D,legendPosition:z,selection:P,linkedHover:L,fallbackFields:oe?["string"==typeof oe?oe:""]:[],unwrapData:!1,onObservation:R,onClick:I,hoverHighlight:N,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"StackedAreaChart",chartId:F,showLegend:U,userMargin:i,marginDefaults:o.marginDefaults,loading:T,loadingContent:B,emptyContent:O,width:G,height:q}),{flattenedData:ie,lineStyle:se,pointStyle:ae,defaultTooltipContent:le}=Sl({safeData:ne,data:r,areaBy:h,lineDataAccessor:d,colorBy:oe,colorScale:re.colorScale,color:H,stroke:E,strokeWidth:$,opacity:Y,effectiveSelectionHook:re.effectiveSelectionHook,resolvedSelection:re.resolvedSelection,areaOpacity:g,showLine:m,lineWidth:x,showPoints:b,pointRadius:v,xAccessor:c,yAccessor:u,xLabel:ee,yLabel:te,xFormat:a,yFormat:l,groupField:h||f}),ce=Ja({componentName:"StackedAreaChart",data:r,accessors:{xAccessor:c,yAccessor:u}}),ue={chartType:"stackedarea",...null!=r&&{data:ie},xAccessor:c,yAccessor:u,groupAccessor:h||void 0,curve:y,normalize:k,baseline:k?"zero":w,stackOrder:A,lineStyle:se,...b&&ae&&{pointStyle:ae},size:[G,q],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:re.margin,showAxes:o.showAxes,xLabel:ee,yLabel:te,xFormat:a,yFormat:l,enableHover:X,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:V,...re.legendBehaviorProps,...cl({title:K,description:Q,summary:Z,accessibleTable:J,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),..."multi"===S?{tooltipContent:Li(),tooltipMode:"multi"}:hl({tooltip:S,defaultTooltipContent:le}),...ul({linkedHover:L,selection:P,onObservation:R,onClick:I,hoverHighlight:N,mobileInteraction:re.mobileInteraction,customHoverBehavior:re.customHoverBehavior,customClickBehavior:re.customClickBehavior}),...C&&C.length>0&&{annotations:C},...M&&{xExtent:M},..._&&{yExtent:_},...re.crosshairProps,...j};return re.earlyReturn?re.earlyReturn:ce?(0,Nl.jsx)(Wa,{componentName:"StackedAreaChart",message:ce,width:G,height:q}):(0,Nl.jsx)(Ga,{componentName:"StackedAreaChart",width:G,height:q,children:(0,Nl.jsx)(Bs,{ref:n,...ue})})});Fl.displayName="StackedAreaChart";var Tl=c(require("react")),Bl=require("react"),Ol=require("react");function Dl(e){const{colorBy:t,colorScale:n,color:o,pointRadius:r=5,radiusFn:i,fillOpacity:s=1,fallbackFill:a,baseStyleExtras:l,stroke:c,strokeWidth:u,opacity:h,effectiveSelectionHook:d,resolvedSelection:f,colorDatumAccessor:p}=e,y=(0,Ol.useMemo)(()=>e=>{const c="function"==typeof l?l(e):l,u=c?{...c}:{};if(void 0===u.fillOpacity&&(u.fillOpacity=s),void 0===u.fill)if(t){if(n){const o=p?p(e):e;u.fill=Ne(o,t,n)}}else u.fill=a?a(e):o||wa;return void 0===u.r&&(u.r=i?i(e):r),u},[t,n,o,r,i,s,a,l,p]),g=(0,Ol.useMemo)(()=>il(y,{stroke:c,strokeWidth:u,opacity:h}),[y,c,u,h]);return(0,Ol.useMemo)(()=>ga(g,d??null,f),[g,d,f])}var Wl=require("react");function zl(e){const{accessor:t,data:n,isPushMode:o}=e,r=(0,Wl.useRef)(null),[i,s]=(0,Wl.useState)(0),a=(0,Wl.useCallback)(e=>{if(!o||!t)return;let n=!1;for(const o of e){const e="function"==typeof t?t(o):o[t];if(null==e)continue;const i="number"==typeof e?e:Number(e);Number.isFinite(i)&&(r.current?(r.current[0]>i&&(r.current[0]=i,n=!0),i>r.current[1]&&(r.current[1]=i,n=!0)):(r.current=[i,i],n=!0))}n&&s(e=>e+1)},[o,t]),l=(0,Wl.useCallback)(()=>{o&&(r.current=null,s(e=>e+1))},[o]);return{domain:(0,Wl.useMemo)(()=>{if(o)return r.current??void 0;if(!t||0===n.length)return;const e="function"==typeof t?t:e=>e[t];let i=1/0,s=-1/0;for(const t of n){const n=e(t);if(null==n)continue;const o="number"==typeof n?n:Number(n);Number.isFinite(o)&&(i>o&&(i=o),o>s&&(s=o))}return Number.isFinite(i)&&Number.isFinite(s)?[i,s]:void 0},[n,t,o,i]),trackPushed:a,reset:l}}function Hl(e){if(!e)return;const t="boolean"==typeof e?{}:"string"==typeof e?{method:e}:e;return{type:"trend",method:t.method??"linear",...null!=t.bandwidth&&{bandwidth:t.bandwidth},...null!=t.order&&{order:t.order},...null!=t.color&&{color:t.color},...null!=t.strokeWidth&&{strokeWidth:t.strokeWidth},...null!=t.strokeDasharray&&{strokeDasharray:t.strokeDasharray},...null!=t.label&&{label:t.label}}}var El=require("react/jsx-runtime"),$l=(0,Bl.forwardRef)(function(e,t){const n=(0,Bl.useRef)(null),o=Ba(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}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:u="y",xScaleType:h,yScaleType:d,colorBy:f,colorScheme:p,sizeBy:y,sizeRange:g=[3,15],symbolBy:m,symbolMap:x,pointRadius:b=5,pointOpacity:v=.8,tooltip:k,marginalGraphics:w,pointIdAccessor:A,annotations:S,regression:C,forecast:M,anomaly:_,xExtent:j,yExtent:P,frameProps:L={},selection:R,linkedHover:I,linkedBrush:N,onObservation:F,onClick:T,hoverHighlight:B,chartId:O,loading:D,loadingContent:z,emptyContent:H,legendInteraction:E,legendPosition:$,color:Y,stroke:G,strokeWidth:q,opacity:X}=e,{width:V,height:U,enableHover:K,showGrid:Q,showLegend:Z,title:J,description:ee,summary:te,accessibleTable:ne,xLabel:oe,yLabel:re}=o,ie=(0,Bl.useMemo)(()=>W(r),[r]),se=void 0===r,{domain:ae,trackPushed:le,reset:ce}=zl({accessor:y,data:ie,isPushMode:se}),ue=(0,Bl.useCallback)(e=>{le([e]),n.current?.push(e)},[le]),he=(0,Bl.useCallback)(e=>{le(e),n.current?.pushMany(e)},[le]);ll(t,{variant:"xy",frameRef:n,overrides:{push:ue,pushMany:he,clear:()=>{ce(),n.current?.clear()}},deps:[ue,he,ce]});const de=ol({data:ie,rawData:r,colorBy:f,colorScheme:p,legendInteraction:E,legendPosition:$,selection:R,linkedHover:I,fallbackFields:f?["string"==typeof f?f:""]:[],unwrapData:!1,onObservation:F,onClick:T,hoverHighlight:B,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"Scatterplot",chartId:O,showLegend:Z,userMargin:i,marginDefaults:o.marginDefaults,loading:D,loadingContent:z,emptyContent:H,width:V,height:U}),fe=pa(N),pe=ta({name:fe?.name||"__unused_brush__",xField:fe?.xField||("string"==typeof c?c:void 0),yField:fe?.yField||("string"==typeof u?u:void 0)}),ye=fe?"xyBrush"===pe.brushInteraction.brush?"xy":"xBrush"===pe.brushInteraction.brush?"x":"y":void 0,ge=Tl.useRef(pe.brushInteraction);ge.current=pe.brushInteraction;const me=(0,Bl.useCallback)(e=>{const t=ge.current;t.end(e?"xyBrush"===t.brush?[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:"xBrush"===t.brush?e.x:e.y:null)},[]);Ka("Scatterplot",ie,"xAccessor",c),Ka("Scatterplot",ie,"yAccessor",u);const xe=(0,Bl.useMemo)(()=>y?ae??[0,1]:void 0,[y,ae]),be=(0,Bl.useMemo)(()=>y?e=>Be(e,y,g,xe):void 0,[y,g,xe]),ve=Dl({colorBy:f,colorScale:de.colorScale,color:Y,pointRadius:b,fillOpacity:v,radiusFn:be,stroke:G,strokeWidth:q,opacity:X,effectiveSelectionHook:de.effectiveSelectionHook,resolvedSelection:de.resolvedSelection}),ke=(0,Bl.useMemo)(()=>_s([{label:oe||ws(c),accessor:c,role:"x",format:a},{label:re||ws(u),accessor:u,role:"y",format:l},...f?[{label:ws(f),accessor:f,role:"color"}]:[],...y?[{label:ws(y),accessor:y,role:"size"}]:[]]),[c,u,oe,re,f,y,a,l]),{effectiveData:we,statisticalAnnotations:Ae}=xl({data:ie,xAccessor:c,yAccessor:u,forecast:M,anomaly:_}),Se=(0,Bl.useMemo)(()=>{const e=Hl(C);return e||0!==Ae.length?[...e?[e]:[],...S||[],...Ae]:S},[C,S,Ae]);if(de.earlyReturn)return de.earlyReturn;const Ce=Ja({componentName:"Scatterplot",data:r,accessors:{xAccessor:c,yAccessor:u}});if(Ce)return(0,El.jsx)(Wa,{componentName:"Scatterplot",message:Ce,width:V,height:U});const Me={chartType:"scatter",...null!=r&&{data:we},xAccessor:c,yAccessor:u,xScaleType:h,yScaleType:d,colorAccessor:f||void 0,sizeAccessor:y||void 0,...m&&{symbolAccessor:m},...x&&{symbolMap:x},sizeRange:g,pointStyle:ve,colorScheme:p,size:[V,U],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:de.margin,showAxes:o.showAxes,xLabel:oe,yLabel:re,xFormat:a,yFormat:l,enableHover:K,showGrid:Q,...de.legendBehaviorProps,...cl({title:J,description:ee,summary:te,accessibleTable:ne,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...hl({tooltip:k,defaultTooltipContent:ke}),...ul({linkedHover:I,selection:R,onObservation:F,onClick:T,hoverHighlight:B,mobileInteraction:de.mobileInteraction,customHoverBehavior:de.customHoverBehavior,customClickBehavior:de.customClickBehavior}),...w&&{marginalGraphics:w},...A&&{pointIdAccessor:A},...Se&&Se.length>0&&{annotations:Se},...j&&{xExtent:j},...P&&{yExtent:P},...fe&&{brush:{dimension:ye},onBrush:me},...de.crosshairProps,...L};return(0,El.jsx)(Ga,{componentName:"Scatterplot",width:V,height:U,children:(0,El.jsx)(Bs,{ref:n,...Me})})});$l.displayName="Scatterplot";var Yl=require("react"),Gl=require("react/jsx-runtime");function ql(e,t){return ke(1===t?.5:e/(t-1))}var Xl=(0,Yl.forwardRef)(function(e,t){const n=(0,Yl.useRef)(null);ll(t,{variant:"xy",frameRef:n});const o=Ba(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:u="y",orderAccessor:h,orderLabel:d,pointRadius:f=4,tooltip:p,pointIdAccessor:y,annotations:g,regression:m,forecast:x,anomaly:b,xExtent:v,yExtent:k,frameProps:w={},selection:A,linkedHover:S,onObservation:C,onClick:M,hoverHighlight:_,chartId:j,loading:P,loadingContent:L,emptyContent:R,legendInteraction:I,stroke:N,strokeWidth:F,opacity:T}=e,{width:B,height:O,enableHover:D,showGrid:W,title:z,description:H,summary:E,accessibleTable:$,xLabel:Y,yLabel:G}=o,q=r||[],{safeData:X,orderMap:V}=(0,Yl.useMemo)(()=>{const e="function"==typeof c?c:e=>e[c],t="function"==typeof u?u:e=>e[u];let n=q;if(h&&q.length>0){const e="function"==typeof h?h:e=>e[h];n=[...q].sort((t,n)=>{const o=e(t),r=e(n);return(o instanceof Date?o.getTime():+o)-(r instanceof Date?r.getTime():+r)})}const o=new WeakMap;let r=0;for(const o of n){const n=e(o),i=t(o);null!=n&&null!=i&&isFinite(n)&&isFinite(i)&&r++}let i=0;for(const s of n){const n=e(s),a=t(s);null!=n&&null!=a&&isFinite(n)&&isFinite(a)&&o.set(s,{idx:i++,total:r})}return{safeData:n,orderMap:o}},[q,h,c,u]);Ka("ConnectedScatterplot",X,"xAccessor",c),Ka("ConnectedScatterplot",X,"yAccessor",u);const U=ol({data:X,rawData:r,colorBy:void 0,colorScheme:void 0,legendInteraction:I,selection:A,linkedHover:S,fallbackFields:[],unwrapData:!1,onObservation:C,onClick:M,hoverHighlight:_,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"ConnectedScatterplot",chartId:j,showLegend:void 0,userMargin:i,marginDefaults:{top:50,right:40,bottom:60,left:70},loading:P,loadingContent:L,emptyContent:R,width:B,height:O}),K=U.resolvedSelection?.unselectedOpacity??ya,Q=(0,Yl.useMemo)(()=>(e,t)=>{const n=t.filter(e=>"point"===e.type);if(2>n.length)return;const o=U.effectiveSelectionHook?.isActive,r=U.effectiveSelectionHook?.predicate,i=100>n.length,s=n.length;e.lineCap="round";for(let t=0;s-1>t;t++){const a=n[t],l=n[t+1],c=ql(t,s),u=!o||!r||r(a.datum??a)||r(l.datum??l),h=o?u?1:K:1;i&&(e.beginPath(),e.moveTo(a.x,a.y),e.lineTo(l.x,l.y),e.strokeStyle="white",e.lineWidth=f+2,e.globalAlpha=.5*h,e.stroke()),e.beginPath(),e.moveTo(a.x,a.y),e.lineTo(l.x,l.y),e.strokeStyle=c,e.lineWidth=f,e.globalAlpha=h,e.stroke()}e.globalAlpha=1},[f,U.effectiveSelectionHook,K]),Z=(0,Yl.useMemo)(()=>[Q],[Q]),J=(0,Yl.useMemo)(()=>(e,t,n)=>{const o=e.filter(e=>"point"===e.type);if(2>o.length)return null;const r=o.length,i=100>r,s=[];for(let e=0;r-1>e;e++){const t=o[e],n=o[e+1],a=ql(e,r),l=Math.min("number"==typeof t.style?.opacity?t.style.opacity:1,"number"==typeof n.style?.opacity?n.style.opacity:1);i&&s.push((0,Gl.jsx)("line",{x1:t.x,y1:t.y,x2:n.x,y2:n.y,stroke:"white",strokeWidth:f+2,strokeLinecap:"round",opacity:.5*l},"halo-"+e)),s.push((0,Gl.jsx)("line",{x1:t.x,y1:t.y,x2:n.x,y2:n.y,stroke:a,strokeWidth:f,strokeLinecap:"round",opacity:l},"seg-"+e))}return(0,Gl.jsx)(Gl.Fragment,{children:s})},[f]),ee=(0,Yl.useMemo)(()=>[J],[J]),te=Dl({colorScale:void 0,baseStyleExtras:(0,Yl.useMemo)(()=>e=>{const t=V.get(e),n=t?.idx??0,o=t?.total??1;return{fill:o>0?ql(n,o):"#6366f1",stroke:"white",strokeWidth:1,r:f,fillOpacity:1}},[f,V]),stroke:N,strokeWidth:F,opacity:T,effectiveSelectionHook:U.effectiveSelectionHook,resolvedSelection:U.resolvedSelection}),ne=d||("string"==typeof h?h:"Order"),oe=(0,Yl.useMemo)(()=>_s([{label:Y||ws(c),accessor:c,role:"x",format:a},{label:G||ws(u),accessor:u,role:"y",format:l},...h?[{label:ne,accessor:h,role:"group"}]:[]]),[c,u,Y,G,h,ne,a,l]),re=Ja({componentName:"ConnectedScatterplot",data:r,accessors:{xAccessor:c,yAccessor:u}}),{effectiveData:ie,statisticalAnnotations:se}=xl({data:X,xAccessor:c,yAccessor:u,forecast:x,anomaly:b});if(U.earlyReturn)return U.earlyReturn;const ae=Hl(m),le=ae||se.length>0?[...ae?[ae]:[],...g||[],...se]:g,ce={chartType:"scatter",...null!=r&&{data:ie},xAccessor:c,yAccessor:u,pointStyle:te,size:[B,O],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:U.margin,showAxes:o.showAxes,xLabel:Y,yLabel:G,xFormat:a,yFormat:l,enableHover:D,showGrid:W,...cl({title:z,description:H,summary:E,accessibleTable:$,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...hl({tooltip:p,defaultTooltipContent:oe}),...ul({linkedHover:S,selection:A,onObservation:C,onClick:M,hoverHighlight:_,mobileInteraction:U.mobileInteraction,customHoverBehavior:U.customHoverBehavior,customClickBehavior:U.customClickBehavior}),...y&&{pointIdAccessor:y},canvasPreRenderers:Z,svgPreRenderers:ee,...le&&le.length>0&&{annotations:le},...v&&{xExtent:v},...k&&{yExtent:k},...U.crosshairProps,...w};return re?(0,Gl.jsx)(Wa,{componentName:"ConnectedScatterplot",message:re,width:B,height:O}):(0,Gl.jsx)(Ga,{componentName:"ConnectedScatterplot",width:B,height:O,children:(0,Gl.jsx)(Bs,{ref:n,...ce})})});Xl.displayName="ConnectedScatterplot";var Vl=require("react"),Ul=require("react/jsx-runtime"),Kl=(0,Vl.forwardRef)(function(e,t){const n=(0,Vl.useRef)(null),o=Ba(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}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:u="y",sizeBy:h,sizeRange:d=[5,40],colorBy:f,colorScheme:p,bubbleOpacity:y=.6,bubbleStrokeWidth:g=1,bubbleStrokeColor:m="white",tooltip:x,marginalGraphics:b,pointIdAccessor:v,annotations:k,regression:w,xExtent:A,yExtent:S,frameProps:C={},selection:M,linkedHover:_,linkedBrush:j,onObservation:P,onClick:L,hoverHighlight:R,chartId:I,loading:N,loadingContent:F,emptyContent:T,legendInteraction:B,legendPosition:O,color:D,stroke:z,strokeWidth:H,opacity:E}=e,{width:$,height:Y,enableHover:G,showGrid:q,showLegend:X,title:V,description:U,summary:K,accessibleTable:Q,xLabel:Z,yLabel:J}=o,ee=(0,Vl.useMemo)(()=>W(r),[r]),te=void 0===r,ne=ol({data:ee,rawData:r,colorBy:f,colorScheme:p,legendInteraction:B,legendPosition:O,selection:M,linkedHover:_,fallbackFields:f?["string"==typeof f?f:""]:[],unwrapData:!1,onObservation:P,onClick:L,hoverHighlight:R,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"BubbleChart",chartId:I,showLegend:X,userMargin:i,marginDefaults:o.marginDefaults,loading:N,loadingContent:F,emptyContent:T,width:$,height:Y}),{domain:oe,trackPushed:re,reset:ie}=zl({accessor:h,data:ee,isPushMode:te}),se=(0,Vl.useCallback)(e=>{re([e]),n.current?.push(e)},[re]),ae=(0,Vl.useCallback)(e=>{re(e),n.current?.pushMany(e)},[re]);ll(t,{variant:"xy",frameRef:n,overrides:{push:se,pushMany:ae,clear:()=>{ie(),n.current?.clear()}},deps:[se,ae,ie]});const le=pa(j),ce=(ta({name:le?.name||"__unused_brush__",xField:le?.xField||("string"==typeof c?c:void 0),yField:le?.yField||("string"==typeof u?u:void 0)}),(0,Vl.useMemo)(()=>({stroke:m,strokeWidth:g}),[m,g])),ue=(0,Vl.useMemo)(()=>oe??[0,1],[oe]),he=(0,Vl.useCallback)(e=>Be(e,h,d,ue),[h,d,ue]),de=Dl({colorBy:f,colorScale:ne.colorScale,color:D,fillOpacity:y,radiusFn:he,baseStyleExtras:ce,stroke:z,strokeWidth:H,opacity:E,effectiveSelectionHook:ne.effectiveSelectionHook,resolvedSelection:ne.resolvedSelection}),fe=(0,Vl.useMemo)(()=>_s([{label:Z||ws(c),accessor:c,role:"x",format:a},{label:J||ws(u),accessor:u,role:"y",format:l},{label:ws(h),accessor:h,role:"size"},...f?[{label:ws(f),accessor:f,role:"color"}]:[]]),[c,u,Z,J,h,f,a,l]);if(ne.earlyReturn)return ne.earlyReturn;const pe=Ja({componentName:"BubbleChart",data:r,accessors:{xAccessor:c,yAccessor:u},requiredProps:{sizeBy:h}});if(pe)return(0,Ul.jsx)(Wa,{componentName:"BubbleChart",message:pe,width:$,height:Y});const ye=Hl(w),ge=ye?[ye,...k||[]]:k,me={chartType:"bubble",...null!=r&&{data:ee},xAccessor:c,yAccessor:u,colorAccessor:f||void 0,sizeAccessor:h,sizeRange:d,pointStyle:de,colorScheme:p,size:[$,Y],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ne.margin,showAxes:o.showAxes,xLabel:Z,yLabel:J,xFormat:a,yFormat:l,enableHover:G,showGrid:q,...ne.legendBehaviorProps,...cl({title:V,description:U,summary:K,accessibleTable:Q,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...hl({tooltip:x,defaultTooltipContent:fe}),...ul({linkedHover:_,selection:M,onObservation:P,onClick:L,hoverHighlight:R,mobileInteraction:ne.mobileInteraction,customHoverBehavior:ne.customHoverBehavior,customClickBehavior:ne.customClickBehavior}),...b&&{marginalGraphics:b},...v&&{pointIdAccessor:v},...ge&&ge.length>0&&{annotations:ge},...A&&{xExtent:A},...S&&{yExtent:S},...ne.crosshairProps,...C};return(0,Ul.jsx)(Ga,{componentName:"BubbleChart",width:$,height:Y,children:(0,Ul.jsx)(Bs,{ref:n,...me})})});Kl.displayName="BubbleChart";var Ql=require("react"),Zl=require("d3-scale");d();var Jl=require("react/jsx-runtime"),ec=(0,Ql.forwardRef)(function(e,t){const n=(0,Ql.useRef)(null);ll(t,{variant:"xy",frameRef:n});const o=Ba(e.mode,{width:e.width,height:e.height,showGrid:void 0,enableHover:e.enableHover,showLegend:void 0,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xAccessor:a="x",yAccessor:l="y",valueAccessor:c="value",xFormat:h,yFormat:d,colorScheme:f,customColorScale:p,showValues:y=!1,valueFormat:g,cellBorderColor:m="#fff",cellBorderWidth:x=1,tooltip:b,annotations:v,xExtent:k,yExtent:w,frameProps:A={},selection:S,linkedHover:C,onObservation:M,onClick:_,hoverHighlight:j,chartId:P,loading:L,loadingContent:R,emptyContent:I,showLegend:N,legendPosition:F,legendInteraction:T}=e,{width:B,height:O,enableHover:D,title:z,description:H,summary:E,accessibleTable:$,xLabel:Y,yLabel:G}=o,q=Ua(L,B,O,R),X=q?null:Va(r,B,O,I),V=(0,Ql.useMemo)(()=>W(r),[r]),U=function(){const e=xa();return e?.colors?.sequential||void 0}(),K=f??U??"blues",Q=N??!1,Z=F??"right",{margin:J}=Na({data:V,colorBy:Q?"value":void 0,colorScale:void 0,showLegend:Q,legendPosition:Z,userMargin:i,defaults:o.marginDefaults}),{customHoverBehavior:ee,customClickBehavior:te,crosshairSourceId:ne}=Ra({selection:S,linkedHover:C,fallbackFields:[],onObservation:M,onClick:_,chartType:"Heatmap",chartId:P,hoverHighlight:j,colorByField:void 0,mobileInteraction:o.mobileInteraction});nl(S);const oe=Ia(C,ne);Fa(T,void 0,[]);const re=(0,Ql.useMemo)(()=>"function"==typeof c?e=>c(e):e=>e[c],[c]),ie=(0,Ql.useMemo)(()=>u(V.map(re)),[V,re]),se=(0,Ql.useMemo)(()=>{if("custom"===K&&p)return p;const e=je(K);return(0,Zl.scaleSequential)(e).domain(ie)},[K,p,ie]),ae=(0,Ql.useMemo)(()=>_s([{label:Y||ws(a),accessor:a,role:"x",format:h},{label:G||ws(l),accessor:l,role:"y",format:d},{label:ws(c),accessor:c,role:"value",format:g}]),[a,l,Y,G,c,h,d,g]),le=Ja({componentName:"Heatmap",data:r,accessors:{xAccessor:a,yAccessor:l,valueAccessor:c}}),ce=(0,Ql.useMemo)(()=>{if(Q)return{gradient:{colorFn:e=>se(e),domain:ie,label:"string"==typeof c?c:"value",format:g}}},[Q,se,ie,c,g]),ue={chartType:"heatmap",...null!=r&&{data:V},xAccessor:a,yAccessor:l,valueAccessor:c,colorScheme:"custom"!==K?K:void 0,showValues:y,heatmapValueFormat:g,size:[B,O],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:J,showAxes:o.showAxes,xLabel:Y,yLabel:G,xFormat:h,yFormat:d,enableHover:D,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...ce&&{legend:ce,legendPosition:Z},...cl({title:z,description:H,summary:E,accessibleTable:$,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...hl({tooltip:b,defaultTooltipContent:ae}),...ul({linkedHover:C,selection:S,onObservation:M,onClick:_,hoverHighlight:j,mobileInteraction:o.mobileInteraction,customHoverBehavior:ee,customClickBehavior:te}),...v&&v.length>0&&{annotations:v},...k&&{xExtent:k},...w&&{yExtent:w},...oe,...A};return q||X||(le?(0,Jl.jsx)(Wa,{componentName:"Heatmap",message:le,width:B,height:O}):(0,Jl.jsx)(Ga,{componentName:"Heatmap",width:B,height:O,children:(0,Jl.jsx)(Bs,{ref:n,...ue})}))});ec.displayName="Heatmap";var tc=c(require("react")),nc=require("react"),oc=require("d3-brush"),rc=require("d3-selection");d();var ic=require("react/jsx-runtime"),sc="__splomIdx",ac="splom-hover-source",lc={top:4,bottom:4,left:4,right:4};function cc({frameRef:e,cellSize:t,onBrush:n}){const o=(0,nc.useRef)(null),r=t-lc.left-lc.right,i=t-lc.top-lc.bottom;return(0,nc.useEffect)(()=>{if(!o.current)return;const t=(0,rc.select)(o.current).select(".brush-g"),s=(0,oc.brush)().extent([[0,0],[r,i]]).on("brush end",t=>{const o=e.current?.getScales();if(!o)return;if(!t.selection)return void n(null);const[[r,i],[s,a]]=t.selection,l=[[o.x.invert(r),o.y.invert(i)],[o.x.invert(s),o.y.invert(a)]];n(l)});return t.call(s),t.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{s.on("brush end",null)}},[r,i,e,n]),(0,ic.jsx)("svg",{ref:o,width:t,height:t,style:{position:"absolute",top:0,left:0},children:(0,ic.jsx)("g",{className:"brush-g",transform:`translate(${lc.left},${lc.top})`})})}function uc({data:e,xField:t,yField:n,cellSize:o,pointRadius:r,pointOpacity:i,colorBy:s,colorScale:a,brushSelectionName:l,hoverSelectionName:c,unselectedOpacity:u,mobileInteraction:h,mode:d,onPointHover:f,onPointClick:p}){const y=(0,nc.useRef)(null),g=Js({name:l,clientId:`splom-${t}-${n}`,fields:[t,n]}),m=ta({name:l,xField:t,yField:n}),x=Js({name:c,clientId:ac,fields:[sc]}),b=x.selectPoints,v=(0,nc.useCallback)(e=>{e?m.brushInteraction.during(e):m.brushInteraction.end(null)},[m.brushInteraction]),k=(0,nc.useCallback)(e=>{if(!e)return void f?.(null);const t=e.data,n=t?.[sc];void 0!==n&&(b({[sc]:[n]}),f?.(t,e.x+lc.left,e.y+lc.top))},[b,f]),w=(0,nc.useCallback)(e=>{if(!e)return void p?.(null);const t=e.data;t&&p?.(t,e.x+lc.left,e.y+lc.top)},[p]),A=(0,nc.useCallback)(e=>{const t={opacity:i,r:r};return t.fill=s?Ne(e,s,a):wa,"hover"===d?x.isActive&&x.predicate(e)?(t.opacity=1,t.r=2.5*r,t.stroke="#333",t.strokeWidth=1.5):x.isActive&&(t.opacity=.6*i):g.isActive&&!g.predicate(e)&&(t.opacity=u),t},[s,a,i,r,d,g.isActive,g.predicate,x.isActive,x.predicate,u]);return(0,ic.jsxs)("div",{style:{position:"relative",width:o,height:o},children:[(0,ic.jsx)(Bs,{ref:y,chartType:"scatter",data:e,size:[o,o],xAccessor:t,yAccessor:n,pointStyle:A,margin:lc,showAxes:!1,enableHover:"hover"===d,...ul({forceHoverBehavior:"hover"===d,forceClickBehavior:!!p,mobileInteraction:h,customHoverBehavior:k,customClickBehavior:w}),tooltipContent:"hover"===d?()=>null:void 0}),"brush"===d&&(0,ic.jsx)(cc,{frameRef:y,cellSize:o,xField:t,yField:n,onBrush:v})]})}function hc({data:e,field:t,label:n,cellSize:o,bins:r,colorBy:i,colorScale:s,brushSelectionName:a,hoverSelectionName:l,mode:c}){const d=Js({name:a,clientId:"splom-diag-"+t,fields:[t]}),f=Js({name:l,clientId:`splom-diag-${t}-hover`,fields:[sc]}),p="hover"===c?f:d,y=p.isActive,g=p.predicate,m=(0,nc.useMemo)(()=>{const n="string"==typeof i?i:null,s=[],a=new Set;for(const o of e){const e=o[t];if(null==e||isNaN(e)||s.push(Number(e)),n){const e=o[n];null!=e&&a.add(e+"")}}if(0===s.length)return{bars:[],selectedBars:[],categoryBars:[],selectedCategoryBars:[],max:0,categories:[]};const[l,c]=u(s),d=(c-l)/r||1,f=Array.from(a),p=new Map(f.map((e,t)=>[e,t])),m=Array(r).fill(0),x=Array(r).fill(0),b=Array.from({length:r},()=>Array(f.length).fill(0)),v=Array.from({length:r},()=>Array(f.length).fill(0));for(const o of e){const e=o[t];if(null==e||isNaN(e))continue;const i=Math.min(Math.floor((e-l)/d),r-1);if(m[i]++,y&&!g(o)||x[i]++,n){const e=p.get(o[n]+"");void 0!==e&&(b[i][e]++,y&&!g(o)||v[i][e]++)}}const k=h(m,1),w=b.map((e,t)=>{let n=0;return e.map((e,i)=>{const s=e/k*(o-24),a={x:t/r*o,w:o/r-1,h:s,y0:n,category:f[i]};return n+=s,a})}),A=v.map((e,t)=>{let n=0;return e.map((e,i)=>{const s=e/k*(o-24),a={x:t/r*o,w:o/r-1,h:s,y0:n,category:f[i]};return n+=s,a})});return{bars:m.map((e,t)=>({x:t/r*o,w:o/r-1,h:e/k*(o-24),count:e})),selectedBars:x.map((e,t)=>({x:t/r*o,w:o/r-1,h:e/k*(o-24),count:e})),categoryBars:w,selectedCategoryBars:A,max:k,categories:f}},[e,t,r,o,y,g,i]);return(0,ic.jsxs)("svg",{width:o,height:o,style:{overflow:"hidden"},children:[(0,ic.jsx)("text",{x:o/2,y:14,textAnchor:"middle",fontSize:11,fontWeight:"bold",fill:"#333",children:n}),m.categories.length>0?m.categoryBars.map((e,t)=>e.map((e,n)=>(0,ic.jsx)("rect",{x:e.x,y:o-e.y0-e.h,width:Math.max(e.w,1),height:e.h,fill:s?s(e.category):wa,opacity:y?.3:.6},`bg-${t}-${n}`))):m.bars.map((e,t)=>(0,ic.jsx)("rect",{x:e.x,y:o-e.h,width:Math.max(e.w,1),height:e.h,fill:wa,opacity:y?.3:.6},"bg-"+t)),y&&(m.categories.length>0?m.selectedCategoryBars.map((e,t)=>e.map((e,n)=>(0,ic.jsx)("rect",{x:e.x,y:o-e.y0-e.h,width:Math.max(e.w,1),height:e.h,fill:s?s(e.category):wa,opacity:.7},`sel-${t}-${n}`))):m.selectedBars.map((e,t)=>(0,ic.jsx)("rect",{x:e.x,y:o-e.h,width:Math.max(e.w,1),height:e.h,fill:wa,opacity:.7},"sel-"+t)))]})}function dc({label:e,cellSize:t}){return(0,ic.jsx)("svg",{width:t,height:t,children:(0,ic.jsx)("text",{x:t/2,y:t/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:12,fontWeight:"bold",fill:"#333",children:e})})}function fc(e){const{data:t,fields:n,fieldLabels:o={},colorBy:r,colorScheme:i,cellSize:s=150,cellGap:a=4,pointRadius:l=2,pointOpacity:c=.5,diagonal:u="histogram",histogramBins:h=20,brushMode:d="crossfilter",hoverMode:f=!0,unselectedOpacity:p=.1,showGrid:y=!1,tooltip:g,showLegend:m,idAccessor:x,width:b,className:v,onObservation:k,onClick:w,chartId:A}=e,S="splom",C="splom-hover",M=ja(e.mobileInteraction,{mode:e.mode,width:b??n.length*s,mobileSemantics:e.mobileSemantics}),_=f?"hover":d?"brush":"hover",j=Us(e=>e.clearSelection),[P,L]=(0,nc.useState)(null),R=(0,nc.useCallback)(()=>{j(C),L(null)},[j,C]),I=(0,nc.useMemo)(()=>(t||[]).map((e,t)=>void 0!==e[sc]?e:{...e,[sc]:t}),[t]),N=La(I,r,i),F=(0,nc.useCallback)((e,t,n,o)=>[40+e*(s+a)+(n??0),t*(s+a)+(o??0)],[40,s,a]),T=void 0!==m?m:!!r,B=(0,nc.useMemo)(()=>{if(!T||!r)return null;const e="string"==typeof r?r:null;return e?Array.from(new Set(I.map(t=>t[e]).filter(e=>null!=e))).map(e=>({label:e+"",color:N?N(e+""):wa})):null},[T,r,I,N]),O=(0,nc.useMemo)(()=>({display:"grid",gridTemplateColumns:"40px "+n.map(()=>s+"px").join(" "),gridTemplateRows:n.map(()=>s+"px").join(" ")+" 40px",gap:a+"px",width:"fit-content"}),[n,s,a,40]);return(0,ic.jsxs)("div",{className:v,style:{position:"relative"},children:[B&&(0,ic.jsx)("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"},children:B.map(e=>(0,ic.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4},children:[(0,ic.jsx)("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",backgroundColor:e.color}}),(0,ic.jsx)("span",{style:{fontSize:11},children:e.label})]},e.label))}),(0,ic.jsxs)("div",{style:O,onMouseLeave:"hover"===_?R:void 0,children:[n.map((e,t)=>(0,ic.jsxs)(tc.Fragment,{children:[(0,ic.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:11,fontWeight:"bold",color:"#333"},children:o[e]||e}),n.map((n,i)=>t===i?"label"===u?(0,ic.jsx)(dc,{label:o[e]||e,cellSize:s},"diag-"+e):(0,ic.jsx)(hc,{data:I,field:e,label:o[e]||e,cellSize:s,bins:h,colorBy:r,colorScale:N,brushSelectionName:S,hoverSelectionName:C,unselectedOpacity:p,mode:_},"diag-"+e):(0,ic.jsx)(uc,{data:I,xField:n,yField:e,fieldLabels:o,cellSize:s,pointRadius:l,pointOpacity:c,colorBy:r,colorScale:N,brushSelectionName:S,hoverSelectionName:C,unselectedOpacity:p,showGrid:y,tooltip:g,mobileInteraction:M,mode:_,onPointHover:"hover"===_?(o,r,s)=>{if(o){if(L({datum:o,xField:n,yField:e,colIndex:i,rowIndex:t,px:r??0,py:s??0}),k){const[e,n]=F(i,t,r,s);k({type:"hover",datum:o,x:e,y:n,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:A})}}else L(null),k&&k({type:"hover-end",timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:A})}:void 0,onPointClick:w||k?(e,n,o)=>{if(!e)return;const[r,s]=F(i,t,n,o);w&&w(e,{x:r,y:s}),k&&k({type:"click",datum:e,x:r,y:s,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:A})}:void 0},`cell-${e}-${n}`))]},"row-"+e)),(0,ic.jsx)("div",{})," ",n.map(e=>(0,ic.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:"bold",color:"#333"},children:o[e]||e},"col-label-"+e))]}),P&&"hover"===_&&(()=>{const e=P.datum,t=o[P.xField]||P.xField,n=o[P.yField]||P.yField,i=r?"function"==typeof r?r(e):e[r]:null,l=x?"function"==typeof x?x(e):e[x]:"Row "+e[sc];return(0,ic.jsxs)("div",{style:{position:"absolute",left:40+P.colIndex*(s+a)+P.px,top:P.rowIndex*(s+a)+P.py-8,transform:"translate(-50%, -100%)",color:"#333",background:"rgba(255,255,255,0.95)",border:"1px solid #ddd",borderRadius:3,padding:"4px 8px",fontSize:11,lineHeight:1.4,whiteSpace:"nowrap",pointerEvents:"none",zIndex:10},children:[(0,ic.jsx)("div",{style:{fontWeight:"bold",marginBottom:2},children:l+""}),(0,ic.jsxs)("div",{children:[t,": ",null!=e[P.xField]?Number(e[P.xField]).toFixed(1):"–"]}),(0,ic.jsxs)("div",{children:[n,": ",null!=e[P.yField]?Number(e[P.yField]).toFixed(1):"–"]}),null!=i&&(0,ic.jsxs)("div",{style:{opacity:.8},children:["string"==typeof r?r:"group",": ",i+""]})]})})()]})}function pc(e){const{brushMode:t="crossfilter",hoverMode:n=!0}=e,o={};return!n&&t&&(o.splom={resolution:t}),n&&(o["splom-hover"]={resolution:"union"}),(0,ic.jsx)(fa,{selections:o,children:(0,ic.jsx)(fc,{...e})})}pc.displayName="ScatterplotMatrix";var yc=require("react"),gc=require("d3-brush"),mc=require("d3-selection"),xc=require("react/jsx-runtime");function bc({width:e,height:t,margin:n,scales:o,brushDirection:r,extent:i,onBrush:s}){const a=(0,yc.useRef)(null),l=(0,yc.useRef)(null),c=(0,yc.useRef)(!1),u=e+n.left+n.right,h=t+n.top+n.bottom;return(0,yc.useEffect)(()=>{if(!a.current||!o)return;const n=(0,mc.select)(a.current).select(".brush-group"),i="x"===r?(0,gc.brushX)().extent([[0,0],[e,t]]):(0,gc.brushY)().extent([[0,0],[e,t]]);return i.on("brush end",e=>{if(c.current)return;if(!e.sourceEvent)return;const t=e.selection;if(!t)return void s(null);const n=("x"===r?o.x:o.y).invert;if(!n)return;const i=[n(t[0]),n(t[1])];s(i)}),n.call(i),l.current=i,n.select(".selection").attr("fill","steelblue").attr("fill-opacity",.2).attr("stroke","steelblue").attr("stroke-width",1),()=>{i.on("brush end",null)}},[o,e,t,r,s]),(0,yc.useEffect)(()=>{if(!l.current||!o||!a.current)return;const e=(0,mc.select)(a.current).select(".brush-group"),t="x"===r?o.x:o.y;if(c.current=!0,i){const n=[t(i[0]),t(i[1])];e.call(l.current.move,n)}else e.call(l.current.move,null);c.current=!1},[i,o,r]),(0,xc.jsx)("svg",{ref:a,width:u,height:h,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:(0,xc.jsx)("g",{className:"brush-group",transform:`translate(${n.left},${n.top})`})})}function vc(e){const{data:t,width:n=600,height:o=400,margin:r,className:i,title:s,description:a,summary:l,xLabel:c,yLabel:u,xFormat:h,yFormat:d,xAccessor:f="x",yAccessor:p="y",lineBy:y,lineDataAccessor:g="coordinates",colorBy:m,colorScheme:x,curve:b="linear",lineWidth:v=2,fillArea:k=!1,areaOpacity:w=.3,showPoints:A=!1,pointRadius:S=3,enableHover:C=!0,showGrid:M=!1,showLegend:_,legendPosition:j,tooltip:P,minimap:L={},renderBefore:R=!1,onBrush:I,brushExtent:N,yExtent:F,frameProps:T={},loading:B,loadingContent:O,emptyContent:D}=e,z=Ua(B,n,o,O),H=z?null:Va(t,n,o,D),E=(0,yc.useMemo)(()=>W(t),[t]),[$,Y]=(0,yc.useState)(null),G=N??$,q=(0,yc.useCallback)(e=>{N||Y(e),I?.(e)},[N,I]),X=(0,yc.useRef)(null),[V,U]=(0,yc.useState)(null);(0,yc.useEffect)(()=>{let e=0,t=!1;const n=()=>{if(t)return;const o=X.current?.getScales?.();o?U(o):e=requestAnimationFrame(n)};return e=requestAnimationFrame(n),()=>{t=!0,e&&cancelAnimationFrame(e)}},[t]);const K=void 0!==E[0]?.[g],Q=(0,yc.useMemo)(()=>{if(K)return E;if(y){const e=E.reduce((e,t)=>{const n="function"==typeof y?y(t):t[y];if(!e[n]){const t={[g]:[]};"string"==typeof y&&(t[y]=n),e[n]=t}return e[n][g].push(t),e},{});return Object.values(e)}return[{[g]:E}]},[E,y,g,K]),Z=(0,yc.useMemo)(()=>K||y?Q.flatMap(e=>{const t=e[g]||[];return y&&"string"==typeof y?t.map(t=>({...t,[y]:e[y]})):t}):E,[Q,g,K,y,E]),J=La(E,m,x),ee=sl({lineWidth:v,colorBy:m,colorScale:J,fillArea:k,areaOpacity:w}),te=(0,yc.useMemo)(()=>{if(L.lineStyle)return L.lineStyle},[L.lineStyle]),ne=sl({lineWidth:1,colorBy:m,colorScale:J}),oe=te??ne,re=(0,yc.useMemo)(()=>{if(A)return e=>{const t={r:S,fillOpacity:1};return t.fill=m?Ne(e.parentLine||e,m,J):wa,t}},[A,S,m,J]),{legend:ie,margin:se,legendPosition:ae}=Na({data:Q,colorBy:m,colorScale:J,showLegend:_,legendPosition:j,userMargin:r}),le=L.height||60,ce=(0,yc.useMemo)(()=>({top:L.margin?.top??0,bottom:L.margin?.bottom??20,left:L.margin?.left??se.left,right:L.margin?.right??se.right}),[L.margin,se]),ue=L.brushDirection||"x",he=(0,yc.useMemo)(()=>_s([{label:c||ws(f),accessor:f,role:"x",format:h},{label:u||ws(p),accessor:p,role:"y",format:d}]),[f,p,c,u,h,d]),de=Ja({componentName:"MinimapChart",data:t,accessors:{xAccessor:f,yAccessor:p}});if(de)return(0,xc.jsx)(Wa,{componentName:"MinimapChart",message:de,width:n,height:o});const fe=k?"area":"line",pe={chartType:fe,data:Z,xAccessor:f,yAccessor:p,groupAccessor:y||void 0,curve:b,lineStyle:ee,...A&&{pointStyle:re},size:[n,o],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:se,showAxes:!0,xLabel:c,yLabel:u,xFormat:h,yFormat:d,enableHover:C,showGrid:M,...ie&&{legend:ie,legendPosition:ae},...s&&{title:s},...a&&{description:a},...l&&{summary:l},tooltipContent:!1===P?()=>null:Ri(P)||he,...G&&{xExtent:G},...F&&{yExtent:F},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...T},ye={chartType:fe,data:Z,xAccessor:f,yAccessor:p,groupAccessor:y||void 0,curve:b,lineStyle:oe,size:[n,le+ce.top+ce.bottom],margin:ce,showAxes:L.showAxes??!1,background:L.background,enableHover:!1,...F&&{yExtent:F}},ge=(0,xc.jsxs)("div",{style:{position:"relative",width:n,overflow:"hidden"},children:[(0,xc.jsx)(Bs,{ref:X,...ye}),(0,xc.jsx)(bc,{width:n-ce.left-ce.right,height:le,margin:ce,scales:V,brushDirection:ue,extent:G,onBrush:q})]},"minimap"),me=(0,xc.jsx)("div",{style:{overflow:"hidden"},children:(0,xc.jsx)(Bs,{...pe})},"main");return z||H||(0,xc.jsx)(Ga,{componentName:"MinimapChart",width:n,height:o,children:(0,xc.jsxs)("div",{className:"minimap-chart"+(i?" "+i:""),children:[R?ge:me,R?me:ge]})})}vc.displayName="MinimapChart";var kc=require("react"),wc={label:"Low / High",color:"#E9C46A",opacity:.08},Ac={label:"High / High",color:"#2A9D8F",opacity:.08},Sc={label:"Low / Low",color:"#E76F51",opacity:.08},Cc={label:"High / Low",color:"#86BBD8",opacity:.08};d();var Mc=require("react/jsx-runtime");function _c(e,t){return{label:t?.label??e.label,color:t?.color??e.color,opacity:t?.opacity??e.opacity}}var jc=(0,kc.forwardRef)(function(e,t){const n=(0,kc.useRef)(null);ll(t,{variant:"xy",frameRef:n});const o=Ba(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}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:h="y",xCenter:d,yCenter:f,quadrants:p,centerlineStyle:y={},showQuadrantLabels:g=!0,quadrantLabelSize:m=12,colorBy:x,colorScheme:b,sizeBy:v,sizeRange:k=[3,15],pointRadius:w=5,pointOpacity:A=.8,tooltip:S,pointIdAccessor:C,annotations:M,frameProps:_={},selection:j,linkedHover:P,onObservation:L,onClick:R,hoverHighlight:I,chartId:N,loading:F,loadingContent:T,emptyContent:B,legendInteraction:O,legendPosition:D,color:z,stroke:H,strokeWidth:E,opacity:$}=e,{width:Y,height:G,enableHover:q,showGrid:X,showLegend:V,title:U,description:K,summary:Q,accessibleTable:Z,xLabel:J,yLabel:ee}=o,te=(0,kc.useMemo)(()=>({topLeft:_c(wc,p?.topLeft),topRight:_c(Ac,p?.topRight),bottomLeft:_c(Sc,p?.bottomLeft),bottomRight:_c(Cc,p?.bottomRight)}),[p]),ne=(0,kc.useMemo)(()=>W(r),[r]),oe=ol({data:ne,rawData:r,colorBy:x,colorScheme:b,legendInteraction:O,legendPosition:D,selection:j,linkedHover:P,fallbackFields:"string"==typeof x?[x]:[],unwrapData:!1,onObservation:L,onClick:R,hoverHighlight:I,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"QuadrantChart",chartId:N,showLegend:V,userMargin:i,marginDefaults:o.marginDefaults,loading:F,loadingContent:T,emptyContent:B,width:Y,height:G});Ka("QuadrantChart",ne,"xAccessor",c),Ka("QuadrantChart",ne,"yAccessor",h);const re=(0,kc.useMemo)(()=>{if(!ne.length)return;const e="function"==typeof c?c:e=>+e[c],t="function"==typeof h?h:e=>+e[h];let n=1/0,o=-1/0,r=1/0,i=-1/0;for(const s of ne){const a=e(s),l=t(s);isFinite(a)&&(n>a&&(n=a),a>o&&(o=a)),isFinite(l)&&(r>l&&(r=l),l>i&&(i=l))}if(null!=d&&isFinite(d)&&(n>d&&(n=d),d>o&&(o=d)),null!=f&&isFinite(f)&&(r>f&&(r=f),f>i&&(i=f)),n===1/0)return;const s=.1*(o-n)||1,a=.1*(i-r)||1;return{xExtent:[n-s,o+s],yExtent:[r-a,i+a]}},[ne,c,h,d,f]),ie=(0,kc.useMemo)(()=>{if(!v||0===ne.length)return;const e=ne.map(e=>"function"==typeof v?v(e):e[v]).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0!==e.length?u(e):void 0},[ne,v]),se=(0,kc.useMemo)(()=>"function"==typeof c?c:e=>+e[c],[c]),ae=(0,kc.useMemo)(()=>"function"==typeof h?h:e=>+e[h],[h]),le=(0,kc.useMemo)(()=>e=>{const t=se(e),n=ae(e),o=null!=d?t>=d:void 0,r=null!=f?n>=f:void 0;return void 0===r||void 0===o?z||wa:r&&o?te.topRight.color:r&&!o?te.topLeft.color:!r&&o?te.bottomRight.color:te.bottomLeft.color},[se,ae,d,f,te,z]),ce=(0,kc.useMemo)(()=>v?e=>Be(e,v,k,ie):void 0,[v,k,ie]),ue=Dl({colorBy:x,colorScale:oe.colorScale,color:z,pointRadius:w,fillOpacity:A,radiusFn:ce,fallbackFill:le,stroke:H,strokeWidth:E,opacity:$,effectiveSelectionHook:oe.effectiveSelectionHook,resolvedSelection:oe.resolvedSelection}),he=(0,kc.useMemo)(()=>{if(!ne.length)return;const e=new Set;"string"==typeof c&&e.add(c),"string"==typeof h&&e.add(h),"string"==typeof x&&e.add(x),"string"==typeof v&&e.add(v);const t=ne[0];for(const n of Object.keys(t))if(!n.startsWith("_")&&!e.has(n)&&"string"==typeof t[n])return n},[ne,c,h,x,v]),de=(0,kc.useMemo)(()=>_s([...he?[{label:he,accessor:he,role:"title"}]:[],{label:J||ws(c),accessor:c,role:"x",format:a},{label:ee||ws(h),accessor:h,role:"y",format:l},...x?[{label:ws(x),accessor:x,role:"color"}]:[],...v?[{label:ws(v),accessor:v,role:"size"}]:[]]),[he,c,h,J,ee,x,v,a,l]),fe=Ja({componentName:"QuadrantChart",data:r,accessors:{xAccessor:c,yAccessor:h}}),pe=(0,kc.useMemo)(()=>{const e={stroke:y.stroke||"#999",strokeWidth:y.strokeWidth??1,dashArray:y.strokeDasharray||[]};return[(t,n,o,r)=>{if(!o?.x||!o?.y)return;const i=r.width,s=r.height,a=null!=d?o.x(d):i/2,l=null!=f?o.y(f):s/2;if(null!=d&&!isFinite(a))return;if(null!=f&&!isFinite(l))return;const c=Math.max(0,Math.min(i,a)),u=Math.max(0,Math.min(s,l)),h=[{config:te.topLeft,x:0,y:0,w:c,h:u},{config:te.topRight,x:c,y:0,w:i-c,h:u},{config:te.bottomLeft,x:0,y:u,w:c,h:s-u},{config:te.bottomRight,x:c,y:u,w:i-c,h:s-u}];for(const e of h)e.w>0&&e.h>0&&(t.fillStyle=e.config.color,t.globalAlpha=e.config.opacity??.08,t.fillRect(e.x,e.y,e.w,e.h));t.globalAlpha=1,t.strokeStyle=e.stroke,t.lineWidth=e.strokeWidth,e.dashArray.length>0&&t.setLineDash(e.dashArray),t.beginPath(),t.moveTo(c,0),t.lineTo(c,s),t.stroke(),t.beginPath(),t.moveTo(0,u),t.lineTo(i,u),t.stroke(),t.setLineDash([])}]},[d,f,te,y]),ye=(0,kc.useMemo)(()=>g?[...pe,(e,t,n,o)=>{if(!n?.x||!n?.y)return;const r=o.width,i=o.height,s=null!=d?n.x(d):r/2,a=null!=f?n.y(f):i/2;(null==d||isFinite(s))&&(null==f||isFinite(a))&&(e.font=`600 ${m}px sans-serif`,e.globalAlpha=.5,e.fillStyle=te.topLeft.color,e.textAlign="left",e.textBaseline="top",e.fillText(te.topLeft.label,8,8),e.fillStyle=te.topRight.color,e.textAlign="right",e.textBaseline="top",e.fillText(te.topRight.label,r-8,8),e.fillStyle=te.bottomLeft.color,e.textAlign="left",e.textBaseline="bottom",e.fillText(te.bottomLeft.label,8,i-8),e.fillStyle=te.bottomRight.color,e.textAlign="right",e.textBaseline="bottom",e.fillText(te.bottomRight.label,r-8,i-8),e.globalAlpha=1)}]:pe,[pe,g,m,te,d,f]),ge=(0,kc.useMemo)(()=>{const e=_.canvasPreRenderers||[];return[...ye,...e]},[ye,_.canvasPreRenderers]),me=(0,kc.useMemo)(()=>{const e={stroke:y.stroke||"#999",strokeWidth:y.strokeWidth??1,dashArray:y.strokeDasharray?Array.isArray(y.strokeDasharray)?y.strokeDasharray.join(","):y.strokeDasharray:void 0};return[(t,n,o)=>{if(!n?.x||!n?.y)return null;const r=o.width,i=o.height,s=null!=d?n.x(d):r/2,a=null!=f?n.y(f):i/2;if(null!=d&&!isFinite(s))return null;if(null!=f&&!isFinite(a))return null;const l=Math.max(0,Math.min(r,s)),c=Math.max(0,Math.min(i,a));return(0,Mc.jsxs)(Mc.Fragment,{children:[[{config:te.topLeft,x:0,y:0,w:l,h:c},{config:te.topRight,x:l,y:0,w:r-l,h:c},{config:te.bottomLeft,x:0,y:c,w:l,h:i-c},{config:te.bottomRight,x:l,y:c,w:r-l,h:i-c}].map((e,t)=>e.w>0&&e.h>0?(0,Mc.jsx)("rect",{x:e.x,y:e.y,width:e.w,height:e.h,fill:e.config.color,opacity:e.config.opacity??.08},"qf-"+t):null),(0,Mc.jsx)("line",{x1:l,y1:0,x2:l,y2:i,stroke:e.stroke,strokeWidth:e.strokeWidth,strokeDasharray:e.dashArray}),(0,Mc.jsx)("line",{x1:0,y1:c,x2:r,y2:c,stroke:e.stroke,strokeWidth:e.strokeWidth,strokeDasharray:e.dashArray}),g&&(0,Mc.jsxs)(Mc.Fragment,{children:[(0,Mc.jsx)("text",{x:8,y:8+m,fill:te.topLeft.color,fontWeight:600,fontSize:m,opacity:.5,children:te.topLeft.label}),(0,Mc.jsx)("text",{x:r-8,y:8+m,fill:te.topRight.color,fontWeight:600,fontSize:m,opacity:.5,textAnchor:"end",children:te.topRight.label}),(0,Mc.jsx)("text",{x:8,y:i-8,fill:te.bottomLeft.color,fontWeight:600,fontSize:m,opacity:.5,children:te.bottomLeft.label}),(0,Mc.jsx)("text",{x:r-8,y:i-8,fill:te.bottomRight.color,fontWeight:600,fontSize:m,opacity:.5,textAnchor:"end",children:te.bottomRight.label})]})]})}]},[d,f,te,y,g,m]);if(oe.earlyReturn)return oe.earlyReturn;const xe={chartType:"scatter",...null!=r&&{data:ne},xAccessor:c,yAccessor:h,colorAccessor:x||void 0,sizeAccessor:v||void 0,sizeRange:k,pointStyle:ue,colorScheme:b,size:[Y,G],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:oe.margin,showAxes:o.showAxes,xLabel:J,yLabel:ee,xFormat:a,yFormat:l,enableHover:q,showGrid:X,...re&&{xExtent:re.xExtent,yExtent:re.yExtent},...oe.legendBehaviorProps,...U&&{title:U},...K&&{description:K},...Q&&{summary:Q},...void 0!==Z&&{accessibleTable:Z},...s&&{className:s},...null!=e.animate&&{animate:e.animate},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},tooltipContent:!1===S?()=>null:!0===S||void 0===S?de:Ri(S)||de,...ul({linkedHover:P,selection:j,onObservation:L,onClick:R,hoverHighlight:I,mobileInteraction:oe.mobileInteraction,customHoverBehavior:oe.customHoverBehavior,customClickBehavior:oe.customClickBehavior}),...C&&{pointIdAccessor:C},...M&&M.length>0&&{annotations:M},canvasPreRenderers:ge,...oe.crosshairProps,..._,...ge.length>0&&{canvasPreRenderers:ge},svgPreRenderers:me};return fe?(0,Mc.jsx)(Wa,{componentName:"QuadrantChart",message:fe,width:Y,height:G}):(0,Mc.jsx)(Ga,{componentName:"QuadrantChart",width:Y,height:G,children:(0,Mc.jsx)(Bs,{ref:n,...xe})})});jc.displayName="QuadrantChart";var Pc=c(require("react")),Lc=require("react"),Rc=require("react/jsx-runtime"),Ic="__ma_unitized",Nc="__ma_series";function Fc(e,t){const n=t[1]-t[0];return 0===n?.5:(e-t[0])/n}function Tc(e,t){return t[0]+e*(t[1]-t[0])}var Bc=(0,Lc.forwardRef)(function(e,t){const n=(0,Lc.useRef)(null),o=(0,Lc.useRef)([]),r=(0,Lc.useRef)(e.series);r.current=e.series,(0,Lc.useImperativeHandle)(t,()=>{const e=()=>(r.current??[]).filter(e=>null!=e&&"object"==typeof e);return{push:t=>{if(!n.current)return;const r=e(),i=t;for(let e=0;r.length>e&&2>e;e++){const t=r[e],s=t.extent||o.current[e];if(!s)continue;const a=("function"==typeof t.yAccessor?t.yAccessor:e=>e[t.yAccessor])(i);null!=a&&isFinite(a)&&n.current.push({...i,[Ic]:Fc(a,s),[Nc]:t.label||"Series "+(e+1)})}},pushMany:t=>{if(!n.current)return;const r=e(),i=[];for(const e of t)for(let t=0;r.length>t&&2>t;t++){const n=r[t],s=n.extent||o.current[t];if(!s)continue;const a=("function"==typeof n.yAccessor?n.yAccessor:e=>e[n.yAccessor])(e);null!=a&&isFinite(a)&&i.push({...e,[Ic]:Fc(a,s),[Nc]:n.label||"Series "+(t+1)})}n.current.pushMany(i)},remove:e=>n.current?.remove(e)??[],update:(e,t)=>n.current?.update(e,t)??[],clear:()=>n.current?.clear(),getData:()=>n.current?.getData()??[],getScales:()=>n.current?.getScales()??null}},[]);const i=Ba(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,accessibleTable:e.accessibleTable,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:800,height:400}),{data:s,margin:a,className:l,xFormat:c,xAccessor:u="x",series:h,colorScheme:d,curve:f="monotoneX",lineWidth:p=2,tooltip:y,annotations:g,frameProps:m={},selection:x,linkedHover:b,onObservation:v,onClick:k,hoverHighlight:w,chartId:A,loading:S,loadingContent:C,emptyContent:M,legendInteraction:_,legendPosition:j,stroke:P,strokeWidth:L,opacity:R}=e,{width:I,height:N,enableHover:F,showGrid:T,showLegend:B=!0,title:O,description:D,summary:z,accessibleTable:H,xLabel:E}=i,$=(0,Lc.useMemo)(()=>W(s),[s]),Y=(0,Lc.useMemo)(()=>W(h),[h]),G=Y,q=2===Y.length;"undefined"==typeof process||"production"===process.env?.NODE_ENV||q||console.warn(`[MultiAxisLineChart] Expected exactly 2 series for dual-axis mode, got ${Y.length}. Rendering as a standard multi-line chart.`);const X=Ua(S,I,N,C),V=X?null:Va(s,I,N,M),U=Pa(),K=(0,Lc.useMemo)(()=>{let e;if(Array.isArray(d))e=d;else if(U&&U.length>0)e=U;else{const t=Pe[d];e=Array.isArray(t)?t:Le}return G.map((t,n)=>t.color||e[n%e.length])},[G,d,U]),Q=(0,Lc.useMemo)(()=>Y.map((e,t)=>e.label||"Series "+(t+1)),[Y]),{unitizedData:Z,extents:J}=(0,Lc.useMemo)(()=>{if(0===$.length){const e=Y.map(e=>e.extent||null).filter(Boolean);return e.length===Y.length&&(o.current=e),{unitizedData:[],extents:e.length===Y.length?e:[]}}const e=Y.map(e=>e.extent||function(e,t){let n=1/0,o=-1/0;const r="function"==typeof t?t:e=>e[t];for(const t of e){const e=r(t);null!=e&&isFinite(e)&&(n>e&&(n=e),e>o&&(o=e))}if(!isFinite(n)||!isFinite(o))return[0,1];if(n===o){const e=0===n?1:.1*Math.abs(n);return[n-e,o+e]}return[n,o]}($,e.yAccessor));if(o.current=e,!q){const t=[];for(const e of $)for(let n=0;Y.length>n;n++){const o=Y[n],r=("function"==typeof o.yAccessor?o.yAccessor:e=>e[o.yAccessor])(e);null!=r&&t.push({...e,[Ic]:r,[Nc]:Q[n]})}return{unitizedData:t,extents:e}}const t=[];for(const n of $)for(let o=0;2>o;o++){const r=Y[o],i=("function"==typeof r.yAccessor?r.yAccessor:e=>e[r.yAccessor])(n);null!=i&&t.push({...n,[Ic]:Fc(i,e[o]),[Nc]:Q[o]})}return{unitizedData:t,extents:e}},[$,Y,q,Q]),ee=(0,Lc.useMemo)(()=>{if(q&&J.length>=2)return[{orient:"left",label:Q[0],tickFormat:Y[0].format||(e=>{const t=Tc(e,J[0]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"right",label:Q[1],tickFormat:Y[1].format||(e=>{const t=Tc(e,J[1]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"bottom"}]},[q,J,Y,Q]),te=ol({data:(0,Lc.useMemo)(()=>Z.length>0?Z:Q.map(e=>({[Nc]:e})),[Z,Q]),rawData:s,colorBy:Nc,colorScheme:K,legendInteraction:_,legendPosition:j,selection:x,linkedHover:b,fallbackFields:[Nc],unwrapData:!1,onObservation:v,onClick:k,hoverHighlight:w,mobileInteraction:i.mobileInteraction,mobileSemantics:i.mobileSemantics,chartType:"MultiAxisLineChart",chartId:A,showLegend:B,userMargin:a,marginDefaults:q?{...i.marginDefaults,left:70,right:70}:i.marginDefaults,loading:S,loadingContent:C,emptyContent:M,width:I,height:N}),ne=(0,Lc.useMemo)(()=>{const e=new Map;return Q.forEach((t,n)=>e.set(t,K[n])),e},[Q,K]),oe=sl({lineWidth:p,resolveStroke:(0,Lc.useCallback)(e=>ne.get(e[Nc])||K[0],[ne,K]),stroke:P,strokeWidth:L,opacity:R,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection}),re=(0,Lc.useMemo)(()=>{if(!1===y)return()=>null;return Ri(y)||(e=>{const t=e.data||e,n=t[Nc],o=Q.indexOf(n),r=t[Ic],i=q&&o>=0&&J[o]?Tc(r,J[o]):r,s=o>=0&&Y[o]?.format?Y[o].format:e=>Number.isInteger(e)?e+"":e.toFixed(2),a="function"==typeof u?u(t):t[u];return Pc.createElement("div",{style:{padding:"6px 10px",fontFamily:"var(--semiotic-font-family, sans-serif)",fontSize:"var(--semiotic-tooltip-font-size, 13px)"}},Pc.createElement("div",{style:{fontWeight:600,marginBottom:4,color:K[o]||"inherit"}},n),Pc.createElement("div",null,`${"string"==typeof u?u:"x"}: ${a}`),Pc.createElement("div",null,`${n}: ${s(i)}`))})},[y,Q,K,J,q,Y,u]);if(te.earlyReturn)return te.earlyReturn;const ie=Ja({componentName:"MultiAxisLineChart",data:s,accessors:{xAccessor:u}}),se=q?[0,1]:void 0,ae={chartType:"line",...null!=s&&{data:Z},xAccessor:u,yAccessor:Ic,groupAccessor:Nc,lineStyle:oe,colorScheme:K,size:[I,N],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:te.margin,showAxes:i.showAxes,...ee&&{axes:ee},xLabel:E,...q?{}:{yLabel:Q[0]},xFormat:c,...q&&se&&{yExtent:se},enableHover:F,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:T,curve:f,...te.legendBehaviorProps,...O&&{title:O},...D&&{description:D},...z&&{summary:z},...void 0!==H&&{accessibleTable:H},...l&&{className:l},...null!=e.animate&&{animate:e.animate},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},tooltipContent:re,...g&&{annotations:g},...ul({linkedHover:b,selection:x,onObservation:v,onClick:k,hoverHighlight:w,mobileInteraction:te.mobileInteraction,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior}),...te.crosshairProps,...m};return X||V||(ie?(0,Rc.jsx)(Wa,{componentName:"MultiAxisLineChart",message:ie,width:I,height:N}):(0,Rc.jsx)(Ga,{componentName:"MultiAxisLineChart",width:I,height:N,children:(0,Rc.jsx)(Bs,{ref:n,...ae})}))});Bc.displayName="MultiAxisLineChart";var Oc=require("react");function Dc(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}var Wc=require("react/jsx-runtime"),zc=(0,Oc.forwardRef)(function(e,t){const n=(0,Oc.useRef)(null);ll(t,{variant:"xy",frameRef:n});const o=Ba(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",highAccessor:u="high",lowAccessor:h="low",openAccessor:d,closeAccessor:f,candlestickStyle:p,tooltip:y,annotations:g,xExtent:m,yExtent:x,frameProps:b={},selection:v,linkedHover:k,onObservation:w,onClick:A,chartId:S,loading:C,loadingContent:M,emptyContent:_}=e,{width:j,height:P,enableHover:L,showGrid:R,title:I,description:N,summary:F,accessibleTable:T,xLabel:B,yLabel:O}=o,D=Ua(C,j,P,M),z=D?null:Va(r,j,P,_),H=(0,Oc.useMemo)(()=>W(r),[r]),E=null==d||null==f;Ka("CandlestickChart",H,"xAccessor",c),Ka("CandlestickChart",H,"highAccessor",u),Ka("CandlestickChart",H,"lowAccessor",h),E||(Ka("CandlestickChart",H,"openAccessor",d),Ka("CandlestickChart",H,"closeAccessor",f));const{customHoverBehavior:$,customClickBehavior:Y,crosshairSourceId:G}=Ra({selection:v,linkedHover:k,onObservation:w,onClick:A,chartType:"CandlestickChart",chartId:S,mobileInteraction:o.mobileInteraction}),q=Ia(k,G),X=(0,Oc.useMemo)(()=>{const t=o.marginDefaults,n="sparkline"===e.mode?{...t,top:0,bottom:0}:t;return null==i?n:{...n,...Dc(i)}},[i,o.marginDefaults,e.mode]),V=(0,Oc.useMemo)(()=>{const e=[{label:B||ws(c),accessor:c,role:"x",format:a}];return E?(e.push({label:"High",accessor:u,role:"y",format:l}),e.push({label:"Low",accessor:h,format:l})):(e.push({label:"Open",accessor:d,format:l}),e.push({label:"High",accessor:u,format:l}),e.push({label:"Low",accessor:h,format:l}),e.push({label:"Close",accessor:f,format:l})),_s(e)},[c,B,a,l,u,h,d,f,E]),U=Ja({componentName:"CandlestickChart",data:r,accessors:{xAccessor:c,highAccessor:u,lowAccessor:h,...!E&&{openAccessor:d,closeAccessor:f}}}),K={chartType:"candlestick",...null!=r&&{data:H},xAccessor:c,yAccessor:u,highAccessor:u,lowAccessor:h,...!E&&{openAccessor:d,closeAccessor:f},...p&&{candlestickStyle:p},scalePadding:Math.max(2,Math.min(12,Math.round(j/40))),extentPadding:j>200?.1:.02,size:[j,P],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:X,showAxes:o.showAxes,xLabel:B,yLabel:O,xFormat:a,yFormat:l,enableHover:L,showGrid:R,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...cl({title:I,description:N,summary:F,accessibleTable:T,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...hl({tooltip:y,defaultTooltipContent:V}),...ul({linkedHover:k,selection:v,onObservation:w,onClick:A,mobileInteraction:o.mobileInteraction,customHoverBehavior:$,customClickBehavior:Y}),...g&&g.length>0&&{annotations:g},...m&&{xExtent:m},...x&&{yExtent:x},...q,...b};return D||z||(U?(0,Wc.jsx)(Wa,{componentName:"CandlestickChart",message:U,width:j,height:P}):(0,Wc.jsx)(Ga,{componentName:"CandlestickChart",width:j,height:P,children:(0,Wc.jsx)(Bs,{ref:n,...K})}))});zc.displayName="CandlestickChart";var Hc=require("react"),Ec=require("react");var $c=require("react/jsx-runtime"),Yc=(0,Hc.forwardRef)(function(e,t){const{data:n,layout:o,layoutConfig:r,onLayoutError:i,xExtent:s,yExtent:a,showAxes:l=!1,margin:c,className:u,annotations:h,onObservation:d,onClick:f,selection:p,linkedHover:y,chartId:g,loading:m,loadingContent:x,emptyContent:b,colorBy:v,colorScheme:k,frameProps:w={}}=e,{frameRef:A,resolved:S,safeData:C,setup:M,earlyReturn:_}=function(e){const t=function(e){const t=(0,Ec.useRef)(null);return ll(e.imperativeRef,{variant:e.imperativeVariant,frameRef:t}),{frameRef:t,resolved:Ba(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),normalizedMargin:(0,Ec.useMemo)(()=>Dc(e.margin),[e.margin])}}(e),{resolved:n,normalizedMargin:o}=t,r=ol({data:e.data??[],rawData:e.data,colorBy:e.colorBy,colorScheme:e.colorScheme,legendInteraction:void 0,selection:e.selection,linkedHover:e.linkedHover,fallbackFields:"string"==typeof e.colorBy?[e.colorBy]:[],unwrapData:e.unwrapData,onObservation:e.onObservation,onClick:e.onClick,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,chartType:e.chartTypeLabel,chartId:e.chartId,showLegend:n.showLegend,userMargin:o,marginDefaults:n.marginDefaults,loading:e.loading,loadingContent:e.loadingContent,emptyContent:e.emptyContent,width:n.width,height:n.height});return{...t,safeData:r.data,setup:r,earlyReturn:r.earlyReturn}}({imperativeRef:t,imperativeVariant:"xy",chartTypeLabel:"XYCustomChart",unwrapData:!1,data:n,colorBy:v,colorScheme:k,selection:p,linkedHover:y,onObservation:d,onClick:f,chartId:g,loading:m,loadingContent:x,emptyContent:b,margin:c,width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,mode:e.mode,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules,xLabel:e.xLabel,yLabel:e.yLabel}),j=M.effectiveSelectionHook,P=(0,Hc.useMemo)(()=>j?.isActive?{isActive:!0,predicate:j.predicate}:null,[j?.isActive,j?.predicate]);if(_)return _;const{width:L,height:R,enableHover:I,showGrid:N,title:F,description:T,summary:B,accessibleTable:O,xLabel:D,yLabel:W}=S,z={chartType:"custom",...null!=n&&{data:C},customLayout:o,layoutConfig:r,onLayoutError:i,...P&&{layoutSelection:P},xExtent:s,yExtent:a,colorAccessor:v,colorScheme:k,size:[L,R],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:M.margin,showAxes:l,xLabel:D,yLabel:W,enableHover:I,showGrid:N,...M.legendBehaviorProps,...cl({title:F,description:T,summary:B,accessibleTable:O,className:u,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...null!=e.tooltip&&{tooltipContent:e.tooltip},...ul({linkedHover:y,selection:p,onObservation:d,onClick:f,hoverHighlight:!1,mobileInteraction:M.mobileInteraction,customHoverBehavior:M.customHoverBehavior,customClickBehavior:M.customClickBehavior}),...h&&h.length>0&&{annotations:h},...M.crosshairProps,...w};return(0,$c.jsx)(Ga,{componentName:"XYCustomChart",width:L,height:R,children:(0,$c.jsx)(Bs,{ref:A,...z})})});Yc.displayName="XYCustomChart";var Gc={fill:"rgba(0,0,0,0)",stroke:"rgba(0,0,0,0)",opacity:0},qc=8;function Xc(e){return null==e?void 0:e+""}function Vc(e){const t=Xc(e.id);return{type:"point",x:e.x,y:e.y,r:e.r??qc,style:{...Gc},datum:e.datum,pointId:t,_transitionKey:t}}function Uc(e){return{type:"rect",x:e.x,y:e.y,w:e.width,h:e.height,style:{...Gc},datum:e.datum,group:e.group,_transitionKey:Xc(e.id)}}
2
+ var e,t,n,o,r,i,s=Object.create,a=Object.defineProperty,l=Object.getOwnPropertyDescriptor,c=Object.getOwnPropertyNames,u=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty,d=(e,t,n)=>function(){if(n)throw n[0];try{return e&&(t=(0,e[c(e)[0]])(e=0)),t}catch(e){throw n=[e],e}},f=(e,t)=>{for(var n in t)a(e,n,{get:t[n],enumerable:!0})},p=(e,t,n,o)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let r of c(t))h.call(e,r)||r===n||a(e,r,{get:()=>t[r],enumerable:!(o=l(t,r))||o.enumerable});return e},y=(e,t,n)=>(n=null!=e?s(u(e)):{},p(!t&&e&&e.__esModule?n:a(n,"default",{value:e,enumerable:!0}),e)),m=d({"src/components/stream/brushAccessibility.ts"(){e=y(require("react")),t="Use arrow keys to move the selected range, Shift plus an arrow key to resize it, and Escape to clear it."}}),g={};function x(e,t,n,o){const[r,i]=[Math.min(...t),Math.max(...t)],s=(i-r)/20;let[a,l]=e;if(o)0>n?a=Math.max(r,a-s):l=Math.min(i,l+s);else{const e=l-a;a=Math.max(r,Math.min(i-e,a+n*s)),l=a+e}return[a,l]}function b(e,t){let n=0,o=t.length-1;for(;o>n;){const r=n+o+1>>1;t[r]>e?o=r-1:n=r}return t[n]}function v(e,t){let n=0,o=t.length-1;for(;o>n;){const r=n+o>>1;e>t[r]?n=r+1:o=r}return t[n]}function k({width:s,height:a,totalWidth:l,totalHeight:c,margin:u,dimension:h,scales:d,onBrush:f,binSize:p,snap:y,binBoundaries:m,snapDuring:g,streaming:k}){const w=(0,n.useRef)(null),A=(0,n.useRef)(null),S=(0,n.useRef)(f);S.current=f;const C=(0,n.useRef)(d);C.current=d;const M=(0,n.useMemo)(()=>m?[...m].sort((e,t)=>e-t):void 0,[m]),j=(0,n.useRef)(M);j.current=M;const _=(0,n.useRef)(!1),R=(0,n.useRef)(null),P=function({label:n="Data range brush",description:o=t,onAction:r}={}){const i=e.useId().replace(/:/g,""),s=e.useRef(r);return s.current=r,{description:o,descriptionId:"semiotic-brush-description-"+i,svgProps:{role:"region",tabIndex:0,"aria-label":n,"aria-describedby":"semiotic-brush-description-"+i,onKeyDown:e.useCallback(e=>{const t=function(e){return"Escape"===e.key?{type:"clear"}:"ArrowLeft"===e.key?{type:"nudge",direction:"left",resize:e.shiftKey}:"ArrowRight"===e.key?{type:"nudge",direction:"right",resize:e.shiftKey}:"ArrowUp"===e.key?{type:"nudge",direction:"up",resize:e.shiftKey}:"ArrowDown"===e.key?{type:"nudge",direction:"down",resize:e.shiftKey}:null}(e);t&&(e.preventDefault(),s.current?.(t))},[])}}}({label:"xy"===h?"Two-dimensional data range brush":h.toUpperCase()+" data range brush",onAction:e=>{const t=C.current,n=A.current;if(!t||!n||!w.current)return;const r=(0,o.select)(w.current).select(".brush-g");if("clear"===e.type)return _.current=!0,r.call(n.move,null),_.current=!1,R.current=null,void S.current(null);const i=t.x.domain(),s=t.y.domain(),a=R.current;let l=a?.x??[i[0]+.4*(i[1]-i[0]),i[0]+.6*(i[1]-i[0])],c=a?.y??[s[0]+.4*(s[1]-s[0]),s[0]+.6*(s[1]-s[0])];const u="left"===e.direction||"right"===e.direction,d="left"===e.direction||"down"===e.direction?-1:1;if(u&&"y"!==h&&(l=x(l,i,d,e.resize)),u||"x"===h||(c=x(c,s,d,e.resize)),u&&"y"===h||!u&&"x"===h)return;const f={x:l,y:c};_.current=!0,r.call(n.move,"x"===h?[t.x(l[0]),t.x(l[1])]:"y"===h?[t.y(c[1]),t.y(c[0])]:[[t.x(l[0]),t.y(c[1])],[t.x(l[1]),t.y(c[0])]]),_.current=!1,R.current=f,S.current(f)}});return(0,n.useEffect)(()=>{if(!w.current)return;const e=(0,o.select)(w.current).select(".brush-g"),t="x"===h?(0,r.brushX)():"y"===h?(0,r.brushY)():(0,r.brush)();return t.extent([[0,0],[s,a]]),t.on("brush end",n=>{if(_.current)return;const o=C.current;if(!o)return;if(!n.selection)return R.current=null,void S.current(null);let r,i;if("x"===h){const[e,t]=n.selection;r=[o.x.invert(e),o.x.invert(t)],i=[o.y.invert(a),o.y.invert(0)]}else if("y"===h){const[e,t]=n.selection;r=[o.x.invert(0),o.x.invert(s)],i=[o.y.invert(t),o.y.invert(e)]}else{const[[e,t],[s,a]]=n.selection;r=[o.x.invert(e),o.x.invert(s)],i=[o.y.invert(a),o.y.invert(t)]}if("bin"===y&&"y"!==h&&("end"===n.type||"brush"===n.type&&g)){const i=j.current;i&&i.length>0?r=function(e,t){return 0===t.length?e:[b(e[0],t),v(e[1],t)]}(r,i):p&&p>0&&(r=[Math.floor(r[0]/p)*p,Math.ceil(r[1]/p)*p]);const s=o.x(r[0]),a=o.x(r[1]);if(_.current=!0,"x"===h)e.call(t.move,[s,a]);else if("xy"===h){const o=n.selection;e.call(t.move,[[s,o[0][1]],[a,o[1][1]]])}_.current=!1}const l={x:r,y:i};R.current=l,S.current(l)}),e.call(t),A.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null),A.current=null}},[s,a,h,y,p,g]),(0,n.useEffect)(()=>{if(!(k&&d&&A.current&&R.current))return;if(!w.current)return;if("y"===h)return;const e=R.current,t=d.x.domain()[0],n=(0,o.select)(w.current).select(".brush-g");if(t>=e.x[1])return _.current=!0,n.call(A.current.move,null),_.current=!1,R.current=null,void S.current(null);let r=e.x[0],i=!1;if(t>e.x[0]){if(r=t,"bin"===y){const e=j.current;e&&e.length>0?r=v(t,e):p&&p>0&&(r=Math.ceil(t/p)*p)}if(r>=e.x[1])return _.current=!0,n.call(A.current.move,null),_.current=!1,R.current=null,void S.current(null);i=!0}const s=d.x(r),a=d.x(e.x[1]);if(_.current=!0,"x"===h)n.call(A.current.move,[s,a]);else{const t=d.y(e.y[1]),o=d.y(e.y[0]);n.call(A.current.move,[[s,t],[a,o]])}if(_.current=!1,i){const t={x:[r,e.x[1]],y:e.y};R.current=t,S.current(t)}},[d,k,h,y,p]),(0,i.jsxs)("svg",{ref:w,width:l,height:c,...P.svgProps,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:[(0,i.jsx)("title",{children:P.svgProps["aria-label"]}),(0,i.jsx)("desc",{id:P.descriptionId,children:P.description}),(0,i.jsx)("g",{className:"brush-g",transform:`translate(${u.left},${u.top})`})]})}f(g,{XYBrushOverlay:()=>k});var w=d({"src/components/stream/XYBrushOverlay.tsx"(){n=require("react"),o=require("d3-selection"),r=require("d3-brush"),m(),i=require("react/jsx-runtime")}});function A(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 S(e,t=-1/0){let n=t;for(const t of e)t>n&&(n=t);return n}var C=d({"src/components/charts/shared/minMax.ts"(){}});function M(e,t=.5){const n=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!n)return e;const o=Math.round(parseInt(n[1],16)*(1-t)),r=Math.round(parseInt(n[2],16)*(1-t)),i=Math.round(parseInt(n[3],16)*(1-t));return`#${o.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}`}function j(e,t=.5){const n=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!n)return e;const o=Math.round(parseInt(n[1],16)+(255-parseInt(n[1],16))*t),r=Math.round(parseInt(n[2],16)+(255-parseInt(n[2],16))*t),i=Math.round(parseInt(n[3],16)+(255-parseInt(n[3],16))*t);return`#${o.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}`}var _,R,P=d({"src/components/charts/shared/colorManipulation.ts"(){}}),L={};function I(e,t,n,o){const r=t.uncertaintyOpacity,i=t.confidenceAccessor;if(!r&&!i)return;const s="object"==typeof r?r:{},a=s.min??.15,l=s.max??1;if(i){const t="function"==typeof i?i:e=>e[i];for(const n of e){const e=t(n);null!=e&&Number.isFinite(e)&&(n[R]=a+Math.max(0,Math.min(1,e))*(l-a))}return}const c=e.map(e=>{const t=n(e),r=o(e);return null!=t&&null!=r&&Number.isFinite(t)&&Number.isFinite(r)?Math.abs(t-r):NaN}),u=c.filter(e=>Number.isFinite(e));if(0===u.length)return;const[h,d]=A(u),f=d-h;e.forEach((e,t)=>{const n=c[t];Number.isFinite(n)&&(e[R]=l-(f>0?(n-h)/f:0)*(l-a))})}function T(e,t){return"function"==typeof t?t(e):!!e[t]}function N(e){return[{type:"anomaly-band",threshold:e.threshold??2,showBand:!1!==e.showBand,fill:e.bandColor||"#6366f1",fillOpacity:e.bandOpacity??.1,anomalyColor:e.anomalyColor||"#ef4444",anomalyRadius:e.anomalyRadius??6,label:e.label}]}function F(e,t,n,o,r){return(i=o).isTraining||i.isForecast||i.isAnomaly||i.upperBounds||i.lowerBounds?function(e,t,n,o,r){const{isTraining:i,isForecast:s,isAnomaly:a,upperBounds:l,lowerBounds:c,color:u="#6366f1",bandOpacity:h=.15,anomalyColor:d="#ef4444",anomalyRadius:f=6,label:p}=o,y=e.map(e=>{let t="observed";return s&&T(e,s)?t="forecast":i&&T(e,i)&&(t="training"),{...e,[_]:t}}),m=o._groupBy,g=[];if(m){const e=new Map;for(const t of y){const n=t[m]??"__default";e.has(n)||e.set(n,[]),e.get(n).push(t)}const t=[];for(const[,n]of e)for(let e=0;n.length-1>e;e++)n[e][_]!==n[e+1][_]&&(t.push({...n[e+1],[_]:n[e][_]}),t.push({...n[e],[_]:n[e+1][_]}));g.push(...y,...t)}else for(let e=0;y.length>e;e++)g.push(y[e]),y.length-1>e&&y[e][_]!==y[e+1][_]&&(g.push({...y[e+1],[_]:y[e][_]}),g.push({...y[e],[_]:y[e+1][_]}));if(o.trainUnderline){const e=[];for(const t of g)"training"===t[_]&&e.push({...t,[_]:"training-base"});g.unshift(...e)}const x=[];if(l&&c){const e="string"==typeof l?l:"__envUpper",t="string"==typeof c?c:"__envLower";if("function"==typeof l||"function"==typeof c)for(const n of g)"function"==typeof l&&(n[e]=l(n)),"function"==typeof c&&(n[t]=c(n));x.push({type:"envelope",upperAccessor:e,lowerAccessor:t,fill:u,fillOpacity:h,label:p})}if(o.uncertaintyOpacity||o.confidenceAccessor){const e=l?"function"==typeof l?l:e=>e[l]:()=>{},t=c?"function"==typeof c?c:e=>e[c]:()=>{};I(g.filter(e=>"forecast"===e[_]),o,e,t)}if(a){const e=o.anomalyStyle,t={type:"highlight",filter:e=>T(e,a)};e?(t.style=e,t.r=f):"function"==typeof d?(t.style=e=>{const t=d(e);return{stroke:t,strokeWidth:1.5,fill:t,fillOpacity:.7}},t.r=f):(t.color=d,t.r=f,t.style={stroke:d,strokeWidth:1.5,fill:d,fillOpacity:.7}),x.push(t)}return r&&x.push({type:"anomaly-band",threshold:r.threshold??2,showBand:!1!==r.showBand,fill:r.bandColor||"#6366f1",fillOpacity:r.bandOpacity??.1,anomalyColor:r.anomalyColor||"#ef4444",anomalyRadius:r.anomalyRadius??6,label:r.label}),{processedData:g,annotations:x}}(e,0,0,o,r):function(e,t,n,o,r){const{trainEnd:i,steps:s=10,confidence:a=.95,color:l="#6366f1",bandOpacity:c=.15,label:u}=o;if(null==i)return{processedData:e,annotations:[]};const h=[],d=[];for(const n of e)n[t]>i?d.push({...n,[_]:"observed"}):h.push({...n,[_]:"training"});const f=h.map(e=>[e[t],e[n]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]),p=[],y=[];if(f.length>=3){const r=f.length;let i=0,h=0,d=0,m=0;for(const[e,t]of f)i+=e,h+=t,d+=e*e,m+=e*t;const g=r*d-i*i;if(Math.abs(g)>1e-12){const d=(r*m-i*h)/g,x=(h-d*i)/r,b=e=>x+d*e,v=f.map(([e,t])=>t-b(e)).reduce((e,t)=>e+t*t,0),k=Math.sqrt(v/Math.max(r-2,1)),w=f.reduce((e,t)=>e+t[0],0)/r,A=f.reduce((e,t)=>e+(t[0]-w)**2,0),C=.99>a?.95>a?.9>a?1:1.645:1.96:2.576,M=S(e.map(e=>e[t]).filter(e=>null!=e&&isFinite(e))),j=f.length>1?(f[r-1][0]-f[0][0])/(r-1):1;for(let e=1;s>=e;e++){const o=M+e*j,i=b(o),s=k*Math.sqrt(1+1/r+(A>0?(o-w)**2/A:0))*C;y.push({[t]:o,[n]:i,[_]:"forecast",__forecastUpper:i+s,__forecastLower:i-s})}I(y,o,e=>e.__forecastUpper,e=>e.__forecastLower),p.push({type:"envelope",upperAccessor:"__forecastUpper",lowerAccessor:"__forecastLower",fill:l,fillOpacity:c,label:u})}}p.push({type:"x-threshold",x:i,color:"#94a3b8",strokeWidth:1,strokeDasharray:"4,2",label:"Train / Forecast"}),r&&p.push({type:"anomaly-band",threshold:r.threshold??2,showBand:!1!==r.showBand,fill:r.bandColor||"#6366f1",fillOpacity:r.bandOpacity??.1,anomalyColor:r.anomalyColor||"#ef4444",anomalyRadius:r.anomalyRadius??6,label:r.label});const m=[];if(m.push(...h),h.length>0&&d.length>0&&m.push({...h[h.length-1],[_]:"observed"}),m.push(...d),y.length>0){const e=d.length>0?d[d.length-1]:h[h.length-1];e&&m.push({...e,[_]:"forecast"}),m.push(...y)}return{processedData:m,annotations:p}}(e,t,n,o,r);var i}function O(e,t){const n=t.trainDasharray??"8,4",o=t.forecastDasharray??"4,4",r=t.color||"#6366f1",i=t.trainOpacity,s=t.forecastOpacity,a=t.trainStroke,l=t.trainLinecap,c=t.trainUnderline;return t=>{const u=e(t),h=t[_];if("training"===h){let e=u.stroke;return"darken"===a?e=M(u.stroke||"#666",.5):a&&(e=a),{...u,stroke:e,strokeDasharray:n,...l&&{strokeLinecap:l},...null!=i&&{strokeOpacity:i}}}if("training-base"===h){let e=u.stroke||"#666";return"lighten"===c&&(e=j(e,.4)),{...u,stroke:e,strokeDasharray:void 0}}if("forecast"===h){const e=t[R],n=null!=e?e:s;return{...u,stroke:r,strokeDasharray:o,...null!=n&&{strokeOpacity:n}}}return u}}f(L,{FORECAST_OPACITY_FIELD:()=>R,SEGMENT_FIELD:()=>_,buildAnomalyAnnotations:()=>N,buildForecast:()=>F,createSegmentLineStyle:()=>O,darkenColor:()=>M,lightenColor:()=>j,stampForecastOpacity:()=>I});var B,D=d({"src/components/charts/shared/statisticalOverlays.ts"(){C(),P(),P(),_="__forecastSegment",R="__forecastOpacity"}}),W={};f(W,{AreaChart:()=>Fc,BubbleChart:()=>ru,CandlestickChart:()=>Xu,ConnectedScatterplot:()=>tu,DEFAULT_HIT_RADIUS:()=>eh,DifferenceChart:()=>Wc,Heatmap:()=>lu,LineChart:()=>Rc,MinimapChart:()=>_u,MultiAxisLineChart:()=>Yu,QuadrantChart:()=>Ou,Scatterplot:()=>Qc,ScatterplotMatrix:()=>wu,StackedAreaChart:()=>Ec,StreamXYFrame:()=>Da,XYCustomChart:()=>Zu,composeStyleRules:()=>fc,glyphExtent:()=>Cn,glyphPlacement:()=>Sn,hatchFillId:()=>$n,hatchPatternDef:()=>qn,hitTargetPoint:()=>nh,hitTargetRect:()=>oh,isHatchFill:()=>Hn,makeRuleValueResolver:()=>ac,makeXYRuleContext:()=>lc,matchesThreshold:()=>uc,resolveResponsiveRules:()=>kl,resolveStyleRules:()=>dc,resolveSvgFill:()=>Gn,responsiveRuleMatches:()=>vl,ruleMatches:()=>hc,useCustomLayoutSelection:()=>yn}),module.exports=(B=W,p(a({},"__esModule",{value:!0}),B));var z=y(require("react")),H=require("react"),E=y(require("react")),$=require("react/jsx-runtime"),Y=null,q=null;function G(e){const[t,n]=E.useState(()=>Y);return E.useEffect(()=>{if(t)return;let e=!1;return(Y?Promise.resolve(Y):(q||(q=Promise.resolve().then(()=>(w(),g)).then(e=>Y=e.XYBrushOverlay)),q)).then(t=>{e||n(()=>t)}),()=>{e=!0}},[t]),t?(0,$.jsx)(t,{...e}):null}var V=Object.freeze([]);function X(e){if(!e)return V;let t=!1;for(let n=0;e.length>n;n++){const o=e[n];if(null==o||"object"!=typeof o){t=!0;break}}if(!t)return e;const n=[];for(const t of e)null!=t&&"object"==typeof t&&n.push(t);return n}var U=class{constructor(e,t){this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=e,this.chunkThreshold=t?.chunkThreshold??5e3,this.chunkSize=t?.chunkSize??5e3}updateChunkOptions(e){null!=e.chunkThreshold&&(this.chunkThreshold=e.chunkThreshold),null!=e.chunkSize&&(this.chunkSize=e.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(e){if(e=X(e),this.lastBoundedData===e)return;if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}setReplacementData(e){if(e=X(e),this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.pushBuffer=[],this.flushScheduled=!1,this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0,preserveCategoryOrder:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,preserveCategoryOrder:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const e=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:e,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(e){null!=e&&"object"==typeof e&&(this.pushBuffer.push(e),this.scheduleFlush())}pushMany(e){if(0===e.length)return;let t=0;for(let n=0;e.length>n;n++){const o=e[n];null!=o&&"object"==typeof o&&(this.pushBuffer.push(o),t++)}0!==t&&this.scheduleFlush()}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}},K=require("react"),Q=require("react/jsx-runtime");function Z(e){let t=null;const n=()=>(t||(t=(0,K.createContext)(null)),t),o=J(e);return[function({children:t,initialState:o}){const r=(0,K.useRef)(o),i=(0,K.useMemo)(()=>J(e,r.current),[]),s=n();return(0,Q.jsx)(s.Provider,{value:i,children:t})},(e,t)=>{const r=n(),i=(0,K.useContext)(r)??o,s=(0,K.useRef)(e);s.current=e;const a=(0,K.useRef)({hasValue:!1,value:void 0}),l=(0,K.useCallback)(()=>{const e=s.current(i.getState()),n=a.current;return n.hasValue&&t&&t(n.value,e)?n.value:(a.current={hasValue:!0,value:e},e)},[i,t]),c=(0,K.useCallback)(()=>s.current(i.getState()),[i]);return(0,K.useSyncExternalStore)(i.subscribe,l,c)}]}function J(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 ee(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 te(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t={...t,colors:{...t.colors,categorical:ne}}),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 ne=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],oe={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}},re={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}},ie={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:ne,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 se(e,t){if("light"===t)return oe;if("dark"===t)return re;if("high-contrast"===t)return ie;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?re:oe;return te({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}return te({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}var[ae,le]=Z(e=>({theme:oe,setTheme(t){e(e=>({theme:se(e.theme,t)}))}})),ce=class{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;return{next:()=>this._size>e?{done:!1,value:this.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray();let n=0,o=[];t.length>e&&(n=t.length-e,o=t.slice(0,n)),this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(let e=n;t.length>e;e++)this.push(t[e]);return o}update(e,t){const n=[],o=(this.head-this._size+this._capacity)%this._capacity;for(let r=0;this._size>r;r++){const i=(o+r)%this._capacity,s=this.buffer[i];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:{...s},n.push(e),this.buffer[i]=t(s)}}return n}remove(e){const t=[],n=[];if(this.forEach(o=>{e(o)?n.push(o):t.push(o)}),0===n.length)return n;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}},ue=class{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(e){Number.isFinite(e)&&(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}evict(e){e!==this._min&&e!==this._max||(this._dirty=!0)}recalculate(e,t){this._min=1/0,this._max=-1/0;for(const n of e){const e=t?t(n):n;Number.isFinite(e)&&(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}this._dirty=!1}clear(){this._min=1/0,this._max=-1/0,this._dirty=!1}get extent(){return[this._min,this._max]}get min(){return this._min}get max(){return this._max}get dirty(){return this._dirty}};function he(e,t){return e===t}function de(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function fe(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function pe(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}var ye=/^\d{4}-\d{1,2}$/;function me(e){const t=e.trim();if(!t||!Number.isNaN(Number(t)))return NaN;const n=ye.test(t)?t+"-01":t;if(n===t&&10>t.length)return NaN;const o=Date.parse(n);return Number.isFinite(o)?o:NaN}function ge(e){return e instanceof Date?e.getTime():"string"==typeof e?me(e):+e}function xe(e){return new Set(Array.isArray(e)?e:[e])}var be=require("d3-scale");function ve(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function ke(e,t,n){const o=e=>e.toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function we(e){const t=e.map(ve),n=t.length-1;return e=>{if(0>=e){const[e,n,o]=t[0];return ke(e,n,o)}if(e>=1){const[e,o,r]=t[n];return ke(e,o,r)}const o=e*n,r=Math.floor(o),i=o-r,[s,a,l]=t[r],[c,u,h]=t[r+1];return ke(Math.round(s+(c-s)*i),Math.round(a+(u-a)*i),Math.round(l+(h-l)*i))}}var Ae=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Se=we(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),Ce=we(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),Me=we(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),je=we(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),_e=we(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),Re=we(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),Pe=we(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),Le=we(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),Ie=we(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),Te=we(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),Ne=we(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),Fe=we(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]),Oe={blues:Se,reds:Ce,greens:Me,viridis:Pe,oranges:je,purples:_e,greys:Re,plasma:Le,inferno:Ie,magma:Te,cividis:Ne,turbo:Fe};function Be(e){return e&&Oe[e]||Se}we(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),we(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),we(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),we(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),we(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),we(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),we(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]);var De={category10:Ae,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],...Oe},We=Ae,ze=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],He=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 Ee(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")||He.has(t)}(o)?n(o):o}const o=e?.[t]+"";return n?n(o):We[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))%We.length]}function $e(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 Ye(e,t,n="category10"){if(n&&"object"==typeof n&&!Array.isArray(n)){const e=n;return t=>$e(e,t)??"#999"}const o=Array.from(new Set(e.map(e=>e?.[t]).filter(e=>null!=e).map(e=>e+""))),r=o.every(e=>!isNaN(Number(e)));if(Array.isArray(n))return(0,be.scaleOrdinal)().domain(o).range(n).unknown("#999");const i=De[n]||De.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:We;return(0,be.scaleOrdinal)().domain(o).range(e).unknown("#999")}}function qe(e,t,n=[3,20],o){let r;if(r="function"==typeof t?t(e):e?.[t],!o)return r;const[i,s]=o,[a,l]=n;if(s===i)return(a+l)/2;let c=(r-i)/(s-i);return 0>c?c=0:c>1&&(c=1),a+c*(l-a)}function Ge(e,t,n){return e+(t-e)*n}function Ve(){return"undefined"!=typeof performance?performance.now():Date.now()}function Xe(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 Ue(e){const t=new Map;for(let n=0;e.length>n;n++)t.set(e[n],n);return t}function Ke(e,t,n){const o=e.duration??500,r=n-t;return o>r?1-r/o:0}function Qe(e,t,n,o){let r=!1;return t>0?(e._pulseIntensity!==t&&(e._pulseIntensity=t,r=!0),e._pulseColor!==n&&(e._pulseColor=n,r=!0),e._pulseGlowRadius!==o&&(e._pulseGlowRadius=o,r=!0),r):(0!==e._pulseIntensity&&(e._pulseIntensity=0,r=!0),void 0!==e._pulseColor&&(e._pulseColor=void 0,r=!0),void 0!==e._pulseGlowRadius&&(e._pulseGlowRadius=void 0,r=!0),r)}function Ze(e,t,n){if(t._transitionKey)return t._transitionKey;switch(t.type){case"point":if(t.pointId)return"p:"+t.pointId;if("streaming"===e.runtimeMode&&t.datum){const n=e.getX(t.datum),o=e.getY(t.datum);if(e.getCategory)return`p:${e.getCategory(t.datum)}:${n}:${o}`;if(null!=n&&null!=o)return`p:${n}:${o}`}return"p:"+n;case"glyph":return t.pointId?"g:"+t.pointId:"g:"+n;case"rect":return`r:${t.group||""}:${t.datum?.binStart??t.datum?.category??n}`;case"heatcell":return`h:${t.x}_${t.y}`;case"candlestick":return null==t.datum?"c:"+n:"c:"+e.getX(t.datum);case"line":return"l:"+(t.group||"_default");case"area":return"a:"+(t.group||"_default");default:return null}}function Je(e,t,n,o,r,i){const s=[];for(const r of e){const e=n(r),i=o(r);Number.isFinite(e)&&Number.isFinite(i)&&s.push({px:t.x(e),py:t.y(i),rawY:i,d:r})}s.sort((e,t)=>e.px-t.px);const a=Array(s.length),l=Array(s.length),c=Array(s.length);for(let e=0;s.length>e;e++){const t=s[e];a[e]=[t.px,t.py],l[e]=t.rawY,c[e]=t.d}return{type:"line",path:a,rawValues:l,style:r,datum:c,group:i}}function et(e,t,n,o,r,i,s,a){const l=[];for(const i of e){const e=n(i),s=o(i);if(!Number.isFinite(e)||!Number.isFinite(s))continue;const c=t.x(e),u=a?a(i):r;l.push({px:c,topY:t.y(s),botY:t.y(u)})}l.sort((e,t)=>e.px-t.px);const c=Array(l.length),u=Array(l.length);for(let e=0;l.length>e;e++){const t=l[e];c[e]=[t.px,t.topY],u[e]=[t.px,t.botY]}return{type:"area",topPath:c,bottomPath:u,style:i,datum:e,group:s}}function tt(e,t,n,o){const r=new Map;if("silhouette"===o)for(const o of e){let e=0;for(const r of t)e+=n(r,o)||0;r.set(o,-e/2)}else if("wiggle"===o){e.length>0&&r.set(e[0],0);for(let o=1;e.length>o;o++){const i=e[o-1],s=e[o];let a=0,l=0,c=0;for(const e of t){const t=n(e,s)||0;a+=(2*c+t)*(t-(n(e,i)||0)),l+=t,c+=t}const u=r.get(i)??0;r.set(s,u-(l>0?a/(2*l):0))}if(e.length>0){let o=0;for(const i of e){let e=0;for(const o of t)e+=n(o,i)||0;o+=(r.get(i)??0)+e/2}const i=o/e.length;for(const t of e)r.set(t,(r.get(t)??0)-i)}}else for(const t of e)r.set(t,0);return r}function nt(e,t,n,o,r,i,s){const a=n(e),l=o(e);if(!Number.isFinite(a)||!Number.isFinite(l))return null;const c={type:"point",x:t.x(a),y:t.y(l),r:r,style:i,datum:e};return void 0!==s&&(c.pointId=s),c}function ot(e,t,n,o,r,i,s,a){const l=n(e),c=o(e);if(!Number.isFinite(l)||!Number.isFinite(c))return null;const u={type:"symbol",x:t.x(l),y:t.y(c),size:r,symbolType:i,style:s,datum:e};return void 0!==a&&(u.pointId=a),u}function rt(e,t,n,o,r,i,s){return{type:"rect",x:e,y:t,w:n,h:o,style:r,datum:i,group:s}}function it(e,t,n,o,r,i,s){const a={type:"heatcell",x:e,y:t,w:n,h:o,fill:r,datum:i};return s?.showValues&&(a.showValues=!0,a.value=s.value,s.valueFormat&&(a.valueFormat=s.valueFormat)),a}function st(e,t,n,o){return"function"==typeof t.style?t.style(o||{},n):t.style&&"object"==typeof t.style?t.style:e.resolveBoundsStyle(n,o)}function at(e,t,n,o){if(!e.scales)return null;const r=[],i=[];for(const n of t){const t=e.getX(n);if(!Number.isFinite(t))continue;const s=o.getTop(n),a=o.getBottom(n);if(!Number.isFinite(s)||!Number.isFinite(a))continue;const l=e.scales.x(t),c=e.scales.y(s),u=e.scales.y(a);Number.isFinite(l)&&Number.isFinite(c)&&Number.isFinite(u)&&(r.push([l,c]),i.push([l,u]))}return 2>r.length?null:{type:"area",topPath:r,bottomPath:i,style:st(e,o,n,t[0]),datum:t,group:n,interactive:o.interactive}}function lt(e){const t=[],n=[];if(!e)return{perSeries:t,aggregate:n};for(const o of e)o.perSeries?t.push(o):n.push(o);return{perSeries:t,aggregate:n}}function ct(e,t,n){const o=[];for(const r of n){const n=at(e,t,"__ribbon_aggregate",r);n&&o.push(n)}return o}function ut(e,t,n,o){const r=[];for(const i of o){const o=at(e,t,n,i);o&&r.push(o)}return r}function ht(e,t){if(!e)return{};if(!t||0===t.length)return e;const n=[];for(const o of t){if("band"!==o.kind)continue;const t=o.getTop(e),r=o.getBottom(e);Number.isFinite(r)&&Number.isFinite(t)&&n.push({y0:r,y1:t})}return 0===n.length?e:{...e,band:n[0],bands:n}}function dt(e,t,n,o){if(!e.config.pointStyle)return;const r=o??e.getY;for(const o of t){const t=e.resolveGroupColor(o.key);for(const i of o.data){let o=e.config.pointStyle(i);!o.fill&&t&&(o={...o,fill:t});const s=o.r??3,a=e.getPointId?e.getPointId(i)+"":void 0,l=nt(i,e.scales,e.getX,r,s,o,a);l&&n.push(l)}}}function ft(e){return"threshold"===e.type&&"string"==typeof e.color&&"number"==typeof e.value}var pt={topOpacity:.8,bottomOpacity:.05};function yt(e){if(e)return!0===e?pt:"colorStops"in e?e:{topOpacity:e.topOpacity??pt.topOpacity,bottomOpacity:e.bottomOpacity??pt.bottomOpacity}}var mt=require("d3-shape"),gt={circle:mt.symbolCircle,square:mt.symbolSquare,triangle:mt.symbolTriangle,diamond:mt.symbolDiamond,star:mt.symbolStar,cross:mt.symbolCross,wye:mt.symbolWye},xt=["circle","triangle","diamond","star","square","chevron","cross","wye"];function bt(e,t,n){if(n)return n;const o=e??"circle";return"chevron"===o?function(e){const t=1.5*vt(e),n=.92*t;return`M0,${-t}L${n},${(.78*t).toFixed(3)}L0,${(.28*t).toFixed(3)}L${-n},${(.78*t).toFixed(3)}Z`}(t):(0,mt.symbol)(gt[o]??mt.symbolCircle,Math.max(1,t))()??""}function vt(e){return Math.sqrt(Math.max(1,e)/Math.PI)}var kt=new Map;function wt(e,t,n,o,r){const i=new Map;for(const s of e){const e=t(s),a=n(s);if(null==e||null==a||Number.isNaN(e)||Number.isNaN(a))continue;const l=Math.floor(e/o)*o;let c=i.get(l);if(c||(c={start:l,end:l+o,total:0,categories:new Map},i.set(l,c)),c.total+=a,r){const e=r(s);c.categories.set(e,(c.categories.get(e)||0)+a)}}return i}function At(e){return null!=e&&!1!==e&&""!==e&&(!Array.isArray(e)||e.some(At))}function St(e,t,n){e.has(t)||(e.add(t),console.warn(n))}function Ct(e,t){const n="function"==typeof e?e:n=>n[e||t];return e=>{const t=n(e);return null==t?NaN:+t}}function Mt(e){const t=[],n=["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode,o=Ct(n&&e.valueAccessor||e.yAccessor,n?"value":"y");if(e.boundsAccessor){const n=de(e.boundsAccessor,"bounds");t.push({kind:"bounds",getTop:e=>{const t=o(e);if(!Number.isFinite(t))return NaN;const r=n(e);return Number.isFinite(r)&&0!==r?t+r:t},getBottom:e=>{const t=o(e);if(!Number.isFinite(t))return NaN;const r=n(e);return Number.isFinite(r)&&0!==r?t-r:t},style:e.boundsStyle,perSeries:!0,interactive:!1})}if(e.band){const n=Array.isArray(e.band)?e.band:[e.band];for(const e of n)t.push({kind:"band",getTop:Ct(e.y1Accessor,"y1"),getBottom:Ct(e.y0Accessor,"y0"),style:e.style,perSeries:!1!==e.perSeries,interactive:!0===e.interactive})}return t}var jt=require("d3-scale");function _t(e,t){return t?[t[0]??e[0],t[1]??e[1]]:e}function Rt(e,t,n){if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return(0,jt.scaleLog)().domain(e).range(n).clamp(!0)}return"symlog"===e?(0,jt.scaleSymlog)().domain(t).range(n):"time"===e?(0,jt.scaleTime)().domain([new Date(t[0]),new Date(t[1])]).range(n):(0,jt.scaleLinear)().domain(t).range(n)}function Pt(e,t,n,o){const r=e.push(t);return n&&n.push(o),r}var Lt=new WeakMap;var It={data:"data",domain:"domain",layout:"layout","scene-geometry":"sceneGeometry","scene-style":"sceneStyle","data-paint":"dataPaint","interaction-paint":"interactionPaint",overlay:"overlay",accessibility:"accessibility",evidence:"evidence"};function Tt(e,t){const n={...e};for(const e of t)n[It[e]]++;return n}function Nt(e,t,n){const o=new Set(t);return{changeSet:{...e,...e.keys?{keys:[...e.keys]}:{}},changed:o,revisions:Tt(n,o)}}var Ft=class{constructor(){this.revisions={data:0,domain:0,layout:0,sceneGeometry:0,sceneStyle:0,dataPaint:0,interactionPaint:0,overlay:0,accessibility:0,evidence:0},this.latest=Nt({kind:"initialize"},[],this.revisions),this.listeners=new Set}get last(){return this.latest}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}record(e,t){const n=Nt(e,t,this.revisions);this.revisions=n.revisions,this.latest=n;for(const e of[...this.listeners])e();return n}},Ot=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Bt=["scene-style","data-paint","accessibility","evidence"],Dt=(e,t)=>({retainedData:e,invalidations:t}),Wt=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],zt=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Ht=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Et=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],$t=["scene-geometry","data-paint","accessibility","evidence"],Yt=["scene-style","data-paint","accessibility","evidence"],qt=[],Gt={chartType:Dt("rebuild",Wt),runtimeMode:Dt("rebuild",Wt),xAccessor:Dt("rebuild",Wt),yAccessor:Dt("rebuild",Wt),timeAccessor:Dt("rebuild",Wt),valueAccessor:Dt("rebuild",Wt),y0Accessor:Dt("rebuild",Wt),boundsAccessor:Dt("rebuild",Wt),band:Dt("rebuild",Wt),openAccessor:Dt("rebuild",Wt),highAccessor:Dt("rebuild",Wt),lowAccessor:Dt("rebuild",Wt),closeAccessor:Dt("rebuild",Wt),candlestickRangeMode:Dt("rebuild",Wt),accessorRevision:Dt("rebuild",Wt),groupAccessor:Dt("rebuild",zt),categoryAccessor:Dt("rebuild",zt),lineDataAccessor:Dt("rebuild",zt),colorAccessor:Dt("rebuild",Yt),sizeAccessor:Dt("rebuild",$t),symbolAccessor:Dt("rebuild",$t),pointIdAccessor:Dt("rebuild",$t),xScaleType:Dt("preserve",Ht),yScaleType:Dt("preserve",Ht),xExtent:Dt("preserve",Ht),yExtent:Dt("preserve",Ht),extentPadding:Dt("preserve",Ht),scalePadding:Dt("preserve",Ht),axisExtent:Dt("preserve",Ht),binSize:Dt("preserve",Ht),normalize:Dt("preserve",Ht),heatmapAggregation:Dt("preserve",Ht),heatmapXBins:Dt("preserve",Ht),heatmapYBins:Dt("preserve",Ht),arrowOfTime:Dt("preserve",Et),baseline:Dt("preserve",Et),stackOrder:Dt("preserve",Et),sizeRange:Dt("preserve",Et),curve:Dt("preserve",Et),areaGroups:Dt("preserve",Et),customLayout:Dt("preserve",Et),layoutConfig:Dt("preserve",Et),layoutMargin:Dt("preserve",Et),symbolMap:Dt("preserve",$t),showValues:Dt("preserve",$t),heatmapValueFormat:Dt("preserve",$t),lineStyle:Dt("preserve",Yt),pointStyle:Dt("preserve",Yt),areaStyle:Dt("preserve",Yt),barStyle:Dt("preserve",Yt),swarmStyle:Dt("preserve",Yt),waterfallStyle:Dt("preserve",Yt),candlestickStyle:Dt("preserve",Yt),boundsStyle:Dt("preserve",Yt),gradientFill:Dt("preserve",Yt),lineGradient:Dt("preserve",Yt),colorScheme:Dt("preserve",Yt),themeCategorical:Dt("preserve",Yt),themeSemantic:Dt("preserve",Yt),themeSequential:Dt("preserve",Yt),themeDiverging:Dt("preserve",Yt),barColors:Dt("preserve",Yt),decay:Dt("preserve",Yt),pulse:Dt("preserve",Yt),staleness:Dt("preserve",Yt),layoutSelection:Dt("preserve",Yt),annotations:Dt("preserve",["overlay","accessibility","evidence"]),windowSize:Dt("preserve",qt),windowMode:Dt("preserve",qt),maxCapacity:Dt("preserve",qt),clock:Dt("preserve",qt),transition:Dt("preserve",qt),introAnimation:Dt("preserve",qt),onLayoutError:Dt("preserve",qt)},Vt=Dt("preserve",Et),Xt=class{constructor(){this.tracker=new Ft}get last(){return this.tracker.last}subscribe(e){return this.tracker.subscribe(e)}recordData(e,t){return this.tracker.record({kind:e,...void 0===t?{}:{count:t}},Ot)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},Bt):this.recordNoop("restyle")}recordConfig(e){const t=function(e){let t="preserve";const n=new Set;for(const o of e){const e=Gt[o]??Vt;"rebuild"===e.retainedData&&(t="rebuild");for(const t of e.invalidations)n.add(t)}return{retainedData:t,invalidations:n}}(e);return this.tracker.record({kind:"config",keys:e},t.invalidations)}},Ut=require("d3-quadtree"),Kt=class{constructor(){this.maxRadius=0,this.tree=null}get quadtree(){return this.tree}get maxPointRadius(){return this.maxRadius}clear(){this.tree=null,this.maxRadius=0}rebuild(e,t){if("scatter"!==e&&"bubble"!==e&&"custom"!==e)return void this.clear();let n=0,o=0;for(const e of t)"point"===e.type&&(n++,e.r>o&&(o=e.r));if(this.maxRadius=o,500>=n)return void(this.tree=null);const r=Array(n);let i=0;for(const e of t)"point"===e.type&&(r[i++]=e);this.tree=(0,Ut.quadtree)().x(e=>e.x).y(e=>e.y).addAll(r)}},Qt=class e{constructor(e){if(this.xExtent=new ue,this.yExtent=new ue,this.growingCapacityWarned=!1,this.windowSizeWarned=!1,this.resolvedRibbons=[],this.timestampBuffer=null,this.activeTransition=null,this._hasRenderedOnce=!1,this.prevPositionMap=new Map,this.prevPathMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this._colorMapCache=null,this._groupDataCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this._ingestVersion=0,this._datumIndexCache=null,this._bufferArrayCache=null,this._bufferDirty=!0,this.needsFullRebuild=!0,this.lastLayout=null,this.updateResults=new Xt,this.scales=null,this.scene=[],this.version=0,this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customLayoutFailedThisBuild=!1,this._customLayoutDiagnosticsWarned=new Set,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.xIsDate=!1,this.spatialIndex=new Kt,this._lastBoundedInsertsRef=null,this.applyPulse=(e,t,n)=>!(!this.config.pulse||!this.timestampBuffer)&&function(e,t,n,o,r,i=("undefined"!=typeof performance?performance.now():Date.now())){const s=e.color??"rgba(255,255,255,0.6)",a=e.glowRadius??4;let l=!1;const c=r??(()=>{const e=new Map;for(let t=0;n.length>t;t++)e.set(n[t],t);return e})();for(const n of t){if("line"===n.type)continue;if("area"===n.type){const t=Array.isArray(n.datum)?n.datum:[n.datum];let r=0,a=!1;for(const n of t){const t=c.get(n);if(null==t)continue;a=!0;const s=o.get(t);if(null==s)continue;const l=Ke(e,s,i);l>r&&(r=l)}a&&(l=Qe(n,r,s)||l);continue}const t=c.get(n.datum);if(null==t)continue;const r=o.get(t);l=Qe(n,null==r?0:Ke(e,r,i),s,a)||l}return l}(this.config.pulse,e,t,this.timestampBuffer,this.getDatumIndexMap(t),n),this.config=e,this.buffer=new ce(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=de(e.timeAccessor||e.xAccessor,"time"),this.getY=de(e.valueAccessor||e.yAccessor,"value")):(this.getX=de(e.xAccessor,"x"),this.getY=de(e.yAccessor,"y")),this.getGroup=pe(e.groupAccessor),this.getCategory=pe(e.categoryAccessor),this.getSize=e.sizeAccessor?de(e.sizeAccessor,"size"):void 0,this.getColor=pe(e.colorAccessor),this.getSymbol=pe(e.symbolAccessor),this.getY0=e.y0Accessor?de(e.y0Accessor,"y0"):void 0,this.resolvedRibbons=Mt(e),this.getPointId=pe(e.pointIdAccessor),"candlestick"===e.chartType){const t=null!=e.openAccessor,n=null!=e.closeAccessor;this.getOpen=t?de(e.openAccessor,"open"):void 0,this.getHigh=de(e.highAccessor,"high"),this.getLow=de(e.lowAccessor,"low"),this.getClose=n?de(e.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!t&&!n}e.pulse&&(this.timestampBuffer=new ce(e.windowSize))}currentTime(){return this.config.clock?.()??Ve()}syncPulseTimestampBuffer(){this.config.pulse?null!=this.timestampBuffer&&this.timestampBuffer.capacity===this.buffer.capacity&&this.timestampBuffer.size===this.buffer.size||(this.timestampBuffer=function(e,t){const n=new ce(e.capacity);return e.forEach(()=>n.push(t)),n}(this.buffer,this.currentTime())):this.timestampBuffer=null}pushDatumYExtent(e){if("candlestick"===this.config.chartType&&this.getHigh&&this.getLow)return this.yExtent.push(this.getHigh(e)),void this.yExtent.push(this.getLow(e));this.yExtent.push(this.getY(e)),this.getY0&&this.yExtent.push(this.getY0(e));for(const t of this.resolvedRibbons){const n=t.getTop(e),o=t.getBottom(e);Number.isFinite(n)&&this.yExtent.push(n),Number.isFinite(o)&&this.yExtent.push(o)}}evictDatumYExtent(e){if("candlestick"===this.config.chartType&&this.getHigh&&this.getLow)return this.yExtent.evict(this.getHigh(e)),void this.yExtent.evict(this.getLow(e));this.yExtent.evict(this.getY(e)),this.getY0&&this.yExtent.evict(this.getY0(e));for(const t of this.resolvedRibbons){const n=t.getTop(e),o=t.getBottom(e);Number.isFinite(n)&&this.yExtent.evict(n),Number.isFinite(o)&&this.yExtent.evict(o)}}rebuildYExtent(){this.yExtent.clear();for(const e of this.buffer)this.pushDatumYExtent(e)}rebuildExtents(){this.xExtent.clear(),this.yExtent.clear();for(const e of this.buffer)this.xExtent.push(this.getX(e)),this.pushDatumYExtent(e)}ingest(e){if(e.bounded&&this._lastBoundedInsertsRef===e.inserts)return this.updateResults.recordNoop("replace"),!1;const t=this.currentTime();if(this.lastIngestTime=t,this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,e.bounded){this._lastBoundedInsertsRef=e.inserts,this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this.timestampBuffer&&this.timestampBuffer.clear();const i=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode;if(this.getX=i?de(this.config.timeAccessor||this.config.xAccessor,"time"):de(this.config.xAccessor,"x"),this.xIsDate=!1,e.inserts.length>0){const t=e.inserts[0],n=this.config.xAccessor,o="function"==typeof n?n(t):t[n||"x"],r=o instanceof Date,i="string"==typeof o&&Number.isFinite(me(o));if(this.xIsDate=r||i,i){const e="string"==typeof n?n:void 0;this.getX=e?t=>ge(t[e]):e=>ge(n(e))}}r=this.timestampBuffer,(o=e.totalSize||e.inserts.length)>(n=this.buffer).capacity&&(n.resize(o),r&&o>r.capacity&&r.resize(o));for(const n of e.inserts)Pt(this.buffer,n,this.timestampBuffer,t),this.xExtent.push(this.getX(n)),this.pushDatumYExtent(n)}else for(const n of e.inserts){if("growing"===this.config.windowMode&&this.buffer.full){const e=this.config.maxCapacity??1e5;e>this.growingCap&&(this.growingCap=Math.min(2*this.growingCap,e),this.buffer.resize(this.growingCap),this.timestampBuffer&&this.timestampBuffer.resize(this.growingCap),"production"===process.env.NODE_ENV||this.growingCapacityWarned||5e4>this.growingCap||(this.growingCapacityWarned=!0,console.warn(`[Semiotic] Growing window buffer reached ${this.growingCap} points (cap ${e}). Large canvas scenes are expensive — prefer a sliding window, aggregation, or an explicit maxCapacity if this is intentional.`)))}const e=Pt(this.buffer,n,this.timestampBuffer,t);this.xExtent.push(this.getX(n)),this.pushDatumYExtent(n),null!=e&&(this.xExtent.evict(this.getX(e)),this.evictDatumYExtent(e))}var n,o,r;return this.updateResults.recordData(e.bounded?"replace":"ingest",e.inserts.length),!0}ingestWithResult(e){return this.ingest(e),this.updateResults.last}computeScene(e){const{config:t,buffer:n}=this,o=this.scales,r=this.lastLayout;if(!this.needsFullRebuild&&!t.customLayout&&this.lastLayout&&this.scene.length>0&&this.scales&&0>=(this.config.scalePadding??0)&&(this.lastLayout.width!==e.width||this.lastLayout.height!==e.height))return void this.remapScene(e);this.xExtent.dirty&&this.xExtent.recalculate(n,this.getX),this.yExtent.dirty&&this.rebuildYExtent();const i=this.getBufferArray(),s=this.yExtent.extent;let a=_t(this.xExtent.extent,t.xExtent),l=_t(s,t.yExtent);const c=!(!(u=t.yExtent)||null==u[0]||null==u[1]);var u;const h="exact"===t.axisExtent;if("stackedarea"===t.chartType&&!c&&n.size>0){const e=function(e){const{config:t,groups:n,getX:o,getY:r}=e,i="exact"===t.axisExtent;if(t.normalize){const n=[0,i?1:1+t.extentPadding];return{yDomain:n,stackExtentCache:{key:`${e.bufferSize}:${e.ingestVersion}:norm`,yDomain:n}}}const s=`${e.bufferSize}:${e.ingestVersion}:${t.baseline??"zero"}:${t.stackOrder??"key"}`;if(e.stackExtentCache&&e.stackExtentCache.key===s)return{yDomain:e.stackExtentCache.yDomain,stackExtentCache:e.stackExtentCache};const a=new Map,l=new Set;let c=0;const u=new Map,h=new Map;for(const e of n){const t=new Map;let n=0;for(const i of e.data){const e=o(i),s=r(i);if(!Number.isFinite(e)||!Number.isFinite(s))continue;t.set(e,(t.get(e)||0)+s),l.add(e),n+=s;const a=(u.get(e)||0)+s;u.set(e,a),a>c&&(c=a)}a.set(e.key,t),h.set(e.key,n)}const d=t.stackOrder??"key",f=(e,t)=>t>e?-1:e>t?1:0;let p,y;if("input"===d)p=n.map(e=>e.key);else if("insideOut"===d){const e=[...n].map(e=>e.key).sort((e,t)=>{const n=(h.get(t)??0)-(h.get(e)??0);return 0!==n?n:f(e,t)}),t=[],o=[];let r=0,i=0;for(const n of e)i>r?(t.push(n),r+=h.get(n)??0):(o.push(n),i+=h.get(n)??0);p=[...o.reverse(),...t]}else p="asc"===d?n.map(e=>e.key).sort((e,t)=>{const n=(h.get(e)??0)-(h.get(t)??0);return 0!==n?n:f(e,t)}):"desc"===d?n.map(e=>e.key).sort((e,t)=>{const n=(h.get(t)??0)-(h.get(e)??0);return 0!==n?n:f(e,t)}):n.map(e=>e.key).sort(f);if("wiggle"===t.baseline||"silhouette"===t.baseline){const e=Array.from(l).sort((e,t)=>e-t),n=tt(e,p,(e,t)=>a.get(e)?.get(t)||0,t.baseline);let o=1/0,r=-1/0;for(const t of e){const e=n.get(t)??0,i=u.get(t)??0;o>e&&(o=e),e+i>r&&(r=e+i)}Number.isFinite(o)&&Number.isFinite(r)||(o=0,r=0);const s=r-o,c=i?0:s>0?s*t.extentPadding:1;y=[o-c,r+c]}else if("diverging"===t.baseline){const e=Array.from(l).sort((e,t)=>e-t),[n,o]=function(e,t,n){let o=0,r=0;for(const i of e){let e=0,s=0;for(const o of t){const t=n(o,i)||0;0>t?s+=t:e+=t}o>s&&(o=s),e>r&&(r=e)}return[o,r]}(e,p,(e,t)=>a.get(e)?.get(t)||0),r=o-n,s=i?0:r>0?r*t.extentPadding:1;y=[n-s,o+s]}else y=[0,c+(i?0:c>0?c*t.extentPadding:1)];return{yDomain:y,stackExtentCache:{key:s,yDomain:y}}}({config:t,groups:this.groupData(i),getX:this.getX,getY:this.getY,bufferSize:n.size,ingestVersion:this._ingestVersion,stackExtentCache:this._stackExtentCache});l=e.yDomain,this._stackExtentCache=e.stackExtentCache}else"bar"===t.chartType&&t.binSize&&!c&&n.size>0?l=function(e,t,n,o,r,i,s){const[,a]=function(e,t,n,o,r){const i=wt(e,t,n,o,r);if(0===i.size)return[0,0];let s=0;for(const e of i.values())e.total>s&&(s=e.total);return[0,s]}(e,t,n,o,r);return[0,s?a:a+a*i]}(n,this.getX,this.getY,t.binSize,this.getCategory,t.extentPadding,h):"waterfall"===t.chartType&&!c&&n.size>0?l=function(e,t,n,o){const[r,i]=function(e,t){let n=0,o=0,r=0;for(const i of e){const e=t(i);null==e||Number.isNaN(e)||(r+=e,n>r&&(n=r),r>o&&(o=r))}return[n,o]}(e,t),s=i-r,a=o?0:s>0?s*n:1;return[Math.min(0,r-Math.abs(a)),Math.max(0,i+Math.abs(a))]}(n,this.getY,t.extentPadding,h):c||l[0]===1/0||(l=function(e,t,n){if(!n.length)return e;let[o,r]=e;for(const e of t)for(const t of n){const n=t.getTop(e),i=t.getBottom(e);Number.isFinite(n)&&(o>n&&(o=n),n>r&&(r=n)),Number.isFinite(i)&&(o>i&&(o=i),i>r&&(r=i))}return[o,r]}(l,i,this.resolvedRibbons),l=function(e,t){const n=e[1]-e[0],o=t.exactMode?0:n>0?n*t.extentPadding:1,r=[null!=t.userMin?e[0]:e[0]-o,null!=t.userMax?e[1]:e[1]+o];return"log"!==t.yScaleType||r[0]>0||0>=t.dataYDomain[0]||t.exactMode||null==t.userMin&&(r[0]=t.dataYDomain[0]/(1+t.extentPadding)),r}(l,{exactMode:h,extentPadding:t.extentPadding,userMin:t.yExtent?.[0],userMax:t.yExtent?.[1],yScaleType:t.yScaleType,dataYDomain:s}));l=function(e,t,n){if(!t||n)return e;const o=t[0],r=t[1];return null==o&&null==r?e:[null!=o?o:e[0],null!=r?r:e[1]]}(l,t.yExtent,!!c),({xDomain:a,yDomain:l}=function(e,t,n){let o=e,r=t;if(o[0]===1/0||o[1]===-1/0)if("time"===n){const e=Date.now();o=[e-864e5,e]}else o=[0,1];return r[0]!==1/0&&r[1]!==-1/0||(r=[0,1]),{xDomain:o,yDomain:r}}(a,l,t.xScaleType)),this.scales=function(e){const{config:t,layout:n,xDomain:o,yDomain:r}=e,i="streaming"===t.runtimeMode,s=Math.max(0,Math.min(t.scalePadding||0,Math.min(n.width,n.height)/2-1));if(i){if("x"==("up"===(a=t.arrowOfTime)||"down"===a?"y":"x")){const e="right"===t.arrowOfTime?[s,n.width-s]:[n.width-s,s];return{x:(0,jt.scaleLinear)().domain(o).range(e),y:Rt(t.yScaleType,r,[n.height-s,s])}}const e="down"===t.arrowOfTime?[s,n.height-s]:[n.height-s,s];return{x:Rt(t.yScaleType,r,[s,n.width-s]),y:(0,jt.scaleLinear)().domain(o).range(e)}}var a;return{x:Rt(t.xScaleType,o,[s,n.width-s]),y:Rt(t.yScaleType,r,[n.height-s,s])}}({config:t,layout:e,xDomain:a,yDomain:l}),this._customLayoutFailedThisBuild=!1;const d=this.buildSceneNodes(e,i);if(this._customLayoutFailedThisBuild)return!0===this.lastCustomLayoutFailure?.preservedLastGoodScene?(this.scales=o,this.lastLayout=r):(this.scene=[],this.spatialIndex.rebuild(this.config.chartType,this.scene)),void(this.needsFullRebuild=!0);this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=d,this.config.decay&&this.applyDecay(this.scene,i),this.config.pulse&&this.applyPulse(this.scene,i,this.currentTime()),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&(this.prevPositionMap.size>0||this.prevPathMap.size>0)&&this.startTransition(),this.spatialIndex.rebuild(this.config.chartType,this.scene),this.needsFullRebuild=!1,this.lastLayout={width:e.width,height:e.height},this.version++}get quadtree(){return this.spatialIndex.quadtree}get maxPointRadius(){return this.spatialIndex.maxPointRadius}remapScene(e){const t=e.width/this.lastLayout.width,n=e.height/this.lastLayout.height;for(const e of this.scene)switch(e.type){case"line":for(const o of e.path)o[0]*=t,o[1]*=n;break;case"area":for(const o of e.topPath)o[0]*=t,o[1]*=n;for(const o of e.bottomPath)o[0]*=t,o[1]*=n;e.clipRect&&(e.clipRect={x:e.clipRect.x*t,y:e.clipRect.y*n,width:e.clipRect.width*t,height:e.clipRect.height*n});break;case"point":case"glyph":e.x*=t,e.y*=n;break;case"rect":case"heatcell":e.x*=t,e.y*=n,e.w*=t,e.h*=n;break;case"candlestick":e.x*=t,e.openY*=n,e.closeY*=n,e.highY*=n,e.lowY*=n}const o=this.scales.x.domain(),r=this.scales.y.domain(),i=this.scales.x.range(),s=this.scales.y.range(),a=Rt,l=Math.max(0,Math.min(this.config.scalePadding||0,Math.min(e.width,e.height)/2-1)),c=s[1]>s[0];this.scales={x:a(this.config.xScaleType,o,i[0]>i[1]?[e.width-l,l]:[l,e.width-l]),y:a(this.config.yScaleType,r,c?[l,e.height-l]:[e.height-l,l])},this.lastLayout={width:e.width,height:e.height},this.spatialIndex.rebuild(this.config.chartType,this.scene),this.version++}buildSceneNodes(e,t){const{config:n,scales:o}=this;if(!o)return[];if(n.customLayout){const r={data:t,scales:o,dimensions:{width:e.width,height:e.height,margin:n.layoutMargin??{top:0,right:0,bottom:0,left:0},plot:{x:0,y:0,width:e.width,height:e.height}},theme:{semantic:n.themeSemantic??{},categorical:n.themeCategorical??ze},resolveColor:(e,t)=>{const o=this.resolveGroupColor(e);if(o)return o;const r=this.resolveLineStyle(e,t);return r.stroke?r.stroke:"string"==typeof r.fill?r.fill:n.themeSemantic?.primary??"#4e79a7"},config:n.layoutConfig??{},selection:n.layoutSelection??null};let i;try{i=n.customLayout(r)}catch(e){const t=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}}("xy",e,t,this.version);this.lastCustomLayoutFailure=o,this._customLayoutFailedThisBuild=!0,"production"!==process.env.NODE_ENV&&console.error("[semiotic] customLayout threw:",e);try{n.onLayoutError?.(o)}catch(e){"production"!==process.env.NODE_ENV&&console.error("[semiotic] onLayoutError threw:",e)}return t?this.scene:(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,[])}this.customLayoutOverlays=i.overlays??null,this.lastCustomLayoutResult=i,this.lastCustomLayoutFailure=null;const s=i.nodes??[];if(this._customRestyle=i.restyle,this.hasCustomRestyle=!!i.restyle,this.hasCustomRestyle){this._baseStyles=new WeakMap;for(const e of s)e.style&&this._baseStyles.set(e,e.style);this.applyCustomRestyle(s,n.layoutSelection??null)}return function(e){if("production"===process.env.NODE_ENV)return;const{label:t,nodes:n,overlays:o,warned:r}=e;At(o)&&0===n.length&&St(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)&&St(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:"customLayout",nodes:s,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned}),s}if(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,0===t.length)return[];const r={scales:o,config:n,getX:this.getX,getY:this.getY,getY0:this.getY0,getSize:this.getSize,getColor:this.getColor,getSymbol:this.getSymbol,getGroup:this.getGroup,getCategory:this.getCategory,getPointId:this.getPointId,ribbons:this.resolvedRibbons,getOpen:this.getOpen,getHigh:this.getHigh,getLow:this.getLow,getClose:this.getClose,resolveLineStyle:(e,t)=>this.resolveLineStyle(e,t),resolveAreaStyle:(e,t)=>this.resolveAreaStyle(e,t),resolveBoundsStyle:(e,t)=>this.resolveBoundsStyle(e,t),resolveColorMap:e=>this.resolveColorMap(e),resolveGroupColor:e=>this.resolveGroupColor(e),groupData:e=>this.groupData(e),barCategoryCache:this._barCategoryCache};switch(n.chartType){case"line":return function(e,t){const n=e.groupData(t),o=[],r=e.config.annotations?.filter(ft).map(e=>({value:e.value,color:e.color,thresholdType:e.thresholdType||"greater"}));if(e.ribbons&&e.ribbons.length>0){const{perSeries:r,aggregate:i}=lt(e.ribbons);if(i.length>0&&o.push(...ct(e,t,i)),r.length>0)for(const t of n)o.push(...ut(e,t.data,t.key,r))}for(const t of n){const n=e.resolveLineStyle(t.key,t.data[0]),i=Je(t.data,e.scales,e.getX,e.getY,n,t.key);r&&r.length>0&&(i.colorThresholds=r),e.config.curve&&"linear"!==e.config.curve&&(i.curve=e.config.curve),e.config.lineGradient&&(i.strokeGradient=e.config.lineGradient),o.push(i)}return dt(e,n,o),o}(r,t);case"area":return function(e,t){const n=e.groupData(t),o=[];if(e.ribbons&&e.ribbons.length>0){const{perSeries:r,aggregate:i}=lt(e.ribbons);if(i.length>0&&o.push(...ct(e,t,i)),r.length>0)for(const t of n)o.push(...ut(e,t.data,t.key,r))}const r=e.scales.y.domain()[0],i=e.getY0?t=>{const n=e.getY0(t);return null==n?r:n}:void 0;for(const t of n){const n=e.resolveAreaStyle(t.key,t.data[0]),s=et(t.data,e.scales,e.getX,e.getY,r,n,t.key,i),a=yt(e.config.gradientFill);a&&(s.fillGradient=a),e.config.curve&&"linear"!==e.config.curve&&(s.curve=e.config.curve),e.config.lineGradient&&(s.strokeGradient=e.config.lineGradient),o.push(s)}return dt(e,n,o),o}(r,t);case"mixed":return function(e,t){const n=e.groupData(t),o=[],r=e.config.areaGroups||new Set;if(e.ribbons&&e.ribbons.length>0){const{perSeries:r,aggregate:i}=lt(e.ribbons);if(i.length>0&&o.push(...ct(e,t,i)),r.length>0)for(const t of n)o.push(...ut(e,t.data,t.key,r))}const i=e.scales.y.domain()[0],s=e.getY0?t=>{const n=e.getY0(t);return null==n?i:n}:void 0;for(const t of n)if(r.has(t.key)){const n=e.resolveAreaStyle(t.key,t.data[0]),r=et(t.data,e.scales,e.getX,e.getY,i,n,t.key,s),a=yt(e.config.gradientFill);a&&(r.fillGradient=a),e.config.curve&&"linear"!==e.config.curve&&(r.curve=e.config.curve),e.config.lineGradient&&(r.strokeGradient=e.config.lineGradient),o.push(r)}else{const n=e.resolveLineStyle(t.key,t.data[0]),r=Je(t.data,e.scales,e.getX,e.getY,n,t.key);e.config.curve&&"linear"!==e.config.curve&&(r.curve=e.config.curve),e.config.lineGradient&&(r.strokeGradient=e.config.lineGradient),o.push(r)}return dt(e,n,o),o}(r,t);case"stackedarea":return function(e,t){const n=e.groupData(t),o=e.config.stackOrder??"key",r=()=>n.sort((e,t)=>t.key>e.key?-1:e.key>t.key?1:0);if("input"===o);else if("key"===o)r();else if("asc"===o||"desc"===o||"insideOut"===o){const t=new Map;for(const o of n){let n=0;for(const t of o.data){const o=e.getX(t),r=e.getY(t);Number.isFinite(o)&&Number.isFinite(r)&&(n+=r)}t.set(o.key,n)}const r=(e,t)=>t>e?-1:e>t?1:0;if("asc"===o)n.sort((e,n)=>{const o=(t.get(e.key)??0)-(t.get(n.key)??0);return 0!==o?o:r(e.key,n.key)});else if("desc"===o)n.sort((e,n)=>{const o=(t.get(n.key)??0)-(t.get(e.key)??0);return 0!==o?o:r(e.key,n.key)});else{const e=[...n].sort((e,n)=>{const o=(t.get(n.key)??0)-(t.get(e.key)??0);return 0!==o?o:r(e.key,n.key)}),o=[],i=[];let s=0,a=0;for(const n of e)a>s?(o.push(n),s+=t.get(n.key)??0):(i.push(n),a+=t.get(n.key)??0);n.length=0,n.push(...i.reverse(),...o)}}else r();const i=e.config.curve&&"linear"!==e.config.curve?e.config.curve:void 0,s=e.config.normalize?"zero":e.config.baseline??"zero",{nodes:a,stackedTops:l}=function(e,t,n,o,r,i,s,a="zero"){const l=new Set;for(const t of e)for(const e of t.data){const t=n(e);Number.isFinite(t)&&l.add(t)}const c=Array.from(l).sort((e,t)=>e-t),u=new Map;for(const t of e){const e=new Map;for(const r of t.data){const t=n(r),i=o(r);Number.isFinite(t)&&Number.isFinite(i)&&e.set(t,(e.get(t)||0)+i)}u.set(t.key,e)}let h;if(i){h=new Map;for(const t of c){let n=0;for(const o of e)n+=u.get(o.key)?.get(t)||0;h.set(t,n||1)}}const d=tt(c,e.map(e=>e.key),(e,t)=>u.get(e)?.get(t)||0,a),f="diverging"===a&&!i,p=[],y=new Map,m=new Map,g=new Map,x=new Map;for(const e of c)m.set(e,d.get(e)??0),g.set(e,0),x.set(e,0);for(const n of e){const e=u.get(n.key),o=new Map;let a=[],l=[];const d=()=>{if(a.length>=2){const e={type:"area",topPath:a,bottomPath:l,style:r(n.key,n.data[0]),datum:n.data,group:n.key};s&&(e.curve=s),p.push(e)}a=[],l=[]};for(const n of c){const r=e.has(n);let s,c,u=r?e.get(n):0;if(i&&r&&(u/=h.get(n)),!r||!Number.isFinite(u)||0===u){d();continue}f?u>0?(s=g.get(n),c=s+u,g.set(n,c)):(s=x.get(n),c=s+u,x.set(n,c)):(s=m.get(n),c=s+u,m.set(n,c));const p=t.x(n);l.push([p,t.y(s)]),a.push([p,t.y(c)]),o.set(n,c)}d(),y.set(n.key,o)}return{nodes:p,stackedTops:y}}(n,e.scales,e.getX,e.getY,(t,n)=>e.resolveAreaStyle(t,n),e.config.normalize,i,s),c=a;if(e.config.pointStyle){const t=new WeakMap;for(const o of n){const n=l.get(o.key);if(n)for(const r of o.data){const o=e.getX(r),i=e.getY(r);null==o||Number.isNaN(o)||null==i||Number.isNaN(i)||!n.has(o)||t.set(r,n.get(o))}}const o=n=>t.get(n)??e.getY(n);dt(e,n,c,o)}return c}(r,t);case"scatter":case"bubble":return function(e,t){const n=[],o="bubble"===e.config.chartType?10:5,r=e.config.sizeRange||[3,15];let i=null;if(e.getSize&&!e.config.pointStyle){const n=t.map(t=>e.getSize(t)).filter(e=>null!=e&&!Number.isNaN(e));if(n.length>0){let e=1/0,t=-1/0;for(const o of n)e>o&&(e=o),o>t&&(t=o);i=n=>e===t?(r[0]+r[1])/2:r[0]+(n-e)/(t-e)*(r[1]-r[0])}}const s=e.getColor?e.resolveColorMap(t):null,a=e.config.themeSemantic?.primary||"#4e79a7",l=e.getSymbol,c=e.config.symbolMap,u=new Map;let h=0;const d=e=>{const t=c?.[e];if(t)return t;let n=u.get(e);return n||(n=xt[h%xt.length],h++,u.set(e,n)),n};for(const r of t){let t=e.config.pointStyle?e.config.pointStyle(r):{fill:a,opacity:.8},c=t.r||o;if(i&&e.getSize){const t=e.getSize(r);null==t||Number.isNaN(t)||(c=i(t))}if(s&&e.getColor&&!t.fill){const n=e.getColor(r);n&&s.has(n)&&(t={...t,fill:s.get(n)})}const u=e.getPointId?e.getPointId(r)+"":void 0;if(l){const o=d(l(r)+""),i=ot(r,e.scales,e.getX,e.getY,Math.PI*c*c,o,t,u);i&&n.push(i)}else{const o=nt(r,e.scales,e.getX,e.getY,c,t,u);o&&n.push(o)}}return n}(r,t);case"heatmap":return function(e,t,n){if(e.config.heatmapAggregation)return function(e,t,n){const o=Math.max(1,Math.floor(e.config.heatmapXBins??20)),r=Math.max(1,Math.floor(e.config.heatmapYBins??20)),i=e.config.heatmapAggregation??"count",s=de(e.config.valueAccessor,"value");if(!e.scales||0===t.length)return[];const[a,l]=e.scales.x.domain(),[c,u]=e.scales.y.domain(),h=(l-a||1)/o,d=(u-c||1)/r,f=o*r;if(f>1e6)return[];const p=new Int32Array(f),y=new Float64Array(f);for(let n=0;t.length>n;n++){const i=t[n],l=e.getX(i),u=e.getY(i);if(!isFinite(l)||!isFinite(u))continue;const f=Math.min(Math.floor((l-a)/h),o-1),m=Math.min(Math.floor((u-c)/d),r-1);if(0>f||0>m)continue;const g=m*o+f;p[g]++;const x=s(i);y[g]+=isFinite(x)?x:0}let m=1/0,g=-1/0;for(let e=0;f>e;e++){if(0===p[e])continue;let t;switch(i){case"sum":t=y[e];break;case"mean":t=y[e]/p[e];break;default:t=p[e]}m>t&&(m=t),t>g&&(g=t)}if(!isFinite(m))return[];const x=g-m||1,b=n.width/o,v=n.height/r,k=e.config.showValues,w=e.config.heatmapValueFormat,A=[];for(let e=0;r>e;e++){const t=e*o;for(let n=0;o>n;n++){const o=t+n;if(0===p[o])continue;let s;switch(i){case"sum":s=y[o];break;case"mean":s=y[o]/p[o];break;default:s=p[o]}const l=(s-m)/x;A.push(it(n*b,(r-1-e)*v,b,v,`rgb(${220-(180*l+.5)|0},${220-(100*l+.5)|0},${255-(50*l+.5)|0})`,{xi:n,yi:e,value:s,count:p[o],sum:y[o],xCenter:a+(n+.5)*h,yCenter:c+(e+.5)*d,agg:i},k?{value:s,showValues:!0,valueFormat:w}:void 0))}}return A}(e,t,n);if(0===t.length)return[];const o=de(e.config.valueAccessor,"value"),r=fe(e.config.xAccessor,"x"),i=fe(e.config.yAccessor,"y"),s=new Map,a=new Map,l=Array(t.length),c=Array(t.length);for(let e=0;t.length>e;e++){const n=t[e],o=r(n),u=i(n);l[e]=o,c[e]=u,s.has(o)||s.set(o,s.size),a.has(u)||a.set(u,a.size)}const u=s.size,h=a.size;if(0===u||0===h)return[];const d=Array.from(s.keys()),f=Array.from(a.keys()),p=d.every(e=>"number"==typeof e&&!isNaN(e)),y=f.every(e=>"number"==typeof e&&!isNaN(e));if(p){d.sort((e,t)=>Number(e)-Number(t)),s.clear();for(let e=0;d.length>e;e++)s.set(d[e],e)}if(y){f.sort((e,t)=>Number(e)-Number(t)),a.clear();for(let e=0;f.length>e;e++)a.set(f[e],e)}const m=new Float64Array(t.length),g=new Float64Array(t.length),x=Array(t.length),b=new Map;let v=0;for(let e=0;t.length>e;e++){const n=t[e],r=s.get(l[e]),i=a.get(c[e]);if(void 0===r||void 0===i)continue;const h=o(n),d=i*u+r,f=b.get(d);let p;void 0!==f?p=f:(p=v++,b.set(d,p)),m[p]=d,g[p]=h,x[p]=n}let k=1/0,w=-1/0;for(let e=0;v>e;e++){const t=g[e];isFinite(t)&&(k>t&&(k=t),t>w&&(w=t))}if(!isFinite(k)||!isFinite(w))return[];const A=function(e){const t=e in Oe?e:"blues";let n=kt.get(t);if(n)return n;n=Array(256);const o=Be(t);for(let e=0;256>e;e++)n[e]=o(e/255);return kt.set(t,n),n}("string"==typeof e.config.colorScheme?e.config.colorScheme:e.config.themeSequential||"blues"),S=255/(w-k||1),C=n.width/u,M=n.height/h,j=e.config.showValues,_=e.config.heatmapValueFormat,R=[];for(let e=0;v>e;e++){const t=g[e];if(!isFinite(t))continue;const n=m[e],o=n%u;R.push(it(o*C,(h-1-(n-o)/u)*M,C,M,A[Math.min((t-k)*S+.5|0,255)],x[e],j?{value:t,showValues:!0,valueFormat:_}:void 0))}return R}(r,t,e);case"bar":{const e=function(e,t){if(!e.config.binSize)return{nodes:[],binBoundaries:[]};const n=wt(t,e.getX,e.getY,e.config.binSize,e.getCategory);if(0===n.size)return{nodes:[],binBoundaries:[]};let o=null;if(e.getCategory){const t=new Set;for(const e of n.values())for(const n of e.categories.keys())t.add(n);const r=e.config.barColors?Object.keys(e.config.barColors):[],i=new Set(r),s=Array.from(t).filter(e=>!i.has(e)).sort(),a=r.filter(e=>t.has(e)),l=a.join("\0")+""+s.join("\0");e.barCategoryCache&&e.barCategoryCache.key===l?o=e.barCategoryCache.order:(o=[...a,...s],e.barCategoryCache={key:l,order:o})}const r=[],i=e.scales,[s,a]=i.x.domain(),l=e.config.barStyle,c=e.config.themeSemantic?.primary,u=l?.gap,h="number"!=typeof u||0>u?1:u,d={};l?.stroke&&(d.stroke=l.stroke),"number"==typeof l?.strokeWidth&&(d.strokeWidth=l.strokeWidth),"number"==typeof l?.opacity&&(d.opacity=l.opacity);for(const t of n.values()){const n=Math.max(t.start,s),u=Math.min(t.end,a);if(n>=u)continue;const f=i.x(n),p=i.x(u),y=Math.abs(p-f),m=y>h+1?h:0,g=Math.min(f,p)+m/2,x=Math.max(y-m,1);if(x>0)if(o&&t.categories.size>0){let n=0;for(const s of o){const o=t.categories.get(s)||0;if(0===o)continue;const a=i.y(n),u=i.y(n+o);r.push(rt(g,Math.min(a,u),x,Math.abs(a-u),{fill:e.config.barColors?.[s]||l?.fill||c||"#4e79a7",...d},{binStart:t.start,binEnd:t.end,total:t.total,category:s,categoryValue:o},s)),n+=o}}else{const e=i.y(0),n=i.y(t.total);r.push(rt(g,Math.min(e,n),x,Math.abs(e-n),{fill:l?.fill||c||"#007bff",...d},{binStart:t.start,binEnd:t.end,total:t.total}))}}const f=new Set;for(const e of n.values())f.add(e.start),f.add(e.end);return{nodes:r,binBoundaries:Array.from(f).sort((e,t)=>e-t)}}(r,t);return this._barCategoryCache=r.barCategoryCache??null,this._binBoundaries=e.binBoundaries,e.nodes}case"swarm":return function(e,t){const n=[],o=e.config.swarmStyle||{},r=o.radius??3,i=o.fill??e.config.themeSemantic?.primary??"#007bff",s=o.opacity??.7,a=o.stroke,l=o.strokeWidth;for(const o of t){const t=e.getX(o),c=e.getY(o);if(null==c||Number.isNaN(c))continue;const u=e.scales.x(t),h=e.scales.y(c);let d=i;if(e.getCategory){const t=e.getCategory(o);d=e.config.barColors?.[t]||d}const{r:f,...p}=e.config.pointStyle?.(o)??{},y={type:"point",x:u,y:h,r:f??r,style:{fill:d,opacity:s,stroke:a,strokeWidth:l,...p},datum:o};e.getPointId&&(y.pointId=e.getPointId(o)+""),n.push(y)}return n}(r,t);case"waterfall":return function(e,t,n){const o=[],r=e.scales,i=e.config.waterfallStyle,s=t.filter(t=>{const n=e.getY(t),o=e.getX(t);return null!=n&&!Number.isNaN(n)&&null!=o&&isFinite(o)});if(0===s.length)return o;const a=i?.positiveColor??e.config.themeSemantic?.success??"#28a745",l=i?.negativeColor??e.config.themeSemantic?.danger??"#dc3545",c=i?.gap??1,u=i?.stroke,h=i?.strokeWidth,d=i?.opacity;let f=0;for(let t=0;s.length>t;t++){const p=s[t],y=e.getX(p),m=e.getY(p),g=f+m;let x;x=s.length-1>t?e.getX(s[t+1])-y:t>0?y-e.getX(s[t-1]):0;const b=r.x(y),v=0!==x?r.x(y+x):b+n.width/10,k=Math.min(b,v)+c/2,w=Math.max(b,v)-c/2-k;if(0>=w){f=g;continue}const A=r.y(f),S=r.y(g),C=Math.min(A,S),M=Math.abs(A-S),j={fill:0>m?l:a,stroke:u,strokeWidth:h};null!=d&&(j.opacity=d),o.push(rt(k,C,w,M,j,{...p,baseline:f,cumEnd:g,delta:m,_connectorStroke:i?.connectorStroke,_connectorWidth:i?.connectorWidth})),f=g}return o}(r,t,e);case"candlestick":return function(e,t){if(!e.getHigh||!e.getLow||!e.scales)return[];const n=e.config.candlestickRangeMode??!1;if(!(n||e.getOpen&&e.getClose))return[];const o=[],r=e.config.candlestickStyle||{},i=r.rangeColor||"#6366f1",s=n?i:r.upColor||"#28a745",a=n?i:r.downColor||"#dc3545",l=n?i:r.wickColor||"#333",c=r.wickWidth||(n?2:1),u=t.map(t=>e.getX(t)).filter(e=>null!=e&&!Number.isNaN(e)).sort((e,t)=>e-t);let h=r.bodyWidth??0;if(null==r.bodyWidth)if(u.length>1){let t=1/0;for(let n=1;u.length>n;n++){const o=Math.abs(e.scales.x(u[n])-e.scales.x(u[n-1]));o>0&&t>o&&(t=o)}h=t!==1/0?Math.max(2,Math.min(.6*t,20)):6}else h=6;for(const r of t){const t=e.getX(r);if(null==t||Number.isNaN(t))continue;const i=e.getHigh(r),u=e.getLow(r);if(null==i||Number.isNaN(i)||null==u||Number.isNaN(u))continue;const d=n?i:e.getOpen(r),f=n?u:e.getClose(r);if(!n&&[d,f].some(e=>null==e||Number.isNaN(e)))continue;const p=f>=d,y={type:"candlestick",x:e.scales.x(t),openY:e.scales.y(d),closeY:e.scales.y(f),highY:e.scales.y(i),lowY:e.scales.y(u),bodyWidth:h,upColor:s,downColor:a,wickColor:l,wickWidth:c,isUp:p,datum:r};n&&(y.isRange=!0),o.push(y)}return o}(r,t);default:return[]}}resolveBoundsStyle(e,t){return function(e,t,n,o){const r=e.boundsStyle;return"function"==typeof r?r(n||{},t):r&&"object"==typeof r?r:{fill:o(t,n).stroke||e.themeSemantic?.primary||"#4e79a7",fillOpacity:.2,stroke:"none"}}(this.config,e,t,(e,t)=>this.resolveLineStyle(e,t))}computeDecayOpacity(e,t){const n=this.config.decay;return n&&t>1?Xe(n,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._ingestVersion)return this._datumIndexCache.map;const t=Ue(e);return this._datumIndexCache={version:this._ingestVersion,map:t},t}applyDecay(e,t){this.config.decay&&function(e,t,n,o=Ue(n)){const r=n.length;if(r>1)for(const n of t){if("line"===n.type){const t=Array.isArray(n.datum)?n.datum:[];if(2>t.length)continue;const i=Array(t.length);let s=!1;for(let n=0;t.length>n;n++){const a=o.get(t[n]);null!=a?(i[n]=Xe(e,a,r),1>i[n]&&(s=!0)):i[n]=1}s&&(n._decayOpacities=i);continue}if("area"===n.type){const t=Array.isArray(n.datum)?n.datum:[],i=n.topPath?n.topPath.length:t.length;if(2>i)continue;if(t.length===i){const s=Array(i);let a=!1;for(let n=0;t.length>n;n++){const i=o.get(t[n]);null!=i?(s[n]=Xe(e,i,r),1>s[n]&&(a=!0)):s[n]=1}a&&(n._decayOpacities=s)}else{let s=1;for(const n of t){const t=o.get(n);if(null!=t){const n=Xe(e,t,r);s>n&&(s=n)}}if(1>s){const e=Array(i);e.fill(s),n._decayOpacities=e}}continue}const t=o.get(n.datum);if(null==t)continue;const i=Xe(e,t,r);"heatcell"===n.type?n.style={opacity:i}:"candlestick"===n.type?n._decayOpacity=i:n.style={...n.style,opacity:(n.style?.opacity??1)*i}}}(this.config.decay,e,t,this.getDatumIndexMap(t))}refreshPulse(e){return!0!==this.lastCustomLayoutFailure?.preservedLastGoodScene&&this.applyPulse(this.scene,this.getBufferArray(),e)}hasActivePulsesAt(e){return!!this.config.pulse&&function(e,t,n=("undefined"!=typeof performance?performance.now():Date.now())){if(!t||0===t.size)return!1;const o=e.duration??500,r=t.peek();return null!=r&&o>n-r}(this.config.pulse,this.timestampBuffer,e)}get hasActivePulses(){return this.hasActivePulsesAt(this.currentTime())}get transitionContext(){return{runtimeMode:this.config.runtimeMode,getX:this.getX,getY:this.getY,getCategory:this.getCategory}}snapshotPositions(){!function(e,t,n,o){n.clear(),o.clear();for(let r=0;t.length>r;r++){const i=t[r],s=Ze(e,i,r);s&&("point"===i.type?n.set(s,{x:i.x,y:i.y,r:i.r,opacity:i.style.opacity}):"glyph"===i.type?n.set(s,{x:i.x,y:i.y,r:i.size,opacity:i.style.opacity,glyph:i.glyph}):"rect"===i.type?n.set(s,{x:i.x,y:i.y,w:i.w,h:i.h,opacity:i.style.opacity}):"heatcell"===i.type?n.set(s,{x:i.x,y:i.y,w:i.w,h:i.h,opacity:i.style?.opacity}):"candlestick"===i.type?n.set(s,{x:i.x,y:i.openY,w:i.bodyWidth,openY:i.openY,closeY:i.closeY,highY:i.highY,lowY:i.lowY,opacity:i.style?.opacity}):"line"===i.type?o.set(s,{path:i.path.map(e=>[e[0],e[1]]),opacity:i.style?.opacity}):"area"===i.type&&o.set(s,{topPath:i.topPath.map(e=>[e[0],e[1]]),bottomPath:i.bottomPath.map(e=>[e[0],e[1]]),opacity:i.style?.opacity}))}}(this.transitionContext,this.scene,this.prevPositionMap,this.prevPathMap)}synthesizeIntroPositions(){this.prevPositionMap.clear(),this.prevPathMap.clear();const e=this.scales?.y(0)??0;for(let t=0;this.scene.length>t;t++){const n=this.scene[t],o=Ze(this.transitionContext,n,t);o&&("point"===n.type?this.prevPositionMap.set(o,{x:n.x,y:n.y,r:0,opacity:0}):"rect"===n.type?this.prevPositionMap.set(o,{x:n.x,y:e,w:n.w,h:0,opacity:n.style.opacity??1}):"heatcell"===n.type?this.prevPositionMap.set(o,{x:n.x,y:n.y,w:n.w,h:n.h,opacity:0}):"line"===n.type?(n._introClipFraction=0,this.prevPathMap.set(o,{path:n.path.map(e=>[e[0],e[1]]),opacity:n.style.opacity})):"area"===n.type&&(n._introClipFraction=0,this.prevPathMap.set(o,{topPath:n.topPath.map(e=>[e[0],e[1]]),bottomPath:n.bottomPath.map(e=>[e[0],e[1]]),opacity:n.style.opacity})))}}startTransition(){if(!this.config.transition)return;const e=function(e,t,n,o,r,i=Ve()){if(0===o.size&&0===r.size)return n;const s=t.duration??300;if(n.exitNodes.length>0){const e=new Set(n.exitNodes);n.scene=n.scene.filter(t=>!e.has(t)),n.exitNodes=[]}let a=!1;const l=new Set,c=new Set;for(let t=0;n.scene.length>t;t++){const i=n.scene[t],s=Ze(e,i,t);if(!s)continue;if(i._transitionKey=s,"line"===i.type||"area"===i.type){const e=r.get(s);if(e){if(c.add(s),"line"===i.type&&e.path&&e.path.length===i.path.length){i._targetPath=i.path.map(e=>[e[0],e[1]]),i._prevPath=e.path;for(let t=0;i.path.length>t;t++)i.path[t]=[e.path[t][0],e.path[t][1]];a=!0}else if("area"===i.type&&e.topPath&&e.bottomPath&&e.topPath.length===i.topPath.length&&e.bottomPath.length===i.bottomPath.length){i._targetTopPath=i.topPath.map(e=>[e[0],e[1]]),i._targetBottomPath=i.bottomPath.map(e=>[e[0],e[1]]),i._prevTopPath=e.topPath,i._prevBottomPath=e.bottomPath;for(let t=0;i.topPath.length>t;t++)i.topPath[t]=[e.topPath[t][0],e.topPath[t][1]];for(let t=0;i.bottomPath.length>t;t++)i.bottomPath[t]=[e.bottomPath[t][0],e.bottomPath[t][1]];a=!0}i._targetOpacity=i.style.opacity??1,i._startOpacity=e.opacity??i.style.opacity??1}else i._targetOpacity=i.style.opacity??1,i._startOpacity=0,i.style={...i.style,opacity:0},a=!0;continue}const u=o.get(s);if("point"===i.type)if(u){l.add(s);const e={x:i.x,y:i.y,r:i.r};i._targetOpacity=i.style.opacity??1,u.x===e.x&&u.y===e.y&&u.r===e.r||(i._targetX=e.x,i._targetY=e.y,i._targetR=e.r,i.x=u.x,i.y=u.y,i.r=u.r??i.r,a=!0)}else i._targetOpacity=i.style.opacity??1,i.style={...i.style,opacity:0},a=!0;else if("glyph"===i.type)if(u){l.add(s);const e={x:i.x,y:i.y,size:i.size};i._targetOpacity=i.style.opacity??1,u.x===e.x&&u.y===e.y&&u.r===e.size||(i._targetX=e.x,i._targetY=e.y,i._targetR=e.size,i.x=u.x,i.y=u.y,i.size=u.r??i.size,a=!0)}else i._targetOpacity=i.style.opacity??1,i.style={...i.style,opacity:0},a=!0;else if("rect"===i.type)if(u){l.add(s);const e={x:i.x,y:i.y,w:i.w,h:i.h};i._targetOpacity=i.style.opacity??1,u.x===e.x&&u.y===e.y&&u.w===e.w&&u.h===e.h||(i._targetX=e.x,i._targetY=e.y,i._targetW=e.w,i._targetH=e.h,i.x=u.x,i.y=u.y,i.w=u.w??i.w,i.h=u.h??i.h,a=!0)}else i._targetOpacity=i.style.opacity??1,i.style={...i.style,opacity:0},a=!0;else if("heatcell"===i.type)if(u){l.add(s);const e={x:i.x,y:i.y,w:i.w,h:i.h};i._targetOpacity=i.style?.opacity??1,u.x===e.x&&u.y===e.y&&u.w===e.w&&u.h===e.h||(i._targetX=e.x,i._targetY=e.y,i._targetW=e.w,i._targetH=e.h,i.x=u.x,i.y=u.y,i.w=u.w??i.w,i.h=u.h??i.h,a=!0)}else i._targetOpacity=i.style?.opacity??1,i.style={...i.style||{},opacity:0},a=!0;else if("candlestick"===i.type)if(u&&null!=u.openY){l.add(s);const e={x:i.x,openY:i.openY,closeY:i.closeY,highY:i.highY,lowY:i.lowY};i._targetOpacity=i.style?.opacity??1,(u.x!==e.x||u.openY!==e.openY||u.closeY!==e.closeY||u.highY!==e.highY||u.lowY!==e.lowY)&&(i._targetX=e.x,i._targetOpenY=e.openY,i._targetCloseY=e.closeY,i._targetHighY=e.highY,i._targetLowY=e.lowY,i.x=u.x,i.openY=u.openY,i.closeY=u.closeY??i.closeY,i.highY=u.highY??i.highY,i.lowY=u.lowY??i.lowY,a=!0)}else i._targetOpacity=i.style?.opacity??1,i.style={...i.style||{},opacity:0},a=!0}for(const[e,t]of r)if(!c.has(e))if(e.startsWith("l:")&&t.path){const o={type:"line",path:t.path.map(e=>[e[0],e[1]]),group:e.slice(2),style:{stroke:"#999",strokeWidth:1,opacity:t.opacity??1},_targetOpacity:0,_transitionKey:e,datum:null};n.exitNodes.push(o),a=!0}else if(e.startsWith("a:")&&t.topPath&&t.bottomPath){const o={type:"area",topPath:t.topPath.map(e=>[e[0],e[1]]),bottomPath:t.bottomPath.map(e=>[e[0],e[1]]),group:e.slice(2),style:{fill:"#999",opacity:t.opacity??1},_targetOpacity:0,_transitionKey:e,datum:null};n.exitNodes.push(o),a=!0}for(const[e,t]of o)if(!l.has(e)){if(e.startsWith("p:"))n.exitNodes.push({type:"point",x:t.x,y:t.y,r:t.r??3,style:{opacity:t.opacity??1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("g:")&&t.glyph)n.exitNodes.push({type:"glyph",x:t.x,y:t.y,size:t.r??12,glyph:t.glyph,color:"#999",accent:"#999",style:{opacity:t.opacity??1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("r:"))n.exitNodes.push({type:"rect",x:t.x,y:t.y,w:t.w??0,h:t.h??0,style:{opacity:t.opacity??1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("h:"))n.exitNodes.push({type:"heatcell",x:t.x,y:t.y,w:t.w??0,h:t.h??0,fill:"#999",datum:null,style:{opacity:t.opacity??1},_targetOpacity:0,_transitionKey:e});else if(e.startsWith("c:")){const o=t.openY??t.y;n.exitNodes.push({type:"candlestick",x:t.x,openY:o,closeY:t.closeY??o,highY:t.highY??o,lowY:t.lowY??o,bodyWidth:t.w??6,upColor:"#999",downColor:"#999",wickColor:"#999",wickWidth:1,isUp:!0,datum:null,style:{opacity:t.opacity??1},_targetOpacity:0,_transitionKey:e})}a=!0}return n.exitNodes.length>0&&(n.scene=[...n.scene,...n.exitNodes]),a&&(n.activeTransition={startTime:i,duration:s}),n}(this.transitionContext,this.config.transition,{scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},this.prevPositionMap,this.prevPathMap,this.currentTime());this.scene=e.scene,this.exitNodes=e.exitNodes,this.activeTransition=e.activeTransition}advanceTransition(e){if(!this.activeTransition||!this.config.transition)return!1;const t={scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},n=function(e,t,n,o){if(!n.activeTransition)return!1;const r=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,n.activeTransition),i=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(r,"linear"===t.easing?"linear":"ease-out-cubic");for(const e of n.scene){const t=e._transitionKey;if("point"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0;e.style.opacity=Ge(n?n.opacity??1:0,e._targetOpacity,i)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=Ge(n.x,e._targetX,i),e.y=Ge(n.y,e._targetY,i),void 0!==e._targetR&&void 0!==n.r&&(e.r=Ge(n.r,e._targetR,i))}else if("glyph"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0;e.style.opacity=Ge(n?n.opacity??1:0,e._targetOpacity,i)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=Ge(n.x,e._targetX,i),e.y=Ge(n.y,e._targetY,i),void 0!==e._targetR&&void 0!==n.r&&(e.size=Ge(n.r,e._targetR,i))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0;e.style.opacity=Ge(n?n.opacity??1:0,e._targetOpacity,i)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=Ge(n.x,e._targetX,i),e.y=Ge(n.y,e._targetY,i),void 0!==n.w&&(e.w=Ge(n.w,e._targetW,i)),void 0!==n.h&&(e.h=Ge(n.h,e._targetH,i))}else if("heatcell"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0;e.style={...e.style||{},opacity:Ge(n?n.opacity??1:0,e._targetOpacity,i)}}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=Ge(n.x,e._targetX,i),e.y=Ge(n.y,e._targetY,i),void 0!==n.w&&(e.w=Ge(n.w,e._targetW,i)),void 0!==n.h&&(e.h=Ge(n.h,e._targetH,i))}else if("candlestick"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0;e.style={...e.style||{},opacity:Ge(n?n.opacity??1:0,e._targetOpacity,i)}}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=Ge(n.x,e._targetX,i),void 0!==n.openY&&(e.openY=Ge(n.openY,e._targetOpenY,i)),void 0!==n.closeY&&(e.closeY=Ge(n.closeY,e._targetCloseY,i)),void 0!==n.highY&&(e.highY=Ge(n.highY,e._targetHighY,i)),void 0!==n.lowY&&(e.lowY=Ge(n.lowY,e._targetLowY,i))}else if("line"===e.type){void 0!==e._targetOpacity&&(e.style={...e.style,opacity:Ge(e._startOpacity??0,e._targetOpacity,i)}),void 0!==e._introClipFraction&&(e._introClipFraction=i);const t=e._prevPath,n=e._targetPath;if(t&&n&&t.length===e.path.length)for(let o=0;e.path.length>o;o++)e.path[o][0]=Ge(t[o][0],n[o][0],i),e.path[o][1]=Ge(t[o][1],n[o][1],i)}else if("area"===e.type){void 0!==e._targetOpacity&&(e.style={...e.style,opacity:Ge(e._startOpacity??0,e._targetOpacity,i)}),void 0!==e._introClipFraction&&(e._introClipFraction=i);const t=e._prevTopPath,n=e._prevBottomPath,o=e._targetTopPath,r=e._targetBottomPath;if(t&&o&&t.length===e.topPath.length)for(let n=0;e.topPath.length>n;n++)e.topPath[n][0]=Ge(t[n][0],o[n][0],i),e.topPath[n][1]=Ge(t[n][1],o[n][1],i);if(n&&r&&n.length===e.bottomPath.length)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t][0]=Ge(n[t][0],r[t][0],i),e.bottomPath[t][1]=Ge(n[t][1],r[t][1],i)}}if(r>=1){for(const e of n.scene){if(void 0!==e._targetOpacity){const t=e._targetOpacity;e.style="line"===e.type||"area"===e.type?{...e.style,opacity:0===t?0:t}:{...e.style||{},opacity:0===t?0:t},e._targetOpacity=void 0}if("point"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("glyph"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,void 0!==e._targetR&&(e.size=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else if("heatcell"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else if("candlestick"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,void 0!==e._targetOpenY&&(e.openY=e._targetOpenY),void 0!==e._targetCloseY&&(e.closeY=e._targetCloseY),void 0!==e._targetHighY&&(e.highY=e._targetHighY),void 0!==e._targetLowY&&(e.lowY=e._targetLowY),e._targetX=void 0,e._targetOpenY=void 0,e._targetCloseY=void 0,e._targetHighY=void 0,e._targetLowY=void 0}else if("line"===e.type){const t=e._targetPath;if(t)for(let n=0;e.path.length>n;n++)e.path[n]=t[n];e._prevPath=void 0,e._targetPath=void 0,e._introClipFraction=void 0}else if("area"===e.type){const t=e._targetTopPath,n=e._targetBottomPath;if(t)for(let n=0;e.topPath.length>n;n++)e.topPath[n]=t[n];if(n)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t]=n[t];e._prevTopPath=void 0,e._prevBottomPath=void 0,e._targetTopPath=void 0,e._targetBottomPath=void 0,e._introClipFraction=void 0}}if(n.exitNodes.length>0){const e=new Set(n.exitNodes);n.scene=n.scene.filter(t=>!e.has(t)),n.exitNodes=[]}return n.activeTransition=null,!1}return!0}(e,this.config.transition,t,this.prevPositionMap);return this.scene=t.scene,this.exitNodes=t.exitNodes,this.activeTransition=t.activeTransition,n}cancelIntroAnimation(){this.prevPositionMap.clear(),this.prevPathMap.clear(),this.activeTransition=null;for(const e of this.scene)"line"!==e.type&&"area"!==e.type||(e._introClipFraction=void 0)}groupData(e){const{result:t,cache:n}=function(e,t,n,o){if(o&&o.version===n&&o.group===t&&o.data===e)return{result:o.result,cache:o};let r;if(t){const n=new Map;for(const o of e){const e=t(o);n.has(e)||n.set(e,[]),n.get(e).push(o)}r=Array.from(n.entries()).map(([e,t])=>({key:e,data:t}))}else r=[{key:"_default",data:e}];return{result:r,cache:{version:n,group:t,data:e,result:r}}}(e,this.getGroup,this._ingestVersion,this._groupDataCache);return this._groupDataCache=n,t}resolveColorMap(e){const{map:t,cache:n}=function(e,t,n,o,r){if(r&&r.version===o)return{map:r.map,cache:r};const i=new Set;if(t)for(const n of e){const e=t(n);e&&i.add(e)}const s=Array.from(i).sort(),a=s.join("\0");if(r&&r.key===a){const e={...r,version:o};return{map:e.map,cache:e}}const l=Array.isArray(n.colorScheme)?n.colorScheme:n.themeCategorical||ze,c=new Map;for(let e=0;s.length>e;e++)c.set(s[e],l[e%l.length]);return{map:c,cache:{key:a,map:c,version:o}}}(e,this.getColor,this.config,this._ingestVersion,this._colorMapCache);return this._colorMapCache=n,t}resolveLineStyle(e,t){return function(e,t,n,o){const r=e.lineStyle;if("function"==typeof r){const e=r(n||{},t);if(e&&!e.stroke&&t){const n=o(t);if(n)return{...e,stroke:n}}return e}const i=e.themeSemantic?.primary;return r&&"object"==typeof r?{stroke:r.stroke||i||"#007bff",strokeWidth:r.strokeWidth||2,strokeDasharray:r.strokeDasharray,fill:r.fill,fillOpacity:r.fillOpacity,opacity:r.opacity}:{stroke:o(t)||i||"#007bff",strokeWidth:2}}(this.config,e,t,e=>this.resolveGroupColor(e))}resolveAreaStyle(e,t){return function(e,t,n,o){if(e.areaStyle){const r=e.areaStyle(n||{});if(r&&!r.fill&&t){const e=o(t);if(e)return{...r,fill:e,stroke:r.stroke||e}}return r}const r=e.lineStyle;if("function"==typeof r){const e=r(n||{},t);if(e&&!e.fill&&t){const n=o(t);if(n)return{...e,fill:n,stroke:e.stroke||n}}return e}const i=e.themeSemantic?.primary;if(r&&"object"==typeof r)return{fill:r.fill||r.stroke||i||"#4e79a7",fillOpacity:r.fillOpacity??.7,stroke:r.stroke||i||"#4e79a7",strokeWidth:r.strokeWidth||2};const s=o(t)||i||"#4e79a7";return{fill:s,fillOpacity:.7,stroke:s,strokeWidth:2}}(this.config,e,t,e=>this.resolveGroupColor(e))}resolveGroupColor(t){const{color:n,groupColorCounter:o}=function(e){const{group:t,colorMapCache:n,groupColorMap:o,groupColorMapCap:r,config:i}=e;let{groupColorCounter:s}=e;if(n){const e=n.map.get(t);if(e)return{color:e,groupColorCounter:s}}const a=o.get(t);if(a)return{color:a,groupColorCounter:s};const l=(Array.isArray(i.colorScheme)&&i.colorScheme.length>0?i.colorScheme:null)||(Array.isArray(i.themeCategorical)&&i.themeCategorical.length>0?i.themeCategorical:null)||ze;if(0===l.length)return{color:null,groupColorCounter:s};const c=l[s%l.length];if(s++,o.set(t,c),o.size>r){const e=o.keys().next().value;void 0!==e&&o.delete(e)}return{color:c,groupColorCounter:s}}({group:t,colorMapCache:this._colorMapCache,groupColorMap:this._groupColorMap,groupColorCounter:this._groupColorCounter,groupColorMapCap:e.GROUP_COLOR_MAP_CAP,config:this.config});return this._groupColorCounter=o,n}getBufferArray(){return!this._bufferDirty&&this._bufferArrayCache||(this._bufferArrayCache=this.buffer.toArray(),this._bufferDirty=!1),this._bufferArrayCache}getData(){return this.getBufferArray()}remove(e){if(!this.getPointId)throw Error("remove() requires pointIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=xe(e),n=this.getPointId,o=e=>t.has(n(e));!function(e,t,n){if(!t||0===t.size)return;const o=new Set;if(e.forEach((e,t)=>{n(e)&&o.add(t)}),0===o.size)return;const r=t.toArray();t.clear();for(let e=0;r.length>e;e++)o.has(e)||t.push(r[e])}(this.buffer,this.timestampBuffer,o);const r=this.buffer.remove(o);if(0===r.length)return this.updateResults.recordNoop("remove"),r;for(const e of r)this.xExtent.evict(this.getX(e)),this.evictDatumYExtent(e);return this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("remove",r.length),r}update(e,t){if(!this.getPointId)throw Error("update() requires pointIdAccessor to be configured");const n=xe(e),o=this.getPointId,r=new Set;this.buffer.forEach((e,t)=>{n.has(o(e))&&r.add(t)});const i=this.buffer.update(e=>n.has(o(e)),t);if(0===i.length)return this.updateResults.recordNoop("update"),i;for(const e of i)this.xExtent.evict(this.getX(e)),this.evictDatumYExtent(e);return this.buffer.forEach((e,t)=>{r.has(t)&&(this.xExtent.push(this.getX(e)),this.pushDatumYExtent(e))}),this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("update",i.length),i}getBinBoundaries(){return this._binBoundaries}getExtents(){return this.xExtent.min===1/0?null:{x:this.xExtent.extent,y:this.yExtent.extent}}clear(){this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.prevPathMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this._lastBoundedInsertsRef=null,this.needsFullRebuild=!0,this._bufferDirty=!0,this._bufferArrayCache=null,this._datumIndexCache=null,this.lastLayout=null,this.scales=null,this.scene=[],this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.spatialIndex.clear(),this._colorMapCache=null,this._groupDataCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this.version++,this.updateResults.recordData("clear")}get size(){return this.buffer.size}getBuffer(){return this.buffer}getXAccessor(){return this.getX}getYAccessor(){return this.getY}getCategoryAccessor(){return this.getCategory}applyCustomRestyle(e,t){const n=this._customRestyle;if(n)for(const o of e){const e=this._baseStyles.get(o)??o.style??{},r=n(o,t);o.style=r?{...e,...r}:e}}restyleScene(e){this._customRestyle?(this.applyCustomRestyle(this.scene,e),this.markStylePaintPending(),this.updateResults.recordRestyle(!0)):this.updateResults.recordRestyle(!1)}updateConfig(e){const t={...this.config},n=Object.keys(e).filter(n=>e[n]!==t[n]);"production"!==process.env.NODE_ENV&&!this.windowSizeWarned&&"windowSize"in e&&e.windowSize!==t.windowSize&&(this.windowSizeWarned=!0,console.warn(`[Semiotic] windowSize changed after mount (${t.windowSize} → ${e.windowSize}) but it is a mount-only setting — the ring buffer keeps its original capacity. Remount the chart (e.g. via a React key) to apply a new windowSize.`)),("colorScheme"in e||"themeCategorical"in e||"colorAccessor"in e)&&(this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0),("barColors"in e||"colorScheme"in e)&&(this._barCategoryCache=null),("normalize"in e||"extentPadding"in e||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e||"boundsAccessor"in e||"band"in e||"y0Accessor"in e||"openAccessor"in e||"highAccessor"in e||"lowAccessor"in e||"closeAccessor"in e||"groupAccessor"in e||"categoryAccessor"in e||"chartType"in e||"runtimeMode"in e)&&(this._stackExtentCache=null);let o=!1,r=!1;Object.assign(this.config,e),"pulse"in e&&this.syncPulseTimestampBuffer();const i="chartType"in e&&e.chartType!==t.chartType||"runtimeMode"in e&&e.runtimeMode!==t.runtimeMode;if(i||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e){const e=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode,n=e&&this.config.valueAccessor||this.config.yAccessor,s=e&&t.valueAccessor||t.yAccessor,a=i||!he(e&&this.config.timeAccessor||this.config.xAccessor,e&&t.timeAccessor||t.xAccessor),l=i||!he(n,s);(a||l)&&(e?(this.getX=de(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=de(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=de(this.config.xAccessor,"x"),this.getY=de(this.config.yAccessor,"y")),l&&this.resolvedRibbons.some(e=>"bounds"===e.kind)&&(this.resolvedRibbons=Mt(this.config)),o=!0,r=!0)}if("groupAccessor"in e&&!he(e.groupAccessor,t.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?pe(this.config.groupAccessor):void 0,o=!0),"categoryAccessor"in e&&!he(e.categoryAccessor,t.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?pe(this.config.categoryAccessor):void 0,o=!0),"sizeAccessor"in e&&!he(e.sizeAccessor,t.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?de(this.config.sizeAccessor,"size"):void 0,o=!0),"symbolAccessor"in e&&!he(e.symbolAccessor,t.symbolAccessor)&&(this.getSymbol=null!=this.config.symbolAccessor?pe(this.config.symbolAccessor):void 0,o=!0),"colorAccessor"in e&&!he(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?pe(this.config.colorAccessor):void 0,o=!0),"y0Accessor"in e&&!he(e.y0Accessor,t.y0Accessor)&&(this.getY0=this.config.y0Accessor?de(this.config.y0Accessor,"y0"):void 0,o=!0,r=!0),("boundsAccessor"in e&&!he(e.boundsAccessor,t.boundsAccessor)||"band"in e&&e.band!==t.band||"boundsStyle"in e&&e.boundsStyle!==t.boundsStyle)&&(this.resolvedRibbons=Mt(this.config),o=!0,r=!0),"pointIdAccessor"in e&&!he(e.pointIdAccessor,t.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?pe(this.config.pointIdAccessor):void 0,o=!0),"candlestick"===this.config.chartType&&(i||"openAccessor"in e&&!he(e.openAccessor,t.openAccessor)||"closeAccessor"in e&&!he(e.closeAccessor,t.closeAccessor)||"highAccessor"in e&&!he(e.highAccessor,t.highAccessor)||"lowAccessor"in e&&!he(e.lowAccessor,t.lowAccessor))){const e=null!=this.config.openAccessor,t=null!=this.config.closeAccessor;this.getOpen=e?de(this.config.openAccessor,"open"):void 0,this.getHigh=de(this.config.highAccessor,"high"),this.getLow=de(this.config.lowAccessor,"low"),this.getClose=t?de(this.config.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!e&&!t,o=!0,r=!0}if("accessorRevision"in e&&e.accessorRevision!==t.accessorRevision&&(o=!0,r=!0),!o){const n=Object.keys(e).filter(e=>!e.endsWith("Accessor")&&"timeAccessor"!==e&&"valueAccessor"!==e);for(const r of n)if(e[r]!==t[r]){o=!0;break}}o&&(r&&this.rebuildExtents(),this.needsFullRebuild=!0),this.updateResults.recordConfig(n)}updateConfigWithResult(e){return this.updateConfig(e),this.updateResults.last}};Qt.GROUP_COLOR_MAP_CAP=1e3;var Zt=Qt;Object.assign(Zt.prototype,{getLastUpdateResult:function(){return this.updateResults.last},getUpdateSnapshot:function(){return this.updateResults.last},subscribeUpdateResult:function(e){return this.updateResults.subscribe(e)},setLayoutSelection:function(e){this.config.layoutSelection=e},markStylePaintPending:function(){Lt.set(this,!0)},consumeStylePaintPending:function(){const e=!0===Lt.get(this);return Lt.delete(this),e}});var Jt=require("react"),en={sceneGeometry:0,layout:0,domain:0};function tn(e){const{domain:t,layout:n,sceneGeometry:o}=e.revisions;return{domain:t,layout:n,sceneGeometry:o}}function nn(e,t){return{sceneGeometry:Math.max(e.sceneGeometry,t.sceneGeometry),layout:Math.max(e.layout,t.layout),domain:Math.max(e.domain,t.domain)}}var on="production"!==process.env.NODE_ENV,rn={revisions:en,signature:"",sawSignals:!1,wasUnconsumed:!1,warnUnconsumed:!1},sn=class{constructor(e="scene host"){this.hostName=e,this.lastConsumed=en,this.lastObserved=en,this.lastDuplicateWarning="",this.lastUnconsumedWarning=""}observeUpdateResult(e){on&&(this.lastObserved=nn(this.lastObserved,tn(e)))}beforeCompute(e,t){if(!on)return rn;const n=nn(tn(e),this.lastObserved),o=function(e){return`${e.sceneGeometry}|${e.layout}|${e.domain}`}(n),r=!((i=n).sceneGeometry===(s=this.lastConsumed).sceneGeometry&&i.layout===s.layout&&i.domain===s.domain);var i,s;return{revisions:n,signature:o,sawSignals:e.changed.has("scene-geometry")||e.changed.has("layout")||e.changed.has("domain"),wasUnconsumed:r,warnUnconsumed:!t&&r&&this.lastUnconsumedWarning!==o}}afterCompute(e,t,n){if(on){if(t&&e.wasUnconsumed&&(this.lastConsumed=e.revisions),e.warnUnconsumed&&!t)return console.warn(`[semiotic] ${this.hostName} observed scene-affecting revisions without a scene rebuild: ${e.signature}.`),void(this.lastUnconsumedWarning=e.signature);t&&e.sawSignals&&!e.wasUnconsumed&&!n&&this.lastDuplicateWarning!==e.signature?(console.warn(`[semiotic] ${this.hostName} performed scene rebuild with unchanged scene revisions: ${e.signature}.`),this.lastDuplicateWarning=e.signature):t&&!e.sawSignals&&(this.lastDuplicateWarning="")}}},an=(0,Jt.memo)(function({store:e,diagnostics:t}){return(0,Jt.useEffect)(()=>{const n=()=>t.observeUpdateResult(e.getUpdateSnapshot());return n(),e.subscribeUpdateResult(n)},[t,e]),null}),ln=y(require("react"));function cn(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:ln.createElement(ln.Fragment,null,...t)}var un=y(require("react")),hn=require("react/jsx-runtime"),dn={isActive:!1,predicate:()=>!0},fn=un.createContext(null);function pn({value:e,children:t}){return(0,hn.jsx)(fn.Provider,{value:e,children:t})}function yn(){return un.useContext(fn)??dn}function mn(e,t){return null!=e?(0,hn.jsx)(pn,{value:t,children:e}):e}var gn=require("react");function xn(e,t,n){return n.x>e||e>n.x+n.w||n.y>t||t>n.y+n.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:n.x+n.w/2,cy:n.y+n.h/2}}function bn(e,t=30){return Math.max((e??4)+5,12,t)}function vn(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function kn(e,t){const n=vn(e);if(!n)return!1;const o=vn(t);return!o||n.getFullYear()!==o.getFullYear()||n.getMonth()!==o.getMonth()}var wn=[40,40],An=[.5,.5];function Sn(e,t){const[n,o]=e.viewBox??wn,[r,i]=e.anchor??An,s=o>0?o:1,a=Math.max(0,t)/s,l=(n>0?n:s)*a,c=s*a;return{width:l,height:c,scale:a,offsetX:-r*l,offsetY:-i*c}}function Cn(e,t){const n=Sn(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 Mn(e,t,n,o){if("none"!==e)return"color"===e||null==e?t??o:"accent"===e?n:e}var jn=null;function _n(e){if("undefined"==typeof Path2D)return null;jn||(jn=new Map);const t=jn.get(e);if(t)return t;const n=new Path2D(e);return jn.size>1024&&jn.clear(),jn.set(e,n),n}function Rn(e,t,n=0,o="horizontal"){const[r,i]=e.viewBox??wn,s=Math.min(1,Math.max(0,n)),a=Math.min(1,Math.max(0,t));return a>s?s>0||1>a?"vertical"===o?{x:0,y:i*(1-a),width:r,height:i*(a-s)}:{x:r*s,y:0,width:r*(a-s),height:i}:null:{x:0,y:0,width:0,height:0}}function Pn(e,t){const n=Sn(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 Ln(e,t,n,o,r,i=e=>e){for(const s of t.parts){const t=_n(s.d);if(!t)continue;const a=s.opacity??1,l=e.globalAlpha;1!==a&&(e.globalAlpha=l*a);const c=r?"none"===s.fill?void 0:r:Mn(s.fill,n,o);c&&(e.fillStyle=i(c),e.fill(t));const u=r?s.stroke&&"none"!==s.stroke?r:void 0:Mn(s.stroke??"none",n,o);u&&(e.strokeStyle=i(u),e.lineWidth=s.strokeWidth??1,e.lineCap=s.strokeLinecap??"butt",e.lineJoin=s.strokeLinejoin??"miter",e.stroke(t)),1!==a&&(e.globalAlpha=l)}}var In=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,Tn=new WeakMap,Nn=0,Fn=!1,On=null,Bn=null;function Dn(e,t){if(!t)return t;const n=In.exec(t);if(!n)return t;const o=e.canvas;if(!o)return n[2]?.trim()||t;!function(){if(Fn)return;if("undefined"==typeof window||"undefined"==typeof document)return;Fn=!0;const e=()=>{Nn++};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{On=window.matchMedia("(prefers-color-scheme: dark)"),Bn=e,"function"==typeof On.addEventListener?On.addEventListener("change",Bn):"function"==typeof On.addListener&&On.addListener(Bn)}catch{}}();let r=Tn.get(o);r&&r.version===Nn||(r={version:Nn,map:new Map},Tn.set(o,r));const i=r.map.get(t);if(void 0!==i)return i;const s=getComputedStyle(o).getPropertyValue(n[1]).trim()||n[2]?.trim()||t;return r.map.set(t,s),s}var Wn=null;var zn=require("react/jsx-runtime");function Hn(e){return"object"==typeof e&&null!==e&&"hatch"===e.type}function En(e){return["hatch",e.background??"transparent",e.stroke??"#000",e.lineWidth??1.5,e.spacing??6,e.angle??45,e.lineOpacity??1].join("|")}function $n(e,t){let n=2166136261;const o=En(t);for(let e=0;o.length>e;e++)n^=o.charCodeAt(e),n=Math.imul(n,16777619);return`${e}-hatch-${(n>>>0).toString(36)}`}var Yn=new Map;function qn(e,t){const{background:n="transparent",stroke:o="#000",lineWidth:r=1.5,spacing:i=6,angle:s=45,lineOpacity:a=1}=e,l=Math.max(8,Math.ceil(2*i));return(0,zn.jsxs)("pattern",{id:t,width:l,height:l,patternUnits:"userSpaceOnUse",patternTransform:0!==s?`rotate(${s})`:void 0,children:[n&&"transparent"!==n&&(0,zn.jsx)("rect",{width:l,height:l,fill:n}),(0,zn.jsx)("line",{x1:0,y1:0,x2:0,y2:l,stroke:o,strokeWidth:r,strokeOpacity:a}),(0,zn.jsx)("line",{x1:i,y1:0,x2:i,y2:l,stroke:o,strokeWidth:r,strokeOpacity:a})]},t)}function Gn(e,t,n="#4e79a7"){if(Hn(e)){const n=$n(t,e);return{fill:`url(#${n})`,def:qn(e,n)}}return e&&"string"==typeof e?{fill:e}:{fill:n}}var Vn=require("d3-shape");function Xn(e){switch(e){case"monotoneX":return Vn.curveMonotoneX;case"monotoneY":return Vn.curveMonotoneY;case"cardinal":return Vn.curveCardinal;case"catmullRom":return Vn.curveCatmullRom;case"step":return Vn.curveStep;case"stepBefore":return Vn.curveStepBefore;case"stepAfter":return Vn.curveStepAfter;case"basis":return Vn.curveBasis;case"natural":return Vn.curveNatural;default:return null}}function Un(e,t,n){if(null==t)return n;if(Hn(t)){const o=function(e,t){const n="undefined"!=typeof window&&window.devicePixelRatio||1,o=`${En(e)}@${n}`,r=Yn.get(o);if(void 0!==r)return r;const i=function(e={},t){const{background:n="transparent",stroke:o="#000",lineWidth:r=1.5,spacing:i=6,angle:s=45}=e,a=Math.max(8,Math.ceil(2*i));let l;try{l=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(Wn||(Wn=document.createElement("canvas")),Wn.width=e,Wn.height=e,Wn)}(a)}catch{return null}const c=l.getContext("2d");if(!c)return null;n&&"transparent"!==n?(c.fillStyle=n,c.fillRect(0,0,a,a)):c.clearRect(0,0,a,a),c.strokeStyle=o,c.lineWidth=r,c.lineCap="square";const u=s*Math.PI/180;if(45===s||-45===s){const e=s>0?1:-1;for(let t=-a;2*a>=t;t+=i)c.beginPath(),c.moveTo(t,0),c.lineTo(t+e*a,a),c.stroke()}else{c.save(),c.translate(a/2,a/2),c.rotate(u);const e=2*a;for(let t=-e;e>=t;t+=i)c.beginPath(),c.moveTo(-e,t),c.lineTo(e,t),c.stroke();c.restore()}return(t||c).createPattern(l,"repeat")}({background:e.background,stroke:e.stroke,lineWidth:e.lineWidth,spacing:e.spacing,angle:e.angle},t);return Yn.set(o,i),i}(t,e);return o||t.background&&Dn(e,t.background)||n}return"string"!=typeof t?t:Dn(e,t)||n}function Kn(e,t,n,o,r,i,s){if("colorStops"in t){const n=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>n.length)return null;const a=e.createLinearGradient(o,r,i,s);for(const e of n)a.addColorStop(e.offset,e.color);return a}const{topOpacity:a,bottomOpacity:l}=t;if(!Number.isFinite(a)||!Number.isFinite(l))return null;const c=Math.max(0,Math.min(1,a)),u=Math.max(0,Math.min(1,l)),h=e.createLinearGradient(o,r,i,s),[d,f,p]=function(e,t){const n=e.fillStyle,o="#010203";try{e.fillStyle=o,e.fillStyle=t}catch{return e.fillStyle=n,[78,121,167]}const r=e.fillStyle;if(e.fillStyle=n,"string"!=typeof r)return[78,121,167];if(r.toLowerCase()===o&&t.trim().toLowerCase()!==o)return[78,121,167];if(r.startsWith("#"))return[parseInt(r.slice(1,3),16),parseInt(r.slice(3,5),16),parseInt(r.slice(5,7),16)];const i=r.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return i?[+i[1],+i[2],+i[3]]:[78,121,167]}(e,n);return h.addColorStop(0,`rgba(${d},${f},${p},${c})`),h.addColorStop(1,`rgba(${d},${f},${p},${u})`),h}function Qn(e,t,n,o,r,i){const s=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>s.length)return null;const a=e.createLinearGradient(n,o,r,i);for(const e of s)a.addColorStop(e.offset,e.color);return a}var Zn=require("d3-shape"),Jn=new WeakMap;function eo(e,t){const n=Xn(t);if(!n)return e;const o=Jn.get(e);if(o)return o;const r=function(e,t,n=8){if(!t||2>e.length)return e.map(([e,t])=>[e,t]);const o=[];let r=null;const i={moveTo(e,t){r=[e,t],o.push([e,t])},lineTo(e,t){r=[e,t],o.push([e,t])},bezierCurveTo(e,t,i,s,a,l){if(!r)return r=[a,l],void o.push([a,l]);const[c,u]=r;for(let r=1;n>=r;r++){const h=r/n,d=1-h;o.push([d*d*d*c+3*d*d*h*e+3*d*h*h*i+h*h*h*a,d*d*d*u+3*d*d*h*t+3*d*h*h*s+h*h*h*l])}r=[a,l]},closePath(){},arc(){},rect(){},arcTo(){},quadraticCurveTo(e,t,n,i){r=[n,i],o.push([n,i])}};return(0,Zn.line)().x(e=>e[0]).y(e=>e[1]).curve(t).context(i)(e),o}(e,n);return Jn.set(e,r),r}function to(e,t,n,o=30,r,i=0){let s=null;if(r){const e=function(e,t,n,o,r,i=e=>e.x,s=e=>e.y,a=e=>e.r){const l=Math.max(o,r+5,12),c=t-l,u=t+l,h=n-l,d=n+l;let f=null,p=1/0;return e.visit((e,r,l,y,m)=>{if(r>u||c>y||l>d||h>m)return!0;if(!e.length){let r=e;do{const e=r.data,l=i(e)-t,c=s(e)-n,u=Math.sqrt(l*l+c*c);bn(a(e),o)>=u&&p>u&&(f=e,p=u),r=r.next}while(r)}return!1}),f?{node:f,distance:p}:null}(r,t,n,o,i);e&&(s={node:e.node,datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const i of e){let e=null;switch(i.type){case"point":if(r)break;e=oo(i,t,n,o);break;case"symbol":e=ro(i,t,n,o);break;case"glyph":e=io(i,t,n,o);break;case"line":e=so(i,t,n,o);break;case"rect":if(null==i.datum)break;e=lo(i,t,n);break;case"heatcell":e=co(i,t,n);break;case"area":if(!1===i.interactive)break;e=ho(i,t,n);break;case"candlestick":e=uo(i,t,n)}e&&o>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}function no(e,t,n){if(0===e.length)return null;if(e[0][0]>t||t>e[e.length-1][0])return null;const o=fo(e,t);if(0>o)return null;if(Math.abs(e[o][0]-t)>n)return null;let r=o,i=o;o>0&&e[o][0]>=t?(r=o-1,i=o):e.length-1>o&&(r=o,i=o+1);const[s,a]=e[r],[l,c]=e[i];return l===s?a:a+Math.max(0,Math.min(1,(t-s)/(l-s)))*(c-a)}function oo(e,t,n,o=30){const r=t-e.x,i=n-e.y,s=Math.sqrt(r*r+i*i);return s>bn(e.r,o)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:s}}function ro(e,t,n,o=30){const r=t-e.x,i=n-e.y,s=Math.sqrt(r*r+i*i);return s>bn(vt(e.size),o)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:s}}function io(e,t,n,o=30){if(null==e.datum)return null;const r=Pn(e.glyph,e.size),i=e.x+r.centerDx,s=e.y+r.centerDy,a=t-i,l=n-s,c=Math.sqrt(a*a+l*l);return c>bn(r.radius,o)?null:{node:e,datum:e.datum,x:i,y:s,distance:c}}function so(e,t,n,o=30){if(0===e.path.length)return null;const r=fo(e.path,t);if(0>r)return null;const[i,s]=e.path[r];let a;if(e.path.length>1){let o=1/0;const i=Math.max(0,r-1),s=Math.min(e.path.length-2,r);for(let r=i;s>=r;r++){const[i,s]=e.path[r],[a,l]=e.path[r+1],c=ao(t,n,i,s,a,l);o>c&&(o=c)}a=o}else{const e=t-i,o=n-s;a=Math.sqrt(e*e+o*o)}const l=e.style;return a>Math.max(5,(l.strokeWidth??l.lineWidth??1)/2+2,o)?null:{node:e,datum:Array.isArray(e.datum)&&e.datum[r]?e.datum[r]:e.datum,x:i,y:s,distance:a}}function ao(e,t,n,o,r,i){const s=r-n,a=i-o,l=s*s+a*a;if(0===l)return Math.sqrt((e-n)**2+(t-o)**2);let c=((e-n)*s+(t-o)*a)/l;return c=Math.max(0,Math.min(1,c)),Math.sqrt((e-(n+c*s))**2+(t-(o+c*a))**2)}function lo(e,t,n){const o=xn(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function co(e,t,n){const o=xn(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function uo(e,t,n){const o=e.bodyWidth/2,r=Math.min(e.openY,e.closeY);if(!(e.x-o-3>t||t>e.x+o+3||e.highY-3>n||n>e.lowY+3)){const o=r+Math.max(Math.max(e.openY,e.closeY)-r,1)/2,i=t-e.x,s=n-o;return{node:e,datum:e.datum,x:e.x,y:o,distance:Math.sqrt(i*i+s*s)}}return null}function ho(e,t,n){if(0===e.topPath.length)return null;const o=fo(e.topPath,t);if(0>o)return null;const[r,i]=e.topPath[o],s=t-r,a=n-i,l=Math.sqrt(s*s+a*a);return{node:e,datum:Array.isArray(e.datum)&&e.datum[o]?e.datum[o]:e.datum,x:r,y:i,distance:l}}function fo(e,t){if(0===e.length)return-1;let n=0,o=e.length-1;for(;o>n;){const r=n+o>>1;t>e[r][0]?n=r+1:o=r}return n>0&&Math.abs(e[n][0]-t)>=Math.abs(e[n-1][0]-t)?n-1:n}var po=require("react"),yo={fresh:1,aging:.7,stale:.45,expired:.25},mo={alpha:1,band:"fresh",isStale:!1};function go(e,t){if(!e||0>=t)return mo;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:{...yo,...e.opacities??{}}[r],band:r,isStale:"fresh"!==r}}return t>n?{alpha:e.dimOpacity??.5,band:"stale",isStale:!0}:mo}var xo=require("react/jsx-runtime");function bo({isStale:e,position:t}){return(0,xo.jsx)("div",{className:"stream-staleness-badge",style:{position:"absolute",..."top-left"===t?{top:4,left:4}:"bottom-left"===t?{bottom:4,left:4}:"bottom-right"===t?{bottom:4,right:4}:{top:4,right:4},padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",zIndex:3,background:e?"#dc3545":"#28a745",color:"white"},children:e?"STALE":"LIVE"})}var vo=require("react"),ko=y(require("react")),wo=require("react/jsx-runtime"),Ao=16,So=6,Co=10,Mo=22,jo={fill:(e,t)=>(0,wo.jsx)("rect",{style:e,width:t,height:t}),line:(e,t)=>(0,wo.jsx)("line",{style:e,x1:0,y1:0,x2:t,y2:t})};function _o(e,t,n,o,r){let i;return i="function"==typeof n?n(e):(0,jo[n])(o(e,t),r),i}function Ro({swatchSize:e}){return(0,wo.jsx)("path",{d:`M${.25*e},${.55*e} L${.45*e},${.75*e} L${.8*e},${.3*e}`,fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function Po(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}var Lo=(e,t,n,o,r,i,s,a,l,c,u)=>{const{type:h="fill",styleFn:d,items:f}=e,p=[];let y=0;const m=!(!t&&!n),g="isolate"===c||void 0===c&&null!=r,{swatchSize:x,labelGap:b,rowHeight:v}=u;return f.forEach((e,c)=>{const u=_o(e,c,h,d,x),k=Po(e,o,r),w=r&&r.size>0&&r.has(e.label);p.push((0,wo.jsxs)("g",{transform:`translate(0,${y})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:m?a===i&&c===s?0:-1:void 0,role:m?"option":void 0,"aria-selected":m&&g?w||!1:void 0,"aria-current":m&&!g&&null!=o&&e.label===o||void 0,"aria-label":e.label,onKeyDown:m?n=>{if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowDown"===n.key||"ArrowUp"===n.key){n.preventDefault();const e=(c+("ArrowDown"===n.key?1:-1)+f.length)%f.length;l(a,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:m?t=>{l(a,c),n&&n(e);const o=t.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:m?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:m?"pointer":"default",opacity:k,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[m&&(0,wo.jsx)("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:x+b+2+7*e.label.length,height:x+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),u,w&&(0,wo.jsx)(Ro,{swatchSize:x}),(0,wo.jsx)("text",{y:x/2,x:x+b,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+c)),y+=v}),p},Io=({legendGroups:e,width:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:s,focusedItemIndex:a,onFocusedIndexChange:l,legendInteraction:c,metrics:u})=>{let h=24;const d=[];return e.forEach((e,f)=>{h+=5,d.push((0,wo.jsx)("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((0,wo.jsx)("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((0,wo.jsx)("g",{className:"legend-item",transform:`translate(0,${h})`,children:Lo(e,n,o,r,i,s,a,f,l,c,u)},"legend-group-"+f)),h+=e.items.length*u.rowHeight+8}),d},To=({legendGroups:e,height:t,width:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:a,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 y=((e,t,n,o,r,i,s,a,l,c,u,h)=>{const{type:d="fill",styleFn:f,items:p}=e,y=[],{swatchSize:m,labelGap:g,itemGap:x,rowHeight:b,align:v}=u,k=!(!t&&!n),w="isolate"===c||void 0===c&&null!=r,A=p.map(e=>m+g+7*e.label.length),S=[];let C=0,M=0;A.forEach((e,t)=>{const n=0===M?e:M+x+e;h&&h>0&&M>0&&n>h?(S.push({start:C,end:t,width:M}),C=t,M=e):M=n}),p.length>0&&S.push({start:C,end:p.length,width:M}),S.forEach((e,c)=>{let u="center"===v?Math.max(0,((h??e.width)-e.width)/2):"end"===v?Math.max(0,(h??e.width)-e.width):0;for(let h=e.start;e.end>h;h++){const e=p[h],v=_o(e,h,d,f,m),S=Po(e,o,r),C=r&&r.size>0&&r.has(e.label);y.push((0,wo.jsxs)("g",{transform:`translate(${u},${c*b})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:k?a===i&&h===s?0:-1:void 0,role:k?"option":void 0,"aria-selected":k&&w?C||!1:void 0,"aria-current":k&&!w&&null!=o&&e.label===o||void 0,"aria-label":e.label,onKeyDown:k?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(a,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:k?t=>{l(a,h),n&&n(e);const o=t.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:k?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:k?"pointer":"default",opacity:S,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[k&&(0,wo.jsx)("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:m+g+2+7*e.label.length,height:m+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),v,C&&(0,wo.jsx)(Ro,{swatchSize:m}),(0,wo.jsx)("text",{y:m/2,x:m+g,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+h)),u+=A[h]+x}});const j=Math.max(0,...S.map(e=>e.width)),_=S.length;return{items:y,offset:j,totalRows:_,totalHeight:_*b}})(e,o,r,i,s,a,l,t,c,u,h,h.maxWidth??n);p+=y.offset+5,f.push({label:e.label,...y,offset:p,totalRows:y.totalRows,totalHeight:y.totalHeight}),d+=p+12});const p=h.maxWidth??n;let y=d>p?0:"center"===h.align?Math.max(0,(p-d)/2):"end"===h.align?Math.max(0,p-d):0;const m=[];return f.forEach((n,o)=>{const r=e[o];r.label&&(m.push((0,wo.jsx)("text",{transform:`translate(${y},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)),y+=16),m.push((0,wo.jsx)("g",{className:"legend-item",transform:`translate(${y},0)`,children:n.items},"legend-group-"+o)),y+=n.offset+5,e[o+1]&&m.push((0,wo.jsx)("line",{stroke:"gray",x1:y,y1:-8,x2:y,y2:(n.totalHeight||t)+0+8},"legend-top-line legend-symbol-"+o)),y+=12}),(0,wo.jsx)("g",{children:m})};function No({config:e,orientation:t="vertical",width:n=100}){const{colorFn:o,domain:r,label:i,format:s}=e,a=s||(e=>Math.round(100*e)/100+""),l="grad-legend-"+ko.useId();if("horizontal"===t){const e=12,t=Math.min(n,200),s=Math.max(0,(n-t)/2),c=[];for(let e=0;64>=e;e++){const t=e/64;c.push((0,wo.jsx)("stop",{offset:100*t+"%",stopColor:o(r[0]+t*(r[1]-r[0]))},e))}return(0,wo.jsxs)("g",{"aria-label":i||"Gradient legend",children:[(0,wo.jsx)("defs",{children:(0,wo.jsx)("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),i&&(0,wo.jsx)("text",{x:s+t/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),(0,wo.jsx)("rect",{x:s,y:0,width:t,height:e,fill:`url(#${l})`,rx:2}),(0,wo.jsx)("text",{x:s,y:e+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[0])}),(0,wo.jsx)("text",{x:s+t,y:e+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[1])})]})}const c=[];for(let e=0;64>=e;e++){const t=e/64;c.push((0,wo.jsx)("stop",{offset:100*t+"%",stopColor:o(r[1]-t*(r[1]-r[0]))},e))}return(0,wo.jsxs)("g",{"aria-label":i||"Gradient legend",children:[i&&(0,wo.jsx)("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),(0,wo.jsx)("defs",{children:(0,wo.jsx)("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:c})}),(0,wo.jsx)("rect",{x:0,y:0,width:14,height:100,fill:`url(#${l})`,rx:2}),(0,wo.jsx)("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[1])}),(0,wo.jsx)("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[0])})]})}function Fo(e){const{legendGroups:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,legendInteraction:s,title:a="Legend",width:l=100,height:c=20,orientation:u="vertical",legendLayout:h}=e,d=function(e){const t=Math.max(1,e?.swatchSize??Ao),n=Math.max(t,e?.rowHeight??Mo);return{swatchSize:t,labelGap:Math.max(0,e?.labelGap??So),itemGap:Math.max(0,e?.itemGap??Co),rowHeight:n,align:"left"===e?.align?"start":"right"===e?.align?"end":e?.align??"start",maxWidth:e?.maxWidth}}(h),[f,p]=ko.useState(0),[y,m]=ko.useState(0),g=ko.useCallback((e,t)=>{p(e),m(t)},[]),x="vertical"===u?Io({legendGroups:t||[],width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:y,onFocusedIndexChange:g,legendInteraction:s,metrics:d}):To({legendGroups:t||[],title:a,height:c,width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:y,onFocusedIndexChange:g,legendInteraction:s,metrics:d}),b=!(!n&&!o);return(0,wo.jsxs)("g",{role:b?"listbox":void 0,"aria-multiselectable":!(!b||"isolate"!==s&&(void 0!==s||null==i))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==a&&""!==a&&"vertical"===u&&(0,wo.jsx)("text",{className:"legend-title",y:16,x:l/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:a}),x]})}function Oo(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}var Bo=require("react/jsx-runtime");function Do(e){const{legend:t,totalWidth:n,totalHeight:o,margin:r,legendPosition:i="right",legendLayout:s,title:a,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:h,legendInteraction:d}=e;if(!t)return null;const f="top"===i||"bottom"===i,p=!!a,y=Math.max(0,n-r.left-r.right),m=Math.max(1,f?s?.maxWidth??y:100);let g,x;return"left"===i?(g=Math.max(4,r.left-m-10),x=r.top):"top"===i?(g=r.left,x=p?32:8):"bottom"===i?(g=r.left,x=o-r.bottom+38):(g=n-r.right+10,x=r.top),(0,Bo.jsx)("g",{transform:`translate(${g}, ${x})`,children:(b=t,"object"==typeof b&&null!==b&&"gradient"in b?(0,Bo.jsx)(No,{config:t.gradient,orientation:f?"horizontal":"vertical",width:m}):Oo(t)?(0,Bo.jsx)(Fo,{legendGroups:t.legendGroups,title:"",width:m,orientation:f?"horizontal":"vertical",legendLayout:s,customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:h,legendInteraction:d}):t)});var b}var Wo=require("react"),zo=require("d3-array");C();var Ho=require("react/jsx-runtime");function Eo(e){return"string"==typeof e?{type:e}:e}function $o({orient:e,config:t,values:n,scale:o,size:r,length:i}){const s=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),a="top"===e||"bottom"===e,l=(0,Wo.useMemo)(()=>{if(0===n.length)return null;const t=o.domain(),l=r-8;if("boxplot"===s.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)],s=i-o;return{q1:o,median:r,q3:i,whiskerLow:Math.max(t[0],o-1.5*s),whiskerHigh:Math.min(t[n-1],i+1.5*s)}}(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(a){const t=o(r),n=o(c),a=o(i),l=o(u),p=o(h),y="top"===e?-1:1,m=0;return(0,Ho.jsxs)("g",{"data-testid":"marginal-boxplot-"+e,children:[(0,Ho.jsx)("line",{x1:l,y1:m+y*(f+d/2),x2:p,y2:m+y*(f+d/2),stroke:s.fill,strokeWidth:s.strokeWidth}),(0,Ho.jsx)("line",{x1:l,y1:m+y*f,x2:l,y2:m+y*(f+d),stroke:s.fill,strokeWidth:s.strokeWidth}),(0,Ho.jsx)("line",{x1:p,y1:m+y*f,x2:p,y2:m+y*(f+d),stroke:s.fill,strokeWidth:s.strokeWidth}),(0,Ho.jsx)("rect",{x:Math.min(t,n),y:"top"===e?m-f-d:m+f,width:Math.abs(n-t),height:d,fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth}),(0,Ho.jsx)("line",{x1:a,y1:"top"===e?m-f-d:m+f,x2:a,y2:"top"===e?m-f:m+f+d,stroke:s.fill,strokeWidth:2})]})}{const t=o(r),n=o(c),a=o(i),l=o(u),p=o(h),y="left"===e?-1:1,m=0;return(0,Ho.jsxs)("g",{"data-testid":"marginal-boxplot-"+e,children:[(0,Ho.jsx)("line",{x1:m+y*(f+d/2),y1:l,x2:m+y*(f+d/2),y2:p,stroke:s.fill,strokeWidth:s.strokeWidth}),(0,Ho.jsx)("line",{x1:m+y*f,y1:l,x2:m+y*(f+d),y2:l,stroke:s.fill,strokeWidth:s.strokeWidth}),(0,Ho.jsx)("line",{x1:m+y*f,y1:p,x2:m+y*(f+d),y2:p,stroke:s.fill,strokeWidth:s.strokeWidth}),(0,Ho.jsx)("rect",{x:"left"===e?m-f-d:m+f,y:Math.min(t,n),width:d,height:Math.abs(n-t),fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth}),(0,Ho.jsx)("line",{x1:"left"===e?m-f-d:m+f,y1:a,x2:"left"===e?m-f:m+f+d,y2:a,stroke:s.fill,strokeWidth:2})]})}}const c=(0,zo.bin)().domain(t).thresholds(s.bins)(n);if(0===c.length)return null;const u=S(c.map(e=>e.length));if(0===u)return null;if("histogram"===s.type)return(0,Ho.jsx)("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(a){const i=o(t.x0),a=o(t.x1)-o(t.x0);return(0,Ho.jsx)("rect",{x:i,y:"top"===e?-4-r:4,width:Math.max(a,.5),height:r,fill:s.fill,fillOpacity:s.fillOpacity,stroke:s.stroke,strokeWidth:s.strokeWidth},n)}{const i=o(t.x0),a=o(t.x1)-o(t.x0);return(0,Ho.jsx)("rect",{x:"left"===e?-4-r:4,y:Math.min(i,i+a),width:r,height:Math.abs(a),fill:s.fill,fillOpacity:s.fillOpacity,stroke:s.stroke,strokeWidth:s.strokeWidth},n)}})});if("violin"===s.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),s=o((r.x0+r.x1)/2);n.push(a?`${s},${"top"===e?-(t-i):t-i}`:`${"left"===e?-(t-i):t-i},${s}`)}for(let r=c.length-1;r>=0;r--){const i=c[r];if(null==i.x0||null==i.x1)continue;const s=i.length/u*(l/2),h=o((i.x0+i.x1)/2);n.push(a?`${h},${"top"===e?-(t+s):t+s}`:`${"left"===e?-(t+s):t+s},${h}`)}return(0,Ho.jsx)("g",{"data-testid":"marginal-violin-"+e,children:(0,Ho.jsx)("polygon",{points:n.join(" "),fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth})})}if("ridgeline"===s.type){const t=[];if(a){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 s=null!=c[c.length-1].x1?o(c[c.length-1].x1):i;t.push(`L${s},${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 s=null!=c[c.length-1].x1?o(c[c.length-1].x1):i;t.push(`L${n},${s}`),t.push("Z")}return(0,Ho.jsx)("g",{"data-testid":"marginal-ridgeline-"+e,children:(0,Ho.jsx)("path",{d:t.join(" "),fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth})})}return null},[n,o,s,r,i,e,a,4]);return l?(0,Ho.jsx)("g",{className:"marginal-"+e,"data-testid":"marginal-"+e,children:l}):null}var Yo=y(require("react")),qo=require("react/jsx-runtime");function Go(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),r=e.split(/\s+/),i=[];let s="";for(const e of r)s&&s.length+1+e.length>o?(i.push(s),s=e):s=s?`${s} ${e}`:e;return s&&i.push(s),i}function Vo(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 Xo(e,t,n,o){if(!e)return(0,qo.jsx)("g",{className:"annotation-note"});const{label:r,title:i,orientation:s,align:a,wrap:l=120,noWrap:c}=e;if(!r&&!i)return(0,qo.jsx)("g",{className:"annotation-note"});let u=s;u||(u=Math.abs(t)>Math.abs(n)?"leftRight":"topBottom");let h=a;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]:Go(i,l):[],y=r?c?[r]:Go(r,l):[],m="leftRight"===u?"end"===d?-4:4:0;let g=0;const x=[],b=o||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";e.useHTML||e.html?x.push((0,qo.jsx)("foreignObject",{className:"annotation-note-html",x:"end"===d?m-l:"middle"===d?m-l/2:m,y:-16,width:l,height:Math.max(f,(p.length+y.length)*f+(i&&r?2:0))+f,style:{overflow:"visible"},children:(0,qo.jsxs)("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{color:b,fontSize:"12px",lineHeight:"16px",overflow:"visible",textAlign:"end"===d?"right":"middle"===d?"center":"left",whiteSpace:c?"nowrap":"normal",wordBreak:"break-word"},children:[i&&(0,qo.jsx)("div",{className:"annotation-note-title",style:{fontWeight:"bold"},children:i}),r&&(0,qo.jsx)("div",{className:"annotation-note-label",children:r})]})},"annotation-note-html")):(p.length>0&&(x.push((0,qo.jsx)("text",{className:"annotation-note-title",fill:b,textAnchor:d,fontWeight:"bold",children:p.map((e,t)=>(0,qo.jsx)("tspan",{x:m,dy:0===t?0:f,children:e},t))},"annotation-note-title")),g=p.length*f),y.length>0&&x.push((0,qo.jsx)("text",{className:"annotation-note-label",fill:b,textAnchor:d,y:g,children:y.map((e,t)=>(0,qo.jsx)("tspan",{x:m,dy:0===t?0:f,children:e},t))},"annotation-note-label")));let v=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),v=(0,qo.jsx)("line",{className:"note-line",x1:t,x2:n,y1:0,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)"})}else{const e=(p.length+y.length)*f+(y.length>0?f:0);let t=0,n=e;"bottom"===h?(t=-e,n=0):"middle"===h&&(t=-e/2,n=e/2),v=(0,qo.jsx)("line",{className:"note-line",x1:0,x2:0,y1:t,y2:n,stroke:o||"var(--semiotic-text-secondary, currentColor)"})}const k=Math.max(0,p.length+y.length-1)*f;let w=0;return"topBottom"===u?w=0>n?-(k+2):18:"leftRight"===u&&(w="middle"===h?-(k+f+(y.length>0&&p.length>0?2:0))/2+8:"bottom"===h||0>n?-(k+2):18),(0,qo.jsxs)("g",{className:"annotation-note",transform:`translate(${t},${n})`,children:[(0,qo.jsx)("g",{className:"annotation-note-content",transform:0!==w?`translate(0,${w})`:void 0,children:x}),v]})}function Uo(e,t,n,o,r){const i=[];switch(e){case"callout-circle":{const e=(t?.radius||0)+(t?.radiusPadding||0);e>0&&i.push((0,qo.jsx)("circle",{r:e,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const e=t?.width||0,o=t?.height||0;(e>0||o>0)&&i.push((0,qo.jsx)("rect",{width:e,height:o,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":t?.custom&&i.push(...Array.isArray(t.custom)?t.custom:[t.custom]);break;case"xy-threshold":{const e=o||0,s=r||0;if(void 0!==t?.x){const o=(t.x||0)-e;i.push((0,qo.jsx)("line",{x1:o,y1:(t.y1||0)-s,x2:o,y2:(t.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==t?.y){const o=(t.y||0)-s;i.push((0,qo.jsx)("line",{x1:(t.x1||0)-e,y1:o,x2:(t.x2||0)-e,y2:o,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==t?.x1||void 0!==t?.x2?i.push((0,qo.jsx)("line",{x1:(t.x1||0)-e,y1:0,x2:(t.x2||0)-e,y2:0,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===t?.y1&&void 0===t?.y2||i.push((0,qo.jsx)("line",{x1:0,y1:(t.y1||0)-s,x2:0,y2:(t.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const e=t?.type||"curly",o=t?.width??t?.height;void 0!==o&&i.push((0,qo.jsx)("path",{d:Vo(e,o,t?.depth||30,void 0===t?.width),fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return(0,qo.jsx)("g",{className:"annotation-subject",children:i})}function Ko(e,t,n,o,r,i){const s=[];let a=0,l=0;if("callout-circle"!==r&&"label"!==r||!i?.radius){if("callout-rect"===r&&i){const n=i.width||0,o=i.height||0;if(n>0||o>0){const r=n/2,i=o/2,s=e-r,c=t-i;if(0!==s||0!==c){const e=Math.abs(s),t=Math.abs(c),u=n/2,h=o/2,d=e*h>t*u?u/e:h/t;a=r+s*d,l=i+c*d}}}else if("bracket"===r&&i){const e=i.width,t=i.height,n=i.depth||30;void 0!==e?(a=e/2,l=n):void 0!==t&&(a=n,l=t/2)}}else{const n=(i.radius||0)+(i.radiusPadding||0);if(n>0&&(0!==e||0!==t)){const o=Math.atan2(t,e);a=Math.cos(o)*n,l=Math.sin(o)*n}}const c=Math.sqrt((e-a)**2+(t-l)**2);if(c>.5){const r=o||"var(--semiotic-text-secondary, currentColor)",i="curve"===n?.type;let u=Math.atan2(t-l,e-a);if(i){const o=(a+e)/2,i=(l+t)/2,h=-(t-l)/c,d=(e-a)/c,f=(n?.curve??.25)*c,p=o+h*f,y=i+d*f;s.push((0,qo.jsx)("path",{className:"connector-curve",d:`M${a},${l}Q${p},${y} ${e},${t}`,fill:"none",stroke:r},"connector-line")),u=Math.atan2(y-l,p-a)}else s.push((0,qo.jsx)("line",{x1:a,y1:l,x2:e,y2:t,stroke:r},"connector-line"));if("arrow"===n?.end){const e=10,t=16/180*Math.PI;s.push((0,qo.jsx)("path",{d:`M${a},${l}L${a+e*Math.cos(u+t)},${l+e*Math.sin(u+t)}L${a+e*Math.cos(u-t)},${l+e*Math.sin(u-t)}Z`,fill:r,stroke:"none"},"connector-arrow"))}}return(0,qo.jsx)("g",{className:"annotation-connector",children:s})}function Qo(e){const{x:t=0,y:n=0,dx:o,dy:r,nx:i,ny:s,note:a,connector:l,subject:c,type:u,color:h,className:d,disable:f,opacity:p,strokeDasharray:y,events:m={},"data-testid":g}=e,x=Array.isArray(t)?t[0]??0:t,b=Array.isArray(n)?n[0]??0:n,v=new Set(Array.isArray(f)?f:[]);let k=o||0,w=r||0;null!=i&&(k=i-x),null!=s&&(w=s-b);const A="string"==typeof u?u:"label";if("bracket"===A&&c&&0===k&&0===w)if(void 0!==c.width){k=c.width/2;const e=c.depth||30;w=e+(0>e?-5:5)}else if(void 0!==c.height){const e=c.depth||30;k=e+(0>e?-5:5),w=c.height/2}return(0,qo.jsxs)("g",{className:("annotation "+(d||"")).trim(),transform:`translate(${x},${b})`,"data-testid":g,...null!=p&&{opacity:p},...y&&{strokeDasharray:y},...m,children:[!v.has("connector")&&Ko(k,w,l,h,A,c),!v.has("subject")&&Uo(A,c,h,x,b),!v.has("note")&&Xo(a,k,w,h)]})}function Zo(e){const{noteData:t}=e,{screenCoordinates:n}=t,o="string"==typeof t.type?t.type:"label",r=t.eventListeners||t.events||{};if(t.coordinates&&n){const e=t.nx||n[0][0]+(t.dx??0),r=t.ny||n[0][1]+(t.dy??0),i=n.map((n,i)=>{const s=Object.assign({},t,{note:0===i?t.note:{label:""},x:n[0],y:n[1],nx:e,ny:r});return(0,qo.jsx)(Qo,{"data-testid":"semiotic-annotation",...s,type:o},"multi-annotation-"+i)});return(0,qo.jsx)("g",{children:i})}const i=t.note||{title:"none",label:t.label},s=`${i.label}-${i.title}-${t.i}`;return(0,qo.jsx)(Qo,{"data-testid":"semiotic-annotation",events:r,...t,type:o},s)}var Jo=require("d3-hierarchy"),er=require("d3-shape");function tr(e){return Math.round(100*e)/100}function nr(e,t=2){const n=[],o=[],r=t+1;for(let t=0;r>t;t++){let i=0;for(const[n,o]of e)null!==o&&(i+=n**t*o);n.push(i);const s=[];for(let n=0;r>n;n++){let o=0;for(const[r,i]of e)null!==i&&(o+=r**(t+n));s.push(o)}o.push(s)}o.push(n);const i=function(e,t){const n=e,o=e.length-1,r=[t];for(let e=0;o>e;e++){let t=e;for(let r=e+1;o>r;r++)Math.abs(n[e][r])>Math.abs(n[e][t])&&(t=r);for(let r=e;o+1>r;r++){const o=n[r][e];n[r][e]=n[r][t],n[r][t]=o}for(let t=e+1;o>t;t++)for(let r=o;r>=e;r--)n[r][t]-=n[r][e]*n[e][t]/n[e][e]}for(let e=o-1;e>=0;e--){let t=0;for(let i=e+1;o>i;i++)t+=n[i][e]*r[i];r[e]=(n[o][e]-t)/n[e][e]}return r}(o,r).map(tr);return{points:e.map(([e])=>[tr(e),tr(i.reduce((t,n,o)=>t+n*e**o,0))]),equation:[...i].reverse()}}function or(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 rr(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 ir(e){return null==e?null:e+""}function sr(e,t,n){return t.stickyPositionCache?.set(e,n),n}function ar(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 sr(t,n,{x:r.x,y:r.y})}const o=function(e){const t=e.data;if(!t||0===t.length)return null;const n=t[t.length-1],o=e.scales?.x??e.scales?.time,r=e.scales?.y??e.scales?.value;if(!o||!r)return null;const i=n[e.xAccessor||"x"],s=n[e.yAccessor||"y"];return null==i||null==s?null:{x:o(i),y:r(s)}}(n);return o?sr(t,n,o):null}if("semantic"===o){const o=function(e,t,n){const o=function(e){return ir(e.provenance?.stableId??e.stableId)}(e);if(!o)return null;const r=n.pointNodes?.find(e=>ir(e.pointId)===o);if(r)return sr(t,n,{x:r.x,y:r.y});const i=n.data?.find(e=>function(e){return ir(e.stableId??e.id??e.provenance?.stableId)}(e)===o);if(!i)return null;const s=or(i,n),a=rr(i,n);return null==s||null==a?null:sr(t,n,{x:s,y:a})}(e,t,n);if(o)return o}let r=null,i=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(r=t.x,i=t.y)}if(null!=r&&null!=i||(r=or(e,n),i=rr(e,n)),null!=r&&null!=i)return sr(t,n,{x:r,y:i});if("sticky"===o){const e=n.stickyPositionCache?.get(t);if(e)return e}return null}function lr(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}var cr=require("react/jsx-runtime"),ur={secondary:0,primary:3};function hr(e){return!0===e?._annotationDeferred}function dr(e){return"blended"===e?.cohesion||"layer"===e?.cohesion?e.cohesion:null}function fr(e){const t=e?.provenance?.confidence;return"number"==typeof t&&Number.isFinite(t)?Math.max(0,Math.min(1,t)):null}function pr(e){return Math.max(.72,.95-.06*e)}C();var yr=y(require("react")),[mr,gr]=Z(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const n=e.observations;return n.push(t),n.length>e.maxObservations&&n.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));function xr(e,t={}){const n=function(e){const t=e.provenance,n=e.id??e.stableId??t?.stableId;return null==n||""===n?void 0:n+""}(e);return{"data-semiotic-annotation-widget":"",...n?{"data-semiotic-annotation-id":n}:{},onClickCapture(o){const r=function(e){const t=e.nativeEvent;return"touch"===t.pointerType?"touch":0===t.detail?"keyboard":"pointer"}(o);t.onAnnotationActivate?.({annotation:e,annotationId:n,chartId:t.chartId,inputType:r}),n&&t.onObservation&&t.onObservation({type:"annotation-activate",annotationId:n,inputType:r,timestamp:Date.now(),chartType:t.chartType??"unknown",chartId:t.chartId})}}}var br=require("react/jsx-runtime"),vr="var(--semiotic-bg, #ffffff)";function kr(e){const{x:t,y:n,text:o,fill:r,fontSize:i=12,fontWeight:s,fontFamily:a,textAnchor:l="start",dominantBaseline:c,background:u,className:h}=e,d=function(e){return void 0===e||!0===e||"halo"===e?{type:"halo"}:!1===e||"none"===e?null:"box"===e?{type:"box"}:{type:e.type??"halo",...e}}(u),f=e=>(0,br.jsx)("text",{x:t,y:n,textAnchor:l,dominantBaseline:c,fill:r,fontSize:i,fontWeight:s,fontFamily:a,className:h,...e?{stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:"stroke"}:{},children:o});if(!d)return f();if("halo"===d.type)return f({stroke:d.fill??vr,strokeWidth:d.haloWidth??3});const p=d.padding??{x:6,y:3},y="number"==typeof p?p:p.x,m="number"==typeof p?p:p.y,g=function(e,t){return(e+"").length*t*.6}(o,i),x=i+2*m;let b,v;return b="middle"===l?t-g/2-y:"end"===l?t-g-y:t-y,v="middle"===c||"central"===c?n-x/2:"hanging"===c||"text-before-edge"===c?n-m:n-.8*i-m,(0,br.jsxs)("g",{className:h,children:[(0,br.jsx)("rect",{x:b,y:v,width:g+2*y,height:x,rx:d.radius??3,ry:d.radius??3,fill:d.fill??vr,fillOpacity:d.opacity??.85,stroke:d.stroke,strokeWidth:d.strokeWidth}),f()]})}var wr=require("react/jsx-runtime"),Ar={linear:er.curveLinear,monotoneX:er.curveMonotoneX,monotoneY:er.curveMonotoneY,step:er.curveStep,stepAfter:er.curveStepAfter,stepBefore:er.curveStepBefore,basis:er.curveBasis,cardinal:er.curveCardinal,catmullRom:er.curveCatmullRom};var Sr=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function Cr(e){return!!e&&"object"==typeof e&&Sr.has(function(e){return"string"==typeof e?.type?e.type:""}(e))}function Mr(e){return"primary"===e?.emphasis||!0===e?.defensive}function jr(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 _r(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 Rr=32,Pr=6,Lr=4,Ir=8,Tr=72;var Nr={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function Fr(e){if(!Or(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 Or(e){return Cr(e)}function Br(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 Dr(e,t,n,o,r){const i=e+n,s=t+o;return Math.abs(n)>Math.abs(o)?{x:0>n?i-r.width-4:i+4,y:0>o?s-r.height:s,width:r.width,height:r.height}:{x:0>n?i-r.width:i,y:0>o?s-r.height-4:s+4,width:r.width,height:r.height}}function Wr(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function zr(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 Hr(e,t,n,o,r,i,s,a){const l=Wr(e,s);let c=.4*Math.hypot(t.dx,t.dy)+80*function(e,t,n,o){const r=Math.max(0,o-e.x),i=Math.max(0,o-e.y);return(r+Math.max(0,e.x+e.width-(t-o)))*e.height+(i+Math.max(0,e.y+e.height-(n-o)))*e.width}(l,r,i,a);for(const e of n)c+=12*zr(l,e);for(const e of o)c+=4*zr(l,e);return c}function Er(e){const{annotations:t,context:n,defaultOffset:o=Rr,notePadding:r=Pr,markPadding:i=Lr,edgePadding:s=Ir,preserveManualOffsets:a=!0,routeLongConnectors:l=!0,connectorThreshold:c=Tr,density:u,progressiveDisclosure:h=!1,redundantCues:d=!1,responsive:f,mobile:p,cohesion:y,audience:m}=e,g=n.width||0,x=n.height||0,b="object"==typeof p?p:{},v=b.breakpoint??480,k=!!p&&v>=g,w=k&&!1!==b.preferShortText?t.map(Fr):t,A=k&&!u?{maxAnnotations:b.maxAnnotations??("callout-list"===b.strategy?1:2),minVisible:b.minVisible??1}:u,S=h||k&&(!1!==b.progressiveDisclosure||"callout-list"===b.strategy),C=k&&!f?b.responsive??{minWidth:v}:f,M=k&&!y?b.cohesion:y;if(0===w.length||0>=g||0>=x)return w.slice();const j=[],_=function(e,t){return(e.pointNodes||[]).map(e=>{const n=Math.max(1,e.r||1)+t;return{x:e.x-n,y:e.y-n,width:2*n,height:2*n}})}(n,i);let R=!1;const P=w.map((e,t)=>{if(!Or(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?ar(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=[...Br("string"==typeof e.title?e.title:void 0,t),...Br("string"==typeof e.label?e.label:void 0,t)],o=n.reduce((e,t)=>Math.max(e,t.length),0);return{width:Math.max(24,Math.min(t,7*o)+10),height:Math.max(18,16*n.length+6)}}(e);if(a&&("number"==typeof(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 j.push(Wr(Dr(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=Hr(Dr(i.x,i.y,e.dx,e.dy,u),e,j,_,g,x,r,s);f>t&&(d=e,f=t)}if(!d)return e;const p=Wr(Dr(i.x,i.y,d.dx,d.dy,u),r);j.push(p);const y=Math.hypot(d.dx,d.dy),m=l&&y>=c&&"text"!==e.type&&"widget"!==e.type?{...e.connector||{end:"arrow"},type:"curve"}:e.connector;return R=!0,{...e,dx:d.dx,dy:d.dy,...m?{connector:m}:{}}}),L=R?P:w.slice();let I=L;if(d){let e=!1;const t=L.map(t=>{const n=function(e){return"text"!==e.type||"string"!=typeof e.color||8>Math.hypot("number"==typeof e.dx?e.dx:0,"number"==typeof e.dy?e.dy:0)?e:{...e,_redundantConnector:!0}}(t);return n!==t&&(e=!0),n});I=e?t:L}{let e=!1;const t=I.map(t=>{if(!0!==t?.defensive)return t;const n=function(e){const t=e?.provenance;if(!t||"object"!=typeof t)return e;const n="string"==typeof t.source?Nr[t.source]??t.source:null,o="number"==typeof t.confidence&&Number.isFinite(t.confidence)?Math.round(100*Math.max(0,Math.min(1,t.confidence)))+"%":null;if(!n&&!o)return e;if(null!=e.label&&"string"!=typeof e.label)return e;const r=[n,o].filter(Boolean).join(" · "),i="string"==typeof e.label?e.label:"";return i.includes(`(${r})`)?e:{...e,label:i?`${i} (${r})`:`(${r})`}}(t);return n!==t&&(e=!0),n});I=e?t:I}const T=new Set;if(A){const e="object"==typeof A?A:{},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}(m),n=1===t?e:{...e,maxAnnotations:Math.max(0,Math.round((e.maxAnnotations??jr(g,x,e))*t))},{deferred:o}=function(e){const{annotations:t,width:n,height:o}=e,r=Math.max(0,e.minVisible??1),i=jr(n,o,e),s=t.map((e,t)=>{return{annotation:e,index:t,note:(n=e,Cr(n))};var n}),a=s.filter(e=>e.note);if(0===a.length||i>=a.length)return{visible:t.slice(),deferred:[],budget:i};const l=a.filter(e=>Mr(e.annotation)),c=a.filter(e=>!Mr(e.annotation)).sort((e,t)=>_r(t.annotation)-_r(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 s)!n||h.has(t)?d.push(e):f.push(e);return{visible:d,deferred:f,budget:i}}({annotations:I,width:g,height:x,...n});for(const e of o)T.add(e)}if(C&&("object"==typeof C&&"number"==typeof C.minWidth?C.minWidth:480)>=g)for(const e of I)Or(e)&&"secondary"===e.emphasis&&T.add(e);if(T.size>0)for(const e of I)!0===e?.defensive&&T.delete(e);let N;return N=0===T.size?I:S?I.map(e=>T.has(e)?{...e,_annotationDeferred:!0}:e):I.filter(e=>!T.has(e)),M?function(e,t){let n=!1;const o=e.map(e=>Or(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(n=!0,{...e,cohesion:t}):e);return n?o:e}(N,M):N}var $r=require("react"),Yr={positions:new Map},qr=new Set;function Gr(){for(const e of qr)e()}function Vr(e,t){const n=Yr.positions.get(e);if(n?.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(Yr.positions);o.delete(e),Yr={positions:o},Gr()}function Xr(e,t){const n=Yr.positions.get(e);if(!n?.locked)return;if(t&&n.sourceId!==t)return;const o=new Map(Yr.positions);o.delete(e),Yr={positions:o},Gr()}function Ur(){return Yr}function Kr(e){return qr.add(e),()=>qr.delete(e)}var Qr={positions:new Map};function Zr(){return()=>{}}function Jr(){return Qr}function ei(e,t,n){return"exact"===n?function(e,t){const n=e.domain(),o=n[0],r=n[n.length-1],i=o instanceof Date,s=o instanceof Date?o.getTime():o,a=r instanceof Date?r.getTime():r;if(2>t||s===a)return i?[new Date(s),new Date(a)]:[s,a];const l=(a-s)/(t-1),c=Array(t);for(let e=0;t>e;e++){const n=e===t-1?a:s+e*l;c[e]=i?new Date(n):n}return c}(e,t):e.ticks(t)}function ti(e,t,n){if("edges"===e){if(t)return"start";if(n)return"end"}return"middle"}function ni(e,t,n){if("edges"===e){if(t)return"hanging";if(n)return"auto"}return"middle"}function oi(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 ri(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function ii(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 s="M0,"+o;for(let e=0;i>e;e++){const n=8*(e+1);s+=`L${Math.min(8*e+4,t)},${o+4*r}`,s+=`L${Math.min(n,t)},${o}`}return s}const o="bottom"===e?0:t,r="bottom"===e?1:-1,i=Math.ceil(n/8);let s=`M${o},0`;for(let e=0;i>e;e++){const t=8*(e+1);s+=`L${o+4*r},${Math.min(8*e+4,n)}`,s+=`L${o},${Math.min(t,n)}`}return s}var si=require("react/jsx-runtime");function ai(e){const{width:t,height:n,totalWidth:o,totalHeight:r,margin:i,scales:s,showAxes:a,axes:l,showGrid:c,xFormat:u,yFormat:h,axisExtent:d}=e,f=(0,vo.useMemo)(()=>{if(!s)return[];const e=l?.find(e=>"bottom"===e.orient),n=e?.tickFormat||u||li,o=Math.max(2,Math.floor(t/70)),r=e?.ticks??5,i="exact"===d?Math.max(2,r):Math.min(r,o),a=e?.tickValues??ei(s.x,i,d),c=a.map(e=>e.valueOf()),h=a.map((e,t)=>({value:e,pixel:s.x(e),label:n(e,t,c)})),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);return ci(h,Math.max(55,f+8))},[s,l,u,t,d]),p=(0,vo.useMemo)(()=>{if(!s)return[];const e=l?.find(e=>"left"===e.orient),t=e?.tickFormat||h||li,o=Math.max(2,Math.floor(n/30)),r=e?.ticks??5,i="exact"===d?Math.max(2,r):Math.min(r,o);return ci((e?.tickValues??ei(s.y,i,d)).map(e=>({value:e,pixel:s.y(e),label:t(e)})),22)},[s,l,h,n,d]),y=c&&s,m=a&&s;if(!y&&!m)return null;const g=l?.find(e=>"bottom"===e.orient),x=l?.find(e=>"left"===e.orient),b=m&&(!g||!1!==g.baseline),v=m&&(!x||!1!==x.baseline),k=g?.jaggedBase||!1,w=x?.jaggedBase||!1,A="var(--semiotic-border, #ccc)";return(0,si.jsx)("svg",{width:o,height:r,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:(0,si.jsxs)("g",{transform:`translate(${i.left},${i.top})`,children:[y&&(()=>{const e=ri(l?.find(e=>"bottom"===e.orient)?.gridStyle),o=ri(l?.find(e=>"left"===e.orient)?.gridStyle);return(0,si.jsxs)("g",{className:"stream-grid",children:[f.map((t,o)=>(0,si.jsx)("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:n,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:e},"xgrid-"+o)),p.map((e,n)=>(0,si.jsx)("line",{x1:0,y1:e.pixel,x2:t,y2:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:o},"ygrid-"+n))]})})(),b&&!k&&(0,si.jsx)("line",{x1:0,y1:n,x2:t,y2:n,stroke:A,strokeWidth:1}),k&&(0,si.jsx)("path",{d:ii("bottom",t,n),fill:"none",stroke:A,strokeWidth:1}),v&&!w&&(0,si.jsx)("line",{x1:0,y1:0,x2:0,y2:n,stroke:A,strokeWidth:1}),w&&(0,si.jsx)("path",{d:ii("left",t,n),fill:"none",stroke:A,strokeWidth:1})]})})}function li(e,t,n){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function ci(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 ui(e){const{width:t,height:n,totalWidth:o,totalHeight:r,margin:i,scales:s,showAxes:a,axes:l,xLabel:c,yLabel:u,yLabelRight:h,xFormat:d,yFormat:f,axisExtent:p,showGrid:y,title:m,legend:g,legendHoverBehavior:x,legendClickBehavior:b,legendHighlightedCategory:v,legendIsolatedCategories:k,legendPosition:w="right",legendLayout:S,foregroundGraphics:C,marginalGraphics:M,xValues:j,yValues:_,annotations:R,onAnnotationActivate:P,onObservation:L,chartId:I,chartType:T,autoPlaceAnnotations:N,svgAnnotationRules:F,xAccessor:O,yAccessor:B,annotationData:D,pointNodes:W,curve:z,underlayRendered:H,canvasObscuresUnderlay:E=!0,linkedCrosshairName:$,linkedCrosshairSourceId:Y,children:q}=e,G=function(e){const t=gr(e=>e.pushObservation),n=yr.useCallback(n=>{e.onObservation?.(n),t?.(n)},[e,t]);return yr.useMemo(()=>({...e,onObservation:n}),[n,e])}({onAnnotationActivate:P,onObservation:L,chartId:I,chartType:T}),V=(0,vo.useMemo)(()=>{if(!a||!s)return[];const e=l?.find(e=>"bottom"===e.orient),n=e?.tickFormat||d||li,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??ei(s.x,i,p),u=c.map(e=>e.valueOf()),h=c.map((e,t)=>({value:e,pixel:s.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),y=e?.autoRotate?Math.max(20,Math.min(f+8,55)):Math.max(55,f+8);let m=ci(h,y);if(m.length>1&&(m=m.filter((e,t)=>0===t||e.label+""!=m[t-1].label+"")),e?.includeMax&&m.length>0&&"exact"!==p&&!e?.tickValues){const e=s.x.domain()[1],t=s.x(e),o=m[m.length-1].pixel;if(Math.abs(t-o)>1){const r=n(e,m.length,u);y>t-o&&m.length>1&&(m=m.slice(0,-1)),m.push({value:e,pixel:t,label:r})}}return m},[a,s,l,d,t,p]),X=(0,vo.useMemo)(()=>{if(!a||!s)return[];const e=l?.find(e=>"left"===e.orient),t=e?.tickFormat||f||li,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=ci((e?.tickValues??ei(s.y,i,p)).map(e=>({value:e,pixel:s.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=s.y.domain()[1],n=s.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},[a,s,l,f,n,p]),U=(0,vo.useMemo)(()=>{if(!a||!s)return[];const e=l?.find(e=>"right"===e.orient);if(!e)return[];const t=e.tickFormat||f||li,o=Math.max(2,Math.floor(n/30)),r=e.ticks??5;return ci((e.tickValues??ei(s.y,"exact"===p?Math.max(2,r):Math.min(r,o),p)).map(e=>({value:e,pixel:s.y(e),label:t(e)})),22)},[a,s,l,f,n,p]),K=(0,vo.useRef)(new Map),Q=(0,vo.useRef)(R?.length??0),Z=R?.length??0;Q.current!==Z&&(Q.current=Z,K.current=new Map);const J=(0,vo.useMemo)(()=>{if(!R||0===R.length)return null;const e=function(e,t={}){return function(e,n,o){switch(e.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const t=ar(e,n,o);if(!t)return null;const{x:r,y:i}=t;if(!lr(r,i,o))return null;const s="callout"===e.type?"callout-circle":e.type,a="callout-circle"===s?{radius:e.radius??12,radiusPadding:e.radiusPadding}:"callout-rect"===s?{width:e.width,height:e.height}:void 0;return(0,wr.jsx)(Zo,{noteData:{x:r,y:i,dx:e.dx??30,dy:e.dy??-30,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:s,...a?{subject:a}:{},connector:e.connector||{end:"arrow"},color:e.color,disable:e.disable,opacity:e.opacity,strokeDasharray:e.strokeDasharray,className:e.className}},"ann-"+n)}case"x-threshold":{const t=or(null!=e.value?{...e,x:e.value}:e,o);if(null==t)return null;const r=e.color||"#f97316",i=e.labelPosition||"top";let s;s="bottom"===i?(o.height||0)-4:"center"===i?(o.height||0)/2:16;const a=t>.6*(o.width||0),l=a?t-4:t+4,c=a?"end":"start";return(0,wr.jsxs)("g",{opacity:e.opacity,children:[(0,wr.jsx)("line",{x1:t,y1:0,x2:t,y2:o.height||0,stroke:r,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,wr.jsx)(kr,{x:l,y:s,text:e.label,textAnchor:c,fill:r,fontSize:12,fontWeight:"bold",background:e.labelBackground??"halo"})]},"ann-"+n)}case"y-threshold":{const t=rr(null!=e.value?{...e,y:e.value}:e,o);if(null==t)return null;const r=e.color||"#f97316",i=e.labelPosition||"right";let a,l;"left"===i?(a=4,l="start"):"center"===i?(a=(o.width||0)/2,l="middle"):(a=(o.width||0)-4,l="end");const c=20>(s=t)?Math.min((o.height||0)-4,s+16):s-4;return(0,wr.jsxs)("g",{opacity:e.opacity,children:[(0,wr.jsx)("line",{x1:0,y1:t,x2:o.width||0,y2:t,stroke:r,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,wr.jsx)(kr,{x:a,y:c,text:e.label,textAnchor:l,fill:r,fontSize:12,fontWeight:"bold",background:e.labelBackground??"halo"})]},"ann-"+n)}case"enclose":{const t=(e.coordinates||[]).map(e=>({x:or({...e,type:"point"},o),y:rr({...e,type:"point"},o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>t.length)return null;const r=(0,Jo.packEnclose)(t),i=e.padding||10;return(0,wr.jsxs)("g",{children:[(0,wr.jsx)("circle",{cx:r.x,cy:r.y,r:r.r+i,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&(0,wr.jsx)(kr,{x:r.x,y:r.y-r.r-i-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:e.label,background:e.labelBackground??"none"})]},"ann-"+n)}case"rect-enclose":{const t=(e.coordinates||[]).map(e=>({x:or({...e,type:"point"},o),y:rr({...e,type:"point"},o)})).filter(e=>null!=e.x&&null!=e.y);if(2>t.length)return null;const r=e.padding||10,i=t.map(e=>e.x),s=t.map(e=>e.y),[a,l]=A(i),[c,u]=A(s),h=a-r,d=l+r,f=c-r;return(0,wr.jsxs)("g",{children:[(0,wr.jsx)("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&&(0,wr.jsx)(kr,{x:(h+d)/2,y:f-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:e.label,background:e.labelBackground??"none"})]},"ann-"+n)}case"highlight":{const t=o.data||[],r="function"==typeof e.filter?t.filter(e.filter):e.field&&null!=e.value?t.filter(t=>t[e.field]===e.value):[],i={stroke:e.color||"#f97316",strokeWidth:2,fill:"none"};return(0,wr.jsx)("g",{children:r.map((t,n)=>{const r=or(t,o),s=rr(t,o);if(null==r||null==s)return null;const a="function"==typeof e.r?e.r(t):e.r||6,l="function"==typeof e.style?e.style(t):e.style||i;return(0,wr.jsx)("circle",{cx:r,cy:s,r:a,...l},"hl-"+n)})},"ann-"+n)}case"bracket":{const t=or(e,o),r=rr(e,o);return(0,wr.jsx)(Zo,{noteData:{x:t??0,y:r??0,dx:e.dx||0,dy:e.dy||0,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"bracket",subject:{type:e.bracketType||"curly",width:e.width,height:e.height,depth:e.depth||30},color:e.color}},"ann-"+n)}case"trend":{const t=o.data||[];if(2>t.length)return null;const r=o.xAccessor||"x",i=o.yAccessor||"y",s="ordinal"===o.frameType,a="horizontal"===o.projection,l=s?r:null,c=s?i:null;let u;const h=[],d=new Map;if(s&&l&&c){for(const e of t){const t=e[l];if(null==t)continue;const n=t+"";d.has(n)||(d.set(n,h.length),h.push(n))}u=t.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=t.map(e=>[e[r],e[i]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>u.length)return null;const f=o.scales?.x??o.scales?.time,p=o.scales?.y??o.scales?.value;if(!f||!p)return null;const y=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},m=f,g=p;let x;if(s)if(a){const e=y(g);x=(t,n)=>[m(n),e(t)]}else{const e=y(m);x=(t,n)=>[e(t),g(n)]}else x=(e,t)=>[m(e),g(t)];const b=e.method||"linear";let v;if("loess"===b)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]),s=Math.max(2,Math.ceil(t*n)),a=[];for(let e=0;n>e;e++){const t=r[e],o=r.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(s-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:o[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,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){a.push([t,i[e]]);continue}const y=u*f-h*h;if(1e-12>Math.abs(y))a.push([t,d/u]);else{const e=(u*p-h*d)/y;a.push([t,(d-e*h)/u+e*t])}}return a}(u,e.bandwidth??.3);else{const t="polynomial"===b?nr(u,e.order||2):function(e){const t=[0,0,0,0];let n=0;for(const[o,r]of e)null!==r&&(n++,t[0]+=o,t[1]+=r,t[2]+=o*o,t[3]+=o*r);const o=n*t[2]-t[0]*t[0],r=0===o?0:tr((n*t[3]-t[0]*t[1])/o),i=tr(t[1]/n-r*t[0]/n);return{points:e.map(([e])=>[tr(e),tr(r*e+i)]),equation:[r,i]}}(u);v=t.points}const k=v.map(([e,t])=>{const[n,o]=x(e,t);return`${n},${o}`}).join(" "),w=e.color||"#6366f1",A=v[v.length-1],[S,C]=x(A[0],A[1]);return(0,wr.jsxs)("g",{children:[(0,wr.jsx)("polyline",{points:k,fill:"none",stroke:w,strokeWidth:e.strokeWidth||2,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,wr.jsx)("text",{x:S+4,y:C-4,fill:w,fontSize:11,children:e.label})]},"ann-"+n)}case"band":{const t=o.scales?.y??o.scales?.value,s=t?.(e.y0)??0,a=t?.(e.y1)??(o.height||0),l=Gn(e.fill,"ann-"+n,"var(--semiotic-primary, #6366f1)");return(0,wr.jsxs)("g",{opacity:e.opacity,children:[l.def&&(0,wr.jsx)("defs",{children:l.def}),(0,wr.jsx)("rect",{x:0,y:Math.min(s,a),width:o.width||0,height:Math.abs(a-s),fill:l.fill,fillOpacity:e.fillOpacity||.1}),e.label&&(0,wr.jsx)(kr,{x:(o.width||0)-4,y:(r=s,i=a,Math.max(Math.min(r,i),0)+16),textAnchor:"end",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:e.label,background:e.labelBackground??"halo"})]},"ann-"+n)}case"x-band":{const t=o.scales?.x??o.scales?.time,r=null!=e.x0&&t?t(e.x0):null,i=null!=e.x1&&t?t(e.x1):null;if(null==r||null==i)return null;const s=Gn(e.fill||e.color,"ann-"+n,"var(--semiotic-primary, #6366f1)");return(0,wr.jsxs)("g",{opacity:e.opacity,children:[s.def&&(0,wr.jsx)("defs",{children:s.def}),(0,wr.jsx)("rect",{x:Math.min(r,i),y:0,width:Math.abs(i-r),height:o.height||0,fill:s.fill,fillOpacity:e.fillOpacity??.1}),e.label&&(0,wr.jsx)(kr,{x:Math.min(r,i)+4,y:16,textAnchor:"start",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:e.label,background:e.labelBackground??"halo"})]},"ann-"+n)}case"envelope":{const t=o.data||[];if(2>t.length)return null;const r=o.xAccessor||"x",i=o.scales?.x??o.scales?.time,s=o.scales?.y??o.scales?.value;if(!i||!s)return null;const a=e.upperAccessor||"upperBounds",l=e.lowerAccessor||"lowerBounds",c=e.filter,u=t.filter(e=>null!=e[a]&&null!=e[l]&&!(c&&!c(e))).sort((e,t)=>e[r]-t[r]);if(2>u.length)return null;const h=Ar[o.curve||"linear"]||er.curveLinear,d=(0,er.area)().x(e=>i(e[r])).y0(e=>s(e[l])).y1(e=>s(e[a])).curve(h)(u);if(!d)return null;const f=e.fill||"#6366f1";return(0,wr.jsxs)("g",{children:[(0,wr.jsx)("path",{d:d,fill:f,fillOpacity:e.fillOpacity??.15,stroke:"none"}),e.label&&u.length>0&&(0,wr.jsx)("text",{x:i(u[u.length-1][r])+4,y:s(u[u.length-1][a])-4,fill:f,fontSize:11,children:e.label})]},"ann-"+n)}case"anomaly-band":{const t=o.data||[];if(2>t.length)return null;const r=o.yAccessor||"y",i=o.scales?.x??o.scales?.time,s=o.scales?.y??o.scales?.value;if(!i||!s)return null;const a=t.map(e=>e[r]).filter(e=>null!=e&&isFinite(e));if(2>a.length)return null;const l=a.reduce((e,t)=>e+t,0)/a.length,c=a.reduce((e,t)=>e+(t-l)**2,0)/a.length,u=Math.sqrt(c),h=e.threshold??2,d=l-h*u,f=!1!==e.showBand,p=e.fill||"#6366f1",y=e.fillOpacity??.1,m=e.anomalyColor||"#ef4444",g=e.anomalyRadius??6,x=s(l+h*u),b=s(d),v=t.filter(e=>{const t=e[r];return null!=t&&Math.abs(t-l)>h*u});return(0,wr.jsxs)("g",{children:[f&&(0,wr.jsx)("rect",{x:0,y:Math.min(x,b),width:o.width||0,height:Math.abs(b-x),fill:p,fillOpacity:y}),v.map((e,t)=>{const n=or(e,o),r=rr(e,o);return null==n||null==r?null:(0,wr.jsx)("circle",{cx:n,cy:r,r:g,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5},"anomaly-"+t)}),e.label&&(0,wr.jsx)("text",{x:(o.width||0)-4,y:Math.min(x,b)-4,textAnchor:"end",fill:p,fontSize:11,children:e.label})]},"ann-"+n)}case"forecast":{const t=o.data||[];if(3>t.length)return null;const r=o.xAccessor||"x",i=o.yAccessor||"y",s=o.scales?.x??o.scales?.time,a=o.scales?.y??o.scales?.value;if(!s||!a)return null;const l=t.map(e=>[e[r],e[i]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>l.length)return null;let c;if("polynomial"===(e.method||"linear")){const t=nr(l,e.order||2).equation;c=e=>t.reduce((t,n,o)=>t+n*Math.pow(e,o),0)}else{const e=l.length;let t=0,n=0,o=0,r=0;for(const[e,i]of l)t+=e,n+=i,o+=e*e,r+=e*i;const i=e*o-t*t;if(1e-12>Math.abs(i))return null;const s=(e*r-t*n)/i,a=(n-s*t)/e;c=e=>a+s*e}const u=l.length,h=l.map(([e,t])=>t-c(e)),d=h.reduce((e,t)=>e+t*t,0),f=Math.sqrt(d/Math.max(u-2,1)),p=l.reduce((e,t)=>e+t[0],0)/u,y=l.reduce((e,t)=>e+(t[0]-p)**2,0),m=e.confidence??.95,g=.99>m?.95>m?.9>m?1:1.645:1.96:2.576,x=e.steps??5,b=l[u-1][0],v=(b-l[0][0])/Math.max(u-1,1),k=[];for(let e=1;x>=e;e++)k.push(b+e*v);const w=[];for(const e of k){const t=c(e),n=f*Math.sqrt(1+1/u+(y>0?(e-p)**2/y:0))*g;w.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const A=`M${w.map(e=>`${s(e.x)},${a(e.yUpper)}`).join(" L")} L${w.slice().reverse().map(e=>`${s(e.x)},${a(e.yLower)}`).join(" L")} Z`,S=w.map(e=>`${s(e.x)},${a(e.yCenter)}`).join(" "),C=`${s(b)},${a(c(b))}`,M=e.strokeColor||"#6366f1";return(0,wr.jsxs)("g",{children:[(0,wr.jsx)("path",{d:A,fill:e.fill||"#6366f1",fillOpacity:e.fillOpacity??.15,stroke:"none"}),(0,wr.jsx)("polyline",{points:`${C} ${S}`,fill:"none",stroke:M,strokeWidth:e.strokeWidth??2,strokeDasharray:e.strokeDasharray??"6,3"}),e.label&&w.length>0&&(0,wr.jsx)("text",{x:s(w[w.length-1].x)+4,y:a(w[w.length-1].yCenter)-4,fill:M,fontSize:11,children:e.label})]},"ann-"+n)}case"widget":{let r,i;if(null!=e.px&&null!=e.py)r=e.px,i=e.py;else{const t=ar(e,n,o);if(!t)return null;r=t.x,i=t.y}if(!lr(r,i,o))return null;const s=e.dx??0,a=e.dy??0,l=e.width??32,c=e.height??32,u=e.content??(0,wr.jsx)("span",{style:{fontSize:18,cursor:"default"},title:e.label||"Info",children:"ℹ️"});return(0,wr.jsx)("foreignObject",{x:r+s-l/2,y:i+a-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:(0,wr.jsx)("div",{...xr(e,t),style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+n)}case"text":{const t=ar(e,n,o);if(!t)return null;const{x:r,y:i}=t,s=r+(e.dx||0),a=i+(e.dy||0),l=e.color||"var(--semiotic-text, #333)",c=(0,wr.jsx)("text",{x:s,y:a,fill:l,fontSize:e.fontSize||11,opacity:e.opacity,strokeDasharray:e.strokeDasharray,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:e.label});return!0!==e._redundantConnector?Yo.cloneElement(c,{key:"ann-text-"+n}):(0,wr.jsxs)("g",{opacity:e.opacity,strokeDasharray:e.strokeDasharray,children:[(0,wr.jsx)("line",{x1:r,y1:i,x2:s,y2:a,stroke:l,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),Yo.cloneElement(c,{opacity:void 0,strokeDasharray:void 0})]},"ann-text-"+n)}case"category-highlight":{const t=e.category;if(null==t)return null;const r=e=>"function"==typeof e&&"function"==typeof e.bandwidth,i=o.scales?.o,s=o.scales?.x,a=o.scales?.y,l=r(i)?i:r(s)?s:r(a)?a:null;if(!l)return null;const c=l(t+"");if(null==c)return null;const u=l.bandwidth(),h=e.color||"var(--semiotic-primary, #4589ff)",d=e.opacity??.15,f=e.label;return(0,wr.jsxs)("g",(o.projection?"vertical"===o.projection:l===s)?{children:[(0,wr.jsx)("rect",{x:c,y:0,width:u,height:o.height||0,fill:h,fillOpacity:d}),f&&(0,wr.jsx)(kr,{x:c+u/2,y:16,textAnchor:"middle",fill:h,fontSize:12,fontWeight:"bold",text:f,background:e.labelBackground??"none"})]}:{children:[(0,wr.jsx)("rect",{x:0,y:c,width:o.width||0,height:u,fill:h,fillOpacity:d}),f&&(0,wr.jsx)(kr,{x:12,y:c+u/2,dominantBaseline:"middle",fill:h,fontSize:12,fontWeight:"bold",text:f,background:e.labelBackground??"none"})]},"ann-"+n)}default:return null}var r,i,s}}(0,G),o={scales:s?{x:s.x,y:s.y,time:s.x,value:s.y}:null,timeAxis:"x",xAccessor:O,yAccessor:B,width:t,height:n,data:D,frameType:"xy",pointNodes:W,curve:z,stickyPositionCache:K.current};return function(e,t,n,o){const r=[];return e.forEach((e,i)=>{let s;if(n){const r=n(e,i,o);s=null!=r?r:t(e,i,o)}else s=t(e,i,o);s&&r.push({node:s,annotation:e})}),function(e){const t=e.map((e,t)=>{return{p:e,i:t,emphasis:(n=e.annotation,"primary"===n?.emphasis||"secondary"===n?.emphasis?n.emphasis:null),confidence:fr(e.annotation),readingOrder:null,rank:1};var n}),n=t.some(e=>null!=e.emphasis||null!=e.confidence),o=e.some(e=>hr(e.annotation)),r=e.some(e=>null!=dr(e.annotation)),i=e.some(e=>"layer"===dr(e.annotation));if(!n&&!o&&!r)return e.map(e=>e.node);const s=t.filter(e=>null==e.emphasis&&null!=e.confidence).slice().sort((e,t)=>(t.confidence??0)-(e.confidence??0)||e.i-t.i);s.forEach((e,t)=>{e.readingOrder=t,e.rank=2-t/Math.max(1,s.length)});for(const e of t)e.emphasis&&(e.rank=ur[e.emphasis]);const a=t.sort((e,t)=>e.rank-t.rank||e.i-t.i).map(e=>{const{p:t,i:n,emphasis:o,readingOrder:r}=e,i=hr(t.annotation);let s=t.node;if("primary"===o||"secondary"===o||null!=r){const e=null==o&&null!=r;s=(0,cr.jsx)("g",{className:e?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+o,..."secondary"===o?{opacity:.6,fontSize:"0.88em"}:{},...e?{opacity:pr(r),"data-annotation-reading-order":r}:{},children:t.node},"annotation-emphasis-"+n)}const a=dr(t.annotation);return a&&(s=(0,cr.jsx)("g",{className:"annotation-cohesion--"+a,children:s},"annotation-cohesion-"+n)),i&&(s=(0,cr.jsx)("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:s},"annotation-deferred-"+n)),s});return o&&a.unshift((0,cr.jsx)("style",{children:".annotation-deferred{opacity:0;pointer-events:none;transition:opacity .12s ease}.stream-xy-frame:hover .annotation-deferred,.stream-ordinal-frame:hover .annotation-deferred,.stream-network-frame:hover .annotation-deferred,.stream-geo-frame:hover .annotation-deferred,.stream-xy-frame:focus-within .annotation-deferred,.stream-ordinal-frame:focus-within .annotation-deferred,.stream-network-frame:focus-within .annotation-deferred,.stream-geo-frame:focus-within .annotation-deferred{opacity:1;pointer-events:auto}@media (prefers-reduced-motion:reduce){.annotation-deferred{transition:none}}"},"annotation-disclosure-style")),i&&a.unshift((0,cr.jsx)("style",{children:".annotation-cohesion--layer text,.annotation-cohesion--layer tspan{fill:var(--semiotic-annotation-color,var(--semiotic-text-secondary,#666));font-style:italic}"},"annotation-cohesion-style")),a}(r)}(N?Er({annotations:R,context:o,..."object"==typeof N?N:{}}):R,e,F,o)},[R,N,F,t,n,O,B,D,s,W,z,G]),ee=function(e){const t=(0,$r.useSyncExternalStore)(e?Kr:Zr,e?Ur:Jr,e?Ur:Jr);return e?t.positions.get(e)??null:null}($);return(0,vo.useEffect)(()=>{if(!ee?.locked||!$)return;const e=e=>{"Escape"===e.key&&Xr($)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[ee?.locked,$]),a||m||g||C||M||J&&J.length>0||y||q||ee?(0,si.jsxs)("svg",{role:"img",width:o,height:r,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[(0,si.jsx)("title",{children:"string"==typeof m?m:"XY Chart"}),(0,si.jsx)("desc",{children:"string"==typeof m?m+" (XY data visualization)":"XY data visualization"}),(0,si.jsxs)("g",{transform:`translate(${i.left},${i.top})`,children:[y&&s&&(!H||E)&&(()=>{const e=ri(l?.find(e=>"bottom"===e.orient)?.gridStyle),o=ri(l?.find(e=>"left"===e.orient)?.gridStyle);return(0,si.jsxs)("g",{className:"stream-grid",children:[V.map((t,o)=>(0,si.jsx)("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:n,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:e},"xgrid-"+o)),X.map((e,n)=>(0,si.jsx)("line",{x1:0,y1:e.pixel,x2:t,y2:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:o},"ygrid-"+n))]})})(),a&&s&&(()=>{const e=l?.find(e=>"left"===e.orient),o=l?.find(e=>"bottom"===e.orient),r=!e||!1!==e.baseline,s=!o||!1!==o.baseline,a=e?.jaggedBase||!1,d=o?.jaggedBase||!1,f=o?.landmarkTicks,p=e?.landmarkTicks,y="var(--semiotic-border, #ccc)",m="var(--semiotic-text-secondary, var(--semiotic-text, #666))",g="var(--semiotic-text, #333)",x=!!o?.autoRotate&&V.length>1&&(()=>{const e=t/Math.max(V.length-1,1);return V.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0)+8>e})(),b=x?12:18,v=n+(x?58:40),k={fontSize:"var(--semiotic-tick-font-size, 12px)"},w={fontSize:"calc(var(--semiotic-tick-font-size, 12px) + 1px)"},A={fontSize:"var(--semiotic-axis-label-font-size, 12px)"},S=o?.tickAnchor,C=e?.tickAnchor,M=oi(V),j=oi(X);return(0,si.jsxs)("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[(0,si.jsxs)("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[(!H||E)&&s&&!d&&(0,si.jsx)("line",{x1:0,y1:n,x2:t,y2:n,stroke:y,strokeWidth:1}),(!H||E)&&d&&(0,si.jsx)("path",{d:ii("bottom",t,n),fill:"none",stroke:y,strokeWidth:1}),V.map((e,t)=>{const o=!!f&&("function"==typeof f?f(e.value,t):kn(e.value,t>0?V[t-1].value:void 0));return(0,si.jsxs)("g",{transform:`translate(${e.pixel},${n})`,children:[(0,si.jsx)("line",{y2:5,stroke:y,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?(0,si.jsx)("text",{y:b,textAnchor:x?"end":ti(S,e.pixel===M.min,e.pixel===M.max),fontWeight:o?600:400,fill:m,className:"semiotic-axis-tick",style:{userSelect:"none",...o?w:k},transform:x?"rotate(-45)":void 0,children:e.label}):(0,si.jsx)("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:(0,si.jsx)("div",{style:{textAlign:"center",userSelect:"none",...k},children:e.label})})]},"xtick-"+t)}),c&&(0,si.jsx)("text",{x:t/2,y:v,textAnchor:"middle",fill:g,className:"semiotic-axis-label",style:{userSelect:"none",...A},children:c})]}),(0,si.jsxs)("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[(!H||E)&&r&&!a&&(0,si.jsx)("line",{x1:0,y1:0,x2:0,y2:n,stroke:y,strokeWidth:1}),(!H||E)&&a&&(0,si.jsx)("path",{d:ii("left",t,n),fill:"none",stroke:y,strokeWidth:1}),X.map((e,t)=>{const n=!!p&&("function"==typeof p?p(e.value,t):kn(e.value,t>0?X[t-1].value:void 0));return(0,si.jsxs)("g",{transform:`translate(0,${e.pixel})`,children:[(0,si.jsx)("line",{x2:-5,stroke:y,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?(0,si.jsx)("text",{x:-8,textAnchor:"end",dominantBaseline:ni(C,e.pixel===j.min,e.pixel===j.max),fontWeight:n?600:400,fill:m,className:"semiotic-axis-tick",style:{userSelect:"none",...n?w:k},children:e.label}):(0,si.jsx)("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:(0,si.jsx)("div",{style:{textAlign:"right",userSelect:"none",...k},children:e.label})})]},"ytick-"+t)}),(()=>{const t=e?.label||u;return t?(0,si.jsx)("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",...A},children:t}):null})()]}),(()=>{const e=l?.find(e=>"right"===e.orient);if(!e||0===U.length)return null;const o=!1!==e.baseline,r=e.landmarkTicks,s=e.label||h,a=e.tickAnchor,c=oi(U);return(0,si.jsxs)("g",{className:"semiotic-axis semiotic-axis-right","data-orient":"right",children:[o&&(0,si.jsx)("line",{x1:t,y1:0,x2:t,y2:n,stroke:y,strokeWidth:1}),U.map((e,n)=>{const o=!!r&&("function"==typeof r?r(e.value,n):kn(e.value,n>0?U[n-1].value:void 0));return(0,si.jsxs)("g",{transform:`translate(${t},${e.pixel})`,children:[(0,si.jsx)("line",{x2:5,stroke:y,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?(0,si.jsx)("text",{x:8,textAnchor:"start",dominantBaseline:ni(a,e.pixel===c.min,e.pixel===c.max),fontWeight:o?600:400,fill:m,className:"semiotic-axis-tick",style:{userSelect:"none",...o?w:k},children:e.label}):(0,si.jsx)("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:(0,si.jsx)("div",{style:{textAlign:"left",userSelect:"none",...k},children:e.label})})]},"ytick-r-"+n)}),s&&(0,si.jsx)("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",...A},children:s})]})})()]})})(),J,M&&s&&j&&_&&(0,si.jsxs)(si.Fragment,{children:[M.top&&(0,si.jsx)("g",{transform:"translate(0, 0)",children:(0,si.jsx)($o,{orient:"top",config:Eo(M.top),values:j,scale:s.x,size:i.top,length:t})}),M.bottom&&(0,si.jsx)("g",{transform:`translate(0, ${n})`,children:(0,si.jsx)($o,{orient:"bottom",config:Eo(M.bottom),values:j,scale:s.x,size:i.bottom,length:t})}),M.left&&(0,si.jsx)("g",{transform:"translate(0, 0)",children:(0,si.jsx)($o,{orient:"left",config:Eo(M.left),values:_,scale:s.y,size:i.left,length:n})}),M.right&&(0,si.jsx)("g",{transform:`translate(${t}, 0)`,children:(0,si.jsx)($o,{orient:"right",config:Eo(M.right),values:_,scale:s.y,size:i.right,length:n})})]}),C,ee&&ee.sourceId!==Y&&s?.x&&(()=>{const e=s.x(ee.xValue);if(null==e||0>e||e>t)return null;const o=ee.locked;return(0,si.jsx)("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"})})(),q]}),m&&"string"==typeof m?(0,si.jsx)("text",{x:o/2,y:22,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:m}):m?(0,si.jsx)("foreignObject",{x:0,y:0,width:o,height:i.top,children:m}):null,Do({legend:g,totalWidth:o,totalHeight:r,margin:i,legendPosition:w,title:m,legendLayout:S,legendHoverBehavior:x,legendClickBehavior:b,legendHighlightedCategory:v,legendIsolatedCategories:k})]}):null}var hi=y(require("react"));function di(e){return(e.tl??0)>0||(e.tr??0)>0||(e.br??0)>0||(e.bl??0)>0}require("d3-shape");var fi=require("react/jsx-runtime");function pi(e,t="#4e79a7"){return Hn(e)?e.background&&"transparent"!==e.background?e.background:t:e&&"string"==typeof e?e:t}var yi="undefined"==typeof window||"undefined"==typeof document,mi=require("react"),gi="undefined"!=typeof window?mi.useLayoutEffect:mi.useEffect,xi=()=>()=>{},bi=()=>!1,vi=()=>!0,ki=require("react");function wi(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 Ai(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 Si(e){if(null===e||"object"!=typeof e)return!1;if(Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}var Ci={axisStroke:"#ccc",tickText:"#666",crosshair:"rgba(0, 0, 0, 0.25)",hoverFill:"rgba(255, 255, 255, 0.3)",hoverStroke:"rgba(0, 0, 0, 0.4)",pointRing:"white",primary:"#007bff",background:""};function Mi(e,t){const n=e.trim();if(/^#[0-9a-f]{3}$/i.test(n)){const e=n[1],o=n[2],r=n[3];return`#${e}${e}${o}${o}${r}${r}${t}`}if(/^#[0-9a-f]{6}$/i.test(n))return`${n}${t}`;const o=n.match(/^rgb\s*\(\s*([^)]+?)\s*\)$/i);return o?`rgba(${o[1]}, ${(parseInt(t,16)/255).toFixed(3)})`:n}var ji=y(require("react")),_i=y(require("react")),Ri=(require("react/jsx-runtime"),_i.createContext(null)),Pi=require("react/jsx-runtime"),Li={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function Ii({hoverPoint:e}){let t="";if(e){const n=e.data||e;t="object"==typeof n?"Data point: "+Object.entries(n).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Data point: "+n}return(0,Pi.jsx)("div",{"aria-live":"polite","aria-atomic":"true",style:Li,children:t})}function Ti(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 Ni(e){return e&&"object"==typeof e?e:{}}function Fi(e){return Ni(e.accessibility).tableFields??e.accessibleDatum??e.datum}var Oi=require("react/jsx-runtime");function Bi(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e){if(null===t?.datum)continue;const e=t.type+"";n[e]=(n[e]||0)+1}if(0===Object.keys(n).length)return t+", empty";const o=[],r={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},i=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],s=Object.keys(n).sort((e,t)=>{const n=i.indexOf(e),o=i.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of s)o.push(`${n[e]} ${r[e]||e}`);return`${t}, ${o.join(", ")}`}var Di=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},Wi="semiotic-accessible-data-table",zi=Wi+" semiotic-accessible-data-table-hidden",Hi=Wi+" semiotic-accessible-data-table-visible",Ei={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"},$i={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},Yi={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)"},qi={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},Gi={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))"},Vi={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},Xi={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},Ui={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 Ki({scene:e,chartType:t,tableId:n,chartTitle:o}){const[r,i]=ji.useState(!1),[s,a]=ji.useState(5),l=_i.useContext(Ri),c=l?.visible??!1,u=r||c,h=ji.useRef(null),d=o?"Data summary for "+o:n?`Data summary for ${t} ${n}`:"Data summary for "+t;ji.useEffect(()=>{u||a(5)},[u]);const f=ji.useCallback(e=>{e.target===e.currentTarget&&(r||c||i(!0))},[r,c]),p=ji.useCallback(e=>{c||h.current?.contains(e.relatedTarget)||i(!1)},[c]);if(!e||0===e.length)return n?(0,Oi.jsx)("span",{id:n,tabIndex:-1,style:Li}):null;if(!u)return(0,Oi.jsx)("div",{id:n,className:zi,tabIndex:-1,onFocus:f,style:Li,role:"region","aria-label":d,children:(0,Oi.jsxs)("button",{type:"button",onClick:()=>i(!0),children:["View data summary (",e.length," elements)"]})});const y=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:Ti(Fi(o))});break;case"line":case"area":{const e=Fi(o),n=Array.isArray(e)?e:[],r="line"===o.type?"Line point":"Area point";for(const e of n)t.push({label:r,values:Ti(e)});break}case"rect":{const e=Fi(o),n=null!=e&&"object"==typeof e?e:{},r=n.category??o.group??"",i=n.value??n.__aggregateValue??n.total,s=Ti(n);null==s.category&&""!==r&&(s.category=r+""),null==s.value&&null!=i&&(s.value="number"==typeof i||"string"==typeof i?i:i+""),t.push({label:"Bar",values:s});break}case"heatcell":{const e=Ti(Fi(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=Fi(o),n=Ti(e);if(null==n.category){const t=Ni(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:Ti(Fi(o))});break;case"arc":t.push({label:"Arc",values:Ti(Fi(o))});break;case"candlestick":t.push({label:"Candlestick",values:Ti(Fi(o))});break;case"geoarea":{const e=Ni(Fi(o)),n=Ti(e);if(null==n.name){const t=Ni(e.properties).name??e.name;null!=t&&(n.name=t+"")}t.push({label:"Region",values:n});break}}}catch{}return t}(e),m=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}(y),g=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${Di(e.min)} to ${Di(e.max)}, mean ${Di(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(" ")}(y.length,m),x=Math.min(s,y.length),b=y.slice(0,x),v=y.length-x,k=new Set;for(const e of b)for(const t of Object.keys(e.values))k.add(t);const w=Array.from(k);return(0,Oi.jsxs)("div",{ref:h,id:n,className:Hi,tabIndex:-1,onBlur:p,style:Ei,role:"region","aria-label":d,children:[(0,Oi.jsx)("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{c&&l&&l.setVisible(!1),i(!1)},"aria-label":"Close data summary",style:Yi,children:"×"}),(0,Oi.jsx)("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:$i,children:g}),(0,Oi.jsxs)("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+t,style:qi,children:[(0,Oi.jsx)("caption",{className:"semiotic-accessible-data-table-caption",style:Xi,children:v>0?`First ${x} of ${y.length} data points`:`All ${y.length} data points`}),(0,Oi.jsx)("thead",{children:(0,Oi.jsxs)("tr",{children:[(0,Oi.jsx)("th",{style:Gi,children:"type"}),w.map(e=>(0,Oi.jsx)("th",{style:Gi,children:e},e))]})}),(0,Oi.jsx)("tbody",{children:b.map((e,t)=>(0,Oi.jsxs)("tr",{children:[(0,Oi.jsx)("td",{style:Vi,children:e.label}),w.map(t=>{return(0,Oi.jsx)("td",{style:Vi,children:(n=e.values[t],null==n||""===n?"—":"number"==typeof n?Number.isNaN(n)?"—":Di(n):"boolean"==typeof n?n?"true":"false":"object"==typeof n?"—":n+"")},t);var n})]},t))})]}),v>0&&(0,Oi.jsxs)("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>a(e=>e+25),style:Ui,children:["Show ",Math.min(25,v)," more"," ",1===v?"row":"rows"," (",v," remaining)"]})]})}function Qi({summary:e}){return e?(0,Oi.jsx)("div",{role:"note",style:Li,children:e}):null}function Zi({tableId:e}){return(0,Oi.jsx)("a",{href:"#"+e,style:Li,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,Li)},children:"Skip to data table"})}var Ji=require("react/jsx-runtime"),es="var(--semiotic-focus, #005fcc)";function ts({active:e,hoverPoint:t,margin:n,size:o,shape:r="circle",width:i,height:s,pathData:a}){if(!e||!t)return null;const l=t.x+n.left,c=t.y+n.top;let u;if("geoarea"!==r&&"path"!==r||!a)if("rect"===r&&null!=i&&null!=s){const e=Math.max(i,4),t=Math.max(s,4);u=(0,Ji.jsx)("rect",{x:l-e/2-3,y:c-t/2-3,width:e+6,height:t+6,rx:3,fill:"none",stroke:es,strokeWidth:2,strokeDasharray:"4,2"})}else u=(0,Ji.jsx)("circle","wedge"===r?{cx:l,cy:c,r:12,fill:"none",stroke:es,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:es,strokeWidth:2,strokeDasharray:"4,2"});else u=(0,Ji.jsx)("g",{transform:`translate(${n.left},${n.top})`,children:(0,Ji.jsx)("path",{d:a,fill:"none",stroke:es,strokeWidth:2.5,strokeDasharray:"6,3"})});return(0,Ji.jsx)("svg",{style:{position:"absolute",left:0,top:0,width:o[0],height:o[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}var ns=y(require("react"));function os(e,t){return"touch"===t?Math.max(e,24):e}function rs(e){return Array.isArray(e)?e[0]:e}function is(e,t,n,o){return{data:rs(e),x:t,y:n,__semioticHoverData:!0,...o}}var ss=["name","label","title"],as=["type","kind","category","group","class","status","role","shape"],ls=["value","amount","total","count","weight","score"],cs=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 us(e,t){for(const n of t){const t=e.find(e=>e.lower===n);if(t)return t}}var hs=require("react/jsx-runtime"),ds={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 fs(e,t){return"function"==typeof t?t(e):e[t]}function ps(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 ys(e={}){const{fields:t,title:n,format:o,style:r={},className:i=""}=e;return e=>{if(!e||"object"!=typeof e)return null;let s;const a=[];if(n){const t=fs(e,n);s=ps(t,o)}if(t&&t.length>0)t.forEach(t=>{let n,r,i;"string"==typeof t?(n=t,r=t,i=o):(n=t.label,r=t.accessor||t.key||"",i=t.format||o);const s=fs(e,r);a.push({label:n,value:ps(s,i)})});else if(!n){const t=["value","y","name","id","label"];for(const n of t)if(void 0!==e[n]){s=ps(e[n],o);break}if(!s){const t=Object.keys(e).filter(e=>!e.startsWith("_"));t.length>0&&(s=ps(e[t[0]],o))}}const l={...ds,...r};return(0,hs.jsxs)("div",{className:("semiotic-tooltip "+i).trim(),style:l,children:[s&&(0,hs.jsx)("div",{style:{fontWeight:a.length>0?"bold":"normal"},children:s}),a.map((e,t)=>(0,hs.jsxs)("div",{style:{marginTop:0===t&&s?"4px":0},children:[e.label&&(0,hs.jsxs)("span",{children:[e.label,": "]}),e.value]},t))]})}}function ms(){return e=>{const t=e.allSeries;if(!t||0===t.length)return(0,hs.jsx)("div",{className:"semiotic-tooltip",style:ds,children:(0,hs.jsx)("div",{children:ps(e.data?.value??e.data?.y)})});const n=e.xValue??e.data?.time??e.data?.x;return(0,hs.jsxs)("div",{className:"semiotic-tooltip",style:ds,children:[null!=n&&(0,hs.jsx)("div",{style:{fontWeight:600,marginBottom:4,fontSize:"0.9em",borderBottom:"1px solid var(--semiotic-border, #eee)",paddingBottom:4},children:ps(n)}),t.map((e,t)=>(0,hs.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"1px 0"},children:[(0,hs.jsx)("span",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:e.color,flexShrink:0}}),(0,hs.jsx)("span",{style:{flex:1,fontSize:"0.85em"},children:e.group}),(0,hs.jsx)("span",{style:{fontWeight:500,fontSize:"0.85em"},children:ps(e.value)})]},t))]})}}function gs(e){if(!0!==e){if("function"==typeof e){const t=e;return e=>{let n=rs(!0===e?.__semioticHoverData||e&&void 0!==e.data&&"number"==typeof e.x&&"number"==typeof e.y&&e&&("node"===e.type||"edge"===e.type||void 0!==e.nodeOrEdge||void 0!==e.allSeries||void 0!==e.stats||void 0!==e.__chartType)?e.data??{}:e);if(!n)return null;if(("node"===e?.nodeOrEdge&&"number"==typeof n?.x0&&"number"==typeof n?.x1||"edge"===e?.nodeOrEdge&&"number"==typeof n?.sankeyWidth)&&n.data&&"object"==typeof n.data&&(n=n.data),!n)return null;const o=t(n);return null==o?null:(0,hs.jsx)("div",{className:"semiotic-tooltip",style:ds,children:o})}}return!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?ys(e):ys())}}var xs=require("react/jsx-runtime");function bs({x:e,y:t,containerWidth:n,containerHeight:o,margin:r,children:i,className:s="stream-frame-tooltip",zIndex:a=1}){const l=Number.isFinite(e)&&Number.isFinite(t),c=ns.useRef(null),[u,h]=ns.useState(null);ns.useLayoutEffect(()=>{const e=c.current;if(!e)return;const t=()=>{const t=e.getBoundingClientRect();Number.isFinite(t.width)&&Number.isFinite(t.height)&&h(e=>e&&.5>Math.abs(e.width-t.width)&&.5>Math.abs(e.height-t.height)?e:{width:t.width,height:t.height})};if(t(),"undefined"==typeof ResizeObserver)return;const n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[s,n,o,l]);let 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(!ns.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:ds;return l?(0,xs.jsx)("div",{ref:c,className:f?s:(s+" semiotic-tooltip").trim(),style:{...p||{},position:"absolute",left:r.left+e,top:r.top+t,transform:d,pointerEvents:"none",zIndex:a,width:"max-content"},children:i}):null}var vs=y(require("react")),ks=require("react"),ws=require("react");var As=require("react");function Ss(e,t,n){const o=(0,As.useRef)(null),[r,i]=(0,As.useState)(null);return(0,As.useEffect)(()=>{if(!t&&!n)return;const e=o.current;if(!e)return;const r=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;i(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return r.observe(e),()=>r.disconnect()},[t,n]),[o,[t&&r?r.w:e[0],n&&r?r.h:e[1]]]}var Cs=()=>"undefined"!=typeof performance?performance.now():Date.now();function Ms(e,t){const n=e();return Number.isFinite(n)?n:t}var js=class{constructor(e={}){this.randomSource=Math.random,this.subscribers=new Set,this.now=()=>this.advance(),this.random=()=>this.randomSource(),this.clock=e.clock??Cs,this.lastWallTime=Ms(this.clock,0),this.logicalTime=this.lastWallTime,this.pausedValue=!0===e.paused,this.visibleValue=!1!==e.visible,this.setRandomSource(e.random,e.seed)}get isActive(){return!this.pausedValue&&this.visibleValue}get paused(){return this.pausedValue}get seed(){return this.seedValue}get visible(){return this.visibleValue}configure(e){this.setClock(e.clock),this.setRandomSource(e.random,e.seed)}setPaused(e){this.pausedValue!==e&&(this.advance(),this.pausedValue=e,this.emit())}setVisible(e){this.visibleValue!==e&&(this.advance(),this.visibleValue=e,this.emit())}snapshot(){return{now:this.now(),paused:this.pausedValue,seed:this.seedValue,visible:this.visibleValue}}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}advance(){const e=Ms(this.clock,this.lastWallTime),t=Math.max(0,e-this.lastWallTime);return this.lastWallTime=e,this.isActive&&(this.logicalTime+=t),this.logicalTime}emit(){for(const e of this.subscribers)e()}setClock(e){const t=e??Cs;t!==this.clock&&(this.advance(),this.clock=t,this.lastWallTime=Ms(t,this.lastWallTime))}setRandomSource(e,t){const n=function(e){return"number"==typeof e&&Number.isFinite(e)?Math.trunc(e):void 0}(t);e===this.randomInput&&n===this.seedValue||(this.randomInput=e,this.seedValue=n,this.randomSource=e??(void 0===n?Math.random:function(e){let t=e>>>0;return()=>{t+=1831565813;let e=t;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}}(n)))}},_s="undefined"==typeof window?ks.useEffect:ks.useLayoutEffect,Rs={requestAnimationFrame:e=>("undefined"==typeof window?globalThis:window).requestAnimationFrame(e),cancelAnimationFrame:e=>("undefined"==typeof window?globalThis:window).cancelAnimationFrame(e)};function Ps(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function Ls(e){const t=function(){const[e,t]=(0,ws.useState)(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return(0,ws.useEffect)(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),function(e,t){if("function"==typeof e.addEventListener)return e.addEventListener("change",t),()=>e.removeEventListener("change",t);const n=e;return n.addListener(t),()=>n.removeListener(t)}(e,e=>t(e.matches))},[]),e}(),n=(0,ks.useRef)(t);n.current=t;const[o,r]=Ss(e.sizeProp,e.responsiveWidth,e.responsiveHeight),i=!!e.title,s=!!e.legend&&"top"===e.legendPosition,a=(0,ks.useMemo)(()=>function(e,t,n=!1){const o=n?t?58:34:t?36:0;return o>e.top?{...e,top:o}:e}({...e.marginDefault,...e.userMargin},i,s),[e.marginDefault,e.userMargin,i,s]),l=r[0]-a.left-a.right,c=r[1]-a.top-a.bottom,u=Ps(e.foregroundGraphics,r,a),h=Ps(e.backgroundGraphics,r,a),d=le(e=>e.theme),{transition:f,introEnabled:p}=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),y="semiotic-table-"+vs.useId(),m=(0,ks.useRef)(null);if(!m.current){const t=!e.suspendWhenHidden||"undefined"==typeof document||!document.hidden;m.current=new js({clock:e.clock,random:e.random,seed:e.seed,paused:e.paused,visible:t})}const g=m.current;g.configure({clock:e.clock,random:e.random,seed:e.seed});const x=(0,ks.useRef)(null),b=(0,ks.useRef)(e.frameScheduler??Rs);b.current=e.frameScheduler??Rs;const v=(0,ks.useRef)(null),k=(0,ks.useRef)(!1),w=(0,ks.useRef)(()=>{}),A=(0,ks.useCallback)(()=>{if(null!==x.current||k.current)return;const e=b.current;let t=!1,n=!1;const o=e.requestAnimationFrame(()=>{t=!0;const e=!n;e&&(k.current=!0),x.current=null,v.current=null;try{w.current()}finally{e&&(k.current=!1)}});n=!0,t||(x.current=o,v.current=e)},[]),S=(0,ks.useCallback)(()=>{null!==x.current&&((v.current??b.current).cancelAnimationFrame(x.current),x.current=null,v.current=null)},[]);_s(()=>{g.setPaused(!0===e.paused)},[g,e.paused]),(0,ks.useEffect)(()=>{if(!e.suspendWhenHidden||"undefined"==typeof document)return void g.setVisible(!0);const t=()=>g.setVisible(!document.hidden);return t(),document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},[g,e.suspendWhenHidden]),(0,ks.useEffect)(()=>()=>{S()},[S]);const C=(0,ks.useRef)(()=>{}),M=(0,ks.useRef)(()=>{}),j=(0,ks.useRef)(null),_=(0,ks.useRef)(null),R=(0,ks.useRef)(null),P=(0,ks.useCallback)(()=>{const e=j.current;j.current=null,e&&C.current(e)},[]),L=(0,ks.useCallback)(e=>{if(j.current={clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType},null===_.current){const e=b.current;let t=!1;const n=e.requestAnimationFrame(()=>{t=!0,_.current=null,R.current=null,P()});t||(_.current=n,R.current=e)}},[P]),I=(0,ks.useCallback)(()=>{j.current=null,null!==_.current&&((R.current??b.current).cancelAnimationFrame(_.current),_.current=null,R.current=null),M.current()},[]);(0,ks.useEffect)(()=>()=>{j.current=null,null!==_.current&&((R.current??b.current).cancelAnimationFrame(_.current),_.current=null,R.current=null)},[]);const T=e.themeDirtyRef;return _s(()=>{T&&(Nn++,T.current=!0,A())},[d,A,T]),{reducedMotion:t,reducedMotionRef:n,responsiveRef:o,size:r,margin:a,adjustedWidth:l,adjustedHeight:c,resolvedForeground:u,resolvedBackground:h,currentTheme:d,transition:f,introEnabled:p,tableId:y,frameRuntime:g,rafRef:x,renderFnRef:w,scheduleRender:A,cancelRender:S,hoverHandlerRef:C,hoverLeaveRef:M,onPointerMove:L,onPointerLeave:I}}var Is=require("react"),Ts=require("react/jsx-runtime");function Ns({children:e,size:t,margin:n,overflowVisible:o=!1}){return e?(0,Ts.jsx)("svg",{style:{position:"absolute",left:0,top:0,width:t[0],height:t[1],pointerEvents:"none",overflow:o?"visible":void 0},children:(0,Ts.jsx)("g",{transform:`translate(${n.left},${n.top})`,children:e})}):null}function Fs(e,t,n,o){return"function"==typeof e?e({size:t,margin:n,scales:o}):e}function Os(e,t,n,o){const r=e.getContext("2d");if(!r)return null;const i=Math.round(t[0]*o),s=Math.round(t[1]*o),a=i/t[0],l=s/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===s||(e.width=i,e.height=s),r.setTransform(a,0,0,l,0,0),r.translate(n.left,n.top),r}var Bs=require("react");function Ds(e,t,n,o){return"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:n,fn:e}:"string"==typeof t?{key:t,fn:null}:"function"==typeof t?{key:o,fn:t}:{key:void 0,fn:null}}var Ws=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],zs=3156e7;function Hs(e){const t=e[1]-e[0];return 864e5>t?e=>{const t=new Date(e);return`${(t.getUTCHours()+"").padStart(2,"0")}:${(t.getUTCMinutes()+"").padStart(2,"0")}`}:zs>t?e=>{const t=new Date(e);return`${Ws[t.getUTCMonth()]} ${t.getUTCDate()}`}:5*zs>t?e=>{const t=new Date(e);return`${Ws[t.getUTCMonth()]} ${t.getUTCFullYear()}`}:e=>new Date(e).getUTCFullYear()+""}function Es(e){if(!e)return;const t=[];for(const n of e)if("point"===n.type)t.push(n);else if("symbol"===n.type)t.push({pointId:n.pointId,x:n.x,y:n.y,r:vt(n.size)});else if("glyph"===n.type){const e=Pn(n.glyph,n.size);t.push({pointId:n.pointId,x:n.x+e.centerDx,y:n.y+e.centerDy,r:e.radius})}return t}var $s=require("d3-shape");function Ys(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 qs(e,t,n,o,r,i){if(2>t.length)return;const s=[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];s.push(s[e-1]+Math.sqrt(n*n+o*o))}const a=s[s.length-1];if(0===a)return;const l=Math.min(.2*a,40);e.strokeStyle=n,e.lineWidth=o,e.lineCap=i;for(let n=0;t.length-1>n;n++){const o=(s[n]+s[n+1])/2;let i=r;l>o&&(i*=o/l),l>a-o&&(i*=(a-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()}}var Gs=(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=Dn(e,r)||r,s=t.style.strokeWidth||2,a=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=s,e.lineCap=t.style.strokeLinecap||"butt",t.style._edgeFade){qs(e,t.path,i,s,t.style.opacity??1,t.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const c=Xn(t.curve),u=a&&a.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,s=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],y=Ys(p,a,i);if(null!==r&&null!==u&&null!==c){if(y===u)e.lineTo(d,f);else{const t=[];for(const e of a){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=s+(f-s)*l.t,h=Ys(c+(p-c)*Math.min(l.t+1e-4,1),a,i);e.lineTo(t,u),o(),n(h,t,u)}e.lineTo(d,f)}r=d,s=f,c=p,u=y}else n(y,d,f),r=d,s=f,c=p,u=y}o()}else{e.beginPath();const n=t.strokeGradient&&t.path.length>=2?Qn(e,t.strokeGradient,t.path[0][0],0,t.path[t.path.length-1][0],0):null;if(e.strokeStyle=n||i,c)(0,$s.line)().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=Un(e,t.style.fill,t.style.fill),c&&!u)(0,$s.line)().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"}};function Vs(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Xs(e,t,n=.3){Vs(t)&&(e.globalAlpha=t._pulseIntensity*n,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h))}function Us(e,t,n=.6){if(!Vs(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 Ks(e,t,n,o=.35){Vs(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",n?e.fill(n):e.fill())}var Qs=require("d3-shape");function Zs(e,t){const n=Xn(t.curve);if(!n||2>t.topPath.length||2>t.bottomPath.length){e.beginPath(),e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1]);for(let n=t.bottomPath.length-1;n>=0;n--)e.lineTo(t.bottomPath[n][0],t.bottomPath[n][1]);e.closePath()}else{const o=(0,Qs.area)().x(e=>e[0]).y0((e,n)=>t.bottomPath[n][1]).y1(e=>e[1]).curve(n).context(e);e.beginPath(),o(t.topPath)}}var Js=(e,t,n,o)=>{const r=t.filter(e=>"area"===e.type);for(const t of r){if(2>t.topPath.length)continue;let n=!1;t.clipRect&&(e.save(),e.beginPath(),e.rect(t.clipRect.x,t.clipRect.y,t.clipRect.width,t.clipRect.height),e.clip(),n=!0);const r=t._introClipFraction;void 0!==r&&1>r&&(e.save(),e.beginPath(),e.rect(0,0,o.width*r,o.height),e.clip());const i=Un(e,t.style.fill,"#4e79a7"),s=t._decayOpacities;if(s&&s.length===t.topPath.length){const n=t.style.fillOpacity??.7;e.fillStyle=i;for(let o=0;t.topPath.length-1>o;o++)e.globalAlpha=.5*(s[o]+s[o+1])*n,e.beginPath(),e.moveTo(t.topPath[o][0],t.topPath[o][1]),e.lineTo(t.topPath[o+1][0],t.topPath[o+1][1]),e.lineTo(t.bottomPath[o+1][0],t.bottomPath[o+1][1]),e.lineTo(t.bottomPath[o][0],t.bottomPath[o][1]),e.closePath(),e.fill();if(t.style.stroke&&"none"!==t.style.stroke){e.strokeStyle=Dn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);for(let n=0;t.topPath.length-1>n;n++)e.globalAlpha=.5*(s[n]+s[n+1]),e.beginPath(),e.moveTo(t.topPath[n][0],t.topPath[n][1]),e.lineTo(t.topPath[n+1][0],t.topPath[n+1][1]),e.stroke()}e.globalAlpha=1;continue}const a=t.style.opacity??1;if(Zs(e,t),t.fillGradient&&("colorStops"in t.fillGradient&&t.fillGradient.colorStops.length>=2||"topOpacity"in t.fillGradient)&&t.fillGradient){let n=1/0;for(const e of t.topPath)n>e[1]&&(n=e[1]);let o=-1/0;for(const e of t.bottomPath)e[1]>o&&(o=e[1]);const r=Kn(e,t.fillGradient,"string"==typeof i?i:"#4e79a7",0,n,0,o);e.fillStyle=r||i,e.globalAlpha=a}else e.globalAlpha=(t.style.fillOpacity??.7)*a,e.fillStyle=i;if(e.fill(),t._pulseIntensity&&t._pulseIntensity>0&&(Zs(e,t),Ks(e,t)),t.style.stroke&&"none"!==t.style.stroke){e.globalAlpha=a;const n=t.strokeGradient&&t.topPath.length>=2?Qn(e,t.strokeGradient,t.topPath[0][0],0,t.topPath[t.topPath.length-1][0],0):null;e.strokeStyle=n||Dn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);const o=Xn(t.curve);if(e.beginPath(),o)(0,Qs.line)().x(e=>e[0]).y(e=>e[1]).curve(o).context(e)(t.topPath);else{e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1])}e.stroke()}void 0!==r&&1>r&&e.restore(),n&&e.restore(),e.globalAlpha=1}},ea=(e,t,n,o)=>{const r=t.filter(e=>"point"===e.type);if(0!==r.length){e.save();try{const t=e.globalAlpha;for(const n of r)e.beginPath(),e.arc(n.x,n.y,n.r,0,2*Math.PI),e.globalAlpha=t*(n.style.opacity??n.style.fillOpacity??1),e.fillStyle=Un(e,n.style.fill,"#4e79a7"),e.fill(),n.style.stroke&&(e.strokeStyle=Un(e,n.style.stroke,n.style.stroke),e.lineWidth=n.style.strokeWidth||1,e.stroke()),Us(e,n)}finally{e.restore()}}},ta=new Map;function na(e){try{if(e.path)return new Path2D(e.path);const t=`${e.symbolType??"circle"}:${Math.round(e.size)}`;let n=ta.get(t);return n||(n=new Path2D(bt(e.symbolType,e.size)),ta.size>256&&ta.clear(),ta.set(t,n)),n}catch{return null}}var oa=(e,t)=>{const n=e.globalAlpha;for(const o of t){if("symbol"!==o.type)continue;const t=o;if(0>=t.size)continue;const r=na(t);if(!r)continue;e.save(),e.translate(t.x,t.y),t.rotation&&e.rotate(t.rotation);const i=(t.style.opacity??1)*(t._decayOpacity??1);t.style.fill&&(e.globalAlpha=n*i*(t.style.fillOpacity??1),e.fillStyle=Un(e,t.style.fill,"#4e79a7"),e.fill(r)),t.style.stroke&&"none"!==t.style.stroke&&(e.globalAlpha=n*i,e.strokeStyle=Un(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth??1,e.stroke(r)),e.restore()}e.globalAlpha=n};function ra(e,t,n,o,r){if(0>=t.size)return;const i=t.glyph;if(!i||!i.parts?.length)return;const s=Sn(i,t.size);if(0>=s.scale)return;const a=(t.style.opacity??1)*(t._decayOpacity??1);if(0>=a)return;const l=t=>{const n=Un(e,t,t);return"string"==typeof n?n:t},c=t.color??("string"==typeof t.style.fill?t.style.fill:void 0);e.save(),e.translate(n,o),t.rotation&&e.rotate(t.rotation),e.translate(s.offsetX,s.offsetY),e.scale(s.scale,s.scale),e.globalAlpha=r*a*(t.style.fillOpacity??1);const u=Rn(i,t.fraction??1,t.fractionStart??0,t.fractionDirection??"horizontal");u&&t.ghostColor&&Ln(e,i,c,t.accent,t.ghostColor,l),u&&(e.beginPath(),e.rect(u.x,u.y,u.width,u.height),e.clip()),Ln(e,i,c,t.accent,void 0,l),e.restore()}function ia(e,t){const{x:n,y:o,w:r,h:i}=t,{tl:s,tr:a,br:l,bl:c}=function(e){const t=e.cornerRadii;if(!t)return{tl:0,tr:0,br:0,bl:0};const n=Math.min(e.w,e.h)/2,o=e=>Math.max(0,Math.min(e??0,n));return{tl:o(t.tl),tr:o(t.tr),br:o(t.br),bl:o(t.bl)}}(t);e.beginPath(),e.moveTo(n+s,o),e.lineTo(n+r-a,o),a>0&&e.arcTo(n+r,o,n+r,o+a,a),e.lineTo(n+r,o+i-l),l>0&&e.arcTo(n+r,o+i,n+r-l,o+i,l),e.lineTo(n+c,o+i),c>0&&e.arcTo(n,o+i,n,o+i-c,c),e.lineTo(n,o+s),s>0&&e.arcTo(n,o,n+s,o,s),e.closePath()}function sa(e){switch(e.roundedEdge){case"bottom":return{x0:e.x,y0:e.y+e.h,x1:e.x,y1:e.y};case"right":return{x0:e.x+e.w,y0:e.y,x1:e.x,y1:e.y};case"left":return{x0:e.x,y0:e.y,x1:e.x+e.w,y1:e.y};default:return{x0:e.x,y0:e.y,x1:e.x,y1:e.y+e.h}}}var aa=(e,t,n,o)=>{const r=t.filter(e=>"rect"===e.type);for(const t of r){if(null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon)la(e,t);else if(t.cornerRadii&&di(t.cornerRadii)){const n=Un(e,t.style.fill,Dn(e,"var(--semiotic-primary, #007bff)")),o=sa(t),r=t.fillGradient&&"string"==typeof n?Kn(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=r||n,ia(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Dn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else if(t.roundedTop&&t.roundedTop>0){const n=Un(e,t.style.fill,Dn(e,"var(--semiotic-primary, #007bff)")),o=sa(t),r=t.fillGradient&&"string"==typeof n?Kn(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=r||n;const i=Math.min(t.roundedTop,t.w/2,t.h/2);e.beginPath();const{x:s,y:a,w:l,h:c}=t;switch(t.roundedEdge){case"right":e.moveTo(s,a),e.lineTo(s+l-i,a),e.arcTo(s+l,a,s+l,a+i,i),e.lineTo(s+l,a+c-i),e.arcTo(s+l,a+c,s+l-i,a+c,i),e.lineTo(s,a+c);break;case"left":e.moveTo(s+l,a),e.lineTo(s+i,a),e.arcTo(s,a,s,a+i,i),e.lineTo(s,a+c-i),e.arcTo(s,a+c,s+i,a+c,i),e.lineTo(s+l,a+c);break;case"bottom":e.moveTo(s,a),e.lineTo(s+l,a),e.lineTo(s+l,a+c-i),e.arcTo(s+l,a+c,s+l-i,a+c,i),e.lineTo(s+i,a+c),e.arcTo(s,a+c,s,a+c-i,i);break;default:e.moveTo(s,a+c),e.lineTo(s,a+i),e.arcTo(s,a,s+i,a,i),e.lineTo(s+l-i,a),e.arcTo(s+l,a,s+l,a+i,i),e.lineTo(s+l,a+c)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Dn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const n=Un(e,t.style.fill,Dn(e,"var(--semiotic-primary, #007bff)")),o=sa(t),r=t.fillGradient&&"string"==typeof n?Kn(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=r||n,e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Dn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}Xs(e,t),e.globalAlpha=1}};function la(e,t){const n=t.style.icon,o=t.style.iconPadding||2,r=Math.min(t.w,t.h)-o;if(0>=r)return;const i=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),i){const i=r+o,s=t.x+(t.w-r)/2;for(let o=t.y+t.h-r;o>=t.y-r;o-=i)e.drawImage(n,s,o,r,r)}else{const i=r+o,s=t.y+(t.h-r)/2;for(let o=t.x;t.x+t.w>o;o+=i)e.drawImage(n,o,s,r,r)}e.restore()}function ca(e){const[t,n,o]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(e);return.299*t+.587*n+.114*o>128?"#000":"#fff"}function ua(e){return Number.isInteger(e)?e+"":100>Math.abs(e)?1>Math.abs(e)?e.toPrecision(3):e.toFixed(1):e.toFixed(0)}var ha=(e,t,n,o)=>{const r=t.filter(e=>"heatcell"===e.type);e.save();try{for(const t of r){const n=t.style;if(null!=n?.opacity&&(e.globalAlpha=n.opacity),e.fillStyle=t.fill,e.fillRect(t.x,t.y,t.w,t.h),e.strokeStyle=Dn(e,"var(--semiotic-surface, #fff)"),e.lineWidth=1,e.strokeRect(t.x,t.y,t.w,t.h),Xs(e,t),e.globalAlpha=1,t.showValues&&null!=t.value){if(20>t.w||20>t.h)continue;const n=t.valueFormat?t.valueFormat(t.value):ua(t.value),o=Math.max(10,Math.min(16,.3*Math.min(t.w,t.h))),r=t.x+t.w/2,i=t.y+t.h/2;e.fillStyle=ca(t.fill),e.font=o+"px sans-serif",e.textAlign="center",e.textBaseline="middle",e.fillText(n,r,i)}}}finally{e.restore()}},da=(e,t,n,o)=>{for(const n of t){if("candlestick"!==n.type)continue;const t=n;e.save();const r=(t._decayOpacity??1)*(t.style?.opacity??1);1!==r&&(e.globalAlpha=r);const i=Dn(e,t.wickColor)||t.wickColor,s=60>o.height,a=s?Math.max(t.wickWidth,2):t.wickWidth,l=()=>{e.beginPath(),e.moveTo(t.x,t.highY),e.lineTo(t.x,t.lowY),e.strokeStyle=i,e.lineWidth=a,e.stroke()};if(s||l(),t.isRange){const n=Math.max(2,Math.min(t.bodyWidth/2,.12*o.height));e.fillStyle=i,e.beginPath(),e.arc(t.x,t.highY,n,0,2*Math.PI),e.fill(),e.beginPath(),e.arc(t.x,t.lowY,n,0,2*Math.PI),e.fill()}else if(t.bodyWidth>0){const n=Math.min(t.openY,t.closeY),o=Math.abs(t.openY-t.closeY),r=t.isUp?t.upColor:t.downColor,i=Dn(e,r)||r;e.fillStyle=i,e.fillRect(t.x-t.bodyWidth/2,n,t.bodyWidth,Math.max(o,1)),e.strokeStyle=i,e.lineWidth=1,e.strokeRect(t.x-t.bodyWidth/2,n,t.bodyWidth,Math.max(o,1))}s&&l(),e.restore()}},fa={line:[Js,Gs,ea],area:[Js,ea],stackedarea:[Js,ea],scatter:[ea,oa],bubble:[ea,oa],heatmap:[ha],bar:[aa],swarm:[ea],waterfall:[(e,t,n,o)=>{aa(e,t);const r=t.filter(e=>"rect"===e.type);if(2>r.length)return;const i=r[0].datum,s=i?._connectorStroke;if(s){e.save(),e.strokeStyle=Dn(e,s)||s,e.lineWidth=i?._connectorWidth??1,e.setLineDash([]);for(let t=0;r.length-1>t;t++){const o=r[t],i=r[t+1],s=o.datum,a=i.datum;if(null==s?.cumEnd||null==a?.baseline)continue;const l=n.y(s.cumEnd),c=o.x+o.w,u=i.x;e.beginPath(),e.moveTo(c,l),e.lineTo(u,l),e.stroke()}e.restore()}}],candlestick:[da],mixed:[Js,Gs,ea],custom:[Js,aa,ha,Gs,ea,oa,(e,t)=>{const n=e.globalAlpha;for(const o of t)"glyph"===o.type&&ra(e,o,o.x,o.y,n);e.globalAlpha=n},da]},pa=new Set;function ya(e,t){const n="function"==typeof e?e(t.datum??null,t):e;return(o=n)&&"object"==typeof o&&"string"==typeof o.id&&"function"==typeof o.cacheKey&&"function"==typeof o.drawCanvas&&"function"==typeof o.renderStaticSVG?n:void 0;var o}function ma(e,t){if("undefined"!=typeof process&&"production"===process.env?.NODE_ENV)return;const n=`${e}:${t}`;pa.has(n)||(pa.add(n),console.warn(`[Semiotic] Render backend "${e}" does not support scene node "${t}"; using the built-in renderer.`))}var ga=require("react/jsx-runtime");function xa(e){return"string"==typeof e?e:"value"}function ba(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function va(e,t){if(!t)return ba(e);try{const n=t(e);return null==n?ba(e):n}catch{return ba(e)}}function ka(e,t){return"function"==typeof t?t(e):e[t]}function wa(e,t){if(!e)return[];const n=[];return(Array.isArray(e)?e:[e]).forEach((e,o)=>{const r="string"==typeof e?.y0Accessor?e.y0Accessor:"low",i="string"==typeof e?.y1Accessor?e.y1Accessor:"high";n.push({label:r,accessor:e=>e.bands?.[o]?.y0??(0===o?e.band?.y0:void 0),format:t}),n.push({label:i,accessor:e=>e.bands?.[o]?.y1??(0===o?e.band?.y1:void 0),format:t})}),n}function Aa(e){const t=e.find(e=>"title"===e.role),n=e.filter(e=>"title"!==e.role);return e=>{const o=e.data;if(!o)return null;const r=t?va(ka(o,t.accessor),t.format):null;return(0,ga.jsxs)("div",{className:"semiotic-tooltip",style:ds,children:[null!=r&&(0,ga.jsx)("div",{style:{fontWeight:"bold",marginBottom:n.length>0?4:0},children:r}),n.map((e,t)=>{const n=va(ka(o,e.accessor),e.format);return(0,ga.jsxs)("div",{style:t>0?{marginTop:2}:void 0,children:[(0,ga.jsxs)("span",{style:{opacity:.7},children:[e.label,": "]}),(0,ga.jsx)("span",{children:n})]},t)})]})}}var Sa=require("react/jsx-runtime");function Ca(e){return null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+""}function Ma({hover:e}){const t=e.data??{},n=t.y??t.value,o=t.x??t.time;if(void 0===n&&void 0===o){const e=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&&cs.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=>ss.includes(e.lower));const s=i>=0;0>i&&(i=r.findIndex(e=>"id"===e.lower)),0>i&&(i=r.findIndex(e=>"string"==typeof e.value));const a=0>i?void 0:r[i];let l=r.filter((e,t)=>t!==i);s&&(l=l.filter(e=>"id"!==e.lower));const c=us(l,as),u=us(l,ls),h=new Set(as),d=new Set(ls),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:a?.key,title:a?.value,entries:f}}(t);if(null!=e.title||e.entries.length>0)return(0,Sa.jsxs)("div",{className:"semiotic-tooltip",style:ds,children:[null!=e.title&&(0,Sa.jsx)("div",{style:{fontWeight:600,marginBottom:e.entries.length?2:0},children:e.title+""}),e.entries.map(e=>(0,Sa.jsxs)("div",{style:{opacity:.7,fontSize:11},children:[e.key,":"," ",(0,Sa.jsx)("span",{style:{fontWeight:600},children:Ca(e.value)})]},e.key))]})}return(0,Sa.jsxs)("div",{className:"semiotic-tooltip",style:ds,children:[(0,Sa.jsx)("div",{style:{fontWeight:600,marginBottom:2},children:Ca(n)}),(0,Sa.jsx)("div",{style:{opacity:.7,fontSize:11},children:Ca(o)})]})}function ja(e){const{onObservation:t,datum:n,x:o=0,y:r=0,chartType:i,chartId:s,context:a,timestamp:l=Date.now()}=e;t&&(n?(t({type:"hover",datum:n,x:o,y:r,timestamp:l,chartType:i,chartId:s}),"focus"===a?.type&&t({type:"focus",datum:n,inputType:"touch"===a.inputType?"pointer":a.inputType,timestamp:l,chartType:i,chartId:s})):t({type:"hover-end",timestamp:l,chartType:i,chartId:s}))}function _a(e){const{onObservation:t,datum:n,x:o=0,y:r=0,chartType:i,chartId:s,context:a,timestamp:l=Date.now()}=e;t&&(n?(t({type:"click",datum:n,x:o,y:r,timestamp:l,chartType:i,chartId:s}),"activate"===a?.type&&t({type:"activate",datum:n,inputType:a.inputType,timestamp:l,chartType:i,chartId:s})):t({type:"click-end",timestamp:l,chartType:i,chartId:s}))}Ma.ownsChrome=!0;var Ra=require("react"),Pa=require("react");function La(e,t,n){const o=e.byGroup.get(t);let r=0,i=Math.abs(o[0].x-n.x);for(let e=1;o.length>e;e++){const t=Math.abs(o[e].x-n.x);i>t&&(i=t,r=e)}return o[r]._flatIndex}function Ia(e){const t=[];for(const n of e)switch(n.type){case"point":t.push({x:n.x,y:n.y,datum:n.datum,shape:"circle",group:"_default"});break;case"symbol":if(0>=n.size)break;t.push({x:n.x,y:n.y,datum:n.datum,shape:"circle",group:"_default"});break;case"glyph":{if(0>=n.size||null==n.datum)break;const e=Pn(n.glyph,n.size);t.push({x:n.x+e.centerDx,y:n.y+e.centerDy,datum:n.datum,shape:"rect",w:2*e.halfWidth,h:2*e.halfHeight,group:"_default"});break}case"line":{const e=n,o=Array.isArray(e.datum)?e.datum:[],r=e.group??"_default";for(let n=0;e.path.length>n&&o.length>n;n++)t.push({x:e.path[n][0],y:e.path[n][1],datum:o[n],shape:"circle",group:r});break}case"area":{const e=n,o=Array.isArray(e.datum)?e.datum:[],r=e.group??"_default";for(let n=0;e.topPath.length>n&&o.length>n;n++)t.push({x:e.topPath[n][0],y:e.topPath[n][1],datum:o[n],shape:"circle",group:r});break}case"rect":t.push({x:n.x+n.w/2,y:n.y+n.h/2,datum:n.datum,shape:"rect",w:n.w,h:n.h,group:n.group??"_default"});break;case"heatcell":t.push({x:n.x+n.w/2,y:n.y+n.h/2,datum:n.datum,shape:"rect",w:n.w,h:n.h,group:"_default"})}return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}var Ta=require("react/jsx-runtime"),Na={top:20,right:20,bottom:30,left:40},Fa=Ci;function Oa(e){if(e)return"x"===e.dimension?"pan-y":"y"===e.dimension?"pan-x":"none"}var Ba=(0,H.memo)((0,H.forwardRef)(function(e,t){const{chartType:n,runtimeMode:o,data:r,chunkThreshold:i,chunkSize:s,xAccessor:a,yAccessor:l,accessorRevision:c,colorAccessor:u,sizeAccessor:h,symbolAccessor:d,symbolMap:f,groupAccessor:p,lineDataAccessor:y,curve:m,normalize:g,baseline:x,stackOrder:b,binSize:v,valueAccessor:k,arrowOfTime:w="right",windowMode:A="sliding",windowSize:S=200,timeAccessor:C,xExtent:M,yExtent:j,extentPadding:_=.1,scalePadding:R,sizeRange:P,size:L=[500,300],responsiveWidth:I,responsiveHeight:T,margin:N,className:F,background:O,renderMode:B,lineStyle:D,pointStyle:W,areaStyle:E,barStyle:$,waterfallStyle:Y,swarmStyle:q,barColors:V,colorScheme:K,boundsAccessor:Q,boundsStyle:Z,y0Accessor:J,band:te,gradientFill:ne,lineGradient:oe,areaGroups:re,openAccessor:ie,highAccessor:se,lowAccessor:ae,closeAccessor:le,candlestickStyle:ce,showAxes:ue=!0,axes:he,xLabel:de,yLabel:fe,yLabelRight:pe,xFormat:ye,yFormat:me,axisExtent:ge,tickFormatTime:xe,tickFormatValue:be,hoverAnnotation:ve,tooltipContent:ke,customHoverBehavior:we,customClickBehavior:Ae,onObservation:Se,annotationObservationCallback:Ce,chartId:Me,enableHover:je,hoverRadius:_e=30,tooltipMode:Re,annotations:Pe,onAnnotationActivate:Le,autoPlaceAnnotations:Ie,svgAnnotationRules:Te,showGrid:Ne,legend:Fe,legendHoverBehavior:Oe,legendClickBehavior:Be,legendHighlightedCategory:De,legendIsolatedCategories:We,legendPosition:ze,legendLayout:He,legendCategoryAccessor:Ee,onCategoriesChange:$e,backgroundGraphics:Ye,foregroundGraphics:qe,canvasPreRenderers:Ge,svgPreRenderers:Ve,title:Xe,categoryAccessor:Ue,brush:Ke,onBrush:Qe,decay:Ze,pulse:Je,transition:et,animate:tt,staleness:nt,frameScheduler:ot,clock:rt,random:it,seed:st,paused:at=!1,suspendWhenHidden:lt=!0,heatmapAggregation:ct,heatmapXBins:ut,heatmapYBins:dt,showValues:ft,heatmapValueFormat:pt,marginalGraphics:yt,pointIdAccessor:mt,xScaleType:gt,yScaleType:xt,accessibleTable:vt=!0,description:kt,summary:wt,linkedCrosshairName:At,linkedCrosshairSourceId:St,customLayout:Ct,onLayoutError:Mt,layoutConfig:jt,layoutSelection:_t}=e,{customHoverBehavior:Rt,customClickBehavior:Pt,hasClickBehavior:Lt}=function({customHoverBehavior:e,customClickBehavior:t,onObservation:n,chartId:o,chartType:r}){return{customHoverBehavior:(0,Ra.useCallback)((t,i)=>{e?.(t,i),ja({onObservation:n,datum:t?t.data||t:null,x:t?.x,y:t?.y,chartType:r,chartId:o,context:i})},[o,r,e,n]),customClickBehavior:(0,Ra.useCallback)((e,i)=>{t?.(e,i),_a({onObservation:n,datum:e?e.data||e:null,x:e?.x,y:e?.y,chartType:r,chartId:o,context:i})},[o,r,t,n]),hasClickBehavior:!(!t&&!n)}}({customHoverBehavior:we,customClickBehavior:Ae,onObservation:Se,chartId:Me,chartType:"StreamXYFrame"}),It=(0,H.useId)().replace(/:/g,""),Tt=(0,H.useRef)(!1),Nt=(0,H.useRef)({w:-1,h:-1}),Ft=(0,H.useRef)(!1),Ot=Ls({sizeProp:L,responsiveWidth:I,responsiveHeight:T,userMargin:N,marginDefault:Na,title:Xe,legend:Fe,legendPosition:ze,animate:tt,transitionProp:et,frameScheduler:ot,clock:rt,random:it,seed:st,paused:at,suspendWhenHidden:lt,themeDirtyRef:Tt}),Bt=function(){const[e,t]=(0,mi.useState)(!1);return gi(()=>{t(!0)},[]),e}(),Dt=function(){const e=(0,mi.useSyncExternalStore)(xi,bi,vi);return(0,mi.useRef)(e).current}(),{reducedMotionRef:Wt,responsiveRef:zt,size:Ht,currentTheme:Et,transition:$t,introEnabled:Yt,tableId:qt,rafRef:Gt,renderFnRef:Vt,scheduleRender:Xt,frameRuntime:Ut}=Ot;let Kt=Ot.margin;if(yt){const e=60,t={...Ot.margin};yt.top&&e>t.top&&(t.top=e),yt.bottom&&e>t.bottom&&(t.bottom=e),yt.left&&e>t.left&&(t.left=e),yt.right&&e>t.right&&(t.right=e),Kt=t}const Qt=Ht[0]-Kt.left-Kt.right,en=Ht[1]-Kt.top-Kt.bottom,tn=(0,H.useMemo)(()=>X(r),[r]),nn=ve??je,[on,rn]=(0,H.useState)(0),ln=(0,H.useRef)(0),[un,hn]=(0,H.useState)(null),dn=Fs(qe,Ht,Kt,un),fn=Fs(Ye,Ht,Kt,un),pn=(0,H.useRef)(null),yn=(0,H.useRef)(null),xn=(0,H.useRef)(void 0),[bn,vn]=(0,H.useState)(null),kn=(0,H.useRef)(Fa.primary),wn=(0,H.useRef)(function(){let e=-1,t=Ci;return{resolve(n){if(!n)return Ci;const o=Nn;return o===e||(t=function(e){if(!e)return Ci;const t=getComputedStyle(e),n=t.getPropertyValue("--semiotic-border").trim(),o=t.getPropertyValue("--semiotic-text-secondary").trim(),r=t.getPropertyValue("--semiotic-bg").trim(),i=t.getPropertyValue("--semiotic-primary").trim(),s=o||t.getPropertyValue("--text-secondary").trim(),a=t.getPropertyValue("--text-primary").trim(),l=n||t.getPropertyValue("--surface-3").trim(),c=r||t.getPropertyValue("--surface-0").trim();return s||a||n||i?{axisStroke:l||Ci.axisStroke,tickText:s||Ci.tickText,crosshair:s?Mi(s,"66"):Ci.crosshair,hoverFill:c?Mi(c,"4D"):Ci.hoverFill,hoverStroke:s?Mi(s,"99"):Ci.hoverStroke,pointRing:c||Ci.pointRing,primary:i||Ci.primary,background:c||Ci.background}:Ci}(n),e=o),t},invalidate(){e=-1}}}()),An=(0,H.useRef)(!1),Cn=(0,Jt.useRef)(new sn("StreamXYFrame")),[jn,_n]=(0,H.useState)(!1),[Pn,Ln]=(0,H.useState)([]),[In,Tn]=(0,H.useState)([]),Fn="streaming"===o||["bar","swarm","waterfall"].includes(n),On=function(e){const t=(0,ki.useRef)(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return Ai(e,t);if(!Si(e)||!Si(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(!Ai(n,r))return!1}else{if(!Si(n)||!Si(r))return!1;if(!wi(n,r))return!1}}return!0}(t.current,e)||(t.current=e),t.current}((0,H.useMemo)(()=>({chartType:n,runtimeMode:Fn?"streaming":"bounded",windowSize:S,windowMode:A,arrowOfTime:Fn?w:"right",extentPadding:_,scalePadding:R,axisExtent:ge,xAccessor:a,yAccessor:l,accessorRevision:c,timeAccessor:Fn?C:void 0,valueAccessor:k,colorAccessor:u,sizeAccessor:h,symbolAccessor:d,symbolMap:f,groupAccessor:p||(y?"_lineGroup":void 0),categoryAccessor:Ue,lineDataAccessor:y,xScaleType:gt,yScaleType:xt,xExtent:M,yExtent:j,sizeRange:P,binSize:v,normalize:g,baseline:x,stackOrder:b,boundsAccessor:Q,boundsStyle:Z,y0Accessor:J,band:te,gradientFill:!0===ne?{topOpacity:.8,bottomOpacity:.05}:!1===ne?void 0:ne,areaGroups:re?new Set(re):void 0,lineGradient:oe,openAccessor:ie,highAccessor:se,lowAccessor:ae,closeAccessor:le,candlestickStyle:ce,lineStyle:D,pointStyle:W,areaStyle:E,swarmStyle:q,waterfallStyle:Y,colorScheme:K,barColors:V,barStyle:$,annotations:Pe,decay:Ze,pulse:Je,transition:$t,introAnimation:Yt,staleness:nt,clock:Ut.now,heatmapAggregation:ct,heatmapXBins:ut,heatmapYBins:dt,showValues:ft,heatmapValueFormat:pt,pointIdAccessor:mt,curve:m,themeCategorical:Et?.colors?.categorical,themeSemantic:ee(Et),themeSequential:Et?.colors?.sequential,themeDiverging:Et?.colors?.diverging,customLayout:Ct,onLayoutError:Mt,layoutConfig:jt,layoutMargin:Kt}),[n,Fn,S,A,w,_,R,ge,a,l,c,C,k,u,h,d,f,p,y,Ue,gt,xt,M,j,P,v,g,x,b,Q,Z,J,te,ne,re,oe,ie,se,ae,le,ce,D,W,E,q,Y,K,V,$,Pe,Ze,Je,$t,Yt,nt,Ut.now,ct,ut,dt,ft,pt,mt,m,Et,Ct,Mt,jt,Kt])),Bn=(0,H.useRef)(null);Bn.current||(Bn.current=new Zt(On));const Wn=function(e,t,n,o){const r=(0,Bs.useRef)({accessor:t,onChange:n,readData:o}),i=(0,Bs.useRef)([]);return r.current={accessor:t,onChange:n,readData:o},(0,Bs.useCallback)(()=>{const{accessor:t,onChange:n,readData:o}=r.current;if(!n||!t)return;const s=function(e,t){if(!t)return[];const n=new Set,o=[];for(const r of e){if(!r||"object"!=typeof r)continue;const e="function"==typeof t?t(r):r[t];if(null==e)continue;const i=e+"";n.has(i)||(n.add(i),o.push(i))}return o}(e.current?o(e.current):[],t);(function(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0})(s,i.current)||(i.current=s,n(s))},[e])}(Bn,Ee,$e,e=>e.getData());!function(e,t,n,o){(0,gn.useEffect)(()=>{e.current?.updateConfig(t),n.current=!0,o()},[t,o,e,n])}(Bn,On,Tt,Xt),function(e,t,n,o){const r=(0,gn.useRef)(null);(0,gn.useEffect)(()=>{const i=e.current;if(!i)return;const s=t??null;r.current!==s&&(r.current=s,i.setLayoutSelection(s),i.hasCustomRestyle?i.restyleScene(s):n.current=!0,o())},[t,o,e,n])}(Bn,_t,Tt,Xt);const zn=(0,H.useRef)(null);zn.current||(zn.current=new U(e=>{const t=Bn.current;t&&t.ingest(e)&&(Tt.current=!0,Xt())},{chunkThreshold:i,chunkSize:s})),(0,H.useEffect)(()=>{zn.current?.updateChunkOptions({chunkThreshold:i,chunkSize:s})},[i,s]);const En=(0,H.useCallback)(e=>{zn.current?.push(e)},[]),$n=(0,H.useCallback)(e=>{zn.current?.pushMany(e)},[]),Yn=(0,H.useCallback)(()=>{zn.current?.clear(),Bn.current?.clear(),Tt.current=!0,Xt()},[Xt]);(0,H.useImperativeHandle)(t,()=>({push:En,pushMany:$n,remove:e=>{zn.current?.flush();const t=Bn.current?.remove(e)??[];return t.length>0&&(pn.current&&t.some(e=>e===pn.current?.data)&&(pn.current=null,vn(null)),Tt.current=!0,Xt()),t},update:(e,t)=>{zn.current?.flush();const n=Bn.current?.update(e,t)??[];return n.length>0&&(Tt.current=!0,Xt()),n},clear:Yn,getData:()=>(zn.current?.flush(),Bn.current?.getData()??[]),getScales:()=>Bn.current?.scales??null,getExtents:()=>Bn.current?.getExtents()??null,getCustomLayout:()=>Bn.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>Bn.current?.lastCustomLayoutFailure??null}),[En,$n,Yn,Xt]),(0,H.useEffect)(()=>{if(r){if(y&&tn.length>0&&"object"==typeof tn[0]&&null!==tn[0]){const e="string"==typeof y?y:"coordinates";if(Array.isArray(tn[0][e])){const t=[];for(const n of tn){const o=n[e];if(Array.isArray(o)){const e=n.label||n.id||n.key;if(null!=e)for(const n of o)t.push({...n,_lineGroup:e});else for(const e of o)t.push(e)}}return void zn.current?.setBoundedData(t)}}zn.current?.setBoundedData(tn)}},[r,tn,y]);const{canvasRef:Gn,interactionCanvasRef:Vn}=function(e,t){return function(e){const{cancelRender:t,dirtyRef:n,frameRuntime:o,manageFrameRuntime:r,scheduleRender:i}=e,s=(0,Is.useRef)(null),a=(0,Is.useRef)(null),l=(0,Is.useRef)(!1);return function(e){const{hydrated:t,wasHydratingFromSSR:n,storeRef:o,dirtyRef:r,renderFnRef:i,cancelRender:s,cleanup:a}=e;gi(()=>{t&&n&&o.current?.cancelIntroAnimation?.(),r.current=!0,s?.(),i.current()},[t,n]);const l=(0,mi.useRef)(a);l.current=a,(0,mi.useEffect)(()=>()=>l.current?.(),[])}({hydrated:e.hydrated,wasHydratingFromSSR:e.wasHydratingFromSSR,storeRef:e.storeRef,dirtyRef:e.dirtyRef,renderFnRef:e.renderFnRef,cancelRender:e.cancelRender,cleanup:e.cleanup}),(0,Is.useEffect)(()=>{if(!1!==r)return o.subscribe(()=>{o.isActive?(n.current=!0,i()):t()})},[t,n,o,r,i]),(0,Is.useEffect)(()=>{!l.current&&(l.current=!0,e.skipInitialCanvasPaintInvalidation)||(e.dirtyRef.current=!0,e.scheduleRender())},e.canvasPaintDependencies),{canvasRef:s,interactionCanvasRef:a}}({...t,renderFnRef:e.renderFnRef,scheduleRender:e.scheduleRender,cancelRender:e.cancelRender,frameRuntime:e.frameRuntime})}(Ot,{storeRef:Bn,dirtyRef:Tt,hydrated:Bt,wasHydratingFromSSR:Dt,cleanup:()=>zn.current?.clear(),canvasPaintDependencies:[n,Qt,en,ue,O,Ye,D,B,Ge,Xt]}),{hoverHandlerRef:Xn,hoverLeaveRef:Un,onPointerMove:Kn,onPointerLeave:Qn}=Ot;Xn.current=e=>{if(!nn)return;const t=Gn.current;if(!t)return;const o=t.getBoundingClientRect(),r=e.clientX-o.left-Kt.left,i=e.clientY-o.top-Kt.top;if(0>r||r>Qt||0>i||i>en)return void(pn.current&&(pn.current=null,yn.current=null,vn(null),Rt&&(Rt(null),Tt.current=!0),Xt()));const s=Bn.current;if(!s||0===s.scene.length)return;const l=os(_e,e.pointerType),c=to(s.scene,r,i,l,s.quadtree,s.maxPointRadius),u="multi"===Re,h=()=>{pn.current&&(pn.current=null,yn.current=null,vn(null),Rt&&Rt(null),Xt())};if(!c&&!u)return void h();const d=u||!c?r:c.x,f=u||!c?i:c.y,p=c?.datum?ht(c.datum,s.resolvedRibbons):{},y=s.scales?.x?.invert,m="function"==typeof y?y(d):void 0;let g=is(p,d,f,null!=m?{xValue:m,xPx:d}:void 0);if(u&&s.scene.length>0&&s.scales){const e=function(e,t,n=30){const o=[];for(const r of e)if("line"===r.type){const e=r;if(2>e.path.length)continue;const i=no(eo(e.path,e.curve),t,n);if(null===i)continue;const s=fo(e.path,t);o.push({node:r,datum:Array.isArray(e.datum)&&e.datum[s]?e.datum[s]:e.datum,x:e.path[s][0],y:i,group:e.group,color:e.style.stroke})}else if("area"===r.type){const e=r;if(!1===e.interactive)continue;if(2>e.topPath.length)continue;const i=eo(e.topPath,e.curve),s=eo(e.bottomPath,e.curve),a=no(i,t,n);if(null===a)continue;const l=no(s,t,n),c=fo(e.topPath,t);o.push({node:r,datum:Array.isArray(e.datum)&&e.datum[c]?e.datum[c]:e.datum,x:e.topPath[c][0],y:a,y0:l??void 0,group:e.group,color:"string"==typeof e.style.stroke?e.style.stroke:"string"==typeof e.style.fill?e.style.fill:void 0})}return o}(s.scene,d,Math.max(l,Qt));if(e.length>0){const t=s.scales.y.invert,o=kn.current,r=y?y(d):d;if(c)g.xValue=r,g.xPx=d;else{const e={xValue:r};"string"==typeof a&&(e[a]=r),g=is(e,d,f,{xValue:r,xPx:d})}g.allSeries=e.map(e=>{const r=t?t(e.y):e.y,i=null!=e.y0?t?t(e.y0):e.y0:void 0;return{group:e.group||"",value:"stackedarea"===n&&null!=i?r-i:r,valuePx:e.y,color:e.color||o,datum:ht(e.datum,s.resolvedRibbons)}})}}c||g.allSeries?.length?(pn.current=g,yn.current=c?.node??null,vn(g),Rt&&(Rt(g),Tt.current=!0),Xt()):h()},Un.current=()=>{pn.current&&(pn.current=null,yn.current=null,vn(null),Rt&&(Rt(null),Tt.current=!0),Xt())};const Zn=(0,H.useRef)(()=>{});Zn.current=e=>{if((t=e.target)instanceof Element&&null!=t.closest("[data-semiotic-annotation-widget]"))return;var t;if(!Pt)return;const n=Gn.current;if(!n)return;const o=n.getBoundingClientRect(),r=e.clientX-o.left-Kt.left,i=e.clientY-o.top-Kt.top;if(0>r||r>Qt||0>i||i>en)return void Pt(null);const s=Bn.current;if(!s||0===s.scene.length)return void Pt(null);const a=os(_e,xn.current),l=to(s.scene,r,i,a,s.quadtree,s.maxPointRadius);if(!l)return void Pt(null);const c=l.datum||{},u=s.scales?.x?.invert,h="function"==typeof u?u(l.x):void 0;var d;Pt(is(c,l.x,l.y,null!=h?{xValue:h,xPx:l.x}:void 0),{type:"activate",inputType:(d=xn.current,"touch"===d?"touch":"pointer")})};const Jn=(0,H.useCallback)(e=>Zn.current(e),[]),{kbFocusIndexRef:oo,focusedNavPointRef:ro,onKeyDown:io}=(so={storeRef:Bn,hoverRef:pn,hoveredNodeRef:yn,setHoverPoint:vn,customHoverBehavior:Rt,customClickBehavior:Pt,scheduleRender:Xt},function({storeRef:e,hoverRef:t,hoveredNodeRef:n,setHoverPoint:o,customHoverBehavior:r,customClickBehavior:i,scheduleRender:s,extractPoints:a,toHover:l}){const c=(0,Pa.useRef)(-1),u=(0,Pa.useRef)(null),h=(0,Pa.useRef)(null),d=(0,Pa.useCallback)(d=>{if(function(e){const t=e.target;return t instanceof Element&&t!==e.currentTarget&&null!=t.closest("button, a[href], input, select, textarea, summary, [contenteditable='true'], [role='button'], [role='link'], [role='checkbox'], [role='radio'], [role='switch']")}(d))return;const f=e.current;if(!f)return;const p=()=>{c.current=-1,u.current=null,t.current=null,n&&(n.current=null),o(null),r(null),s()};if(0===f.scene.length)return void(0>c.current||p());let y;if(h.current?.version===f.version)y=h.current.graph;else{const e=a(f.scene);if(0===e.length)return void(0>c.current||p());y=function(e){const t=new Map;for(const n of e){const e=n.group??"_default";let o=t.get(e);o||(o=[],t.set(e,o)),o.push(n)}for(const e of t.values()){e.sort((e,t)=>e.x-t.x||e.y-t.y);for(let t=0;e.length>t;t++)e[t]._groupIndex=t}const n=Array.from(t.keys()).sort((e,n)=>{const o=t.get(e),r=t.get(n);return(o.length>0?o[0].y:0)-(r.length>0?r[0].y:0)}),o=Array.from(t.values()).flat();o.sort((e,t)=>e.x-t.x||e.y-t.y);const r=new Map;for(let e=0;o.length>e;e++){o[e]._flatIndex=e;const t=o[e].datum?.id;null!=t&&r.set(t+"",e)}return{flat:o,groups:n,byGroup:t,idToIdx:r}}(e),h.current={version:f.version,graph:y}}let m=c.current;if(y.flat.length>m||(p(),m=-1),("Enter"===d.key||" "===d.key)&&m>=0)return d.preventDefault(),void i(l(y.flat[m],f),{type:"activate",inputType:"keyboard"});if(0>m){if("Escape"===d.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(d.key))return;d.preventDefault(),c.current=0;const e=y.flat[0];u.current=e;const n=l(e,f);return t.current=n,o(n),r(n,{type:"focus",inputType:"keyboard"}),void s()}const g=function(e,t,n){const{group:o,indexInGroup:r}=t,i=n.byGroup.get(o);switch(e){case"ArrowRight":return i.length-1>r?i[r+1]._flatIndex:t.flatIndex;case"ArrowLeft":return r>0?i[r-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=n.groups.indexOf(o);return n.groups.length-1>e?La(n,n.groups[e+1],i[r]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?La(n,n.groups[e-1],i[r]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*n.flat.length)),n.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*n.flat.length)),0);case"Home":return 0;case"End":return n.flat.length-1;case"Escape":return-1;default:return null}}(d.key,function(e,t){if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const n=Math.max(0,Math.min(t,e.flat.length-1)),o=e.flat[n];return{flatIndex:n,group:o.group??"_default",indexInGroup:o._groupIndex??0}}(y,m),y);if(null===g)return;if(d.preventDefault(),0>g)return void p();c.current=g;const x=y.flat[g];u.current=x;const b=l(x,f);t.current=b,o(b),r(b,{type:"focus",inputType:"keyboard"}),s()},[i,r,a,t,n,s,o,e,l]);return{kbFocusIndexRef:c,focusedNavPointRef:u,onKeyDown:d}}({...so,extractPoints:Ia,toHover:(e,t)=>function(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}({...e,datum:ht(e.datum,t.resolvedRibbons)})}));var so;const ao=(0,H.useCallback)(e=>{xn.current=e.pointerType,oo.current=-1,ro.current=null,Kn(e)},[ro,oo,Kn]),lo=(0,H.useCallback)(e=>{xn.current="mouse",oo.current=-1,ro.current=null,Kn({clientX:e.clientX,clientY:e.clientY,pointerType:"mouse"})},[ro,oo,Kn]),co=(0,H.useCallback)(e=>{xn.current=e.pointerType},[]);Vt.current=()=>{if(Gt.current=null,!Ut.isActive)return;const e=Gn.current,t=Vn.current;if(!e||!t)return;const o=Bn.current;if(!o)return;const r=Ut.now(),i=o.advanceTransition(Wt.current?r+1e6:r),s=!Wt.current&&i,c=Nt.current.w!==Qt||Nt.current.h!==en,u=Tt.current||i||c,h=o.consumeStylePaintPending();let d=!1;const f=o.getLastUpdateResult(),p=Cn.current.beforeCompute(f,s);!u||s&&!c||(o.computeScene({width:Qt,height:en}),Nt.current={w:Qt,h:en},d=!0,Wn()),Cn.current.afterCompute(p,d,c);const y=function(e,t,n,o){const r=o.current,i=!0===e.lastCustomLayoutFailure?.preservedLastGoodScene,s=!i&&e.hasActivePulsesAt(t),a=!(n||i||!s&&!r)&&e.refreshPulse(t);return o.current=s,{changed:a,pending:s}}(o,r,d,Ft),m=function(){if("undefined"==typeof window)return 1;const e=window.devicePixelRatio||1,t=function(){if("undefined"==typeof window)return!1;const e="function"==typeof window.matchMedia&&window.matchMedia("(pointer: coarse)").matches,t=768>Math.min(window.innerWidth||1/0,window.innerHeight||1/0);return e||t}()?2:3;return Math.max(1,Math.min(e,t))}(),g=wn.current.resolve(e);kn.current=g.primary;const x=go(nt,o.lastIngestTime>0?r-o.lastIngestTime:0),b=nt&&x.isStale;if(u||h||y.changed){const t=Os(e,Ht,Kt,m);if(t){if(t.clearRect(-Kt.left,-Kt.top,Ht[0],Ht[1]),nt&&1>x.alpha&&(t.globalAlpha=x.alpha),function(e,t){const{background:n,hasBackgroundGraphics:o=!1,themeBackground:r="",x:i=0,y:s=0,width:a,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=Dn(e,c);u&&(e.fillStyle=u,e.fillRect(i,s,a,l))}(t,{background:O,hasBackgroundGraphics:!!Ye,themeBackground:g.background,x:-Kt.left,y:-Kt.top,width:Ht[0],height:Ht[1]}),t.save(),"function"==typeof t.rect&&(t.beginPath(),t.rect(0,0,Qt,en),t.clip()),Ge&&o.scales)for(const e of Ge)t.save(),e(t,o.scene,o.scales,{width:Qt,height:en}),t.restore();const e=Ct?fa.custom:fa[n];!function(e){const{context:t,nodes:n,renderMode:o,pixelRatio:r,paintBuiltIn:i}=e;if(!o||"sketchy"===o)return void i(n);let s=[];const a=()=>{s.length&&(i(s),s=[])};for(const e of n){const n=ya(o,e);if(!n){s.push(e);continue}let l;a(),t.save();try{l=n.drawCanvas({context:t,node:e,style:e.style??{},pixelRatio:r})}finally{t.restore()}l||(ma(n.id,e.type??"unknown"),i([e]))}a()}({context:t,nodes:o.scene,renderMode:B,pixelRatio:m,paintBuiltIn:n=>{if(e&&o.scales)for(const r of e)r(t,n,o.scales,{width:Qt,height:en})}}),t.restore(),nt&&1>x.alpha&&(t.globalAlpha=1)}}const v=!!(nn&&pn.current&&o.scales),k=!!(yn.current&&Array.isArray(ve)&&ve.some(e=>e&&"object"==typeof e&&"highlight"===e.type)),w=v||k;if(w||An.current){const e=Os(t,Ht,Kt,m);if(e&&(e.clearRect(-Kt.left,-Kt.top,Ht[0],Ht[1]),v&&pn.current&&function(e,t,n,o,r,i,s){if(!1===r.crosshair)return;const a=t.allSeries,l=a&&a.length>0,c=t.xPx??t.x;e.save();const u="object"==typeof r.crosshair?r.crosshair:{};if(e.strokeStyle=u.stroke||s.crosshair,e.lineWidth=u.strokeWidth||1,e.setLineDash(u.strokeDasharray?u.strokeDasharray.split(/[\s,]+/).map(Number):[4,4]),e.beginPath(),e.moveTo(l?c:t.x,0),e.lineTo(l?c:t.x,o),e.stroke(),l||(e.beginPath(),e.moveTo(0,t.y),e.lineTo(n,t.y),e.stroke()),e.restore(),l){e.lineWidth=2,e.strokeStyle=s.pointRing;for(const t of a)null!=t.valuePx&&(e.beginPath(),e.arc(c,t.valuePx,4,0,2*Math.PI),e.fillStyle=t.color||s.primary,e.fill(),e.stroke())}else{const n=r.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}(i)||s.primary;e.beginPath(),e.arc(t.x,t.y,4,0,2*Math.PI),e.fillStyle=n,e.fill(),e.strokeStyle=s.pointRing,e.lineWidth=2,e.stroke()}}(e,pn.current,Qt,en,"object"==typeof nn?nn:{},yn.current,g),k&&yn.current&&Array.isArray(ve))){const t=ve.find(e=>e&&"object"==typeof e&&"highlight"===e.type);t&&function(e,t,n,o,r){if(!n)return;const i="group"in n?n.group:void 0;if(void 0!==i)for(const n of t){if("line"!==n.type)continue;if(n.group!==i)continue;if(2>n.path.length)continue;const t="function"==typeof o.style?n.datum?o.style(n.datum):{}:o.style||{};e.save(),e.beginPath(),e.moveTo(n.path[0][0],n.path[0][1]);for(let t=1;n.path.length>t;t++)e.lineTo(n.path[t][0],n.path[t][1]);e.strokeStyle=t.stroke||n.style.stroke||r.primary,e.lineWidth=t.strokeWidth||(n.style.strokeWidth||2)+2,e.globalAlpha=t.opacity??1,e.stroke(),e.restore()}}(e,o.scene,yn.current,t,g)}An.current=w}u&&e&&e.setAttribute("aria-label",Bi(o.scene,n+" chart"));const A=Tt.current;if(Tt.current=A&&s&&!d,A&&o.scales){const e=e=>"object"==typeof e&&null!==e&&"function"==typeof e.valueOf?e.valueOf():e;if((!un||e(un.x.domain()[0])!==e(o.scales.x.domain()[0])||e(un.x.domain()[1])!==e(o.scales.x.domain()[1])||e(un.y.domain()[0])!==e(o.scales.y.domain()[0])||e(un.y.domain()[1])!==e(o.scales.y.domain()[1])||un.x.range()[0]!==o.scales.x.range()[0]||un.x.range()[1]!==o.scales.x.range()[1]||un.y.range()[0]!==o.scales.y.range()[0]||un.y.range()[1]!==o.scales.y.range()[1])&&hn(o.scales),yt){const e=o.getData(),t="function"==typeof a?a:e=>e[a||"x"],n="function"==typeof l?l:e=>e[l||"y"];Ln(e.map(e=>t(e)).filter(e=>"number"==typeof e&&isFinite(e))),Tn(e.map(e=>n(e)).filter(e=>"number"==typeof e&&isFinite(e)))}}!((Pe&&Pe.length>0||Ct)&&(d||s))||!d&&33>r-ln.current||(rn(e=>e+1),ln.current=r),nt?.showBadge&&_n(!!b),(s||null!=o.activeTransition||y.pending)&&Xt()},function(e,t,n,o,r,i){const s=(0,po.useRef)("fresh");(0,po.useEffect)(()=>{if(!e)return;const a=setInterval(()=>{const a=t.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=go(e,l-a.lastIngestTime);c.band===s.current&&c.isStale===r||(s.current=c.band,c.isStale!==r&&i(c.isStale),n.current=!0,o())},1e3);return()=>clearInterval(a)},[e,r,o,t,i,n])}(nt,Bn,Tt,Xt,jn,_n);const uo=(0,H.useMemo)(()=>{if(ye||xe)return;const e=Bn.current;return e?.xIsDate&&un?Hs(un.x.domain()):void 0},[ye,xe,un]),ho=ye||xe||uo,yo=nn&&bn?ke?ke(bn):(0,Ta.jsx)(Ma,{hover:bn}):null,mo=yo?(0,Ta.jsx)(bs,{x:bn.x,y:bn.y,containerWidth:Qt,containerHeight:en,margin:Kt,className:"stream-frame-tooltip",children:yo}):null,xo=ro.current,vo=(0,Ta.jsx)(ts,{active:oo.current>=0,hoverPoint:bn,margin:Kt,size:Ht,shape:xo?.shape,width:xo?.w,height:xo?.h}),ko=Ds(a,C,"__semiotic_resolvedX","__semiotic_resolvedTime"),wo=Ds(l,k,"__semiotic_resolvedY","__semiotic_resolvedValue"),Ao=ko.key,So=wo.key,Co=function(e,t,n){return o=>{if(!o||!n||!e.fn&&!t.fn)return o;let r=!1;const i=o.map(n=>{const o=e.fn&&e.key&&!(e.key in n),i=t.fn&&t.key&&!(t.key in n);if(!o&&!i)return n;r=!0;const s={...n};return o&&(s[e.key]=e.fn(n)),i&&(s[t.key]=t.fn(n)),s});return r?i:o}}(ko,wo,Pe&&Pe.length>0||!1);if(yi||!Bt&&Dt){const e=Bn.current;e&&r&&(e.ingest({inserts:tn,bounded:!0}),e.computeScene({width:Qt,height:en}));const t=e?.scene??[],n=e?.scales??null,o=Fs(qe,Ht,Kt,n),i=Fs(Ye,Ht,Kt,n),s=ho||(()=>{if(e?.xIsDate&&n)return Hs(n.x.domain())})();return(0,Ta.jsxs)("div",{ref:zt,className:"stream-xy-frame"+(F?" "+F:""),role:"img","aria-label":kt||("string"==typeof Xe?Xe:"XY chart"),style:{position:"relative",width:I?"100%":Ht[0],height:T?"100%":Ht[1]},children:[(0,Ta.jsx)(Qi,{summary:wt}),(0,Ta.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:Ht[0],height:Ht[1],style:{position:"absolute",left:0,top:0},children:[(0,Ta.jsx)("g",{transform:`translate(${Kt.left},${Kt.top})`,children:i}),(0,Ta.jsxs)("g",{transform:`translate(${Kt.left},${Kt.top})`,children:[O&&(0,Ta.jsx)("rect",{x:0,y:0,width:Qt,height:en,fill:O}),Ve&&n&&Ve.map((e,o)=>(0,Ta.jsx)(z.Fragment,{children:e(t,n,{width:Qt,height:en})},"svgpre-"+o)),t.map((e,t)=>function(e){const{node:t,index:n,renderMode:o,fallback:r}=e,i=ya(o,t);if(!i)return r();const s=i.renderStaticSVG({node:t,style:t.style??{},key:`${i.id}-${n}`});return null!=s?s:(ma(i.id,t.type??"unknown"),r())}({node:e,index:t,renderMode:B,fallback:()=>function(e,t,n){switch(e.type){case"line":{const n=e;if(0===n.path.length)return null;const o="M"+n.path.map(([e,t])=>`${e},${t}`).join("L");return(0,fi.jsx)("path",{d:o,fill:"none",stroke:n.style.stroke||"#4e79a7",strokeWidth:n.style.strokeWidth||2,strokeDasharray:n.style.strokeDasharray,opacity:n.style.opacity},"line-"+t)}case"area":{const o=e;if(0===o.topPath.length)return null;const r=`M${o.topPath.map(([e,t])=>`${e},${t}`).join("L")}L${[...o.bottomPath].reverse().map(([e,t])=>`${e},${t}`).join("L")}Z`,i=`${n?n+"-":""}area-${t}-hatch`,s=Hn(o.style.fill)?qn(o.style.fill,i):void 0,a=s?`url(#${i})`:pi(o.style.fill);if(o.clipRect){const e=`${n?n+"-":""}area-clip-${t}`;return(0,fi.jsxs)("g",{children:[(0,fi.jsxs)("defs",{children:[s,(0,fi.jsx)("clipPath",{id:e,children:(0,fi.jsx)("rect",{x:o.clipRect.x,y:o.clipRect.y,width:o.clipRect.width,height:o.clipRect.height})})]}),(0,fi.jsx)("path",{d:r,fill:a,fillOpacity:o.style.fillOpacity??o.style.opacity??.7,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,clipPath:`url(#${e})`})]},"area-"+t)}return(0,fi.jsxs)(hi.Fragment,{children:[s&&(0,fi.jsx)("defs",{children:s}),(0,fi.jsx)("path",{d:r,fill:a,fillOpacity:o.style.fillOpacity??o.style.opacity??.7,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth})]},"area-"+t)}case"point":{const o=e,r=`${n?n+"-":""}point-${t}-hatch`,i=Hn(o.style.fill)?qn(o.style.fill,r):void 0;return(0,fi.jsxs)(hi.Fragment,{children:[i&&(0,fi.jsx)("defs",{children:i}),(0,fi.jsx)("circle",{cx:o.x,cy:o.y,r:o.r,fill:i?`url(#${r})`:pi(o.style.fill),opacity:o.style.opacity??.8,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth})]},"point-"+t)}case"symbol":return function(e,t){const n=bt(e.symbolType,e.size,e.path);return(0,fi.jsx)("path",{d:n,transform:e.rotation?`translate(${e.x},${e.y}) rotate(${180*e.rotation/Math.PI})`:`translate(${e.x},${e.y})`,fill:e.style.fill?pi(e.style.fill):"none",opacity:e.style.opacity,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth},"symbol-"+t)}(e,t);case"glyph":return function(e,t,n,o){const r=e.glyph;if(!r?.parts?.length||0>=e.size)return null;const i=Sn(r,e.size);if(0>=i.scale)return null;const s=`translate(${t},${n})${e.rotation?` rotate(${180*e.rotation/Math.PI})`:""} translate(${i.offsetX},${i.offsetY}) scale(${i.scale})`,a=e.color??("string"==typeof e.style.fill?e.style.fill:void 0),l=Rn(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:Mn(n.fill,a,e.accent),i=t?n.stroke&&"none"!==n.stroke?t:void 0:Mn(n.stroke??"none",a,e.accent);return r||i?(0,fi.jsx)("path",{d:n.d,fill:r??"none",stroke:i,strokeWidth:i?n.strokeWidth??1:void 0,strokeLinecap:n.strokeLinecap,strokeLinejoin:n.strokeLinejoin,opacity:n.opacity},o):null});return(0,fi.jsxs)("g",{transform:s,opacity:1===u?void 0:u,children:[l&&c&&(0,fi.jsx)("clipPath",{id:c,children:(0,fi.jsx)("rect",{x:l.x,y:l.y,width:l.width,height:l.height})}),l&&e.ghostColor?(0,fi.jsx)("g",{children:h(e.ghostColor)}):null,l&&c?(0,fi.jsx)("g",{clipPath:`url(#${c})`,children:h()}):h()]},o)}(e,e.x,e.y,`${n??""}glyph-${e.pointId??t}`);case"rect":{const o=e,r=`${n?n+"-":""}xyrect-${t}-hatch`,i=Hn(o.style.fill)?qn(o.style.fill,r):void 0;return(0,fi.jsxs)(hi.Fragment,{children:[i&&(0,fi.jsx)("defs",{children:i}),(0,fi.jsx)("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:i?`url(#${r})`:pi(o.style.fill),opacity:o.style.opacity,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth})]},"rect-"+t)}case"heatcell":{const n=e;if(n.showValues&&null!=n.value&&n.w>=20&&n.h>=20){const e=n.valueFormat?n.valueFormat(n.value):Number.isInteger(n.value)?n.value+"":100>Math.abs(n.value)?1>Math.abs(n.value)?n.value.toPrecision(3):n.value.toFixed(1):n.value.toFixed(0),[o,r,i]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(n.fill),s=.299*o+.587*r+.114*i>128?"#000":"#fff",a=Math.max(10,Math.min(16,.3*Math.min(n.w,n.h)));return(0,fi.jsxs)("g",{children:[(0,fi.jsx)("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:n.fill}),(0,fi.jsx)("text",{x:n.x+n.w/2,y:n.y+n.h/2,textAnchor:"middle",dominantBaseline:"middle",fill:s,fontSize:a+"px",children:e})]},"heatcell-"+t)}return(0,fi.jsx)("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:n.fill},"heatcell-"+t)}case"candlestick":{const n=e,o=Math.min(n.openY,n.closeY),r=Math.max(Math.abs(n.openY-n.closeY),1),i=n.isUp?n.upColor:n.downColor;return(0,fi.jsxs)("g",{children:[(0,fi.jsx)("line",{x1:n.x,y1:n.highY,x2:n.x,y2:n.lowY,stroke:n.wickColor,strokeWidth:n.wickWidth}),(0,fi.jsx)("rect",{x:n.x-n.bodyWidth/2,y:o,width:n.bodyWidth,height:r,fill:i,stroke:i,strokeWidth:1})]},"candle-"+t)}default:return null}}(e,t,It)})).filter(Boolean)]})]}),(0,Ta.jsx)(ui,{width:Qt,height:en,totalWidth:Ht[0],totalHeight:Ht[1],margin:Kt,scales:n,showAxes:ue,axes:he,xLabel:de,yLabel:fe,yLabelRight:pe,xFormat:s,yFormat:me||be,axisExtent:ge,showGrid:Ne,title:Xe,legend:Fe,legendHoverBehavior:Oe,legendClickBehavior:Be,legendHighlightedCategory:De,legendIsolatedCategories:We,legendPosition:ze,legendLayout:He,foregroundGraphics:cn(o,mn(Bn.current?.customLayoutOverlays,_t??null)),marginalGraphics:yt,xValues:[],yValues:[],annotations:Pe,onAnnotationActivate:Le,onObservation:Ce??Se,chartId:Me,chartType:"StreamXYFrame",autoPlaceAnnotations:Ie,svgAnnotationRules:Te,annotationFrame:0,xAccessor:Ao,yAccessor:So,annotationData:Co(Bn.current?.getData()),pointNodes:Es(Bn.current?.scene),curve:"string"==typeof m?m:void 0,linkedCrosshairName:At,linkedCrosshairSourceId:St})]})}return(0,Ta.jsxs)("div",{ref:zt,className:"stream-xy-frame"+(F?" "+F:""),role:"group","aria-label":kt||("string"==typeof Xe?Xe:"XY chart"),tabIndex:0,style:{position:"relative",width:I?"100%":Ht[0],height:T?"100%":Ht[1],overflow:"visible",touchAction:Oa(Ke)},onKeyDown:io,children:["production"!==process.env.NODE_ENV&&Bn.current&&(0,Ta.jsx)(an,{store:Bn.current,diagnostics:Cn.current}),vt&&(0,Ta.jsx)(Zi,{tableId:qt}),vt&&(0,Ta.jsx)(Ki,{scene:Bn.current?.scene??[],chartType:n+" chart",tableId:qt,chartTitle:"string"==typeof Xe?Xe:void 0}),(0,Ta.jsx)(Qi,{summary:wt}),(0,Ta.jsx)(Ii,{hoverPoint:bn}),(0,Ta.jsxs)("div",{role:"img","aria-label":kt||("string"==typeof Xe?Xe:"XY chart"),style:{position:"relative",width:"100%",height:"100%"},onPointerMove:nn?ao:void 0,onMouseMove:nn?lo:void 0,onPointerLeave:nn?Qn:void 0,onMouseLeave:nn?Qn:void 0,onPointerDown:nn||Lt?co:void 0,onClick:Lt?Jn:void 0,children:[(0,Ta.jsx)(Ns,{size:Ht,margin:Kt,children:fn}),(0,Ta.jsx)(ai,{width:Qt,height:en,totalWidth:Ht[0],totalHeight:Ht[1],margin:Kt,scales:un,showAxes:ue,axes:he,showGrid:Ne,xFormat:ho,yFormat:me||be,axisExtent:ge}),(0,Ta.jsx)("canvas",{ref:Gn,"aria-label":Bi(Bn.current?.scene??[],n+" chart"),style:{position:"absolute",left:0,top:0}}),(0,Ta.jsx)("canvas",{ref:Vn,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),(0,Ta.jsx)(ui,{width:Qt,height:en,totalWidth:Ht[0],totalHeight:Ht[1],margin:Kt,scales:un,showAxes:ue,axes:he,xLabel:de,yLabel:fe,yLabelRight:pe,xFormat:ho,yFormat:me||be,axisExtent:ge,showGrid:Ne,title:Xe,legend:Fe,legendHoverBehavior:Oe,legendClickBehavior:Be,legendHighlightedCategory:De,legendIsolatedCategories:We,legendPosition:ze,legendLayout:He,foregroundGraphics:cn(dn,mn(Bn.current?.customLayoutOverlays,_t??null)),marginalGraphics:yt,xValues:Pn,yValues:In,annotations:Pe,onAnnotationActivate:Le,onObservation:Ce??Se,chartId:Me,chartType:"StreamXYFrame",autoPlaceAnnotations:Ie,svgAnnotationRules:Te,annotationFrame:on,xAccessor:Ao,yAccessor:So,annotationData:Co(Bn.current?.getData()),pointNodes:Es(Bn.current?.scene),curve:"string"==typeof m?m:void 0,underlayRendered:!0,canvasObscuresUnderlay:"transparent"!==O&&!Ye,linkedCrosshairName:At,linkedCrosshairSourceId:St}),(Ke||Qe)&&(0,Ta.jsx)(G,{width:Qt,height:en,totalWidth:Ht[0],totalHeight:Ht[1],margin:Kt,dimension:Ke?.dimension??"xy",scales:un,onBrush:Qe??(()=>{}),binSize:v,snap:Ke?.snap,binBoundaries:Ke?.binBoundaries??("bar"===n?Bn.current?.getBinBoundaries():void 0),snapDuring:Ke?.snapDuring,streaming:"streaming"===o}),nt?.showBadge&&(0,Ta.jsx)(bo,{isStale:jn,position:nt.badgePosition}),vo,mo]})]})}));Ba.displayName="StreamXYFrame";var Da=Ba,Wa=require("react"),za=require("react"),Ha=require("react"),Ea=require("react/jsx-runtime"),$a=(0,Ha.createContext)(null);function Ya({colors:e,categories:t,colorScheme:n="category10",children:o}){const r=(0,Ha.useMemo)(()=>{if(e)return e;if(t){if(n&&"object"==typeof n&&!Array.isArray(n)){const e=n,o={};let r=0;for(const n of t)o[n]=$e(e,n)??We[r++%We.length];return o}const e=Array.isArray(n)?n:De[n]||We,o={};for(let n=0;t.length>n;n++)o[t[n]]=e[n%e.length];return o}return{}},[e,t,n]);return(0,Ea.jsx)($a.Provider,{value:r,children:o})}function qa(){return(0,Ha.useContext)($a)}Ya.displayName="CategoryColorProvider";var Ga=require("react");function Va(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 Xa(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}function Ua(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[Ka,Qa]=Z(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||!Ua(o,n))return!1}return!0}(r,n))return{};const i=new Map(e.selections),s=Xa(i,t),a=new Map(s.clauses);return a.set(n.clientId,n),i.set(t,{...s,clauses:a}),{selections:i}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o||!o.clauses.has(n))return{};const r=new Map(e.selections),i=new Map(o.clauses);return i.delete(n),r.set(t,{...o,clauses:i}),{selections:r}})},setResolution(t,n){e(e=>{const o=e.selections.get(t);if(o?.resolution===n)return{};const r=new Map(e.selections),i=Xa(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}})}})),Za=require("react");function Ja(e){const t=(0,Za.useId)(),n=e.clientId||t,{name:o}=e,r=Qa(e=>e.selections.get(o)),i=Qa(e=>e.setClause),s=Qa(e=>e.clearClause),a=(0,Za.useMemo)(()=>!!r&&r.clauses.size>0,[r]);return{predicate:(0,Za.useMemo)(()=>r&&0!==r.clauses.size?function(e,t){const n=[];for(const[o,r]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(Va(r));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(r,n):()=>!0,[r,n]),isActive:a,selectPoints:(0,Za.useCallback)(e=>{const t={};let r=!1;for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)},r=!0;r&&i(o,{clientId:n,type:"point",fields:t})},[n,o,i]),selectInterval:(0,Za.useCallback)(e=>{const t={};let r=!1;for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o},r=!0;r&&i(o,{clientId:n,type:"interval",fields:t})},[n,o,i]),clear:(0,Za.useCallback)(()=>{s(o,n)},[s,o,n]),clientId:n}}function el(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function tl(e){const{name:t,xField:n,yField:o}=e,{predicate:r,isActive:i,selectInterval:s,clear:a}=Ja({name:t,fields:[n,o].filter(Boolean)}),l=n&&o?"xyBrush":n?"xBrush":"yBrush",c=(0,Za.useCallback)(e=>{if(!e)return void a();const t={};"xyBrush"===l&&function(e){return 2===e.length&&Array.isArray(e[0])&&2===e[0].length&&Array.isArray(e[1])&&2===e[1].length}(e)?(n&&(t[n]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),o&&(t[o]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===l&&el(e)?n&&(t[n]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]):"yBrush"===l&&el(e)&&o&&(t[o]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]),nl(t)&&s(t)},[l,n,o,s,a]);return{brushInteraction:(0,Za.useMemo)(()=>({brush:l,during:c,end:c}),[l,c]),predicate:r,isActive:i,clear:a}}function nl(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}var ol=require("react/jsx-runtime"),rl=(0,Ga.createContext)(!1),il=(0,Ga.createContext)(!1),sl=(0,Ga.createContext)(null),al="undefined"==typeof window?Ga.useEffect:Ga.useLayoutEffect;function ll(e){const t=new Set,n=[];for(const o of e)t.has(o)||(t.add(o),n.push(o));return n}function cl(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}var ul="__linked-legend-isolate__",hl="__linked-legend-highlight__";function dl({categoryColors:e,interaction:t,selectionName:n,field:o}){const r=Object.entries(e),i=r.map(([e])=>e),s=[{styleFn:e=>({fill:e.color||"#333",stroke:e.color||"#333"}),type:"fill",items:r.map(([e,t])=>({label:e,color:t})),label:""}],{selectPoints:a,clear:l}=Ja({name:n,fields:[o],clientId:ul}),{selectPoints:c,clear:u}=Ja({name:n,fields:[o],clientId:hl}),h=Qa(e=>e.selections.get(n)),{isolatedCategories:d,highlightedCategory:f}=(0,Ga.useMemo)(()=>{const e=new Set;let t=null;const n=h?.clauses.get(ul)?.fields[o];if("point"===n?.type)for(const t of n.values)e.add(t+"");const r=h?.clauses.get(hl)?.fields[o];if("point"===r?.type){const e=r.values.values().next().value;null!=e&&(t=e+"")}return{isolatedCategories:e,highlightedCategory:t}},[h,o]),p=(0,Ga.useCallback)(e=>{"highlight"===t&&(e?c({[o]:[e.label]}):u())},[t,o,c,u]),y=(0,Ga.useCallback)(e=>{if("isolate"!==t)return;const n=new Set(d);n.has(e.label)?n.delete(e.label):n.add(e.label),0===n.size||n.size===i.length?l():a({[o]:Array.from(n)})},[t,o,d,i.length,a,l]),[m,[g]]=Ss([0,0],!0,!1),x=(0,Ga.useMemo)(()=>function(e,t){if(!t||0===e.length)return 1;let n=0,o=1;for(const r of e){const e=26+7*r.length;n>0&&n+e>t&&(o++,n=0),n+=e}return o}(r.map(([e])=>e),g),[r,g]);return 0===r.length?null:(0,ol.jsx)("div",{ref:m,style:{width:"100%",display:"block"},children:(0,ol.jsx)("svg",{width:"100%",height:Math.max(30,22*x+8),style:{display:"block",overflow:"visible"},children:(0,ol.jsx)(Fo,{legendGroups:s,title:!1,orientation:"horizontal",width:g,height:20,customHoverBehavior:"highlight"===t?p:void 0,customClickBehavior:"isolate"===t?y:void 0,highlightedCategory:f,isolatedCategories:d})})})}function fl({children:e,selections:t,showLegend:n,legendPosition:o="top",legendInteraction:r="none",legendSelectionName:i="legend",legendField:s="category"}){const a=(0,Ga.useMemo)(()=>{if(!t)return;const e=new Map;for(const[n,o]of Object.entries(t))o.resolution&&e.set(n,{name:n,resolution:o.resolution,clauses:new Map});return e.size>0?{selections:e}:void 0},[t]),l=qa(),[c,u]=(0,Ga.useState)({}),h=(0,Ga.useRef)({}),d=(0,Ga.useMemo)(()=>({registerCategories:(e,t)=>{const n=ll(t);u(t=>cl(t[e]??[],n)?t:{...t,[e]:n})},unregisterCategories:e=>{u(t=>{if(!(e in t))return t;const n={...t};return delete n[e],n})}}),[]),f=(0,Ga.useMemo)(()=>{const e=[];for(const t of Object.values(c))for(const n of t)e.push(n);return ll(e)},[c]),p=(0,Ga.useMemo)(()=>{const e=l??{},t=h.current;let n=Object.keys(e).length+Object.keys(t).length;for(const o of f)e[o]||t[o]||(t[o]=We[n%We.length],n++);const o={...e};for(const n of f)o[n]=e[n]??t[n];return o},[l,f]),y=void 0===n||n,m=Object.keys(p).length>0;return(0,ol.jsx)(Ka,{initialState:a,children:(0,ol.jsx)(mr,{children:(0,ol.jsx)(il.Provider,{value:!0,children:(0,ol.jsx)(sl.Provider,{value:d,children:(0,ol.jsx)(Ya,{colors:p,children:(0,ol.jsxs)(rl.Provider,{value:y&&m,children:[y&&"top"===o&&(0,ol.jsx)(dl,{categoryColors:p,interaction:r,selectionName:i,field:s}),e,y&&"bottom"===o&&(0,ol.jsx)(dl,{categoryColors:p,interaction:r,selectionName:i,field:s})]})})})})})})}function pl(e){return e?"string"==typeof e?{name:e}:e:null}var yl=.5;function ml(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??yl;i.opacity=e,i.fillOpacity=e,i.strokeOpacity=e,n?.unselectedStyle&&Object.assign(i,n.unselectedStyle)}return i}:e}var gl=y(require("react"));function xl(){return le(e=>e.theme)}function bl(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function vl(e,t){const{when:n}=e,o=t.width,r=t.height,i=function(e){if("number"==typeof e.height&&e.height>0)return e.width/e.height}(t),s=function(e){if("number"==typeof e.height&&e.height>0)return e.height>e.width?"portrait":"landscape"}(t);return!("number"==typeof n.minWidth&&n.minWidth>o||"number"==typeof n.maxWidth&&o>n.maxWidth||"number"==typeof n.minHeight&&("number"!=typeof r||n.minHeight>r)||"number"==typeof n.maxHeight&&("number"!=typeof r||r>n.maxHeight)||"number"==typeof n.minAspectRatio&&("number"!=typeof i||n.minAspectRatio>i)||"number"==typeof n.maxAspectRatio&&("number"!=typeof i||i>n.maxAspectRatio)||n.orientation&&s!==n.orientation)}function kl(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=>vl(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"])bl(e[o])&&bl(t[o])&&(n[o]={...e[o],...t[o]});return"string"==typeof e.className&&"string"==typeof t.className&&(n.className=`${e.className} ${t.className}`),n}(e,t.rule.transform),e),matches:o}}function wl(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 Al(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 Sl(e){if(!e)return!1;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}require("react/jsx-runtime"),gl.createContext(void 0);var Cl="#007bff",Ml=[],jl=44,_l={enabled:!0,tapToSelect:!0,tapToLockTooltip:!0,clearSelection:"backgroundTap",targetSize:jl,snap:"nearestDatum",brushHandleSize:jl,standardControls:!1,enabled:!1,tapToSelect:!1,tapToLockTooltip:!1};function Rl(e,t={}){const n=t.mobileSemantics?.interaction,o="number"==typeof n?.targetSize?n.targetSize:"number"==typeof t.mobileSemantics?.minimumHitTarget?t.mobileSemantics.minimumHitTarget:void 0,r="mobile"===t.mode||"number"==typeof t.width&&480>=t.width,i=!!n||void 0!==o,s=e&&"object"==typeof e?e:void 0;if(!1===e||!1===s?.enabled||void 0===e&&!r&&!i)return _l;const a=s??{};return{enabled:!0,tapToSelect:a.tapToSelect??!0,tapToLockTooltip:a.tapToLockTooltip??!0,clearSelection:a.clearSelection??"backgroundTap",targetSize:a.targetSize??o??jl,snap:a.snap??"nearestDatum",brushHandleSize:a.brushHandleSize??jl,standardControls:a.standardControls??!1}}function Pl(){const e=xl(),t=e?.colors?.categorical;return t&&t.length>0?t:void 0}function Ll(e,t,n){const o=qa(),r=Pl();return(0,za.useMemo)(()=>{if(!t)return;const i=o??void 0,s=n??(r&&r.length>0?r:void 0)??"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>t(e)+"")));if(i&&Sl(i)){const e=Ye(n.map(e=>({_cat:e})),"_cat",s);return t=>i[t]||e(t)}return Ye(n.map(e=>({_cat:e})),"_cat",s)}if(i&&Sl(i)){const n=Ye(e,t,s);return e=>i[e]||n(e)}return Ye(e,t,s)}if(i&&Sl(i)){const e=Ye([{_:"a"}],"_",s);return t=>i[t]||e(t)}},[e,t,n,o,r])}function Il({selection:e,linkedHover:t,fallbackFields:n=Ml,unwrapData:o=!1,onObservation:r,chartType:i,chartId:s,onClick:a,hoverHighlight:l,colorByField:c,mobileInteraction:u}){const h=(0,za.useId)(),d=(0,za.useMemo)(()=>function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField,seriesField:e.seriesField}:null}(t,n),[t,n]),f=(0,za.useMemo)(()=>"series"===d?.mode?[d.seriesField||c||n[0]].filter(e=>!!e):d?.fields||n,[d,c,n]),p=Ja({name:e?.name||"__unused__",fields:f}),y=function(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:r,selectPoints:i,clear:s}=Ja({name:t,fields:n});return{onHover:(0,Za.useCallback)(e=>{if(!e)return void s();const t={};for(const o of n){const n=e[o];void 0!==n&&(t[o]=[n])}nl(t)&&i(t)},[n,i,s]),predicate:o,isActive:r}}({name:d?.name||"hover",fields:f}),m=gr(e=>e.pushObservation),g=(0,za.useCallback)(e=>{r?.(e),m?.(e)},[r,m]),x=e?{isActive:p.isActive,predicate:p.predicate}:null,[b,v]=(0,za.useState)(null),k=(0,za.useRef)(!1),w=c||n[0],A=(0,za.useMemo)(()=>{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=(0,za.useCallback)((e,n)=>{const o=!e&&k.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=wl(e,t,d.xField);null!=n&&function(e,t,n){const o=Yr.positions.get(e);o?.locked||o&&o.xValue===t&&o.sourceId===n||(Yr={positions:new Map(Yr.positions).set(e,{xValue:t,sourceId:n})},Gr())}(d.name||"hover",n,h)}"x-position"!==d?.mode&&y.onHover(t)}else"x-position"!==d?.mode||o||Vr(d.name||"hover",h),"x-position"===d?.mode||o||y.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 o||v(null);(r||m)&&ja({onObservation:g,datum:e?Al(e):null,x:e?.x,y:e?.y,chartType:i||"unknown",chartId:s,context:n})},[t,y,d,h,r,i,s,m,g,l,w,u]),C=(0,za.useCallback)((n=!0)=>{k.current=!1,t&&"x-position"!==d?.mode&&y.onHover(null),e&&u?.tapToSelect&&p.clear(),n&&l&&v(null),"x-position"===d?.mode&&(Xr(d.name||"hover",h),Vr(d.name||"hover",h))},[t,d,y,e,u,p,l,h]),M=(0,za.useCallback)((n,o)=>{const c=!!u?.enabled&&(u.tapToLockTooltip||u.tapToSelect),x=!!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=wl(n,e,d.xField);null!=t&&function(e,t,n){const o=Yr.positions.get(e);if(o?.locked){const t=new Map(Yr.positions);return t.delete(e),Yr={positions:t},Gr(),!1}Yr={positions:new Map(Yr.positions).set(e,{xValue:t,sourceId:n,locked:!0})},Gr()}(d.name||"hover",t,h)}if(c)if(n){k.current=!0;const o=Al(n);if(t&&"x-position"!==d?.mode&&y.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])}Sl(e)&&p.selectPoints(e)}if(l&&w){const e=o?.[w];v(null!=e?e+"":null)}}else x&&C();if(n||x){if(n&&a){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]),a(e,{x:n.x??0,y:n.y??0})}(r||m)&&_a({onObservation:g,datum:n?Al(n):null,x:n?.x,y:n?.y,chartType:i||"unknown",chartId:s,context:o})}},[a,r,m,g,i,s,d,h,u,t,y,e,p,f,l,w,C]);return(0,za.useEffect)(()=>{if(!u?.enabled||"undefined"==typeof document)return;const e=e=>{"Escape"===e.key&&k.current&&C()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[u?.enabled,C]),(0,za.useEffect)(()=>()=>{k.current&&C(!1)},[C]),(0,za.useEffect)(()=>{if("x-position"!==d?.mode)return;const e=d.name||"hover";return()=>{Xr(e,h),Vr(e,h)}},[d?.mode,d?.name,h]),{activeSelectionHook:x,hoverSelectionHook:A,customHoverBehavior:S,customClickBehavior:M,crosshairSourceId:h}}function Tl(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===n?.mode)return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}function Nl({data:e,colorBy:t,colorScale:n,showLegend:o,legendPosition:r="right",userMargin:i,defaults:s={top:50,bottom:60,left:70,right:40},categories:a}){const l=(0,Ga.useContext)(rl),c=null!==(0,Ga.useContext)(sl),u=void 0!==o?o:!l&&!!t,h=!!t&&(u||c),d=(0,za.useMemo)(()=>{if(!h)return[];if(void 0!==a)return a;const n=new Set;for(const o of e){const e="function"==typeof t?t(o):o[t];null!=e&&n.add(e+"")}return Array.from(n)},[a,t,e,h]);!function(e){const t=(0,Ga.useContext)(sl),n=(0,Ga.useId)(),o=ll(e),r=(0,Ga.useRef)([]);cl(r.current,o)||(r.current=o);const i=r.current;al(()=>{if(t)return()=>t.unregisterCategories(n)},[t,n]),al(()=>{t&&t.registerCategories(n,i)},[t,n,i])}(c&&t?d:[]);const f=(0,za.useMemo)(()=>{if(!u||!t)return;const o=function({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:r,strokeWidth:i,categories:s}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==r&&(n.stroke=r),void 0!==i&&(n.strokeWidth=i),n},type:"fill",items:(s&&s.length>0?s:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((r,i)=>{const s=e.find("function"==typeof t?e=>t(e)===r:e=>e[t]===r),a=s?o(s,t,n):n?n(r):ze[i%ze.length];return{label:r+"",color:a}}),label:""}]}}({data:e,colorBy:t,colorScale:n,getColor:Ee,categories:d});return 0!==o.legendGroups.reduce((e,t)=>e+t.items.length,0)?o:void 0},[u,t,e,n,d]),p=(0,za.useMemo)(()=>{const e="number"==typeof i?{top:i,bottom:i,left:i,right:i}:i??{},t=t=>{const n=e[t];return"number"==typeof n?n:s[t]},n={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},o=t=>"number"==typeof e[t];return f&&("right"===r&&!o("right")&&110>n.right?n.right=110:"left"===r&&!o("left")&&110>n.left?n.left=110:"top"===r&&!o("top")&&50>n.top?n.top=50:"bottom"===r&&!o("bottom")&&80>n.bottom&&(n.bottom=80)),n},[s,i,f,r]);return{legend:f,margin:p,legendPosition:r}}function Fl(e,t,n){const[o,r]=(0,za.useState)(null),[i,s]=(0,za.useState)(new Set),a=(0,za.useMemo)(()=>new Set,[]),l=(0,za.useCallback)(t=>{"highlight"===e&&r(t?t.label:null)},[e]),c=(0,za.useCallback)(t=>{"isolate"===e&&s(e=>{const o=new Set(e);return o.has(t.label)?o.delete(t.label):o.add(t.label),o.size===n.length?new Set:o})},[e,n.length]),u=(0,za.useMemo)(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=o?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===o}:"isolate"===e&&i.size>0?{isActive:!0,predicate:e=>{const o=n?e[n]:"function"==typeof t?t(e):null;return i.has(o)}}:null},[e,t,o,i]);return{highlightedCategory:"highlight"===e?o:null,isolatedCategories:"isolate"===e?i:a,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}var Ol={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 Bl(e,t,n){const o=Ol[e||"primary"],r=e&&"primary"!==e||!n?.width?o.width:n.width,i=e&&"primary"!==e||!n?.height?o.height:n.height,s=kl({...t,mode:e},{width:t.width??r,height:t.height??i}).props,a=s.mode||e,l=Ol[a||"primary"],c="context"===a||"sparkline"===a,u=a&&"primary"!==a||!n?.width?l.width:n.width;return{width:s.width??u,height:s.height??(a&&"primary"!==a||!n?.height?l.height:n.height),showAxes:s.showAxes??l.showAxes,showGrid:s.showGrid??l.showGrid,enableHover:s.enableHover??(!!s.linkedHover||l.enableHover),showLegend:s.showLegend??l.showLegend,showLabels:s.showLabels??l.showLabels,title:c?void 0:s.title,description:s.description,summary:s.summary,accessibleTable:s.accessibleTable,xLabel:c?void 0:s.xLabel,yLabel:c?void 0:s.yLabel,categoryLabel:c?void 0:s.categoryLabel,valueLabel:c?void 0:s.valueLabel,marginDefaults:Dl(l.marginDefaults,s.showCategoryTicks,s.orientation),compactMode:c,mobileInteraction:Rl(s.mobileInteraction,{mode:a,width:s.width??u,mobileSemantics:s.mobileSemantics}),mobileSemantics:s.mobileSemantics}}function Dl(e,t,n){if(!1!==t)return e;const o={...e};return"horizontal"===n?o.left=Math.min(o.left,15):o.bottom=Math.min(o.bottom,15),o}var Wl=require("react/jsx-runtime");function zl({componentName:e,message:t,diagnosticHint:n,width:o,height:r}){return(0,Wl.jsx)("div",{role:"alert",style:{width:o,height:Math.max(r,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:(0,Wl.jsxs)("div",{style:{textAlign:"center",maxWidth:400},children:[(0,Wl.jsx)("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:e}),(0,Wl.jsx)("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:t}),n&&(0,Wl.jsx)("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:n})]})})}var Hl=y(require("react")),El=require("react/jsx-runtime"),$l=class extends Hl.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){this.props.onError?.(e,t)}render(){if(this.state.error){const{fallback:e}=this.props,t=this.state.error;return"function"==typeof e?e(t):void 0!==e?e:(0,El.jsx)(zl,{componentName:"ChartErrorBoundary",message:t.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}},Yl=require("react/jsx-runtime"),ql="undefined"!=typeof process&&"production"!==process.env?.NODE_ENV;function Gl({componentName:e,width:t,height:n,children:o}){return(0,Yl.jsx)($l,{fallback:o=>(0,Yl.jsx)(zl,{componentName:e,message:o.message,width:t,height:n}),children:o})}var Vl={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"},Xl={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Ul(e,t,n,o){return!1===o||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?(0,Yl.jsx)("div",{style:{...Vl,width:t,height:n},children:o||"No data available"}):null}function Kl(e,t,n,o){if(!e)return null;if(!1===o)return null;if(null!=o)return(0,Yl.jsx)("div",{style:{width:t,height:n,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:o});const r=Math.min(5,Math.floor(n/40)),i=Math.max(8,Math.floor(n/(3*r))),s=Math.max(6,Math.floor(n/(2.5*r))),a=Math.floor((n-(r*(i+s)-s))/2);return(0,Yl.jsx)("div",{style:{width:t,height:n,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:r},(e,n)=>(0,Yl.jsx)("div",{className:"semiotic-loading-bar",style:{...Xl,position:"absolute",top:a+n*(i+s),left:Math.floor(.1*t),width:30+(37*n+13)%50+"%",height:i,opacity:.5+n%2*.2}},n))})}function Ql(e,t,n,o){if(!ql)return;if(!t||0===t.length)return;if("string"!=typeof o)return;const r=t[0];if(!r||"object"!=typeof r)return;if(o in r)return;const i=Object.keys(r).join(", ");console.warn(`[semiotic] ${e}: ${n} "${o}" not found in data. Available keys: ${i}`)}function Zl(e,t){const n=e.length,o=t.length,r=Array(o+1);for(let e=0;o>=e;e++)r[e]=e;for(let i=1;n>=i;i++){let n=r[0];r[0]=i;for(let s=1;o>=s;s++){const o=r[s];r[s]=e[i-1]===t[s-1]?n:1+Math.min(n,r[s],r[s-1]),n=o}}return r[o]}function Jl(e,t){if(0===t.length)return null;const n=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(n)||n.includes(e.toLowerCase()))||(function(e,t,n=3){let o,r=n+1;for(const n of t){const t=Zl(e.toLowerCase(),n.toLowerCase());r>t&&(r=t,o=n)}return r>n?void 0:o}(e,t,3)??null)}function ec({componentName:e,data:t,accessors:n,requiredProps:o}){if(o)for(const[t,n]of Object.entries(o))if(null==n)return`${e}: ${t} is required. Provide a field name or function.`;if(null==t)return null;if(!Array.isArray(t)&&"object"==typeof t)return e+": data should be an array, but received an object. If this is hierarchical data, use TreeDiagram, Treemap, or CirclePack instead.";if(!Array.isArray(t)||0===t.length)return e+": No data provided. Pass a non-empty array to the data prop.";if(n){const o=function(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:[...e]}(t).find(e=>e&&"object"==typeof e);if(o){const t=Object.keys(o);for(const[r,i]of Object.entries(n))if(i&&"string"==typeof i&&!(i in o)){const n=Jl(i,t),o=n?` Try ${r}="${n}".`:"";return`${e}: ${r} "${i}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}var tc=require("react"),nc=require("react");function oc(e){const t=le(e=>e.theme.colors.selectionOpacity);return(0,nc.useMemo)(()=>{if(void 0!==e||void 0!==t)return{name:e?.name??"",...e,unselectedOpacity:e?.unselectedOpacity??t}},[e,t])}function rc(e){const{data:t,rawData:n,colorBy:o,colorScheme:r,legendInteraction:i,legendPosition:s,selection:a,linkedHover:l,fallbackFields:c,unwrapData:u=!1,onObservation:h,chartType:d,chartId:f,showLegend:p,userMargin:y,marginDefaults:m,onClick:g,hoverHighlight:x,mobileInteraction:b,mobileSemantics:v,loading:k,loadingContent:w,emptyContent:A,width:S,height:C}=e,M=void 0===n,j=(0,tc.useMemo)(()=>X(t),[t]),[_,R]=(0,tc.useState)([]),P=(0,tc.useCallback)(e=>{R(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[]),L="string"==typeof e.colorBy?e.colorBy:void 0,I=(0,tc.useMemo)(()=>Rl(b,{width:S,mobileSemantics:v}),[b,S,v]),{activeSelectionHook:T,hoverSelectionHook:N,customHoverBehavior:F,customClickBehavior:O,crosshairSourceId:B}=Il({selection:a,linkedHover:l,fallbackFields:c,unwrapData:u,onObservation:h,chartType:d,chartId:f,onClick:g,hoverHighlight:x,colorByField:L,mobileInteraction:I}),D=Tl(l,B),W=Ll(j,o,r),z=(0,tc.useMemo)(()=>{if(!o)return[];const e=new Set;for(const t of j){const n="function"==typeof o?o(t):t[o];null!=n&&e.add(n+"")}return Array.from(e)},[j,o]),H=(0,tc.useMemo)(()=>M&&_.length>0?_:z,[M,_,z]),E=Fl(i,o,H),$=(0,tc.useMemo)(()=>N||(E.legendSelectionHook?E.legendSelectionHook:T),[N,E.legendSelectionHook,T]),Y=oc(a),q=Pl(),G=qa(),V=(0,tc.useMemo)(()=>{if(W)return W;if(!o||0===H.length)return;const e=Array.isArray(r)&&r.length>0||"string"==typeof r&&r.length>0?r:q&&q.length>0?q:ze,t="__streamCat",n=Ye(H.map(e=>({[t]:e})),t,e);return e=>G?.[e]||n(e)||"#999"},[W,o,H,r,q,G]),{legend:U,margin:K,legendPosition:Q}=Nl({data:j,colorBy:o,colorScale:V,showLegend:p,legendPosition:s,userMargin:y,defaults:m,categories:H}),Z=(0,tc.useMemo)(()=>{const e={};return U&&(e.legend=U,e.legendPosition=Q),i&&"none"!==i&&(e.legendHoverBehavior=E.onLegendHover,e.legendClickBehavior=E.onLegendClick,e.legendHighlightedCategory=E.highlightedCategory,e.legendIsolatedCategories=E.isolatedCategories),M&&o&&(e.legendCategoryAccessor=o,e.onCategoriesChange=P),e},[U,Q,i,E.onLegendHover,E.onLegendClick,E.highlightedCategory,E.isolatedCategories,M,o,P]),J=Array.isArray(n)?X(n):n,ee=Kl(k,S,C,w),te=ee?null:Ul(J,S,C,A);return{data:j,colorScale:W,allCategories:H,legendState:E,effectiveSelectionHook:$,activeSelectionHook:T,customHoverBehavior:F,customClickBehavior:O,mobileInteraction:I,legend:U,margin:K,legendPosition:Q,earlyReturn:ee||te||null,legendBehaviorProps:Z,crosshairProps:D,resolvedSelection:Y}}var ic=require("react");function sc(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return e??((...e)=>({}));const n={};return void 0!==t.stroke&&(n.stroke=t.stroke),void 0!==t.strokeWidth&&(n.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(n.opacity=t.opacity),e?(...t)=>({...e(...t)||{},...n}):(...e)=>({...n})}function ac(e){if(null==e)return()=>{};const t="function"==typeof e?e:t=>t[e];return e=>cc(t(e))}function lc(e,t){const n=ac(e),o=ac(t);return(e,t)=>{const r=o(e);return{value:r,x:n(e),y:r,category:t}}}function cc(e){if("number"==typeof e)return Number.isFinite(e)?e:void 0;if("string"==typeof e&&""!==e.trim()){const t=Number(e);return Number.isFinite(t)?t:void 0}}function uc(e,t,n){const o=null!=e.axis?n[e.axis]:null!=e.field?t[e.field]:n.value;if(void 0!==e.eq&&o!==e.eq)return!1;if(void 0!==e.ne&&o===e.ne)return!1;if(void 0!==e.in&&!e.in.includes(o))return!1;if(void 0===e.gt&&void 0===e.gte&&void 0===e.lt&&void 0===e.lte&&void 0===e.within&&void 0===e.outside)return!0;const r=cc(o);if(void 0===r)return!1;if(void 0!==e.gt&&e.gt>=r)return!1;if(void 0!==e.gte&&e.gte>r)return!1;if(void 0!==e.lt&&r>=e.lt)return!1;if(void 0!==e.lte&&r>e.lte)return!1;if(void 0!==e.within){const[t,n]=e.within;if(t>r||r>n)return!1}if(void 0!==e.outside){const[t,n]=e.outside;if(r>=t&&n>=r)return!1}return!0}function hc(e,t,n){const o=e.when;return void 0===o||!0===o||!1!==o&&("function"==typeof o?o(t,n):uc(o,t,n))}function dc(e,t,n){if(!t||0===t.length)return{};let o={};for(const r of t){if(!hc(r,e,n))continue;const t="function"==typeof r.style?r.style(e,n):r.style;t&&(o={...o,...t})}return o}function fc(e,t,n,o=e=>e){const r=e??(()=>({}));return t&&0!==t.length?(e,i)=>{const s=o(e),a={...r(e,i)};return Object.assign(a,dc(s,t,n(s,i))),a}:r}function pc(e){const{lineWidth:t=2,colorBy:n,colorScale:o,color:r,resolveStroke:i,fillArea:s,areaOpacity:a=.3,stroke:l,strokeWidth:c,opacity:u,effectiveSelectionHook:h,resolvedSelection:d,styleRules:f,ruleContext:p}=e,y=(0,ic.useMemo)(()=>(e,l)=>{const c={strokeWidth:t},u=!0===s||Array.isArray(s)&&null!=l&&s.includes(l);let h;return i?h=i(e,l):n?o&&(h=Ee(e,n,o)):h=r||Cl,void 0!==h&&(c.stroke=h,u&&(c.fill=h,c.fillOpacity=a)),f&&f.length>0&&Object.assign(c,dc(e,f,p?p(e,l):{value:void 0,category:l})),c},[t,n,o,r,i,s,a,f,p]),m=(0,ic.useMemo)(()=>sc(y,{stroke:l,strokeWidth:c,opacity:u}),[y,l,c,u]);return(0,ic.useMemo)(()=>ml(m,h??null,d),[m,h,d])}var yc=require("react");function mc(e,t){const{variant:n,frameRef:o,overrides:r}=t;(0,yc.useImperativeHandle)(e,()=>{const e=function(e,t){if("xy"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>e.current?.remove(t)??[],update:(t,n)=>e.current?.update(t,n)??[],clear:()=>e.current?.clear(),getData:()=>e.current?.getData()??[],getScales:()=>e.current?.getScales()??null,getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}if("network"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>{const n=Array.isArray(t)?t:[t],o=e.current?.getTopology()?.nodes??[],r=[];for(const t of n){const n=o.find(e=>e.id===t);n&&r.push({...n.data??{},id:t}),e.current?.removeNode(t)}return r},update:(t,n)=>(Array.isArray(t)?t:[t]).flatMap(t=>{const o=e.current?.updateNode(t,n);return o?[{...o,id:t}]:[]}),clear:()=>e.current?.clear(),getData:()=>e.current?.getTopology()?.nodes?.map(e=>e.data)??[],getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}if("geo-points"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>e.current?.removePoint(t)??[],update:(t,n)=>{const o=e.current?.removePoint(t)??[];for(const t of o)e.current?.push(n(t));return o},clear:()=>e.current?.clear(),getData:()=>e.current?.getData()??[],getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}const n=t;return{push:e=>n.current?.pushLine(e),pushMany:e=>n.current?.pushManyLines(e),remove:e=>n.current?.removeLine(e)??[],update:(e,t)=>{const o=n.current?.removeLine(e)??[];for(const e of o)n.current?.pushLine(t(e));return o},clear:()=>n.current?.clear(),getData:()=>n.current?.getLines()??[],getCustomLayout:()=>n.current?.getCustomLayout?.()??null,getLayoutFailure:()=>n.current?.getLayoutFailure?.()??null}}(n,o);return{...e,...r}},[o,r,n])}function gc(e){const{title:t,description:n,summary:o,accessibleTable:r,className:i,animate:s,axisExtent:a,autoPlaceAnnotations:l}=e,c={};return t&&(c.title=t),n&&(c.description=n),o&&(c.summary=o),void 0!==r&&(c.accessibleTable=r),i&&(c.className=i),null!=s&&(c.animate=s),void 0!==a&&(c.axisExtent=a),void 0!==l&&(c.autoPlaceAnnotations=l),c}function xc(e){const{linkedHover:t,selection:n,onObservation:o,onClick:r,hoverRadius:i,hoverHighlight:s,forceHoverBehavior:a,forceClickBehavior:l,mobileInteraction:c,customHoverBehavior:u,customClickBehavior:h,linkedHoverInClickPredicate:d=!0}=e,f={};o&&(f.annotationObservationCallback=o);const p=c?.enabled?Math.max(i??30,Math.ceil((c.targetSize||44)/2),24):i;return(a||t||o||r||s)&&(f.customHoverBehavior=u),h&&(l||(d?o||r||t:o||r)||c?.enabled&&(c.tapToSelect||c.tapToLockTooltip)&&(t||s||n))&&(f.customClickBehavior=h),null!=p&&(f.hoverRadius=p),f}function bc(e){const{tooltip:t,defaultTooltipContent:n}=e;return{tooltipContent:!1===t?()=>null:gs(t)||n}}var vc="__forecastSegment",kc=null;async function wc(){return kc||(kc=await Promise.resolve().then(()=>(D(),L))),kc}var Ac=require("react"),Sc="__semiotic_resolvedX",Cc="__semiotic_resolvedY";function Mc(e){const{data:t,xAccessor:n,yAccessor:o,forecast:r,anomaly:i,groupBy:s}=e,a="string"==typeof n?n:Sc,l="string"==typeof o?o:Cc,c=(0,Ac.useMemo)(()=>{if(!r&&!i)return t;const e="function"==typeof n,s="function"==typeof o;return e||s?t.map(t=>{const r={...t};return e&&(r[Sc]=n(t)),s&&(r[Cc]=o(t)),r}):t},[t,r,i,n,o]),[u,h]=(0,Ac.useState)(null),[d,f]=(0,Ac.useState)([]),p=(0,Ac.useRef)(r),y=(0,Ac.useRef)(i);return(0,Ac.useEffect)(()=>{if(!r&&!i)return void((p.current||y.current)&&(h(null),f([]),p.current=r,y.current=i));let e=!1;const t=r!==p.current||i!==y.current;if(p.current=r,y.current=i,t&&(h(null),f([])),r){const t=s&&"string"==typeof s&&"object"==typeof r?{...r,_groupBy:s}:r;(async function(...e){return(await wc()).buildForecast(...e)})(c,a,l,t,i).then(t=>{e||(h(t),f(t.annotations))}).catch(()=>{e||(h(null),f([]))})}else i&&async function(...e){return(await wc()).buildAnomalyAnnotations(...e)}(i).then(t=>{e||(h(null),f(t))}).catch(()=>{e||f([])});return()=>{e=!0}},[c,r,i,a,l,s]),{effectiveData:u?u.processedData:t,statisticalAnnotations:d,hasForecast:!!u,xAccessorKey:a,yAccessorKey:l}}var jc=require("react/jsx-runtime"),_c="__lineObjectSeries",Rc=(0,Wa.forwardRef)(function(e,t){const n=(0,Wa.useRef)(null);mc(t,{variant:"xy",frameRef:n});const o=Bl(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,axisExtent:c,xAccessor:u="x",yAccessor:h="y",lineBy:d,lineDataAccessor:f="coordinates",colorBy:p,colorScheme:y,styleRules:m,curve:g="linear",showPoints:x=!1,pointRadius:b=3,fillArea:v=!1,areaOpacity:k=.3,lineWidth:w=2,lineGradient:A,tooltip:S,pointIdAccessor:C,annotations:M,directLabel:j,gapStrategy:_="break",anomaly:R,forecast:P,band:L,xExtent:I,yExtent:T,frameProps:N={},selection:F,linkedHover:O,onObservation:B,onClick:D,hoverHighlight:W,hoverRadius:z,chartId:H,loading:E,loadingContent:$,emptyContent:Y,legendInteraction:q,legendPosition:G,xScaleType:V,yScaleType:U,color:K,stroke:Q,strokeWidth:Z,opacity:J}=e,{width:ee,height:te,enableHover:ne,showGrid:oe,showLegend:re,title:ie,description:se,summary:ae,accessibleTable:le,xLabel:ce,yLabel:ue}=o,he=(0,Wa.useMemo)(()=>X(r),[r]),de=Array.isArray(he[0]?.[f])?he[0][f]:he;Ql("LineChart",de,"xAccessor",u),Ql("LineChart",de,"yAccessor",h);const{effectiveData:fe,statisticalAnnotations:pe}=Mc({data:he,xAccessor:u,yAccessor:h,forecast:P,anomaly:R,groupBy:d}),ye="__compoundGroup",me=!(!P||!d),ge=me?ye:P?vc:d,xe=(0,Wa.useMemo)(()=>{if(!me)return fe;const e="function"==typeof d?d:e=>e[d];return fe.map(t=>{const n={...t};return n[ye]=`${e(t)}__${t[vc]||"observed"}`,n})},[fe,me,d]),be=me?xe:fe,ve=p||d,ke=(0,Wa.useMemo)(()=>{if(!P)return;const e=P.upperBounds,t=P.lowerBounds;if(!e&&!t)return;const n="function"==typeof e?e:"string"==typeof e?t=>t[e]:null,o="function"==typeof t?t:"string"==typeof t?e=>e[t]:null;let r=1/0,i=-1/0;const s=fe;for(const e of s){const t="function"==typeof h?h(e):+e[h];if(isFinite(t)&&(r>t&&(r=t),t>i&&(i=t)),n){const t=n(e);null!=t&&isFinite(t)&&(t>i&&(i=t),r>t&&(r=t))}if(o){const t=o(e);null!=t&&isFinite(t)&&(r>t&&(r=t),t>i&&(i=t))}}return isFinite(r)&&isFinite(i)?[r,i]:void 0},[P,fe,h]),we=(0,Wa.useCallback)(e=>{const t="function"==typeof u?u(e):e[u],n="function"==typeof h?h(e):e[h];return null==t||null==n||Number.isNaN(t)||Number.isNaN(n)},[u,h]),Ae=void 0!==be[0]?.[f],Se=Ae?_c:ge,Ce=(0,Wa.useMemo)(()=>{if(Ae)return be.map((e,t)=>{const n="function"==typeof d?d(e):"string"==typeof d?e[d]:void 0,o=null==n?"line-"+t:n+"",r=Array.isArray(e[f])?e[f]:[];return{...e,[_c]:o,[f]:r.map(t=>({...t,[_c]:o,parentLine:e,..."string"==typeof d&&void 0!==e[d]?{[d]:e[d]}:{}}))}});if(ge){const e=be.reduce((e,t)=>{const n="function"==typeof ge?ge(t):t[ge];if(!e[n]){const o={[f]:[]};"string"==typeof ge&&(o[ge]=n),me&&(o[vc]=t[vc],"string"==typeof d&&(o[d]=t[d])),e[n]=o}return e[n][f].push(t),e},{});return Object.values(e)}return[{[f]:be}]},[Ae,ge,f,be,d,me]),{gapProcessedLineData:Me,hasGaps:je}=(0,Wa.useMemo)(()=>{if("interpolate"===_){let e=!1;const t=[];for(const n of Ce){const o=(n[f]||[]).filter(t=>!we(t)||(e=!0,!1));o.length>0&&t.push({...n,[f]:o})}return{gapProcessedLineData:t,hasGaps:e}}if("break"===_){let e=!1;const t=[];for(const n of Ce){const o=n[f]||[];let r=[],i=0;const s=Se&&"string"==typeof Se?n[Se]:void 0;for(const a of o)if(we(a))e=!0,r.length>0&&(t.push({...n,[f]:r}),r=[],i++);else{const e=null!=s?`${s}__seg${i}`:"__seg"+i;r.push({...a,_gapSegment:e})}r.length>0&&t.push({...n,[f]:r})}return{gapProcessedLineData:t,hasGaps:e}}if("zero"===_){let e=!1;const t="string"==typeof h?h:"y",n=[];for(const o of Ce){const r=o[f]||[],i=[];for(const n of r)we(n)?(e=!0,i.push({...n,[t]:0})):i.push(n);n.push({...o,[f]:i})}return{gapProcessedLineData:n,hasGaps:e}}return{gapProcessedLineData:Ce,hasGaps:!1}},[Ce,_,f,we,Se,h]),_e="object"==typeof j?j:{},Re=_e.position||"end",Pe=_e.fontSize||11,Le=(0,Wa.useMemo)(()=>{if(!j||!ve)return[];const e="function"==typeof ve?ve:e=>e[ve],t=new Set;for(const n of Me){const o=n[f]||[];if(0===o.length)continue;const r=e("end"===Re?o[o.length-1]:o[0])??e(n);if(null==r)continue;const i=r+"";""!==i&&t.add(i)}return Array.from(t)},[j,ve,Me,f,Re]),Ie=(0,Wa.useMemo)(()=>{if(!j)return o.marginDefaults;const e=Le.reduce((e,t)=>Math.max(e,t.length*(.6*Pe)),0)+10,t="end"===Re?"right":"left";return{...o.marginDefaults,[t]:Math.max(o.marginDefaults[t]||0,e)}},[j,Le,Pe,Re,o.marginDefaults]),Te=rc({data:fe,rawData:r,colorBy:ve,colorScheme:y,legendInteraction:q,legendPosition:G,selection:F,linkedHover:O,fallbackFields:ve?["string"==typeof ve?ve:""]:[],unwrapData:!1,onObservation:B,onClick:D,hoverHighlight:W,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"LineChart",chartId:H,showLegend:(!j||void 0!==re)&&re,userMargin:i,marginDefaults:Ie,loading:E,loadingContent:$,emptyContent:Y,width:ee,height:te}),Ne=Te.colorScale,Fe=Te.effectiveSelectionHook,Oe=Te.resolvedSelection,Be=Te.customHoverBehavior,De=Te.customClickBehavior,We=Te.crosshairProps,ze=(0,Wa.useMemo)(()=>{if(ve)return Ae?e=>{const t=e.parentLine||e;return"function"==typeof ve?ve(t):t[ve]}:ve},[ve,Ae]),He=(0,Wa.useMemo)(()=>lc(u,h),[u,h]),$e=pc({lineWidth:w,colorBy:ze,colorScale:Ne,color:K,fillArea:v,areaOpacity:k,stroke:Q,strokeWidth:Z,opacity:J,effectiveSelectionHook:Fe,resolvedSelection:Oe,styleRules:m,ruleContext:He}),[Ye,qe]=(0,Wa.useState)(null);(0,Wa.useEffect)(()=>{if(!P)return void qe(null);let e=!1;return async function(...e){return(await wc()).createSegmentLineStyle(...e)}($e,P).then(t=>{e||qe(()=>t)}).catch(()=>{e||qe(null)}),()=>{e=!0}},[$e,P]);const Ge=Ye||$e,Ve=(0,Wa.useMemo)(()=>{if(x)return e=>{const t={r:b,fillOpacity:1};return ve?Ne&&(t.fill=Ee(e.parentLine||e,ve,Ne)):t.fill=K||Cl,t}},[x,b,ve,Ne,K]),Xe=Array.isArray(v)?"mixed":v?"area":"line",Ue=(0,Wa.useMemo)(()=>{if(!j||!ve)return[];const e="function"==typeof u?u:e=>e[u],t="function"==typeof h?h:e=>e[h],n="function"==typeof ve?ve:e=>e[ve],o=new Map;for(const e of Me){const t=e[f]||[];if(0===t.length)continue;const r="end"===Re?t[t.length-1]:t[0],i=n(r)??n(e);if(null==i)continue;const s=i+"";""===s||o.has(s)||o.set(s,r)}const r=Array.from(o.entries()).map(([n,o])=>({type:"text",label:n,["string"==typeof u?u:"x"]:e(o),["string"==typeof h?h:"y"]:t(o),dx:"end"===Re?6:-6,dy:0,color:Ne?Ne(n):Cl,fontSize:Pe}));r.sort((e,t)=>{const n="string"==typeof h?h:"y";return e[n]-t[n]});for(let e=1;r.length>e;e++){const t="string"==typeof h?h:"y",n=r[e-1],o=r[e];Pe+2>Math.abs(o[t]+o.dy-(n[t]+n.dy))&&(o.dy+=Pe+2)}return r},[j,ve,Ne,Me,f,u,h,Re,Pe]),Ke=Te.margin,Qe=d||p,Ze=(0,Wa.useMemo)(()=>Aa([{label:ce||xa(u),accessor:u,role:"x",format:a},{label:ue||xa(h),accessor:h,role:"y",format:l},...Qe?[{label:xa(Qe),accessor:Qe,role:"group"}]:[],...wa(L,l)]),[u,h,ce,ue,Qe,a,l,L]),Je=ec({componentName:"LineChart",data:Ae?fe[0]?.[f]||[]:r,accessors:{xAccessor:u,yAccessor:h}}),et=(0,Wa.useMemo)(()=>Ae||Se||je?Me.flatMap(e=>{const t=e[f]||[];return Se&&"string"==typeof Se?t.map(t=>({...t,[Se]:t[Se]??e[Se]})):t}):be,[Me,f,Ae,Se,be,je]),tt={chartType:Xe,...Array.isArray(v)&&{areaGroups:v},...A&&{lineGradient:A},...null!=r&&{data:et},xAccessor:u,yAccessor:h,xScaleType:V,yScaleType:U,...I&&{xExtent:I},...!T||null==T[0]&&null==T[1]?ke?{yExtent:ke}:{}:{yExtent:T},groupAccessor:"break"===_&&je?"_gapSegment":Se||void 0,...L&&{band:L},curve:g,lineStyle:Ge,...x&&{pointStyle:Ve},size:[ee,te],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Ke,showAxes:o.showAxes,xLabel:ce,yLabel:ue,xFormat:a,yFormat:l,...void 0!==c&&{axisExtent:c},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},enableHover:ne,showGrid:oe,...Te.legendBehaviorProps,...ie&&{title:ie},...se&&{description:se},...ae&&{summary:ae},...void 0!==le&&{accessibleTable:le},...s&&{className:s},...null!=e.animate&&{animate:e.animate},tooltipContent:!1===S?()=>null:"multi"===S?ms():gs(S)||Ze,..."multi"===S&&{tooltipMode:"multi"},...xc({linkedHover:O,selection:F,onObservation:B,onClick:D,hoverRadius:z,hoverHighlight:W,mobileInteraction:Te.mobileInteraction,customHoverBehavior:Be,customClickBehavior:De}),...C&&{pointIdAccessor:C},...(M?.length||pe.length||Ue.length)&&{annotations:[...M||[],...pe,...Ue]},...We,...N};return Te.earlyReturn?Te.earlyReturn:Je?(0,jc.jsx)(zl,{componentName:"LineChart",message:Je,width:ee,height:te}):(0,jc.jsx)(Gl,{componentName:"LineChart",width:ee,height:te,children:(0,jc.jsx)(Da,{ref:n,...tt})})});Rc.displayName="LineChart";var Pc=require("react"),Lc=require("react");function Ic(e){const{safeData:t,data:n,areaBy:o,lineDataAccessor:r,colorBy:i,colorScale:s,color:a,stroke:l,strokeWidth:c,opacity:u,effectiveSelectionHook:h,resolvedSelection:d,areaOpacity:f,showLine:p,lineWidth:y,showPoints:m,pointRadius:g,xAccessor:x,yAccessor:b,xLabel:v,yLabel:k,xFormat:w,yFormat:A,groupField:S,styleRules:C,ruleContext:M}=e,j=void 0!==t[0]?.[r],_=(0,Lc.useMemo)(()=>{if(null==n)return[];if(!j&&!o)return t;let e;if(j)e=t;else{const n=o,i=t.reduce((e,t)=>{const o="function"==typeof n?n(t):t[n];if(!e[o]){const t={[r]:[]};"string"==typeof n&&(t[n]=o),e[o]=t}return e[o][r].push(t),e},{});e=Object.values(i)}return e.flatMap(e=>{const t=e[r]||[];return o&&"string"==typeof o?t.map(t=>({...t,[o]:e[o]})):t})},[n,t,o,r,j]),R=(0,Lc.useMemo)(()=>e=>{const t={};if(i){if(s){const n=Ee(e,i,s);t.fill=n,p?(t.stroke=n,t.strokeWidth=y):t.stroke="none"}}else{const e=a||Cl;t.fill=e,p?(t.stroke=e,t.strokeWidth=y):t.stroke="none"}return t.fillOpacity=f,C&&C.length>0&&Object.assign(t,dc(e,C,M?M(e):{value:void 0})),t},[i,s,a,f,p,y,C,M]),P=(0,Lc.useMemo)(()=>sc(R,{stroke:l,strokeWidth:c,opacity:u}),[R,l,c,u]);return{flattenedData:_,lineStyle:(0,Lc.useMemo)(()=>ml(P,h??null,d),[P,h,d]),pointStyle:(0,Lc.useMemo)(()=>{if(m)return e=>{const t={r:g,fillOpacity:1};return i?s&&(t.fill=Ee(e.parentLine||e,i,s)):t.fill=a||Cl,t}},[m,g,i,s,a]),defaultTooltipContent:(0,Lc.useMemo)(()=>Aa([{label:v||xa(x),accessor:x,role:"x",format:w},{label:k||xa(b),accessor:b,role:"y",format:A},...S?[{label:xa(S),accessor:S,role:"group"}]:[],...wa(e.band,A)]),[x,b,v,k,S,w,A,e.band])}}var Tc=require("react/jsx-runtime");function Nc(e,t){if(null==t)return e;const n=e.trim(),o=n.match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i);if(o){const e=o[1],n=3===e.length?e.split("").map(e=>e+e).join(""):e;return`rgba(${parseInt(n.slice(0,2),16)}, ${parseInt(n.slice(2,4),16)}, ${parseInt(n.slice(4,6),16)}, ${t})`}if(n.startsWith("rgba(")){const e=n.lastIndexOf(","),o=n.lastIndexOf(")");if(-1!==e&&o>e)return`${n.slice(0,e+1)} ${t})`}return n.startsWith("rgb(")?n.replace(/^rgb\(/,"rgba(").replace(/\)$/,`, ${t})`):e}var Fc=(0,Pc.forwardRef)(function(e,t){const n=(0,Pc.useRef)(null);mc(t,{variant:"xy",frameRef:n});const o=Bl(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}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:u="y",areaBy:h,y0Accessor:d,gradientFill:f=!1,semanticGradient:p,lineDataAccessor:y="coordinates",colorBy:m,colorScheme:g,styleRules:x,curve:b="monotoneX",areaOpacity:v=.7,lineGradient:k,showLine:w=!0,lineWidth:A=2,showPoints:S=!1,pointRadius:C=3,tooltip:M,annotations:j,forecast:_,anomaly:R,band:P,xExtent:L,yExtent:I,frameProps:T={},selection:N,linkedHover:F,onObservation:O,onClick:B,hoverHighlight:D,chartId:W,loading:z,loadingContent:H,emptyContent:E,legendInteraction:$,legendPosition:Y,color:q,stroke:G,strokeWidth:V,opacity:U}=e,{width:K,height:Q,enableHover:Z,showGrid:J,showLegend:ee,title:te,description:ne,summary:oe,accessibleTable:re,xLabel:ie,yLabel:se}=o,ae=(0,Pc.useMemo)(()=>X(r),[r]),le=m||h,ce=(0,Pc.useMemo)(()=>{return p&&p.length>0?{colorStops:(e=p,e.filter(e=>Number.isFinite(e.at)).map(e=>({offset:1-Math.max(0,Math.min(100,e.at))/100,color:Nc(e.color,e.opacity)})).sort((e,t)=>e.offset-t.offset))}:f;var e},[p,f]);Ql("AreaChart",ae,"xAccessor",c),Ql("AreaChart",ae,"yAccessor",u);const ue=rc({data:ae,rawData:r,colorBy:le,colorScheme:g,legendInteraction:$,legendPosition:Y,selection:N,linkedHover:F,fallbackFields:le?["string"==typeof le?le:""]:[],unwrapData:!1,onObservation:O,onClick:B,hoverHighlight:D,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"AreaChart",chartId:W,showLegend:ee,userMargin:i,marginDefaults:o.marginDefaults,loading:z,loadingContent:H,emptyContent:E,width:K,height:Q}),{effectiveData:he,statisticalAnnotations:de}=Mc({data:ae,xAccessor:c,yAccessor:u,forecast:_,anomaly:R,groupBy:h}),fe=(0,Pc.useMemo)(()=>lc(c,u),[c,u]),{flattenedData:pe,lineStyle:ye,pointStyle:me,defaultTooltipContent:ge}=Ic({safeData:he,data:r,areaBy:h,lineDataAccessor:y,colorBy:le,colorScale:ue.colorScale,color:q,stroke:G,strokeWidth:V,opacity:U,effectiveSelectionHook:ue.effectiveSelectionHook,resolvedSelection:ue.resolvedSelection,areaOpacity:v,showLine:w,lineWidth:A,showPoints:S,pointRadius:C,xAccessor:c,yAccessor:u,xLabel:ie,yLabel:se,xFormat:a,yFormat:l,groupField:h||m,band:P,styleRules:x,ruleContext:fe}),xe=ec({componentName:"AreaChart",data:r,accessors:{xAccessor:c,yAccessor:u}}),be={chartType:"area",...null!=r&&{data:pe},xAccessor:c,yAccessor:u,groupAccessor:h||void 0,...d&&{y0Accessor:d},...P&&{band:P},...ce&&{gradientFill:ce},...k&&{lineGradient:k},curve:b,lineStyle:ye,...S&&me&&{pointStyle:me},size:[K,Q],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ue.margin,showAxes:o.showAxes,xLabel:ie,yLabel:se,xFormat:a,yFormat:l,enableHover:Z,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:J,...ue.legendBehaviorProps,...gc({title:te,description:ne,summary:oe,accessibleTable:re,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),..."multi"===M?{tooltipContent:ms(),tooltipMode:"multi"}:bc({tooltip:M,defaultTooltipContent:ge}),...xc({linkedHover:F,selection:N,onObservation:O,onClick:B,hoverHighlight:D,mobileInteraction:ue.mobileInteraction,customHoverBehavior:ue.customHoverBehavior,customClickBehavior:ue.customClickBehavior}),...(j&&j.length>0||de.length>0)&&{annotations:[...j||[],...de]},...L&&{xExtent:L},...I&&{yExtent:I},...ue.crosshairProps,...T};return ue.earlyReturn?ue.earlyReturn:xe?(0,Tc.jsx)(zl,{componentName:"AreaChart",message:xe,width:K,height:Q}):(0,Tc.jsx)(Gl,{componentName:"AreaChart",width:K,height:Q,children:(0,Tc.jsx)(Da,{ref:n,...be})})});Fc.displayName="AreaChart";var Oc=require("react"),Bc=require("react/jsx-runtime");function Dc(e){if(null==e)return NaN;if("number"==typeof e)return e;if(e instanceof Date)return e.getTime();if("string"==typeof e){if(""===e.trim())return NaN;const t=+e;return Number.isFinite(t)?t:NaN}return NaN}var Wc=(0,Oc.forwardRef)(function(e,t){const n=(0,Oc.useRef)(null),o=Bl(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}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",seriesAAccessor:u="a",seriesBAccessor:h="b",seriesALabel:d="A",seriesBLabel:f="B",seriesAColor:p="var(--semiotic-danger, #dc2626)",seriesBColor:y="var(--semiotic-info, #2563eb)",showLines:m=!0,lineWidth:g=1.5,showPoints:x=!1,pointRadius:b=3,curve:v="linear",areaOpacity:k=.6,gradientFill:w,tooltip:A,annotations:S,xExtent:C,yExtent:M,frameProps:j={},selection:_,linkedHover:R,onObservation:P,onClick:L,hoverHighlight:I,chartId:T,loading:N,loadingContent:F,emptyContent:O,legendInteraction:B,legendPosition:D,pointIdAccessor:W,windowSize:z}=e,{width:H,height:E,enableHover:$,showGrid:Y,showLegend:q,title:G,description:V,summary:U,accessibleTable:K,xLabel:Q,yLabel:Z}=o,J=(0,Oc.useMemo)(()=>"function"==typeof c?e=>Dc(c(e)):e=>Dc(e[c]),[c]),ee=(0,Oc.useMemo)(()=>"function"==typeof u?e=>Dc(u(e)):e=>Dc(e[u]),[u]),te=(0,Oc.useMemo)(()=>"function"==typeof h?e=>Dc(h(e)):e=>Dc(e[h]),[h]),[ne,oe]=(0,Oc.useState)([]),re=(0,Oc.useRef)([]),ie=null==r,se=(0,Oc.useMemo)(()=>X(ie?ne:r),[ie,ne,r]),ae=(0,Oc.useMemo)(()=>function(e,t,n,o){if(!e.length)return[];const r=e.filter(e=>Number.isFinite(t(e))).sort((e,n)=>t(e)-t(n)),i=[];let s=0,a=null,l=null,c=[];const u=(e,t)=>e>t?"A":t>e?"B":null,h=e=>`seg-${s}-${e}`,d=e=>i.push(e),f=(e,t)=>{d({__x:e.x,__y:e.y,__y0:e.y,__diffSegment:h(t),__diffWinner:t,__valA:e.y,__valB:e.y,__sourceDatum:e.datum})};for(let e=0;r.length>e;e++){const i=r[e],p=t(i),y=n(i),m=o(i);if(!Number.isFinite(p)||!Number.isFinite(y)||!Number.isFinite(m))continue;const g=u(y,m);if(null!==g)if(null!=a){if(l&&l.w!==g){let e,t;if(c.length>0)e=c[0].x,t=c[0].y;else{const n=y-l.a-(m-l.b);if(0!==n){const o=Math.max(0,Math.min(1,(l.b-l.a)/n));e=l.x+o*(p-l.x),t=l.a+o*(y-l.a)}else e=l.x,t=l.a}d({__x:e,__y:t,__y0:t,__diffSegment:h(a),__diffWinner:a,__valA:t,__valB:t}),s++,a=g,d({__x:e,__y:t,__y0:t,__diffSegment:h(a),__diffWinner:a,__valA:t,__valB:t});for(let e=1;c.length>e;e++)f(c[e],a)}else for(const e of c)f(e,a);c=[],d({__x:p,__y:m>y?m:y,__y0:m>y?y:m,__diffSegment:h(a),__diffWinner:a,__valA:y,__valB:m,__sourceDatum:i}),l={x:p,a:y,b:m,w:g}}else{a=g;for(const e of c)f(e,a);c=[],d({__x:p,__y:m>y?m:y,__y0:m>y?y:m,__diffSegment:h(a),__diffWinner:a,__valA:y,__valB:m,__sourceDatum:i}),l={x:p,a:y,b:m,w:g}}else c.push({x:p,y:y,datum:i})}for(const e of c)f(e,a??"A");return i}(se,J,ee,te),[se,J,ee,te]),le=(0,Oc.useMemo)(()=>m?function(e,t,n,o){if(!e.length)return[];const r=e.filter(e=>Number.isFinite(t(e))).sort((e,n)=>t(e)-t(n)),i=[];for(const e of r){const r=t(e),s=n(e),a=o(e);Number.isFinite(s)&&i.push({__x:r,__y:s,__diffSegment:"line-A"}),Number.isFinite(a)&&i.push({__x:r,__y:a,__diffSegment:"line-B"})}return i}(se,J,ee,te):[],[m,se,J,ee,te]),ce=(0,Oc.useMemo)(()=>[...ae,...le],[ae,le]),ue=(0,Oc.useMemo)(()=>{const e=new Set;for(const t of ae)e.add(t.__diffSegment);return Array.from(e)},[ae]);(0,Oc.useImperativeHandle)(t,()=>{const e=e=>{const t=z&&e.length>z?e.slice(e.length-z):e;re.current=t,oe(t)},t=W?"function"==typeof W?W:e=>e[W]:null;return{push:t=>e([...re.current,t]),pushMany:t=>e([...re.current,...t]),remove:n=>{if(!t)return[];const o=Array.isArray(n)?n:[n],r=[],i=[];for(const e of re.current)o.includes(t(e))?r.push(e):i.push(e);return e(i),r},update:(n,o)=>{if(!t)return[];const r=Array.isArray(n)?n:[n],i=[],s=re.current.map(e=>{if(r.includes(t(e))){const t=o(e);return i.push(t),t}return e});return e(s),i},clear:()=>e([]),getData:()=>ie?re.current:se,getScales:()=>n.current?.getScales()??null}},[ie,se,W,z]);const he=rc({data:se,rawData:r,colorBy:"__diffWinner",colorScheme:[p,y],legendInteraction:B,legendPosition:D,selection:_,linkedHover:R,fallbackFields:["__diffWinner"],unwrapData:!1,onObservation:P,onClick:L,hoverHighlight:I,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"DifferenceChart",chartId:T,showLegend:q,userMargin:i,marginDefaults:o.marginDefaults,loading:N,loadingContent:F,emptyContent:O,width:H,height:E}),de=(0,Oc.useMemo)(()=>{if(!1!==q)return{legendGroups:[{label:"",type:"fill",styleFn:e=>({fill:e.color||"currentColor"}),items:[{label:d,color:p},{label:f,color:y}]}]}},[q,d,f,p,y]),fe=(0,Oc.useCallback)(e=>{const t=e.__diffSegment;return{fill:"A"==(t?.endsWith("-A")?"A":"B")?p:y,stroke:"none",fillOpacity:k}},[p,y,k]),pe=(0,Oc.useCallback)(e=>({stroke:"A"==("line-A"===e.__diffSegment?"A":"B")?p:y,strokeWidth:g,fill:"none"}),[p,y,g]),ye=(0,Oc.useCallback)(e=>({fill:"A"==("line-A"===e.__diffSegment?"A":"B")?p:y,r:b}),[p,y,b]),me=(0,Oc.useCallback)(e=>{const t=e.data,n=e.allSeries,o=e.xValue??t?.__x;let r=t?.__valA,i=t?.__valB;if(n&&n.length>0){const e=n.find(e=>"line-A"===e.group),t=n.find(e=>"line-B"===e.group);null!=e?.value&&Number.isFinite(e.value)&&(r=e.value),null!=t?.value&&Number.isFinite(t.value)&&(i=t.value)}if(null!=o&&(null==r||null==i)){const e=se.find(e=>J(e)===o);e&&(null==r&&(r=ee(e)),null==i&&(i=te(e)))}const s=e=>null!=e&&Number.isFinite(e)?""+Math.round(100*e)/100:"—",l=a&&null!=o?a(o):null!=o?o+"":"";return(0,Bc.jsxs)("div",{className:"semiotic-tooltip",style:ds,children:[l&&(0,Bc.jsx)("div",{style:{fontWeight:600,marginBottom:4},children:l}),(0,Bc.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6},children:[(0,Bc.jsx)("span",{style:{width:10,height:10,background:p,display:"inline-block",borderRadius:2}}),(0,Bc.jsxs)("span",{children:[d,": ",s(r)]})]}),(0,Bc.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6},children:[(0,Bc.jsx)("span",{style:{width:10,height:10,background:y,display:"inline-block",borderRadius:2}}),(0,Bc.jsxs)("span",{children:[f,": ",s(i)]})]}),null!=r&&null!=i&&Number.isFinite(r)&&Number.isFinite(i)&&(0,Bc.jsxs)("div",{style:{marginTop:4,opacity:.7},children:["Δ = ",s(r-i)]})]})},[se,J,ee,te,a,p,y,d,f]),ge="multi"===A,xe=(0,Oc.useMemo)(()=>!1===A?()=>null:ge?me:gs(A)||me,[A,ge,me]);if(he.earlyReturn)return he.earlyReturn;const be={chartType:"mixed",data:ce,xAccessor:"__x",yAccessor:"__y",y0Accessor:"__y0",groupAccessor:"__diffSegment",areaGroups:ue,curve:v,areaStyle:fe,lineStyle:pe,...x&&{pointStyle:ye},size:[H,E],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:he.margin,showAxes:o.showAxes,xLabel:Q,yLabel:Z,xFormat:a,yFormat:l,enableHover:$,showGrid:Y,...w&&{gradientFill:!0===w?{topOpacity:.85,bottomOpacity:.15}:w},...de&&{legend:de,legendPosition:he.legendPosition},...gc({title:G,description:V,summary:U,accessibleTable:K,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),tooltipContent:xe,...ge&&{tooltipMode:"multi"},...xc({linkedHover:R,selection:_,onObservation:P,onClick:L,hoverHighlight:I,mobileInteraction:he.mobileInteraction,customHoverBehavior:he.customHoverBehavior,customClickBehavior:he.customClickBehavior}),...S&&S.length>0&&{annotations:S},...C&&{xExtent:C},...M&&{yExtent:M},...he.crosshairProps,...j};return(0,Bc.jsx)(Gl,{componentName:"DifferenceChart",width:H,height:E,children:(0,Bc.jsx)(Da,{ref:n,...be})})});"function"==typeof Wc&&(Wc.displayName="DifferenceChart");var zc=require("react"),Hc=require("react/jsx-runtime"),Ec=(0,zc.forwardRef)(function(e,t){const n=(0,zc.useRef)(null),o=Bl(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}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:u="y",areaBy:h,lineDataAccessor:d="coordinates",colorBy:f,colorScheme:p,styleRules:y,curve:m="monotoneX",areaOpacity:g=.7,showLine:x=!0,lineWidth:b=2,showPoints:v=!1,pointRadius:k=3,normalize:w=!1,baseline:A="zero",stackOrder:S,tooltip:C,annotations:M,xExtent:j,yExtent:_,frameProps:R={},selection:P,linkedHover:L,onObservation:I,onClick:T,hoverHighlight:N,chartId:F,loading:O,loadingContent:B,emptyContent:D,legendInteraction:W,legendPosition:z,color:H,stroke:E,strokeWidth:$,opacity:Y}=e,{width:q,height:G,enableHover:V,showGrid:U,showLegend:K,title:Q,description:Z,summary:J,accessibleTable:ee,xLabel:te,yLabel:ne}=o,oe=(0,zc.useMemo)(()=>X(r),[r]),re=f||h;mc(t,{variant:"xy",frameRef:n});const ie=rc({data:oe,rawData:r,colorBy:re,colorScheme:p,legendInteraction:W,legendPosition:z,selection:P,linkedHover:L,fallbackFields:re?["string"==typeof re?re:""]:[],unwrapData:!1,onObservation:I,onClick:T,hoverHighlight:N,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"StackedAreaChart",chartId:F,showLegend:K,userMargin:i,marginDefaults:o.marginDefaults,loading:O,loadingContent:B,emptyContent:D,width:q,height:G}),se=(0,zc.useMemo)(()=>lc(c,u),[c,u]),{flattenedData:ae,lineStyle:le,pointStyle:ce,defaultTooltipContent:ue}=Ic({safeData:oe,data:r,areaBy:h,lineDataAccessor:d,colorBy:re,colorScale:ie.colorScale,color:H,stroke:E,strokeWidth:$,opacity:Y,effectiveSelectionHook:ie.effectiveSelectionHook,resolvedSelection:ie.resolvedSelection,areaOpacity:g,showLine:x,lineWidth:b,showPoints:v,pointRadius:k,xAccessor:c,yAccessor:u,xLabel:te,yLabel:ne,xFormat:a,yFormat:l,groupField:h||f,styleRules:y,ruleContext:se}),he=ec({componentName:"StackedAreaChart",data:r,accessors:{xAccessor:c,yAccessor:u}}),de={chartType:"stackedarea",...null!=r&&{data:ae},xAccessor:c,yAccessor:u,groupAccessor:h||void 0,curve:m,normalize:w,baseline:w?"zero":A,stackOrder:S,lineStyle:le,...v&&ce&&{pointStyle:ce},size:[q,G],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ie.margin,showAxes:o.showAxes,xLabel:te,yLabel:ne,xFormat:a,yFormat:l,enableHover:V,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:U,...ie.legendBehaviorProps,...gc({title:Q,description:Z,summary:J,accessibleTable:ee,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),..."multi"===C?{tooltipContent:ms(),tooltipMode:"multi"}:bc({tooltip:C,defaultTooltipContent:ue}),...xc({linkedHover:L,selection:P,onObservation:I,onClick:T,hoverHighlight:N,mobileInteraction:ie.mobileInteraction,customHoverBehavior:ie.customHoverBehavior,customClickBehavior:ie.customClickBehavior}),...M&&M.length>0&&{annotations:M},...j&&{xExtent:j},..._&&{yExtent:_},...ie.crosshairProps,...R};return ie.earlyReturn?ie.earlyReturn:he?(0,Hc.jsx)(zl,{componentName:"StackedAreaChart",message:he,width:q,height:G}):(0,Hc.jsx)(Gl,{componentName:"StackedAreaChart",width:q,height:G,children:(0,Hc.jsx)(Da,{ref:n,...de})})});Ec.displayName="StackedAreaChart";var $c=y(require("react")),Yc=require("react"),qc=require("react");function Gc(e){const{colorBy:t,colorScale:n,color:o,pointRadius:r=5,radiusFn:i,fillOpacity:s=1,fallbackFill:a,baseStyleExtras:l,stroke:c,strokeWidth:u,opacity:h,effectiveSelectionHook:d,resolvedSelection:f,colorDatumAccessor:p,styleRules:y,ruleContext:m}=e,g=(0,qc.useMemo)(()=>e=>{const c="function"==typeof l?l(e):l,u=c?{...c}:{};if(void 0===u.fillOpacity&&(u.fillOpacity=s),void 0===u.fill)if(t){if(n){const o=p?p(e):e;u.fill=Ee(o,t,n)}}else u.fill=a?a(e):o||Cl;return void 0===u.r&&(u.r=i?i(e):r),y&&y.length>0&&Object.assign(u,dc(e,y,m?m(e):{value:void 0})),u},[t,n,o,r,i,s,a,l,p,y,m]),x=(0,qc.useMemo)(()=>sc(g,{stroke:c,strokeWidth:u,opacity:h}),[g,c,u,h]);return(0,qc.useMemo)(()=>ml(x,d??null,f),[x,d,f])}var Vc=require("react");function Xc(e){const{accessor:t,data:n,isPushMode:o}=e,r=(0,Vc.useRef)(null),[i,s]=(0,Vc.useState)(0),a=(0,Vc.useCallback)(e=>{if(!o||!t)return;let n=!1;for(const o of e){const e="function"==typeof t?t(o):o[t];if(null==e)continue;const i="number"==typeof e?e:Number(e);Number.isFinite(i)&&(r.current?(r.current[0]>i&&(r.current[0]=i,n=!0),i>r.current[1]&&(r.current[1]=i,n=!0)):(r.current=[i,i],n=!0))}n&&s(e=>e+1)},[o,t]),l=(0,Vc.useCallback)(()=>{o&&(r.current=null,s(e=>e+1))},[o]);return{domain:(0,Vc.useMemo)(()=>{if(o)return r.current??void 0;if(!t||0===n.length)return;const e="function"==typeof t?t:e=>e[t];let i=1/0,s=-1/0;for(const t of n){const n=e(t);if(null==n)continue;const o="number"==typeof n?n:Number(n);Number.isFinite(o)&&(i>o&&(i=o),o>s&&(s=o))}return Number.isFinite(i)&&Number.isFinite(s)?[i,s]:void 0},[n,t,o,i]),trackPushed:a,reset:l}}function Uc(e){if(!e)return;const t="boolean"==typeof e?{}:"string"==typeof e?{method:e}:e;return{type:"trend",method:t.method??"linear",...null!=t.bandwidth&&{bandwidth:t.bandwidth},...null!=t.order&&{order:t.order},...null!=t.color&&{color:t.color},...null!=t.strokeWidth&&{strokeWidth:t.strokeWidth},...null!=t.strokeDasharray&&{strokeDasharray:t.strokeDasharray},...null!=t.label&&{label:t.label}}}var Kc=require("react/jsx-runtime"),Qc=(0,Yc.forwardRef)(function(e,t){const n=(0,Yc.useRef)(null),o=Bl(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}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:u="y",xScaleType:h,yScaleType:d,colorBy:f,colorScheme:p,styleRules:y,sizeBy:m,sizeRange:g=[3,15],symbolBy:x,symbolMap:b,pointRadius:v=5,pointOpacity:k=.8,tooltip:w,marginalGraphics:A,pointIdAccessor:S,annotations:C,regression:M,forecast:j,anomaly:_,xExtent:R,yExtent:P,frameProps:L={},selection:I,linkedHover:T,linkedBrush:N,onObservation:F,onClick:O,hoverHighlight:B,chartId:D,loading:W,loadingContent:z,emptyContent:H,legendInteraction:E,legendPosition:$,color:Y,stroke:q,strokeWidth:G,opacity:V}=e,{width:U,height:K,enableHover:Q,showGrid:Z,showLegend:J,title:ee,description:te,summary:ne,accessibleTable:oe,xLabel:re,yLabel:ie}=o,se=(0,Yc.useMemo)(()=>X(r),[r]),ae=void 0===r,{domain:le,trackPushed:ce,reset:ue}=Xc({accessor:m,data:se,isPushMode:ae}),he=(0,Yc.useCallback)(e=>{ce([e]),n.current?.push(e)},[ce]),de=(0,Yc.useCallback)(e=>{ce(e),n.current?.pushMany(e)},[ce]);mc(t,{variant:"xy",frameRef:n,overrides:{push:he,pushMany:de,clear:()=>{ue(),n.current?.clear()}}});const fe=rc({data:se,rawData:r,colorBy:f,colorScheme:p,legendInteraction:E,legendPosition:$,selection:I,linkedHover:T,fallbackFields:f?["string"==typeof f?f:""]:[],unwrapData:!1,onObservation:F,onClick:O,hoverHighlight:B,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"Scatterplot",chartId:D,showLegend:J,userMargin:i,marginDefaults:o.marginDefaults,loading:W,loadingContent:z,emptyContent:H,width:U,height:K}),pe=pl(N),ye=tl({name:pe?.name||"__unused_brush__",xField:pe?.xField||("string"==typeof c?c:void 0),yField:pe?.yField||("string"==typeof u?u:void 0)}),me=pe?"xyBrush"===ye.brushInteraction.brush?"xy":"xBrush"===ye.brushInteraction.brush?"x":"y":void 0,ge=$c.useRef(ye.brushInteraction);ge.current=ye.brushInteraction;const xe=(0,Yc.useCallback)(e=>{const t=ge.current;t.end(e?"xyBrush"===t.brush?[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:"xBrush"===t.brush?e.x:e.y:null)},[]);Ql("Scatterplot",se,"xAccessor",c),Ql("Scatterplot",se,"yAccessor",u);const be=(0,Yc.useMemo)(()=>m?le??[0,1]:void 0,[m,le]),ve=(0,Yc.useMemo)(()=>m?e=>qe(e,m,g,be):void 0,[m,g,be]),ke=(0,Yc.useMemo)(()=>lc(c,u),[c,u]),we=Gc({colorBy:f,colorScale:fe.colorScale,color:Y,pointRadius:v,fillOpacity:k,radiusFn:ve,stroke:q,strokeWidth:G,opacity:V,styleRules:y,ruleContext:ke,effectiveSelectionHook:fe.effectiveSelectionHook,resolvedSelection:fe.resolvedSelection}),Ae=(0,Yc.useMemo)(()=>Aa([{label:re||xa(c),accessor:c,role:"x",format:a},{label:ie||xa(u),accessor:u,role:"y",format:l},...f?[{label:xa(f),accessor:f,role:"color"}]:[],...m?[{label:xa(m),accessor:m,role:"size"}]:[]]),[c,u,re,ie,f,m,a,l]),{effectiveData:Se,statisticalAnnotations:Ce}=Mc({data:se,xAccessor:c,yAccessor:u,forecast:j,anomaly:_}),Me=(0,Yc.useMemo)(()=>{const e=Uc(M);return e||0!==Ce.length?[...e?[e]:[],...C||[],...Ce]:C},[M,C,Ce]);if(fe.earlyReturn)return fe.earlyReturn;const je=ec({componentName:"Scatterplot",data:r,accessors:{xAccessor:c,yAccessor:u}});if(je)return(0,Kc.jsx)(zl,{componentName:"Scatterplot",message:je,width:U,height:K});const _e={chartType:"scatter",...null!=r&&{data:Se},xAccessor:c,yAccessor:u,xScaleType:h,yScaleType:d,colorAccessor:f||void 0,sizeAccessor:m||void 0,...x&&{symbolAccessor:x},...b&&{symbolMap:b},sizeRange:g,pointStyle:we,colorScheme:p,size:[U,K],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:fe.margin,showAxes:o.showAxes,xLabel:re,yLabel:ie,xFormat:a,yFormat:l,enableHover:Q,showGrid:Z,...fe.legendBehaviorProps,...gc({title:ee,description:te,summary:ne,accessibleTable:oe,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...bc({tooltip:w,defaultTooltipContent:Ae}),...xc({linkedHover:T,selection:I,onObservation:F,onClick:O,hoverHighlight:B,mobileInteraction:fe.mobileInteraction,customHoverBehavior:fe.customHoverBehavior,customClickBehavior:fe.customClickBehavior}),...A&&{marginalGraphics:A},...S&&{pointIdAccessor:S},...Me&&Me.length>0&&{annotations:Me},...R&&{xExtent:R},...P&&{yExtent:P},...pe&&{brush:{dimension:me},onBrush:xe},...fe.crosshairProps,...L};return(0,Kc.jsx)(Gl,{componentName:"Scatterplot",width:U,height:K,children:(0,Kc.jsx)(Da,{ref:n,..._e})})});Qc.displayName="Scatterplot";var Zc=require("react"),Jc=require("react/jsx-runtime");function eu(e,t){return Pe(1===t?.5:e/(t-1))}var tu=(0,Zc.forwardRef)(function(e,t){const n=(0,Zc.useRef)(null);mc(t,{variant:"xy",frameRef:n});const o=Bl(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:u="y",orderAccessor:h,orderLabel:d,styleRules:f,pointRadius:p=4,tooltip:y,pointIdAccessor:m,annotations:g,regression:x,forecast:b,anomaly:v,xExtent:k,yExtent:w,frameProps:A={},selection:S,linkedHover:C,onObservation:M,onClick:j,hoverHighlight:_,chartId:R,loading:P,loadingContent:L,emptyContent:I,legendInteraction:T,stroke:N,strokeWidth:F,opacity:O}=e,{width:B,height:D,enableHover:W,showGrid:z,title:H,description:E,summary:$,accessibleTable:Y,xLabel:q,yLabel:G}=o,{safeData:V,orderMap:X}=(0,Zc.useMemo)(()=>{const e=r||[],t="function"==typeof c?c:e=>e[c],n="function"==typeof u?u:e=>e[u];let o=e;if(h&&e.length>0){const t="function"==typeof h?h:e=>e[h];o=[...e].sort((e,n)=>{const o=t(e),r=t(n);return(o instanceof Date?o.getTime():+o)-(r instanceof Date?r.getTime():+r)})}const i=new WeakMap;let s=0;for(const e of o){const o=t(e),r=n(e);null!=o&&null!=r&&isFinite(o)&&isFinite(r)&&s++}let a=0;for(const e of o){const o=t(e),r=n(e);null!=o&&null!=r&&isFinite(o)&&isFinite(r)&&i.set(e,{idx:a++,total:s})}return{safeData:o,orderMap:i}},[r,h,c,u]);Ql("ConnectedScatterplot",V,"xAccessor",c),Ql("ConnectedScatterplot",V,"yAccessor",u);const U=rc({data:V,rawData:r,colorBy:void 0,colorScheme:void 0,legendInteraction:T,selection:S,linkedHover:C,fallbackFields:[],unwrapData:!1,onObservation:M,onClick:j,hoverHighlight:_,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"ConnectedScatterplot",chartId:R,showLegend:void 0,userMargin:i,marginDefaults:{top:50,right:40,bottom:60,left:70},loading:P,loadingContent:L,emptyContent:I,width:B,height:D}),K=U.resolvedSelection?.unselectedOpacity??yl,Q=(0,Zc.useMemo)(()=>(e,t)=>{const n=t.filter(e=>"point"===e.type);if(2>n.length)return;const o=U.effectiveSelectionHook?.isActive,r=U.effectiveSelectionHook?.predicate,i=100>n.length,s=n.length;e.lineCap="round";for(let t=0;s-1>t;t++){const a=n[t],l=n[t+1],c=eu(t,s),u=!o||!r||r(a.datum??a)||r(l.datum??l),h=o?u?1:K:1;i&&(e.beginPath(),e.moveTo(a.x,a.y),e.lineTo(l.x,l.y),e.strokeStyle="white",e.lineWidth=p+2,e.globalAlpha=.5*h,e.stroke()),e.beginPath(),e.moveTo(a.x,a.y),e.lineTo(l.x,l.y),e.strokeStyle=c,e.lineWidth=p,e.globalAlpha=h,e.stroke()}e.globalAlpha=1},[p,U.effectiveSelectionHook,K]),Z=(0,Zc.useMemo)(()=>[Q],[Q]),J=(0,Zc.useMemo)(()=>(e,t,n)=>{const o=e.filter(e=>"point"===e.type);if(2>o.length)return null;const r=o.length,i=100>r,s=[];for(let e=0;r-1>e;e++){const t=o[e],n=o[e+1],a=eu(e,r),l=Math.min("number"==typeof t.style?.opacity?t.style.opacity:1,"number"==typeof n.style?.opacity?n.style.opacity:1);i&&s.push((0,Jc.jsx)("line",{x1:t.x,y1:t.y,x2:n.x,y2:n.y,stroke:"white",strokeWidth:p+2,strokeLinecap:"round",opacity:.5*l},"halo-"+e)),s.push((0,Jc.jsx)("line",{x1:t.x,y1:t.y,x2:n.x,y2:n.y,stroke:a,strokeWidth:p,strokeLinecap:"round",opacity:l},"seg-"+e))}return(0,Jc.jsx)(Jc.Fragment,{children:s})},[p]),ee=(0,Zc.useMemo)(()=>[J],[J]),te=Gc({colorScale:void 0,baseStyleExtras:(0,Zc.useMemo)(()=>e=>{const t=X.get(e),n=t?.idx??0,o=t?.total??1;return{fill:o>0?eu(n,o):"#6366f1",stroke:"white",strokeWidth:1,r:p,fillOpacity:1}},[p,X]),stroke:N,strokeWidth:F,opacity:O,styleRules:f,ruleContext:(0,Zc.useMemo)(()=>lc(c,u),[c,u]),effectiveSelectionHook:U.effectiveSelectionHook,resolvedSelection:U.resolvedSelection}),ne=d||("string"==typeof h?h:"Order"),oe=(0,Zc.useMemo)(()=>Aa([{label:q||xa(c),accessor:c,role:"x",format:a},{label:G||xa(u),accessor:u,role:"y",format:l},...h?[{label:ne,accessor:h,role:"group"}]:[]]),[c,u,q,G,h,ne,a,l]),re=ec({componentName:"ConnectedScatterplot",data:r,accessors:{xAccessor:c,yAccessor:u}}),{effectiveData:ie,statisticalAnnotations:se}=Mc({data:V,xAccessor:c,yAccessor:u,forecast:b,anomaly:v});if(U.earlyReturn)return U.earlyReturn;const ae=Uc(x),le=ae||se.length>0?[...ae?[ae]:[],...g||[],...se]:g,ce={chartType:"scatter",...null!=r&&{data:ie},xAccessor:c,yAccessor:u,pointStyle:te,size:[B,D],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:U.margin,showAxes:o.showAxes,xLabel:q,yLabel:G,xFormat:a,yFormat:l,enableHover:W,showGrid:z,...gc({title:H,description:E,summary:$,accessibleTable:Y,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...bc({tooltip:y,defaultTooltipContent:oe}),...xc({linkedHover:C,selection:S,onObservation:M,onClick:j,hoverHighlight:_,mobileInteraction:U.mobileInteraction,customHoverBehavior:U.customHoverBehavior,customClickBehavior:U.customClickBehavior}),...m&&{pointIdAccessor:m},canvasPreRenderers:Z,svgPreRenderers:ee,...le&&le.length>0&&{annotations:le},...k&&{xExtent:k},...w&&{yExtent:w},...U.crosshairProps,...A};return re?(0,Jc.jsx)(zl,{componentName:"ConnectedScatterplot",message:re,width:B,height:D}):(0,Jc.jsx)(Gl,{componentName:"ConnectedScatterplot",width:B,height:D,children:(0,Jc.jsx)(Da,{ref:n,...ce})})});tu.displayName="ConnectedScatterplot";var nu=require("react"),ou=require("react/jsx-runtime"),ru=(0,nu.forwardRef)(function(e,t){const n=(0,nu.useRef)(null),o=Bl(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}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:u="y",sizeBy:h,sizeRange:d=[5,40],colorBy:f,colorScheme:p,styleRules:y,bubbleOpacity:m=.6,bubbleStrokeWidth:g=1,bubbleStrokeColor:x="white",tooltip:b,marginalGraphics:v,pointIdAccessor:k,annotations:w,regression:A,xExtent:S,yExtent:C,frameProps:M={},selection:j,linkedHover:_,linkedBrush:R,onObservation:P,onClick:L,hoverHighlight:I,chartId:T,loading:N,loadingContent:F,emptyContent:O,legendInteraction:B,legendPosition:D,color:W,stroke:z,strokeWidth:H,opacity:E}=e,{width:$,height:Y,enableHover:q,showGrid:G,showLegend:V,title:U,description:K,summary:Q,accessibleTable:Z,xLabel:J,yLabel:ee}=o,te=(0,nu.useMemo)(()=>X(r),[r]),ne=void 0===r,oe=rc({data:te,rawData:r,colorBy:f,colorScheme:p,legendInteraction:B,legendPosition:D,selection:j,linkedHover:_,fallbackFields:f?["string"==typeof f?f:""]:[],unwrapData:!1,onObservation:P,onClick:L,hoverHighlight:I,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"BubbleChart",chartId:T,showLegend:V,userMargin:i,marginDefaults:o.marginDefaults,loading:N,loadingContent:F,emptyContent:O,width:$,height:Y}),{domain:re,trackPushed:ie,reset:se}=Xc({accessor:h,data:te,isPushMode:ne}),ae=(0,nu.useCallback)(e=>{ie([e]),n.current?.push(e)},[ie]),le=(0,nu.useCallback)(e=>{ie(e),n.current?.pushMany(e)},[ie]);mc(t,{variant:"xy",frameRef:n,overrides:{push:ae,pushMany:le,clear:()=>{se(),n.current?.clear()}}});const ce=pl(R),ue=(tl({name:ce?.name||"__unused_brush__",xField:ce?.xField||("string"==typeof c?c:void 0),yField:ce?.yField||("string"==typeof u?u:void 0)}),(0,nu.useMemo)(()=>({stroke:x,strokeWidth:g}),[x,g])),he=(0,nu.useMemo)(()=>re??[0,1],[re]),de=(0,nu.useCallback)(e=>qe(e,h,d,he),[h,d,he]),fe=(0,nu.useMemo)(()=>lc(c,u),[c,u]),pe=Gc({colorBy:f,colorScale:oe.colorScale,color:W,fillOpacity:m,radiusFn:de,baseStyleExtras:ue,stroke:z,strokeWidth:H,opacity:E,styleRules:y,ruleContext:fe,effectiveSelectionHook:oe.effectiveSelectionHook,resolvedSelection:oe.resolvedSelection}),ye=(0,nu.useMemo)(()=>Aa([{label:J||xa(c),accessor:c,role:"x",format:a},{label:ee||xa(u),accessor:u,role:"y",format:l},{label:xa(h),accessor:h,role:"size"},...f?[{label:xa(f),accessor:f,role:"color"}]:[]]),[c,u,J,ee,h,f,a,l]);if(oe.earlyReturn)return oe.earlyReturn;const me=ec({componentName:"BubbleChart",data:r,accessors:{xAccessor:c,yAccessor:u},requiredProps:{sizeBy:h}});if(me)return(0,ou.jsx)(zl,{componentName:"BubbleChart",message:me,width:$,height:Y});const ge=Uc(A),xe=ge?[ge,...w||[]]:w,be={chartType:"bubble",...null!=r&&{data:te},xAccessor:c,yAccessor:u,colorAccessor:f||void 0,sizeAccessor:h,sizeRange:d,pointStyle:pe,colorScheme:p,size:[$,Y],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:oe.margin,showAxes:o.showAxes,xLabel:J,yLabel:ee,xFormat:a,yFormat:l,enableHover:q,showGrid:G,...oe.legendBehaviorProps,...gc({title:U,description:K,summary:Q,accessibleTable:Z,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...bc({tooltip:b,defaultTooltipContent:ye}),...xc({linkedHover:_,selection:j,onObservation:P,onClick:L,hoverHighlight:I,mobileInteraction:oe.mobileInteraction,customHoverBehavior:oe.customHoverBehavior,customClickBehavior:oe.customClickBehavior}),...v&&{marginalGraphics:v},...k&&{pointIdAccessor:k},...xe&&xe.length>0&&{annotations:xe},...S&&{xExtent:S},...C&&{yExtent:C},...oe.crosshairProps,...M};return(0,ou.jsx)(Gl,{componentName:"BubbleChart",width:$,height:Y,children:(0,ou.jsx)(Da,{ref:n,...be})})});ru.displayName="BubbleChart";var iu=require("react"),su=require("d3-scale");C();var au=require("react/jsx-runtime"),lu=(0,iu.forwardRef)(function(e,t){const n=(0,iu.useRef)(null);mc(t,{variant:"xy",frameRef:n});const o=Bl(e.mode,{width:e.width,height:e.height,showGrid:void 0,enableHover:e.enableHover,showLegend:void 0,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xAccessor:a="x",yAccessor:l="y",valueAccessor:c="value",xFormat:u,yFormat:h,colorScheme:d,customColorScale:f,showValues:p=!1,valueFormat:y,cellBorderColor:m="#fff",cellBorderWidth:g=1,tooltip:x,annotations:b,xExtent:v,yExtent:k,frameProps:w={},selection:S,linkedHover:C,onObservation:M,onClick:j,hoverHighlight:_,chartId:R,loading:P,loadingContent:L,emptyContent:I,showLegend:T,legendPosition:N,legendInteraction:F}=e,{width:O,height:B,enableHover:D,title:W,description:z,summary:H,accessibleTable:E,xLabel:$,yLabel:Y}=o,q=Kl(P,O,B,L),G=q?null:Ul(r,O,B,I),V=(0,iu.useMemo)(()=>X(r),[r]),U=function(){const e=xl();return e?.colors?.sequential||void 0}(),K=d??U??"blues",Q=T??!1,Z=N??"right",{margin:J}=Nl({data:V,colorBy:Q?"value":void 0,colorScale:void 0,showLegend:Q,legendPosition:Z,userMargin:i,defaults:o.marginDefaults}),{customHoverBehavior:ee,customClickBehavior:te,crosshairSourceId:ne}=Il({selection:S,linkedHover:C,fallbackFields:[],onObservation:M,onClick:j,chartType:"Heatmap",chartId:R,hoverHighlight:_,colorByField:void 0,mobileInteraction:o.mobileInteraction});oc(S);const oe=Tl(C,ne);Fl(F,void 0,[]);const re=(0,iu.useMemo)(()=>"function"==typeof c?e=>c(e):e=>e[c],[c]),ie=(0,iu.useMemo)(()=>A(V.map(re)),[V,re]),se=(0,iu.useMemo)(()=>{if("custom"===K&&f)return f;const e=Be(K);return(0,su.scaleSequential)(e).domain(ie)},[K,f,ie]),ae=(0,iu.useMemo)(()=>Aa([{label:$||xa(a),accessor:a,role:"x",format:u},{label:Y||xa(l),accessor:l,role:"y",format:h},{label:xa(c),accessor:c,role:"value",format:y}]),[a,l,$,Y,c,u,h,y]),le=ec({componentName:"Heatmap",data:r,accessors:{xAccessor:a,yAccessor:l,valueAccessor:c}}),ce=(0,iu.useMemo)(()=>{if(Q)return{gradient:{colorFn:e=>se(e),domain:ie,label:"string"==typeof c?c:"value",format:y}}},[Q,se,ie,c,y]),ue={chartType:"heatmap",...null!=r&&{data:V},xAccessor:a,yAccessor:l,valueAccessor:c,colorScheme:"custom"!==K?K:void 0,showValues:p,heatmapValueFormat:y,size:[O,B],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:J,showAxes:o.showAxes,xLabel:$,yLabel:Y,xFormat:u,yFormat:h,enableHover:D,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...ce&&{legend:ce,legendPosition:Z},...gc({title:W,description:z,summary:H,accessibleTable:E,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...bc({tooltip:x,defaultTooltipContent:ae}),...xc({linkedHover:C,selection:S,onObservation:M,onClick:j,hoverHighlight:_,mobileInteraction:o.mobileInteraction,customHoverBehavior:ee,customClickBehavior:te}),...b&&b.length>0&&{annotations:b},...v&&{xExtent:v},...k&&{yExtent:k},...oe,...w};return q||G||(le?(0,au.jsx)(zl,{componentName:"Heatmap",message:le,width:O,height:B}):(0,au.jsx)(Gl,{componentName:"Heatmap",width:O,height:B,children:(0,au.jsx)(Da,{ref:n,...ue})}))});lu.displayName="Heatmap";var cu=y(require("react")),uu=require("react"),hu=require("d3-brush"),du=require("d3-selection");C();var fu=require("react/jsx-runtime"),pu="__splomIdx",yu="splom-hover-source",mu={top:4,bottom:4,left:4,right:4};function gu({frameRef:e,cellSize:t,onBrush:n}){const o=(0,uu.useRef)(null),r=t-mu.left-mu.right,i=t-mu.top-mu.bottom;return(0,uu.useEffect)(()=>{if(!o.current)return;const t=(0,du.select)(o.current).select(".brush-g"),s=(0,hu.brush)().extent([[0,0],[r,i]]).on("brush end",t=>{const o=e.current?.getScales();if(!o)return;if(!(r=t.selection)||!Array.isArray(r[0]))return void n(null);var r;const[[i,s],[a,l]]=t.selection,c=[[o.x.invert(i),o.y.invert(s)],[o.x.invert(a),o.y.invert(l)]];n(c)});return t.call(s),t.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{s.on("brush end",null)}},[r,i,e,n]),(0,fu.jsx)("svg",{ref:o,width:t,height:t,style:{position:"absolute",top:0,left:0},children:(0,fu.jsx)("g",{className:"brush-g",transform:`translate(${mu.left},${mu.top})`})})}function xu({data:e,xField:t,yField:n,cellSize:o,pointRadius:r,pointOpacity:i,colorBy:s,colorScale:a,brushSelectionName:l,hoverSelectionName:c,unselectedOpacity:u,mobileInteraction:h,mode:d,onPointHover:f,onPointClick:p}){const y=(0,uu.useRef)(null),m=Ja({name:l,clientId:`splom-${t}-${n}`,fields:[t,n]}),g=tl({name:l,xField:t,yField:n}),x=Ja({name:c,clientId:yu,fields:[pu]}),b=x.selectPoints,v=(0,uu.useCallback)(e=>{e?g.brushInteraction.during(e):g.brushInteraction.end(null)},[g.brushInteraction]),k=(0,uu.useCallback)(e=>{if(!e)return void f?.(null);const t=e.data,n=t?.[pu];void 0!==n&&(b({[pu]:[n]}),f?.(t,e.x+mu.left,e.y+mu.top))},[b,f]),w=(0,uu.useCallback)(e=>{if(!e)return void p?.(null);const t=e.data;t&&p?.(t,e.x+mu.left,e.y+mu.top)},[p]),A=(0,uu.useCallback)(e=>{const t={opacity:i,r:r};return t.fill=s?Ee(e,s,a):Cl,"hover"===d?x.isActive&&x.predicate(e)?(t.opacity=1,t.r=2.5*r,t.stroke="#333",t.strokeWidth=1.5):x.isActive&&(t.opacity=.6*i):m.isActive&&!m.predicate(e)&&(t.opacity=u),t},[i,r,s,d,a,x,m,u]);return(0,fu.jsxs)("div",{style:{position:"relative",width:o,height:o},children:[(0,fu.jsx)(Da,{ref:y,chartType:"scatter",data:e,size:[o,o],xAccessor:t,yAccessor:n,pointStyle:A,margin:mu,showAxes:!1,enableHover:"hover"===d,...xc({forceHoverBehavior:"hover"===d,forceClickBehavior:!!p,mobileInteraction:h,customHoverBehavior:k,customClickBehavior:w}),tooltipContent:"hover"===d?()=>null:void 0}),"brush"===d&&(0,fu.jsx)(gu,{frameRef:y,cellSize:o,xField:t,yField:n,onBrush:v})]})}function bu({data:e,field:t,label:n,cellSize:o,bins:r,colorBy:i,colorScale:s,brushSelectionName:a,hoverSelectionName:l,mode:c}){const u=Ja({name:a,clientId:"splom-diag-"+t,fields:[t]}),h=Ja({name:l,clientId:`splom-diag-${t}-hover`,fields:[pu]}),d="hover"===c?h:u,f=d.isActive,p=d.predicate,y=(0,uu.useMemo)(()=>{const n="string"==typeof i?i:null,s=[],a=new Set;for(const o of e){const e=o[t];if(null==e||isNaN(e)||s.push(Number(e)),n){const e=o[n];null!=e&&a.add(e+"")}}if(0===s.length)return{bars:[],selectedBars:[],categoryBars:[],selectedCategoryBars:[],max:0,categories:[]};const[l,c]=A(s),u=(c-l)/r||1,h=Array.from(a),d=new Map(h.map((e,t)=>[e,t])),y=Array(r).fill(0),m=Array(r).fill(0),g=Array.from({length:r},()=>Array(h.length).fill(0)),x=Array.from({length:r},()=>Array(h.length).fill(0));for(const o of e){const e=o[t];if(null==e||isNaN(e))continue;const i=Math.min(Math.floor((e-l)/u),r-1);if(y[i]++,f&&!p(o)||m[i]++,n){const e=d.get(o[n]+"");void 0!==e&&(g[i][e]++,f&&!p(o)||x[i][e]++)}}const b=S(y,1),v=g.map((e,t)=>{let n=0;return e.map((e,i)=>{const s=e/b*(o-24),a={x:t/r*o,w:o/r-1,h:s,y0:n,category:h[i]};return n+=s,a})}),k=x.map((e,t)=>{let n=0;return e.map((e,i)=>{const s=e/b*(o-24),a={x:t/r*o,w:o/r-1,h:s,y0:n,category:h[i]};return n+=s,a})});return{bars:y.map((e,t)=>({x:t/r*o,w:o/r-1,h:e/b*(o-24),count:e})),selectedBars:m.map((e,t)=>({x:t/r*o,w:o/r-1,h:e/b*(o-24),count:e})),categoryBars:v,selectedCategoryBars:k,max:b,categories:h}},[e,t,r,o,f,p,i]);return(0,fu.jsxs)("svg",{width:o,height:o,style:{overflow:"hidden"},children:[(0,fu.jsx)("text",{x:o/2,y:14,textAnchor:"middle",fontSize:11,fontWeight:"bold",fill:"#333",children:n}),y.categories.length>0?y.categoryBars.map((e,t)=>e.map((e,n)=>(0,fu.jsx)("rect",{x:e.x,y:o-e.y0-e.h,width:Math.max(e.w,1),height:e.h,fill:s?s(e.category):Cl,opacity:f?.3:.6},`bg-${t}-${n}`))):y.bars.map((e,t)=>(0,fu.jsx)("rect",{x:e.x,y:o-e.h,width:Math.max(e.w,1),height:e.h,fill:Cl,opacity:f?.3:.6},"bg-"+t)),f&&(y.categories.length>0?y.selectedCategoryBars.map((e,t)=>e.map((e,n)=>(0,fu.jsx)("rect",{x:e.x,y:o-e.y0-e.h,width:Math.max(e.w,1),height:e.h,fill:s?s(e.category):Cl,opacity:.7},`sel-${t}-${n}`))):y.selectedBars.map((e,t)=>(0,fu.jsx)("rect",{x:e.x,y:o-e.h,width:Math.max(e.w,1),height:e.h,fill:Cl,opacity:.7},"sel-"+t)))]})}function vu({label:e,cellSize:t}){return(0,fu.jsx)("svg",{width:t,height:t,children:(0,fu.jsx)("text",{x:t/2,y:t/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:12,fontWeight:"bold",fill:"#333",children:e})})}function ku(e){const{data:t,fields:n,fieldLabels:o={},colorBy:r,colorScheme:i,cellSize:s=150,cellGap:a=4,pointRadius:l=2,pointOpacity:c=.5,diagonal:u="histogram",histogramBins:h=20,brushMode:d="crossfilter",hoverMode:f=!0,unselectedOpacity:p=.1,showGrid:y=!1,tooltip:m,showLegend:g,idAccessor:x,width:b,className:v,onObservation:k,onClick:w,chartId:A}=e,S="splom",C="splom-hover",M=Rl(e.mobileInteraction,{mode:e.mode,width:b??n.length*s,mobileSemantics:e.mobileSemantics}),j=f?"hover":d?"brush":"hover",_=Qa(e=>e.clearSelection),[R,P]=(0,uu.useState)(null),L=(0,uu.useCallback)(()=>{_(C),P(null)},[_,C]),I=(0,uu.useMemo)(()=>(t||[]).map((e,t)=>void 0!==e[pu]?e:{...e,[pu]:t}),[t]),T=Ll(I,r,i),N=(0,uu.useCallback)((e,t,n,o)=>[40+e*(s+a)+(n??0),t*(s+a)+(o??0)],[40,s,a]),F=void 0!==g?g:!!r,O=(0,uu.useMemo)(()=>{if(!F||!r)return null;const e="string"==typeof r?r:null;return e?Array.from(new Set(I.map(t=>t[e]).filter(e=>null!=e))).map(e=>({label:e+"",color:T?T(e+""):Cl})):null},[F,r,I,T]),B=(0,uu.useMemo)(()=>({display:"grid",gridTemplateColumns:"40px "+n.map(()=>s+"px").join(" "),gridTemplateRows:n.map(()=>s+"px").join(" ")+" 40px",gap:a+"px",width:"fit-content"}),[n,s,a,40]);return(0,fu.jsxs)("div",{className:v,style:{position:"relative"},children:[O&&(0,fu.jsx)("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"},children:O.map(e=>(0,fu.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4},children:[(0,fu.jsx)("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",backgroundColor:e.color}}),(0,fu.jsx)("span",{style:{fontSize:11},children:e.label})]},e.label))}),(0,fu.jsxs)("div",{style:B,onMouseLeave:"hover"===j?L:void 0,children:[n.map((e,t)=>(0,fu.jsxs)(cu.Fragment,{children:[(0,fu.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:11,fontWeight:"bold",color:"#333"},children:o[e]||e}),n.map((n,i)=>t===i?"label"===u?(0,fu.jsx)(vu,{label:o[e]||e,cellSize:s},"diag-"+e):(0,fu.jsx)(bu,{data:I,field:e,label:o[e]||e,cellSize:s,bins:h,colorBy:r,colorScale:T,brushSelectionName:S,hoverSelectionName:C,unselectedOpacity:p,mode:j},"diag-"+e):(0,fu.jsx)(xu,{data:I,xField:n,yField:e,fieldLabels:o,cellSize:s,pointRadius:l,pointOpacity:c,colorBy:r,colorScale:T,brushSelectionName:S,hoverSelectionName:C,unselectedOpacity:p,showGrid:y,tooltip:m,mobileInteraction:M,mode:j,onPointHover:"hover"===j?(o,r,s)=>{if(o){if(P({datum:o,xField:n,yField:e,colIndex:i,rowIndex:t,px:r??0,py:s??0}),k){const[e,n]=N(i,t,r,s);k({type:"hover",datum:o,x:e,y:n,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:A})}}else P(null),k&&k({type:"hover-end",timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:A})}:void 0,onPointClick:w||k?(e,n,o)=>{if(!e)return;const[r,s]=N(i,t,n,o);w&&w(e,{x:r,y:s}),k&&k({type:"click",datum:e,x:r,y:s,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:A})}:void 0},`cell-${e}-${n}`))]},"row-"+e)),(0,fu.jsx)("div",{})," ",n.map(e=>(0,fu.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:"bold",color:"#333"},children:o[e]||e},"col-label-"+e))]}),R&&"hover"===j&&(()=>{const e=R.datum,t=o[R.xField]||R.xField,n=o[R.yField]||R.yField,i=r?"function"==typeof r?r(e):e[r]:null,l=x?"function"==typeof x?x(e):e[x]:"Row "+e[pu];return(0,fu.jsxs)("div",{style:{position:"absolute",left:40+R.colIndex*(s+a)+R.px,top:R.rowIndex*(s+a)+R.py-8,transform:"translate(-50%, -100%)",color:"#333",background:"rgba(255,255,255,0.95)",border:"1px solid #ddd",borderRadius:3,padding:"4px 8px",fontSize:11,lineHeight:1.4,whiteSpace:"nowrap",pointerEvents:"none",zIndex:10},children:[(0,fu.jsx)("div",{style:{fontWeight:"bold",marginBottom:2},children:l+""}),(0,fu.jsxs)("div",{children:[t,": ",null!=e[R.xField]?Number(e[R.xField]).toFixed(1):"–"]}),(0,fu.jsxs)("div",{children:[n,": ",null!=e[R.yField]?Number(e[R.yField]).toFixed(1):"–"]}),null!=i&&(0,fu.jsxs)("div",{style:{opacity:.8},children:["string"==typeof r?r:"group",": ",i+""]})]})})()]})}function wu(e){const{brushMode:t="crossfilter",hoverMode:n=!0}=e,o={};return!n&&t&&(o.splom={resolution:t}),n&&(o["splom-hover"]={resolution:"union"}),(0,fu.jsx)(fl,{selections:o,children:(0,fu.jsx)(ku,{...e})})}wu.displayName="ScatterplotMatrix";var Au=require("react"),Su=require("d3-brush"),Cu=require("d3-selection"),Mu=require("react/jsx-runtime");function ju({width:e,height:t,margin:n,scales:o,brushDirection:r,extent:i,onBrush:s}){const a=(0,Au.useRef)(null),l=(0,Au.useRef)(null),c=(0,Au.useRef)(!1),u=e+n.left+n.right,h=t+n.top+n.bottom;return(0,Au.useEffect)(()=>{if(!a.current||!o)return;const n=(0,Cu.select)(a.current).select(".brush-group"),i="x"===r?(0,Su.brushX)().extent([[0,0],[e,t]]):(0,Su.brushY)().extent([[0,0],[e,t]]);return i.on("brush end",e=>{if(c.current)return;if(!e.sourceEvent)return;const t=e.selection;if(!t)return void s(null);const n=("x"===r?o.x:o.y).invert;if(!n)return;const i=[n(t[0]),n(t[1])];s(i)}),n.call(i),l.current=e=>{n.call(i.move,e)},n.select(".selection").attr("fill","steelblue").attr("fill-opacity",.2).attr("stroke","steelblue").attr("stroke-width",1),()=>{l.current=null,i.on("brush end",null)}},[o,e,t,r,s]),(0,Au.useEffect)(()=>{if(!l.current||!o||!a.current)return;const e="x"===r?o.x:o.y;if(c.current=!0,i){const t=[e(i[0]),e(i[1])];l.current(t)}else l.current(null);c.current=!1},[i,o,r]),(0,Mu.jsx)("svg",{ref:a,width:u,height:h,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:(0,Mu.jsx)("g",{className:"brush-group",transform:`translate(${n.left},${n.top})`})})}function _u(e){const{data:t,width:n=600,height:o=400,margin:r,className:i,title:s,description:a,summary:l,xLabel:c,yLabel:u,xFormat:h,yFormat:d,xAccessor:f="x",yAccessor:p="y",lineBy:y,lineDataAccessor:m="coordinates",colorBy:g,colorScheme:x,curve:b="linear",lineWidth:v=2,fillArea:k=!1,areaOpacity:w=.3,showPoints:A=!1,pointRadius:S=3,enableHover:C=!0,showGrid:M=!1,showLegend:j,legendPosition:_,tooltip:R,minimap:P={},renderBefore:L=!1,onBrush:I,brushExtent:T,yExtent:N,frameProps:F={},loading:O,loadingContent:B,emptyContent:D}=e,W=Kl(O,n,o,B),z=W?null:Ul(t,n,o,D),H=(0,Au.useMemo)(()=>X(t),[t]),[E,$]=(0,Au.useState)(null),Y=T??E,q=(0,Au.useCallback)(e=>{T||$(e),I?.(e)},[T,I]),G=(0,Au.useRef)(null),[V,U]=(0,Au.useState)(null);(0,Au.useEffect)(()=>{let e=0,t=!1;const n=()=>{if(t)return;const o=G.current?.getScales?.();o?U(o):e=requestAnimationFrame(n)};return e=requestAnimationFrame(n),()=>{t=!0,e&&cancelAnimationFrame(e)}},[t]);const K=void 0!==H[0]?.[m],Q=(0,Au.useMemo)(()=>{if(K)return H;if(y){const e=H.reduce((e,t)=>{const n="function"==typeof y?y(t):t[y];if(!e[n]){const t={[m]:[]};"string"==typeof y&&(t[y]=n),e[n]=t}return e[n][m].push(t),e},{});return Object.values(e)}return[{[m]:H}]},[H,y,m,K]),Z=(0,Au.useMemo)(()=>K||y?Q.flatMap(e=>{const t=e[m]||[];return y&&"string"==typeof y?t.map(t=>({...t,[y]:e[y]})):t}):H,[Q,m,K,y,H]),J=Ll(H,g,x),ee=pc({lineWidth:v,colorBy:g,colorScale:J,fillArea:k,areaOpacity:w}),te=(0,Au.useMemo)(()=>{if(P.lineStyle)return P.lineStyle},[P.lineStyle]),ne=pc({lineWidth:1,colorBy:g,colorScale:J}),oe=te??ne,re=(0,Au.useMemo)(()=>{if(A)return e=>{const t={r:S,fillOpacity:1};return t.fill=g?Ee(e.parentLine||e,g,J):Cl,t}},[A,S,g,J]),{legend:ie,margin:se,legendPosition:ae}=Nl({data:Q,colorBy:g,colorScale:J,showLegend:j,legendPosition:_,userMargin:r}),le=P.height||60,ce=(0,Au.useMemo)(()=>({top:P.margin?.top??0,bottom:P.margin?.bottom??20,left:P.margin?.left??se.left,right:P.margin?.right??se.right}),[P.margin,se]),ue=P.brushDirection||"x",he=(0,Au.useMemo)(()=>Aa([{label:c||xa(f),accessor:f,role:"x",format:h},{label:u||xa(p),accessor:p,role:"y",format:d}]),[f,p,c,u,h,d]),de=ec({componentName:"MinimapChart",data:t,accessors:{xAccessor:f,yAccessor:p}});if(de)return(0,Mu.jsx)(zl,{componentName:"MinimapChart",message:de,width:n,height:o});const fe=k?"area":"line",pe={chartType:fe,data:Z,xAccessor:f,yAccessor:p,groupAccessor:y||void 0,curve:b,lineStyle:ee,...A&&{pointStyle:re},size:[n,o],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:se,showAxes:!0,xLabel:c,yLabel:u,xFormat:h,yFormat:d,enableHover:C,showGrid:M,...ie&&{legend:ie,legendPosition:ae},...s&&{title:s},...a&&{description:a},...l&&{summary:l},tooltipContent:!1===R?()=>null:gs(R)||he,...Y&&{xExtent:Y},...N&&{yExtent:N},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...F},ye={chartType:fe,data:Z,xAccessor:f,yAccessor:p,groupAccessor:y||void 0,curve:b,lineStyle:oe,size:[n,le+ce.top+ce.bottom],margin:ce,showAxes:P.showAxes??!1,background:P.background,enableHover:!1,...N&&{yExtent:N}},me=(0,Mu.jsxs)("div",{style:{position:"relative",width:n,overflow:"hidden"},children:[(0,Mu.jsx)(Da,{ref:G,...ye}),(0,Mu.jsx)(ju,{width:n-ce.left-ce.right,height:le,margin:ce,scales:V,brushDirection:ue,extent:Y,onBrush:q})]},"minimap"),ge=(0,Mu.jsx)("div",{style:{overflow:"hidden"},children:(0,Mu.jsx)(Da,{...pe})},"main");return W||z||(0,Mu.jsx)(Gl,{componentName:"MinimapChart",width:n,height:o,children:(0,Mu.jsxs)("div",{className:"minimap-chart"+(i?" "+i:""),children:[L?me:ge,L?ge:me]})})}_u.displayName="MinimapChart";var Ru=require("react"),Pu={label:"Low / High",color:"#E9C46A",opacity:.08},Lu={label:"High / High",color:"#2A9D8F",opacity:.08},Iu={label:"Low / Low",color:"#E76F51",opacity:.08},Tu={label:"High / Low",color:"#86BBD8",opacity:.08};C();var Nu=require("react/jsx-runtime");function Fu(e,t){return{label:t?.label??e.label,color:t?.color??e.color,opacity:t?.opacity??e.opacity}}var Ou=(0,Ru.forwardRef)(function(e,t){const n=(0,Ru.useRef)(null);mc(t,{variant:"xy",frameRef:n});const o=Bl(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}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:u="y",xCenter:h,yCenter:d,quadrants:f,centerlineStyle:p={},showQuadrantLabels:y=!0,quadrantLabelSize:m=12,colorBy:g,colorScheme:x,styleRules:b,sizeBy:v,sizeRange:k=[3,15],pointRadius:w=5,pointOpacity:S=.8,tooltip:C,pointIdAccessor:M,annotations:j,frameProps:_={},selection:R,linkedHover:P,onObservation:L,onClick:I,hoverHighlight:T,chartId:N,loading:F,loadingContent:O,emptyContent:B,legendInteraction:D,legendPosition:W,color:z,stroke:H,strokeWidth:E,opacity:$}=e,{width:Y,height:q,enableHover:G,showGrid:V,showLegend:U,title:K,description:Q,summary:Z,accessibleTable:J,xLabel:ee,yLabel:te}=o,ne=(0,Ru.useMemo)(()=>({topLeft:Fu(Pu,f?.topLeft),topRight:Fu(Lu,f?.topRight),bottomLeft:Fu(Iu,f?.bottomLeft),bottomRight:Fu(Tu,f?.bottomRight)}),[f]),oe=(0,Ru.useMemo)(()=>X(r),[r]),re=rc({data:oe,rawData:r,colorBy:g,colorScheme:x,legendInteraction:D,legendPosition:W,selection:R,linkedHover:P,fallbackFields:"string"==typeof g?[g]:[],unwrapData:!1,onObservation:L,onClick:I,hoverHighlight:T,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"QuadrantChart",chartId:N,showLegend:U,userMargin:i,marginDefaults:o.marginDefaults,loading:F,loadingContent:O,emptyContent:B,width:Y,height:q});Ql("QuadrantChart",oe,"xAccessor",c),Ql("QuadrantChart",oe,"yAccessor",u);const ie=(0,Ru.useMemo)(()=>{if(!oe.length)return;const e="function"==typeof c?c:e=>+e[c],t="function"==typeof u?u:e=>+e[u];let n=1/0,o=-1/0,r=1/0,i=-1/0;for(const s of oe){const a=e(s),l=t(s);isFinite(a)&&(n>a&&(n=a),a>o&&(o=a)),isFinite(l)&&(r>l&&(r=l),l>i&&(i=l))}if(null!=h&&isFinite(h)&&(n>h&&(n=h),h>o&&(o=h)),null!=d&&isFinite(d)&&(r>d&&(r=d),d>i&&(i=d)),n===1/0)return;const s=.1*(o-n)||1,a=.1*(i-r)||1;return{xExtent:[n-s,o+s],yExtent:[r-a,i+a]}},[oe,c,u,h,d]),se=(0,Ru.useMemo)(()=>{if(!v||0===oe.length)return;const e=oe.map(e=>"function"==typeof v?v(e):e[v]).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0!==e.length?A(e):void 0},[oe,v]),ae=(0,Ru.useMemo)(()=>"function"==typeof c?c:e=>+e[c],[c]),le=(0,Ru.useMemo)(()=>"function"==typeof u?u:e=>+e[u],[u]),ce=(0,Ru.useMemo)(()=>e=>{const t=ae(e),n=le(e),o=null!=h?t>=h:void 0,r=null!=d?n>=d:void 0;return void 0===r||void 0===o?z||Cl:r&&o?ne.topRight.color:r&&!o?ne.topLeft.color:!r&&o?ne.bottomRight.color:ne.bottomLeft.color},[ae,le,h,d,ne,z]),ue=(0,Ru.useMemo)(()=>v?e=>qe(e,v,k,se):void 0,[v,k,se]),he=(0,Ru.useMemo)(()=>lc(c,u),[c,u]),de=Gc({colorBy:g,colorScale:re.colorScale,color:z,pointRadius:w,fillOpacity:S,radiusFn:ue,fallbackFill:ce,stroke:H,strokeWidth:E,opacity:$,styleRules:b,ruleContext:he,effectiveSelectionHook:re.effectiveSelectionHook,resolvedSelection:re.resolvedSelection}),fe=(0,Ru.useMemo)(()=>{if(!oe.length)return;const e=new Set;"string"==typeof c&&e.add(c),"string"==typeof u&&e.add(u),"string"==typeof g&&e.add(g),"string"==typeof v&&e.add(v);const t=oe[0];for(const n of Object.keys(t))if(!n.startsWith("_")&&!e.has(n)&&"string"==typeof t[n])return n},[oe,c,u,g,v]),pe=(0,Ru.useMemo)(()=>Aa([...fe?[{label:fe,accessor:fe,role:"title"}]:[],{label:ee||xa(c),accessor:c,role:"x",format:a},{label:te||xa(u),accessor:u,role:"y",format:l},...g?[{label:xa(g),accessor:g,role:"color"}]:[],...v?[{label:xa(v),accessor:v,role:"size"}]:[]]),[fe,c,u,ee,te,g,v,a,l]),ye=ec({componentName:"QuadrantChart",data:r,accessors:{xAccessor:c,yAccessor:u}}),me=(0,Ru.useMemo)(()=>{const e={stroke:p.stroke||"#999",strokeWidth:p.strokeWidth??1,dashArray:p.strokeDasharray||[]};return[(t,n,o,r)=>{if(!o?.x||!o?.y)return;const i=r.width,s=r.height,a=null!=h?o.x(h):i/2,l=null!=d?o.y(d):s/2;if(null!=h&&!isFinite(a))return;if(null!=d&&!isFinite(l))return;const c=Math.max(0,Math.min(i,a)),u=Math.max(0,Math.min(s,l)),f=[{config:ne.topLeft,x:0,y:0,w:c,h:u},{config:ne.topRight,x:c,y:0,w:i-c,h:u},{config:ne.bottomLeft,x:0,y:u,w:c,h:s-u},{config:ne.bottomRight,x:c,y:u,w:i-c,h:s-u}];for(const e of f)e.w>0&&e.h>0&&(t.fillStyle=e.config.color,t.globalAlpha=e.config.opacity??.08,t.fillRect(e.x,e.y,e.w,e.h));t.globalAlpha=1,t.strokeStyle=e.stroke,t.lineWidth=e.strokeWidth,e.dashArray.length>0&&t.setLineDash(e.dashArray),t.beginPath(),t.moveTo(c,0),t.lineTo(c,s),t.stroke(),t.beginPath(),t.moveTo(0,u),t.lineTo(i,u),t.stroke(),t.setLineDash([])}]},[h,d,ne,p]),ge=(0,Ru.useMemo)(()=>y?[...me,(e,t,n,o)=>{if(!n?.x||!n?.y)return;const r=o.width,i=o.height,s=null!=h?n.x(h):r/2,a=null!=d?n.y(d):i/2;(null==h||isFinite(s))&&(null==d||isFinite(a))&&(e.font=`600 ${m}px sans-serif`,e.globalAlpha=.5,e.fillStyle=ne.topLeft.color,e.textAlign="left",e.textBaseline="top",e.fillText(ne.topLeft.label,8,8),e.fillStyle=ne.topRight.color,e.textAlign="right",e.textBaseline="top",e.fillText(ne.topRight.label,r-8,8),e.fillStyle=ne.bottomLeft.color,e.textAlign="left",e.textBaseline="bottom",e.fillText(ne.bottomLeft.label,8,i-8),e.fillStyle=ne.bottomRight.color,e.textAlign="right",e.textBaseline="bottom",e.fillText(ne.bottomRight.label,r-8,i-8),e.globalAlpha=1)}]:me,[me,y,m,ne,h,d]),xe=(0,Ru.useMemo)(()=>{const e=_.canvasPreRenderers||[];return[...ge,...e]},[ge,_.canvasPreRenderers]),be=(0,Ru.useMemo)(()=>{const e={stroke:p.stroke||"#999",strokeWidth:p.strokeWidth??1,dashArray:p.strokeDasharray?Array.isArray(p.strokeDasharray)?p.strokeDasharray.join(","):p.strokeDasharray:void 0};return[(t,n,o)=>{if(!n?.x||!n?.y)return null;const r=o.width,i=o.height,s=null!=h?n.x(h):r/2,a=null!=d?n.y(d):i/2;if(null!=h&&!isFinite(s))return null;if(null!=d&&!isFinite(a))return null;const l=Math.max(0,Math.min(r,s)),c=Math.max(0,Math.min(i,a));return(0,Nu.jsxs)(Nu.Fragment,{children:[[{config:ne.topLeft,x:0,y:0,w:l,h:c},{config:ne.topRight,x:l,y:0,w:r-l,h:c},{config:ne.bottomLeft,x:0,y:c,w:l,h:i-c},{config:ne.bottomRight,x:l,y:c,w:r-l,h:i-c}].map((e,t)=>e.w>0&&e.h>0?(0,Nu.jsx)("rect",{x:e.x,y:e.y,width:e.w,height:e.h,fill:e.config.color,opacity:e.config.opacity??.08},"qf-"+t):null),(0,Nu.jsx)("line",{x1:l,y1:0,x2:l,y2:i,stroke:e.stroke,strokeWidth:e.strokeWidth,strokeDasharray:e.dashArray}),(0,Nu.jsx)("line",{x1:0,y1:c,x2:r,y2:c,stroke:e.stroke,strokeWidth:e.strokeWidth,strokeDasharray:e.dashArray}),y&&(0,Nu.jsxs)(Nu.Fragment,{children:[(0,Nu.jsx)("text",{x:8,y:8+m,fill:ne.topLeft.color,fontWeight:600,fontSize:m,opacity:.5,children:ne.topLeft.label}),(0,Nu.jsx)("text",{x:r-8,y:8+m,fill:ne.topRight.color,fontWeight:600,fontSize:m,opacity:.5,textAnchor:"end",children:ne.topRight.label}),(0,Nu.jsx)("text",{x:8,y:i-8,fill:ne.bottomLeft.color,fontWeight:600,fontSize:m,opacity:.5,children:ne.bottomLeft.label}),(0,Nu.jsx)("text",{x:r-8,y:i-8,fill:ne.bottomRight.color,fontWeight:600,fontSize:m,opacity:.5,textAnchor:"end",children:ne.bottomRight.label})]})]})}]},[h,d,ne,p,y,m]);if(re.earlyReturn)return re.earlyReturn;const ve={chartType:"scatter",...null!=r&&{data:oe},xAccessor:c,yAccessor:u,colorAccessor:g||void 0,sizeAccessor:v||void 0,sizeRange:k,pointStyle:de,colorScheme:x,size:[Y,q],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:re.margin,showAxes:o.showAxes,xLabel:ee,yLabel:te,xFormat:a,yFormat:l,enableHover:G,showGrid:V,...ie&&{xExtent:ie.xExtent,yExtent:ie.yExtent},...re.legendBehaviorProps,...K&&{title:K},...Q&&{description:Q},...Z&&{summary:Z},...void 0!==J&&{accessibleTable:J},...s&&{className:s},...null!=e.animate&&{animate:e.animate},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},tooltipContent:!1===C?()=>null:!0===C||void 0===C?pe:gs(C)||pe,...xc({linkedHover:P,selection:R,onObservation:L,onClick:I,hoverHighlight:T,mobileInteraction:re.mobileInteraction,customHoverBehavior:re.customHoverBehavior,customClickBehavior:re.customClickBehavior}),...M&&{pointIdAccessor:M},...j&&j.length>0&&{annotations:j},canvasPreRenderers:xe,...re.crosshairProps,..._,...xe.length>0&&{canvasPreRenderers:xe},svgPreRenderers:be};return ye?(0,Nu.jsx)(zl,{componentName:"QuadrantChart",message:ye,width:Y,height:q}):(0,Nu.jsx)(Gl,{componentName:"QuadrantChart",width:Y,height:q,children:(0,Nu.jsx)(Da,{ref:n,...ve})})});Ou.displayName="QuadrantChart";var Bu=y(require("react")),Du=require("react"),Wu=require("react/jsx-runtime"),zu="__ma_unitized",Hu="__ma_series";function Eu(e,t){const n=t[1]-t[0];return 0===n?.5:(e-t[0])/n}function $u(e,t){return t[0]+e*(t[1]-t[0])}var Yu=(0,Du.forwardRef)(function(e,t){const n=(0,Du.useRef)(null),o=(0,Du.useRef)([]),r=(0,Du.useRef)(e.series);r.current=e.series,(0,Du.useImperativeHandle)(t,()=>{const e=()=>(r.current??[]).filter(e=>null!=e&&"object"==typeof e);return{push:t=>{if(!n.current)return;const r=e(),i=t;for(let e=0;r.length>e&&2>e;e++){const t=r[e],s=t.extent||o.current[e];if(!s)continue;const a=("function"==typeof t.yAccessor?t.yAccessor:e=>e[t.yAccessor])(i);null!=a&&isFinite(a)&&n.current.push({...i,[zu]:Eu(a,s),[Hu]:t.label||"Series "+(e+1)})}},pushMany:t=>{if(!n.current)return;const r=e(),i=[];for(const e of t)for(let t=0;r.length>t&&2>t;t++){const n=r[t],s=n.extent||o.current[t];if(!s)continue;const a=("function"==typeof n.yAccessor?n.yAccessor:e=>e[n.yAccessor])(e);null!=a&&isFinite(a)&&i.push({...e,[zu]:Eu(a,s),[Hu]:n.label||"Series "+(t+1)})}n.current.pushMany(i)},remove:e=>n.current?.remove(e)??[],update:(e,t)=>n.current?.update(e,t)??[],clear:()=>n.current?.clear(),getData:()=>n.current?.getData()??[],getScales:()=>n.current?.getScales()??null}},[]);const i=Bl(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,accessibleTable:e.accessibleTable,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:800,height:400}),{data:s,margin:a,className:l,xFormat:c,xAccessor:u="x",series:h,colorScheme:d,curve:f="monotoneX",lineWidth:p=2,tooltip:y,annotations:m,frameProps:g={},selection:x,linkedHover:b,onObservation:v,onClick:k,hoverHighlight:w,chartId:A,loading:S,loadingContent:C,emptyContent:M,legendInteraction:j,legendPosition:_,stroke:R,strokeWidth:P,opacity:L}=e,{width:I,height:T,enableHover:N,showGrid:F,showLegend:O=!0,title:B,description:D,summary:W,accessibleTable:z,xLabel:H}=i,E=(0,Du.useMemo)(()=>X(s),[s]),$=(0,Du.useMemo)(()=>X(h),[h]),Y=$,q=2===$.length;"undefined"==typeof process||"production"===process.env?.NODE_ENV||q||console.warn(`[MultiAxisLineChart] Expected exactly 2 series for dual-axis mode, got ${$.length}. Rendering as a standard multi-line chart.`);const G=Kl(S,I,T,C),V=G?null:Ul(s,I,T,M),U=Pl(),K=(0,Du.useMemo)(()=>{let e;if(Array.isArray(d))e=d;else if(U&&U.length>0)e=U;else{const t=De[d];e=Array.isArray(t)?t:We}return Y.map((t,n)=>t.color||e[n%e.length])},[Y,d,U]),Q=(0,Du.useMemo)(()=>$.map((e,t)=>e.label||"Series "+(t+1)),[$]),{unitizedData:Z,extents:J}=(0,Du.useMemo)(()=>{if(0===E.length){const e=$.map(e=>e.extent||null).filter(Boolean);return e.length===$.length&&(o.current=e),{unitizedData:[],extents:e.length===$.length?e:[]}}const e=$.map(e=>e.extent||function(e,t){let n=1/0,o=-1/0;const r="function"==typeof t?t:e=>e[t];for(const t of e){const e=r(t);null!=e&&isFinite(e)&&(n>e&&(n=e),e>o&&(o=e))}if(!isFinite(n)||!isFinite(o))return[0,1];if(n===o){const e=0===n?1:.1*Math.abs(n);return[n-e,o+e]}return[n,o]}(E,e.yAccessor));if(o.current=e,!q){const t=[];for(const e of E)for(let n=0;$.length>n;n++){const o=$[n],r=("function"==typeof o.yAccessor?o.yAccessor:e=>e[o.yAccessor])(e);null!=r&&t.push({...e,[zu]:r,[Hu]:Q[n]})}return{unitizedData:t,extents:e}}const t=[];for(const n of E)for(let o=0;2>o;o++){const r=$[o],i=("function"==typeof r.yAccessor?r.yAccessor:e=>e[r.yAccessor])(n);null!=i&&t.push({...n,[zu]:Eu(i,e[o]),[Hu]:Q[o]})}return{unitizedData:t,extents:e}},[E,$,q,Q]),ee=(0,Du.useMemo)(()=>{if(q&&J.length>=2)return[{orient:"left",label:Q[0],tickFormat:$[0].format||(e=>{const t=$u(e,J[0]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"right",label:Q[1],tickFormat:$[1].format||(e=>{const t=$u(e,J[1]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"bottom"}]},[q,J,$,Q]),te=rc({data:(0,Du.useMemo)(()=>Z.length>0?Z:Q.map(e=>({[Hu]:e})),[Z,Q]),rawData:s,colorBy:Hu,colorScheme:K,legendInteraction:j,legendPosition:_,selection:x,linkedHover:b,fallbackFields:[Hu],unwrapData:!1,onObservation:v,onClick:k,hoverHighlight:w,mobileInteraction:i.mobileInteraction,mobileSemantics:i.mobileSemantics,chartType:"MultiAxisLineChart",chartId:A,showLegend:O,userMargin:a,marginDefaults:q?{...i.marginDefaults,left:70,right:70}:i.marginDefaults,loading:S,loadingContent:C,emptyContent:M,width:I,height:T}),ne=(0,Du.useMemo)(()=>{const e=new Map;return Q.forEach((t,n)=>e.set(t,K[n])),e},[Q,K]),oe=pc({lineWidth:p,resolveStroke:(0,Du.useCallback)(e=>ne.get(e[Hu])||K[0],[ne,K]),stroke:R,strokeWidth:P,opacity:L,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection}),re=(0,Du.useMemo)(()=>{if(!1===y)return()=>null;return gs(y)||(e=>{const t=e.data||e,n=t[Hu],o=Q.indexOf(n),r=t[zu],i=q&&o>=0&&J[o]?$u(r,J[o]):r,s=o>=0&&$[o]?.format?$[o].format:e=>Number.isInteger(e)?e+"":e.toFixed(2),a="function"==typeof u?u(t):t[u];return Bu.createElement("div",{style:{padding:"6px 10px",fontFamily:"var(--semiotic-font-family, sans-serif)",fontSize:"var(--semiotic-tooltip-font-size, 13px)"}},Bu.createElement("div",{style:{fontWeight:600,marginBottom:4,color:K[o]||"inherit"}},n),Bu.createElement("div",null,`${"string"==typeof u?u:"x"}: ${a}`),Bu.createElement("div",null,`${n}: ${s(i)}`))})},[y,Q,K,J,q,$,u]);if(te.earlyReturn)return te.earlyReturn;const ie=ec({componentName:"MultiAxisLineChart",data:s,accessors:{xAccessor:u}}),se=q?[0,1]:void 0,ae={chartType:"line",...null!=s&&{data:Z},xAccessor:u,yAccessor:zu,groupAccessor:Hu,lineStyle:oe,colorScheme:K,size:[I,T],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:te.margin,showAxes:i.showAxes,...ee&&{axes:ee},xLabel:H,...q?{}:{yLabel:Q[0]},xFormat:c,...q&&se&&{yExtent:se},enableHover:N,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:F,curve:f,...te.legendBehaviorProps,...B&&{title:B},...D&&{description:D},...W&&{summary:W},...void 0!==z&&{accessibleTable:z},...l&&{className:l},...null!=e.animate&&{animate:e.animate},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},tooltipContent:re,...m&&{annotations:m},...xc({linkedHover:b,selection:x,onObservation:v,onClick:k,hoverHighlight:w,mobileInteraction:te.mobileInteraction,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior}),...te.crosshairProps,...g};return G||V||(ie?(0,Wu.jsx)(zl,{componentName:"MultiAxisLineChart",message:ie,width:I,height:T}):(0,Wu.jsx)(Gl,{componentName:"MultiAxisLineChart",width:I,height:T,children:(0,Wu.jsx)(Da,{ref:n,...ae})}))});Yu.displayName="MultiAxisLineChart";var qu=require("react");function Gu(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}var Vu=require("react/jsx-runtime"),Xu=(0,qu.forwardRef)(function(e,t){const n=(0,qu.useRef)(null);mc(t,{variant:"xy",frameRef:n});const o=Bl(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",highAccessor:u="high",lowAccessor:h="low",openAccessor:d,closeAccessor:f,candlestickStyle:p,tooltip:y,annotations:m,xExtent:g,yExtent:x,frameProps:b={},selection:v,linkedHover:k,onObservation:w,onClick:A,chartId:S,loading:C,loadingContent:M,emptyContent:j}=e,{width:_,height:R,enableHover:P,showGrid:L,title:I,description:T,summary:N,accessibleTable:F,xLabel:O,yLabel:B}=o,D=Kl(C,_,R,M),W=D?null:Ul(r,_,R,j),z=(0,qu.useMemo)(()=>X(r),[r]),H=null==d||null==f;Ql("CandlestickChart",z,"xAccessor",c),Ql("CandlestickChart",z,"highAccessor",u),Ql("CandlestickChart",z,"lowAccessor",h),H||(Ql("CandlestickChart",z,"openAccessor",d),Ql("CandlestickChart",z,"closeAccessor",f));const{customHoverBehavior:E,customClickBehavior:$,crosshairSourceId:Y}=Il({selection:v,linkedHover:k,onObservation:w,onClick:A,chartType:"CandlestickChart",chartId:S,mobileInteraction:o.mobileInteraction}),q=Tl(k,Y),G=(0,qu.useMemo)(()=>{const t=o.marginDefaults,n="sparkline"===e.mode?{...t,top:0,bottom:0}:t;return null==i?n:{...n,...Gu(i)}},[i,o.marginDefaults,e.mode]),V=(0,qu.useMemo)(()=>{const e=[{label:O||xa(c),accessor:c,role:"x",format:a}];return H?(e.push({label:"High",accessor:u,role:"y",format:l}),e.push({label:"Low",accessor:h,format:l})):(e.push({label:"Open",accessor:d,format:l}),e.push({label:"High",accessor:u,format:l}),e.push({label:"Low",accessor:h,format:l}),e.push({label:"Close",accessor:f,format:l})),Aa(e)},[c,O,a,l,u,h,d,f,H]),U=ec({componentName:"CandlestickChart",data:r,accessors:{xAccessor:c,highAccessor:u,lowAccessor:h,...!H&&{openAccessor:d,closeAccessor:f}}}),K={chartType:"candlestick",...null!=r&&{data:z},xAccessor:c,yAccessor:u,highAccessor:u,lowAccessor:h,...!H&&{openAccessor:d,closeAccessor:f},...p&&{candlestickStyle:p},scalePadding:Math.max(2,Math.min(12,Math.round(_/40))),extentPadding:_>200?.1:.02,size:[_,R],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:G,showAxes:o.showAxes,xLabel:O,yLabel:B,xFormat:a,yFormat:l,enableHover:P,showGrid:L,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...gc({title:I,description:T,summary:N,accessibleTable:F,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...bc({tooltip:y,defaultTooltipContent:V}),...xc({linkedHover:k,selection:v,onObservation:w,onClick:A,mobileInteraction:o.mobileInteraction,customHoverBehavior:E,customClickBehavior:$}),...m&&m.length>0&&{annotations:m},...g&&{xExtent:g},...x&&{yExtent:x},...q,...b};return D||W||(U?(0,Vu.jsx)(zl,{componentName:"CandlestickChart",message:U,width:_,height:R}):(0,Vu.jsx)(Gl,{componentName:"CandlestickChart",width:_,height:R,children:(0,Vu.jsx)(Da,{ref:n,...K})}))});Xu.displayName="CandlestickChart";var Uu=require("react"),Ku=require("react");var Qu=require("react/jsx-runtime"),Zu=(0,Uu.forwardRef)(function(e,t){const{data:n,layout:o,layoutConfig:r,onLayoutError:i,xExtent:s,yExtent:a,showAxes:l=!1,margin:c,className:u,annotations:h,onObservation:d,onClick:f,selection:p,linkedHover:y,chartId:m,loading:g,loadingContent:x,emptyContent:b,colorBy:v,colorScheme:k,frameProps:w={}}=e,{frameRef:A,resolved:S,safeData:C,setup:M,earlyReturn:j}=function(e){const t=function(e){const t=(0,Ku.useRef)(null);return mc(e.imperativeRef,{variant:e.imperativeVariant,frameRef:t}),{frameRef:t,resolved:Bl(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),normalizedMargin:(0,Ku.useMemo)(()=>Gu(e.margin),[e.margin])}}(e),{resolved:n,normalizedMargin:o}=t,r=rc({data:e.data??[],rawData:e.data,colorBy:e.colorBy,colorScheme:e.colorScheme,legendInteraction:void 0,selection:e.selection,linkedHover:e.linkedHover,fallbackFields:"string"==typeof e.colorBy?[e.colorBy]:[],unwrapData:e.unwrapData,onObservation:e.onObservation,onClick:e.onClick,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,chartType:e.chartTypeLabel,chartId:e.chartId,showLegend:n.showLegend,userMargin:o,marginDefaults:n.marginDefaults,loading:e.loading,loadingContent:e.loadingContent,emptyContent:e.emptyContent,width:n.width,height:n.height});return{...t,safeData:r.data,setup:r,earlyReturn:r.earlyReturn}}({imperativeRef:t,imperativeVariant:"xy",chartTypeLabel:"XYCustomChart",unwrapData:!1,data:n,colorBy:v,colorScheme:k,selection:p,linkedHover:y,onObservation:d,onClick:f,chartId:m,loading:g,loadingContent:x,emptyContent:b,margin:c,width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,mode:e.mode,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules,xLabel:e.xLabel,yLabel:e.yLabel}),_=M.effectiveSelectionHook,R=(0,Uu.useMemo)(()=>_?.isActive?{isActive:!0,predicate:_.predicate}:null,[_?.isActive,_?.predicate]);if(j)return j;const{width:P,height:L,enableHover:I,showGrid:T,title:N,description:F,summary:O,accessibleTable:B,xLabel:D,yLabel:W}=S,z={chartType:"custom",...null!=n&&{data:C},customLayout:o,layoutConfig:r,onLayoutError:i,...R&&{layoutSelection:R},xExtent:s,yExtent:a,colorAccessor:v,colorScheme:k,size:[P,L],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:M.margin,showAxes:l,xLabel:D,yLabel:W,enableHover:I,showGrid:T,...M.legendBehaviorProps,...gc({title:N,description:F,summary:O,accessibleTable:B,className:u,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...null!=e.tooltip&&{tooltipContent:e.tooltip},...xc({linkedHover:y,selection:p,onObservation:d,onClick:f,hoverHighlight:!1,mobileInteraction:M.mobileInteraction,customHoverBehavior:M.customHoverBehavior,customClickBehavior:M.customClickBehavior}),...h&&h.length>0&&{annotations:h},...M.crosshairProps,...w};return(0,Qu.jsx)(Gl,{componentName:"XYCustomChart",width:P,height:L,children:(0,Qu.jsx)(Da,{ref:A,...z})})});Zu.displayName="XYCustomChart";var Ju={fill:"rgba(0,0,0,0)",stroke:"rgba(0,0,0,0)",opacity:0},eh=8;function th(e){return null==e?void 0:e+""}function nh(e){const t=th(e.id);return{type:"point",x:e.x,y:e.y,r:e.r??eh,style:{...Ju},datum:e.datum,pointId:t,_transitionKey:t}}function oh(e){return{type:"rect",x:e.x,y:e.y,w:e.width,h:e.height,style:{...Ju},datum:e.datum,group:e.group,_transitionKey:th(e.id)}}