semiotic 3.8.5 → 3.8.7

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 (277) hide show
  1. package/CLAUDE.md +37 -10
  2. package/README.md +83 -56
  3. package/ai/behaviorContracts.cjs +88 -3
  4. package/ai/componentMetadata.cjs +5 -10
  5. package/ai/dist/mcp-server.js +99 -10
  6. package/ai/examples.md +198 -9
  7. package/ai/schema.json +2002 -165
  8. package/ai/surface-manifest.json +14 -10
  9. package/ai/system-prompt.md +9 -3
  10. package/dist/{chunk-chartContainerDataAudit-74TLKIP6.module.min.js → chunk-chartContainerDataAudit-JDSVSKGM.module.min.js} +1 -1
  11. package/dist/chunk-chunk-2JGJ5GUG.module.min.js +1 -0
  12. package/dist/chunk-chunk-2YAZHXL4.module.min.js +2 -0
  13. package/dist/chunk-chunk-3NGIKFD6.module.min.js +1 -0
  14. package/dist/{chunk-chunk-G7WFWHAD.module.min.js → chunk-chunk-4ITOQRXM.module.min.js} +1 -1
  15. package/dist/chunk-chunk-5SD6BHVW.module.min.js +2 -0
  16. package/dist/chunk-chunk-6V5VQVCT.module.min.js +2 -0
  17. package/dist/chunk-chunk-7TTBHSAG.module.min.js +2 -0
  18. package/dist/chunk-chunk-7ZDJSYKI.module.min.js +2 -0
  19. package/dist/chunk-chunk-BGHPD3RA.module.min.js +1 -0
  20. package/dist/chunk-chunk-BMRZ2SPU.module.min.js +2 -0
  21. package/dist/chunk-chunk-BNGBEY7N.module.min.js +2 -0
  22. package/dist/chunk-chunk-C7APLVQD.module.min.js +2 -0
  23. package/dist/chunk-chunk-DGWFBOGB.module.min.js +1 -0
  24. package/dist/chunk-chunk-DIVE2DRA.module.min.js +2 -0
  25. package/dist/chunk-chunk-FBUNUIPV.module.min.js +2 -0
  26. package/dist/chunk-chunk-FQPKOAIH.module.min.js +2 -0
  27. package/dist/chunk-chunk-FRO4TRXK.module.min.js +2 -0
  28. package/dist/chunk-chunk-G7QVPZUD.module.min.js +2 -0
  29. package/dist/chunk-chunk-GBPYV4FP.module.min.js +2 -0
  30. package/dist/chunk-chunk-GU2EJIDJ.module.min.js +2 -0
  31. package/dist/chunk-chunk-J5QD4RAM.module.min.js +2 -0
  32. package/dist/{chunk-chunk-LJLS6DY7.module.min.js → chunk-chunk-JWXLNZSM.module.min.js} +1 -1
  33. package/dist/chunk-chunk-KXAFCCDB.module.min.js +2 -0
  34. package/dist/chunk-chunk-LG7YKJAK.module.min.js +2 -0
  35. package/dist/{chunk-chunk-I36PJ4OC.module.min.js → chunk-chunk-LVHDZAT3.module.min.js} +1 -1
  36. package/dist/chunk-chunk-LWITSR2O.module.min.js +2 -0
  37. package/dist/chunk-chunk-MX35T6RX.module.min.js +2 -0
  38. package/dist/chunk-chunk-NH4MEAKP.module.min.js +2 -0
  39. package/dist/chunk-chunk-NJETWX42.module.min.js +2 -0
  40. package/dist/chunk-chunk-NW25WGLS.module.min.js +2 -0
  41. package/dist/{chunk-chunk-TMWIZL3K.module.min.js → chunk-chunk-OI7R7EJB.module.min.js} +1 -1
  42. package/dist/chunk-chunk-ONMLEXHR.module.min.js +2 -0
  43. package/dist/chunk-chunk-OY66GCE6.module.min.js +1 -0
  44. package/dist/chunk-chunk-PZFT457G.module.min.js +1 -0
  45. package/dist/chunk-chunk-Q3WW6JGR.module.min.js +1 -0
  46. package/dist/chunk-chunk-Q6XKQTOQ.module.min.js +1 -0
  47. package/dist/chunk-chunk-RJRM2E6P.module.min.js +1 -0
  48. package/dist/chunk-chunk-RPL7WYXI.module.min.js +1 -0
  49. package/dist/chunk-chunk-SV4XAZ3Q.module.min.js +1 -0
  50. package/dist/chunk-chunk-TSCFL235.module.min.js +1 -0
  51. package/dist/chunk-chunk-UOQRPGPK.module.min.js +2 -0
  52. package/dist/chunk-chunk-V3OAKG32.module.min.js +1 -0
  53. package/dist/chunk-chunk-WLOIUMWG.module.min.js +2 -0
  54. package/dist/chunk-chunk-XEGXX4F7.module.min.js +1 -0
  55. package/dist/chunk-chunk-XFRBLXYM.module.min.js +1 -0
  56. package/dist/chunk-chunk-Z2AJERX5.module.min.js +2 -0
  57. package/dist/chunk-chunk-ZXYDYAB7.module.min.js +2 -0
  58. package/dist/components/ai/SemioticVACPBridge.d.ts +22 -0
  59. package/dist/components/ai/chartCapabilities.d.ts +5 -3
  60. package/dist/components/ai/conversationArc.d.ts +2 -176
  61. package/dist/components/ai/conversationArcTypes.d.ts +202 -0
  62. package/dist/components/ai/readerGrounding.d.ts +12 -0
  63. package/dist/components/ai/vacpAdapter.d.ts +13 -0
  64. package/dist/components/ai/vacpAdapterActions.d.ts +2 -0
  65. package/dist/components/ai/vacpAdapterModel.d.ts +7 -0
  66. package/dist/components/ai/vacpAdapterRuntime.d.ts +26 -0
  67. package/dist/components/ai/vacpAdapterState.d.ts +3 -0
  68. package/dist/components/ai/vacpAdapterTypes.d.ts +169 -0
  69. package/dist/components/ai/vacpTypes.d.ts +160 -0
  70. package/dist/components/charts/custom/XYCustomChart.d.ts +3 -0
  71. package/dist/components/charts/geo/DistanceCartogram.d.ts +1 -1
  72. package/dist/components/charts/index.d.ts +7 -4
  73. package/dist/components/charts/ordinal/BarChart.d.ts +7 -14
  74. package/dist/components/charts/ordinal/GaugeChart.d.ts +3 -0
  75. package/dist/components/charts/ordinal/GroupedBarChart.d.ts +3 -0
  76. package/dist/components/charts/ordinal/StackedBarChart.d.ts +3 -0
  77. package/dist/components/charts/ordinal/SwimlaneChart.d.ts +4 -14
  78. package/dist/components/charts/physics/ChainReactionChart.capability.d.ts +9 -0
  79. package/dist/components/charts/physics/ChainReactionChart.d.ts +29 -0
  80. package/dist/components/charts/physics/CollisionSwarmChart.d.ts +1 -1
  81. package/dist/components/charts/physics/EventDropChart.d.ts +7 -2
  82. package/dist/components/charts/physics/GaltonBoardChart.d.ts +1 -1
  83. package/dist/components/charts/physics/{PhysicsPileChart.capability.d.ts → PacketFlowChart.capability.d.ts} +1 -1
  84. package/dist/components/charts/physics/{PhysicalFlowChart.d.ts → PacketFlowChart.d.ts} +22 -6
  85. package/dist/components/charts/physics/PhysicsCustomChart.d.ts +1 -1
  86. package/dist/components/charts/physics/ProcessFlowChart.d.ts +7 -4
  87. package/dist/components/charts/physics/{PhysicalFlowChart.capability.d.ts → UnitPileChart.capability.d.ts} +1 -1
  88. package/dist/components/charts/physics/{PhysicsPileChart.d.ts → UnitPileChart.d.ts} +19 -6
  89. package/dist/components/charts/physics/crucibleChartProps.d.ts +1 -1
  90. package/dist/components/charts/physics/crucibleChartUtils.d.ts +9 -0
  91. package/dist/components/charts/physics/gauntletChartProps.d.ts +6 -1
  92. package/dist/components/charts/physics/gauntletTerminal.d.ts +61 -0
  93. package/dist/components/charts/physics/packetFlowSemantics.d.ts +6 -0
  94. package/dist/components/charts/physics/physicsHocUtils.d.ts +45 -2
  95. package/dist/components/charts/shared/auditAccessibilityStyles.d.ts +9 -0
  96. package/dist/components/charts/shared/chartSpecCore.d.ts +2 -4
  97. package/dist/components/charts/shared/gaugeGradient.d.ts +4 -8
  98. package/dist/components/charts/shared/gradient.d.ts +35 -0
  99. package/dist/components/charts/shared/hatchFill.d.ts +3 -10
  100. package/dist/components/charts/shared/hooks.d.ts +2 -50
  101. package/dist/components/charts/shared/knownChartComponents.d.ts +1 -1
  102. package/dist/components/charts/shared/streamPropsHelpers.d.ts +1 -2
  103. package/dist/components/charts/shared/useChartLegend.d.ts +65 -0
  104. package/dist/components/charts/shared/useChartSetup.d.ts +12 -0
  105. package/dist/components/charts/shared/useCustomChartSetup.d.ts +6 -1
  106. package/dist/components/charts/shared/useNetworkChartSetup.d.ts +1 -0
  107. package/dist/components/charts/shared/useStreamingLegend.d.ts +1 -1
  108. package/dist/components/charts/xy/AreaChart.d.ts +25 -42
  109. package/dist/components/charts/xy/BumpChart.capability.d.ts +11 -0
  110. package/dist/components/charts/xy/BumpChart.d.ts +161 -0
  111. package/dist/components/charts/xy/DifferenceChart.d.ts +3 -10
  112. package/dist/components/charts/xy/Heatmap.d.ts +3 -0
  113. package/dist/components/charts/xy/LineChart.d.ts +6 -8
  114. package/dist/components/data/portability/capabilityBinding.d.ts +41 -0
  115. package/dist/components/data/portability/index.d.ts +2 -0
  116. package/dist/components/geometry/bumpRibbonGeometry.d.ts +36 -0
  117. package/dist/components/legendLayout.d.ts +75 -1
  118. package/dist/components/recipes/geographicDotGrid.d.ts +82 -0
  119. package/dist/components/recipes/geographicGrid.d.ts +100 -0
  120. package/dist/components/recipes/physics.d.ts +2 -0
  121. package/dist/components/recipes/physicsStageGeography.d.ts +137 -0
  122. package/dist/components/semiotic-ai.d.ts +6 -4
  123. package/dist/components/semiotic-experimental-vacp.d.ts +11 -0
  124. package/dist/components/semiotic-experimental.d.ts +6 -3
  125. package/dist/components/semiotic-geo.d.ts +5 -0
  126. package/dist/components/semiotic-network.d.ts +1 -0
  127. package/dist/components/semiotic-ordinal.d.ts +2 -0
  128. package/dist/components/semiotic-physics.d.ts +10 -6
  129. package/dist/components/semiotic-realtime-core.d.ts +1 -0
  130. package/dist/components/semiotic-recipes-core.d.ts +6 -1
  131. package/dist/components/semiotic-server-edge.d.ts +1 -1
  132. package/dist/components/semiotic-server.d.ts +1 -1
  133. package/dist/components/semiotic-xy.d.ts +4 -0
  134. package/dist/components/semiotic.d.ts +4 -4
  135. package/dist/components/server/renderEvidence.d.ts +1 -1
  136. package/dist/components/server/renderToStaticSVG.d.ts +2 -1
  137. package/dist/components/server/serverChartConfigHeatmap.d.ts +6 -0
  138. package/dist/components/server/serverChartConfigNetworkStyles.d.ts +12 -0
  139. package/dist/components/server/serverChartConfigShared.d.ts +16 -0
  140. package/dist/components/server/serverChartConfigs.d.ts +3 -2
  141. package/dist/components/server/serverChartConfigsPhysics.d.ts +2 -2
  142. package/dist/components/server/serverChartConfigsXY.d.ts +1 -1
  143. package/dist/components/server/staticLegend.d.ts +10 -2
  144. package/dist/components/server/staticSVGChrome.d.ts +14 -6
  145. package/dist/components/server/staticValue.d.ts +8 -0
  146. package/dist/components/stream/GeoSVGOverlay.d.ts +4 -10
  147. package/dist/components/stream/NetworkSVGOverlay.d.ts +2 -6
  148. package/dist/components/stream/OrdinalSVGOverlay.d.ts +2 -6
  149. package/dist/components/stream/SVGOverlay.d.ts +2 -6
  150. package/dist/components/stream/StalenessBadge.d.ts +2 -6
  151. package/dist/components/stream/geoPipelineConfig.d.ts +10 -0
  152. package/dist/components/stream/geoTypes.d.ts +3 -6
  153. package/dist/components/stream/legendRenderer.d.ts +10 -6
  154. package/dist/components/stream/ordinalTypes.d.ts +7 -31
  155. package/dist/components/stream/physics/PhysicsEvidence.d.ts +37 -0
  156. package/dist/components/stream/physics/PhysicsKernel.d.ts +1 -0
  157. package/dist/components/stream/physics/PhysicsPipelineStore.d.ts +9 -0
  158. package/dist/components/stream/physics/PhysicsSVGOverlay.d.ts +2 -6
  159. package/dist/components/stream/physics/PhysicsSettledScene.d.ts +5 -0
  160. package/dist/components/stream/physics/StreamPhysicsTypes.d.ts +2 -6
  161. package/dist/components/stream/physics/physicsFramePipelineConfig.d.ts +19 -0
  162. package/dist/components/stream/physics/physicsPipelineSettle.d.ts +52 -0
  163. package/dist/components/stream/physics/physicsRegionRuntime.d.ts +23 -0
  164. package/dist/components/stream/pipelineConfig.d.ts +7 -15
  165. package/dist/components/stream/renderers/canvasRenderHelpers.d.ts +9 -69
  166. package/dist/components/stream/renderers/cornerRadii.d.ts +2 -9
  167. package/dist/components/stream/renderers/thresholdLineSegments.d.ts +12 -0
  168. package/dist/components/stream/sceneToSVGShared.d.ts +3 -5
  169. package/dist/components/stream/types.d.ts +34 -56
  170. package/dist/components/stream/xySceneBuilders/areaGradient.d.ts +4 -20
  171. package/dist/components/stream/xySceneBuilders/types.d.ts +6 -6
  172. package/dist/components/types/legendTypes.d.ts +31 -6
  173. package/dist/controls.min.js +1 -1
  174. package/dist/controls.module.min.js +1 -1
  175. package/dist/geo.min.js +1 -1
  176. package/dist/geo.module.min.js +1 -1
  177. package/dist/network.min.js +1 -1
  178. package/dist/network.module.min.js +1 -1
  179. package/dist/ordinal.min.js +1 -1
  180. package/dist/ordinal.module.min.js +1 -1
  181. package/dist/physics.min.js +1 -1
  182. package/dist/physics.module.min.js +1 -1
  183. package/dist/physicsWorker.js +1 -1
  184. package/dist/realtime.min.js +1 -1
  185. package/dist/realtime.module.min.js +1 -1
  186. package/dist/semiotic-ai-core.min.js +1 -1
  187. package/dist/semiotic-ai-core.module.min.js +1 -1
  188. package/dist/semiotic-ai.d.ts +6 -4
  189. package/dist/semiotic-ai.min.js +1 -1
  190. package/dist/semiotic-ai.module.min.js +1 -1
  191. package/dist/semiotic-data.module.min.js +1 -1
  192. package/dist/semiotic-experimental-vacp.d.ts +11 -0
  193. package/dist/semiotic-experimental-vacp.min.js +1 -0
  194. package/dist/semiotic-experimental-vacp.module.min.js +1 -0
  195. package/dist/semiotic-experimental.d.ts +6 -3
  196. package/dist/semiotic-experimental.min.js +2 -1
  197. package/dist/semiotic-experimental.module.min.js +2 -1
  198. package/dist/semiotic-geo.d.ts +5 -0
  199. package/dist/semiotic-network.d.ts +1 -0
  200. package/dist/semiotic-ordinal.d.ts +2 -0
  201. package/dist/semiotic-physics.d.ts +10 -6
  202. package/dist/semiotic-realtime-core.d.ts +1 -0
  203. package/dist/semiotic-realtime-core.min.js +1 -1
  204. package/dist/semiotic-realtime-core.module.min.js +1 -1
  205. package/dist/semiotic-recipes-core.d.ts +6 -1
  206. package/dist/semiotic-recipes-core.min.js +1 -1
  207. package/dist/semiotic-recipes-core.module.min.js +1 -1
  208. package/dist/semiotic-recipes.min.js +1 -1
  209. package/dist/semiotic-recipes.module.min.js +1 -1
  210. package/dist/semiotic-server-edge.d.ts +1 -1
  211. package/dist/semiotic-server-edge.min.js +1 -1
  212. package/dist/semiotic-server-edge.module.min.js +1 -1
  213. package/dist/semiotic-server-node.min.js +1 -1
  214. package/dist/semiotic-server-node.module.min.js +1 -1
  215. package/dist/semiotic-server.d.ts +1 -1
  216. package/dist/semiotic-utils-core.min.js +1 -1
  217. package/dist/semiotic-utils-core.module.min.js +1 -1
  218. package/dist/semiotic-utils.min.js +1 -1
  219. package/dist/semiotic-utils.module.min.js +1 -1
  220. package/dist/semiotic-xy.d.ts +4 -0
  221. package/dist/semiotic.d.ts +4 -4
  222. package/dist/semiotic.min.js +1 -1
  223. package/dist/semiotic.module.min.js +1 -1
  224. package/dist/server.min.js +1 -1
  225. package/dist/server.module.min.js +1 -1
  226. package/dist/xy.min.js +1 -1
  227. package/dist/xy.module.min.js +1 -1
  228. package/package.json +18 -2
  229. package/spec/README.md +94 -2
  230. package/spec/bindings/README.md +14 -3
  231. package/spec/v0.1/examples/annotation-provenance-reviewed-revision.json +27 -0
  232. package/spec/v0.1/examples/annotation-provenance-watcher-threshold.json +21 -0
  233. package/spec/v0.1/examples/audience-profile-executive-review.json +24 -0
  234. package/spec/v0.1/examples/audience-profile-incident-operators.json +42 -0
  235. package/spec/v0.1/examples/chart-capability-bar-comparison.json +48 -0
  236. package/spec/v0.1/examples/chart-capability-service-flow.json +54 -0
  237. package/dist/chunk-chunk-4AANPFOX.module.min.js +0 -2
  238. package/dist/chunk-chunk-5I3UZV4Q.module.min.js +0 -2
  239. package/dist/chunk-chunk-5RKXZQ2P.module.min.js +0 -1
  240. package/dist/chunk-chunk-74CCPVXB.module.min.js +0 -1
  241. package/dist/chunk-chunk-7ALTGHK6.module.min.js +0 -1
  242. package/dist/chunk-chunk-ANYDWOZF.module.min.js +0 -1
  243. package/dist/chunk-chunk-AVBI6GDT.module.min.js +0 -1
  244. package/dist/chunk-chunk-BANTPINB.module.min.js +0 -2
  245. package/dist/chunk-chunk-C4YA6TDR.module.min.js +0 -1
  246. package/dist/chunk-chunk-C57LR3YG.module.min.js +0 -1
  247. package/dist/chunk-chunk-CKMD5NV3.module.min.js +0 -2
  248. package/dist/chunk-chunk-CO5KQMGH.module.min.js +0 -1
  249. package/dist/chunk-chunk-CWQ5YIHX.module.min.js +0 -2
  250. package/dist/chunk-chunk-E6TXX6MI.module.min.js +0 -1
  251. package/dist/chunk-chunk-GMQ5AYTD.module.min.js +0 -1
  252. package/dist/chunk-chunk-JCG72SGW.module.min.js +0 -2
  253. package/dist/chunk-chunk-K3DMEW22.module.min.js +0 -1
  254. package/dist/chunk-chunk-KT2VAZMZ.module.min.js +0 -1
  255. package/dist/chunk-chunk-L6EA5V3G.module.min.js +0 -2
  256. package/dist/chunk-chunk-LJPCLYSC.module.min.js +0 -2
  257. package/dist/chunk-chunk-LRIFN2HK.module.min.js +0 -1
  258. package/dist/chunk-chunk-N5DDKCCF.module.min.js +0 -1
  259. package/dist/chunk-chunk-NEVE562N.module.min.js +0 -1
  260. package/dist/chunk-chunk-NLO44TOS.module.min.js +0 -2
  261. package/dist/chunk-chunk-PZJ2SBLL.module.min.js +0 -2
  262. package/dist/chunk-chunk-QSQVBIJA.module.min.js +0 -1
  263. package/dist/chunk-chunk-QUJ6TTLY.module.min.js +0 -1
  264. package/dist/chunk-chunk-RBIDBUT4.module.min.js +0 -2
  265. package/dist/chunk-chunk-RCF52Z42.module.min.js +0 -2
  266. package/dist/chunk-chunk-RFLAG356.module.min.js +0 -1
  267. package/dist/chunk-chunk-RPU4IZAV.module.min.js +0 -2
  268. package/dist/chunk-chunk-SKMBCFIL.module.min.js +0 -2
  269. package/dist/chunk-chunk-TAE7W424.module.min.js +0 -2
  270. package/dist/chunk-chunk-TUBMTZMU.module.min.js +0 -2
  271. package/dist/chunk-chunk-UFFEXJQY.module.min.js +0 -1
  272. package/dist/chunk-chunk-XSCHTS4D.module.min.js +0 -2
  273. package/dist/chunk-chunk-XXWSHGPL.module.min.js +0 -2
  274. package/dist/chunk-chunk-ZOAQDIJO.module.min.js +0 -1
  275. package/dist/chunk-chunk-ZXIXAPRE.module.min.js +0 -2
  276. package/dist/chunk-statisticalOverlays-QGDLRUHX.module.min.js +0 -1
  277. package/dist/chunk-statisticalOverlays-T77OKLDY.module.min.js +0 -1
@@ -1 +1 @@
1
- import{canUseForceWorker as e,createFrameForceWorkerRequest as t,runForceLayoutWorker as o,shouldUseForceWorker as n}from"./chunk-chunk-ZOAQDIJO.module.min.js";import"./chunk-chunk-SV4XAZ3Q.module.min.js";import{StalenessBadge as s,StreamXYFrame_default as r,attachUpdateResultStore as i,buildCustomBehaviorProps as a,buildNavGraph as l,compileMotionEncoding as c,composeOverlays as d,computeDecayOpacity as u,createCustomLayoutFailureDiagnostic as h,deriveMotionVector as g,extractNetworkNavPoints as y,findHitPointInQuadtree as p,formatVal as m,getLayoutPlugin as f,needsDataCanvasPaint as v,networkGlyphRenderer as b,nextNetworkIndex as _,opacityFromAge as w,paintCanvasBackground as x,paintSceneWithBackend as k,renderCirclePulse as A,renderRectPulse as S,renderSceneWithBackend as C,resolveDownwardHistogramExtent as R,resolveMotionAccessor as N,resolveMotionVector as T,resolvePosition as E,useConfigSync as P,useLayoutSelectionSync as I,useStableShallow as D,useStalenessCheck as M,warnCustomLayoutDiagnostics as z}from"./chunk-chunk-RFLAG356.module.min.js";import{IncrementalExtent as L,RingBuffer as H,getHitRadius as W,hitTestRect as B,normalizeAngle as F}from"./chunk-chunk-7ALTGHK6.module.min.js";import{CustomLayoutSelectionProvider as O,wrapWithCustomLayoutSelection as Y}from"./chunk-chunk-C4YA6TDR.module.min.js";import{ANNOTATION_DISCLOSURE_REVEAL_CSS as j,AriaLiveTooltip as X,CanvasFrameBackground as $,DEFAULT_COLORS as V,FlippingTooltip as G,FocusRing as Q,NetworkAccessibleDataTable as q,SceneRevisionDiagnosticsObserver as K,ScreenReaderSummary as U,SkipToTableLink as Z,TITLE_BASELINE as J,buildResolveColor as ee,computeEasing as te,computeNetworkAriaLabel as oe,computeRawProgress as ne,createDefaultAnnotationRules as se,emitClickObservations as re,emitHoverObservations as ie,filterSparseArray as ae,getDevicePixelRatio as le,isInteractiveKeyboardTarget as ce,isServerEnvironment as de,lerp as ue,networkLabelToSVG as he,networkSceneEdgeToSVG as ge,networkSceneNodeToSVG as ye,normalizeLinkedBrush as pe,now as me,observationInputType as fe,prepareCanvas as ve,renderAnnotationPass as be,renderEmptyState as _e,renderLegendFromConfig as we,renderLoadingState as xe,resolveCanvasFill as ke,resolveCustomLayoutPalette as Ae,runSceneBuild as Se,useBrushSelection as Ce,useChartLegendAndMargin as Re,useChartMode as Ne,useChartSelection as Te,useFrame as Ee,useFrameCanvasHost as Pe,useHydration as Ie,useSceneRevisionDiagnostics as De,useWasHydratingFromSSR as Me}from"./chunk-chunk-E6TXX6MI.module.min.js";import"./chunk-chunk-XEVJDUTH.module.min.js";import{DEFAULT_LIFECYCLE_THRESHOLDS as ze,annotationActivationProps as Le,bandFromAge as He,buildHoverData as We,defaultTooltipStyle as Be,filterAnnotationsByStatus as Fe,isAnnotationActivationTarget as Oe,smartTooltipEntries as Ye,useAnnotationActivationOptions as je}from"./chunk-chunk-CO5KQMGH.module.min.js";import{UpdateResultTracker as Xe,annotationLayout as $e,glyphHitGeometry as Ve,schemeCategory10 as Ge,symbolPathString as Qe,symbolRadius as qe}from"./chunk-chunk-5RKXZQ2P.module.min.js";import"./chunk-chunk-U66USBWU.module.min.js";import"./chunk-chunk-JJ2OOIET.module.min.js";import{resolveCSSColor as Ke}from"./chunk-chunk-IY7RYD4S.module.min.js";import"./chunk-chunk-J3QOW4OE.module.min.js";import{resolveThemeSemanticColors as Ue}from"./chunk-chunk-DSNGDNJY.module.min.js";import*as Ze from"react";import{useRef as Je,useState as et,useEffect as tt,useMemo as ot,useCallback as nt,useImperativeHandle as st,forwardRef as rt,memo as it}from"react";var at={weightChange:.1,newEdge:.5,newNode:1,threshold:3,transitionDuration:500},lt={radius:3,opacity:.7,speedMultiplier:1,maxPerEdge:50,spawnRate:.1},ct=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 s=0;this.capacity>s;s++){const r=this.particles[s];if(!r.active)continue;const i=o[r.edgeIndex];i&&i.bezier?(r.t+=e*t*(n?n[r.edgeIndex]??1:1)*(i.bezier.circular?.3:1),1>r.t?dt(i.bezier,r.t,r.offset,r):(r.active=!1,this._freeIndices.push(s))):(r.active=!1,this._freeIndices.push(s))}}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 dt(e,t,o,n){if(e.circular&&e.segments)return void function(e,t,o,n,s){const r=e.length,i=t*r,a=Math.min(Math.floor(i),r-1),l=i-a,[c,d,u,h]=e[a];ut(c,d,u,h,l,s);const g=h.x-c.x,y=h.y-c.y,p=Math.sqrt(g*g+y*y);if(p>.001){const e=g/p;s.x+=-y/p*o*n*2,s.y+=e*o*n*2}}(e.segments,t,o,e.halfWidth,n);if(!e.points)return n.x=0,void(n.y=0);const[s,r,i,a]=e.points;ut(s,r,i,a,t,n);const l=a.x-s.x,c=a.y-s.y,d=Math.sqrt(l*l+c*c);if(d>.001){const t=l/d;n.x+=-c/d*o*e.halfWidth*2,n.y+=t*o*e.halfWidth*2}}function ut(e,t,o,n,s,r){const i=1-s,a=i*i,l=a*i,c=s*s,d=c*s;r.x=l*e.x+3*a*s*t.x+3*i*c*o.x+d*n.x,r.y=l*e.y+3*a*s*t.y+3*i*c*o.y+d*n.y}import{quadtree as ht}from"d3-quadtree";function gt(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 yt(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(!pt(e))return!1;return!0}return pt(t.points)}function pt(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}import{interpolateNumber as mt}from"d3-interpolate";var ft="rgba(34, 197, 94, 0.7)",vt=2e3,bt=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],_t=["scene-style","data-paint","accessibility","evidence"],wt=(e,t)=>({retainedData:e,invalidations:t}),xt=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],kt=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],At=["scene-geometry","data-paint","overlay","accessibility","evidence"],St=["scene-style","data-paint","accessibility","evidence"],Ct=["scene-geometry","data-paint","overlay","accessibility","evidence"],Rt=[],Nt={chartType:wt("rebuild",xt),nodeIDAccessor:wt("rebuild",xt),sourceAccessor:wt("rebuild",xt),targetAccessor:wt("rebuild",xt),valueAccessor:wt("rebuild",xt),edgeIdAccessor:wt("rebuild",xt),childrenAccessor:wt("rebuild",xt),hierarchySum:wt("rebuild",xt),orientation:wt("preserve",kt),nodeAlign:wt("preserve",kt),nodePaddingRatio:wt("preserve",kt),nodeWidth:wt("preserve",kt),edgeSort:wt("preserve",kt),iterations:wt("preserve",kt),forceStrength:wt("preserve",kt),padAngle:wt("preserve",kt),groupWidth:wt("preserve",kt),sortGroups:wt("preserve",kt),treeOrientation:wt("preserve",kt),edgeType:wt("preserve",kt),padding:wt("preserve",kt),paddingTop:wt("preserve",kt),orbitMode:wt("preserve",kt),orbitSize:wt("preserve",kt),orbitSpeed:wt("preserve",kt),orbitRevolution:wt("preserve",kt),orbitRevolutionStyle:wt("preserve",kt),orbitEccentricity:wt("preserve",kt),orbitShowRings:wt("preserve",kt),orbitAnimated:wt("preserve",kt),customNetworkLayout:wt("preserve",kt),layoutConfig:wt("preserve",kt),nodeSize:wt("preserve",At),nodeSizeRange:wt("preserve",At),colorByDepth:wt("preserve",At),nodeLabel:wt("preserve",Ct),showLabels:wt("preserve",Ct),labelMode:wt("preserve",Ct),nodeStyle:wt("preserve",St),edgeStyle:wt("preserve",St),colorBy:wt("preserve",St),colorScheme:wt("preserve",St),themeCategorical:wt("preserve",St),themeSemantic:wt("preserve",St),edgeColorBy:wt("preserve",St),edgeOpacity:wt("preserve",St),showParticles:wt("preserve",St),particleStyle:wt("preserve",St),decay:wt("preserve",St),pulse:wt("preserve",St),thresholds:wt("preserve",St),staleness:wt("preserve",St),layoutSelection:wt("preserve",St),clock:wt("preserve",Rt),random:wt("preserve",Rt),seed:wt("preserve",Rt),tensionConfig:wt("preserve",Rt),transition:wt("preserve",Rt),introAnimation:wt("preserve",Rt),onLayoutError:wt("preserve",Rt),__skipForceSimulation:wt("preserve",Rt),__hierarchyRoot:wt("preserve",Rt),__orbitState:wt("preserve",Rt),__previousPositions:wt("preserve",Rt)},Tt=wt("preserve",kt),Et=class{constructor(){this.tracker=new Xe}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}},bt)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},_t):this.recordNoop("restyle")}recordConfig(e){const t=function(e){let t="preserve";const o=new Set;for(const n of e){const e=Nt[n]??Tt;"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)}},Pt=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 Et,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={...at,...e.tensionConfig},e.showParticles&&("sankey"===e.chartType||e.customNetworkLayout)&&(this.particlePool=new ct(2e3))}currentTime(){return this.config.clock?.()??me()}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={...at,...o.tensionConfig},!o.showParticles||"sankey"!==o.chartType&&!o.customNetworkLayout||this.particlePool||(this.particlePool=new ct(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:s="id",sourceAccessor:r="source",targetAccessor:i="target",valueAccessor:a="value"}=this.config,l="function"==typeof s?s:e=>e[s],c="function"==typeof r?r:e=>e[r],d="function"==typeof i?i:e=>e[i],u="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,{...gt(e),data:t})}for(let e=0;t.length>e;e++){const o=t[e],n=c(o)+"",s=d(o)+"",r=u(o),i=null==r?NaN:Number(r),a=Number.isFinite(i)?i:1;this.nodes.has(n)||this.nodes.set(n,{...gt(n),data:o}),this.nodes.has(s)||this.nodes.set(s,{...gt(s),data:o});const l=`${n}\0${s}\0${e}`,h={source:n,target:s,value:a,y0:0,y1:0,sankeyWidth:0,data:o,_edgeKey:l};o&&"object"==typeof o&&yt(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,s=0===this.nodes.size;let r=!1;const i=this.currentTime();this.lastIngestTime=i,this._decaySortedNodes=null,this._networkDecayCache=null,this.nodes.has(t)||(this.nodes.set(t,gt(t)),this.nodeTimestamps.set(t,i),this.tension+=this.tensionConfig.newNode,r=!0),this.nodes.has(o)||(this.nodes.set(o,gt(o)),this.nodeTimestamps.set(o,i),this.tension+=this.tensionConfig.newNode,r=!0);const a=this.edgeKey(t,o),l=this.edges.get(a);let c=!1;l?(l.value+=n,this.edgeTimestamps.set(a,i),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,i),this.tension+=this.tensionConfig.newEdge,r=!0);const d=s||r||c||this.tension>=this.tensionConfig.threshold;return this.updateResults.recordData("ingest",1),d}ingestEdgeWithResult(e){return this.ingestEdge(e),this.updateResults.last}runLayout(e){if(this.config.customNetworkLayout)return this.recordTopologyDiff(),void this.layoutVersion++;const t=f(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 s=new Map;for(const e of this.nodes.values())0===e.x&&0===e.y||s.set(e.id,{x:e.x,y:e.y});this._lastPositionSnapshot=s,this.saveTargetPositions();const r=o.some(e=>void 0!==e._prevX0&&(0!==e._prevX0||0!==e._prevX1||0!==e._prevY0||0!==e._prevY1)),i=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&&i>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:i}}else r&&i>0&&(this.restorePreviousPositions(),this.transition={startTime:this.currentTime(),duration:i});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:s,selection:r}){const i=!(!o&&!n);if(o)for(const t of e){const e=s.get(t)??t.style,n=o(t,r);t.style=n?{...e,...n}:e}if(n)for(const e of t){const t=s.get(e)??e.style,o=n(e,r);e.style=o?{...t,...o}:t}return i}({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:s,previousResult:r,revision:i}){const a=Ae(e.colorScheme,e.themeCategorical,Ge),l={nodes:n,edges:s,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:ee(a,e.colorScheme),config:e.layoutConfig??{},selection:e.layoutSelection??null};try{return{kind:"success",result:t(l)}}catch(t){const o=null!==r,n=h("network",t,o,i);"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 z({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=f(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:s,sceneEdges:r,labels:i}=t.buildScene(o,n,this.config,e);this.sceneNodes=s,this.sceneEdges=r,this.labels=i,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 s=0;for(const e of this.sceneNodes)"circle"===e.type&&(n[s++]=e);this._nodeQuadtree=ht().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=f(this.config.chartType);return!!e?.supportsAnimation&&!1!==this.config.orbitAnimated}tickAnimation(e,t){const o=f(this.config.chartType);if(!o?.tick)return!1;const n=o.hierarchical?Array.from(this.nodes.values()):this.nodesArray,s=o.hierarchical?Array.from(this.edges.values()):this.edgesArray;return o.tick(n,s,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=ne(e,this.transition),o=te(t);for(const e of this.nodes.values())void 0===e._targetX0||void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=ue(e._prevX0,e._targetX0,o),e.x1=ue(e._prevX1,e._targetX1,o),e.y0=ue(e._prevY0,e._targetY0,o),e.y1=ue(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=ue(e._prevY0,e._targetY0,o),e.y1=ue(e._prevY1,e._targetY1,o),e.sankeyWidth=ue(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,s="string"==typeof e.target?t.get(e.target):e.target;!n||!s||(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 s=[];for(let e=0;n.length-1>e;e++){const t=n[e],o=n[e+1],r=o.x-t.x,i=o.y-t.y;s.push([t,{x:t.x+r/3,y:t.y+i/3},{x:t.x+2*r/3,y:t.y+2*i/3},o])}return{circular:!0,segments:s,halfWidth:t}}(e):function(e,t,o,n=.5){const s=(e.sankeyWidth||1)/2;if("down"===e.direction){const r=t.x1,i=o.x0,a=mt(r,i);return{circular:!1,points:[{x:e.y0,y:r},{x:e.y0,y:a(n)},{x:e.y1,y:a(1-n)},{x:e.y1,y:i}],halfWidth:s}}const r=t.x1,i=o.x0,a=mt(r,i);return{circular:!1,points:[{x:r,y:e.y0},{x:a(n),y:e.y0},{x:a(1-n),y:e.y1},{x:i,y:e.y1}],halfWidth:s}}(e,n,s,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)",s=t.glowRadius??4,{now:r}=e;for(const t of e.sceneNodes){const i=t.id;if(!i)continue;const a=e.nodeTimestamps.get(i);if(!a)continue;const l=r-a;o>l&&(t._pulseIntensity=1-l/o,t._pulseColor=n,t._pulseGlowRadius=s)}for(const t of e.sceneEdges){const s=t.datum;if(!s)continue;const i="object"==typeof s.source?s.source?.id:s.source,a="object"==typeof s.target?s.target?.id:s.target;if(!i||!a)continue;const l=e.edgeTimestamps.get(`${i}\0${a}`);if(!l)continue;const c=r-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 s of e.sceneNodes){const e=s.id;if(!e)continue;const r=n.get(e);if(void 0===r)continue;const i=u(t,r,o);s.style={...s.style,opacity:(s.style?.opacity??1)*i}}}({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===ft&&(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>=vt)return;const o=1-t/vt;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=ft,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&&vt>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",s=!1!==t.pulse;for(const r of e.sceneNodes){const i=r.id;if(!i)continue;const a=e.nodes.get(i);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&&(r.style={...r.style,fill:c},s&&(r._pulseIntensity=.6+.4*Math.sin(e.now/300),r._pulseColor=c,r._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,s="function"==typeof n?n:n?e=>e[n]:e=>e.value,r=[];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){r.push(n.data?{...n.data}:{}),n.data=o(n.data??{});const e=s(n.data);null!=e&&(n.value=Number(e))}return r.length>0?(this.layoutVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("update",r.length)):this.updateResults.recordNoop("update"),r}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,s]of this.edges)s.data&&n(s.data)===e&&o.push(t)}else for(const[n,s]of this.edges)("string"==typeof s.source?s.source:s.source.id)===e&&("string"==typeof s.target?s.target:s.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")}};Pt.QUADTREE_THRESHOLD=500;var It=Pt;i(It);import*as Dt from"react";import{Fragment as Mt,jsx as zt,jsxs as Lt}from"react/jsx-runtime";function Ht(e){const{width:t,height:o,totalWidth:n,totalHeight:s,margin:r,labels:i,title:a,legend:l,legendHoverBehavior:c,legendClickBehavior:d,legendHighlightedCategory:u,legendIsolatedCategories:h,legendPosition:g="right",legendLayout:y,foregroundGraphics:p,sceneNodes:m,annotations:f,onAnnotationActivate:v,onObservation:b,chartId:_,chartType:w,autoPlaceAnnotations:x,svgAnnotationRules:k}=e,A=je({onAnnotationActivate:v,onObservation:b,chartId:_,chartType:w}),S=Dt.useMemo(()=>{const e=(m||[]).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=Ve(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,qe(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:m}},[o,m,t]),C=Dt.useMemo(()=>{if(!f)return f;const e=Fe(f);return x?$e({annotations:e,context:S,..."object"==typeof x?x:{}}):e},[f,x,S]),R=Dt.useMemo(()=>se("network"),[]),N=C?be(C.filter(e=>"widget"!==e.type),R,k,S):null,T=!0===C?.some(e=>"widget"===e.type&&!0===e._annotationDeferred);return Lt(Mt,{children:[T&&zt("style",{children:j},"annotation-widget-disclosure-style"),Lt("svg",{role:"img",width:n,height:s,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[zt("title",{children:"string"==typeof a?a:"Network Chart"}),zt("desc",{children:"string"==typeof a?a+" (network data visualization)":"Network data visualization"}),Lt("g",{transform:`translate(${r.left},${r.top})`,children:[i.map((e,t)=>zt("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)),N,p]}),a&&"string"==typeof a?zt("text",{x:n/2,y:J,textAnchor:"middle",fontWeight:600,fill:"currentColor",className:"semiotic-chart-title",style:{fontSize:"var(--semiotic-title-font-size, 14px)"},children:a}):a?zt("foreignObject",{x:0,y:0,width:n,height:r.top,children:a}):null,we({legend:l,totalWidth:n,totalHeight:s,margin:r,legendPosition:g,title:a,legendLayout:y,legendHoverBehavior:c,legendClickBehavior:d,legendHighlightedCategory:u,legendIsolatedCategories:h})]}),C?.filter(e=>"widget"===e.type&&e.nodeId&&m).map((e,t)=>{const o=!0===e._annotationDeferred,n=m.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 s=r.left+(n.cx??(null!=n.x&&null!=n.w?n.x+n.w/2:n.x??0)),i=r.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,d=e.height??32,u=e.content??zt("span",{style:{fontSize:18,cursor:"default"},children:"ℹ️"});return zt("div",{...Le(e,A),className:o?"annotation-deferred":void 0,"data-annotation-disclosure":o?"deferred":void 0,style:{position:"absolute",left:s+a-c/2,top:i+l-d/2,width:c,height:d,display:"flex",alignItems:"center",justifyContent:"center",zIndex:5},children:u},"widget-"+t)})]})}Ht.displayName="NetworkSVGOverlay";import*as Wt from"react";import{jsx as Bt}from"react/jsx-runtime";var Ft={position:"absolute",top:0,left:0,pointerEvents:"none"};function Ot({marks:e,margin:t,selection:o=null,overscan:n=400}){const s=Wt.useRef(null),r=function(e,t,o){const[n,s]=Wt.useState(null);return Wt.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 s(null);let n=0;const r=()=>{n=0;const t=o.getBoundingClientRect(),r=e.getBoundingClientRect();s(0!==t.width&&0!==t.height?{scroll:{left:t.left,top:t.top,right:t.right,bottom:t.bottom},originX:r.left,originY:r.top}:null)},i=()=>{0===n&&(n=window.requestAnimationFrame(r))};r(),o.addEventListener("scroll",i,{passive:!0});const a=new ResizeObserver(i);return a.observe(o),()=>{0!==n&&window.cancelAnimationFrame(n),o.removeEventListener("scroll",i),a.disconnect()}},[t,e,o]),Wt.useMemo(()=>{if(!e||!n)return e;const{scroll:t,originX:s,originY:r}=n,i=t.left-o,a=t.right+o,l=t.top-o,c=t.bottom+o;return e.filter(e=>{const t=s+e.x,o=r+e.y;return!(i>t+e.width||t>a||l>o+e.height||o>c)})},[e,n,o])}(e,s,n);if(!e||0===e.length)return null;const i=Bt("div",{className:"semiotic-network-html-marks",ref:s,style:{...Ft,transform:`translate(${t.left}px, ${t.top}px)`},children:(r??e).map(e=>Bt("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?Bt(O,{value:o,children:i}):i}import{jsx as Yt,jsxs as jt}from"react/jsx-runtime";function Xt({props:e,store:t,responsiveRef:o,size:n,margin:s,adjustedWidth:r,adjustedHeight:i,resolvedBackground:a,resolvedForeground:l}){const{chartType:c,nodes:u,edges:h,data:g,className:y,description:p,title:m,responsiveWidth:f,responsiveHeight:v,summary:b,background:_,renderMode:w,legend:x,legendPosition:k,legendLayout:A,legendHoverBehavior:S,legendClickBehavior:R,legendHighlightedCategory:N,legendIsolatedCategories:T,layoutSelection:E,annotations:P,onAnnotationActivate:I,annotationObservationCallback:D,onObservation:M,chartId:z,autoPlaceAnnotations:L,svgAnnotationRules:H}=e;if(t){const e=["tree","cluster","treemap","circlepack","partition","orbit"].includes(c),o=e?g||(Array.isArray(h)?void 0:h):void 0;if(e&&o)t.ingestHierarchy(o,[r,i]),t.buildScene([r,i]);else{const e=ae(u),o=Array.isArray(h)?ae(h):[];(e.length>0||o.length>0)&&(t.ingestBounded(e,o,[r,i]),t.buildScene([r,i]))}}const W=t?.sceneNodes??[],B=t?.sceneEdges??[],F=t?.labels??[];return jt("div",{ref:o,className:"stream-network-frame"+(y?" "+y:""),role:"img","aria-label":p||("string"==typeof m?m:"Network chart"),style:{position:"relative",width:f?"100%":n[0],height:v?"100%":n[1]},children:[Yt(U,{summary:b}),jt("svg",{xmlns:"http://www.w3.org/2000/svg",width:n[0],height:n[1],style:{position:"absolute",left:0,top:0},children:[a&&Yt("g",{transform:`translate(${s.left},${s.top})`,children:a}),jt("g",{transform:`translate(${s.left},${s.top})`,children:[_&&Yt("rect",{x:0,y:0,width:r,height:i,fill:_}),B.map((e,t)=>C({node:e,index:t,renderMode:w,fallback:()=>ge(e,t)})).filter(Boolean),W.map((e,t)=>C({node:e,index:t,renderMode:w,fallback:()=>ye(e,t)})).filter(Boolean),F.map((e,t)=>he(e,t)).filter(Boolean)]})]}),Yt(Ht,{width:r,height:i,totalWidth:n[0],totalHeight:n[1],margin:s,labels:F,sceneNodes:W,title:m,legend:x,legendPosition:k,legendLayout:A,legendHoverBehavior:S,legendClickBehavior:R,legendHighlightedCategory:N,legendIsolatedCategories:T,foregroundGraphics:d(l,Y(t?.customLayoutOverlays,E??null)),annotations:P,onAnnotationActivate:I,onObservation:D??M,chartId:z,chartType:"StreamNetworkFrame",autoPlaceAnnotations:L,svgAnnotationRules:H,annotationFrame:0}),Yt(Ot,{marks:t?.customLayoutHtmlMarks,margin:s,selection:E??null})]})}import{jsx as $t,jsxs as Vt}from"react/jsx-runtime";var Gt=/^(value|amount|total|count|weight|score)$/i;function Qt({data:e}){if("edge"===e.nodeOrEdge){const t=e.data;return t?Vt("div",{className:"semiotic-tooltip",style:Be,children:[Vt("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&&Vt("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 s=e.length-1;return Vt("div",{className:"semiotic-tooltip",style:Be,children:[$t("div",{children:e.map((e,t)=>Vt("span",{children:[t>0&&$t("span",{style:{margin:"0 3px",opacity:.5},children:" → "}),t===s?$t("strong",{children:e}):$t("span",{style:{opacity:.7},children:e})]},t))}),null!=t.value&&t.value>0&&$t("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),s=(t.sourceLinks||[]).reduce((e,t)=>e+(t.value||0),0)+(t.targetLinks||[]).reduce((e,t)=>e+(t.value||0),0),r=Ye(t.data??t),i=null!=r.title?r.title+"":t.id,a=r.entries.some(e=>Gt.test(e.key));return Vt("div",{className:"semiotic-tooltip",style:Be,children:[$t("div",{style:{fontWeight:600},children:i}),r.entries.map(e=>Vt("div",{style:{marginTop:4,opacity:.8},children:[e.key,": ",m(e.value)]},e.key)),!a&&null!=t.value&&t.value>0&&Vt("div",{style:{marginTop:4,opacity:.8},children:["Total:"," ","number"==typeof t.value?t.value.toLocaleString():t.value+""]}),n>0&&Vt("div",{style:{marginTop:4,opacity:.8},children:["Connections: ",n,s!==n&&` (weighted: ${s.toLocaleString()})`]})]})}function qt(e){return e._cachedPath2D&&e._cachedPath2DSource===e.pathD||(e._cachedPath2D=new Path2D(e.pathD),e._cachedPath2DSource=e.pathD),e._cachedPath2D}function Kt(e,t){if(!t.pathD)return;e.save();const o=qt(t);if(t.style.fill&&"none"!==t.style.fill){const n=t._gradient;if(n){const o=e.createLinearGradient(n.x0,0,n.x1,0),s=t.style.fillOpacity??t.style.opacity??.5,r="string"==typeof t.style.fill?t.style.fill:"#999",i=Ke(e,r)||r;o.addColorStop(0,1===n.from?i:"transparent"),o.addColorStop(1,1===n.to?i:"transparent"),e.fillStyle=o,e.globalAlpha=s}else e.fillStyle=ke(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=Ke(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 Ut(e,t){e.save();const o=t.style.stroke||"#999";e.strokeStyle=Ke(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 Zt(e,t){if(!t.pathD)return;e.save();const o=qt(t);t.style.fill&&"none"!==t.style.fill&&(e.fillStyle=ke(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=Ke(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 Jt(e,t){if(!t.pathD)return;e.save();const o=qt(t),n=t.style.stroke||"#999";e.strokeStyle=Ke(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=ke(e,t.style.fill,"#007bff"),e.globalAlpha=t.style.fillOpacity??.1,e.fill(o)),e.restore()}Qt.ownsChrome=!0;var eo=new Map;function to(e){try{if(e.path)return new Path2D(e.path);const t=`${e.symbolType??"circle"}:${Math.round(e.size)}`;let o=eo.get(t);return o||(o=new Path2D(Qe(e.symbolType,e.size)),eo.size>256&&eo.clear(),eo.set(t,o)),o}catch{return null}}function oo(e,t,o,n=30){switch(e.type){case"circle":return function(e,t,o,n=30){const s=t-e.cx,r=o-e.cy,i=Math.sqrt(s*s+r*r);return i>W(e.r,n)?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:i}}(e,t,o,n);case"rect":return function(e,t,o){const n=B(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,s=o-e.cy,r=Math.sqrt(n*n+s*s);if(e.innerR-2>r||r>e.outerR+2)return null;const i=F(Math.atan2(s,n)),a=F(e.startAngle),l=F(e.endAngle);if(a>l?i>=a||l>=i:i>=a&&l>=i){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 s=t-e.cx,r=o-e.cy,i=Math.sqrt(s*s+r*r);return i>W(qe(e.size),n)?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:i}}(e,t,o,n);case"glyph":return function(e,t,o,n=30){if(null==e.datum)return null;const s=Ve(e.glyph,e.size),r=e.cx+s.centerDx,i=e.cy+s.centerDy,a=t-r,l=o-i,c=Math.sqrt(a*a+l*l);return c>W(s.radius,n)?null:{type:"node",datum:e.datum,x:r,y:i,distance:c}}(e,t,o,n);default:return null}}var no=null,so=null;function ro(){return so||((no=document.createElement("canvas")).width=1,no.height=1,so=no.getContext("2d")),so}function io(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 ao(e,t,o){switch(e.type){case"bezier":return function(e,t,o){if(!e.pathD)return null;const n=io(e),s=ro();if(!n||!s)return null;try{if(s.isPointInPath(n,t,o))return{type:"edge",datum:e.datum,x:t,y:o,distance:0};const r=s.lineWidth;s.lineWidth=10;const i=s.isPointInStroke(n,t,o);if(s.lineWidth=r,i)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,s=e.y2-e.y1,r=n*n+s*s;if(0===r)return null;let i=((t-e.x1)*n+(o-e.y1)*s)/r;i=Math.max(0,Math.min(1,i));const a=e.x1+i*n,l=e.y1+i*s,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=io(e),s=ro();if(!n||!s)return null;try{if(s.isPointInPath(n,t,o))return{type:"edge",datum:e.datum,x:t,y:o,distance:0};const r=s.lineWidth;s.lineWidth=10;const i=s.isPointInStroke(n,t,o);if(s.lineWidth=r,i)return{type:"edge",datum:e.datum,x:t,y:o,distance:4}}catch{}return null}(e,t,o);default:return null}}function lo(e){const{clientX:t,clientY:o,canvasRect:n,margin:s,adjustedWidth:r,adjustedHeight:i,sceneNodes:a,sceneEdges:l,nodeQuadtree:c,maxNodeRadius:d,hitRadius:u=30}=e,h=t-n.left-s.left,g=o-n.top-s.top;if(0>h||h>r||0>g||g>i)return{kind:"miss-outside"};const y=function(e,t,o,n,s=30,r,i=0){let a=null,l=s,c=1/0;if(r){const e=p(r,o,n,s,i,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(r&&"circle"===t.type)continue;const e=oo(t,o,n,s);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=ao(e,o,n);t&&l>t.distance&&(a=t,l=t.distance)}return a}(a,l,h,g,u,c,d);return y?{kind:"hit",hover:We(y.datum||{},y.x,y.y,{nodeOrEdge:y.type})}:{kind:"miss"}}import{useCallback as co}from"react";var uo="StreamNetworkFrame";import{jsx as ho,jsxs as go}from"react/jsx-runtime";var yo={top:20,right:80,bottom:20,left:80},po={top:40,right:40,bottom:40,left:40},mo=new Set(["chord","force","circlepack","orbit"]),fo=[800,600],vo=it(rt(function(r,i){const{chartType:a,nodes:c,edges:u,data:h,initialEdges:g,nodeIDAccessor:p="id",sourceAccessor:m="source",targetAccessor:f="target",valueAccessor:w="value",edgeIdAccessor:C,childrenAccessor:R,hierarchySum:N,orientation:T="horizontal",nodeAlign:z="justify",nodePaddingRatio:L=.05,nodeWidth:H=15,iterations:W=300,forceStrength:B=.1,layoutExecution:F="auto",layoutLoadingContent:O,onLayoutStateChange:j,padAngle:J=.01,groupWidth:ee=20,sortGroups:te,edgeSort:ne,treeOrientation:se="vertical",edgeType:ue="curve",padding:he,paddingTop:ge,tensionConfig:ye,showParticles:pe=!1,particleStyle:me,renderMode:be,nodeStyle:_e,edgeStyle:we,colorBy:Ae,colorScheme:Ce="category10",edgeColorBy:Re="source",edgeOpacity:Ne=.5,colorByDepth:Te=!1,nodeSize:ze=8,nodeSizeRange:Le=[5,20],nodeLabel:He,showLabels:Be=!0,labelMode:Fe,size:Ye=fo,responsiveWidth:je,responsiveHeight:Xe,margin:$e,className:Ve,background:Ge,enableHover:Qe=!0,tooltipContent:qe,customHoverBehavior:rt,customClickBehavior:it,onObservation:ct,annotationObservationCallback:dt,chartId:ut,onTopologyChange:ht,annotations:gt,onAnnotationActivate:yt,autoPlaceAnnotations:pt,svgAnnotationRules:mt,legend:ft,legendPosition:vt,legendLayout:bt,legendHoverBehavior:_t,legendClickBehavior:wt,legendHighlightedCategory:xt,legendIsolatedCategories:kt,title:At,foregroundGraphics:St,backgroundGraphics:Ct,decay:Rt,pulse:Nt,transition:Tt,animate:Et,staleness:Pt,frameScheduler:Dt,clock:Mt,random:zt,seed:Lt,paused:Wt=!1,suspendWhenHidden:Bt=!0,thresholds:Ft,accessibleTable:Yt=!0,description:jt,summary:$t,orbitMode:Vt,orbitSize:Gt,orbitSpeed:qt,orbitRevolution:eo,orbitRevolutionStyle:oo,orbitEccentricity:no,orbitShowRings:so,orbitAnimated:ro,customNetworkLayout:io,onLayoutError:ao,layoutConfig:vo,layoutSelection:bo}=r,_o=mo.has(a)?po:yo,wo=Je(!0),xo=Ee({sizeProp:Ye,responsiveWidth:je,responsiveHeight:Xe,userMargin:$e,marginDefault:_o,title:At,legend:ft,legendPosition:vt,foregroundGraphics:St,backgroundGraphics:Ct,animate:Et,transitionProp:Tt,frameScheduler:Dt,clock:Mt,random:zt,seed:Lt,paused:Wt,suspendWhenHidden:Bt,themeDirtyRef:wo}),{reducedMotionRef:ko,responsiveRef:Ao,size:So,margin:Co,adjustedWidth:Ro,adjustedHeight:No,resolvedForeground:To,resolvedBackground:Eo,transition:Po,introEnabled:Io,tableId:Do,rafRef:Mo,renderFnRef:zo,scheduleRender:Lo,frameRuntime:Ho,currentTheme:Wo}=xo,Bo=Ie(),Fo=Me(),Oo=ot(()=>ae(c),[c]),Yo=ot(()=>Array.isArray(u)?ae(u):u,[u]),jo=ot(()=>({...at,...ye}),[ye]),Xo=ot(()=>({...lt,...me}),[me]),$o=ot(()=>{return{chartType:(e={chartType:a,clock:Ho.now,random:zt,seed:Lt,nodeIDAccessor:p,sourceAccessor:m,targetAccessor:f,valueAccessor:w,edgeIdAccessor:C,childrenAccessor:R,hierarchySum:N,orientation:T,nodeAlign:z,nodePaddingRatio:L,nodeWidth:H,iterations:W,forceStrength:B,padAngle:J,groupWidth:ee,sortGroups:te,edgeSort:ne,treeOrientation:se,edgeType:ue,padding:he,paddingTop:ge,tensionConfig:jo,showParticles:pe,particleStyle:Xo,nodeStyle:_e,edgeStyle:we,nodeLabel:He,showLabels:Be,labelMode:Fe,colorBy:Ae,colorScheme:Ce,edgeColorBy:Re,edgeOpacity:Ne,colorByDepth:Te,nodeSize:ze,nodeSizeRange:Le,decay:Rt,pulse:Nt,transition:Po,introAnimation:Io,staleness:Pt,thresholds:Ft,orbitMode:Vt,orbitSize:Gt,orbitSpeed:qt,orbitRevolution:eo,orbitRevolutionStyle:oo,orbitEccentricity:no,orbitShowRings:so,orbitAnimated:ro,customNetworkLayout:io,onLayoutError:ao,layoutConfig:vo,currentTheme:Wo}).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:Ue(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},[a,Ho.now,zt,Lt,p,m,f,w,C,R,N,T,z,L,H,W,B,J,ee,te,ne,se,ue,he,ge,jo,pe,Xo,_e,we,He,Be,Fe,Ae,Ce,Re,Ne,Te,ze,Le,Rt,Nt,Po,Io,Pt,Ft,Vt,Gt,qt,eo,oo,no,so,ro,io,ao,vo,Wo]),Vo=D($o),Go=D({chartType:(Qo={chartType:a,nodeIDAccessor:p,sourceAccessor:m,targetAccessor:f,valueAccessor:w,edgeIdAccessor:C,childrenAccessor:R,hierarchySum:N,orientation:T,nodeAlign:z,nodePaddingRatio:L,nodeWidth:H,iterations:W,forceStrength:B,padAngle:J,groupWidth:ee,sortGroups:te,edgeSort:ne,treeOrientation:se,edgeType:ue,padding:he,paddingTop:ge,random:zt,seed:Lt,tensionConfig:jo,customNetworkLayout:io,orbitMode:Vt,orbitSize:Gt,orbitEccentricity:no}).chartType,nodeIDAccessor:Qo.nodeIDAccessor,sourceAccessor:Qo.sourceAccessor,targetAccessor:Qo.targetAccessor,valueAccessor:Qo.valueAccessor,edgeIdAccessor:Qo.edgeIdAccessor,childrenAccessor:Qo.childrenAccessor,hierarchySum:Qo.hierarchySum,orientation:Qo.orientation,nodeAlign:Qo.nodeAlign,nodePaddingRatio:Qo.nodePaddingRatio,nodeWidth:Qo.nodeWidth,iterations:Qo.iterations,forceStrength:Qo.forceStrength,padAngle:Qo.padAngle,groupWidth:Qo.groupWidth,sortGroups:Qo.sortGroups,edgeSort:Qo.edgeSort,treeOrientation:Qo.treeOrientation,edgeType:Qo.edgeType,padding:Qo.padding,paddingTop:Qo.paddingTop,random:Qo.random,seed:Qo.seed,tensionConfig:Qo.tensionConfig,customNetworkLayout:Qo.customNetworkLayout,orbitMode:Qo.orbitMode,orbitSize:Qo.orbitSize,orbitEccentricity:Qo.orbitEccentricity});var Qo;const qo=Je(0),Ko=Je(0),Uo=Je(!1),Zo=Je(null);Zo.current||(Zo.current=new It(Vo));const Jo=De("StreamNetworkFrame"),en=nt((e,t,o=!1)=>Se(Jo.current,e,()=>e.buildScene(t),o),[Jo]),[tn,on]=et(null),[nn,sn]=et(0),[rn,an]=et(0),[ln,cn]=et(!1),[dn,un]=et(!1),hn=Je(0),gn=Je(null),yn=Je(!1),pn=Je(j);pn.current=j;const mn=Je(Vo);mn.current=Vo;const fn=Je(null),vn=Je(new Map),bn=Je(0),_n=nt(e=>function(e){const{node:t,colorBy:o,colorScheme:n,nodeColorMap:s,colorIndexRef:r}=e;if("function"==typeof o)return o(t)+"";if("string"==typeof o&&t.data){const e=t.data[o];if(void 0!==e){if(!s.has(e+"")){const t=Array.isArray(n)?n:V;s.set(e+"",t[r.current++%t.length])}return s.get(e+"")}}if(s.has(t.id))return s.get(t.id);const i=Array.isArray(n)?n:V,a=o?i[r.current++%i.length]:i[0];return s.set(t.id,a),a}({node:e,colorBy:Ae,colorScheme:Ce,nodeColorMap:vn.current,colorIndexRef:bn}),[Ae,Ce]),wn=nt(e=>{bn.current=function(e){const{sceneNodes:t,nodes:o,nodeColorMap:n,colorScheme:s}=e;for(const e of t)e.id&&"string"==typeof e.style?.fill&&n.set(e.id,e.style.fill);const r=Array.isArray(s)?s:V,i=Array.from(o);for(let e=0;i.length>e;e++){const t=i[e];n.has(t.id)||n.set(t.id,r[e%r.length])}return i.length}({sceneNodes:e.sceneNodes,nodes:e.nodes.values(),nodeColorMap:vn.current,colorScheme:Ce})},[Ce]),xn=nt((e,t)=>{en(e,t),wn(e),wo.current=!1,e.markStylePaintPending()},[en,wn]),kn=(An=Wo,An?.colors?.border||An?.colors?.secondary||An?.colors?.primary||"#999");var An;const Sn=nt(e=>function(e,t){return e?"object"==typeof e?e:t?.get(e)??null:null}(e,Zo.current?.nodes),[]),Cn=nt(e=>function(e){const{edge:t,edgeColorBy:o,getNodeColor:n,resolveEndpoint:s,fallback:r}=e;if("function"==typeof o)return o(t);const i=s(t.source),a=s(t.target);return"target"===o&&a?n(a):i?n(i):r}({edge:e,edgeColorBy:Re,getNodeColor:_n,resolveEndpoint:Sn,fallback:kn}),[Re,_n,kn,Sn]),Rn=nt(e=>function(e){const{edge:t,particleStyleColor:o,particleColorBy:n,hasExplicitParticleColorBy:s,getEdgeColor:r,getNodeColor:i,resolveEndpoint:a,fallback:l}=e;if("function"==typeof o){const e=a(t.source);return e?o(t,e):l}if(!s)return r(t);const c=n,d=a(t.source),u=a(t.target);return"target"===c&&u?i(u):d?i(d):l}({edge:e,particleStyleColor:Xo.color,particleColorBy:Xo.colorBy,hasExplicitParticleColorBy:!!me?.colorBy,getEdgeColor:Cn,getNodeColor:_n,resolveEndpoint:Sn,fallback:kn}),[me?.colorBy,Xo.color,Xo.colorBy,_n,Cn,kn,Sn]),Nn=function(e,t,o,n,s){return("sankey"===e||t)&&o||n||s}(a,!!io,pe,!!Nt,Zo.current?.isAnimating??!1);P(Zo,Vo,wo,Lo),I(Zo,bo,wo,Lo),tt(()=>{const e=Zo.current;e&&(xn(e,[Ro,No]),Lo())},[Wo,Ro,No,xn,Lo]);const Tn=nt(()=>{const e=Zo.current;if(e&&(e.runLayout([Ro,No]),xn(e,[Ro,No]),sn(e.layoutVersion),ht)){const{nodes:t,edges:o}=e.getLayoutData();ht(t,o)}},[Ro,No,xn,ht]),En=Je(!1),Pn=nt((e=!1)=>!(!e&&!En.current||(En.current=!1,Tn(),0)),[Tn]),In=nt(()=>Pn(!1),[Pn]),Dn=nt(e=>{const t=Zo.current;if(!t)return!1;let o=!1,n=En.current;for(const s of e)null!=s&&"object"==typeof s&&(o=!0,t.ingestEdge(s)&&(n=!0));const s=Pn(n);return o||s},[Pn]),Mn=nt(e=>{if(null==e||"object"!=typeof e)return;const t=Zo.current;t&&(t.ingestEdge(e)&&(En.current=!0),Ho.isActive?Lo():In())},[In,Ho,Lo]),zn=nt(e=>{Dn(e)&&Lo()},[Dn,Lo]);tt(()=>Ho.subscribe(()=>{Ho.isActive||In()}),[In,Ho]);const Ln=nt(()=>{En.current=!1,Zo.current?.clear(),vn.current.clear(),bn.current=0,sn(Zo.current?.layoutVersion??0),on(null),fn.current=null,wo.current=!0,Lo()},[Lo]),Hn=nt(()=>{const e=Zo.current;e&&(e.tension+=999,Pn(!0),Lo())},[Pn,Lo]);st(i,()=>({push:Mn,pushMany:zn,removeNode:e=>{const t=Zo.current?.removeNode(e)??!1;if(t){const t=fn.current?.data?"function"==typeof p?p(fn.current.data):fn.current.data[p]:void 0;fn.current&&"node"===fn.current.nodeOrEdge&&t===e&&(fn.current=null,on(null)),vn.current.delete(e)}return Pn(t)&&(wo.current=!0,Lo()),t},removeEdge:(e,t)=>{const o=Zo.current?.removeEdge(e,t)??!1;if(o&&fn.current&&"edge"===fn.current.nodeOrEdge){const o=fn.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:!C||!o||("function"==typeof C?C:e=>e?.[C])(o)===e,n&&(fn.current=null,on(null))}return Pn(o)&&(wo.current=!0,Lo()),o},updateNode:(e,t)=>{const o=Zo.current?.updateNode(e,t)??null;return Pn(null!==o)&&(wo.current=!0,Lo()),o},updateEdge:(e,t,o)=>{const n=Zo.current?.updateEdge(e,t,o)??[];return Pn(n.length>0)&&(wo.current=!0,Lo()),n},clear:Ln,getTopology:()=>(In(),Zo.current?.getLayoutData()??{nodes:[],edges:[]}),getCustomLayout:()=>(In(),Zo.current?.lastCustomLayoutResult??null),getLayoutFailure:()=>(In(),Zo.current?.lastCustomLayoutFailure??null),getTopologyDiff:()=>{In();const e=Zo.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:Hn,getTension:()=>(In(),Zo.current?.tension??0)}),[Mn,zn,Ln,Hn,In,Pn,p,Lo,C]);const Wn=["tree","cluster","treemap","circlepack","partition","orbit"].includes(a),Bn=Wn?h||(Array.isArray(u)?void 0:u):void 0;tt(()=>{const s=Zo.current;if(!s)return;const r=++hn.current;if(gn.current?.abort(),gn.current=null,Wn&&Bn)En.current=!1,s.ingestHierarchy(Bn,[Ro,No]),xn(s,[Ro,No]),un(!1),pn.current?.("ready"),Lo();else{const i=Oo,l=Array.isArray(Yo)?Yo:[];if(null==c&&null==u||(En.current=!1),0===i.length&&0===l.length)return null==c&&null==u||0>=s.nodes.size&&0>=s.edges.size||Ln(),un(!1),void pn.current?.("ready");const d=[Ro,No],h="force"===a&&!io&&e()&&!zt&&n(F,i.length,l.length,W);if(h&&Fo&&!yn.current&&s.sceneNodes.length>0)return yn.current=!0,un(!1),pn.current?.("ready"),wo.current=!0,void Lo();if(h){const e=new AbortController;gn.current=e;const n=s._lastPositionSnapshot;s.ingestBounded(i,l,d,{deferLayout:!0});const a=s.getLayoutData(),c=t(a.nodes,a.edges,mn.current,d,n);return un(!0),pn.current?.("pending"),o(c,e.signal).then(({positions:e})=>{r===hn.current&&(s.applyForceLayoutPositions(e,d),xn(s,d),un(!1),pn.current?.("ready"),sn(s.layoutVersion),Lo())}).catch(e=>{"AbortError"!==e.name&&r===hn.current&&(s.runLayout(d),xn(s,d),un(!1),pn.current?.("error"),sn(s.layoutVersion),Lo())}),()=>e.abort()}s.ingestBounded(i,l,d),xn(s,d),un(!1),pn.current?.("ready"),Lo()}},[Oo,Yo,c,u,h,Bn,Wn,Ro,No,Go,F,W,Fo,a,io,zt,Lo,Ln,xn]);const Fn=Ze.useRef(!1);tt(()=>{Fn.current||g&&g.length>0&&(Fn.current=!0,zn(g))},[g,zn]);const{customHoverBehavior:On,customClickBehavior:Yn}=function({customHoverBehavior:e,customClickBehavior:t,onObservation:o,chartId:n}){return{customHoverBehavior:co((t,s)=>{e?.(t,s),ie({onObservation:o,datum:t?t.data||t:null,x:t?.x,y:t?.y,chartType:uo,chartId:n,context:s})},[e,o,n]),customClickBehavior:co((e,s)=>{t?.(e,s),re({onObservation:o,datum:e?e.data||e:null,x:e?.x,y:e?.y,chartType:uo,chartId:n,context:s})},[t,o,n])}}({customHoverBehavior:rt,customClickBehavior:it,onObservation:ct,chartId:ut}),{hoverHandlerRef:jn,hoverLeaveRef:Xn,onPointerMove:$n,onPointerLeave:Vn}=xo,Gn=()=>!io||(Zo.current?.hasCustomRestyle??!1);jn.current=e=>{if(!Qe)return;const t=Gn(),o=ts.current;if(!o)return;const n=Zo.current;if(!n)return;const s=lo({clientX:e.clientX,clientY:e.clientY,canvasRect:o.getBoundingClientRect(),margin:Co,adjustedWidth:Ro,adjustedHeight:No,sceneNodes:n.sceneNodes,sceneEdges:n.sceneEdges,nodeQuadtree:n.nodeQuadtree,maxNodeRadius:n.maxNodeRadius});"hit"===s.kind?(fn.current=s.hover,on(s.hover),On&&(On(s.hover),t&&(wo.current=!0)),t&&Lo()):fn.current&&(fn.current=null,on(null),On&&(On(null),t&&(wo.current=!0)),t&&Lo())},Xn.current=()=>{if(fn.current){const e=Gn();fn.current=null,on(null),On&&(On(null),e&&(wo.current=!0)),e&&Lo()}};const Qn=Je(()=>{});Qn.current=e=>{if(Oe(e.target))return;if(!it&&!ct)return;const t=ts.current;if(!t)return;const o=Zo.current;if(!o)return;const n=lo({clientX:e.clientX,clientY:e.clientY,canvasRect:t.getBoundingClientRect(),margin:Co,adjustedWidth:Ro,adjustedHeight:No,sceneNodes:o.sceneNodes,sceneEdges:o.sceneEdges,nodeQuadtree:o.nodeQuadtree,maxNodeRadius:o.maxNodeRadius});"hit"===n.kind?Yn(n.hover,{type:"activate",inputType:fe(e.nativeEvent.pointerType)}):"miss"===n.kind&&Yn(null)};const qn=nt(e=>Qn.current(e),[]),Kn=Je(-1),Un=Je(null),Zn=Je(-1),Jn=nt(e=>{if(ce(e))return;const t=Zo.current;if(!t)return;const o=()=>{Kn.current=-1,Un.current=null,Zn.current=-1,fn.current=null,on(null),On&&(On(null),wo.current=!0),Lo()},n=y(t.sceneNodes);if(0===n.length)return void(0>Kn.current||o());const s=l(n);let r=Kn.current;if(s.flat.length>r||(o(),r=-1)," "===e.key&&r>=0){e.preventDefault();const t=s.flat[r];return void Yn(We(t.datum||{},t.x,t.y,{nodeOrEdge:"node"}),{type:"activate",inputType:"keyboard"})}if(0>r){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown","Enter"].includes(e.key))return;e.preventDefault(),Kn.current=0,Zn.current=-1;const t=s.flat[0];Un.current={shape:t.shape,w:t.w,h:t.h};const o=We(t.datum||{},t.x,t.y,{nodeOrEdge:"node"});return fn.current=o,on(o),On&&(On(o,{type:"focus",inputType:"keyboard"}),wo.current=!0),void Lo()}const i=E(s,r),a=_(e.key,i,s,t.sceneEdges??[],Zn);if(null===a)return;if(e.preventDefault(),0>a)return void o();Kn.current=a;const c=s.flat[a];Un.current={shape:c.shape,w:c.w,h:c.h};const d={data:c.datum||{},x:c.x,y:c.y,__semioticHoverData:!0,nodeOrEdge:"node"};fn.current=d,on(d),On&&(On(d,{type:"focus",inputType:"keyboard"}),wo.current=!0),Lo()},[Yn,On,Lo]),es=nt(e=>{Kn.current=-1,Un.current=null,$n(e)},[$n]);zo.current=()=>{if(Mo.current=null,In(),!Ho.isActive)return;const e=ts.current;if(!e)return;const t=Zo.current;t&&function(e){const{canvas:t,store:o,sceneRevisionDiagnostics:n,size:s,margin:r,adjustedWidth:i,adjustedHeight:a,background:l,renderMode:c,hasBackgroundGraphics:d=!1,dirtyRef:u,lastFrameTimeRef:h,now:g,random:y,reducedMotion:p,showParticles:m,isContinuous:f,animate:_,decay:w,pulse:C,thresholds:R,staleness:N,particleStyle:T,getParticleColor:E,pendingAnnotationFrameRef:P,lastAnnotationFrameTimeRef:I,setAnnotationFrame:D,scheduleNextFrame:M,syncColorMap:z}=e,L=t.getContext("2d");if(!L)return;const H=h.current?Math.min((g-h.current)/1e3,.1):.016;h.current=g;const W=o.advanceTransition(p?g+1e6:g),B=!p&&W,F=!p&&o.tickAnimation([i,a],H),O=u.current,Y=n?.beforeCompute(o.getLastUpdateResult(),B),j=W||O||F;j&&(o.buildScene([i,a]),O&&z?.()),Y&&n?.afterCompute(Y,j,!1);const X=m&&!p&&!!o.particlePool,$=!!w||!!C||!!R||!1!==_&&o.hasActiveTopologyDiff||o.hasActivePulses||o.hasActiveThresholds,V=o.consumeStylePaintPending(),G=v({dirtyOrRebuilt:O,transitioning:B,animationTicked:F,continuous:X||f,liveEncoding:$,forced:V}),Q=!!N&&o.lastIngestTime>0&&g-o.lastIngestTime>(N?.threshold??5e3);if(G){const e=le();if(!ve(t,s,r,e))return;if(L.clearRect(-r.left,-r.top,s[0],s[1]),x(L,{background:l,hasBackgroundGraphics:d,width:i,height:a}),w&&o.applyDecay(),C&&o.applyPulse(g),R&&o.applyThresholds(g),!1!==_&&o.applyTopologyDiff(g),Q&&(L.globalAlpha=N?.dimOpacity??.5),k({context:L,nodes:o.sceneEdges,renderMode:c,pixelRatio:e,paintBuiltIn:e=>function(e,t){for(const o of t)switch(o.type){case"bezier":Kt(e,o);break;case"line":Ut(e,o);break;case"ribbon":Zt(e,o);break;case"curved":Jt(e,o)}}(L,e)}),k({context:L,nodes:o.sceneNodes,renderMode:c,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),t.style.fill&&(e.fillStyle=ke(e,t.style.fill,"#007bff"),void 0!==t.style.fillOpacity&&(e.globalAlpha=(t.style.opacity??1)*t.style.fillOpacity),e.fillRect(t.x,t.y,t.w,t.h)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ke(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??1,e.globalAlpha=t.style.opacity??1,e.strokeRect(t.x,t.y,t.w,t.h)),S(e,t),e.restore())}}(L,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),t.style.fill&&(e.fillStyle=ke(e,t.style.fill,"#007bff"),void 0!==t.style.fillOpacity&&(e.globalAlpha=(t.style.opacity??1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ke(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??1,e.globalAlpha=t.style.opacity??1,e.stroke()),A(e,t),e.restore())}}(L,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(),t.style.fill&&(e.fillStyle=ke(e,t.style.fill,"#007bff"),void 0!==t.style.fillOpacity&&(e.globalAlpha=(t.style.opacity??1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ke(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??1,e.globalAlpha=t.style.opacity??1,e.stroke()),e.restore()}}(L,t),function(e,t){const o=e.globalAlpha;for(const n of t){if("symbol"!==n.type)continue;const t=n;if(0>=t.size)continue;const s=to(t);if(!s)continue;e.save(),e.translate(t.cx,t.cy),t.rotation&&e.rotate(t.rotation);const r=t.style.opacity??1;t.style.fill&&(e.globalAlpha=o*r*(t.style.fillOpacity??1),e.fillStyle=ke(e,t.style.fill,"#007bff"),e.fill(s)),t.style.stroke&&"none"!==t.style.stroke&&(e.globalAlpha=o*r,e.strokeStyle=Ke(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??1,e.stroke(s)),e.restore()}}(L,t),b(L,t)}}),X&&!Q){const e=o.edgesArray;if(e.length>0){!function(e,t,o,n,s=Math.random){const r=n.spawnRate??.1,i=n.maxPerEdge??50;for(let n=0;t.length>n;n++){const a=t[n];if(!a.bezier)continue;if(e.countForEdge(n)>=i)continue;const l=a.value*r*o*(a.bezier.circular?.3:1),c=Math.floor(l),d=l-c;let u=c;s()<d&&u++;for(let t=0;u>t&&e.countForEdge(n)<i;t++)e.spawn(n,s)}}(o.particlePool,e,H,T,y);const t=.5*(T.speedMultiplier??1);let n;if(T.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(H,t,e,n),function(e,t,o,n,s){const r=n.radius??3;e.globalAlpha=n.opacity??.7;for(let i=0;t.particles.length>i;i++){const a=t.particles[i];if(!a.active)continue;const l=o[a.edgeIndex];if(!l)continue;let c;c="string"==typeof n.color&&"inherit"!==n.color?n.color:s(l),e.fillStyle=Ke(e,c)||c,e.beginPath(),e.arc(a.x,a.y,r,0,2*Math.PI),e.fill()}e.globalAlpha=1}(L,o.particlePool,e,T,E)}}Q&&(L.globalAlpha=1)}u.current=!1,(O||B||F)&&t.setAttribute("aria-label",oe(o.sceneNodes?.length??0,o.sceneEdges?.length??0,"Network chart"));const q=O||B||F||P.current;q&&g-I.current>=33?(D(e=>e+1),I.current=g,P.current=!1):P.current=!!q,(f||B||null!=o.transition||F||o.hasActivePulses||o.hasActiveThresholds||!1!==_&&o.hasActiveTopologyDiff||P.current)&&M()}({canvas:e,store:t,sceneRevisionDiagnostics:Jo.current,size:So,margin:Co,adjustedWidth:Ro,adjustedHeight:No,background:Ge,renderMode:be,hasBackgroundGraphics:!!Ct,dirtyRef:wo,lastFrameTimeRef:qo,now:Ho.now(),random:Ho.random,reducedMotion:!!ko.current,showParticles:pe,isContinuous:Nn,animate:Et,decay:Rt,pulse:Nt,thresholds:Ft,staleness:Pt,particleStyle:Xo,getParticleColor:Rn,pendingAnnotationFrameRef:Uo,lastAnnotationFrameTimeRef:Ko,setAnnotationFrame:an,scheduleNextFrame:()=>{Lo()},syncColorMap:()=>wn(t)})};const{canvasRef:ts}=Pe(xo,{hydrated:Bo,wasHydratingFromSSR:Fo,storeRef:Zo,dirtyRef:wo,skipInitialCanvasPaintInvalidation:!0,canvasPaintDependencies:[a,Ro,No,Ge,Ct,be,Lo]});M(Pt,Zo,wo,Lo,ln,cn);const os=Qe&&tn?ho(G,{x:tn.x,y:tn.y,containerWidth:Ro,containerHeight:No,margin:Co,className:"stream-network-tooltip",zIndex:2,children:qe?qe(tn):ho(Qt,{data:tn})}):null;if(de||!Bo&&Fo)return ho(Xt,{props:r,store:Zo.current,responsiveRef:Ao,size:So,margin:Co,adjustedWidth:Ro,adjustedHeight:No,resolvedBackground:Eo,resolvedForeground:To});const ns=Zo.current;return go("div",{ref:Ao,className:"stream-network-frame"+(Ve?" "+Ve:""),role:"group","aria-label":jt||("string"==typeof At?At:"Network chart"),tabIndex:0,"aria-busy":dn||void 0,style:{position:"relative",width:je?"100%":So[0],height:Xe?"100%":So[1],overflow:"visible"},onKeyDown:Jn,children:["production"!==process.env.NODE_ENV&&Zo.current&&ho(K,{store:Zo.current,diagnostics:Jo.current}),Yt&&ho(Z,{tableId:Do}),Yt&&ho(q,{nodes:ns?.sceneNodes??[],edges:ns?.sceneEdges??[],chartType:"Network chart",tableId:Do,chartTitle:"string"==typeof At?At:void 0}),ho(U,{summary:$t}),ho(X,{hoverPoint:tn}),go("div",{role:"img","aria-label":jt||("string"==typeof At?At:"Network chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Qe?es:void 0,onMouseLeave:Qe?Vn:void 0,onClick:it||ct?qn:void 0,children:[dn&&!1!==O&&ho("div",{style:{position:"absolute",inset:0,zIndex:3,background:"var(--semiotic-bg, #fff)"},children:xe(!0,So[0],So[1],O)}),ho($,{size:So,margin:Co,overflowVisible:!0,children:Eo}),ho("canvas",{ref:ts,"aria-label":oe(ns?.sceneNodes?.length??0,ns?.sceneEdges?.length??0,"Network chart"),style:{position:"absolute",top:0,left:0}}),ho(Ht,{width:Ro,height:No,totalWidth:So[0],totalHeight:So[1],margin:Co,labels:ns?.labels||[],sceneNodes:ns?.sceneNodes,title:At,legend:ft,legendPosition:vt,legendLayout:bt,legendHoverBehavior:_t,legendClickBehavior:wt,legendHighlightedCategory:xt,legendIsolatedCategories:kt,foregroundGraphics:d(To,Y(Zo.current?.customLayoutOverlays,bo??null)),annotations:gt,onAnnotationActivate:yt,onObservation:dt??ct,chartId:ut,chartType:"StreamNetworkFrame",autoPlaceAnnotations:pt,svgAnnotationRules:mt,annotationFrame:rn}),ho(Ot,{marks:ns?.customLayoutHtmlMarks,margin:Co,selection:bo??null}),ho(Q,{active:Kn.current>=0,hoverPoint:tn,margin:Co,size:So,shape:Un.current?.shape,width:Un.current?.w,height:Un.current?.h}),os,Pt?.showBadge&&ho(s,{isStale:ln,position:Pt.badgePosition})]})]})}));vo.displayName="StreamNetworkFrame";var bo=vo,_o=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}},wo=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 s=Math.floor((e-this.size)/o)+1;n>=s;s++)this.bump(s*o,t)}bump(e,t){let o=this.windows.get(e);o||(o=new _o,this.windows.set(e,o)),o.push(t)}pushSession(e,t){const o=this.gap,n=new _o;n.push(t);let s=e,r=e;const i=[],a={start:s,end:r,stats:n};for(const t of this.sessions)e-o>t.end||t.start>e+o?i.push(t):(a.stats.merge(t.stats),s>t.start&&(s=t.start),t.end>r&&(r=t.end));a.start=s,a.end=r,i.push(a),i.sort((e,t)=>e.start-t.start),this.sessions=i}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 xo(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}}function ko(e,t,o,n=1){if("none"===t)return null;if("minmax"===t)return[e.min,e.max];const s=xo(e,o),r=e.stddev*n;return[s-r,s+r]}var Ao={ms:1,s:1e3,m:6e4,h:36e5,d:864e5},So=/(\d+(?:\.\d+)?)(ms|s|m|h|d)/g;function Co(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;So.lastIndex=0;let o,n=0,s=0;for(;null!==(o=So.exec(t));){const e=parseFloat(o[1]),t=Ao[o[2]];if(null==t||!Number.isFinite(e))return null;n+=e*t,s+=o[0].length}return s!==t.length?null:n>0?n:null}var Ro=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}};import{useRef as No,useImperativeHandle as To,forwardRef as Eo,useCallback as Po,useState as Io,useEffect as Do}from"react";import{jsx as Mo,jsxs as zo}from"react/jsx-runtime";var Lo={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"},Ho={opacity:.7,marginRight:4};function Wo(e,t,o){if(null!=e)return"function"==typeof t?t(e):e["string"==typeof t?t:o]}function Bo(e){return null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+""}function Fo(e={}){const{timeAccessor:t,valueAccessor:o,xLabel:n="x",yLabel:s="y"}=e;return e=>{const r=e?.data??null,i=Wo(r,t,"time"),a=Wo(r,o,"value");return zo("div",{className:"semiotic-tooltip",style:Lo,children:[zo("div",{children:[zo("span",{style:Ho,children:[n,":"]}),Bo(i)]}),zo("div",{children:[zo("span",{style:Ho,children:[s,":"]}),Bo(a)]})]})}}function Oo(e,t){return null!=e?e:Math.max(t?.length??0,200)}var Yo="time",jo="value",Xo="__aggLower",$o="__aggUpper",Vo="__aggPartial",Go="count",Qo="__aggStart",qo="__aggEnd";function Ko(e,t){const o=t.stat??"mean",n=t.band??"none",s=t.sigma??1;return e.emit().map(e=>{const t={[Yo]:(e.start+e.end)/2,[jo]:xo(e,o),[Go]:e.count,[Vo]:e.partial,[Qo]:e.start,[qo]:e.end},r=ko(e,n,o,s);return r&&(t[Xo]=r[0],t[$o]=r[1]),t})}import{jsx as Uo}from"react/jsx-runtime";function Zo(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 s=Number(n);return Number.isFinite(s)?s:null}var Jo=Eo(function(e,t){const o=Ne(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:s,className:i,arrowOfTime:l="right",windowMode:c="sliding",windowSize:d,data:u,timeAccessor:h,valueAccessor:g,timeExtent:y,valueExtent:p,extentPadding:m,stroke:f="#007bff",strokeWidth:v=2,strokeDasharray:b,opacity:_,background:w,tooltipContent:x,tooltip:k,onHover:A,annotations:S,autoPlaceAnnotations:C,svgAnnotationRules:R,tickFormatTime:N,tickFormatValue:T,decay:E,pulse:P,staleness:I,transition:D,linkedHover:M,selection:z,onObservation:L,chartId:H,loading:W,loadingContent:B,emptyContent:F,emphasis:O,legendPosition:Y,aggregate:j,eventTime:X}=e,$=o.showAxes,V=o.enableHover,G=s??o.marginDefaults,Q=n??[o.width,o.height],q=x??k??Fo({timeAccessor:h,valueAccessor:g}),K=No(null),{customHoverBehavior:U}=Te({selection:z,linkedHover:M,unwrapData:!0,onObservation:L,chartType:"RealtimeLineChart",chartId:H}),Z=Po(e=>{A&&A(e),U(e)},[A,U]),J=null!=j,[ee,te]=Io([]),oe=No(null),ne=No(j);ne.current=j;const se=No(J);se.current=J;const re=No(ee);re.current=ee;const ie=No({timeAccessor:h,valueAccessor:g});ie.current={timeAccessor:h,valueAccessor:g},Do(()=>{if(!J)return void(oe.current=null);const e=ne.current,t=function(e){const t=e.window??"tumbling",o=Co("session"===t?e.gap??e.size:e.size);if(null==o)return null;const n=null!=e.hop?Co(e.hop):void 0,s=null!=e.gap?Co(e.gap):void 0;return new wo({window:t,size:o,hop:n??void 0,gap:s??void 0,retain:e.retain})}(e);if(oe.current=t,t&&u){const{timeAccessor:e,valueAccessor:o}=ie.current;for(const n of u){const s=Zo(n,e,"time"),r=Zo(n,o,"value");null!=s&&null!=r&&t.push(s,r)}}te(t?Ko(t,e):[])},[J?[j.window??"tumbling",j.size,j.hop??"",j.gap??"",j.retain??""].join("|"):"",J,u]),Do(()=>{J&&oe.current&&te(Ko(oe.current,ne.current))},[j?.stat,j?.band,j?.sigma]);const ae=Po(e=>{const t=oe.current,o=ne.current;if(!t||!o)return;const{timeAccessor:n,valueAccessor:s}=ie.current;for(const o of e){const e=Zo(o,n,"time"),r=Zo(o,s,"value");null!=e&&null!=r&&t.push(e,r)}te(Ko(t,o))},[]),le=null!=X,ce=No(null),de=No(X);de.current=X;const ue=No(le);ue.current=le;const he=No(L);he.current=L;const ge=No(H);ge.current=H,Do(()=>{ce.current=le?function(e){const t=Co(e.lateness);return null==t?null:new Ro({lateness:t,getTime:e=>Zo(e,ie.current.timeAccessor,"time")??NaN,latePolicy:e.latePolicy??"drop"})}(de.current):null},[le?`${X.lateness}|${X.latePolicy??"drop"}`:"",le]);const ye=Po(e=>{0!==e.length&&(se.current?ae(e):K.current?.pushMany(e))},[ae]),pe=Po(e=>{const t=ce.current;if(!ue.current||!t)return void ye(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=he.current;if(o){const{timeAccessor:n}=ie.current,s=de.current?.latePolicy??"drop";for(const r of e.late)o({type:"late-data",datum:r,eventTime:Zo(r,n,"time")??NaN,watermark:t.watermark,policy:s,lateCount:t.lateCount,timestamp:Date.now(),chartType:"RealtimeLineChart",chartId:ge.current})}}}ye(o)},[ye]);To(t,()=>({push:e=>pe([e]),pushMany:e=>pe(e),remove:e=>se.current?[]:K.current?.remove(e)??[],update:(e,t)=>se.current?[]:K.current?.update(e,t)??[],clear:()=>{ce.current?.clear(),se.current?(oe.current?.clear(),te([])):K.current?.clear()},getData:()=>se.current?re.current:K.current?.getData()??[],getScales:()=>K.current?.getScales()??null}),[pe]);const me=xe(W,Q[0],Q[1],B),fe=me?null:_e(J?void 0:u,Q[0],Q[1],F),ve={stroke:f,strokeWidth:v,strokeDasharray:b};null!=_&&(ve.opacity=_);const be=Oo(d,u),we=J?ee:u,ke=J?Yo:h,Ae=J?jo:g,Se=J&&j&&"none"!==(j.band??"none")?{y0Accessor:Xo,y1Accessor:$o,perSeries:!1}:void 0;return me||fe||Uo(r,{ref:K,chartType:"line",runtimeMode:"streaming",size:Q,margin:G,className:O?`${i||""} semiotic-emphasis-${O}`.trim():i,arrowOfTime:l,windowMode:J?"growing":c,windowSize:J?Math.max(1,j?.retain??Math.max(ee.length,600)):be,data:we,timeAccessor:ke,valueAccessor:Ae,xExtent:y,yExtent:p,extentPadding:m,band:Se,lineStyle:ve,showAxes:$,background:w,hoverAnnotation:V,tooltipContent:q,...a({linkedHover:M,selection:z,onObservation:L,forceHoverBehavior:!0,mobileInteraction:o.mobileInteraction,customHoverBehavior:Z}),annotations:S,autoPlaceAnnotations:C,svgAnnotationRules:R,tickFormatTime:N,tickFormatValue:T,decay:E,pulse:P,staleness:I,transition:D,pointIdAccessor:e.pointIdAccessor,legendPosition:Y})});Jo.displayName="RealtimeLineChart";import{useRef as en,useImperativeHandle as tn,forwardRef as on,useCallback as nn,useMemo as sn}from"react";import{jsx as rn}from"react/jsx-runtime";var an=on(function(e,t){const o=Ne(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:s,margin:i,className:l,arrowOfTime:c="right",windowMode:d="sliding",windowSize:u,data:h,timeAccessor:g,valueAccessor:y,direction:p="up",timeExtent:m,valueExtent:f,extentPadding:v,categoryAccessor:b,colors:_,fill:w,stroke:x,strokeWidth:k,opacity:A,gap:S,background:C,tooltipContent:N,tooltip:T,onHover:E,annotations:P,autoPlaceAnnotations:I,svgAnnotationRules:D,tickFormatTime:M,tickFormatValue:z,linkedHover:L,selection:H,decay:W,pulse:B,staleness:F,transition:O,onObservation:Y,chartId:j,loading:X,loadingContent:$,emptyContent:V,emphasis:G,legendPosition:Q,legend:q,brush:K,onBrush:U,linkedBrush:Z}=e,J=o.showAxes,ee=o.enableHover,te=s??[o.width,o.height],oe=sn(()=>_?e=>_[e]??w??"#999":void 0,[_,w]),{legend:ne,margin:se,legendPosition:re}=Re({data:h??[],colorBy:b,colorScale:oe,showLegend:o.showLegend,legendPosition:Q,userMargin:i,defaults:o.marginDefaults,additionalLegend:q}),ie=N??T??function(e={}){const{timeAccessor:t,valueAccessor:o}=e;return e=>{const n=e?.data??null;if(null==n?.binStart||null==n?.binEnd){const e=Wo(n,t,"time"),s=Wo(n,o,"value");return zo("div",{className:"semiotic-tooltip",style:Lo,children:[zo("div",{children:[Mo("span",{style:Ho,children:"x:"}),Bo(e)]}),zo("div",{children:[Mo("span",{style:Ho,children:"y:"}),Bo(s)]})]})}return zo("div",{className:"semiotic-tooltip",style:Lo,children:[zo("div",{children:[Mo("span",{style:Ho,children:"range:"}),Bo(n.binStart),"–",Bo(n.binEnd)]}),null!=n.total&&zo("div",{children:[Mo("span",{style:Ho,children:"count:"}),Bo(n.total)]}),null!=n.category&&zo("div",{children:[Mo("span",{style:Ho,children:"category:"}),Bo(n.category)]})]})}}({timeAccessor:g,valueAccessor:y}),ae=en(null),{customHoverBehavior:le}=Te({selection:H,linkedHover:L,unwrapData:!0,onObservation:Y,chartType:"RealtimeHistogram",chartId:j}),ce=nn(e=>{E&&E(e),le(e)},[E,le]),de=!0===K?{dimension:"x",snap:"bin"}:"x"===K?{dimension:"x"}:"object"==typeof K?K:void 0,ue=pe(Z),he="string"==typeof g?g:"time",ge=Ce({name:ue?.name||"__unused_hist_brush__",xField:ue?.xField||he,...ue?.yField?{yField:ue.yField}:{}}),ye=en(ge.brushInteraction);ye.current=ge.brushInteraction;const me=nn(e=>{if(U&&U(e),Y&&Y(e?{type:"brush",extent:e,timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:j}:{type:"brush-end",timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:j}),ue){const t=ye.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)}},[U,Y,j,ue]);tn(t,()=>({push:e=>ae.current?.push(e),pushMany:e=>ae.current?.pushMany(e),remove:e=>ae.current?.remove(e)??[],update:(e,t)=>ae.current?.update(e,t)??[],clear:()=>ae.current?.clear(),getData:()=>ae.current?.getData()??[],getScales:()=>ae.current?.getScales()??null}),[]);const fe=xe(X,te[0],te[1],$),ve=fe?null:_e(h,te[0],te[1],V),be={};null!=w&&(be.fill=w),null!=x&&(be.stroke=x),null!=k&&(be.strokeWidth=k),null!=A&&(be.opacity=A),null!=S&&(be.gap=S);const we=G?`${l||""} semiotic-emphasis-${G}`.trim():l,ke=Oo(u,h),Ae=sn(()=>"down"!==p?f:R({data:h,valueAccessor:y,timeAccessor:g,binSize:n,valueExtent:f,extentPadding:v}),[p,h,y,g,n,f,v]);return fe||ve||rn(r,{ref:ae,chartType:"bar",runtimeMode:"streaming",size:te,margin:se,className:we,arrowOfTime:c,windowMode:d,windowSize:ke,data:h,timeAccessor:g,valueAccessor:y,xExtent:m,yExtent:Ae,extentPadding:v,binSize:n,categoryAccessor:b,barColors:_,barStyle:be,showAxes:J,background:C,hoverAnnotation:ee,tooltipContent:ie,...a({linkedHover:L,selection:H,onObservation:Y,forceHoverBehavior:!0,mobileInteraction:o.mobileInteraction,customHoverBehavior:ce}),annotations:P,autoPlaceAnnotations:I,svgAnnotationRules:D,tickFormatTime:M,tickFormatValue:z,decay:W,pulse:B,staleness:F,transition:O,pointIdAccessor:e.pointIdAccessor,legend:ne,legendPosition:re,brush:de||(Z?{dimension:"x"}:void 0),onBrush:de||Z?me:void 0})});function ln(e){return rn(an,{...e,windowMode:"growing"})}an.displayName="RealtimeHistogram",ln.displayName="TemporalHistogram";import{useRef as cn,useImperativeHandle as dn,forwardRef as un,useCallback as hn}from"react";import{jsx as gn}from"react/jsx-runtime";var yn=un(function(e,t){const o=Ne(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:s,className:i,arrowOfTime:l="right",windowMode:c="sliding",windowSize:d,data:u,timeAccessor:h,valueAccessor:g,timeExtent:y,valueExtent:p,yScaleType:m,extentPadding:f,categoryAccessor:v,colors:b,radius:_,fill:w,opacity:x,stroke:k,strokeWidth:A,pointStyle:S,background:C,tooltipContent:R,tooltip:N,onHover:T,annotations:E,autoPlaceAnnotations:P,svgAnnotationRules:I,tickFormatTime:D,tickFormatValue:M,linkedHover:z,selection:L,onObservation:H,chartId:W,loading:B,loadingContent:F,emptyContent:O,emphasis:Y,legendPosition:j}=e,X=o.showAxes,$=o.enableHover,V=s??o.marginDefaults,G=n??[o.width,o.height],Q=R??N??Fo({timeAccessor:h,valueAccessor:g}),q=cn(null),{customHoverBehavior:K}=Te({selection:L,linkedHover:z,unwrapData:!0,onObservation:H,chartType:"RealtimeSwarmChart",chartId:W}),U=hn(e=>{T&&T(e),K(e)},[T,K]);dn(t,()=>({push:e=>q.current?.push(e),pushMany:e=>q.current?.pushMany(e),remove:e=>q.current?.remove(e)??[],update:(e,t)=>q.current?.update(e,t)??[],clear:()=>q.current?.clear(),getData:()=>q.current?.getData()??[],getScales:()=>q.current?.getScales()??null}),[]);const Z=xe(B,G[0],G[1],F),J=Z?null:_e(u,G[0],G[1],O),ee={};null!=_&&(ee.radius=_),null!=w&&(ee.fill=w),null!=x&&(ee.opacity=x),null!=k&&(ee.stroke=k),null!=A&&(ee.strokeWidth=A);const te=S,oe=Y?`${i||""} semiotic-emphasis-${Y}`.trim():i,ne=Oo(d,u);return Z||J||gn(r,{ref:q,chartType:"swarm",runtimeMode:"streaming",size:G,margin:V,className:oe,arrowOfTime:l,windowMode:c,windowSize:ne,data:u,timeAccessor:h,valueAccessor:g,xExtent:y,yExtent:p,yScaleType:m,extentPadding:f,categoryAccessor:v,barColors:b,swarmStyle:ee,pointStyle:te,showAxes:X,background:C,hoverAnnotation:$,tooltipContent:Q,...a({linkedHover:z,selection:L,onObservation:H,forceHoverBehavior:!0,mobileInteraction:o.mobileInteraction,customHoverBehavior:U}),annotations:E,autoPlaceAnnotations:P,svgAnnotationRules:I,tickFormatTime:D,tickFormatValue:M,legendPosition:j,pointIdAccessor:e.pointIdAccessor})});yn.displayName="RealtimeSwarmChart";import{useRef as pn,useImperativeHandle as mn,forwardRef as fn,useCallback as vn}from"react";import{jsx as bn}from"react/jsx-runtime";var _n=fn(function(e,t){const o=Ne(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:s,className:i,arrowOfTime:l="right",windowMode:c="sliding",windowSize:d,data:u,timeAccessor:h,valueAccessor:g,timeExtent:y,valueExtent:p,extentPadding:m,positiveColor:f,negativeColor:v,connectorStroke:b,connectorWidth:_,gap:w,stroke:x,strokeWidth:k,opacity:A,background:S,tooltipContent:C,tooltip:R,onHover:N,annotations:T,autoPlaceAnnotations:E,svgAnnotationRules:P,tickFormatTime:I,tickFormatValue:D,linkedHover:M,selection:z,onObservation:L,chartId:H,loading:W,loadingContent:B,emptyContent:F,emphasis:O,legendPosition:Y}=e,j=o.showAxes,X=o.enableHover,$=s??o.marginDefaults,V=n??[o.width,o.height],G=C??R??function(e={}){const{timeAccessor:t,valueAccessor:o}=e;return e=>{const n=e?.data??null,s=Wo(n,t,"time"),r=n?.delta??Wo(n,o,"value"),i=n?.cumEnd,a="number"==typeof r?0>r?Bo(r):"+"+Bo(r):Bo(r);return zo("div",{className:"semiotic-tooltip",style:Lo,children:[zo("div",{children:[Mo("span",{style:Ho,children:"x:"}),Bo(s)]}),zo("div",{children:[Mo("span",{style:Ho,children:"Δ:"}),a]}),null!=i&&zo("div",{children:[Mo("span",{style:Ho,children:"total:"}),Bo(i)]})]})}}({timeAccessor:h,valueAccessor:g}),Q=pn(null),{customHoverBehavior:q}=Te({selection:z,linkedHover:M,unwrapData:!0,onObservation:L,chartType:"RealtimeWaterfallChart",chartId:H}),K=vn(e=>{N&&N(e),q(e)},[N,q]);mn(t,()=>({push:e=>Q.current?.push(e),pushMany:e=>Q.current?.pushMany(e),remove:e=>Q.current?.remove(e)??[],update:(e,t)=>Q.current?.update(e,t)??[],clear:()=>Q.current?.clear(),getData:()=>Q.current?.getData()??[],getScales:()=>Q.current?.getScales()??null}),[]);const U=xe(W,V[0],V[1],B),Z=U?null:_e(u,V[0],V[1],F),J={};null!=f&&(J.positiveColor=f),null!=v&&(J.negativeColor=v),null!=b&&(J.connectorStroke=b),null!=_&&(J.connectorWidth=_),null!=w&&(J.gap=w),null!=x&&(J.stroke=x),null!=k&&(J.strokeWidth=k),null!=A&&(J.opacity=A);const ee=O?`${i||""} semiotic-emphasis-${O}`.trim():i,te=Oo(d,u);return U||Z||bn(r,{ref:Q,chartType:"waterfall",runtimeMode:"streaming",size:V,margin:$,className:ee,arrowOfTime:l,windowMode:c,windowSize:te,data:u,timeAccessor:h,valueAccessor:g,xExtent:y,yExtent:p,extentPadding:m,waterfallStyle:J,showAxes:j,background:S,hoverAnnotation:X,tooltipContent:G,...a({linkedHover:M,selection:z,onObservation:L,forceHoverBehavior:!0,mobileInteraction:o.mobileInteraction,customHoverBehavior:K}),annotations:T,autoPlaceAnnotations:E,svgAnnotationRules:P,tickFormatTime:I,tickFormatValue:D,legendPosition:Y,pointIdAccessor:e.pointIdAccessor})});_n.displayName="RealtimeWaterfallChart";import{useRef as wn,useImperativeHandle as xn,forwardRef as kn,useCallback as An}from"react";import{jsx as Sn}from"react/jsx-runtime";var Cn=kn(function(e,t){const o=Ne(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:s,className:i,arrowOfTime:l="right",windowMode:c="sliding",windowSize:d,data:u,timeAccessor:h,valueAccessor:g,categoryAccessor:y,timeExtent:p,valueExtent:m,extentPadding:f,heatmapXBins:v=20,heatmapYBins:b=20,aggregation:_="count",background:w,tooltipContent:x,tooltip:k,onHover:A,annotations:S,autoPlaceAnnotations:C,svgAnnotationRules:R,tickFormatTime:N,tickFormatValue:T,decay:E,pulse:P,staleness:I,linkedHover:D,selection:M,onObservation:z,chartId:L,loading:H,loadingContent:W,emptyContent:B,emphasis:F,legendPosition:O}=e,Y=o.showAxes,j=o.enableHover,X=s??o.marginDefaults,$=n??[o.width,o.height],V=x??k??function(e={}){const{timeAccessor:t,valueAccessor:o,xLabel:n="x",yLabel:s="y"}=e;return e=>{const r=e?.data??null,i=r?.xCenter??Wo(r,t,"time"),a=r?.yCenter??Wo(r,o,"value"),l=r?.count,c=r?.sum,d=r?.value,u=r?.agg??"count";return zo("div",{className:"semiotic-tooltip",style:Lo,children:[zo("div",{children:[zo("span",{style:Ho,children:[n,":"]}),Bo(i)]}),zo("div",{children:[zo("span",{style:Ho,children:[s,":"]}),Bo(a)]}),null!=l&&zo("div",{children:[Mo("span",{style:Ho,children:"count:"}),Bo(l)]}),"sum"===u&&null!=c&&zo("div",{children:[Mo("span",{style:Ho,children:"sum:"}),Bo(c)]}),"mean"===u&&null!=d&&zo("div",{children:[Mo("span",{style:Ho,children:"mean:"}),Bo(d)]})]})}}({timeAccessor:h,valueAccessor:g}),G=wn(null),{customHoverBehavior:Q}=Te({selection:M,linkedHover:D,unwrapData:!0,onObservation:z,chartType:"RealtimeHeatmap",chartId:L}),q=An(e=>{A&&A(e),Q(e)},[A,Q]);xn(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 K=xe(H,$[0],$[1],W),U=K?null:_e(u,$[0],$[1],B),Z=F?`${i||""} semiotic-emphasis-${F}`.trim():i,J=Oo(d,u);return K||U||Sn(r,{ref:G,chartType:"heatmap",runtimeMode:"streaming",size:$,margin:X,className:Z,arrowOfTime:l,windowMode:c,windowSize:J,data:u,timeAccessor:h,valueAccessor:g,categoryAccessor:y,xExtent:p,yExtent:m,extentPadding:f,heatmapXBins:v,heatmapYBins:b,heatmapAggregation:_,showAxes:Y,background:w,hoverAnnotation:j,tooltipContent:V,...a({linkedHover:D,selection:M,onObservation:z,forceHoverBehavior:!0,mobileInteraction:o.mobileInteraction,customHoverBehavior:q}),annotations:S,autoPlaceAnnotations:C,svgAnnotationRules:R,tickFormatTime:N,tickFormatValue:T,decay:E,pulse:P,staleness:I,legendPosition:O,pointIdAccessor:e.pointIdAccessor})});Cn.displayName="RealtimeHeatmap";export{ze as DEFAULT_LIFECYCLE_THRESHOLDS,L as IncrementalExtent,Cn as RealtimeHeatmap,an as RealtimeHistogram,Jo as RealtimeLineChart,yn as RealtimeSwarmChart,_n as RealtimeWaterfallChart,Ro as ReorderBuffer,H as RingBuffer,_o as RunningStats,bo as StreamNetworkFrame,r as StreamXYFrame,ln as TemporalHistogram,wo as WindowAccumulator,ko as bandBounds,He as bandFromAge,c as compileMotionEncoding,g as deriveMotionVector,w as opacityFromAge,Co as parseWindowDuration,N as resolveMotionAccessor,T as resolveMotionVector,xo as statValue};
1
+ import{canUseForceWorker as e,createFrameForceWorkerRequest as t,runForceLayoutWorker as o,shouldUseForceWorker as n}from"./chunk-chunk-BGHPD3RA.module.min.js";import{ANNOTATION_DISCLOSURE_REVEAL_CSS as s,AriaLiveTooltip as r,CanvasFrameBackground as i,DEFAULT_COLORS as a,FlippingTooltip as l,FocusRing as c,NetworkAccessibleDataTable as d,SceneRevisionDiagnosticsObserver as u,ScreenReaderSummary as h,SkipToTableLink as g,StalenessBadge as y,StreamXYFrame_default as p,TITLE_BASELINE as m,attachUpdateResultStore as f,buildCustomBehaviorProps as v,buildNavGraph as b,buildResolveColor as w,compileMotionEncoding as _,composeOverlays as x,computeDecayOpacity as k,computeEasing as A,computeNetworkAriaLabel as S,computeRawProgress as R,createCustomLayoutFailureDiagnostic as C,createDefaultAnnotationRules as N,deriveMotionVector as T,emitClickObservations as E,emitHoverObservations as P,extractNetworkNavPoints as I,filterSparseArray as D,findHitPointInQuadtree as M,formatVal as z,getDevicePixelRatio as L,getLayoutPlugin as W,isInteractiveKeyboardTarget as H,isServerEnvironment as B,lerp as F,needsDataCanvasPaint as O,networkGlyphRenderer as Y,networkLabelToSVG as j,networkSceneEdgeToSVG as X,networkSceneNodeToSVG as $,nextNetworkIndex as V,normalizeLinkedBrush as G,now as Q,observationInputType as q,opacityFromAge as K,paintCanvasBackground as U,paintSceneWithBackend as J,prepareCanvas as Z,renderAnnotationPass as ee,renderCirclePulse as te,renderEmptyState as oe,renderLegendFromConfig as ne,renderLoadingState as se,renderRectPulse as re,renderSceneWithBackend as ie,resolveCanvasFill as ae,resolveCustomLayoutPalette as le,resolveDownwardHistogramExtent as ce,resolveMotionAccessor as de,resolveMotionVector as ue,resolvePosition as he,runSceneBuild as ge,useBrushSelection as ye,useChartLegendAndMargin as pe,useChartMode as me,useChartSelection as fe,useConfigSync as ve,useFrame as be,useFrameCanvasHost as we,useHydration as _e,useLayoutSelectionSync as xe,useSceneRevisionDiagnostics as ke,useStableShallow as Ae,useStalenessCheck as Se,useWasHydratingFromSSR as Re,warnCustomLayoutDiagnostics as Ce}from"./chunk-chunk-RJRM2E6P.module.min.js";import"./chunk-chunk-XEVJDUTH.module.min.js";import{IncrementalExtent as Ne,RingBuffer as Te,annotationActivationProps as Ee,buildHoverData as Pe,defaultTooltipStyle as Ie,getHitRadius as De,hitTestRect as Me,isAnnotationActivationTarget as ze,normalizeAngle as Le,smartTooltipEntries as We,useAnnotationActivationOptions as He}from"./chunk-chunk-OY66GCE6.module.min.js";import{CustomLayoutSelectionProvider as Be,UpdateResultTracker as Fe,annotationLayout as Oe,glyphHitGeometry as Ye,schemeCategory10 as je,symbolPathString as Xe,symbolRadius as $e,wrapWithCustomLayoutSelection as Ve}from"./chunk-chunk-PZFT457G.module.min.js";import"./chunk-chunk-U66USBWU.module.min.js";import{DEFAULT_LIFECYCLE_THRESHOLDS as Ge,bandFromAge as Qe,filterAnnotationsByStatus as qe}from"./chunk-chunk-XFRBLXYM.module.min.js";import"./chunk-chunk-JJ2OOIET.module.min.js";import{resolveCSSColor as Ke}from"./chunk-chunk-IY7RYD4S.module.min.js";import"./chunk-chunk-J3QOW4OE.module.min.js";import{resolveThemeSemanticColors as Ue}from"./chunk-chunk-DSNGDNJY.module.min.js";import*as Je from"react";import{useRef as Ze,useState as et,useEffect as tt,useMemo as ot,useCallback as nt,useImperativeHandle as st,forwardRef as rt,memo as it}from"react";var at={weightChange:.1,newEdge:.5,newNode:1,threshold:3,transitionDuration:500},lt={radius:3,opacity:.7,speedMultiplier:1,maxPerEdge:50,spawnRate:.1},ct=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 s=0;this.capacity>s;s++){const r=this.particles[s];if(!r.active)continue;const i=o[r.edgeIndex];i&&i.bezier?(r.t+=e*t*(n?n[r.edgeIndex]??1:1)*(i.bezier.circular?.3:1),1>r.t?dt(i.bezier,r.t,r.offset,r):(r.active=!1,this._freeIndices.push(s))):(r.active=!1,this._freeIndices.push(s))}}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 dt(e,t,o,n){if(e.circular&&e.segments)return void function(e,t,o,n,s){const r=e.length,i=t*r,a=Math.min(Math.floor(i),r-1),l=i-a,[c,d,u,h]=e[a];ut(c,d,u,h,l,s);const g=h.x-c.x,y=h.y-c.y,p=Math.sqrt(g*g+y*y);if(p>.001){const e=g/p;s.x+=-y/p*o*n*2,s.y+=e*o*n*2}}(e.segments,t,o,e.halfWidth,n);if(!e.points)return n.x=0,void(n.y=0);const[s,r,i,a]=e.points;ut(s,r,i,a,t,n);const l=a.x-s.x,c=a.y-s.y,d=Math.sqrt(l*l+c*c);if(d>.001){const t=l/d;n.x+=-c/d*o*e.halfWidth*2,n.y+=t*o*e.halfWidth*2}}function ut(e,t,o,n,s,r){const i=1-s,a=i*i,l=a*i,c=s*s,d=c*s;r.x=l*e.x+3*a*s*t.x+3*i*c*o.x+d*n.x,r.y=l*e.y+3*a*s*t.y+3*i*c*o.y+d*n.y}import{quadtree as ht}from"d3-quadtree";function gt(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 yt(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(!pt(e))return!1;return!0}return pt(t.points)}function pt(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}import{interpolateNumber as mt}from"d3-interpolate";var ft="rgba(34, 197, 94, 0.7)",vt=2e3,bt=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],wt=["scene-style","data-paint","accessibility","evidence"],_t=(e,t)=>({retainedData:e,invalidations:t}),xt=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],kt=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],At=["scene-geometry","data-paint","overlay","accessibility","evidence"],St=["scene-style","data-paint","accessibility","evidence"],Rt=["scene-geometry","data-paint","overlay","accessibility","evidence"],Ct=[],Nt={chartType:_t("rebuild",xt),nodeIDAccessor:_t("rebuild",xt),sourceAccessor:_t("rebuild",xt),targetAccessor:_t("rebuild",xt),valueAccessor:_t("rebuild",xt),edgeIdAccessor:_t("rebuild",xt),childrenAccessor:_t("rebuild",xt),hierarchySum:_t("rebuild",xt),orientation:_t("preserve",kt),nodeAlign:_t("preserve",kt),nodePaddingRatio:_t("preserve",kt),nodeWidth:_t("preserve",kt),edgeSort:_t("preserve",kt),iterations:_t("preserve",kt),forceStrength:_t("preserve",kt),padAngle:_t("preserve",kt),groupWidth:_t("preserve",kt),sortGroups:_t("preserve",kt),treeOrientation:_t("preserve",kt),edgeType:_t("preserve",kt),padding:_t("preserve",kt),paddingTop:_t("preserve",kt),orbitMode:_t("preserve",kt),orbitSize:_t("preserve",kt),orbitSpeed:_t("preserve",kt),orbitRevolution:_t("preserve",kt),orbitRevolutionStyle:_t("preserve",kt),orbitEccentricity:_t("preserve",kt),orbitShowRings:_t("preserve",kt),orbitAnimated:_t("preserve",kt),customNetworkLayout:_t("preserve",kt),layoutConfig:_t("preserve",kt),nodeSize:_t("preserve",At),nodeSizeRange:_t("preserve",At),colorByDepth:_t("preserve",At),nodeLabel:_t("preserve",Rt),showLabels:_t("preserve",Rt),labelMode:_t("preserve",Rt),nodeStyle:_t("preserve",St),edgeStyle:_t("preserve",St),colorBy:_t("preserve",St),colorScheme:_t("preserve",St),themeCategorical:_t("preserve",St),themeSemantic:_t("preserve",St),edgeColorBy:_t("preserve",St),edgeOpacity:_t("preserve",St),showParticles:_t("preserve",St),particleStyle:_t("preserve",St),decay:_t("preserve",St),pulse:_t("preserve",St),thresholds:_t("preserve",St),staleness:_t("preserve",St),layoutSelection:_t("preserve",St),clock:_t("preserve",Ct),random:_t("preserve",Ct),seed:_t("preserve",Ct),tensionConfig:_t("preserve",Ct),transition:_t("preserve",Ct),introAnimation:_t("preserve",Ct),onLayoutError:_t("preserve",Ct),__skipForceSimulation:_t("preserve",Ct),__hierarchyRoot:_t("preserve",Ct),__orbitState:_t("preserve",Ct),__previousPositions:_t("preserve",Ct)},Tt=_t("preserve",kt),Et=class{constructor(){this.tracker=new Fe}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}},bt)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},wt):this.recordNoop("restyle")}recordConfig(e){const t=function(e){let t="preserve";const o=new Set;for(const n of e){const e=Nt[n]??Tt;"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)}},Pt=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 Et,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={...at,...e.tensionConfig},e.showParticles&&("sankey"===e.chartType||e.customNetworkLayout)&&(this.particlePool=new ct(2e3))}currentTime(){return this.config.clock?.()??Q()}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={...at,...o.tensionConfig},!o.showParticles||"sankey"!==o.chartType&&!o.customNetworkLayout||this.particlePool||(this.particlePool=new ct(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:s="id",sourceAccessor:r="source",targetAccessor:i="target",valueAccessor:a="value"}=this.config,l="function"==typeof s?s:e=>e[s],c="function"==typeof r?r:e=>e[r],d="function"==typeof i?i:e=>e[i],u="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,{...gt(e),data:t})}for(let e=0;t.length>e;e++){const o=t[e],n=c(o)+"",s=d(o)+"",r=u(o),i=null==r?NaN:Number(r),a=Number.isFinite(i)?i:1;this.nodes.has(n)||this.nodes.set(n,{...gt(n),data:o}),this.nodes.has(s)||this.nodes.set(s,{...gt(s),data:o});const l=`${n}\0${s}\0${e}`,h={source:n,target:s,value:a,y0:0,y1:0,sankeyWidth:0,data:o,_edgeKey:l};o&&"object"==typeof o&&yt(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,s=0===this.nodes.size;let r=!1;const i=this.currentTime();this.lastIngestTime=i,this._decaySortedNodes=null,this._networkDecayCache=null,this.nodes.has(t)||(this.nodes.set(t,gt(t)),this.nodeTimestamps.set(t,i),this.tension+=this.tensionConfig.newNode,r=!0),this.nodes.has(o)||(this.nodes.set(o,gt(o)),this.nodeTimestamps.set(o,i),this.tension+=this.tensionConfig.newNode,r=!0);const a=this.edgeKey(t,o),l=this.edges.get(a);let c=!1;l?(l.value+=n,this.edgeTimestamps.set(a,i),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,i),this.tension+=this.tensionConfig.newEdge,r=!0);const d=s||r||c||this.tension>=this.tensionConfig.threshold;return this.updateResults.recordData("ingest",1),d}ingestEdgeWithResult(e){return this.ingestEdge(e),this.updateResults.last}runLayout(e){if(this.config.customNetworkLayout)return this.recordTopologyDiff(),void this.layoutVersion++;const t=W(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 s=new Map;for(const e of this.nodes.values())0===e.x&&0===e.y||s.set(e.id,{x:e.x,y:e.y});this._lastPositionSnapshot=s,this.saveTargetPositions();const r=o.some(e=>void 0!==e._prevX0&&(0!==e._prevX0||0!==e._prevX1||0!==e._prevY0||0!==e._prevY1)),i=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&&i>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:i}}else r&&i>0&&(this.restorePreviousPositions(),this.transition={startTime:this.currentTime(),duration:i});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:s,selection:r}){const i=!(!o&&!n);if(o)for(const t of e){const e=s.get(t)??t.style,n=o(t,r);t.style=n?{...e,...n}:e}if(n)for(const e of t){const t=s.get(e)??e.style,o=n(e,r);e.style=o?{...t,...o}:t}return i}({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:s,previousResult:r,revision:i}){const a=le(e.colorScheme,e.themeCategorical,je),l={nodes:n,edges:s,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:w(a,e.colorScheme),config:e.layoutConfig??{},selection:e.layoutSelection??null};try{return{kind:"success",result:t(l)}}catch(t){const o=null!==r,n=C("network",t,o,i);"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 Ce({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=W(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:s,sceneEdges:r,labels:i}=t.buildScene(o,n,this.config,e);this.sceneNodes=s,this.sceneEdges=r,this.labels=i,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 s=0;for(const e of this.sceneNodes)"circle"===e.type&&(n[s++]=e);this._nodeQuadtree=ht().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=W(this.config.chartType);return!!e?.supportsAnimation&&!1!==this.config.orbitAnimated}tickAnimation(e,t){const o=W(this.config.chartType);if(!o?.tick)return!1;const n=o.hierarchical?Array.from(this.nodes.values()):this.nodesArray,s=o.hierarchical?Array.from(this.edges.values()):this.edgesArray;return o.tick(n,s,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=R(e,this.transition),o=A(t);for(const e of this.nodes.values())void 0===e._targetX0||void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=F(e._prevX0,e._targetX0,o),e.x1=F(e._prevX1,e._targetX1,o),e.y0=F(e._prevY0,e._targetY0,o),e.y1=F(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=F(e._prevY0,e._targetY0,o),e.y1=F(e._prevY1,e._targetY1,o),e.sankeyWidth=F(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,s="string"==typeof e.target?t.get(e.target):e.target;!n||!s||(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 s=[];for(let e=0;n.length-1>e;e++){const t=n[e],o=n[e+1],r=o.x-t.x,i=o.y-t.y;s.push([t,{x:t.x+r/3,y:t.y+i/3},{x:t.x+2*r/3,y:t.y+2*i/3},o])}return{circular:!0,segments:s,halfWidth:t}}(e):function(e,t,o,n=.5){const s=(e.sankeyWidth||1)/2;if("down"===e.direction){const r=t.x1,i=o.x0,a=mt(r,i);return{circular:!1,points:[{x:e.y0,y:r},{x:e.y0,y:a(n)},{x:e.y1,y:a(1-n)},{x:e.y1,y:i}],halfWidth:s}}const r=t.x1,i=o.x0,a=mt(r,i);return{circular:!1,points:[{x:r,y:e.y0},{x:a(n),y:e.y0},{x:a(1-n),y:e.y1},{x:i,y:e.y1}],halfWidth:s}}(e,n,s,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)",s=t.glowRadius??4,{now:r}=e;for(const t of e.sceneNodes){const i=t.id;if(!i)continue;const a=e.nodeTimestamps.get(i);if(!a)continue;const l=r-a;o>l&&(t._pulseIntensity=1-l/o,t._pulseColor=n,t._pulseGlowRadius=s)}for(const t of e.sceneEdges){const s=t.datum;if(!s)continue;const i="object"==typeof s.source?s.source?.id:s.source,a="object"==typeof s.target?s.target?.id:s.target;if(!i||!a)continue;const l=e.edgeTimestamps.get(`${i}\0${a}`);if(!l)continue;const c=r-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 s of e.sceneNodes){const e=s.id;if(!e)continue;const r=n.get(e);if(void 0===r)continue;const i=k(t,r,o);s.style={...s.style,opacity:(s.style?.opacity??1)*i}}}({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===ft&&(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>=vt)return;const o=1-t/vt;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=ft,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&&vt>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",s=!1!==t.pulse;for(const r of e.sceneNodes){const i=r.id;if(!i)continue;const a=e.nodes.get(i);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&&(r.style={...r.style,fill:c},s&&(r._pulseIntensity=.6+.4*Math.sin(e.now/300),r._pulseColor=c,r._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,s="function"==typeof n?n:n?e=>e[n]:e=>e.value,r=[];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){r.push(n.data?{...n.data}:{}),n.data=o(n.data??{});const e=s(n.data);null!=e&&(n.value=Number(e))}return r.length>0?(this.layoutVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("update",r.length)):this.updateResults.recordNoop("update"),r}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,s]of this.edges)s.data&&n(s.data)===e&&o.push(t)}else for(const[n,s]of this.edges)("string"==typeof s.source?s.source:s.source.id)===e&&("string"==typeof s.target?s.target:s.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")}};Pt.QUADTREE_THRESHOLD=500;var It=Pt;f(It);import*as Dt from"react";import{Fragment as Mt,jsx as zt,jsxs as Lt}from"react/jsx-runtime";function Wt(e){const{width:t,height:o,totalWidth:n,totalHeight:r,margin:i,labels:a,title:l,legend:c,legendHoverBehavior:d,legendClickBehavior:u,legendHighlightedCategory:h,legendIsolatedCategories:g,legendPosition:y="right",legendLayout:p,foregroundGraphics:f,sceneNodes:v,annotations:b,onAnnotationActivate:w,onObservation:_,chartId:x,chartType:k,autoPlaceAnnotations:A,svgAnnotationRules:S}=e,R=He({onAnnotationActivate:w,onObservation:_,chartId:x,chartType:k}),C=Dt.useMemo(()=>{const e=(v||[]).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=Ye(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,$e(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:v}},[o,v,t]),T=Dt.useMemo(()=>{if(!b)return b;const e=qe(b);return A?Oe({annotations:e,context:C,..."object"==typeof A?A:{}}):e},[b,A,C]),E=Dt.useMemo(()=>N("network"),[]),P=T?ee(T.filter(e=>"widget"!==e.type),E,S,C):null,I=!0===T?.some(e=>"widget"===e.type&&!0===e._annotationDeferred);return Lt(Mt,{children:[I&&zt("style",{children:s},"annotation-widget-disclosure-style"),Lt("svg",{role:"img",width:n,height:r,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[zt("title",{children:"string"==typeof l?l:"Network Chart"}),zt("desc",{children:"string"==typeof l?l+" (network data visualization)":"Network data visualization"}),Lt("g",{transform:`translate(${i.left},${i.top})`,children:[a.map((e,t)=>zt("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,f]}),l&&"string"==typeof l?zt("text",{x:n/2,y:m,textAnchor:"middle",fontWeight:600,fill:"currentColor",className:"semiotic-chart-title",style:{fontSize:"var(--semiotic-title-font-size, 14px)"},children:l}):l?zt("foreignObject",{x:0,y:0,width:n,height:i.top,children:l}):null,ne({legend:c,totalWidth:n,totalHeight:r,margin:i,legendPosition:y,title:l,legendLayout:p,legendHoverBehavior:d,legendClickBehavior:u,legendHighlightedCategory:h,legendIsolatedCategories:g})]}),T?.filter(e=>"widget"===e.type&&e.nodeId&&v).map((e,t)=>{const o=!0===e._annotationDeferred,n=v.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 s=i.left+(n.cx??(null!=n.x&&null!=n.w?n.x+n.w/2:n.x??0)),r=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,d=e.height??32,u=e.content??zt("span",{style:{fontSize:18,cursor:"default"},children:"ℹ️"});return zt("div",{...Ee(e,R),className:o?"annotation-deferred":void 0,"data-annotation-disclosure":o?"deferred":void 0,style:{position:"absolute",left:s+a-c/2,top:r+l-d/2,width:c,height:d,display:"flex",alignItems:"center",justifyContent:"center",zIndex:5},children:u},"widget-"+t)})]})}Wt.displayName="NetworkSVGOverlay";import*as Ht from"react";import{jsx as Bt}from"react/jsx-runtime";var Ft={position:"absolute",top:0,left:0,pointerEvents:"none"};function Ot({marks:e,margin:t,selection:o=null,overscan:n=400}){const s=Ht.useRef(null),r=function(e,t,o){const[n,s]=Ht.useState(null);return Ht.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 s(null);let n=0;const r=()=>{n=0;const t=o.getBoundingClientRect(),r=e.getBoundingClientRect();s(0!==t.width&&0!==t.height?{scroll:{left:t.left,top:t.top,right:t.right,bottom:t.bottom},originX:r.left,originY:r.top}:null)},i=()=>{0===n&&(n=window.requestAnimationFrame(r))};r(),o.addEventListener("scroll",i,{passive:!0});const a=new ResizeObserver(i);return a.observe(o),()=>{0!==n&&window.cancelAnimationFrame(n),o.removeEventListener("scroll",i),a.disconnect()}},[t,e,o]),Ht.useMemo(()=>{if(!e||!n)return e;const{scroll:t,originX:s,originY:r}=n,i=t.left-o,a=t.right+o,l=t.top-o,c=t.bottom+o;return e.filter(e=>{const t=s+e.x,o=r+e.y;return!(i>t+e.width||t>a||l>o+e.height||o>c)})},[e,n,o])}(e,s,n);if(!e||0===e.length)return null;const i=Bt("div",{className:"semiotic-network-html-marks",ref:s,style:{...Ft,transform:`translate(${t.left}px, ${t.top}px)`},children:(r??e).map(e=>Bt("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?Bt(Be,{value:o,children:i}):i}import{jsx as Yt,jsxs as jt}from"react/jsx-runtime";function Xt({props:e,store:t,responsiveRef:o,size:n,margin:s,adjustedWidth:r,adjustedHeight:i,resolvedBackground:a,resolvedForeground:l}){const{chartType:c,nodes:d,edges:u,data:g,className:y,description:p,title:m,responsiveWidth:f,responsiveHeight:v,summary:b,background:w,renderMode:_,legend:k,legendPosition:A,legendLayout:S,legendHoverBehavior:R,legendClickBehavior:C,legendHighlightedCategory:N,legendIsolatedCategories:T,layoutSelection:E,annotations:P,onAnnotationActivate:I,annotationObservationCallback:M,onObservation:z,chartId:L,autoPlaceAnnotations:W,svgAnnotationRules:H}=e;if(t){const e=["tree","cluster","treemap","circlepack","partition","orbit"].includes(c),o=e?g||(Array.isArray(u)?void 0:u):void 0;if(e&&o)t.ingestHierarchy(o,[r,i]),t.buildScene([r,i]);else{const e=D(d),o=Array.isArray(u)?D(u):[];(e.length>0||o.length>0)&&(t.ingestBounded(e,o,[r,i]),t.buildScene([r,i]))}}const B=t?.sceneNodes??[],F=t?.sceneEdges??[],O=t?.labels??[];return jt("div",{ref:o,className:"stream-network-frame"+(y?" "+y:""),role:"img","aria-label":p||("string"==typeof m?m:"Network chart"),style:{position:"relative",width:f?"100%":n[0],height:v?"100%":n[1]},children:[Yt(h,{summary:b}),jt("svg",{xmlns:"http://www.w3.org/2000/svg",width:n[0],height:n[1],style:{position:"absolute",left:0,top:0},children:[a&&Yt("g",{transform:`translate(${s.left},${s.top})`,children:a}),jt("g",{transform:`translate(${s.left},${s.top})`,children:[w&&Yt("rect",{x:0,y:0,width:r,height:i,fill:w}),F.map((e,t)=>ie({node:e,index:t,renderMode:_,fallback:()=>X(e,t)})).filter(Boolean),B.map((e,t)=>ie({node:e,index:t,renderMode:_,fallback:()=>$(e,t)})).filter(Boolean),O.map((e,t)=>j(e,t)).filter(Boolean)]})]}),Yt(Wt,{width:r,height:i,totalWidth:n[0],totalHeight:n[1],margin:s,labels:O,sceneNodes:B,title:m,legend:k,legendPosition:A,legendLayout:S,legendHoverBehavior:R,legendClickBehavior:C,legendHighlightedCategory:N,legendIsolatedCategories:T,foregroundGraphics:x(l,Ve(t?.customLayoutOverlays,E??null)),annotations:P,onAnnotationActivate:I,onObservation:M??z,chartId:L,chartType:"StreamNetworkFrame",autoPlaceAnnotations:W,svgAnnotationRules:H,annotationFrame:0}),Yt(Ot,{marks:t?.customLayoutHtmlMarks,margin:s,selection:E??null})]})}import{jsx as $t,jsxs as Vt}from"react/jsx-runtime";var Gt=/^(value|amount|total|count|weight|score)$/i;function Qt({data:e}){if("edge"===e.nodeOrEdge){const t=e.data;return t?Vt("div",{className:"semiotic-tooltip",style:Ie,children:[Vt("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&&Vt("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 s=e.length-1;return Vt("div",{className:"semiotic-tooltip",style:Ie,children:[$t("div",{children:e.map((e,t)=>Vt("span",{children:[t>0&&$t("span",{style:{margin:"0 3px",opacity:.5},children:" → "}),t===s?$t("strong",{children:e}):$t("span",{style:{opacity:.7},children:e})]},t))}),null!=t.value&&t.value>0&&$t("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),s=(t.sourceLinks||[]).reduce((e,t)=>e+(t.value||0),0)+(t.targetLinks||[]).reduce((e,t)=>e+(t.value||0),0),r=We(t.data??t),i=null!=r.title?r.title+"":t.id,a=r.entries.some(e=>Gt.test(e.key));return Vt("div",{className:"semiotic-tooltip",style:Ie,children:[$t("div",{style:{fontWeight:600},children:i}),r.entries.map(e=>Vt("div",{style:{marginTop:4,opacity:.8},children:[e.key,": ",z(e.value)]},e.key)),!a&&null!=t.value&&t.value>0&&Vt("div",{style:{marginTop:4,opacity:.8},children:["Total:"," ","number"==typeof t.value?t.value.toLocaleString():t.value+""]}),n>0&&Vt("div",{style:{marginTop:4,opacity:.8},children:["Connections: ",n,s!==n&&` (weighted: ${s.toLocaleString()})`]})]})}function qt(e){return e._cachedPath2D&&e._cachedPath2DSource===e.pathD||(e._cachedPath2D=new Path2D(e.pathD),e._cachedPath2DSource=e.pathD),e._cachedPath2D}function Kt(e,t){if(!t.pathD)return;e.save();const o=qt(t);if(t.style.fill&&"none"!==t.style.fill){const n=t._gradient;if(n){const o=e.createLinearGradient(n.x0,0,n.x1,0),s=t.style.fillOpacity??t.style.opacity??.5,r="string"==typeof t.style.fill?t.style.fill:"#999",i=Ke(e,r)||r;o.addColorStop(0,1===n.from?i:"transparent"),o.addColorStop(1,1===n.to?i:"transparent"),e.fillStyle=o,e.globalAlpha=s}else e.fillStyle=ae(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=Ke(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 Ut(e,t){e.save();const o=t.style.stroke||"#999";e.strokeStyle=Ke(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 Jt(e,t){if(!t.pathD)return;e.save();const o=qt(t);t.style.fill&&"none"!==t.style.fill&&(e.fillStyle=ae(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=Ke(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 Zt(e,t){if(!t.pathD)return;e.save();const o=qt(t),n=t.style.stroke||"#999";e.strokeStyle=Ke(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=ae(e,t.style.fill,"#007bff"),e.globalAlpha=t.style.fillOpacity??.1,e.fill(o)),e.restore()}Qt.ownsChrome=!0;var eo=new Map;function to(e){try{if(e.path)return new Path2D(e.path);const t=`${e.symbolType??"circle"}:${Math.round(e.size)}`;let o=eo.get(t);return o||(o=new Path2D(Xe(e.symbolType,e.size)),eo.size>256&&eo.clear(),eo.set(t,o)),o}catch{return null}}function oo(e,t,o,n=30){switch(e.type){case"circle":return function(e,t,o,n=30){const s=t-e.cx,r=o-e.cy,i=Math.sqrt(s*s+r*r);return i>De(e.r,n)?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:i}}(e,t,o,n);case"rect":return function(e,t,o){const n=Me(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,s=o-e.cy,r=Math.sqrt(n*n+s*s);if(e.innerR-2>r||r>e.outerR+2)return null;const i=Le(Math.atan2(s,n)),a=Le(e.startAngle),l=Le(e.endAngle);if(a>l?i>=a||l>=i:i>=a&&l>=i){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 s=t-e.cx,r=o-e.cy,i=Math.sqrt(s*s+r*r);return i>De($e(e.size),n)?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:i}}(e,t,o,n);case"glyph":return function(e,t,o,n=30){if(null==e.datum)return null;const s=Ye(e.glyph,e.size),r=e.cx+s.centerDx,i=e.cy+s.centerDy,a=t-r,l=o-i,c=Math.sqrt(a*a+l*l);return c>De(s.radius,n)?null:{type:"node",datum:e.datum,x:r,y:i,distance:c}}(e,t,o,n);default:return null}}var no=null,so=null;function ro(){return so||((no=document.createElement("canvas")).width=1,no.height=1,so=no.getContext("2d")),so}function io(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 ao(e,t,o){switch(e.type){case"bezier":return function(e,t,o){if(!e.pathD)return null;const n=io(e),s=ro();if(!n||!s)return null;try{if(s.isPointInPath(n,t,o))return{type:"edge",datum:e.datum,x:t,y:o,distance:0};const r=s.lineWidth;s.lineWidth=10;const i=s.isPointInStroke(n,t,o);if(s.lineWidth=r,i)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,s=e.y2-e.y1,r=n*n+s*s;if(0===r)return null;let i=((t-e.x1)*n+(o-e.y1)*s)/r;i=Math.max(0,Math.min(1,i));const a=e.x1+i*n,l=e.y1+i*s,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=io(e),s=ro();if(!n||!s)return null;try{if(s.isPointInPath(n,t,o))return{type:"edge",datum:e.datum,x:t,y:o,distance:0};const r=s.lineWidth;s.lineWidth=10;const i=s.isPointInStroke(n,t,o);if(s.lineWidth=r,i)return{type:"edge",datum:e.datum,x:t,y:o,distance:4}}catch{}return null}(e,t,o);default:return null}}function lo(e){const{clientX:t,clientY:o,canvasRect:n,margin:s,adjustedWidth:r,adjustedHeight:i,sceneNodes:a,sceneEdges:l,nodeQuadtree:c,maxNodeRadius:d,hitRadius:u=30}=e,h=t-n.left-s.left,g=o-n.top-s.top;if(0>h||h>r||0>g||g>i)return{kind:"miss-outside"};const y=function(e,t,o,n,s=30,r,i=0){let a=null,l=s,c=1/0;if(r){const e=M(r,o,n,s,i,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(r&&"circle"===t.type)continue;const e=oo(t,o,n,s);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=ao(e,o,n);t&&l>t.distance&&(a=t,l=t.distance)}return a}(a,l,h,g,u,c,d);return y?{kind:"hit",hover:Pe(y.datum||{},y.x,y.y,{nodeOrEdge:y.type})}:{kind:"miss"}}import{useCallback as co}from"react";var uo="StreamNetworkFrame";import{jsx as ho,jsxs as go}from"react/jsx-runtime";var yo={top:20,right:80,bottom:20,left:80},po={top:40,right:40,bottom:40,left:40},mo=new Set(["chord","force","circlepack","orbit"]),fo=[800,600],vo=it(rt(function(s,p){const{chartType:m,nodes:f,edges:v,data:w,initialEdges:_,nodeIDAccessor:k="id",sourceAccessor:A="source",targetAccessor:R="target",valueAccessor:C="value",edgeIdAccessor:N,childrenAccessor:T,hierarchySum:M,orientation:z="horizontal",nodeAlign:W="justify",nodePaddingRatio:F=.05,nodeWidth:j=15,iterations:X=300,forceStrength:$=.1,layoutExecution:G="auto",layoutLoadingContent:Q,onLayoutStateChange:K,padAngle:ee=.01,groupWidth:oe=20,sortGroups:ne,edgeSort:ie,treeOrientation:le="vertical",edgeType:ce="curve",padding:de,paddingTop:ue,tensionConfig:ye,showParticles:pe=!1,particleStyle:me,renderMode:fe,nodeStyle:Ce,edgeStyle:Ne,colorBy:Te,colorScheme:Ee="category10",edgeColorBy:Ie="source",edgeOpacity:De=.5,colorByDepth:Me=!1,nodeSize:Le=8,nodeSizeRange:We=[5,20],nodeLabel:He,showLabels:Be=!0,labelMode:Fe,size:Oe=fo,responsiveWidth:Ye,responsiveHeight:je,margin:Xe,className:$e,background:Ge,enableHover:Qe=!0,tooltipContent:qe,customHoverBehavior:rt,customClickBehavior:it,onObservation:ct,annotationObservationCallback:dt,chartId:ut,onTopologyChange:ht,annotations:gt,onAnnotationActivate:yt,autoPlaceAnnotations:pt,svgAnnotationRules:mt,legend:ft,legendPosition:vt,legendLayout:bt,legendHoverBehavior:wt,legendClickBehavior:_t,legendHighlightedCategory:xt,legendIsolatedCategories:kt,title:At,foregroundGraphics:St,backgroundGraphics:Rt,decay:Ct,pulse:Nt,transition:Tt,animate:Et,staleness:Pt,frameScheduler:Dt,clock:Mt,random:zt,seed:Lt,paused:Ht=!1,suspendWhenHidden:Bt=!0,thresholds:Ft,accessibleTable:Yt=!0,description:jt,summary:$t,orbitMode:Vt,orbitSize:Gt,orbitSpeed:qt,orbitRevolution:eo,orbitRevolutionStyle:oo,orbitEccentricity:no,orbitShowRings:so,orbitAnimated:ro,customNetworkLayout:io,onLayoutError:ao,layoutConfig:vo,layoutSelection:bo}=s,wo=mo.has(m)?po:yo,_o=Ze(!0),xo=be({sizeProp:Oe,responsiveWidth:Ye,responsiveHeight:je,userMargin:Xe,marginDefault:wo,title:At,legend:ft,legendPosition:vt,foregroundGraphics:St,backgroundGraphics:Rt,animate:Et,transitionProp:Tt,frameScheduler:Dt,clock:Mt,random:zt,seed:Lt,paused:Ht,suspendWhenHidden:Bt,themeDirtyRef:_o}),{reducedMotionRef:ko,responsiveRef:Ao,size:So,margin:Ro,adjustedWidth:Co,adjustedHeight:No,resolvedForeground:To,resolvedBackground:Eo,transition:Po,introEnabled:Io,tableId:Do,rafRef:Mo,renderFnRef:zo,scheduleRender:Lo,frameRuntime:Wo,currentTheme:Ho}=xo,Bo=_e(),Fo=Re(),Oo=ot(()=>D(f),[f]),Yo=ot(()=>Array.isArray(v)?D(v):v,[v]),jo=ot(()=>({...at,...ye}),[ye]),Xo=ot(()=>({...lt,...me}),[me]),$o=ot(()=>{return{chartType:(e={chartType:m,clock:Wo.now,random:zt,seed:Lt,nodeIDAccessor:k,sourceAccessor:A,targetAccessor:R,valueAccessor:C,edgeIdAccessor:N,childrenAccessor:T,hierarchySum:M,orientation:z,nodeAlign:W,nodePaddingRatio:F,nodeWidth:j,iterations:X,forceStrength:$,padAngle:ee,groupWidth:oe,sortGroups:ne,edgeSort:ie,treeOrientation:le,edgeType:ce,padding:de,paddingTop:ue,tensionConfig:jo,showParticles:pe,particleStyle:Xo,nodeStyle:Ce,edgeStyle:Ne,nodeLabel:He,showLabels:Be,labelMode:Fe,colorBy:Te,colorScheme:Ee,edgeColorBy:Ie,edgeOpacity:De,colorByDepth:Me,nodeSize:Le,nodeSizeRange:We,decay:Ct,pulse:Nt,transition:Po,introAnimation:Io,staleness:Pt,thresholds:Ft,orbitMode:Vt,orbitSize:Gt,orbitSpeed:qt,orbitRevolution:eo,orbitRevolutionStyle:oo,orbitEccentricity:no,orbitShowRings:so,orbitAnimated:ro,customNetworkLayout:io,onLayoutError:ao,layoutConfig:vo,currentTheme:Ho}).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:Ue(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},[m,Wo.now,zt,Lt,k,A,R,C,N,T,M,z,W,F,j,X,$,ee,oe,ne,ie,le,ce,de,ue,jo,pe,Xo,Ce,Ne,He,Be,Fe,Te,Ee,Ie,De,Me,Le,We,Ct,Nt,Po,Io,Pt,Ft,Vt,Gt,qt,eo,oo,no,so,ro,io,ao,vo,Ho]),Vo=Ae($o),Go=Ae({chartType:(Qo={chartType:m,nodeIDAccessor:k,sourceAccessor:A,targetAccessor:R,valueAccessor:C,edgeIdAccessor:N,childrenAccessor:T,hierarchySum:M,orientation:z,nodeAlign:W,nodePaddingRatio:F,nodeWidth:j,iterations:X,forceStrength:$,padAngle:ee,groupWidth:oe,sortGroups:ne,edgeSort:ie,treeOrientation:le,edgeType:ce,padding:de,paddingTop:ue,random:zt,seed:Lt,tensionConfig:jo,customNetworkLayout:io,orbitMode:Vt,orbitSize:Gt,orbitEccentricity:no}).chartType,nodeIDAccessor:Qo.nodeIDAccessor,sourceAccessor:Qo.sourceAccessor,targetAccessor:Qo.targetAccessor,valueAccessor:Qo.valueAccessor,edgeIdAccessor:Qo.edgeIdAccessor,childrenAccessor:Qo.childrenAccessor,hierarchySum:Qo.hierarchySum,orientation:Qo.orientation,nodeAlign:Qo.nodeAlign,nodePaddingRatio:Qo.nodePaddingRatio,nodeWidth:Qo.nodeWidth,iterations:Qo.iterations,forceStrength:Qo.forceStrength,padAngle:Qo.padAngle,groupWidth:Qo.groupWidth,sortGroups:Qo.sortGroups,edgeSort:Qo.edgeSort,treeOrientation:Qo.treeOrientation,edgeType:Qo.edgeType,padding:Qo.padding,paddingTop:Qo.paddingTop,random:Qo.random,seed:Qo.seed,tensionConfig:Qo.tensionConfig,customNetworkLayout:Qo.customNetworkLayout,orbitMode:Qo.orbitMode,orbitSize:Qo.orbitSize,orbitEccentricity:Qo.orbitEccentricity});var Qo;const qo=Ze(0),Ko=Ze(0),Uo=Ze(!1),Jo=Ze(null);Jo.current||(Jo.current=new It(Vo));const Zo=ke("StreamNetworkFrame"),en=nt((e,t,o=!1)=>ge(Zo.current,e,()=>e.buildScene(t),o),[Zo]),[tn,on]=et(null),[nn,sn]=et(0),[rn,an]=et(0),[ln,cn]=et(!1),[dn,un]=et(!1),hn=Ze(0),gn=Ze(null),yn=Ze(!1),pn=Ze(K);pn.current=K;const mn=Ze(Vo);mn.current=Vo;const fn=Ze(null),vn=Ze(new Map),bn=Ze(0),wn=nt(e=>function(e){const{node:t,colorBy:o,colorScheme:n,nodeColorMap:s,colorIndexRef:r}=e;if("function"==typeof o)return o(t)+"";if("string"==typeof o&&t.data){const e=t.data[o];if(void 0!==e){if(!s.has(e+"")){const t=Array.isArray(n)?n:a;s.set(e+"",t[r.current++%t.length])}return s.get(e+"")}}if(s.has(t.id))return s.get(t.id);const i=Array.isArray(n)?n:a,l=o?i[r.current++%i.length]:i[0];return s.set(t.id,l),l}({node:e,colorBy:Te,colorScheme:Ee,nodeColorMap:vn.current,colorIndexRef:bn}),[Te,Ee]),_n=nt(e=>{bn.current=function(e){const{sceneNodes:t,nodes:o,nodeColorMap:n,colorScheme:s}=e;for(const e of t)e.id&&"string"==typeof e.style?.fill&&n.set(e.id,e.style.fill);const r=Array.isArray(s)?s:a,i=Array.from(o);for(let e=0;i.length>e;e++){const t=i[e];n.has(t.id)||n.set(t.id,r[e%r.length])}return i.length}({sceneNodes:e.sceneNodes,nodes:e.nodes.values(),nodeColorMap:vn.current,colorScheme:Ee})},[Ee]),xn=nt((e,t)=>{en(e,t),_n(e),_o.current=!1,e.markStylePaintPending()},[en,_n]),kn=(An=Ho,An?.colors?.border||An?.colors?.secondary||An?.colors?.primary||"#999");var An;const Sn=nt(e=>function(e,t){return e?"object"==typeof e?e:t?.get(e)??null:null}(e,Jo.current?.nodes),[]),Rn=nt(e=>function(e){const{edge:t,edgeColorBy:o,getNodeColor:n,resolveEndpoint:s,fallback:r}=e;if("function"==typeof o)return o(t);const i=s(t.source),a=s(t.target);return"target"===o&&a?n(a):i?n(i):r}({edge:e,edgeColorBy:Ie,getNodeColor:wn,resolveEndpoint:Sn,fallback:kn}),[Ie,wn,kn,Sn]),Cn=nt(e=>function(e){const{edge:t,particleStyleColor:o,particleColorBy:n,hasExplicitParticleColorBy:s,getEdgeColor:r,getNodeColor:i,resolveEndpoint:a,fallback:l}=e;if("function"==typeof o){const e=a(t.source);return e?o(t,e):l}if(!s)return r(t);const c=n,d=a(t.source),u=a(t.target);return"target"===c&&u?i(u):d?i(d):l}({edge:e,particleStyleColor:Xo.color,particleColorBy:Xo.colorBy,hasExplicitParticleColorBy:!!me?.colorBy,getEdgeColor:Rn,getNodeColor:wn,resolveEndpoint:Sn,fallback:kn}),[me?.colorBy,Xo.color,Xo.colorBy,wn,Rn,kn,Sn]),Nn=function(e,t,o,n,s){return("sankey"===e||t)&&o||n||s}(m,!!io,pe,!!Nt,Jo.current?.isAnimating??!1);ve(Jo,Vo,_o,Lo),xe(Jo,bo,_o,Lo),tt(()=>{const e=Jo.current;e&&(xn(e,[Co,No]),Lo())},[Ho,Co,No,xn,Lo]);const Tn=nt(()=>{const e=Jo.current;if(e&&(e.runLayout([Co,No]),xn(e,[Co,No]),sn(e.layoutVersion),ht)){const{nodes:t,edges:o}=e.getLayoutData();ht(t,o)}},[Co,No,xn,ht]),En=Ze(!1),Pn=nt((e=!1)=>!(!e&&!En.current||(En.current=!1,Tn(),0)),[Tn]),In=nt(()=>Pn(!1),[Pn]),Dn=nt(e=>{const t=Jo.current;if(!t)return!1;let o=!1,n=En.current;for(const s of e)null!=s&&"object"==typeof s&&(o=!0,t.ingestEdge(s)&&(n=!0));const s=Pn(n);return o||s},[Pn]),Mn=nt(e=>{if(null==e||"object"!=typeof e)return;const t=Jo.current;t&&(t.ingestEdge(e)&&(En.current=!0),Wo.isActive?Lo():In())},[In,Wo,Lo]),zn=nt(e=>{Dn(e)&&Lo()},[Dn,Lo]);tt(()=>Wo.subscribe(()=>{Wo.isActive||In()}),[In,Wo]);const Ln=nt(()=>{En.current=!1,Jo.current?.clear(),vn.current.clear(),bn.current=0,sn(Jo.current?.layoutVersion??0),on(null),fn.current=null,_o.current=!0,Lo()},[Lo]),Wn=nt(()=>{const e=Jo.current;e&&(e.tension+=999,Pn(!0),Lo())},[Pn,Lo]);st(p,()=>({push:Mn,pushMany:zn,removeNode:e=>{const t=Jo.current?.removeNode(e)??!1;if(t){const t=fn.current?.data?"function"==typeof k?k(fn.current.data):fn.current.data[k]:void 0;fn.current&&"node"===fn.current.nodeOrEdge&&t===e&&(fn.current=null,on(null)),vn.current.delete(e)}return Pn(t)&&(_o.current=!0,Lo()),t},removeEdge:(e,t)=>{const o=Jo.current?.removeEdge(e,t)??!1;if(o&&fn.current&&"edge"===fn.current.nodeOrEdge){const o=fn.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:!N||!o||("function"==typeof N?N:e=>e?.[N])(o)===e,n&&(fn.current=null,on(null))}return Pn(o)&&(_o.current=!0,Lo()),o},updateNode:(e,t)=>{const o=Jo.current?.updateNode(e,t)??null;return Pn(null!==o)&&(_o.current=!0,Lo()),o},updateEdge:(e,t,o)=>{const n=Jo.current?.updateEdge(e,t,o)??[];return Pn(n.length>0)&&(_o.current=!0,Lo()),n},clear:Ln,getTopology:()=>(In(),Jo.current?.getLayoutData()??{nodes:[],edges:[]}),getCustomLayout:()=>(In(),Jo.current?.lastCustomLayoutResult??null),getLayoutFailure:()=>(In(),Jo.current?.lastCustomLayoutFailure??null),getTopologyDiff:()=>{In();const e=Jo.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:Wn,getTension:()=>(In(),Jo.current?.tension??0)}),[Mn,zn,Ln,Wn,In,Pn,k,Lo,N]);const Hn=["tree","cluster","treemap","circlepack","partition","orbit"].includes(m),Bn=Hn?w||(Array.isArray(v)?void 0:v):void 0;tt(()=>{const s=Jo.current;if(!s)return;const r=++hn.current;if(gn.current?.abort(),gn.current=null,Hn&&Bn)En.current=!1,s.ingestHierarchy(Bn,[Co,No]),xn(s,[Co,No]),un(!1),pn.current?.("ready"),Lo();else{const i=Oo,a=Array.isArray(Yo)?Yo:[];if(null==f&&null==v||(En.current=!1),0===i.length&&0===a.length)return null==f&&null==v||0>=s.nodes.size&&0>=s.edges.size||Ln(),un(!1),void pn.current?.("ready");const l=[Co,No],c="force"===m&&!io&&e()&&!zt&&n(G,i.length,a.length,X);if(c&&Fo&&!yn.current&&s.sceneNodes.length>0)return yn.current=!0,un(!1),pn.current?.("ready"),_o.current=!0,void Lo();if(c){const e=new AbortController;gn.current=e;const n=s._lastPositionSnapshot;s.ingestBounded(i,a,l,{deferLayout:!0});const c=s.getLayoutData(),d=t(c.nodes,c.edges,mn.current,l,n);return un(!0),pn.current?.("pending"),o(d,e.signal).then(({positions:e})=>{r===hn.current&&(s.applyForceLayoutPositions(e,l),xn(s,l),un(!1),pn.current?.("ready"),sn(s.layoutVersion),Lo())}).catch(e=>{"AbortError"!==e.name&&r===hn.current&&(s.runLayout(l),xn(s,l),un(!1),pn.current?.("error"),sn(s.layoutVersion),Lo())}),()=>e.abort()}s.ingestBounded(i,a,l),xn(s,l),un(!1),pn.current?.("ready"),Lo()}},[Oo,Yo,f,v,w,Bn,Hn,Co,No,Go,G,X,Fo,m,io,zt,Lo,Ln,xn]);const Fn=Je.useRef(!1);tt(()=>{Fn.current||_&&_.length>0&&(Fn.current=!0,zn(_))},[_,zn]);const{customHoverBehavior:On,customClickBehavior:Yn}=function({customHoverBehavior:e,customClickBehavior:t,onObservation:o,chartId:n}){return{customHoverBehavior:co((t,s)=>{e?.(t,s),P({onObservation:o,datum:t?t.data||t:null,x:t?.x,y:t?.y,chartType:uo,chartId:n,context:s})},[e,o,n]),customClickBehavior:co((e,s)=>{t?.(e,s),E({onObservation:o,datum:e?e.data||e:null,x:e?.x,y:e?.y,chartType:uo,chartId:n,context:s})},[t,o,n])}}({customHoverBehavior:rt,customClickBehavior:it,onObservation:ct,chartId:ut}),{hoverHandlerRef:jn,hoverLeaveRef:Xn,onPointerMove:$n,onPointerLeave:Vn}=xo,Gn=()=>!io||(Jo.current?.hasCustomRestyle??!1);jn.current=e=>{if(!Qe)return;const t=Gn(),o=ts.current;if(!o)return;const n=Jo.current;if(!n)return;const s=lo({clientX:e.clientX,clientY:e.clientY,canvasRect:o.getBoundingClientRect(),margin:Ro,adjustedWidth:Co,adjustedHeight:No,sceneNodes:n.sceneNodes,sceneEdges:n.sceneEdges,nodeQuadtree:n.nodeQuadtree,maxNodeRadius:n.maxNodeRadius});"hit"===s.kind?(fn.current=s.hover,on(s.hover),On&&(On(s.hover),t&&(_o.current=!0)),t&&Lo()):fn.current&&(fn.current=null,on(null),On&&(On(null),t&&(_o.current=!0)),t&&Lo())},Xn.current=()=>{if(fn.current){const e=Gn();fn.current=null,on(null),On&&(On(null),e&&(_o.current=!0)),e&&Lo()}};const Qn=Ze(()=>{});Qn.current=e=>{if(ze(e.target))return;if(!it&&!ct)return;const t=ts.current;if(!t)return;const o=Jo.current;if(!o)return;const n=lo({clientX:e.clientX,clientY:e.clientY,canvasRect:t.getBoundingClientRect(),margin:Ro,adjustedWidth:Co,adjustedHeight:No,sceneNodes:o.sceneNodes,sceneEdges:o.sceneEdges,nodeQuadtree:o.nodeQuadtree,maxNodeRadius:o.maxNodeRadius});"hit"===n.kind?Yn(n.hover,{type:"activate",inputType:q(e.nativeEvent.pointerType)}):"miss"===n.kind&&Yn(null)};const qn=nt(e=>Qn.current(e),[]),Kn=Ze(-1),Un=Ze(null),Jn=Ze(-1),Zn=nt(e=>{if(H(e))return;const t=Jo.current;if(!t)return;const o=()=>{Kn.current=-1,Un.current=null,Jn.current=-1,fn.current=null,on(null),On&&(On(null),_o.current=!0),Lo()},n=I(t.sceneNodes);if(0===n.length)return void(0>Kn.current||o());const s=b(n);let r=Kn.current;if(s.flat.length>r||(o(),r=-1)," "===e.key&&r>=0){e.preventDefault();const t=s.flat[r];return void Yn(Pe(t.datum||{},t.x,t.y,{nodeOrEdge:"node"}),{type:"activate",inputType:"keyboard"})}if(0>r){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown","Enter"].includes(e.key))return;e.preventDefault(),Kn.current=0,Jn.current=-1;const t=s.flat[0];Un.current={shape:t.shape,w:t.w,h:t.h};const o=Pe(t.datum||{},t.x,t.y,{nodeOrEdge:"node"});return fn.current=o,on(o),On&&(On(o,{type:"focus",inputType:"keyboard"}),_o.current=!0),void Lo()}const i=he(s,r),a=V(e.key,i,s,t.sceneEdges??[],Jn);if(null===a)return;if(e.preventDefault(),0>a)return void o();Kn.current=a;const l=s.flat[a];Un.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"};fn.current=c,on(c),On&&(On(c,{type:"focus",inputType:"keyboard"}),_o.current=!0),Lo()},[Yn,On,Lo]),es=nt(e=>{Kn.current=-1,Un.current=null,$n(e)},[$n]);zo.current=()=>{if(Mo.current=null,In(),!Wo.isActive)return;const e=ts.current;if(!e)return;const t=Jo.current;t&&function(e){const{canvas:t,store:o,sceneRevisionDiagnostics:n,size:s,margin:r,adjustedWidth:i,adjustedHeight:a,background:l,renderMode:c,hasBackgroundGraphics:d=!1,dirtyRef:u,lastFrameTimeRef:h,now:g,random:y,reducedMotion:p,showParticles:m,isContinuous:f,animate:v,decay:b,pulse:w,thresholds:_,staleness:x,particleStyle:k,getParticleColor:A,pendingAnnotationFrameRef:R,lastAnnotationFrameTimeRef:C,setAnnotationFrame:N,scheduleNextFrame:T,syncColorMap:E}=e,P=t.getContext("2d");if(!P)return;const I=h.current?Math.min((g-h.current)/1e3,.1):.016;h.current=g;const D=o.advanceTransition(p?g+1e6:g),M=!p&&D,z=!p&&o.tickAnimation([i,a],I),W=u.current,H=n?.beforeCompute(o.getLastUpdateResult(),M),B=D||W||z;B&&(o.buildScene([i,a]),W&&E?.()),H&&n?.afterCompute(H,B,!1);const F=m&&!p&&!!o.particlePool,j=!!b||!!w||!!_||!1!==v&&o.hasActiveTopologyDiff||o.hasActivePulses||o.hasActiveThresholds,X=o.consumeStylePaintPending(),$=O({dirtyOrRebuilt:W,transitioning:M,animationTicked:z,continuous:F||f,liveEncoding:j,forced:X}),V=!!x&&o.lastIngestTime>0&&g-o.lastIngestTime>(x?.threshold??5e3);if($){const e=L();if(!Z(t,s,r,e))return;if(P.clearRect(-r.left,-r.top,s[0],s[1]),U(P,{background:l,hasBackgroundGraphics:d,width:i,height:a}),b&&o.applyDecay(),w&&o.applyPulse(g),_&&o.applyThresholds(g),!1!==v&&o.applyTopologyDiff(g),V&&(P.globalAlpha=x?.dimOpacity??.5),J({context:P,nodes:o.sceneEdges,renderMode:c,pixelRatio:e,paintBuiltIn:e=>function(e,t){for(const o of t)switch(o.type){case"bezier":Kt(e,o);break;case"line":Ut(e,o);break;case"ribbon":Jt(e,o);break;case"curved":Zt(e,o)}}(P,e)}),J({context:P,nodes:o.sceneNodes,renderMode:c,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),t.style.fill&&(e.fillStyle=ae(e,t.style.fill,"#007bff"),void 0!==t.style.fillOpacity&&(e.globalAlpha=(t.style.opacity??1)*t.style.fillOpacity),e.fillRect(t.x,t.y,t.w,t.h)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ke(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??1,e.globalAlpha=t.style.opacity??1,e.strokeRect(t.x,t.y,t.w,t.h)),re(e,t),e.restore())}}(P,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),t.style.fill&&(e.fillStyle=ae(e,t.style.fill,"#007bff"),void 0!==t.style.fillOpacity&&(e.globalAlpha=(t.style.opacity??1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ke(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??1,e.globalAlpha=t.style.opacity??1,e.stroke()),te(e,t),e.restore())}}(P,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(),t.style.fill&&(e.fillStyle=ae(e,t.style.fill,"#007bff"),void 0!==t.style.fillOpacity&&(e.globalAlpha=(t.style.opacity??1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ke(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??1,e.globalAlpha=t.style.opacity??1,e.stroke()),e.restore()}}(P,t),function(e,t){const o=e.globalAlpha;for(const n of t){if("symbol"!==n.type)continue;const t=n;if(0>=t.size)continue;const s=to(t);if(!s)continue;e.save(),e.translate(t.cx,t.cy),t.rotation&&e.rotate(t.rotation);const r=t.style.opacity??1;t.style.fill&&(e.globalAlpha=o*r*(t.style.fillOpacity??1),e.fillStyle=ae(e,t.style.fill,"#007bff"),e.fill(s)),t.style.stroke&&"none"!==t.style.stroke&&(e.globalAlpha=o*r,e.strokeStyle=Ke(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??1,e.stroke(s)),e.restore()}}(P,t),Y(P,t)}}),F&&!V){const e=o.edgesArray;if(e.length>0){!function(e,t,o,n,s=Math.random){const r=n.spawnRate??.1,i=n.maxPerEdge??50;for(let n=0;t.length>n;n++){const a=t[n];if(!a.bezier)continue;if(e.countForEdge(n)>=i)continue;const l=a.value*r*o*(a.bezier.circular?.3:1),c=Math.floor(l),d=l-c;let u=c;s()<d&&u++;for(let t=0;u>t&&e.countForEdge(n)<i;t++)e.spawn(n,s)}}(o.particlePool,e,I,k,y);const t=.5*(k.speedMultiplier??1);let n;if(k.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,s){const r=n.radius??3;e.globalAlpha=n.opacity??.7;for(let i=0;t.particles.length>i;i++){const a=t.particles[i];if(!a.active)continue;const l=o[a.edgeIndex];if(!l)continue;let c;c="string"==typeof n.color&&"inherit"!==n.color?n.color:s(l),e.fillStyle=Ke(e,c)||c,e.beginPath(),e.arc(a.x,a.y,r,0,2*Math.PI),e.fill()}e.globalAlpha=1}(P,o.particlePool,e,k,A)}}V&&(P.globalAlpha=1)}u.current=!1,(W||M||z)&&t.setAttribute("aria-label",S(o.sceneNodes?.length??0,o.sceneEdges?.length??0,"Network chart"));const G=W||M||z||R.current;G&&g-C.current>=33?(N(e=>e+1),C.current=g,R.current=!1):R.current=!!G,(f||M||null!=o.transition||z||o.hasActivePulses||o.hasActiveThresholds||!1!==v&&o.hasActiveTopologyDiff||R.current)&&T()}({canvas:e,store:t,sceneRevisionDiagnostics:Zo.current,size:So,margin:Ro,adjustedWidth:Co,adjustedHeight:No,background:Ge,renderMode:fe,hasBackgroundGraphics:!!Rt,dirtyRef:_o,lastFrameTimeRef:qo,now:Wo.now(),random:Wo.random,reducedMotion:!!ko.current,showParticles:pe,isContinuous:Nn,animate:Et,decay:Ct,pulse:Nt,thresholds:Ft,staleness:Pt,particleStyle:Xo,getParticleColor:Cn,pendingAnnotationFrameRef:Uo,lastAnnotationFrameTimeRef:Ko,setAnnotationFrame:an,scheduleNextFrame:()=>{Lo()},syncColorMap:()=>_n(t)})};const{canvasRef:ts}=we(xo,{hydrated:Bo,wasHydratingFromSSR:Fo,storeRef:Jo,dirtyRef:_o,skipInitialCanvasPaintInvalidation:!0,canvasPaintDependencies:[m,Co,No,Ge,Rt,fe,Lo]});Se(Pt,Jo,_o,Lo,ln,cn);const os=Qe&&tn?ho(l,{x:tn.x,y:tn.y,containerWidth:Co,containerHeight:No,margin:Ro,className:"stream-network-tooltip",zIndex:2,children:qe?qe(tn):ho(Qt,{data:tn})}):null;if(B||!Bo&&Fo)return ho(Xt,{props:s,store:Jo.current,responsiveRef:Ao,size:So,margin:Ro,adjustedWidth:Co,adjustedHeight:No,resolvedBackground:Eo,resolvedForeground:To});const ns=Jo.current;return go("div",{ref:Ao,className:"stream-network-frame"+($e?" "+$e:""),role:"group","aria-label":jt||("string"==typeof At?At:"Network chart"),tabIndex:0,"aria-busy":dn||void 0,style:{position:"relative",width:Ye?"100%":So[0],height:je?"100%":So[1],overflow:"visible"},onKeyDown:Zn,children:["production"!==process.env.NODE_ENV&&Jo.current&&ho(u,{store:Jo.current,diagnostics:Zo.current}),Yt&&ho(g,{tableId:Do}),Yt&&ho(d,{nodes:ns?.sceneNodes??[],edges:ns?.sceneEdges??[],chartType:"Network chart",tableId:Do,chartTitle:"string"==typeof At?At:void 0}),ho(h,{summary:$t}),ho(r,{hoverPoint:tn}),go("div",{role:"img","aria-label":jt||("string"==typeof At?At:"Network chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Qe?es:void 0,onMouseLeave:Qe?Vn:void 0,onClick:it||ct?qn:void 0,children:[dn&&!1!==Q&&ho("div",{style:{position:"absolute",inset:0,zIndex:3,background:"var(--semiotic-bg, #fff)"},children:se(!0,So[0],So[1],Q)}),ho(i,{size:So,margin:Ro,overflowVisible:!0,children:Eo}),ho("canvas",{ref:ts,"aria-label":S(ns?.sceneNodes?.length??0,ns?.sceneEdges?.length??0,"Network chart"),style:{position:"absolute",top:0,left:0}}),ho(Wt,{width:Co,height:No,totalWidth:So[0],totalHeight:So[1],margin:Ro,labels:ns?.labels||[],sceneNodes:ns?.sceneNodes,title:At,legend:ft,legendPosition:vt,legendLayout:bt,legendHoverBehavior:wt,legendClickBehavior:_t,legendHighlightedCategory:xt,legendIsolatedCategories:kt,foregroundGraphics:x(To,Ve(Jo.current?.customLayoutOverlays,bo??null)),annotations:gt,onAnnotationActivate:yt,onObservation:dt??ct,chartId:ut,chartType:"StreamNetworkFrame",autoPlaceAnnotations:pt,svgAnnotationRules:mt,annotationFrame:rn}),ho(Ot,{marks:ns?.customLayoutHtmlMarks,margin:Ro,selection:bo??null}),ho(c,{active:Kn.current>=0,hoverPoint:tn,margin:Ro,size:So,shape:Un.current?.shape,width:Un.current?.w,height:Un.current?.h}),os,Pt?.showBadge&&ho(y,{isStale:ln,position:Pt.badgePosition})]})]})}));vo.displayName="StreamNetworkFrame";var bo=vo,wo=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}},_o=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 s=Math.floor((e-this.size)/o)+1;n>=s;s++)this.bump(s*o,t)}bump(e,t){let o=this.windows.get(e);o||(o=new wo,this.windows.set(e,o)),o.push(t)}pushSession(e,t){const o=this.gap,n=new wo;n.push(t);let s=e,r=e;const i=[],a={start:s,end:r,stats:n};for(const t of this.sessions)e-o>t.end||t.start>e+o?i.push(t):(a.stats.merge(t.stats),s>t.start&&(s=t.start),t.end>r&&(r=t.end));a.start=s,a.end=r,i.push(a),i.sort((e,t)=>e.start-t.start),this.sessions=i}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 xo(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}}function ko(e,t,o,n=1){if("none"===t)return null;if("minmax"===t)return[e.min,e.max];const s=xo(e,o),r=e.stddev*n;return[s-r,s+r]}var Ao={ms:1,s:1e3,m:6e4,h:36e5,d:864e5},So=/(\d+(?:\.\d+)?)(ms|s|m|h|d)/g;function Ro(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;So.lastIndex=0;let o,n=0,s=0;for(;null!==(o=So.exec(t));){const e=parseFloat(o[1]),t=Ao[o[2]];if(null==t||!Number.isFinite(e))return null;n+=e*t,s+=o[0].length}return s!==t.length?null:n>0?n:null}var Co=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}};import{useRef as No,useImperativeHandle as To,forwardRef as Eo,useCallback as Po,useState as Io,useEffect as Do}from"react";import{jsx as Mo,jsxs as zo}from"react/jsx-runtime";var Lo={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"},Wo={opacity:.7,marginRight:4};function Ho(e,t,o){if(null!=e)return"function"==typeof t?t(e):e["string"==typeof t?t:o]}function Bo(e){return null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+""}function Fo(e={}){const{timeAccessor:t,valueAccessor:o,xLabel:n="x",yLabel:s="y"}=e;return e=>{const r=e?.data??null,i=Ho(r,t,"time"),a=Ho(r,o,"value");return zo("div",{className:"semiotic-tooltip",style:Lo,children:[zo("div",{children:[zo("span",{style:Wo,children:[n,":"]}),Bo(i)]}),zo("div",{children:[zo("span",{style:Wo,children:[s,":"]}),Bo(a)]})]})}}function Oo(e,t){return null!=e?e:Math.max(t?.length??0,200)}var Yo="time",jo="value",Xo="__aggLower",$o="__aggUpper",Vo="__aggPartial",Go="count",Qo="__aggStart",qo="__aggEnd";function Ko(e,t){const o=t.stat??"mean",n=t.band??"none",s=t.sigma??1;return e.emit().map(e=>{const t={[Yo]:(e.start+e.end)/2,[jo]:xo(e,o),[Go]:e.count,[Vo]:e.partial,[Qo]:e.start,[qo]:e.end},r=ko(e,n,o,s);return r&&(t[Xo]=r[0],t[$o]=r[1]),t})}import{jsx as Uo}from"react/jsx-runtime";function Jo(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 s=Number(n);return Number.isFinite(s)?s:null}var Zo=Eo(function(e,t){const o=me(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:s,className:r,arrowOfTime:i="right",windowMode:a="sliding",windowSize:l,data:c,timeAccessor:d,valueAccessor:u,timeExtent:h,valueExtent:g,extentPadding:y,stroke:m="#007bff",strokeWidth:f=2,strokeDasharray:b,opacity:w,background:_,tooltipContent:x,tooltip:k,onHover:A,annotations:S,autoPlaceAnnotations:R,svgAnnotationRules:C,tickFormatTime:N,tickFormatValue:T,decay:E,pulse:P,staleness:I,transition:D,linkedHover:M,selection:z,onObservation:L,chartId:W,loading:H,loadingContent:B,emptyContent:F,emphasis:O,legendPosition:Y,aggregate:j,eventTime:X}=e,$=o.showAxes,V=o.enableHover,G=s??o.marginDefaults,Q=n??[o.width,o.height],q=x??k??Fo({timeAccessor:d,valueAccessor:u}),K=No(null),{customHoverBehavior:U}=fe({selection:z,linkedHover:M,unwrapData:!0,onObservation:L,chartType:"RealtimeLineChart",chartId:W}),J=Po(e=>{A&&A(e),U(e)},[A,U]),Z=null!=j,[ee,te]=Io([]),ne=No(null),re=No(j);re.current=j;const ie=No(Z);ie.current=Z;const ae=No(ee);ae.current=ee;const le=No({timeAccessor:d,valueAccessor:u});le.current={timeAccessor:d,valueAccessor:u},Do(()=>{if(!Z)return void(ne.current=null);const e=re.current,t=function(e){const t=e.window??"tumbling",o=Ro("session"===t?e.gap??e.size:e.size);if(null==o)return null;const n=null!=e.hop?Ro(e.hop):void 0,s=null!=e.gap?Ro(e.gap):void 0;return new _o({window:t,size:o,hop:n??void 0,gap:s??void 0,retain:e.retain})}(e);if(ne.current=t,t&&c){const{timeAccessor:e,valueAccessor:o}=le.current;for(const n of c){const s=Jo(n,e,"time"),r=Jo(n,o,"value");null!=s&&null!=r&&t.push(s,r)}}te(t?Ko(t,e):[])},[Z?[j.window??"tumbling",j.size,j.hop??"",j.gap??"",j.retain??""].join("|"):"",Z,c]),Do(()=>{Z&&ne.current&&te(Ko(ne.current,re.current))},[j?.stat,j?.band,j?.sigma]);const ce=Po(e=>{const t=ne.current,o=re.current;if(!t||!o)return;const{timeAccessor:n,valueAccessor:s}=le.current;for(const o of e){const e=Jo(o,n,"time"),r=Jo(o,s,"value");null!=e&&null!=r&&t.push(e,r)}te(Ko(t,o))},[]),de=null!=X,ue=No(null),he=No(X);he.current=X;const ge=No(de);ge.current=de;const ye=No(L);ye.current=L;const pe=No(W);pe.current=W,Do(()=>{ue.current=de?function(e){const t=Ro(e.lateness);return null==t?null:new Co({lateness:t,getTime:e=>Jo(e,le.current.timeAccessor,"time")??NaN,latePolicy:e.latePolicy??"drop"})}(he.current):null},[de?`${X.lateness}|${X.latePolicy??"drop"}`:"",de]);const ve=Po(e=>{0!==e.length&&(ie.current?ce(e):K.current?.pushMany(e))},[ce]),be=Po(e=>{const t=ue.current;if(!ge.current||!t)return void ve(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=ye.current;if(o){const{timeAccessor:n}=le.current,s=he.current?.latePolicy??"drop";for(const r of e.late)o({type:"late-data",datum:r,eventTime:Jo(r,n,"time")??NaN,watermark:t.watermark,policy:s,lateCount:t.lateCount,timestamp:Date.now(),chartType:"RealtimeLineChart",chartId:pe.current})}}}ve(o)},[ve]);To(t,()=>({push:e=>be([e]),pushMany:e=>be(e),remove:e=>ie.current?[]:K.current?.remove(e)??[],update:(e,t)=>ie.current?[]:K.current?.update(e,t)??[],clear:()=>{ue.current?.clear(),ie.current?(ne.current?.clear(),te([])):K.current?.clear()},getData:()=>ie.current?ae.current:K.current?.getData()??[],getScales:()=>K.current?.getScales()??null}),[be]);const we=se(H,Q[0],Q[1],B),_e=we?null:oe(Z?void 0:c,Q[0],Q[1],F),xe={stroke:m,strokeWidth:f,strokeDasharray:b};null!=w&&(xe.opacity=w);const ke=Oo(l,c),Ae=Z?ee:c,Se=Z?Yo:d,Re=Z?jo:u,Ce=Z&&j&&"none"!==(j.band??"none")?{y0Accessor:Xo,y1Accessor:$o,perSeries:!1}:void 0;return we||_e||Uo(p,{ref:K,chartType:"line",runtimeMode:"streaming",size:Q,margin:G,className:O?`${r||""} semiotic-emphasis-${O}`.trim():r,arrowOfTime:i,windowMode:Z?"growing":a,windowSize:Z?Math.max(1,j?.retain??Math.max(ee.length,600)):ke,data:Ae,timeAccessor:Se,valueAccessor:Re,xExtent:h,yExtent:g,extentPadding:y,band:Ce,lineStyle:xe,showAxes:$,background:_,hoverAnnotation:V,tooltipContent:q,...v({linkedHover:M,selection:z,onObservation:L,forceHoverBehavior:!0,mobileInteraction:o.mobileInteraction,customHoverBehavior:J}),annotations:S,autoPlaceAnnotations:R,svgAnnotationRules:C,tickFormatTime:N,tickFormatValue:T,decay:E,pulse:P,staleness:I,transition:D,pointIdAccessor:e.pointIdAccessor,legendPosition:Y})});Zo.displayName="RealtimeLineChart";import{useRef as en,useImperativeHandle as tn,forwardRef as on,useCallback as nn,useMemo as sn}from"react";import{jsx as rn}from"react/jsx-runtime";var an=on(function(e,t){const o=me(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:s,margin:r,className:i,arrowOfTime:a="right",windowMode:l="sliding",windowSize:c,data:d,timeAccessor:u,valueAccessor:h,direction:g="up",timeExtent:y,valueExtent:m,extentPadding:f,categoryAccessor:b,colors:w,fill:_,stroke:x,strokeWidth:k,opacity:A,gap:S,background:R,tooltipContent:C,tooltip:N,onHover:T,annotations:E,autoPlaceAnnotations:P,svgAnnotationRules:I,tickFormatTime:D,tickFormatValue:M,linkedHover:z,selection:L,decay:W,pulse:H,staleness:B,transition:F,onObservation:O,chartId:Y,loading:j,loadingContent:X,emptyContent:$,emphasis:V,legendPosition:Q,legend:q,brush:K,onBrush:U,linkedBrush:J}=e,Z=o.showAxes,ee=o.enableHover,te=s??[o.width,o.height],ne=sn(()=>w?e=>w[e]??_??"#999":void 0,[w,_]),{legend:re,margin:ie,legendPosition:ae}=pe({data:d??[],colorBy:b,colorScale:ne,showLegend:o.showLegend,legendPosition:Q,userMargin:r,defaults:o.marginDefaults,additionalLegend:q,chartWidth:te[0],axisChrome:{hasAxis:!1!==o.showAxes}}),le=C??N??function(e={}){const{timeAccessor:t,valueAccessor:o}=e;return e=>{const n=e?.data??null;if(null==n?.binStart||null==n?.binEnd){const e=Ho(n,t,"time"),s=Ho(n,o,"value");return zo("div",{className:"semiotic-tooltip",style:Lo,children:[zo("div",{children:[Mo("span",{style:Wo,children:"x:"}),Bo(e)]}),zo("div",{children:[Mo("span",{style:Wo,children:"y:"}),Bo(s)]})]})}return zo("div",{className:"semiotic-tooltip",style:Lo,children:[zo("div",{children:[Mo("span",{style:Wo,children:"range:"}),Bo(n.binStart),"–",Bo(n.binEnd)]}),null!=n.total&&zo("div",{children:[Mo("span",{style:Wo,children:"count:"}),Bo(n.total)]}),null!=n.category&&zo("div",{children:[Mo("span",{style:Wo,children:"category:"}),Bo(n.category)]})]})}}({timeAccessor:u,valueAccessor:h}),de=en(null),{customHoverBehavior:ue}=fe({selection:L,linkedHover:z,unwrapData:!0,onObservation:O,chartType:"RealtimeHistogram",chartId:Y}),he=nn(e=>{T&&T(e),ue(e)},[T,ue]),ge=!0===K?{dimension:"x",snap:"bin"}:"x"===K?{dimension:"x"}:"object"==typeof K?K:void 0,ve=G(J),be="string"==typeof u?u:"time",we=ye({name:ve?.name||"__unused_hist_brush__",xField:ve?.xField||be,...ve?.yField?{yField:ve.yField}:{}}),_e=en(we.brushInteraction);_e.current=we.brushInteraction;const xe=nn(e=>{if(U&&U(e),O&&O(e?{type:"brush",extent:e,timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:Y}:{type:"brush-end",timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:Y}),ve){const t=_e.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)}},[U,O,Y,ve]);tn(t,()=>({push:e=>de.current?.push(e),pushMany:e=>de.current?.pushMany(e),remove:e=>de.current?.remove(e)??[],update:(e,t)=>de.current?.update(e,t)??[],clear:()=>de.current?.clear(),getData:()=>de.current?.getData()??[],getScales:()=>de.current?.getScales()??null}),[]);const ke=se(j,te[0],te[1],X),Ae=ke?null:oe(d,te[0],te[1],$),Se={};null!=_&&(Se.fill=_),null!=x&&(Se.stroke=x),null!=k&&(Se.strokeWidth=k),null!=A&&(Se.opacity=A),null!=S&&(Se.gap=S);const Re=V?`${i||""} semiotic-emphasis-${V}`.trim():i,Ce=Oo(c,d),Ne=sn(()=>"down"!==g?m:ce({data:d,valueAccessor:h,timeAccessor:u,binSize:n,valueExtent:m,extentPadding:f}),[g,d,h,u,n,m,f]);return ke||Ae||rn(p,{ref:de,chartType:"bar",runtimeMode:"streaming",size:te,margin:ie,className:Re,arrowOfTime:a,windowMode:l,windowSize:Ce,data:d,timeAccessor:u,valueAccessor:h,xExtent:y,yExtent:Ne,extentPadding:f,binSize:n,categoryAccessor:b,barColors:w,barStyle:Se,showAxes:Z,background:R,hoverAnnotation:ee,tooltipContent:le,...v({linkedHover:z,selection:L,onObservation:O,forceHoverBehavior:!0,mobileInteraction:o.mobileInteraction,customHoverBehavior:he}),annotations:E,autoPlaceAnnotations:P,svgAnnotationRules:I,tickFormatTime:D,tickFormatValue:M,decay:W,pulse:H,staleness:B,transition:F,pointIdAccessor:e.pointIdAccessor,legend:re,legendPosition:ae,brush:ge||(J?{dimension:"x"}:void 0),onBrush:ge||J?xe:void 0})});function ln(e){return rn(an,{...e,windowMode:"growing"})}an.displayName="RealtimeHistogram",ln.displayName="TemporalHistogram";import{useRef as cn,useImperativeHandle as dn,forwardRef as un,useCallback as hn}from"react";import{jsx as gn}from"react/jsx-runtime";var yn=un(function(e,t){const o=me(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:s,className:r,arrowOfTime:i="right",windowMode:a="sliding",windowSize:l,data:c,timeAccessor:d,valueAccessor:u,timeExtent:h,valueExtent:g,yScaleType:y,extentPadding:m,categoryAccessor:f,colors:b,radius:w,fill:_,opacity:x,stroke:k,strokeWidth:A,pointStyle:S,background:R,tooltipContent:C,tooltip:N,onHover:T,annotations:E,autoPlaceAnnotations:P,svgAnnotationRules:I,tickFormatTime:D,tickFormatValue:M,linkedHover:z,selection:L,onObservation:W,chartId:H,loading:B,loadingContent:F,emptyContent:O,emphasis:Y,legendPosition:j}=e,X=o.showAxes,$=o.enableHover,V=s??o.marginDefaults,G=n??[o.width,o.height],Q=C??N??Fo({timeAccessor:d,valueAccessor:u}),q=cn(null),{customHoverBehavior:K}=fe({selection:L,linkedHover:z,unwrapData:!0,onObservation:W,chartType:"RealtimeSwarmChart",chartId:H}),U=hn(e=>{T&&T(e),K(e)},[T,K]);dn(t,()=>({push:e=>q.current?.push(e),pushMany:e=>q.current?.pushMany(e),remove:e=>q.current?.remove(e)??[],update:(e,t)=>q.current?.update(e,t)??[],clear:()=>q.current?.clear(),getData:()=>q.current?.getData()??[],getScales:()=>q.current?.getScales()??null}),[]);const J=se(B,G[0],G[1],F),Z=J?null:oe(c,G[0],G[1],O),ee={};null!=w&&(ee.radius=w),null!=_&&(ee.fill=_),null!=x&&(ee.opacity=x),null!=k&&(ee.stroke=k),null!=A&&(ee.strokeWidth=A);const te=S,ne=Y?`${r||""} semiotic-emphasis-${Y}`.trim():r,re=Oo(l,c);return J||Z||gn(p,{ref:q,chartType:"swarm",runtimeMode:"streaming",size:G,margin:V,className:ne,arrowOfTime:i,windowMode:a,windowSize:re,data:c,timeAccessor:d,valueAccessor:u,xExtent:h,yExtent:g,yScaleType:y,extentPadding:m,categoryAccessor:f,barColors:b,swarmStyle:ee,pointStyle:te,showAxes:X,background:R,hoverAnnotation:$,tooltipContent:Q,...v({linkedHover:z,selection:L,onObservation:W,forceHoverBehavior:!0,mobileInteraction:o.mobileInteraction,customHoverBehavior:U}),annotations:E,autoPlaceAnnotations:P,svgAnnotationRules:I,tickFormatTime:D,tickFormatValue:M,legendPosition:j,pointIdAccessor:e.pointIdAccessor})});yn.displayName="RealtimeSwarmChart";import{useRef as pn,useImperativeHandle as mn,forwardRef as fn,useCallback as vn}from"react";import{jsx as bn}from"react/jsx-runtime";var wn=fn(function(e,t){const o=me(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:s,className:r,arrowOfTime:i="right",windowMode:a="sliding",windowSize:l,data:c,timeAccessor:d,valueAccessor:u,timeExtent:h,valueExtent:g,extentPadding:y,positiveColor:m,negativeColor:f,connectorStroke:b,connectorWidth:w,gap:_,stroke:x,strokeWidth:k,opacity:A,background:S,tooltipContent:R,tooltip:C,onHover:N,annotations:T,autoPlaceAnnotations:E,svgAnnotationRules:P,tickFormatTime:I,tickFormatValue:D,linkedHover:M,selection:z,onObservation:L,chartId:W,loading:H,loadingContent:B,emptyContent:F,emphasis:O,legendPosition:Y}=e,j=o.showAxes,X=o.enableHover,$=s??o.marginDefaults,V=n??[o.width,o.height],G=R??C??function(e={}){const{timeAccessor:t,valueAccessor:o}=e;return e=>{const n=e?.data??null,s=Ho(n,t,"time"),r=n?.delta??Ho(n,o,"value"),i=n?.cumEnd,a="number"==typeof r?0>r?Bo(r):"+"+Bo(r):Bo(r);return zo("div",{className:"semiotic-tooltip",style:Lo,children:[zo("div",{children:[Mo("span",{style:Wo,children:"x:"}),Bo(s)]}),zo("div",{children:[Mo("span",{style:Wo,children:"Δ:"}),a]}),null!=i&&zo("div",{children:[Mo("span",{style:Wo,children:"total:"}),Bo(i)]})]})}}({timeAccessor:d,valueAccessor:u}),Q=pn(null),{customHoverBehavior:q}=fe({selection:z,linkedHover:M,unwrapData:!0,onObservation:L,chartType:"RealtimeWaterfallChart",chartId:W}),K=vn(e=>{N&&N(e),q(e)},[N,q]);mn(t,()=>({push:e=>Q.current?.push(e),pushMany:e=>Q.current?.pushMany(e),remove:e=>Q.current?.remove(e)??[],update:(e,t)=>Q.current?.update(e,t)??[],clear:()=>Q.current?.clear(),getData:()=>Q.current?.getData()??[],getScales:()=>Q.current?.getScales()??null}),[]);const U=se(H,V[0],V[1],B),J=U?null:oe(c,V[0],V[1],F),Z={};null!=m&&(Z.positiveColor=m),null!=f&&(Z.negativeColor=f),null!=b&&(Z.connectorStroke=b),null!=w&&(Z.connectorWidth=w),null!=_&&(Z.gap=_),null!=x&&(Z.stroke=x),null!=k&&(Z.strokeWidth=k),null!=A&&(Z.opacity=A);const ee=O?`${r||""} semiotic-emphasis-${O}`.trim():r,te=Oo(l,c);return U||J||bn(p,{ref:Q,chartType:"waterfall",runtimeMode:"streaming",size:V,margin:$,className:ee,arrowOfTime:i,windowMode:a,windowSize:te,data:c,timeAccessor:d,valueAccessor:u,xExtent:h,yExtent:g,extentPadding:y,waterfallStyle:Z,showAxes:j,background:S,hoverAnnotation:X,tooltipContent:G,...v({linkedHover:M,selection:z,onObservation:L,forceHoverBehavior:!0,mobileInteraction:o.mobileInteraction,customHoverBehavior:K}),annotations:T,autoPlaceAnnotations:E,svgAnnotationRules:P,tickFormatTime:I,tickFormatValue:D,legendPosition:Y,pointIdAccessor:e.pointIdAccessor})});wn.displayName="RealtimeWaterfallChart";import{useRef as _n,useImperativeHandle as xn,forwardRef as kn,useCallback as An}from"react";import{jsx as Sn}from"react/jsx-runtime";var Rn=kn(function(e,t){const o=me(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:s,className:r,arrowOfTime:i="right",windowMode:a="sliding",windowSize:l,data:c,timeAccessor:d,valueAccessor:u,categoryAccessor:h,timeExtent:g,valueExtent:y,extentPadding:m,heatmapXBins:f=20,heatmapYBins:b=20,aggregation:w="count",background:_,tooltipContent:x,tooltip:k,onHover:A,annotations:S,autoPlaceAnnotations:R,svgAnnotationRules:C,tickFormatTime:N,tickFormatValue:T,decay:E,pulse:P,staleness:I,linkedHover:D,selection:M,onObservation:z,chartId:L,loading:W,loadingContent:H,emptyContent:B,emphasis:F,legendPosition:O}=e,Y=o.showAxes,j=o.enableHover,X=s??o.marginDefaults,$=n??[o.width,o.height],V=x??k??function(e={}){const{timeAccessor:t,valueAccessor:o,xLabel:n="x",yLabel:s="y"}=e;return e=>{const r=e?.data??null,i=r?.xCenter??Ho(r,t,"time"),a=r?.yCenter??Ho(r,o,"value"),l=r?.count,c=r?.sum,d=r?.value,u=r?.agg??"count";return zo("div",{className:"semiotic-tooltip",style:Lo,children:[zo("div",{children:[zo("span",{style:Wo,children:[n,":"]}),Bo(i)]}),zo("div",{children:[zo("span",{style:Wo,children:[s,":"]}),Bo(a)]}),null!=l&&zo("div",{children:[Mo("span",{style:Wo,children:"count:"}),Bo(l)]}),"sum"===u&&null!=c&&zo("div",{children:[Mo("span",{style:Wo,children:"sum:"}),Bo(c)]}),"mean"===u&&null!=d&&zo("div",{children:[Mo("span",{style:Wo,children:"mean:"}),Bo(d)]})]})}}({timeAccessor:d,valueAccessor:u}),G=_n(null),{customHoverBehavior:Q}=fe({selection:M,linkedHover:D,unwrapData:!0,onObservation:z,chartType:"RealtimeHeatmap",chartId:L}),q=An(e=>{A&&A(e),Q(e)},[A,Q]);xn(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 K=se(W,$[0],$[1],H),U=K?null:oe(c,$[0],$[1],B),J=F?`${r||""} semiotic-emphasis-${F}`.trim():r,Z=Oo(l,c);return K||U||Sn(p,{ref:G,chartType:"heatmap",runtimeMode:"streaming",size:$,margin:X,className:J,arrowOfTime:i,windowMode:a,windowSize:Z,data:c,timeAccessor:d,valueAccessor:u,categoryAccessor:h,xExtent:g,yExtent:y,extentPadding:m,heatmapXBins:f,heatmapYBins:b,heatmapAggregation:w,showAxes:Y,background:_,hoverAnnotation:j,tooltipContent:V,...v({linkedHover:D,selection:M,onObservation:z,forceHoverBehavior:!0,mobileInteraction:o.mobileInteraction,customHoverBehavior:q}),annotations:S,autoPlaceAnnotations:R,svgAnnotationRules:C,tickFormatTime:N,tickFormatValue:T,decay:E,pulse:P,staleness:I,legendPosition:O,pointIdAccessor:e.pointIdAccessor})});Rn.displayName="RealtimeHeatmap";export{Ge as DEFAULT_LIFECYCLE_THRESHOLDS,Ne as IncrementalExtent,Rn as RealtimeHeatmap,an as RealtimeHistogram,Zo as RealtimeLineChart,yn as RealtimeSwarmChart,wn as RealtimeWaterfallChart,Co as ReorderBuffer,Te as RingBuffer,wo as RunningStats,bo as StreamNetworkFrame,p as StreamXYFrame,ln as TemporalHistogram,_o as WindowAccumulator,ko as bandBounds,Qe as bandFromAge,_ as compileMotionEncoding,T as deriveMotionVector,K as opacityFromAge,Ro as parseWindowDuration,de as resolveMotionAccessor,ue as resolveMotionVector,xo as statValue};
@@ -7,6 +7,7 @@
7
7
  */
8
8
  export { waffleLayout, allocateCells } from "./components/recipes/waffle";
9
9
  export { unitize, unitizeRange } from "./components/recipes/unitize";
10
+ export type { PhysicsDestinationZone, PhysicsStageColliderOptions, PhysicsStageGeography, PhysicsStageGeographyOptions, PhysicsZone } from "./components/recipes/physicsStageGeography";
10
11
  export type { UnitSign, RangeUnitSign, UnitizeOptions, UnitizeResult, UnitizeRangeResult, } from "./components/recipes/unitize";
11
12
  export { generateTokens, layoutTokenGrid, normalizeTokenEncoding, diagnoseTokenEncoding, suggestTokenEncoding, tokenTaskIntentToCapabilityIntents, } from "./components/recipes/tokenEncoding";
12
13
  export type { TokenType, TokenSemantics, TokenCountStrategy, TokenLayout, TokenLabelPolicy, TokenTaskIntent, TokenCapabilityIntent, TokenEncoding, TokenGeneratorInput, VisualToken, TokenDiagnosticCode, TokenDiagnostic, TokenDiagnosticsContext, TokenSet, TokenGridOptions, PositionedToken, TokenEncodingSuggestion, SuggestTokenEncodingInput, } from "./components/recipes/tokenEncoding";
@@ -17,6 +18,10 @@ export { calendarLayout } from "./components/recipes/calendar";
17
18
  export type { CalendarConfig } from "./components/recipes/calendar";
18
19
  export { isometricLandmarkLayout, selectIsometricLandmarks, DEFAULT_ISOMETRIC_SPRITE_SIZES, } from "./components/recipes/isometricLandmarks";
19
20
  export type { IsometricLandmarkConfig, IsometricLandmarkTile, IsometricTerrainCell, IsometricTerrainKind, LandmarkKind, } from "./components/recipes/isometricLandmarks";
21
+ export { geographicGridLayout, gridifyGeographicPoints, } from "./components/recipes/geographicGrid";
22
+ export type { GeographicGridConfig, GeographicGridInput, GeographicGridShape, GeographicGridSource, GridifiedGeographicPoint, GridifyGeographicPointsOptions, } from "./components/recipes/geographicGrid";
23
+ export { geographicDotGridLayout, sampleGeographicDotGrid, } from "./components/recipes/geographicDotGrid";
24
+ export type { GeographicDotGridAccessor, GeographicDotGridConfig, GeographicDotGridDatum, GeographicDotGridSampleOptions, GeographicDotGridShape, } from "./components/recipes/geographicDotGrid";
20
25
  export { flextreeLayout } from "./components/recipes/flextree";
21
26
  export type { FlextreeConfig } from "./components/recipes/flextree";
22
27
  export { dagreLayout } from "./components/recipes/dagre";
@@ -89,7 +94,7 @@ export { forceLayout, mulberry32 } from "./components/recipes/forceLayout";
89
94
  export type { ForceLayoutOptions } from "./components/recipes/forceLayout";
90
95
  export { forceLayoutAsync } from "./components/recipes/forceLayoutAsync";
91
96
  export type { ForceLayoutAsyncOptions } from "./components/recipes/forceLayoutAsync";
92
- export { absorbRegion, aggregateRegionCounts, arrivalReplay, bodyGroupSpec, capacitatedRegion, chargeGateRegion, collidersFromScales, composePhysicsControllers, createCapacityQueueController, createDependencyGateController, createPortalController, createServiceLevelController, createServiceResourcePoolController, createProcessJourneyLedger, comparePhysicsTrace, forceFieldRegion, processChrome, galtonPegs, groupCompletionRows, membraneRegion, portalRegion, pressureFieldRegion, processLaneWalls, processJourneyRows, processStageLayout, processStageRegions, processVolumePolygons, physicsReferenceEnvelope, regionCountsToProjectionRows, routeSurfaceRegion, sedimentBake, spawnFromTokens, stageTargetInVolume, updateProcessJourney, } from "./components/recipes/physics";
97
+ export { absorbRegion, aggregateRegionCounts, arrivalReplay, bodyGroupSpec, capacitatedRegion, chargeGateRegion, collidersFromScales, composePhysicsControllers, createCapacityQueueController, createDependencyGateController, createPortalController, createServiceLevelController, createServiceResourcePoolController, createProcessJourneyLedger, comparePhysicsTrace, forceFieldRegion, processChrome, galtonPegs, groupCompletionRows, membraneRegion, portalRegion, pressureFieldRegion, processLaneWalls, processJourneyRows, processStageLayout, describePhysicsStageGeography, physicsChargePoint, physicsDestination, physicsStageColliders, physicsStageGeography, processStageRegions, processVolumePolygons, physicsReferenceEnvelope, regionCountsToProjectionRows, routeSurfaceRegion, sedimentBake, spawnFromTokens, stageTargetInVolume, updateProcessJourney, } from "./components/recipes/physics";
93
98
  export type { ArrivalReplayOptions, BandScale, BodyGroupSpec, BodyGroupSpecOptions, CapacityQueueAbandonedInfo, CapacityQueueAgeSummary, CapacityQueueBlockedInfo, CapacityQueueControllerOptions, CapacityQueueProcessedInfo, CapacityQueueSnapshot, CapacityQueueVisitInfo, CapacityQueueWindowSnapshot, ComposedPhysicsControllers, DependencyGateController, DependencyGateOptions, DependencyGateSnapshot, GaltonPegsOptions, ProcessChromeGroup, ProcessChromeLayout, ProcessChromeOptions, ProcessChromeStage, NumericScale, PhysicsBandColliderOptions, PhysicsColliderSpec, PhysicsPlotBounds, PhysicsQueuedSpawn, PhysicsReferenceBandSelector, PhysicsReferenceEnvelope, PhysicsReferenceEnvelopeOptions, PhysicsReferenceEnvelopePoint, PhysicsReferenceSampleGrid, PhysicsReferenceTrace, PhysicsScalarTraceSample, PhysicsScaleColliderOptions, PhysicsSedimentBinSnapshot, PhysicsSedimentColumn, PhysicsSedimentHeightfieldOptions, PhysicsSpawnPacingOptions, PhysicsTraceAccessor, PhysicsTraceComparison, PhysicsTraceComparisonOptions, PhysicsTraceComparisonPoint, PhysicsTraceComparisonStatus, PhysicsTraceInterpolation, PhysicsTraceOutsideDomain, ProcessMembraneDef, ProcessJourneyEntityState, ProcessJourneyLedger, ProcessJourneyRow, ProcessJourneyStage, ProcessJourneyUpdateOptions, ProcessRegionBaseOptions, ProcessStageRegionOptions, ProcessStageDef, ProcessVolumeLayout, ProcessVolumeLayoutOptions, ProcessVolumeMembraneBand, ProcessVolumePoint, ProcessVolumePolygon, ProcessVolumePolygonRole, PhysicsController, PhysicsControllerTickContext, ServiceLevelCaseInfo, ServiceLevelCaseState, ServiceLevelController, ServiceLevelControllerOptions, ServiceLevelSnapshot, ServiceResourceAssignment, ServiceResourceDefinition, ServiceResourcePoolController, ServiceResourcePoolOptions, ServiceResourcePoolSnapshot, ProcessVolumeShape, ProcessVolumeStageBand, RegionCountBucket, RegionCountMap, SedimentBakeOptions, SedimentBakeResult, SpawnFromTokensOptions, } from "./components/recipes/physics";
94
99
  export { orderByGroupDegree, arcLayout, arcPath, circularLayout, adjacencyMatrix, } from "./components/recipes/networkLayouts";
95
100
  export type { ArcLayoutOptions, CircularLayoutOptions, MatrixCell, AdjacencyMatrix, AdjacencyMatrixOptions, } from "./components/recipes/networkLayouts";