semiotic 3.8.9 → 3.9.1

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 (502) hide show
  1. package/README.md +55 -81
  2. package/agent-skill/semiotic-charts/SKILL.md +11 -2
  3. package/ai/behaviorContracts.cjs +33 -3
  4. package/ai/cli.js +53 -2
  5. package/ai/componentMetadata.cjs +15 -0
  6. package/ai/dist/mcp-server.js +1530 -611
  7. package/ai/examples.md +48 -42
  8. package/{CLAUDE.md → ai/reference.md} +43 -22
  9. package/ai/schema.json +10603 -986
  10. package/ai/surface-manifest.json +643 -2
  11. package/ai/system-prompt.md +83 -130
  12. package/dist/c-3BLJEQNG.min.js +1 -0
  13. package/dist/c-3KZD6AXJ.min.js +1 -0
  14. package/dist/c-4TWEX5HG.min.js +1 -0
  15. package/dist/c-52TEGIUJ.min.js +1 -0
  16. package/dist/c-5YCIX3VZ.min.js +1 -0
  17. package/dist/c-6FEKTA3U.min.js +1 -0
  18. package/dist/c-6O5EVOPH.min.js +1 -0
  19. package/dist/c-74HEEZGK.min.js +1 -0
  20. package/dist/c-AKAF6JAD.min.js +1 -0
  21. package/dist/c-BBKITSXB.min.js +1 -0
  22. package/dist/c-BWNB6USU.min.js +1 -0
  23. package/dist/c-C25ENHIK.min.js +1 -0
  24. package/dist/c-CDR5AO3R.min.js +1 -0
  25. package/dist/c-COHXCW3Q.min.js +1 -0
  26. package/dist/{chunk-scatterplotMatrixBrushOverlay-SDIZSN66.module.min.js → c-DADXPJXV.min.js} +0 -1
  27. package/dist/c-E3JFRRMI.min.js +1 -0
  28. package/dist/c-EBFPQHHO.min.js +1 -0
  29. package/dist/c-G36WS6LN.min.js +1 -0
  30. package/dist/c-GIKRQI4X.min.js +1 -0
  31. package/dist/c-GPYOFETM.min.js +1 -0
  32. package/dist/c-IDUHYYSI.min.js +1 -0
  33. package/dist/{chunk-chunk-FQPKOAIH.module.min.js → c-IUHFPMHD.min.js} +0 -1
  34. package/dist/c-J5G56TUH.min.js +1 -0
  35. package/dist/c-JAZ73J32.min.js +1 -0
  36. package/dist/c-KG3NXHAL.min.js +1 -0
  37. package/dist/c-KII3PLZE.min.js +1 -0
  38. package/dist/c-LIXGXMNS.min.js +1 -0
  39. package/dist/c-LVEY6D6B.min.js +1 -0
  40. package/dist/c-M4Y3BHFR.min.js +1 -0
  41. package/dist/c-MAIICR2Z.min.js +1 -0
  42. package/dist/c-MG5DM6VE.min.js +1 -0
  43. package/dist/{chunk-minimapBrushOverlay-JU57U7NM.module.min.js → c-MNF2S4AA.min.js} +0 -1
  44. package/dist/c-MT3WBK7M.min.js +1 -0
  45. package/dist/c-NY3JWV2K.min.js +1 -0
  46. package/dist/c-O6U6K4CW.min.js +1 -0
  47. package/dist/c-OCI56QF2.min.js +1 -0
  48. package/dist/c-OQ7M4AGV.min.js +1 -0
  49. package/dist/c-OXYMVK7Q.min.js +1 -0
  50. package/dist/c-PPWDL5ZI.min.js +1 -0
  51. package/dist/c-QHF5YON3.min.js +1 -0
  52. package/dist/c-RR3GO5SW.min.js +1 -0
  53. package/dist/{chunk-chunk-J5QD4RAM.module.min.js → c-RSVIHIQ4.min.js} +0 -1
  54. package/dist/{chunk-chunk-EMO5NUGE.module.min.js → c-S2BXNNJN.min.js} +0 -1
  55. package/dist/{chunk-chunk-YCQYG6J5.module.min.js → c-SLGMUBUL.min.js} +0 -1
  56. package/dist/c-SUILCHWU.min.js +1 -0
  57. package/dist/c-TZW3JGJ5.min.js +1 -0
  58. package/dist/c-US5ZFT6E.min.js +1 -0
  59. package/dist/{chunk-chunk-RZH7VZYS.module.min.js → c-USFMFKIH.min.js} +0 -1
  60. package/dist/c-UUKVD4WB.min.js +1 -0
  61. package/dist/{chunk-chunk-SV4XAZ3Q.module.min.js → c-VGW3VG3I.min.js} +0 -1
  62. package/dist/c-W3CE4A4S.min.js +1 -0
  63. package/dist/{chunk-chunk-2NVFEB7P.module.min.js → c-WJCD5EUY.min.js} +0 -1
  64. package/dist/{chunk-chunk-2JGJ5GUG.module.min.js → c-X5UBGU2V.min.js} +0 -1
  65. package/dist/c-YDAY2WFR.min.js +1 -0
  66. package/dist/c-ZOWWU34K.min.js +1 -0
  67. package/dist/components/AccessibleNavTree.d.ts +1 -1
  68. package/dist/components/CategoryColors.d.ts +1 -1
  69. package/dist/components/GradientLegend.d.ts +14 -0
  70. package/dist/components/Legend.d.ts +2 -7
  71. package/dist/components/LinkedCharts.d.ts +1 -1
  72. package/dist/components/MobileAnnotationCalloutList.d.ts +1 -1
  73. package/dist/components/ObservationReadout.d.ts +45 -0
  74. package/dist/components/ThemeProvider.d.ts +4 -4
  75. package/dist/components/Tooltip/FlippingTooltip.d.ts +5 -7
  76. package/dist/components/Tooltip/Tooltip.d.ts +30 -5
  77. package/dist/components/Tooltip/tooltipChrome.d.ts +43 -0
  78. package/dist/components/ai/chartCapabilityTypes.d.ts +86 -2
  79. package/dist/components/ai/chartClinic.d.ts +2 -0
  80. package/dist/components/ai/deriveProfileFields.d.ts +40 -0
  81. package/dist/components/ai/evaluateChart.d.ts +85 -0
  82. package/dist/components/ai/fieldPolicy.d.ts +7 -0
  83. package/dist/components/ai/fieldRoles.d.ts +24 -0
  84. package/dist/components/ai/generativeChart.d.ts +18 -2
  85. package/dist/components/ai/inferIntent.d.ts +26 -2
  86. package/dist/components/ai/intents.d.ts +35 -0
  87. package/dist/components/ai/navigationTree.d.ts +2 -2
  88. package/dist/components/ai/observedSceneAudit.d.ts +2 -1
  89. package/dist/components/ai/profileData.d.ts +11 -0
  90. package/dist/components/ai/repairChartConfig.d.ts +2 -3
  91. package/dist/components/ai/semanticEvidence.d.ts +4 -0
  92. package/dist/components/ai/semanticViability.d.ts +11 -0
  93. package/dist/components/ai/semanticViabilityRegistry.d.ts +5 -0
  94. package/dist/components/ai/streamingTypes.d.ts +4 -0
  95. package/dist/components/ai/suggestCharts.d.ts +5 -6
  96. package/dist/components/ai/suggestDashboard.d.ts +2 -3
  97. package/dist/components/ai/suggestStreamCharts.d.ts +1 -1
  98. package/dist/components/ai/suggestStretchCharts.d.ts +2 -3
  99. package/dist/components/ai/suggestionPropContracts.d.ts +20 -0
  100. package/dist/components/ai/variantDiscovery.d.ts +3 -1
  101. package/dist/components/charts/custom/NetworkCustomChart.d.ts +3 -0
  102. package/dist/components/charts/custom/OrdinalCustomChart.d.ts +3 -0
  103. package/dist/components/charts/custom/XYCustomChart.d.ts +1 -1
  104. package/dist/components/charts/geo/ChoroplethMap.d.ts +3 -1
  105. package/dist/components/charts/geo/DistanceCartogram.d.ts +2 -7
  106. package/dist/components/charts/geo/cartogramOverlay.d.ts +28 -0
  107. package/dist/components/charts/index.d.ts +4 -3
  108. package/dist/components/charts/network/ProcessSankey.d.ts +2 -136
  109. package/dist/components/charts/network/ProcessSankeyProps.d.ts +139 -0
  110. package/dist/components/charts/network/Treemap.d.ts +2 -1
  111. package/dist/components/charts/network/processSankey/boundaryHubOrdering.d.ts +23 -0
  112. package/dist/components/charts/network/processSankey/layoutGeometry.d.ts +2 -0
  113. package/dist/components/charts/network/processSankey/ordering.d.ts +3 -41
  114. package/dist/components/charts/network/processSankey/orderingTypes.d.ts +32 -0
  115. package/dist/components/charts/network/processSankey/packing.d.ts +1 -1
  116. package/dist/components/charts/network/processSankey/packingCache.d.ts +1 -1
  117. package/dist/components/charts/network/processSankey/packingOptimization.d.ts +72 -0
  118. package/dist/components/charts/ordinal/BarChart.d.ts +4 -3
  119. package/dist/components/charts/ordinal/FunnelChart.d.ts +2 -0
  120. package/dist/components/charts/ordinal/GroupedBarChart.d.ts +3 -2
  121. package/dist/components/charts/ordinal/StackedBarChart.d.ts +4 -3
  122. package/dist/components/charts/ordinal/SwimlaneChart.d.ts +2 -2
  123. package/dist/components/charts/physics/GaltonBoardChart.d.ts +2 -9
  124. package/dist/components/charts/physics/GauntletChart.d.ts +10 -41
  125. package/dist/components/charts/physics/ProcessFlowChart.d.ts +1 -1
  126. package/dist/components/charts/physics/chainReactionAccessibleTable.d.ts +9 -0
  127. package/dist/components/charts/physics/chainReactionRuntime.d.ts +2 -1
  128. package/dist/components/charts/physics/chainReactionTypes.d.ts +5 -1
  129. package/dist/components/charts/physics/crucibleBodyRenderers.d.ts +2 -2
  130. package/dist/components/charts/physics/crucibleClone.d.ts +6 -0
  131. package/dist/components/charts/physics/crucibleEffects.d.ts +1 -2
  132. package/dist/components/charts/physics/crucibleRecord.d.ts +7 -0
  133. package/dist/components/charts/physics/gauntletChrome.d.ts +4 -4
  134. package/dist/components/charts/physics/gauntletPhysics.d.ts +1 -0
  135. package/dist/components/charts/physics/gauntletPublic.d.ts +4 -0
  136. package/dist/components/charts/physics/packetFlowOverlay.d.ts +7 -0
  137. package/dist/components/charts/physics/physicsChartLayout.d.ts +8 -0
  138. package/dist/components/charts/physics/physicsChartShared.d.ts +3 -1
  139. package/dist/components/charts/physics/physicsChartUtils.d.ts +1 -1
  140. package/dist/components/charts/physics/physicsHocUtils.d.ts +25 -12
  141. package/dist/components/charts/physics/physicsProjectionOverlays.d.ts +24 -0
  142. package/dist/components/charts/physics/processFlowOverlays.d.ts +9 -0
  143. package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +15 -12
  144. package/dist/components/charts/realtime/RealtimeHistogram.d.ts +10 -7
  145. package/dist/components/charts/realtime/RealtimeLineChart.d.ts +35 -14
  146. package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +21 -14
  147. package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +20 -13
  148. package/dist/components/charts/realtime/aggregate.d.ts +4 -1
  149. package/dist/components/charts/realtime/eventTime.d.ts +4 -0
  150. package/dist/components/charts/realtime/realtimeChartRuntime.d.ts +27 -0
  151. package/dist/components/charts/realtime/realtimeChartTypes.d.ts +30 -0
  152. package/dist/components/charts/realtime/useRealtimeCategoryColors.d.ts +30 -0
  153. package/dist/components/charts/shared/FrameTextAnnotationSVG.d.ts +10 -0
  154. package/dist/components/charts/shared/annotationActivation.d.ts +3 -7
  155. package/dist/components/charts/shared/annotationBandFill.d.ts +6 -0
  156. package/dist/components/charts/shared/annotationDispatch.d.ts +31 -0
  157. package/dist/components/charts/shared/annotationIdentity.d.ts +8 -0
  158. package/dist/components/charts/shared/annotationRules.d.ts +1 -15
  159. package/dist/components/charts/shared/boundedCategoryRegistry.d.ts +8 -0
  160. package/dist/components/charts/shared/chainReactionChartSpec.d.ts +3 -0
  161. package/dist/components/charts/shared/chartMode.d.ts +3 -2
  162. package/dist/components/charts/shared/chartSpecCore.d.ts +1 -0
  163. package/dist/components/charts/shared/frameTextAnnotation.d.ts +63 -0
  164. package/dist/components/charts/shared/gradient.d.ts +16 -0
  165. package/dist/components/charts/shared/hatchFill.d.ts +15 -0
  166. package/dist/components/charts/shared/hooks.d.ts +4 -4
  167. package/dist/components/charts/shared/legendUtils.d.ts +1 -0
  168. package/dist/components/charts/shared/streamPropsHelpers.d.ts +2 -1
  169. package/dist/components/charts/shared/styleRules.d.ts +9 -2
  170. package/dist/components/charts/shared/styleRulesWireSchema.d.ts +353 -0
  171. package/dist/components/charts/shared/types.d.ts +18 -9
  172. package/dist/components/charts/shared/useChartLegend.d.ts +43 -9
  173. package/dist/components/charts/shared/useChartSetup.d.ts +3 -1
  174. package/dist/components/charts/shared/useCustomChartSetup.d.ts +5 -2
  175. package/dist/components/charts/shared/useNetworkChartSetup.d.ts +5 -1
  176. package/dist/components/charts/shared/useOrdinalBrush.d.ts +3 -3
  177. package/dist/components/charts/shared/useStreamingLegend.d.ts +6 -1
  178. package/dist/components/charts/value/types.d.ts +1 -1
  179. package/dist/components/charts/xy/BubbleChart.d.ts +1 -1
  180. package/dist/components/charts/xy/BumpChart.capability.d.ts +14 -1
  181. package/dist/components/charts/xy/BumpChart.d.ts +13 -73
  182. package/dist/components/charts/xy/BumpChart.semanticViability.d.ts +5 -0
  183. package/dist/components/charts/xy/CandlestickChart.d.ts +2 -2
  184. package/dist/components/charts/xy/LineChart.d.ts +2 -2
  185. package/dist/components/charts/xy/Scatterplot.d.ts +1 -1
  186. package/dist/components/charts/xy/bumpData.d.ts +44 -0
  187. package/dist/components/charts/xy/bumpIdentity.d.ts +2 -0
  188. package/dist/components/charts/xy/bumpLayout.d.ts +45 -0
  189. package/dist/components/charts/xy/bumpTooltip.d.ts +20 -0
  190. package/dist/components/legendLayout.d.ts +131 -4
  191. package/dist/components/realtime/ReorderBuffer.d.ts +2 -0
  192. package/dist/components/realtime/types.d.ts +10 -1
  193. package/dist/components/recipes/balanceSnapshotsToFlows.d.ts +42 -0
  194. package/dist/components/recipes/directedReachability.d.ts +14 -0
  195. package/dist/components/recipes/gofishDisplayListFixtures.generated.d.ts +6 -6
  196. package/dist/components/recipes/gridObservatory.d.ts +1 -1
  197. package/dist/components/recipes/networkAnalysis.d.ts +1 -18
  198. package/dist/components/recipes/physics.d.ts +7 -4
  199. package/dist/components/recipes/processPhysics.d.ts +0 -1
  200. package/dist/components/recipes/waffle.d.ts +7 -4
  201. package/dist/components/semiotic-ai-core.d.ts +13 -4
  202. package/dist/components/semiotic-ai-observations.d.ts +3 -0
  203. package/dist/components/semiotic-ai.d.ts +16 -9
  204. package/dist/components/semiotic-client-shared.d.ts +10 -0
  205. package/dist/components/semiotic-experimental.d.ts +1 -1
  206. package/dist/components/semiotic-geo.d.ts +4 -1
  207. package/dist/components/semiotic-network.d.ts +7 -4
  208. package/dist/components/semiotic-ordinal.d.ts +4 -1
  209. package/dist/components/semiotic-physics.d.ts +11 -4
  210. package/dist/components/semiotic-realtime-core.d.ts +11 -4
  211. package/dist/components/semiotic-realtime-react.d.ts +4 -3
  212. package/dist/components/semiotic-realtime.d.ts +3 -1
  213. package/dist/components/semiotic-recipes-core.d.ts +7 -5
  214. package/dist/components/semiotic-server-edge.d.ts +3 -2
  215. package/dist/components/semiotic-server.d.ts +3 -2
  216. package/dist/components/semiotic-themes-core.d.ts +5 -48
  217. package/dist/components/semiotic-utils-core.d.ts +10 -5
  218. package/dist/components/semiotic-utils-react.d.ts +2 -0
  219. package/dist/components/semiotic-utils.d.ts +1 -1
  220. package/dist/components/semiotic-xy.d.ts +4 -1
  221. package/dist/components/semiotic.d.ts +68 -26
  222. package/dist/components/server/animatedGif.d.ts +1 -1
  223. package/dist/components/server/renderEvidence.d.ts +25 -2
  224. package/dist/components/server/renderToStaticSVG.d.ts +15 -7
  225. package/dist/components/server/serverChartConfigShared.d.ts +8 -1
  226. package/dist/components/server/serverChartConfigs.d.ts +1 -0
  227. package/dist/components/server/serverChartConfigsNetwork.d.ts +3 -3
  228. package/dist/components/server/serverChartConfigsNetworkChord.d.ts +2 -0
  229. package/dist/components/server/serverChartConfigsNetworkForce.d.ts +2 -0
  230. package/dist/components/server/serverChartConfigsNetworkHierarchy.d.ts +3 -0
  231. package/dist/components/server/serverChartConfigsXY.d.ts +3 -3
  232. package/dist/components/server/serverChartConfigsXYBubble.d.ts +5 -0
  233. package/dist/components/server/serverChartConfigsXYBump.d.ts +7 -0
  234. package/dist/components/server/serverChartConfigsXYScatter.d.ts +5 -0
  235. package/dist/components/server/staticAnnotationFallbacks.d.ts +10 -0
  236. package/dist/components/server/staticAnnotations.d.ts +28 -1
  237. package/dist/components/server/staticAxisTickLabel.d.ts +13 -0
  238. package/dist/components/server/staticLegend.d.ts +1 -1
  239. package/dist/components/server/staticLegendMargin.d.ts +41 -0
  240. package/dist/components/server/staticOrdinal.d.ts +8 -2
  241. package/dist/components/server/staticPhysics.d.ts +13 -1
  242. package/dist/components/server/staticPhysicsChrome.d.ts +20 -0
  243. package/dist/components/server/staticRawLegend.d.ts +15 -0
  244. package/dist/components/server/staticSVGChrome.d.ts +16 -55
  245. package/dist/components/server/staticXYAxes.d.ts +27 -0
  246. package/dist/components/server/staticXYAxisTicks.d.ts +39 -0
  247. package/dist/components/server/staticXYGrid.d.ts +11 -0
  248. package/dist/components/server/themeResolver.d.ts +5 -1
  249. package/dist/components/store/ThemeStore.d.ts +2 -98
  250. package/dist/components/store/designTokens.d.ts +1 -1
  251. package/dist/components/store/themeCSSVariables.d.ts +10 -0
  252. package/dist/components/store/themeCore.d.ts +91 -0
  253. package/dist/components/store/themePresets.d.ts +81 -0
  254. package/dist/components/store/themeSerialization.d.ts +2 -1
  255. package/dist/components/stream/AccessibleDataTable.d.ts +12 -14
  256. package/dist/components/stream/AccessibleTablePortalImpl.d.ts +6 -0
  257. package/dist/components/stream/GeoTileRenderer.d.ts +2 -0
  258. package/dist/components/stream/NetworkCanvasHitTester.d.ts +3 -1
  259. package/dist/components/stream/NetworkSSRFrame.d.ts +2 -1
  260. package/dist/components/stream/NetworkSVGOverlay.d.ts +3 -31
  261. package/dist/components/stream/OrdinalCanvasHitTester.d.ts +2 -0
  262. package/dist/components/stream/SVGChartTitle.d.ts +9 -0
  263. package/dist/components/stream/SVGOverlay.d.ts +1 -21
  264. package/dist/components/stream/SVGUnderlay.d.ts +24 -0
  265. package/dist/components/stream/SceneToSVG.d.ts +1 -1
  266. package/dist/components/stream/StreamGeoFrame.d.ts +1 -1
  267. package/dist/components/stream/StreamOrdinalFrame.d.ts +1 -1
  268. package/dist/components/stream/StreamXYFrame.d.ts +1 -1
  269. package/dist/components/stream/accessibleDataRows.d.ts +11 -0
  270. package/dist/components/stream/accessibleDataTableModel.d.ts +40 -0
  271. package/dist/components/stream/accessibleTableTypes.d.ts +11 -0
  272. package/dist/components/stream/axisTickUtils.d.ts +19 -0
  273. package/dist/components/stream/canvasBackground.d.ts +10 -0
  274. package/dist/components/stream/canvasSetup.d.ts +9 -0
  275. package/dist/components/stream/frameCursorInteraction.d.ts +25 -0
  276. package/dist/components/stream/frameDefaultMargins.d.ts +37 -0
  277. package/dist/components/stream/frameGraphics.d.ts +18 -0
  278. package/dist/components/stream/frameGraphicsSubscription.d.ts +26 -0
  279. package/dist/components/stream/frameLegendOptions.d.ts +18 -0
  280. package/dist/components/stream/geoFrameCursorInteraction.d.ts +9 -0
  281. package/dist/components/stream/geoFrameHelpers.d.ts +29 -1
  282. package/dist/components/stream/geoTypes.d.ts +10 -11
  283. package/dist/components/stream/hitTarget.d.ts +61 -2
  284. package/dist/components/stream/moduleWorkerSession.d.ts +6 -0
  285. package/dist/components/stream/networkAnnotationAnchors.d.ts +37 -0
  286. package/dist/components/stream/networkCustomLayout.d.ts +2 -2
  287. package/dist/components/stream/networkFrameCursorInteraction.d.ts +12 -0
  288. package/dist/components/stream/networkFrameInteraction.d.ts +2 -0
  289. package/dist/components/stream/networkFramePaint.d.ts +7 -0
  290. package/dist/components/stream/networkPipelineConfig.d.ts +1 -1
  291. package/dist/components/stream/networkTypes.d.ts +30 -32
  292. package/dist/components/stream/normalizeXYData.d.ts +7 -0
  293. package/dist/components/stream/ordinalFrameCursorInteraction.d.ts +7 -0
  294. package/dist/components/stream/ordinalFrameInteraction.d.ts +29 -0
  295. package/dist/components/stream/ordinalSceneSVG.d.ts +10 -0
  296. package/dist/components/stream/ordinalTypes.d.ts +10 -4
  297. package/dist/components/stream/physics/PhysicsBodySpatialIndex.d.ts +9 -1
  298. package/dist/components/stream/physics/PhysicsCanvasTheme.d.ts +25 -0
  299. package/dist/components/stream/physics/PhysicsControllers.d.ts +0 -3
  300. package/dist/components/stream/physics/PhysicsPipelineStore.d.ts +4 -1
  301. package/dist/components/stream/physics/PhysicsSVGOverlay.d.ts +3 -24
  302. package/dist/components/stream/physics/PhysicsSettledSVG.d.ts +9 -21
  303. package/dist/components/stream/physics/PhysicsSettledSVGElement.d.ts +37 -0
  304. package/dist/components/stream/physics/PhysicsSettledScene.d.ts +7 -3
  305. package/dist/components/stream/physics/StreamPhysicsFrame.d.ts +1 -1
  306. package/dist/components/stream/physics/StreamPhysicsTypes.d.ts +23 -4
  307. package/dist/components/stream/physics/physicsAnnotationContext.d.ts +19 -0
  308. package/dist/components/stream/physics/physicsBodyCanvas.d.ts +4 -0
  309. package/dist/components/stream/physics/physicsSettledChrome.d.ts +7 -0
  310. package/dist/components/stream/physics/usePhysicsCanvasPointer.d.ts +32 -0
  311. package/dist/components/stream/physics/usePhysicsSemanticNavigation.d.ts +36 -0
  312. package/dist/components/stream/pipelineConfig.d.ts +6 -17
  313. package/dist/components/stream/pipelineDomainResolution.d.ts +1 -1
  314. package/dist/components/stream/renderBackend.d.ts +2 -0
  315. package/dist/components/stream/renderers/canvasRenderHelpers.d.ts +13 -2
  316. package/dist/components/stream/renderers/resolveCSSColor.d.ts +7 -0
  317. package/dist/components/stream/responsiveSize.d.ts +17 -0
  318. package/dist/components/stream/sceneCursor.d.ts +41 -0
  319. package/dist/components/stream/sceneRevisionDiagnostics.d.ts +1 -1
  320. package/dist/components/stream/svgOverlayUtils.d.ts +22 -1
  321. package/dist/components/stream/types.d.ts +25 -12
  322. package/dist/components/stream/useCanvasFrameHost.d.ts +3 -1
  323. package/dist/components/stream/useFrame.d.ts +24 -1
  324. package/dist/components/stream/useResponsiveSize.d.ts +6 -1
  325. package/dist/components/stream/useStalenessCheck.d.ts +1 -1
  326. package/dist/components/stream/xyFrameAxisTypes.d.ts +15 -4
  327. package/dist/components/stream/xyFrameCursorInteraction.d.ts +6 -0
  328. package/dist/components/stream/xySceneBuilders/swarmScene.d.ts +1 -1
  329. package/dist/components/stream/xySceneBuilders/types.d.ts +6 -26
  330. package/dist/components/types/legendTypes.d.ts +6 -0
  331. package/dist/components/types/marginType.d.ts +7 -8
  332. package/dist/controls.min.js +1 -1
  333. package/dist/controls.module.min.js +1 -1
  334. package/dist/forceLayoutWorker.js +1 -1
  335. package/dist/geo.min.js +1 -1
  336. package/dist/geo.module.min.js +1 -1
  337. package/dist/network.min.js +1 -1
  338. package/dist/network.module.min.js +1 -1
  339. package/dist/ordinal.min.js +1 -1
  340. package/dist/ordinal.module.min.js +1 -1
  341. package/dist/physics-matter.module.min.js +1 -1
  342. package/dist/physics-rapier.module.min.js +1 -1
  343. package/dist/physics.min.js +1 -1
  344. package/dist/physics.module.min.js +1 -1
  345. package/dist/physicsWorker.js +1 -1
  346. package/dist/processSankeyLayoutWorker.js +1 -1
  347. package/dist/realtime.min.js +1 -1
  348. package/dist/realtime.module.min.js +1 -1
  349. package/dist/rough.min.js +1 -1
  350. package/dist/rough.module.min.js +1 -1
  351. package/dist/semiotic-ai-core.d.ts +13 -4
  352. package/dist/semiotic-ai-core.min.js +1 -1
  353. package/dist/semiotic-ai-core.module.min.js +1 -1
  354. package/dist/semiotic-ai.d.ts +16 -9
  355. package/dist/semiotic-ai.min.js +1 -1
  356. package/dist/semiotic-ai.module.min.js +1 -1
  357. package/dist/semiotic-client-cjs-shared.min.js +1 -0
  358. package/dist/semiotic-client-glyph.module.min.js +2 -0
  359. package/dist/semiotic-client-responsive.module.min.js +2 -0
  360. package/dist/semiotic-client-shared.module.min.js +2 -0
  361. package/dist/semiotic-custom-layout-selection-cjs-shared.min.js +2 -0
  362. package/dist/semiotic-data.min.js +1 -1
  363. package/dist/semiotic-data.module.min.js +1 -1
  364. package/dist/semiotic-experimental-auxiliary.module.min.js +2 -0
  365. package/dist/semiotic-experimental-node-auxiliary.module.min.js +2 -0
  366. package/dist/semiotic-experimental-node.module.min.js +2 -0
  367. package/dist/semiotic-experimental-react-shared.module.min.js +2 -0
  368. package/dist/semiotic-experimental-vacp.min.js +1 -1
  369. package/dist/semiotic-experimental-vacp.module.min.js +1 -1
  370. package/dist/semiotic-experimental.d.ts +1 -1
  371. package/dist/semiotic-experimental.min.js +1 -1
  372. package/dist/semiotic-experimental.module.min.js +1 -1
  373. package/dist/semiotic-geo.d.ts +4 -1
  374. package/dist/semiotic-network.d.ts +7 -4
  375. package/dist/semiotic-ordinal.d.ts +4 -1
  376. package/dist/semiotic-physics.d.ts +11 -4
  377. package/dist/semiotic-realtime-core.d.ts +11 -4
  378. package/dist/semiotic-realtime-core.min.js +2 -1
  379. package/dist/semiotic-realtime-core.module.min.js +2 -1
  380. package/dist/semiotic-realtime-react.d.ts +4 -3
  381. package/dist/semiotic-realtime-react.min.js +1 -1
  382. package/dist/semiotic-realtime-react.module.min.js +1 -1
  383. package/dist/semiotic-realtime.d.ts +3 -1
  384. package/dist/semiotic-recipes-core-cjs-base.min.js +1 -0
  385. package/dist/semiotic-recipes-core.d.ts +7 -5
  386. package/dist/semiotic-recipes-core.min.js +9 -1
  387. package/dist/semiotic-recipes-core.module.min.js +1 -1
  388. package/dist/semiotic-recipes-geo-cjs.min.js +1 -0
  389. package/dist/semiotic-recipes-react.min.js +1 -1
  390. package/dist/semiotic-recipes-react.module.min.js +1 -1
  391. package/dist/semiotic-recipes.min.js +7 -1
  392. package/dist/semiotic-recipes.module.min.js +2 -1
  393. package/dist/semiotic-server-edge-node.module.min.js +1 -0
  394. package/dist/semiotic-server-edge.d.ts +3 -2
  395. package/dist/semiotic-server-edge.min.js +1 -1
  396. package/dist/semiotic-server-edge.module.min.js +1 -1
  397. package/dist/semiotic-server-node.min.js +1 -1
  398. package/dist/semiotic-server-node.module.min.js +1 -1
  399. package/dist/semiotic-server.d.ts +3 -2
  400. package/dist/semiotic-themes-core.d.ts +5 -48
  401. package/dist/semiotic-themes-core.min.js +1 -1
  402. package/dist/semiotic-themes-core.module.min.js +1 -1
  403. package/dist/semiotic-themes-react.min.js +1 -1
  404. package/dist/semiotic-themes-react.module.min.js +1 -1
  405. package/dist/semiotic-themes.min.js +1 -1
  406. package/dist/semiotic-themes.module.min.js +1 -1
  407. package/dist/semiotic-utils-core.d.ts +10 -5
  408. package/dist/semiotic-utils-core.min.js +1 -1
  409. package/dist/semiotic-utils-core.module.min.js +1 -1
  410. package/dist/semiotic-utils-react.d.ts +2 -0
  411. package/dist/semiotic-utils-react.min.js +1 -1
  412. package/dist/semiotic-utils-react.module.min.js +1 -1
  413. package/dist/semiotic-utils.d.ts +1 -1
  414. package/dist/semiotic-utils.min.js +2 -1
  415. package/dist/semiotic-utils.module.min.js +2 -1
  416. package/dist/semiotic-value.min.js +1 -1
  417. package/dist/semiotic-value.module.min.js +1 -1
  418. package/dist/semiotic-xy.d.ts +4 -1
  419. package/dist/semiotic.d.ts +68 -26
  420. package/dist/semiotic.min.js +1 -1
  421. package/dist/semiotic.module.min.js +1 -1
  422. package/dist/server.min.js +1 -1
  423. package/dist/server.module.min.js +1 -1
  424. package/dist/xy.min.js +1 -1
  425. package/dist/xy.module.min.js +1 -1
  426. package/package.json +53 -19
  427. package/dist/__tests__/scenarios/mcpProtocolTypes.d.ts +0 -20
  428. package/dist/chunk-OrdinalBrushOverlay-PXHQYDB2.module.min.js +0 -2
  429. package/dist/chunk-XYBrushOverlay-ECZJJLAJ.module.min.js +0 -1
  430. package/dist/chunk-XYBrushOverlay-EP2SV3UI.module.min.js +0 -2
  431. package/dist/chunk-chartContainerDataAudit-IQ3NBN3Q.module.min.js +0 -2
  432. package/dist/chunk-chunk-2B3AIKUZ.module.min.js +0 -2
  433. package/dist/chunk-chunk-2CXCXRB4.module.min.js +0 -1
  434. package/dist/chunk-chunk-2X3FJCME.module.min.js +0 -1
  435. package/dist/chunk-chunk-2ZHHWZQM.module.min.js +0 -2
  436. package/dist/chunk-chunk-4ITOQRXM.module.min.js +0 -2
  437. package/dist/chunk-chunk-5UKL5W76.module.min.js +0 -2
  438. package/dist/chunk-chunk-5VVNW5AZ.module.min.js +0 -1
  439. package/dist/chunk-chunk-5ZON5NMV.module.min.js +0 -2
  440. package/dist/chunk-chunk-66PCWJUG.module.min.js +0 -1
  441. package/dist/chunk-chunk-6S3YGYW7.module.min.js +0 -1
  442. package/dist/chunk-chunk-6V5VQVCT.module.min.js +0 -2
  443. package/dist/chunk-chunk-7C5EDZ3Z.module.min.js +0 -2
  444. package/dist/chunk-chunk-A3I4HBD5.module.min.js +0 -1
  445. package/dist/chunk-chunk-ACLDBMRH.module.min.js +0 -2
  446. package/dist/chunk-chunk-AFQHURLO.module.min.js +0 -2
  447. package/dist/chunk-chunk-DDB4TLQG.module.min.js +0 -2
  448. package/dist/chunk-chunk-DTH3SUOU.module.min.js +0 -2
  449. package/dist/chunk-chunk-DTSNLGRK.module.min.js +0 -2
  450. package/dist/chunk-chunk-DVCWU7MT.module.min.js +0 -2
  451. package/dist/chunk-chunk-FEPXDKJP.module.min.js +0 -1
  452. package/dist/chunk-chunk-FJ76HWQZ.module.min.js +0 -1
  453. package/dist/chunk-chunk-FSIHAW6L.module.min.js +0 -2
  454. package/dist/chunk-chunk-G2RGVEYY.module.min.js +0 -2
  455. package/dist/chunk-chunk-G75OPF5N.module.min.js +0 -2
  456. package/dist/chunk-chunk-HADHLMY5.module.min.js +0 -1
  457. package/dist/chunk-chunk-HAJVODLO.module.min.js +0 -2
  458. package/dist/chunk-chunk-HBFA4NN6.module.min.js +0 -1
  459. package/dist/chunk-chunk-HIV7AW2V.module.min.js +0 -2
  460. package/dist/chunk-chunk-IY7RYD4S.module.min.js +0 -1
  461. package/dist/chunk-chunk-J3QOW4OE.module.min.js +0 -0
  462. package/dist/chunk-chunk-J3XWETBJ.module.min.js +0 -2
  463. package/dist/chunk-chunk-JZAMMSQQ.module.min.js +0 -2
  464. package/dist/chunk-chunk-KTWEBFMX.module.min.js +0 -2
  465. package/dist/chunk-chunk-LSJUXBMF.module.min.js +0 -1
  466. package/dist/chunk-chunk-MXMRXSCI.module.min.js +0 -2
  467. package/dist/chunk-chunk-MXVBXFKW.module.min.js +0 -2
  468. package/dist/chunk-chunk-NWIGA3UK.module.min.js +0 -1
  469. package/dist/chunk-chunk-OFAP623Y.module.min.js +0 -2
  470. package/dist/chunk-chunk-OHLRAEQZ.module.min.js +0 -2
  471. package/dist/chunk-chunk-OZK46A5U.module.min.js +0 -1
  472. package/dist/chunk-chunk-PMR47KRY.module.min.js +0 -2
  473. package/dist/chunk-chunk-PRNXOCYZ.module.min.js +0 -2
  474. package/dist/chunk-chunk-Q2YADC2V.module.min.js +0 -2
  475. package/dist/chunk-chunk-RLKZVJMQ.module.min.js +0 -2
  476. package/dist/chunk-chunk-ROP4HI7H.module.min.js +0 -2
  477. package/dist/chunk-chunk-SK2TQMG4.module.min.js +0 -2
  478. package/dist/chunk-chunk-SKLYXNYW.module.min.js +0 -2
  479. package/dist/chunk-chunk-TCMHJWFJ.module.min.js +0 -1
  480. package/dist/chunk-chunk-TSCFL235.module.min.js +0 -1
  481. package/dist/chunk-chunk-U4NZCU5T.module.min.js +0 -2
  482. package/dist/chunk-chunk-U66USBWU.module.min.js +0 -1
  483. package/dist/chunk-chunk-UOQRPGPK.module.min.js +0 -2
  484. package/dist/chunk-chunk-VKL6DI43.module.min.js +0 -2
  485. package/dist/chunk-chunk-W62673ZE.module.min.js +0 -1
  486. package/dist/chunk-chunk-WFHZHWT7.module.min.js +0 -1
  487. package/dist/chunk-chunk-XCC25CZZ.module.min.js +0 -2
  488. package/dist/chunk-chunk-XECNOUZY.module.min.js +0 -2
  489. package/dist/chunk-chunk-XYZDTYAF.module.min.js +0 -2
  490. package/dist/chunk-chunk-YHNZCPOZ.module.min.js +0 -2
  491. package/dist/chunk-chunk-YWZB3KPI.module.min.js +0 -2
  492. package/dist/chunk-statisticalOverlays-HMYYSGPE.module.min.js +0 -2
  493. package/dist/components/stream/test-utils/frameScheduler.d.ts +0 -12
  494. package/dist/components/stream/test-utils/revisionConsumption.d.ts +0 -13
  495. package/dist/test-utils/canvasMock.d.ts +0 -86
  496. package/dist/test-utils/capturedFrameProps.d.ts +0 -67
  497. package/dist/test-utils/frameMock.d.ts +0 -81
  498. package/dist/test-utils/ordinalFixtures.d.ts +0 -48
  499. /package/dist/{chunk-chunk-JJ2OOIET.module.min.js → c-GGISSW5E.min.js} +0 -0
  500. /package/dist/{chunk-chunk-SIRIJ3DY.module.min.js → c-N4G2L7ID.min.js} +0 -0
  501. /package/dist/{chunk-chunk-CA3YDW6F.module.min.js → c-S6U5CGT5.min.js} +0 -0
  502. /package/dist/components/recipes/{mobileAnnotationStrategy.d.ts → mobileAnnotationBehavior.d.ts} +0 -0
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- var e,t,o=Object.create,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,s=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,l=(e,t,o)=>function(){if(o)throw o[0];try{return e&&(t=(0,e[i(e)[0]])(e=0)),t}catch(e){throw o=[e],e}},c=(e,t)=>{for(var o in t)n(e,o,{get:t[o],enumerable:!0})},u=(e,t,o,s)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let l of i(t))a.call(e,l)||l===o||n(e,l,{get:()=>t[l],enumerable:!(s=r(t,l))||s.enumerable});return e},d=(e,t,r)=>(r=null!=e?o(s(e)):{},u(!t&&e&&e.__esModule?r:n(r,"default",{value:e,enumerable:!0}),e));function h({label:o="Data range brush",description:n=t,onAction:r}={}){const i=e.useId().replace(/:/g,""),s=e.useRef(r);return s.current=r,{description:n,descriptionId:"semiotic-brush-description-"+i,svgProps:{role:"region",tabIndex:0,"aria-label":o,"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))},[])}}}var f,m,p,g,y=l({"src/components/stream/brushAccessibility.ts"(){e=d(require("react")),t="Use arrow keys to move the selected range, Shift plus an arrow key to resize it, and Escape to clear it."}}),b={};function v(e,t,o,n){const[r,i]=[Math.min(...t),Math.max(...t)],s=(i-r)/20;let[a,l]=e;if(n)0>o?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+o*s)),l=a+e}return[a,l]}function x(e,t){let o=0,n=t.length-1;for(;n>o;){const r=o+n+1>>1;t[r]>e?n=r-1:o=r}return t[o]}function k(e,t){let o=0,n=t.length-1;for(;n>o;){const r=o+n>>1;e>t[r]?o=r+1:n=r}return t[o]}function w({width:e,height:t,totalWidth:o,totalHeight:n,margin:r,dimension:i,scales:s,onBrush:a,binSize:l,snap:c,binBoundaries:u,snapDuring:d,streaming:y}){const b=(0,f.useRef)(null),w=(0,f.useRef)(null),S=(0,f.useRef)(a);S.current=a;const A=(0,f.useRef)(s);A.current=s;const C=(0,f.useMemo)(()=>u?[...u].sort((e,t)=>e-t):void 0,[u]),M=(0,f.useRef)(C);M.current=C;const _=(0,f.useRef)(!1),P=(0,f.useRef)(null),R=h({label:"xy"===i?"Two-dimensional data range brush":i.toUpperCase()+" data range brush",onAction:e=>{const t=A.current,o=w.current;if(!t||!o||!b.current)return;const n=(0,m.select)(b.current).select(".brush-g");if("clear"===e.type)return _.current=!0,n.call(o.move,null),_.current=!1,P.current=null,void S.current(null);const r=t.x.domain(),s=t.y.domain(),a=P.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,d="left"===e.direction||"down"===e.direction?-1:1;if(u&&"y"!==i&&(l=v(l,r,d,e.resize)),u||"x"===i||(c=v(c,s,d,e.resize)),u&&"y"===i||!u&&"x"===i)return;const h={x:l,y:c};_.current=!0,n.call(o.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])]]),_.current=!1,P.current=h,S.current(h)}});return(0,f.useEffect)(()=>{if(!b.current)return;const o=(0,m.select)(b.current).select(".brush-g"),n="x"===i?(0,p.brushX)():"y"===i?(0,p.brushY)():(0,p.brush)();return n.extent([[0,0],[e,t]]),n.on("brush end",r=>{if(_.current)return;const s=A.current;if(!s)return;if(!r.selection)return P.current=null,void S.current(null);let a,u;if("x"===i){const[e,o]=r.selection;a=[s.x.invert(e),s.x.invert(o)],u=[s.y.invert(t),s.y.invert(0)]}else if("y"===i){const[t,o]=r.selection;a=[s.x.invert(0),s.x.invert(e)],u=[s.y.invert(o),s.y.invert(t)]}else{const[[e,t],[o,n]]=r.selection;a=[s.x.invert(e),s.x.invert(o)],u=[s.y.invert(n),s.y.invert(t)]}if("bin"===c&&"y"!==i&&("end"===r.type||"brush"===r.type&&d)){const e=M.current;e&&e.length>0?a=function(e,t){return 0===t.length?e:[x(e[0],t),k(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(_.current=!0,"x"===i)o.call(n.move,[t,c]);else if("xy"===i){const e=r.selection;o.call(n.move,[[t,e[0][1]],[c,e[1][1]]])}_.current=!1}const h={x:a,y:u};P.current=h,S.current(h)}),o.call(n),w.current=n,o.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{n.on("brush end",null),w.current=null}},[e,t,i,c,l,d]),(0,f.useEffect)(()=>{if(!(y&&s&&w.current&&P.current))return;if(!b.current)return;if("y"===i)return;const e=P.current,t=s.x.domain()[0],o=(0,m.select)(b.current).select(".brush-g");if(t>=e.x[1])return _.current=!0,o.call(w.current.move,null),_.current=!1,P.current=null,void S.current(null);let n=e.x[0],r=!1;if(t>e.x[0]){if(n=t,"bin"===c){const e=M.current;e&&e.length>0?n=k(t,e):l&&l>0&&(n=Math.ceil(t/l)*l)}if(n>=e.x[1])return _.current=!0,o.call(w.current.move,null),_.current=!1,P.current=null,void S.current(null);r=!0}const a=s.x(n),u=s.x(e.x[1]);if(_.current=!0,"x"===i)o.call(w.current.move,[a,u]);else{const t=s.y(e.y[1]),n=s.y(e.y[0]);o.call(w.current.move,[[a,t],[u,n]])}if(_.current=!1,r){const t={x:[n,e.x[1]],y:e.y};P.current=t,S.current(t)}},[s,y,i,c,l]),(0,g.jsxs)("svg",{ref:b,width:o,height:n,...R.svgProps,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:[(0,g.jsx)("title",{children:R.svgProps["aria-label"]}),(0,g.jsx)("desc",{id:R.descriptionId,children:R.description}),(0,g.jsx)("g",{className:"brush-g",transform:`translate(${r.left},${r.top})`})]})}c(b,{XYBrushOverlay:()=>w});var S,A=l({"src/components/stream/XYBrushOverlay.tsx"(){f=require("react"),m=require("d3-selection"),p=require("d3-brush"),y(),g=require("react/jsx-runtime")}});function C(e){const t=e.trim();if(!t||!Number.isNaN(Number(t)))return NaN;const o=S.test(t)?t+"-01":t;if(o===t&&10>t.length)return NaN;const n=Date.parse(o);return Number.isFinite(n)?n:NaN}function M(e){return e instanceof Date?e.getTime():"string"==typeof e?C(e):+e}var _=l({"src/components/charts/shared/temporalStrings.ts"(){S=/^\d{4}-\d{1,2}$/}});function P(e){let t=1/0,o=-1/0;for(const n of e)t>n&&(t=n),n>o&&(o=n);return[t,o]}function R(e,t=-1/0){let o=t;for(const t of e)t>o&&(o=t);return o}var j,L=l({"src/components/charts/shared/minMax.ts"(){}});function T(e){const t=10**j;return Math.round(e*t)/t}function I(e,t=2){const o=[],n=[],r=t+1;for(let t=0;r>t;t++){let i=0;for(const[o,n]of e)null!==n&&(i+=o**t*n);o.push(i);const s=[];for(let o=0;r>o;o++){let n=0;for(const[r,i]of e)null!==i&&(n+=r**(t+o));s.push(n)}n.push(s)}n.push(o);const i=function(e,t){const o=e,n=e.length-1,r=[t];for(let e=0;n>e;e++){let t=e;for(let r=e+1;n>r;r++)Math.abs(o[e][r])>Math.abs(o[e][t])&&(t=r);for(let r=e;n+1>r;r++){const n=o[r][e];o[r][e]=o[r][t],o[r][t]=n}for(let t=e+1;n>t;t++)for(let r=n;r>=e;r--)o[r][t]-=o[r][e]*o[e][t]/o[e][e]}for(let e=n-1;e>=0;e--){let t=0;for(let i=e+1;n>i;i++)t+=o[i][e]*r[i];r[e]=(o[n][e]-t)/o[e][e]}return r}(n,r).map(T);return{points:e.map(([e])=>[T(e),T(i.reduce((t,o,n)=>t+o*e**n,0))]),equation:[...i].reverse()}}function $(e){const t=e.length;let o=0,n=0,r=0,i=0;for(const[t,s]of e)o+=t,n+=s,r+=t*t,i+=t*s;const s=t*r-o*o;if(1e-12>Math.abs(s))return null;const a=(t*i-o*n)/s,l=(n-a*o)/t;return e=>l+a*e}function N(e,t){const o=e.length,n=e.map(([e,o])=>o-t(e)).reduce((e,t)=>e+t*t,0),r=Math.sqrt(n/Math.max(o-2,1)),i=e.reduce((e,t)=>e+t[0],0)/o,s=e.reduce((e,t)=>e+(t[0]-i)**2,0);return{se:r,meanX:i,ssX:s}}function D(e){return.99>e?.95>e?.9>e?1:1.645:1.96:2.576}var E,O,B,F,z=l({"src/components/charts/shared/leastSquaresRegression.ts"(){j=2}}),H={};function W({width:e,height:t,totalWidth:o,totalHeight:n,margin:r,scales:i,onBrush:s}){const a=(0,E.useRef)(null),l=(0,E.useRef)(null),c=(0,E.useRef)(s);c.current=s;const u=(0,E.useRef)(i);u.current=i;const d=(0,E.useRef)(!1),f=(0,E.useRef)(null),m="horizontal"===i?.projection,p=(0,E.useRef)(m);p.current=m;const g=h({label:"Ordinal value range brush",onAction:e=>{const t=u.current,o=l.current;if(!t||!o||!a.current)return;const n=(0,O.select)(a.current).select(".brush-g");if("clear"===e.type)return d.current=!0,n.call(o.move,null),d.current=!1,f.current=null,void c.current(null);if(("left"===e.direction||"right"===e.direction)!=!!p.current)return;const r=t.r.domain(),[i,s]=[Math.min(...r),Math.max(...r)],h=(s-i)/20,m=f.current?.r??[i+.4*(s-i),i+.6*(s-i)],g="left"===e.direction||"down"===e.direction?-1:1;let[y,b]=m;if(e.resize)0>g?y=Math.max(i,y-h):b=Math.min(s,b+h);else{const e=b-y;y=Math.max(i,Math.min(s-e,y+g*h)),b=y+e}const v={r:[y,b]};d.current=!0,n.call(o.move,p.current?[t.r(y),t.r(b)]:[t.r(b),t.r(y)]),d.current=!1,f.current=v,c.current(v)}});return(0,E.useEffect)(()=>{if(!a.current)return;const o=(0,O.select)(a.current).select(".brush-g"),n=m?(0,B.brushX)():(0,B.brushY)();return n.extent([[0,0],[e,t]]),n.on("brush end",e=>{if(d.current)return;const t=u.current;if(!t)return;if(!e.selection)return f.current=null,void c.current(null);const[o,n]=e.selection;let r;r=p.current?[t.r.invert(o),t.r.invert(n)]:[t.r.invert(n),t.r.invert(o)];const i={r:r};f.current=i,c.current(i)}),o.call(n),l.current=n,o.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{n.on("brush end",null),l.current=null}},[e,t,m]),(0,E.useEffect)(()=>{if(!i||!l.current||!f.current)return;if(!a.current)return;const e=f.current,t=(0,O.select)(a.current).select(".brush-g"),o=i.r(e.r[0]),n=i.r(e.r[1]);m?(d.current=!0,t.call(l.current.move,[o,n]),d.current=!1):(d.current=!0,t.call(l.current.move,[n,o]),d.current=!1)},[i,m]),(0,F.jsxs)("svg",{ref:a,width:o,height:n,...g.svgProps,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[(0,F.jsx)("title",{children:g.svgProps["aria-label"]}),(0,F.jsx)("desc",{id:g.descriptionId,children:g.description}),(0,F.jsx)("g",{className:"brush-g",transform:`translate(${r.left},${r.top})`,style:{pointerEvents:"all"}})]})}c(H,{OrdinalBrushOverlay:()=>W});var q=l({"src/components/stream/OrdinalBrushOverlay.tsx"(){E=require("react"),O=require("d3-selection"),B=require("d3-brush"),y(),F=require("react/jsx-runtime")}});function Y(e,t=.5){const o=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!o)return e;const n=Math.round(parseInt(o[1],16)*(1-t)),r=Math.round(parseInt(o[2],16)*(1-t)),i=Math.round(parseInt(o[3],16)*(1-t));return`#${n.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}`}function G(e,t=.5){const o=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!o)return e;const n=Math.round(parseInt(o[1],16)+(255-parseInt(o[1],16))*t),r=Math.round(parseInt(o[2],16)+(255-parseInt(o[2],16))*t),i=Math.round(parseInt(o[3],16)+(255-parseInt(o[3],16))*t);return`#${n.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}`}var V,X,U=l({"src/components/charts/shared/colorManipulation.ts"(){}}),K={};function Q(e,t,o,n){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 o of e){const e=t(o);null!=e&&Number.isFinite(e)&&(o[X]=a+Math.max(0,Math.min(1,e))*(l-a))}return}const c=e.map(e=>{const t=o(e),r=n(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[d,h]=P(u),f=h-d;e.forEach((e,t)=>{const o=c[t];Number.isFinite(o)&&(e[X]=l-(f>0?(o-d)/f:0)*(l-a))})}function Z(e,t){return"function"==typeof t?t(e):!!e[t]}function J(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 ee(e,t,o,n,r){return(i=n).isTraining||i.isForecast||i.isAnomaly||i.upperBounds||i.lowerBounds?function(e,t,o,n,r){const{isTraining:i,isForecast:s,isAnomaly:a,upperBounds:l,lowerBounds:c,color:u="#6366f1",bandOpacity:d=.15,anomalyColor:h="#ef4444",anomalyRadius:f=6,label:m}=n,p=e.map(e=>{let t="observed";return s&&Z(e,s)?t="forecast":i&&Z(e,i)&&(t="training"),{...e,[V]:t}}),g=n._groupBy,y=[];if(g){const e=new Map;for(const t of p){const o=t[g]??"__default";e.has(o)||e.set(o,[]),e.get(o).push(t)}const t=[];for(const[,o]of e)for(let e=0;o.length-1>e;e++)o[e][V]!==o[e+1][V]&&(t.push({...o[e+1],[V]:o[e][V]}),t.push({...o[e],[V]:o[e+1][V]}));y.push(...p,...t)}else for(let e=0;p.length>e;e++)y.push(p[e]),p.length-1>e&&p[e][V]!==p[e+1][V]&&(y.push({...p[e+1],[V]:p[e][V]}),y.push({...p[e],[V]:p[e+1][V]}));if(n.trainUnderline){const e=[];for(const t of y)"training"===t[V]&&e.push({...t,[V]:"training-base"});y.unshift(...e)}const b=[];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 o of y)"function"==typeof l&&(o[e]=l(o)),"function"==typeof c&&(o[t]=c(o));b.push({type:"envelope",upperAccessor:e,lowerAccessor:t,fill:u,fillOpacity:d,label:m})}if(n.uncertaintyOpacity||n.confidenceAccessor){const e=l?"function"==typeof l?l:e=>e[l]:()=>{},t=c?"function"==typeof c?c:e=>e[c]:()=>{};Q(y.filter(e=>"forecast"===e[V]),n,e,t)}if(a){const e=n.anomalyStyle,t={type:"highlight",filter:e=>Z(e,a)};e?(t.style=e,t.r=f):"function"==typeof h?(t.style=e=>{const t=h(e);return{stroke:t,strokeWidth:1.5,fill:t,fillOpacity:.7}},t.r=f):(t.color=h,t.r=f,t.style={stroke:h,strokeWidth:1.5,fill:h,fillOpacity:.7}),b.push(t)}return r&&b.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:y,annotations:b}}(e,0,0,n,r):function(e,t,o,n,r){const{trainEnd:i,steps:s=10,confidence:a=.95,color:l="#6366f1",bandOpacity:c=.15,label:u}=n;if(null==i)return{processedData:e,annotations:[]};const d=[],h=[];for(const o of e)o[t]>i?h.push({...o,[V]:"observed"}):d.push({...o,[V]:"training"});const f=d.map(e=>[e[t],e[o]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]),m=[],p=[];if(f.length>=3){const r=f.length,i=$(f);if(i){const{se:d,meanX:h,ssX:g}=N(f,i),y=D(a),b=R(e.map(e=>e[t]).filter(e=>null!=e&&isFinite(e))),v=f.length>1?(f[r-1][0]-f[0][0])/(r-1):1;for(let e=1;s>=e;e++){const n=b+e*v,s=i(n),a=d*Math.sqrt(1+1/r+(g>0?(n-h)**2/g:0))*y;p.push({[t]:n,[o]:s,[V]:"forecast",__forecastUpper:s+a,__forecastLower:s-a})}Q(p,n,e=>e.__forecastUpper,e=>e.__forecastLower),m.push({type:"envelope",upperAccessor:"__forecastUpper",lowerAccessor:"__forecastLower",fill:l,fillOpacity:c,label:u})}}m.push({type:"x-threshold",x:i,color:"#94a3b8",strokeWidth:1,strokeDasharray:"4,2",label:"Train / Forecast"}),r&&m.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 g=[];if(g.push(...d),d.length>0&&h.length>0&&g.push({...d[d.length-1],[V]:"observed"}),g.push(...h),p.length>0){const e=h.length>0?h[h.length-1]:d[d.length-1];e&&g.push({...e,[V]:"forecast"}),g.push(...p)}return{processedData:g,annotations:m}}(e,t,o,n,r);var i}function te(e,t){const o=t.trainDasharray??"8,4",n=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),d=t[V];if("training"===d){let e=u.stroke;return"darken"===a?e=Y(u.stroke||"#666",.5):a&&(e=a),{...u,stroke:e,strokeDasharray:o,...l&&{strokeLinecap:l},...null!=i&&{strokeOpacity:i}}}if("training-base"===d){let e=u.stroke||"#666";return"lighten"===c&&(e=G(e,.4)),{...u,stroke:e,strokeDasharray:void 0}}if("forecast"===d){const e=t[X],o=null!=e?e:s;return{...u,stroke:r,strokeDasharray:n,...null!=o&&{strokeOpacity:o}}}return u}}c(K,{FORECAST_OPACITY_FIELD:()=>X,SEGMENT_FIELD:()=>V,buildAnomalyAnnotations:()=>J,buildForecast:()=>ee,createSegmentLineStyle:()=>te,darkenColor:()=>Y,lightenColor:()=>G,stampForecastOpacity:()=>Q});var oe,ne,re,ie,se,ae=l({"src/components/charts/shared/statisticalOverlays.ts"(){L(),U(),z(),U(),V="__forecastSegment",X="__forecastOpacity"}}),le=l({"src/components/charts/xy/scatterplotMatrixInteractionTypes.ts"(){}}),ce={};function ue({frameRef:e,cellSize:t,onBrush:o}){const n=(0,oe.useRef)(null),r=t-se.left-se.right,i=t-se.top-se.bottom;return(0,oe.useEffect)(()=>{if(!n.current)return;const t=(0,re.select)(n.current).select(".brush-g"),s=(0,ne.brush)().extent([[0,0],[r,i]]).on("brush end",t=>{const n=e.current?.getScales();if(!n)return;if(!(r=t.selection)||!Array.isArray(r[0]))return void o(null);var r;const[[i,s],[a,l]]=t.selection,c=[[n.x.invert(i),n.y.invert(s)],[n.x.invert(a),n.y.invert(l)]];o(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,o]),(0,ie.jsx)("svg",{ref:n,width:t,height:t,style:{position:"absolute",top:0,left:0},children:(0,ie.jsx)("g",{className:"brush-g",transform:`translate(${se.left},${se.top})`})})}c(ce,{ScatterplotMatrixBrushOverlay:()=>ue});var de,he,fe,me,pe=l({"src/components/charts/xy/scatterplotMatrixBrushOverlay.tsx"(){oe=require("react"),ne=require("d3-brush"),re=require("d3-selection"),le(),ie=require("react/jsx-runtime"),se={top:4,bottom:4,left:4,right:4}}}),ge={};function ye({width:e,height:t,margin:o,scales:n,brushDirection:r,extent:i,onBrush:s}){const a=(0,de.useRef)(null),l=(0,de.useRef)(null),c=(0,de.useRef)(!1),u=e+o.left+o.right,d=t+o.top+o.bottom;return(0,de.useEffect)(()=>{if(!a.current||!n)return;const o=(0,fe.select)(a.current).select(".brush-group"),i="x"===r?(0,he.brushX)().extent([[0,0],[e,t]]):(0,he.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 o=("x"===r?n.x:n.y).invert;if(!o)return;const i=[o(t[0]),o(t[1])];s(i)}),o.call(i),l.current=e=>{o.call(i.move,e)},o.select(".selection").attr("fill","steelblue").attr("fill-opacity",.2).attr("stroke","steelblue").attr("stroke-width",1),()=>{l.current=null,i.on("brush end",null)}},[n,e,t,r,s]),(0,de.useEffect)(()=>{if(!l.current||!n||!a.current)return;const e="x"===r?n.x:n.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,n,r]),(0,me.jsx)("svg",{ref:a,width:u,height:d,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:(0,me.jsx)("g",{className:"brush-group",transform:`translate(${o.left},${o.top})`})})}c(ge,{MinimapBrushOverlay:()=>ye});var be=l({"src/components/charts/xy/minimapBrushOverlay.tsx"(){de=require("react"),he=require("d3-brush"),fe=require("d3-selection"),me=require("react/jsx-runtime")}});function ve(e,t){const o=e.nestedDataAccessorProp?t[e.nestedDataAccessorProp]:void 0;return"string"==typeof o?o:e.defaultNestedDataAccessor}function xe(e,t,o){const n=e.dataProp??"data",r=t[n],i=o??(Array.isArray(r)?r:[]),s=ve(e,t);if(!s)return{dataProp:n,rows:i};const a=[];let l=!1;for(const e of i){const t=e?.[s];if(Array.isArray(t)){l=!0;for(const e of t)e&&"object"==typeof e&&a.push(e)}}return{dataProp:n,rows:l?a:i}}var ke,we,Se,Ae,Ce,Me,_e,Pe,Re,je,Le,Te,Ie,$e,Ne,De,Ee,Oe=l({"src/components/data/dataAuditSources.ts"(){}});var Be=l({"src/components/data/numericContracts.ts"(){we={fields:ke=[{role:"x",accessor:"xAccessor",defaultAccessor:"x",temporalValues:"date-like",domain:!0},{role:"y",accessor:"yAccessor",defaultAccessor:"y",domain:!0}]},Se=[{...ke[0],nestedDataAccessorProp:"lineDataAccessor",defaultNestedDataAccessor:"coordinates"},{...ke[1],nestedDataAccessorProp:"lineDataAccessor",defaultNestedDataAccessor:"coordinates",allowMissing:!0}],Ae={fields:Se},Ce={role:"value",accessor:"valueAccessor",defaultAccessor:"value"},Me={...Ce,domain:!0},_e={fields:[{...Ce,requirements:["finite","non-negative"]}],aggregates:[{kind:"positive-total",role:"value"}]},Pe={fields:[Ce],aggregates:[{kind:"normalized-total",role:"value",groupAccessor:"categoryAccessor",defaultGroupAccessor:"category",whenProp:"normalize"}]},Re={fields:Se,aggregates:[{kind:"normalized-total",role:"y",groupAccessor:"xAccessor",defaultGroupAccessor:"x",whenProp:"normalize"}]},je={fields:[...ke,{role:"size",accessor:"sizeBy",requirements:["finite","non-negative"]}]},Le={fields:[...ke,{role:"size",accessor:"sizeBy",requirements:["finite","non-negative"]}]},Te={fields:[{role:"x",accessor:"xAccessor",defaultAccessor:"x",temporalValues:"date-like",domain:!0},{role:"high",accessor:"highAccessor",defaultAccessor:"high",requirements:["finite"]},{role:"low",accessor:"lowAccessor",defaultAccessor:"low",requirements:["finite"]},{role:"open",accessor:"openAccessor",whenProps:["openAccessor","closeAccessor"],requirements:["finite"]},{role:"close",accessor:"closeAccessor",whenProps:["openAccessor","closeAccessor"],requirements:["finite"]}]},Ie={fields:[{role:"x",accessor:"xAccessor",defaultAccessor:"x",temporalValues:"date",domain:!0},{role:"value",accessor:"seriesAAccessor",defaultAccessor:"a"},{role:"value",accessor:"seriesBAccessor",defaultAccessor:"b"}]},$e={fields:[Ce]},Ne={fields:[{...Ce,dataProp:"edges",requirements:["finite","non-negative"],missingValue:1}]},De={LineChart:Ae,AreaChart:Ae,BumpChart:Ae,Scatterplot:Le,ConnectedScatterplot:we,QuadrantChart:Le,MinimapChart:Ae,BubbleChart:je,StackedAreaChart:Re,DifferenceChart:Ie,CandlestickChart:Te,Heatmap:$e,BarChart:{fields:[Ce]},GroupedBarChart:{fields:[Ce]},StackedBarChart:Pe,DotPlot:{fields:[Me]},Histogram:{fields:[Me]},BoxPlot:{fields:[Me]},SwarmPlot:{fields:[Me,{role:"size",accessor:"sizeBy",requirements:["finite","non-negative"]}]},ViolinPlot:{fields:[Me]},RidgelinePlot:{fields:[Me]},PieChart:_e,DonutChart:_e,FunnelChart:_e,SankeyDiagram:Ne,ChordDiagram:Ne,ProportionalSymbolMap:{fields:[{role:"x",accessor:"xAccessor",defaultAccessor:"lon",dataProp:"points",requirements:["finite"]},{role:"y",accessor:"yAccessor",defaultAccessor:"lat",dataProp:"points",requirements:["finite"]},{role:"size",accessor:"sizeBy",dataProp:"points",requirements:["finite","non-negative"]}]}},Ee=Symbol.for("semiotic.numericContractRegistry")}});function Fe(e,t){if(0===e.length)return;const o=(e.length-1)*t,n=Math.floor(o),r=Math.ceil(o);if(n===r)return e[n];const i=o-n;return e[n]*(1-i)+e[r]*i}var ze=l({"src/components/data/numericFieldProfiler.ts"(){}});function He(e){return e.code.toLowerCase().split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}var We,qe,Ye=l({"src/components/data/dataAuditPresentation.ts"(){}});function Ge(e,t,o){return"function"==typeof e?e(t,o):t[e]}function Ve(e,t){if("number"==typeof e)return Number.isFinite(e)?e:null;if(e instanceof Date){const o=e.getTime();return t&&Number.isFinite(o)?o:null}if("string"==typeof e){const o=e.trim(),n=Number(o);if(o&&Number.isFinite(n))return n;if("date-like"===t){const e=C(o);return Number.isFinite(e)?e:null}}return null}function Xe(e){return"number"==typeof e&&!Number.isFinite(e)}function Ue(e,t,o,n,r){const i={field:o,numbers:[],finiteRows:[],missingRows:[],nonFiniteRows:[],nonNumericRows:[],accessorErrorRows:[],zeroRows:[],negativeRows:[],fractionalRows:[]};for(let o=0;e.length>o;o++){let s;try{s=Ge(t,e[o],o)}catch{i.accessorErrorRows.push(o);continue}if(null==s||""===s){if(void 0!==r){i.numbers.push(r),i.finiteRows.push(o),0===r&&i.zeroRows.push(o),0>r&&i.negativeRows.push(o),Number.isInteger(r)||i.fractionalRows.push(o);continue}i.missingRows.push(o);continue}const a=Ve(s,n);null!=a?(i.numbers.push(a),i.finiteRows.push(o),0===a&&i.zeroRows.push(o),0>a&&i.negativeRows.push(o),Number.isInteger(a)||i.fractionalRows.push(o)):Xe(s)?i.nonFiniteRows.push(o):i.nonNumericRows.push(o)}return i}function Ke(e,t){const o=new Set(e.requirements??["finite"]);return o.add("finite"),("x"===e.role&&"log"===t.xScaleType||"y"===e.role&&"log"===t.yScaleType)&&o.add("positive"),[...o]}function Qe(e){return e.slice(0,We)}function Ze(e){return{domain:"data",...e}}function Je(e,t){const o=[],{observation:n,contract:r,accessorLabel:i,requirements:s}=e,a={field:i,role:r.role},l=[...n.nonFiniteRows,...n.nonNumericRows,...n.accessorErrorRows].sort((e,t)=>e-t);if(0===n.numbers.length)return o.push(Ze({severity:"error",code:"DEGENERATE_EXTENT",message:`${r.accessor}="${i}" produces no finite numeric values; the chart cannot resolve its ${r.role} input.`,fix:`Ensure ${i} contains finite numbers${"x"===r.role?" (or valid dates for a time scale)":""}.`,...a,...l.length>0?{rows:Qe(l),count:l.length}:{}})),o;n.nonFiniteRows.length>0&&o.push(Ze({severity:"error",code:"NON_FINITE_VALUE",message:`${i} contains ${n.nonFiniteRows.length} NaN or infinite value${1===n.nonFiniteRows.length?"":"s"}; scale and layout math require finite numbers.`,fix:`Filter or replace NaN/Infinity in ${i} before rendering.`,...a,rows:Qe(n.nonFiniteRows),count:n.nonFiniteRows.length})),!r.allowMissing&&n.missingRows.length>0&&o.push(Ze({severity:"error",code:"MISSING_NUMERIC_VALUE",message:`${i} is missing for ${n.missingRows.length} row${1===n.missingRows.length?"":"s"}; the ${r.role} role requires an explicit numeric value.`,fix:`Fill or filter missing ${i} values before rendering.`,...a,rows:Qe(n.missingRows),count:n.missingRows.length}));const c=[...n.nonNumericRows,...n.accessorErrorRows].sort((e,t)=>e-t);if(c.length>0&&o.push(Ze({severity:"error",code:"NON_NUMERIC_VALUE",message:`${i} produces ${c.length} non-numeric value${1===c.length?"":"s"} for the ${r.role} role.`,fix:`Bind ${r.accessor} to a numeric field or return finite numbers from the accessor.`,...a,rows:Qe(c),count:c.length})),r.domain&&n.numbers.length>=2){const[e,t]=function(e){let t=1/0,o=-1/0;for(const n of e)t>n&&(t=n),n>o&&(o=n);return[t,o]}(n.numbers);e===t&&o.push(Ze({severity:"warning",code:"ZERO_SPAN_DOMAIN",message:`${i} is constant at ${e}; its ${r.role} scale has a zero-span data domain.`,fix:`Provide varying ${r.role} values, set an explicit extent around ${e}, or use a single-value display.`,...a,rows:Qe(n.finiteRows),count:n.finiteRows.length}))}if(s.includes("positive")){const t=n.numbers.map((e,t)=>({number:e,row:n.finiteRows[t]})).filter(({number:e})=>0>=e).map(({row:e})=>e);if(t.length>0){const n=e.logScale;o.push(Ze({severity:"error",code:n?"LOG_NON_POSITIVE":"NON_POSITIVE_VALUE",message:`${i} contains ${t.length} non-positive value${1===t.length?"":"s"}, which ${n?"cannot be represented on a log scale":"violate the positive-value contract"}.`,fix:n?"Remove or transform values ≤ 0, or use a linear/symlog scale.":"Provide values greater than zero.",...a,rows:Qe(t),count:t.length}))}}if(s.includes("non-negative")&&n.negativeRows.length>0&&o.push(Ze({severity:"error",code:"size"===r.role?"NEGATIVE_SIZE":"NEGATIVE_VALUE",message:`${i} contains ${n.negativeRows.length} negative ${r.role} value${1===n.negativeRows.length?"":"s"}; the chart maps this role to non-negative geometry.`,fix:"Use a non-negative measure, clamp intentionally, or encode sign with position/color instead.",...a,rows:Qe(n.negativeRows),count:n.negativeRows.length})),s.includes("integer")){const e=[...new Set([...n.negativeRows,...n.zeroRows,...n.fractionalRows])].sort((e,t)=>e-t);e.length>0&&o.push(Ze({severity:"error",code:"INVALID_COUNT",message:`${i} contains ${e.length} value${1===e.length?"":"s"} that are not positive integers.`,fix:"Counts must be integers ≥ 1; aggregate, round intentionally, or use a continuous-value encoding.",...a,rows:Qe(e),count:e.length}))}if(s.includes("unit-interval")){const e=n.numbers.map((e,t)=>({number:e,row:n.finiteRows[t]})).filter(({number:e})=>0>e||e>1).map(({row:e})=>e);e.length>0&&o.push(Ze({severity:"error",code:"OUTSIDE_UNIT_INTERVAL",message:`${i} contains ${e.length} value${1===e.length?"":"s"} outside [0, 1].`,fix:`Normalize ${i} to [0, 1] before using it as ${r.role}.`,...a,rows:Qe(e),count:e.length}))}if(t&&r.domain){const t=function(e){const t=e.observation.numbers.map((t,o)=>({value:t,row:e.observation.finiteRows[o]})).sort((e,t)=>e.value-t.value);if(8>t.length)return[];const o=t.map(e=>e.value),n=Fe(o,.25),r=Fe(o,.75),i=Fe(o,.5),s=r-n;if(s>0){const e=n-10*s,o=r+10*s;return t.filter(t=>e>t.value||t.value>o).map(e=>e.row)}const a=100*Math.max(1,Math.abs(i));return t.filter(e=>Math.abs(e.value-i)>a).map(e=>e.row)}(e);t.length>0&&o.push(Ze({severity:"warning",code:"OUTLIER_DOMINATED_DOMAIN",message:`${i} has ${t.length} extreme value${1===t.length?"":"s"} beyond the 10×IQR guardrail; the main distribution may collapse visually.`,fix:"Verify the extreme values, then consider a log scale, robust extent, inset, or explicit annotation rather than silently clipping them.",...a,rows:Qe(t),count:t.length}))}return o}function et(e,t,o){if(!e)return"__all__";try{return Ge(e,t,o)+""}catch{return"__accessor_error__"}}function tt(e,t,o){if(e.whenProp&&!0!==o[e.whenProp])return[];const n=t.find(t=>t.contract.role===e.role);if(!n||0===n.observation.numbers.length)return[];const r=e.groupAccessor?o[e.groupAccessor]:void 0,i="string"==typeof r||"function"==typeof r?r:e.defaultGroupAccessor,s=new Map;for(let e=0;n.rows.length>e;e++){let t;try{t=Ge(n.accessor,n.rows[e],e)}catch{continue}const o=Ve(t,void 0);if(null==o)continue;const r=et(i,n.rows[e],e),a=s.get(r)??{sum:0,magnitude:0,positive:!1,negative:!1,rows:[],negativeRows:[]};a.sum+=o,a.magnitude+=Math.abs(o),a.positive||(a.positive=o>0),a.negative||(a.negative=0>o),a.rows.push(e),0>o&&a.negativeRows.push(e),s.set(r,a)}const a=[],l=[],c=[],u=[],d=[],h=[];for(const[t,o]of s)("positive-total"===e.kind&&0>=o.sum||"normalized-total"===e.kind&&Number.EPSILON*Math.max(1,o.magnitude)*10>=Math.abs(o.sum))&&(a.push(t),u.push(...o.rows)),"normalized-total"===e.kind&&o.positive&&o.negative&&(l.push(t),d.push(...o.rows)),"normalized-total"===e.kind&&o.negative&&(c.push(t),h.push(...o.negativeRows));const f=[];return a.length>0&&f.push(Ze({severity:"error",code:"normalized-total"===e.kind?"ZERO_NORMALIZED_TOTAL":"NON_POSITIVE_TOTAL",message:"normalized-total"===e.kind?`${a.length} normalization group${1===a.length?" has":"s have"} a zero total, so division would be undefined.`:"The part-to-whole total is not positive, so meaningful shares cannot be computed.",fix:"normalized-total"===e.kind?"Remove empty/zero-sum groups or disable normalization.":"Provide at least one positive value and ensure the total is greater than zero.",field:n.accessorLabel,role:e.role,rows:Qe([...new Set(u)].sort((e,t)=>e-t)),count:a.length})),c.length>0&&f.push(Ze({severity:"error",code:"NEGATIVE_NORMALIZED_VALUE",message:`${c.length} normalization group${1===c.length?" contains":"s contain"} negative contributions, so conventional percentage shares are not defined.`,fix:"Use non-negative contributions, a diverging stack, or disable normalization.",field:n.accessorLabel,role:e.role,rows:Qe([...new Set(h)].sort((e,t)=>e-t)),count:h.length})),l.length>0&&f.push(Ze({severity:"warning",code:"MIXED_SIGN_NORMALIZATION",message:`${l.length} normalization group${1===l.length?" mixes":"s mix"} positive and negative contributions; percentage shares may be unstable or misleading.`,fix:"Separate positive and negative contributions, use diverging stacks, or disable normalization.",field:n.accessorLabel,role:e.role,rows:Qe([...new Set(d)].sort((e,t)=>e-t)),count:l.length})),f}function ot(e,t,o,n={}){const r=n.contracts??function(e){return function(){const e=globalThis;return e[Ee]??(e[Ee]={contracts:new Map}),e[Ee]}().contracts.get(e)??De[e]}(e)??function(e){const t=[];for(const[o,n]of Object.entries(qe))"string"!=typeof e[o]&&"function"!=typeof e[o]||t.push({role:n,accessor:o,..."size"===n?{requirements:["finite","non-negative"]}:{},..."x"===n||"y"===n?{domain:!0}:{}});return t.length>0?{fields:t}:void 0}(t);if(!r)return{component:e,ok:!0,rowCount:o?.length??(Array.isArray(t.data)?t.data.length:0),summary:{fieldsChecked:0,errors:0,warnings:0},contracts:[],diagnoses:[]};const i=function(e,t,o){const n=[],r=new Set;for(const i of e.fields){if(i.whenProps?.some(e=>null==t[e]))continue;const e=t[i.accessor],s="string"==typeof e||"function"==typeof e?e:i.defaultAccessor;if("string"!=typeof s&&"function"!=typeof s)continue;const{dataProp:a,rows:l}=xe(i,t,o);if(0===l.length)continue;const c="string"==typeof s?s:i.accessor+"()",u=`${a}:${i.role}:${c}`;if(r.has(u))continue;r.add(u);const d=i.temporalValues??("time"===i.role||"x"===i.role&&"time"===t.xScaleType?"date-like":void 0),h="x"===i.role&&"log"===t.xScaleType||"y"===i.role&&"log"===t.yScaleType,f=Ke(i,t);n.push({contract:i,accessor:s,accessorLabel:c,dataProp:a,rows:l,requirements:f,logScale:h,observation:Ue(l,s,c,d,i.missingValue)})}return n}(r,t,o),s=[],a=!1!==n.checkOutliers;for(const e of function(e,t,o){const n=new Set;for(const r of e.fields){const e=r.dataProp??"data",i=o??t[e];if(!Array.isArray(i))continue;if(0===i.length){n.add(e);continue}const s=ve(r,t);if(!s)continue;const a=i.map(e=>e?.[s]).filter(Array.isArray);a.length>0&&a.every(e=>0===e.length)&&n.add(`${e}.${s}`)}return[...n]}(r,t,o))s.push(Ze({severity:"error",code:"EMPTY_DATA",message:e+" is an explicitly empty array; there are no numeric inputs to render.",fix:`Provide at least one valid row, render an intentional empty state, or omit ${e} when using the ref push API.`,count:0,rows:[]}));const l=new Set(i.filter(e=>e.contract.domain&&1===e.rows.length).map(e=>e.dataProp));for(const e of l)s.push(Ze({severity:"warning",code:"SINGLE_ROW_DOMAIN",message:e+" has one row; a quantitative scale cannot establish variation from a single observation.",fix:"Provide at least two observations or use a single-value display such as BigNumber.",count:1,rows:[0]}));for(const e of i)s.push(...Je(e,a));for(const e of r.aggregates??[])s.push(...tt(e,i,t));const c=s.filter(e=>"error"===e.severity).length,u=s.length-c;return{component:e,ok:0===c,rowCount:i.reduce((e,t)=>Math.max(e,t.rows.length),o?.length??(Array.isArray(t.data)?t.data.length:0)),summary:{fieldsChecked:i.length,errors:c,warnings:u},contracts:i.map(e=>({role:e.contract.role,accessor:e.accessorLabel,dataProp:e.dataProp,requirements:e.requirements,allowMissing:!0===e.contract.allowMissing,...void 0!==e.contract.missingValue?{missingValue:e.contract.missingValue}:{},domain:!0===e.contract.domain})),diagnoses:s}}var nt=l({"src/components/data/auditData.ts"(){_(),Oe(),Be(),ze(),We=5,qe={xAccessor:"x",yAccessor:"y",valueAccessor:"value",sizeBy:"size",sizeAccessor:"size",radiusAccessor:"size",countAccessor:"count",amountAccessor:"value",highAccessor:"high",lowAccessor:"low",openAccessor:"open",closeAccessor:"close",lowerAccessor:"lower",upperAccessor:"upper",positiveAccessor:"value",negativeAccessor:"value",progressAccessor:"value",confidenceAccessor:"value",costAccessor:"value",throughputAccessor:"value"}}}),rt={};function it(e,t){if(!t||!e?.component||!e.props)return[];const o="object"==typeof t?t:{};try{return function(e,t={}){const o=Number.isFinite(t.max)?Math.max(0,Math.floor(t.max)):6,n=e.diagnoses.map((e,t)=>({item:e,diagnosisIndex:t})).filter(({item:e})=>!t.errorsOnly||"error"===e.severity),r=n.slice(0,o).map(({item:e,diagnosisIndex:t})=>({id:`data-audit:${e.code}:${e.role??"chart"}:${e.field??"chart"}:${t}`,level:e.severity,title:e.field?`${He(e)} · ${e.field}`:He(e),message:e.fix?`${e.message} ${e.fix}`:e.message,source:"Semiotic data audit",dismissible:!0}));return n.length>o&&r.push({id:"data-audit:overflow:chart",level:n.slice(o).some(({item:e})=>"error"===e.severity)?"error":"warning",title:`${n.length-o} more numeric finding${n.length-o===1?"":"s"}`,message:"Run auditData() or diagnoseConfig() to inspect the complete report.",source:"Semiotic data audit",dismissible:!0}),r}(ot(e.component,e.props,void 0,{checkOutliers:o.checkOutliers}),{max:o.max,errorsOnly:o.errorsOnly})}catch{return[]}}c(rt,{buildChartDataAuditNotifications:()=>it});var st,at=l({"src/components/chartContainerDataAudit.ts"(){nt(),Ye()}}),lt={};c(lt,{AccessibleNavTree:()=>BM,AnnotationLabel:()=>ra,AreaChart:()=>tv,BarChart:()=>yx,BoxPlot:()=>Yx,BubbleChart:()=>pv,BumpChart:()=>Kb,CARBON_ALERT:()=>Ig,CARBON_CATEGORICAL_14:()=>Tg,COLOR_BLIND_SAFE_CATEGORICAL:()=>Mt,CandlestickChart:()=>rx,CategoryColorProvider:()=>dg,ChartContainer:()=>R_,ChartErrorBoundary:()=>up,ChartGrid:()=>W_,ChordDiagram:()=>Fk,CirclePack:()=>eA,CircularBrush:()=>eP,ConnectedScatterplot:()=>kb,ContextLayout:()=>G_,DARK_THEME:()=>Pt,DetailsPanel:()=>cP,DifferenceChart:()=>iv,DirectManipulationControl:()=>iP,DonutChart:()=>fk,DotPlot:()=>ak,ForceDirectedGraph:()=>Ek,FunnelChart:()=>rk,GaugeChart:()=>wk,GroupedBarChart:()=>Ck,HIGH_CONTRAST_THEME:()=>Rt,Heatmap:()=>hv,Histogram:()=>Ux,IncrementalExtent:()=>$t,IntentMark:()=>CP,LIGHT_THEME:()=>_t,LikertChart:()=>Nx,LineChart:()=>_b,LinkedCharts:()=>vy,MinimapChart:()=>Bv,MobileAnnotationCalloutList:()=>EP,MobileChartContainer:()=>I_,MobileStandardControls:()=>ZM,MultiAxisLineChart:()=>tx,MultiLineTooltip:()=>Dc,MultiPointTooltip:()=>Fc,NetworkCustomChart:()=>ax,OrbitDiagram:()=>rA,OrdinalCustomChart:()=>ux,PieChart:()=>uk,ProcessSankey:()=>YS,QuadrantChart:()=>Vv,RealtimeHeatmap:()=>GA,RealtimeHistogram:()=>NA,RealtimeLineChart:()=>LA,RealtimeSwarmChart:()=>FA,RealtimeTemporalHistogram:()=>EA,RealtimeWaterfallChart:()=>WA,RidgelinePlot:()=>tk,RingBuffer:()=>It,SankeyDiagram:()=>Wk,Scatterplot:()=>yb,ScatterplotMatrix:()=>Lv,SmallMultipleChart:()=>F_,StackedAreaChart:()=>lv,StackedBarChart:()=>xx,StreamNetworkFrame:()=>tg,StreamOrdinalFrame:()=>Zh,StreamXYFrame:()=>Ld,SwarmPlot:()=>Fx,SwimlaneChart:()=>Pk,THEME_PRESETS:()=>$g,TemporalHistogram:()=>DA,ThemeProvider:()=>Hg,Tooltip:()=>Nc,TreeDiagram:()=>XS,Treemap:()=>QS,VISUALIZATION_CONTROL_TYPES:()=>aC,ViolinPlot:()=>Zx,XYCustomChart:()=>Nb,adaptiveTimeTicks:()=>eC,annotationStableId:()=>Qs,auditVisualizationControls:()=>uC,buildNavigationTree:()=>wM,clampMobileRange:()=>HM,compileMotionEncoding:()=>Io,composeStyleRules:()=>eb,configToJSX:()=>$C,copyConfig:()=>IC,createControlObservationAdapter:()=>lC,createHatchPattern:()=>Jr,darkenColor:()=>Y,deriveMotionVector:()=>Eo,deserializeSelections:()=>DC,diagnoseProcessSankeyLayout:()=>tS,diagnoseProcessSankeyProps:()=>nS,estimateLabelWidth:()=>na,explainProcessSankeyLayout:()=>oS,exportChart:()=>tC,formatProcessSankeyIssue:()=>Kk,fromConfig:()=>jC,fromURL:()=>TC,fromVegaLite:()=>HC,hatchFillId:()=>ni,hatchPatternDef:()=>ii,intentManifestFromRecipe:()=>SP,inventoryAtTime:()=>rS,isHatchFill:()=>ti,isMultiTooltip:()=>Ec,lightenColor:()=>G,makeNodeRuleContext:()=>Uy,makeRuleValueResolver:()=>Vy,makeStyleRuleStyleFn:()=>tb,makeXYRuleContext:()=>Xy,matchesThreshold:()=>Qy,normalizeTooltip:()=>zc,opacityFromAge:()=>No,rankBumpData:()=>qb,resolveMotionAccessor:()=>To,resolveMotionAge:()=>$o,resolveMotionVector:()=>Do,resolveMultiCapableTooltip:()=>Bc,resolveResponsiveRules:()=>Gg,resolveStyleRules:()=>Jy,resolveSvgFill:()=>si,resolveThemePreset:()=>Ng,responsiveRuleMatches:()=>Yg,ruleMatches:()=>Zy,serializeSelections:()=>NC,smartTickFormat:()=>VA,smartTooltipEntries:()=>jc,styleRulesToNodeStyle:()=>ob,styleRulesToPieceStyle:()=>rb,styleRulesToXYStyle:()=>nb,summarizeIntentManifest:()=>wP,syncPushBuffer:()=>$P,themeToCSS:()=>jg,themeToTokens:()=>Lg,toConfig:()=>RC,toProcessSankeyTime:()=>iS,toURL:()=>LC,useBrushSelection:()=>_g,useCategoryColors:()=>hg,useChartObserver:()=>sy,useCustomLayoutSelection:()=>Ar,useFilteredData:()=>Pg,useForceLayout:()=>xP,useLinkedChartsActive:()=>uy,useLinkedHover:()=>Cg,useMobileRangeControls:()=>qM,useNavigationSync:()=>TP,useSelection:()=>Sg,useSelectionActions:()=>Ag,useSyncedPushData:()=>NP,useTheme:()=>Wg,validateProcessSankey:()=>Uk,zoomMobileRange:()=>WM}),module.exports=(st=lt,u(n({},"__esModule",{value:!0}),st));var ct=d(require("react")),ut=require("react"),dt=d(require("react")),ht=require("react/jsx-runtime"),ft=null,mt=null;function pt(e){const[t,o]=dt.useState(()=>ft);return dt.useEffect(()=>{if(t)return;let e=!1;return(ft?Promise.resolve(ft):(mt||(mt=Promise.resolve().then(()=>(A(),b)).then(e=>ft=e.XYBrushOverlay).catch(e=>{throw mt=null,e})),mt)).then(t=>{e||o(()=>t)}),()=>{e=!0}},[t]),t?(0,ht.jsx)(t,{...e}):null}var gt=Object.freeze([]);function yt(e){if(!e)return gt;let t=!1;for(let o=0;e.length>o;o++){const n=e[o];if(null==n||"object"!=typeof n){t=!0;break}}if(!t)return e;const o=[];for(const t of e)null!=t&&"object"==typeof t&&o.push(t);return o}var bt=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=yt(e),this.lastBoundedData===e)return;if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,totalSize:e.length});let t=this.chunkSize;const o=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const n=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,n),bounded:!1}),t=n,this.chunkTimer=e.length>t?requestAnimationFrame(o):0};this.chunkTimer=requestAnimationFrame(o)}setReplacementData(e){if(e=yt(e),this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.pushBuffer=[],this.flushScheduled=!1,this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0,preserveCategoryOrder:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,preserveCategoryOrder:!0,totalSize:e.length});let t=this.chunkSize;const o=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const n=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,n),bounded:!1}),t=n,this.chunkTimer=e.length>t?requestAnimationFrame(o):0};this.chunkTimer=requestAnimationFrame(o)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const e=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:e,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(e){null!=e&&"object"==typeof e&&(this.pushBuffer.push(e),this.scheduleFlush())}pushMany(e){if(0===e.length)return;let t=0;for(let o=0;e.length>o;o++){const n=e[o];null!=n&&"object"==typeof n&&(this.pushBuffer.push(n),t++)}0!==t&&this.scheduleFlush()}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}},vt=require("react"),xt=require("react/jsx-runtime");function kt(e){let t=null;const o=()=>(t||(t=(0,vt.createContext)(null)),t),n=wt(e);return[function({children:t,initialState:n}){const r=(0,vt.useRef)(n),i=(0,vt.useMemo)(()=>wt(e,r.current),[]),s=o();return(0,xt.jsx)(s.Provider,{value:i,children:t})},(e,t)=>{const r=o(),i=(0,vt.useContext)(r)??n,s=(0,vt.useRef)(e);s.current=e;const a=(0,vt.useRef)({hasValue:!1,value:void 0}),l=(0,vt.useCallback)(()=>{const e=s.current(i.getState()),o=a.current;return o.hasValue&&t&&t(o.value,e)?o.value:(a.current={hasValue:!0,value:e},e)},[i,t]),c=(0,vt.useCallback)(()=>s.current(i.getState()),[i]);return(0,vt.useSyncExternalStore)(i.subscribe,l,c)}]}function wt(e,t){const o=new Set;let n={...e(function(e){const t=e(n);if(St(t)){n={...n,...t};for(const e of o)e()}}),...t??{}};return{getState:()=>n,subscribe:function(e){return o.add(e),()=>{o.delete(e)}}}}function St(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function At(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 Ct(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t={...t,colors:{...t.colors,categorical:Mt}}),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 Mt=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],_t={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}},Pt={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}},Rt={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:Mt,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 jt(e,t){if("light"===t)return _t;if("dark"===t)return Pt;if("high-contrast"===t)return Rt;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?Pt:_t;return Ct({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}return Ct({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}var[Lt,Tt]=kt(e=>({theme:_t,setTheme(t){e(e=>({theme:jt(e.theme,t)}))}})),It=class{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const o of e){const e=this.push(o);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;return{next:()=>this._size>e?{done:!1,value:this.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let o=0;this._size>o;o++)e(this.buffer[(t+o)%this._capacity],o)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let o=0;this._size>o;o++)e[o]=this.buffer[(t+o)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray();let o=0,n=[];t.length>e&&(o=t.length-e,n=t.slice(0,o)),this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(let e=o;t.length>e;e++)this.push(t[e]);return n}update(e,t){const o=[],n=(this.head-this._size+this._capacity)%this._capacity;for(let r=0;this._size>r;r++){const i=(n+r)%this._capacity,s=this.buffer[i];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:{...s},o.push(e),this.buffer[i]=t(s)}}return o}remove(e){const t=[],o=[];if(this.forEach(n=>{e(n)?o.push(n):t.push(n)}),0===o.length)return o;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return o}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}},$t=class{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(e){Number.isFinite(e)&&(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}evict(e){e!==this._min&&e!==this._max||(this._dirty=!0)}recalculate(e,t){this._min=1/0,this._max=-1/0;for(const o of e){const e=t?t(o):o;Number.isFinite(e)&&(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}this._dirty=!1}clear(){this._min=1/0,this._max=-1/0,this._dirty=!1}get extent(){return[this._min,this._max]}get min(){return this._min}get max(){return this._max}get dirty(){return this._dirty}};function Nt(e,t){return e===t}function Dt(e,t){if("function"==typeof e)return t=>+e(t);const o=e||t;return e=>+e[o]}function Et(e,t){if("function"==typeof e)return e;const o=e||t;return e=>e[o]}function Ot(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}function Bt(e){return e?"function"==typeof e?e:t=>t[e]||t.id:null}function Ft(e){return"string"==typeof e?e:e.id}function zt(e){return new Set(Array.isArray(e)?e:[e])}_();var Ht=require("d3-scale");function Wt(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function qt(e,t,o){const n=e=>e.toString(16).padStart(2,"0");return`#${n(e)}${n(t)}${n(o)}`}function Yt(e){const t=e.map(Wt),o=t.length-1;return e=>{if(0>=e){const[e,o,n]=t[0];return qt(e,o,n)}if(e>=1){const[e,n,r]=t[o];return qt(e,n,r)}const n=e*o,r=Math.floor(n),i=n-r,[s,a,l]=t[r],[c,u,d]=t[r+1];return qt(Math.round(s+(c-s)*i),Math.round(a+(u-a)*i),Math.round(l+(d-l)*i))}}var Gt=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Vt=Yt(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),Xt=Yt(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),Ut=Yt(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),Kt=Yt(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),Qt=Yt(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),Zt=Yt(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),Jt=Yt(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),eo=Yt(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),to=Yt(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),oo=Yt(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),no=Yt(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),ro=Yt(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]),io={blues:Vt,reds:Xt,greens:Ut,viridis:Jt,oranges:Kt,purples:Qt,greys:Zt,plasma:eo,inferno:to,magma:oo,cividis:no,turbo:ro};function so(e){return e&&io[e]||Vt}var ao=Yt(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),lo=Yt(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),co=Yt(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),uo=Yt(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),ho=Yt(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),fo=Yt(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),mo=Yt(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]),po={category10:Gt,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],...io},go=Gt,yo="#007bff";function bo(e,t,o=go){if(e&&"object"==typeof e&&!Array.isArray(e)){const t=Object.values(e).filter(e=>"string"==typeof e&&e.length>0);if(t.length>0)return t}if(Array.isArray(e)&&e.length>0)return e;if("string"==typeof e){const t=po[e];if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:o}var vo=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],xo=["#f0f0f0","#b5d4ea","#f4c2a1","#b8dab2","#d4b5e0","#f9e0a2","#a8d8d8"],ko=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 wo(e,t,o){if("function"==typeof t){const n=t(e);return o&&n&&"string"==typeof n&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||ko.has(t)}(n)?o(n):n}const n=e?.[t]+"";return o?o(n):go[Math.abs(function(e){let t=0;for(let o=0;e.length>o;o++)t=(t<<5)-t+e.charCodeAt(o),t&=t;return Math.abs(t)}(n))%go.length]}function So(e,t){if(null==t||!Object.prototype.hasOwnProperty.call(e,t))return;const o=e[t];return"string"==typeof o&&o.length>0?o:void 0}function Ao(e,t,o="category10"){if(o&&"object"==typeof o&&!Array.isArray(o)){const e=o;return t=>So(e,t)??"#999"}const n=Array.from(new Set(e.map(e=>e?.[t]).filter(e=>null!=e).map(e=>e+""))),r=n.every(e=>!isNaN(Number(e)));if(Array.isArray(o))return(0,Ht.scaleOrdinal)().domain(n).range(o).unknown("#999");const i=po[o]||po.category10;if(r&&"function"==typeof i){let e=-1/0;for(const t of n){const o=Number(t);o>e&&(e=o)}return t=>i(Number(t)/e)}{const e=Array.isArray(i)?i:go;return(0,Ht.scaleOrdinal)().domain(n).range(e).unknown("#999")}}function Co(e,t,o=[3,20],n){let r;if(r="function"==typeof t?t(e):e?.[t],!n)return r;const[i,s]=n,[a,l]=o;if(s===i)return(a+l)/2;let c=(r-i)/(s-i);return 0>c?c=0:c>1&&(c=1),a+c*(l-a)}function Mo(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}function _o(e,t){return Math.min((e-t.startTime)/t.duration,1)}function Po(e,t,o){return e+(t-e)*o}function Ro(){return"undefined"!=typeof performance?performance.now():Date.now()}var jo={fresh:1,aging:1.5,stale:3};function Lo(e,t,o={}){return Number.isFinite(t)&&t>0?Number.isNaN(e)?"fresh":e===1/0?"expired":0>e||t*(o.fresh??jo.fresh)>e?"fresh":t*(o.aging??jo.aging)>e?"aging":t*(o.stale??jo.stale)>e?"stale":"expired":"fresh"}function To(e,t,o){if(null!=e)return"function"==typeof e?e(t,o):"object"==typeof e&&null!==e&&"constant"in e?e.constant:t[e]}function Io(e){const{data:t,encoding:o}=e,n=[],r=new Map;return t.forEach((e,t)=>{const i=To(o.id,e,t);if(null==i||""===i)throw Error(`[semiotic] Motion encoding row ${t} resolved an empty id.`);const s=i+"";if(r.has(s))throw Error(`[semiotic] Duplicate motion encoding id "${s}".`);const a=To(o.process?.group,e,t),l=To(o.process?.stage,e,t),c=To(o.accessible?.group,e,t)??(null!=a?a+"":null!=l?l+"":void 0),u={};for(const n of Object.keys(o.evidence??{}))u[n]=To(o.evidence?.[n],e,t);const d={id:s,datum:e,time:{arrival:To(o.time?.arrival,e,t),basis:o.time?.basis,unit:o.time?.unit},placement:{x:To(o.placement?.x,e,t),y:To(o.placement?.y,e,t),lane:To(o.placement?.lane,e,t),space:o.placement?.space},kinematics:{velocityX:To(o.kinematics?.velocityX,e,t),velocityY:To(o.kinematics?.velocityY,e,t),space:o.kinematics?.space},process:{group:a,stage:l,target:To(o.process?.target,e,t),work:To(o.process?.work,e,t)},evidence:u,accessible:{description:To(o.accessible?.description,e,t),group:c,label:To(o.accessible?.label,e,t)??s}};n.push(d),r.set(s,d)}),{rows:n,byId:r}}function $o(e){const t=e.now-e.arrival;return{age:t,progress:Number.isFinite(t)&&Number.isFinite(e.ttl)&&e.ttl>0?Math.max(0,t)/e.ttl:t===1/0&&Number.isFinite(e.ttl)&&e.ttl>0?1/0:0,lifecycle:Lo(t,e.ttl,e.thresholds)}}function No(e){const t=Math.max(0,Math.min(1,e.minOpacity??.1));if(Number.isNaN(e.age))return 1;if(e.age===1/0)return t;if(!Number.isFinite(e.extent)||0>=e.extent)return 1;const o=Math.max(0,e.age);if("step"===e.type)return(e.threshold??.5*e.extent)>o?1:t;if("exponential"===e.type){const n=e.halfLife??e.extent/2;return t+Math.pow(.5,o/(n>0?n:e.extent/2))*(1-t)}return t+Math.max(0,Math.min(1,1-o/e.extent))*(1-t)}function Do(e,t){const o=Number.isFinite(e)?e:0,n=Number.isFinite(t)?t:0;return{velocityX:o,velocityY:n,speed:Math.hypot(o,n),direction:Math.atan2(n,o)}}function Eo(e,t,o){return Number.isFinite(o)&&o>0?Do((t.x-e.x)/o,(t.y-e.y)/o):Do(0,0)}function Oo(e,t,o){if(1>=o)return 1;const n=o-1;return No({age:n-t,extent:n,type:e.type,halfLife:e.halfLife??o/2,threshold:e.stepThreshold??.5*o,minOpacity:e.minOpacity??.1})}function Bo(e){const t=new Map;for(let o=0;e.length>o;o++)t.set(e[o],o);return t}function Fo(e,t,o){const n=e.duration??500,r=o-t;return n>r?1-r/n:0}function zo(e,t,o,n){let r=!1;return t>0?(e._pulseIntensity!==t&&(e._pulseIntensity=t,r=!0),e._pulseColor!==o&&(e._pulseColor=o,r=!0),e._pulseGlowRadius!==n&&(e._pulseGlowRadius=n,r=!0),r):(0!==e._pulseIntensity&&(e._pulseIntensity=0,r=!0),void 0!==e._pulseColor&&(e._pulseColor=void 0,r=!0),void 0!==e._pulseGlowRadius&&(e._pulseGlowRadius=void 0,r=!0),r)}function Ho(e,t,o=("undefined"!=typeof performance?performance.now():Date.now())){if(!t||0===t.size)return!1;const n=e.duration??500,r=t.peek();return null!=r&&n>o-r}function Wo(e,t,o){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 o=e.getX(t.datum),n=e.getY(t.datum);if(e.getCategory)return`p:${e.getCategory(t.datum)}:${o}:${n}`;if(null!=o&&null!=n)return`p:${o}:${n}`}return"p:"+o;case"glyph":return t.pointId?"g:"+t.pointId:"g:"+o;case"rect":return`r:${t.group||""}:${t.datum?.binStart??t.datum?.category??o}`;case"heatcell":return`h:${t.x}_${t.y}`;case"candlestick":return null==t.datum?"c:"+o:"c:"+e.getX(t.datum);case"line":return"l:"+(t.group||"_default");case"area":return"a:"+(t.group||"_default");default:return null}}function qo(e){return e?null!=e.opacity?e.opacity:null!=e.fillOpacity?e.fillOpacity:1:1}function Yo(e,t,o,n,r,i){const s=[];for(const r of e){const e=o(r),i=n(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 Go(e,t,o,n,r,i,s,a){const l=[];for(const i of e){const e=o(i),s=n(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),rawY:s})}l.sort((e,t)=>e.px-t.px);const c=Array(l.length),u=Array(l.length),d=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],d[e]=t.rawY}return{type:"area",topPath:c,bottomPath:u,rawValues:d,style:i,datum:e,group:s}}function Vo(e,t,o,n){const r=new Map;if("silhouette"===n)for(const n of e){let e=0;for(const r of t)e+=o(r,n)||0;r.set(n,-e/2)}else if("wiggle"===n){e.length>0&&r.set(e[0],0);for(let n=1;e.length>n;n++){const i=e[n-1],s=e[n];let a=0,l=0,c=0;for(const e of t){const t=o(e,s)||0;a+=(2*c+t)*(t-(o(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 n=0;for(const i of e){let e=0;for(const n of t)e+=o(n,i)||0;n+=(r.get(i)??0)+e/2}const i=n/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 Xo(e,t,o,n,r,i,s){const a=o(e),l=n(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 Uo(e,t,o,n,r,i,s,a){const l=o(e),c=n(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 Ko(e,t,o,n,r,i,s){return{type:"rect",x:e,y:t,w:o,h:n,style:r,datum:i,group:s}}function Qo(e,t,o,n,r,i,s){const a={type:"heatcell",x:e,y:t,w:o,h:n,fill:r,datum:i};return s?.showValues&&(a.showValues=!0,a.value=s.value,s.valueFormat&&(a.valueFormat=s.valueFormat)),a}function Zo(e,t,o,n){return"function"==typeof t.style?t.style(n||{},o):t.style&&"object"==typeof t.style?t.style:e.resolveBoundsStyle(o,n)}function Jo(e,t,o,n){if(!e.scales)return null;const r=[],i=[];for(const o of t){const t=e.getX(o);if(!Number.isFinite(t))continue;const s=n.getTop(o),a=n.getBottom(o);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,...e.config.curve&&"linear"!==e.config.curve&&{curve:e.config.curve},style:Zo(e,n,o,t[0]),datum:t,group:o,interactive:n.interactive}}function en(e){const t=[],o=[];if(!e)return{perSeries:t,aggregate:o};for(const n of e)n.perSeries?t.push(n):o.push(n);return{perSeries:t,aggregate:o}}function tn(e,t,o){const n=[];for(const r of o){const o=Jo(e,t,"__ribbon_aggregate",r);o&&n.push(o)}return n}function on(e,t,o,n){const r=[];for(const i of n){const n=Jo(e,t,o,i);n&&r.push(n)}return r}function nn(e,t){if(!e)return{};if(!t||0===t.length)return e;const o=[];for(const n of t){if("band"!==n.kind)continue;const t=n.getTop(e),r=n.getBottom(e);Number.isFinite(r)&&Number.isFinite(t)&&o.push({y0:r,y1:t})}return 0===o.length?e:{...e,band:o[0],bands:o}}function rn(e,t,o,n){if(!e.config.pointStyle)return;const r=n??e.getY;for(const n of t){const t=e.resolveGroupColor(n.key);for(const i of n.data){let n=e.config.pointStyle(i);!n.fill&&t&&(n={...n,fill:t});const s=n.r??3,a=e.getPointId?e.getPointId(i)+"":void 0,l=Xo(i,e.scales,e.getX,r,s,n,a);l&&o.push(l)}}}function sn(e){return"threshold"===e.type&&"string"==typeof e.color&&"number"==typeof e.value}var an={stops:[{offset:0,opacity:.8},{offset:1,opacity:.05}]};function ln(e,t=an){if(e)return!0===e?t:"stops"in e?Array.isArray(e.stops)?e:void 0:"colorStops"in e?Array.isArray(e.colorStops)?{stops:e.colorStops.map(({offset:e,color:t})=>({offset:e,color:t}))}:void 0:{stops:[{offset:0,opacity:e.topOpacity??t.stops[0]?.opacity??.8},{offset:1,opacity:e.bottomOpacity??t.stops.at(-1)?.opacity??.05}]}}function cn(e){return e?ln(e):void 0}function un(e){return ln(e)}var dn=require("d3-shape"),hn={circle:dn.symbolCircle,square:dn.symbolSquare,triangle:dn.symbolTriangle,diamond:dn.symbolDiamond,star:dn.symbolStar,cross:dn.symbolCross,wye:dn.symbolWye},fn=["circle","triangle","diamond","star","square","chevron","cross","wye"];function mn(e,t,o){if(o)return o;const n=e??"circle";return"chevron"===n?function(e){const t=1.5*pn(e),o=.92*t;return`M0,${-t}L${o},${(.78*t).toFixed(3)}L0,${(.28*t).toFixed(3)}L${-o},${(.78*t).toFixed(3)}Z`}(t):(0,dn.symbol)(hn[n]??dn.symbolCircle,Math.max(1,t))()??""}function pn(e){return Math.sqrt(Math.max(1,e)/Math.PI)}function gn(e,t){const o=new Map;let n=0;return r=>{const i=e(r)+"",s=t?.[i];if(s)return s;let a=o.get(i);return a||(a=fn[n%fn.length],n++,o.set(i,a)),a}}var yn=new Map;function bn(e,t,o){const n=o.config.areaStyle?.(t);return n&&(e.style=n),e}function vn(e,t,o,n,r){const i=new Map;for(const s of e){const e=t(s),a=o(s);if(null==e||null==a||Number.isNaN(e)||Number.isNaN(a))continue;const l=Math.floor(e/n)*n;let c=i.get(l);if(c||(c={start:l,end:l+n,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 xn(e){if("production"===process.env.NODE_ENV)return;const{label:t,nodes:o,overlays:n,warned:r}=e;kn(n)&&0===o.length&&wn(r,"overlay-only",`[semiotic] ${t} returned overlays but no data-bearing scene nodes. Overlays do not participate in hover, selection, transitions, SSR evidence, or accessibility tables. Emit at least one scene node with a datum, or mark the overlay-only chart as intentionally decorative.`),o.length>0&&o.every(e=>null==e.datum)&&wn(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.`)}function kn(e){return null!=e&&!1!==e&&""!==e&&(!Array.isArray(e)||e.some(kn))}function wn(e,t,o){e.has(t)||(e.add(t),console.warn(o))}function Sn(e,t,o,n){const r=function(e){if(e instanceof Error)return{name:e.name||"Error",message:e.message||"Custom layout threw."};if("string"==typeof e)return{name:"Error",message:e};if(null==e)return{name:"Error",message:"Custom layout threw a nullish value."};try{return{name:"Error",message:e+""}}catch{return{name:"Error",message:"Custom layout threw a non-stringifiable value."}}}(t),i="network"===e?"customNetworkLayout":"customLayout";return{code:"CUSTOM_LAYOUT_ERROR",severity:"error",phase:"layout",component:e,source:i,message:`Semiotic ${e} ${i} failed: ${r.message}`,error:r,recovery:o?"preserved-last-good-scene":"empty-scene",preservedLastGoodScene:o,affectedRevision:n}}function An(e,t){const o="function"==typeof e?e:o=>o[e||t];return e=>{const t=o(e);return null==t?NaN:+t}}function Cn(e){const t=[],o=["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode,n=An(o&&e.valueAccessor||e.yAccessor,o?"value":"y");if(e.boundsAccessor){const o=Dt(e.boundsAccessor,"bounds");t.push({kind:"bounds",getTop:e=>{const t=n(e);if(!Number.isFinite(t))return NaN;const r=o(e);return Number.isFinite(r)&&0!==r?t+r:t},getBottom:e=>{const t=n(e);if(!Number.isFinite(t))return NaN;const r=o(e);return Number.isFinite(r)&&0!==r?t-r:t},style:e.boundsStyle,perSeries:!0,interactive:!1})}if(e.band){const o=Array.isArray(e.band)?e.band:[e.band];for(const e of o)t.push({kind:"band",getTop:An(e.y1Accessor,"y1"),getBottom:An(e.y0Accessor,"y0"),style:e.style,perSeries:!1!==e.perSeries,interactive:!0===e.interactive})}return t}var Mn=require("d3-scale");function _n(e,t){return t?[t[0]??e[0],t[1]??e[1]]:e}function Pn(e,t,o){if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return(0,Mn.scaleLog)().domain(e).range(o).clamp(!0)}return"symlog"===e?(0,Mn.scaleSymlog)().domain(t).range(o):"time"===e?(0,Mn.scaleTime)().domain([new Date(t[0]),new Date(t[1])]).range(o):(0,Mn.scaleLinear)().domain(t).range(o)}function Rn(e,t,o){t>e.capacity&&(e.resize(t),o&&t>o.capacity&&o.resize(t))}function jn(e,t){const o=new It(e.capacity);return e.forEach(()=>o.push(t)),o}function Ln(e,t,o,n){const r=e.push(t);return o&&o.push(n),r}function Tn(e,t,o){if(!t||0===t.size)return;const n=new Set;if(e.forEach((e,t)=>{o(e)&&n.add(t)}),0===n.size)return;const r=t.toArray();t.clear();for(let e=0;r.length>e;e++)n.has(e)||t.push(r[e])}var In=new WeakMap;function $n(){return this.updateResults.last}function Nn(){return this.updateResults.last}function Dn(e){return this.updateResults.subscribe(e)}function En(e){this.config.layoutSelection=e}function On(){In.set(this,!0)}function Bn(){const e=!0===In.get(this);return In.delete(this),e}function Fn(e){Object.assign(e.prototype,{getLastUpdateResult:$n,getUpdateSnapshot:Nn,subscribeUpdateResult:Dn,setLayoutSelection:En,markStylePaintPending:On,consumeStylePaintPending:Bn})}var zn={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 Hn(e,t){const o={...e};for(const e of t)o[zn[e]]++;return o}function Wn(e,t,o){const n=new Set(t);return{changeSet:{...e,...e.keys?{keys:[...e.keys]}:{}},changed:n,revisions:Hn(o,n)}}var qn=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=Wn({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 o=Wn(e,t,this.revisions);this.revisions=o.revisions,this.latest=o;for(const e of[...this.listeners])e();return o}},Yn=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Gn=["scene-style","data-paint","accessibility","evidence"],Vn=(e,t)=>({retainedData:e,invalidations:t}),Xn=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Un=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Kn=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Qn=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Zn=["scene-geometry","data-paint","accessibility","evidence"],Jn=["scene-style","data-paint","accessibility","evidence"],er=[],tr={chartType:Vn("rebuild",Xn),runtimeMode:Vn("rebuild",Xn),xAccessor:Vn("rebuild",Xn),yAccessor:Vn("rebuild",Xn),timeAccessor:Vn("rebuild",Xn),valueAccessor:Vn("rebuild",Xn),y0Accessor:Vn("rebuild",Xn),boundsAccessor:Vn("rebuild",Xn),band:Vn("rebuild",Xn),openAccessor:Vn("rebuild",Xn),highAccessor:Vn("rebuild",Xn),lowAccessor:Vn("rebuild",Xn),closeAccessor:Vn("rebuild",Xn),candlestickRangeMode:Vn("rebuild",Xn),accessorRevision:Vn("rebuild",Xn),groupAccessor:Vn("rebuild",Un),categoryAccessor:Vn("rebuild",Un),lineDataAccessor:Vn("rebuild",Un),colorAccessor:Vn("rebuild",Jn),sizeAccessor:Vn("rebuild",Zn),symbolAccessor:Vn("rebuild",Zn),pointIdAccessor:Vn("rebuild",Zn),xScaleType:Vn("preserve",Kn),yScaleType:Vn("preserve",Kn),xExtent:Vn("preserve",Kn),yExtent:Vn("preserve",Kn),extentPadding:Vn("preserve",Kn),scalePadding:Vn("preserve",Kn),axisExtent:Vn("preserve",Kn),yAxisExtent:Vn("preserve",Kn),binSize:Vn("preserve",Kn),normalize:Vn("preserve",Kn),heatmapAggregation:Vn("preserve",Kn),heatmapXBins:Vn("preserve",Kn),heatmapYBins:Vn("preserve",Kn),arrowOfTime:Vn("preserve",Qn),baseline:Vn("preserve",Qn),stackOrder:Vn("preserve",Qn),sizeRange:Vn("preserve",Qn),curve:Vn("preserve",Qn),areaGroups:Vn("preserve",Qn),customLayout:Vn("preserve",Qn),layoutConfig:Vn("preserve",Qn),layoutMargin:Vn("preserve",Qn),symbolMap:Vn("preserve",Zn),showValues:Vn("preserve",Zn),heatmapValueFormat:Vn("preserve",Zn),lineStyle:Vn("preserve",Jn),pointStyle:Vn("preserve",Jn),areaStyle:Vn("preserve",Jn),barStyle:Vn("preserve",Jn),swarmStyle:Vn("preserve",Jn),waterfallStyle:Vn("preserve",Jn),candlestickStyle:Vn("preserve",Jn),boundsStyle:Vn("preserve",Jn),gradientFill:Vn("preserve",Jn),lineGradient:Vn("preserve",Jn),semanticLineStops:Vn("preserve",Jn),colorScheme:Vn("preserve",Jn),themeCategorical:Vn("preserve",Jn),themeSemantic:Vn("preserve",Jn),themeSequential:Vn("preserve",Jn),themeDiverging:Vn("preserve",Jn),barColors:Vn("preserve",Jn),decay:Vn("preserve",Jn),pulse:Vn("preserve",Jn),staleness:Vn("preserve",Jn),layoutSelection:Vn("preserve",Jn),annotations:Vn("preserve",["overlay","accessibility","evidence"]),windowSize:Vn("preserve",er),windowMode:Vn("preserve",er),maxCapacity:Vn("preserve",er),clock:Vn("preserve",er),transition:Vn("preserve",er),introAnimation:Vn("preserve",er),onLayoutError:Vn("preserve",er)},or=Vn("preserve",Qn),nr=class{constructor(){this.tracker=new qn}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}},Yn)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},Gn):this.recordNoop("restyle")}recordConfig(e){const t=function(e){let t="preserve";const o=new Set;for(const n of e){const e=tr[n]??or;"rebuild"===e.retainedData&&(t="rebuild");for(const t of e.invalidations)o.add(t)}return{retainedData:t,invalidations:o}}(e);return this.tracker.record({kind:"config",keys:e},t.invalidations)}},rr=require("d3-quadtree"),ir=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 o=0,n=0;for(const e of t)"point"===e.type&&(o++,e.r>n&&(n=e.r));if(this.maxRadius=n,500>=o)return void(this.tree=null);const r=Array(o);let i=0;for(const e of t)"point"===e.type&&(r[i++]=e);this.tree=(0,rr.quadtree)().x(e=>e.x).y(e=>e.y).addAll(r)}},sr=class e{constructor(e){if(this.xExtent=new $t,this.yExtent=new $t,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 nr,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 ir,this._lastBoundedInsertsRef=null,this.applyPulse=(e,t,o)=>!(!this.config.pulse||!this.timestampBuffer)&&function(e,t,o,n,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;o.length>t;t++)e.set(o[t],t);return e})();for(const o of t){if("line"===o.type)continue;if("area"===o.type){const t=Array.isArray(o.datum)?o.datum:[o.datum];let r=0,a=!1;for(const o of t){const t=c.get(o);if(null==t)continue;a=!0;const s=n.get(t);if(null==s)continue;const l=Fo(e,s,i);l>r&&(r=l)}a&&(l=zo(o,r,s)||l);continue}const t=c.get(o.datum);if(null==t)continue;const r=n.get(t);l=zo(o,null==r?0:Fo(e,r,i),s,a)||l}return l}(this.config.pulse,e,t,this.timestampBuffer,this.getDatumIndexMap(t),o),this.config=e,this.buffer=new It(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=Dt(e.timeAccessor||e.xAccessor,"time"),this.getY=Dt(e.valueAccessor||e.yAccessor,"value")):(this.getX=Dt(e.xAccessor,"x"),this.getY=Dt(e.yAccessor,"y")),this.getGroup=Ot(e.groupAccessor),this.getCategory=Ot(e.categoryAccessor),this.getSize=e.sizeAccessor?Dt(e.sizeAccessor,"size"):void 0,this.getColor=Ot(e.colorAccessor),this.getSymbol=Ot(e.symbolAccessor),this.getY0=e.y0Accessor?Dt(e.y0Accessor,"y0"):void 0,this.resolvedRibbons=Cn(e),this.getPointId=Ot(e.pointIdAccessor),"candlestick"===e.chartType){const t=null!=e.openAccessor,o=null!=e.closeAccessor;this.getOpen=t?Dt(e.openAccessor,"open"):void 0,this.getHigh=Dt(e.highAccessor,"high"),this.getLow=Dt(e.lowAccessor,"low"),this.getClose=o?Dt(e.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!t&&!o}e.pulse&&(this.timestampBuffer=new It(e.windowSize))}currentTime(){return this.config.clock?.()??Ro()}syncPulseTimestampBuffer(){this.config.pulse?null!=this.timestampBuffer&&this.timestampBuffer.capacity===this.buffer.capacity&&this.timestampBuffer.size===this.buffer.size||(this.timestampBuffer=jn(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 o=t.getTop(e),n=t.getBottom(e);Number.isFinite(o)&&this.yExtent.push(o),Number.isFinite(n)&&this.yExtent.push(n)}}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 o=t.getTop(e),n=t.getBottom(e);Number.isFinite(o)&&this.yExtent.evict(o),Number.isFinite(n)&&this.yExtent.evict(n)}}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 o=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode;if(this.getX=o?Dt(this.config.timeAccessor||this.config.xAccessor,"time"):Dt(this.config.xAccessor,"x"),this.xIsDate=!1,e.inserts.length>0){const t=e.inserts[0],o=this.config.xAccessor,n="function"==typeof o?o(t):t[o||"x"],r=n instanceof Date,i="string"==typeof n&&Number.isFinite(C(n));if(this.xIsDate=r||i,i){const e="string"==typeof o?o:void 0;this.getX=e?t=>M(t[e]):e=>M(o(e))}}Rn(this.buffer,e.totalSize||e.inserts.length,this.timestampBuffer);for(const o of e.inserts)Ln(this.buffer,o,this.timestampBuffer,t),this.xExtent.push(this.getX(o)),this.pushDatumYExtent(o)}else for(const o 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=Ln(this.buffer,o,this.timestampBuffer,t);this.xExtent.push(this.getX(o)),this.pushDatumYExtent(o),null!=e&&(this.xExtent.evict(this.getX(e)),this.evictDatumYExtent(e))}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:o}=this,n=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(o,this.getX),this.yExtent.dirty&&this.rebuildYExtent();const i=this.getBufferArray(),s=this.yExtent.extent;let a=_n(this.xExtent.extent,t.xExtent),l=_n(s,t.yExtent);const c=!(!(u=t.yExtent)||null==u[0]||null==u[1]);var u;const d="exact"===(t.yAxisExtent??t.axisExtent);if("stackedarea"===t.chartType&&!c&&o.size>0){const e=function(e){const{config:t,groups:o,getX:n,getY:r}=e,i="exact"===(t.yAxisExtent??t.axisExtent);if(t.normalize){const o=[0,i?1:1+t.extentPadding];return{yDomain:o,stackExtentCache:{key:`${e.bufferSize}:${e.ingestVersion}:norm`,yDomain:o}}}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,d=new Map;for(const e of o){const t=new Map;let o=0;for(const i of e.data){const e=n(i),s=r(i);if(!Number.isFinite(e)||!Number.isFinite(s))continue;t.set(e,(t.get(e)||0)+s),l.add(e),o+=s;const a=(u.get(e)||0)+s;u.set(e,a),a>c&&(c=a)}a.set(e.key,t),d.set(e.key,o)}const h=t.stackOrder??"key",f=(e,t)=>t>e?-1:e>t?1:0;let m,p;if("input"===h)m=o.map(e=>e.key);else if("insideOut"===h){const e=[...o].map(e=>e.key).sort((e,t)=>{const o=(d.get(t)??0)-(d.get(e)??0);return 0!==o?o:f(e,t)}),t=[],n=[];let r=0,i=0;for(const o of e)i>r?(t.push(o),r+=d.get(o)??0):(n.push(o),i+=d.get(o)??0);m=[...n.reverse(),...t]}else m="asc"===h?o.map(e=>e.key).sort((e,t)=>{const o=(d.get(e)??0)-(d.get(t)??0);return 0!==o?o:f(e,t)}):"desc"===h?o.map(e=>e.key).sort((e,t)=>{const o=(d.get(t)??0)-(d.get(e)??0);return 0!==o?o:f(e,t)}):o.map(e=>e.key).sort(f);if("wiggle"===t.baseline||"silhouette"===t.baseline){const e=Array.from(l).sort((e,t)=>e-t),o=Vo(e,m,(e,t)=>a.get(e)?.get(t)||0,t.baseline);let n=1/0,r=-1/0;for(const t of e){const e=o.get(t)??0,i=u.get(t)??0;n>e&&(n=e),e+i>r&&(r=e+i)}Number.isFinite(n)&&Number.isFinite(r)||(n=0,r=0);const s=r-n,c=i?0:s>0?s*t.extentPadding:1;p=[n-c,r+c]}else if("diverging"===t.baseline){const e=Array.from(l).sort((e,t)=>e-t),[o,n]=function(e,t,o){let n=0,r=0;for(const i of e){let e=0,s=0;for(const n of t){const t=o(n,i)||0;0>t?s+=t:e+=t}n>s&&(n=s),e>r&&(r=e)}return[n,r]}(e,m,(e,t)=>a.get(e)?.get(t)||0),r=n-o,s=i?0:r>0?r*t.extentPadding:1;p=[o-s,n+s]}else p=[0,c+(i?0:c>0?c*t.extentPadding:1)];return{yDomain:p,stackExtentCache:{key:s,yDomain:p}}}({config:t,groups:this.groupData(i),getX:this.getX,getY:this.getY,bufferSize:o.size,ingestVersion:this._ingestVersion,stackExtentCache:this._stackExtentCache});l=e.yDomain,this._stackExtentCache=e.stackExtentCache}else"bar"===t.chartType&&t.binSize&&!c&&o.size>0?l=function(e,t,o,n,r,i,s){const[,a]=function(e,t,o,n,r){const i=vn(e,t,o,n,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,o,n,r);return[0,s?a:a+a*i]}(o,this.getX,this.getY,t.binSize,this.getCategory,t.extentPadding,d):"waterfall"===t.chartType&&!c&&o.size>0?l=function(e,t,o,n){const[r,i]=function(e,t){let o=0,n=0,r=0;for(const i of e){const e=t(i);null==e||Number.isNaN(e)||(r+=e,o>r&&(o=r),r>n&&(n=r))}return[o,n]}(e,t),s=i-r,a=n?0:s>0?s*o:1;return[Math.min(0,r-Math.abs(a)),Math.max(0,i+Math.abs(a))]}(o,this.getY,t.extentPadding,d):c||l[0]===1/0||(l=function(e,t,o){if(!o.length)return e;let[n,r]=e;for(const e of t)for(const t of o){const o=t.getTop(e),i=t.getBottom(e);Number.isFinite(o)&&(n>o&&(n=o),o>r&&(r=o)),Number.isFinite(i)&&(n>i&&(n=i),i>r&&(r=i))}return[n,r]}(l,i,this.resolvedRibbons),l=function(e,t){const o=e[1]-e[0],n=t.exactMode?0:o>0?o*t.extentPadding:1,r=[null!=t.userMin?e[0]:e[0]-n,null!=t.userMax?e[1]:e[1]+n];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:d,extentPadding:t.extentPadding,userMin:t.yExtent?.[0],userMax:t.yExtent?.[1],yScaleType:t.yScaleType,dataYDomain:s}));l=function(e,t,o){if(!t||o)return e;const n=t[0],r=t[1];return null==n&&null==r?e:[null!=n?n:e[0],null!=r?r:e[1]]}(l,t.yExtent,!!c),({xDomain:a,yDomain:l}=function(e,t,o){let n=e,r=t;if(n[0]===1/0||n[1]===-1/0)if("time"===o){const e=Date.now();n=[e-864e5,e]}else n=[0,1];return r[0]!==1/0&&r[1]!==-1/0||(r=[0,1]),{xDomain:n,yDomain:r}}(a,l,t.xScaleType)),this.scales=function(e){const{config:t,layout:o,xDomain:n,yDomain:r}=e,i="streaming"===t.runtimeMode,s=Math.max(0,Math.min(t.scalePadding||0,Math.min(o.width,o.height)/2-1));if(i){if("x"==("up"===(a=t.arrowOfTime)||"down"===a?"y":"x")){const e="right"===t.arrowOfTime?[s,o.width-s]:[o.width-s,s];return{x:(0,Mn.scaleLinear)().domain(n).range(e),y:Pn(t.yScaleType,r,[o.height-s,s])}}const e="down"===t.arrowOfTime?[s,o.height-s]:[o.height-s,s];return{x:Pn(t.yScaleType,r,[s,o.width-s]),y:(0,Mn.scaleLinear)().domain(n).range(e)}}var a;return{x:Pn(t.xScaleType,n,[s,o.width-s]),y:Pn(t.yScaleType,r,[o.height-s,s])}}({config:t,layout:e,xDomain:a,yDomain:l}),this._customLayoutFailedThisBuild=!1;const h=this.buildSceneNodes(e,i);if(this._customLayoutFailedThisBuild)return!0===this.lastCustomLayoutFailure?.preservedLastGoodScene?(this.scales=n,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=h,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,o=e.height/this.lastLayout.height;for(const e of this.scene)switch(e.type){case"line":for(const n of e.path)n[0]*=t,n[1]*=o;break;case"area":for(const n of e.topPath)n[0]*=t,n[1]*=o;for(const n of e.bottomPath)n[0]*=t,n[1]*=o;e.clipRect&&(e.clipRect={x:e.clipRect.x*t,y:e.clipRect.y*o,width:e.clipRect.width*t,height:e.clipRect.height*o}),e.strokeColorBands&&(e.strokeColorBands=e.strokeColorBands.map(e=>({...e,y:e.y*o,height:e.height*o})));break;case"point":case"glyph":e.x*=t,e.y*=o;break;case"rect":case"heatcell":e.x*=t,e.y*=o,e.w*=t,e.h*=o;break;case"candlestick":e.x*=t,e.openY*=o,e.closeY*=o,e.highY*=o,e.lowY*=o}const n=this.scales.x.domain(),r=this.scales.y.domain(),i=this.scales.x.range(),s=this.scales.y.range(),a=Pn,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,n,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:o,scales:n}=this;if(!n)return[];if(o.customLayout){const r={data:t,scales:n,dimensions:{width:e.width,height:e.height,margin:o.layoutMargin??{top:0,right:0,bottom:0,left:0},plot:{x:0,y:0,width:e.width,height:e.height}},theme:{semantic:o.themeSemantic??{},categorical:o.themeCategorical??vo},resolveColor:(e,t)=>{const n=this.resolveGroupColor(e);if(n)return n;const r=this.resolveLineStyle(e,t);return r.stroke?r.stroke:"string"==typeof r.fill?r.fill:o.themeSemantic?.primary??"#4e79a7"},config:o.layoutConfig??{},selection:o.layoutSelection??null};let i;try{i=o.customLayout(r)}catch(e){const t=null!==this.lastCustomLayoutResult,n=Sn("xy",e,t,this.version);this.lastCustomLayoutFailure=n,this._customLayoutFailedThisBuild=!0,"production"!==process.env.NODE_ENV&&console.error("[semiotic] customLayout threw:",e);try{o.onLayoutError?.(n)}catch(e){"production"!==process.env.NODE_ENV&&console.error("[semiotic] onLayoutError threw:",e)}return t?this.scene:(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,[])}this.customLayoutOverlays=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,o.layoutSelection??null)}return xn({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:n,config:o,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(o.chartType){case"line":return function(e,t){const o=e.groupData(t),n=[],r=e.config.annotations?.filter(sn).map(e=>({value:e.value,color:e.color,thresholdType:e.thresholdType||"greater"}));if(e.ribbons&&e.ribbons.length>0){const{perSeries:r,aggregate:i}=en(e.ribbons);if(i.length>0&&n.push(...tn(e,t,i)),r.length>0)for(const t of o)n.push(...on(e,t.data,t.key,r))}for(const t of o){const o=e.resolveLineStyle(t.key,t.data[0]),i=Yo(t.data,e.scales,e.getX,e.getY,o,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),n.push(i)}return rn(e,o,n),n}(r,t);case"area":return function(e,t){const o=e.groupData(t),n=[];if(e.ribbons&&e.ribbons.length>0){const{perSeries:r,aggregate:i}=en(e.ribbons);if(i.length>0&&n.push(...tn(e,t,i)),r.length>0)for(const t of o)n.push(...on(e,t.data,t.key,r))}const r=e.scales.y.domain(),i=r[0],s=e.config.semanticLineStops?.filter(e=>Number.isFinite(e.offset)).map(e=>({value:r[0]+Math.max(0,Math.min(1,e.offset))*(r[1]-r[0]),color:e.color,thresholdType:"greater"})).sort((e,t)=>e.value-t.value),a=s&&s.length>0?(()=>{const t=s.reduce((e,t)=>(e.at(-1)?.value===t.value?e[e.length-1]=t:e.push(t),e),[]),o=[{from:r[0],to:t[0].value}];for(let e=0;t.length>e;e++)o.push({from:t[e].value,to:t[e+1]?.value??r[1],color:t[e].color});return o.map(({from:t,to:o,color:n})=>{const r=e.scales.y(t),i=e.scales.y(o);return{y:Math.min(r,i),height:Math.abs(i-r),color:n}}).filter(e=>e.height>0)})():void 0,l=e.getY0?t=>{const o=e.getY0(t);return null==o?i:o}:void 0;for(const t of o){const o=e.resolveAreaStyle(t.key,t.data[0]),r=Go(t.data,e.scales,e.getX,e.getY,i,o,t.key,l),c=un(e.config.gradientFill);c&&(r.fillGradient=c),e.config.curve&&"linear"!==e.config.curve&&(r.curve=e.config.curve),e.config.lineGradient&&(r.strokeGradient=e.config.lineGradient),s&&s.length>0&&(r.colorThresholds=s,r.strokeColorBands=a),n.push(r)}return rn(e,o,n),n}(r,t);case"mixed":return function(e,t){const o=e.groupData(t),n=[],r=e.config.areaGroups||new Set;if(e.ribbons&&e.ribbons.length>0){const{perSeries:r,aggregate:i}=en(e.ribbons);if(i.length>0&&n.push(...tn(e,t,i)),r.length>0)for(const t of o)n.push(...on(e,t.data,t.key,r))}const i=e.scales.y.domain()[0],s=e.getY0?t=>{const o=e.getY0(t);return null==o?i:o}:void 0;for(const t of o)if(r.has(t.key)){const o=e.resolveAreaStyle(t.key,t.data[0]),r=Go(t.data,e.scales,e.getX,e.getY,i,o,t.key,s),a=un(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),n.push(r)}else{const o=e.resolveLineStyle(t.key,t.data[0]),r=Yo(t.data,e.scales,e.getX,e.getY,o,t.key);e.config.curve&&"linear"!==e.config.curve&&(r.curve=e.config.curve),e.config.lineGradient&&(r.strokeGradient=e.config.lineGradient),n.push(r)}return rn(e,o,n),n}(r,t);case"stackedarea":return function(e,t){const o=e.groupData(t),n=e.config.stackOrder??"key",r=()=>o.sort((e,t)=>t.key>e.key?-1:e.key>t.key?1:0);if("input"===n);else if("key"===n)r();else if("asc"===n||"desc"===n||"insideOut"===n){const t=new Map;for(const n of o){let o=0;for(const t of n.data){const n=e.getX(t),r=e.getY(t);Number.isFinite(n)&&Number.isFinite(r)&&(o+=r)}t.set(n.key,o)}const r=(e,t)=>t>e?-1:e>t?1:0;if("asc"===n)o.sort((e,o)=>{const n=(t.get(e.key)??0)-(t.get(o.key)??0);return 0!==n?n:r(e.key,o.key)});else if("desc"===n)o.sort((e,o)=>{const n=(t.get(o.key)??0)-(t.get(e.key)??0);return 0!==n?n:r(e.key,o.key)});else{const e=[...o].sort((e,o)=>{const n=(t.get(o.key)??0)-(t.get(e.key)??0);return 0!==n?n:r(e.key,o.key)}),n=[],i=[];let s=0,a=0;for(const o of e)a>s?(n.push(o),s+=t.get(o.key)??0):(i.push(o),a+=t.get(o.key)??0);o.length=0,o.push(...i.reverse(),...n)}}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,o,n,r,i,s,a="zero"){const l=new Set;for(const t of e)for(const e of t.data){const t=o(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=o(r),i=n(r);Number.isFinite(t)&&Number.isFinite(i)&&e.set(t,(e.get(t)||0)+i)}u.set(t.key,e)}let d;if(i){d=new Map;for(const t of c){let o=0;for(const n of e)o+=u.get(n.key)?.get(t)||0;d.set(t,o||1)}}const h=Vo(c,e.map(e=>e.key),(e,t)=>u.get(e)?.get(t)||0,a),f="diverging"===a&&!i,m=[],p=new Map,g=new Map,y=new Map,b=new Map;for(const e of c)g.set(e,h.get(e)??0),y.set(e,0),b.set(e,0);for(const o of e){const e=u.get(o.key),n=new Map;let a=[],l=[];const h=()=>{if(a.length>=2){const e={type:"area",topPath:a,bottomPath:l,style:r(o.key,o.data[0]),datum:o.data,group:o.key};s&&(e.curve=s),m.push(e)}a=[],l=[]};for(const o of c){const r=e.has(o);let s,c,u=r?e.get(o):0;if(i&&r&&(u/=d.get(o)),!r||!Number.isFinite(u)||0===u){h();continue}f?u>0?(s=y.get(o),c=s+u,y.set(o,c)):(s=b.get(o),c=s+u,b.set(o,c)):(s=g.get(o),c=s+u,g.set(o,c));const m=t.x(o);l.push([m,t.y(s)]),a.push([m,t.y(c)]),n.set(o,c)}h(),p.set(o.key,n)}return{nodes:m,stackedTops:p}}(o,e.scales,e.getX,e.getY,(t,o)=>e.resolveAreaStyle(t,o),e.config.normalize,i,s),c=a;if(e.config.pointStyle){const t=new WeakMap;for(const n of o){const o=l.get(n.key);if(o)for(const r of n.data){const n=e.getX(r),i=e.getY(r);null==n||Number.isNaN(n)||null==i||Number.isNaN(i)||!o.has(n)||t.set(r,o.get(n))}}const n=o=>t.get(o)??e.getY(o);rn(e,o,c,n)}return c}(r,t);case"scatter":case"bubble":return function(e,t){const o=[],n="bubble"===e.config.chartType?10:5,r=e.config.sizeRange||[3,15];let i=null;if(e.getSize&&!e.config.pointStyle){const o=t.map(t=>e.getSize(t)).filter(e=>null!=e&&!Number.isNaN(e));if(o.length>0){let e=1/0,t=-1/0;for(const n of o)e>n&&(e=n),n>t&&(t=n);i=o=>e===t?(r[0]+r[1])/2:r[0]+(o-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=l?gn(l,e.config.symbolMap):null;for(const r of t){let t=e.config.pointStyle?e.config.pointStyle(r):{fill:a,opacity:.8},l=t.r||n;if(i&&e.getSize){const t=e.getSize(r);null==t||Number.isNaN(t)||(l=i(t))}if(s&&e.getColor&&!t.fill){const o=e.getColor(r);o&&s.has(o)&&(t={...t,fill:s.get(o)})}const u=e.getPointId?e.getPointId(r)+"":void 0;if(c){const n=c(r),i=Uo(r,e.scales,e.getX,e.getY,Math.PI*l*l,n,t,u);i&&o.push(i)}else{const n=Xo(r,e.scales,e.getX,e.getY,l,t,u);n&&o.push(n)}}return o}(r,t);case"heatmap":return function(e,t,o){if(e.config.heatmapAggregation)return function(e,t,o){const n=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=Dt(e.config.valueAccessor,"value");if(!e.scales||0===t.length)return[];const[a,l]=e.scales.x.domain(),[c,u]=e.scales.y.domain(),d=(l-a||1)/n,h=(u-c||1)/r,f=n*r;if(f>1e6)return[];const m=new Int32Array(f),p=new Float64Array(f);for(let o=0;t.length>o;o++){const i=t[o],l=e.getX(i),u=e.getY(i);if(!isFinite(l)||!isFinite(u))continue;const f=Math.min(Math.floor((l-a)/d),n-1),g=Math.min(Math.floor((u-c)/h),r-1);if(0>f||0>g)continue;const y=g*n+f;m[y]++;const b=s(i);p[y]+=isFinite(b)?b:0}let g=1/0,y=-1/0;for(let e=0;f>e;e++){if(0===m[e])continue;let t;switch(i){case"sum":t=p[e];break;case"mean":t=p[e]/m[e];break;default:t=m[e]}g>t&&(g=t),t>y&&(y=t)}if(!isFinite(g))return[];const b=y-g||1,v=o.width/n,x=o.height/r,k=e.config.showValues,w=e.config.heatmapValueFormat,S=[];for(let t=0;r>t;t++){const o=t*n;for(let s=0;n>s;s++){const n=o+s;if(0===m[n])continue;let l;switch(i){case"sum":l=p[n];break;case"mean":l=p[n]/m[n];break;default:l=m[n]}const u=(l-g)/b,f={xi:s,yi:t,value:l,count:m[n],sum:p[n],xCenter:a+(s+.5)*d,yCenter:c+(t+.5)*h,agg:i};S.push(bn(Qo(s*v,(r-1-t)*x,v,x,`rgb(${220-(180*u+.5)|0},${220-(100*u+.5)|0},${255-(50*u+.5)|0})`,f,k?{value:l,showValues:!0,valueFormat:w}:void 0),f,e))}}return S}(e,t,o);if(0===t.length)return[];const n=Dt(e.config.valueAccessor,"value"),r=Et(e.config.xAccessor,"x"),i=Et(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 o=t[e],n=r(o),u=i(o);l[e]=n,c[e]=u,s.has(n)||s.set(n,s.size),a.has(u)||a.set(u,a.size)}const u=s.size,d=a.size;if(0===u||0===d)return[];const h=Array.from(s.keys()),f=Array.from(a.keys()),m=h.every(e=>"number"==typeof e&&!isNaN(e)),p=f.every(e=>"number"==typeof e&&!isNaN(e));if(m){h.sort((e,t)=>Number(e)-Number(t)),s.clear();for(let e=0;h.length>e;e++)s.set(h[e],e)}if(p){f.sort((e,t)=>Number(e)-Number(t)),a.clear();for(let e=0;f.length>e;e++)a.set(f[e],e)}const g=new Float64Array(t.length),y=new Float64Array(t.length),b=Array(t.length),v=new Map;let x=0;for(let e=0;t.length>e;e++){const o=t[e],r=s.get(l[e]),i=a.get(c[e]);if(void 0===r||void 0===i)continue;const d=n(o),h=i*u+r,f=v.get(h);let m;void 0!==f?m=f:(m=x++,v.set(h,m)),g[m]=h,y[m]=d,b[m]=o}let k=1/0,w=-1/0;for(let e=0;x>e;e++){const t=y[e];isFinite(t)&&(k>t&&(k=t),t>w&&(w=t))}if(!isFinite(k)||!isFinite(w))return[];const S=function(e){const t=e in io?e:"blues";let o=yn.get(t);if(o)return o;o=Array(256);const n=so(t);for(let e=0;256>e;e++)o[e]=n(e/255);return yn.set(t,o),o}("string"==typeof e.config.colorScheme?e.config.colorScheme:e.config.themeSequential||"blues"),A=255/(w-k||1),C=o.width/u,M=o.height/d,_=e.config.showValues,P=e.config.heatmapValueFormat,R=[];for(let t=0;x>t;t++){const o=y[t];if(!isFinite(o))continue;const n=g[t],r=n%u,i=b[t];R.push(bn(Qo(r*C,(d-1-(n-r)/u)*M,C,M,S[Math.min((o-k)*A+.5|0,255)],i,_?{value:o,showValues:!0,valueFormat:P}:void 0),i,e))}return R}(r,t,e);case"bar":{const e=function(e,t){if(!e.config.binSize)return{nodes:[],binBoundaries:[]};const o=vn(t,e.getX,e.getY,e.config.binSize,e.getCategory);if(0===o.size)return{nodes:[],binBoundaries:[]};let n=null;if(e.getCategory){const t=new Set;for(const e of o.values())for(const o of e.categories.keys())t.add(o);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?n=e.barCategoryCache.order:(n=[...a,...s],e.barCategoryCache={key:l,order:n})}const r=[],i=e.scales,[s,a]=i.x.domain(),l=e.config.barStyle,c=e.config.themeSemantic?.primary,u=l?.gap,d="number"!=typeof u||0>u?1:u,h={};l?.stroke&&(h.stroke=l.stroke),"number"==typeof l?.strokeWidth&&(h.strokeWidth=l.strokeWidth),"number"==typeof l?.opacity&&(h.opacity=l.opacity);for(const t of o.values()){const o=Math.max(t.start,s),u=Math.min(t.end,a);if(o>=u)continue;const f=i.x(o),m=i.x(u),p=Math.abs(m-f),g=p>d+1?d:0,y=Math.min(f,m)+g/2,b=Math.max(p-g,1);if(b>0)if(n&&t.categories.size>0){let o=0;for(const s of n){const n=t.categories.get(s)||0;if(0===n)continue;const a=i.y(o),u=i.y(o+n);r.push(Ko(y,Math.min(a,u),b,Math.abs(a-u),{fill:e.config.barColors?.[s]||l?.fill||c||"#4e79a7",...h},{binStart:t.start,binEnd:t.end,total:t.total,category:s,categoryValue:n},s)),o+=n}}else{const e=i.y(0),o=i.y(t.total);r.push(Ko(y,Math.min(e,o),b,Math.abs(e-o),{fill:l?.fill||c||"#007bff",...h},{binStart:t.start,binEnd:t.end,total:t.total}))}}const f=new Set;for(const e of o.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 o=[],n=e.config.swarmStyle||{},r=n.radius??3,i=n.fill??e.config.themeSemantic?.primary??"#007bff",s=n.opacity??.7,a=n.stroke,l=n.strokeWidth;for(const n of t){const t=e.getX(n),c=e.getY(n);if(null==c||Number.isNaN(c))continue;const u=e.scales.x(t),d=e.scales.y(c);let h=i;if(e.getCategory){const t=e.getCategory(n);h=e.config.barColors?.[t]||h}const{r:f,...m}=e.config.pointStyle?.(n)??{},p={type:"point",x:u,y:d,r:f??r,style:{fill:h,opacity:s,stroke:a,strokeWidth:l,...m},datum:n};e.getPointId&&(p.pointId=e.getPointId(n)+""),o.push(p)}return o}(r,t);case"waterfall":return function(e,t,o){const n=[],r=e.scales,i=e.config.waterfallStyle,s=t.filter(t=>{const o=e.getY(t),n=e.getX(t);return null!=o&&!Number.isNaN(o)&&null!=n&&isFinite(n)});if(0===s.length)return n;const a=i?.positiveColor??e.config.themeSemantic?.success??"#28a745",l=i?.negativeColor??e.config.themeSemantic?.danger??"#dc3545",c=i?.gap??1,u=i?.stroke,d=i?.strokeWidth,h=i?.opacity;let f=0;for(let t=0;s.length>t;t++){const m=s[t],p=e.getX(m),g=e.getY(m),y=f+g;let b;b=s.length-1>t?e.getX(s[t+1])-p:t>0?p-e.getX(s[t-1]):0;const v=r.x(p),x=0!==b?r.x(p+b):v+o.width/10,k=Math.min(v,x)+c/2,w=Math.max(v,x)-c/2-k;if(0>=w){f=y;continue}const S=r.y(f),A=r.y(y),C=Math.min(S,A),M=Math.abs(S-A),_={fill:0>g?l:a,stroke:u,strokeWidth:d};null!=h&&(_.opacity=h),n.push(Ko(k,C,w,M,_,{...m,baseline:f,cumEnd:y,delta:g,_connectorStroke:i?.connectorStroke,_connectorWidth:i?.connectorWidth})),f=y}return n}(r,t,e);case"candlestick":return function(e,t,o){if(!e.getHigh||!e.getLow||!e.scales)return[];const n=e.config.candlestickRangeMode??!1;if(!(n||e.getOpen&&e.getClose))return[];const r=[],i=e.config.candlestickStyle||{},s=i.rangeColor||"#6366f1",a=n?s:i.upColor||"#28a745",l=n?s:i.downColor||"#dc3545",c=n?s:i.wickColor||"#333",u=i.wickWidth||(n?2:1),d=t.map(t=>e.getX(t)).filter(e=>null!=e&&!Number.isNaN(e)).sort((e,t)=>e-t);let h=i.bodyWidth??0;if(null==i.bodyWidth)if(d.length>1){let t=1/0;for(let o=1;d.length>o;o++){const n=Math.abs(e.scales.x(d[o])-e.scales.x(d[o-1]));n>0&&t>n&&(t=n)}h=t!==1/0?Math.max(2,Math.min(.6*t,20)):6}else h=6;for(const i of t){const t=e.getX(i);if(null==t||Number.isNaN(t))continue;const s=e.getHigh(i),d=e.getLow(i);if(null==s||Number.isNaN(s)||null==d||Number.isNaN(d))continue;const f=n?s:e.getOpen(i),m=n?d:e.getClose(i);if(!n&&[f,m].some(e=>null==e||Number.isNaN(e)))continue;const p=m>=f,g={type:"candlestick",x:e.scales.x(t),openY:e.scales.y(f),closeY:e.scales.y(m),highY:e.scales.y(s),lowY:e.scales.y(d),bodyWidth:h,upColor:a,downColor:l,wickColor:c,wickWidth:u,isUp:p,datum:i};n&&(g.isRange=!0,g.dotRadius=Math.max(2,Math.min(h/2,.12*o.height))),r.push(g)}return r}(r,t,e);default:return[]}}resolveBoundsStyle(e,t){return function(e,t,o,n){const r=e.boundsStyle;return"function"==typeof r?r(o||{},t):r&&"object"==typeof r?r:{fill:n(t,o).stroke||e.themeSemantic?.primary||"#4e79a7",fillOpacity:.2,stroke:"none"}}(this.config,e,t,(e,t)=>this.resolveLineStyle(e,t))}computeDecayOpacity(e,t){const o=this.config.decay;return o&&t>1?Oo(o,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._ingestVersion)return this._datumIndexCache.map;const t=Bo(e);return this._datumIndexCache={version:this._ingestVersion,map:t},t}applyDecay(e,t){this.config.decay&&function(e,t,o,n=Bo(o)){const r=o.length;if(r>1)for(const o of t){if("line"===o.type){const t=Array.isArray(o.datum)?o.datum:[];if(2>t.length)continue;const i=Array(t.length);let s=!1;for(let o=0;t.length>o;o++){const a=n.get(t[o]);null!=a?(i[o]=Oo(e,a,r),1>i[o]&&(s=!0)):i[o]=1}s&&(o._decayOpacities=i);continue}if("area"===o.type){const t=Array.isArray(o.datum)?o.datum:[],i=o.topPath?o.topPath.length:t.length;if(2>i)continue;if(t.length===i){const s=Array(i);let a=!1;for(let o=0;t.length>o;o++){const i=n.get(t[o]);null!=i?(s[o]=Oo(e,i,r),1>s[o]&&(a=!0)):s[o]=1}a&&(o._decayOpacities=s)}else{let s=1;for(const o of t){const t=n.get(o);if(null!=t){const o=Oo(e,t,r);s>o&&(s=o)}}if(1>s){const e=Array(i);e.fill(s),o._decayOpacities=e}}continue}const t=n.get(o.datum);if(null==t)continue;const i=Oo(e,t,r);"heatcell"===o.type?o.style={opacity:i}:"candlestick"===o.type?o._decayOpacity=i:o.style={...o.style,opacity:(o.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&&Ho(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,o,n){o.clear(),n.clear();for(let r=0;t.length>r;r++){const i=t[r],s=Wo(e,i,r);s&&("point"===i.type?o.set(s,{x:i.x,y:i.y,r:i.r,opacity:qo(i.style)}):"glyph"===i.type?o.set(s,{x:i.x,y:i.y,r:i.size,opacity:qo(i.style),glyph:i.glyph}):"rect"===i.type||"heatcell"===i.type?o.set(s,{x:i.x,y:i.y,w:i.w,h:i.h,opacity:qo(i.style)}):"candlestick"===i.type?o.set(s,{x:i.x,y:i.openY,w:i.bodyWidth,openY:i.openY,closeY:i.closeY,highY:i.highY,lowY:i.lowY,opacity:qo(i.style)}):"line"===i.type?n.set(s,{path:i.path.map(e=>[e[0],e[1]]),opacity:i.style?.opacity}):"area"===i.type&&n.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 o=this.scene[t],n=Wo(this.transitionContext,o,t);n&&("point"===o.type?this.prevPositionMap.set(n,{x:o.x,y:o.y,r:0,opacity:0}):"rect"===o.type?this.prevPositionMap.set(n,{x:o.x,y:e,w:o.w,h:0,opacity:o.style.opacity??1}):"heatcell"===o.type?this.prevPositionMap.set(n,{x:o.x,y:o.y,w:o.w,h:o.h,opacity:0}):"line"===o.type?(o._introClipFraction=0,this.prevPathMap.set(n,{path:o.path.map(e=>[e[0],e[1]]),opacity:o.style.opacity})):"area"===o.type&&(o._introClipFraction=0,this.prevPathMap.set(n,{topPath:o.topPath.map(e=>[e[0],e[1]]),bottomPath:o.bottomPath.map(e=>[e[0],e[1]]),opacity:o.style.opacity})))}}startTransition(){if(!this.config.transition)return;const e=function(e,t,o,n,r,i=Ro()){if(0===n.size&&0===r.size)return o;const s=t.duration??300;if(o.exitNodes.length>0){const e=new Set(o.exitNodes);o.scene=o.scene.filter(t=>!e.has(t)),o.exitNodes=[]}let a=!1;const l=new Set,c=new Set;for(let t=0;o.scene.length>t;t++){const i=o.scene[t],s=Wo(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=n.get(s);if("point"===i.type)if(u){l.add(s);const e={x:i.x,y:i.y,r:i.r};i._targetOpacity=qo(i.style),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=qo(i.style),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=qo(i.style),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=qo(i.style),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=qo(i.style),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=qo(i.style),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=qo(i.style),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=qo(i.style),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=qo(i.style),(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=qo(i.style),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 n={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};o.exitNodes.push(n),a=!0}else if(e.startsWith("a:")&&t.topPath&&t.bottomPath){const n={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};o.exitNodes.push(n),a=!0}for(const[e,t]of n)if(!l.has(e)){if(e.startsWith("p:"))o.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)o.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:"))o.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:"))o.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 n=t.openY??t.y;o.exitNodes.push({type:"candlestick",x:t.x,openY:n,closeY:t.closeY??n,highY:t.highY??n,lowY:t.lowY??n,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 o.exitNodes.length>0&&(o.scene=[...o.scene,...o.exitNodes]),a&&(o.activeTransition={startTime:i,duration:s}),o}(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},o=function(e,t,o,n){if(!o.activeTransition)return!1;const r=_o(e,o.activeTransition),i=Mo(r,"linear"===t.easing?"linear":"ease-out-cubic");for(const e of o.scene){const t=e._transitionKey;if("point"===e.type){if(void 0!==e._targetOpacity){const o=t?n.get(t):void 0;e.style.opacity=Po(o?o.opacity??1:0,e._targetOpacity,i)}if(void 0===e._targetX)continue;if(!t)continue;const o=n.get(t);if(!o)continue;e.x=Po(o.x,e._targetX,i),e.y=Po(o.y,e._targetY,i),void 0!==e._targetR&&void 0!==o.r&&(e.r=Po(o.r,e._targetR,i))}else if("glyph"===e.type){if(void 0!==e._targetOpacity){const o=t?n.get(t):void 0;e.style.opacity=Po(o?o.opacity??1:0,e._targetOpacity,i)}if(void 0===e._targetX)continue;if(!t)continue;const o=n.get(t);if(!o)continue;e.x=Po(o.x,e._targetX,i),e.y=Po(o.y,e._targetY,i),void 0!==e._targetR&&void 0!==o.r&&(e.size=Po(o.r,e._targetR,i))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const o=t?n.get(t):void 0;e.style.opacity=Po(o?o.opacity??1:0,e._targetOpacity,i)}if(void 0===e._targetX)continue;if(!t)continue;const o=n.get(t);if(!o)continue;e.x=Po(o.x,e._targetX,i),e.y=Po(o.y,e._targetY,i),void 0!==o.w&&(e.w=Po(o.w,e._targetW,i)),void 0!==o.h&&(e.h=Po(o.h,e._targetH,i))}else if("heatcell"===e.type){if(void 0!==e._targetOpacity){const o=t?n.get(t):void 0;e.style={...e.style||{},opacity:Po(o?o.opacity??1:0,e._targetOpacity,i)}}if(void 0===e._targetX)continue;if(!t)continue;const o=n.get(t);if(!o)continue;e.x=Po(o.x,e._targetX,i),e.y=Po(o.y,e._targetY,i),void 0!==o.w&&(e.w=Po(o.w,e._targetW,i)),void 0!==o.h&&(e.h=Po(o.h,e._targetH,i))}else if("candlestick"===e.type){if(void 0!==e._targetOpacity){const o=t?n.get(t):void 0;e.style={...e.style||{},opacity:Po(o?o.opacity??1:0,e._targetOpacity,i)}}if(void 0===e._targetX)continue;if(!t)continue;const o=n.get(t);if(!o)continue;e.x=Po(o.x,e._targetX,i),void 0!==o.openY&&(e.openY=Po(o.openY,e._targetOpenY,i)),void 0!==o.closeY&&(e.closeY=Po(o.closeY,e._targetCloseY,i)),void 0!==o.highY&&(e.highY=Po(o.highY,e._targetHighY,i)),void 0!==o.lowY&&(e.lowY=Po(o.lowY,e._targetLowY,i))}else if("line"===e.type){void 0!==e._targetOpacity&&(e.style={...e.style,opacity:Po(e._startOpacity??0,e._targetOpacity,i)}),void 0!==e._introClipFraction&&(e._introClipFraction=i);const t=e._prevPath,o=e._targetPath;if(t&&o&&t.length===e.path.length)for(let n=0;e.path.length>n;n++)e.path[n][0]=Po(t[n][0],o[n][0],i),e.path[n][1]=Po(t[n][1],o[n][1],i)}else if("area"===e.type){void 0!==e._targetOpacity&&(e.style={...e.style,opacity:Po(e._startOpacity??0,e._targetOpacity,i)}),void 0!==e._introClipFraction&&(e._introClipFraction=i);const t=e._prevTopPath,o=e._prevBottomPath,n=e._targetTopPath,r=e._targetBottomPath;if(t&&n&&t.length===e.topPath.length)for(let o=0;e.topPath.length>o;o++)e.topPath[o][0]=Po(t[o][0],n[o][0],i),e.topPath[o][1]=Po(t[o][1],n[o][1],i);if(o&&r&&o.length===e.bottomPath.length)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t][0]=Po(o[t][0],r[t][0],i),e.bottomPath[t][1]=Po(o[t][1],r[t][1],i)}}if(r>=1){for(const e of o.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 o=0;e.path.length>o;o++)e.path[o]=t[o];e._prevPath=void 0,e._targetPath=void 0,e._introClipFraction=void 0}else if("area"===e.type){const t=e._targetTopPath,o=e._targetBottomPath;if(t)for(let o=0;e.topPath.length>o;o++)e.topPath[o]=t[o];if(o)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t]=o[t];e._prevTopPath=void 0,e._prevBottomPath=void 0,e._targetTopPath=void 0,e._targetBottomPath=void 0,e._introClipFraction=void 0}}if(o.exitNodes.length>0){const e=new Set(o.exitNodes);o.scene=o.scene.filter(t=>!e.has(t)),o.exitNodes=[]}return o.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,o}cancelIntroAnimation(){this.prevPositionMap.clear(),this.prevPathMap.clear(),this.activeTransition=null,function(e){for(const t of e){if(void 0!==t._targetOpacity){const e=t._targetOpacity;t.style={...t.style||{},opacity:0===e?0:e},t._targetOpacity=void 0}if("point"===t.type)void 0!==t._targetX&&(t.x=t._targetX,t.y=t._targetY,void 0!==t._targetR&&(t.r=t._targetR),t._targetX=void 0,t._targetY=void 0,t._targetR=void 0);else if("glyph"===t.type)void 0!==t._targetX&&(t.x=t._targetX,t.y=t._targetY,void 0!==t._targetR&&(t.size=t._targetR),t._targetX=void 0,t._targetY=void 0,t._targetR=void 0);else if("rect"===t.type||"heatcell"===t.type)void 0!==t._targetX&&(t.x=t._targetX,t.y=t._targetY,t.w=t._targetW,t.h=t._targetH,t._targetX=void 0,t._targetY=void 0,t._targetW=void 0,t._targetH=void 0);else if("candlestick"===t.type)void 0!==t._targetX&&(t.x=t._targetX,void 0!==t._targetOpenY&&(t.openY=t._targetOpenY),void 0!==t._targetCloseY&&(t.closeY=t._targetCloseY),void 0!==t._targetHighY&&(t.highY=t._targetHighY),void 0!==t._targetLowY&&(t.lowY=t._targetLowY),t._targetX=void 0,t._targetOpenY=void 0,t._targetCloseY=void 0,t._targetHighY=void 0,t._targetLowY=void 0);else if("line"===t.type||"area"===t.type){if(t._introClipFraction=void 0,"line"===t.type&&t._targetPath){for(let e=0;t.path.length>e;e++)t.path[e]=t._targetPath[e];t._prevPath=void 0,t._targetPath=void 0}if("area"===t.type){if(t._targetTopPath)for(let e=0;t.topPath.length>e;e++)t.topPath[e]=t._targetTopPath[e];if(t._targetBottomPath)for(let e=0;t.bottomPath.length>e;e++)t.bottomPath[e]=t._targetBottomPath[e];t._prevTopPath=void 0,t._prevBottomPath=void 0,t._targetTopPath=void 0,t._targetBottomPath=void 0}}}}(this.scene),this.exitNodes=[]}groupData(e){const{result:t,cache:o}=function(e,t,o,n){if(n&&n.version===o&&n.group===t&&n.data===e)return{result:n.result,cache:n};let r;if(t){const o=new Map;for(const n of e){const e=t(n);o.has(e)||o.set(e,[]),o.get(e).push(n)}r=Array.from(o.entries()).map(([e,t])=>({key:e,data:t}))}else r=[{key:"_default",data:e}];return{result:r,cache:{version:o,group:t,data:e,result:r}}}(e,this.getGroup,this._ingestVersion,this._groupDataCache);return this._groupDataCache=o,t}resolveColorMap(e){const{map:t,cache:o}=function(e,t,o,n,r){if(r&&r.version===n)return{map:r.map,cache:r};const i=new Set;if(t)for(const o of e){const e=t(o);e&&i.add(e)}const s=Array.from(i).sort(),a=s.join("\0");if(r&&r.key===a){const e={...r,version:n};return{map:e.map,cache:e}}const l=Array.isArray(o.colorScheme)?o.colorScheme:o.themeCategorical||vo,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:n}}}(e,this.getColor,this.config,this._ingestVersion,this._colorMapCache);return this._colorMapCache=o,t}resolveLineStyle(e,t){return function(e,t,o,n){const r=e.lineStyle;if("function"==typeof r){const e=r(o||{},t);if(e&&!e.stroke&&t){const o=n(t);if(o)return{...e,stroke:o}}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:n(t)||i||"#007bff",strokeWidth:2}}(this.config,e,t,e=>this.resolveGroupColor(e))}resolveAreaStyle(e,t){return function(e,t,o,n){if(e.areaStyle){const r=e.areaStyle(o||{});if(r&&!r.fill&&t){const e=n(t);if(e)return{...r,fill:e,stroke:r.stroke||e}}return r}const r=e.lineStyle;if("function"==typeof r){const e=r(o||{},t);if(e&&!e.fill&&t){const o=n(t);if(o)return{...e,fill:o,stroke:e.stroke||o}}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=n(t)||i||"#4e79a7";return{fill:s,fillOpacity:.7,stroke:s,strokeWidth:2}}(this.config,e,t,e=>this.resolveGroupColor(e))}resolveGroupColor(t){const{color:o,groupColorCounter:n}=function(e){const{group:t,colorMapCache:o,groupColorMap:n,groupColorMapCap:r,config:i}=e;let{groupColorCounter:s}=e;if(o){const e=o.map.get(t);if(e)return{color:e,groupColorCounter:s}}const a=n.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)||vo;if(0===l.length)return{color:null,groupColorCounter:s};const c=l[s%l.length];if(s++,n.set(t,c),n.size>r){const e=n.keys().next().value;void 0!==e&&n.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=n,o}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=zt(e),o=this.getPointId,n=e=>t.has(o(e));Tn(this.buffer,this.timestampBuffer,n);const r=this.buffer.remove(n);if(0===r.length)return this.updateResults.recordNoop("remove"),r;for(const e of r)this.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 o=zt(e),n=this.getPointId,r=new Set;this.buffer.forEach((e,t)=>{o.has(n(e))&&r.add(t)});const i=this.buffer.update(e=>o.has(n(e)),t);if(0===i.length)return this.updateResults.recordNoop("update"),i;for(const e of i)this.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 o=this._customRestyle;if(o)for(const n of e){const e=this._baseStyles.get(n)??n.style??{},r=o(n,t);n.style=r?{...e,...r}:e}}restyleScene(e){this._customRestyle?(this.applyCustomRestyle(this.scene,e),this.markStylePaintPending(),this.updateResults.recordRestyle(!0)):this.updateResults.recordRestyle(!1)}updateConfig(e){const t={...this.config},o=Object.keys(e).filter(o=>e[o]!==t[o]);"production"!==process.env.NODE_ENV&&!this.windowSizeWarned&&"windowSize"in e&&e.windowSize!==t.windowSize&&(this.windowSizeWarned=!0,console.warn(`[Semiotic] windowSize changed after mount (${t.windowSize} → ${e.windowSize}) but it is a mount-only setting — the ring buffer keeps its original capacity. Remount the chart (e.g. via a React key) to apply a new windowSize.`)),("colorScheme"in e||"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 n=!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,o=e&&this.config.valueAccessor||this.config.yAccessor,s=e&&t.valueAccessor||t.yAccessor,a=i||!Nt(e&&this.config.timeAccessor||this.config.xAccessor,e&&t.timeAccessor||t.xAccessor),l=i||!Nt(o,s);(a||l)&&(e?(this.getX=Dt(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=Dt(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=Dt(this.config.xAccessor,"x"),this.getY=Dt(this.config.yAccessor,"y")),l&&this.resolvedRibbons.some(e=>"bounds"===e.kind)&&(this.resolvedRibbons=Cn(this.config)),n=!0,r=!0)}if("groupAccessor"in e&&!Nt(e.groupAccessor,t.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?Ot(this.config.groupAccessor):void 0,n=!0),"categoryAccessor"in e&&!Nt(e.categoryAccessor,t.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?Ot(this.config.categoryAccessor):void 0,n=!0),"sizeAccessor"in e&&!Nt(e.sizeAccessor,t.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?Dt(this.config.sizeAccessor,"size"):void 0,n=!0),"symbolAccessor"in e&&!Nt(e.symbolAccessor,t.symbolAccessor)&&(this.getSymbol=null!=this.config.symbolAccessor?Ot(this.config.symbolAccessor):void 0,n=!0),"colorAccessor"in e&&!Nt(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?Ot(this.config.colorAccessor):void 0,n=!0),"y0Accessor"in e&&!Nt(e.y0Accessor,t.y0Accessor)&&(this.getY0=this.config.y0Accessor?Dt(this.config.y0Accessor,"y0"):void 0,n=!0,r=!0),("boundsAccessor"in e&&!Nt(e.boundsAccessor,t.boundsAccessor)||"band"in e&&e.band!==t.band||"boundsStyle"in e&&e.boundsStyle!==t.boundsStyle)&&(this.resolvedRibbons=Cn(this.config),n=!0,r=!0),"pointIdAccessor"in e&&!Nt(e.pointIdAccessor,t.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?Ot(this.config.pointIdAccessor):void 0,n=!0),"candlestick"===this.config.chartType&&(i||"openAccessor"in e&&!Nt(e.openAccessor,t.openAccessor)||"closeAccessor"in e&&!Nt(e.closeAccessor,t.closeAccessor)||"highAccessor"in e&&!Nt(e.highAccessor,t.highAccessor)||"lowAccessor"in e&&!Nt(e.lowAccessor,t.lowAccessor))){const e=null!=this.config.openAccessor,t=null!=this.config.closeAccessor;this.getOpen=e?Dt(this.config.openAccessor,"open"):void 0,this.getHigh=Dt(this.config.highAccessor,"high"),this.getLow=Dt(this.config.lowAccessor,"low"),this.getClose=t?Dt(this.config.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!e&&!t,n=!0,r=!0}if("accessorRevision"in e&&e.accessorRevision!==t.accessorRevision&&(n=!0,r=!0),!n){const o=Object.keys(e).filter(e=>!e.endsWith("Accessor")&&"timeAccessor"!==e&&"valueAccessor"!==e);for(const r of o)if(e[r]!==t[r]){n=!0;break}}n&&(r&&this.rebuildExtents(),this.needsFullRebuild=!0),this.updateResults.recordConfig(o)}updateConfigWithResult(e){return this.updateConfig(e),this.updateResults.last}};sr.GROUP_COLOR_MAP_CAP=1e3;var ar=sr;Fn(ar);var lr=require("react"),cr={sceneGeometry:0,layout:0,domain:0};function ur(e){const{domain:t,layout:o,sceneGeometry:n}=e.revisions;return{domain:t,layout:o,sceneGeometry:n}}function dr(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 hr="production"!==process.env.NODE_ENV,fr={revisions:cr,signature:"",sawSignals:!1,wasUnconsumed:!1,warnUnconsumed:!1},mr=class{constructor(e="scene host"){this.hostName=e,this.lastConsumed=cr,this.lastObserved=cr,this.lastDuplicateWarning="",this.lastUnconsumedWarning=""}observeUpdateResult(e){hr&&(this.lastObserved=dr(this.lastObserved,ur(e)))}beforeCompute(e,t){if(!hr)return fr;const o=dr(ur(e),this.lastObserved),n=function(e){return`${e.sceneGeometry}|${e.layout}|${e.domain}`}(o),r=!((i=o).sceneGeometry===(s=this.lastConsumed).sceneGeometry&&i.layout===s.layout&&i.domain===s.domain);var i,s;return{revisions:o,signature:n,sawSignals:e.changed.has("scene-geometry")||e.changed.has("layout")||e.changed.has("domain"),wasUnconsumed:r,warnUnconsumed:!t&&r&&this.lastUnconsumedWarning!==n}}afterCompute(e,t,o){if(hr){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&&!o&&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="")}}};function pr(e){return(0,lr.useRef)(new mr(e))}var gr=(0,lr.memo)(function({store:e,diagnostics:t}){return(0,lr.useEffect)(()=>{const o=()=>t.observeUpdateResult(e.getUpdateSnapshot());return o(),e.subscribeUpdateResult(o)},[t,e]),null}),yr=d(require("react"));function br(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:yr.createElement(yr.Fragment,null,...t)}var vr=d(require("react")),xr=require("react/jsx-runtime"),kr={isActive:!1,predicate:()=>!0},wr=vr.createContext(null);function Sr({value:e,children:t}){return(0,xr.jsx)(wr.Provider,{value:e,children:t})}function Ar(){return vr.useContext(wr)??kr}function Cr(e,t){return null!=e?(0,xr.jsx)(Sr,{value:t,children:e}):e}var Mr=require("react");function _r(e,t,o,n){(0,Mr.useEffect)(()=>{e.current?.updateConfig(t),o.current=!0,n()},[t,n,e,o])}function Pr(e,t,o,n){const r=(0,Mr.useRef)(null);(0,Mr.useEffect)(()=>{const i=e.current;if(!i)return;const s=t??null;r.current!==s&&(r.current=s,i.setLayoutSelection(s),i.hasCustomRestyle?i.restyleScene(s):o.current=!0,n())},[t,n,e,o])}function Rr(e,t,o){return o.x>e||e>o.x+o.w||o.y>t||t>o.y+o.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:o.x+o.w/2,cy:o.y+o.h/2}}function jr(e,t=30){return Math.max((e??4)+5,12,t)}function Lr(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function Tr(e,t){const o=Lr(e);if(!o)return!1;const n=Lr(t);return!n||o.getFullYear()!==n.getFullYear()||o.getMonth()!==n.getMonth()}function Ir(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}var $r=[40,40],Nr=[.5,.5];function Dr(e,t){const[o,n]=e.viewBox??$r,[r,i]=e.anchor??Nr,s=n>0?n:1,a=Math.max(0,t)/s,l=(o>0?o:s)*a,c=s*a;return{width:l,height:c,scale:a,offsetX:-r*l,offsetY:-i*c}}function Er(e,t,o,n){if("none"!==e)return"color"===e||null==e?t??n:"accent"===e?o:e}var Or=null;function Br(e){if("undefined"==typeof Path2D)return null;Or||(Or=new Map);const t=Or.get(e);if(t)return t;const o=new Path2D(e);return Or.size>1024&&Or.clear(),Or.set(e,o),o}function Fr(e,t,o=0,n="horizontal"){const[r,i]=e.viewBox??$r,s=Math.min(1,Math.max(0,o)),a=Math.min(1,Math.max(0,t));return a>s?s>0||1>a?"vertical"===n?{x:0,y:i*(1-a),width:r,height:i*(a-s)}:{x:r*s,y:0,width:r*(a-s),height:i}:null:{x:0,y:0,width:0,height:0}}function zr(e,t){const o=Dr(e,t);return{centerDx:o.offsetX+o.width/2,centerDy:o.offsetY+o.height/2,halfWidth:o.width/2,halfHeight:o.height/2,radius:Math.hypot(o.width,o.height)/2}}function Hr(e,t,o,n,r,i=e=>e){for(const s of t.parts){const t=Br(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:Er(s.fill,o,n);c&&(e.fillStyle=i(c),e.fill(t));const u=r?s.stroke&&"none"!==s.stroke?r:void 0:Er(s.stroke??"none",o,n);u&&(e.strokeStyle=i(u),e.lineWidth=s.strokeWidth??1,e.lineCap=s.strokeLinecap??"butt",e.lineJoin=s.strokeLinejoin??"miter",e.stroke(t)),1!==a&&(e.globalAlpha=l)}}function Wr(e,t,o,n,r,i=e=>e.x,s=e=>e.y,a=e=>e.r){const l=Math.max(n,r+5,12),c=t-l,u=t+l,d=o-l,h=o+l;let f=null,m=1/0;return e.visit((e,r,l,p,g)=>{if(r>u||c>p||l>h||d>g)return!0;if(!e.length){let r=e;do{const e=r.data,l=i(e)-t,c=s(e)-o,u=Math.sqrt(l*l+c*c);jr(a(e),n)>=u&&m>u&&(f=e,m=u),r=r.next}while(r)}return!1}),f?{node:f,distance:m}:null}var qr=new WeakMap,Yr=0,Gr=!1,Vr=null,Xr=null;function Ur(e,t){if(!t)return t;const o=function(e){const t=e.trim();if(!t.startsWith("var(")||!t.endsWith(")"))return null;const o=t.slice(4,-1),n=o.indexOf(",");if(-1===n){const e=o.trim();return e.startsWith("--")?{name:e}:null}const r=o.slice(0,n).trim(),i=o.slice(n+1).trim();return r.startsWith("--")?{name:r,fallback:i||void 0}:null}(t);if(!o)return t;const n=()=>o.fallback?Ur(e,o.fallback):t,r=e.canvas;if(!r)return n();!function(){if(Gr)return;if("undefined"==typeof window||"undefined"==typeof document)return;Gr=!0;const e=()=>{Yr++};if("undefined"!=typeof MutationObserver&&document.documentElement&&new MutationObserver(e).observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"],subtree:!0}),"function"==typeof window.matchMedia)try{Vr=window.matchMedia("(prefers-color-scheme: dark)"),Xr=e,"function"==typeof Vr.addEventListener?Vr.addEventListener("change",Xr):"function"==typeof Vr.addListener&&Vr.addListener(Xr)}catch{}}();let i=qr.get(r);i&&i.version===Yr||(i={version:Yr,map:new Map},qr.set(r,i));const s=i.map.get(t);if(void 0!==s)return s;const a=getComputedStyle(r).getPropertyValue(o.name).trim()||n()||t;return i.map.set(t,a),a}function Kr(e,t){const o=e.fillStyle,n="#010203";try{e.fillStyle=n,e.fillStyle=t}catch{return e.fillStyle=o,[78,121,167]}const r=e.fillStyle;if(e.fillStyle=o,"string"!=typeof r)return[78,121,167];if(r.toLowerCase()===n&&t.trim().toLowerCase()!==n)return[78,121,167];if(r.startsWith("#"))return[parseInt(r.slice(1,3),16),parseInt(r.slice(3,5),16),parseInt(r.slice(5,7),16)];const i=r.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return i?[+i[1],+i[2],+i[3]]:[78,121,167]}function Qr(e){return{type:"hatch",background:e.background,stroke:e.stroke,lineWidth:e.lineWidth,spacing:e.spacing,angle:e.angle}}var Zr=null;function Jr(e={},t){const{background:o="transparent",stroke:n="#000",lineWidth:r=1.5,spacing:i=6,angle:s=45}=e,a={background:o,stroke:n,lineWidth:r,spacing:i,angle:s},l=Math.max(8,Math.ceil(2*i));let c;try{c=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(Zr||(Zr=document.createElement("canvas")),Zr.width=e,Zr.height=e,Zr)}(l)}catch{return Qr(a)}const u=c.getContext("2d");if(!u)return Qr(a);o&&"transparent"!==o?(u.fillStyle=o,u.fillRect(0,0,l,l)):u.clearRect(0,0,l,l),u.strokeStyle=n,u.lineWidth=r,u.lineCap="square";const d=s*Math.PI/180;if(45===s||-45===s){const e=s>0?1:-1;for(let t=-l;2*l>=t;t+=i)u.beginPath(),u.moveTo(t,0),u.lineTo(t+e*l,l),u.stroke()}else{u.save(),u.translate(l/2,l/2),u.rotate(d);const e=2*l;for(let t=-e;e>=t;t+=i)u.beginPath(),u.moveTo(-e,t),u.lineTo(e,t),u.stroke();u.restore()}return(t||u).createPattern(c,"repeat")}var ei=require("react/jsx-runtime");function ti(e){return"object"==typeof e&&null!==e&&"hatch"===e.type}function oi(e){return["hatch",e.background??"transparent",e.stroke??"#000",e.lineWidth??1.5,e.spacing??6,e.angle??45,e.lineOpacity??1].join("|")}function ni(e,t){let o=2166136261;const n=oi(t);for(let e=0;n.length>e;e++)o^=n.charCodeAt(e),o=Math.imul(o,16777619);return`${e}-hatch-${(o>>>0).toString(36)}`}var ri=new Map;function ii(e,t){const{background:o="transparent",stroke:n="#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,ei.jsxs)("pattern",{id:t,width:l,height:l,patternUnits:"userSpaceOnUse",patternTransform:0!==s?`rotate(${s})`:void 0,children:[o&&"transparent"!==o&&(0,ei.jsx)("rect",{width:l,height:l,fill:o}),(0,ei.jsx)("line",{x1:0,y1:0,x2:0,y2:l,stroke:n,strokeWidth:r,strokeOpacity:a}),(0,ei.jsx)("line",{x1:i,y1:0,x2:i,y2:l,stroke:n,strokeWidth:r,strokeOpacity:a})]},t)}function si(e,t,o="#4e79a7"){if(ti(e)){const o=ni(t,e);return{fill:`url(#${o})`,def:ii(e,o)}}return e&&"string"==typeof e?{fill:e}:{fill:o}}var ai=require("d3-shape");function li(e){switch(e){case"monotoneX":return ai.curveMonotoneX;case"monotoneY":return ai.curveMonotoneY;case"cardinal":return ai.curveCardinal;case"catmullRom":return ai.curveCatmullRom;case"step":return ai.curveStep;case"stepBefore":return ai.curveStepBefore;case"stepAfter":return ai.curveStepAfter;case"basis":return ai.curveBasis;case"natural":return ai.curveNatural;default:return null}}function ci(e,t,o){if(null==t)return o;if(ti(t)){const n=function(e,t){const o=e.background??"transparent",n=e.stroke??"#000",r="transparent"===o||"none"===o?o:Ur(t,o)||o,i=Ur(t,n)||n||"#000",s="undefined"!=typeof window&&window.devicePixelRatio||1,a=`${oi(e)}|${r}|${i}@${s}`,l=ri.get(a);if(void 0!==l)return l;const c=Jr({background:r,stroke:i,lineWidth:e.lineWidth,spacing:e.spacing,angle:e.angle},t),u=ti(c)?null:c;return ri.set(a,u),u}(t,e);return n||t.background&&Ur(e,t.background)||o}return"string"!=typeof t?t:Ur(e,t)||o}function ui(e,t){if(null==t)return;const o=ci(e,t,"");return""===o?void 0:o}function di(e,t,o,n,r,i,s){const a=t.stops.filter(e=>Number.isFinite(e.offset)&&(null==e.opacity||Number.isFinite(e.opacity)));if(2>a.length)return null;const l=e.createLinearGradient(n,r,i,s);for(const t of a)l.addColorStop(Math.max(0,Math.min(1,t.offset)),hi(e,t,o));return l}function hi(e,t,o){const n=t.color??o,r=Ur(e,n)||n;if(null==t.opacity)return r;const i=Math.max(0,Math.min(1,t.opacity)),[s,a,l]=Kr(e,r);return`rgba(${s},${a},${l},${i})`}function fi(e,t,o,n){t.fill&&(e.fillStyle=ci(e,t.fill,o),void 0!==t.fillOpacity&&(e.globalAlpha=(t.opacity??1)*t.fillOpacity),n())}function mi(e,t,o){t.stroke&&"none"!==t.stroke&&(e.strokeStyle=Ur(e,t.stroke)||t.stroke,e.lineWidth=t.strokeWidth??1,e.globalAlpha=(t.opacity??1)*(t.strokeOpacity??1),o())}var pi=require("d3-shape"),gi=new WeakMap;function yi(e,t){const o=li(t);if(!o)return e;const n=gi.get(e);if(n)return n;const r=function(e,t,o=8){if(!t||2>e.length)return e.map(([e,t])=>[e,t]);const n=[];let r=null;const i={moveTo(e,t){r=[e,t],n.push([e,t])},lineTo(e,t){r=[e,t],n.push([e,t])},bezierCurveTo(e,t,i,s,a,l){if(!r)return r=[a,l],void n.push([a,l]);const[c,u]=r;for(let r=1;o>=r;r++){const d=r/o,h=1-d;n.push([h*h*h*c+3*h*h*d*e+3*h*d*d*i+d*d*d*a,h*h*h*u+3*h*h*d*t+3*h*d*d*s+d*d*d*l])}r=[a,l]},closePath(){},arc(){},rect(){},arcTo(){},quadraticCurveTo(e,t,o,i){r=[o,i],n.push([o,i])}};return(0,pi.line)().x(e=>e[0]).y(e=>e[1]).curve(t).context(i)(e),n}(e,o);return gi.set(e,r),r}function bi(e,t,o,n=30,r,i=0){let s=null;if(r){const e=Wr(r,t,o,n,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=xi(i,t,o,n);break;case"symbol":e=ki(i,t,o,n);break;case"glyph":e=wi(i,t,o,n);break;case"line":e=Si(i,t,o,n);break;case"rect":if(null==i.datum)break;e=Ci(i,t,o);break;case"heatcell":e=Mi(i,t,o);break;case"area":if(!1===i.interactive)break;e=Pi(i,t,o);break;case"candlestick":e=_i(i,t,o)}e&&n>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}function vi(e,t,o){if(0===e.length)return null;if(e[0][0]>t||t>e[e.length-1][0])return null;const n=Ri(e,t);if(0>n)return null;if(Math.abs(e[n][0]-t)>o)return null;let r=n,i=n;n>0&&e[n][0]>=t?(r=n-1,i=n):e.length-1>n&&(r=n,i=n+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 xi(e,t,o,n=30){const r=t-e.x,i=o-e.y,s=Math.sqrt(r*r+i*i);return s>jr(e.r,n)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:s}}function ki(e,t,o,n=30){const r=t-e.x,i=o-e.y,s=Math.sqrt(r*r+i*i);return s>jr(pn(e.size),n)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:s}}function wi(e,t,o,n=30){if(null==e.datum)return null;const r=zr(e.glyph,e.size),i=e.x+r.centerDx,s=e.y+r.centerDy,a=t-i,l=o-s,c=Math.sqrt(a*a+l*l);return c>jr(r.radius,n)?null:{node:e,datum:e.datum,x:i,y:s,distance:c}}function Si(e,t,o,n=30){if(0===e.path.length)return null;const r=Ri(e.path,t);if(0>r)return null;const[i,s]=e.path[r];let a;if(e.path.length>1){let n=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=Ai(t,o,i,s,a,l);n>c&&(n=c)}a=n}else{const e=t-i,n=o-s;a=Math.sqrt(e*e+n*n)}const l=e.style;return a>Math.max(5,(l.strokeWidth??l.lineWidth??1)/2+2,n)?null:{node:e,datum:Array.isArray(e.datum)&&e.datum[r]?e.datum[r]:e.datum,x:i,y:s,distance:a}}function Ai(e,t,o,n,r,i){const s=r-o,a=i-n,l=s*s+a*a;if(0===l)return Math.sqrt((e-o)**2+(t-n)**2);let c=((e-o)*s+(t-n)*a)/l;return c=Math.max(0,Math.min(1,c)),Math.sqrt((e-(o+c*s))**2+(t-(n+c*a))**2)}function Ci(e,t,o){const n=Rr(t,o,e);return n.hit?{node:e,datum:e.datum,x:n.cx,y:n.cy,distance:0}:null}function Mi(e,t,o){const n=Rr(t,o,e);return n.hit?{node:e,datum:e.datum,x:n.cx,y:n.cy,distance:0}:null}function _i(e,t,o){const n=e.bodyWidth/2,r=Math.min(e.openY,e.closeY);if(!(e.x-n-3>t||t>e.x+n+3||e.highY-3>o||o>e.lowY+3)){const n=r+Math.max(Math.max(e.openY,e.closeY)-r,1)/2,i=t-e.x,s=o-n;return{node:e,datum:e.datum,x:e.x,y:n,distance:Math.sqrt(i*i+s*s)}}return null}function Pi(e,t,o){if(0===e.topPath.length)return null;const n=Ri(e.topPath,t);if(0>n)return null;const[r,i]=e.topPath[n],s=t-r,a=o-i,l=Math.sqrt(s*s+a*a);return{node:e,datum:Array.isArray(e.datum)&&e.datum[n]?e.datum[n]:e.datum,x:r,y:i,distance:l}}function Ri(e,t){if(0===e.length)return-1;let o=0,n=e.length-1;for(;n>o;){const r=o+n>>1;t>e[r][0]?o=r+1:n=r}return o>0&&Math.abs(e[o][0]-t)>=Math.abs(e[o-1][0]-t)?o-1:o}var ji=require("react"),Li={fresh:1,aging:.7,stale:.45,expired:.25},Ti={alpha:1,band:"fresh",isStale:!1};function Ii(e,t){if(!e||0>=t)return Ti;const o=null!=e.threshold&&e.threshold>0?e.threshold:5e3,n=e.graded;if(n){const e="object"==typeof n?n:{},r=Lo(t,o,e.thresholds);return{alpha:{...Li,...e.opacities??{}}[r],band:r,isStale:"fresh"!==r}}return t>o?{alpha:e.dimOpacity??.5,band:"stale",isStale:!0}:Ti}function $i(e,t,o,n,r,i){const s=(0,ji.useRef)("fresh");(0,ji.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=Ii(e,l-a.lastIngestTime);c.band===s.current&&c.isStale===r||(s.current=c.band,c.isStale!==r&&i(c.isStale),o.current=!0,n())},1e3);return()=>clearInterval(a)},[e,r,n,t,i,o])}var Ni=require("react/jsx-runtime");function Di({isStale:e,position:t}){return(0,Ni.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 Ei=require("react"),Oi=d(require("react"));function Bi(...e){let t;for(const o of e)o&&(t=Fi(t)&&Fi(o)?{legendGroups:[...t.legendGroups,...o.legendGroups],legendDistance:o.legendDistance??t.legendDistance}:o);return t}function Fi(e){return"object"==typeof e&&null!==e&&"legendGroups"in e&&Array.isArray(e.legendGroups)}function zi(e){return"object"==typeof e&&null!==e&&"gradient"in e}var Hi=16,Wi=6,qi=10,Yi=22,Gi=100,Vi=10;function Xi(e){return Math.ceil(7*e.length)}function Ui(e,t){if(Fi(e)){const o=is(t),n=e.legendGroups.flatMap(e=>[e.label?Xi(e.label):0,...e.items.map(e=>o.swatchSize+o.labelGap+Xi(e.label))]);return Math.max(Gi,...n)}if(zi(e)){const{gradient:t}=e,o=t.format||(e=>Math.round(100*e)/100+""),n=Math.max(Xi(o(t.domain[0])),Xi(o(t.domain[1]))),r=t.label?Xi(t.label):0;return Math.max(Gi,19+n,r)}return Gi}function Ki(e){return(Fi(e)||zi(e))&&Number.isFinite(e.legendDistance)?Math.max(0,e.legendDistance):Vi}function Qi(e){return Math.max(0,e?.sideGutter??0)}var Zi=22,Ji=46,es=64;function ts(e,t){return null!=t?.axisGutter?Math.max(0,t.axisGutter):e?.hasAxis?e.hasAxisLabel?e.rotatedTicks?es:Ji:Zi:0}function os(e){return{hasAxis:!1!==e.showAxes,hasAxisLabel:!!e.xLabel}}function ns(e){const t=e.projection??"vertical";return{hasAxis:!1!==e.showAxes&&"radial"!==t,hasAxisLabel:"horizontal"===t?e.hasValueLabel:e.hasCategoryLabel}}function rs(e,t,o){if(zi(e))return e.gradient.label?34:26;if(!Fi(e))return 20;const n=is(o),r=Math.max(1,o?.maxWidth??t);let i=n.rowHeight;for(const t of e.legendGroups){let e=0,o=0;for(const i of t.items){const t=n.swatchSize+n.labelGap+Xi(i.label),s=0===o?t:o+n.itemGap+t;o>0&&s>r?(e+=1,o=t):o=s}t.items.length>0&&(e+=1),i=Math.max(i,e*n.rowHeight,t.label?Xi(t.label):0)}return i+(e.legendGroups.length>1?16:0)}function is(e){const t=Math.max(1,e?.swatchSize??Hi),o=Math.max(t,e?.rowHeight??Yi);return{swatchSize:t,labelGap:Math.max(0,e?.labelGap??Wi),itemGap:Math.max(0,e?.itemGap??qi),rowHeight:o,align:"left"===e?.align?"start":"right"===e?.align?"end":e?.align??"start",maxWidth:e?.maxWidth}}var ss=require("react/jsx-runtime"),as={fill:(e,t)=>(0,ss.jsx)("rect",{style:e,width:t,height:t}),line:(e,t)=>(0,ss.jsx)("line",{style:e,x1:0,y1:0,x2:t,y2:t})};function ls(e,t,o,n,r){let i;return i="function"==typeof o?o(e):(0,as[o])(n(e,t),r),i}function cs({swatchSize:e}){return(0,ss.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 us(e,t,o){return o&&o.size>0?o.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}var ds=(e,t,o,n,r,i,s,a,l,c,u)=>{const{type:d="fill",styleFn:h,items:f}=e,m=[];let p=0;const g=!(!t&&!o),y="isolate"===c||void 0===c&&null!=r,{swatchSize:b,labelGap:v,rowHeight:x}=u;return f.forEach((e,c)=>{const u=ls(e,c,d,h,b),k=us(e,n,r),w=r&&r.size>0&&r.has(e.label);m.push((0,ss.jsxs)("g",{transform:`translate(0,${p})`,onClick:t?()=>t(e):void 0,onMouseEnter:o?()=>o(e):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:g?a===i&&c===s?0:-1:void 0,role:g?"option":void 0,"aria-selected":g&&y?w||!1:void 0,"aria-current":g&&!y&&null!=n&&e.label===n||void 0,"aria-label":e.label,onKeyDown:g?o=>{if("Enter"!==o.key&&" "!==o.key||(o.preventDefault(),t&&t(e)),"ArrowDown"===o.key||"ArrowUp"===o.key){o.preventDefault();const e=(c+("ArrowDown"===o.key?1:-1)+f.length)%f.length;l(a,e);const t=o.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:g?t=>{l(a,c),o&&o(e);const n=t.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:g?e=>{o&&o(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,ss.jsx)("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:b+v+2+7*e.label.length,height:b+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),u,w&&(0,ss.jsx)(cs,{swatchSize:b}),(0,ss.jsx)("text",{y:b/2,x:b+v,dominantBaseline:"central",fontSize:12,style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+c)),p+=x}),m},hs=({legendGroups:e,width:t,customClickBehavior:o,customHoverBehavior:n,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:s,focusedItemIndex:a,onFocusedIndexChange:l,legendInteraction:c,metrics:u})=>{const d=[],h=function(e,t){let o=24;return e.map(({hasLabel:e,itemCount:n})=>{o+=5;const r=o;let i;o+=8,e&&(o+=16,i=o,o+=8);const s=o;return o+=n*t+8,{lineY:r,labelY:i,itemsY:s,endY:o}})}(e.map(e=>({hasLabel:!!e.label,itemCount:e.items.length})),u.rowHeight);return e.forEach((e,f)=>{const m=h[f];d.push((0,ss.jsx)("line",{stroke:"gray",x1:0,y1:m.lineY,x2:t,y2:m.lineY},"legend-top-line legend-symbol-"+f)),e.label&&null!=m.labelY&&d.push((0,ss.jsx)("text",{y:m.labelY,className:"legend-group-label",fontSize:12,style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label},"legend-text-"+f)),d.push((0,ss.jsx)("g",{className:"legend-item",transform:`translate(0,${m.itemsY})`,children:ds(e,o,n,r,i,s,a,f,l,c,u)},"legend-group-"+f))}),d},fs=({legendGroups:e,height:t,width:o,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u,metrics:d})=>{let h=0;const f=[];e.forEach((e,t)=>{let m=0;e.label&&(m+=16);const p=((e,t,o,n,r,i,s,a,l,c,u,d)=>{const{type:h="fill",styleFn:f,items:m}=e,p=[],{swatchSize:g,labelGap:y,itemGap:b,rowHeight:v,align:x}=u,k=!(!t&&!o),w="isolate"===c||void 0===c&&null!=r,S=m.map(e=>g+y+7*e.label.length),A=[];let C=0,M=0;S.forEach((e,t)=>{const o=0===M?e:M+b+e;d&&d>0&&M>0&&o>d?(A.push({start:C,end:t,width:M}),C=t,M=e):M=o}),m.length>0&&A.push({start:C,end:m.length,width:M}),A.forEach((e,c)=>{let u="center"===x?Math.max(0,((d??e.width)-e.width)/2):"end"===x?Math.max(0,(d??e.width)-e.width):0;for(let d=e.start;e.end>d;d++){const e=m[d],x=ls(e,d,h,f,g),A=us(e,n,r),C=r&&r.size>0&&r.has(e.label);p.push((0,ss.jsxs)("g",{transform:`translate(${u},${c*v})`,onClick:t?()=>t(e):void 0,onMouseEnter:o?()=>o(e):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:k?a===i&&d===s?0:-1:void 0,role:k?"option":void 0,"aria-selected":k&&w?C||!1:void 0,"aria-current":k&&!w&&null!=n&&e.label===n||void 0,"aria-label":e.label,onKeyDown:k?o=>{if("Enter"!==o.key&&" "!==o.key||(o.preventDefault(),t&&t(e)),"ArrowRight"===o.key||"ArrowLeft"===o.key){o.preventDefault();const e=(d+("ArrowRight"===o.key?1:-1)+m.length)%m.length;l(a,e);const t=o.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:k?t=>{l(a,d),o&&o(e);const n=t.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:k?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:k?"pointer":"default",opacity:A,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[k&&(0,ss.jsx)("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:g+y+2+7*e.label.length,height:g+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),x,C&&(0,ss.jsx)(cs,{swatchSize:g}),(0,ss.jsx)("text",{y:g/2,x:g+y,dominantBaseline:"central",fontSize:12,style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+d)),u+=S[d]+b}});const _=Math.max(0,...A.map(e=>e.width)),P=A.length;return{items:p,offset:_,totalRows:P,totalHeight:P*v}})(e,n,r,i,s,a,l,t,c,u,d,d.maxWidth??o);m+=p.offset+5,f.push({label:e.label,...p,offset:m,totalRows:p.totalRows,totalHeight:p.totalHeight}),h+=m+12});const m=d.maxWidth??o;let p=h>m?0:"center"===d.align?Math.max(0,(m-h)/2):"end"===d.align?Math.max(0,m-h):0;const g=[];return f.forEach((o,n)=>{const r=e[n];r.label&&(g.push((0,ss.jsx)("text",{transform:`translate(${p},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",fontSize:12,style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:r.label},"legend-text-"+n)),p+=16),g.push((0,ss.jsx)("g",{className:"legend-item",transform:`translate(${p},0)`,children:o.items},"legend-group-"+n)),p+=o.offset+5,e[n+1]&&g.push((0,ss.jsx)("line",{stroke:"gray",x1:p,y1:-8,x2:p,y2:(o.totalHeight||t)+0+8},"legend-top-line legend-symbol-"+n)),p+=12}),(0,ss.jsx)("g",{children:g})};function ms({config:e,orientation:t="vertical",width:o=100}){const{colorFn:n,domain:r,label:i,format:s}=e,a=s||(e=>Math.round(100*e)/100+""),l="grad-legend-"+Oi.useId();if("horizontal"===t){const e=12,t=Math.min(o,200),s=Math.max(0,(o-t)/2),c=[];for(let e=0;64>=e;e++){const t=e/64;c.push((0,ss.jsx)("stop",{offset:100*t+"%",stopColor:n(r[0]+t*(r[1]-r[0]))},e))}return(0,ss.jsxs)("g",{"aria-label":i||"Gradient legend",children:[(0,ss.jsx)("defs",{children:(0,ss.jsx)("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),i&&(0,ss.jsx)("text",{x:s+t/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),(0,ss.jsx)("rect",{x:s,y:0,width:t,height:e,fill:`url(#${l})`,rx:2}),(0,ss.jsx)("text",{x:s,y:e+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[0])}),(0,ss.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,ss.jsx)("stop",{offset:100*t+"%",stopColor:n(r[1]-t*(r[1]-r[0]))},e))}return(0,ss.jsxs)("g",{"aria-label":i||"Gradient legend",children:[i&&(0,ss.jsx)("text",{x:0,y:-6,textAnchor:"start",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),(0,ss.jsx)("defs",{children:(0,ss.jsx)("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:c})}),(0,ss.jsx)("rect",{x:0,y:0,width:14,height:100,fill:`url(#${l})`,rx:2}),(0,ss.jsx)("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[1])}),(0,ss.jsx)("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[0])})]})}function ps(e){const{legendGroups:t,customClickBehavior:o,customHoverBehavior:n,highlightedCategory:r,isolatedCategories:i,legendInteraction:s,title:a="Legend",width:l=100,height:c=20,orientation:u="vertical",legendLayout:d}=e,h=is(d),[f,m]=Oi.useState(0),[p,g]=Oi.useState(0),y=Oi.useCallback((e,t)=>{m(e),g(t)},[]),b="vertical"===u?hs({legendGroups:t||[],width:l,customClickBehavior:o,customHoverBehavior:n,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:p,onFocusedIndexChange:y,legendInteraction:s,metrics:h}):fs({legendGroups:t||[],title:a,height:c,width:l,customClickBehavior:o,customHoverBehavior:n,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:p,onFocusedIndexChange:y,legendInteraction:s,metrics:h}),v=!(!o&&!n);return(0,ss.jsxs)("g",{role:v?"listbox":void 0,"aria-multiselectable":!(!v||"isolate"!==s&&(void 0!==s||null==i))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==a&&""!==a&&"vertical"===u&&(0,ss.jsx)("text",{className:"legend-title",y:16,x:l/2,textAnchor:"middle",fontSize:12,style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:a}),b]})}var gs=require("react/jsx-runtime");function ys(e){const{legend:t,totalWidth:o,totalHeight:n,margin:r,legendPosition:i="right",legendLayout:s,legendHoverBehavior:a,legendClickBehavior:l,legendHighlightedCategory:c,legendIsolatedCategories:u,legendInteraction:d}=e;if(!t)return null;const h="top"===i||"bottom"===i,f=Math.max(0,o-r.left-r.right),m=Math.max(1,h?s?.maxWidth??f:Ui(t,s)),p=Ki(t),g=Qi(s),y=ts(e.axisChrome,s),b=ts(void 0,s),v=rs(t,f,s);let x,k;if("left"===i)x=r.left-g-m-p,k=r.top;else if("top"===i)x=r.left,k=r.top-b-p-v;else if("bottom"===i){x=r.left;const e=n-r.bottom;k=Math.max(e+p,Math.min(e+y+p,n-v))}else x=o-r.right+g+p,k=r.top;return(0,gs.jsx)("g",{transform:`translate(${x}, ${k})`,children:zi(t)?(0,gs.jsx)(ms,{config:t.gradient,orientation:h?"horizontal":"vertical",width:m}):Fi(t)?(0,gs.jsx)(ps,{legendGroups:t.legendGroups,title:"",width:m,orientation:h?"horizontal":"vertical",legendLayout:s,customHoverBehavior:a,customClickBehavior:l,highlightedCategory:c,isolatedCategories:u,legendInteraction:d}):t})}var bs=require("react"),vs=require("d3-array");L();var xs=require("react/jsx-runtime");function ks(e){return"string"==typeof e?{type:e}:e}function ws({orient:e,config:t,values:o,scale:n,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,bs.useMemo)(()=>{if(0===o.length)return null;const t=n.domain(),l=r-8;if("boxplot"===s.type){const t=function(e){const t=[...e].sort((e,t)=>e-t),o=t.length;if(0===o)return null;const n=t[Math.floor(.25*o)],r=t[Math.floor(.5*o)],i=t[Math.floor(.75*o)],s=i-n;return{q1:n,median:r,q3:i,whiskerLow:Math.max(t[0],n-1.5*s),whiskerHigh:Math.min(t[o-1],i+1.5*s)}}(o);if(!t)return null;const{q1:r,median:i,q3:c,whiskerLow:u,whiskerHigh:d}=t,h=Math.min(.5*l,20),f=(l-h)/2+4;if(a){const t=n(r),o=n(c),a=n(i),l=n(u),m=n(d),p="top"===e?-1:1,g=0;return(0,xs.jsxs)("g",{"data-testid":"marginal-boxplot-"+e,children:[(0,xs.jsx)("line",{x1:l,y1:g+p*(f+h/2),x2:m,y2:g+p*(f+h/2),stroke:s.fill,strokeWidth:s.strokeWidth}),(0,xs.jsx)("line",{x1:l,y1:g+p*f,x2:l,y2:g+p*(f+h),stroke:s.fill,strokeWidth:s.strokeWidth}),(0,xs.jsx)("line",{x1:m,y1:g+p*f,x2:m,y2:g+p*(f+h),stroke:s.fill,strokeWidth:s.strokeWidth}),(0,xs.jsx)("rect",{x:Math.min(t,o),y:"top"===e?g-f-h:g+f,width:Math.abs(o-t),height:h,fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth}),(0,xs.jsx)("line",{x1:a,y1:"top"===e?g-f-h:g+f,x2:a,y2:"top"===e?g-f:g+f+h,stroke:s.fill,strokeWidth:2})]})}{const t=n(r),o=n(c),a=n(i),l=n(u),m=n(d),p="left"===e?-1:1,g=0;return(0,xs.jsxs)("g",{"data-testid":"marginal-boxplot-"+e,children:[(0,xs.jsx)("line",{x1:g+p*(f+h/2),y1:l,x2:g+p*(f+h/2),y2:m,stroke:s.fill,strokeWidth:s.strokeWidth}),(0,xs.jsx)("line",{x1:g+p*f,y1:l,x2:g+p*(f+h),y2:l,stroke:s.fill,strokeWidth:s.strokeWidth}),(0,xs.jsx)("line",{x1:g+p*f,y1:m,x2:g+p*(f+h),y2:m,stroke:s.fill,strokeWidth:s.strokeWidth}),(0,xs.jsx)("rect",{x:"left"===e?g-f-h:g+f,y:Math.min(t,o),width:h,height:Math.abs(o-t),fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth}),(0,xs.jsx)("line",{x1:"left"===e?g-f-h:g+f,y1:a,x2:"left"===e?g-f:g+f+h,y2:a,stroke:s.fill,strokeWidth:2})]})}}const c=(0,vs.bin)().domain(t).thresholds(s.bins)(o);if(0===c.length)return null;const u=R(c.map(e=>e.length));if(0===u)return null;if("histogram"===s.type)return(0,xs.jsx)("g",{"data-testid":"marginal-histogram-"+e,children:c.map((t,o)=>{if(null==t.x0||null==t.x1)return null;const r=t.length/u*l;if(a){const i=n(t.x0),a=n(t.x1)-n(t.x0);return(0,xs.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},o)}{const i=n(t.x0),a=n(t.x1)-n(t.x0);return(0,xs.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},o)}})});if("violin"===s.type){const t=l/2+4,o=[];for(const r of c){if(null==r.x0||null==r.x1)continue;const i=r.length/u*(l/2),s=n((r.x0+r.x1)/2);o.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),d=n((i.x0+i.x1)/2);o.push(a?`${d},${"top"===e?-(t+s):t+s}`:`${"left"===e?-(t+s):t+s},${d}`)}return(0,xs.jsx)("g",{"data-testid":"marginal-violin-"+e,children:(0,xs.jsx)("polygon",{points:o.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 o=0,r=null!=c[0].x0?n(c[0].x0):0;t.push(`M${r},${o}`);for(const o of c){if(null==o.x0||null==o.x1)continue;const r=o.length/u*l,i=n((o.x0+o.x1)/2);t.push(`L${i},${"top"===e?-r-4:r+4}`)}const s=null!=c[c.length-1].x1?n(c[c.length-1].x1):i;t.push(`L${s},${o}`),t.push("Z")}else{const o=0,r=null!=c[0].x0?n(c[0].x0):0;t.push(`M${o},${r}`);for(const o of c){if(null==o.x0||null==o.x1)continue;const r=o.length/u*l,i=n((o.x0+o.x1)/2);t.push(`L${"left"===e?-r-4:r+4},${i}`)}const s=null!=c[c.length-1].x1?n(c[c.length-1].x1):i;t.push(`L${o},${s}`),t.push("Z")}return(0,xs.jsx)("g",{"data-testid":"marginal-ridgeline-"+e,children:(0,xs.jsx)("path",{d:t.join(" "),fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth})})}return null},[o,n,s,r,i,e,a,4]);return l?(0,xs.jsx)("g",{className:"marginal-"+e,"data-testid":"marginal-"+e,children:l}):null}var Ss=d(require("react")),As=require("react/jsx-runtime");function Cs(e,t=120,o=8){if(!e)return[];const n=Math.max(1,Math.floor(t/o)),r=e.split(/\s+/),i=[];let s="";for(const e of r)s&&s.length+1+e.length>n?(i.push(s),s=e):s=s?`${s} ${e}`:e;return s&&i.push(s),i}function Ms(e,t,o,n){return"curly"===e?n?`M0,0 C${.6*o},0 ${.4*o},${t/2} ${o},${t/2} C${.4*o},${t/2} ${.6*o},${t} 0,${t}`:`M0,0 C0,${.6*o} ${t/2},${.4*o} ${t/2},${o} C${t/2},${.4*o} ${t},${.6*o} ${t},0`:n?`M0,0 L${o},0 L${o},${t} L0,${t}`:`M0,0 L0,${o} L${t},${o} L${t},0`}function _s(e,t,o,n){if(!e)return(0,As.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,As.jsx)("g",{className:"annotation-note"});let u=s;u||(u=Math.abs(t)>Math.abs(o)?"leftRight":"topBottom");let d=a;d&&"dynamic"!==d||(d="topBottom"===u?0>t?"right":"left":0>o?"bottom":"top");let h="start";"topBottom"===u?"right"===d?h="end":"middle"===d&&(h="middle"):h=0>t?"end":"start";const f=16,m=i?c?[i]:Cs(i,l):[],p=r?c?[r]:Cs(r,l):[],g="leftRight"===u?"end"===h?-4:4:0;let y=0;const b=[],v=n||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";e.useHTML||e.html?b.push((0,As.jsx)("foreignObject",{className:"annotation-note-html",x:"end"===h?g-l:"middle"===h?g-l/2:g,y:-16,width:l,height:Math.max(f,(m.length+p.length)*f+(i&&r?2:0))+f,style:{overflow:"visible"},children:(0,As.jsxs)("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{color:v,fontSize:"12px",lineHeight:"16px",overflow:"visible",textAlign:"end"===h?"right":"middle"===h?"center":"left",whiteSpace:c?"nowrap":"normal",wordBreak:"break-word"},children:[i&&(0,As.jsx)("div",{className:"annotation-note-title",style:{fontWeight:"bold"},children:i}),r&&(0,As.jsx)("div",{className:"annotation-note-label",children:r})]})},"annotation-note-html")):(m.length>0&&(b.push((0,As.jsx)("text",{className:"annotation-note-title",fill:v,textAnchor:h,fontWeight:"bold",children:m.map((e,t)=>(0,As.jsx)("tspan",{x:g,dy:0===t?0:f,children:e},t))},"annotation-note-title")),y=m.length*f),p.length>0&&b.push((0,As.jsx)("text",{className:"annotation-note-label",fill:v,textAnchor:h,y:y,children:p.map((e,t)=>(0,As.jsx)("tspan",{x:g,dy:0===t?0:f,children:e},t))},"annotation-note-label")));let x=null;if((i||r)&&(0!==t||0!==o))if("topBottom"===u){const e=Math.min(l,120);let t=0,o=e;"end"===h?(t=-e,o=0):"middle"===h&&(t=-e/2,o=e/2),x=(0,As.jsx)("line",{className:"note-line",x1:t,x2:o,y1:0,y2:0,stroke:n||"var(--semiotic-text-secondary, currentColor)"})}else{const e=(m.length+p.length)*f+(p.length>0?f:0);let t=0,o=e;"bottom"===d?(t=-e,o=0):"middle"===d&&(t=-e/2,o=e/2),x=(0,As.jsx)("line",{className:"note-line",x1:0,x2:0,y1:t,y2:o,stroke:n||"var(--semiotic-text-secondary, currentColor)"})}const k=Math.max(0,m.length+p.length-1)*f;let w=0;return"topBottom"===u?w=0>o?-(k+2):18:"leftRight"===u&&(w="middle"===d?-(k+f+(p.length>0&&m.length>0?2:0))/2+8:"bottom"===d||0>o?-(k+2):18),(0,As.jsxs)("g",{className:"annotation-note",transform:`translate(${t},${o})`,children:[(0,As.jsx)("g",{className:"annotation-note-content",transform:0!==w?`translate(0,${w})`:void 0,children:b}),x]})}function Ps(e,t,o,n,r){const i=[];switch(e){case"callout-circle":{const e=(t?.radius||0)+(t?.radiusPadding||0);e>0&&i.push((0,As.jsx)("circle",{r:e,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const e=t?.width||0,n=t?.height||0;(e>0||n>0)&&i.push((0,As.jsx)("rect",{width:e,height:n,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":t?.custom&&i.push(...Array.isArray(t.custom)?t.custom:[t.custom]);break;case"xy-threshold":{const e=n||0,s=r||0;if(void 0!==t?.x){const n=(t.x||0)-e;i.push((0,As.jsx)("line",{x1:n,y1:(t.y1||0)-s,x2:n,y2:(t.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==t?.y){const n=(t.y||0)-s;i.push((0,As.jsx)("line",{x1:(t.x1||0)-e,y1:n,x2:(t.x2||0)-e,y2:n,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==t?.x1||void 0!==t?.x2?i.push((0,As.jsx)("line",{x1:(t.x1||0)-e,y1:0,x2:(t.x2||0)-e,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===t?.y1&&void 0===t?.y2||i.push((0,As.jsx)("line",{x1:0,y1:(t.y1||0)-s,x2:0,y2:(t.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const e=t?.type||"curly",n=t?.width??t?.height;void 0!==n&&i.push((0,As.jsx)("path",{d:Ms(e,n,t?.depth||30,void 0===t?.width),fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return(0,As.jsx)("g",{className:"annotation-subject",children:i})}function Rs(e,t,o,n,r,i){const s=[];let a=0,l=0;if("callout-circle"!==r&&"label"!==r||!i?.radius){if("callout-rect"===r&&i){const o=i.width||0,n=i.height||0;if(o>0||n>0){const r=o/2,i=n/2,s=e-r,c=t-i;if(0!==s||0!==c){const e=Math.abs(s),t=Math.abs(c),u=o/2,d=n/2,h=e*d>t*u?u/e:d/t;a=r+s*h,l=i+c*h}}}else if("bracket"===r&&i){const e=i.width,t=i.height,o=i.depth||30;void 0!==e?(a=e/2,l=o):void 0!==t&&(a=o,l=t/2)}}else{const o=(i.radius||0)+(i.radiusPadding||0);if(o>0&&(0!==e||0!==t)){const n=Math.atan2(t,e);a=Math.cos(n)*o,l=Math.sin(n)*o}}const c=Math.sqrt((e-a)**2+(t-l)**2);if(c>.5){const r=n||"var(--semiotic-text-secondary, currentColor)",i="curve"===o?.type;let u=Math.atan2(t-l,e-a);if(i){const n=(a+e)/2,i=(l+t)/2,d=-(t-l)/c,h=(e-a)/c,f=(o?.curve??.25)*c,m=n+d*f,p=i+h*f;s.push((0,As.jsx)("path",{className:"connector-curve",d:`M${a},${l}Q${m},${p} ${e},${t}`,fill:"none",stroke:r},"connector-line")),u=Math.atan2(p-l,m-a)}else s.push((0,As.jsx)("line",{x1:a,y1:l,x2:e,y2:t,stroke:r},"connector-line"));if("arrow"===o?.end){const e=10,t=16/180*Math.PI;s.push((0,As.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,As.jsx)("g",{className:"annotation-connector",children:s})}function js(e){const{x:t=0,y:o=0,dx:n,dy:r,nx:i,ny:s,note:a,connector:l,subject:c,type:u,color:d,className:h,disable:f,opacity:m,strokeDasharray:p,events:g={},"data-testid":y}=e,b=Array.isArray(t)?t[0]??0:t,v=Array.isArray(o)?o[0]??0:o,x=new Set(Array.isArray(f)?f:[]);let k=n||0,w=r||0;null!=i&&(k=i-b),null!=s&&(w=s-v);const S="string"==typeof u?u:"label";if("bracket"===S&&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,As.jsxs)("g",{className:("annotation "+(h||"")).trim(),transform:`translate(${b},${v})`,"data-testid":y,...null!=m&&{opacity:m},...p&&{strokeDasharray:p},...g,children:[!x.has("connector")&&Rs(k,w,l,d,S,c),!x.has("subject")&&Ps(S,c,d,b,v),!x.has("note")&&_s(a,k,w,d)]})}function Ls(e){const{noteData:t}=e,{screenCoordinates:o}=t,n="string"==typeof t.type?t.type:"label",r=t.eventListeners||t.events||{};if(t.coordinates&&o){const e=t.nx||o[0][0]+(t.dx??0),r=t.ny||o[0][1]+(t.dy??0),i=o.map((o,i)=>{const s=Object.assign({},t,{note:0===i?t.note:{label:""},x:o[0],y:o[1],nx:e,ny:r});return(0,As.jsx)(js,{"data-testid":"semiotic-annotation",...s,type:n},"multi-annotation-"+i)});return(0,As.jsx)("g",{children:i})}const i=t.note||{title:"none",label:t.label},s=`${i.label}-${i.title}-${t.i}`;return(0,As.jsx)(js,{"data-testid":"semiotic-annotation",events:r,...t,type:n},s)}var Ts=require("d3-hierarchy"),Is=require("d3-shape");function $s(e,t){const o=t.scales?.x??t.scales?.time;return o?null!=e.x?o(e.x):t.xAccessor&&null!=e[t.xAccessor]?o(e[t.xAccessor]):null:null}function Ns(e,t){const o=t.scales?.y??t.scales?.value;return o?null!=e.y?o(e.y):t.yAccessor&&null!=e[t.yAccessor]?o(e[t.yAccessor]):null:null}function Ds(e){return null==e?null:e+""}function Es(e,t,o){return t.stickyPositionCache?.set(e,o),o}function Os(e,t,o){const n=e.anchor||e.lifecycle?.anchor||"fixed";if("latest"===n){if(null!=e.pointId&&o.pointNodes&&o.pointNodes.length>0)for(let n=o.pointNodes.length-1;n>=0;n--){const r=o.pointNodes[n];if(r.pointId===e.pointId)return Es(t,o,{x:r.x,y:r.y})}const n=function(e){const t=e.data;if(!t||0===t.length)return null;const o=t[t.length-1],n=e.scales?.x??e.scales?.time,r=e.scales?.y??e.scales?.value;if(!n||!r)return null;const i=o[e.xAccessor||"x"],s=o[e.yAccessor||"y"];return null==i||null==s?null:{x:n(i),y:r(s)}}(o);return n?Es(t,o,n):null}if("semantic"===n){const n=function(e,t,o){const n=function(e){return Ds(e.provenance?.stableId??e.stableId)}(e);if(!n)return null;const r=o.pointNodes?.find(e=>Ds(e.pointId)===n);if(r)return Es(t,o,{x:r.x,y:r.y});const i=o.data?.find(e=>function(e){return Ds(e.stableId??e.id??e.provenance?.stableId)}(e)===n);if(!i)return null;const s=$s(i,o),a=Ns(i,o);return null==s||null==a?null:Es(t,o,{x:s,y:a})}(e,t,o);if(n)return n}let r=null,i=null;if(null!=e.pointId&&o.pointNodes){const t=o.pointNodes.find(t=>t.pointId===e.pointId);t&&(r=t.x,i=t.y)}if(null!=r&&null!=i||(r=$s(e,o),i=Ns(e,o)),null!=r&&null!=i)return Es(t,o,{x:r,y:i});if("sticky"===n){const e=o.stickyPositionCache?.get(t);if(e)return e}return null}function Bs(e,t,o,n=50){return!(-n>e||e>(o.width||0)+n||-n>t||t>(o.height||0)+n)}z();var Fs=require("react/jsx-runtime"),zs={secondary:0,primary:3},Hs=".annotation-deferred{opacity:0;pointer-events:none;transition:opacity .12s ease}.stream-xy-frame:hover .annotation-deferred,.stream-ordinal-frame:hover .annotation-deferred,.stream-network-frame:hover .annotation-deferred,.stream-geo-frame:hover .annotation-deferred,.stream-xy-frame:focus-within .annotation-deferred,.stream-ordinal-frame:focus-within .annotation-deferred,.stream-network-frame:focus-within .annotation-deferred,.stream-geo-frame:focus-within .annotation-deferred{opacity:1;pointer-events:auto}@media (prefers-reduced-motion:reduce){.annotation-deferred{transition:none}}";function Ws(e){return!0===e?._annotationDeferred}function qs(e){return"blended"===e?.cohesion||"layer"===e?.cohesion?e.cohesion:null}function Ys(e){const t=e?.provenance?.confidence;return"number"==typeof t&&Number.isFinite(t)?Math.max(0,Math.min(1,t)):null}function Gs(e){return Math.max(.72,.95-.06*e)}L();var Vs=d(require("react")),[Xs,Us]=kt(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const o=e.observations;return o.push(t),o.length>e.maxObservations&&o.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));function Ks(e){const t=Us(e=>e.pushObservation),o=Vs.useCallback(o=>{e.onObservation?.(o),t?.(o)},[e,t]);return Vs.useMemo(()=>({...e,onObservation:o}),[o,e])}function Qs(e){const t=e.provenance,o=e.id??e.stableId??t?.stableId;return null==o||""===o?void 0:o+""}function Zs(e,t={}){const o=Qs(e);return{"data-semiotic-annotation-widget":"",...o?{"data-semiotic-annotation-id":o}:{},onClickCapture(n){const r=function(e){const t=e.nativeEvent;return"touch"===t.pointerType?"touch":0===t.detail?"keyboard":"pointer"}(n);t.onAnnotationActivate?.({annotation:e,annotationId:o,chartId:t.chartId,inputType:r}),o&&t.onObservation&&t.onObservation({type:"annotation-activate",annotationId:o,inputType:r,timestamp:Date.now(),chartType:t.chartType??"unknown",chartId:t.chartId})}}}function Js(e){return e instanceof Element&&null!=e.closest("[data-semiotic-annotation-widget]")}var ea=require("react/jsx-runtime"),ta="var(--semiotic-bg, #ffffff)",oa=.85;function na(e,t){return(e+"").length*t*.6}function ra(e){const{x:t,y:o,text:n,fill:r,fontSize:i=12,fontWeight:s,fontFamily:a,textAnchor:l="start",dominantBaseline:c,background:u,className:d}=e,h=function(e){return void 0===e||!0===e||"halo"===e?{type:"halo"}:!1===e||"none"===e?null:"box"===e?{type:"box"}:{type:e.type??"halo",...e}}(u),f=e=>(0,ea.jsx)("text",{x:t,y:o,textAnchor:l,dominantBaseline:c,fill:r,fontSize:i,fontWeight:s,fontFamily:a,className:d,...e?{stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:"stroke"}:{},children:n});if(!h)return f();if("halo"===h.type)return f({stroke:h.fill??ta,strokeWidth:h.haloWidth??3});const m=h.padding??{x:6,y:3},p="number"==typeof m?m:m.x,g="number"==typeof m?m:m.y,y=na(n,i),b=i+2*g;let v,x;return v="middle"===l?t-y/2-p:"end"===l?t-y-p:t-p,x="middle"===c||"central"===c?o-b/2:"hanging"===c||"text-before-edge"===c?o-g:o-.8*i-g,(0,ea.jsxs)("g",{className:d,children:[(0,ea.jsx)("rect",{x:v,y:x,width:y+2*p,height:b,rx:h.radius??3,ry:h.radius??3,fill:h.fill??ta,fillOpacity:h.opacity??oa,stroke:h.stroke,strokeWidth:h.strokeWidth}),f()]})}var ia=require("react/jsx-runtime"),sa={linear:Is.curveLinear,monotoneX:Is.curveMonotoneX,monotoneY:Is.curveMonotoneY,step:Is.curveStep,stepAfter:Is.curveStepAfter,stepBefore:Is.curveStepBefore,basis:Is.curveBasis,cardinal:Is.curveCardinal,catmullRom:Is.curveCatmullRom};function aa(e,t,o,n){const r=[];return e.forEach((e,i)=>{let s;if(o){const r=o(e,i,n);s=null!=r?r:t(e,i,n)}else s=t(e,i,n);s&&r.push({node:s,annotation:e})}),function(e){const t=e.map((e,t)=>{return{p:e,i:t,emphasis:(o=e.annotation,"primary"===o?.emphasis||"secondary"===o?.emphasis?o.emphasis:null),confidence:Ys(e.annotation),readingOrder:null,rank:1};var o}),o=t.some(e=>null!=e.emphasis||null!=e.confidence),n=e.some(e=>Ws(e.annotation)),r=e.some(e=>null!=qs(e.annotation)),i=e.some(e=>"layer"===qs(e.annotation));if(!o&&!n&&!r)return e.map(e=>e.node);const s=t.filter(e=>null==e.emphasis&&null!=e.confidence).slice().sort((e,t)=>(t.confidence??0)-(e.confidence??0)||e.i-t.i);s.forEach((e,t)=>{e.readingOrder=t,e.rank=2-t/Math.max(1,s.length)});for(const e of t)e.emphasis&&(e.rank=zs[e.emphasis]);const a=t.sort((e,t)=>e.rank-t.rank||e.i-t.i).map(e=>{const{p:t,i:o,emphasis:n,readingOrder:r}=e,i=Ws(t.annotation);let s=t.node;if("primary"===n||"secondary"===n||null!=r){const e=null==n&&null!=r;s=(0,Fs.jsx)("g",{className:e?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+n,..."secondary"===n?{opacity:.6,fontSize:"0.88em"}:{},...e?{opacity:Gs(r),"data-annotation-reading-order":r}:{},children:t.node},"annotation-emphasis-"+o)}const a=qs(t.annotation);return a&&(s=(0,Fs.jsx)("g",{className:"annotation-cohesion--"+a,children:s},"annotation-cohesion-"+o)),i&&(s=(0,Fs.jsx)("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:s},"annotation-deferred-"+o)),s});return n&&a.unshift((0,Fs.jsx)("style",{children:Hs},"annotation-disclosure-style")),i&&a.unshift((0,Fs.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)}function la(e,t={}){return function(e,o,n){switch(e.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const t=Os(e,o,n);if(!t)return null;const{x:r,y:i}=t;if(!Bs(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,ia.jsx)(Ls,{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-"+o)}case"x-threshold":{const t=$s(null!=e.value?{...e,x:e.value}:e,n);if(null==t)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:16;const a=t>.6*(n.width||0),l=a?t-4:t+4,c=a?"end":"start";return(0,ia.jsxs)("g",{opacity:e.opacity,children:[(0,ia.jsx)("line",{x1:t,y1:0,x2:t,y2:n.height||0,stroke:r,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,ia.jsx)(ra,{x:l,y:s,text:e.label,textAnchor:c,fill:r,fontSize:12,fontWeight:"bold",background:e.labelBackground??"halo"})]},"ann-"+o)}case"y-threshold":{const t=Ns(null!=e.value?{...e,y:e.value}:e,n);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=(n.width||0)/2,l="middle"):(a=(n.width||0)-4,l="end");const c=20>(s=t)?Math.min((n.height||0)-4,s+16):s-4;return(0,ia.jsxs)("g",{opacity:e.opacity,children:[(0,ia.jsx)("line",{x1:0,y1:t,x2:n.width||0,y2:t,stroke:r,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,ia.jsx)(ra,{x:a,y:c,text:e.label,textAnchor:l,fill:r,fontSize:12,fontWeight:"bold",background:e.labelBackground??"halo"})]},"ann-"+o)}case"enclose":{const t=(e.coordinates||[]).map(e=>({x:$s({...e,type:"point"},n),y:Ns({...e,type:"point"},n),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>t.length)return null;const r=(0,Ts.packEnclose)(t),i=e.padding||10;return(0,ia.jsxs)("g",{children:[(0,ia.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,ia.jsx)(ra,{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-"+o)}case"rect-enclose":{const t=(e.coordinates||[]).map(e=>({x:$s({...e,type:"point"},n),y:Ns({...e,type:"point"},n)})).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]=P(i),[c,u]=P(s),d=a-r,h=l+r,f=c-r;return(0,ia.jsxs)("g",{children:[(0,ia.jsx)("rect",{x:d,y:f,width:h-d,height:u+r-f,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&(0,ia.jsx)(ra,{x:(d+h)/2,y:f-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:e.label,background:e.labelBackground??"none"})]},"ann-"+o)}case"highlight":{const t=n.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,ia.jsx)("g",{children:r.map((t,o)=>{const r=$s(t,n),s=Ns(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,ia.jsx)("circle",{cx:r,cy:s,r:a,...l},"hl-"+o)})},"ann-"+o)}case"bracket":{const t=$s(e,n),r=Ns(e,n);return(0,ia.jsx)(Ls,{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-"+o)}case"trend":{const t=n.data||[];if(2>t.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 d=[],h=new Map;if(s&&l&&c){for(const e of t){const t=e[l];if(null==t)continue;const o=t+"";h.has(o)||(h.set(o,d.length),d.push(o))}u=t.map(e=>{const t=e[l],o=e[c];if(null==t||null==o)return null;const n=h.get(t+"");return null!=n?[n,+o]:null}).filter(e=>null!==e)}else u=t.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,m=n.scales?.y??n.scales?.value;if(!f||!m)return null;const p=e=>t=>{const o=Math.max(0,Math.floor(t)),n=Math.min(d.length-1,o+1),r=t-o,i=e(d[o]);return i+(e(d[n])-i)*r},g=f,y=m;let b;if(s)if(a){const e=p(y);b=(t,o)=>[g(o),e(t)]}else{const e=p(g);b=(t,o)=>[e(t),y(o)]}else b=(e,t)=>[g(e),y(t)];const v=e.method||"linear";let x;if("loess"===v)x=function(e,t=.3){const o=e.length;if(2>o)return e.slice();const n=e.slice().sort((e,t)=>e[0]-t[0]),r=n.map(e=>e[0]),i=n.map(e=>e[1]),s=Math.max(2,Math.ceil(t*o)),a=[];for(let e=0;o>e;e++){const t=r[e],n=r.map(e=>Math.abs(e-t)),l=n.slice().sort((e,t)=>e-t)[Math.min(s-1,o-1)]||1,c=[];for(let e=0;o>e;e++){const t=0===l?0:n[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,f=0,m=0;for(let e=0;o>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*r[e],h+=t*i[e],f+=t*r[e]*r[e],m+=t*r[e]*i[e])}if(0===u){a.push([t,i[e]]);continue}const p=u*f-d*d;if(1e-12>Math.abs(p))a.push([t,h/u]);else{const e=(u*m-d*h)/p;a.push([t,(h-e*d)/u+e*t])}}return a}(u,e.bandwidth??.3);else{const t="polynomial"===v?I(u,e.order||2):function(e){const t=[0,0,0,0];let o=0;for(const[n,r]of e)null!==r&&(o++,t[0]+=n,t[1]+=r,t[2]+=n*n,t[3]+=n*r);const n=o*t[2]-t[0]*t[0],r=0===n?0:T((o*t[3]-t[0]*t[1])/n),i=T(t[1]/o-r*t[0]/o);return{points:e.map(([e])=>[T(e),T(r*e+i)]),equation:[r,i]}}(u);x=t.points}const k=x.map(([e,t])=>{const[o,n]=b(e,t);return`${o},${n}`}).join(" "),w=e.color||"#6366f1",S=x[x.length-1],[A,C]=b(S[0],S[1]);return(0,ia.jsxs)("g",{children:[(0,ia.jsx)("polyline",{points:k,fill:"none",stroke:w,strokeWidth:e.strokeWidth||2,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,ia.jsx)("text",{x:A+4,y:C-4,fill:w,fontSize:11,children:e.label})]},"ann-"+o)}case"band":{const t=n.scales?.y??n.scales?.value,s=t?.domain?.(),a=e.y0??s?.[0],l=e.y1??s?.[1],c=null!=a&&t?t(a):0,u=null!=l&&t?t(l):n.height||0,d=si(e.fill,"ann-"+o,"var(--semiotic-primary, #6366f1)");return(0,ia.jsxs)("g",{opacity:e.opacity,children:[d.def&&(0,ia.jsx)("defs",{children:d.def}),(0,ia.jsx)("rect",{x:0,y:Math.min(c,u),width:n.width||0,height:Math.abs(u-c),fill:d.fill,fillOpacity:e.fillOpacity||.1}),e.label&&(0,ia.jsx)(ra,{x:(n.width||0)-4,y:(r=c,i=u,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-"+o)}case"x-band":{const t=n.scales?.x??n.scales?.time,r=t?.domain?.(),i=e.x0??r?.[0],s=e.x1??r?.[1],a=null!=i&&t?t(i):null,l=null!=s&&t?t(s):null;if(null==a||null==l)return null;const c=si(e.fill||e.color,"ann-"+o,"var(--semiotic-primary, #6366f1)");return(0,ia.jsxs)("g",{opacity:e.opacity,children:[c.def&&(0,ia.jsx)("defs",{children:c.def}),(0,ia.jsx)("rect",{x:Math.min(a,l),y:0,width:Math.abs(l-a),height:n.height||0,fill:c.fill,fillOpacity:e.fillOpacity??.1}),e.label&&(0,ia.jsx)(ra,{x:Math.min(a,l)+4,y:16,textAnchor:"start",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:e.label,background:e.labelBackground??"halo"})]},"ann-"+o)}case"envelope":{const t=n.data||[];if(2>t.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=t.filter(e=>null!=e[a]&&null!=e[l]&&!(c&&!c(e))).sort((e,t)=>e[r]-t[r]);if(2>u.length)return null;const d=sa[n.curve||"linear"]||Is.curveLinear,h=(0,Is.area)().x(e=>i(e[r])).y0(e=>s(e[l])).y1(e=>s(e[a])).curve(d)(u);if(!h)return null;const f=e.fill||"#6366f1";return(0,ia.jsxs)("g",{children:[(0,ia.jsx)("path",{d:h,fill:f,fillOpacity:e.fillOpacity??.15,stroke:"none"}),e.label&&u.length>0&&(0,ia.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-"+o)}case"anomaly-band":{const t=n.data||[];if(2>t.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=t.map(e=>e[r]).filter(e=>null!=e&&isFinite(e));if(2>a.length)return null;const l=a.reduce((e,t)=>e+t,0)/a.length,c=a.reduce((e,t)=>e+(t-l)**2,0)/a.length,u=Math.sqrt(c),d=e.threshold??2,h=l-d*u,f=!1!==e.showBand,m=e.fill||"#6366f1",p=e.fillOpacity??.1,g=e.anomalyColor||"#ef4444",y=e.anomalyRadius??6,b=s(l+d*u),v=s(h),x=t.filter(e=>{const t=e[r];return null!=t&&Math.abs(t-l)>d*u});return(0,ia.jsxs)("g",{children:[f&&(0,ia.jsx)("rect",{x:0,y:Math.min(b,v),width:n.width||0,height:Math.abs(v-b),fill:m,fillOpacity:p}),x.map((e,t)=>{const o=$s(e,n),r=Ns(e,n);return null==o||null==r?null:(0,ia.jsx)("circle",{cx:o,cy:r,r:y,fill:g,fillOpacity:.7,stroke:g,strokeWidth:1.5},"anomaly-"+t)}),e.label&&(0,ia.jsx)("text",{x:(n.width||0)-4,y:Math.min(b,v)-4,textAnchor:"end",fill:m,fontSize:11,children:e.label})]},"ann-"+o)}case"forecast":{const t=n.data||[];if(3>t.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=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=I(l,e.order||2).equation;c=e=>t.reduce((t,o,n)=>t+o*Math.pow(e,n),0)}else{const e=$(l);if(!e)return null;c=e}const u=l.length,{se:d,meanX:h,ssX:f}=N(l,c),m=D(e.confidence??.95),p=e.steps??5,g=l[u-1][0],y=(g-l[0][0])/Math.max(u-1,1),b=[];for(let e=1;p>=e;e++)b.push(g+e*y);const v=[];for(const e of b){const t=c(e),o=d*Math.sqrt(1+1/u+(f>0?(e-h)**2/f:0))*m;v.push({x:e,yCenter:t,yUpper:t+o,yLower:t-o})}const x=`M${v.map(e=>`${s(e.x)},${a(e.yUpper)}`).join(" L")} L${v.slice().reverse().map(e=>`${s(e.x)},${a(e.yLower)}`).join(" L")} Z`,k=v.map(e=>`${s(e.x)},${a(e.yCenter)}`).join(" "),w=`${s(g)},${a(c(g))}`,S=e.strokeColor||"#6366f1";return(0,ia.jsxs)("g",{children:[(0,ia.jsx)("path",{d:x,fill:e.fill||"#6366f1",fillOpacity:e.fillOpacity??.15,stroke:"none"}),(0,ia.jsx)("polyline",{points:`${w} ${k}`,fill:"none",stroke:S,strokeWidth:e.strokeWidth??2,strokeDasharray:e.strokeDasharray??"6,3"}),e.label&&v.length>0&&(0,ia.jsx)("text",{x:s(v[v.length-1].x)+4,y:a(v[v.length-1].yCenter)-4,fill:S,fontSize:11,children:e.label})]},"ann-"+o)}case"widget":{let r,i;if(null!=e.px&&null!=e.py)r=e.px,i=e.py;else{const t=Os(e,o,n);if(!t)return null;r=t.x,i=t.y}if(!Bs(r,i,n))return null;const s=e.dx??0,a=e.dy??0,l=e.width??32,c=e.height??32,u=e.content??(0,ia.jsx)("span",{style:{fontSize:18,cursor:"default"},title:e.label||"Info",children:"ℹ️"});return(0,ia.jsx)("foreignObject",{x:r+s-l/2,y:i+a-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:(0,ia.jsx)("div",{...Zs(e,t),style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+o)}case"text":{const t=Os(e,o,n);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,ia.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?Ss.cloneElement(c,{key:"ann-text-"+o}):(0,ia.jsxs)("g",{opacity:e.opacity,strokeDasharray:e.strokeDasharray,children:[(0,ia.jsx)("line",{x1:r,y1:i,x2:s,y2:a,stroke:l,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),Ss.cloneElement(c,{opacity:void 0,strokeDasharray:void 0})]},"ann-text-"+o)}case"category-highlight":{const t=e.category;if(null==t)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(t+"");if(null==c)return null;const u=l.bandwidth(),d=e.color||"var(--semiotic-primary, #4589ff)",h=e.opacity??.15,f=e.label;return(0,ia.jsxs)("g",(n.projection?"vertical"===n.projection:l===s)?{children:[(0,ia.jsx)("rect",{x:c,y:0,width:u,height:n.height||0,fill:d,fillOpacity:h}),f&&(0,ia.jsx)(ra,{x:c+u/2,y:16,textAnchor:"middle",fill:d,fontSize:12,fontWeight:"bold",text:f,background:e.labelBackground??"none"})]}:{children:[(0,ia.jsx)("rect",{x:0,y:c,width:n.width||0,height:u,fill:d,fillOpacity:h}),f&&(0,ia.jsx)(ra,{x:12,y:c+u/2,dominantBaseline:"middle",fill:d,fontSize:12,fontWeight:"bold",text:f,background:e.labelBackground??"none"})]},"ann-"+o)}default:return null}var r,i,s}}var ca=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function ua(e){return!!e&&"object"==typeof e&&ca.has(function(e){return"string"==typeof e?.type?e.type:""}(e))}function da(e){return"primary"===e?.emphasis||!0===e?.defensive}function ha(e,t,o={}){return"number"==typeof o.maxAnnotations&&Number.isFinite(o.maxAnnotations)?Math.max(0,Math.floor(o.maxAnnotations)):e>0&&t>0?Math.max(1,Math.round(e*t/(o.areaPerAnnotation&&o.areaPerAnnotation>0?o.areaPerAnnotation:2e4))):1/0}function fa(e){let t;const o=e?.emphasis;t="primary"===o?100:"secondary"===o?10:50;const n=e?.provenance?.confidence;switch("number"==typeof n&&Number.isFinite(n)&&(t+=15*Math.max(0,Math.min(1,n))),e?.lifecycle?.freshness){case"fresh":t+=8;break;case"aging":t+=4;break;case"stale":t+=1;break;case"expired":t-=200}return t}new Set(["label","callout","callout-circle","callout-rect"]);var ma=32,pa=6,ga=4,ya=8,ba=72;var va={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function xa(e){if(!ka(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 ka(e){return ua(e)}function wa(e,t){if(!e)return[];const o=Math.max(1,Math.floor(t/7)),n=e.split(/\s+/).filter(Boolean),r=[];let i="";for(const e of n)i&&i.length+e.length+1>o?(r.push(i),i=e):i=i?`${i} ${e}`:e;return i&&r.push(i),r}function Sa(e,t,o,n,r){const i=e+o,s=t+n;return Math.abs(o)>Math.abs(n)?{x:0>o?i-r.width-4:i+4,y:0>n?s-r.height:s,width:r.width,height:r.height}:{x:0>o?i-r.width:i,y:0>n?s-r.height-4:s+4,width:r.width,height:r.height}}function Aa(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function Ca(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 Ma(e,t,o,n,r,i,s,a){const l=Aa(e,s);let c=.4*Math.hypot(t.dx,t.dy)+80*function(e,t,o,n){const r=Math.max(0,n-e.x),i=Math.max(0,n-e.y);return(r+Math.max(0,e.x+e.width-(t-n)))*e.height+(i+Math.max(0,e.y+e.height-(o-n)))*e.width}(l,r,i,a);for(const e of o)c+=12*Ca(l,e);for(const e of n)c+=4*Ca(l,e);return c}function _a(e){const{annotations:t,context:o,defaultOffset:n=ma,notePadding:r=pa,markPadding:i=ga,edgePadding:s=ya,preserveManualOffsets:a=!0,routeLongConnectors:l=!0,connectorThreshold:c=ba,density:u,progressiveDisclosure:d=!1,redundantCues:h=!1,responsive:f,mobile:m,cohesion:p,audience:g}=e,y=o.width||0,b=o.height||0,v="object"==typeof m?m:{},x=v.breakpoint??480,k=!!m&&x>=y,w=k&&!1!==v.preferShortText?t.map(xa):t,S=k&&!u?{maxAnnotations:v.maxAnnotations??("callout-list"===v.strategy?1:2),minVisible:v.minVisible??1}:u,A=d||k&&(!1!==v.progressiveDisclosure||"callout-list"===v.strategy),C=k&&!f?v.responsive??{minWidth:x}:f,M=k&&!p?v.cohesion:p;if(0===w.length||0>=y||0>=b)return w.slice();const _=[],P=function(e,t){return(e.pointNodes||[]).map(e=>{const o=Math.max(1,e.r||1)+t;return{x:e.x-o,y:e.y-o,width:2*o,height:2*o}})}(o,i);let R=!1;const j=w.map((e,t)=>{if(!ka(e))return e;const i=function(e,t,o){if("widget"===e.type&&"number"==typeof e.px&&"number"==typeof e.py)return{x:e.px,y:e.py};const n=e.pointId??e.nodeId;if(null!=n&&o.pointNodes){const e=o.pointNodes.find(e=>e.pointId===n);if(e)return{x:e.x,y:e.y}}const r=e.coordinates,i=o.scales?.geoProjection;if(Array.isArray(r)&&r.length>=2&&i){const e=r[0],t=r[1];if("number"==typeof e&&"number"==typeof t){const o=i([e,t]);if(o&&"number"==typeof o[0]&&"number"==typeof o[1])return{x:o[0],y:o[1]}}}return o.scales||"number"!=typeof e.x||"number"!=typeof e.y?Os(e,t,o):{x:e.x,y:e.y}}(e,t,o);if(!i)return e;const u=function(e){if("widget"===e.type)return{width:"number"==typeof e.width?e.width:32,height:"number"==typeof e.height?e.height:32};const t="number"==typeof e.wrap?e.wrap:120,o=[...wa("string"==typeof e.title?e.title:void 0,t),...wa("string"==typeof e.label?e.label:void 0,t)],n=o.reduce((e,t)=>Math.max(e,t.length),0);return{width:Math.max(24,Math.min(t,7*n)+10),height:Math.max(18,16*o.length+6)}}(e);if(a&&("number"==typeof(d=e).dx||"number"==typeof d.dy)){const t=function(e){return"text"===e.type||"widget"===e.type?{dx:0,dy:0}:{dx:30,dy:-30}}(e);return _.push(Aa(Sa(i.x,i.y,"number"==typeof e.dx?e.dx:t.dx,"number"==typeof e.dy?e.dy:t.dy,u),r)),e}var d;let h=null,f=1/0;for(const e of function(e){const t=1.6*e;return[{dx:e,dy:-e},{dx:-e,dy:-e},{dx:e,dy:e},{dx:-e,dy:e},{dx:e,dy:0},{dx:-e,dy:0},{dx:0,dy:-e},{dx:0,dy:e},{dx:t,dy:-t},{dx:-t,dy:-t},{dx:t,dy:t},{dx:-t,dy:t}]}(n)){const t=Ma(Sa(i.x,i.y,e.dx,e.dy,u),e,_,P,y,b,r,s);f>t&&(h=e,f=t)}if(!h)return e;const m=Aa(Sa(i.x,i.y,h.dx,h.dy,u),r);_.push(m);const p=Math.hypot(h.dx,h.dy),g=l&&p>=c&&"text"!==e.type&&"widget"!==e.type?{...e.connector||{end:"arrow"},type:"curve"}:e.connector;return R=!0,{...e,dx:h.dx,dy:h.dy,...g?{connector:g}:{}}}),L=R?j:w.slice();let T=L;if(h){let e=!1;const t=L.map(t=>{const o=function(e){return"text"!==e.type||"string"!=typeof e.color||8>Math.hypot("number"==typeof e.dx?e.dx:0,"number"==typeof e.dy?e.dy:0)?e:{...e,_redundantConnector:!0}}(t);return o!==t&&(e=!0),o});T=e?t:L}{let e=!1;const t=T.map(t=>{if(!0!==t?.defensive)return t;const o=function(e){const t=e?.provenance;if(!t||"object"!=typeof t)return e;const o="string"==typeof t.source?va[t.source]??t.source:null,n="number"==typeof t.confidence&&Number.isFinite(t.confidence)?Math.round(100*Math.max(0,Math.min(1,t.confidence)))+"%":null;if(!o&&!n)return e;if(null!=e.label&&"string"!=typeof e.label)return e;const r=[o,n].filter(Boolean).join(" · "),i="string"==typeof e.label?e.label:"";return i.includes(`(${r})`)?e:{...e,label:i?`${i} (${r})`:`(${r})`}}(t);return o!==t&&(e=!0),o});T=e?t:T}const I=new Set;if(S){const e="object"==typeof S?S:{},t=function(e){if(!e)return 1;const t=function(e){const t=e?.familiarity;if(!t)return 3;const o=Object.values(t).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0===o.length?3:o.reduce((e,t)=>e+t,0)/o.length}(e);return t>2?4>t?1:.6:1.5}(g),o=1===t?e:{...e,maxAnnotations:Math.max(0,Math.round((e.maxAnnotations??ha(y,b,e))*t))},{deferred:n}=function(e){const{annotations:t,width:o,height:n}=e,r=Math.max(0,e.minVisible??1),i=ha(o,n,e),s=t.map((e,t)=>{return{annotation:e,index:t,note:(o=e,ua(o))};var o}),a=s.filter(e=>e.note);if(0===a.length||i>=a.length)return{visible:t.slice(),deferred:[],budget:i};const l=a.filter(e=>da(e.annotation)),c=a.filter(e=>!da(e.annotation)).sort((e,t)=>fa(t.annotation)-fa(e.annotation)||e.index-t.index),u=Math.min(c.length,Math.max(Math.max(0,i-l.length),Math.max(0,r-l.length))),d=new Set([...l.map(e=>e.index),...c.slice(0,u).map(e=>e.index)]),h=[],f=[];for(const{annotation:e,index:t,note:o}of s)!o||d.has(t)?h.push(e):f.push(e);return{visible:h,deferred:f,budget:i}}({annotations:T,width:y,height:b,...o});for(const e of n)I.add(e)}if(C&&("object"==typeof C&&"number"==typeof C.minWidth?C.minWidth:480)>=y)for(const e of T)ka(e)&&"secondary"===e.emphasis&&I.add(e);if(I.size>0)for(const e of T)!0===e?.defensive&&I.delete(e);let $;return $=0===I.size?T:A?T.map(e=>I.has(e)?{...e,_annotationDeferred:!0}:e):T.filter(e=>!I.has(e)),M?function(e,t){let o=!1;const n=e.map(e=>ka(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(o=!0,{...e,cohesion:t}):e);return o?n:e}($,M):$}function Pa(e,t={}){const o=!0===t.showRetractedAnnotations,n=!0===t.showSupersededAnnotations,r=new Set;for(const t of e){const e=t?.lifecycle?.supersedes;e&&"retracted"!==t?.lifecycle?.status&&r.add(e)}return e.filter(e=>{if("retracted"===e?.lifecycle?.status&&!o)return!1;const t=e?.provenance?.stableId;return!(t&&r.has(t)&&!n)})}var Ra=require("react"),ja={positions:new Map},La=new Set;function Ta(){for(const e of La)e()}function Ia(e,t){const o=ja.positions.get(e);if(o?.locked)return;if(!o||o.sourceId!==t)return;const n=new Map(ja.positions);n.delete(e),ja={positions:n},Ta()}function $a(e,t){const o=ja.positions.get(e);if(!o?.locked)return;if(t&&o.sourceId!==t)return;const n=new Map(ja.positions);n.delete(e),ja={positions:n},Ta()}function Na(){return ja}function Da(e){return La.add(e),()=>La.delete(e)}var Ea={positions:new Map};function Oa(){return()=>{}}function Ba(){return Ea}function Fa(e,t,o){return"exact"===o?function(e,t){const o=e.domain(),n=o[0],r=o[o.length-1],i=n instanceof Date,s=n instanceof Date?n.getTime():n,a=r instanceof Date?r.getTime():r;if(2>t||s===a)return i?[new Date(s),new Date(a)]:[s,a];const l=(a-s)/(t-1),c=Array(t);for(let e=0;t>e;e++){const o=e===t-1?a:s+e*l;c[e]=i?new Date(o):o}return c}(e,t):e.ticks(t)}function za(e,t,o){if("edges"===e){if(t)return"start";if(o)return"end"}return"middle"}function Ha(e,t,o){if("edges"===e){if(t)return"hanging";if(o)return"auto"}return"middle"}function Wa(e){if(0===e.length)return{min:null,max:null};let t=1/0,o=-1/0;for(const n of e)t>n.pixel&&(t=n.pixel),n.pixel>o&&(o=n.pixel);return{min:t,max:o}}function qa(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function Ya(e,t,o){if("left"===e||"right"===e){const n="left"===e?o:0,r="left"===e?-1:1,i=Math.ceil(t/8);let s="M0,"+n;for(let e=0;i>e;e++){const o=8*(e+1);s+=`L${Math.min(8*e+4,t)},${n+4*r}`,s+=`L${Math.min(o,t)},${n}`}return s}const n="bottom"===e?0:t,r="bottom"===e?1:-1,i=Math.ceil(o/8);let s=`M${n},0`;for(let e=0;i>e;e++){const t=8*(e+1);s+=`L${n+4*r},${Math.min(8*e+4,o)}`,s+=`L${n},${Math.min(t,o)}`}return s}var Ga=require("react/jsx-runtime");function Va(e){const{width:t,height:o,totalWidth:n,totalHeight:r,margin:i,scales:s,showAxes:a,axes:l,showGrid:c,xFormat:u,yFormat:d,axisExtent:h}=e,f=(0,Ei.useMemo)(()=>{if(!s)return[];const e=l?.find(e=>"bottom"===e.orient),o=l?.find(e=>"top"===e.orient),n=e??o,r=n?.extent??h,i=n?.tickFormat||u||Xa,a=Math.max(2,Math.floor(t/70)),c=n?.ticks??5,d="exact"===r?Math.max(2,c):Math.min(c,a),f=n?.tickValues??Fa(s.x,d,r),m=f.map(e=>e.valueOf()),p=f.map((e,t)=>({value:e,pixel:s.x(e),label:i(e,t,m)})),g=p.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 Ua(p,Math.max(55,g+8))},[s,l,u,t,h]),m=(0,Ei.useMemo)(()=>{if(!s)return[];const e=l?.find(e=>"left"===e.orient),t=e?.extent??h,n=e?.tickFormat||d||Xa,r=Math.max(2,Math.floor(o/30)),i=e?.ticks??5,a="exact"===t?Math.max(2,i):Math.min(i,r);return Ua((e?.tickValues??Fa(s.y,a,t)).map(e=>({value:e,pixel:s.y(e),label:n(e)})),22)},[s,l,d,o,h]),p=c&&s,g=a&&s;if(!p&&!g)return null;const y=l?.find(e=>"bottom"===e.orient),b=l?.find(e=>"left"===e.orient),v=g&&(!y||!1!==y.baseline),x=g&&(!b||!1!==b.baseline),k=y?.jaggedBase||!1,w=b?.jaggedBase||!1,S="var(--semiotic-border, #ccc)";return(0,Ga.jsx)("svg",{width:n,height:r,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:(0,Ga.jsxs)("g",{transform:`translate(${i.left},${i.top})`,children:[p&&(()=>{const e=qa(l?.find(e=>"bottom"===e.orient)?.gridStyle),n=qa(l?.find(e=>"left"===e.orient)?.gridStyle),r=!1!==l?.find(e=>"bottom"===e.orient)?.grid,i=!1!==l?.find(e=>"left"===e.orient)?.grid;return(0,Ga.jsxs)("g",{className:"stream-grid",children:[r&&f.map((t,n)=>(0,Ga.jsx)("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:o,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:e},"xgrid-"+n)),i&&m.map((e,o)=>(0,Ga.jsx)("line",{x1:0,y1:e.pixel,x2:t,y2:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:n},"ygrid-"+o))]})})(),v&&!k&&(0,Ga.jsx)("line",{x1:0,y1:o,x2:t,y2:o,stroke:S,strokeWidth:1}),k&&(0,Ga.jsx)("path",{d:Ya("bottom",t,o),fill:"none",stroke:S,strokeWidth:1}),x&&!w&&(0,Ga.jsx)("line",{x1:0,y1:0,x2:0,y2:o,stroke:S,strokeWidth:1}),w&&(0,Ga.jsx)("path",{d:Ya("left",t,o),fill:"none",stroke:S,strokeWidth:1})]})})}function Xa(e,t,o){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function Ua(e,t){if(2>=e.length)return e;const o=[e[0]];for(let n=1;e.length-1>n;n++)t>Math.abs(e[n].pixel-o[o.length-1].pixel)||o.push(e[n]);const n=e[e.length-1];return t>Math.abs(n.pixel-o[o.length-1].pixel)?o[o.length-1]=n:o.push(n),o}function Ka(e){const{width:t,height:o,totalWidth:n,totalHeight:r,margin:i,scales:s,showAxes:a,axes:l,xLabel:c,yLabel:u,yLabelRight:d,xFormat:h,yFormat:f,axisExtent:m,showGrid:p,title:g,legend:y,legendHoverBehavior:b,legendClickBehavior:v,legendHighlightedCategory:x,legendIsolatedCategories:k,legendPosition:w="right",legendLayout:S,foregroundGraphics:A,marginalGraphics:C,xValues:M,yValues:_,annotations:P,onAnnotationActivate:R,onObservation:j,chartId:L,chartType:T,autoPlaceAnnotations:I,svgAnnotationRules:$,xAccessor:N,yAccessor:D,annotationData:E,pointNodes:O,curve:B,underlayRendered:F,canvasObscuresUnderlay:z=!0,linkedCrosshairName:H,linkedCrosshairSourceId:W,children:q}=e,Y=Ks({onAnnotationActivate:R,onObservation:j,chartId:L,chartType:T}),G=Qi(S),V=y&&"left"===w&&G>0?G:i.left,X=y&&"right"===w&&G>0?G:i.right,U=(0,Ei.useMemo)(()=>{if(!a||!s)return[];const e=l?.find(e=>"bottom"===e.orient),o=l?.find(e=>"top"===e.orient),n=e??o,r=n?.extent??m,i=n?.tickFormat||h||Xa,c=Math.max(2,Math.floor(t/70)),u=n?.ticks??5,d="exact"===r?Math.max(2,u):Math.min(u,c),f=n?.tickValues??Fa(s.x,d,r),p=f.map(e=>e.valueOf()),g=f.map((e,t)=>({value:e,pixel:s.x(e),label:i(e,t,p)})),y=g.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),b=n?.autoRotate?Math.max(20,Math.min(y+8,55)):Math.max(55,y+8);let v=Ua(g,b);if(v.length>1&&(v=v.filter((e,t)=>0===t||e.label+""!=v[t-1].label+"")),n?.includeMax&&v.length>0&&"exact"!==r&&!n?.tickValues){const e=s.x.domain()[1],t=s.x(e),o=v[v.length-1].pixel;if(Math.abs(t-o)>1){const n=i(e,v.length,p);b>t-o&&v.length>1&&(v=v.slice(0,-1)),v.push({value:e,pixel:t,label:n})}}return v},[a,s,l,h,t,m]),K=(0,Ei.useMemo)(()=>{const e=l?.find(e=>"bottom"===e.orient);if(!e?.autoRotate||1>=U.length)return!1;const o=t/Math.max(U.length-1,1);return U.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0)+8>o},[l,U,t]),Q=(0,Ei.useMemo)(()=>{if(!a||!s)return[];const e=l?.find(e=>"left"===e.orient),t=e?.extent??m,n=e?.tickFormat||f||Xa,r=Math.max(2,Math.floor(o/30)),i=e?.ticks??5,c="exact"===t?Math.max(2,i):Math.min(i,r);let u=Ua((e?.tickValues??Fa(s.y,c,t)).map(e=>({value:e,pixel:s.y(e),label:n(e)})),22);if(u.length>1&&(u=u.filter((e,t)=>0===t||e.label+""!=u[t-1].label+"")),e?.includeMax&&u.length>0&&"exact"!==t&&!e?.tickValues){const e=s.y.domain()[1],t=s.y(e),o=u[u.length-1].pixel;if(Math.abs(t-o)>1){const r=n(e);22>Math.abs(t-o)&&u.length>1&&(u=u.slice(0,-1)),u.push({value:e,pixel:t,label:r})}}return u},[a,s,l,f,o,m]),Z=(0,Ei.useMemo)(()=>{if(!a||!s)return[];const e=l?.find(e=>"right"===e.orient);if(!e)return[];const t=e.extent??m,n=e.tickFormat||f||Xa,r=Math.max(2,Math.floor(o/30)),i=e.ticks??5;return Ua((e.tickValues??Fa(s.y,"exact"===t?Math.max(2,i):Math.min(i,r),t)).map(e=>({value:e,pixel:s.y(e),label:n(e)})),22)},[a,s,l,f,o,m]),J=(0,Ei.useRef)(new Map),ee=(0,Ei.useRef)(P?.length??0),te=P?.length??0;ee.current!==te&&(ee.current=te,J.current=new Map);const oe=(0,Ei.useMemo)(()=>{if(!P||0===P.length)return null;const e=Pa(P),n=la(0,Y),r={scales:s?{x:s.x,y:s.y,time:s.x,value:s.y}:null,timeAxis:"x",xAccessor:N,yAccessor:D,width:t,height:o,data:E,frameType:"xy",pointNodes:O,curve:B,stickyPositionCache:J.current};return aa(I?_a({annotations:e,context:r,..."object"==typeof I?I:{}}):e,n,$,r)},[P,I,$,t,o,N,D,E,s,O,B,Y]),ne=function(e){const t=(0,Ra.useSyncExternalStore)(e?Da:Oa,e?Na:Ba,e?Na:Ba);return e?t.positions.get(e)??null:null}(H);return(0,Ei.useEffect)(()=>{if(!ne?.locked||!H)return;const e=e=>{"Escape"===e.key&&$a(H)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[ne?.locked,H]),a||g||y||A||C||oe&&oe.length>0||p||q||ne?(0,Ga.jsxs)("svg",{role:"img",width:n,height:r,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[(0,Ga.jsx)("title",{children:"string"==typeof g?g:"XY Chart"}),(0,Ga.jsx)("desc",{children:"string"==typeof g?g+" (XY data visualization)":"XY data visualization"}),(0,Ga.jsxs)("g",{transform:`translate(${i.left},${i.top})`,children:[p&&s&&(!F||z)&&(()=>{const e=qa(l?.find(e=>"bottom"===e.orient)?.gridStyle),n=qa(l?.find(e=>"left"===e.orient)?.gridStyle),r=!1!==l?.find(e=>"bottom"===e.orient)?.grid,i=!1!==l?.find(e=>"left"===e.orient)?.grid;return(0,Ga.jsxs)("g",{className:"stream-grid",children:[r&&U.map((t,n)=>(0,Ga.jsx)("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:o,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:e},"xgrid-"+n)),i&&Q.map((e,o)=>(0,Ga.jsx)("line",{x1:0,y1:e.pixel,x2:t,y2:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:n},"ygrid-"+o))]})})(),a&&s&&(()=>{const e=l?.find(e=>"left"===e.orient),n=l?.find(e=>"bottom"===e.orient),r=!e||!1!==e.baseline,i=!n||!1!==n.baseline,s=e?.jaggedBase||!1,a=n?.jaggedBase||!1,h=n?.landmarkTicks,f=e?.landmarkTicks,m="var(--semiotic-border, #ccc)",p="var(--semiotic-text-secondary, var(--semiotic-text, #666))",g="var(--semiotic-text, #333)",y=K,b={fontSize:"var(--semiotic-tick-font-size, 12px)"},v={fontSize:"calc(var(--semiotic-tick-font-size, 12px) + 1px)"},x={fontSize:"var(--semiotic-axis-label-font-size, 12px)"},k=n?.tickAnchor,w=e?.tickAnchor,S=Wa(U),A=Wa(Q);return(0,Ga.jsxs)("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[(0,Ga.jsxs)("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[(!F||z)&&i&&!a&&(0,Ga.jsx)("line",{x1:0,y1:o,x2:t,y2:o,stroke:m,strokeWidth:1}),(!F||z)&&a&&(0,Ga.jsx)("path",{d:Ya("bottom",t,o),fill:"none",stroke:m,strokeWidth:1}),U.map((e,t)=>{const n=!!h&&("function"==typeof h?h(e.value,t):Tr(e.value,t>0?U[t-1].value:void 0));return(0,Ga.jsxs)("g",{transform:`translate(${e.pixel},${o})`,children:[(0,Ga.jsx)("line",{y2:5,stroke:m,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?(0,Ga.jsx)("text",{y:y?12:18,textAnchor:y?"end":za(k,e.pixel===S.min,e.pixel===S.max),fontWeight:n?600:400,fill:p,fontSize:n?13:12,className:"semiotic-axis-tick",style:{userSelect:"none",...n?v:b},transform:y?"rotate(-45)":void 0,children:e.label}):(0,Ga.jsx)("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:(0,Ga.jsx)("div",{style:{textAlign:"center",userSelect:"none",...b},children:e.label})})]},"xtick-"+t)}),c&&(0,Ga.jsx)("text",{x:t/2,y:o+(y?58:40),textAnchor:"middle",fill:g,fontSize:12,className:"semiotic-axis-label",style:{userSelect:"none",...x},children:c})]}),(0,Ga.jsxs)("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[(!F||z)&&r&&!s&&(0,Ga.jsx)("line",{x1:0,y1:0,x2:0,y2:o,stroke:m,strokeWidth:1}),(!F||z)&&s&&(0,Ga.jsx)("path",{d:Ya("left",t,o),fill:"none",stroke:m,strokeWidth:1}),Q.map((e,t)=>{const o=!!f&&("function"==typeof f?f(e.value,t):Tr(e.value,t>0?Q[t-1].value:void 0));return(0,Ga.jsxs)("g",{transform:`translate(0,${e.pixel})`,children:[(0,Ga.jsx)("line",{x2:-5,stroke:m,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?(0,Ga.jsx)("text",{x:-8,textAnchor:"end",dominantBaseline:Ha(w,e.pixel===A.min,e.pixel===A.max),fontWeight:o?600:400,fill:p,fontSize:o?13:12,className:"semiotic-axis-tick",style:{userSelect:"none",...o?v:b},children:e.label}):(0,Ga.jsx)("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:(0,Ga.jsx)("div",{style:{textAlign:"right",userSelect:"none",...b},children:e.label})})]},"ytick-"+t)}),(()=>{const t=e?.label||u;return t?(0,Ga.jsx)("text",{x:15-V,y:o/2,textAnchor:"middle",fill:g,transform:`rotate(-90, ${15-V}, ${o/2})`,fontSize:12,className:"semiotic-axis-label",style:{userSelect:"none",...x},children:t}):null})()]}),(()=>{const e=l?.find(e=>"right"===e.orient);if(!e||0===Z.length)return null;const n=!1!==e.baseline,r=e.landmarkTicks,i=e.label||d,s=e.tickAnchor,a=Wa(Z);return(0,Ga.jsxs)("g",{className:"semiotic-axis semiotic-axis-right","data-orient":"right",children:[n&&(0,Ga.jsx)("line",{x1:t,y1:0,x2:t,y2:o,stroke:m,strokeWidth:1}),Z.map((e,o)=>{const n=!!r&&("function"==typeof r?r(e.value,o):Tr(e.value,o>0?Z[o-1].value:void 0));return(0,Ga.jsxs)("g",{transform:`translate(${t},${e.pixel})`,children:[(0,Ga.jsx)("line",{x2:5,stroke:m,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?(0,Ga.jsx)("text",{x:8,textAnchor:"start",dominantBaseline:Ha(s,e.pixel===a.min,e.pixel===a.max),fontWeight:n?600:400,fill:p,fontSize:n?13:12,className:"semiotic-axis-tick",style:{userSelect:"none",...n?v:b},children:e.label}):(0,Ga.jsx)("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:(0,Ga.jsx)("div",{style:{textAlign:"left",userSelect:"none",...b},children:e.label})})]},"ytick-r-"+o)}),i&&(0,Ga.jsx)("text",{x:t+X-15,y:o/2,textAnchor:"middle",fill:g,transform:`rotate(90, ${t+X-15}, ${o/2})`,fontSize:12,className:"semiotic-axis-label",style:{userSelect:"none",...x},children:i})]})})()]})})(),oe,C&&s&&M&&_&&(0,Ga.jsxs)(Ga.Fragment,{children:[C.top&&(0,Ga.jsx)("g",{transform:"translate(0, 0)",children:(0,Ga.jsx)(ws,{orient:"top",config:ks(C.top),values:M,scale:s.x,size:i.top,length:t})}),C.bottom&&(0,Ga.jsx)("g",{transform:`translate(0, ${o})`,children:(0,Ga.jsx)(ws,{orient:"bottom",config:ks(C.bottom),values:M,scale:s.x,size:i.bottom,length:t})}),C.left&&(0,Ga.jsx)("g",{transform:"translate(0, 0)",children:(0,Ga.jsx)(ws,{orient:"left",config:ks(C.left),values:_,scale:s.y,size:i.left,length:o})}),C.right&&(0,Ga.jsx)("g",{transform:`translate(${t}, 0)`,children:(0,Ga.jsx)(ws,{orient:"right",config:ks(C.right),values:_,scale:s.y,size:i.right,length:o})})]}),A,ne&&ne.sourceId!==W&&s?.x&&(()=>{const e=s.x(ne.xValue);if(null==e||0>e||e>t)return null;const n=ne.locked;return(0,Ga.jsx)("line",{x1:e,y1:0,x2:e,y2:o,stroke:n?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:n?1.5:1,strokeDasharray:n?"6,3":"4,4",pointerEvents:"none"})})(),q]}),g&&"string"==typeof g?(0,Ga.jsx)("text",{x:n/2,y:22,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",fontSize:14,className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:g}):g?(0,Ga.jsx)("foreignObject",{x:0,y:0,width:n,height:i.top,children:g}):null,ys({legend:y,totalWidth:n,totalHeight:r,margin:i,legendPosition:w,title:g,legendLayout:S,axisChrome:{hasAxis:!!a,hasAxisLabel:!!c,rotatedTicks:K},legendHoverBehavior:b,legendClickBehavior:v,legendHighlightedCategory:x,legendIsolatedCategories:k})]}):null}var Qa=d(require("react")),Za=require("d3-shape");function Ja(e,t,o){let n=o;for(const o of t)"lesser"===o.thresholdType?o.value>e&&(n=o.color):e>o.value&&(n=o.color);return n}function el(e,t,o,n){if(2>e.length||t.length!==e.length||0===o.length)return[];const r=[],i=(e,t,o)=>{const n=r[r.length-1];n?.color===e?n.path.push(o):r.push({color:e,path:[t,o]})};for(let r=1;e.length>r;r++){const[s,a]=e[r-1],[l,c]=e[r],u=t[r-1],d=t[r]-u,h=[0,...0===d?[]:o.map(({value:e})=>(e-u)/d).filter(e=>e>0&&1>e&&Number.isFinite(e)).sort((e,t)=>e-t).filter((e,t,o)=>0===t||e!==o[t-1]),1];for(let e=1;h.length>e;e++){const t=h[e-1],r=h[e];i(Ja(u+d*((t+r)/2),o,n),[s+(l-s)*t,a+(c-a)*t],[s+(l-s)*r,a+(c-a)*r])}}return r}function tl(e){return(e.tl??0)>0||(e.tr??0)>0||(e.br??0)>0||(e.bl??0)>0}function ol(e){const t=e.cornerRadii;if(!t)return{tl:0,tr:0,br:0,bl:0};const o=Math.min(e.w,e.h)/2,n=e=>Math.max(0,Math.min(e??0,o));return{tl:n(t.tl),tr:n(t.tr),br:n(t.br),bl:n(t.bl)}}var nl=require("react/jsx-runtime"),rl={innerRadius:0,outerRadius:0,startAngle:0,endAngle:0};function il(e,t="#4e79a7"){return ti(e)?e.background&&"transparent"!==e.background?e.background:t:e&&"string"==typeof e?e:t}function sl(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}function al(e,t,o,n){const r=e.glyph;if(!r?.parts?.length||0>=e.size)return null;const i=Dr(r,e.size);if(0>=i.scale)return null;const s=`translate(${t},${o})${e.rotation?` rotate(${180*e.rotation/Math.PI})`:""} translate(${i.offsetX},${i.offsetY}) scale(${i.scale})`,a=e.color??("string"==typeof e.style.fill?e.style.fill:void 0),l=Fr(r,e.fraction??1,e.fractionStart??0,e.fractionDirection??"horizontal"),c=l?sl(n+"-clip"):void 0,u=(e.style.opacity??1)*(e._decayOpacity??1)*(e.style.fillOpacity??1),d=t=>r.parts.map((o,n)=>{const r=t?"none"===o.fill?void 0:t:Er(o.fill,a,e.accent),i=t?o.stroke&&"none"!==o.stroke?t:void 0:Er(o.stroke??"none",a,e.accent);return r||i?(0,nl.jsx)("path",{d:o.d,fill:r??"none",stroke:i,strokeWidth:i?o.strokeWidth??1:void 0,strokeLinecap:o.strokeLinecap,strokeLinejoin:o.strokeLinejoin,opacity:o.opacity},n):null});return(0,nl.jsxs)("g",{transform:s,opacity:1===u?void 0:u,children:[l&&c&&(0,nl.jsx)("clipPath",{id:c,children:(0,nl.jsx)("rect",{x:l.x,y:l.y,width:l.width,height:l.height})}),l&&e.ghostColor?(0,nl.jsx)("g",{children:d(e.ghostColor)}):null,l&&c?(0,nl.jsx)("g",{clipPath:`url(#${c})`,children:d()}):d()]},n)}function ll(e,t){const o=e.filter(e=>Number.isFinite(e.offset)&&(null==e.opacity||Number.isFinite(e.opacity))).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color??t,opacity:null==e.opacity?void 0:Math.max(0,Math.min(1,e.opacity))}));return 2>o.length?null:o.map((e,t)=>(0,nl.jsx)("stop",{offset:e.offset,stopColor:e.color,stopOpacity:e.opacity},t))}function cl(e,t,o){const n=mn(e.symbolType,e.size,e.path);return(0,nl.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?il(e.style.fill):"none",fillOpacity:e.style.fillOpacity,opacity:e.style.opacity,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth},`${o??""}symbol-${t}`)}var ul=d(require("react")),dl=require("d3-shape"),hl=require("react/jsx-runtime"),fl=d(require("react")),ml=require("d3-shape"),pl=(e,t)=>({x:e*Math.cos(t),y:e*Math.sin(t)});function gl(e){const{innerRadius:t,outerRadius:o,startAngle:n,endAngle:r}=e,i=0>=t;if(0>=(e.cornerRadius??0)||!e.roundStart&&!e.roundEnd){if(i){const e=pl(o,n),t=pl(o,r);return`M0,0 L${e.x},${e.y} A${o},${o} 0 ${r-n>Math.PI?1:0} 1 ${t.x},${t.y} Z`}const e=pl(o,n),s=pl(o,r),a=pl(t,r),l=pl(t,n),c=r-n>Math.PI?1:0;return`M${e.x},${e.y} A${o},${o} 0 ${c} 1 ${s.x},${s.y} L${a.x},${a.y} A${t},${t} 0 ${c} 0 ${l.x},${l.y} Z`}const s=Math.max(0,Math.min(e.cornerRadius??0,(o-t)/2));if(0===s)return gl({...e,cornerRadius:0,roundStart:!1,roundEnd:!1});const a=Math.asin(Math.min(1,s/Math.max(1e-9,o-s))),l=i?0:Math.asin(Math.min(1,s/Math.max(1e-9,t+s))),c=r-n,u=e.roundStart&&e.roundEnd?c/2:c,d=!!e.roundStart&&u>a,h=!!e.roundEnd&&u>a;if(!d&&!h)return gl({...e,cornerRadius:0,roundStart:!1,roundEnd:!1});const f=n+(d?a:0),m=r-(h?a:0),p=n+(d?l:0),g=r-(h?l:0),y=pl(o,f),b=pl(o,m),v=(o-s)*Math.cos(a),x=pl(v,n),k=pl(v,r),w=i?null:pl(t,g),S=i?null:pl(t,p),A=i?0:(t+s)*Math.cos(l),C=i?null:pl(A,n),M=i?null:pl(A,r),_=m-f>Math.PI?1:0,P=i?0:g-p>Math.PI?1:0;let R="";if(d)R+=`M${x.x},${x.y}`,R+=` A${s},${s} 0 0 1 ${y.x},${y.y}`;else{const e=pl(o,n);R+=`M${e.x},${e.y}`}if(h)R+=` A${o},${o} 0 ${_} 1 ${b.x},${b.y}`,R+=` A${s},${s} 0 0 1 ${k.x},${k.y}`;else{const e=pl(o,r);R+=` A${o},${o} 0 ${_} 1 ${e.x},${e.y}`}if(i)R+=" L0,0";else{if(h)R+=` L${M.x},${M.y}`,R+=` A${s},${s} 0 0 1 ${w.x},${w.y}`;else{const e=pl(t,r);R+=` L${e.x},${e.y}`}if(d)R+=` A${t},${t} 0 ${P} 0 ${S.x},${S.y}`,R+=` A${s},${s} 0 0 1 ${C.x},${C.y}`;else{const e=pl(t,n);R+=` A${t},${t} 0 ${P} 0 ${e.x},${e.y}`}}return R+=" Z",R}function yl(e){const t=gl({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle,endAngle:e.endAngle,cornerRadius:e.cornerRadius,roundStart:e.roundStart,roundEnd:e.roundEnd}),o=[],n=e.colors;if(n.length>0){const t=(e.endAngle-e.startAngle)/n.length;for(let r=0;n.length>r;r++)o.push({d:gl({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle+r*t,endAngle:e.endAngle}),color:n[r]})}return{clipPath:t,slices:o}}var bl=require("react/jsx-runtime");function vl(e){return 1e6>e?1e4>e?1e3>e?e+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function xl(e,t){const o=e.datum;if(!o)return null;const n=[],r=o.__funnelStepLabel,i=Number(o.__funnelStepLabelX),s=Number(o.__funnelStepLabelY),a=Number(o.__funnelRowWidth);"string"!=typeof r||!Number.isFinite(i)||!Number.isFinite(s)||Number.isFinite(a)&&8.4*r.length+16>a||n.push((0,bl.jsx)("text",{x:i,y:s+3,textAnchor:"middle",dominantBaseline:"hanging",fontSize:14,fontWeight:"bold",fill:"#fff",stroke:"rgba(0,0,0,0.6)",strokeWidth:3,paintOrder:"stroke",children:r},t+"-funnel-step"));const l=Number(o.__funnelValue),c=Number(o.__funnelValueLabelX),u=Number(o.__funnelValueLabelY),d=Number(o.__funnelBarW);if(Number.isFinite(l)&&0!==l&&Number.isFinite(c)&&Number.isFinite(u)&&d>=60){const e=Number(o.__funnelPercent);let r=!0!==o.__funnelIsFirstStep&&Number.isFinite(e)?`${vl(l)} (${.05>Math.abs(e-Math.round(e))?Math.round(e):e.toFixed(1)}%)`:vl(l);7.8*r.length+16>d&&(r=vl(l)),7.8*r.length+16>d||n.push((0,bl.jsx)("text",{x:c,y:u+22,textAnchor:"middle",dominantBaseline:"hanging",fontSize:13,fontWeight:"bold",fill:"#fff",stroke:"rgba(0,0,0,0.5)",strokeWidth:3,paintOrder:"stroke",children:r},t+"-funnel-value"))}return n.length?(0,bl.jsx)("g",{children:n},t+"-funnel-labels"):null}var kl=require("react/jsx-runtime");function wl(e,t,o,n){if(!e||2>t.length)return null;const r=ll(e.stops,n);return r?(0,kl.jsx)("linearGradient",{id:o,gradientUnits:"userSpaceOnUse",x1:t[0][0],y1:0,x2:t[t.length-1][0],y2:0,children:r}):null}var Sl="undefined"==typeof window||"undefined"==typeof document,Al=require("react"),Cl="undefined"!=typeof window?Al.useLayoutEffect:Al.useEffect;function Ml(){const[e,t]=(0,Al.useState)(!1);return Cl(()=>{t(!0)},[]),e}var _l=()=>()=>{},Pl=()=>!1,Rl=()=>!0;function jl(){const e=(0,Al.useSyncExternalStore)(_l,Pl,Rl);return(0,Al.useRef)(e).current}var Ll=require("react");function Tl(e){const t=(0,Ll.useRef)(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return $l(e,t);if(!Nl(e)||!Nl(t))return!1;const o=Object.keys(e),n=Object.keys(t);if(o.length!==n.length)return!1;for(const n of o){if(!Object.prototype.hasOwnProperty.call(t,n))return!1;const o=e[n],r=t[n];if(!Object.is(o,r))if(Array.isArray(o)&&Array.isArray(r)){if(!$l(o,r))return!1}else{if(!Nl(o)||!Nl(r))return!1;if(!Il(o,r))return!1}}return!0}(t.current,e)||(t.current=e),t.current}function Il(e,t){const o=Object.keys(e),n=Object.keys(t);if(o.length!==n.length)return!1;for(const n of o){if(!Object.prototype.hasOwnProperty.call(t,n))return!1;if(!Object.is(e[n],t[n]))return!1}return!0}function $l(e,t){if(e.length!==t.length)return!1;for(let o=0;e.length>o;o++)if(!Object.is(e[o],t[o]))return!1;return!0}function Nl(e){if(null===e||"object"!=typeof e)return!1;if(Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}function Dl(e){const{background:t,hasBackgroundGraphics:o=!1,themeBackground:n=""}=e;return"transparent"===t||o?null:t||(n&&"transparent"!==n?n:"")||null}function El(e,t){const{background:o,hasBackgroundGraphics:n=!1,themeBackground:r="",x:i=0,y:s=0,width:a,height:l}=t,c=Dl({background:o,hasBackgroundGraphics:n,themeBackground:r});if(!c)return!1;const u=Ur(e,c);return!!u&&(e.fillStyle=u,e.fillRect(i,s,a,l),!0)}var Ol={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 Bl(e,t){const o=e.trim();if(/^#[0-9a-f]{3}$/i.test(o)){const e=o[1],n=o[2],r=o[3];return`#${e}${e}${n}${n}${r}${r}${t}`}if(/^#[0-9a-f]{6}$/i.test(o))return`${o}${t}`;const n=o.match(/^rgb\s*\(\s*([^)]+?)\s*\)$/i);return n?`rgba(${n[1]}, ${(parseInt(t,16)/255).toFixed(3)})`:o}var Fl=d(require("react")),zl=d(require("react")),Hl=require("react/jsx-runtime"),Wl=zl.createContext(null);function ql({children:e}){const[t,o]=zl.useState(!1),n=zl.useCallback(()=>o(e=>!e),[]),r=zl.useMemo(()=>({visible:t,setVisible:o,toggle:n}),[t,n]);return(0,Hl.jsx)(Wl.Provider,{value:r,children:e})}function Yl(){return zl.useContext(Wl)}var Gl=require("react/jsx-runtime"),Vl={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function Xl({hoverPoint:e}){let t="";if(e){const o=e.data||e;t="object"==typeof o?"Data point: "+Object.entries(o).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Data point: "+o}return(0,Gl.jsx)("div",{"aria-live":"polite","aria-atomic":"true",style:Vl,children:t})}function Ul(e){const t={};if(null==e||"object"!=typeof e)return t;for(const[o,n]of Object.entries(e))o.startsWith("_")||null!=n&&""!==n&&("number"==typeof n?Number.isFinite(n)&&(t[o]=n):"string"==typeof n?t[o]=n:"boolean"==typeof n?t[o]=n+"":n instanceof Date&&(t[o]=n.toISOString().slice(0,10)));return t}function Kl(e){return e&&"object"==typeof e?e:{}}function Ql(e){return Kl(e.accessibility).tableFields??e.accessibleDatum??e.datum}var Zl=require("react/jsx-runtime");function Jl(e,t){if(!e||0===e.length)return t+", empty";const o={};for(const t of e){if(null===t?.datum)continue;const e=t.type+"";o[e]=(o[e]||0)+1}if(0===Object.keys(o).length)return t+", empty";const n=[],r={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},i=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],s=Object.keys(o).sort((e,t)=>{const o=i.indexOf(e),n=i.indexOf(t);return(-1===o?999:o)-(-1===n?999:n)});for(const e of s)n.push(`${o[e]} ${r[e]||e}`);return`${t}, ${n.join(", ")}`}function ec(e,t,o){const n=[];return e>0&&n.push(e+" nodes"),t>0&&n.push(t+" edges"),0===n.length?o+", empty":`${o}, ${n.join(", ")}`}var tc=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},oc="semiotic-accessible-data-table",nc=oc+" semiotic-accessible-data-table-hidden",rc=oc+" semiotic-accessible-data-table-visible",ic=rc+" semiotic-accessible-data-table-network",sc={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"},ac={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},lc={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)"},cc={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},uc={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))"},dc={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},hc={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},fc={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 mc({scene:e,chartType:t,tableId:o,chartTitle:n}){const[r,i]=Fl.useState(!1),[s,a]=Fl.useState(5),l=Yl(),c=l?.visible??!1,u=r||c,d=Fl.useRef(null),h=n?"Data summary for "+n:o?`Data summary for ${t} ${o}`:"Data summary for "+t;Fl.useEffect(()=>{u||a(5)},[u]);const f=Fl.useCallback(e=>{e.target===e.currentTarget&&(r||c||i(!0))},[r,c]),m=Fl.useCallback(e=>{c||d.current?.contains(e.relatedTarget)||i(!1)},[c]);if(!e||0===e.length)return o?(0,Zl.jsx)("span",{id:o,tabIndex:-1,style:Vl}):null;if(!u)return(0,Zl.jsx)("div",{id:o,className:nc,tabIndex:-1,onFocus:f,style:Vl,role:"region","aria-label":h,children:(0,Zl.jsxs)("button",{type:"button",onClick:()=>i(!0),children:["View data summary (",e.length," elements)"]})});const p=function(e){const t=[];if(!Array.isArray(e))return t;const o=e.some(e=>e&&("line"===e.type||"area"===e.type));for(const n of e)if(n&&"object"==typeof n&&null!==n.datum)try{switch(n.type){case"point":if(o)break;t.push({label:"Point",values:Ul(Ql(n))});break;case"line":case"area":{const e=Ql(n),o=Array.isArray(e)?e:[],r="line"===n.type?"Line point":"Area point";for(const e of o)t.push({label:r,values:Ul(e)});break}case"rect":{const e=Ql(n),o=null!=e&&"object"==typeof e?e:{},r=o.category??n.group??"",i=o.value??o.__aggregateValue??o.total,s=Ul(o);null==s.category&&""!==r&&(s.category=r+""),null==s.value&&null!=i&&(s.value="number"==typeof i||"string"==typeof i?i:i+""),t.push({label:"Bar",values:s});break}case"heatcell":{const e=Ul(Ql(n));null==e.value&&"number"==typeof n.value&&Number.isFinite(n.value)&&(e.value=n.value),t.push({label:"Cell",values:e});break}case"wedge":{const e=Ql(n),o=Ul(e);if(null==o.category){const t=Kl(e),n=t.category??t.label;null!=n&&(o.category=n+"")}t.push({label:"Wedge",values:o});break}case"circle":t.push({label:"Node",values:Ul(Ql(n))});break;case"arc":t.push({label:"Arc",values:Ul(Ql(n))});break;case"candlestick":t.push({label:"Candlestick",values:Ul(Ql(n))});break;case"geoarea":{const e=Kl(Ql(n)),o=Ul(e);if(null==o.name){const t=Kl(e.properties).name??e.name;null!=t&&(o.name=t+"")}t.push({label:"Region",values:o});break}}}catch{}return t}(e),g=function(e){if(!e||0===e.length)return[];const t=new Set;for(const o of e)if(o&&o.values)for(const e of Object.keys(o.values))t.add(e);const o=[];for(const n of t){const t=[],r=new Set;for(const o of e){if(!o||!o.values)continue;const e=o.values[n];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&r.add(e+""))}if(t.length>0){let e=t[0],r=t[0],i=0;for(const o of t)e>o&&(e=o),o>r&&(r=o),i+=o;o.push({name:n,count:t.length,numeric:!0,min:e,max:r,mean:i/t.length})}else if(r.size>0){const e=Array.from(r);o.push({name:n,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return o}(p),y=function(e,t){const o=[e+" data points."];for(const e of t)if(e.numeric)o.push(`${e.name}: ${tc(e.min)} to ${tc(e.max)}, mean ${tc(e.mean)}.`);else{const t=e.uniqueValues,n=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");o.push(`${e.name}: ${n}.`)}return o.join(" ")}(p.length,g),b=Math.min(s,p.length),v=p.slice(0,b),x=p.length-b,k=new Set;for(const e of v)for(const t of Object.keys(e.values))k.add(t);const w=Array.from(k);return(0,Zl.jsxs)("div",{ref:d,id:o,className:rc,tabIndex:-1,onBlur:m,style:sc,role:"region","aria-label":h,children:[(0,Zl.jsx)("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{c&&l&&l.setVisible(!1),i(!1)},"aria-label":"Close data summary",style:lc,children:"×"}),(0,Zl.jsx)("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:ac,children:y}),(0,Zl.jsxs)("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+t,style:cc,children:[(0,Zl.jsx)("caption",{className:"semiotic-accessible-data-table-caption",style:hc,children:x>0?`First ${b} of ${p.length} data points`:`All ${p.length} data points`}),(0,Zl.jsx)("thead",{children:(0,Zl.jsxs)("tr",{children:[(0,Zl.jsx)("th",{style:uc,children:"type"}),w.map(e=>(0,Zl.jsx)("th",{style:uc,children:e},e))]})}),(0,Zl.jsx)("tbody",{children:v.map((e,t)=>(0,Zl.jsxs)("tr",{children:[(0,Zl.jsx)("td",{style:dc,children:e.label}),w.map(t=>{return(0,Zl.jsx)("td",{style:dc,children:(o=e.values[t],null==o||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":tc(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"")},t);var o})]},t))})]}),x>0&&(0,Zl.jsxs)("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>a(e=>e+25),style:fc,children:["Show ",Math.min(25,x)," more"," ",1===x?"row":"rows"," (",x," remaining)"]})]})}function pc({nodes:e,edges:t,chartType:o,tableId:n,chartTitle:r}){const[i,s]=Fl.useState(!1),[a,l]=Fl.useState(5),c=Yl(),u=c?.visible??!1,d=i||u,h=r?"Data summary for "+r:n?`Data summary for ${o} ${n}`:"Data summary for "+o,f=Fl.useRef(null);Fl.useEffect(()=>{d||l(5)},[d]);const m=Fl.useCallback(e=>{e.target===e.currentTarget&&(i||u||s(!0))},[i,u]),p=Fl.useCallback(e=>{u||f.current?.contains(e.relatedTarget)||s(!1)},[u]);if(!e||0===e.length)return n?(0,Zl.jsx)("span",{id:n,tabIndex:-1,style:Vl}):null;if(!d)return(0,Zl.jsx)("div",{id:n,className:nc,tabIndex:-1,onFocus:m,style:Vl,role:"region","aria-label":h,children:(0,Zl.jsxs)("button",{type:"button",onClick:()=>s(!0),children:["View data summary (",e.length," nodes, ",t.length," edges)"]})});const g=Array.isArray(e)?e:[],y=Array.isArray(t)?t:[],b=new Map,v=new Map,x=new Map,k=new Map;for(const e of y){if(!e||"object"!=typeof e)continue;const t=e.datum??{source:e.source,target:e.target},o="object"==typeof t.source?t.source?.id:t.source,n="object"==typeof t.target?t.target?.id:t.target,r="number"==typeof t.value&&Number.isFinite(t.value)?t.value:0;if(null!=o&&""!==o){const e=o+"";v.set(e,(v.get(e)??0)+1),k.set(e,(k.get(e)??0)+r)}if(null!=n&&""!==n){const e=n+"";b.set(e,(b.get(e)??0)+1),x.set(e,(x.get(e)??0)+r)}}const w=[];for(let e=0;g.length>e;e++){const t=g[e];if(!t||"object"!=typeof t)continue;const o=t.datum?.id??t.id,n=null!=o?o+"":"node-"+e,r=b.get(n)??0,i=v.get(n)??0,s=x.get(n)??0,a=k.get(n)??0;w.push({id:n,degree:r+i,inDeg:r,outDeg:i,wDegree:s+a,wInDeg:s,wOutDeg:a})}w.sort((e,t)=>t.degree-e.degree);let S=0,A=0;if(w.length>0){let e=0;for(const t of w)e+=t.degree,t.degree>A&&(A=t.degree);S=e/w.length}const C=y.some(e=>{const t=e?.datum??{source:e?.source,target:e?.target};return"number"==typeof t?.value&&Number.isFinite(t.value)}),M=[`${w.length} nodes, ${y.length} edges.`];w.length>0&&M.push(`Mean degree: ${tc(S)}, max degree: ${A}.`);const _=Math.min(a,w.length),P=w.slice(0,_),R=w.length-_;return(0,Zl.jsxs)("div",{ref:f,id:n,className:ic,tabIndex:-1,onBlur:p,style:sc,role:"region","aria-label":h,children:[(0,Zl.jsx)("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{u&&c&&c.setVisible(!1),s(!1)},"aria-label":"Close data summary",style:lc,children:"×"}),(0,Zl.jsx)("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:ac,children:M.join(" ")}),(0,Zl.jsxs)("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Node degree summary for "+o,style:cc,children:[(0,Zl.jsx)("caption",{className:"semiotic-accessible-data-table-caption",style:hc,children:R>0?`Top ${_} of ${w.length} nodes by degree`:`All ${w.length} nodes by degree`}),(0,Zl.jsx)("thead",{children:(0,Zl.jsxs)("tr",{children:[(0,Zl.jsx)("th",{style:uc,children:"id"}),(0,Zl.jsx)("th",{style:uc,children:"degree"}),(0,Zl.jsx)("th",{style:uc,children:"in"}),(0,Zl.jsx)("th",{style:uc,children:"out"}),C&&(0,Zl.jsx)("th",{style:uc,children:"w. degree"}),C&&(0,Zl.jsx)("th",{style:uc,children:"w. in"}),C&&(0,Zl.jsx)("th",{style:uc,children:"w. out"})]})}),(0,Zl.jsx)("tbody",{children:P.map((e,t)=>(0,Zl.jsxs)("tr",{children:[(0,Zl.jsx)("td",{style:dc,children:e.id}),(0,Zl.jsx)("td",{style:dc,children:e.degree}),(0,Zl.jsx)("td",{style:dc,children:e.inDeg}),(0,Zl.jsx)("td",{style:dc,children:e.outDeg}),C&&(0,Zl.jsx)("td",{style:dc,children:tc(e.wDegree)}),C&&(0,Zl.jsx)("td",{style:dc,children:tc(e.wInDeg)}),C&&(0,Zl.jsx)("td",{style:dc,children:tc(e.wOutDeg)})]},t))})]}),R>0&&(0,Zl.jsxs)("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>l(e=>e+25),style:fc,children:["Show ",Math.min(25,R)," more"," ",1===R?"node":"nodes"," (",R," remaining)"]})]})}function gc({summary:e}){return e?(0,Zl.jsx)("div",{role:"note",style:Vl,children:e}):null}function yc({tableId:e}){return(0,Zl.jsx)("a",{href:"#"+e,style:Vl,onClick:t=>{t.preventDefault();const o=document.getElementById(e);o&&requestAnimationFrame(()=>o.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,Vl)},children:"Skip to data table"})}var bc=require("react/jsx-runtime"),vc="var(--semiotic-focus, #005fcc)";function xc({active:e,hoverPoint:t,margin:o,size:n,shape:r="circle",width:i,height:s,pathData:a}){if(!e||!t)return null;const l=t.x+o.left,c=t.y+o.top;let u;if("geoarea"!==r&&"path"!==r||!a)if("rect"===r&&null!=i&&null!=s){const e=Math.max(i,4),t=Math.max(s,4);u=(0,bc.jsx)("rect",{x:l-e/2-3,y:c-t/2-3,width:e+6,height:t+6,rx:3,fill:"none",stroke:vc,strokeWidth:2,strokeDasharray:"4,2"})}else u=(0,bc.jsx)("circle","wedge"===r?{cx:l,cy:c,r:12,fill:"none",stroke:vc,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:vc,strokeWidth:2,strokeDasharray:"4,2"});else u=(0,bc.jsx)("g",{transform:`translate(${o.left},${o.top})`,children:(0,bc.jsx)("path",{d:a,fill:"none",stroke:vc,strokeWidth:2.5,strokeDasharray:"6,3"})});return(0,bc.jsx)("svg",{style:{position:"absolute",left:0,top:0,width:n[0],height:n[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}var kc=d(require("react"));function wc(e,t){return"touch"===t?Math.max(e,24):e}function Sc(e){return Array.isArray(e)?e[0]:e}function Ac(e,t,o,n){return{data:Sc(e),x:t,y:o,__semioticHoverData:!0,...n}}var Cc=["name","label","title"],Mc=["type","kind","category","group","class","status","role","shape"],_c=["value","amount","total","count","weight","score"],Pc=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 Rc(e,t){for(const o of t){const t=e.find(e=>e.lower===o);if(t)return t}}function jc(e,t={}){if(!e||"object"!=typeof e)return{entries:[]};const o=t.maxEntries??6,n=!1!==t.skipPositional,r=[];for(const[t,o]of Object.entries(e)){if(t.startsWith("_"))continue;if("data"===t)continue;if(n&&Pc.has(t.toLowerCase()))continue;if(null==o)continue;const e=typeof o;("string"===e||"number"===e||"boolean"===e||o instanceof Date)&&r.push({key:t,lower:t.toLowerCase(),value:o})}if(0===r.length)return{entries:[]};let i=r.findIndex(e=>Cc.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=Rc(l,Mc),u=Rc(l,_c),d=new Set(Mc),h=new Set(_c),f=[];c&&f.push({key:c.key,value:c.value}),u&&f.push({key:u.key,value:u.value});for(const e of l){if(f.length>=o)break;e!==c&&e!==u&&(d.has(e.lower)||h.has(e.lower)||f.push({key:e.key,value:e.value}))}return{titleKey:a?.key,title:a?.value,entries:f}}var Lc=require("react/jsx-runtime"),Tc={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 Ic(e,t){return"function"==typeof t?t(e):e[t]}function $c(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 Nc(e={}){const{fields:t,title:o,format:n,style:r={},className:i=""}=e;return e=>{if(!e||"object"!=typeof e)return null;let s;const a=[];if(o){const t=Ic(e,o);s=$c(t,n)}if(t&&t.length>0)t.forEach(t=>{let o,r,i;"string"==typeof t?(o=t,r=t,i=n):(o=t.label,r=t.accessor||t.key||"",i=t.format||n);const s=Ic(e,r);a.push({label:o,value:$c(s,i)})});else if(!o){const t=["value","y","name","id","label"];for(const o of t)if(void 0!==e[o]){s=$c(e[o],n);break}if(!s){const t=Object.keys(e).filter(e=>!e.startsWith("_"));t.length>0&&(s=$c(e[t[0]],n))}}const l={...Tc,...r};return(0,Lc.jsxs)("div",{className:("semiotic-tooltip "+i).trim(),style:l,children:[s&&(0,Lc.jsx)("div",{style:{fontWeight:a.length>0?"bold":"normal"},children:s}),a.map((e,t)=>(0,Lc.jsxs)("div",{style:{marginTop:0===t&&s?"4px":0},children:[e.label&&(0,Lc.jsxs)("span",{children:[e.label,": "]}),e.value]},t))]})}}function Dc(e={}){const{fields:t=[],title:o,format:n,style:r={},className:i="",showLabels:s=!0,separator:a=": "}=e;return e=>{if(!e||"object"!=typeof e)return null;const l=[];if(o){const t=Ic(e,o);l.push({value:$c(t,n)})}if(t&&Array.isArray(t)&&t.length>0)t.forEach(t=>{let o,r,i;"string"==typeof t?(o=t,r=t,i=n):(o=t.label,r=t.accessor||t.key||"",i=t.format||n);const a=$c(Ic(e,r),i);l.push({label:s?o:void 0,value:a})});else{const t=jc(e,{skipPositional:!1});null!=t.title&&l.push({label:void 0,value:$c(t.title,n),bold:!0}),t.entries.forEach(e=>{l.push({label:s?e.key:void 0,value:$c(e.value,n)})})}const c={...Tc,...r};return Array.isArray(l)&&0!==l.length?(0,Lc.jsx)("div",{className:("semiotic-tooltip semiotic-tooltip-multiline "+i).trim(),style:c,children:l.map((e,t)=>(0,Lc.jsxs)("div",{style:{marginBottom:l.length-1>t?"4px":0,fontWeight:e.bold?"bold":void 0},children:[e.label&&(0,Lc.jsxs)("strong",{children:[e.label,a]}),e.value]},t))}):null}}function Ec(e){return"multi"===e||Oc(e)}function Oc(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)&&"mode"in e&&"multi"===e.mode}function Bc(e){const{tooltip:t,defaultTooltipContent:o,multiDefaultContent:n=Fc()}=e;return!1===t?{tooltipContent:()=>null}:Ec(t)?{tooltipContent:(Oc(t)&&"function"==typeof t.content?zc(t.content):void 0)||n,tooltipMode:"multi"}:{tooltipContent:zc(t)||o}}function Fc(){return e=>{const t=e.allSeries;if(!t||0===t.length)return(0,Lc.jsx)("div",{className:"semiotic-tooltip",style:Tc,children:(0,Lc.jsx)("div",{children:$c(e.data?.value??e.data?.y)})});const o=e.xValue??e.data?.time??e.data?.x;return(0,Lc.jsxs)("div",{className:"semiotic-tooltip",style:Tc,children:[null!=o&&(0,Lc.jsx)("div",{style:{fontWeight:600,marginBottom:4,fontSize:"0.9em",borderBottom:"1px solid var(--semiotic-border, #eee)",paddingBottom:4},children:$c(o)}),t.map((e,t)=>(0,Lc.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"1px 0"},children:[(0,Lc.jsx)("span",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:e.color,flexShrink:0}}),(0,Lc.jsx)("span",{style:{flex:1,fontSize:"0.85em"},children:e.group}),(0,Lc.jsx)("span",{style:{fontWeight:500,fontSize:"0.85em"},children:$c(e.value)})]},t))]})}}function zc(e){if(!0!==e){if("function"==typeof e){const t=e;return e=>{const o=!0===e?.__semioticHoverData||e&&void 0!==e.data&&"number"==typeof e.x&&"number"==typeof e.y&&e&&("node"===e.type||"edge"===e.type||void 0!==e.nodeOrEdge||void 0!==e.allSeries||void 0!==e.stats||void 0!==e.__chartType);let n=Sc(o?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;if(o&&(void 0!==e.allSeries||void 0!==e.xValue)){const t={...n};void 0!==e.allSeries&&void 0===t.allSeries&&(t.allSeries=e.allSeries),void 0!==e.xValue&&void 0===t.xValue&&(t.xValue=e.xValue),n=t}const r=t(n);return null==r?null:(0,Lc.jsx)("div",{className:"semiotic-tooltip",style:Tc,children:r})}}return!1!==e&&void 0!==e&&(Oc(e)?"function"==typeof e.content?zc(e.content):("undefined"!=typeof process&&"production"!==process.env?.NODE_ENV&&console.warn('[semiotic] tooltip={{ mode: "multi" }} reached normalizeTooltip without a chart that wires tooltipMode. Prefer LineChart/AreaChart/StackedAreaChart/DifferenceChart, or pass frameProps.tooltipMode: "multi".'),Fc()):"object"==typeof e&&null!==e&&("fields"in e||"title"in e)?Nc(e):"multi"===e?("undefined"!=typeof process&&"production"!==process.env?.NODE_ENV&&console.warn('[semiotic] tooltip="multi" reached normalizeTooltip — prefer charts that set tooltipMode (LineChart, AreaChart, StackedAreaChart, DifferenceChart). Rendering MultiLineTooltip content as a fallback.'),Dc()):Nc())}}var Hc=require("react/jsx-runtime");function Wc({x:e,y:t,containerWidth:o,containerHeight:n,margin:r,children:i,className:s="stream-frame-tooltip",zIndex:a=1}){const l=Number.isFinite(e)&&Number.isFinite(t),c=kc.useRef(null),[u,d]=kc.useState(null);kc.useLayoutEffect(()=>{const e=c.current;if(!e)return;const t=()=>{const t=e.getBoundingClientRect();Number.isFinite(t.width)&&Number.isFinite(t.height)&&d(e=>e&&.5>Math.abs(e.width-t.width)&&.5>Math.abs(e.height-t.height)?e:{width:t.width,height:t.height})};if(t(),"undefined"==typeof ResizeObserver)return;const o=new ResizeObserver(t);return o.observe(e),()=>o.disconnect()},[s,o,n,l]);let h;h=u?`translate(${u.width+12>o-e?"calc(-100% - 12px)":"12px"}, ${u.height+12>n-t?"calc(-100% - 4px)":"4px"})`:`translate(${e>.7*o?"calc(-100% - 12px)":"12px"}, ${.3*n>t?"4px":"calc(-100% - 4px)"})`;const f=function(e){if(!kc.isValidElement(e))return!1;const t=e.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;const o=e.props;if(!0===o["data-semiotic-tooltip-chrome"])return!0;if("true"===o["data-semiotic-tooltip-chrome"])return!0;const n=o.style;if(n&&"object"==typeof n){if(null!=n.background&&""!==n.background&&"transparent"!==n.background)return!0;if(null!=n.backgroundColor&&""!==n.backgroundColor&&"transparent"!==n.backgroundColor)return!0}return!1}(i),m=f?null:Tc;return l?(0,Hc.jsx)("div",{ref:c,className:f?s:(s+" semiotic-tooltip").trim(),style:{...m||{},position:"absolute",left:r.left+e,top:r.top+t,transform:h,pointerEvents:"none",zIndex:a,width:"max-content"},children:i}):null}var qc=d(require("react")),Yc=require("react"),Gc=require("react");function Vc(e,t){if("function"==typeof e.addEventListener)return e.addEventListener("change",t),()=>e.removeEventListener("change",t);const o=e;return o.addListener(t),()=>o.removeListener(t)}var Xc=require("react");function Uc(e,t,o){const n=(0,Xc.useRef)(null),[r,i]=(0,Xc.useState)(null);return(0,Xc.useEffect)(()=>{if(!t&&!o)return;const e=n.current;if(!e)return;const r=new ResizeObserver(e=>{for(const t of e){const{width:e,height:o}=t.contentRect;i(t=>t&&t.w===e&&t.h===o?t:{w:e,h:o})}});return r.observe(e),()=>r.disconnect()},[t,o]),[n,[t&&r?r.w:e[0],o&&r?r.h:e[1]]]}var Kc=()=>"undefined"!=typeof performance?performance.now():Date.now();function Qc(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}}function Zc(e,t){const o=e();return Number.isFinite(o)?o:t}var Jc=class{constructor(e={}){this.randomSource=Math.random,this.subscribers=new Set,this.now=()=>this.advance(),this.random=()=>this.randomSource(),this.clock=e.clock??Kc,this.lastWallTime=Zc(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=Zc(this.clock,this.lastWallTime),t=Math.max(0,e-this.lastWallTime);return this.lastWallTime=e,this.isActive&&(this.logicalTime+=t),this.logicalTime}emit(){for(const e of this.subscribers)e()}setClock(e){const t=e??Kc;t!==this.clock&&(this.advance(),this.clock=t,this.lastWallTime=Zc(t,this.lastWallTime))}setRandomSource(e,t){const o=function(e){return"number"==typeof e&&Number.isFinite(e)?Math.trunc(e):void 0}(t);e===this.randomInput&&o===this.seedValue||(this.randomInput=e,this.seedValue=o,this.randomSource=e??(void 0===o?Math.random:Qc(o)))}},eu="undefined"==typeof window?Yc.useEffect:Yc.useLayoutEffect,tu={requestAnimationFrame:e=>("undefined"==typeof window?globalThis:window).requestAnimationFrame(e),cancelAnimationFrame:e=>("undefined"==typeof window?globalThis:window).cancelAnimationFrame(e)};function ou(e,t,o){return"function"==typeof e?e({size:t,margin:o}):e}function nu(e){const t=function(){const[e,t]=(0,Gc.useState)(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return(0,Gc.useEffect)(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),Vc(e,e=>t(e.matches))},[]),e}(),o=(0,Yc.useRef)(t);o.current=t;const[n,r]=Uc(e.sizeProp,e.responsiveWidth,e.responsiveHeight),i=!!e.title,s=!!e.legend&&"top"===e.legendPosition,a=(0,Yc.useMemo)(()=>function(e,t,o=!1){const n=o?t?58:34:t?36:0;return n>e.top?{...e,top:n}: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=ou(e.foregroundGraphics,r,a),d=ou(e.backgroundGraphics,r,a),h=Tt(e=>e.theme),{transition:f,introEnabled:m}=function(e,t){if(!1===e)return{transition:void 0,introEnabled:!1};const o="undefined"!=typeof window&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;return{transition:e?!0===e?{duration:300}:{duration:e.duration??300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(o||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),p="semiotic-table-"+qc.useId(),g=(0,Yc.useRef)(null);if(!g.current){const t=!e.suspendWhenHidden||"undefined"==typeof document||!document.hidden;g.current=new Jc({clock:e.clock,random:e.random,seed:e.seed,paused:e.paused,visible:t})}const y=g.current;y.configure({clock:e.clock,random:e.random,seed:e.seed});const b=(0,Yc.useRef)(null),v=(0,Yc.useRef)(e.frameScheduler??tu);v.current=e.frameScheduler??tu;const x=(0,Yc.useRef)(null),k=(0,Yc.useRef)(!1),w=(0,Yc.useRef)(()=>{}),S=(0,Yc.useCallback)(()=>{if(null!==b.current||k.current)return;const e=v.current;let t=!1,o=!1;const n=e.requestAnimationFrame(()=>{t=!0;const e=!o;e&&(k.current=!0),b.current=null,x.current=null;try{w.current()}finally{e&&(k.current=!1)}});o=!0,t||(b.current=n,x.current=e)},[]),A=(0,Yc.useCallback)(()=>{null!==b.current&&((x.current??v.current).cancelAnimationFrame(b.current),b.current=null,x.current=null)},[]);eu(()=>{y.setPaused(!0===e.paused)},[y,e.paused]),(0,Yc.useEffect)(()=>{if(!e.suspendWhenHidden||"undefined"==typeof document)return void y.setVisible(!0);const t=()=>y.setVisible(!document.hidden);return t(),document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},[y,e.suspendWhenHidden]),(0,Yc.useEffect)(()=>()=>{A()},[A]);const C=(0,Yc.useRef)(()=>{}),M=(0,Yc.useRef)(()=>{}),_=(0,Yc.useRef)(null),P=(0,Yc.useRef)(null),R=(0,Yc.useRef)(null),j=(0,Yc.useCallback)(()=>{const e=_.current;_.current=null,e&&C.current(e)},[]),L=(0,Yc.useCallback)(e=>{if(_.current={clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType},null===P.current){const e=v.current;let t=!1;const o=e.requestAnimationFrame(()=>{t=!0,P.current=null,R.current=null,j()});t||(P.current=o,R.current=e)}},[j]),T=(0,Yc.useCallback)(()=>{_.current=null,null!==P.current&&((R.current??v.current).cancelAnimationFrame(P.current),P.current=null,R.current=null),M.current()},[]);(0,Yc.useEffect)(()=>()=>{_.current=null,null!==P.current&&((R.current??v.current).cancelAnimationFrame(P.current),P.current=null,R.current=null)},[]);const I=e.themeDirtyRef;return eu(()=>{I&&(Yr++,I.current=!0,S())},[h,S,I]),{reducedMotion:t,reducedMotionRef:o,responsiveRef:n,size:r,margin:a,adjustedWidth:l,adjustedHeight:c,resolvedForeground:u,resolvedBackground:d,currentTheme:h,transition:f,introEnabled:m,tableId:p,frameRuntime:y,rafRef:b,renderFnRef:w,scheduleRender:S,cancelRender:A,hoverHandlerRef:C,hoverLeaveRef:M,onPointerMove:L,onPointerLeave:T}}var ru=require("react");function iu(e,t,o,n){const r=e.getContext("2d");if(!r)return null;const i=Math.round(t[0]*n),s=Math.round(t[1]*n),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(o.left,o.top),r}function su(e){if("undefined"==typeof window)return 1;const t=window.devicePixelRatio||1,o=function(){if("undefined"==typeof window)return!1;const e="function"==typeof window.matchMedia&&window.matchMedia("(pointer: coarse)").matches,t=768>Math.min(window.innerWidth||1/0,window.innerHeight||1/0);return e||t}()?2:3;return Math.max(1,Math.min(t,"number"==typeof e&&e>0?e:o))}var au=require("react/jsx-runtime");function lu(e){const{cancelRender:t,dirtyRef:o,frameRuntime:n,manageFrameRuntime:r,maxDevicePixelRatio:i,scheduleRender:s}=e,a=(0,ru.useRef)(null),l=(0,ru.useRef)(null),c=(0,ru.useRef)(!1),u=(0,ru.useRef)(!1),d=(0,ru.useRef)(!1);return function(e){const{hydrated:t,wasHydratingFromSSR:o,storeRef:n,dirtyRef:r,renderFnRef:i,cancelRender:s,cleanup:a}=e;Cl(()=>{const e=n.current;t&&o&&e?.cancelIntroAnimation?.(),!o&&e?.sceneNodes&&e.sceneNodes.length>0&&e?.markStylePaintPending?e.markStylePaintPending():r.current=!0,s?.(),i.current()},[t,o]);const l=(0,Al.useRef)(a);l.current=a,(0,Al.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,ru.useEffect)(()=>{if(!1!==r)return n.subscribe(()=>{n.isActive?(o.current=!0,s()):t()})},[t,o,n,r,s]),(0,ru.useEffect)(()=>function(){if("undefined"==typeof window||"function"!=typeof window.matchMedia)return()=>{};let e=null,t=!1;const o=()=>{e&&("function"==typeof e.removeEventListener?e.removeEventListener("change",r):"function"==typeof e.removeListener&&e.removeListener(r))},n=()=>{const t=`(resolution: ${window.devicePixelRatio||1}dppx)`;e=window.matchMedia(t),e.media.includes("resolution")?"function"==typeof e.addEventListener?e.addEventListener("change",r):"function"==typeof e.addListener&&e.addListener(r):e=null};function r(){t||(o(),e=null,c.current=!0,s(),queueMicrotask(()=>{t||n()}))}return n(),()=>{t=!0,o(),e=null}}(),[s]),(0,ru.useEffect)(()=>{d.current?(c.current=!0,s()):d.current=!0},[i,s]),(0,ru.useEffect)(()=>{!u.current&&(u.current=!0,e.skipInitialCanvasPaintInvalidation)||(e.canvasPaintInvalidator?e.canvasPaintInvalidator():e.dirtyRef.current=!0,e.scheduleRender())},e.canvasPaintDependencies),{canvasRef:a,interactionCanvasRef:l,resolutionDirtyRef:c}}function cu(e,t){return lu({...t,renderFnRef:e.renderFnRef,scheduleRender:e.scheduleRender,cancelRender:e.cancelRender,frameRuntime:e.frameRuntime})}function uu({children:e,size:t,margin:o,overflowVisible:n=!1}){return e?(0,au.jsx)("svg",{style:{position:"absolute",left:0,top:0,width:t[0],height:t[1],pointerEvents:"none",overflow:n?"visible":void 0},children:(0,au.jsx)("g",{transform:`translate(${o.left},${o.top})`,children:e})}):null}function du(e,t,o,n){const r=n.current,i=!0===e.lastCustomLayoutFailure?.preservedLastGoodScene,s=!i&&e.hasActivePulsesAt(t),a=!(o||i||!s&&!r)&&e.refreshPulse(t);return n.current=s,{changed:a,pending:s}}function hu(e,t,o,n){return"function"==typeof e?e({size:t,margin:o,scales:n}):e}var fu=require("react");function mu(e,t,o,n){const r=(0,fu.useRef)({accessor:t,onChange:o,readData:n}),i=(0,fu.useRef)([]);return r.current={accessor:t,onChange:o,readData:n},(0,fu.useCallback)(()=>{const{accessor:t,onChange:o,readData:n}=r.current;if(!o||!t)return;const s=function(e,t){if(!t)return[];const o=new Set,n=[];for(const r of e){if(!r||"object"!=typeof r)continue;const e="function"==typeof t?t(r):r[t];if(null==e)continue;const i=e+"";o.has(i)||(o.add(i),n.push(i))}return n}(e.current?n(e.current):[],t);(function(e,t){if(e.length!==t.length)return!1;for(let o=0;e.length>o;o++)if(e[o]!==t[o])return!1;return!0})(s,i.current)||(i.current=s,o(s))},[e])}function pu(e,t,o,n){return"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:o,fn:e}:"string"==typeof t?{key:t,fn:null}:"function"==typeof t?{key:n,fn:t}:{key:void 0,fn:null}}function gu(e,t,o){return n=>{if(!n||!o||!e.fn&&!t.fn)return n;let r=!1;const i=n.map(o=>{const n=e.fn&&e.key&&!(e.key in o),i=t.fn&&t.key&&!(t.key in o);if(!n&&!i)return o;r=!0;const s={...o};return n&&(s[e.key]=e.fn(o)),i&&(s[t.key]=t.fn(o)),s});return r?i:n}}var yu=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],bu=3156e7;function vu(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")}`}:bu>t?e=>{const t=new Date(e);return`${yu[t.getUTCMonth()]} ${t.getUTCDate()}`}:5*bu>t?e=>{const t=new Date(e);return`${yu[t.getUTCMonth()]} ${t.getUTCFullYear()}`}:e=>new Date(e).getUTCFullYear()+""}function xu(e){if(!e)return;const t=[];for(const o of e)if("point"===o.type)t.push(o);else if("symbol"===o.type)t.push({pointId:o.pointId,x:o.x,y:o.y,r:pn(o.size)});else if("glyph"===o.type){const e=zr(o.glyph,o.size);t.push({pointId:o.pointId,x:o.x+e.centerDx,y:o.y+e.centerDy,r:e.radius})}return t}var ku=require("d3-shape");function wu(e,t,o,n,r,i){if(2>t.length)return;const s=[0];for(let e=1;t.length>e;e++){const o=t[e][0]-t[e-1][0],n=t[e][1]-t[e-1][1];s.push(s[e-1]+Math.sqrt(o*o+n*n))}const a=s[s.length-1];if(0===a)return;const l=Math.min(.2*a,40);e.strokeStyle=o,e.lineWidth=n,e.lineCap=i;for(let o=0;t.length-1>o;o++){const n=(s[o]+s[o+1])/2;let i=r;l>n&&(i*=n/l),l>a-n&&(i*=(a-n)/l),e.globalAlpha=Math.max(0,i),e.beginPath(),e.moveTo(t[o][0],t[o][1]),e.lineTo(t[o+1][0],t[o+1][1]),e.stroke()}}var Su=(e,t,o,n)=>{const r=t.filter(e=>"line"===e.type);for(const t of r){if(2>t.path.length)continue;const o=t._introClipFraction;void 0!==o&&1>o&&(e.save(),e.beginPath(),e.rect(0,0,n.width*o,n.height),e.clip());const r=t.style.stroke||"#007bff",i=Ur(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){wu(e,t.path,i,s,t.style.opacity??1,t.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const c=li(t.curve),u=a&&a.length>0&&l&&l.length===t.path.length,d=t._decayOpacities;if(d&&d.length===t.path.length&&!u){e.strokeStyle=i;const o=t.style.opacity??1;for(let n=0;t.path.length-1>n;n++)e.globalAlpha=.5*(d[n]+d[n+1])*o,e.beginPath(),e.moveTo(t.path[n][0],t.path[n][1]),e.lineTo(t.path[n+1][0],t.path[n+1][1]),e.stroke()}else if(u){const o=el(t.path,l,a,i);for(const t of o){e.beginPath(),e.strokeStyle=Ur(e,t.color)||t.color,e.moveTo(t.path[0][0],t.path[0][1]);for(let o=1;t.path.length>o;o++)e.lineTo(t.path[o][0],t.path[o][1]);e.stroke()}}else{e.beginPath();const o=t.strokeGradient&&t.path.length>=2?di(e,t.strokeGradient,i,t.path[0][0],0,t.path[t.path.length-1][0],0):null;if(e.strokeStyle=o||i,c)(0,ku.line)().x(e=>e[0]).y(e=>e[1]).curve(c).context(e)(t.path);else{const[o,n]=t.path[0];e.moveTo(o,n);for(let o=1;t.path.length>o;o++)e.lineTo(t.path[o][0],t.path[o][1])}e.stroke()}if(t.style.fill&&t.style.fillOpacity&&t.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=t.style.fillOpacity,e.fillStyle=ci(e,t.style.fill,t.style.fill),c&&!u)(0,ku.line)().x(e=>e[0]).y(e=>e[1]).curve(c).context(e)(t.path);else{const[o,n]=t.path[0];e.moveTo(o,n);for(let o=1;t.path.length>o;o++)e.lineTo(t.path[o][0],t.path[o][1])}const o=t.path[0][0];e.lineTo(t.path[t.path.length-1][0],n.height),e.lineTo(o,n.height),e.closePath(),e.fill()}void 0!==o&&1>o&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}};function Au(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Cu(e,t,o=.3){Au(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h))}function Mu(e,t,o=.6){if(!Au(t))return;const n=t.r+(t._pulseGlowRadius??4)*t._pulseIntensity,r=t.cx??t.x??0,i=t.cy??t.y??0;e.beginPath(),e.arc(r,i,n,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*o,e.stroke()}function _u(e,t,o,n=.35){Au(t)&&(e.globalAlpha=t._pulseIntensity*n,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",o?e.fill(o):e.fill())}var Pu=require("d3-shape");function Ru(e,t){const o=li(t.curve);if(!o||2>t.topPath.length||2>t.bottomPath.length){e.beginPath(),e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let o=1;t.topPath.length>o;o++)e.lineTo(t.topPath[o][0],t.topPath[o][1]);for(let o=t.bottomPath.length-1;o>=0;o--)e.lineTo(t.bottomPath[o][0],t.bottomPath[o][1]);e.closePath()}else{const n=(0,Pu.area)().x(e=>e[0]).y0((e,o)=>t.bottomPath[o][1]).y1(e=>e[1]).curve(o).context(e);e.beginPath(),n(t.topPath)}}function ju(e,t){const o=li(t.curve);if(e.beginPath(),o)(0,Pu.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 o=1;t.topPath.length>o;o++)e.lineTo(t.topPath[o][0],t.topPath[o][1])}}var Lu=(e,t,o,n)=>{const r=t.filter(e=>"area"===e.type);for(const t of r){if(2>t.topPath.length)continue;let o=!1;t.clipRect&&(e.save(),e.beginPath(),e.rect(t.clipRect.x,t.clipRect.y,t.clipRect.width,t.clipRect.height),e.clip(),o=!0);const r=t._introClipFraction;void 0!==r&&1>r&&(e.save(),e.beginPath(),e.rect(0,0,n.width*r,n.height),e.clip());const i=ci(e,t.style.fill,"#4e79a7"),s=t._decayOpacities,a=!(!t.colorThresholds?.length||!t.rawValues||t.rawValues.length!==t.topPath.length),l=!!t.strokeColorBands?.length;if(s&&s.length===t.topPath.length&&!a&&!l){const o=t.style.fillOpacity??.7;e.fillStyle=i;for(let n=0;t.topPath.length-1>n;n++)e.globalAlpha=.5*(s[n]+s[n+1])*o,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.lineTo(t.bottomPath[n+1][0],t.bottomPath[n+1][1]),e.lineTo(t.bottomPath[n][0],t.bottomPath[n][1]),e.closePath(),e.fill();if(t.style.stroke&&"none"!==t.style.stroke){e.strokeStyle=Ur(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);for(let o=0;t.topPath.length-1>o;o++)e.globalAlpha=.5*(s[o]+s[o+1]),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.stroke()}e.globalAlpha=1;continue}const c=t.style.opacity??1;if(Ru(e,t),t.fillGradient&&t.fillGradient.stops.length>=2&&t.fillGradient){let o=1/0;for(const e of t.topPath)o>e[1]&&(o=e[1]);let n=-1/0;for(const e of t.bottomPath)e[1]>n&&(n=e[1]);const r=di(e,t.fillGradient,"string"==typeof i?i:"#4e79a7",0,o,0,n);e.fillStyle=r||i,e.globalAlpha=c}else e.globalAlpha=(t.style.fillOpacity??.7)*c,e.fillStyle=i;if(e.fill(),t._pulseIntensity&&t._pulseIntensity>0&&(Ru(e,t),_u(e,t)),t.style.stroke&&"none"!==t.style.stroke){e.globalAlpha=c;const o=Ur(e,t.style.stroke)||t.style.stroke,n=a||l||!t.strokeGradient||2>t.topPath.length?null:di(e,t.strokeGradient,o,t.topPath[0][0],0,t.topPath[t.topPath.length-1][0],0);if(e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]),l){let n=1/0,r=-1/0;for(const[e]of t.topPath)n=Math.min(n,e),r=Math.max(r,e);const i=e.lineWidth;for(const s of t.strokeColorBands){e.save(),e.beginPath(),e.rect(n-i,s.y,r-n+2*i,s.height),e.clip();const a=s.color??o;e.strokeStyle=Ur(e,a)||a,ju(e,t),e.stroke(),e.restore()}}else if(a){const n=el(t.topPath,t.rawValues,t.colorThresholds,o);for(const t of n){e.beginPath(),e.strokeStyle=Ur(e,t.color)||t.color,e.moveTo(t.path[0][0],t.path[0][1]);for(let o=1;t.path.length>o;o++)e.lineTo(t.path[o][0],t.path[o][1]);e.stroke()}}else e.strokeStyle=n||o,ju(e,t),e.stroke()}void 0!==r&&1>r&&e.restore(),o&&e.restore(),e.globalAlpha=1}},Tu=(e,t,o,n)=>{const r=t.filter(e=>"point"===e.type);if(0!==r.length){e.save();try{const t=e.globalAlpha;for(const o of r)e.beginPath(),e.arc(o.x,o.y,o.r,0,2*Math.PI),e.globalAlpha=t*(o.style.opacity??o.style.fillOpacity??1),e.fillStyle=ci(e,o.style.fill,"#4e79a7"),e.fill(),o.style.stroke&&"none"!==o.style.stroke&&(e.strokeStyle=ci(e,o.style.stroke,o.style.stroke),e.lineWidth=o.style.strokeWidth||1,e.stroke()),Mu(e,o)}finally{e.restore()}}},Iu=new Map;function $u(e,t,o,n,r,i){if(0>=t.size)return;const s=function(e,t,o){try{if(o)return new Path2D(o);const n=`${e??"circle"}:${Math.round(t)}`;let r=Iu.get(n);return r||(r=new Path2D(mn(e,t)),Iu.size>256&&Iu.clear(),Iu.set(n,r)),r}catch{return null}}(t.symbolType,t.size,t.path);if(!s)return;e.save(),e.translate(o,n),t.rotation&&e.rotate(t.rotation);const a=(t.style.opacity??1)*(t._decayOpacity??1);t.style.fill&&(e.globalAlpha=r*a*(t.style.fillOpacity??1),e.fillStyle=ci(e,t.style.fill,i),e.fill(s)),t.style.stroke&&"none"!==t.style.stroke&&(e.globalAlpha=r*a,e.strokeStyle=Ur(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??1,e.stroke(s)),e.restore()}var Nu=(e,t)=>{const o=e.globalAlpha;for(const n of t)"symbol"===n.type&&$u(e,n,n.x,n.y,o,"#4e79a7");e.globalAlpha=o};function Du(e,t,o,n,r){if(0>=t.size)return;const i=t.glyph;if(!i||!i.parts?.length)return;const s=Dr(i,t.size);if(0>=s.scale)return;const a=(t.style.opacity??1)*(t._decayOpacity??1);if(0>=a)return;const l=t=>{const o=ci(e,t,t);return"string"==typeof o?o:t},c=t.color??("string"==typeof t.style.fill?t.style.fill:void 0);e.save(),e.translate(o,n),t.rotation&&e.rotate(t.rotation),e.translate(s.offsetX,s.offsetY),e.scale(s.scale,s.scale),e.globalAlpha=r*a*(t.style.fillOpacity??1);const u=Fr(i,t.fraction??1,t.fractionStart??0,t.fractionDirection??"horizontal");u&&t.ghostColor&&Hr(e,i,c,t.accent,t.ghostColor,l),u&&(e.beginPath(),e.rect(u.x,u.y,u.width,u.height),e.clip()),Hr(e,i,c,t.accent,void 0,l),e.restore()}var Eu=(e,t)=>{const o=e.globalAlpha;for(const n of t)"glyph"===n.type&&Du(e,n,n.x,n.y,o);e.globalAlpha=o};function Ou(e,t){const{x:o,y:n,w:r,h:i}=t,{tl:s,tr:a,br:l,bl:c}=ol(t);e.beginPath(),e.moveTo(o+s,n),e.lineTo(o+r-a,n),a>0&&e.arcTo(o+r,n,o+r,n+a,a),e.lineTo(o+r,n+i-l),l>0&&e.arcTo(o+r,n+i,o+r-l,n+i,l),e.lineTo(o+c,n+i),c>0&&e.arcTo(o,n+i,o,n+i-c,c),e.lineTo(o,n+s),s>0&&e.arcTo(o,n,o+s,n,s),e.closePath()}function Bu(e,t){const o=ci(e,t.style.fill,Ur(e,"var(--semiotic-primary, #007bff)")),n=function(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}}}(t);return(t.fillGradient&&"string"==typeof o?di(e,t.fillGradient,o,n.x0,n.y0,n.x1,n.y1):null)||o}function Fu(e,t){return!(!t.style.stroke||"none"===t.style.stroke||(e.strokeStyle=Ur(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,0))}var zu=(e,t,o,n)=>{const r=t.filter(e=>"rect"===e.type);for(const t of r){if(null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon)Hu(e,t);else if(t.cornerRadii&&tl(t.cornerRadii))e.fillStyle=Bu(e,t),Ou(e,t),e.fill(),Fu(e,t)&&e.stroke();else if(t.roundedTop&&t.roundedTop>0){e.fillStyle=Bu(e,t);const o=Math.min(t.roundedTop,t.w/2,t.h/2);e.beginPath();const{x:n,y:r,w:i,h:s}=t;switch(t.roundedEdge){case"right":e.moveTo(n,r),e.lineTo(n+i-o,r),e.arcTo(n+i,r,n+i,r+o,o),e.lineTo(n+i,r+s-o),e.arcTo(n+i,r+s,n+i-o,r+s,o),e.lineTo(n,r+s);break;case"left":e.moveTo(n+i,r),e.lineTo(n+o,r),e.arcTo(n,r,n,r+o,o),e.lineTo(n,r+s-o),e.arcTo(n,r+s,n+o,r+s,o),e.lineTo(n+i,r+s);break;case"bottom":e.moveTo(n,r),e.lineTo(n+i,r),e.lineTo(n+i,r+s-o),e.arcTo(n+i,r+s,n+i-o,r+s,o),e.lineTo(n+o,r+s),e.arcTo(n,r+s,n,r+s-o,o);break;default:e.moveTo(n,r+s),e.lineTo(n,r+o),e.arcTo(n,r,n+o,r,o),e.lineTo(n+i-o,r),e.arcTo(n+i,r,n+i,r+o,o),e.lineTo(n+i,r+s)}e.closePath(),e.fill(),Fu(e,t)&&e.stroke()}else e.fillStyle=Bu(e,t),e.fillRect(t.x,t.y,t.w,t.h),Fu(e,t)&&e.strokeRect(t.x,t.y,t.w,t.h);Cu(e,t),e.globalAlpha=1}};function Hu(e,t){const o=t.style.icon,n=t.style.iconPadding||2,r=Math.min(t.w,t.h)-n;if(0>=r)return;const i=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),i){const i=r+n,s=t.x+(t.w-r)/2;for(let n=t.y+t.h-r;n>=t.y-r;n-=i)e.drawImage(o,s,n,r,r)}else{const i=r+n,s=t.y+(t.h-r)/2;for(let n=t.x;t.x+t.w>n;n+=i)e.drawImage(o,n,s,r,r)}e.restore()}function Wu(e){const[t,o,n]=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*o+.114*n>128?"#000":"#fff"}function qu(e){return Number.isInteger(e)?e+"":100>Math.abs(e)?1>Math.abs(e)?e.toPrecision(3):e.toFixed(1):e.toFixed(0)}var Yu=(e,t,o,n)=>{const r=t.filter(e=>"heatcell"===e.type);e.save();try{for(const t of r){const o=t.style;null!=o?.opacity&&(e.globalAlpha=o.opacity),e.fillStyle=t.fill,e.fillRect(t.x,t.y,t.w,t.h);const n=Math.max(0,o?.strokeWidth??1);if(n>0&&(e.strokeStyle=Ur(e,o?.stroke??"var(--semiotic-surface, #fff)"),e.lineWidth=n,e.strokeRect(t.x,t.y,t.w,t.h)),Cu(e,t),e.globalAlpha=1,t.showValues&&null!=t.value){if(20>t.w||20>t.h)continue;const o=t.valueFormat?t.valueFormat(t.value):qu(t.value),n=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=Wu(t.fill),e.font=n+"px sans-serif",e.textAlign="center",e.textBaseline="middle",e.fillText(o,r,i)}}}finally{e.restore()}},Gu=(e,t,o,n)=>{for(const o of t){if("candlestick"!==o.type)continue;const t=o;e.save();const r=(t._decayOpacity??1)*(t.style?.opacity??1);1!==r&&(e.globalAlpha=r);const i=Ur(e,t.wickColor)||t.wickColor,s=60>n.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 o=t.dotRadius??Math.max(2,Math.min(t.bodyWidth/2,.12*n.height));e.fillStyle=i,e.beginPath(),e.arc(t.x,t.highY,o,0,2*Math.PI),e.fill(),e.beginPath(),e.arc(t.x,t.lowY,o,0,2*Math.PI),e.fill()}else if(t.bodyWidth>0){const o=Math.min(t.openY,t.closeY),n=Math.abs(t.openY-t.closeY),r=t.isUp?t.upColor:t.downColor,i=Ur(e,r)||r;e.fillStyle=i,e.fillRect(t.x-t.bodyWidth/2,o,t.bodyWidth,Math.max(n,1)),e.strokeStyle=i,e.lineWidth=1,e.strokeRect(t.x-t.bodyWidth/2,o,t.bodyWidth,Math.max(n,1))}s&&l(),e.restore()}},Vu={line:[Lu,Su,Tu],area:[Lu,Tu],stackedarea:[Lu,Tu],scatter:[Tu,Nu],bubble:[Tu,Nu],heatmap:[Yu],bar:[zu],swarm:[Tu],waterfall:[(e,t,o,n)=>{zu(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=Ur(e,s)||s,e.lineWidth=i?._connectorWidth??1,e.setLineDash([]);for(let t=0;r.length-1>t;t++){const n=r[t],i=r[t+1],s=n.datum,a=i.datum;if(null==s?.cumEnd||null==a?.baseline)continue;const l=o.y(s.cumEnd),c=n.x+n.w,u=i.x;e.beginPath(),e.moveTo(c,l),e.lineTo(u,l),e.stroke()}e.restore()}}],candlestick:[Gu],mixed:[Lu,Su,Tu],custom:[Lu,zu,Yu,Su,Tu,Nu,Eu,Gu]},Xu=new Set;function Uu(e,t){const o="function"==typeof e?e(t.datum??null,t):e;return(n=o)&&"object"==typeof n&&"string"==typeof n.id&&"function"==typeof n.cacheKey&&"function"==typeof n.drawCanvas&&"function"==typeof n.renderStaticSVG?o:void 0;var n}function Ku(e,t){if("undefined"!=typeof process&&"production"===process.env?.NODE_ENV)return;const o=`${e}:${t}`;Xu.has(o)||(Xu.add(o),console.warn(`[Semiotic] Render backend "${e}" does not support scene node "${t}"; using the built-in renderer.`))}function Qu(e){const{context:t,nodes:o,renderMode:n,pixelRatio:r,paintBuiltIn:i}=e;if(!n||"sketchy"===n)return void i(o);let s=[];const a=()=>{s.length&&(i(s),s=[])};for(const e of o){const o=Uu(n,e);if(!o){s.push(e);continue}let l;a(),t.save();try{l=o.drawCanvas({context:t,node:e,style:e.style??{},pixelRatio:r})}finally{t.restore()}l||(Ku(o.id,e.type??"unknown"),i([e]))}a()}function Zu(e){const{node:t,index:o,renderMode:n,fallback:r}=e,i=Uu(n,t);if(!i)return r();const s=i.renderStaticSVG({node:t,style:t.style??{},key:`${i.id}-${o}`});return null!=s?s:(Ku(i.id,t.type??"unknown"),r())}var Ju=require("react/jsx-runtime");function ed(e){return"string"==typeof e?e:"value"}function td(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function od(e,t){if(!t)return td(e);try{const o=t(e);return null==o?td(e):o}catch{return td(e)}}function nd(e,t){return"function"==typeof t?t(e):e[t]}function rd(e,t){if(!e)return[];const o=[];return(Array.isArray(e)?e:[e]).forEach((e,n)=>{const r="string"==typeof e?.y0Accessor?e.y0Accessor:"low",i="string"==typeof e?.y1Accessor?e.y1Accessor:"high";o.push({label:r,accessor:e=>e.bands?.[n]?.y0??(0===n?e.band?.y0:void 0),format:t}),o.push({label:i,accessor:e=>e.bands?.[n]?.y1??(0===n?e.band?.y1:void 0),format:t})}),o}function id(e){const t=e.find(e=>"title"===e.role),o=e.filter(e=>"title"!==e.role);return e=>{const n=e.data;if(!n)return null;const r=t?od(nd(n,t.accessor),t.format):null;return(0,Ju.jsxs)("div",{className:"semiotic-tooltip",style:Tc,children:[null!=r&&(0,Ju.jsx)("div",{style:{fontWeight:"bold",marginBottom:o.length>0?4:0},children:r}),o.map((e,t)=>{const o=od(nd(n,e.accessor),e.format);return(0,Ju.jsxs)("div",{style:t>0?{marginTop:2}:void 0,children:[(0,Ju.jsxs)("span",{style:{opacity:.7},children:[e.label,": "]}),(0,Ju.jsx)("span",{children:o})]},t)})]})}}function sd({categoryAccessor:e,valueAccessor:t,groupAccessor:o,groupLabel:n,pieData:r=!1,valueFormat:i}){return s=>{const a=r?s.data?.[0]||s.data||s:s.data||s,l=nd(a,e),c=nd(a,t),u=o?nd(a,o):void 0;return(0,Ju.jsxs)("div",{className:"semiotic-tooltip",style:Tc,children:[(0,Ju.jsx)("div",{style:{fontWeight:"bold"},children:td(l)}),(0,Ju.jsx)("div",{style:{marginTop:4},children:od(c,i)}),null!=u&&(0,Ju.jsxs)("div",{style:{marginTop:2,opacity:.8},children:[n||ed(o),": ",td(u)]})]})}}var ad=require("react/jsx-runtime");function ld(e){return null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+""}function cd({hover:e}){const t=e.data??{},o=t.y??t.value,n=t.x??t.time;if(void 0===o&&void 0===n){const e=jc(t);if(null!=e.title||e.entries.length>0)return(0,ad.jsxs)("div",{className:"semiotic-tooltip",style:Tc,children:[null!=e.title&&(0,ad.jsx)("div",{style:{fontWeight:600,marginBottom:e.entries.length?2:0},children:e.title+""}),e.entries.map(e=>(0,ad.jsxs)("div",{style:{opacity:.7,fontSize:11},children:[e.key,":"," ",(0,ad.jsx)("span",{style:{fontWeight:600},children:ld(e.value)})]},e.key))]})}return(0,ad.jsxs)("div",{className:"semiotic-tooltip",style:Tc,children:[(0,ad.jsx)("div",{style:{fontWeight:600,marginBottom:2},children:ld(o)}),(0,ad.jsx)("div",{style:{opacity:.7,fontSize:11},children:ld(n)})]})}function ud(e){return"touch"===e?"touch":"pointer"}function dd(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']")}function hd(e){const{onObservation:t,datum:o,x:n=0,y:r=0,chartType:i,chartId:s,context:a,timestamp:l=Date.now()}=e;t&&(o?(t({type:"hover",datum:o,x:n,y:r,timestamp:l,chartType:i,chartId:s}),"focus"===a?.type&&t({type:"focus",datum:o,inputType:"touch"===a.inputType?"pointer":a.inputType,timestamp:l,chartType:i,chartId:s})):t({type:"hover-end",timestamp:l,chartType:i,chartId:s}))}function fd(e){const{onObservation:t,datum:o,x:n=0,y:r=0,chartType:i,chartId:s,context:a,timestamp:l=Date.now()}=e;t&&(o?(t({type:"click",datum:o,x:n,y:r,timestamp:l,chartType:i,chartId:s}),"activate"===a?.type&&t({type:"activate",datum:o,inputType:a.inputType,timestamp:l,chartType:i,chartId:s})):t({type:"click-end",timestamp:l,chartType:i,chartId:s}))}cd.ownsChrome=!0;var md=require("react");function pd({customHoverBehavior:e,customClickBehavior:t,onObservation:o,chartId:n,chartType:r}){const i=!(!e&&!o),s=!(!t&&!o),a=(0,md.useCallback)((t,i)=>{e?.(t,i),hd({onObservation:o,datum:t?t.data||t:null,x:t?.x,y:t?.y,chartType:r,chartId:n,context:i})},[n,r,e,o]),l=(0,md.useCallback)((e,i)=>{t?.(e,i),fd({onObservation:o,datum:e?e.data||e:null,x:e?.x,y:e?.y,chartType:r,chartId:n,context:i})},[n,r,t,o]);return{customHoverBehavior:i?a:void 0,customClickBehavior:s?l:void 0,hasClickBehavior:s}}var gd=require("react");function yd(e){const t=new Map;for(const o of e){const e=o.group??"_default";let n=t.get(e);n||(n=[],t.set(e,n)),n.push(o)}for(const e of t.values()){e.sort((e,t)=>e.x-t.x||e.y-t.y);for(let t=0;e.length>t;t++)e[t]._groupIndex=t}const o=Array.from(t.keys()).sort((e,o)=>{const n=t.get(e),r=t.get(o);return(n.length>0?n[0].y:0)-(r.length>0?r[0].y:0)}),n=Array.from(t.values()).flat();n.sort((e,t)=>e.x-t.x||e.y-t.y);const r=new Map;for(let e=0;n.length>e;e++){n[e]._flatIndex=e;const t=n[e].datum?.id;null!=t&&r.set(t+"",e)}return{flat:n,groups:o,byGroup:t,idToIdx:r}}function bd(e,t){if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const o=Math.max(0,Math.min(t,e.flat.length-1)),n=e.flat[o];return{flatIndex:o,group:n.group??"_default",indexInGroup:n._groupIndex??0}}function vd(e,t,o){const{group:n,indexInGroup:r}=t,i=o.byGroup.get(n);switch(e){case"ArrowRight":return i.length-1>r?i[r+1]._flatIndex:t.flatIndex;case"ArrowLeft":return r>0?i[r-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=o.groups.indexOf(n);return o.groups.length-1>e?xd(o,o.groups[e+1],i[r]):t.flatIndex}case"ArrowUp":{const e=o.groups.indexOf(n);return e>0?xd(o,o.groups[e-1],i[r]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*o.flat.length)),o.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*o.flat.length)),0);case"Home":return 0;case"End":return o.flat.length-1;case"Escape":return-1;default:return null}}function xd(e,t,o){const n=e.byGroup.get(t);let r=0,i=Math.abs(n[0].x-o.x);for(let e=1;n.length>e;e++){const t=Math.abs(n[e].x-o.x);i>t&&(i=t,r=e)}return n[r]._flatIndex}function kd(e){const t=[];for(const o of e)switch(o.type){case"point":t.push({x:o.x,y:o.y,datum:o.datum,shape:"circle",group:"_default"});break;case"symbol":if(0>=o.size)break;t.push({x:o.x,y:o.y,datum:o.datum,shape:"circle",group:"_default"});break;case"glyph":{if(0>=o.size||null==o.datum)break;const e=zr(o.glyph,o.size);t.push({x:o.x+e.centerDx,y:o.y+e.centerDy,datum:o.datum,shape:"rect",w:2*e.halfWidth,h:2*e.halfHeight,group:"_default"});break}case"line":{const e=o,n=Array.isArray(e.datum)?e.datum:[],r=e.group??"_default";for(let o=0;e.path.length>o&&n.length>o;o++)t.push({x:e.path[o][0],y:e.path[o][1],datum:n[o],shape:"circle",group:r});break}case"area":{const e=o,n=Array.isArray(e.datum)?e.datum:[],r=e.group??"_default";for(let o=0;e.topPath.length>o&&n.length>o;o++)t.push({x:e.topPath[o][0],y:e.topPath[o][1],datum:n[o],shape:"circle",group:r});break}case"rect":t.push({x:o.x+o.w/2,y:o.y+o.h/2,datum:o.datum,shape:"rect",w:o.w,h:o.h,group:o.group??"_default"});break;case"heatcell":t.push({x:o.x+o.w/2,y:o.y+o.h/2,datum:o.datum,shape:"rect",w:o.w,h:o.h,group:"_default"})}return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}function wd(e){const t=[];for(const o of e)if("rect"===o.type&&null!=o.x){if(null==o.datum)continue;t.push({x:o.x+o.w/2,y:o.y+o.h/2,datum:o.datum,shape:"rect",w:o.w,h:o.h,group:o.group??o.datum?.category??""})}else if("point"===o.type)t.push({x:o.x,y:o.y,datum:o.datum,shape:"circle",group:"_default"});else if("symbol"===o.type){if(0>=o.size)continue;t.push({x:o.x,y:o.y,datum:o.datum,shape:"circle",group:"_default"})}else if("glyph"===o.type){if(0>=o.size||null==o.datum)continue;const e=zr(o.glyph,o.size);t.push({x:o.x+e.centerDx,y:o.y+e.centerDy,datum:o.datum,shape:"rect",w:2*e.halfWidth,h:2*e.halfHeight,group:"_default"})}else if("wedge"===o.type&&null!=o.cx){if(null===o.datum)continue;const e=((o.startAngle||0)+(o.endAngle||0))/2,n=((o.innerRadius||0)+(o.outerRadius||50))/2;t.push({x:o.cx+Math.cos(e)*n,y:o.cy+Math.sin(e)*n,datum:o.datum,shape:"wedge",group:"_default"})}return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}function Sd(e){return"object"==typeof e&&null!==e&&"id"in e?e.id:e}function Ad(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}function Cd({storeRef:e,hoverRef:t,hoveredNodeRef:o,setHoverPoint:n,customHoverBehavior:r,customClickBehavior:i,scheduleRender:s,extractPoints:a,toHover:l}){const c=(0,gd.useRef)(-1),u=(0,gd.useRef)(null),d=(0,gd.useRef)(null),h=(0,gd.useCallback)(h=>{if(dd(h))return;const f=e.current;if(!f)return;const m=()=>{c.current=-1,u.current=null,t.current=null,o&&(o.current=null),n(null),r?.(null),s()};if(0===f.scene.length)return void(0>c.current||m());let p;if(d.current?.version===f.version)p=d.current.graph;else{const e=a(f.scene);if(0===e.length)return void(0>c.current||m());p=yd(e),d.current={version:f.version,graph:p}}let g=c.current;if(p.flat.length>g||(m(),g=-1),("Enter"===h.key||" "===h.key)&&g>=0)return h.preventDefault(),void i?.(l(p.flat[g],f),{type:"activate",inputType:"keyboard"});if(0>g){if("Escape"===h.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(h.key))return;h.preventDefault(),c.current=0;const e=p.flat[0];u.current=e;const o=l(e,f);return t.current=o,n(o),r?.(o,{type:"focus",inputType:"keyboard"}),void s()}const y=vd(h.key,bd(p,g),p);if(null===y)return;if(h.preventDefault(),0>y)return void m();c.current=y;const b=p.flat[y];u.current=b;const v=l(b,f);t.current=v,n(v),r?.(v,{type:"focus",inputType:"keyboard"}),s()},[i,r,a,t,o,s,n,e,l]);return{kbFocusIndexRef:c,focusedNavPointRef:u,onKeyDown:h}}var Md=require("react/jsx-runtime"),_d={top:20,right:20,bottom:30,left:40},Pd=Ol;function Rd(e){if(e)return"x"===e.dimension?"pan-y":"y"===e.dimension?"pan-x":"none"}var jd=(0,ut.memo)((0,ut.forwardRef)(function(e,t){const{chartType:o,runtimeMode:n,data:r,chunkThreshold:i,chunkSize:s,xAccessor:a,yAccessor:l,accessorRevision:c,colorAccessor:u,sizeAccessor:d,symbolAccessor:h,symbolMap:f,groupAccessor:m,lineDataAccessor:p,curve:g,normalize:y,baseline:b,stackOrder:v,binSize:x,valueAccessor:k,arrowOfTime:w="right",windowMode:S="sliding",windowSize:A=200,timeAccessor:C,xExtent:M,yExtent:_,extentPadding:P=.1,scalePadding:R,sizeRange:j,size:L=[500,300],responsiveWidth:T,responsiveHeight:I,margin:$,className:N,background:D,maxDevicePixelRatio:E,renderMode:O,lineStyle:B,pointStyle:F,areaStyle:z,barStyle:H,waterfallStyle:W,swarmStyle:q,barColors:Y,colorScheme:G,boundsAccessor:V,boundsStyle:X,y0Accessor:U,band:K,gradientFill:Q,lineGradient:Z,semanticLineStops:J,areaGroups:ee,openAccessor:te,highAccessor:oe,lowAccessor:ne,closeAccessor:re,candlestickStyle:ie,showAxes:se=!0,axes:ae,xLabel:le,yLabel:ce,yLabelRight:ue,xFormat:de,yFormat:he,axisExtent:fe,tickFormatTime:me,tickFormatValue:pe,hoverAnnotation:ge,tooltipContent:ye,customHoverBehavior:be,customClickBehavior:ve,onObservation:xe,annotationObservationCallback:ke,chartId:we,enableHover:Se,hoverRadius:Ae=30,tooltipMode:Ce,annotations:Me,onAnnotationActivate:_e,autoPlaceAnnotations:Pe,svgAnnotationRules:Re,showGrid:je,legend:Le,legendHoverBehavior:Te,legendClickBehavior:Ie,legendHighlightedCategory:$e,legendIsolatedCategories:Ne,legendPosition:De,legendLayout:Ee,legendCategoryAccessor:Oe,onCategoriesChange:Be,backgroundGraphics:Fe,foregroundGraphics:ze,canvasPreRenderers:He,svgPreRenderers:We,title:qe,categoryAccessor:Ye,brush:Ge,onBrush:Ve,decay:Xe,pulse:Ue,transition:Ke,animate:Qe,staleness:Ze,frameScheduler:Je,clock:et,random:tt,seed:ot,paused:nt=!1,suspendWhenHidden:rt=!0,heatmapAggregation:it,heatmapXBins:st,heatmapYBins:at,showValues:lt,heatmapValueFormat:dt,marginalGraphics:ht,pointIdAccessor:ft,xScaleType:mt,yScaleType:gt,accessibleTable:vt=!0,description:xt,summary:kt,linkedCrosshairName:wt,linkedCrosshairSourceId:St,customLayout:Ct,onLayoutError:Mt,layoutConfig:_t,layoutSelection:Pt}=e,{customHoverBehavior:Rt,customClickBehavior:jt,hasClickBehavior:Lt}=pd({customHoverBehavior:be,customClickBehavior:ve,onObservation:xe,chartId:we,chartType:"StreamXYFrame"}),Tt=(0,ut.useId)().replace(/:/g,""),It=(0,ut.useRef)(!1),$t=(0,ut.useRef)({w:-1,h:-1}),Nt=(0,ut.useRef)(!1),Dt=nu({sizeProp:L,responsiveWidth:T,responsiveHeight:I,userMargin:$,marginDefault:_d,title:qe,legend:Le,legendPosition:De,animate:Qe,transitionProp:Ke,frameScheduler:Je,clock:et,random:tt,seed:ot,paused:nt,suspendWhenHidden:rt,themeDirtyRef:It}),Et=Ml(),Ot=jl(),{reducedMotionRef:Bt,responsiveRef:Ft,size:zt,currentTheme:Ht,transition:Wt,introEnabled:qt,tableId:Yt,rafRef:Gt,renderFnRef:Vt,scheduleRender:Xt,frameRuntime:Ut}=Dt;let Kt=Dt.margin;if(ht){const e=60,t={...Dt.margin};ht.top&&e>t.top&&(t.top=e),ht.bottom&&e>t.bottom&&(t.bottom=e),ht.left&&e>t.left&&(t.left=e),ht.right&&e>t.right&&(t.right=e),Kt=t}const Qt=zt[0]-Kt.left-Kt.right,Zt=zt[1]-Kt.top-Kt.bottom,Jt=(ae?.find(e=>"left"===e.orient)??ae?.find(e=>"right"===e.orient))?.extent??fe,eo=(0,ut.useMemo)(()=>yt(r),[r]),to=ge??Se,[oo,no]=(0,ut.useState)(0),ro=(0,ut.useRef)(0),[io,so]=(0,ut.useState)(null),ao=hu(ze,zt,Kt,io),lo=hu(Fe,zt,Kt,io),co=(0,ut.useRef)(null),uo=(0,ut.useRef)(null),ho=(0,ut.useRef)(void 0),[fo,mo]=(0,ut.useState)(null),po=(0,ut.useRef)(Pd.primary),go=(0,ut.useRef)(function(){let e=-1,t=Ol;return{resolve(o){if(!o)return Ol;const n=Yr;return n===e||(t=function(e){if(!e)return Ol;const t=getComputedStyle(e),o=t.getPropertyValue("--semiotic-border").trim(),n=t.getPropertyValue("--semiotic-text-secondary").trim(),r=t.getPropertyValue("--semiotic-bg").trim(),i=t.getPropertyValue("--semiotic-primary").trim(),s=n||t.getPropertyValue("--text-secondary").trim(),a=t.getPropertyValue("--text-primary").trim(),l=o||t.getPropertyValue("--surface-3").trim(),c=r||t.getPropertyValue("--surface-0").trim();return s||a||o||i?{axisStroke:l||Ol.axisStroke,tickText:s||Ol.tickText,crosshair:s?Bl(s,"66"):Ol.crosshair,hoverFill:c?Bl(c,"4D"):Ol.hoverFill,hoverStroke:s?Bl(s,"99"):Ol.hoverStroke,pointRing:c||Ol.pointRing,primary:i||Ol.primary,background:c||Ol.background}:Ol}(o),e=n),t},invalidate(){e=-1}}}()),yo=(0,ut.useRef)(!1),bo=pr("StreamXYFrame"),[vo,xo]=(0,ut.useState)(!1),[ko,wo]=(0,ut.useState)([]),[So,Ao]=(0,ut.useState)([]),Co="streaming"===n||["bar","swarm","waterfall"].includes(o),Mo=Tl((0,ut.useMemo)(()=>({chartType:o,runtimeMode:Co?"streaming":"bounded",windowSize:A,windowMode:S,arrowOfTime:Co?w:"right",extentPadding:P,scalePadding:R,axisExtent:fe,yAxisExtent:Jt,xAccessor:a,yAccessor:l,accessorRevision:c,timeAccessor:Co?C:void 0,valueAccessor:k,colorAccessor:u,sizeAccessor:d,symbolAccessor:h,symbolMap:f,groupAccessor:m||(p?"_lineGroup":void 0),categoryAccessor:Ye,lineDataAccessor:p,xScaleType:mt,yScaleType:gt,xExtent:M,yExtent:_,sizeRange:j,binSize:x,normalize:y,baseline:b,stackOrder:v,boundsAccessor:V,boundsStyle:X,y0Accessor:U,band:K,gradientFill:ln(Q),areaGroups:ee?new Set(ee):void 0,lineGradient:cn(Z),semanticLineStops:J,openAccessor:te,highAccessor:oe,lowAccessor:ne,closeAccessor:re,candlestickStyle:ie,lineStyle:B,pointStyle:F,areaStyle:z,swarmStyle:q,waterfallStyle:W,colorScheme:G,barColors:Y,barStyle:H,annotations:Me,decay:Xe,pulse:Ue,transition:Wt,introAnimation:qt,staleness:Ze,clock:Ut.now,heatmapAggregation:it,heatmapXBins:st,heatmapYBins:at,showValues:lt,heatmapValueFormat:dt,pointIdAccessor:ft,curve:g,themeCategorical:Ht?.colors?.categorical,themeSemantic:At(Ht),themeSequential:Ht?.colors?.sequential,themeDiverging:Ht?.colors?.diverging,customLayout:Ct,onLayoutError:Mt,layoutConfig:_t,layoutMargin:Kt}),[o,Co,A,S,w,P,R,fe,Jt,a,l,c,C,k,u,d,h,f,m,p,Ye,mt,gt,M,_,j,x,y,b,v,V,X,U,K,Q,ee,Z,J,te,oe,ne,re,ie,B,F,z,q,W,G,Y,H,Me,Xe,Ue,Wt,qt,Ze,Ut.now,it,st,at,lt,dt,ft,g,Ht,Ct,Mt,_t,Kt])),_o=(0,ut.useRef)(null);_o.current||(_o.current=new ar(Mo));const Po=mu(_o,Oe,Be,e=>e.getData());_r(_o,Mo,It,Xt),Pr(_o,Pt,It,Xt);const Ro=(0,ut.useRef)(null);Ro.current||(Ro.current=new bt(e=>{const t=_o.current;t&&t.ingest(e)&&(It.current=!0,Xt())},{chunkThreshold:i,chunkSize:s})),(0,ut.useEffect)(()=>{Ro.current?.updateChunkOptions({chunkThreshold:i,chunkSize:s})},[i,s]);const jo=(0,ut.useCallback)(e=>{Ro.current?.push(e)},[]),Lo=(0,ut.useCallback)(e=>{Ro.current?.pushMany(e)},[]),To=(0,ut.useCallback)(()=>{Ro.current?.clear(),_o.current?.clear(),It.current=!0,Xt()},[Xt]);(0,ut.useImperativeHandle)(t,()=>({push:jo,pushMany:Lo,remove:e=>{Ro.current?.flush();const t=_o.current?.remove(e)??[];return t.length>0&&(co.current&&t.some(e=>e===co.current?.data)&&(co.current=null,mo(null)),It.current=!0,Xt()),t},update:(e,t)=>{Ro.current?.flush();const o=_o.current?.update(e,t)??[];return o.length>0&&(It.current=!0,Xt()),o},clear:To,getData:()=>(Ro.current?.flush(),_o.current?.getData()??[]),getScales:()=>_o.current?.scales??null,getExtents:()=>_o.current?.getExtents()??null,getCustomLayout:()=>_o.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>_o.current?.lastCustomLayoutFailure??null}),[jo,Lo,To,Xt]),(0,ut.useEffect)(()=>{if(r){if(p&&eo.length>0&&"object"==typeof eo[0]&&null!==eo[0]){const e="string"==typeof p?p:"coordinates";if(Array.isArray(eo[0][e])){const t=[];for(const o of eo){const n=o[e];if(Array.isArray(n)){const e=o.label||o.id||o.key;if(null!=e)for(const o of n)t.push({...o,_lineGroup:e});else for(const e of n)t.push(e)}}return void Ro.current?.setBoundedData(t)}}Ro.current?.setBoundedData(eo)}},[r,eo,p]);const{canvasRef:Io,interactionCanvasRef:$o,resolutionDirtyRef:No}=cu(Dt,{storeRef:_o,dirtyRef:It,hydrated:Et,wasHydratingFromSSR:Ot,cleanup:()=>Ro.current?.clear(),maxDevicePixelRatio:E,canvasPaintDependencies:[o,Qt,Zt,se,D,Fe,B,O,He,Xt]}),{hoverHandlerRef:Do,hoverLeaveRef:Eo,onPointerMove:Oo,onPointerLeave:Bo}=Dt;Do.current=e=>{if(!to)return;const t=Io.current;if(!t)return;const n=t.getBoundingClientRect(),r=e.clientX-n.left-Kt.left,i=e.clientY-n.top-Kt.top;if(0>r||r>Qt||0>i||i>Zt)return void(co.current&&(co.current=null,uo.current=null,mo(null),Rt?.(null),Xt()));const s=_o.current;if(!s||0===s.scene.length)return;const l=wc(Ae,e.pointerType),c=bi(s.scene,r,i,l,s.quadtree,s.maxPointRadius),u="multi"===Ce,d=()=>{co.current&&(co.current=null,uo.current=null,mo(null),Rt&&Rt(null),Xt())};if(!c&&!u)return void d();const h=u||!c?r:c.x,f=u||!c?i:c.y,m=c?.datum?nn(c.datum,s.resolvedRibbons):{},p=s.scales?.x?.invert,g="function"==typeof p?p(h):void 0;let y=Ac(m,h,f,null!=g?{xValue:g,xPx:h}:void 0);if(u&&s.scene.length>0&&s.scales){const e=function(e,t,o=30){const n=[];for(const r of e)if("line"===r.type){const e=r;if(2>e.path.length)continue;const i=vi(yi(e.path,e.curve),t,o);if(null===i)continue;const s=Ri(e.path,t);n.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=yi(e.topPath,e.curve),s=yi(e.bottomPath,e.curve),a=vi(i,t,o);if(null===a)continue;const l=vi(s,t,o),c=Ri(e.topPath,t);n.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 n}(s.scene,h,Math.max(l,Qt));if(e.length>0){const t=s.scales.y.invert,n=po.current,r=p?p(h):h;if(c)y.xValue=r,y.xPx=h;else{const e={xValue:r};"string"==typeof a&&(e[a]=r),y=Ac(e,h,f,{xValue:r,xPx:h})}y.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"===o&&null!=i?r-i:r,valuePx:e.y,color:e.color||n,datum:nn(e.datum,s.resolvedRibbons)}})}}c||y.allSeries?.length?(co.current=y,uo.current=c?.node??null,mo(y),Rt?.(y),Xt()):d()},Eo.current=()=>{co.current&&(co.current=null,uo.current=null,mo(null),Rt?.(null),Xt())};const Fo=(0,ut.useRef)(()=>{});Fo.current=e=>{if(Js(e.target))return;if(!jt)return;const t=Io.current;if(!t)return;const o=t.getBoundingClientRect(),n=e.clientX-o.left-Kt.left,r=e.clientY-o.top-Kt.top;if(0>n||n>Qt||0>r||r>Zt)return void jt(null);const i=_o.current;if(!i||0===i.scene.length)return void jt(null);const s=wc(Ae,ho.current),a=bi(i.scene,n,r,s,i.quadtree,i.maxPointRadius);if(!a)return void jt(null);const l=a.datum||{},c=i.scales?.x?.invert,u="function"==typeof c?c(a.x):void 0;jt(Ac(l,a.x,a.y,null!=u?{xValue:u,xPx:a.x}:void 0),{type:"activate",inputType:ud(ho.current)})};const zo=(0,ut.useCallback)(e=>Fo.current(e),[]),{kbFocusIndexRef:Ho,focusedNavPointRef:Wo,onKeyDown:qo}=(Yo={storeRef:_o,hoverRef:co,hoveredNodeRef:uo,setHoverPoint:mo,customHoverBehavior:Rt,customClickBehavior:jt,scheduleRender:Xt},Cd({...Yo,extractPoints:kd,toHover:(e,t)=>Ad({...e,datum:nn(e.datum,t.resolvedRibbons)})}));var Yo;const Go=(0,ut.useCallback)(e=>{ho.current=e.pointerType,Ho.current=-1,Wo.current=null,Oo(e)},[Wo,Ho,Oo]),Vo=(0,ut.useCallback)(e=>{ho.current="mouse",Ho.current=-1,Wo.current=null,Oo({clientX:e.clientX,clientY:e.clientY,pointerType:"mouse"})},[Wo,Ho,Oo]),Xo=(0,ut.useCallback)(e=>{ho.current=e.pointerType},[]);Vt.current=()=>{if(Gt.current=null,!Ut.isActive)return;const e=Io.current,t=$o.current;if(!e||!t)return;const n=_o.current;if(!n)return;const r=Ut.now(),i=n.advanceTransition(Bt.current?r+1e6:r),s=!Bt.current&&i,c=$t.current.w!==Qt||$t.current.h!==Zt,u=No.current,d=It.current||i||c,h=n.consumeStylePaintPending();let f=!1;const m=n.getLastUpdateResult(),p=bo.current.beforeCompute(m,s);!d||s&&!c||(n.computeScene({width:Qt,height:Zt}),$t.current={w:Qt,h:Zt},f=!0,Po()),bo.current.afterCompute(p,f,c);const g=du(n,r,f,Nt),y=su(E),b=go.current.resolve(e);po.current=b.primary;const v=Ii(Ze,n.lastIngestTime>0?r-n.lastIngestTime:0),x=Ze&&v.isStale;if(d||h||g.changed||u){const t=iu(e,zt,Kt,y);if(t){if(t.clearRect(-Kt.left,-Kt.top,zt[0],zt[1]),Ze&&1>v.alpha&&(t.globalAlpha=v.alpha),El(t,{background:D,hasBackgroundGraphics:!!Fe,themeBackground:b.background,x:-Kt.left,y:-Kt.top,width:zt[0],height:zt[1]}),t.save(),"function"==typeof t.rect&&(t.beginPath(),t.rect(0,0,Qt,Zt),t.clip()),He&&n.scales)for(const e of He)t.save(),e(t,n.scene,n.scales,{width:Qt,height:Zt}),t.restore();const e=Ct?Vu.custom:Vu[o];Qu({context:t,nodes:n.scene,renderMode:O,pixelRatio:y,paintBuiltIn:o=>{if(e&&n.scales)for(const r of e)r(t,o,n.scales,{width:Qt,height:Zt})}}),t.restore(),Ze&&1>v.alpha&&(t.globalAlpha=1)}}const k=!!(to&&co.current&&n.scales),w=!!(uo.current&&Array.isArray(ge)&&ge.some(e=>e&&"object"==typeof e&&"highlight"===e.type)),S=k||w;if(S||yo.current){const e=iu(t,zt,Kt,y);if(e&&(e.clearRect(-Kt.left,-Kt.top,zt[0],zt[1]),k&&co.current&&function(e,t,o,n,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,n),e.stroke(),l||(e.beginPath(),e.moveTo(0,t.y),e.lineTo(o,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 o=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 o="string"==typeof t.fill?t.fill:null;return"line"===e.type||"area"===e.type?t.stroke||o||null:o||t.stroke||null}(i)||s.primary;e.beginPath(),e.arc(t.x,t.y,4,0,2*Math.PI),e.fillStyle=o,e.fill(),e.strokeStyle=s.pointRing,e.lineWidth=2,e.stroke()}}(e,co.current,Qt,Zt,"object"==typeof to?to:{},uo.current,b),w&&uo.current&&Array.isArray(ge))){const t=ge.find(e=>e&&"object"==typeof e&&"highlight"===e.type);t&&function(e,t,o,n,r){if(!o)return;const i="group"in o?o.group:void 0;if(void 0!==i)for(const o of t){if("line"!==o.type)continue;if(o.group!==i)continue;if(2>o.path.length)continue;const t="function"==typeof n.style?o.datum?n.style(o.datum):{}:n.style||{};e.save(),e.beginPath(),e.moveTo(o.path[0][0],o.path[0][1]);for(let t=1;o.path.length>t;t++)e.lineTo(o.path[t][0],o.path[t][1]);e.strokeStyle=t.stroke||o.style.stroke||r.primary,e.lineWidth=t.strokeWidth||(o.style.strokeWidth||2)+2,e.globalAlpha=t.opacity??1,e.stroke(),e.restore()}}(e,n.scene,uo.current,t,b)}yo.current=S}d&&e&&e.setAttribute("aria-label",Jl(n.scene,o+" chart"));const A=It.current;if(It.current=A&&s&&!f,No.current=!1,A&&n.scales){const e=e=>"object"==typeof e&&null!==e&&"function"==typeof e.valueOf?e.valueOf():e;if((!io||e(io.x.domain()[0])!==e(n.scales.x.domain()[0])||e(io.x.domain()[1])!==e(n.scales.x.domain()[1])||e(io.y.domain()[0])!==e(n.scales.y.domain()[0])||e(io.y.domain()[1])!==e(n.scales.y.domain()[1])||io.x.range()[0]!==n.scales.x.range()[0]||io.x.range()[1]!==n.scales.x.range()[1]||io.y.range()[0]!==n.scales.y.range()[0]||io.y.range()[1]!==n.scales.y.range()[1])&&so(n.scales),ht){const e=n.getData(),t="function"==typeof a?a:e=>e[a||"x"],o="function"==typeof l?l:e=>e[l||"y"];wo(e.map(e=>t(e)).filter(e=>"number"==typeof e&&isFinite(e))),Ao(e.map(e=>o(e)).filter(e=>"number"==typeof e&&isFinite(e)))}}!((Me&&Me.length>0||Ct)&&(f||s))||!f&&33>r-ro.current||(no(e=>e+1),ro.current=r),Ze?.showBadge&&xo(!!x),(s||null!=n.activeTransition||g.pending)&&Xt()},$i(Ze,_o,It,Xt,vo,xo);const Uo=(0,ut.useMemo)(()=>{if(de||me)return;const e=_o.current;return e?.xIsDate&&io?vu(io.x.domain()):void 0},[de,me,io]),Ko=de||me||Uo,Qo=to&&fo?ye?ye(fo):(0,Md.jsx)(cd,{hover:fo}):null,Zo=Qo?(0,Md.jsx)(Wc,{x:fo.x,y:fo.y,containerWidth:Qt,containerHeight:Zt,margin:Kt,className:"stream-frame-tooltip",children:Qo}):null,Jo=Wo.current,en=(0,Md.jsx)(xc,{active:Ho.current>=0,hoverPoint:fo,margin:Kt,size:zt,shape:Jo?.shape,width:Jo?.w,height:Jo?.h}),tn=pu(a,C,"__semiotic_resolvedX","__semiotic_resolvedTime"),on=pu(l,k,"__semiotic_resolvedY","__semiotic_resolvedValue"),rn=tn.key,sn=on.key,an=gu(tn,on,Me&&Me.length>0||!1);if(Sl||!Et&&Ot){const e=_o.current;e&&r&&(e.ingest({inserts:eo,bounded:!0}),e.computeScene({width:Qt,height:Zt}));const t=e?.scene??[],o=e?.scales??null,n=hu(ze,zt,Kt,o),i=hu(Fe,zt,Kt,o),s=Ko||(()=>{if(e?.xIsDate&&o)return vu(o.x.domain())})();return(0,Md.jsxs)("div",{ref:Ft,className:"stream-xy-frame"+(N?" "+N:""),role:"img","aria-label":xt||("string"==typeof qe?qe:"XY chart"),style:{position:"relative",width:T?"100%":zt[0],height:I?"100%":zt[1]},children:[(0,Md.jsx)(gc,{summary:kt}),(0,Md.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:zt[0],height:zt[1],style:{position:"absolute",left:0,top:0},children:[(0,Md.jsx)("g",{transform:`translate(${Kt.left},${Kt.top})`,children:i}),(0,Md.jsxs)("g",{transform:`translate(${Kt.left},${Kt.top})`,children:[D&&(0,Md.jsx)("rect",{x:0,y:0,width:Qt,height:Zt,fill:D}),We&&o&&We.map((e,n)=>(0,Md.jsx)(ct.Fragment,{children:e(t,o,{width:Qt,height:Zt})},"svgpre-"+n)),t.map((e,t)=>Zu({node:e,index:t,renderMode:O,fallback:()=>function(e,t,o){switch(e.type){case"line":{const n=e;if(0===n.path.length)return null;const r=li(n.curve),i=r?(0,Za.line)().x(([e])=>e).y(([,e])=>e).curve(r)(n.path)??"":"M"+n.path.map(([e,t])=>`${e},${t}`).join("L"),s=sl(`${o?o+"-":""}line-${t}-stroke-gradient`),a=wl(n.strokeGradient,n.path,s,n.style.stroke||"#4e79a7");return(0,kl.jsxs)(Qa.Fragment,{children:[a&&(0,kl.jsx)("defs",{children:a}),(0,kl.jsx)("path",{d:i,fill:"none",stroke:a?`url(#${s})`:n.style.stroke||"#4e79a7",strokeWidth:n.style.strokeWidth||2,strokeDasharray:n.style.strokeDasharray,opacity:n.style.opacity})]},"line-"+t)}case"area":{const n=e;if(0===n.topPath.length)return null;const r=li(n.curve),i=!r||2>n.topPath.length||2>n.bottomPath.length?`M${n.topPath.map(([e,t])=>`${e},${t}`).join("L")}L${[...n.bottomPath].reverse().map(([e,t])=>`${e},${t}`).join("L")}Z`:(0,Za.area)().x(([e])=>e).y0((e,t)=>n.bottomPath[t][1]).y1(([,e])=>e).curve(r)(n.topPath)??"",s=`${o?o+"-":""}area-${t}-hatch`,a=ti(n.style.fill)?ii(n.style.fill,s):void 0,l=sl(`${o?o+"-":""}area-${t}-gradient`),c=function(e,t){const o=e.fillGradient;if(!o||"object"!=typeof o)return null;let n=1/0;for(const[,t]of e.topPath)n=Math.min(n,t);let r=-1/0;for(const[,t]of e.bottomPath)r=Math.max(r,t);if(!Number.isFinite(n)||!Number.isFinite(r))return null;const i=ll(o.stops,il(e.style.fill));return i?(0,kl.jsx)("linearGradient",{id:t,gradientUnits:"userSpaceOnUse",x1:0,y1:n,x2:0,y2:r,children:i}):null}(n,l),u=c?`url(#${l})`:a?`url(#${s})`:il(n.style.fill),d=c?void 0:n.style.fillOpacity??n.style.opacity??.7,h=r?(0,Za.line)().x(([e])=>e).y(([,e])=>e).curve(r)(n.topPath)??"":"M"+n.topPath.map(([e,t])=>`${e},${t}`).join("L"),f=sl(`${o?o+"-":""}area-${t}-stroke-gradient`),m=!(!n.colorThresholds?.length||!n.rawValues||n.rawValues.length!==n.topPath.length),p=!!n.strokeColorBands?.length,g=m||p?null:wl(n.strokeGradient,n.topPath,f,n.style.stroke||"#4e79a7"),y=n.style.strokeWidth||2;let b=1/0,v=-1/0;for(const[e]of n.topPath)b>e&&(b=e),e>v&&(v=e);const x=p?n.strokeColorBands.map((e,n)=>sl(`${o?o+"-":""}area-${t}-stroke-band-${n}`)):[],k=p?n.strokeColorBands.map((e,t)=>(0,kl.jsx)("clipPath",{id:x[t],children:(0,kl.jsx)("rect",{x:b-y,y:e.y,width:v-b+2*y,height:e.height})},x[t])):null,w=n.style.stroke&&"none"!==n.style.stroke?p?n.strokeColorBands.map((e,o)=>(0,kl.jsx)("path",{d:h,fill:"none",stroke:e.color??il(n.style.stroke),strokeWidth:y,opacity:n.style.opacity,clipPath:`url(#${x[o]})`},`area-${t}-stroke-band-${o}`)):m?el(n.topPath,n.rawValues,n.colorThresholds,il(n.style.stroke)).map((e,o)=>(0,kl.jsx)("path",{d:"M"+e.path.map(([e,t])=>`${e},${t}`).join("L"),fill:"none",stroke:e.color,strokeWidth:y,opacity:n.style.opacity},`area-${t}-threshold-${o}`)):(0,kl.jsx)("path",{d:h,fill:"none",stroke:g?`url(#${f})`:il(n.style.stroke),strokeWidth:y,opacity:n.style.opacity}):null;if(n.clipRect){const e=`${o?o+"-":""}area-clip-${t}`;return(0,kl.jsxs)("g",{children:[(0,kl.jsxs)("defs",{children:[c,!c&&a,g,k,(0,kl.jsx)("clipPath",{id:e,children:(0,kl.jsx)("rect",{x:n.clipRect.x,y:n.clipRect.y,width:n.clipRect.width,height:n.clipRect.height})})]}),(0,kl.jsxs)("g",{clipPath:`url(#${e})`,children:[(0,kl.jsx)("path",{d:i,fill:u,fillOpacity:d,opacity:c?n.style.opacity:void 0,stroke:"none"}),w]})]},"area-"+t)}return(0,kl.jsxs)(Qa.Fragment,{children:[(c||a||g||k)&&(0,kl.jsxs)("defs",{children:[c,!c&&a,g,k]}),(0,kl.jsx)("path",{d:i,fill:u,fillOpacity:d,opacity:c?n.style.opacity:void 0,stroke:"none"}),w]},"area-"+t)}case"point":{const n=e,r=`${o?o+"-":""}point-${t}-hatch`,i=ti(n.style.fill)?ii(n.style.fill,r):void 0;return(0,kl.jsxs)(Qa.Fragment,{children:[i&&(0,kl.jsx)("defs",{children:i}),(0,kl.jsx)("circle",{cx:n.x,cy:n.y,r:n.r,fill:i?`url(#${r})`:il(n.style.fill),opacity:n.style.opacity??n.style.fillOpacity??.8,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})]},"point-"+t)}case"symbol":return cl(e,t);case"glyph":return al(e,e.x,e.y,`${o??""}glyph-${e.pointId??t}`);case"rect":{const n=e,r=`${o?o+"-":""}xyrect-${t}-hatch`,i=ti(n.style.fill)?ii(n.style.fill,r):void 0;return(0,kl.jsxs)(Qa.Fragment,{children:[i&&(0,kl.jsx)("defs",{children:i}),(0,kl.jsx)("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:i?`url(#${r})`:il(n.style.fill),opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})]},"rect-"+t)}case"heatcell":{const o=e,n={x:o.x,y:o.y,width:o.w,height:o.h,fill:o.fill,stroke:o.style?.stroke,strokeWidth:o.style?.strokeWidth,...null!=o.style?.opacity&&{opacity:o.style.opacity}};if(o.showValues&&null!=o.value&&o.w>=20&&o.h>=20){const e=o.valueFormat?o.valueFormat(o.value):Number.isInteger(o.value)?o.value+"":100>Math.abs(o.value)?1>Math.abs(o.value)?o.value.toPrecision(3):o.value.toFixed(1):o.value.toFixed(0),[r,i,s]=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]}(o.fill),a=.299*r+.587*i+.114*s>128?"#000":"#fff",l=Math.max(10,Math.min(16,.3*Math.min(o.w,o.h)));return(0,kl.jsxs)("g",{children:[(0,kl.jsx)("rect",{...n}),(0,kl.jsx)("text",{x:o.x+o.w/2,y:o.y+o.h/2,textAnchor:"middle",dominantBaseline:"middle",fill:a,fontSize:l+"px",children:e})]},"heatcell-"+t)}return(0,kl.jsx)("rect",{...n},"heatcell-"+t)}case"candlestick":{const o=e;if(o.isRange){const e=o.dotRadius??Math.max(2,o.bodyWidth/2);return(0,kl.jsxs)("g",{children:[(0,kl.jsx)("line",{x1:o.x,y1:o.highY,x2:o.x,y2:o.lowY,stroke:o.wickColor,strokeWidth:o.wickWidth}),(0,kl.jsx)("circle",{cx:o.x,cy:o.highY,r:e,fill:o.wickColor}),(0,kl.jsx)("circle",{cx:o.x,cy:o.lowY,r:e,fill:o.wickColor})]},"candle-"+t)}const n=Math.min(o.openY,o.closeY),r=Math.max(Math.abs(o.openY-o.closeY),1),i=o.isUp?o.upColor:o.downColor;return(0,kl.jsxs)("g",{children:[(0,kl.jsx)("line",{x1:o.x,y1:o.highY,x2:o.x,y2:o.lowY,stroke:o.wickColor,strokeWidth:o.wickWidth}),(0,kl.jsx)("rect",{x:o.x-o.bodyWidth/2,y:n,width:o.bodyWidth,height:r,fill:i,stroke:i,strokeWidth:1})]},"candle-"+t)}default:return null}}(e,t,Tt)})).filter(Boolean)]})]}),(0,Md.jsx)(Ka,{width:Qt,height:Zt,totalWidth:zt[0],totalHeight:zt[1],margin:Kt,scales:o,showAxes:se,axes:ae,xLabel:le,yLabel:ce,yLabelRight:ue,xFormat:s,yFormat:he||pe,axisExtent:fe,showGrid:je,title:qe,legend:Le,legendHoverBehavior:Te,legendClickBehavior:Ie,legendHighlightedCategory:$e,legendIsolatedCategories:Ne,legendPosition:De,legendLayout:Ee,foregroundGraphics:br(n,Cr(_o.current?.customLayoutOverlays,Pt??null)),marginalGraphics:ht,xValues:[],yValues:[],annotations:Me,onAnnotationActivate:_e,onObservation:ke??xe,chartId:we,chartType:"StreamXYFrame",autoPlaceAnnotations:Pe,svgAnnotationRules:Re,annotationFrame:0,xAccessor:rn,yAccessor:sn,annotationData:an(_o.current?.getData()),pointNodes:xu(_o.current?.scene),curve:"string"==typeof g?g:void 0,linkedCrosshairName:wt,linkedCrosshairSourceId:St})]})}return(0,Md.jsxs)("div",{ref:Ft,className:"stream-xy-frame"+(N?" "+N:""),role:"group","aria-label":xt||("string"==typeof qe?qe:"XY chart"),tabIndex:0,style:{position:"relative",width:T?"100%":zt[0],height:I?"100%":zt[1],overflow:"visible",touchAction:Rd(Ge)},onKeyDown:qo,children:["production"!==process.env.NODE_ENV&&_o.current&&(0,Md.jsx)(gr,{store:_o.current,diagnostics:bo.current}),vt&&(0,Md.jsx)(yc,{tableId:Yt}),vt&&(0,Md.jsx)(mc,{scene:_o.current?.scene??[],chartType:o+" chart",tableId:Yt,chartTitle:"string"==typeof qe?qe:void 0}),(0,Md.jsx)(gc,{summary:kt}),(0,Md.jsx)(Xl,{hoverPoint:fo}),(0,Md.jsxs)("div",{role:"img","aria-label":xt||("string"==typeof qe?qe:"XY chart"),style:{position:"relative",width:"100%",height:"100%"},onPointerMove:to?Go:void 0,onMouseMove:to?Vo:void 0,onPointerLeave:to?Bo:void 0,onMouseLeave:to?Bo:void 0,onPointerDown:to||Lt?Xo:void 0,onClick:Lt?zo:void 0,children:[(0,Md.jsx)(uu,{size:zt,margin:Kt,children:lo}),(0,Md.jsx)(Va,{width:Qt,height:Zt,totalWidth:zt[0],totalHeight:zt[1],margin:Kt,scales:io,showAxes:se,axes:ae,showGrid:je,xFormat:Ko,yFormat:he||pe,axisExtent:fe}),(0,Md.jsx)("canvas",{ref:Io,"aria-label":Jl(_o.current?.scene??[],o+" chart"),style:{position:"absolute",left:0,top:0}}),(0,Md.jsx)("canvas",{ref:$o,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),(0,Md.jsx)(Ka,{width:Qt,height:Zt,totalWidth:zt[0],totalHeight:zt[1],margin:Kt,scales:io,showAxes:se,axes:ae,xLabel:le,yLabel:ce,yLabelRight:ue,xFormat:Ko,yFormat:he||pe,axisExtent:fe,showGrid:je,title:qe,legend:Le,legendHoverBehavior:Te,legendClickBehavior:Ie,legendHighlightedCategory:$e,legendIsolatedCategories:Ne,legendPosition:De,legendLayout:Ee,foregroundGraphics:br(ao,Cr(_o.current?.customLayoutOverlays,Pt??null)),marginalGraphics:ht,xValues:ko,yValues:So,annotations:Me,onAnnotationActivate:_e,onObservation:ke??xe,chartId:we,chartType:"StreamXYFrame",autoPlaceAnnotations:Pe,svgAnnotationRules:Re,annotationFrame:oo,xAccessor:rn,yAccessor:sn,annotationData:an(_o.current?.getData()),pointNodes:xu(_o.current?.scene),curve:"string"==typeof g?g:void 0,underlayRendered:!0,canvasObscuresUnderlay:!!Dl({background:D,hasBackgroundGraphics:!!Fe,themeBackground:Ht?.colors.background}),linkedCrosshairName:wt,linkedCrosshairSourceId:St}),(Ge||Ve)&&(0,Md.jsx)(pt,{width:Qt,height:Zt,totalWidth:zt[0],totalHeight:zt[1],margin:Kt,dimension:Ge?.dimension??"xy",scales:io,onBrush:Ve??(()=>{}),binSize:x,snap:Ge?.snap,binBoundaries:Ge?.binBoundaries??("bar"===o?_o.current?.getBinBoundaries():void 0),snapDuring:Ge?.snapDuring,streaming:"streaming"===n}),Ze?.showBadge&&(0,Md.jsx)(Di,{isStale:vo,position:Ze.badgePosition}),en,Zo]})]})}));jd.displayName="StreamXYFrame";var Ld=jd,Td=require("react"),Id=require("d3-scale"),$d=class{constructor(){this.colorSchemeMap=new Map,this.colorSchemeIndex=0}resetColors(){this.colorSchemeMap.clear(),this.colorSchemeIndex=0}resolvePieceStyle(e,t,o){if(t&&"function"==typeof e.pieceStyle){const n=e.pieceStyle(t,o);return n&&!n.fill&&o?{...n,fill:this.getColorFromScheme(e,o)}:n}return e.pieceStyle&&"object"==typeof e.pieceStyle?e.pieceStyle:e.barColors&&o?{fill:e.barColors[o]||"#007bff"}:{fill:o?this.getColorFromScheme(e,o):"#007bff"}}resolveSummaryStyle(e,t,o){return t&&"function"==typeof e.summaryStyle?e.summaryStyle(t,o):e.summaryStyle&&"object"==typeof e.summaryStyle?e.summaryStyle:{fill:"#007bff",fillOpacity:.6,stroke:"#007bff",strokeWidth:1}}getColorFromScheme(e,t){const o=this.colorSchemeMap.get(t);if(o)return o;const n=Array.isArray(e.colorScheme)?e.colorScheme:e.themeCategorical||vo,r=n[this.colorSchemeIndex%n.length];return this.colorSchemeIndex++,this.colorSchemeMap.set(t,r),r}};function Nd(e){const t=e.getSymbol;return t?gn(t,e.config.symbolMap):null}function Dd(e,t,o,n,r,i,s){e.push(t?{type:"symbol",x:n,y:r,size:Math.PI*i*i,symbolType:t(o),style:s,datum:o}:{type:"point",x:n,y:r,r:i,style:s,datum:o})}function Ed(e,t){const{columns:o,config:n,resolvePieceStyle:r}=e,i=[],s=Math.min(t.width,t.height)/2-4,a="donut"===n.chartType?n.innerRadius||60:0,l=-Math.PI/2+(n.startAngle||0)*Math.PI/180,c=null!=n.sweepAngle?n.sweepAngle*Math.PI/180:2*Math.PI,u=null!=n.sweepAngle&&360>n.sweepAngle,d=Object.values(o),h=d.some(e=>{const t=e.pieceData[0];return t&&("number"==typeof t._pct||"number"==typeof t._pctStart||null!=t._roundedEnds)}),f=u&&!h&&d.length>1&&(n.cornerRadius??0)>0;for(let e=0;d.length>e;e++){const t=d[e],o=t.pieceData[0],u="number"==typeof o?._pctStart?o._pctStart:t.pctStart,h=l+u*c,m=l+(u+("number"==typeof o?._pct?o._pct:t.pct))*c,p=r(t.pieceData[0],t.name),g=0===e,y=e===d.length-1,b={type:"wedge",cx:0,cy:0,innerRadius:a,outerRadius:s,startAngle:h,endAngle:m,...n.cornerRadius&&{cornerRadius:n.cornerRadius},style:p,datum:o?._nonInteractive?null:t.pieceData,category:t.name};o?._roundedEnds?b.roundedEnds=o._roundedEnds:f&&(b.roundedEnds={start:g,end:y}),o?._gradientBand&&(b._gradientBand=o._gradientBand),i.push(b)}return i}var Od=require("d3-array");function Bd(e){const t=e.length,o=e[0],n=e[t-1];return{n:t,min:o,q1:(0,Od.quantile)(e,.25)??o,median:(0,Od.quantile)(e,.5)??(o+n)/2,q3:(0,Od.quantile)(e,.75)??n,max:n,mean:e.reduce((e,t)=>e+t,0)/t}}L();var Fd=require("d3-scale"),zd={bar:function(e,t){const{scales:o,columns:n,config:r,getR:i,getStack:s,resolvePieceStyle:a}=e,{r:l,projection:c}=o,u=[],d="vertical"===c,h="horizontal"===c,f=r.normalize,m=[];if(s){const e=new Set;for(const t of Object.values(n))for(const o of t.pieceData){const t=s(o);e.has(t)||(e.add(t),m.push(t))}}else m.push("_default");for(const e of Object.values(n)){const t=new Map;for(const o of e.pieceData){const e=s?s(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const n=t.get(e);n.total+=i(o),n.pieces.push(o)}let o=0;if(f)for(const e of t.values())o+=Math.abs(e.total);let n=0,r=0;for(const i of m){const c=t.get(i);if(!c)continue;let m=c.total;f&&o>0&&(m/=o);const p=a(c.pieces[0],s?i:e.name),g={...c.pieces[0],__aggregateValue:c.total,__pieceCount:c.pieces.length,category:e.name};if(d){const t=l(0>m?r:n+m),o=0>m?l(r+m)-l(r):l(n)-l(n+m);u.push(Ko(e.x,t,e.width,Math.abs(o),p,g,i)),0>m?r+=m:n+=m}else if(h){const t=l(0>m?r+m:n),o=0>m?l(r)-l(r+m):l(n+m)-l(n);u.push(Ko(t,e.x,Math.abs(o),e.width,p,g,i)),0>m?r+=m:n+=m}}}const p="vertical"===c,g=r.roundedTop&&r.roundedTop>0?Math.max(0,r.roundedTop):0;for(const e of u){if("rect"!==e.type)continue;const t=e.datum?.__aggregateValue??0;e.roundedEdge=p?0>t?"bottom":"top":0>t?"left":"right",r.gradientFill&&(e.fillGradient=r.gradientFill)}if(g>0){const e=new Map;for(const t of u){if("rect"!==t.type)continue;const o=t.datum?.category||"";e.has(o)||e.set(o,[]),e.get(o).push(t)}for(const t of e.values()){if(0===t.length)continue;const e=t.filter(e=>(e.datum?.__aggregateValue??0)>=0),o=t.filter(e=>0>(e.datum?.__aggregateValue??0));e.length>0&&(e.reduce(p?(e,t)=>t.y>e.y?e:t:(e,t)=>e.x+e.w>t.x+t.w?e:t).roundedTop=g),o.length>0&&(o.reduce(p?(e,t)=>e.y+e.h>t.y+t.h?e:t:(e,t)=>t.x>e.x?e:t).roundedTop=g)}}return u},clusterbar:function(e,t){const{scales:o,columns:n,config:r,getR:i,getGroup:s,resolvePieceStyle:a}=e,{r:l,projection:c}=o,u=[],d="vertical"===c,h=[],f=new Set;for(const e of Object.values(n))for(const t of e.pieceData){const e=s?s(t):"_default";f.has(e)||(f.add(e),h.push(e))}const m=h.length||1;for(const e of Object.values(n)){const t=e.width/m,o=.2*t,n=t-o,r=new Map;for(const t of e.pieceData){const e=s?s(t):"_default";r.has(e)||r.set(e,[]),r.get(e).push(t)}for(let s=0;h.length>s;s++){const c=r.get(h[s])||[];for(const r of c){const c=i(r),f=a(r,h[s]);if(d){const i=e.x+s*t+o/2,a=l(0),d=l(c);u.push(Ko(i,Math.min(a,d),n,Math.abs(a-d),f,r,h[s]))}else{const i=e.x+s*t+o/2,a=l(0),d=l(c);u.push(Ko(Math.min(a,d),i,Math.abs(d-a),n,f,r,h[s]))}}}}const p=r.roundedTop&&r.roundedTop>0?Math.max(0,r.roundedTop):0;for(const e of u){if("rect"!==e.type)continue;if(null==e.datum)continue;const t=i(e.datum);p>0&&(e.roundedTop=p),e.roundedEdge=d?0>t?"bottom":"top":0>t?"left":"right",r.gradientFill&&(e.fillGradient=r.gradientFill)}return u},point:function(e,t){const{scales:o,columns:n,getR:r,multiScales:i,resolvePieceStyle:s}=e,{r:a,projection:l}=o,c=[],u="vertical"===l,d="radial"===l,h=i.length>0,f=Nd(e),m=2*Math.PI,p=-Math.PI/2;for(const e of Object.values(n))for(const t of e.pieceData){const o=t.__rIndex??0,n=t.__rValue??r(t),l=h&&i[o]||a,g=s(t,e.name),y=g.r||5;let b,v;if(d){const t=p+(e.pctStart+e.pct/2)*m,o=l(n);b=Math.cos(t)*o,v=Math.sin(t)*o}else u?(b=e.middle,v=l(n)):(b=l(n),v=e.middle);Dd(c,f,t,b,v,y,g)}return c},swarm:function(e,t){const{scales:o,columns:n,getR:r,resolvePieceStyle:i}=e,{r:s,projection:a}=o,l=[],c="vertical"===a,u=Nd(e);for(const e of Object.values(n)){const t=e.width/2;for(let o=0;e.pieceData.length>o;o++){const n=e.pieceData[o],a=r(n),d=i(n,e.name),h=d.r||4,f=(7919*o%100/100-.5)*t*.8;Dd(l,u,n,c?e.middle+f:s(a),c?s(a):e.middle+f,h,d)}}return l},pie:Ed,donut:Ed,boxplot:function(e,t){const{scales:o,columns:n,config:r,getR:i,resolveSummaryStyle:s}=e,{r:a,projection:l}=o,c=[],u="vertical"===l,d=!1!==r.showOutliers;for(const t of Object.values(n)){const o=t.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===o.length)continue;const n=o[0],r=o[o.length-1],l=(0,Od.quantile)(o,.25)??n,h=(0,Od.quantile)(o,.5)??(n+r)/2,f=(0,Od.quantile)(o,.75)??r,m=f-l,p=l-1.5*m,g=f+1.5*m,y=o.find(e=>e>=p)??n,b=[...o].reverse().find(e=>g>=e)??r,v=s(t.pieceData[0],t.name),x=[];if(d)for(const e of t.pieceData){const o=i(e);if(p>o||o>g){const n=u?t.middle:a(o),r=u?a(o):t.middle;x.push({px:n,py:r,value:o,datum:e})}}if(c.push({type:"boxplot",x:u?t.middle:0,y:u?0:t.middle,projection:u?"vertical":"horizontal",columnWidth:.6*t.width,minPos:a(y),q1Pos:a(l),medianPos:a(h),q3Pos:a(f),maxPos:a(b),stats:{n:o.length,min:y,q1:l,median:h,q3:f,max:b,mean:o.reduce((e,t)=>e+t,0)/o.length},style:v,datum:t.pieceData,category:t.name,outliers:x}),d)for(const t of x)c.push({type:"point",x:t.px,y:t.py,r:3,style:{fill:v.fill||e.config.themeSemantic?.secondary||"#999",opacity:.6},datum:t.datum})}return c},violin:function(e,t){const{scales:o,columns:n,config:r,getR:i,resolveSummaryStyle:s}=e,{r:a,projection:l}=o,c=[],u="vertical"===l,d=r.bins||20,h=!1!==r.showIQR;for(const e of Object.values(n)){const t=e.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const o=t[0],n=t[t.length-1],r=(n-o)/d||1,l=Array(d).fill(0);for(const e of t)l[Math.min(Math.floor((e-o)/r),d-1)]++;const f=R(l,1),m=e.width/2*.9;let p;if(u){p=`M ${e.middle} ${a(o)}`;for(let t=0;d>t;t++){const n=a(o+(t+.5)*r);p+=` L ${e.middle+l[t]/f*m} ${n}`}p+=` L ${e.middle} ${a(n)}`;for(let t=d-1;t>=0;t--){const n=a(o+(t+.5)*r);p+=` L ${e.middle-l[t]/f*m} ${n}`}p+=" Z"}else{p=`M ${a(o)} ${e.middle}`;for(let t=0;d>t;t++)p+=` L ${a(o+(t+.5)*r)} ${e.middle-l[t]/f*m}`;p+=` L ${a(n)} ${e.middle}`;for(let t=d-1;t>=0;t--)p+=` L ${a(o+(t+.5)*r)} ${e.middle+l[t]/f*m}`;p+=" Z"}const g=s(e.pieceData[0],e.name);let y;if(h&&t.length>=4){const r=(0,Od.quantile)(t,.25)??o,i=(0,Od.quantile)(t,.5)??(o+n)/2,s=(0,Od.quantile)(t,.75)??n;y={q1Pos:a(r),medianPos:a(i),q3Pos:a(s),centerPos:e.middle,isVertical:u}}const b=u?{x:e.x,y:Math.min(a(n),a(o)),width:e.width,height:Math.abs(a(n)-a(o))}:{x:Math.min(a(o),a(n)),y:e.x,width:Math.abs(a(n)-a(o)),height:e.width};c.push({type:"violin",pathString:p,translateX:0,translateY:0,bounds:b,iqrLine:y,stats:Bd(t),style:g,datum:e.pieceData,category:e.name})}return c},histogram:function(e,t){const{scales:o,columns:n,config:r,getR:i,resolveSummaryStyle:s}=e,{r:a}=o,l=[],c=r.bins||25,u=r.normalize,d=a.domain?.(),h=d?+d[0]:void 0,f=d?+d[1]:void 0;for(const e of Object.values(n)){const t=e.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const[o,n]=P(t),r=null!=h&&isFinite(h)?h:o,d=null!=f&&isFinite(f)?f:n,m=(d-r)/c||1,p=Array(c).fill(0);for(const e of t)r>e||e>d||p[Math.min(Math.floor((e-r)/m),c-1)]++;const g=t.length,y=R(p,1),b=s(e.pieceData[0],e.name);for(let t=0;c>t;t++){if(0===p[t])continue;const o=(u?p[t]/g:p[t]/y)*e.width*.9,n=a(r+t*m),i=a(r+(t+1)*m);l.push(Ko(Math.min(n,i),e.x+e.width-o,Math.abs(i-n),o,b,{bin:t,count:p[t],range:[r+t*m,r+(t+1)*m],category:e.name},e.name))}}return l},ridgeline:function(e,t){const{scales:o,columns:n,config:r,getR:i,resolveSummaryStyle:s}=e,{r:a,projection:l}=o,c=[],u=r.bins||20,d="horizontal"===l,h=r.amplitude||1.5;for(const e of Object.values(n)){const t=e.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const o=t[0],n=t[t.length-1],r=(n-o)/u||1,l=Array(u).fill(0);for(const e of t)o>e||e>n||l[Math.min(Math.floor((e-o)/r),u-1)]++;const f=R(l,1),m=s(e.pieceData[0],e.name),p=e.width*h;let g;if(d){const t=e.x+e.width;g=`M ${a(o)} ${t}`;for(let e=0;u>e;e++)g+=` L ${a(o+(e+.5)*r)} ${t-l[e]/f*p}`;g+=` L ${a(n)} ${t} Z`}else{const t=e.x;g=`M ${t} ${a(o)}`;for(let e=0;u>e;e++){const n=a(o+(e+.5)*r);g+=` L ${t+l[e]/f*p} ${n}`}g+=` L ${t} ${a(n)} Z`}const y=d?{x:Math.min(a(o),a(n)),y:e.x,width:Math.abs(a(n)-a(o)),height:e.width}:{x:e.x,y:Math.min(a(n),a(o)),width:e.width,height:Math.abs(a(n)-a(o))};c.push({type:"violin",pathString:g,translateX:0,translateY:0,bounds:y,stats:Bd(t),style:{...m,fillOpacity:m.fillOpacity??.5},datum:e.pieceData,category:e.name})}return c},timeline:function(e,t){const{scales:o,columns:n,getRawRange:r,resolvePieceStyle:i}=e,{r:s,projection:a}=o,l=[],c="horizontal"===a;for(const e of Object.values(n))for(const t of e.pieceData){const o=r(t);if(!o)continue;const[n,a]=o,u=i(t,e.name);if(c){const o=s(Math.min(n,a)),r=s(Math.max(n,a));l.push(Ko(o,e.x,r-o,e.width,u,t,e.name))}else{const o=s(Math.max(n,a)),r=s(Math.min(n,a));l.push(Ko(e.x,o,e.width,r-o,u,t,e.name))}}return l},funnel:function(e,t){const{columns:o,getR:n,getStack:r,resolvePieceStyle:i}=e,s=[],a=t.width/2,l=!1!==e.config.showLabels,c=e.scales.o.domain().map(e=>o[e]).filter(Boolean);if(0===c.length)return s;const u=[],d=new Set;for(const e of c)for(const t of e.pieceData){const e=r?r(t):"_default";d.has(e)||(d.add(e),u.push(e))}const h=u.length>1&&"_default"!==u[0],f=[];let m=0;for(const e of c){const t=new Map;let o=0;for(const i of e.pieceData){const e=r?r(i):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const s=t.get(e),a=n(i);s.total+=a,s.pieces.push(i),o+=a}f.push({col:e,groups:t,stepTotal:o}),h||o>m&&(m=o)}if(h)for(const e of f){let t=0,o=0;for(let n=0;u.length>n;n++){const r=e.groups.get(u[n]);r&&(n%2==0?t+=r.total:o+=r.total)}const n=Math.max(t,o);n>m&&(m=n)}if(0===m)return s;const p=new Map;for(const e of u){const t=f[0].groups.get(e);p.set(e,t?.total??0)}const g=f[0].stepTotal,y=h?.95*a:.9*t.width,b=(0,Fd.scaleLinear)().domain([0,m]).range([0,y]),v=e.config.connectorOpacity??.3;let x=new Map;for(let t=0;f.length>t;t++){const o=f[t],n=o.col,r=0===t,c=n.width,d=.55*c,m=n.x+(c-d)/2,y=new Map;if(h){let e=0;for(const t of u){const n=o.groups.get(t);n&&(e+=b(n.total))}let t=a,c=a;for(let h=0;u.length>h;h++){const f=u[h],g=o.groups.get(f);if(!g)continue;const v=b(g.total),x=h%2==0,k=x?t:c-v;x?t+=v:c-=v;const w=i(g.pieces[0],f),S=p.get(f)??g.total,A={...g.pieces[0],__funnelValue:g.total,__funnelPercent:S>0?g.total/S*100:0,__funnelStep:n.name,__funnelIsFirstStep:r,__aggregateValue:g.total,__pieceCount:g.pieces.length,category:f};l&&(0===h&&(A.__funnelStepLabel=n.name,A.__funnelStepLabelX=a,A.__funnelStepLabelY=m,A.__funnelRowWidth=e),A.__funnelValueLabelX=k+v/2,A.__funnelValueLabelY=m,A.__funnelBarW=v),s.push(Ko(k,m,v,d,w,A,f)),y.set(f,{x:k,y:m,w:v,h:d})}}else{const e=o.stepTotal,t=b(e),c=a-t/2,h=u[0],f="_default"!==h,p=o.groups.get(h)?.pieces[0]??n.pieceData[0],v=f?h:n.name,x=i(p,v),k=g>0?e/g*100:0,w={...p,__funnelValue:e,__funnelPercent:k,__funnelStep:n.name,__funnelIsFirstStep:r,category:f?h:n.name};l&&(w.__funnelStepLabel=n.name,w.__funnelStepLabelX=a,w.__funnelStepLabelY=m,w.__funnelRowWidth=t,w.__funnelValueLabelX=a,w.__funnelValueLabelY=m,w.__funnelBarW=t),s.push(Ko(c,m,t,d,x,w,v)),y.set(h,{x:c,y:m,w:t,h:d})}if(t>0&&x.size>0){const t=h?u:[u[0]];for(const r of t){const t=x.get(r),a=y.get(r);if(!t||!a)continue;const l=(()=>{const e=o.groups.get(r);return i(e?e.pieces[0]:n.pieceData[0],"_default"===r?n.name:r)})(),c={type:"trapezoid",points:[[t.x,t.y+t.h],[t.x+t.w,t.y+t.h],[a.x+a.w,a.y],[a.x,a.y]],style:{fill:l.fill||e.config.themeSemantic?.secondary||"#999",opacity:v},datum:o.groups.get(r)?.pieces[0]??n.pieceData[0],category:"_default"===r?n.name:r};s.push(c)}}x=y}return s},"bar-funnel":function(e,t){const{columns:o,getR:n,getStack:r,resolvePieceStyle:i,scales:s}=e,a=[],l=s.o.domain().map(e=>o[e]).filter(Boolean);if(0===l.length)return a;const c=[],u=new Set;for(const e of l)for(const t of e.pieceData){const e=r?r(t):"_default";u.has(e)||(u.add(e),c.push(e))}const d=c.length>1&&"_default"!==c[0],h=[];for(const e of l){const t=new Map;let o=0;for(const i of e.pieceData){const e=r?r(i):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const s=t.get(e),a=n(i);s.total+=a,s.pieces.push(i),o+=a}h.push({col:e,groups:t,stepTotal:o})}const f=new Map;for(const e of c){const t=h[0]?.groups.get(e);f.set(e,t?.total??0)}const m=s.r,p=d?c.length:1,g=d?.15:0;for(let e=0;h.length>e;e++){const t=h[e],o=t.col,n=0===e,r=e>0?h[e-1]:null,s=o.width/p,l=s*g,u=s-l;for(let e=0;c.length>e;e++){const h=c[e],p=t.groups.get(h);if(!p)continue;const g=p.total,y=f.get(h)??g,b=y>0?g/y*100:0,v=r?.groups.get(h),x=n?0:Math.max(0,(v?.total??g)-g),k=o.x+e*s+l/2,w=m(g),S=m(0)-w,A=i(p.pieces[0],d?h:o.name),C={...p.pieces[0],__barFunnelValue:g,__barFunnelPercent:b,__barFunnelIsFirstStep:n,__barFunnelIsDropoff:!1,__barFunnelStep:o.name,__barFunnelDropoffValue:x,__barFunnelCategory:"_default"===h?void 0:h,category:d?h:o.name,__barFunnelLabelX:k+u/2,__barFunnelLabelY:m(g+x)};if(a.push(Ko(k,w,u,S,A,C,d?h:o.name)),x>0){const e=m(g+x),t=w-e,n={...A},r={...p.pieces[0],__barFunnelValue:x,__barFunnelPercent:y>0?x/y*100:0,__barFunnelIsFirstStep:!1,__barFunnelIsDropoff:!0,__barFunnelStep:o.name,__barFunnelCategory:"_default"===h?void 0:h,category:d?h:o.name};a.push(Ko(k,e,u,t,n,r,d?h:o.name))}}}return a},swimlane:function(e,t){const{scales:o,columns:n,getR:r,getStack:i,resolvePieceStyle:s}=e,{r:a,projection:l}=o,c=[],u="horizontal"===l,d=e.config.gradientFill,h=u?"left":"bottom",f=e.config.trackFill;if(f){const e="string"==typeof f?f:f.color,t="string"==typeof f?1:f.opacity??1,[o,r]=a.range(),i=Math.min(o,r),s=Math.abs(r-o);for(const o of Object.values(n)){const n={fill:e,opacity:t},r=u?Ko(i,o.x,s,o.width,n,null,"__track__"):Ko(o.x,i,o.width,s,n,null,"__track__");c.push(r)}}const m=e.config.roundedTop&&e.config.roundedTop>0?Math.max(0,e.config.roundedTop):0;for(const e of Object.values(n)){let t=0;const o=c.length;for(const o of e.pieceData){const n=Math.abs(r(o));if(0===n)continue;const l=i?i(o):e.name,f=s(o,l);let m;if(u){const r=a(t),i=a(t+n);m=Ko(r,e.x,i-r,e.width,f,o,l)}else{const r=a(t+n),i=a(t);m=Ko(e.x,r,e.width,i-r,f,o,l)}d&&(m.fillGradient=d,m.roundedEdge=h),c.push(m),t+=n}if(m>0&&c.length>o){const e=c.slice(o),t=e[0],n=e[e.length-1];1===e.length?t.cornerRadii={tl:m,tr:m,br:m,bl:m}:u?(t.cornerRadii={tl:m,bl:m},n.cornerRadii={tr:m,br:m}):(t.cornerRadii={bl:m,br:m},n.cornerRadii={tl:m,tr:m})}}return c}};function Hd(e,t,o){return bo(e,t,o)}function Wd(e,t){const o=t&&"object"==typeof t&&!Array.isArray(t)?t:void 0;return 0===e.length?e=>o&&So(o,e)||"#4e79a7":t=>{if(o){const e=So(o,t);if(e)return e}let n=0;for(let e=0;t.length>e;e++)n=31*n+t.charCodeAt(e)|0;return e[Math.abs(n)%e.length]??"#4e79a7"}}var qd=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Yd=["scene-style","data-paint","accessibility","evidence"],Gd=(e,t)=>({retainedData:e,invalidations:t}),Vd=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Xd=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Ud=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Kd=["scene-geometry","data-paint","accessibility","evidence"],Qd=["scene-style","data-paint","accessibility","evidence"],Zd=[],Jd={chartType:Gd("rebuild",Vd),runtimeMode:Gd("rebuild",Vd),categoryAccessor:Gd("rebuild",Vd),valueAccessor:Gd("rebuild",Vd),oAccessor:Gd("rebuild",Vd),rAccessor:Gd("rebuild",Vd),stackBy:Gd("rebuild",Vd),groupBy:Gd("rebuild",Vd),timeAccessor:Gd("rebuild",Vd),accessorRevision:Gd("rebuild",Vd),colorAccessor:Gd("rebuild",Qd),symbolAccessor:Gd("rebuild",Kd),connectorAccessor:Gd("rebuild",Kd),dataIdAccessor:Gd("rebuild",Kd),projection:Gd("preserve",Xd),extentPadding:Gd("preserve",Xd),axisExtent:Gd("preserve",Xd),rExtent:Gd("preserve",Xd),oExtent:Gd("preserve",Xd),multiAxis:Gd("preserve",Xd),normalize:Gd("preserve",Xd),bins:Gd("preserve",Xd),oSort:Gd("preserve",Ud),barPadding:Gd("preserve",Ud),roundedTop:Gd("preserve",Ud),baselinePadding:Gd("preserve",Ud),innerRadius:Gd("preserve",Ud),cornerRadius:Gd("preserve",Ud),startAngle:Gd("preserve",Ud),sweepAngle:Gd("preserve",Ud),trackFill:Gd("preserve",Ud),showOutliers:Gd("preserve",Ud),showIQR:Gd("preserve",Ud),amplitude:Gd("preserve",Ud),connectorOpacity:Gd("preserve",Ud),showLabels:Gd("preserve",Ud),dynamicColumnWidth:Gd("rebuild",Ud),customLayout:Gd("preserve",Ud),layoutConfig:Gd("preserve",Ud),layoutMargin:Gd("preserve",Ud),symbolMap:Gd("preserve",Kd),pieceStyle:Gd("preserve",Qd),summaryStyle:Gd("preserve",Qd),connectorStyle:Gd("preserve",Qd),gradientFill:Gd("preserve",Qd),colorScheme:Gd("preserve",Qd),themeCategorical:Gd("preserve",Qd),themeSemantic:Gd("preserve",Qd),themeSequential:Gd("preserve",Qd),themeDiverging:Gd("preserve",Qd),barColors:Gd("preserve",Qd),decay:Gd("preserve",Qd),pulse:Gd("preserve",Qd),staleness:Gd("preserve",Qd),layoutSelection:Gd("preserve",Qd),windowSize:Gd("preserve",Zd),windowMode:Gd("preserve",Zd),clock:Gd("preserve",Zd),transition:Gd("preserve",Zd),introAnimation:Gd("preserve",Zd),onLayoutError:Gd("preserve",Zd)},eh=Gd("preserve",Ud),th=class{constructor(){this.tracker=new qn}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}},qd)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},Yd):this.recordNoop("restyle")}recordConfig(e){const t=function(e){let t="preserve";const o=new Set;for(const n of e){const e=Jd[n]??eh;"rebuild"===e.retainedData&&(t="rebuild");for(const t of e.invalidations)o.add(t)}return{retainedData:t,invalidations:o}}(e);return this.tracker.record({kind:"config",keys:e},t.invalidations)}},oh=require("d3-quadtree"),nh=class{constructor(e){this.rExtent=new $t,this.rExtents=[],this.windowSizeWarned=!1,this.updateResults=new th,this.rAccessors=[],this.categories=new Set,this._hasStreamingData=!1,this.styleResolver=new $d,this.timestampBuffer=null,this.activeTransition=null,this.prevPositionMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this.scales=null,this.multiScales=[],this.scene=[],this.columns={},this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customLayoutFailedThisBuild=!1,this._customLayoutDiagnosticsWarned=new Set,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.version=0,this._dataVersion=0,this._bufferArrayCache=null,this._pointQuadtree=null,this._maxPointRadius=0,this._datumIndexCache=null,this._categoryIndexCache=null,this._hasRenderedOnce=!1,this.config=e,this.buffer=new It(e.windowSize),this.getO=Ot(e.categoryAccessor||e.oAccessor,"category");const t=e.valueAccessor||e.rAccessor;Array.isArray(t)?(this.rAccessors=t.map(e=>Dt(e,"value")),this.getR=this.rAccessors[0],this.rExtents=t.map(()=>new $t)):(this.getR=Dt(t,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=Ot(e.stackBy),this.getGroup=Ot(e.groupBy),this.getColor=Ot(e.colorAccessor),this.getSymbol=Ot(e.symbolAccessor),this.getConnector=Ot(e.connectorAccessor),this.getDataId=Ot(e.dataIdAccessor),e.pulse&&(this.timestampBuffer=new It(e.windowSize))}syncPulseTimestampBuffer(){var e,t,o,n;this.timestampBuffer=(e=!!this.config.pulse,t=this.buffer,o=this.timestampBuffer,n=this.currentTime(),e?null!=o&&o.capacity===t.capacity&&o.size===t.size?o:jn(t,n):null)}currentTime(){return this.config.clock?.()??Ro()}ingest(e){const t=this.currentTime();if(this.lastIngestTime=t,this._dataVersion++,e.bounded){this.buffer.clear(),this.rExtent.clear();for(const e of this.rExtents)e.clear();e.preserveCategoryOrder?this._hasStreamingData=!0:this.categories.clear(),this.timestampBuffer&&this.timestampBuffer.clear(),Rn(this.buffer,e.totalSize||e.inserts.length,this.timestampBuffer);for(const o of e.inserts)Ln(this.buffer,o,this.timestampBuffer,t),this.categories.add(this.getO(o)),this.pushValueExtent(o)}else{this._hasStreamingData=!0;for(const o of e.inserts){const e=Ln(this.buffer,o,this.timestampBuffer,t);this.categories.add(this.getO(o)),this.pushValueExtent(o),null!=e&&this.evictValueExtent(e)}}return this.updateResults.recordData(e.bounded?"replace":"ingest",e.inserts.length),!0}ingestWithResult(e){return this.ingest(e),this.updateResults.last}pushValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.push(t[0]),this.rExtent.push(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].push(this.rAccessors[t](e));this.rExtent.push(this.getR(e))}else this.rExtent.push(this.getR(e))}evictValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.evict(t[0]),this.rExtent.evict(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].evict(this.rAccessors[t](e));this.rExtent.evict(this.getR(e))}else this.rExtent.evict(this.getR(e))}getRawRange(e){const t=this.config.valueAccessor||this.config.rAccessor;if(!t)return null;const o="function"==typeof t?t(e):e[t];return Array.isArray(o)&&o.length>=2?[+o[0],+o[1]]:null}computeScene(e){const{config:t,buffer:o}=this,n=this.scales,r=this.multiScales,i=this.columns;if(0===o.size)return this.scales=null,this.multiScales=[],this.scene=[],this.columns={},this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(o,this.getR);const s=this.getBufferArray(),a=t.projection||"vertical",l=t.oExtent||this.resolveCategories(s),c=this.computeValueDomain(s,l),u="horizontal"===a,d="radial"===a,h=Math.min(.9,Math.max(0,null!=t.barPadding?t.barPadding/("vertical"===a?e.width:e.height):.1));let f,m;if(d){f=(0,Id.scaleBand)().domain(l).range([0,1]).padding(0);const o=Math.min(e.width,e.height)/2,n=t.innerRadius||0;m=(0,Id.scaleLinear)().domain(c).range([n,o])}else u?(f=(0,Id.scaleBand)().domain(l).range([0,e.height]).padding(h),m=(0,Id.scaleLinear)().domain(c).range([0,e.width])):(f=(0,Id.scaleBand)().domain(l).range([0,e.width]).padding(h),m=(0,Id.scaleLinear)().domain(c).range([e.height,0]));this.scales={o:f,r:m,projection:a},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((n,r)=>{const i=this.rExtents[r];i.dirty&&i.recalculate(o,n);let[s,a]=i.extent;s===1/0&&(s=0,a=1);const l=a-s,c=l>0?l*(t.extentPadding??.05):1;return s-=c,a+=c,s>0&&(s=0),u?(0,Id.scaleLinear)().domain([s,a]).range([0,e.width]):(0,Id.scaleLinear)().domain([s,a]).range([e.height,0])}):[];let p=s;this.rAccessors.length>1&&(p=s.flatMap(e=>this.rAccessors.map((t,o)=>({...e,__rIndex:o,__rValue:t(e),__rName:this.resolveRAccessorName(o)})))),this.columns=this.buildColumns(p,l,f,a,e),this._customLayoutFailedThisBuild=!1;const g=this.buildSceneNodes(p,e);this._customLayoutFailedThisBuild?!0===this.lastCustomLayoutFailure?.preservedLastGoodScene?(this.scales=n,this.multiScales=r,this.columns=i):(this.scene=[],this.rebuildPointQuadtree()):(this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=g,this.rebuildPointQuadtree(),this.config.decay&&this.applyDecay(this.scene,s),this.config.pulse&&this.applyPulse(this.scene,s),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&this.prevPositionMap.size>0&&this.startTransition(),this.version++)}resolveRAccessorName(e){const t=this.config.valueAccessor||this.config.rAccessor,o=Array.isArray(t)?t[e]:t;return"string"==typeof o?o:"value"+e}resolveCategories(e){const t=this.config.oSort,o="streaming"===this.config.runtimeMode||this._hasStreamingData,n="auto"===t?void 0:t;let r=null;if(o){r=new Set;for(const t of e)r.add(this.getO(t))}const i=r?Array.from(this.categories).filter(e=>r.has(e)):Array.from(this.categories);if(o&&void 0===n){const e=Math.max(50,3*r.size);if(this.categories.size>e){let t=this.categories.size-e;for(const e of this.categories){if(0>=t)break;r.has(e)||(this.categories.delete(e),t--)}}return i}if(!1===n)return i;if("function"==typeof n)return i.sort(n);const s=new Map;for(const t of e){const e=this.getO(t);s.set(e,(s.get(e)||0)+Math.abs(this.getR(t)))}return i.sort("asc"===n?(e,t)=>(s.get(e)||0)-(s.get(t)||0):(e,t)=>(s.get(t)||0)-(s.get(e)||0))}computeValueDomain(e,t){return function(e){const{data:t,chartType:o,projection:n,normalize:r,rExtent:i,extentPadding:s=.05,baselinePadding:a,axisExtent:l,getO:c,getR:u,getStack:d,rawRExtent:h}=e,f=s;if("radial"===n&&("pie"===o||"donut"===o))return[0,1];let m=0,p=0;if("bar"===o&&d&&r)m=0,p=1;else if("bar"===o&&d){const e=new Map,o=new Map;for(const n of t){const t=c(n),r=u(n);0>r?o.set(t,(o.get(t)||0)+r):e.set(t,(e.get(t)||0)+r)}for(const t of e.values())t>p&&(p=t);for(const e of o.values())m>e&&(m=e)}else if("bar"===o){const e=new Map;for(const o of t){const t=c(o),n=u(o);e.set(t,(e.get(t)||0)+n)}for(const t of e.values())t>p&&(p=t),m>t&&(m=t)}else if("swimlane"===o){const e=new Map;for(const o of t){const t=c(o),n=Math.abs(u(o));e.set(t,(e.get(t)||0)+n)}for(const t of e.values())t>p&&(p=t)}else if("clusterbar"===o||"bar-funnel"===o)for(const e of t){const t=u(e);t>p&&(p=t),m>t&&(m=t)}else{const e=h[0],t=h[1];e!==1/0&&(m=e),t!==-1/0&&(p=t)}i&&(null!=i[0]&&(m=i[0]),null!=i[1]&&(p=i[1]));const g="bar"===o||"clusterbar"===o||"bar-funnel"===o||"swimlane"===o;if(g&&null==i?.[0]&&null==i?.[1]&&(m>0&&(m=0),0>p&&(p=0)),"bar-funnel"!==o&&"exact"!==l){const e=p-m,t=e>0?e*f:1,n=g&&!a&&0===m,r=g&&!a&&0===p||"swimlane"===o;null!=i?.[0]||n||(m-=t),null!=i?.[1]||r||(p+=t)}return[m,p]}({data:e,chartType:this.config.chartType,projection:this.config.projection,normalize:this.config.normalize,rExtent:this.config.rExtent,extentPadding:this.config.extentPadding,baselinePadding:this.config.baselinePadding,axisExtent:this.config.axisExtent,getO:this.getO,getR:this.getR,getStack:this.getStack,rawRExtent:this.rExtent.extent})}buildColumns(e,t,o,n,r){return function(e){const{data:t,oExtent:o,oScale:n,projection:r,layout:i,dynamicColumnWidth:s,getO:a,getR:l}=e,c={},u=new Map;for(const e of t){const t=a(e);u.has(t)||u.set(t,[]),u.get(t).push(e)}let d=0;if("radial"===r)for(const e of t)d+=Math.abs(l(e));let h=null;if(s&&"radial"!==r){h=new Map;let e=0;for(const t of o){const o=u.get(t)||[];let n;n="string"==typeof s?o.reduce((e,t)=>e+(Number(t[s])||0),0):s(o),h.set(t,n),e+=n}const t=("horizontal"===r?i.height:i.width)-n.padding()*n.step()*o.length;if(e>0)for(const[o,n]of h)h.set(o,n/e*t)}let f=0,m=0;for(const e of o){const t=u.get(e)||[],o=t.reduce((e,t)=>e+Math.abs(l(t)),0),r=d>0?o/d:0;let i,s;h?(i=m,s=h.get(e)||n.bandwidth(),m+=s+n.padding()*n.step()):(i=n(e)??0,s=n.bandwidth()),c[e]={name:e,x:i,y:0,width:s,middle:i+s/2,padding:n.padding()*n.step(),pieceData:t,pct:r,pctStart:f},f+=r}return c}({data:e,oExtent:t,oScale:o,projection:n,layout:r,dynamicColumnWidth:this.config.dynamicColumnWidth,getO:this.getO,getR:this.getR})}getSceneContext(){return{scales:this.scales,columns:this.columns,config:this.config,getR:this.getR,getStack:this.getStack,getGroup:this.getGroup,getColor:this.getColor,getSymbol:this.getSymbol,getConnector:this.getConnector,getO:this.getO,multiScales:this.multiScales,rAccessors:this.rAccessors,resolvePieceStyle:(e,t)=>this.styleResolver.resolvePieceStyle(this.config,e,t),resolveSummaryStyle:(e,t)=>this.styleResolver.resolveSummaryStyle(this.config,e,t),getRawRange:e=>this.getRawRange(e)}}buildSceneNodes(e,t){if(!this.scales)return[];if(this.config.customLayout){const o=this.buildLayoutContext(e,t);let n;try{n=this.config.customLayout(o)}catch(e){const t=null!==this.lastCustomLayoutResult,o=Sn("ordinal",e,t,this.version);this.lastCustomLayoutFailure=o,this._customLayoutFailedThisBuild=!0,"production"!==process.env.NODE_ENV&&console.error("[semiotic] ordinal customLayout threw:",e);try{this.config.onLayoutError?.(o)}catch(e){"production"!==process.env.NODE_ENV&&console.error("[semiotic] onLayoutError threw:",e)}return t?this.scene:(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,[])}this.customLayoutOverlays=n.overlays??null,this.lastCustomLayoutResult=n,this.lastCustomLayoutFailure=null;const r=n.nodes??[];if(this._customRestyle=n.restyle,this.hasCustomRestyle=!!n.restyle,this.hasCustomRestyle){this._baseStyles=new WeakMap;for(const e of r)e.style&&this._baseStyles.set(e,e.style);this.applyCustomRestyle(r,this.config.layoutSelection??null)}return xn({label:"ordinal customLayout",nodes:r,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned}),r}this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1;const o=this.getSceneContext(),n=zd[this.config.chartType];let r=n?n(o,t):[];if(this.getConnector&&this.scales){const e=function(e,t){const{scales:o,config:n,getConnector:r,getO:i}=e;if(!r||!o)return[];const s=[],{projection:a}=o,l=new Map;for(const e of t){if("point"!==e.type&&"rect"!==e.type)continue;const t=e.datum;if(!t)continue;const o=r(t);if(!o)continue;let n,s;"point"===e.type?(n=e.x,s=e.y):(n=e.x+e.w/2,s=e.y+("vertical"===a?0:e.h/2)),l.has(o)||l.set(o,[]),l.get(o).push({x:n,y:s,datum:t,category:i(t)})}const c=o.o.domain(),u=n.connectorStyle;for(const[t,o]of l)if(o.length>=2){o.sort((e,t)=>c.indexOf(e.category)-c.indexOf(t.category));for(let n=0;o.length-1>n;n++){const r=o[n],i=o[n+1],a="function"==typeof u?u(r.datum):u||{stroke:e.config.themeSemantic?.border||e.config.themeSemantic?.secondary||"#999",strokeWidth:1,opacity:.5};s.push({type:"connector",x1:r.x,y1:r.y,x2:i.x,y2:i.y,style:a,datum:r.datum,group:t})}}return s}(o,r);r=[...e,...r]}return r}buildLayoutContext(e,t){const o=this.config,n=o.layoutMargin??{top:0,right:0,bottom:0,left:0},r=Hd(o.colorScheme,o.themeCategorical,vo),i=this.scales;return{data:e,scales:{o:i.o,r:i.r,projection:i.projection},dimensions:{width:t.width,height:t.height,margin:n,plot:"radial"===i.projection?{x:-t.width/2,y:-t.height/2,width:t.width,height:t.height}:{x:0,y:0,width:t.width,height:t.height}},theme:{semantic:o.themeSemantic??{},categorical:[...r]},resolveColor:Wd(r,o.colorScheme),config:o.layoutConfig??{},selection:o.layoutSelection??null}}computeDecayOpacity(e,t){const o=this.config.decay;return o&&t>1?Oo(o,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._dataVersion)return this._datumIndexCache.map;const t=Bo(e);return this._datumIndexCache={version:this._dataVersion,map:t},t}getCategoryIndexMap(e){if(this._categoryIndexCache&&this._categoryIndexCache.version===this._dataVersion)return this._categoryIndexCache.map;const t=function(e,t){const o="function"==typeof t,n=o?null:t||"category",r=new Map;for(let i=0;e.length>i;i++){const s=e[i],a=o?t(s):s[n],l=r.get(a);l?l.push(i):r.set(a,[i])}return r}(e,this.config.categoryAccessor||this.config.oAccessor);return this._categoryIndexCache={version:this._dataVersion,map:t},t}rebuildPointQuadtree(){const e=function(e){let t=0,o=0;for(const n of e)"point"===n.type&&(t++,n.r>o&&(o=n.r));if(500>=t)return{quadtree:null,maxRadius:o};const n=Array(t);let r=0;for(const t of e)"point"===t.type&&(n[r++]=t);return{maxRadius:o,quadtree:(0,oh.quadtree)().x(e=>e.x).y(e=>e.y).addAll(n)}}(this.scene);this._pointQuadtree=e.quadtree,this._maxPointRadius=e.maxRadius}get pointQuadtree(){return this._pointQuadtree}get maxPointRadius(){return this._maxPointRadius}applyDecay(e,t){if(!this.config.decay)return;const o=t.length;if(1>=o)return;const n=this.getDatumIndexMap(t);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;if(!t.datum)continue;const e=n.get(t.datum);if(null==e)continue;const r=this.computeDecayOpacity(e,o);t.style={...t.style,opacity:(t.style?.opacity??1)*r}}}applyPulse(e,t,o=this.currentTime()){return!(!this.config.pulse||!this.timestampBuffer)&&function(e,t,o,n,r,i){const s=e.color??"rgba(255,255,255,0.6)",a=e.glowRadius??4;let l=!1;for(const c of t){if("connector"===c.type||"violin"===c.type||"boxplot"===c.type)continue;if("wedge"===c.type){const t=c.category;if(!t)continue;let n=0;for(const s of r(t)??[]){const t=o.get(s);null!=t&&(n=Math.max(n,Fo(e,t,i)))}l=zo(c,n,s)||l;continue}if(null==c.datum)continue;const t=n.get(c.datum);if(null==t)continue;const u=o.get(t);l=zo(c,null==u?0:Fo(e,u,i),s,a)||l}return l}(this.config.pulse,e,this.timestampBuffer,this.getDatumIndexMap(t),e=>this.getCategoryIndexMap(t).get(e),o)}refreshPulse(e){return!0!==this.lastCustomLayoutFailure?.preservedLastGoodScene&&this.applyPulse(this.scene,this.getBufferArray(),e)}hasActivePulsesAt(e){return!!this.config.pulse&&Ho(this.config.pulse,this.timestampBuffer,e)}get hasActivePulses(){return this.hasActivePulsesAt(this.currentTime())}synthesizeIntroPositions(){this.prevPositionMap.clear();const e=new Map,t=this.scales?.r(0)??0,o="horizontal"!==this.scales?.projection;let n;for(let r=0;this.scene.length>r;r++){const i=this.scene[r],s=this.getNodeKey(i,e);s&&("rect"===i.type?this.prevPositionMap.set(s,o?{x:i.x,y:t,w:i.w,h:0,opacity:i.style.opacity??1}:{x:t,y:i.y,w:0,h:i.h,opacity:i.style.opacity??1}):"point"===i.type?this.prevPositionMap.set(s,{x:i.x,y:i.y,r:0,opacity:0}):"wedge"===i.type&&(void 0===n&&(n=i.startAngle),this.prevPositionMap.set(s,{x:i.cx,y:i.cy,startAngle:n,endAngle:n,innerRadius:i.innerRadius,outerRadius:i.outerRadius,opacity:0})))}}getNodeKey(e,t){if("point"===e.type){const o=`p:${e.datum?this.getO(e.datum):""}:${e.datum?this.getR(e.datum):0}`,n=t.get(o)||0;return t.set(o,n+1),`${o}:${n}`}if("rect"===e.type){const o=e.datum?null!=e.datum.category&&""!==e.datum.category?e.datum.category+"":(this.getO(e.datum)??"")+"":"",n=`r:${e.group||""}:${o}`,r=t.get(n)||0;return t.set(n,r+1),0===r?n:`${n}:${r}`}return"wedge"===e.type?"w:"+(e.category??""):null}snapshotPositions(){this.prevPositionMap.clear();const e=new Map;for(let t=0;this.scene.length>t;t++){const o=this.scene[t],n=this.getNodeKey(o,e);n&&("point"===o.type?this.prevPositionMap.set(n,{x:o.x,y:o.y,r:o.r,opacity:o.style.opacity??o.style.fillOpacity}):"rect"===o.type?this.prevPositionMap.set(n,{x:o.x,y:o.y,w:o.w,h:o.h,opacity:o.style.opacity??o.style.fillOpacity}):"wedge"===o.type&&this.prevPositionMap.set(n,{x:o.cx,y:o.cy,startAngle:o.startAngle,endAngle:o.endAngle,innerRadius:o.innerRadius,outerRadius:o.outerRadius,opacity:o.style.opacity??1}))}}startTransition(){if(!this.config.transition||0===this.prevPositionMap.size)return;const e=this.config.transition.duration??300;if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}let t=!1;const o=new Set,n=new Map;for(let e=0;this.scene.length>e;e++){const r=this.scene[e],i=this.getNodeKey(r,n);if(!i)continue;r._transitionKey=i;const s=this.prevPositionMap.get(i);if("point"===r.type)s?(o.add(i),r._targetOpacity=r.style.opacity??r.style.fillOpacity??1,(s.x!==r.x||s.y!==r.y||void 0!==s.r&&s.r!==r.r)&&(r._targetX=r.x,r._targetY=r.y,r._targetR=r.r,r.x=s.x,r.y=s.y,void 0!==s.r&&(r.r=s.r),t=!0)):(r._targetOpacity=r.style.opacity??r.style.fillOpacity??1,r._targetR=r.r,r.r=0,r.style={...r.style,opacity:0},t=!0);else if("rect"===r.type)s?(o.add(i),r._targetOpacity=r.style.opacity??r.style.fillOpacity??1,s.x===r.x&&s.y===r.y&&s.w===r.w&&s.h===r.h||(r._targetX=r.x,r._targetY=r.y,r._targetW=r.w,r._targetH=r.h,r.x=s.x,r.y=s.y,r.w=s.w??r.w,r.h=s.h??r.h,t=!0)):(r._targetOpacity=r.style.opacity??r.style.fillOpacity??1,r.style={...r.style,opacity:0},t=!0);else if("wedge"===r.type)if(s)o.add(i),r._targetOpacity=r.style.opacity??r.style.fillOpacity??1,s.startAngle===r.startAngle&&s.endAngle===r.endAngle||(r._targetStartAngle=r.startAngle,r._targetEndAngle=r.endAngle,r.startAngle=s.startAngle,r.endAngle=s.endAngle,t=!0);else{r._targetOpacity=r.style.opacity??r.style.fillOpacity??1,r._targetStartAngle=r.startAngle,r._targetEndAngle=r.endAngle;const e=r.startAngle;r.startAngle=e,r.endAngle=e,r.style={...r.style,opacity:0},this.prevPositionMap.set(i,{x:r.cx,y:r.cy,startAngle:e,endAngle:e,innerRadius:r.innerRadius,outerRadius:r.outerRadius,opacity:0}),t=!0}}this.exitNodes=[];for(const[e,n]of this.prevPositionMap)if(!o.has(e)){if(e.startsWith("p:"))this.exitNodes.push({type:"point",x:n.x,y:n.y,r:n.r??3,style:{opacity:n.opacity??1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("r:"))this.exitNodes.push({type:"rect",x:n.x,y:n.y,w:n.w??0,h:n.h??0,style:{opacity:n.opacity??1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("w:")){const t=((n.startAngle??0)+(n.endAngle??0))/2,o={type:"wedge",cx:n.x,cy:n.y,innerRadius:n.innerRadius??0,outerRadius:n.outerRadius??100,startAngle:n.startAngle??0,endAngle:n.endAngle??0,style:{opacity:n.opacity??1},datum:null,category:e.slice(2),_targetStartAngle:t,_targetEndAngle:t,_targetOpacity:0,_transitionKey:e};this.exitNodes.push(o)}t=!0}this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),t&&(this.activeTransition={startTime:this.currentTime(),duration:e})}advanceTransition(e){if(!this.activeTransition)return!1;const t=_o(e,this.activeTransition),o=Mo(t,"linear"===this.config.transition?.easing?"linear":"ease-out-cubic");for(const e of this.scene){const t=e._transitionKey;if(t)if("point"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t);e.style.opacity=Po(n?n.opacity??1:0,e._targetOpacity,o)}const n=this.prevPositionMap.get(t);void 0!==e._targetX&&n&&(e.x=Po(n.x,e._targetX,o),e.y=Po(n.y,e._targetY,o)),void 0!==e._targetR&&void 0!==n?.r&&(e.r=Po(n.r,e._targetR,o))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t);e.style.opacity=Po(n?n.opacity??1:0,e._targetOpacity,o)}if(void 0===e._targetX)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=Po(n.x,e._targetX,o),e.y=Po(n.y,e._targetY,o),void 0!==n.w&&(e.w=Po(n.w,e._targetW,o),e.h=Po(n.h,e._targetH,o))}else if("wedge"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t);e.style={...e.style,opacity:Po(n?n.opacity??1:0,e._targetOpacity,o)}}if(void 0!==e._targetStartAngle&&void 0!==e._targetEndAngle){const n=this.prevPositionMap.get(t);n&&void 0!==n.startAngle&&(e.startAngle=Po(n.startAngle,e._targetStartAngle,o),e.endAngle=Po(n.endAngle,e._targetEndAngle,o))}}}if(t>=1){for(const e of this.scene)if(void 0!==e._targetOpacity&&(e.style={...e.style||{},opacity:0===e._targetOpacity?0:e._targetOpacity},e._targetOpacity=void 0),"point"===e.type){if(void 0===e._targetX&&void 0===e._targetR)continue;void 0!==e._targetX&&(e.x=e._targetX,e.y=e._targetY),void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else"wedge"===e.type&&void 0!==e._targetStartAngle&&(e.startAngle=e._targetStartAngle,e.endAngle=e._targetEndAngle,e._targetStartAngle=void 0,e._targetEndAngle=void 0);if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}return this.activeTransition=null,!1}return!0}cancelIntroAnimation(){this.prevPositionMap.clear(),this.activeTransition=null,function(e){for(const t of e){if(void 0!==t._targetOpacity){const e=t._targetOpacity;t.style={...t.style||{},opacity:0===e?0:e},t._targetOpacity=void 0}"point"===t.type?void 0!==t._targetX?(t.x=t._targetX,t.y=t._targetY,void 0!==t._targetR&&(t.r=t._targetR),t._targetX=void 0,t._targetY=void 0,t._targetR=void 0):void 0!==t._targetR&&(t.r=t._targetR,t._targetR=void 0):"rect"===t.type?void 0!==t._targetX&&(t.x=t._targetX,t.y=t._targetY,t.w=t._targetW,t.h=t._targetH,t._targetX=void 0,t._targetY=void 0,t._targetW=void 0,t._targetH=void 0):"wedge"===t.type&&void 0!==t._targetStartAngle&&(t.startAngle=t._targetStartAngle,t.endAngle=t._targetEndAngle,t._targetStartAngle=void 0,t._targetEndAngle=void 0)}}(this.scene),this.exitNodes=[]}getBufferArray(){return this._bufferArrayCache?.version!==this._dataVersion&&(this._bufferArrayCache={version:this._dataVersion,data:this.buffer.toArray()}),this._bufferArrayCache.data}getData(){return this.buffer.toArray()}remove(e){if(!this.getDataId)throw Error("remove() requires dataIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=zt(e),o=this.getDataId,n=e=>t.has(o(e));Tn(this.buffer,this.timestampBuffer,n);const r=this.buffer.remove(n);if(0===r.length)return this.updateResults.recordNoop("remove"),r;for(const e of r)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach(e=>this.categories.add(this.getO(e))),this._dataVersion++,this.version++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("remove",r.length),r}update(e,t){if(!this.getDataId)throw Error("update() requires dataIdAccessor to be configured");const o=zt(e),n=this.getDataId,r=new Set;this.buffer.forEach((e,t)=>{o.has(n(e))&&r.add(t)});const i=this.buffer.update(e=>o.has(n(e)),t);if(0===i.length)return this.updateResults.recordNoop("update"),i;for(const e of i)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach((e,t)=>{this.categories.add(this.getO(e)),r.has(t)&&this.pushValueExtent(e)}),this._dataVersion++,this.version++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("update",i.length),i}clear(){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this._hasStreamingData=!1,this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this.scales=null,this.scene=[],this.columns={},this.multiScales=[],this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this._pointQuadtree=null,this._maxPointRadius=0,this.styleResolver.resetColors(),this._dataVersion++,this.version++,this.updateResults.recordData("clear")}get size(){return this.buffer.size}getOAccessor(){return this.getO}getRAccessor(){return this.getR}applyCustomRestyle(e,t){const o=this._customRestyle;if(o)for(const n of e){const e=this._baseStyles.get(n)??n.style??{},r=o(n,t);n.style=r?{...e,...r}:e}}restyleScene(e){this._customRestyle?(this.applyCustomRestyle(this.scene,e),this.updateResults.recordRestyle(!0)):this.updateResults.recordRestyle(!1)}rebuildAccessorDerivedState(){this.categories.clear(),this.rExtent.clear();for(const e of this.rExtents)e.clear();this._categoryIndexCache=null,this.buffer.forEach(e=>{this.categories.add(this.getO(e)),this.pushValueExtent(e)})}updateConfig(e){const t={...this.config},o=Object.keys(e).filter(o=>e[o]!==t[o]);"production"!==process.env.NODE_ENV&&!this.windowSizeWarned&&"windowSize"in e&&e.windowSize!==t.windowSize&&(this.windowSizeWarned=!0,console.warn(`[Semiotic] windowSize changed after mount (${t.windowSize} → ${e.windowSize}) but it is a mount-only setting — the ring buffer keeps its original capacity. Remount the chart (e.g. via a React key) to apply a new windowSize.`)),("colorScheme"in e&&e.colorScheme!==t.colorScheme||"themeCategorical"in e&&e.themeCategorical!==t.themeCategorical||"colorAccessor"in e&&!Nt(e.colorAccessor,t.colorAccessor))&&this.styleResolver.resetColors(),("categoryAccessor"in e&&!Nt(e.categoryAccessor,t.categoryAccessor)||"oAccessor"in e&&!Nt(e.oAccessor,t.oAccessor))&&(this._categoryIndexCache=null),Object.assign(this.config,e),"pulse"in e&&this.syncPulseTimestampBuffer();let n=!1;("categoryAccessor"in e||"oAccessor"in e)&&(Nt(this.config.categoryAccessor||this.config.oAccessor,t.categoryAccessor||t.oAccessor)||(this.getO=Ot(this.config.categoryAccessor||this.config.oAccessor,"category"),n=!0));let r=!1;if("valueAccessor"in e||"rAccessor"in e){const e=this.config.valueAccessor||this.config.rAccessor,o=t.valueAccessor||t.rAccessor,n=Array.isArray(e)?e:[e],i=Array.isArray(o)?o:[o];if(r=n.length!==i.length||n.some((e,t)=>!Nt(e,i[t])),r){const e=this.config.valueAccessor||this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>Dt(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new $t)):(this.getR=Dt(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!Nt(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?Ot(this.config.stackBy):void 0),"groupBy"in e&&!Nt(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?Ot(this.config.groupBy):void 0),"colorAccessor"in e&&!Nt(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?Ot(this.config.colorAccessor):void 0),"symbolAccessor"in e&&!Nt(e.symbolAccessor,t.symbolAccessor)&&(this.getSymbol=null!=this.config.symbolAccessor?Ot(this.config.symbolAccessor):void 0),"connectorAccessor"in e&&!Nt(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?Ot(this.config.connectorAccessor):void 0),(n||r||"accessorRevision"in e&&e.accessorRevision!==t.accessorRevision)&&this.rebuildAccessorDerivedState(),this.updateResults.recordConfig(o)}updateConfigWithResult(e){return this.updateConfig(e),this.updateResults.last}};function rh(e,t,o,n=30,r,i=0){let s=null;if(r){const e=Wr(r,t,o,n,i);e&&(s={datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const i of e){let e=null;switch(i.type){case"rect":if(null==i.datum)break;e=ih(i,t,o);break;case"point":if(r)break;e=sh(i,t,o,n);break;case"symbol":e=ah(i,t,o,n);break;case"glyph":e=lh(i,t,o,n);break;case"wedge":if(null===i.datum)break;e=ch(i,t,o);break;case"boxplot":e=uh(i,t,o);break;case"violin":e=dh(i,t,o)}e&&n>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}function ih(e,t,o){const n=Rr(t,o,e);return n.hit?{datum:e.datum,x:n.cx,y:e.y,distance:0,category:e.group}:null}function sh(e,t,o,n=30){const r=t-e.x,i=o-e.y,s=Math.sqrt(r*r+i*i);return s>jr(e.r,n)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function ah(e,t,o,n=30){const r=t-e.x,i=o-e.y,s=Math.sqrt(r*r+i*i);return s>jr(pn(e.size),n)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function lh(e,t,o,n=30){if(null==e.datum)return null;const r=zr(e.glyph,e.size),i=e.x+r.centerDx,s=e.y+r.centerDy,a=t-i,l=o-s,c=Math.sqrt(a*a+l*l);return c>jr(r.radius,n)?null:{datum:e.datum,x:i,y:s,distance:c}}function ch(e,t,o){const n=t-e.cx,r=o-e.cy,i=Math.sqrt(n*n+r*r);if(e.innerRadius>i||i>e.outerRadius)return null;const s=Ir(Math.atan2(r,n)),a=Ir(e.startAngle),l=Ir(e.endAngle);if(!(a>l?s>=a||l>=s:s>=a&&l>=s))return null;const c=(e.startAngle+e.endAngle)/2,u=(e.innerRadius+e.outerRadius)/2;return{datum:e.datum,x:e.cx+Math.cos(c)*u,y:e.cy+Math.sin(c)*u,distance:0,category:e.category}}function uh(e,t,o){const n=e.columnWidth/2;if("vertical"===e.projection){if(!(e.x-n>t||t>e.x+n||Math.min(e.minPos,e.maxPos)>o||o>Math.max(e.minPos,e.maxPos)))return{datum:e.datum,x:e.x,y:e.medianPos,distance:0,category:e.category,stats:e.stats}}else{const r=e.y-n,i=e.y+n;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||r>o||o>i))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category,stats:e.stats}}return null}function dh(e,t,o){if(!e.bounds)return null;const{x:n,y:r,width:i,height:s}=e.bounds;return n>t||t>n+i||r>o||o>r+s?null:{datum:e.datum,x:n+i/2,y:r+s/2,distance:0,category:e.category,stats:e.stats}}Fn(nh);var hh=require("react"),fh=require("react/jsx-runtime");function mh(e){const{width:t,height:o,totalWidth:n,totalHeight:r,margin:i,scales:s,showAxes:a,showGrid:l,rFormat:c}=e,{rTickValues:u,axisExtent:d}=e,h="radial"===s?.projection,f="horizontal"===s?.projection,m=(0,hh.useMemo)(()=>!s||h?[]:(u||Fa(s.r,5,d)).map(e=>({value:e,pixel:s.r(e),label:(c||ph)(e)})),[s,c,h,u,d]),p=l&&s&&!h,g=a&&s&&!h;return p||g?(0,fh.jsx)("svg",{width:n,height:r,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:(0,fh.jsxs)("g",{transform:`translate(${i.left},${i.top})`,children:[p&&(0,fh.jsx)("g",{className:"ordinal-grid",children:m.map((e,n)=>(0,fh.jsx)("line",{x1:f?e.pixel:0,y1:f?0:e.pixel,x2:f?e.pixel:t,y2:f?o:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+n))}),g&&(0,fh.jsx)(fh.Fragment,{children:(0,fh.jsxs)(fh.Fragment,f?{children:[(0,fh.jsx)("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),(0,fh.jsx)("line",{x1:0,y1:o,x2:t,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]}:{children:[(0,fh.jsx)("line",{x1:0,y1:o,x2:t,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),(0,fh.jsx)("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]})})]})}):null}function ph(e){return Math.round(100*e)/100+""}function gh(e){const{width:t,height:o,totalWidth:n,totalHeight:r,margin:i,scales:s,showAxes:a,showCategoryTicks:l,oLabel:c,rLabel:u,oFormat:d,rFormat:h,showGrid:f,title:m,legend:p,legendHoverBehavior:g,legendClickBehavior:y,legendHighlightedCategory:b,legendIsolatedCategories:v,legendPosition:x="right",legendLayout:k,foregroundGraphics:w,annotations:S,onAnnotationActivate:A,onObservation:C,chartId:M,chartType:_,autoPlaceAnnotations:P,svgAnnotationRules:R,xAccessor:j,yAccessor:L,annotationData:T,underlayRendered:I,canvasObscuresUnderlay:$=!0,children:N}=e,D=Ks({onAnnotationActivate:A,onObservation:C,chartId:M,chartType:_}),E="radial"===s?.projection,O="horizontal"===s?.projection,B=!1!==l,F=!I||$,z=(0,hh.useMemo)(()=>{if(!a||!B||!s||E)return[];const e=s.o.bandwidth(),t=s.o.domain().map((t,o)=>({value:t,pixel:(s.o(t)??0)+e/2,label:d?d(t,o):t}));if(2>=t.length)return t;const o=Math.abs(t[1].pixel-t[0].pixel)||e,n=t.map(e=>{return t=e.label,O?"string"==typeof t||"number"==typeof t?16:24:"string"==typeof t||"number"==typeof t?6.5*(t+"").length:60;var t}),r=O?0:6;if(n.every((e,t)=>0===t||o>=(n[t-1]+e)/2+r))return t;const i=Math.max(...n)+r,l=Math.max(1,Math.ceil(i/o));return 1===l?t:t.filter((e,t)=>t%l===0)},[a,B,s,d,E,O]),H=e.rTickValues,W=e.tickLabelEdgeAlign,q=e.axisExtent,Y=(0,hh.useMemo)(()=>a&&s&&!E?(H||Fa(s.r,5,q)).map(e=>({value:e,pixel:s.r(e),label:(h||ph)(e)})):[],[a,s,h,E,H,q]),G=(0,hh.useRef)(new Map),V=(0,hh.useRef)(S?.length??0),X=S?.length??0;V.current!==X&&(V.current=X,G.current=new Map);const U=(0,hh.useMemo)(()=>{if(!S||0===S.length)return null;const e=Pa(S),n=la(0,D),r="horizontal"===s?.projection,i=s?.o?e=>(s.o(e)??0)+s.o.bandwidth()/2:null,a={scales:s?{x:r?s.r:i||s.r,y:r&&i||s.r,time:s.r,value:s.r,o:s.o}:null,timeAxis:"x",xAccessor:j,yAccessor:L,width:t,height:o,data:T,frameType:"ordinal",projection:r?"horizontal":"vertical",stickyPositionCache:G.current};return aa(P?_a({annotations:e,context:a,..."object"==typeof P?P:{}}):e,n,R,a)},[S,P,R,t,o,s,j,L,T,D]);return a||m||p||w||U&&U.length>0||f||N?(0,fh.jsxs)("svg",{role:"img",width:n,height:r,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[(0,fh.jsx)("title",{children:"string"==typeof m?m:"Ordinal Chart"}),(0,fh.jsx)("desc",{children:"string"==typeof m?m+" (ordinal data visualization)":"Ordinal data visualization"}),(0,fh.jsxs)("g",{transform:`translate(${i.left},${i.top})`,children:[f&&s&&!E&&F&&(0,fh.jsx)("g",{className:"ordinal-grid",children:Y.map((e,n)=>(0,fh.jsx)("line",{x1:O?e.pixel:0,y1:O?0:e.pixel,x2:O?e.pixel:t,y2:O?o:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+n))}),a&&s&&!E&&(()=>{const e={fontSize:"var(--semiotic-tick-font-size, 12px)"},n={fontSize:"var(--semiotic-axis-label-font-size, 12px)"};return(0,fh.jsx)("g",{className:"ordinal-axes",children:(0,fh.jsxs)(fh.Fragment,O?{children:[(0,fh.jsxs)("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[F&&(0,fh.jsx)("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),z.map((t,o)=>(0,fh.jsxs)("g",{transform:`translate(0,${t.pixel})`,children:[(0,fh.jsx)("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?(0,fh.jsx)("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",fontSize:12,className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label}):(0,fh.jsx)("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:(0,fh.jsx)("div",{style:{textAlign:"right",userSelect:"none",...e},children:t.label})})]},"cat-"+o)),c&&(0,fh.jsx)("text",{x:15-i.left,y:o/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-i.left}, ${o/2})`,fontSize:12,className:"semiotic-axis-label",style:{userSelect:"none",...n},children:c})]}),(0,fh.jsxs)("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[F&&(0,fh.jsx)("line",{x1:0,y1:o,x2:t,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),F&&s?.r&&(()=>{const e=s.r(0);return e>1&&t-1>e?(0,fh.jsx)("line",{x1:e,y1:0,x2:e,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1,strokeDasharray:"4,4"}):null})(),Y.map((t,n)=>{const r=W?0===n?"start":n===Y.length-1?"end":"middle":"middle";return(0,fh.jsxs)("g",{transform:`translate(${t.pixel},${o})`,children:[(0,fh.jsx)("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),(0,fh.jsx)("text",{y:18,textAnchor:r,fill:"var(--semiotic-text-secondary, #666)",fontSize:12,className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label})]},"val-"+n)}),u&&(0,fh.jsx)("text",{x:t/2,y:o+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",fontSize:12,className:"semiotic-axis-label",style:{userSelect:"none",...n},children:u})]})]}:{children:[(0,fh.jsxs)("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[F&&(()=>{const e=s?.r?s.r(0):o,n=0>e||e>o?o:e;return(0,fh.jsx)("line",{x1:0,y1:n,x2:t,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),z.map((t,n)=>(0,fh.jsxs)("g",{transform:`translate(${t.pixel},${o})`,children:[(0,fh.jsx)("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?(0,fh.jsx)("text",{y:18,textAnchor:"middle",fill:"var(--semiotic-text-secondary, #666)",fontSize:12,className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label}):(0,fh.jsx)("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:(0,fh.jsx)("div",{style:{textAlign:"center",userSelect:"none",...e},children:t.label})})]},"cat-"+n)),c&&(0,fh.jsx)("text",{x:t/2,y:o+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",fontSize:12,className:"semiotic-axis-label",style:{userSelect:"none",...n},children:c})]}),(0,fh.jsxs)("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[F&&(0,fh.jsx)("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),Y.map((t,o)=>(0,fh.jsxs)("g",{transform:`translate(0,${t.pixel})`,children:[(0,fh.jsx)("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),(0,fh.jsx)("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",fontSize:12,className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label})]},"val-"+o)),u&&(0,fh.jsx)("text",{x:15-i.left,y:o/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-i.left}, ${o/2})`,fontSize:12,className:"semiotic-axis-label",style:{userSelect:"none",...n},children:u})]})]})})})(),U,w,N]}),m&&"string"==typeof m?(0,fh.jsx)("text",{x:n/2,y:22,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",fontSize:14,className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:m}):m?(0,fh.jsx)("foreignObject",{x:0,y:0,width:n,height:i.top,children:m}):null,ys({legend:p,totalWidth:n,totalHeight:r,margin:i,legendPosition:x,title:m,legendLayout:k,axisChrome:{hasAxis:!!a&&!E,hasAxisLabel:O?!!u:!!c},legendHoverBehavior:g,legendClickBehavior:y,legendHighlightedCategory:b,legendIsolatedCategories:v})]}):null}var yh=d(require("react")),bh=require("react/jsx-runtime"),vh=null,xh=null;function kh(e){const[t,o]=yh.useState(()=>vh);return yh.useEffect(()=>{if(t)return;let e=!1;return(vh?Promise.resolve(vh):(xh||(xh=Promise.resolve().then(()=>(q(),H)).then(e=>vh=e.OrdinalBrushOverlay).catch(e=>{throw xh=null,e})),xh)).then(t=>{e||o(()=>t)}),()=>{e=!0}},[t]),t?(0,bh.jsx)(t,{...e}):null}var wh=require("d3-shape");function Sh(e,t){const o=t._gradientBand.colors;if(0===o.length)return;const{clipPath:n,slices:r}=yl({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,cornerRadius:t.cornerRadius,roundStart:t.roundedEnds?.start??!0,roundEnd:t.roundedEnds?.end??!0,colors:o}),i=new Path2D(n);e.save(),e.translate(t.cx,t.cy),e.clip(i);for(const t of r)e.fillStyle=Ur(e,t.color)||t.color||"#007bff",e.fill(new Path2D(t.d));e.restore(),t.style.stroke&&"none"!==t.style.stroke&&(e.save(),e.translate(t.cx,t.cy),e.strokeStyle=Ur(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(i),e.restore())}function Ah(e,t){e.beginPath(),t.innerRadius>0?(e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerRadius,t.endAngle,t.startAngle,!0)):(e.moveTo(t.cx,t.cy),e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle)),e.closePath()}function Ch(e,t){const o={innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle+Math.PI/2,endAngle:t.endAngle+Math.PI/2},n=(0,wh.arc)().cornerRadius(t.cornerRadius)(o);if(!n)return;e.save(),e.translate(t.cx,t.cy);const r=new Path2D(n);e.fill(r),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(r),e.restore()}var Mh=(e,t,o,n)=>{const r=t.filter(e=>"wedge"===e.type);for(const t of r)if(e.globalAlpha=(t.style.fillOpacity??1)*(t.style.opacity??1),t._gradientBand&&t._gradientBand.colors.length>0)Sh(e,t),t._pulseIntensity&&t._pulseIntensity>0&&(Ah(e,t),_u(e,t)),e.globalAlpha=1;else{if(e.fillStyle=ci(e,t.style.fill,"#007bff"),t.roundedEnds){t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ur(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1);const o=gl({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,cornerRadius:t.cornerRadius,roundStart:t.roundedEnds.start,roundEnd:t.roundedEnds.end});e.save(),e.translate(t.cx,t.cy);const n=new Path2D(o);e.fill(n),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(n),e.restore()}else t.cornerRadius?(t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ur(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1),Ch(e,t)):(Ah(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ur(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()));t._pulseIntensity&&t._pulseIntensity>0&&(Ah(e,t),_u(e,t)),e.globalAlpha=1}},_h=(e,t,o,n)=>{const r=t.filter(e=>"boxplot"===e.type);for(const t of r){const o=t.columnWidth/2,n="vertical"===t.projection,r=Ur(e,"var(--semiotic-primary, #007bff)"),i=Ur(e,"var(--semiotic-text, #333)"),s=ci(e,t.style.fill,r),a=t.style.stroke,l="string"==typeof a?Ur(e,a)||a:i,c=t.style.strokeWidth||1,u=t.style.fillOpacity??t.style.opacity??.6;if(e.save(),e.strokeStyle=l,e.lineWidth=c,e.beginPath(),n?(e.moveTo(t.x,t.minPos),e.lineTo(t.x,t.maxPos)):(e.moveTo(t.minPos,t.y),e.lineTo(t.maxPos,t.y)),e.stroke(),e.beginPath(),n?(e.moveTo(t.x-.4*o,t.minPos),e.lineTo(t.x+.4*o,t.minPos),e.moveTo(t.x-.4*o,t.maxPos),e.lineTo(t.x+.4*o,t.maxPos)):(e.moveTo(t.minPos,t.y-.4*o),e.lineTo(t.minPos,t.y+.4*o),e.moveTo(t.maxPos,t.y-.4*o),e.lineTo(t.maxPos,t.y+.4*o)),e.stroke(),e.globalAlpha=u,e.fillStyle=s,n){const n=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-o,n,t.columnWidth,r),e.globalAlpha=1,e.strokeRect(t.x-o,n,t.columnWidth,r)}else{const n=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(n,t.y-o,r,t.columnWidth),e.globalAlpha=1,e.strokeRect(n,t.y-o,r,t.columnWidth)}e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),n?(e.moveTo(t.x-o,t.medianPos),e.lineTo(t.x+o,t.medianPos)):(e.moveTo(t.medianPos,t.y-o),e.lineTo(t.medianPos,t.y+o)),e.stroke(),e.restore()}},Ph=(e,t,o,n)=>{const r=t.filter(e=>"violin"===e.type);for(const t of r){e.save(),(t.translateX||t.translateY)&&e.translate(t.translateX,t.translateY);const o=new Path2D(t.pathString);if(e.globalAlpha=t.style.fillOpacity??t.style.opacity??.6,e.fillStyle=ci(e,t.style.fill,"#007bff"),e.fill(o),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ur(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(o)),t.iqrLine){e.strokeStyle="#333",e.lineWidth=2,e.globalAlpha=.8;const o=t.iqrLine.centerPos,n=!1!==t.iqrLine.isVertical;e.beginPath(),n?(e.moveTo(o,t.iqrLine.q1Pos),e.lineTo(o,t.iqrLine.q3Pos)):(e.moveTo(t.iqrLine.q1Pos,o),e.lineTo(t.iqrLine.q3Pos,o)),e.stroke(),e.beginPath(),n?e.arc(o,t.iqrLine.medianPos,3,0,2*Math.PI):e.arc(t.iqrLine.medianPos,o,3,0,2*Math.PI),e.fillStyle="#fff",e.fill(),e.strokeStyle="#333",e.lineWidth=1,e.stroke(),e.globalAlpha=1}e.restore()}},Rh=(e,t,o,n)=>{const r=t.filter(e=>"connector"===e.type);if(0===r.length)return;const i=new Map;for(const e of r){const t=e.group||"_default";i.has(t)||i.set(t,[]),i.get(t).push(e)}for(const[,t]of i){if(0===t.length)continue;const o=t[0].style;if(o.fill&&"none"!==o.fill){e.beginPath(),e.moveTo(t[0].x1,t[0].y1);for(const o of t)e.lineTo(o.x2,o.y2);e.closePath(),e.globalAlpha=o.fillOpacity??o.opacity??.3,e.fillStyle=ui(e,o.fill)??"#999",e.fill(),e.globalAlpha=1}for(const o of t)e.beginPath(),e.moveTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.strokeStyle=Ur(e,o.style.stroke)||ci(e,o.style.fill,"")||Ur(e,"var(--semiotic-border, #999)"),e.lineWidth=o.style.strokeWidth||1,e.globalAlpha=o.style.opacity??.5,e.stroke(),e.globalAlpha=1}},jh=(e,t,o,n)=>{const r=t.filter(e=>"trapezoid"===e.type);for(const t of r){const o=t.points;if(o.length>=4){e.globalAlpha=t.style?.opacity??1,e.beginPath(),e.moveTo(o[0][0],o[0][1]);for(let t=1;o.length>t;t++)e.lineTo(o[t][0],o[t][1]);e.closePath(),e.fillStyle=ui(e,t.style?.fill)||"#999",e.fill(),t.style?.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ur(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}};function Lh(e){return 1e6>e?1e4>e?1e3>e?e+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function Th(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}var Ih=new Map;function $h(e,t){const o=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,n=Ih.get(o);if(void 0!==n)return n;const r=Jr({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t),i=ti(r)?null:r;return Ih.set(o,i),i}function Nh(e,t,o,n,r,i){e.moveTo(t+i,o),e.lineTo(t+n-i,o),e.quadraticCurveTo(t+n,o,t+n,o+i),e.lineTo(t+n,o+r-i),e.quadraticCurveTo(t+n,o+r,t+n-i,o+r),e.lineTo(t+i,o+r),e.quadraticCurveTo(t,o+r,t,o+r-i),e.lineTo(t,o+i),e.quadraticCurveTo(t,o,t+i,o),e.closePath()}function Dh(e){return 1e6>e?1e4>e?1e3>e?Math.round(e)+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function Eh(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}function Oh(e){return"rect"===e.type||"point"===e.type||"symbol"===e.type||"glyph"===e.type}function Bh(e){return(t,o,n,r)=>{e(t,o.filter(Oh),{x:n.r,y:n.r},r)}}var Fh=Bh(zu),zh=Bh(Tu),Hh=Bh(Nu),Wh=Bh(Eu),qh=e=>[Rh,...e],Yh={bar:qh([Fh]),clusterbar:qh([Fh]),point:qh([zh,Hh]),swarm:qh([zh,Hh]),pie:[Mh],donut:[Mh],boxplot:qh([_h,zh]),violin:qh([Ph]),histogram:qh([Fh]),ridgeline:qh([Ph]),timeline:qh([Fh]),funnel:[Fh,jh,(e,t,o,n)=>{const r=t.filter(e=>"rect"===e.type&&null!=e.datum);if(0!==r.length&&r.some(e=>null!=e.datum?.__funnelStepLabel||null!=e.datum?.__funnelValueLabelX)){e.textBaseline="top",e.lineJoin="round",e.textAlign="center",e.font="bold 14px sans-serif";for(const t of r){const o=t.datum;if(!o)continue;if(!o.__funnelStepLabel)continue;const n=o.__funnelStepLabel;if(e.measureText(n).width+16>(o.__funnelRowWidth??o.__funnelBarW??0))continue;const r=o.__funnelStepLabelX,i=o.__funnelStepLabelY+3;e.strokeStyle="rgba(0,0,0,0.6)",e.lineWidth=3,e.strokeText(n,r,i),e.fillStyle="#fff",e.fillText(n,r,i)}e.font="bold 13px sans-serif";for(const t of r){const o=t.datum;if(!o)continue;if(null==o.__funnelValueLabelX)continue;const n=o.__funnelBarW??0;if(60>n)continue;const r=o.__funnelValue;if(null==r||0===r)continue;const i=o.__funnelPercent,s=!0===o.__funnelIsFirstStep;let a;if(a=s?Lh(r):null!=i?`${Lh(r)} (${Th(i)})`:Lh(r),e.measureText(a).width+16>n){if(s||null==i)continue;if(a=Lh(r),e.measureText(a).width+16>n)continue}const l=o.__funnelValueLabelX,c=(o.__funnelValueLabelY??t.y)+14+5;e.textAlign="center",e.strokeStyle="rgba(0,0,0,0.5)",e.lineWidth=3,e.strokeText(a,l,c),e.fillStyle="#fff",e.fillText(a,l,c)}e.lineWidth=1,e.lineJoin="miter"}}],"bar-funnel":[Fh,(e,t,o,n)=>{const r=t.filter(e=>"rect"===e.type&&!0===e.datum?.__barFunnelIsDropoff);for(const t of r){const o=("string"==typeof t.style.fill?t.style.fill:null)||Ur(e,"var(--semiotic-border, #999)"),n=$h(o,e);e.globalAlpha=t.style.opacity??1,e.beginPath(),e.rect(t.x,t.y,t.w,t.h),n?e.fillStyle=n:(e.fillStyle=o,e.globalAlpha=.4*(t.style.opacity??1)),e.fill(),e.globalAlpha=1}},(e,t,o,n)=>{const r=t.filter(e=>"rect"===e.type&&!0!==e.datum?.__barFunnelIsDropoff&&null!=e.datum?.__barFunnelLabelX);if(0===r.length)return;const i=function(e,t){const[o,n,r]=Kr(e,t);return(.2126*o+.7152*n+.0722*r)/255>.6}(e,Ur(e,"var(--semiotic-text, #333)")),s=i?"#1f2937":"#ffffff",a=i?"rgba(255,255,255,0.18)":"rgba(0,0,0,0.12)",l=i?"#f3f4f6":"#1a1a1a",c=l;for(const t of r){const o=t.datum;if(!o)continue;const n=o.__barFunnelValue;if(null==n)continue;if(25>t.w)continue;const r=o.__barFunnelPercent,i=!(!0===o.__barFunnelIsFirstStep)&&null!=r,u=i?Eh(r):"",d=Dh(n);e.font="bold 13px sans-serif";const h=i?e.measureText(u).width:0;e.font="11px sans-serif";const f=e.measureText(d).width,m=Math.max(h,f)+12,p=i?32:17,g=o.__barFunnelLabelX,y=g-m/2,b=o.__barFunnelLabelY-p-4;e.save(),e.shadowColor="rgba(0,0,0,0.15)",e.shadowBlur=4,e.shadowOffsetY=1,e.fillStyle=s,e.beginPath(),Nh(e,y,b,m,p,4),e.fill(),e.restore(),e.strokeStyle=a,e.lineWidth=.5,e.beginPath(),Nh(e,y,b,m,p,4),e.stroke(),e.textAlign="center",e.textBaseline="top",i?(e.font="bold 13px sans-serif",e.fillStyle=l,e.fillText(u,g,b+3),e.font="11px sans-serif",e.fillStyle=c,e.fillText(d,g,b+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle=l,e.fillText(d,g,b+3))}e.lineWidth=1}],swimlane:qh([Fh]),custom:qh([Fh,zh,Hh,Wh,Mh,_h,Ph,jh])},Gh=require("react/jsx-runtime");function Vh(e){const t=jc(e,{skipPositional:!1});return null==t.title&&0===t.entries.length?null:(0,Gh.jsxs)("div",{className:"semiotic-tooltip",style:Tc,children:[null!=t.title&&(0,Gh.jsx)("div",{style:{fontWeight:"bold"},children:t.title+""}),t.entries.map(e=>(0,Gh.jsxs)("div",{children:[(0,Gh.jsxs)("span",{style:{opacity:.7},children:[e.key,":"]})," ","number"==typeof e.value?e.value.toLocaleString():e.value+""]},e.key))]})}function Xh({hover:e}){const t=e.data||{},o=e.stats,n=e.category;if(Array.isArray(t)){const e=n||t[0]?.category||"";if(o)return(0,Gh.jsxs)("div",{className:"semiotic-tooltip",style:Tc,children:[e&&(0,Gh.jsx)("div",{style:{fontWeight:"bold"},children:e+""}),(0,Gh.jsxs)("div",{children:["n = ",o.n]}),(0,Gh.jsxs)("div",{children:["Min: ",o.min.toLocaleString()]}),(0,Gh.jsxs)("div",{children:["Q1: ",o.q1.toLocaleString()]}),(0,Gh.jsxs)("div",{children:["Median: ",o.median.toLocaleString()]}),(0,Gh.jsxs)("div",{children:["Q3: ",o.q3.toLocaleString()]}),(0,Gh.jsxs)("div",{children:["Max: ",o.max.toLocaleString()]}),(0,Gh.jsxs)("div",{style:{opacity:.8},children:["Mean: ",o.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});const r=t.length;return(0,Gh.jsxs)("div",{className:"semiotic-tooltip",style:Tc,children:[e&&(0,Gh.jsx)("div",{style:{fontWeight:"bold"},children:e+""}),(0,Gh.jsxs)("div",{children:[r," items"]})]})}if(null!=t.bin&&null!=t.count){const e=t.range||[];return(0,Gh.jsxs)("div",{className:"semiotic-tooltip",style:Tc,children:[t.category&&(0,Gh.jsx)("div",{style:{fontWeight:"bold"},children:t.category+""}),(0,Gh.jsxs)("div",{children:["Count: ",t.count]}),2===e.length&&(0,Gh.jsxs)("div",{style:{opacity:.8},children:[Number(e[0]).toFixed(1)," – ",Number(e[1]).toFixed(1)]})]})}const r=e.__oAccessor,i=e.__rAccessor,s=e.__chartType;if("swarm"===s||"point"===s)return Vh(t);const a=(r&&null!=t[r]?t[r]:null)||t.category||t.name||t.group||t.__rName||"",l=t.__aggregateValue??(i&&null!=t[i]?t[i]:null)??t.value??t.__rValue??t.pct??"";return a||""!==l?(0,Gh.jsxs)("div",{className:"semiotic-tooltip",style:Tc,children:[a&&(0,Gh.jsx)("div",{style:{fontWeight:"bold"},children:a+""}),""!==l&&(0,Gh.jsx)("div",{children:"number"==typeof l?l.toLocaleString():l+""})]}):Vh(t)}Xh.ownsChrome=!0;var Uh=require("react/jsx-runtime"),Kh={top:50,right:40,bottom:60,left:70},Qh=(0,Td.memo)((0,Td.forwardRef)(function(e,t){const{chartType:o,runtimeMode:n,data:r,oAccessor:i="category",rAccessor:s="value",colorAccessor:a,symbolAccessor:l,symbolMap:c,stackBy:u,groupBy:d,multiAxis:h,timeAccessor:f,valueAccessor:m,categoryAccessor:p,accessorRevision:g,projection:y="vertical",size:b=[600,400],responsiveWidth:v,responsiveHeight:x,margin:k,maxDevicePixelRatio:w,barPadding:S,roundedTop:A,gradientFill:C,trackFill:M,baselinePadding:_,innerRadius:P,cornerRadius:R,normalize:j,startAngle:L,sweepAngle:T,dynamicColumnWidth:I,bins:$,showOutliers:N,showIQR:D,amplitude:E,connectorOpacity:O,showLabels:B,connectorAccessor:F,connectorStyle:z,dataIdAccessor:H,rExtent:W,oExtent:q,extentPadding:Y=.05,oSort:G,windowMode:V="sliding",windowSize:X=200,pieceStyle:U,summaryStyle:K,renderMode:Q,colorScheme:Z,barColors:J,showAxes:ee=!0,showCategoryTicks:te,categoryLabel:oe,valueLabel:ne,categoryFormat:re,valueFormat:ie,oLabel:se,rLabel:ae,oFormat:le,rFormat:ce,rTickValues:ue,tickLabelEdgeAlign:de,axisExtent:he,enableHover:fe=!0,hoverAnnotation:me,tooltipContent:pe,customHoverBehavior:ge,customClickBehavior:ye,onObservation:be,annotationObservationCallback:ve,chartId:xe,annotations:ke,onAnnotationActivate:we,autoPlaceAnnotations:Se,svgAnnotationRules:Ae,showGrid:Ce=!1,legend:Me,legendHoverBehavior:_e,legendClickBehavior:Pe,legendHighlightedCategory:Re,legendIsolatedCategories:je,legendPosition:Le,legendLayout:Te,legendCategoryAccessor:Ie,onCategoriesChange:$e,backgroundGraphics:Ne,foregroundGraphics:De,title:Ee,className:Oe,background:Be,centerContent:Fe,decay:ze,pulse:He,transition:We,animate:qe,staleness:Ye,frameScheduler:Ge,clock:Ve,random:Xe,seed:Ue,paused:Ke=!1,suspendWhenHidden:Qe=!0,brush:Ze,onBrush:Je,accessibleTable:et=!0,description:tt,summary:ot,customLayout:nt,onLayoutError:rt,layoutConfig:it,layoutSelection:st}=e,{customHoverBehavior:at,customClickBehavior:lt,hasClickBehavior:ct}=pd({customHoverBehavior:ge,customClickBehavior:ye,onObservation:be,chartId:xe,chartType:"StreamOrdinalFrame"}),ut=p??i,dt=m??s,ht=(0,Td.useRef)(!0),ft=nu({sizeProp:b,responsiveWidth:v,responsiveHeight:x,userMargin:k,marginDefault:Kh,title:Ee,legend:Me,legendPosition:Le,animate:qe,transitionProp:We,frameScheduler:Ge,clock:Ve,random:Xe,seed:Ue,paused:Ke,suspendWhenHidden:Qe,themeDirtyRef:ht}),{reducedMotionRef:mt,responsiveRef:pt,size:gt,margin:vt,adjustedWidth:xt,adjustedHeight:kt,currentTheme:wt,transition:St,introEnabled:Ct,tableId:Mt,rafRef:_t,renderFnRef:Pt,scheduleRender:Rt,frameRuntime:jt}=ft,Lt=Ml(),Tt=jl(),It=(0,Td.useMemo)(()=>yt(r),[r]),$t=oe??se,Nt=ne??ae,Dt=re??le,Et=ie??ce,Ot=(0,Td.useRef)(null),[Bt,Ft]=(0,Td.useState)(null),[zt,Ht]=(0,Td.useState)(null),Wt=hu(De,gt,vt,zt),qt=hu(Ne,gt,vt,zt),Yt=Ne||"transparent"===Be?null:(0,Uh.jsx)("rect",{className:"semiotic-canvas-background","data-semiotic-layer":"canvas-background",x:-vt.left,y:-vt.top,width:gt[0],height:gt[1],fill:Be||"var(--semiotic-bg, transparent)"}),[Gt,Vt]=(0,Td.useState)(0),Xt=(0,Td.useRef)(0),[Ut,Kt]=(0,Td.useState)(!1),Qt=(0,Td.useRef)({w:-1,h:-1}),Zt=(0,Td.useRef)(!1),Jt=pr("StreamOrdinalFrame"),eo=fe||me,to="streaming"===n,oo=Tl((0,Td.useMemo)(()=>({chartType:o,runtimeMode:to?"streaming":"bounded",windowSize:X,windowMode:V,extentPadding:Y,projection:y,oAccessor:to?void 0:ut,rAccessor:to?void 0:dt,accessorRevision:g,colorAccessor:a,symbolAccessor:l,symbolMap:c,stackBy:u,groupBy:d,multiAxis:h,timeAccessor:to?f:void 0,valueAccessor:to?m||("string"==typeof dt||"function"==typeof dt?dt:void 0):void 0,categoryAccessor:to?ut:void 0,rExtent:W,oExtent:q,axisExtent:he,barPadding:S,roundedTop:A,gradientFill:ln(C),trackFill:M,baselinePadding:_,innerRadius:P,cornerRadius:R,normalize:j,startAngle:L,sweepAngle:T,dynamicColumnWidth:I,bins:$,showOutliers:N,showIQR:D,amplitude:E,connectorOpacity:O,showLabels:B,connectorAccessor:F,connectorStyle:z,dataIdAccessor:H,oSort:G,pieceStyle:U,summaryStyle:K,colorScheme:Z,themeCategorical:wt?.colors?.categorical,themeSemantic:At(wt),themeSequential:wt?.colors?.sequential,themeDiverging:wt?.colors?.diverging,barColors:J,decay:ze,pulse:He,transition:St,introAnimation:Ct,staleness:Ye,clock:jt.now,customLayout:nt,onLayoutError:rt,layoutConfig:it,layoutMargin:vt}),[o,to,X,V,Y,y,ut,dt,g,a,l,c,u,d,h,f,m,W,q,he,S,A,C,M,_,P,R,j,L,T,I,$,N,D,E,O,B,F,z,H,G,U,K,Z,wt,J,ze,He,St,Ct,Ye,jt.now,nt,rt,it,vt])),no=(0,Td.useRef)(null);no.current||(no.current=new nh(oo));const ro=mu(no,Ie,$e,e=>e.getData());_r(no,oo,ht,Rt),Pr(no,st,ht,Rt);const io=(0,Td.useRef)(null);io.current||(io.current=new bt(e=>{const t=no.current;t&&t.ingest(e)&&(ht.current=!0,Rt())}));const so=(0,Td.useCallback)(e=>{io.current?.push(e)},[]),ao=(0,Td.useCallback)(e=>{io.current?.pushMany(e)},[]),lo=(0,Td.useCallback)(()=>{io.current?.clear(),no.current?.clear(),ht.current=!0,Rt()},[Rt]),co=(0,Td.useCallback)(e=>{io.current?.clearLastData(),io.current?.setReplacementData(e)},[]);(0,Td.useImperativeHandle)(t,()=>({push:so,pushMany:ao,replace:co,remove:e=>{io.current?.flush();const t=no.current?.remove(e)??[];if(t.length>0){const e=Ot.current?.data;!!Ot.current&&t.some(Array.isArray(e)?t=>e.includes(t):t=>t===e)&&(Ot.current=null,Ft(null)),ht.current=!0,Rt()}return t},update:(e,t)=>{io.current?.flush();const o=no.current?.update(e,t)??[];return o.length>0&&(ht.current=!0,Rt()),o},clear:lo,getData:()=>(io.current?.flush(),no.current?.getData()??[]),getScales:()=>no.current?.scales??null,getCustomLayout:()=>no.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>no.current?.lastCustomLayoutFailure??null}),[so,ao,co,lo,Rt]),(0,Td.useEffect)(()=>{r&&io.current?.setBoundedData(It)},[r,It]);const{canvasRef:uo,resolutionDirtyRef:ho}=cu(ft,{storeRef:no,dirtyRef:ht,hydrated:Lt,wasHydratingFromSSR:Tt,cleanup:()=>io.current?.clear(),maxDevicePixelRatio:w,canvasPaintDependencies:[o,xt,kt,ee,Be,Ne,Q,Rt]}),{hoverHandlerRef:fo,hoverLeaveRef:mo,onPointerMove:po,onPointerLeave:go}=ft;fo.current=e=>{if(!eo)return;const t=uo.current;if(!t)return;const n=t.getBoundingClientRect(),r=e.clientX-n.left-vt.left,i=e.clientY-n.top-vt.top;if(0>r||r>xt||0>i||i>kt)return void(Ot.current&&(Ot.current=null,Ft(null),at&&at(null),Rt()));const s=no.current;if(!s||0===s.scene.length)return;const a="radial"===y,l=rh(s.scene,a?r-xt/2:r,a?i-kt/2:i,30,s.pointQuadtree,s.maxPointRadius);if(!l)return void(Ot.current&&(Ot.current=null,Ft(null),at&&at(null),Rt()));const c=Ac(l.datum||{},l.x,l.y,{...l.stats&&{stats:l.stats},...l.category&&{category:l.category},__oAccessor:"string"==typeof ut?ut:void 0,__rAccessor:"string"==typeof dt?dt:void 0,__chartType:o});Ot.current=c,Ft(c),at?.(c),Rt()},mo.current=()=>{Ot.current&&(Ot.current=null,Ft(null),at?.(null),Rt())};const yo=(0,Td.useCallback)(e=>{if(Js(e.target))return;if(!lt)return;const t=uo.current;if(!t)return lt(null),void Rt();const n=t.getBoundingClientRect(),r=e.clientX-n.left-vt.left,i=e.clientY-n.top-vt.top;if(0>r||r>xt||0>i||i>kt)return lt(null),void Rt();const s=no.current;if(!s||0===s.scene.length)return lt(null),void Rt();const a="radial"===y,l=rh(s.scene,a?r-xt/2:r,a?i-kt/2:i,30,s.pointQuadtree,s.maxPointRadius);if(!l)return lt(null),void Rt();lt(Ac(l.datum||{},l.x,l.y,{...l.stats&&{stats:l.stats},...l.category&&{category:l.category},__oAccessor:"string"==typeof ut?ut:void 0,__rAccessor:"string"==typeof dt?dt:void 0,__chartType:o}),{type:"activate",inputType:ud(e.nativeEvent.pointerType)}),Rt()},[lt,uo,vt.left,vt.top,xt,kt,y,ut,dt,o,Rt]),{kbFocusIndexRef:bo,focusedNavPointRef:vo,onKeyDown:xo}=function({chartType:e,oAccessor:t,rAccessor:o,...n}){return Cd({...n,extractPoints:wd,toHover:n=>({...Ad(n),__oAccessor:"string"==typeof t?t:void 0,__rAccessor:"string"==typeof o?o:void 0,__chartType:e})})}({storeRef:no,hoverRef:Ot,setHoverPoint:Ft,customHoverBehavior:at,customClickBehavior:lt,scheduleRender:Rt,chartType:o,oAccessor:ut,rAccessor:dt}),ko=(0,Td.useCallback)(e=>{bo.current=-1,vo.current=null,po(e)},[vo,bo,po]);Pt.current=()=>{if(_t.current=null,!jt.isActive)return;const e=uo.current;if(!e)return;const t=e.getContext("2d");if(!t)return;const n=no.current;if(!n)return;const r=jt.now(),i=n.advanceTransition(mt.current?r+1e6:r),s=!mt.current&&i,a=Qt.current.w!==xt||Qt.current.h!==kt,l=ht.current;let c=!1;const u=Jt.current.beforeCompute(n.getLastUpdateResult(),s);!l&&!a||s&&!a||(n.computeScene({width:xt,height:kt}),Qt.current={w:xt,h:kt},c=!0,ro()),Jt.current.afterCompute(u,c,a),ht.current=l&&s&&!c,ho.current=!1;const d=du(n,r,c,Zt);(c||s)&&e.setAttribute("aria-label",Jl(n.scene,o+" chart"));const h=su(w),f=gt[0]*h,m=gt[1]*h;e.width===f&&e.height===m||(e.width=f,e.height=m,e.style.width=gt[0]+"px",e.style.height=gt[1]+"px"),t.setTransform(h,0,0,h,0,0),t.clearRect(0,0,gt[0],gt[1]);const p=Ye&&n.lastIngestTime>0&&r-n.lastIngestTime>(Ye?.threshold??5e3);p&&(t.globalAlpha=Ye?.dimOpacity??.5);const g="radial"===y;t.save(),t.beginPath(),t.rect(vt.left,vt.top,xt,kt),t.clip(),g?(t.save(),t.translate(vt.left+xt/2,vt.top+kt/2)):t.translate(vt.left,vt.top);const b=nt?Yh.custom:Yh[o]||[],v={width:xt,height:kt},x=n.scales;x&&Qu({context:t,nodes:n.scene,renderMode:Q,pixelRatio:h,paintBuiltIn:e=>{for(const o of b)o(t,e,x,v)}}),g&&t.restore(),t.restore(),p&&(t.globalAlpha=1),c&&n.scales?(Ht(n.scales),Vt(e=>e+1),Xt.current=r):s&&n.scales&&r-Xt.current>=33&&(Vt(e=>e+1),Xt.current=r),Ye?.showBadge&&Kt(!!p),(s||null!=n.activeTransition||d.pending)&&Rt()},$i(Ye,no,ht,Rt,Ut,Kt);const wo=eo&&Bt?pe?pe(Bt):(0,Uh.jsx)(Xh,{hover:Bt}):null,So="radial"===y,Ao=wo?(0,Uh.jsx)(Wc,{x:Bt?So?Bt.x+xt/2:Bt.x:0,y:Bt?So?Bt.y+kt/2:Bt.y:0,containerWidth:xt,containerHeight:kt,margin:vt,className:"stream-ordinal-tooltip",children:wo}):null,Co="horizontal"===y?ut:dt,Mo=pu("horizontal"===y?dt:ut,void 0,"__semiotic_resolvedO",""),_o=pu(Co,void 0,"__semiotic_resolvedR",""),Po=Mo.key,Ro=_o.key,jo=gu(Mo,_o,ke&&ke.length>0||!1);if(Sl||!Lt&&Tt){const e=no.current;e&&r&&(e.ingest({inserts:It,bounded:!0}),e.computeScene({width:xt,height:kt}));const t=e?.scene??[],o=e?.scales??null,n=hu(De,gt,vt,o),i=hu(Ne,gt,vt,o),s="radial"===y,a=s?vt.left+xt/2:vt.left,l=s?vt.top+kt/2:vt.top;return(0,Uh.jsxs)("div",{ref:pt,className:"stream-ordinal-frame"+(Oe?" "+Oe:""),role:"img","aria-label":tt||("string"==typeof Ee?Ee:"Ordinal chart"),style:{position:"relative",width:v?"100%":gt[0],height:x?"100%":gt[1]},children:[(0,Uh.jsx)(gc,{summary:ot}),(0,Uh.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:gt[0],height:gt[1],style:{position:"absolute",left:0,top:0},children:[i&&(0,Uh.jsx)("g",{transform:`translate(${vt.left},${vt.top})`,children:i}),(0,Uh.jsxs)("g",{transform:`translate(${a},${l})`,children:[Be&&(0,Uh.jsx)("rect",{x:0,y:0,width:xt,height:kt,fill:Be}),t.map((e,t)=>Zu({node:e,index:t,renderMode:Q,fallback:()=>function(e,t,o){const n=("category"in e?e.category:void 0)||("group"in e?e.group:void 0)||"",r=o=>`ord-${e.type}-${n}-${t}-${o}`,i=`ord-${e.type}-${n}-${t}`;switch(e.type){case"rect":{const t=e,o=sl(i)+"-grad",n=function(e,t){const o=e.fillGradient;if(!o||"object"!=typeof o)return null;let n=e.x,r=e.y,i=e.x,s=e.y+e.h;"bottom"===e.roundedEdge?(r=e.y+e.h,s=e.y):"right"===e.roundedEdge?(n=e.x+e.w,r=e.y,i=e.x,s=e.y):"left"===e.roundedEdge&&(n=e.x,r=e.y,i=e.x+e.w,s=e.y);const a=ll(o.stops,il(e.style.fill));return a?(0,nl.jsx)("linearGradient",{id:t,gradientUnits:"userSpaceOnUse",x1:n,y1:r,x2:i,y2:s,children:a}):null}(t,o);let r,s;if(n)s=`url(#${o})`;else if(ti(t.style.fill)){const e=sl(i)+"-hatch";r=ii(t.style.fill,e),s=`url(#${e})`}else s=il(t.style.fill);const a=n||r?(0,bl.jsxs)("defs",{children:[n,r]}):null;if(t.cornerRadii&&tl(t.cornerRadii)){const e=function(e){const{x:t,y:o,w:n,h:r}=e,{tl:i,tr:s,br:a,bl:l}=ol(e);let c=`M${t+i},${o}`;return c+=` L${t+n-s},${o}`,s>0&&(c+=` A${s},${s} 0 0 1 ${t+n},${o+s}`),c+=` L${t+n},${o+r-a}`,a>0&&(c+=` A${a},${a} 0 0 1 ${t+n-a},${o+r}`),c+=` L${t+l},${o+r}`,l>0&&(c+=` A${l},${l} 0 0 1 ${t},${o+r-l}`),c+=` L${t},${o+i}`,i>0&&(c+=` A${i},${i} 0 0 1 ${t+i},${o}`),c+=" Z",c}(t);return(0,bl.jsxs)(fl.Fragment,{children:[a,(0,bl.jsx)("path",{d:e,fill:s,opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})]},i)}if(t.roundedTop&&t.roundedTop>0){const e=Math.min(t.roundedTop,t.w/2,t.h/2),{x:o,y:n,w:r,h:l}=t;let c;switch(t.roundedEdge){case"right":c=`M${o},${n} L${o+r-e},${n} A${e},${e} 0 0 1 ${o+r},${n+e} L${o+r},${n+l-e} A${e},${e} 0 0 1 ${o+r-e},${n+l} L${o},${n+l} Z`;break;case"left":c=`M${o+r},${n} L${o+e},${n} A${e},${e} 0 0 0 ${o},${n+e} L${o},${n+l-e} A${e},${e} 0 0 0 ${o+e},${n+l} L${o+r},${n+l} Z`;break;case"bottom":c=`M${o},${n} L${o+r},${n} L${o+r},${n+l-e} A${e},${e} 0 0 1 ${o+r-e},${n+l} L${o+e},${n+l} A${e},${e} 0 0 1 ${o},${n+l-e} Z`;break;default:c=`M${o},${n+l} L${o},${n+e} A${e},${e} 0 0 1 ${o+e},${n} L${o+r-e},${n} A${e},${e} 0 0 1 ${o+r},${n+e} L${o+r},${n+l} Z`}return(0,bl.jsxs)(fl.Fragment,{children:[a,(0,bl.jsx)("path",{d:c,fill:s,opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})]},i)}return(0,bl.jsxs)(fl.Fragment,{children:[a,(0,bl.jsx)("rect",{x:t.x,y:t.y,width:t.w,height:t.h,fill:s,opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth}),xl(t,i)]},i)}case"point":{const t=e;return(0,bl.jsx)("circle",{cx:t.x,cy:t.y,r:t.r,fill:il(t.style.fill),opacity:t.style.opacity??t.style.fillOpacity??.8,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},i)}case"symbol":return cl(e,t,o);case"glyph":return al(e,e.x,e.y,`${o??""}ord-glyph-${e.pointId??t}`);case"wedge":{const n=e;if(n._gradientBand&&n._gradientBand.colors.length>0){const e=sl(`${o?o+"-":""}gauge-grad-${n.category||i}-${t}`),{clipPath:r,slices:s}=yl({innerRadius:n.innerRadius,outerRadius:n.outerRadius,startAngle:n.startAngle,endAngle:n.endAngle,cornerRadius:n.cornerRadius,roundStart:n.roundedEnds?.start??!0,roundEnd:n.roundedEnds?.end??!0,colors:n._gradientBand.colors});return(0,bl.jsxs)("g",{transform:`translate(${n.cx},${n.cy})`,opacity:n.style.opacity,fillOpacity:n.style.fillOpacity,children:[(0,bl.jsx)("defs",{children:(0,bl.jsx)("clipPath",{id:e,children:(0,bl.jsx)("path",{d:r})})}),(0,bl.jsx)("g",{clipPath:`url(#${e})`,children:s.map((e,t)=>(0,bl.jsx)("path",{d:e.d,fill:il(e.color)},t))}),n.style.stroke&&"none"!==n.style.stroke&&(0,bl.jsx)("path",{d:r,fill:"none",stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})]},i)}let r;if(n.roundedEnds)r=gl({innerRadius:n.innerRadius,outerRadius:n.outerRadius,startAngle:n.startAngle,endAngle:n.endAngle,cornerRadius:n.cornerRadius,roundStart:n.roundedEnds.start,roundEnd:n.roundedEnds.end});else{const e=(0,ml.arc)().innerRadius(n.innerRadius).outerRadius(n.outerRadius).startAngle(n.startAngle+Math.PI/2).endAngle(n.endAngle+Math.PI/2);n.cornerRadius&&e.cornerRadius(n.cornerRadius),r=e(rl)||""}return(0,bl.jsx)("path",{d:r,transform:`translate(${n.cx},${n.cy})`,fill:il(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},i)}case"boxplot":{const t=e,o=t.columnWidth/2;return(0,bl.jsxs)("g","vertical"===t.projection?{children:[(0,bl.jsx)("line",{x1:t.x,y1:t.minPos,x2:t.x,y2:t.maxPos,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,bl.jsx)("rect",{x:t.x-o,y:Math.min(t.q1Pos,t.q3Pos),width:t.columnWidth,height:Math.abs(t.q3Pos-t.q1Pos),fill:il(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,bl.jsx)("line",{x1:t.x-o,y1:t.medianPos,x2:t.x+o,y2:t.medianPos,stroke:t.style.stroke||"#333",strokeWidth:2}),(0,bl.jsx)("line",{x1:t.x-.5*o,y1:t.minPos,x2:t.x+.5*o,y2:t.minPos,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,bl.jsx)("line",{x1:t.x-.5*o,y1:t.maxPos,x2:t.x+.5*o,y2:t.maxPos,stroke:t.style.stroke||"#333",strokeWidth:1})]}:{children:[(0,bl.jsx)("line",{x1:t.minPos,y1:t.y,x2:t.maxPos,y2:t.y,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,bl.jsx)("rect",{x:Math.min(t.q1Pos,t.q3Pos),y:t.y-o,width:Math.abs(t.q3Pos-t.q1Pos),height:t.columnWidth,fill:il(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,bl.jsx)("line",{x1:t.medianPos,y1:t.y-o,x2:t.medianPos,y2:t.y+o,stroke:t.style.stroke||"#333",strokeWidth:2}),(0,bl.jsx)("line",{x1:t.minPos,y1:t.y-.5*o,x2:t.minPos,y2:t.y+.5*o,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,bl.jsx)("line",{x1:t.maxPos,y1:t.y-.5*o,x2:t.maxPos,y2:t.y+.5*o,stroke:t.style.stroke||"#333",strokeWidth:1})]},i)}case"violin":{const t=e,o=[(0,bl.jsx)("path",{d:t.pathString,transform:t.translateX||t.translateY?`translate(${t.translateX},${t.translateY})`:void 0,fill:il(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:t.style.strokeWidth||1},r("path"))];if(t.iqrLine&&t.bounds){const e=t.bounds,n=e.x+e.width/2,i=e.y+e.height/2;t.iqrLine.isVertical?o.push((0,bl.jsx)("line",{x1:n,y1:t.iqrLine.q1Pos,x2:n,y2:t.iqrLine.q3Pos,stroke:t.style.stroke||"#333",strokeWidth:2},r("iqr")),(0,bl.jsx)("circle",{cx:n,cy:t.iqrLine.medianPos,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},r("med"))):o.push((0,bl.jsx)("line",{x1:t.iqrLine.q1Pos,y1:i,x2:t.iqrLine.q3Pos,y2:i,stroke:t.style.stroke||"#333",strokeWidth:2},r("iqr")),(0,bl.jsx)("circle",{cx:t.iqrLine.medianPos,cy:i,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},r("med")))}return(0,bl.jsx)("g",{children:o},i)}case"connector":return(0,bl.jsx)("line",{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stroke:e.style.stroke||"#999",strokeWidth:e.style.strokeWidth||1,opacity:e.style.opacity??.5},i);case"trapezoid":{const t=e,o=t.points.map(e=>`${e[0]},${e[1]}`).join(" ");return(0,bl.jsx)("polygon",{points:o,fill:il(t.style.fill,"#999"),opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},i)}default:return null}}(e,t,Mt)})).filter(Boolean)]})]}),(0,Uh.jsx)(gh,{width:xt,height:kt,totalWidth:gt[0],totalHeight:gt[1],margin:vt,scales:o,showAxes:ee,showCategoryTicks:te,oLabel:$t,rLabel:Nt,oFormat:Dt,rFormat:Et,rTickValues:ue,tickLabelEdgeAlign:de,axisExtent:he,showGrid:Ce,title:Ee,legend:Me,legendHoverBehavior:_e,legendClickBehavior:Pe,legendHighlightedCategory:Re,legendIsolatedCategories:je,legendPosition:Le,legendLayout:Te,foregroundGraphics:br(n,Cr(no.current?.customLayoutOverlays,st??null)),annotations:ke,onAnnotationActivate:we,onObservation:ve??be,chartId:xe,chartType:"StreamOrdinalFrame",autoPlaceAnnotations:Se,svgAnnotationRules:Ae,annotationFrame:0,xAccessor:Po,yAccessor:Ro,annotationData:jo(e?.getData())}),Fe&&"radial"===y&&(0,Uh.jsx)("div",{style:{position:"absolute",left:vt.left+xt/2,top:vt.top+kt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:Fe})]})}return(0,Uh.jsxs)("div",{ref:pt,className:"stream-ordinal-frame"+(Oe?" "+Oe:""),role:"group","aria-label":tt||("string"==typeof Ee?Ee:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:v?"100%":gt[0],height:x?"100%":gt[1],overflow:"visible"},onKeyDown:xo,children:["production"!==process.env.NODE_ENV&&no.current&&(0,Uh.jsx)(gr,{store:no.current,diagnostics:Jt.current}),et&&(0,Uh.jsx)(yc,{tableId:Mt}),et&&(0,Uh.jsx)(mc,{scene:no.current?.scene??[],chartType:o+" chart",tableId:Mt,chartTitle:"string"==typeof Ee?Ee:void 0}),(0,Uh.jsx)(gc,{summary:ot}),(0,Uh.jsx)(Xl,{hoverPoint:Bt}),(0,Uh.jsxs)("div",{role:"img","aria-label":tt||("string"==typeof Ee?Ee:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:eo?ko:void 0,onMouseLeave:eo?go:void 0,onClick:ct?yo:void 0,children:[(0,Uh.jsxs)(uu,{size:gt,margin:vt,children:[Yt,qt]}),(0,Uh.jsx)(mh,{width:xt,height:kt,totalWidth:gt[0],totalHeight:gt[1],margin:vt,scales:zt,showAxes:ee,showGrid:Ce,rFormat:Et,rTickValues:ue,axisExtent:he}),(0,Uh.jsx)("canvas",{ref:uo,"aria-label":Jl(no.current?.scene??[],o+" chart"),style:{position:"absolute",top:0,left:0,width:gt[0],height:gt[1]}}),(0,Uh.jsx)(gh,{width:xt,height:kt,totalWidth:gt[0],totalHeight:gt[1],margin:vt,scales:zt,showAxes:ee,showCategoryTicks:te,oLabel:$t,rLabel:Nt,oFormat:Dt,rFormat:Et,rTickValues:ue,axisExtent:he,showGrid:Ce,title:Ee,legend:Me,legendHoverBehavior:_e,legendClickBehavior:Pe,legendHighlightedCategory:Re,legendIsolatedCategories:je,legendPosition:Le,legendLayout:Te,foregroundGraphics:br(Wt,Cr(no.current?.customLayoutOverlays,st??null)),annotations:ke,onAnnotationActivate:we,onObservation:ve??be,chartId:xe,chartType:"StreamOrdinalFrame",autoPlaceAnnotations:Se,svgAnnotationRules:Ae,annotationFrame:Gt,xAccessor:Po,yAccessor:Ro,annotationData:jo(no.current?.getData()),underlayRendered:!0,canvasObscuresUnderlay:!1}),(Ze||Je)&&"radial"!==y&&(0,Uh.jsx)(kh,{width:xt,height:kt,totalWidth:gt[0],totalHeight:gt[1],margin:vt,scales:zt,onBrush:Je||(()=>{})}),Fe&&"radial"===y&&(0,Uh.jsx)("div",{style:{position:"absolute",left:vt.left+xt/2,top:vt.top+kt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:Fe}),Ye?.showBadge&&(0,Uh.jsx)(Di,{isStale:Ut,position:Ye.badgePosition}),(0,Uh.jsx)(xc,{active:bo.current>=0,hoverPoint:Bt,margin:vt,size:gt,shape:vo.current?.shape,width:vo.current?.w,height:vo.current?.h}),Ao]})]})}));Qh.displayName="StreamOrdinalFrame";var Zh=Qh,Jh=d(require("react")),ef=require("react"),tf={weightChange:.1,newEdge:.5,newNode:1,threshold:3,transitionDuration:500},of={radius:3,opacity:.7,speedMultiplier:1,maxPerEdge:50,spawnRate:.1},nf=class{constructor(e){this.capacity=e,this.particles=Array(e),this._freeIndices=Array(e);for(let t=0;e>t;t++)this.particles[t]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0},this._freeIndices[t]=e-1-t}spawn(e,t=Math.random){const o=this._freeIndices.pop();if(void 0===o)return null;const n=this.particles[o];return n.active=!0,n.t=0,n.offset=t()-.5,n.edgeIndex=e,n.x=0,n.y=0,n}step(e,t,o,n){for(let r=0;this.capacity>r;r++){const i=this.particles[r];if(!i.active)continue;const s=o[i.edgeIndex];s&&s.bezier?(i.t+=e*t*(n?n[i.edgeIndex]??1:1)*(s.bezier.circular?.3:1),1>i.t?rf(s.bezier,i.t,i.offset,i):(i.active=!1,this._freeIndices.push(r))):(i.active=!1,this._freeIndices.push(r))}}countForEdge(e){let t=0;for(let o=0;this.capacity>o;o++)this.particles[o].active&&this.particles[o].edgeIndex===e&&t++;return t}clear(){for(let e=0;this.capacity>e;e++)this.particles[e].active=!1;this._freeIndices.length=0;for(let e=this.capacity-1;e>=0;e--)this._freeIndices.push(e)}resize(e){if(this.capacity>=e)return;const t=this.particles;this.particles=Array(e);for(let o=0;e>o;o++)t.length>o?this.particles[o]=t[o]:(this.particles[o]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0},this._freeIndices.push(o));this.capacity=e}};function rf(e,t,o,n){if(e.circular&&e.segments)return void function(e,t,o,n,r){const i=e.length,s=t*i,a=Math.min(Math.floor(s),i-1),l=s-a,[c,u,d,h]=e[a];sf(c,u,d,h,l,r);const f=h.x-c.x,m=h.y-c.y,p=Math.sqrt(f*f+m*m);if(p>.001){const e=f/p;r.x+=-m/p*o*n*2,r.y+=e*o*n*2}}(e.segments,t,o,e.halfWidth,n);if(!e.points)return n.x=0,void(n.y=0);const[r,i,s,a]=e.points;sf(r,i,s,a,t,n);const l=a.x-r.x,c=a.y-r.y,u=Math.sqrt(l*l+c*c);if(u>.001){const t=l/u;n.x+=-c/u*o*e.halfWidth*2,n.y+=t*o*e.halfWidth*2}}function sf(e,t,o,n,r,i){const s=1-r,a=s*s,l=a*s,c=r*r,u=c*r;i.x=l*e.x+3*a*r*t.x+3*s*c*o.x+u*n.x,i.y=l*e.y+3*a*r*t.y+3*s*c*o.y+u*n.y}function af(e,t){var o=e.get(t);if(!o)throw Error("missing: "+t);return o}function lf(e,t){var o,n=[],r=[],i=[],s={},a=[];function l(e){i[e]=!1,s.hasOwnProperty(e)&&Object.keys(s[e]).forEach(function(t){delete s[e][t],i[t]&&l(t)})}function c(e){var t,n,d=!1;for(r.push(e),i[e]=!0,t=0;a[e].length>t;t++)(n=a[e][t])===o?(u(o,r),d=!0):i[n]||(d=c(n));if(d)l(e);else for(t=0;a[e].length>t;t++){var h=s[n=a[e][t]];h||(s[n]=h={}),h[n]=!0}return r.pop(),d}function u(e,o){var r=[].concat(o).concat(e);t?t(r):n.push(r)}function d(t){!function(t){for(var o=0;e.length>o;o++)o>=t&&e[o]||(e[o]=[]),e[o]=e[o].filter(function(e){return e>=t})}(t);for(var o,n=function(e){for(var t=e.length,o=Array(t),n=Array(t),r=Array(t),i=Array(t),s=Array(t),a=Array(t),l=0;t>l;++l)o[l]=-1,n[l]=0,r[l]=!1,i[l]=0,s[l]=-1,a[l]=[];var c,u=0,d=[],h=[];function f(t){var l=[t],c=[t];for(o[t]=n[t]=u,r[t]=!0,u+=1;c.length>0;){var f=e[t=c[c.length-1]];if(f.length>i[t]){for(var m=i[t];f.length>m;++m){var p=f[m];if(0>o[p]){o[p]=n[p]=u,r[p]=!0,u+=1,l.push(p),c.push(p);break}r[p]&&(n[t]=0|Math.min(n[t],n[p])),0>s[p]||a[t].push(s[p])}i[t]=m}else{if(n[t]===o[t]){var g=[],y=[],b=0;for(m=l.length-1;m>=0;--m){var v=l[m];if(r[v]=!1,g.push(v),y.push(a[v]),b+=a[v].length,s[v]=d.length,v===t){l.length=m;break}}d.push(g);var x=Array(b);for(m=0;y.length>m;m++)for(var k=0;y[m].length>k;k++)x[--b]=y[m][k];h.push(x)}c.pop()}}}for(l=0;t>l;++l)0>o[l]&&f(l);for(l=0;h.length>l;l++){var m=h[l];if(0!==m.length){m.sort(function(e,t){return e-t}),c=[m[0]];for(var p=1;m.length>p;p++)m[p]!==m[p-1]&&c.push(m[p]);h[l]=c}}return{components:d,adjacencyList:h}}(e),r=n.components.filter(function(e){return e.length>1}),i=1/0,s=0;r.length>s;s++)for(var a=0;r[s].length>a;a++)i>r[s][a]&&(i=r[s][a],o=s);var l=r[o];return!!l&&{leastVertex:i,adjList:e.map(function(e,t){return-1===l.indexOf(t)?[]:e.filter(function(e){return-1!==l.indexOf(e)})})}}o=0;for(var h=e.length;h>o;){var f=d(o);if(o=f.leastVertex,a=f.adjList){for(var m=0;a.length>m;m++)for(var p=0;a[m].length>p;p++){var g=a[m][p];i[+g]=!1,s[g]={}}c(o),o+=1}else o=h}return t?void 0:n}function cf(e){return e.y0-e.y1>0?"up":"down"}function uf(e,t){return t(e.source)==t(e.target)}function df(e){var t=0;e.source.sourceLinks.forEach(function(e){t=e.circular?t+1:t});var o=0;return e.target.targetLinks.forEach(function(e){o=e.circular?o+1:o}),1>=t&&1>=o}function hf(e){return e.target.x0-e.source.x1}function ff(e,t){var o=pf(e),n=hf(t)/Math.tan(o);return"up"==cf(e)?e.y1-n:e.y1+n}function mf(e,t){var o=pf(e),n=hf(t)/Math.tan(o);return"up"==cf(e)?e.y1+n:e.y1-n}function pf(e){var t=Math.abs(e.y1-e.y0);return Math.atan(Math.abs(e.target.x0-e.source.x1)/t)}function gf(e,t){return t(e)}function yf(e){return vf(e.source)}function bf(e){return vf(e.target)}function vf(e){return(e.y0+e.y1)/2}function xf(e){return e.virtual?0:e.value}function kf(e,t){var o=0;e.sourceLinks.forEach(function(e){o=e.circular&&!uf(e,t)?o+1:o});var n=0;return e.targetLinks.forEach(function(e){n=e.circular&&!uf(e,t)?n+1:n}),o+n}function wf(e){return e.target.depth}function Sf(e,t){return e.sourceLinks.length?e.depth:t-1}function Af(e,t){return e.y0-t.y0}function Cf(e,t){return t.y0-e.y0}function Mf(e,t){return e.y1-t.y1}function _f(e,t){return t.y1-e.y1}function Pf(e,t){return jf(e.source,t.source)||e.index-t.index}function Rf(e,t){return jf(e.target,t.target)||e.index-t.index}function jf(e,t){return e.partOfCycle===t.partOfCycle?e.y0-t.y0:"top"===e.circularLinkType||"bottom"===t.circularLinkType?-1:1}function Lf(e,t){return Tf(e)==Tf(t)?"bottom"==e.circularLinkType?Cf(e,t):Af(e,t):Tf(t)-Tf(e)}function Tf(e){return e.target.column-e.source.column}function If(e,t){return $f(e)==$f(t)}function $f(e){return e.y0-e.y1>0?"up":"down"}var Nf=require("d3-array");function Df(e,t,o,n,r){let i=e;var s=Math.max(8,.15*(i.y1-i.y0));i.links.forEach(function(e){e.circular&&(e._circularWidth=Math.min(e.width,s))});var a=(0,Nf.min)(i.links,function(e){return e.source.y0});i.links.forEach(function(e){e.circular&&(e.circularPathData={})});var l=i.links.filter(function(e){return e.circular});return l.sort(function(e,t){return t.value-e.value}),l.forEach(function(e,t){e._circularStub=t>=4}),Ef(i.links.filter(function(e){return"top"==e.circularLinkType}),t,o),Ef(i.links.filter(function(e){return"bottom"==e.circularLinkType}),t,o),i.links.forEach(function(e){if(e.circular){if(e.circularPathData.arcRadius=e._circularWidth+n,e.circularPathData.rightNodeBuffer=5,e.circularPathData.leftNodeBuffer=5,e.circularPathData.sourceWidth=e.source.x1-e.source.x0,e.circularPathData.sourceX=e.source.x0+e.circularPathData.sourceWidth,e.circularPathData.targetX=e.target.x0,e.circularPathData.sourceY=e.y0,e.circularPathData.targetY=e.y1,uf(e,t)&&df(e))e.circularPathData.rightSmallArcRadius=n+e._circularWidth/2,e.circularPathData.rightLargeArcRadius=n+e._circularWidth/2,e.circularPathData.leftSmallArcRadius=n+e._circularWidth/2,e.circularPathData.leftLargeArcRadius=n+e._circularWidth/2,"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=e.source.y1+r+e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius):(e.circularPathData.verticalFullExtent=e.source.y0-r-e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius);else{var s=e.source.column,l=e.circularLinkType,c=i.links.filter(function(e){return e.source.column==s&&e.circularLinkType==l});c.sort("bottom"==e.circularLinkType?Cf:Af);var u=0;c.forEach(function(t,r){t.circularLinkID==e.circularLinkID&&(e.circularPathData.rightSmallArcRadius=n+e._circularWidth/2+u,e.circularPathData.rightLargeArcRadius=n+e._circularWidth/2+r*o+u),u+=t._circularWidth||t.width}),s=e.target.column,(c=i.links.filter(function(e){return e.target.column==s&&e.circularLinkType==l})).sort("bottom"==e.circularLinkType?_f:Mf),u=0,c.forEach(function(t,r){t.circularLinkID==e.circularLinkID&&(e.circularPathData.leftSmallArcRadius=n+e._circularWidth/2+u,e.circularPathData.leftLargeArcRadius=n+e._circularWidth/2+r*o+u),u+=t._circularWidth||t.width}),"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=Math.max(i.y1,e.source.y1,e.target.y1)+r+e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius):(e.circularPathData.verticalFullExtent=a-r-e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius)}e.circularPathData.rightInnerExtent=e.circularPathData.sourceX+e.circularPathData.rightNodeBuffer,e.circularPathData.leftInnerExtent=e.circularPathData.targetX-e.circularPathData.leftNodeBuffer,e.circularPathData.rightFullExtent=e.circularPathData.sourceX+e.circularPathData.rightLargeArcRadius+e.circularPathData.rightNodeBuffer,e.circularPathData.leftFullExtent=e.circularPathData.targetX-e.circularPathData.leftLargeArcRadius-e.circularPathData.leftNodeBuffer}e.path=e.circular?function(e){return"top"==e.circularLinkType?"M"+e.circularPathData.sourceX+" "+e.circularPathData.sourceY+" L"+e.circularPathData.rightInnerExtent+" "+e.circularPathData.sourceY+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightSmallArcRadius+" 0 0 0 "+e.circularPathData.rightFullExtent+" "+(e.circularPathData.sourceY-e.circularPathData.rightSmallArcRadius)+" L"+e.circularPathData.rightFullExtent+" "+e.circularPathData.verticalRightInnerExtent+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightLargeArcRadius+" 0 0 0 "+e.circularPathData.rightInnerExtent+" "+e.circularPathData.verticalFullExtent+" L"+e.circularPathData.leftInnerExtent+" "+e.circularPathData.verticalFullExtent+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftLargeArcRadius+" 0 0 0 "+e.circularPathData.leftFullExtent+" "+e.circularPathData.verticalLeftInnerExtent+" L"+e.circularPathData.leftFullExtent+" "+(e.circularPathData.targetY-e.circularPathData.leftSmallArcRadius)+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftSmallArcRadius+" 0 0 0 "+e.circularPathData.leftInnerExtent+" "+e.circularPathData.targetY+" L"+e.circularPathData.targetX+" "+e.circularPathData.targetY:"M"+e.circularPathData.sourceX+" "+e.circularPathData.sourceY+" L"+e.circularPathData.rightInnerExtent+" "+e.circularPathData.sourceY+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightSmallArcRadius+" 0 0 1 "+e.circularPathData.rightFullExtent+" "+(e.circularPathData.sourceY+e.circularPathData.rightSmallArcRadius)+" L"+e.circularPathData.rightFullExtent+" "+e.circularPathData.verticalRightInnerExtent+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightLargeArcRadius+" 0 0 1 "+e.circularPathData.rightInnerExtent+" "+e.circularPathData.verticalFullExtent+" L"+e.circularPathData.leftInnerExtent+" "+e.circularPathData.verticalFullExtent+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftLargeArcRadius+" 0 0 1 "+e.circularPathData.leftFullExtent+" "+e.circularPathData.verticalLeftInnerExtent+" L"+e.circularPathData.leftFullExtent+" "+(e.circularPathData.targetY+e.circularPathData.leftSmallArcRadius)+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftSmallArcRadius+" 0 0 1 "+e.circularPathData.leftInnerExtent+" "+e.circularPathData.targetY+" L"+e.circularPathData.targetX+" "+e.circularPathData.targetY}(e):function(e){var t=e.source.x1,o=e.y0,n=e.target.x0,r=e.y1,i=(t+n)/2;return"M"+t+","+o+"C"+i+","+o+" "+i+","+r+" "+n+","+r}(e)}),i}function Ef(e,t,o){e.sort(Lf);var n=e.filter(function(e){return!e._circularStub});return e.forEach(function(e,r){var i=0;if(e._circularStub)e.circularPathData.verticalBuffer=0;else if(uf(e,t)&&df(e))e.circularPathData.verticalBuffer=i+e._circularWidth/2;else{for(var s=0;n.length>s;s++){var a=n[s];if(a!==e&&a.circularPathData&&void 0!==a.circularPathData.verticalBuffer&&Of(e,a)){var l=a.circularPathData.verticalBuffer+(a._circularWidth||a.width)/2+o;i=l>i?l:i}}e.circularPathData.verticalBuffer=i+e._circularWidth/2}}),e}function Of(e,t){return e.source.column>=t.target.column&&t.source.column>=e.target.column}var Bf=require("d3-array");function Ff(e){return function(){return e}}function zf(e){return e.index}function Hf(e){return e.nodes}function Wf(e){return e.links}function qf(e,t,o){var n=(0,Bf.groups)(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});n.forEach(function(r,i){var s=r.length;if(t)r.sort(t);else if(i>0){var a=new Map;r.forEach(function(e,t){var o,n,r,i=(n=0,r=0,(o=e).targetLinks.forEach(function(e){if(!e.circular){var t=e.value||1;r+=vf(e.source)*t,n+=t}}),o.sourceLinks.forEach(function(e){if(!e.circular){var t=e.value||1;r+=vf(e.target)*t,n+=t}}),n>0?r/n:NaN);a.set(e,{bc:i,idx:t})}),r.sort(function(e,t){var o=a.get(e),n=a.get(t),r=o.bc,i=n.bc;if(e.circularLinkType!==t.circularLinkType){if("top"==e.circularLinkType&&"bottom"==t.circularLinkType)return-1;if("bottom"==e.circularLinkType&&"top"==t.circularLinkType)return 1;if("top"==e.circularLinkType)return-1;if("top"==t.circularLinkType)return 1;if("bottom"==e.circularLinkType)return 1;if("bottom"==t.circularLinkType)return-1}return isNaN(r)||isNaN(i)?isNaN(r)?isNaN(i)?o.idx-n.idx:1:-1:r-i})}else r.sort(function(e,t){return e.circularLinkType==t.circularLinkType?kf(t,o)-kf(e,o):"top"==e.circularLinkType&&"bottom"==t.circularLinkType||"top"==e.circularLinkType&&0==t.partOfCycle||0==e.partOfCycle&&"bottom"==t.circularLinkType?-1:0});r.forEach(function(t,r){t.depth==n.length-1&&1==s||0==t.depth&&1==s?(t.y0=e.y1/2-t.value*e.ky,t.y1=t.y0+t.value*e.ky):t.partOfCycle?0==kf(t,o)?(t.y0=e.y1/2+r,t.y1=t.y0+t.value*e.ky):"top"==t.circularLinkType?(t.y0=e.y0+r,t.y1=t.y0+t.value*e.ky):(t.y0=e.y1-t.value*e.ky-r,t.y1=t.y0+t.value*e.ky):0==e.y0||0==e.y1?(t.y0=(e.y1-e.y0)/s*r,t.y1=t.y0+t.value*e.ky):(t.y0=(e.y1-e.y0)/2-s/2+r,t.y1=t.y0+t.value*e.ky)})})}function Yf(e,t,o,n,r,i){var s=(0,Bf.groups)(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});u();for(var a=1,l=i;l>0;--l)c(a*=.99,o),u();function c(t,o){var n=s.length;s.forEach(function(r){var i=r.length,s=r[0].depth;r.forEach(function(r){var a;if(r.sourceLinks.length||r.targetLinks.length)if(r.partOfCycle&&kf(r,o)>0){var l=(0,Bf.mean)(r.sourceLinks,bf),c=(0,Bf.mean)(r.targetLinks,yf),u=l&&c?(l+c)/2:l||c;if(u){var d=(u-vf(r))*t*.3;r.y0+=d,r.y1+=d}}else if(0==s&&1==i)r.y0=e.y1/2-(a=r.y1-r.y0)/2,r.y1=e.y1/2+a/2;else if(s==n-1&&1==i)r.y0=e.y1/2-(a=r.y1-r.y0)/2,r.y1=e.y1/2+a/2;else if(1==r.targetLinks.length&&1==r.targetLinks[0].source.sourceLinks.length)a=r.y1-r.y0,r.y0=r.targetLinks[0].source.y0,r.y1=r.y0+a;else{var h=(0,Bf.mean)(r.sourceLinks,bf),f=(0,Bf.mean)(r.targetLinks,yf),m=((h&&f?(h+f)/2:h||f)-vf(r))*t;r.y0+=m,r.y1+=m}})})}function u(){s.forEach(function(o){var i,s,a,l=e.y0,c=o.length;for(o.sort(t||jf),a=0;c>a;++a)(s=l-(i=o[a]).y0)>0&&(i.y0+=s,i.y1+=s),l=i.y1+n;if((s=l-n-e.y1)>0)for(l=i.y0-=s,i.y1-=s,a=c-2;a>=0;--a)(s=(i=o[a]).y1+r-l)>0&&(i.y0-=s,i.y1-=s),l=i.y0})}}function Gf(e){e.nodes.forEach(function(e){e.sourceLinks.sort(Rf),e.targetLinks.sort(Pf)}),e.nodes.forEach(function(e){var t=e.y0,o=t,n=e.y1,r=n;e.sourceLinks.forEach(function(e){e.circular?(e.y0=n-e.width/2,n-=e.width):(e.y0=t+e.width/2,t+=e.width)}),e.targetLinks.forEach(function(e){e.circular?(e.y1=r-e.width/2,r-=e.width):(e.y1=o+e.width/2,o+=e.width)})})}function Vf(){var e=0,t=0,o=1,n=1,r=24,i=8,s=null,a=zf,l=Sf,c=void 0,u=32,d=2,h=Hf,f=Wf;function m(){var m={nodes:h.apply(null,arguments),links:f.apply(null,arguments)};return function(h){h.x0=e,h.y0=t,h.x1=o,h.y1=n,h.py=0,function(e,t){e.nodes.forEach(function(e,t){e.index=t,e.sourceLinks=[],e.targetLinks=[]});var o=function(e,t){var o=new Map;return(0,Bf.group)(e,t).forEach(function(e,t){o.set(t,e[0])}),o}(e.nodes,t);e.links.forEach(function(e,t){e.index=t;var n=e.source,r=e.target;"object"!=typeof n&&(n=e.source=af(o,n)),"object"!=typeof r&&(r=e.target=af(o,r)),n.sourceLinks.push(e),r.targetLinks.push(e)})}(h,a),function(e,t){var o=0;if(null==t){for(var n=[],r=0;e.links.length>r;r++){var i=e.links[r],s=i.source.index,a=i.target.index;n[s]||(n[s]=[]),n[a]||(n[a]=[]),-1===n[s].indexOf(a)&&n[s].push(a)}var l=lf(n);l.sort(function(e,t){return e.length-t.length});var c={};for(r=0;l.length>r;r++){var u=l[r].slice(-2);c[u[0]]||(c[u[0]]={}),c[u[0]][u[1]]=!0}e.links.forEach(function(e){var t=e.target.index,n=e.source.index;t===n||c[n]&&c[n][t]?(e.circular=!0,e.circularLinkID=o++):e.circular=!1})}else e.links.forEach(function(e){t(e.source)<t(e.target)?e.circular=!1:(e.circular=!0,e.circularLinkID=o++)})}(h,c),function(e,t){var o=0,n=0;e.links.forEach(function(r){r.circular&&(r.circularLinkType=r.source.circularLinkType||r.target.circularLinkType?r.source.circularLinkType?r.source.circularLinkType:r.target.circularLinkType:n>o?"top":"bottom","top"==r.circularLinkType?o++:n++,e.nodes.forEach(function(e){gf(e,t)!=gf(r.source,t)&&gf(e,t)!=gf(r.target,t)||(e.circularLinkType=r.circularLinkType)}))}),e.links.forEach(function(e){e.circular&&(e.source.circularLinkType==e.target.circularLinkType&&(e.circularLinkType=e.source.circularLinkType),uf(e,t)&&(e.circularLinkType=e.source.circularLinkType))})}(h,a),function(e){e.nodes.forEach(function(e){e.partOfCycle=!1,e.value=Math.max((0,Bf.sum)(e.sourceLinks,xf),(0,Bf.sum)(e.targetLinks,xf)),e.sourceLinks.forEach(function(t){t.circular&&(e.partOfCycle=!0,e.circularLinkType=t.circularLinkType)}),e.targetLinks.forEach(function(t){t.circular&&(e.partOfCycle=!0,e.circularLinkType=t.circularLinkType)})})}(h),function(e,t,o){var n,r,i;if(null!=t){e.nodes.sort(function(e,o){return t(e)<t(o)?-1:1});var s=0,a=t(e.nodes[0]);e.nodes.forEach(function(e){s=t(e)==a?s:s+1,a=t(e)==a?a:t(e),e.column=s})}for(n=e.nodes,r=[],i=0;n.length;++i,n=r,r=[])n.forEach(function(e){e.depth=i,e.sourceLinks.forEach(function(e){0>r.indexOf(e.target)&&!e.circular&&r.push(e.target)})});for(n=e.nodes,r=[],i=0;n.length;++i,n=r,r=[])n.forEach(function(e){e.height=i,e.targetLinks.forEach(function(e){0>r.indexOf(e.source)&&!e.circular&&r.push(e.source)})});e.nodes.forEach(function(e){e.column=null==t?o(e,i):e.column})}(h,c,l);var f=i;if(null!==s){var m=(0,Bf.groups)(h.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]}),p=(0,Bf.max)(m,function(e){return e.length});p>1&&(f=Math.max(1,(n-t)*s/(p-1)))}(function(e,t,o){var n=(0,Bf.groups)(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});e.py=t;var r=(0,Bf.min)(n,function(t){return(e.y1-e.y0-(t.length-1)*e.py)/(0,Bf.sum)(t,function(e){return e.value})});e.ky=r,e.links.forEach(function(t){t.width=t.value*e.ky});var i=(0,Bf.max)(e.nodes,function(e){return e.column});e.nodes.forEach(i>0?function(t){t.x0=e.x0+t.column*((e.x1-e.x0-o)/i),t.x1=t.x0+o}:function(t){t.x0=e.x0,t.x1=t.x0+o})})(h,f,r),qf(h,c,a),Yf(h,c,a,f,f,u),Gf(h),Df(h,a,d,10,8),qf(h,c,a),Yf(h,c,a,f,f,u),Gf(h),Df(h,a,d,10,8),function(e,t){let o=e;o.nodes.forEach(function(e){e.y+(e.y1-e.y0)>o.y1&&(e.y=e.y-(e.y+(e.y1-e.y0)-o.y1));var n=o.links.filter(function(o){return gf(o.source,t)==gf(e,t)}),r=n.length;r>1&&n.sort(function(e,t){if(!e.circular&&!t.circular){if(e.target.column==t.target.column)return e.y1-t.y1;if(!If(e,t))return e.y1-t.y1;if(e.target.column>t.target.column){var o=ff(t,e);return e.y1-o}if(t.target.column>e.target.column)return ff(e,t)-t.y1}return e.circular&&!t.circular?"top"==e.circularLinkType?-1:1:t.circular&&!e.circular?"top"==t.circularLinkType?1:-1:e.circular&&t.circular?e.circularLinkType===t.circularLinkType&&"top"==e.circularLinkType?e.target.column===t.target.column?e.target.y1-t.target.y1:t.target.column-e.target.column:e.circularLinkType===t.circularLinkType&&"bottom"==e.circularLinkType?e.target.column===t.target.column?t.target.y1-e.target.y1:e.target.column-t.target.column:"top"==e.circularLinkType?-1:1:void 0});var i=e.y0;n.forEach(function(e){e.y0=i+e.width/2,i+=e.width}),n.forEach(function(t,o){if("bottom"==t.circularLinkType){for(var i=o+1,s=0;r>i;i++)s+=n[i].width;t.y0=e.y1-s-t.width/2}})})}(h,a),function(e,t){let o=e;o.nodes.forEach(function(e){var n=o.links.filter(function(o){return gf(o.target,t)==gf(e,t)}),r=n.length;r>1&&n.sort(function(e,t){if(!e.circular&&!t.circular){if(e.source.column==t.source.column)return e.y0-t.y0;if(!If(e,t))return e.y0-t.y0;if(e.source.column>t.source.column){var o=mf(t,e);return e.y0-o}if(t.source.column>e.source.column)return mf(e,t)-t.y0}return e.circular&&!t.circular?"top"==e.circularLinkType?-1:1:t.circular&&!e.circular?"top"==t.circularLinkType?1:-1:e.circular&&t.circular?e.circularLinkType===t.circularLinkType&&"top"==e.circularLinkType?e.source.column===t.source.column?e.source.y1-t.source.y1:e.source.column-t.source.column:e.circularLinkType===t.circularLinkType&&"bottom"==e.circularLinkType?e.source.column===t.source.column?e.source.y1-t.source.y1:t.source.column-e.source.column:"top"==e.circularLinkType?-1:1:void 0});var i=e.y0;n.forEach(function(e){e.y1=i+e.width/2,i+=e.width}),n.forEach(function(t,o){if("bottom"==t.circularLinkType){for(var i=o+1,s=0;r>i;i++)s+=n[i].width;t.y1=e.y1-s-t.width/2}})})}(h,a),function(e){var t=e.nodes,o=e.links,n=!1,r=!1;if(o.forEach(function(e){"top"==e.circularLinkType?n=!0:"bottom"==e.circularLinkType&&(r=!0)}),0==n||0==r){let n=function(t){return(t-i)/(s-i)*(e.y1-e.y0)+e.y0};var i=(0,Bf.min)(t,function(e){return e.y0}),s=(0,Bf.max)(t,function(e){return e.y1}),a=(e.y1-e.y0)/(s-i);1>a?(t.forEach(function(e){e.y0=n(e.y0),e.y1=n(e.y1)}),o.forEach(function(e){e.y0=n(e.y0),e.y1=n(e.y1),e.width=e.width*a})):t.forEach(function(e){var t=e.y1-e.y0,o=n(e.y0)-e.y0;e.y0=n(e.y0),e.y1=e.y0+t,e.sourceLinks.forEach(function(e){e.y0=e.y0+o}),e.targetLinks.forEach(function(e){e.y1=e.y1+o})})}}(h),Df(h,a,d,10,8)}(m),m}return m.update=function(e){return Gf(e),Df(e,a,d,10,8),e},m.nodeWidth=function(e){return arguments.length?(r=+e,m):r},m.nodePadding=function(e){return arguments.length?(i=+e,m):i},m.nodePaddingRatio=function(e){return arguments.length?(s=+e,m):s},m.nodes=function(e){return arguments.length?(h="function"==typeof e?e:Ff(e),m):h},m.links=function(e){return arguments.length?(f="function"==typeof e?e:Ff(e),m):f},m.nodeId=function(e){return arguments.length?(a="function"==typeof e?e:Ff(e),m):a},m.nodeAlign=function(e){return arguments.length?(l="function"==typeof e?e:Ff(e),m):l},m.nodeSort=function(e){return arguments.length?(c=e,m):c},m.iterations=function(e){return arguments.length?(u=+e,m):u},m.circularLinkGap=function(e){return arguments.length?(d=+e,m):d},m.extent=function(r){return arguments.length?(e=+r[0][0],t=+r[0][1],o=+r[1][0],n=+r[1][1],m):[[e,t],[o,n]]},m.size=function(r){return arguments.length?(e=t=0,o=+r[0],n=+r[1],m):[o-e,n-t]},m}var Xf=require("d3-interpolate");function Uf(e){const{sx:t,sTop:o,sBot:n,tx:r,tTop:i,tBot:s,cp1X:a,cp2X:l}=e,c=(o+n)/2,u=(i+s)/2;return{pathD:[`M${t},${o}`,`C${a},${o} ${l},${i} ${r},${i}`,`L${r},${s}`,`C${l},${s} ${a},${n} ${t},${n}`,"Z"].join(" "),bezier:{circular:!1,points:[{x:t,y:c},{x:a,y:c},{x:l,y:u},{x:r,y:u}],halfWidth:(n-o)/2}}}require("d3-shape");var Kf=e=>{let t,o,n,r,i,s,a,l,c;if("down"===e.direction)return t=e.y0-e.sankeyWidth/2,o=e.y1-e.sankeyWidth/2,n=e.y1+e.sankeyWidth/2,r=e.y0+e.sankeyWidth/2,i=e.source.x1,s=e.target.x0,a=(0,Xf.interpolateNumber)(i,s),l=a(.5),c=a(.5),`M${t},${i}C${t},${l} ${o},${c} ${o},${s}L${n},${s}C${n},${c} ${r},${l} ${r},${i}Z`;const u=e.sankeyWidth/2,d=(0,Xf.interpolateNumber)(e.source.x1,e.target.x0),{pathD:h}=Uf({sx:e.source.x1,sTop:e.y0-u,sBot:e.y0+u,tx:e.target.x0,tTop:e.y1-u,tBot:e.y1+u,cp1X:d(.5),cp2X:d(.5)});return h};function Qf(e){const t=e.sankeyWidth/2,o=(e._circularWidth??e.sankeyWidth)/2,n=e.circularPathData;if(!n)return null;if("down"===e.direction)return null;if(e._circularStub){const o=n.sourceX,r=n.sourceY,i=n.targetX,s=n.targetY;if("object"!=typeof e.source||!e.source||"object"!=typeof e.target||!e.target)return null;const a=Math.max(15,Math.min(40,.33*(n.rightFullExtent-o))),l=Math.max(15,Math.min(40,.33*(i-n.leftFullExtent)));return`M${o},${r-t}L${o+a},${r-t}L${o+a},${r+t}L${o},${r+t}ZM${i},${s-t}L${i-l},${s-t}L${i-l},${s+t}L${i},${s+t}Z`}const r=n.sourceX,i=n.sourceY,s=n.targetX,a=n.targetY,l=n.rightFullExtent,c=n.leftFullExtent,u=n.verticalFullExtent,d="bottom"===e.circularLinkType?1:-1,h=Math.max(4,Math.min(o,15));return`M${r},${i-d*t}L${l},${i-d*t}L${l+o},${i-d*t+d*h}L${l+o},${u+d*o-d*h}L${l+o-h},${u+d*o}L${c-o+h},${u+d*o}L${c-o},${u+d*o-d*h}L${c-o},${a-d*t+d*h}L${c-o+h},${a-d*t}L${s},${a-d*t}L${s},${a+d*t}L${c+o},${a+d*t}L${c+o},${u-d*o}L${l-o},${u-d*o}L${l-o},${i+d*t}L${r},${i+d*t}Z`}var Zf=new Set,Jf=new WeakMap;function em(e,t){if("production"===process.env.NODE_ENV)return e;if(!e||!e.data||"object"!=typeof e.data)return e;let o=Jf.get(e);if(o){const e=o.get(t);if(e)return e}else o=new Map,Jf.set(e,o);const n=new Proxy(e,{get(e,o,n){if("string"==typeof o&&!(o in e)&&e.data&&o in e.data){const e=`${t}:${o}`;Zf.has(e)||(Zf.add(e),console.warn(`[Semiotic] "${t}" callback accessed "${o}" on the wrapper object, but it only exists on ".data". Use d.data.${o} (or d.data?.${o}) instead. Frame callbacks receive RealtimeNode/RealtimeEdge wrappers, not your raw data.`))}return Reflect.get(e,o,n)}});return o.set(t,n),n}var tm={left:function(e){return e.depth},right:function(e,t){return t-1-e.height},center:function(e){return e.targetLinks.length?e.depth:e.sourceLinks.length?Math.min.apply(Math,e.sourceLinks.map(wf))-1:0},justify:Sf},om={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,o,n){if(0===e.length)return;const r="vertical"===o.orientation?"down":"right",i=o.nodeAlign||"justify",s=o.nodeWidth??15,a=o.nodePaddingRatio??.05,l=o.iterations??100,c=e.map(e=>({...e})),u=t.map(e=>({...e,source:Ft(e.source),target:Ft(e.target),value:Math.sqrt(Math.max(1,e.value||1))}));let d;d="down"===r?[[0,0],[n[1],n[0]]]:[[0,0],[n[0],n[1]]];const h=Vf().extent(d).links(u).nodes(c).nodeAlign(tm[i]||Sf).nodeId(e=>e.id).nodeWidth(s).iterations(l);h.nodePaddingRatio&&h.nodePaddingRatio(a),h();{let e=1/0,t=-1/0,o=1/0,r=-1/0;for(const n of c)e>n.x0&&(e=n.x0),n.x1>t&&(t=n.x1),o>n.y0&&(o=n.y0),n.y1>r&&(r=n.y1);for(const n of u){if(!n.circular||!n.circularPathData)continue;const i=n.circularPathData,s=(n._circularWidth??n.width??0)/2;e>i.leftFullExtent-s&&(e=i.leftFullExtent-s),i.rightFullExtent+s>t&&(t=i.rightFullExtent+s),o>i.verticalFullExtent-s&&(o=i.verticalFullExtent-s),i.verticalFullExtent+s>r&&(r=i.verticalFullExtent+s)}const i=t-e,s=r-o,a=n[0],l=n[1];if(i>0&&s>0&&(0>e||0>o||t>a||r>l)){const t=Math.min(a/i,l/s),n=-e*t+(a-i*t)/2,r=-o*t+(l-s*t)/2;for(const e of c)e.x0=e.x0*t+n,e.x1=e.x1*t+n,e.y0=e.y0*t+r,e.y1=e.y1*t+r;for(const e of u)if(e.y0=e.y0*t+r,e.y1=e.y1*t+r,e.width=(e.width??0)*t,e._circularWidth&&(e._circularWidth*=t),e.circular&&e.circularPathData){const o=e.circularPathData;o.sourceX=o.sourceX*t+n,o.targetX=o.targetX*t+n,o.sourceY=o.sourceY*t+r,o.targetY=o.targetY*t+r,o.rightFullExtent=o.rightFullExtent*t+n,o.leftFullExtent=o.leftFullExtent*t+n,o.verticalFullExtent=o.verticalFullExtent*t+r,o.rightInnerExtent=o.rightInnerExtent*t+n,o.leftInnerExtent=o.leftInnerExtent*t+n,o.verticalRightInnerExtent=o.verticalRightInnerExtent*t+r,o.verticalLeftInnerExtent=o.verticalLeftInnerExtent*t+r,o.rightSmallArcRadius*=t,o.rightLargeArcRadius*=t,o.leftSmallArcRadius*=t,o.leftLargeArcRadius*=t,o.sourceWidth*=t,o.rightNodeBuffer*=t,o.leftNodeBuffer*=t,o.arcRadius*=t}}}const f=new Map;for(const t of e)f.set(t.id,t);for(const e of c){const t=f.get(e.id);t&&(t.x0=e.x0,t.x1=e.x1,t.y0=e.y0,t.y1=e.y1,t.value=e.value,t.depth=e.depth,t.sourceLinks=e.sourceLinks,t.targetLinks=e.targetLinks,t.width=e.x1-e.x0,t.height=e.y1-e.y0,t.x=e.x0+(e.x1-e.x0)/2,t.y=e.y0+(e.y1-e.y0)/2)}const m=new Map;for(const e of t)if(e._edgeKey)m.set(e._edgeKey,e);else{const t=Ft(e.source),o=Ft(e.target);m.set(`${t}\0${o}`,e)}for(const e of u){const t=Ft(e.source),o=Ft(e.target),n=m.get(e._edgeKey?e._edgeKey:`${t}\0${o}`);if(n){n.y0=e.y0,n.y1=e.y1,n.sankeyWidth=e.width??0,n.circular=!!e.circular,n.circularPathData=e.circularPathData,n._circularWidth=e._circularWidth,n._circularStub=e._circularStub,n.path=e.path,n.circularLinkType=e.circularLinkType,n.direction=r;const i=f.get(t),s=f.get(o);i&&(n.source=i),s&&(n.target=s)}}},buildScene(e,t,o,n){const r="vertical"===o.orientation?"down":"right",i=o.nodeStyle,s=o.edgeStyle,a=o.edgeOpacity??.5,l=o.edgeColorBy||"source",c=Array.isArray(o.colorScheme)?o.colorScheme:o.themeCategorical&&o.themeCategorical.length>0?o.themeCategorical:Gt,u=new Map;e.forEach((e,t)=>{u.set(e.id,c[t%c.length])});const d=[],h=[],f=[],m=new Map;for(const t of e){const e=t.x1-t.x0,o=t.y1-t.y0;if(0>=e||0>=o)continue;const n=i?i(em(t,"nodeStyle")):{},s={fill:n.fill||u.get(t.id)||"#4d430c",stroke:n.stroke,strokeWidth:n.strokeWidth,opacity:n.opacity};m.set(t.id,("string"==typeof s.fill?s.fill:null)||u.get(t.id)||"#4d430c"),d.push("down"===r?{type:"rect",x:t.y0,y:t.x0,w:o,h:e,style:s,datum:t,id:t.id,label:t.id}:{type:"rect",x:t.x0,y:t.y0,w:e,h:o,style:s,datum:t,id:t.id,label:t.id})}const p=[...t].sort((e,t)=>(t.sankeyWidth||0)-(e.sankeyWidth||0));for(const e of p){if(!e.sankeyWidth||0>=e.sankeyWidth)continue;const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;if(!t||!n)continue;let r=o.themeSemantic?.border||o.themeSemantic?.secondary||"#999";r="function"==typeof l?l(e)||r:"target"===l?m.get(n.id)||u.get(n.id)||r:m.get(t.id)||u.get(t.id)||r;const i=s?s(em(e,"edgeStyle")):{};if(e._circularStub&&e.circular&&e.circularPathData){const t=e.circularPathData,o=e.sankeyWidth/2,n=Math.max(15,Math.min(40,.33*(t.rightFullExtent-t.sourceX))),s=Math.max(15,Math.min(40,.33*(t.targetX-t.leftFullExtent))),l=i.fill||r;h.push({type:"bezier",pathD:`M${t.sourceX},${t.sourceY-o}L${t.sourceX+n},${t.sourceY-o}L${t.sourceX+n},${t.sourceY+o}L${t.sourceX},${t.sourceY+o}Z`,style:{fill:l,fillOpacity:i.fillOpacity??a,stroke:"none",opacity:i.opacity},datum:e,_gradient:{direction:"right",from:1,to:0,x0:t.sourceX,x1:t.sourceX+n}}),h.push({type:"bezier",pathD:`M${t.targetX},${t.targetY-o}L${t.targetX-s},${t.targetY-o}L${t.targetX-s},${t.targetY+o}L${t.targetX},${t.targetY+o}Z`,style:{fill:l,fillOpacity:i.fillOpacity??a,stroke:"none",opacity:i.opacity},datum:e,_gradient:{direction:"left",from:0,to:1,x0:t.targetX-s,x1:t.targetX}});continue}let c;(c=e.circular&&e.circularPathData?Qf(e):Kf(e),c)&&h.push({type:"bezier",pathD:c,bezierCache:e.bezier,style:{fill:i.fill||r,fillOpacity:i.fillOpacity??a,stroke:i.stroke||"none",strokeWidth:i.strokeWidth,opacity:i.opacity},datum:e})}if(!1!==o.showLabels){const t=Bt(o.nodeLabel);for(const o of e){const e=o.x1-o.x0,i=o.y1-o.y0;if(0>=e||0>=i)continue;const s=t?t(o):o.id;if(!s)continue;let a,l,c;"down"===r?(a=o.y0+(o.y1-o.y0)/2,l=o.x1+14,c="start"):(n[0]/2>o.x0+e/2?(a=o.x0-6,c="end"):(a=o.x1+6,c="start"),l=o.y0+i/2),f.push({x:a,y:l,text:s+"",anchor:"down"===r?"middle":c,baseline:"middle",fontSize:11})}}return{sceneNodes:d,sceneEdges:h,labels:f}}},nm=require("d3-force"),rm=require("d3-scale");L();var im={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,o,n){if(0===e.length)return;const r=o.forceStrength??.1,i=n[0]/2,s=n[1]/2,a=Math.max(.1,Math.min(1,Math.min(n[0],n[1])/200)),l=Math.min(.5,.06+1.8*(1-a)),c=o.__previousPositions;let u=0;const d=[];for(const t of e){const e=null!=t.x&&null!=t.y&&(0!==t.x||0!==t.y),o=c?.get(t.id);e?u++:o?(t.x=o.x,t.y=o.y,u++):d.push(t)}const h=u>0&&.3>=(e.length>0?d.length/e.length:1);if(h){const o=new Map;for(const t of e)o.set(t.id,t);for(const e of d){const n=sm(e.id,t,o);if(n.length>0){let t=0,o=0;for(const e of n)t+=e.x,o+=e.y;const r=am(e.id),i=r%360*(Math.PI/180),s=(10+r%20)*a;e.x=t/n.length+s*Math.cos(i),e.y=o/n.length+s*Math.sin(i)}else{const t=am(e.id),o=t%360*(Math.PI/180),n=(15+t%30)*a;e.x=i+n*Math.cos(o),e.y=s+n*Math.sin(o)}}}else{const t=2.399963229728653;for(let o=0;e.length>o;o++){const n=e[o];if(null==n.x||null==n.y||0===n.x&&0===n.y){const e=10*Math.sqrt(o+.5)*a,r=o*t;n.x=i+e*Math.cos(r),n.y=s+e*Math.sin(r)}}}const f=o.__skipForceSimulation||0===o.iterations?0:h?40:o.iterations??Math.max(50,Math.min(300,Math.floor(300-2*(e.length-30)))),m=lm(o.nodeSize,o.nodeSizeRange,e),p=e=>m(e);if(f>0){const c=new Map,u=new Map;for(const t of e)c.set(t.id,0),u.set(t.id,t);for(const e of t){const t=Ft(e.source),o=Ft(e.target);c.set(t,(c.get(t)??0)+1),c.set(o,(c.get(o)??0)+1)}const d=(0,nm.forceLink)().strength(e=>{const t=e.weight,o=Ft(e.source),n=Ft(e.target),i=Math.max(1,Math.min(c.get(o)??1,c.get(n)??1));return Math.min(2.5,(t&&t>0?Math.sqrt(t):1)*r/(.1*i))}).distance(e=>{const t="string"==typeof e.source?u.get(e.source):e.source,o="string"==typeof e.target?u.get(e.target):e.target,n=(t?p(t):0)+(o?p(o):0)+Math.max(6,12*a);return Math.max(16,40*a,n)}).id(e=>e.id),m=(0,nm.forceSimulation)();if(void 0===o.random&&void 0===o.seed||m.randomSource(o.random??Qc(o.seed)),m.force("charge",(0,nm.forceManyBody)().strength(e=>{const t=c.get(e.id)??0;return-15*a*p(e)*Math.sqrt(t+1)})).force("collide",(0,nm.forceCollide)(e=>p(e)+3*a).strength(.9).iterations(2)).force("center",(0,nm.forceCenter)(i,s).strength(.8)).force("x",(0,nm.forceX)(i).strength(l)).force("y",(0,nm.forceY)(s).strength(l)).force("bounds",function(e,t,o=2,n=.6){let r=[];const i=i=>{const s=n*Math.max(i,.2);for(const n of r){const r=n.x??e[0]/2,i=n.y??e[1]/2,a=n.vx??0,l=n.vy??0,c=t(n)+o,u=Math.min(e[0]/2,c),d=Math.max(e[0]/2,e[0]-c),h=Math.min(e[1]/2,c),f=Math.max(e[1]/2,e[1]-c),m=r+a,p=i+l;u>m?n.vx=a+(u-m)*s:m>d&&(n.vx=a+(d-m)*s),h>p?n.vy=l+(h-p)*s:p>f&&(n.vy=l+(f-p)*s)}};return i.initialize=e=>{r=e},i}(n,p)),m.nodes(e),t.length>0){const e=t.map(e=>({...e,source:Ft(e.source),target:Ft(e.target)}));d.links(e),m.force("link",d)}h?m.alpha(.3):.1>m.alpha()&&m.alpha(1),m.stop();for(let e=0;f>e;++e)m.tick()}for(const t of e){if(null==t.x||null==t.y)continue;const e=p(t),o=f>0?2:0,r=Math.min(n[0]/2,e+o),i=Math.min(n[1]/2,e+o);t.x=Math.max(r,Math.min(n[0]-r,t.x)),t.y=Math.max(i,Math.min(n[1]-i,t.y)),t.x0=0,t.x1=0,t.y0=0,t.y1=0}const g=new Map;for(const t of e)g.set(t.id,t);for(const e of t){if("string"==typeof e.source){const t=g.get(e.source);t&&(e.source=t)}if("string"==typeof e.target){const t=g.get(e.target);t&&(e.target=t)}}},buildScene(e,t,o,n){const r=o.nodeStyle,i=o.edgeStyle,s=lm(o.nodeSize,o.nodeSizeRange,e),a=Array.isArray(o.colorScheme)?o.colorScheme:o.themeCategorical&&o.themeCategorical.length>0?o.themeCategorical:Gt,l=new Map;e.forEach((e,t)=>{l.set(e.id,a[t%a.length])});const c=[],u=[],d=[];for(const t of e){if(null==t.x||null==t.y)continue;const e=s(em(t,"nodeSize")),n=r?r(em(t,"nodeStyle")):{},i={fill:n.fill||l.get(t.id)||o.themeSemantic?.primary||"#007bff",stroke:n.stroke||o.themeSemantic?.surface||"#fff",strokeWidth:n.strokeWidth??2,opacity:n.opacity};c.push({type:"circle",cx:t.x,cy:t.y,r:e,style:i,datum:t,id:t.id,label:t.id})}const h=new Map;for(const t of e)h.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:h.get(e.source),n="object"==typeof e.target?e.target:h.get(e.target);if(!t||!n)continue;if(null==t.x||null==t.y)continue;if(null==n.x||null==n.y)continue;const r=i?i(em(e,"edgeStyle")):{};u.push({type:"line",x1:t.x,y1:t.y,x2:n.x,y2:n.y,style:{stroke:r.stroke||o.themeSemantic?.border||o.themeSemantic?.secondary||"#999",strokeWidth:r.strokeWidth??1,opacity:r.opacity??.6},datum:e})}if(!1!==o.showLabels){const t=Bt(o.nodeLabel);for(const o of e){if(null==o.x||null==o.y)continue;const e=t?t(o):o.id;if(!e)continue;const n=s(em(o,"nodeSize"));d.push({x:o.x,y:o.y-n-4,text:e+"",anchor:"middle",baseline:"auto",fontSize:11})}}return{sceneNodes:c,sceneEdges:u,labels:d}}};function sm(e,t,o){const n=[];for(const r of t){const t=Ft(r.source),i=Ft(r.target);let s=null;if(t===e?s=i:i===e&&(s=t),s){const e=o.get(s);!e||0===e.x&&0===e.y||n.push({x:e.x,y:e.y})}}return n}function am(e){let t=0;for(let o=0;e.length>o;o++)t=(t<<5)-t+e.charCodeAt(o)|0;return Math.abs(t)}function lm(e,t,o){if(o.some(e=>null!=e.__forceRadius))return e=>e.__forceRadius??8;if(null==e)return()=>8;if("number"==typeof e)return()=>e;if("function"==typeof e)return t=>e(t)||8;const n=t||[5,20],r=[];for(const t of o){const o=t.data?.[e];"number"==typeof o&&r.push(o)}if(0===r.length)return()=>n[0];const[i,s]=P(r);if(i===s)return()=>(n[0]+n[1])/2;const a=(0,rm.scaleLinear)().domain([i,s]).range(n).clamp(!0);return t=>{const o=t.data?.[e];return null==o||"number"!=typeof o?n[0]:a(o)}}var cm=require("d3-chord"),um=require("d3-shape"),dm=Gt,hm={supportsStreaming:!1,hierarchical:!1,computeLayout(e,t,o,n){if(0===e.length)return;const{padAngle:r=.01,groupWidth:i=20,sortGroups:s}=o,a=Math.min(n[0],n[1])/2,l=a-i,c=n[0]/2,u=n[1]/2,d=(h=o.valueAccessor)?"function"==typeof h?h:e=>e[h]??1:e=>e.value??1;var h;const f=new Map;for(let t=0;e.length>t;t++)f.set(e[t].id,t);const m=e.length,p=Array.from({length:m},()=>Array.from({length:m},()=>0));for(const e of t){const t=Ft(e.source),o=Ft(e.target),n=f.get(t),r=f.get(o);if(void 0===n||void 0===r)continue;const i=d(e);p[n][r]=i}const g=(0,cm.chord)().padAngle(r);s&&g.sortGroups(s);const y=g(p),b=y.groups,v=(0,um.arc)().innerRadius(l).outerRadius(a);for(const t of b){const o=e[t.index],n=v.centroid({innerRadius:l,outerRadius:a,startAngle:t.startAngle,endAngle:t.endAngle});o.x=n[0]+c,o.y=n[1]+u,o.__arcData={startAngle:t.startAngle,endAngle:t.endAngle}}const x=new Map;for(const t of e)x.set(t.id,t);for(const e of t){const t=Ft(e.source),o=Ft(e.target),n=x.get(t),r=x.get(o);n&&(e.source=n),r&&(e.target=r)}const k=new Map;for(const e of t){const t=Ft(e.source),o=Ft(e.target);k.set(`${t}\0${o}`,e)}for(const t of y){const o=e[t.source.index].id,n=e[t.target.index].id,r=k.get(`${o}\0${n}`)||k.get(`${n}\0${o}`);r&&(r.__chordData=t)}},buildScene(e,t,o,n){const{groupWidth:r=20,edgeOpacity:i=.5}=o,s=Math.min(n[0],n[1])/2,a=s-r,l=n[0]/2,c=n[1]/2,u=o.nodeStyle,d=o.edgeStyle,h=o.edgeColorBy||"source",f=Array.isArray(o.colorScheme)?o.colorScheme:o.themeCategorical&&o.themeCategorical.length>0?o.themeCategorical:dm,m=new Map;e.forEach((e,t)=>{m.set(e.id,f[t%f.length])});const p=(0,cm.ribbon)().radius(a),g=[],y=[],b=[];for(let t=0;e.length>t;t++){const o=e[t],n=o.__arcData;if(!n)continue;let r;r=u?u(em(o,"nodeStyle")).fill||m.get(o.id)||f[t%f.length]:m.get(o.id)||f[t%f.length];const i=u?u(em(o,"nodeStyle")):{};g.push({type:"arc",cx:l,cy:c,innerR:a,outerR:s,startAngle:n.startAngle-Math.PI/2,endAngle:n.endAngle-Math.PI/2,style:{fill:r,stroke:i.stroke||"black",strokeWidth:i.strokeWidth??1,opacity:i.opacity},datum:o,id:o.id,label:o.id})}for(const e of t){const t=e.__chordData;if(!t)continue;const n=p(t);if(!n)continue;const r=fm(n,l,c);let s=o.themeSemantic?.border||o.themeSemantic?.secondary||"#999";if(d)s=d(em(e,"edgeStyle")).fill||s;else{const t="object"==typeof e.source?e.source:null,o="object"==typeof e.target?e.target:null;"target"===h&&o?s=m.get(o.id)||s:t&&(s=m.get(t.id)||s)}const a=d?d(em(e,"edgeStyle")):{};y.push({type:"ribbon",pathD:r,style:{fill:s,fillOpacity:a.fillOpacity??i,stroke:a.stroke||"none",strokeWidth:a.strokeWidth,opacity:a.opacity},datum:e})}if(!1!==o.showLabels){const t=Bt(o.nodeLabel),n=s+12;for(const o of e){const e=o.__arcData;if(!e)continue;const r=t?t(o):o.id;if(!r)continue;const i=(e.startAngle+e.endAngle)/2,s=i-Math.PI/2;b.push({x:l+Math.cos(s)*n,y:c+Math.sin(s)*n,text:r+"",anchor:i>Math.PI?"end":"start",baseline:"middle",fontSize:11})}}return{sceneNodes:g,sceneEdges:y,labels:b}}};function fm(e,t,o){const n=e.match(/[a-zA-Z]|[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?/g);if(!n)return e;const r=[];let i=0;for(;n.length>i;){const e=n[i];if("M"===e||"L"===e)for(r.push(e),i++;n.length>i&&!isNaN(Number(n[i]));)r.push(Number(n[i])+t+""),i++,n.length>i&&!isNaN(Number(n[i]))&&(r.push(Number(n[i])+o+""),i++);else if("C"===e)for(r.push(e),i++;n.length>i&&!isNaN(Number(n[i]));)for(let e=0;3>e&&n.length>i&&!isNaN(Number(n[i]));e++)r.push(Number(n[i])+t+""),i++,n.length>i&&!isNaN(Number(n[i]))&&(r.push(Number(n[i])+o+""),i++);else if("Q"===e)for(r.push(e),i++;n.length>i&&!isNaN(Number(n[i]));)for(let e=0;2>e&&n.length>i&&!isNaN(Number(n[i]));e++)r.push(Number(n[i])+t+""),i++,n.length>i&&!isNaN(Number(n[i]))&&(r.push(Number(n[i])+o+""),i++);else if("A"===e)for(r.push(e),i++;n.length>i&&!isNaN(Number(n[i]));)r.push(n[i++]),n.length>i&&r.push(n[i++]),n.length>i&&r.push(n[i++]),n.length>i&&r.push(n[i++]),n.length>i&&r.push(n[i++]),n.length>i&&(r.push(Number(n[i])+t+""),i++),n.length>i&&(r.push(Number(n[i])+o+""),i++);else"Z"===e||"z"===e?(r.push(e),i++):(r.push(n[i]),i++)}return r.join(" ")}var mm=require("d3-hierarchy"),pm=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];function gm(e){const[t,o,n]=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*o+.114*n>150?"#222":"#fff"}function ym(e,t,o){const n=t.nodeIDAccessor;return"function"==typeof n?n(e.data)+"":"string"==typeof n&&void 0!==e.data[n]?e.data[n]+"":void 0!==e.data.name?e.data.name+"":void 0!==e.data.id?e.data.id+"":"node-"+o}function bm(e){if(!e)return null;if("function"==typeof e){const t=e;return e=>t(e.data??e)}return t=>t.data?.[e]||t[e]||t.id}function vm(e){return Array.isArray(e.colorScheme)?e.colorScheme:e.themeCategorical&&e.themeCategorical.length>0?e.themeCategorical:pm}function xm(e){return Array.isArray(e.colorScheme)&&e.colorScheme.length>0?e.colorScheme[0]:e.themeSemantic?.primary?e.themeSemantic.primary:e.themeCategorical&&e.themeCategorical.length>0?e.themeCategorical[0]:"#4d430c"}function km(e,t,o,n,r){if("horizontal"===r){const r=(e+o)/2;return`M ${e},${t} C ${r},${t} ${r},${n} ${o},${n}`}if("radial"===r){const r=(e+o)/2;return`M ${e},${t} Q ${r},${t} ${r},${(t+n)/2} T ${o},${n}`}{const r=(t+n)/2;return`M ${e},${t} C ${e},${r} ${o},${r} ${o},${n}`}}var wm={supportsStreaming:!1,hierarchical:!0,computeLayout(e,t,o,n){const r=o.__hierarchyRoot;if(!r)return;const i=o.chartType,s=function(e){if(e)return"function"==typeof e?e:t=>t[e]}(o.childrenAccessor),a=o.hierarchySum,l="function"==typeof a?a:"string"==typeof a?e=>Number(e[a])||0:e=>Number(e.value)||0,c=(0,mm.hierarchy)(r,s);c.sum(l),c.sort((e,t)=>(t.value??0)-(e.value??0));const[u,d]=n;switch(i){case"tree":!function(e,t,o,n){const r=t.treeOrientation||"vertical",i=(0,mm.tree)();i.size("horizontal"===r?[n,o]:"radial"===r?[2*Math.PI,Math.min(o,n)/2*.8]:[o,n]),i(e)}(c,o,u,d);break;case"cluster":!function(e,t,o,n){const r=t.treeOrientation||"vertical",i=(0,mm.cluster)();i.size("horizontal"===r?[n,o]:"radial"===r?[2*Math.PI,Math.min(o,n)/2*.8]:[o,n]),i(e)}(c,o,u,d);break;case"treemap":!function(e,t,o,n){const r=t.padding??4,i=t.paddingTop??0,s=(0,mm.treemap)().size([o,n]).tile(mm.treemapBinary).padding(r);i>0&&s.paddingTop(i),s(e)}(c,o,u,d);break;case"circlepack":!function(e,t,o,n){const r=t.padding??4;(0,mm.pack)().size([o,n]).padding(r)(e)}(c,o,u,d);break;case"partition":!function(e,t,o,n){(0,mm.partition)().size([o,n]).padding(t.padding??1)(e)}(c,o,u,d)}const h=c.descendants();e.length=0,t.length=0;const f=new Map;for(let t=0;h.length>t;t++){const n=h[t],r={id:ym(n,o,t),x:0,y:0,x0:0,x1:0,y0:0,y1:0,width:0,height:0,value:n.value??0,depth:n.depth,data:n.data,createdByFrame:!0};"tree"===i||"cluster"===i?Sm(r,n,o):"treemap"===i||"partition"===i?Am(r,n):"circlepack"===i&&Cm(r,n),r.__hierarchyNode=n,e.push(r),f.set(n,r)}if("tree"===i||"cluster"===i)for(const e of h)if(e.parent){const o=f.get(e.parent),n=f.get(e);o&&n&&t.push({source:o,target:n,value:1,y0:0,y1:0,sankeyWidth:0,data:{depth:e.depth}})}},buildScene(e,t,o,n){const r=o.nodeStyle||(()=>({})),i=o.edgeStyle||(()=>({}));switch(o.chartType){case"tree":case"cluster":return function(e,t,o,n,r,i){const s=[],a=[],l=[],c=o.treeOrientation||"vertical",u="radial"===c,d=n[0]/2,h=n[1]/2,f="number"==typeof(m=o.nodeSize)?m:5;var m;for(const t of e){let e=t.x,n=t.y;u&&(e+=d,n+=h);const i=r(em(t,"nodeStyle"));let a=i.fill||xm(o);if(o.colorByDepth&&void 0!==t.depth){const e=vm(o);a=e[t.depth%e.length]}s.push({type:"circle",cx:e,cy:n,r:f,style:{fill:a,stroke:i.stroke||o.themeSemantic?.surface||"#fff",strokeWidth:i.strokeWidth??1,opacity:i.opacity},datum:t,id:t.id,label:t.id,depth:t.depth})}const p=o.edgeOpacity??.5;for(const e of t){const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;if(!t||!n)continue;let r=t.x,s=t.y,l=n.x,f=n.y;u&&(r+=d,s+=h,l+=d,f+=h);const m=km(r,s,l,f,c),g=i(em(e,"edgeStyle"));a.push({type:"curved",pathD:m,style:{fill:"none",stroke:g.stroke||o.themeSemantic?.border||o.themeSemantic?.secondary||"#999",strokeWidth:g.strokeWidth??1.5,opacity:g.opacity??p},datum:e})}if(!1!==o.showLabels){const t=bm(o.nodeLabel);for(const o of e){const e=t?t(o):o.id;if(!e)continue;let n,r,i,s=o.x,a=o.y;if(u&&(s+=d,a+=h),u){const e=s-d,t=a-h,o=Math.sqrt(e*e+t*t);o>0?(n=s+e/o*10,r=a+t/o*10,i=0>e?"end":"start"):(n=s,r=a-12,i="middle")}else"horizontal"===c?(o.data?.children&&0!==o.data.children.length?(n=s-f-6,i="end"):(n=s+f+6,i="start"),r=a):(n=s,r=a+f+14,i="middle");l.push({x:n,y:r,text:e+"",anchor:i,baseline:"middle",fontSize:11})}}return{sceneNodes:s,sceneEdges:a,labels:l}}(e,t,o,n,r,i);case"treemap":case"partition":return function(e,t,o,n){const r=[],i=[];for(const o of e){const e=o.x1-o.x0,i=o.y1-o.y0;if(0>=e||0>=i)continue;const s=n(em(o,"nodeStyle"));let a=s.fill||xm(t);if(t.colorByDepth&&void 0!==o.depth){const e=vm(t);a=e[o.depth%e.length]}r.push({type:"rect",x:o.x0,y:o.y0,w:e,h:i,style:{fill:a,stroke:s.stroke||t.themeSemantic?.surface||"#fff",strokeWidth:s.strokeWidth??1,opacity:s.opacity,fillOpacity:s.fillOpacity,strokeOpacity:s.strokeOpacity},datum:o,id:o.id,label:o.id,depth:o.depth})}if(!1!==t.showLabels){const o=bm(t.nodeLabel),r=t.labelMode||"leaf",s="partition"===t.chartType;for(const a of e){const e=a.x1-a.x0,l=a.y1-a.y0;if(0>=e||0>=l)continue;const c=!(a.data?.children&&a.data.children.length>0);if(!s){if("leaf"===r&&!c)continue;if("parent"===r&&c)continue}const u=o?o(a):a.id;if(!u)continue;if((c?30:40)>e||(c?16:14)>l)continue;let d=n(em(a,"nodeStyle")).fill||xm(t);if(t.colorByDepth&&void 0!==a.depth){const e=vm(t);d=e[a.depth%e.length]}const h="string"==typeof d?gm(d):t.themeSemantic?.text??"#000";i.push(c?{x:a.x0+e/2,y:a.y0+l/2,text:u+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,Math.min(e,l)/6)),fill:h}:{x:a.x0+4,y:a.y0+12,text:u+"",anchor:"start",baseline:"auto",fontSize:11,fontWeight:600,fill:h})}}return{sceneNodes:r,sceneEdges:[],labels:i}}(e,o,0,r);case"circlepack":return function(e,t,o,n){const r=[],i=[];for(const o of e){const e=o.__radius??5;if(0>=e)continue;const i=n(em(o,"nodeStyle"));let s=i.fill||xm(t);if(t.colorByDepth&&void 0!==o.depth){const e=vm(t);s=e[o.depth%e.length]}r.push({type:"circle",cx:o.x,cy:o.y,r:e,style:{fill:s,stroke:i.stroke||t.themeSemantic?.surface||"#fff",strokeWidth:i.strokeWidth??1,opacity:i.opacity??.7},datum:o,id:o.id,label:o.id,depth:o.depth})}if(!1!==t.showLabels){const o=bm(t.nodeLabel);for(const r of e){const e=r.__radius??5,s=o?o(r):r.id;if(!s)continue;if(15>e)continue;const a=!(r.data?.children&&r.data.children.length>0);let l=n(em(r,"nodeStyle")).fill||xm(t);if(t.colorByDepth&&void 0!==r.depth){const e=vm(t);l=e[r.depth%e.length]}if(a){const o="string"==typeof l?gm(l):t.themeSemantic?.text??"#000";i.push({x:r.x,y:r.y,text:s+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,e/3)),fill:o})}else i.push({x:r.x,y:r.y-e+14,text:s+"",anchor:"middle",baseline:"hanging",fontSize:Math.min(11,Math.max(8,e/3)),fill:t.themeSemantic?.text||"#000",stroke:t.themeSemantic?.surface||"#fff",strokeWidth:3,paintOrder:"stroke"})}}return{sceneNodes:r,sceneEdges:[],labels:i}}(e,o,0,r);default:return{sceneNodes:[],sceneEdges:[],labels:[]}}}};function Sm(e,t,o){const n=o.treeOrientation||"vertical";if("radial"===n){const o=t.x,n=t.y;e.x=n*Math.cos(o-Math.PI/2),e.y=n*Math.sin(o-Math.PI/2)}else"horizontal"===n?(e.x=t.y,e.y=t.x):(e.x=t.x,e.y=t.y);e.x0=e.x-5,e.x1=e.x+5,e.y0=e.y-5,e.y1=e.y+5,e.width=10,e.height=10}function Am(e,t){e.x0=t.x0,e.x1=t.x1,e.y0=t.y0,e.y1=t.y1,e.x=(t.x0+t.x1)/2,e.y=(t.y0+t.y1)/2,e.width=t.x1-t.x0,e.height=t.y1-t.y0}function Cm(e,t){const o=t.r??0;e.x=t.x,e.y=t.y,e.x0=t.x-o,e.x1=t.x+o,e.y0=t.y-o,e.y1=t.y+o,e.width=2*o,e.height=2*o,e.__radius=o}var Mm=require("d3-shape");function _m(e){let t=e.__orbitState;return t||(t={metaMap:new Map,startTime:"undefined"!=typeof performance?performance.now():Date.now()},e.__orbitState=t),t}var Pm={sankey:om,force:im,chord:hm,tree:wm,cluster:wm,treemap:wm,circlepack:wm,partition:wm,orbit:{supportsStreaming:!1,hierarchical:!0,supportsAnimation:!0,computeLayout(e,t,o,n){const r=o.__hierarchyRoot;r&&function(e,t,o,n,r){const i=function(e){if("function"==typeof e)return e;const t=e||"children";return e=>e[t]||null}(o.childrenAccessor),s=function(e){if("function"==typeof e)return e;const t=e||"name";return e=>(e[t]??"")+""}(o.nodeIDAccessor),a=function(e){if(Array.isArray(e))return e;switch(e){case"solar":return[1];case"atomic":return[2,8];default:return[9999]}}(o.orbitMode),l=o.orbitSize??2.95,c=o.orbitEccentricity??1,u="number"==typeof l?()=>l:l,d="number"==typeof c?()=>c:c,h=_m(o);h.metaMap.clear(),n.length=0,r.length=0;const f=new Map;function m(e){const t=f.get(e)??0;return f.set(e,t+1),0===t?e:`${e}__${t}`}const p=t[0]/2,g=t[1]/2,y=Math.min(t[0],t[1])/2*.85,b=m(s(e));n.push({id:b,x:p,y:g,x0:p,x1:p,y0:g,y1:g,width:0,height:0,value:0,depth:0,data:e}),h.metaMap.set(b,{ring:y,angle:0,depth:0,parentId:null,eccentricity:1}),function e(t,o,l,c,f,p,g){const y=i(t);if(!y?.length)return;const b=y.length;let v=0,x=0,k=0;for(;b>x;)x+=a[Math.min(k,a.length-1)],k++,v++;let w=0;for(let b=0;v>b;b++){const x=a[Math.min(b,a.length-1)],k=y.slice(w,w+x);if(!k.length)break;const S=(b+1)/v,A={id:o,depth:p,data:t,parentId:o},C=g?f/u(A)*S:f*S,M=(0,Mm.pie)().value(e=>{const t=i(e)?.length;return t?4:1}).sort(null)(k),_=d(A);for(let t=0;k.length>t;t++){const i=(M[t].startAngle+M[t].endAngle)/2,a=k[t],u=m(s(a)),d=l+C*Math.sin(i),f=c+C*Math.cos(i)*_;n.push({id:u,x:d,y:f,x0:d,x1:d,y0:f,y1:f,width:0,height:0,value:0,depth:p,data:a}),h.metaMap.set(u,{ring:C,angle:i,depth:p,parentId:o,eccentricity:_}),r.push({source:o,target:u,value:1,y0:0,y1:0,sankeyWidth:0,data:{source:o,target:u}}),e(a,u,d,f,C,p+1,!0)}w+=x}}(e,b,p,g,y,1,!1)}(r,n,o,e,t)},buildScene(e,t,o,n){const r=o.nodeStyle,i=o.nodeSize,s="number"==typeof i?()=>i:"function"==typeof i?i:()=>6,a=[],l=[],c=[];if(!1!==o.orbitShowRings){const t=_m(o),n=new Map;for(const t of e)n.set(t.id,t);const r=new Map;for(const[,e]of t.metaMap){if(!e.parentId)continue;const t=n.get(e.parentId);if(!t)continue;const o=`${e.parentId}:${e.ring}`;r.has(o)||r.set(o,{parentX:t.x,parentY:t.y,ring:e.ring,ecc:e.eccentricity})}const i=48,s={stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1};for(const[,{parentX:e,parentY:t,ring:o,ecc:n}]of r)for(let r=0;i>r;r++){const a=r/i*Math.PI*2,c=(r+1)/i*Math.PI*2;l.push({type:"line",x1:e+o*Math.sin(a),y1:t+o*Math.cos(a)*n,x2:e+o*Math.sin(c),y2:t+o*Math.cos(c)*n,style:s,datum:null})}}for(const t of e){if(null==t.x||null==t.y)continue;const e=s(em(t,"nodeSize")),n=r?r(em(t,"nodeStyle")):{};a.push({type:"circle",cx:t.x,cy:t.y,r:e,style:{fill:n.fill||o.themeSemantic?.primary||"#6366f1",stroke:n.stroke||o.themeSemantic?.surface||"#fff",strokeWidth:n.strokeWidth??1,opacity:n.opacity??(0===(t.depth??0)?1:.85)},datum:t,id:t.id,label:t.id,depth:t.depth})}const u=new Map;for(const t of e)u.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:u.get(e.source),o="object"==typeof e.target?e.target:u.get(e.target);t&&o&&(null!=t.x&&null!=o.x&&l.push({type:"line",x1:t.x,y1:t.y,x2:o.x,y2:o.y,style:{stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1},datum:e}))}if(o.showLabels){const t=o.nodeLabel;for(const o of e){const e=s(em(o,"nodeSize"));if(4>=e)continue;const n="function"==typeof t?t(o):t?o.data?.[t]??o.id:o.id;c.push({x:o.x,y:o.y+e+12,text:n+"",anchor:"middle",fontSize:10,fill:"currentColor"})}}return{sceneNodes:a,sceneEdges:l,labels:c}},tick:(e,t,o,n,r)=>!1!==o.orbitAnimated&&(function(e,t){const o=_m(t),n=t.orbitSpeed??.25,r=t.orbitRevolution??function(e){switch(e){case"decay":return e=>Math.pow(.6,e.depth??0);case"alternate":return e=>{const t=e.depth??0;return(t%2==0?1:-1)/(t+1)};default:return e=>1/((e.depth??0)+1)}}(t.orbitRevolutionStyle),i=(("undefined"!=typeof performance?performance.now():Date.now())-o.startTime)/1e3,s=n*(Math.PI/6),a=new Map;for(const t of e)a.set(t.id,t);for(const t of e){const e=o.metaMap.get(t.id);if(!e||!e.parentId)continue;const n=a.get(e.parentId);if(!n)continue;const l=e.angle+i*s*r({id:t.id,depth:e.depth,data:t.data,parentId:e.parentId});t.x=n.x+e.ring*Math.sin(l),t.y=n.y+e.ring*Math.cos(l)*e.eccentricity,t.x0=t.x,t.x1=t.x,t.y0=t.y,t.y1=t.y}}(e,o),!0)}};function Rm(e){return Pm[e]}var jm=require("d3-quadtree");function Lm(e){return{id:e,x0:0,x1:0,y0:0,y1:0,x:0,y:0,width:0,height:0,value:0,createdByFrame:!0}}function Tm(e){if(!e||"object"!=typeof e)return!1;const t=e;if("boolean"!=typeof t.circular)return!1;if("number"!=typeof t.halfWidth||!Number.isFinite(t.halfWidth))return!1;if(t.circular){if(!Array.isArray(t.segments)||0===t.segments.length)return!1;for(const e of t.segments)if(!Im(e))return!1;return!0}return Im(t.points)}function Im(e){if(!Array.isArray(e)||4!==e.length)return!1;for(const t of e){if(!t||"object"!=typeof t)return!1;const e=t;if("number"!=typeof e.x||!Number.isFinite(e.x))return!1;if("number"!=typeof e.y||!Number.isFinite(e.y))return!1}return!0}var $m=require("d3-interpolate");var Nm="rgba(34, 197, 94, 0.7)",Dm=2e3,Em=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Om=["scene-style","data-paint","accessibility","evidence"],Bm=(e,t)=>({retainedData:e,invalidations:t}),Fm=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],zm=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Hm=["scene-geometry","data-paint","overlay","accessibility","evidence"],Wm=["scene-style","data-paint","accessibility","evidence"],qm=["scene-geometry","data-paint","overlay","accessibility","evidence"],Ym=[],Gm={chartType:Bm("rebuild",Fm),nodeIDAccessor:Bm("rebuild",Fm),sourceAccessor:Bm("rebuild",Fm),targetAccessor:Bm("rebuild",Fm),valueAccessor:Bm("rebuild",Fm),edgeIdAccessor:Bm("rebuild",Fm),childrenAccessor:Bm("rebuild",Fm),hierarchySum:Bm("rebuild",Fm),orientation:Bm("preserve",zm),nodeAlign:Bm("preserve",zm),nodePaddingRatio:Bm("preserve",zm),nodeWidth:Bm("preserve",zm),edgeSort:Bm("preserve",zm),iterations:Bm("preserve",zm),forceStrength:Bm("preserve",zm),padAngle:Bm("preserve",zm),groupWidth:Bm("preserve",zm),sortGroups:Bm("preserve",zm),treeOrientation:Bm("preserve",zm),edgeType:Bm("preserve",zm),padding:Bm("preserve",zm),paddingTop:Bm("preserve",zm),orbitMode:Bm("preserve",zm),orbitSize:Bm("preserve",zm),orbitSpeed:Bm("preserve",zm),orbitRevolution:Bm("preserve",zm),orbitRevolutionStyle:Bm("preserve",zm),orbitEccentricity:Bm("preserve",zm),orbitShowRings:Bm("preserve",zm),orbitAnimated:Bm("preserve",zm),customNetworkLayout:Bm("preserve",zm),layoutConfig:Bm("preserve",zm),nodeSize:Bm("preserve",Hm),nodeSizeRange:Bm("preserve",Hm),colorByDepth:Bm("preserve",Hm),nodeLabel:Bm("preserve",qm),showLabels:Bm("preserve",qm),labelMode:Bm("preserve",qm),nodeStyle:Bm("preserve",Wm),edgeStyle:Bm("preserve",Wm),colorBy:Bm("preserve",Wm),colorScheme:Bm("preserve",Wm),themeCategorical:Bm("preserve",Wm),themeSemantic:Bm("preserve",Wm),edgeColorBy:Bm("preserve",Wm),edgeOpacity:Bm("preserve",Wm),showParticles:Bm("preserve",Wm),particleStyle:Bm("preserve",Wm),decay:Bm("preserve",Wm),pulse:Bm("preserve",Wm),thresholds:Bm("preserve",Wm),staleness:Bm("preserve",Wm),layoutSelection:Bm("preserve",Wm),clock:Bm("preserve",Ym),random:Bm("preserve",Ym),seed:Bm("preserve",Ym),tensionConfig:Bm("preserve",Ym),transition:Bm("preserve",Ym),introAnimation:Bm("preserve",Ym),onLayoutError:Bm("preserve",Ym),__skipForceSimulation:Bm("preserve",Ym),__hierarchyRoot:Bm("preserve",Ym),__orbitState:Bm("preserve",Ym),__previousPositions:Bm("preserve",Ym)},Vm=Bm("preserve",zm),Xm=class{constructor(){this.tracker=new qn}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}},Em)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},Om):this.recordNoop("restyle")}recordConfig(e){const t=function(e){let t="preserve";const o=new Set;for(const n of e){const e=Gm[n]??Vm;"rebuild"===e.retainedData&&(t="rebuild");for(const t of e.invalidations)o.add(t)}return{retainedData:t,invalidations:o}}(e);return this.tracker.record({kind:"config",keys:e},t.invalidations)}},Um=class e{constructor(e){this.nodes=new Map,this.edges=new Map,this.tension=0,this.layoutVersion=0,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this.customLayoutHtmlMarks=[],this._customLayoutDiagnosticsWarned=new Set,this._customRestyle=void 0,this._customRestyleEdge=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this._nodeQuadtree=null,this._maxNodeRadius=0,this._sceneNodesRevision=0,this._nodeQuadtreeRevision=-1,this._nodesArrCache=null,this._edgesArrCache=null,this._arrCacheVersion=-1,this.particlePool=null,this.updateResults=new Xm,this.transition=null,this._hasRenderedOnce=!1,this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,this.lastIngestTime=0,this.nodeTimestamps=new Map,this.edgeTimestamps=new Map,this._decaySortedNodes=null,this._decayAgeMap=null,this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set,this.lastTopologyChangeTime=0,this.previousNodeIds=new Set,this.previousEdgeKeys=new Set,this._networkDecayCache=null,this._lastPositionSnapshot=null,this.config=e,this.tensionConfig={...tf,...e.tensionConfig},e.showParticles&&("sankey"===e.chartType||e.customNetworkLayout)&&(this.particlePool=new nf(2e3))}currentTime(){return this.config.clock?.()??Ro()}updateConfig(e){const t=this.config,o={...t,...e};t.__orbitState&&(o.__orbitState=t.__orbitState),t.__hierarchyRoot&&(o.__hierarchyRoot=t.__hierarchyRoot),void 0===e.layoutSelection&&null!=t.layoutSelection&&(o.layoutSelection=t.layoutSelection);const n=[...new Set([...Object.keys(t),...Object.keys(o)])].filter(e=>t[e]!==o[e]);this.config=o,this.tensionConfig={...tf,...o.tensionConfig},!o.showParticles||"sankey"!==o.chartType&&!o.customNetworkLayout||this.particlePool||(this.particlePool=new nf(2e3)),this.updateResults.recordConfig(n)}updateConfigWithResult(e){return this.updateConfig(e),this.updateResults.last}ingestHierarchy(e,t){this._boundedPrevSnapshot=new Map;for(const[e,t]of this.nodes)0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1||this._boundedPrevSnapshot.set(e,{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this._networkDecayCache=null,this.config.__hierarchyRoot=e,this.runLayout(t),this._boundedPrevSnapshot=null,this.updateResults.recordData("replace",1)}ingestBounded(e,t,o,n){const{nodeIDAccessor:r="id",sourceAccessor:i="source",targetAccessor:s="target",valueAccessor:a="value"}=this.config,l="function"==typeof r?r:e=>e[r],c="function"==typeof i?i:e=>e[i],u="function"==typeof s?s:e=>e[s],d="function"==typeof a?a:e=>e[a]??1;this._boundedPrevSnapshot=new Map;for(const[e,t]of this.nodes)0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1||this._boundedPrevSnapshot.set(e,{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});this._boundedEdgeSnapshot=new Map;for(const[,e]of this.edges)e.sankeyWidth>0&&this._boundedEdgeSnapshot.set(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,{y0:e.y0,y1:e.y1,sankeyWidth:e.sankeyWidth});this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this._networkDecayCache=null;for(const t of e){const e=l(t)+"";this.nodes.set(e,{...Lm(e),data:t})}for(let e=0;t.length>e;e++){const o=t[e],n=c(o)+"",r=u(o)+"",i=d(o),s=null==i?NaN:Number(i),a=Number.isFinite(s)?s:1;this.nodes.has(n)||this.nodes.set(n,{...Lm(n),data:o}),this.nodes.has(r)||this.nodes.set(r,{...Lm(r),data:o});const l=`${n}\0${r}\0${e}`,h={source:n,target:r,value:a,y0:0,y1:0,sankeyWidth:0,data:o,_edgeKey:l};o&&"object"==typeof o&&Tm(o.bezier)&&(h.bezier=o.bezier),this.edges.set(l,h)}n?.deferLayout||this.runLayout(o),this.updateResults.recordData("replace",e.length+t.length)}ingestBoundedWithResult(e,t,o,n){return this.ingestBounded(e,t,o,n),this.updateResults.last}applyForceLayoutPositions(e,t){for(const[t,o]of Object.entries(e)){const e=this.nodes.get(t);e&&(e.x=o.x,e.y=o.y)}this.config.__skipForceSimulation=!0;try{this.runLayout(t)}finally{this.config.__skipForceSimulation=void 0}}edgeKey(e,t){return`${e}\0${t}`}ingestEdge(e){const{source:t,target:o,value:n}=e,r=0===this.nodes.size;let i=!1;const s=this.currentTime();this.lastIngestTime=s,this._decaySortedNodes=null,this._networkDecayCache=null,this.nodes.has(t)||(this.nodes.set(t,Lm(t)),this.nodeTimestamps.set(t,s),this.tension+=this.tensionConfig.newNode,i=!0),this.nodes.has(o)||(this.nodes.set(o,Lm(o)),this.nodeTimestamps.set(o,s),this.tension+=this.tensionConfig.newNode,i=!0);const a=this.edgeKey(t,o),l=this.edges.get(a);let c=!1;l?(l.value+=n,this.edgeTimestamps.set(a,s),this.tension+=this.tensionConfig.weightChange,c=!0):(this.edges.set(a,{source:t,target:o,value:n,y0:0,y1:0,sankeyWidth:0}),this.edgeTimestamps.set(a,s),this.tension+=this.tensionConfig.newEdge,i=!0);const u=r||i||c||this.tension>=this.tensionConfig.threshold;return this.updateResults.recordData("ingest",1),u}ingestEdgeWithResult(e){return this.ingestEdge(e),this.updateResults.last}runLayout(e){if(this.config.customNetworkLayout)return this.recordTopologyDiff(),void this.layoutVersion++;const t=Rm(this.config.chartType);if(!t)return;let o=Array.from(this.nodes.values());const n=Array.from(this.edges.values());if(0===o.length&&!t.hierarchical)return;if(this.prepareForRelayout(),t.supportsStreaming&&!t.hierarchical){const e=new Map;for(const t of o)void 0!==t._prevX0?e.set(t.id,{x:(t._prevX0??0)+((t._prevX1??0)-(t._prevX0??0))/2,y:(t._prevY0??0)+((t._prevY1??0)-(t._prevY0??0))/2}):0===t.x&&0===t.y||e.set(t.id,{x:t.x,y:t.y});if(this._lastPositionSnapshot)for(const[t,o]of this._lastPositionSnapshot)e.has(t)||e.set(t,o);this.config.__previousPositions=e.size>0?e:void 0}if(t.computeLayout(o,n,this.config,e),this.config.__previousPositions=void 0,t.hierarchical&&o.length>0){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this._networkDecayCache=null;for(const e of o)this.nodes.set(e.id,e);for(let e=0;n.length>e;e++){const t=n[e],o=t._edgeKey||`${"string"==typeof t.source?t.source:t.source.id}\0${"string"==typeof t.target?t.target:t.target.id}\0${e}`;t._edgeKey=o,this.edges.set(o,t)}const e=this._boundedPrevSnapshot;if(e&&e.size>0)for(const t of this.nodes.values()){const o=e.get(t.id);o&&(t._prevX0=o.x0,t._prevX1=o.x1,t._prevY0=o.y0,t._prevY1=o.y1)}this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,o=Array.from(this.nodes.values())}this.finalizeLayout();const r=new Map;for(const e of this.nodes.values())0===e.x&&0===e.y||r.set(e.id,{x:e.x,y:e.y});this._lastPositionSnapshot=r,this.saveTargetPositions();const i=o.some(e=>void 0!==e._prevX0&&(0!==e._prevX0||0!==e._prevX1||0!==e._prevY0||0!==e._prevY1)),s=this.config.transition?.duration??this.tensionConfig.transitionDuration,a=["sankey","tree","treemap","circlepack","partition"].includes(this.config.chartType);if(!this._hasRenderedOnce&&this.config.introAnimation&&a&&o.length>0&&s>0){const t=e[0]/2,o=e[1]/2;for(const e of this.nodes.values())e._prevX0=t,e._prevX1=t,e._prevY0=o,e._prevY1=o;for(const e of this.edges.values())e._prevY0=o,e._prevY1=o,e._prevSankeyWidth=0,e._introFromZero=!0;this.restorePreviousPositions(),this.transition={startTime:this.currentTime(),duration:s}}else i&&s>0&&(this.restorePreviousPositions(),this.transition={startTime:this.currentTime(),duration:s});this._hasRenderedOnce=!0,this.recordTopologyDiff(),this.layoutVersion++}recordTopologyDiff(){const e=new Set(this.nodes.keys()),t=new Set(this.edges.keys());this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set;for(const t of e)this.previousNodeIds.has(t)||this.addedNodes.add(t);for(const t of this.previousNodeIds)e.has(t)||this.removedNodes.add(t);for(const e of t)this.previousEdgeKeys.has(e)||this.addedEdges.add(e);for(const e of this.previousEdgeKeys)t.has(e)||this.removedEdges.add(e);(this.addedNodes.size>0||this.removedNodes.size>0||this.addedEdges.size>0||this.removedEdges.size>0)&&(this.lastTopologyChangeTime=this.currentTime()),this.previousNodeIds=e,this.previousEdgeKeys=t}restyleScene(e){const t=function({nodes:e,edges:t,restyle:o,restyleEdge:n,baseStyles:r,selection:i}){const s=!(!o&&!n);if(o)for(const t of e){const e=r.get(t)??t.style,n=o(t,i);t.style=n?{...e,...n}:e}if(n)for(const e of t){const t=r.get(e)??e.style,o=n(e,i);e.style=o?{...t,...o}:t}return s}({nodes:this.sceneNodes,edges:this.sceneEdges,restyle:this._customRestyle,restyleEdge:this._customRestyleEdge,baseStyles:this._baseStyles,selection:e});this.markStylePaintPending(),this.updateResults.recordRestyle(t)}buildScene(e){if(this.config.customNetworkLayout){const t=function({config:e,customLayout:t,size:o,nodes:n,edges:r,previousResult:i,revision:s}){const a=Hd(e.colorScheme,e.themeCategorical,Gt),l={nodes:n,edges:r,dimensions:{width:o[0],height:o[1],plot:{x:0,y:0,width:o[0],height:o[1]}},theme:{semantic:e.themeSemantic??{},categorical:[...a]},resolveColor:Wd(a,e.colorScheme),config:e.layoutConfig??{},selection:e.layoutSelection??null};try{return{kind:"success",result:t(l)}}catch(t){const o=null!==i,n=Sn("network",t,o,s);"production"!==process.env.NODE_ENV&&console.error("[semiotic] customNetworkLayout threw:",t);try{e.onLayoutError?.(n)}catch(e){"production"!==process.env.NODE_ENV&&console.error("[semiotic] onLayoutError threw:",e)}return{kind:"failure",diagnostic:n,preservedLastGoodScene:o}}}({config:this.config,customLayout:this.config.customNetworkLayout,size:e,nodes:Array.from(this.nodes.values()),edges:Array.from(this.edges.values()),previousResult:this.lastCustomLayoutResult,revision:this.layoutVersion});if("failure"===t.kind)return this.lastCustomLayoutFailure=t.diagnostic,void(t.preservedLastGoodScene||(this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.customLayoutOverlays=null,this.customLayoutHtmlMarks=[],this.lastCustomLayoutResult=null,this._customRestyle=void 0,this._customRestyleEdge=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this._sceneNodesRevision++));const o=t.result;return this.sceneNodes=o.sceneNodes??[],this.sceneEdges=o.sceneEdges??[],this.labels=o.labels??[],this.customLayoutOverlays=o.overlays??null,this.customLayoutHtmlMarks=o.htmlMarks??[],this.lastCustomLayoutResult=o,this.lastCustomLayoutFailure=null,this._sceneNodesRevision++,this._customRestyle=o.restyle,this._customRestyleEdge=o.restyleEdge,this.hasCustomRestyle=!(!o.restyle&&!o.restyleEdge),this.hasCustomRestyle&&(this._baseStyles=function(e,t){const o=new WeakMap;for(const t of e)o.set(t,t.style);for(const e of t)o.set(e,e.style);return o}(this.sceneNodes,this.sceneEdges),this.restyleScene(this.config.layoutSelection??null)),void xn({label:"customNetworkLayout",nodes:this.sceneNodes,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned})}this._customRestyle=void 0,this._customRestyleEdge=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.customLayoutOverlays=null,this.customLayoutHtmlMarks=[],this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null;const t=Rm(this.config.chartType);if(!t)return void this._sceneNodesRevision++;const o=t.hierarchical?Array.from(this.nodes.values()):this.nodesArray,n=t.hierarchical?Array.from(this.edges.values()):this.edgesArray,{sceneNodes:r,sceneEdges:i,labels:s}=t.buildScene(o,n,this.config,e);this.sceneNodes=r,this.sceneEdges=i,this.labels=s,this._sceneNodesRevision++}rebuildNodeQuadtree(){let t=0,o=0;for(const e of this.sceneNodes)"circle"===e.type&&(t++,e.r>o&&(o=e.r));if(this._maxNodeRadius=o,e.QUADTREE_THRESHOLD>=t)return void(this._nodeQuadtree=null);const n=Array(t);let r=0;for(const e of this.sceneNodes)"circle"===e.type&&(n[r++]=e);this._nodeQuadtree=(0,jm.quadtree)().x(e=>e.cx).y(e=>e.cy).addAll(n)}get nodeQuadtree(){return this._nodeQuadtreeRevision!==this._sceneNodesRevision&&(this.rebuildNodeQuadtree(),this._nodeQuadtreeRevision=this._sceneNodesRevision),this._nodeQuadtree}get maxNodeRadius(){return this._maxNodeRadius}_ensureArrays(){this._arrCacheVersion===this.layoutVersion&&this._nodesArrCache&&this._edgesArrCache||(this._nodesArrCache=Array.from(this.nodes.values()),this._edgesArrCache=Array.from(this.edges.values()),this._arrCacheVersion=this.layoutVersion)}get nodesArray(){return this._ensureArrays(),this._nodesArrCache}get edgesArray(){return this._ensureArrays(),this._edgesArrCache}get isAnimating(){const e=Rm(this.config.chartType);return!!e?.supportsAnimation&&!1!==this.config.orbitAnimated}tickAnimation(e,t){const o=Rm(this.config.chartType);if(!o?.tick)return!1;const n=o.hierarchical?Array.from(this.nodes.values()):this.nodesArray,r=o.hierarchical?Array.from(this.edges.values()):this.edgesArray;return o.tick(n,r,this.config,e,t)}cancelIntroAnimation(){this.transition=null;for(const e of this.nodes.values())e._prevX0=void 0,e._prevX1=void 0,e._prevY0=void 0,e._prevY1=void 0;for(const e of this.edges.values())e._prevY0=void 0,e._prevY1=void 0,e._prevSankeyWidth=void 0,e._introFromZero=!1}advanceTransition(e){if(!this.transition)return!1;const t=_o(e,this.transition),o=Mo(t);for(const e of this.nodes.values())void 0===e._targetX0||void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=Po(e._prevX0,e._targetX0,o),e.x1=Po(e._prevX1,e._targetX1,o),e.y0=Po(e._prevY0,e._targetY0,o),e.y1=Po(e._prevY1,e._targetY1,o));for(const e of this.edges.values())void 0!==e._targetY0&&void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&(e._prevSankeyWidth>0||e._introFromZero)&&(e.y0=Po(e._prevY0,e._targetY0,o),e.y1=Po(e._prevY1,e._targetY1,o),e.sankeyWidth=Po(e._prevSankeyWidth,e._targetSankeyWidth,o));return this.rebuildAllBeziers(),1>t||(this.snapToTargets(),this.transition=null,!1)}prepareForRelayout(){const e=this._boundedPrevSnapshot;for(const t of this.nodes.values()){const o=e?.get(t.id);o&&0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1?(t._prevX0=o.x0,t._prevX1=o.x1,t._prevY0=o.y0,t._prevY1=o.y1):(t._prevX0=t.x0,t._prevX1=t.x1,t._prevY0=t.y0,t._prevY1=t.y1)}const t=this._boundedEdgeSnapshot;for(const e of this.edges.values()){if(t&&0===e.sankeyWidth){const o=t.get(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`);if(o){e._prevY0=o.y0,e._prevY1=o.y1,e._prevSankeyWidth=o.sankeyWidth;continue}}e._prevY0=e.y0,e._prevY1=e.y1,e._prevSankeyWidth=e.sankeyWidth}this.nodes.size>0&&(this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null)}finalizeLayout(){const e="vertical"===this.config.orientation?"down":"right";for(const e of this.nodes.values())if(0!==e.x0||0!==e.x1||0!==e.y0||0!==e.y1)e.width=e.x1-e.x0,e.height=e.y1-e.y0,e.x=e.x0+e.width/2,e.y=e.y0+e.height/2;else{const t=5;e.x0=e.x-t,e.x1=e.x+t,e.y0=e.y-t,e.y1=e.y+t,e.width=2*t,e.height=2*t}for(const t of this.edges.values())t.direction=e,this.updateEdgeBezier(t);this.tension=0}saveTargetPositions(){for(const e of this.nodes.values())e._targetX0=e.x0,e._targetX1=e.x1,e._targetY0=e.y0,e._targetY1=e.y1;for(const e of this.edges.values())e._targetY0=e.y0,e._targetY1=e.y1,e._targetSankeyWidth=e.sankeyWidth}restorePreviousPositions(){for(const e of this.nodes.values())void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=e._prevX0,e.x1=e._prevX1,e.y0=e._prevY0,e.y1=e._prevY1);for(const e of this.edges.values())void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&e._prevSankeyWidth>0&&(e.y0=e._prevY0,e.y1=e._prevY1,e.sankeyWidth=e._prevSankeyWidth);this.rebuildAllBeziers()}snapToTargets(){for(const e of this.nodes.values())void 0!==e._targetX0&&(e.x0=e._targetX0,e.x1=e._targetX1,e.y0=e._targetY0,e.y1=e._targetY1);for(const e of this.edges.values())void 0!==e._targetY0&&(e.y0=e._targetY0,e.y1=e._targetY1,e.sankeyWidth=e._targetSankeyWidth),e._introFromZero=void 0;this.rebuildAllBeziers()}updateEdgeBezier(e){!function(e,t,o=.5){const n="string"==typeof e.source?t.get(e.source):e.source,r="string"==typeof e.target?t.get(e.target):e.target;!n||!r||(e.bezier=e.circular&&e.circularPathData?function(e){const t=(e._circularWidth||e.sankeyWidth||1)/2,o=e.circularPathData;if(!o)throw Error("buildCircularBezier requires circularPathData");if(e._circularStub){const e=Math.max(15,Math.min(40,.33*(o.rightFullExtent-o.sourceX))),n=Math.max(15,Math.min(40,.33*(o.targetX-o.leftFullExtent)));return{circular:!0,segments:[[{x:o.sourceX,y:o.sourceY},{x:o.sourceX+.33*e,y:o.sourceY},{x:o.sourceX+.66*e,y:o.sourceY},{x:o.sourceX+e,y:o.sourceY}],[{x:o.targetX-n,y:o.targetY},{x:o.targetX-.66*n,y:o.targetY},{x:o.targetX-.33*n,y:o.targetY},{x:o.targetX,y:o.targetY}]],halfWidth:t}}let n;n="down"===e.direction?[{x:o.sourceY,y:o.sourceX},{x:o.sourceY,y:o.rightFullExtent},{x:o.verticalFullExtent,y:o.rightFullExtent},{x:o.verticalFullExtent,y:o.leftFullExtent},{x:o.targetY,y:o.leftFullExtent},{x:o.targetY,y:o.targetX}]:[{x:o.sourceX,y:o.sourceY},{x:o.rightFullExtent,y:o.sourceY},{x:o.rightFullExtent,y:o.verticalFullExtent},{x:o.leftFullExtent,y:o.verticalFullExtent},{x:o.leftFullExtent,y:o.targetY},{x:o.targetX,y:o.targetY}];const r=[];for(let e=0;n.length-1>e;e++){const t=n[e],o=n[e+1],i=o.x-t.x,s=o.y-t.y;r.push([t,{x:t.x+i/3,y:t.y+s/3},{x:t.x+2*i/3,y:t.y+2*s/3},o])}return{circular:!0,segments:r,halfWidth:t}}(e):function(e,t,o,n=.5){const r=(e.sankeyWidth||1)/2;if("down"===e.direction){const i=t.x1,s=o.x0,a=(0,$m.interpolateNumber)(i,s);return{circular:!1,points:[{x:e.y0,y:i},{x:e.y0,y:a(n)},{x:e.y1,y:a(1-n)},{x:e.y1,y:s}],halfWidth:r}}const i=t.x1,s=o.x0,a=(0,$m.interpolateNumber)(i,s);return{circular:!1,points:[{x:i,y:e.y0},{x:a(n),y:e.y0},{x:a(1-n),y:e.y1},{x:s,y:e.y1}],halfWidth:r}}(e,n,r,o))}(e,this.nodes,.5)}rebuildAllBeziers(){for(const e of this.nodes.values())e.width=e.x1-e.x0,e.height=e.y1-e.y0,e.x=e.x0+e.width/2,e.y=e.y0+e.height/2;for(const e of this.edges.values())this.updateEdgeBezier(e)}applyPulse(e){!function(e){const t=e.pulse;if(!t)return;const o=t.duration??500,n=t.color??"rgba(255,255,255,0.6)",r=t.glowRadius??4,{now:i}=e;for(const t of e.sceneNodes){const s=t.id;if(!s)continue;const a=e.nodeTimestamps.get(s);if(!a)continue;const l=i-a;o>l&&(t._pulseIntensity=1-l/o,t._pulseColor=n,t._pulseGlowRadius=r)}for(const t of e.sceneEdges){const r=t.datum;if(!r)continue;const s="object"==typeof r.source?r.source?.id:r.source,a="object"==typeof r.target?r.target?.id:r.target;if(!s||!a)continue;const l=e.edgeTimestamps.get(`${s}\0${a}`);if(!l)continue;const c=i-l;o>c&&(t._pulseIntensity=1-c/o,t._pulseColor=n)}}({sceneNodes:this.sceneNodes,sceneEdges:this.sceneEdges,nodeTimestamps:this.nodeTimestamps,edgeTimestamps:this.edgeTimestamps,pulse:this.config.pulse,now:e})}applyDecay(){this._networkDecayCache||(this._networkDecayCache={sortedNodes:null,ageMap:null}),this._decaySortedNodes||(this._networkDecayCache.sortedNodes=null,this._networkDecayCache.ageMap=null),function(e){const t=e.decay;if(!t)return;const o=e.nodeTimestamps.size;if(1>=o)return;if(!e.cache.sortedNodes){e.cache.sortedNodes=Array.from(e.nodeTimestamps.entries()).sort((e,t)=>e[1]-t[1]);const t=new Map;for(let o=0;e.cache.sortedNodes.length>o;o++)t.set(e.cache.sortedNodes[o][0],o);e.cache.ageMap=t}const n=e.cache.ageMap;for(const r of e.sceneNodes){const e=r.id;if(!e)continue;const i=n.get(e);if(void 0===i)continue;const s=Oo(t,i,o);r.style={...r.style,opacity:(r.style?.opacity??1)*s}}}({sceneNodes:this.sceneNodes,nodeTimestamps:this.nodeTimestamps,decay:this.config.decay,cache:this._networkDecayCache}),this._decaySortedNodes=this._networkDecayCache.sortedNodes,this._decayAgeMap=this._networkDecayCache.ageMap}applyTopologyDiff(e){!function(e){for(const t of e.sceneNodes)t._pulseColor===Nm&&(t._pulseIntensity=0,t._pulseColor=void 0,t._pulseGlowRadius=void 0);if(0===e.addedNodes.size)return;const t=e.now-e.lastTopologyChangeTime;if(t>=Dm)return;const o=1-t/Dm;for(const t of e.sceneNodes){const n=t.id;n&&e.addedNodes.has(n)&&(t._pulseIntensity=Math.max(t._pulseIntensity??0,o),t._pulseColor=Nm,t._pulseGlowRadius=8)}}({sceneNodes:this.sceneNodes,addedNodes:this.addedNodes,lastTopologyChangeTime:this.lastTopologyChangeTime,now:e})}get hasActiveTopologyDiff(){return function(e,t,o=("undefined"!=typeof performance?performance.now():Date.now())){return 0!==e.size&&Dm>o-t}(this.addedNodes,this.lastTopologyChangeTime)}applyThresholds(e){!function(e){const t=e.thresholds;if(!t)return;const o=t.warningColor??"#f59e0b",n=t.criticalColor??"#ef4444",r=!1!==t.pulse;for(const i of e.sceneNodes){const s=i.id;if(!s)continue;const a=e.nodes.get(s);if(!a)continue;const l=t.metric(a);let c=null;void 0===t.critical||t.critical>l?void 0===t.warning||t.warning>l||(c=o):c=n,c&&(i.style={...i.style,fill:c},r&&(i._pulseIntensity=.6+.4*Math.sin(e.now/300),i._pulseColor=c,i._pulseGlowRadius=6))}}({sceneNodes:this.sceneNodes,nodes:this.nodes,thresholds:this.config.thresholds,now:e})}get hasActiveThresholds(){return function(e,t){if(!t)return!1;for(const o of e){const e=t.metric(o);if(void 0!==t.warning&&e>=t.warning||void 0!==t.critical&&e>=t.critical)return!0}return!1}(this.nodes.values(),this.config.thresholds)}get hasActivePulses(){return function(e){const t=e.pulse;if(!t||0===e.lastIngestTime)return!1;const o=e.now??("undefined"!=typeof performance?performance.now():Date.now());return(t.duration??500)>o-e.lastIngestTime}({pulse:this.config.pulse,lastIngestTime:this.lastIngestTime})}getLayoutData(){return{nodes:Array.from(this.nodes.values()),edges:Array.from(this.edges.values())}}updateNode(e,t){const o=this.nodes.get(e);if(!o)return this.updateResults.recordNoop("update"),null;const n=o.data?{...o.data}:{};return o.data=t(o.data??{}),this.layoutVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("update",1),n}updateEdge(e,t,o){const n=this.config.valueAccessor,r="function"==typeof n?n:n?e=>e[n]:e=>e.value,i=[];for(const[,n]of this.edges)if(("string"==typeof n.source?n.source:n.source.id)===e&&("string"==typeof n.target?n.target:n.target.id)===t){i.push(n.data?{...n.data}:{}),n.data=o(n.data??{});const e=r(n.data);null!=e&&(n.value=Number(e))}return i.length>0?(this.layoutVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("update",i.length)):this.updateResults.recordNoop("update"),i}removeNode(e){if(!this.nodes.has(e))return this.updateResults.recordNoop("remove"),!1;this.nodes.delete(e),this.nodeTimestamps.delete(e);for(const[t,o]of this.edges)("string"==typeof o.source?o.source:o.source.id)!==e&&("string"==typeof o.target?o.target:o.target.id)!==e||(this.edges.delete(t),this.edgeTimestamps.delete(t));return this.layoutVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("remove",1),!0}removeEdge(e,t){const o=[];if(void 0===t){const t=this.config.edgeIdAccessor;if(!t)throw Error("removeEdge(edgeId) requires edgeIdAccessor to be configured. Use removeEdge(sourceId, targetId) instead.");const n="function"==typeof t?t:e=>e?.[t];for(const[t,r]of this.edges)r.data&&n(r.data)===e&&o.push(t)}else for(const[n,r]of this.edges)("string"==typeof r.source?r.source:r.source.id)===e&&("string"==typeof r.target?r.target:r.target.id)===t&&o.push(n);for(const e of o)this.edges.delete(e),this.edgeTimestamps.delete(e);return o.length>0?(this.layoutVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("remove",o.length)):this.updateResults.recordNoop("remove"),o.length>0}clear(){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this._networkDecayCache=null,this._decayAgeMap=null,this._nodeQuadtree=null,this._nodesArrCache=null,this._edgesArrCache=null,this._sceneNodesRevision++,this.tension=0,this.layoutVersion++,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.customLayoutOverlays=null,this.customLayoutHtmlMarks=[],this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this._customRestyleEdge=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.transition=null,this._hasRenderedOnce=!1,this.lastIngestTime=0,this._lastPositionSnapshot=null,this.nodeTimestamps.clear(),this.edgeTimestamps.clear(),this.previousNodeIds=new Set,this.previousEdgeKeys=new Set,this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set,this.lastTopologyChangeTime=0,this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,this.particlePool&&this.particlePool.clear(),this.updateResults.recordData("clear")}};Um.QUADTREE_THRESHOLD=500;var Km=Um;Fn(Km);var Qm=d(require("react")),Zm=require("react/jsx-runtime");function Jm(e){const{width:t,height:o,totalWidth:n,totalHeight:r,margin:i,labels:s,title:a,legend:l,legendHoverBehavior:c,legendClickBehavior:u,legendHighlightedCategory:d,legendIsolatedCategories:h,legendPosition:f="right",legendLayout:m,foregroundGraphics:p,sceneNodes:g,annotations:y,onAnnotationActivate:b,onObservation:v,chartId:x,chartType:k,autoPlaceAnnotations:w,svgAnnotationRules:S}=e,A=Ks({onAnnotationActivate:b,onObservation:v,chartId:x,chartType:k}),C=Qm.useMemo(()=>{const e=(g||[]).flatMap(e=>{const t=function(e){if("glyph"===e.type&&e.glyph&&"number"==typeof e.size){const t=e.cx??e.x,o=e.cy??e.y;if("number"!=typeof t||"number"!=typeof o)return null;const n=zr(e.glyph,e.size);return{x:t+n.centerDx,y:o+n.centerDy,r:Math.max(1,n.radius)}}const t=e.cx??(null!=e.x&&null!=e.w?e.x+e.w/2:e.x),o=e.cy??(null!=e.y&&null!=e.h?e.y+e.h/2:e.y);return"number"!=typeof t||"number"!=typeof o?null:{x:t,y:o,r:"number"==typeof e.r?Math.max(1,e.r):"number"==typeof e.outerR?Math.max(1,e.outerR):"number"==typeof e.size?Math.max(1,pn(e.size)):Math.max(1,e.w??0,e.h??0)/2}}(e),o=function(e){const t=e.id??e.datum?.id??e.datum?.data?.id??e.datum?.data?.name;return null==t?void 0:t+""}(e);return t?[{pointId:o,...t}]:[]});return{scales:null,width:t,height:o,frameType:"network",pointNodes:e,sceneNodes:g}},[o,g,t]),M=Qm.useMemo(()=>{if(!y)return y;const e=Pa(y);return w?_a({annotations:e,context:C,..."object"==typeof w?w:{}}):e},[y,w,C]),_=Qm.useMemo(()=>la(),[]),P=M?aa(M.filter(e=>"widget"!==e.type),_,S,C):null,R=!0===M?.some(e=>"widget"===e.type&&!0===e._annotationDeferred);return(0,Zm.jsxs)(Zm.Fragment,{children:[R&&(0,Zm.jsx)("style",{children:Hs},"annotation-widget-disclosure-style"),(0,Zm.jsxs)("svg",{role:"img",width:n,height:r,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[(0,Zm.jsx)("title",{children:"string"==typeof a?a:"Network Chart"}),(0,Zm.jsx)("desc",{children:"string"==typeof a?a+" (network data visualization)":"Network data visualization"}),(0,Zm.jsxs)("g",{transform:`translate(${i.left},${i.top})`,children:[s.map((e,t)=>(0,Zm.jsx)("text",{x:e.x,y:e.y,textAnchor:e.anchor||"start",dominantBaseline:e.baseline||"middle",fontSize:e.fontSize||11,fontWeight:e.fontWeight,fill:e.fill||"var(--semiotic-text, #333)",stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:e.paintOrder,style:{pointerEvents:"none"},children:e.text},"label-"+t)),P,p]}),a&&"string"==typeof a?(0,Zm.jsx)("text",{x:n/2,y:22,textAnchor:"middle",fontWeight:600,fill:"currentColor",fontSize:14,className:"semiotic-chart-title",style:{fontSize:"var(--semiotic-title-font-size, 14px)"},children:a}):a?(0,Zm.jsx)("foreignObject",{x:0,y:0,width:n,height:i.top,children:a}):null,ys({legend:l,totalWidth:n,totalHeight:r,margin:i,legendPosition:f,title:a,legendLayout:m,legendHoverBehavior:c,legendClickBehavior:u,legendHighlightedCategory:d,legendIsolatedCategories:h})]}),M?.filter(e=>"widget"===e.type&&e.nodeId&&g).map((e,t)=>{const o=!0===e._annotationDeferred,n=g.find(t=>t.id===e.nodeId||t.datum?.id===e.nodeId||t.datum?.data?.id===e.nodeId||t.datum?.data?.name===e.nodeId);if(!n)return null;const r=i.left+(n.cx??(null!=n.x&&null!=n.w?n.x+n.w/2:n.x??0)),s=i.top+(n.cy??(null!=n.y&&null!=n.h?n.y+n.h/2:n.y??0)),a=e.dx??0,l=e.dy??-16,c=e.width??32,u=e.height??32,d=e.content??(0,Zm.jsx)("span",{style:{fontSize:18,cursor:"default"},children:"ℹ️"});return(0,Zm.jsx)("div",{...Zs(e,A),className:o?"annotation-deferred":void 0,"data-annotation-disclosure":o?"deferred":void 0,style:{position:"absolute",left:r+a-c/2,top:s+l-u/2,width:c,height:u,display:"flex",alignItems:"center",justifyContent:"center",zIndex:5},children:d},"widget-"+t)})]})}Jm.displayName="NetworkSVGOverlay";var ep=d(require("react")),tp=require("react/jsx-runtime"),op={position:"absolute",top:0,left:0,pointerEvents:"none"};function np({marks:e,margin:t,selection:o=null,overscan:n=400}){const r=ep.useRef(null),i=function(e,t,o){const[n,r]=ep.useState(null);return ep.useLayoutEffect(()=>{const e=t.current,o=function(e){let t=e?.parentElement??null;for(;t;){const{overflow:e,overflowX:o,overflowY:n}=window.getComputedStyle(t);if(/(auto|scroll|overlay)/.test(`${e} ${n} ${o}`))return t;t=t.parentElement}return null}(e);if(!e||!o)return void r(null);let n=0;const i=()=>{n=0;const t=o.getBoundingClientRect(),i=e.getBoundingClientRect();r(0!==t.width&&0!==t.height?{scroll:{left:t.left,top:t.top,right:t.right,bottom:t.bottom},originX:i.left,originY:i.top}:null)},s=()=>{0===n&&(n=window.requestAnimationFrame(i))};i(),o.addEventListener("scroll",s,{passive:!0});const a=new ResizeObserver(s);return a.observe(o),()=>{0!==n&&window.cancelAnimationFrame(n),o.removeEventListener("scroll",s),a.disconnect()}},[t,e,o]),ep.useMemo(()=>{if(!e||!n)return e;const{scroll:t,originX:r,originY:i}=n,s=t.left-o,a=t.right+o,l=t.top-o,c=t.bottom+o;return e.filter(e=>{const t=r+e.x,o=i+e.y;return!(s>t+e.width||t>a||l>o+e.height||o>c)})},[e,n,o])}(e,r,n);if(!e||0===e.length)return null;const s=(0,tp.jsx)("div",{className:"semiotic-network-html-marks",ref:r,style:{...op,transform:`translate(${t.left}px, ${t.top}px)`},children:(i??e).map(e=>(0,tp.jsx)("div",{className:"semiotic-network-html-mark","data-mark-id":e.id,style:{position:"absolute",transform:`translate(${e.x}px, ${e.y}px)`,width:e.width,height:e.height,pointerEvents:"none"},children:e.content},e.id))});return null!=o?(0,tp.jsx)(Sr,{value:o,children:s}):s}var rp=require("react/jsx-runtime");function ip({props:e,store:t,responsiveRef:o,size:n,margin:r,adjustedWidth:i,adjustedHeight:s,resolvedBackground:a,resolvedForeground:l}){const{chartType:c,nodes:u,edges:d,data:h,className:f,description:m,title:p,responsiveWidth:g,responsiveHeight:y,summary:b,background:v,renderMode:x,legend:k,legendPosition:w,legendLayout:S,legendHoverBehavior:A,legendClickBehavior:C,legendHighlightedCategory:M,legendIsolatedCategories:_,layoutSelection:P,annotations:R,onAnnotationActivate:j,annotationObservationCallback:L,onObservation:T,chartId:I,autoPlaceAnnotations:$,svgAnnotationRules:N}=e;if(t){const e=["tree","cluster","treemap","circlepack","partition","orbit"].includes(c),o=e?h||(Array.isArray(d)?void 0:d):void 0;if(e&&o)t.ingestHierarchy(o,[i,s]),t.buildScene([i,s]);else{const e=yt(u),o=Array.isArray(d)?yt(d):[];(e.length>0||o.length>0)&&(t.ingestBounded(e,o,[i,s]),t.buildScene([i,s]))}}const D=t?.sceneNodes??[],E=t?.sceneEdges??[],O=t?.labels??[];return(0,rp.jsxs)("div",{ref:o,className:"stream-network-frame"+(f?" "+f:""),role:"img","aria-label":m||("string"==typeof p?p:"Network chart"),style:{position:"relative",width:g?"100%":n[0],height:y?"100%":n[1]},children:[(0,rp.jsx)(gc,{summary:b}),(0,rp.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:n[0],height:n[1],style:{position:"absolute",left:0,top:0},children:[a&&(0,rp.jsx)("g",{transform:`translate(${r.left},${r.top})`,children:a}),(0,rp.jsxs)("g",{transform:`translate(${r.left},${r.top})`,children:[v&&(0,rp.jsx)("rect",{x:0,y:0,width:i,height:s,fill:v}),E.map((e,t)=>Zu({node:e,index:t,renderMode:x,fallback:()=>function(e,t){switch(e.type){case"line":return(0,hl.jsx)("line",{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stroke:e.style.stroke||"#999",strokeWidth:e.style.strokeWidth||1,opacity:e.style.opacity},"net-edge-"+t);case"bezier":{const o=e,n=`net-bezier-${t}-hatch`,r=ti(o.style.fill)?ii(o.style.fill,n):void 0;return(0,hl.jsxs)(ul.Fragment,{children:[r&&(0,hl.jsx)("defs",{children:r}),(0,hl.jsx)("path",{d:o.pathD,fill:r?`url(#${n})`:il(o.style.fill,"#999"),fillOpacity:o.style.fillOpacity,stroke:o.style.stroke||"none",strokeWidth:o.style.strokeWidth,opacity:o.style.opacity})]},"net-edge-"+t)}case"ribbon":{const o=e,n=`net-ribbon-${t}-hatch`,r=ti(o.style.fill)?ii(o.style.fill,n):void 0;return(0,hl.jsxs)(ul.Fragment,{children:[r&&(0,hl.jsx)("defs",{children:r}),(0,hl.jsx)("path",{d:o.pathD,fill:r?`url(#${n})`:il(o.style.fill,"#999"),fillOpacity:o.style.fillOpacity,stroke:o.style.stroke||"none",strokeWidth:o.style.strokeWidth,opacity:o.style.opacity})]},"net-edge-"+t)}case"curved":{const o=e;return(0,hl.jsx)("path",{d:o.pathD,fill:il(o.style.fill,"none"),stroke:o.style.stroke||"#999",strokeWidth:o.style.strokeWidth||1,opacity:o.style.opacity},"net-edge-"+t)}default:return null}}(e,t)})).filter(Boolean),D.map((e,t)=>Zu({node:e,index:t,renderMode:x,fallback:()=>function(e,t){switch(e.type){case"circle":{const o=e,n=ti(o.style.fill)?ii(o.style.fill,`net-circle-${t}-hatch`):void 0;return(0,hl.jsxs)(ul.Fragment,{children:[n&&(0,hl.jsx)("defs",{children:n}),(0,hl.jsx)("circle",{cx:o.cx,cy:o.cy,r:o.r,fill:n?`url(#net-circle-${t}-hatch)`:il(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,fillOpacity:o.style.fillOpacity,strokeOpacity:o.style.strokeOpacity,opacity:o.style.opacity})]},"net-circle-"+t)}case"rect":{const o=e,n=ti(o.style.fill)?ii(o.style.fill,`net-rect-${t}-hatch`):void 0;return(0,hl.jsxs)(ul.Fragment,{children:[n&&(0,hl.jsx)("defs",{children:n}),(0,hl.jsx)("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:n?`url(#net-rect-${t}-hatch)`:il(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,fillOpacity:o.style.fillOpacity,strokeOpacity:o.style.strokeOpacity,opacity:o.style.opacity})]},"net-rect-"+t)}case"arc":{const o=e,n=(0,dl.arc)().innerRadius(o.innerR).outerRadius(o.outerR).startAngle(o.startAngle+Math.PI/2).endAngle(o.endAngle+Math.PI/2)(rl)||"",r=ti(o.style.fill)?ii(o.style.fill,`net-arc-${t}-hatch`):void 0;return(0,hl.jsxs)(ul.Fragment,{children:[r&&(0,hl.jsx)("defs",{children:r}),(0,hl.jsx)("path",{d:n,transform:`translate(${o.cx},${o.cy})`,fill:r?`url(#net-arc-${t}-hatch)`:il(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,fillOpacity:o.style.fillOpacity,strokeOpacity:o.style.strokeOpacity,opacity:o.style.opacity})]},"net-arc-"+t)}case"symbol":{const o=e,n=mn(o.symbolType,o.size,o.path);return(0,hl.jsx)("path",{d:n,transform:o.rotation?`translate(${o.cx},${o.cy}) rotate(${180*o.rotation/Math.PI})`:`translate(${o.cx},${o.cy})`,fill:o.style.fill?il(o.style.fill):"none",stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,fillOpacity:o.style.fillOpacity,strokeOpacity:o.style.strokeOpacity,opacity:o.style.opacity},"net-symbol-"+t)}case"glyph":return al(e,e.cx,e.cy,"net-glyph-"+(e.id??t));default:return null}}(e,t)})).filter(Boolean),O.map((e,t)=>function(e,t){return(0,hl.jsx)("text",{x:e.x,y:e.y,textAnchor:e.anchor||"middle",dominantBaseline:e.baseline||"auto",fontSize:e.fontSize||11,fontWeight:e.fontWeight,fill:e.fill||"var(--semiotic-text, #333)",stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:e.paintOrder,children:e.text},"net-label-"+t)}(e,t)).filter(Boolean)]})]}),(0,rp.jsx)(Jm,{width:i,height:s,totalWidth:n[0],totalHeight:n[1],margin:r,labels:O,sceneNodes:D,title:p,legend:k,legendPosition:w,legendLayout:S,legendHoverBehavior:A,legendClickBehavior:C,legendHighlightedCategory:M,legendIsolatedCategories:_,foregroundGraphics:br(l,Cr(t?.customLayoutOverlays,P??null)),annotations:R,onAnnotationActivate:j,onObservation:L??T,chartId:I,chartType:"StreamNetworkFrame",autoPlaceAnnotations:$,svgAnnotationRules:N,annotationFrame:0}),(0,rp.jsx)(np,{marks:t?.customLayoutHtmlMarks,margin:r,selection:P??null})]})}var sp=d(require("react")),ap=require("react/jsx-runtime");function lp({componentName:e,message:t,diagnosticHint:o,width:n,height:r}){return(0,ap.jsx)("div",{role:"alert",style:{width:n,height:Math.max(r,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:(0,ap.jsxs)("div",{style:{textAlign:"center",maxWidth:400},children:[(0,ap.jsx)("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:e}),(0,ap.jsx)("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:t}),o&&(0,ap.jsx)("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:o})]})})}var cp=require("react/jsx-runtime"),up=class extends sp.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,cp.jsx)(lp,{componentName:"ChartErrorBoundary",message:t.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}},dp=require("react/jsx-runtime"),hp="undefined"!=typeof process&&"production"!==process.env?.NODE_ENV;function fp({componentName:e,width:t,height:o,children:n}){return(0,dp.jsx)(up,{fallback:n=>(0,dp.jsx)(lp,{componentName:e,message:n.message,width:t,height:o}),children:n})}var mp={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"},pp={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function gp(e,t,o,n){return!1===n||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?(0,dp.jsx)("div",{style:{...mp,width:t,height:o},children:n||"No data available"}):null}function yp(e,t,o,n){if(!e)return null;if(!1===n)return null;if(null!=n)return(0,dp.jsx)("div",{style:{width:t,height:o,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:n});const r=Math.min(5,Math.floor(o/40)),i=Math.max(8,Math.floor(o/(3*r))),s=Math.max(6,Math.floor(o/(2.5*r))),a=Math.floor((o-(r*(i+s)-s))/2);return(0,dp.jsx)("div",{style:{width:t,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:r},(e,o)=>(0,dp.jsx)("div",{className:"semiotic-loading-bar",style:{...pp,position:"absolute",top:a+o*(i+s),left:Math.floor(.1*t),width:30+(37*o+13)%50+"%",height:i,opacity:.5+o%2*.2}},o))})}function bp(e,t,o,n){if(!hp)return;if(!t||0===t.length)return;if("string"!=typeof n)return;const r=t[0];if(!r||"object"!=typeof r)return;if(n in r)return;const i=Object.keys(r).join(", ");console.warn(`[semiotic] ${e}: ${o} "${n}" not found in data. Available keys: ${i}`)}function vp(e){if("undefined"!=typeof __filename){const t=__filename.replace(/\\/g,"/"),o=t.startsWith("/")?t:"/"+t;return new URL("./"+e,"file:"+o)}throw Error("Cannot resolve module worker asset: "+e)}function xp(e){if("undefined"!=typeof DOMException)return new DOMException(e+" aborted","AbortError");const t=Error(e+" aborted");return t.name="AbortError",t}function kp(e){const t=Error(e.message);return t.name=e.name??"Error",e.stack&&(t.stack=e.stack),t}function wp(e){return e&&"object"==typeof e?{requestId:e.requestId,error:e.error}:{}}var Sp=class{constructor(e){this.nextRequestId=1,this.pending=new Map,this.dead=!1,this.options=e,this.worker=e.createWorker(),this.worker.onmessage=e=>{const t=this.options.parseMessage(e.data),o=t.requestId,n=null!=o?this.pending.get(o):this.pending.values().next().value;if(n){if(null!=o)this.pending.delete(o);else{for(const e of this.pending.values())e!==n&&(e.cleanup(),e.reject(Error(this.options.name+" worker response missing requestId")));this.pending.clear()}n.cleanup(),t.ok?n.resolve(t.payload):n.reject(t.error)}},this.worker.onerror=e=>{this.rejectAll(Error(e.message||this.options.name+" worker failed")),this.terminate()}}get isDead(){return this.dead}request(e,t){if(this.dead)return Promise.reject(Error(this.options.name+" worker session is closed"));if(t?.aborted)return Promise.reject(xp(this.options.name));const o=this.nextRequestId;this.nextRequestId+=1;const n=this.options.encodeRequest?.(o,e)??{requestId:o,request:e};return new Promise((e,r)=>{const i=()=>{this.pending.delete(o),t?.removeEventListener("abort",i),r(xp(this.options.name))},s=()=>t?.removeEventListener("abort",i);this.pending.set(o,{cleanup:s,reject:r,resolve:e}),t?.addEventListener("abort",i,{once:!0});try{this.worker.postMessage(n)}catch(e){this.pending.delete(o),s(),r(e instanceof Error?e:Error(e+""))}})}terminate(){this.dead||(this.dead=!0,this.rejectAll(Error(this.options.name+" worker terminated")),this.worker.terminate())}rejectAll(e){for(const t of this.pending.values())t.cleanup(),t.reject(e);this.pending.clear()}};function Ap(e){let t=null;return{get:()=>(t&&!t.isDead||(t=e()),t),resetForTest:()=>{if(t){try{t.terminate()}catch{}t=null}}}}var Cp={},Mp=4e4;function _p(e,t,o,n,r=Mp){return"sync"!==e&&("worker"===e||n*(t+o)>=r)}function Pp(){return"undefined"!=typeof window&&"undefined"!=typeof Worker}var Rp=class{constructor(e=function(){const e="string"==typeof Cp.url&&Cp.url?new URL("./forceLayoutWorker.js",Cp.url):vp("forceLayoutWorker.js");return new Worker(e,{type:"module",name:"semiotic-force-layout"})}()){this.session=new Sp({name:"Force layout",createWorker:()=>e,parseMessage:e=>{const t=e,{requestId:o,error:n}=wp(t);return n?{requestId:o,ok:!1,error:kp(n)}:{requestId:o,ok:!0,payload:{positions:t.positions??{}}}}})}get isDead(){return this.session.isDead}request(e,t){return this.session.request(e,t)}terminate(){this.session.terminate()}},jp=Ap(()=>new Rp);function Lp(e,t){return Pp()?jp.get().request(e,t):Promise.reject(Error("Web Workers are unavailable"))}var Tp=require("react/jsx-runtime"),Ip=/^(value|amount|total|count|weight|score)$/i;function $p({data:e}){if("edge"===e.nodeOrEdge){const t=e.data;return t?(0,Tp.jsxs)("div",{className:"semiotic-tooltip",style:Tc,children:[(0,Tp.jsxs)("div",{style:{fontWeight:600},children:["object"==typeof t.source?t.source.id:t.source," → ","object"==typeof t.target?t.target.id:t.target]}),null!=t.value&&(0,Tp.jsxs)("div",{style:{marginTop:4,opacity:.8},children:["Value:"," ","number"==typeof t.value?t.value.toLocaleString():t.value+""]})]}):null}const t=e.data;if(!t)return null;const o=t.__hierarchyNode;if(o){const e=[];let n=o;for(;n;){const o=n.data?.name??n.data?.id??t.id;null!=o&&e.unshift(o+""),n=n.parent}e.length>1&&e.shift();const r=e.length-1;return(0,Tp.jsxs)("div",{className:"semiotic-tooltip",style:Tc,children:[(0,Tp.jsx)("div",{children:e.map((e,t)=>(0,Tp.jsxs)("span",{children:[t>0&&(0,Tp.jsx)("span",{style:{margin:"0 3px",opacity:.5},children:" → "}),t===r?(0,Tp.jsx)("strong",{children:e}):(0,Tp.jsx)("span",{style:{opacity:.7},children:e})]},t))}),null!=t.value&&t.value>0&&(0,Tp.jsx)("div",{style:{marginTop:4,opacity:.8},children:"number"==typeof t.value?t.value.toLocaleString():t.value+""})]})}const n=(t.sourceLinks?.length||0)+(t.targetLinks?.length||0),r=(t.sourceLinks||[]).reduce((e,t)=>e+(t.value||0),0)+(t.targetLinks||[]).reduce((e,t)=>e+(t.value||0),0),i=jc(t.data??t),s=null!=i.title?i.title+"":t.id,a=i.entries.some(e=>Ip.test(e.key));return(0,Tp.jsxs)("div",{className:"semiotic-tooltip",style:Tc,children:[(0,Tp.jsx)("div",{style:{fontWeight:600},children:s}),i.entries.map(e=>(0,Tp.jsxs)("div",{style:{marginTop:4,opacity:.8},children:[e.key,": ",td(e.value)]},e.key)),!a&&null!=t.value&&t.value>0&&(0,Tp.jsxs)("div",{style:{marginTop:4,opacity:.8},children:["Total:"," ","number"==typeof t.value?t.value.toLocaleString():t.value+""]}),n>0&&(0,Tp.jsxs)("div",{style:{marginTop:4,opacity:.8},children:["Connections: ",n,r!==n&&` (weighted: ${r.toLocaleString()})`]})]})}function Np(e){return e._cachedPath2D&&e._cachedPath2DSource===e.pathD||(e._cachedPath2D=new Path2D(e.pathD),e._cachedPath2DSource=e.pathD),e._cachedPath2D}function Dp(e,t){if(!t.pathD)return;e.save();const o=Np(t);if(t.style.fill&&"none"!==t.style.fill){const n=t._gradient;if(n){const o=e.createLinearGradient(n.x0,n.y0??0,n.x1,n.y1??0),r=t.style.fillOpacity??t.style.opacity??.5,i="string"==typeof t.style.fill?t.style.fill:"#999",s=Ur(e,i)||i;o.addColorStop(0,1===n.from?s:"transparent"),o.addColorStop(1,1===n.to?s:"transparent"),e.fillStyle=o,e.globalAlpha=r}else e.fillStyle=ci(e,t.style.fill,"#007bff"),e.globalAlpha=t.style.fillOpacity??t.style.opacity??.5;e.fill(o)}t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ur(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??.5,e.globalAlpha=.5*(t.style.opacity??1),e.stroke(o)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.2*t._pulseIntensity,e.fill(o)),e.restore()}function Ep(e,t){e.save();const o=t.style.stroke||"#999";e.strokeStyle=Ur(e,o)||o,e.lineWidth=t.style.strokeWidth??1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.strokeDasharray&&e.setLineDash(t.style.strokeDasharray.split(/[\s,]+/).map(Number)),e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.stroke(),t._pulseIntensity&&t._pulseIntensity>0&&(e.setLineDash([]),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=(t.style.strokeWidth??1)+3*t._pulseIntensity,e.globalAlpha=.4*t._pulseIntensity,e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.stroke()),e.restore()}function Op(e,t){if(!t.pathD)return;e.save();const o=Np(t);t.style.fill&&"none"!==t.style.fill&&(e.fillStyle=ci(e,t.style.fill,"#007bff"),e.globalAlpha=t.style.fillOpacity??t.style.opacity??.5,e.fill(o)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ur(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??.5,e.globalAlpha=.3*(t.style.opacity??1),e.stroke(o)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.25*t._pulseIntensity,e.fill(o)),e.restore()}function Bp(e,t){if(!t.pathD)return;e.save();const o=Np(t),n=t.style.stroke||"#999";e.strokeStyle=Ur(e,n)||n,e.lineWidth=t.style.strokeWidth??1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.stroke(o),t.style.fill&&"none"!==t.style.fill&&(e.fillStyle=ci(e,t.style.fill,"#007bff"),e.globalAlpha=t.style.fillOpacity??.1,e.fill(o)),e.restore()}function Fp(e,t,o,n=30){switch(e.type){case"circle":return function(e,t,o,n=30){const r=t-e.cx,i=o-e.cy,s=Math.sqrt(r*r+i*i);return s>jr(e.r,n)?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:s}}(e,t,o,n);case"rect":return function(e,t,o){const n=Rr(t,o,e);return n.hit?{type:"node",datum:e.datum,x:n.cx,y:n.cy,distance:0}:null}(e,t,o);case"arc":return function(e,t,o){const n=t-e.cx,r=o-e.cy,i=Math.sqrt(n*n+r*r);if(e.innerR-2>i||i>e.outerR+2)return null;const s=Ir(Math.atan2(r,n)),a=Ir(e.startAngle),l=Ir(e.endAngle);if(a>l?s>=a||l>=s:s>=a&&l>=s){const t=(e.startAngle+e.endAngle)/2,o=(e.innerR+e.outerR)/2;return{type:"node",datum:e.datum,x:e.cx+o*Math.cos(t),y:e.cy+o*Math.sin(t),distance:0}}return null}(e,t,o);case"symbol":return function(e,t,o,n=30){const r=t-e.cx,i=o-e.cy,s=Math.sqrt(r*r+i*i);return s>jr(pn(e.size),n)?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:s}}(e,t,o,n);case"glyph":return function(e,t,o,n=30){if(null==e.datum)return null;const r=zr(e.glyph,e.size),i=e.cx+r.centerDx,s=e.cy+r.centerDy,a=t-i,l=o-s,c=Math.sqrt(a*a+l*l);return c>jr(r.radius,n)?null:{type:"node",datum:e.datum,x:i,y:s,distance:c}}(e,t,o,n);default:return null}}$p.ownsChrome=!0;var zp=null,Hp=null;function Wp(){return Hp||((zp=document.createElement("canvas")).width=1,zp.height=1,Hp=zp.getContext("2d")),Hp}function qp(e){if(e._cachedPath2D&&e._cachedPath2DSource===e.pathD)return e._cachedPath2D;try{return e._cachedPath2D=new Path2D(e.pathD),e._cachedPath2DSource=e.pathD,e._cachedPath2D}catch{return null}}function Yp(e,t,o){switch(e.type){case"bezier":return function(e,t,o){if(!e.pathD)return null;const n=qp(e),r=Wp();if(!n||!r)return null;try{if(r.isPointInPath(n,t,o))return{type:"edge",datum:e.datum,x:t,y:o,distance:0};const i=r.lineWidth;r.lineWidth=10;const s=r.isPointInStroke(n,t,o);if(r.lineWidth=i,s)return{type:"edge",datum:e.datum,x:t,y:o,distance:4}}catch{}return null}(e,t,o);case"line":return function(e,t,o){const n=e.x2-e.x1,r=e.y2-e.y1,i=n*n+r*r;if(0===i)return null;let s=((t-e.x1)*n+(o-e.y1)*r)/i;s=Math.max(0,Math.min(1,s));const a=e.x1+s*n,l=e.y1+s*r,c=Math.sqrt((t-a)**2+(o-l)**2);return c>5?null:{type:"edge",datum:e.datum,x:a,y:l,distance:c}}(e,t,o);case"ribbon":case"curved":return function(e,t,o){if(!e.pathD)return null;const n=qp(e),r=Wp();if(!n||!r)return null;try{if(r.isPointInPath(n,t,o))return{type:"edge",datum:e.datum,x:t,y:o,distance:0};const i=r.lineWidth;r.lineWidth=10;const s=r.isPointInStroke(n,t,o);if(r.lineWidth=i,s)return{type:"edge",datum:e.datum,x:t,y:o,distance:4}}catch{}return null}(e,t,o);default:return null}}function Gp(e){const{clientX:t,clientY:o,canvasRect:n,margin:r,adjustedWidth:i,adjustedHeight:s,sceneNodes:a,sceneEdges:l,nodeQuadtree:c,maxNodeRadius:u,hitRadius:d=30}=e,h=t-n.left-r.left,f=o-n.top-r.top;if(0>h||h>i||0>f||f>s)return{kind:"miss-outside"};const m=function(e,t,o,n,r=30,i,s=0){let a=null,l=r,c=1/0;if(i){const e=Wr(i,o,n,r,s,e=>e.cx,e=>e.cy,e=>e.r);e&&(a={type:"node",datum:e.node.datum,x:e.node.cx,y:e.node.cy,distance:e.distance},l=e.distance)}for(const t of e){if(i&&"circle"===t.type)continue;const e=Fp(t,o,n,r);if(e)if("rect"===t.type){const o=t.w*t.h;c>o&&(a=e,c=o)}else l>e.distance&&(a=e,l=e.distance)}if(a)return a;for(const e of t){if(!1===e.interactive)continue;const t=Yp(e,o,n);t&&l>t.distance&&(a=t,l=t.distance)}return a}(a,l,h,f,d,c,u);return m?{kind:"hit",hover:Ac(m.datum||{},m.x,m.y,{nodeOrEdge:m.type})}:{kind:"miss"}}var Vp=require("react"),Xp="StreamNetworkFrame",Up=require("react/jsx-runtime"),Kp={top:20,right:80,bottom:20,left:80},Qp={top:40,right:40,bottom:40,left:40},Zp=new Set(["chord","force","circlepack","orbit"]),Jp=[800,600],eg=(0,ef.memo)((0,ef.forwardRef)(function(e,t){const{chartType:o,nodes:n,edges:r,data:i,initialEdges:s,nodeIDAccessor:a="id",sourceAccessor:l="source",targetAccessor:c="target",valueAccessor:u="value",edgeIdAccessor:d,childrenAccessor:h,hierarchySum:f,orientation:m="horizontal",nodeAlign:p="justify",nodePaddingRatio:g=.05,nodeWidth:y=15,iterations:b=300,forceStrength:v=.1,layoutExecution:x="auto",layoutLoadingContent:k,onLayoutStateChange:w,padAngle:S=.01,groupWidth:A=20,sortGroups:C,edgeSort:M,treeOrientation:_="vertical",edgeType:P="curve",padding:R,paddingTop:j,tensionConfig:L,showParticles:T=!1,particleStyle:I,renderMode:$,nodeStyle:N,edgeStyle:D,colorBy:E,colorScheme:O="category10",edgeColorBy:B="source",edgeOpacity:F=.5,colorByDepth:z=!1,nodeSize:H=8,nodeSizeRange:W=[5,20],nodeLabel:q,showLabels:Y=!0,labelMode:G,size:V=Jp,responsiveWidth:X,responsiveHeight:U,margin:K,className:Q,background:Z,maxDevicePixelRatio:J,enableHover:ee=!0,tooltipContent:te,customHoverBehavior:oe,customClickBehavior:ne,onObservation:re,annotationObservationCallback:ie,chartId:se,onTopologyChange:ae,annotations:le,onAnnotationActivate:ce,autoPlaceAnnotations:ue,svgAnnotationRules:de,legend:he,legendPosition:fe,legendLayout:me,legendHoverBehavior:pe,legendClickBehavior:ge,legendHighlightedCategory:ye,legendIsolatedCategories:be,title:ve,foregroundGraphics:xe,backgroundGraphics:ke,decay:we,pulse:Se,transition:Ae,animate:Ce,staleness:Me,frameScheduler:_e,clock:Pe,random:Re,seed:je,paused:Le=!1,suspendWhenHidden:Te=!0,thresholds:Ie,accessibleTable:$e=!0,description:Ne,summary:De,orbitMode:Ee,orbitSize:Oe,orbitSpeed:Be,orbitRevolution:Fe,orbitRevolutionStyle:ze,orbitEccentricity:He,orbitShowRings:We,orbitAnimated:qe,customNetworkLayout:Ye,onLayoutError:Ge,layoutConfig:Ve,layoutSelection:Xe}=e,Ue=Zp.has(o)?Qp:Kp,Ke=(0,ef.useRef)(!0),Qe=nu({sizeProp:V,responsiveWidth:X,responsiveHeight:U,userMargin:K,marginDefault:Ue,title:ve,legend:he,legendPosition:fe,foregroundGraphics:xe,backgroundGraphics:ke,animate:Ce,transitionProp:Ae,frameScheduler:_e,clock:Pe,random:Re,seed:je,paused:Le,suspendWhenHidden:Te,themeDirtyRef:Ke}),{reducedMotionRef:Ze,responsiveRef:Je,size:et,margin:tt,adjustedWidth:ot,adjustedHeight:nt,resolvedForeground:rt,resolvedBackground:it,transition:st,introEnabled:at,tableId:lt,rafRef:ct,renderFnRef:ut,scheduleRender:dt,frameRuntime:ht,currentTheme:ft}=Qe,mt=Ml(),pt=jl(),gt=(0,ef.useMemo)(()=>yt(n),[n]),bt=(0,ef.useMemo)(()=>Array.isArray(r)?yt(r):r,[r]),vt=(0,ef.useMemo)(()=>({...tf,...L}),[L]),xt=(0,ef.useMemo)(()=>({...of,...I}),[I]),kt=(0,ef.useMemo)(()=>{return{chartType:(e={chartType:o,clock:ht.now,random:Re,seed:je,nodeIDAccessor:a,sourceAccessor:l,targetAccessor:c,valueAccessor:u,edgeIdAccessor:d,childrenAccessor:h,hierarchySum:f,orientation:m,nodeAlign:p,nodePaddingRatio:g,nodeWidth:y,iterations:b,forceStrength:v,padAngle:S,groupWidth:A,sortGroups:C,edgeSort:M,treeOrientation:_,edgeType:P,padding:R,paddingTop:j,tensionConfig:vt,showParticles:T,particleStyle:xt,nodeStyle:N,edgeStyle:D,nodeLabel:q,showLabels:Y,labelMode:G,colorBy:E,colorScheme:O,edgeColorBy:B,edgeOpacity:F,colorByDepth:z,nodeSize:H,nodeSizeRange:W,decay:we,pulse:Se,transition:st,introAnimation:at,staleness:Me,thresholds:Ie,orbitMode:Ee,orbitSize:Oe,orbitSpeed:Be,orbitRevolution:Fe,orbitRevolutionStyle:ze,orbitEccentricity:He,orbitShowRings:We,orbitAnimated:qe,customNetworkLayout:Ye,onLayoutError:Ge,layoutConfig:Ve,currentTheme:ft}).chartType,clock:e.clock,random:e.random,seed:e.seed,nodeIDAccessor:e.nodeIDAccessor,sourceAccessor:e.sourceAccessor,targetAccessor:e.targetAccessor,valueAccessor:e.valueAccessor,edgeIdAccessor:e.edgeIdAccessor,childrenAccessor:e.childrenAccessor,hierarchySum:e.hierarchySum,orientation:e.orientation,nodeAlign:e.nodeAlign,nodePaddingRatio:e.nodePaddingRatio,nodeWidth:e.nodeWidth,iterations:e.iterations,forceStrength:e.forceStrength,padAngle:e.padAngle,groupWidth:e.groupWidth,sortGroups:e.sortGroups,edgeSort:e.edgeSort,treeOrientation:e.treeOrientation,edgeType:e.edgeType,padding:e.padding,paddingTop:e.paddingTop,tensionConfig:e.tensionConfig,showParticles:e.showParticles,particleStyle:e.particleStyle,nodeStyle:e.nodeStyle,edgeStyle:e.edgeStyle,nodeLabel:e.nodeLabel,showLabels:e.showLabels,labelMode:e.labelMode,colorBy:e.colorBy,colorScheme:e.colorScheme,themeCategorical:e.currentTheme?.colors?.categorical,themeSemantic:At(e.currentTheme),edgeColorBy:e.edgeColorBy,edgeOpacity:e.edgeOpacity,colorByDepth:e.colorByDepth,nodeSize:e.nodeSize,nodeSizeRange:e.nodeSizeRange,decay:e.decay,pulse:e.pulse,transition:e.transition,introAnimation:e.introAnimation,staleness:e.staleness,thresholds:e.thresholds,orbitMode:e.orbitMode,orbitSize:e.orbitSize,orbitSpeed:e.orbitSpeed,orbitRevolution:e.orbitRevolution,orbitRevolutionStyle:e.orbitRevolutionStyle,orbitEccentricity:e.orbitEccentricity,orbitShowRings:e.orbitShowRings,orbitAnimated:e.orbitAnimated,customNetworkLayout:e.customNetworkLayout,onLayoutError:e.onLayoutError,layoutConfig:e.layoutConfig};var e},[o,ht.now,Re,je,a,l,c,u,d,h,f,m,p,g,y,b,v,S,A,C,M,_,P,R,j,vt,T,xt,N,D,q,Y,G,E,O,B,F,z,H,W,we,Se,st,at,Me,Ie,Ee,Oe,Be,Fe,ze,He,We,qe,Ye,Ge,Ve,ft]),wt=Tl(kt),St=Tl({chartType:(Ct={chartType:o,nodeIDAccessor:a,sourceAccessor:l,targetAccessor:c,valueAccessor:u,edgeIdAccessor:d,childrenAccessor:h,hierarchySum:f,orientation:m,nodeAlign:p,nodePaddingRatio:g,nodeWidth:y,iterations:b,forceStrength:v,padAngle:S,groupWidth:A,sortGroups:C,edgeSort:M,treeOrientation:_,edgeType:P,padding:R,paddingTop:j,random:Re,seed:je,tensionConfig:vt,customNetworkLayout:Ye,orbitMode:Ee,orbitSize:Oe,orbitEccentricity:He}).chartType,nodeIDAccessor:Ct.nodeIDAccessor,sourceAccessor:Ct.sourceAccessor,targetAccessor:Ct.targetAccessor,valueAccessor:Ct.valueAccessor,edgeIdAccessor:Ct.edgeIdAccessor,childrenAccessor:Ct.childrenAccessor,hierarchySum:Ct.hierarchySum,orientation:Ct.orientation,nodeAlign:Ct.nodeAlign,nodePaddingRatio:Ct.nodePaddingRatio,nodeWidth:Ct.nodeWidth,iterations:Ct.iterations,forceStrength:Ct.forceStrength,padAngle:Ct.padAngle,groupWidth:Ct.groupWidth,sortGroups:Ct.sortGroups,edgeSort:Ct.edgeSort,treeOrientation:Ct.treeOrientation,edgeType:Ct.edgeType,padding:Ct.padding,paddingTop:Ct.paddingTop,random:Ct.random,seed:Ct.seed,tensionConfig:Ct.tensionConfig,customNetworkLayout:Ct.customNetworkLayout,orbitMode:Ct.orbitMode,orbitSize:Ct.orbitSize,orbitEccentricity:Ct.orbitEccentricity});var Ct;const Mt=(0,ef.useRef)(0),_t=(0,ef.useRef)(0),Pt=(0,ef.useRef)(!1),Rt=(0,ef.useRef)(null);Rt.current||(Rt.current=new Km(wt));const jt=pr("StreamNetworkFrame"),Lt=(0,ef.useCallback)((e,t,o=!1)=>function(e,t,o,n=!1,r=!1){const i=e.beforeCompute(t.getLastUpdateResult(),n);o(),e.afterCompute(i,!0,r)}(jt.current,e,()=>e.buildScene(t),o),[jt]),[Tt,It]=(0,ef.useState)(null),[$t,Nt]=(0,ef.useState)(0),[Dt,Et]=(0,ef.useState)(0),[Ot,Bt]=(0,ef.useState)(!1),[Ft,zt]=(0,ef.useState)(!1),Ht=(0,ef.useRef)(0),Wt=(0,ef.useRef)(null),qt=(0,ef.useRef)(!1),Yt=(0,ef.useRef)(w);Yt.current=w;const Gt=(0,ef.useRef)(wt);Gt.current=wt;const Vt=(0,ef.useRef)(null),Xt=(0,ef.useRef)(new Map),Ut=(0,ef.useRef)(0),Kt=(0,ef.useCallback)(e=>function(e){const{node:t,colorBy:o,colorScheme:n,nodeColorMap:r,colorIndexRef:i}=e;if("function"==typeof o)return o(t)+"";if("string"==typeof o&&t.data){const e=t.data[o];if(void 0!==e){if(!r.has(e+"")){const t=Array.isArray(n)?n:go;r.set(e+"",t[i.current++%t.length])}return r.get(e+"")}}if(r.has(t.id))return r.get(t.id);const s=Array.isArray(n)?n:go,a=o?s[i.current++%s.length]:s[0];return r.set(t.id,a),a}({node:e,colorBy:E,colorScheme:O,nodeColorMap:Xt.current,colorIndexRef:Ut}),[E,O]),Qt=(0,ef.useCallback)(e=>{Ut.current=function(e){const{sceneNodes:t,nodes:o,nodeColorMap:n,colorScheme:r}=e;for(const e of t)e.id&&"string"==typeof e.style?.fill&&n.set(e.id,e.style.fill);const i=Array.isArray(r)?r:go,s=Array.from(o);for(let e=0;s.length>e;e++){const t=s[e];n.has(t.id)||n.set(t.id,i[e%i.length])}return s.length}({sceneNodes:e.sceneNodes,nodes:e.nodes.values(),nodeColorMap:Xt.current,colorScheme:O})},[O]),Zt=(0,ef.useCallback)((e,t)=>{Lt(e,t),Qt(e),Ke.current=!1,e.markStylePaintPending()},[Lt,Qt]),Jt=(0,ef.useCallback)(()=>{Rt.current?.markStylePaintPending()},[]),eo=(to=ft,to?.colors?.border||to?.colors?.secondary||to?.colors?.primary||"#999");var to;const oo=(0,ef.useCallback)(e=>function(e,t){return e?"object"==typeof e?e:t?.get(e)??null:null}(e,Rt.current?.nodes),[]),no=(0,ef.useCallback)(e=>function(e){const{edge:t,edgeColorBy:o,getNodeColor:n,resolveEndpoint:r,fallback:i}=e;if("function"==typeof o)return o(t);const s=r(t.source),a=r(t.target);return"target"===o&&a?n(a):s?n(s):i}({edge:e,edgeColorBy:B,getNodeColor:Kt,resolveEndpoint:oo,fallback:eo}),[B,Kt,eo,oo]),ro=(0,ef.useCallback)(e=>function(e){const{edge:t,particleStyleColor:o,particleColorBy:n,hasExplicitParticleColorBy:r,getEdgeColor:i,getNodeColor:s,resolveEndpoint:a,fallback:l}=e;if("function"==typeof o){const e=a(t.source);return e?o(t,e):l}if(!r)return i(t);const c=n,u=a(t.source),d=a(t.target);return"target"===c&&d?s(d):u?s(u):l}({edge:e,particleStyleColor:xt.color,particleColorBy:xt.colorBy,hasExplicitParticleColorBy:!!I?.colorBy,getEdgeColor:no,getNodeColor:Kt,resolveEndpoint:oo,fallback:eo}),[I?.colorBy,xt.color,xt.colorBy,Kt,no,eo,oo]),io=function(e,t,o,n,r){return("sankey"===e||t)&&o||n||r}(o,!!Ye,T,!!Se,Rt.current?.isAnimating??!1);_r(Rt,wt,Ke,dt),Pr(Rt,Xe,Ke,dt),(0,ef.useEffect)(()=>{const e=Rt.current;e&&(Zt(e,[ot,nt]),Nt(e=>e+1),dt())},[ft,ot,nt,Zt,dt]);const so=(0,ef.useCallback)(()=>{const e=Rt.current;if(e&&(e.runLayout([ot,nt]),Zt(e,[ot,nt]),Nt(e.layoutVersion),ae)){const{nodes:t,edges:o}=e.getLayoutData();ae(t,o)}},[ot,nt,Zt,ae]),ao=(0,ef.useRef)(!1),lo=(0,ef.useCallback)((e=!1)=>!(!e&&!ao.current||(ao.current=!1,so(),0)),[so]),co=(0,ef.useCallback)(()=>lo(!1),[lo]),uo=(0,ef.useCallback)(e=>{const t=Rt.current;if(!t)return!1;let o=!1,n=ao.current;for(const r of e)null!=r&&"object"==typeof r&&(o=!0,t.ingestEdge(r)&&(n=!0));const r=lo(n);return o||r},[lo]),ho=(0,ef.useCallback)(e=>{if(null==e||"object"!=typeof e)return;const t=Rt.current;t&&(t.ingestEdge(e)&&(ao.current=!0),ht.isActive?dt():co())},[co,ht,dt]),fo=(0,ef.useCallback)(e=>{uo(e)&&dt()},[uo,dt]);(0,ef.useEffect)(()=>ht.subscribe(()=>{ht.isActive||co()}),[co,ht]);const mo=(0,ef.useCallback)(()=>{ao.current=!1,Rt.current?.clear(),Xt.current.clear(),Ut.current=0,Nt(Rt.current?.layoutVersion??0),It(null),Vt.current=null,Ke.current=!0,dt()},[dt]),po=(0,ef.useCallback)(()=>{const e=Rt.current;e&&(e.tension+=999,lo(!0),dt())},[lo,dt]);(0,ef.useImperativeHandle)(t,()=>({push:ho,pushMany:fo,removeNode:e=>{const t=Rt.current?.removeNode(e)??!1;if(t){const t=Vt.current?.data?"function"==typeof a?a(Vt.current.data):Vt.current.data[a]:void 0;Vt.current&&"node"===Vt.current.nodeOrEdge&&t===e&&(Vt.current=null,It(null)),Xt.current.delete(e)}return lo(t)&&(Ke.current=!0,dt()),t},removeEdge:(e,t)=>{const o=Rt.current?.removeEdge(e,t)??!1;if(o&&Vt.current&&"edge"===Vt.current.nodeOrEdge){const o=Vt.current.data;let n;n=void 0!==t?("object"==typeof o?.source?o.source.id:o?.source)===e&&("object"==typeof o?.target?o.target.id:o?.target)===t:!d||!o||("function"==typeof d?d:e=>e?.[d])(o)===e,n&&(Vt.current=null,It(null))}return lo(o)&&(Ke.current=!0,dt()),o},updateNode:(e,t)=>{const o=Rt.current?.updateNode(e,t)??null;return lo(null!==o)&&(Ke.current=!0,dt()),o},updateEdge:(e,t,o)=>{const n=Rt.current?.updateEdge(e,t,o)??[];return lo(n.length>0)&&(Ke.current=!0,dt()),n},clear:mo,getTopology:()=>(co(),Rt.current?.getLayoutData()??{nodes:[],edges:[]}),getCustomLayout:()=>(co(),Rt.current?.lastCustomLayoutResult??null),getLayoutFailure:()=>(co(),Rt.current?.lastCustomLayoutFailure??null),getTopologyDiff:()=>{co();const e=Rt.current;return e?{addedNodes:Array.from(e.addedNodes),removedNodes:Array.from(e.removedNodes),addedEdges:Array.from(e.addedEdges),removedEdges:Array.from(e.removedEdges)}:{addedNodes:[],removedNodes:[],addedEdges:[],removedEdges:[]}},relayout:po,getTension:()=>(co(),Rt.current?.tension??0)}),[ho,fo,mo,po,co,lo,a,dt,d]);const yo=["tree","cluster","treemap","circlepack","partition","orbit"].includes(o),bo=yo?i||(Array.isArray(r)?void 0:r):void 0;(0,ef.useEffect)(()=>{const e=Rt.current;if(!e)return;const t=++Ht.current;if(Wt.current?.abort(),Wt.current=null,yo&&bo)ao.current=!1,e.ingestHierarchy(bo,[ot,nt]),Zt(e,[ot,nt]),Nt(e.layoutVersion),zt(!1),Yt.current?.("ready"),dt();else{const i=gt,s=Array.isArray(bt)?bt:[];if(null==n&&null==r||(ao.current=!1),0===i.length&&0===s.length)return null==n&&null==r||0>=e.nodes.size&&0>=e.edges.size||mo(),zt(!1),void Yt.current?.("ready");const a=[ot,nt],l="force"===o&&!Ye&&Pp()&&!Re&&_p(x,i.length,s.length,b);if(l&&pt&&!qt.current&&e.sceneNodes.length>0)return qt.current=!0,zt(!1),Yt.current?.("ready"),Ke.current=!0,void dt();if(l){const o=new AbortController;Wt.current=o;const n=e._lastPositionSnapshot;e.ingestBounded(i,s,a,{deferLayout:!0});const r=e.getLayoutData(),l=function(e,t,o,n,r){const i=lm(o.nodeSize,o.nodeSizeRange,e);return{kind:"frame",nodes:e.map(e=>{const t=r?.get(e.id);return{id:e.id,x:0!==e.x||0!==e.y?e.x:t?.x??0,y:0!==e.x||0!==e.y?e.y:t?.y??0,x0:0,x1:0,y0:0,y1:0,width:0,height:0,value:e.value,__forceRadius:i(e)}}),edges:t.map(e=>{const t="string"==typeof e.source?e.source:e.source.id,o="string"==typeof e.target?e.target:e.target.id,n=e.data?.weight,r="number"==typeof n&&Number.isFinite(n)?n:e.value;return{source:t,target:o,value:e.value,y0:0,y1:0,sankeyWidth:0,weight:r}}),config:{chartType:"force",iterations:o.iterations,forceStrength:o.forceStrength,seed:o.seed},size:n}}(r.nodes,r.edges,Gt.current,a,n);return zt(!0),Yt.current?.("pending"),Lp(l,o.signal).then(({positions:o})=>{t===Ht.current&&(e.applyForceLayoutPositions(o,a),Zt(e,a),zt(!1),Yt.current?.("ready"),Nt(e.layoutVersion),dt())}).catch(o=>{"AbortError"!==o.name&&t===Ht.current&&(e.runLayout(a),Zt(e,a),zt(!1),Yt.current?.("error"),Nt(e.layoutVersion),dt())}),()=>o.abort()}e.ingestBounded(i,s,a),Zt(e,a),Nt(e.layoutVersion),zt(!1),Yt.current?.("ready"),dt()}},[gt,bt,n,r,i,bo,yo,ot,nt,St,x,b,pt,o,Ye,Re,dt,mo,Zt]);const vo=Jh.useRef(!1);(0,ef.useEffect)(()=>{vo.current||s&&s.length>0&&(vo.current=!0,fo(s))},[s,fo]);const{customHoverBehavior:xo,customClickBehavior:ko}=function({customHoverBehavior:e,customClickBehavior:t,onObservation:o,chartId:n}){return{customHoverBehavior:(0,Vp.useCallback)((t,r)=>{e?.(t,r),hd({onObservation:o,datum:t?t.data||t:null,x:t?.x,y:t?.y,chartType:Xp,chartId:n,context:r})},[e,o,n]),customClickBehavior:(0,Vp.useCallback)((e,r)=>{t?.(e,r),fd({onObservation:o,datum:e?e.data||e:null,x:e?.x,y:e?.y,chartType:Xp,chartId:n,context:r})},[t,o,n])}}({customHoverBehavior:oe,customClickBehavior:ne,onObservation:re,chartId:se}),{hoverHandlerRef:wo,hoverLeaveRef:So,onPointerMove:Ao,onPointerLeave:Co}=Qe,Mo=()=>!Ye||(Rt.current?.hasCustomRestyle??!1);wo.current=e=>{if(!ee)return;const t=Mo(),o=$o.current;if(!o)return;const n=Rt.current;if(!n)return;const r=Gp({clientX:e.clientX,clientY:e.clientY,canvasRect:o.getBoundingClientRect(),margin:tt,adjustedWidth:ot,adjustedHeight:nt,sceneNodes:n.sceneNodes,sceneEdges:n.sceneEdges,nodeQuadtree:n.nodeQuadtree,maxNodeRadius:n.maxNodeRadius});"hit"===r.kind?(Vt.current=r.hover,It(r.hover),xo?.(r.hover),t&&dt()):Vt.current&&(Vt.current=null,It(null),xo?.(null),t&&dt())},So.current=()=>{if(Vt.current){const e=Mo();Vt.current=null,It(null),xo?.(null),e&&dt()}};const _o=(0,ef.useRef)(()=>{});_o.current=e=>{if(Js(e.target))return;if(!ne&&!re)return;const t=$o.current;if(!t)return;const o=Rt.current;if(!o)return;const n=Gp({clientX:e.clientX,clientY:e.clientY,canvasRect:t.getBoundingClientRect(),margin:tt,adjustedWidth:ot,adjustedHeight:nt,sceneNodes:o.sceneNodes,sceneEdges:o.sceneEdges,nodeQuadtree:o.nodeQuadtree,maxNodeRadius:o.maxNodeRadius});"hit"===n.kind?ko(n.hover,{type:"activate",inputType:ud(e.nativeEvent.pointerType)}):"miss"===n.kind&&ko(null)};const Po=(0,ef.useCallback)(e=>_o.current(e),[]),Ro=(0,ef.useRef)(-1),jo=(0,ef.useRef)(null),Lo=(0,ef.useRef)(-1),To=(0,ef.useCallback)(e=>{if(dd(e))return;const t=Rt.current;if(!t)return;const o=()=>{Ro.current=-1,jo.current=null,Lo.current=-1,Vt.current=null,It(null),xo?.(null),dt()},n=function(e){const t=[];for(const o of e)if("circle"===o.type&&null!=o.cx){if(0>=o.r)continue;t.push({x:o.cx,y:o.cy,datum:o.datum,shape:"circle",group:o.datum?.id??"_default"})}else if("rect"===o.type&&null!=o.x){if(0>=o.w||0>=o.h)continue;t.push({x:o.x+o.w/2,y:o.y+o.h/2,datum:o.datum,shape:"rect",w:o.w,h:o.h,group:o.datum?.id??"_default"})}else if("arc"===o.type&&null!=o.cx)t.push({x:o.cx,y:o.cy,datum:o.datum,shape:"circle",group:o.datum?.id??"_default"});else if("symbol"===o.type&&null!=o.cx){if(0>=o.size)continue;t.push({x:o.cx,y:o.cy,datum:o.datum,shape:"circle",group:o.datum?.id??"_default"})}else if("glyph"===o.type&&null!=o.cx){if(0>=o.size||null==o.datum)continue;const e=zr(o.glyph,o.size);t.push({x:o.cx+e.centerDx,y:o.cy+e.centerDy,datum:o.datum,shape:"rect",w:2*e.halfWidth,h:2*e.halfHeight,group:o.datum?.id??"_default"})}return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}(t.sceneNodes);if(0===n.length)return void(0>Ro.current||o());const r=yd(n);let i=Ro.current;if(r.flat.length>i||(o(),i=-1)," "===e.key&&i>=0){e.preventDefault();const t=r.flat[i];return void ko?.(Ac(t.datum||{},t.x,t.y,{nodeOrEdge:"node"}),{type:"activate",inputType:"keyboard"})}if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown","Enter"].includes(e.key))return;e.preventDefault(),Ro.current=0,Lo.current=-1;const t=r.flat[0];jo.current={shape:t.shape,w:t.w,h:t.h};const o=Ac(t.datum||{},t.x,t.y,{nodeOrEdge:"node"});return Vt.current=o,It(o),xo?.(o,{type:"focus",inputType:"keyboard"}),void dt()}const s=bd(r,i),a=function(e,t,o,n,r){const i=o.flat[t.flatIndex];if(!i)return vd(e,t,o);const s=i.datum?.id;switch(e){case"ArrowRight":case"ArrowLeft":case"ArrowDown":case"ArrowUp":{const n=function(e,t,o){let n=null,r=1/0;for(let i=0;e.flat.length>i;i++){const s=e.flat[i];if(s===t)continue;const a=s.x-t.x,l=s.y-t.y;let c=!1;switch(o){case"right":c=a>0&&Math.abs(a)>=Math.abs(l);break;case"left":c=0>a&&Math.abs(a)>=Math.abs(l);break;case"down":c=l>0&&Math.abs(l)>=Math.abs(a);break;case"up":c=0>l&&Math.abs(l)>=Math.abs(a)}if(!c)continue;const u=a*a+l*l;r>u&&(r=u,n=i)}return n}(o,i,"ArrowRight"===e?"right":"ArrowLeft"===e?"left":"ArrowDown"===e?"down":"up")??t.flatIndex;return n!==t.flatIndex&&(r.current=-1),n}case"Enter":{if(null==s)return t.flatIndex;const e=function(e,t){const o=e+"",n=[];for(const e of t){const t=e.datum??e,r=Sd(t.source),i=Sd(t.target),s=null!=r,a=null!=i;s&&r+""===o&&a?n.push(i+""):a&&i+""===o&&s&&n.push(r+"")}return n}(s,n);if(0===e.length)return t.flatIndex;const i=o.idToIdx.get(e[(r.current+1)%e.length])??-1;return 0>i?t.flatIndex:(r.current=-1,i)}default:{const n=vd(e,t,o);return null!==n&&n!==t.flatIndex&&(r.current=-1),n}}}(e.key,s,r,t.sceneEdges??[],Lo);if(null===a)return;if(e.preventDefault(),0>a)return void o();Ro.current=a;const l=r.flat[a];jo.current={shape:l.shape,w:l.w,h:l.h};const c={data:l.datum||{},x:l.x,y:l.y,__semioticHoverData:!0,nodeOrEdge:"node"};Vt.current=c,It(c),xo?.(c,{type:"focus",inputType:"keyboard"}),dt()},[ko,xo,dt]),Io=(0,ef.useCallback)(e=>{Ro.current=-1,jo.current=null,Ao(e)},[Ao]);ut.current=()=>{if(ct.current=null,co(),!ht.isActive)return;const e=$o.current;if(!e)return;const t=Rt.current;t&&function(e){const{canvas:t,store:o,sceneRevisionDiagnostics:n,size:r,margin:i,adjustedWidth:s,adjustedHeight:a,background:l,maxDevicePixelRatio:c,renderMode:u,hasBackgroundGraphics:d=!1,dirtyRef:h,resolutionDirtyRef:f,lastFrameTimeRef:m,now:p,random:g,reducedMotion:y,showParticles:b,isContinuous:v,animate:x,decay:k,pulse:w,thresholds:S,staleness:A,particleStyle:C,getParticleColor:M,pendingAnnotationFrameRef:_,lastAnnotationFrameTimeRef:P,setAnnotationFrame:R,scheduleNextFrame:j,syncColorMap:L}=e,T=t.getContext("2d");if(!T)return;const I=m.current?Math.min((p-m.current)/1e3,.1):.016;m.current=p;const $=o.advanceTransition(y?p+1e6:p),N=!y&&$,D=!y&&o.tickAnimation([s,a],I),E=h.current,O=n?.beforeCompute(o.getLastUpdateResult(),N),B=$||E||D;B&&(o.buildScene([s,a]),E&&L?.()),O&&n?.afterCompute(O,B,!1);const F=b&&!y&&!!o.particlePool,z=!!((H={dirtyOrRebuilt:E,transitioning:N,animationTicked:D,continuous:F||v,liveEncoding:!!k||!!w||!!S||!1!==x&&o.hasActiveTopologyDiff||o.hasActivePulses||o.hasActiveThresholds,forced:o.consumeStylePaintPending()||!0===f?.current}).dirtyOrRebuilt||H.transitioning||H.animationTicked||H.continuous||H.liveEncoding||H.forced);var H;f&&(f.current=!1);const W=!!A&&o.lastIngestTime>0&&p-o.lastIngestTime>(A?.threshold??5e3);if(z){const e=su(c);if(!iu(t,r,i,e))return;if(T.clearRect(-i.left,-i.top,r[0],r[1]),El(T,{background:l,hasBackgroundGraphics:d,width:s,height:a}),k&&o.applyDecay(),w&&o.applyPulse(p),S&&o.applyThresholds(p),!1!==x&&o.applyTopologyDiff(p),W&&(T.globalAlpha=A?.dimOpacity??.5),Qu({context:T,nodes:o.sceneEdges,renderMode:u,pixelRatio:e,paintBuiltIn:e=>function(e,t){for(const o of t)switch(o.type){case"bezier":Dp(e,o);break;case"line":Ep(e,o);break;case"ribbon":Op(e,o);break;case"curved":Bp(e,o)}}(T,e)}),Qu({context:T,nodes:o.sceneNodes,renderMode:u,pixelRatio:e,paintBuiltIn:e=>{const t=e;!function(e,t){for(const o of t){if("rect"!==o.type)continue;const t=o;t.w>0&&t.h>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),fi(e,t.style,"#007bff",()=>e.fillRect(t.x,t.y,t.w,t.h)),mi(e,t.style,()=>e.strokeRect(t.x,t.y,t.w,t.h)),Cu(e,t),e.restore())}}(T,t),function(e,t){for(const o of t){if("circle"!==o.type)continue;const t=o;t.r>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.r,0,2*Math.PI),fi(e,t.style,"#007bff",()=>e.fill()),mi(e,t.style,()=>e.stroke()),Mu(e,t),e.restore())}}(T,t),function(e,t){for(const o of t){if("arc"!==o.type)continue;const t=o;e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.outerR,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerR,t.endAngle,t.startAngle,!0),e.closePath(),fi(e,t.style,"#007bff",()=>e.fill()),mi(e,t.style,()=>e.stroke()),e.restore()}}(T,t),function(e,t){const o=e.globalAlpha;for(const n of t)"symbol"===n.type&&$u(e,n,n.cx,n.cy,o,"#007bff");e.globalAlpha=o}(T,t),function(e,t){const o=e.globalAlpha;for(const n of t)"glyph"===n.type&&Du(e,n,n.cx,n.cy,o);e.globalAlpha=o}(T,t)}}),F&&!W){const e=o.edgesArray;if(e.length>0){!function(e,t,o,n,r=Math.random){const i=n.spawnRate??.1,s=n.maxPerEdge??50;for(let n=0;t.length>n;n++){const a=t[n];if(!a.bezier)continue;if(e.countForEdge(n)>=s)continue;const l=a.value*i*o*(a.bezier.circular?.3:1),c=Math.floor(l),u=l-c;let d=c;r()<u&&d++;for(let t=0;d>t&&e.countForEdge(n)<s;t++)e.spawn(n,r)}}(o.particlePool,e,I,C,g);const t=.5*(C.speedMultiplier??1);let n;if(C.proportionalSpeed){const t=e.reduce((e,t)=>Math.max(e,t.value||1),1);n=e.map(e=>.3+(e.value||1)/t*1.7)}o.particlePool.step(I,t,e,n),function(e,t,o,n,r){const i=n.radius??3;e.globalAlpha=n.opacity??.7;for(let s=0;t.particles.length>s;s++){const a=t.particles[s];if(!a.active)continue;const l=o[a.edgeIndex];if(!l)continue;let c;c="string"==typeof n.color&&"inherit"!==n.color?n.color:r(l),e.fillStyle=Ur(e,c)||c,e.beginPath(),e.arc(a.x,a.y,i,0,2*Math.PI),e.fill()}e.globalAlpha=1}(T,o.particlePool,e,C,M)}}W&&(T.globalAlpha=1)}h.current=!1,(E||N||D)&&t.setAttribute("aria-label",ec(o.sceneNodes?.length??0,o.sceneEdges?.length??0,"Network chart"));const q=E||N||D||_.current;q&&p-P.current>=33?(R(e=>e+1),P.current=p,_.current=!1):_.current=!!q,(v||N||null!=o.transition||D||o.hasActivePulses||o.hasActiveThresholds||!1!==x&&o.hasActiveTopologyDiff||_.current)&&j()}({canvas:e,store:t,sceneRevisionDiagnostics:jt.current,size:et,margin:tt,adjustedWidth:ot,adjustedHeight:nt,background:Z,maxDevicePixelRatio:J,renderMode:$,hasBackgroundGraphics:!!ke,dirtyRef:Ke,resolutionDirtyRef:No,lastFrameTimeRef:Mt,now:ht.now(),random:ht.random,reducedMotion:!!Ze.current,showParticles:T,isContinuous:io,animate:Ce,decay:we,pulse:Se,thresholds:Ie,staleness:Me,particleStyle:xt,getParticleColor:ro,pendingAnnotationFrameRef:Pt,lastAnnotationFrameTimeRef:_t,setAnnotationFrame:Et,scheduleNextFrame:()=>{dt()},syncColorMap:()=>Qt(t)})};const{canvasRef:$o,resolutionDirtyRef:No}=cu(Qe,{hydrated:mt,wasHydratingFromSSR:pt,storeRef:Rt,dirtyRef:Ke,skipInitialCanvasPaintInvalidation:!0,canvasPaintInvalidator:Jt,maxDevicePixelRatio:J,canvasPaintDependencies:[o,ot,nt,Z,ke,$,dt]});$i(Me,Rt,Ke,dt,Ot,Bt);const Do=ee&&Tt?(0,Up.jsx)(Wc,{x:Tt.x,y:Tt.y,containerWidth:ot,containerHeight:nt,margin:tt,className:"stream-network-tooltip",zIndex:2,children:te?te(Tt):(0,Up.jsx)($p,{data:Tt})}):null;if(Sl||!mt&&pt)return(0,Up.jsx)(ip,{props:e,store:Rt.current,responsiveRef:Je,size:et,margin:tt,adjustedWidth:ot,adjustedHeight:nt,resolvedBackground:it,resolvedForeground:rt});const Eo=Rt.current;return(0,Up.jsxs)("div",{ref:Je,className:"stream-network-frame"+(Q?" "+Q:""),role:"group","aria-label":Ne||("string"==typeof ve?ve:"Network chart"),tabIndex:0,"aria-busy":Ft||void 0,style:{position:"relative",width:X?"100%":et[0],height:U?"100%":et[1],overflow:"visible"},onKeyDown:To,children:["production"!==process.env.NODE_ENV&&Rt.current&&(0,Up.jsx)(gr,{store:Rt.current,diagnostics:jt.current}),$e&&(0,Up.jsx)(yc,{tableId:lt}),$e&&(0,Up.jsx)(pc,{nodes:Eo?.sceneNodes??[],edges:Eo?.sceneEdges??[],chartType:"Network chart",tableId:lt,chartTitle:"string"==typeof ve?ve:void 0}),(0,Up.jsx)(gc,{summary:De}),(0,Up.jsx)(Xl,{hoverPoint:Tt}),(0,Up.jsxs)("div",{role:"img","aria-label":Ne||("string"==typeof ve?ve:"Network chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:ee?Io:void 0,onMouseLeave:ee?Co:void 0,onClick:ne||re?Po:void 0,children:[Ft&&!1!==k&&(0,Up.jsx)("div",{style:{position:"absolute",inset:0,zIndex:3,background:"var(--semiotic-bg, #fff)"},children:yp(!0,et[0],et[1],k)}),(0,Up.jsx)(uu,{size:et,margin:tt,overflowVisible:!0,children:it}),(0,Up.jsx)("canvas",{ref:$o,"aria-label":ec(Eo?.sceneNodes?.length??0,Eo?.sceneEdges?.length??0,"Network chart"),style:{position:"absolute",top:0,left:0}}),(0,Up.jsx)(Jm,{width:ot,height:nt,totalWidth:et[0],totalHeight:et[1],margin:tt,labels:Eo?.labels||[],sceneNodes:Eo?.sceneNodes,title:ve,legend:he,legendPosition:fe,legendLayout:me,legendHoverBehavior:pe,legendClickBehavior:ge,legendHighlightedCategory:ye,legendIsolatedCategories:be,foregroundGraphics:br(rt,Cr(Rt.current?.customLayoutOverlays,Xe??null)),annotations:le,onAnnotationActivate:ce,onObservation:ie??re,chartId:se,chartType:"StreamNetworkFrame",autoPlaceAnnotations:ue,svgAnnotationRules:de,annotationFrame:Dt}),(0,Up.jsx)(np,{marks:Eo?.customLayoutHtmlMarks,margin:tt,selection:Xe??null}),(0,Up.jsx)(xc,{active:Ro.current>=0,hoverPoint:Tt,margin:tt,size:et,shape:jo.current?.shape,width:jo.current?.w,height:jo.current?.h}),Do,Me?.showBadge&&(0,Up.jsx)(Di,{isStale:Ot,position:Me.badgePosition})]})]})}));eg.displayName="StreamNetworkFrame";var tg=eg;function og(e){const{title:t,description:o,summary:n,accessibleTable:r,className:i,animate:s,maxDevicePixelRatio:a,axisExtent:l,autoPlaceAnnotations:c}=e,u={};return t&&(u.title=t),o&&(u.description=o),n&&(u.summary=n),void 0!==r&&(u.accessibleTable=r),i&&(u.className=i),null!=s&&(u.animate=s),void 0!==a&&(u.maxDevicePixelRatio=a),void 0!==l&&(u.axisExtent=l),void 0!==c&&(u.autoPlaceAnnotations=c),u}function ng(e){const{linkedHover:t,selection:o,onObservation:n,onClick:r,hoverRadius:i,hoverHighlight:s,forceHoverBehavior:a,forceClickBehavior:l,mobileInteraction:c,customHoverBehavior:u,customClickBehavior:d,linkedHoverInClickPredicate:h=!0}=e,f={};n&&(f.annotationObservationCallback=n);const m=c?.enabled?Math.max(i??30,Math.ceil((c.targetSize||44)/2),24):i;return(a||t||n||r||s)&&(f.customHoverBehavior=u),d&&(l||(h?n||r||t:n||r)||c?.enabled&&(c.tapToSelect||c.tapToLockTooltip)&&(t||s||o))&&(f.customClickBehavior=d),null!=m&&(f.hoverRadius=m),f}function rg(e){const{tooltip:t,defaultTooltipContent:o}=e;return{tooltipContent:!1===t?()=>null:zc(t)||o}}var ig=d(require("react")),sg=require("react"),ag=require("react"),lg=require("react"),cg=require("react/jsx-runtime"),ug=(0,lg.createContext)(null);function dg({colors:e,categories:t,colorScheme:o="category10",children:n}){const r=(0,lg.useMemo)(()=>{if(e)return e;if(t){if(o&&"object"==typeof o&&!Array.isArray(o)){const e=o,n={};let r=0;for(const o of t)n[o]=So(e,o)??go[r++%go.length];return n}const e=Array.isArray(o)?o:po[o]||go,n={};for(let o=0;t.length>o;o++)n[t[o]]=e[o%e.length];return n}return{}},[e,t,o]);return(0,cg.jsx)(ug.Provider,{value:r,children:n})}function hg(){return(0,lg.useContext)(ug)}function fg(e){return e?"string"==typeof e?{name:e}:e:null}dg.displayName="CategoryColorProvider";var mg=.5;function pg(e,t,o){return t?(n,...r)=>{const i={...e(n,...r)};if(t.isActive)if(t.predicate(n))o?.selectedStyle&&Object.assign(i,o.selectedStyle);else{const e=o?.unselectedOpacity??mg;i.opacity=e,i.fillOpacity=e,i.strokeOpacity=e,o?.unselectedStyle&&Object.assign(i,o.unselectedStyle)}return i}:e}var gg=require("react");function yg(e){const t=[];for(const[o,n]of Object.entries(e.fields))if("point"===n.type)t.push(e=>n.values.has(e[o]));else{const[e,r]=n.range;t.push(t=>{const n=t[o];return n>=e&&r>=n})}return e=>t.every(t=>t(e))}function bg(e,t){const o=[];for(const[n,r]of e.clauses)"crossfilter"===e.resolution&&n===t||o.push(yg(r));return 0===o.length?()=>!0:"intersect"===e.resolution?e=>o.every(t=>t(e)):e=>o.some(t=>t(e))}function vg(e,t){let o=e.get(t);return o||(o={name:t,resolution:"union",clauses:new Map},e.set(t,o)),o}function xg(e,t){if(e.type!==t.type)return!1;if("interval"===e.type&&"interval"===t.type)return e.range[0]===t.range[0]&&e.range[1]===t.range[1];if("point"===e.type&&"point"===t.type){if(e.values.size!==t.values.size)return!1;for(const o of e.values)if(!t.values.has(o))return!1;return!0}return!1}var[kg,wg]=kt(e=>({selections:new Map,setClause(t,o){e(e=>{const n=e.selections.get(t),r=n?.clauses.get(o.clientId);if(r&&function(e,t){if(e.clientId!==t.clientId||e.type!==t.type)return!1;const o=Object.entries(e.fields);if(o.length!==function(e){let t=0;for(const o in e)t++;return t}(t.fields))return!1;for(const[e,n]of o){const o=t.fields[e];if(!o||!xg(n,o))return!1}return!0}(r,o))return{};const i=new Map(e.selections),s=vg(i,t),a=new Map(s.clauses);return a.set(o.clientId,o),i.set(t,{...s,clauses:a}),{selections:i}})},clearClause(t,o){e(e=>{const n=e.selections.get(t);if(!n||!n.clauses.has(o))return{};const r=new Map(e.selections),i=new Map(n.clauses);return i.delete(o),r.set(t,{...n,clauses:i}),{selections:r}})},setResolution(t,o){e(e=>{const n=e.selections.get(t);if(n?.resolution===o)return{};const r=new Map(e.selections),i=vg(r,t);return r.set(t,{...i,resolution:o}),{selections:r}})},clearSelection(t){e(e=>{const o=e.selections.get(t);if(!o||0===o.clauses.size)return{};const n=new Map(e.selections);return n.set(t,{...o,clauses:new Map}),{selections:n}})}}));function Sg(e){const t=(0,gg.useId)(),o=e.clientId||t,{name:n}=e,r=wg(e=>e.selections.get(n)),i=wg(e=>e.setClause),s=wg(e=>e.clearClause),a=(0,gg.useMemo)(()=>!!r&&r.clauses.size>0,[r]);return{predicate:(0,gg.useMemo)(()=>r&&0!==r.clauses.size?bg(r,o):()=>!0,[r,o]),isActive:a,selectPoints:(0,gg.useCallback)(e=>{const t={};let r=!1;for(const[o,n]of Object.entries(e))t[o]={type:"point",values:new Set(n)},r=!0;r&&i(n,{clientId:o,type:"point",fields:t})},[o,n,i]),selectInterval:(0,gg.useCallback)(e=>{const t={};let r=!1;for(const[o,n]of Object.entries(e))t[o]={type:"interval",range:n},r=!0;r&&i(n,{clientId:o,type:"interval",fields:t})},[o,n,i]),clear:(0,gg.useCallback)(()=>{s(n,o)},[s,n,o]),clientId:o}}function Ag(e,t){const o=(0,gg.useId)(),n=t||o,r=wg(e=>e.setClause),i=wg(e=>e.clearClause);return{selectPoints:(0,gg.useCallback)(t=>{const o={};let i=!1;for(const[e,n]of Object.entries(t))o[e]={type:"point",values:new Set(n)},i=!0;i&&r(e,{clientId:n,type:"point",fields:o})},[e,n,r]),clear:(0,gg.useCallback)(()=>i(e,n),[e,n,i]),clientId:n}}function Cg(e){const t=e.name||"hover",{fields:o}=e,{predicate:n,isActive:r,selectPoints:i,clear:s}=Sg({name:t,fields:o});return{onHover:(0,gg.useCallback)(e=>{if(!e)return void s();const t={};for(const n of o){const o=e[n];void 0!==o&&(t[n]=[o])}St(t)&&i(t)},[o,i,s]),predicate:n,isActive:r}}function Mg(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function _g(e){const{name:t,xField:o,yField:n}=e,{predicate:r,isActive:i,selectInterval:s,clear:a}=Sg({name:t,fields:[o,n].filter(Boolean)}),l=o&&n?"xyBrush":o?"xBrush":"yBrush",c=(0,gg.useCallback)(e=>{if(!e)return void a();const t={};"xyBrush"===l&&function(e){return 2===e.length&&Array.isArray(e[0])&&2===e[0].length&&Array.isArray(e[1])&&2===e[1].length}(e)?(o&&(t[o]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),n&&(t[n]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===l&&Mg(e)?o&&(t[o]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]):"yBrush"===l&&Mg(e)&&n&&(t[n]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]),St(t)&&s(t)},[l,o,n,s,a]);return{brushInteraction:(0,gg.useMemo)(()=>({brush:l,during:c,end:c}),[l,c]),predicate:r,isActive:i,clear:a}}function Pg(e,t,o){const n=wg(e=>e.selections.get(t));return(0,gg.useMemo)(()=>{if(!n||0===n.clauses.size)return e;const t=bg(n,o);return e.filter(t)},[e,n,o])}var Rg=d(require("react"));function jg(e,t=":root"){const o=[];return o.push(` --semiotic-bg: ${e.colors.background};`),o.push(` --semiotic-text: ${e.colors.text};`),o.push(` --semiotic-text-secondary: ${e.colors.textSecondary};`),o.push(` --semiotic-grid: ${e.colors.grid};`),o.push(` --semiotic-border: ${e.colors.border};`),o.push(` --semiotic-primary: ${e.colors.primary};`),o.push(` --semiotic-font-family: ${e.typography.fontFamily};`),e.colors.focus&&o.push(` --semiotic-focus: ${e.colors.focus};`),e.colors.selection&&o.push(` --semiotic-selection-color: ${e.colors.selection};`),null!=e.colors.selectionOpacity&&o.push(` --semiotic-selection-opacity: ${e.colors.selectionOpacity};`),e.colors.diverging&&o.push(` --semiotic-diverging: ${e.colors.diverging};`),e.tooltip?.background&&o.push(` --semiotic-tooltip-bg: ${e.tooltip.background};`),e.tooltip?.text&&o.push(` --semiotic-tooltip-text: ${e.tooltip.text};`),e.tooltip?.borderRadius&&o.push(` --semiotic-tooltip-radius: ${e.tooltip.borderRadius};`),e.tooltip?.fontSize&&o.push(` --semiotic-tooltip-font-size: ${e.tooltip.fontSize};`),e.tooltip?.shadow&&o.push(` --semiotic-tooltip-shadow: ${e.tooltip.shadow};`),e.borderRadius&&o.push(` --semiotic-border-radius: ${e.borderRadius};`),e.colors.annotation&&o.push(` --semiotic-annotation-color: ${e.colors.annotation};`),null!=e.typography.legendSize&&o.push(` --semiotic-legend-font-size: ${e.typography.legendSize}px;`),null!=e.typography.titleFontSize&&o.push(` --semiotic-title-font-size: ${e.typography.titleFontSize}px;`),null!=e.typography.tickFontFamily&&o.push(` --semiotic-tick-font-family: ${e.typography.tickFontFamily};`),null!=e.typography.tickSize&&o.push(` --semiotic-tick-font-size: ${e.typography.tickSize}px;`),null!=e.typography.labelSize&&o.push(` --semiotic-axis-label-font-size: ${e.typography.labelSize}px;`),o.push(` --semiotic-secondary: ${e.colors.secondary||e.colors.primary};`),o.push(` --semiotic-surface: ${e.colors.surface||e.colors.background};`),e.colors.success&&o.push(` --semiotic-success: ${e.colors.success};`),e.colors.danger&&o.push(` --semiotic-danger: ${e.colors.danger};`),e.colors.warning&&o.push(` --semiotic-warning: ${e.colors.warning};`),e.colors.error&&o.push(` --semiotic-error: ${e.colors.error};`),e.colors.info&&o.push(` --semiotic-info: ${e.colors.info};`),`${t} {\n${o.join("\n")}\n}`}function Lg(e){return{semiotic:{bg:{$value:e.colors.background,$type:"color"},text:{$value:e.colors.text,$type:"color"},"text-secondary":{$value:e.colors.textSecondary,$type:"color"},grid:{$value:e.colors.grid,$type:"color"},border:{$value:e.colors.border,$type:"color"},primary:{$value:e.colors.primary,$type:"color"},focus:{$value:e.colors.focus||e.colors.primary,$type:"color"},"font-family":{$value:e.typography.fontFamily,$type:"fontFamily"},"border-radius":{$value:e.borderRadius||"8px",$type:"dimension"},tooltip:{bg:{$value:e.tooltip?.background||e.colors.background,$type:"color"},text:{$value:e.tooltip?.text||e.colors.text,$type:"color"},radius:{$value:e.tooltip?.borderRadius||"6px",$type:"dimension"},"font-size":{$value:e.tooltip?.fontSize||"14px",$type:"dimension"},shadow:{$value:e.tooltip?.shadow||"0 2px 8px rgba(0,0,0,0.15)",$type:"shadow"}},selection:{color:{$value:e.colors.selection||e.colors.primary,$type:"color"},opacity:{$value:e.colors.selectionOpacity??.2,$type:"number"}},categorical:{$value:e.colors.categorical,$type:"color",$description:"Categorical color palette"},sequential:{$value:e.colors.sequential,$type:"string",$description:"d3-scale-chromatic sequential scheme name"},...e.colors.diverging?{diverging:{$value:e.colors.diverging,$type:"string",$description:"d3-scale-chromatic diverging scheme name"}}:{},...e.colors.annotation?{"annotation-color":{$value:e.colors.annotation,$type:"color"}}:{},...null!=e.typography.legendSize?{"legend-font-size":{$value:e.typography.legendSize+"px",$type:"dimension"}}:{},...null!=e.typography.titleFontSize?{"title-font-size":{$value:e.typography.titleFontSize+"px",$type:"dimension"}}:{},...null!=e.typography.tickFontFamily?{"tick-font-family":{$value:e.typography.tickFontFamily,$type:"fontFamily"}}:{},...null!=e.typography.tickSize?{"tick-font-size":{$value:e.typography.tickSize+"px",$type:"dimension"}}:{},...null!=e.typography.labelSize?{"axis-label-font-size":{$value:e.typography.labelSize+"px",$type:"dimension"}}:{},secondary:{$value:e.colors.secondary||e.colors.primary,$type:"color"},surface:{$value:e.colors.surface||e.colors.background,$type:"color"},...e.colors.success?{success:{$value:e.colors.success,$type:"color"}}:{},...e.colors.danger?{danger:{$value:e.colors.danger,$type:"color"}}:{},...e.colors.warning?{warning:{$value:e.colors.warning,$type:"color"}}:{},...e.colors.error?{error:{$value:e.colors.error,$type:"color"}}:{},...e.colors.info?{info:{$value:e.colors.info,$type:"color"}}:{}}}}var Tg=["#6929c4","#1192e8","#005d5d","#9f1853","#fa4d56","#570408","#198038","#002d9c","#ee538b","#b28600","#009d9a","#012749","#8a3800","#a56eff"],Ig={danger:"#da1e28",warning:"#f1c21b",success:"#24a148",info:"#0043ce"},$g={light:_t,dark:Pt,"high-contrast":Rt,pastels:{mode:"light",colors:{primary:"#c9a0dc",secondary:"#b8a8c8",categorical:["#f0a0c0","#88d4ab","#b0a0e8","#f0c888"],sequential:"purples",background:"#fdf6f0",surface:"#fff5ee",text:"#4a3728",textSecondary:"#7a644a",grid:"#e8d5c4",border:"#e8d5c4",focus:"#8a5fae",annotation:"#8a5fae",success:"#9ad4a3",danger:"#e8869a",warning:"#f0c888",error:"#c86070",info:"#9cb8e0"},typography:{fontFamily:"Inter, system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#fff5ee",text:"#4a3728",borderRadius:"8px",shadow:"0 2px 8px rgba(0, 0, 0, 0.12)"},borderRadius:"10px"},"pastels-dark":{mode:"dark",colors:{primary:"#c9a0dc",secondary:"#a899c0",categorical:["#f0a0c0","#88d4ab","#b0a0e8","#f0c888"],sequential:"purples",background:"#1a1525",surface:"#251e35",text:"#e8ddf0",textSecondary:"#a899c0",grid:"#3d3455",border:"#3d3455",focus:"#c9a0dc",annotation:"#c9a0dc",success:"#88d4ab",danger:"#f0a0c0",warning:"#f0c888",error:"#e87690",info:"#9cb8e0"},typography:{fontFamily:"Inter, system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#251e35",text:"#e8ddf0",borderRadius:"8px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"10px"},"bi-tool":{mode:"light",colors:{primary:"#2563eb",secondary:"#6b7280",categorical:["#2563eb","#0d9488","#ea580c","#6b7280"],sequential:"blues",background:"#f5f6f8",surface:"#ffffff",text:"#2c3e50",textSecondary:"#64717f",grid:"#d8dce3",border:"#d8dce3",focus:"#2563eb",annotation:"#2563eb",success:"#10b981",danger:"#ef4444",warning:"#f59e0b",error:"#dc2626",info:"#2563eb"},typography:{fontFamily:"'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#ffffff",text:"#2c3e50",borderRadius:"6px",shadow:"0 2px 8px rgba(0, 0, 0, 0.12)"},borderRadius:"8px"},"bi-tool-dark":{mode:"dark",colors:{primary:"#3b82f6",secondary:"#9ca3af",categorical:["#3b82f6","#14b8a6","#f97316","#9ca3af"],sequential:"blues",background:"#111827",surface:"#1f2937",text:"#f3f4f6",textSecondary:"#9ca3af",grid:"#374151",border:"#374151",focus:"#3b82f6",annotation:"#3b82f6",success:"#34d399",danger:"#f87171",warning:"#fbbf24",error:"#ef4444",info:"#60a5fa"},typography:{fontFamily:"'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#1f2937",text:"#f3f4f6",borderRadius:"6px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"8px"},italian:{mode:"light",colors:{primary:"#cc0000",secondary:"#666666",categorical:["#cc0000","#333333","#c8a415","#4682b4"],sequential:"reds",background:"#fafafa",surface:"#ffffff",text:"#1a1a1a",textSecondary:"#666666",grid:"#e0e0e0",border:"#e0e0e0",focus:"#cc0000",annotation:"#cc0000",success:"#556b2f",danger:"#cc0000",warning:"#c8a415",error:"#8b0000",info:"#4682b4"},typography:{fontFamily:"'Helvetica Neue', Helvetica, Arial, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#ffffff",text:"#1a1a1a",borderRadius:"2px",shadow:"0 2px 4px rgba(0, 0, 0, 0.15)"},borderRadius:"2px"},"italian-dark":{mode:"dark",colors:{primary:"#ff3333",secondary:"#aaaaaa",categorical:["#ff3333","#aaaaaa","#d4a843","#6aa4d4"],sequential:"reds",background:"#0a0a0a",surface:"#1a1a1a",text:"#f5f5f5",textSecondary:"#aaaaaa",grid:"#333333",border:"#333333",focus:"#ff3333",annotation:"#ff3333",success:"#7a8b5a",danger:"#ff3333",warning:"#d4a843",error:"#cc0000",info:"#6aa4d4"},typography:{fontFamily:"'Helvetica Neue', Helvetica, Arial, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#1a1a1a",text:"#f5f5f5",borderRadius:"2px",shadow:"0 2px 8px rgba(0, 0, 0, 0.5)"},borderRadius:"2px"},tufte:{mode:"light",colors:{primary:"#8b0000",secondary:"#555555",categorical:["#8b4513","#556b2f","#4a5568","#800020"],sequential:"oranges",background:"#fffff8",surface:"#fffff8",text:"#111111",textSecondary:"#555555",grid:"#e0ddd0",border:"#e0ddd0",focus:"#8b0000",annotation:"#8b0000",success:"#556b2f",danger:"#8b0000",warning:"#b88700",error:"#6b0000",info:"#4a5568"},typography:{fontFamily:"Georgia, 'Times New Roman', serif",titleSize:16,labelSize:12,tickSize:12,tickFontFamily:"'Courier New', Courier, monospace",legendSize:11},tooltip:{background:"#fffff8",text:"#111111",borderRadius:"2px",shadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},borderRadius:"0px"},"tufte-dark":{mode:"dark",colors:{primary:"#c05050",secondary:"#a09880",categorical:["#c08050","#7a8b5a","#8090a0","#a05060"],sequential:"oranges",background:"#1c1b18",surface:"#262520",text:"#e8e4d8",textSecondary:"#a09880",grid:"#3d3c35",border:"#3d3c35",focus:"#c05050",annotation:"#d06a6a",success:"#7a8b5a",danger:"#c05050",warning:"#c8a060",error:"#a04040",info:"#8090a0"},typography:{fontFamily:"Georgia, 'Times New Roman', serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#262520",text:"#e8e4d8",borderRadius:"2px",shadow:"0 2px 6px rgba(0, 0, 0, 0.4)"},borderRadius:"0px"},journalist:{mode:"light",colors:{primary:"#e45050",secondary:"#666666",categorical:["#3a86c8","#e45050","#d4a843","#888888"],sequential:"blues",background:"#ffffff",surface:"#f8f8f8",text:"#222222",textSecondary:"#666666",grid:"#d4d4d4",border:"#d4d4d4",focus:"#e45050",annotation:"#c63b3b",success:"#2d7a3d",danger:"#c8303a",warning:"#d4a843",error:"#a02028",info:"#3a86c8"},typography:{fontFamily:"'Franklin Gothic Medium', 'Libre Franklin', Arial, sans-serif",titleSize:18,labelSize:12,tickSize:12,tickFontFamily:"'Courier New', Courier, monospace",legendSize:11},tooltip:{background:"#f8f8f8",text:"#222222",borderRadius:"4px",shadow:"0 2px 6px rgba(0, 0, 0, 0.12)"},borderRadius:"4px"},"journalist-dark":{mode:"dark",colors:{primary:"#ff6b6b",secondary:"#a0a0a0",categorical:["#5a9fd8","#ff6b6b","#e0c060","#aaaaaa"],sequential:"blues",background:"#141414",surface:"#1e1e1e",text:"#ededed",textSecondary:"#a0a0a0",grid:"#383838",border:"#383838",focus:"#ff6b6b",annotation:"#ff6b6b",success:"#6fba78",danger:"#ff6b6b",warning:"#e0c060",error:"#d04040",info:"#5a9fd8"},typography:{fontFamily:"'Franklin Gothic Medium', 'Libre Franklin', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#1e1e1e",text:"#ededed",borderRadius:"4px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"4px"},playful:{mode:"light",colors:{primary:"#8b5cf6",secondary:"#7c5a9e",categorical:["#8b5cf6","#ec4899","#06b6d4","#84cc16"],sequential:"viridis",background:"#fdf8ff",surface:"#ffffff",text:"#2d1b4e",textSecondary:"#7c5a9e",grid:"#e8d0f8",border:"#e8d0f8",focus:"#8b5cf6",annotation:"#7a47e8",success:"#10d870",danger:"#ff4b6e",warning:"#ffaa33",error:"#e11d48",info:"#06b6d4"},typography:{fontFamily:"'Nunito', 'Poppins', system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#ffffff",text:"#2d1b4e",borderRadius:"12px",shadow:"0 4px 12px rgba(139, 92, 246, 0.15)"},borderRadius:"12px"},"playful-dark":{mode:"dark",colors:{primary:"#a78bfa",secondary:"#b8a0d8",categorical:["#a78bfa","#f472b6","#22d3ee","#a3e635"],sequential:"viridis",background:"#150a28",surface:"#1f1138",text:"#f0e8ff",textSecondary:"#b8a0d8",grid:"#3a2560",border:"#3a2560",focus:"#a78bfa",annotation:"#a78bfa",success:"#4ade80",danger:"#fb7185",warning:"#fbbf24",error:"#f43f5e",info:"#22d3ee"},typography:{fontFamily:"'Nunito', 'Poppins', system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#1f1138",text:"#f0e8ff",borderRadius:"12px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"12px"},carbon:{mode:"light",colors:{primary:"#0f62fe",secondary:"#525252",categorical:["#6929c4","#1192e8","#005d5d","#9f1853"],sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#161616",textSecondary:"#525252",grid:"#e0e0e0",border:"#e0e0e0",focus:"#0f62fe",annotation:"#0f62fe",success:"#24a148",danger:"#da1e28",warning:"#f1c21b",error:"#a2191f",info:"#0043ce"},typography:{fontFamily:"'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#ffffff",text:"#161616",borderRadius:"2px",shadow:"0 2px 6px rgba(0, 0, 0, 0.2)"},borderRadius:"0px"},"carbon-dark":{mode:"dark",colors:{primary:"#4589ff",secondary:"#a8a8a8",categorical:["#a56eff","#33b1ff","#08bdba","#ff7eb6"],sequential:"blues",diverging:"RdBu",background:"#161616",surface:"#262626",text:"#f4f4f4",textSecondary:"#a8a8a8",grid:"#393939",border:"#393939",focus:"#4589ff",annotation:"#4589ff",success:"#42be65",danger:"#fa4d56",warning:"#f1c21b",error:"#da1e28",info:"#4589ff"},typography:{fontFamily:"'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#262626",text:"#f4f4f4",borderRadius:"2px",shadow:"0 4px 12px rgba(0, 0, 0, 0.5)"},borderRadius:"0px"}};function Ng(e){return $g[e]}var Dg=require("react/jsx-runtime"),Eg=Rg.createContext(void 0),Og="undefined"==typeof window?Rg.useEffect:Rg.useLayoutEffect;function Bg(e){if("string"!=typeof e)return e;if("light"===e||"dark"===e||"high-contrast"===e)return e;return Ng(e)||(void 0!==console&&console.warn(`[ThemeProvider] Unknown theme preset "${e}". Falling back to light theme.`),"light")}function Fg({theme:e}){const t=Tt(e=>e.setTheme),o=Tt(e=>e.theme),n=Rg.useRef(o);n.current=o;const r=Rg.useRef(null);Rg.useEffect(()=>{if(void 0!==e)return;if("undefined"==typeof window||!window.matchMedia)return;const o=window.matchMedia("(forced-colors: active)");return o.matches&&(r.current=n.current===Rt?_t:n.current,t("high-contrast")),Vc(o,e=>{e.matches?(r.current=n.current===Rt?r.current??_t:n.current,t("high-contrast")):(function(e,t){e(t===_t?"light":t===Pt?"dark":t===Rt?"high-contrast":t)}(t,r.current??_t),r.current=null)})},[e,t]);const i=Rg.useRef(!1);return Og(()=>{i.current?void 0!==e&&t(Bg(e)):i.current=!0},[e,t]),null}function zg({children:e}){const t=Tt(e=>e.theme),o={position:"relative","--semiotic-bg":t.colors.background,"--semiotic-text":t.colors.text,"--semiotic-text-secondary":t.colors.textSecondary,"--semiotic-grid":t.colors.grid,"--semiotic-border":t.colors.border,"--semiotic-cell-border":t.colors.cellBorder||t.colors.border,"--semiotic-primary":t.colors.primary,"--semiotic-font-family":t.typography.fontFamily,...t.colors.focus?{"--semiotic-focus":t.colors.focus}:{},...t.tooltip?.background?{"--semiotic-tooltip-bg":t.tooltip.background}:{},...t.tooltip?.text?{"--semiotic-tooltip-text":t.tooltip.text}:{},...t.tooltip?.borderRadius?{"--semiotic-tooltip-radius":t.tooltip.borderRadius}:{},...t.tooltip?.fontSize?{"--semiotic-tooltip-font-size":t.tooltip.fontSize}:{},...t.tooltip?.shadow?{"--semiotic-tooltip-shadow":t.tooltip.shadow}:{},...t.borderRadius?{"--semiotic-border-radius":t.borderRadius}:{},...t.colors.selection?{"--semiotic-selection-color":t.colors.selection}:{},...null!=t.colors.selectionOpacity?{"--semiotic-selection-opacity":t.colors.selectionOpacity+""}:{},...t.colors.diverging?{"--semiotic-diverging":t.colors.diverging}:{},...t.colors.annotation?{"--semiotic-annotation-color":t.colors.annotation}:{},...null!=t.typography.legendSize?{"--semiotic-legend-font-size":t.typography.legendSize+"px"}:{},...null!=t.typography.titleFontSize?{"--semiotic-title-font-size":t.typography.titleFontSize+"px"}:{},...null!=t.typography.tickFontFamily?{"--semiotic-tick-font-family":t.typography.tickFontFamily}:{},...null!=t.typography.tickSize?{"--semiotic-tick-font-size":t.typography.tickSize+"px"}:{},...null!=t.typography.labelSize?{"--semiotic-axis-label-font-size":t.typography.labelSize+"px"}:{},"--semiotic-secondary":t.colors.secondary||t.colors.primary,"--semiotic-surface":t.colors.surface||t.colors.background,...t.colors.success?{"--semiotic-success":t.colors.success}:{},...t.colors.danger?{"--semiotic-danger":t.colors.danger}:{},...t.colors.warning?{"--semiotic-warning":t.colors.warning}:{},...t.colors.error?{"--semiotic-error":t.colors.error}:{},...t.colors.info?{"--semiotic-info":t.colors.info}:{}},n=Rg.useContext(Eg),r={};return n&&(r["data-semiotic-theme"]=n),(0,Dg.jsx)("div",{style:o,...r,children:e})}function Hg({theme:e,children:t}){const o="string"==typeof e&&Ng(e)?e:void 0,n=Rg.useMemo(()=>function(e){return void 0!==e?jt(_t,Bg(e)):"undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(forced-colors: active)").matches?Rt:_t}(e),[e]);return(0,Dg.jsx)(Lt,{initialState:{theme:n},children:(0,Dg.jsxs)(Eg.Provider,{value:o,children:[(0,Dg.jsx)(Fg,{theme:e}),(0,Dg.jsx)(zg,{children:t})]})})}function Wg(){return Tt(e=>e.theme)}function qg(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function Yg(e,t){const{when:o}=e,n=t.width,r=t.height,i=function(e){if("number"==typeof e.height&&e.height>0)return e.width/e.height}(t),s=function(e){if("number"==typeof e.height&&e.height>0)return e.height>e.width?"portrait":"landscape"}(t);return!("number"==typeof o.minWidth&&o.minWidth>n||"number"==typeof o.maxWidth&&n>o.maxWidth||"number"==typeof o.minHeight&&("number"!=typeof r||o.minHeight>r)||"number"==typeof o.maxHeight&&("number"!=typeof r||r>o.maxHeight)||"number"==typeof o.minAspectRatio&&("number"!=typeof i||o.minAspectRatio>i)||"number"==typeof o.maxAspectRatio&&("number"!=typeof i||i>o.maxAspectRatio)||o.orientation&&s!==o.orientation)}function Gg(e,t,o=e.responsiveRules){if(!Array.isArray(o)||0===o.length)return{props:e,matches:[]};const n=o.map((e,t)=>({rule:e,index:t})).filter(e=>Yg(e.rule,t)).sort((e,t)=>("number"==typeof e.rule.priority?e.rule.priority:e.index)-("number"==typeof t.rule.priority?t.rule.priority:t.index));return{props:n.reduce((e,t)=>function(e,t){const o={...e,...t};for(const n of["margin","frameProps","mobileSemantics","style"])qg(e[n])&&qg(t[n])&&(o[n]={...e[n],...t[n]});return"string"==typeof e.className&&"string"==typeof t.className&&(o.className=`${e.className} ${t.className}`),o}(e,t.rule.transform),e),matches:n}}var Vg=44,Xg={enabled:!0,tapToSelect:!0,tapToLockTooltip:!0,clearSelection:"backgroundTap",targetSize:Vg,snap:"nearestDatum",brushHandleSize:Vg,standardControls:!1,enabled:!1,tapToSelect:!1,tapToLockTooltip:!1};function Ug(e,t={}){const o=t.mobileSemantics?.interaction,n="number"==typeof o?.targetSize?o.targetSize:"number"==typeof t.mobileSemantics?.minimumHitTarget?t.mobileSemantics.minimumHitTarget:void 0,r="mobile"===t.mode||"number"==typeof t.width&&480>=t.width,i=!!o||void 0!==n,s=e&&"object"==typeof e?e:void 0;if(!1===e||!1===s?.enabled||void 0===e&&!r&&!i)return Xg;const a=s??{};return{enabled:!0,tapToSelect:a.tapToSelect??!0,tapToLockTooltip:a.tapToLockTooltip??!0,clearSelection:a.clearSelection??"backgroundTap",targetSize:a.targetSize??n??Vg,snap:a.snap??"nearestDatum",brushHandleSize:a.brushHandleSize??Vg,standardControls:a.standardControls??!1}}var Kg={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}}},Qg={top:10,bottom:10,left:10,right:10};function Zg(e){return e.compactMode?e.marginDefaults:Qg}function Jg(e,t,o){if(!1!==t)return e;const n={...e};return"horizontal"===o?n.left=Math.min(n.left,15):n.bottom=Math.min(n.bottom,15),n}function ey(e,t,o){const n=e.xValue??t?.[o];if(null==n)return null;const r=Number(n);return Number.isFinite(r)?r:null}function ty(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 oy(e){if(!e)return!1;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}var ny=require("react"),ry=require("react"),iy=require("react");function sy(e={}){const{limit:t=50,types:o,chartId:n}=e,r=Us(e=>e.version),i=Us(e=>e.observations),s=Us(e=>e.clearObservations),a=(0,iy.useMemo)(()=>{let e=i;if(o&&o.length>0){const t=new Set(o);e=e.filter(e=>t.has(e.type))}return n&&(e=e.filter(e=>e.chartId===n)),e.length>t&&(e=e.slice(e.length-t)),e},[i,o,n,t,r]);return{observations:a,latest:a.length>0?a[a.length-1]:null,clear:s}}var ay=require("react/jsx-runtime"),ly=(0,ry.createContext)(!1),cy=(0,ry.createContext)(!1);function uy(){return(0,ry.useContext)(cy)}var dy=(0,ry.createContext)(null),hy="undefined"==typeof window?ry.useEffect:ry.useLayoutEffect;function fy(e){const t=new Set,o=[];for(const n of e)t.has(n)||(t.add(n),o.push(n));return o}function my(e,t){if(e.length!==t.length)return!1;for(let o=0;e.length>o;o++)if(e[o]!==t[o])return!1;return!0}function py(e){const t=(0,ry.useContext)(dy),o=(0,ry.useId)(),n=fy(e),r=(0,ry.useRef)([]);my(r.current,n)||(r.current=n);const i=r.current;hy(()=>{if(t)return()=>t.unregisterCategories(o)},[t,o]),hy(()=>{t&&t.registerCategories(o,i)},[t,o,i])}var gy="__linked-legend-isolate__",yy="__linked-legend-highlight__";function by({categoryColors:e,interaction:t,selectionName:o,field:n}){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}=Sg({name:o,fields:[n],clientId:gy}),{selectPoints:c,clear:u}=Sg({name:o,fields:[n],clientId:yy}),d=wg(e=>e.selections.get(o)),{isolatedCategories:h,highlightedCategory:f}=(0,ry.useMemo)(()=>{const e=new Set;let t=null;const o=d?.clauses.get(gy)?.fields[n];if("point"===o?.type)for(const t of o.values)e.add(t+"");const r=d?.clauses.get(yy)?.fields[n];if("point"===r?.type){const e=r.values.values().next().value;null!=e&&(t=e+"")}return{isolatedCategories:e,highlightedCategory:t}},[d,n]),m=(0,ry.useCallback)(e=>{"highlight"===t&&(e?c({[n]:[e.label]}):u())},[t,n,c,u]),p=(0,ry.useCallback)(e=>{if("isolate"!==t)return;const o=new Set(h);o.has(e.label)?o.delete(e.label):o.add(e.label),0===o.size||o.size===i.length?l():a({[n]:Array.from(o)})},[t,n,h,i.length,a,l]),[g,[y]]=Uc([0,0],!0,!1),b=(0,ry.useMemo)(()=>function(e,t){if(!t||0===e.length)return 1;let o=0,n=1;for(const r of e){const e=26+7*r.length;o>0&&o+e>t&&(n++,o=0),o+=e}return n}(r.map(([e])=>e),y),[r,y]);return 0===r.length?null:(0,ay.jsx)("div",{ref:g,style:{width:"100%",display:"block"},children:(0,ay.jsx)("svg",{width:"100%",height:Math.max(30,22*b+8),style:{display:"block",overflow:"visible"},children:(0,ay.jsx)(ps,{legendGroups:s,title:!1,orientation:"horizontal",width:y,height:20,customHoverBehavior:"highlight"===t?m:void 0,customClickBehavior:"isolate"===t?p:void 0,highlightedCategory:f,isolatedCategories:h})})})}function vy({children:e,selections:t,showLegend:o,legendPosition:n="top",legendInteraction:r="none",legendSelectionName:i="legend",legendField:s="category"}){const a=(0,ry.useMemo)(()=>{if(!t)return;const e=new Map;for(const[o,n]of Object.entries(t))n.resolution&&e.set(o,{name:o,resolution:n.resolution,clauses:new Map});return e.size>0?{selections:e}:void 0},[t]),l=hg(),[c,u]=(0,ry.useState)({}),d=(0,ry.useRef)({}),h=(0,ry.useMemo)(()=>({registerCategories:(e,t)=>{const o=fy(t);u(t=>my(t[e]??[],o)?t:{...t,[e]:o})},unregisterCategories:e=>{u(t=>{if(!(e in t))return t;const o={...t};return delete o[e],o})}}),[]),f=(0,ry.useMemo)(()=>{const e=[];for(const t of Object.values(c))for(const o of t)e.push(o);return fy(e)},[c]),m=(0,ry.useMemo)(()=>{const e=l??{},t=d.current;let o=Object.keys(e).length+Object.keys(t).length;for(const n of f)e[n]||t[n]||(t[n]=go[o%go.length],o++);const n={...e};for(const o of f)n[o]=e[o]??t[o];return n},[l,f]),p=void 0===o||o,g=Object.keys(m).length>0;return(0,ay.jsx)(kg,{initialState:a,children:(0,ay.jsx)(Xs,{children:(0,ay.jsx)(cy.Provider,{value:!0,children:(0,ay.jsx)(dy.Provider,{value:h,children:(0,ay.jsx)(dg,{colors:m,children:(0,ay.jsxs)(ly.Provider,{value:p&&g,children:[p&&"top"===n&&(0,ay.jsx)(by,{categoryColors:m,interaction:r,selectionName:i,field:s}),e,p&&"bottom"===n&&(0,ay.jsx)(by,{categoryColors:m,interaction:r,selectionName:i,field:s})]})})})})})})}function xy({data:e,colorBy:t,colorScale:o,getColor:n,strokeColor:r,strokeWidth:i,categories:s}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",o={fill:t,stroke:t};return void 0!==r&&(o.stroke=r),void 0!==i&&(o.strokeWidth=i),o},type:"fill",items:(s&&s.length>0?s:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((r,i)=>{const s=e.find("function"==typeof t?e=>t(e)===r:e=>e[t]===r),a=s?n(s,t,o):o?o(r):vo[i%vo.length];return{label:r+"",color:a}}),label:""}]}}function ky(e,t){if(!t)return[];const o=new Set;for(const n of e){const e="function"==typeof t?t(n):n[t];null!=e&&o.add(e+"")}return Array.from(o)}function wy({data:e,colorBy:t,colorScale:o,showLegend:n,legendPosition:r="right",userMargin:i,defaults:s={top:50,bottom:60,left:70,right:40},categories:a,additionalLegend:l,chartWidth:c,legendLayout:u,hasTitle:d=!1,axisChrome:h}){const f=(0,ry.useContext)(ly),m=null!==(0,ry.useContext)(dy),p=void 0!==n?n:!f&&!!t,g=!!t&&(p||m),y=(0,ny.useMemo)(()=>g?void 0!==a?a:ky(e,t):[],[a,t,e,g]);py(m&&t?y:[]);const b=(0,ny.useMemo)(()=>{if(!p||!t)return;const n=xy({data:e,colorBy:t,colorScale:o,getColor:wo,categories:y});return 0!==n.legendGroups.reduce((e,t)=>e+t.items.length,0)?n:void 0},[p,t,e,o,y]),v=(0,ny.useMemo)(()=>Bi(b,l),[b,l]),{hasAxis:x,hasAxisLabel:k,rotatedTicks:w}=h??{},S=(0,ny.useMemo)(()=>{const e="number"==typeof i?{top:i,bottom:i,left:i,right:i}:i??{},t=t=>{const o=e[t];return"number"==typeof o?o:s[t]},o={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},n=t=>"number"==typeof e[t];if(v){const e=function(e,t){return Ui(e,t)+Ki(e)+Qi(t)}(v,u),t=void 0===x?{hasAxis:!0,hasAxisLabel:!0}:{hasAxis:x,hasAxisLabel:k,rotatedTicks:w},i=rs(v,Math.max(1,(c??600)-o.left-o.right),u)+Ki(v)+ts("bottom"===r?t:void 0,u)+("top"===r&&d?24:0);"right"===r&&!n("right")&&e>o.right?o.right=e:"left"===r&&!n("left")&&e>o.left?o.left=e:"top"!==r||n("top")?"bottom"!==r||n("bottom")||(o.bottom=Math.max(o.bottom,80,i)):o.top=Math.max(o.top,50,i)}return o},[s,i,v,r,c,u,d,x,k,w]);return{legend:v,margin:S,legendPosition:r}}function Sy(e,t,o){const[n,r]=(0,ny.useState)(null),[i,s]=(0,ny.useState)(new Set),a=(0,ny.useMemo)(()=>new Set,[]),l=(0,ny.useCallback)(t=>{"highlight"===e&&r(t?t.label:null)},[e]),c=(0,ny.useCallback)(t=>{"isolate"===e&&s(e=>{const n=new Set(e);return n.has(t.label)?n.delete(t.label):n.add(t.label),n.size===o.length?new Set:n})},[e,o.length]),u=(0,ny.useMemo)(()=>{if(!e||"none"===e||!t)return null;const o="string"==typeof t?t:null;return"highlight"===e&&null!=n?{isActive:!0,predicate:e=>{const r=o?e[o]:"function"==typeof t?t(e):null;return("string"==typeof r?r:(r??"")+"")===n}}:"isolate"===e&&i.size>0?{isActive:!0,predicate:e=>{const n=o?e[o]:"function"==typeof t?t(e):null;return i.has("string"==typeof n?n:(n??"")+"")}}:null},[e,t,n,i]);return{highlightedCategory:"highlight"===e?n:null,isolatedCategories:"isolate"===e?i:a,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}var Ay=[];function Cy(){const e=Wg(),t=e?.colors?.categorical;return t&&t.length>0?t:void 0}function My(e,t,o,n,r){if(e)return e;if(o&&"object"==typeof o&&!Array.isArray(o)){const e=So(o,n);if(e)return e}let i;if(Array.isArray(o))i=o;else if(t&&t.length>0)i=t;else if("string"==typeof o){const e=po[o];Array.isArray(e)&&(i=e)}return i&&0!==i.length?null!=n?(r.has(n)||r.set(n,r.size),i[r.get(n)%i.length]):i[0]:yo}function _y(e,t,o){const n=hg(),r=Cy();return(0,ag.useMemo)(()=>{if(!t)return;const i=n??void 0,s=o??(r&&r.length>0?r:void 0)??"category10";if(0!==e.length){if("function"==typeof t){const o=Array.from(new Set(e.map(e=>t(e)+"")));if(i&&oy(i)){const e=Ao(o.map(e=>({_cat:e})),"_cat",s);return t=>i[t]||e(t)}return Ao(o.map(e=>({_cat:e})),"_cat",s)}if(i&&oy(i)){const o=Ao(e,t,s);return e=>i[e]||o(e)}return Ao(e,t,s)}if(i&&oy(i)){const e=Ao([{_:"a"}],"_",s);return t=>i[t]||e(t)}},[e,t,o,n,r])}function Py(e,t,o){return(0,ag.useMemo)(()=>{if(!t||"auto"===t||"function"==typeof t)return e;const n=[...e],r="function"==typeof(i=o)?i:e=>e[i];var i;return n.sort("asc"===t?(e,t)=>r(e)-r(t):(e,t)=>r(t)-r(e))},[e,t,o])}function Ry({selection:e,linkedHover:t,fallbackFields:o=Ay,unwrapData:n=!1,onObservation:r,chartType:i,chartId:s,onClick:a,hoverHighlight:l,colorByField:c,mobileInteraction:u}){const d=(0,ag.useId)(),h=(0,ag.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,o),[t,o]),f=(0,ag.useMemo)(()=>"series"===h?.mode?[h.seriesField||c||o[0]].filter(e=>!!e):h?.fields||o,[h,c,o]),m=Sg({name:e?.name||"__unused__",fields:f}),p=Cg({name:h?.name||"hover",fields:f}),g=Us(e=>e.pushObservation),y=(0,ag.useCallback)(e=>{r?.(e),g?.(e)},[r,g]),b=e?{isActive:m.isActive,predicate:m.predicate}:null,[v,x]=(0,ag.useState)(null),k=(0,ag.useRef)(!1),w=c||o[0],S=(0,ag.useMemo)(()=>{if(!l||null==v||!w)return null;const e=v,t=w;return{isActive:!0,predicate:o=>("string"==typeof o[t]?o[t]:(o[t]??"")+"")===e}},[l,v,w]),A=(0,ag.useCallback)((e,o)=>{const n=!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"===h?.mode&&h.xField){const o=ey(e,t,h.xField);null!=o&&function(e,t,o){const n=ja.positions.get(e);n?.locked||n&&n.xValue===t&&n.sourceId===o||(ja={positions:new Map(ja.positions).set(e,{xValue:t,sourceId:o})},Ta())}(h.name||"hover",o,d)}"x-position"!==h?.mode&&p.onHover(t)}else"x-position"!==h?.mode||n||Ia(h.name||"hover",d),"x-position"===h?.mode||n||p.onHover(null);if(l&&w)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const o=t?.[w];x(null!=o?o+"":null)}else n||x(null);(r||g)&&hd({onObservation:y,datum:e?ty(e):null,x:e?.x,y:e?.y,chartType:i||"unknown",chartId:s,context:o})},[t,p,h,d,r,i,s,g,y,l,w,u]),C=(0,ag.useCallback)((o=!0)=>{k.current=!1,t&&"x-position"!==h?.mode&&p.onHover(null),e&&u?.tapToSelect&&m.clear(),o&&l&&x(null),"x-position"===h?.mode&&($a(h.name||"hover",d),Ia(h.name||"hover",d))},[t,h,p,e,u,m,l,d]),M=(0,ag.useCallback)((o,n)=>{const c=!!u?.enabled&&(u.tapToLockTooltip||u.tapToSelect),b=!!u?.enabled&&"backgroundTap"===u.clearSelection;if("x-position"===h?.mode&&h.xField&&o){let e=o.data||o.datum||o;Array.isArray(e)&&(e=e[0]);const t=ey(o,e,h.xField);null!=t&&function(e,t,o){const n=ja.positions.get(e);if(n?.locked){const t=new Map(ja.positions);return t.delete(e),ja={positions:t},Ta(),!1}ja={positions:new Map(ja.positions).set(e,{xValue:t,sourceId:o,locked:!0})},Ta()}(h.name||"hover",t,d)}if(c)if(o){k.current=!0;const n=ty(o);if(t&&"x-position"!==h?.mode&&p.onHover(n),e&&u?.tapToSelect&&f.length>0){const e={};for(const t of f){const o=n[t];void 0!==o&&(e[t]=[o])}oy(e)&&m.selectPoints(e)}if(l&&w){const e=n?.[w];x(null!=e?e+"":null)}}else b&&C();if(o||b){if(o&&a){let e=o.data||o.datum||o;Array.isArray(e)&&(e=e[0]),a(e,{x:o.x??0,y:o.y??0})}(r||g)&&fd({onObservation:y,datum:o?ty(o):null,x:o?.x,y:o?.y,chartType:i||"unknown",chartId:s,context:n})}},[a,r,g,y,i,s,h,d,u,t,p,e,m,f,l,w,C]);return(0,ag.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,ag.useEffect)(()=>()=>{k.current&&C(!1)},[C]),(0,ag.useEffect)(()=>{if("x-position"!==h?.mode)return;const e=h.name||"hover";return()=>{$a(e,d),Ia(e,d)}},[h?.mode,h?.name,d]),{activeSelectionHook:b,hoverSelectionHook:S,customHoverBehavior:A,customClickBehavior:M,crosshairSourceId:d}}function jy(e,t){const o="object"==typeof e&&null!==e?e:void 0;if("x-position"===o?.mode)return{linkedCrosshairName:o.name||"hover",linkedCrosshairSourceId:t}}function Ly(e,t,o){return function(e,t,o){const n=Kg[e||"primary"],r=e&&"primary"!==e||!o?.width?n.width:o.width,i=e&&"primary"!==e||!o?.height?n.height:o.height,s=Gg({...t,mode:e},{width:t.width??r,height:t.height??i}).props,a=s.mode||e||"primary",l=Kg[a],c="context"===a||"sparkline"===a,u="primary"===a&&o?.width?o.width:l.width;return{mode:a,width:s.width??u,height:s.height??("primary"===a&&o?.height?o.height:l.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:Jg(l.marginDefaults,s.showCategoryTicks,s.orientation),compactMode:c,mobileInteraction:Ug(s.mobileInteraction,{mode:a,width:s.width??u,mobileSemantics:s.mobileSemantics}),mobileSemantics:s.mobileSemantics}}(e,t,o)}function Ty(e,t){const o=e.length,n=t.length,r=Array(n+1);for(let e=0;n>=e;e++)r[e]=e;for(let i=1;o>=i;i++){let o=r[0];r[0]=i;for(let s=1;n>=s;s++){const n=r[s];r[s]=e[i-1]===t[s-1]?o:1+Math.min(o,r[s],r[s-1]),o=n}}return r[n]}function Iy(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:[...e]}function $y(e,t){if(0===t.length)return null;const o=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(o)||o.includes(e.toLowerCase()))||(function(e,t,o=3){let n,r=o+1;for(const o of t){const t=Ty(e.toLowerCase(),o.toLowerCase());r>t&&(r=t,n=o)}return r>o?void 0:n}(e,t,3)??null)}function Ny(e){return` Or use a function: ${e}={d => d.myValue}.`}function Dy({componentName:e,data:t,accessors:o,requiredProps:n}){if(n)for(const[t,o]of Object.entries(n))if(null==o)return`${e}: ${t} is required. Provide a field name or function.`;if(null==t)return null;if(!Array.isArray(t)&&"object"==typeof t)return e+": data should be an array, but received an object. If this is hierarchical data, use TreeDiagram, Treemap, or CirclePack instead.";if(!Array.isArray(t)||0===t.length)return e+": No data provided. Pass a non-empty array to the data prop.";if(o){const n=Iy(t).find(e=>e&&"object"==typeof e);if(n){const t=Object.keys(n);for(const[r,i]of Object.entries(o))if(i&&"string"==typeof i&&!(i in n)){const o=$y(i,t),n=o?` Try ${r}="${o}".`:"";return`${e}: ${r} "${i}" not found in data. Available fields: ${t.join(", ")}.${n}`+Ny(r)}}}return null}function Ey({componentName:e,data:t,dataLabel:o="data"}){return null==t?`${e}: No ${o} provided. Pass a hierarchical object with children: { name: "root", children: [...] }.`:Array.isArray(t)?`${e}: ${o} should be a single root object, not an array. Expected: { name: "root", children: [...] }. If you have flat data, use LineChart, BarChart, or Scatterplot instead.`:null}function Oy({componentName:e,nodes:t,edges:o,nodesRequired:n=!1,edgesRequired:r=!0,accessors:i}){if(null==t&&null==o)return null;if(r&&(!o||!Array.isArray(o)||0===o.length))return e+': No edges provided. Pass a non-empty array: edges={[{ source: "A", target: "B", value: 10 }, ...]}.';if(n&&(!t||!Array.isArray(t)||0===t.length))return e+': No nodes provided. Pass a non-empty array: nodes={[{ id: "A" }, { id: "B" }, ...]}.';if(i&&t&&t.length>0){const o=Iy(t).find(e=>e&&"object"==typeof e);if(o){const t=Object.keys(o);for(const[n,r]of Object.entries(i))if(r&&"string"==typeof r&&!(r in o)){const o=$y(r,t),i=o?` Try ${n}="${o}".`:"";return`${e}: ${n} "${r}" not found in node data. Available fields: ${t.join(", ")}.${i}`+Ny(n)}}}return null}var By=require("react"),Fy=require("react");function zy(e){const t=Tt(e=>e.theme.colors.selectionOpacity);return(0,Fy.useMemo)(()=>{if(void 0!==e||void 0!==t)return{name:e?.name??"",...e,unselectedOpacity:e?.unselectedOpacity??t}},[e,t])}function Hy(e){const{data:t,rawData:o,colorBy:n,colorScheme:r,legendInteraction:i,legendPosition:s,selection:a,linkedHover:l,fallbackFields:c,unwrapData:u=!1,onObservation:d,chartType:h,chartId:f,showLegend:m,legend:p,legendLayout:g,userMargin:y,marginDefaults:b,onClick:v,hoverHighlight:x,mobileInteraction:k,mobileSemantics:w,loading:S,loadingContent:A,emptyContent:C,width:M,height:_,hasTitle:P,axisChrome:R}=e,j=void 0===o,L=(0,By.useMemo)(()=>yt(t),[t]),[T,I]=(0,By.useState)([]),$=(0,By.useCallback)(e=>{I(t=>t.length===e.length&&t.every((t,o)=>t===e[o])?t:e)},[]),N="string"==typeof n?n:void 0,D=(0,By.useMemo)(()=>Ug(k,{width:M,mobileSemantics:w}),[k,M,w]),{activeSelectionHook:E,hoverSelectionHook:O,customHoverBehavior:B,customClickBehavior:F,crosshairSourceId:z}=Ry({selection:a,linkedHover:l,fallbackFields:c,unwrapData:u,onObservation:d,chartType:h,chartId:f,onClick:v,hoverHighlight:x,colorByField:N,mobileInteraction:D}),H=jy(l,z),W=_y(L,n,r),q=(0,By.useMemo)(()=>ky(L,n),[L,n]),Y=(0,By.useMemo)(()=>j&&T.length>0?T:q,[j,T,q]),G=Sy(i,n,Y),V=(0,By.useMemo)(()=>O||(G.legendSelectionHook?G.legendSelectionHook:E),[O,G.legendSelectionHook,E]),X=zy(a),U=Cy(),K=hg(),Q=(0,By.useMemo)(()=>{if(W)return W;if(!n||0===Y.length)return;const e=Array.isArray(r)&&r.length>0||"string"==typeof r&&r.length>0?r:U&&U.length>0?U:vo,t="__streamCat",o=Ao(Y.map(e=>({[t]:e})),t,e);return e=>K?.[e]||o(e)||"#999"},[W,n,Y,r,U,K]),{legend:Z,margin:J,legendPosition:ee}=wy({data:L,colorBy:n,colorScale:Q,showLegend:m,legendPosition:s,userMargin:y,defaults:b,categories:Y,additionalLegend:p,chartWidth:M,legendLayout:g,hasTitle:P,axisChrome:R}),te=(0,By.useMemo)(()=>{const e={};return Z&&(e.legend=Z,e.legendPosition=ee,g&&(e.legendLayout=g)),i&&"none"!==i&&(e.legendHoverBehavior=G.onLegendHover,e.legendClickBehavior=G.onLegendClick,e.legendHighlightedCategory=G.highlightedCategory,e.legendIsolatedCategories=G.isolatedCategories),j&&n&&(e.legendCategoryAccessor=n,e.onCategoriesChange=$),e},[Z,ee,g,i,G.onLegendHover,G.onLegendClick,G.highlightedCategory,G.isolatedCategories,j,n,$]),oe=Array.isArray(o)?yt(o):o,ne=yp(S,M,_,A),re=ne?null:gp(oe,M,_,C);return{data:L,colorScale:W,allCategories:Y,legendState:G,effectiveSelectionHook:V,activeSelectionHook:E,customHoverBehavior:B,customClickBehavior:F,mobileInteraction:D,legend:Z,margin:J,legendPosition:ee,earlyReturn:ne||re||null,legendBehaviorProps:te,crosshairProps:H,resolvedSelection:X}}var Wy=require("react");function qy(e,t){const{variant:o,frameRef:n,overrides:r}=t,i=(0,Wy.useRef)(r);i.current=r,(0,Wy.useImperativeHandle)(e,()=>{const e=function(e,t){if("xy"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>e.current?.remove(t)??[],update:(t,o)=>e.current?.update(t,o)??[],replace:t=>e.current?.replace?.(t),clear:()=>e.current?.clear(),getData:()=>e.current?.getData()??[],getScales:()=>e.current?.getScales()??null,getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}if("network"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>{const o=Array.isArray(t)?t:[t],n=e.current?.getTopology()?.nodes??[],r=[];for(const t of o){const o=n.find(e=>e.id===t);o&&r.push({...o.data??{},id:t}),e.current?.removeNode(t)}return r},update:(t,o)=>(Array.isArray(t)?t:[t]).flatMap(t=>{const n=e.current?.updateNode(t,o);return n?[{...n,id:t}]:[]}),clear:()=>e.current?.clear(),getData:()=>e.current?.getTopology()?.nodes?.map(e=>e.data)??[],getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}if("geo-points"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>e.current?.removePoint(t)??[],update:(t,o)=>{const n=e.current?.removePoint(t)??[];for(const t of n)e.current?.push(o(t));return n},clear:()=>e.current?.clear(),getData:()=>e.current?.getData()??[],getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}const o=t;return{push:e=>o.current?.pushLine(e),pushMany:e=>o.current?.pushManyLines(e),remove:e=>o.current?.removeLine(e)??[],update:(e,t)=>{const n=o.current?.removeLine(e)??[];for(const e of n)o.current?.pushLine(t(e));return n},clear:()=>o.current?.clear(),getData:()=>o.current?.getLines()??[],getCustomLayout:()=>o.current?.getCustomLayout?.()??null,getLayoutFailure:()=>o.current?.getLayoutFailure?.()??null}}(o,n);return new Proxy(e,{get(e,t,o){if("string"==typeof t){const e=i.current?.[t];if("function"==typeof e)return e}return Reflect.get(e,t,o)},has:(e,t)=>!("string"!=typeof t||!i.current||!(t in i.current))||Reflect.has(e,t)})},[])}var Yy=require("react");function Gy(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return e??((...e)=>({}));const o={};return void 0!==t.stroke&&(o.stroke=t.stroke),void 0!==t.strokeWidth&&(o.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(o.opacity=t.opacity),e?(...t)=>({...e(...t)||{},...o}):(...e)=>({...o})}function Vy(e){if(null==e)return()=>{};const t="function"==typeof e?e:t=>t[e];return e=>Ky(t(e))}function Xy(e,t){const o=Vy(e),n=Vy(t);return(e,t)=>{const r=n(e);return{value:r,x:o(e),y:r,category:t}}}function Uy(e,t){const o=Vy(t??"value"),n=null==e?void 0:"function"==typeof e?e:t=>t[e];return e=>{const t=n?n(e):void 0;return{value:o(e),category:null==t?void 0:t+""}}}function Ky(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 Qy(e,t,o){const n=null!=e.axis?o[e.axis]:null!=e.field?t[e.field]:o.value;if(void 0!==e.eq&&n!==e.eq)return!1;if(void 0!==e.ne&&n===e.ne)return!1;if(void 0!==e.in&&!e.in.includes(n))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=Ky(n);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,o]=e.within;if(t>r||r>o)return!1}if(void 0!==e.outside){const[t,o]=e.outside;if(r>=t&&o>=r)return!1}return!0}function Zy(e,t,o){const n=e.when;return void 0===n||!0===n||!1!==n&&("function"==typeof n?n(t,o):Qy(n,t,o))}function Jy(e,t,o){if(!t||0===t.length)return{};let n={};for(const r of t){if(!Zy(r,e,o))continue;const t="function"==typeof r.style?r.style(e,o):r.style;t&&(n={...n,...t})}return n}function eb(e,t,o,n=e=>e){const r=e??(()=>({}));return t&&0!==t.length?(e,i)=>{const s=n(e),a={...r(e,i)};return Object.assign(a,Jy(s,t,o(s,i))),a}:r}function tb(e,t,o){return e&&0!==e.length?(n,r)=>{const i=Jy(n,e,t(n,r)),s=o?o(n,r):void 0;return s?{...i,...s}:i}:o}function ob(e,t,o,n){if(!e||0===e.length)return n;const r=Uy(t,o);return(t,o)=>{const i=t&&t.data||t,s=Jy(i,e,r(i)),a=n?n(t,o):void 0;return a?{...s,...a}:s}}function nb(e,t,o,n){return tb(e,Xy(t,o),n)}function rb(e,t,o){const n=Vy(t);return tb(e,(e,t)=>({value:n(e),category:t}),o)}function ib(e){const{colorBy:t,colorScale:o,color:n,pointRadius:r=5,radiusFn:i,fillOpacity:s=1,fallbackFill:a,baseStyleExtras:l,stroke:c,strokeWidth:u,opacity:d,effectiveSelectionHook:h,resolvedSelection:f,colorDatumAccessor:m,styleRules:p,ruleContext:g}=e,y=(0,Yy.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(o){const n=m?m(e):e;u.fill=wo(n,t,o)}}else u.fill=a?a(e):n||yo;return void 0===u.r&&(u.r=i?i(e):r),p&&p.length>0&&Object.assign(u,Jy(e,p,g?g(e):{value:void 0})),u},[t,o,n,r,i,s,a,l,m,p,g]),b=(0,Yy.useMemo)(()=>Gy(y,{stroke:c,strokeWidth:u,opacity:d}),[y,c,u,d]);return(0,Yy.useMemo)(()=>pg(b,h??null,f),[b,h,f])}var sb=require("react");function ab(e){const{accessor:t,data:o,isPushMode:n}=e,r=(0,sb.useRef)(null),[i,s]=(0,sb.useState)(0),a=(0,sb.useCallback)(e=>{if(!n||!t)return;let o=!1;for(const n of e){const e="function"==typeof t?t(n):n[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,o=!0),i>r.current[1]&&(r.current[1]=i,o=!0)):(r.current=[i,i],o=!0))}o&&s(e=>e+1)},[n,t]),l=(0,sb.useCallback)(()=>{n&&(r.current=null,s(e=>e+1))},[n]);return{domain:(0,sb.useMemo)(()=>{if(n)return r.current??void 0;if(!t||0===o.length)return;const e="function"==typeof t?t:e=>e[t];let i=1/0,s=-1/0;for(const t of o){const o=e(t);if(null==o)continue;const n="number"==typeof o?o:Number(o);Number.isFinite(n)&&(i>n&&(i=n),n>s&&(s=n))}return Number.isFinite(i)&&Number.isFinite(s)?[i,s]:void 0},[o,t,n,i]),trackPushed:a,reset:l}}function lb(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 cb=require("react"),ub="__forecastSegment",db=null;async function hb(){return db||(db=await Promise.resolve().then(()=>(ae(),K))),db}var fb="__semiotic_resolvedX",mb="__semiotic_resolvedY";function pb(e){const{data:t,xAccessor:o,yAccessor:n,forecast:r,anomaly:i,groupBy:s}=e,a="string"==typeof o?o:fb,l="string"==typeof n?n:mb,c=(0,cb.useMemo)(()=>{if(!r&&!i)return t;const e="function"==typeof o,s="function"==typeof n;return e||s?t.map(t=>{const r={...t};return e&&(r[fb]=o(t)),s&&(r[mb]=n(t)),r}):t},[t,r,i,o,n]),[u,d]=(0,cb.useState)(null),[h,f]=(0,cb.useState)([]),m=(0,cb.useRef)(r),p=(0,cb.useRef)(i);return(0,cb.useEffect)(()=>{if(!r&&!i)return void((m.current||p.current)&&(d(null),f([]),m.current=r,p.current=i));let e=!1;const t=r!==m.current||i!==p.current;if(m.current=r,p.current=i,t&&(d(null),f([])),r){const t=s&&"string"==typeof s&&"object"==typeof r?{...r,_groupBy:s}:r;(async function(...e){return(await hb()).buildForecast(...e)})(c,a,l,t,i).then(t=>{e||(d(t),f(t.annotations))}).catch(()=>{e||(d(null),f([]))})}else i&&async function(...e){return(await hb()).buildAnomalyAnnotations(...e)}(i).then(t=>{e||(d(null),f(t))}).catch(()=>{e||f([])});return()=>{e=!0}},[c,r,i,a,l,s]),{effectiveData:u?u.processedData:t,statisticalAnnotations:h,hasForecast:!!u,xAccessorKey:a,yAccessorKey:l}}var gb=require("react/jsx-runtime"),yb=(0,sg.forwardRef)(function(e,t){const o=(0,sg.useRef)(null),n=Ly(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:d,yScaleType:h,colorBy:f,colorScheme:m,styleRules:p,sizeBy:g,sizeRange:y=[3,15],symbolBy:b,symbolMap:v,pointRadius:x=5,pointOpacity:k=.8,tooltip:w,marginalGraphics:S,pointIdAccessor:A,annotations:C,regression:M,forecast:_,anomaly:P,xExtent:R,yExtent:j,frameProps:L={},selection:T,linkedHover:I,linkedBrush:$,onObservation:N,onClick:D,hoverHighlight:E,chartId:O,loading:B,loadingContent:F,emptyContent:z,legendInteraction:H,legendPosition:W,color:q,stroke:Y,strokeWidth:G,opacity:V}=e,{width:X,height:U,enableHover:K,showGrid:Q,showLegend:Z,title:J,description:ee,summary:te,accessibleTable:oe,xLabel:ne,yLabel:re}=n,ie=(0,sg.useMemo)(()=>yt(r),[r]),se=void 0===r,{domain:ae,trackPushed:le,reset:ce}=ab({accessor:g,data:ie,isPushMode:se}),ue=(0,sg.useCallback)(e=>{le([e]),o.current?.push(e)},[le]),de=(0,sg.useCallback)(e=>{le(e),o.current?.pushMany(e)},[le]);qy(t,{variant:"xy",frameRef:o,overrides:{push:ue,pushMany:de,clear:()=>{ce(),o.current?.clear()}}});const he=Hy({data:ie,rawData:r,colorBy:f,colorScheme:m,legendInteraction:H,legendPosition:W,selection:T,linkedHover:I,fallbackFields:f?["string"==typeof f?f:""]:[],unwrapData:!1,onObservation:N,onClick:D,hoverHighlight:E,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"Scatterplot",chartId:O,showLegend:Z,userMargin:i,marginDefaults:n.marginDefaults,loading:B,loadingContent:F,emptyContent:z,width:X,height:U,hasTitle:!!J,axisChrome:os({showAxes:n.showAxes,xLabel:ne})}),fe=fg($),me=_g({name:fe?.name||"__unused_brush__",xField:fe?.xField||("string"==typeof c?c:void 0),yField:fe?.yField||("string"==typeof u?u:void 0)}),pe=fe?"xyBrush"===me.brushInteraction.brush?"xy":"xBrush"===me.brushInteraction.brush?"x":"y":void 0,ge=ig.useRef(me.brushInteraction);ge.current=me.brushInteraction;const ye=(0,sg.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)},[]);bp("Scatterplot",ie,"xAccessor",c),bp("Scatterplot",ie,"yAccessor",u);const be=(0,sg.useMemo)(()=>g?ae??[0,1]:void 0,[g,ae]),ve=(0,sg.useMemo)(()=>g?e=>Co(e,g,y,be):void 0,[g,y,be]),xe=(0,sg.useMemo)(()=>Xy(c,u),[c,u]),ke=ib({colorBy:f,colorScale:he.colorScale,color:q,pointRadius:x,fillOpacity:k,radiusFn:ve,stroke:Y,strokeWidth:G,opacity:V,styleRules:p,ruleContext:xe,effectiveSelectionHook:he.effectiveSelectionHook,resolvedSelection:he.resolvedSelection}),we=(0,sg.useMemo)(()=>id([{label:ne||ed(c),accessor:c,role:"x",format:a},{label:re||ed(u),accessor:u,role:"y",format:l},...f?[{label:ed(f),accessor:f,role:"color"}]:[],...g?[{label:ed(g),accessor:g,role:"size"}]:[]]),[c,u,ne,re,f,g,a,l]),{effectiveData:Se,statisticalAnnotations:Ae}=pb({data:ie,xAccessor:c,yAccessor:u,forecast:_,anomaly:P}),Ce=(0,sg.useMemo)(()=>{const e=lb(M);return e||0!==Ae.length?[...e?[e]:[],...C||[],...Ae]:C},[M,C,Ae]);if(he.earlyReturn)return he.earlyReturn;const Me=Dy({componentName:"Scatterplot",data:r,accessors:{xAccessor:c,yAccessor:u}});if(Me)return(0,gb.jsx)(lp,{componentName:"Scatterplot",message:Me,width:X,height:U});const _e={chartType:"scatter",...null!=r&&{data:Se},xAccessor:c,yAccessor:u,xScaleType:d,yScaleType:h,colorAccessor:f||void 0,sizeAccessor:g||void 0,...b&&{symbolAccessor:b},...v&&{symbolMap:v},sizeRange:y,pointStyle:ke,colorScheme:m,size:[X,U],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:he.margin,showAxes:n.showAxes,xLabel:ne,yLabel:re,xFormat:a,yFormat:l,enableHover:K,showGrid:Q,...he.legendBehaviorProps,...og({title:J,description:ee,summary:te,accessibleTable:oe,className:s,animate:e.animate,maxDevicePixelRatio:e.maxDevicePixelRatio,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...rg({tooltip:w,defaultTooltipContent:we}),...ng({linkedHover:I,selection:T,onObservation:N,onClick:D,hoverHighlight:E,mobileInteraction:he.mobileInteraction,customHoverBehavior:he.customHoverBehavior,customClickBehavior:he.customClickBehavior}),...S&&{marginalGraphics:S},...A&&{pointIdAccessor:A},...Ce&&Ce.length>0&&{annotations:Ce},...R&&{xExtent:R},...j&&{yExtent:j},...fe&&{brush:{dimension:pe},onBrush:ye},...he.crosshairProps,...L};return(0,gb.jsx)(fp,{componentName:"Scatterplot",width:X,height:U,children:(0,gb.jsx)(Ld,{ref:o,..._e})})});yb.displayName="Scatterplot";var bb=require("react"),vb=require("react/jsx-runtime");function xb(e,t){return Jt(1===t?.5:e/(t-1))}var kb=(0,bb.forwardRef)(function(e,t){const o=(0,bb.useRef)(null);qy(t,{variant:"xy",frameRef:o});const n=Ly(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:d,orderLabel:h,styleRules:f,pointRadius:m=4,tooltip:p,pointIdAccessor:g,annotations:y,regression:b,forecast:v,anomaly:x,xExtent:k,yExtent:w,frameProps:S={},selection:A,linkedHover:C,onObservation:M,onClick:_,hoverHighlight:P,chartId:R,loading:j,loadingContent:L,emptyContent:T,legendInteraction:I,stroke:$,strokeWidth:N,opacity:D}=e,{width:E,height:O,enableHover:B,showGrid:F,title:z,description:H,summary:W,accessibleTable:q,xLabel:Y,yLabel:G}=n,{safeData:V,orderMap:X}=(0,bb.useMemo)(()=>{const e=r||[],t="function"==typeof c?c:e=>e[c],o="function"==typeof u?u:e=>e[u];let n=e;if(d&&e.length>0){const t="function"==typeof d?d:e=>e[d];n=[...e].sort((e,o)=>{const n=t(e),r=t(o);return(n instanceof Date?n.getTime():+n)-(r instanceof Date?r.getTime():+r)})}const i=new WeakMap;let s=0;for(const e of n){const n=t(e),r=o(e);null!=n&&null!=r&&isFinite(n)&&isFinite(r)&&s++}let a=0;for(const e of n){const n=t(e),r=o(e);null!=n&&null!=r&&isFinite(n)&&isFinite(r)&&i.set(e,{idx:a++,total:s})}return{safeData:n,orderMap:i}},[r,d,c,u]);bp("ConnectedScatterplot",V,"xAccessor",c),bp("ConnectedScatterplot",V,"yAccessor",u);const U=Hy({data:V,rawData:r,colorBy:void 0,colorScheme:void 0,legendInteraction:I,selection:A,linkedHover:C,fallbackFields:[],unwrapData:!1,onObservation:M,onClick:_,hoverHighlight:P,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"ConnectedScatterplot",chartId:R,showLegend:void 0,userMargin:i,marginDefaults:n.marginDefaults,loading:j,loadingContent:L,emptyContent:T,width:E,height:O,hasTitle:!!z,axisChrome:os({showAxes:n.showAxes,xLabel:Y})}),K=U.resolvedSelection?.unselectedOpacity??mg,Q=(0,bb.useMemo)(()=>(e,t)=>{const o=t.filter(e=>"point"===e.type);if(2>o.length)return;const n=U.effectiveSelectionHook?.isActive,r=U.effectiveSelectionHook?.predicate,i=100>o.length,s=o.length;e.lineCap="round";for(let t=0;s-1>t;t++){const a=o[t],l=o[t+1],c=xb(t,s),u=!n||!r||r(a.datum??a)||r(l.datum??l),d=n?u?1:K:1;i&&(e.beginPath(),e.moveTo(a.x,a.y),e.lineTo(l.x,l.y),e.strokeStyle="white",e.lineWidth=m+2,e.globalAlpha=.5*d,e.stroke()),e.beginPath(),e.moveTo(a.x,a.y),e.lineTo(l.x,l.y),e.strokeStyle=c,e.lineWidth=m,e.globalAlpha=d,e.stroke()}e.globalAlpha=1},[m,U.effectiveSelectionHook,K]),Z=(0,bb.useMemo)(()=>[Q],[Q]),J=(0,bb.useMemo)(()=>(e,t,o)=>{const n=e.filter(e=>"point"===e.type);if(2>n.length)return null;const r=n.length,i=100>r,s=[];for(let e=0;r-1>e;e++){const t=n[e],o=n[e+1],a=xb(e,r),l=Math.min("number"==typeof t.style?.opacity?t.style.opacity:1,"number"==typeof o.style?.opacity?o.style.opacity:1);i&&s.push((0,vb.jsx)("line",{x1:t.x,y1:t.y,x2:o.x,y2:o.y,stroke:"white",strokeWidth:m+2,strokeLinecap:"round",opacity:.5*l},"halo-"+e)),s.push((0,vb.jsx)("line",{x1:t.x,y1:t.y,x2:o.x,y2:o.y,stroke:a,strokeWidth:m,strokeLinecap:"round",opacity:l},"seg-"+e))}return(0,vb.jsx)(vb.Fragment,{children:s})},[m]),ee=(0,bb.useMemo)(()=>[J],[J]),te=ib({colorScale:void 0,baseStyleExtras:(0,bb.useMemo)(()=>e=>{const t=X.get(e),o=t?.idx??0,n=t?.total??1;return{fill:n>0?xb(o,n):"#6366f1",stroke:"white",strokeWidth:1,r:m,fillOpacity:1}},[m,X]),stroke:$,strokeWidth:N,opacity:D,styleRules:f,ruleContext:(0,bb.useMemo)(()=>Xy(c,u),[c,u]),effectiveSelectionHook:U.effectiveSelectionHook,resolvedSelection:U.resolvedSelection}),oe=h||("string"==typeof d?d:"Order"),ne=(0,bb.useMemo)(()=>id([{label:Y||ed(c),accessor:c,role:"x",format:a},{label:G||ed(u),accessor:u,role:"y",format:l},...d?[{label:oe,accessor:d,role:"group"}]:[]]),[c,u,Y,G,d,oe,a,l]),re=Dy({componentName:"ConnectedScatterplot",data:r,accessors:{xAccessor:c,yAccessor:u}}),{effectiveData:ie,statisticalAnnotations:se}=pb({data:V,xAccessor:c,yAccessor:u,forecast:v,anomaly:x});if(U.earlyReturn)return U.earlyReturn;const ae=lb(b),le=ae||se.length>0?[...ae?[ae]:[],...y||[],...se]:y,ce={chartType:"scatter",...null!=r&&{data:ie},xAccessor:c,yAccessor:u,pointStyle:te,size:[E,O],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:U.margin,showAxes:n.showAxes,xLabel:Y,yLabel:G,xFormat:a,yFormat:l,enableHover:B,showGrid:F,...og({title:z,description:H,summary:W,accessibleTable:q,className:s,animate:e.animate,maxDevicePixelRatio:e.maxDevicePixelRatio,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...rg({tooltip:p,defaultTooltipContent:ne}),...ng({linkedHover:C,selection:A,onObservation:M,onClick:_,hoverHighlight:P,mobileInteraction:U.mobileInteraction,customHoverBehavior:U.customHoverBehavior,customClickBehavior:U.customClickBehavior}),...g&&{pointIdAccessor:g},canvasPreRenderers:Z,svgPreRenderers:ee,...le&&le.length>0&&{annotations:le},...k&&{xExtent:k},...w&&{yExtent:w},...U.crosshairProps,...S};return re?(0,vb.jsx)(lp,{componentName:"ConnectedScatterplot",message:re,width:E,height:O}):(0,vb.jsx)(fp,{componentName:"ConnectedScatterplot",width:E,height:O,children:(0,vb.jsx)(Ld,{ref:o,...ce})})});kb.displayName="ConnectedScatterplot";var wb=require("react"),Sb=require("react");function Ab(e){const{lineWidth:t=2,colorBy:o,colorScale:n,color:r,resolveStroke:i,fillArea:s,areaOpacity:a=.3,stroke:l,strokeWidth:c,opacity:u,effectiveSelectionHook:d,resolvedSelection:h,styleRules:f,ruleContext:m}=e,p=(0,Sb.useMemo)(()=>function(e){const{lineWidth:t=2,colorBy:o,colorScale:n,color:r,resolveStroke:i,fillArea:s,areaOpacity:a=.3,styleRules:l,ruleContext:c}=e;return(e,u)=>{const d={strokeWidth:t},h=!0===s||Array.isArray(s)&&null!=u&&s.includes(u);let f;return i?f=i(e,u):o?n&&(f=wo(e,o,n)):f=r||yo,void 0!==f&&(d.stroke=f,h&&(d.fill=f,d.fillOpacity=a)),l?.length&&Object.assign(d,Jy(e,l,c?c(e,u):{value:void 0,category:u})),d}}({lineWidth:t,colorBy:o,colorScale:n,color:r,resolveStroke:i,fillArea:s,areaOpacity:a,styleRules:f,ruleContext:m}),[t,o,n,r,i,s,a,f,m]),g=(0,Sb.useMemo)(()=>Gy(p,{stroke:l,strokeWidth:c,opacity:u}),[p,l,c,u]);return(0,Sb.useMemo)(()=>pg(g,d??null,h),[g,d,h])}var Cb=require("react/jsx-runtime"),Mb="__lineObjectSeries",_b=(0,wb.forwardRef)(function(e,t){const o=(0,wb.useRef)(null);qy(t,{variant:"xy",frameRef:o});const n=Ly(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:d="y",lineBy:h,lineDataAccessor:f="coordinates",colorBy:m,colorScheme:p,styleRules:g,curve:y="linear",showPoints:b=!1,pointRadius:v=3,fillArea:x=!1,areaOpacity:k=.3,lineWidth:w=2,lineGradient:S,tooltip:A,pointIdAccessor:C,annotations:M,directLabel:_,gapStrategy:P="break",anomaly:R,forecast:j,band:L,xExtent:T,yExtent:I,frameProps:$={},selection:N,linkedHover:D,onObservation:E,onClick:O,hoverHighlight:B,hoverRadius:F,chartId:z,loading:H,loadingContent:W,emptyContent:q,legendInteraction:Y,legendPosition:G,legend:V,xScaleType:X,yScaleType:U,color:K,stroke:Q,strokeWidth:Z,opacity:J}=e,{legend:ee,...te}=$,oe=(0,wb.useMemo)(()=>Bi(ee,V),[ee,V]),{width:ne,height:re,enableHover:ie,showGrid:se,showLegend:ae,title:le,description:ce,summary:ue,accessibleTable:de,xLabel:he,yLabel:fe}=n,me=(0,wb.useMemo)(()=>yt(r),[r]),pe=Array.isArray(me[0]?.[f])?me[0][f]:me;bp("LineChart",pe,"xAccessor",u),bp("LineChart",pe,"yAccessor",d);const{effectiveData:ge,statisticalAnnotations:ye}=pb({data:me,xAccessor:u,yAccessor:d,forecast:j,anomaly:R,groupBy:h}),be="__compoundGroup",ve=!(!j||!h),xe=ve?be:j?ub:h,ke=(0,wb.useMemo)(()=>{if(!ve)return ge;const e="function"==typeof h?h:e=>e[h];return ge.map(t=>{const o={...t};return o[be]=`${e(t)}__${t[ub]||"observed"}`,o})},[ge,ve,h]),we=ve?ke:ge,Se=m||h,Ae=(0,wb.useMemo)(()=>{if(!j)return;const e=j.upperBounds,t=j.lowerBounds;if(!e&&!t)return;const o="function"==typeof e?e:"string"==typeof e?t=>t[e]:null,n="function"==typeof t?t:"string"==typeof t?e=>e[t]:null;let r=1/0,i=-1/0;const s=ge;for(const e of s){const t="function"==typeof d?d(e):+e[d];if(isFinite(t)&&(r>t&&(r=t),t>i&&(i=t)),o){const t=o(e);null!=t&&isFinite(t)&&(t>i&&(i=t),r>t&&(r=t))}if(n){const t=n(e);null!=t&&isFinite(t)&&(r>t&&(r=t),t>i&&(i=t))}}return isFinite(r)&&isFinite(i)?[r,i]:void 0},[j,ge,d]),Ce=(0,wb.useCallback)(e=>{const t="function"==typeof u?u(e):e[u],o="function"==typeof d?d(e):e[d];return null==t||null==o||Number.isNaN(t)||Number.isNaN(o)},[u,d]),Me=void 0!==we[0]?.[f],_e=Me?Mb:xe,Pe=(0,wb.useMemo)(()=>{if(Me)return we.map((e,t)=>{const o="function"==typeof h?h(e):"string"==typeof h?e[h]:void 0,n=null==o?"line-"+t:o+"",r=Array.isArray(e[f])?e[f]:[];return{...e,[Mb]:n,[f]:r.map(t=>({...t,[Mb]:n,parentLine:e,..."string"==typeof h&&void 0!==e[h]?{[h]:e[h]}:{}}))}});if(xe){const e=we.reduce((e,t)=>{const o="function"==typeof xe?xe(t):t[xe];if(!e[o]){const n={[f]:[]};"string"==typeof xe&&(n[xe]=o),ve&&(n[ub]=t[ub],"string"==typeof h&&(n[h]=t[h])),e[o]=n}return e[o][f].push(t),e},{});return Object.values(e)}return[{[f]:we}]},[Me,xe,f,we,h,ve]),{gapProcessedLineData:Re,hasGaps:je}=(0,wb.useMemo)(()=>{if("interpolate"===P){let e=!1;const t=[];for(const o of Pe){const n=(o[f]||[]).filter(t=>!Ce(t)||(e=!0,!1));n.length>0&&t.push({...o,[f]:n})}return{gapProcessedLineData:t,hasGaps:e}}if("break"===P){let e=!1;const t=[];for(const o of Pe){const n=o[f]||[];let r=[],i=0;const s=_e&&"string"==typeof _e?o[_e]:void 0;for(const a of n)if(Ce(a))e=!0,r.length>0&&(t.push({...o,[f]:r}),r=[],i++);else{const e=null!=s?`${s}__seg${i}`:"__seg"+i;r.push({...a,_gapSegment:e})}r.length>0&&t.push({...o,[f]:r})}return{gapProcessedLineData:t,hasGaps:e}}if("zero"===P){let e=!1;const t="string"==typeof d?d:"y",o=[];for(const n of Pe){const r=n[f]||[],i=[];for(const o of r)Ce(o)?(e=!0,i.push({...o,[t]:0})):i.push(o);o.push({...n,[f]:i})}return{gapProcessedLineData:o,hasGaps:e}}return{gapProcessedLineData:Pe,hasGaps:!1}},[Pe,P,f,Ce,_e,d]),Le="object"==typeof _?_:{},Te=Le.position||"end",Ie=Le.fontSize||11,$e=(0,wb.useMemo)(()=>{if(!_||!Se)return[];const e="function"==typeof Se?Se:e=>e[Se],t=new Set;for(const o of Re){const n=o[f]||[];if(0===n.length)continue;const r=e("end"===Te?n[n.length-1]:n[0])??e(o);if(null==r)continue;const i=r+"";""!==i&&t.add(i)}return Array.from(t)},[_,Se,Re,f,Te]),Ne=(0,wb.useMemo)(()=>{if(!_)return n.marginDefaults;const e=$e.reduce((e,t)=>Math.max(e,t.length*(.6*Ie)),0)+10,t="end"===Te?"right":"left";return{...n.marginDefaults,[t]:Math.max(n.marginDefaults[t]||0,e)}},[_,$e,Ie,Te,n.marginDefaults]),De=Hy({data:ge,rawData:r,colorBy:Se,colorScheme:p,legendInteraction:Y,legendPosition:G,selection:N,linkedHover:D,fallbackFields:Se?["string"==typeof Se?Se:""]:[],unwrapData:!1,onObservation:E,onClick:O,hoverHighlight:B,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"LineChart",chartId:z,showLegend:(!_||void 0!==ae)&&ae,legend:oe,userMargin:i,marginDefaults:Ne,loading:H,loadingContent:W,emptyContent:q,width:ne,height:re,hasTitle:!!le,axisChrome:os({showAxes:n.showAxes,xLabel:he})}),Ee=De.colorScale,Oe=De.effectiveSelectionHook,Be=De.resolvedSelection,Fe=De.customHoverBehavior,ze=De.customClickBehavior,He=De.crosshairProps,We=(0,wb.useMemo)(()=>{if(Se)return Me?e=>{const t=e.parentLine||e;return"function"==typeof Se?Se(t):t[Se]}:Se},[Se,Me]),qe=(0,wb.useMemo)(()=>Xy(u,d),[u,d]),Ye=Ab({lineWidth:w,colorBy:We,colorScale:Ee,color:K,fillArea:x,areaOpacity:k,stroke:Q,strokeWidth:Z,opacity:J,effectiveSelectionHook:Oe,resolvedSelection:Be,styleRules:g,ruleContext:qe}),[Ge,Ve]=(0,wb.useState)(null);(0,wb.useEffect)(()=>{if(!j)return void Ve(null);let e=!1;return async function(...e){return(await hb()).createSegmentLineStyle(...e)}(Ye,j).then(t=>{e||Ve(()=>t)}).catch(()=>{e||Ve(null)}),()=>{e=!0}},[Ye,j]);const Xe=Ge||Ye,Ue=(0,wb.useMemo)(()=>{if(b)return e=>{const t={r:v,fillOpacity:1};return Se?Ee&&(t.fill=wo(e.parentLine||e,Se,Ee)):t.fill=K||yo,t}},[b,v,Se,Ee,K]),Ke=Array.isArray(x)?"mixed":x?"area":"line",Qe=(0,wb.useMemo)(()=>{if(!_||!Se)return[];const e="function"==typeof u?u:e=>e[u],t="function"==typeof d?d:e=>e[d],o="function"==typeof Se?Se:e=>e[Se],n=new Map;for(const e of Re){const t=e[f]||[];if(0===t.length)continue;const r="end"===Te?t[t.length-1]:t[0],i=o(r)??o(e);if(null==i)continue;const s=i+"";""===s||n.has(s)||n.set(s,r)}const r=Array.from(n.entries()).map(([o,n])=>({type:"text",label:o,["string"==typeof u?u:"x"]:e(n),["string"==typeof d?d:"y"]:t(n),dx:"end"===Te?6:-6,dy:0,color:Ee?Ee(o):yo,fontSize:Ie}));r.sort((e,t)=>{const o="string"==typeof d?d:"y";return e[o]-t[o]});for(let e=1;r.length>e;e++){const t="string"==typeof d?d:"y",o=r[e-1],n=r[e];Ie+2>Math.abs(n[t]+n.dy-(o[t]+o.dy))&&(n.dy+=Ie+2)}return r},[_,Se,Ee,Re,f,u,d,Te,Ie]),Ze=De.margin,Je=h||m,et=(0,wb.useMemo)(()=>id([{label:he||ed(u),accessor:u,role:"x",format:a},{label:fe||ed(d),accessor:d,role:"y",format:l},...Je?[{label:ed(Je),accessor:Je,role:"group"}]:[],...rd(L,l)]),[u,d,he,fe,Je,a,l,L]),tt=Dy({componentName:"LineChart",data:Me?ge[0]?.[f]||[]:r,accessors:{xAccessor:u,yAccessor:d}}),ot=(0,wb.useMemo)(()=>Me||_e||je?Re.flatMap(e=>{const t=e[f]||[];return _e&&"string"==typeof _e?t.map(t=>({...t,[_e]:t[_e]??e[_e]})):t}):we,[Re,f,Me,_e,we,je]),nt=cn(S),rt={chartType:Ke,...Array.isArray(x)&&{areaGroups:x},...nt&&{lineGradient:nt},...null!=r&&{data:ot},xAccessor:u,yAccessor:d,xScaleType:X,yScaleType:U,...T&&{xExtent:T},...!I||null==I[0]&&null==I[1]?Ae?{yExtent:Ae}:{}:{yExtent:I},groupAccessor:"break"===P&&je?"_gapSegment":_e||void 0,...L&&{band:L},curve:y,lineStyle:Xe,...b&&{pointStyle:Ue},size:[ne,re],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,...void 0!==e.maxDevicePixelRatio&&{maxDevicePixelRatio:e.maxDevicePixelRatio},margin:Ze,showAxes:n.showAxes,xLabel:he,yLabel:fe,xFormat:a,yFormat:l,...void 0!==c&&{axisExtent:c},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},enableHover:ie,showGrid:se,...De.legendBehaviorProps,...le&&{title:le},...ce&&{description:ce},...ue&&{summary:ue},...void 0!==de&&{accessibleTable:de},...s&&{className:s},...null!=e.animate&&{animate:e.animate},...Bc({tooltip:A,defaultTooltipContent:et,multiDefaultContent:Fc()}),...ng({linkedHover:D,selection:N,onObservation:E,onClick:O,hoverRadius:F,hoverHighlight:B,mobileInteraction:De.mobileInteraction,customHoverBehavior:Fe,customClickBehavior:ze}),...C&&{pointIdAccessor:C},...(M?.length||ye.length||Qe.length)&&{annotations:[...M||[],...ye,...Qe]},...He,...te};return De.earlyReturn?De.earlyReturn:tt?(0,Cb.jsx)(lp,{componentName:"LineChart",message:tt,width:ne,height:re}):(0,Cb.jsx)(fp,{componentName:"LineChart",width:ne,height:re,children:(0,Cb.jsx)(Ld,{ref:o,...rt})})});_b.displayName="LineChart";var Pb=require("react"),Rb=require("react"),jb=require("react");function Lb(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}function Tb(e){const t=(0,jb.useRef)(null);return qy(e.imperativeRef,{variant:e.imperativeVariant,frameRef:t}),{frameRef:t,resolved:Ly(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,jb.useMemo)(()=>Lb(e.margin),[e.margin])}}function Ib(e){const t=Tb(e),{resolved:o,normalizedMargin:n}=t,r=Hy({data:e.data??[],rawData:e.data,colorBy:e.colorBy,colorScheme:e.colorScheme,legendInteraction:e.legendInteraction,legendPosition:e.legendPosition,selection:e.selection,linkedHover:e.linkedHover,hoverHighlight:e.hoverHighlight,fallbackFields:"string"==typeof e.colorBy?[e.colorBy]:[],unwrapData:e.unwrapData,onObservation:e.onObservation,onClick:e.onClick,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,chartType:e.chartTypeLabel,chartId:e.chartId,showLegend:o.showLegend,legend:e.legend,userMargin:n,marginDefaults:o.marginDefaults,loading:e.loading,loadingContent:e.loadingContent,emptyContent:e.emptyContent,width:o.width,height:o.height});return{...t,safeData:r.data,setup:r,earlyReturn:r.earlyReturn}}var $b=require("react/jsx-runtime"),Nb=(0,Rb.forwardRef)(function(e,t){const{data:o,layout:n,layoutConfig:r,onLayoutError:i,xExtent:s,yExtent:a,showAxes:l=!1,margin:c,className:u,annotations:d,onObservation:h,onClick:f,selection:m,linkedHover:p,hoverHighlight:g,chartId:y,loading:b,loadingContent:v,emptyContent:x,colorBy:k,colorScheme:w,legend:S,legendInteraction:A,legendPosition:C,frameProps:M={}}=e,{legend:_,...P}=M,R=(0,Rb.useMemo)(()=>Bi(_,S),[_,S]),{frameRef:j,resolved:L,safeData:T,setup:I,earlyReturn:$}=Ib({imperativeRef:t,imperativeVariant:"xy",chartTypeLabel:"XYCustomChart",unwrapData:!1,data:o,colorBy:k,colorScheme:w,legend:R,legendInteraction:A,legendPosition:C,selection:m,linkedHover:p,hoverHighlight:g,onObservation:h,onClick:f,chartId:y,loading:b,loadingContent:v,emptyContent:x,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}),N=I.effectiveSelectionHook,D=(0,Rb.useMemo)(()=>N?.isActive?{isActive:!0,predicate:N.predicate}:null,[N?.isActive,N?.predicate]);if($)return $;const{width:E,height:O,enableHover:B,showGrid:F,title:z,description:H,summary:W,accessibleTable:q,xLabel:Y,yLabel:G}=L,V={chartType:"custom",...null!=o&&{data:T},customLayout:n,layoutConfig:r,onLayoutError:i,...D&&{layoutSelection:D},xExtent:s,yExtent:a,colorAccessor:k,colorScheme:w,size:[E,O],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:I.margin,showAxes:l,xLabel:Y,yLabel:G,enableHover:B,showGrid:F,...I.legendBehaviorProps,...og({title:z,description:H,summary:W,accessibleTable:q,className:u,animate:e.animate,maxDevicePixelRatio:e.maxDevicePixelRatio,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...null!=e.tooltip&&{tooltipContent:e.tooltip},...ng({linkedHover:p,selection:m,onObservation:h,onClick:f,hoverRadius:e.hoverRadius,hoverHighlight:g,mobileInteraction:I.mobileInteraction,customHoverBehavior:I.customHoverBehavior,customClickBehavior:I.customClickBehavior}),...d&&d.length>0&&{annotations:d},...I.crosshairProps,...P};return(0,$b.jsx)(fp,{componentName:"XYCustomChart",width:E,height:O,children:(0,$b.jsx)(Ld,{ref:j,...V})})});function Db(e,t,o,n,r){const i=1-r;return i*i*i*e+3*i*i*r*t+3*i*r*r*o+r*r*r*n}function Eb(e,t,o,n,r){const i=1-r;return 3*i*i*(t-e)+6*i*r*(o-t)+3*r*r*(n-o)}function Ob(e,t,o,n,r){const i=[],s=(e.x+t.x)/2;for(let a=0;r>=a;a++){const l=a/r;let c,u,d,h;"linear"===n?(c=e.x+(t.x-e.x)*l,u=e.y+(t.y-e.y)*l,d=t.x-e.x,h=t.y-e.y):(c=Db(e.x,s,s,t.x,l),u=Db(e.y,e.y,t.y,t.y,l),d=Eb(e.x,s,s,t.x,l),h=Eb(e.y,e.y,t.y,t.y,l)),i.push({x:c,y:u,dx:d,dy:h,radius:e.radius+(t.radius-e.radius)*l,datumIndex:.5>l?o:o+1})}return i}function Bb(e,t={}){const o=[],n=[],r=[];if(2>e.length)return{topPath:o,bottomPath:n,datumIndices:r};const i=t.curve??"smooth",s=Math.max(2,Math.floor(t.samplesPerSegment??12));for(let t=0;e.length-1>t;t++){const a=Ob(e[t],e[t+1],t,i,s);for(let e=0===t?0:1;a.length>e;e++){const t=a[e],i=Math.hypot(t.dx,t.dy)||1,s=-t.dy/i,l=t.dx/i,c=Math.max(0,t.radius);o.push([t.x+s*c,t.y+l*c]),n.push([t.x-s*c,t.y-l*c]),r.push(t.datumIndex)}}return{topPath:o,bottomPath:n,datumIndices:r}}Nb.displayName="XYCustomChart";var Fb=require("react/jsx-runtime"),zb="Other";function Hb(e,t,o){return"function"==typeof e?e(t,o):t[e]}function Wb(e){return e instanceof Date?"date:"+e.getTime():`${typeof e}:${e+""}`}function qb(e,t={}){const o=t.xAccessor??"x",n=t.yAccessor??"y",r=t.lineBy??"series",i=t.rankDirection??"descending",s=[],a=new Map,l=new Map,c=[],u=new Map;let d=1/0,h=-1/0;e.forEach((e,t)=>{const i=Hb(o,e,t),f=Wb(i);let m=a.get(f);null==m&&(m=s.length,a.set(f,m),s.push(i),l.set(m,[]));const p=Hb(r,e,t)+"";u.has(p)||(u.set(p,c.length),c.push(p));const g=Number(Hb(n,e,t));Number.isFinite(g)&&(d=Math.min(d,g),h=Math.max(h,g),l.get(m)?.push({datum:e,inputIndex:t,series:p,value:g}))});const f=[],m=new Map,p=new Map;for(let e=0;s.length>e;e++){const t=l.get(e)??[];t.sort((e,t)=>("descending"===i?t.value-e.value:e.value-t.value)||(u.get(e.series)??0)-(u.get(t.series)??0)),t.forEach((t,o)=>{const n=o+1;f.push({datum:t.datum,xIndex:e,xValue:s[e],series:t.series,value:t.value,rank:n}),m.set(t.series,(m.get(t.series)??0)+n),p.set(t.series,(p.get(t.series)??0)+1)})}const g=c.length+1,y=[...c].sort((e,t)=>{const o=p.get(e)??0,n=p.get(t)??0;return((m.get(e)??0)+(s.length-o)*g)/Math.max(1,s.length)-((m.get(t)??0)+(s.length-n)*g)/Math.max(1,s.length)||(u.get(e)??0)-(u.get(t)??0)}),b=new Set(y.slice(0,null==t.highlightTop?y.length:Math.max(0,Math.floor(t.highlightTop))));return{data:f.map(e=>{const t=b.has(e.series);return{...e.datum,x:e.xIndex,y:e.rank,__bumpRaw:e.datum,__bumpSeries:e.series,__bumpColorGroup:t?e.series:zb,__bumpValue:e.value,__bumpRank:e.rank,__bumpXValue:e.xValue,__bumpHighlighted:t}}),xValues:s,seriesOrder:c,overallOrder:y,valueExtent:d===1/0?[0,0]:[d,h]}}function Yb({datum:e,x:t,y:o,side:n,color:r,highlighted:i,labelStyle:s}){const a=Ar(),l=a.isActive&&!a.predicate(e),c="function"==typeof s?s(e.__bumpRaw):s;return(0,Fb.jsx)("text",{className:"semiotic-bump-label",x:t+("end"===n?8:-8),y:o,dy:"0.35em",textAnchor:"end"===n?"start":"end",fill:r,fillOpacity:l?.16:1,fontWeight:i?650:450,fontSize:12,style:{pointerEvents:"none",fontFamily:"var(--semiotic-font-family, sans-serif)",fontSize:"var(--semiotic-axis-label-font-size, 12px)",...c},children:e.__bumpSeries})}function Gb(e,t,o){const[n,r]=t,[i,s]=o;return r===n?(i+s)/2:i+(s-i)*Math.max(0,Math.min(1,(e-n)/(r-n)))}function Vb(e){const t=e instanceof Date?e.getTime():Number(e);return Number.isFinite(t)?t:void 0}function Xb(e){return{value:e.__bumpValue,x:Vb(e.__bumpXValue),y:e.__bumpValue,category:e.__bumpSeries}}function Ub(e){const t=e.config,o=new Map;for(const t of e.data){const e=o.get(t.__bumpSeries)??[];e.push(t),o.set(t.__bumpSeries,e)}const n=t.seriesOrder.filter(e=>o.has(e)).sort((e,n)=>(o.get(e)?.[0]?.__bumpHighlighted?1:0)-(o.get(n)?.[0]?.__bumpHighlighted?1:0)||t.seriesOrder.indexOf(e)-t.seriesOrder.indexOf(n)),r=[],i=[];for(const s of n){const n=(o.get(s)??[]).sort((e,t)=>e.x-t.x);if(2>n.length)continue;const a=n[0].__bumpHighlighted,l=e.resolveColor(n[0].__bumpSeries,n[0]),c=t.color??(a?l:t.neutralColor??e.theme.semantic.textSecondary??e.theme.semantic.border??l),u=n.map(o=>({x:e.scales.x(o.x),y:e.scales.y(o.y),radius:t.ribbon?Gb(o.__bumpValue,t.valueExtent,t.ribbonSizeRange)/2:Math.max(.5,t.lineWidth/2)})),d=Bb(u,{curve:t.curve,samplesPerSegment:t.samplesPerSegment}),h=d.datumIndices.map(e=>n[e]),f={fill:c,fillOpacity:1,opacity:a?t.ribbon?t.ribbonOpacity:t.lineOpacity:Math.min(t.ribbon?t.ribbonOpacity:t.lineOpacity,.58)};t.styleRules?.length&&Object.assign(f,Jy(n[0].__bumpRaw,t.styleRules,Xb(n[0]))),t.areaStyle&&Object.assign(f,t.areaStyle(n[0].__bumpRaw)??{}),void 0!==t.stroke&&(f.stroke=t.stroke),void 0!==t.strokeWidth&&(f.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(f.opacity=t.opacity),r.push({type:"area",topPath:d.topPath,bottomPath:d.bottomPath,style:f,datum:h,accessibleDatum:n.map(e=>e.__bumpRaw),accessibility:{label:s+" ranking trajectory",tableFields:n.map(e=>e.__bumpRaw)},group:s,interactive:!0}),t.showPoints&&n.forEach((e,o)=>{const n={fill:c,stroke:"none",opacity:a?1:.75};t.styleRules?.length&&Object.assign(n,Jy(e.__bumpRaw,t.styleRules,Xb(e))),t.pointStyle&&Object.assign(n,t.pointStyle(e.__bumpRaw)??{}),void 0!==t.stroke&&(n.stroke=t.stroke),void 0!==t.strokeWidth&&(n.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(n.opacity=t.opacity),r.push({type:"point",x:u[o].x,y:u[o].y,r:n.r??t.pointRadius,style:n,datum:e,accessibleDatum:e.__bumpRaw,accessibility:{label:`${s}, rank ${e.__bumpRank}, value ${e.__bumpValue}`},pointId:`${s}:${e.x}`})});const m=!0===t.showLabels?"end":t.showLabels,p=(e,o,n)=>{i.push((0,Fb.jsx)(Yb,{datum:e,x:u[o].x,y:u[o].y,side:n,color:"string"==typeof f.fill?f.fill:c,highlighted:a,labelStyle:t.labelStyle},`${s}-${n}`))};"start"!==m&&"both"!==m||p(n[0],0,"start"),"end"!==m&&"both"!==m||p(n.at(-1),n.length-1,"end")}return{nodes:r,overlays:i.length?(0,Fb.jsx)("g",{className:"semiotic-bump-labels",children:i}):void 0,restyle:(e,t)=>{const o=function(e){const t=Array.isArray(e.datum)?e.datum[0]:e.datum;return t&&"object"==typeof t&&"__bumpSeries"in t?t:void 0}(e);if(t?.isActive&&o&&!t.predicate(o))return{opacity:.14}}}}var Kb=(0,Pb.forwardRef)(function(e,t){const o=Cy(),n=Wg(),{data:r,xAccessor:i,yAccessor:s,lineBy:a,rankDirection:l="descending",ribbon:c=!1,curve:u="smooth",ribbonSizeRange:d=[4,28],samplesPerSegment:h=12,lineWidth:f=3,highlightTop:m,neutralColor:p,styleRules:g,labelStyle:y,colorScheme:b,ribbonOpacity:v=.82,lineOpacity:x=.9,showPoints:k=!1,pointRadius:w=3,showLabels:S=!0,showAxes:A=!0,showGrid:C=!0,showLegend:M=!1,enableHover:_=!0,hoverHighlight:P=!0,tooltip:R,frameProps:j={},xFormat:L,yFormat:T,onClick:I}=e,$=(0,Pb.useMemo)(()=>qb(r,{xAccessor:i,yAccessor:s,lineBy:a,rankDirection:l,highlightTop:m}),[r,i,s,a,l,m]),{axes:N,areaStyle:D,pointStyle:E,...O}=j,B=(0,Pb.useMemo)(()=>function(e){const{seriesOrder:t,overallOrder:o,highlightTop:n,color:r,colorScheme:i,neutralColor:s,themeCategorical:a,themeNeutral:l}=e;if(null==n&&null==r)return i;const c=new Set(o.slice(0,null==n?o.length:Math.max(0,Math.floor(n)))),u=new Map,d={};for(const e of t)d[e]=r??(c.has(e)?My(void 0,a,i,e,u):s??l??"#b8bec8");return d}({seriesOrder:$.seriesOrder,overallOrder:$.overallOrder,highlightTop:m,color:e.color,colorScheme:b,neutralColor:p,themeCategorical:o,themeNeutral:n.colors.textSecondary}),[$.seriesOrder,$.overallOrder,m,e.color,b,p,o,n.colors.textSecondary]),F=(0,Pb.useMemo)(()=>({ribbon:c,curve:u,samplesPerSegment:h,ribbonSizeRange:d,valueExtent:$.valueExtent,seriesOrder:$.seriesOrder,lineWidth:f,ribbonOpacity:v,lineOpacity:x,neutralColor:p,color:e.color,stroke:e.stroke,strokeWidth:e.strokeWidth,opacity:e.opacity,styleRules:g,areaStyle:D,pointStyle:E,labelStyle:y,showPoints:k,pointRadius:w,showLabels:S}),[c,u,h,d,$.valueExtent,$.seriesOrder,f,v,x,p,e.color,e.stroke,e.strokeWidth,e.opacity,g,D,E,y,k,w,S]),z=(0,Pb.useCallback)((e,t)=>{if(0===$.xValues.length)return"";const o=$.xValues[Math.max(0,Math.min($.xValues.length-1,Math.round(Number(e))))];return L?L(o,t):(o instanceof Date?o.toLocaleDateString():o)+""},[$.xValues,L]),H=(0,Pb.useCallback)(e=>T?T(e):e.toLocaleString(),[T]),W=(0,Pb.useMemo)(()=>"multi"===R?void 0:zc(R),[R]),q=(0,Pb.useCallback)(e=>{const t=e?.data??e;return t?!1===R?null:W?W({...e,data:t.__bumpRaw,__semioticHoverData:!0}):(0,Fb.jsxs)("div",{className:"semiotic-tooltip",style:Tc,children:[(0,Fb.jsx)("div",{style:{fontWeight:700},children:t.__bumpSeries}),(0,Fb.jsxs)("div",{children:[z(t.x)," · Rank ",t.__bumpRank]}),(0,Fb.jsxs)("div",{children:["Value: ",H(t.__bumpValue)]})]}):null},[H,z,W,R]),Y=(0,Pb.useMemo)(()=>{if(I)return(e,t)=>{I(e.__bumpRaw??e,t)}},[I]),G=Math.max(1,$.seriesOrder.length),V=$.xValues.map((e,t)=>t),X=Array.from({length:G},(e,t)=>t+1),U=N??[{orient:"left",tickValues:X,tickFormat:e=>e+"",label:e.yLabel??"Rank",baseline:!1},{orient:"bottom",tickValues:V,tickFormat:z,label:e.xLabel,tickAnchor:"edges"}],K=(0,Pb.useMemo)(()=>function(e,t){if(!e?.length)return;const o=new Map(t.map((e,t)=>[Wb(e),t]));return e.map(e=>{const t={...e},n=n=>{if(!(n in e))return;const r=o.get(Wb(e[n]));void 0!==r&&(t[n]=r)};return n("x"),n("x0"),n("x1"),"string"!=typeof e.type||"x-threshold"!==e.type&&"x"!==e.type||n("value"),t})}(e.annotations,$.xValues),[e.annotations,$.xValues]);return(0,Fb.jsx)(Nb,{ref:t,data:$.data,layout:Ub,layoutConfig:F,xExtent:[0,Math.max(1,$.xValues.length-1)],yExtent:[G+.5,.5],showAxes:A,showGrid:C,showLegend:M,enableHover:_,hoverHighlight:P,colorBy:"__bumpSeries",colorScheme:B,tooltip:q,onClick:Y,hoverRadius:e.hoverRadius,width:e.width,height:e.height,responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,responsiveRules:e.responsiveRules,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,mode:e.mode,margin:e.margin??{top:20,right:S?110:24,bottom:48,left:48},className:e.className,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,selection:e.selection,linkedHover:e.linkedHover,legend:e.legend,legendInteraction:e.legendInteraction,legendPosition:e.legendPosition,onObservation:e.onObservation,chartId:e.chartId,loading:e.loading,loadingContent:e.loadingContent,emptyContent:e.emptyContent,animate:e.animate,autoPlaceAnnotations:e.autoPlaceAnnotations,annotations:K,xLabel:e.xLabel,yLabel:e.yLabel??"Rank",frameProps:{axes:U,axisExtent:"exact",...O}})});Kb.displayName="BumpChart";var Qb=require("react"),Zb=require("react");function Jb(e){const{safeData:t,data:o,areaBy:n,lineDataAccessor:r,colorBy:i,colorScale:s,color:a,stroke:l,strokeWidth:c,opacity:u,effectiveSelectionHook:d,resolvedSelection:h,areaOpacity:f,showLine:m,lineWidth:p,showPoints:g,pointRadius:y,xAccessor:b,yAccessor:v,xLabel:x,yLabel:k,xFormat:w,yFormat:S,groupField:A,styleRules:C,ruleContext:M}=e,_=(0,Zb.useMemo)(()=>function({data:e,safeData:t,areaBy:o,lineDataAccessor:n}){if(null==e)return[];const r=void 0!==t[0]?.[n];if(!r&&!o)return t;let i;if(r)i=t;else{const e=t.reduce((e,t)=>{const r="function"==typeof o?o(t):t[o],i=r+"";if(!e[i]){const t={[n]:[]};"string"==typeof o&&(t[o]=r),e[i]=t}return e[i][n].push(t),e},{});i=Object.values(e)}return i.flatMap(e=>{const t=Array.isArray(e[n])?e[n]:[];return"string"==typeof o?t.map(t=>({...t,[o]:t[o]??e[o]})):t})}({data:o,safeData:t,areaBy:n,lineDataAccessor:r}),[o,t,n,r]),P=(0,Zb.useMemo)(()=>e=>{const t={};if(i){if(s){const o=wo(e,i,s);t.fill=o,m?(t.stroke=o,t.strokeWidth=p):t.stroke="none"}}else{const e=a||yo;t.fill=e,m?(t.stroke=e,t.strokeWidth=p):t.stroke="none"}return t.fillOpacity=f,C&&C.length>0&&Object.assign(t,Jy(e,C,M?M(e):{value:void 0})),t},[i,s,a,f,m,p,C,M]),R=(0,Zb.useMemo)(()=>Gy(P,{stroke:l,strokeWidth:c,opacity:u}),[P,l,c,u]);return{flattenedData:_,lineStyle:(0,Zb.useMemo)(()=>pg(R,d??null,h),[R,d,h]),pointStyle:(0,Zb.useMemo)(()=>{if(g)return e=>{const t={r:y,fillOpacity:1};return i?s&&(t.fill=wo(e.parentLine||e,i,s)):t.fill=a||yo,t}},[g,y,i,s,a]),defaultTooltipContent:(0,Zb.useMemo)(()=>id([{label:x||ed(b),accessor:b,role:"x",format:w},{label:k||ed(v),accessor:v,role:"y",format:S},...A?[{label:ed(A),accessor:A,role:"group"}]:[],...rd(e.band,S)]),[b,v,x,k,A,w,S,e.band])}}var ev=require("react/jsx-runtime"),tv=(0,Qb.forwardRef)(function(e,t){const o=(0,Qb.useRef)(null);qy(t,{variant:"xy",frameRef:o});const n=Ly(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:d,y0Accessor:h,gradientFill:f=!1,semanticGradient:m,semanticLine:p=!0,lineDataAccessor:g="coordinates",colorBy:y,colorScheme:b,styleRules:v,curve:x="monotoneX",areaOpacity:k=.7,lineGradient:w,showLine:S=!0,lineWidth:A=2,showPoints:C=!1,pointRadius:M=3,tooltip:_,annotations:P,forecast:R,anomaly:j,band:L,xExtent:T,yExtent:I,frameProps:$={},selection:N,linkedHover:D,onObservation:E,onClick:O,hoverHighlight:B,chartId:F,loading:z,loadingContent:H,emptyContent:W,legendInteraction:q,legendPosition:Y,color:G,stroke:V,strokeWidth:X,opacity:U}=e,{width:K,height:Q,enableHover:Z,showGrid:J,showLegend:ee,title:te,description:oe,summary:ne,accessibleTable:re,xLabel:ie,yLabel:se}=n,ae=(0,Qb.useMemo)(()=>yt(r),[r]),le=y||d,ce=(0,Qb.useMemo)(()=>function(e){if(e)return Array.isArray(e)?{stops:e.map(({at:e,color:t,opacity:o})=>({offset:e/100,color:t,...null!=o&&{opacity:o}}))}:Array.isArray(e.stops)?e:void 0}(m),[m]),ue=(0,Qb.useMemo)(()=>ce?.stops.length?{stops:ce.stops.map(e=>({...e,offset:1-e.offset})).sort((e,t)=>e.offset-t.offset)}:ln(f),[ce,f]),de=(0,Qb.useMemo)(()=>cn(w),[w]),he=(0,Qb.useMemo)(()=>p&&ce?.stops.length?ce.stops.flatMap(({offset:e,color:t})=>t?[{offset:e,color:t}]:[]):void 0,[ce,p]);bp("AreaChart",ae,"xAccessor",c),bp("AreaChart",ae,"yAccessor",u);const fe=Hy({data:ae,rawData:r,colorBy:le,colorScheme:b,legendInteraction:q,legendPosition:Y,selection:N,linkedHover:D,fallbackFields:le?["string"==typeof le?le:""]:[],unwrapData:!1,onObservation:E,onClick:O,hoverHighlight:B,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"AreaChart",chartId:F,showLegend:ee,userMargin:i,marginDefaults:n.marginDefaults,loading:z,loadingContent:H,emptyContent:W,width:K,height:Q,hasTitle:!!te,axisChrome:os({showAxes:n.showAxes,xLabel:ie})}),{effectiveData:me,statisticalAnnotations:pe}=pb({data:ae,xAccessor:c,yAccessor:u,forecast:R,anomaly:j,groupBy:d}),ge=(0,Qb.useMemo)(()=>Xy(c,u),[c,u]),{flattenedData:ye,lineStyle:be,pointStyle:ve,defaultTooltipContent:xe}=Jb({safeData:me,data:r,areaBy:d,lineDataAccessor:g,colorBy:le,colorScale:fe.colorScale,color:G,stroke:V,strokeWidth:X,opacity:U,effectiveSelectionHook:fe.effectiveSelectionHook,resolvedSelection:fe.resolvedSelection,areaOpacity:k,showLine:S,lineWidth:A,showPoints:C,pointRadius:M,xAccessor:c,yAccessor:u,xLabel:ie,yLabel:se,xFormat:a,yFormat:l,groupField:d||y,band:L,styleRules:v,ruleContext:ge}),ke=Dy({componentName:"AreaChart",data:r,accessors:{xAccessor:c,yAccessor:u}}),we={chartType:"area",...null!=r&&{data:ye},xAccessor:c,yAccessor:u,groupAccessor:d||void 0,...h&&{y0Accessor:h},...L&&{band:L},...ue&&{gradientFill:ue},...de&&{lineGradient:de},...he&&{semanticLineStops:he},curve:x,lineStyle:be,...C&&ve&&{pointStyle:ve},size:[K,Q],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:fe.margin,showAxes:n.showAxes,xLabel:ie,yLabel:se,xFormat:a,yFormat:l,enableHover:Z,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:J,...fe.legendBehaviorProps,...og({title:te,description:oe,summary:ne,accessibleTable:re,className:s,animate:e.animate,maxDevicePixelRatio:e.maxDevicePixelRatio,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Bc({tooltip:_,defaultTooltipContent:xe,multiDefaultContent:Fc()}),...ng({linkedHover:D,selection:N,onObservation:E,onClick:O,hoverHighlight:B,mobileInteraction:fe.mobileInteraction,customHoverBehavior:fe.customHoverBehavior,customClickBehavior:fe.customClickBehavior}),...(P&&P.length>0||pe.length>0)&&{annotations:[...P||[],...pe]},...T&&{xExtent:T},...I&&{yExtent:I},...fe.crosshairProps,...$};return fe.earlyReturn?fe.earlyReturn:ke?(0,ev.jsx)(lp,{componentName:"AreaChart",message:ke,width:K,height:Q}):(0,ev.jsx)(fp,{componentName:"AreaChart",width:K,height:Q,children:(0,ev.jsx)(Ld,{ref:o,...we})})});tv.displayName="AreaChart";var ov=require("react"),nv=require("react/jsx-runtime");function rv(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 iv=(0,ov.forwardRef)(function(e,t){const o=(0,ov.useRef)(null),n=Ly(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:d="b",seriesALabel:h="A",seriesBLabel:f="B",seriesAColor:m="var(--semiotic-danger, #dc2626)",seriesBColor:p="var(--semiotic-info, #2563eb)",showLines:g=!0,lineWidth:y=1.5,showPoints:b=!1,pointRadius:v=3,curve:x="linear",areaOpacity:k=.6,gradientFill:w,tooltip:S,annotations:A,xExtent:C,yExtent:M,frameProps:_={},selection:P,linkedHover:R,onObservation:j,onClick:L,hoverHighlight:T,chartId:I,loading:$,loadingContent:N,emptyContent:D,legendInteraction:E,legendPosition:O,pointIdAccessor:B,windowSize:F}=e,{width:z,height:H,enableHover:W,showGrid:q,showLegend:Y,title:G,description:V,summary:X,accessibleTable:U,xLabel:K,yLabel:Q}=n,Z=(0,ov.useMemo)(()=>"function"==typeof c?e=>rv(c(e)):e=>rv(e[c]),[c]),J=(0,ov.useMemo)(()=>"function"==typeof u?e=>rv(u(e)):e=>rv(e[u]),[u]),ee=(0,ov.useMemo)(()=>"function"==typeof d?e=>rv(d(e)):e=>rv(e[d]),[d]),[te,oe]=(0,ov.useState)([]),ne=(0,ov.useRef)([]),re=null==r,ie=(0,ov.useMemo)(()=>yt(re?te:r),[re,te,r]),se=(0,ov.useMemo)(()=>function(e,t,o,n){if(!e.length)return[];const r=e.filter(e=>Number.isFinite(t(e))).sort((e,o)=>t(e)-t(o)),i=[];let s=0,a=null,l=null,c=[];const u=(e,t)=>e>t?"A":t>e?"B":null,d=e=>`seg-${s}-${e}`,h=e=>i.push(e),f=(e,t)=>{h({__x:e.x,__y:e.y,__y0:e.y,__diffSegment:d(t),__diffWinner:t,__valA:e.y,__valB:e.y,__sourceDatum:e.datum})};for(let e=0;r.length>e;e++){const i=r[e],m=t(i),p=o(i),g=n(i);if(!Number.isFinite(m)||!Number.isFinite(p)||!Number.isFinite(g))continue;const y=u(p,g);if(null!==y)if(null!=a){if(l&&l.w!==y){let e,t;if(c.length>0)e=c[0].x,t=c[0].y;else{const o=p-l.a-(g-l.b);if(0!==o){const n=Math.max(0,Math.min(1,(l.b-l.a)/o));e=l.x+n*(m-l.x),t=l.a+n*(p-l.a)}else e=l.x,t=l.a}h({__x:e,__y:t,__y0:t,__diffSegment:d(a),__diffWinner:a,__valA:t,__valB:t}),s++,a=y,h({__x:e,__y:t,__y0:t,__diffSegment:d(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=[],h({__x:m,__y:g>p?g:p,__y0:g>p?p:g,__diffSegment:d(a),__diffWinner:a,__valA:p,__valB:g,__sourceDatum:i}),l={x:m,a:p,b:g,w:y}}else{a=y;for(const e of c)f(e,a);c=[],h({__x:m,__y:g>p?g:p,__y0:g>p?p:g,__diffSegment:d(a),__diffWinner:a,__valA:p,__valB:g,__sourceDatum:i}),l={x:m,a:p,b:g,w:y}}else c.push({x:m,y:p,datum:i})}for(const e of c)f(e,a??"A");return i}(ie,Z,J,ee),[ie,Z,J,ee]),ae=(0,ov.useMemo)(()=>g?function(e,t,o,n){if(!e.length)return[];const r=e.filter(e=>Number.isFinite(t(e))).sort((e,o)=>t(e)-t(o)),i=[];for(const e of r){const r=t(e),s=o(e),a=n(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}(ie,Z,J,ee):[],[g,ie,Z,J,ee]),le=(0,ov.useMemo)(()=>[...se,...ae],[se,ae]),ce=(0,ov.useMemo)(()=>{const e=new Set;for(const t of se)e.add(t.__diffSegment);return Array.from(e)},[se]);(0,ov.useImperativeHandle)(t,()=>{const e=e=>{const t=F&&e.length>F?e.slice(e.length-F):e;ne.current=t,oe(t)},t=B?"function"==typeof B?B:e=>e[B]:null;return{push:t=>e([...ne.current,t]),pushMany:t=>e([...ne.current,...t]),remove:o=>{if(!t)return[];const n=Array.isArray(o)?o:[o],r=[],i=[];for(const e of ne.current)n.includes(t(e))?r.push(e):i.push(e);return e(i),r},update:(o,n)=>{if(!t)return[];const r=Array.isArray(o)?o:[o],i=[],s=ne.current.map(e=>{if(r.includes(t(e))){const t=n(e);return i.push(t),t}return e});return e(s),i},clear:()=>e([]),getData:()=>re?ne.current:ie,getScales:()=>o.current?.getScales()??null}},[re,ie,B,F]);const ue=Hy({data:ie,rawData:r,colorBy:"__diffWinner",colorScheme:[m,p],legendInteraction:E,legendPosition:O,selection:P,linkedHover:R,fallbackFields:["__diffWinner"],unwrapData:!1,onObservation:j,onClick:L,hoverHighlight:T,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"DifferenceChart",chartId:I,showLegend:Y,userMargin:i,marginDefaults:n.marginDefaults,loading:$,loadingContent:N,emptyContent:D,width:z,height:H,hasTitle:!!G,axisChrome:os({showAxes:n.showAxes,xLabel:K})}),de=(0,ov.useMemo)(()=>{if(!1!==Y)return{legendGroups:[{label:"",type:"fill",styleFn:e=>({fill:e.color||"currentColor"}),items:[{label:h,color:m},{label:f,color:p}]}]}},[Y,h,f,m,p]),he=(0,ov.useCallback)(e=>{const t=e.__diffSegment;return{fill:"A"==(t?.endsWith("-A")?"A":"B")?m:p,stroke:"none",fillOpacity:k}},[m,p,k]),fe=(0,ov.useCallback)(e=>({stroke:"A"==("line-A"===e.__diffSegment?"A":"B")?m:p,strokeWidth:y,fill:"none"}),[m,p,y]),me=(0,ov.useCallback)(e=>({fill:"A"==("line-A"===e.__diffSegment?"A":"B")?m:p,r:v}),[m,p,v]),pe=(0,ov.useCallback)(e=>{const t=e.data,o=e.allSeries,n=e.xValue??t?.__x;let r=t?.__valA,i=t?.__valB;if(o&&o.length>0){const e=o.find(e=>"line-A"===e.group),t=o.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!=n&&(null==r||null==i)){const e=ie.find(e=>Z(e)===n);e&&(null==r&&(r=J(e)),null==i&&(i=ee(e)))}const s=e=>null!=e&&Number.isFinite(e)?""+Math.round(100*e)/100:"—",l=a&&null!=n?a(n):null!=n?n+"":"";return(0,nv.jsxs)("div",{className:"semiotic-tooltip",style:Tc,children:[l&&(0,nv.jsx)("div",{style:{fontWeight:600,marginBottom:4},children:l}),(0,nv.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6},children:[(0,nv.jsx)("span",{style:{width:10,height:10,background:m,display:"inline-block",borderRadius:2}}),(0,nv.jsxs)("span",{children:[h,": ",s(r)]})]}),(0,nv.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6},children:[(0,nv.jsx)("span",{style:{width:10,height:10,background:p,display:"inline-block",borderRadius:2}}),(0,nv.jsxs)("span",{children:[f,": ",s(i)]})]}),null!=r&&null!=i&&Number.isFinite(r)&&Number.isFinite(i)&&(0,nv.jsxs)("div",{style:{marginTop:4,opacity:.7},children:["Δ = ",s(r-i)]})]})},[ie,Z,J,ee,a,m,p,h,f]),{tooltipContent:ge,tooltipMode:ye}=(0,ov.useMemo)(()=>Bc({tooltip:S,defaultTooltipContent:pe,multiDefaultContent:pe}),[S,pe]),be=(0,ov.useMemo)(()=>ln(w,{stops:[{offset:0,opacity:.85},{offset:1,opacity:.15}]}),[w]);if(ue.earlyReturn)return ue.earlyReturn;const ve={chartType:"mixed",data:le,xAccessor:"__x",yAccessor:"__y",y0Accessor:"__y0",groupAccessor:"__diffSegment",areaGroups:ce,curve:x,areaStyle:he,lineStyle:fe,...b&&{pointStyle:me},size:[z,H],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ue.margin,showAxes:n.showAxes,xLabel:K,yLabel:Q,xFormat:a,yFormat:l,enableHover:W,showGrid:q,...be&&{gradientFill:be},...de&&{legend:de,legendPosition:ue.legendPosition},...og({title:G,description:V,summary:X,accessibleTable:U,className:s,animate:e.animate,maxDevicePixelRatio:e.maxDevicePixelRatio,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),tooltipContent:ge,..."multi"===ye&&{tooltipMode:"multi"},...ng({linkedHover:R,selection:P,onObservation:j,onClick:L,hoverHighlight:T,mobileInteraction:ue.mobileInteraction,customHoverBehavior:ue.customHoverBehavior,customClickBehavior:ue.customClickBehavior}),...A&&A.length>0&&{annotations:A},...C&&{xExtent:C},...M&&{yExtent:M},...ue.crosshairProps,..._};return(0,nv.jsx)(fp,{componentName:"DifferenceChart",width:z,height:H,children:(0,nv.jsx)(Ld,{ref:o,...ve})})});"function"==typeof iv&&(iv.displayName="DifferenceChart");var sv=require("react"),av=require("react/jsx-runtime"),lv=(0,sv.forwardRef)(function(e,t){const o=(0,sv.useRef)(null),n=Ly(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:d,lineDataAccessor:h="coordinates",colorBy:f,colorScheme:m,styleRules:p,curve:g="monotoneX",areaOpacity:y=.7,showLine:b=!0,lineWidth:v=2,showPoints:x=!1,pointRadius:k=3,normalize:w=!1,baseline:S="zero",stackOrder:A,tooltip:C,annotations:M,xExtent:_,yExtent:P,frameProps:R={},selection:j,linkedHover:L,onObservation:T,onClick:I,hoverHighlight:$,chartId:N,loading:D,loadingContent:E,emptyContent:O,legendInteraction:B,legendPosition:F,color:z,stroke:H,strokeWidth:W,opacity:q}=e,{width:Y,height:G,enableHover:V,showGrid:X,showLegend:U,title:K,description:Q,summary:Z,accessibleTable:J,xLabel:ee,yLabel:te}=n,oe=(0,sv.useMemo)(()=>yt(r),[r]),ne=f||d;qy(t,{variant:"xy",frameRef:o});const re=Hy({data:oe,rawData:r,colorBy:ne,colorScheme:m,legendInteraction:B,legendPosition:F,selection:j,linkedHover:L,fallbackFields:ne?["string"==typeof ne?ne:""]:[],unwrapData:!1,onObservation:T,onClick:I,hoverHighlight:$,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"StackedAreaChart",chartId:N,showLegend:U,userMargin:i,marginDefaults:n.marginDefaults,loading:D,loadingContent:E,emptyContent:O,width:Y,height:G,hasTitle:!!K,axisChrome:os({showAxes:n.showAxes,xLabel:ee})}),ie=(0,sv.useMemo)(()=>Xy(c,u),[c,u]),{flattenedData:se,lineStyle:ae,pointStyle:le,defaultTooltipContent:ce}=Jb({safeData:oe,data:r,areaBy:d,lineDataAccessor:h,colorBy:ne,colorScale:re.colorScale,color:z,stroke:H,strokeWidth:W,opacity:q,effectiveSelectionHook:re.effectiveSelectionHook,resolvedSelection:re.resolvedSelection,areaOpacity:y,showLine:b,lineWidth:v,showPoints:x,pointRadius:k,xAccessor:c,yAccessor:u,xLabel:ee,yLabel:te,xFormat:a,yFormat:l,groupField:d||f,styleRules:p,ruleContext:ie}),ue=Dy({componentName:"StackedAreaChart",data:r,accessors:{xAccessor:c,yAccessor:u}}),de={chartType:"stackedarea",...null!=r&&{data:se},xAccessor:c,yAccessor:u,groupAccessor:d||void 0,curve:g,normalize:w,baseline:w?"zero":S,stackOrder:A,lineStyle:ae,...x&&le&&{pointStyle:le},size:[Y,G],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:re.margin,showAxes:n.showAxes,xLabel:ee,yLabel:te,xFormat:a,yFormat:l,enableHover:V,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:X,...re.legendBehaviorProps,...og({title:K,description:Q,summary:Z,accessibleTable:J,className:s,animate:e.animate,maxDevicePixelRatio:e.maxDevicePixelRatio,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Bc({tooltip:C,defaultTooltipContent:ce,multiDefaultContent:Fc()}),...ng({linkedHover:L,selection:j,onObservation:T,onClick:I,hoverHighlight:$,mobileInteraction:re.mobileInteraction,customHoverBehavior:re.customHoverBehavior,customClickBehavior:re.customClickBehavior}),...M&&M.length>0&&{annotations:M},..._&&{xExtent:_},...P&&{yExtent:P},...re.crosshairProps,...R};return re.earlyReturn?re.earlyReturn:ue?(0,av.jsx)(lp,{componentName:"StackedAreaChart",message:ue,width:Y,height:G}):(0,av.jsx)(fp,{componentName:"StackedAreaChart",width:Y,height:G,children:(0,av.jsx)(Ld,{ref:o,...de})})});lv.displayName="StackedAreaChart";var cv=require("react"),uv=require("d3-scale");L();var dv=require("react/jsx-runtime"),hv=(0,cv.forwardRef)(function(e,t){const o=(0,cv.useRef)(null);qy(t,{variant:"xy",frameRef:o});const n=Ly(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:d,colorScheme:h,customColorScale:f,showValues:m=!1,valueFormat:p,cellBorderColor:g="#fff",cellBorderWidth:y=1,tooltip:b,annotations:v,xExtent:x,yExtent:k,frameProps:w={},selection:S,linkedHover:A,onObservation:C,onClick:M,hoverHighlight:_,chartId:R,loading:j,loadingContent:L,emptyContent:T,showLegend:I,legendPosition:$,legend:N,legendInteraction:D}=e,{width:E,height:O,enableHover:B,title:F,description:z,summary:H,accessibleTable:W,xLabel:q,yLabel:Y}=n,G=yp(j,E,O,L),V=G?null:gp(r,E,O,T),X=(0,cv.useMemo)(()=>yt(r),[r]),U=function(){const e=Wg();return e?.colors?.sequential||void 0}(),K=h??U??"blues",Q=I??!1,Z=$??"right",{customHoverBehavior:J,customClickBehavior:ee,crosshairSourceId:te}=Ry({selection:S,linkedHover:A,fallbackFields:[],onObservation:C,onClick:M,chartType:"Heatmap",chartId:R,hoverHighlight:_,colorByField:void 0,mobileInteraction:n.mobileInteraction});zy(S);const oe=jy(A,te);Sy(D,void 0,[]);const ne=(0,cv.useMemo)(()=>"function"==typeof c?e=>c(e):e=>e[c],[c]),re=(0,cv.useMemo)(()=>P(X.map(ne)),[X,ne]),ie=(0,cv.useMemo)(()=>{if("custom"===K&&f)return f;const e=so(K);return(0,uv.scaleSequential)(e).domain(re)},[K,f,re]),se=(0,cv.useMemo)(()=>{const e=Number.isFinite(y)?Math.max(0,y):1;return()=>({stroke:g,strokeWidth:e})},[g,y]),ae=(0,cv.useMemo)(()=>id([{label:q||ed(a),accessor:a,role:"x",format:u},{label:Y||ed(l),accessor:l,role:"y",format:d},{label:ed(c),accessor:c,role:"value",format:p}]),[a,l,q,Y,c,u,d,p]),le=Dy({componentName:"Heatmap",data:r,accessors:{xAccessor:a,yAccessor:l,valueAccessor:c}}),ce=(0,cv.useMemo)(()=>{if(Q)return{gradient:{colorFn:e=>ie(e),domain:re,label:"string"==typeof c?c:"value",format:p},legendDistance:N?.legendDistance}},[Q,ie,re,c,p,N?.legendDistance]),{margin:ue}=wy({data:[],colorBy:void 0,colorScale:void 0,showLegend:!1,legendPosition:Z,userMargin:i,defaults:n.marginDefaults,additionalLegend:ce,chartWidth:E,legendLayout:w.legendLayout,hasTitle:!!F,axisChrome:{hasAxis:!1!==n.showAxes,hasAxisLabel:!!q}}),de={chartType:"heatmap",...null!=r&&{data:X},xAccessor:a,yAccessor:l,valueAccessor:c,colorScheme:"custom"!==K?K:void 0,areaStyle:se,showValues:m,heatmapValueFormat:p,size:[E,O],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ue,showAxes:n.showAxes,xLabel:q,yLabel:Y,xFormat:u,yFormat:d,enableHover:B,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...ce&&{legend:ce,legendPosition:Z},...og({title:F,description:z,summary:H,accessibleTable:W,className:s,animate:e.animate,maxDevicePixelRatio:e.maxDevicePixelRatio,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...rg({tooltip:b,defaultTooltipContent:ae}),...ng({linkedHover:A,selection:S,onObservation:C,onClick:M,hoverHighlight:_,mobileInteraction:n.mobileInteraction,customHoverBehavior:J,customClickBehavior:ee}),...v&&v.length>0&&{annotations:v},...x&&{xExtent:x},...k&&{yExtent:k},...oe,...w};return G||V||(le?(0,dv.jsx)(lp,{componentName:"Heatmap",message:le,width:E,height:O}):(0,dv.jsx)(fp,{componentName:"Heatmap",width:E,height:O,children:(0,dv.jsx)(Ld,{ref:o,...de})}))});hv.displayName="Heatmap";var fv=require("react"),mv=require("react/jsx-runtime"),pv=(0,fv.forwardRef)(function(e,t){const o=(0,fv.useRef)(null),n=Ly(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:d,sizeRange:h=[5,40],colorBy:f,colorScheme:m,styleRules:p,bubbleOpacity:g=.6,bubbleStrokeWidth:y=1,bubbleStrokeColor:b="white",tooltip:v,marginalGraphics:x,pointIdAccessor:k,annotations:w,regression:S,xExtent:A,yExtent:C,frameProps:M={},selection:_,linkedHover:P,linkedBrush:R,onObservation:j,onClick:L,hoverHighlight:T,chartId:I,loading:$,loadingContent:N,emptyContent:D,legendInteraction:E,legendPosition:O,color:B,stroke:F,strokeWidth:z,opacity:H}=e,{width:W,height:q,enableHover:Y,showGrid:G,showLegend:V,title:X,description:U,summary:K,accessibleTable:Q,xLabel:Z,yLabel:J}=n,ee=(0,fv.useMemo)(()=>yt(r),[r]),te=void 0===r,oe=Hy({data:ee,rawData:r,colorBy:f,colorScheme:m,legendInteraction:E,legendPosition:O,selection:_,linkedHover:P,fallbackFields:f?["string"==typeof f?f:""]:[],unwrapData:!1,onObservation:j,onClick:L,hoverHighlight:T,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"BubbleChart",chartId:I,showLegend:V,userMargin:i,marginDefaults:n.marginDefaults,loading:$,loadingContent:N,emptyContent:D,width:W,height:q,hasTitle:!!X,axisChrome:os({showAxes:n.showAxes,xLabel:Z})}),{domain:ne,trackPushed:re,reset:ie}=ab({accessor:d,data:ee,isPushMode:te}),se=(0,fv.useCallback)(e=>{re([e]),o.current?.push(e)},[re]),ae=(0,fv.useCallback)(e=>{re(e),o.current?.pushMany(e)},[re]);qy(t,{variant:"xy",frameRef:o,overrides:{push:se,pushMany:ae,clear:()=>{ie(),o.current?.clear()}}});const le=fg(R),ce=(_g({name:le?.name||"__unused_brush__",xField:le?.xField||("string"==typeof c?c:void 0),yField:le?.yField||("string"==typeof u?u:void 0)}),(0,fv.useMemo)(()=>({stroke:b,strokeWidth:y}),[b,y])),ue=(0,fv.useMemo)(()=>ne??[0,1],[ne]),de=(0,fv.useCallback)(e=>Co(e,d,h,ue),[d,h,ue]),he=(0,fv.useMemo)(()=>Xy(c,u),[c,u]),fe=ib({colorBy:f,colorScale:oe.colorScale,color:B,fillOpacity:g,radiusFn:de,baseStyleExtras:ce,stroke:F,strokeWidth:z,opacity:H,styleRules:p,ruleContext:he,effectiveSelectionHook:oe.effectiveSelectionHook,resolvedSelection:oe.resolvedSelection}),me=(0,fv.useMemo)(()=>id([{label:Z||ed(c),accessor:c,role:"x",format:a},{label:J||ed(u),accessor:u,role:"y",format:l},{label:ed(d),accessor:d,role:"size"},...f?[{label:ed(f),accessor:f,role:"color"}]:[]]),[c,u,Z,J,d,f,a,l]);if(oe.earlyReturn)return oe.earlyReturn;const pe=Dy({componentName:"BubbleChart",data:r,accessors:{xAccessor:c,yAccessor:u},requiredProps:{sizeBy:d}});if(pe)return(0,mv.jsx)(lp,{componentName:"BubbleChart",message:pe,width:W,height:q});const ge=lb(S),ye=ge?[ge,...w||[]]:w,be={chartType:"bubble",...null!=r&&{data:ee},xAccessor:c,yAccessor:u,colorAccessor:f||void 0,sizeAccessor:d,sizeRange:h,pointStyle:fe,colorScheme:m,size:[W,q],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:oe.margin,showAxes:n.showAxes,xLabel:Z,yLabel:J,xFormat:a,yFormat:l,enableHover:Y,showGrid:G,...oe.legendBehaviorProps,...og({title:X,description:U,summary:K,accessibleTable:Q,className:s,animate:e.animate,maxDevicePixelRatio:e.maxDevicePixelRatio,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...rg({tooltip:v,defaultTooltipContent:me}),...ng({linkedHover:P,selection:_,onObservation:j,onClick:L,hoverHighlight:T,mobileInteraction:oe.mobileInteraction,customHoverBehavior:oe.customHoverBehavior,customClickBehavior:oe.customClickBehavior}),...x&&{marginalGraphics:x},...k&&{pointIdAccessor:k},...ye&&ye.length>0&&{annotations:ye},...A&&{xExtent:A},...C&&{yExtent:C},...oe.crosshairProps,...M};return(0,mv.jsx)(fp,{componentName:"BubbleChart",width:W,height:q,children:(0,mv.jsx)(Ld,{ref:o,...be})})});pv.displayName="BubbleChart";var gv=d(require("react")),yv=require("react");L();var bv=d(require("react")),vv=require("react/jsx-runtime"),xv=null,kv=null;function wv(e){const[t,o]=bv.useState(()=>xv);return bv.useEffect(()=>{if(t)return;let e=!1;return(xv?Promise.resolve(xv):(kv||(kv=Promise.resolve().then(()=>(pe(),ce)).then(e=>xv=e.ScatterplotMatrixBrushOverlay).catch(e=>{throw kv=null,e})),kv)).then(t=>{e||o(()=>t)}).catch(()=>{}),()=>{e=!0}},[t]),t?(0,vv.jsx)(t,{...e}):null}var Sv=require("react/jsx-runtime"),Av="__splomIdx",Cv="splom-hover-source",Mv={top:4,bottom:4,left:4,right:4};function _v({data:e,xField:t,yField:o,cellSize:n,pointRadius:r,pointOpacity:i,colorBy:s,colorScale:a,brushSelectionName:l,hoverSelectionName:c,unselectedOpacity:u,maxDevicePixelRatio:d,mobileInteraction:h,mode:f,onPointHover:m,onPointClick:p}){const g=(0,yv.useRef)(null),y=Sg({name:l,clientId:`splom-${t}-${o}`,fields:[t,o]}),b=_g({name:l,xField:t,yField:o}),v=Sg({name:c,clientId:Cv,fields:[Av]}),x=v.selectPoints,k=(0,yv.useCallback)(e=>{e?b.brushInteraction.during(e):b.brushInteraction.end(null)},[b.brushInteraction]),w=(0,yv.useCallback)(e=>{if(!e)return void m?.(null);const t=e.data,o=t?.[Av];void 0!==o&&(x({[Av]:[o]}),m?.(t,e.x+Mv.left,e.y+Mv.top))},[x,m]),S=(0,yv.useCallback)(e=>{if(!e)return void p?.(null);const t=e.data;t&&p?.(t,e.x+Mv.left,e.y+Mv.top)},[p]),A=(0,yv.useCallback)(e=>{const t={opacity:i,r:r};return t.fill=s?wo(e,s,a):yo,"hover"===f?v.isActive&&v.predicate(e)?(t.opacity=1,t.r=2.5*r,t.stroke="#333",t.strokeWidth=1.5):v.isActive&&(t.opacity=.6*i):y.isActive&&!y.predicate(e)&&(t.opacity=u),t},[i,r,s,f,a,v,y,u]);return(0,Sv.jsxs)("div",{style:{position:"relative",width:n,height:n},children:[(0,Sv.jsx)(Ld,{ref:g,chartType:"scatter",data:e,size:[n,n],xAccessor:t,yAccessor:o,pointStyle:A,margin:Mv,showAxes:!1,maxDevicePixelRatio:d,enableHover:"hover"===f,...ng({forceHoverBehavior:"hover"===f,forceClickBehavior:!!p,mobileInteraction:h,customHoverBehavior:w,customClickBehavior:S}),tooltipContent:"hover"===f?()=>null:void 0}),"brush"===f&&(0,Sv.jsx)(wv,{frameRef:g,cellSize:n,onBrush:k})]})}function Pv({data:e,field:t,label:o,cellSize:n,bins:r,colorBy:i,colorScale:s,brushSelectionName:a,hoverSelectionName:l,mode:c}){const u=Sg({name:a,clientId:"splom-diag-"+t,fields:[t]}),d=Sg({name:l,clientId:`splom-diag-${t}-hover`,fields:[Av]}),h="hover"===c?d:u,f=h.isActive,m=h.predicate,p=(0,yv.useMemo)(()=>{const o="string"==typeof i?i:null,s=[],a=new Set;for(const n of e){const e=n[t];if(null==e||isNaN(e)||s.push(Number(e)),o){const e=n[o];null!=e&&a.add(e+"")}}if(0===s.length)return{bars:[],selectedBars:[],categoryBars:[],selectedCategoryBars:[],max:0,categories:[]};const[l,c]=P(s),u=(c-l)/r||1,d=Array.from(a),h=new Map(d.map((e,t)=>[e,t])),p=Array(r).fill(0),g=Array(r).fill(0),y=Array.from({length:r},()=>Array(d.length).fill(0)),b=Array.from({length:r},()=>Array(d.length).fill(0));for(const n of e){const e=n[t];if(null==e||isNaN(e))continue;const i=Math.min(Math.floor((e-l)/u),r-1);if(p[i]++,f&&!m(n)||g[i]++,o){const e=h.get(n[o]+"");void 0!==e&&(y[i][e]++,f&&!m(n)||b[i][e]++)}}const v=R(p,1),x=y.map((e,t)=>{let o=0;return e.map((e,i)=>{const s=e/v*(n-24),a={x:t/r*n,w:n/r-1,h:s,y0:o,category:d[i]};return o+=s,a})}),k=b.map((e,t)=>{let o=0;return e.map((e,i)=>{const s=e/v*(n-24),a={x:t/r*n,w:n/r-1,h:s,y0:o,category:d[i]};return o+=s,a})});return{bars:p.map((e,t)=>({x:t/r*n,w:n/r-1,h:e/v*(n-24),count:e})),selectedBars:g.map((e,t)=>({x:t/r*n,w:n/r-1,h:e/v*(n-24),count:e})),categoryBars:x,selectedCategoryBars:k,max:v,categories:d}},[e,t,r,n,f,m,i]);return(0,Sv.jsxs)("svg",{width:n,height:n,style:{overflow:"hidden"},children:[(0,Sv.jsx)("text",{x:n/2,y:14,textAnchor:"middle",fontSize:11,fontWeight:"bold",fill:"#333",children:o}),p.categories.length>0?p.categoryBars.map((e,t)=>e.map((e,o)=>(0,Sv.jsx)("rect",{x:e.x,y:n-e.y0-e.h,width:Math.max(e.w,1),height:e.h,fill:s?s(e.category):yo,opacity:f?.3:.6},`bg-${t}-${o}`))):p.bars.map((e,t)=>(0,Sv.jsx)("rect",{x:e.x,y:n-e.h,width:Math.max(e.w,1),height:e.h,fill:yo,opacity:f?.3:.6},"bg-"+t)),f&&(p.categories.length>0?p.selectedCategoryBars.map((e,t)=>e.map((e,o)=>(0,Sv.jsx)("rect",{x:e.x,y:n-e.y0-e.h,width:Math.max(e.w,1),height:e.h,fill:s?s(e.category):yo,opacity:.7},`sel-${t}-${o}`))):p.selectedBars.map((e,t)=>(0,Sv.jsx)("rect",{x:e.x,y:n-e.h,width:Math.max(e.w,1),height:e.h,fill:yo,opacity:.7},"sel-"+t)))]})}function Rv({label:e,cellSize:t}){return(0,Sv.jsx)("svg",{width:t,height:t,children:(0,Sv.jsx)("text",{x:t/2,y:t/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:12,fontWeight:"bold",fill:"#333",children:e})})}function jv(e){const{data:t,fields:o,fieldLabels:n={},colorBy:r,colorScheme:i,cellSize:s=150,cellGap:a=4,pointRadius:l=2,pointOpacity:c=.5,diagonal:u="histogram",histogramBins:d=20,brushMode:h="crossfilter",hoverMode:f=!0,unselectedOpacity:m=.1,showGrid:p=!1,maxDevicePixelRatio:g,tooltip:y,showLegend:b,idAccessor:v,width:x,className:k,onObservation:w,onClick:S,chartId:A}=e,C="splom",M="splom-hover",_=Ug(e.mobileInteraction,{mode:e.mode,width:x??o.length*s,mobileSemantics:e.mobileSemantics}),P=f?"hover":h?"brush":"hover",R=wg(e=>e.clearSelection),[j,L]=(0,yv.useState)(null),T=(0,yv.useCallback)(()=>{R(M),L(null)},[R,M]),I=(0,yv.useMemo)(()=>(t||[]).map((e,t)=>void 0!==e[Av]?e:{...e,[Av]:t}),[t]),$=_y(I,r,i),N=(0,yv.useCallback)((e,t,o,n)=>[40+e*(s+a)+(o??0),t*(s+a)+(n??0)],[40,s,a]),D=void 0!==b?b:!!r,E=(0,yv.useMemo)(()=>{if(!D||!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:$?$(e+""):yo})):null},[D,r,I,$]),O=(0,yv.useMemo)(()=>({display:"grid",gridTemplateColumns:"40px "+o.map(()=>s+"px").join(" "),gridTemplateRows:o.map(()=>s+"px").join(" ")+" 40px",gap:a+"px",width:"fit-content"}),[o,s,a,40]);return(0,Sv.jsxs)("div",{className:k,style:{position:"relative"},children:[E&&(0,Sv.jsx)("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"},children:E.map(e=>(0,Sv.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4},children:[(0,Sv.jsx)("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",backgroundColor:e.color}}),(0,Sv.jsx)("span",{style:{fontSize:11},children:e.label})]},e.label))}),(0,Sv.jsxs)("div",{style:O,onMouseLeave:"hover"===P?T:void 0,children:[o.map((e,t)=>(0,Sv.jsxs)(gv.Fragment,{children:[(0,Sv.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:11,fontWeight:"bold",color:"#333"},children:n[e]||e}),o.map((o,i)=>t===i?"label"===u?(0,Sv.jsx)(Rv,{label:n[e]||e,cellSize:s},"diag-"+e):(0,Sv.jsx)(Pv,{data:I,field:e,label:n[e]||e,cellSize:s,bins:d,colorBy:r,colorScale:$,brushSelectionName:C,hoverSelectionName:M,unselectedOpacity:m,mode:P},"diag-"+e):(0,Sv.jsx)(_v,{data:I,xField:o,yField:e,fieldLabels:n,cellSize:s,pointRadius:l,pointOpacity:c,colorBy:r,colorScale:$,brushSelectionName:C,hoverSelectionName:M,unselectedOpacity:m,showGrid:p,maxDevicePixelRatio:g,tooltip:y,mobileInteraction:_,mode:P,onPointHover:"hover"===P?(n,r,s)=>{if(n){if(L({datum:n,xField:o,yField:e,colIndex:i,rowIndex:t,px:r??0,py:s??0}),w){const[e,o]=N(i,t,r,s);w({type:"hover",datum:n,x:e,y:o,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:A})}}else L(null),w&&w({type:"hover-end",timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:A})}:void 0,onPointClick:S||w?(e,o,n)=>{if(!e)return;const[r,s]=N(i,t,o,n);S&&S(e,{x:r,y:s}),w&&w({type:"click",datum:e,x:r,y:s,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:A})}:void 0},`cell-${e}-${o}`))]},"row-"+e)),(0,Sv.jsx)("div",{})," ",o.map(e=>(0,Sv.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:"bold",color:"#333"},children:n[e]||e},"col-label-"+e))]}),j&&"hover"===P&&(()=>{const e=j.datum,t=n[j.xField]||j.xField,o=n[j.yField]||j.yField,i=r?"function"==typeof r?r(e):e[r]:null,l=v?"function"==typeof v?v(e):e[v]:"Row "+e[Av];return(0,Sv.jsxs)("div",{style:{position:"absolute",left:40+j.colIndex*(s+a)+j.px,top:j.rowIndex*(s+a)+j.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,Sv.jsx)("div",{style:{fontWeight:"bold",marginBottom:2},children:l+""}),(0,Sv.jsxs)("div",{children:[t,": ",null!=e[j.xField]?Number(e[j.xField]).toFixed(1):"–"]}),(0,Sv.jsxs)("div",{children:[o,": ",null!=e[j.yField]?Number(e[j.yField]).toFixed(1):"–"]}),null!=i&&(0,Sv.jsxs)("div",{style:{opacity:.8},children:["string"==typeof r?r:"group",": ",i+""]})]})})()]})}function Lv(e){const{brushMode:t="crossfilter",hoverMode:o=!0}=e,n={};return!o&&t&&(n.splom={resolution:t}),o&&(n["splom-hover"]={resolution:"union"}),(0,Sv.jsx)(vy,{selections:n,children:(0,Sv.jsx)(jv,{...e})})}Lv.displayName="ScatterplotMatrix";var Tv=require("react"),Iv=d(require("react")),$v=require("react/jsx-runtime"),Nv=null,Dv=null;function Ev(e){const[t,o]=Iv.useState(()=>Nv);return Iv.useEffect(()=>{if(t)return;let e=!1;return(Nv?Promise.resolve(Nv):(Dv||(Dv=Promise.resolve().then(()=>(be(),ge)).then(e=>Nv=e.MinimapBrushOverlay).catch(e=>{throw Dv=null,e})),Dv)).then(t=>{e||o(()=>t)}).catch(()=>{}),()=>{e=!0}},[t]),t?(0,$v.jsx)(t,{...e}):null}var Ov=require("react/jsx-runtime");function Bv(e){const{data:t,width:o=600,height:n=400,margin:r,className:i,title:s,description:a,summary:l,xLabel:c,yLabel:u,xFormat:d,yFormat:h,xAccessor:f="x",yAccessor:m="y",lineBy:p,lineDataAccessor:g="coordinates",colorBy:y,colorScheme:b,curve:v="linear",lineWidth:x=2,fillArea:k=!1,areaOpacity:w=.3,showPoints:S=!1,pointRadius:A=3,enableHover:C=!0,showGrid:M=!1,showLegend:_,legendPosition:P,tooltip:R,minimap:j={},renderBefore:L=!1,onBrush:T,brushExtent:I,yExtent:$,frameProps:N={},loading:D,loadingContent:E,emptyContent:O}=e,B=yp(D,o,n,E),F=B?null:gp(t,o,n,O),z=(0,Tv.useMemo)(()=>yt(t),[t]),[H,W]=(0,Tv.useState)(null),q=I??H,Y=(0,Tv.useCallback)(e=>{I||W(e),T?.(e)},[I,T]),G=(0,Tv.useRef)(null),[V,X]=(0,Tv.useState)(null);(0,Tv.useEffect)(()=>{let e=0,t=!1;const o=()=>{if(t)return;const n=G.current?.getScales?.();n?X(n):e=requestAnimationFrame(o)};return e=requestAnimationFrame(o),()=>{t=!0,e&&cancelAnimationFrame(e)}},[t]);const U=void 0!==z[0]?.[g],K=(0,Tv.useMemo)(()=>{if(U)return z;if(p){const e=z.reduce((e,t)=>{const o="function"==typeof p?p(t):t[p];if(!e[o]){const t={[g]:[]};"string"==typeof p&&(t[p]=o),e[o]=t}return e[o][g].push(t),e},{});return Object.values(e)}return[{[g]:z}]},[z,p,g,U]),Q=(0,Tv.useMemo)(()=>U||p?K.flatMap(e=>{const t=e[g]||[];return p&&"string"==typeof p?t.map(t=>({...t,[p]:e[p]})):t}):z,[K,g,U,p,z]),Z=_y(z,y,b),J=Ab({lineWidth:x,colorBy:y,colorScale:Z,fillArea:k,areaOpacity:w}),ee=(0,Tv.useMemo)(()=>{if(j.lineStyle)return j.lineStyle},[j.lineStyle]),te=Ab({lineWidth:1,colorBy:y,colorScale:Z}),oe=ee??te,ne=(0,Tv.useMemo)(()=>{if(S)return e=>{const t={r:A,fillOpacity:1};return t.fill=y?wo(e.parentLine||e,y,Z):yo,t}},[S,A,y,Z]),{legend:re,margin:ie,legendPosition:se}=wy({data:K,colorBy:y,colorScale:Z,showLegend:_,legendPosition:P,userMargin:r,chartWidth:o,hasTitle:!!s,axisChrome:{hasAxis:!0,hasAxisLabel:!!c}}),ae=j.height||60,le=(0,Tv.useMemo)(()=>({top:j.margin?.top??0,bottom:j.margin?.bottom??20,left:j.margin?.left??ie.left,right:j.margin?.right??ie.right}),[j.margin,ie]),ce=j.brushDirection||"x",ue=(0,Tv.useMemo)(()=>id([{label:c||ed(f),accessor:f,role:"x",format:d},{label:u||ed(m),accessor:m,role:"y",format:h}]),[f,m,c,u,d,h]),de=Dy({componentName:"MinimapChart",data:t,accessors:{xAccessor:f,yAccessor:m}});if(de)return(0,Ov.jsx)(lp,{componentName:"MinimapChart",message:de,width:o,height:n});const he=k?"area":"line",fe={chartType:he,data:Q,xAccessor:f,yAccessor:m,groupAccessor:p||void 0,curve:v,lineStyle:J,...S&&{pointStyle:ne},size:[o,n],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,...void 0!==e.maxDevicePixelRatio&&{maxDevicePixelRatio:e.maxDevicePixelRatio},margin:ie,showAxes:!0,xLabel:c,yLabel:u,xFormat:d,yFormat:h,enableHover:C,showGrid:M,...re&&{legend:re,legendPosition:se},...s&&{title:s},...a&&{description:a},...l&&{summary:l},tooltipContent:!1===R?()=>null:zc(R)||ue,...q&&{xExtent:q},...$&&{yExtent:$},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...N},me={chartType:he,data:Q,xAccessor:f,yAccessor:m,groupAccessor:p||void 0,curve:v,lineStyle:oe,...void 0!==e.maxDevicePixelRatio&&{maxDevicePixelRatio:e.maxDevicePixelRatio},size:[o,ae+le.top+le.bottom],margin:le,showAxes:j.showAxes??!1,background:j.background,enableHover:!1,...$&&{yExtent:$}},pe=(0,Ov.jsxs)("div",{style:{position:"relative",width:o,overflow:"hidden"},children:[(0,Ov.jsx)(Ld,{ref:G,...me}),(0,Ov.jsx)(Ev,{width:o-le.left-le.right,height:ae,margin:le,scales:V,brushDirection:ce,extent:q,onBrush:Y})]},"minimap"),ge=(0,Ov.jsx)("div",{style:{overflow:"hidden"},children:(0,Ov.jsx)(Ld,{...fe})},"main");return B||F||(0,Ov.jsx)(fp,{componentName:"MinimapChart",width:o,height:n,children:(0,Ov.jsxs)("div",{className:"minimap-chart"+(i?" "+i:""),children:[L?pe:ge,L?ge:pe]})})}Bv.displayName="MinimapChart";var Fv=require("react"),zv={label:"Low / High",color:"#E9C46A",opacity:.08},Hv={label:"High / High",color:"#2A9D8F",opacity:.08},Wv={label:"Low / Low",color:"#E76F51",opacity:.08},qv={label:"High / Low",color:"#86BBD8",opacity:.08};L();var Yv=require("react/jsx-runtime");function Gv(e,t){return{label:t?.label??e.label,color:t?.color??e.color,opacity:t?.opacity??e.opacity}}var Vv=(0,Fv.forwardRef)(function(e,t){const o=(0,Fv.useRef)(null);qy(t,{variant:"xy",frameRef:o});const n=Ly(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:d,yCenter:h,quadrants:f,centerlineStyle:m={},showQuadrantLabels:p=!0,quadrantLabelSize:g=12,colorBy:y,colorScheme:b,styleRules:v,sizeBy:x,sizeRange:k=[3,15],pointRadius:w=5,pointOpacity:S=.8,tooltip:A,pointIdAccessor:C,annotations:M,frameProps:_={},selection:R,linkedHover:j,onObservation:L,onClick:T,hoverHighlight:I,chartId:$,loading:N,loadingContent:D,emptyContent:E,legendInteraction:O,legendPosition:B,color:F,stroke:z,strokeWidth:H,opacity:W}=e,{width:q,height:Y,enableHover:G,showGrid:V,showLegend:X,title:U,description:K,summary:Q,accessibleTable:Z,xLabel:J,yLabel:ee}=n,te=(0,Fv.useMemo)(()=>({topLeft:Gv(zv,f?.topLeft),topRight:Gv(Hv,f?.topRight),bottomLeft:Gv(Wv,f?.bottomLeft),bottomRight:Gv(qv,f?.bottomRight)}),[f]),oe=(0,Fv.useMemo)(()=>yt(r),[r]),ne=Hy({data:oe,rawData:r,colorBy:y,colorScheme:b,legendInteraction:O,legendPosition:B,selection:R,linkedHover:j,fallbackFields:"string"==typeof y?[y]:[],unwrapData:!1,onObservation:L,onClick:T,hoverHighlight:I,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"QuadrantChart",chartId:$,showLegend:X,userMargin:i,marginDefaults:n.marginDefaults,loading:N,loadingContent:D,emptyContent:E,width:q,height:Y,hasTitle:!!U,axisChrome:os({showAxes:n.showAxes,xLabel:J})});bp("QuadrantChart",oe,"xAccessor",c),bp("QuadrantChart",oe,"yAccessor",u);const re=(0,Fv.useMemo)(()=>{if(!oe.length)return;const e="function"==typeof c?c:e=>+e[c],t="function"==typeof u?u:e=>+e[u];let o=1/0,n=-1/0,r=1/0,i=-1/0;for(const s of oe){const a=e(s),l=t(s);isFinite(a)&&(o>a&&(o=a),a>n&&(n=a)),isFinite(l)&&(r>l&&(r=l),l>i&&(i=l))}if(null!=d&&isFinite(d)&&(o>d&&(o=d),d>n&&(n=d)),null!=h&&isFinite(h)&&(r>h&&(r=h),h>i&&(i=h)),o===1/0)return;const s=.1*(n-o)||1,a=.1*(i-r)||1;return{xExtent:[o-s,n+s],yExtent:[r-a,i+a]}},[oe,c,u,d,h]),ie=(0,Fv.useMemo)(()=>{if(!x||0===oe.length)return;const e=oe.map(e=>"function"==typeof x?x(e):e[x]).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0!==e.length?P(e):void 0},[oe,x]),se=(0,Fv.useMemo)(()=>"function"==typeof c?c:e=>+e[c],[c]),ae=(0,Fv.useMemo)(()=>"function"==typeof u?u:e=>+e[u],[u]),le=(0,Fv.useMemo)(()=>e=>{const t=se(e),o=ae(e),n=null!=d?t>=d:void 0,r=null!=h?o>=h:void 0;return void 0===r||void 0===n?F||yo:r&&n?te.topRight.color:r&&!n?te.topLeft.color:!r&&n?te.bottomRight.color:te.bottomLeft.color},[se,ae,d,h,te,F]),ce=(0,Fv.useMemo)(()=>x?e=>Co(e,x,k,ie):void 0,[x,k,ie]),ue=(0,Fv.useMemo)(()=>Xy(c,u),[c,u]),de=ib({colorBy:y,colorScale:ne.colorScale,color:F,pointRadius:w,fillOpacity:S,radiusFn:ce,fallbackFill:le,stroke:z,strokeWidth:H,opacity:W,styleRules:v,ruleContext:ue,effectiveSelectionHook:ne.effectiveSelectionHook,resolvedSelection:ne.resolvedSelection}),he=(0,Fv.useMemo)(()=>{if(!oe.length)return;const e=new Set;"string"==typeof c&&e.add(c),"string"==typeof u&&e.add(u),"string"==typeof y&&e.add(y),"string"==typeof x&&e.add(x);const t=oe[0];for(const o of Object.keys(t))if(!o.startsWith("_")&&!e.has(o)&&"string"==typeof t[o])return o},[oe,c,u,y,x]),fe=(0,Fv.useMemo)(()=>id([...he?[{label:he,accessor:he,role:"title"}]:[],{label:J||ed(c),accessor:c,role:"x",format:a},{label:ee||ed(u),accessor:u,role:"y",format:l},...y?[{label:ed(y),accessor:y,role:"color"}]:[],...x?[{label:ed(x),accessor:x,role:"size"}]:[]]),[he,c,u,J,ee,y,x,a,l]),me=Dy({componentName:"QuadrantChart",data:r,accessors:{xAccessor:c,yAccessor:u}}),pe=(0,Fv.useMemo)(()=>{const e={stroke:m.stroke||"#999",strokeWidth:m.strokeWidth??1,dashArray:m.strokeDasharray||[]};return[(t,o,n,r)=>{if(!n?.x||!n?.y)return;const i=r.width,s=r.height,a=null!=d?n.x(d):i/2,l=null!=h?n.y(h):s/2;if(null!=d&&!isFinite(a))return;if(null!=h&&!isFinite(l))return;const c=Math.max(0,Math.min(i,a)),u=Math.max(0,Math.min(s,l)),f=[{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 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([])}]},[d,h,te,m]),ge=(0,Fv.useMemo)(()=>p?[...pe,(e,t,o,n)=>{if(!o?.x||!o?.y)return;const r=n.width,i=n.height,s=null!=d?o.x(d):r/2,a=null!=h?o.y(h):i/2;(null==d||isFinite(s))&&(null==h||isFinite(a))&&(e.font=`600 ${g}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,p,g,te,d,h]),ye=(0,Fv.useMemo)(()=>{const e=_.canvasPreRenderers||[];return[...ge,...e]},[ge,_.canvasPreRenderers]),be=(0,Fv.useMemo)(()=>{const e={stroke:m.stroke||"#999",strokeWidth:m.strokeWidth??1,dashArray:m.strokeDasharray?Array.isArray(m.strokeDasharray)?m.strokeDasharray.join(","):m.strokeDasharray:void 0};return[(t,o,n)=>{if(!o?.x||!o?.y)return null;const r=n.width,i=n.height,s=null!=d?o.x(d):r/2,a=null!=h?o.y(h):i/2;if(null!=d&&!isFinite(s))return null;if(null!=h&&!isFinite(a))return null;const l=Math.max(0,Math.min(r,s)),c=Math.max(0,Math.min(i,a));return(0,Yv.jsxs)(Yv.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,Yv.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,Yv.jsx)("line",{x1:l,y1:0,x2:l,y2:i,stroke:e.stroke,strokeWidth:e.strokeWidth,strokeDasharray:e.dashArray}),(0,Yv.jsx)("line",{x1:0,y1:c,x2:r,y2:c,stroke:e.stroke,strokeWidth:e.strokeWidth,strokeDasharray:e.dashArray}),p&&(0,Yv.jsxs)(Yv.Fragment,{children:[(0,Yv.jsx)("text",{x:8,y:8+g,fill:te.topLeft.color,fontWeight:600,fontSize:g,opacity:.5,children:te.topLeft.label}),(0,Yv.jsx)("text",{x:r-8,y:8+g,fill:te.topRight.color,fontWeight:600,fontSize:g,opacity:.5,textAnchor:"end",children:te.topRight.label}),(0,Yv.jsx)("text",{x:8,y:i-8,fill:te.bottomLeft.color,fontWeight:600,fontSize:g,opacity:.5,children:te.bottomLeft.label}),(0,Yv.jsx)("text",{x:r-8,y:i-8,fill:te.bottomRight.color,fontWeight:600,fontSize:g,opacity:.5,textAnchor:"end",children:te.bottomRight.label})]})]})}]},[d,h,te,m,p,g]);if(ne.earlyReturn)return ne.earlyReturn;const ve={chartType:"scatter",...null!=r&&{data:oe},xAccessor:c,yAccessor:u,colorAccessor:y||void 0,sizeAccessor:x||void 0,sizeRange:k,pointStyle:de,colorScheme:b,size:[q,Y],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,...void 0!==e.maxDevicePixelRatio&&{maxDevicePixelRatio:e.maxDevicePixelRatio},margin:ne.margin,showAxes:n.showAxes,xLabel:J,yLabel:ee,xFormat:a,yFormat:l,enableHover:G,showGrid:V,...re&&{xExtent:re.xExtent,yExtent:re.yExtent},...ne.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===A?()=>null:!0===A||void 0===A?fe:zc(A)||fe,...ng({linkedHover:j,selection:R,onObservation:L,onClick:T,hoverHighlight:I,mobileInteraction:ne.mobileInteraction,customHoverBehavior:ne.customHoverBehavior,customClickBehavior:ne.customClickBehavior}),...C&&{pointIdAccessor:C},...M&&M.length>0&&{annotations:M},canvasPreRenderers:ye,...ne.crosshairProps,..._,...ye.length>0&&{canvasPreRenderers:ye},svgPreRenderers:be};return me?(0,Yv.jsx)(lp,{componentName:"QuadrantChart",message:me,width:q,height:Y}):(0,Yv.jsx)(fp,{componentName:"QuadrantChart",width:q,height:Y,children:(0,Yv.jsx)(Ld,{ref:o,...ve})})});Vv.displayName="QuadrantChart";var Xv=d(require("react")),Uv=require("react"),Kv=require("react/jsx-runtime"),Qv="__ma_unitized",Zv="__ma_series";function Jv(e,t){const o=t[1]-t[0];return 0===o?.5:(e-t[0])/o}function ex(e,t){return t[0]+e*(t[1]-t[0])}var tx=(0,Uv.forwardRef)(function(e,t){const o=(0,Uv.useRef)(null),n=(0,Uv.useRef)([]),r=(0,Uv.useRef)(e.series);r.current=e.series,(0,Uv.useImperativeHandle)(t,()=>{const e=()=>(r.current??[]).filter(e=>null!=e&&"object"==typeof e);return{push:t=>{if(!o.current)return;const r=e(),i=t;for(let e=0;r.length>e&&2>e;e++){const t=r[e],s=t.extent||n.current[e];if(!s)continue;const a=("function"==typeof t.yAccessor?t.yAccessor:e=>e[t.yAccessor])(i);null!=a&&isFinite(a)&&o.current.push({...i,[Qv]:Jv(a,s),[Zv]:t.label||"Series "+(e+1)})}},pushMany:t=>{if(!o.current)return;const r=e(),i=[];for(const e of t)for(let t=0;r.length>t&&2>t;t++){const o=r[t],s=o.extent||n.current[t];if(!s)continue;const a=("function"==typeof o.yAccessor?o.yAccessor:e=>e[o.yAccessor])(e);null!=a&&isFinite(a)&&i.push({...e,[Qv]:Jv(a,s),[Zv]:o.label||"Series "+(t+1)})}o.current.pushMany(i)},remove:e=>o.current?.remove(e)??[],update:(e,t)=>o.current?.update(e,t)??[],clear:()=>o.current?.clear(),getData:()=>o.current?.getData()??[],getScales:()=>o.current?.getScales()??null}},[]);const i=Ly(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:d,colorScheme:h,curve:f="monotoneX",lineWidth:m=2,tooltip:p,annotations:g,frameProps:y={},selection:b,linkedHover:v,onObservation:x,onClick:k,hoverHighlight:w,chartId:S,loading:A,loadingContent:C,emptyContent:M,legendInteraction:_,legendPosition:P,stroke:R,strokeWidth:j,opacity:L}=e,{width:T,height:I,enableHover:$,showGrid:N,showLegend:D=!0,title:E,description:O,summary:B,accessibleTable:F,xLabel:z}=i,H=(0,Uv.useMemo)(()=>yt(s),[s]),W=(0,Uv.useMemo)(()=>yt(d),[d]),q=W,Y=2===W.length,G=(0,Uv.useMemo)(()=>Y?{...y.legendLayout,sideGutter:y.legendLayout?.sideGutter??70}:y.legendLayout,[y.legendLayout,Y]);"undefined"==typeof process||"production"===process.env?.NODE_ENV||Y||console.warn(`[MultiAxisLineChart] Expected exactly 2 series for dual-axis mode, got ${W.length}. Rendering as a standard multi-line chart.`);const V=yp(A,T,I,C),X=V?null:gp(s,T,I,M),U=Cy(),K=(0,Uv.useMemo)(()=>{let e;if(Array.isArray(h))e=h;else if(U&&U.length>0)e=U;else{const t=po[h];e=Array.isArray(t)?t:go}return q.map((t,o)=>t.color||e[o%e.length])},[q,h,U]),Q=(0,Uv.useMemo)(()=>W.map((e,t)=>e.label||"Series "+(t+1)),[W]),{unitizedData:Z,extents:J}=(0,Uv.useMemo)(()=>{if(0===H.length){const e=W.map(e=>e.extent||null).filter(Boolean);return e.length===W.length&&(n.current=e),{unitizedData:[],extents:e.length===W.length?e:[]}}const e=W.map(e=>e.extent||function(e,t){let o=1/0,n=-1/0;const r="function"==typeof t?t:e=>e[t];for(const t of e){const e=r(t);null!=e&&isFinite(e)&&(o>e&&(o=e),e>n&&(n=e))}if(!isFinite(o)||!isFinite(n))return[0,1];if(o===n){const e=0===o?1:.1*Math.abs(o);return[o-e,n+e]}return[o,n]}(H,e.yAccessor));if(n.current=e,!Y){const t=[];for(const e of H)for(let o=0;W.length>o;o++){const n=W[o],r=("function"==typeof n.yAccessor?n.yAccessor:e=>e[n.yAccessor])(e);null!=r&&t.push({...e,[Qv]:r,[Zv]:Q[o]})}return{unitizedData:t,extents:e}}const t=[];for(const o of H)for(let n=0;2>n;n++){const r=W[n],i=("function"==typeof r.yAccessor?r.yAccessor:e=>e[r.yAccessor])(o);null!=i&&t.push({...o,[Qv]:Jv(i,e[n]),[Zv]:Q[n]})}return{unitizedData:t,extents:e}},[H,W,Y,Q]),ee=(0,Uv.useMemo)(()=>{if(Y&&J.length>=2)return[{orient:"left",label:Q[0],tickFormat:W[0].format||(e=>{const t=ex(e,J[0]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"right",label:Q[1],tickFormat:W[1].format||(e=>{const t=ex(e,J[1]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"bottom"}]},[Y,J,W,Q]),te=Hy({data:(0,Uv.useMemo)(()=>Z.length>0?Z:Q.map(e=>({[Zv]:e})),[Z,Q]),rawData:s,colorBy:Zv,colorScheme:K,legendInteraction:_,legendPosition:P,selection:b,linkedHover:v,fallbackFields:[Zv],unwrapData:!1,onObservation:x,onClick:k,hoverHighlight:w,mobileInteraction:i.mobileInteraction,mobileSemantics:i.mobileSemantics,chartType:"MultiAxisLineChart",chartId:S,showLegend:D,legendLayout:G,userMargin:a,marginDefaults:Y?{...i.marginDefaults,left:70,right:70}:i.marginDefaults,loading:A,loadingContent:C,emptyContent:M,width:T,height:I,hasTitle:!!E,axisChrome:os({showAxes:i.showAxes,xLabel:z})}),oe=(0,Uv.useMemo)(()=>{const e=new Map;return Q.forEach((t,o)=>e.set(t,K[o])),e},[Q,K]),ne=Ab({lineWidth:m,resolveStroke:(0,Uv.useCallback)(e=>oe.get(e[Zv])||K[0],[oe,K]),stroke:R,strokeWidth:j,opacity:L,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection}),re=(0,Uv.useMemo)(()=>{if(!1===p)return()=>null;return zc(p)||(e=>{const t=e.data||e,o=t[Zv],n=Q.indexOf(o),r=t[Qv],i=Y&&n>=0&&J[n]?ex(r,J[n]):r,s=n>=0&&W[n]?.format?W[n].format:e=>Number.isInteger(e)?e+"":e.toFixed(2),a="function"==typeof u?u(t):t[u];return Xv.createElement("div",{style:{padding:"6px 10px",fontFamily:"var(--semiotic-font-family, sans-serif)",fontSize:"var(--semiotic-tooltip-font-size, 13px)"}},Xv.createElement("div",{style:{fontWeight:600,marginBottom:4,color:K[n]||"inherit"}},o),Xv.createElement("div",null,`${"string"==typeof u?u:"x"}: ${a}`),Xv.createElement("div",null,`${o}: ${s(i)}`))})},[p,Q,K,J,Y,W,u]);if(te.earlyReturn)return te.earlyReturn;const ie=Dy({componentName:"MultiAxisLineChart",data:s,accessors:{xAccessor:u}}),se=Y?[0,1]:void 0,ae={chartType:"line",...null!=s&&{data:Z},xAccessor:u,yAccessor:Qv,groupAccessor:Zv,lineStyle:ne,colorScheme:K,size:[T,I],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,...void 0!==e.maxDevicePixelRatio&&{maxDevicePixelRatio:e.maxDevicePixelRatio},margin:te.margin,showAxes:i.showAxes,...ee&&{axes:ee},xLabel:z,...Y?{}:{yLabel:Q[0]},xFormat:c,...Y&&se&&{yExtent:se},enableHover:$,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:N,curve:f,...te.legendBehaviorProps,...E&&{title:E},...O&&{description:O},...B&&{summary:B},...void 0!==F&&{accessibleTable:F},...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},...ng({linkedHover:v,selection:b,onObservation:x,onClick:k,hoverHighlight:w,mobileInteraction:te.mobileInteraction,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior}),...te.crosshairProps,...y,...G&&{legendLayout:G}};return V||X||(ie?(0,Kv.jsx)(lp,{componentName:"MultiAxisLineChart",message:ie,width:T,height:I}):(0,Kv.jsx)(fp,{componentName:"MultiAxisLineChart",width:T,height:I,children:(0,Kv.jsx)(Ld,{ref:o,...ae})}))});tx.displayName="MultiAxisLineChart";var ox=require("react"),nx=require("react/jsx-runtime"),rx=(0,ox.forwardRef)(function(e,t){const o=(0,ox.useRef)(null);qy(t,{variant:"xy",frameRef:o});const n=Ly(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:d="low",openAccessor:h,closeAccessor:f,candlestickStyle:m,tooltip:p,annotations:g,xExtent:y,yExtent:b,frameProps:v={},selection:x,linkedHover:k,onObservation:w,onClick:S,chartId:A,loading:C,loadingContent:M,emptyContent:_}=e,{width:P,height:R,enableHover:j,showGrid:L,title:T,description:I,summary:$,accessibleTable:N,xLabel:D,yLabel:E}=n,O=yp(C,P,R,M),B=O?null:gp(r,P,R,_),F=(0,ox.useMemo)(()=>yt(r),[r]),z=null==h||null==f;bp("CandlestickChart",F,"xAccessor",c),bp("CandlestickChart",F,"highAccessor",u),bp("CandlestickChart",F,"lowAccessor",d),z||(bp("CandlestickChart",F,"openAccessor",h),bp("CandlestickChart",F,"closeAccessor",f));const{customHoverBehavior:H,customClickBehavior:W,crosshairSourceId:q}=Ry({selection:x,linkedHover:k,onObservation:w,onClick:S,chartType:"CandlestickChart",chartId:A,mobileInteraction:n.mobileInteraction}),Y=jy(k,q),G=(0,ox.useMemo)(()=>{const e=n.marginDefaults,t="sparkline"===n.mode?{...e,top:0,bottom:0}:e;return null==i?t:{...t,...Lb(i)}},[i,n.marginDefaults,n.mode]),V=(0,ox.useMemo)(()=>{const e=[{label:D||ed(c),accessor:c,role:"x",format:a}];return z?(e.push({label:"High",accessor:u,role:"y",format:l}),e.push({label:"Low",accessor:d,format:l})):(e.push({label:"Open",accessor:h,format:l}),e.push({label:"High",accessor:u,format:l}),e.push({label:"Low",accessor:d,format:l}),e.push({label:"Close",accessor:f,format:l})),id(e)},[c,D,a,l,u,d,h,f,z]),X=Dy({componentName:"CandlestickChart",data:r,accessors:{xAccessor:c,highAccessor:u,lowAccessor:d,...!z&&{openAccessor:h,closeAccessor:f}}}),U={chartType:"candlestick",...null!=r&&{data:F},xAccessor:c,yAccessor:u,highAccessor:u,lowAccessor:d,...!z&&{openAccessor:h,closeAccessor:f},...m&&{candlestickStyle:m},scalePadding:Math.max(2,Math.min(12,Math.round(P/40))),extentPadding:P>200?.1:.02,size:[P,R],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:G,showAxes:n.showAxes,xLabel:D,yLabel:E,xFormat:a,yFormat:l,enableHover:j,showGrid:L,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...og({title:T,description:I,summary:$,accessibleTable:N,className:s,animate:e.animate,maxDevicePixelRatio:e.maxDevicePixelRatio,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...rg({tooltip:p,defaultTooltipContent:V}),...ng({linkedHover:k,selection:x,onObservation:w,onClick:S,mobileInteraction:n.mobileInteraction,customHoverBehavior:H,customClickBehavior:W}),...g&&g.length>0&&{annotations:g},...y&&{xExtent:y},...b&&{yExtent:b},...Y,...v};return O||B||(X?(0,nx.jsx)(lp,{componentName:"CandlestickChart",message:X,width:P,height:R}):(0,nx.jsx)(fp,{componentName:"CandlestickChart",width:P,height:R,children:(0,nx.jsx)(Ld,{ref:o,...U})}))});rx.displayName="CandlestickChart";var ix=require("react"),sx=require("react/jsx-runtime"),ax=(0,ix.forwardRef)(function(e,t){const{nodes:o,edges:n,layout:r,layoutConfig:i,onLayoutError:s,nodeIDAccessor:a="id",sourceAccessor:l="source",targetAccessor:c="target",margin:u,className:d,colorBy:h,colorScheme:f,selection:m,linkedHover:p,onObservation:g,onClick:y,chartId:b,annotations:v,autoPlaceAnnotations:x,frameProps:k={}}=e,{frameRef:w,resolved:S,normalizedMargin:A}=Tb({imperativeRef:t,imperativeVariant:"network",margin:u,width:e.width,height:e.height,enableHover:e.enableHover,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,mode:e.mode,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),C=(0,ix.useMemo)(()=>yt(o),[o]),M=(0,ix.useMemo)(()=>yt(n),[n]),_=(0,ix.useMemo)(()=>void 0===o&&void 0===n?void 0:[...C,...M],[n,o,M,C]),P=Ug(e.mobileInteraction,{mode:e.mode,width:S.width,mobileSemantics:e.mobileSemantics}),{customHoverBehavior:R,customClickBehavior:j,activeSelectionHook:L}=Ry({selection:m,linkedHover:p,fallbackFields:"string"==typeof h?[h]:[],onObservation:g,onClick:y,chartType:"NetworkCustomChart",chartId:b,colorByField:"string"==typeof h?h:void 0,mobileInteraction:P}),T=(0,ix.useMemo)(()=>L?.isActive?{isActive:!0,predicate:L.predicate}:null,[L?.isActive,L?.predicate]),{width:I,height:$,enableHover:N,title:D,description:E,summary:O,accessibleTable:B}=S,F=yp(e.loading,I,$,e.loadingContent),z=F?null:gp(_,I,$,e.emptyContent);if(F||z)return F||z;const H={chartType:"force",...null!=o&&{nodes:C},...null!=n&&{edges:M},customNetworkLayout:r,layoutConfig:i,onLayoutError:s,nodeIDAccessor:a,sourceAccessor:l,targetAccessor:c,colorBy:h,colorScheme:f,size:[I,$],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:A,enableHover:N,...og({title:D,description:E,summary:O,accessibleTable:B,className:d,animate:e.animate,maxDevicePixelRatio:e.maxDevicePixelRatio,autoPlaceAnnotations:x}),...ng({linkedHover:p,selection:m,onObservation:g,onClick:y,mobileInteraction:P,customHoverBehavior:R,customClickBehavior:j,linkedHoverInClickPredicate:!1}),layoutSelection:T,...null!=v&&{annotations:v},...k};return(0,sx.jsx)(fp,{componentName:"NetworkCustomChart",width:I,height:$,children:(0,sx.jsx)(tg,{ref:w,...H})})});ax.displayName="NetworkCustomChart";var lx=require("react"),cx=require("react/jsx-runtime"),ux=(0,lx.forwardRef)(function(e,t){const{data:o,layout:n,layoutConfig:r,onLayoutError:i,categoryAccessor:s="category",valueAccessor:a="value",oExtent:l,rExtent:c,projection:u="vertical",margin:d,className:h,colorBy:f,colorScheme:m,showAxes:p=!1,annotations:g,onObservation:y,onClick:b,selection:v,linkedHover:x,chartId:k,loading:w,loadingContent:S,emptyContent:A,frameProps:C={}}=e,{frameRef:M,resolved:_,safeData:P,setup:R,earlyReturn:j}=Ib({imperativeRef:t,imperativeVariant:"xy",chartTypeLabel:"OrdinalCustomChart",unwrapData:!0,data:o,colorBy:f,colorScheme:m,selection:v,linkedHover:x,onObservation:y,onClick:b,chartId:k,loading:w,loadingContent:S,emptyContent:A,margin:d,width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,mode:e.mode,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),L=R.effectiveSelectionHook,T=(0,lx.useMemo)(()=>L?.isActive?{isActive:!0,predicate:L.predicate}:null,[L?.isActive,L?.predicate]);if(j)return j;const{width:I,height:$,enableHover:N,showGrid:D,title:E,description:O,summary:B,accessibleTable:F}=_,z={chartType:"custom",...null!=o&&{data:P},customLayout:n,layoutConfig:r,onLayoutError:i,...T&&{layoutSelection:T},oAccessor:s,rAccessor:a,oExtent:l,rExtent:c,projection:u,colorAccessor:f,colorScheme:m,size:[I,$],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:R.margin,enableHover:N,showAxes:p,showGrid:D,annotations:g,...og({title:E,description:O,summary:B,accessibleTable:F,className:h,animate:e.animate,maxDevicePixelRatio:e.maxDevicePixelRatio,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...ng({linkedHover:x,selection:v,onObservation:y,onClick:b,hoverHighlight:!1,mobileInteraction:R.mobileInteraction,customHoverBehavior:R.customHoverBehavior,customClickBehavior:R.customClickBehavior}),...C};return(0,cx.jsx)(fp,{componentName:"OrdinalCustomChart",width:I,height:$,children:(0,cx.jsx)(Zh,{ref:M,...z})})});ux.displayName="OrdinalCustomChart";var dx=require("react"),hx=require("react");function fx({ref:e,frameRef:t,setup:o}){return(0,hx.useImperativeHandle)(e,()=>({push:e=>t.current?.push(e),pushMany:e=>t.current?.pushMany(e),remove:e=>t.current?.remove(e)??[],update:(e,o)=>t.current?.update(e,o)??[],replace:e=>t.current?.replace(e),clear:()=>t.current?.clear(),getData:()=>t.current?.getData()??[],getScales:()=>t.current?.getScales()??null}),[t]),{effectiveLegendProps:o.legendBehaviorProps,effectiveMargin:o.margin}}var mx=require("react");function px(e){const{colorBy:t,colorScale:o,color:n,themeCategorical:r,colorScheme:i,categoryIndexMap:s,userPieceStyle:a,stroke:l,strokeWidth:c,opacity:u,effectiveSelectionHook:d,resolvedSelection:h,cycleByCategory:f=!1,baseStyleExtras:m,linkStrokeToFill:p=!1,styleRules:g,resolveRuleValue:y}=e,b=(0,mx.useMemo)(()=>(e,a)=>{const l="function"==typeof m?m(e,a):m,c=l?{...l}:{};if(void 0===c.fill)if(t){if(!o)return c;c.fill=wo(e,t,o)}else c.fill=My(n,r,i,f?a:void 0,s);if(g&&g.length>0){const t=Jy(e,g,{value:y?y(e):void 0,category:a});Object.assign(c,t)}return p&&void 0===c.stroke&&void 0!==c.fill&&(c.stroke=c.fill),c},[t,o,n,r,i,s,f,m,p,g,y]),v=(0,mx.useMemo)(()=>Gy(a?"function"==typeof a?(e,t)=>({...b(e,t),...a(e,t)||{}}):(e,t)=>({...b(e,t),...a}):b,{stroke:l,strokeWidth:c,opacity:u}),[b,a,l,c,u]);return(0,mx.useMemo)(()=>pg(v,d??null,h),[v,d,h])}var gx=require("react/jsx-runtime"),yx=(0,dx.forwardRef)(function(e,t){const o=Ly(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=(0,dx.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="vertical",valueFormat:u,colorBy:d,colorScheme:h,sort:f=!1,barPadding:m=40,roundedTop:p,gradientFill:g=!1,styleRules:y,baselinePadding:b=!1,tooltip:v,annotations:x,regression:k,valueExtent:w,frameProps:S={},selection:A,linkedHover:C,onObservation:M,onClick:_,hoverHighlight:P,chartId:R,loading:j,loadingContent:L,emptyContent:T,legendInteraction:I,legendPosition:$,color:N,stroke:D,strokeWidth:E,opacity:O,showCategoryTicks:B,categoryFormat:F,dataIdAccessor:z}=e,{width:H,height:W,enableHover:q,showGrid:Y,showLegend:G,title:V,description:X,summary:U,accessibleTable:K,categoryLabel:Q,valueLabel:Z}=o,J=(0,dx.useMemo)(()=>yt(r),[r]),ee=Hy({data:J,rawData:r,colorBy:d,colorScheme:h,legendInteraction:I,legendPosition:$,selection:A,linkedHover:C,fallbackFields:d?["string"==typeof d?d:""]:[],unwrapData:!0,onObservation:M,onClick:_,hoverHighlight:P,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"BarChart",chartId:R,showLegend:G,userMargin:i,marginDefaults:o.marginDefaults,loading:j,loadingContent:L,emptyContent:T,width:H,height:W,hasTitle:!!V,axisChrome:ns({showAxes:o.showAxes,projection:"horizontal"===c?"horizontal":"vertical",hasCategoryLabel:!!Q,hasValueLabel:!!Z})}),{effectiveLegendProps:te,effectiveMargin:oe}=fx({ref:t,frameRef:n,setup:ee});bp("BarChart",J,"categoryAccessor",a),bp("BarChart",J,"valueAccessor",l);const ne=Py(J,f,l),re=Cy(),ie=(0,dx.useMemo)(()=>new Map,[]),se=(0,dx.useMemo)(()=>Vy(l),[l]),ae=px({colorBy:d,colorScale:ee.colorScale,color:N,themeCategorical:re,colorScheme:h,categoryIndexMap:ie,userPieceStyle:S?.pieceStyle,stroke:D,strokeWidth:E,opacity:O,styleRules:y,resolveRuleValue:se,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection}),le=(0,dx.useMemo)(()=>sd({categoryAccessor:a,valueAccessor:l,groupAccessor:d&&d!==a?d:void 0,groupLabel:"string"==typeof d?d:"group",valueFormat:u}),[a,l,d,u]),ce=(0,dx.useMemo)(()=>ln(g),[g]);if(ee.earlyReturn)return ee.earlyReturn;const ue=Dy({componentName:"BarChart",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(ue)return(0,gx.jsx)(lp,{componentName:"BarChart",message:ue,width:H,height:W});const de=lb(k),he=de?[de,...x||[]]:x,fe={chartType:"bar",...null!=r&&{data:ne},oAccessor:a,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",pieceStyle:ae,size:[H,W],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:oe,barPadding:m,...null!=p&&{roundedTop:p},...ce&&{gradientFill:ce},...z&&{dataIdAccessor:z},baselinePadding:b,enableHover:q,showAxes:o.showAxes,oLabel:Q,rLabel:Z,rFormat:u,...F&&{oFormat:F},showGrid:Y,showCategoryTicks:B,oSort:f,...te,...og({title:V,description:X,summary:U,accessibleTable:K,className:s,animate:e.animate,maxDevicePixelRatio:e.maxDevicePixelRatio,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...rg({tooltip:v,defaultTooltipContent:le}),...ng({linkedHover:C,selection:A,onObservation:M,onClick:_,hoverHighlight:P,mobileInteraction:ee.mobileInteraction,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior}),...he&&he.length>0&&{annotations:he},...w&&{rExtent:w},...Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e))};return(0,gx.jsx)(fp,{componentName:"BarChart",width:H,height:W,children:(0,gx.jsx)(Zh,{ref:n,...fe})})});yx.displayName="BarChart";var bx=require("react"),vx=require("react/jsx-runtime"),xx=(0,bx.forwardRef)(function(e,t){const o=Ly(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=(0,bx.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="category",stackBy:l,valueAccessor:c="value",orientation:u="vertical",valueFormat:d,colorBy:h,colorScheme:f,normalize:m=!1,sort:p=!1,barPadding:g=40,roundedTop:y,gradientFill:b,styleRules:v,baselinePadding:x=!1,tooltip:k,annotations:w,valueExtent:S,frameProps:A={},selection:C,linkedHover:M,onObservation:_,onClick:P,hoverHighlight:R,chartId:j,loading:L,loadingContent:T,emptyContent:I,legendInteraction:$,legendPosition:N,color:D,stroke:E,strokeWidth:O,opacity:B,categoryFormat:F}=e,{width:z,height:H,enableHover:W,showGrid:q,showLegend:Y,title:G,description:V,summary:X,accessibleTable:U,categoryLabel:K,valueLabel:Q}=o,Z=(0,bx.useMemo)(()=>yt(r),[r]),J=h||l,ee=Hy({data:Z,rawData:r,colorBy:J,colorScheme:f,legendInteraction:$,legendPosition:N,selection:C,linkedHover:M,fallbackFields:J?["string"==typeof J?J:""]:[],unwrapData:!0,onObservation:_,onClick:P,hoverHighlight:R,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"StackedBarChart",chartId:j,showLegend:Y,userMargin:i,marginDefaults:o.marginDefaults,loading:L,loadingContent:T,emptyContent:I,width:z,height:H,hasTitle:!!G,axisChrome:ns({showAxes:o.showAxes,projection:"horizontal"===u?"horizontal":"vertical",hasCategoryLabel:!!K,hasValueLabel:!!Q})}),te=Cy(),oe=(0,bx.useMemo)(()=>new Map,[]),ne=(0,bx.useMemo)(()=>Vy(c),[c]),re=px({colorBy:J,colorScale:ee.colorScale,color:D,themeCategorical:te,colorScheme:f,categoryIndexMap:oe,userPieceStyle:A?.pieceStyle,stroke:E,strokeWidth:O,opacity:B,styleRules:v,resolveRuleValue:ne,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection}),ie=(0,bx.useMemo)(()=>sd({categoryAccessor:l,valueAccessor:c,groupAccessor:a,valueFormat:d}),[l,a,c,d]),se=Dy({componentName:"StackedBarChart",data:r,accessors:{categoryAccessor:a,valueAccessor:c},requiredProps:{stackBy:l}}),{effectiveLegendProps:ae,effectiveMargin:le}=fx({ref:t,frameRef:n,setup:ee}),ce=(0,bx.useMemo)(()=>ln(b),[b]);if(ee.earlyReturn)return ee.earlyReturn;const ue={chartType:"bar",...null!=r&&{data:Z},oAccessor:a,rAccessor:c,stackBy:l,normalize:m,oSort:p,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:re,size:[z,H],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:le,barPadding:g,...null!=y&&{roundedTop:y},...ce&&{gradientFill:ce},baselinePadding:x,enableHover:W,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:K,rLabel:Q,rFormat:d,...F&&{oFormat:F},showGrid:q,...ae,...og({title:G,description:V,summary:X,accessibleTable:U,className:s,animate:e.animate,maxDevicePixelRatio:e.maxDevicePixelRatio,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...rg({tooltip:k,defaultTooltipContent:ie}),...ng({linkedHover:M,selection:C,onObservation:_,onClick:P,hoverHighlight:R,mobileInteraction:ee.mobileInteraction,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior}),...w&&w.length>0&&{annotations:w},...S&&{rExtent:S},...Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e))};return se?(0,vx.jsx)(lp,{componentName:"StackedBarChart",message:se,width:z,height:H}):(0,vx.jsx)(fp,{componentName:"StackedBarChart",width:z,height:H,children:(0,vx.jsx)(Zh,{ref:n,...ue})})});xx.displayName="StackedBarChart";var kx=d(require("react")),wx=require("react"),Sx=require("react"),Ax=require("react"),Cx={RdBu:ao,PiYG:lo,PRGn:co,BrBG:uo,RdYlBu:ho,RdYlGn:fo,Spectral:mo},Mx="__likert_neutral_neg",_x="__likert_neutral_pos";function Px(e,t){if("function"==typeof e)return e;const o=e||t;return e=>e[o]}function Rx(e,t,o,n,r,i){const s=new Map,a=new Set(t);for(const l of e){const e=o(l);s.has(e)||s.set(e,new Map);const c=s.get(e);if(n){const e=n(l);if(null==e||!Number.isFinite(e))continue;if(!Number.isInteger(e)){"production"!==process.env.NODE_ENV&&console.warn("[LikertChart] Ignoring non-integer Likert score:",e);continue}const o=e-1;if(0>o||o>=t.length)continue;const r=t[o];c.set(r,(c.get(r)||0)+1)}else if(r&&i){const e=r(l),t=i(l);if(!a.has(e))continue;c.set(e,(c.get(e)||0)+(Number.isFinite(t)?t:0))}}const l=[];for(const[e,o]of s){let n=0;for(const e of t)n+=o.get(e)||0;if(0!==n)for(let r=0;t.length>r;r++){const i=t[r],s=o.get(i)||0;l.push({__likertCategory:e,__likertLevel:i,__likertLevelLabel:i,__likertCount:s,__likertPct:s/n*100,__likertLevelIndex:r})}}return l}function jx(e,t){const o=t.length,n=o%2!=0,r=Math.floor(o/2),i=[];for(const t of e){const e=t.__likertLevelIndex;if(n&&e===r){const e=t.__likertPct/2;i.push({...t,__likertLevel:Mx,__likertPct:-e}),i.push({...t,__likertLevel:_x,__likertPct:e})}else i.push(r>e?{...t,__likertPct:-t.__likertPct}:t)}return i}function Lx(e,t){const o=t.length,n=o%2!=0,r=Math.floor(o/2),i=new Map;for(const t of e){const e=i.get(t.__likertCategory)||[];e.push(t),i.set(t.__likertCategory,e)}const s=[];for(const[,e]of i){const t=new Map;let i,a;for(const o of e)o.__likertLevel===Mx?i=o:o.__likertLevel===_x?a=o:t.set(o.__likertLevelIndex,o);n&&i&&s.push(i);for(let e=r-1;e>=0;e--){const o=t.get(e);o&&s.push(o)}n&&a&&s.push(a);for(let e=n?r+1:r;o>e;e++){const o=t.get(e);o&&s.push(o)}}return s}var Tx=["Very Low","Low","Neutral","High","Very High"],Ix=require("react/jsx-runtime"),$x=new Map,Nx=(0,wx.forwardRef)(function(e,t){const o=Ly(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=(0,wx.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="question",valueAccessor:l,levelAccessor:c,countAccessor:u="count",levels:d=Tx,orientation:h="horizontal",colorScheme:f,barPadding:m=20,tooltip:p,annotations:g,valueExtent:y,frameProps:b={},selection:v,linkedHover:x,onObservation:k,onClick:w,hoverHighlight:S,chartId:A,valueFormat:C,loading:M,loadingContent:_,emptyContent:P,legendInteraction:R,legendPosition:j,categoryFormat:L,stroke:T,strokeWidth:I,opacity:$}=e,{width:N,height:D,enableHover:E,showGrid:O,showLegend:B,title:F,description:z,summary:H,accessibleTable:W,categoryLabel:q,valueLabel:Y}=o,G="horizontal"===h,V=void 0===r,X=!c,U=function(){const e=Wg();return e?.colors?.diverging||void 0}(),K=(0,wx.useMemo)(()=>f&&Array.isArray(f)&&f.length>=d.length?f:function(e,t){if(0>=e)return[];if(t){const o=Cx[t];if(o){if(1===e)return[o(.5)];const t=[];for(let n=0;e>n;n++)t.push(o(n/(e-1)));return t}}const o=["#da1e28","#ff8389","#ffb3b8"],n=["#a6c8ff","#4589ff","#0043ce"],r="#a8a8a8";if(1===e)return[r];const i=e%2!=0,s=Math.floor(e/2),a=[];for(let e=0;s>e;e++)a.push(o[Math.min(Math.floor(e*o.length/s),o.length-1)]);i&&a.push(r);for(let e=0;s>e;e++)a.push(n[Math.min(Math.floor(e*n.length/s),n.length-1)]);return a}(d.length,U),[f,d.length,U]),Q=(0,wx.useMemo)(()=>{const e=new Map;for(let t=0;d.length>t;t++)e.set(d[t],K[t]||"#888");return e},[d,K]),{processedData:Z,reAggregate:J,accumulatorRef:ee}=function({data:e,levels:t,categoryAccessor:o,valueAccessor:n,levelAccessor:r,countAccessor:i,isDiverging:s,frameRef:a}){const l=!r,c=(0,Ax.useMemo)(()=>Px(o,"question"),[o]),u=(0,Ax.useMemo)(()=>l?Px(n,"score"):null,[l,n]),d=(0,Ax.useMemo)(()=>l?null:Px(r,"level"),[l,r]),h=(0,Ax.useMemo)(()=>l?null:Px(i,"count"),[l,i]),f=(0,Ax.useRef)([]);return{processedData:(0,Ax.useMemo)(()=>{const o=e||[];if(0===o.length)return[];let n=Rx(o,t,c,u,d,h);return s&&(n=jx(n,t),n=Lx(n,t)),n},[e,t,c,u,d,h,s]),reAggregate:(0,Ax.useCallback)(e=>{let o=Rx(e,t,c,u,d,h);s&&(o=jx(o,t),o=Lx(o,t)),a.current?.replace(o)},[t,c,u,d,h,s,a]),accumulatorRef:f}}({data:r,levels:d,categoryAccessor:a,valueAccessor:l,levelAccessor:c,countAccessor:u,isDiverging:G,frameRef:n}),te="__likertLevelLabel",oe=function({isPushMode:e,colorBy:t,colorScheme:o,showLegend:n,legendPosition:r="right"}){const i=(0,Sx.useRef)(new Set),s=(0,Sx.useRef)([]),[a,l]=(0,Sx.useState)(0),c=hg(),u=Cy(),d=(0,Sx.useCallback)(e=>{if(!t)return null;const o="function"==typeof t?t(e):e[t];return null!=o?o+"":null},[t]),h=(0,Sx.useCallback)(o=>{if(!e||!t)return;let n=!1;for(const e of o){if(!e||"object"!=typeof e)continue;const t=d(e);null==t||i.current.has(t)||(i.current.add(t),s.current.push(t),n=!0)}n&&l(e=>e+1)},[e,t,d]),f=(0,Sx.useCallback)(o=>{if(!e||!t)return;const n=Array.from(new Set(o.map(String))),r=s.current;r.length===n.length&&r.every((e,t)=>e===n[t])||(i.current=new Set(n),s.current=n,l(e=>e+1))},[e,t]),m=(0,Sx.useCallback)(e=>t=>{h([t]),e(t)},[h]),p=(0,Sx.useCallback)(e=>t=>{h(t),e(t)},[h]),g=(0,Sx.useCallback)(()=>{i.current=new Set,s.current=[],l(e=>e+1)},[]);py(e&&t?s.current:[]);const y=(0,Sx.useMemo)(()=>{if(!e||!t||!1===n)return;const r=s.current;if(0===r.length)return;const i=Array.isArray(o)&&o.length>0||"string"==typeof o&&o.length>0?o:u&&u.length>0?u:vo,a="string"==typeof t?t:"__streamCat",l=r.map(e=>({[a]:e})),d=Ao(l,a,i);return xy({data:l,colorBy:a,colorScale:e=>c?.[e]||d(e)||"#999",getColor:wo})},[e,t,n,o,c,u,a]),b=(0,Sx.useMemo)(()=>{if(y)return"right"===r?{right:110}:"left"===r?{left:110}:"top"===r?{top:50}:"bottom"===r?{bottom:80}:{right:110}},[y,r]);return{wrapPush:m,wrapPushMany:p,resetCategories:g,categories:s.current,categoryDomainProps:e&&t?{legendCategoryAccessor:t,onCategoriesChange:f}:{},streamingLegend:y,streamingMarginAdjust:b}}({isPushMode:V,colorBy:te,colorScheme:K,showLegend:B,legendPosition:j}),{wrapPush:ne,wrapPushMany:re}=oe,ie=(0,wx.useCallback)(e=>ne(e=>{ee.current.push(e),J(ee.current)})(e),[ne,J,ee]),se=(0,wx.useCallback)(e=>re(e=>{ee.current.push(...e),J(ee.current)})(e),[re,J,ee]);(0,wx.useImperativeHandle)(t,()=>({push:ie,pushMany:se,remove:e=>n.current?.remove(e)??[],update:(e,t)=>n.current?.update(e,t)??[],replace:e=>n.current?.replace(e),clear:()=>{ee.current=[],oe.resetCategories(),n.current?.clear()},getData:()=>n.current?.getData()??[],getScales:()=>n.current?.getScales()??null}),[ie,se,ee,oe]);const ae=Hy({data:Z,rawData:r,colorBy:te,colorScheme:K,legendInteraction:R,legendPosition:j,selection:v,linkedHover:x,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:k,onClick:w,hoverHighlight:S,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"LikertChart",chartId:A,showLegend:B,userMargin:i,marginDefaults:o.marginDefaults,loading:M,loadingContent:_,emptyContent:P,width:N,height:D,hasTitle:!!F,axisChrome:{hasAxis:!1!==o.showAxes,hasAxisLabel:G?!!Y:!!q}}),le=(0,wx.useMemo)(()=>{const e=d.length;return e%2!=0&&Q.get(d[Math.floor(e/2)])||"#888"},[d,Q]),ce=px({colorBy:void 0,colorScale:void 0,color:void 0,themeCategorical:void 0,colorScheme:void 0,categoryIndexMap:$x,userPieceStyle:b?.pieceStyle,stroke:T,strokeWidth:I,opacity:$,effectiveSelectionHook:ae.effectiveSelectionHook,resolvedSelection:ae.resolvedSelection,baseStyleExtras:e=>{const t=e.__likertLevelLabel||e.data?.__likertLevelLabel,o=e.__likertLevel||e.data?.__likertLevel;if(o===Mx||o===_x)return{fill:le};const n=t||o;return n&&Q.has(n)?{fill:Q.get(n)}:{fill:"#888"}}}),ue=(0,wx.useMemo)(()=>{const e=d.length;return e%2!=0?d[Math.floor(e/2)]:""},[d]),de=(0,wx.useMemo)(()=>e=>{const t=e.data||e,o=t.__likertLevel||"Unknown",n=o===Mx||o===_x?ue:o,r=t.__likertCategory||"",i=Math.abs(t.__likertPct||0),s=o===Mx||o===_x?2*i:i,a=t.__likertCount||0;return kx.createElement("div",{className:"semiotic-tooltip",style:Tc},kx.createElement("div",{style:{fontWeight:"bold"}},r),kx.createElement("div",{style:{marginTop:4}},`${n}: ${s.toFixed(1)}% (n=${a})`))},[ue]),he=(0,wx.useMemo)(()=>{if(!d||2>d.length)return"LikertChart requires `levels` with at least 2 entries.";if(l&&c)return"LikertChart: provide either `valueAccessor` (raw responses) or `levelAccessor` + `countAccessor` (pre-aggregated), not both.";if(c&&!u)return"LikertChart: pre-aggregated mode requires both `levelAccessor` and `countAccessor`.";if(void 0!==r&&0===r.length)return null;const e={categoryAccessor:a};return X?l&&(e.valueAccessor=l):(c&&(e.levelAccessor=c),u&&(e.countAccessor=u)),Dy({componentName:"LikertChart",data:r,accessors:e,requiredProps:{levels:d}})},[r,a,l,c,u,d,X]),fe=(0,wx.useMemo)(()=>[{styleFn:e=>({fill:Q.get(e.label)||"#888"}),items:d.map(e=>({label:e})),label:""}],[d,Q]),me=(0,wx.useMemo)(()=>!1!==B?{...ae.legendBehaviorProps,legend:{legendGroups:fe},legendPosition:j||ae.legendPosition||"bottom"}:ae.legendBehaviorProps,[ae.legendBehaviorProps,ae.legendPosition,j,B,fe]),pe=(0,wx.useMemo)(()=>{const e={...ae.margin};if(V&&!1!==B){const t=j||"bottom";"bottom"===t&&80>e.bottom?e.bottom=80:"top"===t&&50>e.top?e.top=50:"right"===t&&110>e.right?e.right=110:"left"===t&&110>e.left&&(e.left=110)}else if(oe.streamingMarginAdjust)for(const[t,o]of Object.entries(oe.streamingMarginAdjust))o>e[t]&&(e[t]=o);return G&&100>e.left&&(e.left=100),e},[ae.margin,oe.streamingMarginAdjust,G,V,B,j]),ge=(0,wx.useMemo)(()=>C||(G?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[G,C]);if(ae.earlyReturn)return ae.earlyReturn;const ye={chartType:"bar",...null!=r&&{data:Z},oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:G?"horizontal":"vertical",pieceStyle:ce,size:[N,D],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,maxDevicePixelRatio:e.maxDevicePixelRatio,margin:pe,barPadding:m,enableHover:E,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:q,rLabel:Y||(G?void 0:"Percentage"),rFormat:ge,...L&&{oFormat:L},showGrid:O,...me,...F&&{title:F},...z&&{description:z},...H&&{summary:H},...void 0!==W&&{accessibleTable:W},...s&&{className:s},...null!=e.animate&&{animate:e.animate},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},tooltipContent:!1===p?()=>null:!0===p?de:zc(p)||de,...ng({linkedHover:x,selection:v,onObservation:k,onClick:w,hoverHighlight:S,mobileInteraction:ae.mobileInteraction,customHoverBehavior:ae.customHoverBehavior,customClickBehavior:ae.customClickBehavior}),...g&&g.length>0&&{annotations:g},...y&&{rExtent:y},...Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e))};return he?(0,Ix.jsx)(lp,{componentName:"LikertChart",message:he,width:N,height:D}):(0,Ix.jsx)(fp,{componentName:"LikertChart",width:N,height:D,children:(0,Ix.jsx)(Zh,{ref:n,...ye})})});Nx.displayName="LikertChart";var Dx=require("react"),Ex=require("react");function Ox({brushProp:e,onBrushProp:t,linkedBrush:o,valueAccessor:n}){const r=(0,Ex.useMemo)(()=>fg("string"==typeof o?o:o?{name:o.name,xField:o.rField}:void 0),[o]),i="string"==typeof n?n:"value",s=_g({name:r?.name||"__unused_ordinal_brush__",xField:r?.xField||i}),a=(0,Ex.useRef)(s.brushInteraction);a.current=s.brushInteraction;const l=(0,Ex.useCallback)(e=>{if(r){a.current.end(e?e.r:null)}t?.(e)},[t,r]),c=!!(e||o||t);return{hasBrush:c,handleBrush:l,brushStreamProps:c?{brush:{dimension:"r"},onBrush:l}:{}}}L();var Bx=require("react/jsx-runtime"),Fx=(0,Dx.forwardRef)(function(e,t){const o=Ly(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=(0,Dx.useRef)(null);qy(t,{variant:"xy",frameRef:n});const{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="vertical",valueFormat:u,colorBy:d,colorScheme:h,sizeBy:f,sizeRange:m=[3,8],symbolBy:p,symbolMap:g,pointRadius:y=4,pointOpacity:b=.7,categoryPadding:v=20,tooltip:x,annotations:k,valueExtent:w,brush:S,onBrush:A,linkedBrush:C,frameProps:M={},selection:_,linkedHover:R,onObservation:j,onClick:L,hoverHighlight:T,chartId:I,loading:$,loadingContent:N,emptyContent:D,legendInteraction:E,legendPosition:O,color:B,stroke:F,strokeWidth:z,opacity:H,showCategoryTicks:W,categoryFormat:q}=e,{width:Y,height:G,enableHover:V,showGrid:X,showLegend:U,title:K,description:Q,summary:Z,accessibleTable:J,categoryLabel:ee,valueLabel:te}=o,oe=(0,Dx.useMemo)(()=>yt(r),[r]),ne=Hy({data:oe,rawData:r,colorBy:d,colorScheme:h,legendInteraction:E,legendPosition:O,selection:_,linkedHover:R,fallbackFields:d?["string"==typeof d?d:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:j,onClick:L,hoverHighlight:T,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"SwarmPlot",chartId:I,showLegend:U,userMargin:i,marginDefaults:o.marginDefaults,loading:$,loadingContent:N,emptyContent:D,width:Y,height:G,hasTitle:!!K,axisChrome:ns({showAxes:o.showAxes,projection:"horizontal"===c?"horizontal":"vertical",hasCategoryLabel:!!ee,hasValueLabel:!!te})}),re=Ox({brushProp:S,onBrushProp:A,linkedBrush:C,valueAccessor:l}),ie=(0,Dx.useMemo)(()=>{if(f)return P(oe.map(e=>"function"==typeof f?f(e):e[f]))},[oe,f]),se=Cy(),ae=(0,Dx.useMemo)(()=>new Map,[]),le=px({colorBy:d,colorScale:ne.colorScale,color:B,themeCategorical:se,colorScheme:h,categoryIndexMap:ae,userPieceStyle:M?.pieceStyle,stroke:F,strokeWidth:z,opacity:H,effectiveSelectionHook:ne.effectiveSelectionHook,resolvedSelection:ne.resolvedSelection,baseStyleExtras:e=>({fillOpacity:b,r:f?Co(e,f,m,ie):y})}),ce=(0,Dx.useMemo)(()=>sd({categoryAccessor:a,valueAccessor:l,groupAccessor:d||void 0,valueFormat:u}),[a,l,d,u]);if(ne.earlyReturn)return ne.earlyReturn;const ue=Dy({componentName:"SwarmPlot",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(ue)return(0,Bx.jsx)(lp,{componentName:"SwarmPlot",message:ue,width:Y,height:G});const de={chartType:"swarm",...null!=r&&{data:oe},oAccessor:a,rAccessor:l,...p&&{symbolAccessor:p},...g&&{symbolMap:g},projection:"horizontal"===c?"horizontal":"vertical",pieceStyle:le,size:[Y,G],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ne.margin,barPadding:v,enableHover:V,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:ee,rLabel:te,rFormat:u,...q&&{oFormat:q},showGrid:X,showCategoryTicks:W,...ne.legendBehaviorProps,...og({title:K,description:Q,summary:Z,accessibleTable:J,className:s,animate:e.animate,maxDevicePixelRatio:e.maxDevicePixelRatio,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...rg({tooltip:x,defaultTooltipContent:ce}),...ng({linkedHover:R,selection:_,onObservation:j,onClick:L,hoverHighlight:T,mobileInteraction:ne.mobileInteraction,customHoverBehavior:ne.customHoverBehavior,customClickBehavior:ne.customClickBehavior}),...k&&k.length>0&&{annotations:k},...w&&{rExtent:w},...re.brushStreamProps,...Object.fromEntries(Object.entries(M).filter(([e])=>"pieceStyle"!==e))};return(0,Bx.jsx)(fp,{componentName:"SwarmPlot",width:Y,height:G,children:(0,Bx.jsx)(Zh,{ref:n,...de})})});Fx.displayName="SwarmPlot";var zx=require("react"),Hx=require("react/jsx-runtime");function Wx(e){return t=>{const o=t.category||t.data&&t.data[0]?.category||"",n=t.stats||(t.data||t).stats;if(n&&null!=n.median)return(0,Hx.jsxs)("div",{className:"semiotic-tooltip",style:Tc,children:[o&&(0,Hx.jsx)("div",{style:{fontWeight:"bold"},children:o+""}),null!=n.n&&(0,Hx.jsxs)("div",{children:["n = ",n.n]}),null!=n.min&&(0,Hx.jsxs)("div",{children:["Min: ",n.min.toLocaleString()]}),null!=n.q1&&(0,Hx.jsxs)("div",{children:["Q1: ",n.q1.toLocaleString()]}),(0,Hx.jsxs)("div",{children:["Median: ",n.median.toLocaleString()]}),null!=n.q3&&(0,Hx.jsxs)("div",{children:["Q3: ",n.q3.toLocaleString()]}),null!=n.max&&(0,Hx.jsxs)("div",{children:["Max: ",n.max.toLocaleString()]}),null!=n.mean&&(0,Hx.jsxs)("div",{style:{opacity:.8},children:["Mean: ",n.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});if(e?.valueAccessor){const n=e.valueAccessor,r=(Array.isArray(t.data)?t.data:[]).map(e=>Number("function"==typeof n?n(e):e[n])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),i=r.length,s=i>0?i%2!=0?r[Math.floor(i/2)]:(r[i/2-1]+r[i/2])/2:null;return(0,Hx.jsxs)("div",{className:"semiotic-tooltip",style:Tc,children:[o&&(0,Hx.jsx)("div",{style:{fontWeight:"bold"},children:o+""}),i>0&&(0,Hx.jsxs)("div",{children:["n = ",i]}),null!=s&&(0,Hx.jsxs)("div",{children:["Median: ",s.toLocaleString()]})]})}return(0,Hx.jsx)("div",{className:"semiotic-tooltip",style:Tc,children:(0,Hx.jsx)("div",{style:{fontWeight:"bold"},children:o+""})})}}var qx=require("react/jsx-runtime"),Yx=(0,zx.forwardRef)(function(e,t){const o=Ly(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=(0,zx.useRef)(null);qy(t,{variant:"xy",frameRef:n});const{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="vertical",valueFormat:u,colorBy:d,colorScheme:h,showOutliers:f=!0,outlierRadius:m=3,categoryPadding:p=20,tooltip:g,annotations:y,valueExtent:b,frameProps:v={},selection:x,linkedHover:k,onObservation:w,onClick:S,hoverHighlight:A,chartId:C,loading:M,loadingContent:_,emptyContent:P,legendInteraction:R,legendPosition:j,color:L,stroke:T,strokeWidth:I,opacity:$,showCategoryTicks:N,categoryFormat:D}=e,{width:E,height:O,enableHover:B,showGrid:F,showLegend:z,title:H,description:W,summary:q,accessibleTable:Y,categoryLabel:G,valueLabel:V}=o,X=(0,zx.useMemo)(()=>yt(r),[r]),U=Hy({data:X,rawData:r,colorBy:d,colorScheme:h,legendInteraction:R,legendPosition:j,selection:x,linkedHover:k,fallbackFields:d?["string"==typeof d?d:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:w,onClick:S,hoverHighlight:A,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"BoxPlot",chartId:C,showLegend:z,userMargin:i,marginDefaults:o.marginDefaults,loading:M,loadingContent:_,emptyContent:P,width:E,height:O,hasTitle:!!H,axisChrome:ns({showAxes:o.showAxes,projection:"horizontal"===c?"horizontal":"vertical",hasCategoryLabel:!!G,hasValueLabel:!!V})}),K=Cy(),Q=(0,zx.useMemo)(()=>new Map,[]),Z=px({colorBy:d,colorScale:U.colorScale,color:L,themeCategorical:K,colorScheme:h,categoryIndexMap:Q,userPieceStyle:void 0,stroke:T,strokeWidth:I,opacity:$,effectiveSelectionHook:U.effectiveSelectionHook,resolvedSelection:U.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),J=(0,zx.useMemo)(()=>Wx(),[]);if(U.earlyReturn)return U.earlyReturn;const ee=Dy({componentName:"BoxPlot",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(ee)return(0,qx.jsx)(lp,{componentName:"BoxPlot",message:ee,width:E,height:O});const te={chartType:"boxplot",...null!=r&&{data:X},oAccessor:a,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",summaryStyle:Z,showOutliers:f,size:[E,O],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:U.margin,barPadding:p,enableHover:B,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:G,rLabel:V,rFormat:u,...D&&{oFormat:D},showGrid:F,showCategoryTicks:N,...U.legendBehaviorProps,...og({title:H,description:W,summary:q,accessibleTable:Y,className:s,animate:e.animate,maxDevicePixelRatio:e.maxDevicePixelRatio,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...rg({tooltip:g,defaultTooltipContent:J}),...ng({linkedHover:k,selection:x,onObservation:w,onClick:S,hoverHighlight:A,mobileInteraction:U.mobileInteraction,customHoverBehavior:U.customHoverBehavior,customClickBehavior:U.customClickBehavior}),...y&&y.length>0&&{annotations:y},...b&&{rExtent:b},...Object.fromEntries(Object.entries(v).filter(([e])=>"pieceStyle"!==e))};return(0,qx.jsx)(fp,{componentName:"BoxPlot",width:E,height:O,children:(0,qx.jsx)(Zh,{ref:n,...te})})});Yx.displayName="BoxPlot";var Gx=require("react"),Vx=require("react/jsx-runtime"),Xx=e=>{const t=e?.category;return null==t?"All":t+""},Ux=(0,Gx.forwardRef)(function(e,t){const o=Ly(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:"horizontal",mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=(0,Gx.useRef)(null);qy(t,{variant:"xy",frameRef:n});const{data:r,margin:i,className:s,categoryAccessor:a=Xx,valueAccessor:l="value",bins:c=25,relative:u=!1,valueFormat:d,colorBy:h,colorScheme:f,categoryPadding:m=("sparkline"===o.mode?0:20),tooltip:p,annotations:g,valueExtent:y,brush:b,onBrush:v,linkedBrush:x,frameProps:k={},selection:w,linkedHover:S,onObservation:A,onClick:C,hoverHighlight:M,chartId:_,loading:P,loadingContent:R,emptyContent:j,legendInteraction:L,legendPosition:T,color:I,stroke:$,strokeWidth:N,opacity:D,showCategoryTicks:E,categoryFormat:O}=e,{width:B,height:F,enableHover:z,showGrid:H,showLegend:W,title:q,description:Y,summary:G,accessibleTable:V,categoryLabel:X,valueLabel:U}=o,K=(0,Gx.useMemo)(()=>yt(r),[r]),Q=Hy({data:K,rawData:r,colorBy:h,colorScheme:f,legendInteraction:L,legendPosition:T,selection:w,linkedHover:S,fallbackFields:h?["string"==typeof h?h:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:A,onClick:C,hoverHighlight:M,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"Histogram",chartId:_,showLegend:W,userMargin:i,marginDefaults:o.marginDefaults,loading:P,loadingContent:R,emptyContent:j,width:B,height:F,hasTitle:!!q,axisChrome:ns({showAxes:o.showAxes,projection:"horizontal",hasCategoryLabel:!!X,hasValueLabel:!!U})}),Z=Ox({brushProp:b,onBrushProp:v,linkedBrush:x,valueAccessor:l}),J=(0,Gx.useMemo)(()=>{if(0===K.length)return;const e="function"==typeof l?l:e=>e[l];let t=1/0,o=-1/0;for(const n of K){const r=e(n);null!=r&&isFinite(r)&&(t>r&&(t=r),r>o&&(o=r))}return t>o?void 0:[t,o]},[K,l]),ee=Cy(),te=(0,Gx.useMemo)(()=>new Map,[]),oe=px({colorBy:h,colorScale:Q.colorScale,color:I,themeCategorical:ee,colorScheme:f,categoryIndexMap:te,userPieceStyle:void 0,stroke:$,strokeWidth:N,opacity:D,effectiveSelectionHook:Q.effectiveSelectionHook,resolvedSelection:Q.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),ne=(0,Gx.useMemo)(()=>e=>{const t=e.data||e,o=t.category||e.category||"",n=t.count,r=t.range;return(0,Vx.jsxs)("div",{className:"semiotic-tooltip",style:Tc,children:[o&&(0,Vx.jsx)("div",{style:{fontWeight:"bold"},children:o+""}),null!=n&&(0,Vx.jsxs)("div",{children:["Count: ",n]}),r&&2===r.length&&(0,Vx.jsxs)("div",{style:{opacity:.8},children:[Number(r[0]).toFixed(1)," – ",Number(r[1]).toFixed(1)]})]})},[]);if(Q.earlyReturn)return Q.earlyReturn;const re=Dy({componentName:"Histogram",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(re)return(0,Vx.jsx)(lp,{componentName:"Histogram",message:re,width:B,height:F});const ie={chartType:"histogram",...null!=r&&{data:K},oAccessor:a,rAccessor:l,projection:"horizontal",summaryStyle:oe,bins:c,normalize:u,...y?{rExtent:y}:J&&{rExtent:J},size:[B,F],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Q.margin,barPadding:m,enableHover:z,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:X,rLabel:U,rFormat:d,...O&&{oFormat:O},showGrid:H,showCategoryTicks:E,...Q.legendBehaviorProps,...og({title:q,description:Y,summary:G,accessibleTable:V,className:s,animate:e.animate,maxDevicePixelRatio:e.maxDevicePixelRatio,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...rg({tooltip:p,defaultTooltipContent:ne}),...ng({linkedHover:S,selection:w,onObservation:A,onClick:C,hoverHighlight:M,mobileInteraction:Q.mobileInteraction,customHoverBehavior:Q.customHoverBehavior,customClickBehavior:Q.customClickBehavior}),...g&&g.length>0&&{annotations:g},...Z.brushStreamProps,...Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e))};return(0,Vx.jsx)(fp,{componentName:"Histogram",width:B,height:F,children:(0,Vx.jsx)(Zh,{ref:n,...ie})})});Ux.displayName="Histogram";var Kx=require("react"),Qx=require("react/jsx-runtime"),Zx=(0,Kx.forwardRef)(function(e,t){const o=Ly(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=(0,Kx.useRef)(null);qy(t,{variant:"xy",frameRef:n});const{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="vertical",bins:u=25,curve:d="catmullRom",showIQR:h=!0,valueFormat:f,colorBy:m,colorScheme:p,categoryPadding:g=20,tooltip:y,annotations:b,valueExtent:v,brush:x,onBrush:k,linkedBrush:w,frameProps:S={},selection:A,linkedHover:C,onObservation:M,onClick:_,hoverHighlight:P,chartId:R,loading:j,loadingContent:L,emptyContent:T,legendInteraction:I,legendPosition:$,color:N,stroke:D,strokeWidth:E,opacity:O,showCategoryTicks:B,categoryFormat:F}=e,{width:z,height:H,enableHover:W,showGrid:q,showLegend:Y,title:G,description:V,summary:X,accessibleTable:U,categoryLabel:K,valueLabel:Q}=o,Z=(0,Kx.useMemo)(()=>yt(r),[r]),J=Hy({data:Z,rawData:r,colorBy:m,colorScheme:p,legendInteraction:I,legendPosition:$,selection:A,linkedHover:C,fallbackFields:m?["string"==typeof m?m:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:M,onClick:_,hoverHighlight:P,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"ViolinPlot",chartId:R,showLegend:Y,userMargin:i,marginDefaults:o.marginDefaults,loading:j,loadingContent:L,emptyContent:T,width:z,height:H,hasTitle:!!G,axisChrome:ns({showAxes:o.showAxes,projection:"horizontal"===c?"horizontal":"vertical",hasCategoryLabel:!!K,hasValueLabel:!!Q})}),ee=Ox({brushProp:x,onBrushProp:k,linkedBrush:w,valueAccessor:l}),te=Cy(),oe=(0,Kx.useMemo)(()=>new Map,[]),ne=px({colorBy:m,colorScale:J.colorScale,color:N,themeCategorical:te,colorScheme:p,categoryIndexMap:oe,userPieceStyle:void 0,stroke:D,strokeWidth:E,opacity:O,effectiveSelectionHook:J.effectiveSelectionHook,resolvedSelection:J.resolvedSelection,baseStyleExtras:{fillOpacity:.6},linkStrokeToFill:!0}),re=(0,Kx.useMemo)(()=>Wx({valueAccessor:l}),[l]);if(J.earlyReturn)return J.earlyReturn;const ie=Dy({componentName:"ViolinPlot",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(ie)return(0,Qx.jsx)(lp,{componentName:"ViolinPlot",message:ie,width:z,height:H});const se={chartType:"violin",...null!=r&&{data:Z},oAccessor:a,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",summaryStyle:ne,bins:u,showIQR:h,size:[z,H],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:J.margin,barPadding:g,enableHover:W,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:K,rLabel:Q,rFormat:f,...F&&{oFormat:F},showGrid:q,showCategoryTicks:B,...J.legendBehaviorProps,...og({title:G,description:V,summary:X,accessibleTable:U,className:s,animate:e.animate,maxDevicePixelRatio:e.maxDevicePixelRatio,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...rg({tooltip:y,defaultTooltipContent:re}),...ng({linkedHover:C,selection:A,onObservation:M,onClick:_,hoverHighlight:P,mobileInteraction:J.mobileInteraction,customHoverBehavior:J.customHoverBehavior,customClickBehavior:J.customClickBehavior}),...b&&b.length>0&&{annotations:b},...v&&{rExtent:v},...ee.brushStreamProps,...Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e))};return(0,Qx.jsx)(fp,{componentName:"ViolinPlot",width:z,height:H,children:(0,Qx.jsx)(Zh,{ref:n,...se})})});Zx.displayName="ViolinPlot";var Jx=require("react"),ek=require("react/jsx-runtime"),tk=(0,Jx.forwardRef)(function(e,t){const o=Ly(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=(0,Jx.useRef)(null);qy(t,{variant:"xy",frameRef:n});const{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="horizontal",bins:u=20,amplitude:d=1.5,valueFormat:h,colorBy:f,colorScheme:m,categoryPadding:p=5,tooltip:g,annotations:y,valueExtent:b,frameProps:v={},selection:x,linkedHover:k,onObservation:w,onClick:S,hoverHighlight:A,chartId:C,loading:M,loadingContent:_,emptyContent:P,legendInteraction:R,legendPosition:j,color:L,stroke:T,strokeWidth:I,opacity:$,showCategoryTicks:N,categoryFormat:D}=e,{width:E,height:O,enableHover:B,showGrid:F,showLegend:z,title:H,description:W,summary:q,accessibleTable:Y,categoryLabel:G,valueLabel:V}=o,X=(0,Jx.useMemo)(()=>yt(r),[r]),U=Hy({data:X,rawData:r,colorBy:f,colorScheme:m,legendInteraction:R,legendPosition:j,selection:x,linkedHover:k,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:w,onClick:S,hoverHighlight:A,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"RidgelinePlot",chartId:C,showLegend:z,userMargin:i,marginDefaults:o.marginDefaults,loading:M,loadingContent:_,emptyContent:P,width:E,height:O,hasTitle:!!H,axisChrome:ns({showAxes:o.showAxes,projection:"horizontal"===c?"horizontal":"vertical",hasCategoryLabel:!!G,hasValueLabel:!!V})}),K=Cy(),Q=(0,Jx.useMemo)(()=>new Map,[]),Z=px({colorBy:f,colorScale:U.colorScale,color:L,themeCategorical:K,colorScheme:m,categoryIndexMap:Q,userPieceStyle:void 0,stroke:T,strokeWidth:I,opacity:$,effectiveSelectionHook:U.effectiveSelectionHook,resolvedSelection:U.resolvedSelection,baseStyleExtras:{fillOpacity:.5},linkStrokeToFill:!0}),J=(0,Jx.useMemo)(()=>Wx(),[]);if(U.earlyReturn)return U.earlyReturn;const ee=Dy({componentName:"RidgelinePlot",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(ee)return(0,ek.jsx)(lp,{componentName:"RidgelinePlot",message:ee,width:E,height:O});const te={chartType:"ridgeline",...null!=r&&{data:X},oAccessor:a,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",summaryStyle:Z,bins:u,size:[E,O],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:U.margin,barPadding:p,enableHover:B,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:G,rLabel:V,rFormat:h,...D&&{oFormat:D},showGrid:F,showCategoryTicks:N,oSort:!1,amplitude:d,...U.legendBehaviorProps,...og({title:H,description:W,summary:q,accessibleTable:Y,className:s,animate:e.animate,maxDevicePixelRatio:e.maxDevicePixelRatio,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...rg({tooltip:g,defaultTooltipContent:J}),...ng({linkedHover:k,selection:x,onObservation:w,onClick:S,hoverHighlight:A,mobileInteraction:U.mobileInteraction,customHoverBehavior:U.customHoverBehavior,customClickBehavior:U.customClickBehavior}),...y&&y.length>0&&{annotations:y},...b&&{rExtent:b},...Object.fromEntries(Object.entries(v).filter(([e])=>"pieceStyle"!==e))};return(0,ek.jsx)(fp,{componentName:"RidgelinePlot",width:E,height:O,children:(0,ek.jsx)(Zh,{ref:n,...te})})});tk.displayName="RidgelinePlot";var ok=require("react"),nk=require("react/jsx-runtime"),rk=(0,ok.forwardRef)(function(e,t){const o=Ly(e.mode,{width:e.width,height:e.height,showGrid:!1,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,showCategoryTicks:!1,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=(0,ok.useRef)(null);qy(t,{variant:"xy",frameRef:n});const{data:r,margin:i,className:s,stepAccessor:a="step",valueAccessor:l="value",categoryAccessor:c,colorBy:u,colorScheme:d,orientation:h="horizontal",connectorOpacity:f=.3,showLabels:m=!0,tooltip:p,annotations:g,frameProps:y={},selection:b,linkedHover:v,onObservation:x,onClick:k,hoverHighlight:w,chartId:S,loading:A,loadingContent:C,emptyContent:M,legendInteraction:_,legendPosition:P,color:R,stroke:j,strokeWidth:L,opacity:T,categoryFormat:I}=e,$="vertical"===h,{width:N,height:D,enableHover:E,showLegend:O,title:B,description:F,summary:z,accessibleTable:H}=o,W=$?{top:B?60:40,right:20,bottom:60,left:60}:{top:B?40:10,right:10,bottom:10,left:10},q=(0,ok.useMemo)(()=>yt(r),[r]),Y=u||c,G=!Y,V=Hy({data:q,rawData:r,colorBy:Y,colorScheme:d,legendInteraction:_,legendPosition:P,selection:b,linkedHover:v,fallbackFields:Y?["string"==typeof Y?Y:""]:[],unwrapData:!0,onObservation:x,onClick:k,hoverHighlight:w,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"FunnelChart",chartId:S,showLegend:O,userMargin:i,marginDefaults:W,loading:A,loadingContent:C,emptyContent:M,width:N,height:D,hasTitle:!!B,axisChrome:ns({showAxes:$,projection:$?"vertical":"horizontal",hasCategoryLabel:!1,hasValueLabel:!1})});bp("FunnelChart",q,"stepAccessor",a),bp("FunnelChart",q,"valueAccessor",l);const X=Cy(),U=(0,ok.useMemo)(()=>new Map,[]),K=(0,ok.useMemo)(()=>{if(G)return R||(X?.[0]?X[0]:Array.isArray(d)&&d[0]?d[0]:"#4e79a7")},[G,R,X,d]),Q=px({colorBy:K?void 0:Y,colorScale:V.colorScale,color:K??R,themeCategorical:X,colorScheme:d,categoryIndexMap:U,userPieceStyle:y?.pieceStyle,stroke:j,strokeWidth:L,opacity:T,effectiveSelectionHook:V.effectiveSelectionHook,resolvedSelection:V.resolvedSelection}),Z=(0,ok.useMemo)(()=>e=>{const t=e?.data||e,o=t?.__funnelStep||t?.__barFunnelStep||t?.step||"",n=t?.__funnelValue??t?.__barFunnelValue??t?.value??"",r=t?.__funnelPercent??t?.__barFunnelPercent,i=t?.__funnelIsFirstStep??t?.__barFunnelIsFirstStep,s=t?.__barFunnelIsDropoff,a=t?.__barFunnelCategory??t?.category,l=null==r||i?"":` (${.05>Math.abs(r-Math.round(r))?Math.round(r)+"%":r.toFixed(1)+"%"})`;return(0,nk.jsxs)("div",{className:"semiotic-tooltip",style:Tc,children:[o&&(0,nk.jsx)("div",{style:{fontWeight:"bold"},children:o+""}),a&&a!==o&&(0,nk.jsx)("div",{style:{marginTop:2,opacity:.8},children:a+""}),s&&(0,nk.jsx)("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7},children:"Dropoff"}),(0,nk.jsxs)("div",{style:{marginTop:4},children:[n+"",l]})]})},[]);if(V.earlyReturn)return V.earlyReturn;const J=Dy({componentName:"FunnelChart",data:r,accessors:{stepAccessor:a,valueAccessor:l}});if(J)return(0,nk.jsx)(lp,{componentName:"FunnelChart",message:J,width:N,height:D});const ee={chartType:$?"bar-funnel":"funnel",...null!=r&&{data:q},oAccessor:a,rAccessor:l,...c&&{stackBy:c},projection:$?"vertical":"horizontal",barPadding:$?40:0,pieceStyle:Q,size:[N,D],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,maxDevicePixelRatio:e.maxDevicePixelRatio,margin:V.margin,enableHover:E,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:$,showCategoryTicks:$,...I&&{oFormat:I},showGrid:$,...!$&&{connectorOpacity:f},showLabels:m,...V.legendBehaviorProps,...B&&{title:B},...F&&{description:F},...z&&{summary:z},...void 0!==H&&{accessibleTable:H},...s&&{className:s},...null!=e.animate&&{animate:e.animate},tooltipContent:!1===p?()=>null:!0===p||null==p?Z:zc(p)||Z,...ng({linkedHover:v,selection:b,onObservation:x,onClick:k,hoverHighlight:w,mobileInteraction:V.mobileInteraction,customHoverBehavior:V.customHoverBehavior,customClickBehavior:V.customClickBehavior}),...g&&g.length>0&&{annotations:g},...Object.fromEntries(Object.entries(y).filter(([e])=>"pieceStyle"!==e))};return(0,nk.jsx)(fp,{componentName:"FunnelChart",width:N,height:D,children:(0,nk.jsx)(Zh,{ref:n,...ee})})});rk.displayName="FunnelChart";var ik=require("react"),sk=require("react/jsx-runtime"),ak=(0,ik.forwardRef)(function(e,t){const o=Ly(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid??!0,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=(0,ik.useRef)(null);qy(t,{variant:"xy",frameRef:n});const{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="horizontal",valueFormat:u,colorBy:d,colorScheme:h,sort:f="auto",dotRadius:m=5,categoryPadding:p=10,tooltip:g,annotations:y,regression:b,valueExtent:v,frameProps:x={},selection:k,linkedHover:w,onObservation:S,onClick:A,hoverHighlight:C,chartId:M,loading:_,loadingContent:P,emptyContent:R,legendInteraction:j,legendPosition:L,color:T,stroke:I,strokeWidth:$,opacity:N,categoryFormat:D}=e,{width:E,height:O,enableHover:B,showGrid:F,showLegend:z,title:H,description:W,summary:q,accessibleTable:Y,categoryLabel:G,valueLabel:V}=o,X=(0,ik.useMemo)(()=>yt(r),[r]),U=Hy({data:X,rawData:r,colorBy:d,colorScheme:h,legendInteraction:j,legendPosition:L,selection:k,linkedHover:w,fallbackFields:d?["string"==typeof d?d:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:S,onClick:A,hoverHighlight:C,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"DotPlot",chartId:M,showLegend:z,userMargin:i,marginDefaults:o.marginDefaults,loading:_,loadingContent:P,emptyContent:R,width:E,height:O,hasTitle:!!H,axisChrome:ns({showAxes:o.showAxes,projection:"horizontal"===c?"horizontal":"vertical",hasCategoryLabel:!!G,hasValueLabel:!!V})}),K=Py(X,f,l),Q=Cy(),Z=(0,ik.useMemo)(()=>new Map,[]),J=px({colorBy:d,colorScale:U.colorScale,color:T,themeCategorical:Q,colorScheme:h,categoryIndexMap:Z,userPieceStyle:x?.pieceStyle,stroke:I,strokeWidth:$,opacity:N,effectiveSelectionHook:U.effectiveSelectionHook,resolvedSelection:U.resolvedSelection,baseStyleExtras:{r:m,fillOpacity:.8}}),ee=(0,ik.useMemo)(()=>sd({categoryAccessor:a,valueAccessor:l,valueFormat:u}),[a,l,u]);if(U.earlyReturn)return U.earlyReturn;const te=Dy({componentName:"DotPlot",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(te)return(0,sk.jsx)(lp,{componentName:"DotPlot",message:te,width:E,height:O});const oe=lb(b),ne=oe?[oe,...y||[]]:y,re={chartType:"point",...null!=r&&{data:K},oAccessor:a,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",pieceStyle:J,size:[E,O],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:U.margin,barPadding:p,enableHover:B,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:G,rLabel:V,rFormat:u,...D&&{oFormat:D},showGrid:F,oSort:f,...U.legendBehaviorProps,...og({title:H,description:W,summary:q,accessibleTable:Y,className:s,animate:e.animate,maxDevicePixelRatio:e.maxDevicePixelRatio,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...rg({tooltip:g,defaultTooltipContent:ee}),...ng({linkedHover:w,selection:k,onObservation:S,onClick:A,hoverHighlight:C,mobileInteraction:U.mobileInteraction,customHoverBehavior:U.customHoverBehavior,customClickBehavior:U.customClickBehavior}),...ne&&ne.length>0&&{annotations:ne},...v&&{rExtent:v},...Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e))};return(0,sk.jsx)(fp,{componentName:"DotPlot",width:E,height:O,children:(0,sk.jsx)(Zh,{ref:n,...re})})});ak.displayName="DotPlot";var lk=require("react"),ck=require("react/jsx-runtime"),uk=(0,lk.forwardRef)(function(e,t){const o=Ly(e.mode,{width:e.width??400,height:e.height??400,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,showCategoryTicks:e.showCategoryTicks,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=(0,lk.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",colorBy:c,colorScheme:u,startAngle:d=0,cornerRadius:h,tooltip:f,annotations:m,frameProps:p={},selection:g,linkedHover:y,onObservation:b,onClick:v,hoverHighlight:x,chartId:k,loading:w,loadingContent:S,emptyContent:A,legendInteraction:C,legendPosition:M,color:_,stroke:P,strokeWidth:R,opacity:j}=e,{width:L,height:T,enableHover:I,showLegend:$,title:N,description:D,summary:E,accessibleTable:O}=o,B=(0,lk.useMemo)(()=>yt(r),[r]),F=c||a,z=Hy({data:B,rawData:r,colorBy:F,colorScheme:u,legendInteraction:C,legendPosition:M,selection:g,linkedHover:y,fallbackFields:F?["string"==typeof F?F:""]:[],unwrapData:!0,onObservation:b,onClick:v,hoverHighlight:x,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"PieChart",chartId:k,showLegend:$,userMargin:i,marginDefaults:o.marginDefaults,loading:w,loadingContent:S,emptyContent:A,width:L,height:T,hasTitle:!!N,axisChrome:{hasAxis:!1}}),H=Cy(),W=(0,lk.useMemo)(()=>new Map,[]),q=px({colorBy:F,colorScale:z.colorScale,color:_,themeCategorical:H,colorScheme:u,categoryIndexMap:W,userPieceStyle:p?.pieceStyle,stroke:P,strokeWidth:R,opacity:j,effectiveSelectionHook:z.effectiveSelectionHook,resolvedSelection:z.resolvedSelection,cycleByCategory:!0}),Y=(0,lk.useMemo)(()=>sd({categoryAccessor:a,valueAccessor:l,groupAccessor:c&&c!==a?c:void 0,groupLabel:"string"==typeof c?c:"group",pieData:!0}),[a,l,c]),G=Dy({componentName:"PieChart",data:r,accessors:{categoryAccessor:a,valueAccessor:l}}),{effectiveLegendProps:V,effectiveMargin:X}=fx({ref:t,frameRef:n,setup:z});if(z.earlyReturn)return z.earlyReturn;const U={chartType:"pie",...null!=r&&{data:B},oAccessor:a,rAccessor:l,projection:"radial",pieceStyle:q,startAngle:d,...null!=h&&{cornerRadius:h},size:[L,T],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:X,enableHover:I,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:!1,...V,...og({title:N,description:D,summary:E,accessibleTable:O,className:s,animate:e.animate,maxDevicePixelRatio:e.maxDevicePixelRatio,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...rg({tooltip:f,defaultTooltipContent:Y}),...ng({linkedHover:y,selection:g,onObservation:b,onClick:v,hoverHighlight:x,mobileInteraction:z.mobileInteraction,customHoverBehavior:z.customHoverBehavior,customClickBehavior:z.customClickBehavior}),...m&&m.length>0&&{annotations:m},...Object.fromEntries(Object.entries(p).filter(([e])=>"pieceStyle"!==e))};return G?(0,ck.jsx)(lp,{componentName:"PieChart",message:G,width:L,height:T}):(0,ck.jsx)(fp,{componentName:"PieChart",width:L,height:T,children:(0,ck.jsx)(Zh,{ref:n,...U})})});uk.displayName="PieChart";var dk=require("react"),hk=require("react/jsx-runtime"),fk=(0,dk.forwardRef)(function(e,t){const o=Ly(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,linkedHover:e.linkedHover,showCategoryTicks:e.showCategoryTicks,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:400,height:400}),n=(0,dk.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",innerRadius:c,centerContent:u,colorBy:d,colorScheme:h,startAngle:f=0,cornerRadius:m,tooltip:p,annotations:g,frameProps:y={},selection:b,linkedHover:v,onObservation:x,onClick:k,hoverHighlight:w,chartId:S,loading:A,loadingContent:C,emptyContent:M,legendInteraction:_,legendPosition:P,color:R,stroke:j,strokeWidth:L,opacity:T}=e,{width:I,height:$,enableHover:N,showLegend:D,title:E,description:O,summary:B,accessibleTable:F}=o,z=(0,dk.useMemo)(()=>yt(r),[r]),H=d||a,W=Hy({data:z,rawData:r,colorBy:H,colorScheme:h,legendInteraction:_,legendPosition:P,selection:b,linkedHover:v,fallbackFields:H?["string"==typeof H?H:""]:[],unwrapData:!0,onObservation:x,onClick:k,hoverHighlight:w,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"DonutChart",chartId:S,showLegend:D,userMargin:i,marginDefaults:o.marginDefaults,loading:A,loadingContent:C,emptyContent:M,width:I,height:$,hasTitle:!!E,axisChrome:{hasAxis:!1}}),q=c??Math.max(2,.15*Math.min(I,$)),Y=Cy(),G=(0,dk.useMemo)(()=>new Map,[]),V=px({colorBy:H,colorScale:W.colorScale,color:R,themeCategorical:Y,colorScheme:h,categoryIndexMap:G,userPieceStyle:y?.pieceStyle,stroke:j,strokeWidth:L,opacity:T,effectiveSelectionHook:W.effectiveSelectionHook,resolvedSelection:W.resolvedSelection,cycleByCategory:!0}),X=(0,dk.useMemo)(()=>sd({categoryAccessor:a,valueAccessor:l,groupAccessor:d&&d!==a?d:void 0,groupLabel:"string"==typeof d?d:"group",pieData:!0}),[a,l,d]),U=Dy({componentName:"DonutChart",data:r,accessors:{categoryAccessor:a,valueAccessor:l}}),{effectiveLegendProps:K,effectiveMargin:Q}=fx({ref:t,frameRef:n,setup:W});if(W.earlyReturn)return W.earlyReturn;const Z={chartType:"donut",...null!=r&&{data:z},oAccessor:a,rAccessor:l,projection:"radial",pieceStyle:V,innerRadius:q,startAngle:f,...null!=m&&{cornerRadius:m},centerContent:u,size:[I,$],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Q,enableHover:N,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:!1,...K,...og({title:E,description:O,summary:B,accessibleTable:F,className:s,animate:e.animate,maxDevicePixelRatio:e.maxDevicePixelRatio,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...rg({tooltip:p,defaultTooltipContent:X}),...ng({linkedHover:v,selection:b,onObservation:x,onClick:k,hoverHighlight:w,mobileInteraction:W.mobileInteraction,customHoverBehavior:W.customHoverBehavior,customClickBehavior:W.customClickBehavior}),...g&&g.length>0&&{annotations:g},...Object.fromEntries(Object.entries(y).filter(([e])=>"pieceStyle"!==e))};return U?(0,hk.jsx)(lp,{componentName:"DonutChart",message:U,width:I,height:$}):(0,hk.jsx)(fp,{componentName:"DonutChart",width:I,height:$,children:(0,hk.jsx)(Zh,{ref:n,...Z})})});fk.displayName="DonutChart";var mk=require("react");function pk(e=240){const t=360-e,o=180+t/2,n=o*Math.PI/180;return{sweepRad:e*Math.PI/180,gapDeg:t,startAngleDeg:o,startAngleRad:n,offsetRad:-Math.PI/2+n}}function gk(e){return Math.max(0,Math.min(1,e))}function yk(e){const t=e.trim();if(t.startsWith("#")){let e=t.slice(1);if(3===e.length&&(e=e.split("").map(e=>e+e).join("")),6===e.length&&/^[0-9a-f]{6}$/i.test(e))return[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16)]}const o=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);if(o){const e=[Number(o[1]),Number(o[2]),Number(o[3])];if(e.every(Number.isFinite))return e}return null}function bk(e,t,o){const n=e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0");return`#${n(e)}${n(t)}${n(o)}`}function vk(e,t,o){const n=e.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:gk(e.offset),color:e.color??o,opacity:null==e.opacity?1:gk(e.opacity)})).sort((e,t)=>e.offset-t.offset);if(0===n.length)return"#999999";const r=e=>{if(1===e.opacity)return e.color;const t=yk(e.color);return t?`rgba(${t[0]},${t[1]},${t[2]},${e.opacity})`:e.color};if(1===n.length)return r(n[0]);const i=gk(t);if(n[0].offset>=i)return r(n[0]);if(i>=n[n.length-1].offset)return r(n[n.length-1]);for(let e=0;n.length-1>e;e++){const t=n[e],o=n[e+1];if(t.offset>i||i>o.offset)continue;const s=o.offset-t.offset,a=s>0?(i-t.offset)/s:0,l=yk(t.color),c=yk(o.color);if(!l||!c)return r(.5>a?t:o);const[u,d,h]=l,[f,m,p]=c,g=u+(f-u)*a,y=d+(m-d)*a,b=h+(p-h)*a,v=t.opacity+(o.opacity-t.opacity)*a;return 1===v?bk(g,y,b):`rgba(${Math.round(g)},${Math.round(y)},${Math.round(b)},${v})`}return r(n[n.length-1])}function xk(e,t,o){return null==o?`${e}-${t}`:`${e}-${t}-${o}`}L();var kk=require("react/jsx-runtime"),wk=(0,mk.forwardRef)(function(e,t){const o=Ly(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLegend:!1,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:300,height:250}),n=(0,mk.useRef)(null),r="context"===o.mode,{compactMode:i}=o,{value:s,min:a=0,max:l=100,thresholds:c,gradientFill:u,color:d,backgroundColor:h="var(--semiotic-grid, #e0e0e0)",arcWidth:f=.3,cornerRadius:m,showNeedle:p=!0,needleColor:g="var(--semiotic-text, #333)",centerContent:y,valueFormat:b,showScaleLabels:v=!i,sweep:x=240,fillZones:k=!0,tooltip:w,annotations:S,frameProps:A={},className:C,stroke:M,strokeWidth:_,opacity:R}=e,{width:j,height:L,title:T,description:I,summary:$,accessibleTable:N}=o,D=cn(u),E=Math.max(a,Math.min(l,s)),O=l-a||1,B=(E-a)/O,{gaugeData:F,pieceStyle:z,gaugeAnnotations:H}=(0,mk.useMemo)(()=>function(e){const{min:t,max:o,value:n,thresholds:r,fillColor:i,backgroundColor:s,fillZones:a,showScaleLabels:l,gradientFill:c,gradientSteps:u=240}=e,d=o-t||1,h=(Math.max(t,Math.min(o,n))-t)/d;let f=r&&r.length>0?[...r].sort((e,t)=>e.value-t.value):[{value:o,color:i||"#007bff"}];f=f.map(e=>({...e,value:Math.max(t,Math.min(o,e.value))})),o>f[f.length-1].value&&f.push({value:o,color:f[f.length-1].color});const m=!!c&&c.stops.length>=2,p=[],g=new Map,y=[];if(m){const e=a?h:1,t=xk("bg",0);if(p.push({category:t,value:1,_zone:"Track",_isFill:!1,_pctStart:0,_pct:1,_roundedEnds:{start:!0,end:!0},_nonInteractive:!0}),g.set(t,{fill:s,opacity:.4}),e>0){const t=Math.max(1,Math.floor(u)),o=Math.max(1,Math.min(t,Math.round(e*t))),n=[];for(let t=0;o>t;t++)n.push(vk(c.stops,e*(t+.5)/o,i||f[0]?.color||"#007bff"));const r=xk("fill",0);p.push({category:r,value:e,_zone:"Gradient",_isFill:!0,_pctStart:0,_pct:e,_roundedEnds:{start:!0,end:!0},_nonInteractive:!0,_gradientBand:{colors:n}}),g.set(r,{fill:n[0]||s})}}else{let e=t;for(let o=0;f.length>o;o++){const n=f[o],r=(n.value-e)/d,i=(e-t)/d,l=(n.value-t)/d,c=Math.max(0,(a?Math.min(h,l):l)-i),u=a?Math.max(0,r-c):0;if(c>0){const e=xk("fill",o);p.push({category:e,value:c,_zone:n.label||"Zone "+(o+1),_isFill:!0}),g.set(e,{fill:n.color})}if(u>0){const e=xk("bg",o);p.push({category:e,value:u,_zone:n.label||"Zone "+(o+1),_isFill:!1}),g.set(e,{fill:s,opacity:.4})}e=n.value}}if(l&&r&&r.length>0)for(const e of r)e.value>t&&o>e.value&&y.push({type:"gauge-label",value:e.value,label:e.label||e.value+""});return{gaugeData:p,pieceStyle:(e,t)=>g.get(t||e.category)||{fill:s},gaugeAnnotations:y}}({min:a,max:l,value:s,thresholds:c,fillColor:d,backgroundColor:h,fillZones:k,showScaleLabels:v,gradientFill:D}),[s,a,l,c,d,h,v,k,D]),W=(0,mk.useMemo)(()=>Gy(z,{stroke:M,strokeWidth:_,opacity:R}),[z,M,_,R]),{sweepRad:q,startAngleDeg:Y}=pk(x),G=function(e=240){const{sweepRad:t,offsetRad:o}=pk(e),n=[[Math.cos(o),Math.sin(o)],[Math.cos(o+t),Math.sin(o+t)],[0,0]];for(let e=0;2*Math.PI>e;e+=Math.PI/2)((e-o)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)>t+.001||n.push([Math.cos(e),Math.sin(e)]);const r=n.map(e=>e[0]),i=n.map(e=>e[1]),[s,a]=P(r),[l,c]=P(i);return{minX:s,maxX:a,minY:l,maxY:c,width:a-s,height:c-l,cx:(s+a)/2,cy:(l+c)/2}}(x),V=Math.min(10,Math.max(1,Math.min(j,L)/12)),X=G.cx,U=G.cy,K=Math.max(4,Math.min((j-2*V)/G.width,(L-2*V)/G.height)-2),Q=Math.max(0,Math.min(K-1.5,K*(1-f))),Z=j/2-X*K,J=L/2-U*K,ee=2*(K+4),te=(0,mk.useMemo)(()=>{if(i&&null==y)return null;if(null!=y)return"function"==typeof y?y(E,a,l):y;const e=b?b(E):Math.round(E)+"";return(0,kk.jsxs)("div",{style:{textAlign:"center",lineHeight:1.2},children:[(0,kk.jsx)("div",{style:{fontSize:Math.max(16,.3*K),fontWeight:700,color:"var(--semiotic-text, #333)"},children:e}),v&&(0,kk.jsxs)("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"},children:[a," – ",l]})]})},[y,E,a,l,b,v,K,i]),oe=(0,mk.useMemo)(()=>r&&null==y?{type:"gauge-value",text:b?b(E):Math.round(E)+""}:null,[r,y,E,b]),ne=(0,mk.useMemo)(()=>{if(!p)return null;const e=-Math.PI/2+Y*Math.PI/180+B*q,t=Q>20?Q-8:K-1;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:g}},[p,Y,B,q,Q,K,g]),re=(0,mk.useMemo)(()=>(e,t,o)=>{if("gauge-needle"===e.type){const n=(o.width||j)/2,r=(o.height||L)/2,i=Math.max(1,K-Q),s=Math.max(1,Math.min(2.5,.4*i)),a=Math.max(1,Math.min(5,.6*i));return(0,kk.jsxs)("g",{transform:`translate(${n},${r})`,children:[(0,kk.jsx)("line",{x1:0,y1:0,x2:e.tipX,y2:e.tipY,stroke:e.color,strokeWidth:s,strokeLinecap:"round"}),(0,kk.jsx)("circle",{cx:0,cy:0,r:a,fill:e.color})]},"gauge-needle-"+t)}if("gauge-label"===e.type){const n=-Math.PI/2+Y*Math.PI/180+(e.value-a)/O*q,r=(o.width||j)/2,i=(o.height||L)/2,s=Q-1,l=K+1,c=Math.cos(n)*s,u=Math.sin(n)*s,d=Math.cos(n)*l,h=Math.sin(n)*l,f=K+10,m=Math.cos(n)*f,p=Math.sin(n)*f,g=((n+Math.PI/2)/(2*Math.PI)*12+12)%12;let y,b;return g>=11||1>g?(y="middle",b="auto"):g>=1&&5>g?(y="start",b="middle"):g>=5&&7>g?(y="middle",b="hanging"):(y="end",b="middle"),(0,kk.jsxs)("g",{transform:`translate(${r},${i})`,children:[(0,kk.jsx)("line",{x1:c,y1:u,x2:d,y2:h,stroke:"var(--semiotic-border, #ccc)",strokeWidth:2,strokeLinecap:"round"}),(0,kk.jsx)("text",{x:m,y:p,textAnchor:y,dominantBaseline:b,fill:"var(--semiotic-text-secondary, #666)",fontSize:10,style:{userSelect:"none",fontSize:"var(--semiotic-gauge-label-font-size, 10px)"},children:e.label})]},"gauge-label-"+t)}return"gauge-value"===e.type?(0,kk.jsx)("text",{x:(o.width||j)/2,y:(o.height||L)/2-.2*Q,textAnchor:"middle",dominantBaseline:"middle",fontSize:Math.max(12,Math.min(22,.28*K)),fontWeight:700,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:e.text},"gauge-value-"+t):null},[j,L,a,O,Y,q,Q,K]),ie=(0,mk.useMemo)(()=>{const e=[...H,...S||[]];return ne&&e.push(ne),oe&&e.push(oe),e},[H,S,ne,oe]),se=(0,mk.useMemo)(()=>e=>{const t=e?.data?.[0]||e?.data||e,o=t?._zone||"",n=t?._isFill;return(0,kk.jsxs)("div",{className:"semiotic-tooltip",style:{padding:"6px 10px",background:"var(--semiotic-tooltip-bg, white)",borderRadius:"var(--semiotic-tooltip-radius, 6px)",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0,0,0,0.15))"},children:[(0,kk.jsx)("div",{style:{fontWeight:600},children:o}),(0,kk.jsx)("div",{style:{fontSize:"0.85em",color:"var(--semiotic-text-secondary, #666)"},children:n?"Current: "+Math.round(E):"Remaining"})]})},[E]);if(0===F.length)return(0,kk.jsx)(lp,{componentName:"GaugeChart",message:"No data to display",width:j,height:L});const ae={chartType:"donut",data:F,oAccessor:"category",rAccessor:"value",oSort:!1,projection:"radial",pieceStyle:W,innerRadius:Q,startAngle:Y,sweepAngle:x,...null!=m&&{cornerRadius:m},centerContent:te,size:[j,L],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,maxDevicePixelRatio:e.maxDevicePixelRatio,margin:{top:J-ee/2,bottom:L-J-ee/2,left:Z-ee/2,right:j-Z-ee/2},enableHover:o.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===w?()=>null:zc(w)||se,svgAnnotationRules:re,...ie.length>0&&{annotations:ie},...T&&{title:T},...I&&{description:I},...$&&{summary:$},...void 0!==N&&{accessibleTable:N},...C&&{className:C},...null!=e.animate&&{animate:e.animate},...A};return(0,kk.jsx)(fp,{componentName:"GaugeChart",width:j,height:L,children:(0,kk.jsx)(Zh,{ref:n,...ae})})});wk.displayName="GaugeChart";var Sk=require("react"),Ak=require("react/jsx-runtime"),Ck=(0,Sk.forwardRef)(function(e,t){const o=Ly(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=(0,Sk.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="category",groupBy:l,valueAccessor:c="value",orientation:u="vertical",valueFormat:d,colorBy:h,colorScheme:f,sort:m=!1,barPadding:p=60,roundedTop:g,gradientFill:y,styleRules:b,baselinePadding:v=!1,tooltip:x,annotations:k,valueExtent:w,frameProps:S={},selection:A,linkedHover:C,onObservation:M,onClick:_,hoverHighlight:P,chartId:R,loading:j,loadingContent:L,emptyContent:T,legendInteraction:I,legendPosition:$,color:N,stroke:D,strokeWidth:E,opacity:O,categoryFormat:B}=e,{width:F,height:z,enableHover:H,showGrid:W,showLegend:q,title:Y,description:G,summary:V,accessibleTable:X,categoryLabel:U,valueLabel:K}=o,Q=(0,Sk.useMemo)(()=>yt(r),[r]),Z=h||l,J=Hy({data:Q,rawData:r,colorBy:Z,colorScheme:f,legendInteraction:I,legendPosition:$,selection:A,linkedHover:C,fallbackFields:Z?["string"==typeof Z?Z:""]:[],unwrapData:!0,onObservation:M,onClick:_,hoverHighlight:P,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"GroupedBarChart",chartId:R,showLegend:q,userMargin:i,marginDefaults:o.marginDefaults,loading:j,loadingContent:L,emptyContent:T,width:F,height:z,hasTitle:!!Y,axisChrome:ns({showAxes:o.showAxes,projection:"horizontal"===u?"horizontal":"vertical",hasCategoryLabel:!!U,hasValueLabel:!!K})}),ee=Cy(),te=(0,Sk.useMemo)(()=>new Map,[]),oe=(0,Sk.useMemo)(()=>Vy(c),[c]),ne=px({colorBy:Z,colorScale:J.colorScale,color:N,themeCategorical:ee,colorScheme:f,categoryIndexMap:te,userPieceStyle:S.pieceStyle,stroke:D,strokeWidth:E,opacity:O,styleRules:b,resolveRuleValue:oe,effectiveSelectionHook:J.effectiveSelectionHook,resolvedSelection:J.resolvedSelection}),re=(0,Sk.useMemo)(()=>sd({categoryAccessor:l,valueAccessor:c,groupAccessor:a,valueFormat:d}),[l,a,c,d]),ie=Dy({componentName:"GroupedBarChart",data:r,accessors:{categoryAccessor:a,valueAccessor:c},requiredProps:{groupBy:l}}),{effectiveLegendProps:se,effectiveMargin:ae}=fx({ref:t,frameRef:n,setup:J}),le=(0,Sk.useMemo)(()=>ln(y),[y]);if(J.earlyReturn)return J.earlyReturn;const ce={chartType:"clusterbar",...null!=r&&{data:Q},oAccessor:a,rAccessor:c,groupBy:l,oSort:m,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:ne,size:[F,z],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ae,barPadding:p,...null!=g&&{roundedTop:g},...le&&{gradientFill:le},baselinePadding:v,enableHover:H,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:U,rLabel:K,rFormat:d,...B&&{oFormat:B},showGrid:W,...se,...og({title:Y,description:G,summary:V,accessibleTable:X,className:s,animate:e.animate,maxDevicePixelRatio:e.maxDevicePixelRatio,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...rg({tooltip:x,defaultTooltipContent:re}),...ng({linkedHover:C,selection:A,onObservation:M,onClick:_,hoverHighlight:P,mobileInteraction:J.mobileInteraction,customHoverBehavior:J.customHoverBehavior,customClickBehavior:J.customClickBehavior}),...k&&k.length>0&&{annotations:k},...w&&{rExtent:w},...Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e))};return ie?(0,Ak.jsx)(lp,{componentName:"GroupedBarChart",message:ie,width:F,height:z}):(0,Ak.jsx)(fp,{componentName:"GroupedBarChart",width:F,height:z,children:(0,Ak.jsx)(Zh,{ref:n,...ce})})});Ck.displayName="GroupedBarChart";var Mk=require("react"),_k=require("react/jsx-runtime"),Pk=(0,Mk.forwardRef)(function(e,t){const o=Ly(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=(0,Mk.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="category",subcategoryAccessor:l,valueAccessor:c="value",orientation:u="horizontal",valueFormat:d,colorBy:h,colorScheme:f,barPadding:m,tooltip:p,annotations:g,brush:y,onBrush:b,linkedBrush:v,frameProps:x={},selection:k,linkedHover:w,onObservation:S,onClick:A,hoverHighlight:C,chartId:M,loading:_,loadingContent:P,emptyContent:R,legendInteraction:j,legendPosition:L,color:T,stroke:I,strokeWidth:$,opacity:N,categoryFormat:D,rTickValues:E,tickLabelEdgeAlign:O,showCategoryTicks:B,gradientFill:F,trackFill:z,roundedTop:H,valueExtent:W}=e,{width:q,height:Y,enableHover:G,showGrid:V,showLegend:X,title:U,description:K,summary:Q,accessibleTable:Z,categoryLabel:J,valueLabel:ee}=o,te=(0,Mk.useMemo)(()=>yt(r),[r]),oe=h||l,ne=(0,Mk.useMemo)(()=>{if(null!=m)return m;if("sparkline"!==o.mode)return 40;const e=new Set(te.map(e=>"function"==typeof a?a(e):e[a])),t=Math.max(1,e.size);return t>1?Math.max(0,Math.min(1,(("horizontal"===u?Y:q)-2*t)/(t-1))):1},[m,o.mode,te,a,u,q,Y]),re=Hy({data:te,rawData:r,colorBy:oe,colorScheme:f,legendInteraction:j,legendPosition:L,selection:k,linkedHover:w,fallbackFields:oe?["string"==typeof oe?oe:""]:[],unwrapData:!0,onObservation:S,onClick:A,hoverHighlight:C,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"SwimlaneChart",chartId:M,showLegend:X,userMargin:i,marginDefaults:o.marginDefaults,loading:_,loadingContent:P,emptyContent:R,width:q,height:Y,hasTitle:!!U,axisChrome:ns({showAxes:o.showAxes,projection:"horizontal"===u?"horizontal":"vertical",hasCategoryLabel:!1!==B&&!!J,hasValueLabel:!!ee})}),ie=Ox({brushProp:y,onBrushProp:b,linkedBrush:v,valueAccessor:c}),se=Cy(),ae=(0,Mk.useMemo)(()=>new Map,[]),le=px({colorBy:oe,colorScale:re.colorScale,color:T,themeCategorical:se,colorScheme:f,categoryIndexMap:ae,userPieceStyle:x?.pieceStyle,stroke:I,strokeWidth:$,opacity:N,effectiveSelectionHook:re.effectiveSelectionHook,resolvedSelection:re.resolvedSelection,cycleByCategory:!0}),ce=(0,Mk.useMemo)(()=>sd({categoryAccessor:l,valueAccessor:c,groupAccessor:a,valueFormat:d}),[l,a,c,d]),ue=Dy({componentName:"SwimlaneChart",data:r,accessors:{categoryAccessor:a,valueAccessor:c,subcategoryAccessor:l},requiredProps:{subcategoryAccessor:l}}),{effectiveLegendProps:de,effectiveMargin:he}=fx({ref:t,frameRef:n,setup:re}),fe=(0,Mk.useMemo)(()=>ln(F),[F]);if(re.earlyReturn)return re.earlyReturn;const me={chartType:"swimlane",...null!=r&&{data:te},oAccessor:a,rAccessor:c,stackBy:l,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:le,size:[q,Y],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:he,barPadding:ne,enableHover:G,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:!1===B?void 0:J,rLabel:ee,rFormat:d,...E&&{rTickValues:E},...null!=O&&{tickLabelEdgeAlign:O},...D&&{oFormat:D},...void 0!==B&&{showCategoryTicks:B},showGrid:V,...de,...og({title:U,description:K,summary:Q,accessibleTable:Z,className:s,animate:e.animate,maxDevicePixelRatio:e.maxDevicePixelRatio,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...rg({tooltip:p,defaultTooltipContent:ce}),...ng({linkedHover:w,selection:k,onObservation:S,onClick:A,hoverHighlight:C,mobileInteraction:re.mobileInteraction,customHoverBehavior:re.customHoverBehavior,customClickBehavior:re.customClickBehavior}),...g&&g.length>0&&{annotations:g},...fe&&{gradientFill:fe},...null!=z&&{trackFill:z},...null!=H&&{roundedTop:H},...W&&{rExtent:W},...ie.brushStreamProps,...Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e))};return ue?(0,_k.jsx)(lp,{componentName:"SwimlaneChart",message:ue,width:q,height:Y}):(0,_k.jsx)(fp,{componentName:"SwimlaneChart",width:q,height:Y,children:(0,_k.jsx)(Zh,{ref:n,...me})})});Pk.displayName="SwimlaneChart";var Rk=require("react"),jk=require("react");function Lk(e,t){if(!e)return[];const o=[],n=e=>{o.push(e);const r="function"==typeof t?t(e):e[t];r&&Array.isArray(r)&&r.forEach(n)};return n(e),o}function Tk(e,t,o,n){if(e&&e.length>0)return e;const r=new Set;return t.forEach(e=>{const t="function"==typeof o?o(e):e[o],i="function"==typeof n?n(e):e[n];r.add(t),r.add(i)}),Array.from(r).map(e=>({id:e}))}function Ik(e){return"function"==typeof e?e:t=>t[e]||1}function $k({edgeColorBy:e,colorBy:t,colorScale:o,nodeStyleFn:n,edgeOpacity:r,baseStyle:i={}}){return s=>{const a={fillOpacity:r,...i};if("function"==typeof e)a.fill=e(s);else if("source"===e){const e="object"==typeof s.source?s.source:null;t&&e?a.fill=wo(e.data||e,t,o):e&&(a.fill=n(e,e.index).fill)}else if("target"===e){const e="object"==typeof s.target?s.target:null;t&&e?a.fill=wo(e.data||e,t,o):e&&(a.fill=n(e,e.index).fill)}else"gradient"===e&&(a.fill="#999",a.fillOpacity=.7*r);return a}}function Nk(e){const{nodes:t,edges:o,inferNodes:n=!0,sourceAccessor:r="source",targetAccessor:i="target",colorBy:s,colorScheme:a,showLegend:l,legendPosition:c,legendInteraction:u,selection:d,linkedHover:h,onObservation:f,onClick:m,mobileInteraction:p,mobileSemantics:g,chartType:y,chartId:b,marginDefaults:v,userMargin:x,width:k,height:w,hasTitle:S,loading:A,loadingContent:C,emptyContent:M,emptyDataKey:_="edges"}=e,P=(0,jk.useMemo)(()=>yt(o),[o]),R=(0,jk.useMemo)(()=>yt(t),[t]),j=yp(A,k,w,C),L=j?null:gp("nodes"===_?void 0===t?void 0:R:void 0===o?void 0:P,k,w,M),T=(0,jk.useMemo)(()=>n?Tk(R,P,r,i):R,[n,R,P,r,i]),I=_y(T,s,a),$=Cy(),N=(0,jk.useMemo)(()=>Array.isArray(a)&&a.length>0?a:[...bo(a,$,go)],[a,$]),D=(0,jk.useMemo)(()=>ky(T,s),[T,s]),E=Sy(u,s,D),{legend:O,margin:B,legendPosition:F}=wy({data:T,colorBy:s,colorScale:I,showLegend:l,legendPosition:c,userMargin:x,defaults:v,categories:D,chartWidth:k,hasTitle:S}),z=(0,jk.useMemo)(()=>Ug(p,{width:k,mobileSemantics:g}),[p,k,g]),H=Ry({selection:d,linkedHover:h,fallbackFields:s?["string"==typeof s?s:""]:[],unwrapData:!0,onObservation:f,onClick:m,mobileInteraction:z,chartType:y,chartId:b}),{customHoverBehavior:W,customClickBehavior:q,activeSelectionHook:Y,hoverSelectionHook:G,crosshairSourceId:V}=H;return{safeNodes:T,safeEdges:P,colorScale:I,effectivePalette:N,themeCategorical:$,allCategories:D,legendState:E,legend:O,margin:B,legendPosition:F,mobileInteraction:z,customHoverBehavior:W,customClickBehavior:q,activeSelectionHook:Y,hoverSelectionHook:G,crosshairSourceId:V,loadingEl:j,emptyEl:L}}var Dk=require("react/jsx-runtime"),Ek=(0,Rk.forwardRef)(function(e,t){const o=(0,Rk.useRef)(null);qy(t,{variant:"network",frameRef:o});const n=Ly(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLegend:e.showLegend,showLabels:e.showLabels,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:600,height:600}),{nodes:r,edges:i,margin:s,className:a,nodeIdAccessor:l,nodeIDAccessor:c,sourceAccessor:u="source",targetAccessor:d="target",nodeLabel:h,colorBy:f,colorScheme:m,styleRules:p,nodeSize:g=8,nodeSizeRange:y=[5,20],nodeStroke:b,nodeStrokeWidth:v,edgeWidth:x,edgeColor:k,edgeOpacity:w,iterations:S=300,forceStrength:A=.1,layoutExecution:C="auto",layoutLoadingContent:M,onLayoutStateChange:_,tooltip:P,frameProps:R={},onObservation:j,onClick:L,chartId:T,selection:I,linkedHover:$,loading:N,loadingContent:D,emptyContent:E,legendInteraction:O,legendPosition:B,stroke:F,strokeWidth:z,opacity:H}=e,W=l??c??"id",{width:q,height:Y,enableHover:G,showLegend:V,showLabels:X=!1,title:U,description:K,summary:Q,accessibleTable:Z}=n,J=Nk({nodes:r,edges:i,inferNodes:!1,nodeIdAccessor:W,sourceAccessor:u,targetAccessor:d,colorBy:f,colorScheme:m,showLegend:V,legendPosition:B,legendInteraction:O,selection:I,linkedHover:$,onObservation:j,onClick:L,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"ForceDirectedGraph",chartId:T,marginDefaults:n.marginDefaults,userMargin:s,width:q,height:Y,hasTitle:!!U,loading:N,loadingContent:D,emptyContent:E,emptyDataKey:"nodes"}),ee=(0,Rk.useMemo)(()=>new Map,[]),te=(0,Rk.useMemo)(()=>e=>{const t={};return t.fill=f?wo(e.data||e,f,J.colorScale):My(void 0,J.themeCategorical,m,void 0,ee),"number"==typeof g&&(t.r=g),t},[f,J.colorScale,g,J.themeCategorical,m,ee]),oe=(0,Rk.useMemo)(()=>Uy(f,"number"==typeof g?void 0:g),[f,g]),ne=(0,Rk.useMemo)(()=>Gy(eb(te,p,oe,e=>e.data||e),{stroke:b??F,strokeWidth:v??z,opacity:H}),[te,p,oe,b,F,v,z,H]),re=k??F??"#999",ie=w??H??.6,se=z??1,ae=(0,Rk.useMemo)(()=>e=>{const t=e.data||e;let o;if(void 0===x)o=se;else if("number"==typeof x)o=x;else if("function"==typeof x)o=x(t);else{const e=t[x],n="number"==typeof e?e:Number(e);o=Number.isFinite(n)&&n>0?n:se}return{stroke:re,strokeWidth:o,opacity:ie}},[x,re,ie,se]),le=(0,Rk.useMemo)(()=>{if(X&&h)return"function"==typeof h?h:e=>e.data?.[h]??e[h]??e.id},[X,h]),ce=Oy({componentName:"ForceDirectedGraph",nodes:r,edges:i,nodesRequired:!0,edgesRequired:!0,accessors:{nodeIDAccessor:W}});return ce?(0,Dk.jsx)(lp,{componentName:"ForceDirectedGraph",message:ce,width:q,height:Y}):J.loadingEl?J.loadingEl:J.emptyEl?J.emptyEl:(0,Dk.jsx)(fp,{componentName:"ForceDirectedGraph",width:q,height:Y,children:(0,Dk.jsx)(tg,{ref:o,chartType:"force",...null!=r&&{nodes:J.safeNodes},...null!=i&&{edges:J.safeEdges},size:[q,Y],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,maxDevicePixelRatio:e.maxDevicePixelRatio,margin:J.margin,nodeIDAccessor:W,sourceAccessor:u,targetAccessor:d,iterations:S,forceStrength:A,layoutExecution:C,layoutLoadingContent:M,onLayoutStateChange:_,nodeStyle:ne,edgeStyle:ae,colorBy:f,colorScheme:J.effectivePalette,nodeSize:g,nodeSizeRange:y,nodeLabel:le,showLabels:X,enableHover:G,tooltipContent:!1===P?()=>null:zc(P)||void 0,...ng({linkedHover:$,selection:I,onObservation:j,onClick:L,mobileInteraction:J.mobileInteraction,customHoverBehavior:J.customHoverBehavior,customClickBehavior:J.customClickBehavior,linkedHoverInClickPredicate:!1}),legend:J.legend,legendPosition:J.legendPosition,...O&&"none"!==O&&{legendHoverBehavior:J.legendState.onLegendHover,legendClickBehavior:J.legendState.onLegendClick,legendHighlightedCategory:J.legendState.highlightedCategory,legendIsolatedCategories:J.legendState.isolatedCategories},className:a,title:U,description:K,summary:Q,accessibleTable:Z,...null!=e.animate&&{animate:e.animate},...R})})});Ek.displayName="ForceDirectedGraph";var Ok=require("react"),Bk=require("react/jsx-runtime"),Fk=(0,Ok.forwardRef)(function(e,t){const o=(0,Ok.useRef)(null);qy(t,{variant:"network",frameRef:o,overrides:{getData:()=>o.current?.getTopology()?.edges?.map(e=>e.data)??[]}});const n=Ly(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLabels:e.showLabels,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:600,height:600}),{nodes:r,edges:i,margin:s,className:a,sourceAccessor:l="source",targetAccessor:c="target",valueAccessor:u="value",nodeIdAccessor:d="id",colorBy:h,colorScheme:f,styleRules:m,edgeColorBy:p="source",padAngle:g=.01,groupWidth:y=20,sortGroups:b,nodeLabel:v,edgeOpacity:x=.5,tooltip:k,frameProps:w={},onObservation:S,onClick:A,chartId:C,selection:M,linkedHover:_,loading:P,loadingContent:R,emptyContent:j,legendInteraction:L,stroke:T,strokeWidth:I,opacity:$}=e,{width:N,height:D,enableHover:E,showLabels:O=!0,title:B,description:F,summary:z,accessibleTable:H}=n,W=Nk({nodes:r,edges:i,inferNodes:!0,nodeIdAccessor:d,sourceAccessor:l,targetAccessor:c,colorBy:h,colorScheme:f,showLegend:!1,legendInteraction:L,selection:M,linkedHover:_,onObservation:S,onClick:A,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"ChordDiagram",chartId:C,marginDefaults:n.marginDefaults,userMargin:s,width:N,height:D,hasTitle:!!B,loading:P,loadingContent:R,emptyContent:j}),q=(0,Ok.useMemo)(()=>new Map,[]),Y=(0,Ok.useMemo)(()=>new Map,[]),G=W.safeNodes.length>0,V=(0,Ok.useMemo)(()=>{if(G)return(e,t)=>{const o={stroke:"black",strokeWidth:1};if(h)o.fill=wo(e.data||e,h,W.colorScale);else{const n=Array.isArray(f)?f:po[f]||go,r=Array.isArray(n)?n:go,i=(e.id??e.data?.[d]??"")+"";Y.has(i)||Y.set(i,Y.size);const s=e.index??t??Y.get(i);o.fill=r[s%r.length]}return o}},[G,h,W.colorScale,f,d,Y]),X=(0,Ok.useMemo)(()=>Uy(h),[h]),U=(0,Ok.useMemo)(()=>{if(V||m&&m.length>0)return Gy(eb(V,m,X,e=>e.data||e),{stroke:T,strokeWidth:I,opacity:$})},[V,m,X,T,I,$]),K=(0,Ok.useMemo)(()=>{if(G)return $k({edgeColorBy:p,colorBy:h,colorScale:W.colorScale,nodeStyleFn:U||(e=>({fill:My(void 0,W.themeCategorical,f,void 0,q)})),edgeOpacity:x,baseStyle:{stroke:"black",strokeWidth:.5,strokeOpacity:x}})},[G,p,h,W.colorScale,U,x,W.themeCategorical,f,q]),Q=(0,Ok.useMemo)(()=>K?Gy(K,{stroke:T,strokeWidth:I,opacity:$}):void 0,[K,T,I,$]),Z=(0,Ok.useMemo)(()=>{if(!O)return;const e=v||d;return"function"==typeof e?e:t=>t.data?.[e]??t[e]??t.id},[O,v,d]),J=Oy({componentName:"ChordDiagram",edges:i,edgesRequired:!0});return J?(0,Bk.jsx)(lp,{componentName:"ChordDiagram",message:J,width:N,height:D}):W.loadingEl?W.loadingEl:W.emptyEl?W.emptyEl:(0,Bk.jsx)(fp,{componentName:"ChordDiagram",width:N,height:D,children:(0,Bk.jsx)(tg,{ref:o,chartType:"chord",...W.safeNodes.length>0&&{nodes:W.safeNodes},...null!=i&&{edges:W.safeEdges},size:[N,D],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,maxDevicePixelRatio:e.maxDevicePixelRatio,margin:W.margin,nodeIDAccessor:d,sourceAccessor:l,targetAccessor:c,valueAccessor:u,padAngle:g,groupWidth:y,sortGroups:b,nodeStyle:U,edgeStyle:Q,colorBy:h,colorScheme:W.effectivePalette,edgeColorBy:p,edgeOpacity:x,nodeLabel:Z,showLabels:O,enableHover:E,tooltipContent:!1===k?()=>null:zc(k)||void 0,...ng({linkedHover:_,selection:M,onObservation:S,onClick:A,mobileInteraction:W.mobileInteraction,customHoverBehavior:W.customHoverBehavior,customClickBehavior:W.customClickBehavior,linkedHoverInClickPredicate:!1}),...L&&"none"!==L&&{legendHoverBehavior:W.legendState.onLegendHover,legendClickBehavior:W.legendState.onLegendClick,legendHighlightedCategory:W.legendState.highlightedCategory,legendIsolatedCategories:W.legendState.isolatedCategories},className:a,title:B,description:F,summary:z,accessibleTable:H,...null!=e.animate&&{animate:e.animate},...w})})});Fk.displayName="ChordDiagram";var zk=require("react"),Hk=require("react/jsx-runtime"),Wk=(0,zk.forwardRef)(function(e,t){const o=(0,zk.useRef)(null);qy(t,{variant:"network",frameRef:o,overrides:{getData:()=>o.current?.getTopology()?.edges?.map(e=>e.data)??[]}});const n=Ly(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLabels:e.showLabels,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:800,height:600}),{nodes:r,edges:i,margin:s,className:a,sourceAccessor:l="source",targetAccessor:c="target",valueAccessor:u="value",nodeIdAccessor:d="id",colorBy:h,colorScheme:f,styleRules:m,edgeColorBy:p="source",orientation:g="horizontal",nodeAlign:y="justify",nodePaddingRatio:b=.05,nodeWidth:v=15,nodeLabel:x,edgeOpacity:k=.5,edgeSort:w,tooltip:S,frameProps:A={},onObservation:C,onClick:M,chartId:_,selection:P,linkedHover:R,loading:j,loadingContent:L,emptyContent:T,showLegend:I,legendPosition:$,legendInteraction:N,stroke:D,strokeWidth:E,opacity:O}=e,{width:B,height:F,enableHover:z,showLabels:H=!0,title:W,description:q,summary:Y,accessibleTable:G}=n,V=Nk({nodes:r,edges:i,inferNodes:!0,nodeIdAccessor:d,sourceAccessor:l,targetAccessor:c,colorBy:h,colorScheme:f,showLegend:I,legendPosition:$,legendInteraction:N,selection:P,linkedHover:R,onObservation:C,onClick:M,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"SankeyDiagram",chartId:_,marginDefaults:n.marginDefaults,userMargin:s,width:B,height:F,hasTitle:!!W,loading:j,loadingContent:L,emptyContent:T}),X=(0,zk.useMemo)(()=>new Map,[]),U=(0,zk.useMemo)(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=h?wo(e.data||e,h,V.colorScale):My(void 0,V.themeCategorical,f,void 0,X),t},[h,V.colorScale,V.themeCategorical,f,X]),K=(0,zk.useMemo)(()=>Uy(h,u),[h,u]),Q=(0,zk.useMemo)(()=>Gy(eb(U,m,K,e=>e.data||e),{stroke:D,strokeWidth:E,opacity:O}),[U,m,K,D,E,O]),Z=(0,zk.useMemo)(()=>$k({edgeColorBy:p,colorBy:h,colorScale:V.colorScale,nodeStyleFn:Q,edgeOpacity:k,baseStyle:{stroke:"none",strokeWidth:0}}),[p,h,V.colorScale,Q,k]),J=(0,zk.useMemo)(()=>Gy(Z,{stroke:D,strokeWidth:E,opacity:O}),[Z,D,E,O]),ee=(0,zk.useMemo)(()=>{if(!H)return;const e=x||d;return"function"==typeof e?e:t=>t.data?.[e]??t[e]??t.id},[H,x,d]),te=Oy({componentName:"SankeyDiagram",edges:i,edgesRequired:!0});return te?(0,Hk.jsx)(lp,{componentName:"SankeyDiagram",message:te,width:B,height:F}):V.loadingEl?V.loadingEl:V.emptyEl?V.emptyEl:(0,Hk.jsx)(fp,{componentName:"SankeyDiagram",width:B,height:F,children:(0,Hk.jsx)(tg,{ref:o,chartType:"sankey",...V.safeNodes.length>0&&{nodes:V.safeNodes},...null!=i&&{edges:V.safeEdges},size:[B,F],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,maxDevicePixelRatio:e.maxDevicePixelRatio,margin:V.margin,nodeIDAccessor:d,sourceAccessor:l,targetAccessor:c,valueAccessor:u,orientation:g,nodeAlign:y,nodePaddingRatio:b,nodeWidth:v,nodeStyle:Q,edgeStyle:J,colorBy:h,colorScheme:V.effectivePalette,edgeColorBy:p,edgeOpacity:k,edgeSort:w,nodeLabel:ee,showLabels:H,enableHover:z,tooltipContent:!1===S?()=>null:zc(S)||void 0,...ng({linkedHover:R,selection:P,onObservation:C,onClick:M,mobileInteraction:V.mobileInteraction,customHoverBehavior:V.customHoverBehavior,customClickBehavior:V.customClickBehavior,linkedHoverInClickPredicate:!1}),legend:V.legend,legendPosition:V.legendPosition,...N&&"none"!==N&&{legendHoverBehavior:V.legendState.onLegendHover,legendClickBehavior:V.legendState.onLegendClick,legendHighlightedCategory:V.legendState.highlightedCategory,legendIsolatedCategories:V.legendState.isolatedCategories},className:a,title:W,description:q,summary:Y,accessibleTable:G,...null!=e.animate&&{animate:e.animate},...A})})});Wk.displayName="SankeyDiagram";var qk=require("react"),Yk={static:{duplicateIds:"fatal",invalidSystemTime:"warn"},mcp:{duplicateIds:"fatal",invalidSystemTime:"warn"},push:{duplicateIds:"warn",invalidSystemTime:"strip"}};function Gk(e="static"){return Yk[e]??Yk.static}var Vk=new Set(["invalid-domain","missing-node","backward-edge","invalid-edge-time","invalid-value","invalid-node-time"]);function Xk(e){return"fatal"===e.severity||"warn"===e.severity?e.severity:Vk.has(e.kind)?"fatal":"warn"}function Uk(e,t,o,n={}){const r=Gk(n.usageMode??"static"),i=[],s=new Set;for(const t of e)s.has(t.id)&&i.push({kind:"duplicate-node",id:t.id,severity:r.duplicateIds}),s.add(t.id);const a=new Set,l=Array.isArray(o)&&2===o.length,c=l&&Number.isFinite(o[0])&&Number.isFinite(o[1]);l&&c&&c&&o[1]>=o[0]||i.push({kind:"invalid-domain"});for(const t of e)null!=t.xExtent&&(Array.isArray(t.xExtent)&&2===t.xExtent.length&&Number.isFinite(t.xExtent[0])&&Number.isFinite(t.xExtent[1])&&t.xExtent[1]>=t.xExtent[0]||i.push({kind:"invalid-node-time",id:t.id}));for(const e of t)a.has(e.id)&&i.push({kind:"duplicate-edge",id:e.id,severity:r.duplicateIds}),a.add(e.id),s.has(e.source)||i.push({kind:"missing-node",id:e.id,endpoint:"source",nodeId:e.source}),s.has(e.target)||i.push({kind:"missing-node",id:e.id,endpoint:"target",nodeId:e.target}),Number.isFinite(e.startTime)&&Number.isFinite(e.endTime)?((null!=e.systemInTime&&!Number.isFinite(e.systemInTime)||null!=e.systemOutTime&&!Number.isFinite(e.systemOutTime))&&i.push({kind:"invalid-system-time",id:e.id,severity:"warn"}),Number.isFinite(e.value)&&e.value>0||i.push({kind:"invalid-value",id:e.id}),e.startTime>e.endTime&&i.push({kind:"backward-edge",severity:"fatal",id:e.id,source:e.source,target:e.target})):i.push({kind:"invalid-edge-time",id:e.id});return i}function Kk(e){return"invalid-node-time"===e.kind?`node ${e.id} has an invalid xExtent (must be [start, end] with start <= end)`:"invalid-edge-time"===e.kind?`edge ${e.id} has an invalid startTime or endTime`:"invalid-domain"===e.kind?"time domain must be a 2-tuple of finite times [start, end] with start <= end":"invalid-value"===e.kind?`edge ${e.id} must have a positive finite value`:"missing-node"===e.kind?`edge ${e.id} references missing ${e.endpoint} node "${e.nodeId}"`:"backward-edge"===e.kind?`edge ${e.id} (${e.source}->${e.target}) ends before it starts`:"duplicate-node"===e.kind?`node id "${e.id}" is duplicated`:"duplicate-edge"===e.kind?`edge id "${e.id}" is duplicated`:"invalid-system-time"===e.kind?`edge ${e.id} has an invalid systemInTime or systemOutTime`:e.kind}function Qk(e){const{desired:t,minGaps:o,weights:n}=e,r=t.length;if(0===r)return[];if(o.length!==Math.max(0,r-1))throw Error("placeWithMinGap: minGaps must have desired.length - 1 entries");const i=Array(r).fill(0);for(let e=1;r>e;e++)i[e]=i[e-1]+Math.max(0,Number.isFinite(o[e-1])?o[e-1]:0);const s=[];for(let e=0;r>e;e++){const o=Math.max(Number.EPSILON,Number.isFinite(n?.[e])?n[e]:1),r=(Number.isFinite(t[e])?t[e]:0)-i[e];for(s.push({start:e,end:e,weight:o,mean:r});s.length>1;){const e=s[s.length-1],t=s[s.length-2];if(e.mean>=t.mean)break;const o=t.weight+e.weight;s.splice(s.length-2,2,{start:t.start,end:e.end,weight:o,mean:(t.mean*t.weight+e.mean*e.weight)/o})}}const a=Number.isFinite(e.min)?e.min:-1/0,l=Number.isFinite(e.max)?e.max-i[r-1]:1/0,c=a>l?a:l,u=Array(r);for(const e of s){const t=Math.max(a,Math.min(c,e.mean));for(let o=e.start;e.end>=o;o++)u[o]=t+i[o]}return u}function Zk(e,t){let o=0,n=e.length-1,r=-1;for(;n>=o;){const i=o+n>>>1;e[i].at>t?n=i-1:(r=i,o=i+1)}return 0>r?{at:t,before:0,after:0}:e[r]}function Jk(e,t=0){if(0===e.length)return{adjacentClearance:[],positions:[]};const o=[],n=[0];for(let r=0;e.length-1>r;r++){const i=e[r],s=e[r+1],a=[...new Set([...i.map(e=>e.at),...s.map(e=>e.at)])].sort((e,t)=>e-t);let l=0;for(const e of a){const t=Zk(i,e),o=Zk(s,e);l=Math.max(l,t.after+o.before)}o.push(l),n.push(n[n.length-1]+l+t)}return{adjacentClearance:o,positions:n}}function ew(e,t,o,n={}){let r=[...e];if(1>=r.length)return r;let i=[...r],s=o(r),a=1;const l=Math.max(0,n.passes??6),c=Math.max(1,n.maxEvaluations??1/0);for(let e=0;l>e&&c>a;e++){const e=new Map(r.map((e,t)=>[e,t])),l=new Map,c=new Map;for(const o of t){const t=e.get(o.source),n=e.get(o.target);if(null==t||null==n)continue;const r=Number.isFinite(o.weight)&&o.weight>0?o.weight:1;l.set(o.source,(l.get(o.source)??0)+n*r),c.set(o.source,(c.get(o.source)??0)+r),l.set(o.target,(l.get(o.target)??0)+t*r),c.set(o.target,(c.get(o.target)??0)+r)}r=r.map((e,t)=>({item:e,index:t,barycenter:(l.get(e)??t)/(c.get(e)??1)})).sort((e,t)=>e.barycenter-t.barycenter||(n.compare?.(e.item,t.item)??e.index-t.index)).map(e=>e.item);const u=o(r);if(a++,s>u)s=u,i=[...r];else if(u===s)break}return i}function tw(e,t,o={}){const n=[...e],r=n.length;if(1>=r||r>(o.maxItems??8))return n;const i=Math.max(1,o.maxEvaluations??1/0);let s=0,a=[...n],l=1/0;const c=()=>{if(s>=i)return;const e=t(n);s++,l>e&&(l=e,a=[...n])};c();const u=Array(r).fill(0);let d=0;for(;r>d&&i>s;)if(d>u[d]){const e=d%2==0?0:u[d];[n[e],n[d]]=[n[d],n[e]],c(),u[d]++,d=0}else u[d]=0,d++;return a}function ow(e,t){return t>e?-1:e>t?1:0}function nw(e){return e.occupants.map(e=>e.id).sort(ow).join("\0")}function rw(e,t,o=0){return e.slice(0,-1).map((n,r)=>null!=n.group&&n.group===e[r+1].group?o:t)}function iw(e,t){return e.map(e=>{const o=new Map;for(const n of e.occupants){const e=t[n.id];if(e)for(const t of e.samples){const e=o.get(t.t)??{before:0,after:0},n=t.boundaryOffset??0;o.set(t.t,{before:Math.max(e.before,t.topMass-n),after:Math.max(e.after,t.botMass+n)})}}return[...o].sort((e,t)=>e[0]-t[0]).map(([e,t])=>({at:e,...t}))})}function sw(e,t,o){if(0===e.length)return[];const{padding:n,plotH:r,valueScale:i}=o,s=o.stackValueScale??i,a=rw(e,n,o.groupPadding??0),l=[n+e[0].peak.topPeak*s];for(let o=1;e.length>o;o++)l.push(l[o-1]+t[o-1]*s+a[o-1]);const c=l[l.length-1]+e[e.length-1].peak.botPeak*s+n;if(c>r&&c>0){const e=r/c;for(let t=0;l.length>t;t++)l[t]*=e}return l}function aw(e,t){const o=(e.boundaryOffset??0)*t,n=e.value*t;if("out"===e.kind){const r=e.sideMassBefore*t;return o+("top"===e.side?n/2-r:r-n/2)}const r=e.sideMassAfter*t;return o+("top"===e.side?n/2-r:r-n/2)}function lw(e,t,o,n,r,i){const s=i.adjacentClearance?[...i.adjacentClearance]:Jk(iw(n,o)).adjacentClearance,a=sw(n,s,i);let l="hug"===i.lanePlacement?function(e,t,o,n,r,i,s){const a=e.length;if(0===a)return[];const{padding:l,plotH:c,valueScale:u}=s,d=rw(e,l,s.groupPadding??0),h=r.map((e,t)=>e*u+d[t]),f=l+e[0].peak.topPeak*u,m=c-l-e[a-1].peak.botPeak*u;if(h.reduce((e,t)=>e+t,0)+1e-6>=m-f)return sw(e,r,s);let p=1===a?[(f+m)/2]:[...i];for(let e=0;12>e;e++){const e=Array(a).fill(0),r=Array(a).fill(0);for(const i of o){const o=t[i.source],s=t[i.target];if(null==o||null==s||o===s)continue;const a=n[i.source]?.localAttachments.get(i.id),l=n[i.target]?.localAttachments.get(i.id);if(!a||!l)continue;const c=i.value>0&&Number.isFinite(i.value)?i.value:1,d=aw(a,u),h=aw(l,u);e[o]+=(p[s]+h-d)*c,r[o]+=c,e[s]+=(p[o]+d-h)*c,r[s]+=c}const i=Qk({desired:p.map((t,o)=>0===r[o]?t:.45*t+e[o]/r[o]*.55),minGaps:h,weights:r.map(e=>Math.max(1,e)),min:f,max:m});let s=0;for(let e=0;a>e;e++)s=Math.max(s,Math.abs(i[e]-p[e]));if(p=i,.01>s)break}return p}(n,r,t,o,s,a,i):[...a];if("hug"===i.lanePlacement){const o=t=>{const o={};for(const n of e)o[n.id]=t[r[n.id]];return o};cw(o(l),t)>cw(o(a),t)+1e-6&&(l=[...a])}const c={};for(const t of e)c[t.id]=l[r[t.id]];let u=1/0,d=-1/0;for(const t of e){const e=c[t.id],n=o[t.id];Number.isFinite(e)&&n&&(u=Math.min(u,e-n.topPeak*i.valueScale),d=Math.max(d,e+n.botPeak*i.valueScale))}return{adjacentClearance:s,centerlines:c,slotCenter:l,stackCenter:a,verticalUtilization:Number.isFinite(u)&&Number.isFinite(d)&&i.plotH>0?Math.max(0,Math.min(1,(d-u)/i.plotH)):0}}function cw(e,t){let o=0;for(const n of t){const t=e[n.source],r=e[n.target];Number.isFinite(t)&&Number.isFinite(r)&&(o+=Math.abs(t-r)*(n.value>0?n.value:1))}return o}function uw(e,t){const o=e?.samples;if(!o||0===o.length||o[0].t>t)return{top:0,bot:0};let n=0,r=o.length-1,i=0;for(;r>=n;){const e=n+r>>>1;o[e].t>t?r=e-1:(i=e,n=e+1)}const s=o[i].boundaryOffset??0;return{top:o[i].topMass-s,bot:o[i].botMass+s}}function dw(e,t,o,n,r){const i=1-r;return i*i*i*e+3*i*i*r*t+3*i*r*r*o+r*r*r*n}function hw(e,t){let o=0,n=1;for(let r=0;28>r;r++){const r=(o+n)/2;e>dw(0,t,t,1,r)?o=r:n=r}return(o+n)/2}function fw(e,t,o){const n=t+aw(e,o),r=e.value*o/2;return[n-r,n+r]}function mw(e,t,o,n){return Math.max(0,Math.min(t,n)-Math.max(e,o))/Math.max(1e-9,t-e)}function pw(e,t,o,n,r,i,s){const{valueScale:a,domain:l,mode:c="quality"}=s,u="source"===s.ribbonLane?.85:"target"===s.ribbonLane?.15:.5;let d=0;for(const s of e){const e=n[s.source],h=n[s.target];if(null==e||null==h||2>Math.abs(e-h))continue;const f=t[s.source]?.localAttachments.get(s.id),m=t[s.target]?.localAttachments.get(s.id);if(!f||!m)continue;const p=Math.max(s.startTime,l?.[0]??-1/0),g=Math.min(s.endTime,l?.[1]??1/0);if(p>=g)continue;const[y,b]=fw(f,r[s.source],a),[v,x]=fw(m,r[s.target],a),k=Math.min(e,h)+1,w=Math.max(e,h)-1;for(let e=k;w>=e;e++){const n=o[e];if(!n)continue;const l=[p,g];if("quality"===c)for(const e of n.occupants)for(const o of t[e.id]?.samples??[])o.t>p&&g>o.t&&l.push(o.t);const h=e=>{const o=hw((e-p)/(g-p),u),l=dw(y,y,v,v,o),c=dw(b,b,x,x,o);let d=0;for(const o of n.occupants){if(o.id===s.source||o.id===s.target)continue;const n=i[o.id];if(null!=n?.start&&n.start>e)continue;if(null!=n?.end&&e>n.end)continue;const u=uw(t[o.id],e),h=r[o.id];d=Math.max(d,mw(l,c,h-u.top*a,h+u.bot*a))}return d},f=[...new Set(l)].sort((e,t)=>e-t);let m=0;for(let e=0;f.length-1>e;e++){const t=f[e],o=f[e+1]-t;m+=(h(t+.25*o)+h(t+.5*o)+h(t+.75*o))/3*o}d+=m/(g-p)*(s.value>0?s.value:1)}}return d}function gw(e,t,o,n,r,i,s,a,l,c,u="both",d){return{crossings:e,weightedLength:t,pixelLength:cw(s,o),transitOcclusion:pw(o,n,r,i,s,a,{valueScale:l,ribbonLane:u,domain:d,mode:"quality"}),verticalUtilization:c}}function yw(e,t){return t?Math.max(t[0],Math.min(t[1],e)):e}function bw(e,t){return e.map(e=>({t:yw(e.t,t),topMass:e.topMass,botMass:e.botMass,...null!=e.boundaryOffset&&{boundaryOffset:e.boundaryOffset}}))}function vw(e,t,o){const n=t+(e.boundaryOffset??0)*o,r=e.value*o;if("out"===e.kind){const t=e.sideMassBefore*o;if("top"===e.side){const e=n-t;return[e,e+r]}const i=n+t;return[i-r,i]}const i=e.sideMassAfter*o;if("top"===e.side){const e=n-i;return[e,e+r]}const s=n+i;return[s-r,s]}function xw(e,t,o,n,r="temporal"){const i=t.incoming[e.id],s=t.outgoing[e.id],a=[];for(const e of i)a.push({time:e.endTime,delta:+e.value,edge:e,kind:"in",side:o.get(e.id).targetSide});for(const e of s)a.push({time:e.startTime,delta:-e.value,edge:e,kind:"out",side:o.get(e.id).sourceSide});const l={create:0,in:1,"transfer-out":2,"transfer-in":3,out:4},c=()=>{a.sort((e,t)=>e.time-t.time||(e.phase??0)-(t.phase??0)||(e.sequence??0)-(t.sequence??0)||(l[e.kind]??99)-(l[t.kind]??99)||((e,t)=>{if(!n||!e.edge||!t.edge||e.kind!==t.kind||e.side!==t.side)return 0;if("out"===e.kind){if(e.edge.target===t.edge.target&&e.edge.endTime===t.edge.endTime)return 0;const o=n.get(e.edge.id)?.target,r=n.get(t.edge.id)?.target;return"number"==typeof o&&Number.isFinite(o)&&"number"==typeof r&&Number.isFinite(r)&&o!==r?"top"===e.side?o-r:r-o:0}if("in"===e.kind){if(e.edge.source===t.edge.source&&e.edge.startTime===t.edge.startTime)return 0;const o=n.get(e.edge.id)?.source,r=n.get(t.edge.id)?.source;return"number"==typeof o&&Number.isFinite(o)&&"number"==typeof r&&Number.isFinite(r)&&o!==r?"top"===e.side?r-o:o-r:0}return 0})(e,t)||ow(e.edge?.id??"",t.edge?.id??"")||ow(e.side,t.side)||e.delta-t.delta)},u=a.length?function(e,t=1/0){let o=t;for(const t of e)o>t&&(o=t);return o}(a.map(e=>e.time)):null,d=Array.isArray(e.xExtent)&&Number.isFinite(e.xExtent[0])?e.xExtent[0]:null,h=null!=d?d-1:null!=u&&Number.isFinite(u)?u-1:null;c();let f=null,m=0;for(const e of a)e.time!==f&&(f=e.time,m=0),e.sequence=m++;const p=e=>({time:e.time,phase:0,sequence:e.sequence??0}),g=[];let y=0,b=0;for(const e of a)if("out"===e.kind){const t=Math.abs(e.delta);let o=t-("top"===e.side?y:b);if(o>0){const t="top"===e.side?"bot":"top",n=Math.min(o,"top"===t?y:b);if(n>0){const r=p(e);g.push({...r,delta:-n,kind:"transfer-out",side:t}),g.push({...r,delta:+n,kind:"transfer-in",side:e.side}),"top"===t?y-=n:b-=n,"top"===e.side?y+=n:b+=n,o-=n}o>0&&null!==h&&(g.push({time:h,delta:+o,kind:"create",side:e.side}),"top"===e.side?y+=o:b+=o)}"top"===e.side?y-=t:b-=t}else if("in"===e.kind){const t=Math.abs(e.delta);"top"===e.side?y+=t:b+=t}a.push(...g),c();let v=0,x=0,k=0,w=0,S=0,A=0;const C=[],M=new Map,_=e=>{C.push({t:e,topMass:v,botMass:x,...Math.abs(k)>1e-12&&{boundaryOffset:k}})},P=()=>{w=Math.max(w,v+x),S=Math.max(S,v-k),A=Math.max(A,x+k)};for(const e of a){if("transfer-out"!==e.kind&&"transfer-in"!==e.kind&&_(e.time),("in"===e.kind||"out"===e.kind)&&e.edge){const t="top"===e.side?v:x;M.set(e.edge.id,{side:e.side,time:e.time,sideMassBefore:t,sideMassAfter:t+e.delta,kind:e.kind,value:Math.abs(e.delta),...Math.abs(k)>1e-12&&{boundaryOffset:k}})}"top"===e.side?v+=e.delta:x+=e.delta,"transfer-in"===e.kind?(k+="top"===e.side?e.delta:-e.delta,P(),_(e.time)):"transfer-out"!==e.kind&&(P(),"out"!==e.kind||v+x>1e-12||(k=0),_(e.time))}const R=[];let j=0;for(;C.length>j;){let e=j;for(;C.length>e+1&&C[e+1].t===C[j].t;)e++;R.push(C[j]);for(let t=j+1;e>=t;t++){const e=R[R.length-1];C[t].topMass===e.topMass&&C[t].botMass===e.botMass&&(C[t].boundaryOffset??0)===(e.boundaryOffset??0)||R.push(C[t])}j=e+1}const L=Array.isArray(e.xExtent)&&Number.isFinite(e.xExtent[1])?e.xExtent[1]:null;let T=null;for(const e of s)null!=e.systemInTime&&Number.isFinite(e.systemInTime)&&e.startTime>e.systemInTime&&(null===T||T>e.systemInTime)&&(T=e.systemInTime);let I=null;for(const e of i)null!=e.systemOutTime&&Number.isFinite(e.systemOutTime)&&e.systemOutTime>e.endTime&&(null===I||e.systemOutTime>I)&&(I=e.systemOutTime);if(R.length>0){const e=R[R.length-1],t=Math.max(null!=L?L:-1/0,null!=I?I:-1/0);Number.isFinite(t)&&t>e.t&&e.topMass+e.botMass>0&&R.push({t:t,topMass:e.topMass,botMass:e.botMass,...null!=e.boundaryOffset&&{boundaryOffset:e.boundaryOffset}});const o=R[0],n=R.find(e=>e.topMass+e.botMass>0);let r,i=1/0;null!=d&&Number.isFinite(d)&&o.t>d&&o.topMass+o.botMass>0&&(i=d,r=o),n&&null!=T&&Number.isFinite(T)&&n.t>T&&i>T&&(i=T,r=n),r&&Number.isFinite(i)&&R.unshift({t:i,topMass:r.topMass,botMass:r.botMass,...null!=r.boundaryOffset&&{boundaryOffset:r.boundaryOffset}})}let $=R;if("max"===r&&null!=d&&null!=L&&L>d){let e,t=0;for(const o of R){const n=o.topMass+o.botMass;n>t&&(t=n,e=o)}if(e){const t={topMass:e.topMass,botMass:e.botMass,...null!=e.boundaryOffset&&{boundaryOffset:e.boundaryOffset}};$=[...R.filter(e=>d>e.t),{t:d,...t},{t:L,...t},...R.filter(e=>e.t>L)]}}return{samples:$,peak:w,topPeak:S,botPeak:A,localAttachments:M}}function kw(e){const t={};return e.forEach((e,o)=>{for(const n of e.occupants)t[n.id]=o}),t}function ww(e,t,o){e.splice(0,e.length,...o);const n=kw(o);for(const e of Object.keys(t))delete t[e];Object.assign(t,n)}function Sw(e){const t=new Map,o=[];e.forEach((e,n)=>{if(!e.group)return void o.push({anchor:n,stableId:nw(e),slots:[e]});const r=t.get(e.group)??{indexes:[],slots:[]};r.indexes.push(n),r.slots.push(e),t.set(e.group,r)});for(const[e,n]of t)o.push({anchor:n.indexes.reduce((e,t)=>e+t,0)/n.indexes.length,stableId:`${e}\0${n.slots.map(nw).join("\0")}`,slots:n.slots});return o.sort((e,t)=>e.anchor-t.anchor||ow(e.stableId,t.stableId))}function Aw(e){return e.some(e=>e.group)?Sw(e).flatMap(e=>e.slots):[...e]}function Cw(e){return e.flatMap(e=>e.slots)}function Mw(e,t,o){const n=new Map;return e.forEach((e,t)=>{for(const o of e.slots)n.set(o,t)}),e.map((e,r)=>{if(1>=e.slots.length)return e;const i=new Map;for(const t of e.slots)i.set(t,0);for(const e of t){const t=n.get(e.source),o=n.get(e.target);if(null==t||null==o)continue;const s=Number.isFinite(e.weight)&&e.weight>0?e.weight:1;if(t===r&&o!==r){const t=o>r?1:-1;i.set(e.source,(i.get(e.source)??0)+s*t)}else if(o===r&&t!==r){const o=t>r?1:-1;i.set(e.target,(i.get(e.target)??0)+s*o)}}const s=[...e.slots].sort((e,t)=>(i.get(e)??0)-(i.get(t)??0)||o(e,t));return{...e,slots:s}})}function _w(e,t){e.some(e=>e.group)&&ww(e,t,Aw(e))}function Pw(e,t){return e.source!==t.source&&e.target!==t.target&&e.source!==t.target&&e.target!==t.source&&Math.min(e.endTime,t.endTime)>Math.max(e.startTime,t.startTime)}function Rw(e,t){return function(e,t,o=()=>!0){let n=0;for(let r=0;e.length>r;r++){const[i,s]=t(e[r]);for(let a=r+1;e.length>a;a++){if(!o(e[r],e[a]))continue;const[l,c]=t(e[a]);0>(i-l)*(s-c)&&n++}}return n}(t,t=>[e[t.source],e[t.target]],Pw)}function jw(e,t){let o=0;for(const n of t){const t=e[n.source],r=e[n.target];null!=t&&null!=r&&(o+=Math.abs(t-r)*(n.value>0?n.value:1))}return o}function Lw(e,t,o){const[n,r]=o.get(e.first),[i,s]=o.get(e.second);return 0>(t.get(n)-t.get(i))*(t.get(r)-t.get(s))?1:0}L();var Tw=e=>{let t=1;for(let o=2;e>=o;o++)t*=o;return t},Iw=828*Tw(8),$w=3e3;function Nw(e,t,o,n,r,i,s){const a=[...r],l=new Map(r.map(e=>[e,nw(e)])),c=new Map;for(const e of r)for(const t of e.occupants)c.set(t.id,e);const u=new Map,d=[];for(const e of t){const t=c.get(e.source),o=c.get(e.target);t&&o&&(u.set(e,[t,o]),t!==o&&d.push({source:t,target:o,weight:e.value}))}const h=[];for(let e=0;t.length>e;e++)if(u.has(t[e]))for(let o=e+1;t.length>o;o++){if(!u.has(t[o])||!Pw(t[e],t[o]))continue;const n=new Set([...u.get(t[e]),...u.get(t[o])]);h.push({index:h.length,first:t[e],second:t[o],involvedSlots:n})}const f=new Map;for(const e of r)f.set(e,[]);for(const e of h)for(const t of e.involvedSlots)f.get(t)?.push(e);const m=new Uint32Array(h.length);let p=0;const g=t.reduce((e,t)=>e+(t.value>0?t.value:1),0),y=s.plotH/Math.max(1,r.length),b=r.reduce((e,t)=>e+t.peak.topPeak+t.peak.botPeak,0),v=Math.max(1,g)*(Math.max(1,s.plotH)+y*Math.max(b,r.length)+1e-6*Math.max(1,r.length-1))+1,x=4*y,k={fullCrossing:0,localCrossing:0},w=new Map,S=(e,t)=>{let n=w.get(e);n||(n=new Map,w.set(e,n));const r=n.get(t);if(null!=r)return r;const i=function(e,t,o){return Jk(iw([e,t],o)).adjacentClearance[0]??0}(e,t,o);return n.set(t,i),i},A=new Map(r.map((e,t)=>[e,t])),C=t.flatMap(e=>{const t=u.get(e);return t?[{source:A.get(t[0]),target:A.get(t[1]),weight:e.value>0?e.value:1}]:[]}),M=new Map;for(const e of t){const t=u.get(e);t&&M.set(e,{source:A.get(t[0]),target:A.get(t[1])})}const _=new Map,P=new Map;for(const e of t)_.has(e.source)||_.set(e.source,new Set),P.has(e.target)||P.set(e.target,new Set),_.get(e.source).add(e.target),P.get(e.target).add(e.source);const R=t.flatMap(e=>{if(!(e=>{const t=new Set([..._.get(e.source)??[],...P.get(e.source)??[]]),o=new Set([..._.get(e.target)??[],...P.get(e.target)??[]]);return 1===_.get(e.source)?.size&&_.get(e.source).has(e.target)||1===t.size&&t.has(e.target)||1===o.size&&o.has(e.source)})(e))return[];const t=M.get(e);return t&&t.source!==t.target?[{source:t.source,target:t.target,weight:e.value>0?e.value:1}]:[]}),j=e=>{let t=0;for(const o of R)t+=Math.max(0,Math.abs(e[o.source]-e[o.target])-1)*o.weight;return t*x},L=e=>{const t=new Int16Array(r.length);for(let o=0;e.length>o;o++)t[A.get(e[o])]=o;return j(t)},T=h.map(e=>{const t=M.get(e.first),o=M.get(e.second);return[t.source,t.target,o.source,o.target]}),I=new Int16Array(r.length),$=new Float64Array(r.length),N=new Float64Array(r.length+1),D=e=>{for(let t=0;e.length>t;t++)I[A.get(e[t])]=t;let t=0;for(const[e,o,n,r]of T)0>(I[e]-I[n])*(I[o]-I[r])&&t++;if(e.length>0){const t=A.get(e[0]);$[t]=s.padding+e[0].peak.topPeak*s.valueScale;for(let t=1;e.length>t;t++){const o=A.get(e[t-1]),n=A.get(e[t]);$[n]=$[o]+S(e[t-1],e[t])*s.valueScale+s.padding}const o=A.get(e[e.length-1]),n=$[o]+e[e.length-1].peak.botPeak*s.valueScale+s.padding;if(n>s.plotH&&n>0){const e=s.plotH/n;for(let t=0;$.length>t;t++)$[t]*=e}}N[0]=0;for(let t=0;e.length>t;t++)N[t+1]=N[t]+e[t].peak.topPeak+e[t].peak.botPeak;let o=0,n=0,r=0;for(const e of C){const t=I[e.source],i=I[e.target];if(o+=Math.abs(t-i)*e.weight,n+=Math.abs($[e.source]-$[e.target])*e.weight,Math.abs(t-i)>=2){const o=Math.min(t,i)+1;r+=(N[Math.max(t,i)]-N[o])*e.weight}}return t*v+n+r*y+j(I)+1e-6*o},E=(e,o)=>{const n=Array(e.length+1).fill(0);for(let t=0;e.length>t;t++)n[t+1]=n[t]+e[t].peak.topPeak+e[t].peak.botPeak;let r=0;for(const e of t){const t=o[e.source],i=o[e.target];if(null==t||null==i||2>Math.abs(t-i))continue;const s=Math.min(t,i)+1;r+=(n[Math.max(t,i)]-n[s])*(e.value>0?e.value:1)}return r},O=n=>{const r=kw(n),i=n.slice(0,-1).map((e,t)=>S(e,n[t+1])),a=lw(e,t,o,n,r,{plotH:s.plotH,padding:s.padding,valueScale:s.valueScale,lanePlacement:s.lanePlacement??"stack",groupPadding:s.groupPadding,adjacentClearance:i});return{map:r,geometry:a,weightedLength:jw(r,t),pixelLength:cw(a.centerlines,t),transitOcclusion:E(n,r)}},B=(e,t,o)=>({crossings:e,weightedLength:t.weightedLength,pixelLength:t.pixelLength,transitOcclusion:t.transitOcclusion,cost:e*v+t.pixelLength+t.transitOcclusion*y+L(o)+1e-6*t.weightedLength}),F=(e,t)=>{let o=t;if(null==o){const t=new Map(e.map((e,t)=>[e,t]));o=h.reduce((e,o)=>e+Lw(o,t,u),0),k.fullCrossing++}return B(o,O(e),e)},z=(e,r,i="quality")=>{let a=r;if(null==a){const t=new Map(e.map((e,t)=>[e,t]));a=h.reduce((e,o)=>e+Lw(o,t,u),0),k.fullCrossing++}const l=O(e);return B(a,{...l,transitOcclusion:pw(t,o,e,l.map,l.geometry.centerlines,n,{valueScale:s.valueScale,ribbonLane:s.ribbonLane,domain:s.domain,mode:i})},e)};let H=[...a];const W=(e,t)=>ow(l.get(e),l.get(t)),q=function(e){const t=new Set;for(const o of e)if(o.group){if(t.has(o.group))return!0;t.add(o.group)}return!1}(H),Y=e=>{const t=(e=>{const t=ew(e,d,e=>F(e).cost,{passes:6,compare:W,maxEvaluations:$w});let o=F(t),n=$w;for(let e=0;6>e&&n>0;e++){let r=!1;const i=Array.from({length:t.length-1},(e,t)=>t);e%2==1&&i.reverse();for(const e of i){if(0>=n--)break;const i=t[e],s=t[e+1],a=new Map(t.map((e,t)=>[e,t]));let l=0;const c=[];p++;for(const e of[...f.get(i)??[],...f.get(s)??[]])m[e.index]!==p&&(m[e.index]=p,c.push(e),l+=Lw(e,a,u));[t[e],t[e+1]]=[s,i];const d=new Map(a);d.set(i,e+1),d.set(s,e);let h=0;for(const e of c)h+=Lw(e,d,u);k.localCrossing+=c.length;const g=F(t,o.crossings-l+h);o.cost>g.cost?(o=g,r=!0):[t[e],t[e+1]]=[i,s]}if(!r)break}return t})(e);if((e.length>8?1/0:Tw(e.length)*(e.length+C.length+T.length))>Iw)return t;const o=tw(e,D,{maxItems:8,maxEvaluations:5e4}),n=z(o),r=z(t);return n.crossings!==r.crossings&&r.crossings>n.crossings?o:t},G="geometry-refine"===s.mode;if(G||"crossing-min"!==s.laneOrder&&"crossing-min+inside-out"!==s.laneOrder){if(!G&&"inside-out"===s.laneOrder)if(q){const e=Sw(H),t=e=>e.slots.reduce((e,t)=>e+t.peak.topPeak+t.peak.botPeak,0),o=[...e].sort((e,o)=>t(o)-t(e)||ow(e.stableId,o.stableId)),n=Array(o.length);let r=Math.floor((o.length-1)/2)-1,i=Math.floor((o.length-1)/2)+1;o.length>0&&(n[Math.floor((o.length-1)/2)]=o[0]);for(let e=1;o.length>e;e++)e%2==1&&o.length>i||0>r?n[i++]=o[e]:n[r--]=o[e];H=Cw(n)}else{const e=[...H].sort((e,t)=>t.peak.topPeak+t.peak.botPeak-(e.peak.topPeak+e.peak.botPeak)||W(e,t)),t=Array(e.length);let o=Math.floor((e.length-1)/2)-1,n=Math.floor((e.length-1)/2)+1;e.length>0&&(t[Math.floor((e.length-1)/2)]=e[0]);for(let r=1;e.length>r;r++)r%2==1&&e.length>n||0>o?t[n++]=e[r]:t[o--]=e[r];H=t}}else H=q?(e=>{let t=Sw(e);if(1>=t.length)return Cw(t);const o=e=>F(Cw(e)).cost;t=Sw(Y(e)),t=Mw(t,d,W);const n=function(e,t){const o=new Map;for(const t of e)for(const e of t.slots)o.set(e,t);const n=new Map;for(const e of t){const t=o.get(e.source),r=o.get(e.target);if(!t||!r||t===r)continue;const i=Number.isFinite(e.weight)&&e.weight>0?e.weight:1,s=r.stableId>t.stableId?`${t.stableId}\0${r.stableId}`:`${r.stableId}\0${t.stableId}`,a=n.get(s);a?a.weight=(a.weight??0)+i:n.set(s,{source:t,target:r,weight:i})}return[...n.values()]}(t,d);t=ew(t,n,o,{passes:6,compare:(e,t)=>ow(e.stableId,t.stableId),maxEvaluations:$w}),t=function(e,t,o={}){const n=[...e];if(1>=n.length)return n;let r=t(n),i=1;const s=Math.max(0,o.passes??6),a=Math.max(1,o.maxEvaluations??1/0);for(let e=0;s>e&&a>i;e++){let e=!1;for(let o=0;n.length-1>o&&a>i;o++){[n[o],n[o+1]]=[n[o+1],n[o]];const s=t(n);i++,r>s?(r=s,e=!0):[n[o],n[o+1]]=[n[o+1],n[o]]}if(!e)break}return n}(t,o,{passes:8,maxEvaluations:$w});const r=t.length>8?1/0:Tw(t.length)*(t.length+C.length+T.length);if(Iw>=r){const e=tw(t,e=>D(Cw(e)),{maxItems:8,maxEvaluations:5e4}),o=Cw(e),n=Cw(t),r=z(o),i=z(n);r.crossings!==i.crossings?t=i.crossings>r.crossings?e:t:i.cost>r.cost&&(t=e)}return t=Mw(t,d,W),Cw(t)})(H):Y(H);if(!G&&"crossing-min+inside-out"===s.laneOrder&&H.length>1)if(q){const e=Sw(H);let t=F(Cw(e)),o=Cw(e),n=t;const r=Math.floor((e.length-1)/2),i=e=>e.slots.reduce((e,t)=>e+t.peak.topPeak+t.peak.botPeak,0),s=[...e].sort((e,t)=>i(t)-i(e)||ow(e.stableId,t.stableId));for(const i of s){const s=e.indexOf(i);if(s===r)continue;e.splice(s,1),e.splice(r,0,i);const a=Cw(e),l=F(a);l.cost>t.cost?(e.splice(r,1),e.splice(s,0,i)):(t=l,n.cost>l.cost&&(o=a,n=l))}H=o}else{let e=F(H),t=[...H],o=e;const n=Math.floor((H.length-1)/2),r=[...H].sort((e,t)=>t.peak.topPeak+t.peak.botPeak-(e.peak.topPeak+e.peak.botPeak)||W(e,t));for(const i of r){const r=H.indexOf(i);if(r===n)continue;H.splice(r,1),H.splice(n,0,i);const s=F(H);s.cost>e.cost?(H.splice(n,1),H.splice(r,0,i)):(e=s,o.cost>s.cost&&(t=[...H],o=s))}H=t}if((G||"crossing-min"===s.laneOrder||"crossing-min+inside-out"===s.laneOrder)&&H.length>1)if(q){let e=Sw(H),t=z(Cw(e),void 0,"score");for(let o=0;6>o&&e.length>1;o++){let o=!1;for(let n=0;e.length-1>n;n++){[e[n],e[n+1]]=[e[n+1],e[n]];const r=Cw(e),i=z(r,void 0,"score");t.cost>i.cost?(H=r,t=i,o=!0):[e[n],e[n+1]]=[e[n+1],e[n]]}if(!o)break}e=Mw(Sw(H),d,W),H=Cw(e)}else{let e=z(H,void 0,"score");for(let t=0;H.length-1>t;t++){const o=H[t],n=H[t+1],r=new Map(H.map((e,t)=>[e,t]));let i=0;const s=[];p++;for(const e of[...f.get(o)??[],...f.get(n)??[]])m[e.index]!==p&&(m[e.index]=p,s.push(e),i+=Lw(e,r,u));[H[t],H[t+1]]=[n,o];const a=new Map(r);a.set(o,t+1),a.set(n,t);let l=0;for(const e of s)l+=Lw(e,a,u);k.localCrossing+=s.length;const c=z(H,e.crossings-i+l,"score");e.cost>c.cost?e=c:[H[t],H[t+1]]=[o,n]}}const V=Aw(a);H=Aw(H);let X=z(H);const U=z(V);if(G){const e=L(V),t=L(H);(X.crossings>U.crossings||X.crossings===U.crossings&&t>e+1e-9||X.cost>U.cost)&&(H=V,X=U)}else X.cost>U.cost&&(H=V,X=U);return ww(r,i,H),{before:U,after:X,initialOrder:a.map(e=>l.get(e)),evaluations:k}}function Dw(e,t,o){const n=e.map(e=>{const n=e.occupants.map(e=>({id:e.id,end:o[e.id]?.end??e.end}));let r=0,i=0;for(const e of n){const o=t[e.id];r=Math.max(r,o?.topPeak||0),i=Math.max(i,o?.botPeak||0)}return{occupants:n,peak:{topPeak:r,botPeak:i},...null!=e.group?{group:e.group}:{}}}),r={};return n.forEach((e,t)=>{for(const o of e.occupants)r[o.id]=t}),{slots:n,slotByNode:r}}var Ew=new Map,Ow=1e-9,Bw=1e5;function Fw(e,t){let o=1/0,n=-1/0;for(const t of e?.samples??[])t.topMass+t.botMass>Ow&&(o=Math.min(o,t.t),n=Math.max(n,t.t));return Number.isFinite(o)&&Number.isFinite(n)?(null!=t.start&&(o=Math.max(o,t.start)),null!=t.end&&(n=Math.min(n,t.end)),o>n?{start:null,end:null}:{start:o,end:n}):{start:null,end:null}}function zw(e,t){return null!=e.start&&null!=e.end&&null!=t.start&&null!=t.end&&!(t.start>=e.end||e.start>=t.end)}function Hw(e,t){return ow(e,t)>0?`${t}\0${e}`:`${e}\0${t}`}function Ww(e){const t=new Map,o=new Map;for(const n of e)o.has(n.source)||o.set(n.source,new Set),t.has(n.target)||t.set(n.target,new Set),o.get(n.source).add(n.target),t.get(n.target).add(n.source);return{incoming:new Map([...t].map(([e,t])=>[e,t.size])),outgoing:new Map([...o].map(([e,t])=>[e,t.size]))}}function qw(e){const t=new Map,o=new Map,n=(e,t,o,n)=>{let r=e.get(t);r||(r=new Map,e.set(t,r)),r.set(o,(r.get(o)??0)+n)};for(const r of e){const e=r.value>0&&Number.isFinite(r.value)?r.value:1;n(t,r.source,r.target,e),n(o,r.target,r.source,e)}const r=new Map,i=e=>{if(r.has(e))return;const n=t.get(e),i=o.get(e);if(n&&1===n.size&&(!i||0===i.size)){const[t,o]=[...n][0];return void r.set(e,{partner:t,weight:o})}const s=new Map;for(const[e,t]of n??[])s.set(e,(s.get(e)??0)+t);for(const[e,t]of i??[])s.set(e,(s.get(e)??0)+t);if(1===s.size){const[t,o]=[...s][0];r.set(e,{partner:t,weight:o})}};for(const t of e)i(t.source),i(t.target);return r}function Yw(e,t,o){const n=o.get(e),r=o.get(t);return!n||!r||n.partner===r.partner||n.partner===t||r.partner===e}function Gw(e,t,o){return!!o.has(e)&&t.some(t=>!Yw(e,t,o))}function Vw(e,t){return(e.value>0&&Number.isFinite(e.value)?e.value:1)*(1+(1===t.outgoing.get(e.source)?1:0)+(1===t.incoming.get(e.target)?1:0))}function Xw(e,t,o,n){if(12>=e.length||1>=n.slotCount)return n.assignment;const r=new Map(e.map((e,t)=>[e,t])),i=Array.from({length:e.length},()=>new Map),s=Ww(o);for(const e of o){const t=r.get(e.source),o=r.get(e.target);if(null==t||null==o||t===o)continue;const n=Vw(e,s);i[t].set(o,(i[t].get(o)??0)+n),i[o].set(t,(i[o].get(t)??0)+n)}const a=qw(o),l=e.map(e=>a.get(e)?.weight??0),c=Array.from({length:e.length},()=>new Map);let u=0;for(let o=0;e.length-1>o&&5e4>u;o++)if(a.has(e[o]))for(let n=o+1;e.length>n;n++){if(!a.has(e[n]))continue;if(t.conflicts(e[o],e[n]))continue;u++;const r=Math.min(l[o],l[n])||Math.max(l[o],l[n]),i=Yw(e[o],e[n],a)?r:-r;if(Math.abs(i)>Ow&&(c[o].set(n,i),c[n].set(o,i),u>=5e4))break}const d=[...n.assignment],h=Array.from({length:n.slotCount},()=>[]);d.forEach((e,t)=>h[e].push(t));const f=(e,t,o)=>{const n=d[t],r=d[o];let i=0;const s=new Set;for(const a of[t,o])for(const[l,c]of e[a]){const e=l>a?`${a}:${l}`:`${l}:${a}`;if(s.has(e))continue;s.add(e);const u=(a===t?r:n)===(l===t?r:l===o?n:d[l]);d[a]===d[l]!==u&&(i+=u?c:-c)}return i},m=(e,t,o)=>{let n=0;for(const[r,i]of e[t]){const e=o===d[r];d[t]===d[r]!==e&&(n+=e?i:-i)}return n},p=(e,t)=>e>Ow||Ow>=Math.abs(e)&&t>Ow,g=(e,t,o,n)=>e>o+Ow||Ow>=Math.abs(e-o)&&t>n+Ow;let y=0;for(let o=0;32>o&&Bw>y;o++){let o=null,n=-1,r=-1,s=-1,a=-1/0,l=-1/0;for(let u=0;e.length>u;u++){for(let f=0;h.length>f&&y++<Bw;f++){if(f===d[u])continue;if(!h[f].every(o=>!t.conflicts(e[u],e[o])))continue;const y=m(i,u,f),b=m(c,u,f);p(y,b)&&g(y,b,a,l)&&(o="move",n=u,r=-1,s=f,a=y,l=b)}if(y>=Bw)break}for(let u=0;e.length-1>u;u++){for(let m=u+1;e.length>m&&y++<Bw;m++){const y=d[u],b=d[m];if(y===b)continue;if(!h[b].every(o=>o===m||!t.conflicts(e[u],e[o])))continue;if(!h[y].every(o=>o===u||!t.conflicts(e[m],e[o])))continue;const v=f(i,u,m),x=f(c,u,m);p(v,x)&&g(v,x,a,l)&&(o="swap",n=u,r=m,s=-1,a=v,l=x)}if(y>=Bw)break}if(null==o||-1===n)break;if("move"===o){const e=d[n];h[e].splice(h[e].indexOf(n),1),h[s].push(n),d[n]=s;continue}const u=d[n],b=d[r];h[u].splice(h[u].indexOf(n),1,r),h[b].splice(h[b].indexOf(r),1,n),d[n]=b,d[r]=u}return d}function Uw(e,t,o,n){const r=function(e,t,o,n){return`${e.map(e=>{const t=o[e.id],r=n[e.id];return[e.id,e.group??"",e.xExtent?.[0]??"",e.xExtent?.[1]??"",t?.topPeak??0,t?.botPeak??0,r?.start??"",r?.end??""].join(":")}).join("|")}#${t.map(e=>[e.id,e.source,e.target,e.value,e.startTime,e.endTime].join(":")).join("|")}`}(e,t,o,n),i=Ew.get(r);if(i)return Dw(i.slots,o,n);const s={};for(const t of e)s[t.id]=Fw(o[t.id],n[t.id]);const a=function(e,t){return e.filter(e=>null!=t[e.id].start).sort((e,o)=>t[e.id].start-t[o.id].start||t[e.id].end-t[o.id].end||ow(e.id,o.id)).map(e=>e.id)}(e,s),l=new Map(e.map(e=>[e.id,e])),c=new Map(e.map(e=>[e.id,e.group||void 0])),u=function(e,t,o,n,r){const i=new Set,s=new Map(e.map(e=>[e,new Set])),a=new Map(e.map(e=>[e,new Set]));for(const e of n)i.add(Hw(e.source,e.target)),s.get(e.target)?.add(e.source),a.get(e.source)?.add(e.target);const l=new Map,c=new Set,u=(e,t)=>{for(let o=0;e.length>o;o++)for(let n=o+1;e.length>n;n++){const r=Hw(e[o],e[n]);t instanceof Map?t.set(r,[e[o],e[n]]):t.add(r)}};for(const e of a.values())u([...e],l);for(const e of s.values())u([...e],c);const d=new Set;for(const[e,[n,r]]of l)c.has(e)&&(zw(t[n],t[r])||zw(o[n],o[r])&&(d.add(n),d.add(r)));return{conflicts:(e,o)=>{const n=r.get(e),s=r.get(o);return null!=n&&null!=s&&n!==s||null!=n!=(null!=s)&&!i.has(Hw(e,o))||!!zw(t[e],t[o])||!(!d.has(e)&&!d.has(o))&&!i.has(Hw(e,o))}}}(a,s,n,t,c),d=function(e,t,o=new Map){const n=[],r=[];for(const i of e){let e=n.findIndex(e=>e.every(e=>!t.conflicts(i,e))&&!Gw(i,e,o));-1!==e||o.has(i)||(e=n.findIndex(e=>e.every(e=>!t.conflicts(i,e)))),-1===e&&(e=n.length,n.push([])),n[e].push(i),r.push(e)}return{assignment:r,slotCount:n.length}}(a,u,qw(t)),h=function(e,t,o,n){if(0===e.length||e.length>12||1>=n.slotCount)return n.assignment;const r=new Map(e.map((e,t)=>[e,t])),i=Array.from({length:e.length},()=>new Float64Array(e.length)),s=Array.from({length:e.length},()=>new Map),a=Array.from({length:e.length},()=>new Map),l=Ww(o);for(const e of o){const t=r.get(e.source),o=r.get(e.target);if(null==t||null==o||t===o)continue;const n=Vw(e,l);i[t][o]+=n,i[o][t]+=n,a[t].set(o,(a[t].get(o)??0)+n),s[o].set(t,(s[o].get(t)??0)+n)}const c=qw(o),u=e.map(e=>c.get(e)?.weight??0),d=Array.from({length:e.length},()=>new Float64Array(e.length));for(let t=0;e.length>t;t++)for(let o=t+1;e.length>o;o++){for(const[e,n]of s[t])d[t][o]+=Math.min(n,s[o].get(e)??0);for(const[e,n]of a[t])d[t][o]+=Math.min(n,a[o].get(e)??0);if(c.has(e[t])&&c.has(e[o])){const n=Math.min(u[t],u[o])||Math.max(u[t],u[o]);d[t][o]+=Yw(e[t],e[o],c)?n:-n}d[o][t]=d[t][o]}let h=[...n.assignment],f=(t=>{let o=0,n=0;for(let r=0;e.length>r;r++)for(let s=r+1;e.length>s;s++)t[r]===t[s]&&(o+=i[r][s],n+=d[r][s]);return{flow:o,affinity:n}})(h),m=0;const p=Array(e.length).fill(-1),g=Array.from({length:n.slotCount},()=>[]),y=(o,r,s,a)=>{if(m>=75e3)return;if(o===e.length)return m++,void((s>f.flow||s===f.flow&&a>f.affinity||s===f.flow&&a===f.affinity&&function(e,t){for(let o=0;Math.min(e.length,t.length)>o;o++)if(e[o]!==t[o])return t[o]>e[o];return t.length>e.length}(p,h))&&(h=[...p],f={flow:s,affinity:a}));const l=Math.min(r+1,n.slotCount-1);for(let n=0;l>=n;n++){if(g[n].some(n=>t.conflicts(e[o],e[n])))continue;let l=0,c=0;for(const e of g[n])l+=i[o][e],c+=d[o][e];if(p[o]=n,g[n].push(o),y(o+1,Math.max(r,n),s+l,a+c),g[n].pop(),p[o]=-1,m>=75e3)return}};return p[0]=0,g[0].push(0),y(1,0,0,0),h}(a,u,t,{...d,assignment:Xw(a,u,t,d)}),f=new Map,m=h.map(e=>(f.has(e)||f.set(e,f.size),f.get(e))),p=Array.from({length:f.size||(e.length>0?1:0)},()=>({occupants:[],peak:{topPeak:0,botPeak:0}})),g={};a.forEach((e,t)=>{const o=m[t],n=p[o];n.occupants.push({id:e,end:s[e].end??-1/0});const r=l.get(e)?.group;r&&(n.group=r),g[e]=o});for(const t of[...e].sort((e,t)=>ow(e.id,t.id)))null==g[t.id]&&(p[0].occupants.push({id:t.id,end:-1/0}),g[t.id]=0);for(const e of p){e.occupants.sort((e,t)=>(s[e.id].start??1/0)-(s[t.id].start??1/0)||ow(e.id,t.id));for(const t of e.occupants){const n=o[t.id];e.peak.topPeak=Math.max(e.peak.topPeak,n?.topPeak||0),e.peak.botPeak=Math.max(e.peak.botPeak,n?.botPeak||0)}}const y={slots:p,slotByNode:g};return function(e,t){for(Ew.has(e)&&Ew.delete(e),Ew.set(e,{slots:t.slots.map(e=>({occupants:e.occupants.map(e=>({...e})),peak:{...e.peak},...null!=e.group?{group:e.group}:{}})),slotByNode:{...t.slotByNode}});Ew.size>12;){const e=Ew.keys().next().value;if(null==e)break;Ew.delete(e)}}(r,y),y}function Kw(e){return e.topMass+e.botMass}function Qw(e,t){const o=e.samples.filter(e=>e.t===t);if(o.length>0)return o.reduce((e,t)=>Kw(t)<Kw(e)?e:t,o[0]);let n=null;for(const o of e.samples){if(o.t>t)break;n=o}return n}function Zw(e,t,o,n,r,i,s=0){const a=new Map;for(const o of e){if(!o.group||!t[o.id])continue;const e=a.get(o.group)??[];e.push(o),a.set(o.group,e)}if(0===a.size||0>=i)return t;const l=Object.fromEntries(Object.entries(t).map(([e,t])=>[e,{...t,samples:t.samples.map(e=>({...e})),localAttachments:new Map([...t.localAttachments].map(([e,t])=>[e,{...t}]))}]));for(const[e,c]of a){const a=o.map((e,t)=>({slot:e,index:t})).filter(({slot:t})=>t.group===e);if(0===a.length)continue;const u=a[0].slot,d=a.at(-1).slot,h=r[u.occupants[0]?.id],f=r[d.occupants[0]?.id];if(!Number.isFinite(h)||!Number.isFinite(f))continue;const m=(h-u.peak.topPeak*i+(f+d.peak.botPeak*i))/2,p=[...new Set(c.flatMap(e=>t[e.id].samples.map(e=>e.t)))].sort((e,t)=>e-t),g=new Map;for(const e of c)g.set(e.id,new Map);for(const e of p){const o=new Map;for(const r of c){const i=Qw(t[r.id],e);if(!i||1e-9>=Kw(i))continue;const s=n[r.id];if(null==s)continue;const a=o.get(s)??[];a.push({node:r,sample:i}),o.set(s,a)}const a=[...o].sort((e,t)=>e[0]-t[0]).map(([e,t])=>({slot:e,active:t,mass:Math.max(...t.map(({sample:e})=>Kw(e)))}));if(0===a.length)continue;let l=m-(a.reduce((e,t)=>e+t.mass,0)*i+Math.max(0,s)*Math.max(0,a.length-1))/2;for(const t of a){for(const{node:o,sample:n}of t.active){const t=(l-r[o.id])/i+n.topMass-(n.boundaryOffset??0);g.get(o.id).set(e,t)}l+=t.mass*i+Math.max(0,s)}}for(const e of c){const o=t[e.id],n=l[e.id],r=g.get(e.id),i=[];for(const e of p){const t=r.get(e),n=o.samples.filter(t=>t.t===e);if(n.length>0){i.push(...n.map(e=>({...e,...null!=t?{boundaryOffset:(e.boundaryOffset??0)+t}:{}})));continue}const s=Qw(o,e);null!=t&&s&&Kw(s)>1e-9&&i.push({...s,t:e,boundaryOffset:(s.boundaryOffset??0)+t})}n.samples=i,n.localAttachments=new Map([...o.localAttachments].map(([e,t])=>{const o=r.get(t.time);return[e,{...t,...null!=o?{boundaryOffset:(t.boundaryOffset??0)+o}:{}}]}))}}return l}function Jw(e,t,o,n,r){const{plotH:i,padding:s,valueScale:a,packing:l,laneOrder:c,lifetimeMode:u="half",lanePlacement:d="stack",groupPadding:h=0,ribbonLane:f="both",domain:m}=r,p={},g={};for(const t of e)p[t.id]=o[t.id].topPeak||0,g[t.id]=o[t.id].botPeak||0;const y="half"===u,b={};for(const t of e){const e=Array.isArray(t.xExtent)?t.xExtent[0]:null,o=Array.isArray(t.xExtent)?t.xExtent[1]:null;let r=null!=e&&Number.isFinite(e)?e:1/0,i=null!=o&&Number.isFinite(o)?o:-1/0;for(const e of n.outgoing[t.id]){r>e.startTime&&(r=e.startTime),null!=e.systemInTime&&Number.isFinite(e.systemInTime)&&r>e.systemInTime&&(r=e.systemInTime);const t=y?(e.startTime+e.endTime)/2:e.endTime;t>i&&(i=t)}for(const e of n.incoming[t.id]){const t=y?(e.startTime+e.endTime)/2:e.startTime;r>t&&(r=t),e.endTime>i&&(i=e.endTime),null!=e.systemOutTime&&Number.isFinite(e.systemOutTime)&&e.systemOutTime>i&&(i=e.systemOutTime)}b[t.id]={start:Number.isFinite(r)?r:null,end:Number.isFinite(i)?i:null}}let v={},x=[],k=[];if(r.frozenSlots){const e=Dw(r.frozenSlots,o,b);x=e.slots,v=e.slotByNode,k=x.map(nw)}else if("reuse"===l){const n=Uw(e,t,o,b);x=n.slots,v=n.slotByNode}else e.forEach((e,t)=>{x.push({occupants:[{id:e.id,end:b[e.id]?.end??-1/0}],peak:{topPeak:p[e.id],botPeak:g[e.id]},...e.group?{group:e.group}:{}}),v[e.id]=t});_w(x,v),0===k.length&&(k=x.map(nw));let w=null;r.frozenSlots||(r.fixedSlotOrder?function(e,t,o){const n=new Map(o.map((e,t)=>[e,t]));ww(e,t,[...e].sort((e,t)=>(n.get(nw(e))??1/0)-(n.get(nw(t))??1/0)||ow(nw(e),nw(t))))}(x,v,r.fixedSlotOrder):r.runOrdering&&c&&"insertion"!==c&&(w=Nw(e,t,o,b,x,v,{plotH:i,padding:s,valueScale:a,groupPadding:h,laneOrder:c,ribbonLane:f,domain:m}))),_w(x,v);const S=lw(e,t,o,x,v,{plotH:i,padding:s,valueScale:a,stackValueScale:r.stackValueScale,lanePlacement:d,groupPadding:h}),A=0===x.length?0:x[0].peak.topPeak+S.adjacentClearance.reduce((e,t)=>e+t,0)+x[x.length-1].peak.botPeak,C=w?.before.crossings??null,M=w?.after.crossings??null,_=w?.before.weightedLength??null,P=w?.after.weightedLength??null;return{effectiveSlotsHeight:A,centerlines:S.centerlines,laneLifetime:b,slots:x,slotByNode:v,slotCenter:S.slotCenter,stackCenter:S.stackCenter,verticalUtilization:S.verticalUtilization,selectedSlotOrder:x.map(nw),initialSlotOrder:k,ordering:w,crossingsBefore:C,crossingsAfter:M,lengthBefore:_,lengthAfter:P}}var eS={highTransitOcclusion:8,highLaneUtilization:.92,residualCrossings:3};function tS(e){if(!e?.layoutQuality)return[];const t=[],o=e.layoutQuality,n=e.layoutQualityBefore;e.compressedPadding&&t.push({severity:"warning",code:"PROCESS_SANKEY_COMPRESSED_PADDING",message:"Lane gaps were compressed to fit peaks into the plot height.",fix:'Increase height, lower maxValueScale, use packing="reuse", or reduce concurrent peaks.'}),eS.highTransitOcclusion>o.transitOcclusion||t.push({severity:"warning",code:"PROCESS_SANKEY_HIGH_TRANSIT",message:`High transit occlusion (${o.transitOcclusion.toFixed(1)}) — ribbons cross dense intermediate lanes.`,fix:'Try laneOrder="crossing-min+inside-out", packing="reuse", or lanePlacement="hug" with a modest maxValueScale.'}),eS.highLaneUtilization>o.verticalUtilization||t.push({severity:"warning",code:"PROCESS_SANKEY_HIGH_UTILIZATION",message:`Lane utilization is ${Math.round(100*o.verticalUtilization)}% of plot height.`,fix:"Increase chart height or cap band scale with maxValueScale."});const r=e.crossingsAfter??o.crossings;return null==r||eS.residualCrossings>r||t.push({severity:"warning",code:"PROCESS_SANKEY_RESIDUAL_CROSSINGS",message:`Ordering left ${r} edge-pair crossings`+(n?` (from ${n.crossings})`:"")+".",fix:'Prefer laneOrder="crossing-min" or "crossing-min+inside-out"; check for unavoidable fan-outs.'}),t}function oS(e){if(!e?.layoutQuality)return null;const t=e.layoutQuality,o=e.layoutQualityBefore,n=e.crossingsAfter??t.crossings;return[`ProcessSankey layout uses ${e.slots?.length??"?"} packed lane(s).`,null!=n?`Edge-pair crossings ${o?o.crossings+" → ":""}${n}.`:null,`Pixel path length ${o?Math.round(o.pixelLength)+" → ":""}${Math.round(t.pixelLength)}.`,`Transit occlusion ${o?o.transitOcclusion.toFixed(1)+" → ":""}${t.transitOcclusion.toFixed(1)}.`,`Lane utilization ${Math.round(100*t.verticalUtilization)}%.`,e.compressedPadding?"Lane gaps were compressed to fit the plot.":null].filter(Boolean).join(" ")}function nS(e){const t=[],o=e.domain;null==o?t.push({severity:"error",code:"PROCESS_SANKEY_MISSING_DOMAIN",message:"ProcessSankey requires domain: [tStart, tEnd].",fix:"Pass domain={[start, end]} as numbers or Date-compatible values."}):Array.isArray(o)&&2===o.length&&Number.isFinite(Number(o[0]))&&Number.isFinite(Number(o[1]))||t.push({severity:"error",code:"PROCESS_SANKEY_BAD_DOMAIN",message:"domain must be a 2-tuple of finite times.",fix:"Use domain={[t0, t1]} with t0 <= t1."});const n=e.edges;if(Array.isArray(n)&&n.length>0){const e=n[0];null!=e.startTime&&null!=e.endTime||t.push({severity:"warning",code:"PROCESS_SANKEY_EDGE_TIMES",message:"Edges should carry startTime and endTime for temporal layout.",fix:"Add startTime/endTime fields or set startTimeAccessor/endTimeAccessor."})}const r=e.nodes,i=Array.isArray(r)?r.length:0;return!0!==e.showLabels||24>i||t.push({severity:"warning",code:"PROCESS_SANKEY_LABEL_DENSITY",message:`showLabels={true} with ${i} nodes may overcrowd the plot.`,fix:'Use showLabels="auto" with optional labelPriorityAccessor / maxLabels.'}),80>(Array.isArray(n)?n.length:0)||null!=e.layoutExecution||"off"===e.packing||t.push({severity:"warning",code:"PROCESS_SANKEY_WORKER_HINT",message:"Dense ProcessSankey layouts benefit from worker packing/order.",fix:'layoutExecution defaults to "auto"; set layoutExecution="worker" or raise layoutWorkerThreshold deliberately.'}),t}function rS(e,t,o,n={}){const r=!1!==n.inferOpeningStock,i=[];for(const t of o){const o=Number(t.value);if(!Number.isFinite(o))continue;const n=Number(t.endTime);t.target===e&&Number.isFinite(n)&&i.push({time:n,delta:o});const r=Number(t.startTime);if(t.source===e&&Number.isFinite(r)&&i.push({time:r,delta:-o}),t.target===e&&null!=t.systemOutTime){const e=Number(t.systemOutTime);Number.isFinite(e)&&i.push({time:e,delta:-o})}}i.sort((e,t)=>e.time-t.time||t.delta-e.delta);let s=0,a=0,l=0;for(const e of i)s+=e.delta,a=Math.min(a,s),e.time>t||(l+=e.delta);return r?l-a:l}function iS(e){return null==e?NaN:e instanceof Date?e.getTime():"number"==typeof e?e:new Date(e).getTime()}function sS(e,t,o,n="horizontal"){return"vertical"===n?{top:e?38:t?28:16,right:24,bottom:24,left:o?72:24}:{top:e?30:t?24:8,right:80,bottom:o?28:8,left:80}}var aS=require("react/jsx-runtime"),lS="var(--semiotic-grid, #94a3b8)",cS="var(--semiotic-text-secondary, #475569)",uS="var(--semiotic-text-secondary, #94a3b8)",dS=require("react"),hS=require("d3-scale"),fS=require("d3-scale");function mS(e,t,o,n,r,i,s,a,l={}){const c=r,u=e=>a?Math.max(a[0],Math.min(a[1],e)):e;let d=i(u(e.time));const h=i(u(o.time)),f=e.value*c,m=o.value*c,p=t+(e.boundaryOffset??0)*c,g=n+(o.boundaryOffset??0)*c,y=e.sideMassBefore*c,b=o.sideMassAfter*c;let v,x,k,w;"top"===e.side?(v=p-y,x=v+f):(x=p+y,v=x-f),"top"===o.side?(k=g-b,w=k+m):(w=g+b,k=w-m);const S=l.sourceRunwayStart,A=l.minRun,C=Math.abs((k+w)/2-(v+x)/2),M=h-d,_="number"==typeof S&&Number.isFinite(S),P="number"==typeof A&&Number.isFinite(A)&&A>0;if(_&&C>1e-9&&M>0&&("auto"===A||P)){const t="source"===s?.85:"target"===s?.15:.5,o="auto"===A?Math.min(144,Math.sqrt(8*C/(1.5*Math.min(t*t,(1-t)*(1-t))))):A;if(o>M){const t=i(u(Math.min(S,e.time)));Number.isFinite(t)&&(d=Math.min(d,Math.max(Math.min(d,t),h-o)))}}const R="source"===s?d+.85*(h-d):"target"===s?d+.15*(h-d):(d+h)/2;return{sx:d,sTop:v,sBot:x,tx:h,tTop:k,tBot:w,cp1X:R,cp2X:R}}function pS(e){return Math.max(18,11*e.length*.58)}function gS(e){const t=1.22*pS(e.labelText)+4;return"start"===e.labelAnchor?[e.labelX,e.labelX+t]:"middle"===e.labelAnchor?[e.labelX-t/2,e.labelX+t/2]:[e.labelX-t,e.labelX]}function yS(e,t){const o=e.labelX-pS(e.labelText),n=t.labelX-pS(t.labelText);return t.labelX+3>=o&&e.labelX+3>=n}var bS=/(-?(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?),(-?(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)/gi;function vS(e){return e.replace(bS,(e,t,o)=>`${o},${t}`)}function xS(e){if(!e)return;const t=e=>({x:e.y,y:e.x});return{...e,...e.points&&{points:e.points.map(t)},...e.segments&&{segments:e.segments.map(e=>e.map(t))}}}function kS(e){return{...e,pathD:vS(e.pathD),y0:e.x0,y1:e.x1,x0:0,x1:0}}function wS(e){const{nodes:t,edges:o,domain:n,plotW:r,plotH:i,ribbonLane:s,ribbonMinRun:a=0,edgeOpacity:l,colorOf:c,layoutOpts:u,orientation:d="horizontal",showLabels:h=!0,labelPriorityAccessor:f,maxLabels:m,selectionDatum:p="raw",styleRules:g,colorBy:y,valueAccessor:b,usageMode:v="static"}=e,x="vertical"===d?i:r,k="vertical"===d?r:i,w=Uk(t,o,n,{usageMode:v}),{fatal:S,warnings:A}=function(e){const t=[],o=[];for(const n of e)"fatal"===Xk(n)?t.push(n):o.push(n);return{fatal:t,warnings:o}}(w),C=function(e,t,o="static"){if("strip"!==Gk(o).invalidSystemTime)return e;const n=new Set(t.filter(e=>"invalid-system-time"===e.kind).map(e=>e.id));return 0===n.size?e:e.map(e=>{if(!n.has(e.id))return e;const t={...e};return null==t.systemInTime||Number.isFinite(t.systemInTime)||delete t.systemInTime,null==t.systemOutTime||Number.isFinite(t.systemOutTime)||delete t.systemOutTime,t})}(o,w,v),M=(0,fS.scaleTime)().domain(n).range([0,x]);if(S.length>0)return{layout:null,layoutConfig:{bands:[],ribbons:[],showLabels:!1!==h},issues:S,warnings:A,xScale:M};const _=function(e,t,o){const{plotH:n,pairing:r="temporal",packing:i="reuse",laneOrder:s="crossing-min",lifetimeMode:a="half",maxValueScale:l,lanePlacement:c="stack",nodeSizing:u="temporal",groupPadding:d=0,ribbonLane:h="both",domain:f}=o,m=Number.isFinite(d)?Math.max(0,d):0,p=function(e,t){const o={},n={};for(const t of e)o[t.id]=[],n[t.id]=[];for(const e of t)n[e.source]&&n[e.source].push(e),o[e.target]&&o[e.target].push(e);return{incoming:o,outgoing:n}}(e,t),g=function(e,t,o,n="temporal"){const r="temporal"===n?(e,t)=>e.endTime-t.endTime||ow(e.id,t.id):(e,t)=>t.value-e.value||ow(e.id,t.id),i="temporal"===n?(e,t)=>e.startTime-t.startTime||ow(e.id,t.id):(e,t)=>t.value-e.value||ow(e.id,t.id),s=new Map;for(const e of t)s.set(e.id,{});const a=(e,t)=>{const o=new Map;for(const n of e){const e=n[t];o.has(e)||o.set(e,{partner:e,edges:[],total:0,earliestStart:1/0,latestEnd:-1/0});const r=o.get(e);r.edges.push(n),r.total+=n.value,r.earliestStart=Math.min(r.earliestStart,n.startTime),r.latestEnd=Math.max(r.latestEnd,n.endTime)}const s=[...o.values()];s.sort("temporal"===n?(e,o)=>"target"===t?e.earliestStart-o.earliestStart||ow(e.partner,o.partner):e.latestEnd-o.latestEnd||ow(e.partner,o.partner):(e,t)=>t.total-e.total||ow(e.partner,t.partner));for(const e of s)e.edges.sort("target"===t?i:r);return s};for(const t of e){const e=o.outgoing[t.id],n=o.incoming[t.id];if(0===n.length)a(e,"target").forEach((e,t)=>{const o=t%2==0?"top":"bot";for(const t of e.edges)s.get(t.id).sourceSide=o});else if(0===e.length)a(n,"source").forEach((e,t)=>{const o=t%2==0?"top":"bot";for(const t of e.edges)s.get(t.id).targetSide=o});else{const t=a(n,"source"),o=a(e,"target"),r=Math.max(t.length,o.length);for(let e=0;r>e;e++){const n=e%2==0?"top":"bot";if(t[e])for(const o of t[e].edges)s.get(o.id).targetSide=n;if(o[e])for(const t of o[e].edges)s.get(t.id).sourceSide=n}}}return s}(e,t,p,r);let y={};for(const t of e)y[t.id]=xw(t,p,g,void 0,u);const b=Jw(e,t,y,p,{plotH:n,padding:12,valueScale:1,packing:i,laneOrder:s,lifetimeMode:a,runOrdering:!0,lanePlacement:"stack",groupPadding:m,ribbonLane:h,domain:f}),v=b.slots.map(e=>({occupants:e.occupants.map(e=>({...e})),peak:{...e.peak},...null!=e.group?{group:e.group}:{}})),x=new Set;for(const e of t){const t=b.slotByNode[e.source],o=b.slotByNode[e.target];if(void 0===t||void 0===o)continue;const n=g.get(e.id);t!==o?t>o?(n.sourceSide="top",n.targetSide="bot"):(n.sourceSide="bot",n.targetSide="top"):(x.add(e.id),n.sourceSide="bot",n.targetSide="bot")}for(const t of e){const e=p.outgoing[t.id],o=p.incoming[t.id],n=new Set(e.map(e=>g.get(e.id).sourceSide)),r=new Set(o.map(e=>g.get(e.id).targetSide));if(1===n.size&&o.length>0){const e=[...n][0];for(const t of o)b.slotByNode[t.source]===b.slotByNode[t.target]&&(g.get(t.id).targetSide=e)}if(1===r.size&&e.length>0){const t=[...r][0];for(const o of e)b.slotByNode[o.source]===b.slotByNode[o.target]&&(g.get(o.id).sourceSide=t)}}!function(e,t,o){const n=new Map,r=[];for(const t of e)r.push({time:t.startTime,kind:"out",edge:t}),r.push({time:t.endTime,kind:"in",edge:t});r.sort((e,t)=>e.time-t.time||(e.kind===t.kind?0:"in"===e.kind?-1:1)||("out"===e.kind?t.edge.value-e.edge.value:0)||ow(e.edge.id,t.edge.id));const i=e=>{let t=n.get(e);return t||(t={top:0,bot:0},n.set(e,t)),t},s=(e,t,o)=>{const n="top"===t?"bot":"top",r=Math.min(o,e[t]);e[t]-=r;const i=o-r;i>0&&(e[n]=Math.max(0,e[n]-i))};for(const e of r){const{edge:n}=e;if("in"===e.kind){const e=t.get(n.id)?.targetSide??"bot";i(n.target)[e]+=n.value;continue}const r=i(n.source),a=t.get(n.id);let l=a.sourceSide??"bot";if(o[n.source]===o[n.target]){const e=r.top>=n.value,t=r.bot>=n.value;e!==t?l=e?"top":"bot":e||t||r.top===r.bot||(l=r.top>r.bot?"top":"bot"),a.sourceSide=l,a.targetSide=l}s(r,l,n.value)}}(t,g,b.slotByNode),function(e,t,o,n){for(const r of e){const e=t.incoming[r.id],i=t.outgoing[r.id];if(0===e.length||0===i.length)continue;const s=()=>{const t={inTop:0,inBot:0,outTop:0,outBot:0};for(const n of e)"top"===o.get(n.id).targetSide?t.inTop+=n.value:t.inBot+=n.value;for(const e of i)"top"===o.get(e.id).sourceSide?t.outTop+=e.value:t.outBot+=e.value;return t},a=(e,t)=>{const r=s(),a="top"===e?r.outTop-r.inTop:r.outBot-r.inBot,l="top"===t?r.inTop-r.outTop:r.inBot-r.outBot;if(0>=a||0>=l)return!1;const c=Math.min(a,l),u=i.filter(t=>!n.has(t.id)&&o.get(t.id).sourceSide===e&&c>=t.value).sort((e,t)=>t.value-e.value||ow(e.id,t.id));return 0!==u.length&&(o.get(u[0].id).sourceSide=t,!0)};let l=i.length+1;for(;l-- >0&&(a("top","bot")||a("bot","top")););}}(e,p,g,x),y={};for(const t of e)y[t.id]=xw(t,p,g,void 0,u);const k=Jw(e,t,y,p,{plotH:n,padding:12,valueScale:1,packing:i,laneOrder:s,lifetimeMode:a,frozenSlots:v,lanePlacement:"stack",groupPadding:m,ribbonLane:h,domain:f}),w=k.effectiveSlotsHeight??k.slots.reduce((e,t)=>e+t.peak.topPeak+t.peak.botPeak,0),S=k.slots.slice(0,-1).reduce((e,t,o)=>e+(null!=t.group&&t.group===k.slots[o+1].group?1:0),0),A=Math.max(1,k.slots.length+1-S),C=Math.min(12,Math.max(0,.35*n-S*m)/A),M=2*C+rw(k.slots,C,m).reduce((e,t)=>e+t,0),_=w>0?Math.max(0,(n-M)/w):1,P=Number.isFinite(l)&&l>0?Math.min(_,l):_;let R=Jw(e,t,y,p,{plotH:n,padding:C,valueScale:P,packing:i,laneOrder:s,lifetimeMode:a,frozenSlots:v,lanePlacement:c,groupPadding:m,ribbonLane:h,domain:f,stackValueScale:_});const j=Number.isFinite(l)&&l>0&&_>l+1e-12;if("insertion"!==s&&("hug"===c||j)&&R.slots.length>1&&(Nw(e,t,y,R.laneLifetime,R.slots,R.slotByNode,{plotH:n,padding:C,valueScale:P,groupPadding:m,laneOrder:s,ribbonLane:h,domain:f,lanePlacement:c,mode:"geometry-refine"}),R=Jw(e,t,y,p,{plotH:n,padding:C,valueScale:P,packing:i,laneOrder:s,lifetimeMode:a,frozenSlots:R.slots,fixedSlotOrder:R.slots.map(nw),lanePlacement:c,groupPadding:m,ribbonLane:h,domain:f,stackValueScale:_})),function(e,t){const o=(e,o)=>{for(const n of e){const e=new Map;for(const r of n){const n=`${("out"===o?t.get(r.id)?.sourceSide:t.get(r.id)?.targetSide)??""}\0${"out"===o?r.startTime:r.endTime}`,i="out"===o?`${r.target}\0${r.endTime}`:`${r.source}\0${r.startTime}`,s=e.get(n);if(null!=s&&s!==i)return!0;e.set(n,i)}}return!1};return o(Object.values(e.outgoing),"out")||o(Object.values(e.incoming),"in")}(p,g)){const o=function(e,t,o,n){const r=new Map;for(const i of e){const e=t[i.source]?.localAttachments.get(i.id),s=t[i.target]?.localAttachments.get(i.id),a=o[i.source],l=o[i.target];if(!(e&&s&&Number.isFinite(a)&&Number.isFinite(l)))continue;const c=vw(e,a,n),u=vw(s,l,n);r.set(i.id,{source:(c[0]+c[1])/2,target:(u[0]+u[1])/2})}return r}(t,y,R.centerlines,P);y={};for(const t of e)y[t.id]=xw(t,p,g,o,u);R=Jw(e,t,y,p,{plotH:n,padding:C,valueScale:P,packing:i,laneOrder:s,lifetimeMode:a,frozenSlots:R.slots,fixedSlotOrder:R.slots.map(nw),lanePlacement:c,groupPadding:m,ribbonLane:h,domain:f,stackValueScale:_})}const L=new Map(b.initialSlotOrder.map((e,t)=>[e,t])),T=[...R.slots].sort((e,t)=>(L.get(nw(e))??1/0)-(L.get(nw(t))??1/0)||ow(nw(e),nw(t))),I={};T.forEach((e,t)=>{for(const o of e.occupants)I[o.id]=t});const $=lw(e,t,y,T,I,{plotH:n,padding:C,valueScale:P,stackValueScale:_,lanePlacement:"stack",groupPadding:m}),N=Zw(e,y,T,I,$.centerlines,P,m),D=gw(Rw(I,t),jw(I,t),t,N,T,I,$.centerlines,R.laneLifetime,P,$.verticalUtilization,h,f);y=Zw(e,y,R.slots,R.slotByNode,R.centerlines,P,m);const E=gw(Rw(R.slotByNode,t),jw(R.slotByNode,t),t,y,R.slots,R.slotByNode,R.centerlines,R.laneLifetime,P,R.verticalUtilization,h,f);return{nodeData:y,sides:g,valueScale:P,padding:C,compressedPadding:12>C,centerlines:R.centerlines,laneLifetime:R.laneLifetime,slots:R.slots,slotByNode:R.slotByNode,crossingsBefore:"insertion"===s?null:D.crossings,crossingsAfter:"insertion"===s?null:E.crossings,lengthBefore:"insertion"===s?null:D.weightedLength,lengthAfter:"insertion"===s?null:E.weightedLength,layoutQualityBefore:D,layoutQuality:E}}(t,C,{plotH:k,...u,ribbonLane:s,domain:n}),{centerlines:P,nodeData:R,valueScale:j}=_,L=Uy(y,b),T=[],I=[],$=0===a?new Map:function(e,t,o){const n=new Set(t.map(e=>e.target)),r=new Map(e.map(e=>[e.id,e])),i=new Map;for(const e of t){if(n.has(e.source))continue;const t=i.get(e.source)??[];t.push(e),i.set(e.source,t)}const s=new Map;for(const t of e){if(!t.group)continue;const e=s.get(t.group)??[];e.push(t),s.set(t.group,e)}const a=new Set;for(const[e,t]of s){const o=t.flatMap(e=>i.get(e.id)??[]),r=new Set(o.map(e=>e.startTime));o.length>0&&1===r.size&&t.every(e=>{const t=e.xExtent?.[0],r=o[0].startTime;return!n.has(e.id)&&(i.get(e.id)?.length??0)>0&&Number.isFinite(t)&&r>t})&&a.add(e)}const l=new Map;for(const[e,t]of i){const n=r.get(e);if(n?.group&&!a.has(n.group))continue;const i=n?.xExtent?.[0],s=[...t].sort((e,t)=>e.startTime-t.startTime||e.id.localeCompare(t.id)),c=s[0]?.startTime-1;let u=null;for(let e=0;s.length>e;){const t=s[e].startTime;let n=e+1;for(;s.length>n&&s[n].startTime===t;)n++;for(let t=e;n>t;t++){const e=s[t],n=Number.isFinite(i)&&e.startTime>i,r=Number.isFinite(e.systemInTime)&&e.startTime>e.systemInTime;if(!n&&!r)continue;let a=o[0];n&&(a=Math.max(a,i)),r&&(a=Math.max(a,e.systemInTime)),!n&&r&&Number.isFinite(c)&&(a=Math.max(a,c)),null!=u&&(a=Math.max(a,u)),e.startTime>a&&l.set(e.id,a)}u=t,e=n}}for(const[e,t]of s){if(!a.has(e))continue;const o=t.flatMap(e=>i.get(e.id)??[]);if(!o.every(e=>l.has(e.id))){for(const e of o)l.delete(e.id);continue}const n=Math.max(...o.map(e=>l.get(e.id)));for(const e of o)l.set(e.id,n)}return l}(t,C,n),N=new Map(t.filter(e=>e.group).map(e=>[e.id,e.group])),D=new Map;for(const e of C){const t=R[e.source]?.localAttachments.get(e.id),o=R[e.target]?.localAttachments.get(e.id);t&&o&&D.set(e.id,mS(t,P[e.source],o,P[e.target],j,M,s,n,{minRun:a,sourceRunwayStart:$.get(e.id)}))}const E=function(e,t,o,n,r,i){const s=new Map(t),a=new Map;for(const t of e){const e=i?.get(t.source),o=null==e?"node:"+t.source:"group:"+e,n=a.get(o)??new Map,r=n.get(t.startTime)??[];r.push(t),n.set(t.startTime,r),a.set(o,n)}for(const e of a.values())for(const[i,a]of e){if(!a.some(e=>o.has(e.id)))continue;const e=a.map(e=>t.get(e.id));if(e.some(e=>null==e))continue;const l=n(i),c=Math.min(...e.map(e=>e.sx));if(c>=l-1e-9)continue;const u=Math.max(...a.map(e=>{const t=o.get(e.id);return null==t?l:Math.min(l,n(t))})),d=Math.min(l,Math.max(c,u));for(const e of a){const o=t.get(e.id),n=d+(o.tx-d)*("source"===r?.85:"target"===r?.15:.5);s.set(e.id,{...o,sx:d,cp1X:n,cp2X:n})}}return s}(C,D,$,M,s,N),O=function(e,t,o,n,r){const i=new Map;for(const s of e){if(!o.has(s.id))continue;const e=t.get(s.id);if(!e||e.sx>=n(s.startTime)-1e-9)continue;const a=r(e.sx);Number.isFinite(a)&&s.startTime>a&&i.set(s.id,a)}return i}(C,E,$,M,e=>n[0]+e/x*(n[1]-n[0])),B=function(e,t,o){const n=new Map,r=new Map;for(const[e,t]of o??[]){const o=r.get(t)??[];o.push(e),r.set(t,o)}for(const i of e){const e=t.get(i.id);if(null==e||!Number.isFinite(e)||e>=i.startTime)continue;const s=o?.get(i.source),a=null==s?[i.source]:r.get(s)??[i.source];for(const t of a){const o=n.get(t)??new Map,r=o.get(i.startTime);o.set(i.startTime,null==r?e:Math.min(r,e)),n.set(t,o)}}return n}(C,O,N);t.forEach((e,t)=>{const o=R[e.id];if(!o||0===o.samples.length)return;const r=(i=o.samples,(s=B.get(e.id))&&0!==s.size?i.map(e=>{const t=s.get(e.t);return null==t?e:{...e,t:t}}):i);var i,s;const a=function(e,t,o,n,r){if(0===e.length)return null;const i=bw(e,r),s=e=>t+(i[e].boundaryOffset??0)*o,a=e=>s(e)-i[e].topMass*o,l=e=>s(e)+i[e].botMass*o;let c=`M${n(i[0].t)},${a(0)}`;for(let e=1;i.length>e;e++)c+=` L${n(i[e].t)},${a(e)}`;c+=` L${n(i[i.length-1].t)},${l(i.length-1)}`;for(let e=i.length-2;e>=0;e--)c+=` L${n(i[e].t)},${l(e)}`;return c+" Z"}(r,P[e.id],j,M,n);if(!a)return;const l=bw(r,n),u=l.find(e=>e.topMass+e.botMass>0)||l[0],h=P[e.id]+(u.botMass-u.topMass+2*(u.boundaryOffset??0))*j/2;let f,m,p=c(e.id,t),y=p,b=.5;const v=e.__raw??e;if(g&&g.length>0){const e=Jy(v,g,L(v));"string"==typeof e.fill?p=e.fill:null!=e.fill&&ti(e.fill)&&(m=e.fill,p=e.fill.background&&"transparent"!==e.fill.background?e.fill.background:p),"string"==typeof e.stroke&&(y=e.stroke),"number"==typeof e.strokeWidth&&(b=e.strokeWidth),"number"==typeof e.fillOpacity&&(f=e.fillOpacity),"number"==typeof e.opacity&&null==f&&(f=e.opacity)}const x=function(e,t,o,n,r,i){const s=o.nodeData[e];if(!s||0===s.samples.length)return[];const a=o.valueScale,l=o.centerlines[e],c=bw(s.samples,r),u=c.find(e=>e.topMass+e.botMass>0)||c[0],d=[...c].reverse().find(e=>e.topMass+e.botMass>0)||c[c.length-1],h=n(u.t),f=n(d.t),m=e=>n(yw(e,r)),p=[],g=(e,t,o,n)=>`M${e},${t} L${o},${t} L${o},${n} L${e},${n} Z`;for(const o of t){if(o.source===e&&null!=o.systemInTime&&Number.isFinite(o.systemInTime)){const e=s.localAttachments.get(o.id),t=i?.get(o.id)??o.startTime;if(e&&"out"===e.kind&&t>o.systemInTime){const n=m(o.systemInTime),i=m(t),s=null!=r&&r[0]>o.systemInTime,c=s?n:n-20,u=s?Math.min(i,n+20):n,d=Math.max(h,c);if(i>d){const[t,o]=vw(e,l,a);p.push({pathD:g(d,t,i,o),x0:c,x1:u,from:0,to:1})}}}if(o.target===e&&null!=o.systemOutTime&&Number.isFinite(o.systemOutTime)){const e=s.localAttachments.get(o.id);if(e&&"in"===e.kind&&o.systemOutTime>o.endTime){const t=m(o.systemOutTime),n=m(o.endTime),r=t+20,i=Math.min(f,r);if(i>n){const[o,s]=vw(e,l,a);p.push({pathD:g(n,o,i,s),x0:t,x1:r,from:1,to:0})}}}}return p}(e.id,C,_,M,n,O);T.push({id:e.id,pathD:a,fill:p,stroke:y,strokeWidth:b,...null!=f&&{fillOpacity:f},...m&&{hatchFill:m},...x.length>0&&{gradientStubs:x},rawDatum:v,labelX:M("vertical"===d&&e.xExtent?e.xExtent[0]:u.t)-4,labelY:h,labelText:e.label??e.id})});const F=new Map;t.forEach((e,t)=>F.set(e.id,t)),C.forEach(e=>{const t=E.get(e.id);if(!t)return;const o=F.get(e.source)??0,n=c(e.source,o),{pathD:r,bezier:i}=Uf(t),s=e.__raw??e,a="function"==typeof l?Number(l(s)):l,u=Number.isFinite(a)?Math.max(0,Math.min(1,a)):.35;I.push({id:e.id,pathD:r,fill:n,opacity:u,rawDatum:s,bezier:i})});const z=function(e,t,o){const n=e.map(e=>({...e})),r=new Map;for(const e of n){const o=t[e.id];if(null==o)continue;const n=r.get(o)??[];n.push(e),r.set(o,n)}const i=e=>{if(2>e.length)return;const t=e.reduce((e,t)=>e+t.labelY,0)/e.length,n=(e.length-1)/2;e.forEach((e,r)=>{e.labelY=Math.max(8,Math.min(o-8,t+16*(r-n)))})};for(const e of r.values()){e.sort((e,t)=>e.labelX-t.labelX||e.id.localeCompare(t.id));let t=[],o=-1/0;for(const n of e){const e=n.labelX-pS(n.labelText);t.length>0&&e>o+3&&(i(t),t=[],o=-1/0),t.push(n),o=Math.max(o,n.labelX)}i(t)}return function(e,t){const o=[...e].sort((e,t)=>e.labelY-t.labelY||e.labelX-t.labelX||e.id.localeCompare(t.id));for(let e=0;3>e;e+=1){for(let e=0;o.length>e;e+=1){let t=8;for(let n=0;e>n;n+=1)yS(o[e],o[n])&&(t=Math.max(t,o[n].labelY+16));o[e].labelY=Math.max(o[e].labelY,t)}for(let e=o.length-1;e>=0;e-=1){let n=t-8;for(let t=e+1;o.length>t;t+=1)yS(o[e],o[t])&&(n=Math.min(n,o[t].labelY-16));o[e].labelY=Math.min(o[e].labelY,n)}}}(n,o),n}(T,_.slotByNode,k).map(e=>function(e,t){return"horizontal"===t?e:{...e,pathD:vS(e.pathD),gradientStubs:e.gradientStubs?.map(kS),labelX:e.labelY,labelY:e.labelX,labelAnchor:"middle",labelBaseline:"auto"}}(e,d)),H="vertical"===d?function(e,t,o){const n=e.map(e=>({...e}));for(const e of n){const o=1.22*pS(e.labelText)+4;e.labelX=t-4>o?Math.max(o/2+2,Math.min(t-o/2-2,e.labelX)):t/2}const r=[],i=[...n].sort((e,t)=>e.labelY-t.labelY||e.labelX-t.labelX);for(const e of i){const t=r[r.length-1];!t||Math.abs(t[0].labelY-e.labelY)>14?r.push([e]):t.push(e)}for(const e of r){e.sort((e,t)=>e.labelX-t.labelX||e.id.localeCompare(t.id));const t=[],n=new Map;for(const o of e){const[e,r]=gS(o);let i=t.findIndex(t=>e>t+8);-1===i&&(i=t.length),t[i]=r,n.set(o,i)}const r=e.reduce((e,t)=>e+t.labelY,0)/e.length,i=14*t.length+8>r;for(const t of e){const e=n.get(t)??0;t.labelY=i?Math.min(o-8,12+14*e):Math.max(8,r-14*e)}}return n}(z,r,i):z,W=new Map;if(null!=f)for(const e of t){const t=e.__raw??e,o="function"==typeof f?f(t):Number(t[f]);Number.isFinite(o)&&W.set(e.id,o)}const q=function(e,t,o,n,r={}){if(!1===n)return e.map(e=>({...e,labelText:"",labelDeferred:!1,labelFullText:void 0}));if(!0===n)return e.map(e=>({...e,labelDeferred:!1,labelFullText:void 0}));let i=Math.max(4,Math.min(e.length,Math.floor(Math.max(1,t*o)/14e3)));Number.isFinite(r.maxLabels)&&r.maxLabels>=0&&(i=Math.min(i,Math.floor(r.maxLabels)));const s=e.map((e,t)=>{const o=r.priorityById?.get(e.id),n=Math.abs(e.labelY);return{band:e,index:t,score:null!=o&&Number.isFinite(o)?1e6*o+pS(e.labelText):pS(e.labelText)+.01*n}}).filter(e=>e.band.labelText.trim().length>0).sort((e,t)=>t.score-e.score||e.index-t.index||e.band.id.localeCompare(t.band.id)),a=new Set(s.slice(0,i).map(e=>e.band.id));return e.map(e=>a.has(e.id)||0===e.labelText.trim().length?{...e,labelDeferred:!1,labelFullText:void 0}:{...e,labelFullText:e.labelText,labelText:"",labelDeferred:!0})}(H,r,i,h,{...W.size>0&&{priorityById:W},...null!=m&&{maxLabels:m}});return{layout:_,layoutConfig:{bands:q,ribbons:I.map(e=>function(e,t){return"horizontal"===t?e:{...e,pathD:vS(e.pathD),bezier:xS(e.bezier)}}(e,d)),showLabels:!1!==h,selectionDatum:p},issues:[],warnings:A,xScale:M}}var SS=require("d3-scale"),AS={};function CS(e,t,o,n="reuse",r="crossing-min",i=5e4){return"sync"!==e&&("worker"===e||function(e,t,o="reuse",n="crossing-min"){return e*e*("reuse"===o?80:1)+t*t*(n&&"insertion"!==n?40:1)+10*(e+t)}(t,o,n,r)>=i)}function MS(){return"undefined"!=typeof window&&"undefined"!=typeof Worker}function _S(e){if(!e)return null;const t=e.sides,o=t instanceof Map?t:new Map(Array.isArray(t)?t:[]);return{...e,sides:o}}var PS=class{constructor(e=function(){const e="string"==typeof AS.url&&AS.url?new URL("./processSankeyLayoutWorker.js",AS.url):vp("processSankeyLayoutWorker.js");return new Worker(e,{type:"module",name:"semiotic-process-sankey-layout"})}()){this.session=new Sp({name:"ProcessSankey layout",createWorker:()=>e,parseMessage:e=>{const t=e,{requestId:o,error:n}=wp(t);return n?{requestId:o,ok:!1,error:kp(n)}:{requestId:o,ok:!0,payload:{layout:_S(t.layout),layoutConfig:t.layoutConfig??{bands:[],ribbons:[],showLabels:!0},issues:t.issues??[],warnings:t.warnings??[],domain:t.domain??[0,1],timelineExtent:t.timelineExtent??0}}}})}get isDead(){return this.session.isDead}request(e,t){return this.session.request(e,t)}terminate(){this.session.terminate()}},RS=Ap(()=>new PS);function jS(e){if(function(e){if(!e||0===e.length)return!1;for(const t of e){if("function"==typeof t.when)return!0;if("function"==typeof t.style)return!0}return!1}(e.styleRules))return!0;if("function"==typeof e.edgeOpacity)return!0;if("function"==typeof e.labelPriorityAccessor)return!0;if(e.styleRules&&e.styleRules.length>0){if("function"==typeof e.colorBy)return!0;if("function"==typeof e.valueAccessor)return!0}return!1}function LS(e){if(null!=e&&"object"==typeof e){try{if("function"==typeof structuredClone)return structuredClone(e)}catch{}try{return JSON.parse(JSON.stringify(e))}catch{return}}}function TS(e){const t=LS(e.__raw);return{id:e.id,...null!=e.label&&{label:e.label},...null!=e.group&&{group:e.group},...null!=e.xExtent&&{xExtent:e.xExtent},...null!=t&&{__raw:t}}}function IS(e){const t=LS(e.__raw);return{id:e.id,source:e.source,target:e.target,value:e.value,startTime:e.startTime,endTime:e.endTime,...null!=e.systemInTime&&{systemInTime:e.systemInTime},...null!=e.systemOutTime&&{systemOutTime:e.systemOutTime},...null!=t&&{__raw:t}}}var $S=(e,t)=>({layout:null,layoutConfig:{bands:[],ribbons:[],showLabels:!0},issues:[],warnings:[],xScale:(0,hS.scaleTime)().domain(e).range([0,t])});function NS(e,t){const o=jl(),{execution:n="auto",workerThreshold:r,colorById:i,fallbackPalette:s,rawNodeById:a,rawEdgeById:l}=t,c=(0,dS.useMemo)(()=>Object.keys(i).sort().map(e=>`${e}:${i[e]}`).join("|"),[i]),u=(0,dS.useMemo)(()=>e?[e.nodes,e.edges,e.plotW,e.plotH,e.orientation??"horizontal",e.ribbonLane,(e.ribbonMinRun??0)+"",e.edgeOpacity,(e.showLabels??!0)+"",e.layoutOpts.pairing??"temporal",e.layoutOpts.packing??"reuse",e.layoutOpts.laneOrder??"crossing-min",e.layoutOpts.lifetimeMode??"half",e.layoutOpts.maxValueScale??"",e.layoutOpts.lanePlacement??"stack",e.layoutOpts.nodeSizing??"temporal",e.layoutOpts.groupPadding??0,e.domain[0],e.domain[1],e.styleRules,c]:"null",[e,c]),d=!!e&&!o&&function(e,t,o){return"undefined"!=typeof window&&!!MS()&&!jS(e)&&CS(t,e.nodes.length,e.edges.length,e.layoutOpts.packing??"reuse",e.layoutOpts.laneOrder??"crossing-min",o)}(e,n,r),h=(0,dS.useMemo)(()=>e?d?null:wS(e):$S([0,1],1),[u,d,e]),f=(0,dS.useRef)(o),[m,p]=(0,dS.useState)(()=>e?o?{...wS(e),status:"ready",error:null}:d?{...$S(e.domain,"vertical"===e.orientation?e.plotH:e.plotW),status:"pending",error:null}:{...wS(e),status:"ready",error:null}:{...$S([0,1],1),status:"ready",error:null});return(0,dS.useEffect)(()=>{if(f.current)return void(f.current=!1);if(!e||!d)return;const t=new AbortController;return p(e=>({...e,status:"pending",error:null})),async function(e,t){const{execution:o="auto",workerThreshold:n,signal:r,colorById:i,fallbackPalette:s=["#475569"],rawNodeById:a=new Map,rawEdgeById:l=new Map}=t,c=e.layoutOpts.packing??"reuse",u=e.layoutOpts.laneOrder??"crossing-min";if(!MS()||jS(e)||!CS(o,e.nodes.length,e.edges.length,c,u,n))return wS(e);try{const t=await function(e,t){return MS()?RS.get().request(e,t):Promise.reject(Error("Web Workers are unavailable"))}(function(e,t,o){return{input:{nodes:e.nodes.map(TS),edges:e.edges.map(IS),domain:e.domain,plotW:e.plotW,plotH:e.plotH,orientation:e.orientation,ribbonLane:e.ribbonLane,ribbonMinRun:e.ribbonMinRun,edgeOpacity:"number"==typeof e.edgeOpacity?e.edgeOpacity:.35,layoutOpts:{...e.layoutOpts},showLabels:e.showLabels,..."string"==typeof e.labelPriorityAccessor&&{labelPriorityAccessor:e.labelPriorityAccessor},...null!=e.maxLabels&&{maxLabels:e.maxLabels},...null!=e.selectionDatum&&{selectionDatum:e.selectionDatum},...null!=e.usageMode&&{usageMode:e.usageMode},styleRules:e.styleRules,colorBy:"string"==typeof e.colorBy?e.colorBy:void 0,valueAccessor:"string"==typeof e.valueAccessor?e.valueAccessor:void 0},colorById:t,fallbackPalette:o}}(e,i,s),r);return function(e,t,o){const n=(e.layoutConfig.bands??[]).map(e=>({...e,rawDatum:t.get(e.id)??{id:e.id}})),r=(e.layoutConfig.ribbons??[]).map(e=>({...e,rawDatum:o.get(e.id)??{id:e.id}})),i=(0,SS.scaleTime)().domain(e.domain).range([0,e.timelineExtent]);return{layout:e.layout,layoutConfig:{bands:n,ribbons:r,showLabels:e.layoutConfig.showLabels},issues:e.issues,warnings:e.warnings,xScale:i}}(t,a,l)}catch(t){if("AbortError"===t?.name)throw t;return wS(e)}}(e,{execution:n,workerThreshold:r,signal:t.signal,colorById:i,fallbackPalette:s,rawNodeById:a,rawEdgeById:l}).then(e=>{p({...e,status:"ready",error:null})}).catch(e=>{"AbortError"!==e.name&&p(t=>({...t,status:"error",error:e}))}),()=>t.abort()},[u,d,n,r,s,a,l]),h?{...h,status:"ready",error:null}:m}var DS=require("react");function ES(e,t){return"function"==typeof e?e(t):t[e]}var OS=require("react"),BS=.22;function FS(e,t,o){return!t?.isActive||t.predicate(function(e,t){return"scene"===t?e:e.data}(e,o))}var zS=e=>{const{bands:t=[],ribbons:o=[],showLabels:n=!0,selectionDatum:r="raw"}=e.config,i=e.selection??null,s=[];for(const e of o){const t={__kind:"ribbon",data:e.rawDatum,id:e.id},o=!FS(t,i,r);s.push({type:"bezier",pathD:e.pathD,...e.bezier&&{bezierCache:e.bezier},style:{fill:e.fill,opacity:o?Math.min(e.opacity,BS):e.opacity,stroke:"none"},datum:t})}for(const e of t){if(!e.gradientStubs)continue;const t=!FS({__kind:"band",data:e.rawDatum,id:e.id},i,r);for(let o=0;e.gradientStubs.length>o;o++){const n=e.gradientStubs[o];s.push({type:"bezier",pathD:n.pathD,interactive:!1,style:{fill:e.fill,fillOpacity:t?BS:e.fillOpacity??.86,stroke:"none"},_gradient:{x0:n.x0,x1:n.x1,...null!=n.y0&&{y0:n.y0},...null!=n.y1&&{y1:n.y1},from:n.from,to:n.to},datum:{__kind:"band",data:e.rawDatum,id:`${e.id}__stub${o}`}})}}for(const e of t){const t=!(!e.gradientStubs||0>=e.gradientStubs.length),o={__kind:"band",data:e.rawDatum,id:e.id},n=!FS(o,i,r);s.push({type:"bezier",pathD:e.pathD,style:{...t?{fill:"none"}:{fill:e.hatchFill??e.fill,fillOpacity:n?BS:e.fillOpacity??.86},stroke:e.stroke??("string"==typeof e.fill?e.fill:"#666"),strokeWidth:e.strokeWidth??.5,...n&&t?{opacity:BS}:{}},datum:o})}const a=n?t.flatMap(e=>{const t=e.labelDeferred&&e.labelFullText?.trim(),o=e.labelText.trim().length>0,n=t&&i?.isActive&&FS({__kind:"band",data:e.rawDatum,id:e.id},i,r),s=o?e.labelText:n?e.labelFullText:"";return s.trim()?[{x:e.labelX,y:e.labelY,text:s,anchor:e.labelAnchor??"end",baseline:e.labelBaseline??"middle",fontSize:11,fontWeight:600}]:[]}):[];return{sceneNodes:t.map(e=>({type:"circle",id:e.id,cx:-1e4,cy:-1e4,r:0,style:{fill:e.fill},datum:{__kind:"band",data:e.rawDatum,id:e.id}})),sceneEdges:s,labels:a}};function HS(e){return"object"==typeof e&&null!==e&&"__kind"in e&&("band"===e.__kind||"ribbon"===e.__kind)}var WS=require("react/jsx-runtime");var qS=require("react/jsx-runtime"),YS=(0,qk.forwardRef)(function(e,t){const{nodes:o,edges:n,domain:r,axisTicks:i=[],nodeIdAccessor:s="id",nodeLabel:a,sourceAccessor:l="source",targetAccessor:c="target",valueAccessor:u="value",startTimeAccessor:d="startTime",endTimeAccessor:h="endTime",systemInTimeAccessor:f,systemOutTimeAccessor:m,xExtentAccessor:p="xExtent",groupBy:g,edgeIdAccessor:y="id",colorBy:b,colorScheme:v,showLegend:x,legendPosition:k="right",orientation:w="horizontal",pairing:S="temporal",packing:A="reuse",laneOrder:C="crossing-min",maxValueScale:M,lanePlacement:_="stack",nodeSizing:P="temporal",groupPadding:R=0,ribbonLane:j="both",ribbonMinRun:L=0,lifetimeMode:T="half",showLaneRails:I=!1,showQualityReadout:$=!1,showLabels:N=!0,labelPriorityAccessor:D,maxLabels:E,selectionDatum:O="raw",styleRules:B,layoutExecution:F="auto",layoutWorkerThreshold:z,layoutLoadingContent:H,onLayoutStateChange:W,width:q=600,height:Y=400,margin:G,title:V,description:X,summary:U,accessibleTable:K,responsiveWidth:Q,responsiveHeight:Z,loading:J,loadingContent:ee,emptyContent:te,edgeOpacity:oe=.35,timeFormat:ne,valueFormat:re,tooltip:ie,enableHover:se=!0,onObservation:ae,onClick:le,selection:ce,linkedHover:ue,showParticles:de=!1,particleStyle:he,chartId:fe,frameProps:me={}}=e,pe=(0,qk.useRef)(null),ge=(0,qk.useRef)(null),{rawNodes:ye,rawEdges:be,frameRef:ve,getNodeId:xe,getEdgeId:ke}=function(e){const{ref:t,rawNodesProp:o,rawEdgesProp:n,nodeIdAccessor:r,edgeIdAccessor:i,sourceAccessor:s,targetAccessor:a,scalesRef:l,layoutSnapshotRef:c}=e,[u,d]=(0,DS.useState)([]),[h,f]=(0,DS.useState)([]),m=(0,DS.useRef)(u),p=(0,DS.useRef)(h);m.current=u,p.current=h;const g=(0,DS.useCallback)(e=>{m.current=e,d(e)},[]),y=(0,DS.useCallback)(e=>{p.current=e,f(e)},[]),b=void 0!==n,v=yt(b?n:u),x=(0,DS.useMemo)(()=>{const e=yt(o??[]),t=h;if(0===e.length&&0===t.length)return Tk([],v,s,a);const n=new Set,i=[];for(const t of e){const e=ES(r,t)+"";n.has(e)||(n.add(e),i.push(t))}for(const e of t){const t=ES(r,e)+"";n.has(t)||(n.add(t),i.push(e))}const l=Tk([],v,s,a);for(const e of l)n.has(e.id)||(n.add(e.id),i.push(e));return i},[o,h,v,r,s,a]),k=(0,DS.useRef)(null),w=(0,DS.useCallback)((e,t)=>{const o=ES(i,e);return null!=o?o+"":`${ES(s,e)}-${ES(a,e)}-${t}`},[i,s,a]),S=(0,DS.useCallback)(e=>{if(null==e)return!1;const t=e;return null!=ES(s,t)&&null!=ES(a,t)},[s,a]),A=(0,DS.useCallback)(e=>ES(r,e)+"",[r]);return qy(t,{variant:"network",frameRef:k,overrides:{push(e){if(S(e)){if(b)return void console.warn("ProcessSankey.push: edge ignored — `edges` prop is controlled.");g([...m.current,e])}else y([...p.current,e])},pushMany(e){const t=[],o=[];for(const n of e)S(n)?t.push(n):o.push(n);t.length>0&&(b?console.warn("ProcessSankey.pushMany: edges ignored — `edges` prop is controlled."):g([...m.current,...t])),o.length>0&&y([...p.current,...o])},remove(e){const t=new Set(Array.isArray(e)?e:[e]),o=[];if(!b){const e=m.current,n=[];for(let r=0;e.length>r;r++){const i=e[r];t.has(w(i,r))?o.push(i):n.push(i)}n.length!==e.length&&g(n)}const n=p.current,i=[];for(const e of n){const n=ES(r,e)+"";t.has(n)?o.push(e):i.push(e)}return i.length!==n.length&&y(i),o},update(e,t){const o=new Set(Array.isArray(e)?e:[e]),n=[];if(!b){let e=!1;const r=m.current.map((r,i)=>o.has(w(r,i))?(n.push(r),e=!0,t(r)):r);e&&g(r)}let i=!1;const s=p.current.map(e=>{const s=ES(r,e)+"";return o.has(s)?(n.push(e),i=!0,t(e)):e});return i&&y(s),n},clear(){b||g([]),y([]),k.current?.clear()},getData:()=>v??[],getScales:()=>l.current,getCustomLayout:()=>c.current}}),{rawNodes:x,rawEdges:v,frameRef:k,getNodeId:A,getEdgeId:w,isControlled:b}}({ref:t,rawNodesProp:o,rawEdgesProp:n,nodeIdAccessor:s,edgeIdAccessor:y,sourceAccessor:l,targetAccessor:c,scalesRef:pe,layoutSnapshotRef:ge}),{nodes:we,edges:Se,domain:Ae,rawNodeById:Ce,rawEdgeById:Me}=(0,qk.useMemo)(()=>{const e=(ye??[]).map(e=>{const t=xe(e),o=a?ES(a,e):t,n={id:t,label:null==o?t:o+"",__raw:e},r=g?ES(g,e):null;null!=r&&r+""!=""&&(n.group=r+"");const i=p?ES(p,e):null;if(Array.isArray(i)&&2===i.length){const e=iS(i[0]),t=iS(i[1]);Number.isFinite(e)&&Number.isFinite(t)&&(n.xExtent=[e,t])}return n}),t=(be??[]).map((e,t)=>{const o={id:ke(e,t),source:ES(l,e)+"",target:ES(c,e)+"",value:Number(ES(u,e)),startTime:iS(ES(d,e)),endTime:iS(ES(h,e)),__raw:e};if(f){const t=iS(ES(f,e));Number.isFinite(t)&&(o.systemInTime=t)}if(m){const t=iS(ES(m,e));Number.isFinite(t)&&(o.systemOutTime=t)}return o}),o=[iS(r[0]),iS(r[1])],n=new Map;for(const t of e)null!=t.__raw&&n.set(t.id,t.__raw);const i=new Map;for(const e of t)null!=e.__raw&&i.set(e.id,e.__raw);return{nodes:e,edges:t,domain:o,rawNodeById:n,rawEdgeById:i}},[ye,be,r,xe,ke,a,p,g,l,c,u,d,h,f,m]),_e=Nk({nodes:ye,edges:be,inferNodes:!1,nodeIdAccessor:s,sourceAccessor:l,targetAccessor:c,colorBy:b,colorScheme:v,showLegend:!1,legendPosition:k,selection:ce,linkedHover:ue,onObservation:ae,onClick:le?(e,t)=>{HS(e)?le(e.data,t):le(e,t)}:void 0,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,chartType:"ProcessSankey",chartId:fe,marginDefaults:sS(!!V,$,i.length>0,w),userMargin:G,width:q,height:Y,hasTitle:!!V,loading:J,loadingContent:ee,emptyContent:te}),Pe=(x??!!b)&&!!b,Re=(0,qk.useCallback)(e=>null!=G&&("number"==typeof G||null!=G[e]),[G]),je=(0,qk.useMemo)(()=>{const e={..._e.margin};return Pe&&("right"===k&&!Re("right")&&140>e.right?e.right=140:"bottom"===k&&!Re("bottom")&&80>e.bottom&&(e.bottom=80)),e},[_e.margin,Pe,k,Re]),Le=q-je.left-je.right,Te=Y-je.top-je.bottom,Ie="vertical"===w?Te:Le,$e=(0,qk.useCallback)((e,t)=>{if(b&&ye){const t=Ce.get(e);if(t)return wo(t,b,_e.colorScale)}return _e.effectivePalette[t%_e.effectivePalette.length]||"#475569"},[b,ye,Ce,_e.colorScale,_e.effectivePalette]),Ne=NS((0,qk.useMemo)(()=>Le>0&&Te>0?{nodes:we,edges:Se,domain:Ae,plotW:Le,plotH:Te,orientation:w,ribbonLane:j,ribbonMinRun:L,edgeOpacity:"function"==typeof oe?e=>oe(e):oe,colorOf:$e,showLabels:N,labelPriorityAccessor:D,maxLabels:E,selectionDatum:O,styleRules:B,usageMode:"push",colorBy:b,valueAccessor:u,layoutOpts:{pairing:S,packing:A,laneOrder:C,lifetimeMode:T,maxValueScale:M,lanePlacement:_,nodeSizing:P,groupPadding:R}}:null,[we,Se,Ae,Le,Te,w,j,L,oe,$e,N,D,E,O,B,b,u,S,A,C,T,M,_,P,R]),{execution:F,workerThreshold:z,colorById:(0,qk.useMemo)(()=>{const e={};return we.forEach((t,o)=>{e[t.id]=$e(t.id,o)}),e},[we,$e]),fallbackPalette:_e.effectivePalette,rawNodeById:Ce,rawEdgeById:Me}),{issues:De,warnings:Ee,layout:Oe,xScale:Be}=Ne,Fe=Ne.layoutConfig,ze=Ne.status;pe.current=Oe?{time:Be,centerlines:Oe.centerlines}:{time:Be},ge.current=Oe?{layout:Oe,nodes:we,edges:Se,bands:Fe.bands,ribbons:Fe.ribbons,warnings:Ee,status:ze}:null;const He=(0,qk.useRef)(W);He.current=W,(0,qk.useEffect)(()=>{He.current?.(ze)},[ze]),(0,qk.useEffect)(()=>{0!==Ee.length&&console.warn("ProcessSankey warnings:",Ee.map(Kk).join("; "))},[Ee]);const We=(0,qk.useMemo)(()=>{if(!Pe||!b)return;const e=new Map;(ye??[]).forEach((t,o)=>{const n=ES(b,t),r=null==n?"":n+"";r&&!e.has(r)&&e.set(r,{label:r,color:$e(xe(t),o)})});const t=Array.from(e.values());return 0!==t.length?{legendGroups:[{type:"fill",label:"",items:t,styleFn:e=>{const t=e.color||"#333";return{fill:t,stroke:t}}}]}:void 0},[Pe,b,ye,$e,xe]),qe=function(e){const{tooltip:t,enableHover:o,layout:n,timeFormat:r,valueFormat:i,sourceAccessor:s,targetAccessor:a,valueAccessor:l,startTimeAccessor:c,endTimeAccessor:u}=e,d=(0,OS.useMemo)(()=>!1!==t&&o?void 0===t||!0===t?null:zc(t)||null:null,[t,o]),h=(0,OS.useCallback)(e=>r?r(new Date(e)):Number.isFinite(e)?1e10>Math.abs(e)?Number.isInteger(e)?e+"":e.toFixed(2):new Date(e).toISOString().slice(0,10):"",[r]),f=(0,OS.useCallback)(e=>i?i(e):e+"",[i]);return(0,OS.useCallback)(e=>{if(!e||!e.data)return null;const t=e.data;if(!HS(t))return null;const o=t.data;if(d)return d(o);if("band"===t.__kind){const e=t.id,o=n?function(e){if(!e)return[];const t=new Set,o=[];for(const n of e.samples){const e=n.topMass+n.botMass,r=`${n.t}:${e}`;t.has(r)||(t.add(r),o.push({t:n.t,total:e}))}return o}(n.nodeData[e]):[],r=5,i=o.length>r?o.length:null,s=function(e,t=5){if(t>=e.length)return e.slice();const o=[...e].sort((e,t)=>e.total-t.total),n=o.length-1,r=[{...o[0],mark:"min"},{...o[Math.floor(.25*n)],mark:"q25"},{...o[Math.floor(.5*n)],mark:"median"},{...o[Math.floor(.75*n)],mark:"q75"},{...o[n],mark:"max"}],i=new Set,s=[];for(const e of r)i.has(e.t)||(i.add(e.t),s.push(e));return s.sort((e,t)=>e.t-t.t)}(o,r);return(0,WS.jsxs)("div",{style:{minWidth:160},children:[(0,WS.jsx)("div",{style:{fontWeight:600,marginBottom:4},children:e}),s.length>0&&(0,WS.jsxs)("table",{style:{borderCollapse:"collapse",fontSize:11,width:"100%"},children:[(0,WS.jsx)("thead",{children:(0,WS.jsxs)("tr",{style:{opacity:.6},children:[(0,WS.jsx)("th",{style:{textAlign:"left",fontWeight:500,paddingRight:8},children:"Time"}),(0,WS.jsx)("th",{style:{textAlign:"right",fontWeight:500},children:"Mass"}),null!=i&&(0,WS.jsx)("th",{})]})}),(0,WS.jsx)("tbody",{children:s.map((e,t)=>(0,WS.jsxs)("tr",{children:[(0,WS.jsx)("td",{style:{paddingRight:8},children:h(e.t)}),(0,WS.jsx)("td",{style:{textAlign:"right"},children:f(e.total)}),null!=i&&(0,WS.jsx)("td",{style:{textAlign:"right",paddingLeft:8,opacity:.55},children:e.mark})]},t))})]}),null!=i&&(0,WS.jsxs)("div",{style:{marginTop:4,fontSize:10,opacity:.55},children:["showing ",s.length," of ",i," samples"]})]})}const r=o,i=ES(s,r),m=ES(a,r),p=ES(l,r),g=ES(c,r),y=ES(u,r);return(0,WS.jsxs)("div",{style:{minWidth:160},children:[(0,WS.jsxs)("div",{style:{fontWeight:600,marginBottom:4},children:[i+""," → ",m+""]}),(0,WS.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"auto 1fr",columnGap:8,fontSize:11},children:[null!=p&&(0,WS.jsxs)(WS.Fragment,{children:[(0,WS.jsx)("span",{style:{opacity:.6},children:"value"}),(0,WS.jsx)("span",{style:{textAlign:"right"},children:f(Number(p))})]}),null!=g&&(0,WS.jsxs)(WS.Fragment,{children:[(0,WS.jsx)("span",{style:{opacity:.6},children:"start"}),(0,WS.jsx)("span",{style:{textAlign:"right"},children:h(iS(g))})]}),null!=y&&(0,WS.jsxs)(WS.Fragment,{children:[(0,WS.jsx)("span",{style:{opacity:.6},children:"end"}),(0,WS.jsx)("span",{style:{textAlign:"right"},children:h(iS(y))})]})]})]})},[n,d,h,f,s,a,l,c,u])}({tooltip:ie,enableHover:se,layout:Oe,timeFormat:ne,valueFormat:re,sourceAccessor:l,targetAccessor:c,valueAccessor:u,startTimeAccessor:d,endTimeAccessor:h}),Ye=(0,qk.useMemo)(()=>{if(!Oe)return null;const e=Ee.map(e=>Kk(e));return function(e){const t=e.layout,o=e.nodes,n=e.orientation,r=e.plotW,i=e.plotH,s=e.timelineExtent,a=e.axisTicks,l=e.showQualityReadout??!1,c=e.showLaneRails??!1,u=(e.warnings??[]).slice(0,3),d=e.timeFormat,h=e.colorOf,f=e.toTime,m=e.xScale,{centerlines:p,laneLifetime:g,nodeData:y,valueScale:b,compressedPadding:v,crossingsBefore:x,crossingsAfter:k,layoutQualityBefore:w,layoutQuality:S}=t;let A=null,C=null;for(const e of o){const t=g[e.id];if(!t||null===t.start||null===t.end)continue;const o=m(t.start),n=m(t.end);(null===A||A>o)&&(A=o),(null===C||n>C)&&(C=n)}const M=e=>Math.max(0,Math.min(s,e)),_=M(A??0),P=Math.max(_,M(C??s)),R=a.map((e,t)=>({tick:e,index:t,coordinate:m(f(e.date))})).filter(({coordinate:e})=>e>=_-.5&&P+.5>=e),j=null!==(k??null)&&null!=w&&null!=S,L=l&&(j||u.length>0)?(0,aS.jsxs)("g",{fill:uS,fontSize:10,textAnchor:"end",children:[j&&(0,aS.jsxs)(aS.Fragment,{children:[(0,aS.jsxs)("text",{x:r,y:-14,children:["crossings: ",x," → ",k," ","pixel length: ",Math.round(w.pixelLength)," → ",Math.round(S.pixelLength)]}),(0,aS.jsxs)("text",{x:r,y:-3,children:["transit: ",w.transitOcclusion.toFixed(1)," → ",S.transitOcclusion.toFixed(1)," ","lane use: ",Math.round(100*S.verticalUtilization),"%"]})]}),u.map((e,t)=>(0,aS.jsxs)("text",{x:r,y:j?10+11*t:11*t-3,fill:"var(--semiotic-warning, #b45309)",children:["warn: ",e]},"warn-"+t))]}):null,T=v?(0,aS.jsx)("text",{x:r,y:"vertical"===n?-3:2,fontSize:10,fill:uS,textAnchor:"end",children:"dense layout: lane gaps compressed"}):null,I=(e,t)=>h?h(e,t):lS;return(0,aS.jsxs)("g","vertical"===n?{children:[L,T,R.map(({index:e,coordinate:t})=>(0,aS.jsx)("line",{x1:0,y1:t,x2:r,y2:t,stroke:lS,strokeOpacity:.15,strokeDasharray:"2 4"},"grid-"+e)),c&&o.map((e,t)=>{const o=g[e.id];if(!o||null===o.start)return null;const n=y[e.id],r=n?{topPeak:n.topPeak,botPeak:n.botPeak}:{topPeak:0,botPeak:0},i=p[e.id]+(r.botPeak-r.topPeak)*b/2,s=m(o.start),a=m(o.end),l=I(e.id,t);return(0,aS.jsxs)("g",{children:[(0,aS.jsx)("line",{x1:i,y1:s,x2:i,y2:a,stroke:l,strokeOpacity:.35,strokeWidth:1,strokeDasharray:"3 3"}),(0,aS.jsx)("line",{x1:i-4,y1:s,x2:i+4,y2:s,stroke:l,strokeOpacity:.5}),(0,aS.jsx)("line",{x1:i-4,y1:a,x2:i+4,y2:a,stroke:l,strokeOpacity:.5})]},"lane-"+e.id)}),(0,aS.jsx)("line",{x1:-4,y1:_,x2:-4,y2:P,stroke:lS}),R.map(({tick:e,index:t,coordinate:o})=>{const n=f(e.date),r=null!=e.label?e.label:d?d(new Date(n)):"";return(0,aS.jsxs)("g",{transform:`translate(-4,${o})`,children:[(0,aS.jsx)("line",{x2:-6,stroke:lS}),(0,aS.jsx)("text",{x:-10,y:4,textAnchor:"end",fontSize:11,fill:cS,children:r})]},t)})]}:{children:[L,T,R.map(({index:e,coordinate:t})=>(0,aS.jsx)("line",{x1:t,y1:0,x2:t,y2:i,stroke:lS,strokeOpacity:.15,strokeDasharray:"2 4"},"grid-"+e)),c&&o.map((e,t)=>{const o=g[e.id];if(!o||null===o.start)return null;const n=y[e.id],r=n?{topPeak:n.topPeak,botPeak:n.botPeak}:{topPeak:0,botPeak:0},i=p[e.id]+(r.botPeak-r.topPeak)*b/2,s=m(o.start),a=m(o.end),l=I(e.id,t);return(0,aS.jsxs)("g",{children:[(0,aS.jsx)("line",{x1:s,y1:i,x2:a,y2:i,stroke:l,strokeOpacity:.35,strokeWidth:1,strokeDasharray:"3 3"}),(0,aS.jsx)("line",{x1:s,y1:i-4,x2:s,y2:i+4,stroke:l,strokeOpacity:.5}),(0,aS.jsx)("line",{x1:a,y1:i-4,x2:a,y2:i+4,stroke:l,strokeOpacity:.5})]},"lane-"+e.id)}),(0,aS.jsx)("line",{x1:_,y1:i+4,x2:P,y2:i+4,stroke:lS}),R.map(({tick:e,index:t,coordinate:o})=>{const n=f(e.date),r=null!=e.label?e.label:d?d(new Date(n)):"";return(0,aS.jsxs)("g",{transform:`translate(${o},${i+4})`,children:[(0,aS.jsx)("line",{y2:6,stroke:lS}),(0,aS.jsx)("text",{y:20,textAnchor:"middle",fontSize:11,fill:cS,children:r})]},t)})]})}({layout:Oe,nodes:we,orientation:w,plotW:Le,plotH:Te,timelineExtent:Ie,axisTicks:i,showQualityReadout:$,showLaneRails:I,warnings:e,timeFormat:ne?e=>ne(e):void 0,colorOf:$e,toTime:iS,xScale:e=>Number(Be(e))})},[Oe,we,w,Le,Te,Ie,i,$,I,Ee,ne,$e,Be]),Ge=(0,qk.useMemo)(()=>(ye??[]).map(e=>({id:xe(e),data:e})),[ye,xe]),Ve=(0,qk.useMemo)(()=>{const e=new Map;for(const t of Fe.ribbons)t.bezier&&e.set(t.id,t.bezier);return e},[Fe]),Xe=(0,qk.useMemo)(()=>(be??[]).map((e,t)=>{const o=ke(e,t),n=Number(ES(u,e));return{id:o,source:ES(l,e)+"",target:ES(c,e)+"",value:Number.isFinite(n)?n:0,bezier:Ve.get(o),data:e}}),[be,ke,l,c,u,Ve]);return De.length>0?(0,qS.jsxs)("svg",{width:q,height:Y,role:"img","aria-label":V??"Process Sankey validation failed",children:[(0,qS.jsx)("text",{x:20,y:30,fontSize:13,fontWeight:600,fill:"var(--semiotic-danger, #dc2626)",children:"ProcessSankey: data invalid"}),De.map((e,t)=>(0,qS.jsx)("text",{x:20,y:56+18*t,fontSize:12,fill:"#64748b",children:"• "+Kk(e)},t))]}):_e.loadingEl?_e.loadingEl:_e.emptyEl?_e.emptyEl:(0,qS.jsxs)("div",{style:{position:"relative",width:q,height:Y},children:["pending"===ze&&!1!==H&&!Oe&&(0,qS.jsx)("div",{style:{position:"absolute",inset:0,zIndex:3,background:"var(--semiotic-bg, #fff)"},children:yp(!0,q,Y,H)}),(0,qS.jsx)(tg,{ref:ve,chartType:"force",nodes:Ge,edges:Xe,customNetworkLayout:zS,layoutConfig:Fe,size:[q,Y],responsiveWidth:Q,responsiveHeight:Z,maxDevicePixelRatio:e.maxDevicePixelRatio,margin:je,title:V,description:X??"Temporal process flow with lifetime-bounded node lanes, mass bands, and value-scaled ribbons.",summary:U,accessibleTable:K,enableHover:se,tooltipContent:!1===ie?()=>null:qe,backgroundGraphics:Ye,showParticles:de,particleStyle:he,legend:We,legendPosition:k,...ng({linkedHover:ue,selection:ce,onObservation:ae,onClick:le,mobileInteraction:_e.mobileInteraction,customHoverBehavior:_e.customHoverBehavior,customClickBehavior:_e.customClickBehavior,linkedHoverInClickPredicate:!1}),chartId:fe,colorScheme:Array.isArray(v)?v:void 0,layoutSelection:_e.activeSelectionHook,...me})]})});YS.displayName="ProcessSankey";var GS=require("react"),VS=require("react/jsx-runtime");function XS(e){const t=Ly(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLabels:e.showLabels,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:600,height:600}),{data:o,margin:n,className:r,layout:i="tree",orientation:s="vertical",childrenAccessor:a="children",valueAccessor:l="value",nodeIdAccessor:c="name",colorBy:u,colorScheme:d,colorByDepth:h=!1,edgeStyle:f="curve",nodeLabel:m,nodeSize:p=5,tooltip:g,frameProps:y={},onObservation:b,onClick:v,chartId:x,selection:k,linkedHover:w,loading:S,loadingContent:A,legendInteraction:C,stroke:M,strokeWidth:_,opacity:P}=e,{width:R,height:j,enableHover:L,showLabels:T=!0,title:I,description:$,summary:N,accessibleTable:D}=t,E=Nk({nodes:(0,GS.useMemo)(()=>Lk(o??null,a),[o,a]),edges:void 0,inferNodes:!1,colorBy:h?void 0:u,colorScheme:d,showLegend:!1,legendInteraction:C,selection:k,linkedHover:w,onObservation:b,onClick:v,mobileInteraction:t.mobileInteraction,mobileSemantics:t.mobileSemantics,chartType:"TreeDiagram",chartId:x,marginDefaults:t.marginDefaults,userMargin:n,width:R,height:j,hasTitle:!!I,loading:S,loadingContent:A}),O=(0,GS.useMemo)(()=>new Map,[]),B=(0,GS.useMemo)(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=h?xo[(e.depth||0)%xo.length]:u?wo(e.data||e,u,E.colorScale):My(void 0,E.themeCategorical,d,void 0,O),t},[u,h,E.colorScale,E.themeCategorical,d,O]),F=(0,GS.useMemo)(()=>Gy(B,{stroke:M,strokeWidth:_,opacity:P}),[B,M,_,P]),z=(0,GS.useMemo)(()=>()=>({stroke:"#999",strokeWidth:1,fill:"none"}),[]),H=(0,GS.useMemo)(()=>Gy(z,{stroke:M,strokeWidth:_,opacity:P}),[z,M,_,P]),W=(0,GS.useMemo)(()=>{if("treemap"===i||"circlepack"===i||"partition"===i)return Ik(l)},[i,l]),q=Ey({componentName:"TreeDiagram",data:o});return q?(0,VS.jsx)(lp,{componentName:"TreeDiagram",message:q,width:R,height:j}):E.loadingEl?E.loadingEl:(0,VS.jsx)(fp,{componentName:"TreeDiagram",width:R,height:j,children:(0,VS.jsx)(tg,{chartType:i,...null!=o&&{data:o},size:[R,j],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,maxDevicePixelRatio:e.maxDevicePixelRatio,margin:E.margin,nodeIDAccessor:c,childrenAccessor:a,hierarchySum:W,treeOrientation:s,edgeType:f,nodeStyle:F,edgeStyle:H,colorBy:u,colorScheme:E.effectivePalette,colorByDepth:h,nodeSize:p,nodeLabel:T?m||c:void 0,showLabels:T,enableHover:L,tooltipContent:!1===g?()=>null:zc(g)||void 0,...ng({linkedHover:w,selection:k,onObservation:b,onClick:v,mobileInteraction:E.mobileInteraction,customHoverBehavior:E.customHoverBehavior,customClickBehavior:E.customClickBehavior,linkedHoverInClickPredicate:!1}),...C&&"none"!==C&&{legendHoverBehavior:E.legendState.onLegendHover,legendClickBehavior:E.legendState.onLegendClick,legendHighlightedCategory:E.legendState.highlightedCategory,legendIsolatedCategories:E.legendState.isolatedCategories},className:r,title:I,description:$,summary:N,accessibleTable:D,...null!=e.animate&&{animate:e.animate},...y})})}XS.displayName="TreeDiagram";var US=require("react"),KS=require("react/jsx-runtime");function QS(e){const t=Ly(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLabels:e.showLabels,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,linkedHover:e.linkedHover,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:600,height:600}),{data:o,margin:n,className:r,childrenAccessor:i="children",valueAccessor:s="value",nodeIdAccessor:a="name",colorBy:l,colorScheme:c,colorByDepth:u=!1,labelMode:d="leaf",nodeLabel:h,padding:f=4,paddingTop:m,nodeStyle:p,tooltip:g,frameProps:y={},selection:b,linkedHover:v,onObservation:x,onClick:k,chartId:w,loading:S,loadingContent:A,legendInteraction:C,stroke:M,strokeWidth:_,opacity:P}=e,{nodeStyle:R,...j}=y,{width:L,height:T,enableHover:I,showLabels:$=!0,title:N,description:D,summary:E,accessibleTable:O}=t,B=Nk({nodes:(0,US.useMemo)(()=>Lk(o??null,i),[o,i]),edges:void 0,inferNodes:!1,colorBy:u?void 0:l,colorScheme:c,showLegend:!1,legendInteraction:C,selection:b,linkedHover:v,onObservation:x,onClick:k,mobileInteraction:t.mobileInteraction,mobileSemantics:t.mobileSemantics,chartType:"Treemap",chartId:w,marginDefaults:t.marginDefaults,userMargin:n,width:L,height:T,hasTitle:!!N,loading:S,loadingContent:A}),F=zy(b),z=B.customHoverBehavior,H=(0,US.useCallback)(e=>{if(!e)return z(null);const t=e.data||e;z({data:t?.data||t})},[z]),W=(0,US.useMemo)(()=>new Map,[]),q=(0,US.useMemo)(()=>e=>{const t={stroke:"var(--semiotic-cell-border, var(--semiotic-border, #fff))",strokeWidth:1,strokeOpacity:.8};return t.fill=u?xo[(e.depth||0)%xo.length]:l?wo(e.data||e,l,B.colorScale):My(void 0,B.themeCategorical,c,void 0,W),t},[l,u,B.colorScale,B.themeCategorical,c,W]),Y=(0,US.useMemo)(()=>p||R?e=>({...q(e),...R?R(e)??{}:{},...p?p(e)??{}:{}}):q,[q,p,R]),G=(0,US.useMemo)(()=>Gy(Y,{stroke:M,strokeWidth:_,opacity:P}),[Y,M,_,P]),V=(0,US.useMemo)(()=>B.activeSelectionHook?e=>{const t={...G(e)};if(B.activeSelectionHook.isActive)if(B.activeSelectionHook.predicate(e.data||e))F?.selectedStyle&&Object.assign(t,F.selectedStyle);else{const e=F?.unselectedOpacity??mg;t.opacity=e,t.fillOpacity=e,t.strokeOpacity=e,F?.unselectedStyle&&Object.assign(t,F.unselectedStyle)}return t}:G,[G,B.activeSelectionHook,F]),X=(0,US.useMemo)(()=>Ik(s),[s]),U=void 0!==m?m:!$||"parent"!==d&&"all"!==d?void 0:18,K=Ey({componentName:"Treemap",data:o});return K?(0,KS.jsx)(lp,{componentName:"Treemap",message:K,width:L,height:T}):B.loadingEl?B.loadingEl:(0,KS.jsx)(fp,{componentName:"Treemap",width:L,height:T,children:(0,KS.jsx)(tg,{chartType:"treemap",...null!=o&&{data:o},size:[L,T],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,maxDevicePixelRatio:e.maxDevicePixelRatio,margin:B.margin,nodeIDAccessor:a,childrenAccessor:i,hierarchySum:X,padding:f,paddingTop:U,nodeStyle:V,colorBy:l,colorScheme:B.effectivePalette,colorByDepth:u,nodeLabel:$?h||a:void 0,showLabels:$,labelMode:d,enableHover:I,tooltipContent:!1===g?()=>null:zc(g)||void 0,...ng({linkedHover:v,selection:b,onObservation:x,onClick:k,mobileInteraction:B.mobileInteraction,customHoverBehavior:H,customClickBehavior:B.customClickBehavior,linkedHoverInClickPredicate:!1}),...C&&"none"!==C&&{legendHoverBehavior:B.legendState.onLegendHover,legendClickBehavior:B.legendState.onLegendClick,legendHighlightedCategory:B.legendState.highlightedCategory,legendIsolatedCategories:B.legendState.isolatedCategories},className:r,title:N,description:D,summary:E,accessibleTable:O,...null!=e.animate&&{animate:e.animate},...j})})}QS.displayName="Treemap";var ZS=require("react"),JS=require("react/jsx-runtime");function eA(e){const t=Ly(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLabels:e.showLabels,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:600,height:600}),{data:o,margin:n,className:r,childrenAccessor:i="children",valueAccessor:s="value",nodeIdAccessor:a="name",colorBy:l,colorScheme:c,colorByDepth:u=!1,nodeLabel:d,circleOpacity:h=.7,padding:f=4,tooltip:m,frameProps:p={},onObservation:g,onClick:y,chartId:b,selection:v,linkedHover:x,loading:k,loadingContent:w,legendInteraction:S,stroke:A,strokeWidth:C,opacity:M}=e,{width:_,height:P,enableHover:R,showLabels:j=!0,title:L,description:T,summary:I,accessibleTable:$}=t,N=Nk({nodes:(0,ZS.useMemo)(()=>Lk(o??null,i),[o,i]),edges:void 0,inferNodes:!1,colorBy:u?void 0:l,colorScheme:c,showLegend:!1,legendInteraction:S,selection:v,linkedHover:x,onObservation:g,onClick:y,mobileInteraction:t.mobileInteraction,mobileSemantics:t.mobileSemantics,chartType:"CirclePack",chartId:b,marginDefaults:t.marginDefaults,userMargin:n,width:_,height:P,hasTitle:!!L,loading:k,loadingContent:w}),D=(0,ZS.useMemo)(()=>new Map,[]),E=(0,ZS.useMemo)(()=>e=>{const t={stroke:"currentColor",strokeWidth:1,strokeOpacity:.3,fillOpacity:h};return t.fill=u?xo[(e.depth||0)%xo.length]:l?wo(e.data||e,l,N.colorScale):My(void 0,N.themeCategorical,c,void 0,D),t},[l,u,N.colorScale,h,N.themeCategorical,c,D]),O=(0,ZS.useMemo)(()=>Gy(E,{stroke:A,strokeWidth:C,opacity:M}),[E,A,C,M]),B=(0,ZS.useMemo)(()=>Ik(s),[s]),F=Ey({componentName:"CirclePack",data:o});return F?(0,JS.jsx)(lp,{componentName:"CirclePack",message:F,width:_,height:P}):N.loadingEl?N.loadingEl:(0,JS.jsx)(fp,{componentName:"CirclePack",width:_,height:P,children:(0,JS.jsx)(tg,{chartType:"circlepack",...null!=o&&{data:o},size:[_,P],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,maxDevicePixelRatio:e.maxDevicePixelRatio,margin:N.margin,nodeIDAccessor:a,childrenAccessor:i,hierarchySum:B,padding:f,nodeStyle:O,colorBy:l,colorScheme:N.effectivePalette,colorByDepth:u,nodeLabel:j?d||a:void 0,showLabels:j,enableHover:R,tooltipContent:!1===m?()=>null:zc(m)||void 0,...ng({linkedHover:x,selection:v,onObservation:g,onClick:y,mobileInteraction:N.mobileInteraction,customHoverBehavior:N.customHoverBehavior,customClickBehavior:N.customClickBehavior,linkedHoverInClickPredicate:!1}),...S&&"none"!==S&&{legendHoverBehavior:N.legendState.onLegendHover,legendClickBehavior:N.legendState.onLegendClick,legendHighlightedCategory:N.legendState.highlightedCategory,legendIsolatedCategories:N.legendState.isolatedCategories},className:r,title:L,description:T,summary:I,accessibleTable:$,...null!=e.animate&&{animate:e.animate},...p})})}eA.displayName="CirclePack";var tA=require("react"),oA=require("react/jsx-runtime"),nA=xo;function rA(e){const t=Ly(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLabels:e.showLabels,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:600,height:600}),{data:o,margin:n,className:r,childrenAccessor:i="children",nodeIdAccessor:s="name",colorBy:a,colorScheme:l,colorByDepth:c=!1,orbitMode:u="flat",orbitSize:d=2.95,speed:h=.25,revolution:f,revolutionStyle:m,eccentricity:p=1,showRings:g=!0,nodeRadius:y=6,showLabels:b=!1,animated:v=!0,tooltip:x,foregroundGraphics:k,annotations:w,frameProps:S={},onObservation:A,onClick:C,chartId:M,selection:_,linkedHover:P,loading:R,loadingContent:j,stroke:L,strokeWidth:T,opacity:I}=e,{width:$,height:N,enableHover:D,title:E,description:O,summary:B,accessibleTable:F}=t,z=Nk({nodes:(0,tA.useMemo)(()=>Lk(o,i),[o,i]),edges:void 0,inferNodes:!1,colorBy:c?void 0:a,colorScheme:l,showLegend:!1,legendInteraction:void 0,selection:_,linkedHover:P,onObservation:A,onClick:C,mobileInteraction:t.mobileInteraction,mobileSemantics:t.mobileSemantics,chartType:"OrbitDiagram",chartId:M,marginDefaults:Zg(t),userMargin:n,width:$,height:N,hasTitle:!!E,loading:R,loadingContent:j}),H=(0,tA.useMemo)(()=>new Map,[]),{colorScale:W,customClickBehavior:q,customHoverBehavior:Y,themeCategorical:G}=z,V=(0,tA.useMemo)(()=>{if(Array.isArray(l))return l;const e=po[l];return Array.isArray(e)?e:go},[l]),X=(0,tA.useMemo)(()=>e=>{const t={stroke:"#fff",strokeWidth:1},o=0===(e.depth??0);return t.fill=c?o?V[0]:nA[(e.depth||0)%nA.length]:a?wo(e.data||e,a,W):My(void 0,G,l,void 0,H),t.opacity=o?1:.85,t},[a,c,W,V,G,l,H]),U=(0,tA.useMemo)(()=>Gy(X,{stroke:L,strokeWidth:T,opacity:I}),[X,L,T,I]),K=(0,tA.useMemo)(()=>()=>({stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1}),[]),Q=(0,tA.useMemo)(()=>e=>{Y(e&&e.data&&void 0!==e.data.data?{...e,data:e.data.data}:e)},[Y]),Z=(0,tA.useMemo)(()=>e=>{q(e&&e.data&&void 0!==e.data.data?{...e,data:e.data.data}:e)},[q]),J=Ey({componentName:"OrbitDiagram",data:o});return J?(0,oA.jsx)(lp,{componentName:"OrbitDiagram",message:J,width:$,height:N}):z.loadingEl?z.loadingEl:(0,oA.jsx)(fp,{componentName:"OrbitDiagram",width:$,height:N,children:(0,oA.jsx)(tg,{chartType:"orbit",...null!=o&&{data:o},size:[$,N],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,maxDevicePixelRatio:e.maxDevicePixelRatio,margin:z.margin,nodeIDAccessor:s,childrenAccessor:i,nodeStyle:U,edgeStyle:K,colorBy:a,colorScheme:z.effectivePalette,colorByDepth:c,nodeSize:y,nodeLabel:b?s:void 0,showLabels:b,enableHover:!v&&D,tooltipContent:v?void 0:!1===x?()=>null:zc(x)||void 0,...ng({linkedHover:P,selection:_,onObservation:A,onClick:C,mobileInteraction:z.mobileInteraction,customHoverBehavior:Q,customClickBehavior:Z,linkedHoverInClickPredicate:!1}),foregroundGraphics:k,annotations:w,className:r,title:E,description:O,summary:B,orbitMode:u,orbitSize:d,orbitSpeed:h,orbitRevolution:f,orbitRevolutionStyle:m,orbitEccentricity:p,orbitShowRings:g,orbitAnimated:v,accessibleTable:F,...null!=e.animate&&{animate:e.animate},...S})})}rA.displayName="OrbitDiagram";var iA=require("react"),sA=require("react/jsx-runtime"),aA={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, #f3f4f6)",padding:"6px 10px",borderRadius:"var(--semiotic-tooltip-radius, 4px)",fontSize:"var(--semiotic-tooltip-font-size, 12px)",fontFamily:"var(--semiotic-tick-font-family, var(--semiotic-font-family, sans-serif))",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.25))",lineHeight:1.4,pointerEvents:"none",whiteSpace:"nowrap"},lA={opacity:.7,marginRight:4};function cA(e,t,o){if(null!=e)return"function"==typeof t?t(e):e["string"==typeof t?t:o]}function uA(e){return null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+""}function dA(e={}){const{timeAccessor:t,valueAccessor:o,xLabel:n="x",yLabel:r="y"}=e;return e=>{const i=e?.data??null,s=cA(i,t,"time"),a=cA(i,o,"value");return(0,sA.jsxs)("div",{className:"semiotic-tooltip",style:aA,children:[(0,sA.jsxs)("div",{children:[(0,sA.jsxs)("span",{style:lA,children:[n,":"]}),uA(s)]}),(0,sA.jsxs)("div",{children:[(0,sA.jsxs)("span",{style:lA,children:[r,":"]}),uA(a)]})]})}}function hA(e,t){return null!=e?e:Math.max(t?.length??0,200)}var fA=class e{constructor(){this._count=0,this._mean=0,this._m2=0,this._min=1/0,this._max=-1/0}push(e){if(!Number.isFinite(e))return;this._count+=1;const t=e-this._mean;this._mean+=t/this._count,this._m2+=t*(e-this._mean),this._min>e&&(this._min=e),e>this._max&&(this._max=e)}merge(e){if(0===e._count)return;if(0===this._count)return this._count=e._count,this._mean=e._mean,this._m2=e._m2,this._min=e._min,void(this._max=e._max);const t=this._count+e._count,o=e._mean-this._mean;this._mean+=o*e._count/t,this._m2+=e._m2+o*o*this._count*e._count/t,this._count=t,this._min>e._min&&(this._min=e._min),e._max>this._max&&(this._max=e._max)}clear(){this._count=0,this._mean=0,this._m2=0,this._min=1/0,this._max=-1/0}clone(){const t=new e;return t._count=this._count,t._mean=this._mean,t._m2=this._m2,t._min=this._min,t._max=this._max,t}get count(){return this._count}get mean(){return 0===this._count?0:this._mean}get sum(){return 0===this._count?0:this._mean*this._count}get variance(){return 2>this._count?0:this._m2/this._count}get stddev(){return Math.sqrt(this.variance)}get sampleVariance(){return 2>this._count?0:this._m2/(this._count-1)}get sampleStddev(){return Math.sqrt(this.sampleVariance)}get min(){return this._min}get max(){return this._max}},mA=class{constructor(e){this.windows=new Map,this.sessions=[],this.latest=-1/0,this.type=e.window??"tumbling",this.size=e.size;const t=e.hop??e.size;this.hop=t>0&&e.size>=t?t:e.size,this.gap=e.gap??e.size,this.retain=null!=e.retain&&e.retain>0?e.retain:1/0}push(e,t){Number.isFinite(e)&&Number.isFinite(t)&&(e>this.latest&&(this.latest=e),"session"===this.type?this.pushSession(e,t):this.pushFixed(e,t),this.prune())}pushFixed(e,t){if("tumbling"===this.type||this.hop>=this.size)return void this.bump(Math.floor(e/this.size)*this.size,t);const o=this.hop,n=Math.floor(e/o);for(let r=Math.floor((e-this.size)/o)+1;n>=r;r++)this.bump(r*o,t)}bump(e,t){let o=this.windows.get(e);o||(o=new fA,this.windows.set(e,o)),o.push(t)}pushSession(e,t){const o=this.gap,n=new fA;n.push(t);let r=e,i=e;const s=[],a={start:r,end:i,stats:n};for(const t of this.sessions)e-o>t.end||t.start>e+o?s.push(t):(a.stats.merge(t.stats),r>t.start&&(r=t.start),t.end>i&&(i=t.end));a.start=r,a.end=i,s.push(a),s.sort((e,t)=>e.start-t.start),this.sessions=s}prune(){if(this.retain===1/0)return;if("session"===this.type)return void(this.sessions.length>this.retain&&(this.sessions=this.sessions.slice(this.sessions.length-this.retain)));if(this.retain>=this.windows.size)return;const e=[...this.windows.keys()].sort((e,t)=>e-t),t=e.length-this.retain;for(let o=0;t>o;o++)this.windows.delete(e[o])}emit(){return"session"===this.type?this.emitSessions():this.emitFixed()}emitFixed(){const e=[];for(const[t,o]of this.windows){const n=t+this.size;e.push(this.row(t,n,o,n>this.latest))}return e.sort((e,t)=>e.start-t.start),e}emitSessions(){return this.sessions.map(e=>this.row(e.start,e.end,e.stats,this.gap>this.latest-e.end))}row(e,t,o,n){return{start:e,end:t,count:o.count,mean:o.mean,sum:o.sum,min:o.min,max:o.max,stddev:o.stddev,partial:n}}get windowCount(){return"session"===this.type?this.sessions.length:this.windows.size}get watermark(){return this.latest}clear(){this.windows.clear(),this.sessions=[],this.latest=-1/0}};function pA(e,t){switch(t){case"sum":return e.sum;case"min":return e.min;case"max":return e.max;case"count":return e.count;default:return e.mean}}var gA={ms:1,s:1e3,m:6e4,h:36e5,d:864e5},yA=/(\d+(?:\.\d+)?)(ms|s|m|h|d)/g;function bA(e){if("number"==typeof e)return Number.isFinite(e)&&e>0?e:null;if("string"!=typeof e)return null;const t=e.trim();if(""===t)return null;yA.lastIndex=0;let o,n=0,r=0;for(;null!==(o=yA.exec(t));){const e=parseFloat(o[1]),t=gA[o[2]];if(null==t||!Number.isFinite(e))return null;n+=e*t,r+=o[0].length}return r!==t.length?null:n>0?n:null}var vA="time",xA="value",kA="__aggLower",wA="__aggUpper",SA="__aggPartial",AA="count",CA="__aggStart",MA="__aggEnd";function _A(e,t){const o=t.stat??"mean",n=t.band??"none",r=t.sigma??1;return e.emit().map(e=>{const t={[vA]:(e.start+e.end)/2,[xA]:pA(e,o),[AA]:e.count,[SA]:e.partial,[CA]:e.start,[MA]:e.end},i=function(e,t,o,n=1){if("none"===t)return null;if("minmax"===t)return[e.min,e.max];const r=pA(e,o),i=e.stddev*n;return[r-i,r+i]}(e,n,o,r);return i&&(t[kA]=i[0],t[wA]=i[1]),t})}var PA=class{constructor(e){this.held=[],this._watermark=-1/0,this._lateCount=0,this.lateness=e.lateness>0?e.lateness:0,this.getTime=e.getTime,this.latePolicy=e.latePolicy??"drop"}push(e){const t=this.getTime(e);if(!Number.isFinite(t))return{released:[e],late:[]};const o=[];return this._watermark!==-1/0&&this._watermark-this.lateness>t?(this._lateCount+=1,o.push(e),"drop"===this.latePolicy?{released:[],late:o}:{released:[e],late:o}):(t>this._watermark&&(this._watermark=t),this.held.push(e),{released:this.drain(),late:o})}drain(){const e=this._watermark-this.lateness;if(0===this.held.length)return[];const t=[],o=[];for(const n of this.held)this.getTime(n)>e?o.push(n):t.push(n);return this.held=o,t.sort((e,t)=>this.getTime(e)-this.getTime(t)),t}flush(){const e=this.held;return this.held=[],e.sort((e,t)=>this.getTime(e)-this.getTime(t)),e}clear(){this.held=[],this._watermark=-1/0,this._lateCount=0}get watermark(){return this._watermark}get lateCount(){return this._lateCount}get heldCount(){return this.held.length}},RA=require("react/jsx-runtime");function jA(e,t,o){const n="function"==typeof t?t(e):e[t??o];if(null==n)return null;if(n instanceof Date)return n.getTime();const r=Number(n);return Number.isFinite(r)?r:null}var LA=(0,iA.forwardRef)(function(e,t){const o=Ly(e.mode,{width:e.size?.[0]??e.width,height:e.size?.[1]??e.height,enableHover:null!=e.enableHover?!!e.enableHover:void 0,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{size:n,margin:r,className:i,arrowOfTime:s="right",windowMode:a="sliding",windowSize:l,data:c,timeAccessor:u,valueAccessor:d,timeExtent:h,valueExtent:f,extentPadding:m,stroke:p="#007bff",strokeWidth:g=2,strokeDasharray:y,opacity:b,background:v,tooltipContent:x,tooltip:k,onHover:w,annotations:S,autoPlaceAnnotations:A,svgAnnotationRules:C,tickFormatTime:M,tickFormatValue:_,decay:P,pulse:R,staleness:j,transition:L,linkedHover:T,selection:I,onObservation:$,chartId:N,loading:D,loadingContent:E,emptyContent:O,emphasis:B,legendPosition:F,aggregate:z,eventTime:H}=e,W=o.showAxes,q=o.enableHover,Y=r??o.marginDefaults,G=n??[o.width,o.height],V=x??k??dA({timeAccessor:u,valueAccessor:d}),X=(0,iA.useRef)(null),{customHoverBehavior:U}=Ry({selection:I,linkedHover:T,unwrapData:!0,onObservation:$,chartType:"RealtimeLineChart",chartId:N}),K=(0,iA.useCallback)(e=>{w&&w(e),U(e)},[w,U]),Q=null!=z,[Z,J]=(0,iA.useState)([]),ee=(0,iA.useRef)(null),te=(0,iA.useRef)(z);te.current=z;const oe=(0,iA.useRef)(Q);oe.current=Q;const ne=(0,iA.useRef)(Z);ne.current=Z;const re=(0,iA.useRef)({timeAccessor:u,valueAccessor:d});re.current={timeAccessor:u,valueAccessor:d},(0,iA.useEffect)(()=>{if(!Q)return void(ee.current=null);const e=te.current,t=function(e){const t=e.window??"tumbling",o=bA("session"===t?e.gap??e.size:e.size);if(null==o)return null;const n=null!=e.hop?bA(e.hop):void 0,r=null!=e.gap?bA(e.gap):void 0;return new mA({window:t,size:o,hop:n??void 0,gap:r??void 0,retain:e.retain})}(e);if(ee.current=t,t&&c){const{timeAccessor:e,valueAccessor:o}=re.current;for(const n of c){const r=jA(n,e,"time"),i=jA(n,o,"value");null!=r&&null!=i&&t.push(r,i)}}J(t?_A(t,e):[])},[Q?[z.window??"tumbling",z.size,z.hop??"",z.gap??"",z.retain??""].join("|"):"",Q,c]),(0,iA.useEffect)(()=>{Q&&ee.current&&J(_A(ee.current,te.current))},[z?.stat,z?.band,z?.sigma]);const ie=(0,iA.useCallback)(e=>{const t=ee.current,o=te.current;if(!t||!o)return;const{timeAccessor:n,valueAccessor:r}=re.current;for(const o of e){const e=jA(o,n,"time"),i=jA(o,r,"value");null!=e&&null!=i&&t.push(e,i)}J(_A(t,o))},[]),se=null!=H,ae=(0,iA.useRef)(null),le=(0,iA.useRef)(H);le.current=H;const ce=(0,iA.useRef)(se);ce.current=se;const ue=(0,iA.useRef)($);ue.current=$;const de=(0,iA.useRef)(N);de.current=N,(0,iA.useEffect)(()=>{ae.current=se?function(e){const t=bA(e.lateness);return null==t?null:new PA({lateness:t,getTime:e=>jA(e,re.current.timeAccessor,"time")??NaN,latePolicy:e.latePolicy??"drop"})}(le.current):null},[se?`${H.lateness}|${H.latePolicy??"drop"}`:"",se]);const he=(0,iA.useCallback)(e=>{0!==e.length&&(oe.current?ie(e):X.current?.pushMany(e))},[ie]),fe=(0,iA.useCallback)(e=>{const t=ae.current;if(!ce.current||!t)return void he(e);const o=[];for(const n of e){const e=t.push(n);if(e.released.length&&o.push(...e.released),e.late.length){const o=ue.current;if(o){const{timeAccessor:n}=re.current,r=le.current?.latePolicy??"drop";for(const i of e.late)o({type:"late-data",datum:i,eventTime:jA(i,n,"time")??NaN,watermark:t.watermark,policy:r,lateCount:t.lateCount,timestamp:Date.now(),chartType:"RealtimeLineChart",chartId:de.current})}}}he(o)},[he]);(0,iA.useImperativeHandle)(t,()=>({push:e=>fe([e]),pushMany:e=>fe(e),remove:e=>oe.current?[]:X.current?.remove(e)??[],update:(e,t)=>oe.current?[]:X.current?.update(e,t)??[],clear:()=>{ae.current?.clear(),oe.current?(ee.current?.clear(),J([])):X.current?.clear()},getData:()=>oe.current?ne.current:X.current?.getData()??[],getScales:()=>X.current?.getScales()??null}),[fe]);const me=yp(D,G[0],G[1],E),pe=me?null:gp(Q?void 0:c,G[0],G[1],O),ge={stroke:p,strokeWidth:g,strokeDasharray:y};null!=b&&(ge.opacity=b);const ye=hA(l,c),be=Q?Z:c,ve=Q?vA:u,xe=Q?xA:d,ke=Q&&z&&"none"!==(z.band??"none")?{y0Accessor:kA,y1Accessor:wA,perSeries:!1}:void 0;return me||pe||(0,RA.jsx)(Ld,{ref:X,chartType:"line",runtimeMode:"streaming",size:G,maxDevicePixelRatio:e.maxDevicePixelRatio,margin:Y,className:B?`${i||""} semiotic-emphasis-${B}`.trim():i,arrowOfTime:s,windowMode:Q?"growing":a,windowSize:Q?Math.max(1,z?.retain??Math.max(Z.length,600)):ye,data:be,timeAccessor:ve,valueAccessor:xe,xExtent:h,yExtent:f,extentPadding:m,band:ke,lineStyle:ge,showAxes:W,background:v,hoverAnnotation:q,tooltipContent:V,...ng({linkedHover:T,selection:I,onObservation:$,forceHoverBehavior:!0,mobileInteraction:o.mobileInteraction,customHoverBehavior:K}),annotations:S,autoPlaceAnnotations:A,svgAnnotationRules:C,tickFormatTime:M,tickFormatValue:_,decay:P,pulse:R,staleness:j,transition:L,pointIdAccessor:e.pointIdAccessor,legendPosition:F})});LA.displayName="RealtimeLineChart";var TA=require("react");function IA(e,t,o){const n="function"==typeof t?t(e):e[t??o];if(null==n)return null;if(n instanceof Date)return n.getTime();if("string"==typeof n&&""===n.trim())return null;const r=Number(n);return Number.isFinite(r)?r:null}var $A=require("react/jsx-runtime"),NA=(0,TA.forwardRef)(function(e,t){const o=Ly(e.mode,{width:e.size?.[0]??e.width,height:e.size?.[1]??e.height,showAxes:e.showAxes,showLegend:e.showLegend,enableHover:null!=e.enableHover?!!e.enableHover:void 0,linkedHover:e.linkedHover,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{binSize:n,size:r,margin:i,className:s,arrowOfTime:a="right",windowMode:l="sliding",windowSize:c,data:u,timeAccessor:d,valueAccessor:h,direction:f="up",timeExtent:m,valueExtent:p,extentPadding:g,categoryAccessor:y,colors:b,fill:v,stroke:x,strokeWidth:k,opacity:w,gap:S,background:A,tooltipContent:C,tooltip:M,onHover:_,annotations:P,autoPlaceAnnotations:R,svgAnnotationRules:j,tickFormatTime:L,tickFormatValue:T,linkedHover:I,selection:$,decay:N,pulse:D,staleness:E,transition:O,onObservation:B,chartId:F,loading:z,loadingContent:H,emptyContent:W,emphasis:q,legendPosition:Y,legend:G,brush:V,onBrush:X,linkedBrush:U}=e,K=o.showAxes,Q=o.enableHover,Z=r??[o.width,o.height],J=(0,TA.useMemo)(()=>b?e=>b[e]??v??"#999":void 0,[b,v]),{legend:ee,margin:te,legendPosition:oe}=wy({data:u??[],colorBy:y,colorScale:J,showLegend:o.showLegend,legendPosition:Y,userMargin:i,defaults:o.marginDefaults,additionalLegend:G,chartWidth:Z[0],axisChrome:{hasAxis:!1!==o.showAxes}}),ne=C??M??function(e={}){const{timeAccessor:t,valueAccessor:o}=e;return e=>{const n=e?.data??null;if(null==n?.binStart||null==n?.binEnd){const e=cA(n,t,"time"),r=cA(n,o,"value");return(0,sA.jsxs)("div",{className:"semiotic-tooltip",style:aA,children:[(0,sA.jsxs)("div",{children:[(0,sA.jsx)("span",{style:lA,children:"x:"}),uA(e)]}),(0,sA.jsxs)("div",{children:[(0,sA.jsx)("span",{style:lA,children:"y:"}),uA(r)]})]})}return(0,sA.jsxs)("div",{className:"semiotic-tooltip",style:aA,children:[(0,sA.jsxs)("div",{children:[(0,sA.jsx)("span",{style:lA,children:"range:"}),uA(n.binStart),"–",uA(n.binEnd)]}),null!=n.total&&(0,sA.jsxs)("div",{children:[(0,sA.jsx)("span",{style:lA,children:"count:"}),uA(n.total)]}),null!=n.category&&(0,sA.jsxs)("div",{children:[(0,sA.jsx)("span",{style:lA,children:"category:"}),uA(n.category)]})]})}}({timeAccessor:d,valueAccessor:h}),re=(0,TA.useRef)(null),{customHoverBehavior:ie}=Ry({selection:$,linkedHover:I,unwrapData:!0,onObservation:B,chartType:"RealtimeHistogram",chartId:F}),se=(0,TA.useCallback)(e=>{_&&_(e),ie(e)},[_,ie]),ae=!0===V?{dimension:"x",snap:"bin"}:"x"===V?{dimension:"x"}:"object"==typeof V?V:void 0,le=fg(U),ce="string"==typeof d?d:"time",ue=_g({name:le?.name||"__unused_hist_brush__",xField:le?.xField||ce,...le?.yField?{yField:le.yField}:{}}),de=(0,TA.useRef)(ue.brushInteraction);de.current=ue.brushInteraction;const he=(0,TA.useCallback)(e=>{if(X&&X(e),B&&B(e?{type:"brush",extent:e,timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:F}:{type:"brush-end",timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:F}),le){const t=de.current;t.end(e?"xBrush"===t.brush?e.x:"yBrush"===t.brush?e.y:[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:null)}},[X,B,F,le]);(0,TA.useImperativeHandle)(t,()=>({push:e=>re.current?.push(e),pushMany:e=>re.current?.pushMany(e),remove:e=>re.current?.remove(e)??[],update:(e,t)=>re.current?.update(e,t)??[],clear:()=>re.current?.clear(),getData:()=>re.current?.getData()??[],getScales:()=>re.current?.getScales()??null}),[]);const fe=yp(z,Z[0],Z[1],H),me=fe?null:gp(u,Z[0],Z[1],W),pe={};null!=v&&(pe.fill=v),null!=x&&(pe.stroke=x),null!=k&&(pe.strokeWidth=k),null!=w&&(pe.opacity=w),null!=S&&(pe.gap=S);const ge=q?`${s||""} semiotic-emphasis-${q}`.trim():s,ye=hA(c,u),be=(0,TA.useMemo)(()=>"down"!==f?p:function({data:e,valueAccessor:t,timeAccessor:o,binSize:n,valueExtent:r,extentPadding:i}){if(r)return[r[1],r[0]];if(!e||0===e.length)return;const s=new Map;for(const r of e){const e=IA(r,o,"time"),i=IA(r,t,"value");if(null==e||null==i)continue;const a=Math.floor(e/n)*n;s.set(a,(s.get(a)??0)+i)}let a=0;for(const e of s.values())a=Math.max(a,e);return[a>0?a+a*(i??.1):1,0]}({data:u,valueAccessor:h,timeAccessor:d,binSize:n,valueExtent:p,extentPadding:g}),[f,u,h,d,n,p,g]);return fe||me||(0,$A.jsx)(Ld,{ref:re,chartType:"bar",runtimeMode:"streaming",size:Z,maxDevicePixelRatio:e.maxDevicePixelRatio,margin:te,className:ge,arrowOfTime:a,windowMode:l,windowSize:ye,data:u,timeAccessor:d,valueAccessor:h,xExtent:m,yExtent:be,extentPadding:g,binSize:n,categoryAccessor:y,barColors:b,barStyle:pe,showAxes:K,background:A,hoverAnnotation:Q,tooltipContent:ne,...ng({linkedHover:I,selection:$,onObservation:B,forceHoverBehavior:!0,mobileInteraction:o.mobileInteraction,customHoverBehavior:se}),annotations:P,autoPlaceAnnotations:R,svgAnnotationRules:j,tickFormatTime:L,tickFormatValue:T,decay:N,pulse:D,staleness:E,transition:O,pointIdAccessor:e.pointIdAccessor,legend:ee,legendPosition:oe,brush:ae||(U?{dimension:"x"}:void 0),onBrush:ae||U?he:void 0})});function DA(e){return(0,$A.jsx)(NA,{...e,windowMode:"growing"})}NA.displayName="RealtimeHistogram",DA.displayName="TemporalHistogram";var EA=NA,OA=require("react"),BA=require("react/jsx-runtime"),FA=(0,OA.forwardRef)(function(e,t){const o=Ly(e.mode,{width:e.size?.[0]??e.width,height:e.size?.[1]??e.height,enableHover:null!=e.enableHover?!!e.enableHover:void 0,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{size:n,margin:r,className:i,arrowOfTime:s="right",windowMode:a="sliding",windowSize:l,data:c,timeAccessor:u,valueAccessor:d,timeExtent:h,valueExtent:f,yScaleType:m,extentPadding:p,categoryAccessor:g,colors:y,radius:b,fill:v,opacity:x,stroke:k,strokeWidth:w,pointStyle:S,background:A,tooltipContent:C,tooltip:M,onHover:_,annotations:P,autoPlaceAnnotations:R,svgAnnotationRules:j,tickFormatTime:L,tickFormatValue:T,linkedHover:I,selection:$,onObservation:N,chartId:D,loading:E,loadingContent:O,emptyContent:B,emphasis:F,legendPosition:z}=e,H=o.showAxes,W=o.enableHover,q=r??o.marginDefaults,Y=n??[o.width,o.height],G=C??M??dA({timeAccessor:u,valueAccessor:d}),V=(0,OA.useRef)(null),{customHoverBehavior:X}=Ry({selection:$,linkedHover:I,unwrapData:!0,onObservation:N,chartType:"RealtimeSwarmChart",chartId:D}),U=(0,OA.useCallback)(e=>{_&&_(e),X(e)},[_,X]);(0,OA.useImperativeHandle)(t,()=>({push:e=>V.current?.push(e),pushMany:e=>V.current?.pushMany(e),remove:e=>V.current?.remove(e)??[],update:(e,t)=>V.current?.update(e,t)??[],clear:()=>V.current?.clear(),getData:()=>V.current?.getData()??[],getScales:()=>V.current?.getScales()??null}),[]);const K=yp(E,Y[0],Y[1],O),Q=K?null:gp(c,Y[0],Y[1],B),Z={};null!=b&&(Z.radius=b),null!=v&&(Z.fill=v),null!=x&&(Z.opacity=x),null!=k&&(Z.stroke=k),null!=w&&(Z.strokeWidth=w);const J=S,ee=F?`${i||""} semiotic-emphasis-${F}`.trim():i,te=hA(l,c);return K||Q||(0,BA.jsx)(Ld,{ref:V,chartType:"swarm",runtimeMode:"streaming",size:Y,maxDevicePixelRatio:e.maxDevicePixelRatio,margin:q,className:ee,arrowOfTime:s,windowMode:a,windowSize:te,data:c,timeAccessor:u,valueAccessor:d,xExtent:h,yExtent:f,yScaleType:m,extentPadding:p,categoryAccessor:g,barColors:y,swarmStyle:Z,pointStyle:J,showAxes:H,background:A,hoverAnnotation:W,tooltipContent:G,...ng({linkedHover:I,selection:$,onObservation:N,forceHoverBehavior:!0,mobileInteraction:o.mobileInteraction,customHoverBehavior:U}),annotations:P,autoPlaceAnnotations:R,svgAnnotationRules:j,tickFormatTime:L,tickFormatValue:T,legendPosition:z,pointIdAccessor:e.pointIdAccessor})});FA.displayName="RealtimeSwarmChart";var zA=require("react"),HA=require("react/jsx-runtime"),WA=(0,zA.forwardRef)(function(e,t){const o=Ly(e.mode,{width:e.size?.[0]??e.width,height:e.size?.[1]??e.height,enableHover:null!=e.enableHover?!!e.enableHover:void 0,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{size:n,margin:r,className:i,arrowOfTime:s="right",windowMode:a="sliding",windowSize:l,data:c,timeAccessor:u,valueAccessor:d,timeExtent:h,valueExtent:f,extentPadding:m,positiveColor:p,negativeColor:g,connectorStroke:y,connectorWidth:b,gap:v,stroke:x,strokeWidth:k,opacity:w,background:S,tooltipContent:A,tooltip:C,onHover:M,annotations:_,autoPlaceAnnotations:P,svgAnnotationRules:R,tickFormatTime:j,tickFormatValue:L,linkedHover:T,selection:I,onObservation:$,chartId:N,loading:D,loadingContent:E,emptyContent:O,emphasis:B,legendPosition:F}=e,z=o.showAxes,H=o.enableHover,W=r??o.marginDefaults,q=n??[o.width,o.height],Y=A??C??function(e={}){const{timeAccessor:t,valueAccessor:o}=e;return e=>{const n=e?.data??null,r=cA(n,t,"time"),i=n?.delta??cA(n,o,"value"),s=n?.cumEnd,a="number"==typeof i?0>i?uA(i):"+"+uA(i):uA(i);return(0,sA.jsxs)("div",{className:"semiotic-tooltip",style:aA,children:[(0,sA.jsxs)("div",{children:[(0,sA.jsx)("span",{style:lA,children:"x:"}),uA(r)]}),(0,sA.jsxs)("div",{children:[(0,sA.jsx)("span",{style:lA,children:"Δ:"}),a]}),null!=s&&(0,sA.jsxs)("div",{children:[(0,sA.jsx)("span",{style:lA,children:"total:"}),uA(s)]})]})}}({timeAccessor:u,valueAccessor:d}),G=(0,zA.useRef)(null),{customHoverBehavior:V}=Ry({selection:I,linkedHover:T,unwrapData:!0,onObservation:$,chartType:"RealtimeWaterfallChart",chartId:N}),X=(0,zA.useCallback)(e=>{M&&M(e),V(e)},[M,V]);(0,zA.useImperativeHandle)(t,()=>({push:e=>G.current?.push(e),pushMany:e=>G.current?.pushMany(e),remove:e=>G.current?.remove(e)??[],update:(e,t)=>G.current?.update(e,t)??[],clear:()=>G.current?.clear(),getData:()=>G.current?.getData()??[],getScales:()=>G.current?.getScales()??null}),[]);const U=yp(D,q[0],q[1],E),K=U?null:gp(c,q[0],q[1],O),Q={};null!=p&&(Q.positiveColor=p),null!=g&&(Q.negativeColor=g),null!=y&&(Q.connectorStroke=y),null!=b&&(Q.connectorWidth=b),null!=v&&(Q.gap=v),null!=x&&(Q.stroke=x),null!=k&&(Q.strokeWidth=k),null!=w&&(Q.opacity=w);const Z=B?`${i||""} semiotic-emphasis-${B}`.trim():i,J=hA(l,c);return U||K||(0,HA.jsx)(Ld,{ref:G,chartType:"waterfall",runtimeMode:"streaming",size:q,maxDevicePixelRatio:e.maxDevicePixelRatio,margin:W,className:Z,arrowOfTime:s,windowMode:a,windowSize:J,data:c,timeAccessor:u,valueAccessor:d,xExtent:h,yExtent:f,extentPadding:m,waterfallStyle:Q,showAxes:z,background:S,hoverAnnotation:H,tooltipContent:Y,...ng({linkedHover:T,selection:I,onObservation:$,forceHoverBehavior:!0,mobileInteraction:o.mobileInteraction,customHoverBehavior:X}),annotations:_,autoPlaceAnnotations:P,svgAnnotationRules:R,tickFormatTime:j,tickFormatValue:L,legendPosition:F,pointIdAccessor:e.pointIdAccessor})});WA.displayName="RealtimeWaterfallChart";var qA=require("react"),YA=require("react/jsx-runtime"),GA=(0,qA.forwardRef)(function(e,t){const o=Ly(e.mode,{width:e.size?.[0]??e.width,height:e.size?.[1]??e.height,enableHover:null!=e.enableHover?!!e.enableHover:void 0,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{size:n,margin:r,className:i,arrowOfTime:s="right",windowMode:a="sliding",windowSize:l,data:c,timeAccessor:u,valueAccessor:d,categoryAccessor:h,timeExtent:f,valueExtent:m,extentPadding:p,heatmapXBins:g=20,heatmapYBins:y=20,aggregation:b="count",background:v,tooltipContent:x,tooltip:k,onHover:w,annotations:S,autoPlaceAnnotations:A,svgAnnotationRules:C,tickFormatTime:M,tickFormatValue:_,decay:P,pulse:R,staleness:j,linkedHover:L,selection:T,onObservation:I,chartId:$,loading:N,loadingContent:D,emptyContent:E,emphasis:O,legendPosition:B}=e,F=o.showAxes,z=o.enableHover,H=r??o.marginDefaults,W=n??[o.width,o.height],q=x??k??function(e={}){const{timeAccessor:t,valueAccessor:o,xLabel:n="x",yLabel:r="y"}=e;return e=>{const i=e?.data??null,s=i?.xCenter??cA(i,t,"time"),a=i?.yCenter??cA(i,o,"value"),l=i?.count,c=i?.sum,u=i?.value,d=i?.agg??"count";return(0,sA.jsxs)("div",{className:"semiotic-tooltip",style:aA,children:[(0,sA.jsxs)("div",{children:[(0,sA.jsxs)("span",{style:lA,children:[n,":"]}),uA(s)]}),(0,sA.jsxs)("div",{children:[(0,sA.jsxs)("span",{style:lA,children:[r,":"]}),uA(a)]}),null!=l&&(0,sA.jsxs)("div",{children:[(0,sA.jsx)("span",{style:lA,children:"count:"}),uA(l)]}),"sum"===d&&null!=c&&(0,sA.jsxs)("div",{children:[(0,sA.jsx)("span",{style:lA,children:"sum:"}),uA(c)]}),"mean"===d&&null!=u&&(0,sA.jsxs)("div",{children:[(0,sA.jsx)("span",{style:lA,children:"mean:"}),uA(u)]})]})}}({timeAccessor:u,valueAccessor:d}),Y=(0,qA.useRef)(null),{customHoverBehavior:G}=Ry({selection:T,linkedHover:L,unwrapData:!0,onObservation:I,chartType:"RealtimeHeatmap",chartId:$}),V=(0,qA.useCallback)(e=>{w&&w(e),G(e)},[w,G]);(0,qA.useImperativeHandle)(t,()=>({push:e=>Y.current?.push(e),pushMany:e=>Y.current?.pushMany(e),remove:e=>Y.current?.remove(e)??[],update:(e,t)=>Y.current?.update(e,t)??[],clear:()=>Y.current?.clear(),getData:()=>Y.current?.getData()??[],getScales:()=>Y.current?.getScales()??null}),[]);const X=yp(N,W[0],W[1],D),U=X?null:gp(c,W[0],W[1],E),K=O?`${i||""} semiotic-emphasis-${O}`.trim():i,Q=hA(l,c);return X||U||(0,YA.jsx)(Ld,{ref:Y,chartType:"heatmap",runtimeMode:"streaming",size:W,maxDevicePixelRatio:e.maxDevicePixelRatio,margin:H,className:K,arrowOfTime:s,windowMode:a,windowSize:Q,data:c,timeAccessor:u,valueAccessor:d,categoryAccessor:h,xExtent:f,yExtent:m,extentPadding:p,heatmapXBins:g,heatmapYBins:y,heatmapAggregation:b,showAxes:F,background:v,hoverAnnotation:z,tooltipContent:q,...ng({linkedHover:L,selection:T,onObservation:I,forceHoverBehavior:!0,mobileInteraction:o.mobileInteraction,customHoverBehavior:V}),annotations:S,autoPlaceAnnotations:A,svgAnnotationRules:C,tickFormatTime:M,tickFormatValue:_,decay:P,pulse:R,staleness:j,legendPosition:B,pointIdAccessor:e.pointIdAccessor})});function VA(e){if(null==e)return"";if("number"!=typeof e)return e+"";if(!isFinite(e))return e+"";if(0===e)return"0";const t=parseFloat(e.toPrecision(12)),o=Math.abs(t);return 1e9>o?1e6>o?1e4>o?Number.isInteger(t)?t+"":parseFloat(t.toPrecision(6))+"":parseFloat((t/1e3).toPrecision(3))+"K":parseFloat((t/1e6).toPrecision(3))+"M":parseFloat((t/1e9).toPrecision(3))+"B"}GA.displayName="RealtimeHeatmap",d(require("react"));var XA=6e4,UA=60*XA,KA=24*UA;function QA(e){return 10>e?"0"+e:e+""}var ZA=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function JA(e,t){return t?{month:e.getUTCMonth(),day:e.getUTCDate(),year:e.getUTCFullYear(),hours:e.getUTCHours(),minutes:e.getUTCMinutes(),seconds:e.getUTCSeconds()}:{month:e.getMonth(),day:e.getDate(),year:e.getFullYear(),hours:e.getHours(),minutes:e.getMinutes(),seconds:e.getSeconds()}}function eC(e,t={}){let o,n=e;const r=(i=function(e={}){const t=e.timeZone;return"UTC"===t?{kind:"utc"}:"local"===t?{kind:"local"}:"string"==typeof t&&t.length>0?{kind:"iana",id:t}:!1===e.utc?{kind:"local"}:{kind:"utc"}}(t),"utc"===i.kind?e=>JA(e,!0):"local"===i.kind?e=>JA(e,!1):function(e){let t;try{t=new Intl.DateTimeFormat("en-US",{timeZone:e,year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hourCycle:"h23"})}catch{return e=>JA(e,!0)}return e=>{const o={};for(const n of t.formatToParts(e))"literal"!==n.type&&(o[n.type]=n.value);return{month:Math.max(0,(Number(o.month)||1)-1),day:Number(o.day)||1,year:Number(o.year)||1970,hours:Number(o.hour)||0,minutes:Number(o.minute)||0,seconds:Number(o.second)||0}}}(i.id));var i;return(t,i,s)=>{const a=t instanceof Date?t:new Date(t);e||!s||2>s.length||s===o||(o=s,n=function(e){if(2>e.length)return"days";const t=[];for(let o=1;e.length>o;o++)t.push(e[o]-e[o-1]);t.sort((e,t)=>e-t);const o=t[Math.floor(t.length/2)];return 2*XA>o?"seconds":2*UA>o?"minutes":2*KA>o?"hours":60*KA>o?"days":400*KA>o?"months":"years"}(s));const l=n||"days";return null!=i&&0!==i&&s&&0!==s.length?function(e,t,o,n){const r=n(e),i=n(t),s=r.year!==i.year,a=s||r.month!==i.month,l=a||r.day!==i.day,c=l||r.hours!==i.hours,u=c||r.minutes!==i.minutes,d=ZA[r.month],{day:h,year:f}=r,m=QA(r.hours),p=QA(r.minutes),g=QA(r.seconds);switch(o){case"seconds":return s?`${d} ${h}, ${f} ${m}:${p}:${g}`:l?`${d} ${h} ${m}:${p}:${g}`:c?`${m}:${p}:${g}`:u?`${p}:${g}`:":"+g;case"minutes":return s?`${d} ${h}, ${f} ${m}:${p}`:l?`${d} ${h} ${m}:${p}`:c?`${m}:${p}`:":"+p;case"hours":return s?`${d} ${h}, ${f} ${m}:00`:a?`${d} ${h} ${m}:${p}`:l?`${d} ${h} ${m}:00`:m+":00";case"days":return s?`${d} ${h}, ${f}`:a?`${d} ${h}`:""+h;case"months":return s?`${d} ${f}`:""+d;case"years":return""+f}}(a,new Date(s[i-1]),l,r):function(e,t,o){const{month:n,day:r,year:i,hours:s,minutes:a,seconds:l}=o(e),c=ZA[n],u=QA(s),d=QA(a),h=QA(l);switch(t){case"seconds":return`${c} ${r}, ${i} ${u}:${d}:${h}`;case"minutes":case"hours":return`${c} ${r}, ${i} ${u}:${d}`;case"days":return`${c} ${r}, ${i}`;case"months":return`${c} ${i}`;case"years":return""+i}}(a,l,r)}}async function tC(e,t){const{format:o="png",filename:n="chart",scale:r=2,background:i="white"}=t||{},s=e.querySelector("svg");if(!s)throw Error("No SVG element found in the container");const a=s.cloneNode(!0),l=s.getBoundingClientRect();if(a.getAttribute("width")||a.setAttribute("width",l.width+""),a.getAttribute("height")||a.setAttribute("height",l.height+""),a.getAttribute("xmlns")||a.setAttribute("xmlns","http://www.w3.org/2000/svg"),oC(s,a),"svg"===o){const e=(new XMLSerializer).serializeToString(a);nC(new Blob([e],{type:"image/svg+xml;charset=utf-8"}),n+".svg")}else{const t=l.width*r,o=l.height*r,s=document.createElement("canvas");s.width=t,s.height=o;const c=s.getContext("2d");c.fillStyle=i,c.fillRect(0,0,t,o),c.scale(r,r);const u=e.querySelector("canvas");u&&c.drawImage(u,0,0,l.width,l.height);const d=(new XMLSerializer).serializeToString(a),h=new Blob([d],{type:"image/svg+xml;charset=utf-8"}),f=URL.createObjectURL(h),m=new Image;m.width=l.width,m.height=l.height,await new Promise((e,t)=>{m.onload=()=>{c.drawImage(m,0,0),s.toBlob(o=>{o?(nC(o,n+".png"),e()):t(Error("Failed to create PNG blob"))},"image/png"),URL.revokeObjectURL(f)},m.onerror=()=>{URL.revokeObjectURL(f),t(Error("Failed to load SVG image"))},m.src=f})}}function oC(e,t){const o=e.children,n=t.children,r=window.getComputedStyle(e),i=["fill","stroke","stroke-width","stroke-dasharray","opacity","fill-opacity","stroke-opacity","font-family","font-size","font-weight","text-anchor","dominant-baseline"];for(const e of i){const o=r.getPropertyValue(e);o&&"none"!==o&&""!==o&&t.style?.setProperty(e,o)}for(let e=0;Math.min(o.length,n.length)>e;e++)oC(o[e],n[e])}function nC(e,t){const o=URL.createObjectURL(e),n=document.createElement("a");n.href=o,n.download=t,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(o)}var rC=["BarChart","StackedBarChart","GroupedBarChart","SwarmPlot","BoxPlot","Histogram","ViolinPlot","RidgelinePlot","DotPlot","PieChart","DonutChart","GaugeChart","FunnelChart","SwimlaneChart","LikertChart","LineChart","BumpChart","AreaChart","DifferenceChart","StackedAreaChart","Scatterplot","BubbleChart","Heatmap","QuadrantChart","MultiAxisLineChart","CandlestickChart","ConnectedScatterplot","ScatterplotMatrix","MinimapChart","ForceDirectedGraph","SankeyDiagram","ProcessSankey","ChordDiagram","TreeDiagram","Treemap","CirclePack","OrbitDiagram","ChoroplethMap","ProportionalSymbolMap","FlowMap","DistanceCartogram","RealtimeLineChart","RealtimeHistogram","TemporalHistogram","RealtimeSwarmChart","RealtimeWaterfallChart","RealtimeHeatmap","GaltonBoardChart","EventDropChart","UnitPileChart","CollisionSwarmChart","GauntletChart","CrucibleChart","ProcessFlowChart","PacketFlowChart","ChainReactionChart","BigNumber"],iC=new Set(rC);function sC(e){return iC.has(e)}var aC=["value","threshold","partition-boundary","time-window","range-boundary"];function lC({controlType:e,controlId:t,chartId:o,chartType:n="VisualizationControl",onObservation:r}){return(i,s,a)=>{r?.({type:i,controlType:e,value:s,chartType:n,timestamp:Date.now(),...t?{controlId:t}:{},...o?{chartId:o}:{},...a?{source:a}:{}})}}function cC(e,t,o,n,r){return{id:e,...t?{controlId:t}:{},status:o,message:n,...r?{remediation:r}:{}}}function uC({controls:e=[],minimumTargetSize:t=24}){const o=[],n=new Set;for(const r of e){const e=r?.id,i="controls."+(e||"unknown"),s=r?.domain,a=Array.isArray(s)&&2===s.length&&Number.isFinite(s[0])&&Number.isFinite(s[1])&&s[1]>s[0],l=aC.includes(r?.type),c="string"==typeof r?.target&&r.target.trim().length>0,u=["slider","buttons","native-range"].includes(r?.keyboard??""),d=r?.minimumTargetSize;o.push(cC(i+".semantic-type",e,l?"pass":"fail",l?`Control uses the semantic type "${r.type}".`:"Control has no recognized semantic type.","Use one of VISUALIZATION_CONTROL_TYPES.")),o.push(cC(i+".state-binding",e,c?"pass":"fail",c?`Control is bound to "${r.target}".`:"Control has no declarative state binding.","Declare the controlled state key with target.")),o.push(cC(i+".domain",e,a?"pass":"fail",a?"Control has a finite ordered value domain.":"Control has no finite ordered value domain.","Declare domain as [minimum, maximum].")),o.push(cC(i+".keyboard",e,u?"pass":"fail",u?`Control declares a ${r.keyboard} keyboard path.`:"Control does not declare a keyboard path.","Declare slider, buttons, or native-range keyboard interaction.")),o.push(cC(i+".value-text",e,"string"==typeof r?.valueText&&r.valueText.trim().length>0?"pass":"fail","string"==typeof r?.valueText&&r.valueText.trim().length>0?"Control declares human-readable value text.":"Control does not declare human-readable value text.","Provide valueText, typically with a {value} placeholder.")),o.push(cC(i+".target-size",e,"number"!=typeof d||t>d?"fail":"pass","number"!=typeof d||t>d?`Control target is below the ${t}px minimum or undeclared.`:`Control declares a ${d}px target.`,`Declare minimumTargetSize of at least ${t}.`)),null!=r?.step&&o.push(cC(i+".step",e,Number.isFinite(r.step)&&r.step>0?"pass":"fail",Number.isFinite(r.step)&&r.step>0?"Control has a positive quantization step.":"Control step must be a positive finite number.","Use a positive finite step.")),r?.observations?.length&&o.push(cC(i+".observations",e,r.observations.includes("control-change")?"pass":"warn",r.observations.includes("control-change")?"Control declares control-change observation coverage.":"Control declares observations but omits control-change.","Include control-change so observable state changes are represented.")),e&&!n.has(e)||o.push(cC(i+".identity",e,"fail",e?"Control id is duplicated.":"Control id is missing.","Use a unique stable control id.")),e&&n.add(e)}return{ok:o.every(e=>"fail"!==e.status),findings:o}}function dC(e,t=new Set){if(null===e)return!0;const o=typeof e;if("string"===o||"boolean"===o)return!0;if("number"===o)return Number.isFinite(e);if("object"!==o)return!1;if(t.has(e))return!1;t.add(e);const n=Array.isArray(e)?e.every(e=>dC(e,t)):Object.entries(e).every(([,e])=>dC(e,t));return t.delete(e),n}var hC=Symbol.for("semiotic.chartRecipeRegistry");function fC(e){return function(){const e=globalThis;return e[hC]||(e[hC]={recipes:new Map,capabilities:new Map,layouts:new Map}),e[hC]}().recipes.get(e)}function mC(e){return"string"==typeof e?fC(e):e&&"object"==typeof e&&"string"==typeof e.id?e:void 0}function pC(e){return"string"==typeof e?e:e.id??e.name}function gC(e){return e.layoutConfig&&"object"==typeof e.layoutConfig?e.layoutConfig:{}}function yC(e){return Array.isArray(e.data)?e.data:Array.isArray(e.nodes)?e.nodes:Array.isArray(e.points)?e.points:Array.isArray(e.areas)?e.areas:[]}function bC(e,t,o){return o??mC(t.recipe)??mC(t.recipeId)??fC(e)}function vC(e,t,o=[]){const n=e.accessor?t[e.accessor]:void 0;if("string"==typeof n&&n)return n;if(e.field)return e.field;const r=o.find(e=>e&&"object"==typeof e);if(!r)return;const i=Object.entries(r).filter(([e,t])=>!e.startsWith("_")&&null!=t);return"quantitative"===e.semanticType?i.find(([,e])=>"number"==typeof e)?.[0]:"identifier"===e.semanticType?["id","key","name"].find(e=>e in r):i.find(([,e])=>"string"==typeof e)?.[0]}function xC(e,t){return e.dataRoles.find(e=>e.role===t)}function kC(e,t){return e.dataRoles.find(e=>t.includes(e.semanticType))}function wC(e,t,o,n,r,i={}){const s={...i};if(t)for(const[e,o]of Object.entries(t))s[e]=o;for(const e of o.dataRoles){const o=vC(e,n,r),i=t&&o?t[o]:o;void 0!==i&&(s[e.role]=i)}return e.replace(/\{([^}]+)\}/g,(e,t)=>{const o=s[t];return null==o?`{${t}}`:o+""})}var SC="1",AC=new Set(["tooltip","onObservation","xFormat","yFormat","valueFormat","svgAnnotationRules","tooltipContent","onHover","tickFormatTime","tickFormatValue","edgeSort","sortGroups","centerContent","frameProps","controls","oFormat","rFormat","oSort","pieceStyle","summaryStyle","nodeStyle","edgeStyle","customHoverBehavior","customClickBehavior","customDoubleClickBehavior","onBrush","onTopologyChange","backgroundGraphics","foregroundGraphics","legend","recipe","layout"]),CC=new Set(["data","nodes","edges","points","areas","lines","flows"]);function MC(e){if(null==e)return e;if("function"==typeof e)return;if("object"!=typeof e)return e;if(e.$$typeof)return;if(Array.isArray(e))return e.map(MC).filter(e=>void 0!==e);if(e instanceof Date)return e;const t={};for(const[o,n]of Object.entries(e)){if("function"==typeof n)continue;if(n&&"object"==typeof n&&n.$$typeof)continue;const e=MC(n);void 0!==e&&(t[o]=e)}return t}function _C(e,t){return!!CC.has(e)&&("areas"!==e||"string"!=typeof t)}var PC="function"==typeof structuredClone?structuredClone:e=>JSON.parse(JSON.stringify(e));function RC(e,t,o){const n=fC(e)??mC(t.recipe)??mC(t.recipeId);if(n)return function(e,t,o){const n=function(e,t,o){const n={};for(const[r,i]of Object.entries(e))if(null!=i&&!AC.has(r)&&"recipeId"!==r&&(t||!_C(r,i)))if("function"==typeof i||i?.$$typeof){if(o)throw Error(`Portable recipe prop "${r}" is not JSON-safe.`)}else if(dC(i))n[r]=PC(i);else if(o)throw Error(`Portable recipe prop "${r}" is not JSON-safe.`);return n}(t,!1!==o?.includeData,"portable"===e.portability),r=e.intents.map(pC).filter(e=>!!e),i={name:e.name,intents:r,...e.audience?.primary?{audience:[e.audience.primary]}:{},frameFamily:e.frameFamily};if("portable"===e.portability){if(!dC(n))throw Error(`Portable recipe "${e.id}" contains non-JSON-safe props or layoutConfig.`);return{component:"ChartRecipe",recipeId:e.id,portable:!0,props:n,manifest:i,version:SC,createdAt:(new Date).toISOString(),...o?.selections?{selections:o.selections}:{}}}return{component:"ChartRecipe",recipeId:e.id,portable:!1,reason:"Recipe contains or may depend on non-serializable local layout callbacks.",warnings:["This config is inspectable but cannot be rendered remotely by CLI or MCP."],props:n,manifest:i,version:SC,createdAt:(new Date).toISOString(),...o?.selections?{selections:o.selections}:{}}}(n,t,o);if(!sC(e))throw Error(`Unknown component "${e}". Known components: ${rC.join(", ")}`);const r=!1!==o?.includeData,i={};for(const[e,o]of Object.entries(t))if(null!=o&&!AC.has(e)&&(r||!_C(e,o))&&"function"!=typeof o&&!o?.$$typeof)try{i[e]=PC(MC(o))}catch{}return{component:e,props:i,version:SC,createdAt:(new Date).toISOString(),...o?.selections?{selections:o.selections}:{}}}function jC(e){if(!e.component||!e.props)throw Error("Invalid chart config: missing component or props");if("ChartRecipe"===e.component||"LocalChartRecipe"===e.component){if(!e.recipeId)throw Error("Invalid chart recipe config: missing recipeId");const t=fC(e.recipeId);if(!t)throw Error(`Unknown chart recipe "${e.recipeId}". Register it before deserializing this config.`);if("LocalChartRecipe"!==e.component&&!1!==e.portable&&"portable"!==t.portability)throw Error(`Chart recipe "${e.recipeId}" is registered as local, not portable.`);return{componentName:"ChartRecipe",props:{...PC(e.props),recipeId:e.recipeId}}}if(!sC(e.component))throw Error(`Unknown component "${e.component}". This config may require a newer version of semiotic.`);return{componentName:e.component,props:PC(e.props)}}function LC(e){const t=JSON.stringify(e);return"sc="+btoa(unescape(encodeURIComponent(t))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function TC(e){const t=new URLSearchParams(e.includes("?")?e.split("?")[1]:e).get("sc");if(!t)throw Error("No chart config found in URL (missing 'sc' parameter)");const o=t.replace(/-/g,"+").replace(/_/g,"/"),n=decodeURIComponent(escape(atob(o)));return JSON.parse(n)}async function IC(e,t="json"){const o="jsx"===t?$C(e):JSON.stringify(e,null,2);if("undefined"==typeof navigator||!navigator.clipboard)throw Error("Clipboard API not available. copyConfig requires a browser environment.");await navigator.clipboard.writeText(o)}function $C(e){const{props:t}=e,o=["<"+("LocalChartRecipe"===e.component?"ChartRecipe":e.component)];e.recipeId&&o.push(` recipeId="${e.recipeId}"`);for(const[e,n]of Object.entries(t))if("string"==typeof n)o.push(` ${e}="${n}"`);else if("boolean"==typeof n&&!0===n)o.push(" "+e);else if("boolean"==typeof n&&!1===n)o.push(` ${e}={false}`);else if("number"==typeof n)o.push(` ${e}={${n}}`);else{const t=JSON.stringify(n);o.push(80>t.length?` ${e}={${t}}`:` ${e}={${JSON.stringify(n,null,2)}}`)}return o.push("/>"),o.join("\n")}function NC(e){const t=Object.create(null);for(const[o,n]of e){const e=[];for(const[,t]of n.clauses){const o=Object.create(null);for(const[e,n]of Object.entries(t.fields))o[e]="point"===n.type?{type:"point",values:Array.from(n.values)}:{type:"interval",range:n.range};e.push({clientId:t.clientId,type:t.type,fields:o})}t[o]={name:n.name,resolution:n.resolution,clauses:e}}return t}function DC(e){const t=new Map;for(const[o,n]of Object.entries(e)){const e=new Map;for(const t of n.clauses){const o=Object.create(null);for(const[e,n]of Object.entries(t.fields))o[e]="point"===n.type?{type:"point",values:new Set(n.values)}:{type:"interval",range:n.range};e.set(t.clientId,{clientId:t.clientId,type:t.type,fields:o})}t.set(o,{name:n.name,resolution:n.resolution,clauses:e})}return t}function EC(e){return"nominal"===e||"ordinal"===e}function OC(e){return"quantitative"===e||"temporal"===e}L();var BC={category10:"category10",category20:"category20",category20b:"category20",category20c:"category20",accent:"accent",dark2:"dark2",paired:"paired",pastel1:"pastel1",pastel2:"pastel2",set1:"set1",set2:"set2",set3:"set3",tableau10:"category10",tableau20:"category20"},FC={linear:"linear","monotone-x":"monotoneX","monotone-y":"monotoneY",monotone:"monotoneX",step:"step","step-after":"stepAfter","step-before":"stepBefore",basis:"basis",cardinal:"cardinal","catmull-rom":"catmullRom"},zC={sum:"sum",mean:"mean",average:"mean",count:"count",min:"min",max:"max",median:"mean"};function HC(e){e=function(e){if(!function(e){return e.usermeta?.idid}(e)||!Array.isArray(e.layer))return e;const t=e.layer.filter(e=>!function(e){return"annotation-layer"===e.usermeta?.idid?.role}(e));if(1!==t.length)return e;const{layer:o,...n}=e,{usermeta:r,...i}=t[0];return{...n,...i}}(e);const t=[],{type:o,markProps:n}=function(e){if(!e)return{type:"",markProps:{}};if("string"==typeof e)return{type:e,markProps:{}};const{type:t,...o}=e;return{type:t,markProps:o}}(e.mark),r=e.encoding||{},i=r.x,s=r.y,a=r.color,l=r.size,c=r.theta,u=r.opacity;let d;e.data?.values?d=e.data.values:e.data?.url&&t.push("data.url is not supported — only inline data.values can be translated. Provide data manually."),e.transform&&e.transform.length>0&&t.push("Vega-Lite transforms are not supported. Pre-transform your data before passing to fromVegaLite()."),e.layer&&t.push('Layered specs ("layer") are not supported. Only single-mark specs can be translated.'),(e.hconcat||e.vconcat||e.concat)&&t.push('Concatenated views ("hconcat"/"vconcat"/"concat") are not supported. Translate each sub-spec individually.'),(e.facet||r.facet||r.row||r.column)&&t.push("Faceted views are not supported. Use Semiotic's LinkedCharts or render multiple charts manually."),e.repeat&&t.push('Repeated views ("repeat") are not supported. Translate each field combination individually.'),(e.params||e.selection)&&t.push("Selections/params are not supported. Use Semiotic's LinkedCharts and selection props for interactivity.");const h={};e.width&&(h.width=e.width),e.height&&(h.height=e.height);const f=function(e){if(e)return"string"==typeof e?e:e.text}(e.title);if(f&&(h.title=f),a?.field&&(h.colorBy=a.field,a.scale?.scheme)){const e=BC[a.scale.scheme];e&&(h.colorScheme=e)}void 0!==u?.value&&(h.pointOpacity=u.value);const m=i?.aggregate,p=s?.aggregate;if(d&&(m||p)){const e=p?s:i,t=p?i:s,o=zC[e.aggregate];if(o&&t?.field&&e.field)d=function(e,t){const{groupBy:o,value:n,agg:r="sum"}=t,i=new Map;for(const t of e){const e=t[o]+"";i.has(e)||i.set(e,[]),i.get(e).push(Number(t[n]))}const s=[];for(const[e,t]of i){let n;switch(r){case"count":n=t.length;break;case"mean":n=t.reduce((e,t)=>e+t,0)/t.length;break;case"min":n=P(t)[0];break;case"max":n=P(t)[1];break;default:n=t.reduce((e,t)=>e+t,0)}s.push({[o]:e,value:n})}return s}(d,{groupBy:t.field,value:e.field,agg:o});else if(("count"===o||"count"===e.aggregate)&&t?.field&&d){const e=new Map;for(const o of d){const n=o[t.field]+"";e.set(n,(e.get(n)||0)+1)}d=Array.from(e,([e,o])=>({[t.field]:e,value:o}))}}if(i?.bin||s?.bin){const e="Histogram";d&&(h.data=d),i?.bin?(h.valueAccessor=i.field,s?.field&&(h.categoryAccessor=s.field),i.axis?.title&&(h.valueLabel=i.axis.title)):s?.bin&&(h.valueAccessor=s.field,i?.field&&(h.categoryAccessor=i.field),s.axis?.title&&(h.valueLabel=s.axis.title));const o=i?.bin||s?.bin,n="object"==typeof o?o.maxbins:void 0;return n&&(h.bins=n),qC(e,h,t)}let g;switch(o){case"bar":g=function(e,t,o,n,r,i,s){let a;return o?.field&&!1!==e?.stack&&!1!==t?.stack&&null!==e?.stack&&null!==t?.stack?(a="StackedBarChart",n.stackBy=o.field):a="BarChart",EC(e?.type)&&OC(t?.type)?(n.categoryAccessor=e.field,n.valueAccessor=s?"value":t.field,e?.axis?.title&&(n.categoryLabel=e.axis.title),t?.axis?.title&&(n.valueLabel=t.axis.title)):OC(e?.type)&&EC(t?.type)?(n.categoryAccessor=t.field,n.valueAccessor=i?"value":e.field,n.orientation="horizontal",t?.axis?.title&&(n.categoryLabel=t.axis.title),e?.axis?.title&&(n.valueLabel=e.axis.title)):(e?.field&&(n.categoryAccessor=e.field),t?.field&&(n.valueAccessor=s?"value":t.field),e?.axis?.title&&(n.categoryLabel=e.axis.title),t?.axis?.title&&(n.valueLabel=t.axis.title)),r&&(n.data=r),a}(i,s,a,h,d,m,p);break;case"line":if(g="LineChart",WC(i,s,h,m,p),a?.field&&(h.lineBy=a.field),n.interpolate){const e=FC[n.interpolate];e&&(h.curve=e)}!0===n.point&&(h.showPoints=!0),d&&(h.data=d);break;case"area":if(a?.field?(g="StackedAreaChart",h.areaBy=a.field):g="AreaChart",WC(i,s,h,m,p),n.interpolate){const e=FC[n.interpolate];e&&(h.curve=e)}void 0!==n.opacity&&(h.areaOpacity=n.opacity),d&&(h.data=d);break;case"point":case"circle":case"square":l?.field?(g="BubbleChart",h.sizeBy=l.field,l.scale?.range&&(h.sizeRange=l.scale.range)):g="Scatterplot",WC(i,s,h,m,p),d&&(h.data=d);break;case"rect":g="Heatmap",i?.field&&(h.xAccessor=i.field),s?.field&&(h.yAccessor=s.field),a?.field&&(h.valueAccessor=a.field,delete h.colorBy),i?.axis?.title&&(h.xLabel=i.axis.title),s?.axis?.title&&(h.yLabel=s.axis.title),d&&(h.data=d);break;case"arc":n.innerRadius&&n.innerRadius>0?(g="DonutChart",h.innerRadius=n.innerRadius):g="PieChart",c?.field?h.valueAccessor=c.field:s?.field&&(h.valueAccessor=p?"value":s.field),a?.field&&(h.categoryAccessor=a.field),i?.field&&!c?.field&&(h.categoryAccessor=i.field),d&&(h.data=d);break;case"tick":g="DotPlot",EC(i?.type)?(h.categoryAccessor=i.field,s?.field&&(h.valueAccessor=p?"value":s.field),i?.axis?.title&&(h.categoryLabel=i.axis.title),s?.axis?.title&&(h.valueLabel=s.axis.title)):EC(s?.type)?(h.categoryAccessor=s.field,i?.field&&(h.valueAccessor=m?"value":i.field),h.orientation="horizontal",s?.axis?.title&&(h.categoryLabel=s.axis.title),i?.axis?.title&&(h.valueLabel=i.axis.title)):(i?.field&&(h.categoryAccessor=i.field),s?.field&&(h.valueAccessor=p?"value":s.field)),d&&(h.data=d);break;default:t.push(`Unsupported mark type "${o}". Defaulting to Scatterplot.`),g="Scatterplot",WC(i,s,h,m,p),d&&(h.data=d)}return qC(g,h,t)}function WC(e,t,o,n,r){e?.field&&(o.xAccessor=n?"value":e.field),t?.field&&(o.yAccessor=r?"value":t.field),e?.axis?.title&&(o.xLabel=e.axis.title),t?.axis?.title&&(o.yLabel=t.axis.title)}function qC(e,t,o){const n={component:e,props:t,version:"1",createdAt:(new Date).toISOString()};if(o.length>0){n.warnings=o;for(const e of o)console.warn("[semiotic/fromVegaLite] "+e)}return n}var YC=d(require("react")),GC=new Set(["LineChart","AreaChart","StackedAreaChart","DifferenceChart","Scatterplot","BubbleChart","ConnectedScatterplot","QuadrantChart","MultiAxisLineChart","MinimapChart"]),VC=new Set(["BarChart","StackedBarChart","GroupedBarChart","DotPlot"]),XC=new Set(["PieChart","DonutChart","FunnelChart"]),UC=new Set(["Histogram","BoxPlot","ViolinPlot","RidgelinePlot","SwarmPlot"]);function KC(e,t){return VC.has(e)||XC.has(e)||"SwimlaneChart"===e||"GaugeChart"===e?{measure:t.valueAccessor,measureFallback:"value",dimension:t.categoryAccessor??t.stepAccessor,dimensionFallback:"category"}:{measure:t.yAccessor??t.valueAccessor,measureFallback:"y",dimension:t.xAccessor,dimensionFallback:"x"}}function QC(e){for(const t of["lineBy","areaBy","stackBy","groupBy","colorBy"]){const o=e[t];if("string"==typeof o&&o)return o}}function ZC(e,t){return null==e?"—":e instanceof Date?e.toISOString().slice(0,10):"number"==typeof e?t(e):e+""}var JC={LineChart:"line chart",AreaChart:"area chart",StackedAreaChart:"stacked area chart",DifferenceChart:"difference chart",Scatterplot:"scatter plot",BubbleChart:"bubble chart",ConnectedScatterplot:"connected scatter plot",QuadrantChart:"quadrant chart",MultiAxisLineChart:"dual-axis line chart",CandlestickChart:"candlestick chart",Heatmap:"heatmap",MinimapChart:"line chart",BarChart:"bar chart",StackedBarChart:"stacked bar chart",GroupedBarChart:"grouped bar chart",DotPlot:"dot plot",Histogram:"histogram",BoxPlot:"box plot",ViolinPlot:"violin plot",RidgelinePlot:"ridgeline plot",SwarmPlot:"swarm plot",PieChart:"pie chart",DonutChart:"donut chart",FunnelChart:"funnel chart",GaugeChart:"gauge",LikertChart:"Likert chart",SwimlaneChart:"swimlane chart",ForceDirectedGraph:"network graph",SankeyDiagram:"Sankey diagram",ProcessSankey:"temporal Sankey diagram",ChordDiagram:"chord diagram",TreeDiagram:"tree diagram",Treemap:"treemap",CirclePack:"circle-packing chart",OrbitDiagram:"orbit diagram",ChoroplethMap:"choropleth map",ProportionalSymbolMap:"proportional-symbol map",FlowMap:"flow map",DistanceCartogram:"distance cartogram",BigNumber:"single value",StreamPhysicsFrame:"physics stream frame",EventDropChart:"event-drop physics chart",GaltonBoardChart:"Galton board chart",UnitPileChart:"physics pile chart",CollisionSwarmChart:"collision swarm chart",PacketFlowChart:"physical flow chart",ProcessFlowChart:"process flow physics chart",CrucibleChart:"crucible physics chart",PhysicsCustomChart:"custom physics chart"},eM=new Set(["ForceDirectedGraph","SankeyDiagram","ProcessSankey","ChordDiagram"]),tM=new Set(["StreamPhysicsFrame","EventDropChart","GaltonBoardChart","UnitPileChart","CollisionSwarmChart","PacketFlowChart","ProcessFlowChart","GauntletChart","CrucibleChart","PhysicsCustomChart"]);function oM(e){return JC[e]||e.replace(/([a-z])([A-Z])/g,"$1 $2").toLowerCase()+" chart"}function nM(e){const t="number"==typeof e?e:"string"==typeof e?Number(e):NaN;return Number.isFinite(t)?t:void 0}var rM=new Set(["Scatterplot","BubbleChart","ConnectedScatterplot","QuadrantChart","ScatterplotMatrix"]),iM={"outlier-detection":"alerting","change-detection":"alerting",trend:"tracking","composition-over-time":"apportioning","compare-series":"comparing","compare-categories":"comparing",rank:"ranking","part-to-whole":"apportioning",distribution:"characterizing",correlation:"relating",flow:"tracing",hierarchy:"nesting",geo:"locating"},sM={"time-series":"tracking",categorical:"comparing",distribution:"characterizing",relationship:"relating",flow:"tracing",network:"tracing",hierarchy:"nesting",geo:"locating",realtime:"tracking",value:"presenting",custom:"presenting"},aM=["trend","compare-series","compare-categories","rank","part-to-whole","distribution","correlation","flow","hierarchy","geo","composition-over-time","change-detection","outlier-detection"],lM={alerting:"alerting",tracking:"trend",comparing:"comparison",ranking:"ranking",apportioning:"composition",characterizing:"distribution",relating:"correlation",tracing:"flow",nesting:"hierarchy",locating:"locator",presenting:"single-value"};var cM=new Set(["y-threshold","x-threshold","band","x-band","callout","label"]),uM=new Set(["system","agent","watcher"]),dM=new Set(["ai","agent","system","computed","dbt","great-expectations"]),hM=new Set(["rule","statistical-test","llm-inference","computed"]);function fM(e){const t=e.annotations;return!!Array.isArray(t)&&t.some(e=>{if(!e||"object"!=typeof e)return!1;const t=e;if("string"!=typeof t.type||!cM.has(t.type))return!1;const o=t.provenance;return!(!o||"object"!=typeof o)&&(uM.has(o.authorKind)||dM.has(o.source)||hM.has(o.basis))})}function mM(e="en"){let t,o;try{t=new Intl.NumberFormat(e,{notation:"compact",maximumFractionDigits:1}),o=new Intl.NumberFormat(e,{maximumFractionDigits:2})}catch{t=new Intl.NumberFormat("en",{notation:"compact",maximumFractionDigits:1}),o=new Intl.NumberFormat("en",{maximumFractionDigits:2})}return e=>Number.isFinite(e)?1e4>Math.abs(e)?o.format(e):t.format(e):e+""}var pM={"y-threshold":"a threshold line","x-threshold":"a threshold line",band:"a highlighted band","x-band":"a highlighted band",label:"a label",callout:"a callout","callout-circle":"a callout","callout-rect":"a callout",text:"a text note",bracket:"a bracket",enclose:"an enclosure","rect-enclose":"an enclosure",highlight:"a highlight",widget:"a widget",trend:"a trend line",envelope:"an envelope","anomaly-band":"an anomaly band",forecast:"a forecast","category-highlight":"a category highlight"};function gM(e){const t=pM["string"==typeof e.type?e.type:"annotation"]||"an annotation",o=function(e){const t=e.provenance&&"object"==typeof e.provenance?e.provenance:null,o=t?.authorKind??t?.source??t?.basis;return"watcher"===o?"a watcher-flagged ":"agent"===o||"ai"===o||"llm-inference"===o?"an AI-suggested ":""}(e),n=o?o+t.replace(/^an? /,""):t,r="string"==typeof e.label?e.label:"string"==typeof e.title?e.title:void 0;return r?`${n} labeled "${r}"`:n}function yM(e){const t=Array.isArray(e.annotations)?e.annotations:null;if(!t||0===t.length)return;const o=Pa(t.filter(e=>!!e&&"object"==typeof e));if(0===o.length)return;const n=o.map(gM),r=n.slice(0,5),i=n.length-r.length,s=function(e){return e.length>1?2===e.length?`${e[0]} and ${e[1]}`:`${e.slice(0,-1).join(", ")}, and ${e[e.length-1]}`:e[0]??""}(r)+(i>0?`, and ${i} more`:""),a=o.length;return`The author has marked ${1===a?"one feature":a+" features"} on this chart: ${s}.`}function bM(e,t,o={}){const n=void 0!==o.levels,r=new Set(o.levels??["l1","l2","l3"]);n||!o.capability&&!fM(t)||r.add("l4");const i=bC(e,t,o.recipe);if(i){const e=["l1","l2","l3","l4"].filter(e=>r.has(e));n||e.includes("l4")||e.push("l4");const s=function(e,t,o={}){const n=yC(t),r=gC(t),i=o.locale??"en",s="function"==typeof e.description?e.description({data:n,config:r,locale:i}):void 0,a=s?.levels??function(e,t,o,n){const r=kC(e,["nominal","ordinal"]),i=kC(e,["quantitative"]),s=r?vC(r,o,t):void 0,a=i?vC(i,o,t):void 0,l=r?.role??s??"category",c=i?.role??a??"value",u=e.encodings??[],d=u.length?u.slice(0,3).map(e=>e.meaning.replace(/\.$/,"")).join("; "):`${l} and ${c} are mapped through the recipe's declared visual semantics`,{number:h,percent:f}=function(e){try{return{number:new Intl.NumberFormat(e,{maximumFractionDigits:2}),percent:new Intl.NumberFormat(e,{style:"percent",maximumFractionDigits:1})}}catch{return{number:new Intl.NumberFormat("en",{maximumFractionDigits:2}),percent:new Intl.NumberFormat("en",{style:"percent",maximumFractionDigits:1})}}}(n),m=new Map;if(s&&a)for(const e of t){const t=(e[s]??"Uncategorized")+"",o=Number(e[a]);Number.isFinite(o)&&m.set(t,(m.get(t)??0)+o)}const p=[...m].sort((e,t)=>t[1]-e[1]),g=p.reduce((e,[,t])=>e+t,0),y=p[0],b=p[1],v=g>0?((y?.[1]??0)+(b?.[1]??0))/g:0,x=e.intents.map(e=>({id:pC(e),strength:"string"==typeof e?void 0:e.strength})).sort((e,t)=>"primary"===e.strength?-1:"primary"===t.strength?1:0)[0]?.id,k=e.audience?.primary??e.audienceFit?.find(e=>"strong"===e.fit)?.audience;return{l1:`A ${e.name.toLowerCase()} encodes ${l} and ${c}. ${w=d,w?w.charAt(0).toUpperCase()+w.slice(1):w}.`,l2:p.length>0?`${p.length} categories total ${h.format(g)}. ${y[0]} accounts for ${h.format(y[1])}${g>0?` (${f.format(y[1]/g)})`:""}${b?`, followed by ${b[0]} at ${h.format(b[1])}`:""}.`:`${t.length} data ${1===t.length?"item is":"items are"} represented.`,l3:2>p.length?y?y[0]+" is the only represented category.":"No quantitative pattern can be derived from the available data.":.5>v?`The total is distributed across ${p.length} categories without the first two forming a majority.`:`Most of the total is concentrated in ${y[0]} and ${b[0]}, which together account for ${f.format(v)}.`,l4:`The chart is intended for ${x??"explanation"}${k?` with a ${k} audience`:""}: ${e.designContract.whyCustom}`};var w}(e,n,r,i),l=o.levels??["l1","l2","l3","l4"],c={};for(const e of l)a[e]&&(c[e]=a[e]);const u=["l1","l2","l3","l4"].map(e=>c[e]).filter(e=>!!e).join(" "),d=o.includeCaveats?[...e.reception?.risks??[],...e.caveats??[],...(e.designContract.misuse??[]).map(e=>"Misuse: "+e)]:void 0;return{text:u,levels:c,...d?.length?{caveats:d}:{}}}(i,t,{levels:e,locale:o.locale,audience:o.audience,includeCaveats:o.includeCaveats}),a=yM(t);return{...s,text:a?`${a} ${s.text}`.trim():s.text,...a?{annotations:a}:{}}}const s=mM(o.locale??"en"),a=oM(e),l=Array.isArray(t.data)?t.data:null,c=QC(t),u=tM.has(e)?function(e,t){const o=e.physics&&"object"==typeof e.physics?e.physics:null,n=e.settledProjection&&"object"==typeof e.settledProjection?e.settledProjection:null,r=[e.settledProjectionRows,e.projectionRows,n?.rows,o?.settledProjectionRows,o?.projectionRows,o?.settledProjection&&"object"==typeof o.settledProjection?o.settledProjection.rows:void 0].find(e=>Array.isArray(e));return Array.isArray(r)?r.map((e,o)=>{if(!e||"object"!=typeof e)return null;const n=e,r=nM(n.count??n.value??n.total??n.bodies??n.events);if(null==r)return null;const i=n.label??n.id??n.name??"container "+(o+1),s=nM(n.secondary??n.secondaryCount),a=nM(n.observed??n.observedCount);return{label:ZC(i,t),count:r,...null!=s?{secondary:s}:{},..."string"==typeof n.secondaryLabel&&n.secondaryLabel?{secondaryLabel:n.secondaryLabel}:{},...null!=a?{observed:a}:{}}}).filter(e=>null!=e):null}(t,s):null,{measure:d,measureFallback:h,dimension:f,dimensionFallback:m}=KC(e,t),p="string"==typeof d&&d?d:h,g="string"==typeof f&&f?f:m,y={};if(tM.has(e)&&function(e,t,o,n,r,i){const s=function(e){return"EventDropChart"===e?"time window":"GaltonBoardChart"===e?"bin":"CollisionSwarmChart"===e?"group lane":"PacketFlowChart"===e?"flow node":"CrucibleChart"===e?"result group":"container"}(e),a=function(e){return"EventDropChart"===e?"event":"GaltonBoardChart"===e?"sample":"CollisionSwarmChart"===e?"point":"PacketFlowChart"===e?"packet":"CrucibleChart"===e?"settled item":"body"}(e);if(r.has("l1")&&(n.l1=function(e,t){return"EventDropChart"===e?"An event-drop physics chart that collapses moving events into a settled projection by event-time window.":"GaltonBoardChart"===e?"A Galton board chart that collapses falling samples into a settled histogram projection.":"UnitPileChart"===e?"A physics pile chart that collapses moving bodies into a settled bar-style projection by container.":"CollisionSwarmChart"===e?"A collision swarm chart that separates overlapping points while preserving their quantitative axis position.":"PacketFlowChart"===e?"A physical flow chart that keeps authored routes visible while packet bodies show throughput and proximity events.":"CrucibleChart"===e?"A crucible physics chart that replays authored phases and events into declared products and outlets; the settled ledger, not collisions, determines the result.":`A ${t} whose accessible reading is the settled projection rather than individual trajectories.`}(e,t)),!r.has("l2")&&!r.has("l3"))return;if(!o||0===o.length)return void(r.has("l2")&&(n.l2="No settled projection is loaded yet."));const l=o.reduce((e,t)=>e+t.count,0),c=o.filter(e=>e.count>0).sort((e,t)=>t.count-e.count),u=c[0]??o.slice().sort((e,t)=>t.count-e.count)[0];if(!u)return;const d=o.reduce((e,t)=>e+(t.secondary??0),0),h=o.find(e=>e.secondaryLabel)?.secondaryLabel??"secondary";if(r.has("l2"))if(0===c.length)n.l2=`The settled projection contains ${i(l)} ${xM(l,a)} across ${o.length} ${xM(o.length,s)}; no ${xM(2,s)} are non-empty yet.`;else{const e=d>0?` ${i(d)} ${xM(d,a)} ${1===d?"is":"are"} marked ${h}.`:"";n.l2=`The settled projection contains ${i(l)} ${xM(l,a)} across ${o.length} ${xM(o.length,s)}; ${c.length} ${xM(c.length,s)} ${1===c.length?"is":"are"} non-empty. The largest ${s} is ${u.label} with ${i(u.count)} ${xM(u.count,a)}.${e}`}if(r.has("l3")&&l>0&&c.length>0){const e=c.find(e=>e!==u),t=function(e,t){if(0>=t)return"0%";const o=e/t*100;return(10>o?Math.round(10*o)/10:Math.round(o))+"%"}(u.count,l);n.l3=e?`The settled projection is most concentrated in ${u.label}, which holds ${i(u.count)} ${xM(u.count,a)} (${t}); ${e.label} follows with ${i(e.count)} ${xM(e.count,a)}.`:`The settled projection is concentrated in ${u.label}, which holds all ${i(u.count)} ${xM(u.count,a)}.`}}(e,a,u,y,r,s),r.has("l1")&&!tM.has(e))if(GC.has(e)||VC.has(e))y.l1=`A ${a} of ${p} by ${g}`+(c?`, split by ${c}.`:".");else if(XC.has(e))y.l1=`A ${a} showing ${p} across ${g} categories.`;else if(UC.has(e))y.l1=`A ${a} of the distribution of ${p}`+(c?` by ${c}.`:".");else if(eM.has(e)){const e=Array.isArray(t.nodes)?t.nodes.length:void 0,o=Array.isArray(t.edges)?t.edges.length:void 0,n=[null!=e?`${e} ${xM(e,"node")}`:null,null!=o?`${o} ${xM(o,"edge")}`:null].filter(Boolean);y.l1=`A ${a}${n.length?" with "+n.join(" and "):""}.`}else if("BigNumber"===e){const e="string"==typeof t.label?t.label:p;y.l1=`A single value${e?" for "+e:""}.`}else y.l1=`A ${a}.`;const b=GC.has(e)||VC.has(e)||XC.has(e)||UC.has(e);let v=null;if((r.has("l2")||r.has("l3")||r.has("l4"))&&b&&l&&l.length>0&&(v=function(e,t,o,n){let r=0,i=0,s=1/0,a=-1/0,l=null,c=null,u=0,d=0,h=null,f=null,m=NaN,p=NaN;for(const o of e){const e=t(o);Number.isFinite(e)&&(0===r&&(m=e,h=o),p=e,f=o,s>e&&(s=e,l=o,u=r),e>a&&(a=e,c=o,d=r),r++,i+=e)}return 0===r?null:{count:r,min:s,max:a,mean:i/r,minLabel:ZC(null!=l?o(l):null,n),maxLabel:ZC(null!=c?o(c):null,n),first:m,last:p,firstLabel:ZC(null!=h?o(h):null,n),lastLabel:ZC(null!=f?o(f):null,n),minIndex:u,maxIndex:d}}(l,Dt(d,h),Et(f,m),s)),r.has("l2")&&b&&(l&&0!==l.length?v&&(y.l2=XC.has(e)?`${v.count} segments totaling ${s(function(e){return e.mean*e.count}(v))}. Largest is ${v.maxLabel} at ${s(v.max)}; smallest is ${v.minLabel} at ${s(v.min)}.`:`${p} ranges from ${s(v.min)} (${v.minLabel}) to ${s(v.max)} (${v.maxLabel}), with a mean of ${s(v.mean)} across ${v.count} points.`):y.l2="No data is loaded yet."),r.has("l3")&&v&&!c&&GC.has(e)?y.l3=function(e,t,o){const{first:n,last:r,min:i,max:s,maxLabel:a,minLabel:l,firstLabel:c,lastLabel:u,minIndex:d,maxIndex:h,count:f}=e,m=s-i,p=r-n;if(0===m)return`${vM(t)} is constant at ${o(n)} across the series.`;if(.04>m/(Math.abs(e.mean)||1))return`${vM(t)} ends roughly where it started (${o(n)} at ${c} to ${o(r)} at ${u}), ranging between ${o(i)} and ${o(s)}.`;const g=h>0&&f-1>h,y=d>0&&f-1>d,b=(s-Math.max(n,r))/m,v=(Math.min(n,r)-i)/m;return g&&b>.15?`Overall ${t} climbs to a peak of ${o(s)} (${a}), then falls to ${o(r)} (${u}).`:y&&v>.15?`Overall ${t} drops to a low of ${o(i)} (${l}), then recovers to ${o(r)} (${u}).`:.05>Math.abs(p)/m?`${vM(t)} ends roughly where it started (${o(n)} at ${c} to ${o(r)} at ${u}), ranging between ${o(i)} and ${o(s)}.`:p>0?h===f-1?`Overall ${t} rises from ${o(n)} (${c}) to a peak of ${o(r)} (${u}).`:`Overall ${t} rises from ${o(n)} (${c}) to ${o(r)} (${u}), after peaking at ${o(s)} (${a}).`:d===f-1?`Overall ${t} falls from ${o(n)} (${c}) to a low of ${o(r)} (${u}).`:`Overall ${t} falls from ${o(n)} (${c}) to ${o(r)} (${u}), after dipping to ${o(i)} (${l}).`}(v,p,s):r.has("l3")&&v&&!c&&VC.has(e)&&(y.l3=`The highest ${g} is ${v.maxLabel} and the lowest is ${v.minLabel}.`),r.has("l4")){const n=fM(t)?"alerting":function(e,t){const o=function(e){if(e){if("fits"in e||"buildProps"in e){const t=e,o={};for(const[e,n]of Object.entries(t.intentScores))"number"==typeof n&&Number.isFinite(n)&&(o[e]=n);return{family:t.family,intentScores:Object.keys(o).length?o:void 0}}return e}}(t);if(o?.act)return o.act;if(o?.intentScores){const e=function(e){let t,o=0;for(const[n,r]of Object.entries(e))if("number"==typeof r&&r>0)if(r>o)t=n,o=r;else if(r===o&&void 0!==t){const e=aM.indexOf(n),o=aM.indexOf(t);-1===e||-1!==o&&e>=o||(t=n)}return t}(o.intentScores);if(e&&iM[e]&&(o.intentScores[e]??0)>=3)return iM[e]}return o?.family?sM[o.family]:function(e){return XC.has(e)||"StackedAreaChart"===e?"apportioning":rM.has(e)?"relating":VC.has(e)?"comparing":UC.has(e)?"characterizing":GC.has(e)?"tracking":eM.has(e)?"tracing":"BigNumber"===e?"presenting":void 0}(e)}(e,o.capability);n&&(y.l4=function(e,t,o,n,r,i,s,a){const l=lM[e],c=/^[aeiou]/i.test(l)?"an":"a";let u,d;switch(e){case"locating":u="This is a map",d="read values by location";break;case"presenting":u="This is a single-value display",d=`read ${"string"==typeof o.label&&o.label?o.label:r} as the headline number`;break;case"tracing":u=`This is ${c} ${l} chart`,d="follow the movement between states";break;case"nesting":u=`This is ${c} ${l} chart`,d="read it for nested structure and how children sum into their parents";break;case"relating":u=`This is ${c} ${l} chart`,d=`read it for whether ${i} and ${r} move together`;break;default:u=`This is ${c} ${l} chart`,d=function(e,t,o,n,r,i){if(!t)switch(e){case"alerting":return"watch for points that break from the rest";case"tracking":return"read it for the overall direction of "+o;case"comparing":return`compare ${o} across ${n}`;case"ranking":return"read it top to bottom by "+o;case"apportioning":return`read each ${n}'s share of the whole`;case"characterizing":return"read it for the spread and shape of "+o;default:return"read the highlighted features"}switch(e){case"alerting":return function(e,t,o){if(VC.has(o)||XC.has(o))return`${e.maxLabel} stands out at ${t(e.max)} — check it first`;const{first:n,last:r,min:i,max:s,minLabel:a,maxLabel:l,lastLabel:c,minIndex:u,maxIndex:d,count:h}=e,f=s-i;if(f>0){const e=d>0&&h-1>d,o=u>0&&h-1>u,m=(s-Math.max(n,r))/f,p=(Math.min(n,r)-i)/f;if(e&&m>.15)return`the peak of ${t(s)} at ${l} is the point to investigate`;if(o&&p>.15)return`the dip to ${t(i)} at ${a} is the point to investigate`;if(r>=s)return`the climb to ${t(r)} at ${c} warrants a closer look`;if(i>=r)return`the drop to ${t(r)} at ${c} warrants a closer look`}return`the extremes — ${l} (${t(s)}) and ${a} (${t(i)}) — are the points to check`}(t,r,i);case"tracking":return`read it for the trajectory of ${o}, which ${function(e){const t=e.max-e.min,o=e.last-e.first;return 0===t||.05>Math.abs(o)/t?"holds roughly steady":o>0?"rises":"falls"}(t)} from ${r(t.first)} (${t.firstLabel}) to ${r(t.last)} (${t.lastLabel})`;case"comparing":return`compare ${o} across ${n}; ${t.maxLabel} leads at ${r(t.max)}`;case"ranking":return`read it top to bottom by ${o}; ${t.maxLabel} ranks highest at ${r(t.max)}`;case"apportioning":{const e=t.mean*t.count,o=e>0?Math.round(t.max/e*100):null;return`read each ${n}'s share of the ${r(e)} total; ${t.maxLabel} is the largest at ${r(t.max)}${null!=o?` (${o}%)`:""}`}case"characterizing":return`read it for the spread of ${o}, from ${r(t.min)} to ${r(t.max)}`;default:return"read the highlighted features"}}(e,n,r,i,s,t)}return`${u}; ${d}.${function(e,t){if(!t)return"";const o=t.familiarity?.[e];return"number"!=typeof o||o>2?"":` This ${oM(e)} may be unfamiliar${t.name?` to ${t.name.toLowerCase()} readers`:""} — lean on this description.`}(t,a)}`}(n,e,t,c?null:v,p,g,s,o.audience))}const x=["l1","l2","l3","l4"].filter(e=>r.has(e)&&y[e]).map(e=>y[e]).join(" "),k=yM(t);return{text:k?`${k} ${x}`.trim():x,levels:y,...k?{annotations:k}:{}}}function vM(e){return e.length?e[0].toUpperCase()+e.slice(1):e}function xM(e,t){return 1!==e&&"body"===t?"bodies":1===e?t:t+"s"}function kM(e){return((e??"unknown")+"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"unknown"}function wM(e,t,o={}){const n=o.locale??"en",r=Math.max(1,o.maxLeaves??200),i=mM(n),s=bC(e,t,o.recipe);if(s)return function(e,t,o={}){const n=yC(t),r=gC(t),i=Math.max(1,o.maxLeaves??200);if("function"==typeof e.navigation)return e.navigation({data:n,config:r,locale:o.locale??"en"});const s=(a=e.navigation)&&"object"==typeof a?e.navigation:void 0;var a;const l=(s?.groupByRole?xC(e,s.groupByRole):void 0)??(s?.groupBy?.[0]?xC(e,s.groupBy[0])??e.dataRoles.find(e=>e.field===s.groupBy?.[0]):void 0)??kC(e,["nominal","ordinal"]),c=l?vC(l,r,n):void 0,u=(s?.idRole?xC(e,s.idRole):void 0)??kC(e,["identifier"]),d=u?vC(u,r,n):void 0,h={id:"root",role:"chart",label:s?.summaryTemplate?wC(s.summaryTemplate,void 0,e,r,n,{count:n.length}):`${e.name}: ${n.length} ${1===n.length?"item":"items"} represented.`,level:1,children:[]};let f=0;const m=(t,o,i)=>{const a=d?t[d]:void 0,l=s?.itemLabelTemplate?wC(s.itemLabelTemplate,t,e,r,n,{count:n.length}):function(e,t,o,n){const r=kC(t,["nominal","ordinal"]),i=t.dataRoles.filter(e=>"quantitative"===e.semanticType),s=r?vC(r,o,n):void 0,a=[];s&&null!=e[s]&&a.push(e[s]+"");for(const t of i){const r=vC(t,o,n);r&&null!=e[r]&&a.push(`${t.role}: ${e[r]+""}`)}return a.length>0?a.join(", "):"Data item"}(t,e,r,n);return{id:"datum-"+kM(a??o),role:"datum",label:l,level:i,datum:t}};if(c){const e=new Map;for(const t of n){const o=(t[c]??"Uncategorized")+"",n=e.get(o);n?n.push(t):e.set(o,[t])}h.children=[...e].map(([e,t],o)=>{const n=t.slice(0,Math.max(0,i-f));f+=n.length;const r=n.map((e,t)=>m(e,1e5*o+t,3));return t.length>n.length&&r.push({id:"more-"+kM(e),role:"datum",label:`…and ${t.length-n.length} more items`,level:3}),{id:"group-"+kM(e),role:"series",label:`${e}: ${t.length} ${1===t.length?"item":"items"}.`,level:2,children:r}})}else{const e=n.slice(0,i);h.children=e.map((e,t)=>m(e,t,2)),n.length>e.length&&h.children.push({id:"more",role:"datum",label:`…and ${n.length-e.length} more items`,level:2})}return h}(s,t,{maxLeaves:r,locale:n});const a={id:"root",role:"chart",label:bM(e,t,{locale:n}).text||"Chart.",level:1,children:[]},l=function(e,t){const o=Array.isArray(e.annotations)?e.annotations:null;if(!o)return null;const n=Pa(o.filter(e=>!!e&&"object"==typeof e));if(0===n.length)return null;let r=0;const i=n.slice(0,t).map(e=>{const t=e.lifecycle?.status,o=t&&"accepted"!==t?` (${t})`:"";return{id:"annotation-"+r++,role:"annotation",level:3,label:`${n=gM(e),n?n.charAt(0).toUpperCase()+n.slice(1):n}${o}.`,datum:e};var n});n.length>t&&i.push({id:"annotation-"+r++,role:"annotation",level:3,label:`…and ${n.length-t} more annotations.`});const s=n.length;return{id:"annotations",role:"annotation",level:2,label:`Annotations: ${1===s?"one marked feature":s+" marked features"}.`,children:i}}(t,r),c=Array.isArray(t.data)?t.data:null,u=GC.has(e)||VC.has(e)||XC.has(e)||UC.has(e);if(!c||0===c.length||!u)return l&&(a.children=[l]),a;const{measure:d,measureFallback:h,dimension:f,dimensionFallback:m}=KC(e,t),p=Dt(d,h),g=Et(f,m),y="string"==typeof d&&d?d:h,b="string"==typeof f&&f?f:m,v=QC(t);let x=0;const k=e=>`${e}-${x++}`,w=(e,t)=>{const o=e.slice(0,r).map(e=>((e,t)=>{const o=p(e),n=ZC(g(e),i);return{id:k("datum"),role:"datum",level:t,label:`${n}: ${Number.isFinite(o)?i(o):"—"}`,value:Number.isFinite(o)?o:void 0,datum:e}})(e,t));return e.length>r&&o.push({id:k("more"),role:"datum",level:t,label:`…and ${e.length-r} more points`}),o},S=[];if(GC.has(e)||VC.has(e)){let t=1/0,o=-1/0,n=1/0,r=-1/0;const s=[];let a=!0;for(const e of c){const i=p(e);Number.isFinite(i)&&(t>i&&(t=i),i>o&&(o=i));const l=g(e);s.push(l),"number"==typeof l&&Number.isFinite(l)?(n>l&&(n=l),l>r&&(r=l)):a=!1}const l=new Set,u=[];for(const e of s){const t=e+"";l.has(t)||(l.add(t),u.push(e))}const d=a?`${i(n)} to ${i(r)}`:`${ZC(u[0],i)} to ${ZC(u[u.length-1],i)} (${VC.has(e)?u.length+" categories":c.length+" points"})`;S.push({id:k("axis"),role:"axis",level:2,label:`${VC.has(e)?"Category axis":"X axis"}: ${b}, ${d}.`}),t>o||S.push({id:k("axis"),role:"axis",level:2,label:`Value axis: ${y}, ${i(t)} to ${i(o)}.`})}if(v){const o=Et(v,v),r=new Map;for(const e of c){const t=(o(e)??"—")+"",n=r.get(t);n?n.push(e):r.set(t,[e])}const i=[];for(const[o,s]of r){const r=bM(e,{...t,data:s},{levels:["l2","l3"],locale:n}).text;i.push({id:k("series"),role:"series",level:2,label:`Series ${o}: ${r}`,children:w(s,3)})}a.children=[...S,...i]}else a.children=[...S,...w(c,2)];return l&&a.children.push(l),a}var SM=d(require("react")),AM=null,CM=new Set,MM=new Set;function _M(e,t){void 0!==console&&console.warn(`[conversationArc] ${e} failed:`,t)}function PM(e,t){try{const o=t();o&&"function"==typeof o.then&&Promise.resolve(o).catch(t=>_M(e,t))}catch(t){_M(e,t)}}var RM=Object.freeze([]),jM=RM,LM=!1;function TM(){LM=!0}var IM=new Set;function $M(){for(const e of IM)try{e()}catch(e){void 0!==console&&console.warn("[conversationArc] change subscriber threw:",e)}}function NM(){return AM}var DM={get enabled(){return AM?.enabled??!1},get sessionId(){return AM?.sessionId??null},get capacity(){return AM?.capacity??0},record(e){const t=NM();if(!t||!t.enabled)return null;const o={...e,timestamp:e.timestamp??Date.now(),sessionId:e.sessionId??t.sessionId};for(t.buffer.push(o);t.buffer.length>t.capacity;)t.buffer.shift();TM(),$M();for(const e of CM)try{e(o)}catch(e){void 0!==console&&console.warn("[conversationArc] subscriber threw:",e)}return function(e){for(const t of MM)t.record&&PM("sink record",()=>t.record?.(e))}(o),o},flush(){const e=NM();if(!e)return[];const t=e.buffer.slice();return e.buffer=[],TM(),$M(),function(e){for(const t of MM)t.flush&&PM("sink flush",()=>t.flush?.(e))}(t),t},getEvents:()=>LM?(jM=AM?Object.freeze(AM.buffer.slice()):RM,LM=!1,jM):jM,subscribe:e=>(CM.add(e),()=>{CM.delete(e)}),clear(){const e=NM();e&&(e.buffer=[],TM(),$M()),function(){for(const e of MM)e.clear&&PM("sink clear",()=>e.clear?.())}()},reset(){if(CM.clear(),MM.clear(),jM=RM,LM=!1,!AM)return $M(),void IM.clear();AM.buffer=[],AM.enabled=!1,AM=null,$M(),IM.clear()}},EM=require("react/jsx-runtime"),OM={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0,padding:0,margin:-1};function BM({tree:e,label:t,visible:o=!1,className:n,onActiveChange:r,activeId:i,chartId:s,onObservation:a,onAnnotationActivate:l}){const[c,u]=SM.useState(()=>new Set([e.id])),[d,h]=SM.useState(e.id),f=void 0!==i,m=f?i:d,p=SM.useRef(null),g=SM.useRef(new Map),y=Us(e=>e.pushObservation),b=SM.useCallback(e=>{a?.(e),y?.(e)},[a,y]),v=SM.useMemo(()=>function(e){const t=new Map,o=e=>{for(const n of e.children??[])t.set(n.id,e),o(n)};return o(e),t}(e),[e]),x=SM.useMemo(()=>function(e,t){const o=[],n=e=>{if(o.push(e),e.children&&e.children.length>0&&t.has(e.id))for(const t of e.children)n(t)};return n(e),o}(e,c),[e,c]);SM.useEffect(()=>{f||x.some(e=>e.id===d)||h(e.id)},[x,d,e.id,f]),SM.useEffect(()=>{const e=[];let t=v.get(m);for(;t;)e.push(t.id),t=v.get(t.id);e.length>0&&u(t=>{if(e.every(e=>t.has(e)))return t;const o=new Set(t);for(const t of e)o.add(t);return o})},[m,v]),SM.useEffect(()=>{p.current?.contains(document.activeElement)&&g.current.get(m)?.focus()},[m]);const k=SM.useCallback((e,t,o)=>{DM.enabled&&DM.record("focus"===t?{type:"nav-node-focused",chartId:s,nodeId:e.id,role:e.role,level:e.level,label:e.label.length>200?e.label.slice(0,200):e.label}:{type:"nav-branch-expanded",chartId:s,nodeId:e.id,role:e.role,level:e.level,expanded:!!o})},[s]),w=SM.useCallback(e=>{e.id!==m&&(f||h(e.id),r?.(e),k(e,"focus"),e.datum&&b({type:"focus",datum:e.datum,inputType:"navigation-tree",timestamp:Date.now(),chartType:"AccessibleNavTree",chartId:s}))},[r,f,k,m,b,s]),S=SM.useCallback(e=>{if(e.datum){if("annotation"===e.role){const t=Qs(e.datum);return l?.({annotation:e.datum,annotationId:t,chartId:s,inputType:"navigation-tree"}),void(t&&b({type:"annotation-activate",annotationId:t,inputType:"navigation-tree",timestamp:Date.now(),chartType:"AccessibleNavTree",chartId:s}))}b({type:"activate",datum:e.datum,inputType:"navigation-tree",timestamp:Date.now(),chartType:"AccessibleNavTree",chartId:s})}},[s,b,l]),A=e=>{u(t=>new Set(t).add(e.id)),k(e,"toggle",!0)},C=e=>{u(t=>{const o=new Set(t);return o.delete(e.id),o}),k(e,"toggle",!1)},M=(e,t,n)=>{const r=!!e.children&&e.children.length>0,i=c.has(e.id);return(0,EM.jsxs)("li",{role:"treeitem","aria-label":e.label,"aria-level":e.level,"aria-posinset":t,"aria-setsize":n,"aria-expanded":r?i:void 0,"aria-selected":e.id===m,tabIndex:e.id===m?0:-1,ref:t=>{g.current.set(e.id,t)},onClick:t=>{t.stopPropagation(),w(e),r?(i?C:A)(e):S(e)},style:o?{listStyle:"none",padding:"2px 6px",paddingLeft:6+16*(e.level-1),cursor:r?"pointer":"default",fontSize:13,color:"var(--semiotic-text, currentColor)",background:e.id===m?"var(--semiotic-surface, var(--semiotic-grid, var(--semiotic-bg, #f0f4f8)))":"transparent",outline:"none"}:void 0,children:[(0,EM.jsxs)("span",{className:"semiotic-nav-tree-label semiotic-nav-tree-"+e.role,children:[o&&r?i?"▾ ":"▸ ":"",e.label]}),r&&i&&(0,EM.jsx)("ul",{role:"group",style:o?{margin:0,padding:0}:void 0,children:e.children.map((t,o)=>M(t,o+1,e.children.length))})]},e.id)};return(0,EM.jsx)("div",{ref:p,className:"semiotic-nav-tree"+(n?" "+n:""),style:o?void 0:OM,onKeyDown:e=>{const t=x.findIndex(e=>e.id===m);if(-1===t)return;const o=x[t],n=!!o.children&&o.children.length>0,r=c.has(o.id);let i=!0;switch(e.key){case"ArrowDown":w(x[Math.min(t+1,x.length-1)]);break;case"ArrowUp":w(x[Math.max(t-1,0)]);break;case"Home":w(x[0]);break;case"End":w(x[x.length-1]);break;case"ArrowRight":n&&!r?A(o):n&&r?w(o.children[0]):i=!1;break;case"ArrowLeft":if(n&&r)C(o);else{const e=v.get(o.id);e?w(e):i=!1}break;case"Enter":case" ":n?(r?C:A)(o):S(o);break;default:i=!1}i&&(e.preventDefault(),e.stopPropagation())},children:(0,EM.jsx)("ul",{role:"tree","aria-label":t||"Chart navigation",style:o?{margin:0,padding:0}:void 0,children:M(e,1,1)})})}var FM=d(require("react")),zM=require("react/jsx-runtime");function HM(e,t,o=0){const n=Math.min(t[0],t[1]),r=Math.max(t[0],t[1]),i=Math.max(n,Math.min(r,e[0])),s=Math.max(n,Math.min(r,e[1])),a=i>s?[s,i]:[i,s];if(a[1]-a[0]>=o)return a;const l=(a[0]+a[1])/2,c=o/2;return[Math.max(n,Math.min(r-o,l-c)),Math.min(r,Math.max(n+o,l+c))]}function WM(e,t,o,n=1,r=n){const i="in"===o?n:-n;return HM([e[0]+i,e[1]-i],t,r)}function qM(e){const{domain:t,initialValue:o=t,step:n=1,minSpan:r=n,label:i,formatValue:s,onChange:a}=e,[l,c]=FM.useState(()=>HM(o,t,r)),u=HM(l,t,r),d=FM.useCallback(e=>{const o=HM(e,t,r);c(o),a?.(o)},[t,r,a]),h=FM.useMemo(()=>({label:i,domain:t,value:u,step:n,formatValue:s,onChange:d,onClear:()=>d(t)}),[t,s,i,d,n,u]),f=FM.useMemo(()=>({onZoomIn:()=>d(WM(u,t,"in",n,r)),onZoomOut:()=>d(WM(u,t,"out",n,r)),onReset:()=>d(t)}),[t,r,d,n,u]);return{value:u,setValue:d,xExtent:u,brush:h,zoom:f}}var YM={display:"grid",gap:8,padding:"10px 12px",border:"1px solid var(--semiotic-border, #d8dee4)",borderRadius:12,background:"var(--semiotic-surface, var(--semiotic-bg, rgba(255,255,255,0.92)))"},GM={fontSize:11,fontWeight:700,letterSpacing:"0.04em",textTransform:"uppercase",color:"var(--semiotic-text-secondary, #57606a)"};function VM(e,t){return{minWidth:e,minHeight:e,padding:"0 12px",borderRadius:999,border:"1px solid var(--semiotic-border, #d8dee4)",background:t?"var(--semiotic-primary, #0969da)":"var(--semiotic-bg, #fff)",color:t?"var(--semiotic-bg, #fff)":"var(--semiotic-text, #24292f)",fontSize:13,fontWeight:650,touchAction:"manipulation"}}function XM(e){return"function"==typeof e}function UM({brush:e,targetSize:t}){const o=e?.value,n=e?.domain,r=!!o&&!!n,i=!0===e?.disabled,s=e?.formatValue??(e=>e),a=!!e?.onChange&&r&&!i,l=n?.[0]??0,c=n?.[1]??1,u=o?.[0]??l,d=o?.[1]??c,h=e?.step??((c-l)/100||1);return(0,zM.jsxs)("section",{style:YM,"aria-label":"Brush controls",children:[(0,zM.jsx)("div",{style:GM,children:e?.label??"Filter range"}),r?(0,zM.jsxs)("div",{style:{display:"grid",gap:8},children:[(0,zM.jsxs)("label",{style:{display:"grid",gap:4,fontSize:12},children:[(0,zM.jsxs)("span",{children:["Start: ",s(u)]}),(0,zM.jsx)("input",{type:"range",min:l,max:c,step:h,value:u,disabled:!a,style:{minHeight:t},onChange:t=>{const o=Number(t.currentTarget.value);e?.onChange?.([Math.min(o,d),d])}})]}),(0,zM.jsxs)("label",{style:{display:"grid",gap:4,fontSize:12},children:[(0,zM.jsxs)("span",{children:["End: ",s(d)]}),(0,zM.jsx)("input",{type:"range",min:l,max:c,step:h,value:d,disabled:!a,style:{minHeight:t},onChange:t=>{const o=Number(t.currentTarget.value);e?.onChange?.([u,Math.max(o,u)])}})]})]}):(0,zM.jsx)("div",{style:{fontSize:12,color:"var(--semiotic-text-secondary, #57606a)"},children:"Provide a brush domain and value to expose range inputs beside the drag gesture."}),(0,zM.jsx)("button",{type:"button",disabled:i||!XM(e?.onClear),onClick:e?.onClear,style:VM(t),children:"Clear range"})]})}function KM({zoom:e,targetSize:t}){const o=!0===e?.disabled;return(0,zM.jsxs)("section",{style:YM,"aria-label":"Zoom controls",children:[(0,zM.jsx)("div",{style:GM,children:e?.label??"Zoom"}),(0,zM.jsxs)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[(0,zM.jsx)("button",{type:"button","aria-label":"Zoom out",disabled:o||!XM(e?.onZoomOut),onClick:e?.onZoomOut,style:VM(t),children:"-"}),(0,zM.jsx)("button",{type:"button","aria-label":"Reset zoom",disabled:o||!XM(e?.onReset),onClick:e?.onReset,style:VM(t),children:"Reset"}),(0,zM.jsx)("button",{type:"button","aria-label":"Zoom in",disabled:o||!XM(e?.onZoomIn),onClick:e?.onZoomIn,style:VM(t),children:"+"})]})]})}function QM({legend:e,targetSize:t}){const o=!0===e?.disabled,n=e?.items??[];return(0,zM.jsxs)("section",{style:YM,"aria-label":"Legend controls",children:[(0,zM.jsx)("div",{style:GM,children:e?.label??"Series"}),n.length>0&&(0,zM.jsx)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:n.map(n=>{const r=!1!==n.active;return(0,zM.jsxs)("button",{type:"button",disabled:o||n.disabled||!e?.onToggle,onClick:()=>e?.onToggle?.(n.id,!r),style:VM(t,r),"aria-pressed":r,children:[n.color&&(0,zM.jsx)("span",{"aria-hidden":"true",style:{display:"inline-block",width:9,height:9,marginRight:6,borderRadius:999,background:n.color}}),n.label??n.id]},n.id)})}),(0,zM.jsxs)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[(0,zM.jsx)("button",{type:"button",disabled:o||!XM(e?.onShowAll),onClick:e?.onShowAll,style:VM(t),children:"Show all"}),(0,zM.jsx)("button",{type:"button",disabled:o||!XM(e?.onHideAll),onClick:e?.onHideAll,style:VM(t),children:"Hide all"})]})]})}function ZM({controls:e,targetSize:t=44,compact:o=!1,className:n,style:r,ariaLabel:i="Mobile chart controls",brush:s,zoom:a,legend:l}){const c=function(e,t){if(!1===e)return[];if(!0===e||"all"===e)return["brush","zoom","legend"];if(Array.isArray(e))return e;if(e)return[e];const o=[];return t.brush&&o.push("brush"),t.zoom&&o.push("zoom"),t.legend&&o.push("legend"),o}(e,{brush:s,zoom:a,legend:l});return 0===c.length?null:(0,zM.jsxs)("div",{className:n,role:"group","aria-label":i,style:{display:"grid",gridTemplateColumns:o?"1fr":"repeat(auto-fit, minmax(180px, 1fr))",gap:10,...r},children:[c.includes("brush")&&(0,zM.jsx)(UM,{brush:s,targetSize:t}),c.includes("zoom")&&(0,zM.jsx)(KM,{zoom:a,targetSize:t}),c.includes("legend")&&(0,zM.jsx)(QM,{legend:l,targetSize:t})]})}new Set(Object.keys({PieChart:"valueAccessor",DonutChart:"valueAccessor",FunnelChart:"valueAccessor"}));var JM=new Set(["LineChart","AreaChart","DifferenceChart","StackedAreaChart","Scatterplot","ConnectedScatterplot","BubbleChart","QuadrantChart","MultiAxisLineChart","CandlestickChart","Heatmap","MinimapChart"]),e_=new Set(["BarChart","StackedBarChart","GroupedBarChart","SwarmPlot","BoxPlot","Histogram","ViolinPlot","DotPlot","RidgelinePlot","FunnelChart","LikertChart","SwimlaneChart"]),t_=new Set([...JM,"RealtimeLineChart","RealtimeHeatmap"]),o_=Object.fromEntries(Object.entries({Scatterplot:"pointRadius",BubbleChart:"pointRadius",ConnectedScatterplot:"pointRadius",QuadrantChart:"pointRadius",SwarmPlot:"pointRadius",DotPlot:"dotRadius"}).map(([e,t])=>[e,[t,"hoverRadius"]]));function n_(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function r_(e){return"string"==typeof e&&e.trim().length>0}function i_(e){const t=n_(e.capability)?e.capability:null,o=n_(e.recipe)?e.recipe:null,n=[e.mobileSemantics,e.mobileVisualization,e.mobile,t?.mobile,o?.mobile];for(const e of n)if(n_(e))return e;return null}function s_(e){return Array.isArray(e)&&e.length>=2&&"number"==typeof e[0]&&"number"==typeof e[1]&&Number.isFinite(e[0])&&Number.isFinite(e[1])?[e[0],e[1]]:null}function a_(e){return s_(e.size)||s_(n_(e.frameProps)?e.frameProps.size:void 0)||("number"==typeof e.width&&"number"==typeof e.height?[e.width,e.height]:null)}function l_(e,t){e.push({...t,status:"pass"})}function c_(e,t){e.push({...t,status:"warn"})}function u_(e,t){e.push({...t,status:"manual"})}function d_(e,t={},o={}){const n=o.viewportWidth??390,r=o.targetSize??44,i=a_(t),s=Gg(t,{width:n,height:i?.[1]}),a=[],l=a_(t=s.props),c=i_(t),u=function(e,t){return e.includes("CustomChart")||e.includes("Custom")||null!=t.recipeId||null!=t.mobileSemantics}(e,t),d=function(e){const t=i_(e);return!0===e.responsive||!0===e.mobile||!0===t?.responsive||!0===t?.supportsResponsiveLayout||Array.isArray(t?.breakpoints)||"number"==typeof t?.minViewportWidth||"responsive"===t?.strategy||"small-multiples"===t?.strategy||"summary-cards"===t?.strategy||null!=e.mobileLayout||null!=e.responsiveRules||"mobile-readable"===e.density}(t),h=!0===o.inChartContainer,f=r_(t.title)||r_(t.summary)||r_(t.description)||!0===c?.summary||r_(c?.summary);if(s.matches.length>0&&l_(a,{id:"layout.responsive-rule-applied",category:"layout",impact:"medium",message:`${s.matches.length} responsive rule(s) applied for the ${n}px mobile audit.`}),l){const[t,o]=l;t>n&&!d?c_(a,{id:"layout.fixed-desktop-size",category:"layout",impact:"high",message:`Chart size is ${t}px wide against a ${n}px mobile viewport with no responsive/mobile transform hint.`,fix:"Use responsive sizing, responsiveRules/mobileLayout, or an explicit mobile variant that preserves the task instead of clipping the desktop chart."}):l_(a,{id:"layout.fixed-desktop-size",category:"layout",impact:"high",message:"No fixed desktop-width overflow risk is visible from the config."}),"number"==typeof c?.minViewportWidth&&c.minViewportWidth>n&&c_(a,{id:"layout.mobile-min-width",category:"layout",impact:"high",message:`The declared mobile contract supports ${c.minViewportWidth}px minimum, wider than the audited ${n}px viewport.`,fix:"Add a narrower breakpoint, summary-card fallback, or explicit horizontal-scroll affordance with a non-visual equivalent."});const r=t/Math.max(1,o);430>=n&&r>2.4&&"BigNumber"!==e&&c_(a,{id:"layout.wide-aspect-ratio",category:"layout",impact:"medium",message:`Chart aspect ratio is ${r.toFixed(1)}:1, which tends to compress phone charts vertically.`,fix:"Prefer stacked sections, small multiples, cards plus a sparkline, or a taller mobile-specific chart ratio."}),160>o&&"BigNumber"!==e&&c_(a,{id:"layout.too-short-for-reading",category:"layout",impact:"medium",message:`Chart height is ${o}px; most phone charts need enough vertical room for marks plus readable labels.`,fix:"Reserve more vertical space, remove nonessential axes, or switch to a card/sparkline pattern with external labels."})}else u_(a,{id:"layout.unknown-size",category:"layout",impact:"medium",message:"No explicit size is available to audit. This may be responsive, but static mobile overflow cannot be checked.",fix:"Audit rendered widths at 320, 360, 390, and 430px, or pass size/responsiveRules metadata into the config."});const m=function(e){const t=[e.data,e.points,e.lines,e.nodes,e.edges,e.areas,n_(e.frameProps)?e.frameProps.data:void 0];let o=0;for(const e of t)Array.isArray(e)&&(o+=e.length);return o}(t);m>0&&(m>("number"==typeof c?.maxMarks?c.maxMarks:t_.has(e)?1.25*n:e_.has(e)?Math.max(8,Math.floor(n/34)):n)?c_(a,{id:"density.mark-budget",category:"density",impact:t_.has(e)?"medium":"high",message:`${m} data item(s) exceed the rough mobile density budget for ${e} at ${n}px.`,fix:"Aggregate, filter, facet into small multiples, switch to a summary-card plus detail view, or use progressive disclosure."}):l_(a,{id:"density.mark-budget",category:"density",impact:"medium",message:m+" data item(s) are within the rough mobile density budget for this component."}));const p=function(e){const t=[e.tickValues,e.xTickValues,e.yTickValues,e.rTickValues,e.oTickValues];let o=0;for(const e of t)Array.isArray(e)&&(o+=e.length);return o>0?o:null}(t),g=!1!==t.showAxes&&!1!==t.axis;if(g&&null!=p){const e=Math.max(3,Math.floor(n/58));p>e&&c_(a,{id:"density.explicit-tick-count",category:"density",impact:"medium",message:`${p} explicit tick(s) exceed a phone-friendly budget of about ${e} at ${n}px.`,fix:"Use adaptive ticks, fewer tickValues, direct labels, or move exact values into a tap-accessible detail panel."})}else g&&(t_.has(e)||e_.has(e))&&u_(a,{id:"density.axis-label-collision",category:"density",impact:"medium",message:"Axes are enabled, but label collision depends on rendered tick text and cannot be checked statically.",fix:"Verify tick labels at phone widths or provide explicit mobile tick density."});!function(e){const t=n_(e.frameProps)?e.frameProps:{};return(!0===e.enableHover||null!=e.tooltipContent||null!=e.tooltip||null!=t.tooltipContent||!0===t.enableHover)&&!function(e){const t=i_(e),o=n_(e.mobileInteraction)?e.mobileInteraction:null;return null!=e.controls||null!=e.mobileControls||!0===e.alternativeControls||null!=e.selection||null!=e.onClick||null!=e.onSelect||!0===e.mobileInteraction||!0===o?.tapToSelect||!0===o?.tapToLockTooltip||Array.isArray(t?.interaction?.alternatives)&&t.interaction.alternatives.length>0||"tap"===t?.interaction?.primary||"button"===t?.interaction?.primary||r_(t?.interaction?.hoverFallback)}(e)}(t)?l_(a,{id:"interaction.hover-only-detail",category:"interaction",impact:"high",message:"No hover-only detail path is visible from the config."}):c_(a,{id:"interaction.hover-only-detail",category:"interaction",impact:"high",message:"The chart exposes tooltip/hover detail without an obvious tap, selection, or control alternative.",fix:"Enable tap-to-select, a persistent details panel, visible segment buttons, or another non-hover path for the same information."});const y=function(e,t){const o=o_[e];if(!o)return null;let n=o.includes("hoverRadius")?30:null;for(const e of o){const o=t[e];"number"==typeof o&&Number.isFinite(o)&&o>0&&(n=null==n?o:Math.max(n,o))}return null==n?null:2*n}(e,t),b=n_(t.mobileInteraction)?t.mobileInteraction:null,v=y??("number"==typeof b?.targetSize?b.targetSize:!0===t.mobileInteraction?44:"number"==typeof c?.minimumHitTarget?c.minimumHitTarget:"number"==typeof c?.interaction?.targetSize?c.interaction.targetSize:null);null!=v&&(24>v?c_(a,{id:"interaction.target-size-minimum",category:"interaction",impact:"high",message:`Small interactive marks expose an estimated ${v}px pointer target, below WCAG's 24px minimum.`,fix:"Increase mark radius/hoverRadius, add tap snapping to nearest datum, or provide larger external controls."}):r>v?c_(a,{id:"interaction.target-size-comfort",category:"interaction",impact:"medium",message:`Pointer target is about ${v}px, above 24px but below the ${r}px comfortable phone target.`,fix:"Use hoverRadius/tapRadius near 44px while keeping the visible mark small if needed."}):l_(a,{id:"interaction.target-size-comfort",category:"interaction",impact:"medium",message:`Pointer target is about ${v}px, meeting the configured ${r}px target.`}));const x=[];null==t.brush&&null==t.onBrush||x.push("brush"),!0===t.zoomable&&x.push("pan/zoom"),"isolate"!==t.legendInteraction&&"highlight"!==t.legendInteraction||x.push("legend filtering"),x.length>0&&!function(e,t){const o=i_(e),n=n_(e.mobileInteraction)?e.mobileInteraction:null,r=n?.standardControls;return!!(null!=e.controls||null!=e.mobileControls||!0===e.alternativeControls||Array.isArray(o?.interaction?.alternatives)&&o.interaction.alternatives.length>0)||!0===r||"all"===r||t.every(e=>"brush"===e?Array.isArray(r)?r.includes("brush"):"brush"===r:"pan/zoom"===e?Array.isArray(r)?r.includes("zoom"):"zoom"===r:"legend filtering"===e&&(Array.isArray(r)?r.includes("legend"):"legend"===r))}(t,x)&&c_(a,{id:"interaction.complex-gesture-alternative",category:"interaction",impact:"high",message:`Mobile-hostile complex interaction detected: ${x.join(", ")} without standard control alternatives.`,fix:"Pair gestures with buttons, range inputs, chips, or a details panel that works with touch and keyboard."}),!1===t.showLegend||!1===t.legend||!0!==t.showLegend&&!0!==t.legend&&null==t.colorBy&&null==t.groupBy&&null==t.lineBy&&null==t.areaBy&&null==t.stackBy||!0===t.directLabel||!0===t.showLabels||"direct"===t.labelStrategy||"direct-end"===t.labelStrategy||"direct"===c?.labels?.strategy||"inline"===c?.labels?.strategy||"external"===c?.labels?.strategy||n>430||c_(a,{id:"semantics.legend-over-direct-labels",category:"semantics",impact:"medium",message:"The chart appears to rely on a legend instead of direct labels at phone width.",fix:"Prefer direct end labels, inline labels, or a compact chip selector so readers do not bounce between plot and legend."});const k=Array.isArray(t.annotations)?t.annotations.filter(e=>n_(e)):[];if(k.length>("number"==typeof c?.maxAnnotations?c.maxAnnotations:3)&&430>=n&&c_(a,{id:"annotation.mobile-density",category:"annotation",impact:"medium",message:k.length+" annotation(s) compete for phone plot space.",fix:"Assign annotation priority, collapse secondary notes into a callout list, or provide shorter mobileText."}),k.length>0){const e=k.filter(e=>!r_(e.mobileText)&&!r_(e.shortText)&&!r_(e.label));e.length>0&&u_(a,{id:"annotation.mobile-copy",category:"annotation",impact:"low",message:e.length+" annotation(s) lack explicit short/mobile copy.",fix:"Add mobileText or shortText for notes that need to survive narrow layouts."})}d||"BigNumber"===e||u_(a,{id:"layout.no-responsive-transform",category:"layout",impact:"low",message:"No explicit responsive transformation hint is present.",fix:"Declare responsiveRules/mobileLayout or a density/label strategy so the mobile version is a designed transformation, not an accidental resize."}),u&&(c?(l_(a,{id:"semantics.custom-mobile-contract",category:"semantics",impact:"medium",message:"Custom chart/recipe provides a mobileSemantics/mobile contract, so the audit can inspect its authored phone behavior."}),!1===c.custom?.dataBearingSceneNodes?c_(a,{id:"semantics.custom-data-bearing-scene",category:"semantics",impact:"medium",message:"Custom mobile contract says emitted scene nodes are not data-bearing.",fix:"Preserve datum references, semantic roles, or accessible-table fields so intelligence, navigation, and tap details can recover the chart's meaning."}):!0!==c.custom?.dataBearingSceneNodes&&u_(a,{id:"semantics.custom-data-bearing-scene",category:"semantics",impact:"low",message:"Custom chart mobile contract does not state whether scene nodes are data-bearing.",fix:"Set mobile.custom.dataBearingSceneNodes and mobile.custom.navigationGranularity for custom layouts and interoperability adapters."})):u_(a,{id:"semantics.custom-mobile-contract",category:"semantics",impact:"medium",message:"Custom chart layout is opaque to static mobile analysis because no mobileSemantics/mobile contract is present.",fix:"Declare mobileSemantics with strategy, breakpoints, mark budgets, touch target size, interaction alternatives, and custom scene semantics."})),f||h||c_(a,{id:"semantics.no-mobile-summary",category:"semantics",impact:"medium",message:"No title, summary, description, or ChartContainer context is visible from the config.",fix:"Add title/summary text or wrap in ChartContainer so the small-screen reader gets the task before the chart."});const w=a.filter(e=>"warn"===e.status),S={highRisk:w.filter(e=>"high"===e.impact).length,warnings:w.length,manual:a.filter(e=>"manual"===e.status).length,passes:a.filter(e=>"pass"===e.status).length};return{component:e,viewportWidth:n,ok:0===S.highRisk,summary:S,findings:a,reference:"Mobile visualization audit: informed by MobileVisFixer, mobile exploratory interaction research, small-multiple mobile studies, responsive visualization grammars, constraint-based breakpoints, and WCAG 2.2 input modalities."}}var h_,f_=d(require("react")),m_=[];function p_(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function g_(e){return e&&"object"==typeof e&&"number"==typeof e.targetSize?e.targetSize:void 0}function y_(e){return Array.isArray(e)?e.length>0:!!e}var b_=require("react/jsx-runtime"),v_={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0,padding:0,margin:-1};function x_(){const e=function(){const e=zl.useContext(Wl);return e?e.toggle:null}();return e?(0,b_.jsx)("button",{className:"semiotic-chart-action",onClick:e,title:"Data summary","aria-label":"Toggle data summary",style:j_,children:(0,b_.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,b_.jsx)("rect",{x:"1",y:"1",width:"12",height:"3",rx:"0.5"}),(0,b_.jsx)("rect",{x:"1",y:"6",width:"8",height:"3",rx:"0.5"}),(0,b_.jsx)("rect",{x:"1",y:"11",width:"5",height:"2",rx:"0.5"})]})}):null}var k_={info:"var(--semiotic-info, #2563eb)",success:"var(--semiotic-success, #16a34a)",warning:"var(--semiotic-warning, #d97706)",error:"var(--semiotic-error, var(--semiotic-danger, #dc2626))",neutral:"var(--semiotic-text-secondary, #6b7280)"},w_={error:4,warning:3,info:2,success:1,neutral:0};function S_({level:e}){const t={width:15,height:15,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0};switch(e){case"error":case"warning":return(0,b_.jsxs)("svg",{...t,children:[(0,b_.jsx)("path",{d:"M8 1.8 15 14H1L8 1.8Z"}),(0,b_.jsx)("path",{d:"M8 6.4v3.4"}),(0,b_.jsx)("circle",{cx:"8",cy:"11.8",r:"0.5",fill:"currentColor",stroke:"none"})]});case"success":return(0,b_.jsxs)("svg",{...t,children:[(0,b_.jsx)("circle",{cx:"8",cy:"8",r:"6.4"}),(0,b_.jsx)("path",{d:"M5 8.2 7 10.2 11 5.8"})]});case"info":return(0,b_.jsxs)("svg",{...t,children:[(0,b_.jsx)("circle",{cx:"8",cy:"8",r:"6.4"}),(0,b_.jsx)("path",{d:"M8 7.4V11"}),(0,b_.jsx)("circle",{cx:"8",cy:"5",r:"0.5",fill:"currentColor",stroke:"none"})]});default:return(0,b_.jsxs)("svg",{...t,children:[(0,b_.jsx)("path",{d:"M8 2a3.5 3.5 0 0 0-3.5 3.5c0 4-1.5 5-1.5 5h10s-1.5-1-1.5-5A3.5 3.5 0 0 0 8 2Z"}),(0,b_.jsx)("path",{d:"M6.5 13a1.5 1.5 0 0 0 3 0"})]})}}function A_({notification:e,level:t,onDismiss:o}){const n=k_[t]??k_.info,r=!1!==e.dismissible;return(0,b_.jsxs)("div",{className:"semiotic-chart-notification semiotic-chart-notification--"+t,style:{display:"flex",alignItems:"flex-start",gap:8,padding:"6px 10px",borderRadius:4,borderLeft:"3px solid "+n,background:"var(--semiotic-surface, rgba(127, 127, 127, 0.08))"},children:[(0,b_.jsxs)("div",{style:{flex:1,minWidth:0},children:[e.source&&(0,b_.jsx)("div",{className:"semiotic-chart-notification-source",style:{fontSize:9,fontWeight:700,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--semiotic-text-secondary, #666)"},children:e.source}),e.title&&(0,b_.jsx)("div",{className:"semiotic-chart-notification-title",style:{fontSize:12,fontWeight:600,color:n},children:e.title}),(0,b_.jsx)("div",{className:"semiotic-chart-notification-message",style:{fontSize:12,lineHeight:1.45,color:"var(--semiotic-text, #333)"},children:e.message})]}),r&&(0,b_.jsx)("button",{className:"semiotic-chart-notification-dismiss","aria-label":e.title?"Dismiss notification: "+e.title:"Dismiss notification",title:"Dismiss",onClick:o,style:{...j_,width:18,height:18,fontSize:13,lineHeight:1,flex:"none"},children:"×"})]})}function C_({visible:e,onDismiss:t}){const[o,n]=YC.useState(!1),r=YC.useRef(null),i=YC.useRef(null);if(YC.useEffect(()=>{0===e.length&&o&&n(!1)},[e.length,o]),YC.useEffect(()=>{if(!o)return;const e=e=>{r.current&&!r.current.contains(e.target)&&n(!1)},t=e=>{"Escape"===e.key&&(n(!1),i.current?.focus())};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)}},[o]),0===e.length)return null;const s=e.reduce((e,t)=>w_[t.level]>w_[e]?t.level:e,e[0].level),a=k_[s]??k_.info,l=e.length,c=`${l} chart notification${1===l?"":"s"}, most severe: ${s}`;return(0,b_.jsxs)("div",{ref:r,className:"semiotic-chart-notifications",style:{position:"relative",display:"inline-flex"},children:[(0,b_.jsx)("span",{style:v_,role:"status","aria-live":"polite",children:c}),(0,b_.jsxs)("button",{ref:i,className:"semiotic-chart-action semiotic-chart-notifications-toggle","aria-haspopup":"dialog","aria-expanded":o,"aria-label":`${c}. ${o?"Hide":"Show"} notifications`,title:c,onClick:()=>n(e=>!e),style:{...j_,color:a,position:"relative"},children:[(0,b_.jsx)(S_,{level:s}),(0,b_.jsx)("span",{className:"semiotic-chart-notifications-badge","aria-hidden":"true",style:{position:"absolute",top:-3,right:-3,minWidth:15,height:15,padding:"0 3px",boxSizing:"border-box",borderRadius:8,background:a,color:"#fff",fontSize:9,fontWeight:700,lineHeight:"15px",textAlign:"center"},children:l>99?"99+":l})]}),o&&(0,b_.jsx)("div",{className:"semiotic-chart-notifications-popover",role:"dialog","aria-label":"Chart notifications",style:{position:"absolute",top:"calc(100% + 6px)",right:0,zIndex:20,width:320,maxWidth:"min(360px, 90vw)",maxHeight:320,overflowY:"auto",display:"flex",flexDirection:"column",gap:6,padding:10,textAlign:"left",background:"var(--semiotic-bg, #fff)",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:6,boxShadow:"0 6px 24px rgba(0, 0, 0, 0.16)"},children:e.map(e=>(0,b_.jsx)(A_,{notification:e.notification,level:e.level,onDismiss:()=>t(e)},e.key))})]})}var M_={live:{bg:"#22c55e",color:"#fff"},stale:{bg:"#ef4444",color:"#fff"},paused:{bg:"#eab308",color:"#000"},error:{bg:"#ef4444",color:"#fff"},static:{bg:"#6b7280",color:"#fff"}};function __({height:e}){return(0,b_.jsx)("div",{role:"status","aria-busy":"true","aria-label":"Loading chart",style:{width:"100%",height:e,background:"linear-gradient(90deg, var(--semiotic-border, #e0e0e0) 25%, var(--semiotic-bg, #f5f5f5) 50%, var(--semiotic-border, #e0e0e0) 75%)",backgroundSize:"200% 100%",animation:"semiotic-skeleton-pulse 1.5s ease-in-out infinite",borderRadius:4}})}function P_({error:e}){return(0,b_.jsx)("div",{role:"alert",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",minHeight:120,padding:24,boxSizing:"border-box"},children:(0,b_.jsx)("div",{style:{textAlign:"center",maxWidth:400,fontSize:14,color:"var(--semiotic-text-secondary, #666)",lineHeight:1.5},children:e})})}var R_=YC.forwardRef(function({title:e,subtitle:t,children:o,width:n="100%",height:r=400,actions:i,chartConfig:s,describe:a,navigable:l,controls:c,banner:u,notifications:d,dataAudit:h,onNotificationDismiss:f,loading:m=!1,error:p,errorBoundary:g=!1,status:y,detailsPanel:b,mobile:v,mobileAudit:x,className:k,style:w},S){const A=YC.useRef(null),C=YC.useRef(null),[M,_]=YC.useState(!1),P=function(e,t){const[o,n]=f_.useState(m_),r=e?.component,i=e?.props,s=!!t,a="object"==typeof t?t.checkOutliers:void 0,l="object"==typeof t?t.errorsOnly:void 0,c="object"==typeof t?t.max:void 0;return f_.useEffect(()=>{let e=!0;return s&&r&&i?((h_??(h_=Promise.resolve().then(()=>(at(),rt)).catch(e=>{throw h_=void 0,e})),h_).then(({buildChartDataAuditNotifications:t})=>{e&&n(t({component:r,props:i},{checkOutliers:a,errorsOnly:l,max:c}))}).catch(()=>{e&&n(m_)}),()=>{e=!1}):(n(e=>0===e.length?e:m_),()=>{e=!1})},[a,r,s,l,c,i]),o}(s,h),R=YC.useMemo(()=>[...d??[],...P],[d,P]),[j,L]=YC.useState(()=>new Set);YC.useEffect(()=>{L(e=>{if(0===e.size)return e;const t=new Set(R.map((e,t)=>e.id??t+""));let o=!1;const n=new Set;for(const r of e)t.has(r)?n.add(r):o=!0;return o?n:e})},[R]);const T=YC.useMemo(()=>R.map((e,t)=>({notification:e,index:t,key:e.id??t+"",level:e.level??"info"})).filter(({key:e})=>!j.has(e)),[R,j]),I=YC.useCallback(e=>{L(t=>new Set(t).add(e.key)),f?.(e.notification,e.index)},[f]),$=!1!==i?.export&&void 0!==i?.export,N=!1!==i?.fullscreen&&void 0!==i?.fullscreen,D=!1!==i?.copyConfig&&void 0!==i?.copyConfig&&s,E=!0===i?.dataSummary,O=YC.useMemo(()=>{if(!a||!s?.component||!s?.props)return"";const e="object"==typeof a?a.levels:void 0;try{return bM(s.component,s.props,e?{levels:e}:{}).text}catch{return""}},[a,s]),B="object"==typeof a&&!0===a.visible,F=YC.useMemo(()=>{if(!l||!s?.component||!s?.props)return null;const e="object"==typeof l?l.maxLeaves:void 0;try{return wM(s.component,s.props,e?{maxLeaves:e}:{})}catch{return null}},[l,s]),z="object"==typeof l&&!0===l.visible,H=YC.useMemo(()=>"object"==typeof i?.export?i.export:{},[i?.export]),W="object"==typeof i?.copyConfig?i.copyConfig.format:"json",q=YC.useCallback(async e=>{C.current&&await tC(C.current,{...H,...e})},[H]),Y=YC.useCallback(()=>{A.current&&(document.fullscreenElement?document.exitFullscreen().catch(()=>{}):A.current.requestFullscreen().catch(()=>{}))},[]),G=YC.useCallback(async e=>{s&&await IC({...s,version:s.version??"1",createdAt:s.createdAt??(new Date).toISOString()},e||W||"json")},[s,W]);YC.useEffect(()=>{const e=()=>{_(!!document.fullscreenElement)};return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[]),YC.useImperativeHandle(S,()=>({export:q,toggleFullscreen:Y,copyConfig:G,element:A.current}),[q,Y,G]);const V=!0===v?{}:v&&"object"==typeof v?v:null,X=!!v,U=V?.breakpoint??480,K=void 0===V?.chartMode?"mobile":V.chartMode,Q=V?.semantics,Z=V?.mobileInteraction??(!!X||void 0),J=V?.standardControls,ee=p_(J)?J:null,te=ee?.controls??(p_(J)?void 0:J)??function(e){return e&&"object"==typeof e?e.standardControls:void 0}(Z),oe=YC.useMemo(()=>function(e,t){return y_(t)?e&&"object"==typeof e?{...e,standardControls:t}:!1===e||null==e?e:{standardControls:t}:e}(Z,te),[Z,te]),ne=X&&y_(te)?(0,b_.jsx)(ZM,{controls:te,targetSize:ee?.targetSize??g_(Z)??44,compact:ee?.compact??!0,className:ee?.className,style:ee?.style,ariaLabel:ee?.ariaLabel,brush:ee?.brush,zoom:ee?.zoom,legend:ee?.legend}):null,re=V?.summary,ie=!0===V?.allowHorizontalScroll,se=!0===V?.hideToolbar,ae=YC.useMemo(()=>{if(!x||!s?.component||!s?.props)return null;const e="object"==typeof x?x:{},t=s.props;try{return d_(s.component,{...t,mobileSemantics:t.mobileSemantics??Q,mobileInteraction:t.mobileInteraction??oe},{viewportWidth:e.viewportWidth??390,targetSize:e.targetSize??44,inChartContainer:!0})}catch{return null}},[x,s,Q,oe]);YC.useEffect(()=>{if(!ae||ae.ok)return;const e=ae.findings.filter(e=>"pass"!==e.status).slice(0,5);console.warn(`[Semiotic mobile audit] ${s?.component}: ${ae.summary.highRisk} high-risk mobile finding(s), ${ae.summary.warnings} warning(s).`,e)},[ae,s?.component]);const le=ae&&!ae.ok&&"object"==typeof x&&!0===x.visible?(0,b_.jsxs)("div",{className:"semiotic-chart-mobile-audit",role:"status",style:{padding:"8px 12px",fontSize:12,lineHeight:1.45,color:"var(--semiotic-warning, #6b3f00)",background:"color-mix(in srgb, var(--semiotic-warning, #d97706) 14%, var(--semiotic-bg, #fff))",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},children:["Mobile audit: ",ae.summary.highRisk," high-risk finding",1===ae.summary.highRisk?"":"s"," and"," ",ae.summary.warnings," warning",1===ae.summary.warnings?"":"s"," at"," ",("object"==typeof x?x.viewportWidth:void 0)??390,"px."]}):null,ce=T.length>0,ue=e||t||c||$||N||D||E||y||ce,de=YC.useMemo(()=>{if(!X||!YC.isValidElement(o))return o;if(!function(e){const t=e.type;return"function"==typeof t||"object"==typeof t&&null!==t}(o))return o;const e=o.props,t={};return K&&null==e.mode&&(t.mode=K),Q&&null==e.mobileSemantics&&(t.mobileSemantics=Q),void 0!==oe&&null==e.mobileInteraction&&(t.mobileInteraction=oe),Object.keys(t).length>0?YC.cloneElement(o,t):o},[o,X,K,Q,oe]),he=m?(0,b_.jsx)(__,{height:r}):p?(0,b_.jsx)(P_,{error:p}):g?(0,b_.jsx)(up,{children:de}):de;return fe=(0,b_.jsxs)(b_.Fragment,{children:[(0,b_.jsx)("style",{dangerouslySetInnerHTML:{__html:`@keyframes semiotic-skeleton-pulse {\n 0% { background-position: 200% 0; }\n 100% { background-position: -200% 0; }\n}\n@media (max-width: ${U}px) {\n .semiotic-chart-container[data-semiotic-mobile="true"] .semiotic-chart-header {\n padding: 10px 12px !important;\n gap: 10px !important;\n }\n .semiotic-chart-container[data-semiotic-mobile="true"] .semiotic-chart-title-area {\n flex-basis: 100% !important;\n }\n .semiotic-chart-container[data-semiotic-mobile="true"] .semiotic-chart-toolbar {\n width: 100% !important;\n margin-left: 0 !important;\n justify-content: flex-start !important;\n overflow-x: auto !important;\n -webkit-overflow-scrolling: touch;\n }\n .semiotic-chart-container[data-semiotic-mobile="true"][data-semiotic-mobile-hide-toolbar="true"] .semiotic-chart-toolbar {\n display: none !important;\n }\n .semiotic-chart-container[data-semiotic-mobile="true"] .semiotic-chart-action {\n min-width: 32px !important;\n min-height: 32px !important;\n }\n .semiotic-chart-container[data-semiotic-mobile="true"] .semiotic-chart-mobile-summary {\n display: block !important;\n }\n .semiotic-chart-container[data-semiotic-mobile="true"] .semiotic-chart-mobile-standard-controls {\n display: block !important;\n }\n .semiotic-chart-container[data-semiotic-mobile="true"][data-semiotic-mobile-scroll="true"] .semiotic-chart-body {\n overflow-x: auto !important;\n justify-content: flex-start !important;\n -webkit-overflow-scrolling: touch;\n }\n}`}}),(0,b_.jsxs)("div",{ref:A,className:"semiotic-chart-container"+(k?" "+k:""),"data-semiotic-mobile":X?"true":void 0,"data-semiotic-mobile-scroll":ie?"true":void 0,"data-semiotic-mobile-hide-toolbar":se?"true":void 0,style:{width:n,border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:"var(--semiotic-border-radius, 8px)",overflow:"hidden",background:"var(--semiotic-bg, #fff)",fontFamily:"var(--semiotic-font-family, sans-serif)",position:"relative",...M?{display:"flex",flexDirection:"column",width:"100%",height:"100%"}:{},...w},children:[ue&&(0,b_.jsxs)("div",{className:"semiotic-chart-header",style:{padding:"12px 16px",display:"flex",justifyContent:"space-between",alignItems:"flex-start",flexWrap:"wrap",gap:8,borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},children:[(0,b_.jsxs)("div",{className:"semiotic-chart-title-area",style:{minWidth:0,flex:"1 1 200px"},children:[e&&(0,b_.jsx)("div",{className:"semiotic-chart-title",style:{fontSize:14,fontWeight:600,color:"var(--semiotic-text, #333)"},children:e}),t&&(0,b_.jsx)("div",{className:"semiotic-chart-subtitle",style:{fontSize:12,color:"var(--semiotic-text-secondary, #666)",marginTop:e?2:0},children:t})]}),(0,b_.jsxs)("div",{className:"semiotic-chart-toolbar",style:{display:"flex",alignItems:"center",gap:4,marginLeft:"auto"},children:[c,ce&&(0,b_.jsx)(C_,{visible:T,onDismiss:I}),$&&(0,b_.jsx)("button",{className:"semiotic-chart-action",onClick:()=>q(),title:"Export chart","aria-label":"Export chart",style:j_,children:(0,b_.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,b_.jsx)("path",{d:"M7 2v8M3.5 7L7 10.5 10.5 7"}),(0,b_.jsx)("path",{d:"M2 12h10"})]})}),E&&(0,b_.jsx)(x_,{}),N&&(0,b_.jsx)("button",{className:"semiotic-chart-action",onClick:Y,title:M?"Exit fullscreen":"Fullscreen","aria-label":M?"Exit fullscreen":"Enter fullscreen",style:j_,children:(0,b_.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,b_.jsxs)(b_.Fragment,M?{children:[(0,b_.jsx)("path",{d:"M9 1v4h4"}),(0,b_.jsx)("path",{d:"M5 13V9H1"}),(0,b_.jsx)("path",{d:"M13 5H9V1"}),(0,b_.jsx)("path",{d:"M1 9h4v4"})]}:{children:[(0,b_.jsx)("path",{d:"M1 5V1h4"}),(0,b_.jsx)("path",{d:"M13 9v4H9"}),(0,b_.jsx)("path",{d:"M9 1h4v4"}),(0,b_.jsx)("path",{d:"M5 13H1V9"})]})})}),D&&(0,b_.jsx)("button",{className:"semiotic-chart-action",onClick:()=>G(),title:"Copy config","aria-label":"Copy chart configuration",style:j_,children:(0,b_.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,b_.jsx)("rect",{x:"5",y:"5",width:"8",height:"8",rx:"1"}),(0,b_.jsx)("path",{d:"M9 5V2a1 1 0 00-1-1H2a1 1 0 00-1 1v6a1 1 0 001 1h3"})]})}),y&&(0,b_.jsx)("div",{className:"semiotic-chart-status","aria-live":"polite","aria-atomic":"true",style:{padding:"2px 8px",borderRadius:4,fontSize:10,fontWeight:700,letterSpacing:"0.05em",textTransform:"uppercase",background:M_[y].bg,color:M_[y].color,lineHeight:"18px"},children:y})]})]}),u&&(0,b_.jsx)("div",{className:"semiotic-chart-banner",children:u}),le,re&&(0,b_.jsx)("div",{className:"semiotic-chart-mobile-summary",style:{display:"none",padding:"8px 12px",fontSize:12,lineHeight:1.45,color:"var(--semiotic-text-secondary, #666)",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},children:re}),ne&&(0,b_.jsx)("div",{className:"semiotic-chart-mobile-standard-controls",style:{display:"none",padding:"10px 12px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)",background:"var(--semiotic-surface, var(--semiotic-bg, #f6f8fa))"},children:ne}),O&&(0,b_.jsx)("div",{className:"semiotic-chart-description",role:"note",style:B?{padding:"8px 16px",fontSize:12,lineHeight:1.5,color:"var(--semiotic-text-secondary, #666)",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"}:v_,children:O}),F&&(0,b_.jsx)("div",{className:"semiotic-chart-nav",style:z?{padding:"8px 8px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)",maxHeight:240,overflow:"auto"}:void 0,children:(0,b_.jsx)(BM,{tree:F,label:"string"==typeof e&&e?e+" — navigable structure":"Chart navigable structure",visible:z,chartId:"string"==typeof s?.props?.chartId?s.props.chartId:void 0})}),(0,b_.jsxs)("div",{className:"semiotic-chart-body",ref:C,style:{position:"relative",overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center",...M?{flex:1}:{height:r}},children:[he,b]})]})]}),E?(0,b_.jsx)(ql,{children:fe}):fe;var fe}),j_={width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",cursor:"pointer",borderRadius:4,color:"var(--semiotic-text-secondary, #666)",padding:0},L_=d(require("react")),T_=require("react/jsx-runtime");function I_({children:e,controls:t,mobile:o,breakpoint:n=480,chartMode:r="mobile",mobileInteraction:i=!0,mobileSemantics:s,mobileSummary:a,chips:l=[],activeChip:c,onChipChange:u,detail:d,detailTitle:h="Details",detailMode:f="sheet",initialDetailOpen:m=!1,allowHorizontalScroll:p=!1,hideToolbar:g=!1,chartDefaults:y,...b}){const[v,x]=L_.useState(()=>c??l.find(e=>!e.disabled)?.id),[k,w]=L_.useState(m);L_.useEffect(()=>{void 0===c&&(l.length?l.some(e=>e.id===v&&!e.disabled)||x(l.find(e=>!e.disabled)?.id):x(void 0))},[c,l,v]);const S=c??v,A=L_.useCallback(e=>{e.disabled||(void 0===c&&x(e.id),u?.(e))},[c,u]),C=l.length?(0,T_.jsx)("div",{className:"semiotic-mobile-chip-row",role:"list","aria-label":"Mobile chart controls",children:l.map(e=>(0,T_.jsxs)("button",{type:"button",className:"semiotic-mobile-chip","aria-pressed":e.id===S,disabled:e.disabled,onClick:()=>A(e),title:"string"==typeof e.description?e.description:void 0,children:[(0,T_.jsx)("span",{children:e.label}),e.description&&(0,T_.jsx)("small",{className:"semiotic-mobile-chip-description",children:e.description})]},e.id))}):null,M=a||C?(0,T_.jsxs)("div",{className:"semiotic-mobile-summary-card",children:[a&&(0,T_.jsx)("div",{className:"semiotic-mobile-summary-copy",children:a}),C]}):o?.summary,_={breakpoint:n,chartMode:r,mobileInteraction:i,semantics:s,allowHorizontalScroll:p,hideToolbar:g,...o,summary:M},P=L_.useMemo(()=>{if(!y||!L_.isValidElement(e))return e;const t=e.props,o={};for(const[e,n]of Object.entries(y))null==t[e]&&(o[e]=n);return Object.keys(o).length>0?L_.cloneElement(e,o):e},[e,y]),R=!!d&&"sheet"===f,j=!!d&&"inline"===f||R&&k,L=R?(0,T_.jsx)("button",{type:"button",className:"semiotic-mobile-detail-toggle","aria-expanded":k,onClick:()=>w(e=>!e),children:k?"Hide details":"Show details"}):null,T=t||L?(0,T_.jsxs)("div",{className:"semiotic-mobile-control-stack",children:[t,L]}):void 0;return(0,T_.jsxs)("div",{className:"semiotic-mobile-chart-shell",children:[(0,T_.jsx)("style",{children:`\n .semiotic-mobile-chart-shell {\n display: grid;\n gap: 10px;\n width: 100%;\n }\n .semiotic-mobile-summary-card {\n display: grid;\n gap: 10px;\n }\n .semiotic-mobile-summary-copy {\n font-size: 13px;\n line-height: 1.45;\n }\n .semiotic-mobile-chip-row {\n display: flex;\n gap: 8px;\n overflow-x: auto;\n padding-bottom: 2px;\n -webkit-overflow-scrolling: touch;\n }\n .semiotic-mobile-chip {\n display: inline-flex;\n flex: 0 0 auto;\n flex-direction: column;\n align-items: flex-start;\n justify-content: center;\n min-height: 40px;\n min-width: 44px;\n border: 1px solid var(--semiotic-border, #d8d8d8);\n border-radius: 999px;\n padding: 7px 12px;\n background: var(--semiotic-bg, #fff);\n color: var(--semiotic-text, #222);\n font: inherit;\n font-size: 12px;\n font-weight: 700;\n cursor: pointer;\n }\n .semiotic-mobile-chip[aria-pressed="true"] {\n border-color: var(--semiotic-primary, #1f7a6d);\n background: color-mix(in srgb, var(--semiotic-primary, #1f7a6d) 14%, transparent);\n }\n .semiotic-mobile-chip:disabled {\n cursor: not-allowed;\n opacity: 0.45;\n }\n .semiotic-mobile-chip-description {\n display: block;\n max-width: 160px;\n margin-top: 2px;\n color: var(--semiotic-text-secondary, #666);\n font-size: 10px;\n font-weight: 500;\n line-height: 1.2;\n }\n .semiotic-mobile-control-stack {\n display: inline-flex;\n align-items: center;\n gap: 8px;\n flex-wrap: wrap;\n }\n .semiotic-mobile-detail-toggle {\n min-height: 32px;\n border: 1px solid var(--semiotic-border, #d8d8d8);\n border-radius: 999px;\n padding: 5px 10px;\n background: transparent;\n color: var(--semiotic-text, #222);\n font: inherit;\n font-size: 12px;\n font-weight: 700;\n cursor: pointer;\n }\n .semiotic-mobile-detail-panel {\n border: 1px solid var(--semiotic-border, #d8d8d8);\n border-radius: 16px;\n background: var(--semiotic-bg, #fff);\n color: var(--semiotic-text, #222);\n box-shadow: 0 18px 48px rgba(0, 0, 0, 0.16);\n overflow: hidden;\n }\n .semiotic-mobile-detail-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 12px;\n padding: 10px 12px;\n border-bottom: 1px solid var(--semiotic-border, #d8d8d8);\n font-size: 13px;\n font-weight: 800;\n }\n .semiotic-mobile-detail-body {\n padding: 12px;\n font-size: 13px;\n line-height: 1.5;\n }\n @media (max-width: ${n}px) {\n .semiotic-mobile-detail-panel[data-mode="sheet"] {\n position: sticky;\n bottom: 8px;\n z-index: 2;\n max-height: min(55vh, 420px);\n overflow: auto;\n }\n }\n `}),(0,T_.jsx)(R_,{...b,controls:T,mobile:_,children:P}),j&&(0,T_.jsxs)("section",{className:"semiotic-mobile-detail-panel","data-mode":f,"aria-label":"string"==typeof h?h:"Chart details",children:[(0,T_.jsxs)("div",{className:"semiotic-mobile-detail-header",children:[(0,T_.jsx)("span",{children:h}),R&&(0,T_.jsx)("button",{type:"button",className:"semiotic-mobile-detail-toggle",onClick:()=>w(!1),children:"Close"})]}),(0,T_.jsx)("div",{className:"semiotic-mobile-detail-body",children:d})]})]})}var $_=d(require("react")),N_=require("react/jsx-runtime");function D_(e,t){if(t)return"function"==typeof t?t(e):e?.[t]}function E_(e,t){const o="function"==typeof t?t(e):e[t];return Array.isArray(o)?o:[]}function O_(e){return{strategy:"small-multiples",responsive:!0,supportsResponsiveLayout:!0,summary:`${e} vertically stacked small multiple panel${1===e?"":"s"} with shared scale guidance.`,interaction:{primary:"tap",alternatives:["panel summary","linked selection"],hoverFallback:"tap-to-lock",targetSize:44},labels:{strategy:"external",minFontSize:12}}}function B_(e,t){if(!$_.isValidElement(e))return e;const o=e.props,n={};for(const[e,r]of Object.entries(t))void 0!==r&&null==o[e]&&(n[e]=r);return Object.keys(n).length>0?$_.cloneElement(e,n):e}function F_({items:e,children:t,columns:o=3,tabletColumns:n=2,mobileColumns:r=1,mobileBreakpoint:i=480,tabletBreakpoint:s=860,gap:a=12,mode:l="mobile",chartHeight:c=220,sharedExtent:u=!0,valueAccessor:d,dataAccessor:h="data",extentProps:f=["yExtent","valueExtent"],linkedHover:m,selection:p,linkedBy:g,linkProvider:y="auto",selections:b,showLegend:v=!1,legendPosition:x,legendInteraction:k,legendSelectionName:w,legendField:S,mobileInteraction:A=!0,mobileSemantics:C,labelMode:M="panel",chartDefaults:_,className:P,style:R}){const j=uy(),L=e||"function"==typeof t?[]:$_.Children.toArray(t),T=e??L.map((e,t)=>({id:"panel-"+(t+1)})),I=T.length,$=$_.useMemo(()=>function(e,t,o,n){if(t&&"object"==typeof t)return t;if(!1===t)return{};const r=[],i=[];for(const t of e)if(t.extent&&r.push(t.extent[0],t.extent[1]),n)for(const e of E_(t,o))i.push(D_(e,n));const s=function(e){let t=1/0,o=-1/0;for(const n of e){const e=Number(n);Number.isFinite(e)&&(t>e&&(t=e),e>o&&(o=e))}if(Number.isFinite(t)&&Number.isFinite(o))return t===o?[t-1,o+1]:[t,o]}(i.length?i:r);return s?{yExtent:s,valueExtent:s}:{}}(T,u,h,d),[T,u,h,d]),N=$_.useMemo(()=>{if(!g)return{name:void 0,fields:void 0,linkedHover:m,selection:p};const e=Array.isArray(g)?"small-multiples":g.name||"small-multiples",t=Array.isArray(g)?g:g.fields||[];return{name:e,fields:t,linkedHover:m??{name:e,fields:t},selection:p??{name:e}}},[g,m,p]),D=$_.useMemo(()=>({linkedHover:N.linkedHover,selection:N.selection}),[N.linkedHover,N.selection]),E=$_.useMemo(()=>{const e={mode:l,height:c,responsiveWidth:!0,mobileInteraction:A,mobileSemantics:C??O_(I),...D,..._};"legend"!==M&&(e.showLegend=!1),"direct"===M&&(e.directLabel=!0);for(const t of f)t in $&&(e[t]=$[t]);return e},[l,c,A,C,I,D,_,M,f,$]),O=(0,N_.jsxs)("section",{className:["semiotic-small-multiple-chart",P].filter(Boolean).join(" "),style:R,"data-semiotic-small-multiple":"true",children:[(0,N_.jsx)("style",{children:`\n .semiotic-small-multiple-chart {\n --semiotic-small-multiple-columns: ${o};\n --semiotic-small-multiple-gap: ${a}px;\n display: grid;\n grid-template-columns: repeat(var(--semiotic-small-multiple-columns), minmax(0, 1fr));\n gap: var(--semiotic-small-multiple-gap);\n width: 100%;\n }\n .semiotic-small-multiple-panel {\n min-width: 0;\n border: 1px solid var(--semiotic-border, #d8d8d8);\n border-radius: 16px;\n background: var(--semiotic-bg, #fff);\n overflow: hidden;\n }\n .semiotic-small-multiple-heading {\n display: grid;\n gap: 3px;\n padding: 10px 12px 0;\n }\n .semiotic-small-multiple-title {\n margin: 0;\n color: var(--semiotic-text, #222);\n font-size: 13px;\n font-weight: 800;\n line-height: 1.25;\n }\n .semiotic-small-multiple-subtitle,\n .semiotic-small-multiple-summary {\n margin: 0;\n color: var(--semiotic-text-secondary, #666);\n font-size: 11px;\n line-height: 1.35;\n }\n .semiotic-small-multiple-plot {\n min-width: 0;\n padding: 4px 6px 8px;\n overflow: hidden;\n }\n @media (max-width: ${s}px) {\n .semiotic-small-multiple-chart {\n --semiotic-small-multiple-columns: ${n};\n }\n }\n @media (max-width: ${i}px) {\n .semiotic-small-multiple-chart {\n --semiotic-small-multiple-columns: ${r};\n }\n .semiotic-small-multiple-panel {\n border-radius: 14px;\n }\n .semiotic-small-multiple-heading {\n padding: 9px 10px 0;\n }\n }\n `}),T.map((e,o)=>{const n={...E},r="function"==typeof t?t(e,{item:e,index:o,count:I,chartProps:n,sharedExtent:$}):L[o];return(0,N_.jsxs)("article",{className:"semiotic-small-multiple-panel","aria-label":"string"==typeof e.title?e.title:void 0,children:[(e.title||e.subtitle||e.summary)&&(0,N_.jsxs)("header",{className:"semiotic-small-multiple-heading",children:[e.title&&(0,N_.jsx)("h3",{className:"semiotic-small-multiple-title",children:e.title}),e.subtitle&&(0,N_.jsx)("p",{className:"semiotic-small-multiple-subtitle",children:e.subtitle}),e.summary&&(0,N_.jsx)("p",{className:"semiotic-small-multiple-summary",children:e.summary})]}),(0,N_.jsx)("div",{className:"semiotic-small-multiple-plot",children:B_(r,n)})]},e.id??o)})]});return!0===y||"auto"===y&&(g||m||p||b||!0===v)&&!j?(0,N_.jsx)(vy,{selections:b,showLegend:v,legendPosition:x,legendInteraction:k,legendSelectionName:w??N.name??"small-multiples",legendField:S??N.fields?.[0]??"category",children:O}):O}var z_=d(require("react")),H_=require("react/jsx-runtime");function W_({children:e,columns:t="auto",minCellWidth:o=300,gap:n=16,tabletColumns:r,mobileColumns:i=1,mobileBreakpoint:s=480,tabletBreakpoint:a=860,chartDefaults:l,className:c,style:u}){const d="semiotic-chart-grid-"+z_.useId().replace(/[^a-zA-Z0-9_-]/g,""),h="number"==typeof t?t:void 0,f="auto"===t?`repeat(auto-fill, minmax(${o}px, 1fr))`:`repeat(${t}, 1fr)`,m=["semiotic-chart-grid",d,c].filter(Boolean).join(" ");return(0,H_.jsxs)(H_.Fragment,{children:[(0,H_.jsx)("style",{children:`\n ${r?`\n @media (max-width: ${a}px) {\n .${d} {\n grid-template-columns: repeat(${r}, minmax(0, 1fr)) !important;\n }\n }`:""}\n @media (max-width: ${s}px) {\n .${d} {\n grid-template-columns: repeat(${i}, minmax(0, 1fr)) !important;\n }\n .${d} > [data-semiotic-chart-grid-primary="true"] {\n grid-column: span ${i} !important;\n }\n }\n `}),(0,H_.jsx)("div",{className:m,style:{display:"grid",gridTemplateColumns:f,gap:n,width:"100%",...u},children:z_.Children.map(e,e=>{if(!z_.isValidElement(e))return e;const t=e.props,o={};if(l)for(const[e,n]of Object.entries(l))null==t[e]&&(o[e]=n);const n=Object.keys(o).length>0?z_.cloneElement(e,o):e;return"primary"!==e.props.emphasis||void 0!==h&&2>h?n:(0,H_.jsx)("div",{"data-semiotic-chart-grid-primary":"true",style:{gridColumn:"span 2",minWidth:0},children:n})})})]})}W_.displayName="ChartGrid";var q_=d(require("react")),Y_=require("react/jsx-runtime");function G_({children:e,context:t,position:o="right",contextSize:n=250,mobilePosition:r="bottom",mobileBreakpoint:i=480,gap:s=12,className:a,style:l}){const c="semiotic-context-layout-"+q_.useId().replace(/[^a-zA-Z0-9_-]/g,""),u="left"===o||"right"===o,d="left"===o||"top"===o,h={display:"flex",flexDirection:u?d?"row-reverse":"row":d?"column-reverse":"column",gap:s,width:"100%",...l},f=u?{flex:`0 0 ${n}px`,width:n,minHeight:0}:{flex:`0 0 ${n}px`,height:n,minWidth:0};return(0,Y_.jsxs)(Y_.Fragment,{children:[(0,Y_.jsx)("style",{children:`\n @media (max-width: ${i}px) {\n .${c}[data-mobile-position="bottom"] {\n flex-direction: column !important;\n }\n .${c}[data-mobile-position="top"] {\n flex-direction: column-reverse !important;\n }\n .${c}[data-mobile-position="bottom"] > .semiotic-context-panel,\n .${c}[data-mobile-position="top"] > .semiotic-context-panel {\n flex: 0 0 auto !important;\n width: 100% !important;\n height: auto !important;\n }\n }\n `}),(0,Y_.jsxs)("div",{className:["semiotic-context-layout",c,a].filter(Boolean).join(" "),"data-mobile-position":r,style:h,children:[(0,Y_.jsx)("div",{className:"semiotic-context-primary",style:{flex:"1 1 0%",minWidth:0,minHeight:0},children:e}),(0,Y_.jsx)("div",{className:"semiotic-context-panel",style:f,children:t})]})]})}G_.displayName="ContextLayout";var V_=require("react"),X_=2*Math.PI;function U_(e,t,o){const n=o?.center?.x??0,r=o?.center?.y??0;return{x:n+Math.sin(e)*t,y:r-Math.cos(e)*t}}function K_(e,t,o,n,r){const i=r?.center,s=(e,t)=>{const{x:o,y:n}=U_(e,t,{center:i});return`${Q_(o)},${Q_(n)}`},a=Math.max(0,o),l=Math.max(a,n),c=Math.abs(t-e),u=e>t?0:1;if(c>=X_-1e-6){const e=i?.x??0,t=i?.y??0,o=`${Q_(e)},${Q_(t-l)}`,n=`${Q_(e)},${Q_(t+l)}`;let r=`M${o} A${Q_(l)},${Q_(l)} 0 1 1 ${n} A${Q_(l)},${Q_(l)} 0 1 1 ${o} Z`;if(a>0){const o=`${Q_(e)},${Q_(t-a)}`,n=`${Q_(e)},${Q_(t+a)}`;r+=` M${o} A${Q_(a)},${Q_(a)} 0 1 0 ${n} A${Q_(a)},${Q_(a)} 0 1 0 ${o} Z`}return r}const d=c>Math.PI?1:0,h=s(e,l),f=s(t,l);if(0>=a){const e=i?.x??0,t=i?.y??0;return`M${Q_(e)},${Q_(t)} L${h} A${Q_(l)},${Q_(l)} 0 ${d} ${u} ${f} Z`}const m=s(t,a),p=s(e,a);return`M${h} A${Q_(l)},${Q_(l)} 0 ${d} ${u} ${f} L${m} A${Q_(a)},${Q_(a)} 0 ${d} ${1===u?0:1} ${p} Z`}function Q_(e){return Math.round(1e3*e)/1e3}function Z_(e,t,o=0){return t>0?((e-o)%t+t)%t+o:e}var J_=require("react/jsx-runtime");function eP({value:e,onChange:t,period:o=365,radius:n=180,innerRadius:r=14,width:i,height:s,step:a=1,largeStep:l=7,label:c="Range",formatValue:u,arcFill:d="var(--semiotic-primary, #4e79a7)",stroke:h="var(--semiotic-bg, #ffffff)",className:f,style:m}){const p=i??2*n+40,g=s??2*n+40,y=p/2,b=g/2,v=function(e){const[t,o]=e,n=o-t||1,r=X_;return e=>0+(e-t)/n*(r-0)}([0,o]),x=(0,V_.useRef)(null),k=e=>{const t=e.currentTarget.ownerSVGElement??e.currentTarget,n=t.getBoundingClientRect(),r=t.viewBox?.baseVal;return Math.round((Math.atan2((r?.width||p)/(n.width||1)*(e.clientX-n.left)-y-0,-((r?.height||g)/(n.height||1)*(e.clientY-n.top)-b-0))+X_)%X_/X_*o)%o},w=(e,t)=>{e.preventDefault(),e.stopPropagation();const o=e.currentTarget.ownerSVGElement;o?.setPointerCapture?.(e.pointerId),x.current={mode:t,lastValue:k(e)}},S=e=>{const t=e.currentTarget.ownerSVGElement??e.currentTarget;t?.hasPointerCapture?.(e.pointerId)&&t.releasePointerCapture(e.pointerId),x.current=null},A=(e,n)=>{t("range"===e?e=>({start:Z_(e.start+n,o),end:Z_(e.end+n,o)}):t=>({...t,[e]:Z_(t[e]+n,o)}))},C=e=>t=>{const o=t.shiftKey?l:a;"ArrowRight"===t.key||"ArrowUp"===t.key?(t.preventDefault(),A(e,o)):"ArrowLeft"!==t.key&&"ArrowDown"!==t.key||(t.preventDefault(),A(e,-o))},M=e.start>e.end?[[e.start,o],[0,e.end]]:[[e.start,e.end]],_=e=>u?u(e):e+"";return(0,J_.jsx)("svg",{viewBox:`0 0 ${p} ${g}`,width:p,height:g,className:f,onPointerMove:e=>{const n=x.current;if(!n)return;const r=k(e);if("range"===n.mode){const e=function(e,t,o){if(0>=o)return t-e;let n=(t-e)%o;return n>o/2?n-=o:-o/2>n&&(n+=o),n}(n.lastValue,r,o);if(0===e)return;return n.lastValue=r,void t(t=>({start:Z_(t.start+e,o),end:Z_(t.end+e,o)}))}t(e=>({...e,[n.mode]:r}))},onPointerUp:S,onPointerCancel:S,onLostPointerCapture:S,style:{touchAction:"none",...m},"aria-label":c+" brush",children:(0,J_.jsxs)("g",{transform:`translate(${y},${b})`,children:[(0,J_.jsx)("g",{role:"slider",tabIndex:0,"aria-label":c+" (move both ends)","aria-valuemin":0,"aria-valuemax":o-1,"aria-valuenow":e.start,"aria-valuetext":`${_(e.start)} to ${_(e.end)}`,onPointerDown:e=>w(e,"range"),onKeyDown:C("range"),style:{cursor:"grab"},children:M.map(([e,t],o)=>(0,J_.jsx)("path",{d:K_(v(e),v(t),r,n),fill:d,fillOpacity:.35,stroke:h,strokeWidth:1},o))}),["start","end"].map(t=>{const i=e[t],s=(e=>U_(v(e),r))(i),a=(e=>U_(v(e),n+8))(i);return(0,J_.jsxs)("g",{role:"slider",tabIndex:0,"aria-label":`${c} ${t}`,"aria-valuemin":0,"aria-valuemax":o-1,"aria-valuenow":i,"aria-valuetext":_(i),onPointerDown:e=>w(e,t),onKeyDown:C(t),style:{cursor:"grab"},children:[(0,J_.jsx)("line",{x1:s.x,y1:s.y,x2:a.x,y2:a.y,stroke:"transparent",strokeWidth:20}),(0,J_.jsx)("line",{x1:s.x,y1:s.y,x2:a.x,y2:a.y,stroke:h,strokeWidth:1.5}),(0,J_.jsx)("circle",{cx:a.x,cy:a.y,r:4.5,fill:h,stroke:d,strokeWidth:1})]},t)})]})})}var tP=d(require("react")),oP=require("react"),nP=require("react/jsx-runtime");function rP(e,t,o,n){return Math.min(o,Math.max(t,Number((t+Math.round((Math.min(o,Math.max(t,e))-t)/n)*n).toFixed(12))))}function iP({value:e,onChange:t,pointerToValue:o,min:n,max:r,step:i=1,largeStep:s=5*i,x:a,y:l,controlType:c="value",controlId:u,label:d,valueText:h,radius:f=12,fill:m="var(--semiotic-bg, #ffffff)",stroke:p="var(--semiotic-primary, #4e79a7)",strokeWidth:g=4,labelText:y,labelDx:b=16,labelDy:v=-16,labelClassName:x,className:k,disabled:w=!1,onChangeStart:S,onChangeEnd:A,onObservation:C,chartId:M,chartType:_}){const P=(0,oP.useRef)(null),R=(0,oP.useRef)(e);R.current=e;const j=tP.useMemo(()=>lC({controlType:c,controlId:u,chartId:M,chartType:_,onObservation:C}),[M,_,u,c,C]),L=e=>{if(w)return;const s=o(e);if(null==s||!Number.isFinite(s))return;const a=rP(s,n,r,i);R.current=a,t(a),j("control-change",a,"pointer")},T=e=>{e.stopPropagation(),P.current===e.pointerId&&(e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture?.(e.pointerId),P.current=null,A?.(R.current),j("control-end",R.current,"pointer"))},I=["semiotic-direct-manipulation-control",k].filter(Boolean).join(" ");return(0,nP.jsxs)("g",{className:I,role:"slider",tabIndex:w?-1:0,"aria-disabled":w||void 0,"aria-label":d,"aria-valuemin":n,"aria-valuemax":r,"aria-valuenow":e,"aria-valuetext":h??`${d}: ${e}`,"aria-roledescription":"visualization control","data-viz-control":c,"data-viz-control-id":u,"data-viz-control-state":"controlled",pointerEvents:"all",onPointerDown:e=>{w||(e.preventDefault(),e.stopPropagation(),e.currentTarget.setPointerCapture?.(e.pointerId),P.current=e.pointerId,S?.(R.current),j("control-start",R.current,"pointer"),L(e))},onPointerMove:e=>{e.stopPropagation(),P.current===e.pointerId&&L(e)},onPointerUp:T,onPointerCancel:T,onLostPointerCapture:T,onKeyDown:e=>{if(w)return;const o=e.shiftKey?s:i,a=R.current;let l=null;if("ArrowLeft"!==e.key&&"ArrowDown"!==e.key||(l=a-o),"ArrowRight"!==e.key&&"ArrowUp"!==e.key||(l=a+o),"Home"===e.key&&(l=n),"End"===e.key&&(l=r),null===l)return;e.preventDefault();const c=rP(l,n,r,i);R.current=c,t(c),j("control-change",c,"keyboard")},style:{cursor:w?"default":"grab",touchAction:"none"},children:[(0,nP.jsx)("circle",{className:"semiotic-direct-manipulation-control__hit",cx:a,cy:l,r:f+10,fill:"transparent"}),(0,nP.jsx)("circle",{className:"semiotic-direct-manipulation-control__handle",cx:a,cy:l,r:f,fill:m,stroke:p,strokeWidth:g}),y?(0,nP.jsx)("text",{className:x,x:a+b,y:l+v,fill:p,children:y}):null]})}var sP=require("react"),aP=require("react/jsx-runtime"),lP=200;function cP({children:e,position:t="right",size:o=300,trigger:n="click",chartId:r,observation:i,dismissOnEmpty:s=!0,showClose:a=!0,onToggle:l,className:c,style:u}){const[d,h]=(0,sP.useState)(null),[f,m]=(0,sP.useState)(null),[p,g]=(0,sP.useState)(!1),[y,b]=(0,sP.useState)(!1),v=(0,sP.useRef)(null),x=(0,sP.useRef)(void 0),k="click"===n?["click","click-end"]:["hover","hover-end"],{latest:w}=sy({types:k,chartId:r,limit:1}),S=void 0!==i?i:w,A=(0,sP.useCallback)(()=>{b(!0),g(!1),clearTimeout(x.current),x.current=setTimeout(()=>{b(!1),h(null),m(null)},lP)},[]);if((0,sP.useEffect)(()=>{if(S)if("click"===S.type||"hover"===S.type){const e=S;h(e.datum),m(e),g(e=>(e||(b(!0),clearTimeout(x.current),x.current=setTimeout(()=>b(!1),lP)),!0))}else!s||"click-end"!==S.type&&"hover-end"!==S.type||A()},[s,A,S]),(0,sP.useEffect)(()=>{l?.(p)},[p,l]),(0,sP.useEffect)(()=>()=>clearTimeout(x.current),[]),!d&&!y)return null;const C=d&&f?e(d,f):null;if(null===C&&!y)return null;const M=function(e,t,o,n){const r={position:"absolute",background:"var(--semiotic-bg, #fff)",borderColor:"var(--semiotic-border, #e0e0e0)",borderStyle:"solid",borderWidth:0,boxSizing:"border-box",zIndex:10,display:"flex",flexDirection:"column",transition:n?`transform ${lP}ms ease-out, opacity ${lP}ms ease-out`:void 0};return"right"===e?{...r,top:0,right:0,width:t,height:"100%",borderLeftWidth:1,padding:"12px 16px",transform:o?"translateX(0)":`translateX(${t}px)`,opacity:o?1:0}:"bottom"===e?{...r,bottom:0,left:0,width:"100%",height:t,borderTopWidth:1,padding:"12px 16px",transform:o?"translateY(0)":`translateY(${t}px)`,opacity:o?1:0}:{...r,top:"50%",left:"50%",transform:o?"translate(-50%, -50%) scale(1)":"translate(-50%, -50%) scale(0.95)",opacity:o?1:0,width:Math.min(t,400),maxHeight:"80%",borderWidth:1,borderRadius:8,padding:"16px 20px",boxShadow:"0 8px 32px rgba(0,0,0,0.12)"}}(t,o,p,y);return(0,aP.jsxs)("div",{ref:v,className:`semiotic-details-panel semiotic-details-${t}${c?" "+c:""}`,style:{...M,...u},children:[a&&(0,aP.jsx)("button",{className:"semiotic-details-close",onClick:A,"aria-label":"Close details",style:uP,children:(0,aP.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",children:(0,aP.jsx)("path",{d:"M2 2l8 8M10 2l-8 8"})})}),(0,aP.jsx)("div",{className:"semiotic-details-content",style:{overflow:"auto",flex:1},children:C})]})}var uP={position:"absolute",top:8,right:8,width:20,height:20,display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",cursor:"pointer",borderRadius:4,color:"var(--semiotic-text-secondary, #666)",padding:0,zIndex:1};cP.displayName="DetailsPanel";var dP=require("react"),hP=require("d3-force"),fP=1e3;function mP(e,t,o={}){const n=o.iterations??260,r=o.repulsion??5200,i=o.linkDistance??165,s=o.linkStrength??.045,a=o.centerStrength??.018,l=o.damping??.84,c=o.nodeRadius??12,u=o.nodePadding??3,d=o.inset??.06,h=function(e){let t=e>>>0;return function(){t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}(o.seed??1),f=new Map;for(const t of e)f.set(t.id,0);for(const e of t)f.set(e.source,(f.get(e.source)??0)+1),f.set(e.target,(f.get(e.target)??0)+1);const m=fP/2,p=e.map(e=>({id:e.id,data:e,x:200+600*h(),y:200+600*h()})),g=new Set(e.map(e=>e.id)),y=t.filter(e=>g.has(e.source)&&g.has(e.target)).map(e=>({source:e.source,target:e.target}));if(n>0){const e=(0,hP.forceSimulation)(p).randomSource(h).alphaDecay(1-Math.pow(.001,1/n)).velocityDecay(Math.max(0,Math.min(1,1-l))).force("charge",(0,hP.forceManyBody)().strength(e=>{const t=f.get(e.id)??0;return 2.5*-Math.sqrt(r)*Math.sqrt(t+1)})).force("collide",(0,hP.forceCollide)(e=>(e=>"function"==typeof c?c(e.data):c)(e)+u).strength(.9).iterations(2)).force("center",(0,hP.forceCenter)(m,m).strength(.8)).force("x",(0,hP.forceX)(m).strength(a)).force("y",(0,hP.forceY)(m).strength(a));y.length>0&&e.force("link",(0,hP.forceLink)(y).id(e=>e.id).distance(i).strength(e=>{const t="string"==typeof e.target?e.target:e.target.id,o=Math.max(1,Math.min(f.get("string"==typeof e.source?e.source:e.source.id)??1,f.get(t)??1));return s/.045/o})),e.stop();for(let t=0;n>t;t+=1)e.tick()}let b=1/0,v=1/0,x=-1/0,k=-1/0;for(const e of p){const t=e.x??m,o=e.y??m;b>t&&(b=t),v>o&&(v=o),t>x&&(x=t),o>k&&(k=o)}const w=x-b,S=k-v,A={};for(const e of p)A[e.id]={x:0===w?.5:d+((e.x??m)-b)/w*(1-2*d),y:0===S?.5:d+((e.y??m)-v)/S*(1-2*d)};return A}var pP=16,gP=new WeakMap;function yP(e){const t=[];for(const o of Object.keys(e).sort()){const n=e[o];if(void 0!==n){if("function"==typeof n)return null;t.push(`${o}:${n+""}`)}}return t.join("|")}function bP(e,t,o){return null==o?null:gP.get(e)?.get(t)?.get(o)??null}function vP(e,t,o,n){if(null==o)return;let r=gP.get(e);r||(r=new WeakMap,gP.set(e,r));let i=r.get(t);if(i||(i=new Map,r.set(t,i)),!i.has(o)&&i.size>=pP){const e=i.keys().next().value;void 0!==e&&i.delete(e)}i.set(o,n)}function xP(e,t,o={}){const n=jl(),{seed:r,iterations:i,repulsion:s,linkDistance:a,linkStrength:l,centerStrength:c,damping:u,nodeRadius:d,nodePadding:h,inset:f,execution:m,workerThreshold:p}=o,g=(0,dP.useMemo)(()=>({seed:r,iterations:i,repulsion:s,linkDistance:a,linkStrength:l,centerStrength:c,damping:u,nodeRadius:d,nodePadding:h,inset:f,execution:m,workerThreshold:p}),[r,i,s,a,l,c,u,d,h,f,m,p]),y=(0,dP.useRef)(n),[b,v]=(0,dP.useState)(()=>{if("undefined"==typeof window||n){const o=mP(e,t,g);return vP(e,t,yP(g),o),{positions:o,status:"ready",error:null}}const o=bP(e,t,yP(g));return o?{positions:o,status:"ready",error:null}:{positions:null,status:"pending",error:null}});return(0,dP.useEffect)(()=>{if(y.current)return void(y.current=!1);const o=yP(g),n=bP(e,t,o);if(n)return void v(e=>"ready"===e.status&&e.positions===n?e:{positions:n,status:"ready",error:null});const r=new AbortController;return v(e=>({positions:e.positions,status:"pending",error:null})),async function(e,t,o={}){const{execution:n="auto",signal:r,workerThreshold:i,nodeRadius:s,...a}=o,l=a.iterations??260;if(!Pp()||!_p(n,e.length,t.length,l,i))return mP(e,t,{...a,nodeRadius:s});const c={kind:"normalized",nodes:e.map(e=>({...e})),edges:t.map(e=>({...e})),options:a,nodeRadii:"function"==typeof s?Object.fromEntries(e.map(e=>[e.id,s(e)])):null==s?void 0:Object.fromEntries(e.map(e=>[e.id,s]))};try{return(await Lp(c,r)).positions}catch(o){if("AbortError"===o?.name)throw o;return mP(e,t,{...a,nodeRadius:s})}}(e,t,{...g,signal:r.signal}).then(n=>{vP(e,t,o,n),v({positions:n,status:"ready",error:null})}).catch(e=>{"AbortError"!==e.name&&v(t=>({positions:t.positions,status:"error",error:e}))}),()=>r.abort()},[e,t,g]),b}var kP=d(require("react"));function wP(e){const t=e.designContract?.chartFamily??e.title??"chart",o=e.audience?.primary?" for "+e.audience.primary:"",n=e.designContract?.whyThisForm;return`${t}: ${e.intent.primary}${o}${n?". "+n:""}`}function SP(e,t){const o=e.intents.map(e=>"string"==typeof e?e:e.id??e.name).filter(e=>!!e),n=e.intents.find(e=>"string"!=typeof e&&"primary"===e.strength),r=("object"==typeof n?n.id??n.name:void 0)??o[0]??"explanation";return{ididVersion:"0.1",chartId:t.chartId,title:t.title??e.name,intent:{primary:r,secondary:o.filter(e=>e!==r)},audience:{primary:e.audience?.primary,familiarityAssumptions:Object.fromEntries(Object.entries(e.audience?.familiarity??{}).map(([e,t])=>[e,t+""])),literacyTargets:e.audience?.literacyTargets?.map(e=>({feature:e.concept,rationale:e.rationale}))},reception:e.reception?{channels:e.reception.channels,strengths:e.reception.strengths,risks:e.reception.risks,scaffolds:e.reception.scaffolds,memorableForm:e.reception.memorableForm}:void 0,designContract:{chartFamily:e.frameFamily,whyThisForm:e.designContract.whyThisForm??e.designContract.whyCustom,whyNotDefault:e.designContract.whyNotDefault,risks:e.reception?.risks,misuse:e.designContract.misuse},accessibility:{description:t.description,navigation:"required"===e.accessibility.keyboardNavigation||null!=e.navigation,dataFallback:!0===e.accessibility.fallbackTable||"required"===e.accessibility.accessibleTable||!0===e.accessibility.requiresAccessibleTable,manualChecks:["real screen-reader behavior","keyboard order quality","custom metaphor comprehension","animation distraction"]},provenance:t.dataSources||t.reviewStatus?{dataSources:t.dataSources,reviewStatus:t.reviewStatus,generatedBy:"Semiotic recipe intelligence"}:void 0}}var AP=require("react/jsx-runtime");function CP({manifest:e,label:t="Intent Mark",className:o,showSummary:n=!0}){const[r,i]=kP.useState(!1),s=kP.useMemo(()=>JSON.stringify(e,null,2),[e]),a=kP.useCallback(async()=>{"undefined"!=typeof navigator&&navigator.clipboard&&(await navigator.clipboard.writeText(s),i(!0),window.setTimeout(()=>i(!1),1200))},[s]);return(0,AP.jsxs)("details",{className:o?"semiotic-intent-mark "+o:"semiotic-intent-mark",style:{border:"1px solid var(--semiotic-border, #c8c8c8)",borderRadius:6,background:"var(--semiotic-surface, #fff)",color:"var(--semiotic-text, #222)",fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[(0,AP.jsxs)("summary",{style:{cursor:"pointer",padding:"7px 10px",fontSize:12,fontWeight:700,letterSpacing:"0.04em",textTransform:"uppercase"},children:[t," · ",e.intent.primary]}),(0,AP.jsxs)("div",{style:{padding:"0 10px 10px"},children:[n&&(0,AP.jsx)("p",{style:{margin:"4px 0 10px",fontSize:13,lineHeight:1.45},children:wP(e)}),(0,AP.jsx)("button",{type:"button",onClick:a,style:{border:"1px solid currentColor",borderRadius:4,background:"transparent",color:"inherit",padding:"4px 8px",font:"inherit",fontSize:12,cursor:"pointer"},children:r?"Copied":"Copy manifest"}),(0,AP.jsx)("pre",{style:{maxHeight:280,overflow:"auto",margin:"10px 0 0",padding:10,background:"var(--semiotic-bg, #f5f5f5)",fontSize:11,lineHeight:1.45,whiteSpace:"pre-wrap"},children:s})]})]})}var MP=require("react"),_P="",PP=["hover","click","focus","activate"];function RP(e){if("datum"===e.role&&e.datum)return e.datum;for(const t of e.children??[]){const e=RP(t);if(e)return e}return null}function jP(e,t){return e?t.map(t=>e[t]+"").join(_P):""}function LP(e,t){if(e.id===t)return e;for(const o of e.children??[]){const e=LP(o,t);if(e)return e}return null}function TP(e){const{tree:t,chartId:o,observe:n=PP}=e,r=e.selectionName??"__semiotic-nav-sync"+(o?":"+o:""),i=(0,MP.useMemo)(()=>{if(e.matchFields)return e.matchFields;const o=RP(t);return o?Object.keys(o).filter(e=>{return!e.startsWith("_")&&(null==(t=o[e])||"string"==typeof t||"number"==typeof t||"boolean"==typeof t);var t}):[]},[e.matchFields,t]),s=(0,MP.useMemo)(()=>{const e=new Map,o=t=>{if("datum"===t.role&&t.datum){const o=jP(t.datum,i);e.has(o)||e.set(o,t.id)}for(const e of t.children??[])o(e)};return o(t),e},[t,i]),{selectPoints:a,clear:l}=Sg({name:r,fields:i}),c=(0,MP.useMemo)(()=>[...n,"hover-end"],[n]),{latest:u}=sy({chartId:o,types:c,limit:1}),[d,h]=(0,MP.useState)(t.id),f=(0,MP.useRef)(d);f.current=d;const m=(0,MP.useRef)(t);(0,MP.useEffect)(()=>{const e=m.current;m.current=t;const o=LP(e,f.current),n=LP(t,f.current);"datum"===o?.role&&"datum"===n?.role&&o.datum&&n.datum&&i.length>0&&jP(o.datum,i)===jP(n.datum,i)||o&&n&&"datum"!==o.role&&"datum"!==n.role||(h(t.id),l())},[t,l,i]);const p=(0,MP.useCallback)(e=>{if(h(e.id),"datum"===e.role&&e.datum&&i.length>0){const t={};for(const o of i)t[o]=[e.datum[o]];a(t)}else l()},[i,a,l]),g=e.annotations,y=(0,MP.useMemo)(()=>{const e=new Set;if(0===i.length||!g)return e;for(const t of g){const o=s.get(jP(t,i));o&&e.add(o)}return e},[g,s,i]),b=(0,MP.useCallback)(e=>{const t="number"==typeof e?g?.[e]:e;if(!t||0===i.length)return!1;const o=s.get(jP(t,i));if(!o)return!1;h(o);const n={};for(const e of i)n[e]=[t[e]];return a(n),!0},[g,s,i,a]),v=(0,MP.useRef)(null),x=(0,MP.useCallback)(e=>{if(o&&e.chartId!==o)return;if("hover-end"===e.type){if(e===v.current)return;return void(v.current=e)}if(!function(e){return"hover"===e.type||"click"===e.type||"focus"===e.type||"activate"===e.type}(e))return;if(!n.includes(e.type))return;if(e===v.current)return;if(v.current=e,0===i.length)return;const t=function(e){const t=e,o=t.data;if(!o||"object"!=typeof o||Array.isArray(o))return e;const n=e=>e.every(e=>"number"==typeof t[e]),r=n(["x0","x1","y0","y1","width","height","value"]),i=n(["y0","y1","sankeyWidth","value"])&&"source"in t&&"target"in t;return r||i?o:e}(e.datum),r=s.get(jP(t,i));r&&h(e=>e===r?e:r)},[o,n,s,i]),k=(0,MP.useRef)(null);return(0,MP.useEffect)(()=>{u&&u!==k.current&&(k.current=u,x(u))},[u,x]),{activeId:d,onActiveChange:p,selection:{name:r},onObservation:x,handleObservation:x,annotatedIds:y,focusAnnotation:b}}U();var IP=require("react");function $P(e,t,o,n){const r=new Map;o.forEach((e,t)=>{r.set(n?n(e,t):t+"",e)});const i=[];t.forEach((e,t)=>{r.has(t)||i.push(t)}),i.length>0&&e.remove?.(i);const s=[];if(r.forEach((o,n)=>{const r=t.get(n);void 0===r?s.push(o):r!==o&&(e.update?e.update(n,()=>o):(e.remove?.(n),s.push(o)))}),s.length>0)if(e.pushMany)e.pushMany(s);else if(e.push)for(const t of s)e.push(t);return r}function NP(e,t,o={}){const{id:n,resetKey:r}=o,i=(0,IP.useMemo)(()=>function(e){return null==e?null:"function"==typeof e?(t,o)=>{const n=e(t,o);return null==n?o+"":n+""}:(t,o)=>{const n=t[e];return null==n?o+"":n+""}}(n),[n]),s=(0,IP.useRef)({map:new Map,handle:null,resetKey:void 0});(0,IP.useEffect)(()=>{const o=e.current;if(!o)return;const n=s.current;n.handle===o&&n.resetKey===r||(o.clear?.(),n.map=new Map,n.handle=o,n.resetKey=r),n.map=$P(o,n.map,t,i)},[e,t,i,r])}var DP=require("react/jsx-runtime");function EP({items:e,title:t="Additional notes",empty:o=null,ordered:n=!0,renderItem:r,className:i,style:s}){if(!e.length)return o?(0,DP.jsx)(DP.Fragment,{children:o}):null;const a=n?"ol":"ul";return(0,DP.jsxs)("section",{className:["semiotic-mobile-annotation-callouts",i].filter(Boolean).join(" "),style:s,children:[(0,DP.jsx)("style",{children:"\n .semiotic-mobile-annotation-callouts {\n display: grid;\n gap: 8px;\n padding: 10px 12px;\n border: 1px solid var(--semiotic-border, #d8d8d8);\n border-radius: 14px;\n background: var(--semiotic-bg, #fff);\n color: var(--semiotic-text, #222);\n }\n .semiotic-mobile-annotation-callouts h3 {\n margin: 0;\n font-size: 13px;\n font-weight: 800;\n line-height: 1.25;\n }\n .semiotic-mobile-annotation-callouts ol,\n .semiotic-mobile-annotation-callouts ul {\n display: grid;\n gap: 8px;\n margin: 0;\n padding-left: 18px;\n }\n .semiotic-mobile-annotation-callouts li {\n font-size: 13px;\n line-height: 1.45;\n }\n .semiotic-mobile-annotation-callouts small {\n display: block;\n margin-top: 2px;\n color: var(--semiotic-text-secondary, #666);\n font-size: 11px;\n line-height: 1.3;\n }\n "}),t&&(0,DP.jsx)("h3",{children:t}),(0,DP.jsx)(a,{children:e.map((e,t)=>(0,DP.jsx)("li",{children:r?r(e,t):(0,DP.jsxs)(DP.Fragment,{children:[(0,DP.jsx)("span",{children:e.label}),(e.source||e.emphasis)&&(0,DP.jsx)("small",{children:[e.emphasis,e.source].filter(Boolean).join(" - ")})]})},e.id))})]})}
2
+ module.exports=require("./semiotic-client-cjs-shared.min.js").semiotic;