semiotic 3.9.1 → 3.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (328) hide show
  1. package/README.md +102 -48
  2. package/agent-skill/semiotic-charts/SKILL.md +14 -10
  3. package/ai/componentMetadata.cjs +13 -3
  4. package/ai/dist/mcp-server.js +140 -36407
  5. package/ai/examples.md +109 -6
  6. package/ai/reference.md +55 -18
  7. package/ai/schema.json +5964 -1190
  8. package/ai/surface-manifest.json +51 -7
  9. package/ai/system-prompt.md +16 -3
  10. package/dist/c-3SCUN5HI.min.js +1 -0
  11. package/dist/c-3VVKFA4M.min.js +1 -0
  12. package/dist/c-43TJZS3F.min.js +1 -0
  13. package/dist/c-4DTZPSUD.min.js +1 -0
  14. package/dist/c-4ES5367Y.min.js +1 -0
  15. package/dist/c-54IRWOGM.min.js +1 -0
  16. package/dist/c-5D2S4RMI.min.js +1 -0
  17. package/dist/c-5JWCTX3G.min.js +1 -0
  18. package/dist/c-6CMMSN6N.min.js +1 -0
  19. package/dist/c-6HRB2L7H.min.js +1 -0
  20. package/dist/c-7W4SV36A.min.js +1 -0
  21. package/dist/c-A4WRGZFX.min.js +1 -0
  22. package/dist/c-AG7WWVIH.min.js +1 -0
  23. package/dist/c-AH6J4MTN.min.js +1 -0
  24. package/dist/c-ALYR5LKK.min.js +1 -0
  25. package/dist/c-BYDPC44I.min.js +1 -0
  26. package/dist/c-CFFIU2MW.min.js +1 -0
  27. package/dist/c-CGNHBHCE.min.js +1 -0
  28. package/dist/c-CJYSXIFV.min.js +1 -0
  29. package/dist/c-CKLIFCGN.min.js +1 -0
  30. package/dist/c-CZF7MV67.min.js +1 -0
  31. package/dist/c-D53OKBSY.min.js +1 -0
  32. package/dist/c-DBQ2V7CH.min.js +1 -0
  33. package/dist/c-DPMVAUAW.min.js +1 -0
  34. package/dist/c-ECJCKLYY.min.js +1 -0
  35. package/dist/c-EGATGOWJ.min.js +1 -0
  36. package/dist/c-EGR6VYBW.min.js +1 -0
  37. package/dist/c-ENF72HU5.min.js +1 -0
  38. package/dist/c-ESNR43AN.min.js +1 -0
  39. package/dist/c-F3LIKINL.min.js +1 -0
  40. package/dist/c-F5ZB5GJ6.min.js +1 -0
  41. package/dist/c-G3VYMHKE.min.js +1 -0
  42. package/dist/c-GR6MOEQC.min.js +1 -0
  43. package/dist/c-GSVCN34B.min.js +1 -0
  44. package/dist/c-GYOQCEFP.min.js +1 -0
  45. package/dist/c-H3DNMTCC.min.js +1 -0
  46. package/dist/c-I6J3FEZE.min.js +1 -0
  47. package/dist/c-IGH6MGJ5.min.js +1 -0
  48. package/dist/c-II2EEAJN.min.js +1 -0
  49. package/dist/c-J6M4JHRS.min.js +1 -0
  50. package/dist/c-JM3MGLQV.min.js +1 -0
  51. package/dist/c-KM3N7F7R.min.js +1 -0
  52. package/dist/c-LF5BZFNC.min.js +1 -0
  53. package/dist/c-LKBSGFQC.min.js +1 -0
  54. package/dist/c-NDJADPIF.min.js +1 -0
  55. package/dist/c-NVPQCIL5.min.js +1 -0
  56. package/dist/c-OFWJBEE5.min.js +1 -0
  57. package/dist/c-OYFHP5F5.min.js +1 -0
  58. package/dist/c-PGKQGGQ2.min.js +1 -0
  59. package/dist/c-Q2IPZ3MU.min.js +1 -0
  60. package/dist/c-QKHMBE2E.min.js +1 -0
  61. package/dist/c-QMVM3AY6.min.js +1 -0
  62. package/dist/c-QSGWX53A.min.js +1 -0
  63. package/dist/c-RJKEKZOO.min.js +1 -0
  64. package/dist/c-SFDIIU5G.min.js +1 -0
  65. package/dist/c-SRTBCRVE.min.js +1 -0
  66. package/dist/c-T6UAIKBH.min.js +1 -0
  67. package/dist/c-TMCTEVVW.min.js +1 -0
  68. package/dist/c-TMOSJLT3.min.js +1 -0
  69. package/dist/c-U6ESPM7V.min.js +1 -0
  70. package/dist/c-UC5PTTFI.min.js +1 -0
  71. package/dist/c-VGKUEZBC.min.js +1 -0
  72. package/dist/c-VN2HG5BS.min.js +1 -0
  73. package/dist/{c-J5G56TUH.min.js → c-VPZDY5Q4.min.js} +1 -1
  74. package/dist/c-VRXUB2F2.min.js +1 -0
  75. package/dist/c-VUBQNQJH.min.js +1 -0
  76. package/dist/c-VUH4PGZY.min.js +1 -0
  77. package/dist/c-XDRV7RKW.min.js +1 -0
  78. package/dist/c-YGZHURXZ.min.js +1 -0
  79. package/dist/components/Annotation.d.ts +1 -1
  80. package/dist/components/access/chartAccessCapabilities.generated.d.ts +14 -0
  81. package/dist/components/access/chartAccessContract.d.ts +90 -0
  82. package/dist/components/access/chartAccessContractFixtures.d.ts +11 -0
  83. package/dist/components/ai/aestheticProfileTypes.d.ts +35 -0
  84. package/dist/components/ai/annotationProvenance.d.ts +2 -7
  85. package/dist/components/ai/auditVisualHierarchy.d.ts +49 -0
  86. package/dist/components/ai/builtInChartRecipeLayouts.d.ts +2 -0
  87. package/dist/components/ai/builtInChartRecipePublic.d.ts +4 -0
  88. package/dist/components/ai/builtInChartRecipes.d.ts +26 -0
  89. package/dist/components/ai/chartCapabilities.d.ts +3 -1
  90. package/dist/components/ai/chartRecipeRegistry.d.ts +2 -1
  91. package/dist/components/ai/chartRecipes.d.ts +6 -0
  92. package/dist/components/ai/colorEvidence.d.ts +12 -0
  93. package/dist/components/ai/evaluateAesthetics.d.ts +47 -0
  94. package/dist/components/ai/geoNavigation.d.ts +4 -0
  95. package/dist/components/ai/hierarchyNavigation.d.ts +4 -0
  96. package/dist/components/ai/navigationTree.d.ts +7 -1
  97. package/dist/components/ai/qualityFixtures.d.ts +8 -0
  98. package/dist/components/ai/suggestionPropContracts.d.ts +1 -1
  99. package/dist/components/ai/useNavigationSync.d.ts +3 -3
  100. package/dist/components/charts/index.d.ts +4 -0
  101. package/dist/components/charts/network/ChordDiagram.d.ts +5 -1
  102. package/dist/components/charts/network/CirclePack.d.ts +8 -1
  103. package/dist/components/charts/network/OrbitDiagram.d.ts +9 -0
  104. package/dist/components/charts/network/TreeDiagram.d.ts +8 -1
  105. package/dist/components/charts/network/Treemap.d.ts +8 -1
  106. package/dist/components/charts/ordinal/BarChart.d.ts +6 -0
  107. package/dist/components/charts/ordinal/BoxPlot.d.ts +3 -0
  108. package/dist/components/charts/ordinal/DonutChart.d.ts +3 -0
  109. package/dist/components/charts/ordinal/DotPlot.d.ts +3 -0
  110. package/dist/components/charts/ordinal/FunnelChart.d.ts +3 -0
  111. package/dist/components/charts/ordinal/GaugeChart.d.ts +3 -0
  112. package/dist/components/charts/ordinal/Histogram.d.ts +3 -0
  113. package/dist/components/charts/ordinal/LikertChart.d.ts +3 -0
  114. package/dist/components/charts/ordinal/PieChart.d.ts +3 -0
  115. package/dist/components/charts/ordinal/RadarChart.capability.d.ts +2 -0
  116. package/dist/components/charts/ordinal/RadarChart.d.ts +75 -0
  117. package/dist/components/charts/ordinal/RidgelinePlot.d.ts +3 -0
  118. package/dist/components/charts/ordinal/SwarmPlot.d.ts +3 -0
  119. package/dist/components/charts/ordinal/SwimlaneChart.d.ts +3 -0
  120. package/dist/components/charts/ordinal/ViolinPlot.d.ts +3 -0
  121. package/dist/components/charts/physics/GauntletChart.d.ts +1 -5
  122. package/dist/components/charts/physics/chainReactionTypes.d.ts +3 -0
  123. package/dist/components/charts/physics/gauntletPhysics.d.ts +1 -0
  124. package/dist/components/charts/physics/physicsHocUtils.d.ts +7 -1
  125. package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +10 -1
  126. package/dist/components/charts/realtime/RealtimeHistogram.d.ts +11 -1
  127. package/dist/components/charts/realtime/RealtimeLineChart.d.ts +14 -5
  128. package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +7 -1
  129. package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +7 -1
  130. package/dist/components/charts/realtime/aggregate.d.ts +12 -1
  131. package/dist/components/charts/realtime/realtimeChartRuntime.d.ts +4 -2
  132. package/dist/components/charts/realtime/realtimeStyleRules.d.ts +4 -0
  133. package/dist/components/charts/shared/annotationStatusFilter.d.ts +18 -0
  134. package/dist/components/charts/shared/chartDefinitionPilot.d.ts +5 -4
  135. package/dist/components/charts/shared/chartSpecCore.d.ts +2 -2
  136. package/dist/components/charts/shared/heatmapStyleRules.d.ts +13 -0
  137. package/dist/components/charts/shared/knownChartComponents.d.ts +1 -1
  138. package/dist/components/charts/shared/networkUtils.d.ts +14 -0
  139. package/dist/components/charts/shared/selectionUtils.d.ts +3 -1
  140. package/dist/components/charts/shared/types.d.ts +4 -2
  141. package/dist/components/charts/shared/useChartLegend.d.ts +2 -1
  142. package/dist/components/charts/shared/useLikertAggregation.d.ts +8 -2
  143. package/dist/components/charts/shared/useNetworkChartSetup.d.ts +9 -5
  144. package/dist/components/charts/shared/useOrdinalPieceStyle.d.ts +1 -1
  145. package/dist/components/charts/shared/useXYBrush.d.ts +24 -0
  146. package/dist/components/charts/xy/Heatmap.d.ts +16 -0
  147. package/dist/components/charts/xy/LineChart.d.ts +9 -0
  148. package/dist/components/charts/xy/Scatterplot.d.ts +7 -0
  149. package/dist/components/charts/xy/WaterfallChart.capability.d.ts +2 -0
  150. package/dist/components/charts/xy/WaterfallChart.d.ts +68 -0
  151. package/dist/components/evidence/chartEvidenceEnvelope.d.ts +146 -0
  152. package/dist/components/evidence/evidenceGate.d.ts +28 -0
  153. package/dist/components/realtime/BinAccumulator.d.ts +5 -1
  154. package/dist/components/realtime/types.d.ts +16 -7
  155. package/dist/components/recipes/adjacencyFlow.d.ts +12 -0
  156. package/dist/components/recipes/adjacencyFlowAggregation.d.ts +72 -0
  157. package/dist/components/recipes/adjacencyFlowGeometry.d.ts +79 -0
  158. package/dist/components/recipes/lineageDag.d.ts +17 -0
  159. package/dist/components/recipes/lineageDagHulls.d.ts +22 -0
  160. package/dist/components/recipes/transitDiagram.d.ts +75 -0
  161. package/dist/components/recipes/transitDiagramGeometry.d.ts +47 -0
  162. package/dist/components/semiotic-access.d.ts +9 -0
  163. package/dist/components/semiotic-ai-audits.d.ts +17 -0
  164. package/dist/components/semiotic-ai-core.d.ts +9 -0
  165. package/dist/components/semiotic-ai.d.ts +5 -17
  166. package/dist/components/semiotic-evidence.d.ts +10 -0
  167. package/dist/components/semiotic-line.d.ts +9 -0
  168. package/dist/components/semiotic-network.d.ts +3 -0
  169. package/dist/components/semiotic-ordinal.d.ts +2 -0
  170. package/dist/components/semiotic-realtime-core.d.ts +3 -2
  171. package/dist/components/semiotic-recipes-core.d.ts +6 -0
  172. package/dist/components/semiotic-themes-core.d.ts +3 -0
  173. package/dist/components/semiotic-utils-core.d.ts +5 -0
  174. package/dist/components/semiotic-xy.d.ts +3 -0
  175. package/dist/components/semiotic.d.ts +9 -3
  176. package/dist/components/server/renderDashboard.d.ts +37 -0
  177. package/dist/components/server/renderEvidence.d.ts +27 -0
  178. package/dist/components/server/renderToStaticSVG.d.ts +2 -30
  179. package/dist/components/server/serverChartConfigShared.d.ts +13 -0
  180. package/dist/components/server/serverChartConfigs.d.ts +9 -0
  181. package/dist/components/server/serverChartConfigsComposite.d.ts +4 -0
  182. package/dist/components/server/serverChartConfigsCustom.d.ts +2 -0
  183. package/dist/components/server/serverChartConfigsGeo.d.ts +1 -0
  184. package/dist/components/server/serverChartConfigsOrdinal.d.ts +3 -2
  185. package/dist/components/server/serverChartConfigsXY.d.ts +1 -0
  186. package/dist/components/server/serverChartConfigsXYExtra.d.ts +3 -0
  187. package/dist/components/server/serverCompositeChainReaction.d.ts +3 -0
  188. package/dist/components/server/serverOrdinalGauge.d.ts +3 -0
  189. package/dist/components/server/serverOrdinalLikert.d.ts +2 -0
  190. package/dist/components/store/selectionProvenance.d.ts +8 -0
  191. package/dist/components/store/themeCore.d.ts +5 -1
  192. package/dist/components/stream/GeoPipelineStore.d.ts +1 -1
  193. package/dist/components/stream/MarginalGraphics.d.ts +3 -3
  194. package/dist/components/stream/MarginalGraphicsLazy.d.ts +22 -0
  195. package/dist/components/stream/NetworkPipelineStore.d.ts +2 -0
  196. package/dist/components/stream/OrdinalPipelineStore.d.ts +1 -1
  197. package/dist/components/stream/PipelineStore.d.ts +1 -1
  198. package/dist/components/stream/SceneToSVG.d.ts +1 -1
  199. package/dist/components/stream/canvasSetup.d.ts +8 -2
  200. package/dist/components/stream/customLayoutAttempt.d.ts +21 -0
  201. package/dist/components/stream/geoTypes.d.ts +1 -1
  202. package/dist/components/stream/isServerEnvironment.d.ts +6 -0
  203. package/dist/components/stream/layouts/forceLayoutNodeSize.d.ts +12 -0
  204. package/dist/components/stream/layouts/forceLayoutPlugin.d.ts +2 -9
  205. package/dist/components/stream/layouts/forceLayoutWorkerClient.d.ts +2 -21
  206. package/dist/components/stream/layouts/forceLayoutWorkerPolicy.d.ts +21 -0
  207. package/dist/components/stream/layouts/index.d.ts +6 -12
  208. package/dist/components/stream/layouts/missingPlugin.d.ts +7 -0
  209. package/dist/components/stream/layouts/registerBuiltIn.d.ts +1 -0
  210. package/dist/components/stream/layouts/registry.d.ts +12 -0
  211. package/dist/components/stream/marginalConfig.d.ts +3 -0
  212. package/dist/components/stream/networkCustomLayout.d.ts +7 -0
  213. package/dist/components/stream/networkCustomLayoutOutput.d.ts +13 -0
  214. package/dist/components/stream/networkCustomLayoutRunner.d.ts +1 -1
  215. package/dist/components/stream/networkTypes.d.ts +5 -1
  216. package/dist/components/stream/ordinalTypes.d.ts +1 -1
  217. package/dist/components/stream/physics/StreamPhysicsTypes.d.ts +1 -1
  218. package/dist/components/stream/pipelineDomainResolution.d.ts +6 -0
  219. package/dist/components/stream/renderers/pointCanvasRenderer.d.ts +4 -0
  220. package/dist/components/stream/renderers/resolveCSSColor.d.ts +4 -4
  221. package/dist/components/stream/types.d.ts +8 -1
  222. package/dist/components/stream/useEnsureCustomXYRenderers.d.ts +18 -0
  223. package/dist/components/stream/useMarginalValues.d.ts +13 -0
  224. package/dist/components/stream/xyCanvasRenderers.d.ts +4 -4
  225. package/dist/components/stream/xyPlugins/areaPlugin.d.ts +2 -0
  226. package/dist/components/stream/xyPlugins/barPlugin.d.ts +2 -0
  227. package/dist/components/stream/xyPlugins/candlestickPlugin.d.ts +2 -0
  228. package/dist/components/stream/xyPlugins/customPlugin.d.ts +6 -0
  229. package/dist/components/stream/xyPlugins/heatmapPlugin.d.ts +2 -0
  230. package/dist/components/stream/xyPlugins/lineFamily.d.ts +5 -0
  231. package/dist/components/stream/xyPlugins/linePlugin.d.ts +2 -0
  232. package/dist/components/stream/xyPlugins/missingPlugin.d.ts +7 -0
  233. package/dist/components/stream/xyPlugins/mixedPlugin.d.ts +2 -0
  234. package/dist/components/stream/xyPlugins/pointPlugin.d.ts +3 -0
  235. package/dist/components/stream/xyPlugins/registerBuiltIn.d.ts +1 -0
  236. package/dist/components/stream/xyPlugins/registry.d.ts +31 -0
  237. package/dist/components/stream/xyPlugins/stackedAreaPlugin.d.ts +2 -0
  238. package/dist/components/stream/xyPlugins/swarmPlugin.d.ts +2 -0
  239. package/dist/components/stream/xyPlugins/waterfallPlugin.d.ts +2 -0
  240. package/dist/forceLayoutWorker.js +1 -1
  241. package/dist/geo.min.js +1 -1
  242. package/dist/geo.module.min.js +1 -1
  243. package/dist/network.module.min.js +1 -1
  244. package/dist/ordinal.module.min.js +1 -1
  245. package/dist/physics.module.min.js +1 -1
  246. package/dist/rough.module.min.js +1 -1
  247. package/dist/semiotic-access.d.ts +9 -0
  248. package/dist/semiotic-access.min.js +2 -0
  249. package/dist/semiotic-access.module.min.js +2 -0
  250. package/dist/semiotic-ai-core.d.ts +9 -0
  251. package/dist/semiotic-ai-core.min.js +1 -1
  252. package/dist/semiotic-ai-core.module.min.js +1 -1
  253. package/dist/semiotic-ai.d.ts +5 -17
  254. package/dist/semiotic-ai.module.min.js +1 -1
  255. package/dist/semiotic-client-cjs-shared.min.js +1 -1
  256. package/dist/semiotic-client-shared.module.min.js +1 -1
  257. package/dist/semiotic-evidence.d.ts +10 -0
  258. package/dist/semiotic-evidence.min.js +1 -0
  259. package/dist/semiotic-evidence.module.min.js +1 -0
  260. package/dist/semiotic-experimental-auxiliary.module.min.js +1 -1
  261. package/dist/semiotic-experimental-node-auxiliary.module.min.js +1 -1
  262. package/dist/semiotic-experimental-react-shared.module.min.js +1 -1
  263. package/dist/semiotic-experimental-vacp.min.js +1 -1
  264. package/dist/semiotic-experimental-vacp.module.min.js +1 -1
  265. package/dist/semiotic-line.d.ts +9 -0
  266. package/dist/semiotic-line.min.js +2 -0
  267. package/dist/semiotic-line.module.min.js +2 -0
  268. package/dist/semiotic-network.d.ts +3 -0
  269. package/dist/semiotic-ordinal.d.ts +2 -0
  270. package/dist/semiotic-realtime-core.d.ts +3 -2
  271. package/dist/semiotic-realtime-core.module.min.js +1 -1
  272. package/dist/semiotic-recipes-core-cjs-base.min.js +1 -1
  273. package/dist/semiotic-recipes-core.d.ts +6 -0
  274. package/dist/semiotic-recipes-core.module.min.js +1 -1
  275. package/dist/semiotic-server-edge-node.module.min.js +1 -1
  276. package/dist/semiotic-server-edge.min.js +1 -1
  277. package/dist/semiotic-server-edge.module.min.js +1 -1
  278. package/dist/semiotic-server-node.min.js +1 -1
  279. package/dist/semiotic-server-node.module.min.js +1 -1
  280. package/dist/semiotic-themes-core.d.ts +3 -0
  281. package/dist/semiotic-themes-core.min.js +1 -1
  282. package/dist/semiotic-themes-core.module.min.js +1 -1
  283. package/dist/semiotic-themes.min.js +1 -1
  284. package/dist/semiotic-themes.module.min.js +1 -1
  285. package/dist/semiotic-utils-core.d.ts +5 -0
  286. package/dist/semiotic-utils-core.min.js +1 -1
  287. package/dist/semiotic-utils-core.module.min.js +1 -1
  288. package/dist/semiotic-xy.d.ts +3 -0
  289. package/dist/semiotic.d.ts +9 -3
  290. package/dist/semiotic.module.min.js +1 -1
  291. package/dist/server.min.js +1 -1
  292. package/dist/server.module.min.js +1 -1
  293. package/dist/xy.module.min.js +1 -1
  294. package/package.json +39 -60
  295. package/dist/c-3KZD6AXJ.min.js +0 -1
  296. package/dist/c-4TWEX5HG.min.js +0 -1
  297. package/dist/c-5YCIX3VZ.min.js +0 -1
  298. package/dist/c-6FEKTA3U.min.js +0 -1
  299. package/dist/c-74HEEZGK.min.js +0 -1
  300. package/dist/c-BWNB6USU.min.js +0 -1
  301. package/dist/c-C25ENHIK.min.js +0 -1
  302. package/dist/c-CDR5AO3R.min.js +0 -1
  303. package/dist/c-E3JFRRMI.min.js +0 -1
  304. package/dist/c-EBFPQHHO.min.js +0 -1
  305. package/dist/c-GIKRQI4X.min.js +0 -1
  306. package/dist/c-GPYOFETM.min.js +0 -1
  307. package/dist/c-IDUHYYSI.min.js +0 -1
  308. package/dist/c-JAZ73J32.min.js +0 -1
  309. package/dist/c-KG3NXHAL.min.js +0 -1
  310. package/dist/c-KII3PLZE.min.js +0 -1
  311. package/dist/c-LIXGXMNS.min.js +0 -1
  312. package/dist/c-LVEY6D6B.min.js +0 -1
  313. package/dist/c-M4Y3BHFR.min.js +0 -1
  314. package/dist/c-MAIICR2Z.min.js +0 -1
  315. package/dist/c-MG5DM6VE.min.js +0 -1
  316. package/dist/c-O6U6K4CW.min.js +0 -1
  317. package/dist/c-OQ7M4AGV.min.js +0 -1
  318. package/dist/c-OXYMVK7Q.min.js +0 -1
  319. package/dist/c-QHF5YON3.min.js +0 -1
  320. package/dist/c-RR3GO5SW.min.js +0 -1
  321. package/dist/c-S2BXNNJN.min.js +0 -1
  322. package/dist/c-SUILCHWU.min.js +0 -1
  323. package/dist/c-US5ZFT6E.min.js +0 -1
  324. package/dist/c-UUKVD4WB.min.js +0 -1
  325. package/dist/c-WJCD5EUY.min.js +0 -1
  326. package/dist/c-YDAY2WFR.min.js +0 -1
  327. package/dist/c-ZOWWU34K.min.js +0 -1
  328. /package/dist/{c-COHXCW3Q.min.js → c-YZVRZGX2.min.js} +0 -0
@@ -1 +0,0 @@
1
- import{buildNavGraph as t,extractGeoNavPoints as e,extractOrdinalNavPoints as r,extractXYNavPoints as n,navPointToHover as i,nextGraphIndex as s,nextIndex as o,renderCirclePulse as c,resolvePosition as u}from"./c-GPYOFETM.min.js";import{emitClickObservations as a,emitHoverObservations as f,isInteractiveKeyboardTarget as l,resolveCanvasFill as h}from"./c-GIKRQI4X.min.js";var p=class{constructor(t){if(this._capacity=t,this.head=0,this._size=0,1>t)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(t)}push(t){let e;return this._size===this._capacity?e=this.buffer[this.head]:this._size++,this.buffer[this.head]=t,this.head=(this.head+1)%this._capacity,e}pushMany(t){const e=[];for(const r of t){const t=this.push(r);void 0!==t&&e.push(t)}return e}get(t){if(t>=0&&this._size>t)return this.buffer[(this.head-this._size+t+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let t=0;return{next:()=>this._size>t?{done:!1,value:this.get(t++)}:{done:!0,value:void 0}}}forEach(t){const e=(this.head-this._size+this._capacity)%this._capacity;for(let r=0;this._size>r;r++)t(this.buffer[(e+r)%this._capacity],r)}toArray(){const t=Array(this._size),e=(this.head-this._size+this._capacity)%this._capacity;for(let r=0;this._size>r;r++)t[r]=this.buffer[(e+r)%this._capacity];return t}resize(t){if(1>t)throw Error("RingBuffer capacity must be at least 1");const e=this.toArray();let r=0,n=[];e.length>t&&(r=e.length-t,n=e.slice(0,r)),this._capacity=t,this.buffer=Array(t),this.head=0,this._size=0;for(let t=r;e.length>t;t++)this.push(e[t]);return n}update(t,e){const r=[],n=(this.head-this._size+this._capacity)%this._capacity;for(let i=0;this._size>i;i++){const s=(n+i)%this._capacity,o=this.buffer[s];if(t(o)){let t;t="object"!=typeof o||null===o?o:Array.isArray(o)?[...o]:{...o},r.push(t),this.buffer[s]=e(o)}}return r}remove(t){const e=[],r=[];if(this.forEach(n=>{t(n)?r.push(n):e.push(n)}),0===r.length)return r;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const t of e)this.push(t);return r}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}};function y(t,e,r,n){return"function"==typeof e.style?e.style(n||{},r):e.style&&"object"==typeof e.style?e.style:t.resolveBoundsStyle(r,n)}function d(t,e,r,n){if(!t.scales)return null;const i=[],s=[];for(const r of e){const e=t.getX(r);if(!Number.isFinite(e))continue;const o=n.getTop(r),c=n.getBottom(r);if(!Number.isFinite(o)||!Number.isFinite(c))continue;const u=t.scales.x(e),a=t.scales.y(o),f=t.scales.y(c);Number.isFinite(u)&&Number.isFinite(a)&&Number.isFinite(f)&&(i.push([u,a]),s.push([u,f]))}return 2>i.length?null:{type:"area",topPath:i,bottomPath:s,...t.config.curve&&"linear"!==t.config.curve&&{curve:t.config.curve},style:y(t,n,r,e[0]),datum:e,group:r,interactive:n.interactive}}function v(t){const e=[],r=[];if(!t)return{perSeries:e,aggregate:r};for(const n of t)n.perSeries?e.push(n):r.push(n);return{perSeries:e,aggregate:r}}function _(t,e,r){const n=[];for(const i of r){const r=d(t,e,"__ribbon_aggregate",i);r&&n.push(r)}return n}function g(t,e,r,n){const i=[];for(const s of n){const n=d(t,e,r,s);n&&i.push(n)}return i}function m(t,e){if(!t)return{};if(!e||0===e.length)return t;const r=[];for(const n of e){if("band"!==n.kind)continue;const e=n.getTop(t),i=n.getBottom(t);Number.isFinite(i)&&Number.isFinite(e)&&r.push({y0:i,y1:e})}return 0===r.length?t:{...t,band:r[0],bands:r}}function b(t,e,r,n){const i=n.current,s=!0===t.lastCustomLayoutFailure?.preservedLastGoodScene,o=!s&&t.hasActivePulsesAt(e),c=!(r||s||!o&&!i)&&t.refreshPulse(e);return n.current=o,{changed:c,pending:o}}import{useCallback as k,useEffect as z,useRef as A}from"react";function w(t,e,r,n){const i=A({accessor:e,onChange:r,readData:n}),s=A([]);i.current={accessor:e,onChange:r,readData:n};const o=k(()=>{const{accessor:e,onChange:r,readData:n}=i.current;if(!r||!e)return;const o=function(t,e){if(!e)return[];const r=new Set,n=[];for(const i of t){if(!i||"object"!=typeof i)continue;const t=("function"==typeof e?e(i):i[e])+"";r.has(t)||(r.add(t),n.push(t))}return n}(t.current?n(t.current):[],e);(function(t,e){if(t.length!==e.length)return!1;for(let r=0;t.length>r;r++)if(t[r]!==e[r])return!1;return!0})(o,s.current)||(s.current=o,r(o))},[t]);return z(()=>{s.current=[],o()},[e,o,r]),o}var R=(t,e,r,n)=>{const i=e.filter(t=>"point"===t.type);if(0!==i.length){t.save();try{const e=t.globalAlpha;for(const r of i){t.beginPath(),t.arc(r.x,r.y,r.r,0,2*Math.PI),t.globalAlpha=e*(r.style.opacity??r.style.fillOpacity??1),t.fillStyle=h(t,r.style.fill,"#4e79a7"),t.fill();const n=r.style.strokeWidth??1;r.style.stroke&&"none"!==r.style.stroke&&n>0&&(t.strokeStyle=h(t,r.style.stroke,r.style.stroke),t.lineWidth=n,t.stroke()),c(t,r)}}finally{t.restore()}}};import{useCallback as x}from"react";function P({customHoverBehavior:t,customClickBehavior:e,onObservation:r,chartId:n,chartType:i}){const s=!(!t&&!r),o=!(!e&&!r),c=x((e,s)=>{t?.(e,s),f({onObservation:r,datum:e?e.data||e:null,x:e?.x,y:e?.y,chartType:i,chartId:n,context:s})},[n,i,t,r]),u=x((t,s)=>{e?.(t,s),a({onObservation:r,datum:t?t.data||t:null,x:t?.x,y:t?.y,chartType:i,chartId:n,context:s})},[n,i,e,r]);return{customHoverBehavior:s?c:void 0,customClickBehavior:o?u:void 0,hasClickBehavior:o}}import{useCallback as C,useRef as D}from"react";function B({storeRef:e,hoverRef:r,hoveredNodeRef:n,setHoverPoint:i,customHoverBehavior:o,customClickBehavior:c,scheduleRender:a,extractPoints:f,toHover:h}){const p=D(-1),y=D(null),d=D(null),v=C(v=>{if(l(v))return;const _=e.current;if(!_)return;const g=()=>{p.current=-1,y.current=null,r.current=null,n&&(n.current=null),i(null),o?.(null),a()};if(0===_.scene.length)return void(0>p.current||g());let m;if(d.current?.version===_.version)m=d.current.graph;else{const e=f(_.scene);if(0===e.length)return void(0>p.current||g());m=t(e),d.current={version:_.version,graph:m}}let b=p.current;if(m.flat.length>b||(g(),b=-1),("Enter"===v.key||" "===v.key)&&b>=0)return v.preventDefault(),void c?.(h(m.flat[b],_),{type:"activate",inputType:"keyboard"});if(0>b){if("Escape"===v.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(v.key))return;v.preventDefault(),p.current=0;const t=m.flat[0];y.current=t;const e=h(t,_);return r.current=e,i(e),o?.(e,{type:"focus",inputType:"keyboard"}),void a()}const k=s(v.key,u(m,b),m);if(null===k)return;if(v.preventDefault(),0>k)return void g();p.current=k;const z=m.flat[k];y.current=z;const A=h(z,_);r.current=A,i(A),o?.(A,{type:"focus",inputType:"keyboard"}),a()},[c,o,f,r,n,a,i,e,h]);return{kbFocusIndexRef:p,focusedNavPointRef:y,onKeyDown:v}}function T(t){return B({...t,extractPoints:n,toHover:(t,e)=>i({...t,datum:m(t.datum,e.resolvedRibbons)})})}function F({chartType:t,oAccessor:e,rAccessor:n,...s}){return B({...s,extractPoints:r,toHover:r=>({...i(r),__oAccessor:"string"==typeof e?e:void 0,__rAccessor:"string"==typeof n?n:void 0,__chartType:t})})}function I(t){const e=t.datum;return{...e||{},...e?.properties||{},data:e,properties:e?.properties,x:t.x,y:t.y,__semioticHoverData:!0}}function N({storeRef:t,hoverRef:r,hoveredNodeRef:n,setHoverPoint:i,customHoverBehavior:s,customClickBehavior:c,scheduleRender:u}){const a=D(-1),f=D(null),h=C(h=>{if(l(h))return;const p=t.current;if(!p)return;const y=()=>{a.current=-1,f.current=null,r.current=null,n&&(n.current=null),i(null),s?.(null),u()};if(0===p.scene.length)return void(0>a.current||y());const d=e(p.scene);if(0===d.length)return void(0>a.current||y());let v=a.current;if(d.length>v||(y(),v=-1),("Enter"===h.key||" "===h.key)&&v>=0)return h.preventDefault(),void c?.(I(d[v]),{type:"activate",inputType:"keyboard"});const _=o(h.key,0>v?-1:v,d.length);if(null===_)return;if(h.preventDefault(),0>_)return void y();const g=0>v?0:_;a.current=g;const m=d[g];f.current=m;const b=I(m);r.current=b,i(b),s?.(b,{type:"focus",inputType:"keyboard"}),u()},[c,s,r,n,u,i,t]);return{kbFocusIndexRef:a,focusedNavPointRef:f,onKeyDown:h}}function E(t,e,r){const n=t.duration??500,i=r-e;return n>i?1-i/n:0}function H(t,e,r,n,i,s=("undefined"!=typeof performance?performance.now():Date.now())){const o=t.color??"rgba(255,255,255,0.6)",c=t.glowRadius??4;let u=!1;const a=i??(()=>{const t=new Map;for(let e=0;r.length>e;e++)t.set(r[e],e);return t})();for(const r of e){if("line"===r.type)continue;if("area"===r.type){const e=Array.isArray(r.datum)?r.datum:[r.datum];let i=0,c=!1;for(const r of e){const e=a.get(r);if(null==e)continue;c=!0;const o=n.get(e);if(null==o)continue;const u=E(t,o,s);u>i&&(i=u)}c&&(u=S(r,i,o)||u);continue}const e=a.get(r.datum);if(null==e)continue;const i=n.get(e);u=S(r,null==i?0:E(t,i,s),o,c)||u}return u}function S(t,e,r,n){let i=!1;return e>0?(t._pulseIntensity!==e&&(t._pulseIntensity=e,i=!0),t._pulseColor!==r&&(t._pulseColor=r,i=!0),t._pulseGlowRadius!==n&&(t._pulseGlowRadius=n,i=!0),i):(0!==t._pulseIntensity&&(t._pulseIntensity=0,i=!0),void 0!==t._pulseColor&&(t._pulseColor=void 0,i=!0),void 0!==t._pulseGlowRadius&&(t._pulseGlowRadius=void 0,i=!0),i)}function G(t,e,r=("undefined"!=typeof performance?performance.now():Date.now())){if(!e||0===e.size)return!1;const n=t.duration??500,i=e.peek();return null!=i&&n>r-i}function O(t,e,r){e>t.capacity&&(t.resize(e),r&&e>r.capacity&&r.resize(e))}function j(t,e){const r=new p(t.capacity);return t.forEach(()=>r.push(e)),r}function M(t,e,r,n){const i=t.push(e);return r&&r.push(n),i}function K(t,e,r){if(!e||0===e.size)return;const n=new Set;if(t.forEach((t,e)=>{r(t)&&n.add(e)}),0===n.size)return;const i=e.toArray();e.clear();for(let t=0;i.length>t;t++)n.has(t)||e.push(i[t])}export{p as RingBuffer,E as computePulseIntensity,H as applyPulse,S as setPulseState,G as hasActivePulses,v as partitionRibbons,_ as buildAggregateRibbons,g as buildPerSeriesRibbons,m as enrichDatumWithBand,O as ensureRingBufferCapacity,j as createTimestampBufferForData,M as pushWithTimestamp,K as compactTimestampBufferForRemoval,b as refreshIdlePulse,w as useLegendCategoryEmission,R as pointCanvasRenderer,P as useSemanticFrameInteractions,T as useXYKeyboardNavigation,F as useOrdinalKeyboardNavigation,N as useGeoKeyboardNavigation};
@@ -1 +0,0 @@
1
- var e=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],a={mode:"light",colors:{primary:"#00a2ce",secondary:"#6c757d",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"transparent",surface:"#ffffff",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc",selection:"#00a2ce",selectionOpacity:.15,success:"#2ca02c",danger:"#d62728",warning:"#f0ad4e",error:"#b4181b",info:"#00a2ce"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:12}},o={mode:"dark",colors:{primary:"#4fc3f7",secondary:"#90a4ae",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",diverging:"RdBu",background:"#1a1a2e",surface:"#252540",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555",selection:"#4fc3f7",selectionOpacity:.15,success:"#81c784",danger:"#ef5350",warning:"#ffb74d",error:"#d84848",info:"#4fc3f7"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:12}},r={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:e,sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#000000",textSecondary:"#333333",grid:"#999999",border:"#000000",focus:"#0000cc",selection:"#0000cc",selectionOpacity:.1,success:"#006400",danger:"#cc0000",warning:"#b15a00",error:"#8b0000",info:"#0000cc"},typography:{fontFamily:"system-ui, sans-serif",titleSize:18,labelSize:14,tickSize:12},tooltip:{background:"#000000",text:"#ffffff",borderRadius:"4px",fontSize:"14px",shadow:"0 2px 8px rgba(0, 0, 0, 0.3)"},borderRadius:"4px"};function i(e){if(!e?.colors)return;const a=e.colors;return{primary:a.primary,secondary:a.secondary||a.primary,surface:a.surface||a.background,success:a.success,danger:a.danger,warning:a.warning,error:a.error,info:a.info,text:a.text,textSecondary:a.textSecondary,border:a.border,grid:a.grid}}function t(a){if(!a.accessibility)return a;let o=a;if(a.accessibility.colorBlindSafe&&(o={...o,colors:{...o.colors,categorical:e}}),a.accessibility.highContrast){const e="dark"===o.mode;o={...o,colors:{...o.colors,text:e?"#ffffff":"#000000",textSecondary:e?"#cccccc":"#333333",grid:e?"#666666":"#999999",border:e?"#888888":"#000000"}}}return o}var c={mode:"light",colors:{primary:"#c9a0dc",secondary:"#b8a8c8",categorical:["#f0a0c0","#88d4ab","#b0a0e8","#f0c888"],sequential:"purples",background:"#fdf6f0",surface:"#fff5ee",text:"#4a3728",textSecondary:"#7a644a",grid:"#e8d5c4",border:"#e8d5c4",focus:"#8a5fae",annotation:"#8a5fae",success:"#9ad4a3",danger:"#e8869a",warning:"#f0c888",error:"#c86070",info:"#9cb8e0"},typography:{fontFamily:"Inter, system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#fff5ee",text:"#4a3728",borderRadius:"8px",shadow:"0 2px 8px rgba(0, 0, 0, 0.12)"},borderRadius:"10px"},s={mode:"dark",colors:{primary:"#c9a0dc",secondary:"#a899c0",categorical:["#f0a0c0","#88d4ab","#b0a0e8","#f0c888"],sequential:"purples",background:"#1a1525",surface:"#251e35",text:"#e8ddf0",textSecondary:"#a899c0",grid:"#3d3455",border:"#3d3455",focus:"#c9a0dc",annotation:"#c9a0dc",success:"#88d4ab",danger:"#f0a0c0",warning:"#f0c888",error:"#e87690",info:"#9cb8e0"},typography:{fontFamily:"Inter, system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#251e35",text:"#e8ddf0",borderRadius:"8px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"10px"},f={mode:"light",colors:{primary:"#2563eb",secondary:"#6b7280",categorical:["#2563eb","#0d9488","#ea580c","#6b7280"],sequential:"blues",background:"#f5f6f8",surface:"#ffffff",text:"#2c3e50",textSecondary:"#64717f",grid:"#d8dce3",border:"#d8dce3",focus:"#2563eb",annotation:"#2563eb",success:"#10b981",danger:"#ef4444",warning:"#f59e0b",error:"#dc2626",info:"#2563eb"},typography:{fontFamily:"'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#ffffff",text:"#2c3e50",borderRadius:"6px",shadow:"0 2px 8px rgba(0, 0, 0, 0.12)"},borderRadius:"8px"},d={mode:"dark",colors:{primary:"#3b82f6",secondary:"#9ca3af",categorical:["#3b82f6","#14b8a6","#f97316","#9ca3af"],sequential:"blues",background:"#111827",surface:"#1f2937",text:"#f3f4f6",textSecondary:"#9ca3af",grid:"#374151",border:"#374151",focus:"#3b82f6",annotation:"#3b82f6",success:"#34d399",danger:"#f87171",warning:"#fbbf24",error:"#ef4444",info:"#60a5fa"},typography:{fontFamily:"'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#1f2937",text:"#f3f4f6",borderRadius:"6px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"8px"},n={mode:"light",colors:{primary:"#cc0000",secondary:"#666666",categorical:["#cc0000","#333333","#c8a415","#4682b4"],sequential:"reds",background:"#fafafa",surface:"#ffffff",text:"#1a1a1a",textSecondary:"#666666",grid:"#e0e0e0",border:"#e0e0e0",focus:"#cc0000",annotation:"#cc0000",success:"#556b2f",danger:"#cc0000",warning:"#c8a415",error:"#8b0000",info:"#4682b4"},typography:{fontFamily:"'Helvetica Neue', Helvetica, Arial, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#ffffff",text:"#1a1a1a",borderRadius:"2px",shadow:"0 2px 4px rgba(0, 0, 0, 0.15)"},borderRadius:"2px"},l={mode:"dark",colors:{primary:"#ff3333",secondary:"#aaaaaa",categorical:["#ff3333","#aaaaaa","#d4a843","#6aa4d4"],sequential:"reds",background:"#0a0a0a",surface:"#1a1a1a",text:"#f5f5f5",textSecondary:"#aaaaaa",grid:"#333333",border:"#333333",focus:"#ff3333",annotation:"#ff3333",success:"#7a8b5a",danger:"#ff3333",warning:"#d4a843",error:"#cc0000",info:"#6aa4d4"},typography:{fontFamily:"'Helvetica Neue', Helvetica, Arial, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#1a1a1a",text:"#f5f5f5",borderRadius:"2px",shadow:"0 2px 8px rgba(0, 0, 0, 0.5)"},borderRadius:"2px"},b={mode:"light",colors:{primary:"#8b0000",secondary:"#555555",categorical:["#8b4513","#556b2f","#4a5568","#800020"],sequential:"oranges",background:"#fffff8",surface:"#fffff8",text:"#111111",textSecondary:"#555555",grid:"#e0ddd0",border:"#e0ddd0",focus:"#8b0000",annotation:"#8b0000",success:"#556b2f",danger:"#8b0000",warning:"#b88700",error:"#6b0000",info:"#4a5568"},typography:{fontFamily:"Georgia, 'Times New Roman', serif",titleSize:16,labelSize:12,tickSize:12,tickFontFamily:"'Courier New', Courier, monospace",legendSize:11},tooltip:{background:"#fffff8",text:"#111111",borderRadius:"2px",shadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},borderRadius:"0px"},g={mode:"dark",colors:{primary:"#c05050",secondary:"#a09880",categorical:["#c08050","#7a8b5a","#8090a0","#a05060"],sequential:"oranges",background:"#1c1b18",surface:"#262520",text:"#e8e4d8",textSecondary:"#a09880",grid:"#3d3c35",border:"#3d3c35",focus:"#c05050",annotation:"#d06a6a",success:"#7a8b5a",danger:"#c05050",warning:"#c8a060",error:"#a04040",info:"#8090a0"},typography:{fontFamily:"Georgia, 'Times New Roman', serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#262520",text:"#e8e4d8",borderRadius:"2px",shadow:"0 2px 6px rgba(0, 0, 0, 0.4)"},borderRadius:"0px"},p={mode:"light",colors:{primary:"#e45050",secondary:"#666666",categorical:["#3a86c8","#e45050","#d4a843","#888888"],sequential:"blues",background:"#ffffff",surface:"#f8f8f8",text:"#222222",textSecondary:"#666666",grid:"#d4d4d4",border:"#d4d4d4",focus:"#e45050",annotation:"#c63b3b",success:"#2d7a3d",danger:"#c8303a",warning:"#d4a843",error:"#a02028",info:"#3a86c8"},typography:{fontFamily:"'Franklin Gothic Medium', 'Libre Franklin', Arial, sans-serif",titleSize:18,labelSize:12,tickSize:12,tickFontFamily:"'Courier New', Courier, monospace",legendSize:11},tooltip:{background:"#f8f8f8",text:"#222222",borderRadius:"4px",shadow:"0 2px 6px rgba(0, 0, 0, 0.12)"},borderRadius:"4px"},u={mode:"dark",colors:{primary:"#ff6b6b",secondary:"#a0a0a0",categorical:["#5a9fd8","#ff6b6b","#e0c060","#aaaaaa"],sequential:"blues",background:"#141414",surface:"#1e1e1e",text:"#ededed",textSecondary:"#a0a0a0",grid:"#383838",border:"#383838",focus:"#ff6b6b",annotation:"#ff6b6b",success:"#6fba78",danger:"#ff6b6b",warning:"#e0c060",error:"#d04040",info:"#5a9fd8"},typography:{fontFamily:"'Franklin Gothic Medium', 'Libre Franklin', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#1e1e1e",text:"#ededed",borderRadius:"4px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"4px"},y={mode:"light",colors:{primary:"#8b5cf6",secondary:"#7c5a9e",categorical:["#8b5cf6","#ec4899","#06b6d4","#84cc16"],sequential:"viridis",background:"#fdf8ff",surface:"#ffffff",text:"#2d1b4e",textSecondary:"#7c5a9e",grid:"#e8d0f8",border:"#e8d0f8",focus:"#8b5cf6",annotation:"#7a47e8",success:"#10d870",danger:"#ff4b6e",warning:"#ffaa33",error:"#e11d48",info:"#06b6d4"},typography:{fontFamily:"'Nunito', 'Poppins', system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#ffffff",text:"#2d1b4e",borderRadius:"12px",shadow:"0 4px 12px rgba(139, 92, 246, 0.15)"},borderRadius:"12px"},x={mode:"dark",colors:{primary:"#a78bfa",secondary:"#b8a0d8",categorical:["#a78bfa","#f472b6","#22d3ee","#a3e635"],sequential:"viridis",background:"#150a28",surface:"#1f1138",text:"#f0e8ff",textSecondary:"#b8a0d8",grid:"#3a2560",border:"#3a2560",focus:"#a78bfa",annotation:"#a78bfa",success:"#4ade80",danger:"#fb7185",warning:"#fbbf24",error:"#f43f5e",info:"#22d3ee"},typography:{fontFamily:"'Nunito', 'Poppins', system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#1f1138",text:"#f0e8ff",borderRadius:"12px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"12px"},m=["#6929c4","#1192e8","#005d5d","#9f1853","#fa4d56","#570408","#198038","#002d9c","#ee538b","#b28600","#009d9a","#012749","#8a3800","#a56eff"],S={danger:"#da1e28",warning:"#f1c21b",success:"#24a148",info:"#0043ce"},k={mode:"light",colors:{primary:"#0f62fe",secondary:"#525252",categorical:["#6929c4","#1192e8","#005d5d","#9f1853"],sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#161616",textSecondary:"#525252",grid:"#e0e0e0",border:"#e0e0e0",focus:"#0f62fe",annotation:"#0f62fe",success:"#24a148",danger:"#da1e28",warning:"#f1c21b",error:"#a2191f",info:"#0043ce"},typography:{fontFamily:"'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#ffffff",text:"#161616",borderRadius:"2px",shadow:"0 2px 6px rgba(0, 0, 0, 0.2)"},borderRadius:"0px"},h={mode:"dark",colors:{primary:"#4589ff",secondary:"#a8a8a8",categorical:["#a56eff","#33b1ff","#08bdba","#ff7eb6"],sequential:"blues",diverging:"RdBu",background:"#161616",surface:"#262626",text:"#f4f4f4",textSecondary:"#a8a8a8",grid:"#393939",border:"#393939",focus:"#4589ff",annotation:"#4589ff",success:"#42be65",danger:"#fa4d56",warning:"#f1c21b",error:"#da1e28",info:"#4589ff"},typography:{fontFamily:"'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#262626",text:"#f4f4f4",borderRadius:"2px",shadow:"0 4px 12px rgba(0, 0, 0, 0.5)"},borderRadius:"0px"},z={light:a,dark:o,"high-contrast":r,pastels:c,"pastels-dark":s,"bi-tool":f,"bi-tool-dark":d,italian:n,"italian-dark":l,tufte:b,"tufte-dark":g,journalist:p,"journalist-dark":u,playful:y,"playful-dark":x,carbon:k,"carbon-dark":h};function w(e){return Object.prototype.hasOwnProperty.call(z,e)?z[e]:void 0}function F(e){const a={"--semiotic-bg":e.colors.background,"--semiotic-text":e.colors.text,"--semiotic-text-secondary":e.colors.textSecondary,"--semiotic-grid":e.colors.grid,"--semiotic-border":e.colors.border,"--semiotic-cell-border":e.colors.cellBorder||e.colors.border,"--semiotic-primary":e.colors.primary,"--semiotic-font-family":e.typography.fontFamily,"--semiotic-secondary":e.colors.secondary||e.colors.primary,"--semiotic-surface":e.colors.surface||e.colors.background};e.colors.categorical.forEach((e,o)=>{a["--semiotic-category-"+(o+1)]=e}),e.colors.focus&&(a["--semiotic-focus"]=e.colors.focus),e.colors.selection&&(a["--semiotic-selection-color"]=e.colors.selection),null!=e.colors.selectionOpacity&&(a["--semiotic-selection-opacity"]=e.colors.selectionOpacity+""),e.colors.diverging&&(a["--semiotic-diverging"]=e.colors.diverging),e.colors.annotation&&(a["--semiotic-annotation-color"]=e.colors.annotation),e.colors.success&&(a["--semiotic-success"]=e.colors.success),e.colors.danger&&(a["--semiotic-danger"]=e.colors.danger),e.colors.warning&&(a["--semiotic-warning"]=e.colors.warning),e.colors.error&&(a["--semiotic-error"]=e.colors.error),e.colors.info&&(a["--semiotic-info"]=e.colors.info),e.tooltip?.background&&(a["--semiotic-tooltip-bg"]=e.tooltip.background),e.tooltip?.text&&(a["--semiotic-tooltip-text"]=e.tooltip.text),e.tooltip?.borderRadius&&(a["--semiotic-tooltip-radius"]=e.tooltip.borderRadius),e.tooltip?.fontSize&&(a["--semiotic-tooltip-font-size"]=e.tooltip.fontSize),e.tooltip?.shadow&&(a["--semiotic-tooltip-shadow"]=e.tooltip.shadow),e.borderRadius&&(a["--semiotic-border-radius"]=e.borderRadius);const o=e.typography.legendSize??e.typography.labelSize;null!=o&&(a["--semiotic-legend-font-size"]=o+"px"),null!=e.typography.legendFontFamily&&(a["--semiotic-legend-font-family"]=e.typography.legendFontFamily),null!=e.typography.legendFontWeight&&(a["--semiotic-legend-font-weight"]=e.typography.legendFontWeight+"");const r=e.typography.titleFontSize??e.typography.titleSize;return null!=r&&(a["--semiotic-title-font-size"]=r+"px"),null!=e.typography.titleFontFamily&&(a["--semiotic-title-font-family"]=e.typography.titleFontFamily),null!=e.typography.titleFontWeight&&(a["--semiotic-title-font-weight"]=e.typography.titleFontWeight+""),null!=e.typography.tickFontFamily&&(a["--semiotic-tick-font-family"]=e.typography.tickFontFamily),null!=e.typography.tickSize&&(a["--semiotic-tick-font-size"]=e.typography.tickSize+"px"),null!=e.typography.labelSize&&(a["--semiotic-axis-label-font-size"]=e.typography.labelSize+"px"),a}export{e as COLOR_BLIND_SAFE_CATEGORICAL,a as LIGHT_THEME,o as DARK_THEME,r as HIGH_CONTRAST_THEME,i as resolveThemeSemanticColors,t as applyThemeAccessibility,c as PASTELS_LIGHT,s as PASTELS_DARK,f as BI_TOOL_LIGHT,d as BI_TOOL_DARK,n as ITALIAN_LIGHT,l as ITALIAN_DARK,b as TUFTE_LIGHT,g as TUFTE_DARK,p as JOURNALIST_LIGHT,u as JOURNALIST_DARK,y as PLAYFUL_LIGHT,x as PLAYFUL_DARK,m as CARBON_CATEGORICAL_14,S as CARBON_ALERT,k as CARBON_LIGHT,h as CARBON_DARK,z as THEME_PRESETS,w as resolveThemePreset,F as themeToCSSVariables};
@@ -1 +0,0 @@
1
- import{DARK_THEME as e,LIGHT_THEME as t,themeToCSSVariables as o}from"./c-O6U6K4CW.min.js";function r(e,t=":root"){return`${t} {\n${Object.entries(o(e)).map(([e,t])=>` ${e}: ${t};`).join("\n")}\n}`}function i(e){return{semiotic:{bg:{$value:e.colors.background,$type:"color"},text:{$value:e.colors.text,$type:"color"},"text-secondary":{$value:e.colors.textSecondary,$type:"color"},grid:{$value:e.colors.grid,$type:"color"},border:{$value:e.colors.border,$type:"color"},primary:{$value:e.colors.primary,$type:"color"},focus:{$value:e.colors.focus||e.colors.primary,$type:"color"},"font-family":{$value:e.typography.fontFamily,$type:"fontFamily"},"border-radius":{$value:e.borderRadius||"8px",$type:"dimension"},tooltip:{bg:{$value:e.tooltip?.background||e.colors.background,$type:"color"},text:{$value:e.tooltip?.text||e.colors.text,$type:"color"},radius:{$value:e.tooltip?.borderRadius||"6px",$type:"dimension"},"font-size":{$value:e.tooltip?.fontSize||"14px",$type:"dimension"},shadow:{$value:e.tooltip?.shadow||"0 2px 8px rgba(0,0,0,0.15)",$type:"shadow"}},selection:{color:{$value:e.colors.selection||e.colors.primary,$type:"color"},opacity:{$value:e.colors.selectionOpacity??.2,$type:"number"}},categorical:{$value:e.colors.categorical,$type:"color",$description:"Categorical color palette"},sequential:{$value:e.colors.sequential,$type:"string",$description:"d3-scale-chromatic sequential scheme name"},...e.colors.diverging?{diverging:{$value:e.colors.diverging,$type:"string",$description:"d3-scale-chromatic diverging scheme name"}}:{},...e.colors.annotation?{"annotation-color":{$value:e.colors.annotation,$type:"color"}}:{},...null!=e.typography.legendSize?{"legend-font-size":{$value:e.typography.legendSize+"px",$type:"dimension"}}:{},...null!=e.typography.legendFontFamily?{"legend-font-family":{$value:e.typography.legendFontFamily,$type:"fontFamily"}}:{},...null!=e.typography.legendFontWeight?{"legend-font-weight":{$value:e.typography.legendFontWeight,$type:"fontWeight"}}:{},"title-font-size":{$value:(e.typography.titleFontSize??e.typography.titleSize)+"px",$type:"dimension"},...null!=e.typography.titleFontFamily?{"title-font-family":{$value:e.typography.titleFontFamily,$type:"fontFamily"}}:{},...null!=e.typography.titleFontWeight?{"title-font-weight":{$value:e.typography.titleFontWeight,$type:"fontWeight"}}:{},...null!=e.typography.tickFontFamily?{"tick-font-family":{$value:e.typography.tickFontFamily,$type:"fontFamily"}}:{},...null!=e.typography.tickSize?{"tick-font-size":{$value:e.typography.tickSize+"px",$type:"dimension"}}:{},...null!=e.typography.labelSize?{"axis-label-font-size":{$value:e.typography.labelSize+"px",$type:"dimension"}}:{},secondary:{$value:e.colors.secondary||e.colors.primary,$type:"color"},surface:{$value:e.colors.surface||e.colors.background,$type:"color"},...e.colors.success?{success:{$value:e.colors.success,$type:"color"}}:{},...e.colors.danger?{danger:{$value:e.colors.danger,$type:"color"}}:{},...e.colors.warning?{warning:{$value:e.colors.warning,$type:"color"}}:{},...e.colors.error?{error:{$value:e.colors.error,$type:"color"}}:{},...e.colors.info?{info:{$value:e.colors.info,$type:"color"}}:{}}}}var n=/^\{([^}]+)\}$/,a={bg:"background",text:"text","text-secondary":"textSecondary",grid:"grid",border:"border",primary:"primary",focus:"focus",secondary:"secondary",surface:"surface",annotation:"annotation",success:"success",danger:"danger",warning:"warning",error:"error",info:"info"},l=[["textSecondary",/^(text-?secondary|secondary-?text|muted|subtle|text-?muted|fg-?muted)$/],["text",/^(text|foreground|fg|ink|on-?background|on-?surface|text-?default|fg-?default)$/],["background",/^(background|bg|canvas|base|page|backdrop|bg-?default)$/],["surface",/^(surface|card|elevated|panel|sheet)$/],["border",/^(border|divider|outline|stroke|hairline)$/],["grid",/^(grid|gridline|gridlines)$/],["primary",/^(primary|brand|accent|brand-?primary)$/],["secondary",/^(secondary|brand-?secondary)$/],["focus",/^(focus|ring|focus-?ring)$/],["error",/^(error|critical)$/],["danger",/^(danger|negative|destructive|fail|alert)$/],["success",/^(success|positive|ok|good|pass)$/],["warning",/^(warning|warn|caution)$/],["info",/^(info|information|note)$/],["annotation",/^(annotation|callout)$/]],c=/^rgba?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)(?:\s*,\s*[\d.]+)?\s*\)$/i;function s(e){return"string"==typeof e.value&&("color"===e.type||function(e){const t=e.trim();return/^#[0-9a-f]{3}(?:[0-9a-f]{3})?$/i.test(t)||c.test(t)||/^hsla?\(/i.test(t)}(e.value))}function u(e){return Array.isArray(e)&&e.every(e=>"string"==typeof e)?e.join(", "):"string"==typeof e?e:void 0}function p(e){if("number"==typeof e&&Number.isFinite(e))return e;if("string"!=typeof e)return;const t=e.trim().match(/^(-?(?:\d+|\d*\.\d+))px$/);return t?Number(t[1]):void 0}function y(e){return"string"==typeof e||"number"==typeof e&&Number.isFinite(e)?e:void 0}function g(o,r={}){const i=function(e){const t=new Map(e.map(e=>[e.path,e])),o=(e,r)=>{if(r>8||"string"!=typeof e)return e;const i=e.match(n);if(!i)return e;const a=t.get(i[1]);return a?o(a.value,r+1):e};return e.map(e=>({...e,value:o(e.value,0)}))}(function(e){const t=[],o=(e,r,i)=>{if(!e||"object"!=typeof e)return;const n=e,a=n.$type??i;if(function(e){return!!e&&"object"==typeof e&&"$value"in e}(n))t.push({path:r.join("."),leaf:r[r.length-1]??"",value:n.$value,type:n.$type??i});else for(const[e,t]of Object.entries(n))e.startsWith("$")||o(t,[...r,e],a)};return o(e,[]),t}(o)),g=new Map(i.map(e=>[e.path,e])),f=new Set,d={};for(const[e,t]of Object.entries(r.mapping??{})){if("fontFamily"===e||"categorical"===e)continue;const o=t?g.get(t):void 0;o&&"string"==typeof o.value&&(d[e]=o.value,f.add(o.path))}for(const e of i){const t=e.path.match(/^semiotic\.([^.]+)$/),o=t?a[t[1]]:void 0;o&&!(o in d)&&"string"==typeof e.value&&(d[o]=e.value,f.add(e.path))}for(const[e,t]of l){if(e in d)continue;const o=i.find(e=>!f.has(e.path)&&s(e)&&t.test(e.leaf.toLowerCase()));o&&"string"==typeof o.value&&(d[e]=o.value,f.add(o.path))}let $;const m=r.mapping?.categorical,v=(m?g.get(m):void 0)??g.get("semiotic.categorical")??i.find(e=>Array.isArray(e.value)&&/categor|chart|palette|qualitative|series/i.test(e.path));if(v&&Array.isArray(v.value))$=v.value.filter(e=>"string"==typeof e);else{const e=i.filter(e=>s(e)&&/(^|\.)(categorical|chart|palette|qualitative|series)\b/i.test(e.path));2>e.length||($=e.map(e=>e.value))}const h=(r.mapping?.fontFamily?g.get(r.mapping.fontFamily):void 0)??g.get("semiotic.font-family")??i.find(e=>("fontFamily"===e.type||/font-?family|typeface/i.test(e.leaf))&&("string"==typeof e.value||Array.isArray(e.value))),b=h?u(h.value):void 0,F=p(g.get("semiotic.legend-font-size")?.value),x=u(g.get("semiotic.legend-font-family")?.value),k=y(g.get("semiotic.legend-font-weight")?.value),z=p(g.get("semiotic.title-font-size")?.value),w=u(g.get("semiotic.title-font-family")?.value),S=y(g.get("semiotic.title-font-weight")?.value),j=u(g.get("semiotic.tick-font-family")?.value),W=p(g.get("semiotic.tick-font-size")?.value),N=p(g.get("semiotic.axis-label-font-size")?.value),A=function(e){if("string"!=typeof e)return null;const t=e.trim();let o=t.replace(/^#/,"");if(3===o.length&&(o=o.split("").map(e=>e+e).join("")),/^[0-9a-f]{6}$/i.test(o))return parseInt(o.slice(0,2),16)/255*.2126+parseInt(o.slice(2,4),16)/255*.7152+parseInt(o.slice(4,6),16)/255*.0722;const r=t.match(c);if(r){const e=Number(r[1])/255,t=Number(r[2])/255,o=Number(r[3])/255;return[e,t,o].some(e=>Number.isNaN(e)||0>e||e>1)?null:.2126*e+.7152*t+.0722*o}return null}(d.background),q=r.base?.mode??(null!=A?.5>A?"dark":"light":t.mode),O=r.base??("dark"===q?e:t);return{...O,mode:q,colors:{...O.colors,...d,...$&&$.length>0?{categorical:$}:{}},typography:{...O.typography,...b?{fontFamily:b}:{},...null!=F?{legendSize:F}:{},...null!=x?{legendFontFamily:x}:{},...null!=k?{legendFontWeight:k}:{},...null!=z?{titleFontSize:z}:{},...null!=w?{titleFontFamily:w}:{},...null!=S?{titleFontWeight:S}:{},...null!=j?{tickFontFamily:j}:{},...null!=W?{tickSize:W}:{},...null!=N?{labelSize:N}:{}}}}export{r as themeToCSS,i as themeToTokens,g as designTokensToTheme};
@@ -1 +0,0 @@
1
- import{networkFrameDefaultMargin as e,networkSymbolRenderer as t,resolveLabelFn as r,resolveNodeRefId as n}from"./c-RR3GO5SW.min.js";import{commonJsWorkerModuleUrl as o}from"./c-VGW3VG3I.min.js";import{needsDataCanvasPaint as i}from"./c-OCI56QF2.min.js";import{StalenessBadge as a,attachUpdateResultStore as s,buildNavGraph as c,composeOverlays as l,computeDecayOpacity as u,createCustomLayoutFailureDiagnostic as d,extractNetworkNavPoints as h,filterAnnotationsByStatus as y,findHitPointInQuadtree as f,formatVal as g,getHitRadius as p,hitTestRect as m,networkGlyphRenderer as v,nextNetworkIndex as x,normalizeAngle as k,paintCanvasBackground as b,paintSceneWithBackend as _,renderCirclePulse as S,renderRectPulse as w,renderSceneWithBackend as A,resolveFrameLayers as L,resolvePosition as E,shouldHandleFramePointer as P,useConfigSync as D,useLayoutSelectionSync as R,useStableShallow as M,useStalenessCheck as N,warnCustomLayoutDiagnostics as T}from"./c-GPYOFETM.min.js";import{CustomLayoutSelectionProvider as C,wrapWithCustomLayoutSelection as I}from"./c-G36WS6LN.min.js";import{buildResolveColor as W,resolveCustomLayoutPalette as $}from"./c-J5G56TUH.min.js";import{ANNOTATION_DISCLOSURE_REVEAL_CSS as z,AccessibleTablePortal as F,AriaLiveTooltip as B,CanvasFrameBackground as Y,DEFAULT_COLORS as O,FlippingTooltip as X,FocusRing as j,NetworkAccessibleDataTable as H,SVGChartTitle as G,SceneRevisionDiagnosticsObserver as q,ScreenReaderSummary as V,SkipToTableLink as Q,UpdateResultTracker as K,annotationActivationProps as Z,annotationLayout as U,buildHoverData as J,computeEasing as ee,computeNetworkAriaLabel as te,computeRawProgress as re,createDefaultAnnotationRules as ne,createSeededFrameRandom as oe,defaultTooltipStyle as ie,emitClickObservations as ae,emitHoverObservations as se,filterSparseArray as ce,getDevicePixelRatio as le,glyphHitGeometry as ue,isAnnotationActivationTarget as de,isInteractiveKeyboardTarget as he,isServerEnvironment as ye,lerp as fe,networkLabelToSVG as ge,networkSceneEdgeToSVG as pe,networkSceneNodeToSVG as me,now as ve,observationInputType as xe,paintNetworkFill as ke,paintNetworkStroke as be,prepareCanvas as _e,rehitCanvasMarkCursor as Se,renderAnnotationPass as we,renderLegendFromConfig as Ae,renderLoadingState as Le,resolveCSSColor as Ee,resolveCanvasFill as Pe,runSceneBuild as De,sceneHasAuthoredCursor as Re,sceneMarkCursor as Me,schemeCategory10 as Ne,setCanvasMarkCursor as Te,smartTooltipEntries as Ce,symbolRadius as Ie,useAnnotationActivationOptions as We,useCanvasMarkCursorCleanup as $e,useFrame as ze,useFrameCanvasHost as Fe,useHydration as Be,useSceneRevisionDiagnostics as Ye,useWasHydratingFromSSR as Oe}from"./c-GIKRQI4X.min.js";import{resolveThemeSemanticColors as Xe}from"./c-YDAY2WFR.min.js";import{getMinMax as je}from"./c-WJCD5EUY.min.js";import*as He from"react";import{useRef as Ge,useState as qe,useEffect as Ve,useMemo as Qe,useCallback as Ke,useImperativeHandle as Ze,forwardRef as Ue,memo as Je}from"react";var et={weightChange:.1,newEdge:.5,newNode:1,threshold:3,transitionDuration:500},tt={radius:3,opacity:.7,speedMultiplier:1,maxPerEdge:50,spawnRate:.1},rt=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 r=this._freeIndices.pop();if(void 0===r)return null;const n=this.particles[r];return n.active=!0,n.t=0,n.offset=t()-.5,n.edgeIndex=e,n.x=0,n.y=0,n}step(e,t,r,n){for(let o=0;this.capacity>o;o++){const i=this.particles[o];if(!i.active)continue;const a=r[i.edgeIndex];a&&a.bezier?(i.t+=e*t*(n?n[i.edgeIndex]??1:1)*(a.bezier.circular?.3:1),1>i.t?nt(a.bezier,i.t,i.offset,i):(i.active=!1,this._freeIndices.push(o))):(i.active=!1,this._freeIndices.push(o))}}countForEdge(e){let t=0;for(let r=0;this.capacity>r;r++)this.particles[r].active&&this.particles[r].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 r=0;e>r;r++)t.length>r?this.particles[r]=t[r]:(this.particles[r]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0},this._freeIndices.push(r));this.capacity=e}};function nt(e,t,r,n){if(e.circular&&e.segments)return void function(e,t,r,n,o){const i=e.length,a=t*i,s=Math.min(Math.floor(a),i-1),c=a-s,[l,u,d,h]=e[s];ot(l,u,d,h,c,o);const y=h.x-l.x,f=h.y-l.y,g=Math.sqrt(y*y+f*f);if(g>.001){const e=y/g;o.x+=-f/g*r*n*2,o.y+=e*r*n*2}}(e.segments,t,r,e.halfWidth,n);if(!e.points)return n.x=0,void(n.y=0);const[o,i,a,s]=e.points;ot(o,i,a,s,t,n);const c=s.x-o.x,l=s.y-o.y,u=Math.sqrt(c*c+l*l);if(u>.001){const t=c/u;n.x+=-l/u*r*e.halfWidth*2,n.y+=t*r*e.halfWidth*2}}function ot(e,t,r,n,o,i){const a=1-o,s=a*a,c=s*a,l=o*o,u=l*o;i.x=c*e.x+3*s*o*t.x+3*a*l*r.x+u*n.x,i.y=c*e.y+3*s*o*t.y+3*a*l*r.y+u*n.y}function it(e,t){var r=e.get(t);if(!r)throw Error("missing: "+t);return r}function at(e,t){var r,n=[],o=[],i=[],a={},s=[];function c(e){i[e]=!1,a.hasOwnProperty(e)&&Object.keys(a[e]).forEach(function(t){delete a[e][t],i[t]&&c(t)})}function l(e){var t,n,d=!1;for(o.push(e),i[e]=!0,t=0;s[e].length>t;t++)(n=s[e][t])===r?(u(r,o),d=!0):i[n]||(d=l(n));if(d)c(e);else for(t=0;s[e].length>t;t++){var h=a[n=s[e][t]];h||(a[n]=h={}),h[n]=!0}return o.pop(),d}function u(e,r){var o=[].concat(r).concat(e);t?t(o):n.push(o)}function d(t){!function(t){for(var r=0;e.length>r;r++)r>=t&&e[r]||(e[r]=[]),e[r]=e[r].filter(function(e){return e>=t})}(t);for(var r,n=function(e){for(var t=e.length,r=Array(t),n=Array(t),o=Array(t),i=Array(t),a=Array(t),s=Array(t),c=0;t>c;++c)r[c]=-1,n[c]=0,o[c]=!1,i[c]=0,a[c]=-1,s[c]=[];var l,u=0,d=[],h=[];function y(t){var c=[t],l=[t];for(r[t]=n[t]=u,o[t]=!0,u+=1;l.length>0;){var y=e[t=l[l.length-1]];if(y.length>i[t]){for(var f=i[t];y.length>f;++f){var g=y[f];if(0>r[g]){r[g]=n[g]=u,o[g]=!0,u+=1,c.push(g),l.push(g);break}o[g]&&(n[t]=0|Math.min(n[t],n[g])),0>a[g]||s[t].push(a[g])}i[t]=f}else{if(n[t]===r[t]){var p=[],m=[],v=0;for(f=c.length-1;f>=0;--f){var x=c[f];if(o[x]=!1,p.push(x),m.push(s[x]),v+=s[x].length,a[x]=d.length,x===t){c.length=f;break}}d.push(p);var k=Array(v);for(f=0;m.length>f;f++)for(var b=0;m[f].length>b;b++)k[--v]=m[f][b];h.push(k)}l.pop()}}}for(c=0;t>c;++c)0>r[c]&&y(c);for(c=0;h.length>c;c++){var f=h[c];if(0!==f.length){f.sort(function(e,t){return e-t}),l=[f[0]];for(var g=1;f.length>g;g++)f[g]!==f[g-1]&&l.push(f[g]);h[c]=l}}return{components:d,adjacencyList:h}}(e),o=n.components.filter(function(e){return e.length>1}),i=1/0,a=0;o.length>a;a++)for(var s=0;o[a].length>s;s++)i>o[a][s]&&(i=o[a][s],r=a);var c=o[r];return!!c&&{leastVertex:i,adjList:e.map(function(e,t){return-1===c.indexOf(t)?[]:e.filter(function(e){return-1!==c.indexOf(e)})})}}r=0;for(var h=e.length;h>r;){var y=d(r);if(r=y.leastVertex,s=y.adjList){for(var f=0;s.length>f;f++)for(var g=0;s[f].length>g;g++){var p=s[f][g];i[+p]=!1,a[p]={}}l(r),r+=1}else r=h}return t?void 0:n}function st(e){return e.y0-e.y1>0?"up":"down"}function ct(e,t){return t(e.source)==t(e.target)}function lt(e){var t=0;e.source.sourceLinks.forEach(function(e){t=e.circular?t+1:t});var r=0;return e.target.targetLinks.forEach(function(e){r=e.circular?r+1:r}),1>=t&&1>=r}function ut(e){return e.target.x0-e.source.x1}function dt(e,t){var r=yt(e),n=ut(t)/Math.tan(r);return"up"==st(e)?e.y1-n:e.y1+n}function ht(e,t){var r=yt(e),n=ut(t)/Math.tan(r);return"up"==st(e)?e.y1+n:e.y1-n}function yt(e){var t=Math.abs(e.y1-e.y0);return Math.atan(Math.abs(e.target.x0-e.source.x1)/t)}function ft(e,t){return t(e)}function gt(e){return mt(e.source)}function pt(e){return mt(e.target)}function mt(e){return(e.y0+e.y1)/2}function vt(e){return e.virtual?0:e.value}function xt(e,t){var r=0;e.sourceLinks.forEach(function(e){r=e.circular&&!ct(e,t)?r+1:r});var n=0;return e.targetLinks.forEach(function(e){n=e.circular&&!ct(e,t)?n+1:n}),r+n}function kt(e){return e.target.depth}function bt(e,t){return e.sourceLinks.length?e.depth:t-1}function _t(e,t){return e.y0-t.y0}function St(e,t){return t.y0-e.y0}function wt(e,t){return e.y1-t.y1}function At(e,t){return t.y1-e.y1}function Lt(e,t){return Pt(e.source,t.source)||e.index-t.index}function Et(e,t){return Pt(e.target,t.target)||e.index-t.index}function Pt(e,t){return e.partOfCycle===t.partOfCycle?e.y0-t.y0:"top"===e.circularLinkType||"bottom"===t.circularLinkType?-1:1}function Dt(e,t){return Rt(e)==Rt(t)?"bottom"==e.circularLinkType?St(e,t):_t(e,t):Rt(t)-Rt(e)}function Rt(e){return e.target.column-e.source.column}function Mt(e,t){return Nt(e)==Nt(t)}function Nt(e){return e.y0-e.y1>0?"up":"down"}import{min as Tt}from"d3-array";function Ct(e,t,r,n,o){let i=e;var a=Math.max(8,.15*(i.y1-i.y0));i.links.forEach(function(e){e.circular&&(e._circularWidth=Math.min(e.width,a))});var s=Tt(i.links,function(e){return e.source.y0});i.links.forEach(function(e){e.circular&&(e.circularPathData={})});var c=i.links.filter(function(e){return e.circular});return c.sort(function(e,t){return t.value-e.value}),c.forEach(function(e,t){e._circularStub=t>=4}),It(i.links.filter(function(e){return"top"==e.circularLinkType}),t,r),It(i.links.filter(function(e){return"bottom"==e.circularLinkType}),t,r),i.links.forEach(function(e){if(e.circular){if(e.circularPathData.arcRadius=e._circularWidth+n,e.circularPathData.rightNodeBuffer=5,e.circularPathData.leftNodeBuffer=5,e.circularPathData.sourceWidth=e.source.x1-e.source.x0,e.circularPathData.sourceX=e.source.x0+e.circularPathData.sourceWidth,e.circularPathData.targetX=e.target.x0,e.circularPathData.sourceY=e.y0,e.circularPathData.targetY=e.y1,ct(e,t)&&lt(e))e.circularPathData.rightSmallArcRadius=n+e._circularWidth/2,e.circularPathData.rightLargeArcRadius=n+e._circularWidth/2,e.circularPathData.leftSmallArcRadius=n+e._circularWidth/2,e.circularPathData.leftLargeArcRadius=n+e._circularWidth/2,"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=e.source.y1+o+e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius):(e.circularPathData.verticalFullExtent=e.source.y0-o-e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius);else{var a=e.source.column,c=e.circularLinkType,l=i.links.filter(function(e){return e.source.column==a&&e.circularLinkType==c});l.sort("bottom"==e.circularLinkType?St:_t);var u=0;l.forEach(function(t,o){t.circularLinkID==e.circularLinkID&&(e.circularPathData.rightSmallArcRadius=n+e._circularWidth/2+u,e.circularPathData.rightLargeArcRadius=n+e._circularWidth/2+o*r+u),u+=t._circularWidth||t.width}),a=e.target.column,(l=i.links.filter(function(e){return e.target.column==a&&e.circularLinkType==c})).sort("bottom"==e.circularLinkType?At:wt),u=0,l.forEach(function(t,o){t.circularLinkID==e.circularLinkID&&(e.circularPathData.leftSmallArcRadius=n+e._circularWidth/2+u,e.circularPathData.leftLargeArcRadius=n+e._circularWidth/2+o*r+u),u+=t._circularWidth||t.width}),"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=Math.max(i.y1,e.source.y1,e.target.y1)+o+e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius):(e.circularPathData.verticalFullExtent=s-o-e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius)}e.circularPathData.rightInnerExtent=e.circularPathData.sourceX+e.circularPathData.rightNodeBuffer,e.circularPathData.leftInnerExtent=e.circularPathData.targetX-e.circularPathData.leftNodeBuffer,e.circularPathData.rightFullExtent=e.circularPathData.sourceX+e.circularPathData.rightLargeArcRadius+e.circularPathData.rightNodeBuffer,e.circularPathData.leftFullExtent=e.circularPathData.targetX-e.circularPathData.leftLargeArcRadius-e.circularPathData.leftNodeBuffer}e.path=e.circular?function(e){return"top"==e.circularLinkType?"M"+e.circularPathData.sourceX+" "+e.circularPathData.sourceY+" L"+e.circularPathData.rightInnerExtent+" "+e.circularPathData.sourceY+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightSmallArcRadius+" 0 0 0 "+e.circularPathData.rightFullExtent+" "+(e.circularPathData.sourceY-e.circularPathData.rightSmallArcRadius)+" L"+e.circularPathData.rightFullExtent+" "+e.circularPathData.verticalRightInnerExtent+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightLargeArcRadius+" 0 0 0 "+e.circularPathData.rightInnerExtent+" "+e.circularPathData.verticalFullExtent+" L"+e.circularPathData.leftInnerExtent+" "+e.circularPathData.verticalFullExtent+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftLargeArcRadius+" 0 0 0 "+e.circularPathData.leftFullExtent+" "+e.circularPathData.verticalLeftInnerExtent+" L"+e.circularPathData.leftFullExtent+" "+(e.circularPathData.targetY-e.circularPathData.leftSmallArcRadius)+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftSmallArcRadius+" 0 0 0 "+e.circularPathData.leftInnerExtent+" "+e.circularPathData.targetY+" L"+e.circularPathData.targetX+" "+e.circularPathData.targetY:"M"+e.circularPathData.sourceX+" "+e.circularPathData.sourceY+" L"+e.circularPathData.rightInnerExtent+" "+e.circularPathData.sourceY+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightSmallArcRadius+" 0 0 1 "+e.circularPathData.rightFullExtent+" "+(e.circularPathData.sourceY+e.circularPathData.rightSmallArcRadius)+" L"+e.circularPathData.rightFullExtent+" "+e.circularPathData.verticalRightInnerExtent+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightLargeArcRadius+" 0 0 1 "+e.circularPathData.rightInnerExtent+" "+e.circularPathData.verticalFullExtent+" L"+e.circularPathData.leftInnerExtent+" "+e.circularPathData.verticalFullExtent+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftLargeArcRadius+" 0 0 1 "+e.circularPathData.leftFullExtent+" "+e.circularPathData.verticalLeftInnerExtent+" L"+e.circularPathData.leftFullExtent+" "+(e.circularPathData.targetY+e.circularPathData.leftSmallArcRadius)+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftSmallArcRadius+" 0 0 1 "+e.circularPathData.leftInnerExtent+" "+e.circularPathData.targetY+" L"+e.circularPathData.targetX+" "+e.circularPathData.targetY}(e):function(e){var t=e.source.x1,r=e.y0,n=e.target.x0,o=e.y1,i=(t+n)/2;return"M"+t+","+r+"C"+i+","+r+" "+i+","+o+" "+n+","+o}(e)}),i}function It(e,t,r){e.sort(Dt);var n=e.filter(function(e){return!e._circularStub});return e.forEach(function(e,o){var i=0;if(e._circularStub)e.circularPathData.verticalBuffer=0;else if(ct(e,t)&&lt(e))e.circularPathData.verticalBuffer=i+e._circularWidth/2;else{for(var a=0;n.length>a;a++){var s=n[a];if(s!==e&&s.circularPathData&&void 0!==s.circularPathData.verticalBuffer&&Wt(e,s)){var c=s.circularPathData.verticalBuffer+(s._circularWidth||s.width)/2+r;i=c>i?c:i}}e.circularPathData.verticalBuffer=i+e._circularWidth/2}}),e}function Wt(e,t){return e.source.column>=t.target.column&&t.source.column>=e.target.column}import{min as $t,max as zt,sum as Ft,mean as Bt,group as Yt,groups as Ot}from"d3-array";function Xt(e){return function(){return e}}function jt(e){return e.index}function Ht(e){return e.nodes}function Gt(e){return e.links}function qt(e,t,r){var n=Ot(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});n.forEach(function(o,i){var a=o.length;if(t)o.sort(t);else if(i>0){var s=new Map;o.forEach(function(e,t){var r,n,o,i=(n=0,o=0,(r=e).targetLinks.forEach(function(e){if(!e.circular){var t=e.value||1;o+=mt(e.source)*t,n+=t}}),r.sourceLinks.forEach(function(e){if(!e.circular){var t=e.value||1;o+=mt(e.target)*t,n+=t}}),n>0?o/n:NaN);s.set(e,{bc:i,idx:t})}),o.sort(function(e,t){var r=s.get(e),n=s.get(t),o=r.bc,i=n.bc;if(e.circularLinkType!==t.circularLinkType){if("top"==e.circularLinkType&&"bottom"==t.circularLinkType)return-1;if("bottom"==e.circularLinkType&&"top"==t.circularLinkType)return 1;if("top"==e.circularLinkType)return-1;if("top"==t.circularLinkType)return 1;if("bottom"==e.circularLinkType)return 1;if("bottom"==t.circularLinkType)return-1}return isNaN(o)||isNaN(i)?isNaN(o)?isNaN(i)?r.idx-n.idx:1:-1:o-i})}else o.sort(function(e,t){return e.circularLinkType==t.circularLinkType?xt(t,r)-xt(e,r):"top"==e.circularLinkType&&"bottom"==t.circularLinkType||"top"==e.circularLinkType&&0==t.partOfCycle||0==e.partOfCycle&&"bottom"==t.circularLinkType?-1:0});o.forEach(function(t,o){t.depth==n.length-1&&1==a||0==t.depth&&1==a?(t.y0=e.y1/2-t.value*e.ky,t.y1=t.y0+t.value*e.ky):t.partOfCycle?0==xt(t,r)?(t.y0=e.y1/2+o,t.y1=t.y0+t.value*e.ky):"top"==t.circularLinkType?(t.y0=e.y0+o,t.y1=t.y0+t.value*e.ky):(t.y0=e.y1-t.value*e.ky-o,t.y1=t.y0+t.value*e.ky):0==e.y0||0==e.y1?(t.y0=(e.y1-e.y0)/a*o,t.y1=t.y0+t.value*e.ky):(t.y0=(e.y1-e.y0)/2-a/2+o,t.y1=t.y0+t.value*e.ky)})})}function Vt(e,t,r,n,o,i){var a=Ot(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});u();for(var s=1,c=i;c>0;--c)l(s*=.99,r),u();function l(t,r){var n=a.length;a.forEach(function(o){var i=o.length,a=o[0].depth;o.forEach(function(o){var s;if(o.sourceLinks.length||o.targetLinks.length)if(o.partOfCycle&&xt(o,r)>0){var c=Bt(o.sourceLinks,pt),l=Bt(o.targetLinks,gt),u=c&&l?(c+l)/2:c||l;if(u){var d=(u-mt(o))*t*.3;o.y0+=d,o.y1+=d}}else if(0==a&&1==i)o.y0=e.y1/2-(s=o.y1-o.y0)/2,o.y1=e.y1/2+s/2;else if(a==n-1&&1==i)o.y0=e.y1/2-(s=o.y1-o.y0)/2,o.y1=e.y1/2+s/2;else if(1==o.targetLinks.length&&1==o.targetLinks[0].source.sourceLinks.length)s=o.y1-o.y0,o.y0=o.targetLinks[0].source.y0,o.y1=o.y0+s;else{var h=Bt(o.sourceLinks,pt),y=Bt(o.targetLinks,gt),f=((h&&y?(h+y)/2:h||y)-mt(o))*t;o.y0+=f,o.y1+=f}})})}function u(){a.forEach(function(r){var i,a,s,c=e.y0,l=r.length;for(r.sort(t||Pt),s=0;l>s;++s)(a=c-(i=r[s]).y0)>0&&(i.y0+=a,i.y1+=a),c=i.y1+n;if((a=c-n-e.y1)>0)for(c=i.y0-=a,i.y1-=a,s=l-2;s>=0;--s)(a=(i=r[s]).y1+o-c)>0&&(i.y0-=a,i.y1-=a),c=i.y0})}}function Qt(e){e.nodes.forEach(function(e){e.sourceLinks.sort(Et),e.targetLinks.sort(Lt)}),e.nodes.forEach(function(e){var t=e.y0,r=t,n=e.y1,o=n;e.sourceLinks.forEach(function(e){e.circular?(e.y0=n-e.width/2,n-=e.width):(e.y0=t+e.width/2,t+=e.width)}),e.targetLinks.forEach(function(e){e.circular?(e.y1=o-e.width/2,o-=e.width):(e.y1=r+e.width/2,r+=e.width)})})}function Kt(){var e=0,t=0,r=1,n=1,o=24,i=8,a=null,s=jt,c=bt,l=void 0,u=32,d=2,h=Ht,y=Gt;function f(){var f={nodes:h.apply(null,arguments),links:y.apply(null,arguments)};return function(h){h.x0=e,h.y0=t,h.x1=r,h.y1=n,h.py=0,function(e,t){e.nodes.forEach(function(e,t){e.index=t,e.sourceLinks=[],e.targetLinks=[]});var r=function(e,t){var r=new Map;return Yt(e,t).forEach(function(e,t){r.set(t,e[0])}),r}(e.nodes,t);e.links.forEach(function(e,t){e.index=t;var n=e.source,o=e.target;"object"!=typeof n&&(n=e.source=it(r,n)),"object"!=typeof o&&(o=e.target=it(r,o)),n.sourceLinks.push(e),o.targetLinks.push(e)})}(h,s),function(e,t){var r=0;if(null==t){for(var n=[],o=0;e.links.length>o;o++){var i=e.links[o],a=i.source.index,s=i.target.index;n[a]||(n[a]=[]),n[s]||(n[s]=[]),-1===n[a].indexOf(s)&&n[a].push(s)}var c=at(n);c.sort(function(e,t){return e.length-t.length});var l={};for(o=0;c.length>o;o++){var u=c[o].slice(-2);l[u[0]]||(l[u[0]]={}),l[u[0]][u[1]]=!0}e.links.forEach(function(e){var t=e.target.index,n=e.source.index;t===n||l[n]&&l[n][t]?(e.circular=!0,e.circularLinkID=r++):e.circular=!1})}else e.links.forEach(function(e){t(e.source)<t(e.target)?e.circular=!1:(e.circular=!0,e.circularLinkID=r++)})}(h,l),function(e,t){var r=0,n=0;e.links.forEach(function(o){o.circular&&(o.circularLinkType=o.source.circularLinkType||o.target.circularLinkType?o.source.circularLinkType?o.source.circularLinkType:o.target.circularLinkType:n>r?"top":"bottom","top"==o.circularLinkType?r++:n++,e.nodes.forEach(function(e){ft(e,t)!=ft(o.source,t)&&ft(e,t)!=ft(o.target,t)||(e.circularLinkType=o.circularLinkType)}))}),e.links.forEach(function(e){e.circular&&(e.source.circularLinkType==e.target.circularLinkType&&(e.circularLinkType=e.source.circularLinkType),ct(e,t)&&(e.circularLinkType=e.source.circularLinkType))})}(h,s),function(e){e.nodes.forEach(function(e){e.partOfCycle=!1,e.value=Math.max(Ft(e.sourceLinks,vt),Ft(e.targetLinks,vt)),e.sourceLinks.forEach(function(t){t.circular&&(e.partOfCycle=!0,e.circularLinkType=t.circularLinkType)}),e.targetLinks.forEach(function(t){t.circular&&(e.partOfCycle=!0,e.circularLinkType=t.circularLinkType)})})}(h),function(e,t,r){var n,o,i;if(null!=t){e.nodes.sort(function(e,r){return t(e)<t(r)?-1:1});var a=0,s=t(e.nodes[0]);e.nodes.forEach(function(e){a=t(e)==s?a:a+1,s=t(e)==s?s:t(e),e.column=a})}for(n=e.nodes,o=[],i=0;n.length;++i,n=o,o=[])n.forEach(function(e){e.depth=i,e.sourceLinks.forEach(function(e){0>o.indexOf(e.target)&&!e.circular&&o.push(e.target)})});for(n=e.nodes,o=[],i=0;n.length;++i,n=o,o=[])n.forEach(function(e){e.height=i,e.targetLinks.forEach(function(e){0>o.indexOf(e.source)&&!e.circular&&o.push(e.source)})});e.nodes.forEach(function(e){e.column=null==t?r(e,i):e.column})}(h,l,c);var y=i;if(null!==a){var f=Ot(h.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]}),g=zt(f,function(e){return e.length});g>1&&(y=Math.max(1,(n-t)*a/(g-1)))}(function(e,t,r){var n=Ot(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});e.py=t;var o=$t(n,function(t){return(e.y1-e.y0-(t.length-1)*e.py)/Ft(t,function(e){return e.value})});e.ky=o,e.links.forEach(function(t){t.width=t.value*e.ky});var i=zt(e.nodes,function(e){return e.column});e.nodes.forEach(i>0?function(t){t.x0=e.x0+t.column*((e.x1-e.x0-r)/i),t.x1=t.x0+r}:function(t){t.x0=e.x0,t.x1=t.x0+r})})(h,y,o),qt(h,l,s),Vt(h,l,s,y,y,u),Qt(h),Ct(h,s,d,10,8),qt(h,l,s),Vt(h,l,s,y,y,u),Qt(h),Ct(h,s,d,10,8),function(e,t){let r=e;r.nodes.forEach(function(e){e.y+(e.y1-e.y0)>r.y1&&(e.y=e.y-(e.y+(e.y1-e.y0)-r.y1));var n=r.links.filter(function(r){return ft(r.source,t)==ft(e,t)}),o=n.length;o>1&&n.sort(function(e,t){if(!e.circular&&!t.circular){if(e.target.column==t.target.column)return e.y1-t.y1;if(!Mt(e,t))return e.y1-t.y1;if(e.target.column>t.target.column){var r=dt(t,e);return e.y1-r}if(t.target.column>e.target.column)return dt(e,t)-t.y1}return e.circular&&!t.circular?"top"==e.circularLinkType?-1:1:t.circular&&!e.circular?"top"==t.circularLinkType?1:-1:e.circular&&t.circular?e.circularLinkType===t.circularLinkType&&"top"==e.circularLinkType?e.target.column===t.target.column?e.target.y1-t.target.y1:t.target.column-e.target.column:e.circularLinkType===t.circularLinkType&&"bottom"==e.circularLinkType?e.target.column===t.target.column?t.target.y1-e.target.y1:e.target.column-t.target.column:"top"==e.circularLinkType?-1:1:void 0});var i=e.y0;n.forEach(function(e){e.y0=i+e.width/2,i+=e.width}),n.forEach(function(t,r){if("bottom"==t.circularLinkType){for(var i=r+1,a=0;o>i;i++)a+=n[i].width;t.y0=e.y1-a-t.width/2}})})}(h,s),function(e,t){let r=e;r.nodes.forEach(function(e){var n=r.links.filter(function(r){return ft(r.target,t)==ft(e,t)}),o=n.length;o>1&&n.sort(function(e,t){if(!e.circular&&!t.circular){if(e.source.column==t.source.column)return e.y0-t.y0;if(!Mt(e,t))return e.y0-t.y0;if(e.source.column>t.source.column){var r=ht(t,e);return e.y0-r}if(t.source.column>e.source.column)return ht(e,t)-t.y0}return e.circular&&!t.circular?"top"==e.circularLinkType?-1:1:t.circular&&!e.circular?"top"==t.circularLinkType?1:-1:e.circular&&t.circular?e.circularLinkType===t.circularLinkType&&"top"==e.circularLinkType?e.source.column===t.source.column?e.source.y1-t.source.y1:e.source.column-t.source.column:e.circularLinkType===t.circularLinkType&&"bottom"==e.circularLinkType?e.source.column===t.source.column?e.source.y1-t.source.y1:t.source.column-e.source.column:"top"==e.circularLinkType?-1:1:void 0});var i=e.y0;n.forEach(function(e){e.y1=i+e.width/2,i+=e.width}),n.forEach(function(t,r){if("bottom"==t.circularLinkType){for(var i=r+1,a=0;o>i;i++)a+=n[i].width;t.y1=e.y1-a-t.width/2}})})}(h,s),function(e){var t=e.nodes,r=e.links,n=!1,o=!1;if(r.forEach(function(e){"top"==e.circularLinkType?n=!0:"bottom"==e.circularLinkType&&(o=!0)}),0==n||0==o){let n=function(t){return(t-i)/(a-i)*(e.y1-e.y0)+e.y0};var i=$t(t,function(e){return e.y0}),a=zt(t,function(e){return e.y1}),s=(e.y1-e.y0)/(a-i);1>s?(t.forEach(function(e){e.y0=n(e.y0),e.y1=n(e.y1)}),r.forEach(function(e){e.y0=n(e.y0),e.y1=n(e.y1),e.width=e.width*s})):t.forEach(function(e){var t=e.y1-e.y0,r=n(e.y0)-e.y0;e.y0=n(e.y0),e.y1=e.y0+t,e.sourceLinks.forEach(function(e){e.y0=e.y0+r}),e.targetLinks.forEach(function(e){e.y1=e.y1+r})})}}(h),Ct(h,s,d,10,8)}(f),f}return f.update=function(e){return Qt(e),Ct(e,s,d,10,8),e},f.nodeWidth=function(e){return arguments.length?(o=+e,f):o},f.nodePadding=function(e){return arguments.length?(i=+e,f):i},f.nodePaddingRatio=function(e){return arguments.length?(a=+e,f):a},f.nodes=function(e){return arguments.length?(h="function"==typeof e?e:Xt(e),f):h},f.links=function(e){return arguments.length?(y="function"==typeof e?e:Xt(e),f):y},f.nodeId=function(e){return arguments.length?(s="function"==typeof e?e:Xt(e),f):s},f.nodeAlign=function(e){return arguments.length?(c="function"==typeof e?e:Xt(e),f):c},f.nodeSort=function(e){return arguments.length?(l=e,f):l},f.iterations=function(e){return arguments.length?(u=+e,f):u},f.circularLinkGap=function(e){return arguments.length?(d=+e,f):d},f.extent=function(o){return arguments.length?(e=+o[0][0],t=+o[0][1],r=+o[1][0],n=+o[1][1],f):[[e,t],[r,n]]},f.size=function(o){return arguments.length?(e=t=0,r=+o[0],n=+o[1],f):[r-e,n-t]},f}import{interpolateNumber as Zt}from"d3-interpolate";import{line as Ut,curveLinearClosed as Jt}from"d3-shape";function er(e){const{sx:t,sTop:r,sBot:n,tx:o,tTop:i,tBot:a,cp1X:s,cp2X:c}=e,l=(r+n)/2,u=(i+a)/2;return{pathD:[`M${t},${r}`,`C${s},${r} ${c},${i} ${o},${i}`,`L${o},${a}`,`C${c},${a} ${s},${n} ${t},${n}`,"Z"].join(" "),bezier:{circular:!1,points:[{x:t,y:l},{x:s,y:l},{x:c,y:u},{x:o,y:u}],halfWidth:(n-r)/2}}}var tr=e=>{let t,r,n,o,i,a,s,c,l;if("down"===e.direction)return t=e.y0-e.sankeyWidth/2,r=e.y1-e.sankeyWidth/2,n=e.y1+e.sankeyWidth/2,o=e.y0+e.sankeyWidth/2,i=e.source.x1,a=e.target.x0,s=Zt(i,a),c=s(.5),l=s(.5),`M${t},${i}C${t},${c} ${r},${l} ${r},${a}L${n},${a}C${n},${l} ${o},${c} ${o},${i}Z`;const u=e.sankeyWidth/2,d=Zt(e.source.x1,e.target.x0),{pathD:h}=er({sx:e.source.x1,sTop:e.y0-u,sBot:e.y0+u,tx:e.target.x0,tTop:e.y1-u,tBot:e.y1+u,cp1X:d(.5),cp2X:d(.5)});return h};function rr(e){const t=e.sankeyWidth/2,r=(e._circularWidth??e.sankeyWidth)/2,n=e.circularPathData;if(!n)return null;if("down"===e.direction)return null;if(e._circularStub){const r=n.sourceX,o=n.sourceY,i=n.targetX,a=n.targetY;if("object"!=typeof e.source||!e.source||"object"!=typeof e.target||!e.target)return null;const s=Math.max(15,Math.min(40,.33*(n.rightFullExtent-r))),c=Math.max(15,Math.min(40,.33*(i-n.leftFullExtent)));return`M${r},${o-t}L${r+s},${o-t}L${r+s},${o+t}L${r},${o+t}ZM${i},${a-t}L${i-c},${a-t}L${i-c},${a+t}L${i},${a+t}Z`}const o=n.sourceX,i=n.sourceY,a=n.targetX,s=n.targetY,c=n.rightFullExtent,l=n.leftFullExtent,u=n.verticalFullExtent,d="bottom"===e.circularLinkType?1:-1,h=Math.max(4,Math.min(r,15));return`M${o},${i-d*t}L${c},${i-d*t}L${c+r},${i-d*t+d*h}L${c+r},${u+d*r-d*h}L${c+r-h},${u+d*r}L${l-r+h},${u+d*r}L${l-r},${u+d*r-d*h}L${l-r},${s-d*t+d*h}L${l-r+h},${s-d*t}L${a},${s-d*t}L${a},${s+d*t}L${l+r},${s+d*t}L${l+r},${u-d*r}L${c-r},${u-d*r}L${c-r},${i+d*t}L${o},${i+d*t}Z`}var nr=new Set,or=new WeakMap;function ir(e,t){if("production"===process.env.NODE_ENV)return e;if(!e||!e.data||"object"!=typeof e.data)return e;let r=or.get(e);if(r){const e=r.get(t);if(e)return e}else r=new Map,or.set(e,r);const n=new Proxy(e,{get(e,r,n){if("string"==typeof r&&!(r in e)&&e.data&&r in e.data){const e=`${t}:${r}`;nr.has(e)||(nr.add(e),console.warn(`[Semiotic] "${t}" callback accessed "${r}" on the wrapper object, but it only exists on ".data". Use d.data.${r} (or d.data?.${r}) instead. Frame callbacks receive RealtimeNode/RealtimeEdge wrappers, not your raw data.`))}return Reflect.get(e,r,n)}});return r.set(t,n),n}var ar={left:function(e){return e.depth},right:function(e,t){return t-1-e.height},center:function(e){return e.targetLinks.length?e.depth:e.sourceLinks.length?Math.min.apply(Math,e.sourceLinks.map(kt))-1:0},justify:bt},sr={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,r,o){if(0===e.length)return;const i="vertical"===r.orientation?"down":"right",a=r.nodeAlign||"justify",s=r.nodeWidth??15,c=r.nodePaddingRatio??.05,l=r.iterations??100,u=e.map(e=>({...e})),d=t.map(e=>({...e,source:n(e.source),target:n(e.target),value:Math.sqrt(Math.max(1,e.value||1))}));let h;h="down"===i?[[0,0],[o[1],o[0]]]:[[0,0],[o[0],o[1]]];const y=Kt().extent(h).links(d).nodes(u).nodeAlign(ar[a]||bt).nodeId(e=>e.id).nodeWidth(s).iterations(l);y.nodePaddingRatio&&y.nodePaddingRatio(c),y();{let e=1/0,t=-1/0,r=1/0,n=-1/0;for(const o of u)e>o.x0&&(e=o.x0),o.x1>t&&(t=o.x1),r>o.y0&&(r=o.y0),o.y1>n&&(n=o.y1);for(const o of d){if(!o.circular||!o.circularPathData)continue;const i=o.circularPathData,a=(o._circularWidth??o.width??0)/2;e>i.leftFullExtent-a&&(e=i.leftFullExtent-a),i.rightFullExtent+a>t&&(t=i.rightFullExtent+a),r>i.verticalFullExtent-a&&(r=i.verticalFullExtent-a),i.verticalFullExtent+a>n&&(n=i.verticalFullExtent+a)}const i=t-e,a=n-r,s=o[0],c=o[1];if(i>0&&a>0&&(0>e||0>r||t>s||n>c)){const t=Math.min(s/i,c/a),n=-e*t+(s-i*t)/2,o=-r*t+(c-a*t)/2;for(const e of u)e.x0=e.x0*t+n,e.x1=e.x1*t+n,e.y0=e.y0*t+o,e.y1=e.y1*t+o;for(const e of d)if(e.y0=e.y0*t+o,e.y1=e.y1*t+o,e.width=(e.width??0)*t,e._circularWidth&&(e._circularWidth*=t),e.circular&&e.circularPathData){const r=e.circularPathData;r.sourceX=r.sourceX*t+n,r.targetX=r.targetX*t+n,r.sourceY=r.sourceY*t+o,r.targetY=r.targetY*t+o,r.rightFullExtent=r.rightFullExtent*t+n,r.leftFullExtent=r.leftFullExtent*t+n,r.verticalFullExtent=r.verticalFullExtent*t+o,r.rightInnerExtent=r.rightInnerExtent*t+n,r.leftInnerExtent=r.leftInnerExtent*t+n,r.verticalRightInnerExtent=r.verticalRightInnerExtent*t+o,r.verticalLeftInnerExtent=r.verticalLeftInnerExtent*t+o,r.rightSmallArcRadius*=t,r.rightLargeArcRadius*=t,r.leftSmallArcRadius*=t,r.leftLargeArcRadius*=t,r.sourceWidth*=t,r.rightNodeBuffer*=t,r.leftNodeBuffer*=t,r.arcRadius*=t}}}const f=new Map;for(const t of e)f.set(t.id,t);for(const e of u){const t=f.get(e.id);t&&(t.x0=e.x0,t.x1=e.x1,t.y0=e.y0,t.y1=e.y1,t.value=e.value,t.depth=e.depth,t.sourceLinks=e.sourceLinks,t.targetLinks=e.targetLinks,t.width=e.x1-e.x0,t.height=e.y1-e.y0,t.x=e.x0+(e.x1-e.x0)/2,t.y=e.y0+(e.y1-e.y0)/2)}const g=new Map;for(const e of t)if(e._edgeKey)g.set(e._edgeKey,e);else{const t=n(e.source),r=n(e.target);g.set(`${t}\0${r}`,e)}for(const e of d){const t=n(e.source),r=n(e.target),o=g.get(e._edgeKey?e._edgeKey:`${t}\0${r}`);if(o){o.y0=e.y0,o.y1=e.y1,o.sankeyWidth=e.width??0,o.circular=!!e.circular,o.circularPathData=e.circularPathData,o._circularWidth=e._circularWidth,o._circularStub=e._circularStub,o.path=e.path,o.circularLinkType=e.circularLinkType,o.direction=i;const n=f.get(t),a=f.get(r);n&&(o.source=n),a&&(o.target=a)}}},buildScene(e,t,n,o){const i="vertical"===n.orientation?"down":"right",a=n.nodeStyle,s=n.edgeStyle,c=n.edgeOpacity??.5,l=n.edgeColorBy||"source",u=Array.isArray(n.colorScheme)?n.colorScheme:n.themeCategorical&&n.themeCategorical.length>0?n.themeCategorical:Ne,d=new Map;e.forEach((e,t)=>{d.set(e.id,u[t%u.length])});const h=[],y=[],f=[],g=new Map;for(const t of e){const e=t.x1-t.x0,r=t.y1-t.y0;if(0>=e||0>=r)continue;const n=a?a(ir(t,"nodeStyle")):{},o={fill:n.fill||d.get(t.id)||"#4d430c",stroke:n.stroke,strokeWidth:n.strokeWidth,opacity:n.opacity,cursor:n.cursor};g.set(t.id,("string"==typeof o.fill?o.fill:null)||d.get(t.id)||"#4d430c"),h.push("down"===i?{type:"rect",x:t.y0,y:t.x0,w:r,h:e,style:o,datum:t,id:t.id,label:t.id}:{type:"rect",x:t.x0,y:t.y0,w:e,h:r,style:o,datum:t,id:t.id,label:t.id})}const p=[...t].sort((e,t)=>(t.sankeyWidth||0)-(e.sankeyWidth||0));for(const e of p){if(!e.sankeyWidth||0>=e.sankeyWidth)continue;const t="object"==typeof e.source?e.source:null,r="object"==typeof e.target?e.target:null;if(!t||!r)continue;let o=n.themeSemantic?.border||n.themeSemantic?.secondary||"#999";o="function"==typeof l?l(e)||o:"target"===l?g.get(r.id)||d.get(r.id)||o:g.get(t.id)||d.get(t.id)||o;const i=s?s(ir(e,"edgeStyle")):{};if(e._circularStub&&e.circular&&e.circularPathData){const t=e.circularPathData,r=e.sankeyWidth/2,n=Math.max(15,Math.min(40,.33*(t.rightFullExtent-t.sourceX))),a=Math.max(15,Math.min(40,.33*(t.targetX-t.leftFullExtent))),s=i.fill||o;y.push({type:"bezier",pathD:`M${t.sourceX},${t.sourceY-r}L${t.sourceX+n},${t.sourceY-r}L${t.sourceX+n},${t.sourceY+r}L${t.sourceX},${t.sourceY+r}Z`,style:{fill:s,fillOpacity:i.fillOpacity??c,stroke:"none",opacity:i.opacity,cursor:i.cursor},datum:e,_gradient:{direction:"right",from:1,to:0,x0:t.sourceX,x1:t.sourceX+n}}),y.push({type:"bezier",pathD:`M${t.targetX},${t.targetY-r}L${t.targetX-a},${t.targetY-r}L${t.targetX-a},${t.targetY+r}L${t.targetX},${t.targetY+r}Z`,style:{fill:s,fillOpacity:i.fillOpacity??c,stroke:"none",opacity:i.opacity,cursor:i.cursor},datum:e,_gradient:{direction:"left",from:0,to:1,x0:t.targetX-a,x1:t.targetX}});continue}let a;(a=e.circular&&e.circularPathData?rr(e):tr(e),a)&&y.push({type:"bezier",pathD:a,bezierCache:e.bezier,style:{fill:i.fill||o,fillOpacity:i.fillOpacity??c,stroke:i.stroke||"none",strokeWidth:i.strokeWidth,opacity:i.opacity,cursor:i.cursor},datum:e})}if(!1!==n.showLabels){const t=r(n.nodeLabel);for(const r of e){const e=r.x1-r.x0,n=r.y1-r.y0;if(0>=e||0>=n)continue;const a=t?t(r):r.id;if(!a)continue;let s,c,l;"down"===i?(s=r.y0+(r.y1-r.y0)/2,c=r.x1+14,l="start"):(o[0]/2>r.x0+e/2?(s=r.x0-6,l="end"):(s=r.x1+6,l="start"),c=r.y0+n/2),f.push({x:s,y:c,text:a+"",anchor:"down"===i?"middle":l,baseline:"middle",fontSize:11})}}return{sceneNodes:h,sceneEdges:y,labels:f}}};import{forceSimulation as cr,forceCenter as lr,forceX as ur,forceY as dr,forceLink as hr,forceManyBody as yr,forceCollide as fr}from"d3-force";import{scaleLinear as gr}from"d3-scale";var pr={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,r,o){if(0===e.length)return;const i=r.forceStrength??.1,a=o[0]/2,s=o[1]/2,c=Math.max(.1,Math.min(1,Math.min(o[0],o[1])/200)),l=Math.min(.5,.06+1.8*(1-c)),u=r.__previousPositions;let d=0;const h=[];for(const t of e){const e=null!=t.x&&null!=t.y&&(0!==t.x||0!==t.y),r=u?.get(t.id);e?d++:r?(t.x=r.x,t.y=r.y,d++):h.push(t)}const y=d>0&&.3>=(e.length>0?h.length/e.length:1);if(y){const r=new Map;for(const t of e)r.set(t.id,t);for(const e of h){const n=mr(e.id,t,r);if(n.length>0){let t=0,r=0;for(const e of n)t+=e.x,r+=e.y;const o=vr(e.id),i=o%360*(Math.PI/180),a=(10+o%20)*c;e.x=t/n.length+a*Math.cos(i),e.y=r/n.length+a*Math.sin(i)}else{const t=vr(e.id),r=t%360*(Math.PI/180),n=(15+t%30)*c;e.x=a+n*Math.cos(r),e.y=s+n*Math.sin(r)}}}else{const t=2.399963229728653;for(let r=0;e.length>r;r++){const n=e[r];if(null==n.x||null==n.y||0===n.x&&0===n.y){const e=10*Math.sqrt(r+.5)*c,o=r*t;n.x=a+e*Math.cos(o),n.y=s+e*Math.sin(o)}}}const f=r.__skipForceSimulation||0===r.iterations?0:y?40:r.iterations??Math.max(50,Math.min(300,Math.floor(300-2*(e.length-30)))),g=xr(r.nodeSize,r.nodeSizeRange,e),p=e=>g(e);if(f>0){const u=new Map,d=new Map;for(const t of e)u.set(t.id,0),d.set(t.id,t);for(const e of t){const t=n(e.source),r=n(e.target);u.set(t,(u.get(t)??0)+1),u.set(r,(u.get(r)??0)+1)}const h=hr().strength(e=>{const t=e.weight,r=n(e.source),o=n(e.target),a=Math.max(1,Math.min(u.get(r)??1,u.get(o)??1));return Math.min(2.5,(t&&t>0?Math.sqrt(t):1)*i/(.1*a))}).distance(e=>{const t="string"==typeof e.source?d.get(e.source):e.source,r="string"==typeof e.target?d.get(e.target):e.target,n=(t?p(t):0)+(r?p(r):0)+Math.max(6,12*c);return Math.max(16,40*c,n)}).id(e=>e.id),g=cr();if(void 0===r.random&&void 0===r.seed||g.randomSource(r.random??oe(r.seed)),g.force("charge",yr().strength(e=>{const t=u.get(e.id)??0;return-15*c*p(e)*Math.sqrt(t+1)})).force("collide",fr(e=>p(e)+3*c).strength(.9).iterations(2)).force("center",lr(a,s).strength(.8)).force("x",ur(a).strength(l)).force("y",dr(s).strength(l)).force("bounds",function(e,t,r=2,n=.6){let o=[];const i=i=>{const a=n*Math.max(i,.2);for(const n of o){const o=n.x??e[0]/2,i=n.y??e[1]/2,s=n.vx??0,c=n.vy??0,l=t(n)+r,u=Math.min(e[0]/2,l),d=Math.max(e[0]/2,e[0]-l),h=Math.min(e[1]/2,l),y=Math.max(e[1]/2,e[1]-l),f=o+s,g=i+c;u>f?n.vx=s+(u-f)*a:f>d&&(n.vx=s+(d-f)*a),h>g?n.vy=c+(h-g)*a:g>y&&(n.vy=c+(y-g)*a)}};return i.initialize=e=>{o=e},i}(o,p)),g.nodes(e),t.length>0){const e=t.map(e=>({...e,source:n(e.source),target:n(e.target)}));h.links(e),g.force("link",h)}y?g.alpha(.3):.1>g.alpha()&&g.alpha(1),g.stop();for(let e=0;f>e;++e)g.tick()}for(const t of e){if(null==t.x||null==t.y)continue;const e=p(t),r=f>0?2:0,n=Math.min(o[0]/2,e+r),i=Math.min(o[1]/2,e+r);t.x=Math.max(n,Math.min(o[0]-n,t.x)),t.y=Math.max(i,Math.min(o[1]-i,t.y)),t.x0=0,t.x1=0,t.y0=0,t.y1=0}const m=new Map;for(const t of e)m.set(t.id,t);for(const e of t){if("string"==typeof e.source){const t=m.get(e.source);t&&(e.source=t)}if("string"==typeof e.target){const t=m.get(e.target);t&&(e.target=t)}}},buildScene(e,t,n,o){const i=n.nodeStyle,a=n.edgeStyle,s=xr(n.nodeSize,n.nodeSizeRange,e),c=Array.isArray(n.colorScheme)?n.colorScheme:n.themeCategorical&&n.themeCategorical.length>0?n.themeCategorical:Ne,l=new Map;e.forEach((e,t)=>{l.set(e.id,c[t%c.length])});const u=[],d=[],h=[];for(const t of e){if(null==t.x||null==t.y)continue;const e=s(ir(t,"nodeSize")),r=i?i(ir(t,"nodeStyle")):{},o={fill:r.fill||l.get(t.id)||n.themeSemantic?.primary||"#007bff",stroke:r.stroke||n.themeSemantic?.surface||"#fff",strokeWidth:r.strokeWidth??2,opacity:r.opacity,cursor:r.cursor};u.push({type:"circle",cx:t.x,cy:t.y,r:e,style:o,datum:t,id:t.id,label:t.id})}const y=new Map;for(const t of e)y.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:y.get(e.source),r="object"==typeof e.target?e.target:y.get(e.target);if(!t||!r)continue;if(null==t.x||null==t.y)continue;if(null==r.x||null==r.y)continue;const o=a?a(ir(e,"edgeStyle")):{};d.push({type:"line",x1:t.x,y1:t.y,x2:r.x,y2:r.y,style:{stroke:o.stroke||n.themeSemantic?.border||n.themeSemantic?.secondary||"#999",strokeWidth:o.strokeWidth??1,opacity:o.opacity??.6,cursor:o.cursor},datum:e})}if(!1!==n.showLabels){const t=r(n.nodeLabel);for(const r of e){if(null==r.x||null==r.y)continue;const e=t?t(r):r.id;if(!e)continue;const n=s(ir(r,"nodeSize"));h.push({x:r.x,y:r.y-n-4,text:e+"",anchor:"middle",baseline:"auto",fontSize:11})}}return{sceneNodes:u,sceneEdges:d,labels:h}}};function mr(e,t,r){const o=[];for(const i of t){const t=n(i.source),a=n(i.target);let s=null;if(t===e?s=a:a===e&&(s=t),s){const e=r.get(s);!e||0===e.x&&0===e.y||o.push({x:e.x,y:e.y})}}return o}function vr(e){let t=0;for(let r=0;e.length>r;r++)t=(t<<5)-t+e.charCodeAt(r)|0;return Math.abs(t)}function xr(e,t,r){if(r.some(e=>null!=e.__forceRadius))return e=>e.__forceRadius??8;if(null==e)return()=>8;if("number"==typeof e)return()=>e;if("function"==typeof e)return t=>e(t)||8;const n=t||[5,20],o=[];for(const t of r){const r=t.data?.[e];"number"==typeof r&&o.push(r)}if(0===o.length)return()=>n[0];const[i,a]=je(o);if(i===a)return()=>(n[0]+n[1])/2;const s=gr().domain([i,a]).range(n).clamp(!0);return t=>{const r=t.data?.[e];return null==r||"number"!=typeof r?n[0]:s(r)}}import{chord as kr,ribbon as br}from"d3-chord";import{arc as _r}from"d3-shape";var Sr=Ne,wr={supportsStreaming:!1,hierarchical:!1,computeLayout(e,t,r,o){if(0===e.length)return;const{padAngle:i=.01,groupWidth:a=20,sortGroups:s}=r,c=Math.min(o[0],o[1])/2,l=c-a,u=o[0]/2,d=o[1]/2,h=(y=r.valueAccessor)?"function"==typeof y?y:e=>e[y]??1:e=>e.value??1;var y;const f=new Map;for(let t=0;e.length>t;t++)f.set(e[t].id,t);const g=e.length,p=Array.from({length:g},()=>Array.from({length:g},()=>0));for(const e of t){const t=n(e.source),r=n(e.target),o=f.get(t),i=f.get(r);if(void 0===o||void 0===i)continue;const a=h(e);p[o][i]=a}const m=kr().padAngle(i);s&&m.sortGroups(s);const v=m(p),x=v.groups,k=_r().innerRadius(l).outerRadius(c);for(const t of x){const r=e[t.index],n=k.centroid({innerRadius:l,outerRadius:c,startAngle:t.startAngle,endAngle:t.endAngle});r.x=n[0]+u,r.y=n[1]+d,r.__arcData={startAngle:t.startAngle,endAngle:t.endAngle}}const b=new Map;for(const t of e)b.set(t.id,t);for(const e of t){const t=n(e.source),r=n(e.target),o=b.get(t),i=b.get(r);o&&(e.source=o),i&&(e.target=i)}const _=new Map;for(const e of t){const t=n(e.source),r=n(e.target);_.set(`${t}\0${r}`,e)}for(const t of v){const r=e[t.source.index].id,n=e[t.target.index].id,o=_.get(`${r}\0${n}`)||_.get(`${n}\0${r}`);o&&(o.__chordData=t)}},buildScene(e,t,n,o){const{groupWidth:i=20,edgeOpacity:a=.5}=n,s=Math.min(o[0],o[1])/2,c=s-i,l=o[0]/2,u=o[1]/2,d=n.nodeStyle,h=n.edgeStyle,y=n.edgeColorBy||"source",f=Array.isArray(n.colorScheme)?n.colorScheme:n.themeCategorical&&n.themeCategorical.length>0?n.themeCategorical:Sr,g=new Map;e.forEach((e,t)=>{g.set(e.id,f[t%f.length])});const p=br().radius(c),m=[],v=[],x=[];for(let t=0;e.length>t;t++){const r=e[t],n=r.__arcData;if(!n)continue;let o;if(d){const e=d(ir(r,"nodeStyle"));o=("string"==typeof e.fill?e.fill:void 0)||g.get(r.id)||f[t%f.length]}else o=g.get(r.id)||f[t%f.length];const i=d?d(ir(r,"nodeStyle")):{};m.push({type:"arc",cx:l,cy:u,innerR:c,outerR:s,startAngle:n.startAngle-Math.PI/2,endAngle:n.endAngle-Math.PI/2,style:{fill:o,stroke:i.stroke||"black",strokeWidth:i.strokeWidth??1,opacity:i.opacity,cursor:i.cursor},datum:r,id:r.id,label:r.id})}for(const e of t){const t=e.__chordData;if(!t)continue;const r=p(t);if(!r)continue;const o=Ar(r,l,u);let i=n.themeSemantic?.border||n.themeSemantic?.secondary||"#999";if(h){const t=h(ir(e,"edgeStyle"));i=("string"==typeof t.fill?t.fill:void 0)||i}else{const t="object"==typeof e.source?e.source:null,r="object"==typeof e.target?e.target:null;"target"===y&&r?i=g.get(r.id)||i:t&&(i=g.get(t.id)||i)}const s=h?h(ir(e,"edgeStyle")):{};v.push({type:"ribbon",pathD:o,style:{fill:i,fillOpacity:s.fillOpacity??a,stroke:s.stroke||"none",strokeWidth:s.strokeWidth,opacity:s.opacity,cursor:s.cursor},datum:e})}if(!1!==n.showLabels){const t=r(n.nodeLabel),o=s+12;for(const r of e){const e=r.__arcData;if(!e)continue;const n=t?t(r):r.id;if(!n)continue;const i=(e.startAngle+e.endAngle)/2,a=i-Math.PI/2;x.push({x:l+Math.cos(a)*o,y:u+Math.sin(a)*o,text:n+"",anchor:i>Math.PI?"end":"start",baseline:"middle",fontSize:11})}}return{sceneNodes:m,sceneEdges:v,labels:x}}};function Ar(e,t,r){const n=e.match(/[a-zA-Z]|[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?/g);if(!n)return e;const o=[];let i=0;for(;n.length>i;){const e=n[i];if("M"===e||"L"===e)for(o.push(e),i++;n.length>i&&!isNaN(Number(n[i]));)o.push(Number(n[i])+t+""),i++,n.length>i&&!isNaN(Number(n[i]))&&(o.push(Number(n[i])+r+""),i++);else if("C"===e)for(o.push(e),i++;n.length>i&&!isNaN(Number(n[i]));)for(let e=0;3>e&&n.length>i&&!isNaN(Number(n[i]));e++)o.push(Number(n[i])+t+""),i++,n.length>i&&!isNaN(Number(n[i]))&&(o.push(Number(n[i])+r+""),i++);else if("Q"===e)for(o.push(e),i++;n.length>i&&!isNaN(Number(n[i]));)for(let e=0;2>e&&n.length>i&&!isNaN(Number(n[i]));e++)o.push(Number(n[i])+t+""),i++,n.length>i&&!isNaN(Number(n[i]))&&(o.push(Number(n[i])+r+""),i++);else if("A"===e)for(o.push(e),i++;n.length>i&&!isNaN(Number(n[i]));)o.push(n[i++]),n.length>i&&o.push(n[i++]),n.length>i&&o.push(n[i++]),n.length>i&&o.push(n[i++]),n.length>i&&o.push(n[i++]),n.length>i&&(o.push(Number(n[i])+t+""),i++),n.length>i&&(o.push(Number(n[i])+r+""),i++);else"Z"===e||"z"===e?(o.push(e),i++):(o.push(n[i]),i++)}return o.join(" ")}import{hierarchy as Lr,tree as Er,cluster as Pr,treemap as Dr,pack as Rr,partition as Mr,treemapBinary as Nr}from"d3-hierarchy";var Tr=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];function Cr(e){const[t,r,n]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(e);return.299*t+.587*r+.114*n>150?"#222":"#fff"}function Ir(e,t,r){const n=t.nodeIDAccessor;return"function"==typeof n?n(e.data)+"":"string"==typeof n&&void 0!==e.data[n]?e.data[n]+"":void 0!==e.data.name?e.data.name+"":void 0!==e.data.id?e.data.id+"":"node-"+r}function Wr(e){if(!e)return null;if("function"==typeof e){const t=e;return e=>t(e.data??e)}return t=>t.data?.[e]||t[e]||t.id}function $r(e){return Array.isArray(e.colorScheme)?e.colorScheme:e.themeCategorical&&e.themeCategorical.length>0?e.themeCategorical:Tr}function zr(e){return Array.isArray(e.colorScheme)&&e.colorScheme.length>0?e.colorScheme[0]:e.themeSemantic?.primary?e.themeSemantic.primary:e.themeCategorical&&e.themeCategorical.length>0?e.themeCategorical[0]:"#4d430c"}function Fr(e,t,r,n,o){if("horizontal"===o){const o=(e+r)/2;return`M ${e},${t} C ${o},${t} ${o},${n} ${r},${n}`}if("radial"===o){const o=(e+r)/2;return`M ${e},${t} Q ${o},${t} ${o},${(t+n)/2} T ${r},${n}`}{const o=(t+n)/2;return`M ${e},${t} C ${e},${o} ${r},${o} ${r},${n}`}}var Br={supportsStreaming:!1,hierarchical:!0,computeLayout(e,t,r,n){const o=r.__hierarchyRoot;if(!o)return;const i=r.chartType,a=function(e){if(e)return"function"==typeof e?e:t=>t[e]}(r.childrenAccessor),s=r.hierarchySum,c="function"==typeof s?s:"string"==typeof s?e=>Number(e[s])||0:e=>Number(e.value)||0,l=Lr(o,a);l.sum(c),l.sort((e,t)=>(t.value??0)-(e.value??0));const[u,d]=n;switch(i){case"tree":!function(e,t,r,n){const o=t.treeOrientation||"vertical",i=Er();i.size("horizontal"===o?[n,r]:"radial"===o?[2*Math.PI,Math.min(r,n)/2*.8]:[r,n]),i(e)}(l,r,u,d);break;case"cluster":!function(e,t,r,n){const o=t.treeOrientation||"vertical",i=Pr();i.size("horizontal"===o?[n,r]:"radial"===o?[2*Math.PI,Math.min(r,n)/2*.8]:[r,n]),i(e)}(l,r,u,d);break;case"treemap":!function(e,t,r,n){const o=t.padding??4,i=t.paddingTop??0,a=Dr().size([r,n]).tile(Nr).padding(o);i>0&&a.paddingTop(i),a(e)}(l,r,u,d);break;case"circlepack":!function(e,t,r,n){const o=t.padding??4;Rr().size([r,n]).padding(o)(e)}(l,r,u,d);break;case"partition":!function(e,t,r,n){Mr().size([r,n]).padding(t.padding??1)(e)}(l,r,u,d)}const h=l.descendants();e.length=0,t.length=0;const y=new Map;for(let t=0;h.length>t;t++){const n=h[t],o={id:Ir(n,r,t),x:0,y:0,x0:0,x1:0,y0:0,y1:0,width:0,height:0,value:n.value??0,depth:n.depth,data:n.data,createdByFrame:!0};"tree"===i||"cluster"===i?Yr(o,n,r):"treemap"===i||"partition"===i?Or(o,n):"circlepack"===i&&Xr(o,n),o.__hierarchyNode=n,e.push(o),y.set(n,o)}if("tree"===i||"cluster"===i)for(const e of h)if(e.parent){const r=y.get(e.parent),n=y.get(e);r&&n&&t.push({source:r,target:n,value:1,y0:0,y1:0,sankeyWidth:0,data:{depth:e.depth}})}},buildScene(e,t,r,n){const o=r.nodeStyle||(()=>({})),i=r.edgeStyle||(()=>({}));switch(r.chartType){case"tree":case"cluster":return function(e,t,r,n,o,i){const a=[],s=[],c=[],l=r.treeOrientation||"vertical",u="radial"===l,d=n[0]/2,h=n[1]/2,y="number"==typeof(f=r.nodeSize)?f:5;var f;for(const t of e){let e=t.x,n=t.y;u&&(e+=d,n+=h);const i=o(ir(t,"nodeStyle"));let s=i.fill||zr(r);if(r.colorByDepth&&void 0!==t.depth){const e=$r(r);s=e[t.depth%e.length]}a.push({type:"circle",cx:e,cy:n,r:y,style:{fill:s,stroke:i.stroke||r.themeSemantic?.surface||"#fff",strokeWidth:i.strokeWidth??1,opacity:i.opacity,cursor:i.cursor},datum:t,id:t.id,label:t.id,depth:t.depth})}const g=r.edgeOpacity??.5;for(const e of t){const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;if(!t||!n)continue;let o=t.x,a=t.y,c=n.x,y=n.y;u&&(o+=d,a+=h,c+=d,y+=h);const f=Fr(o,a,c,y,l),p=i(ir(e,"edgeStyle"));s.push({type:"curved",pathD:f,style:{fill:"none",stroke:p.stroke||r.themeSemantic?.border||r.themeSemantic?.secondary||"#999",strokeWidth:p.strokeWidth??1.5,opacity:p.opacity??g,cursor:p.cursor},datum:e})}if(!1!==r.showLabels){const t=Wr(r.nodeLabel);for(const r of e){const e=t?t(r):r.id;if(!e)continue;let n,o,i,a=r.x,s=r.y;if(u&&(a+=d,s+=h),u){const e=a-d,t=s-h,r=Math.sqrt(e*e+t*t);r>0?(n=a+e/r*10,o=s+t/r*10,i=0>e?"end":"start"):(n=a,o=s-12,i="middle")}else"horizontal"===l?(r.data?.children&&0!==r.data.children.length?(n=a-y-6,i="end"):(n=a+y+6,i="start"),o=s):(n=a,o=s+y+14,i="middle");c.push({x:n,y:o,text:e+"",anchor:i,baseline:"middle",fontSize:11})}}return{sceneNodes:a,sceneEdges:s,labels:c}}(e,t,r,n,o,i);case"treemap":case"partition":return function(e,t,r,n){const o=[],i=[];for(const r of e){const e=r.x1-r.x0,i=r.y1-r.y0;if(0>=e||0>=i)continue;const a=n(ir(r,"nodeStyle"));let s=a.fill||zr(t);if(t.colorByDepth&&void 0!==r.depth){const e=$r(t);s=e[r.depth%e.length]}o.push({type:"rect",x:r.x0,y:r.y0,w:e,h:i,style:{fill:s,stroke:a.stroke||t.themeSemantic?.surface||"#fff",strokeWidth:a.strokeWidth??1,opacity:a.opacity,fillOpacity:a.fillOpacity,strokeOpacity:a.strokeOpacity,cursor:a.cursor},datum:r,id:r.id,label:r.id,depth:r.depth})}if(!1!==t.showLabels){const r=Wr(t.nodeLabel),o=t.labelMode||"leaf",a="partition"===t.chartType;for(const s of e){const e=s.x1-s.x0,c=s.y1-s.y0;if(0>=e||0>=c)continue;const l=!(s.data?.children&&s.data.children.length>0);if(!a){if("leaf"===o&&!l)continue;if("parent"===o&&l)continue}const u=r?r(s):s.id;if(!u)continue;if((l?30:40)>e||(l?16:14)>c)continue;let d=n(ir(s,"nodeStyle")).fill||zr(t);if(t.colorByDepth&&void 0!==s.depth){const e=$r(t);d=e[s.depth%e.length]}const h="string"==typeof d?Cr(d):t.themeSemantic?.text??"#000";i.push(l?{x:s.x0+e/2,y:s.y0+c/2,text:u+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,Math.min(e,c)/6)),fill:h}:{x:s.x0+4,y:s.y0+12,text:u+"",anchor:"start",baseline:"auto",fontSize:11,fontWeight:600,fill:h})}}return{sceneNodes:o,sceneEdges:[],labels:i}}(e,r,0,o);case"circlepack":return function(e,t,r,n){const o=[],i=[];for(const r of e){const e=r.__radius??5;if(0>=e)continue;const i=n(ir(r,"nodeStyle"));let a=i.fill||zr(t);if(t.colorByDepth&&void 0!==r.depth){const e=$r(t);a=e[r.depth%e.length]}o.push({type:"circle",cx:r.x,cy:r.y,r:e,style:{fill:a,stroke:i.stroke||t.themeSemantic?.surface||"#fff",strokeWidth:i.strokeWidth??1,opacity:i.opacity??.7,cursor:i.cursor},datum:r,id:r.id,label:r.id,depth:r.depth})}if(!1!==t.showLabels){const r=Wr(t.nodeLabel);for(const o of e){const e=o.__radius??5,a=r?r(o):o.id;if(!a)continue;if(15>e)continue;const s=!(o.data?.children&&o.data.children.length>0);let c=n(ir(o,"nodeStyle")).fill||zr(t);if(t.colorByDepth&&void 0!==o.depth){const e=$r(t);c=e[o.depth%e.length]}if(s){const r="string"==typeof c?Cr(c):t.themeSemantic?.text??"#000";i.push({x:o.x,y:o.y,text:a+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,e/3)),fill:r})}else i.push({x:o.x,y:o.y-e+14,text:a+"",anchor:"middle",baseline:"hanging",fontSize:Math.min(11,Math.max(8,e/3)),fill:t.themeSemantic?.text||"#000",stroke:t.themeSemantic?.surface||"#fff",strokeWidth:3,paintOrder:"stroke"})}}return{sceneNodes:o,sceneEdges:[],labels:i}}(e,r,0,o);default:return{sceneNodes:[],sceneEdges:[],labels:[]}}}};function Yr(e,t,r){const n=r.treeOrientation||"vertical";if("radial"===n){const r=t.x,n=t.y;e.x=n*Math.cos(r-Math.PI/2),e.y=n*Math.sin(r-Math.PI/2)}else"horizontal"===n?(e.x=t.y,e.y=t.x):(e.x=t.x,e.y=t.y);e.x0=e.x-5,e.x1=e.x+5,e.y0=e.y-5,e.y1=e.y+5,e.width=10,e.height=10}function Or(e,t){e.x0=t.x0,e.x1=t.x1,e.y0=t.y0,e.y1=t.y1,e.x=(t.x0+t.x1)/2,e.y=(t.y0+t.y1)/2,e.width=t.x1-t.x0,e.height=t.y1-t.y0}function Xr(e,t){const r=t.r??0;e.x=t.x,e.y=t.y,e.x0=t.x-r,e.x1=t.x+r,e.y0=t.y-r,e.y1=t.y+r,e.width=2*r,e.height=2*r,e.__radius=r}import{pie as jr}from"d3-shape";function Hr(e){let t=e.__orbitState;return t||(t={metaMap:new Map,startTime:"undefined"!=typeof performance?performance.now():Date.now()},e.__orbitState=t),t}var Gr={sankey:sr,force:pr,chord:wr,tree:Br,cluster:Br,treemap:Br,circlepack:Br,partition:Br,orbit:{supportsStreaming:!1,hierarchical:!0,supportsAnimation:!0,computeLayout(e,t,r,n){const o=r.__hierarchyRoot;o&&function(e,t,r,n,o){const i=function(e){if("function"==typeof e)return e;const t=e||"children";return e=>e[t]||null}(r.childrenAccessor),a=function(e){if("function"==typeof e)return e;const t=e||"name";return e=>(e[t]??"")+""}(r.nodeIDAccessor),s=function(e){if(Array.isArray(e))return e;switch(e){case"solar":return[1];case"atomic":return[2,8];default:return[9999]}}(r.orbitMode),c=r.orbitSize??2.95,l=r.orbitEccentricity??1,u="number"==typeof c?()=>c:c,d="number"==typeof l?()=>l:l,h=Hr(r);h.metaMap.clear(),n.length=0,o.length=0;const y=new Map;function f(e){const t=y.get(e)??0;return y.set(e,t+1),0===t?e:`${e}__${t}`}const g=t[0]/2,p=t[1]/2,m=Math.min(t[0],t[1])/2*.85,v=f(a(e));n.push({id:v,x:g,y:p,x0:g,x1:g,y0:p,y1:p,width:0,height:0,value:0,depth:0,data:e}),h.metaMap.set(v,{ring:m,angle:0,depth:0,parentId:null,eccentricity:1}),function e(t,r,c,l,y,g,p){const m=i(t);if(!m?.length)return;const v=m.length;let x=0,k=0,b=0;for(;v>k;)k+=s[Math.min(b,s.length-1)],b++,x++;let _=0;for(let v=0;x>v;v++){const k=s[Math.min(v,s.length-1)],b=m.slice(_,_+k);if(!b.length)break;const S=(v+1)/x,w={id:r,depth:g,data:t,parentId:r},A=p?y/u(w)*S:y*S,L=jr().value(e=>{const t=i(e)?.length;return t?4:1}).sort(null)(b),E=d(w);for(let t=0;b.length>t;t++){const i=(L[t].startAngle+L[t].endAngle)/2,s=b[t],u=f(a(s)),d=c+A*Math.sin(i),y=l+A*Math.cos(i)*E;n.push({id:u,x:d,y:y,x0:d,x1:d,y0:y,y1:y,width:0,height:0,value:0,depth:g,data:s}),h.metaMap.set(u,{ring:A,angle:i,depth:g,parentId:r,eccentricity:E}),o.push({source:r,target:u,value:1,y0:0,y1:0,sankeyWidth:0,data:{source:r,target:u}}),e(s,u,d,y,A,g+1,!0)}_+=k}}(e,v,g,p,m,1,!1)}(o,n,r,e,t)},buildScene(e,t,r,n){const o=r.nodeStyle,i=r.edgeStyle,a=r.nodeSize,s="number"==typeof a?()=>a:"function"==typeof a?a:()=>6,c=[],l=[],u=[];if(!1!==r.orbitShowRings){const t=Hr(r),n=new Map;for(const t of e)n.set(t.id,t);const o=new Map;for(const[,e]of t.metaMap){if(!e.parentId)continue;const t=n.get(e.parentId);if(!t)continue;const r=`${e.parentId}:${e.ring}`;o.has(r)||o.set(r,{parentX:t.x,parentY:t.y,ring:e.ring,ecc:e.eccentricity})}const i=48,a={stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1};for(const[,{parentX:e,parentY:t,ring:r,ecc:n}]of o)for(let o=0;i>o;o++){const s=o/i*Math.PI*2,c=(o+1)/i*Math.PI*2;l.push({type:"line",x1:e+r*Math.sin(s),y1:t+r*Math.cos(s)*n,x2:e+r*Math.sin(c),y2:t+r*Math.cos(c)*n,style:a,datum:null})}}for(const t of e){if(null==t.x||null==t.y)continue;const e=s(ir(t,"nodeSize")),n=o?o(ir(t,"nodeStyle")):{};c.push({type:"circle",cx:t.x,cy:t.y,r:e,style:{fill:n.fill||r.themeSemantic?.primary||"#6366f1",stroke:n.stroke||r.themeSemantic?.surface||"#fff",strokeWidth:n.strokeWidth??1,opacity:n.opacity??(0===(t.depth??0)?1:.85),cursor:n.cursor},datum:t,id:t.id,label:t.id,depth:t.depth})}const d=new Map;for(const t of e)d.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:d.get(e.source),r="object"==typeof e.target?e.target:d.get(e.target);if(!t||!r)continue;if(null==t.x||null==r.x)continue;const n=i?i(ir(e,"edgeStyle")):{};l.push({type:"line",x1:t.x,y1:t.y,x2:r.x,y2:r.y,style:{stroke:n.stroke||"rgba(128,128,128,0.35)",strokeWidth:n.strokeWidth??.5,opacity:n.opacity??1,cursor:n.cursor},datum:e})}if(r.showLabels){const t=r.nodeLabel;for(const r of e){const e=s(ir(r,"nodeSize"));if(4>=e)continue;const n="function"==typeof t?t(r):t?r.data?.[t]??r.id:r.id;u.push({x:r.x,y:r.y+e+12,text:n+"",anchor:"middle",fontSize:10,fill:"currentColor"})}}return{sceneNodes:c,sceneEdges:l,labels:u}},tick:(e,t,r,n,o)=>!1!==r.orbitAnimated&&(function(e,t){const r=Hr(t),n=t.orbitSpeed??.25,o=t.orbitRevolution??function(e){switch(e){case"decay":return e=>Math.pow(.6,e.depth??0);case"alternate":return e=>{const t=e.depth??0;return(t%2==0?1:-1)/(t+1)};default:return e=>1/((e.depth??0)+1)}}(t.orbitRevolutionStyle),i=(("undefined"!=typeof performance?performance.now():Date.now())-r.startTime)/1e3,a=n*(Math.PI/6),s=new Map;for(const t of e)s.set(t.id,t);for(const t of e){const e=r.metaMap.get(t.id);if(!e||!e.parentId)continue;const n=s.get(e.parentId);if(!n)continue;const c=e.angle+i*a*o({id:t.id,depth:e.depth,data:t.data,parentId:e.parentId});t.x=n.x+e.ring*Math.sin(c),t.y=n.y+e.ring*Math.cos(c)*e.eccentricity,t.x0=t.x,t.x1=t.x,t.y0=t.y,t.y1=t.y}}(e,r),!0)}};function qr(e){return Gr[e]}import{quadtree as Vr}from"d3-quadtree";function Qr(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 Kr(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(!Zr(e))return!1;return!0}return Zr(t.points)}function Zr(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 Ur}from"d3-interpolate";var Jr="rgba(34, 197, 94, 0.7)",en=2e3,tn=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],rn=["scene-style","data-paint","accessibility","evidence"],nn=(e,t)=>({retainedData:e,invalidations:t}),on=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],an=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],sn=["scene-geometry","data-paint","overlay","accessibility","evidence"],cn=["scene-style","data-paint","accessibility","evidence"],ln=["scene-geometry","data-paint","overlay","accessibility","evidence"],un=[],dn={chartType:nn("rebuild",on),nodeIDAccessor:nn("rebuild",on),sourceAccessor:nn("rebuild",on),targetAccessor:nn("rebuild",on),valueAccessor:nn("rebuild",on),edgeIdAccessor:nn("rebuild",on),childrenAccessor:nn("rebuild",on),hierarchySum:nn("rebuild",on),orientation:nn("preserve",an),nodeAlign:nn("preserve",an),nodePaddingRatio:nn("preserve",an),nodeWidth:nn("preserve",an),edgeSort:nn("preserve",an),iterations:nn("preserve",an),forceStrength:nn("preserve",an),padAngle:nn("preserve",an),groupWidth:nn("preserve",an),sortGroups:nn("preserve",an),treeOrientation:nn("preserve",an),edgeType:nn("preserve",an),padding:nn("preserve",an),paddingTop:nn("preserve",an),orbitMode:nn("preserve",an),orbitSize:nn("preserve",an),orbitSpeed:nn("preserve",an),orbitRevolution:nn("preserve",an),orbitRevolutionStyle:nn("preserve",an),orbitEccentricity:nn("preserve",an),orbitShowRings:nn("preserve",an),orbitAnimated:nn("preserve",an),customNetworkLayout:nn("preserve",an),layoutConfig:nn("preserve",an),nodeSize:nn("preserve",sn),nodeSizeRange:nn("preserve",sn),colorByDepth:nn("preserve",sn),nodeLabel:nn("preserve",ln),showLabels:nn("preserve",ln),labelMode:nn("preserve",ln),nodeStyle:nn("preserve",cn),edgeStyle:nn("preserve",cn),colorBy:nn("preserve",cn),colorScheme:nn("preserve",cn),themeCategorical:nn("preserve",cn),themeSemantic:nn("preserve",cn),edgeColorBy:nn("preserve",cn),edgeOpacity:nn("preserve",cn),showParticles:nn("preserve",cn),particleStyle:nn("preserve",cn),decay:nn("preserve",cn),pulse:nn("preserve",cn),thresholds:nn("preserve",cn),staleness:nn("preserve",cn),layoutSelection:nn("preserve",cn),clock:nn("preserve",un),random:nn("preserve",un),seed:nn("preserve",un),tensionConfig:nn("preserve",un),transition:nn("preserve",un),introAnimation:nn("preserve",un),onLayoutError:nn("preserve",un),__skipForceSimulation:nn("preserve",un),__hierarchyRoot:nn("preserve",un),__orbitState:nn("preserve",un),__previousPositions:nn("preserve",un)},hn=nn("preserve",an),yn=class{constructor(){this.tracker=new K}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}},tn)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},rn):this.recordNoop("restyle")}recordConfig(e){const t=function(e){let t="preserve";const r=new Set;for(const n of e){const e=dn[n]??hn;"rebuild"===e.retainedData&&(t="rebuild");for(const t of e.invalidations)r.add(t)}return{retainedData:t,invalidations:r}}(e);return this.tracker.record({kind:"config",keys:e},t.invalidations)}},fn=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 yn,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={...et,...e.tensionConfig},e.showParticles&&("sankey"===e.chartType||e.customNetworkLayout)&&(this.particlePool=new rt(2e3))}currentTime(){return this.config.clock?.()??ve()}updateConfig(e){const t=this.config,r={...t,...e};t.__orbitState&&(r.__orbitState=t.__orbitState),t.__hierarchyRoot&&(r.__hierarchyRoot=t.__hierarchyRoot),void 0===e.layoutSelection&&null!=t.layoutSelection&&(r.layoutSelection=t.layoutSelection);const n=[...new Set([...Object.keys(t),...Object.keys(r)])].filter(e=>t[e]!==r[e]);this.config=r,this.tensionConfig={...et,...r.tensionConfig},!r.showParticles||"sankey"!==r.chartType&&!r.customNetworkLayout||this.particlePool||(this.particlePool=new rt(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,r,n){const{nodeIDAccessor:o="id",sourceAccessor:i="source",targetAccessor:a="target",valueAccessor:s="value"}=this.config,c="function"==typeof o?o:e=>e[o],l="function"==typeof i?i:e=>e[i],u="function"==typeof a?a:e=>e[a],d="function"==typeof s?s:e=>e[s]??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=c(t)+"";this.nodes.set(e,{...Qr(e),data:t})}for(let e=0;t.length>e;e++){const r=t[e],n=l(r)+"",o=u(r)+"",i=d(r),a=null==i?NaN:Number(i),s=Number.isFinite(a)?a:1;this.nodes.has(n)||this.nodes.set(n,{...Qr(n),data:r}),this.nodes.has(o)||this.nodes.set(o,{...Qr(o),data:r});const c=`${n}\0${o}\0${e}`,h={source:n,target:o,value:s,y0:0,y1:0,sankeyWidth:0,data:r,_edgeKey:c};r&&"object"==typeof r&&Kr(r.bezier)&&(h.bezier=r.bezier),this.edges.set(c,h)}n?.deferLayout||this.runLayout(r),this.updateResults.recordData("replace",e.length+t.length)}ingestBoundedWithResult(e,t,r,n){return this.ingestBounded(e,t,r,n),this.updateResults.last}applyForceLayoutPositions(e,t){for(const[t,r]of Object.entries(e)){const e=this.nodes.get(t);e&&(e.x=r.x,e.y=r.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:r,value:n}=e,o=0===this.nodes.size;let i=!1;const a=this.currentTime();this.lastIngestTime=a,this._decaySortedNodes=null,this._networkDecayCache=null,this.nodes.has(t)||(this.nodes.set(t,Qr(t)),this.nodeTimestamps.set(t,a),this.tension+=this.tensionConfig.newNode,i=!0),this.nodes.has(r)||(this.nodes.set(r,Qr(r)),this.nodeTimestamps.set(r,a),this.tension+=this.tensionConfig.newNode,i=!0);const s=this.edgeKey(t,r),c=this.edges.get(s);let l=!1;c?(c.value+=n,this.edgeTimestamps.set(s,a),this.tension+=this.tensionConfig.weightChange,l=!0):(this.edges.set(s,{source:t,target:r,value:n,y0:0,y1:0,sankeyWidth:0}),this.edgeTimestamps.set(s,a),this.tension+=this.tensionConfig.newEdge,i=!0);const u=o||i||l||this.tension>=this.tensionConfig.threshold;return this.updateResults.recordData("ingest",1),u}ingestEdgeWithResult(e){return this.ingestEdge(e),this.updateResults.last}runLayout(e){if(this.config.customNetworkLayout)return this.recordTopologyDiff(),void this.layoutVersion++;const t=qr(this.config.chartType);if(!t)return;let r=Array.from(this.nodes.values());const n=Array.from(this.edges.values());if(0===r.length&&!t.hierarchical)return;if(this.prepareForRelayout(),t.supportsStreaming&&!t.hierarchical){const e=new Map;for(const t of r)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,r]of this._lastPositionSnapshot)e.has(t)||e.set(t,r);this.config.__previousPositions=e.size>0?e:void 0}if(t.computeLayout(r,n,this.config,e),this.config.__previousPositions=void 0,t.hierarchical&&r.length>0){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this._networkDecayCache=null;for(const e of r)this.nodes.set(e.id,e);for(let e=0;n.length>e;e++){const t=n[e],r=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=r,this.edges.set(r,t)}const e=this._boundedPrevSnapshot;if(e&&e.size>0)for(const t of this.nodes.values()){const r=e.get(t.id);r&&(t._prevX0=r.x0,t._prevX1=r.x1,t._prevY0=r.y0,t._prevY1=r.y1)}this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,r=Array.from(this.nodes.values())}this.finalizeLayout();const o=new Map;for(const e of this.nodes.values())0===e.x&&0===e.y||o.set(e.id,{x:e.x,y:e.y});this._lastPositionSnapshot=o,this.saveTargetPositions();const i=r.some(e=>void 0!==e._prevX0&&(0!==e._prevX0||0!==e._prevX1||0!==e._prevY0||0!==e._prevY1)),a=this.config.transition?.duration??this.tensionConfig.transitionDuration,s=["sankey","tree","treemap","circlepack","partition"].includes(this.config.chartType);if(!this._hasRenderedOnce&&this.config.introAnimation&&s&&r.length>0&&a>0){const t=e[0]/2,r=e[1]/2;for(const e of this.nodes.values())e._prevX0=t,e._prevX1=t,e._prevY0=r,e._prevY1=r;for(const e of this.edges.values())e._prevY0=r,e._prevY1=r,e._prevSankeyWidth=0,e._introFromZero=!0;this.restorePreviousPositions(),this.transition={startTime:this.currentTime(),duration:a}}else i&&a>0&&(this.restorePreviousPositions(),this.transition={startTime:this.currentTime(),duration:a});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:r,restyleEdge:n,baseStyles:o,selection:i}){const a=!(!r&&!n);if(r)for(const t of e){const e=o.get(t)??t.style,n=r(t,i);t.style=n?{...e,...n}:e}if(n)for(const e of t){const t=o.get(e)??e.style,r=n(e,i);e.style=r?{...t,...r}:t}return a}({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:r,nodes:n,edges:o,previousResult:i,revision:a}){const s=$(e.colorScheme,e.themeCategorical,Ne),c={nodes:n,edges:o,dimensions:{width:r[0],height:r[1],plot:{x:0,y:0,width:r[0],height:r[1]}},theme:{semantic:e.themeSemantic??{},categorical:[...s]},resolveColor:W(s,e.colorScheme),config:e.layoutConfig??{},selection:e.layoutSelection??null};try{return{kind:"success",result:t(c)}}catch(t){const r=null!==i,n=d("network",t,r,a);"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:r}}}({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 r=t.result;return this.sceneNodes=r.sceneNodes??[],this.sceneEdges=r.sceneEdges??[],this.labels=r.labels??[],this.customLayoutOverlays=r.overlays??null,this.customLayoutHtmlMarks=r.htmlMarks??[],this.lastCustomLayoutResult=r,this.lastCustomLayoutFailure=null,this._sceneNodesRevision++,this._customRestyle=r.restyle,this._customRestyleEdge=r.restyleEdge,this.hasCustomRestyle=!(!r.restyle&&!r.restyleEdge),this.hasCustomRestyle&&(this._baseStyles=function(e,t){const r=new WeakMap;for(const t of e)r.set(t,t.style);for(const e of t)r.set(e,e.style);return r}(this.sceneNodes,this.sceneEdges),this.restyleScene(this.config.layoutSelection??null)),void T({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=qr(this.config.chartType);if(!t)return void this._sceneNodesRevision++;const r=t.hierarchical?Array.from(this.nodes.values()):this.nodesArray,n=t.hierarchical?Array.from(this.edges.values()):this.edgesArray,{sceneNodes:o,sceneEdges:i,labels:a}=t.buildScene(r,n,this.config,e);this.sceneNodes=o,this.sceneEdges=i,this.labels=a,this._sceneNodesRevision++}rebuildNodeQuadtree(){let t=0,r=0;for(const e of this.sceneNodes)"circle"===e.type&&(t++,e.r>r&&(r=e.r));if(this._maxNodeRadius=r,e.QUADTREE_THRESHOLD>=t)return void(this._nodeQuadtree=null);const n=Array(t);let o=0;for(const e of this.sceneNodes)"circle"===e.type&&(n[o++]=e);this._nodeQuadtree=Vr().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=qr(this.config.chartType);return!!e?.supportsAnimation&&!1!==this.config.orbitAnimated}tickAnimation(e,t){const r=qr(this.config.chartType);if(!r?.tick)return!1;const n=r.hierarchical?Array.from(this.nodes.values()):this.nodesArray,o=r.hierarchical?Array.from(this.edges.values()):this.edgesArray;return r.tick(n,o,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=re(e,this.transition),r=ee(t);for(const e of this.nodes.values())void 0===e._targetX0||void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=fe(e._prevX0,e._targetX0,r),e.x1=fe(e._prevX1,e._targetX1,r),e.y0=fe(e._prevY0,e._targetY0,r),e.y1=fe(e._prevY1,e._targetY1,r));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=fe(e._prevY0,e._targetY0,r),e.y1=fe(e._prevY1,e._targetY1,r),e.sankeyWidth=fe(e._prevSankeyWidth,e._targetSankeyWidth,r));return this.rebuildAllBeziers(),1>t||(this.snapToTargets(),this.transition=null,!1)}prepareForRelayout(){const e=this._boundedPrevSnapshot;for(const t of this.nodes.values()){const r=e?.get(t.id);r&&0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1?(t._prevX0=r.x0,t._prevX1=r.x1,t._prevY0=r.y0,t._prevY1=r.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 r=t.get(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`);if(r){e._prevY0=r.y0,e._prevY1=r.y1,e._prevSankeyWidth=r.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,r=.5){const n="string"==typeof e.source?t.get(e.source):e.source,o="string"==typeof e.target?t.get(e.target):e.target;!n||!o||(e.bezier=e.circular&&e.circularPathData?function(e){const t=(e._circularWidth||e.sankeyWidth||1)/2,r=e.circularPathData;if(!r)throw Error("buildCircularBezier requires circularPathData");if(e._circularStub){const e=Math.max(15,Math.min(40,.33*(r.rightFullExtent-r.sourceX))),n=Math.max(15,Math.min(40,.33*(r.targetX-r.leftFullExtent)));return{circular:!0,segments:[[{x:r.sourceX,y:r.sourceY},{x:r.sourceX+.33*e,y:r.sourceY},{x:r.sourceX+.66*e,y:r.sourceY},{x:r.sourceX+e,y:r.sourceY}],[{x:r.targetX-n,y:r.targetY},{x:r.targetX-.66*n,y:r.targetY},{x:r.targetX-.33*n,y:r.targetY},{x:r.targetX,y:r.targetY}]],halfWidth:t}}let n;n="down"===e.direction?[{x:r.sourceY,y:r.sourceX},{x:r.sourceY,y:r.rightFullExtent},{x:r.verticalFullExtent,y:r.rightFullExtent},{x:r.verticalFullExtent,y:r.leftFullExtent},{x:r.targetY,y:r.leftFullExtent},{x:r.targetY,y:r.targetX}]:[{x:r.sourceX,y:r.sourceY},{x:r.rightFullExtent,y:r.sourceY},{x:r.rightFullExtent,y:r.verticalFullExtent},{x:r.leftFullExtent,y:r.verticalFullExtent},{x:r.leftFullExtent,y:r.targetY},{x:r.targetX,y:r.targetY}];const o=[];for(let e=0;n.length-1>e;e++){const t=n[e],r=n[e+1],i=r.x-t.x,a=r.y-t.y;o.push([t,{x:t.x+i/3,y:t.y+a/3},{x:t.x+2*i/3,y:t.y+2*a/3},r])}return{circular:!0,segments:o,halfWidth:t}}(e):function(e,t,r,n=.5){const o=(e.sankeyWidth||1)/2;if("down"===e.direction){const i=t.x1,a=r.x0,s=Ur(i,a);return{circular:!1,points:[{x:e.y0,y:i},{x:e.y0,y:s(n)},{x:e.y1,y:s(1-n)},{x:e.y1,y:a}],halfWidth:o}}const i=t.x1,a=r.x0,s=Ur(i,a);return{circular:!1,points:[{x:i,y:e.y0},{x:s(n),y:e.y0},{x:s(1-n),y:e.y1},{x:a,y:e.y1}],halfWidth:o}}(e,n,o,r))}(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 r=t.duration??500,n=t.color??"rgba(255,255,255,0.6)",o=t.glowRadius??4,{now:i}=e;for(const t of e.sceneNodes){const a=t.id;if(!a)continue;const s=e.nodeTimestamps.get(a);if(!s)continue;const c=i-s;r>c&&(t._pulseIntensity=1-c/r,t._pulseColor=n,t._pulseGlowRadius=o)}for(const t of e.sceneEdges){const o=t.datum;if(!o)continue;const a="object"==typeof o.source?o.source?.id:o.source,s="object"==typeof o.target?o.target?.id:o.target;if(!a||!s)continue;const c=e.edgeTimestamps.get(`${a}\0${s}`);if(!c)continue;const l=i-c;r>l&&(t._pulseIntensity=1-l/r,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 r=e.nodeTimestamps.size;if(1>=r)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 r=0;e.cache.sortedNodes.length>r;r++)t.set(e.cache.sortedNodes[r][0],r);e.cache.ageMap=t}const n=e.cache.ageMap;for(const o of e.sceneNodes){const e=o.id;if(!e)continue;const i=n.get(e);if(void 0===i)continue;const a=u(t,i,r);o.style={...o.style,opacity:(o.style?.opacity??1)*a}}}({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===Jr&&(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>=en)return;const r=1-t/en;for(const t of e.sceneNodes){const n=t.id;n&&e.addedNodes.has(n)&&(t._pulseIntensity=Math.max(t._pulseIntensity??0,r),t._pulseColor=Jr,t._pulseGlowRadius=8)}}({sceneNodes:this.sceneNodes,addedNodes:this.addedNodes,lastTopologyChangeTime:this.lastTopologyChangeTime,now:e})}get hasActiveTopologyDiff(){return function(e,t,r=("undefined"!=typeof performance?performance.now():Date.now())){return 0!==e.size&&en>r-t}(this.addedNodes,this.lastTopologyChangeTime)}applyThresholds(e){!function(e){const t=e.thresholds;if(!t)return;const r=t.warningColor??"#f59e0b",n=t.criticalColor??"#ef4444",o=!1!==t.pulse;for(const i of e.sceneNodes){const a=i.id;if(!a)continue;const s=e.nodes.get(a);if(!s)continue;const c=t.metric(s);let l=null;void 0===t.critical||t.critical>c?void 0===t.warning||t.warning>c||(l=r):l=n,l&&(i.style={...i.style,fill:l},o&&(i._pulseIntensity=.6+.4*Math.sin(e.now/300),i._pulseColor=l,i._pulseGlowRadius=6))}}({sceneNodes:this.sceneNodes,nodes:this.nodes,thresholds:this.config.thresholds,now:e})}get hasActiveThresholds(){return function(e,t){if(!t)return!1;for(const r of e){const e=t.metric(r);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 r=e.now??("undefined"!=typeof performance?performance.now():Date.now());return(t.duration??500)>r-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 r=this.nodes.get(e);if(!r)return this.updateResults.recordNoop("update"),null;const n=r.data?{...r.data}:{};return r.data=t(r.data??{}),this.layoutVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("update",1),n}updateEdge(e,t,r){const n=this.config.valueAccessor,o="function"==typeof n?n:n?e=>e[n]:e=>e.value,i=[];for(const[,n]of this.edges)if(("string"==typeof n.source?n.source:n.source.id)===e&&("string"==typeof n.target?n.target:n.target.id)===t){i.push(n.data?{...n.data}:{}),n.data=r(n.data??{});const e=o(n.data);null!=e&&(n.value=Number(e))}return i.length>0?(this.layoutVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("update",i.length)):this.updateResults.recordNoop("update"),i}removeNode(e){if(!this.nodes.has(e))return this.updateResults.recordNoop("remove"),!1;this.nodes.delete(e),this.nodeTimestamps.delete(e);for(const[t,r]of this.edges)("string"==typeof r.source?r.source:r.source.id)!==e&&("string"==typeof r.target?r.target:r.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 r=[];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,o]of this.edges)o.data&&n(o.data)===e&&r.push(t)}else for(const[n,o]of this.edges)("string"==typeof o.source?o.source:o.source.id)===e&&("string"==typeof o.target?o.target:o.target.id)===t&&r.push(n);for(const e of r)this.edges.delete(e),this.edgeTimestamps.delete(e);return r.length>0?(this.layoutVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("remove",r.length)):this.updateResults.recordNoop("remove"),r.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")}};fn.QUADTREE_THRESHOLD=500;var gn=fn;s(gn);import*as pn from"react";function mn(e){const t=e.id??e.datum?.id??e.datum?.data?.id??e.datum?.data?.name;return null==t?void 0:t+""}function vn(e){if("glyph"===e.type&&e.glyph&&"number"==typeof e.size){const t=e.cx??e.x,r=e.cy??e.y;if("number"!=typeof t||"number"!=typeof r)return null;const n=ue(e.glyph,e.size);return{x:t+n.centerDx,y:r+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),r=e.cy??(null!=e.y&&null!=e.h?e.y+e.h/2:e.y);return"number"!=typeof t||"number"!=typeof r?null:{x:t,y:r,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,Ie(e.size)):Math.max(1,e.w??0,e.h??0)/2}}import{Fragment as xn,jsx as kn,jsxs as bn}from"react/jsx-runtime";function _n(e){const{width:t,height:r,totalWidth:n,totalHeight:o,margin:i,labels:a,title:s,legend:c,legendHoverBehavior:l,legendClickBehavior:u,legendHighlightedCategory:d,legendIsolatedCategories:h,legendPosition:f="right",legendLayout:g,foregroundGraphics:p,sceneNodes:m,annotations:v,onAnnotationActivate:x,onObservation:k,chartId:b,chartType:_,autoPlaceAnnotations:S,svgAnnotationRules:w}=e,A=We({onAnnotationActivate:x,onObservation:k,chartId:b,chartType:_}),L=pn.useMemo(()=>{const e=function(e){if(!e)return;const t=[];for(const r of e){const e=vn(r);e&&t.push({pointId:mn(r),...e})}return t}(m)??[];return{scales:null,width:t,height:r,frameType:"network",pointNodes:e,sceneNodes:m}},[r,m,t]),E=pn.useMemo(()=>{if(!v)return v;const e=y(v);return S?U({annotations:e,context:L,..."object"==typeof S?S:{}}):e},[v,S,L]),P=pn.useMemo(()=>ne("network"),[]),D=E?we(E.filter(e=>"widget"!==e.type),P,w,L):null,R=!0===E?.some(e=>"widget"===e.type&&!0===e._annotationDeferred);return bn(xn,{children:[R&&kn("style",{children:z},"annotation-widget-disclosure-style"),bn("svg",{role:"img",width:n,height:o,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[kn("title",{children:"string"==typeof s?s:"Network Chart"}),kn("desc",{children:"string"==typeof s?s+" (network data visualization)":"Network data visualization"}),bn("g",{transform:`translate(${i.left},${i.top})`,children:[a.map((e,t)=>kn("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)),D,p]}),kn(G,{title:s,totalWidth:n,marginTop:i.top}),Ae({legend:c,totalWidth:n,totalHeight:o,margin:i,legendPosition:f,title:s,legendLayout:g,legendHoverBehavior:l,legendClickBehavior:u,legendHighlightedCategory:d,legendIsolatedCategories:h})]}),E?.filter(e=>"widget"===e.type&&e.nodeId&&m).map((e,t)=>{const r=!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 o=i.left+(n.cx??(null!=n.x&&null!=n.w?n.x+n.w/2:n.x??0)),a=i.top+(n.cy??(null!=n.y&&null!=n.h?n.y+n.h/2:n.y??0)),s=e.dx??0,c=e.dy??-16,l=e.width??32,u=e.height??32,d=e.content??kn("span",{style:{fontSize:18,cursor:"default"},children:"ℹ️"});return kn("div",{...Z(e,A),className:r?"annotation-deferred":void 0,"data-annotation-disclosure":r?"deferred":void 0,style:{position:"absolute",left:o+s-l/2,top:a+c-u/2,width:l,height:u,display:"flex",alignItems:"center",justifyContent:"center",zIndex:5},children:d},"widget-"+t)})]})}_n.displayName="NetworkSVGOverlay";import*as Sn from"react";import{jsx as wn}from"react/jsx-runtime";var An={position:"absolute",top:0,left:0,pointerEvents:"none"};function Ln({marks:e,margin:t,selection:r=null,overscan:n=400}){const o=Sn.useRef(null),i=function(e,t,r){const[n,o]=Sn.useState(null);return Sn.useLayoutEffect(()=>{const e=t.current,r=function(e){let t=e?.parentElement??null;for(;t;){const{overflow:e,overflowX:r,overflowY:n}=window.getComputedStyle(t);if(/(auto|scroll|overlay)/.test(`${e} ${n} ${r}`))return t;t=t.parentElement}return null}(e);if(!e||!r)return void o(null);let n=0;const i=()=>{n=0;const t=r.getBoundingClientRect(),i=e.getBoundingClientRect();o(0!==t.width&&0!==t.height?{scroll:{left:t.left,top:t.top,right:t.right,bottom:t.bottom},originX:i.left,originY:i.top}:null)},a=()=>{0===n&&(n=window.requestAnimationFrame(i))};i(),r.addEventListener("scroll",a,{passive:!0});const s=new ResizeObserver(a);return s.observe(r),()=>{0!==n&&window.cancelAnimationFrame(n),r.removeEventListener("scroll",a),s.disconnect()}},[t,e,r]),Sn.useMemo(()=>{if(!e||!n)return e;const{scroll:t,originX:o,originY:i}=n,a=t.left-r,s=t.right+r,c=t.top-r,l=t.bottom+r;return e.filter(e=>{const t=o+e.x,r=i+e.y;return!(a>t+e.width||t>s||c>r+e.height||r>l)})},[e,n,r])}(e,o,n);if(!e||0===e.length)return null;const a=wn("div",{className:"semiotic-network-html-marks",ref:o,style:{...An,transform:`translate(${t.left}px, ${t.top}px)`},children:(i??e).map(e=>wn("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!=r?wn(C,{value:r,children:a}):a}import{jsx as En,jsxs as Pn}from"react/jsx-runtime";function Dn({props:e,store:t,responsiveRef:r,size:n,margin:o,adjustedWidth:i,adjustedHeight:a,surfaceBackground:s,resolvedBackground:c,resolvedForeground:u}){const{chartType:d,nodes:h,edges:y,data:f,className:g,description:p,title:m,responsiveWidth:v,responsiveHeight:x,summary:k,renderMode:b,legend:_,legendPosition:S,legendLayout:w,legendHoverBehavior:L,legendClickBehavior:E,legendHighlightedCategory:P,legendIsolatedCategories:D,layoutSelection:R,annotations:M,onAnnotationActivate:N,annotationObservationCallback:T,onObservation:C,chartId:W,autoPlaceAnnotations:$,svgAnnotationRules:z}=e;if(t){const e=["tree","cluster","treemap","circlepack","partition","orbit"].includes(d),r=e?f||(Array.isArray(y)?void 0:y):void 0;if(e&&r)t.ingestHierarchy(r,[i,a]),t.buildScene([i,a]);else{const e=ce(h),r=Array.isArray(y)?ce(y):[];(e.length>0||r.length>0)&&(t.ingestBounded(e,r,[i,a]),t.buildScene([i,a]))}}const F=t?.sceneNodes??[],B=t?.sceneEdges??[],Y=t?.labels??[];return Pn("div",{ref:r,className:"stream-network-frame"+(g?" "+g:""),role:"img","aria-label":p||("string"==typeof m?m:"Network chart"),style:{position:"relative",width:v?"100%":n[0],height:x?"100%":n[1]},children:[En(V,{summary:k}),Pn("svg",{xmlns:"http://www.w3.org/2000/svg",width:n[0],height:n[1],style:{position:"absolute",left:0,top:0},children:[s?En("rect",{className:"stream-frame-background__backdrop",x:0,y:0,width:n[0],height:n[1],fill:s}):null,En("g",{transform:`translate(${o.left},${o.top})`,children:c}),Pn("g",{transform:`translate(${o.left},${o.top})`,children:[B.map((e,t)=>A({node:e,index:t,renderMode:b,fallback:()=>pe(e,t)})).filter(Boolean),F.map((e,t)=>A({node:e,index:t,renderMode:b,fallback:()=>me(e,t)})).filter(Boolean),Y.map((e,t)=>ge(e,t)).filter(Boolean)]})]}),En(_n,{width:i,height:a,totalWidth:n[0],totalHeight:n[1],margin:o,labels:Y,sceneNodes:F,title:m,legend:_,legendPosition:S,legendLayout:w,legendHoverBehavior:L,legendClickBehavior:E,legendHighlightedCategory:P,legendIsolatedCategories:D,foregroundGraphics:l(u,I(t?.customLayoutOverlays,R??null)),annotations:M,onAnnotationActivate:N,onObservation:T??C,chartId:W,chartType:"StreamNetworkFrame",autoPlaceAnnotations:$,svgAnnotationRules:z,annotationFrame:0}),En(Ln,{marks:t?.customLayoutHtmlMarks,margin:o,selection:R??null})]})}function Rn(e){if("undefined"!=typeof DOMException)return new DOMException(e+" aborted","AbortError");const t=Error(e+" aborted");return t.name="AbortError",t}function Mn(e){const t=Error(e.message);return t.name=e.name??"Error",e.stack&&(t.stack=e.stack),t}function Nn(e){return e&&"object"==typeof e?{requestId:e.requestId,error:e.error}:{}}var Tn=class{constructor(e){this.nextRequestId=1,this.pending=new Map,this.dead=!1,this.options=e,this.worker=e.createWorker(),this.worker.onmessage=e=>{const t=this.options.parseMessage(e.data),r=t.requestId,n=null!=r?this.pending.get(r):this.pending.values().next().value;if(n){if(null!=r)this.pending.delete(r);else{for(const e of this.pending.values())e!==n&&(e.cleanup(),e.reject(Error(this.options.name+" worker response missing requestId")));this.pending.clear()}n.cleanup(),t.ok?n.resolve(t.payload):n.reject(t.error)}},this.worker.onerror=e=>{this.rejectAll(Error(e.message||this.options.name+" worker failed")),this.terminate()}}get isDead(){return this.dead}request(e,t){if(this.dead)return Promise.reject(Error(this.options.name+" worker session is closed"));if(t?.aborted)return Promise.reject(Rn(this.options.name));const r=this.nextRequestId;this.nextRequestId+=1;const n=this.options.encodeRequest?.(r,e)??{requestId:r,request:e};return new Promise((e,o)=>{const i=()=>{const e=1===this.pending.size;this.pending.delete(r),t?.removeEventListener("abort",i),o(Rn(this.options.name)),this.options.terminateOnAbort&&e&&this.terminate()},a=()=>t?.removeEventListener("abort",i);this.pending.set(r,{cleanup:a,reject:o,resolve:e}),t?.addEventListener("abort",i,{once:!0});try{this.worker.postMessage(n)}catch(e){this.pending.delete(r),a(),o(e instanceof Error?e:Error(e+""))}})}terminate(){this.dead||(this.dead=!0,this.rejectAll(Error(this.options.name+" worker terminated")),this.worker.terminate())}rejectAll(e){for(const t of this.pending.values())t.cleanup(),t.reject(e);this.pending.clear()}};function Cn(e){let t=null;return{get:()=>(t&&!t.isDead||(t=e()),t),resetForTest:()=>{if(t){try{t.terminate()}catch{}t=null}}}}function In(e,t,r,n,o=4e4){return"sync"!==e&&("worker"===e||n*(t+r)>=o)}function Wn(){return"undefined"!=typeof window&&"undefined"!=typeof Worker}var $n=class{constructor(e=function(){const e="string"==typeof import.meta.url&&import.meta.url?new URL("./forceLayoutWorker.js",import.meta.url):o("forceLayoutWorker.js");return new Worker(e,{type:"module",name:"semiotic-force-layout"})}()){this.session=new Tn({name:"Force layout",createWorker:()=>e,terminateOnAbort:!0,parseMessage:e=>{const t=e,{requestId:r,error:n}=Nn(t);return n?{requestId:r,ok:!1,error:Mn(n)}:{requestId:r,ok:!0,payload:{positions:t.positions??{}}}}})}get isDead(){return this.session.isDead}request(e,t){return this.session.request(e,t)}terminate(){this.session.terminate()}},zn=Cn(()=>new $n);function Fn(e,t){return Wn()?zn.get().request(e,t):Promise.reject(Error("Web Workers are unavailable"))}import{jsx as Bn,jsxs as Yn}from"react/jsx-runtime";var On=/^(value|amount|total|count|weight|score)$/i;function Xn({data:e}){if("edge"===e.nodeOrEdge){const t=e.data;return t?Yn("div",{className:"semiotic-tooltip",style:ie,children:[Yn("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&&Yn("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 r=t.__hierarchyNode;if(r){const e=[];let n=r;for(;n;){const r=n.data?.name??n.data?.id??t.id;null!=r&&e.unshift(r+""),n=n.parent}e.length>1&&e.shift();const o=e.length-1;return Yn("div",{className:"semiotic-tooltip",style:ie,children:[Bn("div",{children:e.map((e,t)=>Yn("span",{children:[t>0&&Bn("span",{style:{margin:"0 3px",opacity:.5},children:" → "}),t===o?Bn("strong",{children:e}):Bn("span",{style:{opacity:.7},children:e})]},t))}),null!=t.value&&t.value>0&&Bn("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),o=(t.sourceLinks||[]).reduce((e,t)=>e+(t.value||0),0)+(t.targetLinks||[]).reduce((e,t)=>e+(t.value||0),0),i=Ce(t.data??t),a=null!=i.title?i.title+"":t.id,s=i.entries.some(e=>On.test(e.key));return Yn("div",{className:"semiotic-tooltip",style:ie,children:[Bn("div",{style:{fontWeight:600},children:a}),i.entries.map(e=>Yn("div",{style:{marginTop:4,opacity:.8},children:[e.key,": ",g(e.value)]},e.key)),!s&&null!=t.value&&t.value>0&&Yn("div",{style:{marginTop:4,opacity:.8},children:["Total:"," ","number"==typeof t.value?t.value.toLocaleString():t.value+""]}),n>0&&Yn("div",{style:{marginTop:4,opacity:.8},children:["Connections: ",n,o!==n&&` (weighted: ${o.toLocaleString()})`]})]})}function jn(e){return e._cachedPath2D&&e._cachedPath2DSource===e.pathD||(e._cachedPath2D=new Path2D(e.pathD),e._cachedPath2DSource=e.pathD),e._cachedPath2D}function Hn(e,t){if(!t.pathD)return;e.save();const r=jn(t);if(t.style.fill&&"none"!==t.style.fill){const n=t._gradient;if(n){const r=e.createLinearGradient(n.x0,n.y0??0,n.x1,n.y1??0),o=t.style.fillOpacity??t.style.opacity??.5,i="string"==typeof t.style.fill?t.style.fill:"#999",a=Ee(e,i)||i;r.addColorStop(0,1===n.from?a:"transparent"),r.addColorStop(1,1===n.to?a:"transparent"),e.fillStyle=r,e.globalAlpha=o}else e.fillStyle=Pe(e,t.style.fill,"#007bff"),e.globalAlpha=t.style.fillOpacity??t.style.opacity??.5;e.fill(r)}t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ee(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??.5,e.globalAlpha=.5*(t.style.opacity??1),e.stroke(r)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.2*t._pulseIntensity,e.fill(r)),e.restore()}function Gn(e,t){e.save();const r=t.style.stroke||"#999";e.strokeStyle=Ee(e,r)||r,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 qn(e,t){if(!t.pathD)return;e.save();const r=jn(t);t.style.fill&&"none"!==t.style.fill&&(e.fillStyle=Pe(e,t.style.fill,"#007bff"),e.globalAlpha=t.style.fillOpacity??t.style.opacity??.5,e.fill(r)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ee(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??.5,e.globalAlpha=.3*(t.style.opacity??1),e.stroke(r)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.25*t._pulseIntensity,e.fill(r)),e.restore()}function Vn(e,t){if(!t.pathD)return;e.save();const r=jn(t),n=t.style.stroke||"#999";e.strokeStyle=Ee(e,n)||n,e.lineWidth=t.style.strokeWidth??1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.stroke(r),t.style.fill&&"none"!==t.style.fill&&(e.fillStyle=Pe(e,t.style.fill,"#007bff"),e.globalAlpha=t.style.fillOpacity??.1,e.fill(r)),e.restore()}function Qn(e,t,r,n=30){switch(e.type){case"circle":return function(e,t,r,n=30){const o=t-e.cx,i=r-e.cy,a=Math.sqrt(o*o+i*i);return a>p(e.r,n)?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:a}}(e,t,r,n);case"rect":return function(e,t,r){const n=m(t,r,e);return n.hit?{type:"node",datum:e.datum,x:n.cx,y:n.cy,distance:0}:null}(e,t,r);case"arc":return function(e,t,r){const n=t-e.cx,o=r-e.cy,i=Math.sqrt(n*n+o*o);if(e.innerR-2>i||i>e.outerR+2)return null;const a=k(Math.atan2(o,n)),s=k(e.startAngle),c=k(e.endAngle);if(s>c?a>=s||c>=a:a>=s&&c>=a){const t=(e.startAngle+e.endAngle)/2,r=(e.innerR+e.outerR)/2;return{type:"node",datum:e.datum,x:e.cx+r*Math.cos(t),y:e.cy+r*Math.sin(t),distance:0}}return null}(e,t,r);case"symbol":return function(e,t,r,n=30){const o=t-e.cx,i=r-e.cy,a=Math.sqrt(o*o+i*i);return a>p(Ie(e.size),n)?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:a}}(e,t,r,n);case"glyph":return function(e,t,r,n=30){if(null==e.datum)return null;const o=ue(e.glyph,e.size),i=e.cx+o.centerDx,a=e.cy+o.centerDy,s=t-i,c=r-a,l=Math.sqrt(s*s+c*c);return l>p(o.radius,n)?null:{type:"node",datum:e.datum,x:i,y:a,distance:l}}(e,t,r,n);default:return null}}Xn.ownsChrome=!0;var Kn=null,Zn=null;function Un(){return Zn||((Kn=document.createElement("canvas")).width=1,Kn.height=1,Zn=Kn.getContext("2d")),Zn}function Jn(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 eo(e,t,r){switch(e.type){case"bezier":return function(e,t,r){if(!e.pathD)return null;const n=Jn(e),o=Un();if(!n||!o)return null;try{if(o.isPointInPath(n,t,r))return{type:"edge",datum:e.datum,x:t,y:r,distance:0};const i=o.lineWidth;o.lineWidth=10;const a=o.isPointInStroke(n,t,r);if(o.lineWidth=i,a)return{type:"edge",datum:e.datum,x:t,y:r,distance:4}}catch{}return null}(e,t,r);case"line":return function(e,t,r){const n=e.x2-e.x1,o=e.y2-e.y1,i=n*n+o*o;if(0===i)return null;let a=((t-e.x1)*n+(r-e.y1)*o)/i;a=Math.max(0,Math.min(1,a));const s=e.x1+a*n,c=e.y1+a*o,l=Math.sqrt((t-s)**2+(r-c)**2);return l>5?null:{type:"edge",datum:e.datum,x:s,y:c,distance:l}}(e,t,r);case"ribbon":case"curved":return function(e,t,r){if(!e.pathD)return null;const n=Jn(e),o=Un();if(!n||!o)return null;try{if(o.isPointInPath(n,t,r))return{type:"edge",datum:e.datum,x:t,y:r,distance:0};const i=o.lineWidth;o.lineWidth=10;const a=o.isPointInStroke(n,t,r);if(o.lineWidth=i,a)return{type:"edge",datum:e.datum,x:t,y:r,distance:4}}catch{}return null}(e,t,r);default:return null}}function to(e){const{clientX:t,clientY:r,canvasRect:n,margin:o,adjustedWidth:i,adjustedHeight:a,sceneNodes:s,sceneEdges:c,nodeQuadtree:l,maxNodeRadius:u,hitRadius:d=30,includeEdges:h=!0}=e,y=t-n.left-o.left,g=r-n.top-o.top;if(0>y||y>i||0>g||g>a)return{kind:"miss-outside"};const p=function(e,t,r,n,o=30,i,a=0,s=!0){let c=null,l=1/0,u=1/0;if(i){const e=f(i,r,n,o,a,e=>e.cx,e=>e.cy,e=>e.r);e&&(c={mark:e.node,type:"node",datum:e.node.datum,x:e.node.cx,y:e.node.cy,distance:e.distance},l=e.distance)}for(const t of e){if(i&&"circle"===t.type)continue;const e=Qn(t,r,n,o);if(e)if(e.mark=t,"rect"===t.type){const r=t.w*t.h;u>r&&(c=e,u=r)}else l>e.distance&&(c=e,l=e.distance)}if(c)return c;if(!s)return null;for(const e of t){if(!1===e.interactive)continue;const t=eo(e,r,n);t&&(t.mark=e),t&&l>t.distance&&(c=t,l=t.distance)}return c}(s,c,y,g,d,l,u,h);return p?{kind:"hit",hover:J(p.datum||{},p.x,p.y,{nodeOrEdge:p.type}),mark:p.mark}:{kind:"miss"}}import{useCallback as ro}from"react";var no="StreamNetworkFrame";function oo(e,t,r){return e.nodes=Re(t),e.edges=Re(r),e.nodes||e.edges}import{jsx as io,jsxs as ao}from"react/jsx-runtime";var so=[800,600],co=Je(Ue(function(r,n){const{chartType:o,nodes:s,edges:u,data:d,initialEdges:y,nodeIDAccessor:f="id",sourceAccessor:g="source",targetAccessor:p="target",valueAccessor:m="value",edgeIdAccessor:k,childrenAccessor:A,hierarchySum:T,orientation:C="horizontal",nodeAlign:W="justify",nodePaddingRatio:$=.05,nodeWidth:z=15,iterations:G=300,forceStrength:K=.1,layoutExecution:Z="auto",layoutLoadingContent:U,onLayoutStateChange:ee,padAngle:re=.01,groupWidth:ne=20,sortGroups:oe,edgeSort:ie,treeOrientation:ue="vertical",edgeType:fe="curve",padding:ge,paddingTop:pe,tensionConfig:me,showParticles:ve=!1,particleStyle:we,renderMode:Ae,nodeStyle:Pe,edgeStyle:Re,colorBy:Ne,colorScheme:Ce="category10",edgeColorBy:Ie="source",edgeOpacity:We=.5,colorByDepth:je=!1,nodeSize:Ue=8,nodeSizeRange:Je=[5,20],nodeLabel:rt,showLabels:nt=!0,labelMode:ot,size:it=so,responsiveWidth:at,responsiveHeight:st,margin:ct,className:lt,background:ut,maxDevicePixelRatio:dt,enableHover:ht=!0,tooltipContent:yt,customHoverBehavior:ft,customClickBehavior:gt,onObservation:pt,annotationObservationCallback:mt,chartId:vt,onTopologyChange:xt,annotations:kt,onAnnotationActivate:bt,autoPlaceAnnotations:_t,svgAnnotationRules:St,legend:wt,legendPosition:At,legendLayout:Lt,legendHoverBehavior:Et,legendClickBehavior:Pt,legendHighlightedCategory:Dt,legendIsolatedCategories:Rt,title:Mt,foregroundGraphics:Nt,backgroundGraphics:Tt,decay:Ct,pulse:It,transition:Wt,animate:$t,staleness:zt,frameScheduler:Ft,clock:Bt,random:Yt,seed:Ot,paused:Xt=!1,suspendWhenHidden:jt=!0,thresholds:Ht,accessibleTable:Gt=!0,description:qt,summary:Vt,orbitMode:Qt,orbitSize:Kt,orbitSpeed:Zt,orbitRevolution:Ut,orbitRevolutionStyle:Jt,orbitEccentricity:er,orbitShowRings:tr,orbitAnimated:rr,customNetworkLayout:nr,onLayoutError:or,layoutConfig:ir,layoutSelection:ar}=r,sr=e(o),cr=Ge(!0),lr=ze({sizeProp:it,responsiveWidth:at,responsiveHeight:st,userMargin:ct,marginDefault:sr,title:Mt,legend:wt,legendPosition:At,legendLayout:Lt,legendMarginReserved:r.__legendMarginReservedFor===wt,animate:$t,transitionProp:Wt,frameScheduler:Ft,clock:Bt,random:Yt,seed:Ot,paused:Xt,suspendWhenHidden:jt,themeDirtyRef:cr}),{reducedMotionRef:ur,responsiveRef:dr,size:hr,margin:yr,adjustedWidth:fr,adjustedHeight:gr,transition:pr,introEnabled:mr,tableId:vr,rafRef:kr,renderFnRef:br,scheduleRender:_r,frameRuntime:Sr,currentTheme:wr}=lr,{resolvedForeground:Ar,resolvedBackground:Lr,themeBackground:Er,surfaceBackground:Pr}=L({foregroundGraphics:Nt,backgroundGraphics:Tt,size:hr,margin:yr,scales:null,background:ut,themeBackgroundColor:wr.colors.background}),Dr=Be(),Rr=Oe(),Mr=Qe(()=>ce(s),[s]),Nr=Qe(()=>Array.isArray(u)?ce(u):u,[u]),Tr=Qe(()=>({...et,...me}),[me]),Cr=Qe(()=>({...tt,...we}),[we]),Ir=Qe(()=>{return{chartType:(e={chartType:o,clock:Sr.now,random:Yt,seed:Ot,nodeIDAccessor:f,sourceAccessor:g,targetAccessor:p,valueAccessor:m,edgeIdAccessor:k,childrenAccessor:A,hierarchySum:T,orientation:C,nodeAlign:W,nodePaddingRatio:$,nodeWidth:z,iterations:G,forceStrength:K,padAngle:re,groupWidth:ne,sortGroups:oe,edgeSort:ie,treeOrientation:ue,edgeType:fe,padding:ge,paddingTop:pe,tensionConfig:Tr,showParticles:ve,particleStyle:Cr,nodeStyle:Pe,edgeStyle:Re,nodeLabel:rt,showLabels:nt,labelMode:ot,colorBy:Ne,colorScheme:Ce,edgeColorBy:Ie,edgeOpacity:We,colorByDepth:je,nodeSize:Ue,nodeSizeRange:Je,decay:Ct,pulse:It,transition:pr,introAnimation:mr,staleness:zt,thresholds:Ht,orbitMode:Qt,orbitSize:Kt,orbitSpeed:Zt,orbitRevolution:Ut,orbitRevolutionStyle:Jt,orbitEccentricity:er,orbitShowRings:tr,orbitAnimated:rr,customNetworkLayout:nr,onLayoutError:or,layoutConfig:ir,currentTheme:wr}).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:Xe(e.currentTheme),edgeColorBy:e.edgeColorBy,edgeOpacity:e.edgeOpacity,colorByDepth:e.colorByDepth,nodeSize:e.nodeSize,nodeSizeRange:e.nodeSizeRange,decay:e.decay,pulse:e.pulse,transition:e.transition,introAnimation:e.introAnimation,staleness:e.staleness,thresholds:e.thresholds,orbitMode:e.orbitMode,orbitSize:e.orbitSize,orbitSpeed:e.orbitSpeed,orbitRevolution:e.orbitRevolution,orbitRevolutionStyle:e.orbitRevolutionStyle,orbitEccentricity:e.orbitEccentricity,orbitShowRings:e.orbitShowRings,orbitAnimated:e.orbitAnimated,customNetworkLayout:e.customNetworkLayout,onLayoutError:e.onLayoutError,layoutConfig:e.layoutConfig};var e},[o,Sr.now,Yt,Ot,f,g,p,m,k,A,T,C,W,$,z,G,K,re,ne,oe,ie,ue,fe,ge,pe,Tr,ve,Cr,Pe,Re,rt,nt,ot,Ne,Ce,Ie,We,je,Ue,Je,Ct,It,pr,mr,zt,Ht,Qt,Kt,Zt,Ut,Jt,er,tr,rr,nr,or,ir,wr]),Wr=M(Ir),$r=M({chartType:(zr={chartType:o,nodeIDAccessor:f,sourceAccessor:g,targetAccessor:p,valueAccessor:m,edgeIdAccessor:k,childrenAccessor:A,hierarchySum:T,orientation:C,nodeAlign:W,nodePaddingRatio:$,nodeWidth:z,iterations:G,forceStrength:K,padAngle:re,groupWidth:ne,sortGroups:oe,edgeSort:ie,treeOrientation:ue,edgeType:fe,padding:ge,paddingTop:pe,random:Yt,seed:Ot,tensionConfig:Tr,customNetworkLayout:nr,orbitMode:Qt,orbitSize:Kt,orbitEccentricity:er}).chartType,nodeIDAccessor:zr.nodeIDAccessor,sourceAccessor:zr.sourceAccessor,targetAccessor:zr.targetAccessor,valueAccessor:zr.valueAccessor,edgeIdAccessor:zr.edgeIdAccessor,childrenAccessor:zr.childrenAccessor,hierarchySum:zr.hierarchySum,orientation:zr.orientation,nodeAlign:zr.nodeAlign,nodePaddingRatio:zr.nodePaddingRatio,nodeWidth:zr.nodeWidth,iterations:zr.iterations,forceStrength:zr.forceStrength,padAngle:zr.padAngle,groupWidth:zr.groupWidth,sortGroups:zr.sortGroups,edgeSort:zr.edgeSort,treeOrientation:zr.treeOrientation,edgeType:zr.edgeType,padding:zr.padding,paddingTop:zr.paddingTop,random:zr.random,seed:zr.seed,tensionConfig:zr.tensionConfig,customNetworkLayout:zr.customNetworkLayout,orbitMode:zr.orbitMode,orbitSize:zr.orbitSize,orbitEccentricity:zr.orbitEccentricity});var zr;const Fr=Ge(0),Br=Ge(0),Yr=Ge(!1),Or=Ge(null);Or.current||(Or.current=new gn(Wr));const Xr=Ye("StreamNetworkFrame"),jr=Ke((e,t,r=!1)=>De(Xr.current,e,()=>e.buildScene(t),r),[Xr]),[Hr,Gr]=qe(null),[qr,Vr]=qe(0),[Qr,Kr]=qe(0),[Zr,Ur]=qe(!1),[Jr,en]=qe(!1),tn=Ge(0),rn=Ge(null),nn=Ge(!1),on=Ge(ee);on.current=ee;const an=Ge(Wr);an.current=Wr;const sn=Ge(null),cn=Ge({nodes:!1,edges:!1}),ln=Ge(new Map),un=Ge(0),dn=Ke(e=>function(e){const{node:t,colorBy:r,colorScheme:n,nodeColorMap:o,colorIndexRef:i}=e;if("function"==typeof r)return r(t)+"";if("string"==typeof r&&t.data){const e=t.data[r];if(void 0!==e){if(!o.has(e+"")){const t=Array.isArray(n)?n:O;o.set(e+"",t[i.current++%t.length])}return o.get(e+"")}}if(o.has(t.id))return o.get(t.id);const a=Array.isArray(n)?n:O,s=r?a[i.current++%a.length]:a[0];return o.set(t.id,s),s}({node:e,colorBy:Ne,colorScheme:Ce,nodeColorMap:ln.current,colorIndexRef:un}),[Ne,Ce]),hn=Ke(e=>{un.current=function(e){const{sceneNodes:t,nodes:r,nodeColorMap:n,colorScheme:o}=e;for(const e of t)e.id&&"string"==typeof e.style?.fill&&n.set(e.id,e.style.fill);const i=Array.isArray(o)?o:O,a=Array.from(r);for(let e=0;a.length>e;e++){const t=a[e];n.has(t.id)||n.set(t.id,i[e%i.length])}return a.length}({sceneNodes:e.sceneNodes,nodes:e.nodes.values(),nodeColorMap:ln.current,colorScheme:Ce})},[Ce]),yn=Ke((e,t)=>{jr(e,t),hn(e),oo(cn.current,e.sceneNodes,e.sceneEdges),cr.current=!1,e.markStylePaintPending()},[jr,hn]),fn=Ke(()=>{Or.current?.markStylePaintPending()},[]),{canvasRef:pn,resolutionDirtyRef:mn}=Fe(lr,{hydrated:Dr,wasHydratingFromSSR:Rr,storeRef:Or,dirtyRef:cr,skipInitialCanvasPaintInvalidation:!0,canvasPaintInvalidator:fn,maxDevicePixelRatio:dt,canvasPaintDependencies:[o,fr,gr,ut,Tt,Ae,_r]}),vn=(xn=wr,xn?.colors?.border||xn?.colors?.secondary||xn?.colors?.primary||"#999");var xn;const kn=Ke(e=>function(e,t){return e?"object"==typeof e?e:t?.get(e)??null:null}(e,Or.current?.nodes),[]),bn=Ke(e=>function(e){const{edge:t,edgeColorBy:r,getNodeColor:n,resolveEndpoint:o,fallback:i}=e;if("function"==typeof r)return r(t);const a=o(t.source),s=o(t.target);return"target"===r&&s?n(s):a?n(a):i}({edge:e,edgeColorBy:Ie,getNodeColor:dn,resolveEndpoint:kn,fallback:vn}),[Ie,dn,vn,kn]),Sn=Ke(e=>function(e){const{edge:t,particleStyleColor:r,particleColorBy:n,hasExplicitParticleColorBy:o,getEdgeColor:i,getNodeColor:a,resolveEndpoint:s,fallback:c}=e;if("function"==typeof r){const e=s(t.source);return e?r(t,e):c}if(!o)return i(t);const l=n,u=s(t.source),d=s(t.target);return"target"===l&&d?a(d):u?a(u):c}({edge:e,particleStyleColor:Cr.color,particleColorBy:Cr.colorBy,hasExplicitParticleColorBy:!!we?.colorBy,getEdgeColor:bn,getNodeColor:dn,resolveEndpoint:kn,fallback:vn}),[we?.colorBy,Cr.color,Cr.colorBy,dn,bn,vn,kn]),wn=function(e,t,r,n,o){return("sankey"===e||t)&&r||n||o}(o,!!nr,ve,!!It,Or.current?.isAnimating??!1);D(Or,Wr,cr,_r),R(Or,ar,cr,_r),Ve(()=>{const e=Or.current;e&&(yn(e,[fr,gr]),Vr(e=>e+1),_r())},[wr,fr,gr,yn,_r]);const An=Ke(()=>{const e=Or.current;if(e&&(e.runLayout([fr,gr]),yn(e,[fr,gr]),Vr(e.layoutVersion),xt)){const{nodes:t,edges:r}=e.getLayoutData();xt(t,r)}},[fr,gr,yn,xt]),En=Ge(!1),Pn=Ke((e=!1)=>!(!e&&!En.current||(En.current=!1,An(),0)),[An]),Rn=Ke(()=>Pn(!1),[Pn]),Mn=Ke(e=>{const t=Or.current;if(!t)return!1;let r=!1,n=En.current;for(const o of e)null!=o&&"object"==typeof o&&(r=!0,t.ingestEdge(o)&&(n=!0));const o=Pn(n);return r||o},[Pn]),Nn=Ke(e=>{if(null==e||"object"!=typeof e)return;const t=Or.current;t&&(t.ingestEdge(e)&&(En.current=!0),Sr.isActive?_r():Rn())},[Rn,Sr,_r]),Tn=Ke(e=>{Mn(e)&&_r()},[Mn,_r]);Ve(()=>Sr.subscribe(()=>{Sr.isActive||Rn()}),[Rn,Sr]);const Cn=Ke(()=>{En.current=!1,Or.current?.clear(),ln.current.clear(),un.current=0,Vr(Or.current?.layoutVersion??0),Gr(null),sn.current=null,cr.current=!0,_r()},[_r]),$n=Ke(()=>{const e=Or.current;e&&(e.tension+=999,Pn(!0),_r())},[Pn,_r]);Ze(n,()=>({push:Nn,pushMany:Tn,removeNode:e=>{const t=Or.current?.removeNode(e)??!1;if(t){const t=sn.current?.data?"function"==typeof f?f(sn.current.data):sn.current.data[f]:void 0;sn.current&&"node"===sn.current.nodeOrEdge&&t===e&&(sn.current=null,Gr(null)),ln.current.delete(e)}return Pn(t)&&(cr.current=!0,_r()),t},removeEdge:(e,t)=>{const r=Or.current?.removeEdge(e,t)??!1;if(r&&sn.current&&"edge"===sn.current.nodeOrEdge){const r=sn.current.data;let n;n=void 0!==t?("object"==typeof r?.source?r.source.id:r?.source)===e&&("object"==typeof r?.target?r.target.id:r?.target)===t:!k||!r||("function"==typeof k?k:e=>e?.[k])(r)===e,n&&(sn.current=null,Gr(null))}return Pn(r)&&(cr.current=!0,_r()),r},updateNode:(e,t)=>{const r=Or.current?.updateNode(e,t)??null;return Pn(null!==r)&&(cr.current=!0,_r()),r},updateEdge:(e,t,r)=>{const n=Or.current?.updateEdge(e,t,r)??[];return Pn(n.length>0)&&(cr.current=!0,_r()),n},clear:Cn,getTopology:()=>(Rn(),Or.current?.getLayoutData()??{nodes:[],edges:[]}),getCustomLayout:()=>(Rn(),Or.current?.lastCustomLayoutResult??null),getLayoutFailure:()=>(Rn(),Or.current?.lastCustomLayoutFailure??null),getTopologyDiff:()=>{Rn();const e=Or.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:$n,getTension:()=>(Rn(),Or.current?.tension??0)}),[Nn,Tn,Cn,$n,Rn,Pn,f,_r,k]);const zn=["tree","cluster","treemap","circlepack","partition","orbit"].includes(o),Bn=zn?d||(Array.isArray(u)?void 0:u):void 0;Ve(()=>{const e=Or.current;if(!e)return;const t=++tn.current;if(rn.current?.abort(),rn.current=null,zn&&Bn)En.current=!1,e.ingestHierarchy(Bn,[fr,gr]),yn(e,[fr,gr]),Vr(e.layoutVersion),en(!1),on.current?.("ready"),_r();else{const r=Mr,n=Array.isArray(Nr)?Nr:[];if(null==s&&null==u||(En.current=!1),0===r.length&&0===n.length)return null==s&&null==u||0>=e.nodes.size&&0>=e.edges.size||Cn(),en(!1),void on.current?.("ready");const i=[fr,gr],a="force"===o&&!nr&&Wn()&&!Yt&&In(Z,r.length,n.length,G);if(a&&Rr&&!nn.current&&e.sceneNodes.length>0)return nn.current=!0,en(!1),on.current?.("ready"),cr.current=!0,void _r();if(a){const o=new AbortController;rn.current=o;const a=e._lastPositionSnapshot;e.ingestBounded(r,n,i,{deferLayout:!0});const s=e.getLayoutData(),c=function(e,t,r,n,o){const i=xr(r.nodeSize,r.nodeSizeRange,e);return{kind:"frame",nodes:e.map(e=>{const t=o?.get(e.id);return{id:e.id,x:0!==e.x||0!==e.y?e.x:t?.x??0,y:0!==e.x||0!==e.y?e.y:t?.y??0,x0:0,x1:0,y0:0,y1:0,width:0,height:0,value:e.value,__forceRadius:i(e)}}),edges:t.map(e=>{const t="string"==typeof e.source?e.source:e.source.id,r="string"==typeof e.target?e.target:e.target.id,n=e.data?.weight,o="number"==typeof n&&Number.isFinite(n)?n:e.value;return{source:t,target:r,value:e.value,y0:0,y1:0,sankeyWidth:0,weight:o}}),config:{chartType:"force",iterations:r.iterations,forceStrength:r.forceStrength,seed:r.seed},size:n}}(s.nodes,s.edges,an.current,i,a);return en(!0),on.current?.("pending"),Fn(c,o.signal).then(({positions:r})=>{t===tn.current&&(e.applyForceLayoutPositions(r,i),yn(e,i),en(!1),on.current?.("ready"),Vr(e.layoutVersion),_r())}).catch(r=>{"AbortError"!==r.name&&t===tn.current&&(e.runLayout(i),yn(e,i),en(!1),on.current?.("error"),Vr(e.layoutVersion),_r())}),()=>o.abort()}e.ingestBounded(r,n,i),yn(e,i),Vr(e.layoutVersion),en(!1),on.current?.("ready"),_r()}},[Mr,Nr,s,u,d,Bn,zn,fr,gr,$r,Z,G,Rr,o,nr,Yt,_r,Cn,yn]);const Yn=He.useRef(!1);Ve(()=>{Yn.current||y&&y.length>0&&(Yn.current=!0,Tn(y))},[y,Tn]);const{customHoverBehavior:On,customClickBehavior:jn}=function({customHoverBehavior:e,customClickBehavior:t,onObservation:r,chartId:n}){return{customHoverBehavior:ro((t,o)=>{e?.(t,o),se({onObservation:r,datum:t?t.data||t:null,x:t?.x,y:t?.y,chartType:no,chartId:n,context:o})},[e,r,n]),customClickBehavior:ro((e,o)=>{t?.(e,o),ae({onObservation:r,datum:e?e.data||e:null,x:e?.x,y:e?.y,chartType:no,chartId:n,context:o})},[t,r,n])}}({customHoverBehavior:ft,customClickBehavior:gt,onObservation:pt,chartId:vt}),{hoverHandlerRef:Qn,hoverLeaveRef:Kn,onPointerMove:Zn,onPointerLeave:Un,pointerStateRef:Jn}=lr,eo=()=>!nr||(Or.current?.hasCustomRestyle??!1);Qn.current=e=>{const t=eo(),r=pn.current;if(!r)return;const n=Or.current;if(!n)return void Te(r);const o=to({clientX:e.clientX,clientY:e.clientY,canvasRect:r.getBoundingClientRect(),margin:yr,adjustedWidth:fr,adjustedHeight:gr,sceneNodes:n.sceneNodes,sceneEdges:n.sceneEdges,nodeQuadtree:n.nodeQuadtree,maxNodeRadius:n.maxNodeRadius,includeEdges:ht||cn.current.edges});Te(r,"hit"===o.kind?Me(o.mark):void 0),ht&&("hit"===o.kind?(sn.current=o.hover,Gr(o.hover),On?.(o.hover),t&&_r()):sn.current&&(sn.current=null,Gr(null),On?.(null),t&&_r()))},Kn.current=()=>{if(Te(pn.current),sn.current){const e=eo();sn.current=null,Gr(null),On?.(null),e&&_r()}};const co=Ge(()=>{});co.current=e=>{if(de(e.target))return;if(!gt&&!pt)return;const t=pn.current;if(!t)return;const r=Or.current;if(!r)return;const n=to({clientX:e.clientX,clientY:e.clientY,canvasRect:t.getBoundingClientRect(),margin:yr,adjustedWidth:fr,adjustedHeight:gr,sceneNodes:r.sceneNodes,sceneEdges:r.sceneEdges,nodeQuadtree:r.nodeQuadtree,maxNodeRadius:r.maxNodeRadius});"hit"===n.kind?jn(n.hover,{type:"activate",inputType:xe(e.nativeEvent.pointerType)}):"miss"===n.kind&&jn(null)};const lo=Ke(e=>co.current(e),[]),uo=Ge(-1),ho=Ge(null),yo=Ge(-1),fo=Ke(e=>{if(he(e))return;const t=Or.current;if(!t)return;const r=()=>{uo.current=-1,ho.current=null,yo.current=-1,sn.current=null,Gr(null),On?.(null),_r()},n=h(t.sceneNodes);if(0===n.length)return void(0>uo.current||r());const o=c(n);let i=uo.current;if(o.flat.length>i||(r(),i=-1)," "===e.key&&i>=0){e.preventDefault();const t=o.flat[i];return void jn?.(J(t.datum||{},t.x,t.y,{nodeOrEdge:"node"}),{type:"activate",inputType:"keyboard"})}if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown","Enter"].includes(e.key))return;e.preventDefault(),uo.current=0,yo.current=-1;const t=o.flat[0];ho.current={shape:t.shape,w:t.w,h:t.h};const r=J(t.datum||{},t.x,t.y,{nodeOrEdge:"node"});return sn.current=r,Gr(r),On?.(r,{type:"focus",inputType:"keyboard"}),void _r()}const a=E(o,i),s=x(e.key,a,o,t.sceneEdges??[],yo);if(null===s)return;if(e.preventDefault(),0>s)return void r();uo.current=s;const l=o.flat[s];ho.current={shape:l.shape,w:l.w,h:l.h};const u={data:l.datum||{},x:l.x,y:l.y,__semioticHoverData:!0,nodeOrEdge:"node"};sn.current=u,Gr(u),On?.(u,{type:"focus",inputType:"keyboard"}),_r()},[jn,On,_r]),go=Ke(e=>{P(Jn,e,ht,cn.current.nodes||cn.current.edges,pn.current,"mouse")&&(uo.current=-1,ho.current=null,Zn(e))},[pn,ht,Zn,Jn]);br.current=()=>{if(kr.current=null,Rn(),!Sr.isActive)return;const e=pn.current;if(!e)return;const r=Or.current;r&&function(e){const{canvas:r,store:n,sceneRevisionDiagnostics:o,size:a,margin:s,adjustedWidth:c,adjustedHeight:l,background:u,themeBackground:d,maxDevicePixelRatio:h,renderMode:y,hasBackgroundGraphics:f=!1,dirtyRef:g,resolutionDirtyRef:p,lastFrameTimeRef:m,now:x,random:k,reducedMotion:A,showParticles:L,isContinuous:E,animate:P,decay:D,pulse:R,thresholds:M,staleness:N,particleStyle:T,getParticleColor:C,pendingAnnotationFrameRef:I,lastAnnotationFrameTimeRef:W,setAnnotationFrame:$,scheduleNextFrame:z,syncColorMap:F,onSceneOrStyleChange:B}=e,Y=r.getContext("2d");if(!Y)return;const O=m.current?Math.min((x-m.current)/1e3,.1):.016;m.current=x;const X=null!=n.transition,j=n.advanceTransition(A?x+1e6:x),H=!A&&j,G=X&&!j,q=!A&&n.tickAnimation([c,l],O),V=g.current,Q=o?.beforeCompute(n.getLastUpdateResult(),H),K=X||V||q;K&&(n.buildScene([c,l]),V&&F?.()),Q&&o?.afterCompute(Q,K,!0);const Z=L&&!A&&!!n.particlePool,U=!!D||!!R||!!M||!1!==P&&n.hasActiveTopologyDiff||n.hasActivePulses||n.hasActiveThresholds,J=n.consumeStylePaintPending();(K||J)&&B?.({inventoryChanged:V||J,geometryChanged:K});const ee=i({dirtyOrRebuilt:K,transitioning:H,animationTicked:q,continuous:Z||E,liveEncoding:U,forced:J||!0===p?.current});p&&(p.current=!1);const re=!!N&&n.lastIngestTime>0&&x-n.lastIngestTime>(N?.threshold??5e3);if(ee){const e=le(h);if(!_e(r,a,s,e))return;if(Y.clearRect(-s.left,-s.top,a[0],a[1]),b(Y,{background:u,themeBackground:d,hasBackgroundGraphics:f,x:-s.left,y:-s.top,width:a[0],height:a[1]}),D&&n.applyDecay(),R&&n.applyPulse(x),M&&n.applyThresholds(x),!1!==P&&n.applyTopologyDiff(x),re&&(Y.globalAlpha=N?.dimOpacity??.5),_({context:Y,nodes:n.sceneEdges,renderMode:y,pixelRatio:e,paintBuiltIn:e=>function(e,t){for(const r of t)switch(r.type){case"bezier":Hn(e,r);break;case"line":Gn(e,r);break;case"ribbon":qn(e,r);break;case"curved":Vn(e,r)}}(Y,e)}),_({context:Y,nodes:n.sceneNodes,renderMode:y,pixelRatio:e,paintBuiltIn:e=>{const r=e;!function(e,t){for(const r of t){if("rect"!==r.type)continue;const t=r;t.w>0&&t.h>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),ke(e,t.style,"#007bff",()=>e.fillRect(t.x,t.y,t.w,t.h)),be(e,t.style,()=>e.strokeRect(t.x,t.y,t.w,t.h)),w(e,t),e.restore())}}(Y,r),function(e,t){for(const r of t){if("circle"!==r.type)continue;const t=r;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),ke(e,t.style,"#007bff",()=>e.fill()),be(e,t.style,()=>e.stroke()),S(e,t),e.restore())}}(Y,r),function(e,t){for(const r of t){if("arc"!==r.type)continue;const t=r;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(),ke(e,t.style,"#007bff",()=>e.fill()),be(e,t.style,()=>e.stroke()),e.restore()}}(Y,r),t(Y,r),v(Y,r)}}),Z&&!re){const e=n.edgesArray;if(e.length>0){!function(e,t,r,n,o=Math.random){const i=n.spawnRate??.1,a=n.maxPerEdge??50;for(let n=0;t.length>n;n++){const s=t[n];if(!s.bezier)continue;if(e.countForEdge(n)>=a)continue;const c=s.value*i*r*(s.bezier.circular?.3:1),l=Math.floor(c),u=c-l;let d=l;o()<u&&d++;for(let t=0;d>t&&e.countForEdge(n)<a;t++)e.spawn(n,o)}}(n.particlePool,e,O,T,k);const t=.5*(T.speedMultiplier??1);let r;if(T.proportionalSpeed){const t=e.reduce((e,t)=>Math.max(e,t.value||1),1);r=e.map(e=>.3+(e.value||1)/t*1.7)}n.particlePool.step(O,t,e,r),function(e,t,r,n,o){const i=n.radius??3;e.globalAlpha=n.opacity??.7;for(let a=0;t.particles.length>a;a++){const s=t.particles[a];if(!s.active)continue;const c=r[s.edgeIndex];if(!c)continue;let l;l="string"==typeof n.color&&"inherit"!==n.color?n.color:o(c),e.fillStyle=Ee(e,l)||l,e.beginPath(),e.arc(s.x,s.y,i,0,2*Math.PI),e.fill()}e.globalAlpha=1}(Y,n.particlePool,e,T,C)}}re&&(Y.globalAlpha=1)}g.current=!1,K&&r.setAttribute("aria-label",te(n.sceneNodes?.length??0,n.sceneEdges?.length??0,"Network chart"));const ne=K||I.current;!ne||!G&&33>x-W.current?I.current=!!ne:($(e=>e+1),W.current=x,I.current=!1),(E||H||null!=n.transition||q||n.hasActivePulses||n.hasActiveThresholds||!1!==P&&n.hasActiveTopologyDiff||I.current)&&z()}({canvas:e,store:r,sceneRevisionDiagnostics:Xr.current,size:hr,margin:yr,adjustedWidth:fr,adjustedHeight:gr,background:ut,themeBackground:Er,maxDevicePixelRatio:dt,renderMode:Ae,hasBackgroundGraphics:!!Tt,dirtyRef:cr,resolutionDirtyRef:mn,lastFrameTimeRef:Fr,now:Sr.now(),random:Sr.random,reducedMotion:!!ur.current,showParticles:ve,isContinuous:wn,animate:$t,decay:Ct,pulse:It,thresholds:Ht,staleness:zt,particleStyle:Cr,getParticleColor:Sn,pendingAnnotationFrameRef:Yr,lastAnnotationFrameTimeRef:Br,setAnnotationFrame:Kr,scheduleNextFrame:()=>{_r()},syncColorMap:()=>hn(r),onSceneOrStyleChange:({inventoryChanged:t,geometryChanged:n})=>{var o;t&&(oo(cn.current,r.sceneNodes,r.sceneEdges)||Te(e)),(cn.current.nodes||cn.current.edges)&&(t||n)&&Se((o={canvas:e,pointer:Jn.current,store:r,margin:yr,width:fr,height:gr,geometryMoved:n,cursorInventory:cn.current}).canvas,o.pointer,e=>{const t=to({clientX:e.clientX,clientY:e.clientY,canvasRect:o.canvas.getBoundingClientRect(),margin:o.margin,adjustedWidth:o.width,adjustedHeight:o.height,sceneNodes:o.store.sceneNodes,sceneEdges:o.store.sceneEdges,nodeQuadtree:o.geometryMoved?null:o.store.nodeQuadtree,maxNodeRadius:o.geometryMoved?0:o.store.maxNodeRadius,includeEdges:o.cursorInventory.edges});return"hit"===t.kind?Me(t.mark):void 0})}})},$e(pn),N(zt,Or,cr,_r,Sr.now,Zr,Ur);const po=ht&&Hr?io(X,{x:Hr.x,y:Hr.y,containerWidth:fr,containerHeight:gr,margin:yr,className:"stream-network-tooltip",zIndex:2,children:yt?yt(Hr):io(Xn,{data:Hr})}):null;if(ye||!Dr&&Rr)return io(Dn,{props:r,store:Or.current,responsiveRef:dr,size:hr,margin:yr,adjustedWidth:fr,adjustedHeight:gr,surfaceBackground:Pr,resolvedBackground:Lr,resolvedForeground:Ar});const mo=Or.current;return ao("div",{ref:dr,className:"stream-network-frame"+(lt?" "+lt:""),role:"group","aria-label":qt||("string"==typeof Mt?Mt:"Network chart"),tabIndex:0,"aria-busy":Jr||void 0,style:{position:"relative",width:at?"100%":hr[0],height:st?"100%":hr[1],overflow:"visible"},onKeyDown:fo,children:["production"!==process.env.NODE_ENV&&Or.current&&io(q,{store:Or.current,diagnostics:Xr.current}),Gt&&ao(F,{accessibleTable:Gt,children:[io(Q,{tableId:vr}),io(H,{nodes:mo?.sceneNodes??[],edges:mo?.sceneEdges??[],chartType:"Network chart",tableId:vr,chartTitle:"string"==typeof Mt?Mt:void 0})]}),io(V,{summary:Vt}),io(B,{hoverPoint:Hr}),ao("div",{role:"img","aria-label":qt||("string"==typeof Mt?Mt:"Network chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:go,onMouseLeave:Un,onClick:gt||pt?lo:void 0,children:[Jr&&!1!==U&&io("div",{style:{position:"absolute",inset:0,zIndex:3,background:"var(--semiotic-bg, #fff)"},children:Le(!0,hr[0],hr[1],U)}),io(Y,{size:hr,margin:yr,backdropFill:Pr??void 0,overflowVisible:!0,children:Lr}),io("canvas",{ref:pn,"aria-label":te(mo?.sceneNodes?.length??0,mo?.sceneEdges?.length??0,"Network chart"),style:{position:"absolute",top:0,left:0}}),io(_n,{width:fr,height:gr,totalWidth:hr[0],totalHeight:hr[1],margin:yr,labels:mo?.labels||[],sceneNodes:mo?.sceneNodes,title:Mt,legend:wt,legendPosition:At,legendLayout:Lt,legendHoverBehavior:Et,legendClickBehavior:Pt,legendHighlightedCategory:Dt,legendIsolatedCategories:Rt,foregroundGraphics:l(Ar,I(Or.current?.customLayoutOverlays,ar??null)),annotations:kt,onAnnotationActivate:bt,onObservation:mt??pt,chartId:vt,chartType:"StreamNetworkFrame",autoPlaceAnnotations:_t,svgAnnotationRules:St,annotationFrame:Qr}),io(Ln,{marks:mo?.customLayoutHtmlMarks,margin:yr,selection:ar??null}),io(j,{active:uo.current>=0,hoverPoint:Hr,margin:yr,size:hr,shape:ho.current?.shape,width:ho.current?.w,height:ho.current?.h}),po,zt?.showBadge&&io(a,{isStale:Zr,position:zt.badgePosition})]})]})}));co.displayName="StreamNetworkFrame";var lo=co;export{er as buildRibbonGeometry,Mn as errorFromPayload,Nn as parseModuleWorkerErrorField,Tn as ModuleWorkerSession,Cn as createSharedWorkerSessionHolder,In as shouldUseForceWorker,Wn as canUseForceWorker,Fn as runForceLayoutWorker,lo as StreamNetworkFrame_default};