superlocalmemory 4.1.13 → 4.1.14

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 (740) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +48 -0
  3. package/README.md +3 -3
  4. package/package.json +1 -8
  5. package/plugin/.claude-plugin/plugin.json +1 -1
  6. package/plugin/CLAUDE.md +3 -3
  7. package/plugin/agents/slm-governance-advisor.md +1 -1
  8. package/plugin/agents/slm-loop-runner.md +1 -1
  9. package/plugin/agents/slm-memory-advisor.md +1 -1
  10. package/plugin/agents/slm-optimize-advisor.md +1 -1
  11. package/plugin/requirements.txt +1 -1
  12. package/plugin/skills/slm-cache/SKILL.md +1 -1
  13. package/plugin/skills/slm-compress/SKILL.md +1 -1
  14. package/plugin/skills/slm-governance/SKILL.md +1 -1
  15. package/plugin/skills/slm-graph/SKILL.md +1 -1
  16. package/plugin/skills/slm-loop/SKILL.md +1 -1
  17. package/plugin/skills/slm-mesh/SKILL.md +1 -1
  18. package/plugin/skills/slm-profile/SKILL.md +1 -1
  19. package/plugin/skills/slm-recall/SKILL.md +1 -1
  20. package/plugin/skills/slm-remember/SKILL.md +1 -1
  21. package/plugin/skills/slm-scope/SKILL.md +1 -1
  22. package/plugin/skills/slm-session/SKILL.md +1 -1
  23. package/plugin/skills/slm-status/SKILL.md +1 -1
  24. package/plugin-src/agents/slm-memory-advisor.md +1 -1
  25. package/plugin-src/agents/slm-optimize-advisor.md +1 -1
  26. package/plugin-src/rules/AGENTS.md +1 -1
  27. package/plugin-src/skills/slm-cache/SKILL.md +1 -1
  28. package/plugin-src/skills/slm-compress/SKILL.md +1 -1
  29. package/plugin-src/skills/slm-governance/SKILL.md +1 -1
  30. package/plugin-src/skills/slm-graph/SKILL.md +1 -1
  31. package/plugin-src/skills/slm-loop/SKILL.md +1 -1
  32. package/plugin-src/skills/slm-mesh/SKILL.md +1 -1
  33. package/plugin-src/skills/slm-profile/SKILL.md +1 -1
  34. package/plugin-src/skills/slm-recall/SKILL.md +1 -1
  35. package/plugin-src/skills/slm-remember/SKILL.md +1 -1
  36. package/plugin-src/skills/slm-scope/SKILL.md +1 -1
  37. package/plugin-src/skills/slm-session/SKILL.md +1 -1
  38. package/plugin-src/skills/slm-status/SKILL.md +1 -1
  39. package/scripts/postinstall.js +71 -2
  40. package/pyproject.toml +0 -250
  41. package/src/superlocalmemory/__init__.py +0 -82
  42. package/src/superlocalmemory/access/__init__.py +0 -3
  43. package/src/superlocalmemory/access/rbac.py +0 -575
  44. package/src/superlocalmemory/attribution/__init__.py +0 -9
  45. package/src/superlocalmemory/attribution/signer.py +0 -173
  46. package/src/superlocalmemory/attribution/watermark.py +0 -189
  47. package/src/superlocalmemory/brain/__init__.py +0 -5
  48. package/src/superlocalmemory/brain/truth.py +0 -418
  49. package/src/superlocalmemory/cli/__init__.py +0 -5
  50. package/src/superlocalmemory/cli/__main__.py +0 -17
  51. package/src/superlocalmemory/cli/_lazy_init.py +0 -115
  52. package/src/superlocalmemory/cli/cache_cmd.py +0 -198
  53. package/src/superlocalmemory/cli/commands.py +0 -4710
  54. package/src/superlocalmemory/cli/compress_cmd.py +0 -151
  55. package/src/superlocalmemory/cli/context_commands.py +0 -193
  56. package/src/superlocalmemory/cli/daemon.py +0 -909
  57. package/src/superlocalmemory/cli/db_migrate.py +0 -150
  58. package/src/superlocalmemory/cli/diagnostics_cmd.py +0 -101
  59. package/src/superlocalmemory/cli/escape_hatch.py +0 -220
  60. package/src/superlocalmemory/cli/evidence_cmd.py +0 -103
  61. package/src/superlocalmemory/cli/gdpr_cmd.py +0 -792
  62. package/src/superlocalmemory/cli/gdpr_io.py +0 -109
  63. package/src/superlocalmemory/cli/help_cmd.py +0 -197
  64. package/src/superlocalmemory/cli/host_upgrades.py +0 -189
  65. package/src/superlocalmemory/cli/ingest_cmd.py +0 -327
  66. package/src/superlocalmemory/cli/json_output.py +0 -81
  67. package/src/superlocalmemory/cli/loop_cmd.py +0 -187
  68. package/src/superlocalmemory/cli/main.py +0 -1145
  69. package/src/superlocalmemory/cli/mesh_cmd.py +0 -38
  70. package/src/superlocalmemory/cli/migrate_cmd.py +0 -55
  71. package/src/superlocalmemory/cli/ops_cmd.py +0 -281
  72. package/src/superlocalmemory/cli/optimize_cmd.py +0 -179
  73. package/src/superlocalmemory/cli/optimize_constants.py +0 -31
  74. package/src/superlocalmemory/cli/pending_store.py +0 -296
  75. package/src/superlocalmemory/cli/proxy_cmd.py +0 -108
  76. package/src/superlocalmemory/cli/scale_engine_cmd.py +0 -56
  77. package/src/superlocalmemory/cli/service_installer.py +0 -373
  78. package/src/superlocalmemory/cli/setup_wizard.py +0 -1162
  79. package/src/superlocalmemory/cli/summary_cmd.py +0 -215
  80. package/src/superlocalmemory/cli/version_banner.py +0 -202
  81. package/src/superlocalmemory/cli/wizard_v3426_options.py +0 -129
  82. package/src/superlocalmemory/code_graph/__init__.py +0 -46
  83. package/src/superlocalmemory/code_graph/blast_radius.py +0 -177
  84. package/src/superlocalmemory/code_graph/bridge/__init__.py +0 -36
  85. package/src/superlocalmemory/code_graph/bridge/entity_resolver.py +0 -490
  86. package/src/superlocalmemory/code_graph/bridge/event_listeners.py +0 -206
  87. package/src/superlocalmemory/code_graph/bridge/fact_enricher.py +0 -159
  88. package/src/superlocalmemory/code_graph/bridge/hebbian_linker.py +0 -170
  89. package/src/superlocalmemory/code_graph/bridge/maintenance.py +0 -220
  90. package/src/superlocalmemory/code_graph/bridge/temporal_checker.py +0 -152
  91. package/src/superlocalmemory/code_graph/changes.py +0 -363
  92. package/src/superlocalmemory/code_graph/communities.py +0 -299
  93. package/src/superlocalmemory/code_graph/config.py +0 -154
  94. package/src/superlocalmemory/code_graph/database.py +0 -526
  95. package/src/superlocalmemory/code_graph/extractors/__init__.py +0 -95
  96. package/src/superlocalmemory/code_graph/extractors/python.py +0 -413
  97. package/src/superlocalmemory/code_graph/extractors/typescript.py +0 -556
  98. package/src/superlocalmemory/code_graph/flows.py +0 -350
  99. package/src/superlocalmemory/code_graph/git_hooks.py +0 -226
  100. package/src/superlocalmemory/code_graph/graph_engine.py +0 -295
  101. package/src/superlocalmemory/code_graph/graph_store.py +0 -335
  102. package/src/superlocalmemory/code_graph/incremental.py +0 -200
  103. package/src/superlocalmemory/code_graph/models.py +0 -130
  104. package/src/superlocalmemory/code_graph/parser.py +0 -687
  105. package/src/superlocalmemory/code_graph/resolver.py +0 -321
  106. package/src/superlocalmemory/code_graph/search.py +0 -460
  107. package/src/superlocalmemory/code_graph/service.py +0 -95
  108. package/src/superlocalmemory/code_graph/watcher.py +0 -207
  109. package/src/superlocalmemory/compliance/__init__.py +0 -0
  110. package/src/superlocalmemory/compliance/abac.py +0 -204
  111. package/src/superlocalmemory/compliance/audit.py +0 -385
  112. package/src/superlocalmemory/compliance/eu_ai_act.py +0 -101
  113. package/src/superlocalmemory/compliance/gdpr.py +0 -1479
  114. package/src/superlocalmemory/compliance/lifecycle.py +0 -158
  115. package/src/superlocalmemory/compliance/retention.py +0 -415
  116. package/src/superlocalmemory/compliance/scheduler.py +0 -217
  117. package/src/superlocalmemory/contracts/__init__.py +0 -1
  118. package/src/superlocalmemory/contracts/schemas/agent-experience-v1.schema.json +0 -92
  119. package/src/superlocalmemory/contracts/schemas/agent-integration-contract-v2.schema.json +0 -46
  120. package/src/superlocalmemory/contracts/schemas/cognitive-turn-receipt-v1.schema.json +0 -59
  121. package/src/superlocalmemory/contracts/v402.py +0 -62
  122. package/src/superlocalmemory/core/__init__.py +0 -0
  123. package/src/superlocalmemory/core/actor_context.py +0 -166
  124. package/src/superlocalmemory/core/admission.py +0 -769
  125. package/src/superlocalmemory/core/backend_orchestrator.py +0 -637
  126. package/src/superlocalmemory/core/block_hygiene.py +0 -147
  127. package/src/superlocalmemory/core/community_summary.py +0 -267
  128. package/src/superlocalmemory/core/component_healer.py +0 -144
  129. package/src/superlocalmemory/core/component_registry.py +0 -514
  130. package/src/superlocalmemory/core/config.py +0 -2204
  131. package/src/superlocalmemory/core/consolidation_engine.py +0 -983
  132. package/src/superlocalmemory/core/context_cache.py +0 -574
  133. package/src/superlocalmemory/core/derivation_lineage.py +0 -246
  134. package/src/superlocalmemory/core/embedding_worker.py +0 -208
  135. package/src/superlocalmemory/core/embeddings.py +0 -1052
  136. package/src/superlocalmemory/core/engine.py +0 -1395
  137. package/src/superlocalmemory/core/engine_capabilities.py +0 -24
  138. package/src/superlocalmemory/core/engine_ingestion.py +0 -983
  139. package/src/superlocalmemory/core/engine_lock.py +0 -75
  140. package/src/superlocalmemory/core/engine_wiring.py +0 -776
  141. package/src/superlocalmemory/core/entity_community.py +0 -178
  142. package/src/superlocalmemory/core/error_envelope.py +0 -60
  143. package/src/superlocalmemory/core/evidence_bundle.py +0 -528
  144. package/src/superlocalmemory/core/fact_consolidator.py +0 -812
  145. package/src/superlocalmemory/core/file_lock.py +0 -92
  146. package/src/superlocalmemory/core/graph_analyzer.py +0 -456
  147. package/src/superlocalmemory/core/graph_metrics.py +0 -597
  148. package/src/superlocalmemory/core/graph_pruner.py +0 -939
  149. package/src/superlocalmemory/core/health_monitor.py +0 -338
  150. package/src/superlocalmemory/core/hooks.py +0 -65
  151. package/src/superlocalmemory/core/ingest_gate.py +0 -133
  152. package/src/superlocalmemory/core/ingest_policy.py +0 -38
  153. package/src/superlocalmemory/core/ingestion_command.py +0 -1042
  154. package/src/superlocalmemory/core/injection.py +0 -434
  155. package/src/superlocalmemory/core/install_detector.py +0 -131
  156. package/src/superlocalmemory/core/key_expander.py +0 -138
  157. package/src/superlocalmemory/core/lifecycle_state.py +0 -153
  158. package/src/superlocalmemory/core/maintenance.py +0 -777
  159. package/src/superlocalmemory/core/maintenance_scheduler.py +0 -507
  160. package/src/superlocalmemory/core/materialization_control.py +0 -20
  161. package/src/superlocalmemory/core/mcp_embedder_proxy.py +0 -89
  162. package/src/superlocalmemory/core/memory_health.py +0 -266
  163. package/src/superlocalmemory/core/mode_capability.py +0 -111
  164. package/src/superlocalmemory/core/modes.py +0 -168
  165. package/src/superlocalmemory/core/mutations.py +0 -688
  166. package/src/superlocalmemory/core/ollama_embedder.py +0 -266
  167. package/src/superlocalmemory/core/ollama_validator.py +0 -315
  168. package/src/superlocalmemory/core/operation_policy.py +0 -92
  169. package/src/superlocalmemory/core/operation_policy_registry.py +0 -542
  170. package/src/superlocalmemory/core/operation_request.py +0 -127
  171. package/src/superlocalmemory/core/ops_remediation.py +0 -542
  172. package/src/superlocalmemory/core/pii.py +0 -105
  173. package/src/superlocalmemory/core/platform_utils.py +0 -138
  174. package/src/superlocalmemory/core/profiles.py +0 -234
  175. package/src/superlocalmemory/core/progressive_abstraction.py +0 -208
  176. package/src/superlocalmemory/core/projection_drain.py +0 -380
  177. package/src/superlocalmemory/core/queue_consumer.py +0 -168
  178. package/src/superlocalmemory/core/ram_lock.py +0 -160
  179. package/src/superlocalmemory/core/rate_limit.py +0 -151
  180. package/src/superlocalmemory/core/recall_gate.py +0 -95
  181. package/src/superlocalmemory/core/recall_pipeline.py +0 -1337
  182. package/src/superlocalmemory/core/recall_queue.py +0 -377
  183. package/src/superlocalmemory/core/recall_worker.py +0 -414
  184. package/src/superlocalmemory/core/registry.py +0 -121
  185. package/src/superlocalmemory/core/remember_admission.py +0 -161
  186. package/src/superlocalmemory/core/remember_runtime.py +0 -1190
  187. package/src/superlocalmemory/core/remote_mode.py +0 -214
  188. package/src/superlocalmemory/core/reranker_worker.py +0 -338
  189. package/src/superlocalmemory/core/safe_fs.py +0 -108
  190. package/src/superlocalmemory/core/scale_autopromote.py +0 -196
  191. package/src/superlocalmemory/core/scale_engine.py +0 -915
  192. package/src/superlocalmemory/core/score_contract.py +0 -82
  193. package/src/superlocalmemory/core/security_primitives.py +0 -672
  194. package/src/superlocalmemory/core/session_identity.py +0 -98
  195. package/src/superlocalmemory/core/shadow_router.py +0 -319
  196. package/src/superlocalmemory/core/slm_disabled.py +0 -85
  197. package/src/superlocalmemory/core/status_contract.py +0 -108
  198. package/src/superlocalmemory/core/store_pipeline.py +0 -1404
  199. package/src/superlocalmemory/core/summarizer.py +0 -200
  200. package/src/superlocalmemory/core/tier_manager.py +0 -461
  201. package/src/superlocalmemory/core/topic_signature.py +0 -156
  202. package/src/superlocalmemory/core/transactions/__init__.py +0 -78
  203. package/src/superlocalmemory/core/transactions/concrete_owners.py +0 -604
  204. package/src/superlocalmemory/core/transactions/erasure.py +0 -825
  205. package/src/superlocalmemory/core/transactions/manifest.py +0 -255
  206. package/src/superlocalmemory/core/transactions/manifest_key.py +0 -155
  207. package/src/superlocalmemory/core/transactions/obligations.py +0 -272
  208. package/src/superlocalmemory/core/transactions/owners.py +0 -114
  209. package/src/superlocalmemory/core/transactions/reconciler.py +0 -285
  210. package/src/superlocalmemory/core/transactions/service.py +0 -330
  211. package/src/superlocalmemory/core/worker_pool.py +0 -377
  212. package/src/superlocalmemory/core/working_memory.py +0 -288
  213. package/src/superlocalmemory/dynamics/__init__.py +0 -0
  214. package/src/superlocalmemory/dynamics/activation_guided_quantization.py +0 -374
  215. package/src/superlocalmemory/dynamics/eap_scheduler.py +0 -294
  216. package/src/superlocalmemory/dynamics/ebbinghaus_langevin_coupling.py +0 -171
  217. package/src/superlocalmemory/dynamics/fisher_langevin_coupling.py +0 -227
  218. package/src/superlocalmemory/encoding/__init__.py +0 -0
  219. package/src/superlocalmemory/encoding/auto_linker.py +0 -308
  220. package/src/superlocalmemory/encoding/cognitive_consolidator.py +0 -899
  221. package/src/superlocalmemory/encoding/consolidator.py +0 -472
  222. package/src/superlocalmemory/encoding/context_generator.py +0 -175
  223. package/src/superlocalmemory/encoding/emotional.py +0 -189
  224. package/src/superlocalmemory/encoding/entity_reflexion.py +0 -200
  225. package/src/superlocalmemory/encoding/entity_resolver.py +0 -687
  226. package/src/superlocalmemory/encoding/entropy_gate.py +0 -101
  227. package/src/superlocalmemory/encoding/fact_extractor.py +0 -877
  228. package/src/superlocalmemory/encoding/foresight.py +0 -93
  229. package/src/superlocalmemory/encoding/graph_builder.py +0 -346
  230. package/src/superlocalmemory/encoding/observation_builder.py +0 -177
  231. package/src/superlocalmemory/encoding/prospective_markers.py +0 -262
  232. package/src/superlocalmemory/encoding/scene_builder.py +0 -410
  233. package/src/superlocalmemory/encoding/signal_inference.py +0 -90
  234. package/src/superlocalmemory/encoding/temporal_parser.py +0 -432
  235. package/src/superlocalmemory/encoding/temporal_validator.py +0 -572
  236. package/src/superlocalmemory/encoding/type_router.py +0 -237
  237. package/src/superlocalmemory/evaluation/__init__.py +0 -13
  238. package/src/superlocalmemory/evaluation/calibration.py +0 -308
  239. package/src/superlocalmemory/evolution/__init__.py +0 -29
  240. package/src/superlocalmemory/evolution/blind_verifier.py +0 -122
  241. package/src/superlocalmemory/evolution/budget.py +0 -356
  242. package/src/superlocalmemory/evolution/evolution_store.py +0 -619
  243. package/src/superlocalmemory/evolution/llm_dispatch.py +0 -559
  244. package/src/superlocalmemory/evolution/model_selection.py +0 -175
  245. package/src/superlocalmemory/evolution/mutation_generator.py +0 -226
  246. package/src/superlocalmemory/evolution/skill_activator.py +0 -270
  247. package/src/superlocalmemory/evolution/skill_evolver.py +0 -928
  248. package/src/superlocalmemory/evolution/triggers.py +0 -376
  249. package/src/superlocalmemory/evolution/types.py +0 -114
  250. package/src/superlocalmemory/graph/__init__.py +0 -9
  251. package/src/superlocalmemory/graph/cozo_adjacency.py +0 -122
  252. package/src/superlocalmemory/graph/cozo_backend.py +0 -751
  253. package/src/superlocalmemory/hooks/__init__.py +0 -3
  254. package/src/superlocalmemory/hooks/_outcome_common.py +0 -523
  255. package/src/superlocalmemory/hooks/adapter_base.py +0 -347
  256. package/src/superlocalmemory/hooks/antigravity_adapter.py +0 -171
  257. package/src/superlocalmemory/hooks/auto_capture.py +0 -133
  258. package/src/superlocalmemory/hooks/auto_invoker.py +0 -521
  259. package/src/superlocalmemory/hooks/auto_parameterize.py +0 -147
  260. package/src/superlocalmemory/hooks/auto_recall.py +0 -191
  261. package/src/superlocalmemory/hooks/auto_recall_hook.py +0 -251
  262. package/src/superlocalmemory/hooks/before_web_hook.py +0 -131
  263. package/src/superlocalmemory/hooks/claude_code_hooks.py +0 -637
  264. package/src/superlocalmemory/hooks/codex_assets.py +0 -251
  265. package/src/superlocalmemory/hooks/codex_hooks.py +0 -186
  266. package/src/superlocalmemory/hooks/context_payload.py +0 -311
  267. package/src/superlocalmemory/hooks/copilot_adapter.py +0 -208
  268. package/src/superlocalmemory/hooks/cross_platform_connector.py +0 -90
  269. package/src/superlocalmemory/hooks/cursor_adapter.py +0 -173
  270. package/src/superlocalmemory/hooks/hook_daemon.py +0 -295
  271. package/src/superlocalmemory/hooks/hook_handlers.py +0 -822
  272. package/src/superlocalmemory/hooks/ide_connector.py +0 -246
  273. package/src/superlocalmemory/hooks/memory_protocol.py +0 -158
  274. package/src/superlocalmemory/hooks/portable_kit.py +0 -755
  275. package/src/superlocalmemory/hooks/post_tool_async_hook.py +0 -183
  276. package/src/superlocalmemory/hooks/post_tool_outcome_hook.py +0 -351
  277. package/src/superlocalmemory/hooks/prewarm_auth.py +0 -187
  278. package/src/superlocalmemory/hooks/rules_engine.py +0 -99
  279. package/src/superlocalmemory/hooks/session_registry.py +0 -330
  280. package/src/superlocalmemory/hooks/stop_outcome_hook.py +0 -138
  281. package/src/superlocalmemory/hooks/sync_loop.py +0 -114
  282. package/src/superlocalmemory/hooks/topic_shift_hook.py +0 -302
  283. package/src/superlocalmemory/hooks/user_prompt_hook.py +0 -131
  284. package/src/superlocalmemory/hooks/user_prompt_rehash_hook.py +0 -210
  285. package/src/superlocalmemory/infra/__init__.py +0 -3
  286. package/src/superlocalmemory/infra/auth_middleware.py +0 -145
  287. package/src/superlocalmemory/infra/backup.py +0 -974
  288. package/src/superlocalmemory/infra/backup_obligations.py +0 -423
  289. package/src/superlocalmemory/infra/cache_manager.py +0 -267
  290. package/src/superlocalmemory/infra/cloud_backup.py +0 -788
  291. package/src/superlocalmemory/infra/daemon_identity.py +0 -300
  292. package/src/superlocalmemory/infra/data_root.py +0 -238
  293. package/src/superlocalmemory/infra/event_bus.py +0 -637
  294. package/src/superlocalmemory/infra/local_diagnostics.py +0 -327
  295. package/src/superlocalmemory/infra/pid_manager.py +0 -193
  296. package/src/superlocalmemory/infra/process_identity.py +0 -180
  297. package/src/superlocalmemory/infra/process_reaper.py +0 -624
  298. package/src/superlocalmemory/infra/rate_limiter.py +0 -228
  299. package/src/superlocalmemory/infra/self_heal.py +0 -401
  300. package/src/superlocalmemory/infra/version_integrity.py +0 -229
  301. package/src/superlocalmemory/ingestion/__init__.py +0 -13
  302. package/src/superlocalmemory/ingestion/adapter_manager.py +0 -255
  303. package/src/superlocalmemory/ingestion/base_adapter.py +0 -171
  304. package/src/superlocalmemory/ingestion/calendar_adapter.py +0 -349
  305. package/src/superlocalmemory/ingestion/credentials.py +0 -125
  306. package/src/superlocalmemory/ingestion/gmail_adapter.py +0 -378
  307. package/src/superlocalmemory/ingestion/parsers.py +0 -100
  308. package/src/superlocalmemory/ingestion/transcript_adapter.py +0 -161
  309. package/src/superlocalmemory/integrations/__init__.py +0 -1
  310. package/src/superlocalmemory/integrations/bounded_loops_mcp.py +0 -431
  311. package/src/superlocalmemory/integrations/bounded_loops_v051.py +0 -236
  312. package/src/superlocalmemory/learning/__init__.py +0 -0
  313. package/src/superlocalmemory/learning/adaptive.py +0 -172
  314. package/src/superlocalmemory/learning/arm_catalog.py +0 -97
  315. package/src/superlocalmemory/learning/assertion_miner.py +0 -403
  316. package/src/superlocalmemory/learning/bandit.py +0 -654
  317. package/src/superlocalmemory/learning/bandit_cache.py +0 -131
  318. package/src/superlocalmemory/learning/behavioral.py +0 -542
  319. package/src/superlocalmemory/learning/bootstrap.py +0 -298
  320. package/src/superlocalmemory/learning/consolidation_cycle.py +0 -398
  321. package/src/superlocalmemory/learning/consolidation_quantization_worker.py +0 -115
  322. package/src/superlocalmemory/learning/consolidation_worker.py +0 -261
  323. package/src/superlocalmemory/learning/cross_project.py +0 -408
  324. package/src/superlocalmemory/learning/database.py +0 -698
  325. package/src/superlocalmemory/learning/dedup_hnsw.py +0 -413
  326. package/src/superlocalmemory/learning/engagement.py +0 -487
  327. package/src/superlocalmemory/learning/engagement_features.py +0 -279
  328. package/src/superlocalmemory/learning/ensemble.py +0 -309
  329. package/src/superlocalmemory/learning/entity_compiler.py +0 -356
  330. package/src/superlocalmemory/learning/fact_outcome_joins.py +0 -207
  331. package/src/superlocalmemory/learning/features.py +0 -138
  332. package/src/superlocalmemory/learning/feedback.py +0 -724
  333. package/src/superlocalmemory/learning/forgetting_scheduler.py +0 -375
  334. package/src/superlocalmemory/learning/hnsw_dedup.py +0 -69
  335. package/src/superlocalmemory/learning/labeler.py +0 -85
  336. package/src/superlocalmemory/learning/legacy_migration.py +0 -316
  337. package/src/superlocalmemory/learning/lightgbm_subprocess.py +0 -236
  338. package/src/superlocalmemory/learning/memory_merge.py +0 -175
  339. package/src/superlocalmemory/learning/model_cache.py +0 -267
  340. package/src/superlocalmemory/learning/model_rollback.py +0 -281
  341. package/src/superlocalmemory/learning/outcome_queue.py +0 -306
  342. package/src/superlocalmemory/learning/outcomes.py +0 -286
  343. package/src/superlocalmemory/learning/pattern_miner.py +0 -465
  344. package/src/superlocalmemory/learning/pattern_miner_constants.py +0 -90
  345. package/src/superlocalmemory/learning/pcos.py +0 -291
  346. package/src/superlocalmemory/learning/project_context.py +0 -366
  347. package/src/superlocalmemory/learning/propensity.py +0 -131
  348. package/src/superlocalmemory/learning/ranker.py +0 -300
  349. package/src/superlocalmemory/learning/ranker_common.py +0 -163
  350. package/src/superlocalmemory/learning/ranker_retrain_legacy.py +0 -210
  351. package/src/superlocalmemory/learning/ranker_retrain_online.py +0 -423
  352. package/src/superlocalmemory/learning/reward.py +0 -888
  353. package/src/superlocalmemory/learning/reward_archive.py +0 -223
  354. package/src/superlocalmemory/learning/reward_boost.py +0 -211
  355. package/src/superlocalmemory/learning/reward_from_outcomes.py +0 -365
  356. package/src/superlocalmemory/learning/reward_model.py +0 -144
  357. package/src/superlocalmemory/learning/reward_proxy.py +0 -578
  358. package/src/superlocalmemory/learning/shadow_test.py +0 -524
  359. package/src/superlocalmemory/learning/signal_kinds.py +0 -79
  360. package/src/superlocalmemory/learning/signal_worker.py +0 -268
  361. package/src/superlocalmemory/learning/signals.py +0 -646
  362. package/src/superlocalmemory/learning/skill_performance_miner.py +0 -422
  363. package/src/superlocalmemory/learning/source_quality.py +0 -828
  364. package/src/superlocalmemory/learning/trigram_index.py +0 -548
  365. package/src/superlocalmemory/learning/workflows.py +0 -309
  366. package/src/superlocalmemory/llm/__init__.py +0 -0
  367. package/src/superlocalmemory/llm/backbone.py +0 -364
  368. package/src/superlocalmemory/loops/__init__.py +0 -58
  369. package/src/superlocalmemory/loops/budget.py +0 -58
  370. package/src/superlocalmemory/loops/engine.py +0 -174
  371. package/src/superlocalmemory/loops/ledger.py +0 -298
  372. package/src/superlocalmemory/loops/models.py +0 -152
  373. package/src/superlocalmemory/loops/rules.py +0 -52
  374. package/src/superlocalmemory/math/__init__.py +0 -0
  375. package/src/superlocalmemory/math/ebbinghaus.py +0 -352
  376. package/src/superlocalmemory/math/fisher.py +0 -356
  377. package/src/superlocalmemory/math/fisher_quantized.py +0 -255
  378. package/src/superlocalmemory/math/hopfield.py +0 -282
  379. package/src/superlocalmemory/math/langevin.py +0 -411
  380. package/src/superlocalmemory/math/polar_quant.py +0 -414
  381. package/src/superlocalmemory/math/qjl.py +0 -115
  382. package/src/superlocalmemory/math/sheaf.py +0 -261
  383. package/src/superlocalmemory/math/turbo_quant.py +0 -318
  384. package/src/superlocalmemory/mcp/__init__.py +0 -0
  385. package/src/superlocalmemory/mcp/_daemon_proxy.py +0 -203
  386. package/src/superlocalmemory/mcp/_pool_adapter.py +0 -181
  387. package/src/superlocalmemory/mcp/_stdin_guard.py +0 -60
  388. package/src/superlocalmemory/mcp/agent_context.py +0 -115
  389. package/src/superlocalmemory/mcp/cli_fallback.py +0 -602
  390. package/src/superlocalmemory/mcp/http_transport.py +0 -85
  391. package/src/superlocalmemory/mcp/profiles.py +0 -154
  392. package/src/superlocalmemory/mcp/resources.py +0 -281
  393. package/src/superlocalmemory/mcp/server.py +0 -480
  394. package/src/superlocalmemory/mcp/session_binding.py +0 -98
  395. package/src/superlocalmemory/mcp/shared.py +0 -112
  396. package/src/superlocalmemory/mcp/tools.py +0 -18
  397. package/src/superlocalmemory/mcp/tools_active.py +0 -958
  398. package/src/superlocalmemory/mcp/tools_brain.py +0 -298
  399. package/src/superlocalmemory/mcp/tools_code_graph.py +0 -1717
  400. package/src/superlocalmemory/mcp/tools_context.py +0 -239
  401. package/src/superlocalmemory/mcp/tools_core.py +0 -1112
  402. package/src/superlocalmemory/mcp/tools_evolution.py +0 -343
  403. package/src/superlocalmemory/mcp/tools_learning.py +0 -393
  404. package/src/superlocalmemory/mcp/tools_loops.py +0 -345
  405. package/src/superlocalmemory/mcp/tools_mesh.py +0 -429
  406. package/src/superlocalmemory/mcp/tools_ops.py +0 -115
  407. package/src/superlocalmemory/mcp/tools_optimize.py +0 -322
  408. package/src/superlocalmemory/mcp/tools_summaries.py +0 -147
  409. package/src/superlocalmemory/mcp/tools_v28.py +0 -292
  410. package/src/superlocalmemory/mcp/tools_v3.py +0 -398
  411. package/src/superlocalmemory/mcp/tools_v33.py +0 -507
  412. package/src/superlocalmemory/mesh/__init__.py +0 -12
  413. package/src/superlocalmemory/mesh/broker.py +0 -812
  414. package/src/superlocalmemory/mesh/broker_security.py +0 -470
  415. package/src/superlocalmemory/mesh/discovery.py +0 -365
  416. package/src/superlocalmemory/mesh/lock_protocol.py +0 -313
  417. package/src/superlocalmemory/mesh/node_identity.py +0 -97
  418. package/src/superlocalmemory/mesh/outbox_remote.py +0 -429
  419. package/src/superlocalmemory/mesh/remote_sync.py +0 -829
  420. package/src/superlocalmemory/mesh/state_sync.py +0 -286
  421. package/src/superlocalmemory/migrations/__init__.py +0 -5
  422. package/src/superlocalmemory/migrations/v3_4_25_to_v3_4_26.py +0 -144
  423. package/src/superlocalmemory/optimize/NOTICE +0 -6
  424. package/src/superlocalmemory/optimize/__init__.py +0 -0
  425. package/src/superlocalmemory/optimize/adapters/__init__.py +0 -68
  426. package/src/superlocalmemory/optimize/adapters/_agent_registry.py +0 -120
  427. package/src/superlocalmemory/optimize/adapters/anthropic_adapter.py +0 -112
  428. package/src/superlocalmemory/optimize/adapters/openai_adapter.py +0 -122
  429. package/src/superlocalmemory/optimize/adapters/wrap.py +0 -228
  430. package/src/superlocalmemory/optimize/cache/__init__.py +0 -31
  431. package/src/superlocalmemory/optimize/cache/boundary_store.py +0 -488
  432. package/src/superlocalmemory/optimize/cache/centroid_store.py +0 -199
  433. package/src/superlocalmemory/optimize/cache/context_key.py +0 -67
  434. package/src/superlocalmemory/optimize/cache/exact.py +0 -88
  435. package/src/superlocalmemory/optimize/cache/invalidation.py +0 -36
  436. package/src/superlocalmemory/optimize/cache/key_builder.py +0 -111
  437. package/src/superlocalmemory/optimize/cache/manager.py +0 -737
  438. package/src/superlocalmemory/optimize/cache/semantic.py +0 -637
  439. package/src/superlocalmemory/optimize/cache/stampede.py +0 -50
  440. package/src/superlocalmemory/optimize/compress/__init__.py +0 -17
  441. package/src/superlocalmemory/optimize/compress/align.py +0 -159
  442. package/src/superlocalmemory/optimize/compress/ccr.py +0 -116
  443. package/src/superlocalmemory/optimize/compress/prose_llmlingua.py +0 -71
  444. package/src/superlocalmemory/optimize/compress/router.py +0 -667
  445. package/src/superlocalmemory/optimize/config/__init__.py +0 -56
  446. package/src/superlocalmemory/optimize/config/defaults.py +0 -43
  447. package/src/superlocalmemory/optimize/config/schema.py +0 -327
  448. package/src/superlocalmemory/optimize/config/store.py +0 -270
  449. package/src/superlocalmemory/optimize/metrics/__init__.py +0 -8
  450. package/src/superlocalmemory/optimize/metrics/counters.py +0 -155
  451. package/src/superlocalmemory/optimize/metrics/estimator.py +0 -87
  452. package/src/superlocalmemory/optimize/metrics/exporters.py +0 -77
  453. package/src/superlocalmemory/optimize/metrics/persistence.py +0 -115
  454. package/src/superlocalmemory/optimize/proxy/__init__.py +0 -28
  455. package/src/superlocalmemory/optimize/proxy/_helpers.py +0 -730
  456. package/src/superlocalmemory/optimize/proxy/anthropic_surface.py +0 -375
  457. package/src/superlocalmemory/optimize/proxy/capture.py +0 -550
  458. package/src/superlocalmemory/optimize/proxy/gemini_surface.py +0 -528
  459. package/src/superlocalmemory/optimize/proxy/lifecycle.py +0 -126
  460. package/src/superlocalmemory/optimize/proxy/openai_surface.py +0 -465
  461. package/src/superlocalmemory/optimize/proxy/server.py +0 -199
  462. package/src/superlocalmemory/optimize/proxy/vertex_surface.py +0 -246
  463. package/src/superlocalmemory/optimize/storage/__init__.py +0 -0
  464. package/src/superlocalmemory/optimize/storage/db.py +0 -1185
  465. package/src/superlocalmemory/optimize/storage/schema.py +0 -205
  466. package/src/superlocalmemory/parameterization/__init__.py +0 -47
  467. package/src/superlocalmemory/parameterization/cross_project.py +0 -12
  468. package/src/superlocalmemory/parameterization/pattern_extractor.py +0 -584
  469. package/src/superlocalmemory/parameterization/pii_filter.py +0 -106
  470. package/src/superlocalmemory/parameterization/prompt_injector.py +0 -219
  471. package/src/superlocalmemory/parameterization/prompt_lifecycle.py +0 -281
  472. package/src/superlocalmemory/parameterization/soft_prompt_generator.py +0 -542
  473. package/src/superlocalmemory/parameterization/workflow_miner.py +0 -17
  474. package/src/superlocalmemory/reliability/__init__.py +0 -45
  475. package/src/superlocalmemory/reliability/join_liveness.py +0 -301
  476. package/src/superlocalmemory/reliability/prior_distance.py +0 -243
  477. package/src/superlocalmemory/retrieval/__init__.py +0 -0
  478. package/src/superlocalmemory/retrieval/agentic.py +0 -367
  479. package/src/superlocalmemory/retrieval/ann_index.py +0 -235
  480. package/src/superlocalmemory/retrieval/bm25_channel.py +0 -451
  481. package/src/superlocalmemory/retrieval/bridge_discovery.py +0 -253
  482. package/src/superlocalmemory/retrieval/channel_registry.py +0 -154
  483. package/src/superlocalmemory/retrieval/channel_status.py +0 -117
  484. package/src/superlocalmemory/retrieval/engine.py +0 -1615
  485. package/src/superlocalmemory/retrieval/entity_channel.py +0 -994
  486. package/src/superlocalmemory/retrieval/forgetting_filter.py +0 -160
  487. package/src/superlocalmemory/retrieval/fusion.py +0 -81
  488. package/src/superlocalmemory/retrieval/graph_adjacency.py +0 -219
  489. package/src/superlocalmemory/retrieval/hopfield_channel.py +0 -465
  490. package/src/superlocalmemory/retrieval/profile_channel.py +0 -105
  491. package/src/superlocalmemory/retrieval/quantization_aware_search.py +0 -147
  492. package/src/superlocalmemory/retrieval/remote_reranker.py +0 -758
  493. package/src/superlocalmemory/retrieval/reranker.py +0 -674
  494. package/src/superlocalmemory/retrieval/scope_policy.py +0 -126
  495. package/src/superlocalmemory/retrieval/semantic_channel.py +0 -638
  496. package/src/superlocalmemory/retrieval/spreading.py +0 -288
  497. package/src/superlocalmemory/retrieval/spreading_activation.py +0 -616
  498. package/src/superlocalmemory/retrieval/strategy.py +0 -248
  499. package/src/superlocalmemory/retrieval/temporal_channel.py +0 -433
  500. package/src/superlocalmemory/retrieval/temporal_frame.py +0 -102
  501. package/src/superlocalmemory/retrieval/temporal_utils.py +0 -122
  502. package/src/superlocalmemory/retrieval/temporal_validity_filter.py +0 -499
  503. package/src/superlocalmemory/retrieval/time_window.py +0 -181
  504. package/src/superlocalmemory/retrieval/vector_store.py +0 -863
  505. package/src/superlocalmemory/server/__init__.py +0 -1
  506. package/src/superlocalmemory/server/api.py +0 -310
  507. package/src/superlocalmemory/server/asset_versions.py +0 -171
  508. package/src/superlocalmemory/server/bandit_loops.py +0 -158
  509. package/src/superlocalmemory/server/config_file.py +0 -90
  510. package/src/superlocalmemory/server/consolidation_runner.py +0 -140
  511. package/src/superlocalmemory/server/egress_policy.py +0 -258
  512. package/src/superlocalmemory/server/loopback.py +0 -85
  513. package/src/superlocalmemory/server/middleware/__init__.py +0 -11
  514. package/src/superlocalmemory/server/middleware/security_headers.py +0 -144
  515. package/src/superlocalmemory/server/origin.py +0 -55
  516. package/src/superlocalmemory/server/profile_runtime.py +0 -515
  517. package/src/superlocalmemory/server/rbac_enforce.py +0 -194
  518. package/src/superlocalmemory/server/recall_health.py +0 -343
  519. package/src/superlocalmemory/server/recall_serializer.py +0 -320
  520. package/src/superlocalmemory/server/route_mutations.py +0 -104
  521. package/src/superlocalmemory/server/routes/__init__.py +0 -4
  522. package/src/superlocalmemory/server/routes/abstraction.py +0 -314
  523. package/src/superlocalmemory/server/routes/adapters.py +0 -63
  524. package/src/superlocalmemory/server/routes/agents.py +0 -303
  525. package/src/superlocalmemory/server/routes/backup.py +0 -869
  526. package/src/superlocalmemory/server/routes/behavioral.py +0 -659
  527. package/src/superlocalmemory/server/routes/brain.py +0 -1892
  528. package/src/superlocalmemory/server/routes/chat.py +0 -393
  529. package/src/superlocalmemory/server/routes/compliance.py +0 -533
  530. package/src/superlocalmemory/server/routes/config_api.py +0 -703
  531. package/src/superlocalmemory/server/routes/data_io.py +0 -329
  532. package/src/superlocalmemory/server/routes/entity.py +0 -237
  533. package/src/superlocalmemory/server/routes/events.py +0 -214
  534. package/src/superlocalmemory/server/routes/evolution.py +0 -510
  535. package/src/superlocalmemory/server/routes/helpers.py +0 -499
  536. package/src/superlocalmemory/server/routes/ingest.py +0 -137
  537. package/src/superlocalmemory/server/routes/insights.py +0 -366
  538. package/src/superlocalmemory/server/routes/learning.py +0 -834
  539. package/src/superlocalmemory/server/routes/learning_telemetry.py +0 -154
  540. package/src/superlocalmemory/server/routes/lifecycle.py +0 -184
  541. package/src/superlocalmemory/server/routes/memories.py +0 -1661
  542. package/src/superlocalmemory/server/routes/mesh.py +0 -517
  543. package/src/superlocalmemory/server/routes/mesh_lock.py +0 -54
  544. package/src/superlocalmemory/server/routes/mesh_state.py +0 -63
  545. package/src/superlocalmemory/server/routes/optimize.py +0 -197
  546. package/src/superlocalmemory/server/routes/prewarm.py +0 -173
  547. package/src/superlocalmemory/server/routes/profiles.py +0 -292
  548. package/src/superlocalmemory/server/routes/ratelimit.py +0 -132
  549. package/src/superlocalmemory/server/routes/rbac.py +0 -366
  550. package/src/superlocalmemory/server/routes/stats.py +0 -385
  551. package/src/superlocalmemory/server/routes/tiers.py +0 -222
  552. package/src/superlocalmemory/server/routes/timeline.py +0 -258
  553. package/src/superlocalmemory/server/routes/token.py +0 -90
  554. package/src/superlocalmemory/server/routes/v3_api.py +0 -3023
  555. package/src/superlocalmemory/server/routes/ws.py +0 -171
  556. package/src/superlocalmemory/server/security_middleware.py +0 -89
  557. package/src/superlocalmemory/server/ui.py +0 -354
  558. package/src/superlocalmemory/server/unified_daemon.py +0 -6326
  559. package/src/superlocalmemory/server/write_identity.py +0 -195
  560. package/src/superlocalmemory/storage/__init__.py +0 -0
  561. package/src/superlocalmemory/storage/_migration_internals.py +0 -638
  562. package/src/superlocalmemory/storage/_schema_version.py +0 -174
  563. package/src/superlocalmemory/storage/access_log.py +0 -170
  564. package/src/superlocalmemory/storage/admission_codec.py +0 -129
  565. package/src/superlocalmemory/storage/admission_journal.py +0 -843
  566. package/src/superlocalmemory/storage/agent_experience.py +0 -546
  567. package/src/superlocalmemory/storage/backup.py +0 -531
  568. package/src/superlocalmemory/storage/correction_cases.py +0 -670
  569. package/src/superlocalmemory/storage/database.py +0 -3180
  570. package/src/superlocalmemory/storage/deferred_writes.py +0 -209
  571. package/src/superlocalmemory/storage/embedding_codec.py +0 -200
  572. package/src/superlocalmemory/storage/embedding_migrator.py +0 -672
  573. package/src/superlocalmemory/storage/erasure_fence.py +0 -45
  574. package/src/superlocalmemory/storage/execution_learning.py +0 -285
  575. package/src/superlocalmemory/storage/external_evidence.py +0 -359
  576. package/src/superlocalmemory/storage/generation_fence.py +0 -63
  577. package/src/superlocalmemory/storage/lineage_retention.py +0 -236
  578. package/src/superlocalmemory/storage/logical_edges.py +0 -86
  579. package/src/superlocalmemory/storage/memory_write.py +0 -115
  580. package/src/superlocalmemory/storage/migration_runner.py +0 -895
  581. package/src/superlocalmemory/storage/migration_v33.py +0 -140
  582. package/src/superlocalmemory/storage/migrations/M001_add_signal_features_columns.py +0 -67
  583. package/src/superlocalmemory/storage/migrations/M002_model_state_history.py +0 -107
  584. package/src/superlocalmemory/storage/migrations/M003_migration_log.py +0 -38
  585. package/src/superlocalmemory/storage/migrations/M004_cross_platform_sync_log.py +0 -46
  586. package/src/superlocalmemory/storage/migrations/M005_bandit_tables.py +0 -75
  587. package/src/superlocalmemory/storage/migrations/M006_action_outcomes_reward.py +0 -75
  588. package/src/superlocalmemory/storage/migrations/M007_pending_outcomes.py +0 -63
  589. package/src/superlocalmemory/storage/migrations/M009_model_lineage.py +0 -94
  590. package/src/superlocalmemory/storage/migrations/M010_evolution_config.py +0 -80
  591. package/src/superlocalmemory/storage/migrations/M011_archive_and_merge.py +0 -87
  592. package/src/superlocalmemory/storage/migrations/M012_shadow_observations.py +0 -72
  593. package/src/superlocalmemory/storage/migrations/M013_bi_temporal_columns.py +0 -55
  594. package/src/superlocalmemory/storage/migrations/M014_v345_scale_ready.py +0 -45
  595. package/src/superlocalmemory/storage/migrations/M015_add_pinned_column.py +0 -58
  596. package/src/superlocalmemory/storage/migrations/M016_add_scope_support.py +0 -120
  597. package/src/superlocalmemory/storage/migrations/M017_ccq_scope_column.py +0 -79
  598. package/src/superlocalmemory/storage/migrations/M018_ingestion_operations.py +0 -120
  599. package/src/superlocalmemory/storage/migrations/M019_derivation_lineage.py +0 -54
  600. package/src/superlocalmemory/storage/migrations/M020_model_state_integrity.py +0 -52
  601. package/src/superlocalmemory/storage/migrations/M021_ingestion_log_profile.py +0 -108
  602. package/src/superlocalmemory/storage/migrations/M022_entity_aliases_profile.py +0 -86
  603. package/src/superlocalmemory/storage/migrations/M023_mesh_profile_isolation.py +0 -194
  604. package/src/superlocalmemory/storage/migrations/M024_rbac_users_roles.py +0 -87
  605. package/src/superlocalmemory/storage/migrations/M025_perf_indexes.py +0 -90
  606. package/src/superlocalmemory/storage/migrations/M026_rbac_memberships_fk.py +0 -136
  607. package/src/superlocalmemory/storage/migrations/M027_transferable_patterns_profile.py +0 -163
  608. package/src/superlocalmemory/storage/migrations/M028_fact_entity_associations.py +0 -305
  609. package/src/superlocalmemory/storage/migrations/M029_behavioral_history_indexes.py +0 -137
  610. package/src/superlocalmemory/storage/migrations/M030_entity_explorer_indexes.py +0 -93
  611. package/src/superlocalmemory/storage/migrations/M031_dead_letter_operations.py +0 -80
  612. package/src/superlocalmemory/storage/migrations/M032_write_coordinator_admission.py +0 -188
  613. package/src/superlocalmemory/storage/migrations/M033_projection_transactions.py +0 -148
  614. package/src/superlocalmemory/storage/migrations/M034_obligation_integrity.py +0 -58
  615. package/src/superlocalmemory/storage/migrations/M035_erasure_receipts.py +0 -113
  616. package/src/superlocalmemory/storage/migrations/M036_vector_row_map.py +0 -107
  617. package/src/superlocalmemory/storage/migrations/M037_manifest_hmac_version.py +0 -162
  618. package/src/superlocalmemory/storage/migrations/M038_learning_feedback_channel.py +0 -77
  619. package/src/superlocalmemory/storage/migrations/M039_scene_fact_members.py +0 -137
  620. package/src/superlocalmemory/storage/migrations/M040_agent_experience_receipts.py +0 -254
  621. package/src/superlocalmemory/storage/migrations/M041_external_evidence_receipts.py +0 -189
  622. package/src/superlocalmemory/storage/migrations/M042_correction_case_ledger.py +0 -245
  623. package/src/superlocalmemory/storage/migrations/M043_quarantine_display_summaries.py +0 -512
  624. package/src/superlocalmemory/storage/migrations/M044_play_carries_its_own_evidence.py +0 -127
  625. package/src/superlocalmemory/storage/migrations/M045_fact_outcome_score.py +0 -158
  626. package/src/superlocalmemory/storage/migrations/M046_prospective_memory_has_its_own_name.py +0 -620
  627. package/src/superlocalmemory/storage/migrations/M047_fisher_vectors_are_stored_like_every_other_vector.py +0 -306
  628. package/src/superlocalmemory/storage/migrations/M048_upcoming_holds_only_what_is_upcoming.py +0 -229
  629. package/src/superlocalmemory/storage/migrations/M049_a_schema_version_marker_is_one_row.py +0 -201
  630. package/src/superlocalmemory/storage/migrations/M050_execution_learning_v2.py +0 -70
  631. package/src/superlocalmemory/storage/migrations/__init__.py +0 -103
  632. package/src/superlocalmemory/storage/migrations.py +0 -333
  633. package/src/superlocalmemory/storage/models.py +0 -500
  634. package/src/superlocalmemory/storage/projection_outbox.py +0 -346
  635. package/src/superlocalmemory/storage/quantized_store.py +0 -280
  636. package/src/superlocalmemory/storage/read_connection.py +0 -115
  637. package/src/superlocalmemory/storage/retention_policy.py +0 -860
  638. package/src/superlocalmemory/storage/schema.py +0 -1108
  639. package/src/superlocalmemory/storage/schema_code_graph.py +0 -282
  640. package/src/superlocalmemory/storage/schema_v32.py +0 -382
  641. package/src/superlocalmemory/storage/schema_v3410.py +0 -159
  642. package/src/superlocalmemory/storage/schema_v3411.py +0 -149
  643. package/src/superlocalmemory/storage/schema_v343.py +0 -315
  644. package/src/superlocalmemory/storage/schema_v345.py +0 -109
  645. package/src/superlocalmemory/storage/schema_v347.py +0 -140
  646. package/src/superlocalmemory/storage/sqlite_vectors.py +0 -169
  647. package/src/superlocalmemory/storage/v2_migrator.py +0 -466
  648. package/src/superlocalmemory/storage/write_coordinator.py +0 -949
  649. package/src/superlocalmemory/storage/write_lock.py +0 -88
  650. package/src/superlocalmemory/summaries/__init__.py +0 -37
  651. package/src/superlocalmemory/summaries/base.py +0 -267
  652. package/src/superlocalmemory/summaries/daily_reflection.py +0 -340
  653. package/src/superlocalmemory/summaries/non_answer.py +0 -223
  654. package/src/superlocalmemory/summaries/project_work_log.py +0 -440
  655. package/src/superlocalmemory/summaries/session_summary.py +0 -311
  656. package/src/superlocalmemory/trust/__init__.py +0 -0
  657. package/src/superlocalmemory/trust/gate.py +0 -171
  658. package/src/superlocalmemory/trust/provenance.py +0 -124
  659. package/src/superlocalmemory/trust/scorer.py +0 -413
  660. package/src/superlocalmemory/trust/signals.py +0 -153
  661. package/src/superlocalmemory/ui/assets/slm-icon-white.svg +0 -64
  662. package/src/superlocalmemory/ui/assets/slm-icon.svg +0 -36
  663. package/src/superlocalmemory/ui/css/brain.css +0 -409
  664. package/src/superlocalmemory/ui/css/design-system.css +0 -696
  665. package/src/superlocalmemory/ui/css/legacy-dashboard.css +0 -663
  666. package/src/superlocalmemory/ui/css/neural-glass.css +0 -1599
  667. package/src/superlocalmemory/ui/css/od-bridge.css +0 -158
  668. package/src/superlocalmemory/ui/favicon.svg +0 -36
  669. package/src/superlocalmemory/ui/index.html +0 -1638
  670. package/src/superlocalmemory/ui/js/agents.js +0 -192
  671. package/src/superlocalmemory/ui/js/auto-settings.js +0 -624
  672. package/src/superlocalmemory/ui/js/brain.js +0 -1400
  673. package/src/superlocalmemory/ui/js/clusters.js +0 -326
  674. package/src/superlocalmemory/ui/js/compliance.js +0 -307
  675. package/src/superlocalmemory/ui/js/core.js +0 -566
  676. package/src/superlocalmemory/ui/js/dashboard.js +0 -503
  677. package/src/superlocalmemory/ui/js/event-delegation.js +0 -113
  678. package/src/superlocalmemory/ui/js/events.js +0 -178
  679. package/src/superlocalmemory/ui/js/fact-detail.js +0 -142
  680. package/src/superlocalmemory/ui/js/feedback.js +0 -339
  681. package/src/superlocalmemory/ui/js/graph-event-bus.js +0 -83
  682. package/src/superlocalmemory/ui/js/graph-filters.js +0 -220
  683. package/src/superlocalmemory/ui/js/graph-ui.js +0 -214
  684. package/src/superlocalmemory/ui/js/ide-status.js +0 -115
  685. package/src/superlocalmemory/ui/js/init.js +0 -54
  686. package/src/superlocalmemory/ui/js/knowledge-graph.js +0 -945
  687. package/src/superlocalmemory/ui/js/lifecycle.js +0 -387
  688. package/src/superlocalmemory/ui/js/math-health.js +0 -114
  689. package/src/superlocalmemory/ui/js/memories.js +0 -394
  690. package/src/superlocalmemory/ui/js/memory-chat.js +0 -371
  691. package/src/superlocalmemory/ui/js/memory-timeline.js +0 -265
  692. package/src/superlocalmemory/ui/js/modal.js +0 -733
  693. package/src/superlocalmemory/ui/js/ng-entities.js +0 -298
  694. package/src/superlocalmemory/ui/js/ng-health.js +0 -208
  695. package/src/superlocalmemory/ui/js/ng-ingestion.js +0 -203
  696. package/src/superlocalmemory/ui/js/ng-mesh.js +0 -374
  697. package/src/superlocalmemory/ui/js/ng-shell.js +0 -524
  698. package/src/superlocalmemory/ui/js/ng-skills.js +0 -663
  699. package/src/superlocalmemory/ui/js/od-agents.js +0 -588
  700. package/src/superlocalmemory/ui/js/od-auth-gate.js +0 -257
  701. package/src/superlocalmemory/ui/js/od-backup.js +0 -878
  702. package/src/superlocalmemory/ui/js/od-boundedloops.js +0 -324
  703. package/src/superlocalmemory/ui/js/od-brain.js +0 -1095
  704. package/src/superlocalmemory/ui/js/od-compliance-ext.js +0 -301
  705. package/src/superlocalmemory/ui/js/od-components.js +0 -147
  706. package/src/superlocalmemory/ui/js/od-entities.js +0 -622
  707. package/src/superlocalmemory/ui/js/od-graph.js +0 -776
  708. package/src/superlocalmemory/ui/js/od-health.js +0 -579
  709. package/src/superlocalmemory/ui/js/od-mcp.js +0 -508
  710. package/src/superlocalmemory/ui/js/od-memories.js +0 -1499
  711. package/src/superlocalmemory/ui/js/od-mesh.js +0 -645
  712. package/src/superlocalmemory/ui/js/od-operations.js +0 -1268
  713. package/src/superlocalmemory/ui/js/od-ops-health.js +0 -417
  714. package/src/superlocalmemory/ui/js/od-optimize.js +0 -828
  715. package/src/superlocalmemory/ui/js/od-settings.js +0 -1275
  716. package/src/superlocalmemory/ui/js/od-shell.js +0 -819
  717. package/src/superlocalmemory/ui/js/od-skills.js +0 -600
  718. package/src/superlocalmemory/ui/js/od-team.js +0 -265
  719. package/src/superlocalmemory/ui/js/optimize.js +0 -191
  720. package/src/superlocalmemory/ui/js/profiles.js +0 -362
  721. package/src/superlocalmemory/ui/js/quick-actions.js +0 -334
  722. package/src/superlocalmemory/ui/js/recall-lab.js +0 -373
  723. package/src/superlocalmemory/ui/js/search.js +0 -86
  724. package/src/superlocalmemory/ui/js/settings.js +0 -556
  725. package/src/superlocalmemory/ui/js/timeline.js +0 -62
  726. package/src/superlocalmemory/ui/js/trust-dashboard.js +0 -225
  727. package/src/superlocalmemory/ui/vendor/bootstrap-icons/bootstrap-icons.css +0 -2018
  728. package/src/superlocalmemory/ui/vendor/bootstrap-icons/fonts/bootstrap-icons.woff +0 -0
  729. package/src/superlocalmemory/ui/vendor/bootstrap-icons/fonts/bootstrap-icons.woff2 +0 -0
  730. package/src/superlocalmemory/ui/vendor/bootstrap.bundle.min.js +0 -7
  731. package/src/superlocalmemory/ui/vendor/bootstrap.min.css +0 -6
  732. package/src/superlocalmemory/ui/vendor/d3.v7.min.js +0 -2
  733. package/src/superlocalmemory/ui/vendor/graphology-library.min.js +0 -2
  734. package/src/superlocalmemory/ui/vendor/graphology.umd.min.js +0 -2
  735. package/src/superlocalmemory/ui/vendor/inter-ui/inter-variable.min.css +0 -8
  736. package/src/superlocalmemory/ui/vendor/inter-ui/variable/InterVariable-Italic.woff2 +0 -0
  737. package/src/superlocalmemory/ui/vendor/inter-ui/variable/InterVariable.woff2 +0 -0
  738. package/src/superlocalmemory/ui/vendor/sigma.min.js +0 -1
  739. package/src/superlocalmemory/vector/__init__.py +0 -9
  740. package/src/superlocalmemory/vector/lancedb_backend.py +0 -366
@@ -1,2 +0,0 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).graphologyLibrary={})}(this,(function(t){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},r={},n={},i=function(t){return null!==t&&"object"==typeof t&&"function"==typeof t.addUndirectedEdgeWithKey&&"function"==typeof t.dropNode&&"boolean"==typeof t.multi},o=function(t){return null!==t&&"function"==typeof t&&"object"==typeof t.prototype&&"function"==typeof t.prototype.addUndirectedEdgeWithKey&&"function"==typeof t.prototype.dropNode},a=function t(e,r){if(e===r)return!0;if(e&&r&&"object"==typeof e&&"object"==typeof r){if(e.constructor!==r.constructor)return!1;var n,i,o;if(Array.isArray(e)){if((n=e.length)!=r.length)return!1;for(i=n;0!=i--;)if(!t(e[i],r[i]))return!1;return!0}if(e instanceof Map&&r instanceof Map){if(e.size!==r.size)return!1;for(i of e.entries())if(!r.has(i[0]))return!1;for(i of e.entries())if(!t(i[1],r.get(i[0])))return!1;return!0}if(e instanceof Set&&r instanceof Set){if(e.size!==r.size)return!1;for(i of e.entries())if(!r.has(i[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(r)){if((n=e.length)!=r.length)return!1;for(i=n;0!=i--;)if(e[i]!==r[i])return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if((n=(o=Object.keys(e)).length)!==Object.keys(r).length)return!1;for(i=n;0!=i--;)if(!Object.prototype.hasOwnProperty.call(r,o[i]))return!1;for(i=n;0!=i--;){var a=o[i];if(!t(e[a],r[a]))return!1}return!0}return e!=e&&r!=r},s=Symbol("size");function h(t,e){var r,n,i,o,s=t.length,h=e.length;if(s!==h)return!1;var u=new Set;t:for(i=0;i<s;i++){for(r=t[i],o=0;o<h;o++)if(!u.has(o)&&(n=e[o],a(r,n))){u.add(o);continue t}return!1}return!0}function u(t,e){if(t[s]!==e[s])return!1;for(var r in t)if(!h(t[r],e[r]))return!1;return!0}function d(t,e){var r,n={};return t.forEachOutEdge(e,(function(t,e,i,o){r=n[o]||0,r++,n[o]=r})),n}function c(t,e){var r,n={};return t.forEachUndirectedEdge(e,(function(t,i,o,a){e>(a=e===o?a:o)||(r=n[a]||0,r++,n[a]=r)})),n}function l(t,e){var r,n={};return n[s]=0,t.forEachOutEdge(e,(function(t,e,i,o){(r=n[o])||(r=[],n[s]+=1,n[o]=r),r.push(e)})),n}function f(t,e){var r,n={};return n[s]=0,t.forEachUndirectedEdge(e,(function(t,i,o,a){e>(a=e===o?a:o)||((r=n[a])||(r=[],n[s]+=1,n[a]=r),r.push(i))})),n}function g(t,e,r){return e===r||e.order===r.order&&e.everyNode((function(e,n){return!!r.hasNode(e)&&(!t||a(n,r.getNodeAttributes(e)))}))}function p(t,e,r,n){if(r===n)return!0;if(e){if("directed"===r.type&&"undirected"===n.type||"undirected"===r.type&&"directed"===n.type)return!1}else if(r.type!==n.type||r.allowSelfLoops!==n.allowSelfLoops||r.multi!==n.multi)return!1;if(r.directedSize!==n.directedSize||r.undirectedSize!==n.undirectedSize)return!1;if(!g(t,r,n))return!1;var i=!1,o=!1;if(r.multi||n.multi){var s=t?l:d,h=t?u:a;if(i=r.everyNode((function(t){var e=s(r,t),i=s(n,t);return h(e,i)})),!i)return!1;if(s=t?f:c,o=r.everyNode((function(t){var e=s(r,t),i=s(n,t);return h(e,i)})),!o)return!1}else{if(!(i=r.everyDirectedEdge((function(e,i,o,s){return!!n.hasDirectedEdge(o,s)&&(!t||a(r.getDirectedEdgeAttributes(o,s),n.getDirectedEdgeAttributes(o,s)))}))))return!1;if(!(o=r.everyUndirectedEdge((function(e,i,o,s){return!!n.hasUndirectedEdge(o,s)&&(!t||a(r.getUndirectedEdgeAttributes(o,s),n.getUndirectedEdgeAttributes(o,s)))}))))return!1}return!0}n.isGraph=i,n.isGraphConstructor=o,n.haveSameNodes=g.bind(null,!1),n.haveSameNodesDeep=g.bind(null,!0),n.areSameGraphs=p.bind(null,!1,!1),n.areSameGraphsDeep=p.bind(null,!0,!1),n.haveSameEdges=p.bind(null,!1,!0),n.haveSameEdgesDeep=p.bind(null,!0,!0);var y=n,v={},m={},b={},w={};var E=function t(e,r){e=e||{};var n,i={};for(var o in r){var a=e[o],s=r[o];!(n=s)||"object"!=typeof n||"function"==typeof n||Array.isArray(n)||n instanceof Set||n instanceof Map||n instanceof RegExp||n instanceof Date?i[o]=void 0===a?s:a:i[o]=t(a,s)}return i},A={identity:function(){return Float64Array.of(1,0,0,0,1,0,0,0,1)},scale:function(t,e,r){return t[0]=e,t[4]="number"==typeof r?r:e,t},rotate:function(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=r,t[3]=-r,t[4]=n,t},translate:function(t,e,r){return t[6]=e,t[7]=r,t},multiply:function(t,e){var r=t[0],n=t[1],i=t[2],o=t[3],a=t[4],s=t[5],h=t[6],u=t[7],d=t[8],c=e[0],l=e[1],f=e[2],g=e[3],p=e[4],y=e[5],v=e[6],m=e[7],b=e[8];return t[0]=c*r+l*o+f*h,t[1]=c*n+l*a+f*u,t[2]=c*i+l*s+f*d,t[3]=g*r+p*o+y*h,t[4]=g*n+p*a+y*u,t[5]=g*i+p*s+y*d,t[6]=v*r+m*o+b*h,t[7]=v*n+m*a+b*u,t[8]=v*i+m*s+b*d,t},multiplyVec2:function(t,e){var r=t[0],n=t[1],i=t[3],o=t[4],a=t[6],s=t[7],h=e.x,u=e.y;e.x=h*r+u*i+a,e.y=h*n+u*o+s}},x=E,z=A,M=z.identity,S=z.multiply,D=z.translate,N=z.scale,k=z.rotate,C=z.multiplyVec2;var O={camera:{x:.5,y:.5,angle:0,ratio:1},padding:0};w.createGraphToViewportConversionFunction=function(t,e,r){var n=(r=x(r,O)).camera,i=t.x[1],o=t.y[1],a=t.x[0],s=t.y[0],h=i-a,u=o-s,d=e.width,c=e.height,l=Math.max(h,u)||1,f=(i+a)/2,g=(o+s)/2,p=Math.min(d,c);p-=2*r.padding;var y=function(t,e,r,n){var i=n/r,o=e/t;return i<1&&o>1||i>1&&o<1?1:Math.min(Math.max(o,1/o),Math.max(1/i,i))}(h,u,d,c),v=M();S(v,N(M(),d/2,c/2)),S(v,D(M(),1,1)),S(v,N(M(),1,-1)),S(v,N(M(),p/d*2*y,p/c*2*y)),S(v,k(M(),-n.angle)),S(v,N(M(),1/n.ratio)),S(v,D(M(),-n.x,-n.y)),S(v,D(M(),.5,.5)),S(v,N(M(),1/l)),S(v,D(M(),-f,-g));var m=function(t){return C(v,t),t},b=function(t){return m({x:t.x,y:t.y})};return b.assign=m,b};var W={};var j=function(){this.__data__=[],this.size=0};var _=function(t,e){return t===e||t!=t&&e!=e},P=_;var U=function(t,e){for(var r=t.length;r--;)if(P(t[r][0],e))return r;return-1},I=U,F=Array.prototype.splice;var T=U;var L=U;var R=U;var G=j,q=function(t){var e=this.__data__,r=I(e,t);return!(r<0)&&(r==e.length-1?e.pop():F.call(e,r,1),--this.size,!0)},B=function(t){var e=this.__data__,r=T(e,t);return r<0?void 0:e[r][1]},H=function(t){return L(this.__data__,t)>-1},V=function(t,e){var r=this.__data__,n=R(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this};function Y(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}Y.prototype.clear=G,Y.prototype.delete=q,Y.prototype.get=B,Y.prototype.has=H,Y.prototype.set=V;var K=Y,$=K;var X=function(){this.__data__=new $,this.size=0};var J=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r};var Q=function(t){return this.__data__.get(t)};var Z=function(t){return this.__data__.has(t)},tt="object"==typeof e&&e&&e.Object===Object&&e,et=tt,rt="object"==typeof self&&self&&self.Object===Object&&self,nt=et||rt||Function("return this")(),it=nt.Symbol,ot=it,at=Object.prototype,st=at.hasOwnProperty,ht=at.toString,ut=ot?ot.toStringTag:void 0;var dt=function(t){var e=st.call(t,ut),r=t[ut];try{t[ut]=void 0;var n=!0}catch(t){}var i=ht.call(t);return n&&(e?t[ut]=r:delete t[ut]),i},ct=Object.prototype.toString;var lt=dt,ft=function(t){return ct.call(t)},gt=it?it.toStringTag:void 0;var pt=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":gt&&gt in Object(t)?lt(t):ft(t)};var yt=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},vt=pt,mt=yt;var bt,wt=function(t){if(!mt(t))return!1;var e=vt(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},Et=nt["__core-js_shared__"],At=(bt=/[^.]+$/.exec(Et&&Et.keys&&Et.keys.IE_PROTO||""))?"Symbol(src)_1."+bt:"";var xt=function(t){return!!At&&At in t},zt=Function.prototype.toString;var Mt=wt,St=xt,Dt=yt,Nt=function(t){if(null!=t){try{return zt.call(t)}catch(t){}try{return t+""}catch(t){}}return""},kt=/^\[object .+?Constructor\]$/,Ct=Function.prototype,Ot=Object.prototype,Wt=Ct.toString,jt=Ot.hasOwnProperty,_t=RegExp("^"+Wt.call(jt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var Pt=function(t){return!(!Dt(t)||St(t))&&(Mt(t)?_t:kt).test(Nt(t))},Ut=function(t,e){return null==t?void 0:t[e]};var It=function(t,e){var r=Ut(t,e);return Pt(r)?r:void 0},Ft=It(nt,"Map"),Tt=It(Object,"create"),Lt=Tt;var Rt=function(){this.__data__=Lt?Lt(null):{},this.size=0};var Gt=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},qt=Tt,Bt=Object.prototype.hasOwnProperty;var Ht=function(t){var e=this.__data__;if(qt){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return Bt.call(e,t)?e[t]:void 0},Vt=Tt,Yt=Object.prototype.hasOwnProperty;var Kt=Tt;var $t=Rt,Xt=Gt,Jt=Ht,Qt=function(t){var e=this.__data__;return Vt?void 0!==e[t]:Yt.call(e,t)},Zt=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=Kt&&void 0===e?"__lodash_hash_undefined__":e,this};function te(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}te.prototype.clear=$t,te.prototype.delete=Xt,te.prototype.get=Jt,te.prototype.has=Qt,te.prototype.set=Zt;var ee=te,re=K,ne=Ft;var ie=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t};var oe=function(t,e){var r=t.__data__;return ie(e)?r["string"==typeof e?"string":"hash"]:r.map},ae=oe;var se=oe;var he=oe;var ue=oe;var de=function(){this.size=0,this.__data__={hash:new ee,map:new(ne||re),string:new ee}},ce=function(t){var e=ae(this,t).delete(t);return this.size-=e?1:0,e},le=function(t){return se(this,t).get(t)},fe=function(t){return he(this,t).has(t)},ge=function(t,e){var r=ue(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this};function pe(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}pe.prototype.clear=de,pe.prototype.delete=ce,pe.prototype.get=le,pe.prototype.has=fe,pe.prototype.set=ge;var ye=K,ve=Ft,me=pe;var be=K,we=X,Ee=J,Ae=Q,xe=Z,ze=function(t,e){var r=this.__data__;if(r instanceof ye){var n=r.__data__;if(!ve||n.length<199)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new me(n)}return r.set(t,e),this.size=r.size,this};function Me(t){var e=this.__data__=new be(t);this.size=e.size}Me.prototype.clear=we,Me.prototype.delete=Ee,Me.prototype.get=Ae,Me.prototype.has=xe,Me.prototype.set=ze;var Se=Me,De=It,Ne=function(){try{var t=De(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),ke=Ne;var Ce=function(t,e,r){"__proto__"==e&&ke?ke(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r},Oe=Ce,We=_;var je=function(t,e,r){(void 0!==r&&!We(t[e],r)||void 0===r&&!(e in t))&&Oe(t,e,r)};var _e=function(t){return function(e,r,n){for(var i=-1,o=Object(e),a=n(e),s=a.length;s--;){var h=a[t?s:++i];if(!1===r(o[h],h,o))break}return e}}(),Pe={exports:{}};!function(t,e){var r=nt,n=e&&!e.nodeType&&e,i=n&&t&&!t.nodeType&&t,o=i&&i.exports===n?r.Buffer:void 0,a=o?o.allocUnsafe:void 0;t.exports=function(t,e){if(e)return t.slice();var r=t.length,n=a?a(r):new t.constructor(r);return t.copy(n),n}}(Pe,Pe.exports);var Ue=nt.Uint8Array;var Ie=function(t){var e=new t.constructor(t.byteLength);return new Ue(e).set(new Ue(t)),e};var Fe=function(t,e){var r=e?Ie(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)};var Te=function(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e},Le=yt,Re=Object.create,Ge=function(){function t(){}return function(e){if(!Le(e))return{};if(Re)return Re(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}();var qe=function(t,e){return function(r){return t(e(r))}}(Object.getPrototypeOf,Object),Be=Object.prototype;var He=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Be)},Ve=Ge,Ye=qe,Ke=He;var $e=function(t){return"function"!=typeof t.constructor||Ke(t)?{}:Ve(Ye(t))};var Xe=function(t){return null!=t&&"object"==typeof t},Je=pt,Qe=Xe;var Ze=function(t){return Qe(t)&&"[object Arguments]"==Je(t)},tr=Xe,er=Object.prototype,rr=er.hasOwnProperty,nr=er.propertyIsEnumerable,ir=Ze(function(){return arguments}())?Ze:function(t){return tr(t)&&rr.call(t,"callee")&&!nr.call(t,"callee")},or=ir,ar=Array.isArray;var sr=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991},hr=wt,ur=sr;var dr=function(t){return null!=t&&ur(t.length)&&!hr(t)},cr=dr,lr=Xe;var fr=function(t){return lr(t)&&cr(t)},gr={exports:{}};var pr=function(){return!1};!function(t,e){var r=nt,n=pr,i=e&&!e.nodeType&&e,o=i&&t&&!t.nodeType&&t,a=o&&o.exports===i?r.Buffer:void 0,s=(a?a.isBuffer:void 0)||n;t.exports=s}(gr,gr.exports);var yr=pt,vr=qe,mr=Xe,br=Function.prototype,wr=Object.prototype,Er=br.toString,Ar=wr.hasOwnProperty,xr=Er.call(Object);var zr=function(t){if(!mr(t)||"[object Object]"!=yr(t))return!1;var e=vr(t);if(null===e)return!0;var r=Ar.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&Er.call(r)==xr},Mr=pt,Sr=sr,Dr=Xe,Nr={};Nr["[object Float32Array]"]=Nr["[object Float64Array]"]=Nr["[object Int8Array]"]=Nr["[object Int16Array]"]=Nr["[object Int32Array]"]=Nr["[object Uint8Array]"]=Nr["[object Uint8ClampedArray]"]=Nr["[object Uint16Array]"]=Nr["[object Uint32Array]"]=!0,Nr["[object Arguments]"]=Nr["[object Array]"]=Nr["[object ArrayBuffer]"]=Nr["[object Boolean]"]=Nr["[object DataView]"]=Nr["[object Date]"]=Nr["[object Error]"]=Nr["[object Function]"]=Nr["[object Map]"]=Nr["[object Number]"]=Nr["[object Object]"]=Nr["[object RegExp]"]=Nr["[object Set]"]=Nr["[object String]"]=Nr["[object WeakMap]"]=!1;var kr=function(t){return Dr(t)&&Sr(t.length)&&!!Nr[Mr(t)]};var Cr=function(t){return function(e){return t(e)}},Or={exports:{}};!function(t,e){var r=tt,n=e&&!e.nodeType&&e,i=n&&t&&!t.nodeType&&t,o=i&&i.exports===n&&r.process,a=function(){try{var t=i&&i.require&&i.require("util").types;return t||o&&o.binding&&o.binding("util")}catch(t){}}();t.exports=a}(Or,Or.exports);var Wr=kr,jr=Cr,_r=Or.exports,Pr=_r&&_r.isTypedArray,Ur=Pr?jr(Pr):Wr;var Ir=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]},Fr=Ce,Tr=_,Lr=Object.prototype.hasOwnProperty;var Rr=function(t,e,r){var n=t[e];Lr.call(t,e)&&Tr(n,r)&&(void 0!==r||e in t)||Fr(t,e,r)},Gr=Ce;var qr=function(t,e,r,n){var i=!r;r||(r={});for(var o=-1,a=e.length;++o<a;){var s=e[o],h=n?n(r[s],t[s],s,r,t):void 0;void 0===h&&(h=t[s]),i?Gr(r,s,h):Rr(r,s,h)}return r};var Br=/^(?:0|[1-9]\d*)$/;var Hr=function(t,e){var r=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==r||"symbol"!=r&&Br.test(t))&&t>-1&&t%1==0&&t<e},Vr=function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n},Yr=or,Kr=ar,$r=gr.exports,Xr=Hr,Jr=Ur,Qr=Object.prototype.hasOwnProperty;var Zr=function(t,e){var r=Kr(t),n=!r&&Yr(t),i=!r&&!n&&$r(t),o=!r&&!n&&!i&&Jr(t),a=r||n||i||o,s=a?Vr(t.length,String):[],h=s.length;for(var u in t)!e&&!Qr.call(t,u)||a&&("length"==u||i&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||Xr(u,h))||s.push(u);return s};var tn=yt,en=He,rn=function(t){var e=[];if(null!=t)for(var r in Object(t))e.push(r);return e},nn=Object.prototype.hasOwnProperty;var on=Zr,an=function(t){if(!tn(t))return rn(t);var e=en(t),r=[];for(var n in t)("constructor"!=n||!e&&nn.call(t,n))&&r.push(n);return r},sn=dr;var hn=function(t){return sn(t)?on(t,!0):an(t)},un=qr,dn=hn;var cn=je,ln=Pe.exports,fn=Fe,gn=Te,pn=$e,yn=or,vn=ar,mn=fr,bn=gr.exports,wn=wt,En=yt,An=zr,xn=Ur,zn=Ir,Mn=function(t){return un(t,dn(t))};var Sn=Se,Dn=je,Nn=_e,kn=function(t,e,r,n,i,o,a){var s=zn(t,r),h=zn(e,r),u=a.get(h);if(u)cn(t,r,u);else{var d=o?o(s,h,r+"",t,e,a):void 0,c=void 0===d;if(c){var l=vn(h),f=!l&&bn(h),g=!l&&!f&&xn(h);d=h,l||f||g?vn(s)?d=s:mn(s)?d=gn(s):f?(c=!1,d=ln(h,!0)):g?(c=!1,d=fn(h,!0)):d=[]:An(h)||yn(h)?(d=s,yn(s)?d=Mn(s):En(s)&&!wn(s)||(d=pn(h))):c=!1}c&&(a.set(h,d),i(d,h,n,o,a),a.delete(h)),cn(t,r,d)}},Cn=yt,On=hn,Wn=Ir;var jn=function t(e,r,n,i,o){e!==r&&Nn(r,(function(a,s){if(o||(o=new Sn),Cn(a))kn(e,r,s,n,t,i,o);else{var h=i?i(Wn(e,s),a,s+"",e,r,o):void 0;void 0===h&&(h=a),Dn(e,s,h)}}),On)};var _n=function(t){return t};var Pn=function(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)},Un=Math.max;var In=function(t,e,r){return e=Un(void 0===e?t.length-1:e,0),function(){for(var n=arguments,i=-1,o=Un(n.length-e,0),a=Array(o);++i<o;)a[i]=n[e+i];i=-1;for(var s=Array(e+1);++i<e;)s[i]=n[i];return s[e]=r(a),Pn(t,this,s)}};var Fn=function(t){return function(){return t}},Tn=Ne,Ln=Tn?function(t,e){return Tn(t,"toString",{configurable:!0,enumerable:!1,value:Fn(e),writable:!0})}:_n,Rn=Date.now;var Gn=function(t){var e=0,r=0;return function(){var n=Rn(),i=16-(n-r);if(r=n,i>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}},qn=Gn(Ln),Bn=_n,Hn=In,Vn=qn;var Yn=_,Kn=dr,$n=Hr,Xn=yt;var Jn=function(t,e){return Vn(Hn(t,e,Bn),t+"")},Qn=function(t,e,r){if(!Xn(r))return!1;var n=typeof e;return!!("number"==n?Kn(r)&&$n(e,r.length):"string"==n&&e in r)&&Yn(r[e],t)};var Zn=jn,ti=function(t){return Jn((function(e,r){var n=-1,i=r.length,o=i>1?r[i-1]:void 0,a=i>2?r[2]:void 0;for(o=t.length>3&&"function"==typeof o?(i--,o):void 0,a&&Qn(r[0],r[1],a)&&(o=i<3?void 0:o,i=1),e=Object(e);++n<i;){var s=r[n];s&&t(e,s,n,o)}return e}))}((function(t,e,r){Zn(t,e,r)})),ei={batchSize:500,padding:20,width:2048,height:2048,nodes:{reducer:null,defaultColor:"#999"},edges:{reducer:null,defaultColor:"#ccc"}};W.DEFAULTS=ei,W.refineSettings=function(t){var e={width:(t=t||{}).width,height:t.height};if(e.width&&!e.height&&(e.height=e.width),e.height&&!e.width&&(e.width=e.height),!(t=ti({},ei,t,e)).width&&!t.height)throw new Error("graphology-canvas: need at least a valid width or height!");return t},W.DEFAULT_NODE_REDUCER=function(t,e,r){var n={type:r.type||"circle",label:r.label||e,x:r.x,y:r.y,size:r.size||1,color:r.color||t.nodes.defaultColor};if("number"!=typeof n.x||"number"!=typeof n.y)throw new Error('graphology-canvas: the "'+e+'" node has no valid x or y position.');return n},W.DEFAULT_EDGE_REDUCER=function(t,e,r){return{type:r.type||"line",size:r.size||1,color:r.color||t.edges.defaultColor}};var ri=W,ni=w.createGraphToViewportConversionFunction;b.reduceNodes=function(t,e){var r=e.width,n=e.height,i=1/0,o=-1/0,a=1/0,s=-1/0,h={};t.forEachNode((function(t,r){"function"==typeof e.nodes.reducer&&(r=e.nodes.reducer(e,t,r)),r=ri.DEFAULT_NODE_REDUCER(e,t,r),h[t]=r;var n=r.x,u=r.y;n<i&&(i=n),n>o&&(o=n),u<a&&(a=u),u>s&&(s=u)}));var u=ni({x:[i,o],y:[a,s]},{width:r,height:n},{padding:e.padding});for(var d in h)u.assign(h[d]);return h};var ii=2*Math.PI,oi=b,ai=W,si=function(t,e,r,n){t.fillStyle=e,t.fillRect(0,0,r,n)},hi={nodes:{circle:function(t,e,r){e.fillStyle=r.color,e.beginPath(),e.arc(r.x,r.y,r.size,0,ii,!0),e.closePath(),e.fill()}},edges:{line:function(t,e,r,n,i){e.strokeStyle=r.color,e.lineWidth=r.size,e.beginPath(),e.moveTo(n.x,n.y),e.lineTo(i.x,i.y),e.stroke()}}};m.renderSync=function(t,e,r){var n,i,o,a,s=oi.reduceNodes(t,r);for(o in si(e,"white",r.width,r.height),t.forEachEdge((function(t,o,a,h){"function"==typeof r.edges.reducer&&(o=r.edges.reducer(r,t,o)),o=ai.DEFAULT_EDGE_REDUCER(r,t,o),n=s[a],i=s[h],hi.edges[o.type](r,e,o,n,i)})),s)a=s[o],hi.nodes[a.type](r,e,a)};var ui=function(t){return setTimeout(t,16)};function di(t,e,r){return t()?(e(),t()?ui((function(){di(t,e,r)})):r()):r()}"undefined"!=typeof requestAnimationFrame&&(ui=requestAnimationFrame),m.renderAsync=function(t,e,r,n){var i=oi.reduceNodes(t,r);si(e,"white",r.width,r.height);var o=t.edges(),a=0;var s=new Array(t.order),h=0;for(var u in i)s[h++]=i[u];var d=0;function c(){var t,n;for(t=Math.min(d+r.batchSize,s.length);d<t;d++)n=s[d],hi.nodes[n.type](r,e,n)}function l(){return d<s.length}di((function(){return a<o.length}),(function(){var n,s,h,u,d,c,l,f;for(n=Math.min(a+r.batchSize,o.length);a<n;a++)s=o[a],h=t.getEdgeAttributes(s),d=(u=t.extremities(s))[0],c=u[1],"function"==typeof r.edges.reducer&&(h=r.edges.reducer(r,s,h)),h=ai.DEFAULT_EDGE_REDUCER(r,s,h),l=i[d],f=i[c],hi.edges[h.type](r,e,h,l,f)}),(function(){di(l,c,(function(){return n()}))}))};var ci=i,li=m,fi=W.refineSettings;v.render=function(t,e,r){if(!ci(t))throw new Error("graphology-canvas/render: expecting a valid graphology instance.");r=fi(r),li.renderSync(t,e,r)},v.renderAsync=function(t,e,r,n){3===arguments.length&&(n=r,r={}),r=fi(r),li.renderAsync(t,e,r,n)};var gi=v,pi=i,yi=function(t){if(!pi(t))throw new Error("graphology-utils/infer-type: expecting a valid graphology instance.");var e=t.type;return"mixed"!==e?e:0===t.directedSize&&0===t.undirectedSize||t.directedSize>0&&t.undirectedSize>0?"mixed":t.directedSize>0?"directed":"undirected"};function vi(t){if("function"!=typeof t)throw new Error("obliterator/iterator: expecting a function!");this.next=t}"undefined"!=typeof Symbol&&(vi.prototype[Symbol.iterator]=function(){return this}),vi.of=function(){var t=arguments,e=t.length,r=0;return new vi((function(){return r>=e?{done:!0}:{done:!1,value:t[r++]}}))},vi.empty=function(){return new vi((function(){return{done:!0}}))},vi.fromSequence=function(t){var e=0,r=t.length;return new vi((function(){return e>=r?{done:!0}:{done:!1,value:t[e++]}}))},vi.is=function(t){return t instanceof vi||"object"==typeof t&&null!==t&&"function"==typeof t.next};var mi=vi,bi={};!function(t){var e=Math.pow(2,8)-1,r=Math.pow(2,16)-1,n=Math.pow(2,32)-1,i=Math.pow(2,7)-1,o=Math.pow(2,15)-1,a=Math.pow(2,31)-1;t.getPointerArray=function(t){var i=t-1;if(i<=e)return Uint8Array;if(i<=r)return Uint16Array;if(i<=n)return Uint32Array;throw new Error("mnemonist: Pointer Array of size > 4294967295 is not supported.")},t.getSignedPointerArray=function(t){var e=t-1;return e<=i?Int8Array:e<=o?Int16Array:e<=a?Int32Array:Float64Array},t.getNumberType=function(t){return t===(0|t)?-1===Math.sign(t)?t<=127&&t>=-128?Int8Array:t<=32767&&t>=-32768?Int16Array:Int32Array:t<=255?Uint8Array:t<=65535?Uint16Array:Uint32Array:Float64Array};var s={Uint8Array:1,Int8Array:2,Uint16Array:3,Int16Array:4,Uint32Array:5,Int32Array:6,Float32Array:7,Float64Array:8};t.getMinimalRepresentation=function(e,r){var n,i,o,a,h,u=null,d=0;for(a=0,h=e.length;a<h;a++)o=r?r(e[a]):e[a],i=t.getNumberType(o),(n=s[i.name])>d&&(d=n,u=i);return u},t.isTypedArray=function(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView(t)},t.concat=function(){var t,e,r,n=0;for(t=0,r=arguments.length;t<r;t++)n+=arguments[t].length;var i=new arguments[0].constructor(n);for(t=0,e=0;t<r;t++)i.set(arguments[t],e),e+=arguments[t].length;return i},t.indices=function(e){for(var r=new(t.getPointerArray(e))(e),n=0;n<e;n++)r[n]=n;return r}}(bi);var wi=mi,Ei=bi.getPointerArray;function Ai(t,e){arguments.length<2&&(e=t,t=Array);var r=Ei(e);this.size=0,this.length=e,this.dense=new r(e),this.sparse=new r(e),this.vals=new t(e)}Ai.prototype.clear=function(){this.size=0},Ai.prototype.has=function(t){var e=this.sparse[t];return e<this.size&&this.dense[e]===t},Ai.prototype.get=function(t){var e=this.sparse[t];if(e<this.size&&this.dense[e]===t)return this.vals[e]},Ai.prototype.set=function(t,e){var r=this.sparse[t];return r<this.size&&this.dense[r]===t?(this.vals[r]=e,this):(this.dense[this.size]=t,this.sparse[t]=this.size,this.vals[this.size]=e,this.size++,this)},Ai.prototype.delete=function(t){var e=this.sparse[t];return!(e>=this.size||this.dense[e]!==t)&&(e=this.dense[this.size-1],this.dense[this.sparse[t]]=e,this.sparse[e]=this.sparse[t],this.size--,!0)},Ai.prototype.forEach=function(t,e){e=arguments.length>1?e:this;for(var r=0;r<this.size;r++)t.call(e,this.vals[r],this.dense[r])},Ai.prototype.keys=function(){var t=this.size,e=this.dense,r=0;return new wi((function(){if(r<t){var n=e[r];return r++,{value:n}}return{done:!0}}))},Ai.prototype.values=function(){var t=this.size,e=this.vals,r=0;return new wi((function(){if(r<t){var n=e[r];return r++,{value:n}}return{done:!0}}))},Ai.prototype.entries=function(){var t=this.size,e=this.dense,r=this.vals,n=0;return new wi((function(){if(n<t){var i=[e[n],r[n]];return n++,{value:i}}return{done:!0}}))},"undefined"!=typeof Symbol&&(Ai.prototype[Symbol.iterator]=Ai.prototype.entries),Ai.prototype.inspect=function(){for(var t=new Map,e=0;e<this.size;e++)t.set(this.dense[e],this.vals[e]);return Object.defineProperty(t,"constructor",{value:Ai,enumerable:!1}),t.length=this.length,this.vals.constructor!==Array&&(t.type=this.vals.constructor.name),t},"undefined"!=typeof Symbol&&(Ai.prototype[Symbol.for("nodejs.util.inspect.custom")]=Ai.prototype.inspect);var xi=Ai,zi=mi,Mi=bi.getPointerArray;function Si(t){var e=Mi(t);this.start=0,this.size=0,this.capacity=t,this.dense=new e(t),this.sparse=new e(t)}Si.prototype.clear=function(){this.start=0,this.size=0},Si.prototype.has=function(t){if(0===this.size)return!1;var e=this.sparse[t];return(e<this.capacity&&e>=this.start&&e<this.start+this.size||e<(this.start+this.size)%this.capacity)&&this.dense[e]===t},Si.prototype.enqueue=function(t){var e=this.sparse[t];if(0!==this.size&&((e<this.capacity&&e>=this.start&&e<this.start+this.size||e<(this.start+this.size)%this.capacity)&&this.dense[e]===t))return this;return e=(this.start+this.size)%this.capacity,this.dense[e]=t,this.sparse[t]=e,this.size++,this},Si.prototype.dequeue=function(){if(0!==this.size){var t=this.start;this.size--,this.start++,this.start===this.capacity&&(this.start=0);var e=this.dense[t];return this.sparse[e]=this.capacity,e}},Si.prototype.forEach=function(t,e){e=arguments.length>1?e:this;for(var r=this.capacity,n=this.size,i=this.start,o=0;o<n;)t.call(e,this.dense[i],o,this),o++,++i===r&&(i=0)},Si.prototype.values=function(){var t=this.dense,e=this.capacity,r=this.size,n=this.start,i=0;return new zi((function(){if(i>=r)return{done:!0};var o=t[n];return n++,i++,n===e&&(n=0),{value:o,done:!1}}))},"undefined"!=typeof Symbol&&(Si.prototype[Symbol.iterator]=Si.prototype.values),Si.prototype.inspect=function(){var t=[];return this.forEach((function(e){t.push(e)})),Object.defineProperty(t,"constructor",{value:Si,enumerable:!1}),t.capacity=this.capacity,t},"undefined"!=typeof Symbol&&(Si.prototype[Symbol.for("nodejs.util.inspect.custom")]=Si.prototype.inspect);var Di=Si;function Ni(t){return function(e){return"number"!=typeof e&&(e=e.length),Math.floor(t()*e)}}var ki=Ni(Math.random);ki.createRandomIndex=Ni;var Ci=ki,Oi={},Wi={};function ji(t){return"number"!=typeof t||isNaN(t)?1:t}function _i(t,e){var r={},n=function(t){return void 0===t?e:t};"function"==typeof e&&(n=e);var i=function(e){return n(e[t])},o=function(){return n(void 0)};return"string"==typeof t?(r.fromAttributes=i,r.fromGraph=function(t,e){return i(t.getEdgeAttributes(e))},r.fromEntry=function(t,e){return i(e)},r.fromPartialEntry=r.fromEntry,r.fromMinimalEntry=r.fromEntry):"function"==typeof t?(r.fromAttributes=function(){throw new Error("graphology-utils/getters/createEdgeValueGetter: irrelevant usage.")},r.fromGraph=function(e,r){var i=e.extremities(r);return n(t(r,e.getEdgeAttributes(r),i[0],i[1],e.getNodeAttributes(i[0]),e.getNodeAttributes(i[1]),e.isUndirected(r)))},r.fromEntry=function(e,r,i,o,a,s,h){return n(t(e,r,i,o,a,s,h))},r.fromPartialEntry=function(e,r,i,o){return n(t(e,r,i,o))},r.fromMinimalEntry=function(e,r){return n(t(e,r))}):(r.fromAttributes=o,r.fromGraph=o,r.fromEntry=o,r.fromMinimalEntry=o),r}Wi.createNodeValueGetter=function(t,e){var r={},n=function(t){return void 0===t?e:t};"function"==typeof e&&(n=e);var i=function(e){return n(e[t])},o=function(){return n(void 0)};return"string"==typeof t?(r.fromAttributes=i,r.fromGraph=function(t,e){return i(t.getNodeAttributes(e))},r.fromEntry=function(t,e){return i(e)}):"function"==typeof t?(r.fromAttributes=function(){throw new Error("graphology-utils/getters/createNodeValueGetter: irrelevant usage.")},r.fromGraph=function(e,r){return n(t(r,e.getNodeAttributes(r)))},r.fromEntry=function(e,r){return n(t(e,r))}):(r.fromAttributes=o,r.fromGraph=o,r.fromEntry=o),r},Wi.createEdgeValueGetter=_i,Wi.createEdgeWeightGetter=function(t){return _i(t,ji)};var Pi=bi,Ui=E,Ii=Wi.createEdgeWeightGetter,Fi=Symbol.for("nodejs.util.inspect.custom"),Ti={getEdgeWeight:"weight",keepDendrogram:!1,resolution:1};function Li(t,e){var r=(e=Ui(e,Ti)).resolution,n=Ii(e.getEdgeWeight).fromEntry,i=2*(t.size-t.selfLoopCount),o=Pi.getPointerArray(i),a=Pi.getPointerArray(t.order+1),s=e.getEdgeWeight?Float64Array:Pi.getPointerArray(2*t.size);this.C=t.order,this.M=0,this.E=i,this.U=0,this.resolution=r,this.level=0,this.graph=t,this.nodes=new Array(t.order),this.keepDendrogram=e.keepDendrogram,this.neighborhood=new a(i),this.weights=new s(i),this.loops=new s(t.order),this.starts=new o(t.order+1),this.belongings=new a(t.order),this.dendrogram=[],this.mapping=null,this.counts=new a(t.order),this.unused=new a(t.order),this.totalWeights=new s(t.order);var h,u={},d=0,c=0,l=this;t.forEachNode((function(e){l.nodes[d]=e,u[e]=d,c+=t.undirectedDegreeWithoutSelfLoops(e),l.starts[d]=c,l.belongings[d]=d,l.counts[d]=1,d++})),t.forEachEdge((function(t,e,r,i,o,a,s){if(h=n(t,e,r,i,o,a,s),r=u[r],i=u[i],l.M+=h,r===i)l.totalWeights[r]+=2*h,l.loops[r]=2*h;else{l.totalWeights[r]+=h,l.totalWeights[i]+=h;var d=--l.starts[r],c=--l.starts[i];l.neighborhood[d]=i,l.neighborhood[c]=r,l.weights[d]=h,l.weights[c]=h}})),this.starts[d]=this.E,this.keepDendrogram?this.dendrogram.push(this.belongings.slice()):this.mapping=this.belongings.slice()}function Ri(t,e){var r=(e=Ui(e,Ti)).resolution,n=Ii(e.getEdgeWeight).fromEntry,i=2*(t.size-t.selfLoopCount),o=Pi.getPointerArray(i),a=Pi.getPointerArray(t.order+1),s=e.getEdgeWeight?Float64Array:Pi.getPointerArray(2*t.size);this.C=t.order,this.M=0,this.E=i,this.U=0,this.resolution=r,this.level=0,this.graph=t,this.nodes=new Array(t.order),this.keepDendrogram=e.keepDendrogram,this.neighborhood=new a(i),this.weights=new s(i),this.loops=new s(t.order),this.starts=new o(t.order+1),this.offsets=new o(t.order),this.belongings=new a(t.order),this.dendrogram=[],this.counts=new a(t.order),this.unused=new a(t.order),this.totalInWeights=new s(t.order),this.totalOutWeights=new s(t.order);var h,u={},d=0,c=0,l=this;t.forEachNode((function(e){l.nodes[d]=e,u[e]=d,c+=t.outDegreeWithoutSelfLoops(e),l.starts[d]=c,c+=t.inDegreeWithoutSelfLoops(e),l.offsets[d]=c,l.belongings[d]=d,l.counts[d]=1,d++})),t.forEachEdge((function(t,e,r,i,o,a,s){if(h=n(t,e,r,i,o,a,s),r=u[r],i=u[i],l.M+=h,r===i)l.loops[r]+=h,l.totalInWeights[r]+=h,l.totalOutWeights[r]+=h;else{l.totalOutWeights[r]+=h,l.totalInWeights[i]+=h;var d=--l.starts[r],c=--l.offsets[i];l.neighborhood[d]=i,l.neighborhood[c]=r,l.weights[d]=h,l.weights[c]=h}})),this.starts[d]=this.E,this.keepDendrogram?this.dendrogram.push(this.belongings.slice()):this.mapping=this.belongings.slice()}Li.prototype.isolate=function(t,e){var r=this.belongings[t];if(1===this.counts[r])return r;var n=this.unused[--this.U],i=this.loops[t];return this.totalWeights[r]-=e+i,this.totalWeights[n]+=e+i,this.belongings[t]=n,this.counts[r]--,this.counts[n]++,n},Li.prototype.move=function(t,e,r){var n=this.belongings[t],i=this.loops[t];this.totalWeights[n]-=e+i,this.totalWeights[r]+=e+i,this.belongings[t]=r;var o=1==this.counts[n]--;this.counts[r]++,o&&(this.unused[this.U++]=n)},Li.prototype.computeNodeDegree=function(t){var e,r,n=0;for(e=this.starts[t],r=this.starts[t+1];e<r;e++)n+=this.weights[e];return n},Li.prototype.expensiveIsolate=function(t){var e=this.computeNodeDegree(t);return this.isolate(t,e)},Li.prototype.expensiveMove=function(t,e){var r=this.computeNodeDegree(t);this.move(t,r,e)},Li.prototype.zoomOut=function(){var t,e,r,n,i,o,a,s,h,u,d,c=new Array(this.C-this.U),l={},f=this.nodes.length,g=0,p=0;for(t=0,r=this.C;t<r;t++)(o=this.belongings[t])in l||(l[o]=g,c[g]={adj:{},totalWeights:this.totalWeights[o],internalWeights:0},g++),this.belongings[t]=l[o];if(this.keepDendrogram){for(u=this.dendrogram[this.level],d=new(Pi.getPointerArray(g))(f),t=0;t<f;t++)d[t]=this.belongings[u[t]];this.dendrogram.push(d)}else for(t=0;t<f;t++)this.mapping[t]=this.belongings[this.mapping[t]];for(t=0,r=this.C;t<r;t++)for(h=(s=c[o=this.belongings[t]]).adj,s.internalWeights+=this.loops[t],e=this.starts[t],n=this.starts[t+1];e<n;e++)i=this.neighborhood[e],o!==(a=this.belongings[i])?(a in h||(h[a]=0),h[a]+=this.weights[e]):s.internalWeights+=this.weights[e];for(this.C=g,i=0,o=0;o<g;o++)for(a in h=(s=c[o]).adj,o=+o,this.totalWeights[o]=s.totalWeights,this.loops[o]=s.internalWeights,this.counts[o]=1,this.starts[o]=i,this.belongings[o]=o,h)this.neighborhood[i]=+a,this.weights[i]=h[a],p++,i++;return this.starts[g]=p,this.E=p,this.U=0,this.level++,l},Li.prototype.modularity=function(){var t,e,r,n,i=0,o=2*this.M,a=new Float64Array(this.C);for(e=0;e<this.C;e++)for(a[t=this.belongings[e]]+=this.loops[e],r=this.starts[e],n=this.starts[e+1];r<n;r++)t===this.belongings[this.neighborhood[r]]&&(a[t]+=this.weights[r]);for(e=0;e<this.C;e++)i+=a[e]/o-Math.pow(this.totalWeights[e]/o,2)*this.resolution;return i},Li.prototype.delta=function(t,e,r,n){var i=this.M;return r/i-this.totalWeights[n]*(e+=this.loops[t])*this.resolution/(2*i*i)},Li.prototype.deltaWithOwnCommunity=function(t,e,r,n){var i=this.M;return r/i-(this.totalWeights[n]-(e+=this.loops[t]))*e*this.resolution/(2*i*i)},Li.prototype.fastDelta=function(t,e,r,n){var i=this.M,o=this.totalWeights[n];return r-(e+=this.loops[t])*o*this.resolution/(2*i)},Li.prototype.fastDeltaWithOwnCommunity=function(t,e,r,n){var i=this.M,o=this.totalWeights[n];return r-(e+=this.loops[t])*(o-e)*this.resolution/(2*i)},Li.prototype.bounds=function(t){return[this.starts[t],this.starts[t+1]]},Li.prototype.project=function(){var t=this,e={};return t.nodes.slice(0,this.C).forEach((function(r,n){e[r]=Array.from(t.neighborhood.slice(t.starts[n],t.starts[n+1])).map((function(e){return t.nodes[e]}))})),e},Li.prototype.collect=function(t){arguments.length<1&&(t=this.level);var e,r,n={},i=this.keepDendrogram?this.dendrogram[t]:this.mapping;for(e=0,r=i.length;e<r;e++)n[this.nodes[e]]=i[e];return n},Li.prototype.assign=function(t,e){arguments.length<2&&(e=this.level);var r,n,i=this.keepDendrogram?this.dendrogram[e]:this.mapping;for(r=0,n=i.length;r<n;r++)this.graph.setNodeAttribute(this.nodes[r],t,i[r])},Li.prototype[Fi]=function(){var t={};Object.defineProperty(t,"constructor",{value:Li,enumerable:!1}),t.C=this.C,t.M=this.M,t.E=this.E,t.U=this.U,t.resolution=this.resolution,t.level=this.level,t.nodes=this.nodes,t.starts=this.starts.slice(0,t.C+1);var e=this;return["neighborhood","weights"].forEach((function(r){t[r]=e[r].slice(0,t.E)})),["counts","loops","belongings","totalWeights"].forEach((function(r){t[r]=e[r].slice(0,t.C)})),t.unused=this.unused.slice(0,this.U),this.keepDendrogram?t.dendrogram=this.dendrogram:t.mapping=this.mapping,t},Ri.prototype.bounds=Li.prototype.bounds,Ri.prototype.inBounds=function(t){return[this.offsets[t],this.starts[t+1]]},Ri.prototype.outBounds=function(t){return[this.starts[t],this.offsets[t]]},Ri.prototype.project=Li.prototype.project,Ri.prototype.projectIn=function(){var t=this,e={};return t.nodes.slice(0,this.C).forEach((function(r,n){e[r]=Array.from(t.neighborhood.slice(t.offsets[n],t.starts[n+1])).map((function(e){return t.nodes[e]}))})),e},Ri.prototype.projectOut=function(){var t=this,e={};return t.nodes.slice(0,this.C).forEach((function(r,n){e[r]=Array.from(t.neighborhood.slice(t.starts[n],t.offsets[n])).map((function(e){return t.nodes[e]}))})),e},Ri.prototype.isolate=function(t,e,r){var n=this.belongings[t];if(1===this.counts[n])return n;var i=this.unused[--this.U],o=this.loops[t];return this.totalInWeights[n]-=e+o,this.totalInWeights[i]+=e+o,this.totalOutWeights[n]-=r+o,this.totalOutWeights[i]+=r+o,this.belongings[t]=i,this.counts[n]--,this.counts[i]++,i},Ri.prototype.move=function(t,e,r,n){var i=this.belongings[t],o=this.loops[t];this.totalInWeights[i]-=e+o,this.totalInWeights[n]+=e+o,this.totalOutWeights[i]-=r+o,this.totalOutWeights[n]+=r+o,this.belongings[t]=n;var a=1==this.counts[i]--;this.counts[n]++,a&&(this.unused[this.U++]=i)},Ri.prototype.computeNodeInDegree=function(t){var e,r,n=0;for(e=this.offsets[t],r=this.starts[t+1];e<r;e++)n+=this.weights[e];return n},Ri.prototype.computeNodeOutDegree=function(t){var e,r,n=0;for(e=this.starts[t],r=this.offsets[t];e<r;e++)n+=this.weights[e];return n},Ri.prototype.expensiveMove=function(t,e){var r=this.computeNodeInDegree(t),n=this.computeNodeOutDegree(t);this.move(t,r,n,e)},Ri.prototype.zoomOut=function(){var t,e,r,n,i,o,a,s,h,u,d,c,l,f,g,p=new Array(this.C-this.U),y={},v=this.nodes.length,m=0,b=0;for(t=0,r=this.C;t<r;t++)(o=this.belongings[t])in y||(y[o]=m,p[m]={inAdj:{},outAdj:{},totalInWeights:this.totalInWeights[o],totalOutWeights:this.totalOutWeights[o],internalWeights:0},m++),this.belongings[t]=y[o];if(this.keepDendrogram){for(f=this.dendrogram[this.level],g=new(Pi.getPointerArray(m))(v),t=0;t<v;t++)g[t]=this.belongings[f[t]];this.dendrogram.push(g)}else for(t=0;t<v;t++)this.mapping[t]=this.belongings[this.mapping[t]];for(t=0,r=this.C;t<r;t++)for(o=this.belongings[t],h=this.offsets[t],c=(s=p[o]).inAdj,l=s.outAdj,s.internalWeights+=this.loops[t],e=this.starts[t],n=this.starts[t+1];e<n;e++)i=this.neighborhood[e],d=(u=e<h)?l:c,o!==(a=this.belongings[i])?(a in d||(d[a]=0),d[a]+=this.weights[e]):u&&(s.internalWeights+=this.weights[e]);for(this.C=m,i=0,o=0;o<m;o++){for(a in c=(s=p[o]).inAdj,l=s.outAdj,o=+o,this.totalInWeights[o]=s.totalInWeights,this.totalOutWeights[o]=s.totalOutWeights,this.loops[o]=s.internalWeights,this.counts[o]=1,this.starts[o]=i,this.belongings[o]=o,l)this.neighborhood[i]=+a,this.weights[i]=l[a],b++,i++;for(a in this.offsets[o]=i,c)this.neighborhood[i]=+a,this.weights[i]=c[a],b++,i++}return this.starts[m]=b,this.E=b,this.U=0,this.level++,y},Ri.prototype.modularity=function(){var t,e,r,n,i=0,o=this.M,a=new Float64Array(this.C);for(e=0;e<this.C;e++)for(a[t=this.belongings[e]]+=this.loops[e],r=this.starts[e],n=this.offsets[e];r<n;r++)t===this.belongings[this.neighborhood[r]]&&(a[t]+=this.weights[r]);for(e=0;e<this.C;e++)i+=a[e]/o-this.totalInWeights[e]*this.totalOutWeights[e]/Math.pow(o,2)*this.resolution;return i},Ri.prototype.delta=function(t,e,r,n,i){var o=this.M,a=this.totalInWeights[i],s=this.totalOutWeights[i],h=this.loops[t];return n/o-((r+=h)*a+(e+=h)*s)*this.resolution/(o*o)},Ri.prototype.deltaWithOwnCommunity=function(t,e,r,n,i){var o=this.M,a=this.totalInWeights[i],s=this.totalOutWeights[i],h=this.loops[t];return n/o-((r+=h)*(a-(e+=h))+e*(s-r))*this.resolution/(o*o)},Ri.prototype.collect=Li.prototype.collect,Ri.prototype.assign=Li.prototype.assign,Ri.prototype[Fi]=function(){var t={};Object.defineProperty(t,"constructor",{value:Ri,enumerable:!1}),t.C=this.C,t.M=this.M,t.E=this.E,t.U=this.U,t.resolution=this.resolution,t.level=this.level,t.nodes=this.nodes,t.starts=this.starts.slice(0,t.C+1);var e=this;return["neighborhood","weights"].forEach((function(r){t[r]=e[r].slice(0,t.E)})),["counts","offsets","loops","belongings","totalInWeights","totalOutWeights"].forEach((function(r){t[r]=e[r].slice(0,t.C)})),t.unused=this.unused.slice(0,this.U),this.keepDendrogram?t.dendrogram=this.dendrogram:t.mapping=this.mapping,t},Oi.UndirectedLouvainIndex=Li,Oi.DirectedLouvainIndex=Ri;var Gi=E,qi=i,Bi=yi,Hi=xi,Vi=Di,Yi=Ci.createRandomIndex,Ki=Oi,$i=Ki.UndirectedLouvainIndex,Xi=Ki.DirectedLouvainIndex,Ji={nodeCommunityAttribute:"community",getEdgeWeight:"weight",fastLocalMoves:!0,randomWalk:!0,resolution:1,rng:Math.random};function Qi(t,e,r){var n=t.get(e);void 0===n&&(n=0),n+=r,t.set(e,n)}function Zi(t,e,r,n,i){return Math.abs(n-i)<1e-10?t!==e&&r>t:n>i}function to(t,e,r){var n,i,o,a,s,h,u,d,c,l,f,g,p,y,v,m,b,w,E,A=new $i(e,{getEdgeWeight:r.getEdgeWeight,keepDendrogram:t,resolution:r.resolution}),x=Yi(r.rng),z=!0,M=!0,S=new Hi(Float64Array,A.C),D=0,N=0,k=[];for(r.fastLocalMoves&&(o=new Vi(A.C));z;){if(g=A.C,z=!1,M=!0,r.fastLocalMoves){for(E=0,d=r.randomWalk?x(g):0,c=0;c<g;c++,d++)l=d%g,o.enqueue(l);for(;0!==o.size;){for(l=o.dequeue(),N++,p=0,S.clear(),n=A.belongings[l],a=A.starts[l],s=A.starts[l+1];a<s;a++)f=A.neighborhood[a],p+=h=A.weights[a],Qi(S,i=A.belongings[f],h);for(m=A.fastDeltaWithOwnCommunity(l,p,S.get(n)||0,n),v=n,u=0;u<S.size;u++)(i=S.dense[u])!==n&&(y=S.vals[u],D++,Zi(v,n,i,b=A.fastDelta(l,p,y,i),m)&&(m=b,v=i));if(m<0){if((v=A.isolate(l,p))===n)continue}else{if(v===n)continue;A.move(l,p,v)}for(z=!0,E++,a=A.starts[l],s=A.starts[l+1];a<s;a++)f=A.neighborhood[a],(i=A.belongings[f])!==v&&o.enqueue(f)}k.push(E)}else for(w=[],k.push(w);M;){for(M=!1,E=0,d=r.randomWalk?x(g):0,c=0;c<g;c++,d++){for(l=d%g,N++,p=0,S.clear(),n=A.belongings[l],a=A.starts[l],s=A.starts[l+1];a<s;a++)f=A.neighborhood[a],p+=h=A.weights[a],Qi(S,i=A.belongings[f],h);for(m=A.fastDeltaWithOwnCommunity(l,p,S.get(n)||0,n),v=n,u=0;u<S.size;u++)(i=S.dense[u])!==n&&(y=S.vals[u],D++,Zi(v,n,i,b=A.fastDelta(l,p,y,i),m)&&(m=b,v=i));if(m<0){if((v=A.isolate(l,p))===n)continue}else{if(v===n)continue;A.move(l,p,v)}M=!0,E++}w.push(E),z=M||z}z&&A.zoomOut()}return{index:A,deltaComputations:D,nodesVisited:N,moves:k}}function eo(t,e,r){var n,i,o,a,s,h,u,d,c,l,f,g,p,y,v,m,b,w,E,A,x,z,M=new Xi(e,{getEdgeWeight:r.getEdgeWeight,keepDendrogram:t,resolution:r.resolution}),S=Yi(r.rng),D=!0,N=!0,k=new Hi(Float64Array,M.C),C=0,O=0,W=[];for(r.fastLocalMoves&&(o=new Vi(M.C));D;){if(y=M.C,D=!1,N=!0,r.fastLocalMoves){for(z=0,l=r.randomWalk?S(y):0,f=0;f<y;f++,l++)g=l%y,o.enqueue(g);for(;0!==o.size;){for(g=o.dequeue(),O++,v=0,m=0,k.clear(),n=M.belongings[g],a=M.starts[g],s=M.starts[g+1],h=M.offsets[g];a<s;a++)u=a<h,p=M.neighborhood[a],d=M.weights[a],u?m+=d:v+=d,Qi(k,i=M.belongings[p],d);for(E=M.deltaWithOwnCommunity(g,v,m,k.get(n)||0,n),w=n,c=0;c<k.size;c++)(i=k.dense[c])!==n&&(b=k.vals[c],C++,Zi(w,n,i,A=M.delta(g,v,m,b,i),E)&&(E=A,w=i));if(E<0){if((w=M.isolate(g,v,m))===n)continue}else{if(w===n)continue;M.move(g,v,m,w)}for(D=!0,z++,a=M.starts[g],s=M.starts[g+1];a<s;a++)p=M.neighborhood[a],(i=M.belongings[p])!==w&&o.enqueue(p)}W.push(z)}else for(x=[],W.push(x);N;){for(N=!1,z=0,l=r.randomWalk?S(y):0,f=0;f<y;f++,l++){for(g=l%y,O++,v=0,m=0,k.clear(),n=M.belongings[g],a=M.starts[g],s=M.starts[g+1],h=M.offsets[g];a<s;a++)u=a<h,p=M.neighborhood[a],d=M.weights[a],u?m+=d:v+=d,Qi(k,i=M.belongings[p],d);for(E=M.deltaWithOwnCommunity(g,v,m,k.get(n)||0,n),w=n,c=0;c<k.size;c++)(i=k.dense[c])!==n&&(b=k.vals[c],C++,Zi(w,n,i,A=M.delta(g,v,m,b,i),E)&&(E=A,w=i));if(E<0){if((w=M.isolate(g,v,m))===n)continue}else{if(w===n)continue;M.move(g,v,m,w)}N=!0,z++}x.push(z),D=N||D}D&&M.zoomOut()}return{index:M,deltaComputations:C,nodesVisited:O,moves:W}}function ro(t,e,r,n){if(!qi(r))throw new Error("graphology-communities-louvain: the given graph is not a valid graphology instance.");var i=Bi(r);if("mixed"===i)throw new Error("graphology-communities-louvain: cannot run the algorithm on a true mixed graph.");n=Gi(n,Ji);var o=0;if(0===r.size){if(t)return void r.forEachNode((function(t){r.setNodeAttribute(t,n.nodeCommunityAttribute,o++)}));var a={};return r.forEachNode((function(t){a[t]=o++})),e?{communities:a,count:r.order,deltaComputations:0,dendrogram:null,level:0,modularity:NaN,moves:null,nodesVisited:0,resolution:n.resolution}:a}var s=("undirected"===i?to:eo)(e,r,n),h=s.index;if(!e)return t?void h.assign(n.nodeCommunityAttribute):h.collect();var u={count:h.C,deltaComputations:s.deltaComputations,dendrogram:h.dendrogram,level:h.level,modularity:h.modularity(),moves:s.moves,nodesVisited:s.nodesVisited,resolution:n.resolution};return t?(h.assign(n.nodeCommunityAttribute),u):(u.communities=h.collect(),u)}var no=ro.bind(null,!1,!1);no.assign=ro.bind(null,!0,!1),no.detailed=ro.bind(null,!1,!0),no.defaults=Ji;var io=no,oo={},ao={copyNode:function(t,e,r){return r=Object.assign({},r),t.addNode(e,r)}},so={};function ho(t){this.graph=t,this.stack=new Array(t.order),this.seen=new Set,this.size=0}so.addEdge=function(t,e,r,n,i,o){return e?null==r?t.addUndirectedEdge(n,i,o):t.addUndirectedEdgeWithKey(r,n,i,o):null==r?t.addDirectedEdge(n,i,o):t.addDirectedEdgeWithKey(r,n,i,o)},so.copyEdge=function(t,e,r,n,i,o){return o=Object.assign({},o),e?null==r?t.addUndirectedEdge(n,i,o):t.addUndirectedEdgeWithKey(r,n,i,o):null==r?t.addDirectedEdge(n,i,o):t.addDirectedEdgeWithKey(r,n,i,o)},so.mergeEdge=function(t,e,r,n,i,o){return e?null==r?t.mergeUndirectedEdge(n,i,o):t.mergeUndirectedEdgeWithKey(r,n,i,o):null==r?t.mergeDirectedEdge(n,i,o):t.mergeDirectedEdgeWithKey(r,n,i,o)},so.updateEdge=function(t,e,r,n,i,o){return e?null==r?t.updateUndirectedEdge(n,i,o):t.updateUndirectedEdgeWithKey(r,n,i,o):null==r?t.updateDirectedEdge(n,i,o):t.updateDirectedEdgeWithKey(r,n,i,o)},ho.prototype.hasAlreadySeenEverything=function(){return this.seen.size===this.graph.order},ho.prototype.countUnseenNodes=function(){return this.graph.order-this.seen.size},ho.prototype.forEachNodeYetUnseen=function(t){var e=this.seen,r=this.graph;r.someNode((function(n,i){return e.size===r.order||!e.has(n)&&!!t(n,i)}))},ho.prototype.has=function(t){return this.seen.has(t)},ho.prototype.push=function(t){var e=this.seen.size;return this.seen.add(t),e!==this.seen.size&&(this.stack[this.size++]=t,!0)},ho.prototype.pushWith=function(t,e){var r=this.seen.size;return this.seen.add(t),r!==this.seen.size&&(this.stack[this.size++]=e,!0)},ho.prototype.pop=function(){if(0!==this.size)return this.stack[--this.size]};var uo=ho,co=i,lo=ao.copyNode,fo=so.copyEdge,go=uo;function po(t,e){if(!co(t))throw new Error("graphology-components: the given graph is not a valid graphology instance.");if(t.order){var r=new go(t),n=r.push.bind(r);r.forEachNodeYetUnseen((function(i){var o,a=[];for(r.push(i);0!==r.size;)o=r.pop(),a.push(o),t.forEachNeighbor(o,n);e(a)}))}}function yo(t,e){if(!co(t))throw new Error("graphology-components: the given graph is not a valid graphology instance.");if(t.order){var r=new go(t),n=r.push.bind(r);r.forEachNodeYetUnseen((function(i){var o,a=0;for(r.push(i);0!==r.size;)o=r.pop(),a++,t.forEachNeighbor(o,n);e(a)}))}}function vo(t){if(!co(t))throw new Error("graphology-components: the given graph is not a valid graphology instance.");if(!t.order)return[];var e,r=new go(t),n=r.push.bind(r),i=[];return r.forEachNodeYetUnseen((function(o){var a;for(e=[],r.push(o);0!==r.size;)a=r.pop(),e.push(a),t.forEachNeighbor(a,n);return e.length>i.length&&(i=e),i.length>r.countUnseenNodes()})),i}oo.forEachConnectedComponent=po,oo.forEachConnectedComponentOrder=yo,oo.forEachConnectedComponentOrderWithEdgeFilter=function(t,e,r){if(!co(t))throw new Error("graphology-components: the given graph is not a valid graphology instance.");if(t.order){var n,i=new go(t);i.forEachNodeYetUnseen((function(e){var a=0;for(i.push(e);0!==i.size;)n=i.pop(),a++,t.forEachEdge(n,o);r(a)}))}function o(t,r,o,a,s,h,u){n===a&&(a=o),e(t,r,o,a,s,h,u)&&i.push(a)}},oo.countConnectedComponents=function(t){var e=0;return yo(t,(function(){e++})),e},oo.connectedComponents=function(t){var e=[];return po(t,(function(t){e.push(t)})),e},oo.largestConnectedComponent=vo,oo.largestConnectedComponentSubgraph=function(t){var e=vo(t),r=t.nullCopy();return e.forEach((function(e){lo(r,e,t.getNodeAttributes(e))})),t.forEachEdge((function(t,e,n,i,o,a,s){r.hasNode(n)&&fo(r,s,t,n,i,e)})),r},oo.cropToLargestConnectedComponent=function(t){var e=new Set(vo(t));t.forEachNode((function(r){e.has(r)||t.dropNode(r)}))},oo.stronglyConnectedComponents=function(t){if(!co(t))throw new Error("graphology-components: the given graph is not a valid graphology instance.");if(!t.order)return[];if("undirected"===t.type)throw new Error("graphology-components: the given graph is undirected");var e,r,n=t.nodes(),i=[];if(!t.size){for(e=0,r=n.length;e<r;e++)i.push([n[e]]);return i}var o,a,s,h=1,u=[],d=[],c=new Map,l=new Set,f=function(e){var r,n,s=t.outboundNeighbors(e);c.set(e,h++),u.push(e),d.push(e);for(var g=0,p=s.length;g<p;g++)if(r=s[g],c.has(r)){if(n=c.get(r),!l.has(r))for(;c.get(u[u.length-1])>n;)u.pop()}else f(r);if(c.get(u[u.length-1])===c.get(e)){o=[];do{a=d.pop(),o.push(a),l.add(a)}while(a!==e);i.push(o),u.pop()}};for(e=0,r=n.length;e<r;e++)s=n[e],l.has(s)||f(s);return i};var mo=oo,bo={},wo={},Eo=o,Ao=o,xo=function(t,e){if(!Ao(t))throw new Error("graphology-generators/classic/empty: invalid Graph constructor.");var r,n=new t;for(r=0;r<e;r++)n.addNode(r);return n},zo=o,Mo=o;wo.complete=function(t,e){if(!Eo(t))throw new Error("graphology-generators/classic/complete: invalid Graph constructor.");var r,n,i=new t;for(r=0;r<e;r++)i.addNode(r);for(r=0;r<e;r++)for(n=r+1;n<e;n++)"directed"!==i.type&&i.addUndirectedEdge(r,n),"undirected"!==i.type&&(i.addDirectedEdge(r,n),i.addDirectedEdge(n,r));return i},wo.empty=xo,wo.ladder=function(t,e){if(!zo(t))throw new Error("graphology-generators/classic/ladder: invalid Graph constructor.");var r,n=new t;for(r=0;r<e-1;r++)n.mergeEdge(r,r+1);for(r=e;r<2*e-1;r++)n.mergeEdge(r,r+1);for(r=0;r<e;r++)n.addEdge(r,r+e);return n},wo.path=function(t,e){if(!Mo(t))throw new Error("graphology-generators/classic/path: invalid Graph constructor.");for(var r=new t,n=0;n<e-1;n++)r.mergeEdge(n,n+1);return r};var So={},Do=o,No=xo,ko=o,Co=xo;So.caveman=function(t,e,r){if(!Do(t))throw new Error("graphology-generators/community/caveman: invalid Graph constructor.");var n,i,o,a=e*r,s=No(t,a);if(r<2)return s;for(n=0;n<a;n+=r)for(i=n;i<n+r;i++)for(o=i+1;o<n+r;o++)s.addEdge(i,o);return s},So.connectedCaveman=function(t,e,r){if(!ko(t))throw new Error("graphology-generators/community/connected-caveman: invalid Graph constructor.");var n,i,o,a=e*r,s=Co(t,a);if(r<2)return s;for(n=0;n<a;n+=r){for(i=n;i<n+r;i++)for(o=i+1;o<n+r;o++)i===n&&i===o-1||s.addEdge(i,o);n>0&&s.addEdge(n,(n-1)%a)}return s.addEdge(0,a-1),s};var Oo={},Wo=o,jo={},_o=i,Po=function(t){if(!_o(t))throw new Error("graphology-metrics/simple-size: the given graph is not a valid graphology instance.");if(!t.multi)return t.size;var e=0,r=0;function n(){e++}function i(){r++}return t.forEachNode((function(e){"directed"!==t.type&&t.forEachUndirectedNeighbor(e,n),"undirected"!==t.type&&t.forEachOutNeighbor(e,i)})),e/2+r},Uo=i,Io=Po;function Fo(t,e){return 2*e/(t*(t-1))}function To(t,e){return e/(t*(t-1))}function Lo(t,e){var r=t*(t-1);return e/(r+r/2)}function Ro(t,e,r){var n,i;if(arguments.length>3){if(i=arguments[3],"number"!=typeof(n=r)||n<0)throw new Error("graphology-metrics/density: given order is not a valid number.");if("number"!=typeof i||i<0)throw new Error("graphology-metrics/density: given size is not a valid number.")}else{if(!Uo(r))throw new Error("graphology-metrics/density: given graph is not a valid graphology instance.");n=r.order,i=r.size,r.multi&&!1===e&&(i=Io(r))}return n<2?0:(null===t&&(t=r.type),null===e&&(e=r.multi),("undirected"===t?Fo:"directed"===t?To:Lo)(n,i))}jo.abstractDensity=Ro,jo.density=Ro.bind(null,null,null),jo.directedDensity=Ro.bind(null,"directed",!1),jo.undirectedDensity=Ro.bind(null,"undirected",!1),jo.mixedDensity=Ro.bind(null,"mixed",!1),jo.multiDirectedDensity=Ro.bind(null,"directed",!0),jo.multiUndirectedDensity=Ro.bind(null,"undirected",!0),jo.multiMixedDensity=Ro.bind(null,"mixed",!0);var Go=o,qo=jo.abstractDensity;function Bo(t,e){if(!Go(t))throw new Error("graphology-generators/random/erdos-renyi: invalid Graph constructor.");var r,n,i=e.order,o=e.probability,a=e.rng||Math.random,s=new t;if("number"==typeof e.approximateSize&&(o=qo(s.type,!1,i,e.approximateSize)),"number"!=typeof i||i<=0)throw new Error("graphology-generators/random/erdos-renyi: invalid `order`. Should be a positive number.");if("number"!=typeof o||o<0||o>1)throw new Error("graphology-generators/random/erdos-renyi: invalid `probability`. Should be a number between 0 and 1. Or maybe you gave an `approximateSize` exceeding the graph's density.");if("function"!=typeof a)throw new Error("graphology-generators/random/erdos-renyi: invalid `rng`. Should be a function.");for(r=0;r<i;r++)s.addNode(r);if(o<=0)return s;for(r=0;r<i;r++)for(n=r+1;n<i;n++)"directed"!==s.type&&a()<o&&s.addUndirectedEdge(r,n),"undirected"!==s.type&&(a()<o&&s.addDirectedEdge(r,n),a()<o&&s.addDirectedEdge(n,r));return s}Bo.sparse=function(t,e){if(!Go(t))throw new Error("graphology-generators/random/erdos-renyi: invalid Graph constructor.");var r=e.order,n=e.probability,i=e.rng||Math.random,o=new t;if("number"==typeof e.approximateSize&&(n=qo(o.type,!1,r,e.approximateSize)),"number"!=typeof r||r<=0)throw new Error("graphology-generators/random/erdos-renyi: invalid `order`. Should be a positive number.");if("number"!=typeof n||n<0||n>1)throw new Error("graphology-generators/random/erdos-renyi: invalid `probability`. Should be a number between 0 and 1. Or maybe you gave an `approximateSize` exceeding the graph's density.");if("function"!=typeof i)throw new Error("graphology-generators/random/erdos-renyi: invalid `rng`. Should be a function.");for(var a=0;a<r;a++)o.addNode(a);if(n<=0)return o;var s,h=-1,u=Math.log(1-n);if("undirected"!==o.type)for(s=0;s<r;){for(s===(h+=1+(Math.log(1-i())/u|0))&&h++;s<r&&r<=h;)++s===(h-=r)&&h++;s<r&&o.addDirectedEdge(s,h)}if(h=-1,"directed"!==o.type)for(s=1;s<r;){for(h+=1+(Math.log(1-i())/u|0);h>=s&&s<r;)h-=s,s++;s<r&&o.addUndirectedEdge(s,h)}return o};var Ho=Bo,Vo=o;Oo.clusters=function(t,e){if(!Wo(t))throw new Error("graphology-generators/random/clusters: invalid Graph constructor.");var r="clusterDensity"in(e=e||{})?e.clusterDensity:.5,n=e.rng||Math.random,i=e.order,o=e.size,a=e.clusters;if("number"!=typeof r||r>1||r<0)throw new Error("graphology-generators/random/clusters: `clusterDensity` option should be a number between 0 and 1.");if("function"!=typeof n)throw new Error("graphology-generators/random/clusters: `rng` option should be a function.");if("number"!=typeof i||i<=0)throw new Error("graphology-generators/random/clusters: `order` option should be a positive number.");if("number"!=typeof o||o<=0)throw new Error("graphology-generators/random/clusters: `size` option should be a positive number.");if("number"!=typeof a||a<=0)throw new Error("graphology-generators/random/clusters: `clusters` option should be a positive number.");var s=new t;if(!i)return s;var h,u,d,c,l,f,g=new Array(a);for(d=0;d<a;d++)g[d]=[];for(d=0;d<i;d++)h=n()*a|0,s.addNode(d,{cluster:h}),g[h].push(d);if(!o)return s;for(d=0;d<o;d++){if(n()<1-r){c=n()*i|0;do{l=n()*i|0}while(c===l)}else{if(!(f=(u=g[h=n()*a|0]).length)||f<2)continue;c=u[n()*f|0];do{l=u[n()*f|0]}while(c===l)}s.multi?s.addEdge(c,l):s.mergeEdge(c,l)}return s},Oo.erdosRenyi=Ho,Oo.girvanNewman=function(t,e){if(!Vo(t))throw new Error("graphology-generators/random/girvan-newman: invalid Graph constructor.");var r=e.zOut,n=e.rng||Math.random;if("number"!=typeof r)throw new Error("graphology-generators/random/girvan-newman: invalid `zOut`. Should be a number.");if("function"!=typeof n)throw new Error("graphology-generators/random/girvan-newman: invalid `rng`. Should be a function.");var i,o,a,s=r/96,h=(16-96*s)/31,u=new t;for(o=0;o<128;o++)u.addNode(o);for(o=0;o<128;o++)for(a=o+1;a<128;a++)i=n(),o%4==a%4?i<h&&u.addEdge(o,a):i<s&&u.addEdge(o,a);return u};var Yo={},Ko=function(t,e){if(0!==e.length){var r,n,i,o=e[0];for(t.mergeNode(o),n=1,i=e.length;n<i;n++)r=e[n],t.mergeEdge(o,r)}},$o=o,Xo=Ko,Jo=[["Andre","Beverley","Carol","Diane","Fernando"],["Beverley","Andre","Ed","Garth"],["Carol","Andre","Diane","Fernando"],["Diane","Andre","Beverley","Carol","Ed","Fernando","Garth"],["Ed","Beverley","Diane","Garth"],["Fernando","Andre","Carol","Diane","Garth","Heather"],["Garth","Beverley","Diane","Ed","Fernando","Heather"],["Heather","Fernando","Garth","Ike"],["Ike","Heather","Jane"],["Jane","Ike"]];Yo.krackhardtKite=function(t){if(!$o(t))throw new Error("graphology-generators/social/krackhardt-kite: invalid Graph constructor.");var e,r,n=new t;for(e=0,r=Jo.length;e<r;e++)Xo(n,Jo[e]);return n};var Qo={},Zo=o,ta=[["Acciaiuoli","Medici"],["Castellani","Peruzzi"],["Castellani","Strozzi"],["Castellani","Barbadori"],["Medici","Barbadori"],["Medici","Ridolfi"],["Medici","Tornabuoni"],["Medici","Albizzi"],["Medici","Salviati"],["Salviati","Pazzi"],["Peruzzi","Strozzi"],["Peruzzi","Bischeri"],["Strozzi","Ridolfi"],["Strozzi","Bischeri"],["Ridolfi","Tornabuoni"],["Tornabuoni","Guadagni"],["Albizzi","Ginori"],["Albizzi","Guadagni"],["Bischeri","Guadagni"],["Guadagni","Lamberteschi"]],ea=o,ra=["0111111110111100010101000000000100","1011000100000100010101000000001000","1101000111000100000000000001100010","1110000100001100000000000000000000","1000001000100000000000000000000000","1000001000100000100000000000000000","1000110000000000100000000000000000","1111000000000000000000000000000000","1010000000000000000000000000001011","0010000000000000000000000000000001","1000110000000000000000000000000000","1000000000000000000000000000000000","1001000000000000000000000000000000","1111000000000000000000000000000001","0000000000000000000000000000000011","0000000000000000000000000000000011","0000011000000000000000000000000000","1100000000000000000000000000000000","0000000000000000000000000000000011","1100000000000000000000000000000001","0000000000000000000000000000000011","1100000000000000000000000000000000","0000000000000000000000000000000011","0000000000000000000000000101010011","0000000000000000000000000101000100","0000000000000000000000011000000100","0000000000000000000000000000010001","0010000000000000000000011000000001","0010000000000000000000000000000101","0000000000000000000000010010000011","0100000010000000000000000000000011","1000000000000000000000001100100011","0010000010000011001010110000011101","0000000011000111001110110011111110"],na=new Set([0,1,2,3,4,5,6,7,8,10,11,12,13,16,17,19,21]);Qo.florentineFamilies=function(t){if(!Zo(t))throw new Error("graphology-generators/social/florentine-families: invalid Graph constructor.");var e,r,n,i=new t;for(r=0,n=ta.length;r<n;r++)e=ta[r],i.mergeEdge(e[0],e[1]);return i},Qo.karateClub=function(t){if(!ea(t))throw new Error("graphology-generators/social/karate: invalid Graph constructor.");for(var e,r,n,i,o,a,s=new t,h=0;h<34;h++)e=na.has(h)?"Mr. Hi":"Officer",s.addNode(h,{club:e});for(n=0,o=ra.length;n<o;n++)for(i=n+1,a=(r=ra[n].split("")).length;i<a;i++)+r[i]&&s.addEdgeWithKey(n+"->"+i,n,i);return s},bo.classic=wo,bo.community=So,bo.random=Oo,bo.small=Yo,bo.social=Qo;var ia=bo,oa={};function aa(t){return function(e,r){return e+Math.floor(t()*(r-e+1))}}var sa=aa(Math.random);sa.createRandom=aa;var ha=sa.createRandom;function ua(t){var e=ha(t);return function(t){for(var r=t.length,n=r-1,i=-1;++i<r;){var o=e(i,n),a=t[o];t[o]=t[i],t[i]=a}}}var da=ua(Math.random);da.createShuffleInPlace=ua;var ca=E,la=i,fa=da,ga={attributes:{x:"x",y:"y"},center:0,hierarchyAttributes:[],rng:Math.random,scale:1};function pa(t,e,r,n,i){this.wrappedCircle=i||null,this.children={},this.countChildren=0,this.id=t||null,this.next=null,this.previous=null,this.x=e||null,this.y=r||null,this.r=i?1010101:n||999}function ya(t,e,r){for(var n in e.children){var i=e.children[n];i.hasChildren()?ya(t,i,r):r[i.id]={x:i.x,y:i.y}}}function va(t,e){var r=t.r-e.r,n=e.x-t.x,i=e.y-t.y;return r<0||r*r<n*n+i*i}function ma(t,e){var r=t.r-e.r+1e-6,n=e.x-t.x,i=e.y-t.y;return r>0&&r*r>n*n+i*i}function ba(t,e){for(var r=0;r<e.length;++r)if(!ma(t,e[r]))return!1;return!0}function wa(t,e){var r=t.x,n=t.y,i=t.r,o=e.x,a=e.y,s=e.r,h=o-r,u=a-n,d=s-i,c=Math.sqrt(h*h+u*u);return new pa(null,(r+o+h/c*d)/2,(n+a+u/c*d)/2,(c+i+s)/2)}function Ea(t,e,r){var n=t.x,i=t.y,o=t.r,a=e.x,s=e.y,h=e.r,u=r.x,d=r.y,c=r.r,l=n-a,f=n-u,g=i-s,p=i-d,y=h-o,v=c-o,m=n*n+i*i-o*o,b=m-a*a-s*s+h*h,w=m-u*u-d*d+c*c,E=f*g-l*p,A=(g*w-p*b)/(2*E)-n,x=(p*y-g*v)/E,z=(f*b-l*w)/(2*E)-i,M=(l*v-f*y)/E,S=x*x+M*M-1,D=2*(o+A*x+z*M),N=A*A+z*z-o*o,k=-(S?(D+Math.sqrt(D*D-4*S*N))/(2*S):N/D);return new pa(null,n+A+x*k,i+z+M*k,k)}function Aa(t){switch(t.length){case 1:return new pa(null,(e=t[0]).x,e.y,e.r);case 2:return wa(t[0],t[1]);case 3:return Ea(t[0],t[1],t[2]);default:throw new Error("graphology-layout/circlepack: Invalid basis length "+t.length)}var e}function xa(t,e){var r,n;if(ba(e,t))return[e];for(r=0;r<t.length;++r)if(va(e,t[r])&&ba(wa(t[r],e),t))return[t[r],e];for(r=0;r<t.length-1;++r)for(n=r+1;n<t.length;++n)if(va(wa(t[r],t[n]),e)&&va(wa(t[r],e),t[n])&&va(wa(t[n],e),t[r])&&ba(Ea(t[r],t[n],e),t))return[t[r],t[n],e];throw new Error("graphology-layout/circlepack: extendBasis failure !")}function za(t){var e=t.wrappedCircle,r=t.next.wrappedCircle,n=e.r+r.r,i=(e.x*r.r+r.x*e.r)/n,o=(e.y*r.r+r.y*e.r)/n;return i*i+o*o}function Ma(t,e,r){var n,i,o,a,s=t.x-e.x,h=t.y-e.y,u=s*s+h*h;u?(i=e.r+r.r,i*=i,a=t.r+r.r,i>(a*=a)?(n=(u+a-i)/(2*u),o=Math.sqrt(Math.max(0,a/u-n*n)),r.x=t.x-n*s-o*h,r.y=t.y-n*h+o*s):(n=(u+i-a)/(2*u),o=Math.sqrt(Math.max(0,i/u-n*n)),r.x=e.x+n*s-o*h,r.y=e.y+n*h+o*s)):(r.x=e.x+r.r,r.y=e.y)}function Sa(t,e){var r=t.r+e.r-1e-6,n=e.x-t.x,i=e.y-t.y;return r>0&&r*r>n*n+i*i}function Da(t,e){var r,n,i,o,a,s,h,u,d,c,l=t.length;if(0===l)return 0;if((r=t[0]).x=0,r.y=0,l<=1)return r.r;if(n=t[1],r.x=-n.r,n.x=r.r,n.y=0,l<=2)return r.r+n.r;Ma(n,r,i=t[2]),r=new pa(null,null,null,null,r),n=new pa(null,null,null,null,n),i=new pa(null,null,null,null,i),r.next=i.previous=n,n.next=r.previous=i,i.next=n.previous=r;t:for(s=3;s<l;++s){i=t[s],Ma(r.wrappedCircle,n.wrappedCircle,i),i=new pa(null,null,null,null,i),h=n.next,u=r.previous,d=n.wrappedCircle.r,c=r.wrappedCircle.r;do{if(d<=c){if(Sa(h.wrappedCircle,i.wrappedCircle)){n=h,r.next=n,n.previous=r,--s;continue t}d+=h.wrappedCircle.r,h=h.next}else{if(Sa(u.wrappedCircle,i.wrappedCircle)){(r=u).next=n,n.previous=r,--s;continue t}c+=u.wrappedCircle.r,u=u.previous}}while(h!==u.next);for(i.previous=r,i.next=n,r.next=n.previous=n=i,o=za(r);(i=i.next)!==n;)(a=za(i))<o&&(r=i,o=a);n=r.next}r=[n.wrappedCircle],i=n;for(var f=1e4;(i=i.next)!==n&&0!=--f;)r.push(i.wrappedCircle);for(i=function(t,e){var r,n,i=0,o=t.slice(),a=t.length,s=[];for(e(o);i<a;)r=o[i],n&&ma(n,r)?++i:(n=Aa(s=xa(s,r)),i=0);return n}(r,e),s=0;s<l;++s)(r=t[s]).x-=i.x,r.y-=i.y;return i.r}function Na(t,e){var r=0;if(t.hasChildren()){for(var n in t.children){var i=t.children[n];i.hasChildren()&&(i.r=Na(i,e))}r=Da(Object.values(t.children),e)}return r}function ka(t,e){for(var r in Na(t,e),t.children){t.children[r].applyPositionToChildren()}}function Ca(t,e,r){if(!la(e))throw new Error("graphology-layout/circlepack: the given graph is not a valid graphology instance.");r=ca(r,ga);var n={},i={},o=e.nodes(),a=r.center,s=r.hierarchyAttributes,h=fa.createShuffleInPlace(r.rng),u=r.scale,d=new pa;e.forEachNode((function(t,e){var r=new pa(t,null,null,e.size?e.size:1),n=d;s.forEach((function(t){var r=e[t];n=n.getChild(r)})),n.addChild(t,r)})),ka(d,h),ya(e,d,n);var c,l,f,g=o.length;for(f=0;f<g;f++){var p=o[f];c=a+u*n[p].x,l=a+u*n[p].y,i[p]={x:c,y:l},t&&(e.setNodeAttribute(p,r.attributes.x,c),e.setNodeAttribute(p,r.attributes.y,l))}return i}pa.prototype.hasChildren=function(){return this.countChildren>0},pa.prototype.addChild=function(t,e){this.children[t]=e,++this.countChildren},pa.prototype.getChild=function(t){if(!this.children.hasOwnProperty(t)){var e=new pa;this.children[t]=e,++this.countChildren}return this.children[t]},pa.prototype.applyPositionToChildren=function(){if(this.hasChildren()){var t=this;for(var e in t.children){var r=t.children[e];r.x+=t.x,r.y+=t.y,r.applyPositionToChildren()}}};var Oa=Ca.bind(null,!1);Oa.assign=Ca.bind(null,!0);var Wa=Oa,ja=E,_a=i,Pa={dimensions:["x","y"],center:.5,scale:1};function Ua(t,e,r){if(!_a(e))throw new Error("graphology-layout/random: the given graph is not a valid graphology instance.");var n=(r=ja(r,Pa)).dimensions;if(!Array.isArray(n)||2!==n.length)throw new Error("graphology-layout/random: given dimensions are invalid.");var i=r.center,o=r.scale,a=2*Math.PI,s=(i-.5)*o,h=e.order,u=n[0],d=n[1];function c(t,e){return e[u]=o*Math.cos(t*a/h)+s,e[d]=o*Math.sin(t*a/h)+s,e}var l=0;if(!t){var f={};return e.forEachNode((function(t){f[t]=c(l++,{})})),f}e.updateEachNodeAttributes((function(t,e){return c(l++,e),e}),{attributes:n})}var Ia=Ua.bind(null,!1);Ia.assign=Ua.bind(null,!0);var Fa=Ia,Ta=E,La=i,Ra={dimensions:["x","y"],center:.5,rng:Math.random,scale:1};function Ga(t,e,r){if(!La(e))throw new Error("graphology-layout/random: the given graph is not a valid graphology instance.");var n=(r=Ta(r,Ra)).dimensions;if(!Array.isArray(n)||n.length<1)throw new Error("graphology-layout/random: given dimensions are invalid.");var i=n.length,o=r.center,a=r.rng,s=r.scale,h=(o-.5)*s;function u(t){for(var e=0;e<i;e++)t[n[e]]=a()*s+h;return t}if(!t){var d={};return e.forEachNode((function(t){d[t]=u({})})),d}e.updateEachNodeAttributes((function(t,e){return u(e),e}),{attributes:n})}var qa=Ga.bind(null,!1);qa.assign=Ga.bind(null,!0);var Ba=qa,Ha=E,Va=i,Ya=Math.PI/180,Ka={dimensions:["x","y"],centeredOnZero:!1,degrees:!1};function $a(t,e,r,n){if(!Va(e))throw new Error("graphology-layout/rotation: the given graph is not a valid graphology instance.");(n=Ha(n,Ka)).degrees&&(r*=Ya);var i=n.dimensions;if(!Array.isArray(i)||2!==i.length)throw new Error("graphology-layout/random: given dimensions are invalid.");if(0===e.order){if(t)return;return{}}var o=i[0],a=i[1],s=0,h=0;if(!n.centeredOnZero){var u=1/0,d=-1/0,c=1/0,l=-1/0;e.forEachNode((function(t,e){var r=e[o],n=e[a];r<u&&(u=r),r>d&&(d=r),n<c&&(c=n),n>l&&(l=n)})),s=(u+d)/2,h=(c+l)/2}var f=Math.cos(r),g=Math.sin(r);function p(t){var e=t[o],r=t[a];return t[o]=s+(e-s)*f-(r-h)*g,t[a]=h+(e-s)*g+(r-h)*f,t}if(!t){var y={};return e.forEachNode((function(t,e){var r={};r[o]=e[o],r[a]=e[a],y[t]=p(r)})),y}e.updateEachNodeAttributes((function(t,e){return p(e),e}),{attributes:i})}var Xa=$a.bind(null,!1);Xa.assign=$a.bind(null,!0);var Ja=Xa;oa.circlepack=Wa,oa.circular=Fa,oa.random=Ba,oa.rotation=Ja;var Qa=oa,Za=oa,ts=10,es={};es.assign=function(t){t=t||{};var e,r,n,i=Array.prototype.slice.call(arguments).slice(1);for(e=0,n=i.length;e<n;e++)if(i[e])for(r in i[e])t[r]=i[e][r];return t},es.validateSettings=function(t){return"linLogMode"in t&&"boolean"!=typeof t.linLogMode?{message:"the `linLogMode` setting should be a boolean."}:"outboundAttractionDistribution"in t&&"boolean"!=typeof t.outboundAttractionDistribution?{message:"the `outboundAttractionDistribution` setting should be a boolean."}:"adjustSizes"in t&&"boolean"!=typeof t.adjustSizes?{message:"the `adjustSizes` setting should be a boolean."}:"edgeWeightInfluence"in t&&"number"!=typeof t.edgeWeightInfluence?{message:"the `edgeWeightInfluence` setting should be a number."}:!("scalingRatio"in t)||"number"==typeof t.scalingRatio&&t.scalingRatio>=0?"strongGravityMode"in t&&"boolean"!=typeof t.strongGravityMode?{message:"the `strongGravityMode` setting should be a boolean."}:!("gravity"in t)||"number"==typeof t.gravity&&t.gravity>=0?"slowDown"in t&&!("number"==typeof t.slowDown||t.slowDown>=0)?{message:"the `slowDown` setting should be a number >= 0."}:"barnesHutOptimize"in t&&"boolean"!=typeof t.barnesHutOptimize?{message:"the `barnesHutOptimize` setting should be a boolean."}:!("barnesHutTheta"in t)||"number"==typeof t.barnesHutTheta&&t.barnesHutTheta>=0?null:{message:"the `barnesHutTheta` setting should be a number >= 0."}:{message:"the `gravity` setting should be a number >= 0."}:{message:"the `scalingRatio` setting should be a number >= 0."}},es.graphToByteArrays=function(t,e){var r,n=t.order,i=t.size,o={},a=new Float32Array(10*n),s=new Float32Array(3*i);return r=0,t.forEachNode((function(t,e){o[t]=r,a[r]=e.x,a[r+1]=e.y,a[r+2]=0,a[r+3]=0,a[r+4]=0,a[r+5]=0,a[r+6]=1,a[r+7]=1,a[r+8]=e.size||1,a[r+9]=e.fixed?1:0,r+=10})),r=0,t.forEachEdge((function(t,n,i,h,u,d,c){var l=o[i],f=o[h],g=e(t,n,i,h,u,d,c);a[l+6]+=g,a[f+6]+=g,s[r]=l,s[r+1]=f,s[r+2]=g,r+=3})),{nodes:a,edges:s}},es.assignLayoutChanges=function(t,e,r){var n=0;t.updateEachNodeAttributes((function(t,i){return i.x=e[n],i.y=e[n+1],n+=10,r?r(t,i):i}))},es.readGraphPositions=function(t,e){var r=0;t.forEachNode((function(t,n){e[r]=n.x,e[r+1]=n.y,r+=10}))},es.collectLayoutChanges=function(t,e,r){for(var n=t.nodes(),i={},o=0,a=0,s=e.length;o<s;o+=10){if(r){var h=Object.assign({},t.getNodeAttributes(n[a]));h.x=e[o],h.y=e[o+1],h=r(n[a],h),i[n[a]]={x:h.x,y:h.y}}else i[n[a]]={x:e[o],y:e[o+1]};a++}return i},es.createWorker=function(t){var e=window.URL||window.webkitURL,r=t.toString(),n=e.createObjectURL(new Blob(["("+r+").call(this);"],{type:"text/javascript"})),i=new Worker(n);return e.revokeObjectURL(n),i};var rs={linLogMode:!1,outboundAttractionDistribution:!1,adjustSizes:!1,edgeWeightInfluence:1,scalingRatio:1,strongGravityMode:!1,gravity:1,slowDown:1,barnesHutOptimize:!1,barnesHutTheta:.5},ns=i,is=Wi.createEdgeWeightGetter,os=function(t,e,r){var n,i,o,a,s,h,u,d,c,l,f,g,p,y,v,m,b,w,E,A,x,z,M,S=e.length,D=r.length,N=t.adjustSizes,k=t.barnesHutTheta*t.barnesHutTheta,C=[];for(o=0;o<S;o+=ts)e[o+4]=e[o+2],e[o+5]=e[o+3],e[o+2]=0,e[o+3]=0;if(t.outboundAttractionDistribution){for(f=0,o=0;o<S;o+=ts)f+=e[o+6];f/=S/ts}if(t.barnesHutOptimize){var O,W,j,_=1/0,P=-1/0,U=1/0,I=-1/0;for(o=0;o<S;o+=ts)_=Math.min(_,e[o+0]),P=Math.max(P,e[o+0]),U=Math.min(U,e[o+1]),I=Math.max(I,e[o+1]);var F=P-_,T=I-U;for(F>T?I=(U-=(F-T)/2)+F:P=(_-=(T-F)/2)+T,C[0]=-1,C[1]=(_+P)/2,C[2]=(U+I)/2,C[3]=Math.max(P-_,I-U),C[4]=-1,C[5]=-1,C[6]=0,C[7]=0,C[8]=0,n=1,o=0;o<S;o+=ts)for(i=0,j=3;;){if(!(C[i+5]>=0)){if(C[i+0]<0){C[i+0]=o;break}if(C[i+5]=9*n,d=C[i+3]/2,C[(c=C[i+5])+0]=-1,C[c+1]=C[i+1]-d,C[c+2]=C[i+2]-d,C[c+3]=d,C[c+4]=c+9,C[c+5]=-1,C[c+6]=0,C[c+7]=0,C[c+8]=0,C[(c+=9)+0]=-1,C[c+1]=C[i+1]-d,C[c+2]=C[i+2]+d,C[c+3]=d,C[c+4]=c+9,C[c+5]=-1,C[c+6]=0,C[c+7]=0,C[c+8]=0,C[(c+=9)+0]=-1,C[c+1]=C[i+1]+d,C[c+2]=C[i+2]-d,C[c+3]=d,C[c+4]=c+9,C[c+5]=-1,C[c+6]=0,C[c+7]=0,C[c+8]=0,C[(c+=9)+0]=-1,C[c+1]=C[i+1]+d,C[c+2]=C[i+2]+d,C[c+3]=d,C[c+4]=C[i+4],C[c+5]=-1,C[c+6]=0,C[c+7]=0,C[c+8]=0,n+=4,O=e[C[i+0]+0]<C[i+1]?e[C[i+0]+1]<C[i+2]?C[i+5]:C[i+5]+9:e[C[i+0]+1]<C[i+2]?C[i+5]+18:C[i+5]+27,C[i+6]=e[C[i+0]+6],C[i+7]=e[C[i+0]+0],C[i+8]=e[C[i+0]+1],C[O+0]=C[i+0],C[i+0]=-1,O===(W=e[o+0]<C[i+1]?e[o+1]<C[i+2]?C[i+5]:C[i+5]+9:e[o+1]<C[i+2]?C[i+5]+18:C[i+5]+27)){if(j--){i=O;continue}j=3;break}C[W+0]=o;break}O=e[o+0]<C[i+1]?e[o+1]<C[i+2]?C[i+5]:C[i+5]+9:e[o+1]<C[i+2]?C[i+5]+18:C[i+5]+27,C[i+7]=(C[i+7]*C[i+6]+e[o+0]*e[o+6])/(C[i+6]+e[o+6]),C[i+8]=(C[i+8]*C[i+6]+e[o+1]*e[o+6])/(C[i+6]+e[o+6]),C[i+6]+=e[o+6],i=O}}if(t.barnesHutOptimize){for(g=t.scalingRatio,o=0;o<S;o+=ts)for(i=0;;)if(C[i+5]>=0){if(m=Math.pow(e[o+0]-C[i+7],2)+Math.pow(e[o+1]-C[i+8],2),4*(l=C[i+3])*l/m<k){if(p=e[o+0]-C[i+7],y=e[o+1]-C[i+8],!0===N?m>0?(b=g*e[o+6]*C[i+6]/m,e[o+2]+=p*b,e[o+3]+=y*b):m<0&&(b=-g*e[o+6]*C[i+6]/Math.sqrt(m),e[o+2]+=p*b,e[o+3]+=y*b):m>0&&(b=g*e[o+6]*C[i+6]/m,e[o+2]+=p*b,e[o+3]+=y*b),(i=C[i+4])<0)break;continue}i=C[i+5]}else if((h=C[i+0])>=0&&h!==o&&(m=(p=e[o+0]-e[h+0])*p+(y=e[o+1]-e[h+1])*y,!0===N?m>0?(b=g*e[o+6]*e[h+6]/m,e[o+2]+=p*b,e[o+3]+=y*b):m<0&&(b=-g*e[o+6]*e[h+6]/Math.sqrt(m),e[o+2]+=p*b,e[o+3]+=y*b):m>0&&(b=g*e[o+6]*e[h+6]/m,e[o+2]+=p*b,e[o+3]+=y*b)),(i=C[i+4])<0)break}else for(g=t.scalingRatio,a=0;a<S;a+=ts)for(s=0;s<a;s+=ts)p=e[a+0]-e[s+0],y=e[a+1]-e[s+1],!0===N?(m=Math.sqrt(p*p+y*y)-e[a+8]-e[s+8])>0?(b=g*e[a+6]*e[s+6]/m/m,e[a+2]+=p*b,e[a+3]+=y*b,e[s+2]-=p*b,e[s+3]-=y*b):m<0&&(b=100*g*e[a+6]*e[s+6],e[a+2]+=p*b,e[a+3]+=y*b,e[s+2]-=p*b,e[s+3]-=y*b):(m=Math.sqrt(p*p+y*y))>0&&(b=g*e[a+6]*e[s+6]/m/m,e[a+2]+=p*b,e[a+3]+=y*b,e[s+2]-=p*b,e[s+3]-=y*b);for(c=t.gravity/t.scalingRatio,g=t.scalingRatio,o=0;o<S;o+=ts)b=0,p=e[o+0],y=e[o+1],m=Math.sqrt(Math.pow(p,2)+Math.pow(y,2)),t.strongGravityMode?m>0&&(b=g*e[o+6]*c):m>0&&(b=g*e[o+6]*c/m),e[o+2]-=p*b,e[o+3]-=y*b;for(g=1*(t.outboundAttractionDistribution?f:1),u=0;u<D;u+=3)a=r[u+0],s=r[u+1],d=r[u+2],v=Math.pow(d,t.edgeWeightInfluence),p=e[a+0]-e[s+0],y=e[a+1]-e[s+1],!0===N?(m=Math.sqrt(p*p+y*y)-e[a+8]-e[s+8],t.linLogMode?t.outboundAttractionDistribution?m>0&&(b=-g*v*Math.log(1+m)/m/e[a+6]):m>0&&(b=-g*v*Math.log(1+m)/m):t.outboundAttractionDistribution?m>0&&(b=-g*v/e[a+6]):m>0&&(b=-g*v)):(m=Math.sqrt(Math.pow(p,2)+Math.pow(y,2)),t.linLogMode?t.outboundAttractionDistribution?m>0&&(b=-g*v*Math.log(1+m)/m/e[a+6]):m>0&&(b=-g*v*Math.log(1+m)/m):t.outboundAttractionDistribution?(m=1,b=-g*v/e[a+6]):(m=1,b=-g*v)),m>0&&(e[a+2]+=p*b,e[a+3]+=y*b,e[s+2]-=p*b,e[s+3]-=y*b);if(!0===N)for(o=0;o<S;o+=ts)1!==e[o+9]&&((w=Math.sqrt(Math.pow(e[o+2],2)+Math.pow(e[o+3],2)))>10&&(e[o+2]=10*e[o+2]/w,e[o+3]=10*e[o+3]/w),E=e[o+6]*Math.sqrt((e[o+4]-e[o+2])*(e[o+4]-e[o+2])+(e[o+5]-e[o+3])*(e[o+5]-e[o+3])),A=Math.sqrt((e[o+4]+e[o+2])*(e[o+4]+e[o+2])+(e[o+5]+e[o+3])*(e[o+5]+e[o+3]))/2,x=.1*Math.log(1+A)/(1+Math.sqrt(E)),z=e[o+0]+e[o+2]*(x/t.slowDown),e[o+0]=z,M=e[o+1]+e[o+3]*(x/t.slowDown),e[o+1]=M);else for(o=0;o<S;o+=ts)1!==e[o+9]&&(E=e[o+6]*Math.sqrt((e[o+4]-e[o+2])*(e[o+4]-e[o+2])+(e[o+5]-e[o+3])*(e[o+5]-e[o+3])),A=Math.sqrt((e[o+4]+e[o+2])*(e[o+4]+e[o+2])+(e[o+5]+e[o+3])*(e[o+5]+e[o+3]))/2,x=e[o+7]*Math.log(1+A)/(1+Math.sqrt(E)),e[o+7]=Math.min(1,Math.sqrt(x*(Math.pow(e[o+2],2)+Math.pow(e[o+3],2))/(1+Math.sqrt(E)))),z=e[o+0]+e[o+2]*(x/t.slowDown),e[o+0]=z,M=e[o+1]+e[o+3]*(x/t.slowDown),e[o+1]=M);return{}},as=es,ss=rs;function hs(t,e,r){if(!ns(e))throw new Error("graphology-layout-forceatlas2: the given graph is not a valid graphology instance.");"number"==typeof r&&(r={iterations:r});var n=r.iterations;if("number"!=typeof n)throw new Error("graphology-layout-forceatlas2: invalid number of iterations.");if(n<=0)throw new Error("graphology-layout-forceatlas2: you should provide a positive number of iterations.");var i=is("getEdgeWeight"in r?r.getEdgeWeight:"weight").fromEntry,o="function"==typeof r.outputReducer?r.outputReducer:null,a=as.assign({},ss,r.settings),s=as.validateSettings(a);if(s)throw new Error("graphology-layout-forceatlas2: "+s.message);var h,u=as.graphToByteArrays(e,i);for(h=0;h<n;h++)os(a,u.nodes,u.edges);if(!t)return as.collectLayoutChanges(e,u.nodes);as.assignLayoutChanges(e,u.nodes,o)}var us=hs.bind(null,!1);us.assign=hs.bind(null,!0),us.inferSettings=function(t){var e="number"==typeof t?t:t.order;return{barnesHutOptimize:e>2e3,strongGravityMode:!0,gravity:.05,scalingRatio:10,slowDown:1+Math.log(e)}};var ds=us;function cs(){return.01*(.5-Math.random())}var ls={};ls.validateSettings=function(t){return"gridSize"in t&&"number"!=typeof t.gridSize||t.gridSize<=0?{message:"the `gridSize` setting should be a positive number."}:"margin"in t&&"number"!=typeof t.margin||t.margin<0?{message:"the `margin` setting should be 0 or a positive number."}:"expansion"in t&&"number"!=typeof t.expansion||t.expansion<=0?{message:"the `expansion` setting should be a positive number."}:"ratio"in t&&"number"!=typeof t.ratio||t.ratio<=0?{message:"the `ratio` setting should be a positive number."}:"speed"in t&&"number"!=typeof t.speed||t.speed<=0?{message:"the `speed` setting should be a positive number."}:null},ls.graphToByteArray=function(t,e){var r=t.order,n=new Float32Array(3*r),i=0;return t.forEachNode((function(t,r){"function"==typeof e&&(r=e(t,r)),n[i]=r.x,n[i+1]=r.y,n[i+2]=r.size||1,i+=3})),n},ls.assignLayoutChanges=function(t,e,r){var n=0;t.forEachNode((function(i){var o={x:e[n],y:e[n+1]};"function"==typeof r&&(o=r(i,o)),t.mergeNodeAttributes(i,o),n+=3}))},ls.collectLayoutChanges=function(t,e,r){var n={},i=0;return t.forEachNode((function(t){var o={x:e[i],y:e[i+1]};"function"==typeof r&&(o=r(t,o)),n[t]=o,i+=3})),n},ls.createWorker=function(t){var e=window.URL||window.webkitURL,r=t.toString(),n=e.createObjectURL(new Blob(["("+r+").call(this);"],{type:"text/javascript"})),i=new Worker(n);return e.revokeObjectURL(n),i};var fs={gridSize:20,margin:5,expansion:1.1,ratio:1,speed:3},gs=i,ps=function(t,e){var r,n,i,o,a,s,h=t.margin,u=t.ratio,d=t.expansion,c=t.gridSize,l=t.speed,f=!0,g=e.length,p=g/3|0,y=new Float32Array(p),v=new Float32Array(p),m=1/0,b=1/0,w=-1/0,E=-1/0;for(r=0;r<g;r+=3)i=e[r+0],o=e[r+1],s=e[r+2]*u+h,m=Math.min(m,i-s),w=Math.max(w,i+s),b=Math.min(b,o-s),E=Math.max(E,o+s);var A=w-m,x=E-b,z=(m+w)/2,M=(b+E)/2;m=z-d*A/2,w=z+d*A/2,b=M-d*x/2,E=M+d*x/2;var S,D,N,k,C,O,W,j,_,P,U,I,F=new Array(c*c),T=F.length;for(S=0;S<T;S++)F[S]=[];for(r=0;r<g;r+=3)for(i=e[r+0],o=e[r+1],D=i-(s=e[r+2]*u+h),N=i+s,k=o-s,C=o+s,O=Math.floor(c*(D-m)/(w-m)),W=Math.floor(c*(N-m)/(w-m)),j=Math.floor(c*(k-b)/(E-b)),_=Math.floor(c*(C-b)/(E-b)),P=O;P<=W;P++)for(U=j;U<=_;U++)F[P*c+U].push(r);var L,R,G,q,B,H,V,Y,K,$,X,J,Q=new Set;for(S=0;S<T;S++)for(r=0,a=(I=F[S]).length;r<a;r++)for(G=e[(L=I[r])+0],B=e[L+1],V=e[L+2],n=r+1;n<a;n++)R=I[n],K=L+"§"+R,T>1&&Q.has(K)||(T>1&&Q.add(K),q=e[R+0],H=e[R+1],Y=e[R+2],$=q-G,X=H-B,(J=Math.sqrt($*$+X*X))<V*u+h+(Y*u+h)&&(f=!1,R=R/3|0,J>0?(y[R]+=$/J*(1+V),v[R]+=X/J*(1+V)):(y[R]+=A*cs(),v[R]+=x*cs())));for(r=0,n=0;r<g;r+=3,n++)e[r+0]+=.1*y[n]*l,e[r+1]+=.1*v[n]*l;return{converged:f}},ys=ls,vs=fs;function ms(t,e,r){if(!gs(e))throw new Error("graphology-layout-noverlap: the given graph is not a valid graphology instance.");var n=(r="number"==typeof r?{maxIterations:r}:r||{}).maxIterations||500;if("number"!=typeof n||n<=0)throw new Error("graphology-layout-force: you should provide a positive number of maximum iterations.");var i=Object.assign({},vs,r.settings),o=ys.validateSettings(i);if(o)throw new Error("graphology-layout-noverlap: "+o.message);var a,s=ys.graphToByteArray(e,r.inputReducer),h=!1;for(a=0;a<n&&!h;a++)h=ps(i,s).converged;if(!t)return ys.collectLayoutChanges(e,s,r.outputReducer);ys.assignLayoutChanges(e,s,r.outputReducer)}var bs=ms.bind(null,!1);bs.assign=ms.bind(null,!0);var ws=bs,Es={},As={},xs={},zs=i;function Ms(t,e,r,n){var i=e+"Centrality";if(!zs(r))throw new Error("graphology-centrality/"+i+": the given graph is not a valid graphology instance.");if("degree"!==e&&"undirected"===r.type)throw new Error("graphology-centrality/"+i+": cannot compute "+e+" centrality on an undirected graph.");var o=(n=n||{}).nodeCentralityAttribute||i,a=r.order-1,s=r[e].bind(r);if(!t){var h={};return r.forEachNode((function(t){h[t]=s(t)/a})),h}r.updateEachNodeAttributes((function(t,e){return e[o]=s(t)/a,e}),{attributes:[o]})}var Ss=Ms.bind(null,!1,"degree"),Ds=Ms.bind(null,!1,"inDegree"),Ns=Ms.bind(null,!1,"outDegree");Ss.assign=Ms.bind(null,!0,"degree"),Ds.assign=Ms.bind(null,!0,"inDegree"),Ns.assign=Ms.bind(null,!0,"outDegree"),xs.degreeCentrality=Ss,xs.inDegreeCentrality=Ds,xs.outDegreeCentrality=Ns;var ks={},Cs={},Os={};Os.ARRAY_BUFFER_SUPPORT="undefined"!=typeof ArrayBuffer,Os.SYMBOL_SUPPORT="undefined"!=typeof Symbol;var Ws=Os,js=Ws.ARRAY_BUFFER_SUPPORT,_s=Ws.SYMBOL_SUPPORT,Ps=function(t,e){var r,n,i,o,a;if(!t)throw new Error("obliterator/forEach: invalid iterable.");if("function"!=typeof e)throw new Error("obliterator/forEach: expecting a callback.");if(Array.isArray(t)||js&&ArrayBuffer.isView(t)||"string"==typeof t||"[object Arguments]"===t.toString())for(i=0,o=t.length;i<o;i++)e(t[i],i);else if("function"!=typeof t.forEach)if(_s&&Symbol.iterator in t&&"function"!=typeof t.next&&(t=t[Symbol.iterator]()),"function"!=typeof t.next)for(n in t)t.hasOwnProperty(n)&&e(t[n],n);else for(r=t,i=0;!0!==(a=r.next()).done;)e(a.value,i),i++;else t.forEach(e)},Us=Ps,Is=bi;function Fs(t){return"number"==typeof t.length?t.length:"number"==typeof t.size?t.size:void 0}Cs.isArrayLike=function(t){return Array.isArray(t)||Is.isTypedArray(t)},Cs.guessLength=Fs,Cs.toArray=function(t){var e=Fs(t),r="number"==typeof e?new Array(e):[],n=0;return Us(t,(function(t){r[n++]=t})),r},Cs.toArrayWithIndices=function(t){var e=Fs(t),r="number"==typeof e?Is.getPointerArray(e):Array,n="number"==typeof e?new Array(e):[],i="number"==typeof e?new r(e):[],o=0;return Us(t,(function(t){n[o]=t,i[o]=o++})),[n,i]};var Ts=Cs,Ls=mi;function Rs(t,e){if(arguments.length<2)throw new Error("mnemonist/fixed-deque: expecting an Array class and a capacity.");if("number"!=typeof e||e<=0)throw new Error("mnemonist/fixed-deque: `capacity` should be a positive number.");this.ArrayClass=t,this.capacity=e,this.items=new t(this.capacity),this.clear()}Rs.prototype.clear=function(){this.start=0,this.size=0},Rs.prototype.push=function(t){if(this.size===this.capacity)throw new Error("mnemonist/fixed-deque.push: deque capacity ("+this.capacity+") exceeded!");var e=(this.start+this.size)%this.capacity;return this.items[e]=t,++this.size},Rs.prototype.unshift=function(t){if(this.size===this.capacity)throw new Error("mnemonist/fixed-deque.unshift: deque capacity ("+this.capacity+") exceeded!");var e=this.start-1;return 0===this.start&&(e=this.capacity-1),this.items[e]=t,this.start=e,++this.size},Rs.prototype.pop=function(){if(0===this.size)return;const t=(this.start+this.size-1)%this.capacity;return this.size--,this.items[t]},Rs.prototype.shift=function(){if(0!==this.size){var t=this.start;return this.size--,this.start++,this.start===this.capacity&&(this.start=0),this.items[t]}},Rs.prototype.peekFirst=function(){if(0!==this.size)return this.items[this.start]},Rs.prototype.peekLast=function(){if(0!==this.size){var t=this.start+this.size-1;return t>this.capacity&&(t-=this.capacity),this.items[t]}},Rs.prototype.get=function(t){if(0!==this.size)return(t=this.start+t)>this.capacity&&(t-=this.capacity),this.items[t]},Rs.prototype.forEach=function(t,e){e=arguments.length>1?e:this;for(var r=this.capacity,n=this.size,i=this.start,o=0;o<n;)t.call(e,this.items[i],o,this),o++,++i===r&&(i=0)},Rs.prototype.toArray=function(){var t=this.start+this.size;if(t<this.capacity)return this.items.slice(this.start,t);for(var e=new this.ArrayClass(this.size),r=this.capacity,n=this.size,i=this.start,o=0;o<n;)e[o]=this.items[i],o++,++i===r&&(i=0);return e},Rs.prototype.values=function(){var t=this.items,e=this.capacity,r=this.size,n=this.start,i=0;return new Ls((function(){if(i>=r)return{done:!0};var o=t[n];return n++,i++,n===e&&(n=0),{value:o,done:!1}}))},Rs.prototype.entries=function(){var t=this.items,e=this.capacity,r=this.size,n=this.start,i=0;return new Ls((function(){if(i>=r)return{done:!0};var o=t[n];return++n===e&&(n=0),{value:[i++,o],done:!1}}))},"undefined"!=typeof Symbol&&(Rs.prototype[Symbol.iterator]=Rs.prototype.values),Rs.prototype.inspect=function(){var t=this.toArray();return t.type=this.ArrayClass.name,t.capacity=this.capacity,Object.defineProperty(t,"constructor",{value:Rs,enumerable:!1}),t},"undefined"!=typeof Symbol&&(Rs.prototype[Symbol.for("nodejs.util.inspect.custom")]=Rs.prototype.inspect),Rs.from=function(t,e,r){if(arguments.length<3&&"number"!=typeof(r=Ts.guessLength(t)))throw new Error("mnemonist/fixed-deque.from: could not guess iterable length. Please provide desired capacity as last argument.");var n=new Rs(e,r);if(Ts.isArrayLike(t)){var i,o;for(i=0,o=t.length;i<o;i++)n.items[i]=t[i];return n.size=o,n}return Ts.forEach(t,(function(t){n.push(t)})),n};var Gs=Rs,qs=mi,Bs=Cs;function Hs(t,e){if(arguments.length<2)throw new Error("mnemonist/fixed-stack: expecting an Array class and a capacity.");if("number"!=typeof e||e<=0)throw new Error("mnemonist/fixed-stack: `capacity` should be a positive number.");this.capacity=e,this.ArrayClass=t,this.items=new this.ArrayClass(this.capacity),this.clear()}Hs.prototype.clear=function(){this.size=0},Hs.prototype.push=function(t){if(this.size===this.capacity)throw new Error("mnemonist/fixed-stack.push: stack capacity ("+this.capacity+") exceeded!");return this.items[this.size++]=t,this.size},Hs.prototype.pop=function(){if(0!==this.size)return this.items[--this.size]},Hs.prototype.peek=function(){return this.items[this.size-1]},Hs.prototype.forEach=function(t,e){e=arguments.length>1?e:this;for(var r=0,n=this.items.length;r<n;r++)t.call(e,this.items[n-r-1],r,this)},Hs.prototype.toArray=function(){for(var t=new this.ArrayClass(this.size),e=this.size-1,r=this.size;r--;)t[r]=this.items[e-r];return t},Hs.prototype.values=function(){var t=this.items,e=this.size,r=0;return new qs((function(){if(r>=e)return{done:!0};var n=t[e-r-1];return r++,{value:n,done:!1}}))},Hs.prototype.entries=function(){var t=this.items,e=this.size,r=0;return new qs((function(){if(r>=e)return{done:!0};var n=t[e-r-1];return{value:[r++,n],done:!1}}))},"undefined"!=typeof Symbol&&(Hs.prototype[Symbol.iterator]=Hs.prototype.values),Hs.prototype.toString=function(){return this.toArray().join(",")},Hs.prototype.toJSON=function(){return this.toArray()},Hs.prototype.inspect=function(){var t=this.toArray();return t.type=this.ArrayClass.name,t.capacity=this.capacity,Object.defineProperty(t,"constructor",{value:Hs,enumerable:!1}),t},"undefined"!=typeof Symbol&&(Hs.prototype[Symbol.for("nodejs.util.inspect.custom")]=Hs.prototype.inspect),Hs.from=function(t,e,r){if(arguments.length<3&&"number"!=typeof(r=Bs.guessLength(t)))throw new Error("mnemonist/fixed-stack.from: could not guess iterable length. Please provide desired capacity as last argument.");var n=new Hs(e,r);if(Bs.isArrayLike(t)){var i,o;for(i=0,o=t.length;i<o;i++)n.items[i]=t[i];return n.size=o,n}return Bs.forEach(t,(function(t){n.push(t)})),n};var Vs=Hs,Ys={};Ys.DEFAULT_COMPARATOR=function(t,e){return t<e?-1:t>e?1:0},Ys.DEFAULT_REVERSE_COMPARATOR=function(t,e){return t<e?1:t>e?-1:0},Ys.reverseComparator=function(t){return function(e,r){return t(r,e)}},Ys.createTupleComparator=function(t){return 2===t?function(t,e){return t[0]<e[0]?-1:t[0]>e[0]?1:t[1]<e[1]?-1:t[1]>e[1]?1:0}:function(e,r){for(var n=0;n<t;){if(e[n]<r[n])return-1;if(e[n]>r[n])return 1;n++}return 0}};var Ks=Ps,$s=Ys,Xs=Cs,Js=$s.DEFAULT_COMPARATOR,Qs=$s.reverseComparator;function Zs(t,e,r,n){for(var i,o,a=e[n];n>r&&t(a,o=e[i=n-1>>1])<0;)e[n]=o,n=i;e[n]=a}function th(t,e,r){for(var n,i=e.length,o=r,a=e[r],s=2*r+1;s<i;)(n=s+1)<i&&t(e[s],e[n])>=0&&(s=n),e[r]=e[s],s=2*(r=s)+1;e[r]=a,Zs(t,e,o,r)}function eh(t,e,r){e.push(r),Zs(t,e,0,e.length-1)}function rh(t,e){var r=e.pop();if(0!==e.length){var n=e[0];return e[0]=r,th(t,e,0),n}return r}function nh(t,e,r){if(0===e.length)throw new Error("mnemonist/heap.replace: cannot pop an empty heap.");var n=e[0];return e[0]=r,th(t,e,0),n}function ih(t,e,r){var n;return 0!==e.length&&t(e[0],r)<0&&(n=e[0],e[0]=r,r=n,th(t,e,0)),r}function oh(t,e){for(var r=e.length>>1;--r>=0;)th(t,e,r)}function ah(t,e){for(var r=e.length,n=0,i=new Array(r);n<r;)i[n++]=rh(t,e);return i}function sh(t){if(this.clear(),this.comparator=t||Js,"function"!=typeof this.comparator)throw new Error("mnemonist/Heap.constructor: given comparator should be a function.")}function hh(t){if(this.clear(),this.comparator=t||Js,"function"!=typeof this.comparator)throw new Error("mnemonist/MaxHeap.constructor: given comparator should be a function.");this.comparator=Qs(this.comparator)}sh.prototype.clear=function(){this.items=[],this.size=0},sh.prototype.push=function(t){return eh(this.comparator,this.items,t),++this.size},sh.prototype.peek=function(){return this.items[0]},sh.prototype.pop=function(){return 0!==this.size&&this.size--,rh(this.comparator,this.items)},sh.prototype.replace=function(t){return nh(this.comparator,this.items,t)},sh.prototype.pushpop=function(t){return ih(this.comparator,this.items,t)},sh.prototype.consume=function(){return this.size=0,ah(this.comparator,this.items)},sh.prototype.toArray=function(){return ah(this.comparator,this.items.slice())},sh.prototype.inspect=function(){var t=this.toArray();return Object.defineProperty(t,"constructor",{value:sh,enumerable:!1}),t},"undefined"!=typeof Symbol&&(sh.prototype[Symbol.for("nodejs.util.inspect.custom")]=sh.prototype.inspect),hh.prototype=sh.prototype,sh.from=function(t,e){var r,n=new sh(e);return r=Xs.isArrayLike(t)?t.slice():Xs.toArray(t),oh(n.comparator,r),n.items=r,n.size=r.length,n},hh.from=function(t,e){var r,n=new hh(e);return r=Xs.isArrayLike(t)?t.slice():Xs.toArray(t),oh(n.comparator,r),n.items=r,n.size=r.length,n},sh.siftUp=th,sh.siftDown=Zs,sh.push=eh,sh.pop=rh,sh.replace=nh,sh.pushpop=ih,sh.heapify=oh,sh.consume=ah,sh.nsmallest=function(t,e,r){2===arguments.length&&(r=e,e=t,t=Js);var n,i,o,a,s=Qs(t),h=1/0;if(1===e){if(Xs.isArrayLike(r)){for(n=0,i=r.length;n<i;n++)o=r[n],(h===1/0||t(o,h)<0)&&(h=o);return(a=new r.constructor(1))[0]=h,a}return Ks(r,(function(e){(h===1/0||t(e,h)<0)&&(h=e)})),[h]}if(Xs.isArrayLike(r)){if(e>=r.length)return r.slice().sort(t);for(a=r.slice(0,e),oh(s,a),n=e,i=r.length;n<i;n++)s(r[n],a[0])>0&&nh(s,a,r[n]);return a.sort(t)}var u=Xs.guessLength(r);return null!==u&&u<e&&(e=u),a=new Array(e),n=0,Ks(r,(function(t){n<e?a[n]=t:(n===e&&oh(s,a),s(t,a[0])>0&&nh(s,a,t)),n++})),a.length>n&&(a.length=n),a.sort(t)},sh.nlargest=function(t,e,r){2===arguments.length&&(r=e,e=t,t=Js);var n,i,o,a,s=Qs(t),h=-1/0;if(1===e){if(Xs.isArrayLike(r)){for(n=0,i=r.length;n<i;n++)o=r[n],(h===-1/0||t(o,h)>0)&&(h=o);return(a=new r.constructor(1))[0]=h,a}return Ks(r,(function(e){(h===-1/0||t(e,h)>0)&&(h=e)})),[h]}if(Xs.isArrayLike(r)){if(e>=r.length)return r.slice().sort(s);for(a=r.slice(0,e),oh(t,a),n=e,i=r.length;n<i;n++)t(r[n],a[0])>0&&nh(t,a,r[n]);return a.sort(s)}var u=Xs.guessLength(r);return null!==u&&u<e&&(e=u),a=new Array(e),n=0,Ks(r,(function(r){n<e?a[n]=r:(n===e&&oh(t,a),t(r,a[0])>0&&nh(t,a,r)),n++})),a.length>n&&(a.length=n),a.sort(s)},sh.MinHeap=sh,sh.MaxHeap=hh;var uh=sh,dh={},ch=bi,lh=Wi.createEdgeWeightGetter;function fh(t,e){return"outbound"===t||"inbound"===t?e.directedSize+2*e.undirectedSize:"in"===t||"out"===t||"directed"===t?e.directedSize:2*e.undirectedSize}function gh(t,e){var r=t[(e=e||"outbound")+"Neighbors"].bind(t),n=fh(e,t),i=ch.getPointerArray(n),o=ch.getPointerArray(t.order);this.graph=t,this.neighborhood=new o(n),this.starts=new i(t.order+1),this.nodes=t.nodes();var a,s,h,u,d,c={},l=0;for(a=0,s=t.order;a<s;a++)c[this.nodes[a]]=a;for(a=0,s=t.order;a<s;a++)for(d=r(this.nodes[a]),this.starts[a]=l,h=0,u=d.length;h<u;h++)this.neighborhood[l++]=c[d[h]];this.starts[a]=n}function ph(t,e,r){var n=t[(r=r||"outbound")+"Edges"].bind(t),i=fh(r,t),o=ch.getPointerArray(i),a=ch.getPointerArray(t.order),s=lh(e).fromMinimalEntry;this.graph=t,this.neighborhood=new a(i),this.weights=new Float64Array(i),this.outDegrees=new Float64Array(t.order),this.starts=new o(t.order+1),this.nodes=t.nodes();var h,u,d,c,l,f,g,p,y,v={},m=0;for(h=0,u=t.order;h<u;h++)v[this.nodes[h]]=h;for(h=0,u=t.order;h<u;h++)for(g=n(l=this.nodes[h]),this.starts[h]=m,d=0,c=g.length;d<c;d++)p=g[d],f=t.opposite(l,p),y=s(p,t.getEdgeAttributes(p)),this.neighborhood[m]=v[f],this.weights[m++]=y,this.outDegrees[h]+=y;this.starts[h]=i}gh.prototype.bounds=function(t){return[this.starts[t],this.starts[t+1]]},gh.prototype.project=function(){var t=this,e={};return t.nodes.forEach((function(r,n){e[r]=Array.from(t.neighborhood.slice(t.starts[n],t.starts[n+1])).map((function(e){return t.nodes[e]}))})),e},gh.prototype.collect=function(t){var e,r,n={};for(e=0,r=t.length;e<r;e++)n[this.nodes[e]]=t[e];return n},gh.prototype.assign=function(t,e){var r=0;this.graph.updateEachNodeAttributes((function(n,i){return i[t]=e[r++],i}),{attributes:[t]})},dh.NeighborhoodIndex=gh,ph.prototype.bounds=gh.prototype.bounds,ph.prototype.project=gh.prototype.project,ph.prototype.collect=gh.prototype.collect,ph.prototype.assign=gh.prototype.assign,dh.WeightedNeighborhoodIndex=ph;var yh=Gs,vh=Vs,mh=uh,bh=bi,wh=dh,Eh=wh.NeighborhoodIndex,Ah=wh.WeightedNeighborhoodIndex;function xh(t,e){return t[0]>e[0]?1:t[0]<e[0]?-1:t[1]>e[1]?1:t[1]<e[1]?-1:t[2]>e[2]?1:t[2]<e[2]?-1:t[3]>e[3]?1:t[3]<e[3]?-1:0}ks.createUnweightedIndexedBrandes=function(t){var e=new Eh(t),r=e.neighborhood,n=e.starts,i=t.order,o=new vh(bh.getPointerArray(i),i),a=new Uint32Array(i),s=new Array(i),h=new Int32Array(i),u=new yh(Uint32Array,i),d=function(t){var e,d,c,l,f,g,p;for(g=0;g<i;g++)s[g]=[],a[g]=0,h[g]=-1;for(a[t]=1,h[t]=0,u.push(t);0!==u.size;)for(g=u.shift(),o.push(g),e=h[g],d=a[g],c=n[g],l=n[g+1],f=c;f<l;f++)p=r[f],-1===h[p]&&(u.push(p),h[p]=e+1),h[p]===e+1&&(a[p]+=d,s[p].push(g));return[o,s,a]};return d.index=e,d},ks.createDijkstraIndexedBrandes=function(t,e){var r=new Ah(t,e||"weight"),n=r.neighborhood,i=r.weights,o=r.starts,a=t.order,s=new vh(bh.getPointerArray(a),a),h=new Uint32Array(a),u=new Array(a),d=new Float64Array(a),c=new Float64Array(a),l=new mh(xh),f=function(t){var e,r,f,g,p,y,v,m,b,w=0;for(m=0;m<a;m++)u[m]=[],h[m]=0,d[m]=-1,c[m]=-1;for(h[t]=1,c[t]=0,l.push([0,w++,t,t]);0!==l.size;)if(g=(f=l.pop())[0],p=f[2],m=f[3],-1===d[m])for(s.push(m),d[m]=g,h[m]+=h[p],e=o[m],r=o[m+1],v=e;v<r;v++)b=n[v],y=g+i[v],-1===d[b]&&(-1===c[b]||y<c[b])?(c[b]=y,l.push([y,w++,m,b]),h[b]=0,u[b]=[m]):y===c[b]&&(h[b]+=h[m],u[b].push(m));return[s,u,h]};return f.index=r,f};var zh=i,Mh=ks,Sh=E,Dh=Mh.createUnweightedIndexedBrandes,Nh=Mh.createDijkstraIndexedBrandes,kh={nodeCentralityAttribute:"betweennessCentrality",getEdgeWeight:"weight",normalized:!0};function Ch(t,e,r){if(!zh(e))throw new Error("graphology-centrality/beetweenness-centrality: the given graph is not a valid graphology instance.");var n,i,o,a,s,h,u,d,c,l,f=(r=Sh(r,kh)).nodeCentralityAttribute,g=r.normalized,p=r.getEdgeWeight?Nh(e,r.getEdgeWeight):Dh(e),y=e.order,v=new Float64Array(y),m=new Float64Array(y);for(h=0;h<y;h++){for(i=(n=p(h))[0],o=n[1],a=n[2],u=i.size;u--;)v[i.items[i.size-u]]=0;for(;0!==i.size;){for(s=(1+v[l=i.pop()])/a[l],u=0,d=o[l].length;u<d;u++)v[c=o[l][u]]+=a[c]*s;l!==h&&(m[l]+=v[l])}}var b=null;if(null!==(b=g?y<=2?null:1/((y-1)*(y-2)):"undirected"===e.type?.5:null))for(h=0;h<y;h++)m[h]*=b;return t?p.index.assign(f,m):p.index.collect(m)}var Oh=Ch.bind(null,!1);Oh.assign=Ch.bind(null,!0);var Wh=Oh,jh=mi,_h=bi.getPointerArray;function Ph(t){var e=_h(t);this.size=0,this.length=t,this.dense=new e(t),this.sparse=new e(t)}Ph.prototype.clear=function(){this.size=0},Ph.prototype.has=function(t){var e=this.sparse[t];return e<this.size&&this.dense[e]===t},Ph.prototype.add=function(t){var e=this.sparse[t];return e<this.size&&this.dense[e]===t||(this.dense[this.size]=t,this.sparse[t]=this.size,this.size++),this},Ph.prototype.delete=function(t){var e=this.sparse[t];return!(e>=this.size||this.dense[e]!==t)&&(e=this.dense[this.size-1],this.dense[this.sparse[t]]=e,this.sparse[e]=this.sparse[t],this.size--,!0)},Ph.prototype.forEach=function(t,e){var r;e=arguments.length>1?e:this;for(var n=0;n<this.size;n++)r=this.dense[n],t.call(e,r,r)},Ph.prototype.values=function(){var t=this.size,e=this.dense,r=0;return new jh((function(){if(r<t){var n=e[r];return r++,{value:n}}return{done:!0}}))},"undefined"!=typeof Symbol&&(Ph.prototype[Symbol.iterator]=Ph.prototype.values),Ph.prototype.inspect=function(){for(var t=new Set,e=0;e<this.size;e++)t.add(this.dense[e]);return Object.defineProperty(t,"constructor",{value:Ph,enumerable:!1}),t.length=this.length,t},"undefined"!=typeof Symbol&&(Ph.prototype[Symbol.for("nodejs.util.inspect.custom")]=Ph.prototype.inspect);var Uh=i,Ih=E,Fh=Gs,Th=Ph,Lh=dh.NeighborhoodIndex,Rh={nodeCentralityAttribute:"closenessCentrality",wassermanFaust:!1};function Gh(t){this.index=new Lh(t,"inbound"),this.queue=new Fh(Array,t.order),this.seen=new Th(t.order)}function qh(t,e,r){if(!Uh(e))throw new Error("graphology-metrics/centrality/closeness: the given graph is not a valid graphology instance.");var n,i,o,a,s,h=(r=Ih(r,Rh)).wassermanFaust,u=new Gh(e),d=e.order,c=new Float64Array(d);for(n=0;n<d;n++)o=(i=u.fromNode(n))[0],s=0,(a=i[1])>0&&d>1&&(s=o/a,h&&(s*=o/(d-1))),c[n]=s;return t?u.index.assign(r.nodeCentralityAttribute,c):u.index.collect(c)}Gh.prototype.fromNode=function(t){var e,r,n,i,o,a,s=this.index,h=this.queue,u=this.seen;u.clear(),h.clear(),u.add(t),h.push([t,0]);for(var d=0,c=0;0!==h.size;)for(r=(e=h.shift())[0],0!==(n=e[1])&&(d+=n,c+=1),o=s.starts[r+1],i=s.starts[r];i<o;i++)a=s.neighborhood[i],u.has(a)||(u.add(a),h.push([a,n+1]));return[c,d]};var Bh=qh.bind(null,!1);Bh.assign=qh.bind(null,!0);var Hh=Bh,Vh=i,Yh=E,Kh=dh.WeightedNeighborhoodIndex,$h={nodeCentralityAttribute:"eigenvectorCentrality",getEdgeWeight:"weight",maxIterations:100,tolerance:1e-6};function Xh(t){for(var e=0,r=0,n=0,i=t.length;n<i;n++){var o=Math.abs(t[n]);o>e&&(r*=e/o*(e/o),e=o),r+=0===o&&0===e?0:o/e*(o/e)}return e===1/0?1:e*Math.sqrt(r)}function Jh(t,e,r){if(!Vh(e))throw new Error("graphology-metrics/centrality/eigenvector: the given graph is not a valid graphology instance.");var n,i,o,a,s=(r=Yh(r,$h)).maxIterations,h=r.tolerance,u=e.order,d=new Kh(e,r.getEdgeWeight),c=new Float64Array(e.order);for(n=0;n<u;n++)c[n]=1/u;for(var l,f,g,p=0,y=0,v=!1;p<s;){for(f=c,c=new Float64Array(f),n=0;n<u;n++)for(o=d.starts[n+1],i=d.starts[n];i<o;i++)l=d.neighborhood[i],a=d.weights[i],c[l]+=f[n]*a;for(g=Xh(c),n=0;n<u;n++)c[n]/=g;for(y=0,n=0;n<u;n++)y+=Math.abs(c[n]-f[n]);if(y<u*h){v=!0;break}p++}if(!v)throw Error("graphology-metrics/centrality/eigenvector: failed to converge.");if(!t)return d.collect(c);d.assign(r.nodeCentralityAttribute,c)}var Qh=Jh.bind(null,!1);Qh.assign=Jh.bind(null,!0);var Zh=Qh,tu=E,eu=i,ru=Wi.createEdgeWeightGetter,nu={nodeAuthorityAttribute:"authority",nodeHubAttribute:"hub",getEdgeWeight:"weight",maxIterations:100,normalize:!0,tolerance:1e-8};function iu(t,e){var r,n,i=Object.create(null);for(r=0,n=t.length;r<n;r++)i[t[r]]=e;return i}function ou(t){var e=0;for(var r in t)e+=t[r];return e}function au(t,e,r){if(!eu(e))throw new Error("graphology-hits: the given graph is not a valid graphology instance.");if(e.multi)throw new Error("graphology-hits: the HITS algorithm does not work with MultiGraphs.");r=tu(r,nu);var n,i,o,a,s,h,u,d,c,l,f,g,p,y,v=ru(r.getEdgeWeight).fromEntry,m=e.order,b=e.nodes(),w=iu(b,1/m),E={},A=!1;for(e.forEachEdge((function(t,e,r,n,i,o,a){E[t]=v(t,e,r,n,i,o,a)})),u=0;u<r.maxIterations;u++){for(i=w,w=iu(b,0),o=iu(b,0),c=0,d=0,g=0;g<m;g++)for(a=b[g],p=0,y=(n=e.outboundEdges(a)).length;p<y;p++)h=n[p],s=e.opposite(a,h),o[s]+=i[a]*E[h],o[s]>d&&(d=o[s]);for(g=0;g<m;g++)for(a=b[g],p=0,y=(n=e.outboundEdges(a)).length;p<y;p++)h=n[p],s=e.opposite(a,h),w[a]+=o[s]*E[h],w[s]>c&&(c=w[s]);for(a in f=1/c,w)w[a]*=f;for(a in f=1/d,o)o[a]*=f;for(a in l=0,w)l+=Math.abs(w[a]-i[a]);if(l<r.tolerance){A=!0;break}}if(!A)throw Error("graphology-metrics/centrality/hits: failed to converge.");if(r.normalize){for(a in f=1/ou(o),o)o[a]*=f;for(a in f=1/ou(w),w)w[a]*=f}if(!t)return{hubs:w,authorities:o};e.updateEachNodeAttributes((function(t,e){return e[r.nodeAuthorityAttribute]=o[t],e[r.nodeHubAttribute]=w[t],e}),{attributes:[r.nodeAuthorityAttribute,r.nodeHubAttribute]})}var su=au.bind(null,!1);su.assign=au.bind(null,!0);var hu=su,uu=i,du=E,cu=dh.WeightedNeighborhoodIndex,lu={nodePagerankAttribute:"pagerank",getEdgeWeight:"weight",alpha:.85,maxIterations:100,tolerance:1e-6};function fu(t,e,r){if(!uu(e))throw new Error("graphology-metrics/centrality/pagerank: the given graph is not a valid graphology instance.");var n,i,o,a,s=(r=du(r,lu)).alpha,h=r.maxIterations,u=r.tolerance,d=r.nodePagerankAttribute,c=e.order,l=1/c,f=new cu(e,r.getEdgeWeight),g=new Float64Array(e.order),p=new Float64Array(f.weights.length),y=[];for(n=0;n<c;n++)for(g[n]=l,o=f.starts[n+1],0===(a=f.outDegrees[n])&&y.push(n),i=f.starts[n];i<o;i++)p[i]=f.weights[i]/a;for(var v,m,b=0,w=0,E=!1;b<h;){for(m=g,g=new Float64Array(e.order),v=0,n=0,o=y.length;n<o;n++)v+=m[y[n]];for(v*=s,n=0;n<c;n++){for(o=f.starts[n+1],i=f.starts[n];i<o;i++)g[f.neighborhood[i]]+=s*m[n]*p[i];g[n]+=v*l+(1-s)*l}for(w=0,n=0;n<c;n++)w+=Math.abs(g[n]-m[n]);if(w<c*u){E=!0;break}b++}if(!E)throw Error("graphology-metrics/centrality/pagerank: failed to converge.");if(!t)return f.collect(g);f.assign(d,g)}var gu=fu.bind(null,!1);gu.assign=fu.bind(null,!0);var pu=gu,yu=xs;As.betweenness=Wh,As.closeness=Hh,As.eigenvector=Zh,As.hits=hu,As.pagerank=pu,As.degree=yu.degreeCentrality,As.inDegree=yu.inDegreeCentrality,As.outDegree=yu.outDegreeCentrality;var vu={},mu=i,bu=yi,wu=E,Eu=Wi.createEdgeWeightGetter,Au={edgeDisparityAttribute:"disparity",getEdgeWeight:"weight"};function xu(t,e,r){if(!mu(e))throw new Error("graphology-metrics/edge/disparity: the given graph is not a valid graphology instance.");if(e.multi||"mixed"===bu(e))throw new Error("graphology-metrics/edge/disparity: not defined for multi nor mixed graphs.");r=wu(r,Au);var n,i,o,a=Eu(r.getEdgeWeight).fromEntry,s={};e.forEachNode((function(t){s[t]=0})),e.forEachEdge((function(t,e,r,n,i,o,h){var u=a(t,e,r,n,i,o,h);s[r]+=u,s[n]+=u}));var h={};if(e.forEachAssymetricAdjacencyEntry((function(t,r,u,d,c,l,f){var g=a(c,l,t,r,u,d,f);n!==t&&(n=t,i=e.degree(t),o=s[t]);var p=e.degree(r),y=s[r],v=g/o,m=g/y,b=Math.pow(1-v,i-1),w=Math.pow(1-m,p-1);h[c]=Math.min(b,w)})),!t)return h;e.updateEachEdgeAttributes((function(t,e){return e[r.edgeDisparityAttribute]=h[t],e}),{attributes:[r.edgeDisparityAttribute]})}var zu=xu.bind(null,!1);zu.assign=xu.bind(null,!0);var Mu=zu,Su={};!function(t){t.intersection=function(){if(arguments.length<2)throw new Error("mnemonist/Set.intersection: needs at least two arguments.");var t,e,r=new Set,n=1/0,i=null,o=arguments.length;for(e=0;e<o;e++){if(0===(t=arguments[e]).size)return r;t.size<n&&(n=t.size,i=t)}for(var a,s,h,u,d=i.values();!(a=d.next()).done;){for(s=a.value,h=!0,e=0;e<o;e++)if((u=arguments[e])!==i&&!u.has(s)){h=!1;break}h&&r.add(s)}return r},t.union=function(){if(arguments.length<2)throw new Error("mnemonist/Set.union: needs at least two arguments.");var t,e,r,n=new Set,i=arguments.length;for(t=0;t<i;t++)for(e=arguments[t].values();!(r=e.next()).done;)n.add(r.value);return n},t.difference=function(t,e){if(!t.size)return new Set;if(!e.size)return new Set(t);for(var r,n=new Set,i=t.values();!(r=i.next()).done;)e.has(r.value)||n.add(r.value);return n},t.symmetricDifference=function(t,e){for(var r,n=new Set,i=t.values();!(r=i.next()).done;)e.has(r.value)||n.add(r.value);for(i=e.values();!(r=i.next()).done;)t.has(r.value)||n.add(r.value);return n},t.isSubset=function(t,e){var r,n=t.values();if(t===e)return!0;if(t.size>e.size)return!1;for(;!(r=n.next()).done;)if(!e.has(r.value))return!1;return!0},t.isSuperset=function(e,r){return t.isSubset(r,e)},t.add=function(t,e){for(var r,n=e.values();!(r=n.next()).done;)t.add(r.value)},t.subtract=function(t,e){for(var r,n=e.values();!(r=n.next()).done;)t.delete(r.value)},t.intersect=function(t,e){for(var r,n=t.values();!(r=n.next()).done;)e.has(r.value)||t.delete(r.value)},t.disjunct=function(t,e){for(var r,n=t.values(),i=[];!(r=n.next()).done;)e.has(r.value)&&i.push(r.value);for(n=e.values();!(r=n.next()).done;)t.has(r.value)||t.add(r.value);for(var o=0,a=i.length;o<a;o++)t.delete(i[o])},t.intersectionSize=function(t,e){var r;if(t.size>e.size&&(r=t,t=e,e=r),0===t.size)return 0;if(t===e)return t.size;for(var n,i=t.values(),o=0;!(n=i.next()).done;)e.has(n.value)&&o++;return o},t.unionSize=function(e,r){var n=t.intersectionSize(e,r);return e.size+r.size-n},t.jaccard=function(e,r){var n=t.intersectionSize(e,r);return 0===n?0:n/(e.size+r.size-n)},t.overlap=function(e,r){var n=t.intersectionSize(e,r);return 0===n?0:n/Math.min(e.size,r.size)}}(Su);var Du=i,Nu=Su.intersectionSize;function ku(t,e){if(!Du(e))throw new Error("graphology-metrics/simmelian-strength: given graph is not a valid graphology instance.");var r={};if(e.forEachNode((function(t){r[t]=new Set(e.neighbors(t))})),!t){var n={};return e.forEachEdge((function(t,e,i,o){n[t]=Nu(r[i],r[o])})),n}e.updateEachEdgeAttributes((function(t,e,n,i){return e.simmelianStrength=Nu(r[n],r[i]),e}),{attributes:["simmelianStrength"]})}var Cu=ku.bind(null,!1);Cu.assign=ku.bind(null,!0);var Ou=Cu;vu.disparity=Mu,vu.simmelianStrength=Ou;var Wu={},ju={},_u=i;ju.nodeExtent=function(t,e){if(!_u(t))throw new Error("graphology-metrics/extent: the given graph is not a valid graphology instance.");var r,n,i,o=[].concat(e),a={};for(i=0;i<o.length;i++)n=o[i],a[n]=[1/0,-1/0];return t.forEachNode((function(t,e){for(i=0;i<o.length;i++)n=o[i],(r=e[n])<a[n][0]&&(a[n][0]=r),r>a[n][1]&&(a[n][1]=r)})),"string"==typeof e?a[e]:a},ju.edgeExtent=function(t,e){if(!_u(t))throw new Error("graphology-metrics/extent: the given graph is not a valid graphology instance.");var r,n,i,o=[].concat(e),a={};for(i=0;i<o.length;i++)n=o[i],a[n]=[1/0,-1/0];return t.forEachEdge((function(t,e){for(i=0;i<o.length;i++)n=o[i],(r=e[n])<a[n][0]&&(a[n][0]=r),r>a[n][1]&&(a[n][1]=r)})),"string"==typeof e?a[e]:a};var Pu={},Uu=mi,Iu=Ps;function Fu(){this.clear()}Fu.prototype.clear=function(){this.items=[],this.offset=0,this.size=0},Fu.prototype.enqueue=function(t){return this.items.push(t),++this.size},Fu.prototype.dequeue=function(){if(this.size){var t=this.items[this.offset];return 2*++this.offset>=this.items.length&&(this.items=this.items.slice(this.offset),this.offset=0),this.size--,t}},Fu.prototype.peek=function(){if(this.size)return this.items[this.offset]},Fu.prototype.forEach=function(t,e){e=arguments.length>1?e:this;for(var r=this.offset,n=0,i=this.items.length;r<i;r++,n++)t.call(e,this.items[r],n,this)},Fu.prototype.toArray=function(){return this.items.slice(this.offset)},Fu.prototype.values=function(){var t=this.items,e=this.offset;return new Uu((function(){if(e>=t.length)return{done:!0};var r=t[e];return e++,{value:r,done:!1}}))},Fu.prototype.entries=function(){var t=this.items,e=this.offset,r=0;return new Uu((function(){if(e>=t.length)return{done:!0};var n=t[e];return e++,{value:[r++,n],done:!1}}))},"undefined"!=typeof Symbol&&(Fu.prototype[Symbol.iterator]=Fu.prototype.values),Fu.prototype.toString=function(){return this.toArray().join(",")},Fu.prototype.toJSON=function(){return this.toArray()},Fu.prototype.inspect=function(){var t=this.toArray();return Object.defineProperty(t,"constructor",{value:Fu,enumerable:!1}),t},"undefined"!=typeof Symbol&&(Fu.prototype[Symbol.for("nodejs.util.inspect.custom")]=Fu.prototype.inspect),Fu.from=function(t){var e=new Fu;return Iu(t,(function(t){e.enqueue(t)})),e},Fu.of=function(){return Fu.from(arguments)};var Tu=i,Lu=Fu,Ru=function(t,e){var r=e.length;if(0!==r){var n=t.length;t.length+=r;for(var i=0;i<r;i++)t[n+i]=e[i]}};function Gu(t,e,r){if(!Tu(e))throw new Error("graphology-shortest-path: invalid graphology instance.");if(!e.hasNode(r))throw new Error('graphology-shortest-path: the "'+r+'" source node does not exist in the given graph.');r=""+r;var n=new Set,i={},o=0;i[r]=0;for(var a,s,h,u=[r];0!==u.length;){var d=[];for(a=0,s=u.length;a<s;a++)h=u[a],n.has(h)||(n.add(h),Ru(d,e[t](h)),i[h]=o);o++,u=d}return i}var qu=Gu.bind(null,"outboundNeighbors"),Bu=Gu.bind(null,"neighbors");Pu.bidirectional=function(t,e,r){if(!Tu(t))throw new Error("graphology-shortest-path: invalid graphology instance.");if(arguments.length<3)throw new Error("graphology-shortest-path: invalid number of arguments. Expecting at least 3.");if(!t.hasNode(e))throw new Error('graphology-shortest-path: the "'+e+'" source node does not exist in the given graph.');if(!t.hasNode(r))throw new Error('graphology-shortest-path: the "'+r+'" target node does not exist in the given graph.');if((e=""+e)===(r=""+r))return[e];var n=t.inboundNeighbors.bind(t),i=t.outboundNeighbors.bind(t),o={},a={};o[e]=null,a[r]=null;var s,h,u,d,c,l,f,g,p=[e],y=[r],v=!1;t:for(;p.length&&y.length;)if(p.length<=y.length){for(s=p,p=[],c=0,f=s.length;c<f;c++)for(l=0,g=(u=i(h=s[c])).length;l<g;l++)if((d=u[l])in o||(p.push(d),o[d]=h),d in a){v=!0;break t}}else for(s=y,y=[],c=0,f=s.length;c<f;c++)for(l=0,g=(u=n(h=s[c])).length;l<g;l++)if((d=u[l])in a||(y.push(d),a[d]=h),d in o){v=!0;break t}if(!v)return null;for(var m=[];d;)m.unshift(d),d=o[d];for(d=a[m[m.length-1]];d;)m.push(d),d=a[d];return m.length?m:null},Pu.singleSource=function(t,e){if(!Tu(t))throw new Error("graphology-shortest-path: invalid graphology instance.");if(arguments.length<2)throw new Error("graphology-shortest-path: invalid number of arguments. Expecting at least 2.");if(!t.hasNode(e))throw new Error('graphology-shortest-path: the "'+e+'" source node does not exist in the given graph.');var r,n,i,o,a,s,h={},u={};for(h[e=""+e]=!0,u[e]=[e];Object.keys(h).length;)for(i in r=h,h={},r)for(a=0,s=(n=t.outboundNeighbors(i)).length;a<s;a++)u[o=n[a]]||(u[o]=u[i].concat(o),h[o]=!0);return u},Pu.singleSourceLength=qu,Pu.undirectedSingleSourceLength=Bu,Pu.brandes=function(t,e){e=""+e;var r,n,i,o,a,s,h,u,d,c=[],l={},f={},g=t.nodes();for(s=0,u=g.length;s<u;s++)l[o=g[s]]=[],f[o]=0;var p={};f[e]=1,p[e]=0;for(var y=Lu.of(e);y.size;)for(o=y.dequeue(),c.push(o),r=p[o],n=f[o],h=0,d=(i=t.outboundNeighbors(o)).length;h<d;h++)(a=i[h])in p||(y.enqueue(a),p[a]=r+1),p[a]===r+1&&(f[a]+=n,l[a].push(o));return[c,l,f]};var Hu=i,Vu=Pu.singleSourceLength,Yu=function(t,e){if(!Hu(t))throw new Error("graphology-metrics/eccentricity: given graph is not a valid graphology instance.");if(0===t.size)return 1/0;var r,n,i=-1/0,o=Vu(t,e),a=0;for(r in o)(n=o[r])>i&&(i=n),a++;return a<t.order?1/0:i},Ku=i,$u=Yu,Xu=E,Ju=i,Qu=yi,Zu=Wi,td={getNodeCommunity:"community",getEdgeWeight:"weight",resolution:1};function ed(t,e){var r,n,i,o,a,s,h=e.resolution,u=function(t,e){var r=new Array(t.order),n=new Float64Array(t.order),i={},o=0,a=Zu.createEdgeWeightGetter(e.getEdgeWeight).fromEntry,s=Zu.createNodeValueGetter(e.getNodeCommunity).fromEntry,h=0,u={};return t.forEachNode((function(t,e){u[t]=h,r[h++]=s(t,e)})),t.forEachUndirectedEdge((function(t,e,r,s,h,d,c){var l=a(t,e,r,s,h,d,c);o+=l,i[t]=l,n[u[r]]+=l,r!==s&&(n[u[s]]+=l)})),{weights:i,communities:r,weightedDegrees:n,M:o}}(t,e),d=u.communities,c=u.weightedDegrees,l=u.M,f=t.nodes(),g=0,p=2*l;for(r=0,i=t.order;r<i;r++)for(n=0;n<i;n++)d[r]===d[n]&&(s=t.undirectedEdge(f[r],f[n]),o=u.weights[s]||0,a=c[r]*c[n],g+=r===n&&void 0!==s?2*(o-a/p*h):o-a/p*h);return g/p}function rd(t,e){var r,n,i,o,a=e.resolution,s=function(t,e){var r=new Array(t.order),n=new Float64Array(t.order),i=new Float64Array(t.order),o={},a=0,s=Zu.createEdgeWeightGetter(e.getEdgeWeight).fromEntry,h=Zu.createNodeValueGetter(e.getNodeCommunity).fromEntry,u=0,d={};return t.forEachNode((function(t,e){d[t]=u,r[u++]=h(t,e)})),t.forEachDirectedEdge((function(t,e,r,h,u,c,l){var f=s(t,e,r,h,u,c,l);a+=f,o[t]=f,i[d[r]]+=f,n[d[h]]+=f})),{weights:o,communities:r,weightedInDegrees:n,weightedOutDegrees:i,M:a}}(t,e),h=s.communities,u=s.weightedInDegrees,d=s.weightedOutDegrees,c=s.M,l=t.nodes(),f=0;for(r=0,i=t.order;r<i;r++)for(n=0;n<i;n++)h[r]===h[n]&&(o=t.directedEdge(l[r],l[n]),f+=(s.weights[o]||0)-u[r]*d[n]/c*a);return f/c}function nd(t,e){var r=e.resolution,n=function(t,e){var r={},n={},i={},o=Zu.createNodeValueGetter(e.getNodeCommunity).fromEntry;return t.forEachNode((function(t,e){var a=o(t,e);if(r[t]=a,void 0===a)throw new Error('graphology-metrics/modularity: the "'+t+'" node is not in the partition.');n[a]=0,i[a]=0})),{communities:r,totalWeights:n,internalWeights:i}}(t,e),i=0,o=n.totalWeights,a=n.internalWeights,s=n.communities,h=Zu.createEdgeWeightGetter(e.getEdgeWeight).fromEntry;t.forEachUndirectedEdge((function(t,e,r,n,u,d,c){var l=h(t,e,r,n,u,d,c);i+=l;var f=s[r],g=s[n];o[f]+=l,o[g]+=l,f===g&&(a[f]+=2*l)}));var u=0,d=2*i;for(var c in a)u+=a[c]/d-Math.pow(o[c]/d,2)*r;return u}function id(t,e){var r=e.resolution,n=function(t,e){var r={},n={},i={},o={},a=Zu.createNodeValueGetter(e.getNodeCommunity).fromEntry;return t.forEachNode((function(t,e){var s=a(t,e);if(r[t]=s,void 0===s)throw new Error('graphology-metrics/modularity: the "'+t+'" node is not in the partition.');n[s]=0,i[s]=0,o[s]=0})),{communities:r,totalInWeights:n,totalOutWeights:i,internalWeights:o}}(t,e),i=0,o=n.totalInWeights,a=n.totalOutWeights,s=n.internalWeights,h=n.communities,u=Zu.createEdgeWeightGetter(e.getEdgeWeight).fromEntry;t.forEachDirectedEdge((function(t,e,r,n,d,c,l){var f=u(t,e,r,n,d,c,l);i+=f;var g=h[r],p=h[n];a[g]+=f,o[p]+=f,g===p&&(s[g]+=f)}));var d=0;for(var c in s)d+=s[c]/i-o[c]*a[c]/Math.pow(i,2)*r;return d}function od(t,e){if(!Ju(t))throw new Error("graphology-metrics/modularity: given graph is not a valid graphology instance.");if(0===t.size)throw new Error("graphology-metrics/modularity: cannot compute modularity of an empty graph.");if(t.multi)throw new Error("graphology-metrics/modularity: cannot compute modularity of a multi graph. Cast it to a simple one beforehand.");var r=Qu(t);if("mixed"===r)throw new Error("graphology-metrics/modularity: cannot compute modularity of a mixed graph.");return e=Xu(e,td),"directed"===r?id(t,e):nd(t,e)}var ad=od;ad.sparse=od,ad.dense=function(t,e){if(!Ju(t))throw new Error("graphology-metrics/modularity: given graph is not a valid graphology instance.");if(0===t.size)throw new Error("graphology-metrics/modularity: cannot compute modularity of an empty graph.");if(t.multi)throw new Error("graphology-metrics/modularity: cannot compute modularity of a multi graph. Cast it to a simple one beforehand.");var r=Qu(t);if("mixed"===r)throw new Error("graphology-metrics/modularity: cannot compute modularity of a mixed graph.");return e=Xu(e,td),"directed"===r?rd(t,e):ed(t,e)},ad.undirectedDelta=function(t,e,r,n){return n/(2*t)-e*r/(t*t*2)},ad.directedDelta=function(t,e,r,n,i,o){return o/t-(i*e+n*r)/(t*t)};var sd=ad,hd=i,ud=Wi.createEdgeWeightGetter,dd=jo,cd=ju;Wu.diameter=function(t){if(!Ku(t))throw new Error("graphology-metrics/diameter: given graph is not a valid graphology instance.");if(0===t.size)return 1/0;var e=-1/0;return t.someNode((function(r){var n=$u(t,r);return n>e&&(e=n),e===1/0})),e},Wu.modularity=sd,Wu.simpleSize=Po,Wu.weightedSize=function(t,e){if(!hd(t))throw new Error("graphology-metrics/weighted-size: the given graph is not a valid graphology instance.");e=ud(e||"weight").fromEntry;var r=0;return t.forEachEdge((function(t,n,i,o,a,s,h){r+=e(t,n,i,o,a,s,h)})),r},Wu.abstractDensity=dd.abstractDensity,Wu.density=dd.density,Wu.directedDensity=dd.directedDensity,Wu.undirectedDensity=dd.undirectedDensity,Wu.mixedDensity=dd.mixedDensity,Wu.multiDirectedDensity=dd.multiDirectedDensity,Wu.multiUndirectedDensity=dd.multiUndirectedDensity,Wu.multiMixedDensity=dd.multiMixedDensity,Wu.nodeExtent=cd.nodeExtent,Wu.edgeExtent=cd.edgeExtent;var ld={},fd=i;var gd=Ys,pd=uh,yd=gd.DEFAULT_COMPARATOR,vd=gd.reverseComparator;function md(t,e,r,n){for(var i,o=r,a=n,s=e[n],h=2*n+1;h<o;)(i=h+1)<o&&t(e[h],e[i])>=0&&(h=i),e[n]=e[h],h=2*(n=h)+1;e[n]=s,pd.siftDown(t,e,a,n)}function bd(t,e,r,n){for(var i,o,a=n,s=new t(n);a>0;)i=r[--a],0!==a&&(o=r[0],r[0]=i,md(e,r,--n,0),i=o),s[a]=i;return s}function wd(t,e,r){if(2===arguments.length&&(r=e,e=null),this.ArrayClass=t,this.capacity=r,this.items=new t(r),this.clear(),this.comparator=e||yd,"number"!=typeof r&&r<=0)throw new Error("mnemonist/FixedReverseHeap.constructor: capacity should be a number > 0.");if("function"!=typeof this.comparator)throw new Error("mnemonist/FixedReverseHeap.constructor: given comparator should be a function.");this.comparator=vd(this.comparator)}wd.prototype.clear=function(){this.size=0},wd.prototype.push=function(t){return this.size<this.capacity?(this.items[this.size]=t,pd.siftDown(this.comparator,this.items,0,this.size),this.size++):this.comparator(t,this.items[0])>0&&pd.replace(this.comparator,this.items,t),this.size},wd.prototype.peek=function(){return this.items[0]},wd.prototype.consume=function(){var t=bd(this.ArrayClass,this.comparator,this.items,this.size);return this.size=0,t},wd.prototype.toArray=function(){return bd(this.ArrayClass,this.comparator,this.items.slice(0,this.size),this.size)},wd.prototype.inspect=function(){var t=this.toArray();return Object.defineProperty(t,"constructor",{value:wd,enumerable:!1}),t},"undefined"!=typeof Symbol&&(wd.prototype[Symbol.for("nodejs.util.inspect.custom")]=wd.prototype.inspect);var Ed=wd,Ad={},xd=new Float64Array(64),zd=new Float64Array(64);Ad.inplaceQuickSort=function(t,e,r){var n,i,o,a,s;for(xd[0]=e,zd[0]=r,i=0;i>=0;)if((o=xd[i])<(a=zd[i]-1)){for(n=t[o];o<a;){for(;t[a]>=n&&o<a;)a--;for(o<a&&(t[o++]=t[a]);t[o]<=n&&o<a;)o++;o<a&&(t[a--]=t[o])}t[o]=n,xd[i+1]=o+1,zd[i+1]=zd[i],zd[i++]=o,zd[i]-xd[i]>zd[i-1]-xd[i-1]&&(s=xd[i],xd[i]=xd[i-1],xd[i-1]=s,s=zd[i],zd[i]=zd[i-1],zd[i-1]=s)}else i--;return t},Ad.inplaceQuickSortIndices=function(t,e,r,n){var i,o,a,s,h,u;for(xd[0]=r,zd[0]=n,o=0;o>=0;)if((a=xd[o])<(s=zd[o]-1)){for(i=t[h=e[a]];a<s;){for(;t[e[s]]>=i&&a<s;)s--;for(a<s&&(e[a++]=e[s]);t[e[a]]<=i&&a<s;)a++;a<s&&(e[s--]=e[a])}e[a]=h,xd[o+1]=a+1,zd[o+1]=zd[o],zd[o++]=a,zd[o]-xd[o]>zd[o-1]-xd[o-1]&&(u=xd[o],xd[o]=xd[o-1],xd[o-1]=u,u=zd[o],zd[o]=zd[o-1],zd[o-1]=u)}else o--;return e};var Md=Cs,Sd=bi,Dd=Ys.createTupleComparator,Nd=Ed,kd=Ad.inplaceQuickSortIndices;function Cd(t,e,r,n){var i,o,a=0;for(i=0;i<t;i++)a+=(o=e[i][r]-n[i])*o;return a}function Od(t,e,r,n){for(var i,o,a,s,h,u,d,c,l=n.length,f=Sd.getPointerArray(l+1),g=new f(l),p=new f(l),y=new f(l),v=[[0,0,r.length,-1,0]],m=0;0!==v.length;)c=(i=v.pop())[0],u=i[1],d=i[2],o=i[3],a=i[4],kd(e[c],r,u,d),h=r[s=u+((l=d-u)>>>1)],g[m]=h,o>-1&&(0===a?p[o]=m+1:y[o]=m+1),c=(c+1)%t,s!==u&&s!==d-1&&v.push([c,s+1,d,m,1]),s!==u&&v.push([c,u,s,m,0]),m++;return{axes:e,labels:n,pivots:g,lefts:p,rights:y}}function Wd(t,e){this.dimensions=t,this.visited=0,this.axes=e.axes,this.labels=e.labels,this.pivots=e.pivots,this.lefts=e.lefts,this.rights=e.rights,this.size=this.labels.length}Wd.prototype.nearestNeighbor=function(t){var e=1/0,r=null,n=this.dimensions,i=this.axes,o=this.pivots,a=this.lefts,s=this.rights,h=0;return function u(d,c){h++;var l=a[c],f=s[c],g=o[c],p=Cd(n,i,g,t);if(!(p<e&&(r=g,e=p,0===p))){var y=i[d][g]-t[d];d=(d+1)%n,y>0?0!==l&&u(d,l-1):0!==f&&u(d,f-1),y*y<e&&(y>0?0!==f&&u(d,f-1):0!==l&&u(d,l-1))}}(0,0),this.visited=h,this.labels[r]};var jd=Dd(3),_d=Dd(2);Wd.prototype.kNearestNeighbors=function(t,e){if(t<=0)throw new Error("mnemonist/kd-tree.kNearestNeighbors: k should be a positive number.");if(1===(t=Math.min(t,this.size)))return[this.nearestNeighbor(e)];var r=new Nd(Array,jd,t),n=this.dimensions,i=this.axes,o=this.pivots,a=this.lefts,s=this.rights,h=0;!function u(d,c){var l=a[c],f=s[c],g=o[c],p=Cd(n,i,g,e);r.push([p,h++,g]);var y=e[d],v=i[d][g],m=y-v;d=(d+1)%n,y<v?0!==l&&u(d,l-1):0!==f&&u(d,f-1),(m*m<r.peek()[0]||r.size<t)&&(y<v?0!==f&&u(d,f-1):0!==l&&u(d,l-1))}(0,0),this.visited=h;for(var u=r.consume(),d=0;d<u.length;d++)u[d]=this.labels[u[d][2]];return u},Wd.prototype.linearKNearestNeighbors=function(t,e){if(t<=0)throw new Error("mnemonist/kd-tree.kNearestNeighbors: k should be a positive number.");t=Math.min(t,this.size);var r,n,i,o=new Nd(Array,_d,t);for(r=0,n=this.size;r<n;r++)i=Cd(this.dimensions,this.axes,this.pivots[r],e),o.push([i,r]);var a=o.consume();for(r=0;r<a.length;r++)a[r]=this.labels[this.pivots[a[r][1]]];return a},Wd.prototype.inspect=function(){var t,e,r,n=new Map;for(n.dimensions=this.dimensions,Object.defineProperty(n,"constructor",{value:Wd,enumerable:!1}),t=0;t<this.size;t++){for(r=new Array(this.dimensions),e=0;e<this.dimensions;e++)r[e]=this.axes[e][t];n.set(this.labels[t],r)}return n},"undefined"!=typeof Symbol&&(Wd.prototype[Symbol.for("nodejs.util.inspect.custom")]=Wd.prototype.inspect),Wd.from=function(t,e){var r=function(t,e){var r,n,i,o,a=e.length,s=new Array(t),h=new Array(a),u=new(Sd.getPointerArray(a))(a),d=!0;for(n=0;n<t;n++){for(r=new Float64Array(a),i=0;i<a;i++)o=e[i],r[i]=o[1][n],d&&(h[i]=o[0],u[i]=i);d=!1,s[n]=r}return{axes:s,ids:u,labels:h}}(e,Md.toArray(t));return new Wd(e,Od(e,r.axes,r.ids,r.labels))},Wd.fromAxes=function(t,e){return e||(e=Sd.indices(t[0].length)),new Wd(t.length,Od(t.length,t,Sd.indices(e.length),e))};var Pd=i,Ud=Wd,Id=Su.intersectionSize,Fd=i,Td=Pu.undirectedSingleSourceLength;ld.edgeUniformity=function(t){if(!fd(t))throw new Error("graphology-metrics/layout-quality/edge-uniformity: given graph is not a valid graphology instance.");if(0===t.size)return 0;var e,r=0,n=0,i=new Float64Array(t.size);t.forEachEdge((function(t,e,o,a,s,h){var u,d,c=(u=s,d=h,Math.sqrt(Math.pow(u.x-d.x,2)+Math.pow(u.y-d.y,2)));i[n++]=c,r+=c}));var o=r/t.size,a=0;for(n=0,e=t.size;n<e;n++)a+=Math.pow(o-i[n],2);var s=a/(t.size*Math.pow(o,2));return Math.sqrt(s)},ld.neighborhoodPreservation=function(t){if(!Pd(t))throw new Error("graphology-metrics/layout-quality/neighborhood-preservation: given graph is not a valid graphology instance.");if(0===t.order)throw new Error("graphology-metrics/layout-quality/neighborhood-preservation: cannot compute stress for a null graph.");if(0===t.size)return 0;var e=[new Float64Array(t.order),new Float64Array(t.order)],r=0;t.forEachNode((function(t,n){e[0][r]=n.x,e[1][r++]=n.y}));var n=Ud.fromAxes(e,t.nodes()),i=0;return t.forEachNode((function(e,r){var o=new Set(t.neighbors(e));if(0!==o.size&&o.size!==t.order-1){var a=n.kNearestNeighbors(o.size+1,[r.x,r.y]);a=new Set(a.slice(1));var s=Id(o,a);i+=s/a.size}else i+=1})),i/t.order},ld.stress=function(t){if(!Fd(t))throw new Error("graphology-metrics/layout-quality/stress: given graph is not a valid graphology instance.");if(0===t.order)throw new Error("graphology-metrics/layout-quality/stress: cannot compute stress for a null graph.");var e,r,n,i,o,a,s,h=new Array(t.order),u=new Array(t.order),d=0,c=4*t.order;t.forEachNode((function(t,e){h[d]=t,u[d++]=e}));var l,f,g=0;for(d=0,r=t.order;d<r;d++)for(o=Td(t,h[d]),n=u[d],e=d+1;e<r;e++)i=u[e],void 0===(a=o[h[e]])&&(a=c),l=n,f=i,s=Math.sqrt(Math.pow(l.x-f.x,2)+Math.pow(l.y-f.y,2)),g+=1/(a*a)*Math.pow(s-a,2);return g};var Ld={},Rd={},Gd=i;function qd(t,e,r,n,i){if(!Gd(r))throw new Error("graphology-metrics/"+t+": the given graph is not a valid graphology instance.");i=i||"weight";var o=0;return r[e](n,(function(t,e,r,n,a,s,h){var u="function"==typeof i?i(t,e,r,n,a,s,h):e[i];("number"!=typeof u||isNaN(u))&&(u=1),o+=u})),o}Rd.weightedDegree=qd.bind(null,"weightedDegree","forEachEdge"),Rd.weightedInDegree=qd.bind(null,"weightedInDegree","forEachInEdge"),Rd.weightedOutDegree=qd.bind(null,"weightedOutDegree","forEachOutEdge"),Rd.weightedInboundDegree=qd.bind(null,"weightedInboundDegree","forEachInboundEdge"),Rd.weightedOutboundDegree=qd.bind(null,"weightedOutboundDegree","forEachOutboundEdge"),Rd.weightedUndirectedDegree=qd.bind(null,"weightedUndirectedDegree","forEachUndirectedEdge"),Rd.weightedDirectedDegree=qd.bind(null,"weightedDirectedDegree","forEachDirectedEdge");var Bd=Rd;Ld.eccentricity=Yu,Ld.weightedDegree=Bd.weightedDegree,Ld.weightedInDegree=Bd.weightedInDegree,Ld.weightedOutDegree=Bd.weightedOutDegree,Ld.weightedInboundDegree=Bd.weightedInboundDegree,Ld.weightedOutboundDegree=Bd.weightedOutboundDegree,Ld.weightedUndirectedDegree=Bd.weightedUndirectedDegree,Ld.weightedDirectedDegree=Bd.weightedDirectedDegree,Es.centrality=As,Es.edge=vu,Es.graph=Wu,Es.layoutQuality=ld,Es.node=Ld;var Hd=Es,Vd={},Yd=i,Kd=ao.copyNode,$d=so.copyEdge,Xd=i,Jd=so.copyEdge,Qd=i,Zd=ao.copyNode,tc=so.copyEdge,ec=i,rc=so.copyEdge,nc=i,ic=function(t){if(!nc(t))throw new Error("graphology-operators/to-mixed: expecting a valid graphology instance.");return t.copy({type:"mixed"})},oc=i,ac=function(t){if(!oc(t))throw new Error("graphology-operators/to-multi: expecting a valid graphology instance.");return t.copy({multi:!0})},sc=i,hc=so.copyEdge,uc=i,dc=so.copyEdge,cc=i;Vd.disjointUnion=function(t,e){if(!Yd(t)||!Yd(e))throw new Error("graphology-operators/disjoint-union: invalid graph.");if(t.multi!==e.multi)throw new Error("graphology-operators/disjoint-union: both graph should be simple or multi.");var r=t.nullCopy();r.mergeAttributes(t.getAttributes());var n={},i={},o=0;return t.forEachNode((function(t,e){n[t]=o,Kd(r,o,e),o++})),e.forEachNode((function(t,e){i[t]=o,Kd(r,o,e),o++})),o=0,t.forEachEdge((function(t,e,i,a,s,h,u){$d(r,u,o++,n[i],n[a],a,e)})),e.forEachEdge((function(t,e,n,a,s,h,u){$d(r,u,o++,i[n],i[a],a,e)})),r},Vd.reverse=function(t){if(!Xd(t))throw new Error("graphology-operators/reverse: invalid graph.");var e=t.emptyCopy();return t.forEachUndirectedEdge((function(t,r,n,i){Jd(e,!0,t,n,i,r)})),t.forEachDirectedEdge((function(t,r,n,i){Jd(e,!1,t,i,n,r)})),e},Vd.subgraph=function(t,e){if(!Qd(t))throw new Error("graphology-operators/subgraph: invalid graph instance.");var r=t.nullCopy(),n=e;if(Array.isArray(e)){if(0===e.length)return r;e=new Set(e)}if(e instanceof Set){if(0===e.size)return r;n=function(t){return e.has(t)};var i=e;e=new Set,i.forEach((function(t){e.add(""+t)}))}if("function"!=typeof n)throw new Error("graphology-operators/subgraph: invalid nodes. Expecting an array or a set or a filtering function.");if("function"==typeof e){if(t.forEachNode((function(t,e){n(t,e)&&Zd(r,t,e)})),0===r.order)return r}else e.forEach((function(e){if(!t.hasNode(e))throw new Error('graphology-operators/subgraph: the "'+e+'" node was not found in the graph.');Zd(r,e,t.getNodeAttributes(e))}));return t.forEachEdge((function(t,e,i,o,a,s,h){n(i,a)&&(o===i||n(o,s))&&tc(r,h,t,i,o,e)})),r},Vd.toDirected=function(t,e){if(!ec(t))throw new Error("graphology-operators/to-directed: expecting a valid graphology instance.");"function"==typeof e&&(e={mergeEdge:e});var r="function"==typeof(e=e||{}).mergeEdge?e.mergeEdge:null;if("directed"===t.type)return t.copy();var n=t.emptyCopy({type:"directed"});return t.forEachDirectedEdge((function(t,e,r,i){rc(n,!1,t,r,i,e)})),t.forEachUndirectedEdge((function(e,i,o,a){var s=!t.multi&&"mixed"===t.type&&n.edge(o,a),h=!t.multi&&"mixed"===t.type&&n.edge(a,o);s?n.replaceEdgeAttributes(s,r(n.getEdgeAttributes(s),i)):rc(n,!1,null,o,a,i),o!==a&&(h?n.replaceEdgeAttributes(h,r(n.getEdgeAttributes(h),i)):rc(n,!1,null,a,o,i))})),n},Vd.toMixed=ic,Vd.toMulti=ac,Vd.toSimple=function(t,e){if(!sc(t))throw new Error("graphology-operators/to-simple: expecting a valid graphology instance.");"function"==typeof e&&(e={mergeEdge:e});var r="function"==typeof(e=e||{}).mergeEdge?e.mergeEdge:null;if(!t.multi)return t.copy();var n=t.emptyCopy({multi:!1});return t.forEachEdge((function(t,e,i,o,a,s,h){var u=h?n.undirectedEdge(i,o):n.directedEdge(i,o);u?r&&n.replaceEdgeAttributes(u,r(n.getEdgeAttributes(u),e)):hc(n,h,t,i,o,e)})),n},Vd.toUndirected=function(t,e){if(!uc(t))throw new Error("graphology-operators/to-undirected: expecting a valid graphology instance.");"function"==typeof e&&(e={mergeEdge:e});var r="function"==typeof(e=e||{}).mergeEdge?e.mergeEdge:null;if("undirected"===t.type)return t.copy();var n=t.emptyCopy({type:"undirected"});return t.forEachUndirectedEdge((function(t,e,r,i){dc(n,!0,t,r,i,e)})),t.forEachDirectedEdge((function(e,i,o,a){if(!t.multi){var s=n.edge(o,a);if(s)return void(r&&n.replaceEdgeAttributes(s,r(n.getEdgeAttributes(s),i)))}dc(n,!0,null,o,a,i)})),n},Vd.union=function(t,e){if(!cc(t)||!cc(e))throw new Error("graphology-operators/union: invalid graph.");if(t.multi!==e.multi)throw new Error("graphology-operators/union: both graph should be simple or multi.");var r=t.copy();return r.import(e,!0),r};var lc=Vd,fc={},gc={},pc=function(){return!0};gc.edgePathFromNodePath=function(t,e){var r,n,i,o,a=e.length;if(a<2)return n=e[0],(o=t.multi?t.findEdge(n,n,pc):t.edge(n,n))?[o]:[];a--;var s=new Array(a);for(r=0;r<a;r++){if(n=e[r],i=e[r+1],void 0===(o=t.multi?t.findOutboundEdge(n,i,pc):t.edge(n,i)))throw new Error("graphology-shortest-path: given path is impossible in given graph.");s[r]=o}return s};var yc={},vc=i,mc=Wi.createEdgeWeightGetter,bc=uh,wc="weight";function Ec(t,e){return t[0]>e[0]?1:t[0]<e[0]?-1:t[1]>e[1]?1:t[1]<e[1]?-1:t[2]>e[2]?1:t[2]<e[2]?-1:0}function Ac(t,e){return t[0]>e[0]?1:t[0]<e[0]?-1:t[1]>e[1]?1:t[1]<e[1]?-1:t[2]>e[2]?1:t[2]<e[2]?-1:t[3]>e[3]?1:t[3]<e[3]?-1:0}yc.bidirectional=function(t,e,r,n){return function(t,e,r,n){if(e=""+e,r=""+r,!vc(t))throw new Error("graphology-shortest-path/dijkstra: invalid graphology instance.");if(e&&!t.hasNode(e))throw new Error('graphology-shortest-path/dijkstra: the "'+e+'" source node does not exist in the given graph.');if(r&&!t.hasNode(r))throw new Error('graphology-shortest-path/dijkstra: the "'+r+'" target node does not exist in the given graph.');if(n=mc(n||wc).fromMinimalEntry,e===r)return[0,[e]];var i=[{},{}],o=[{},{}],a=[new bc(Ec),new bc(Ec)],s=[{},{}];o[0][e]=[e],o[1][r]=[r],s[0][e]=0,s[1][r]=0;var h,u,d,c,l,f,g,p,y,v=[],m=1/0,b=0,w=1;for(a[0].push([0,b++,e]),a[1].push([0,b++,r]);a[0].size&&a[1].size;)if(c=(h=a[w=1-w].pop())[0],!((l=h[2])in i[w])){if(i[w][l]=c,l in i[1-w])return[m,v];for(p=0,y=(u=1===w?t.inboundEdges(l):t.outboundEdges(l)).length;p<y;p++){if(g=u[p],f=t.opposite(l,g),d=i[w][l]+n(g,t.getEdgeAttributes(g)),f in i[w]&&d<i[w][f])throw Error("graphology-shortest-path/dijkstra: contradictory paths found. Do some of your edges have a negative weight?");(!(f in s[w])||d<s[w][f])&&(s[w][f]=d,a[w].push([d,b++,f]),o[w][f]=o[w][l].concat(f),f in s[0]&&f in s[1]&&(c=s[0][f]+s[1][f],(0===v.length||m>c)&&(m=c,v=o[0][f].concat(o[1][f].slice(0,-1).reverse()))))}}return[1/0,null]}(t,e,r,n)[1]},yc.singleSource=function(t,e,r){var n={};return function(t,e,r,n,i,o){if(!vc(t))throw new Error("graphology-shortest-path/dijkstra: invalid graphology instance.");if(i&&!t.hasNode(i))throw new Error('graphology-shortest-path/dijkstra: the "'+i+'" target node does not exist in the given graph.');r=mc(r||wc).fromMinimalEntry;var a,s,h,u,d,c,l,f,g,p,y,v={},m={},b=new bc(Ec),w=0;for(f=0,p=e.length;f<p;f++)m[u=e[f]]=0,b.push([0,w++,u]),o&&(o[u]=[u]);for(;b.size;)if(l=(s=b.pop())[0],!((u=s[2])in v)){if(v[u]=l,u===i)break;for(g=0,y=(a=t.outboundEdges(u)).length;g<y;g++)if(c=a[g],d=t.opposite(u,c),h=r(c,t.getEdgeAttributes(c))+v[u],!(n&&h>n)){if(d in v&&h<v[d])throw Error("graphology-shortest-path/dijkstra: contradictory paths found. Do some of your edges have a negative weight?");(!(d in m)||h<m[d])&&(m[d]=h,b.push([h,w++,d]),o&&(o[d]=o[u].concat(d)))}}}(t,[e],r,0,null,n),n},yc.brandes=function(t,e,r){e=""+e,r=mc(r||wc).fromMinimalEntry;var n,i,o,a,s,h,u,d,c,l,f=[],g={},p={},y=t.nodes();for(c=0,l=y.length;c<l;c++)g[h=y[c]]=[],p[h]=0;var v={};p[e]=1;var m={};m[e]=0;var b=0,w=new bc(Ac);for(w.push([0,b++,e,e]);w.size;)if(a=(i=w.pop())[0],o=i[2],!((h=i[3])in v))for(p[h]+=p[o],f.push(h),v[h]=a,c=0,l=(n=t.outboundEdges(h)).length;c<l;c++)d=n[c],u=t.opposite(h,d),s=a+r(d,t.getEdgeAttributes(d)),u in v||u in m&&!(s<m[u])?s===m[u]&&(p[u]+=p[h],g[u].push(h)):(m[u]=s,w.push([s,b++,h,u]),p[u]=0,g[u]=[h]);return[f,g,p]};var xc=Pu,zc=gc;fc.unweighted=xc,fc.dijkstra=yc,fc.bidirectional=xc.bidirectional,fc.singleSource=xc.singleSource,fc.singleSourceLength=xc.singleSourceLength,fc.undirectedSingleSourceLength=xc.undirectedSingleSourceLength,fc.brandes=xc.brandes,fc.edgePathFromNodePath=zc.edgePathFromNodePath;var Mc=fc,Sc={},Dc=function(t){return null!==t&&"object"==typeof t&&"function"==typeof t.addUndirectedEdgeWithKey&&"function"==typeof t.dropNode&&"boolean"==typeof t.multi};function Nc(){this.set=new Set,this.stack=[]}function kc(){this.set=new Set,this.stack=[]}function Cc(t,e){var r=[];return t.forEachOutboundEdge(e,(function(t,n,i,o){r.push([t,e===i?o:i])})),r}function Oc(t,e){var r,n={};t.forEachOutboundEdge(e,(function(t,i,o,a){(r=e===o?a:o)in n||(n[r]=[]),n[r].push(t)}));var i=[];for(r in n)i.push([n[r],r]);return i}Nc.prototype.has=function(t){return this.set.has(t)},Nc.prototype.push=function(t){this.stack.push(t),this.set.add(t)},Nc.prototype.pop=function(){this.set.delete(this.stack.pop())},Nc.prototype.path=function(t){return this.stack.concat(t)},Nc.of=function(t,e){var r=new Nc;return e?r.stack.push(t):r.push(t),r},kc.prototype.has=function(t){return this.set.has(t)},kc.prototype.push=function(t){this.stack.push(t),this.set.add(t[1])},kc.prototype.pop=function(){this.set.delete(this.stack.pop()[1])},kc.prototype.path=function(t){return this.stack.slice(1).map((function(t){return t[0]})).concat([t[0]])},kc.of=function(t,e){var r=new kc,n=[null,t];return e?r.stack.push(n):r.push(n),r},Sc.allSimplePaths=function(t,e,r,n){if(!Dc(t))throw new Error("graphology-simple-path.allSimplePaths: expecting a graphology instance.");if(!t.hasNode(e))throw new Error('graphology-simple-path.allSimplePaths: expecting: could not find source node "'+e+'" in the graph.');if(!t.hasNode(r))throw new Error('graphology-simple-path.allSimplePaths: expecting: could not find target node "'+r+'" in the graph.');for(var i,o,a="number"==typeof(n=n||{}).maxDepth?n.maxDepth:1/0,s=(e=""+e)===(r=""+r),h=[t.outboundNeighbors(e)],u=Nc.of(e,s),d=[];0!==h.length;)if(o=h[h.length-1].pop()){if(u.has(o))continue;o===r&&(i=u.path(o),d.push(i)),u.push(o),!u.has(r)&&h.length<a?h.push(t.outboundNeighbors(o)):u.pop()}else h.pop(),u.pop();return d},Sc.allSimpleEdgePaths=function(t,e,r,n){if(!Dc(t))throw new Error("graphology-simple-path.allSimpleEdgePaths: expecting a graphology instance.");if(t.multi)throw new Error("graphology-simple-path.allSimpleEdgePaths: not implemented for multi graphs.");if(!t.hasNode(e))throw new Error('graphology-simple-path.allSimpleEdgePaths: expecting: could not find source node "'+e+'" in the graph.');if(!t.hasNode(r))throw new Error('graphology-simple-path.allSimpleEdgePaths: expecting: could not find target node "'+r+'" in the graph.');for(var i,o,a,s="number"==typeof(n=n||{}).maxDepth?n.maxDepth:1/0,h=(e=""+e)===(r=""+r),u=[Cc(t,e)],d=kc.of(e,h),c=[];0!==u.length;)if(o=u[u.length-1].pop()){if(a=o[1],d.has(a))continue;a===r&&(i=d.path(o),c.push(i)),d.push(o),!d.has(r)&&u.length<s?u.push(Cc(t,a)):d.pop()}else u.pop(),d.pop();return c},Sc.allSimpleEdgeGroupPaths=function(t,e,r,n){if(!Dc(t))throw new Error("graphology-simple-path.allSimpleEdgeGroupPaths: expecting a graphology instance.");if(!t.hasNode(e))throw new Error('graphology-simple-path.allSimpleEdgeGroupPaths: expecting: could not find source node "'+e+'" in the graph.');if(!t.hasNode(r))throw new Error('graphology-simple-path.allSimpleEdgeGroupPaths: expecting: could not find target node "'+r+'" in the graph.');for(var i,o,a,s="number"==typeof(n=n||{}).maxDepth?n.maxDepth:1/0,h=(e=""+e)===(r=""+r),u=[Oc(t,e)],d=kc.of(e,h),c=[];0!==u.length;)if(o=u[u.length-1].pop()){if(a=o[1],d.has(a))continue;a===r&&(i=d.path(o),c.push(i)),d.push(o),!d.has(r)&&u.length<s?u.push(Oc(t,a)):d.pop()}else u.pop(),d.pop();return c};var Wc=Sc,jc={},_c={},Pc=Gs;function Uc(t){this.graph=t,this.queue=new Pc(Array,t.order),this.seen=new Set,this.size=0}Uc.prototype.hasAlreadySeenEverything=function(){return this.seen.size===this.graph.order},Uc.prototype.countUnseenNodes=function(){return this.graph.order-this.seen.size},Uc.prototype.forEachNodeYetUnseen=function(t){var e=this.seen,r=this.graph;r.someNode((function(n,i){return e.size===r.order||!e.has(n)&&!!t(n,i)}))},Uc.prototype.has=function(t){return this.seen.has(t)},Uc.prototype.push=function(t){var e=this.seen.size;return this.seen.add(t),e!==this.seen.size&&(this.queue.push(t),this.size++,!0)},Uc.prototype.pushWith=function(t,e){var r=this.seen.size;return this.seen.add(t),r!==this.seen.size&&(this.queue.push(e),this.size++,!0)},Uc.prototype.shift=function(){var t=this.queue.shift();return this.size=this.queue.size,t};var Ic=Uc,Fc={};Fc.TraversalRecord=function(t,e,r){this.node=t,this.attributes=e,this.depth=r},Fc.capitalize=function(t){return t[0].toUpperCase()+t.slice(1)};var Tc=i,Lc=Ic,Rc=Fc,Gc=Rc.TraversalRecord,qc=Rc.capitalize;function Bc(t,e,r,n){if(n=n||{},!Tc(t))throw new Error("graphology-traversal/bfs: expecting a graphology instance.");if("function"!=typeof r)throw new Error("graphology-traversal/bfs: given callback is not a function.");if(0!==t.order){var i,o,a=new Lc(t),s=t["forEach"+qc(n.mode||"outbound")+"Neighbor"].bind(t);i=null===e?a.forEachNodeYetUnseen.bind(a):function(r){r(e=""+e,t.getNodeAttributes(e))},i((function(t,e){for(a.pushWith(t,new Gc(t,e,0));0!==a.size;)o=a.shift(),!0!==r(o.node,o.attributes,o.depth)&&s(o.node,h)}))}function h(t,e){a.pushWith(t,new Gc(t,e,o.depth+1))}}_c.bfs=function(t,e,r){return Bc(t,null,e,r)},_c.bfsFromNode=Bc;var Hc={},Vc=i,Yc=uo,Kc=Fc,$c=Kc.TraversalRecord,Xc=Kc.capitalize;function Jc(t,e,r,n){if(n=n||{},!Vc(t))throw new Error("graphology-traversal/dfs: expecting a graphology instance.");if("function"!=typeof r)throw new Error("graphology-traversal/dfs: given callback is not a function.");if(0!==t.order){var i,o,a=new Yc(t),s=t["forEach"+Xc(n.mode||"outbound")+"Neighbor"].bind(t);i=null===e?a.forEachNodeYetUnseen.bind(a):function(r){r(e=""+e,t.getNodeAttributes(e))},i((function(t,e){for(a.pushWith(t,new $c(t,e,0));0!==a.size;)o=a.pop(),!0!==r(o.node,o.attributes,o.depth)&&s(o.node,h)}))}function h(t,e){a.pushWith(t,new $c(t,e,o.depth+1))}}Hc.dfs=function(t,e,r){return Jc(t,null,e,r)},Hc.dfsFromNode=Jc;var Qc=_c,Zc=Hc;jc.bfs=Qc.bfs,jc.bfsFromNode=Qc.bfsFromNode,jc.dfs=Zc.dfs,jc.dfsFromNode=Zc.dfsFromNode;var tl=jc,el={},rl=i,nl=so.copyEdge,il=so.copyEdge;el.inferMulti=function(t){if(!rl(t))throw new Error("graphology-utils/infer-multi: expecting a valid graphology instance.");if(!t.multi||0===t.order||t.size<2)return!1;var e,r,n,i,o=!1;return t.forEachAssymetricAdjacencyEntry((function(t,a,s,h,u,d,c){o||(c&&t>a&&(i=a,a=t,t=i),t!==e||a!==r||c!==n?(e=t,r=a,n=c):o=!0)})),o},el.inferType=yi,el.isGraph=i,el.isGraphConstructor=o,el.mergeClique=function(t,e){var r,n,i,o,a;if(0!==e.length)for(i=0,a=e.length;i<a;i++)for(r=e[i],o=i+1;o<a;o++)n=e[o],t.mergeEdge(r,n)},el.mergeCycle=function(t,e){var r,n,i,o;if(0!==e.length&&(t.mergeNode(e[0]),1!==e.length)){for(i=1,o=e.length;i<o;i++)r=e[i-1],n=e[i],t.mergeEdge(r,n);t.mergeEdge(n,e[0])}},el.mergePath=function(t,e){var r,n,i,o;if(0!==e.length)for(t.mergeNode(e[0]),i=1,o=e.length;i<o;i++)r=e[i-1],n=e[i],t.mergeEdge(r,n)},el.mergeStar=Ko,el.renameGraphKeys=function(t,e,r){void 0===e&&(e={}),void 0===r&&(r={});var n,i,o=t.nullCopy();return t.forEachNode((function(t,r){var n=e[t];void 0===n&&(n=t),o.addNode(n,r)})),t.forEachAssymetricAdjacencyEntry((function(t,a,s,h,u,d,c){t!==n&&(n=t,void 0===(i=e[t])&&(i=t));var l=e[a];void 0===l&&(l=a);var f=r[u];void 0===f&&(f=u),nl(o,c,f,i,l,d)})),o},el.updateGraphKeys=function(t,e,r){var n,i,o=t.nullCopy();return t.forEachNode((function(t,r){var n=e?e(t,r):t;o.addNode(n,r)})),t.forEachAssymetricAdjacencyEntry((function(t,a,s,h,u,d,c){t!==n&&(n=t,i=e?e(t,s):t);var l=e?e(a,h):a,f=r?r(u,d,t,a,s,h,c):u;il(o,c,f,i,l,d)})),o};var ol=el;const{createNodeValueGetter:al,createEdgeValueGetter:sl}=Wi;var hl={assignLayoutChanges:function(t,e,r){const{nodeXAttribute:n,nodeYAttribute:i}=r;t.updateEachNodeAttributes(((t,r)=>{const o=e[t];return!o||o.fixed||(r[n]=o.x,r[i]=o.y),r}),{attributes:["x","y"]})},collectLayoutChanges:function(t){const e={};for(const r in t){const n=t[r];e[r]={x:n.x,y:n.y}}return e}};const ul=i,dl=E,cl=function(t,e,r){const{nodeXAttribute:n,nodeYAttribute:i}=r,{attraction:o,repulsion:a,gravity:s,inertia:h,maxMove:u}=r.settings;let{shouldSkipNode:d,shouldSkipEdge:c,isNodeFixed:l}=r;l=al(l),d=al(d,!1),c=sl(c,!1);const f=t.filterNodes(((t,e)=>!d.fromEntry(t,e))),g=f.length;for(let r=0;r<g;r++){const o=f[r],a=t.getNodeAttributes(o),s=e[o];e[o]=s?{dx:s.dx*h,dy:s.dy*h,x:a[n]||0,y:a[i]||0}:{dx:0,dy:0,x:a[n]||0,y:a[i]||0}}if(a)for(let t=0;t<g;t++){const r=f[t],n=e[r];for(let r=t+1;r<g;r++){const t=f[r],i=e[t],o=i.x-n.x,s=i.y-n.y,h=Math.sqrt(o*o+s*s)||1,u=a/h*o,d=a/h*s;n.dx-=u,n.dy-=d,i.dx+=u,i.dy+=d}}if(o&&t.forEachEdge(((t,r,n,i,a,s,h)=>{if(n===i)return;if(d.fromEntry(n,a)||d.fromEntry(i,s))return;if(c.fromEntry(t,r,n,i,a,s,h))return;const u=e[n],l=e[i],f=l.x-u.x,g=l.y-u.y,p=Math.sqrt(f*f+g*g)||1,y=o*p*f,v=o*p*g;u.dx+=y,u.dy+=v,l.dx-=y,l.dy-=v})),s)for(let t=0;t<g;t++){const r=f[t],n=e[r],{x:i,y:o}=n,a=Math.sqrt(i*i+o*o)||1;e[r].dx-=i*s*a,e[r].dy-=o*s*a}for(let r=0;r<g;r++){const n=f[r],i=e[n],o=Math.sqrt(i.dx*i.dx+i.dy*i.dy);o>u&&(i.dx*=u/o,i.dy*=u/o),l.fromGraph(t,n)?i.fixed=!0:(i.x+=i.dx,i.y+=i.dy,i.fixed=!1)}return{converged:!1}},ll=hl,fl={nodeXAttribute:"x",nodeYAttribute:"y",isNodeFixed:"fixed",shouldSkipNode:null,shouldSkipEdge:null,settings:{attraction:5e-4,repulsion:.1,gravity:1e-4,inertia:.6,maxMove:200}};function gl(t,e){if(!ul(t))throw new Error("graphology-layout-force/worker: the given graph is not a valid graphology instance.");e=dl(e,fl),this.callbacks={},e.onConverged&&(this.callbacks.onConverged=e.onConverged),this.graph=t,this.params=e,this.nodeStates={},this.frameID=null,this.running=!1,this.killed=!1}gl.prototype.isRunning=function(){return this.running},gl.prototype.runFrame=function(){let{converged:t}=cl(this.graph,this.nodeStates,this.params);ll.assignLayoutChanges(this.graph,this.nodeStates,this.params),t=!1,t?(this.callbacks.onConverged&&this.callbacks.onConverged(),this.stop()):this.frameID=window.requestAnimationFrame((()=>this.runFrame()))},gl.prototype.stop=function(){return this.running=!1,null!==this.frameID&&(window.cancelAnimationFrame(this.frameID),this.frameID=null),this},gl.prototype.start=function(){if(this.killed)throw new Error("graphology-layout-force/worker.start: layout was killed.");this.running||(this.running=!0,this.runFrame())},gl.prototype.kill=function(){this.stop(),delete this.nodeStates,this.killed=!0};var pl=gl,yl=function(){var t,e,r={};!function(){var t=10;r.exports=function(e,r,n){var i,o,a,s,h,u,d,c,l,f,g,p,y,v,m,b,w,E,A,x,z,M,S,D=r.length,N=n.length,k=e.adjustSizes,C=e.barnesHutTheta*e.barnesHutTheta,O=[];for(a=0;a<D;a+=t)r[a+4]=r[a+2],r[a+5]=r[a+3],r[a+2]=0,r[a+3]=0;if(e.outboundAttractionDistribution){for(g=0,a=0;a<D;a+=t)g+=r[a+6];g/=D/t}if(e.barnesHutOptimize){var W,j,_,P=1/0,U=-1/0,I=1/0,F=-1/0;for(a=0;a<D;a+=t)P=Math.min(P,r[a+0]),U=Math.max(U,r[a+0]),I=Math.min(I,r[a+1]),F=Math.max(F,r[a+1]);var T=U-P,L=F-I;for(T>L?F=(I-=(T-L)/2)+T:U=(P-=(L-T)/2)+L,O[0]=-1,O[1]=(P+U)/2,O[2]=(I+F)/2,O[3]=Math.max(U-P,F-I),O[4]=-1,O[5]=-1,O[6]=0,O[7]=0,O[8]=0,i=1,a=0;a<D;a+=t)for(o=0,_=3;;){if(!(O[o+5]>=0)){if(O[o+0]<0){O[o+0]=a;break}if(O[o+5]=9*i,c=O[o+3]/2,O[(l=O[o+5])+0]=-1,O[l+1]=O[o+1]-c,O[l+2]=O[o+2]-c,O[l+3]=c,O[l+4]=l+9,O[l+5]=-1,O[l+6]=0,O[l+7]=0,O[l+8]=0,O[(l+=9)+0]=-1,O[l+1]=O[o+1]-c,O[l+2]=O[o+2]+c,O[l+3]=c,O[l+4]=l+9,O[l+5]=-1,O[l+6]=0,O[l+7]=0,O[l+8]=0,O[(l+=9)+0]=-1,O[l+1]=O[o+1]+c,O[l+2]=O[o+2]-c,O[l+3]=c,O[l+4]=l+9,O[l+5]=-1,O[l+6]=0,O[l+7]=0,O[l+8]=0,O[(l+=9)+0]=-1,O[l+1]=O[o+1]+c,O[l+2]=O[o+2]+c,O[l+3]=c,O[l+4]=O[o+4],O[l+5]=-1,O[l+6]=0,O[l+7]=0,O[l+8]=0,i+=4,W=r[O[o+0]+0]<O[o+1]?r[O[o+0]+1]<O[o+2]?O[o+5]:O[o+5]+9:r[O[o+0]+1]<O[o+2]?O[o+5]+18:O[o+5]+27,O[o+6]=r[O[o+0]+6],O[o+7]=r[O[o+0]+0],O[o+8]=r[O[o+0]+1],O[W+0]=O[o+0],O[o+0]=-1,W===(j=r[a+0]<O[o+1]?r[a+1]<O[o+2]?O[o+5]:O[o+5]+9:r[a+1]<O[o+2]?O[o+5]+18:O[o+5]+27)){if(_--){o=W;continue}_=3;break}O[j+0]=a;break}W=r[a+0]<O[o+1]?r[a+1]<O[o+2]?O[o+5]:O[o+5]+9:r[a+1]<O[o+2]?O[o+5]+18:O[o+5]+27,O[o+7]=(O[o+7]*O[o+6]+r[a+0]*r[a+6])/(O[o+6]+r[a+6]),O[o+8]=(O[o+8]*O[o+6]+r[a+1]*r[a+6])/(O[o+6]+r[a+6]),O[o+6]+=r[a+6],o=W}}if(e.barnesHutOptimize){for(p=e.scalingRatio,a=0;a<D;a+=t)for(o=0;;)if(O[o+5]>=0){if(b=Math.pow(r[a+0]-O[o+7],2)+Math.pow(r[a+1]-O[o+8],2),4*(f=O[o+3])*f/b<C){if(y=r[a+0]-O[o+7],v=r[a+1]-O[o+8],!0===k?b>0?(w=p*r[a+6]*O[o+6]/b,r[a+2]+=y*w,r[a+3]+=v*w):b<0&&(w=-p*r[a+6]*O[o+6]/Math.sqrt(b),r[a+2]+=y*w,r[a+3]+=v*w):b>0&&(w=p*r[a+6]*O[o+6]/b,r[a+2]+=y*w,r[a+3]+=v*w),(o=O[o+4])<0)break;continue}o=O[o+5]}else if((u=O[o+0])>=0&&u!==a&&(b=(y=r[a+0]-r[u+0])*y+(v=r[a+1]-r[u+1])*v,!0===k?b>0?(w=p*r[a+6]*r[u+6]/b,r[a+2]+=y*w,r[a+3]+=v*w):b<0&&(w=-p*r[a+6]*r[u+6]/Math.sqrt(b),r[a+2]+=y*w,r[a+3]+=v*w):b>0&&(w=p*r[a+6]*r[u+6]/b,r[a+2]+=y*w,r[a+3]+=v*w)),(o=O[o+4])<0)break}else for(p=e.scalingRatio,s=0;s<D;s+=t)for(h=0;h<s;h+=t)y=r[s+0]-r[h+0],v=r[s+1]-r[h+1],!0===k?(b=Math.sqrt(y*y+v*v)-r[s+8]-r[h+8])>0?(w=p*r[s+6]*r[h+6]/b/b,r[s+2]+=y*w,r[s+3]+=v*w,r[h+2]-=y*w,r[h+3]-=v*w):b<0&&(w=100*p*r[s+6]*r[h+6],r[s+2]+=y*w,r[s+3]+=v*w,r[h+2]-=y*w,r[h+3]-=v*w):(b=Math.sqrt(y*y+v*v))>0&&(w=p*r[s+6]*r[h+6]/b/b,r[s+2]+=y*w,r[s+3]+=v*w,r[h+2]-=y*w,r[h+3]-=v*w);for(l=e.gravity/e.scalingRatio,p=e.scalingRatio,a=0;a<D;a+=t)w=0,y=r[a+0],v=r[a+1],b=Math.sqrt(Math.pow(y,2)+Math.pow(v,2)),e.strongGravityMode?b>0&&(w=p*r[a+6]*l):b>0&&(w=p*r[a+6]*l/b),r[a+2]-=y*w,r[a+3]-=v*w;for(p=1*(e.outboundAttractionDistribution?g:1),d=0;d<N;d+=3)s=n[d+0],h=n[d+1],c=n[d+2],m=Math.pow(c,e.edgeWeightInfluence),y=r[s+0]-r[h+0],v=r[s+1]-r[h+1],!0===k?(b=Math.sqrt(y*y+v*v)-r[s+8]-r[h+8],e.linLogMode?e.outboundAttractionDistribution?b>0&&(w=-p*m*Math.log(1+b)/b/r[s+6]):b>0&&(w=-p*m*Math.log(1+b)/b):e.outboundAttractionDistribution?b>0&&(w=-p*m/r[s+6]):b>0&&(w=-p*m)):(b=Math.sqrt(Math.pow(y,2)+Math.pow(v,2)),e.linLogMode?e.outboundAttractionDistribution?b>0&&(w=-p*m*Math.log(1+b)/b/r[s+6]):b>0&&(w=-p*m*Math.log(1+b)/b):e.outboundAttractionDistribution?(b=1,w=-p*m/r[s+6]):(b=1,w=-p*m)),b>0&&(r[s+2]+=y*w,r[s+3]+=v*w,r[h+2]-=y*w,r[h+3]-=v*w);if(!0===k)for(a=0;a<D;a+=t)1!==r[a+9]&&((E=Math.sqrt(Math.pow(r[a+2],2)+Math.pow(r[a+3],2)))>10&&(r[a+2]=10*r[a+2]/E,r[a+3]=10*r[a+3]/E),A=r[a+6]*Math.sqrt((r[a+4]-r[a+2])*(r[a+4]-r[a+2])+(r[a+5]-r[a+3])*(r[a+5]-r[a+3])),x=Math.sqrt((r[a+4]+r[a+2])*(r[a+4]+r[a+2])+(r[a+5]+r[a+3])*(r[a+5]+r[a+3]))/2,z=.1*Math.log(1+x)/(1+Math.sqrt(A)),M=r[a+0]+r[a+2]*(z/e.slowDown),r[a+0]=M,S=r[a+1]+r[a+3]*(z/e.slowDown),r[a+1]=S);else for(a=0;a<D;a+=t)1!==r[a+9]&&(A=r[a+6]*Math.sqrt((r[a+4]-r[a+2])*(r[a+4]-r[a+2])+(r[a+5]-r[a+3])*(r[a+5]-r[a+3])),x=Math.sqrt((r[a+4]+r[a+2])*(r[a+4]+r[a+2])+(r[a+5]+r[a+3])*(r[a+5]+r[a+3]))/2,z=r[a+7]*Math.log(1+x)/(1+Math.sqrt(A)),r[a+7]=Math.min(1,Math.sqrt(z*(Math.pow(r[a+2],2)+Math.pow(r[a+3],2))/(1+Math.sqrt(A)))),M=r[a+0]+r[a+2]*(z/e.slowDown),r[a+0]=M,S=r[a+1]+r[a+3]*(z/e.slowDown),r[a+1]=S);return{}}}();var n=r.exports;self.addEventListener("message",(function(r){var i=r.data;t=new Float32Array(i.nodes),i.edges&&(e=new Float32Array(i.edges)),n(i.settings,t,e),self.postMessage({nodes:t.buffer},[t.buffer])}))},vl=i,ml=Wi.createEdgeWeightGetter,bl=es,wl=rs;function El(t,e){if(e=e||{},!vl(t))throw new Error("graphology-layout-forceatlas2/worker: the given graph is not a valid graphology instance.");var r=ml("getEdgeWeight"in e?e.getEdgeWeight:"weight").fromEntry,n=bl.assign({},wl,e.settings),i=bl.validateSettings(n);if(i)throw new Error("graphology-layout-forceatlas2/worker: "+i.message);this.worker=null,this.graph=t,this.settings=n,this.getEdgeWeight=r,this.matrices=null,this.running=!1,this.killed=!1,this.outputReducer="function"==typeof e.outputReducer?e.outputReducer:null,this.handleMessage=this.handleMessage.bind(this);var o=void 0,a=this;this.handleGraphUpdate=function(){a.worker&&a.worker.terminate(),o&&clearTimeout(o),o=setTimeout((function(){o=void 0,a.spawnWorker()}),0)},t.on("nodeAdded",this.handleGraphUpdate),t.on("edgeAdded",this.handleGraphUpdate),t.on("nodeDropped",this.handleGraphUpdate),t.on("edgeDropped",this.handleGraphUpdate),this.spawnWorker()}El.prototype.isRunning=function(){return this.running},El.prototype.spawnWorker=function(){this.worker&&this.worker.terminate(),this.worker=bl.createWorker(yl),this.worker.addEventListener("message",this.handleMessage),this.running&&(this.running=!1,this.start())},El.prototype.handleMessage=function(t){if(this.running){var e=new Float32Array(t.data.nodes);bl.assignLayoutChanges(this.graph,e,this.outputReducer),this.outputReducer&&bl.readGraphPositions(this.graph,e),this.matrices.nodes=e,this.askForIterations()}},El.prototype.askForIterations=function(t){var e=this.matrices,r={settings:this.settings,nodes:e.nodes.buffer},n=[e.nodes.buffer];return t&&(r.edges=e.edges.buffer,n.push(e.edges.buffer)),this.worker.postMessage(r,n),this},El.prototype.start=function(){if(this.killed)throw new Error("graphology-layout-forceatlas2/worker.start: layout was killed.");return this.running||(this.matrices=bl.graphToByteArrays(this.graph,this.getEdgeWeight),this.running=!0,this.askForIterations(!0)),this},El.prototype.stop=function(){return this.running=!1,this},El.prototype.kill=function(){if(this.killed)return this;this.running=!1,this.killed=!0,this.matrices=null,this.worker.terminate(),this.graph.removeListener("nodeAdded",this.handleGraphUpdate),this.graph.removeListener("edgeAdded",this.handleGraphUpdate),this.graph.removeListener("nodeDropped",this.handleGraphUpdate),this.graph.removeListener("edgeDropped",this.handleGraphUpdate)};var Al=El,xl=function(){var t,e={};!function(){function t(){return.01*(.5-Math.random())}e.exports=function(e,r){var n,i,o,a,s,h,u=e.margin,d=e.ratio,c=e.expansion,l=e.gridSize,f=e.speed,g=!0,p=r.length,y=p/3|0,v=new Float32Array(y),m=new Float32Array(y),b=1/0,w=1/0,E=-1/0,A=-1/0;for(n=0;n<p;n+=3)o=r[n+0],a=r[n+1],h=r[n+2]*d+u,b=Math.min(b,o-h),E=Math.max(E,o+h),w=Math.min(w,a-h),A=Math.max(A,a+h);var x=E-b,z=A-w,M=(b+E)/2,S=(w+A)/2;b=M-c*x/2,E=M+c*x/2,w=S-c*z/2,A=S+c*z/2;var D,N,k,C,O,W,j,_,P,U,I,F,T=new Array(l*l),L=T.length;for(D=0;D<L;D++)T[D]=[];for(n=0;n<p;n+=3)for(o=r[n+0],a=r[n+1],N=o-(h=r[n+2]*d+u),k=o+h,C=a-h,O=a+h,W=Math.floor(l*(N-b)/(E-b)),j=Math.floor(l*(k-b)/(E-b)),_=Math.floor(l*(C-w)/(A-w)),P=Math.floor(l*(O-w)/(A-w)),U=W;U<=j;U++)for(I=_;I<=P;I++)T[U*l+I].push(n);var R,G,q,B,H,V,Y,K,$,X,J,Q,Z=new Set;for(D=0;D<L;D++)for(n=0,s=(F=T[D]).length;n<s;n++)for(q=r[(R=F[n])+0],H=r[R+1],Y=r[R+2],i=n+1;i<s;i++)G=F[i],$=R+"§"+G,L>1&&Z.has($)||(L>1&&Z.add($),B=r[G+0],V=r[G+1],K=r[G+2],X=B-q,J=V-H,(Q=Math.sqrt(X*X+J*J))<Y*d+u+(K*d+u)&&(g=!1,G=G/3|0,Q>0?(v[G]+=X/Q*(1+Y),m[G]+=J/Q*(1+Y)):(v[G]+=x*t(),m[G]+=z*t())));for(n=0,i=0;n<p;n+=3,i++)r[n+0]+=.1*v[i]*f,r[n+1]+=.1*m[i]*f;return{converged:g}}}();var r=e.exports;self.addEventListener("message",(function(e){var n=e.data;t=new Float32Array(n.nodes);var i=r(n.settings,t);self.postMessage({result:i,nodes:t.buffer},[t.buffer])}))},zl=i,Ml=ls,Sl=fs;function Dl(t,e){if(e=e||{},!zl(t))throw new Error("graphology-layout-noverlap/worker: the given graph is not a valid graphology instance.");var r=Object.assign({},Sl,e.settings),n=Ml.validateSettings(r);if(n)throw new Error("graphology-layout-noverlap/worker: "+n.message);this.worker=null,this.graph=t,this.settings=r,this.matrices=null,this.running=!1,this.killed=!1,this.inputReducer=e.inputReducer,this.outputReducer=e.outputReducer,this.callbacks={onConverged:"function"==typeof e.onConverged?e.onConverged:null},this.handleMessage=this.handleMessage.bind(this);var i=!1,o=this;this.handleAddition=function(){i||(i=!0,o.spawnWorker(),setTimeout((function(){i=!1}),0))},t.on("nodeAdded",this.handleAddition),t.on("edgeAdded",this.handleAddition),this.spawnWorker()}Dl.prototype.isRunning=function(){return this.running},Dl.prototype.spawnWorker=function(){this.worker&&this.worker.terminate(),this.worker=Ml.createWorker(xl),this.worker.addEventListener("message",this.handleMessage),this.running&&(this.running=!1,this.start())},Dl.prototype.handleMessage=function(t){if(this.running){var e=new Float32Array(t.data.nodes);if(Ml.assignLayoutChanges(this.graph,e,this.outputReducer),this.matrices.nodes=e,t.data.result.converged)return this.callbacks.onConverged&&this.callbacks.onConverged(),void this.stop();this.askForIterations()}},Dl.prototype.askForIterations=function(){var t=this.matrices,e={settings:this.settings,nodes:t.nodes.buffer},r=[t.nodes.buffer];return this.worker.postMessage(e,r),this},Dl.prototype.start=function(){if(this.killed)throw new Error("graphology-layout-noverlap/worker.start: layout was killed.");return this.running||(this.matrices={nodes:Ml.graphToByteArray(this.graph,this.inputReducer)},this.running=!0,this.askForIterations()),this},Dl.prototype.stop=function(){return this.running=!1,this},Dl.prototype.kill=function(){if(this.killed)return this;this.running=!1,this.killed=!0,this.matrices=null,this.worker.terminate(),this.graph.removeListener("nodeAdded",this.handleAddition),this.graph.removeListener("edgeAdded",this.handleAddition)};var Nl=Dl,kl={},Cl={cast:function(t,e){switch(t){case"boolean":e="true"===e;break;case"integer":case"long":case"float":case"double":e=+e;break;case"liststring":e=e?e.split("|"):[]}return e}},Ol=/["'<>&\s]/g;Cl.sanitizeTagName=function(t){return t.replace(Ol,"").trim()};var Wl=o,jl=so.mergeEdge,_l=ic,Pl=ac,Ul=Cl.cast;function Il(t,e){var r=t.getElementsByTagName("viz:"+e)[0];return r||(r=t.getElementsByTagNameNS("viz",e)[0]),r||(r=t.getElementsByTagName(e)[0]),r}function Fl(t){for(var e,r,n,i,o={},a={},s=0,h=t.length;s<h;s++)o[n=(e=t[s]).getAttribute("id")||e.getAttribute("for")]={id:n,type:e.getAttribute("type")||"string",title:(i=+n,i==i&&e.getAttribute("title")||n)},(r=e.getElementsByTagName("default")[0])&&(a[o[n].title]=Ul(o[n].type,r.textContent));return[o,a]}function Tl(t,e,r){var n={},i=r.getAttribute("label"),o=r.getAttribute("weight");i&&(n.label=i),o&&(n.weight=+o);for(var a,s,h,u=r.getElementsByTagName("attvalue"),d=0,c=u.length;d<c;d++)n[t[s=(a=u[d]).getAttribute("id")||a.getAttribute("for")].title]=Ul(t[s].type,a.getAttribute("value"));for(h in e)h in n||(n[h]=e[h]);var l,f,g,p=Il(r,"color");return p&&(n.color=function(t){var e=t.getAttribute("a"),r=t.getAttribute("r"),n=t.getAttribute("g"),i=t.getAttribute("b");return e?"rgba("+r+","+n+","+i+","+e+")":"rgb("+r+","+n+","+i+")"}(p)),(p=Il(r,"size"))&&(n.size=+p.getAttribute("value")),(p=Il(r,"position"))&&(l=p.getAttribute("x"),f=p.getAttribute("y"),g=p.getAttribute("z"),l&&(n.x=+l),f&&(n.y=+f),g&&(n.z=+g)),(p=Il(r,"shape"))&&(n.shape=p.getAttribute("value")),(p=Il(r,"thickness"))&&(n.thickness=+p.getAttribute("value")),n}var Ll=function(t,e){return function(r,n,i){var o,a,s,h,u,d,c,l,f,g,p=!0===(i=i||{}).addMissingNodes,y=n;if(!Wl(r))throw new Error("graphology-gexf/parser: invalid Graph constructor.");if("string"==typeof n&&(y=(new t).parseFromString(n,"application/xml")),!(y instanceof e))throw new Error("graphology-gexf/parser: source should either be a XML document or a string.");var v=y.getElementsByTagName("graph")[0],m=y.getElementsByTagName("meta")[0],b=m&&m.childNodes||[],w=y.getElementsByTagName("node"),E=y.getElementsByTagName("edge"),A=y.getElementsByTagName("attributes"),x=[],z=[];for(f=0,g=A.length;f<g;f++)"node"===(a=A[f]).getAttribute("class")?x=a.getElementsByTagName("attribute"):"edge"===a.getAttribute("class")&&(z=a.getElementsByTagName("attribute"));var M=v.getAttribute("defaultedgetype")||"undirected";"mutual"===M&&(M="undirected");var S=(s=Fl(x))[0],D=s[1],N=(s=Fl(z))[0],k=s[1],C=new r({type:E[0]?E[0].getAttribute("type")||M:"mixed"}),O=function(t){for(var e,r={},n=0,i=t.length;n<i;n++)"#text"!==(e=t[n]).nodeName&&e.textContent.trim()&&(r[e.tagName.toLowerCase()]=e.textContent);return r}(b),W=m&&m.getAttribute("lastmodifieddate");for(C.replaceAttributes(O),W&&C.setAttribute("lastModifiedDate",W),f=0,g=w.length;f<g;f++)a=w[f],C.addNode(a.getAttribute("id"),Tl(S,D,a));for(f=0,g=E.length;f<g;f++)if(d=(a=E[f]).getAttribute("id"),h=a.getAttribute("type")||M,c=a.getAttribute("source"),l=a.getAttribute("target"),u=Tl(N,k,a),h!==C.type&&"mixed"!==C.type&&(C=_l(C)),!C.multi&&("directed"===h&&C.hasDirectedEdge(c,l)||C.hasUndirectedEdge(c,l))&&(C=Pl(C)),o=jl(C,"directed"!==h,d||null,c,l,u),!p&&(o[2]||o[3]))throw new Error("graphology-gexf/parser: one of your gexf file edges points to an inexisting node. Set the parser `addMissingNodes` option to `true` if you do not care.");return C}},Rl=Ll(DOMParser,Document);function Gl(t){return"number"!=typeof t&&!t}function ql(t){if("string"==typeof t)return t;if("number"==typeof t)return t+"";if("function"==typeof t)return t();if(t instanceof Bl)return t.toString();throw Error("Bad Parameter")}function Bl(t,e){if(!(this instanceof Bl))return new Bl;this.name_regex=/[_:A-Za-z][-._:A-Za-z0-9]*/,this.indent=!!t,this.indentString=this.indent&&"string"==typeof t?t:" ",this.output="",this.stack=[],this.tags=0,this.attributes=0,this.attribute=0,this.texts=0,this.comment=0,this.dtd=0,this.root="",this.pi=0,this.cdata=0,this.started_write=!1,this.writer,this.writer_encoding="UTF-8",this.writer="function"==typeof e?e:function(t,e){this.output+=t}}Bl.prototype={toString:function(){return this.flush(),this.output},indenter:function(){if(this.indent){this.write("\n");for(var t=1;t<this.tags;t++)this.write(this.indentString)}},write:function(){for(var t=0;t<arguments.length;t++)this.writer(arguments[t],this.writer_encoding)},flush:function(){for(var t=this.tags;t>0;t--)this.endElement();this.tags=0},startDocument:function(t,e,r){return this.tags||this.attributes||(this.startPI("xml"),this.startAttribute("version"),this.text("string"==typeof t?t:"1.0"),this.endAttribute(),"string"==typeof e&&(this.startAttribute("encoding"),this.text(e),this.endAttribute(),this.writer_encoding=e),r&&(this.startAttribute("standalone"),this.text("yes"),this.endAttribute()),this.endPI(),this.indent||this.write("\n")),this},endDocument:function(){return this.attributes&&this.endAttributes(),this},writeElement:function(t,e){return this.startElement(t).text(e).endElement()},writeElementNS:function(t,e,r,n){return n||(n=r),this.startElementNS(t,e,r).text(n).endElement()},startElement:function(t){if(!(t=ql(t)).match(this.name_regex))throw Error("Invalid Parameter");if(0===this.tags&&this.root&&this.root!==t)throw Error("Invalid Parameter");return this.attributes&&this.endAttributes(),++this.tags,this.texts=0,this.stack.length>0&&(this.stack[this.stack.length-1].containsTag=!0),this.stack.push({name:t,tags:this.tags}),this.started_write&&this.indenter(),this.write("<",t),this.startAttributes(),this.started_write=!0,this},startElementNS:function(t,e,r){if(t=ql(t),e=ql(e),!t.match(this.name_regex))throw Error("Invalid Parameter");if(!e.match(this.name_regex))throw Error("Invalid Parameter");return this.attributes&&this.endAttributes(),++this.tags,this.texts=0,this.stack.length>0&&(this.stack[this.stack.length-1].containsTag=!0),this.stack.push({name:t+":"+e,tags:this.tags}),this.started_write&&this.indenter(),this.write("<",t+":"+e),this.startAttributes(),this.started_write=!0,this},endElement:function(){if(!this.tags)return this;var t=this.stack.pop();return this.attributes>0?(this.attribute&&(this.texts&&this.endAttribute(),this.endAttribute()),this.write("/"),this.endAttributes()):(t.containsTag&&this.indenter(),this.write("</",t.name,">")),--this.tags,this.texts=0,this},writeAttribute:function(t,e){return"function"==typeof e&&(e=e()),Gl(e)?this:this.startAttribute(t).text(e).endAttribute()},writeAttributeNS:function(t,e,r,n){return n||(n=r),"function"==typeof n&&(n=n()),Gl(n)?this:this.startAttributeNS(t,e,r).text(n).endAttribute()},startAttributes:function(){return this.attributes=1,this},endAttributes:function(){return this.attributes?(this.attribute&&this.endAttribute(),this.attributes=0,this.attribute=0,this.texts=0,this.write(">"),this):this},startAttribute:function(t){if(!(t=ql(t)).match(this.name_regex))throw Error("Invalid Parameter");return this.attributes||this.pi?(this.attribute||(this.attribute=1,this.write(" ",t,'="')),this):this},startAttributeNS:function(t,e,r){if(t=ql(t),e=ql(e),!t.match(this.name_regex))throw Error("Invalid Parameter");if(!e.match(this.name_regex))throw Error("Invalid Parameter");return this.attributes||this.pi?(this.attribute||(this.attribute=1,this.write(" ",t+":"+e,'="')),this):this},endAttribute:function(){return this.attribute?(this.attribute=0,this.texts=0,this.write('"'),this):this},text:function(t){return t=ql(t),this.tags||this.comment||this.pi||this.cdata?this.attributes&&this.attribute?(++this.texts,this.write(t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;").replace(/\t/g,"&#x9;").replace(/\n/g,"&#xA;").replace(/\r/g,"&#xD;")),this):(this.attributes&&!this.attribute&&this.endAttributes(),this.comment||this.cdata?this.write(t):this.write(t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")),++this.texts,this.started_write=!0,this):this},writeComment:function(t){return this.startComment().text(t).endComment()},startComment:function(){return this.comment||(this.attributes&&this.endAttributes(),this.indenter(),this.write("\x3c!--"),this.comment=1,this.started_write=!0),this},endComment:function(){return this.comment?(this.write("--\x3e"),this.comment=0,this):this},writeDocType:function(t,e,r,n){return this.startDocType(t,e,r,n).endDocType()},startDocType:function(t,e,r,n){if(this.dtd||this.tags)return this;if(t=ql(t),e=e?ql(e):e,r=r?ql(r):r,n=n?ql(n):n,!t.match(this.name_regex))throw Error("Invalid Parameter");if(e&&!e.match(/^[\w\-][\w\s\-\/\+\:\.]*/))throw Error("Invalid Parameter");if(r&&!r.match(/^[\w\.][\w\-\/\\\:\.]*/))throw Error("Invalid Parameter");if(n&&!n.match(/[\w\s\<\>\+\.\!\#\-\?\*\,\(\)\|]*/))throw Error("Invalid Parameter");return e=e?' PUBLIC "'+e+'"':r?" SYSTEM":"",r=r?' "'+r+'"':"",n=n?" ["+n+"]":"",this.started_write&&this.indenter(),this.write("<!DOCTYPE ",t,e,r,n),this.root=t,this.dtd=1,this.started_write=!0,this},endDocType:function(){return this.dtd?(this.write(">"),this):this},writePI:function(t,e){return this.startPI(t).text(e).endPI()},startPI:function(t){if(!(t=ql(t)).match(this.name_regex))throw Error("Invalid Parameter");return this.pi||(this.attributes&&this.endAttributes(),this.started_write&&this.indenter(),this.write("<?",t),this.pi=1,this.started_write=!0),this},endPI:function(){return this.pi?(this.write("?>"),this.pi=0,this):this},writeCData:function(t){return this.startCData().text(t).endCData()},startCData:function(){return this.cdata||(this.attributes&&this.endAttributes(),this.indenter(),this.write("<![CDATA["),this.cdata=1,this.started_write=!0),this},endCData:function(){return this.cdata?(this.write("]]>"),this.cdata=0,this):this},writeRaw:function(t){return t=ql(t),this.tags||this.comment||this.pi||this.cdata?this.attributes&&this.attribute?(++this.texts,this.write(t.replace("&","&amp;").replace('"',"&quot;")),this):(this.attributes&&!this.attribute&&this.endAttributes(),++this.texts,this.write(t),this.started_write=!0,this):this}};var Hl=i,Vl=yi,Yl=Bl,Kl=Cl.sanitizeTagName,$l=new Set(["color","size","x","y","z","shape","thickness"]),Xl=/^\s*rgba?\s*\(/i,Jl=/^\s*rgba?\s*\(\s*([0-9]*)\s*,\s*([0-9]*)\s*,\s*([0-9]*)\s*(?:,\s*([.0-9]*))?\)\s*$/;function Ql(t){if(!t||"string"!=typeof t)return{};if("#"===t[0])return 3===(t=t.slice(1)).length?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16)}:{r:parseInt(t[0]+t[1],16),g:parseInt(t[2]+t[3],16),b:parseInt(t[4]+t[5],16)};if(Xl.test(t)){var e={};return t=t.match(Jl),e.r=+t[1],e.g=+t[2],e.b=+t[3],t[4]&&(e.a=+t[4]),e}return{}}function Zl(t,e,r){var n,i={};for(n in r)"label"===n?i.label=r.label:"edge"===t&&"weight"===n?i.weight=r.weight:$l.has(n)?(i.viz=i.viz||{},i.viz[n]=r[n]):(i.attributes=i.attributes||{},i.attributes[n]=r[n]);return i}function tf(t){return null==t||""===t||t!=t}function ef(t,e){return"liststring"===t&&Array.isArray(e)?e.join("|"):""+e}function rf(t){for(var e,r,n,i,o,a={},s=0,h=t.length;s<h;s++)if(e=t[s].attributes)for(n in e)i=e[n],o=void 0,"empty"!==(r=tf(i)?"empty":Array.isArray(i)?"liststring":"boolean"==typeof i?"boolean":"object"==typeof i?"string":"number"==typeof i?i===(0|i)?(o=i)<=2147483647&&o>=-2147483647?"integer":"long":"double":"string")&&(a[n]?"integer"===a[n]&&"long"===r?a[n]=r:a[n]!==r&&(a[n]="string"):a[n]=r);return a}function nf(t,e,r){var n;if(Object.keys(e).length){for(n in t.startElement("attributes"),t.writeAttribute("class",r),e)t.startElement("attribute"),t.writeAttribute("id",n),t.writeAttribute("title",n),t.writeAttribute("type",e[n]),t.endElement();t.endElement()}}function of(t,e,r,n){var i,o,a,s,h,u,d,c,l,f,g,p=!Object.keys(r).length;for(t.startElement(e+"s"),f=0,g=n.length;f<g;f++){if(u=(i=n[f]).attributes,c=i.viz,t.startElement(e),t.writeAttribute("id",i.key),"edge"===e&&((h=i.undirected?"undirected":"directed")!==t.defaultEdgeType&&t.writeAttribute("type",h),t.writeAttribute("source",i.source),t.writeAttribute("target",i.target),("number"==typeof(d=i.weight)&&!isNaN(d)||"string"==typeof d)&&t.writeAttribute("weight",i.weight)),i.label&&t.writeAttribute("label",i.label),!p&&u){for(o in t.startElement("attvalues"),r)if(o in u){if(tf(s=u[o]))continue;t.startElement("attvalue"),t.writeAttribute("for",o),t.writeAttribute("value",ef(r[o],s)),t.endElement()}t.endElement()}if(c){if(c.color){for(l in a=Ql(c.color),t.startElementNS("viz","color"),a)t.writeAttribute(l,a[l]);t.endElement()}"size"in c&&(t.startElementNS("viz","size"),t.writeAttribute("value",c.size),t.endElement()),("x"in c||"y"in c||"z"in c)&&(t.startElementNS("viz","position"),"x"in c&&t.writeAttribute("x",c.x),"y"in c&&t.writeAttribute("y",c.y),"z"in c&&t.writeAttribute("z",c.z),t.endElement()),c.shape&&(t.startElementNS("viz","shape"),t.writeAttribute("value",c.shape),t.endElement()),"thickness"in c&&(t.startElementNS("viz","thickness"),t.writeAttribute("value",c.thickness),t.endElement())}t.endElement()}t.endElement()}var af={encoding:"UTF-8",pretty:!0,formatNode:Zl.bind(null,"node"),formatEdge:Zl.bind(null,"edge")};kl.parse=Rl,kl.write=function(t,e){if(!Hl(t))throw new Error("graphology-gexf/writer: invalid graphology instance.");var r=!1!==(e=e||{}).pretty&&" ",n=e.formatNode||af.formatNode,i=e.formatEdge||af.formatEdge,o=new Yl(r);o.startDocument("1.0",e.encoding||af.encoding),o.startElement("gexf"),o.writeAttribute("version","1.2"),o.writeAttribute("xmlns","http://www.gexf.net/1.2draft"),o.writeAttribute("xmlns:viz","http:///www.gexf.net/1.1draft/viz"),o.startElement("meta");var a,s,h=t.getAttributes();for(var u in h.lastModifiedDate&&o.writeAttribute("lastmodifieddate",h.lastModifiedDate),h)"lastModifiedDate"!==u&&(a=Kl(u))&&("string"!=typeof(s=h[u])&&"number"!=typeof s&&"boolean"!=typeof s||o.writeElement(a,""+s));o.endElement(),o.startElement("graph");var d=Vl(t);o.defaultEdgeType="mixed"===d?"directed":d,o.writeAttribute("defaultedgetype",o.defaultEdgeType);var c=function(t,e){var r=new Array(t.order),n=0;return t.forEachNode((function(t,i){var o=e(t,i);o.key=t,r[n++]=o})),r}(t,n),l=function(t,e){var r=new Array(t.size),n=0;return t.forEachEdge((function(t,i,o,a,s,h,u){var d=e(t,i);d.key=t,d.source=o,d.target=a,d.undirected=u,r[n++]=d})),r}(t,i),f=rf(c);nf(o,f,"node");var g=rf(l);return nf(o,g,"edge"),of(o,"node",f,c),of(o,"edge",g,l),o.toString()};var sf={},hf={};function uf(t){return("0"+(0|t).toString(16)).slice(-2)}hf.DEFAULT_FORMATTER=function(t){var e,r,n,i;return"number"==typeof t.r&&"number"==typeof t.g&&"number"==typeof t.b?((e=function(t){var e={};for(var r in t)"r"!==r&&"g"!==r&&"b"!==r&&(e[r]=t[r]);return e}(t)).color=(r=t.r,n=t.g,i=t.b,"#"+uf(r)+uf(n)+uf(i)),e):t};var df=o,cf=so.mergeEdge,lf=ic,ff=ac,gf=hf.DEFAULT_FORMATTER;function pf(t){return+t}var yf={boolean:function(t){return"true"===t.toLowerCase()},int:pf,long:pf,float:pf,double:pf,string:function(t){return t}};function vf(t,e,r){var n,i,o,a,s,h=r.getElementsByTagName("data"),u={};for(i=0,o=h.length;i<o;i++)void 0===(s=t[a=(n=h[i]).getAttribute("key")])?u[a]=n.textContent:u[s.name]=s.cast(n.textContent);for(a in e)a in u||(u[a]=e[a]);return u}var mf=function(t,e){return function(r,n,i){var o,a=!0===(i=i||{}).addMissingNodes,s=n;if(!df(r))throw new Error("graphology-graphml/parser: invalid Graph constructor.");if("string"==typeof n&&(s=(new t).parseFromString(n,"application/xml")),!(s instanceof e))throw new Error("graphology-gexf/parser: source should either be a XML document or a string.");var h=s.getElementsByTagName("graph")[0],u=function(t){for(var e,r=t.childNodes,n=[],i=0,o=r.length;i<o;i++)if(1===(e=r[i]).nodeType){if("data"!==e.tagName.toLowerCase())break;n.push(e)}return n}(h),d=s.getElementsByTagName("key"),c=s.getElementsByTagName("node"),l=s.getElementsByTagName("edge"),f=h.getAttribute("edgedefault")||"undirected",g=function(t){var e,r,n,i,o,a,s,h,u,d={graph:{},node:{},edge:{}},c={graph:{},node:{},edge:{}};for(e=0,r=t.length;e<r;e++)n=(s=t[e]).getAttribute("for")||"node",i=s.getAttribute("id"),o=s.getAttribute("attr.name"),a=s.getAttribute("attr.type")||"string",u=void 0,0!==(h=s.getElementsByTagName("default")).length&&(u=h[0].textContent),d[n][i]={name:o,cast:yf[a]},void 0!==u&&(c[n][o]=u);return{models:d,defaults:c}}(d),p=new r({type:f}),y=h.getAttribute("id");y&&p.setAttribute("id",y);var v=s.createElement("graph");u.forEach((function(t){v.appendChild(t)}));var m,b,w,E,A,x,z,M,S,D=vf(g.models.graph,g.defaults.graph,v);for(p.mergeAttributes(D),m=0,b=c.length;m<b;m++)E=(w=c[m]).getAttribute("id"),A=vf(g.models.node,g.defaults.node,w),A=gf(A),p.addNode(E,A);for(m=0,b=l.length;m<b;m++)if(E=(x=l[m]).getAttribute("id"),z=x.getAttribute("source"),M=x.getAttribute("target"),S="true"===x.getAttribute("directed")?"directed":f,A=vf(g.models.edge,g.defaults.edge,x),A=gf(A),"mixed"!==!p.type&&S!==p.type&&(p=lf(p)),p.multi||("undirected"===S?p.hasUndirectedEdge(z,M)&&(p=ff(p)):p.hasDirectedEdge(z,M)&&(p=ff(p))),o=cf(p,"undirected"===S,E||null,z,M,A),!a&&(o[2]||o[3]))throw new Error("graphology-graphml/parser: one of your graphml file edges points to an inexisting node. Set the parser `addMissingNodes` option to `true` if you do not care.");return p}},bf=mf(DOMParser,Document);sf.parse=bf;var wf=r.assertions=y,Ef=r.canvas=gi,Af=r.communitiesLouvain=io,xf=r.components=mo,zf=r.generators=ia,Mf=r.layout=Qa,Sf=r.layoutForce=Za,Df=r.layoutForceAtlas2=ds,Nf=r.layoutNoverlap=ws,kf=r.metrics=Hd,Cf=r.operators=lc,Of=r.shortestPath=Mc,Wf=r.simplePath=Wc,jf=r.traversal=tl,_f=r.utils=ol,Pf=r.ForceLayout=pl,Uf=r.FA2Layout=Al,If=r.NoverlapLayout=Nl,Ff=r.gexf=kl,Tf=r.graphml=sf;t.FA2Layout=Uf,t.ForceLayout=Pf,t.NoverlapLayout=If,t.assertions=wf,t.canvas=Ef,t.communitiesLouvain=Af,t.components=xf,t.default=r,t.generators=zf,t.gexf=Ff,t.graphml=Tf,t.layout=Mf,t.layoutForce=Sf,t.layoutForceAtlas2=Df,t.layoutNoverlap=Nf,t.metrics=kf,t.operators=Cf,t.shortestPath=Of,t.simplePath=Wf,t.traversal=jf,t.utils=_f,Object.defineProperty(t,"__esModule",{value:!0})}));
2
- //# sourceMappingURL=graphology-library.min.js.map